commit 8bb511014885a4003f6e178efdd7cfa6d6d464cc Author: mawkone Date: Fri Feb 27 12:01:08 2026 -0800 deploy: current vibn theia state Made-with: Cursor diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..38b8556 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,50 @@ +# Git +.git +.gitignore +.gitattributes + +# Documentation +*.md +docs/ + +# IDE +.vscode +.idea +*.swp +*.swo + +# Logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +# Testing +coverage/ +.nyc_output/ +test/ +tests/ +**/*.test.ts +**/*.spec.ts + +# Source maps not needed in production +**/*.js.map + +# Examples (except browser) +examples/api-provider-sample +examples/browser-only +examples/electron + +# Temporary files +tmp/ +temp/ +.cache/ + +# OS files +.DS_Store +Thumbs.db + +# Environment files +.env +.env.* +!.env.example diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..3f5be39 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,11 @@ +root = true + +[*] +end_of_line = lf +indent_style = space + +[*.{js,ts,tsx,md}] +indent_size = 4 + +[*.{json,yml}] +indent_size = 2 diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..91587a2 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +dev-packages/*/bin/*.js text eol=lf diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..eba2bb4 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1,5 @@ +# plugin +packages/plugin/** @theia-ide/plugin-system +packages/plugin-dev/** @theia-ide/plugin-system +packages/plugin-ext/** @theia-ide/plugin-system +packages/plugin-ext-vscode/** @theia-ide/plugin-system diff --git a/.github/DISCUSSION_TEMPLATE/general.yml b/.github/DISCUSSION_TEMPLATE/general.yml new file mode 100644 index 0000000..bb86e8e --- /dev/null +++ b/.github/DISCUSSION_TEMPLATE/general.yml @@ -0,0 +1,17 @@ +labels: [] +body: + - type: textarea + id: content + attributes: + label: Discussion + description: Share what's on your mind about Eclipse Theia. + placeholder: Start your discussion here... + validations: + required: true + + - type: markdown + attributes: + value: | + --- + + 💙 Eclipse Theia is community-supported. If you find it valuable, consider supporting the project: https://theia-ide.org/support/ diff --git a/.github/DISCUSSION_TEMPLATE/ideas.yml b/.github/DISCUSSION_TEMPLATE/ideas.yml new file mode 100644 index 0000000..87e40c4 --- /dev/null +++ b/.github/DISCUSSION_TEMPLATE/ideas.yml @@ -0,0 +1,17 @@ +labels: [] +body: + - type: textarea + id: idea + attributes: + label: Idea Description + description: Describe your idea for Eclipse Theia. + placeholder: Share your idea here... + validations: + required: true + + - type: markdown + attributes: + value: | + --- + + 💙 Eclipse Theia is community-supported. If you find it valuable, consider supporting the project: https://theia-ide.org/support/ diff --git a/.github/DISCUSSION_TEMPLATE/improvements.yml b/.github/DISCUSSION_TEMPLATE/improvements.yml new file mode 100644 index 0000000..8accc72 --- /dev/null +++ b/.github/DISCUSSION_TEMPLATE/improvements.yml @@ -0,0 +1,17 @@ +labels: [] +body: + - type: textarea + id: improvement + attributes: + label: Improvement Description + description: Describe the improvement you'd like to see in Eclipse Theia. + placeholder: Describe the improvement here... + validations: + required: true + + - type: markdown + attributes: + value: | + --- + + 💙 Eclipse Theia is community-supported. If you find it valuable, consider supporting the project: https://theia-ide.org/support/ diff --git a/.github/DISCUSSION_TEMPLATE/prompt-template-contribution.yml b/.github/DISCUSSION_TEMPLATE/prompt-template-contribution.yml new file mode 100644 index 0000000..c2fff07 --- /dev/null +++ b/.github/DISCUSSION_TEMPLATE/prompt-template-contribution.yml @@ -0,0 +1,93 @@ +title: "Prompt Template for " +body: + - type: textarea + id: what_template_does + attributes: + label: What Does This Template Do? + description: Provide a brief description of the prompt template. What problem does it solve? What specific functionality and agent does it enhance and how? + placeholder: Enter a description of the template. + validations: + required: true + + - type: textarea + id: prompt_template + attributes: + label: The Prompt Template + description: Paste your prompt template here as plain text. + placeholder: Enter the prompt template. + validations: + required: true + + - type: textarea + id: tested_llms + attributes: + label: Tested LLMs + description: List the language models this template has been tested with, including versions, providers, and notable performance observations. + placeholder: |- + - LLM Name & Version (e.g., OpenAI GPT-4) + - Provider (e.g., OpenAI, llama-file, Ollama) + - Observations or challenges + validations: + required: true + + - type: textarea + id: example_requests + attributes: + label: Example User Requests + description: Provide some example user requests tested with this template. + placeholder: |- + 1. Example Request 1: [User input] + 2. Example Request 2: [User input] + 3. Example Request 3: [User input] + validations: + required: true + + - type: textarea + id: improvement_suggestions + attributes: + label: Suggestions for Improvements (Optional) + description: Share any known limitations or ideas for improving the template. + placeholder: Describe any challenges or potential enhancements. + validations: + required: false + + - type: textarea + id: related_resources + attributes: + label: Related Discussions or Resources (Optional) + description: Link to any relevant discussions, documentation, or resources that could help others understand or improve your template. + placeholder: Provide URLs or references. + validations: + required: false + + - type: checkboxes + id: license_agreement + attributes: + label: License Agreement + description: By submitting this template, you agree to the following terms + options: + - label: | + By submitting this template, you agree to the following: + + 1. Your submission is contributed under the [MIT License](https://opensource.org/licenses/MIT). + 2. You certify that your contribution complies with the **Developer Certificate of Origin (DCO) Version 1.1**, outlined below: + + ### Developer Certificate of Origin 1.1 + + Copyright (C) 2004, 2006 The Linux Foundation and its contributors. + 660 York Street, Suite 102, San Francisco, CA 94110 USA + + Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. + + #### Developer's Certificate of Origin 1.1 + + By making a contribution to this project, I certify that: + + (a) The contribution was created in whole or in part by me and I have the right to submit it under the open-source license indicated in the file; or + (b) The contribution is based upon previous work that, to the best of my knowledge, is covered under an appropriate open-source license and I have the right under that license to submit that work with modifications, whether created in whole or in part by me, under the same open-source license (unless I am permitted to submit under a different license), as indicated in the file; or + (c) The contribution was provided directly to me by some other person who certified (a), (b), or (c) and I have not modified it. + + (d) I understand and agree that this project and the contribution are public and that a record of the contribution (including all personal information I submit with it, including my signoff) is maintained indefinitely and may be redistributed consistent with this project or the open-source license(s) involved. + + I agree to contribute this submission under the MIT License and certify compliance with the Developer Certificate of Origin (DCO) Version 1.1. + required: true diff --git a/.github/DISCUSSION_TEMPLATE/q-a.yml b/.github/DISCUSSION_TEMPLATE/q-a.yml new file mode 100644 index 0000000..4b7be70 --- /dev/null +++ b/.github/DISCUSSION_TEMPLATE/q-a.yml @@ -0,0 +1,17 @@ +labels: [] +body: + - type: textarea + id: question + attributes: + label: Question + description: What would you like to know about Eclipse Theia? + placeholder: Ask your question here... + validations: + required: true + + - type: markdown + attributes: + value: | + --- + + 💙 Eclipse Theia is community-supported. If you find it valuable, consider supporting the project: https://theia-ide.org/support/ diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..8e715fd --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,28 @@ +--- +name: Bug Report (except security vulnerabilities) +about: Create a report to help us improve +--- + + + + + + +### Bug Description: + + +### Steps to Reproduce: + +1. +2. +3. + + + + +### Additional Information + +- Operating System: +- Theia Version: + + diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000..4e2a344 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,5 @@ +blank_issues_enabled: false +contact_links: + - name: Question + url: https://github.com/eclipse-theia/theia/discussions + about: Please ask questions here. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000..0016772 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,14 @@ +--- +name: Feature Request +about: Propose an idea for the project +--- + + + + +### Feature Description: + + + + + diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..bdda07c --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,39 @@ + + +#### What it does + + + +#### How to test + + + +#### Follow-ups + + + +#### Breaking changes + +- [ ] This PR introduces breaking changes and requires careful review. If yes, the breaking changes section in the [changelog](https://github.com/eclipse-theia/theia/blob/master/CHANGELOG.md) has been updated. + +#### Attribution + + + +#### Review checklist + +- [ ] As an author, I have thoroughly tested my changes and carefully followed [the review guidelines](https://github.com/theia-ide/theia/blob/master/doc/pull-requests.md#requesting-a-review) +- [ ] User-facing text is internationalized using the `nls` service (for details, please see the [Internationalization/Localization section](https://github.com/theia-ide/theia/blob/master/doc/coding-guidelines.md#internationalizationlocalization) in the Coding Guidelines) + +#### Reminder for reviewers + +- As a reviewer, I agree to behave in accordance with [the review guidelines](https://github.com/theia-ide/theia/blob/master/doc/pull-requests.md#reviewing) diff --git a/.github/workflows/check-new-package.yml b/.github/workflows/check-new-package.yml new file mode 100644 index 0000000..6077520 --- /dev/null +++ b/.github/workflows/check-new-package.yml @@ -0,0 +1,97 @@ +name: Check New Theia Package + +on: + pull_request: + branches: [master] + types: [opened, synchronized, reopened] + paths: + - 'packages/*/package.json' + +permissions: + pull-requests: write + contents: read + +jobs: + detect-new-packages: + runs-on: ubuntu-22.04 + steps: + - name: Checkout + uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0 + with: + fetch-depth: 0 + + - name: Detect if a new package was added + id: detect + run: | + git fetch origin ${{ github.base_ref }} + NEW_PACKAGES=$(git diff --name-only --diff-filter=A origin/${{ github.base_ref }}...HEAD | grep -E '^packages/[^/]+/package\.json$' || true) + + if [ -z "$NEW_PACKAGES" ]; then + echo "new_package_found=false" >> $GITHUB_OUTPUT + echo "No new packages detected" + else + echo "new_package_found=true" >> $GITHUB_OUTPUT + PACKAGE_NAMES=$(echo "$NEW_PACKAGES" | sed 's|packages/\([^/]*\)/package\.json|\1|' | tr '\n' ',' | sed 's/,$//') + echo "package_names=$PACKAGE_NAMES" >> $GITHUB_OUTPUT + echo "New packages detected: $PACKAGE_NAMES" + fi + + - name: Post or update checklist comment + if: steps.detect.outputs.new_package_found == 'true' + uses: actions/github-script@ffc2c79a5b2490bd33e0a41c1de74b877714d736 # v3.2.0 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + const packageNames = '${{ steps.detect.outputs.package_names }}'; + const packageList = packageNames.split(',').map(name => `\`${name}\``).join(', '); + + const commentBody = ` + ### New \`@theia\` Package(s) Detected + + This PR adds the following new package(s): ${packageList} + + Please ensure the following checklist items are completed before merging: + + - [ ] \`package.json\` contains all required fields (name, version, description, license, etc.) and scripts + - [ ] \`README.md\` was added (please align with the existing README structure, e.g. [README.md](https://github.com/eclipse-theia/theia/blob/master/packages/editor/README.md)) + - [ ] Config files (\`tsconfig.json\`, \`.eslintrc.js\`) were added and align with the existing packages + - [ ] Folder structure follows Theia conventions (see [Code Organization](https://github.com/eclipse-theia/theia/blob/master/doc/code-organization.md)) + - [ ] Package is added to the example applications (i.e. \`browser\`, \`browser-only\`, \`electron\`) + - [ ] New packages must be published manually by a Theia committer initially (see also [Release Process - Newly added Theia packages](https://github.com/eclipse-theia/theia/blob/master/doc/Publishing.md#212-newly-added-theia-packages---publish-initially-to-npm)). + If you are not a committer or do not have enough time, please open a follow-up ticket with the label \`toDoWithRelease\` to inform the release team about the new package (see for example: ). + - [ ] If the package should also be part of the Theia IDE, please [open a ticket for the Theia IDE](https://github.com/eclipse-theia/theia-ide/issues/new?template=feature_request.md) + and assign the \`toDoWithRelease\` (see for example: ) + `; + + const issue_number = context.issue.number; + const owner = context.repo.owner; + const repo = context.repo.repo; + + const comments = await github.issues.listComments({ + owner, + repo, + issue_number + }); + + const botComment = comments.data.find(comment => + comment.user.type === 'Bot' && + comment.body.includes('New `@theia` Package(s) Detected') + ); + + if (botComment) { + await github.issues.updateComment({ + owner, + repo, + comment_id: botComment.id, + body: commentBody + }); + console.log('Updated existing comment'); + } else { + await github.issues.createComment({ + owner, + repo, + issue_number, + body: commentBody + }); + console.log('Created new comment'); + } diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml new file mode 100644 index 0000000..574b411 --- /dev/null +++ b/.github/workflows/ci-cd.yml @@ -0,0 +1,113 @@ +name: CI/CD + +on: + push: + branches: + - master + paths-ignore: + - '**/*.md' + - 'doc/**' + - 'logo/**' + workflow_dispatch: + pull_request: + branches: + - master + paths-ignore: + - '**/*.md' + - 'doc/**' + - 'logo/**' + +jobs: + + lint: + name: Lint + runs-on: ubuntu-22.04 + timeout-minutes: 60 + + steps: + - name: Checkout + uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0 + + - name: Use Node.js 22.x + uses: actions/setup-node@1a4442cacd436585916779262731d5b162bc6ec7 # v3.8.2 + with: + node-version: 22.x + registry-url: 'https://registry.npmjs.org' + + - name: Use Python 3.13 + uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 + with: + python-version: '3.13' + + - name: Install and Build + shell: bash + run: | + npm ci + ./scripts/check_git_status.sh + env: + NODE_OPTIONS: --max_old_space_size=4096 + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # https://github.com/microsoft/vscode-ripgrep/issues/9 + + - name: Lint + run: | + npm run lint + + build: + name: Build and Test (${{ matrix.os }}, node-${{ matrix.node }}) + + strategy: + fail-fast: false + matrix: + os: [windows-2022, ubuntu-22.04, macos-14] + node: [20.x, 22.x] + + runs-on: ${{ matrix.os }} + timeout-minutes: 60 + + steps: + - name: Checkout + uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0 + + - name: Use Node.js ${{ matrix.node }} + uses: actions/setup-node@1a4442cacd436585916779262731d5b162bc6ec7 # v3.8.2 + with: + node-version: ${{ matrix.node }} + registry-url: 'https://registry.npmjs.org' + + - name: Use Python 3.13 + uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 + with: + python-version: '3.13' + + - name: Build + shell: bash + run: | + npm ci + npm run build + git status + ./scripts/check_git_status.sh + env: + NODE_OPTIONS: --max_old_space_size=4096 + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # https://github.com/microsoft/vscode-ripgrep/issues/9 + + - name: Download Plugins + shell: bash + run: | + npm run download:plugins -- --rate-limit 3 + + - name: Test (headless) + if: matrix.tests != 'skip' + shell: bash + run: | + npm run rebuild:browser + npm run test:theia + + - name: Test (browser) + if: matrix.tests != 'skip' && matrix.node == '20.x' + run: | + npm run test:browser + + - name: Test (electron) + if: matrix.tests != 'skip' && runner.os == 'Linux' + run: | + xvfb-run -a npm run test:electron diff --git a/.github/workflows/discussion-welcome.yml b/.github/workflows/discussion-welcome.yml new file mode 100644 index 0000000..0446354 --- /dev/null +++ b/.github/workflows/discussion-welcome.yml @@ -0,0 +1,46 @@ +name: Welcome Discussion + +on: + discussion: + types: [created] + +permissions: + discussions: write + +jobs: + welcome: + runs-on: ubuntu-latest + steps: + - name: Add welcome comment + uses: actions/github-script@e69ef5462fd455e02edcaf4dd7708eda96b9eda0 # v7 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + const discussion = context.payload.discussion; + const author = discussion.user.login; + + const message = [ + `Hi @${author}, thanks for starting this discussion! 👋`, + '', + 'The Theia community will take a look soon. In the meantime, you might find helpful information in:', + '- 📖 [Theia Documentation](https://theia-ide.org/docs/)', + '- ❓ [FAQ](https://theia-ide.org/docs/faq/)', + '- 💬 [Previous Discussions](https://github.com/eclipse-theia/theia/discussions)', + '', + '---', + '', + '💙 Eclipse Theia is built and maintained by a community of contributors and sponsors. ' + + 'If Theia is valuable to your work, consider [sponsoring the project](https://theia-ide.org/support/). ' + + 'For professional support, training, or consulting services, [learn more about available options](https://theia-ide.org/support/).' + ].join('\n'); + + await github.graphql(` + mutation($discussionId: ID!, $body: String!) { + addDiscussionComment(input: {discussionId: $discussionId, body: $body}) { + clientMutationId + } + } + `, { + discussionId: discussion.node_id, + body: message + }); diff --git a/.github/workflows/generate-sbom.yml b/.github/workflows/generate-sbom.yml new file mode 100644 index 0000000..ff94988 --- /dev/null +++ b/.github/workflows/generate-sbom.yml @@ -0,0 +1,77 @@ +name: Generate NPM SBOM + +on: + release: + types: [published] + workflow_dispatch: + inputs: + version: + description: "Version" + default: "master" + required: true + +env: + NODE_VERSION: "20.x" + REGISTRY_URL: "https://registry.npmjs.org" + PRODUCT_PATH: "./" + CDXGEN_VERSION: "11.7.0" + +permissions: + contents: read + +jobs: + generate-sbom: + name: Generate SBOM + runs-on: ubuntu-22.04 + outputs: + project-version: ${{ steps.version.outputs.PROJECT_VERSION }} + permissions: + packages: read + + steps: + - name: Extract version + id: version + run: | + VERSION="${{ github.event_name == 'release' && github.event.release.tag_name || github.event.inputs.version }}" + echo "PROJECT_VERSION=$VERSION" >> $GITHUB_OUTPUT + echo "Product version: $VERSION" + + - name: Checkout repository + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + fetch-depth: 0 + ref: ${{ steps.version.outputs.PROJECT_VERSION }} + + - name: Setup Node SDK + uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4.2.0 + with: + node-version: ${{ env.NODE_VERSION }} + registry-url: ${{ env.REGISTRY_URL }} + + - name: Install dependencies + run: | + npm ci + + - name: Install cdxgen + run: | + npm install -g @cyclonedx/cdxgen@${{ env.CDXGEN_VERSION }} + + - name: Generate SBOM + run: | + cdxgen -r -o ${{ env.PRODUCT_PATH }}bom.json + + - name: Upload SBOM as artifact + uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0 + with: + name: sbom + path: ${{ env.PRODUCT_PATH }}/bom.json + + store-sbom-data: # stores sbom and metadata in a predefined format for otterdog to pick up + needs: ["generate-sbom"] + uses: eclipse-csi/workflows/.github/workflows/store-sbom-data.yml@main + with: + projectName: "theia" + projectVersion: ${{ needs.generate-sbom.outputs.project-version }} + bomArtifact: "sbom" + bomFilename: "bom.json" + parentProject: "2b55dbe6-7a7e-4659-a803-babf4138e03f" diff --git a/.github/workflows/license-check.yml b/.github/workflows/license-check.yml new file mode 100644 index 0000000..bb38729 --- /dev/null +++ b/.github/workflows/license-check.yml @@ -0,0 +1,54 @@ +name: 3PP License Check + +on: + push: + branches: + - master + paths: + - 'package-lock.json' + workflow_dispatch: + pull_request: + branches: + - master + paths: + - 'package-lock.json' + schedule: + - cron: '0 4 * * *' # Runs every day at 4am: https://docs.github.com/en/actions/reference/events-that-trigger-workflows#scheduled-events-schedule + +jobs: + License-check: + name: 3PP License Check + + strategy: + fail-fast: false + matrix: + os: [ubuntu-22.04] + node: ['22.x'] + java: ['11'] + + runs-on: ${{ matrix.os }} + timeout-minutes: 60 + + steps: + - name: Checkout + uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0 + with: + fetch-depth: 2 + + - name: Use Node.js ${{ matrix.node }} + uses: actions/setup-node@1a4442cacd436585916779262731d5b162bc6ec7 # v3.8.2 + with: + node-version: ${{ matrix.node }} + registry-url: 'https://registry.npmjs.org' + + - name: Use Java ${{ matrix.java }} + uses: actions/setup-java@1df8dbefe2a8cbc99770194893dd902763bee34b # v3.9.0 + with: + distribution: 'adopt' + java-version: ${{ matrix.java }} + + - name: Run dash-licenses check + shell: bash + run: | + npm ci + npm run license:check diff --git a/.github/workflows/native-dependencies.yml b/.github/workflows/native-dependencies.yml new file mode 100644 index 0000000..29e603d --- /dev/null +++ b/.github/workflows/native-dependencies.yml @@ -0,0 +1,50 @@ +name: Package Native Dependencies + +on: workflow_dispatch + +jobs: + build: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: ["ubuntu-22.04", "windows-latest", "macos-latest"] + steps: + - name: Checkout + uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0 + + # Update the node version here after every Electron upgrade + - name: Use Node.js v22.20.0 + uses: actions/setup-node@1a4442cacd436585916779262731d5b162bc6ec7 # v3.8.2 + with: + node-version: "22.20.0" + registry-url: "https://registry.npmjs.org" + + - name: Use Python 3.13 + uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 + with: + python-version: "3.13" + + - name: Install and Build + shell: bash + run: | + npm ci + env: + NODE_OPTIONS: --max_old_space_size=4096 + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # https://github.com/microsoft/vscode-ripgrep/issues/9 + + - name: Build Browser App + shell: bash + run: | + npm run build:browser + env: + NODE_OPTIONS: --max_old_space_size=4096 + + - name: Zip Native Dependencies + shell: bash + run: npm run zip:native:dependencies + + - name: Upload Artifacts + uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 #v4 + with: + name: native-dependencies-${{ matrix.os }} + path: ./scripts/native-dependencies-*.zip diff --git a/.github/workflows/performance-tests.yml b/.github/workflows/performance-tests.yml new file mode 100644 index 0000000..ed24d98 --- /dev/null +++ b/.github/workflows/performance-tests.yml @@ -0,0 +1,58 @@ +name: Performance Tests + +on: + workflow_dispatch: + +jobs: + build-and-test-performance: + name: Performance Tests + + runs-on: ubuntu-22.04 + timeout-minutes: 30 + + steps: + - name: Checkout + uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0 + + - name: Use Node.js 22.x + uses: actions/setup-node@1a4442cacd436585916779262731d5b162bc6ec7 # v3.8.2 + with: + node-version: "22.x" + registry-url: "https://registry.npmjs.org" + + - name: Use Python 3.13 + uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 + with: + python-version: '3.13' + + - name: Build + shell: bash + run: | + npm install -g node-gyp + npm ci + npm run build + env: + NODE_OPTIONS: --max_old_space_size=4096 + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # https://github.com/microsoft/vscode-ripgrep/issues/9 + + - name: Performance (browser) + shell: bash + run: npm run performance:startup:browser + + - name: Performance (Electron) + shell: bash + run: xvfb-run npm run performance:startup:electron + + - name: Analyze performance results + uses: benchmark-action/github-action-benchmark@fd31771ce86cc65eab85653da103f71ab1b4479c # v1.9.0 + with: + name: Performance Benchmarks + tool: "customSmallerIsBetter" + output-file-path: performance-result.json + alert-threshold: "150%" + fail-on-alert: false + github-token: ${{ secrets.GITHUB_TOKEN }} # Needed for comments an GH Pages + benchmark-data-dir-path: tests/performance + auto-push: true # Push to GH Pages + comment-on-alert: true # Comment on commit if it causes a performance regression + max-items-in-chart: 100 # Don't just collect results forever diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml new file mode 100644 index 0000000..17be5c0 --- /dev/null +++ b/.github/workflows/playwright.yml @@ -0,0 +1,77 @@ +name: Playwright Tests + +on: + push: + branches: + - master + paths-ignore: + - '**/*.md' + - 'doc/**' + - 'logo/**' + workflow_dispatch: + pull_request: + branches: + - master + paths-ignore: + - '**/*.md' + - 'doc/**' + - 'logo/**' + schedule: + - cron: "0 4 * * *" # Runs every day at 4am: https://docs.github.com/en/actions/reference/events-that-trigger-workflows#scheduled-events-schedule + +jobs: + build-and-test-playwright: + name: Playwright Tests (ubuntu-22.04, Node.js 22.x) + + runs-on: ubuntu-22.04 + timeout-minutes: 60 + + steps: + - name: Checkout + uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0 + + - name: Use Node.js "22.x" + uses: actions/setup-node@1a4442cacd436585916779262731d5b162bc6ec7 # v3.8.2 + with: + node-version: "22.x" + registry-url: "https://registry.npmjs.org" + + - name: Use Python 3.13 + uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 + with: + python-version: "3.13" + + - name: Install IPython Kernel + shell: bash + run: | + python3 -m pip install ipykernel==6.15.2 + python3 -m ipykernel install --user + + - name: Build Browser + shell: bash + run: | + npm ci + npm run build:browser + npm run download:plugins + env: + NODE_OPTIONS: --max_old_space_size=4096 + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # https://github.com/microsoft/vscode-ripgrep/issues/9 + + - name: Build Playwright + shell: bash + run: | + cd examples/playwright && npm run build + + - name: Test (playwright) + shell: bash + run: cd examples/playwright && npm run ui-tests-ci + + - name: Archive test results + uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 #v4 + if: ${{ !cancelled() }} + with: + name: playwright-test-results + path: | + examples/playwright/test-results/ + examples/playwright/playwright-report/ + retention-days: 7 diff --git a/.github/workflows/production-smoke-test.yml b/.github/workflows/production-smoke-test.yml new file mode 100644 index 0000000..21ba337 --- /dev/null +++ b/.github/workflows/production-smoke-test.yml @@ -0,0 +1,58 @@ +name: Production Build Smoke Test + +on: + push: + branches: + - master + paths-ignore: + - '**/*.md' + - 'doc/**' + - 'logo/**' + workflow_dispatch: + pull_request: + branches: + - master + paths-ignore: + - '**/*.md' + - 'doc/**' + - 'logo/**' + +jobs: + build-and-test-playwright: + name: Smoke Test for Browser Example Production Build on ubuntu-22.04 with Node.js 22.x + + runs-on: ubuntu-22.04 + timeout-minutes: 60 + + steps: + - name: Checkout + uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0 + + - name: Use Node.js "22.x" + uses: actions/setup-node@1a4442cacd436585916779262731d5b162bc6ec7 # v3.8.2 + with: + node-version: "22.x" + registry-url: "https://registry.npmjs.org" + + - name: Use Python 3.13 + uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 + with: + python-version: "3.13" + + - name: Build Browser Example Application for Production + shell: bash + run: | + npm ci + cd examples/browser && npm run build:production + env: + NODE_OPTIONS: --max_old_space_size=4096 + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # https://github.com/microsoft/vscode-ripgrep/issues/9 + + - name: Build Playwright + shell: bash + run: | + cd examples/playwright && npm run build + + - name: Run Smoke Test (examples/playwright/src/tests/theia-app) + shell: bash + run: npm run test:playwright -- theia-app diff --git a/.github/workflows/publish-api-doc-gh-pages.yml b/.github/workflows/publish-api-doc-gh-pages.yml new file mode 100644 index 0000000..26b3b16 --- /dev/null +++ b/.github/workflows/publish-api-doc-gh-pages.yml @@ -0,0 +1,55 @@ +name: Publish API Documentation on GitHub Pages + +permissions: + id-token: write + contents: write + +on: + workflow_dispatch: + +jobs: + publish: + name: Publish to NPM and GitHub pages + runs-on: ubuntu-22.04 + + # The current approach is silly. We should be smarter and use `actions/upload-artifact` and `actions/download-artifact` instead of rebuilding + # everything from scratch again. (git checkout, Node.js install, npm, etc.) It was not possible to share artifacts on Travis CI without an + # external storage (such as S3), so we did rebuild everything before the npm publish. We should overcome this limitation with GH Actions. + + steps: + - name: Checkout + uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0 + with: + fetch-depth: 0 # To fetch all history for all branches and tags. (Will be required for caching with lerna: https://github.com/markuplint/markuplint/pull/111) + + - name: Use Node.js 22.x + uses: actions/setup-node@1a4442cacd436585916779262731d5b162bc6ec7 # v3.8.2 + with: + node-version: "22.x" + registry-url: "https://registry.npmjs.org" + + - name: Use Python 3.13 + uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 + with: + python-version: "3.13" + + - name: Install and Build + run: | + npm ci + npm run build + env: + NODE_OPTIONS: --max_old_space_size=4096 + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # https://github.com/microsoft/vscode-ripgrep/issues/9 + + - name: Generate Documentation + run: | + npm run docs + env: + NODE_OPTIONS: --max_old_space_size=8192 + + - name: Publish GH Pages + uses: peaceiris/actions-gh-pages@373f7f263a76c20808c831209c920827a82a2847 # v3.9.3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./gh-pages + force_orphan: true # will only keep latest commit on branch gh-pages diff --git a/.github/workflows/publish-ci.yml b/.github/workflows/publish-ci.yml new file mode 100644 index 0000000..114b751 --- /dev/null +++ b/.github/workflows/publish-ci.yml @@ -0,0 +1,161 @@ +name: Publish packages to NPM + +permissions: + id-token: write + contents: write + pull-requests: write + +on: + workflow_dispatch: + inputs: + release_type: + description: 'Release type: "minor" increments the minor version (e.g., 1.53.0 → 1.54.0), "patch" increments the patch version (e.g., 1.54.0 → 1.54.1), "next" publishes a pre-release version (e.g., 1.55.0-next.17).' + required: true + type: choice + options: + - 'minor' + - 'patch' + - 'next' + default: 'next' + is_patch_to_previous: + description: 'Patch a previous release branch: Enable this to publish a patch to an older version branch (e.g., patching 1.53.x when 1.54.x is the latest). Must be used with release_type="patch". Leave disabled for publishing to the current latest or next version.' + required: true + type: boolean + default: false + schedule: + - cron: "0 0 * * 1" # Publish next version (default) every monday at midnight + +jobs: + publish: + name: Perform Publishing + runs-on: ubuntu-22.04 + timeout-minutes: 60 + env: + RELEASE_TYPE: ${{ inputs.release_type || 'next' }} + IS_PATCH_TO_PREVIOUS: ${{ inputs.is_patch_to_previous || false }} + steps: + - name: Validate Inputs + shell: bash + run: | + if [[ "${{ env.IS_PATCH_TO_PREVIOUS }}" == "true" && "${{ env.RELEASE_TYPE }}" != "patch" ]]; then + echo "Error: When 'is_patch_to_previous' is enabled, release_type must be 'patch'" + exit 1 + fi + echo "Input validation passed" + echo "Release type: ${{ env.RELEASE_TYPE }}" + echo "Is patch to previous: ${{ env.IS_PATCH_TO_PREVIOUS }}" + + - name: Checkout + uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0 + with: + # To fetch all history for all branches and tags. + # Required for lerna to determine the version of the next package. + fetch-depth: 0 + + - name: Use Node.js 22.x + uses: actions/setup-node@1a4442cacd436585916779262731d5b162bc6ec7 # v3.8.2 + with: + node-version: 22.x + registry-url: "https://registry.npmjs.org" + + - name: Use Python 3.13 + uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 + with: + python-version: "3.13" + + - name: Install and build + shell: bash + run: | + npm ci + npm run build + env: + NODE_OPTIONS: --max_old_space_size=4096 + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # https://github.com/microsoft/vscode-ripgrep/issues/9 + + - name: Publish to NPM (Latest) + # We only publish minor or patch releases for the current version as latest, never for older patches or next versions. + if: ${{ (env.RELEASE_TYPE == 'patch' || env.RELEASE_TYPE == 'minor') && env.IS_PATCH_TO_PREVIOUS == 'false' }} + shell: bash + run: | + npm run publish:latest ${{ env.RELEASE_TYPE }} + npm run publish:check + env: + NPM_CONFIG_PROVENANCE: "true" + + - name: Publish to NPM (Patch - To Previous Version) + if: ${{ env.RELEASE_TYPE == 'patch' && env.IS_PATCH_TO_PREVIOUS == 'true' }} + shell: bash + run: | + npm run publish:patch ${{ env.RELEASE_TYPE }} + npm run publish:check + env: + NPM_CONFIG_PROVENANCE: "true" + + - name: Publish to NPM (Next) + if: ${{ env.RELEASE_TYPE == 'next' }} + shell: bash + run: | + npm run publish:next + env: + NPM_CONFIG_PROVENANCE: "true" + + - name: Submit PR for package updates + if: ${{ env.RELEASE_TYPE != 'next' }} + shell: bash + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + # Configure git + git config --local user.email "eclipse-theia-bot@eclipse.org" + git config --local user.name "eclipse-theia-bot" + + # Get the version from lerna.json after publishing + VERSION=$(node -p "require('./lerna.json').version") + echo "Lerna Version: $VERSION" + + # First commit: Update packages/core/README.md + if git diff --name-only | grep -q "packages/core/README.md"; then + git add packages/core/README.md + git commit -m "core: update re-exports for v${VERSION}" + echo "First commit created for packages/core/README.md" + else + echo "No changes to packages/core/README.md" + fi + + # Second commit: Add all other changes + git add . + if git diff --staged --quiet; then + echo "No other changes to commit" + else + git commit -m "v${VERSION}" + echo "Second commit created for remaining changes" + fi + + # Submit PR + if git log origin/${{ github.ref_name }}..HEAD | grep -q "commit"; then + # Define PR body + PR_BODY="Automated package updates for release v${VERSION} + + To complete the release: + - Update all remaining package versions locally + - Amend the commits with your author details (to ensure the ECA check passes) + - Keep the commits split (the re-export commit on the readme needs to be separate) + - Force push the branch + - Verify that all checks pass, and then \`rebase and merge\`" + + # Create a new branch for the PR + BRANCH_NAME="${{ github.ref_name }}-package-updates" + git checkout -b "$BRANCH_NAME" + git push origin "$BRANCH_NAME" + + # Create PR using GitHub CLI + gh pr create \ + --title "Release v${VERSION} - Package updates" \ + --body "$PR_BODY" \ + --base "${{ github.ref_name }}" \ + --head "$BRANCH_NAME" + + echo "PR created for branch $BRANCH_NAME" + else + echo "No commits to push" + fi diff --git a/.github/workflows/set-milestone-on-pr.yml b/.github/workflows/set-milestone-on-pr.yml new file mode 100644 index 0000000..ff31f10 --- /dev/null +++ b/.github/workflows/set-milestone-on-pr.yml @@ -0,0 +1,60 @@ +# +# Copyright (c) 2020 Red Hat, Inc. and others. +# This program and the accompanying materials are made available under the +# terms of the Eclipse Public License v. 2.0 which is available at +# http://www.eclipse.org/legal/epl-2.0. +# +# This Source Code may also be made available under the following Secondary +# Licenses when the conditions for such availability set forth in the Eclipse +# Public License v. 2.0 are satisfied: GNU General Public License, version 2 +# with the GNU Classpath Exception which is available at +# https://www.gnu.org/software/classpath/license.html. +# +# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 + +# Set milestone on each pull request by using the next minor version +# next version is computed using npm version tool +on: + pull_request_target: + branches: [master] + types: [closed] + +jobs: + set-milestone: + if: github.event.pull_request.merged == true + runs-on: ubuntu-22.04 + steps: + - name: Checkout code + uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0 + - id: compute-milestone + run: | + export THEIA_CORE_VERSION=$(node -p "require(\"./packages/core/package.json\").version") + echo "MILESTONE_NUMBER=$(npx -q semver@7 --increment minor $THEIA_CORE_VERSION)" >> $GITHUB_ENV + - id: set + uses: actions/github-script@ffc2c79a5b2490bd33e0a41c1de74b877714d736 # v3.2.0 + with: + github-token: ${{secrets.GITHUB_TOKEN}} + script: | + // get milestone + const milestone = process.env.MILESTONE_NUMBER + console.log(`Using milestone with name ${milestone}`) + // check if milestone exists ? + const issuesGetMilestonesParams = context.repo + + // search if milestone is already defined + const response = await github.issues.listMilestones(issuesGetMilestonesParams) + let githubMilestone = response.data.find(milestoneResponse => milestoneResponse.title === milestone) + + // not defined, create it + if (!githubMilestone) { + const issuesCreateMilestoneParams = { owner: context.repo.owner, repo:context.repo.repo, title: milestone } + const createMilestoneResponse = await github.issues.createMilestone(issuesCreateMilestoneParams) + githubMilestone = createMilestoneResponse.data + } + + // Grab the milestone number + const milestoneNumber = githubMilestone.number + + // sets the milestone from the number + const issuesUpdateParams = { owner: context.repo.owner, repo: context.repo.repo, milestone: milestoneNumber, issue_number: context.issue.number } + await github.issues.update(issuesUpdateParams) diff --git a/.github/workflows/translation.yml b/.github/workflows/translation.yml new file mode 100644 index 0000000..2c88084 --- /dev/null +++ b/.github/workflows/translation.yml @@ -0,0 +1,64 @@ +name: Automatic Translation + +on: workflow_dispatch + +jobs: + translation: + name: Translation Update + runs-on: ubuntu-22.04 + timeout-minutes: 60 + + steps: + - name: Checkout + uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0 + + - name: Use Node.js 22.x + uses: actions/setup-node@1a4442cacd436585916779262731d5b162bc6ec7 # v3.8.2 + with: + node-version: 22.x + registry-url: "https://registry.npmjs.org" + + - name: Use Python 3.13 + uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 + with: + python-version: "3.13" + + - name: Install and Build + shell: bash + run: | + npm ci + npm run build + env: + NODE_OPTIONS: --max_old_space_size=4096 + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # https://github.com/microsoft/vscode-ripgrep/issues/9 + + - id: compute-next-version + run: | + export THEIA_CORE_VERSION=$(node -p "require(\"./packages/core/package.json\").version") + echo "NEXT_VERSION_NUMBER=$(npx -q semver@7 --increment minor $THEIA_CORE_VERSION)" >> $GITHUB_ENV + + - name: Perform Automatic Translation + run: | + node ./scripts/translation-update.js + env: + DEEPL_API_TOKEN: ${{ secrets.DEEPL_API_TOKEN }} + + - name: Get Actor User Data + uses: octokit/request-action@21d174fc38ff59af9cf4d7e07347d29df6dbaa99 # v2.3.0 + id: actor_user_data + with: + route: GET /users/{user} + user: ${{ github.actor }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Create Pull Request + uses: peter-evans/create-pull-request@6d6857d36972b65feb161a90e484f2984215f83e # v6.0.5 + with: + commiter: ${{ github.actor }} <${{ fromJson(steps.actor_user_data.outputs.data).email }}> + author: ${{ github.actor }} <${{ fromJson(steps.actor_user_data.outputs.data).email }}> + branch: bot/translation-update + title: Translation update for version ${{ env.NEXT_VERSION_NUMBER }} + commit-message: Translation update for version ${{ env.NEXT_VERSION_NUMBER }} + body: Automated translation update for Theia version ${{ env.NEXT_VERSION_NUMBER }}. Triggered by @${{ github.actor }}. + labels: localization diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7c7e9cb --- /dev/null +++ b/.gitignore @@ -0,0 +1,40 @@ +.DS_Store +node_modules +build +lib +tmp +*.log +.idea +.metadata +*.iml +jdt.ls-java-project +lerna-debug.log +.nyc_output +coverage +errorShots +examples/*/src-gen +examples/*/gen-webpack.config.js +examples/*/gen-webpack.node.config.js +examples/*/.test +.browser_modules +**/docs/api +package-backup.json +.history +.Trash-* +packages/plugin/typedoc +plugins +gh-pages +.vscode/ipch +dev-packages/electron/compile_commands.json +*.tsbuildinfo +.eslintcache +*-trace.json +.tours +/performance-result.json +*.vsix +/scripts/native-dependencies-* +allure-results +.claude +license-check-summary.txt* +.playwright-mcp/* +/.theia/chatSessions diff --git a/.npmignore b/.npmignore new file mode 100644 index 0000000..3564694 --- /dev/null +++ b/.npmignore @@ -0,0 +1,15 @@ +.DS_Store +node_modules +build +*.log +.idea +.metadata +jdt.ls-java-project +lerna-debug.log +.nyc_output +coverage +.browser_modules +download +*ui-spec.ts +*slow-spec.ts +test-resources diff --git a/.prompts/customAgents.yml b/.prompts/customAgents.yml new file mode 100644 index 0000000..9f3463e --- /dev/null +++ b/.prompts/customAgents.yml @@ -0,0 +1,3 @@ +# Vibn custom agents are implemented as TypeScript extensions in packages/ai-ide/ +# The primary agent is the built-in "Coder" agent with "Code OS" mode. +# No YAML-defined agents are needed — this file intentionally left empty. diff --git a/.prompts/project-info.prompttemplate b/.prompts/project-info.prompttemplate new file mode 100644 index 0000000..2d2df1a --- /dev/null +++ b/.prompts/project-info.prompttemplate @@ -0,0 +1,116 @@ +## Theia Project Information + +This section contains informations specific about the Theia Project and code base, which the user is currenty working on. + +### Architecture overview + +Theia has a modular architecture and consists of so-called "Theia extensions", which are technically node packages. +Most features and generally the source code can be found under "/packages/" which hosts a list of Theia extensions for different sorts of features. +Theia applications can be used in the browser or (via Electron) on the desktop, but generally have a front end (browser application) and a backend part (node application). +Therefore, extensions can contribute to the front end and the backend. This is reflected in the folder structure of extensions: +- src/browser: Frontend part of an extensions +- src/node: Backend part of an extension. +- src/common: Common/shared components, interfaces and protocol information for front end back end communication + +Theia uses dependency injection (via inversify) to wired components. If a class is contributed via dependency injection it needs to be bound in the corresponding frontend or +backend module (which usually already exists in existing packages) + +#### Widgets + +Widgets are views that are visible in the workbench of a Theia-based application. + +#### Commands + +Commands in Theia are actions that can be executed by users and programmatically. They are registered through the `CommandRegistry` and can be triggered via menus, +keybindings, or other UI elements such as toolbar items. + +Commands are contributed via `CommandContribution`, see for example: packages/ai-chat-ui/src/browser/chat-view-widget-toolbar-contribution.tsx + +#### Toolbars + +Toolbars in Theia are UI components that provide quick access to commonly used commands. They can be added to various parts of the workbench including the main toolbar, + and custom widget toolbars. + +Toolbars are typically contributed through: +- `TabBarToolbarContribution`: For adding toolbar items to tab bars +- `ToolbarContribution`: For contributing to main application toolbars +ToolbarContributions are located in separate files. +Browse the following file for an example: packages/ai-chat-ui/src/browser/chat-view-widget-toolbar-contribution.tsx + +### Coding Guidelines + +- Trailing white spaces and empty lines with white spaces are forbidden +- Use constants for values that never get reassigned +- The use of `null` is forbidden. Use `undefined` instead for representing absent or uninitialized values. +- Use single quotes (`'`) for string literals instead of double quotes (`"`). +- Use Theia's Event/Emitter/Disposable for handling event listener patterns + +### Test File References + +When writing new tests, refer to the following files to see example tests and ensure consistency in style and methodology within the project: + +- **Backend Test Example**: `packages/core/src/common/content-replacer.spec.ts` +- **Frontend Test Example**: `packages/ai-code-completion/src/browser/code-completion-postprocessor.spec.ts` + +Tests are located in the same directory as the components under test. + +### Compile and Test + +If you want to compile something, run the linter or tests, prefer to execute them for changed packages first, as they will run faster. Only build the full project once you are +done for a final validation. + +### Preferences + +Theia uses a preferences system for user/workspace settings. To add new preferences: + +1. Define a `PreferenceSchema` with property definitions (type, default, description) +2. Create a `PreferenceContribution` symbol and bind it +3. Use `PreferenceProxy` for type-safe access to preference values + +**Example:** `packages/workspace/src/common/workspace-trust-preferences.ts` + +### Plugin API Extensions + +To extend the plugin API (VS Code compatible API): + +1. **Type definitions:** Add to `packages/plugin/src/theia.d.ts` +2. **Plugin-side implementation:** `packages/plugin-ext/src/plugin/` (e.g., `workspace.ts`) +3. **Main-side implementation:** `packages/plugin-ext/src/main/browser/` (e.g., `workspace-main.ts`) +4. **RPC protocol:** Define in `packages/plugin-ext/src/common/plugin-api-rpc.ts` +5. **Expose to plugins:** `packages/plugin-ext/src/plugin/plugin-context.ts` + +Events flow: Main side service → `workspace-main.ts` → RPC → `workspace.ts` → plugin context + +#### Proposed APIs + +For APIs that are not yet stable, Theia follows VS Code's proposed API pattern: + +1. **Define proposed types:** Create `packages/plugin/src/theia.proposed..d.ts` +2. **Enable via package.json:** Extensions must declare `enabledApiProposals` in their package.json +3. **Implementation:** Same as stable APIs, but types come from the proposed file + +Note: Some VS Code APIs that were previously "proposed" are now stable (e.g., workspace trust). Check VS Code's current API status before creating proposed API files. + +### Styling + +Theia permits extensive color theming and makes extensive use of CSS variables. Styles are typically located either in an `index.css` file for an entire package or in a +module-level CSS file. + +- **Color variable contribution example**: `packages/core/src/browser/common-frontend-contribution.ts` +- **Package-level CSS example**: `packages/ai-ide/src/browser/style/index.css` +- **Module-specific CSS example**: `packages/core/src/browser/style/tabs.css` + +### FileService and Filesystem Access (Browser Mode) + +The `FileService` in browser mode communicates with the backend via RPC and has **restricted filesystem access**: + +- **Accessible paths:** Files within the current workspace directory or the Theia user config directory (e.g., `~/.theia/`) +- **Inaccessible paths:** Arbitrary filesystem paths outside these boundaries (e.g., `/tmp/`, `/etc/`) + +When implementing browser-side services that need to read files from user-configured directories: +1. Use `FileService` from `@theia/filesystem/lib/browser/file-service` +2. Convert paths to URIs using `URI.fromFilePath(path)` +3. Expect `fileService.exists()` to return `false` for paths outside allowed boundaries +4. Document that users should configure paths within their workspace or config directory + +**Reference implementation:** `packages/ai-core/src/browser/skill-service.ts` and `packages/ai-core/src/browser/frontend-prompt-customization-service.ts` diff --git a/.theia/settings.json b/.theia/settings.json new file mode 100644 index 0000000..d687232 --- /dev/null +++ b/.theia/settings.json @@ -0,0 +1,23 @@ +{ + "editor.formatOnSave": true, + "editor.insertSpaces": true, + "[typescript]": { + "editor.tabSize": 4 + }, + "[json]": { + "editor.tabSize": 2 + }, + "[jsonc]": { + "editor.tabSize": 2 + }, + "typescript.tsdk": "node_modules/typescript/lib", + "clang-format.language.typescript.enable": false, + "[markdown]": { + "editor.defaultFormatter": "davidanson.vscode-markdownlint" + }, + "markdownlint.config": { + "MD032": false, // don't require blank line around lists + "MD033": false, // allow inline html + "MD041": false // don't require h1 in first line + }, +} diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json new file mode 100644 index 0000000..e96cedc --- /dev/null +++ b/.vscode/c_cpp_properties.json @@ -0,0 +1,26 @@ +{ + "configurations": [ + { + "name": "@theia/electron (Linux)", + "compileCommands": "${workspaceFolder}/dev-packages/electron/compile_commands.json", + "defines": [], + "cStandard": "c89", + "intelliSenseMode": "${default}" + }, + { + "name": "@theia/electron Debug (Windows)", + "compileCommands": "${workspaceFolder}\\dev-packages\\electron\\Debug\\compile_commands.json", + "defines": [], + "cStandard": "c89", + "intelliSenseMode": "${default}" + }, + { + "name": "@theia/electron Release (Windows)", + "compileCommands": "${workspaceFolder}\\dev-packages\\electron\\Release\\compile_commands.json", + "defines": [], + "cStandard": "c89", + "intelliSenseMode": "${default}" + } + ], + "version": 4 +} diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000..4f803f4 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,11 @@ +{ + // See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations. + // Extension identifier format: ${publisher}.${name}. Example: vscode.csharp + // List of extensions which should be recommended for users of this workspace. + "recommendations": [ + "dbaeumer.vscode-eslint", + "DavidAnson.vscode-markdownlint" + ], + // List of extensions recommended by VS Code that should not be recommended for users of this workspace. + "unwantedRecommendations": [] +} diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..ee1cb6b --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,191 @@ +{ + // Use IntelliSense to learn about possible Node.js debug attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "Playwright Tests", + "type": "node", + "request": "launch", + "program": "${workspaceFolder}/node_modules/@playwright/test/cli.js", + "cwd": "${workspaceFolder}/examples/playwright", + "args": [ + "test", + "--config=./configs/playwright.config.ts" + ] + }, + { + "type": "node", + "request": "attach", + "name": "Attach by Process ID", + "processId": "${command:PickProcess}" + }, + { + "type": "node", + "request": "launch", + "name": "Launch with Node.js", + "program": "${file}" + }, + { + "type": "node", + "request": "launch", + "name": "Launch Electron Backend", + "runtimeExecutable": "${workspaceFolder}/node_modules/.bin/electron", + "windows": { + "runtimeExecutable": "${workspaceFolder}/node_modules/.bin/electron.cmd" + }, + "cwd": "${workspaceFolder}/examples/electron", + "protocol": "inspector", + "args": [ + ".", + "--log-level=debug", + "--hostname=localhost", + "--no-cluster", + "--app-project-path=${workspaceFolder}/examples/electron", + "--remote-debugging-port=9222", + "--no-app-auto-install", + "--plugins=local-dir:../../plugins", + "--ovsx-router-config=${workspaceFolder}/examples/ovsx-router-config.json" + ], + "env": { + "NODE_ENV": "development" + }, + "sourceMaps": true, + "outFiles": [ + "${workspaceFolder}/examples/electron/lib/backend/electron-main.js", + "${workspaceFolder}/examples/electron/lib/backend/main.js", + "${workspaceFolder}/examples/electron/lib/**/*.js", + "${workspaceFolder}/examples/api-samples/lib/**/*.js", + "${workspaceFolder}/packages/*/lib/**/*.js", + "${workspaceFolder}/dev-packages/*/lib/**/*.js" + ], + "smartStep": true, + "internalConsoleOptions": "openOnSessionStart", + "outputCapture": "std" + }, + { + "type": "node", + "request": "launch", + "name": "Launch Browser Backend", + "program": "${workspaceFolder}/examples/browser/lib/backend/main.js", + "cwd": "${workspaceFolder}/examples/browser", + "args": [ + "--hostname=0.0.0.0", + "--port=3000", + "--no-cluster", + "--app-project-path=${workspaceFolder}/examples/browser", + "--plugins=local-dir:../../plugins", + "--hosted-plugin-inspect=9339", + "--ovsx-router-config=${workspaceFolder}/examples/ovsx-router-config.json" + ], + "env": { + "NODE_ENV": "development" + }, + "sourceMaps": true, + "outFiles": [ + "${workspaceFolder}/examples/browser/src-gen/backend/*.js", + "${workspaceFolder}/examples/browser/lib/**/*.js", + "${workspaceFolder}/examples/api-samples/lib/**/*.js", + "${workspaceFolder}/packages/*/lib/**/*.js", + "${workspaceFolder}/dev-packages/*/lib/**/*.js" + ], + "smartStep": true, + "internalConsoleOptions": "openOnSessionStart", + "outputCapture": "std" + }, + { + "type": "node", + "request": "attach", + "name": "Attach to Plugin Host", + "port": 9339, + "timeout": 60000, + "stopOnEntry": false, + "smartStep": true, + "sourceMaps": true, + "internalConsoleOptions": "openOnSessionStart", + "outFiles": [ + "${workspaceFolder}/packages/plugin-ext/lib/**/*.js", + "${workspaceFolder}/plugins/**/*.js" + ] + }, + { + "type": "node", + "request": "launch", + "protocol": "inspector", + "name": "Run Mocha Tests", + "program": "${workspaceFolder}/node_modules/mocha/bin/_mocha", + "args": [ + "--no-timeouts", + "--colors", + "--config", + "${workspaceFolder}/configs/mocharc.yml", + "**/${fileBasenameNoExtension}.js" + ], + "env": { + "TS_NODE_PROJECT": "${workspaceFolder}/tsconfig.json" + }, + "sourceMaps": true, + "smartStep": true, + "internalConsoleOptions": "openOnSessionStart", + "outputCapture": "std" + }, + { + "name": "Launch Browser Frontend", + "type": "chrome", + "request": "launch", + "url": "http://localhost:3000/", + "webRoot": "${workspaceFolder}/examples/browser" + }, + { + "type": "chrome", + "request": "attach", + "name": "Attach to Electron Frontend", + "port": 9222, + "webRoot": "${workspaceFolder}/examples/electron" + }, + { + "name": "Launch VS Code Tests", + "type": "node", + "request": "launch", + "args": [ + "${workspaceFolder}/examples/browser/lib/backend/main.js", + "${workspaceFolder}/plugins/vscode-api-tests/testWorkspace", + "--port", + "3030", + "--hostname", + "0.0.0.0", + "--extensionTestsPath=${workspaceFolder}/plugins/vscode-api-tests/out/singlefolder-tests", + "--hosted-plugin-inspect=9339" + ], + "env": { + "THEIA_DEFAULT_PLUGINS": "local-dir:${workspaceFolder}/plugins" + }, + "stopOnEntry": false, + "sourceMaps": true, + "outFiles": [ + "${workspaceFolder}/../.js" + ] + } + ], + "compounds": [ + { + "name": "Launch Electron Backend & Frontend", + "configurations": [ + "Launch Electron Backend", + "Attach to Plugin Host", + "Attach to Electron Frontend" + ], + "stopAll": true + }, + { + "name": "Launch Browser Backend & Frontend", + "configurations": [ + "Launch Browser Backend", + "Attach to Plugin Host", + "Launch Browser Frontend" + ], + "stopAll": true + } + ] +} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..845ef41 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,75 @@ +// If one would like to add/remove/modify user preferences without modifying the content of the +// workspace settings file, then one would need to modify the `settings.json` under here: +// - Windows: %APPDATA%\Code\User\settings.json +// - Linux: $HOME/.config/Code/User/settings.json +// - Mac: $HOME/Library/Application Support/Code/User/settings.json +{ + "editor.formatOnSave": true, + "search.exclude": { + "**/node_modules": true, + "**/lib": true, + "**/coverage": true + }, + "lcov.path": [ + "packages/core/coverage/lcov.info", + "packages/editor/coverage/lcov.info", + "packages/filesystem/coverage/lcov.info", + "packages/go/coverage/lcov.info", + "packages/java/coverage/lcov.info", + "packages/languages/coverage/lcov.info", + "packages/monaco/coverage/lcov.info", + "packages/navigator/coverage/lcov.info", + "packages/keymaps/coverage/lcov.info", + "packages/preferences/coverage/lcov.info", + "packages/process/coverage/lcov.info", + "packages/python/coverage/lcov.info", + "packages/terminal/coverage/lcov.info", + "packages/workspace/coverage/lcov.info", + "packages/task/coverage/lcov.info", + "packages/monaco-textmate/coverage/lcov.info" + ], + "lcov.watch": [ + { + "pattern": "**/*.spec.ts", + "command": "npm run test:theia" + } + ], + "editor.insertSpaces": true, + "[typescript]": { + "editor.tabSize": 4, + "editor.defaultFormatter": "vscode.typescript-language-features", + }, + "[javascript]": { + "editor.tabSize": 4, + "editor.defaultFormatter": "vscode.typescript-language-features" + }, + "[json]": { + "editor.tabSize": 2, + "editor.defaultFormatter": "vscode.json-language-features", + }, + "[jsonc]": { + "editor.tabSize": 2, + "editor.defaultFormatter": "vscode.json-language-features", + }, + "[markdown]": { + "editor.defaultFormatter": "DavidAnson.vscode-markdownlint" + }, + "typescript.tsdk": "node_modules/typescript/lib", + "files.insertFinalNewline": true, + "clang-format.language.typescript.enable": false, + // ESLint `max-len` rule. + "editor.rulers": [ + 180 + ], + "typescript.preferences.quoteStyle": "single", + "[typescriptreact]": { + "editor.defaultFormatter": "vscode.typescript-language-features", + "typescript.preferences.quoteStyle": "single", + "editor.tabSize": 4, + }, + "markdownlint.config": { + "MD032": false, // don't require blank line around lists + "MD033": false, // allow inline html + "MD041": false // don't require h1 in first line + }, +} diff --git a/.vscode/theia.code-snippets b/.vscode/theia.code-snippets new file mode 100644 index 0000000..24c9c99 --- /dev/null +++ b/.vscode/theia.code-snippets @@ -0,0 +1,20 @@ +{ + "Copyright-JS/JSX/TS/TSX": { + "prefix": [ + "header", + "copyright" + ], + "body": "// *****************************************************************************\n// Copyright (C) $CURRENT_YEAR ${YourCompany} and others.\n//\n// This program and the accompanying materials are made available under the\n// terms of the Eclipse Public License v. 2.0 which is available at\n// http://www.eclipse.org/legal/epl-2.0.\n//\n// This Source Code may also be made available under the following Secondary\n// Licenses when the conditions for such availability set forth in the Eclipse\n// Public License v. 2.0 are satisfied: GNU General Public License, version 2\n// with the GNU Classpath Exception which is available at\n// https://www.gnu.org/software/classpath/license.html.\n//\n// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0\n// *****************************************************************************\n$0", + "description": "Adds the copyright...", + "scope": "javascript,javascriptreact,typescript,typescriptreact" + }, + "Copyright-CSS": { + "prefix": [ + "header", + "copyright" + ], + "body": "/********************************************************************************\n * Copyright (C) $CURRENT_YEAR ${YourCompany} and others.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0.\n *\n * This Source Code may also be made available under the following Secondary\n * Licenses when the conditions for such availability set forth in the Eclipse\n * Public License v. 2.0 are satisfied: GNU General Public License, version 2\n * with the GNU Classpath Exception which is available at\n * https://www.gnu.org/software/classpath/license.html.\n *\n * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0\n ********************************************************************************/\n\n$0", + "description": "Adds the copyright...", + "scope": "css" + } +} diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..f78e59f --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,955 @@ +# Changelog + +## History + +- [Previous Changelogs](https://github.com/eclipse-theia/theia/tree/master/doc/changelogs/) + +## 1.68.0 - 1/29/2026 + +- [ai-chat] added mode selection for coder and architect agents [#16860](https://github.com/eclipse-theia/theia/pull/16860) +- [ai-chat] fix: do not break chat when interrupting tool calls [#16806](https://github.com/eclipse-theia/theia/pull/16806) +- [ai-chat] fixed refresh bug after manual task context change [#16816](https://github.com/eclipse-theia/theia/pull/16816) +- [ai-chat] fixed respect for agentId in delegateToAgent when prompt contains @mentions [#16855](https://github.com/eclipse-theia/theia/pull/16855) +- [ai-chat] fixed the failing test [#16897](https://github.com/eclipse-theia/theia/pull/16897) +- [ai-chat] implemented preference for AI chat persisted session limit [#16776](https://github.com/eclipse-theia/theia/pull/16776) +- [ai-chat] serialized and restored parsedChatRequest in chat sessions [#16736](https://github.com/eclipse-theia/theia/pull/16736) +- [ai-chat] stored persistent chat sessions in the workspace by default [#16847](https://github.com/eclipse-theia/theia/pull/16847) +- [ai-chat-ui] added toggle button to collapse changeset list [#16801](https://github.com/eclipse-theia/theia/pull/16801) +- [ai-chat-ui] displayed prompt variant customization in chat view responses and agent config [#16749](https://github.com/eclipse-theia/theia/pull/16749) +- [ai-chat-ui] enhanced chat accessibility (focus commands and ARIA) [#16835](https://github.com/eclipse-theia/theia/pull/16835) +- [ai-chat-ui] highlighted referenced tools in users' chat messages [#16812](https://github.com/eclipse-theia/theia/pull/16812) +- [ai-copilot] added GitHub Copilot language model integration [#16841](https://github.com/eclipse-theia/theia/pull/16841) +- [ai-core] added agent skills support [#16810](https://github.com/eclipse-theia/theia/pull/16810) +- [ai-core] updated default models [#16828](https://github.com/eclipse-theia/theia/pull/16828) +- [ai-hugging-face] upgraded sdk to v4.x for new api endpoint [#16864](https://github.com/eclipse-theia/theia/pull/16864) +- [ai-hugging-face] used patchLanguageModel to update model status [#16885](https://github.com/eclipse-theia/theia/pull/16885) +- [ai-ide] added createSkill agent [#16903](https://github.com/eclipse-theia/theia/pull/16903) +- [ai-ide] added Theia coder agent mode next prompt [#16799](https://github.com/eclipse-theia/theia/pull/16799) +- [ai-ide] added todo tool function [#16859](https://github.com/eclipse-theia/theia/pull/16859) +- [ai-ide] appTester improvements [#16898](https://github.com/eclipse-theia/theia/pull/16898) +- [ai-ide] fixed misleading tool description for context_addFiles [#16778](https://github.com/eclipse-theia/theia/pull/16778) +- [ai-ide] fixed model selection UI update for model alias [#16800](https://github.com/eclipse-theia/theia/pull/16800) +- [ai-ide] fixed remote MCP server state and improved UX [#16822](https://github.com/eclipse-theia/theia/pull/16822) +- [ai-ide] fixed selected item after model alias change [#16760](https://github.com/eclipse-theia/theia/pull/16760) +- [ai-ide] improved architect planning mode - next prompt [#16843](https://github.com/eclipse-theia/theia/pull/16843) +- [ai-ide] improved function descriptions [#16796](https://github.com/eclipse-theia/theia/pull/16796) +- [ai-ide] improved task context variable description [#16817](https://github.com/eclipse-theia/theia/pull/16817) +- [ai-ide] Reverted "Fixed #16795 (#16800)" [#16802](https://github.com/eclipse-theia/theia/pull/16802) +- [ai-ide] switched writeFileReplacement to V2 replacer [#16815](https://github.com/eclipse-theia/theia/pull/16815) +- [ai-mcp] blocked mcp server autostart in untrusted workspaces [#16891](https://github.com/eclipse-theia/theia/pull/16891) +- [ai-mcp] updated MCP SDK to v1.25.1 and migrated to zod v4 [#16780](https://github.com/eclipse-theia/theia/pull/16780) +- [core] added injectable LoggerSanitizer to mask sensitive data in logs [#16771](https://github.com/eclipse-theia/theia/pull/16771) - Contributed on behalf of STMicroelectronics +- [core] fixed memory leaks from 'toDisposeOn' disposable collections [#16856](https://github.com/eclipse-theia/theia/pull/16856) +- [core] improved keybinding lookup and prioritization [#16763](https://github.com/eclipse-theia/theia/pull/16763) +- [core] postponed default override warning logging until builtin preferences registered [#16853](https://github.com/eclipse-theia/theia/pull/16853) +- [core] refactored tree search box into react widget and enhanced ux and styling [#16761](https://github.com/eclipse-theia/theia/pull/16761) +- [core] restored enhanced tab preview for all widgets [#16895](https://github.com/eclipse-theia/theia/pull/16895) +- [core] theia v1.67.0 released [#16738](https://github.com/eclipse-theia/theia/pull/16738) +- [core] translation update for version 1.68.0 [#16907](https://github.com/eclipse-theia/theia/pull/16907) +- [debug] fixed deletion of disabled source breakpoints [#16794](https://github.com/eclipse-theia/theia/pull/16794) +- [debug] improved debug console with output persistence and text filtering [#16882](https://github.com/eclipse-theia/theia/pull/16882) +- [doc] updated publishing guide documentation [#16768](https://github.com/eclipse-theia/theia/pull/16768) - Contributed on behalf of STMicroelectronics +- [examples] fixed clean script for the example applications [#16767](https://github.com/eclipse-theia/theia/pull/16767) +- [github] added discussion auto-reply [#16746](https://github.com/eclipse-theia/theia/pull/16746) +- [github] added sponsoring hint to discussion templates [#16745](https://github.com/eclipse-theia/theia/pull/16745) +- [github] added sponsoring hint to gh ticket templates [#16744](https://github.com/eclipse-theia/theia/pull/16744) +- [localization-manager] set deepl auth header [#16906](https://github.com/eclipse-theia/theia/pull/16906) +- [messages] allowed copying messages from notifications and fixed copying of error messages in AI chat [#16830](https://github.com/eclipse-theia/theia/pull/16830) - Contributed on behalf of STMicroelectronics +- [messages] handled notification timeout correctly when set to 0 [#16849](https://github.com/eclipse-theia/theia/pull/16849) - Contributed on behalf of STMicroelectronics +- [monaco] updated built-in theme and color definitions [#16873](https://github.com/eclipse-theia/theia/pull/16873) +- [output] fixed state restoration in outputWidget [#16851](https://github.com/eclipse-theia/theia/pull/16851) +- [plugin] preserved lsp diagnostic.data in markers [#16766](https://github.com/eclipse-theia/theia/pull/16766) +- [plugin] updated VS Code built-in extensions to 1.104.0 and Typescript to 5.9.3 [#16774](https://github.com/eclipse-theia/theia/pull/16774) - contributed on behalf of STMicroelectronics +- [preferences] marked llmprovider as experimental [#16784](https://github.com/eclipse-theia/theia/pull/16784) +- [preferences] supported preference tags in settings view [#16783](https://github.com/eclipse-theia/theia/pull/16783) +- [scm] added action button (commit button) support to scm [#16803](https://github.com/eclipse-theia/theia/pull/16803) - contributed under the supervision of @JonasHelming as part of the TUM Bachelor Thesis project "Enhancing Terminal Usability in Modern IDEs through AI-Assisted Interaction" +- [scm] fix manual resolution not detected in some cases [#16869](https://github.com/eclipse-theia/theia/pull/16869) +- [scm] fixed `Go to Previous Unhandled Conflict` doing nothing [#16838](https://github.com/eclipse-theia/theia/pull/16838) +- [scm] fixed `mark as handled` having no effect in some cases [#16858](https://github.com/eclipse-theia/theia/pull/16858) +- [scm] ux: fixed styling for scm commit button for high contrast themes [#16905](https://github.com/eclipse-theia/theia/pull/16905) +- [terminal-manager] improved handling of terminal manager preferences & element deletion [#16827](https://github.com/eclipse-theia/theia/pull/16827) +- [terminal-manager] updated active page handling on terminal page deletion [#16807](https://github.com/eclipse-theia/theia/pull/16807) +- [vscode] API evolution (public and proposed) and nls update to 1.108.0 [#16871](https://github.com/eclipse-theia/theia/pull/16871) - contributed on behalf of STMicroelectronics +- [vsx-registry] fixed vsxExtensionsViewContainer onAfterAttach issue [#16862](https://github.com/eclipse-theia/theia/pull/16862) +- [workspace] implemented workspace trust dialog and management [#16809](https://github.com/eclipse-theia/theia/pull/16809) +- [workspace] improved computation of workspace trust for saved/multi-root workspaces [#16893](https://github.com/eclipse-theia/theia/pull/16893) +- [workspace] updated dialog and status bar item styling and fixed command state handling [#16877](https://github.com/eclipse-theia/theia/pull/16877) + +[Breaking Changes:](#breaking_changes_1.68.0) + +- [monaco] refactored some of the fields in `MonacoEditor` and `MonacoDiffEditor` as part of [#16832](https://github.com/eclipse-theia/theia/pull/16832): + - changed the type of `MonacoEditor.savedViewState` from `monaco.editor.ICodeEditorViewState | null` to `monaco.editor.IEditorViewState | null` and also changed its visibility from public to protected + - removed protected field `MonacoEditor.model` + - removed protected fields `savedDiffState`, `originalTextModel`, and `modifiedTextModel` in `MonacoDiffEditor` +- [preferences] Removed the optional 'knownCurrentValue' argument to `PreferenceLeadNodeRenderer#updateModificationStatus`. Renamed `isModifiedInScope` to `isSet` to reflect new semantics. [#16836](https://github.com/eclipse-theia/theia/pull/16836) +- [core] removed `oldValue` and `newValue` fields from the `PreferenceChange` and the `PreferenceProxy`'s `PreferenceChangeEvent` interfaces. The `newValue` field was a common footgun, as it represented the value in the changed scope rather than the effective value. In particular, it could be `undefined` when a given scope was cleared even if another scope provided a defined value. Use `PreferenceService.get` or `PreferenceProxy.get` or indexing on a `PreferenceProxy` to retrieve the active value rather than using the `newValue` field. [#16832](https://github.com/eclipse-theia/theia/pull/16846) +- [scm] refactored some of the methods pertaining to the 3-way Merge Editor implementation as part of [#16867](https://github.com/eclipse-theia/theia/pull/16867) + - removed the `MergeEditorModel.findMergeRanges` method + - renamed the `RangeUtils.isBeforeOrTouching` method to `isBefore` +- [ai-chat, ai-core] refactored tool handler context types [#16899](https://github.com/eclipse-theia/theia/issues/16899): Tool handlers now receive `ToolInvocationContext` (with `cancellationToken`) instead of `MutableChatRequestModel`. Chat-bound tools should use `assertChatContext(ctx)` to access `ChatToolContext` with `request` and `response` properties. +- [ai-chat] fixed: refactor tool handler context types for type safety [#16901](https://github.com/eclipse-theia/theia/pull/16901) +- [ai-terminal] added shellExecutionTool for AI agents [#16878](https://github.com/eclipse-theia/theia/pull/16878) +- [core] passed widget consistently to toolbar enablement handlers [#16826](https://github.com/eclipse-theia/theia/pull/16826) + +## 1.67.0 - 12/10/2025 + +- [ai-anthropic] added opus 4.5 to default models [#16656](https://github.com/eclipse-theia/theia/pull/16656) +- [ai-anthropic, ai-core, ai-google, ai-openai] updated default models [#16636](https://github.com/eclipse-theia/theia/pull/16636) +- [ai-chat] clarified role of Orchestrator agent in Theia AI chat interactions [#16663](https://github.com/eclipse-theia/theia/pull/16663) +- [ai-chat-ui] ensured active session is recreated after deletion [#16702](https://github.com/eclipse-theia/theia/pull/16702) - Contributed on behalf of [Lonti.com](http://lonti.com/) Pty Ltd +- [ai-claude-code] added session forking support [#16667](https://github.com/eclipse-theia/theia/pull/16667) +- [ai-claude-code] migrated Claude Code to Theia native slash commands and modes [#16541](https://github.com/eclipse-theia/theia/pull/16541) +- [ai-codex] added codex as an agent [#16484](https://github.com/eclipse-theia/theia/pull/16484) +- [ai-codex] correctly asserted path for windows and linux tests [#16620](https://github.com/eclipse-theia/theia/pull/16620) +- [ai-core] enableAgent/disableAgent: added async/await [#16599](https://github.com/eclipse-theia/theia/pull/16599) +- [ai-core] enabled markdown syntax for prompt template files [#16557](https://github.com/eclipse-theia/theia/pull/16557) +- [ai-core] fixed duplicate command check [#16718](https://github.com/eclipse-theia/theia/pull/16718) +- [ai-core] handled undefined parameters for prompt template discard command [#16706](https://github.com/eclipse-theia/theia/pull/16706) +- [ai-core] made opus 4.5 default in model alliasses [#16734](https://github.com/eclipse-theia/theia/pull/16734) +- [ai-core] returned command by name if not found by ID [#16614](https://github.com/eclipse-theia/theia/pull/16614) +- [ai-google] updated @google/genai dependency, added thoughtSignature support and fixed content extraction [#16664](https://github.com/eclipse-theia/theia/pull/16664) +- [ai-ide] added GitHub slash commands [#16704](https://github.com/eclipse-theia/theia/pull/16704) +- [ai-ide] added remember command [#16639](https://github.com/eclipse-theia/theia/pull/16639) +- [ai-ide] clicking on a file in ai context does not open file [#16468](https://github.com/eclipse-theia/theia/pull/16468) +- [ai-ide] improved AI Agent Configuration view [#16698](https://github.com/eclipse-theia/theia/pull/16698) +- [ai-ide] made next replacer function default [#16597](https://github.com/eclipse-theia/theia/pull/16597) +- [ai-ide] updated command prompt template examples [#16608](https://github.com/eclipse-theia/theia/pull/16608) +- [ai-llamafile] updated llamafile model status for agent availability [#16692](https://github.com/eclipse-theia/theia/pull/16692) +- [ai-openai] recursively strictified tool call schemata [#16553](https://github.com/eclipse-theia/theia/pull/16553) +- [ai-terminal] fixed unresponsiveness in ask AI terminal assistant [#16714](https://github.com/eclipse-theia/theia/pull/16714) +- [application-package] bumped API compatibility to 1.106.1 [#16655](https://github.com/eclipse-theia/theia/pull/16655) - Contributed on behalf of STMicroelectronics +- [ci] fixed check-new-packages workflow and checkPublish script [#16650](https://github.com/eclipse-theia/theia/pull/16650) +- [ci] migrated to npm trusted publishing (OIDC) and updated publishing workflow [#16630](https://github.com/eclipse-theia/theia/pull/16630) +- [ci] optimized test builds to avoid redundant executions [#16552](https://github.com/eclipse-theia/theia/pull/16552) +- [ci] set default values for scheduled publish-ci runs [#16695](https://github.com/eclipse-theia/theia/pull/16695) +- [core] added support for emojis in markdown renderers [#16548](https://github.com/eclipse-theia/theia/pull/16548) +- [core] fixed electron startup crash on wayland [#16658](https://github.com/eclipse-theia/theia/pull/16658) +- [core] fixed the issue with exclude pattern in user settings not merging with workspace settings [#16483](https://github.com/eclipse-theia/theia/pull/16483) +- [core] fixed workbench.startupEditor and scm.defaultViewMode reset behavior [#16646](https://github.com/eclipse-theia/theia/pull/16646) +- [core] improved error handling in catalog.json download script [#16579](https://github.com/eclipse-theia/theia/pull/16579) - contributed on behalf of STMicroelectronics +- [core] improved menubar items active state handling on hover [#16586](https://github.com/eclipse-theia/theia/pull/16586) - contributed on behalf of STMicroelectronics +- [core] improved typing related to `globalThis` object [#16603](https://github.com/eclipse-theia/theia/pull/16603) +- [core] npm upgrade [#16516](https://github.com/eclipse-theia/theia/pull/16516) +- [core] provided markdown and localizedMarkdown components [#16470](https://github.com/eclipse-theia/theia/pull/16470) +- [core] removed references to gitpod (now ona) [#16610](https://github.com/eclipse-theia/theia/pull/16610) +- [core] restored tree expansion state preservation in SourceTreeWidget [#16654](https://github.com/eclipse-theia/theia/pull/16654) +- [core] reverted "fix(core): restore tree expansion state preservation in SourceTreeWidget" [#16672](https://github.com/eclipse-theia/theia/pull/16672) +- [core] reverted to `scrollIntoView` [#16532](https://github.com/eclipse-theia/theia/pull/16532) +- [core] theia v1.66.0 released [#16515](https://github.com/eclipse-theia/theia/pull/16515) +- [core] updated nls.metadata for vscode API 1.106.1 and added update eslint localization check [#16728](https://github.com/eclipse-theia/theia/pull/16728) - contributed on behalf of STMicroelectronics +- [core] updated package READMEs [#16631](https://github.com/eclipse-theia/theia/pull/16631) +- [core] updated translations for 'applyAll' and 'finished' in Chinese locale [#16556](https://github.com/eclipse-theia/theia/pull/16556) +- [core] used PreferenceService.get to merge agent settings from different scopes [#16612](https://github.com/eclipse-theia/theia/pull/16612) +- [core] used undefined-safe deep equality check in preference updates [#16709](https://github.com/eclipse-theia/theia/pull/16709) +- [customAgents] fixed default model for theia-dev [#16680](https://github.com/eclipse-theia/theia/pull/16680) +- [debug] added breakpoint actions to debug view [#16700](https://github.com/eclipse-theia/theia/pull/16700) +- [debug] added support for "lazy" debug variables [#16681](https://github.com/eclipse-theia/theia/pull/16681) +- [debug] added support for adding the current editor selection to watch [#16567](https://github.com/eclipse-theia/theia/pull/16567) +- [debug] added support for data breakpoints [#16505](https://github.com/eclipse-theia/theia/pull/16505) +- [debug] opened stack frame editor on tap [#16519](https://github.com/eclipse-theia/theia/pull/16519) +- [debug] variables made expandable when they should not [#16684](https://github.com/eclipse-theia/theia/pull/16684) +- [dev-container] basic devcontainer docker compose support [#16577](https://github.com/eclipse-theia/theia/pull/16577) +- [dev-container] fixed devContainer startup failure due to non-injectable logger [#16678](https://github.com/eclipse-theia/theia/pull/16678) +- [doc] added coding guideline for localizing rich content [#16501](https://github.com/eclipse-theia/theia/pull/16501) +- [doc] added i18n checklist item to PR template and review checklist [#16611](https://github.com/eclipse-theia/theia/pull/16611) +- [doc] updated publishing guide [#16592](https://github.com/eclipse-theia/theia/pull/16592) - Contributed on behalf of STMicroelectronics +- [examples] fixed script parameters [#16523](https://github.com/eclipse-theia/theia/pull/16523) +- [filesystem] fixed undefined error on context menu upload files command [#16600](https://github.com/eclipse-theia/theia/pull/16600) +- [getting-started] enhanced localization of the package [#16578](https://github.com/eclipse-theia/theia/pull/16578) +- [metrics] fixed error after deleting node_modules folder - cannot resolve package @theia/ [#16602](https://github.com/eclipse-theia/theia/pull/16602) +- [monaco] quick command panel not closing when pressing escape fixed [#16668](https://github.com/eclipse-theia/theia/pull/16668) +- [notebook] "split editor" functionality for notebooks [#16507](https://github.com/eclipse-theia/theia/pull/16507) +- [playwright] missing tslib import in @theia/playwright [#16670](https://github.com/eclipse-theia/theia/pull/16670) +- [plugin] API evolution (proposed) to 1.106.1 [#16626](https://github.com/eclipse-theia/theia/pull/16626) - contributed on behalf of STMicroelectronics +- [plugin] API evolution (public) to 1.106.1 [#16625](https://github.com/eclipse-theia/theia/pull/16625) - Contributed on behalf of STMicroelectronics +- [plugin-ext] fixed incorrect argument passing to StatusBarEntry [#16694](https://github.com/eclipse-theia/theia/pull/16694) +- [plugin-ext] fixed issue with creating proper type instances in toSymbolInformation [#16731](https://github.com/eclipse-theia/theia/pull/16731) +- [preferences] fixed: align input heights in preferences UI [#16733](https://github.com/eclipse-theia/theia/pull/16733) +- [preferences] preference UI: subscribed directly to provider changes [#16506](https://github.com/eclipse-theia/theia/pull/16506) +- [prompts] added two agents that allow for an agentic flow [#16473](https://github.com/eclipse-theia/theia/pull/16473) +- [prompts] moved TheiaDev and TheiaDevCoder prompts to customAgents.yml [#16711](https://github.com/eclipse-theia/theia/pull/16711) +- [terminal] enhanced localization of the terminal package [#16587](https://github.com/eclipse-theia/theia/pull/16587) +- [terminal] new terminals were created in the panel of the clicked button [#16538](https://github.com/eclipse-theia/theia/pull/16538) +- [terminal] when the terminal was inputting with a Chinese input method, the text that had already been input was covered [#16605](https://github.com/eclipse-theia/theia/pull/16605) +- [terminal-manager] Adds new package providing a terminal manager widget to have multiple terminals within one view. Adds setting `terminal.grouping.mode` to switch between the +old behavior and the new view. Default is the old behavior. [#16604](https://github.com/eclipse-theia/theia/issues/16604) +- [terminal-manager] enhanced localization of the terminal-manager package [#16717](https://github.com/eclipse-theia/theia/pull/16717) +- [terminal-manager] removed terminal flash animation on selection and cleaned up unused css rules [#16715](https://github.com/eclipse-theia/theia/pull/16715) +- [timeline] updated proposed.timeline API and theia timeline view implementation [#16627](https://github.com/eclipse-theia/theia/pull/16627) - Contributed on behalf of STMicroelectronics +- [toolbar] improved icon picker dialog for adding toolbar items and updated @vscode/codicons [#16629](https://github.com/eclipse-theia/theia/pull/16629) +- [vsx-registry] used versioned id's for (un)installed and deployed plugins [#16513](https://github.com/eclipse-theia/theia/pull/16513) +- [workspace] do not copy preferences that are valid in folder scope [#16622](https://github.com/eclipse-theia/theia/pull/16622) +- [workspace] enhanced localization of the workspace package [#16589](https://github.com/eclipse-theia/theia/pull/16589) + +[Breaking Changes:](#breaking_changes_1.67.0) + +- [ai-core] objects returned by `AiSettingsService` settings retrievals marked readonly. To mutate a settings object, make a copy. [#16612](https://github.com/eclipse-theia/theia/pull/16612) +- [core] `CommonCommands` has been extracted from `common-frontend-contribution.ts` into its own file `common-commands.ts`. This only affects code using deep imports: imports of `CommonCommands` from `@theia/core/lib/browser/common-frontend-contribution` should be updated to use the standard barrel export `@theia/core/lib/browser` instead. +- [core] `CommonMenus` has been extracted from `common-frontend-contribution.ts` into its own file `common-menus.ts`. This only affects code using deep imports: imports of `CommonMenus` from `@theia/core/lib/browser/common-frontend-contribution` should be updated to use the standard barrel export `@theia/core/lib/browser` instead. +- [core] moved CommonCommands to separate file [#16522](https://github.com/eclipse-theia/theia/pull/16522) +- [debug] `DebugSessionManager.getFunctionBreakpoints()`, `DebugSessionManager.getInstructionBreakpoints()`, and `DebugSessionManager.getBreakpoints()` no longer default to the current session when called without arguments. Callers that relied on the implicit default to `currentSession` must now pass `this.currentSession` explicitly. [#16537](https://github.com/eclipse-theia/theia/pull/16537) +- [debug] refactored some of the debug model elements as part of [#16689](https://github.com/eclipse-theia/theia/pull/16689): + - added required `id` parameter to `DebugStackFrame` and `DebugScope` constructors + - changed type of keys in the `DebugThread._frames` map from `number` to `string` + - added required `startFrame` parameter to `DebugThread.doUpdateFrames` method +- [debug] some of the fields and methods of `DebugToolBar` have been removed in [#16719](https://github.com/eclipse-theia/theia/pull/16719) +- [debug] moved `Debug*Commands` and `DebugMenus` to separate file [#16700](https://github.com/eclipse-theia/theia/pull/16700) +- [plugin-ext] `$setBadge` method removed from `WebviewsMain` interface and `WebviewsMainImpl`; badge-related fields removed from `WebviewView` interface and implementation; badge-related fields removed from `PluginViewWidget`; badge-related fields removed from `WebviewWidget`. Use the `BadgeService` instead of `BadgeWidget` interface implementation to show extension badges. [#16518](https://github.com/eclipse-theia/theia/pull/16518) +- [scm] `ScmTabBarDecorator` and bindings removed. `ScmWidget` now contributes badge decorations via the `BadgeService`. [#16518](https://github.com/eclipse-theia/theia/pull/16518) + +## 1.66.0 - 10/30/2025 + +- [ai-anthropic] allowed configuring proxy settings [#16453](https://github.com/eclipse-theia/theia/pull/16453) +- [ai-anthropic] fixed Anthropic request errors when using parallel tool calls [#16359](https://github.com/eclipse-theia/theia/pull/16359) +- [ai-chat] enhanced localization of the ai-chat package [#16409](https://github.com/eclipse-theia/theia/pull/16409) +- [ai-chat] implemented chat session persistence [#16486](https://github.com/eclipse-theia/theia/pull/16486) +- [ai-chat] refined the description of agent delegate tool [#16378](https://github.com/eclipse-theia/theia/pull/16378) +- [ai-chat-ui] added mode support for chat agents [#16489](https://github.com/eclipse-theia/theia/pull/16489) +- [ai-chat-ui] enhanced localization of the ai-chat-ui package [#16414](https://github.com/eclipse-theia/theia/pull/16414) +- [ai-claude-code] added dedicated Claude Code API key preference [#16508](https://github.com/eclipse-theia/theia/pull/16508) +- [ai-claude-code] enhanced localization of the ai-claude-code package [#16451](https://github.com/eclipse-theia/theia/pull/16451) +- [ai-claude-code] migrated to claude agent sdk [#16500](https://github.com/eclipse-theia/theia/pull/16500) +- [ai-code-completion] enhanced localization of ai-code-completion [#16416](https://github.com/eclipse-theia/theia/pull/16416) +- [ai-core] added support for slash commands [#16444](https://github.com/eclipse-theia/theia/pull/16444) +- [ai-core] enhanced localization of the ai-core package [#16350](https://github.com/eclipse-theia/theia/pull/16350) +- [ai-editor] enhanced localization of ai-editor [#16416](https://github.com/eclipse-theia/theia/pull/16416) +- [ai-google] conditionally included tools in GoogleModel based on functionDeclarations length [#16480](https://github.com/eclipse-theia/theia/pull/16480) +- [ai-google] fixed google language model error for requests without tool functions [#16380](https://github.com/eclipse-theia/theia/pull/16380) - Contributed on behalf of Lonti.com Pty Ltd +- [ai-ide] adapted workspace functions preferences [#16452](https://github.com/eclipse-theia/theia/pull/16452) +- [ai-ide] added GitHub agent [#16374](https://github.com/eclipse-theia/theia/pull/16374) +- [ai-ide] added initial project info agent (alpha) [#16462](https://github.com/eclipse-theia/theia/pull/16462) +- [ai-ide] added new content replacer strategy for coder edit mode [#16322](https://github.com/eclipse-theia/theia/pull/16322) +- [ai-ide] added orchestrator agent exclusion list [#16510](https://github.com/eclipse-theia/theia/pull/16510) +- [ai-ide] added support to suggest terminal command [#16428](https://github.com/eclipse-theia/theia/pull/16428) +- [ai-ide] enhanced localization of the ai-ide package [#16426](https://github.com/eclipse-theia/theia/pull/16426) +- [ai-ide] extracted task context prompt into separate agent [#16393](https://github.com/eclipse-theia/theia/pull/16393) +- [ai-ide] fixed two minor spelling/wording issues with the coder prompt [#16402](https://github.com/eclipse-theia/theia/pull/16402) +- [ai-ide] forbade meta comments in coder prompt [#16331](https://github.com/eclipse-theia/theia/pull/16331) +- [ai-ide] removed @theia/git dependency [#16465](https://github.com/eclipse-theia/theia/pull/16465) +- [ai-mcp] added option to run a resolve operation on mcp server start [#16049](https://github.com/eclipse-theia/theia/pull/16049) +- [ai-mcp] fixed preference categorization for MCP server preferences [#16346](https://github.com/eclipse-theia/theia/pull/16346) +- [ai-mcp-server] added .js extension to imports for ESM to allow usage in commonjs [#16410](https://github.com/eclipse-theia/theia/pull/16410) - Contributed by STMicroelectronics +- [ai-openai] allowed configuring proxy settings [#16453](https://github.com/eclipse-theia/theia/pull/16453) +- [ai-openai] used OpenAI response API [#16394](https://github.com/eclipse-theia/theia/pull/16394) +- [ai-scanoss] fixed SCANOSS dialog expansion with long JSON content [#16485](https://github.com/eclipse-theia/theia/pull/16485) +- [ai-terminal] enhanced localization of ai-terminal [#16416](https://github.com/eclipse-theia/theia/pull/16416) +- [application-manager] resolved `.node` files in webpack backend config [#16377](https://github.com/eclipse-theia/theia/pull/16377) +- [application-package] bumped vscode API compatibility to 1.105.0 [#16495](https://github.com/eclipse-theia/theia/pull/16495) +- [ci] optimized CI build to avoid redundant executions [#16457](https://github.com/eclipse-theia/theia/pull/16457) +- [ci] updated license workflow and switched to nodejs wrapper [#16456](https://github.com/eclipse-theia/theia/pull/16456) +- [ci] updated publish-release workflow for release automation [#16433](https://github.com/eclipse-theia/theia/pull/16433) - Contributed on behalf of STMicroelectronics +- [core] added symbol icon default colors [#15860](https://github.com/eclipse-theia/theia/pull/15860) +- [core] added z-index to dock layering style [#16375](https://github.com/eclipse-theia/theia/pull/16375) +- [core] ensured reveal scrolls to selected tree row [#16463](https://github.com/eclipse-theia/theia/pull/16463) +- [core] evaluated enablement and toggle state of command only once before showing context menu [#16325](https://github.com/eclipse-theia/theia/pull/16325) - Contributed on behalf of Lonti.com Pty Ltd +- [core] evolved vscode API (public) to 1.105.0 [#16476](https://github.com/eclipse-theia/theia/pull/16476) - Contributed on behalf of STMicroelectronics +- [core] fixed authentication service not reacting to session changes [#16252](https://github.com/eclipse-theia/theia/pull/16252) +- [core] fixed tooltip/hover service mouseOut for non-chromium browsers [#16417](https://github.com/eclipse-theia/theia/pull/16417) +- [core] fixed vscode plugin activation failed error when it uses an already existing key in its settings [#16481](https://github.com/eclipse-theia/theia/pull/16481) +- [core] improved default value and reset handling for preferences [#16356](https://github.com/eclipse-theia/theia/pull/16356) +- [core] prevented await identifiers [#16404](https://github.com/eclipse-theia/theia/pull/16404) - Contributed on behalf of STMicroelectronics +- [core] showed hover tooltip immediately when clicking status bar item [#16385](https://github.com/eclipse-theia/theia/pull/16385) +- [core] updated toggle developer tools keyboard shortcut to avoid overlap [#16488](https://github.com/eclipse-theia/theia/pull/16488) +- [core] upgraded NPM [#16357](https://github.com/eclipse-theia/theia/pull/16357) +- [debug] added check for valid debug session [#16330](https://github.com/eclipse-theia/theia/pull/16330) +- [debug] added support for context menu in debug hover [#16366](https://github.com/eclipse-theia/theia/pull/16366) +- [debug] fixed `Add to Watch` command [#16340](https://github.com/eclipse-theia/theia/pull/16340) +- [debug] made reveal position smoother [#16311](https://github.com/eclipse-theia/theia/pull/16311) - Contributed on behalf of MVTec Software GmbH +- [debug] retained session-bound metadata for disabled breakpoints [#16361](https://github.com/eclipse-theia/theia/pull/16361) +- [docs] added CLAUDE.md file [#16458](https://github.com/eclipse-theia/theia/pull/16458) +- [docs] published API documentation on GitHub Pages [#16422](https://github.com/eclipse-theia/theia/pull/16422) +- [docs] updated README.md [#16353](https://github.com/eclipse-theia/theia/pull/16353) +- [editor] fixed OutputWidget and MonacoEditor memory leak [#16487](https://github.com/eclipse-theia/theia/pull/16487) - Contributed by Hbb +- [electron] updated electron to version 38.4.0 [#16477](https://github.com/eclipse-theia/theia/pull/16477) +- [filesystem] avoided trying to use watchman for file system watcher [#16335](https://github.com/eclipse-theia/theia/pull/16335) - contributed on behalf of STMicroelectronics +- [notebook] used shared lodash.debounce import in notebook-editor-widget [#16423](https://github.com/eclipse-theia/theia/pull/16423) +- [playwright] added stability checks for TheiaMenuBar and TheiaMenu in Playwright tests [#16455](https://github.com/eclipse-theia/theia/pull/16455) +- [plugin] aligned module declaration for proposed.statusBarItemTooltip.d.ts [#16396](https://github.com/eclipse-theia/theia/pull/16396) +- [plugin] evolved vscode API (proposed) to 1.105.0 [#16475](https://github.com/eclipse-theia/theia/pull/16475) - Contributed on behalf of STMicroelectronics +- [plugin] refactored local plugin readme resolution [#16382](https://github.com/eclipse-theia/theia/pull/16382) +- [plugin] removed deprecated WMIC and unmaintained ps-tree usage [#16439](https://github.com/eclipse-theia/theia/pull/16439) +- [plugin-ext] allowed VSCode extension to access files outside of the extension directory [#16195](https://github.com/eclipse-theia/theia/pull/16195) +- [plugin-ext] ensured output channel methods stay within this context [#16420](https://github.com/eclipse-theia/theia/pull/16420) +- [plugin-ext] implemented asynchronous tooltips [#16364](https://github.com/eclipse-theia/theia/pull/16364) +- [plugin-ext] used unversioned IDs for disabled extensions [#16392](https://github.com/eclipse-theia/theia/pull/16392) +- [preferences] avoided reporting misleading 'invalid scope' warning for excluded preferences [#16332](https://github.com/eclipse-theia/theia/pull/16332) +- [preferences] debounced updateInMemoryResources to reduce startup times [#16440](https://github.com/eclipse-theia/theia/pull/16440) +- [preferences] fixed missing commonly used settings section [#16344](https://github.com/eclipse-theia/theia/pull/16344) +- [preferences] renamed await to awaitAll for esbuild compatibility [#16398](https://github.com/eclipse-theia/theia/pull/16398) - Contributed on behalf of STMicroelectronics +- [scanoss] fixed preference categorization for SCANOSS preferences [#16346](https://github.com/eclipse-theia/theia/pull/16346) +- [vsx-registry] fixed local plugin readme file resolution [#16376](https://github.com/eclipse-theia/theia/pull/16376) +- [workspace] added filename attribute to localization function [#16482](https://github.com/eclipse-theia/theia/pull/16482) + +[Breaking Changes:](#breaking_changes_1.66.0) + +- [core] `Listener.await` has been renamed to `Listener.awaitAll` for better compatibility with esbuild. [#16398](https://github.com/eclipse-theia/theia/pull/16398) - Contributed on behalf of STMicroelectronics + +## 1.65.0 - 9/26/2025 + +- [ai-chat] cancelled incomplete requests on new request [#16179](https://github.com/eclipse-theia/theia/pull/16179) +- [ai-chat] deduplicated tools before sending llm request [#16229](https://github.com/eclipse-theia/theia/pull/16229) +- [ai-chat] enabled specifying original state in change sets [#16067](https://github.com/eclipse-theia/theia/pull/16067) +- [ai-chat] unified tool call result handling [#16106](https://github.com/eclipse-theia/theia/pull/16106) +- [ai-chat-ui] added chat input history with arrow key navigation [#16174](https://github.com/eclipse-theia/theia/pull/16174) - Contributed on behalf of STMicroelectronics +- [ai-chat-ui] cancelled tool execution confirm dialogs when request was cancelled [#16221](https://github.com/eclipse-theia/theia/pull/16221) +- [ai-chat-ui] fix(chat): prevent prompt navigation when suggestion widget is visible [#16224](https://github.com/eclipse-theia/theia/pull/16224) +- [ai-chat-ui] fixed #16129 [#16185](https://github.com/eclipse-theia/theia/pull/16185) +- [ai-chat-ui] fixed arrow up/down only triggering prompt history if visual top/bottom line [#16265](https://github.com/eclipse-theia/theia/pull/16265) +- [ai-claude-code] initial Claude Code agent integration [#16273](https://github.com/eclipse-theia/theia/pull/16273) +- [ai-core] Also watch non-existent template directories [#16251](https://github.com/eclipse-theia/theia/pull/16251) +- [ai-google] improved error reporting for Google GenAI connector [#16228](https://github.com/eclipse-theia/theia/pull/16228) +- [ai-ide] added "find files" tool function [#16250](https://github.com/eclipse-theia/theia/pull/16250) +- [ai-ide] collapsed prompt fragment list 1st level by default [#16202](https://github.com/eclipse-theia/theia/pull/16202) +- [ai-ide] fixed show variables and functions only from selected prompt variants [#15519](https://github.com/eclipse-theia/theia/pull/15519) +- [ai-ide] improved getWorkspaceList to mark sub directories [#16170](https://github.com/eclipse-theia/theia/pull/16170) +- [ai-ide] refined app tester prompt [#16147](https://github.com/eclipse-theia/theia/pull/16147) +- [ai-ide] removed workspace directory structure function from default prompts [#16171](https://github.com/eclipse-theia/theia/pull/16171) +- [ai-mcp-server] added model context protocol server integration for theia [#15832](https://github.com/eclipse-theia/theia/pull/15832) +- [ai-openai] added info on bearer token [#16307](https://github.com/eclipse-theia/theia/pull/16307) +- [ai-openai] correctly handled reasoning output of openai/gpt-oss-120b [#16282](https://github.com/eclipse-theia/theia/pull/16282) +- [ai-openai] deployment configuration for Azure hosted models was added [#16324](https://github.com/eclipse-theia/theia/pull/16324) +- [ai-openai] updated OpenAI models, added gpt-5 [#16169](https://github.com/eclipse-theia/theia/pull/16169) +- [changelog] fixed changelog for 1.64.0 [#16103](https://github.com/eclipse-theia/theia/pull/16103) +- [changelog] updated changelog.md [#16217](https://github.com/eclipse-theia/theia/pull/16217) +- [core] added coding guidelines to project info [#16318](https://github.com/eclipse-theia/theia/pull/16318) +- [core] cleaned up emitters and dangling references when Theia DockPanel disposed [#16317](https://github.com/eclipse-theia/theia/pull/16317) +- [core] ended support for Node 18 and upgraded to node-gyp 11.x [#16218](https://github.com/eclipse-theia/theia/pull/16218) - Contributed on behalf of STMicroelectronics +- [core] fixed api tests on windows [#16050](https://github.com/eclipse-theia/theia/pull/16050) +- [core] fixed missing filters in save as dialog [#16247](https://github.com/eclipse-theia/theia/pull/16247) - Contributed on behalf of MVTec Software GmbH +- [core] fixed react warning for duplicate createroot calls on singleton reactdialogs [#16306](https://github.com/eclipse-theia/theia/pull/16306) +- [core] fixed test failures on Ubuntu with Node 22 [#16272](https://github.com/eclipse-theia/theia/pull/16272) +- [core] fixed: correctly handle plugin-icons during menu creation and use tooltip [#16181](https://github.com/eclipse-theia/theia/pull/16181) +- [core] localized property tooltips for `tasks.json` [#16300](https://github.com/eclipse-theia/theia/pull/16300) +- [core] new contribution point to modify the shell layout data [#16242](https://github.com/eclipse-theia/theia/pull/16242) +- [core] npm upgrade [#16264](https://github.com/eclipse-theia/theia/pull/16264) +- [core] Passed correct "effectiveMenuPath" to menu actions [#16148](https://github.com/eclipse-theia/theia/pull/16148) - Contributed on behalf of STMicroelectronics +- [core] ran npm upgrade [#15688](https://github.com/eclipse-theia/theia/pull/15688) +- [core] replaced links in status bar items which provide markdown with safe commands [#16182](https://github.com/eclipse-theia/theia/pull/16182) +- [core] restored extracted widget to main window [#15871](https://github.com/eclipse-theia/theia/pull/15871) - contributed on behalf of STMicroelectronics +- [core] Reverted "Ensure context menu arguments are propagated to submenus" [#16139](https://github.com/eclipse-theia/theia/pull/16139) +- [core] theia v1.64.0 released [#16100](https://github.com/eclipse-theia/theia/pull/16100) +- [core] translation update for version 1.65.0 [#16329](https://github.com/eclipse-theia/theia/pull/16329) +- [core] updated colors for editor gutter [#16096](https://github.com/eclipse-theia/theia/pull/16096) +- [debug] added `evaluate in debug console` command [#16289](https://github.com/eclipse-theia/theia/pull/16289) +- [debug] added `Run to Cursor` and `Run to Line` commands [#16219](https://github.com/eclipse-theia/theia/pull/16219) +- [debug] don't accept/cancel breakpoint editor while its suggest widget is visible [#16285](https://github.com/eclipse-theia/theia/pull/16285) +- [debug] Don't show inline stackframe pointer when line is empty [#16308](https://github.com/eclipse-theia/theia/pull/16308) - Contributed on behalf of MVTec Software GmbH +- [debug] enhanced localization of the debug package [#16305](https://github.com/eclipse-theia/theia/pull/16305) +- [debug] fixed breakpoints being lost when editing source [#16154](https://github.com/eclipse-theia/theia/pull/16154) +- [debug] fixed enabling continue command if the debugger is active for pressing F5 [#14641](https://github.com/eclipse-theia/theia/pull/14641) - Contributed by MVTec Software GmbH +- [debug] fixed line breakpoints not shifting if lines are inserted above [#16183](https://github.com/eclipse-theia/theia/pull/16183) +- [debug] fixed text misalignment caused by inline breakpoint decoration [#16160](https://github.com/eclipse-theia/theia/pull/16160) +- [debug] removed excessive spacing in breakpoint list [#16173](https://github.com/eclipse-theia/theia/pull/16173) - Contributed on behalf of STMicroelectronics +- [debug] showed the error message when setting a variable fails [#16235](https://github.com/eclipse-theia/theia/pull/16235) +- [debug] supported `copy value`/`copy as expression` in debug console [#16310](https://github.com/eclipse-theia/theia/pull/16310) +- [editor] stored/restored navigation locations without warning [#16207](https://github.com/eclipse-theia/theia/pull/16207) - Contributed on behalf of STMicroelectronics +- [ffmpeg] fixed ffmpeg cache write promise [#16297](https://github.com/eclipse-theia/theia/pull/16297) +- [getting-started] added a link to usage data & telemetry info [#16184](https://github.com/eclipse-theia/theia/pull/16184) +- [github] added sbom generation and upload workflow [#16290](https://github.com/eclipse-theia/theia/pull/16290) +- [monaco] fixed two dots in save as dialog [#16299](https://github.com/eclipse-theia/theia/pull/16299) +- [notebook] added support for vscode-notebook-cell uri's [#16276](https://github.com/eclipse-theia/theia/pull/16276) +- [plugin] added argument processor for plugin toolbar command arguments [#16230](https://github.com/eclipse-theia/theia/pull/16230) +- [plugin] new jupyter support and non chromium rendering fix [#16243](https://github.com/eclipse-theia/theia/pull/16243) +- [plugin-ext] added automatic `${viewId}.open` command [#16239](https://github.com/eclipse-theia/theia/pull/16239) +- [plugin-ext] correctly supported shadow dom when forwarding links from webviews [#16213](https://github.com/eclipse-theia/theia/pull/16213) +- [plugin-ext] fixed error in previous PR [#16178](https://github.com/eclipse-theia/theia/pull/16178) +- [plugin-ext] fixed leak in status bar registry that caused memory leaks on item updates [#16168](https://github.com/eclipse-theia/theia/pull/16168) +- [plugin-ext] fixed missing new file entries from vscode extensions [#16241](https://github.com/eclipse-theia/theia/pull/16241) - Contributed on behalf of MVTec Software GmbH +- [preferences] improved preferenceWidget state restoration on start and scope change [#16078](https://github.com/eclipse-theia/theia/pull/16078) +- [scripts] updated translation workflow to include common dirs [#16328](https://github.com/eclipse-theia/theia/pull/16328) +- [search-in-workspace] search in workspace / find in files functionality fixed in browser-only environment [#16231](https://github.com/eclipse-theia/theia/pull/16231) +- [task] enhanced localization of the task package [#16286](https://github.com/eclipse-theia/theia/pull/16286) +- [vscode] API evolution (public and proposed) to 1.104.0 [#16281](https://github.com/eclipse-theia/theia/pull/16281) - Contributed on behalf of STMicroelectronics + +[Breaking Changes:](#breaking_changes_1.65.0) + +- [ai-ide]`TaskContextFileStorageService.getStorageLocation` and `TaskContextFileStorageService.watchStorage` modified to run synchronously, with corresponding change of signature. [#16063](https://github.com/eclipse-theia/theia/pull/16063) +- [core] Make Preferences available in the back end [#16017](https://github.com/eclipse-theia/theia/pull/16017) - Contributed on behalf of STMicroelectronics\ +This PR allows to user default and user preferences in the back-end process. See [Migration.md](./doc/Migration.md) for breaking API changes +- [workspace] `WorkspaceService.reloadWindow` now requires the workspace path string parameter [#16238](https://github.com/eclipse-theia/theia/pull/16238) +- [filesystem] browser-only: fixed Safari compatibility issues, refactored implementation to use OPFS API with web workers, implemented file watching, folder copying, file/folder download and upload capabilities with streaming support. `OPFSFileSystemProvider` rewritten, `OPFSInitialization.getRootDirectory()` signature changed. `FileUploadService`/`FileDownloadService` moved/renamed. See [Migration.md](./doc/Migration.md) for migration steps. [#16187](https://github.com/eclipse-theia/theia/pull/16187) + +## 1.64.0 - 7/31/2025 + +- [ai-chat] adapted the default of the summary agent to gtp-4o [#16042](https://github.com/eclipse-theia/theia/pull/16042) +- [ai-chat] added session cleanup to `AgentDelegationTool` [#15996](https://github.com/eclipse-theia/theia/pull/15996) +- [ai-chat] correctly handled stream responses [#15942](https://github.com/eclipse-theia/theia/pull/15942) +- [ai-chat] preserved delegation content [#16066](https://github.com/eclipse-theia/theia/pull/16066) +- [ai-chat] reduced formatter selection prompts for changeset elements [#16094](https://github.com/eclipse-theia/theia/pull/16094) +- [ai-chat-ui] fixed cancel on escape in chat input [#16068](https://github.com/eclipse-theia/theia/pull/16068) +- [ai-chat-ui] improved chatUI auto-scroll / scroll-lock consistency [#15936](https://github.com/eclipse-theia/theia/pull/15936) +- [ai-chat-ui] improved delegated content part styling [#15956](https://github.com/eclipse-theia/theia/pull/15956) +- [ai-chat-ui] renamed 'pin agent' to 'agent' to avoid confusion [#16072](https://github.com/eclipse-theia/theia/pull/16072) +- [ai-core] added AI model aliases and default models [#15782](https://github.com/eclipse-theia/theia/pull/15782) +- [ai-core] displayed warning when selected variant does not exist [#15974](https://github.com/eclipse-theia/theia/pull/15974) +- [ai-core] fixed startup crash when 'ai-chat' was not included [#15902](https://github.com/eclipse-theia/theia/pull/15902) +- [ai-ide] added functions for launch configuration [#15941](https://github.com/eclipse-theia/theia/pull/15941) +- [ai-ide] introduced puppeteer to manage the browser instance [#15734](https://github.com/eclipse-theia/theia/pull/15734) +- [ai-ide] put new prompt templates under MIT [#16051](https://github.com/eclipse-theia/theia/pull/16051) +- [ai-ide] promoted AI IDE features to beta [#16058](https://github.com/eclipse-theia/theia/pull/16058) +- [ai-ide] refined architect task context creation prompt [#16059](https://github.com/eclipse-theia/theia/pull/16059) +- [ai-ide] showed selected prompted variant if configured, showed default otherwise [#15907](https://github.com/eclipse-theia/theia/pull/15907) +- [ai-ide] updated toolProvider to handle cancellation [#15951](https://github.com/eclipse-theia/theia/pull/15951) +- [ai-ide] used the agent name that requested the tool call in the change set title [#15952](https://github.com/eclipse-theia/theia/pull/15952) - Contributed on behalf of Lonti.com Pty Lt +- [ai-ollama] fixed crash in ollama language model [#16091](https://github.com/eclipse-theia/theia/pull/16091) +- [ai-ollama] used available parameter information from the provided tool description [#15575](https://github.com/eclipse-theia/theia/pull/15575) +- [application-package] bumped vscode API compatibility to 1.102.3 [#16081](https://github.com/eclipse-theia/theia/pull/16081) - Contributed on behalf of STMicroelectronics +- [core] bumped cookie to 1.0.2 [#16041](https://github.com/eclipse-theia/theia/pull/16041) - contributed by STMicroelectronics +- [core] bumped nyc to 17.1.0 [#15989](https://github.com/eclipse-theia/theia/pull/15989) - contributed by STMicroelectronics +- [core] correctly detached from DOM in DynamicMenuWidget [#16019](https://github.com/eclipse-theia/theia/pull/16019) +- [core] enabled clicks inside interactive hover tooltips and opened tooltip on status-bar click [#15971](https://github.com/eclipse-theia/theia/pull/15971) +- [core] ensured double click on tab maximizes area [#16079](https://github.com/eclipse-theia/theia/pull/16079) +- [core] fix cannot drop explorer view files on AI chat input on Windows [#15979](https://github.com/eclipse-theia/theia/pull/15979) - contributed on behalf of Lonti.com Pty Ltd. +- [core] fix: dynamicMenuWidget memory leak [#15982](https://github.com/eclipse-theia/theia/pull/15982) - contributed by Hbb +- [core] fixed default locale issue [#16093](https://github.com/eclipse-theia/theia/pull/16093) +- [core] fixed memory leak in RenderedToolbarItemImpl [#15949](https://github.com/eclipse-theia/theia/pull/15949) - contributed on behalf of Lonti.com Pty Ltd +- [core] fixed stale tree selection [#15928](https://github.com/eclipse-theia/theia/pull/15928) +- [core] fixed typeError in updateAutoSaveMode [#15991](https://github.com/eclipse-theia/theia/pull/15991) +- [core] reenabled deprecated paste command in electron [#15918](https://github.com/eclipse-theia/theia/pull/15918) - contributed on behalf of STMicroelectronics +- [core] setting service gracefully handled ENOENT [#15803](https://github.com/eclipse-theia/theia/pull/15803) +- [core] translation update for version 1.64.0 [#16099](https://github.com/eclipse-theia/theia/pull/16099) +- [core] ui fixes (squashed) [#15953](https://github.com/eclipse-theia/theia/pull/15953) +- [doc] updated publishing guide documentation [#15939](https://github.com/eclipse-theia/theia/pull/15939) +- [editor] removed now unneeded EditorManager override [#15934](https://github.com/eclipse-theia/theia/pull/15934) +- [electron] updated to Electron 37.2.1 [#15999](https://github.com/eclipse-theia/theia/pull/15999) +- [monaco] ide cannot fully restore to the previous state after restarting [#15898](https://github.com/eclipse-theia/theia/pull/15898) +- [navigator] removed double-click handler that caused folders to auto-open [#15869](https://github.com/eclipse-theia/theia/pull/15869) +- [notebook] fixed usage of lodash debounce [#16045](https://github.com/eclipse-theia/theia/pull/16045) +- [playwright] exported terminal, monaco and welcome-view playwright utilities [#16013](https://github.com/eclipse-theia/theia/pull/16013) +- [playwright] made expectation independent from execution order [#16047](https://github.com/eclipse-theia/theia/pull/16047) +- [plugin-ext] implemented support for remote MCP server [#16002](https://github.com/eclipse-theia/theia/pull/16002) +- [remote] improved type safety of remote ssh config [#15671](https://github.com/eclipse-theia/theia/pull/15671) +- [remote] used environment variable instead of wmic to get remote architecture [#16004](https://github.com/eclipse-theia/theia/pull/16004) +- [remote] used node 22 for remote containers [#15937](https://github.com/eclipse-theia/theia/pull/15937) +- [scm] added the 3-way merge editor [#15701](https://github.com/eclipse-theia/theia/pull/15701) +- [scm] fixed minor issues with scroll sync [#16038](https://github.com/eclipse-theia/theia/pull/16038) +- [scm] set relative sizes for horizontal split panel [#16036](https://github.com/eclipse-theia/theia/pull/16036) +- [toolbar] fixed styling of main toolbar items so enabled items have a pointer cursor [#15948](https://github.com/eclipse-theia/theia/pull/15948) - contributed on behalf of Lonti.com Pty Ltd +- [vsx-registry] disabled extension recommendations [#15830](https://github.com/eclipse-theia/theia/pull/15830) +- [vsx-registry] restored location for the clear all actions in vsx extension view [#15923](https://github.com/eclipse-theia/theia/pull/15923) - contributed on behalf of STMicroelectronics +- [workflows] published next version once a week [#15965](https://github.com/eclipse-theia/theia/pull/15965) + +[Breaking Changes:](#breaking_changes_1.64.0) + +- [ai-core] extracts UI from `@theia/ai-core` and `@theia/ai-mcp` to `@theia/ai-core-ui` and `@theia/ai-mcp-ui` [#16075](https://github.com/eclipse-theia/theia/pull/16075).\ + Include these new packages to restore the old behavior. Also moves the AI Enable preference to `@theia/ai-ide` and enables the AI features by default if `@theia/ai-ide` is not included. + +## 1.63 - 6/26/2025 + +- [ai-anthropic] implemented prompt caching for Anthropic [#15731](https://github.com/eclipse-theia/theia/pull/15731) +- [ai-anthropic] removed tool results from subsequential requests [#15702](https://github.com/eclipse-theia/theia/pull/15702) +- [ai-anthropic] reverted "fix: remove tool results from subsequential requests" [#15721](https://github.com/eclipse-theia/theia/pull/15721) +- [ai-anthropic] set opus 4 to 32000 max tokens [#15788](https://github.com/eclipse-theia/theia/pull/15788) +- [ai-chat] adapted all prompt ids to common schema [#15880](https://github.com/eclipse-theia/theia/pull/15880) +- [ai-chat] added async initialization to changesetfileelement [#15761](https://github.com/eclipse-theia/theia/pull/15761) +- [ai-chat] enabled agent-to-agent delegation via tool calls [#15736](https://github.com/eclipse-theia/theia/pull/15736) +- [ai-chat] filtered out error messages from the messages sent to the llm [#15720](https://github.com/eclipse-theia/theia/pull/15720) +- [ai-chat] fixed change set deletion [#15759](https://github.com/eclipse-theia/theia/pull/15759) +- [ai-chat] fixed pinning of the last mentioned agent rather than the first one [#15777](https://github.com/eclipse-theia/theia/pull/15777) +- [ai-chat] introduced tool call confirmation UI [#15714](https://github.com/eclipse-theia/theia/pull/15714) +- [ai-chat] removed requirement that agent has to be mentioned first [#15854](https://github.com/eclipse-theia/theia/pull/15854) +- [ai-chat] sanitized task context labels [#15762](https://github.com/eclipse-theia/theia/pull/15762) +- [ai-chat] provided a task context management / agent [#15732](https://github.com/eclipse-theia/theia/pull/15732) +- [ai-chat-ui] added chat retry button [#15779](https://github.com/eclipse-theia/theia/pull/15779) +- [ai-chat-ui] fixed chat input widget not tracking branches and pending state [#15727](https://github.com/eclipse-theia/theia/pull/15727) +- [ai-chat-ui] fixed difficulty to scroll up when auto scroll is enabled [#15748](https://github.com/eclipse-theia/theia/pull/15748) +- [ai-chat-ui] fixed paste handling in chat input [#15766](https://github.com/eclipse-theia/theia/pull/15766) +- [ai-chat-ui] fixed temporary scroll lock when user scrolls up in AI Chat [#15683](https://github.com/eclipse-theia/theia/pull/15683) +- [ai-chat-ui] fixed toolcall spinner [#15757](https://github.com/eclipse-theia/theia/pull/15757) +- [ai-chat-ui] showed active chat in chat dropdown [#15723](https://github.com/eclipse-theia/theia/pull/15723) +- [ai-chat-ui] started chat from task context [#15700](https://github.com/eclipse-theia/theia/pull/15700) +- [ai-chat-ui] supported instant request for chat initialized with task context and agent [#15778](https://github.com/eclipse-theia/theia/pull/15778) +- [ai-chat-ui] replaced YOLO terminology with "Always Allow" [#15756](https://github.com/eclipse-theia/theia/pull/15756) +- [ai-code-completion] added support for custom AI variables in code completion prompt [#15681](https://github.com/eclipse-theia/theia/pull/15681) - Contributed on behalf of Lonti.com Pty Ltd. +- [ai-code-completion] fixed caching in code completion [#15855](https://github.com/eclipse-theia/theia/pull/15855) +- [ai-code-completion] worked on improving code completion [#15715](https://github.com/eclipse-theia/theia/pull/15715) +- [ai-core] added chat variable for all open editors [#15775](https://github.com/eclipse-theia/theia/pull/15775) +- [ai-core] added fall back to default prompts if selected does not exist [#15879](https://github.com/eclipse-theia/theia/pull/15879) +- [ai-core] AI features accessible when AI is not enabled [#15780](https://github.com/eclipse-theia/theia/pull/15780) +- [ai-core] allowed to increase the number of retries before failing [#15730](https://github.com/eclipse-theia/theia/pull/15730) +- [ai-core] allowed adding variants via files [#15815](https://github.com/eclipse-theia/theia/pull/15815) +- [ai-core] fixed bug that customizations are treated as variants [#15846](https://github.com/eclipse-theia/theia/pull/15846) +- [ai-core] handled toolCall errors gracefully instead of throwing [#15800](https://github.com/eclipse-theia/theia/pull/15800) +- [ai-core] implemented theia-ai agent completion notification [#15816](https://github.com/eclipse-theia/theia/pull/15816) +- [ai-core] improved image support for tool calls [#15765](https://github.com/eclipse-theia/theia/pull/15765) +- [ai-core] fixed prompt fragment view resetting custom prompt fragments [#15852](https://github.com/eclipse-theia/theia/pull/15852) +- [ai-editor] improved ask AI feature [#15725](https://github.com/eclipse-theia/theia/pull/15725) +- [ai-editor] refined inline Ask AI chat input appearance [#15885](https://github.com/eclipse-theia/theia/pull/15885) +- [ai-editor] started chat from editor context [#15712](https://github.com/eclipse-theia/theia/pull/15712) +- [ai-editor] used chatInputWidget in AskAI Input and fixed keyboard scrolling [#15781](https://github.com/eclipse-theia/theia/pull/15781) +- [ai-editor] streamlined ask AI commands and fixed send to AI chat error [#15839](https://github.com/eclipse-theia/theia/pull/15839) +- [ai-google] updated the Google AI SDK [#15737](https://github.com/eclipse-theia/theia/pull/15737) +- [ai-ide] added ai tools for write through file changes [#15717](https://github.com/eclipse-theia/theia/pull/15717) +- [ai-ide] consolidated coder prompts [#15733](https://github.com/eclipse-theia/theia/pull/15733) +- [ai-ide] fixed agent tree selection highlighting in AI configuration widget [#15850](https://github.com/eclipse-theia/theia/pull/15850) +- [ai-ide] fixed AI Configuration widget tab bar overflow [#15739](https://github.com/eclipse-theia/theia/pull/15739) +- [ai-ide] included the ai-ide stylesheet in the secondary window [#15752](https://github.com/eclipse-theia/theia/pull/15752) +- [ai-ide] introduced appTester agent via browser automation [#15713](https://github.com/eclipse-theia/theia/pull/15713) +- [ai-ide] made workspace functions token efficient [#15703](https://github.com/eclipse-theia/theia/pull/15703) +- [ai-ide] made workspace search function more efficient / use less tokens [#15743](https://github.com/eclipse-theia/theia/pull/15743) +- [ai-ide] moved AI configuration view to main [#15726](https://github.com/eclipse-theia/theia/pull/15726) +- [ai-ide] refined coder prompt [#15774](https://github.com/eclipse-theia/theia/pull/15774) +- [ai-ide] reminded coder to use file change functions [#15848](https://github.com/eclipse-theia/theia/pull/15848) +- [ai-ide] reorganized architect prompts [#15859](https://github.com/eclipse-theia/theia/pull/15859) +- [ai-ide] used relative path in search results in workspace function [#15704](https://github.com/eclipse-theia/theia/pull/15704) +- [ai-ide] workspace search function allowed specifying file extensions [#15699](https://github.com/eclipse-theia/theia/pull/15699) +- [ai-ollama] updated ollama version and supported newest features [#15795](https://github.com/eclipse-theia/theia/pull/15795) +- [ai-openai] made sure to add openai stream options only in streaming models [#15706](https://github.com/eclipse-theia/theia/pull/15706) +- [ai-openai] supported more than 10 tool calls via OpenAI SDK [#15696](https://github.com/eclipse-theia/theia/pull/15696) +- [application-package] bumped vscode API compatibility to 1.101.1 [#15888](https://github.com/eclipse-theia/theia/pull/15888) - contributed on behalf of STMicroelectronics +- [core] cancelled hover preview on right mouse click [#15826](https://github.com/eclipse-theia/theia/pull/15826) +- [core] didn't focus window to reveal widget [#15760](https://github.com/eclipse-theia/theia/pull/15760) +- [core] didn't steal global focus for widget activation [#15735](https://github.com/eclipse-theia/theia/pull/15735) +- [core] fixed getMenuNode() for leaf nodes [#15845](https://github.com/eclipse-theia/theia/pull/15845) - contributed on behalf of STMicroelectronics +- [core] fixed initial configuration of backend loggers [#15705](https://github.com/eclipse-theia/theia/pull/15705) +- [core] fixed problems with menu item 15828_menu_visibility [#15856](https://github.com/eclipse-theia/theia/pull/15856) - Contributed on behalf of STMicroelectronics +- [core] fixed revealTab [#15754](https://github.com/eclipse-theia/theia/pull/15754) +- [core] listened for model will save events directly instead of registering a save participant [#15787](https://github.com/eclipse-theia/theia/pull/15787) - contributed on behalf of STMicroelectronics +- [core] removed obsolete menu workaround [#15753](https://github.com/eclipse-theia/theia/pull/15753) - Contributed on behalf of STMicroelectronics +- [core] returned undefined instead of throwing when getting non-existent menu [#15792](https://github.com/eclipse-theia/theia/pull/15792) - Contributed on behalf of STMicroelectronics +- [core] sync selection if props change [#15784](https://github.com/eclipse-theia/theia/pull/15784) +- [core] theia 1.62.0 released [#15679](https://github.com/eclipse-theia/theia/pull/15679) +- [core] translation update for version 1.63.0 [#15892](https://github.com/eclipse-theia/theia/pull/15892) +- [core] updated electron to version 36.4.0 [#15837](https://github.com/eclipse-theia/theia/pull/15837) - contributed on behalf of STMicroelectronics +- [core] Updated translations for version 1.62.0 [#15678](https://github.com/eclipse-theia/theia/pull/15678) +- [core] used Ctrl+Tab for tab switching on Mac [#15763](https://github.com/eclipse-theia/theia/pull/15763) +- [debug] enabled multiSelect for the debugBreakpointsWidget [#15749](https://github.com/eclipse-theia/theia/pull/15749) +- [doc] added (major) dependency update to publishing [#15674](https://github.com/eclipse-theia/theia/pull/15674) +- [editor] added missing NLS template item for format on save [#15813](https://github.com/eclipse-theia/theia/pull/15813) +- [electron-browser] fixed localization of files [#15677](https://github.com/eclipse-theia/theia/pull/15677) +- [filesystem] bumped multer version to 2.0.1 [#15808](https://github.com/eclipse-theia/theia/pull/15808) - contributed on behalf of STMicroelectronics +- [filesystem] bumped multer version to 2.0.1 [#15806](https://github.com/eclipse-theia/theia/pull/15806) - Contributed on behalf of STMicroelectronics +- [filesystem] bumped tar-fs to 3.0.9 on 1.61.1 [#15805](https://github.com/eclipse-theia/theia/pull/15805) +- [filesystem] deps: bumped tar-fs to 3.0.9 [#15719](https://github.com/eclipse-theia/theia/pull/15719) - contributed by STMicroelectronics +- [general] updated project info with styling information [#15722](https://github.com/eclipse-theia/theia/pull/15722) +- [monaco] enacted code actions when change set file was created [#15724](https://github.com/eclipse-theia/theia/pull/15724) +- [monaco] fixed existence check when contributing monaco menu items [#15746](https://github.com/eclipse-theia/theia/pull/15746) - Contributed on behalf of STMicroelectronics +- [playwright] avoided playwright tests depending on cwd [#15676](https://github.com/eclipse-theia/theia/pull/15676) - Contributed by MVTec Software GmbH +- [playwright] fixed playwright tests on windows [#15684](https://github.com/eclipse-theia/theia/pull/15684) - Contributed by MVTec Software GmbH +- [plugin] added support for the new vscode.lm.registerMcpServerDefinitionProvider API [#15755](https://github.com/eclipse-theia/theia/pull/15755) +- [plugin] supported encoding/decoding from workspace and while opening text documents [#15873](https://github.com/eclipse-theia/theia/pull/15873) - Contributed on behalf of STMicroelectronics +- [project-info] added widgets, commands and toolbar to project info [#15697](https://github.com/eclipse-theia/theia/pull/15697) +- [scm] amended enablement/visibility checks for dirty diff widget toolbar actions [#15851](https://github.com/eclipse-theia/theia/pull/15851) +- [search-in-workspace] fixed bug with incorrect height calculation of the search field [#15881](https://github.com/eclipse-theia/theia/pull/15881) +- [toolbar] restored toolbar default items [#15878](https://github.com/eclipse-theia/theia/pull/15878) + +## 1.62.0 - 5/28/2025 + +- [ai-anthropic] added Claude 4 models [#15640](https://github.com/eclipse-theia/theia/pull/15640) +- [ai-chat] added logic to handle empty text response correctly [#15638](https://github.com/eclipse-theia/theia/pull/15638) +- [ai-chat] overloaded ChatToolRequest.handler [#15655](https://github.com/eclipse-theia/theia/pull/15655) +- [ai-chat-ui] added logic to hide suggestions from chat input for message editing [#15617](https://github.com/eclipse-theia/theia/pull/15617) +- [ai-chat-ui] fixed chat input field to show a vertical scroll bar if content overflows [#15654](https://github.com/eclipse-theia/theia/pull/15654) +- [ai-code-completion] introduced debounce for inline AI code completion [#15619](https://github.com/eclipse-theia/theia/pull/15619) +- [ai-core] added check for a valid LanguageModelStreamResponsePart [#15653](https://github.com/eclipse-theia/theia/pull/15653) +- [ai-core] added default context resolution for custom agents [#15571](https://github.com/eclipse-theia/theia/pull/15571) +- [ai-core] added new generic AI communication model [#15409](https://github.com/eclipse-theia/theia/pull/15409) - Contributed on behalf of STMicroelectronics +- [ai-ide] added initial prompt for coder agent mode [#15569](https://github.com/eclipse-theia/theia/pull/15569) +- [ai-ide] added logic to open AI configuration view at bottom [#15637](https://github.com/eclipse-theia/theia/pull/15637) +- [ai-ide] added next prompt for architect [#15649](https://github.com/eclipse-theia/theia/pull/15649) +- [ai-ide] cleaned up next coder prompt [#15634](https://github.com/eclipse-theia/theia/pull/15634) +- [ai-ide] clarified resolution of context files for coder an architect [#15579](https://github.com/eclipse-theia/theia/pull/15579) +- [ai-ide] fixed a repetition in the coder prompt [#15650](https://github.com/eclipse-theia/theia/pull/15650) +- [ai-ide] improved file change set functions [#15642](https://github.com/eclipse-theia/theia/pull/15642) +- [ai-openai] added stream_options/include_usage only for openai models [#15615](https://github.com/eclipse-theia/theia/pull/15615) +- [ai-vercel-ai] clarified API key description for Vercel AI keys [#15665](https://github.com/eclipse-theia/theia/pull/15665) +- [ai-vercel-ai] introduced experimental generic LLM provider via Vercel AI [#15482](https://github.com/eclipse-theia/theia/pull/15482) +- [collaboration] updated OCT integration to v0.3 [#15633](https://github.com/eclipse-theia/theia/pull/15633) +- [core] added logic to close secondary windows on reload [#15591](https://github.com/eclipse-theia/theia/pull/15591) - Contributed on behalf of STMicroelectronics +- [core] added logic to render groups correctly in "more" tab bar menu [#15647](https://github.com/eclipse-theia/theia/pull/15647) - Contributed on behalf of STMicroelectronics +- [core] added logic to update tree upon becoming visible [#15595](https://github.com/eclipse-theia/theia/pull/15595) - Contributed on behalf of STMicroelectronics +- [core] added logic to use pointer capture for split handle dragging [#15643](https://github.com/eclipse-theia/theia/pull/15643) - Contributed on behalf of STMicroelectronics +- [core] added logic to use same autosave heuristic when closing widget [#15502](https://github.com/eclipse-theia/theia/pull/15502) +- [core] bumped dompurify to 3.2.4 [#15564](https://github.com/eclipse-theia/theia/pull/15564) - Contributed by STMicroelectronics +- [core] cleaned up handling of "toggle maximized" [#15547](https://github.com/eclipse-theia/theia/pull/15547) - Contributed on behalf of STMicroelectronics +- [core] improved handling of logging with proxies [#15478](https://github.com/eclipse-theia/theia/pull/15478) +- [core] made hover-service use platform showPopover() [#15452](https://github.com/eclipse-theia/theia/pull/15452) +- [debug] added logic to subscribe to decoration changes at initialization [#15573](https://github.com/eclipse-theia/theia/pull/15573) - Contributed by MVTec Software GmbH +- [debug] allowed to see editor hovers while debugging [#15609](https://github.com/eclipse-theia/theia/pull/15609) - Contributed by MVTec Software GmbH +- [dev-packages] fixed ssh terminals [#15443](https://github.com/eclipse-theia/theia/pull/15443) +- [editor] added logic to respect editor associations when opening diff-editors [#15422](https://github.com/eclipse-theia/theia/pull/15422) +- [editor] fixed "Show all opened editors" dropdown display by using correct icon class type [#15624](https://github.com/eclipse-theia/theia/pull/15624) +- [filesystem] bumped multer to 2.0.0 [#15614](https://github.com/eclipse-theia/theia/pull/15614) - Contributed by STMicroelectronics +- [filesystem] bumped tar-fs to 3.0.8 [#15562](https://github.com/eclipse-theia/theia/pull/15562) - Contributed by STMicroelectronics +- [notebook] made monaco commands available through command palette for notebook cells [#15538](https://github.com/eclipse-theia/theia/pull/15538) +- [playwright] improved playwright tests reliability [#15446](https://github.com/eclipse-theia/theia/pull/15446) +- [remote-wsl] added WSL remote support [#15543](https://github.com/eclipse-theia/theia/pull/15543) +- [vscode] bumped vscode API compatibility to 1.99.3 [#15658](https://github.com/eclipse-theia/theia/pull/15658) +- [vscode] added support for CommentAuthorInformation in CommentThread canreply [#15598](https://github.com/eclipse-theia/theia/pull/15598) - Contributed on behalf of STMicroelectronics +- [vscode] added support for TerminalState shell property [#15514](https://github.com/eclipse-theia/theia/pull/15514) - Contributed on behalf of STMicroelectronics + +[Breaking Changes:](#breaking_changes_1.62.0) + +- [core] refactored menu nodes [#14676](https://github.com/eclipse-theia/theia/pull/14676) - Contributed on behalf of STMicroelectronics +- [ai-core] refactored prompt management and the agent registration interface [#15632](https://github.com/eclipse-theia/theia/pull/15632)\ + Check the PR for more information. +- [ai-history] updated logic to use communication model in AI history [#15540](https://github.com/eclipse-theia/theia/pull/15540) - Contributed by STMicroelectronics\ + This refactoring removes the communication recording service. Manual recording is no longer needed. When using the `LanguageModelService`, LLM interactions are automatically recorded into a communication model, which can be inspected in the history view. +- [monaco] implemented "code actions on save" [#15555](https://github.com/eclipse-theia/theia/pull/15555) - Contributed on behalf of STMicroelectronics\ + Replaced `MonacoEditorModel.onWillSave` "wait until event" event with `registerWillSaveModelListener` for simpler semantics. Also removed the `EditorModelService.onWillSave` + as it's pure convenience and unused in framework code. + +## 1.61.0 - 4/29/2025 + +- [ai-anthropic] fix: do not set anthropic tool choice without tools [#15329](https://github.com/eclipse-theia/theia/pull/15329) +- [ai-chat] correctly returned tool input when creating the message [#15451](https://github.com/eclipse-theia/theia/pull/15451) +- [ai-chat] enhanced streaming content parsing for incomplete response content matches [#15387](https://github.com/eclipse-theia/theia/pull/15387) +- [ai-chat] added agent prompt suggestions & chat summary [#15427](https://github.com/eclipse-theia/theia/pull/15427) +- [ai-chat] added customizable welcome message [#15316](https://github.com/eclipse-theia/theia/pull/15316) +- [ai-chat] collapsed label from right & no printed   [#15344](https://github.com/eclipse-theia/theia/pull/15344) +- [ai-chat] fixed context menu paste [#15222](https://github.com/eclipse-theia/theia/pull/15222) +- [ai-chat] fixed space issue after variables and agent label in chat view [#15491](https://github.com/eclipse-theia/theia/pull/15491) +- [ai-chat] improved style of code blocks in modern theme [#15351](https://github.com/eclipse-theia/theia/pull/15351) +- [ai-chat] introduced editable chat requests [#15479](https://github.com/eclipse-theia/theia/pull/15479) +- [ai-chat] made private functions and injections protected in chatviewtreewidget to make them overridable [#15297](https://github.com/eclipse-theia/theia/pull/15297) - Contributed by MVTec Software GmbH +- [ai-chat] removed outline in the chat session settings editor [#15356](https://github.com/eclipse-theia/theia/pull/15356) +- [ai-chat] consolidated widget labels [#15304](https://github.com/eclipse-theia/theia/pull/15304) +- [ai-chat] fixed communication recording in orchestrator [#15328](https://github.com/eclipse-theia/theia/pull/15328) +- [ai-code-completion] fixed typo in code completion prompt [#15383](https://github.com/eclipse-theia/theia/pull/15383) +- [ai-code-completion] provided range to completion item to allow for correct inline display [#15398](https://github.com/eclipse-theia/theia/pull/15398) +- [ai-code-completion] turned automatic inline code completion off by default [#15333](https://github.com/eclipse-theia/theia/pull/15333) +- [ai-core] added shortcut for adding the current file to the ai chat context [#15252](https://github.com/eclipse-theia/theia/pull/15252) +- [ai-core] fixed response content in language model utility [#15377](https://github.com/eclipse-theia/theia/pull/15377) +- [ai-core] made parameters in ToolRequest mandatory [#15288](https://github.com/eclipse-theia/theia/pull/15288) +- [ai-core] resolved unresolved variables to empty string [#15463](https://github.com/eclipse-theia/theia/pull/15463) +- [ai-core] white label prompt templates [#15322](https://github.com/eclipse-theia/theia/pull/15322) - Contributed by MVTec Software GmbH +- [ai-core] added initial support for tracking token usage [#15378](https://github.com/eclipse-theia/theia/pull/15378) +- [ai-core] allowed project specific prompt additions [#15236](https://github.com/eclipse-theia/theia/pull/15236) +- [ai-core] allowed workspace specific custom agents [#15457](https://github.com/eclipse-theia/theia/pull/15457) +- [ai-core] ensured all tool providers bound to self [#15330](https://github.com/eclipse-theia/theia/pull/15330) +- [ai-google] added gemini flash 2.5 to default models [#15487](https://github.com/eclipse-theia/theia/pull/15487) +- [ai-google] added native gemini provider [#15334](https://github.com/eclipse-theia/theia/pull/15334) +- [ai-history] more legible history entries [#15483](https://github.com/eclipse-theia/theia/pull/15483) +- [ai-ide] added a new tool which allows to list and run tasks [#15504](https://github.com/eclipse-theia/theia/pull/15504) +- [ai-ide] added a suggestion to architect to summarize the current session and continue with coder [#15512](https://github.com/eclipse-theia/theia/pull/15512) +- [ai-ide] added project info prompt fragment [#15449](https://github.com/eclipse-theia/theia/pull/15449) +- [ai-ide] clarified replace function description [#15442](https://github.com/eclipse-theia/theia/pull/15442) +- [ai-ide] fixed getFileDiagnostics waits forever [#15305](https://github.com/eclipse-theia/theia/pull/15305) +- [ai-ide] minor improvements mcp view [#15364](https://github.com/eclipse-theia/theia/pull/15364) +- [ai-ide] modified link in AI chat instructions to show AI settings directly [#15326](https://github.com/eclipse-theia/theia/pull/15326) +- [ai-ide] refined ai setting descriptions [#15250](https://github.com/eclipse-theia/theia/pull/15250) +- [ai-ide] refined coder prompt [#15358](https://github.com/eclipse-theia/theia/pull/15358) +- [ai-ide] used camelCase in React SVG [#15367](https://github.com/eclipse-theia/theia/pull/15367) +- [ai-ide, ai-mcp] added MCP Server config view to AI Configuration [#15280](https://github.com/eclipse-theia/theia/pull/15280) +- [ai-mcp] allowed to add all MCP functions via prompt fragment [#15270](https://github.com/eclipse-theia/theia/pull/15270) +- [ai-ollama] fixed Ollama regression in Theia 1.60 [#15476](https://github.com/eclipse-theia/theia/pull/15476) +- [ai-openai] added gpt-4.1 models to the list of default models [#15465](https://github.com/eclipse-theia/theia/pull/15465) +- [ai-scanoss] fixed scanoss button/icon in chat ui [#15339](https://github.com/eclipse-theia/theia/pull/15339) +- [api-samples] used `ElectronConnectionHandler` to connect updater services [#15430](https://github.com/eclipse-theia/theia/pull/15430) +- [application-package] bumped VS Code API version to 1.98.2 [#15341](https://github.com/eclipse-theia/theia/pull/15341) - Contributed on behalf of STMicroelectronics +- [console] added missing `editor` dependency to `console` [#15354](https://github.com/eclipse-theia/theia/pull/15354) +- [console] waited for async creation of debug console widget [#15388](https://github.com/eclipse-theia/theia/pull/15388) - Contributed on behalf of STMicroelectronics +- [core] clarified error for multiple occurrences during replace [#15481](https://github.com/eclipse-theia/theia/pull/15481) +- [core] did not re-export the configuration folder as env variable [#15376](https://github.com/eclipse-theia/theia/pull/15376) +- [core] fixed resolve from root [#15331](https://github.com/eclipse-theia/theia/pull/15331) +- [core] fixed switching the localization language back to the default [#15445](https://github.com/eclipse-theia/theia/pull/15445) +- [core] hid overflow in view container headers [#15321](https://github.com/eclipse-theia/theia/pull/15321) - contributed on behalf of STMicroelectronics +- [core] hide overflow on sidebar-toolbar [#15492](https://github.com/eclipse-theia/theia/pull/15492) - contributed on behalf of STMicroelectronics +- [core] limited the width of tab-bar rows to 100% of parent [#15260](https://github.com/eclipse-theia/theia/pull/15260) - contributed on behalf of STMicroelectronics +- [core] made icons right-aligned [#15373](https://github.com/eclipse-theia/theia/pull/15373) - contributed on behalf of STMicroelectronics +- [core] made preventTabbingOutsideDialog more easily overridable [#15460](https://github.com/eclipse-theia/theia/pull/15460) +- [core] relayout dock panel when breadcrumbs became active [#15342](https://github.com/eclipse-theia/theia/pull/15342) - contributed on behalf of STMicroelectronics +- [core] removed es6-promise & setImmediate [#15436](https://github.com/eclipse-theia/theia/pull/15436) - webperf contribution +- [core] reverted #15331 to fix webviews [#15421](https://github.com/eclipse-theia/theia/pull/15421) - Contributed on behalf of STMicroelectronics +- [core] set selection upon editor navigation only after editor was fully visible [#15302](https://github.com/eclipse-theia/theia/pull/15302) - contributed on behalf of STMicroelectronics +- [core] theia 1.60.0 release [#15385](https://github.com/eclipse-theia/theia/pull/15385) +- [core] translation update for version 1.60.0 [#15382](https://github.com/eclipse-theia/theia/pull/15382) - triggered by @sgraband +- [core] used fixed version 1.5.5 of perfect-scrollbar [#15279](https://github.com/eclipse-theia/theia/pull/15279) - contributed on behalf of STMicroelectronics +- [debug] fixed breakpoint editor shrinking in size [#15515](https://github.com/eclipse-theia/theia/pull/15515) +- [debug] reacted to editor model changing [#15509](https://github.com/eclipse-theia/theia/pull/15509) +- [debug] used editor widget as key for debug editor models [#15516](https://github.com/eclipse-theia/theia/pull/15516) - contributed on behalf of STMicroelectronics +- [dev-container] added DOCKER_HOST support to devcontainer [#15350](https://github.com/eclipse-theia/theia/pull/15350) +- [docs] fixed broken links in documentation [#15454](https://github.com/eclipse-theia/theia/pull/15454) +- [getting-started] added news section with AI to welcome page [#15269](https://github.com/eclipse-theia/theia/pull/15269) +- [monaco] avoided double registration of sticky scroll toggle [#15366](https://github.com/eclipse-theia/theia/pull/15366) +- [monaco] disposed of child instantiation services in MonacoEditor [#15246](https://github.com/eclipse-theia/theia/pull/15246) +- [monaco] ensured valid editor was constructed before attempting to use editor services [#15238](https://github.com/eclipse-theia/theia/pull/15238) +- [monaco] fixed autocomplete content in chat view [#15240](https://github.com/eclipse-theia/theia/pull/15240) +- [monaco] fixed issue with dirty state not correctly set when save operation is canceled [#15310](https://github.com/eclipse-theia/theia/pull/15310) +- [monaco] passed multiple classnames as array of strings [#15244](https://github.com/eclipse-theia/theia/pull/15244) +- [monaco] show context menu for editor minimap [#15220](https://github.com/eclipse-theia/theia/pull/15220) +- [monaco] used simpleMonacoEditor for most inline editors [#15389](https://github.com/eclipse-theia/theia/pull/15389) +- [notebook] fixed cell editor and notebook output selection [#15384](https://github.com/eclipse-theia/theia/pull/15384) +- [plugin] made diagnosticcollection iterable [#15361](https://github.com/eclipse-theia/theia/pull/15361) - contributed on behalf of STMicroelectronics +- [plugin] removed proposed API createFileSystemWatcher [#15265](https://github.com/eclipse-theia/theia/pull/15265) - contributed on behalf of STMicroelectronics +- [plugin] renamed authenticationForceNewSessionOptions [#15264](https://github.com/eclipse-theia/theia/pull/15264) - contributed on behalf of STMicroelectronics +- [plugin] supported sourceControlResourceGroup optional contextValue [#15219](https://github.com/eclipse-theia/theia/pull/15219) - contributed on behalf of STMicroelectronics +- [plugin-ext] implemented the registerDiffInformationCommand to address issue #14144 [#15406](https://github.com/eclipse-theia/theia/pull/15406) +- [plugin-ext] prevented plugin localization errors [#15268](https://github.com/eclipse-theia/theia/pull/15268) +- [preferences] explicitly set scrolling element to avoid document scroll [#15315](https://github.com/eclipse-theia/theia/pull/15315) +- [preferences] fixed issue where minimums of 0 for number preferences were ignored [#15230](https://github.com/eclipse-theia/theia/pull/15230) +- [remote] basic ssh_config support [#15499](https://github.com/eclipse-theia/theia/pull/15499) +- [scm] updated dirty diff when editor became visible [#15505](https://github.com/eclipse-theia/theia/pull/15505) - Contributed on behalf of STMicroelectronics +- [search-in-workspace] fixed SiW height mismatch [#15287](https://github.com/eclipse-theia/theia/pull/15287) +- [task] only called resolve() on tasks that have no execution [#15480](https://github.com/eclipse-theia/theia/pull/15480) - contributed on behalf of STMicroelectronics +- [terminal] added terminal via "+" in terminal tool bar [#15470](https://github.com/eclipse-theia/theia/pull/15470) +- [test] updated deprecated xterm dependency [#15523](https://github.com/eclipse-theia/theia/pull/15523) - contributed on behalf of STMicroelectronics + +[Breaking Changes:](#breaking_changes_1.61.0) + +- [core] allow to disable plugins. The PR includes a couple of renamings: `HostedPluginDeployerHandler` => `PluginDeployerHandlerImpl` and +`PluginServerHandler` => `PluginServerImpl`. Also removed the ability of `HostedPluginProcess` to add extra deployed plugins. [#15205](https://github.com/eclipse-theia/theia/pull/15205) - contributed on behalf of STMicroelectronics +- [core] removed version fix of `@types/express-serve-static-core` to `5.0.4`. Adopters might need to do this as well if they run into typing issues. [#15415](https://github.com/eclipse-theia/theia/pull/15415) +- [git] stop publishing the `@theia/git` extension. This extension has been deprecated for a long time. Please use the built-in VS Code Git extension instead, which offers the same feature set. [#15471](https://github.com/eclipse-theia/theia/pull/15471) + +## 1.60.0 - 04/03/2025 + +- [ai] add dummy preference descriptions to open AI config widget [#15166](https://github.com/eclipse-theia/theia/pull/15166) +- [ai] add function to retrieve diagnostics [#14974](https://github.com/eclipse-theia/theia/pull/14974) +- [ai] add gpt-4.5-preview as a default model [#15090](https://github.com/eclipse-theia/theia/pull/15090) +- [ai] add MCP Server config view to AI Configuration [#15280](https://github.com/eclipse-theia/theia/pull/15280) +- [ai] add native gemini provider [#15334](https://github.com/eclipse-theia/theia/pull/15334) +- [ai] add schema for agent settings [#15175](https://github.com/eclipse-theia/theia/pull/15175) +- [ai] allow project specific prompt additions [#15236](https://github.com/eclipse-theia/theia/pull/15236) +- [ai] allow to add all MCP functions via prompt fragment [#15270](https://github.com/eclipse-theia/theia/pull/15270) +- [ai] chore(chat): minor chat style improvements [#15112](https://github.com/eclipse-theia/theia/pull/15112) +- [ai] chore(chat): pass pinned agent in frontend chat service [#15070](https://github.com/eclipse-theia/theia/pull/15070) +- [ai] chore: improve style of code blocks in modern theme [#15351](https://github.com/eclipse-theia/theia/pull/15351) +- [ai] chore: remove outline in the chat session settings editor [#15356](https://github.com/eclipse-theia/theia/pull/15356) +- [ai] consider TerminalLinkProvider contributions recursively [#15177](https://github.com/eclipse-theia/theia/pull/15177) +- [ai] consolidate widget labels [#15304](https://github.com/eclipse-theia/theia/pull/15304) +- [ai] fix(ai-chat): add space after all autocompletions in AI chat [#15052](https://github.com/eclipse-theia/theia/pull/15052) +- [ai] fix: Pin node-abi version to 3.x due to Node.js 22+ requirement in 4.x [#15212](https://github.com/eclipse-theia/theia/pull/15212) +- [ai] fix: autocomplete content in chat view [#15240](https://github.com/eclipse-theia/theia/pull/15240) +- [ai] fix: communication recording in Orchestrator [#15328](https://github.com/eclipse-theia/theia/pull/15328) +- [ai] fix: do not set anthropic tool choice without tools [#15329](https://github.com/eclipse-theia/theia/pull/15329) +- [ai] fix: fix response content in language model utility [#15377](https://github.com/eclipse-theia/theia/pull/15377) +- [ai] fix: getFileDiagnostics waits forever [#15305](https://github.com/eclipse-theia/theia/pull/15305) +- [ai] fix: prevent autocompletion from triggering incorrectly within words [#15030](https://github.com/eclipse-theia/theia/pull/15030) +- [ai] fix(chat): fix context menu paste [#15222](https://github.com/eclipse-theia/theia/pull/15222) +- [ai] feat(chat): add customizable welcome message [#15316](https://github.com/eclipse-theia/theia/pull/15316) +- [ai] feat(chat): introduce LLM-based chat naming and last interaction date [#15116](https://github.com/eclipse-theia/theia/pull/15116) +- [ai] fix: ensure that the dirty state is correctly set even when the current save operation is canceled (#15308). [#15310](https://github.com/eclipse-theia/theia/pull/15310) +- [ai] initialize AIActivationService from preferences [#15044](https://github.com/eclipse-theia/theia/pull/15044) - Contributed by MVTec Software GmbH +- [ai] make parameters in ToolRequest mandatory [#15288](https://github.com/eclipse-theia/theia/pull/15288) +- [ai] make private functions and injections protected in ChatViewTreeWidget to make them overridable [#15297](https://github.com/eclipse-theia/theia/pull/15297) - Contributed by MVTec Software GmbH +- [ai] modify link in AI chat instructions to show AI settings directly [#15326](https://github.com/eclipse-theia/theia/pull/15326) +- [ai] put all prompts under MIT license [#15159](https://github.com/eclipse-theia/theia/pull/15159) +- [ai] refine AI setting descriptions [#15250](https://github.com/eclipse-theia/theia/pull/15250) +- [ai] refine coder prompt [#15358](https://github.com/eclipse-theia/theia/pull/15358) +- [ai] set correct defaults for max tokens for anthropic models [#15198](https://github.com/eclipse-theia/theia/pull/15198) +- [ai] set z-index of hovers to 1000 [#15172](https://github.com/eclipse-theia/theia/pull/15172) +- [ai] show news section with AI on welcome page [#15269](https://github.com/eclipse-theia/theia/pull/15269) +- [ai] turn automatic inline code completion off by default [#15333](https://github.com/eclipse-theia/theia/pull/15333) +- [ai] use camelCase in React SVG [#15367](https://github.com/eclipse-theia/theia/pull/15367) +- [ai] add shortcut for adding the current file to the AI chat context [#15252](https://github.com/eclipse-theia/theia/pull/15252) +- [ai] add variable completion for {{}} syntax in prompttemplate [#15026](https://github.com/eclipse-theia/theia/pull/15026) +- [console] fix: add missing editor dependency to console [#15354](https://github.com/eclipse-theia/theia/pull/15354) +- [core] do not re-export the configuration folder as env variable [#15376](https://github.com/eclipse-theia/theia/pull/15376) +- [core] fix resolve from root [#15331](https://github.com/eclipse-theia/theia/pull/15331) +- [core] fixed node-abi version to 3.x due to Node.js 22+ requirement in 4.x [#15212](https://github.com/eclipse-theia/theia/pull/15212) +- [core] hide overflow in view container headers [#15321](https://github.com/eclipse-theia/theia/pull/15321) - Contributed on behalf of STMicroelectronics +- [core] limit the width of tab-bar rows to 100% of parent [#15260](https://github.com/eclipse-theia/theia/pull/15260) - Contributed on behalf of STMicroelectronics +- [core] made icons right-aligned [#15373](https://github.com/eclipse-theia/theia/pull/15373) - Contributed on behalf of STMicroelectronics +- [core] relayout dock panel when breadcrumbs become active [#15342](https://github.com/eclipse-theia/theia/pull/15342) - Contributed on behalf of STMicroelectronics +- [core] set z-index of hovers to 1000 [#15172](https://github.com/eclipse-theia/theia/pull/15172) +- [core] sync theia dark/light theme with electron nativeTheme setting [#15037](https://github.com/eclipse-theia/theia/pull/15037) - Contributed by MVTec Software GmbH +- [core] use fixed version 1.5.5 of perfect-scrollbar [#15279](https://github.com/eclipse-theia/theia/pull/15279) - Contributed on behalf of STMicroelectronics +- [debug] expand local variables by default [#15017](https://github.com/eclipse-theia/theia/pull/15017) - Contributed by MVTec Software GmbH +- [debug] fix: clipping issue in debug hover (#15086) [#15154](https://github.com/eclipse-theia/theia/pull/15154) +- [debug] fix: store original handle of debug adapter config [#15149](https://github.com/eclipse-theia/theia/pull/15149) +- [debug] improve displaying inline frame decorator [#15097](https://github.com/eclipse-theia/theia/pull/15097) - Contributed by MVTec Software GmbH +- [dev] chore: use shared packages in src-gen [#15185](https://github.com/eclipse-theia/theia/pull/15185) - Contributed on behalf of STMicroelectronics +- [dev] improve error handling on optional dependencies [#14943](https://github.com/eclipse-theia/theia/pull/14943) +- [filesystem] don't stop watching folder because of dropped events. [#15111](https://github.com/eclipse-theia/theia/pull/15111) - Contributed on behalf of STMicroelectronics +- [memory-inspector] style: inputselect of memory inspector ui enhanced [#15032](https://github.com/eclipse-theia/theia/pull/15032) +- [monaco] dispose of child instantiation services in MonacoEditor [#15246](https://github.com/eclipse-theia/theia/pull/15246) +- [monaco] ensure valid editor constructed before attempting to use editor services [#15238](https://github.com/eclipse-theia/theia/pull/15238) +- [monaco] ensure word-wrap respected when diff editors side by side [#15161](https://github.com/eclipse-theia/theia/pull/15161) +- [monaco] handle visibility changes for diff editors [#15189](https://github.com/eclipse-theia/theia/pull/15189) +- [monaco] set selection upon editor navigation only after editor is fully visible [#15302](https://github.com/eclipse-theia/theia/pull/15302) - Contributed on behalf of STMicroelectronics +- [monaco] show context menu for editor minimap [#15220](https://github.com/eclipse-theia/theia/pull/15220) +- [monaco] workspace Symbols: pass multiple classnames as array of strings [#15244](https://github.com/eclipse-theia/theia/pull/15244) +- [notebook] fix: ensure NOTEBOOK_CELL_TYPE context key is set during initialization [#15182](https://github.com/eclipse-theia/theia/pull/15182) +- [playwright] don't open context menu on Playwright explorer selection [#15143](https://github.com/eclipse-theia/theia/pull/15143) +- [playwright] suggestion to fix missing lib folder in playwright package [#15122](https://github.com/eclipse-theia/theia/pull/15122) +- [plugin] improve plugin package localization [#15142](https://github.com/eclipse-theia/theia/pull/15142) +- [plugin] prevent plugin localization errors [#15268](https://github.com/eclipse-theia/theia/pull/15268) +- [plugin] support "Save As" for custom editors [#14972](https://github.com/eclipse-theia/theia/pull/14972) +- [preferences] ensure correct node expansion with short trailing sections [#15005](https://github.com/eclipse-theia/theia/pull/15005) +- [preferences] explicitely set scrolling element to avoid document scroll [#15315](https://github.com/eclipse-theia/theia/pull/15315) +- [preferences] fix issue where minimums of 0 for number preferences are ignored [#15230](https://github.com/eclipse-theia/theia/pull/15230) +- [output] fix: manage channel addition without show usage [#15101](https://github.com/eclipse-theia/theia/pull/15101) - Contributed by STMicroelectronics +- [search] fix SiW height mismatch [#15287](https://github.com/eclipse-theia/theia/pull/15287) +- [terminal] add commandsToSkipShell preference for plugin support [#15099](https://github.com/eclipse-theia/theia/pull/15099) +- [vscode] bump VS Code API version to 1.98.2 [#15341](https://github.com/eclipse-theia/theia/pull/15341) - Contributed on behalf of STMicroelectronics +- [vscode] make DiagnosticCollection iterable [#15361](https://github.com/eclipse-theia/theia/pull/15361) - Contributed on behalf of STMicroelectronics +- [vscode] remove duplicate declaration for DocumentDropEdit [#15126](https://github.com/eclipse-theia/theia/pull/15126) - Contributed on behalf of STMicroelectronics +- [vscode] rename AuthenticationForceNewSessionOptions [#15264](https://github.com/eclipse-theia/theia/pull/15264) - Contributed on behalf of STMicroelectronics +- [vscode] selection properties are now readonly [#15141](https://github.com/eclipse-theia/theia/pull/15141) - Contributed on behalf of STMicroelectronics +- [vscode] support keepWhitespace in SnippetTextEdit and insertSnippet [#15176](https://github.com/eclipse-theia/theia/pull/15176) - Contributed on behalf of STMicroelectronics +- [vscode] support SourceControlResourceGroup optional contextValue [#15219](https://github.com/eclipse-theia/theia/pull/15219) - Contributed on behalf of STMicroelectronics +- [vscode] support command workbench.extensions.command.installFromVSIX [#15179](https://github.com/eclipse-theia/theia/pull/15179) - Contributed on behalf of STMicroelectronics + +[Breaking Changes:](#breaking_changes_1.60.0) + +- [core] fixed version `@types/express` to `^4.17.21` and `@types/express-serve-static-core` to `5.0.4`. This might be required for adopters as well if they run into typing issues. [#15147](https://github.com/eclipse-theia/theia/pull/15147) +- [core] migration from deprecated `phosphorJs` to actively maintained fork `Lumino` [#14320](https://github.com/eclipse-theia/theia/pull/14320) - Contributed on behalf of STMicroelectronics + Adopters importing `@phosphor` packages now need to import from `@lumino`. CSS selectors refering to `.p-` classes now need to refer to `.lm-` classes. There are also minor code adaptations, for example now using `iconClass` instead of `icon` in Lumino commands. +- [core] Refactor menu nodes [#14676](https://github.com/eclipse-theia/theia/pull/14676) - Contributed on behalf of STMicroelectronics + +[Breaking Changes:](#breaking_changes_1.60.0) + +- [ai-chat] `ParsedChatRequest.variables` is now `ResolvedAIVariable[]` instead of a `Map` [#15196](https://github.com/eclipse-theia/theia/pull/15196) +- [ai-chat] `ChatRequestParser.parseChatRequest` is now asynchronous and expects an additional `ChatContext` parameter [#15196](https://github.com/eclipse-theia/theia/pull/15196) + +## 1.59.0 - 02/27/2025 + +- [ai] added claude sonnet 3.7 to default models [#15023](https://github.com/eclipse-theia/theia/pull/15023) +- [ai] added contextsummary variable to ai system [#14971](https://github.com/eclipse-theia/theia/pull/14971) +- [ai] aligned ai chat toggle keybinding with vs code on macos [#14850](https://github.com/eclipse-theia/theia/pull/14850) +- [ai] allowed multiple replacements in coder function [#14934](https://github.com/eclipse-theia/theia/pull/14934) +- [ai] allowed to close chats again [#14992](https://github.com/eclipse-theia/theia/pull/14992) +- [ai] chore: used fileservice.exist instead of trying to read the file [#14849](https://github.com/eclipse-theia/theia/pull/14849) +- [ai] chore(chat): moved chat window to the right by default [#14970](https://github.com/eclipse-theia/theia/pull/14970) +- [ai] consolidated the variables we provided in the chat [#15021](https://github.com/eclipse-theia/theia/pull/15021) +- [ai] corrected description in workspace agent functions [#14898](https://github.com/eclipse-theia/theia/pull/14898) +- [ai] correctly set the systempromptid in custom agents [#14988](https://github.com/eclipse-theia/theia/pull/14988) +- [ai] feat(ai): enabled context variables for chat requests [#14787](https://github.com/eclipse-theia/theia/pull/14787) +- [ai] fixed autocompletion for functions in chat input [#14838](https://github.com/eclipse-theia/theia/pull/14838) +- [ai] fixed: provided open handler for quick file open [#15003](https://github.com/eclipse-theia/theia/pull/15003) +- [ai] fixed(chat): avoided file suggestions on colons [#14965](https://github.com/eclipse-theia/theia/pull/14965) +- [ai] fixed(chat): improved variable autocompletion [#15018](https://github.com/eclipse-theia/theia/pull/15018) +- [ai] fixed(chat): prevented duplicate context element entries [#14979](https://github.com/eclipse-theia/theia/pull/14979) +- [ai] fixed(chat): prevented focus outline color of ai chat [#15020](https://github.com/eclipse-theia/theia/pull/15020) +- [ai] fixed closing changesets [#14994](https://github.com/eclipse-theia/theia/pull/14994) +- [ai] fixed structured output dispatch and settings [#14811](https://github.com/eclipse-theia/theia/pull/14811) +- [ai] fixed tool call prompt text replacement [#14830](https://github.com/eclipse-theia/theia/pull/14830) +- [ai] fixed tool calling string in messages [#14906](https://github.com/eclipse-theia/theia/pull/14906) +- [ai] fixed: quick input hover initialization [#15064](https://github.com/eclipse-theia/theia/pull/15064) +- [ai] instructed coder to use replace when search and replace failed [#15061](https://github.com/eclipse-theia/theia/pull/15061) +- [ai] implemented asynch iterator for open ai stream [#14920](https://github.com/eclipse-theia/theia/pull/14920) +- [ai] improved integration between variableregistry and ai variableservice [#14827](https://github.com/eclipse-theia/theia/pull/14827) +- [ai] introduced ai-ide package and moved ai configuration view [#14948](https://github.com/eclipse-theia/theia/pull/14948) +- [ai] labeled ai as alpha [#14968](https://github.com/eclipse-theia/theia/pull/14968) +- [ai] localized theia ai strings [#14857](https://github.com/eclipse-theia/theia/pull/14857) +- [ai] made dependency on monaco explicit [#14907](https://github.com/eclipse-theia/theia/pull/14907) +- [ai] made universal default prompt plain [#15007](https://github.com/eclipse-theia/theia/pull/15007) +- [ai] made new code completion prompt default and turned on inline by default [#14822](https://github.com/eclipse-theia/theia/pull/14822) +- [ai] pinned chat agent [#14716](https://github.com/eclipse-theia/theia/pull/14716) +- [ai] refined coder prompt [#14887](https://github.com/eclipse-theia/theia/pull/14887) +- [ai] refined search-replace prompt default of coder and made it default [#14870](https://github.com/eclipse-theia/theia/pull/14870) +- [ai] refined system message settings [#14877](https://github.com/eclipse-theia/theia/pull/14877) +- [ai] refactored chat agents into separate ide package [#14852](https://github.com/eclipse-theia/theia/pull/14852) +- [ai] removed aieditormanager [#14912](https://github.com/eclipse-theia/theia/pull/14912) +- [ai] renamed workspace agent to architect [#14963](https://github.com/eclipse-theia/theia/pull/14963) +- [ai] set o1 to stream by default [#14947](https://github.com/eclipse-theia/theia/pull/14947) +- [ai] streamlined the agent code [#14859](https://github.com/eclipse-theia/theia/pull/14859) +- [ai] supported anyof in function parameters [#15012](https://github.com/eclipse-theia/theia/pull/15012) +- [ai] updated chatmodel naming [#14913](https://github.com/eclipse-theia/theia/pull/14913) +- [ai] updated default openai models [#14808](https://github.com/eclipse-theia/theia/pull/14808) +- [ai] used content from monacoworkspaceservice for ai getfilecontent [#14885](https://github.com/eclipse-theia/theia/pull/14885) +- [application-manager] used default import of fix-path package [#14812](https://github.com/eclipse-theia/theia/pull/14812) +- [ci] fixed next build [#14981](https://github.com/eclipse-theia/theia/pull/14981) +- [console] fixed: console text model used the language id [#14854](https://github.com/eclipse-theia/theia/pull/14854) +- [core] added commands to toggle left and right panel [#15041](https://github.com/eclipse-theia/theia/pull/15041) +- [core] fixed: removed files in editor tab when deleted [#14990](https://github.com/eclipse-theia/theia/pull/14990) +- [core] fixed problems related with menu bar updates on focus change [#14959](https://github.com/eclipse-theia/theia/pull/14959) - Contributed on behalf of STMicroelectronics +- [core] made context element mandatory when showing a context menu [#14982](https://github.com/eclipse-theia/theia/pull/14982) - Contributed on behalf of STMicroelectronics +- [core] only sent visibility change notification when the visibility actually changed [#15040](https://github.com/eclipse-theia/theia/pull/15040) - Contributed by STMicroelectronics +- [core] streamlined logging api [#14861](https://github.com/eclipse-theia/theia/pull/14861) +- [core] supported manual override of text blocks [#14712](https://github.com/eclipse-theia/theia/pull/14712) +- [debug] fixed: handled the breakpoint update event for id:0 [#14866](https://github.com/eclipse-theia/theia/pull/14866) +- [debug] fixed: no watch evaluation if no current stack frame [#14874](https://github.com/eclipse-theia/theia/pull/14874) +- [debug] fixed: warned user before starting the same debug session multiple times [#14862](https://github.com/eclipse-theia/theia/pull/14862) +- [debug] handled the case where the editor model was set to null [#15013](https://github.com/eclipse-theia/theia/pull/15013) - Contributed on behalf of STMicroelectronics +- [dev-container] devcontainer: added ability to use localenv for containerenv property [#14821](https://github.com/eclipse-theia/theia/pull/14821) +- [dev-container] devcontainer: added simple containerenv contribution [#14816](https://github.com/eclipse-theia/theia/pull/14816) +- [dev-container] fixed recent workspace tracking for devcontainer workspaces [#14925](https://github.com/eclipse-theia/theia/pull/14925) +- [dev-packages] fixed webpack watching [#14844](https://github.com/eclipse-theia/theia/pull/14844) +- [doc] updated build command in publishing.md [#14798](https://github.com/eclipse-theia/theia/pull/14798) +- [doc] updated mcp readme with autostart option [#15046](https://github.com/eclipse-theia/theia/pull/15046) +- [filesystem] deprioritized file resource resolver to avoid resolution delays [#14917](https://github.com/eclipse-theia/theia/pull/14917) +- [monaco] chore: updated vscode-oniguruma+vscode-textmate [#14848](https://github.com/eclipse-theia/theia/pull/14848) +- [monaco] did not create a model reference for inline editors [#14942](https://github.com/eclipse-theia/theia/pull/14942) - Contributed on behalf of STMicroelectronics +- [monaco] emptied hidden editors [#14909](https://github.com/eclipse-theia/theia/pull/14909) - Contributed on behalf of STMicroelectronics +- [monaco] fixed: contenthoverwidget respected theia styles [#14836](https://github.com/eclipse-theia/theia/pull/14836) +- [monaco] fixed monaco editor localization [#15016](https://github.com/eclipse-theia/theia/pull/15016) +- [monaco] fixed monaco model reference creation [#14957](https://github.com/eclipse-theia/theia/pull/14957) +- [notebook] added an error for when a notebook editor was opened with a non existing file [#14891](https://github.com/eclipse-theia/theia/pull/14891) +- [notebook] fixed new notebook cell editor outline and width with open right sidebar [#14800](https://github.com/eclipse-theia/theia/pull/14800) +- [notebook] fixed notebook widget disposal [#14964](https://github.com/eclipse-theia/theia/pull/14964) +- [plugin] added missing vs code json schemas [#14864](https://github.com/eclipse-theia/theia/pull/14864) +- [plugin] passed code action provider metadata to editor [#14991](https://github.com/eclipse-theia/theia/pull/14991) - Contributed on behalf of STMicroelectronics +- [plugin] refreshed root when change notification had no items [#14868](https://github.com/eclipse-theia/theia/pull/14868) +- [plugin] sent plugin logs to the frontend [#14908](https://github.com/eclipse-theia/theia/pull/14908) +- [plugin] supported snippet file edits [#15066](https://github.com/eclipse-theia/theia/pull/15066) +- [scm] used diffeditor diffnavigator to navigate diffs [#14889](https://github.com/eclipse-theia/theia/pull/14889) +- [terminal] fixed: exited shell process on terminal close [#14823](https://github.com/eclipse-theia/theia/pull/14823) +- [vscode] bumped vs code api version [#15069](https://github.com/eclipse-theia/theia/pull/15069) - Contributed on behalf of STMicroelectronics +- [vscode] introduced the commentingrange type [#15015](https://github.com/eclipse-theia/theia/pull/15015) - Contributed on behalf of STMicroelectronics +- [vscode] made public the documentpaste proposed api [#14953](https://github.com/eclipse-theia/theia/pull/14953) - Contributed on behalf of STMicroelectronics +- [vscode] shellexecution updated with undefined command [#15047](https://github.com/eclipse-theia/theia/pull/15047) - Contributed on behalf of STMicroelectronics + +[Breaking Changes:](#breaking_changes_1.59.0) + +- [ai] refined system message settings [#14877](https://github.com/eclipse-theia/theia/pull/14877) +- [ai-chat] changed chat api by removing chatsetchangedeleteevent, updating changeset interface with added ondidchange event and dispose method (renamed accept to apply and discard to revert), modified changesetelement and changesetimpl accordingly [#14910](https://github.com/eclipse-theia/theia/pull/14910) +- [ai-chat] abstractchatagent updated getsystemmessagedescription to require a context parameter [#14930](https://github.com/eclipse-theia/theia/pull/14930) +- [ai-core] chatmodel interface was updated to include context and promptservice was updated with an optional context argument in getprompt [#14930](https://github.com/eclipse-theia/theia/pull/14930) +- [ai-ide] content-replacer.ts moved from ai-ide/src/browser/ to core/src/common/ [#14930](https://github.com/eclipse-theia/theia/pull/14930) +- [ai-scanoss] scanossdialog constructor accepted an array of results instead of a single result [#14930](https://github.com/eclipse-theia/theia/pull/14930) +- [core] a context html element became mandatory when showing a context menu [#14982](https://github.com/eclipse-theia/theia/pull/14982) - Contributed on behalf of STMicroelectronics +- [core] adjusted binding of named ilogger injections and instructed removal of duplicate ilogger bindings on ambiguous match errors +- [core] streamlined logging api [#14861](https://github.com/eclipse-theia/theia/pull/14861) +- [core] made context element mandatory when showing a context menu [#14982](https://github.com/eclipse-theia/theia/pull/14982) - Contributed on behalf of STMicroelectronics +- [debug] fixed: handled the breakpoint update event for id:0 [#14866](https://github.com/eclipse-theia/theia/pull/14866) + +## 1.58.0 - 01/30/2025 + +- [ai] added 'required' property to tool call parameters [#14673](https://github.com/eclipse-theia/theia/pull/14673) +- [ai] added change set support in chat input and chat model [#14750](https://github.com/eclipse-theia/theia/pull/14750) +- [ai] added logic to allow passing context to tool calls [#14751](https://github.com/eclipse-theia/theia/pull/14751) +- [ai] added logic to allow to auto-start MCP servers on frontend start-up [#14736](https://github.com/eclipse-theia/theia/pull/14736) +- [ai] added logic to override change elements on additional changes [#14792](https://github.com/eclipse-theia/theia/pull/14792) +- [ai] added Ollama LLM provider tools support [#14623](https://github.com/eclipse-theia/theia/pull/14623) +- [ai] added search and replace function to coder [#14774](https://github.com/eclipse-theia/theia/pull/14774) +- [ai] added support for Azure OpenAI [#14722](https://github.com/eclipse-theia/theia/pull/14722) +- [ai] added support for change sets via tool functions [#14715](https://github.com/eclipse-theia/theia/pull/14715) +- [ai] added tool support for anthropic streaming [#14758](https://github.com/eclipse-theia/theia/pull/14758) +- [ai] changed trigger of inline suggestion keybinding to Ctrl+Alt+Space [#14669](https://github.com/eclipse-theia/theia/pull/14669) +- [ai] improved behavior of AI Changeset diff editor [#14786](https://github.com/eclipse-theia/theia/pull/14786) - Contributed on behalf of STMicroelectronics +- [ai] improved cancel logic in openAi model [#14713](https://github.com/eclipse-theia/theia/pull/14713) +- [ai] improved cancellation token handling in chat model [#14644](https://github.com/eclipse-theia/theia/pull/14644) +- [ai] improved performance in AI request logging [#14769](https://github.com/eclipse-theia/theia/pull/14769) +- [ai] updated logic to allow filerting backticks in AI code completion [#14777](https://github.com/eclipse-theia/theia/pull/14777) +- [ai] updated logic to consistently handle OpenAI models not supporting system messages instead of using dedicated O1 chat agent [#14681](https://github.com/eclipse-theia/theia/pull/14681) +- [ai] updated logic to manage AI bindings separately per connection [#14760](https://github.com/eclipse-theia/theia/pull/14760) +- [ai] updated logic to not let ai chat submit empty messages [#14771](https://github.com/eclipse-theia/theia/pull/14771) +- [ai] updated logic to register tool functions of mcp servers again after restart of the frontend [#14723](https://github.com/eclipse-theia/theia/pull/14723) +- [ai] updated logic to show diff on click in ChangeSets [#14784](https://github.com/eclipse-theia/theia/pull/14784) +- [application-manager] fixed error caused by bundling scanoss [#14650](https://github.com/eclipse-theia/theia/pull/14650) +- [application-manager] improved bundling for hoisted dependencies [#14708](https://github.com/eclipse-theia/theia/pull/14708) +- [console] fixed console scrolling [#14748](https://github.com/eclipse-theia/theia/pull/14748) +- [core] added support for dragging files in browser [#14756](https://github.com/eclipse-theia/theia/pull/14756) +- [core] fixed dragging file from outside the workspace [#14746](https://github.com/eclipse-theia/theia/pull/14746) +- [core] fixed override of default key bindings [#14668](https://github.com/eclipse-theia/theia/pull/14668) +- [core] fixed `workbench.action.files.newUntitledFile` command [#14754](https://github.com/eclipse-theia/theia/pull/14754) +- [core] fixed z-index overlay issue in dock panels [#14695](https://github.com/eclipse-theia/theia/pull/14695) +- [core] updated build scripts to use npm instead of yarn to build Theia [#14481](https://github.com/eclipse-theia/theia/pull/14481) - Contributed on behalf of STMicroelectronics +- [core] updated keytar and drivelist [#14306](https://github.com/eclipse-theia/theia/pull/14306) +- [core] updated logic to prevent tabbing outside of dialog overlay [#14647](https://github.com/eclipse-theia/theia/pull/14647) +- [debug] added jump to cursor option to context menu [#14594](https://github.com/eclipse-theia/theia/pull/14594) - Contributed by MVTec Software GmbH +- [debug] fixed updating breakpoints when debugging starts [#14645](https://github.com/eclipse-theia/theia/pull/14645) - Contributed by MVTec Software GmbH +- [dev-container] updated logic to show more dev container info in title bar [#14571](https://github.com/eclipse-theia/theia/pull/14571) +- [electron] bumped fix-path to ^4.0.0 to avoid cross-env <6.0.6 [#14781](https://github.com/eclipse-theia/theia/pull/14781) - Contributed on behalf of STMicroelectronics +- [filesystem] added support for vscode file system provider scheme [#14778](https://github.com/eclipse-theia/theia/pull/14778) +- [filesystem] fixed error handling in OPFSFileSystemProvider [#14790](https://github.com/eclipse-theia/theia/pull/14790) +- [filesystem] fixed file data streaming for http polling [#14659](https://github.com/eclipse-theia/theia/pull/14659) +- [getting-started] updated labels to mark DevContainers in recent workspaces [#14595](https://github.com/eclipse-theia/theia/pull/14595) +- [git] added deprecation warning to theia/git readme [#14646](https://github.com/eclipse-theia/theia/pull/14646) +- [monaco] updated monaco-editor-core to 1.96.3 [#14737](https://github.com/eclipse-theia/theia/pull/14737) - Contributed on behalf of STMicroelectronics +- [notebook] fixed execute cell and below for last cell [#14795](https://github.com/eclipse-theia/theia/pull/14795) +- [notebook] fixed issue with deleted cells when talking to output webview [#14649](https://github.com/eclipse-theia/theia/pull/14649) +- [notebook] fixed race condition for outputs [#14789](https://github.com/eclipse-theia/theia/pull/14789) +- [plugin] added support for property Text in DocumentDropOrPasteEditKind [#14605](https://github.com/eclipse-theia/theia/pull/14605) - Contributed on behalf of STMicroelectronics +- [plugin] stubbed TerminalCompletionProvider proposed API [#14719](https://github.com/eclipse-theia/theia/pull/14719) - Contributed on behalf of STMicroelectronics +- [plugin] updated code to properly mark chat and language model APIs as stubbed [#14734](https://github.com/eclipse-theia/theia/pull/14734) - Contributed on behalf of STMicroelectronics +- [plugin] updated code to provide node-pty package for plugins [#14720](https://github.com/eclipse-theia/theia/pull/14720) +- [plugin] updated logic to include ignored files in vscode.workspace.findFiles [#14365](https://github.com/eclipse-theia/theia/pull/14365) +- [plugin] updated logic to only call refresh on given elements given by plugin [#14697](https://github.com/eclipse-theia/theia/pull/14697) - Contributed on behalf of STMicroelectronics +- [process] updated node-pty to 1.1.0-beta27 [#14677](https://github.com/eclipse-theia/theia/pull/14677) - Contributed on behalf of STMicroelectronics +- [scanoss] fixed scanoss error on Windows [#14653](https://github.com/eclipse-theia/theia/pull/14653) +- [secondary-window] improved README of secondary window package [#14691](https://github.com/eclipse-theia/theia/pull/14691) - Contributed on behalf of STMicroelectronics +- [task] added task related context keys [#14757](https://github.com/eclipse-theia/theia/pull/14757) +- [vsx-registry] added logic to load plugin readme from file system [#14699](https://github.com/eclipse-theia/theia/pull/14699) diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..ebf2a4d --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,85 @@ +# CLAUDE.md + +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. + +## Development Commands + +**Essential commands:** +- `npm install` - Install dependencies and run post-install hooks +- `npm run build:browser` - Builds all packages, including example applications and bundles the Browser application (preferred during development) +- `npm run compile` - Compile TypeScript packages only +- `npm run lint` - Run ESLint across all packages +- `npm run test` - Run all tests + +**Application commands:** +- `npm run start:browser` - Start browser example at localhost:3000 +- `npm run start:electron` - Start electron application +- `npm run watch` - Watch mode for development + +**Package-specific (using lerna):** +- `npx lerna run compile --scope @theia/package-name` - Build specific package +- `npx lerna run test --scope @theia/package-name` - Test specific package +- `npx lerna run watch --scope @theia/package-name --include-filtered-dependencies --parallel` - Watch package with dependencies + +## Architecture + +**Monorepo Structure:** +- Lerna-managed monorepo with 80+ packages +- `/packages/` - Runtime packages (core + extensions) +- `/dev-packages/` - Development tooling +- `/examples/` - Sample applications and examples for API usage + +**Platform-specific code organization:** +- `package-name/src/common/*` - Basic JavaScript APIs, runs everywhere +- `package-name/src/browser/*` - Browser/DOM APIs +- `package-name/src/node/*` - Node.js APIs +- `package-name/src/electron-browser/*` - Electron renderer process +- `package-name/src/electron-main/*` - Electron main process + +**Extension System:** +- Dependency Injection via InversifyJS (property injection preferred) +- Contribution Points pattern for extensibility +- Three extension types: Theia extensions (build-time), VS Code extensions (runtime), Theia plugins (runtime) +- `theiaExtensions` in package.json defines module entry points + +## Key Patterns + +For more information also look at: +- @doc/coding-guidelines.md +- @doc/Testing.md +- @doc/Plugin-API.md (VS Code extension plugin API) + +**Code Style:** +- 4 spaces indentation, single quotes, undefined over null +- PascalCase for types/enums, camelCase for functions/variables +- Arrow functions preferred, explicit return types required +- Property injection over constructor injection + +**File Naming:** +- kebab-case for files (e.g., `document-provider.ts`) +- File name matches main exported type +- Platform folders follow strict dependency rules + +**Architecture Patterns:** +- Main-Ext pattern for plugin API (browser Main ↔ plugin host Ext) +- Services as classes with DI, avoid exported functions +- ContributionProvider instead of @multiInject +- URI strings for cross-platform file paths, never raw paths + +**Testing:** +- Unit tests: `*.spec.ts` +- UI tests: `*.ui-spec.ts` +- Slow tests: `*.slow-spec.ts` + +## Technical Requirements + +- Node.js ≥18.17.0, <21 +- TypeScript ~5.4.5 with strict settings +- React 18.2.0 for UI components +- Monaco Editor for code editing + +**Key Technologies:** +- Express.js for backend HTTP server +- InversifyJS for dependency injection +- Lerna for monorepo management +- Webpack for application bundling diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..88ca1cb --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,62 @@ + + +# Community Code of Conduct + +Version 1.1 + +October 21, 2019 + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to make participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment include: + +- Using welcoming and inclusive language +- Being respectful of differing viewpoints and experiences +- Gracefully accepting constructive criticism +- Focusing on what is best for the community +- Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +- The use of sexualized language or imagery and unwelcome sexual attention or advances +- Trolling, insulting/derogatory comments, and personal or political attacks +- Public or private harassment +- Publishing others' private information, such as a physical or electronic address, without explicit permission +- Other conduct which could reasonably be considered inappropriate in a professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies within all project spaces, and it also applies when an individual is representing the project or its community in public spaces. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at . All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org), version 1.4, available at + +For answers to common questions about this code of conduct, see + + + +---- +Note: Please see [here](https://www.eclipse.org/org/documents/Community_Code_of_Conduct.php) for the latest version of this document, hosted at the Eclipse Foundation diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..9456795 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,123 @@ +# Contributing to Eclipse Theia + +Theia is a young open-source project with a modular architecture. One of the +goals is to make sure that we can customize and enhance any Theia application +through extensions. So while the main Theia repository contains some common +functionality for IDE-like applications, like a file system or a navigator +view, most functionality doesn't necessarily need to be put into the core +repository but can be developed separately. + +## How Can I Contribute? + +In the following some of the typical ways of contribution are described. + +### Asking Questions + +It's totally fine to ask questions by opening an issue in the Theia GitHub +repository. We will close it once it's answered and tag it with the 'question' +label. Please check if the question has been asked before there or on [Stack +Overflow](https://stackoverflow.com). + +### Reporting Bugs + +If you have found a bug, you should first check if it has already been filed +and maybe even fixed. If you find an existing unresolved issue, please add your +case. If you could not find an existing bug report, please file a new one. In +any case, please add all information you can share and that will help to +reproduce and solve the problem. + +### Reporting Feature Requests + +You may want to see a feature or have an idea. You can file a request and we +can discuss it. If such a feature request already exists, please add a comment +or some other form of feedback to indicate you are interested too. Also in this +case any concrete use case scenario is appreciated to understand the motivation +behind it. + +### Pull Requests + +Before you get started investing significant time in something you want to get +merged and maintained as part of Theia, you should talk with the team through +an issue. Simply choose the issue you would want to work on, and tell everyone +that you are willing to do so and how you would approach it. The team will be +happy to guide you and give feedback. + +We follow the contributing and reviewing pull request guidelines described +[here](https://github.com/eclipse-theia/theia/blob/master/doc/pull-requests.md). + +## Coding Guidelines + +We follow the coding guidelines described +[here](doc/coding-guidelines.md). + +## Eclipse Contributor Agreement + +Before your contribution can be accepted by the project team contributors must +electronically sign the Eclipse Contributor Agreement (ECA). + +* + +Commits that are provided by non-committers must have a Signed-off-by field in +the footer indicating that the author is aware of the terms by which the +contribution has been provided to the project. The non-committer must +additionally have an Eclipse Foundation account and must have a signed Eclipse +Contributor Agreement (ECA) on file. + +For more information, please see the Eclipse Committer Handbook: + + +## Sign your work + +The sign-off is a simple line at the end of the explanation for the patch. Your +signature certifies that you wrote the patch or otherwise have the right to +pass it on as an open-source patch. The rules are pretty simple: if you can +certify the below (from +[developercertificate.org](https://developercertificate.org/)): + +``` +Developer Certificate of Origin +Version 1.1 + +Copyright (C) 2004, 2006 The Linux Foundation and its contributors. +1 Letterman Drive +Suite D4700 +San Francisco, CA, 94129 + +Everyone is permitted to copy and distribute verbatim copies of this +license document, but changing it is not allowed. + +Developer's Certificate of Origin 1.1 + +By making a contribution to this project, I certify that: + +(a) The contribution was created in whole or in part by me and I + have the right to submit it under the open source license + indicated in the file; or + +(b) The contribution is based upon previous work that, to the best + of my knowledge, is covered under an appropriate open source + license and I have the right under that license to submit that + work with modifications, whether created in whole or in part + by me, under the same open source license (unless I am + permitted to submit under a different license), as indicated + in the file; or + +(c) The contribution was provided directly to me by some other + person who certified (a), (b) or (c) and I have not modified + it. + +(d) I understand and agree that this project and the contribution + are public and that a record of the contribution (including all + personal information I submit with it, including my sign-off) is + maintained indefinitely and may be redistributed consistent with + this project or the open source license(s) involved. +``` + +Then you just add a line to every git commit message: + + Signed-off-by: Joe Smith + +Use your real name (sorry, no pseudonyms or anonymous contributions.) + +If you set your `user.name` and `user.email` git configs, you can sign your +commit automatically with `git commit -s`. diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..19e8de5 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,4 @@ +# Vibn IDE — pull the custom-compiled image built by Cloud Build +# Cloud Build compiles all TypeScript (Gitea/Coolify tools, Code OS agent) +# and pushes to Artifact Registry. Coolify just pulls that image. +FROM northamerica-northeast1-docker.pkg.dev/master-ai-484822/vibn-ide/theia:latest diff --git a/Dockerfile.custom b/Dockerfile.custom new file mode 100644 index 0000000..da0cb36 --- /dev/null +++ b/Dockerfile.custom @@ -0,0 +1,56 @@ +# Vibn IDE — compiled from source (matches local dev build) +# Uses E2_HIGHCPU_32 in Cloud Build for the webpack step + +FROM node:22-bullseye AS builder + +RUN apt-get update && apt-get install -y libxkbfile-dev libsecret-1-dev python3 make g++ && rm -rf /var/lib/apt/lists/* + +WORKDIR /app + +# Copy dependency manifests first for better caching +COPY package.json package-lock.json lerna.json ./ +COPY scripts/ scripts/ +COPY configs/ configs/ +COPY dev-packages/ dev-packages/ +COPY packages/ packages/ +COPY examples/ examples/ + +# Install all dependencies +# electron is needed for type declarations during compilation (pulled by examples/electron +# which is excluded by .dockerignore, so we add it manually) +RUN npm install --legacy-peer-deps && npm install --no-save electron@38.4.0 + +# Compile TypeScript +RUN npm run compile + +# Build the browser webpack bundle (needs ~4GB RAM — Cloud Build E2_HIGHCPU_32 handles this) +RUN cd examples/browser && npx theia build --mode production + +# ── Runtime stage ───────────────────────────────────────────────────────────── +FROM node:22-bullseye-slim + +RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/* + +RUN useradd -m -s /bin/bash theia +WORKDIR /home/theia/app + +# Copy the built application from builder +COPY --from=builder /app/examples/browser/lib ./lib +COPY --from=builder /app/examples/browser/src-gen ./src-gen +COPY --from=builder /app/examples/browser/package.json ./ +COPY --from=builder /app/node_modules ./node_modules +COPY --from=builder /app/packages ./packages + +# Copy vibn.css into the frontend served directory +COPY examples/browser/vibn.css ./lib/frontend/vibn.css + +# Copy startup script +COPY startup-custom.sh /startup.sh +RUN chmod +x /startup.sh + +RUN chown -R theia:theia /home/theia +USER theia + +EXPOSE 3000 + +ENTRYPOINT ["/startup.sh"] diff --git a/Dockerfile.runtime b/Dockerfile.runtime new file mode 100644 index 0000000..5d5e4aa --- /dev/null +++ b/Dockerfile.runtime @@ -0,0 +1,31 @@ +# Runtime-only image — expects Theia to already be compiled on the host. +# Run `npm run build:local` first, then `docker build -f Dockerfile.runtime ...` + +FROM node:20-bookworm-slim + +RUN apt-get update && apt-get install -y --no-install-recommends \ + git \ + curl \ + libsecret-1-0 \ + libx11-6 \ + libxkbfile1 \ + && rm -rf /var/lib/apt/lists/* + +RUN mkdir -p /home/node/workspace /home/node/.theia && \ + chown -R node:node /home/node + +WORKDIR /home/node + +# Copy the pre-compiled output from the host +COPY --chown=node:node node_modules ./node_modules +COPY --chown=node:node packages ./packages +COPY --chown=node:node dev-packages ./dev-packages +COPY --chown=node:node examples/browser ./examples/browser +COPY --chown=node:node package.json ./package.json + +COPY startup-custom.sh /startup.sh +RUN chmod +x /startup.sh && chown node:node /startup.sh + +USER node +EXPOSE 3000 +ENTRYPOINT ["/startup.sh"] diff --git a/Dockerfile.vibn b/Dockerfile.vibn new file mode 100644 index 0000000..b17eb6b --- /dev/null +++ b/Dockerfile.vibn @@ -0,0 +1,26 @@ +# Vibn IDE — Custom Theia workspace image +# Wraps the official Theia Blueprint with a startup script that: +# 1. Clones the project's Gitea repo on first boot (using GITEA_REPO + GITEA_TOKEN) +# 2. Starts Theia pre-loaded with the cloned folder open + +FROM ghcr.io/eclipse-theia/theia-blueprint/theia-ide:latest + +USER root + +# git is needed for clone — install if not present +RUN apt-get update && apt-get install -y --no-install-recommends git && \ + rm -rf /var/lib/apt/lists/* + +# Add startup script +COPY startup.sh /startup.sh +RUN chmod +x /startup.sh && \ + chown theia:theia /startup.sh + +# Ensure workspace dir exists and is owned by theia +RUN mkdir -p /home/project && chown -R theia:theia /home/project + +USER theia + +EXPOSE 3000 + +ENTRYPOINT ["/startup.sh"] diff --git a/LICENSE-EPL b/LICENSE-EPL new file mode 100644 index 0000000..e48e096 --- /dev/null +++ b/LICENSE-EPL @@ -0,0 +1,277 @@ +Eclipse Public License - v 2.0 + + THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE + PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION + OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + +1. DEFINITIONS + +"Contribution" means: + + a) in the case of the initial Contributor, the initial content + Distributed under this Agreement, and + + b) in the case of each subsequent Contributor: + i) changes to the Program, and + ii) additions to the Program; + where such changes and/or additions to the Program originate from + and are Distributed by that particular Contributor. A Contribution + "originates" from a Contributor if it was added to the Program by + such Contributor itself or anyone acting on such Contributor's behalf. + Contributions do not include changes or additions to the Program that + are not Modified Works. + +"Contributor" means any person or entity that Distributes the Program. + +"Licensed Patents" mean patent claims licensable by a Contributor which +are necessarily infringed by the use or sale of its Contribution alone +or when combined with the Program. + +"Program" means the Contributions Distributed in accordance with this +Agreement. + +"Recipient" means anyone who receives the Program under this Agreement +or any Secondary License (as applicable), including Contributors. + +"Derivative Works" shall mean any work, whether in Source Code or other +form, that is based on (or derived from) the Program and for which the +editorial revisions, annotations, elaborations, or other modifications +represent, as a whole, an original work of authorship. + +"Modified Works" shall mean any work in Source Code or other form that +results from an addition to, deletion from, or modification of the +contents of the Program, including, for purposes of clarity any new file +in Source Code form that contains any contents of the Program. Modified +Works shall not include works that contain only declarations, +interfaces, types, classes, structures, or files of the Program solely +in each case in order to link to, bind by name, or subclass the Program +or Modified Works thereof. + +"Distribute" means the acts of a) distributing or b) making available +in any manner that enables the transfer of a copy. + +"Source Code" means the form of a Program preferred for making +modifications, including but not limited to software source code, +documentation source, and configuration files. + +"Secondary License" means either the GNU General Public License, +Version 2.0, or any later versions of that license, including any +exceptions or additional permissions as identified by the initial +Contributor. + +2. GRANT OF RIGHTS + + a) Subject to the terms of this Agreement, each Contributor hereby + grants Recipient a non-exclusive, worldwide, royalty-free copyright + license to reproduce, prepare Derivative Works of, publicly display, + publicly perform, Distribute and sublicense the Contribution of such + Contributor, if any, and such Derivative Works. + + b) Subject to the terms of this Agreement, each Contributor hereby + grants Recipient a non-exclusive, worldwide, royalty-free patent + license under Licensed Patents to make, use, sell, offer to sell, + import and otherwise transfer the Contribution of such Contributor, + if any, in Source Code or other form. This patent license shall + apply to the combination of the Contribution and the Program if, at + the time the Contribution is added by the Contributor, such addition + of the Contribution causes such combination to be covered by the + Licensed Patents. The patent license shall not apply to any other + combinations which include the Contribution. No hardware per se is + licensed hereunder. + + c) Recipient understands that although each Contributor grants the + licenses to its Contributions set forth herein, no assurances are + provided by any Contributor that the Program does not infringe the + patent or other intellectual property rights of any other entity. + Each Contributor disclaims any liability to Recipient for claims + brought by any other entity based on infringement of intellectual + property rights or otherwise. As a condition to exercising the + rights and licenses granted hereunder, each Recipient hereby + assumes sole responsibility to secure any other intellectual + property rights needed, if any. For example, if a third party + patent license is required to allow Recipient to Distribute the + Program, it is Recipient's responsibility to acquire that license + before distributing the Program. + + d) Each Contributor represents that to its knowledge it has + sufficient copyright rights in its Contribution, if any, to grant + the copyright license set forth in this Agreement. + + e) Notwithstanding the terms of any Secondary License, no + Contributor makes additional grants to any Recipient (other than + those set forth in this Agreement) as a result of such Recipient's + receipt of the Program under the terms of a Secondary License + (if permitted under the terms of Section 3). + +3. REQUIREMENTS + +3.1 If a Contributor Distributes the Program in any form, then: + + a) the Program must also be made available as Source Code, in + accordance with section 3.2, and the Contributor must accompany + the Program with a statement that the Source Code for the Program + is available under this Agreement, and informs Recipients how to + obtain it in a reasonable manner on or through a medium customarily + used for software exchange; and + + b) the Contributor may Distribute the Program under a license + different than this Agreement, provided that such license: + i) effectively disclaims on behalf of all other Contributors all + warranties and conditions, express and implied, including + warranties or conditions of title and non-infringement, and + implied warranties or conditions of merchantability and fitness + for a particular purpose; + + ii) effectively excludes on behalf of all other Contributors all + liability for damages, including direct, indirect, special, + incidental and consequential damages, such as lost profits; + + iii) does not attempt to limit or alter the recipients' rights + in the Source Code under section 3.2; and + + iv) requires any subsequent distribution of the Program by any + party to be under a license that satisfies the requirements + of this section 3. + +3.2 When the Program is Distributed as Source Code: + + a) it must be made available under this Agreement, or if the + Program (i) is combined with other material in a separate file or + files made available under a Secondary License, and (ii) the initial + Contributor attached to the Source Code the notice described in + Exhibit A of this Agreement, then the Program may be made available + under the terms of such Secondary Licenses, and + + b) a copy of this Agreement must be included with each copy of + the Program. + +3.3 Contributors may not remove or alter any copyright, patent, +trademark, attribution notices, disclaimers of warranty, or limitations +of liability ("notices") contained within the Program from any copy of +the Program which they Distribute, provided that Contributors may add +their own appropriate notices. + +4. COMMERCIAL DISTRIBUTION + +Commercial distributors of software may accept certain responsibilities +with respect to end users, business partners and the like. While this +license is intended to facilitate the commercial use of the Program, +the Contributor who includes the Program in a commercial product +offering should do so in a manner which does not create potential +liability for other Contributors. Therefore, if a Contributor includes +the Program in a commercial product offering, such Contributor +("Commercial Contributor") hereby agrees to defend and indemnify every +other Contributor ("Indemnified Contributor") against any losses, +damages and costs (collectively "Losses") arising from claims, lawsuits +and other legal actions brought by a third party against the Indemnified +Contributor to the extent caused by the acts or omissions of such +Commercial Contributor in connection with its distribution of the Program +in a commercial product offering. The obligations in this section do not +apply to any claims or Losses relating to any actual or alleged +intellectual property infringement. In order to qualify, an Indemnified +Contributor must: a) promptly notify the Commercial Contributor in +writing of such claim, and b) allow the Commercial Contributor to control, +and cooperate with the Commercial Contributor in, the defense and any +related settlement negotiations. The Indemnified Contributor may +participate in any such claim at its own expense. + +For example, a Contributor might include the Program in a commercial +product offering, Product X. That Contributor is then a Commercial +Contributor. If that Commercial Contributor then makes performance +claims, or offers warranties related to Product X, those performance +claims and warranties are such Commercial Contributor's responsibility +alone. Under this section, the Commercial Contributor would have to +defend claims against the other Contributors related to those performance +claims and warranties, and if a court requires any other Contributor to +pay any damages as a result, the Commercial Contributor must pay +those damages. + +5. NO WARRANTY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, AND TO THE EXTENT +PERMITTED BY APPLICABLE LAW, THE PROGRAM IS PROVIDED ON AN "AS IS" +BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR +IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF +TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR +PURPOSE. Each Recipient is solely responsible for determining the +appropriateness of using and distributing the Program and assumes all +risks associated with its exercise of rights under this Agreement, +including but not limited to the risks and costs of program errors, +compliance with applicable laws, damage to or loss of data, programs +or equipment, and unavailability or interruption of operations. + +6. DISCLAIMER OF LIABILITY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, AND TO THE EXTENT +PERMITTED BY APPLICABLE LAW, NEITHER RECIPIENT NOR ANY CONTRIBUTORS +SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST +PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE +EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + +7. GENERAL + +If any provision of this Agreement is invalid or unenforceable under +applicable law, it shall not affect the validity or enforceability of +the remainder of the terms of this Agreement, and without further +action by the parties hereto, such provision shall be reformed to the +minimum extent necessary to make such provision valid and enforceable. + +If Recipient institutes patent litigation against any entity +(including a cross-claim or counterclaim in a lawsuit) alleging that the +Program itself (excluding combinations of the Program with other software +or hardware) infringes such Recipient's patent(s), then such Recipient's +rights granted under Section 2(b) shall terminate as of the date such +litigation is filed. + +All Recipient's rights under this Agreement shall terminate if it +fails to comply with any of the material terms or conditions of this +Agreement and does not cure such failure in a reasonable period of +time after becoming aware of such noncompliance. If all Recipient's +rights under this Agreement terminate, Recipient agrees to cease use +and distribution of the Program as soon as reasonably practicable. +However, Recipient's obligations under this Agreement and any licenses +granted by Recipient relating to the Program shall continue and survive. + +Everyone is permitted to copy and distribute copies of this Agreement, +but in order to avoid inconsistency the Agreement is copyrighted and +may only be modified in the following manner. The Agreement Steward +reserves the right to publish new versions (including revisions) of +this Agreement from time to time. No one other than the Agreement +Steward has the right to modify this Agreement. The Eclipse Foundation +is the initial Agreement Steward. The Eclipse Foundation may assign the +responsibility to serve as the Agreement Steward to a suitable separate +entity. Each new version of the Agreement will be given a distinguishing +version number. The Program (including Contributions) may always be +Distributed subject to the version of the Agreement under which it was +received. In addition, after a new version of the Agreement is published, +Contributor may elect to Distribute the Program (including its +Contributions) under the new version. + +Except as expressly stated in Sections 2(a) and 2(b) above, Recipient +receives no rights or licenses to the intellectual property of any +Contributor under this Agreement, whether expressly, by implication, +estoppel or otherwise. All rights in the Program not expressly granted +under this Agreement are reserved. Nothing in this Agreement is intended +to be enforceable by any entity that is not a Contributor or Recipient. +No third-party beneficiary rights are created under this Agreement. + +Exhibit A - Form of Secondary Licenses Notice + +"This Source Code may also be made available under the following +Secondary Licenses when the conditions for such availability set forth +in the Eclipse Public License, v. 2.0 are satisfied: {name license(s), +version(s), and exceptions or additional permissions here}." + + Simply including a copy of this Agreement, including this Exhibit A + is not sufficient to license the Source Code under Secondary Licenses. + + If it is not possible or desirable to put the notice in a particular + file, then You may include the notice in a location (such as a LICENSE + file in a relevant directory) where a recipient would be likely to + look for such a notice. + + You may add additional accurate notices of copyright ownership. diff --git a/LICENSE-GPL-2.0-ONLY-CLASSPATH-EXCEPTION b/LICENSE-GPL-2.0-ONLY-CLASSPATH-EXCEPTION new file mode 100644 index 0000000..b8aa1be --- /dev/null +++ b/LICENSE-GPL-2.0-ONLY-CLASSPATH-EXCEPTION @@ -0,0 +1,356 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + signature of Ty Coon, 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. + +Class Path Exception + +Linking this library statically or dynamically with other modules is making +a combined work based on this library. Thus, the terms and conditions of +the GNU General Public License cover the whole combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent modules, +and to copy and distribute the resulting executable under terms of your +choice, provided that you also meet, for each linked independent module, +the terms and conditions of the license of that module. An independent +module is a module which is not derived from or based on this library. If +you modify this library, you may extend this exception to your version of +the library, but you are not obligated to do so. If you do not wish to do +so, delete this exception statement from your version. diff --git a/LICENSE-MIT.txt b/LICENSE-MIT.txt new file mode 100644 index 0000000..8703eba --- /dev/null +++ b/LICENSE-MIT.txt @@ -0,0 +1,34 @@ + +This license covers code in the repository with the MIT license header: + +// ***************************************************************************** +// Copyright (C) {year, original author} and others. +// +// This file is licensed under the MIT License. +// See LICENSE-MIT.txt in the project root for license information. +// https://opensource.org/license/mit. +// +// SPDX-License-Identifier: MIT +// ***************************************************************************** + +----- + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/LICENSE-vscode.txt b/LICENSE-vscode.txt new file mode 100644 index 0000000..701c014 --- /dev/null +++ b/LICENSE-vscode.txt @@ -0,0 +1,29 @@ +Below is the full text of vscode's MIT license, copied from the link below (it has not changed except cosmetically, since the Theia project was started): + +https://github.com/microsoft/vscode/blob/2dd03eaebe21473f3af6df2a229199b9aa138e97/LICENSE.txt + +This license covers code originally copied from the vscode repository and integrated in this project. + +----- + +MIT License + +Copyright (c) 2015 - present Microsoft Corporation + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/NOTICE.md b/NOTICE.md new file mode 100644 index 0000000..602099d --- /dev/null +++ b/NOTICE.md @@ -0,0 +1,471 @@ +# Notices for Eclipse Theia + +This content is produced and maintained by the Eclipse Theia project. + +* Project home: + +## Trademarks + +Eclipse Theia is a trademark of the Eclipse Foundation. + +## Copyright + +All content is the property of the respective authors or their employers. For +more information regarding authorship of content, please consult the listed +source code repository logs. + +## Declared Project Licenses + +This program and the accompanying materials are made available under the terms +of the Eclipse Public License v. 2.0 which is available at +. This Source Code may also be made +available under the following Secondary Licenses when the conditions for such +availability set forth in the Eclipse Public License v. 2.0 are satisfied: +(secondary) GPL-2.0 with Classpath-exception-2.0 which is available at GNU +General Public License v2.0 w/Classpath exception', +'. + +SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 + +## Source Code + +The project maintains the following source code repositories: + +* +* +* +* +* +* +* +* +* +* + +## Third-party Content + +This project leverages the following third party content. + +chalk (2.4.1) + +* License: MIT +* Project: +* Source: + +code copied from project cortex-debug (0.1.21) + +* License: MIT + +Code copied from project Microsoft/vscode (1.31.0) + +* License: MIT + +Code copied from project Microsoft/vscode (1.32.3) + +* License: MIT +* Project: +* Source: + +Code copied from project Microsoft/vscode (1.32.3) + +* License: MIT + +code copied from project microsoft/vscode (1.33.1) + +* License: MIT + +Code copied from project Microsoft/vscode (1.33.1) + +* License: MIT + +Code copied from project Microsoft/vscode (1.34.0) + +* License: MIT + +Code copied from project microsoft/vscode (1.41.1) + +* License: MIT + +code copied from project vscode (1.26.0) + +* License: MIT + +code copied from project vscode (1.31.0) + +* License: MIT + +code copied from project vscode (1.33.0) + +* License: MIT + +code copied from project vscode (1.33.0) + +* License: MIT + +code copied from project vscode (1.34.0) + +* License: MIT + +code copied from project vscode (1.36.1) + +code copied from project vscode (1.36.1) + +* License: MIT + +code copied from project vscode (1.37.0) + +* License: MIT + +code copied from project vscode (1.37.0) + +* License: MIT + +code copied from project vscode-browser-preview (0.4.0) + +* License: MIT + +Code copied from VS Code (n/a) + +* License: MIT + +Code copied from VSCode (n/a) + +* License: MIT + +Code copied from vscode (n/a) + +* License: MIT + +Code copied from VSCode (n/a) + +* License: MIT + +Code copied from VSCode (n/a) + +* License: MIT + +Copied code from project VSCode (n/a) + +* License: MIT + +CSS copied from VS Code (n/a) + +* License: MIT + +dugite (1.52.0) + +* License: MIT + +Electron (3.1.7) + +* License: BSD-2-Clause AND BSD-3-Clause AND (MIT OR GPL-2.0) AND Apache-2.0 + AND (BSD-2-Clause OR MIT OR Apache-2.0) AND ISC AND MIT AND X11 AND + BSD-2-Clause-FreeBSD AND Public-Domain AND Unlicense AND MPL-2.0 AND + (BSD-3-Clause OR MPL-2.0) AND CC-BY-3.0 AND (AFL-2.0 + +Electron (4.2.11) + +* License: MIT AND BSD-3-Clause AND LicenseRef-Public-Domain + +Electron (9.0.2) + +* License: MIT AND BSD-3-Clause AND LicenseRef-Public-Domain + +electron@2.0.14 (2.0.14) + +* License: MIT AND BSD-2-Clause AND Apache-2.0 AND (AFL-2.1 OR BSD-3-Clause) + AND BSD-3-Clause AND ISC AND X11 AND Public-Domain AND (GPL-2.0 OR MIT) AND + Unlicense AND IJG AND ICU AND UNICODE-TOU AND NTP AND (MIT OR BSD-3-Clause) + AND Libpng AND MPL-2.0 AND LGPL-2.1+ +* Project: +* Source: + +getmac (1.4.6) + +* License: MIT +* Project: +* Source: + +GH-3397: Implemented the HTTP-based authentication for Git in Electron. (n/a) + +* License: MIT + +glob promise (3.4.0) + +* License: ISC +* Project: +* Source: + +Icon configure-inverse.svg (n/a) + +* License: MIT +* Project: +* Source: + + +Icons copied from microsoft/vscode-icons version: +b73945c70f1117c4e65939dd3e10bdd623cb4ef3 (n/a) + +* License: CC-BY-4.0 + +inversify (5.0.1) + +* License: MIT + +jschardet (1.6.0) + +* License: (LGPL-2.1 OR LGPL-2.1+) AND (MIT OR GPL-2.0) +* Project: +* Source: + + +jschardet (2.1.1) + +* License: LGPL-2.1 OR LGPL-2.1+ + +libffmpeg (FFmpeg) Delivered with Electron (3.1.7) + +* License: LGPL-2.1+ + +libffmpeg (FFmpeg) delivered with Electron (4.2.11) + +* License: LGPG-2.1-or-later AND BSD-3-Clause AND MIT AND IJG + +libffmpeg (FFmpeg) delivered with Electron (9.0.2) + +* License: LGPG-2.1-or-later AND BSD-3-Clause AND MIT AND IJG + +long.js (3.2.0) + +* License: Apache-2.0 + +micromatch (3.1.10) + +* License: MIT +* Project: +* Source: + +monaco-typescript (2.3.0) + +* License: MIT +* Project: +* Source: + +native-keymap (1.2.5) + +* License: BSD-3-Clause AND MIT +* Project: +* Source: + +node-oniguruma (n/a) + +* License: BSD-2-Clause AND GPL-2.0 WITH Autoconf-exception-2.0 AND + GPL-2.0-or-later WITH libtool-exception AND X11 AND MIT AND Public-Domain + +node.js dependencies for Theia (n/a) + +* License: MIT AND BSD-3-Clause AND ISC AND Apache-2.0 AND BSD-2-Clause AND + Zlib AND X11 AND (BSD-3-Clause OR AFL-2.1) AND CC-By-4.0 AND CC-by-2.5-SA AND + CC0-1.0 AND (BSD-3-Clause OR MPL-2.0) AND Unlicense AND (MIT OR GPL-3.0) AND + (MIT OR GPL-2.0) AND (Apache-2.0 OR + +Preference code copied from vscode (n/a) + +ps-list (5.0.1) + +* License: MIT +* Project: +* Source: + +react-perfect-scrollbar:1.5.3 (1.5.3) + +* License: MIT +* Project: +* Source: + +read-pkg (4.0.1) + +* License: MIT +* Project: +* Source: + +regular expressions and helper function copied from microsoft/vscode (1.33.1) + +* License: MIT + +requestretry (3.1.0) + +* License: MIT +* Project: +* Source: + +rimraf (2.6.2) + +* License: ISC + +textmate/tcl.tmbundle (n/a) + +* License: LicenseRef-Php_Tmbundle + +theia npm node (n/a) + +* License: BSD-2-Clause OR (MIT OR Apache-2.0) AND (AFL-2.1 OR BSD-3-Clause) + AND Apache-2.0 AND Artistic-2.0 AND BSD-3-Clause AND (BSD-3-Clause OR MIT) + AND MPL-2.0 AND CC0-1.0 AND CC-BY-3.0 AND CC-BY-4.0 AND CC-BY-SA-2.5 AND + GPL-2.0 WITH Autoconf-exception + +theia-cpp-extension npm node (n/a) + +* License: BSD-2-Clause OR (MIT OR Apache-2.0) AND MIT AND BSD-3-Clause AND + Zlib AND (MIT OR GPL-3.0) AND OFL-1.1 AND Apache-2.0 AND CC0-1.0 AND + CC-BY-3.0 AND ISC AND MPL-2.0 AND License-Ref-Public-Domain AND BSL-1.0 AND + (AFL-2.1 OR BSD-3.0) AND Unlicense AND Artist + +tslint (5.10.0) + +* License: Apache-2.0 AND MIT +* Project: +* Source: + +typefox/monaco-language-client (0.5.0) + +* License: MIT + +typescript-formatter (7.2.2) + +* License: MIT +* Project: +* Source: + +VS Code (1.33.0) + +* License: MIT + +VS Code built-in extensions (1.30.1) + +* License: Apache-2.0 AND MIT AND Unicode-DFS-2016 AND CC-BY-4.0 AND W3C + +vscode (1.26.0) + +* License: MIT AND LicenseRef-Php_Tmbundle + +vscode (1.26.0) + +* License: MIT + +vscode (1.31.0) + +* License: MIT + +vscode-debugadapter-node (n/a) + +* License: MIT + +vscode-icons (n/a) + +* License: CC-BY-4.0 AND MIT + +vscode-java (0.36.0) + +* License: EPL-1.0 + +vscode-java (0.44.0) + +* License: EPL-1.0 + +vscode-java-debug (0.15.0) + +* License: MIT + +webdriverio (n/a) + +* License: MIT +* Project: +* Source: + +when (3.7.8) + +* License: MIT +* Project: +* Source: + +wjordan/browser-path SHA6719d19077b1454bff8b802f9be79cb1b69ebe7e (n/a) + +* License: MIT + +xterm-addon-fit (0.3.0) + +* License: MIT + +xterm-addon-search (0.5.0) + +* License: MIT + +xterm.js (3.9.1) + +* License: MIT +* Project: +* Source: + +xterm.js (4.4) + +* License: MIT + +yargs (12.0.1) + +* License: MIT +* Project: +* Source: + +yeoman environment (2.3.0) + +* License: BSD-2-Clause AND BSD-3-Clause +* Project: +* Source: + +yeoman generator (3.0.0) + +* License: BSD-2-Clause AND BSD-3-Clause +* Project: +* Source: + +yeoman-generator (2.0) + +* License: BSD-2-Clause +* Project: +* Source: + +yosay (2.0.2) + +* License: BSD-2-Clause +* Project: +* Source: + +## Cryptography + +Content may contain encryption software. The country in which you are currently +may have restrictions on the import, possession, and use, and/or re-export to +another country, of encryption software. BEFORE using any encryption software, +please check the country's laws, regulations and policies concerning the import, +possession, or use, and re-export of encryption software, to see if this is +permitted. + +## Electron + +NOTICE: + +Please note Electron combines Chromium and Node.js into a single runtime. +While Electron, Chromium and Node.js are generally licensed under very +permissive MIT and BSD-3-Clause licenses, both Electron and Chromium distribute +FFmpeg. While FFmpeg is under the LGPL-2.1-or-later license it incorporates +several optional parts and optimizations that are covered by the +GPL-2.0-or-later. We understand both Electron and Chromium do not distribute +versions of FFmpeg with GPL content enabled; however, FFmpeg may be configured +enabled to work with proprietary codecs. It is our understanding these +proprietary codecs may be patented; and as a result, may be subject to +licensing fees. + +We strongly recommend downstream consumers verify the type of FFmpeg support +configured and modify as required. More information on instructions to verify +can be found here + diff --git a/README.md b/README.md new file mode 100644 index 0000000..8c557fc --- /dev/null +++ b/README.md @@ -0,0 +1,130 @@ +
+ + +
+ + [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-curved)](https://github.com/eclipse-theia/theia/labels/help%20wanted) + [![Build Status](https://github.com/eclipse-theia/theia/actions/workflows/ci-cd.yml/badge.svg?branch=master)](https://github.com/eclipse-theia/theia/actions/workflows/ci-cd.yml?query=branch%3Amaster) + [![Publish VS Code Built-in Extensions](https://github.com/eclipse-theia/vscode-builtin-extensions/actions/workflows/build.yml/badge.svg?branch=master)](https://github.com/eclipse-theia/vscode-builtin-extensions/actions/workflows/build.yml?query=branch%3Amaster) + [![Open questions](https://img.shields.io/badge/Open-questions-blue.svg?style=flat-curved)](https://github.com/eclipse-theia/theia/discussions/categories/q-a) + [![Open bugs](https://img.shields.io/badge/Open-bugs-red.svg?style=flat-curved)](https://github.com/eclipse-theia/theia/labels/bug) + +Eclipse Theia is an extensible framework to develop full-fledged multi-language Cloud & Desktop IDEs and tools with state-of-the-art web technologies. + +
+ +- [Website](#website) +- [Repositories](#repositories) +- [Releases](#releases) +- [Scope](#scope) +- [Roadmap](#roadmap) +- [Getting Started](#getting-started) +- [Contributing](#contributing) +- [Feedback](#feedback) +- [Documentation](#documentation) +- [License](#license) +- [Trademark](#trademark) + +
+ +![Theia](https://raw.githubusercontent.com/eclipse-theia/theia/master/doc/images/theia-screenshot.png) + +
+ +## Website + +[Visit the Eclipse Theia website](http://www.theia-ide.org) for more information and [the Theia documentation](http://www.theia-ide.org/docs). + +## Repositories + +This is the main repository for the Eclipse Theia project, containing the sources of the Theia Platform. Please open generic discussions, bug reports and feature requests about Theia on this repository. The Theia project also includes additional repositories, e.g. for the [artifacts building the Theia IDE](https://github.com/eclipse-theia/theia-blueprint) and the [Theia website](https://github.com/eclipse-theia/theia-website). Please also see the [overview of all Theia project repositories](https://github.com/eclipse-theia). + +## Releases + +- [All available releases](https://github.com/eclipse-theia/theia/releases) are available on GitHub including changelogs. +- [Detailed release announcements](https://theia-ide.org/resources/) are linked on the Theia website. +- [Community Releases](https://theia-ide.org/releases/) are listed on the Theia website. +- [Visit the release website](https://theia-ide.org/releases/) for more information. + +## Scope + +- Support building browser-based and desktop IDEs and tools +- Provide a highly flexible architecture for adopters +- Support VS Code Extension protocol +- Develop under vendor-neutral open-source governance + +[More details on the project goals](https://theia-ide.org/docs/project_goals/) are available on the Theia website. + +## Roadmap + +See [our roadmap](https://github.com/eclipse-theia/theia/wiki/Eclipse-Theia-Roadmap) for an overview about the current project goals and the upcoming releases. + +## Getting Started + +Here you can find guides and examples for common scenarios to adopt Theia: + +- [Get an overview of how to get started](https://theia-ide.org/#gettingstarted) on the Theia website +- [Develop a Theia application - your own IDE/Tool](https://theia-ide.org/docs/composing_applications/) +- [Learn about Theia's extension mechanisms](https://theia-ide.org/docs/extensions/) +- [Develop a VS Code like extension](https://theia-ide.org/docs/authoring_vscode_extensions/) +- [Develop a Theia extension](https://theia-ide.org/docs/authoring_extensions/) +- [Test a VS Code extension in Theia](https://github.com/eclipse-theia/theia/wiki/Testing-VS-Code-extensions) +- [Package a desktop Theia application with Electron](https://theia-ide.org/docs/blueprint_documentation/) + +## Contributing + +Read below to learn how to take part in improving Theia: + +- Fork the repository and [run the examples from source](doc/Developing.md#quick-start) +- Get familiar with [the development workflow](doc/Developing.md), [Coding Guidelines](doc/coding-guidelines.md), [Code of Conduct](CODE_OF_CONDUCT.md) and [sign the Eclipse contributor agreement](CONTRIBUTING.md#eclipse-contributor-agreement) +- Find an issue to work on and submit a pull request + - First time contributing to open source? Pick a [good first issue](https://github.com/eclipse-theia/theia/labels/good%20first%20issue) to get you familiar with GitHub contributing process. + - First time contributing to Theia? Pick a [beginner friendly issue](https://github.com/eclipse-theia/theia/labels/beginners) to get you familiar with codebase and our contributing process. + - Want to become a Committer? Solve an issue showing that you understand Theia objectives and architecture. [Here](https://github.com/eclipse-theia/theia/labels/help%20wanted) is a good list to start. Further, have a look at our [roadmap](https://github.com/eclipse-theia/theia/wiki/Eclipse-Theia-Roadmap) to align your contributions with the current project goals. +- Could not find an issue? Look for bugs, typos, and missing features. + +## Feedback + +Read below how to engage with Theia community: + +- Join the discussion on [GitHub](https://github.com/eclipse-theia/theia/discussions). +- Ask a question, request a new feature and file a bug with [GitHub issues](https://github.com/eclipse-theia/theia/issues/new/choose). +- Vote on existing GitHub issues by reacting with a 👍. We regularly check issues with votes! +- Star the repository to show your support. +- Follow Theia on [X](https://x.com/theia_ide). +- Join the [weekly developer call](https://github.com/eclipse-theia/theia/wiki/Dev-Meetings) + +## Documentation + +- [API Documentation](https://eclipse-theia.github.io/theia/docs/next/index.html) +- [General Documentation](https://theia-ide.org/docs/) +- [VS Code API Compatibility Report](https://eclipse-theia.github.io/vscode-theia-comparator/status.html) +- Useful Links: + - [Developing](doc/Developing.md) + - [Testing](doc/Testing.md) + - [Migration Guide](doc/Migration.md) + - [API Integration Testing](doc/api-testing.md) + - [Coding Guidelines](doc/coding-guidelines.md) + - [Code Organization](doc/code-organization.md) + - [Plugin and VSCode API](doc/Plugin-API.md) + +## SBOM + +To enhance supply chain security and offer users clear insight into project components, Eclipse Theia now generates a Software Bill of Materials (SBOM) for every release. These are published to the Eclipse Foundation SBOM registry, with access instructions and usage details available in this [documentation](https://eclipse-csi.github.io/security-handbook/sbom/registry.html). + +## License + +- [Eclipse Public License 2.0](LICENSE-EPL) +- [一 (Secondary) GNU General Public License, version 2 with the GNU Classpath Exception](LICENSE-GPL-2.0-ONLY-CLASSPATH-EXCEPTION) + +## Trademark + +"Theia" is a **trademark of the Eclipse Foundation**. [Learn More](https://www.eclipse.org/theia) + + + + diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 0000000..5b7d38f --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,11 @@ +# Eclipse Theia Vulnerability Reporting Policy + +If you think or suspect that you have discovered a new security vulnerability +in this project, please __do not__ disclose it on GitHub, e.g. in an issue, a +PR, or a discussion. Any such disclosure will be removed/deleted on sight, to +promote orderly disclosure, as per the Eclipse Foundation Security Policy (1). + +Instead, please report any potential vulnerability to the Eclipse Foundation [Security Team](https://www.eclipse.org/security/). Make sure to provide a concise description of the issue, a CWE, and other supporting information. + +(1) _Eclipse Foundation Vulnerability Reporting Policy_: +[https://www.eclipse.org/security/policy.php](https://www.eclipse.org/security/policy.php) diff --git a/cloudbuild-custom.yaml b/cloudbuild-custom.yaml new file mode 100644 index 0000000..c119ee2 --- /dev/null +++ b/cloudbuild-custom.yaml @@ -0,0 +1,68 @@ +availableSecrets: + secretManager: + - versionName: projects/master-ai-484822/secrets/gitea-token/versions/latest + env: GITEA_TOKEN + +steps: + # Step 1: Clone the repo from Gitea (master branch has our startup script + vibn.css) + - name: 'alpine/git' + entrypoint: sh + args: + - -c + - | + git clone --depth=1 -b master \ + https://oauth2:$$GITEA_TOKEN@git.vibnai.com/mark/theia-code-os.git \ + /workspace/src && \ + echo "Cloned commit: $(git -C /workspace/src rev-parse --short HEAD)" + secretEnv: ['GITEA_TOKEN'] + + # Step 2: Build image FROM upstream Theia Blueprint — no compilation needed + # Just adds startup-custom.sh and vibn.css on top of the pre-built Blueprint image + - name: 'gcr.io/cloud-builders/docker' + args: + - build + - -f + - /workspace/src/Dockerfile.custom + - -t + - northamerica-northeast1-docker.pkg.dev/master-ai-484822/vibn-ide/theia:latest + - /workspace/src + + # Step 3: Push to Artifact Registry + - name: 'gcr.io/cloud-builders/docker' + args: + - push + - northamerica-northeast1-docker.pkg.dev/master-ai-484822/vibn-ide/theia:latest + + # Step 4: Roll out new image to all active Cloud Run workspace services + - name: 'gcr.io/google.com/cloudsdktool/cloud-sdk:slim' + entrypoint: bash + args: + - -c + - | + IMAGE="northamerica-northeast1-docker.pkg.dev/master-ai-484822/vibn-ide/theia:latest" + + SERVICES=$$(gcloud run services list \ + --project=master-ai-484822 \ + --region=northamerica-northeast1 \ + --format="value(name)" \ + --filter="metadata.name:theia-") + + for svc in $$SERVICES; do + echo "Rolling out new image to $$svc..." + gcloud run services update $$svc \ + --project=master-ai-484822 \ + --region=northamerica-northeast1 \ + --image=$$IMAGE \ + --quiet + done + echo "Rollout complete." + +images: + - northamerica-northeast1-docker.pkg.dev/master-ai-484822/vibn-ide/theia:latest + +options: + machineType: E2_HIGHCPU_32 + logging: CLOUD_LOGGING_ONLY + +# Full source compile + webpack — needs ~20 minutes on 32-vCPU machine +timeout: 2400s diff --git a/cloudbuild.yaml b/cloudbuild.yaml new file mode 100644 index 0000000..4f0fec8 --- /dev/null +++ b/cloudbuild.yaml @@ -0,0 +1,12 @@ +steps: + - name: 'gcr.io/cloud-builders/docker' + args: + - build + - -f + - Dockerfile.vibn + - -t + - northamerica-northeast1-docker.pkg.dev/master-ai-484822/vibn-ide/theia:latest + - . +images: + - northamerica-northeast1-docker.pkg.dev/master-ai-484822/vibn-ide/theia:latest +timeout: 1200s diff --git a/configs/base.eslintrc.json b/configs/base.eslintrc.json new file mode 100644 index 0000000..d4dfeff --- /dev/null +++ b/configs/base.eslintrc.json @@ -0,0 +1,29 @@ +{ + "parser": "@typescript-eslint/parser", + "parserOptions": { + "sourceType": "module", + "ecmaVersion": 6, + "ecmaFeatures": { + "jsx": true + } + }, + "plugins": [ + "@theia", + "@typescript-eslint", + "@typescript-eslint/tslint", + "import", + "no-null", + "eslint-plugin-deprecation", + "eslint-plugin-react", + "eslint-plugin-no-unsanitized" + ], + "env": { + "browser": true, + "mocha": true, + "node": true + }, + "ignorePatterns": [ + "node_modules", + "lib" + ] +} diff --git a/configs/base.tsconfig.json b/configs/base.tsconfig.json new file mode 100644 index 0000000..30aed93 --- /dev/null +++ b/configs/base.tsconfig.json @@ -0,0 +1,30 @@ +{ + "$schema": "https://json.schemastore.org/tsconfig", + "compilerOptions": { + "skipLibCheck": true, + "declaration": true, + "declarationMap": true, + "noImplicitAny": true, + "noImplicitOverride": true, + "noEmitOnError": false, + "noImplicitThis": true, + "noUnusedLocals": true, + "strictNullChecks": true, + "experimentalDecorators": true, + "emitDecoratorMetadata": true, + "importHelpers": true, + "downlevelIteration": true, + "resolveJsonModule": true, + "useDefineForClassFields": false, + "module": "CommonJS", + "moduleResolution": "Node", + "target": "ES2023", + "jsx": "react", + "lib": [ + "ES2023", + "DOM", + "DOM.AsyncIterable" + ], + "sourceMap": true + } +} diff --git a/configs/build.eslintrc.json b/configs/build.eslintrc.json new file mode 100644 index 0000000..b2ac03d --- /dev/null +++ b/configs/build.eslintrc.json @@ -0,0 +1,12 @@ +{ + "extends": [ + "./base.eslintrc.json", + "./errors.eslintrc.json" + ], + "parserOptions": { + "lib": [ + "ES2023", + "DOM" + ] + } +} diff --git a/configs/errors.eslintrc.json b/configs/errors.eslintrc.json new file mode 100644 index 0000000..7b7b220 --- /dev/null +++ b/configs/errors.eslintrc.json @@ -0,0 +1,179 @@ +{ + "$schema": "https://json.schemastore.org/eslintrc", + "rules": { + "@typescript-eslint/consistent-type-definitions": "error", + "@typescript-eslint/indent": "off", + "@typescript-eslint/no-explicit-any": "error", + "@typescript-eslint/quotes": [ + "error", + "single", + { + "avoidEscape": true + } + ], + "@typescript-eslint/semi": [ + "error", + "always" + ], + "@typescript-eslint/type-annotation-spacing": "error", + "arrow-body-style": [ + "error", + "as-needed" + ], + "arrow-parens": [ + "error", + "as-needed" + ], + "camelcase": "off", + "comma-dangle": "off", + "curly": "error", + "eol-last": "error", + "eqeqeq": [ + "error", + "smart" + ], + "guard-for-in": "error", + "id-blacklist": "off", + "id-denylist": [ + "error", + "await" + ], + "id-match": "off", + "max-len": [ + "error", + { + "code": 180 + } + ], + "no-duplicate-imports": "error", + "no-magic-numbers": "off", + "no-multiple-empty-lines": [ + "error", + { + "max": 1 + } + ], + "no-new-wrappers": "error", + "no-null/no-null": "error", + "no-shadow": "off", + "no-shadow-restricted-names": "error", + "@typescript-eslint/no-shadow": [ + "error", + { + "hoist": "all" + } + ], + "no-tabs": "error", + "no-throw-literal": "error", + "no-trailing-spaces": "error", + "no-underscore-dangle": "off", + "no-unreachable": "error", + "no-unused-expressions": "error", + "no-var": "error", + "no-void": "error", + "one-var": [ + "error", + "never" + ], + "prefer-const": [ + "error", + { + "destructuring": "all" + } + ], + "radix": "off", + "space-before-function-paren": [ + "error", + { + "anonymous": "always", + "named": "never", + "asyncArrow": "always" + } + ], + "spaced-comment": [ + "error", + "always", + { + "exceptions": [ + "*", + "+", + "-", + "/" + ] + } + ], + "@typescript-eslint/tslint/config": [ + "error", + { + "rules": { + "file-header": [ + true, + { + "allow-single-line-comments": true, + "match": "SPDX-License-Identifier: EPL-2\\.0 OR GPL-2\\.0-only WITH Classpath-exception-2\\.0" + } + ], + "jsdoc-format": [ + true, + "check-multiline-start" + ], + "one-line": [ + true, + "check-open-brace", + "check-catch", + "check-else", + "check-whitespace" + ], + "typedef": [ + true, + "call-signature", + "property-declaration" + ], + "whitespace": [ + true, + "check-branch", + "check-decl", + "check-operator", + "check-separator", + "check-type" + ] + } + } + ], + "@theia/annotation-check": "error", + "@theia/localization-check": "error", + "@theia/no-src-import": "error", + "@theia/runtime-import-check": "error", + "@theia/shared-dependencies": "error", + "import/no-extraneous-dependencies": "error", + "import/no-dynamic-require": "error", + "no-restricted-imports": [ + "error", + ".", + "./", + "..", + "../" + ] + }, + "overrides": [ + { + "files": [ + "**/*.{spec,espec,slow-spec}.{js,ts,tsx}" + ], + "rules": { + "@theia/runtime-import-check": "off", + "@theia/shared-dependencies": "off", + "import/no-extraneous-dependencies": "off", + "no-unused-expressions": "off" + } + }, + { + "files": [ + "**/electron-{node,main}/**" + ], + "rules": { + "import/no-dynamic-require": "off" + } + } + ] +} diff --git a/configs/license-check-config.json b/configs/license-check-config.json new file mode 100644 index 0000000..f6fcf79 --- /dev/null +++ b/configs/license-check-config.json @@ -0,0 +1,7 @@ +{ + "project": "ecd.theia", + "inputFile": "package-lock.json", + "batch": 50, + "timeout": 240, + "summary": "license-check-summary.txt" +} diff --git a/configs/merge.typedoc.json b/configs/merge.typedoc.json new file mode 100644 index 0000000..168b54f --- /dev/null +++ b/configs/merge.typedoc.json @@ -0,0 +1,32 @@ +{ + "$schema": "https://typedoc.org/schema.json", + "entryPointStrategy": "merge", + "entryPoints": [ + "../gh-pages/packages/*.json" + ], + "out": "../gh-pages/docs/next", + "readme": "../README.md", + "favicon": "../logo/favicon.png", + "hideGenerator": true, + "navigation": { + "includeFolders": false, + }, + "navigationLinks": { + "Eclipse Theia Website": "https://theia-ide.org/", + "GitHub": "https://github.com/eclipse-theia/theia" + }, + "searchInDocuments": true, + "projectDocuments": [ + "../doc/Migration.md", + "../doc/Plugin-API.md", + "../doc/api-management.md", + "../doc/api-testing.md", + "../doc/Developing.md", + "../doc/Testing.md", + "../doc/code-organization.md", + "../doc/coding-guidelines.md", + ], + "headings": { + "document": true + } +} diff --git a/configs/mocharc.yml b/configs/mocharc.yml new file mode 100644 index 0000000..f340113 --- /dev/null +++ b/configs/mocharc.yml @@ -0,0 +1,8 @@ +require: + - 'ignore-styles' + - 'reflect-metadata/Reflect' + - '@theia/test-setup' +reporter: 'spec' +watch-files: + - '**/*.js' +exit: true diff --git a/configs/nyc.json b/configs/nyc.json new file mode 100644 index 0000000..6d266bb --- /dev/null +++ b/configs/nyc.json @@ -0,0 +1,17 @@ +{ + "include": [ + "src/**/*.ts" + ], + "exclude": [ + "src/typings", + "src/**/*.spec.ts" + ], + "reporter": [ + "html", + "lcov" + ], + "extension": [ + ".ts" + ], + "all": true +} \ No newline at end of file diff --git a/configs/package.typedoc.json b/configs/package.typedoc.json new file mode 100644 index 0000000..45cccba --- /dev/null +++ b/configs/package.typedoc.json @@ -0,0 +1,18 @@ +{ + "$schema": "https://typedoc.org/schema.json", + "entryPointStrategy": "expand", + "exclude": [ + "**/*spec.ts", + "**/*spec.tsx", + "**/*test.ts", + "**/*test.tsx", + "**/src/**/test/**", + "**/src/**/tests/**", + "**/src/**/typings/**", + ], + "hideGenerator": true, + "searchInComments": true, + "skipErrorChecking": true, + "commentStyle": "all", + "logLevel": "Error" +} diff --git a/configs/warnings.eslintrc.json b/configs/warnings.eslintrc.json new file mode 100644 index 0000000..8403d0a --- /dev/null +++ b/configs/warnings.eslintrc.json @@ -0,0 +1,10 @@ +{ + "plugins": [ + "deprecation" + ], + "rules": { + "@typescript-eslint/await-thenable": "warn", + "no-return-await": "warn", + "deprecation/deprecation": "warn" + } +} \ No newline at end of file diff --git a/configs/xss.eslintrc.json b/configs/xss.eslintrc.json new file mode 100644 index 0000000..11745db --- /dev/null +++ b/configs/xss.eslintrc.json @@ -0,0 +1,29 @@ +{ + "extends": ["plugin:no-unsanitized/DOM"], + "plugins": ["no-unsanitized", "react"], + "parserOptions": { + "ecmaFeatures": { + "jsx": true + } + }, + "rules": { + "no-unsanitized/method": [ + "warn", { + "escape": { + "methods": ["DOMPurify.sanitize"] + } + } + ], + "no-unsanitized/property": [ + "warn", { + "escape": { + "methods": ["DOMPurify.sanitize"] + } + } + ], + "no-eval": "warn", + "no-implied-eval": "warn", + "react/no-danger-with-children": "warn", + "react/no-danger": "warn" + } +} diff --git a/deploy.sh b/deploy.sh new file mode 100755 index 0000000..9b44110 --- /dev/null +++ b/deploy.sh @@ -0,0 +1,72 @@ +#!/bin/bash +# deploy.sh — Build Theia locally then push to Cloud Run +# +# Usage: +# ./deploy.sh # full build + push + deploy +# ./deploy.sh --skip-compile # just repackage + push (if already compiled) +# ./deploy.sh --service theia-my-proj # target a specific Cloud Run service + +set -e + +IMAGE="northamerica-northeast1-docker.pkg.dev/master-ai-484822/vibn-ide/theia:latest" +PROJECT="master-ai-484822" +REGION="northamerica-northeast1" +SERVICE="${SERVICE:-}" # optional: set via --service flag or env var + +SKIP_COMPILE=false + +for arg in "$@"; do + case $arg in + --skip-compile) SKIP_COMPILE=true ;; + --service=*) SERVICE="${arg#*=}" ;; + --service) shift; SERVICE="$1" ;; + esac +done + +echo "🔧 Vibn IDE Deploy" +echo " Image: $IMAGE" +echo " Project: $PROJECT" +echo "" + +# ── Step 1: Compile Theia on the Mac ────────────────────────────────────────── +if [ "$SKIP_COMPILE" = false ]; then + echo "▶ Step 1/3: Compiling Theia (TypeScript + webpack)..." + npm install --legacy-peer-deps + npm run compile + npm run build:browser + echo "✓ Compile done" +else + echo "⏭ Skipping compile (--skip-compile)" +fi + +# ── Step 2: Build runtime Docker image (no compile, just COPY) ───────────── +echo "▶ Step 2/3: Building runtime Docker image..." +docker build \ + --platform linux/amd64 \ + -f Dockerfile.runtime \ + -t "$IMAGE" \ + . +echo "✓ Docker image built" + +# ── Step 3: Push to Artifact Registry ───────────────────────────────────────── +echo "▶ Step 3/3: Pushing to Artifact Registry..." +docker push "$IMAGE" +echo "✓ Pushed: $IMAGE" + +# ── Optional: Update a specific Cloud Run service ────────────────────────────── +if [ -n "$SERVICE" ]; then + echo "▶ Updating Cloud Run service: $SERVICE" + gcloud run services update "$SERVICE" \ + --project="$PROJECT" \ + --region="$REGION" \ + --image="$IMAGE" + echo "✓ Service updated" +fi + +echo "" +echo "✅ Done! New image is live." +echo "" +echo "To update a specific Cloud Run service:" +echo " gcloud run services update \\" +echo " --project=$PROJECT --region=$REGION \\" +echo " --image=$IMAGE" diff --git a/dev-packages/application-manager/.eslintrc.js b/dev-packages/application-manager/.eslintrc.js new file mode 100644 index 0000000..1d7d77d --- /dev/null +++ b/dev-packages/application-manager/.eslintrc.js @@ -0,0 +1,13 @@ +/** @type {import('eslint').Linter.Config} */ +module.exports = { + extends: [ + '../../configs/build.eslintrc.json' + ], + parserOptions: { + tsconfigRootDir: __dirname, + project: 'tsconfig.json' + }, + rules: { + 'import/no-dynamic-require': 'off' + } +}; diff --git a/dev-packages/application-manager/README.md b/dev-packages/application-manager/README.md new file mode 100644 index 0000000..56e508e --- /dev/null +++ b/dev-packages/application-manager/README.md @@ -0,0 +1,26 @@ +
+ +
+ +theia-ext-logo + +

ECLIPSE THEIA - APPLICATION-MANAGER

+ +
+ +
+ +## Additional Information + +- [Theia - GitHub](https://github.com/eclipse-theia/theia) +- [Theia - Website](https://theia-ide.org/) + +## License + +- [Eclipse Public License 2.0](http://www.eclipse.org/legal/epl-2.0/) +- [一 (Secondary) GNU General Public License, version 2 with the GNU Classpath Exception](https://projects.eclipse.org/license/secondary-gpl-2.0-cp) + +## Trademark + +"Theia" is a trademark of the Eclipse Foundation + diff --git a/dev-packages/application-manager/package.json b/dev-packages/application-manager/package.json new file mode 100644 index 0000000..446b38f --- /dev/null +++ b/dev-packages/application-manager/package.json @@ -0,0 +1,81 @@ +{ + "name": "@theia/application-manager", + "version": "1.68.0", + "description": "Theia application manager API.", + "publishConfig": { + "access": "public" + }, + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "repository": { + "type": "git", + "url": "https://github.com/eclipse-theia/theia.git" + }, + "bugs": { + "url": "https://github.com/eclipse-theia/theia/issues" + }, + "homepage": "https://github.com/eclipse-theia/theia", + "files": [ + "lib", + "src" + ], + "main": "lib/index.js", + "typings": "lib/index.d.ts", + "scripts": { + "build": "theiaext build", + "clean": "theiaext clean", + "compile": "theiaext compile", + "lint": "theiaext lint", + "test": "theiaext test", + "watch": "theiaext watch" + }, + "dependencies": { + "@babel/core": "^7.10.0", + "@babel/plugin-transform-classes": "^7.10.0", + "@babel/plugin-transform-runtime": "^7.10.0", + "@babel/preset-env": "^7.10.0", + "@theia/application-package": "1.68.0", + "@theia/ffmpeg": "1.68.0", + "@theia/native-webpack-plugin": "1.68.0", + "@types/fs-extra": "^4.0.2", + "@types/semver": "^7.5.0", + "babel-loader": "^8.2.2", + "buffer": "^6.0.3", + "compression-webpack-plugin": "^9.0.0", + "copy-webpack-plugin": "^8.1.1", + "css-loader": "^6.2.0", + "@electron/rebuild": "^3.7.2", + "fs-extra": "^4.0.2", + "http-server": "^14.1.1", + "ignore-loader": "^0.1.2", + "less": "^3.0.3", + "mini-css-extract-plugin": "^2.6.1", + "node-loader": "^2.0.0", + "path-browserify": "^1.0.1", + "semver": "^7.5.4", + "source-map": "^0.6.1", + "source-map-loader": "^2.0.1", + "source-map-support": "^0.5.19", + "style-loader": "^2.0.0", + "tslib": "^2.6.2", + "umd-compat-loader": "^2.1.2", + "webpack": "^5.76.0", + "webpack-cli": "4.7.0", + "worker-loader": "^3.0.8", + "yargs": "^15.3.1" + }, + "peerDependencies": { + "@theia/electron": "*" + }, + "peerDependenciesMeta": { + "@theia/electron": { + "optional": true + } + }, + "devDependencies": { + "@theia/ext-scripts": "1.68.0" + }, + "nyc": { + "extends": "../../configs/nyc.json" + }, + "gitHead": "21358137e41342742707f660b8e222f940a27652" +} diff --git a/dev-packages/application-manager/src/application-package-manager.ts b/dev-packages/application-manager/src/application-package-manager.ts new file mode 100644 index 0000000..09d3d26 --- /dev/null +++ b/dev-packages/application-manager/src/application-package-manager.ts @@ -0,0 +1,263 @@ +// ***************************************************************************** +// Copyright (C) 2017 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import * as path from 'path'; +import * as fs from 'fs-extra'; +import * as cp from 'child_process'; +import * as semver from 'semver'; +import { ApplicationPackage, ApplicationPackageOptions } from '@theia/application-package'; +import { WebpackGenerator, FrontendGenerator, BackendGenerator } from './generator'; +import { ApplicationProcess } from './application-process'; +import { GeneratorOptions } from './generator/abstract-generator'; +import yargs = require('yargs'); + +// Declare missing exports from `@types/semver@7` +declare module 'semver' { + function minVersion(range: string): string; +} + +class AbortError extends Error { + constructor(...args: Parameters) { + super(...args); + Object.setPrototypeOf(this, AbortError.prototype); + } +} + +export class ApplicationPackageManager { + + static defineGeneratorOptions(cli: yargs.Argv): yargs.Argv { + return cli + .option('mode', { + description: 'Generation mode to use', + choices: ['development', 'production'], + default: 'production' as const, + }) + .option('split-frontend', { + description: 'Split frontend modules into separate chunks. By default enabled in the `development` mode and disabled in the `production` mode.', + type: 'boolean' + }); + } + + readonly pck: ApplicationPackage; + /** application process */ + readonly process: ApplicationProcess; + /** manager process */ + protected readonly __process: ApplicationProcess; + + constructor(options: ApplicationPackageOptions) { + this.pck = new ApplicationPackage(options); + this.process = new ApplicationProcess(this.pck, options.projectPath); + this.__process = new ApplicationProcess(this.pck, path.join(__dirname, '..')); + } + + protected async remove(fsPath: string): Promise { + if (await fs.pathExists(fsPath)) { + await fs.remove(fsPath); + } + } + + async clean(): Promise { + const webpackGenerator = new WebpackGenerator(this.pck); + await Promise.all([ + this.remove(this.pck.lib()), + this.remove(this.pck.srcGen()), + this.remove(webpackGenerator.genConfigPath), + this.remove(webpackGenerator.genNodeConfigPath) + ]); + } + + async prepare(): Promise { + if (this.pck.isElectron()) { + await this.prepareElectron(); + } + } + + async generate(options: GeneratorOptions = {}): Promise { + try { + await this.prepare(); + } catch (error) { + if (error instanceof AbortError) { + console.warn(error.message); + process.exit(1); + } + throw error; + } + await Promise.all([ + new WebpackGenerator(this.pck, options).generate(), + new BackendGenerator(this.pck, options).generate(), + new FrontendGenerator(this.pck, options).generate(), + ]); + } + + async copy(): Promise { + await fs.ensureDir(this.pck.lib('frontend')); + await fs.copy(this.pck.frontend('index.html'), this.pck.lib('frontend', 'index.html')); + } + + async build(args: string[] = [], options: GeneratorOptions = {}): Promise { + await this.generate(options); + await this.copy(); + return this.__process.run('webpack', args); + } + + start(args: string[] = []): cp.ChildProcess { + if (this.pck.isElectron()) { + return this.startElectron(args); + } else if (this.pck.isBrowserOnly()) { + return this.startBrowserOnly(args); + } + return this.startBrowser(args); + } + + startBrowserOnly(args: string[]): cp.ChildProcess { + const { command, mainArgs, options } = this.adjustBrowserOnlyArgs(args); + return this.__process.spawnBin(command, mainArgs, options); + } + + adjustBrowserOnlyArgs(args: string[]): Readonly<{ command: string, mainArgs: string[]; options: cp.SpawnOptions }> { + let { mainArgs, options } = this.adjustArgs(args); + + // first parameter: path to generated frontend + // second parameter: disable cache to support watching + mainArgs = ['lib/frontend', '-c-1', ...mainArgs]; + + const portIndex = mainArgs.findIndex(v => v.startsWith('--port')); + if (portIndex === -1) { + mainArgs.push('--port=3000'); + } + + return { command: 'http-server', mainArgs, options }; + } + + startElectron(args: string[]): cp.ChildProcess { + // If possible, pass the project root directory to electron rather than the script file so that Electron + // can determine the app name. This requires that the package.json has a main field. + let appPath = this.pck.projectPath; + + if (!this.pck.pck.main) { + // Try the bundled electron app first + appPath = this.pck.lib('backend', 'electron-main.js'); + if (!fs.existsSync(appPath)) { + // Fallback to the generated electron app in src-gen + appPath = this.pck.backend('electron-main.js'); + } + + console.warn( + `WARNING: ${this.pck.packagePath} does not have a "main" entry.\n` + + 'Please add the following line:\n' + + ' "main": "lib/backend/electron-main.js"' + ); + } + + const { mainArgs, options } = this.adjustArgs([appPath, ...args]); + const electronCli = require.resolve('electron/cli.js', { paths: [this.pck.projectPath] }); + return this.__process.fork(electronCli, mainArgs, options); + } + + startBrowser(args: string[]): cp.ChildProcess { + const { mainArgs, options } = this.adjustArgs(args); + // The backend must be a process group leader on UNIX in order to kill the tree later. + // See https://nodejs.org/api/child_process.html#child_process_options_detached + options.detached = process.platform !== 'win32'; + // Try the bundled backend app first + let mainPath = this.pck.lib('backend', 'main.js'); + if (!fs.existsSync(mainPath)) { + // Fallback to the generated backend file in src-gen + mainPath = this.pck.backend('main.js'); + } + return this.__process.fork(mainPath, mainArgs, options); + } + + /** + * Inject Theia's Electron-specific dependencies into the application's package.json. + * + * Only overwrite the Electron range if the current minimum supported version is lower than the recommended one. + */ + protected async prepareElectron(): Promise { + let theiaElectron; + try { + theiaElectron = await import('@theia/electron'); + } catch (error) { + if (error.code === 'ERR_MODULE_NOT_FOUND') { + throw new AbortError('Please install @theia/electron as part of your Theia Electron application'); + } + throw error; + } + const expectedRange = theiaElectron.electronRange; + const appPackageJsonPath = this.pck.path('package.json'); + const appPackageJson = await fs.readJSON(appPackageJsonPath) as { devDependencies?: Record }; + if (!appPackageJson.devDependencies) { + appPackageJson.devDependencies = {}; + } + const currentRange: string | undefined = appPackageJson.devDependencies.electron; + if (!currentRange || semver.compare(semver.minVersion(currentRange), semver.minVersion(expectedRange)) < 0) { + // Update the range with the recommended one and write it on disk. + appPackageJson.devDependencies = this.insertAlphabetically(appPackageJson.devDependencies, 'electron', expectedRange); + await fs.writeJSON(appPackageJsonPath, appPackageJson, { spaces: 2 }); + throw new AbortError('Updated dependencies, please run "install" again'); + } + if (!theiaElectron.electronVersion || !semver.satisfies(theiaElectron.electronVersion, currentRange)) { + throw new AbortError('Dependencies are out of sync, please run "install" again'); + } + const ffmpeg = await import('@theia/ffmpeg'); + await ffmpeg.replaceFfmpeg(); + await ffmpeg.checkFfmpeg(); + } + + protected insertAlphabetically>(object: T, key: string, value: string): T { + const updated: Record = {}; + for (const property of Object.keys(object)) { + if (property.localeCompare(key) > 0) { + updated[key] = value; + } + updated[property] = object[property]; + } + if (!(key in updated)) { + updated[key] = value; + } + return updated as T; + } + + private adjustArgs(args: string[], forkOptions: cp.ForkOptions = {}): Readonly<{ mainArgs: string[]; options: cp.ForkOptions }> { + const options = { + ...this.forkOptions, + forkOptions + }; + const mainArgs = [...args]; + const inspectIndex = mainArgs.findIndex(v => v.startsWith('--inspect')); + if (inspectIndex !== -1) { + const inspectArg = mainArgs.splice(inspectIndex, 1)[0]; + options.execArgv = ['--nolazy', inspectArg]; + } + return { + mainArgs, + options + }; + } + + private get forkOptions(): cp.ForkOptions { + return { + stdio: [0, 1, 2, 'ipc'], + env: { + ...process.env, + THEIA_PARENT_PID: String(process.pid) + } + }; + } +} diff --git a/dev-packages/application-manager/src/application-process.ts b/dev-packages/application-manager/src/application-process.ts new file mode 100644 index 0000000..7e735c2 --- /dev/null +++ b/dev-packages/application-manager/src/application-process.ts @@ -0,0 +1,100 @@ +// ***************************************************************************** +// Copyright (C) 2017 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import * as path from 'path'; +import * as fs from 'fs-extra'; +import * as cp from 'child_process'; +import { ApplicationPackage } from '@theia/application-package'; + +export class ApplicationProcess { + + protected readonly defaultOptions = { + cwd: this.pck.projectPath, + env: process.env + }; + + constructor( + protected readonly pck: ApplicationPackage, + protected readonly binProjectPath: string + ) { } + + spawn(command: string, args?: string[], options?: cp.SpawnOptions): cp.ChildProcess { + return cp.spawn(command, args || [], Object.assign({}, this.defaultOptions, { + ...options, + shell: true + })); + } + + fork(modulePath: string, args?: string[], options?: cp.ForkOptions): cp.ChildProcess { + return cp.fork(modulePath, args, Object.assign({}, this.defaultOptions, options)); + } + + canRun(command: string): boolean { + const binPath = this.resolveBin(this.binProjectPath, command); + return !!binPath && fs.existsSync(binPath); + } + + run(command: string, args: string[], options?: cp.SpawnOptions): Promise { + const commandProcess = this.spawnBin(command, args, options); + return this.promisify(command, commandProcess); + } + + spawnBin(command: string, args: string[], options?: cp.SpawnOptions): cp.ChildProcess { + const binPath = this.resolveBin(this.binProjectPath, command); + if (!binPath) { + throw new Error(`Could not resolve ${command} relative to ${this.binProjectPath}`); + } + return this.spawn(binPath, args, { + ...options, + shell: true + }); + } + + protected resolveBin(rootPath: string, command: string): string | undefined { + let commandPath = path.resolve(rootPath, 'node_modules', '.bin', command); + if (process.platform === 'win32') { + commandPath = commandPath + '.cmd'; + } + if (fs.existsSync(commandPath)) { + return commandPath; + } + const parentDir = path.dirname(rootPath); + if (parentDir === rootPath) { + return undefined; + } + return this.resolveBin(parentDir, command); + } + + protected promisify(command: string, p: cp.ChildProcess): Promise { + return new Promise((resolve, reject) => { + p.stdout!.on('data', data => this.pck.log(data.toString())); + p.stderr!.on('data', data => this.pck.error(data.toString())); + p.on('error', reject); + p.on('close', (code, signal) => { + if (signal) { + reject(new Error(`${command} exited with an unexpected signal: ${signal}.`)); + return; + } + if (code === 0) { + resolve(); + } else { + reject(new Error(`${command} exited with an unexpected code: ${code}.`)); + } + }); + }); + } + +} diff --git a/dev-packages/application-manager/src/expose-loader.ts b/dev-packages/application-manager/src/expose-loader.ts new file mode 100644 index 0000000..bdd7070 --- /dev/null +++ b/dev-packages/application-manager/src/expose-loader.ts @@ -0,0 +1,80 @@ +// ***************************************************************************** +// Copyright (C) 2020 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import * as fs from 'fs-extra'; +import * as path from 'path'; +// eslint-disable-next-line import/no-extraneous-dependencies +import type { RawSourceMap } from 'source-map'; +import { ApplicationPackage } from '@theia/application-package/lib/application-package'; + +const modulePackages: { dir: string, name?: string }[] = []; +for (const extensionPackage of new ApplicationPackage({ projectPath: process.cwd() }).extensionPackages) { + modulePackages.push({ + name: extensionPackage.name, + dir: path.dirname(extensionPackage.raw.installed!.packagePath) + }); +} + +function exposeModule(modulePackage: { dir: string, name?: string }, resourcePath: string, source: string): string { + if (!modulePackage.name) { + return source; + } + const { dir, name } = path.parse(resourcePath); + let moduleName = path.join(modulePackage.name, dir.substring(modulePackage.dir.length)); + if (name !== 'index') { + moduleName = path.join(moduleName, name); + } + if (path.sep !== '/') { + moduleName = moduleName.split(path.sep).join('/'); + } + return source + `\n;(globalThis['theia'] = globalThis['theia'] || {})['${moduleName}'] = this;\n`; +} + +/** + * Expose bundled modules on window.theia.moduleName namespace, e.g. + * window['theia']['@theia/core/lib/common/uri']. + * Such syntax can be used by external code, for instance, for testing. + */ +// TODO: webpack@5.36.2 is missing a `LoaderContext` interface so we'll use any in the meantime +// eslint-disable-next-line @typescript-eslint/no-explicit-any +export = function (this: any, source: string, sourceMap?: RawSourceMap): string | undefined { + if (this.cacheable) { + this.cacheable(); + } + let modulePackage = modulePackages.find(({ dir }) => this.resourcePath.startsWith(dir + path.sep)); + if (modulePackage) { + this.callback(undefined, exposeModule(modulePackage, this.resourcePath, source), sourceMap); + return; + } + const searchString = path.sep + 'node_modules'; + const index = this.resourcePath.lastIndexOf(searchString); + if (index !== -1) { + const nodeModulesPath = this.resourcePath.substring(0, index + searchString.length); + let dir = this.resourcePath; + while ((dir = path.dirname(dir)) !== nodeModulesPath) { + try { + const { name } = fs.readJSONSync(path.join(dir, 'package.json')); + modulePackage = { name, dir }; + modulePackages.push(modulePackage); + this.callback(undefined, exposeModule(modulePackage, this.resourcePath, source), sourceMap); + return; + } catch { + /** no-op */ + } + } + } + this.callback(undefined, source, sourceMap); +}; diff --git a/dev-packages/application-manager/src/generator/abstract-generator.ts b/dev-packages/application-manager/src/generator/abstract-generator.ts new file mode 100644 index 0000000..da35c5d --- /dev/null +++ b/dev-packages/application-manager/src/generator/abstract-generator.ts @@ -0,0 +1,69 @@ +// ***************************************************************************** +// Copyright (C) 2017 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import * as fs from 'fs-extra'; +import { ApplicationPackage } from '@theia/application-package'; + +export interface GeneratorOptions { + mode?: 'development' | 'production' + splitFrontend?: boolean +} + +export abstract class AbstractGenerator { + + constructor( + protected readonly pck: ApplicationPackage, + protected options: GeneratorOptions = {} + ) { } + + protected ifBrowser(value: string, defaultValue: string = ''): string { + return this.pck.ifBrowser(value, defaultValue); + } + + protected ifElectron(value: string, defaultValue: string = ''): string { + return this.pck.ifElectron(value, defaultValue); + } + + protected ifBrowserOnly(value: string, defaultValue: string = ''): string { + return this.pck.ifBrowserOnly(value, defaultValue); + } + + protected async write(path: string, content: string): Promise { + await fs.ensureFile(path); + await fs.writeFile(path, content); + } + + protected ifMonaco(value: () => string, defaultValue: () => string = () => ''): string { + return this.ifPackage([ + '@theia/monaco', + '@theia/monaco-editor-core' + ], value, defaultValue); + } + + protected ifPackage(packageName: string | string[], value: string | (() => string), defaultValue: string | (() => string) = ''): string { + const packages = Array.isArray(packageName) ? packageName : [packageName]; + if (this.pck.extensionPackages.some(e => packages.includes(e.name))) { + return typeof value === 'string' ? value : value(); + } else { + return typeof defaultValue === 'string' ? defaultValue : defaultValue(); + } + } + + protected prettyStringify(object: object): string { + return JSON.stringify(object, undefined, 4); + } + +} diff --git a/dev-packages/application-manager/src/generator/backend-generator.ts b/dev-packages/application-manager/src/generator/backend-generator.ts new file mode 100644 index 0000000..7167a49 --- /dev/null +++ b/dev-packages/application-manager/src/generator/backend-generator.ts @@ -0,0 +1,204 @@ +// ***************************************************************************** +// Copyright (C) 2017 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { EOL } from 'os'; +import { AbstractGenerator } from './abstract-generator'; + +export class BackendGenerator extends AbstractGenerator { + + async generate(): Promise { + if (this.pck.isBrowserOnly()) { + // no backend generation in case of browser-only target + return; + } + const backendModules = this.pck.targetBackendModules; + await this.write(this.pck.backend('server.js'), this.compileServer(backendModules)); + await this.write(this.pck.backend('main.js'), this.compileMain(backendModules)); + if (this.pck.isElectron()) { + await this.write(this.pck.backend('electron-main.js'), this.compileElectronMain(this.pck.targetElectronMainModules)); + } + } + + protected compileElectronMain(electronMainModules?: Map): string { + return `// @ts-check + +require('@theia/core/shared/reflect-metadata'); + +// Workaround for https://github.com/electron/electron/issues/9225. Chrome has an issue where +// in certain locales (e.g. PL), image metrics are wrongly computed. We explicitly set the +// LC_NUMERIC to prevent this from happening (selects the numeric formatting category of the +// C locale, http://en.cppreference.com/w/cpp/locale/LC_categories). +if (process.env.LC_ALL) { + process.env.LC_ALL = 'C'; +} +process.env.LC_NUMERIC = 'C'; + +(async () => { + // Useful for Electron/NW.js apps as GUI apps on macOS doesn't inherit the \`$PATH\` define + // in your dotfiles (.bashrc/.bash_profile/.zshrc/etc). + // https://github.com/electron/electron/issues/550#issuecomment-162037357 + // https://github.com/eclipse-theia/theia/pull/3534#issuecomment-439689082 + (await require('@theia/core/electron-shared/fix-path')).default(); + + const { resolve } = require('path'); + const theiaAppProjectPath = resolve(__dirname, '..', '..'); + process.env.THEIA_APP_PROJECT_PATH = theiaAppProjectPath; + const { default: electronMainApplicationModule } = require('@theia/core/lib/electron-main/electron-main-application-module'); + const { ElectronMainApplication, ElectronMainApplicationGlobals } = require('@theia/core/lib/electron-main/electron-main-application'); + const { Container } = require('@theia/core/shared/inversify'); + const { app } = require('electron'); + + const config = ${this.prettyStringify(this.pck.props.frontend.config)}; + const isSingleInstance = ${this.pck.props.backend.config.singleInstance === true ? 'true' : 'false'}; + + if (isSingleInstance && !app.requestSingleInstanceLock(process.argv)) { + // There is another instance running, exit now. The other instance will request focus. + app.quit(); + return; + } + + const container = new Container(); + container.load(electronMainApplicationModule); + container.bind(ElectronMainApplicationGlobals).toConstantValue({ + THEIA_APP_PROJECT_PATH: theiaAppProjectPath, + THEIA_BACKEND_MAIN_PATH: resolve(__dirname, 'main.js'), + THEIA_FRONTEND_HTML_PATH: resolve(__dirname, '..', '..', 'lib', 'frontend', 'index.html'), + THEIA_SECONDARY_WINDOW_HTML_PATH: resolve(__dirname, '..', '..', 'lib', 'frontend', 'secondary-window.html') + }); + + function load(raw) { + return Promise.resolve(raw.default).then(module => + container.load(module) + ); + } + + async function start() { + const application = container.get(ElectronMainApplication); + await application.start(config); + } + + try { +${Array.from(electronMainModules?.values() ?? [], jsModulePath => `\ + await load(require('${jsModulePath}'));`).join(EOL)} + await start(); + } catch (reason) { + if (typeof reason !== 'number') { + console.error('Failed to start the electron application.'); + if (reason) { + console.error(reason); + } + } + app.quit(); + }; +})(); +`; + } + + protected compileServer(backendModules: Map): string { + return `// @ts-check +require('reflect-metadata');${this.ifElectron(` + +// Patch electron version if missing, see https://github.com/eclipse-theia/theia/pull/7361#pullrequestreview-377065146 +if (typeof process.versions.electron === 'undefined' && typeof process.env.THEIA_ELECTRON_VERSION === 'string') { + process.versions.electron = process.env.THEIA_ELECTRON_VERSION; +}`)} + +// Erase the ELECTRON_RUN_AS_NODE variable from the environment, else Electron apps started using Theia will pick it up. +if ('ELECTRON_RUN_AS_NODE' in process.env) { + delete process.env.ELECTRON_RUN_AS_NODE; +} + +const path = require('path'); +process.env.THEIA_APP_PROJECT_PATH = path.resolve(__dirname, '..', '..') +const express = require('@theia/core/shared/express'); +const { Container } = require('@theia/core/shared/inversify'); +const { BackendApplication, BackendApplicationServer, CliManager } = require('@theia/core/lib/node'); +const { backendApplicationModule } = require('@theia/core/lib/node/backend-application-module'); +const { messagingBackendModule } = require('@theia/core/lib/node/messaging/messaging-backend-module'); +const { loggerBackendModule } = require('@theia/core/lib/node/logger-backend-module'); + +const container = new Container(); +container.load(backendApplicationModule); +container.load(messagingBackendModule); +container.load(loggerBackendModule); + +function defaultServeStatic(app) { + app.use(express.static(path.resolve(__dirname, '../../lib/frontend'))) +} + +function load(raw) { + return Promise.resolve(raw).then( + module => container.load(module.default) + ); +} + +async function start(port, host, argv = process.argv) { + if (!container.isBound(BackendApplicationServer)) { + container.bind(BackendApplicationServer).toConstantValue({ configure: defaultServeStatic }); + } + let result = undefined; + await container.get(CliManager).initializeCli(argv.slice(2), + () => container.get(BackendApplication).configured, + async () => { + result = container.get(BackendApplication).start(port, host); + }); + if (result) { + return result; + } else { + return Promise.reject(0); + } +} + +module.exports = async (port, host, argv) => { + try { +${Array.from(backendModules.values(), jsModulePath => `\ + await load(require('${jsModulePath}'));`).join(EOL)} + return await start(port, host, argv); + } catch (error) { + if (typeof error !== 'number') { + console.error('Failed to start the backend application:'); + console.error(error); + process.exitCode = 1; + } + throw error; + } +} +`; + } + + protected compileMain(backendModules: Map): string { + return `// @ts-check +const { BackendApplicationConfigProvider } = require('@theia/core/lib/node/backend-application-config-provider'); +const main = require('@theia/core/lib/node/main'); + +BackendApplicationConfigProvider.set(${this.prettyStringify(this.pck.props.backend.config)}); + +globalThis.extensionInfo = ${this.prettyStringify(this.pck.extensionPackages.map(({ name, version }) => ({ name, version })))}; + +const serverModule = require('./server'); +const serverAddress = main.start(serverModule()); + +serverAddress.then((addressInfo) => { + if (process && process.send && addressInfo) { + process.send(addressInfo); + } +}); + +globalThis.serverAddress = serverAddress; +`; + } + +} diff --git a/dev-packages/application-manager/src/generator/frontend-generator.ts b/dev-packages/application-manager/src/generator/frontend-generator.ts new file mode 100644 index 0000000..e8b7195 --- /dev/null +++ b/dev-packages/application-manager/src/generator/frontend-generator.ts @@ -0,0 +1,221 @@ +// ***************************************************************************** +// Copyright (C) 2017 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +/* eslint-disable @typescript-eslint/indent */ + +import { EOL } from 'os'; +import { AbstractGenerator, GeneratorOptions } from './abstract-generator'; +import { existsSync, readFileSync } from 'fs'; + +export class FrontendGenerator extends AbstractGenerator { + + async generate(options?: GeneratorOptions): Promise { + await this.write(this.pck.frontend('index.html'), this.compileIndexHtml(this.pck.targetFrontendModules)); + await this.write(this.pck.frontend('index.js'), this.compileIndexJs(this.pck.targetFrontendModules, this.pck.targetFrontendPreloadModules)); + await this.write(this.pck.frontend('secondary-window.html'), this.compileSecondaryWindowHtml()); + await this.write(this.pck.frontend('secondary-index.js'), this.compileSecondaryIndexJs(this.pck.secondaryWindowModules)); + if (this.pck.isElectron()) { + await this.write(this.pck.frontend('preload.js'), this.compilePreloadJs()); + } + } + + protected compileIndexPreload(frontendModules: Map): string { + const template = this.pck.props.generator.config.preloadTemplate; + if (!template) { + return ''; + } + + // Support path to html file + if (existsSync(template)) { + return readFileSync(template).toString(); + } + + return template; + } + + protected compileIndexHtml(frontendModules: Map): string { + return ` + + +${this.compileIndexHead(frontendModules)} + + + +
${this.compileIndexPreload(frontendModules)}
+ + + +`; + } + + protected compileIndexHead(frontendModules: Map): string { + return ` + + + + ${this.pck.props.frontend.config.applicationName} + `; + } + + protected compileIndexJs(frontendModules: Map, frontendPreloadModules: Map): string { + return `\ +// @ts-check +require('reflect-metadata'); +const { Container } = require('@theia/core/shared/inversify'); +const { FrontendApplicationConfigProvider } = require('@theia/core/lib/browser/frontend-application-config-provider'); + +FrontendApplicationConfigProvider.set(${this.prettyStringify(this.pck.props.frontend.config)}); + +${this.ifMonaco(() => ` +self.MonacoEnvironment = { + getWorkerUrl: function (moduleId, label) { + return './editor.worker.js'; + } +}`)} + +function load(container, jsModule) { + return Promise.resolve(jsModule) + .then(containerModule => container.load(containerModule.default)); +} + +async function preload(container) { + try { +${Array.from(frontendPreloadModules.values(), jsModulePath => `\ + await load(container, ${this.importOrRequire()}('${jsModulePath}'));`).join(EOL)} + const { Preloader } = require('@theia/core/lib/browser/preload/preloader'); + const preloader = container.get(Preloader); + await preloader.initialize(); + } catch (reason) { + console.error('Failed to run preload scripts.'); + if (reason) { + console.error(reason); + } + } +} + +module.exports = (async () => { + const { messagingFrontendModule } = require('@theia/core/lib/${this.pck.isBrowser() || this.pck.isBrowserOnly() + ? 'browser/messaging/messaging-frontend-module' + : 'electron-browser/messaging/electron-messaging-frontend-module'}'); + const container = new Container(); + container.load(messagingFrontendModule); + ${this.ifBrowserOnly(`const { messagingFrontendOnlyModule } = require('@theia/core/lib/browser-only/messaging/messaging-frontend-only-module'); + container.load(messagingFrontendOnlyModule);`)} + + await preload(container); + + ${this.ifMonaco(() => ` + const { MonacoInit } = require('@theia/monaco/lib/browser/monaco-init'); + `)}; + + const { FrontendApplication } = require('@theia/core/lib/browser'); + const { frontendApplicationModule } = require('@theia/core/lib/browser/frontend-application-module'); + const { loggerFrontendModule } = require('@theia/core/lib/browser/logger-frontend-module'); + + container.load(frontendApplicationModule); + ${this.pck.ifBrowserOnly(`const { frontendOnlyApplicationModule } = require('@theia/core/lib/browser-only/frontend-only-application-module'); + container.load(frontendOnlyApplicationModule);`)} + + container.load(loggerFrontendModule); + ${this.ifBrowserOnly(`const { loggerFrontendOnlyModule } = require('@theia/core/lib/browser-only/logger-frontend-only-module'); + container.load(loggerFrontendOnlyModule);`)} + + try { +${Array.from(frontendModules.values(), jsModulePath => `\ + await load(container, ${this.importOrRequire()}('${jsModulePath}'));`).join(EOL)} + ${this.ifMonaco(() => ` + MonacoInit.init(container); + `)}; + await start(); + } catch (reason) { + console.error('Failed to start the frontend application.'); + if (reason) { + console.error(reason); + } + } + + function start() { + (window['theia'] = window['theia'] || {}).container = container; + return container.get(FrontendApplication).start(); + } +})(); +`; + } + + protected importOrRequire(): string { + return this.options.mode !== 'production' ? 'import' : 'require'; + } + + /** HTML for secondary windows that contain an extracted widget. */ + protected compileSecondaryWindowHtml(): string { + return ` + + + + + Theia — Secondary Window + + + + + +
+ + +`; + } + + protected compileSecondaryIndexJs(secondaryWindowModules: Map): string { + return `\ +// @ts-check +require('reflect-metadata'); +const { Container } = require('@theia/core/shared/inversify'); + +module.exports = Promise.resolve().then(() => { + const { frontendApplicationModule } = require('@theia/core/lib/browser/frontend-application-module'); + const container = new Container(); + container.load(frontendApplicationModule); +${Array.from(secondaryWindowModules.values(), jsModulePath => `\ + container.load(require('${jsModulePath}').default);`).join(EOL)} +}); +`; + } + + compilePreloadJs(): string { + return `\ +// @ts-check +${Array.from(this.pck.preloadModules.values(), path => `require('${path}').preload();`).join(EOL)} +`; + } +} diff --git a/dev-packages/application-manager/src/generator/index.ts b/dev-packages/application-manager/src/generator/index.ts new file mode 100644 index 0000000..9d3cac8 --- /dev/null +++ b/dev-packages/application-manager/src/generator/index.ts @@ -0,0 +1,19 @@ +// ***************************************************************************** +// Copyright (C) 2017 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +export * from './webpack-generator'; +export * from './frontend-generator'; +export * from './backend-generator'; diff --git a/dev-packages/application-manager/src/generator/webpack-generator.ts b/dev-packages/application-manager/src/generator/webpack-generator.ts new file mode 100644 index 0000000..f7dda5b --- /dev/null +++ b/dev-packages/application-manager/src/generator/webpack-generator.ts @@ -0,0 +1,529 @@ +// ***************************************************************************** +// Copyright (C) 2017 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import * as paths from 'path'; +import * as fs from 'fs-extra'; +import { AbstractGenerator } from './abstract-generator'; + +export class WebpackGenerator extends AbstractGenerator { + + async generate(): Promise { + await this.write(this.genConfigPath, this.compileWebpackConfig()); + if (!this.pck.isBrowserOnly()) { + await this.write(this.genNodeConfigPath, this.compileNodeWebpackConfig()); + } + if (await this.shouldGenerateUserWebpackConfig()) { + await this.write(this.configPath, this.compileUserWebpackConfig()); + } + } + + protected async shouldGenerateUserWebpackConfig(): Promise { + if (!(await fs.pathExists(this.configPath))) { + return true; + } + const content = await fs.readFile(this.configPath, 'utf8'); + return content.indexOf('gen-webpack') === -1; + } + + get configPath(): string { + return this.pck.path('webpack.config.js'); + } + + get genConfigPath(): string { + return this.pck.path('gen-webpack.config.js'); + } + + get genNodeConfigPath(): string { + return this.pck.path('gen-webpack.node.config.js'); + } + + protected compileWebpackConfig(): string { + return `/** + * Don't touch this file. It will be regenerated by theia build. + * To customize webpack configuration change ${this.configPath} + */ +// @ts-check +const path = require('path'); +const webpack = require('webpack'); +const yargs = require('yargs'); +const resolvePackagePath = require('resolve-package-path'); +const CopyWebpackPlugin = require('copy-webpack-plugin'); +const CompressionPlugin = require('compression-webpack-plugin'); +const MiniCssExtractPlugin = require('mini-css-extract-plugin'); +const { MonacoWebpackPlugin } = require('@theia/native-webpack-plugin/lib/monaco-webpack-plugins.js'); + +const outputPath = path.resolve(__dirname, 'lib', 'frontend'); +const { mode, staticCompression } = yargs.option('mode', { + description: "Mode to use", + choices: ["development", "production"], + default: "production" +}).option('static-compression', { + description: 'Controls whether to enable compression of static artifacts.', + type: 'boolean', + default: true +}).argv; +const development = mode === 'development'; + +const plugins = [ + new CopyWebpackPlugin({ + patterns: [ + { + // copy secondary window html file to lib folder + from: path.resolve(__dirname, 'src-gen/frontend/secondary-window.html') + }${this.ifPackage('@theia/plugin-ext', `, + { + // copy webview files to lib folder + from: path.join(resolvePackagePath('@theia/plugin-ext', __dirname), '..', 'src', 'main', 'browser', 'webview', 'pre'), + to: path.resolve(__dirname, 'lib', 'webview', 'pre') + }`)} + ${this.ifPackage('@theia/plugin-ext-vscode', `, + { + // copy frontend plugin host files + from: path.join(resolvePackagePath('@theia/plugin-ext-vscode', __dirname), '..', 'lib', 'node', 'context', 'plugin-vscode-init-fe.js'), + to: path.resolve(__dirname, 'lib', 'frontend', 'context', 'plugin-vscode-init-fe.js') + }`)} + ] + }), + new webpack.ProvidePlugin({ + // the Buffer class doesn't exist in the browser but some dependencies rely on it + Buffer: ['buffer', 'Buffer'] + }), + new MonacoWebpackPlugin() +]; +// it should go after copy-plugin in order to compress monaco as well +if (staticCompression) { + plugins.push(new CompressionPlugin({})); +} + +module.exports = [{ + mode, + plugins, + devtool: 'source-map', + entry: { + bundle: path.resolve(__dirname, 'src-gen/frontend/index.js'), + ${this.ifMonaco(() => "'editor.worker': '@theia/monaco-editor-core/esm/vs/editor/editor.worker.js'")} + }, + output: { + filename: '[name].js', + path: outputPath, + devtoolModuleFilenameTemplate: 'webpack:///[resource-path]?[loaders]', + globalObject: 'self' + }, + target: 'web', + cache: staticCompression, + module: { + rules: [ + { + test: /\\.css$/, + exclude: /materialcolors\\.css$|\\.useable\\.css$/, + use: ['style-loader', 'css-loader'] + }, + { + test: /materialcolors\\.css$|\\.useable\\.css$/, + use: [ + { + loader: 'style-loader', + options: { + esModule: false, + injectType: 'lazySingletonStyleTag', + attributes: { + id: 'theia-theme' + } + } + }, + 'css-loader' + ] + }, + { + test: /\\.(ttf|eot|svg)(\\?v=\\d+\\.\\d+\\.\\d+)?$/, + type: 'asset', + parser: { + dataUrlCondition: { + maxSize: 10000, + } + }, + generator: { + dataUrl: { + mimetype: 'image/svg+xml' + } + } + }, + { + test: /\\.(jpg|png|gif)$/, + type: 'asset/resource', + generator: { + filename: '[hash].[ext]' + } + }, + { + // see https://github.com/eclipse-theia/theia/issues/556 + test: /source-map-support/, + loader: 'ignore-loader' + }, + { + test: /\\.d\\.ts$/, + loader: 'ignore-loader' + }, + { + test: /\\.js$/, + enforce: 'pre', + loader: 'source-map-loader', + exclude: /jsonc-parser|fast-plist|onigasm/ + }, + { + test: /\\.woff(2)?(\\?v=[0-9]\\.[0-9]\\.[0-9])?$/, + type: 'asset', + parser: { + dataUrlCondition: { + maxSize: 10000, + } + }, + generator: { + dataUrl: { + mimetype: 'image/svg+xml' + } + } + }, + { + test: /node_modules[\\\\|\/](vscode-languageserver-types|vscode-uri|jsonc-parser|vscode-languageserver-protocol)/, + loader: 'umd-compat-loader' + }, + { + test: /\\.wasm$/, + type: 'asset/resource' + }, + { + test: /\\.plist$/, + type: 'asset/resource' + } + ] + }, + resolve: { + fallback: { + 'child_process': false, + 'crypto': false, + 'net': false, + 'path': require.resolve('path-browserify'), + 'process': false, + 'os': false, + 'timers': false + }, + extensions: ['.js'] + }, + stats: { + warnings: true, + children: true + }, + ignoreWarnings: [ + // Some packages do not have source maps, that's ok + /Failed to parse source map/, + { + // Monaco uses 'require' in a non-standard way + module: /@theia\\/monaco-editor-core/, + message: /require function is used in a way in which dependencies cannot be statically extracted/ + } + ] +}, +{ + mode, + plugins: [ + new MiniCssExtractPlugin({ + // Options similar to the same options in webpackOptions.output + // both options are optional + filename: "[name].css", + chunkFilename: "[id].css", + }), + new MonacoWebpackPlugin(), + ], + devtool: 'source-map', + entry: { + "secondary-window": path.resolve(__dirname, 'src-gen/frontend/secondary-index.js'), + }, + output: { + filename: '[name].js', + path: outputPath, + devtoolModuleFilenameTemplate: 'webpack:///[resource-path]?[loaders]', + globalObject: 'self' + }, + target: 'web', + cache: staticCompression, + module: { + rules: [ + { + test: /\.css$/i, + use: [MiniCssExtractPlugin.loader, "css-loader"] + }, + { + test: /\.wasm$/, + type: 'asset/resource' + } + ] + }, + resolve: { + fallback: { + 'child_process': false, + 'crypto': false, + 'net': false, + 'path': require.resolve('path-browserify'), + 'process': false, + 'os': false, + 'timers': false + }, + extensions: ['.js'] + }, + stats: { + warnings: true, + children: true + }, + ignoreWarnings: [ + { + // Monaco uses 'require' in a non-standard way + module: /@theia\\/monaco-editor-core/, + message: /require function is used in a way in which dependencies cannot be statically extracted/ + } + ] +}${this.ifElectron(`, { + mode, + devtool: 'source-map', + entry: { + "preload": path.resolve(__dirname, 'src-gen/frontend/preload.js'), + }, + output: { + filename: '[name].js', + path: outputPath, + devtoolModuleFilenameTemplate: 'webpack:///[resource-path]?[loaders]', + globalObject: 'self' + }, + target: 'electron-preload', + cache: staticCompression, + stats: { + warnings: true, + children: true + } +}`)}];`; + } + + protected compileUserWebpackConfig(): string { + return `/** + * This file can be edited to customize webpack configuration. + * To reset delete this file and rerun theia build again. + */ +// @ts-check +const configs = require('./${paths.basename(this.genConfigPath)}'); +${this.ifBrowserOnly('', `const nodeConfig = require('./${paths.basename(this.genNodeConfigPath)}');`)} + +/** + * Expose bundled modules on window.theia.moduleName namespace, e.g. + * window['theia']['@theia/core/lib/common/uri']. + * Such syntax can be used by external code, for instance, for testing. +configs[0].module.rules.push({ + test: /\\.js$/, + loader: require.resolve('@theia/application-manager/lib/expose-loader') +}); */ + +${this.ifBrowserOnly('module.exports = configs;', `module.exports = [ + ...configs, + nodeConfig.config +];`)} +`; + } + + protected compileNodeWebpackConfig(): string { + return `/** + * Don't touch this file. It will be regenerated by theia build. + * To customize webpack configuration change ${this.configPath} + */ +// @ts-check +const path = require('path'); +const yargs = require('yargs'); +const webpack = require('webpack'); +const TerserPlugin = require('terser-webpack-plugin'); +const NativeWebpackPlugin = require('@theia/native-webpack-plugin'); +const { MonacoWebpackPlugin } = require('@theia/native-webpack-plugin/lib/monaco-webpack-plugins.js'); + +const { mode } = yargs.option('mode', { + description: "Mode to use", + choices: ["development", "production"], + default: "production" +}).argv; + +const production = mode === 'production'; + +/** @type {import('webpack').EntryObject} */ +const commonJsLibraries = {}; +for (const [entryPointName, entryPointPath] of Object.entries({ + ${this.ifPackage('@theia/plugin-ext', "'backend-init-theia': '@theia/plugin-ext/lib/hosted/node/scanners/backend-init-theia',")} + ${this.ifPackage('@theia/filesystem', "'parcel-watcher': '@theia/filesystem/lib/node/parcel-watcher',")} + ${this.ifPackage('@theia/plugin-ext-vscode', "'plugin-vscode-init': '@theia/plugin-ext-vscode/lib/node/plugin-vscode-init',")} + ${this.ifPackage('@theia/api-provider-sample', "'gotd-api-init': '@theia/api-provider-sample/lib/plugin/gotd-api-init',")} + ${this.ifPackage('@theia/git', "'git-locator-host': '@theia/git/lib/node/git-locator/git-locator-host',")} +})) { + commonJsLibraries[entryPointName] = { + import: require.resolve(entryPointPath), + library: { + type: 'commonjs2', + }, + }; +} + +const ignoredResources = new Set(); + +if (process.platform !== 'win32') { + ignoredResources.add('@vscode/windows-ca-certs'); + ignoredResources.add('@vscode/windows-ca-certs/build/Release/crypt32.node'); +} + +const nativePlugin = new NativeWebpackPlugin({ + out: 'native', + trash: ${this.ifPackage('@theia/filesystem', 'true', 'false')}, + ripgrep: ${this.ifPackage(['@theia/search-in-workspace', '@theia/file-search'], 'true', 'false')}, + pty: ${this.ifPackage('@theia/process', 'true', 'false')}, + nativeBindings: { + drivelist: 'drivelist/build/Release/drivelist.node' + } +}); + +${this.ifPackage('@theia/process', () => `// Ensure that node-pty is correctly hoisted +try { + require.resolve('node-pty'); +} catch { + console.error('"node-pty" dependency is not installed correctly. Ensure that it is available in the root node_modules directory.'); + console.error('Exiting webpack build process.'); + process.exit(1); +}`)} + +/** @type {import('webpack').Configuration} */ +const config = { + mode, + devtool: mode === 'development' ? 'source-map' : false, + target: 'node', + node: { + global: false, + __filename: false, + __dirname: false + }, + resolve: { + extensions: ['.js', '.json', '.wasm', '.node'], + }, + output: { + filename: '[name].js', + path: path.resolve(__dirname, 'lib', 'backend'), + devtoolModuleFilenameTemplate: 'webpack:///[absolute-resource-path]?[loaders]', + },${this.ifElectron(` + externals: { + electron: 'require("electron")' + },`)} + entry: { + // Main entry point of the Theia application backend: + 'main': require.resolve('./src-gen/backend/main'), + // Theia's IPC mechanism: + 'ipc-bootstrap': require.resolve('@theia/core/lib/node/messaging/ipc-bootstrap'), + ${this.ifPackage('@theia/plugin-ext', () => `// VS Code extension support: + 'plugin-host': require.resolve('@theia/plugin-ext/lib/hosted/node/plugin-host'),`)} + ${this.ifPackage('@theia/plugin-ext-headless', () => `// Theia Headless Plugin support: + 'plugin-host-headless': require.resolve('@theia/plugin-ext-headless/lib/hosted/node/plugin-host-headless'),`)} + ${this.ifPackage('@theia/process', () => `// Make sure the node-pty thread worker can be executed: + 'worker/conoutSocketWorker': require.resolve('node-pty/lib/worker/conoutSocketWorker'),`)} + ${this.ifElectron("'electron-main': require.resolve('./src-gen/backend/electron-main'),")} + ${this.ifPackage('@theia/dev-container', () => `// VS Code Dev-Container communication: + 'dev-container-server': require.resolve('@theia/dev-container/lib/dev-container-server/dev-container-server'),`)} + ...commonJsLibraries + }, + module: { + rules: [ + // Make sure we can still find and load our native addons. + { + test: /\\.node$/, + loader: 'node-loader', + options: { + name: 'native/[name].[ext]' + } + }, + { + test: /\\.d\\.ts$/, + loader: 'ignore-loader' + }, + { + test: /\\.js$/, + enforce: 'pre', + loader: 'source-map-loader' + }, + // jsonc-parser exposes its UMD implementation by default, which + // confuses Webpack leading to missing js in the bundles. + { + test: /node_modules[\\/](jsonc-parser)/, + loader: 'umd-compat-loader' + } + ] + }, + plugins: [ + // Some native dependencies need special handling + nativePlugin, + // Optional node dependencies can be safely ignored + new webpack.IgnorePlugin({ + checkResource: resource => ignoredResources.has(resource) + }), + new MonacoWebpackPlugin() + ], + optimization: { + // Split and reuse code across the various entry points + splitChunks: { + chunks: 'all' + }, + // Only minimize if we run webpack in production mode + minimize: production, + minimizer: [ + new TerserPlugin({ + exclude: /^(lib|builtins)\\//${this.ifPackage(['@theia/scanoss', '@theia/ai-anthropic', '@theia/ai-openai'], () => `, + terserOptions: { + keep_classnames: /AbortSignal/ + }`)} + }) + ] + }, + ignoreWarnings: [ + // Some packages do not have source maps, that's ok + /Failed to parse source map/, + // require with expressions are not supported + /the request of a dependency is an expression/, + // Some packages use dynamic requires, we can safely ignore them (they are handled by the native webpack plugin) + /require function is used in a way in which dependencies cannot be statically extracted/, { + module: /yargs/ + }, { + module: /node-pty/ + }, { + module: /require-main-filename/ + }, { + module: /ws/ + }, { + module: /express/ + }, { + module: /cross-spawn/ + }, { + module: /@parcel\\/watcher/ + } + ] +}; + +module.exports = { + config, + nativePlugin, + ignoredResources +}; +`; + } + +} diff --git a/dev-packages/application-manager/src/index.ts b/dev-packages/application-manager/src/index.ts new file mode 100644 index 0000000..e46b503 --- /dev/null +++ b/dev-packages/application-manager/src/index.ts @@ -0,0 +1,19 @@ +// ***************************************************************************** +// Copyright (C) 2018 Ericsson and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +export * from './rebuild'; +export * from './application-package-manager'; +export * from './application-process'; diff --git a/dev-packages/application-manager/src/package.spec.ts b/dev-packages/application-manager/src/package.spec.ts new file mode 100644 index 0000000..e77d4fb --- /dev/null +++ b/dev-packages/application-manager/src/package.spec.ts @@ -0,0 +1,28 @@ +// ***************************************************************************** +// Copyright (C) 2018 Ericsson and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +/* note: this bogus test file is required so that + we are able to run mocha unit tests on this + package, without having any actual unit tests in it. + This way a coverage report will be generated, + showing 0% coverage, instead of no report. + This file can be removed once we have real unit + tests in place. */ + +describe('application-manager package', () => { + + it('should support code coverage statistics', () => true); +}); diff --git a/dev-packages/application-manager/src/rebuild.ts b/dev-packages/application-manager/src/rebuild.ts new file mode 100644 index 0000000..5b0e801 --- /dev/null +++ b/dev-packages/application-manager/src/rebuild.ts @@ -0,0 +1,349 @@ +// ***************************************************************************** +// Copyright (C) 2017 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import cp = require('child_process'); +import fs = require('fs-extra'); +import path = require('path'); +import os = require('os'); + +export type RebuildTarget = 'electron' | 'browser' | 'browser-only'; + +const EXIT_SIGNALS: NodeJS.Signals[] = ['SIGINT', 'SIGTERM']; + +interface ExitToken { + getLastSignal(): NodeJS.Signals | undefined + onSignal(callback: (signal: NodeJS.Signals) => void): void +} + +type NodeABI = string | number; + +export const DEFAULT_MODULES = [ + 'node-pty', + 'native-keymap', + 'find-git-repositories', + 'drivelist', + 'keytar', + 'ssh2', + 'cpu-features' +]; + +export interface RebuildOptions { + /** + * What modules to rebuild. + */ + modules?: string[] + /** + * Folder where the module cache will be created/read from. + */ + cacheRoot?: string + /** + * In the event that `node-abi` doesn't recognize the current Electron version, + * you can specify the Node ABI to rebuild for. + */ + forceAbi?: NodeABI +} + +/** + * @param target What to rebuild for. + * @param options + */ +export function rebuild(target: RebuildTarget, options: RebuildOptions = {}): void { + const { + modules = DEFAULT_MODULES, + cacheRoot = process.cwd(), + forceAbi, + } = options; + const cache = path.resolve(cacheRoot, '.browser_modules'); + const cacheExists = folderExists(cache); + guardExit(async token => { + if (target === 'electron' && !cacheExists) { + process.exitCode = await rebuildElectronModules(cache, modules, forceAbi, token); + } else if (target === 'browser' && cacheExists) { + process.exitCode = await revertBrowserModules(cache, modules); + } else { + console.log(`native node modules are already rebuilt for ${target}`); + } + }).catch(errorOrSignal => { + if (typeof errorOrSignal === 'string' && errorOrSignal in os.constants.signals) { + process.kill(process.pid, errorOrSignal); + } else { + throw errorOrSignal; + } + }); +} + +function folderExists(folder: string): boolean { + if (fs.existsSync(folder)) { + if (fs.statSync(folder).isDirectory()) { + return true; + } else { + throw new Error(`"${folder}" exists but it is not a directory`); + } + } + return false; +} + +/** + * Schema for `/modules.json`. + */ +interface ModulesJson { + [moduleName: string]: ModuleBackup +} +interface ModuleBackup { + originalLocation: string +} + +async function rebuildElectronModules(browserModuleCache: string, modules: string[], forceAbi: NodeABI | undefined, token: ExitToken): Promise { + const modulesJsonPath = path.join(browserModuleCache, 'modules.json'); + const modulesJson: ModulesJson = await fs.access(modulesJsonPath).then( + () => fs.readJson(modulesJsonPath), + () => ({}) + ); + let success = true; + // Backup already built browser modules. + await Promise.all(modules.map(async module => { + let modulePath; + try { + modulePath = require.resolve(`${module}/package.json`, { + paths: [process.cwd()], + }); + } catch (_) { + console.debug(`Module not found: ${module}`); + return; // Skip current module. + } + const src = path.dirname(modulePath); + const dest = path.join(browserModuleCache, module); + try { + await fs.remove(dest); + await fs.copy(src, dest, { overwrite: true }); + modulesJson[module] = { + originalLocation: src, + }; + console.debug(`Processed "${module}"`); + } catch (error) { + console.error(`Error while doing a backup for "${module}": ${error}`); + success = false; + } + })); + if (Object.keys(modulesJson).length === 0) { + console.debug('No module to rebuild.'); + return 0; + } + // Update manifest tracking the backups' original locations. + await fs.writeJson(modulesJsonPath, modulesJson, { spaces: 2 }); + // If we failed to process a module then exit now. + if (!success) { + return 1; + } + const todo = modules.map(m => { + // electron-rebuild ignores the module namespace... + const slash = m.indexOf('/'); + return m.startsWith('@') && slash !== -1 + ? m.substring(slash + 1) + : m; + }); + let exitCode: number | undefined; + try { + if (process.env.THEIA_REBUILD_NO_WORKAROUND) { + exitCode = await runElectronRebuild(todo, forceAbi, token); + } else { + exitCode = await electronRebuildExtraModulesWorkaround(process.cwd(), todo, () => runElectronRebuild(todo, forceAbi, token), token); + } + } catch (error) { + console.error(error); + } finally { + // If code is undefined or different from zero we need to revert back to the browser modules. + if (exitCode !== 0) { + await revertBrowserModules(browserModuleCache, modules); + } + return exitCode ?? 1; + } +} + +async function revertBrowserModules(browserModuleCache: string, modules: string[]): Promise { + let exitCode = 0; + const modulesJsonPath = path.join(browserModuleCache, 'modules.json'); + const modulesJson: ModulesJson = await fs.readJson(modulesJsonPath); + await Promise.all(Object.entries(modulesJson).map(async ([moduleName, entry]) => { + if (!modules.includes(moduleName)) { + return; // Skip modules that weren't requested. + } + const src = path.join(browserModuleCache, moduleName); + if (!await fs.pathExists(src)) { + delete modulesJson[moduleName]; + console.error(`Missing backup for ${moduleName}!`); + exitCode = 1; + return; + } + const dest = entry.originalLocation; + try { + await fs.remove(dest); + await fs.copy(src, dest, { overwrite: false }); + await fs.remove(src); + delete modulesJson[moduleName]; + console.debug(`Reverted "${moduleName}"`); + } catch (error) { + console.error(`Error while reverting "${moduleName}": ${error}`); + exitCode = 1; + } + })); + if (Object.keys(modulesJson).length === 0) { + // We restored everything, so we can delete the cache. + await fs.remove(browserModuleCache); + } else { + // Some things were not restored, so we update the manifest. + await fs.writeJson(modulesJsonPath, modulesJson, { spaces: 2 }); + } + return exitCode; +} + +async function runElectronRebuild(modules: string[], forceAbi: NodeABI | undefined, token: ExitToken): Promise { + const todo = modules.join(','); + return new Promise(async (resolve, reject) => { + let command = `npx --no-install electron-rebuild -f -w=${todo} -o=${todo}`; + if (forceAbi) { + command += ` --force-abi ${forceAbi}`; + } + const electronRebuild = cp.spawn(command, { + stdio: 'inherit', + shell: true, + }); + token.onSignal(signal => electronRebuild.kill(signal)); + electronRebuild.on('error', reject); + electronRebuild.on('close', (code, signal) => { + if (signal) { + reject(new Error(`electron-rebuild exited with "${signal}"`)); + } else { + resolve(code!); + } + }); + }); +} + +/** + * `electron-rebuild` is supposed to accept a list of modules to build, even when not part of the dependencies. + * But there is a bug that causes `electron-rebuild` to not correctly process this list of modules. + * + * This workaround will temporarily modify the current package.json file. + * + * PR with fix: https://github.com/electron/electron-rebuild/pull/888 + * + * TODO: Remove this workaround. + */ +async function electronRebuildExtraModulesWorkaround(cwd: string, extraModules: string[], run: (token: ExitToken) => Promise, token: ExitToken): Promise { + const packageJsonPath = path.resolve(cwd, 'package.json'); + if (await fs.pathExists(packageJsonPath)) { + // package.json exists: We back it up before modifying it then revert it. + const packageJsonCopyPath = `${packageJsonPath}.copy`; + const packageJson = await fs.readJson(packageJsonPath); + await fs.copy(packageJsonPath, packageJsonCopyPath); + await throwIfSignal(token, async () => { + await fs.unlink(packageJsonCopyPath); + }); + if (typeof packageJson.dependencies !== 'object') { + packageJson.dependencies = {}; + } + for (const extraModule of extraModules) { + if (!packageJson.dependencies[extraModule]) { + packageJson.dependencies[extraModule] = '*'; + } + } + try { + await fs.writeJson(packageJsonPath, packageJson, { spaces: 2 }); + await throwIfSignal(token); + return await run(token); + } finally { + await fs.move(packageJsonCopyPath, packageJsonPath, { overwrite: true }); + } + } else { + // package.json does not exist: We create one then remove it. + const packageJson = { + name: 'theia-rebuild-workaround', + version: '0.0.0', + dependencies: {} as Record, + }; + for (const extraModule of extraModules) { + packageJson.dependencies[extraModule] = '*'; + } + try { + await fs.writeJson(packageJsonPath, packageJson); + await throwIfSignal(token); + return await run(token); + } finally { + await fs.unlink(packageJsonPath); + } + } +} + +/** + * Temporarily install hooks to **try** to prevent the process from exiting while `run` is running. + * + * Note that it is still possible to kill the process and prevent cleanup logic (e.g. SIGKILL, computer forced shutdown, etc). + */ +async function guardExit(run: (token: ExitToken) => Promise): Promise { + const token = new ExitTokenImpl(); + const signalListener = (signal: NodeJS.Signals) => token._emitSignal(signal); + for (const signal of EXIT_SIGNALS) { + process.on(signal, signalListener); + } + try { + return await run(token); + } finally { + for (const signal of EXIT_SIGNALS) { + // FIXME we have a type clash here between Node, Electron and Mocha. + // Typescript is resolving here to Electron's Process interface which extends the NodeJS.EventEmitter interface + // However instead of the actual NodeJS.EventEmitter interface it resolves to an empty stub of Mocha + // Therefore it can't find the correct "off" signature and throws an error + // By casting to the NodeJS.EventEmitter ourselves, we short circuit the resolving and it succeeds + (process as NodeJS.EventEmitter).off(signal, signalListener); + } + } +} + +class ExitTokenImpl implements ExitToken { + + protected _listeners = new Set<(signal: NodeJS.Signals) => void>(); + protected _lastSignal?: NodeJS.Signals; + + onSignal(callback: (signal: NodeJS.Signals) => void): void { + this._listeners.add(callback); + } + + getLastSignal(): NodeJS.Signals | undefined { + return this._lastSignal; + } + + _emitSignal(signal: NodeJS.Signals): void { + this._lastSignal = signal; + for (const listener of this._listeners) { + listener(signal); + } + } +} + +/** + * Throw `signal` if one was received, runs `cleanup` before doing so. + */ +async function throwIfSignal(token: ExitToken, cleanup?: () => Promise): Promise { + if (token.getLastSignal()) { + try { + await cleanup?.(); + } finally { + // eslint-disable-next-line no-throw-literal + throw token.getLastSignal()!; + } + } +} diff --git a/dev-packages/application-manager/tsconfig.json b/dev-packages/application-manager/tsconfig.json new file mode 100644 index 0000000..bff525f --- /dev/null +++ b/dev-packages/application-manager/tsconfig.json @@ -0,0 +1,22 @@ +{ + "extends": "../../configs/base.tsconfig", + "compilerOptions": { + "composite": true, + "rootDir": "src", + "outDir": "lib" + }, + "include": [ + "src" + ], + "references": [ + { + "path": "../application-package" + }, + { + "path": "../ffmpeg" + }, + { + "path": "../native-webpack-plugin" + } + ] +} diff --git a/dev-packages/application-package/.eslintrc.js b/dev-packages/application-package/.eslintrc.js new file mode 100644 index 0000000..1308994 --- /dev/null +++ b/dev-packages/application-package/.eslintrc.js @@ -0,0 +1,10 @@ +/** @type {import('eslint').Linter.Config} */ +module.exports = { + extends: [ + '../../configs/build.eslintrc.json' + ], + parserOptions: { + tsconfigRootDir: __dirname, + project: 'tsconfig.json' + } +}; diff --git a/dev-packages/application-package/README.md b/dev-packages/application-package/README.md new file mode 100644 index 0000000..6290023 --- /dev/null +++ b/dev-packages/application-package/README.md @@ -0,0 +1,26 @@ +
+ +
+ +theia-ext-logo + +

ECLIPSE THEIA - APPLICATION-PACKAGE

+ +
+ +
+ +## Additional Information + +- [Theia - GitHub](https://github.com/eclipse-theia/theia) +- [Theia - Website](https://theia-ide.org/) + +## License + +- [Eclipse Public License 2.0](http://www.eclipse.org/legal/epl-2.0/) +- [一 (Secondary) GNU General Public License, version 2 with the GNU Classpath Exception](https://projects.eclipse.org/license/secondary-gpl-2.0-cp) + +## Trademark + +"Theia" is a trademark of the Eclipse Foundation + diff --git a/dev-packages/application-package/package.json b/dev-packages/application-package/package.json new file mode 100644 index 0000000..0ae6541 --- /dev/null +++ b/dev-packages/application-package/package.json @@ -0,0 +1,52 @@ +{ + "name": "@theia/application-package", + "version": "1.68.0", + "description": "Theia application package API.", + "publishConfig": { + "access": "public" + }, + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "repository": { + "type": "git", + "url": "https://github.com/eclipse-theia/theia.git" + }, + "bugs": { + "url": "https://github.com/eclipse-theia/theia/issues" + }, + "homepage": "https://github.com/eclipse-theia/theia", + "files": [ + "lib", + "src" + ], + "main": "lib/index.js", + "typings": "lib/index.d.ts", + "scripts": { + "build": "theiaext build", + "clean": "theiaext clean", + "compile": "theiaext compile", + "lint": "theiaext lint", + "test": "theiaext test", + "watch": "theiaext watch" + }, + "dependencies": { + "@theia/request": "1.68.0", + "@types/fs-extra": "^4.0.2", + "@types/semver": "^7.5.0", + "@types/write-json-file": "^2.2.1", + "deepmerge": "^4.2.2", + "fs-extra": "^4.0.2", + "is-electron": "^2.1.0", + "nano": "^10.1.3", + "resolve-package-path": "^4.0.3", + "semver": "^7.5.4", + "tslib": "^2.6.2", + "write-json-file": "^2.2.0" + }, + "devDependencies": { + "@theia/ext-scripts": "1.68.0" + }, + "nyc": { + "extends": "../../configs/nyc.json" + }, + "gitHead": "21358137e41342742707f660b8e222f940a27652" +} diff --git a/dev-packages/application-package/src/api.ts b/dev-packages/application-package/src/api.ts new file mode 100644 index 0000000..8ef356c --- /dev/null +++ b/dev-packages/application-package/src/api.ts @@ -0,0 +1,21 @@ +// ***************************************************************************** +// Copyright (C) 2021 Ericsson and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +/** + * The default supported API version the framework supports. + * The version should be in the format `x.y.z`. + */ +export const DEFAULT_SUPPORTED_API_VERSION = '1.108.0'; diff --git a/dev-packages/application-package/src/application-package.spec.ts b/dev-packages/application-package/src/application-package.spec.ts new file mode 100644 index 0000000..4167f83 --- /dev/null +++ b/dev-packages/application-package/src/application-package.spec.ts @@ -0,0 +1,62 @@ +// ***************************************************************************** +// Copyright (C) 2020 Maksim Ryzhikov and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import * as assert from 'assert'; +import * as temp from 'temp'; +import * as fs from 'fs-extra'; +import * as path from 'path'; +import { ApplicationPackage } from './application-package'; +import { ApplicationProps } from './application-props'; +import * as sinon from 'sinon'; + +const track = temp.track(); +const sandbox = sinon.createSandbox(); + +describe('application-package', function (): void { + after((): void => { + sandbox.restore(); + track.cleanupSync(); + }); + + it('should print warning if user set unknown target in package.json and use browser as a default value', function (): void { + const warn = sandbox.stub(console, 'warn'); + const root = createProjectWithTarget('foo'); + const applicationPackage = new ApplicationPackage({ projectPath: root }); + assert.deepStrictEqual(applicationPackage.target, ApplicationProps.ApplicationTarget.browser); + assert.deepStrictEqual(warn.called, true); + }); + + it('should set target from package.json', function (): void { + const target = 'electron'; + const root = createProjectWithTarget(target); + const applicationPackage = new ApplicationPackage({ projectPath: root }); + assert.deepStrictEqual(applicationPackage.target, target); + }); + + it('should prefer target from passed options over target from package.json', function (): void { + const pckTarget = 'electron'; + const optTarget = 'browser'; + const root = createProjectWithTarget(pckTarget); + const applicationPackage = new ApplicationPackage({ projectPath: root, appTarget: optTarget }); + assert.deepStrictEqual(applicationPackage.target, optTarget); + }); + + function createProjectWithTarget(target: string): string { + const root = track.mkdirSync('foo-project'); + fs.writeFileSync(path.join(root, 'package.json'), `{"theia": {"target": "${target}"}}`); + return root; + } +}); diff --git a/dev-packages/application-package/src/application-package.ts b/dev-packages/application-package/src/application-package.ts new file mode 100644 index 0000000..803c65a --- /dev/null +++ b/dev-packages/application-package/src/application-package.ts @@ -0,0 +1,328 @@ +// ***************************************************************************** +// Copyright (C) 2017 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import * as paths from 'path'; +import { readJsonFile, writeJsonFile } from './json-file'; +import { NpmRegistry, NodePackage, PublishedNodePackage, sortByKey } from './npm-registry'; +import { Extension, ExtensionPackage, ExtensionPackageOptions, RawExtensionPackage } from './extension-package'; +import { ExtensionPackageCollector } from './extension-package-collector'; +import { ApplicationProps } from './application-props'; +import deepmerge = require('deepmerge'); +import resolvePackagePath = require('resolve-package-path'); + +// eslint-disable-next-line @typescript-eslint/no-explicit-any +export type ApplicationLog = (message?: any, ...optionalParams: any[]) => void; +export class ApplicationPackageOptions { + readonly projectPath: string; + readonly log?: ApplicationLog; + readonly error?: ApplicationLog; + readonly registry?: NpmRegistry; + readonly appTarget?: ApplicationProps.Target; +} + +export type ApplicationModuleResolver = (parentPackagePath: string, modulePath: string) => string; + +export class ApplicationPackage { + readonly projectPath: string; + readonly log: ApplicationLog; + readonly error: ApplicationLog; + + constructor( + protected readonly options: ApplicationPackageOptions + ) { + this.projectPath = options.projectPath; + this.log = options.log || console.log.bind(console); + this.error = options.error || console.error.bind(console); + } + + protected _registry: NpmRegistry | undefined; + get registry(): NpmRegistry { + if (this._registry) { + return this._registry; + } + this._registry = this.options.registry || new NpmRegistry(); + this._registry.updateProps(this.props); + return this._registry; + } + + get target(): ApplicationProps.Target { + return this.props.target; + } + + protected _props: ApplicationProps | undefined; + get props(): ApplicationProps { + if (this._props) { + return this._props; + } + const theia = this.pck.theia || {}; + + if (this.options.appTarget) { + theia.target = this.options.appTarget; + } + + if (theia.target && !(Object.values(ApplicationProps.ApplicationTarget).includes(theia.target))) { + const defaultTarget = ApplicationProps.ApplicationTarget.browser; + console.warn(`Unknown application target '${theia.target}', '${defaultTarget}' to be used instead`); + theia.target = defaultTarget; + } + + return this._props = deepmerge(ApplicationProps.DEFAULT, theia); + } + + protected _pck: NodePackage | undefined; + get pck(): NodePackage { + if (this._pck) { + return this._pck; + } + return this._pck = readJsonFile(this.packagePath); + } + + protected _frontendModules: Map | undefined; + protected _frontendPreloadModules: Map | undefined; + protected _frontendElectronModules: Map | undefined; + protected _secondaryWindowModules: Map | undefined; + protected _backendModules: Map | undefined; + protected _backendElectronModules: Map | undefined; + protected _electronMainModules: Map | undefined; + protected _preloadModules: Map | undefined; + protected _extensionPackages: ReadonlyArray | undefined; + + /** + * Extension packages in the topological order. + */ + get extensionPackages(): ReadonlyArray { + if (!this._extensionPackages) { + const collector = new ExtensionPackageCollector( + (raw: PublishedNodePackage, options: ExtensionPackageOptions = {}) => this.newExtensionPackage(raw, options), + this.resolveModule + ); + this._extensionPackages = collector.collect(this.packagePath, this.pck); + } + return this._extensionPackages; + } + + getExtensionPackage(extension: string): ExtensionPackage | undefined { + return this.extensionPackages.find(pck => pck.name === extension); + } + + async findExtensionPackage(extension: string): Promise { + return this.getExtensionPackage(extension) || this.resolveExtensionPackage(extension); + } + + /** + * Resolve an extension name to its associated package + * @param extension the name of the extension's package as defined in "dependencies" (might be aliased) + * @returns the extension package + */ + async resolveExtensionPackage(extension: string): Promise { + const raw = await RawExtensionPackage.view(this.registry, extension); + return raw ? this.newExtensionPackage(raw, { alias: extension }) : undefined; + } + + protected newExtensionPackage(raw: PublishedNodePackage, options: ExtensionPackageOptions = {}): ExtensionPackage { + return new ExtensionPackage(raw, this.registry, options); + } + + get frontendPreloadModules(): Map { + return this._frontendPreloadModules ??= this.computeModules('frontendPreload'); + } + + get frontendOnlyPreloadModules(): Map { + if (!this._frontendPreloadModules) { + this._frontendPreloadModules = this.computeModules('frontendOnlyPreload', 'frontendPreload'); + } + return this._frontendPreloadModules; + } + + get frontendModules(): Map { + return this._frontendModules ??= this.computeModules('frontend'); + } + + get frontendOnlyModules(): Map { + if (!this._frontendModules) { + this._frontendModules = this.computeModules('frontendOnly', 'frontend'); + } + return this._frontendModules; + } + + get frontendElectronModules(): Map { + return this._frontendElectronModules ??= this.computeModules('frontendElectron', 'frontend'); + } + + get secondaryWindowModules(): Map { + return this._secondaryWindowModules ??= this.computeModules('secondaryWindow'); + } + + get backendModules(): Map { + return this._backendModules ??= this.computeModules('backend'); + } + + get backendElectronModules(): Map { + return this._backendElectronModules ??= this.computeModules('backendElectron', 'backend'); + } + + get electronMainModules(): Map { + return this._electronMainModules ??= this.computeModules('electronMain'); + } + + get preloadModules(): Map { + return this._preloadModules ??= this.computeModules('preload'); + } + + protected computeModules

(primary: P, secondary?: S): Map { + const result = new Map(); + let moduleIndex = 1; + for (const extensionPackage of this.extensionPackages) { + const extensions = extensionPackage.theiaExtensions; + if (extensions) { + for (const extension of extensions) { + const modulePath = extension[primary] || (secondary && extension[secondary]); + if (typeof modulePath === 'string') { + const extensionPath = paths.join(extensionPackage.name, modulePath).split(paths.sep).join('/'); + result.set(`${primary}_${moduleIndex}`, extensionPath); + moduleIndex = moduleIndex + 1; + } + } + } + } + return result; + } + + relative(path: string): string { + return paths.relative(this.projectPath, path); + } + + path(...segments: string[]): string { + return paths.resolve(this.projectPath, ...segments); + } + + get packagePath(): string { + return this.path('package.json'); + } + + lib(...segments: string[]): string { + return this.path('lib', ...segments); + } + + srcGen(...segments: string[]): string { + return this.path('src-gen', ...segments); + } + + backend(...segments: string[]): string { + return this.srcGen('backend', ...segments); + } + + bundledBackend(...segments: string[]): string { + return this.path('backend', 'bundle', ...segments); + } + + frontend(...segments: string[]): string { + return this.srcGen('frontend', ...segments); + } + + isBrowser(): boolean { + return this.target === ApplicationProps.ApplicationTarget.browser; + } + + isElectron(): boolean { + return this.target === ApplicationProps.ApplicationTarget.electron; + } + + isBrowserOnly(): boolean { + return this.target === ApplicationProps.ApplicationTarget.browserOnly; + } + + ifBrowser(value: T): T | undefined; + ifBrowser(value: T, defaultValue: T): T; + ifBrowser(value: T, defaultValue?: T): T | undefined { + return this.isBrowser() ? value : defaultValue; + } + + ifElectron(value: T): T | undefined; + ifElectron(value: T, defaultValue: T): T; + ifElectron(value: T, defaultValue?: T): T | undefined { + return this.isElectron() ? value : defaultValue; + } + + ifBrowserOnly(value: T): T | undefined; + ifBrowserOnly(value: T, defaultValue: T): T; + ifBrowserOnly(value: T, defaultValue?: T): T | undefined { + return this.isBrowserOnly() ? value : defaultValue; + } + + get targetBackendModules(): Map { + if (this.isBrowserOnly()) { + return new Map(); + } + return this.ifBrowser(this.backendModules, this.backendElectronModules); + } + + get targetFrontendModules(): Map { + if (this.isBrowserOnly()) { + return this.frontendOnlyModules; + } + return this.ifBrowser(this.frontendModules, this.frontendElectronModules); + } + + get targetFrontendPreloadModules(): Map { + if (this.isBrowserOnly()) { + return this.frontendOnlyPreloadModules; + } + return this.frontendPreloadModules; + } + + get targetElectronMainModules(): Map { + return this.ifElectron(this.electronMainModules, new Map()); + } + + setDependency(name: string, version: string | undefined): boolean { + const dependencies = this.pck.dependencies || {}; + const currentVersion = dependencies[name]; + if (currentVersion === version) { + return false; + } + if (version) { + dependencies[name] = version; + } else { + delete dependencies[name]; + } + this.pck.dependencies = sortByKey(dependencies); + return true; + } + + save(): Promise { + return writeJsonFile(this.packagePath, this.pck, { + detectIndent: true + }); + } + + protected _moduleResolver: undefined | ApplicationModuleResolver; + /** + * A node module resolver in the context of the application package. + */ + get resolveModule(): ApplicationModuleResolver { + if (!this._moduleResolver) { + this._moduleResolver = (parentPackagePath, modulePath) => { + const resolved = resolvePackagePath(modulePath, parentPackagePath); + if (!resolved) { + throw new Error(`Cannot resolve package ${modulePath} relative to ${parentPackagePath}`); + } + return resolved; + }; + } + return this._moduleResolver!; + } +} diff --git a/dev-packages/application-package/src/application-props.ts b/dev-packages/application-package/src/application-props.ts new file mode 100644 index 0000000..d1b9a97 --- /dev/null +++ b/dev-packages/application-package/src/application-props.ts @@ -0,0 +1,314 @@ +// ***************************************************************************** +// Copyright (C) 2018 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import type { BrowserWindowConstructorOptions } from 'electron'; +export import deepmerge = require('deepmerge'); + +export type RequiredRecursive = { + [K in keyof T]-?: T[K] extends object ? RequiredRecursive : T[K] +}; + +/** + * Base configuration for the Theia application. + */ +export interface ApplicationConfig { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + readonly [key: string]: any; +} + +export type ElectronFrontendApplicationConfig = RequiredRecursive; +export namespace ElectronFrontendApplicationConfig { + export const DEFAULT: ElectronFrontendApplicationConfig = { + windowOptions: {}, + showWindowEarly: true, + splashScreenOptions: {}, + uriScheme: 'theia' + }; + export interface SplashScreenOptions { + /** + * Initial width of the splash screen. Defaults to 640. + */ + width?: number; + /** + * Initial height of the splash screen. Defaults to 480. + */ + height?: number; + /** + * Minimum amount of time in milliseconds to show the splash screen before main window is shown. + * Defaults to 0, i.e. the splash screen will be shown until the frontend application is ready. + */ + minDuration?: number; + /** + * Maximum amount of time in milliseconds before splash screen is removed and main window is shown. + * Defaults to 30000. + */ + maxDuration?: number; + /** + * The content to load in the splash screen. + * Will be resolved from application root. + * + * Mandatory attribute. + */ + content?: string; + } + export interface Partial { + + /** + * Override or add properties to the electron `windowOptions`. + * + * Defaults to `{}`. + */ + readonly windowOptions?: BrowserWindowConstructorOptions; + + /** + * Whether or not to show an empty Electron window as early as possible. + * + * Defaults to `true`. + */ + readonly showWindowEarly?: boolean; + + /** + * Configuration options for splash screen. + * + * Defaults to `{}` which results in no splash screen being displayed. + */ + readonly splashScreenOptions?: SplashScreenOptions; + + /** + * The custom uri scheme the application registers to in the operating system. + */ + readonly uriScheme: string; + } +} + +export type DefaultTheme = string | Readonly<{ light: string, dark: string }>; +export namespace DefaultTheme { + export function defaultForOSTheme(theme: DefaultTheme): string { + if (typeof theme === 'string') { + return theme; + } + if ( + typeof window !== 'undefined' && + window.matchMedia && + window.matchMedia('(prefers-color-scheme: dark)').matches + ) { + return theme.dark; + } + return theme.light; + } + export function defaultBackgroundColor(dark?: boolean): string { + // The default light background color is based on the `colors#editor.background` value from + // `packages/monaco/data/monaco-themes/vscode/dark_vs.json` and the dark background comes from the `light_vs.json`. + return dark ? '#1E1E1E' : '#FFFFFF'; + } +} + +/** + * Application configuration for the frontend. The following properties will be injected into the `index.html`. + */ +export type FrontendApplicationConfig = RequiredRecursive; +export namespace FrontendApplicationConfig { + export const DEFAULT: FrontendApplicationConfig = { + applicationName: 'Eclipse Theia', + defaultTheme: { light: 'light', dark: 'dark' }, + defaultIconTheme: 'theia-file-icons', + electron: ElectronFrontendApplicationConfig.DEFAULT, + defaultLocale: '', + validatePreferencesSchema: true, + reloadOnReconnect: false, + uriScheme: 'theia' + }; + export interface Partial extends ApplicationConfig { + + /** + * The default theme for the application. + * + * Defaults to `dark` if the OS's theme is dark. Otherwise `light`. + */ + readonly defaultTheme?: DefaultTheme; + + /** + * The default icon theme for the application. + * + * Defaults to `none`. + */ + readonly defaultIconTheme?: string; + + /** + * The name of the application. + * + * Defaults to `Eclipse Theia`. + */ + readonly applicationName?: string; + + /** + * Electron specific configuration. + * + * Defaults to `ElectronFrontendApplicationConfig.DEFAULT`. + */ + readonly electron?: ElectronFrontendApplicationConfig.Partial; + + /** + * The default locale for the application. + * + * Defaults to "". + */ + readonly defaultLocale?: string; + + /** + * When `true`, the application will validate the JSON schema of the preferences on start + * and log warnings to the console if the schema is not valid. + * + * Defaults to `true`. + */ + readonly validatePreferencesSchema?: boolean; + + /** + * When 'true', the window will reload in case the front end reconnects to a back-end, + * but the back end does not have a connection context for this front end anymore. + */ + readonly reloadOnReconnect?: boolean; + } +} + +/** + * Application configuration for the backend. + */ +export type BackendApplicationConfig = RequiredRecursive; +export namespace BackendApplicationConfig { + export const DEFAULT: BackendApplicationConfig = { + singleInstance: true, + frontendConnectionTimeout: 0, + configurationFolder: '.theia' + }; + export interface Partial extends ApplicationConfig { + + /** + * If true and in Electron mode, only one instance of the application is allowed to run at a time. + * + * Defaults to `false`. + */ + readonly singleInstance?: boolean; + + /** + * The time in ms the connection context will be preserved for reconnection after a front end disconnects. + */ + readonly frontendConnectionTimeout?: number; + + /** + * Configuration folder within the home user folder + * + * Defaults to `.theia` + */ + readonly configurationFolder?: string; + } +} + +/** + * Configuration for the generator. + */ +export type GeneratorConfig = RequiredRecursive; +export namespace GeneratorConfig { + export const DEFAULT: GeneratorConfig = { + preloadTemplate: '' + }; + export interface Partial { + + /** + * Template to use for extra preload content markup (file path or HTML). + * + * Defaults to `''`. + */ + readonly preloadTemplate?: string; + } +} + +export interface NpmRegistryProps { + + /** + * Defaults to `false`. + */ + readonly next: boolean; + + /** + * Defaults to `https://registry.npmjs.org/`. + */ + readonly registry: string; + +} +export namespace NpmRegistryProps { + export const DEFAULT: NpmRegistryProps = { + next: false, + registry: 'https://registry.npmjs.org/' + }; +} + +/** + * Representation of all backend and frontend related Theia extension and application properties. + */ +export interface ApplicationProps extends NpmRegistryProps { + + // eslint-disable-next-line @typescript-eslint/no-explicit-any + readonly [key: string]: any; + + /** + * Whether the extension targets the browser or electron. Defaults to `browser`. + */ + readonly target: ApplicationProps.Target; + + /** + * Frontend related properties. + */ + readonly frontend: { + readonly config: FrontendApplicationConfig + }; + + /** + * Backend specific properties. + */ + readonly backend: { + readonly config: BackendApplicationConfig + }; + + /** + * Generator specific properties. + */ + readonly generator: { + readonly config: GeneratorConfig + }; +} +export namespace ApplicationProps { + export type Target = `${ApplicationTarget}`; + export enum ApplicationTarget { + browser = 'browser', + electron = 'electron', + browserOnly = 'browser-only' + }; + export const DEFAULT: ApplicationProps = { + ...NpmRegistryProps.DEFAULT, + target: 'browser', + backend: { + config: BackendApplicationConfig.DEFAULT + }, + frontend: { + config: FrontendApplicationConfig.DEFAULT + }, + generator: { + config: GeneratorConfig.DEFAULT + } + }; + +} diff --git a/dev-packages/application-package/src/environment.ts b/dev-packages/application-package/src/environment.ts new file mode 100644 index 0000000..e12ae3d --- /dev/null +++ b/dev-packages/application-package/src/environment.ts @@ -0,0 +1,76 @@ +// ***************************************************************************** +// Copyright (C) 2018 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +const isElectron: () => boolean = require('is-electron'); + +/** + * The electron specific environment. + */ +class ElectronEnv { + + /** + * Environment variable that can be accessed on the `process` to check if running in electron or not. + */ + readonly THEIA_ELECTRON_VERSION = 'THEIA_ELECTRON_VERSION'; + + /** + * `true` if running in electron. Otherwise, `false`. + * + * Can be called from both the `main` and the render process. Also works for forked cluster workers. + */ + is(): boolean { + return isElectron(); + } + + /** + * `true` if running in Electron in development mode. Otherwise, `false`. + * + * Cannot be used from the browser. From the browser, it is always `false`. + */ + isDevMode(): boolean { + return this.is() + && typeof process !== 'undefined' + // `defaultApp` does not exist on the Node.js API, but on electron (`electron.d.ts`). + && ((process as any).defaultApp || /node_modules[/\\]electron[/\\]/.test(process.execPath)); // eslint-disable-line @typescript-eslint/no-explicit-any + } + + /** + * Creates and return with a new environment object which always contains the `ELECTRON_RUN_AS_NODE: 1` property pair. + * This should be used to `spawn` and `fork` a new Node.js process from the Node.js shipped with Electron. Otherwise, a new Electron + * process will be spawned which [has side-effects](https://github.com/eclipse-theia/theia/issues/5385). + * + * If called from the backend and the `env` argument is not defined, it falls back to `process.env` such as Node.js behaves + * with the [`SpawnOptions`](https://nodejs.org/api/child_process.html#child_process_child_process_spawn_command_args_options). + * If `env` is defined, it will be shallow-copied. + * + * Calling this function from the frontend does not make any sense, hence throw an error. + */ + // eslint-disable-next-line @typescript-eslint/no-explicit-any + runAsNodeEnv(env?: any): any & { ELECTRON_RUN_AS_NODE: 1 } { + if (typeof process === 'undefined') { + throw new Error("'process' cannot be undefined."); + } + return { + ...(env === undefined ? process.env : env), + ELECTRON_RUN_AS_NODE: 1 + }; + } + +} + +const electron = new ElectronEnv(); +const environment: Readonly<{ electron: ElectronEnv }> = { electron }; +export { environment }; diff --git a/dev-packages/application-package/src/extension-package-collector.ts b/dev-packages/application-package/src/extension-package-collector.ts new file mode 100644 index 0000000..fd76526 --- /dev/null +++ b/dev-packages/application-package/src/extension-package-collector.ts @@ -0,0 +1,88 @@ +// ***************************************************************************** +// Copyright (C) 2017 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { readJsonFile } from './json-file'; +import { NodePackage, PublishedNodePackage } from './npm-registry'; +import { ExtensionPackage, ExtensionPackageOptions, RawExtensionPackage } from './extension-package'; + +export class ExtensionPackageCollector { + + protected readonly sorted: ExtensionPackage[] = []; + protected readonly visited = new Set(); + + constructor( + protected readonly extensionPackageFactory: (raw: PublishedNodePackage, options?: ExtensionPackageOptions) => ExtensionPackage, + protected readonly resolveModule: (packagepath: string, modulePath: string) => string + ) { } + + protected root: NodePackage; + collect(packagePath: string, pck: NodePackage): ReadonlyArray { + this.root = pck; + this.collectPackages(packagePath, pck); + return this.sorted; + } + + protected collectPackages(packagePath: string, pck: NodePackage): void { + for (const [dependency, versionRange] of [ + ...Object.entries(pck.dependencies ?? {}), + ...Object.entries(pck.peerDependencies ?? {}) + ]) { + const optional = pck.peerDependenciesMeta?.[dependency]?.optional || false; + this.collectPackage(packagePath, dependency, versionRange!, optional); + } + } + + protected parent: ExtensionPackage | undefined; + protected collectPackagesWithParent(packagePath: string, pck: NodePackage, parent: ExtensionPackage): void { + const current = this.parent; + this.parent = parent; + this.collectPackages(packagePath, pck); + this.parent = current; + } + + protected collectPackage(parentPackagePath: string, name: string, versionRange: string, optional: boolean): void { + if (this.visited.has(name)) { + return; + } + this.visited.add(name); + + let packagePath: string | undefined; + try { + packagePath = this.resolveModule(parentPackagePath, name); + } catch (err) { + if (optional) { + console.log(`Could not resolve optional peer dependency '${name}'. Skipping...`); + } else { + console.error(err.message); + } + } + if (!packagePath) { + return; + } + const pck: NodePackage = readJsonFile(packagePath); + if (RawExtensionPackage.is(pck)) { + const parent = this.parent; + const version = pck.version; + const transitive = !(name in this.root.dependencies!); + pck.installed = { packagePath, version, parent, transitive }; + pck.version = versionRange; + const extensionPackage = this.extensionPackageFactory(pck, { alias: name }); + this.collectPackagesWithParent(packagePath, pck, extensionPackage); + this.sorted.push(extensionPackage); + } + } + +} diff --git a/dev-packages/application-package/src/extension-package.ts b/dev-packages/application-package/src/extension-package.ts new file mode 100644 index 0000000..dced483 --- /dev/null +++ b/dev-packages/application-package/src/extension-package.ts @@ -0,0 +1,223 @@ +// ***************************************************************************** +// Copyright (C) 2017 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import * as fs from 'fs-extra'; +import * as paths from 'path'; +import * as semver from 'semver'; +import { NpmRegistry, PublishedNodePackage, NodePackage } from './npm-registry'; + +export interface Extension { + frontendPreload?: string; + frontendOnlyPreload?: string; + frontend?: string; + frontendOnly?: string; + frontendElectron?: string; + secondaryWindow?: string; + backend?: string; + backendElectron?: string; + electronMain?: string; + preload?: string; +} + +export interface ExtensionPackageOptions { + /** + * Alias to use in place of the original package's name. + */ + alias?: string +} + +export class ExtensionPackage { + + protected _name: string; + + constructor( + readonly raw: PublishedNodePackage & Partial, + protected readonly registry: NpmRegistry, + options: ExtensionPackageOptions = {} + ) { + this._name = options.alias ?? raw.name; + } + + /** + * The name of the extension's package as defined in "dependencies" (might be aliased) + */ + get name(): string { + return this._name; + } + + get version(): string { + if (this.raw.installed) { + return this.raw.installed.version; + } + if (this.raw.view) { + const latestVersion = this.raw.view.latestVersion; + if (latestVersion) { + return latestVersion; + } + } + return this.raw.version; + } + + get description(): string { + return this.raw.description || ''; + } + + get theiaExtensions(): Extension[] { + return this.raw.theiaExtensions || []; + } + + get installed(): boolean { + return !!this.raw.installed; + } + + get dependent(): string | undefined { + if (!this.transitive) { + return undefined; + } + let current = this.parent!; + let parent = current.parent; + while (parent !== undefined) { + current = parent; + parent = current.parent; + } + return current.name; + } + + get transitive(): boolean { + return !!this.raw.installed && this.raw.installed.transitive; + } + + get parent(): ExtensionPackage | undefined { + if (this.raw.installed) { + return this.raw.installed.parent; + } + return undefined; + } + + protected async view(): Promise { + if (this.raw.view === undefined) { + const raw = await RawExtensionPackage.view(this.registry, this.name, this.version); + this.raw.view = raw ? raw.view : new RawExtensionPackage.ViewState(this.registry); + } + return this.raw.view!; + } + + protected readme?: string; + async getReadme(): Promise { + if (this.readme === undefined) { + this.readme = await this.resolveReadme(); + } + return this.readme; + } + protected async resolveReadme(): Promise { + const raw = await this.view(); + if (raw && raw.readme) { + return raw.readme; + } + if (this.raw.installed) { + const readmePath = paths.resolve(this.raw.installed.packagePath, '..', 'README.md'); + if (await fs.pathExists(readmePath)) { + return fs.readFile(readmePath, { encoding: 'utf8' }); + } + return ''; + } + return ''; + } + + getAuthor(): string { + if (this.raw.publisher) { + return this.raw.publisher.username; + } + if (typeof this.raw.author === 'string') { + return this.raw.author; + } + if (this.raw.author && this.raw.author.name) { + return this.raw.author.name; + } + if (!!this.raw.maintainers && this.raw.maintainers.length > 0) { + return this.raw.maintainers[0].username; + } + return ''; + } + +} + +export interface RawExtensionPackage extends PublishedNodePackage { + installed?: RawExtensionPackage.InstalledState + view?: RawExtensionPackage.ViewState + theiaExtensions: Extension[]; +} +export namespace RawExtensionPackage { + export interface InstalledState { + version: string; + packagePath: string; + transitive: boolean; + parent?: ExtensionPackage; + } + export class ViewState { + readme?: string; + tags?: { + [tag: string]: string + }; + constructor( + protected readonly registry: NpmRegistry + ) { } + get latestVersion(): string | undefined { + if (this.tags) { + if (this.registry.props.next) { + const next = this.tags['next']; + if (next !== undefined) { + return next; + } + } + const latest = this.tags['latest']; + if (this.registry.props.next || !semver.prerelease(latest)) { + return latest; + } + return undefined; + } + return undefined; + } + } + export function is(pck: NodePackage | undefined): pck is RawExtensionPackage { + return PublishedNodePackage.is(pck) && !!pck.theiaExtensions; + } + export async function view(registry: NpmRegistry, name: string, version?: string): Promise { + const result = await registry.view(name).catch(() => undefined); + if (!result) { + return undefined; + } + const tags = result['dist-tags']; + const versions = [tags['latest']]; + if (registry.props.next) { + versions.push(tags['next']); + } + if (version) { + versions.push(tags[version], version); + } + for (const current of versions.reverse()) { + const raw = result.versions[current]; + if (is(raw)) { + const viewState = new ViewState(registry); + viewState.readme = result.readme; + viewState.tags = tags; + raw.view = viewState; + return raw; + } + } + return undefined; + } +} diff --git a/dev-packages/application-package/src/index.ts b/dev-packages/application-package/src/index.ts new file mode 100644 index 0000000..ade5cc6 --- /dev/null +++ b/dev-packages/application-package/src/index.ts @@ -0,0 +1,22 @@ +// ***************************************************************************** +// Copyright (C) 2017 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +export * from './npm-registry'; +export * from './extension-package'; +export * from './application-package'; +export * from './application-props'; +export * from './environment'; +export * from './api'; diff --git a/dev-packages/application-package/src/json-file.ts b/dev-packages/application-package/src/json-file.ts new file mode 100644 index 0000000..e9080f5 --- /dev/null +++ b/dev-packages/application-package/src/json-file.ts @@ -0,0 +1,25 @@ +// ***************************************************************************** +// Copyright (C) 2017 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import * as fs from 'fs'; +import writeJsonFile = require('write-json-file'); + +// eslint-disable-next-line @typescript-eslint/no-explicit-any +function readJsonFile(path: string): any { + return JSON.parse(fs.readFileSync(path, { encoding: 'utf-8' })); +} + +export { writeJsonFile, readJsonFile }; diff --git a/dev-packages/application-package/src/npm-registry.ts b/dev-packages/application-package/src/npm-registry.ts new file mode 100644 index 0000000..3ad470e --- /dev/null +++ b/dev-packages/application-package/src/npm-registry.ts @@ -0,0 +1,166 @@ +// ***************************************************************************** +// Copyright (C) 2017 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +/* eslint-disable @typescript-eslint/no-explicit-any */ +import * as nano from 'nano'; +import { RequestContext } from '@theia/request'; +import { NodeRequestService } from '@theia/request/lib/node-request-service'; +import { NpmRegistryProps } from './application-props'; + +export interface IChangeStream { + on(event: 'data', cb: (change: { id: string }) => void): void; + destroy(): void; +} + +export interface Author { + name: string; + email: string; +} + +export interface Maintainer { + username: string; + email: string; +} + +export interface Dependencies { + [name: string]: string | undefined; +} + +export interface PeerDependenciesMeta { + [name: string]: { optional: boolean } | undefined; +} + +export interface NodePackage { + name?: string; + version?: string; + description?: string; + publisher?: Maintainer; + author?: string | Author; + maintainers?: Maintainer[]; + keywords?: string[]; + dependencies?: Dependencies; + peerDependencies?: Dependencies; + peerDependenciesMeta?: PeerDependenciesMeta; + [property: string]: any; +} + +export interface PublishedNodePackage extends NodePackage { + name: string; + version: string; +} +export namespace PublishedNodePackage { + export function is(pck: NodePackage | undefined): pck is PublishedNodePackage { + return !!pck && !!pck.name && !!pck.version; + } +} + +export interface ViewResult { + 'dist-tags': { + [tag: string]: string + } + 'versions': { + [version: string]: NodePackage + }, + 'readme': string; + [key: string]: any +} + +export function sortByKey(object: { [key: string]: any }): { + [key: string]: any; +} { + return Object.keys(object).sort().reduce((sorted, key) => { + sorted[key] = object[key]; + return sorted; + }, {} as { [key: string]: any }); +} + +export class NpmRegistryOptions { + /** + * Default: false. + */ + readonly watchChanges: boolean; +} + +export class NpmRegistry { + + readonly props: NpmRegistryProps = { ...NpmRegistryProps.DEFAULT }; + protected readonly options: NpmRegistryOptions; + + protected changes?: nano.ChangesReaderScope; + protected readonly index = new Map>(); + + protected request: NodeRequestService; + + constructor(options?: Partial) { + this.options = { + watchChanges: false, + ...options + }; + this.resetIndex(); + this.request = new NodeRequestService(); + } + + updateProps(props?: Partial): void { + const oldRegistry = this.props.registry; + Object.assign(this.props, props); + const newRegistry = this.props.registry; + if (oldRegistry !== newRegistry) { + this.resetIndex(); + } + } + protected resetIndex(): void { + this.index.clear(); + if (this.options.watchChanges && this.props.registry === NpmRegistryProps.DEFAULT.registry) { + if (this.changes) { + this.changes.stop(); + } + // Invalidate index with NPM registry web hooks + this.changes = nano('https://replicate.npmjs.com').use('registry').changesReader; + this.changes.get({}).on('change', change => this.invalidate(change.id)); + } + } + protected invalidate(name: string): void { + if (this.index.delete(name)) { + this.view(name); + } + } + + view(name: string): Promise { + const indexed = this.index.get(name); + if (indexed) { + return indexed; + } + const result = this.doView(name); + this.index.set(name, result); + result.catch(() => this.index.delete(name)); + return result; + } + + protected async doView(name: string): Promise { + let url = this.props.registry; + if (name[0] === '@') { + url += '@' + encodeURIComponent(name.substring(1)); + } else { + url += encodeURIComponent(name); + } + const response = await this.request.request({ url }); + if (response.res.statusCode !== 200) { + throw new Error(`HTTP ${response.res.statusCode}: for ${url}`); + } + return RequestContext.asJson(response); + } + +} diff --git a/dev-packages/application-package/tsconfig.json b/dev-packages/application-package/tsconfig.json new file mode 100644 index 0000000..1699f09 --- /dev/null +++ b/dev-packages/application-package/tsconfig.json @@ -0,0 +1,16 @@ +{ + "extends": "../../configs/base.tsconfig", + "compilerOptions": { + "composite": true, + "rootDir": "src", + "outDir": "lib" + }, + "include": [ + "src" + ], + "references": [ + { + "path": "../request" + } + ] +} diff --git a/dev-packages/cli/.eslintrc.js b/dev-packages/cli/.eslintrc.js new file mode 100644 index 0000000..1d7d77d --- /dev/null +++ b/dev-packages/cli/.eslintrc.js @@ -0,0 +1,13 @@ +/** @type {import('eslint').Linter.Config} */ +module.exports = { + extends: [ + '../../configs/build.eslintrc.json' + ], + parserOptions: { + tsconfigRootDir: __dirname, + project: 'tsconfig.json' + }, + rules: { + 'import/no-dynamic-require': 'off' + } +}; diff --git a/dev-packages/cli/README.md b/dev-packages/cli/README.md new file mode 100644 index 0000000..c2637ad --- /dev/null +++ b/dev-packages/cli/README.md @@ -0,0 +1,370 @@ +

+ +
+ +theia-ext-logo + +

ECLIPSE THEIA - CLI

+ +
+ +
+ +## Outline + +- [Outline](#outline) +- [Description](#description) +- [Getting Started](#getting-started) +- [Configure](#configure) + - [Application Properties](#application-properties) + - [Default Preferences](#default-preferences) + - [Default Theme](#default-theme) + - [Build Target](#build-target) + - [Electron Frontend Application Config](#electron-frontend-application-config) + - [Using Latest Builds](#using-latest-builds) +- [Building](#building) + - [Build](#build) + - [Watch](#watch) + - [Clean](#clean) +- [Rebuilding Native Modules](#rebuilding-native-modules) +- [Running](#running) +- [Debugging](#debugging) +- [Testing](#testing) + - [Enabling Tests](#enabling-tests) + - [Writing Tests](#writing-tests) + - [Running Tests](#running-tests) + - [Configuring Tests](#configuring-tests) + - [Inspecting Tests](#inspecting-tests) + - [Reporting Test Coverage](#reporting-test-coverage) +- [Downloading Plugins](#downloading-plugins) +- [Autogenerated Application](#autogenerated-application) +- [Additional Information](#additional-information) +- [License](#license) +- [Trademark](#trademark) + +## Description + +The `@theia/cli` package provides helpful scripts and commands for extension and application development. +The contributed `theia`, is a command line tool to manage Theia-based applications. + +## Getting Started + +Install `@theia/cli` as a dev dependency in your application. + +With yarn: + +```bash +yarn add @theia/cli@next --dev +``` + +With npm: + +```bash +npm install @theia/cli@next --save-dev +``` + +## Configure + +A Theia-based application can be configured via the `theia` property as described in the application's `package.json`. + +### Application Properties + +It is possible `Application Properties` for a given application.\ +For example, an application can define it's `applicationName` using the following syntax: + +```json +"theia": { + "frontend": { + "config": { + "applicationName": "Custom Application Name", + } + } + }, +``` + +### Default Preferences + +If required, an application can define for a given preference, the default value. +For example, an application can update the preference value for `files.enableTrash` based on it's requirements: + +```json + +"theia": { + "frontend": { + "config": { + "preferences": { + "files.enableTrash": false + } + } + } + }, +``` + +### Default Theme + +Default color and icon themes can be configured in `theia.frontend.config` section: + +```json +"theia": { + "frontend": { + "config": { + "defaultTheme": "light", + "defaultIconTheme": "vs-seti" + } + } + }, +``` + +### Build Target + +The following targets are supported: `browser` and `electron`. By default `browser` target is used. +The target can be configured in the `package.json` via `theia/target` property, e.g: + +```json +{ + "theia": { + "target": "electron" + }, + "dependencies": { + "@theia/electron": "latest" + } +} +``` + +For `electron` target applications, is it mandatory to include **Electron** runtime dependencies. The `@theia/electron` package is the easiest way to install the necessary dependencies. + +### Electron Frontend Application Config + +The `electron` frontend application configuration provides configuration options for the `electron` target.\ +The currently supported configurations are: + +- `disallowReloadKeybinding`: if set to `true`, reloading the current browser window won't be possible with the Ctrl/Cmd + r keybinding. It is `false` by default. Has no effect if not in an electron environment. +- `windowOptions`: override or add properties to the electron `windowOptions`. + +```json +{ + "theia": { + "target": "electron", + "frontend": { + "config": { + "electron": { + "disallowReloadKeybinding": true, + "windowOptions": { + "titleBarStyle": "hidden", + "webPreferences": { + "webSecurity": false, + "nodeIntegration": true, + "webviewTag": true + } + } + } + } + } + } +} +``` + +### Using Latest Builds + +If you set `next` in your theia config, then Theia will prefer `next` over `latest` as the latest tag. + +```json +{ + "theia": { + "next": "true" + } +} +``` + +## Building + +### Build + +The following command can be used to build the application: + +**Development** + + theia build --mode development + +**Production** + + theia build + +### Watch + +The following command can be used to rebuild the application on each change: + + theia build --watch --mode development + +### Clean + +The following command can be used to clean up the build result: + +In order to clean up the build result: + + theia clean + +Arguments are passed directly to [webpack](https://webpack.js.org/). Use `--help` to learn which options are supported. + +## Rebuilding Native Modules + +In order to run Electron targets, one should rebuild native node modules for an electron version: + + theia rebuild + +To rollback native modules, change the target to `browser` and run the command again. + +## Running + +To run the backend server: + + theia start + +For the browser target a server is started on by default. +For the electron target a server is started on `localhost` host with the dynamically allocated port by default. + +Arguments are passed directly to a server, use `--help` to learn which options are supported. + +## Debugging + +To debug the backend server: + + theia start --inspect + +Theia CLI accepts `--inspect` node flag: . + +## Testing + +### Enabling Tests + +First enable `expose-loader` in `webpack.config.js` +to expose modules from bundled code to tests +by un-commenting: + +```js +/** + * Expose bundled modules on window.theia.moduleName namespace, e.g. + * window['theia']['@theia/core/lib/common/uri']. + * Such syntax can be used by external code, for instance, for testing. +config.module.rules.push({ + test: /\.js$/, + loader: require.resolve('@theia/application-manager/lib/expose-loader') +}); */ +``` + +After that run `theia build` again to expose modules in generated bundle files. + +### Writing Tests + +See [API Integration Testing](../../doc/api-testing.md) docs. + +### Running Tests + +To start the backend server and run API tests against it: + + theia test + +After running test this command terminates. It accepts the same arguments as `start` command, +but as well additional arguments to specify test files, enable inspection or generate test coverage. + +### Configuring Tests + +To specify test files: + + theia test . --test-spec=./test/*.spec.js --plugins=./plugins + +This command starts the application with a current directory as a workspace, +load VS Code extensions from `./plugins` +and run test files matching `./test/*.spec.js` glob. + +Use `theia test --help` to learn more options. Test specific options start with `--test-`. + +### Inspecting Tests + +To inspect tests: + + theia test . --test-spec=./test/*.spec.js --test-inspect --inspect + +This command starts the application server in the debug mode +as well as open the Chrome devtools to debug frontend code and test files. +One can reload/rerun code and tests by simply reloading the page. + +> Important! Since tests are relying on focus, while running tests keep the page focused. + +### Reporting Test Coverage + +To report test coverage: + + theia test . --test-spec=./test/*.spec.js --test-coverage + +This command executes tests and generate test coverage files consumable by [Istanbul](https://github.com/istanbuljs/istanbuljs). + +## Downloading Plugins + +The `@theia/cli` package provides a utility for applications to define and download a list of plugins it requires as part of their application using the command: + + theia download:plugins + +This utility works by declaring in the `package.json` a location to store downloaded plugins, as well as defining each plugin the application wishes to download. + +The property `theiaPluginsDir` describes the location of which to download plugins (relative to the `package.json`), for example: + +```json +"theiaPluginsDir": "plugins", +``` + +The property `theiaPlugins` describes the list of plugins to download, for example: + +```json +"theiaPlugins": { + "vscode.theme-defaults": "https://open-vsx.org/api/vscode/theme-defaults/1.62.3/file/vscode.theme-defaults-1.62.3.vsix", + "vscode-builtin-extension-pack": "https://open-vsx.org/api/eclipse-theia/builtin-extension-pack/1.50.0/file/eclipse-theia.builtin-extension-pack-1.50.0.vsix", + "vscode-editorconfig": "https://open-vsx.org/api/EditorConfig/EditorConfig/0.14.4/file/EditorConfig.EditorConfig-0.14.4.vsix", + "vscode-eslint": "https://open-vsx.org/api/dbaeumer/vscode-eslint/2.1.1/file/dbaeumer.vscode-eslint-2.1.1.vsix", + "rust-analyzer": "https://open-vsx.org/api/rust-lang/rust-analyzer/${targetPlatform}/0.4.1473/file/rust-lang.rust-analyzer-0.4.1473@${targetPlatform}.vsix" +} +``` + +As seen in the `rust-analyzer` entry we can use placeholders in the URLs. Supported placeholders are: + +- The `${targetPlatform}` Placeholder, which resolves to a string like `win32-x64` describing the local system and architecture. This is useful for adding non-universal plugins. + +Please note that in order to use `extensionPacks` properly you should use `namespace.name` as the `id` you give extensions so that when resolving the pack we do not re-download an existing plugin under a different name. + +The property `theiaPluginsExcludeIds` can be used to declare the list of plugin `ids` to exclude when using extension-packs. +The `ids` referenced by the property will not be downloaded when resolving extension-packs, and can be used to omit extensions which are problematic or unwanted. The format of the property is as follows: + +```json +"theiaPluginsExcludeIds": [ + "vscode.cpp" +] +``` + +## Autogenerated Application + +This package can auto-generate application code for both the backend and frontend, as well as webpack configuration files. + +When targeting Electron, the `electron-main.js` script will spawn the backend process in a Node.js sub-process, where Electron's API won't be available. To prevent the generated application from forking the backend, you can pass a `--no-cluster` flag. This flag is mostly useful/used for debugging. + +```sh +# when developing a Theia application with @theia/cli: +yarn theia start --no-cluster + +# when starting a bundled application made using @theia/cli: +bundled-application.exe --no-cluster +``` + +## Additional Information + +- [Theia - GitHub](https://github.com/eclipse-theia/theia) +- [Theia - Website](https://theia-ide.org/) + +## License + +- [Eclipse Public License 2.0](http://www.eclipse.org/legal/epl-2.0/) +- [一 (Secondary) GNU General Public License, version 2 with the GNU Classpath Exception](https://projects.eclipse.org/license/secondary-gpl-2.0-cp) + +## Trademark + +"Theia" is a trademark of the Eclipse Foundation + diff --git a/dev-packages/cli/bin/theia-patch.js b/dev-packages/cli/bin/theia-patch.js new file mode 100755 index 0000000..a6a511f --- /dev/null +++ b/dev-packages/cli/bin/theia-patch.js @@ -0,0 +1,37 @@ +#!/usr/bin/env node + +// ***************************************************************************** +// Copyright (C) 2024 STMicroelectronics and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** +// @ts-check +const path = require('path'); +const cp = require('child_process'); + +const patchPackage = require.resolve('patch-package'); +console.log(`patch-package = ${patchPackage}`); + +const patchesDir = path.join('.', 'node_modules', '@theia', 'cli', 'patches'); + +console.log(`patchesdir = ${patchesDir}`); + +const env = Object.assign({}, process.env); + +const scriptProcess = cp.exec(`node "${patchPackage}" --patch-dir "${patchesDir}"`, { + cwd: process.cwd(), + env +}); + +scriptProcess.stdout.pipe(process.stdout); +scriptProcess.stderr.pipe(process.stderr); diff --git a/dev-packages/cli/bin/theia.js b/dev-packages/cli/bin/theia.js new file mode 100755 index 0000000..d8487b1 --- /dev/null +++ b/dev-packages/cli/bin/theia.js @@ -0,0 +1,2 @@ +#!/usr/bin/env node +require('../lib/theia') diff --git a/dev-packages/cli/package.json b/dev-packages/cli/package.json new file mode 100644 index 0000000..1a9e5a9 --- /dev/null +++ b/dev-packages/cli/package.json @@ -0,0 +1,68 @@ +{ + "name": "@theia/cli", + "version": "1.68.0", + "description": "Theia CLI.", + "publishConfig": { + "access": "public" + }, + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "repository": { + "type": "git", + "url": "https://github.com/eclipse-theia/theia.git" + }, + "bugs": { + "url": "https://github.com/eclipse-theia/theia/issues" + }, + "homepage": "https://github.com/eclipse-theia/theia", + "files": [ + "bin", + "lib", + "src", + "patches" + ], + "bin": { + "theia": "./bin/theia.js", + "theia-patch": "./bin/theia-patch.js" + }, + "scripts": { + "compile": "theiaext compile", + "lint": "theiaext lint", + "build": "theiaext build", + "watch": "theiaext watch", + "clean": "theiaext clean" + }, + "dependencies": { + "@theia/application-manager": "1.68.0", + "@theia/application-package": "1.68.0", + "@theia/ffmpeg": "1.68.0", + "@theia/localization-manager": "1.68.0", + "@theia/ovsx-client": "1.68.0", + "@theia/request": "1.68.0", + "@types/chai": "^4.2.7", + "@types/mocha": "^10.0.0", + "@types/node-fetch": "^2.5.7", + "chai": "^4.3.10", + "chalk": "4.0.0", + "decompress": "^4.2.1", + "escape-string-regexp": "4.0.0", + "glob": "^8.0.3", + "http-server": "^14.1.1", + "limiter": "^2.1.0", + "log-update": "^4.0.0", + "mocha": "^10.1.0", + "patch-package": "^8.0.0", + "puppeteer": "23.1.0", + "puppeteer-core": "23.1.0", + "puppeteer-to-istanbul": "1.4.0", + "temp": "^0.9.1", + "tslib": "^2.6.2", + "yargs": "^15.3.1" + }, + "devDependencies": { + "@types/chai": "^4.2.7", + "@types/mocha": "^10.0.0", + "@types/node-fetch": "^2.5.7", + "@types/proxy-from-env": "^1.0.1" + }, + "gitHead": "21358137e41342742707f660b8e222f940a27652" +} diff --git a/dev-packages/cli/patches/@lumino+widgets+2.7.2.patch b/dev-packages/cli/patches/@lumino+widgets+2.7.2.patch new file mode 100644 index 0000000..38537a8 --- /dev/null +++ b/dev-packages/cli/patches/@lumino+widgets+2.7.2.patch @@ -0,0 +1,449 @@ +diff --git a/node_modules/@lumino/widgets/dist/index.es6.js b/node_modules/@lumino/widgets/dist/index.es6.js +index 06ceb12..e965707 100644 +--- a/node_modules/@lumino/widgets/dist/index.es6.js ++++ b/node_modules/@lumino/widgets/dist/index.es6.js +@@ -6552,28 +6552,28 @@ class Menu extends Widget { + } + } + /** +- * A message handler invoked on a `'before-attach'` message. ++ * A message handler invoked on a `'after-attach'` message. + */ +- onBeforeAttach(msg) { ++ onAfterAttach(msg) { + this.node.addEventListener('keydown', this); + this.node.addEventListener('mouseup', this); + this.node.addEventListener('mousemove', this); + this.node.addEventListener('mouseenter', this); + this.node.addEventListener('mouseleave', this); + this.node.addEventListener('contextmenu', this); +- document.addEventListener('mousedown', this, true); ++ this.node.ownerDocument.addEventListener('mousedown', this, true); + } + /** +- * A message handler invoked on an `'after-detach'` message. ++ * A message handler invoked on an `'before-detach'` message. + */ +- onAfterDetach(msg) { ++ onBeforeDetach(msg) { + this.node.removeEventListener('keydown', this); + this.node.removeEventListener('mouseup', this); + this.node.removeEventListener('mousemove', this); + this.node.removeEventListener('mouseenter', this); + this.node.removeEventListener('mouseleave', this); + this.node.removeEventListener('contextmenu', this); +- document.removeEventListener('mousedown', this, true); ++ this.node.ownerDocument.removeEventListener('mousedown', this, true); + } + /** + * A message handler invoked on an `'activate-request'` message. +@@ -7157,15 +7157,8 @@ var Private$9; + * The horizontal pixel overlap for an open submenu. + */ + Private.SUBMENU_OVERLAP = 3; +- let transientWindowDataCache = null; +- let transientCacheCounter = 0; +- function getWindowData() { +- // if transient cache is in use, take one from it +- if (transientCacheCounter > 0) { +- transientCacheCounter--; +- return transientWindowDataCache; +- } +- return _getWindowData(); ++ function getWindowData(element) { ++ return _getWindowData(element); + } + /** + * Store window data in transient cache. +@@ -7177,8 +7170,6 @@ var Private$9; + * Note: should be called before any DOM modifications. + */ + function saveWindowData() { +- transientWindowDataCache = _getWindowData(); +- transientCacheCounter++; + } + Private.saveWindowData = saveWindowData; + /** +@@ -7273,12 +7264,13 @@ var Private$9; + return result; + } + Private.computeCollapsed = computeCollapsed; +- function _getWindowData() { ++ function _getWindowData(element) { ++ var _a, _b; + return { +- pageXOffset: window.pageXOffset, +- pageYOffset: window.pageYOffset, +- clientWidth: document.documentElement.clientWidth, +- clientHeight: document.documentElement.clientHeight ++ pageXOffset: ((_a = element.ownerDocument.defaultView) === null || _a === void 0 ? void 0 : _a.window.scrollX) || 0, ++ pageYOffset: ((_b = element.ownerDocument.defaultView) === null || _b === void 0 ? void 0 : _b.window.scrollY) || 0, ++ clientWidth: element.ownerDocument.documentElement.clientWidth, ++ clientHeight: element.ownerDocument.documentElement.clientHeight + }; + } + /** +@@ -7286,7 +7278,7 @@ var Private$9; + */ + function openRootMenu(menu, x, y, forceX, forceY, horizontalAlignment, host, ref) { + // Get the current position and size of the main viewport. +- const windowData = getWindowData(); ++ const windowData = getWindowData(host || menu.node); + let px = windowData.pageXOffset; + let py = windowData.pageYOffset; + let cw = windowData.clientWidth; +@@ -7298,6 +7290,8 @@ var Private$9; + // Fetch common variables. + let node = menu.node; + let style = node.style; ++ style.top = '0'; ++ style.left = '0'; + // Clear the menu geometry and prepare it for measuring. + style.opacity = '0'; + style.maxHeight = `${maxHeight}px`; +@@ -7333,7 +7327,7 @@ var Private$9; + */ + function openSubmenu(submenu, itemNode) { + // Get the current position and size of the main viewport. +- const windowData = getWindowData(); ++ const windowData = getWindowData(itemNode); + let px = windowData.pageXOffset; + let py = windowData.pageYOffset; + let cw = windowData.clientWidth; +@@ -7349,7 +7343,7 @@ var Private$9; + style.opacity = '0'; + style.maxHeight = `${maxHeight}px`; + // Attach the menu to the document. +- Widget.attach(submenu, document.body); ++ Widget.attach(submenu, itemNode.ownerDocument.body); + // Measure the size of the menu. + let { width, height } = node.getBoundingClientRect(); + // Compute the box sizing for the menu. +@@ -7368,6 +7362,8 @@ var Private$9; + if (y + height > py + ch) { + y = itemRect.bottom + box.borderBottom + box.paddingBottom - height; + } ++ style.top = '0'; ++ style.left = '0'; + // Update the position of the menu to the computed position. + style.transform = `translate(${Math.max(0, x)}px, ${Math.max(0, y)}px`; + // Finally, make the menu visible on the screen. +diff --git a/node_modules/@lumino/widgets/dist/index.es6.js.map b/node_modules/@lumino/widgets/dist/index.es6.js.map +index cc17c25..26f94d7 100644 +--- a/node_modules/@lumino/widgets/dist/index.es6.js.map ++++ b/node_modules/@lumino/widgets/dist/index.es6.js.map +@@ -1 +1 @@ +-{"version":3,"file":"index.es6.js","sources":["../src/boxengine.ts","../src/title.ts","../src/widget.ts","../src/layout.ts","../src/panellayout.ts","../src/utils.ts","../src/splitlayout.ts","../src/accordionlayout.ts","../src/panel.ts","../src/splitpanel.ts","../src/accordionpanel.ts","../src/boxlayout.ts","../src/boxpanel.ts","../src/commandpalette.ts","../src/menu.ts","../src/contextmenu.ts","../src/tabbar.ts","../src/docklayout.ts","../src/dockpanel.ts","../src/focustracker.ts","../src/gridlayout.ts","../src/menubar.ts","../src/scrollbar.ts","../src/singletonlayout.ts","../src/stackedlayout.ts","../src/stackedpanel.ts","../src/tabpanel.ts"],"sourcesContent":["// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n\n/**\n * A sizer object for use with the box engine layout functions.\n *\n * #### Notes\n * A box sizer holds the geometry information for an object along an\n * arbitrary layout orientation.\n *\n * For best performance, this class should be treated as a raw data\n * struct. It should not typically be subclassed.\n */\nexport class BoxSizer {\n /**\n * The preferred size for the sizer.\n *\n * #### Notes\n * The sizer will be given this initial size subject to its size\n * bounds. The sizer will not deviate from this size unless such\n * deviation is required to fit into the available layout space.\n *\n * There is no limit to this value, but it will be clamped to the\n * bounds defined by {@link minSize} and {@link maxSize}.\n *\n * The default value is `0`.\n */\n sizeHint = 0;\n\n /**\n * The minimum size of the sizer.\n *\n * #### Notes\n * The sizer will never be sized less than this value, even if\n * it means the sizer will overflow the available layout space.\n *\n * It is assumed that this value lies in the range `[0, Infinity)`\n * and that it is `<=` to {@link maxSize}. Failure to adhere to this\n * constraint will yield undefined results.\n *\n * The default value is `0`.\n */\n minSize = 0;\n\n /**\n * The maximum size of the sizer.\n *\n * #### Notes\n * The sizer will never be sized greater than this value, even if\n * it means the sizer will underflow the available layout space.\n *\n * It is assumed that this value lies in the range `[0, Infinity]`\n * and that it is `>=` to {@link minSize}. Failure to adhere to this\n * constraint will yield undefined results.\n *\n * The default value is `Infinity`.\n */\n maxSize = Infinity;\n\n /**\n * The stretch factor for the sizer.\n *\n * #### Notes\n * This controls how much the sizer stretches relative to its sibling\n * sizers when layout space is distributed. A stretch factor of zero\n * is special and will cause the sizer to only be resized after all\n * other sizers with a stretch factor greater than zero have been\n * resized to their limits.\n *\n * It is assumed that this value is an integer that lies in the range\n * `[0, Infinity)`. Failure to adhere to this constraint will yield\n * undefined results.\n *\n * The default value is `1`.\n */\n stretch = 1;\n\n /**\n * The computed size of the sizer.\n *\n * #### Notes\n * This value is the output of a call to {@link BoxEngine.calc}. It represents\n * the computed size for the object along the layout orientation,\n * and will always lie in the range `[minSize, maxSize]`.\n *\n * This value is output only.\n *\n * Changing this value will have no effect.\n */\n size = 0;\n\n /**\n * An internal storage property for the layout algorithm.\n *\n * #### Notes\n * This value is used as temporary storage by the layout algorithm.\n *\n * Changing this value will have no effect.\n */\n done = false;\n}\n\n/**\n * The namespace for the box engine layout functions.\n */\nexport namespace BoxEngine {\n /**\n * Calculate the optimal layout sizes for a sequence of box sizers.\n *\n * This distributes the available layout space among the box sizers\n * according to the following algorithm:\n *\n * 1. Initialize the sizers's size to its size hint and compute the\n * sums for each of size hint, min size, and max size.\n *\n * 2. If the total size hint equals the available space, return.\n *\n * 3. If the available space is less than the total min size, set all\n * sizers to their min size and return.\n *\n * 4. If the available space is greater than the total max size, set\n * all sizers to their max size and return.\n *\n * 5. If the layout space is less than the total size hint, distribute\n * the negative delta as follows:\n *\n * a. Shrink each sizer with a stretch factor greater than zero by\n * an amount proportional to the negative space and the sum of\n * stretch factors. If the sizer reaches its min size, remove\n * it and its stretch factor from the computation.\n *\n * b. If after adjusting all stretch sizers there remains negative\n * space, distribute the space equally among the sizers with a\n * stretch factor of zero. If a sizer reaches its min size,\n * remove it from the computation.\n *\n * 6. If the layout space is greater than the total size hint,\n * distribute the positive delta as follows:\n *\n * a. Expand each sizer with a stretch factor greater than zero by\n * an amount proportional to the postive space and the sum of\n * stretch factors. If the sizer reaches its max size, remove\n * it and its stretch factor from the computation.\n *\n * b. If after adjusting all stretch sizers there remains positive\n * space, distribute the space equally among the sizers with a\n * stretch factor of zero. If a sizer reaches its max size,\n * remove it from the computation.\n *\n * 7. return\n *\n * @param sizers - The sizers for a particular layout line.\n *\n * @param space - The available layout space for the sizers.\n *\n * @returns The delta between the provided available space and the\n * actual consumed space. This value will be zero if the sizers\n * can be adjusted to fit, negative if the available space is too\n * small, and positive if the available space is too large.\n *\n * #### Notes\n * The {@link BoxSizer.size} of each sizer is updated with the computed size.\n *\n * This function can be called at any time to recompute the layout for\n * an existing sequence of sizers. The previously computed results will\n * have no effect on the new output. It is therefore not necessary to\n * create new sizer objects on each resize event.\n */\n export function calc(sizers: ArrayLike, space: number): number {\n // Bail early if there is nothing to do.\n let count = sizers.length;\n if (count === 0) {\n return space;\n }\n\n // Setup the size and stretch counters.\n let totalMin = 0;\n let totalMax = 0;\n let totalSize = 0;\n let totalStretch = 0;\n let stretchCount = 0;\n\n // Setup the sizers and compute the totals.\n for (let i = 0; i < count; ++i) {\n let sizer = sizers[i];\n let min = sizer.minSize;\n let max = sizer.maxSize;\n let hint = sizer.sizeHint;\n sizer.done = false;\n sizer.size = Math.max(min, Math.min(hint, max));\n totalSize += sizer.size;\n totalMin += min;\n totalMax += max;\n if (sizer.stretch > 0) {\n totalStretch += sizer.stretch;\n stretchCount++;\n }\n }\n\n // If the space is equal to the total size, return early.\n if (space === totalSize) {\n return 0;\n }\n\n // If the space is less than the total min, minimize each sizer.\n if (space <= totalMin) {\n for (let i = 0; i < count; ++i) {\n let sizer = sizers[i];\n sizer.size = sizer.minSize;\n }\n return space - totalMin;\n }\n\n // If the space is greater than the total max, maximize each sizer.\n if (space >= totalMax) {\n for (let i = 0; i < count; ++i) {\n let sizer = sizers[i];\n sizer.size = sizer.maxSize;\n }\n return space - totalMax;\n }\n\n // The loops below perform sub-pixel precision sizing. A near zero\n // value is used for compares instead of zero to ensure that the\n // loop terminates when the subdivided space is reasonably small.\n let nearZero = 0.01;\n\n // A counter which is decremented each time a sizer is resized to\n // its limit. This ensures the loops terminate even if there is\n // space remaining to distribute.\n let notDoneCount = count;\n\n // Distribute negative delta space.\n if (space < totalSize) {\n // Shrink each stretchable sizer by an amount proportional to its\n // stretch factor. If a sizer reaches its min size it's marked as\n // done. The loop progresses in phases where each sizer is given\n // a chance to consume its fair share for the pass, regardless of\n // whether a sizer before it reached its limit. This continues\n // until the stretchable sizers or the free space is exhausted.\n let freeSpace = totalSize - space;\n while (stretchCount > 0 && freeSpace > nearZero) {\n let distSpace = freeSpace;\n let distStretch = totalStretch;\n for (let i = 0; i < count; ++i) {\n let sizer = sizers[i];\n if (sizer.done || sizer.stretch === 0) {\n continue;\n }\n let amt = (sizer.stretch * distSpace) / distStretch;\n if (sizer.size - amt <= sizer.minSize) {\n freeSpace -= sizer.size - sizer.minSize;\n totalStretch -= sizer.stretch;\n sizer.size = sizer.minSize;\n sizer.done = true;\n notDoneCount--;\n stretchCount--;\n } else {\n freeSpace -= amt;\n sizer.size -= amt;\n }\n }\n }\n // Distribute any remaining space evenly among the non-stretchable\n // sizers. This progresses in phases in the same manner as above.\n while (notDoneCount > 0 && freeSpace > nearZero) {\n let amt = freeSpace / notDoneCount;\n for (let i = 0; i < count; ++i) {\n let sizer = sizers[i];\n if (sizer.done) {\n continue;\n }\n if (sizer.size - amt <= sizer.minSize) {\n freeSpace -= sizer.size - sizer.minSize;\n sizer.size = sizer.minSize;\n sizer.done = true;\n notDoneCount--;\n } else {\n freeSpace -= amt;\n sizer.size -= amt;\n }\n }\n }\n }\n // Distribute positive delta space.\n else {\n // Expand each stretchable sizer by an amount proportional to its\n // stretch factor. If a sizer reaches its max size it's marked as\n // done. The loop progresses in phases where each sizer is given\n // a chance to consume its fair share for the pass, regardless of\n // whether a sizer before it reached its limit. This continues\n // until the stretchable sizers or the free space is exhausted.\n let freeSpace = space - totalSize;\n while (stretchCount > 0 && freeSpace > nearZero) {\n let distSpace = freeSpace;\n let distStretch = totalStretch;\n for (let i = 0; i < count; ++i) {\n let sizer = sizers[i];\n if (sizer.done || sizer.stretch === 0) {\n continue;\n }\n let amt = (sizer.stretch * distSpace) / distStretch;\n if (sizer.size + amt >= sizer.maxSize) {\n freeSpace -= sizer.maxSize - sizer.size;\n totalStretch -= sizer.stretch;\n sizer.size = sizer.maxSize;\n sizer.done = true;\n notDoneCount--;\n stretchCount--;\n } else {\n freeSpace -= amt;\n sizer.size += amt;\n }\n }\n }\n // Distribute any remaining space evenly among the non-stretchable\n // sizers. This progresses in phases in the same manner as above.\n while (notDoneCount > 0 && freeSpace > nearZero) {\n let amt = freeSpace / notDoneCount;\n for (let i = 0; i < count; ++i) {\n let sizer = sizers[i];\n if (sizer.done) {\n continue;\n }\n if (sizer.size + amt >= sizer.maxSize) {\n freeSpace -= sizer.maxSize - sizer.size;\n sizer.size = sizer.maxSize;\n sizer.done = true;\n notDoneCount--;\n } else {\n freeSpace -= amt;\n sizer.size += amt;\n }\n }\n }\n }\n\n // Indicate that the consumed space equals the available space.\n return 0;\n }\n\n /**\n * Adjust a sizer by a delta and update its neighbors accordingly.\n *\n * @param sizers - The sizers which should be adjusted.\n *\n * @param index - The index of the sizer to grow.\n *\n * @param delta - The amount to adjust the sizer, positive or negative.\n *\n * #### Notes\n * This will adjust the indicated sizer by the specified amount, along\n * with the sizes of the appropriate neighbors, subject to the limits\n * specified by each of the sizers.\n *\n * This is useful when implementing box layouts where the boundaries\n * between the sizers are interactively adjustable by the user.\n */\n export function adjust(\n sizers: ArrayLike,\n index: number,\n delta: number\n ): void {\n // Bail early when there is nothing to do.\n if (sizers.length === 0 || delta === 0) {\n return;\n }\n\n // Dispatch to the proper implementation.\n if (delta > 0) {\n growSizer(sizers, index, delta);\n } else {\n shrinkSizer(sizers, index, -delta);\n }\n }\n\n /**\n * Grow a sizer by a positive delta and adjust neighbors.\n */\n function growSizer(\n sizers: ArrayLike,\n index: number,\n delta: number\n ): void {\n // Compute how much the items to the left can expand.\n let growLimit = 0;\n for (let i = 0; i <= index; ++i) {\n let sizer = sizers[i];\n growLimit += sizer.maxSize - sizer.size;\n }\n\n // Compute how much the items to the right can shrink.\n let shrinkLimit = 0;\n for (let i = index + 1, n = sizers.length; i < n; ++i) {\n let sizer = sizers[i];\n shrinkLimit += sizer.size - sizer.minSize;\n }\n\n // Clamp the delta adjustment to the limits.\n delta = Math.min(delta, growLimit, shrinkLimit);\n\n // Grow the sizers to the left by the delta.\n let grow = delta;\n for (let i = index; i >= 0 && grow > 0; --i) {\n let sizer = sizers[i];\n let limit = sizer.maxSize - sizer.size;\n if (limit >= grow) {\n sizer.sizeHint = sizer.size + grow;\n grow = 0;\n } else {\n sizer.sizeHint = sizer.size + limit;\n grow -= limit;\n }\n }\n\n // Shrink the sizers to the right by the delta.\n let shrink = delta;\n for (let i = index + 1, n = sizers.length; i < n && shrink > 0; ++i) {\n let sizer = sizers[i];\n let limit = sizer.size - sizer.minSize;\n if (limit >= shrink) {\n sizer.sizeHint = sizer.size - shrink;\n shrink = 0;\n } else {\n sizer.sizeHint = sizer.size - limit;\n shrink -= limit;\n }\n }\n }\n\n /**\n * Shrink a sizer by a positive delta and adjust neighbors.\n */\n function shrinkSizer(\n sizers: ArrayLike,\n index: number,\n delta: number\n ): void {\n // Compute how much the items to the right can expand.\n let growLimit = 0;\n for (let i = index + 1, n = sizers.length; i < n; ++i) {\n let sizer = sizers[i];\n growLimit += sizer.maxSize - sizer.size;\n }\n\n // Compute how much the items to the left can shrink.\n let shrinkLimit = 0;\n for (let i = 0; i <= index; ++i) {\n let sizer = sizers[i];\n shrinkLimit += sizer.size - sizer.minSize;\n }\n\n // Clamp the delta adjustment to the limits.\n delta = Math.min(delta, growLimit, shrinkLimit);\n\n // Grow the sizers to the right by the delta.\n let grow = delta;\n for (let i = index + 1, n = sizers.length; i < n && grow > 0; ++i) {\n let sizer = sizers[i];\n let limit = sizer.maxSize - sizer.size;\n if (limit >= grow) {\n sizer.sizeHint = sizer.size + grow;\n grow = 0;\n } else {\n sizer.sizeHint = sizer.size + limit;\n grow -= limit;\n }\n }\n\n // Shrink the sizers to the left by the delta.\n let shrink = delta;\n for (let i = index; i >= 0 && shrink > 0; --i) {\n let sizer = sizers[i];\n let limit = sizer.size - sizer.minSize;\n if (limit >= shrink) {\n sizer.sizeHint = sizer.size - shrink;\n shrink = 0;\n } else {\n sizer.sizeHint = sizer.size - limit;\n shrink -= limit;\n }\n }\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { IDisposable } from '@lumino/disposable';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { VirtualElement } from '@lumino/virtualdom';\n\n/**\n * An object which holds data related to an object's title.\n *\n * #### Notes\n * A title object is intended to hold the data necessary to display a\n * header for a particular object. A common example is the `TabPanel`,\n * which uses the widget title to populate the tab for a child widget.\n *\n * It is the responsibility of the owner to call the title disposal.\n */\nexport class Title implements IDisposable {\n /**\n * Construct a new title.\n *\n * @param options - The options for initializing the title.\n */\n constructor(options: Title.IOptions) {\n this.owner = options.owner;\n if (options.label !== undefined) {\n this._label = options.label;\n }\n if (options.mnemonic !== undefined) {\n this._mnemonic = options.mnemonic;\n }\n if (options.icon !== undefined) {\n this._icon = options.icon;\n }\n\n if (options.iconClass !== undefined) {\n this._iconClass = options.iconClass;\n }\n if (options.iconLabel !== undefined) {\n this._iconLabel = options.iconLabel;\n }\n if (options.caption !== undefined) {\n this._caption = options.caption;\n }\n if (options.className !== undefined) {\n this._className = options.className;\n }\n if (options.closable !== undefined) {\n this._closable = options.closable;\n }\n this._dataset = options.dataset || {};\n }\n\n /**\n * A signal emitted when the state of the title changes.\n */\n get changed(): ISignal {\n return this._changed;\n }\n\n /**\n * The object which owns the title.\n */\n readonly owner: T;\n\n /**\n * Get the label for the title.\n *\n * #### Notes\n * The default value is an empty string.\n */\n get label(): string {\n return this._label;\n }\n\n /**\n * Set the label for the title.\n */\n set label(value: string) {\n if (this._label === value) {\n return;\n }\n this._label = value;\n this._changed.emit(undefined);\n }\n\n /**\n * Get the mnemonic index for the title.\n *\n * #### Notes\n * The default value is `-1`.\n */\n get mnemonic(): number {\n return this._mnemonic;\n }\n\n /**\n * Set the mnemonic index for the title.\n */\n set mnemonic(value: number) {\n if (this._mnemonic === value) {\n return;\n }\n this._mnemonic = value;\n this._changed.emit(undefined);\n }\n\n /**\n * Get the icon renderer for the title.\n *\n * #### Notes\n * The default value is undefined.\n */\n get icon(): VirtualElement.IRenderer | undefined {\n return this._icon;\n }\n\n /**\n * Set the icon renderer for the title.\n *\n * #### Notes\n * A renderer is an object that supplies a render and unrender function.\n */\n set icon(value: VirtualElement.IRenderer | undefined) {\n if (this._icon === value) {\n return;\n }\n this._icon = value;\n this._changed.emit(undefined);\n }\n\n /**\n * Get the icon class name for the title.\n *\n * #### Notes\n * The default value is an empty string.\n */\n get iconClass(): string {\n return this._iconClass;\n }\n\n /**\n * Set the icon class name for the title.\n *\n * #### Notes\n * Multiple class names can be separated with whitespace.\n */\n set iconClass(value: string) {\n if (this._iconClass === value) {\n return;\n }\n this._iconClass = value;\n this._changed.emit(undefined);\n }\n\n /**\n * Get the icon label for the title.\n *\n * #### Notes\n * The default value is an empty string.\n */\n get iconLabel(): string {\n return this._iconLabel;\n }\n\n /**\n * Set the icon label for the title.\n *\n * #### Notes\n * Multiple class names can be separated with whitespace.\n */\n set iconLabel(value: string) {\n if (this._iconLabel === value) {\n return;\n }\n this._iconLabel = value;\n this._changed.emit(undefined);\n }\n\n /**\n * Get the caption for the title.\n *\n * #### Notes\n * The default value is an empty string.\n */\n get caption(): string {\n return this._caption;\n }\n\n /**\n * Set the caption for the title.\n */\n set caption(value: string) {\n if (this._caption === value) {\n return;\n }\n this._caption = value;\n this._changed.emit(undefined);\n }\n\n /**\n * Get the extra class name for the title.\n *\n * #### Notes\n * The default value is an empty string.\n */\n get className(): string {\n return this._className;\n }\n\n /**\n * Set the extra class name for the title.\n *\n * #### Notes\n * Multiple class names can be separated with whitespace.\n */\n set className(value: string) {\n if (this._className === value) {\n return;\n }\n this._className = value;\n this._changed.emit(undefined);\n }\n\n /**\n * Get the closable state for the title.\n *\n * #### Notes\n * The default value is `false`.\n */\n get closable(): boolean {\n return this._closable;\n }\n\n /**\n * Set the closable state for the title.\n *\n * #### Notes\n * This controls the presence of a close icon when applicable.\n */\n set closable(value: boolean) {\n if (this._closable === value) {\n return;\n }\n this._closable = value;\n this._changed.emit(undefined);\n }\n\n /**\n * Get the dataset for the title.\n *\n * #### Notes\n * The default value is an empty dataset.\n */\n get dataset(): Title.Dataset {\n return this._dataset;\n }\n\n /**\n * Set the dataset for the title.\n *\n * #### Notes\n * This controls the data attributes when applicable.\n */\n set dataset(value: Title.Dataset) {\n if (this._dataset === value) {\n return;\n }\n this._dataset = value;\n this._changed.emit(undefined);\n }\n\n /**\n * Test whether the title has been disposed.\n */\n get isDisposed(): boolean {\n return this._isDisposed;\n }\n\n /**\n * Dispose of the resources held by the title.\n *\n * #### Notes\n * It is the responsibility of the owner to call the title disposal.\n */\n dispose(): void {\n if (this.isDisposed) {\n return;\n }\n this._isDisposed = true;\n\n Signal.clearData(this);\n }\n\n private _label = '';\n private _caption = '';\n private _mnemonic = -1;\n private _icon: VirtualElement.IRenderer | undefined = undefined;\n private _iconClass = '';\n private _iconLabel = '';\n private _className = '';\n private _closable = false;\n private _dataset: Title.Dataset;\n private _changed = new Signal(this);\n private _isDisposed = false;\n}\n\n/**\n * The namespace for the `Title` class statics.\n */\nexport namespace Title {\n /**\n * A type alias for a simple immutable string dataset.\n */\n export type Dataset = { readonly [key: string]: string };\n\n /**\n * An options object for initializing a title.\n */\n export interface IOptions {\n /**\n * The object which owns the title.\n */\n owner: T;\n\n /**\n * The label for the title.\n */\n label?: string;\n\n /**\n * The mnemonic index for the title.\n */\n mnemonic?: number;\n\n /**\n * The icon renderer for the title.\n */\n icon?: VirtualElement.IRenderer;\n\n /**\n * The icon class name for the title.\n */\n iconClass?: string;\n\n /**\n * The icon label for the title.\n */\n iconLabel?: string;\n\n /**\n * The caption for the title.\n */\n caption?: string;\n\n /**\n * The extra class name for the title.\n */\n className?: string;\n\n /**\n * The closable state for the title.\n */\n closable?: boolean;\n\n /**\n * The dataset for the title.\n */\n dataset?: Dataset;\n }\n}\n","/* eslint-disable @typescript-eslint/no-empty-function */\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { IObservableDisposable } from '@lumino/disposable';\n\nimport {\n ConflatableMessage,\n IMessageHandler,\n Message,\n MessageLoop\n} from '@lumino/messaging';\n\nimport { AttachedProperty } from '@lumino/properties';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { Layout } from './layout';\n\nimport { Title } from './title';\n\n/**\n * The base class of the lumino widget hierarchy.\n *\n * #### Notes\n * This class will typically be subclassed in order to create a useful\n * widget. However, it can be used directly to host externally created\n * content.\n */\nexport class Widget implements IMessageHandler, IObservableDisposable {\n /**\n * Construct a new widget.\n *\n * @param options - The options for initializing the widget.\n */\n constructor(options: Widget.IOptions = {}) {\n this.node = Private.createNode(options);\n this.addClass('lm-Widget');\n }\n\n /**\n * Dispose of the widget and its descendant widgets.\n *\n * #### Notes\n * It is unsafe to use the widget after it has been disposed.\n *\n * All calls made to this method after the first are a no-op.\n */\n dispose(): void {\n // Do nothing if the widget is already disposed.\n if (this.isDisposed) {\n return;\n }\n\n // Set the disposed flag and emit the disposed signal.\n this.setFlag(Widget.Flag.IsDisposed);\n this._disposed.emit(undefined);\n\n // Remove or detach the widget if necessary.\n if (this.parent) {\n this.parent = null;\n } else if (this.isAttached) {\n Widget.detach(this);\n }\n\n // Dispose of the widget layout.\n if (this._layout) {\n this._layout.dispose();\n this._layout = null;\n }\n\n // Dispose the title\n this.title.dispose();\n\n // Clear the extra data associated with the widget.\n Signal.clearData(this);\n MessageLoop.clearData(this);\n AttachedProperty.clearData(this);\n }\n\n /**\n * A signal emitted when the widget is disposed.\n */\n get disposed(): ISignal {\n return this._disposed;\n }\n\n /**\n * Get the DOM node owned by the widget.\n */\n readonly node: HTMLElement;\n\n /**\n * Test whether the widget has been disposed.\n */\n get isDisposed(): boolean {\n return this.testFlag(Widget.Flag.IsDisposed);\n }\n\n /**\n * Test whether the widget's node is attached to the DOM.\n */\n get isAttached(): boolean {\n return this.testFlag(Widget.Flag.IsAttached);\n }\n\n /**\n * Test whether the widget is explicitly hidden.\n *\n * #### Notes\n * You should prefer `!{@link isVisible}` over `{@link isHidden}` if you want to know if the\n * widget is hidden as this does not test if the widget is hidden because one of its ancestors is hidden.\n */\n get isHidden(): boolean {\n return this.testFlag(Widget.Flag.IsHidden);\n }\n\n /**\n * Test whether the widget is visible.\n *\n * #### Notes\n * A widget is visible when it is attached to the DOM, is not\n * explicitly hidden, and has no explicitly hidden ancestors.\n *\n * Since 2.7.0, this does not rely on the {@link Widget.Flag.IsVisible} flag.\n * It recursively checks the visibility of all parent widgets.\n */\n get isVisible(): boolean {\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n let parent: Widget | null = this;\n do {\n if (parent.isHidden || !parent.isAttached) {\n return false;\n }\n parent = parent.parent;\n } while (parent != null);\n return true;\n }\n\n /**\n * The title object for the widget.\n *\n * #### Notes\n * The title object is used by some container widgets when displaying\n * the widget alongside some title, such as a tab panel or side bar.\n *\n * Since not all widgets will use the title, it is created on demand.\n *\n * The `owner` property of the title is set to this widget.\n */\n get title(): Title {\n return Private.titleProperty.get(this);\n }\n\n /**\n * Get the id of the widget's DOM node.\n */\n get id(): string {\n return this.node.id;\n }\n\n /**\n * Set the id of the widget's DOM node.\n */\n set id(value: string) {\n this.node.id = value;\n }\n\n /**\n * The dataset for the widget's DOM node.\n */\n get dataset(): DOMStringMap {\n return this.node.dataset;\n }\n\n /**\n * Get the method for hiding the widget.\n */\n get hiddenMode(): Widget.HiddenMode {\n return this._hiddenMode;\n }\n\n /**\n * Set the method for hiding the widget.\n */\n set hiddenMode(value: Widget.HiddenMode) {\n if (this._hiddenMode === value) {\n return;\n }\n\n if (this.isHidden) {\n // Reset styles set by previous mode.\n this._toggleHidden(false);\n }\n\n if (value == Widget.HiddenMode.Scale) {\n this.node.style.willChange = 'transform';\n } else {\n this.node.style.willChange = 'auto';\n }\n\n this._hiddenMode = value;\n\n if (this.isHidden) {\n // Set styles for new mode.\n this._toggleHidden(true);\n }\n }\n\n /**\n * Get the parent of the widget.\n */\n get parent(): Widget | null {\n return this._parent;\n }\n\n /**\n * Set the parent of the widget.\n *\n * #### Notes\n * Children are typically added to a widget by using a layout, which\n * means user code will not normally set the parent widget directly.\n *\n * The widget will be automatically removed from its old parent.\n *\n * This is a no-op if there is no effective parent change.\n */\n set parent(value: Widget | null) {\n if (this._parent === value) {\n return;\n }\n if (value && this.contains(value)) {\n throw new Error('Invalid parent widget.');\n }\n if (this._parent && !this._parent.isDisposed) {\n let msg = new Widget.ChildMessage('child-removed', this);\n MessageLoop.sendMessage(this._parent, msg);\n }\n this._parent = value;\n if (this._parent && !this._parent.isDisposed) {\n let msg = new Widget.ChildMessage('child-added', this);\n MessageLoop.sendMessage(this._parent, msg);\n }\n if (!this.isDisposed) {\n MessageLoop.sendMessage(this, Widget.Msg.ParentChanged);\n }\n }\n\n /**\n * Get the layout for the widget.\n */\n get layout(): Layout | null {\n return this._layout;\n }\n\n /**\n * Set the layout for the widget.\n *\n * #### Notes\n * The layout is single-use only. It cannot be changed after the\n * first assignment.\n *\n * The layout is disposed automatically when the widget is disposed.\n */\n set layout(value: Layout | null) {\n if (this._layout === value) {\n return;\n }\n if (this.testFlag(Widget.Flag.DisallowLayout)) {\n throw new Error('Cannot set widget layout.');\n }\n if (this._layout) {\n throw new Error('Cannot change widget layout.');\n }\n if (value!.parent) {\n throw new Error('Cannot change layout parent.');\n }\n this._layout = value;\n value!.parent = this;\n }\n\n /**\n * Create an iterator over the widget's children.\n *\n * @returns A new iterator over the children of the widget.\n *\n * #### Notes\n * The widget must have a populated layout in order to have children.\n *\n * If a layout is not installed, the returned iterator will be empty.\n */\n *children(): IterableIterator {\n if (this._layout) {\n yield* this._layout;\n }\n }\n\n /**\n * Test whether a widget is a descendant of this widget.\n *\n * @param widget - The descendant widget of interest.\n *\n * @returns `true` if the widget is a descendant, `false` otherwise.\n */\n contains(widget: Widget): boolean {\n for (let value: Widget | null = widget; value; value = value._parent) {\n if (value === this) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * Test whether the widget's DOM node has the given class name.\n *\n * @param name - The class name of interest.\n *\n * @returns `true` if the node has the class, `false` otherwise.\n */\n hasClass(name: string): boolean {\n return this.node.classList.contains(name);\n }\n\n /**\n * Add a class name to the widget's DOM node.\n *\n * @param name - The class name to add to the node.\n *\n * #### Notes\n * If the class name is already added to the node, this is a no-op.\n *\n * The class name must not contain whitespace.\n */\n addClass(name: string): void {\n this.node.classList.add(name);\n }\n\n /**\n * Remove a class name from the widget's DOM node.\n *\n * @param name - The class name to remove from the node.\n *\n * #### Notes\n * If the class name is not yet added to the node, this is a no-op.\n *\n * The class name must not contain whitespace.\n */\n removeClass(name: string): void {\n this.node.classList.remove(name);\n }\n\n /**\n * Toggle a class name on the widget's DOM node.\n *\n * @param name - The class name to toggle on the node.\n *\n * @param force - Whether to force add the class (`true`) or force\n * remove the class (`false`). If not provided, the presence of\n * the class will be toggled from its current state.\n *\n * @returns `true` if the class is now present, `false` otherwise.\n *\n * #### Notes\n * The class name must not contain whitespace.\n */\n toggleClass(name: string, force?: boolean): boolean {\n if (force === true) {\n this.node.classList.add(name);\n return true;\n }\n if (force === false) {\n this.node.classList.remove(name);\n return false;\n }\n return this.node.classList.toggle(name);\n }\n\n /**\n * Post an `'update-request'` message to the widget.\n *\n * #### Notes\n * This is a simple convenience method for posting the message.\n */\n update(): void {\n MessageLoop.postMessage(this, Widget.Msg.UpdateRequest);\n }\n\n /**\n * Post a `'fit-request'` message to the widget.\n *\n * #### Notes\n * This is a simple convenience method for posting the message.\n */\n fit(): void {\n MessageLoop.postMessage(this, Widget.Msg.FitRequest);\n }\n\n /**\n * Post an `'activate-request'` message to the widget.\n *\n * #### Notes\n * This is a simple convenience method for posting the message.\n */\n activate(): void {\n MessageLoop.postMessage(this, Widget.Msg.ActivateRequest);\n }\n\n /**\n * Send a `'close-request'` message to the widget.\n *\n * #### Notes\n * This is a simple convenience method for sending the message.\n */\n close(): void {\n MessageLoop.sendMessage(this, Widget.Msg.CloseRequest);\n }\n\n /**\n * Show the widget and make it visible to its parent widget.\n *\n * #### Notes\n * This causes the {@link isHidden} property to be `false`.\n *\n * If the widget is not explicitly hidden, this is a no-op.\n */\n show(): void {\n if (!this.testFlag(Widget.Flag.IsHidden)) {\n return;\n }\n if (this.isAttached && (!this.parent || this.parent.isVisible)) {\n MessageLoop.sendMessage(this, Widget.Msg.BeforeShow);\n }\n this.clearFlag(Widget.Flag.IsHidden);\n this._toggleHidden(false);\n\n if (this.isAttached && (!this.parent || this.parent.isVisible)) {\n MessageLoop.sendMessage(this, Widget.Msg.AfterShow);\n }\n if (this.parent) {\n let msg = new Widget.ChildMessage('child-shown', this);\n MessageLoop.sendMessage(this.parent, msg);\n }\n }\n\n /**\n * Hide the widget and make it hidden to its parent widget.\n *\n * #### Notes\n * This causes the {@link isHidden} property to be `true`.\n *\n * If the widget is explicitly hidden, this is a no-op.\n */\n hide(): void {\n if (this.testFlag(Widget.Flag.IsHidden)) {\n return;\n }\n if (this.isAttached && (!this.parent || this.parent.isVisible)) {\n MessageLoop.sendMessage(this, Widget.Msg.BeforeHide);\n }\n this.setFlag(Widget.Flag.IsHidden);\n this._toggleHidden(true);\n\n if (this.isAttached && (!this.parent || this.parent.isVisible)) {\n MessageLoop.sendMessage(this, Widget.Msg.AfterHide);\n }\n if (this.parent) {\n let msg = new Widget.ChildMessage('child-hidden', this);\n MessageLoop.sendMessage(this.parent, msg);\n }\n }\n\n /**\n * Show or hide the widget according to a boolean value.\n *\n * @param hidden - `true` to hide the widget, or `false` to show it.\n *\n * #### Notes\n * This is a convenience method for `hide()` and `show()`.\n */\n setHidden(hidden: boolean): void {\n if (hidden) {\n this.hide();\n } else {\n this.show();\n }\n }\n\n /**\n * Test whether the given widget flag is set.\n *\n * #### Notes\n * This will not typically be called directly by user code.\n *\n * Since 2.7.0, {@link Widget.Flag.IsVisible} is deprecated.\n * It will be removed in a future version.\n */\n testFlag(flag: Widget.Flag): boolean {\n return (this._flags & flag) !== 0;\n }\n\n /**\n * Set the given widget flag.\n *\n * #### Notes\n * This will not typically be called directly by user code.\n *\n * Since 2.7.0, {@link Widget.Flag.IsVisible} is deprecated.\n * It will be removed in a future version.\n */\n setFlag(flag: Widget.Flag): void {\n this._flags |= flag;\n }\n\n /**\n * Clear the given widget flag.\n *\n * #### Notes\n * This will not typically be called directly by user code.\n *\n * Since 2.7.0, {@link Widget.Flag.IsVisible} is deprecated.\n * It will be removed in a future version.\n */\n clearFlag(flag: Widget.Flag): void {\n this._flags &= ~flag;\n }\n\n /**\n * Process a message sent to the widget.\n *\n * @param msg - The message sent to the widget.\n *\n * #### Notes\n * Subclasses may reimplement this method as needed.\n */\n processMessage(msg: Message): void {\n switch (msg.type) {\n case 'resize':\n this.notifyLayout(msg);\n this.onResize(msg as Widget.ResizeMessage);\n break;\n case 'update-request':\n this.notifyLayout(msg);\n this.onUpdateRequest(msg);\n break;\n case 'fit-request':\n this.notifyLayout(msg);\n this.onFitRequest(msg);\n break;\n case 'before-show':\n this.notifyLayout(msg);\n this.onBeforeShow(msg);\n break;\n case 'after-show':\n this.setFlag(Widget.Flag.IsVisible);\n this.notifyLayout(msg);\n this.onAfterShow(msg);\n break;\n case 'before-hide':\n this.notifyLayout(msg);\n this.onBeforeHide(msg);\n break;\n case 'after-hide':\n this.clearFlag(Widget.Flag.IsVisible);\n this.notifyLayout(msg);\n this.onAfterHide(msg);\n break;\n case 'before-attach':\n this.notifyLayout(msg);\n this.onBeforeAttach(msg);\n break;\n case 'after-attach':\n if (!this.isHidden && (!this.parent || this.parent.isVisible)) {\n this.setFlag(Widget.Flag.IsVisible);\n }\n this.setFlag(Widget.Flag.IsAttached);\n this.notifyLayout(msg);\n this.onAfterAttach(msg);\n break;\n case 'before-detach':\n this.notifyLayout(msg);\n this.onBeforeDetach(msg);\n break;\n case 'after-detach':\n this.clearFlag(Widget.Flag.IsVisible);\n this.clearFlag(Widget.Flag.IsAttached);\n this.notifyLayout(msg);\n this.onAfterDetach(msg);\n break;\n case 'activate-request':\n this.notifyLayout(msg);\n this.onActivateRequest(msg);\n break;\n case 'close-request':\n this.notifyLayout(msg);\n this.onCloseRequest(msg);\n break;\n case 'child-added':\n this.notifyLayout(msg);\n this.onChildAdded(msg as Widget.ChildMessage);\n break;\n case 'child-removed':\n this.notifyLayout(msg);\n this.onChildRemoved(msg as Widget.ChildMessage);\n break;\n default:\n this.notifyLayout(msg);\n break;\n }\n }\n\n /**\n * Invoke the message processing routine of the widget's layout.\n *\n * @param msg - The message to dispatch to the layout.\n *\n * #### Notes\n * This is a no-op if the widget does not have a layout.\n *\n * This will not typically be called directly by user code.\n */\n protected notifyLayout(msg: Message): void {\n if (this._layout) {\n this._layout.processParentMessage(msg);\n }\n }\n\n /**\n * A message handler invoked on a `'close-request'` message.\n *\n * #### Notes\n * The default implementation unparents or detaches the widget.\n */\n protected onCloseRequest(msg: Message): void {\n if (this.parent) {\n this.parent = null;\n } else if (this.isAttached) {\n Widget.detach(this);\n }\n }\n\n /**\n * A message handler invoked on a `'resize'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onResize(msg: Widget.ResizeMessage): void {}\n\n /**\n * A message handler invoked on an `'update-request'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onUpdateRequest(msg: Message): void {}\n\n /**\n * A message handler invoked on a `'fit-request'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onFitRequest(msg: Message): void {}\n\n /**\n * A message handler invoked on an `'activate-request'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onActivateRequest(msg: Message): void {}\n\n /**\n * A message handler invoked on a `'before-show'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onBeforeShow(msg: Message): void {}\n\n /**\n * A message handler invoked on an `'after-show'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onAfterShow(msg: Message): void {}\n\n /**\n * A message handler invoked on a `'before-hide'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onBeforeHide(msg: Message): void {}\n\n /**\n * A message handler invoked on an `'after-hide'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onAfterHide(msg: Message): void {}\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onBeforeAttach(msg: Message): void {}\n\n /**\n * A message handler invoked on an `'after-attach'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onAfterAttach(msg: Message): void {}\n\n /**\n * A message handler invoked on a `'before-detach'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onBeforeDetach(msg: Message): void {}\n\n /**\n * A message handler invoked on an `'after-detach'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onAfterDetach(msg: Message): void {}\n\n /**\n * A message handler invoked on a `'child-added'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onChildAdded(msg: Widget.ChildMessage): void {}\n\n /**\n * A message handler invoked on a `'child-removed'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onChildRemoved(msg: Widget.ChildMessage): void {}\n\n private _toggleHidden(hidden: boolean) {\n if (hidden) {\n switch (this._hiddenMode) {\n case Widget.HiddenMode.Display:\n this.addClass('lm-mod-hidden');\n break;\n case Widget.HiddenMode.Scale:\n this.node.style.transform = 'scale(0)';\n this.node.setAttribute('aria-hidden', 'true');\n break;\n case Widget.HiddenMode.ContentVisibility:\n // @ts-expect-error content-visibility unknown by DOM lib types\n this.node.style.contentVisibility = 'hidden';\n this.node.style.zIndex = '-1';\n break;\n }\n } else {\n switch (this._hiddenMode) {\n case Widget.HiddenMode.Display:\n this.removeClass('lm-mod-hidden');\n break;\n case Widget.HiddenMode.Scale:\n this.node.style.transform = '';\n this.node.removeAttribute('aria-hidden');\n break;\n case Widget.HiddenMode.ContentVisibility:\n // @ts-expect-error content-visibility unknown by DOM lib types\n this.node.style.contentVisibility = '';\n this.node.style.zIndex = '';\n break;\n }\n }\n }\n\n private _flags = 0;\n private _layout: Layout | null = null;\n private _parent: Widget | null = null;\n private _disposed = new Signal(this);\n private _hiddenMode: Widget.HiddenMode = Widget.HiddenMode.Display;\n}\n\n/**\n * The namespace for the `Widget` class statics.\n */\nexport namespace Widget {\n /**\n * An options object for initializing a widget.\n */\n export interface IOptions {\n /**\n * The optional node to use for the widget.\n *\n * If a node is provided, the widget will assume full ownership\n * and control of the node, as if it had created the node itself.\n *\n * The default is a new `
`.\n */\n node?: HTMLElement;\n\n /**\n * The optional element tag, used for constructing the widget's node.\n *\n * If a pre-constructed node is provided via the `node` arg, this\n * value is ignored.\n */\n tag?: keyof HTMLElementTagNameMap;\n }\n\n /**\n * The method for hiding the widget.\n *\n * The default is Display.\n *\n * Using `Scale` will often increase performance as most browsers will not\n * trigger style computation for the `transform` action. This should be used\n * sparingly and tested, since increasing the number of composition layers\n * may slow things down.\n *\n * To ensure the transformation does not trigger style recomputation, you\n * may need to set the widget CSS style `will-change: transform`. This\n * should be used only when needed as it may overwhelm the browser with a\n * high number of layers. See\n * https://developer.mozilla.org/en-US/docs/Web/CSS/will-change\n */\n export enum HiddenMode {\n /**\n * Set a `lm-mod-hidden` CSS class to hide the widget using `display:none`\n * CSS from the standard Lumino CSS.\n */\n Display = 0,\n\n /**\n * Hide the widget by setting the `transform` to `'scale(0)'`.\n */\n Scale,\n\n /**\n *Hide the widget by setting the `content-visibility` to `'hidden'`.\n */\n ContentVisibility\n }\n\n /**\n * An enum of widget bit flags.\n */\n export enum Flag {\n /**\n * The widget has been disposed.\n */\n IsDisposed = 0x1,\n\n /**\n * The widget is attached to the DOM.\n */\n IsAttached = 0x2,\n\n /**\n * The widget is hidden.\n */\n IsHidden = 0x4,\n\n /**\n * The widget is visible.\n *\n * @deprecated since 2.7.0, apply that flag consistently was not reliable\n * so it was dropped in favor of a recursive check of the visibility of all parents.\n */\n IsVisible = 0x8,\n\n /**\n * A layout cannot be set on the widget.\n */\n DisallowLayout = 0x10\n }\n\n /**\n * A collection of stateless messages related to widgets.\n */\n export namespace Msg {\n /**\n * A singleton `'before-show'` message.\n *\n * #### Notes\n * This message is sent to a widget before it becomes visible.\n *\n * This message is **not** sent when the widget is being attached.\n */\n export const BeforeShow = new Message('before-show');\n\n /**\n * A singleton `'after-show'` message.\n *\n * #### Notes\n * This message is sent to a widget after it becomes visible.\n *\n * This message is **not** sent when the widget is being attached.\n */\n export const AfterShow = new Message('after-show');\n\n /**\n * A singleton `'before-hide'` message.\n *\n * #### Notes\n * This message is sent to a widget before it becomes not-visible.\n *\n * This message is **not** sent when the widget is being detached.\n */\n export const BeforeHide = new Message('before-hide');\n\n /**\n * A singleton `'after-hide'` message.\n *\n * #### Notes\n * This message is sent to a widget after it becomes not-visible.\n *\n * This message is **not** sent when the widget is being detached.\n */\n export const AfterHide = new Message('after-hide');\n\n /**\n * A singleton `'before-attach'` message.\n *\n * #### Notes\n * This message is sent to a widget before it is attached.\n */\n export const BeforeAttach = new Message('before-attach');\n\n /**\n * A singleton `'after-attach'` message.\n *\n * #### Notes\n * This message is sent to a widget after it is attached.\n */\n export const AfterAttach = new Message('after-attach');\n\n /**\n * A singleton `'before-detach'` message.\n *\n * #### Notes\n * This message is sent to a widget before it is detached.\n */\n export const BeforeDetach = new Message('before-detach');\n\n /**\n * A singleton `'after-detach'` message.\n *\n * #### Notes\n * This message is sent to a widget after it is detached.\n */\n export const AfterDetach = new Message('after-detach');\n\n /**\n * A singleton `'parent-changed'` message.\n *\n * #### Notes\n * This message is sent to a widget when its parent has changed.\n */\n export const ParentChanged = new Message('parent-changed');\n\n /**\n * A singleton conflatable `'update-request'` message.\n *\n * #### Notes\n * This message can be dispatched to supporting widgets in order to\n * update their content based on the current widget state. Not all\n * widgets will respond to messages of this type.\n *\n * For widgets with a layout, this message will inform the layout to\n * update the position and size of its child widgets.\n */\n export const UpdateRequest = new ConflatableMessage('update-request');\n\n /**\n * A singleton conflatable `'fit-request'` message.\n *\n * #### Notes\n * For widgets with a layout, this message will inform the layout to\n * recalculate its size constraints to fit the space requirements of\n * its child widgets, and to update their position and size. Not all\n * layouts will respond to messages of this type.\n */\n export const FitRequest = new ConflatableMessage('fit-request');\n\n /**\n * A singleton conflatable `'activate-request'` message.\n *\n * #### Notes\n * This message should be dispatched to a widget when it should\n * perform the actions necessary to activate the widget, which\n * may include focusing its node or descendant node.\n */\n export const ActivateRequest = new ConflatableMessage('activate-request');\n\n /**\n * A singleton conflatable `'close-request'` message.\n *\n * #### Notes\n * This message should be dispatched to a widget when it should close\n * and remove itself from the widget hierarchy.\n */\n export const CloseRequest = new ConflatableMessage('close-request');\n }\n\n /**\n * A message class for child related messages.\n */\n export class ChildMessage extends Message {\n /**\n * Construct a new child message.\n *\n * @param type - The message type.\n *\n * @param child - The child widget for the message.\n */\n constructor(type: string, child: Widget) {\n super(type);\n this.child = child;\n }\n\n /**\n * The child widget for the message.\n */\n readonly child: Widget;\n }\n\n /**\n * A message class for `'resize'` messages.\n */\n export class ResizeMessage extends Message {\n /**\n * Construct a new resize message.\n *\n * @param width - The **offset width** of the widget, or `-1` if\n * the width is not known.\n *\n * @param height - The **offset height** of the widget, or `-1` if\n * the height is not known.\n */\n constructor(width: number, height: number) {\n super('resize');\n this.width = width;\n this.height = height;\n }\n\n /**\n * The offset width of the widget.\n *\n * #### Notes\n * This will be `-1` if the width is unknown.\n */\n readonly width: number;\n\n /**\n * The offset height of the widget.\n *\n * #### Notes\n * This will be `-1` if the height is unknown.\n */\n readonly height: number;\n }\n\n /**\n * The namespace for the `ResizeMessage` class statics.\n */\n export namespace ResizeMessage {\n /**\n * A singleton `'resize'` message with an unknown size.\n */\n export const UnknownSize = new ResizeMessage(-1, -1);\n }\n\n /**\n * Attach a widget to a host DOM node.\n *\n * @param widget - The widget of interest.\n *\n * @param host - The DOM node to use as the widget's host.\n *\n * @param ref - The child of `host` to use as the reference element.\n * If this is provided, the widget will be inserted before this\n * node in the host. The default is `null`, which will cause the\n * widget to be added as the last child of the host.\n *\n * #### Notes\n * This will throw an error if the widget is not a root widget, if\n * the widget is already attached, or if the host is not attached\n * to the DOM.\n */\n export function attach(\n widget: Widget,\n host: HTMLElement,\n ref: HTMLElement | null = null\n ): void {\n if (widget.parent) {\n throw new Error('Cannot attach a child widget.');\n }\n if (widget.isAttached || widget.node.isConnected) {\n throw new Error('Widget is already attached.');\n }\n if (!host.isConnected) {\n throw new Error('Host is not attached.');\n }\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n host.insertBefore(widget.node, ref);\n MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n\n /**\n * Detach the widget from its host DOM node.\n *\n * @param widget - The widget of interest.\n *\n * #### Notes\n * This will throw an error if the widget is not a root widget,\n * or if the widget is not attached to the DOM.\n */\n export function detach(widget: Widget): void {\n if (widget.parent) {\n throw new Error('Cannot detach a child widget.');\n }\n if (!widget.isAttached || !widget.node.isConnected) {\n throw new Error('Widget is not attached.');\n }\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n widget.node.parentNode!.removeChild(widget.node);\n MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * An attached property for the widget title object.\n */\n export const titleProperty = new AttachedProperty>({\n name: 'title',\n create: owner => new Title({ owner })\n });\n\n /**\n * Create a DOM node for the given widget options.\n */\n export function createNode(options: Widget.IOptions): HTMLElement {\n return options.node || document.createElement(options.tag || 'div');\n }\n}\n","/* eslint-disable @typescript-eslint/no-empty-function */\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { IDisposable } from '@lumino/disposable';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { AttachedProperty } from '@lumino/properties';\n\nimport { Signal } from '@lumino/signaling';\n\nimport { Widget } from './widget';\n\n/**\n * An abstract base class for creating lumino layouts.\n *\n * #### Notes\n * A layout is used to add widgets to a parent and to arrange those\n * widgets within the parent's DOM node.\n *\n * This class implements the base functionality which is required of\n * nearly all layouts. It must be subclassed in order to be useful.\n *\n * Notably, this class does not define a uniform interface for adding\n * widgets to the layout. A subclass should define that API in a way\n * which is meaningful for its intended use.\n */\nexport abstract class Layout implements Iterable, IDisposable {\n /**\n * Construct a new layout.\n *\n * @param options - The options for initializing the layout.\n */\n constructor(options: Layout.IOptions = {}) {\n this._fitPolicy = options.fitPolicy || 'set-min-size';\n }\n\n /**\n * Dispose of the resources held by the layout.\n *\n * #### Notes\n * This should be reimplemented to clear and dispose of the widgets.\n *\n * All reimplementations should call the superclass method.\n *\n * This method is called automatically when the parent is disposed.\n */\n dispose(): void {\n this._parent = null;\n this._disposed = true;\n Signal.clearData(this);\n AttachedProperty.clearData(this);\n }\n\n /**\n * Test whether the layout is disposed.\n */\n get isDisposed(): boolean {\n return this._disposed;\n }\n\n /**\n * Get the parent widget of the layout.\n */\n get parent(): Widget | null {\n return this._parent;\n }\n\n /**\n * Set the parent widget of the layout.\n *\n * #### Notes\n * This is set automatically when installing the layout on the parent\n * widget. The parent widget should not be set directly by user code.\n */\n set parent(value: Widget | null) {\n if (this._parent === value) {\n return;\n }\n if (this._parent) {\n throw new Error('Cannot change parent widget.');\n }\n if (value!.layout !== this) {\n throw new Error('Invalid parent widget.');\n }\n this._parent = value;\n this.init();\n }\n\n /**\n * Get the fit policy for the layout.\n *\n * #### Notes\n * The fit policy controls the computed size constraints which are\n * applied to the parent widget by the layout.\n *\n * Some layout implementations may ignore the fit policy.\n */\n get fitPolicy(): Layout.FitPolicy {\n return this._fitPolicy;\n }\n\n /**\n * Set the fit policy for the layout.\n *\n * #### Notes\n * The fit policy controls the computed size constraints which are\n * applied to the parent widget by the layout.\n *\n * Some layout implementations may ignore the fit policy.\n *\n * Changing the fit policy will clear the current size constraint\n * for the parent widget and then re-fit the parent.\n */\n set fitPolicy(value: Layout.FitPolicy) {\n // Bail if the policy does not change\n if (this._fitPolicy === value) {\n return;\n }\n\n // Update the internal policy.\n this._fitPolicy = value;\n\n // Clear the size constraints and schedule a fit of the parent.\n if (this._parent) {\n let style = this._parent.node.style;\n style.minWidth = '';\n style.minHeight = '';\n style.maxWidth = '';\n style.maxHeight = '';\n this._parent.fit();\n }\n }\n\n /**\n * Create an iterator over the widgets in the layout.\n *\n * @returns A new iterator over the widgets in the layout.\n *\n * #### Notes\n * This abstract method must be implemented by a subclass.\n */\n abstract [Symbol.iterator](): IterableIterator;\n\n /**\n * Remove a widget from the layout.\n *\n * @param widget - The widget to remove from the layout.\n *\n * #### Notes\n * A widget is automatically removed from the layout when its `parent`\n * is set to `null`. This method should only be invoked directly when\n * removing a widget from a layout which has yet to be installed on a\n * parent widget.\n *\n * This method should *not* modify the widget's `parent`.\n */\n abstract removeWidget(widget: Widget): void;\n\n /**\n * Process a message sent to the parent widget.\n *\n * @param msg - The message sent to the parent widget.\n *\n * #### Notes\n * This method is called by the parent widget to process a message.\n *\n * Subclasses may reimplement this method as needed.\n */\n processParentMessage(msg: Message): void {\n switch (msg.type) {\n case 'resize':\n this.onResize(msg as Widget.ResizeMessage);\n break;\n case 'update-request':\n this.onUpdateRequest(msg);\n break;\n case 'fit-request':\n this.onFitRequest(msg);\n break;\n case 'before-show':\n this.onBeforeShow(msg);\n break;\n case 'after-show':\n this.onAfterShow(msg);\n break;\n case 'before-hide':\n this.onBeforeHide(msg);\n break;\n case 'after-hide':\n this.onAfterHide(msg);\n break;\n case 'before-attach':\n this.onBeforeAttach(msg);\n break;\n case 'after-attach':\n this.onAfterAttach(msg);\n break;\n case 'before-detach':\n this.onBeforeDetach(msg);\n break;\n case 'after-detach':\n this.onAfterDetach(msg);\n break;\n case 'child-removed':\n this.onChildRemoved(msg as Widget.ChildMessage);\n break;\n case 'child-shown':\n this.onChildShown(msg as Widget.ChildMessage);\n break;\n case 'child-hidden':\n this.onChildHidden(msg as Widget.ChildMessage);\n break;\n }\n }\n\n /**\n * Perform layout initialization which requires the parent widget.\n *\n * #### Notes\n * This method is invoked immediately after the layout is installed\n * on the parent widget.\n *\n * The default implementation reparents all of the widgets to the\n * layout parent widget.\n *\n * Subclasses should reimplement this method and attach the child\n * widget nodes to the parent widget's node.\n */\n protected init(): void {\n for (const widget of this) {\n widget.parent = this.parent;\n }\n }\n\n /**\n * A message handler invoked on a `'resize'` message.\n *\n * #### Notes\n * The layout should ensure that its widgets are resized according\n * to the specified layout space, and that they are sent a `'resize'`\n * message if appropriate.\n *\n * The default implementation of this method sends an `UnknownSize`\n * resize message to all widgets.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onResize(msg: Widget.ResizeMessage): void {\n for (const widget of this) {\n MessageLoop.sendMessage(widget, Widget.ResizeMessage.UnknownSize);\n }\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n *\n * #### Notes\n * The layout should ensure that its widgets are resized according\n * to the available layout space, and that they are sent a `'resize'`\n * message if appropriate.\n *\n * The default implementation of this method sends an `UnknownSize`\n * resize message to all widgets.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onUpdateRequest(msg: Message): void {\n for (const widget of this) {\n MessageLoop.sendMessage(widget, Widget.ResizeMessage.UnknownSize);\n }\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n *\n * #### Notes\n * The default implementation of this method forwards the message\n * to all widgets. It assumes all widget nodes are attached to the\n * parent widget node.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onBeforeAttach(msg: Message): void {\n for (const widget of this) {\n MessageLoop.sendMessage(widget, msg);\n }\n }\n\n /**\n * A message handler invoked on an `'after-attach'` message.\n *\n * #### Notes\n * The default implementation of this method forwards the message\n * to all widgets. It assumes all widget nodes are attached to the\n * parent widget node.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onAfterAttach(msg: Message): void {\n for (const widget of this) {\n MessageLoop.sendMessage(widget, msg);\n }\n }\n\n /**\n * A message handler invoked on a `'before-detach'` message.\n *\n * #### Notes\n * The default implementation of this method forwards the message\n * to all widgets. It assumes all widget nodes are attached to the\n * parent widget node.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onBeforeDetach(msg: Message): void {\n for (const widget of this) {\n MessageLoop.sendMessage(widget, msg);\n }\n }\n\n /**\n * A message handler invoked on an `'after-detach'` message.\n *\n * #### Notes\n * The default implementation of this method forwards the message\n * to all widgets. It assumes all widget nodes are attached to the\n * parent widget node.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onAfterDetach(msg: Message): void {\n for (const widget of this) {\n MessageLoop.sendMessage(widget, msg);\n }\n }\n\n /**\n * A message handler invoked on a `'before-show'` message.\n *\n * #### Notes\n * The default implementation of this method forwards the message to\n * all non-hidden widgets. It assumes all widget nodes are attached\n * to the parent widget node.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onBeforeShow(msg: Message): void {\n for (const widget of this) {\n if (!widget.isHidden) {\n MessageLoop.sendMessage(widget, msg);\n }\n }\n }\n\n /**\n * A message handler invoked on an `'after-show'` message.\n *\n * #### Notes\n * The default implementation of this method forwards the message to\n * all non-hidden widgets. It assumes all widget nodes are attached\n * to the parent widget node.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onAfterShow(msg: Message): void {\n for (const widget of this) {\n if (!widget.isHidden) {\n MessageLoop.sendMessage(widget, msg);\n }\n }\n }\n\n /**\n * A message handler invoked on a `'before-hide'` message.\n *\n * #### Notes\n * The default implementation of this method forwards the message to\n * all non-hidden widgets. It assumes all widget nodes are attached\n * to the parent widget node.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onBeforeHide(msg: Message): void {\n for (const widget of this) {\n if (!widget.isHidden) {\n MessageLoop.sendMessage(widget, msg);\n }\n }\n }\n\n /**\n * A message handler invoked on an `'after-hide'` message.\n *\n * #### Notes\n * The default implementation of this method forwards the message to\n * all non-hidden widgets. It assumes all widget nodes are attached\n * to the parent widget node.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onAfterHide(msg: Message): void {\n for (const widget of this) {\n if (!widget.isHidden) {\n MessageLoop.sendMessage(widget, msg);\n }\n }\n }\n\n /**\n * A message handler invoked on a `'child-removed'` message.\n *\n * #### Notes\n * This will remove the child widget from the layout.\n *\n * Subclasses should **not** typically reimplement this method.\n */\n protected onChildRemoved(msg: Widget.ChildMessage): void {\n this.removeWidget(msg.child);\n }\n\n /**\n * A message handler invoked on a `'fit-request'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onFitRequest(msg: Message): void {}\n\n /**\n * A message handler invoked on a `'child-shown'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onChildShown(msg: Widget.ChildMessage): void {}\n\n /**\n * A message handler invoked on a `'child-hidden'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onChildHidden(msg: Widget.ChildMessage): void {}\n\n private _disposed = false;\n private _fitPolicy: Layout.FitPolicy;\n private _parent: Widget | null = null;\n}\n\n/**\n * The namespace for the `Layout` class statics.\n */\nexport namespace Layout {\n /**\n * A type alias for the layout fit policy.\n *\n * #### Notes\n * The fit policy controls the computed size constraints which are\n * applied to the parent widget by the layout.\n *\n * Some layout implementations may ignore the fit policy.\n */\n export type FitPolicy =\n | /**\n * No size constraint will be applied to the parent widget.\n */\n 'set-no-constraint'\n\n /**\n * The computed min size will be applied to the parent widget.\n */\n | 'set-min-size';\n\n /**\n * An options object for initializing a layout.\n */\n export interface IOptions {\n /**\n * The fit policy for the layout.\n *\n * The default is `'set-min-size'`.\n */\n fitPolicy?: FitPolicy;\n }\n\n /**\n * A type alias for the horizontal alignment of a widget.\n */\n export type HorizontalAlignment = 'left' | 'center' | 'right';\n\n /**\n * A type alias for the vertical alignment of a widget.\n */\n export type VerticalAlignment = 'top' | 'center' | 'bottom';\n\n /**\n * Get the horizontal alignment for a widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The horizontal alignment for the widget.\n *\n * #### Notes\n * If the layout width allocated to a widget is larger than its max\n * width, the horizontal alignment controls how the widget is placed\n * within the extra horizontal space.\n *\n * If the allocated width is less than the widget's max width, the\n * horizontal alignment has no effect.\n *\n * Some layout implementations may ignore horizontal alignment.\n */\n export function getHorizontalAlignment(widget: Widget): HorizontalAlignment {\n return Private.horizontalAlignmentProperty.get(widget);\n }\n\n /**\n * Set the horizontal alignment for a widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the horizontal alignment.\n *\n * #### Notes\n * If the layout width allocated to a widget is larger than its max\n * width, the horizontal alignment controls how the widget is placed\n * within the extra horizontal space.\n *\n * If the allocated width is less than the widget's max width, the\n * horizontal alignment has no effect.\n *\n * Some layout implementations may ignore horizontal alignment.\n *\n * Changing the horizontal alignment will post an `update-request`\n * message to widget's parent, provided the parent has a layout\n * installed.\n */\n export function setHorizontalAlignment(\n widget: Widget,\n value: HorizontalAlignment\n ): void {\n Private.horizontalAlignmentProperty.set(widget, value);\n }\n\n /**\n * Get the vertical alignment for a widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The vertical alignment for the widget.\n *\n * #### Notes\n * If the layout height allocated to a widget is larger than its max\n * height, the vertical alignment controls how the widget is placed\n * within the extra vertical space.\n *\n * If the allocated height is less than the widget's max height, the\n * vertical alignment has no effect.\n *\n * Some layout implementations may ignore vertical alignment.\n */\n export function getVerticalAlignment(widget: Widget): VerticalAlignment {\n return Private.verticalAlignmentProperty.get(widget);\n }\n\n /**\n * Set the vertical alignment for a widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the vertical alignment.\n *\n * #### Notes\n * If the layout height allocated to a widget is larger than its max\n * height, the vertical alignment controls how the widget is placed\n * within the extra vertical space.\n *\n * If the allocated height is less than the widget's max height, the\n * vertical alignment has no effect.\n *\n * Some layout implementations may ignore vertical alignment.\n *\n * Changing the horizontal alignment will post an `update-request`\n * message to widget's parent, provided the parent has a layout\n * installed.\n */\n export function setVerticalAlignment(\n widget: Widget,\n value: VerticalAlignment\n ): void {\n Private.verticalAlignmentProperty.set(widget, value);\n }\n}\n\n/**\n * An object which assists in the absolute layout of widgets.\n *\n * #### Notes\n * This class is useful when implementing a layout which arranges its\n * widgets using absolute positioning.\n *\n * This class is used by nearly all of the built-in lumino layouts.\n */\nexport class LayoutItem implements IDisposable {\n /**\n * Construct a new layout item.\n *\n * @param widget - The widget to be managed by the item.\n *\n * #### Notes\n * The widget will be set to absolute positioning.\n * The widget will use strict CSS containment.\n */\n constructor(widget: Widget) {\n this.widget = widget;\n this.widget.node.style.position = 'absolute';\n this.widget.node.style.contain = 'strict';\n }\n\n /**\n * Dispose of the the layout item.\n *\n * #### Notes\n * This will reset the positioning of the widget.\n */\n dispose(): void {\n // Do nothing if the item is already disposed.\n if (this._disposed) {\n return;\n }\n\n // Mark the item as disposed.\n this._disposed = true;\n\n // Reset the widget style.\n let style = this.widget.node.style;\n style.position = '';\n style.top = '';\n style.left = '';\n style.width = '';\n style.height = '';\n style.contain = '';\n }\n\n /**\n * The widget managed by the layout item.\n */\n readonly widget: Widget;\n\n /**\n * The computed minimum width of the widget.\n *\n * #### Notes\n * This value can be updated by calling the `fit` method.\n */\n get minWidth(): number {\n return this._minWidth;\n }\n\n /**\n * The computed minimum height of the widget.\n *\n * #### Notes\n * This value can be updated by calling the `fit` method.\n */\n get minHeight(): number {\n return this._minHeight;\n }\n\n /**\n * The computed maximum width of the widget.\n *\n * #### Notes\n * This value can be updated by calling the `fit` method.\n */\n get maxWidth(): number {\n return this._maxWidth;\n }\n\n /**\n * The computed maximum height of the widget.\n *\n * #### Notes\n * This value can be updated by calling the `fit` method.\n */\n get maxHeight(): number {\n return this._maxHeight;\n }\n\n /**\n * Whether the layout item is disposed.\n */\n get isDisposed(): boolean {\n return this._disposed;\n }\n\n /**\n * Whether the managed widget is hidden.\n */\n get isHidden(): boolean {\n return this.widget.isHidden;\n }\n\n /**\n * Whether the managed widget is visible.\n */\n get isVisible(): boolean {\n return this.widget.isVisible;\n }\n\n /**\n * Whether the managed widget is attached.\n */\n get isAttached(): boolean {\n return this.widget.isAttached;\n }\n\n /**\n * Update the computed size limits of the managed widget.\n */\n fit(): void {\n let limits = ElementExt.sizeLimits(this.widget.node);\n this._minWidth = limits.minWidth;\n this._minHeight = limits.minHeight;\n this._maxWidth = limits.maxWidth;\n this._maxHeight = limits.maxHeight;\n }\n\n /**\n * Update the position and size of the managed widget.\n *\n * @param left - The left edge position of the layout box.\n *\n * @param top - The top edge position of the layout box.\n *\n * @param width - The width of the layout box.\n *\n * @param height - The height of the layout box.\n */\n update(left: number, top: number, width: number, height: number): void {\n // Clamp the size to the computed size limits.\n let clampW = Math.max(this._minWidth, Math.min(width, this._maxWidth));\n let clampH = Math.max(this._minHeight, Math.min(height, this._maxHeight));\n\n // Adjust the left edge for the horizontal alignment, if needed.\n if (clampW < width) {\n switch (Layout.getHorizontalAlignment(this.widget)) {\n case 'left':\n break;\n case 'center':\n left += (width - clampW) / 2;\n break;\n case 'right':\n left += width - clampW;\n break;\n default:\n throw 'unreachable';\n }\n }\n\n // Adjust the top edge for the vertical alignment, if needed.\n if (clampH < height) {\n switch (Layout.getVerticalAlignment(this.widget)) {\n case 'top':\n break;\n case 'center':\n top += (height - clampH) / 2;\n break;\n case 'bottom':\n top += height - clampH;\n break;\n default:\n throw 'unreachable';\n }\n }\n\n // Set up the resize variables.\n let resized = false;\n let style = this.widget.node.style;\n\n // Update the top edge of the widget if needed.\n if (this._top !== top) {\n this._top = top;\n style.top = `${top}px`;\n }\n\n // Update the left edge of the widget if needed.\n if (this._left !== left) {\n this._left = left;\n style.left = `${left}px`;\n }\n\n // Update the width of the widget if needed.\n if (this._width !== clampW) {\n resized = true;\n this._width = clampW;\n style.width = `${clampW}px`;\n }\n\n // Update the height of the widget if needed.\n if (this._height !== clampH) {\n resized = true;\n this._height = clampH;\n style.height = `${clampH}px`;\n }\n\n // Send a resize message to the widget if needed.\n if (resized) {\n let msg = new Widget.ResizeMessage(clampW, clampH);\n MessageLoop.sendMessage(this.widget, msg);\n }\n }\n\n private _top = NaN;\n private _left = NaN;\n private _width = NaN;\n private _height = NaN;\n private _minWidth = 0;\n private _minHeight = 0;\n private _maxWidth = Infinity;\n private _maxHeight = Infinity;\n private _disposed = false;\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * The attached property for a widget horizontal alignment.\n */\n export const horizontalAlignmentProperty = new AttachedProperty<\n Widget,\n Layout.HorizontalAlignment\n >({\n name: 'horizontalAlignment',\n create: () => 'center',\n changed: onAlignmentChanged\n });\n\n /**\n * The attached property for a widget vertical alignment.\n */\n export const verticalAlignmentProperty = new AttachedProperty<\n Widget,\n Layout.VerticalAlignment\n >({\n name: 'verticalAlignment',\n create: () => 'top',\n changed: onAlignmentChanged\n });\n\n /**\n * The change handler for the attached alignment properties.\n */\n function onAlignmentChanged(child: Widget): void {\n if (child.parent && child.parent.layout) {\n child.parent.update();\n }\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { MessageLoop } from '@lumino/messaging';\n\nimport { Layout } from './layout';\n\nimport { Widget } from './widget';\n\n/**\n * A concrete layout implementation suitable for many use cases.\n *\n * #### Notes\n * This class is suitable as a base class for implementing a variety of\n * layouts, but can also be used directly with standard CSS to layout a\n * collection of widgets.\n */\nexport class PanelLayout extends Layout {\n /**\n * Dispose of the resources held by the layout.\n *\n * #### Notes\n * This will clear and dispose all widgets in the layout.\n *\n * All reimplementations should call the superclass method.\n *\n * This method is called automatically when the parent is disposed.\n */\n dispose(): void {\n while (this._widgets.length > 0) {\n this._widgets.pop()!.dispose();\n }\n super.dispose();\n }\n\n /**\n * A read-only array of the widgets in the layout.\n */\n get widgets(): ReadonlyArray {\n return this._widgets;\n }\n\n /**\n * Create an iterator over the widgets in the layout.\n *\n * @returns A new iterator over the widgets in the layout.\n */\n *[Symbol.iterator](): IterableIterator {\n yield* this._widgets;\n }\n\n /**\n * Add a widget to the end of the layout.\n *\n * @param widget - The widget to add to the layout.\n *\n * #### Notes\n * If the widget is already contained in the layout, it will be moved.\n */\n addWidget(widget: Widget): void {\n this.insertWidget(this._widgets.length, widget);\n }\n\n /**\n * Insert a widget into the layout at the specified index.\n *\n * @param index - The index at which to insert the widget.\n *\n * @param widget - The widget to insert into the layout.\n *\n * #### Notes\n * The index will be clamped to the bounds of the widgets.\n *\n * If the widget is already added to the layout, it will be moved.\n *\n * #### Undefined Behavior\n * An `index` which is non-integral.\n */\n insertWidget(index: number, widget: Widget): void {\n // Remove the widget from its current parent. This is a no-op\n // if the widget's parent is already the layout parent widget.\n widget.parent = this.parent;\n\n // Look up the current index of the widget.\n let i = this._widgets.indexOf(widget);\n\n // Clamp the insert index to the array bounds.\n let j = Math.max(0, Math.min(index, this._widgets.length));\n\n // If the widget is not in the array, insert it.\n if (i === -1) {\n // Insert the widget into the array.\n ArrayExt.insert(this._widgets, j, widget);\n\n // If the layout is parented, attach the widget to the DOM.\n if (this.parent) {\n this.attachWidget(j, widget);\n }\n\n // There is nothing more to do.\n return;\n }\n\n // Otherwise, the widget exists in the array and should be moved.\n\n // Adjust the index if the location is at the end of the array.\n if (j === this._widgets.length) {\n j--;\n }\n\n // Bail if there is no effective move.\n if (i === j) {\n return;\n }\n\n // Move the widget to the new location.\n ArrayExt.move(this._widgets, i, j);\n\n // If the layout is parented, move the widget in the DOM.\n if (this.parent) {\n this.moveWidget(i, j, widget);\n }\n }\n\n /**\n * Remove a widget from the layout.\n *\n * @param widget - The widget to remove from the layout.\n *\n * #### Notes\n * A widget is automatically removed from the layout when its `parent`\n * is set to `null`. This method should only be invoked directly when\n * removing a widget from a layout which has yet to be installed on a\n * parent widget.\n *\n * This method does *not* modify the widget's `parent`.\n */\n removeWidget(widget: Widget): void {\n this.removeWidgetAt(this._widgets.indexOf(widget));\n }\n\n /**\n * Remove the widget at a given index from the layout.\n *\n * @param index - The index of the widget to remove.\n *\n * #### Notes\n * A widget is automatically removed from the layout when its `parent`\n * is set to `null`. This method should only be invoked directly when\n * removing a widget from a layout which has yet to be installed on a\n * parent widget.\n *\n * This method does *not* modify the widget's `parent`.\n *\n * #### Undefined Behavior\n * An `index` which is non-integral.\n */\n removeWidgetAt(index: number): void {\n // Remove the widget from the array.\n let widget = ArrayExt.removeAt(this._widgets, index);\n\n // If the layout is parented, detach the widget from the DOM.\n if (widget && this.parent) {\n this.detachWidget(index, widget);\n }\n }\n\n /**\n * Perform layout initialization which requires the parent widget.\n */\n protected init(): void {\n super.init();\n let index = 0;\n for (const widget of this) {\n this.attachWidget(index++, widget);\n }\n }\n\n /**\n * Attach a widget to the parent's DOM node.\n *\n * @param index - The current index of the widget in the layout.\n *\n * @param widget - The widget to attach to the parent.\n *\n * #### Notes\n * This method is called automatically by the panel layout at the\n * appropriate time. It should not be called directly by user code.\n *\n * The default implementation adds the widgets's node to the parent's\n * node at the proper location, and sends the appropriate attach\n * messages to the widget if the parent is attached to the DOM.\n *\n * Subclasses may reimplement this method to control how the widget's\n * node is added to the parent's node.\n */\n protected attachWidget(index: number, widget: Widget): void {\n // Look up the next sibling reference node.\n let ref = this.parent!.node.children[index];\n\n // Send a `'before-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n }\n\n // Insert the widget's node before the sibling.\n this.parent!.node.insertBefore(widget.node, ref);\n\n // Send an `'after-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n }\n\n /**\n * Move a widget in the parent's DOM node.\n *\n * @param fromIndex - The previous index of the widget in the layout.\n *\n * @param toIndex - The current index of the widget in the layout.\n *\n * @param widget - The widget to move in the parent.\n *\n * #### Notes\n * This method is called automatically by the panel layout at the\n * appropriate time. It should not be called directly by user code.\n *\n * The default implementation moves the widget's node to the proper\n * location in the parent's node and sends the appropriate attach and\n * detach messages to the widget if the parent is attached to the DOM.\n *\n * Subclasses may reimplement this method to control how the widget's\n * node is moved in the parent's node.\n */\n protected moveWidget(\n fromIndex: number,\n toIndex: number,\n widget: Widget\n ): void {\n // Send a `'before-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n }\n\n // Remove the widget's node from the parent.\n this.parent!.node.removeChild(widget.node);\n\n // Send an `'after-detach'` and message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n\n // Look up the next sibling reference node.\n let ref = this.parent!.node.children[toIndex];\n\n // Send a `'before-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n }\n\n // Insert the widget's node before the sibling.\n this.parent!.node.insertBefore(widget.node, ref);\n\n // Send an `'after-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n }\n\n /**\n * Detach a widget from the parent's DOM node.\n *\n * @param index - The previous index of the widget in the layout.\n *\n * @param widget - The widget to detach from the parent.\n *\n * #### Notes\n * This method is called automatically by the panel layout at the\n * appropriate time. It should not be called directly by user code.\n *\n * The default implementation removes the widget's node from the\n * parent's node, and sends the appropriate detach messages to the\n * widget if the parent is attached to the DOM.\n *\n * Subclasses may reimplement this method to control how the widget's\n * node is removed from the parent's node.\n */\n protected detachWidget(index: number, widget: Widget): void {\n // Send a `'before-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n }\n\n // Remove the widget's node from the parent.\n this.parent!.node.removeChild(widget.node);\n\n // Send an `'after-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n }\n\n private _widgets: Widget[] = [];\n}\n","/*\n * Copyright (c) Jupyter Development Team.\n * Distributed under the terms of the Modified BSD License.\n */\n\nexport namespace Utils {\n /**\n * Clamp a dimension value to an integer >= 0.\n */\n export function clampDimension(value: number): number {\n return Math.max(0, Math.floor(value));\n }\n}\n\nexport default Utils;\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { AttachedProperty } from '@lumino/properties';\n\nimport { BoxEngine, BoxSizer } from './boxengine';\n\nimport { LayoutItem } from './layout';\n\nimport { PanelLayout } from './panellayout';\n\nimport { Utils } from './utils';\n\nimport { Widget } from './widget';\n\n/**\n * A layout which arranges its widgets into resizable sections.\n */\nexport class SplitLayout extends PanelLayout {\n /**\n * Construct a new split layout.\n *\n * @param options - The options for initializing the layout.\n */\n constructor(options: SplitLayout.IOptions) {\n super();\n this.renderer = options.renderer;\n if (options.orientation !== undefined) {\n this._orientation = options.orientation;\n }\n if (options.alignment !== undefined) {\n this._alignment = options.alignment;\n }\n if (options.spacing !== undefined) {\n this._spacing = Utils.clampDimension(options.spacing);\n }\n }\n\n /**\n * Dispose of the resources held by the layout.\n */\n dispose(): void {\n // Dispose of the layout items.\n for (const item of this._items) {\n item.dispose();\n }\n\n // Clear the layout state.\n this._box = null;\n this._items.length = 0;\n this._sizers.length = 0;\n this._handles.length = 0;\n\n // Dispose of the rest of the layout.\n super.dispose();\n }\n\n /**\n * The renderer used by the split layout.\n */\n readonly renderer: SplitLayout.IRenderer;\n\n /**\n * Get the layout orientation for the split layout.\n */\n get orientation(): SplitLayout.Orientation {\n return this._orientation;\n }\n\n /**\n * Set the layout orientation for the split layout.\n */\n set orientation(value: SplitLayout.Orientation) {\n if (this._orientation === value) {\n return;\n }\n this._orientation = value;\n if (!this.parent) {\n return;\n }\n this.parent.dataset['orientation'] = value;\n this.parent.fit();\n }\n\n /**\n * Get the content alignment for the split layout.\n *\n * #### Notes\n * This is the alignment of the widgets in the layout direction.\n *\n * The alignment has no effect if the widgets can expand to fill the\n * entire split layout.\n */\n get alignment(): SplitLayout.Alignment {\n return this._alignment;\n }\n\n /**\n * Set the content alignment for the split layout.\n *\n * #### Notes\n * This is the alignment of the widgets in the layout direction.\n *\n * The alignment has no effect if the widgets can expand to fill the\n * entire split layout.\n */\n set alignment(value: SplitLayout.Alignment) {\n if (this._alignment === value) {\n return;\n }\n this._alignment = value;\n if (!this.parent) {\n return;\n }\n this.parent.dataset['alignment'] = value;\n this.parent.update();\n }\n\n /**\n * Get the inter-element spacing for the split layout.\n */\n get spacing(): number {\n return this._spacing;\n }\n\n /**\n * Set the inter-element spacing for the split layout.\n */\n set spacing(value: number) {\n value = Utils.clampDimension(value);\n if (this._spacing === value) {\n return;\n }\n this._spacing = value;\n if (!this.parent) {\n return;\n }\n this.parent.fit();\n }\n\n /**\n * A read-only array of the split handles in the layout.\n */\n get handles(): ReadonlyArray {\n return this._handles;\n }\n\n /**\n * Get the absolute sizes of the widgets in the layout.\n *\n * @returns A new array of the absolute sizes of the widgets.\n *\n * This method **does not** measure the DOM nodes.\n */\n absoluteSizes(): number[] {\n return this._sizers.map(sizer => sizer.size);\n }\n\n /**\n * Get the relative sizes of the widgets in the layout.\n *\n * @returns A new array of the relative sizes of the widgets.\n *\n * #### Notes\n * The returned sizes reflect the sizes of the widgets normalized\n * relative to their siblings.\n *\n * This method **does not** measure the DOM nodes.\n */\n relativeSizes(): number[] {\n return Private.normalize(this._sizers.map(sizer => sizer.size));\n }\n\n /**\n * Set the relative sizes for the widgets in the layout.\n *\n * @param sizes - The relative sizes for the widgets in the panel.\n * @param update - Update the layout after setting relative sizes.\n * Default is True.\n *\n * #### Notes\n * Extra values are ignored, too few will yield an undefined layout.\n *\n * The actual geometry of the DOM nodes is updated asynchronously.\n */\n setRelativeSizes(sizes: number[], update = true): void {\n // Copy the sizes and pad with zeros as needed.\n let n = this._sizers.length;\n let temp = sizes.slice(0, n);\n while (temp.length < n) {\n temp.push(0);\n }\n\n // Normalize the padded sizes.\n let normed = Private.normalize(temp);\n\n // Apply the normalized sizes to the sizers.\n for (let i = 0; i < n; ++i) {\n let sizer = this._sizers[i];\n sizer.sizeHint = normed[i];\n sizer.size = normed[i];\n }\n\n // Set the flag indicating the sizes are normalized.\n this._hasNormedSizes = true;\n\n // Trigger an update of the parent widget.\n if (update && this.parent) {\n this.parent.update();\n }\n }\n\n /**\n * Move the offset position of a split handle.\n *\n * @param index - The index of the handle of the interest.\n *\n * @param position - The desired offset position of the handle.\n *\n * #### Notes\n * The position is relative to the offset parent.\n *\n * This will move the handle as close as possible to the desired\n * position. The sibling widgets will be adjusted as necessary.\n */\n moveHandle(index: number, position: number): void {\n // Bail if the index is invalid or the handle is hidden.\n let handle = this._handles[index];\n if (!handle || handle.classList.contains('lm-mod-hidden')) {\n return;\n }\n\n // Compute the desired delta movement for the handle.\n let delta: number;\n if (this._orientation === 'horizontal') {\n delta = position - handle.offsetLeft;\n } else {\n delta = position - handle.offsetTop;\n }\n\n // Bail if there is no handle movement.\n if (delta === 0) {\n return;\n }\n\n // Prevent widget resizing unless needed.\n for (let sizer of this._sizers) {\n if (sizer.size > 0) {\n sizer.sizeHint = sizer.size;\n }\n }\n\n // Adjust the sizers to reflect the handle movement.\n BoxEngine.adjust(this._sizers, index, delta);\n\n // Update the layout of the widgets.\n if (this.parent) {\n this.parent.update();\n }\n }\n\n /**\n * Perform layout initialization which requires the parent widget.\n */\n protected init(): void {\n this.parent!.dataset['orientation'] = this.orientation;\n this.parent!.dataset['alignment'] = this.alignment;\n super.init();\n }\n\n /**\n * Attach a widget to the parent's DOM node.\n *\n * @param index - The current index of the widget in the layout.\n *\n * @param widget - The widget to attach to the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected attachWidget(index: number, widget: Widget): void {\n // Create the item, handle, and sizer for the new widget.\n let item = new LayoutItem(widget);\n let handle = Private.createHandle(this.renderer);\n let average = Private.averageSize(this._sizers);\n let sizer = Private.createSizer(average);\n\n // Insert the item, handle, and sizer into the internal arrays.\n ArrayExt.insert(this._items, index, item);\n ArrayExt.insert(this._sizers, index, sizer);\n ArrayExt.insert(this._handles, index, handle);\n\n // Send a `'before-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n }\n\n // Add the widget and handle nodes to the parent.\n this.parent!.node.appendChild(widget.node);\n this.parent!.node.appendChild(handle);\n\n // Send an `'after-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n\n // Post a fit request for the parent widget.\n this.parent!.fit();\n }\n\n /**\n * Move a widget in the parent's DOM node.\n *\n * @param fromIndex - The previous index of the widget in the layout.\n *\n * @param toIndex - The current index of the widget in the layout.\n *\n * @param widget - The widget to move in the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected moveWidget(\n fromIndex: number,\n toIndex: number,\n widget: Widget\n ): void {\n // Move the item, sizer, and handle for the widget.\n ArrayExt.move(this._items, fromIndex, toIndex);\n ArrayExt.move(this._sizers, fromIndex, toIndex);\n ArrayExt.move(this._handles, fromIndex, toIndex);\n\n // Post a fit request to the parent to show/hide last handle.\n this.parent!.fit();\n }\n\n /**\n * Detach a widget from the parent's DOM node.\n *\n * @param index - The previous index of the widget in the layout.\n *\n * @param widget - The widget to detach from the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected detachWidget(index: number, widget: Widget): void {\n // Remove the item, handle, and sizer for the widget.\n let item = ArrayExt.removeAt(this._items, index);\n let handle = ArrayExt.removeAt(this._handles, index);\n ArrayExt.removeAt(this._sizers, index);\n\n // Send a `'before-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n }\n\n // Remove the widget and handle nodes from the parent.\n this.parent!.node.removeChild(widget.node);\n this.parent!.node.removeChild(handle!);\n\n // Send an `'after-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n\n // Dispose of the layout item.\n item!.dispose();\n\n // Post a fit request for the parent widget.\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'before-show'` message.\n */\n protected onBeforeShow(msg: Message): void {\n super.onBeforeShow(msg);\n this.parent!.update();\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n super.onBeforeAttach(msg);\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-shown'` message.\n */\n protected onChildShown(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-hidden'` message.\n */\n protected onChildHidden(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'resize'` message.\n */\n protected onResize(msg: Widget.ResizeMessage): void {\n if (this.parent!.isVisible) {\n this._update(msg.width, msg.height);\n }\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n protected onUpdateRequest(msg: Message): void {\n if (this.parent!.isVisible) {\n this._update(-1, -1);\n }\n }\n\n /**\n * A message handler invoked on a `'fit-request'` message.\n */\n protected onFitRequest(msg: Message): void {\n if (this.parent!.isAttached) {\n this._fit();\n }\n }\n\n /**\n * Update the item position.\n *\n * @param i Item index\n * @param isHorizontal Whether the layout is horizontal or not\n * @param left Left position in pixels\n * @param top Top position in pixels\n * @param height Item height\n * @param width Item width\n * @param size Item size\n */\n protected updateItemPosition(\n i: number,\n isHorizontal: boolean,\n left: number,\n top: number,\n height: number,\n width: number,\n size: number\n ): void {\n const item = this._items[i];\n if (item.isHidden) {\n return;\n }\n\n // Fetch the style for the handle.\n let handleStyle = this._handles[i].style;\n\n // Update the widget and handle, and advance the relevant edge.\n if (isHorizontal) {\n left += this.widgetOffset;\n item.update(left, top, size, height);\n left += size;\n handleStyle.top = `${top}px`;\n handleStyle.left = `${left}px`;\n handleStyle.width = `${this._spacing}px`;\n handleStyle.height = `${height}px`;\n } else {\n top += this.widgetOffset;\n item.update(left, top, width, size);\n top += size;\n handleStyle.top = `${top}px`;\n handleStyle.left = `${left}px`;\n handleStyle.width = `${width}px`;\n handleStyle.height = `${this._spacing}px`;\n }\n }\n\n /**\n * Fit the layout to the total size required by the widgets.\n */\n private _fit(): void {\n // Update the handles and track the visible widget count.\n let nVisible = 0;\n let lastHandleIndex = -1;\n for (let i = 0, n = this._items.length; i < n; ++i) {\n if (this._items[i].isHidden) {\n this._handles[i].classList.add('lm-mod-hidden');\n } else {\n this._handles[i].classList.remove('lm-mod-hidden');\n lastHandleIndex = i;\n nVisible++;\n }\n }\n\n // Hide the handle for the last visible widget.\n if (lastHandleIndex !== -1) {\n this._handles[lastHandleIndex].classList.add('lm-mod-hidden');\n }\n\n // Update the fixed space for the visible items.\n this._fixed =\n this._spacing * Math.max(0, nVisible - 1) +\n this.widgetOffset * this._items.length;\n\n // Setup the computed minimum size.\n let horz = this._orientation === 'horizontal';\n let minW = horz ? this._fixed : 0;\n let minH = horz ? 0 : this._fixed;\n\n // Update the sizers and computed size limits.\n for (let i = 0, n = this._items.length; i < n; ++i) {\n // Fetch the item and corresponding box sizer.\n let item = this._items[i];\n let sizer = this._sizers[i];\n\n // Prevent resizing unless necessary.\n if (sizer.size > 0) {\n sizer.sizeHint = sizer.size;\n }\n\n // If the item is hidden, it should consume zero size.\n if (item.isHidden) {\n sizer.minSize = 0;\n sizer.maxSize = 0;\n continue;\n }\n\n // Update the size limits for the item.\n item.fit();\n\n // Update the stretch factor.\n sizer.stretch = SplitLayout.getStretch(item.widget);\n\n // Update the sizer limits and computed min size.\n if (horz) {\n sizer.minSize = item.minWidth;\n sizer.maxSize = item.maxWidth;\n minW += item.minWidth;\n minH = Math.max(minH, item.minHeight);\n } else {\n sizer.minSize = item.minHeight;\n sizer.maxSize = item.maxHeight;\n minH += item.minHeight;\n minW = Math.max(minW, item.minWidth);\n }\n }\n\n // Update the box sizing and add it to the computed min size.\n let box = (this._box = ElementExt.boxSizing(this.parent!.node));\n minW += box.horizontalSum;\n minH += box.verticalSum;\n\n // Update the parent's min size constraints.\n let style = this.parent!.node.style;\n style.minWidth = `${minW}px`;\n style.minHeight = `${minH}px`;\n\n // Set the dirty flag to ensure only a single update occurs.\n this._dirty = true;\n\n // Notify the ancestor that it should fit immediately. This may\n // cause a resize of the parent, fulfilling the required update.\n if (this.parent!.parent) {\n MessageLoop.sendMessage(this.parent!.parent!, Widget.Msg.FitRequest);\n }\n\n // If the dirty flag is still set, the parent was not resized.\n // Trigger the required update on the parent widget immediately.\n if (this._dirty) {\n MessageLoop.sendMessage(this.parent!, Widget.Msg.UpdateRequest);\n }\n }\n\n /**\n * Update the layout position and size of the widgets.\n *\n * The parent offset dimensions should be `-1` if unknown.\n */\n private _update(offsetWidth: number, offsetHeight: number): void {\n // Clear the dirty flag to indicate the update occurred.\n this._dirty = false;\n\n // Compute the visible item count.\n let nVisible = 0;\n for (let i = 0, n = this._items.length; i < n; ++i) {\n nVisible += +!this._items[i].isHidden;\n }\n\n // Bail early if there are no visible items to layout.\n if (nVisible === 0 && this.widgetOffset === 0) {\n return;\n }\n\n // Measure the parent if the offset dimensions are unknown.\n if (offsetWidth < 0) {\n offsetWidth = this.parent!.node.offsetWidth;\n }\n if (offsetHeight < 0) {\n offsetHeight = this.parent!.node.offsetHeight;\n }\n\n // Ensure the parent box sizing data is computed.\n if (!this._box) {\n this._box = ElementExt.boxSizing(this.parent!.node);\n }\n\n // Compute the actual layout bounds adjusted for border and padding.\n let top = this._box.paddingTop;\n let left = this._box.paddingLeft;\n let width = offsetWidth - this._box.horizontalSum;\n let height = offsetHeight - this._box.verticalSum;\n\n // Set up the variables for justification and alignment offset.\n let extra = 0;\n let offset = 0;\n let horz = this._orientation === 'horizontal';\n\n if (nVisible > 0) {\n // Compute the adjusted layout space.\n let space: number;\n if (horz) {\n // left += this.widgetOffset;\n space = Math.max(0, width - this._fixed);\n } else {\n // top += this.widgetOffset;\n space = Math.max(0, height - this._fixed);\n }\n\n // Scale the size hints if they are normalized.\n if (this._hasNormedSizes) {\n for (let sizer of this._sizers) {\n sizer.sizeHint *= space;\n }\n this._hasNormedSizes = false;\n }\n\n // Distribute the layout space to the box sizers.\n let delta = BoxEngine.calc(this._sizers, space);\n\n // Account for alignment if there is extra layout space.\n if (delta > 0) {\n switch (this._alignment) {\n case 'start':\n break;\n case 'center':\n extra = 0;\n offset = delta / 2;\n break;\n case 'end':\n extra = 0;\n offset = delta;\n break;\n case 'justify':\n extra = delta / nVisible;\n offset = 0;\n break;\n default:\n throw 'unreachable';\n }\n }\n }\n\n // Layout the items using the computed box sizes.\n for (let i = 0, n = this._items.length; i < n; ++i) {\n // Fetch the item.\n const item = this._items[i];\n\n // Fetch the computed size for the widget.\n const size = item.isHidden ? 0 : this._sizers[i].size + extra;\n\n this.updateItemPosition(\n i,\n horz,\n horz ? left + offset : left,\n horz ? top : top + offset,\n height,\n width,\n size\n );\n\n const fullOffset =\n this.widgetOffset +\n (this._handles[i].classList.contains('lm-mod-hidden')\n ? 0\n : this._spacing);\n\n if (horz) {\n left += size + fullOffset;\n } else {\n top += size + fullOffset;\n }\n }\n }\n\n protected widgetOffset = 0;\n private _fixed = 0;\n private _spacing = 4;\n private _dirty = false;\n private _hasNormedSizes = false;\n private _sizers: BoxSizer[] = [];\n private _items: LayoutItem[] = [];\n private _handles: HTMLDivElement[] = [];\n private _box: ElementExt.IBoxSizing | null = null;\n private _alignment: SplitLayout.Alignment = 'start';\n private _orientation: SplitLayout.Orientation = 'horizontal';\n}\n\n/**\n * The namespace for the `SplitLayout` class statics.\n */\nexport namespace SplitLayout {\n /**\n * A type alias for a split layout orientation.\n */\n export type Orientation = 'horizontal' | 'vertical';\n\n /**\n * A type alias for a split layout alignment.\n */\n export type Alignment = 'start' | 'center' | 'end' | 'justify';\n\n /**\n * An options object for initializing a split layout.\n */\n export interface IOptions {\n /**\n * The renderer to use for the split layout.\n */\n renderer: IRenderer;\n\n /**\n * The orientation of the layout.\n *\n * Possible values are documented in {@link SplitLayout.Orientation}.\n *\n * The default is `'horizontal'`.\n */\n orientation?: Orientation;\n\n /**\n * The content alignment of the layout.\n *\n * Possible values are documented in {@link SplitLayout.Alignment}.\n *\n * The default is `'start'`.\n */\n alignment?: Alignment;\n\n /**\n * The spacing between items in the layout.\n *\n * The default is `4`.\n */\n spacing?: number;\n }\n\n /**\n * A renderer for use with a split layout.\n */\n export interface IRenderer {\n /**\n * Create a new handle for use with a split layout.\n *\n * @returns A new handle element.\n */\n createHandle(): HTMLDivElement;\n }\n\n /**\n * Get the split layout stretch factor for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The split layout stretch factor for the widget.\n */\n export function getStretch(widget: Widget): number {\n return Private.stretchProperty.get(widget);\n }\n\n /**\n * Set the split layout stretch factor for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the stretch factor.\n */\n export function setStretch(widget: Widget, value: number): void {\n Private.stretchProperty.set(widget, value);\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * The property descriptor for a widget stretch factor.\n */\n export const stretchProperty = new AttachedProperty({\n name: 'stretch',\n create: () => 0,\n coerce: (owner, value) => Math.max(0, Math.floor(value)),\n changed: onChildSizingChanged\n });\n\n /**\n * Create a new box sizer with the given size hint.\n */\n export function createSizer(size: number): BoxSizer {\n let sizer = new BoxSizer();\n sizer.sizeHint = Math.floor(size);\n return sizer;\n }\n\n /**\n * Create a new split handle node using the given renderer.\n */\n export function createHandle(\n renderer: SplitLayout.IRenderer\n ): HTMLDivElement {\n let handle = renderer.createHandle();\n handle.style.position = 'absolute';\n // Do not use size containment to allow the handle to fill the available space\n handle.style.contain = 'style';\n return handle;\n }\n\n /**\n * Compute the average size of an array of box sizers.\n */\n export function averageSize(sizers: BoxSizer[]): number {\n return sizers.reduce((v, s) => v + s.size, 0) / sizers.length || 0;\n }\n\n /**\n * Normalize an array of values.\n */\n export function normalize(values: number[]): number[] {\n let n = values.length;\n if (n === 0) {\n return [];\n }\n let sum = values.reduce((a, b) => a + Math.abs(b), 0);\n return sum === 0 ? values.map(v => 1 / n) : values.map(v => v / sum);\n }\n\n /**\n * The change handler for the attached sizing properties.\n */\n function onChildSizingChanged(child: Widget): void {\n if (child.parent && child.parent.layout instanceof SplitLayout) {\n child.parent.fit();\n }\n }\n}\n","/*\n * Copyright (c) Jupyter Development Team.\n * Distributed under the terms of the Modified BSD License.\n */\n\nimport { ArrayExt } from '@lumino/algorithm';\nimport { UUID } from '@lumino/coreutils';\nimport { SplitLayout } from './splitlayout';\nimport { Title } from './title';\nimport Utils from './utils';\nimport { Widget } from './widget';\n\n/**\n * A layout which arranges its widgets into collapsible resizable sections.\n */\nexport class AccordionLayout extends SplitLayout {\n /**\n * Construct a new accordion layout.\n *\n * @param options - The options for initializing the layout.\n *\n * #### Notes\n * The default orientation will be vertical.\n *\n * Titles must be rotated for horizontal accordion panel using CSS: see accordionpanel.css\n */\n constructor(options: AccordionLayout.IOptions) {\n super({ ...options, orientation: options.orientation || 'vertical' });\n this.titleSpace = options.titleSpace || 22;\n }\n\n /**\n * The section title height or width depending on the orientation.\n */\n get titleSpace(): number {\n return this.widgetOffset;\n }\n set titleSpace(value: number) {\n value = Utils.clampDimension(value);\n if (this.widgetOffset === value) {\n return;\n }\n this.widgetOffset = value;\n if (!this.parent) {\n return;\n }\n this.parent.fit();\n }\n\n /**\n * A read-only array of the section titles in the panel.\n */\n get titles(): ReadonlyArray {\n return this._titles;\n }\n\n /**\n * Dispose of the resources held by the layout.\n */\n dispose(): void {\n if (this.isDisposed) {\n return;\n }\n\n // Clear the layout state.\n this._titles.length = 0;\n\n // Dispose of the rest of the layout.\n super.dispose();\n }\n\n /**\n * The renderer used by the accordion layout.\n */\n readonly renderer: AccordionLayout.IRenderer;\n\n public updateTitle(index: number, widget: Widget): void {\n const oldTitle = this._titles[index];\n const expanded = oldTitle.classList.contains('lm-mod-expanded');\n const newTitle = Private.createTitle(this.renderer, widget.title, expanded);\n this._titles[index] = newTitle;\n\n // Add the title node to the parent before the widget.\n this.parent!.node.replaceChild(newTitle, oldTitle);\n }\n\n /**\n * Insert a widget into the layout at the specified index.\n *\n * @param index - The index at which to insert the widget.\n *\n * @param widget - The widget to insert into the layout.\n *\n * #### Notes\n * The index will be clamped to the bounds of the widgets.\n *\n * If the widget is already added to the layout, it will be moved.\n *\n * #### Undefined Behavior\n * An `index` which is non-integral.\n */\n insertWidget(index: number, widget: Widget): void {\n if (!widget.id) {\n widget.id = `id-${UUID.uuid4()}`;\n }\n super.insertWidget(index, widget);\n }\n\n /**\n * Attach a widget to the parent's DOM node.\n *\n * @param index - The current index of the widget in the layout.\n *\n * @param widget - The widget to attach to the parent.\n */\n protected attachWidget(index: number, widget: Widget): void {\n const title = Private.createTitle(this.renderer, widget.title);\n\n ArrayExt.insert(this._titles, index, title);\n\n // Add the title node to the parent before the widget.\n this.parent!.node.appendChild(title);\n\n widget.node.setAttribute('role', 'region');\n widget.node.setAttribute('aria-labelledby', title.id);\n\n super.attachWidget(index, widget);\n }\n\n /**\n * Move a widget in the parent's DOM node.\n *\n * @param fromIndex - The previous index of the widget in the layout.\n *\n * @param toIndex - The current index of the widget in the layout.\n *\n * @param widget - The widget to move in the parent.\n */\n protected moveWidget(\n fromIndex: number,\n toIndex: number,\n widget: Widget\n ): void {\n ArrayExt.move(this._titles, fromIndex, toIndex);\n super.moveWidget(fromIndex, toIndex, widget);\n }\n\n /**\n * Detach a widget from the parent's DOM node.\n *\n * @param index - The previous index of the widget in the layout.\n *\n * @param widget - The widget to detach from the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected detachWidget(index: number, widget: Widget): void {\n const title = ArrayExt.removeAt(this._titles, index);\n\n this.parent!.node.removeChild(title!);\n\n super.detachWidget(index, widget);\n }\n\n /**\n * Update the item position.\n *\n * @param i Item index\n * @param isHorizontal Whether the layout is horizontal or not\n * @param left Left position in pixels\n * @param top Top position in pixels\n * @param height Item height\n * @param width Item width\n * @param size Item size\n */\n protected updateItemPosition(\n i: number,\n isHorizontal: boolean,\n left: number,\n top: number,\n height: number,\n width: number,\n size: number\n ): void {\n const titleStyle = this._titles[i].style;\n\n // Titles must be rotated for horizontal accordion panel using CSS: see accordionpanel.css\n titleStyle.top = `${top}px`;\n titleStyle.left = `${left}px`;\n titleStyle.height = `${this.widgetOffset}px`;\n if (isHorizontal) {\n titleStyle.width = `${height}px`;\n } else {\n titleStyle.width = `${width}px`;\n }\n\n super.updateItemPosition(i, isHorizontal, left, top, height, width, size);\n }\n\n private _titles: HTMLElement[] = [];\n}\n\nexport namespace AccordionLayout {\n /**\n * A type alias for a accordion layout orientation.\n */\n export type Orientation = SplitLayout.Orientation;\n\n /**\n * A type alias for a accordion layout alignment.\n */\n export type Alignment = SplitLayout.Alignment;\n\n /**\n * An options object for initializing a accordion layout.\n */\n export interface IOptions extends SplitLayout.IOptions {\n /**\n * The renderer to use for the accordion layout.\n */\n renderer: IRenderer;\n\n /**\n * The section title height or width depending on the orientation.\n *\n * The default is `22`.\n */\n titleSpace?: number;\n }\n\n /**\n * A renderer for use with an accordion layout.\n */\n export interface IRenderer extends SplitLayout.IRenderer {\n /**\n * Common class name for all accordion titles.\n */\n readonly titleClassName: string;\n\n /**\n * Render the element for a section title.\n *\n * @param title - The data to use for rendering the section title.\n *\n * @returns A element representing the section title.\n */\n createSectionTitle(title: Title): HTMLElement;\n }\n}\n\nnamespace Private {\n /**\n * Create the title HTML element.\n *\n * @param renderer Accordion renderer\n * @param data Widget title\n * @returns Title HTML element\n */\n export function createTitle(\n renderer: AccordionLayout.IRenderer,\n data: Title,\n expanded: boolean = true\n ): HTMLElement {\n const title = renderer.createSectionTitle(data);\n title.style.position = 'absolute';\n title.style.contain = 'strict';\n title.setAttribute('aria-label', `${data.label} Section`);\n title.setAttribute('aria-expanded', expanded ? 'true' : 'false');\n title.setAttribute('aria-controls', data.owner.id);\n if (expanded) {\n title.classList.add('lm-mod-expanded');\n }\n return title;\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { PanelLayout } from './panellayout';\n\nimport { Widget } from './widget';\n\n/**\n * A simple and convenient panel widget class.\n *\n * #### Notes\n * This class is suitable as a base class for implementing a variety of\n * convenience panel widgets, but can also be used directly with CSS to\n * arrange a collection of widgets.\n *\n * This class provides a convenience wrapper around a {@link PanelLayout}.\n */\nexport class Panel extends Widget {\n /**\n * Construct a new panel.\n *\n * @param options - The options for initializing the panel.\n */\n constructor(options: Panel.IOptions = {}) {\n super();\n this.addClass('lm-Panel');\n this.layout = Private.createLayout(options);\n }\n\n /**\n * A read-only array of the widgets in the panel.\n */\n get widgets(): ReadonlyArray {\n return (this.layout as PanelLayout).widgets;\n }\n\n /**\n * Add a widget to the end of the panel.\n *\n * @param widget - The widget to add to the panel.\n *\n * #### Notes\n * If the widget is already contained in the panel, it will be moved.\n */\n addWidget(widget: Widget): void {\n (this.layout as PanelLayout).addWidget(widget);\n }\n\n /**\n * Insert a widget at the specified index.\n *\n * @param index - The index at which to insert the widget.\n *\n * @param widget - The widget to insert into to the panel.\n *\n * #### Notes\n * If the widget is already contained in the panel, it will be moved.\n */\n insertWidget(index: number, widget: Widget): void {\n (this.layout as PanelLayout).insertWidget(index, widget);\n }\n}\n\n/**\n * The namespace for the `Panel` class statics.\n */\nexport namespace Panel {\n /**\n * An options object for creating a panel.\n */\n export interface IOptions {\n /**\n * The panel layout to use for the panel.\n *\n * The default is a new `PanelLayout`.\n */\n layout?: PanelLayout;\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * Create a panel layout for the given panel options.\n */\n export function createLayout(options: Panel.IOptions): PanelLayout {\n return options.layout || new PanelLayout();\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { IDisposable } from '@lumino/disposable';\n\nimport { Drag } from '@lumino/dragdrop';\n\nimport { Message } from '@lumino/messaging';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { Panel } from './panel';\n\nimport { SplitLayout } from './splitlayout';\n\nimport { Widget } from './widget';\n\n/**\n * A panel which arranges its widgets into resizable sections.\n *\n * #### Notes\n * This class provides a convenience wrapper around a {@link SplitLayout}.\n */\nexport class SplitPanel extends Panel {\n /**\n * Construct a new split panel.\n *\n * @param options - The options for initializing the split panel.\n */\n constructor(options: SplitPanel.IOptions = {}) {\n super({ layout: Private.createLayout(options) });\n this.addClass('lm-SplitPanel');\n }\n\n /**\n * Dispose of the resources held by the panel.\n */\n dispose(): void {\n this._releaseMouse();\n super.dispose();\n }\n\n /**\n * Get the layout orientation for the split panel.\n */\n get orientation(): SplitPanel.Orientation {\n return (this.layout as SplitLayout).orientation;\n }\n\n /**\n * Set the layout orientation for the split panel.\n */\n set orientation(value: SplitPanel.Orientation) {\n (this.layout as SplitLayout).orientation = value;\n }\n\n /**\n * Get the content alignment for the split panel.\n *\n * #### Notes\n * This is the alignment of the widgets in the layout direction.\n *\n * The alignment has no effect if the widgets can expand to fill the\n * entire split panel.\n */\n get alignment(): SplitPanel.Alignment {\n return (this.layout as SplitLayout).alignment;\n }\n\n /**\n * Set the content alignment for the split panel.\n *\n * #### Notes\n * This is the alignment of the widgets in the layout direction.\n *\n * The alignment has no effect if the widgets can expand to fill the\n * entire split panel.\n */\n set alignment(value: SplitPanel.Alignment) {\n (this.layout as SplitLayout).alignment = value;\n }\n\n /**\n * Get the inter-element spacing for the split panel.\n */\n get spacing(): number {\n return (this.layout as SplitLayout).spacing;\n }\n\n /**\n * Set the inter-element spacing for the split panel.\n */\n set spacing(value: number) {\n (this.layout as SplitLayout).spacing = value;\n }\n\n /**\n * The renderer used by the split panel.\n */\n get renderer(): SplitPanel.IRenderer {\n return (this.layout as SplitLayout).renderer;\n }\n\n /**\n * A signal emitted when a split handle has moved.\n */\n get handleMoved(): ISignal {\n return this._handleMoved;\n }\n\n /**\n * A read-only array of the split handles in the panel.\n */\n get handles(): ReadonlyArray {\n return (this.layout as SplitLayout).handles;\n }\n\n /**\n * Get the relative sizes of the widgets in the panel.\n *\n * @returns A new array of the relative sizes of the widgets.\n *\n * #### Notes\n * The returned sizes reflect the sizes of the widgets normalized\n * relative to their siblings.\n *\n * This method **does not** measure the DOM nodes.\n */\n relativeSizes(): number[] {\n return (this.layout as SplitLayout).relativeSizes();\n }\n\n /**\n * Set the relative sizes for the widgets in the panel.\n *\n * @param sizes - The relative sizes for the widgets in the panel.\n * @param update - Update the layout after setting relative sizes.\n * Default is True.\n *\n * #### Notes\n * Extra values are ignored, too few will yield an undefined layout.\n *\n * The actual geometry of the DOM nodes is updated asynchronously.\n */\n setRelativeSizes(sizes: number[], update = true): void {\n (this.layout as SplitLayout).setRelativeSizes(sizes, update);\n }\n\n /**\n * Handle the DOM events for the split panel.\n *\n * @param event - The DOM event sent to the panel.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the panel's DOM node. It should\n * not be called directly by user code.\n */\n handleEvent(event: Event): void {\n switch (event.type) {\n case 'pointerdown':\n this._evtPointerDown(event as PointerEvent);\n break;\n case 'pointermove':\n this._evtPointerMove(event as PointerEvent);\n break;\n case 'pointerup':\n this._evtPointerUp(event as PointerEvent);\n break;\n case 'keydown':\n this._evtKeyDown(event as KeyboardEvent);\n break;\n case 'contextmenu':\n event.preventDefault();\n event.stopPropagation();\n break;\n }\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n this.node.addEventListener('pointerdown', this);\n }\n\n /**\n * A message handler invoked on an `'after-detach'` message.\n */\n protected onAfterDetach(msg: Message): void {\n this.node.removeEventListener('pointerdown', this);\n this._releaseMouse();\n }\n\n /**\n * A message handler invoked on a `'child-added'` message.\n */\n protected onChildAdded(msg: Widget.ChildMessage): void {\n msg.child.addClass('lm-SplitPanel-child');\n this._releaseMouse();\n }\n\n /**\n * A message handler invoked on a `'child-removed'` message.\n */\n protected onChildRemoved(msg: Widget.ChildMessage): void {\n msg.child.removeClass('lm-SplitPanel-child');\n this._releaseMouse();\n }\n\n /**\n * Handle the `'keydown'` event for the split panel.\n */\n private _evtKeyDown(event: KeyboardEvent): void {\n // Stop input events during drag.\n if (this._pressData) {\n event.preventDefault();\n event.stopPropagation();\n }\n\n // Release the mouse if `Escape` is pressed.\n if (event.keyCode === 27) {\n this._releaseMouse();\n }\n }\n\n /**\n * Handle the `'pointerdown'` event for the split panel.\n */\n private _evtPointerDown(event: PointerEvent): void {\n // Do nothing if the primary button is not pressed.\n if (event.button !== 0) {\n return;\n }\n\n // Find the handle which contains the target, if any.\n let layout = this.layout as SplitLayout;\n let index = ArrayExt.findFirstIndex(layout.handles, handle => {\n return handle.contains(event.target as HTMLElement);\n });\n\n // Bail early if the mouse press was not on a handle.\n if (index === -1) {\n return;\n }\n\n // Stop the event when a split handle is pressed.\n event.preventDefault();\n event.stopPropagation();\n\n // Add the extra document listeners.\n document.addEventListener('pointerup', this, true);\n document.addEventListener('pointermove', this, true);\n document.addEventListener('keydown', this, true);\n document.addEventListener('contextmenu', this, true);\n\n // Compute the offset delta for the handle press.\n let delta: number;\n let handle = layout.handles[index];\n let rect = handle.getBoundingClientRect();\n if (layout.orientation === 'horizontal') {\n delta = event.clientX - rect.left;\n } else {\n delta = event.clientY - rect.top;\n }\n\n // Override the cursor and store the press data.\n let style = window.getComputedStyle(handle);\n let override = Drag.overrideCursor(style.cursor!);\n this._pressData = { index, delta, override };\n }\n\n /**\n * Handle the `'pointermove'` event for the split panel.\n */\n private _evtPointerMove(event: PointerEvent): void {\n // Stop the event when dragging a split handle.\n event.preventDefault();\n event.stopPropagation();\n\n // Compute the desired offset position for the handle.\n let pos: number;\n let layout = this.layout as SplitLayout;\n let rect = this.node.getBoundingClientRect();\n if (layout.orientation === 'horizontal') {\n pos = event.clientX - rect.left - this._pressData!.delta;\n } else {\n pos = event.clientY - rect.top - this._pressData!.delta;\n }\n\n // Move the handle as close to the desired position as possible.\n layout.moveHandle(this._pressData!.index, pos);\n }\n\n /**\n * Handle the `'pointerup'` event for the split panel.\n */\n private _evtPointerUp(event: PointerEvent): void {\n // Do nothing if the primary button is not released.\n if (event.button !== 0) {\n return;\n }\n\n // Stop the event when releasing a handle.\n event.preventDefault();\n event.stopPropagation();\n\n // Finalize the mouse release.\n this._releaseMouse();\n }\n\n /**\n * Release the mouse grab for the split panel.\n */\n private _releaseMouse(): void {\n // Bail early if no drag is in progress.\n if (!this._pressData) {\n return;\n }\n\n // Clear the override cursor.\n this._pressData.override.dispose();\n this._pressData = null;\n\n // Emit the handle moved signal.\n this._handleMoved.emit();\n\n // Remove the extra document listeners.\n document.removeEventListener('keydown', this, true);\n document.removeEventListener('pointerup', this, true);\n document.removeEventListener('pointermove', this, true);\n document.removeEventListener('contextmenu', this, true);\n }\n\n private _handleMoved = new Signal(this);\n private _pressData: Private.IPressData | null = null;\n}\n\n/**\n * The namespace for the `SplitPanel` class statics.\n */\nexport namespace SplitPanel {\n /**\n * A type alias for a split panel orientation.\n */\n export type Orientation = SplitLayout.Orientation;\n\n /**\n * A type alias for a split panel alignment.\n */\n export type Alignment = SplitLayout.Alignment;\n\n /**\n * A type alias for a split panel renderer.\n */\n export type IRenderer = SplitLayout.IRenderer;\n\n /**\n * An options object for initializing a split panel.\n */\n export interface IOptions {\n /**\n * The renderer to use for the split panel.\n *\n * The default is a shared renderer instance.\n */\n renderer?: IRenderer;\n\n /**\n * The layout orientation of the panel.\n *\n * The default is `'horizontal'`.\n */\n orientation?: Orientation;\n\n /**\n * The content alignment of the panel.\n *\n * The default is `'start'`.\n */\n alignment?: Alignment;\n\n /**\n * The spacing between items in the panel.\n *\n * The default is `4`.\n */\n spacing?: number;\n\n /**\n * The split layout to use for the split panel.\n *\n * If this is provided, the other options are ignored.\n *\n * The default is a new `SplitLayout`.\n */\n layout?: SplitLayout;\n }\n\n /**\n * The default implementation of `IRenderer`.\n */\n export class Renderer implements IRenderer {\n /**\n * Create a new handle for use with a split panel.\n *\n * @returns A new handle element for a split panel.\n */\n createHandle(): HTMLDivElement {\n let handle = document.createElement('div');\n handle.className = 'lm-SplitPanel-handle';\n return handle;\n }\n }\n\n /**\n * The default `Renderer` instance.\n */\n export const defaultRenderer = new Renderer();\n\n /**\n * Get the split panel stretch factor for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The split panel stretch factor for the widget.\n */\n export function getStretch(widget: Widget): number {\n return SplitLayout.getStretch(widget);\n }\n\n /**\n * Set the split panel stretch factor for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the stretch factor.\n */\n export function setStretch(widget: Widget, value: number): void {\n SplitLayout.setStretch(widget, value);\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * An object which holds mouse press data.\n */\n export interface IPressData {\n /**\n * The index of the pressed handle.\n */\n index: number;\n\n /**\n * The offset of the press in handle coordinates.\n */\n delta: number;\n\n /**\n * The disposable which will clear the override cursor.\n */\n override: IDisposable;\n }\n\n /**\n * Create a split layout for the given panel options.\n */\n export function createLayout(options: SplitPanel.IOptions): SplitLayout {\n return (\n options.layout ||\n new SplitLayout({\n renderer: options.renderer || SplitPanel.defaultRenderer,\n orientation: options.orientation,\n alignment: options.alignment,\n spacing: options.spacing\n })\n );\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n\nimport { ArrayExt } from '@lumino/algorithm';\nimport { Message } from '@lumino/messaging';\nimport { ISignal, Signal } from '@lumino/signaling';\nimport { AccordionLayout } from './accordionlayout';\nimport { SplitLayout } from './splitlayout';\nimport { SplitPanel } from './splitpanel';\nimport { Title } from './title';\nimport { Widget } from './widget';\n\n/**\n * A panel which arranges its widgets into resizable sections separated by a title widget.\n *\n * #### Notes\n * This class provides a convenience wrapper around {@link AccordionLayout}.\n *\n * See also the related [example](../../examples/accordionpanel/index.html) and\n * its [source](https://github.com/jupyterlab/lumino/tree/main/examples/example-accordionpanel).\n */\nexport class AccordionPanel extends SplitPanel {\n /**\n * Construct a new accordion panel.\n *\n * @param options - The options for initializing the accordion panel.\n *\n */\n constructor(options: AccordionPanel.IOptions = {}) {\n super({ ...options, layout: Private.createLayout(options) });\n this.addClass('lm-AccordionPanel');\n }\n\n /**\n * The renderer used by the accordion panel.\n */\n get renderer(): AccordionPanel.IRenderer {\n return (this.layout as AccordionLayout).renderer;\n }\n\n /**\n * The section title space.\n *\n * This is the height if the panel is vertical and the width if it is\n * horizontal.\n */\n get titleSpace(): number {\n return (this.layout as AccordionLayout).titleSpace;\n }\n set titleSpace(value: number) {\n (this.layout as AccordionLayout).titleSpace = value;\n }\n\n /**\n * A read-only array of the section titles in the panel.\n */\n get titles(): ReadonlyArray {\n return (this.layout as AccordionLayout).titles;\n }\n\n /**\n * A signal emitted when a widget of the AccordionPanel is collapsed or expanded.\n */\n get expansionToggled(): ISignal {\n return this._expansionToggled;\n }\n\n /**\n * Add a widget to the end of the panel.\n *\n * @param widget - The widget to add to the panel.\n *\n * #### Notes\n * If the widget is already contained in the panel, it will be moved.\n */\n addWidget(widget: Widget): void {\n super.addWidget(widget);\n widget.title.changed.connect(this._onTitleChanged, this);\n }\n\n /**\n * Collapse the widget at position `index`.\n *\n * #### Notes\n * If no widget is found for `index`, this will bail.\n *\n * @param index Widget index\n */\n collapse(index: number): void {\n const widget = (this.layout as AccordionLayout).widgets[index];\n\n if (widget && !widget.isHidden) {\n this._toggleExpansion(index);\n }\n }\n\n /**\n * Expand the widget at position `index`.\n *\n * #### Notes\n * If no widget is found for `index`, this will bail.\n *\n * @param index Widget index\n */\n expand(index: number): void {\n const widget = (this.layout as AccordionLayout).widgets[index];\n\n if (widget && widget.isHidden) {\n this._toggleExpansion(index);\n }\n }\n\n /**\n * Insert a widget at the specified index.\n *\n * @param index - The index at which to insert the widget.\n *\n * @param widget - The widget to insert into to the panel.\n *\n * #### Notes\n * If the widget is already contained in the panel, it will be moved.\n */\n insertWidget(index: number, widget: Widget): void {\n super.insertWidget(index, widget);\n widget.title.changed.connect(this._onTitleChanged, this);\n }\n\n /**\n * Handle the DOM events for the accordion panel.\n *\n * @param event - The DOM event sent to the panel.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the panel's DOM node. It should\n * not be called directly by user code.\n */\n handleEvent(event: Event): void {\n super.handleEvent(event);\n switch (event.type) {\n case 'click':\n this._evtClick(event as MouseEvent);\n break;\n case 'keydown':\n this._eventKeyDown(event as KeyboardEvent);\n break;\n }\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n this.node.addEventListener('click', this);\n this.node.addEventListener('keydown', this);\n super.onBeforeAttach(msg);\n }\n\n /**\n * A message handler invoked on an `'after-detach'` message.\n */\n protected onAfterDetach(msg: Message): void {\n super.onAfterDetach(msg);\n this.node.removeEventListener('click', this);\n this.node.removeEventListener('keydown', this);\n }\n\n /**\n * Handle the `changed` signal of a title object.\n */\n private _onTitleChanged(sender: Title): void {\n const index = ArrayExt.findFirstIndex(this.widgets, widget => {\n return widget.contains(sender.owner);\n });\n\n if (index >= 0) {\n (this.layout as AccordionLayout).updateTitle(index, sender.owner);\n this.update();\n }\n }\n\n /**\n * Compute the size of widgets in this panel on the title click event.\n * On closing, the size of the widget is cached and we will try to expand\n * the last opened widget.\n * On opening, we will use the cached size if it is available to restore the\n * widget.\n * In both cases, if we can not compute the size of widgets, we will let\n * `SplitLayout` decide.\n *\n * @param index - The index of widget to be opened of closed\n *\n * @returns Relative size of widgets in this panel, if this size can\n * not be computed, return `undefined`\n */\n private _computeWidgetSize(index: number): number[] | undefined {\n const layout = this.layout as AccordionLayout;\n\n const widget = layout.widgets[index];\n if (!widget) {\n return undefined;\n }\n const isHidden = widget.isHidden;\n const widgetSizes = layout.absoluteSizes();\n const delta = (isHidden ? -1 : 1) * this.spacing;\n const totalSize = widgetSizes.reduce(\n (prev: number, curr: number) => prev + curr\n );\n\n let newSize = [...widgetSizes];\n\n if (!isHidden) {\n // Hide the widget\n const currentSize = widgetSizes[index];\n\n this._widgetSizesCache.set(widget, currentSize);\n newSize[index] = 0;\n\n const widgetToCollapse = newSize.map(sz => sz > 0).lastIndexOf(true);\n if (widgetToCollapse === -1) {\n // All widget are closed, let the `SplitLayout` compute widget sizes.\n return undefined;\n }\n\n newSize[widgetToCollapse] =\n widgetSizes[widgetToCollapse] + currentSize + delta;\n } else {\n // Show the widget\n const previousSize = this._widgetSizesCache.get(widget);\n if (!previousSize) {\n // Previous size is unavailable, let the `SplitLayout` compute widget sizes.\n return undefined;\n }\n newSize[index] += previousSize;\n\n const widgetToCollapse = newSize\n .map(sz => sz - previousSize > 0)\n .lastIndexOf(true);\n if (widgetToCollapse === -1) {\n // Can not reduce the size of one widget, reduce all opened widgets\n // proportionally with its size.\n newSize.forEach((_, idx) => {\n if (idx !== index) {\n newSize[idx] -=\n (widgetSizes[idx] / totalSize) * (previousSize - delta);\n }\n });\n } else {\n newSize[widgetToCollapse] -= previousSize - delta;\n }\n }\n return newSize.map(sz => sz / (totalSize + delta));\n }\n /**\n * Handle the `'click'` event for the accordion panel\n */\n private _evtClick(event: MouseEvent): void {\n const target = event.target as HTMLElement | null;\n\n if (target) {\n const index = ArrayExt.findFirstIndex(this.titles, title => {\n return title.contains(target);\n });\n\n if (index >= 0) {\n event.preventDefault();\n event.stopPropagation();\n this._toggleExpansion(index);\n }\n }\n }\n\n /**\n * Handle the `'keydown'` event for the accordion panel.\n */\n private _eventKeyDown(event: KeyboardEvent): void {\n if (event.defaultPrevented) {\n return;\n }\n\n const target = event.target as HTMLElement | null;\n let handled = false;\n if (target) {\n const index = ArrayExt.findFirstIndex(this.titles, title => {\n return title.contains(target);\n });\n\n if (index >= 0) {\n const keyCode = event.keyCode.toString();\n\n // If Space or Enter is pressed on title, emulate click event\n if (event.key.match(/Space|Enter/) || keyCode.match(/13|32/)) {\n target.click();\n handled = true;\n } else if (\n this.orientation === 'horizontal'\n ? event.key.match(/ArrowLeft|ArrowRight/) || keyCode.match(/37|39/)\n : event.key.match(/ArrowUp|ArrowDown/) || keyCode.match(/38|40/)\n ) {\n // If Up or Down (for vertical) / Left or Right (for horizontal) is pressed on title, loop on titles\n const direction =\n event.key.match(/ArrowLeft|ArrowUp/) || keyCode.match(/37|38/)\n ? -1\n : 1;\n const length = this.titles.length;\n const newIndex = (index + length + direction) % length;\n\n this.titles[newIndex].focus();\n handled = true;\n } else if (event.key === 'End' || keyCode === '35') {\n // If End is pressed on title, focus on the last title\n this.titles[this.titles.length - 1].focus();\n handled = true;\n } else if (event.key === 'Home' || keyCode === '36') {\n // If Home is pressed on title, focus on the first title\n this.titles[0].focus();\n handled = true;\n }\n }\n\n if (handled) {\n event.preventDefault();\n }\n }\n }\n\n private _toggleExpansion(index: number) {\n const title = this.titles[index];\n const widget = (this.layout as AccordionLayout).widgets[index];\n\n const newSize = this._computeWidgetSize(index);\n if (newSize) {\n this.setRelativeSizes(newSize, false);\n }\n\n if (widget.isHidden) {\n title.classList.add('lm-mod-expanded');\n title.setAttribute('aria-expanded', 'true');\n widget.show();\n } else {\n title.classList.remove('lm-mod-expanded');\n title.setAttribute('aria-expanded', 'false');\n widget.hide();\n }\n\n // Emit the expansion state signal.\n this._expansionToggled.emit(index);\n }\n\n private _widgetSizesCache: WeakMap = new WeakMap();\n private _expansionToggled = new Signal(this);\n}\n\n/**\n * The namespace for the `AccordionPanel` class statics.\n */\nexport namespace AccordionPanel {\n /**\n * A type alias for a accordion panel orientation.\n */\n export type Orientation = SplitLayout.Orientation;\n\n /**\n * A type alias for a accordion panel alignment.\n */\n export type Alignment = SplitLayout.Alignment;\n\n /**\n * A type alias for a accordion panel renderer.\n */\n export type IRenderer = AccordionLayout.IRenderer;\n\n /**\n * An options object for initializing a accordion panel.\n */\n export interface IOptions extends Partial {\n /**\n * The accordion layout to use for the accordion panel.\n *\n * If this is provided, the other options are ignored.\n *\n * The default is a new `AccordionLayout`.\n */\n layout?: AccordionLayout;\n }\n\n /**\n * The default implementation of `IRenderer`.\n */\n export class Renderer extends SplitPanel.Renderer implements IRenderer {\n constructor() {\n super();\n this._uuid = ++Renderer._nInstance;\n }\n /**\n * A selector which matches any title node in the accordion.\n */\n readonly titleClassName = 'lm-AccordionPanel-title';\n\n /**\n * Render the collapse indicator for a section title.\n *\n * @param data - The data to use for rendering the section title.\n *\n * @returns A element representing the collapse indicator.\n */\n createCollapseIcon(data: Title): HTMLElement {\n return document.createElement('span');\n }\n\n /**\n * Render the element for a section title.\n *\n * @param data - The data to use for rendering the section title.\n *\n * @returns A element representing the section title.\n */\n createSectionTitle(data: Title): HTMLElement {\n const handle = document.createElement('h3');\n handle.setAttribute('tabindex', '0');\n handle.id = this.createTitleKey(data);\n handle.className = this.titleClassName;\n for (const aData in data.dataset) {\n handle.dataset[aData] = data.dataset[aData];\n }\n\n const collapser = handle.appendChild(this.createCollapseIcon(data));\n collapser.className = 'lm-AccordionPanel-titleCollapser';\n\n const label = handle.appendChild(document.createElement('span'));\n label.className = 'lm-AccordionPanel-titleLabel';\n label.textContent = data.label;\n label.title = data.caption || data.label;\n\n return handle;\n }\n\n /**\n * Create a unique render key for the title.\n *\n * @param data - The data to use for the title.\n *\n * @returns The unique render key for the title.\n *\n * #### Notes\n * This method caches the key against the section title the first time\n * the key is generated.\n */\n createTitleKey(data: Title): string {\n let key = this._titleKeys.get(data);\n if (key === undefined) {\n key = `title-key-${this._uuid}-${this._titleID++}`;\n this._titleKeys.set(data, key);\n }\n return key;\n }\n\n private static _nInstance = 0;\n private readonly _uuid: number;\n private _titleID = 0;\n private _titleKeys = new WeakMap, string>();\n }\n\n /**\n * The default `Renderer` instance.\n */\n export const defaultRenderer = new Renderer();\n}\n\nnamespace Private {\n /**\n * Create an accordion layout for the given panel options.\n *\n * @param options Panel options\n * @returns Panel layout\n */\n export function createLayout(\n options: AccordionPanel.IOptions\n ): AccordionLayout {\n return (\n options.layout ||\n new AccordionLayout({\n renderer: options.renderer || AccordionPanel.defaultRenderer,\n orientation: options.orientation,\n alignment: options.alignment,\n spacing: options.spacing,\n titleSpace: options.titleSpace\n })\n );\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { AttachedProperty } from '@lumino/properties';\n\nimport { BoxEngine, BoxSizer } from './boxengine';\n\nimport { LayoutItem } from './layout';\n\nimport { PanelLayout } from './panellayout';\n\nimport Utils from './utils';\n\nimport { Widget } from './widget';\n\n/**\n * A layout which arranges its widgets in a single row or column.\n */\nexport class BoxLayout extends PanelLayout {\n /**\n * Construct a new box layout.\n *\n * @param options - The options for initializing the layout.\n */\n constructor(options: BoxLayout.IOptions = {}) {\n super();\n if (options.direction !== undefined) {\n this._direction = options.direction;\n }\n if (options.alignment !== undefined) {\n this._alignment = options.alignment;\n }\n if (options.spacing !== undefined) {\n this._spacing = Utils.clampDimension(options.spacing);\n }\n }\n\n /**\n * Dispose of the resources held by the layout.\n */\n dispose(): void {\n // Dispose of the layout items.\n for (const item of this._items) {\n item.dispose();\n }\n\n // Clear the layout state.\n this._box = null;\n this._items.length = 0;\n this._sizers.length = 0;\n\n // Dispose of the rest of the layout.\n super.dispose();\n }\n\n /**\n * Get the layout direction for the box layout.\n */\n get direction(): BoxLayout.Direction {\n return this._direction;\n }\n\n /**\n * Set the layout direction for the box layout.\n */\n set direction(value: BoxLayout.Direction) {\n if (this._direction === value) {\n return;\n }\n this._direction = value;\n if (!this.parent) {\n return;\n }\n this.parent.dataset['direction'] = value;\n this.parent.fit();\n }\n\n /**\n * Get the content alignment for the box layout.\n *\n * #### Notes\n * This is the alignment of the widgets in the layout direction.\n *\n * The alignment has no effect if the widgets can expand to fill the\n * entire box layout.\n */\n get alignment(): BoxLayout.Alignment {\n return this._alignment;\n }\n\n /**\n * Set the content alignment for the box layout.\n *\n * #### Notes\n * This is the alignment of the widgets in the layout direction.\n *\n * The alignment has no effect if the widgets can expand to fill the\n * entire box layout.\n */\n set alignment(value: BoxLayout.Alignment) {\n if (this._alignment === value) {\n return;\n }\n this._alignment = value;\n if (!this.parent) {\n return;\n }\n this.parent.dataset['alignment'] = value;\n this.parent.update();\n }\n\n /**\n * Get the inter-element spacing for the box layout.\n */\n get spacing(): number {\n return this._spacing;\n }\n\n /**\n * Set the inter-element spacing for the box layout.\n */\n set spacing(value: number) {\n value = Utils.clampDimension(value);\n if (this._spacing === value) {\n return;\n }\n this._spacing = value;\n if (!this.parent) {\n return;\n }\n this.parent.fit();\n }\n\n /**\n * Perform layout initialization which requires the parent widget.\n */\n protected init(): void {\n this.parent!.dataset['direction'] = this.direction;\n this.parent!.dataset['alignment'] = this.alignment;\n super.init();\n }\n\n /**\n * Attach a widget to the parent's DOM node.\n *\n * @param index - The current index of the widget in the layout.\n *\n * @param widget - The widget to attach to the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected attachWidget(index: number, widget: Widget): void {\n // Create and add a new layout item for the widget.\n ArrayExt.insert(this._items, index, new LayoutItem(widget));\n\n // Create and add a new sizer for the widget.\n ArrayExt.insert(this._sizers, index, new BoxSizer());\n\n // Send a `'before-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n }\n\n // Add the widget's node to the parent.\n this.parent!.node.appendChild(widget.node);\n\n // Send an `'after-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n\n // Post a fit request for the parent widget.\n this.parent!.fit();\n }\n\n /**\n * Move a widget in the parent's DOM node.\n *\n * @param fromIndex - The previous index of the widget in the layout.\n *\n * @param toIndex - The current index of the widget in the layout.\n *\n * @param widget - The widget to move in the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected moveWidget(\n fromIndex: number,\n toIndex: number,\n widget: Widget\n ): void {\n // Move the layout item for the widget.\n ArrayExt.move(this._items, fromIndex, toIndex);\n\n // Move the sizer for the widget.\n ArrayExt.move(this._sizers, fromIndex, toIndex);\n\n // Post an update request for the parent widget.\n this.parent!.update();\n }\n\n /**\n * Detach a widget from the parent's DOM node.\n *\n * @param index - The previous index of the widget in the layout.\n *\n * @param widget - The widget to detach from the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected detachWidget(index: number, widget: Widget): void {\n // Remove the layout item for the widget.\n let item = ArrayExt.removeAt(this._items, index);\n\n // Remove the sizer for the widget.\n ArrayExt.removeAt(this._sizers, index);\n\n // Send a `'before-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n }\n\n // Remove the widget's node from the parent.\n this.parent!.node.removeChild(widget.node);\n\n // Send an `'after-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n\n // Dispose of the layout item.\n item!.dispose();\n\n // Post a fit request for the parent widget.\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'before-show'` message.\n */\n protected onBeforeShow(msg: Message): void {\n super.onBeforeShow(msg);\n this.parent!.update();\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n super.onBeforeAttach(msg);\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-shown'` message.\n */\n protected onChildShown(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-hidden'` message.\n */\n protected onChildHidden(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'resize'` message.\n */\n protected onResize(msg: Widget.ResizeMessage): void {\n if (this.parent!.isVisible) {\n this._update(msg.width, msg.height);\n }\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n protected onUpdateRequest(msg: Message): void {\n if (this.parent!.isVisible) {\n this._update(-1, -1);\n }\n }\n\n /**\n * A message handler invoked on a `'fit-request'` message.\n */\n protected onFitRequest(msg: Message): void {\n if (this.parent!.isAttached) {\n this._fit();\n }\n }\n\n /**\n * Fit the layout to the total size required by the widgets.\n */\n private _fit(): void {\n // Compute the visible item count.\n let nVisible = 0;\n for (let i = 0, n = this._items.length; i < n; ++i) {\n nVisible += +!this._items[i].isHidden;\n }\n\n // Update the fixed space for the visible items.\n this._fixed = this._spacing * Math.max(0, nVisible - 1);\n\n // Setup the computed minimum size.\n let horz = Private.isHorizontal(this._direction);\n let minW = horz ? this._fixed : 0;\n let minH = horz ? 0 : this._fixed;\n\n // Update the sizers and computed minimum size.\n for (let i = 0, n = this._items.length; i < n; ++i) {\n // Fetch the item and corresponding box sizer.\n let item = this._items[i];\n let sizer = this._sizers[i];\n\n // If the item is hidden, it should consume zero size.\n if (item.isHidden) {\n sizer.minSize = 0;\n sizer.maxSize = 0;\n continue;\n }\n\n // Update the size limits for the item.\n item.fit();\n\n // Update the size basis and stretch factor.\n sizer.sizeHint = BoxLayout.getSizeBasis(item.widget);\n sizer.stretch = BoxLayout.getStretch(item.widget);\n\n // Update the sizer limits and computed min size.\n if (horz) {\n sizer.minSize = item.minWidth;\n sizer.maxSize = item.maxWidth;\n minW += item.minWidth;\n minH = Math.max(minH, item.minHeight);\n } else {\n sizer.minSize = item.minHeight;\n sizer.maxSize = item.maxHeight;\n minH += item.minHeight;\n minW = Math.max(minW, item.minWidth);\n }\n }\n\n // Update the box sizing and add it to the computed min size.\n let box = (this._box = ElementExt.boxSizing(this.parent!.node));\n minW += box.horizontalSum;\n minH += box.verticalSum;\n\n // Update the parent's min size constraints.\n let style = this.parent!.node.style;\n style.minWidth = `${minW}px`;\n style.minHeight = `${minH}px`;\n\n // Set the dirty flag to ensure only a single update occurs.\n this._dirty = true;\n\n // Notify the ancestor that it should fit immediately. This may\n // cause a resize of the parent, fulfilling the required update.\n if (this.parent!.parent) {\n MessageLoop.sendMessage(this.parent!.parent!, Widget.Msg.FitRequest);\n }\n\n // If the dirty flag is still set, the parent was not resized.\n // Trigger the required update on the parent widget immediately.\n if (this._dirty) {\n MessageLoop.sendMessage(this.parent!, Widget.Msg.UpdateRequest);\n }\n }\n\n /**\n * Update the layout position and size of the widgets.\n *\n * The parent offset dimensions should be `-1` if unknown.\n */\n private _update(offsetWidth: number, offsetHeight: number): void {\n // Clear the dirty flag to indicate the update occurred.\n this._dirty = false;\n\n // Compute the visible item count.\n let nVisible = 0;\n for (let i = 0, n = this._items.length; i < n; ++i) {\n nVisible += +!this._items[i].isHidden;\n }\n\n // Bail early if there are no visible items to layout.\n if (nVisible === 0) {\n return;\n }\n\n // Measure the parent if the offset dimensions are unknown.\n if (offsetWidth < 0) {\n offsetWidth = this.parent!.node.offsetWidth;\n }\n if (offsetHeight < 0) {\n offsetHeight = this.parent!.node.offsetHeight;\n }\n\n // Ensure the parent box sizing data is computed.\n if (!this._box) {\n this._box = ElementExt.boxSizing(this.parent!.node);\n }\n\n // Compute the layout area adjusted for border and padding.\n let top = this._box.paddingTop;\n let left = this._box.paddingLeft;\n let width = offsetWidth - this._box.horizontalSum;\n let height = offsetHeight - this._box.verticalSum;\n\n // Distribute the layout space and adjust the start position.\n let delta: number;\n switch (this._direction) {\n case 'left-to-right':\n delta = BoxEngine.calc(this._sizers, Math.max(0, width - this._fixed));\n break;\n case 'top-to-bottom':\n delta = BoxEngine.calc(this._sizers, Math.max(0, height - this._fixed));\n break;\n case 'right-to-left':\n delta = BoxEngine.calc(this._sizers, Math.max(0, width - this._fixed));\n left += width;\n break;\n case 'bottom-to-top':\n delta = BoxEngine.calc(this._sizers, Math.max(0, height - this._fixed));\n top += height;\n break;\n default:\n throw 'unreachable';\n }\n\n // Setup the variables for justification and alignment offset.\n let extra = 0;\n let offset = 0;\n\n // Account for alignment if there is extra layout space.\n if (delta > 0) {\n switch (this._alignment) {\n case 'start':\n break;\n case 'center':\n extra = 0;\n offset = delta / 2;\n break;\n case 'end':\n extra = 0;\n offset = delta;\n break;\n case 'justify':\n extra = delta / nVisible;\n offset = 0;\n break;\n default:\n throw 'unreachable';\n }\n }\n\n // Layout the items using the computed box sizes.\n for (let i = 0, n = this._items.length; i < n; ++i) {\n // Fetch the item.\n let item = this._items[i];\n\n // Ignore hidden items.\n if (item.isHidden) {\n continue;\n }\n\n // Fetch the computed size for the widget.\n let size = this._sizers[i].size;\n\n // Update the widget geometry and advance the relevant edge.\n switch (this._direction) {\n case 'left-to-right':\n item.update(left + offset, top, size + extra, height);\n left += size + extra + this._spacing;\n break;\n case 'top-to-bottom':\n item.update(left, top + offset, width, size + extra);\n top += size + extra + this._spacing;\n break;\n case 'right-to-left':\n item.update(left - offset - size - extra, top, size + extra, height);\n left -= size + extra + this._spacing;\n break;\n case 'bottom-to-top':\n item.update(left, top - offset - size - extra, width, size + extra);\n top -= size + extra + this._spacing;\n break;\n default:\n throw 'unreachable';\n }\n }\n }\n\n private _fixed = 0;\n private _spacing = 4;\n private _dirty = false;\n private _sizers: BoxSizer[] = [];\n private _items: LayoutItem[] = [];\n private _box: ElementExt.IBoxSizing | null = null;\n private _alignment: BoxLayout.Alignment = 'start';\n private _direction: BoxLayout.Direction = 'top-to-bottom';\n}\n\n/**\n * The namespace for the `BoxLayout` class statics.\n */\nexport namespace BoxLayout {\n /**\n * A type alias for a box layout direction.\n */\n export type Direction =\n | 'left-to-right'\n | 'right-to-left'\n | 'top-to-bottom'\n | 'bottom-to-top';\n\n /**\n * A type alias for a box layout alignment.\n */\n export type Alignment = 'start' | 'center' | 'end' | 'justify';\n\n /**\n * An options object for initializing a box layout.\n */\n export interface IOptions {\n /**\n * The direction of the layout.\n *\n * The default is `'top-to-bottom'`.\n */\n direction?: Direction;\n\n /**\n * The content alignment of the layout.\n *\n * The default is `'start'`.\n */\n alignment?: Alignment;\n\n /**\n * The spacing between items in the layout.\n *\n * The default is `4`.\n */\n spacing?: number;\n }\n\n /**\n * Get the box layout stretch factor for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The box layout stretch factor for the widget.\n */\n export function getStretch(widget: Widget): number {\n return Private.stretchProperty.get(widget);\n }\n\n /**\n * Set the box layout stretch factor for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the stretch factor.\n */\n export function setStretch(widget: Widget, value: number): void {\n Private.stretchProperty.set(widget, value);\n }\n\n /**\n * Get the box layout size basis for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The box layout size basis for the widget.\n */\n export function getSizeBasis(widget: Widget): number {\n return Private.sizeBasisProperty.get(widget);\n }\n\n /**\n * Set the box layout size basis for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the size basis.\n */\n export function setSizeBasis(widget: Widget, value: number): void {\n Private.sizeBasisProperty.set(widget, value);\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * The property descriptor for a widget stretch factor.\n */\n export const stretchProperty = new AttachedProperty({\n name: 'stretch',\n create: () => 0,\n coerce: (owner, value) => Math.max(0, Math.floor(value)),\n changed: onChildSizingChanged\n });\n\n /**\n * The property descriptor for a widget size basis.\n */\n export const sizeBasisProperty = new AttachedProperty({\n name: 'sizeBasis',\n create: () => 0,\n coerce: (owner, value) => Math.max(0, Math.floor(value)),\n changed: onChildSizingChanged\n });\n\n /**\n * Test whether a direction has horizontal orientation.\n */\n export function isHorizontal(dir: BoxLayout.Direction): boolean {\n return dir === 'left-to-right' || dir === 'right-to-left';\n }\n\n /**\n * Clamp a spacing value to an integer >= 0.\n */\n export function clampSpacing(value: number): number {\n return Math.max(0, Math.floor(value));\n }\n\n /**\n * The change handler for the attached sizing properties.\n */\n function onChildSizingChanged(child: Widget): void {\n if (child.parent && child.parent.layout instanceof BoxLayout) {\n child.parent.fit();\n }\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { BoxLayout } from './boxlayout';\n\nimport { Panel } from './panel';\n\nimport { Widget } from './widget';\n\n/**\n * A panel which arranges its widgets in a single row or column.\n *\n * #### Notes\n * This class provides a convenience wrapper around a {@link BoxLayout}.\n */\nexport class BoxPanel extends Panel {\n /**\n * Construct a new box panel.\n *\n * @param options - The options for initializing the box panel.\n */\n constructor(options: BoxPanel.IOptions = {}) {\n super({ layout: Private.createLayout(options) });\n this.addClass('lm-BoxPanel');\n }\n\n /**\n * Get the layout direction for the box panel.\n */\n get direction(): BoxPanel.Direction {\n return (this.layout as BoxLayout).direction;\n }\n\n /**\n * Set the layout direction for the box panel.\n */\n set direction(value: BoxPanel.Direction) {\n (this.layout as BoxLayout).direction = value;\n }\n\n /**\n * Get the content alignment for the box panel.\n *\n * #### Notes\n * This is the alignment of the widgets in the layout direction.\n *\n * The alignment has no effect if the widgets can expand to fill the\n * entire box layout.\n */\n get alignment(): BoxPanel.Alignment {\n return (this.layout as BoxLayout).alignment;\n }\n\n /**\n * Set the content alignment for the box panel.\n *\n * #### Notes\n * This is the alignment of the widgets in the layout direction.\n *\n * The alignment has no effect if the widgets can expand to fill the\n * entire box layout.\n */\n set alignment(value: BoxPanel.Alignment) {\n (this.layout as BoxLayout).alignment = value;\n }\n\n /**\n * Get the inter-element spacing for the box panel.\n */\n get spacing(): number {\n return (this.layout as BoxLayout).spacing;\n }\n\n /**\n * Set the inter-element spacing for the box panel.\n */\n set spacing(value: number) {\n (this.layout as BoxLayout).spacing = value;\n }\n\n /**\n * A message handler invoked on a `'child-added'` message.\n */\n protected onChildAdded(msg: Widget.ChildMessage): void {\n msg.child.addClass('lm-BoxPanel-child');\n }\n\n /**\n * A message handler invoked on a `'child-removed'` message.\n */\n protected onChildRemoved(msg: Widget.ChildMessage): void {\n msg.child.removeClass('lm-BoxPanel-child');\n }\n}\n\n/**\n * The namespace for the `BoxPanel` class statics.\n */\nexport namespace BoxPanel {\n /**\n * A type alias for a box panel direction.\n */\n export type Direction = BoxLayout.Direction;\n\n /**\n * A type alias for a box panel alignment.\n */\n export type Alignment = BoxLayout.Alignment;\n\n /**\n * An options object for initializing a box panel.\n */\n export interface IOptions {\n /**\n * The layout direction of the panel.\n *\n * Possible values are documented in {@link BoxLayout.Direction}.\n *\n * The default is `'top-to-bottom'`.\n */\n direction?: Direction;\n\n /**\n * The content alignment of the panel.\n *\n * Possible values are documented in {@link BoxLayout.Alignment}.\n *\n * The default is `'start'`.\n */\n alignment?: Alignment;\n\n /**\n * The spacing between items in the panel.\n *\n * The default is `4`.\n */\n spacing?: number;\n\n /**\n * The box layout to use for the box panel.\n *\n * If this is provided, the other options are ignored.\n *\n * The default is a new `BoxLayout`.\n */\n layout?: BoxLayout;\n }\n\n /**\n * Get the box panel stretch factor for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The box panel stretch factor for the widget.\n */\n export function getStretch(widget: Widget): number {\n return BoxLayout.getStretch(widget);\n }\n\n /**\n * Set the box panel stretch factor for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the stretch factor.\n */\n export function setStretch(widget: Widget, value: number): void {\n BoxLayout.setStretch(widget, value);\n }\n\n /**\n * Get the box panel size basis for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The box panel size basis for the widget.\n */\n export function getSizeBasis(widget: Widget): number {\n return BoxLayout.getSizeBasis(widget);\n }\n\n /**\n * Set the box panel size basis for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the size basis.\n */\n export function setSizeBasis(widget: Widget, value: number): void {\n BoxLayout.setSizeBasis(widget, value);\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * Create a box layout for the given panel options.\n */\n export function createLayout(options: BoxPanel.IOptions): BoxLayout {\n return options.layout || new BoxLayout(options);\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt, StringExt } from '@lumino/algorithm';\n\nimport { JSONExt, ReadonlyJSONObject } from '@lumino/coreutils';\n\nimport { CommandRegistry } from '@lumino/commands';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message } from '@lumino/messaging';\n\nimport {\n ElementDataset,\n h,\n VirtualDOM,\n VirtualElement\n} from '@lumino/virtualdom';\n\nimport { Widget } from './widget';\n\n/**\n * A widget which displays command items as a searchable palette.\n */\nexport class CommandPalette extends Widget {\n /**\n * Construct a new command palette.\n *\n * @param options - The options for initializing the palette.\n */\n constructor(options: CommandPalette.IOptions) {\n super({ node: Private.createNode() });\n this.addClass('lm-CommandPalette');\n this.setFlag(Widget.Flag.DisallowLayout);\n this.commands = options.commands;\n this.renderer = options.renderer || CommandPalette.defaultRenderer;\n this.commands.commandChanged.connect(this._onGenericChange, this);\n this.commands.keyBindingChanged.connect(this._onGenericChange, this);\n }\n\n /**\n * Dispose of the resources held by the widget.\n */\n dispose(): void {\n this._items.length = 0;\n this._results = null;\n super.dispose();\n }\n\n /**\n * The command registry used by the command palette.\n */\n readonly commands: CommandRegistry;\n\n /**\n * The renderer used by the command palette.\n */\n readonly renderer: CommandPalette.IRenderer;\n\n /**\n * The command palette search node.\n *\n * #### Notes\n * This is the node which contains the search-related elements.\n */\n get searchNode(): HTMLDivElement {\n return this.node.getElementsByClassName(\n 'lm-CommandPalette-search'\n )[0] as HTMLDivElement;\n }\n\n /**\n * The command palette input node.\n *\n * #### Notes\n * This is the actual input node for the search area.\n */\n get inputNode(): HTMLInputElement {\n return this.node.getElementsByClassName(\n 'lm-CommandPalette-input'\n )[0] as HTMLInputElement;\n }\n\n /**\n * The command palette content node.\n *\n * #### Notes\n * This is the node which holds the command item nodes.\n *\n * Modifying this node directly can lead to undefined behavior.\n */\n get contentNode(): HTMLUListElement {\n return this.node.getElementsByClassName(\n 'lm-CommandPalette-content'\n )[0] as HTMLUListElement;\n }\n\n /**\n * A read-only array of the command items in the palette.\n */\n get items(): ReadonlyArray {\n return this._items;\n }\n\n /**\n * Add a command item to the command palette.\n *\n * @param options - The options for creating the command item.\n *\n * @returns The command item added to the palette.\n */\n addItem(options: CommandPalette.IItemOptions): CommandPalette.IItem {\n // Create a new command item for the options.\n let item = Private.createItem(this.commands, options);\n\n // Add the item to the array.\n this._items.push(item);\n\n // Refresh the search results.\n this.refresh();\n\n // Return the item added to the palette.\n return item;\n }\n\n /**\n * Adds command items to the command palette.\n *\n * @param items - An array of options for creating each command item.\n *\n * @returns The command items added to the palette.\n */\n addItems(items: CommandPalette.IItemOptions[]): CommandPalette.IItem[] {\n const newItems = items.map(item => Private.createItem(this.commands, item));\n newItems.forEach(item => this._items.push(item));\n this.refresh();\n return newItems;\n }\n\n /**\n * Remove an item from the command palette.\n *\n * @param item - The item to remove from the palette.\n *\n * #### Notes\n * This is a no-op if the item is not in the palette.\n */\n removeItem(item: CommandPalette.IItem): void {\n this.removeItemAt(this._items.indexOf(item));\n }\n\n /**\n * Remove the item at a given index from the command palette.\n *\n * @param index - The index of the item to remove.\n *\n * #### Notes\n * This is a no-op if the index is out of range.\n */\n removeItemAt(index: number): void {\n // Remove the item from the array.\n let item = ArrayExt.removeAt(this._items, index);\n\n // Bail if the index is out of range.\n if (!item) {\n return;\n }\n\n // Refresh the search results.\n this.refresh();\n }\n\n /**\n * Remove all items from the command palette.\n */\n clearItems(): void {\n // Bail if there is nothing to remove.\n if (this._items.length === 0) {\n return;\n }\n\n // Clear the array of items.\n this._items.length = 0;\n\n // Refresh the search results.\n this.refresh();\n }\n\n /**\n * Clear the search results and schedule an update.\n *\n * #### Notes\n * This should be called whenever the search results of the palette\n * should be updated.\n *\n * This is typically called automatically by the palette as needed,\n * but can be called manually if the input text is programatically\n * changed.\n *\n * The rendered results are updated asynchronously.\n */\n refresh(): void {\n this._results = null;\n if (this.inputNode.value !== '') {\n let clear = this.node.getElementsByClassName(\n 'lm-close-icon'\n )[0] as HTMLInputElement;\n clear.style.display = 'inherit';\n } else {\n let clear = this.node.getElementsByClassName(\n 'lm-close-icon'\n )[0] as HTMLInputElement;\n clear.style.display = 'none';\n }\n this.update();\n }\n\n /**\n * Handle the DOM events for the command palette.\n *\n * @param event - The DOM event sent to the command palette.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the command palette's DOM node.\n * It should not be called directly by user code.\n */\n handleEvent(event: Event): void {\n switch (event.type) {\n case 'click':\n this._evtClick(event as MouseEvent);\n break;\n case 'keydown':\n this._evtKeyDown(event as KeyboardEvent);\n break;\n case 'input':\n this.refresh();\n break;\n case 'focus':\n case 'blur':\n this._toggleFocused();\n break;\n }\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n this.node.addEventListener('click', this);\n this.node.addEventListener('keydown', this);\n this.node.addEventListener('input', this);\n this.node.addEventListener('focus', this, true);\n this.node.addEventListener('blur', this, true);\n }\n\n /**\n * A message handler invoked on an `'after-detach'` message.\n */\n protected onAfterDetach(msg: Message): void {\n this.node.removeEventListener('click', this);\n this.node.removeEventListener('keydown', this);\n this.node.removeEventListener('input', this);\n this.node.removeEventListener('focus', this, true);\n this.node.removeEventListener('blur', this, true);\n }\n\n /**\n * A message handler invoked on an `'after-show'` message.\n */\n protected onAfterShow(msg: Message): void {\n this.update();\n super.onAfterShow(msg);\n }\n\n /**\n * A message handler invoked on an `'activate-request'` message.\n */\n protected onActivateRequest(msg: Message): void {\n if (this.isAttached) {\n let input = this.inputNode;\n input.focus();\n input.select();\n }\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n protected onUpdateRequest(msg: Message): void {\n if (!this.isVisible) {\n // Ensure to clear the content if the widget is hidden\n VirtualDOM.render(null, this.contentNode);\n return;\n }\n\n // Fetch the current query text and content node.\n let query = this.inputNode.value;\n let contentNode = this.contentNode;\n\n // Ensure the search results are generated.\n let results = this._results;\n if (!results) {\n // Generate and store the new search results.\n results = this._results = Private.search(this._items, query);\n\n // Reset the active index.\n this._activeIndex = query\n ? ArrayExt.findFirstIndex(results, Private.canActivate)\n : -1;\n }\n\n // If there is no query and no results, clear the content.\n if (!query && results.length === 0) {\n VirtualDOM.render(null, contentNode);\n return;\n }\n\n // If the is a query but no results, render the empty message.\n if (query && results.length === 0) {\n let content = this.renderer.renderEmptyMessage({ query });\n VirtualDOM.render(content, contentNode);\n return;\n }\n\n // Create the render content for the search results.\n let renderer = this.renderer;\n let activeIndex = this._activeIndex;\n let content = new Array(results.length);\n for (let i = 0, n = results.length; i < n; ++i) {\n let result = results[i];\n if (result.type === 'header') {\n let indices = result.indices;\n let category = result.category;\n content[i] = renderer.renderHeader({ category, indices });\n } else {\n let item = result.item;\n let indices = result.indices;\n let active = i === activeIndex;\n content[i] = renderer.renderItem({ item, indices, active });\n }\n }\n\n // Render the search result content.\n VirtualDOM.render(content, contentNode);\n\n // Adjust the scroll position as needed.\n if (activeIndex < 0 || activeIndex >= results.length) {\n contentNode.scrollTop = 0;\n } else {\n let element = contentNode.children[activeIndex];\n ElementExt.scrollIntoViewIfNeeded(contentNode, element);\n }\n }\n\n /**\n * Handle the `'click'` event for the command palette.\n */\n private _evtClick(event: MouseEvent): void {\n // Bail if the click is not the left button.\n if (event.button !== 0) {\n return;\n }\n\n // Clear input if the target is clear button\n if ((event.target as HTMLElement).classList.contains('lm-close-icon')) {\n this.inputNode.value = '';\n this.refresh();\n return;\n }\n\n // Find the index of the item which was clicked.\n let index = ArrayExt.findFirstIndex(this.contentNode.children, node => {\n return node.contains(event.target as HTMLElement);\n });\n\n // Bail if the click was not on an item.\n if (index === -1) {\n return;\n }\n\n // Kill the event when a content item is clicked.\n event.preventDefault();\n event.stopPropagation();\n\n // Execute the item if possible.\n this._execute(index);\n }\n\n /**\n * Handle the `'keydown'` event for the command palette.\n */\n private _evtKeyDown(event: KeyboardEvent): void {\n if (event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) {\n return;\n }\n switch (event.keyCode) {\n case 13: // Enter\n event.preventDefault();\n event.stopPropagation();\n this._execute(this._activeIndex);\n break;\n case 38: // Up Arrow\n event.preventDefault();\n event.stopPropagation();\n this._activatePreviousItem();\n break;\n case 40: // Down Arrow\n event.preventDefault();\n event.stopPropagation();\n this._activateNextItem();\n break;\n }\n }\n\n /**\n * Activate the next enabled command item.\n */\n private _activateNextItem(): void {\n // Bail if there are no search results.\n if (!this._results || this._results.length === 0) {\n return;\n }\n\n // Find the next enabled item index.\n let ai = this._activeIndex;\n let n = this._results.length;\n let start = ai < n - 1 ? ai + 1 : 0;\n let stop = start === 0 ? n - 1 : start - 1;\n this._activeIndex = ArrayExt.findFirstIndex(\n this._results,\n Private.canActivate,\n start,\n stop\n );\n\n // Schedule an update of the items.\n this.update();\n }\n\n /**\n * Activate the previous enabled command item.\n */\n private _activatePreviousItem(): void {\n // Bail if there are no search results.\n if (!this._results || this._results.length === 0) {\n return;\n }\n\n // Find the previous enabled item index.\n let ai = this._activeIndex;\n let n = this._results.length;\n let start = ai <= 0 ? n - 1 : ai - 1;\n let stop = start === n - 1 ? 0 : start + 1;\n this._activeIndex = ArrayExt.findLastIndex(\n this._results,\n Private.canActivate,\n start,\n stop\n );\n\n // Schedule an update of the items.\n this.update();\n }\n\n /**\n * Execute the command item at the given index, if possible.\n */\n private _execute(index: number): void {\n // Bail if there are no search results.\n if (!this._results) {\n return;\n }\n\n // Bail if the index is out of range.\n let part = this._results[index];\n if (!part) {\n return;\n }\n\n // Update the search text if the item is a header.\n if (part.type === 'header') {\n let input = this.inputNode;\n input.value = `${part.category.toLowerCase()} `;\n input.focus();\n this.refresh();\n return;\n }\n\n // Bail if item is not enabled.\n if (!part.item.isEnabled) {\n return;\n }\n\n // Execute the item.\n this.commands.execute(part.item.command, part.item.args);\n\n // Clear the query text.\n this.inputNode.value = '';\n\n // Refresh the search results.\n this.refresh();\n }\n\n /**\n * Toggle the focused modifier based on the input node focus state.\n */\n private _toggleFocused(): void {\n let focused = document.activeElement === this.inputNode;\n this.toggleClass('lm-mod-focused', focused);\n }\n\n /**\n * A signal handler for generic command changes.\n */\n private _onGenericChange(): void {\n this.refresh();\n }\n\n private _activeIndex = -1;\n private _items: CommandPalette.IItem[] = [];\n private _results: Private.SearchResult[] | null = null;\n}\n\n/**\n * The namespace for the `CommandPalette` class statics.\n */\nexport namespace CommandPalette {\n /**\n * An options object for creating a command palette.\n */\n export interface IOptions {\n /**\n * The command registry for use with the command palette.\n */\n commands: CommandRegistry;\n\n /**\n * A custom renderer for use with the command palette.\n *\n * The default is a shared renderer instance.\n */\n renderer?: IRenderer;\n }\n\n /**\n * An options object for creating a command item.\n */\n export interface IItemOptions {\n /**\n * The category for the item.\n */\n category: string;\n\n /**\n * The command to execute when the item is triggered.\n */\n command: string;\n\n /**\n * The arguments for the command.\n *\n * The default value is an empty object.\n */\n args?: ReadonlyJSONObject;\n\n /**\n * The rank for the command item.\n *\n * The rank is used as a tie-breaker when ordering command items\n * for display. Items are sorted in the following order:\n * 1. Text match (lower is better)\n * 2. Category (locale order)\n * 3. Rank (lower is better)\n * 4. Label (locale order)\n *\n * The default rank is `Infinity`.\n */\n rank?: number;\n }\n\n /**\n * An object which represents an item in a command palette.\n *\n * #### Notes\n * Item objects are created automatically by a command palette.\n */\n export interface IItem {\n /**\n * The command to execute when the item is triggered.\n */\n readonly command: string;\n\n /**\n * The arguments for the command.\n */\n readonly args: ReadonlyJSONObject;\n\n /**\n * The category for the command item.\n */\n readonly category: string;\n\n /**\n * The rank for the command item.\n */\n readonly rank: number;\n\n /**\n * The display label for the command item.\n */\n readonly label: string;\n\n /**\n * The display caption for the command item.\n */\n readonly caption: string;\n\n /**\n * The icon renderer for the command item.\n */\n readonly icon: VirtualElement.IRenderer | undefined;\n\n /**\n * The icon class for the command item.\n */\n readonly iconClass: string;\n\n /**\n * The icon label for the command item.\n */\n readonly iconLabel: string;\n\n /**\n * The extra class name for the command item.\n */\n readonly className: string;\n\n /**\n * The dataset for the command item.\n */\n readonly dataset: CommandRegistry.Dataset;\n\n /**\n * Whether the command item is enabled.\n */\n readonly isEnabled: boolean;\n\n /**\n * Whether the command item is toggled.\n */\n readonly isToggled: boolean;\n\n /**\n * Whether the command item is toggleable.\n */\n readonly isToggleable: boolean;\n\n /**\n * Whether the command item is visible.\n */\n readonly isVisible: boolean;\n\n /**\n * The key binding for the command item.\n */\n readonly keyBinding: CommandRegistry.IKeyBinding | null;\n }\n\n /**\n * The render data for a command palette header.\n */\n export interface IHeaderRenderData {\n /**\n * The category of the header.\n */\n readonly category: string;\n\n /**\n * The indices of the matched characters in the category.\n */\n readonly indices: ReadonlyArray | null;\n }\n\n /**\n * The render data for a command palette item.\n */\n export interface IItemRenderData {\n /**\n * The command palette item to render.\n */\n readonly item: IItem;\n\n /**\n * The indices of the matched characters in the label.\n */\n readonly indices: ReadonlyArray | null;\n\n /**\n * Whether the item is the active item.\n */\n readonly active: boolean;\n }\n\n /**\n * The render data for a command palette empty message.\n */\n export interface IEmptyMessageRenderData {\n /**\n * The query which failed to match any commands.\n */\n query: string;\n }\n\n /**\n * A renderer for use with a command palette.\n */\n export interface IRenderer {\n /**\n * Render the virtual element for a command palette header.\n *\n * @param data - The data to use for rendering the header.\n *\n * @returns A virtual element representing the header.\n */\n renderHeader(data: IHeaderRenderData): VirtualElement;\n\n /**\n * Render the virtual element for a command palette item.\n *\n * @param data - The data to use for rendering the item.\n *\n * @returns A virtual element representing the item.\n *\n * #### Notes\n * The command palette will not render invisible items.\n */\n renderItem(data: IItemRenderData): VirtualElement;\n\n /**\n * Render the empty results message for a command palette.\n *\n * @param data - The data to use for rendering the message.\n *\n * @returns A virtual element representing the message.\n */\n renderEmptyMessage(data: IEmptyMessageRenderData): VirtualElement;\n }\n\n /**\n * The default implementation of `IRenderer`.\n */\n export class Renderer implements IRenderer {\n /**\n * Render the virtual element for a command palette header.\n *\n * @param data - The data to use for rendering the header.\n *\n * @returns A virtual element representing the header.\n */\n renderHeader(data: IHeaderRenderData): VirtualElement {\n let content = this.formatHeader(data);\n return h.li({ className: 'lm-CommandPalette-header' }, content);\n }\n\n /**\n * Render the virtual element for a command palette item.\n *\n * @param data - The data to use for rendering the item.\n *\n * @returns A virtual element representing the item.\n */\n renderItem(data: IItemRenderData): VirtualElement {\n let className = this.createItemClass(data);\n let dataset = this.createItemDataset(data);\n if (data.item.isToggleable) {\n return h.li(\n {\n className,\n dataset,\n role: 'menuitemcheckbox',\n 'aria-checked': `${data.item.isToggled}`\n },\n this.renderItemIcon(data),\n this.renderItemContent(data),\n this.renderItemShortcut(data)\n );\n }\n return h.li(\n {\n className,\n dataset,\n role: 'menuitem'\n },\n this.renderItemIcon(data),\n this.renderItemContent(data),\n this.renderItemShortcut(data)\n );\n }\n\n /**\n * Render the empty results message for a command palette.\n *\n * @param data - The data to use for rendering the message.\n *\n * @returns A virtual element representing the message.\n */\n renderEmptyMessage(data: IEmptyMessageRenderData): VirtualElement {\n let content = this.formatEmptyMessage(data);\n return h.li({ className: 'lm-CommandPalette-emptyMessage' }, content);\n }\n\n /**\n * Render the icon for a command palette item.\n *\n * @param data - The data to use for rendering the icon.\n *\n * @returns A virtual element representing the icon.\n */\n renderItemIcon(data: IItemRenderData): VirtualElement {\n let className = this.createIconClass(data);\n\n // If data.item.icon is undefined, it will be ignored.\n return h.div({ className }, data.item.icon!, data.item.iconLabel);\n }\n\n /**\n * Render the content for a command palette item.\n *\n * @param data - The data to use for rendering the content.\n *\n * @returns A virtual element representing the content.\n */\n renderItemContent(data: IItemRenderData): VirtualElement {\n return h.div(\n { className: 'lm-CommandPalette-itemContent' },\n this.renderItemLabel(data),\n this.renderItemCaption(data)\n );\n }\n\n /**\n * Render the label for a command palette item.\n *\n * @param data - The data to use for rendering the label.\n *\n * @returns A virtual element representing the label.\n */\n renderItemLabel(data: IItemRenderData): VirtualElement {\n let content = this.formatItemLabel(data);\n return h.div({ className: 'lm-CommandPalette-itemLabel' }, content);\n }\n\n /**\n * Render the caption for a command palette item.\n *\n * @param data - The data to use for rendering the caption.\n *\n * @returns A virtual element representing the caption.\n */\n renderItemCaption(data: IItemRenderData): VirtualElement {\n let content = this.formatItemCaption(data);\n return h.div({ className: 'lm-CommandPalette-itemCaption' }, content);\n }\n\n /**\n * Render the shortcut for a command palette item.\n *\n * @param data - The data to use for rendering the shortcut.\n *\n * @returns A virtual element representing the shortcut.\n */\n renderItemShortcut(data: IItemRenderData): VirtualElement {\n let content = this.formatItemShortcut(data);\n return h.div({ className: 'lm-CommandPalette-itemShortcut' }, content);\n }\n\n /**\n * Create the class name for the command palette item.\n *\n * @param data - The data to use for the class name.\n *\n * @returns The full class name for the command palette item.\n */\n createItemClass(data: IItemRenderData): string {\n // Set up the initial class name.\n let name = 'lm-CommandPalette-item';\n\n // Add the boolean state classes.\n if (!data.item.isEnabled) {\n name += ' lm-mod-disabled';\n }\n if (data.item.isToggled) {\n name += ' lm-mod-toggled';\n }\n if (data.active) {\n name += ' lm-mod-active';\n }\n\n // Add the extra class.\n let extra = data.item.className;\n if (extra) {\n name += ` ${extra}`;\n }\n\n // Return the complete class name.\n return name;\n }\n\n /**\n * Create the dataset for the command palette item.\n *\n * @param data - The data to use for creating the dataset.\n *\n * @returns The dataset for the command palette item.\n */\n createItemDataset(data: IItemRenderData): ElementDataset {\n return { ...data.item.dataset, command: data.item.command };\n }\n\n /**\n * Create the class name for the command item icon.\n *\n * @param data - The data to use for the class name.\n *\n * @returns The full class name for the item icon.\n */\n createIconClass(data: IItemRenderData): string {\n let name = 'lm-CommandPalette-itemIcon';\n let extra = data.item.iconClass;\n return extra ? `${name} ${extra}` : name;\n }\n\n /**\n * Create the render content for the header node.\n *\n * @param data - The data to use for the header content.\n *\n * @returns The content to add to the header node.\n */\n formatHeader(data: IHeaderRenderData): h.Child {\n if (!data.indices || data.indices.length === 0) {\n return data.category;\n }\n return StringExt.highlight(data.category, data.indices, h.mark);\n }\n\n /**\n * Create the render content for the empty message node.\n *\n * @param data - The data to use for the empty message content.\n *\n * @returns The content to add to the empty message node.\n */\n formatEmptyMessage(data: IEmptyMessageRenderData): h.Child {\n return `No commands found that match '${data.query}'`;\n }\n\n /**\n * Create the render content for the item shortcut node.\n *\n * @param data - The data to use for the shortcut content.\n *\n * @returns The content to add to the shortcut node.\n */\n formatItemShortcut(data: IItemRenderData): h.Child {\n let kb = data.item.keyBinding;\n return kb ? CommandRegistry.formatKeystroke(kb.keys) : null;\n }\n\n /**\n * Create the render content for the item label node.\n *\n * @param data - The data to use for the label content.\n *\n * @returns The content to add to the label node.\n */\n formatItemLabel(data: IItemRenderData): h.Child {\n if (!data.indices || data.indices.length === 0) {\n return data.item.label;\n }\n return StringExt.highlight(data.item.label, data.indices, h.mark);\n }\n\n /**\n * Create the render content for the item caption node.\n *\n * @param data - The data to use for the caption content.\n *\n * @returns The content to add to the caption node.\n */\n formatItemCaption(data: IItemRenderData): h.Child {\n return data.item.caption;\n }\n }\n\n /**\n * The default `Renderer` instance.\n */\n export const defaultRenderer = new Renderer();\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * Create the DOM node for a command palette.\n */\n export function createNode(): HTMLDivElement {\n let node = document.createElement('div');\n let search = document.createElement('div');\n let wrapper = document.createElement('div');\n let input = document.createElement('input');\n let content = document.createElement('ul');\n let clear = document.createElement('button');\n search.className = 'lm-CommandPalette-search';\n wrapper.className = 'lm-CommandPalette-wrapper';\n input.className = 'lm-CommandPalette-input';\n clear.className = 'lm-close-icon';\n\n content.className = 'lm-CommandPalette-content';\n content.setAttribute('role', 'menu');\n input.spellcheck = false;\n wrapper.appendChild(input);\n wrapper.appendChild(clear);\n search.appendChild(wrapper);\n node.appendChild(search);\n node.appendChild(content);\n return node;\n }\n\n /**\n * Create a new command item from a command registry and options.\n */\n export function createItem(\n commands: CommandRegistry,\n options: CommandPalette.IItemOptions\n ): CommandPalette.IItem {\n return new CommandItem(commands, options);\n }\n\n /**\n * A search result object for a header label.\n */\n export interface IHeaderResult {\n /**\n * The discriminated type of the object.\n */\n readonly type: 'header';\n\n /**\n * The category for the header.\n */\n readonly category: string;\n\n /**\n * The indices of the matched category characters.\n */\n readonly indices: ReadonlyArray | null;\n }\n\n /**\n * A search result object for a command item.\n */\n export interface IItemResult {\n /**\n * The discriminated type of the object.\n */\n readonly type: 'item';\n\n /**\n * The command item which was matched.\n */\n readonly item: CommandPalette.IItem;\n\n /**\n * The indices of the matched label characters.\n */\n readonly indices: ReadonlyArray | null;\n }\n\n /**\n * A type alias for a search result item.\n */\n export type SearchResult = IHeaderResult | IItemResult;\n\n /**\n * Search an array of command items for fuzzy matches.\n */\n export function search(\n items: CommandPalette.IItem[],\n query: string\n ): SearchResult[] {\n // Fuzzy match the items for the query.\n let scores = matchItems(items, query);\n\n // Sort the items based on their score.\n scores.sort(scoreCmp);\n\n // Create the results for the search.\n return createResults(scores);\n }\n\n /**\n * Test whether a result item can be activated.\n */\n export function canActivate(result: SearchResult): boolean {\n return result.type === 'item' && result.item.isEnabled;\n }\n\n /**\n * Normalize a category for a command item.\n */\n function normalizeCategory(category: string): string {\n return category.trim().replace(/\\s+/g, ' ');\n }\n\n /**\n * Normalize the query text for a fuzzy search.\n */\n function normalizeQuery(text: string): string {\n return text.replace(/\\s+/g, '').toLowerCase();\n }\n\n /**\n * An enum of the supported match types.\n */\n const enum MatchType {\n Label,\n Category,\n Split,\n Default\n }\n\n /**\n * A text match score with associated command item.\n */\n interface IScore {\n /**\n * The numerical type for the text match.\n */\n matchType: MatchType;\n\n /**\n * The numerical score for the text match.\n */\n score: number;\n\n /**\n * The indices of the matched category characters.\n */\n categoryIndices: number[] | null;\n\n /**\n * The indices of the matched label characters.\n */\n labelIndices: number[] | null;\n\n /**\n * The command item associated with the match.\n */\n item: CommandPalette.IItem;\n }\n\n /**\n * Perform a fuzzy match on an array of command items.\n */\n function matchItems(items: CommandPalette.IItem[], query: string): IScore[] {\n // Normalize the query text to lower case with no whitespace.\n query = normalizeQuery(query);\n\n // Create the array to hold the scores.\n let scores: IScore[] = [];\n\n // Iterate over the items and match against the query.\n for (let i = 0, n = items.length; i < n; ++i) {\n // Ignore items which are not visible.\n let item = items[i];\n if (!item.isVisible) {\n continue;\n }\n\n // If the query is empty, all items are matched by default.\n if (!query) {\n scores.push({\n matchType: MatchType.Default,\n categoryIndices: null,\n labelIndices: null,\n score: 0,\n item\n });\n continue;\n }\n\n // Run the fuzzy search for the item and query.\n let score = fuzzySearch(item, query);\n\n // Ignore the item if it is not a match.\n if (!score) {\n continue;\n }\n\n // Penalize disabled items.\n // TODO - push disabled items all the way down in sort cmp?\n if (!item.isEnabled) {\n score.score += 1000;\n }\n\n // Add the score to the results.\n scores.push(score);\n }\n\n // Return the final array of scores.\n return scores;\n }\n\n /**\n * Perform a fuzzy search on a single command item.\n */\n function fuzzySearch(\n item: CommandPalette.IItem,\n query: string\n ): IScore | null {\n // Create the source text to be searched.\n let category = item.category.toLowerCase();\n let label = item.label.toLowerCase();\n let source = `${category} ${label}`;\n\n // Set up the match score and indices array.\n let score = Infinity;\n let indices: number[] | null = null;\n\n // The regex for search word boundaries\n let rgx = /\\b\\w/g;\n\n // Search the source by word boundary.\n // eslint-disable-next-line no-constant-condition\n while (true) {\n // Find the next word boundary in the source.\n let rgxMatch = rgx.exec(source);\n\n // Break if there is no more source context.\n if (!rgxMatch) {\n break;\n }\n\n // Run the string match on the relevant substring.\n let match = StringExt.matchSumOfDeltas(source, query, rgxMatch.index);\n\n // Break if there is no match.\n if (!match) {\n break;\n }\n\n // Update the match if the score is better.\n if (match.score <= score) {\n score = match.score;\n indices = match.indices;\n }\n }\n\n // Bail if there was no match.\n if (!indices || score === Infinity) {\n return null;\n }\n\n // Compute the pivot index between category and label text.\n let pivot = category.length + 1;\n\n // Find the slice index to separate matched indices.\n let j = ArrayExt.lowerBound(indices, pivot, (a, b) => a - b);\n\n // Extract the matched category and label indices.\n let categoryIndices = indices.slice(0, j);\n let labelIndices = indices.slice(j);\n\n // Adjust the label indices for the pivot offset.\n for (let i = 0, n = labelIndices.length; i < n; ++i) {\n labelIndices[i] -= pivot;\n }\n\n // Handle a pure label match.\n if (categoryIndices.length === 0) {\n return {\n matchType: MatchType.Label,\n categoryIndices: null,\n labelIndices,\n score,\n item\n };\n }\n\n // Handle a pure category match.\n if (labelIndices.length === 0) {\n return {\n matchType: MatchType.Category,\n categoryIndices,\n labelIndices: null,\n score,\n item\n };\n }\n\n // Handle a split match.\n return {\n matchType: MatchType.Split,\n categoryIndices,\n labelIndices,\n score,\n item\n };\n }\n\n /**\n * A sort comparison function for a match score.\n */\n function scoreCmp(a: IScore, b: IScore): number {\n // First compare based on the match type\n let m1 = a.matchType - b.matchType;\n if (m1 !== 0) {\n return m1;\n }\n\n // Otherwise, compare based on the match score.\n let d1 = a.score - b.score;\n if (d1 !== 0) {\n return d1;\n }\n\n // Find the match index based on the match type.\n let i1 = 0;\n let i2 = 0;\n switch (a.matchType) {\n case MatchType.Label:\n i1 = a.labelIndices![0];\n i2 = b.labelIndices![0];\n break;\n case MatchType.Category:\n case MatchType.Split:\n i1 = a.categoryIndices![0];\n i2 = b.categoryIndices![0];\n break;\n }\n\n // Compare based on the match index.\n if (i1 !== i2) {\n return i1 - i2;\n }\n\n // Otherwise, compare by category.\n let d2 = a.item.category.localeCompare(b.item.category);\n if (d2 !== 0) {\n return d2;\n }\n\n // Otherwise, compare by rank.\n let r1 = a.item.rank;\n let r2 = b.item.rank;\n if (r1 !== r2) {\n return r1 < r2 ? -1 : 1; // Infinity safe\n }\n\n // Finally, compare by label.\n return a.item.label.localeCompare(b.item.label);\n }\n\n /**\n * Create the results from an array of sorted scores.\n */\n function createResults(scores: IScore[]): SearchResult[] {\n // Set up the search results array.\n let results: SearchResult[] = [];\n\n // Iterate over each score in the array.\n for (let i = 0, n = scores.length; i < n; ++i) {\n // Extract the current item and indices.\n let { item, categoryIndices, labelIndices } = scores[i];\n\n // Extract the category for the current item.\n let category = item.category;\n\n // Is this the same category as the preceding result?\n if (i === 0 || category !== scores[i - 1].item.category) {\n // Add the header result for the category.\n results.push({ type: 'header', category, indices: categoryIndices });\n }\n\n // Create the item result for the score.\n results.push({ type: 'item', item, indices: labelIndices });\n }\n\n // Return the final results.\n return results;\n }\n\n /**\n * A concrete implementation of `CommandPalette.IItem`.\n */\n class CommandItem implements CommandPalette.IItem {\n /**\n * Construct a new command item.\n */\n constructor(\n commands: CommandRegistry,\n options: CommandPalette.IItemOptions\n ) {\n this._commands = commands;\n this.category = normalizeCategory(options.category);\n this.command = options.command;\n this.args = options.args || JSONExt.emptyObject;\n this.rank = options.rank !== undefined ? options.rank : Infinity;\n }\n\n /**\n * The category for the command item.\n */\n readonly category: string;\n\n /**\n * The command to execute when the item is triggered.\n */\n readonly command: string;\n\n /**\n * The arguments for the command.\n */\n readonly args: ReadonlyJSONObject;\n\n /**\n * The rank for the command item.\n */\n readonly rank: number;\n\n /**\n * The display label for the command item.\n */\n get label(): string {\n return this._commands.label(this.command, this.args);\n }\n\n /**\n * The icon renderer for the command item.\n */\n get icon(): VirtualElement.IRenderer | undefined {\n return this._commands.icon(this.command, this.args);\n }\n\n /**\n * The icon class for the command item.\n */\n get iconClass(): string {\n return this._commands.iconClass(this.command, this.args);\n }\n\n /**\n * The icon label for the command item.\n */\n get iconLabel(): string {\n return this._commands.iconLabel(this.command, this.args);\n }\n\n /**\n * The display caption for the command item.\n */\n get caption(): string {\n return this._commands.caption(this.command, this.args);\n }\n\n /**\n * The extra class name for the command item.\n */\n get className(): string {\n return this._commands.className(this.command, this.args);\n }\n\n /**\n * The dataset for the command item.\n */\n get dataset(): CommandRegistry.Dataset {\n return this._commands.dataset(this.command, this.args);\n }\n\n /**\n * Whether the command item is enabled.\n */\n get isEnabled(): boolean {\n return this._commands.isEnabled(this.command, this.args);\n }\n\n /**\n * Whether the command item is toggled.\n */\n get isToggled(): boolean {\n return this._commands.isToggled(this.command, this.args);\n }\n\n /**\n * Whether the command item is toggleable.\n */\n get isToggleable(): boolean {\n return this._commands.isToggleable(this.command, this.args);\n }\n\n /**\n * Whether the command item is visible.\n */\n get isVisible(): boolean {\n return this._commands.isVisible(this.command, this.args);\n }\n\n /**\n * The key binding for the command item.\n */\n get keyBinding(): CommandRegistry.IKeyBinding | null {\n let { command, args } = this;\n return (\n ArrayExt.findLastValue(this._commands.keyBindings, kb => {\n return kb.command === command && JSONExt.deepEqual(kb.args, args);\n }) || null\n );\n }\n\n private _commands: CommandRegistry;\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { CommandRegistry } from '@lumino/commands';\n\nimport { JSONExt, ReadonlyJSONObject } from '@lumino/coreutils';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { getKeyboardLayout } from '@lumino/keyboard';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport {\n ARIAAttrNames,\n ElementARIAAttrs,\n ElementDataset,\n h,\n VirtualDOM,\n VirtualElement\n} from '@lumino/virtualdom';\n\nimport { Widget } from './widget';\n\ninterface IWindowData {\n pageXOffset: number;\n pageYOffset: number;\n clientWidth: number;\n clientHeight: number;\n}\n\n/**\n * A widget which displays items as a canonical menu.\n */\nexport class Menu extends Widget {\n /**\n * Construct a new menu.\n *\n * @param options - The options for initializing the menu.\n */\n constructor(options: Menu.IOptions) {\n super({ node: Private.createNode() });\n this.addClass('lm-Menu');\n this.setFlag(Widget.Flag.DisallowLayout);\n this.commands = options.commands;\n this.renderer = options.renderer || Menu.defaultRenderer;\n }\n\n /**\n * Dispose of the resources held by the menu.\n */\n dispose(): void {\n this.close();\n this._items.length = 0;\n super.dispose();\n }\n\n /**\n * A signal emitted just before the menu is closed.\n *\n * #### Notes\n * This signal is emitted when the menu receives a `'close-request'`\n * message, just before it removes itself from the DOM.\n *\n * This signal is not emitted if the menu is already detached from\n * the DOM when it receives the `'close-request'` message.\n */\n get aboutToClose(): ISignal {\n return this._aboutToClose;\n }\n\n /**\n * A signal emitted when a new menu is requested by the user.\n *\n * #### Notes\n * This signal is emitted whenever the user presses the right or left\n * arrow keys, and a submenu cannot be opened or closed in response.\n *\n * This signal is useful when implementing menu bars in order to open\n * the next or previous menu in response to a user key press.\n *\n * This signal is only emitted for the root menu in a hierarchy.\n */\n get menuRequested(): ISignal {\n return this._menuRequested;\n }\n\n /**\n * The command registry used by the menu.\n */\n readonly commands: CommandRegistry;\n\n /**\n * The renderer used by the menu.\n */\n readonly renderer: Menu.IRenderer;\n\n /**\n * The parent menu of the menu.\n *\n * #### Notes\n * This is `null` unless the menu is an open submenu.\n */\n get parentMenu(): Menu | null {\n return this._parentMenu;\n }\n\n /**\n * The child menu of the menu.\n *\n * #### Notes\n * This is `null` unless the menu has an open submenu.\n */\n get childMenu(): Menu | null {\n return this._childMenu;\n }\n\n /**\n * The root menu of the menu hierarchy.\n */\n get rootMenu(): Menu {\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n let menu: Menu = this;\n while (menu._parentMenu) {\n menu = menu._parentMenu;\n }\n return menu;\n }\n\n /**\n * The leaf menu of the menu hierarchy.\n */\n get leafMenu(): Menu {\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n let menu: Menu = this;\n while (menu._childMenu) {\n menu = menu._childMenu;\n }\n return menu;\n }\n\n /**\n * The menu content node.\n *\n * #### Notes\n * This is the node which holds the menu item nodes.\n *\n * Modifying this node directly can lead to undefined behavior.\n */\n get contentNode(): HTMLUListElement {\n return this.node.getElementsByClassName(\n 'lm-Menu-content'\n )[0] as HTMLUListElement;\n }\n\n /**\n * Get the currently active menu item.\n */\n get activeItem(): Menu.IItem | null {\n return this._items[this._activeIndex] || null;\n }\n\n /**\n * Set the currently active menu item.\n *\n * #### Notes\n * If the item cannot be activated, the item will be set to `null`.\n */\n set activeItem(value: Menu.IItem | null) {\n this.activeIndex = value ? this._items.indexOf(value) : -1;\n }\n\n /**\n * Get the index of the currently active menu item.\n *\n * #### Notes\n * This will be `-1` if no menu item is active.\n */\n get activeIndex(): number {\n return this._activeIndex;\n }\n\n /**\n * Set the index of the currently active menu item.\n *\n * #### Notes\n * If the item cannot be activated, the index will be set to `-1`.\n */\n set activeIndex(value: number) {\n // Adjust the value for an out of range index.\n if (value < 0 || value >= this._items.length) {\n value = -1;\n }\n\n // Ensure the item can be activated.\n if (value !== -1 && !Private.canActivate(this._items[value])) {\n value = -1;\n }\n\n // Bail if the index will not change.\n if (this._activeIndex === value) {\n return;\n }\n\n // Update the active index.\n this._activeIndex = value;\n\n // Make active element in focus\n if (\n this._activeIndex >= 0 &&\n this.contentNode.childNodes[this._activeIndex]\n ) {\n (this.contentNode.childNodes[this._activeIndex] as HTMLElement).focus();\n }\n\n // schedule an update of the items.\n this.update();\n }\n\n /**\n * A read-only array of the menu items in the menu.\n */\n get items(): ReadonlyArray {\n return this._items;\n }\n\n /**\n * Activate the next selectable item in the menu.\n *\n * #### Notes\n * If no item is selectable, the index will be set to `-1`.\n */\n activateNextItem(): void {\n let n = this._items.length;\n let ai = this._activeIndex;\n let start = ai < n - 1 ? ai + 1 : 0;\n let stop = start === 0 ? n - 1 : start - 1;\n this.activeIndex = ArrayExt.findFirstIndex(\n this._items,\n Private.canActivate,\n start,\n stop\n );\n }\n\n /**\n * Activate the previous selectable item in the menu.\n *\n * #### Notes\n * If no item is selectable, the index will be set to `-1`.\n */\n activatePreviousItem(): void {\n let n = this._items.length;\n let ai = this._activeIndex;\n let start = ai <= 0 ? n - 1 : ai - 1;\n let stop = start === n - 1 ? 0 : start + 1;\n this.activeIndex = ArrayExt.findLastIndex(\n this._items,\n Private.canActivate,\n start,\n stop\n );\n }\n\n /**\n * Trigger the active menu item.\n *\n * #### Notes\n * If the active item is a submenu, it will be opened and the first\n * item will be activated.\n *\n * If the active item is a command, the command will be executed.\n *\n * If the menu is not attached, this is a no-op.\n *\n * If there is no active item, this is a no-op.\n */\n triggerActiveItem(): void {\n // Bail if the menu is not attached.\n if (!this.isAttached) {\n return;\n }\n\n // Bail if there is no active item.\n let item = this.activeItem;\n if (!item) {\n return;\n }\n\n // Cancel the pending timers.\n this._cancelOpenTimer();\n this._cancelCloseTimer();\n\n // If the item is a submenu, open it.\n if (item.type === 'submenu') {\n this._openChildMenu(true);\n return;\n }\n\n // Close the root menu before executing the command.\n this.rootMenu.close();\n\n // Execute the command for the item.\n let { command, args } = item;\n if (this.commands.isEnabled(command, args)) {\n this.commands.execute(command, args);\n } else {\n console.log(`Command '${command}' is disabled.`);\n }\n }\n\n /**\n * Add a menu item to the end of the menu.\n *\n * @param options - The options for creating the menu item.\n *\n * @returns The menu item added to the menu.\n */\n addItem(options: Menu.IItemOptions): Menu.IItem {\n return this.insertItem(this._items.length, options);\n }\n\n /**\n * Insert a menu item into the menu at the specified index.\n *\n * @param index - The index at which to insert the item.\n *\n * @param options - The options for creating the menu item.\n *\n * @returns The menu item added to the menu.\n *\n * #### Notes\n * The index will be clamped to the bounds of the items.\n */\n insertItem(index: number, options: Menu.IItemOptions): Menu.IItem {\n // Close the menu if it's attached.\n if (this.isAttached) {\n this.close();\n }\n\n // Reset the active index.\n this.activeIndex = -1;\n\n // Clamp the insert index to the array bounds.\n let i = Math.max(0, Math.min(index, this._items.length));\n\n // Create the item for the options.\n let item = Private.createItem(this, options);\n\n // Insert the item into the array.\n ArrayExt.insert(this._items, i, item);\n\n // Schedule an update of the items.\n this.update();\n\n // Return the item added to the menu.\n return item;\n }\n\n /**\n * Remove an item from the menu.\n *\n * @param item - The item to remove from the menu.\n *\n * #### Notes\n * This is a no-op if the item is not in the menu.\n */\n removeItem(item: Menu.IItem): void {\n this.removeItemAt(this._items.indexOf(item));\n }\n\n /**\n * Remove the item at a given index from the menu.\n *\n * @param index - The index of the item to remove.\n *\n * #### Notes\n * This is a no-op if the index is out of range.\n */\n removeItemAt(index: number): void {\n // Close the menu if it's attached.\n if (this.isAttached) {\n this.close();\n }\n\n // Reset the active index.\n this.activeIndex = -1;\n\n // Remove the item from the array.\n let item = ArrayExt.removeAt(this._items, index);\n\n // Bail if the index is out of range.\n if (!item) {\n return;\n }\n\n // Schedule an update of the items.\n this.update();\n }\n\n /**\n * Remove all menu items from the menu.\n */\n clearItems(): void {\n // Close the menu if it's attached.\n if (this.isAttached) {\n this.close();\n }\n\n // Reset the active index.\n this.activeIndex = -1;\n\n // Bail if there is nothing to remove.\n if (this._items.length === 0) {\n return;\n }\n\n // Clear the items.\n this._items.length = 0;\n\n // Schedule an update of the items.\n this.update();\n }\n\n /**\n * Open the menu at the specified location.\n *\n * @param x - The client X coordinate of the menu location.\n *\n * @param y - The client Y coordinate of the menu location.\n *\n * @param options - The additional options for opening the menu.\n *\n * #### Notes\n * The menu will be opened at the given location unless it will not\n * fully fit on the screen. If it will not fit, it will be adjusted\n * to fit naturally on the screen.\n *\n * The menu will be attached under the `host` element in the DOM\n * (or `document.body` if `host` is `null`) and before the `ref`\n * element (or as the last child of `host` if `ref` is `null`).\n * The menu may be displayed outside of the `host` element\n * following the rules of CSS absolute positioning.\n *\n * This is a no-op if the menu is already attached to the DOM.\n */\n open(x: number, y: number, options: Menu.IOpenOptions = {}): void {\n // Bail early if the menu is already attached.\n if (this.isAttached) {\n return;\n }\n\n // Extract the menu options.\n let forceX = options.forceX || false;\n let forceY = options.forceY || false;\n const host = options.host ?? null;\n const ref = options.ref ?? null;\n const horizontalAlignment =\n options.horizontalAlignment ??\n (document.documentElement.dir === 'rtl' ? 'right' : 'left');\n\n // Open the menu as a root menu.\n Private.openRootMenu(\n this,\n x,\n y,\n forceX,\n forceY,\n horizontalAlignment,\n host,\n ref\n );\n\n // Activate the menu to accept keyboard input.\n this.activate();\n }\n\n /**\n * Handle the DOM events for the menu.\n *\n * @param event - The DOM event sent to the menu.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the menu's DOM nodes. It should\n * not be called directly by user code.\n */\n handleEvent(event: Event): void {\n switch (event.type) {\n case 'keydown':\n this._evtKeyDown(event as KeyboardEvent);\n break;\n case 'mouseup':\n this._evtMouseUp(event as MouseEvent);\n break;\n case 'mousemove':\n this._evtMouseMove(event as MouseEvent);\n break;\n case 'mouseenter':\n this._evtMouseEnter(event as MouseEvent);\n break;\n case 'mouseleave':\n this._evtMouseLeave(event as MouseEvent);\n break;\n case 'mousedown':\n this._evtMouseDown(event as MouseEvent);\n break;\n case 'contextmenu':\n event.preventDefault();\n event.stopPropagation();\n break;\n }\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n this.node.addEventListener('keydown', this);\n this.node.addEventListener('mouseup', this);\n this.node.addEventListener('mousemove', this);\n this.node.addEventListener('mouseenter', this);\n this.node.addEventListener('mouseleave', this);\n this.node.addEventListener('contextmenu', this);\n document.addEventListener('mousedown', this, true);\n }\n\n /**\n * A message handler invoked on an `'after-detach'` message.\n */\n protected onAfterDetach(msg: Message): void {\n this.node.removeEventListener('keydown', this);\n this.node.removeEventListener('mouseup', this);\n this.node.removeEventListener('mousemove', this);\n this.node.removeEventListener('mouseenter', this);\n this.node.removeEventListener('mouseleave', this);\n this.node.removeEventListener('contextmenu', this);\n document.removeEventListener('mousedown', this, true);\n }\n\n /**\n * A message handler invoked on an `'activate-request'` message.\n */\n protected onActivateRequest(msg: Message): void {\n if (this.isAttached) {\n this.node.focus();\n }\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n protected onUpdateRequest(msg: Message): void {\n let items = this._items;\n let renderer = this.renderer;\n let activeIndex = this._activeIndex;\n let collapsedFlags = Private.computeCollapsed(items);\n let content = new Array(items.length);\n for (let i = 0, n = items.length; i < n; ++i) {\n let item = items[i];\n let active = i === activeIndex;\n let collapsed = collapsedFlags[i];\n content[i] = renderer.renderItem({\n item,\n active,\n collapsed,\n onfocus: () => {\n this.activeIndex = i;\n }\n });\n }\n VirtualDOM.render(content, this.contentNode);\n }\n\n /**\n * A message handler invoked on a `'close-request'` message.\n */\n protected onCloseRequest(msg: Message): void {\n // Cancel the pending timers.\n this._cancelOpenTimer();\n this._cancelCloseTimer();\n\n // Reset the active index.\n this.activeIndex = -1;\n\n // Close any open child menu.\n let childMenu = this._childMenu;\n if (childMenu) {\n this._childIndex = -1;\n this._childMenu = null;\n childMenu._parentMenu = null;\n childMenu.close();\n }\n\n // Remove this menu from its parent and activate the parent.\n let parentMenu = this._parentMenu;\n if (parentMenu) {\n this._parentMenu = null;\n parentMenu._childIndex = -1;\n parentMenu._childMenu = null;\n parentMenu.activate();\n }\n\n // Emit the `aboutToClose` signal if the menu is attached.\n if (this.isAttached) {\n this._aboutToClose.emit(undefined);\n }\n\n // Finish closing the menu.\n super.onCloseRequest(msg);\n }\n\n /**\n * Handle the `'keydown'` event for the menu.\n *\n * #### Notes\n * This listener is attached to the menu node.\n */\n private _evtKeyDown(event: KeyboardEvent): void {\n // A menu handles all keydown events.\n event.preventDefault();\n event.stopPropagation();\n\n // Fetch the key code for the event.\n let kc = event.keyCode;\n\n // Enter\n if (kc === 13) {\n this.triggerActiveItem();\n return;\n }\n\n // Escape\n if (kc === 27) {\n this.close();\n return;\n }\n\n // Left Arrow\n if (kc === 37) {\n if (this._parentMenu) {\n this.close();\n } else {\n this._menuRequested.emit('previous');\n }\n return;\n }\n\n // Up Arrow\n if (kc === 38) {\n this.activatePreviousItem();\n return;\n }\n\n // Right Arrow\n if (kc === 39) {\n let item = this.activeItem;\n if (item && item.type === 'submenu') {\n this.triggerActiveItem();\n } else {\n this.rootMenu._menuRequested.emit('next');\n }\n return;\n }\n\n // Down Arrow\n if (kc === 40) {\n this.activateNextItem();\n return;\n }\n\n // Get the pressed key character.\n let key = getKeyboardLayout().keyForKeydownEvent(event);\n\n // Bail if the key is not valid.\n if (!key) {\n return;\n }\n\n // Search for the next best matching mnemonic item.\n let start = this._activeIndex + 1;\n let result = Private.findMnemonic(this._items, key, start);\n\n // Handle the requested mnemonic based on the search results.\n // If exactly one mnemonic is matched, that item is triggered.\n // Otherwise, the next mnemonic is activated if available,\n // followed by the auto mnemonic if available.\n if (result.index !== -1 && !result.multiple) {\n this.activeIndex = result.index;\n this.triggerActiveItem();\n } else if (result.index !== -1) {\n this.activeIndex = result.index;\n } else if (result.auto !== -1) {\n this.activeIndex = result.auto;\n }\n }\n\n /**\n * Handle the `'mouseup'` event for the menu.\n *\n * #### Notes\n * This listener is attached to the menu node.\n */\n private _evtMouseUp(event: MouseEvent): void {\n if (event.button !== 0) {\n return;\n }\n event.preventDefault();\n event.stopPropagation();\n this.triggerActiveItem();\n }\n\n /**\n * Handle the `'mousemove'` event for the menu.\n *\n * #### Notes\n * This listener is attached to the menu node.\n */\n private _evtMouseMove(event: MouseEvent): void {\n // Hit test the item nodes for the item under the mouse.\n let index = ArrayExt.findFirstIndex(this.contentNode.children, node => {\n return ElementExt.hitTest(node, event.clientX, event.clientY);\n });\n\n // Bail early if the mouse is already over the active index.\n if (index === this._activeIndex) {\n return;\n }\n\n // Update and coerce the active index.\n this.activeIndex = index;\n index = this.activeIndex;\n\n // If the index is the current child index, cancel the timers.\n if (index === this._childIndex) {\n this._cancelOpenTimer();\n this._cancelCloseTimer();\n return;\n }\n\n // If a child menu is currently open, start the close timer.\n if (this._childIndex !== -1) {\n this._startCloseTimer();\n }\n\n // Cancel the open timer to give a full delay for opening.\n this._cancelOpenTimer();\n\n // Bail if the active item is not a valid submenu item.\n let item = this.activeItem;\n if (!item || item.type !== 'submenu' || !item.submenu) {\n return;\n }\n\n // Start the open timer to open the active item submenu.\n this._startOpenTimer();\n }\n\n /**\n * Handle the `'mouseenter'` event for the menu.\n *\n * #### Notes\n * This listener is attached to the menu node.\n */\n private _evtMouseEnter(event: MouseEvent): void {\n // Synchronize the active ancestor items.\n for (let menu = this._parentMenu; menu; menu = menu._parentMenu) {\n menu._cancelOpenTimer();\n menu._cancelCloseTimer();\n menu.activeIndex = menu._childIndex;\n }\n }\n\n /**\n * Handle the `'mouseleave'` event for the menu.\n *\n * #### Notes\n * This listener is attached to the menu node.\n */\n private _evtMouseLeave(event: MouseEvent): void {\n // Cancel any pending submenu opening.\n this._cancelOpenTimer();\n\n // If there is no open child menu, just reset the active index.\n if (!this._childMenu) {\n this.activeIndex = -1;\n return;\n }\n\n // If the mouse is over the child menu, cancel the close timer.\n let { clientX, clientY } = event;\n if (ElementExt.hitTest(this._childMenu.node, clientX, clientY)) {\n this._cancelCloseTimer();\n return;\n }\n\n // Otherwise, reset the active index and start the close timer.\n this.activeIndex = -1;\n this._startCloseTimer();\n }\n\n /**\n * Handle the `'mousedown'` event for the menu.\n *\n * #### Notes\n * This listener is attached to the document node.\n */\n private _evtMouseDown(event: MouseEvent): void {\n // Bail if the menu is not a root menu.\n if (this._parentMenu) {\n return;\n }\n\n // The mouse button which is pressed is irrelevant. If the press\n // is not on a menu, the entire hierarchy is closed and the event\n // is allowed to propagate. This allows other code to act on the\n // event, such as focusing the clicked element.\n if (Private.hitTestMenus(this, event.clientX, event.clientY)) {\n event.preventDefault();\n event.stopPropagation();\n } else {\n this.close();\n }\n }\n\n /**\n * Open the child menu at the active index immediately.\n *\n * If a different child menu is already open, it will be closed,\n * even if the active item is not a valid submenu.\n */\n private _openChildMenu(activateFirst = false): void {\n // If the item is not a valid submenu, close the child menu.\n let item = this.activeItem;\n if (!item || item.type !== 'submenu' || !item.submenu) {\n this._closeChildMenu();\n return;\n }\n\n // Do nothing if the child menu will not change.\n let submenu = item.submenu;\n if (submenu === this._childMenu) {\n return;\n }\n\n // Prior to any DOM modifications save window data\n Menu.saveWindowData();\n\n // Ensure the current child menu is closed.\n this._closeChildMenu();\n\n // Update the private child state.\n this._childMenu = submenu;\n this._childIndex = this._activeIndex;\n\n // Set the parent menu reference for the child.\n submenu._parentMenu = this;\n\n // Ensure the menu is updated and lookup the item node.\n MessageLoop.sendMessage(this, Widget.Msg.UpdateRequest);\n let itemNode = this.contentNode.children[this._activeIndex];\n\n // Open the submenu at the active node.\n Private.openSubmenu(submenu, itemNode as HTMLElement);\n\n // Activate the first item if desired.\n if (activateFirst) {\n submenu.activeIndex = -1;\n submenu.activateNextItem();\n }\n\n // Activate the child menu.\n submenu.activate();\n }\n\n /**\n * Close the child menu immediately.\n *\n * This is a no-op if a child menu is not open.\n */\n private _closeChildMenu(): void {\n if (this._childMenu) {\n this._childMenu.close();\n }\n }\n\n /**\n * Start the open timer, unless it is already pending.\n */\n private _startOpenTimer(): void {\n if (this._openTimerID === 0) {\n this._openTimerID = window.setTimeout(() => {\n this._openTimerID = 0;\n this._openChildMenu();\n }, Private.TIMER_DELAY);\n }\n }\n\n /**\n * Start the close timer, unless it is already pending.\n */\n private _startCloseTimer(): void {\n if (this._closeTimerID === 0) {\n this._closeTimerID = window.setTimeout(() => {\n this._closeTimerID = 0;\n this._closeChildMenu();\n }, Private.TIMER_DELAY);\n }\n }\n\n /**\n * Cancel the open timer, if the timer is pending.\n */\n private _cancelOpenTimer(): void {\n if (this._openTimerID !== 0) {\n clearTimeout(this._openTimerID);\n this._openTimerID = 0;\n }\n }\n\n /**\n * Cancel the close timer, if the timer is pending.\n */\n private _cancelCloseTimer(): void {\n if (this._closeTimerID !== 0) {\n clearTimeout(this._closeTimerID);\n this._closeTimerID = 0;\n }\n }\n\n /**\n * Save window data used for menu positioning in transient cache.\n *\n * In order to avoid layout trashing it is recommended to invoke this\n * method immediately prior to opening the menu and any DOM modifications\n * (like closing previously visible menu, or adding a class to menu widget).\n *\n * The transient cache will be released upon `open()` call.\n */\n static saveWindowData(): void {\n Private.saveWindowData();\n }\n\n private _childIndex = -1;\n private _activeIndex = -1;\n private _openTimerID = 0;\n private _closeTimerID = 0;\n private _items: Menu.IItem[] = [];\n private _childMenu: Menu | null = null;\n private _parentMenu: Menu | null = null;\n private _aboutToClose = new Signal(this);\n private _menuRequested = new Signal(this);\n}\n\n/**\n * The namespace for the `Menu` class statics.\n */\nexport namespace Menu {\n /**\n * An options object for creating a menu.\n */\n export interface IOptions {\n /**\n * The command registry for use with the menu.\n */\n commands: CommandRegistry;\n\n /**\n * A custom renderer for use with the menu.\n *\n * The default is a shared renderer instance.\n */\n renderer?: IRenderer;\n }\n\n /**\n * An options object for the `open` method on a menu.\n */\n export interface IOpenOptions {\n /**\n * Whether to force the X position of the menu.\n *\n * Setting to `true` will disable the logic which repositions the\n * X coordinate of the menu if it will not fit entirely on screen.\n *\n * The default is `false`.\n */\n forceX?: boolean;\n\n /**\n * Whether to force the Y position of the menu.\n *\n * Setting to `true` will disable the logic which repositions the\n * Y coordinate of the menu if it will not fit entirely on screen.\n *\n * The default is `false`.\n */\n forceY?: boolean;\n\n /**\n * The DOM node to use as the menu's host.\n *\n * If not specified then uses `document.body`.\n */\n host?: HTMLElement;\n\n /**\n * The child of `host` to use as the reference element.\n * If this is provided, the menu will be inserted before this\n * node in the host. The default is `null`, which will cause the\n * menu to be added as the last child of the host.\n */\n ref?: HTMLElement;\n\n /**\n * The alignment of the menu.\n *\n * The default is `'left'` unless the document `dir` attribute is `'rtl'`\n */\n horizontalAlignment?: 'left' | 'right';\n }\n\n /**\n * A type alias for a menu item type.\n */\n export type ItemType = 'command' | 'submenu' | 'separator';\n\n /**\n * An options object for creating a menu item.\n */\n export interface IItemOptions {\n /**\n * The type of the menu item.\n *\n * The default value is `'command'`.\n */\n type?: ItemType;\n\n /**\n * The command to execute when the item is triggered.\n *\n * The default value is an empty string.\n */\n command?: string;\n\n /**\n * The arguments for the command.\n *\n * The default value is an empty object.\n */\n args?: ReadonlyJSONObject;\n\n /**\n * The submenu for a `'submenu'` type item.\n *\n * The default value is `null`.\n */\n submenu?: Menu | null;\n }\n\n /**\n * An object which represents a menu item.\n *\n * #### Notes\n * Item objects are created automatically by a menu.\n */\n export interface IItem {\n /**\n * The type of the menu item.\n */\n readonly type: ItemType;\n\n /**\n * The command to execute when the item is triggered.\n */\n readonly command: string;\n\n /**\n * The arguments for the command.\n */\n readonly args: ReadonlyJSONObject;\n\n /**\n * The submenu for a `'submenu'` type item.\n */\n readonly submenu: Menu | null;\n\n /**\n * The display label for the menu item.\n */\n readonly label: string;\n\n /**\n * The mnemonic index for the menu item.\n */\n readonly mnemonic: number;\n\n /**\n * The icon renderer for the menu item.\n */\n readonly icon: VirtualElement.IRenderer | undefined;\n\n /**\n * The icon class for the menu item.\n */\n readonly iconClass: string;\n\n /**\n * The icon label for the menu item.\n */\n readonly iconLabel: string;\n\n /**\n * The display caption for the menu item.\n */\n readonly caption: string;\n\n /**\n * The extra class name for the menu item.\n */\n readonly className: string;\n\n /**\n * The dataset for the menu item.\n */\n readonly dataset: CommandRegistry.Dataset;\n\n /**\n * Whether the menu item is enabled.\n */\n readonly isEnabled: boolean;\n\n /**\n * Whether the menu item is toggled.\n */\n readonly isToggled: boolean;\n\n /**\n * Whether the menu item is visible.\n */\n readonly isVisible: boolean;\n\n /**\n * The key binding for the menu item.\n */\n readonly keyBinding: CommandRegistry.IKeyBinding | null;\n }\n\n /**\n * An object which holds the data to render a menu item.\n */\n export interface IRenderData {\n /**\n * The item to be rendered.\n */\n readonly item: IItem;\n\n /**\n * Whether the item is the active item.\n */\n readonly active: boolean;\n\n /**\n * Whether the item should be collapsed.\n */\n readonly collapsed: boolean;\n\n /**\n * Handler for when element is in focus.\n */\n readonly onfocus?: () => void;\n }\n\n /**\n * A renderer for use with a menu.\n */\n export interface IRenderer {\n /**\n * Render the virtual element for a menu item.\n *\n * @param data - The data to use for rendering the item.\n *\n * @returns A virtual element representing the item.\n */\n renderItem(data: IRenderData): VirtualElement;\n }\n\n /**\n * The default implementation of `IRenderer`.\n *\n * #### Notes\n * Subclasses are free to reimplement rendering methods as needed.\n */\n export class Renderer implements IRenderer {\n /**\n * Render the virtual element for a menu item.\n *\n * @param data - The data to use for rendering the item.\n *\n * @returns A virtual element representing the item.\n */\n renderItem(data: IRenderData): VirtualElement {\n let className = this.createItemClass(data);\n let dataset = this.createItemDataset(data);\n let aria = this.createItemARIA(data);\n return h.li(\n {\n className,\n dataset,\n tabindex: '0',\n onfocus: data.onfocus,\n ...aria\n },\n this.renderIcon(data),\n this.renderLabel(data),\n this.renderShortcut(data),\n this.renderSubmenu(data)\n );\n }\n\n /**\n * Render the icon element for a menu item.\n *\n * @param data - The data to use for rendering the icon.\n *\n * @returns A virtual element representing the item icon.\n */\n renderIcon(data: IRenderData): VirtualElement {\n let className = this.createIconClass(data);\n\n // If data.item.icon is undefined, it will be ignored.\n return h.div({ className }, data.item.icon!, data.item.iconLabel);\n }\n\n /**\n * Render the label element for a menu item.\n *\n * @param data - The data to use for rendering the label.\n *\n * @returns A virtual element representing the item label.\n */\n renderLabel(data: IRenderData): VirtualElement {\n let content = this.formatLabel(data);\n return h.div({ className: 'lm-Menu-itemLabel' }, content);\n }\n\n /**\n * Render the shortcut element for a menu item.\n *\n * @param data - The data to use for rendering the shortcut.\n *\n * @returns A virtual element representing the item shortcut.\n */\n renderShortcut(data: IRenderData): VirtualElement {\n let content = this.formatShortcut(data);\n return h.div({ className: 'lm-Menu-itemShortcut' }, content);\n }\n\n /**\n * Render the submenu icon element for a menu item.\n *\n * @param data - The data to use for rendering the submenu icon.\n *\n * @returns A virtual element representing the submenu icon.\n */\n renderSubmenu(data: IRenderData): VirtualElement {\n return h.div({ className: 'lm-Menu-itemSubmenuIcon' });\n }\n\n /**\n * Create the class name for the menu item.\n *\n * @param data - The data to use for the class name.\n *\n * @returns The full class name for the menu item.\n */\n createItemClass(data: IRenderData): string {\n // Setup the initial class name.\n let name = 'lm-Menu-item';\n\n // Add the boolean state classes.\n if (!data.item.isEnabled) {\n name += ' lm-mod-disabled';\n }\n if (data.item.isToggled) {\n name += ' lm-mod-toggled';\n }\n if (!data.item.isVisible) {\n name += ' lm-mod-hidden';\n }\n if (data.active) {\n name += ' lm-mod-active';\n }\n if (data.collapsed) {\n name += ' lm-mod-collapsed';\n }\n\n // Add the extra class.\n let extra = data.item.className;\n if (extra) {\n name += ` ${extra}`;\n }\n\n // Return the complete class name.\n return name;\n }\n\n /**\n * Create the dataset for the menu item.\n *\n * @param data - The data to use for creating the dataset.\n *\n * @returns The dataset for the menu item.\n */\n createItemDataset(data: IRenderData): ElementDataset {\n let result: ElementDataset;\n let { type, command, dataset } = data.item;\n if (type === 'command') {\n result = { ...dataset, type, command };\n } else {\n result = { ...dataset, type };\n }\n return result;\n }\n\n /**\n * Create the class name for the menu item icon.\n *\n * @param data - The data to use for the class name.\n *\n * @returns The full class name for the item icon.\n */\n createIconClass(data: IRenderData): string {\n let name = 'lm-Menu-itemIcon';\n let extra = data.item.iconClass;\n return extra ? `${name} ${extra}` : name;\n }\n\n /**\n * Create the aria attributes for menu item.\n *\n * @param data - The data to use for the aria attributes.\n *\n * @returns The aria attributes object for the item.\n */\n createItemARIA(data: IRenderData): ElementARIAAttrs {\n let aria: { [T in ARIAAttrNames]?: string } = {};\n switch (data.item.type) {\n case 'separator':\n aria.role = 'presentation';\n break;\n case 'submenu':\n aria['aria-haspopup'] = 'true';\n if (!data.item.isEnabled) {\n aria['aria-disabled'] = 'true';\n }\n break;\n default:\n if (!data.item.isEnabled) {\n aria['aria-disabled'] = 'true';\n }\n if (data.item.isToggled) {\n aria.role = 'menuitemcheckbox';\n aria['aria-checked'] = 'true';\n } else {\n aria.role = 'menuitem';\n }\n }\n return aria;\n }\n\n /**\n * Create the render content for the label node.\n *\n * @param data - The data to use for the label content.\n *\n * @returns The content to add to the label node.\n */\n formatLabel(data: IRenderData): h.Child {\n // Fetch the label text and mnemonic index.\n let { label, mnemonic } = data.item;\n\n // If the index is out of range, do not modify the label.\n if (mnemonic < 0 || mnemonic >= label.length) {\n return label;\n }\n\n // Split the label into parts.\n let prefix = label.slice(0, mnemonic);\n let suffix = label.slice(mnemonic + 1);\n let char = label[mnemonic];\n\n // Wrap the mnemonic character in a span.\n let span = h.span({ className: 'lm-Menu-itemMnemonic' }, char);\n\n // Return the content parts.\n return [prefix, span, suffix];\n }\n\n /**\n * Create the render content for the shortcut node.\n *\n * @param data - The data to use for the shortcut content.\n *\n * @returns The content to add to the shortcut node.\n */\n formatShortcut(data: IRenderData): h.Child {\n let kb = data.item.keyBinding;\n return kb ? CommandRegistry.formatKeystroke(kb.keys) : null;\n }\n }\n\n /**\n * The default `Renderer` instance.\n */\n export const defaultRenderer = new Renderer();\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * The ms delay for opening and closing a submenu.\n */\n export const TIMER_DELAY = 300;\n\n /**\n * The horizontal pixel overlap for an open submenu.\n */\n export const SUBMENU_OVERLAP = 3;\n\n let transientWindowDataCache: IWindowData | null = null;\n let transientCacheCounter: number = 0;\n\n function getWindowData(): IWindowData {\n // if transient cache is in use, take one from it\n if (transientCacheCounter > 0) {\n transientCacheCounter--;\n return transientWindowDataCache!;\n }\n return _getWindowData();\n }\n\n /**\n * Store window data in transient cache.\n *\n * The transient cache will be released upon `getWindowData()` call.\n * If this function is called multiple times, the cache will be\n * retained until as many calls to `getWindowData()` were made.\n *\n * Note: should be called before any DOM modifications.\n */\n export function saveWindowData(): void {\n transientWindowDataCache = _getWindowData();\n transientCacheCounter++;\n }\n\n /**\n * Create the DOM node for a menu.\n */\n export function createNode(): HTMLDivElement {\n let node = document.createElement('div');\n let content = document.createElement('ul');\n content.className = 'lm-Menu-content';\n node.appendChild(content);\n content.setAttribute('role', 'menu');\n node.tabIndex = 0;\n return node;\n }\n\n /**\n * Test whether a menu item can be activated.\n */\n export function canActivate(item: Menu.IItem): boolean {\n return item.type !== 'separator' && item.isEnabled && item.isVisible;\n }\n\n /**\n * Create a new menu item for an owner menu.\n */\n export function createItem(\n owner: Menu,\n options: Menu.IItemOptions\n ): Menu.IItem {\n return new MenuItem(owner.commands, options);\n }\n\n /**\n * Hit test a menu hierarchy starting at the given root.\n */\n export function hitTestMenus(menu: Menu, x: number, y: number): boolean {\n for (let temp: Menu | null = menu; temp; temp = temp.childMenu) {\n if (ElementExt.hitTest(temp.node, x, y)) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * Compute which extra separator items should be collapsed.\n */\n export function computeCollapsed(\n items: ReadonlyArray\n ): boolean[] {\n // Allocate the return array and fill it with `false`.\n let result = new Array(items.length);\n ArrayExt.fill(result, false);\n\n // Collapse the leading separators.\n let k1 = 0;\n let n = items.length;\n for (; k1 < n; ++k1) {\n let item = items[k1];\n if (!item.isVisible) {\n continue;\n }\n if (item.type !== 'separator') {\n break;\n }\n result[k1] = true;\n }\n\n // Hide the trailing separators.\n let k2 = n - 1;\n for (; k2 >= 0; --k2) {\n let item = items[k2];\n if (!item.isVisible) {\n continue;\n }\n if (item.type !== 'separator') {\n break;\n }\n result[k2] = true;\n }\n\n // Hide the remaining consecutive separators.\n let hide = false;\n while (++k1 < k2) {\n let item = items[k1];\n if (!item.isVisible) {\n continue;\n }\n if (item.type !== 'separator') {\n hide = false;\n } else if (hide) {\n result[k1] = true;\n } else {\n hide = true;\n }\n }\n\n // Return the resulting flags.\n return result;\n }\n\n function _getWindowData(): IWindowData {\n return {\n pageXOffset: window.pageXOffset,\n pageYOffset: window.pageYOffset,\n clientWidth: document.documentElement.clientWidth,\n clientHeight: document.documentElement.clientHeight\n };\n }\n\n /**\n * Open a menu as a root menu at the target location.\n */\n export function openRootMenu(\n menu: Menu,\n x: number,\n y: number,\n forceX: boolean,\n forceY: boolean,\n horizontalAlignment: 'left' | 'right',\n host: HTMLElement | null,\n ref: HTMLElement | null\n ): void {\n // Get the current position and size of the main viewport.\n const windowData = getWindowData();\n let px = windowData.pageXOffset;\n let py = windowData.pageYOffset;\n let cw = windowData.clientWidth;\n let ch = windowData.clientHeight;\n\n // Ensure the menu is updated before attaching and measuring.\n MessageLoop.sendMessage(menu, Widget.Msg.UpdateRequest);\n\n // Compute the maximum allowed height for the menu.\n let maxHeight = ch - (forceY ? y : 0);\n\n // Fetch common variables.\n let node = menu.node;\n let style = node.style;\n\n // Clear the menu geometry and prepare it for measuring.\n style.opacity = '0';\n style.maxHeight = `${maxHeight}px`;\n\n // Attach the menu to the document.\n Widget.attach(menu, host || document.body, ref);\n\n // Measure the size of the menu.\n let { width, height } = node.getBoundingClientRect();\n\n // align the menu to the right of the target if requested or language is RTL\n if (horizontalAlignment === 'right') {\n x -= width;\n }\n\n // Adjust the X position of the menu to fit on-screen.\n if (!forceX && x + width > px + cw) {\n x = px + cw - width;\n }\n\n // Adjust the Y position of the menu to fit on-screen.\n if (!forceY && y + height > py + ch) {\n if (y > py + ch) {\n y = py + ch - height;\n } else {\n y = y - height;\n }\n }\n\n // Update the position of the menu to the computed position.\n style.transform = `translate(${Math.max(0, x)}px, ${Math.max(0, y)}px`;\n\n // Finally, make the menu visible on the screen.\n style.opacity = '1';\n }\n\n /**\n * Open a menu as a submenu using an item node for positioning.\n */\n export function openSubmenu(submenu: Menu, itemNode: HTMLElement): void {\n // Get the current position and size of the main viewport.\n const windowData = getWindowData();\n let px = windowData.pageXOffset;\n let py = windowData.pageYOffset;\n let cw = windowData.clientWidth;\n let ch = windowData.clientHeight;\n\n // Ensure the menu is updated before opening.\n MessageLoop.sendMessage(submenu, Widget.Msg.UpdateRequest);\n\n // Compute the maximum allowed height for the menu.\n let maxHeight = ch;\n\n // Fetch common variables.\n let node = submenu.node;\n let style = node.style;\n\n // Clear the menu geometry and prepare it for measuring.\n style.opacity = '0';\n style.maxHeight = `${maxHeight}px`;\n\n // Attach the menu to the document.\n Widget.attach(submenu, document.body);\n\n // Measure the size of the menu.\n let { width, height } = node.getBoundingClientRect();\n\n // Compute the box sizing for the menu.\n let box = ElementExt.boxSizing(submenu.node);\n\n // Get the bounding rect for the target item node.\n let itemRect = itemNode.getBoundingClientRect();\n\n // Compute the target X position.\n let x = itemRect.right - SUBMENU_OVERLAP;\n\n // Adjust the X position to fit on the screen.\n if (x + width > px + cw) {\n x = itemRect.left + SUBMENU_OVERLAP - width;\n }\n\n // Compute the target Y position.\n let y = itemRect.top - box.borderTop - box.paddingTop;\n\n // Adjust the Y position to fit on the screen.\n if (y + height > py + ch) {\n y = itemRect.bottom + box.borderBottom + box.paddingBottom - height;\n }\n\n // Update the position of the menu to the computed position.\n style.transform = `translate(${Math.max(0, x)}px, ${Math.max(0, y)}px`;\n\n // Finally, make the menu visible on the screen.\n style.opacity = '1';\n }\n\n /**\n * The results of a mnemonic search.\n */\n export interface IMnemonicResult {\n /**\n * The index of the first matching mnemonic item, or `-1`.\n */\n index: number;\n\n /**\n * Whether multiple mnemonic items matched.\n */\n multiple: boolean;\n\n /**\n * The index of the first auto matched non-mnemonic item.\n */\n auto: number;\n }\n\n /**\n * Find the best matching mnemonic item.\n *\n * The search starts at the given index and wraps around.\n */\n export function findMnemonic(\n items: ReadonlyArray,\n key: string,\n start: number\n ): IMnemonicResult {\n // Setup the result variables.\n let index = -1;\n let auto = -1;\n let multiple = false;\n\n // Normalize the key to upper case.\n let upperKey = key.toUpperCase();\n\n // Search the items from the given start index.\n for (let i = 0, n = items.length; i < n; ++i) {\n // Compute the wrapped index.\n let k = (i + start) % n;\n\n // Lookup the item\n let item = items[k];\n\n // Ignore items which cannot be activated.\n if (!canActivate(item)) {\n continue;\n }\n\n // Ignore items with an empty label.\n let label = item.label;\n if (label.length === 0) {\n continue;\n }\n\n // Lookup the mnemonic index for the label.\n let mn = item.mnemonic;\n\n // Handle a valid mnemonic index.\n if (mn >= 0 && mn < label.length) {\n if (label[mn].toUpperCase() === upperKey) {\n if (index === -1) {\n index = k;\n } else {\n multiple = true;\n }\n }\n continue;\n }\n\n // Finally, handle the auto index if possible.\n if (auto === -1 && label[0].toUpperCase() === upperKey) {\n auto = k;\n }\n }\n\n // Return the search results.\n return { index, multiple, auto };\n }\n\n /**\n * A concrete implementation of `Menu.IItem`.\n */\n class MenuItem implements Menu.IItem {\n /**\n * Construct a new menu item.\n */\n constructor(commands: CommandRegistry, options: Menu.IItemOptions) {\n this._commands = commands;\n this.type = options.type || 'command';\n this.command = options.command || '';\n this.args = options.args || JSONExt.emptyObject;\n this.submenu = options.submenu || null;\n }\n\n /**\n * The type of the menu item.\n */\n readonly type: Menu.ItemType;\n\n /**\n * The command to execute when the item is triggered.\n */\n readonly command: string;\n\n /**\n * The arguments for the command.\n */\n readonly args: ReadonlyJSONObject;\n\n /**\n * The submenu for a `'submenu'` type item.\n */\n readonly submenu: Menu | null;\n\n /**\n * The display label for the menu item.\n */\n get label(): string {\n if (this.type === 'command') {\n return this._commands.label(this.command, this.args);\n }\n if (this.type === 'submenu' && this.submenu) {\n return this.submenu.title.label;\n }\n return '';\n }\n\n /**\n * The mnemonic index for the menu item.\n */\n get mnemonic(): number {\n if (this.type === 'command') {\n return this._commands.mnemonic(this.command, this.args);\n }\n if (this.type === 'submenu' && this.submenu) {\n return this.submenu.title.mnemonic;\n }\n return -1;\n }\n\n /**\n * The icon renderer for the menu item.\n */\n get icon(): VirtualElement.IRenderer | undefined {\n if (this.type === 'command') {\n return this._commands.icon(this.command, this.args);\n }\n if (this.type === 'submenu' && this.submenu) {\n return this.submenu.title.icon;\n }\n return undefined;\n }\n\n /**\n * The icon class for the menu item.\n */\n get iconClass(): string {\n if (this.type === 'command') {\n return this._commands.iconClass(this.command, this.args);\n }\n if (this.type === 'submenu' && this.submenu) {\n return this.submenu.title.iconClass;\n }\n return '';\n }\n\n /**\n * The icon label for the menu item.\n */\n get iconLabel(): string {\n if (this.type === 'command') {\n return this._commands.iconLabel(this.command, this.args);\n }\n if (this.type === 'submenu' && this.submenu) {\n return this.submenu.title.iconLabel;\n }\n return '';\n }\n\n /**\n * The display caption for the menu item.\n */\n get caption(): string {\n if (this.type === 'command') {\n return this._commands.caption(this.command, this.args);\n }\n if (this.type === 'submenu' && this.submenu) {\n return this.submenu.title.caption;\n }\n return '';\n }\n\n /**\n * The extra class name for the menu item.\n */\n get className(): string {\n if (this.type === 'command') {\n return this._commands.className(this.command, this.args);\n }\n if (this.type === 'submenu' && this.submenu) {\n return this.submenu.title.className;\n }\n return '';\n }\n\n /**\n * The dataset for the menu item.\n */\n get dataset(): CommandRegistry.Dataset {\n if (this.type === 'command') {\n return this._commands.dataset(this.command, this.args);\n }\n if (this.type === 'submenu' && this.submenu) {\n return this.submenu.title.dataset;\n }\n return {};\n }\n\n /**\n * Whether the menu item is enabled.\n */\n get isEnabled(): boolean {\n if (this.type === 'command') {\n return this._commands.isEnabled(this.command, this.args);\n }\n if (this.type === 'submenu') {\n return this.submenu !== null;\n }\n return true;\n }\n\n /**\n * Whether the menu item is toggled.\n */\n get isToggled(): boolean {\n if (this.type === 'command') {\n return this._commands.isToggled(this.command, this.args);\n }\n return false;\n }\n\n /**\n * Whether the menu item is visible.\n */\n get isVisible(): boolean {\n if (this.type === 'command') {\n return this._commands.isVisible(this.command, this.args);\n }\n if (this.type === 'submenu') {\n return this.submenu !== null;\n }\n return true;\n }\n\n /**\n * The key binding for the menu item.\n */\n get keyBinding(): CommandRegistry.IKeyBinding | null {\n if (this.type === 'command') {\n let { command, args } = this;\n return (\n ArrayExt.findLastValue(this._commands.keyBindings, kb => {\n return kb.command === command && JSONExt.deepEqual(kb.args, args);\n }) || null\n );\n }\n return null;\n }\n\n private _commands: CommandRegistry;\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { CommandRegistry } from '@lumino/commands';\n\nimport { DisposableDelegate, IDisposable } from '@lumino/disposable';\n\nimport { Selector } from '@lumino/domutils';\n\nimport { Menu } from './menu';\n\n/**\n * An object which implements a universal context menu.\n *\n * #### Notes\n * The items shown in the context menu are determined by CSS selector\n * matching against the DOM hierarchy at the site of the mouse click.\n * This is similar in concept to how keyboard shortcuts are matched\n * in the command registry.\n */\nexport class ContextMenu {\n /**\n * Construct a new context menu.\n *\n * @param options - The options for initializing the menu.\n */\n constructor(options: ContextMenu.IOptions) {\n const { groupByTarget, sortBySelector, ...others } = options;\n this.menu = new Menu(others);\n this._groupByTarget = groupByTarget !== false;\n this._sortBySelector = sortBySelector !== false;\n }\n\n /**\n * The menu widget which displays the matched context items.\n */\n readonly menu: Menu;\n\n /**\n * Add an item to the context menu.\n *\n * @param options - The options for creating the item.\n *\n * @returns A disposable which will remove the item from the menu.\n */\n addItem(options: ContextMenu.IItemOptions): IDisposable {\n // Create an item from the given options.\n let item = Private.createItem(options, this._idTick++);\n\n // Add the item to the internal array.\n this._items.push(item);\n\n // Return a disposable which will remove the item.\n return new DisposableDelegate(() => {\n ArrayExt.removeFirstOf(this._items, item);\n });\n }\n\n /**\n * Open the context menu in response to a `'contextmenu'` event.\n *\n * @param event - The `'contextmenu'` event of interest.\n *\n * @returns `true` if the menu was opened, or `false` if no items\n * matched the event and the menu was not opened.\n *\n * #### Notes\n * This method will populate the context menu with items which match\n * the propagation path of the event, then open the menu at the mouse\n * position indicated by the event.\n */\n open(event: MouseEvent): boolean {\n // Prior to any DOM modifications update the window data.\n Menu.saveWindowData();\n\n // Clear the current contents of the context menu.\n this.menu.clearItems();\n\n // Bail early if there are no items to match.\n if (this._items.length === 0) {\n return false;\n }\n\n // Find the matching items for the event.\n let items = Private.matchItems(\n this._items,\n event,\n this._groupByTarget,\n this._sortBySelector\n );\n\n // Bail if there are no matching items.\n if (!items || items.length === 0) {\n return false;\n }\n\n // Add the filtered items to the menu.\n for (const item of items) {\n this.menu.addItem(item);\n }\n\n // Open the context menu at the current mouse position.\n this.menu.open(event.clientX, event.clientY);\n\n // Indicate success.\n return true;\n }\n\n private _groupByTarget: boolean = true;\n private _idTick = 0;\n private _items: Private.IItem[] = [];\n private _sortBySelector: boolean = true;\n}\n\n/**\n * The namespace for the `ContextMenu` class statics.\n */\nexport namespace ContextMenu {\n /**\n * An options object for initializing a context menu.\n */\n export interface IOptions {\n /**\n * The command registry to use with the context menu.\n */\n commands: CommandRegistry;\n\n /**\n * A custom renderer for use with the context menu.\n */\n renderer?: Menu.IRenderer;\n\n /**\n * Whether to sort by selector and rank or only rank.\n *\n * Default true.\n */\n sortBySelector?: boolean;\n\n /**\n * Whether to group items following the DOM hierarchy.\n *\n * Default true.\n *\n * #### Note\n * If true, when the mouse event occurs on element `span` within `div.top`,\n * the items matching `div.top` will be shown before the ones matching `body`.\n */\n groupByTarget?: boolean;\n }\n\n /**\n * An options object for creating a context menu item.\n */\n export interface IItemOptions extends Menu.IItemOptions {\n /**\n * The CSS selector for the context menu item.\n *\n * The context menu item will only be displayed in the context menu\n * when the selector matches a node on the propagation path of the\n * contextmenu event. This allows the menu item to be restricted to\n * user-defined contexts.\n *\n * The selector must not contain commas.\n */\n selector: string;\n\n /**\n * The rank for the item.\n *\n * The rank is used as a tie-breaker when ordering context menu\n * items for display. Items are sorted in the following order:\n * 1. Depth in the DOM tree (deeper is better)\n * 2. Selector specificity (higher is better)\n * 3. Rank (lower is better)\n * 4. Insertion order\n *\n * The default rank is `Infinity`.\n */\n rank?: number;\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * A normalized item for a context menu.\n */\n export interface IItem extends Menu.IItemOptions {\n /**\n * The selector for the item.\n */\n selector: string;\n\n /**\n * The rank for the item.\n */\n rank: number;\n\n /**\n * The tie-breaking id for the item.\n */\n id: number;\n }\n\n /**\n * Create a normalized context menu item from an options object.\n */\n export function createItem(\n options: ContextMenu.IItemOptions,\n id: number\n ): IItem {\n let selector = validateSelector(options.selector);\n let rank = options.rank !== undefined ? options.rank : Infinity;\n return { ...options, selector, rank, id };\n }\n\n /**\n * Find the items which match a context menu event.\n *\n * The results are sorted by DOM level, specificity, and rank.\n */\n export function matchItems(\n items: IItem[],\n event: MouseEvent,\n groupByTarget: boolean,\n sortBySelector: boolean\n ): IItem[] | null {\n // Look up the target of the event.\n let target = event.target as Element | null;\n\n // Bail if there is no target.\n if (!target) {\n return null;\n }\n\n // Look up the current target of the event.\n let currentTarget = event.currentTarget as Element | null;\n\n // Bail if there is no current target.\n if (!currentTarget) {\n return null;\n }\n\n // There are some third party libraries that cause the `target` to\n // be detached from the DOM before lumino can process the event.\n // If that happens, search for a new target node by point. If that\n // node is still dangling, bail.\n if (!currentTarget.contains(target)) {\n target = document.elementFromPoint(event.clientX, event.clientY);\n if (!target || !currentTarget.contains(target)) {\n return null;\n }\n }\n\n // Set up the result array.\n let result: IItem[] = [];\n\n // Copy the items array to allow in-place modification.\n let availableItems: Array = items.slice();\n\n // Walk up the DOM hierarchy searching for matches.\n while (target !== null) {\n // Set up the match array for this DOM level.\n let matches: IItem[] = [];\n\n // Search the remaining items for matches.\n for (let i = 0, n = availableItems.length; i < n; ++i) {\n // Fetch the item.\n let item = availableItems[i];\n\n // Skip items which are already consumed.\n if (!item) {\n continue;\n }\n\n // Skip items which do not match the element.\n if (!Selector.matches(target, item.selector)) {\n continue;\n }\n\n // Add the matched item to the result for this DOM level.\n matches.push(item);\n\n // Mark the item as consumed.\n availableItems[i] = null;\n }\n\n // Sort the matches for this level and add them to the results.\n if (matches.length !== 0) {\n if (groupByTarget) {\n matches.sort(sortBySelector ? itemCmp : itemCmpRank);\n }\n result.push(...matches);\n }\n\n // Stop searching at the limits of the DOM range.\n if (target === currentTarget) {\n break;\n }\n\n // Step to the parent DOM level.\n target = target.parentElement;\n }\n\n if (!groupByTarget) {\n result.sort(sortBySelector ? itemCmp : itemCmpRank);\n }\n\n // Return the matched and sorted results.\n return result;\n }\n\n /**\n * Validate the selector for a menu item.\n *\n * This returns the validated selector, or throws if the selector is\n * invalid or contains commas.\n */\n function validateSelector(selector: string): string {\n if (selector.indexOf(',') !== -1) {\n throw new Error(`Selector cannot contain commas: ${selector}`);\n }\n if (!Selector.isValid(selector)) {\n throw new Error(`Invalid selector: ${selector}`);\n }\n return selector;\n }\n\n /**\n * A sort comparison function for a context menu item by ranks.\n */\n function itemCmpRank(a: IItem, b: IItem): number {\n // Sort based on rank.\n let r1 = a.rank;\n let r2 = b.rank;\n if (r1 !== r2) {\n return r1 < r2 ? -1 : 1; // Infinity-safe\n }\n\n // When all else fails, sort by item id.\n return a.id - b.id;\n }\n\n /**\n * A sort comparison function for a context menu item by selectors and ranks.\n */\n function itemCmp(a: IItem, b: IItem): number {\n // Sort first based on selector specificity.\n let s1 = Selector.calculateSpecificity(a.selector);\n let s2 = Selector.calculateSpecificity(b.selector);\n if (s1 !== s2) {\n return s2 - s1;\n }\n\n // If specificities are equal\n return itemCmpRank(a, b);\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { IDisposable } from '@lumino/disposable';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Drag } from '@lumino/dragdrop';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport {\n ElementARIAAttrs,\n ElementBaseAttrs,\n ElementDataset,\n ElementInlineStyle,\n h,\n VirtualDOM,\n VirtualElement\n} from '@lumino/virtualdom';\n\nimport { Title } from './title';\n\nimport { Widget } from './widget';\n\nconst ARROW_KEYS = [\n 'ArrowLeft',\n 'ArrowUp',\n 'ArrowRight',\n 'ArrowDown',\n 'Home',\n 'End'\n];\n\n/**\n * A widget which displays titles as a single row or column of tabs.\n *\n * #### Notes\n * If CSS transforms are used to rotate nodes for vertically oriented\n * text, then tab dragging will not work correctly. The `tabsMovable`\n * property should be set to `false` when rotating nodes from CSS.\n */\nexport class TabBar extends Widget {\n /**\n * Construct a new tab bar.\n *\n * @param options - The options for initializing the tab bar.\n */\n constructor(options: TabBar.IOptions = {}) {\n super({ node: Private.createNode() });\n this.addClass('lm-TabBar');\n this.contentNode.setAttribute('role', 'tablist');\n this.setFlag(Widget.Flag.DisallowLayout);\n this._document = options.document || document;\n this.tabsMovable = options.tabsMovable || false;\n this.titlesEditable = options.titlesEditable || false;\n this.allowDeselect = options.allowDeselect || false;\n this.addButtonEnabled = options.addButtonEnabled || false;\n this.insertBehavior = options.insertBehavior || 'select-tab-if-needed';\n this.name = options.name || '';\n this.orientation = options.orientation || 'horizontal';\n this.removeBehavior = options.removeBehavior || 'select-tab-after';\n this.renderer = options.renderer || TabBar.defaultRenderer;\n }\n\n /**\n * Dispose of the resources held by the widget.\n */\n dispose(): void {\n this._releaseMouse();\n this._titles.length = 0;\n this._previousTitle = null;\n super.dispose();\n }\n\n /**\n * A signal emitted when the current tab is changed.\n *\n * #### Notes\n * This signal is emitted when the currently selected tab is changed\n * either through user or programmatic interaction.\n *\n * Notably, this signal is not emitted when the index of the current\n * tab changes due to tabs being inserted, removed, or moved. It is\n * only emitted when the actual current tab node is changed.\n */\n get currentChanged(): ISignal> {\n return this._currentChanged;\n }\n\n /**\n * A signal emitted when a tab is moved by the user.\n *\n * #### Notes\n * This signal is emitted when a tab is moved by user interaction.\n *\n * This signal is not emitted when a tab is moved programmatically.\n */\n get tabMoved(): ISignal> {\n return this._tabMoved;\n }\n\n /**\n * A signal emitted when a tab is clicked by the user.\n *\n * #### Notes\n * If the clicked tab is not the current tab, the clicked tab will be\n * made current and the `currentChanged` signal will be emitted first.\n *\n * This signal is emitted even if the clicked tab is the current tab.\n */\n get tabActivateRequested(): ISignal<\n this,\n TabBar.ITabActivateRequestedArgs\n > {\n return this._tabActivateRequested;\n }\n\n /**\n * A signal emitted when the tab bar add button is clicked.\n */\n get addRequested(): ISignal {\n return this._addRequested;\n }\n\n /**\n * A signal emitted when a tab close icon is clicked.\n *\n * #### Notes\n * This signal is not emitted unless the tab title is `closable`.\n */\n get tabCloseRequested(): ISignal> {\n return this._tabCloseRequested;\n }\n\n /**\n * A signal emitted when a tab is dragged beyond the detach threshold.\n *\n * #### Notes\n * This signal is emitted when the user drags a tab with the mouse,\n * and mouse is dragged beyond the detach threshold.\n *\n * The consumer of the signal should call `releaseMouse` and remove\n * the tab in order to complete the detach.\n *\n * This signal is only emitted once per drag cycle.\n */\n get tabDetachRequested(): ISignal> {\n return this._tabDetachRequested;\n }\n\n /**\n * The renderer used by the tab bar.\n */\n readonly renderer: TabBar.IRenderer;\n\n /**\n * The document to use with the tab bar.\n *\n * The default is the global `document` instance.\n */\n get document(): Document | ShadowRoot {\n return this._document;\n }\n\n /**\n * Whether the tabs are movable by the user.\n *\n * #### Notes\n * Tabs can always be moved programmatically.\n */\n tabsMovable: boolean;\n\n /**\n * Whether the titles can be user-edited.\n *\n */\n get titlesEditable(): boolean {\n return this._titlesEditable;\n }\n\n /**\n * Set whether titles can be user edited.\n *\n */\n set titlesEditable(value: boolean) {\n this._titlesEditable = value;\n }\n\n /**\n * Whether a tab can be deselected by the user.\n *\n * #### Notes\n * Tabs can be always be deselected programmatically.\n */\n allowDeselect: boolean;\n\n /**\n * The selection behavior when inserting a tab.\n */\n insertBehavior: TabBar.InsertBehavior;\n\n /**\n * The selection behavior when removing a tab.\n */\n removeBehavior: TabBar.RemoveBehavior;\n\n /**\n * Get the currently selected title.\n *\n * #### Notes\n * This will be `null` if no tab is selected.\n */\n get currentTitle(): Title | null {\n return this._titles[this._currentIndex] || null;\n }\n\n /**\n * Set the currently selected title.\n *\n * #### Notes\n * If the title does not exist, the title will be set to `null`.\n */\n set currentTitle(value: Title | null) {\n this.currentIndex = value ? this._titles.indexOf(value) : -1;\n }\n\n /**\n * Get the index of the currently selected tab.\n *\n * #### Notes\n * This will be `-1` if no tab is selected.\n */\n get currentIndex(): number {\n return this._currentIndex;\n }\n\n /**\n * Set the index of the currently selected tab.\n *\n * #### Notes\n * If the value is out of range, the index will be set to `-1`.\n */\n set currentIndex(value: number) {\n // Adjust for an out of range index.\n if (value < 0 || value >= this._titles.length) {\n value = -1;\n }\n\n // Bail early if the index will not change.\n if (this._currentIndex === value) {\n return;\n }\n\n // Look up the previous index and title.\n let pi = this._currentIndex;\n let pt = this._titles[pi] || null;\n\n // Look up the current index and title.\n let ci = value;\n let ct = this._titles[ci] || null;\n\n // Update the current index and previous title.\n this._currentIndex = ci;\n this._previousTitle = pt;\n\n // Schedule an update of the tabs.\n this.update();\n\n // Emit the current changed signal.\n this._currentChanged.emit({\n previousIndex: pi,\n previousTitle: pt,\n currentIndex: ci,\n currentTitle: ct\n });\n }\n\n /**\n * Get the name of the tab bar.\n */\n get name(): string {\n return this._name;\n }\n\n /**\n * Set the name of the tab bar.\n */\n set name(value: string) {\n this._name = value;\n if (value) {\n this.contentNode.setAttribute('aria-label', value);\n } else {\n this.contentNode.removeAttribute('aria-label');\n }\n }\n\n /**\n * Get the orientation of the tab bar.\n *\n * #### Notes\n * This controls whether the tabs are arranged in a row or column.\n */\n get orientation(): TabBar.Orientation {\n return this._orientation;\n }\n\n /**\n * Set the orientation of the tab bar.\n *\n * #### Notes\n * This controls whether the tabs are arranged in a row or column.\n */\n set orientation(value: TabBar.Orientation) {\n // Do nothing if the orientation does not change.\n if (this._orientation === value) {\n return;\n }\n\n // Release the mouse before making any changes.\n this._releaseMouse();\n\n // Toggle the orientation values.\n this._orientation = value;\n this.dataset['orientation'] = value;\n this.contentNode.setAttribute('aria-orientation', value);\n }\n\n /**\n * Whether the add button is enabled.\n */\n get addButtonEnabled(): boolean {\n return this._addButtonEnabled;\n }\n\n /**\n * Set whether the add button is enabled.\n */\n set addButtonEnabled(value: boolean) {\n // Do nothing if the value does not change.\n if (this._addButtonEnabled === value) {\n return;\n }\n\n this._addButtonEnabled = value;\n if (value) {\n this.addButtonNode.classList.remove('lm-mod-hidden');\n } else {\n this.addButtonNode.classList.add('lm-mod-hidden');\n }\n }\n\n /**\n * A read-only array of the titles in the tab bar.\n */\n get titles(): ReadonlyArray> {\n return this._titles;\n }\n\n /**\n * The tab bar content node.\n *\n * #### Notes\n * This is the node which holds the tab nodes.\n *\n * Modifying this node directly can lead to undefined behavior.\n */\n get contentNode(): HTMLUListElement {\n return this.node.getElementsByClassName(\n 'lm-TabBar-content'\n )[0] as HTMLUListElement;\n }\n\n /**\n * The tab bar add button node.\n *\n * #### Notes\n * This is the node which holds the add button.\n *\n * Modifying this node directly can lead to undefined behavior.\n */\n get addButtonNode(): HTMLDivElement {\n return this.node.getElementsByClassName(\n 'lm-TabBar-addButton'\n )[0] as HTMLDivElement;\n }\n\n /**\n * Add a tab to the end of the tab bar.\n *\n * @param value - The title which holds the data for the tab,\n * or an options object to convert to a title.\n *\n * @returns The title object added to the tab bar.\n *\n * #### Notes\n * If the title is already added to the tab bar, it will be moved.\n */\n addTab(value: Title | Title.IOptions): Title {\n return this.insertTab(this._titles.length, value);\n }\n\n /**\n * Insert a tab into the tab bar at the specified index.\n *\n * @param index - The index at which to insert the tab.\n *\n * @param value - The title which holds the data for the tab,\n * or an options object to convert to a title.\n *\n * @returns The title object added to the tab bar.\n *\n * #### Notes\n * The index will be clamped to the bounds of the tabs.\n *\n * If the title is already added to the tab bar, it will be moved.\n */\n insertTab(index: number, value: Title | Title.IOptions): Title {\n // Release the mouse before making any changes.\n this._releaseMouse();\n\n // Coerce the value to a title.\n let title = Private.asTitle(value);\n\n // Look up the index of the title.\n let i = this._titles.indexOf(title);\n\n // Clamp the insert index to the array bounds.\n let j = Math.max(0, Math.min(index, this._titles.length));\n\n // If the title is not in the array, insert it.\n if (i === -1) {\n // Insert the title into the array.\n ArrayExt.insert(this._titles, j, title);\n\n // Connect to the title changed signal.\n title.changed.connect(this._onTitleChanged, this);\n\n // Schedule an update of the tabs.\n this.update();\n\n // Adjust the current index for the insert.\n this._adjustCurrentForInsert(j, title);\n\n // Return the title added to the tab bar.\n return title;\n }\n\n // Otherwise, the title exists in the array and should be moved.\n\n // Adjust the index if the location is at the end of the array.\n if (j === this._titles.length) {\n j--;\n }\n\n // Bail if there is no effective move.\n if (i === j) {\n return title;\n }\n\n // Move the title to the new location.\n ArrayExt.move(this._titles, i, j);\n\n // Schedule an update of the tabs.\n this.update();\n\n // Adjust the current index for the move.\n this._adjustCurrentForMove(i, j);\n\n // Return the title added to the tab bar.\n return title;\n }\n\n /**\n * Remove a tab from the tab bar.\n *\n * @param title - The title for the tab to remove.\n *\n * #### Notes\n * This is a no-op if the title is not in the tab bar.\n */\n removeTab(title: Title): void {\n this.removeTabAt(this._titles.indexOf(title));\n }\n\n /**\n * Remove the tab at a given index from the tab bar.\n *\n * @param index - The index of the tab to remove.\n *\n * #### Notes\n * This is a no-op if the index is out of range.\n */\n removeTabAt(index: number): void {\n // Release the mouse before making any changes.\n this._releaseMouse();\n\n // Remove the title from the array.\n let title = ArrayExt.removeAt(this._titles, index);\n\n // Bail if the index is out of range.\n if (!title) {\n return;\n }\n\n // Disconnect from the title changed signal.\n title.changed.disconnect(this._onTitleChanged, this);\n\n // Clear the previous title if it's being removed.\n if (title === this._previousTitle) {\n this._previousTitle = null;\n }\n\n // Schedule an update of the tabs.\n this.update();\n\n // Adjust the current index for the remove.\n this._adjustCurrentForRemove(index, title);\n }\n\n /**\n * Remove all tabs from the tab bar.\n */\n clearTabs(): void {\n // Bail if there is nothing to remove.\n if (this._titles.length === 0) {\n return;\n }\n\n // Release the mouse before making any changes.\n this._releaseMouse();\n\n // Disconnect from the title changed signals.\n for (let title of this._titles) {\n title.changed.disconnect(this._onTitleChanged, this);\n }\n\n // Get the current index and title.\n let pi = this.currentIndex;\n let pt = this.currentTitle;\n\n // Reset the current index and previous title.\n this._currentIndex = -1;\n this._previousTitle = null;\n\n // Clear the title array.\n this._titles.length = 0;\n\n // Schedule an update of the tabs.\n this.update();\n\n // If no tab was selected, there's nothing else to do.\n if (pi === -1) {\n return;\n }\n\n // Emit the current changed signal.\n this._currentChanged.emit({\n previousIndex: pi,\n previousTitle: pt,\n currentIndex: -1,\n currentTitle: null\n });\n }\n\n /**\n * Release the mouse and restore the non-dragged tab positions.\n *\n * #### Notes\n * This will cause the tab bar to stop handling mouse events and to\n * restore the tabs to their non-dragged positions.\n */\n releaseMouse(): void {\n this._releaseMouse();\n }\n\n /**\n * Handle the DOM events for the tab bar.\n *\n * @param event - The DOM event sent to the tab bar.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the tab bar's DOM node.\n *\n * This should not be called directly by user code.\n */\n handleEvent(event: Event): void {\n switch (event.type) {\n case 'pointerdown':\n this._evtPointerDown(event as PointerEvent);\n break;\n case 'pointermove':\n this._evtPointerMove(event as PointerEvent);\n break;\n case 'pointerup':\n this._evtPointerUp(event as PointerEvent);\n break;\n case 'dblclick':\n this._evtDblClick(event as MouseEvent);\n break;\n case 'keydown':\n event.eventPhase === Event.CAPTURING_PHASE\n ? this._evtKeyDownCapturing(event as KeyboardEvent)\n : this._evtKeyDown(event as KeyboardEvent);\n break;\n case 'contextmenu':\n event.preventDefault();\n event.stopPropagation();\n break;\n }\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n this.node.addEventListener('pointerdown', this);\n this.node.addEventListener('dblclick', this);\n this.node.addEventListener('keydown', this);\n }\n\n /**\n * A message handler invoked on an `'after-detach'` message.\n */\n protected onAfterDetach(msg: Message): void {\n this.node.removeEventListener('pointerdown', this);\n this.node.removeEventListener('dblclick', this);\n this.node.removeEventListener('keydown', this);\n this._releaseMouse();\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n protected onUpdateRequest(msg: Message): void {\n let titles = this._titles;\n let renderer = this.renderer;\n let currentTitle = this.currentTitle;\n let content = new Array(titles.length);\n // Keep the tabindex=\"0\" attribute to the tab which handled it before the update.\n // If the add button handles it, no need to do anything. If no element of the tab\n // bar handles it, set it on the current or the first tab to ensure one element\n // handles it after update.\n const tabHandlingTabindex =\n this._getCurrentTabindex() ??\n (this._currentIndex > -1 ? this._currentIndex : 0);\n\n for (let i = 0, n = titles.length; i < n; ++i) {\n let title = titles[i];\n let current = title === currentTitle;\n let zIndex = current ? n : n - i - 1;\n let tabIndex = tabHandlingTabindex === i ? 0 : -1;\n content[i] = renderer.renderTab({ title, current, zIndex, tabIndex });\n }\n VirtualDOM.render(content, this.contentNode);\n }\n\n /**\n * Get the index of the tab which handles tabindex=\"0\".\n * If the add button handles tabindex=\"0\", -1 is returned.\n * If none of the previous handles tabindex=\"0\", null is returned.\n */\n private _getCurrentTabindex(): number | null {\n let index = null;\n const elemTabindex = this.contentNode.querySelector('li[tabindex=\"0\"]');\n if (elemTabindex) {\n index = [...this.contentNode.children].indexOf(elemTabindex);\n } else if (\n this._addButtonEnabled &&\n this.addButtonNode.getAttribute('tabindex') === '0'\n ) {\n index = -1;\n }\n return index;\n }\n\n /**\n * Handle the `'dblclick'` event for the tab bar.\n */\n private _evtDblClick(event: MouseEvent): void {\n // Do nothing if titles are not editable\n if (!this.titlesEditable) {\n return;\n }\n\n let tabs = this.contentNode.children;\n\n // Find the index of the targeted tab.\n let index = ArrayExt.findFirstIndex(tabs, tab => {\n return ElementExt.hitTest(tab, event.clientX, event.clientY);\n });\n\n // Do nothing if the press is not on a tab.\n if (index === -1) {\n return;\n }\n\n let title = this.titles[index];\n let label = tabs[index].querySelector('.lm-TabBar-tabLabel') as HTMLElement;\n if (label && label.contains(event.target as HTMLElement)) {\n let value = title.label || '';\n\n // Clear the label element\n let oldValue = label.innerHTML;\n label.innerHTML = '';\n\n let input = document.createElement('input');\n input.classList.add('lm-TabBar-tabInput');\n input.value = value;\n label.appendChild(input);\n\n let onblur = () => {\n input.removeEventListener('blur', onblur);\n label.innerHTML = oldValue;\n this.node.addEventListener('keydown', this);\n };\n\n input.addEventListener('dblclick', (event: Event) =>\n event.stopPropagation()\n );\n input.addEventListener('blur', onblur);\n input.addEventListener('keydown', (event: KeyboardEvent) => {\n if (event.key === 'Enter') {\n if (input.value !== '') {\n title.label = title.caption = input.value;\n }\n onblur();\n } else if (event.key === 'Escape') {\n onblur();\n }\n });\n this.node.removeEventListener('keydown', this);\n input.select();\n input.focus();\n\n if (label.children.length > 0) {\n (label.children[0] as HTMLElement).focus();\n }\n }\n }\n\n /**\n * Handle the `'keydown'` event for the tab bar at capturing phase.\n */\n private _evtKeyDownCapturing(event: KeyboardEvent): void {\n if (event.eventPhase !== Event.CAPTURING_PHASE) {\n return;\n }\n\n // Stop all input events during drag.\n event.preventDefault();\n event.stopPropagation();\n\n // Release the mouse if `Escape` is pressed.\n if (event.key === 'Escape') {\n this._releaseMouse();\n }\n }\n\n /**\n * Handle the `'keydown'` event for the tab bar at target phase.\n */\n private _evtKeyDown(event: KeyboardEvent): void {\n // Allow for navigation using tab key\n if (event.key === 'Tab' || event.eventPhase === Event.CAPTURING_PHASE) {\n return;\n }\n\n // Check if Enter or Spacebar key has been pressed and open that tab\n if (\n event.key === 'Enter' ||\n event.key === 'Spacebar' ||\n event.key === ' '\n ) {\n // Get focus element that is in focus by the tab key\n const focusedElement = document.activeElement;\n\n // Test first if the focus is on the add button node\n if (\n this.addButtonEnabled &&\n this.addButtonNode.contains(focusedElement)\n ) {\n event.preventDefault();\n event.stopPropagation();\n this._addRequested.emit();\n } else {\n const index = ArrayExt.findFirstIndex(this.contentNode.children, tab =>\n tab.contains(focusedElement)\n );\n if (index >= 0) {\n event.preventDefault();\n event.stopPropagation();\n this.currentIndex = index;\n }\n }\n // Handle the arrow keys to switch tabs.\n } else if (ARROW_KEYS.includes(event.key)) {\n // Create a list of all focusable elements in the tab bar.\n const focusable: Element[] = [...this.contentNode.children];\n if (this.addButtonEnabled) {\n focusable.push(this.addButtonNode);\n }\n // If the tab bar contains only one element, nothing to do.\n if (focusable.length <= 1) {\n return;\n }\n event.preventDefault();\n event.stopPropagation();\n\n // Get the current focused element.\n let focusedIndex = focusable.indexOf(document.activeElement as Element);\n if (focusedIndex === -1) {\n focusedIndex = this._currentIndex;\n }\n\n // Find the next element to focus on.\n let nextFocused: Element | null | undefined;\n if (\n (event.key === 'ArrowRight' && this._orientation === 'horizontal') ||\n (event.key === 'ArrowDown' && this._orientation === 'vertical')\n ) {\n nextFocused = focusable[focusedIndex + 1] ?? focusable[0];\n } else if (\n (event.key === 'ArrowLeft' && this._orientation === 'horizontal') ||\n (event.key === 'ArrowUp' && this._orientation === 'vertical')\n ) {\n nextFocused =\n focusable[focusedIndex - 1] ?? focusable[focusable.length - 1];\n } else if (event.key === 'Home') {\n nextFocused = focusable[0];\n } else if (event.key === 'End') {\n nextFocused = focusable[focusable.length - 1];\n }\n\n // Change the focused element and the tabindex value.\n if (nextFocused) {\n focusable[focusedIndex]?.setAttribute('tabindex', '-1');\n nextFocused?.setAttribute('tabindex', '0');\n (nextFocused as HTMLElement).focus();\n }\n }\n }\n\n /**\n * Handle the `'pointerdown'` event for the tab bar.\n */\n private _evtPointerDown(event: PointerEvent | MouseEvent): void {\n // Do nothing if it's not a left or middle mouse press.\n if (event.button !== 0 && event.button !== 1) {\n return;\n }\n\n // Do nothing if a drag is in progress.\n if (this._dragData) {\n return;\n }\n\n // Do nothing if a title editable input was clicked.\n if (\n (event.target as HTMLElement).classList.contains('lm-TabBar-tabInput')\n ) {\n return;\n }\n\n // Check if the add button was clicked.\n let addButtonClicked =\n this.addButtonEnabled &&\n this.addButtonNode.contains(event.target as HTMLElement);\n\n // Lookup the tab nodes.\n let tabs = this.contentNode.children;\n\n // Find the index of the pressed tab.\n let index = ArrayExt.findFirstIndex(tabs, tab => {\n return ElementExt.hitTest(tab, event.clientX, event.clientY);\n });\n\n // Do nothing if the press is not on a tab or the add button.\n if (index === -1 && !addButtonClicked) {\n return;\n }\n\n // Pressing on a tab stops the event propagation.\n event.preventDefault();\n event.stopPropagation();\n\n // Initialize the non-measured parts of the drag data.\n this._dragData = {\n tab: tabs[index] as HTMLElement,\n index: index,\n pressX: event.clientX,\n pressY: event.clientY,\n tabPos: -1,\n tabSize: -1,\n tabPressPos: -1,\n targetIndex: -1,\n tabLayout: null,\n contentRect: null,\n override: null,\n dragActive: false,\n dragAborted: false,\n detachRequested: false\n };\n\n // Add the document pointer up listener.\n this.document.addEventListener('pointerup', this, true);\n\n // Do nothing else if the middle button or add button is clicked.\n if (event.button === 1 || addButtonClicked) {\n return;\n }\n\n // Do nothing else if the close icon is clicked.\n let icon = tabs[index].querySelector(this.renderer.closeIconSelector);\n if (icon && icon.contains(event.target as HTMLElement)) {\n return;\n }\n\n // Add the extra listeners if the tabs are movable.\n if (this.tabsMovable) {\n this.document.addEventListener('pointermove', this, true);\n this.document.addEventListener('keydown', this, true);\n this.document.addEventListener('contextmenu', this, true);\n }\n\n // Update the current index as appropriate.\n if (this.allowDeselect && this.currentIndex === index) {\n this.currentIndex = -1;\n } else {\n this.currentIndex = index;\n }\n\n // Do nothing else if there is no current tab.\n if (this.currentIndex === -1) {\n return;\n }\n\n // Emit the tab activate request signal.\n this._tabActivateRequested.emit({\n index: this.currentIndex,\n title: this.currentTitle!\n });\n }\n\n /**\n * Handle the `'pointermove'` event for the tab bar.\n */\n private _evtPointerMove(event: PointerEvent | MouseEvent): void {\n // Do nothing if no drag is in progress.\n let data = this._dragData;\n if (!data) {\n return;\n }\n\n // Suppress the event during a drag.\n event.preventDefault();\n event.stopPropagation();\n\n // Lookup the tab nodes.\n let tabs = this.contentNode.children;\n\n // Bail early if the drag threshold has not been met.\n if (!data.dragActive && !Private.dragExceeded(data, event)) {\n return;\n }\n\n // Activate the drag if necessary.\n if (!data.dragActive) {\n // Fill in the rest of the drag data measurements.\n let tabRect = data.tab.getBoundingClientRect();\n if (this._orientation === 'horizontal') {\n data.tabPos = data.tab.offsetLeft;\n data.tabSize = tabRect.width;\n data.tabPressPos = data.pressX - tabRect.left;\n } else {\n data.tabPos = data.tab.offsetTop;\n data.tabSize = tabRect.height;\n data.tabPressPos = data.pressY - tabRect.top;\n }\n data.tabPressOffset = {\n x: data.pressX - tabRect.left,\n y: data.pressY - tabRect.top\n };\n data.tabLayout = Private.snapTabLayout(tabs, this._orientation);\n data.contentRect = this.contentNode.getBoundingClientRect();\n data.override = Drag.overrideCursor('default');\n\n // Add the dragging style classes.\n data.tab.classList.add('lm-mod-dragging');\n this.addClass('lm-mod-dragging');\n\n // Mark the drag as active.\n data.dragActive = true;\n }\n\n // Emit the detach requested signal if the threshold is exceeded.\n if (!data.detachRequested && Private.detachExceeded(data, event)) {\n // Only emit the signal once per drag cycle.\n data.detachRequested = true;\n\n // Setup the arguments for the signal.\n let index = data.index;\n let clientX = event.clientX;\n let clientY = event.clientY;\n let tab = tabs[index] as HTMLElement;\n let title = this._titles[index];\n\n // Emit the tab detach requested signal.\n this._tabDetachRequested.emit({\n index,\n title,\n tab,\n clientX,\n clientY,\n offset: data.tabPressOffset\n });\n\n // Bail if the signal handler aborted the drag.\n if (data.dragAborted) {\n return;\n }\n }\n\n // Update the positions of the tabs.\n Private.layoutTabs(tabs, data, event, this._orientation);\n }\n\n /**\n * Handle the `'pointerup'` event for the document.\n */\n private _evtPointerUp(event: PointerEvent | MouseEvent): void {\n // Do nothing if it's not a left or middle mouse release.\n if (event.button !== 0 && event.button !== 1) {\n return;\n }\n\n // Do nothing if no drag is in progress.\n const data = this._dragData;\n if (!data) {\n return;\n }\n\n // Stop the event propagation.\n event.preventDefault();\n event.stopPropagation();\n\n // Remove the extra mouse event listeners.\n this.document.removeEventListener('pointermove', this, true);\n this.document.removeEventListener('pointerup', this, true);\n this.document.removeEventListener('keydown', this, true);\n this.document.removeEventListener('contextmenu', this, true);\n\n // Handle a release when the drag is not active.\n if (!data.dragActive) {\n // Clear the drag data.\n this._dragData = null;\n\n // Handle clicking the add button.\n let addButtonClicked =\n this.addButtonEnabled &&\n this.addButtonNode.contains(event.target as HTMLElement);\n if (addButtonClicked) {\n this._addRequested.emit(undefined);\n return;\n }\n\n // Lookup the tab nodes.\n let tabs = this.contentNode.children;\n\n // Find the index of the released tab.\n let index = ArrayExt.findFirstIndex(tabs, tab => {\n return ElementExt.hitTest(tab, event.clientX, event.clientY);\n });\n\n // Do nothing if the release is not on the original pressed tab.\n if (index !== data.index) {\n return;\n }\n\n // Ignore the release if the title is not closable.\n let title = this._titles[index];\n if (!title.closable) {\n return;\n }\n\n // Emit the close requested signal if the middle button is released.\n if (event.button === 1) {\n this._tabCloseRequested.emit({ index, title });\n return;\n }\n\n // Emit the close requested signal if the close icon was released.\n let icon = tabs[index].querySelector(this.renderer.closeIconSelector);\n if (icon && icon.contains(event.target as HTMLElement)) {\n this._tabCloseRequested.emit({ index, title });\n return;\n }\n\n // Otherwise, there is nothing left to do.\n return;\n }\n\n // Do nothing if the left button is not released.\n if (event.button !== 0) {\n return;\n }\n\n // Position the tab at its final resting position.\n Private.finalizeTabPosition(data, this._orientation);\n\n // Remove the dragging class from the tab so it can be transitioned.\n data.tab.classList.remove('lm-mod-dragging');\n\n // Parse the transition duration for releasing the tab.\n let duration = Private.parseTransitionDuration(data.tab);\n\n // Complete the release on a timer to allow the tab to transition.\n setTimeout(() => {\n // Do nothing if the drag has been aborted.\n if (data.dragAborted) {\n return;\n }\n\n // Clear the drag data reference.\n this._dragData = null;\n\n // Reset the positions of the tabs.\n Private.resetTabPositions(this.contentNode.children, this._orientation);\n\n // Clear the cursor grab.\n data.override!.dispose();\n\n // Remove the remaining dragging style.\n this.removeClass('lm-mod-dragging');\n\n // If the tab was not moved, there is nothing else to do.\n let i = data.index;\n let j = data.targetIndex;\n if (j === -1 || i === j) {\n return;\n }\n\n // Move the title to the new locations.\n ArrayExt.move(this._titles, i, j);\n\n // Adjust the current index for the move.\n this._adjustCurrentForMove(i, j);\n\n // Emit the tab moved signal.\n this._tabMoved.emit({\n fromIndex: i,\n toIndex: j,\n title: this._titles[j]\n });\n\n // Update the tabs immediately to prevent flicker.\n MessageLoop.sendMessage(this, Widget.Msg.UpdateRequest);\n }, duration);\n }\n\n /**\n * Release the mouse and restore the non-dragged tab positions.\n */\n private _releaseMouse(): void {\n // Do nothing if no drag is in progress.\n let data = this._dragData;\n if (!data) {\n return;\n }\n\n // Clear the drag data reference.\n this._dragData = null;\n\n // Remove the extra document event listeners.\n this.document.removeEventListener('pointermove', this, true);\n this.document.removeEventListener('pointerup', this, true);\n this.document.removeEventListener('keydown', this, true);\n this.document.removeEventListener('contextmenu', this, true);\n\n // Indicate the drag has been aborted. This allows the mouse\n // event handlers to return early when the drag is canceled.\n data.dragAborted = true;\n\n // If the drag is not active, there's nothing more to do.\n if (!data.dragActive) {\n return;\n }\n\n // Reset the tabs to their non-dragged positions.\n Private.resetTabPositions(this.contentNode.children, this._orientation);\n\n // Clear the cursor override.\n data.override!.dispose();\n\n // Clear the dragging style classes.\n data.tab.classList.remove('lm-mod-dragging');\n this.removeClass('lm-mod-dragging');\n }\n\n /**\n * Adjust the current index for a tab insert operation.\n *\n * This method accounts for the tab bar's insertion behavior when\n * adjusting the current index and emitting the changed signal.\n */\n private _adjustCurrentForInsert(i: number, title: Title): void {\n // Lookup commonly used variables.\n let ct = this.currentTitle;\n let ci = this._currentIndex;\n let bh = this.insertBehavior;\n\n // TODO: do we need to do an update to update the aria-selected attribute?\n\n // Handle the behavior where the new tab is always selected,\n // or the behavior where the new tab is selected if needed.\n if (bh === 'select-tab' || (bh === 'select-tab-if-needed' && ci === -1)) {\n this._currentIndex = i;\n this._previousTitle = ct;\n this._currentChanged.emit({\n previousIndex: ci,\n previousTitle: ct,\n currentIndex: i,\n currentTitle: title\n });\n return;\n }\n\n // Otherwise, silently adjust the current index if needed.\n if (ci >= i) {\n this._currentIndex++;\n }\n }\n\n /**\n * Adjust the current index for a tab move operation.\n *\n * This method will not cause the actual current tab to change.\n * It silently adjusts the index to account for the given move.\n */\n private _adjustCurrentForMove(i: number, j: number): void {\n if (this._currentIndex === i) {\n this._currentIndex = j;\n } else if (this._currentIndex < i && this._currentIndex >= j) {\n this._currentIndex++;\n } else if (this._currentIndex > i && this._currentIndex <= j) {\n this._currentIndex--;\n }\n }\n\n /**\n * Adjust the current index for a tab remove operation.\n *\n * This method accounts for the tab bar's remove behavior when\n * adjusting the current index and emitting the changed signal.\n */\n private _adjustCurrentForRemove(i: number, title: Title): void {\n // Lookup commonly used variables.\n let ci = this._currentIndex;\n let bh = this.removeBehavior;\n\n // Silently adjust the index if the current tab is not removed.\n if (ci !== i) {\n if (ci > i) {\n this._currentIndex--;\n }\n return;\n }\n\n // TODO: do we need to do an update to adjust the aria-selected value?\n\n // No tab gets selected if the tab bar is empty.\n if (this._titles.length === 0) {\n this._currentIndex = -1;\n this._currentChanged.emit({\n previousIndex: i,\n previousTitle: title,\n currentIndex: -1,\n currentTitle: null\n });\n return;\n }\n\n // Handle behavior where the next sibling tab is selected.\n if (bh === 'select-tab-after') {\n this._currentIndex = Math.min(i, this._titles.length - 1);\n this._currentChanged.emit({\n previousIndex: i,\n previousTitle: title,\n currentIndex: this._currentIndex,\n currentTitle: this.currentTitle\n });\n return;\n }\n\n // Handle behavior where the previous sibling tab is selected.\n if (bh === 'select-tab-before') {\n this._currentIndex = Math.max(0, i - 1);\n this._currentChanged.emit({\n previousIndex: i,\n previousTitle: title,\n currentIndex: this._currentIndex,\n currentTitle: this.currentTitle\n });\n return;\n }\n\n // Handle behavior where the previous history tab is selected.\n if (bh === 'select-previous-tab') {\n if (this._previousTitle) {\n this._currentIndex = this._titles.indexOf(this._previousTitle);\n this._previousTitle = null;\n } else {\n this._currentIndex = Math.min(i, this._titles.length - 1);\n }\n this._currentChanged.emit({\n previousIndex: i,\n previousTitle: title,\n currentIndex: this._currentIndex,\n currentTitle: this.currentTitle\n });\n return;\n }\n\n // Otherwise, no tab gets selected.\n this._currentIndex = -1;\n this._currentChanged.emit({\n previousIndex: i,\n previousTitle: title,\n currentIndex: -1,\n currentTitle: null\n });\n }\n\n /**\n * Handle the `changed` signal of a title object.\n */\n private _onTitleChanged(sender: Title): void {\n this.update();\n }\n\n private _name: string;\n private _currentIndex = -1;\n private _titles: Title[] = [];\n private _orientation: TabBar.Orientation;\n private _document: Document | ShadowRoot;\n private _titlesEditable: boolean = false;\n private _previousTitle: Title | null = null;\n private _dragData: Private.IDragData | null = null;\n private _addButtonEnabled: boolean = false;\n private _tabMoved = new Signal>(this);\n private _currentChanged = new Signal>(\n this\n );\n private _addRequested = new Signal(this);\n private _tabCloseRequested = new Signal<\n this,\n TabBar.ITabCloseRequestedArgs\n >(this);\n private _tabDetachRequested = new Signal<\n this,\n TabBar.ITabDetachRequestedArgs\n >(this);\n private _tabActivateRequested = new Signal<\n this,\n TabBar.ITabActivateRequestedArgs\n >(this);\n}\n\n/**\n * The namespace for the `TabBar` class statics.\n */\nexport namespace TabBar {\n /**\n * A type alias for a tab bar orientation.\n */\n export type Orientation =\n | /**\n * The tabs are arranged in a single row, left-to-right.\n *\n * The tab text orientation is horizontal.\n */\n 'horizontal'\n\n /**\n * The tabs are arranged in a single column, top-to-bottom.\n *\n * The tab text orientation is horizontal.\n */\n | 'vertical';\n\n /**\n * A type alias for the selection behavior on tab insert.\n */\n export type InsertBehavior =\n | /**\n * The selected tab will not be changed.\n */\n 'none'\n\n /**\n * The inserted tab will be selected.\n */\n | 'select-tab'\n\n /**\n * The inserted tab will be selected if the current tab is null.\n */\n | 'select-tab-if-needed';\n\n /**\n * A type alias for the selection behavior on tab remove.\n */\n export type RemoveBehavior =\n | /**\n * No tab will be selected.\n */\n 'none'\n\n /**\n * The tab after the removed tab will be selected if possible.\n */\n | 'select-tab-after'\n\n /**\n * The tab before the removed tab will be selected if possible.\n */\n | 'select-tab-before'\n\n /**\n * The previously selected tab will be selected if possible.\n */\n | 'select-previous-tab';\n\n /**\n * An options object for creating a tab bar.\n */\n export interface IOptions {\n /**\n * The document to use with the tab bar.\n *\n * The default is the global `document` instance.\n */\n\n document?: Document | ShadowRoot;\n\n /**\n * Name of the tab bar.\n *\n * This is used for accessibility reasons. The default is the empty string.\n */\n name?: string;\n\n /**\n * The layout orientation of the tab bar.\n *\n * The default is `horizontal`.\n */\n orientation?: TabBar.Orientation;\n\n /**\n * Whether the tabs are movable by the user.\n *\n * The default is `false`.\n */\n tabsMovable?: boolean;\n\n /**\n * Whether a tab can be deselected by the user.\n *\n * The default is `false`.\n */\n allowDeselect?: boolean;\n\n /**\n * Whether the titles can be directly edited by the user.\n *\n * The default is `false`.\n */\n titlesEditable?: boolean;\n\n /**\n * Whether the add button is enabled.\n *\n * The default is `false`.\n */\n addButtonEnabled?: boolean;\n\n /**\n * The selection behavior when inserting a tab.\n *\n * The default is `'select-tab-if-needed'`.\n */\n insertBehavior?: TabBar.InsertBehavior;\n\n /**\n * The selection behavior when removing a tab.\n *\n * The default is `'select-tab-after'`.\n */\n removeBehavior?: TabBar.RemoveBehavior;\n\n /**\n * A renderer to use with the tab bar.\n *\n * The default is a shared renderer instance.\n */\n renderer?: IRenderer;\n }\n\n /**\n * The arguments object for the `currentChanged` signal.\n */\n export interface ICurrentChangedArgs {\n /**\n * The previously selected index.\n */\n readonly previousIndex: number;\n\n /**\n * The previously selected title.\n */\n readonly previousTitle: Title | null;\n\n /**\n * The currently selected index.\n */\n readonly currentIndex: number;\n\n /**\n * The currently selected title.\n */\n readonly currentTitle: Title | null;\n }\n\n /**\n * The arguments object for the `tabMoved` signal.\n */\n export interface ITabMovedArgs {\n /**\n * The previous index of the tab.\n */\n readonly fromIndex: number;\n\n /**\n * The current index of the tab.\n */\n readonly toIndex: number;\n\n /**\n * The title for the tab.\n */\n readonly title: Title;\n }\n\n /**\n * The arguments object for the `tabActivateRequested` signal.\n */\n export interface ITabActivateRequestedArgs {\n /**\n * The index of the tab to activate.\n */\n readonly index: number;\n\n /**\n * The title for the tab.\n */\n readonly title: Title;\n }\n\n /**\n * The arguments object for the `tabCloseRequested` signal.\n */\n export interface ITabCloseRequestedArgs {\n /**\n * The index of the tab to close.\n */\n readonly index: number;\n\n /**\n * The title for the tab.\n */\n readonly title: Title;\n }\n\n /**\n * The arguments object for the `tabDetachRequested` signal.\n */\n export interface ITabDetachRequestedArgs {\n /**\n * The index of the tab to detach.\n */\n readonly index: number;\n\n /**\n * The title for the tab.\n */\n readonly title: Title;\n\n /**\n * The node representing the tab.\n */\n readonly tab: HTMLElement;\n\n /**\n * The current client X position of the mouse.\n */\n readonly clientX: number;\n\n /**\n * The current client Y position of the mouse.\n */\n readonly clientY: number;\n\n /**\n * The mouse position in the tab coordinate.\n */\n readonly offset?: { x: number; y: number };\n }\n\n /**\n * An object which holds the data to render a tab.\n */\n export interface IRenderData {\n /**\n * The title associated with the tab.\n */\n readonly title: Title;\n\n /**\n * Whether the tab is the current tab.\n */\n readonly current: boolean;\n\n /**\n * The z-index for the tab.\n */\n readonly zIndex: number;\n\n /**\n * The tabindex value for the tab.\n */\n readonly tabIndex?: number;\n }\n\n /**\n * A renderer for use with a tab bar.\n */\n export interface IRenderer {\n /**\n * A selector which matches the close icon node in a tab.\n */\n readonly closeIconSelector: string;\n\n /**\n * Render the virtual element for a tab.\n *\n * @param data - The data to use for rendering the tab.\n *\n * @returns A virtual element representing the tab.\n */\n renderTab(data: IRenderData): VirtualElement;\n }\n\n /**\n * The default implementation of `IRenderer`.\n *\n * #### Notes\n * Subclasses are free to reimplement rendering methods as needed.\n */\n export class Renderer implements IRenderer {\n constructor() {\n this._uuid = ++Renderer._nInstance;\n }\n /**\n * A selector which matches the close icon node in a tab.\n */\n readonly closeIconSelector = '.lm-TabBar-tabCloseIcon';\n\n /**\n * Render the virtual element for a tab.\n *\n * @param data - The data to use for rendering the tab.\n *\n * @returns A virtual element representing the tab.\n */\n renderTab(data: IRenderData): VirtualElement {\n let title = data.title.caption;\n let key = this.createTabKey(data);\n let id = key;\n let style = this.createTabStyle(data);\n let className = this.createTabClass(data);\n let dataset = this.createTabDataset(data);\n let aria = this.createTabARIA(data);\n if (data.title.closable) {\n return h.li(\n { id, key, className, title, style, dataset, ...aria },\n this.renderIcon(data),\n this.renderLabel(data),\n this.renderCloseIcon(data)\n );\n } else {\n return h.li(\n { id, key, className, title, style, dataset, ...aria },\n this.renderIcon(data),\n this.renderLabel(data)\n );\n }\n }\n\n /**\n * Render the icon element for a tab.\n *\n * @param data - The data to use for rendering the tab.\n *\n * @returns A virtual element representing the tab icon.\n */\n renderIcon(data: IRenderData): VirtualElement {\n const { title } = data;\n let className = this.createIconClass(data);\n\n // If title.icon is undefined, it will be ignored.\n return h.div({ className }, title.icon!, title.iconLabel);\n }\n\n /**\n * Render the label element for a tab.\n *\n * @param data - The data to use for rendering the tab.\n *\n * @returns A virtual element representing the tab label.\n */\n renderLabel(data: IRenderData): VirtualElement {\n return h.div({ className: 'lm-TabBar-tabLabel' }, data.title.label);\n }\n\n /**\n * Render the close icon element for a tab.\n *\n * @param data - The data to use for rendering the tab.\n *\n * @returns A virtual element representing the tab close icon.\n */\n renderCloseIcon(data: IRenderData): VirtualElement {\n return h.div({ className: 'lm-TabBar-tabCloseIcon' });\n }\n\n /**\n * Create a unique render key for the tab.\n *\n * @param data - The data to use for the tab.\n *\n * @returns The unique render key for the tab.\n *\n * #### Notes\n * This method caches the key against the tab title the first time\n * the key is generated. This enables efficient rendering of moved\n * tabs and avoids subtle hover style artifacts.\n */\n createTabKey(data: IRenderData): string {\n let key = this._tabKeys.get(data.title);\n if (key === undefined) {\n key = `tab-key-${this._uuid}-${this._tabID++}`;\n this._tabKeys.set(data.title, key);\n }\n return key;\n }\n\n /**\n * Create the inline style object for a tab.\n *\n * @param data - The data to use for the tab.\n *\n * @returns The inline style data for the tab.\n */\n createTabStyle(data: IRenderData): ElementInlineStyle {\n return { zIndex: `${data.zIndex}` };\n }\n\n /**\n * Create the class name for the tab.\n *\n * @param data - The data to use for the tab.\n *\n * @returns The full class name for the tab.\n */\n createTabClass(data: IRenderData): string {\n let name = 'lm-TabBar-tab';\n if (data.title.className) {\n name += ` ${data.title.className}`;\n }\n if (data.title.closable) {\n name += ' lm-mod-closable';\n }\n if (data.current) {\n name += ' lm-mod-current';\n }\n return name;\n }\n\n /**\n * Create the dataset for a tab.\n *\n * @param data - The data to use for the tab.\n *\n * @returns The dataset for the tab.\n */\n createTabDataset(data: IRenderData): ElementDataset {\n return data.title.dataset;\n }\n\n /**\n * Create the ARIA attributes for a tab.\n *\n * @param data - The data to use for the tab.\n *\n * @returns The ARIA attributes for the tab.\n */\n createTabARIA(data: IRenderData): ElementARIAAttrs | ElementBaseAttrs {\n return {\n role: 'tab',\n 'aria-selected': data.current.toString(),\n tabindex: `${data.tabIndex ?? '-1'}`\n };\n }\n\n /**\n * Create the class name for the tab icon.\n *\n * @param data - The data to use for the tab.\n *\n * @returns The full class name for the tab icon.\n */\n createIconClass(data: IRenderData): string {\n let name = 'lm-TabBar-tabIcon';\n let extra = data.title.iconClass;\n return extra ? `${name} ${extra}` : name;\n }\n\n private static _nInstance = 0;\n private readonly _uuid: number;\n private _tabID = 0;\n private _tabKeys = new WeakMap, string>();\n }\n\n /**\n * The default `Renderer` instance.\n */\n export const defaultRenderer = new Renderer();\n\n /**\n * A selector which matches the add button node in the tab bar.\n */\n export const addButtonSelector = '.lm-TabBar-addButton';\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * The start drag distance threshold.\n */\n export const DRAG_THRESHOLD = 5;\n\n /**\n * The detach distance threshold.\n */\n export const DETACH_THRESHOLD = 20;\n\n /**\n * A struct which holds the drag data for a tab bar.\n */\n export interface IDragData {\n /**\n * The tab node being dragged.\n */\n tab: HTMLElement;\n\n /**\n * The index of the tab being dragged.\n */\n index: number;\n\n /**\n * The mouse press client X position.\n */\n pressX: number;\n\n /**\n * The mouse press client Y position.\n */\n pressY: number;\n\n /**\n * The offset left/top of the tab being dragged.\n *\n * This will be `-1` if the drag is not active.\n */\n tabPos: number;\n\n /**\n * The offset width/height of the tab being dragged.\n *\n * This will be `-1` if the drag is not active.\n */\n tabSize: number;\n\n /**\n * The original mouse X/Y position in tab coordinates.\n *\n * This will be `-1` if the drag is not active.\n */\n tabPressPos: number;\n\n /**\n * The original mouse position in tab coordinates.\n *\n * This is undefined if the drag is not active.\n */\n tabPressOffset?: { x: number; y: number };\n\n /**\n * The tab target index upon mouse release.\n *\n * This will be `-1` if the drag is not active.\n */\n targetIndex: number;\n\n /**\n * The array of tab layout objects snapped at drag start.\n *\n * This will be `null` if the drag is not active.\n */\n tabLayout: ITabLayout[] | null;\n\n /**\n * The bounding client rect of the tab bar content node.\n *\n * This will be `null` if the drag is not active.\n */\n contentRect: DOMRect | null;\n\n /**\n * The disposable to clean up the cursor override.\n *\n * This will be `null` if the drag is not active.\n */\n override: IDisposable | null;\n\n /**\n * Whether the drag is currently active.\n */\n dragActive: boolean;\n\n /**\n * Whether the drag has been aborted.\n */\n dragAborted: boolean;\n\n /**\n * Whether a detach request as been made.\n */\n detachRequested: boolean;\n }\n\n /**\n * An object which holds layout data for a tab.\n */\n export interface ITabLayout {\n /**\n * The left/top margin value for the tab.\n */\n margin: number;\n\n /**\n * The offset left/top position of the tab.\n */\n pos: number;\n\n /**\n * The offset width/height of the tab.\n */\n size: number;\n }\n\n /**\n * Create the DOM node for a tab bar.\n */\n export function createNode(): HTMLDivElement {\n let node = document.createElement('div');\n let content = document.createElement('ul');\n content.setAttribute('role', 'tablist');\n content.className = 'lm-TabBar-content';\n node.appendChild(content);\n\n let add = document.createElement('div');\n add.className = 'lm-TabBar-addButton lm-mod-hidden';\n add.setAttribute('tabindex', '-1');\n add.setAttribute('role', 'button');\n node.appendChild(add);\n return node;\n }\n\n /**\n * Coerce a title or options into a real title.\n */\n export function asTitle(value: Title | Title.IOptions): Title {\n return value instanceof Title ? value : new Title(value);\n }\n\n /**\n * Parse the transition duration for a tab node.\n */\n export function parseTransitionDuration(tab: HTMLElement): number {\n let style = window.getComputedStyle(tab);\n return 1000 * (parseFloat(style.transitionDuration!) || 0);\n }\n\n /**\n * Get a snapshot of the current tab layout values.\n */\n export function snapTabLayout(\n tabs: HTMLCollection,\n orientation: TabBar.Orientation\n ): ITabLayout[] {\n let layout = new Array(tabs.length);\n for (let i = 0, n = tabs.length; i < n; ++i) {\n let node = tabs[i] as HTMLElement;\n let style = window.getComputedStyle(node);\n if (orientation === 'horizontal') {\n layout[i] = {\n pos: node.offsetLeft,\n size: node.offsetWidth,\n margin: parseFloat(style.marginLeft!) || 0\n };\n } else {\n layout[i] = {\n pos: node.offsetTop,\n size: node.offsetHeight,\n margin: parseFloat(style.marginTop!) || 0\n };\n }\n }\n return layout;\n }\n\n /**\n * Test if the event exceeds the drag threshold.\n */\n export function dragExceeded(data: IDragData, event: MouseEvent): boolean {\n let dx = Math.abs(event.clientX - data.pressX);\n let dy = Math.abs(event.clientY - data.pressY);\n return dx >= DRAG_THRESHOLD || dy >= DRAG_THRESHOLD;\n }\n\n /**\n * Test if the event exceeds the drag detach threshold.\n */\n export function detachExceeded(data: IDragData, event: MouseEvent): boolean {\n let rect = data.contentRect!;\n return (\n event.clientX < rect.left - DETACH_THRESHOLD ||\n event.clientX >= rect.right + DETACH_THRESHOLD ||\n event.clientY < rect.top - DETACH_THRESHOLD ||\n event.clientY >= rect.bottom + DETACH_THRESHOLD\n );\n }\n\n /**\n * Update the relative tab positions and computed target index.\n */\n export function layoutTabs(\n tabs: HTMLCollection,\n data: IDragData,\n event: MouseEvent,\n orientation: TabBar.Orientation\n ): void {\n // Compute the orientation-sensitive values.\n let pressPos: number;\n let localPos: number;\n let clientPos: number;\n let clientSize: number;\n if (orientation === 'horizontal') {\n pressPos = data.pressX;\n localPos = event.clientX - data.contentRect!.left;\n clientPos = event.clientX;\n clientSize = data.contentRect!.width;\n } else {\n pressPos = data.pressY;\n localPos = event.clientY - data.contentRect!.top;\n clientPos = event.clientY;\n clientSize = data.contentRect!.height;\n }\n\n // Compute the target data.\n let targetIndex = data.index;\n let targetPos = localPos - data.tabPressPos;\n let targetEnd = targetPos + data.tabSize;\n\n // Update the relative tab positions.\n for (let i = 0, n = tabs.length; i < n; ++i) {\n let pxPos: string;\n let layout = data.tabLayout![i];\n let threshold = layout.pos + (layout.size >> 1);\n if (i < data.index && targetPos < threshold) {\n pxPos = `${data.tabSize + data.tabLayout![i + 1].margin}px`;\n targetIndex = Math.min(targetIndex, i);\n } else if (i > data.index && targetEnd > threshold) {\n pxPos = `${-data.tabSize - layout.margin}px`;\n targetIndex = Math.max(targetIndex, i);\n } else if (i === data.index) {\n let ideal = clientPos - pressPos;\n let limit = clientSize - (data.tabPos + data.tabSize);\n pxPos = `${Math.max(-data.tabPos, Math.min(ideal, limit))}px`;\n } else {\n pxPos = '';\n }\n if (orientation === 'horizontal') {\n (tabs[i] as HTMLElement).style.left = pxPos;\n } else {\n (tabs[i] as HTMLElement).style.top = pxPos;\n }\n }\n\n // Update the computed target index.\n data.targetIndex = targetIndex;\n }\n\n /**\n * Position the drag tab at its final resting relative position.\n */\n export function finalizeTabPosition(\n data: IDragData,\n orientation: TabBar.Orientation\n ): void {\n // Compute the orientation-sensitive client size.\n let clientSize: number;\n if (orientation === 'horizontal') {\n clientSize = data.contentRect!.width;\n } else {\n clientSize = data.contentRect!.height;\n }\n\n // Compute the ideal final tab position.\n let ideal: number;\n if (data.targetIndex === data.index) {\n ideal = 0;\n } else if (data.targetIndex > data.index) {\n let tgt = data.tabLayout![data.targetIndex];\n ideal = tgt.pos + tgt.size - data.tabSize - data.tabPos;\n } else {\n let tgt = data.tabLayout![data.targetIndex];\n ideal = tgt.pos - data.tabPos;\n }\n\n // Compute the tab position limit.\n let limit = clientSize - (data.tabPos + data.tabSize);\n let final = Math.max(-data.tabPos, Math.min(ideal, limit));\n\n // Set the final orientation-sensitive position.\n if (orientation === 'horizontal') {\n data.tab.style.left = `${final}px`;\n } else {\n data.tab.style.top = `${final}px`;\n }\n }\n\n /**\n * Reset the relative positions of the given tabs.\n */\n export function resetTabPositions(\n tabs: HTMLCollection,\n orientation: TabBar.Orientation\n ): void {\n for (const tab of tabs) {\n if (orientation === 'horizontal') {\n (tab as HTMLElement).style.left = '';\n } else {\n (tab as HTMLElement).style.top = '';\n }\n }\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt, empty } from '@lumino/algorithm';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { BoxEngine, BoxSizer } from './boxengine';\n\nimport { Layout, LayoutItem } from './layout';\n\nimport { TabBar } from './tabbar';\n\nimport Utils from './utils';\n\nimport { Widget } from './widget';\n\n/**\n * A layout which provides a flexible docking arrangement.\n *\n * #### Notes\n * The consumer of this layout is responsible for handling all signals\n * from the generated tab bars and managing the visibility of widgets\n * and tab bars as needed.\n */\nexport class DockLayout extends Layout {\n /**\n * Construct a new dock layout.\n *\n * @param options - The options for initializing the layout.\n */\n constructor(options: DockLayout.IOptions) {\n super();\n this.renderer = options.renderer;\n if (options.spacing !== undefined) {\n this._spacing = Utils.clampDimension(options.spacing);\n }\n this._document = options.document || document;\n this._hiddenMode =\n options.hiddenMode !== undefined\n ? options.hiddenMode\n : Widget.HiddenMode.Display;\n }\n\n /**\n * Dispose of the resources held by the layout.\n *\n * #### Notes\n * This will clear and dispose all widgets in the layout.\n */\n dispose(): void {\n // Get an iterator over the widgets in the layout.\n let widgets = this[Symbol.iterator]();\n\n // Dispose of the layout items.\n this._items.forEach(item => {\n item.dispose();\n });\n\n // Clear the layout state before disposing the widgets.\n this._box = null;\n this._root = null;\n this._items.clear();\n\n // Dispose of the widgets contained in the old layout root.\n for (const widget of widgets) {\n widget.dispose();\n }\n\n // Dispose of the base class.\n super.dispose();\n }\n\n /**\n * The renderer used by the dock layout.\n */\n readonly renderer: DockLayout.IRenderer;\n\n /**\n * The method for hiding child widgets.\n *\n * #### Notes\n * If there is only one child widget, `Display` hiding mode will be used\n * regardless of this setting.\n */\n get hiddenMode(): Widget.HiddenMode {\n return this._hiddenMode;\n }\n set hiddenMode(v: Widget.HiddenMode) {\n if (this._hiddenMode === v) {\n return;\n }\n this._hiddenMode = v;\n for (const bar of this.tabBars()) {\n if (bar.titles.length > 1) {\n for (const title of bar.titles) {\n title.owner.hiddenMode = this._hiddenMode;\n }\n }\n }\n }\n\n /**\n * Get the inter-element spacing for the dock layout.\n */\n get spacing(): number {\n return this._spacing;\n }\n\n /**\n * Set the inter-element spacing for the dock layout.\n */\n set spacing(value: number) {\n value = Utils.clampDimension(value);\n if (this._spacing === value) {\n return;\n }\n this._spacing = value;\n if (!this.parent) {\n return;\n }\n this.parent.fit();\n }\n\n /**\n * Whether the dock layout is empty.\n */\n get isEmpty(): boolean {\n return this._root === null;\n }\n\n /**\n * Create an iterator over all widgets in the layout.\n *\n * @returns A new iterator over the widgets in the layout.\n *\n * #### Notes\n * This iterator includes the generated tab bars.\n */\n [Symbol.iterator](): IterableIterator {\n return this._root ? this._root.iterAllWidgets() : empty();\n }\n\n /**\n * Create an iterator over the user widgets in the layout.\n *\n * @returns A new iterator over the user widgets in the layout.\n *\n * #### Notes\n * This iterator does not include the generated tab bars.\n */\n widgets(): IterableIterator {\n return this._root ? this._root.iterUserWidgets() : empty();\n }\n\n /**\n * Create an iterator over the selected widgets in the layout.\n *\n * @returns A new iterator over the selected user widgets.\n *\n * #### Notes\n * This iterator yields the widgets corresponding to the current tab\n * of each tab bar in the layout.\n */\n selectedWidgets(): IterableIterator {\n return this._root ? this._root.iterSelectedWidgets() : empty();\n }\n\n /**\n * Create an iterator over the tab bars in the layout.\n *\n * @returns A new iterator over the tab bars in the layout.\n *\n * #### Notes\n * This iterator does not include the user widgets.\n */\n tabBars(): IterableIterator> {\n return this._root ? this._root.iterTabBars() : empty();\n }\n\n /**\n * Create an iterator over the handles in the layout.\n *\n * @returns A new iterator over the handles in the layout.\n */\n handles(): IterableIterator {\n return this._root ? this._root.iterHandles() : empty();\n }\n\n /**\n * Move a handle to the given offset position.\n *\n * @param handle - The handle to move.\n *\n * @param offsetX - The desired offset X position of the handle.\n *\n * @param offsetY - The desired offset Y position of the handle.\n *\n * #### Notes\n * If the given handle is not contained in the layout, this is no-op.\n *\n * The handle will be moved as close as possible to the desired\n * position without violating any of the layout constraints.\n *\n * Only one of the coordinates is used depending on the orientation\n * of the handle. This method accepts both coordinates to make it\n * easy to invoke from a mouse move event without needing to know\n * the handle orientation.\n */\n moveHandle(handle: HTMLDivElement, offsetX: number, offsetY: number): void {\n // Bail early if there is no root or if the handle is hidden.\n let hidden = handle.classList.contains('lm-mod-hidden');\n if (!this._root || hidden) {\n return;\n }\n\n // Lookup the split node for the handle.\n let data = this._root.findSplitNode(handle);\n if (!data) {\n return;\n }\n\n // Compute the desired delta movement for the handle.\n let delta: number;\n if (data.node.orientation === 'horizontal') {\n delta = offsetX - handle.offsetLeft;\n } else {\n delta = offsetY - handle.offsetTop;\n }\n\n // Bail if there is no handle movement.\n if (delta === 0) {\n return;\n }\n\n // Prevent sibling resizing unless needed.\n data.node.holdSizes();\n\n // Adjust the sizers to reflect the handle movement.\n BoxEngine.adjust(data.node.sizers, data.index, delta);\n\n // Update the layout of the widgets.\n if (this.parent) {\n this.parent.update();\n }\n }\n\n /**\n * Save the current configuration of the dock layout.\n *\n * @returns A new config object for the current layout state.\n *\n * #### Notes\n * The return value can be provided to the `restoreLayout` method\n * in order to restore the layout to its current configuration.\n */\n saveLayout(): DockLayout.ILayoutConfig {\n // Bail early if there is no root.\n if (!this._root) {\n return { main: null };\n }\n\n // Hold the current sizes in the layout tree.\n this._root.holdAllSizes();\n\n // Return the layout config.\n return { main: this._root.createConfig() };\n }\n\n /**\n * Restore the layout to a previously saved configuration.\n *\n * @param config - The layout configuration to restore.\n *\n * #### Notes\n * Widgets which currently belong to the layout but which are not\n * contained in the config will be unparented.\n */\n restoreLayout(config: DockLayout.ILayoutConfig): void {\n // Create the widget set for validating the config.\n let widgetSet = new Set();\n\n // Normalize the main area config and collect the widgets.\n let mainConfig: DockLayout.AreaConfig | null;\n if (config.main) {\n mainConfig = Private.normalizeAreaConfig(config.main, widgetSet);\n } else {\n mainConfig = null;\n }\n\n // Create iterators over the old content.\n let oldWidgets = this.widgets();\n let oldTabBars = this.tabBars();\n let oldHandles = this.handles();\n\n // Clear the root before removing the old content.\n this._root = null;\n\n // Unparent the old widgets which are not in the new config.\n for (const widget of oldWidgets) {\n if (!widgetSet.has(widget)) {\n widget.parent = null;\n }\n }\n\n // Dispose of the old tab bars.\n for (const tabBar of oldTabBars) {\n tabBar.dispose();\n }\n\n // Remove the old handles.\n for (const handle of oldHandles) {\n if (handle.parentNode) {\n handle.parentNode.removeChild(handle);\n }\n }\n\n // Reparent the new widgets to the current parent.\n for (const widget of widgetSet) {\n widget.parent = this.parent;\n }\n\n // Create the root node for the new config.\n if (mainConfig) {\n this._root = Private.realizeAreaConfig(\n mainConfig,\n {\n // Ignoring optional `document` argument as we must reuse `this._document`\n createTabBar: (document?: Document | ShadowRoot) =>\n this._createTabBar(),\n createHandle: () => this._createHandle()\n },\n this._document\n );\n } else {\n this._root = null;\n }\n\n // If there is no parent, there is nothing more to do.\n if (!this.parent) {\n return;\n }\n\n // Attach the new widgets to the parent.\n widgetSet.forEach(widget => {\n this.attachWidget(widget);\n });\n\n // Post a fit request to the parent.\n this.parent.fit();\n }\n\n /**\n * Add a widget to the dock layout.\n *\n * @param widget - The widget to add to the dock layout.\n *\n * @param options - The additional options for adding the widget.\n *\n * #### Notes\n * The widget will be moved if it is already contained in the layout.\n *\n * An error will be thrown if the reference widget is invalid.\n */\n addWidget(widget: Widget, options: DockLayout.IAddOptions = {}): void {\n // Parse the options.\n let ref = options.ref || null;\n let mode = options.mode || 'tab-after';\n\n // Find the tab node which holds the reference widget.\n let refNode: Private.TabLayoutNode | null = null;\n if (this._root && ref) {\n refNode = this._root.findTabNode(ref);\n }\n\n // Throw an error if the reference widget is invalid.\n if (ref && !refNode) {\n throw new Error('Reference widget is not in the layout.');\n }\n\n // Reparent the widget to the current layout parent.\n widget.parent = this.parent;\n\n // Insert the widget according to the insert mode.\n switch (mode) {\n case 'tab-after':\n this._insertTab(widget, ref, refNode, true);\n break;\n case 'tab-before':\n this._insertTab(widget, ref, refNode, false);\n break;\n case 'split-top':\n this._insertSplit(widget, ref, refNode, 'vertical', false);\n break;\n case 'split-left':\n this._insertSplit(widget, ref, refNode, 'horizontal', false);\n break;\n case 'split-right':\n this._insertSplit(widget, ref, refNode, 'horizontal', true);\n break;\n case 'split-bottom':\n this._insertSplit(widget, ref, refNode, 'vertical', true);\n break;\n case 'merge-top':\n this._insertSplit(widget, ref, refNode, 'vertical', false, true);\n break;\n case 'merge-left':\n this._insertSplit(widget, ref, refNode, 'horizontal', false, true);\n break;\n case 'merge-right':\n this._insertSplit(widget, ref, refNode, 'horizontal', true, true);\n break;\n case 'merge-bottom':\n this._insertSplit(widget, ref, refNode, 'vertical', true, true);\n break;\n }\n\n // Do nothing else if there is no parent widget.\n if (!this.parent) {\n return;\n }\n\n // Ensure the widget is attached to the parent widget.\n this.attachWidget(widget);\n\n // Post a fit request for the parent widget.\n this.parent.fit();\n }\n\n /**\n * Remove a widget from the layout.\n *\n * @param widget - The widget to remove from the layout.\n *\n * #### Notes\n * A widget is automatically removed from the layout when its `parent`\n * is set to `null`. This method should only be invoked directly when\n * removing a widget from a layout which has yet to be installed on a\n * parent widget.\n *\n * This method does *not* modify the widget's `parent`.\n */\n removeWidget(widget: Widget): void {\n // Remove the widget from its current layout location.\n this._removeWidget(widget);\n\n // Do nothing else if there is no parent widget.\n if (!this.parent) {\n return;\n }\n\n // Detach the widget from the parent widget.\n this.detachWidget(widget);\n\n // Post a fit request for the parent widget.\n this.parent.fit();\n }\n\n /**\n * Find the tab area which contains the given client position.\n *\n * @param clientX - The client X position of interest.\n *\n * @param clientY - The client Y position of interest.\n *\n * @returns The geometry of the tab area at the given position, or\n * `null` if there is no tab area at the given position.\n */\n hitTestTabAreas(\n clientX: number,\n clientY: number\n ): DockLayout.ITabAreaGeometry | null {\n // Bail early if hit testing cannot produce valid results.\n if (!this._root || !this.parent || !this.parent.isVisible) {\n return null;\n }\n\n // Ensure the parent box sizing data is computed.\n if (!this._box) {\n this._box = ElementExt.boxSizing(this.parent.node);\n }\n\n // Convert from client to local coordinates.\n let rect = this.parent.node.getBoundingClientRect();\n let x = clientX - rect.left - this._box.borderLeft;\n let y = clientY - rect.top - this._box.borderTop;\n\n // Find the tab layout node at the local position.\n let tabNode = this._root.hitTestTabNodes(x, y);\n\n // Bail if a tab layout node was not found.\n if (!tabNode) {\n return null;\n }\n\n // Extract the data from the tab node.\n let { tabBar, top, left, width, height } = tabNode;\n\n // Compute the right and bottom edges of the tab area.\n let borderWidth = this._box.borderLeft + this._box.borderRight;\n let borderHeight = this._box.borderTop + this._box.borderBottom;\n let right = rect.width - borderWidth - (left + width);\n let bottom = rect.height - borderHeight - (top + height);\n\n // Return the hit test results.\n return { tabBar, x, y, top, left, right, bottom, width, height };\n }\n\n /**\n * Perform layout initialization which requires the parent widget.\n */\n protected init(): void {\n // Perform superclass initialization.\n super.init();\n\n // Attach each widget to the parent.\n for (const widget of this) {\n this.attachWidget(widget);\n }\n\n // Attach each handle to the parent.\n for (const handle of this.handles()) {\n this.parent!.node.appendChild(handle);\n }\n\n // Post a fit request for the parent widget.\n this.parent!.fit();\n }\n\n /**\n * Attach the widget to the layout parent widget.\n *\n * @param widget - The widget to attach to the parent.\n *\n * #### Notes\n * This is a no-op if the widget is already attached.\n */\n protected attachWidget(widget: Widget): void {\n // Do nothing if the widget is already attached.\n if (this.parent!.node === widget.node.parentNode) {\n return;\n }\n\n // Create the layout item for the widget.\n this._items.set(widget, new LayoutItem(widget));\n\n // Send a `'before-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n }\n\n // Add the widget's node to the parent.\n this.parent!.node.appendChild(widget.node);\n\n // Send an `'after-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n }\n\n /**\n * Detach the widget from the layout parent widget.\n *\n * @param widget - The widget to detach from the parent.\n *\n * #### Notes\n * This is a no-op if the widget is not attached.\n */\n protected detachWidget(widget: Widget): void {\n // Do nothing if the widget is not attached.\n if (this.parent!.node !== widget.node.parentNode) {\n return;\n }\n\n // Send a `'before-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n }\n\n // Remove the widget's node from the parent.\n this.parent!.node.removeChild(widget.node);\n\n // Send an `'after-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n\n // Delete the layout item for the widget.\n let item = this._items.get(widget);\n if (item) {\n this._items.delete(widget);\n item.dispose();\n }\n }\n\n /**\n * A message handler invoked on a `'before-show'` message.\n */\n protected onBeforeShow(msg: Message): void {\n super.onBeforeShow(msg);\n this.parent!.update();\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n super.onBeforeAttach(msg);\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-shown'` message.\n */\n protected onChildShown(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-hidden'` message.\n */\n protected onChildHidden(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'resize'` message.\n */\n protected onResize(msg: Widget.ResizeMessage): void {\n if (this.parent!.isVisible) {\n this._update(msg.width, msg.height);\n }\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n protected onUpdateRequest(msg: Message): void {\n if (this.parent!.isVisible) {\n this._update(-1, -1);\n }\n }\n\n /**\n * A message handler invoked on a `'fit-request'` message.\n */\n protected onFitRequest(msg: Message): void {\n if (this.parent!.isAttached) {\n this._fit();\n }\n }\n\n /**\n * Remove the specified widget from the layout structure.\n *\n * #### Notes\n * This is a no-op if the widget is not in the layout tree.\n *\n * This does not detach the widget from the parent node.\n */\n private _removeWidget(widget: Widget): void {\n // Bail early if there is no layout root.\n if (!this._root) {\n return;\n }\n\n // Find the tab node which contains the given widget.\n let tabNode = this._root.findTabNode(widget);\n\n // Bail early if the tab node is not found.\n if (!tabNode) {\n return;\n }\n\n Private.removeAria(widget);\n\n // If there are multiple tabs, just remove the widget's tab.\n if (tabNode.tabBar.titles.length > 1) {\n tabNode.tabBar.removeTab(widget.title);\n if (\n this._hiddenMode === Widget.HiddenMode.Scale &&\n tabNode.tabBar.titles.length == 1\n ) {\n const existingWidget = tabNode.tabBar.titles[0].owner;\n existingWidget.hiddenMode = Widget.HiddenMode.Display;\n }\n return;\n }\n\n // Otherwise, the tab node needs to be removed...\n\n // Dispose the tab bar.\n tabNode.tabBar.dispose();\n\n // Handle the case where the tab node is the root.\n if (this._root === tabNode) {\n this._root = null;\n return;\n }\n\n // Otherwise, remove the tab node from its parent...\n\n // Prevent widget resizing unless needed.\n this._root.holdAllSizes();\n\n // Clear the parent reference on the tab node.\n let splitNode = tabNode.parent!;\n tabNode.parent = null;\n\n // Remove the tab node from its parent split node.\n let i = ArrayExt.removeFirstOf(splitNode.children, tabNode);\n let handle = ArrayExt.removeAt(splitNode.handles, i)!;\n ArrayExt.removeAt(splitNode.sizers, i);\n\n // Remove the handle from its parent DOM node.\n if (handle.parentNode) {\n handle.parentNode.removeChild(handle);\n }\n\n // If there are multiple children, just update the handles.\n if (splitNode.children.length > 1) {\n splitNode.syncHandles();\n return;\n }\n\n // Otherwise, the split node also needs to be removed...\n\n // Clear the parent reference on the split node.\n let maybeParent = splitNode.parent;\n splitNode.parent = null;\n\n // Lookup the remaining child node and handle.\n let childNode = splitNode.children[0];\n let childHandle = splitNode.handles[0];\n\n // Clear the split node data.\n splitNode.children.length = 0;\n splitNode.handles.length = 0;\n splitNode.sizers.length = 0;\n\n // Remove the child handle from its parent node.\n if (childHandle.parentNode) {\n childHandle.parentNode.removeChild(childHandle);\n }\n\n // Handle the case where the split node is the root.\n if (this._root === splitNode) {\n childNode.parent = null;\n this._root = childNode;\n return;\n }\n\n // Otherwise, move the child node to the parent node...\n let parentNode = maybeParent!;\n\n // Lookup the index of the split node.\n let j = parentNode.children.indexOf(splitNode);\n\n // Handle the case where the child node is a tab node.\n if (childNode instanceof Private.TabLayoutNode) {\n childNode.parent = parentNode;\n parentNode.children[j] = childNode;\n return;\n }\n\n // Remove the split data from the parent.\n let splitHandle = ArrayExt.removeAt(parentNode.handles, j)!;\n ArrayExt.removeAt(parentNode.children, j);\n ArrayExt.removeAt(parentNode.sizers, j);\n\n // Remove the handle from its parent node.\n if (splitHandle.parentNode) {\n splitHandle.parentNode.removeChild(splitHandle);\n }\n\n // The child node and the split parent node will have the same\n // orientation. Merge the grand-children with the parent node.\n for (let i = 0, n = childNode.children.length; i < n; ++i) {\n let gChild = childNode.children[i];\n let gHandle = childNode.handles[i];\n let gSizer = childNode.sizers[i];\n ArrayExt.insert(parentNode.children, j + i, gChild);\n ArrayExt.insert(parentNode.handles, j + i, gHandle);\n ArrayExt.insert(parentNode.sizers, j + i, gSizer);\n gChild.parent = parentNode;\n }\n\n // Clear the child node.\n childNode.children.length = 0;\n childNode.handles.length = 0;\n childNode.sizers.length = 0;\n childNode.parent = null;\n\n // Sync the handles on the parent node.\n parentNode.syncHandles();\n }\n\n /**\n * Create the tab layout node to hold the widget.\n */\n private _createTabNode(widget: Widget): Private.TabLayoutNode {\n let tabNode = new Private.TabLayoutNode(this._createTabBar());\n tabNode.tabBar.addTab(widget.title);\n Private.addAria(widget, tabNode.tabBar);\n return tabNode;\n }\n\n /**\n * Insert a widget next to an existing tab.\n *\n * #### Notes\n * This does not attach the widget to the parent widget.\n */\n private _insertTab(\n widget: Widget,\n ref: Widget | null,\n refNode: Private.TabLayoutNode | null,\n after: boolean\n ): void {\n // Do nothing if the tab is inserted next to itself.\n if (widget === ref) {\n return;\n }\n\n // Create the root if it does not exist.\n if (!this._root) {\n let tabNode = new Private.TabLayoutNode(this._createTabBar());\n tabNode.tabBar.addTab(widget.title);\n this._root = tabNode;\n Private.addAria(widget, tabNode.tabBar);\n return;\n }\n\n // Use the first tab node as the ref node if needed.\n if (!refNode) {\n refNode = this._root.findFirstTabNode()!;\n }\n\n // If the widget is not contained in the ref node, ensure it is\n // removed from the layout and hidden before being added again.\n if (refNode.tabBar.titles.indexOf(widget.title) === -1) {\n this._removeWidget(widget);\n widget.hide();\n }\n\n // Lookup the target index for inserting the tab.\n let index: number;\n if (ref) {\n index = refNode.tabBar.titles.indexOf(ref.title);\n } else {\n index = refNode.tabBar.currentIndex;\n }\n\n // Using transform create an additional layer in the pixel pipeline\n // to limit the number of layer, it is set only if there is more than one widget.\n if (this._hiddenMode === Widget.HiddenMode.Scale) {\n if (refNode.tabBar.titles.length === 0) {\n // Singular tab should use display mode to limit number of layers.\n widget.hiddenMode = Widget.HiddenMode.Display;\n } else if (refNode.tabBar.titles.length == 1) {\n // If we are adding a second tab, switch the existing tab back to scale.\n const existingWidget = refNode.tabBar.titles[0].owner;\n existingWidget.hiddenMode = Widget.HiddenMode.Scale;\n } else {\n // For the third and subsequent tabs no special action is needed.\n widget.hiddenMode = Widget.HiddenMode.Scale;\n }\n } else {\n // For all other modes just propagate the current mode.\n widget.hiddenMode = this._hiddenMode;\n }\n\n // Insert the widget's tab relative to the target index.\n refNode.tabBar.insertTab(index + (after ? 1 : 0), widget.title);\n Private.addAria(widget, refNode.tabBar);\n }\n\n /**\n * Insert a widget as a new split area.\n *\n * #### Notes\n * This does not attach the widget to the parent widget.\n */\n private _insertSplit(\n widget: Widget,\n ref: Widget | null,\n refNode: Private.TabLayoutNode | null,\n orientation: Private.Orientation,\n after: boolean,\n merge: boolean = false\n ): void {\n // Do nothing if there is no effective split.\n if (widget === ref && refNode && refNode.tabBar.titles.length === 1) {\n return;\n }\n\n // Ensure the widget is removed from the current layout.\n this._removeWidget(widget);\n\n // Set the root if it does not exist.\n if (!this._root) {\n this._root = this._createTabNode(widget);\n return;\n }\n\n // If the ref node parent is null, split the root.\n if (!refNode || !refNode.parent) {\n // Ensure the root is split with the correct orientation.\n let root = this._splitRoot(orientation);\n\n // Determine the insert index for the new tab node.\n let i = after ? root.children.length : 0;\n\n // Normalize the split node.\n root.normalizeSizes();\n\n // Create the sizer for new tab node.\n let sizer = Private.createSizer(refNode ? 1 : Private.GOLDEN_RATIO);\n\n // Insert the tab node sized to the golden ratio.\n let tabNode = this._createTabNode(widget);\n ArrayExt.insert(root.children, i, tabNode);\n ArrayExt.insert(root.sizers, i, sizer);\n ArrayExt.insert(root.handles, i, this._createHandle());\n tabNode.parent = root;\n\n // Re-normalize the split node to maintain the ratios.\n root.normalizeSizes();\n\n // Finally, synchronize the visibility of the handles.\n root.syncHandles();\n return;\n }\n\n // Lookup the split node for the ref widget.\n let splitNode = refNode.parent;\n\n // If the split node already had the correct orientation,\n // the widget can be inserted into the split node directly.\n if (splitNode.orientation === orientation) {\n // Find the index of the ref node.\n let i = splitNode.children.indexOf(refNode);\n\n // Conditionally reuse a tab layout found in the wanted position.\n if (merge) {\n let j = i + (after ? 1 : -1);\n let sibling = splitNode.children[j];\n if (sibling instanceof Private.TabLayoutNode) {\n this._insertTab(widget, null, sibling, true);\n ++sibling.tabBar.currentIndex;\n return;\n }\n }\n\n // Normalize the split node.\n splitNode.normalizeSizes();\n\n // Consume half the space for the insert location.\n let s = (splitNode.sizers[i].sizeHint /= 2);\n\n // Insert the tab node sized to the other half.\n let j = i + (after ? 1 : 0);\n let tabNode = this._createTabNode(widget);\n ArrayExt.insert(splitNode.children, j, tabNode);\n ArrayExt.insert(splitNode.sizers, j, Private.createSizer(s));\n ArrayExt.insert(splitNode.handles, j, this._createHandle());\n tabNode.parent = splitNode;\n\n // Finally, synchronize the visibility of the handles.\n splitNode.syncHandles();\n return;\n }\n\n // Remove the ref node from the split node.\n let i = ArrayExt.removeFirstOf(splitNode.children, refNode);\n\n // Create a new normalized split node for the children.\n let childNode = new Private.SplitLayoutNode(orientation);\n childNode.normalized = true;\n\n // Add the ref node sized to half the space.\n childNode.children.push(refNode);\n childNode.sizers.push(Private.createSizer(0.5));\n childNode.handles.push(this._createHandle());\n refNode.parent = childNode;\n\n // Add the tab node sized to the other half.\n let j = after ? 1 : 0;\n let tabNode = this._createTabNode(widget);\n ArrayExt.insert(childNode.children, j, tabNode);\n ArrayExt.insert(childNode.sizers, j, Private.createSizer(0.5));\n ArrayExt.insert(childNode.handles, j, this._createHandle());\n tabNode.parent = childNode;\n\n // Synchronize the visibility of the handles.\n childNode.syncHandles();\n\n // Finally, add the new child node to the original split node.\n ArrayExt.insert(splitNode.children, i, childNode);\n childNode.parent = splitNode;\n }\n\n /**\n * Ensure the root is a split node with the given orientation.\n */\n private _splitRoot(\n orientation: Private.Orientation\n ): Private.SplitLayoutNode {\n // Bail early if the root already meets the requirements.\n let oldRoot = this._root;\n if (oldRoot instanceof Private.SplitLayoutNode) {\n if (oldRoot.orientation === orientation) {\n return oldRoot;\n }\n }\n\n // Create a new root node with the specified orientation.\n let newRoot = (this._root = new Private.SplitLayoutNode(orientation));\n\n // Add the old root to the new root.\n if (oldRoot) {\n newRoot.children.push(oldRoot);\n newRoot.sizers.push(Private.createSizer(0));\n newRoot.handles.push(this._createHandle());\n oldRoot.parent = newRoot;\n }\n\n // Return the new root as a convenience.\n return newRoot;\n }\n\n /**\n * Fit the layout to the total size required by the widgets.\n */\n private _fit(): void {\n // Set up the computed minimum size.\n let minW = 0;\n let minH = 0;\n\n // Update the size limits for the layout tree.\n if (this._root) {\n let limits = this._root.fit(this._spacing, this._items);\n minW = limits.minWidth;\n minH = limits.minHeight;\n }\n\n // Update the box sizing and add it to the computed min size.\n let box = (this._box = ElementExt.boxSizing(this.parent!.node));\n minW += box.horizontalSum;\n minH += box.verticalSum;\n\n // Update the parent's min size constraints.\n let style = this.parent!.node.style;\n style.minWidth = `${minW}px`;\n style.minHeight = `${minH}px`;\n\n // Set the dirty flag to ensure only a single update occurs.\n this._dirty = true;\n\n // Notify the ancestor that it should fit immediately. This may\n // cause a resize of the parent, fulfilling the required update.\n if (this.parent!.parent) {\n MessageLoop.sendMessage(this.parent!.parent!, Widget.Msg.FitRequest);\n }\n\n // If the dirty flag is still set, the parent was not resized.\n // Trigger the required update on the parent widget immediately.\n if (this._dirty) {\n MessageLoop.sendMessage(this.parent!, Widget.Msg.UpdateRequest);\n }\n }\n\n /**\n * Update the layout position and size of the widgets.\n *\n * The parent offset dimensions should be `-1` if unknown.\n */\n private _update(offsetWidth: number, offsetHeight: number): void {\n // Clear the dirty flag to indicate the update occurred.\n this._dirty = false;\n\n // Bail early if there is no root layout node.\n if (!this._root) {\n return;\n }\n\n // Measure the parent if the offset dimensions are unknown.\n if (offsetWidth < 0) {\n offsetWidth = this.parent!.node.offsetWidth;\n }\n if (offsetHeight < 0) {\n offsetHeight = this.parent!.node.offsetHeight;\n }\n\n // Ensure the parent box sizing data is computed.\n if (!this._box) {\n this._box = ElementExt.boxSizing(this.parent!.node);\n }\n\n // Compute the actual layout bounds adjusted for border and padding.\n let x = this._box.paddingTop;\n let y = this._box.paddingLeft;\n let width = offsetWidth - this._box.horizontalSum;\n let height = offsetHeight - this._box.verticalSum;\n\n // Update the geometry of the layout tree.\n this._root.update(x, y, width, height, this._spacing, this._items);\n }\n\n /**\n * Create a new tab bar for use by the dock layout.\n *\n * #### Notes\n * The tab bar will be attached to the parent if it exists.\n */\n private _createTabBar(): TabBar {\n // Create the tab bar using the renderer.\n let tabBar = this.renderer.createTabBar(this._document);\n\n // Enforce necessary tab bar behavior.\n tabBar.orientation = 'horizontal';\n\n // Attach the tab bar to the parent if possible.\n if (this.parent) {\n this.attachWidget(tabBar);\n }\n\n // Return the initialized tab bar.\n return tabBar;\n }\n\n /**\n * Create a new handle for the dock layout.\n *\n * #### Notes\n * The handle will be attached to the parent if it exists.\n */\n private _createHandle(): HTMLDivElement {\n // Create the handle using the renderer.\n let handle = this.renderer.createHandle();\n\n // Initialize the handle layout behavior.\n let style = handle.style;\n style.position = 'absolute';\n style.contain = 'strict';\n style.top = '0';\n style.left = '0';\n style.width = '0';\n style.height = '0';\n\n // Attach the handle to the parent if it exists.\n if (this.parent) {\n this.parent.node.appendChild(handle);\n }\n\n // Return the initialized handle.\n return handle;\n }\n\n private _spacing = 4;\n private _dirty = false;\n private _root: Private.LayoutNode | null = null;\n private _box: ElementExt.IBoxSizing | null = null;\n private _document: Document | ShadowRoot;\n private _hiddenMode: Widget.HiddenMode;\n private _items: Private.ItemMap = new Map();\n}\n\n/**\n * The namespace for the `DockLayout` class statics.\n */\nexport namespace DockLayout {\n /**\n * An options object for creating a dock layout.\n */\n export interface IOptions {\n /**\n * The document to use with the dock panel.\n *\n * The default is the global `document` instance.\n */\n document?: Document | ShadowRoot;\n\n /**\n * The method for hiding widgets.\n *\n * The default is `Widget.HiddenMode.Display`.\n */\n hiddenMode?: Widget.HiddenMode;\n\n /**\n * The renderer to use for the dock layout.\n */\n renderer: IRenderer;\n\n /**\n * The spacing between items in the layout.\n *\n * The default is `4`.\n */\n spacing?: number;\n }\n\n /**\n * A renderer for use with a dock layout.\n */\n export interface IRenderer {\n /**\n * Create a new tab bar for use with a dock layout.\n *\n * @returns A new tab bar for a dock layout.\n */\n createTabBar(document?: Document | ShadowRoot): TabBar;\n\n /**\n * Create a new handle node for use with a dock layout.\n *\n * @returns A new handle node for a dock layout.\n */\n createHandle(): HTMLDivElement;\n }\n\n /**\n * A type alias for the supported insertion modes.\n *\n * An insert mode is used to specify how a widget should be added\n * to the dock layout relative to a reference widget.\n */\n export type InsertMode =\n | /**\n * The area to the top of the reference widget.\n *\n * The widget will be inserted just above the reference widget.\n *\n * If the reference widget is null or invalid, the widget will be\n * inserted at the top edge of the dock layout.\n */\n 'split-top'\n\n /**\n * The area to the left of the reference widget.\n *\n * The widget will be inserted just left of the reference widget.\n *\n * If the reference widget is null or invalid, the widget will be\n * inserted at the left edge of the dock layout.\n */\n | 'split-left'\n\n /**\n * The area to the right of the reference widget.\n *\n * The widget will be inserted just right of the reference widget.\n *\n * If the reference widget is null or invalid, the widget will be\n * inserted at the right edge of the dock layout.\n */\n | 'split-right'\n\n /**\n * The area to the bottom of the reference widget.\n *\n * The widget will be inserted just below the reference widget.\n *\n * If the reference widget is null or invalid, the widget will be\n * inserted at the bottom edge of the dock layout.\n */\n | 'split-bottom'\n\n /**\n * Like `split-top` but if a tab layout exists above the reference widget,\n * it behaves like `tab-after` with reference to that instead.\n */\n | 'merge-top'\n\n /**\n * Like `split-left` but if a tab layout exists left of the reference widget,\n * it behaves like `tab-after` with reference to that instead.\n */\n | 'merge-left'\n\n /**\n * Like `split-right` but if a tab layout exists right of the reference widget,\n * it behaves like `tab-after` with reference to that instead.\n */\n | 'merge-right'\n\n /**\n * Like `split-bottom` but if a tab layout exists below the reference widget,\n * it behaves like `tab-after` with reference to that instead.\n */\n | 'merge-bottom'\n\n /**\n * The tab position before the reference widget.\n *\n * The widget will be added as a tab before the reference widget.\n *\n * If the reference widget is null or invalid, a sensible default\n * will be used.\n */\n | 'tab-before'\n\n /**\n * The tab position after the reference widget.\n *\n * The widget will be added as a tab after the reference widget.\n *\n * If the reference widget is null or invalid, a sensible default\n * will be used.\n */\n | 'tab-after';\n\n /**\n * An options object for adding a widget to the dock layout.\n */\n export interface IAddOptions {\n /**\n * The insertion mode for adding the widget.\n *\n * The default is `'tab-after'`.\n */\n mode?: InsertMode;\n\n /**\n * The reference widget for the insert location.\n *\n * The default is `null`.\n */\n ref?: Widget | null;\n }\n\n /**\n * A layout config object for a tab area.\n */\n export interface ITabAreaConfig {\n /**\n * The discriminated type of the config object.\n */\n type: 'tab-area';\n\n /**\n * The widgets contained in the tab area.\n */\n widgets: Widget[];\n\n /**\n * The index of the selected tab.\n */\n currentIndex: number;\n }\n\n /**\n * A layout config object for a split area.\n */\n export interface ISplitAreaConfig {\n /**\n * The discriminated type of the config object.\n */\n type: 'split-area';\n\n /**\n * The orientation of the split area.\n */\n orientation: 'horizontal' | 'vertical';\n\n /**\n * The children in the split area.\n */\n children: AreaConfig[];\n\n /**\n * The relative sizes of the children.\n */\n sizes: number[];\n }\n\n /**\n * A type alias for a general area config.\n */\n export type AreaConfig = ITabAreaConfig | ISplitAreaConfig;\n\n /**\n * A dock layout configuration object.\n */\n export interface ILayoutConfig {\n /**\n * The layout config for the main dock area.\n */\n main: AreaConfig | null;\n }\n\n /**\n * An object which represents the geometry of a tab area.\n */\n export interface ITabAreaGeometry {\n /**\n * The tab bar for the tab area.\n */\n tabBar: TabBar;\n\n /**\n * The local X position of the hit test in the dock area.\n *\n * #### Notes\n * This is the distance from the left edge of the layout parent\n * widget, to the local X coordinate of the hit test query.\n */\n x: number;\n\n /**\n * The local Y position of the hit test in the dock area.\n *\n * #### Notes\n * This is the distance from the top edge of the layout parent\n * widget, to the local Y coordinate of the hit test query.\n */\n y: number;\n\n /**\n * The local coordinate of the top edge of the tab area.\n *\n * #### Notes\n * This is the distance from the top edge of the layout parent\n * widget, to the top edge of the tab area.\n */\n top: number;\n\n /**\n * The local coordinate of the left edge of the tab area.\n *\n * #### Notes\n * This is the distance from the left edge of the layout parent\n * widget, to the left edge of the tab area.\n */\n left: number;\n\n /**\n * The local coordinate of the right edge of the tab area.\n *\n * #### Notes\n * This is the distance from the right edge of the layout parent\n * widget, to the right edge of the tab area.\n */\n right: number;\n\n /**\n * The local coordinate of the bottom edge of the tab area.\n *\n * #### Notes\n * This is the distance from the bottom edge of the layout parent\n * widget, to the bottom edge of the tab area.\n */\n bottom: number;\n\n /**\n * The width of the tab area.\n *\n * #### Notes\n * This is total width allocated for the tab area.\n */\n width: number;\n\n /**\n * The height of the tab area.\n *\n * #### Notes\n * This is total height allocated for the tab area.\n */\n height: number;\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * A fraction used for sizing root panels; ~= `1 / golden_ratio`.\n */\n export const GOLDEN_RATIO = 0.618;\n\n /**\n * A type alias for a dock layout node.\n */\n export type LayoutNode = TabLayoutNode | SplitLayoutNode;\n\n /**\n * A type alias for the orientation of a split layout node.\n */\n export type Orientation = 'horizontal' | 'vertical';\n\n /**\n * A type alias for a layout item map.\n */\n export type ItemMap = Map;\n\n /**\n * Create a box sizer with an initial size hint.\n */\n export function createSizer(hint: number): BoxSizer {\n let sizer = new BoxSizer();\n sizer.sizeHint = hint;\n sizer.size = hint;\n return sizer;\n }\n\n /**\n * Normalize an area config object and collect the visited widgets.\n */\n export function normalizeAreaConfig(\n config: DockLayout.AreaConfig,\n widgetSet: Set\n ): DockLayout.AreaConfig | null {\n let result: DockLayout.AreaConfig | null;\n if (config.type === 'tab-area') {\n result = normalizeTabAreaConfig(config, widgetSet);\n } else {\n result = normalizeSplitAreaConfig(config, widgetSet);\n }\n return result;\n }\n\n /**\n * Convert a normalized area config into a layout tree.\n */\n export function realizeAreaConfig(\n config: DockLayout.AreaConfig,\n renderer: DockLayout.IRenderer,\n document: Document | ShadowRoot\n ): LayoutNode {\n let node: LayoutNode;\n if (config.type === 'tab-area') {\n node = realizeTabAreaConfig(config, renderer, document);\n } else {\n node = realizeSplitAreaConfig(config, renderer, document);\n }\n return node;\n }\n\n /**\n * A layout node which holds the data for a tabbed area.\n */\n export class TabLayoutNode {\n /**\n * Construct a new tab layout node.\n *\n * @param tabBar - The tab bar to use for the layout node.\n */\n constructor(tabBar: TabBar) {\n let tabSizer = new BoxSizer();\n let widgetSizer = new BoxSizer();\n tabSizer.stretch = 0;\n widgetSizer.stretch = 1;\n this.tabBar = tabBar;\n this.sizers = [tabSizer, widgetSizer];\n }\n\n /**\n * The parent of the layout node.\n */\n parent: SplitLayoutNode | null = null;\n\n /**\n * The tab bar for the layout node.\n */\n readonly tabBar: TabBar;\n\n /**\n * The sizers for the layout node.\n */\n readonly sizers: [BoxSizer, BoxSizer];\n\n /**\n * The most recent value for the `top` edge of the layout box.\n */\n get top(): number {\n return this._top;\n }\n\n /**\n * The most recent value for the `left` edge of the layout box.\n */\n get left(): number {\n return this._left;\n }\n\n /**\n * The most recent value for the `width` of the layout box.\n */\n get width(): number {\n return this._width;\n }\n\n /**\n * The most recent value for the `height` of the layout box.\n */\n get height(): number {\n return this._height;\n }\n\n /**\n * Create an iterator for all widgets in the layout tree.\n */\n *iterAllWidgets(): IterableIterator {\n yield this.tabBar;\n yield* this.iterUserWidgets();\n }\n\n /**\n * Create an iterator for the user widgets in the layout tree.\n */\n *iterUserWidgets(): IterableIterator {\n for (const title of this.tabBar.titles) {\n yield title.owner;\n }\n }\n\n /**\n * Create an iterator for the selected widgets in the layout tree.\n */\n *iterSelectedWidgets(): IterableIterator {\n let title = this.tabBar.currentTitle;\n if (title) {\n yield title.owner;\n }\n }\n\n /**\n * Create an iterator for the tab bars in the layout tree.\n */\n *iterTabBars(): IterableIterator> {\n yield this.tabBar;\n }\n\n /**\n * Create an iterator for the handles in the layout tree.\n */\n // eslint-disable-next-line require-yield\n *iterHandles(): IterableIterator {\n return;\n }\n\n /**\n * Find the tab layout node which contains the given widget.\n */\n findTabNode(widget: Widget): TabLayoutNode | null {\n return this.tabBar.titles.indexOf(widget.title) !== -1 ? this : null;\n }\n\n /**\n * Find the split layout node which contains the given handle.\n */\n findSplitNode(\n handle: HTMLDivElement\n ): { index: number; node: SplitLayoutNode } | null {\n return null;\n }\n\n /**\n * Find the first tab layout node in a layout tree.\n */\n findFirstTabNode(): TabLayoutNode | null {\n return this;\n }\n\n /**\n * Find the tab layout node which contains the local point.\n */\n hitTestTabNodes(x: number, y: number): TabLayoutNode | null {\n if (x < this._left || x >= this._left + this._width) {\n return null;\n }\n if (y < this._top || y >= this._top + this._height) {\n return null;\n }\n return this;\n }\n\n /**\n * Create a configuration object for the layout tree.\n */\n createConfig(): DockLayout.ITabAreaConfig {\n let widgets = this.tabBar.titles.map(title => title.owner);\n let currentIndex = this.tabBar.currentIndex;\n return { type: 'tab-area', widgets, currentIndex };\n }\n\n /**\n * Recursively hold all of the sizes in the layout tree.\n *\n * This ignores the sizers of tab layout nodes.\n */\n holdAllSizes(): void {\n return;\n }\n\n /**\n * Fit the layout tree.\n */\n fit(spacing: number, items: ItemMap): ElementExt.ISizeLimits {\n // Set up the limit variables.\n let minWidth = 0;\n let minHeight = 0;\n let maxWidth = Infinity;\n let maxHeight = Infinity;\n\n // Lookup the tab bar layout item.\n let tabBarItem = items.get(this.tabBar);\n\n // Lookup the widget layout item.\n let current = this.tabBar.currentTitle;\n let widgetItem = current ? items.get(current.owner) : undefined;\n\n // Lookup the tab bar and widget sizers.\n let [tabBarSizer, widgetSizer] = this.sizers;\n\n // Update the tab bar limits.\n if (tabBarItem) {\n tabBarItem.fit();\n }\n\n // Update the widget limits.\n if (widgetItem) {\n widgetItem.fit();\n }\n\n // Update the results and sizer for the tab bar.\n if (tabBarItem && !tabBarItem.isHidden) {\n minWidth = Math.max(minWidth, tabBarItem.minWidth);\n minHeight += tabBarItem.minHeight;\n tabBarSizer.minSize = tabBarItem.minHeight;\n tabBarSizer.maxSize = tabBarItem.maxHeight;\n } else {\n tabBarSizer.minSize = 0;\n tabBarSizer.maxSize = 0;\n }\n\n // Update the results and sizer for the current widget.\n if (widgetItem && !widgetItem.isHidden) {\n minWidth = Math.max(minWidth, widgetItem.minWidth);\n minHeight += widgetItem.minHeight;\n widgetSizer.minSize = widgetItem.minHeight;\n widgetSizer.maxSize = Infinity;\n } else {\n widgetSizer.minSize = 0;\n widgetSizer.maxSize = Infinity;\n }\n\n // Return the computed size limits for the layout node.\n return { minWidth, minHeight, maxWidth, maxHeight };\n }\n\n /**\n * Update the layout tree.\n */\n update(\n left: number,\n top: number,\n width: number,\n height: number,\n spacing: number,\n items: ItemMap\n ): void {\n // Update the layout box values.\n this._top = top;\n this._left = left;\n this._width = width;\n this._height = height;\n\n // Lookup the tab bar layout item.\n let tabBarItem = items.get(this.tabBar);\n\n // Lookup the widget layout item.\n let current = this.tabBar.currentTitle;\n let widgetItem = current ? items.get(current.owner) : undefined;\n\n // Distribute the layout space to the sizers.\n BoxEngine.calc(this.sizers, height);\n\n // Update the tab bar item using the computed size.\n if (tabBarItem && !tabBarItem.isHidden) {\n let size = this.sizers[0].size;\n tabBarItem.update(left, top, width, size);\n top += size;\n }\n\n // Layout the widget using the computed size.\n if (widgetItem && !widgetItem.isHidden) {\n let size = this.sizers[1].size;\n widgetItem.update(left, top, width, size);\n }\n }\n\n private _top = 0;\n private _left = 0;\n private _width = 0;\n private _height = 0;\n }\n\n /**\n * A layout node which holds the data for a split area.\n */\n export class SplitLayoutNode {\n /**\n * Construct a new split layout node.\n *\n * @param orientation - The orientation of the node.\n */\n constructor(orientation: Orientation) {\n this.orientation = orientation;\n }\n\n /**\n * The parent of the layout node.\n */\n parent: SplitLayoutNode | null = null;\n\n /**\n * Whether the sizers have been normalized.\n */\n normalized = false;\n\n /**\n * The orientation of the node.\n */\n readonly orientation: Orientation;\n\n /**\n * The child nodes for the split node.\n */\n readonly children: LayoutNode[] = [];\n\n /**\n * The box sizers for the layout children.\n */\n readonly sizers: BoxSizer[] = [];\n\n /**\n * The handles for the layout children.\n */\n readonly handles: HTMLDivElement[] = [];\n\n /**\n * Create an iterator for all widgets in the layout tree.\n */\n *iterAllWidgets(): IterableIterator {\n for (const child of this.children) {\n yield* child.iterAllWidgets();\n }\n }\n\n /**\n * Create an iterator for the user widgets in the layout tree.\n */\n *iterUserWidgets(): IterableIterator {\n for (const child of this.children) {\n yield* child.iterUserWidgets();\n }\n }\n\n /**\n * Create an iterator for the selected widgets in the layout tree.\n */\n *iterSelectedWidgets(): IterableIterator {\n for (const child of this.children) {\n yield* child.iterSelectedWidgets();\n }\n }\n\n /**\n * Create an iterator for the tab bars in the layout tree.\n */\n *iterTabBars(): IterableIterator> {\n for (const child of this.children) {\n yield* child.iterTabBars();\n }\n }\n\n /**\n * Create an iterator for the handles in the layout tree.\n */\n *iterHandles(): IterableIterator {\n yield* this.handles;\n for (const child of this.children) {\n yield* child.iterHandles();\n }\n }\n\n /**\n * Find the tab layout node which contains the given widget.\n */\n findTabNode(widget: Widget): TabLayoutNode | null {\n for (let i = 0, n = this.children.length; i < n; ++i) {\n let result = this.children[i].findTabNode(widget);\n if (result) {\n return result;\n }\n }\n return null;\n }\n\n /**\n * Find the split layout node which contains the given handle.\n */\n findSplitNode(\n handle: HTMLDivElement\n ): { index: number; node: SplitLayoutNode } | null {\n let index = this.handles.indexOf(handle);\n if (index !== -1) {\n return { index, node: this };\n }\n for (let i = 0, n = this.children.length; i < n; ++i) {\n let result = this.children[i].findSplitNode(handle);\n if (result) {\n return result;\n }\n }\n return null;\n }\n\n /**\n * Find the first tab layout node in a layout tree.\n */\n findFirstTabNode(): TabLayoutNode | null {\n if (this.children.length === 0) {\n return null;\n }\n return this.children[0].findFirstTabNode();\n }\n\n /**\n * Find the tab layout node which contains the local point.\n */\n hitTestTabNodes(x: number, y: number): TabLayoutNode | null {\n for (let i = 0, n = this.children.length; i < n; ++i) {\n let result = this.children[i].hitTestTabNodes(x, y);\n if (result) {\n return result;\n }\n }\n return null;\n }\n\n /**\n * Create a configuration object for the layout tree.\n */\n createConfig(): DockLayout.ISplitAreaConfig {\n let orientation = this.orientation;\n let sizes = this.createNormalizedSizes();\n let children = this.children.map(child => child.createConfig());\n return { type: 'split-area', orientation, children, sizes };\n }\n\n /**\n * Sync the visibility and orientation of the handles.\n */\n syncHandles(): void {\n this.handles.forEach((handle, i) => {\n handle.setAttribute('data-orientation', this.orientation);\n if (i === this.handles.length - 1) {\n handle.classList.add('lm-mod-hidden');\n } else {\n handle.classList.remove('lm-mod-hidden');\n }\n });\n }\n\n /**\n * Hold the current sizes of the box sizers.\n *\n * This sets the size hint of each sizer to its current size.\n */\n holdSizes(): void {\n for (const sizer of this.sizers) {\n sizer.sizeHint = sizer.size;\n }\n }\n\n /**\n * Recursively hold all of the sizes in the layout tree.\n *\n * This ignores the sizers of tab layout nodes.\n */\n holdAllSizes(): void {\n for (const child of this.children) {\n child.holdAllSizes();\n }\n this.holdSizes();\n }\n\n /**\n * Normalize the sizes of the split layout node.\n */\n normalizeSizes(): void {\n // Bail early if the sizers are empty.\n let n = this.sizers.length;\n if (n === 0) {\n return;\n }\n\n // Hold the current sizes of the sizers.\n this.holdSizes();\n\n // Compute the sum of the sizes.\n let sum = this.sizers.reduce((v, sizer) => v + sizer.sizeHint, 0);\n\n // Normalize the sizes based on the sum.\n if (sum === 0) {\n for (const sizer of this.sizers) {\n sizer.size = sizer.sizeHint = 1 / n;\n }\n } else {\n for (const sizer of this.sizers) {\n sizer.size = sizer.sizeHint /= sum;\n }\n }\n\n // Mark the sizes as normalized.\n this.normalized = true;\n }\n\n /**\n * Snap the normalized sizes of the split layout node.\n */\n createNormalizedSizes(): number[] {\n // Bail early if the sizers are empty.\n let n = this.sizers.length;\n if (n === 0) {\n return [];\n }\n\n // Grab the current sizes of the sizers.\n let sizes = this.sizers.map(sizer => sizer.size);\n\n // Compute the sum of the sizes.\n let sum = sizes.reduce((v, size) => v + size, 0);\n\n // Normalize the sizes based on the sum.\n if (sum === 0) {\n for (let i = sizes.length - 1; i > -1; i--) {\n sizes[i] = 1 / n;\n }\n } else {\n for (let i = sizes.length - 1; i > -1; i--) {\n sizes[i] /= sum;\n }\n }\n\n // Return the normalized sizes.\n return sizes;\n }\n\n /**\n * Fit the layout tree.\n */\n fit(spacing: number, items: ItemMap): ElementExt.ISizeLimits {\n // Compute the required fixed space.\n let horizontal = this.orientation === 'horizontal';\n let fixed = Math.max(0, this.children.length - 1) * spacing;\n\n // Set up the limit variables.\n let minWidth = horizontal ? fixed : 0;\n let minHeight = horizontal ? 0 : fixed;\n let maxWidth = Infinity;\n let maxHeight = Infinity;\n\n // Fit the children and update the limits.\n for (let i = 0, n = this.children.length; i < n; ++i) {\n let limits = this.children[i].fit(spacing, items);\n if (horizontal) {\n minHeight = Math.max(minHeight, limits.minHeight);\n minWidth += limits.minWidth;\n this.sizers[i].minSize = limits.minWidth;\n } else {\n minWidth = Math.max(minWidth, limits.minWidth);\n minHeight += limits.minHeight;\n this.sizers[i].minSize = limits.minHeight;\n }\n }\n\n // Return the computed limits for the layout node.\n return { minWidth, minHeight, maxWidth, maxHeight };\n }\n\n /**\n * Update the layout tree.\n */\n update(\n left: number,\n top: number,\n width: number,\n height: number,\n spacing: number,\n items: ItemMap\n ): void {\n // Compute the available layout space.\n let horizontal = this.orientation === 'horizontal';\n let fixed = Math.max(0, this.children.length - 1) * spacing;\n let space = Math.max(0, (horizontal ? width : height) - fixed);\n\n // De-normalize the sizes if needed.\n if (this.normalized) {\n for (const sizer of this.sizers) {\n sizer.sizeHint *= space;\n }\n this.normalized = false;\n }\n\n // Distribute the layout space to the sizers.\n BoxEngine.calc(this.sizers, space);\n\n // Update the geometry of the child nodes and handles.\n for (let i = 0, n = this.children.length; i < n; ++i) {\n let child = this.children[i];\n let size = this.sizers[i].size;\n let handleStyle = this.handles[i].style;\n if (horizontal) {\n child.update(left, top, size, height, spacing, items);\n left += size;\n handleStyle.top = `${top}px`;\n handleStyle.left = `${left}px`;\n handleStyle.width = `${spacing}px`;\n handleStyle.height = `${height}px`;\n left += spacing;\n } else {\n child.update(left, top, width, size, spacing, items);\n top += size;\n handleStyle.top = `${top}px`;\n handleStyle.left = `${left}px`;\n handleStyle.width = `${width}px`;\n handleStyle.height = `${spacing}px`;\n top += spacing;\n }\n }\n }\n }\n\n export function addAria(widget: Widget, tabBar: TabBar): void {\n widget.node.setAttribute('role', 'tabpanel');\n let renderer = tabBar.renderer;\n if (renderer instanceof TabBar.Renderer) {\n let tabId = renderer.createTabKey({\n title: widget.title,\n current: false,\n zIndex: 0\n });\n widget.node.setAttribute('aria-labelledby', tabId);\n }\n }\n\n export function removeAria(widget: Widget): void {\n widget.node.removeAttribute('role');\n widget.node.removeAttribute('aria-labelledby');\n }\n\n /**\n * Normalize a tab area config and collect the visited widgets.\n */\n function normalizeTabAreaConfig(\n config: DockLayout.ITabAreaConfig,\n widgetSet: Set\n ): DockLayout.ITabAreaConfig | null {\n // Bail early if there is no content.\n if (config.widgets.length === 0) {\n return null;\n }\n\n // Setup the filtered widgets array.\n let widgets: Widget[] = [];\n\n // Filter the config for unique widgets.\n for (const widget of config.widgets) {\n if (!widgetSet.has(widget)) {\n widgetSet.add(widget);\n widgets.push(widget);\n }\n }\n\n // Bail if there are no effective widgets.\n if (widgets.length === 0) {\n return null;\n }\n\n // Normalize the current index.\n let index = config.currentIndex;\n if (index !== -1 && (index < 0 || index >= widgets.length)) {\n index = 0;\n }\n\n // Return a normalized config object.\n return { type: 'tab-area', widgets, currentIndex: index };\n }\n\n /**\n * Normalize a split area config and collect the visited widgets.\n */\n function normalizeSplitAreaConfig(\n config: DockLayout.ISplitAreaConfig,\n widgetSet: Set\n ): DockLayout.AreaConfig | null {\n // Set up the result variables.\n let orientation = config.orientation;\n let children: DockLayout.AreaConfig[] = [];\n let sizes: number[] = [];\n\n // Normalize the config children.\n for (let i = 0, n = config.children.length; i < n; ++i) {\n // Normalize the child config.\n let child = normalizeAreaConfig(config.children[i], widgetSet);\n\n // Ignore an empty child.\n if (!child) {\n continue;\n }\n\n // Add the child or hoist its content as appropriate.\n if (child.type === 'tab-area' || child.orientation !== orientation) {\n children.push(child);\n sizes.push(Math.abs(config.sizes[i] || 0));\n } else {\n children.push(...child.children);\n sizes.push(...child.sizes);\n }\n }\n\n // Bail if there are no effective children.\n if (children.length === 0) {\n return null;\n }\n\n // If there is only one effective child, return that child.\n if (children.length === 1) {\n return children[0];\n }\n\n // Return a normalized config object.\n return { type: 'split-area', orientation, children, sizes };\n }\n\n /**\n * Convert a normalized tab area config into a layout tree.\n */\n function realizeTabAreaConfig(\n config: DockLayout.ITabAreaConfig,\n renderer: DockLayout.IRenderer,\n document: Document | ShadowRoot\n ): TabLayoutNode {\n // Create the tab bar for the layout node.\n let tabBar = renderer.createTabBar(document);\n\n // Hide each widget and add it to the tab bar.\n for (const widget of config.widgets) {\n widget.hide();\n tabBar.addTab(widget.title);\n Private.addAria(widget, tabBar);\n }\n\n // Set the current index of the tab bar.\n tabBar.currentIndex = config.currentIndex;\n\n // Return the new tab layout node.\n return new TabLayoutNode(tabBar);\n }\n\n /**\n * Convert a normalized split area config into a layout tree.\n */\n function realizeSplitAreaConfig(\n config: DockLayout.ISplitAreaConfig,\n renderer: DockLayout.IRenderer,\n document: Document | ShadowRoot\n ): SplitLayoutNode {\n // Create the split layout node.\n let node = new SplitLayoutNode(config.orientation);\n\n // Add each child to the layout node.\n config.children.forEach((child, i) => {\n // Create the child data for the layout node.\n let childNode = realizeAreaConfig(child, renderer, document);\n let sizer = createSizer(config.sizes[i]);\n let handle = renderer.createHandle();\n\n // Add the child data to the layout node.\n node.children.push(childNode);\n node.handles.push(handle);\n node.sizers.push(sizer);\n\n // Update the parent for the child node.\n childNode.parent = node;\n });\n\n // Synchronize the handle state for the layout node.\n node.syncHandles();\n\n // Normalize the sizes for the layout node.\n node.normalizeSizes();\n\n // Return the new layout node.\n return node;\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { find } from '@lumino/algorithm';\n\nimport { MimeData } from '@lumino/coreutils';\n\nimport { IDisposable } from '@lumino/disposable';\n\nimport { ElementExt, Platform } from '@lumino/domutils';\n\nimport { Drag } from '@lumino/dragdrop';\n\nimport { ConflatableMessage, Message, MessageLoop } from '@lumino/messaging';\n\nimport { AttachedProperty } from '@lumino/properties';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { DockLayout } from './docklayout';\n\nimport { TabBar } from './tabbar';\n\nimport { Widget } from './widget';\n\n/**\n * A widget which provides a flexible docking area for widgets.\n *\n * #### Notes\n * See also the related [example](../../examples/dockpanel/index.html) and\n * its [source](https://github.com/jupyterlab/lumino/tree/main/examples/example-dockpanel).\n */\nexport class DockPanel extends Widget {\n /**\n * Construct a new dock panel.\n *\n * @param options - The options for initializing the panel.\n */\n constructor(options: DockPanel.IOptions = {}) {\n super();\n this.addClass('lm-DockPanel');\n this._document = options.document || document;\n this._mode = options.mode || 'multiple-document';\n this._renderer = options.renderer || DockPanel.defaultRenderer;\n this._edges = options.edges || Private.DEFAULT_EDGES;\n if (options.tabsMovable !== undefined) {\n this._tabsMovable = options.tabsMovable;\n }\n if (options.tabsConstrained !== undefined) {\n this._tabsConstrained = options.tabsConstrained;\n }\n if (options.addButtonEnabled !== undefined) {\n this._addButtonEnabled = options.addButtonEnabled;\n }\n\n // Toggle the CSS mode attribute.\n this.dataset['mode'] = this._mode;\n\n // Create the delegate renderer for the layout.\n let renderer: DockPanel.IRenderer = {\n createTabBar: () => this._createTabBar(),\n createHandle: () => this._createHandle()\n };\n\n // Set up the dock layout for the panel.\n this.layout = new DockLayout({\n document: this._document,\n renderer,\n spacing: options.spacing,\n hiddenMode: options.hiddenMode\n });\n\n // Set up the overlay drop indicator.\n this.overlay = options.overlay || new DockPanel.Overlay();\n this.node.appendChild(this.overlay.node);\n }\n\n /**\n * Dispose of the resources held by the panel.\n */\n dispose(): void {\n // Ensure the mouse is released.\n this._releaseMouse();\n\n // Hide the overlay.\n this.overlay.hide(0);\n\n // Cancel a drag if one is in progress.\n if (this._drag) {\n this._drag.dispose();\n }\n\n // Dispose of the base class.\n super.dispose();\n }\n\n /**\n * The method for hiding widgets.\n */\n get hiddenMode(): Widget.HiddenMode {\n return (this.layout as DockLayout).hiddenMode;\n }\n\n /**\n * Set the method for hiding widgets.\n */\n set hiddenMode(v: Widget.HiddenMode) {\n (this.layout as DockLayout).hiddenMode = v;\n }\n\n /**\n * A signal emitted when the layout configuration is modified.\n *\n * #### Notes\n * This signal is emitted whenever the current layout configuration\n * may have changed.\n *\n * This signal is emitted asynchronously in a collapsed fashion, so\n * that multiple synchronous modifications results in only a single\n * emit of the signal.\n */\n get layoutModified(): ISignal {\n return this._layoutModified;\n }\n\n /**\n * A signal emitted when the add button on a tab bar is clicked.\n *\n */\n get addRequested(): ISignal> {\n return this._addRequested;\n }\n\n /**\n * The overlay used by the dock panel.\n */\n readonly overlay: DockPanel.IOverlay;\n\n /**\n * The renderer used by the dock panel.\n */\n get renderer(): DockPanel.IRenderer {\n return (this.layout as DockLayout).renderer;\n }\n\n /**\n * Get the spacing between the widgets.\n */\n get spacing(): number {\n return (this.layout as DockLayout).spacing;\n }\n\n /**\n * Set the spacing between the widgets.\n */\n set spacing(value: number) {\n (this.layout as DockLayout).spacing = value;\n }\n\n /**\n * Get the mode for the dock panel.\n */\n get mode(): DockPanel.Mode {\n return this._mode;\n }\n\n /**\n * Set the mode for the dock panel.\n *\n * #### Notes\n * Changing the mode is a destructive operation with respect to the\n * panel's layout configuration. If layout state must be preserved,\n * save the current layout config before changing the mode.\n */\n set mode(value: DockPanel.Mode) {\n // Bail early if the mode does not change.\n if (this._mode === value) {\n return;\n }\n\n // Update the internal mode.\n this._mode = value;\n\n // Toggle the CSS mode attribute.\n this.dataset['mode'] = value;\n\n // Get the layout for the panel.\n let layout = this.layout as DockLayout;\n\n // Configure the layout for the specified mode.\n switch (value) {\n case 'multiple-document':\n for (const tabBar of layout.tabBars()) {\n tabBar.show();\n }\n break;\n case 'single-document':\n layout.restoreLayout(Private.createSingleDocumentConfig(this));\n break;\n default:\n throw 'unreachable';\n }\n\n // Schedule an emit of the layout modified signal.\n MessageLoop.postMessage(this, Private.LayoutModified);\n }\n\n /**\n * Whether the tabs can be dragged / moved at runtime.\n */\n get tabsMovable(): boolean {\n return this._tabsMovable;\n }\n\n /**\n * Enable / Disable draggable / movable tabs.\n */\n set tabsMovable(value: boolean) {\n this._tabsMovable = value;\n for (const tabBar of this.tabBars()) {\n tabBar.tabsMovable = value;\n }\n }\n\n /**\n * Whether the tabs are constrained to their source dock panel\n */\n get tabsConstrained(): boolean {\n return this._tabsConstrained;\n }\n\n /**\n * Constrain/Allow tabs to be dragged outside of this dock panel\n */\n set tabsConstrained(value: boolean) {\n this._tabsConstrained = value;\n }\n\n /**\n * Whether the add buttons for each tab bar are enabled.\n */\n get addButtonEnabled(): boolean {\n return this._addButtonEnabled;\n }\n\n /**\n * Set whether the add buttons for each tab bar are enabled.\n */\n set addButtonEnabled(value: boolean) {\n this._addButtonEnabled = value;\n for (const tabBar of this.tabBars()) {\n tabBar.addButtonEnabled = value;\n }\n }\n\n /**\n * Whether the dock panel is empty.\n */\n get isEmpty(): boolean {\n return (this.layout as DockLayout).isEmpty;\n }\n\n /**\n * Create an iterator over the user widgets in the panel.\n *\n * @returns A new iterator over the user widgets in the panel.\n *\n * #### Notes\n * This iterator does not include the generated tab bars.\n */\n *widgets(): IterableIterator {\n yield* (this.layout as DockLayout).widgets();\n }\n\n /**\n * Create an iterator over the selected widgets in the panel.\n *\n * @returns A new iterator over the selected user widgets.\n *\n * #### Notes\n * This iterator yields the widgets corresponding to the current tab\n * of each tab bar in the panel.\n */\n *selectedWidgets(): IterableIterator {\n yield* (this.layout as DockLayout).selectedWidgets();\n }\n\n /**\n * Create an iterator over the tab bars in the panel.\n *\n * @returns A new iterator over the tab bars in the panel.\n *\n * #### Notes\n * This iterator does not include the user widgets.\n */\n *tabBars(): IterableIterator> {\n yield* (this.layout as DockLayout).tabBars();\n }\n\n /**\n * Create an iterator over the handles in the panel.\n *\n * @returns A new iterator over the handles in the panel.\n */\n *handles(): IterableIterator {\n yield* (this.layout as DockLayout).handles();\n }\n\n /**\n * Select a specific widget in the dock panel.\n *\n * @param widget - The widget of interest.\n *\n * #### Notes\n * This will make the widget the current widget in its tab area.\n */\n selectWidget(widget: Widget): void {\n // Find the tab bar which contains the widget.\n let tabBar = find(this.tabBars(), bar => {\n return bar.titles.indexOf(widget.title) !== -1;\n });\n\n // Throw an error if no tab bar is found.\n if (!tabBar) {\n throw new Error('Widget is not contained in the dock panel.');\n }\n\n // Ensure the widget is the current widget.\n tabBar.currentTitle = widget.title;\n }\n\n /**\n * Activate a specified widget in the dock panel.\n *\n * @param widget - The widget of interest.\n *\n * #### Notes\n * This will select and activate the given widget.\n */\n activateWidget(widget: Widget): void {\n this.selectWidget(widget);\n widget.activate();\n }\n\n /**\n * Save the current layout configuration of the dock panel.\n *\n * @returns A new config object for the current layout state.\n *\n * #### Notes\n * The return value can be provided to the `restoreLayout` method\n * in order to restore the layout to its current configuration.\n */\n saveLayout(): DockPanel.ILayoutConfig {\n return (this.layout as DockLayout).saveLayout();\n }\n\n /**\n * Restore the layout to a previously saved configuration.\n *\n * @param config - The layout configuration to restore.\n *\n * #### Notes\n * Widgets which currently belong to the layout but which are not\n * contained in the config will be unparented.\n *\n * The dock panel automatically reverts to `'multiple-document'`\n * mode when a layout config is restored.\n */\n restoreLayout(config: DockPanel.ILayoutConfig): void {\n // Reset the mode.\n this._mode = 'multiple-document';\n\n // Restore the layout.\n (this.layout as DockLayout).restoreLayout(config);\n\n // Flush the message loop on IE and Edge to prevent flicker.\n if (Platform.IS_EDGE || Platform.IS_IE) {\n MessageLoop.flush();\n }\n\n // Schedule an emit of the layout modified signal.\n MessageLoop.postMessage(this, Private.LayoutModified);\n }\n\n /**\n * Add a widget to the dock panel.\n *\n * @param widget - The widget to add to the dock panel.\n *\n * @param options - The additional options for adding the widget.\n *\n * #### Notes\n * If the panel is in single document mode, the options are ignored\n * and the widget is always added as tab in the hidden tab bar.\n */\n addWidget(widget: Widget, options: DockPanel.IAddOptions = {}): void {\n // Add the widget to the layout.\n if (this._mode === 'single-document') {\n (this.layout as DockLayout).addWidget(widget);\n } else {\n (this.layout as DockLayout).addWidget(widget, options);\n }\n\n // Schedule an emit of the layout modified signal.\n MessageLoop.postMessage(this, Private.LayoutModified);\n }\n\n /**\n * Process a message sent to the widget.\n *\n * @param msg - The message sent to the widget.\n */\n processMessage(msg: Message): void {\n if (msg.type === 'layout-modified') {\n this._layoutModified.emit(undefined);\n } else {\n super.processMessage(msg);\n }\n }\n\n /**\n * Handle the DOM events for the dock panel.\n *\n * @param event - The DOM event sent to the panel.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the panel's DOM node. It should\n * not be called directly by user code.\n */\n handleEvent(event: Event): void {\n switch (event.type) {\n case 'lm-dragenter':\n this._evtDragEnter(event as Drag.Event);\n break;\n case 'lm-dragleave':\n this._evtDragLeave(event as Drag.Event);\n break;\n case 'lm-dragover':\n this._evtDragOver(event as Drag.Event);\n break;\n case 'lm-drop':\n this._evtDrop(event as Drag.Event);\n break;\n case 'pointerdown':\n this._evtPointerDown(event as PointerEvent);\n break;\n case 'pointermove':\n this._evtPointerMove(event as PointerEvent);\n break;\n case 'pointerup':\n this._evtPointerUp(event as PointerEvent);\n break;\n case 'keydown':\n this._evtKeyDown(event as KeyboardEvent);\n break;\n case 'contextmenu':\n event.preventDefault();\n event.stopPropagation();\n break;\n }\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n this.node.addEventListener('lm-dragenter', this);\n this.node.addEventListener('lm-dragleave', this);\n this.node.addEventListener('lm-dragover', this);\n this.node.addEventListener('lm-drop', this);\n this.node.addEventListener('pointerdown', this);\n }\n\n /**\n * A message handler invoked on an `'after-detach'` message.\n */\n protected onAfterDetach(msg: Message): void {\n this.node.removeEventListener('lm-dragenter', this);\n this.node.removeEventListener('lm-dragleave', this);\n this.node.removeEventListener('lm-dragover', this);\n this.node.removeEventListener('lm-drop', this);\n this.node.removeEventListener('pointerdown', this);\n this._releaseMouse();\n }\n\n /**\n * A message handler invoked on a `'child-added'` message.\n */\n protected onChildAdded(msg: Widget.ChildMessage): void {\n // Ignore the generated tab bars.\n if (Private.isGeneratedTabBarProperty.get(msg.child)) {\n return;\n }\n\n // Add the widget class to the child.\n msg.child.addClass('lm-DockPanel-widget');\n }\n\n /**\n * A message handler invoked on a `'child-removed'` message.\n */\n protected onChildRemoved(msg: Widget.ChildMessage): void {\n // Ignore the generated tab bars.\n if (Private.isGeneratedTabBarProperty.get(msg.child)) {\n return;\n }\n\n // Remove the widget class from the child.\n msg.child.removeClass('lm-DockPanel-widget');\n\n // Schedule an emit of the layout modified signal.\n MessageLoop.postMessage(this, Private.LayoutModified);\n }\n\n /**\n * Handle the `'lm-dragenter'` event for the dock panel.\n */\n private _evtDragEnter(event: Drag.Event): void {\n // If the factory mime type is present, mark the event as\n // handled in order to get the rest of the drag events.\n if (event.mimeData.hasData('application/vnd.lumino.widget-factory')) {\n event.preventDefault();\n event.stopPropagation();\n }\n }\n\n /**\n * Handle the `'lm-dragleave'` event for the dock panel.\n */\n private _evtDragLeave(event: Drag.Event): void {\n // Mark the event as handled.\n event.preventDefault();\n\n if (this._tabsConstrained && event.source !== this) return;\n\n event.stopPropagation();\n\n // The new target might be a descendant, so we might still handle the drop.\n // Hide asynchronously so that if a lm-dragover event bubbles up to us, the\n // hide is cancelled by the lm-dragover handler's show overlay logic.\n this.overlay.hide(1);\n }\n\n /**\n * Handle the `'lm-dragover'` event for the dock panel.\n */\n private _evtDragOver(event: Drag.Event): void {\n // Mark the event as handled.\n event.preventDefault();\n\n // Show the drop indicator overlay and update the drop\n // action based on the drop target zone under the mouse.\n if (\n (this._tabsConstrained && event.source !== this) ||\n this._showOverlay(event.clientX, event.clientY) === 'invalid'\n ) {\n event.dropAction = 'none';\n } else {\n event.stopPropagation();\n event.dropAction = event.proposedAction;\n }\n }\n\n /**\n * Handle the `'lm-drop'` event for the dock panel.\n */\n private _evtDrop(event: Drag.Event): void {\n // Mark the event as handled.\n event.preventDefault();\n\n // Hide the drop indicator overlay.\n this.overlay.hide(0);\n\n // Bail if the proposed action is to do nothing.\n if (event.proposedAction === 'none') {\n event.dropAction = 'none';\n return;\n }\n\n // Find the drop target under the mouse.\n let { clientX, clientY } = event;\n let { zone, target } = Private.findDropTarget(\n this,\n clientX,\n clientY,\n this._edges\n );\n\n // Bail if the drop zone is invalid.\n if (\n (this._tabsConstrained && event.source !== this) ||\n zone === 'invalid'\n ) {\n event.dropAction = 'none';\n return;\n }\n\n // Bail if the factory mime type has invalid data.\n let mimeData = event.mimeData;\n let factory = mimeData.getData('application/vnd.lumino.widget-factory');\n if (typeof factory !== 'function') {\n event.dropAction = 'none';\n return;\n }\n\n // Bail if the factory does not produce a widget.\n let widget = factory();\n if (!(widget instanceof Widget)) {\n event.dropAction = 'none';\n return;\n }\n\n // Bail if the widget is an ancestor of the dock panel.\n if (widget.contains(this)) {\n event.dropAction = 'none';\n return;\n }\n\n // Find the reference widget for the drop target.\n let ref = target ? Private.getDropRef(target.tabBar) : null;\n\n // Add the widget according to the indicated drop zone.\n switch (zone) {\n case 'root-all':\n this.addWidget(widget);\n break;\n case 'root-top':\n this.addWidget(widget, { mode: 'split-top' });\n break;\n case 'root-left':\n this.addWidget(widget, { mode: 'split-left' });\n break;\n case 'root-right':\n this.addWidget(widget, { mode: 'split-right' });\n break;\n case 'root-bottom':\n this.addWidget(widget, { mode: 'split-bottom' });\n break;\n case 'widget-all':\n this.addWidget(widget, { mode: 'tab-after', ref });\n break;\n case 'widget-top':\n this.addWidget(widget, { mode: 'split-top', ref });\n break;\n case 'widget-left':\n this.addWidget(widget, { mode: 'split-left', ref });\n break;\n case 'widget-right':\n this.addWidget(widget, { mode: 'split-right', ref });\n break;\n case 'widget-bottom':\n this.addWidget(widget, { mode: 'split-bottom', ref });\n break;\n case 'widget-tab':\n this.addWidget(widget, { mode: 'tab-after', ref });\n break;\n default:\n throw 'unreachable';\n }\n\n // Accept the proposed drop action.\n event.dropAction = event.proposedAction;\n\n // Stop propagation if we have not bailed so far.\n event.stopPropagation();\n\n // Activate the dropped widget.\n this.activateWidget(widget);\n }\n\n /**\n * Handle the `'keydown'` event for the dock panel.\n */\n private _evtKeyDown(event: KeyboardEvent): void {\n // Stop input events during drag.\n event.preventDefault();\n event.stopPropagation();\n\n // Release the mouse if `Escape` is pressed.\n if (event.keyCode === 27) {\n // Finalize the mouse release.\n this._releaseMouse();\n\n // Schedule an emit of the layout modified signal.\n MessageLoop.postMessage(this, Private.LayoutModified);\n }\n }\n\n /**\n * Handle the `'pointerdown'` event for the dock panel.\n */\n private _evtPointerDown(event: PointerEvent): void {\n // Do nothing if the left mouse button is not pressed.\n if (event.button !== 0) {\n return;\n }\n\n // Find the handle which contains the mouse target, if any.\n let layout = this.layout as DockLayout;\n let target = event.target as HTMLElement;\n let handle = find(layout.handles(), handle => handle.contains(target));\n if (!handle) {\n return;\n }\n\n // Stop the event when a handle is pressed.\n event.preventDefault();\n event.stopPropagation();\n\n // Add the extra document listeners.\n this._document.addEventListener('keydown', this, true);\n this._document.addEventListener('pointerup', this, true);\n this._document.addEventListener('pointermove', this, true);\n this._document.addEventListener('contextmenu', this, true);\n\n // Compute the offset deltas for the handle press.\n let rect = handle.getBoundingClientRect();\n let deltaX = event.clientX - rect.left;\n let deltaY = event.clientY - rect.top;\n\n // Override the cursor and store the press data.\n let style = window.getComputedStyle(handle);\n let override = Drag.overrideCursor(style.cursor!, this._document);\n this._pressData = { handle, deltaX, deltaY, override };\n }\n\n /**\n * Handle the `'pointermove'` event for the dock panel.\n */\n private _evtPointerMove(event: PointerEvent): void {\n // Bail early if no drag is in progress.\n if (!this._pressData) {\n return;\n }\n\n // Stop the event when dragging a handle.\n event.preventDefault();\n event.stopPropagation();\n\n // Compute the desired offset position for the handle.\n let rect = this.node.getBoundingClientRect();\n let xPos = event.clientX - rect.left - this._pressData.deltaX;\n let yPos = event.clientY - rect.top - this._pressData.deltaY;\n\n // Set the handle as close to the desired position as possible.\n let layout = this.layout as DockLayout;\n layout.moveHandle(this._pressData.handle, xPos, yPos);\n }\n\n /**\n * Handle the `'pointerup'` event for the dock panel.\n */\n private _evtPointerUp(event: PointerEvent): void {\n // Do nothing if the left mouse button is not released.\n if (event.button !== 0) {\n return;\n }\n\n // Stop the event when releasing a handle.\n event.preventDefault();\n event.stopPropagation();\n\n // Finalize the mouse release.\n this._releaseMouse();\n\n // Schedule an emit of the layout modified signal.\n MessageLoop.postMessage(this, Private.LayoutModified);\n }\n\n /**\n * Release the mouse grab for the dock panel.\n */\n private _releaseMouse(): void {\n // Bail early if no drag is in progress.\n if (!this._pressData) {\n return;\n }\n\n // Clear the override cursor.\n this._pressData.override.dispose();\n this._pressData = null;\n\n // Remove the extra document listeners.\n this._document.removeEventListener('keydown', this, true);\n this._document.removeEventListener('pointerup', this, true);\n this._document.removeEventListener('pointermove', this, true);\n this._document.removeEventListener('contextmenu', this, true);\n }\n\n /**\n * Show the overlay indicator at the given client position.\n *\n * Returns the drop zone at the specified client position.\n *\n * #### Notes\n * If the position is not over a valid zone, the overlay is hidden.\n */\n private _showOverlay(clientX: number, clientY: number): Private.DropZone {\n // Find the dock target for the given client position.\n let { zone, target } = Private.findDropTarget(\n this,\n clientX,\n clientY,\n this._edges\n );\n\n // If the drop zone is invalid, hide the overlay and bail.\n if (zone === 'invalid') {\n this.overlay.hide(100);\n return zone;\n }\n\n // Setup the variables needed to compute the overlay geometry.\n let top: number;\n let left: number;\n let right: number;\n let bottom: number;\n let box = ElementExt.boxSizing(this.node); // TODO cache this?\n let rect = this.node.getBoundingClientRect();\n\n // Compute the overlay geometry based on the dock zone.\n switch (zone) {\n case 'root-all':\n top = box.paddingTop;\n left = box.paddingLeft;\n right = box.paddingRight;\n bottom = box.paddingBottom;\n break;\n case 'root-top':\n top = box.paddingTop;\n left = box.paddingLeft;\n right = box.paddingRight;\n bottom = rect.height * Private.GOLDEN_RATIO;\n break;\n case 'root-left':\n top = box.paddingTop;\n left = box.paddingLeft;\n right = rect.width * Private.GOLDEN_RATIO;\n bottom = box.paddingBottom;\n break;\n case 'root-right':\n top = box.paddingTop;\n left = rect.width * Private.GOLDEN_RATIO;\n right = box.paddingRight;\n bottom = box.paddingBottom;\n break;\n case 'root-bottom':\n top = rect.height * Private.GOLDEN_RATIO;\n left = box.paddingLeft;\n right = box.paddingRight;\n bottom = box.paddingBottom;\n break;\n case 'widget-all':\n top = target!.top;\n left = target!.left;\n right = target!.right;\n bottom = target!.bottom;\n break;\n case 'widget-top':\n top = target!.top;\n left = target!.left;\n right = target!.right;\n bottom = target!.bottom + target!.height / 2;\n break;\n case 'widget-left':\n top = target!.top;\n left = target!.left;\n right = target!.right + target!.width / 2;\n bottom = target!.bottom;\n break;\n case 'widget-right':\n top = target!.top;\n left = target!.left + target!.width / 2;\n right = target!.right;\n bottom = target!.bottom;\n break;\n case 'widget-bottom':\n top = target!.top + target!.height / 2;\n left = target!.left;\n right = target!.right;\n bottom = target!.bottom;\n break;\n case 'widget-tab': {\n const tabHeight = target!.tabBar.node.getBoundingClientRect().height;\n top = target!.top;\n left = target!.left;\n right = target!.right;\n bottom = target!.bottom + target!.height - tabHeight;\n break;\n }\n default:\n throw 'unreachable';\n }\n\n // Show the overlay with the computed geometry.\n this.overlay.show({ top, left, right, bottom });\n\n // Finally, return the computed drop zone.\n return zone;\n }\n\n /**\n * Create a new tab bar for use by the panel.\n */\n private _createTabBar(): TabBar {\n // Create the tab bar.\n let tabBar = this._renderer.createTabBar(this._document);\n\n // Set the generated tab bar property for the tab bar.\n Private.isGeneratedTabBarProperty.set(tabBar, true);\n\n // Hide the tab bar when in single document mode.\n if (this._mode === 'single-document') {\n tabBar.hide();\n }\n\n // Enforce necessary tab bar behavior.\n // TODO do we really want to enforce *all* of these?\n tabBar.tabsMovable = this._tabsMovable;\n tabBar.allowDeselect = false;\n tabBar.addButtonEnabled = this._addButtonEnabled;\n tabBar.removeBehavior = 'select-previous-tab';\n tabBar.insertBehavior = 'select-tab-if-needed';\n\n // Connect the signal handlers for the tab bar.\n tabBar.tabMoved.connect(this._onTabMoved, this);\n tabBar.currentChanged.connect(this._onCurrentChanged, this);\n tabBar.tabCloseRequested.connect(this._onTabCloseRequested, this);\n tabBar.tabDetachRequested.connect(this._onTabDetachRequested, this);\n tabBar.tabActivateRequested.connect(this._onTabActivateRequested, this);\n tabBar.addRequested.connect(this._onTabAddRequested, this);\n\n // Return the initialized tab bar.\n return tabBar;\n }\n\n /**\n * Create a new handle for use by the panel.\n */\n private _createHandle(): HTMLDivElement {\n return this._renderer.createHandle();\n }\n\n /**\n * Handle the `tabMoved` signal from a tab bar.\n */\n private _onTabMoved(): void {\n MessageLoop.postMessage(this, Private.LayoutModified);\n }\n\n /**\n * Handle the `currentChanged` signal from a tab bar.\n */\n private _onCurrentChanged(\n sender: TabBar,\n args: TabBar.ICurrentChangedArgs\n ): void {\n // Extract the previous and current title from the args.\n let { previousTitle, currentTitle } = args;\n\n // Hide the previous widget.\n if (previousTitle) {\n previousTitle.owner.hide();\n }\n\n // Show the current widget.\n if (currentTitle) {\n currentTitle.owner.show();\n }\n\n // Flush the message loop on IE and Edge to prevent flicker.\n if (Platform.IS_EDGE || Platform.IS_IE) {\n MessageLoop.flush();\n }\n\n // Schedule an emit of the layout modified signal.\n MessageLoop.postMessage(this, Private.LayoutModified);\n }\n\n /**\n * Handle the `addRequested` signal from a tab bar.\n */\n private _onTabAddRequested(sender: TabBar): void {\n this._addRequested.emit(sender);\n }\n\n /**\n * Handle the `tabActivateRequested` signal from a tab bar.\n */\n private _onTabActivateRequested(\n sender: TabBar,\n args: TabBar.ITabActivateRequestedArgs\n ): void {\n args.title.owner.activate();\n }\n\n /**\n * Handle the `tabCloseRequested` signal from a tab bar.\n */\n private _onTabCloseRequested(\n sender: TabBar,\n args: TabBar.ITabCloseRequestedArgs\n ): void {\n args.title.owner.close();\n }\n\n /**\n * Handle the `tabDetachRequested` signal from a tab bar.\n */\n private _onTabDetachRequested(\n sender: TabBar,\n args: TabBar.ITabDetachRequestedArgs\n ): void {\n // Do nothing if a drag is already in progress.\n if (this._drag) {\n return;\n }\n\n // Release the tab bar's hold on the mouse.\n sender.releaseMouse();\n\n // Extract the data from the args.\n let { title, tab, clientX, clientY, offset } = args;\n\n // Setup the mime data for the drag operation.\n let mimeData = new MimeData();\n let factory = () => title.owner;\n mimeData.setData('application/vnd.lumino.widget-factory', factory);\n\n // Create the drag image for the drag operation.\n let dragImage = tab.cloneNode(true) as HTMLElement;\n if (offset) {\n dragImage.style.top = `-${offset.y}px`;\n dragImage.style.left = `-${offset.x}px`;\n }\n\n // Create the drag object to manage the drag-drop operation.\n this._drag = new Drag({\n document: this._document,\n mimeData,\n dragImage,\n proposedAction: 'move',\n supportedActions: 'move',\n source: this\n });\n\n // Hide the tab node in the original tab.\n tab.classList.add('lm-mod-hidden');\n let cleanup = () => {\n this._drag = null;\n tab.classList.remove('lm-mod-hidden');\n };\n\n // Start the drag operation and cleanup when done.\n this._drag.start(clientX, clientY).then(cleanup);\n }\n\n private _edges: DockPanel.IEdges;\n private _document: Document | ShadowRoot;\n private _mode: DockPanel.Mode;\n private _drag: Drag | null = null;\n private _renderer: DockPanel.IRenderer;\n private _tabsMovable: boolean = true;\n private _tabsConstrained: boolean = false;\n private _addButtonEnabled: boolean = false;\n private _pressData: Private.IPressData | null = null;\n private _layoutModified = new Signal(this);\n\n private _addRequested = new Signal>(this);\n}\n\n/**\n * The namespace for the `DockPanel` class statics.\n */\nexport namespace DockPanel {\n /**\n * An options object for creating a dock panel.\n */\n export interface IOptions {\n /**\n * The document to use with the dock panel.\n *\n * The default is the global `document` instance.\n */\n\n document?: Document | ShadowRoot;\n /**\n * The overlay to use with the dock panel.\n *\n * The default is a new `Overlay` instance.\n */\n overlay?: IOverlay;\n\n /**\n * The renderer to use for the dock panel.\n *\n * The default is a shared renderer instance.\n */\n renderer?: IRenderer;\n\n /**\n * The spacing between the items in the panel.\n *\n * The default is `4`.\n */\n spacing?: number;\n\n /**\n * The mode for the dock panel.\n *\n * The default is `'multiple-document'`.\n */\n mode?: DockPanel.Mode;\n\n /**\n * The sizes of the edge drop zones, in pixels.\n * If not given, default values will be used.\n */\n edges?: IEdges;\n\n /**\n * The method for hiding widgets.\n *\n * The default is `Widget.HiddenMode.Display`.\n */\n hiddenMode?: Widget.HiddenMode;\n\n /**\n * Allow tabs to be draggable / movable by user.\n *\n * The default is `'true'`.\n */\n tabsMovable?: boolean;\n\n /**\n * Constrain tabs to this dock panel\n *\n * The default is `'false'`.\n */\n tabsConstrained?: boolean;\n\n /**\n * Enable add buttons in each of the dock panel's tab bars.\n *\n * The default is `'false'`.\n */\n addButtonEnabled?: boolean;\n }\n\n /**\n * The sizes of the edge drop zones, in pixels.\n */\n export interface IEdges {\n /**\n * The size of the top edge drop zone.\n */\n top: number;\n\n /**\n * The size of the right edge drop zone.\n */\n right: number;\n\n /**\n * The size of the bottom edge drop zone.\n */\n bottom: number;\n\n /**\n * The size of the left edge drop zone.\n */\n left: number;\n }\n\n /**\n * A type alias for the supported dock panel modes.\n */\n export type Mode =\n | /**\n * The single document mode.\n *\n * In this mode, only a single widget is visible at a time, and that\n * widget fills the available layout space. No tab bars are visible.\n */\n 'single-document'\n\n /**\n * The multiple document mode.\n *\n * In this mode, multiple documents are displayed in separate tab\n * areas, and those areas can be individually resized by the user.\n */\n | 'multiple-document';\n\n /**\n * A type alias for a layout configuration object.\n */\n export type ILayoutConfig = DockLayout.ILayoutConfig;\n\n /**\n * A type alias for the supported insertion modes.\n */\n export type InsertMode = DockLayout.InsertMode;\n\n /**\n * A type alias for the add widget options.\n */\n export type IAddOptions = DockLayout.IAddOptions;\n\n /**\n * An object which holds the geometry for overlay positioning.\n */\n export interface IOverlayGeometry {\n /**\n * The distance between the overlay and parent top edges.\n */\n top: number;\n\n /**\n * The distance between the overlay and parent left edges.\n */\n left: number;\n\n /**\n * The distance between the overlay and parent right edges.\n */\n right: number;\n\n /**\n * The distance between the overlay and parent bottom edges.\n */\n bottom: number;\n }\n\n /**\n * An object which manages the overlay node for a dock panel.\n */\n export interface IOverlay {\n /**\n * The DOM node for the overlay.\n */\n readonly node: HTMLDivElement;\n\n /**\n * Show the overlay using the given overlay geometry.\n *\n * @param geo - The desired geometry for the overlay.\n *\n * #### Notes\n * The given geometry values assume the node will use absolute\n * positioning.\n *\n * This is called on every mouse move event during a drag in order\n * to update the position of the overlay. It should be efficient.\n */\n show(geo: IOverlayGeometry): void;\n\n /**\n * Hide the overlay node.\n *\n * @param delay - The delay (in ms) before hiding the overlay.\n * A delay value <= 0 should hide the overlay immediately.\n *\n * #### Notes\n * This is called whenever the overlay node should been hidden.\n */\n hide(delay: number): void;\n }\n\n /**\n * A concrete implementation of `IOverlay`.\n *\n * This is the default overlay implementation for a dock panel.\n */\n export class Overlay implements IOverlay {\n /**\n * Construct a new overlay.\n */\n constructor() {\n this.node = document.createElement('div');\n this.node.classList.add('lm-DockPanel-overlay');\n this.node.classList.add('lm-mod-hidden');\n this.node.style.position = 'absolute';\n this.node.style.contain = 'strict';\n }\n\n /**\n * The DOM node for the overlay.\n */\n readonly node: HTMLDivElement;\n\n /**\n * Show the overlay using the given overlay geometry.\n *\n * @param geo - The desired geometry for the overlay.\n */\n show(geo: IOverlayGeometry): void {\n // Update the position of the overlay.\n let style = this.node.style;\n style.top = `${geo.top}px`;\n style.left = `${geo.left}px`;\n style.right = `${geo.right}px`;\n style.bottom = `${geo.bottom}px`;\n\n // Clear any pending hide timer.\n clearTimeout(this._timer);\n this._timer = -1;\n\n // If the overlay is already visible, we're done.\n if (!this._hidden) {\n return;\n }\n\n // Clear the hidden flag.\n this._hidden = false;\n\n // Finally, show the overlay.\n this.node.classList.remove('lm-mod-hidden');\n }\n\n /**\n * Hide the overlay node.\n *\n * @param delay - The delay (in ms) before hiding the overlay.\n * A delay value <= 0 will hide the overlay immediately.\n */\n hide(delay: number): void {\n // Do nothing if the overlay is already hidden.\n if (this._hidden) {\n return;\n }\n\n // Hide immediately if the delay is <= 0.\n if (delay <= 0) {\n clearTimeout(this._timer);\n this._timer = -1;\n this._hidden = true;\n this.node.classList.add('lm-mod-hidden');\n return;\n }\n\n // Do nothing if a hide is already pending.\n if (this._timer !== -1) {\n return;\n }\n\n // Otherwise setup the hide timer.\n this._timer = window.setTimeout(() => {\n this._timer = -1;\n this._hidden = true;\n this.node.classList.add('lm-mod-hidden');\n }, delay);\n }\n\n private _timer = -1;\n private _hidden = true;\n }\n\n /**\n * A type alias for a dock panel renderer;\n */\n export type IRenderer = DockLayout.IRenderer;\n\n /**\n * The default implementation of `IRenderer`.\n */\n export class Renderer implements IRenderer {\n /**\n * Create a new tab bar for use with a dock panel.\n *\n * @returns A new tab bar for a dock panel.\n */\n createTabBar(document?: Document | ShadowRoot): TabBar {\n let bar = new TabBar({ document });\n bar.addClass('lm-DockPanel-tabBar');\n return bar;\n }\n\n /**\n * Create a new handle node for use with a dock panel.\n *\n * @returns A new handle node for a dock panel.\n */\n createHandle(): HTMLDivElement {\n let handle = document.createElement('div');\n handle.className = 'lm-DockPanel-handle';\n return handle;\n }\n }\n\n /**\n * The default `Renderer` instance.\n */\n export const defaultRenderer = new Renderer();\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * A fraction used for sizing root panels; ~= `1 / golden_ratio`.\n */\n export const GOLDEN_RATIO = 0.618;\n\n /**\n * The default sizes for the edge drop zones, in pixels.\n */\n export const DEFAULT_EDGES = {\n /**\n * The size of the top edge dock zone for the root panel, in pixels.\n * This is different from the others to distinguish between the top\n * tab bar and the top root zone.\n */\n top: 12,\n\n /**\n * The size of the edge dock zone for the root panel, in pixels.\n */\n right: 40,\n\n /**\n * The size of the edge dock zone for the root panel, in pixels.\n */\n bottom: 40,\n\n /**\n * The size of the edge dock zone for the root panel, in pixels.\n */\n left: 40\n };\n\n /**\n * A singleton `'layout-modified'` conflatable message.\n */\n export const LayoutModified = new ConflatableMessage('layout-modified');\n\n /**\n * An object which holds mouse press data.\n */\n export interface IPressData {\n /**\n * The handle which was pressed.\n */\n handle: HTMLDivElement;\n\n /**\n * The X offset of the press in handle coordinates.\n */\n deltaX: number;\n\n /**\n * The Y offset of the press in handle coordinates.\n */\n deltaY: number;\n\n /**\n * The disposable which will clear the override cursor.\n */\n override: IDisposable;\n }\n\n /**\n * A type alias for a drop zone.\n */\n export type DropZone =\n | /**\n * An invalid drop zone.\n */\n 'invalid'\n\n /**\n * The entirety of the root dock area.\n */\n | 'root-all'\n\n /**\n * The top portion of the root dock area.\n */\n | 'root-top'\n\n /**\n * The left portion of the root dock area.\n */\n | 'root-left'\n\n /**\n * The right portion of the root dock area.\n */\n | 'root-right'\n\n /**\n * The bottom portion of the root dock area.\n */\n | 'root-bottom'\n\n /**\n * The entirety of a tabbed widget area.\n */\n | 'widget-all'\n\n /**\n * The top portion of tabbed widget area.\n */\n | 'widget-top'\n\n /**\n * The left portion of tabbed widget area.\n */\n | 'widget-left'\n\n /**\n * The right portion of tabbed widget area.\n */\n | 'widget-right'\n\n /**\n * The bottom portion of tabbed widget area.\n */\n | 'widget-bottom'\n\n /**\n * The the bar of a tabbed widget area.\n */\n | 'widget-tab';\n\n /**\n * An object which holds the drop target zone and widget.\n */\n export interface IDropTarget {\n /**\n * The semantic zone for the mouse position.\n */\n zone: DropZone;\n\n /**\n * The tab area geometry for the drop zone, or `null`.\n */\n target: DockLayout.ITabAreaGeometry | null;\n }\n\n /**\n * An attached property used to track generated tab bars.\n */\n export const isGeneratedTabBarProperty = new AttachedProperty<\n Widget,\n boolean\n >({\n name: 'isGeneratedTabBar',\n create: () => false\n });\n\n /**\n * Create a single document config for the widgets in a dock panel.\n */\n export function createSingleDocumentConfig(\n panel: DockPanel\n ): DockPanel.ILayoutConfig {\n // Return an empty config if the panel is empty.\n if (panel.isEmpty) {\n return { main: null };\n }\n\n // Get a flat array of the widgets in the panel.\n let widgets = Array.from(panel.widgets());\n\n // Get the first selected widget in the panel.\n let selected = panel.selectedWidgets().next().value;\n\n // Compute the current index for the new config.\n let currentIndex = selected ? widgets.indexOf(selected) : -1;\n\n // Return the single document config.\n return { main: { type: 'tab-area', widgets, currentIndex } };\n }\n\n /**\n * Find the drop target at the given client position.\n */\n export function findDropTarget(\n panel: DockPanel,\n clientX: number,\n clientY: number,\n edges: DockPanel.IEdges\n ): IDropTarget {\n // Bail if the mouse is not over the dock panel.\n if (!ElementExt.hitTest(panel.node, clientX, clientY)) {\n return { zone: 'invalid', target: null };\n }\n\n // Look up the layout for the panel.\n let layout = panel.layout as DockLayout;\n\n // If the layout is empty, indicate the entire root drop zone.\n if (layout.isEmpty) {\n return { zone: 'root-all', target: null };\n }\n\n // Test the edge zones when in multiple document mode.\n if (panel.mode === 'multiple-document') {\n // Get the client rect for the dock panel.\n let panelRect = panel.node.getBoundingClientRect();\n\n // Compute the distance to each edge of the panel.\n let pl = clientX - panelRect.left + 1;\n let pt = clientY - panelRect.top + 1;\n let pr = panelRect.right - clientX;\n let pb = panelRect.bottom - clientY;\n\n // Find the minimum distance to an edge.\n let pd = Math.min(pt, pr, pb, pl);\n\n // Return a root zone if the mouse is within an edge.\n switch (pd) {\n case pt:\n if (pt < edges.top) {\n return { zone: 'root-top', target: null };\n }\n break;\n case pr:\n if (pr < edges.right) {\n return { zone: 'root-right', target: null };\n }\n break;\n case pb:\n if (pb < edges.bottom) {\n return { zone: 'root-bottom', target: null };\n }\n break;\n case pl:\n if (pl < edges.left) {\n return { zone: 'root-left', target: null };\n }\n break;\n default:\n throw 'unreachable';\n }\n }\n\n // Hit test the dock layout at the given client position.\n let target = layout.hitTestTabAreas(clientX, clientY);\n\n // Bail if no target area was found.\n if (!target) {\n return { zone: 'invalid', target: null };\n }\n\n // Return the whole tab area when in single document mode.\n if (panel.mode === 'single-document') {\n return { zone: 'widget-all', target };\n }\n\n // Compute the distance to each edge of the tab area.\n let al = target.x - target.left + 1;\n let at = target.y - target.top + 1;\n let ar = target.left + target.width - target.x;\n let ab = target.top + target.height - target.y;\n\n const tabHeight = target.tabBar.node.getBoundingClientRect().height;\n if (at < tabHeight) {\n return { zone: 'widget-tab', target };\n }\n\n // Get the X and Y edge sizes for the area.\n let rx = Math.round(target.width / 3);\n let ry = Math.round(target.height / 3);\n\n // If the mouse is not within an edge, indicate the entire area.\n if (al > rx && ar > rx && at > ry && ab > ry) {\n return { zone: 'widget-all', target };\n }\n\n // Scale the distances by the slenderness ratio.\n al /= rx;\n at /= ry;\n ar /= rx;\n ab /= ry;\n\n // Find the minimum distance to the area edge.\n let ad = Math.min(al, at, ar, ab);\n\n // Find the widget zone for the area edge.\n let zone: DropZone;\n switch (ad) {\n case al:\n zone = 'widget-left';\n break;\n case at:\n zone = 'widget-top';\n break;\n case ar:\n zone = 'widget-right';\n break;\n case ab:\n zone = 'widget-bottom';\n break;\n default:\n throw 'unreachable';\n }\n\n // Return the final drop target.\n return { zone, target };\n }\n\n /**\n * Get the drop reference widget for a tab bar.\n */\n export function getDropRef(tabBar: TabBar): Widget | null {\n if (tabBar.titles.length === 0) {\n return null;\n }\n if (tabBar.currentTitle) {\n return tabBar.currentTitle.owner;\n }\n return tabBar.titles[tabBar.titles.length - 1].owner;\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt, find, max } from '@lumino/algorithm';\n\nimport { IDisposable } from '@lumino/disposable';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { Widget } from './widget';\n\n/**\n * A class which tracks focus among a set of widgets.\n *\n * This class is useful when code needs to keep track of the most\n * recently focused widget(s) among a set of related widgets.\n */\nexport class FocusTracker implements IDisposable {\n /**\n * Dispose of the resources held by the tracker.\n */\n dispose(): void {\n // Do nothing if the tracker is already disposed.\n if (this._counter < 0) {\n return;\n }\n\n // Mark the tracker as disposed.\n this._counter = -1;\n\n // Clear the connections for the tracker.\n Signal.clearData(this);\n\n // Remove all event listeners.\n for (const widget of this._widgets) {\n widget.node.removeEventListener('focus', this, true);\n widget.node.removeEventListener('blur', this, true);\n }\n\n // Clear the internal data structures.\n this._activeWidget = null;\n this._currentWidget = null;\n this._nodes.clear();\n this._numbers.clear();\n this._widgets.length = 0;\n }\n\n /**\n * A signal emitted when the current widget has changed.\n */\n get currentChanged(): ISignal> {\n return this._currentChanged;\n }\n\n /**\n * A signal emitted when the active widget has changed.\n */\n get activeChanged(): ISignal> {\n return this._activeChanged;\n }\n\n /**\n * A flag indicating whether the tracker is disposed.\n */\n get isDisposed(): boolean {\n return this._counter < 0;\n }\n\n /**\n * The current widget in the tracker.\n *\n * #### Notes\n * The current widget is the widget among the tracked widgets which\n * has the *descendant node* which has most recently been focused.\n *\n * The current widget will not be updated if the node loses focus. It\n * will only be updated when a different tracked widget gains focus.\n *\n * If the current widget is removed from the tracker, the previous\n * current widget will be restored.\n *\n * This behavior is intended to follow a user's conceptual model of\n * a semantically \"current\" widget, where the \"last thing of type X\"\n * to be interacted with is the \"current instance of X\", regardless\n * of whether that instance still has focus.\n */\n get currentWidget(): T | null {\n return this._currentWidget;\n }\n\n /**\n * The active widget in the tracker.\n *\n * #### Notes\n * The active widget is the widget among the tracked widgets which\n * has the *descendant node* which is currently focused.\n */\n get activeWidget(): T | null {\n return this._activeWidget;\n }\n\n /**\n * A read only array of the widgets being tracked.\n */\n get widgets(): ReadonlyArray {\n return this._widgets;\n }\n\n /**\n * Get the focus number for a particular widget in the tracker.\n *\n * @param widget - The widget of interest.\n *\n * @returns The focus number for the given widget, or `-1` if the\n * widget has not had focus since being added to the tracker, or\n * is not contained by the tracker.\n *\n * #### Notes\n * The focus number indicates the relative order in which the widgets\n * have gained focus. A widget with a larger number has gained focus\n * more recently than a widget with a smaller number.\n *\n * The `currentWidget` will always have the largest focus number.\n *\n * All widgets start with a focus number of `-1`, which indicates that\n * the widget has not been focused since being added to the tracker.\n */\n focusNumber(widget: T): number {\n let n = this._numbers.get(widget);\n return n === undefined ? -1 : n;\n }\n\n /**\n * Test whether the focus tracker contains a given widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns `true` if the widget is tracked, `false` otherwise.\n */\n has(widget: T): boolean {\n return this._numbers.has(widget);\n }\n\n /**\n * Add a widget to the focus tracker.\n *\n * @param widget - The widget of interest.\n *\n * #### Notes\n * A widget will be automatically removed from the tracker if it\n * is disposed after being added.\n *\n * If the widget is already tracked, this is a no-op.\n */\n add(widget: T): void {\n // Do nothing if the widget is already tracked.\n if (this._numbers.has(widget)) {\n return;\n }\n\n // Test whether the widget has focus.\n let focused = widget.node.contains(document.activeElement);\n\n // Set up the initial focus number.\n let n = focused ? this._counter++ : -1;\n\n // Add the widget to the internal data structures.\n this._widgets.push(widget);\n this._numbers.set(widget, n);\n this._nodes.set(widget.node, widget);\n\n // Set up the event listeners. The capturing phase must be used\n // since the 'focus' and 'blur' events don't bubble and Firefox\n // doesn't support the 'focusin' or 'focusout' events.\n widget.node.addEventListener('focus', this, true);\n widget.node.addEventListener('blur', this, true);\n\n // Connect the disposed signal handler.\n widget.disposed.connect(this._onWidgetDisposed, this);\n\n // Set the current and active widgets if needed.\n if (focused) {\n this._setWidgets(widget, widget);\n }\n }\n\n /**\n * Remove a widget from the focus tracker.\n *\n * #### Notes\n * If the widget is the `currentWidget`, the previous current widget\n * will become the new `currentWidget`.\n *\n * A widget will be automatically removed from the tracker if it\n * is disposed after being added.\n *\n * If the widget is not tracked, this is a no-op.\n */\n remove(widget: T): void {\n // Bail early if the widget is not tracked.\n if (!this._numbers.has(widget)) {\n return;\n }\n\n // Disconnect the disposed signal handler.\n widget.disposed.disconnect(this._onWidgetDisposed, this);\n\n // Remove the event listeners.\n widget.node.removeEventListener('focus', this, true);\n widget.node.removeEventListener('blur', this, true);\n\n // Remove the widget from the internal data structures.\n ArrayExt.removeFirstOf(this._widgets, widget);\n this._nodes.delete(widget.node);\n this._numbers.delete(widget);\n\n // Bail early if the widget is not the current widget.\n if (this._currentWidget !== widget) {\n return;\n }\n\n // Filter the widgets for those which have had focus.\n let valid = this._widgets.filter(w => this._numbers.get(w) !== -1);\n\n // Get the valid widget with the max focus number.\n let previous =\n max(valid, (first, second) => {\n let a = this._numbers.get(first)!;\n let b = this._numbers.get(second)!;\n return a - b;\n }) || null;\n\n // Set the current and active widgets.\n this._setWidgets(previous, null);\n }\n\n /**\n * Handle the DOM events for the focus tracker.\n *\n * @param event - The DOM event sent to the panel.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the tracked nodes. It should\n * not be called directly by user code.\n */\n handleEvent(event: Event): void {\n switch (event.type) {\n case 'focus':\n this._evtFocus(event as FocusEvent);\n break;\n case 'blur':\n this._evtBlur(event as FocusEvent);\n break;\n }\n }\n\n /**\n * Set the current and active widgets for the tracker.\n */\n private _setWidgets(current: T | null, active: T | null): void {\n // Swap the current widget.\n let oldCurrent = this._currentWidget;\n this._currentWidget = current;\n\n // Swap the active widget.\n let oldActive = this._activeWidget;\n this._activeWidget = active;\n\n // Emit the `currentChanged` signal if needed.\n if (oldCurrent !== current) {\n this._currentChanged.emit({ oldValue: oldCurrent, newValue: current });\n }\n\n // Emit the `activeChanged` signal if needed.\n if (oldActive !== active) {\n this._activeChanged.emit({ oldValue: oldActive, newValue: active });\n }\n }\n\n /**\n * Handle the `'focus'` event for a tracked widget.\n */\n private _evtFocus(event: FocusEvent): void {\n // Find the widget which gained focus, which is known to exist.\n let widget = this._nodes.get(event.currentTarget as HTMLElement)!;\n\n // Update the focus number if necessary.\n if (widget !== this._currentWidget) {\n this._numbers.set(widget, this._counter++);\n }\n\n // Set the current and active widgets.\n this._setWidgets(widget, widget);\n }\n\n /**\n * Handle the `'blur'` event for a tracked widget.\n */\n private _evtBlur(event: FocusEvent): void {\n // Find the widget which lost focus, which is known to exist.\n let widget = this._nodes.get(event.currentTarget as HTMLElement)!;\n\n // Get the node which being focused after this blur.\n let focusTarget = event.relatedTarget as HTMLElement;\n\n // If no other node is being focused, clear the active widget.\n if (!focusTarget) {\n this._setWidgets(this._currentWidget, null);\n return;\n }\n\n // Bail if the focus widget is not changing.\n if (widget.node.contains(focusTarget)) {\n return;\n }\n\n // If no tracked widget is being focused, clear the active widget.\n if (!find(this._widgets, w => w.node.contains(focusTarget))) {\n this._setWidgets(this._currentWidget, null);\n return;\n }\n }\n\n /**\n * Handle the `disposed` signal for a tracked widget.\n */\n private _onWidgetDisposed(sender: T): void {\n this.remove(sender);\n }\n\n private _counter = 0;\n private _widgets: T[] = [];\n private _activeWidget: T | null = null;\n private _currentWidget: T | null = null;\n private _numbers = new Map();\n private _nodes = new Map();\n private _activeChanged = new Signal>(this);\n private _currentChanged = new Signal>(\n this\n );\n}\n\n/**\n * The namespace for the `FocusTracker` class statics.\n */\nexport namespace FocusTracker {\n /**\n * An arguments object for the changed signals.\n */\n export interface IChangedArgs {\n /**\n * The old value for the widget.\n */\n oldValue: T | null;\n\n /**\n * The new value for the widget.\n */\n newValue: T | null;\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { AttachedProperty } from '@lumino/properties';\n\nimport { BoxEngine, BoxSizer } from './boxengine';\n\nimport { Layout, LayoutItem } from './layout';\n\nimport { Widget } from './widget';\n\n/**\n * A layout which arranges its widgets in a grid.\n */\nexport class GridLayout extends Layout {\n /**\n * Construct a new grid layout.\n *\n * @param options - The options for initializing the layout.\n */\n constructor(options: GridLayout.IOptions = {}) {\n super(options);\n if (options.rowCount !== undefined) {\n Private.reallocSizers(this._rowSizers, options.rowCount);\n }\n if (options.columnCount !== undefined) {\n Private.reallocSizers(this._columnSizers, options.columnCount);\n }\n if (options.rowSpacing !== undefined) {\n this._rowSpacing = Private.clampValue(options.rowSpacing);\n }\n if (options.columnSpacing !== undefined) {\n this._columnSpacing = Private.clampValue(options.columnSpacing);\n }\n }\n\n /**\n * Dispose of the resources held by the layout.\n */\n dispose(): void {\n // Dispose of the widgets and layout items.\n for (const item of this._items) {\n let widget = item.widget;\n item.dispose();\n widget.dispose();\n }\n\n // Clear the layout state.\n this._box = null;\n this._items.length = 0;\n this._rowStarts.length = 0;\n this._rowSizers.length = 0;\n this._columnStarts.length = 0;\n this._columnSizers.length = 0;\n\n // Dispose of the rest of the layout.\n super.dispose();\n }\n\n /**\n * Get the number of rows in the layout.\n */\n get rowCount(): number {\n return this._rowSizers.length;\n }\n\n /**\n * Set the number of rows in the layout.\n *\n * #### Notes\n * The minimum row count is `1`.\n */\n set rowCount(value: number) {\n // Do nothing if the row count does not change.\n if (value === this.rowCount) {\n return;\n }\n\n // Reallocate the row sizers.\n Private.reallocSizers(this._rowSizers, value);\n\n // Schedule a fit of the parent.\n if (this.parent) {\n this.parent.fit();\n }\n }\n\n /**\n * Get the number of columns in the layout.\n */\n get columnCount(): number {\n return this._columnSizers.length;\n }\n\n /**\n * Set the number of columns in the layout.\n *\n * #### Notes\n * The minimum column count is `1`.\n */\n set columnCount(value: number) {\n // Do nothing if the column count does not change.\n if (value === this.columnCount) {\n return;\n }\n\n // Reallocate the column sizers.\n Private.reallocSizers(this._columnSizers, value);\n\n // Schedule a fit of the parent.\n if (this.parent) {\n this.parent.fit();\n }\n }\n\n /**\n * Get the row spacing for the layout.\n */\n get rowSpacing(): number {\n return this._rowSpacing;\n }\n\n /**\n * Set the row spacing for the layout.\n */\n set rowSpacing(value: number) {\n // Clamp the spacing to the allowed range.\n value = Private.clampValue(value);\n\n // Bail if the spacing does not change\n if (this._rowSpacing === value) {\n return;\n }\n\n // Update the internal spacing.\n this._rowSpacing = value;\n\n // Schedule a fit of the parent.\n if (this.parent) {\n this.parent.fit();\n }\n }\n\n /**\n * Get the column spacing for the layout.\n */\n get columnSpacing(): number {\n return this._columnSpacing;\n }\n\n /**\n * Set the col spacing for the layout.\n */\n set columnSpacing(value: number) {\n // Clamp the spacing to the allowed range.\n value = Private.clampValue(value);\n\n // Bail if the spacing does not change\n if (this._columnSpacing === value) {\n return;\n }\n\n // Update the internal spacing.\n this._columnSpacing = value;\n\n // Schedule a fit of the parent.\n if (this.parent) {\n this.parent.fit();\n }\n }\n\n /**\n * Get the stretch factor for a specific row.\n *\n * @param index - The row index of interest.\n *\n * @returns The stretch factor for the row.\n *\n * #### Notes\n * This returns `-1` if the index is out of range.\n */\n rowStretch(index: number): number {\n let sizer = this._rowSizers[index];\n return sizer ? sizer.stretch : -1;\n }\n\n /**\n * Set the stretch factor for a specific row.\n *\n * @param index - The row index of interest.\n *\n * @param value - The stretch factor for the row.\n *\n * #### Notes\n * This is a no-op if the index is out of range.\n */\n setRowStretch(index: number, value: number): void {\n // Look up the row sizer.\n let sizer = this._rowSizers[index];\n\n // Bail if the index is out of range.\n if (!sizer) {\n return;\n }\n\n // Clamp the value to the allowed range.\n value = Private.clampValue(value);\n\n // Bail if the stretch does not change.\n if (sizer.stretch === value) {\n return;\n }\n\n // Update the sizer stretch.\n sizer.stretch = value;\n\n // Schedule an update of the parent.\n if (this.parent) {\n this.parent.update();\n }\n }\n\n /**\n * Get the stretch factor for a specific column.\n *\n * @param index - The column index of interest.\n *\n * @returns The stretch factor for the column.\n *\n * #### Notes\n * This returns `-1` if the index is out of range.\n */\n columnStretch(index: number): number {\n let sizer = this._columnSizers[index];\n return sizer ? sizer.stretch : -1;\n }\n\n /**\n * Set the stretch factor for a specific column.\n *\n * @param index - The column index of interest.\n *\n * @param value - The stretch factor for the column.\n *\n * #### Notes\n * This is a no-op if the index is out of range.\n */\n setColumnStretch(index: number, value: number): void {\n // Look up the column sizer.\n let sizer = this._columnSizers[index];\n\n // Bail if the index is out of range.\n if (!sizer) {\n return;\n }\n\n // Clamp the value to the allowed range.\n value = Private.clampValue(value);\n\n // Bail if the stretch does not change.\n if (sizer.stretch === value) {\n return;\n }\n\n // Update the sizer stretch.\n sizer.stretch = value;\n\n // Schedule an update of the parent.\n if (this.parent) {\n this.parent.update();\n }\n }\n\n /**\n * Create an iterator over the widgets in the layout.\n *\n * @returns A new iterator over the widgets in the layout.\n */\n *[Symbol.iterator](): IterableIterator {\n for (const item of this._items) {\n yield item.widget;\n }\n }\n\n /**\n * Add a widget to the grid layout.\n *\n * @param widget - The widget to add to the layout.\n *\n * #### Notes\n * If the widget is already contained in the layout, this is no-op.\n */\n addWidget(widget: Widget): void {\n // Look up the index for the widget.\n let i = ArrayExt.findFirstIndex(this._items, it => it.widget === widget);\n\n // Bail if the widget is already in the layout.\n if (i !== -1) {\n return;\n }\n\n // Add the widget to the layout.\n this._items.push(new LayoutItem(widget));\n\n // Attach the widget to the parent.\n if (this.parent) {\n this.attachWidget(widget);\n }\n }\n\n /**\n * Remove a widget from the grid layout.\n *\n * @param widget - The widget to remove from the layout.\n *\n * #### Notes\n * A widget is automatically removed from the layout when its `parent`\n * is set to `null`. This method should only be invoked directly when\n * removing a widget from a layout which has yet to be installed on a\n * parent widget.\n *\n * This method does *not* modify the widget's `parent`.\n */\n removeWidget(widget: Widget): void {\n // Look up the index for the widget.\n let i = ArrayExt.findFirstIndex(this._items, it => it.widget === widget);\n\n // Bail if the widget is not in the layout.\n if (i === -1) {\n return;\n }\n\n // Remove the widget from the layout.\n let item = ArrayExt.removeAt(this._items, i)!;\n\n // Detach the widget from the parent.\n if (this.parent) {\n this.detachWidget(widget);\n }\n\n // Dispose the layout item.\n item.dispose();\n }\n\n /**\n * Perform layout initialization which requires the parent widget.\n */\n protected init(): void {\n super.init();\n for (const widget of this) {\n this.attachWidget(widget);\n }\n }\n\n /**\n * Attach a widget to the parent's DOM node.\n *\n * @param widget - The widget to attach to the parent.\n */\n protected attachWidget(widget: Widget): void {\n // Send a `'before-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n }\n\n // Add the widget's node to the parent.\n this.parent!.node.appendChild(widget.node);\n\n // Send an `'after-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n\n // Post a fit request for the parent widget.\n this.parent!.fit();\n }\n\n /**\n * Detach a widget from the parent's DOM node.\n *\n * @param widget - The widget to detach from the parent.\n */\n protected detachWidget(widget: Widget): void {\n // Send a `'before-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n }\n\n // Remove the widget's node from the parent.\n this.parent!.node.removeChild(widget.node);\n\n // Send an `'after-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n\n // Post a fit request for the parent widget.\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'before-show'` message.\n */\n protected onBeforeShow(msg: Message): void {\n super.onBeforeShow(msg);\n this.parent!.update();\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n super.onBeforeAttach(msg);\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-shown'` message.\n */\n protected onChildShown(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-hidden'` message.\n */\n protected onChildHidden(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'resize'` message.\n */\n protected onResize(msg: Widget.ResizeMessage): void {\n if (this.parent!.isVisible) {\n this._update(msg.width, msg.height);\n }\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n protected onUpdateRequest(msg: Message): void {\n if (this.parent!.isVisible) {\n this._update(-1, -1);\n }\n }\n\n /**\n * A message handler invoked on a `'fit-request'` message.\n */\n protected onFitRequest(msg: Message): void {\n if (this.parent!.isAttached) {\n this._fit();\n }\n }\n\n /**\n * Fit the layout to the total size required by the widgets.\n */\n private _fit(): void {\n // Reset the min sizes of the sizers.\n for (let i = 0, n = this.rowCount; i < n; ++i) {\n this._rowSizers[i].minSize = 0;\n }\n for (let i = 0, n = this.columnCount; i < n; ++i) {\n this._columnSizers[i].minSize = 0;\n }\n\n // Filter for the visible layout items.\n let items = this._items.filter(it => !it.isHidden);\n\n // Fit the layout items.\n for (let i = 0, n = items.length; i < n; ++i) {\n items[i].fit();\n }\n\n // Get the max row and column index.\n let maxRow = this.rowCount - 1;\n let maxCol = this.columnCount - 1;\n\n // Sort the items by row span.\n items.sort(Private.rowSpanCmp);\n\n // Update the min sizes of the row sizers.\n for (let i = 0, n = items.length; i < n; ++i) {\n // Fetch the item.\n let item = items[i];\n\n // Get the row bounds for the item.\n let config = GridLayout.getCellConfig(item.widget);\n let r1 = Math.min(config.row, maxRow);\n let r2 = Math.min(config.row + config.rowSpan - 1, maxRow);\n\n // Distribute the minimum height to the sizers as needed.\n Private.distributeMin(this._rowSizers, r1, r2, item.minHeight);\n }\n\n // Sort the items by column span.\n items.sort(Private.columnSpanCmp);\n\n // Update the min sizes of the column sizers.\n for (let i = 0, n = items.length; i < n; ++i) {\n // Fetch the item.\n let item = items[i];\n\n // Get the column bounds for the item.\n let config = GridLayout.getCellConfig(item.widget);\n let c1 = Math.min(config.column, maxCol);\n let c2 = Math.min(config.column + config.columnSpan - 1, maxCol);\n\n // Distribute the minimum width to the sizers as needed.\n Private.distributeMin(this._columnSizers, c1, c2, item.minWidth);\n }\n\n // If no size constraint is needed, just update the parent.\n if (this.fitPolicy === 'set-no-constraint') {\n MessageLoop.sendMessage(this.parent!, Widget.Msg.UpdateRequest);\n return;\n }\n\n // Set up the computed min size.\n let minH = maxRow * this._rowSpacing;\n let minW = maxCol * this._columnSpacing;\n\n // Add the sizer minimums to the computed min size.\n for (let i = 0, n = this.rowCount; i < n; ++i) {\n minH += this._rowSizers[i].minSize;\n }\n for (let i = 0, n = this.columnCount; i < n; ++i) {\n minW += this._columnSizers[i].minSize;\n }\n\n // Update the box sizing and add it to the computed min size.\n let box = (this._box = ElementExt.boxSizing(this.parent!.node));\n minW += box.horizontalSum;\n minH += box.verticalSum;\n\n // Update the parent's min size constraints.\n let style = this.parent!.node.style;\n style.minWidth = `${minW}px`;\n style.minHeight = `${minH}px`;\n\n // Set the dirty flag to ensure only a single update occurs.\n this._dirty = true;\n\n // Notify the ancestor that it should fit immediately. This may\n // cause a resize of the parent, fulfilling the required update.\n if (this.parent!.parent) {\n MessageLoop.sendMessage(this.parent!.parent!, Widget.Msg.FitRequest);\n }\n\n // If the dirty flag is still set, the parent was not resized.\n // Trigger the required update on the parent widget immediately.\n if (this._dirty) {\n MessageLoop.sendMessage(this.parent!, Widget.Msg.UpdateRequest);\n }\n }\n\n /**\n * Update the layout position and size of the widgets.\n *\n * The parent offset dimensions should be `-1` if unknown.\n */\n private _update(offsetWidth: number, offsetHeight: number): void {\n // Clear the dirty flag to indicate the update occurred.\n this._dirty = false;\n\n // Measure the parent if the offset dimensions are unknown.\n if (offsetWidth < 0) {\n offsetWidth = this.parent!.node.offsetWidth;\n }\n if (offsetHeight < 0) {\n offsetHeight = this.parent!.node.offsetHeight;\n }\n\n // Ensure the parent box sizing data is computed.\n if (!this._box) {\n this._box = ElementExt.boxSizing(this.parent!.node);\n }\n\n // Compute the layout area adjusted for border and padding.\n let top = this._box.paddingTop;\n let left = this._box.paddingLeft;\n let width = offsetWidth - this._box.horizontalSum;\n let height = offsetHeight - this._box.verticalSum;\n\n // Get the max row and column index.\n let maxRow = this.rowCount - 1;\n let maxCol = this.columnCount - 1;\n\n // Compute the total fixed row and column space.\n let fixedRowSpace = maxRow * this._rowSpacing;\n let fixedColSpace = maxCol * this._columnSpacing;\n\n // Distribute the available space to the box sizers.\n BoxEngine.calc(this._rowSizers, Math.max(0, height - fixedRowSpace));\n BoxEngine.calc(this._columnSizers, Math.max(0, width - fixedColSpace));\n\n // Update the row start positions.\n for (let i = 0, pos = top, n = this.rowCount; i < n; ++i) {\n this._rowStarts[i] = pos;\n pos += this._rowSizers[i].size + this._rowSpacing;\n }\n\n // Update the column start positions.\n for (let i = 0, pos = left, n = this.columnCount; i < n; ++i) {\n this._columnStarts[i] = pos;\n pos += this._columnSizers[i].size + this._columnSpacing;\n }\n\n // Update the geometry of the layout items.\n for (let i = 0, n = this._items.length; i < n; ++i) {\n // Fetch the item.\n let item = this._items[i];\n\n // Ignore hidden items.\n if (item.isHidden) {\n continue;\n }\n\n // Fetch the cell bounds for the widget.\n let config = GridLayout.getCellConfig(item.widget);\n let r1 = Math.min(config.row, maxRow);\n let c1 = Math.min(config.column, maxCol);\n let r2 = Math.min(config.row + config.rowSpan - 1, maxRow);\n let c2 = Math.min(config.column + config.columnSpan - 1, maxCol);\n\n // Compute the cell geometry.\n let x = this._columnStarts[c1];\n let y = this._rowStarts[r1];\n let w = this._columnStarts[c2] + this._columnSizers[c2].size - x;\n let h = this._rowStarts[r2] + this._rowSizers[r2].size - y;\n\n // Update the geometry of the layout item.\n item.update(x, y, w, h);\n }\n }\n\n private _dirty = false;\n private _rowSpacing = 4;\n private _columnSpacing = 4;\n private _items: LayoutItem[] = [];\n private _rowStarts: number[] = [];\n private _columnStarts: number[] = [];\n private _rowSizers: BoxSizer[] = [new BoxSizer()];\n private _columnSizers: BoxSizer[] = [new BoxSizer()];\n private _box: ElementExt.IBoxSizing | null = null;\n}\n\n/**\n * The namespace for the `GridLayout` class statics.\n */\nexport namespace GridLayout {\n /**\n * An options object for initializing a grid layout.\n */\n export interface IOptions extends Layout.IOptions {\n /**\n * The initial row count for the layout.\n *\n * The default is `1`.\n */\n rowCount?: number;\n\n /**\n * The initial column count for the layout.\n *\n * The default is `1`.\n */\n columnCount?: number;\n\n /**\n * The spacing between rows in the layout.\n *\n * The default is `4`.\n */\n rowSpacing?: number;\n\n /**\n * The spacing between columns in the layout.\n *\n * The default is `4`.\n */\n columnSpacing?: number;\n }\n\n /**\n * An object which holds the cell configuration for a widget.\n */\n export interface ICellConfig {\n /**\n * The row index for the widget.\n */\n readonly row: number;\n\n /**\n * The column index for the widget.\n */\n readonly column: number;\n\n /**\n * The row span for the widget.\n */\n readonly rowSpan: number;\n\n /**\n * The column span for the widget.\n */\n readonly columnSpan: number;\n }\n\n /**\n * Get the cell config for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The cell config for the widget.\n */\n export function getCellConfig(widget: Widget): ICellConfig {\n return Private.cellConfigProperty.get(widget);\n }\n\n /**\n * Set the cell config for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the cell config.\n */\n export function setCellConfig(\n widget: Widget,\n value: Partial\n ): void {\n Private.cellConfigProperty.set(widget, Private.normalizeConfig(value));\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * The property descriptor for the widget cell config.\n */\n export const cellConfigProperty = new AttachedProperty<\n Widget,\n GridLayout.ICellConfig\n >({\n name: 'cellConfig',\n create: () => ({ row: 0, column: 0, rowSpan: 1, columnSpan: 1 }),\n changed: onChildCellConfigChanged\n });\n\n /**\n * Normalize a partial cell config object.\n */\n export function normalizeConfig(\n config: Partial\n ): GridLayout.ICellConfig {\n let row = Math.max(0, Math.floor(config.row || 0));\n let column = Math.max(0, Math.floor(config.column || 0));\n let rowSpan = Math.max(1, Math.floor(config.rowSpan || 0));\n let columnSpan = Math.max(1, Math.floor(config.columnSpan || 0));\n return { row, column, rowSpan, columnSpan };\n }\n\n /**\n * Clamp a value to an integer >= 0.\n */\n export function clampValue(value: number): number {\n return Math.max(0, Math.floor(value));\n }\n\n /**\n * A sort comparison function for row spans.\n */\n export function rowSpanCmp(a: LayoutItem, b: LayoutItem): number {\n let c1 = cellConfigProperty.get(a.widget);\n let c2 = cellConfigProperty.get(b.widget);\n return c1.rowSpan - c2.rowSpan;\n }\n\n /**\n * A sort comparison function for column spans.\n */\n export function columnSpanCmp(a: LayoutItem, b: LayoutItem): number {\n let c1 = cellConfigProperty.get(a.widget);\n let c2 = cellConfigProperty.get(b.widget);\n return c1.columnSpan - c2.columnSpan;\n }\n\n /**\n * Reallocate the box sizers for the given grid dimensions.\n */\n export function reallocSizers(sizers: BoxSizer[], count: number): void {\n // Coerce the count to the valid range.\n count = Math.max(1, Math.floor(count));\n\n // Add the missing sizers.\n while (sizers.length < count) {\n sizers.push(new BoxSizer());\n }\n\n // Remove the extra sizers.\n if (sizers.length > count) {\n sizers.length = count;\n }\n }\n\n /**\n * Distribute a min size constraint across a range of sizers.\n */\n export function distributeMin(\n sizers: BoxSizer[],\n i1: number,\n i2: number,\n minSize: number\n ): void {\n // Sanity check the indices.\n if (i2 < i1) {\n return;\n }\n\n // Handle the simple case of no cell span.\n if (i1 === i2) {\n let sizer = sizers[i1];\n sizer.minSize = Math.max(sizer.minSize, minSize);\n return;\n }\n\n // Compute the total current min size of the span.\n let totalMin = 0;\n for (let i = i1; i <= i2; ++i) {\n totalMin += sizers[i].minSize;\n }\n\n // Do nothing if the total is greater than the required.\n if (totalMin >= minSize) {\n return;\n }\n\n // Compute the portion of the space to allocate to each sizer.\n let portion = (minSize - totalMin) / (i2 - i1 + 1);\n\n // Add the portion to each sizer.\n for (let i = i1; i <= i2; ++i) {\n sizers[i].minSize += portion;\n }\n }\n\n /**\n * The change handler for the child cell config property.\n */\n function onChildCellConfigChanged(child: Widget): void {\n if (child.parent && child.parent.layout instanceof GridLayout) {\n child.parent.fit();\n }\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { getKeyboardLayout } from '@lumino/keyboard';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { CommandRegistry } from '@lumino/commands';\n\nimport {\n ElementARIAAttrs,\n ElementDataset,\n h,\n VirtualDOM,\n VirtualElement\n} from '@lumino/virtualdom';\n\nimport { Menu } from './menu';\n\nimport { Title } from './title';\n\nimport { Widget } from './widget';\n\n/**\n * A widget which displays menus as a canonical menu bar.\n *\n * #### Notes\n * See also the related [example](../../examples/menubar/index.html) and\n * its [source](https://github.com/jupyterlab/lumino/tree/main/examples/example-menubar).\n */\nexport class MenuBar extends Widget {\n /**\n * Construct a new menu bar.\n *\n * @param options - The options for initializing the menu bar.\n */\n constructor(options: MenuBar.IOptions = {}) {\n super({ node: Private.createNode() });\n this.addClass('lm-MenuBar');\n this.setFlag(Widget.Flag.DisallowLayout);\n this.renderer = options.renderer || MenuBar.defaultRenderer;\n this._forceItemsPosition = options.forceItemsPosition || {\n forceX: true,\n forceY: true\n };\n this._overflowMenuOptions = options.overflowMenuOptions || {\n isVisible: true\n };\n }\n\n /**\n * Dispose of the resources held by the widget.\n */\n dispose(): void {\n this._closeChildMenu();\n this._menus.length = 0;\n super.dispose();\n }\n\n /**\n * The renderer used by the menu bar.\n */\n readonly renderer: MenuBar.IRenderer;\n\n /**\n * The child menu of the menu bar.\n *\n * #### Notes\n * This will be `null` if the menu bar does not have an open menu.\n */\n get childMenu(): Menu | null {\n return this._childMenu;\n }\n\n /**\n * The overflow index of the menu bar.\n */\n get overflowIndex(): number {\n return this._overflowIndex;\n }\n\n /**\n * The overflow menu of the menu bar.\n */\n get overflowMenu(): Menu | null {\n return this._overflowMenu;\n }\n\n /**\n * Get the menu bar content node.\n *\n * #### Notes\n * This is the node which holds the menu title nodes.\n *\n * Modifying this node directly can lead to undefined behavior.\n */\n get contentNode(): HTMLUListElement {\n return this.node.getElementsByClassName(\n 'lm-MenuBar-content'\n )[0] as HTMLUListElement;\n }\n\n /**\n * Get the currently active menu.\n */\n get activeMenu(): Menu | null {\n return this._menus[this._activeIndex] || null;\n }\n\n /**\n * Set the currently active menu.\n *\n * #### Notes\n * If the menu does not exist, the menu will be set to `null`.\n */\n set activeMenu(value: Menu | null) {\n this.activeIndex = value ? this._menus.indexOf(value) : -1;\n }\n\n /**\n * Get the index of the currently active menu.\n *\n * #### Notes\n * This will be `-1` if no menu is active.\n */\n get activeIndex(): number {\n return this._activeIndex;\n }\n\n /**\n * Set the index of the currently active menu.\n *\n * #### Notes\n * If the menu cannot be activated, the index will be set to `-1`.\n */\n set activeIndex(value: number) {\n // Adjust the value for an out of range index.\n if (value < 0 || value >= this._menus.length) {\n value = -1;\n }\n\n // An empty menu cannot be active\n if (value > -1 && this._menus[value].items.length === 0) {\n value = -1;\n }\n\n // Bail early if the index will not change.\n if (this._activeIndex === value) {\n return;\n }\n\n // Update the active index.\n this._activeIndex = value;\n\n // Schedule an update of the items.\n this.update();\n }\n\n /**\n * A read-only array of the menus in the menu bar.\n */\n get menus(): ReadonlyArray {\n return this._menus;\n }\n\n /**\n * Open the active menu and activate its first menu item.\n *\n * #### Notes\n * If there is no active menu, this is a no-op.\n */\n openActiveMenu(): void {\n // Bail early if there is no active item.\n if (this._activeIndex === -1) {\n return;\n }\n\n // Open the child menu.\n this._openChildMenu();\n\n // Activate the first item in the child menu.\n if (this._childMenu) {\n this._childMenu.activeIndex = -1;\n this._childMenu.activateNextItem();\n }\n }\n\n /**\n * Add a menu to the end of the menu bar.\n *\n * @param menu - The menu to add to the menu bar.\n *\n * #### Notes\n * If the menu is already added to the menu bar, it will be moved.\n */\n addMenu(menu: Menu, update: boolean = true): void {\n this.insertMenu(this._menus.length, menu, update);\n }\n\n /**\n * Insert a menu into the menu bar at the specified index.\n *\n * @param index - The index at which to insert the menu.\n *\n * @param menu - The menu to insert into the menu bar.\n *\n * #### Notes\n * The index will be clamped to the bounds of the menus.\n *\n * If the menu is already added to the menu bar, it will be moved.\n */\n insertMenu(index: number, menu: Menu, update: boolean = true): void {\n // Close the child menu before making changes.\n this._closeChildMenu();\n\n // Look up the index of the menu.\n let i = this._menus.indexOf(menu);\n\n // Clamp the insert index to the array bounds.\n let j = Math.max(0, Math.min(index, this._menus.length));\n\n // If the menu is not in the array, insert it.\n if (i === -1) {\n // Insert the menu into the array.\n ArrayExt.insert(this._menus, j, menu);\n\n // Add the styling class to the menu.\n menu.addClass('lm-MenuBar-menu');\n\n // Connect to the menu signals.\n menu.aboutToClose.connect(this._onMenuAboutToClose, this);\n menu.menuRequested.connect(this._onMenuMenuRequested, this);\n menu.title.changed.connect(this._onTitleChanged, this);\n\n // Schedule an update of the items.\n if (update) {\n this.update();\n }\n\n // There is nothing more to do.\n return;\n }\n\n // Otherwise, the menu exists in the array and should be moved.\n\n // Adjust the index if the location is at the end of the array.\n if (j === this._menus.length) {\n j--;\n }\n\n // Bail if there is no effective move.\n if (i === j) {\n return;\n }\n\n // Move the menu to the new locations.\n ArrayExt.move(this._menus, i, j);\n\n // Schedule an update of the items.\n if (update) {\n this.update();\n }\n }\n\n /**\n * Remove a menu from the menu bar.\n *\n * @param menu - The menu to remove from the menu bar.\n *\n * #### Notes\n * This is a no-op if the menu is not in the menu bar.\n */\n removeMenu(menu: Menu, update: boolean = true): void {\n this.removeMenuAt(this._menus.indexOf(menu), update);\n }\n\n /**\n * Remove the menu at a given index from the menu bar.\n *\n * @param index - The index of the menu to remove.\n *\n * #### Notes\n * This is a no-op if the index is out of range.\n */\n removeMenuAt(index: number, update: boolean = true): void {\n // Close the child menu before making changes.\n this._closeChildMenu();\n\n // Remove the menu from the array.\n let menu = ArrayExt.removeAt(this._menus, index);\n\n // Bail if the index is out of range.\n if (!menu) {\n return;\n }\n\n // Disconnect from the menu signals.\n menu.aboutToClose.disconnect(this._onMenuAboutToClose, this);\n menu.menuRequested.disconnect(this._onMenuMenuRequested, this);\n menu.title.changed.disconnect(this._onTitleChanged, this);\n\n // Remove the styling class from the menu.\n menu.removeClass('lm-MenuBar-menu');\n\n // Schedule an update of the items.\n if (update) {\n this.update();\n }\n }\n\n /**\n * Remove all menus from the menu bar.\n */\n clearMenus(): void {\n // Bail if there is nothing to remove.\n if (this._menus.length === 0) {\n return;\n }\n\n // Close the child menu before making changes.\n this._closeChildMenu();\n\n // Disconnect from the menu signals and remove the styling class.\n for (let menu of this._menus) {\n menu.aboutToClose.disconnect(this._onMenuAboutToClose, this);\n menu.menuRequested.disconnect(this._onMenuMenuRequested, this);\n menu.title.changed.disconnect(this._onTitleChanged, this);\n menu.removeClass('lm-MenuBar-menu');\n }\n\n // Clear the menus array.\n this._menus.length = 0;\n\n // Schedule an update of the items.\n this.update();\n }\n\n /**\n * Handle the DOM events for the menu bar.\n *\n * @param event - The DOM event sent to the menu bar.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the menu bar's DOM nodes. It\n * should not be called directly by user code.\n */\n handleEvent(event: Event): void {\n switch (event.type) {\n case 'keydown':\n this._evtKeyDown(event as KeyboardEvent);\n break;\n case 'mousedown':\n this._evtMouseDown(event as MouseEvent);\n break;\n case 'mousemove':\n case 'mouseleave':\n this._evtMouseMove(event as MouseEvent);\n break;\n case 'focusout':\n this._evtFocusOut(event as FocusEvent);\n break;\n case 'contextmenu':\n event.preventDefault();\n event.stopPropagation();\n break;\n }\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n this.node.addEventListener('keydown', this);\n this.node.addEventListener('mousedown', this);\n this.node.addEventListener('mousemove', this);\n this.node.addEventListener('mouseleave', this);\n this.node.addEventListener('focusout', this);\n this.node.addEventListener('contextmenu', this);\n }\n\n /**\n * A message handler invoked on an `'after-detach'` message.\n */\n protected onAfterDetach(msg: Message): void {\n this.node.removeEventListener('keydown', this);\n this.node.removeEventListener('mousedown', this);\n this.node.removeEventListener('mousemove', this);\n this.node.removeEventListener('mouseleave', this);\n this.node.removeEventListener('focusout', this);\n this.node.removeEventListener('contextmenu', this);\n this._closeChildMenu();\n }\n\n /**\n * A message handler invoked on an `'activate-request'` message.\n */\n protected onActivateRequest(msg: Message): void {\n if (this.isAttached) {\n this._focusItemAt(0);\n }\n }\n\n /**\n * A message handler invoked on a `'resize'` message.\n */\n protected onResize(msg: Widget.ResizeMessage): void {\n this.update();\n super.onResize(msg);\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n protected onUpdateRequest(msg: Message): void {\n let menus = this._menus;\n let renderer = this.renderer;\n let activeIndex = this._activeIndex;\n let tabFocusIndex =\n this._tabFocusIndex >= 0 && this._tabFocusIndex < menus.length\n ? this._tabFocusIndex\n : 0;\n let length = this._overflowIndex > -1 ? this._overflowIndex : menus.length;\n let totalMenuSize = 0;\n let isVisible = false;\n\n // Check that the overflow menu doesn't count\n length = this._overflowMenu !== null ? length - 1 : length;\n let content = new Array(length);\n\n // Render visible menus\n for (let i = 0; i < length; ++i) {\n content[i] = renderer.renderItem({\n title: menus[i].title,\n active: i === activeIndex,\n tabbable: i === tabFocusIndex,\n disabled: menus[i].items.length === 0,\n onfocus: () => {\n this._tabFocusIndex = i;\n this.activeIndex = i;\n }\n });\n // Calculate size of current menu\n totalMenuSize += this._menuItemSizes[i];\n // Check if overflow menu is already rendered\n if (menus[i].title.label === this._overflowMenuOptions.title) {\n isVisible = true;\n length--;\n }\n }\n // Render overflow menu if needed and active\n if (this._overflowMenuOptions.isVisible) {\n if (this._overflowIndex > -1 && !isVisible) {\n // Create overflow menu\n if (this._overflowMenu === null) {\n const overflowMenuTitle = this._overflowMenuOptions.title ?? '...';\n this._overflowMenu = new Menu({ commands: new CommandRegistry() });\n this._overflowMenu.title.label = overflowMenuTitle;\n this._overflowMenu.title.mnemonic = 0;\n this.addMenu(this._overflowMenu, false);\n }\n // Move menus to overflow menu\n for (let i = menus.length - 2; i >= length; i--) {\n const submenu = this.menus[i];\n submenu.title.mnemonic = 0;\n this._overflowMenu.insertItem(0, {\n type: 'submenu',\n submenu: submenu\n });\n this.removeMenu(submenu, false);\n }\n content[length] = renderer.renderItem({\n title: this._overflowMenu.title,\n active: length === activeIndex && menus[length].items.length !== 0,\n tabbable: length === tabFocusIndex,\n disabled: menus[length].items.length === 0,\n onfocus: () => {\n this._tabFocusIndex = length;\n this.activeIndex = length;\n }\n });\n length++;\n } else if (this._overflowMenu !== null) {\n // Remove submenus from overflow menu\n let overflowMenuItems = this._overflowMenu.items;\n let screenSize = this.node.offsetWidth;\n let n = this._overflowMenu.items.length;\n for (let i = 0; i < n; ++i) {\n let index = menus.length - 1 - i;\n if (screenSize - totalMenuSize > this._menuItemSizes[index]) {\n let menu = overflowMenuItems[0].submenu as Menu;\n this._overflowMenu.removeItemAt(0);\n this.insertMenu(length, menu, false);\n content[length] = renderer.renderItem({\n title: menu.title,\n active: false,\n tabbable: length === tabFocusIndex,\n disabled: menus[length].items.length === 0,\n onfocus: () => {\n this._tabFocusIndex = length;\n this.activeIndex = length;\n }\n });\n length++;\n }\n }\n if (this._overflowMenu.items.length === 0) {\n this.removeMenu(this._overflowMenu, false);\n content.pop();\n this._overflowMenu = null;\n this._overflowIndex = -1;\n }\n }\n }\n VirtualDOM.render(content, this.contentNode);\n this._updateOverflowIndex();\n }\n\n /**\n * Calculate and update the current overflow index.\n */\n private _updateOverflowIndex(): void {\n if (!this._overflowMenuOptions.isVisible) {\n return;\n }\n\n // Get elements visible in the main menu bar\n const itemMenus = this.contentNode.childNodes;\n let screenSize = this.node.offsetWidth;\n let totalMenuSize = 0;\n let index = -1;\n let n = itemMenus.length;\n\n if (this._menuItemSizes.length == 0) {\n // Check if it is the first resize and get info about menu items sizes\n for (let i = 0; i < n; i++) {\n let item = itemMenus[i] as HTMLLIElement;\n // Add sizes to array\n totalMenuSize += item.offsetWidth;\n this._menuItemSizes.push(item.offsetWidth);\n if (totalMenuSize > screenSize && index === -1) {\n index = i;\n }\n }\n } else {\n // Calculate current menu size\n for (let i = 0; i < this._menuItemSizes.length; i++) {\n totalMenuSize += this._menuItemSizes[i];\n if (totalMenuSize > screenSize) {\n index = i;\n break;\n }\n }\n }\n this._overflowIndex = index;\n }\n\n /**\n * Handle the `'keydown'` event for the menu bar.\n *\n * #### Notes\n * All keys are trapped except the tab key that is ignored.\n */\n private _evtKeyDown(event: KeyboardEvent): void {\n // Fetch the key code for the event.\n let kc = event.keyCode;\n\n // Reset the active index on tab, but do not trap the tab key.\n if (kc === 9) {\n this.activeIndex = -1;\n return;\n }\n\n // A menu bar handles all other keydown events.\n event.preventDefault();\n event.stopPropagation();\n\n // Enter, Space, Up Arrow, Down Arrow\n if (kc === 13 || kc === 32 || kc === 38 || kc === 40) {\n // The active index may have changed (for example, user hovers over an\n // item with the mouse), so be sure to use the focus index.\n this.activeIndex = this._tabFocusIndex;\n if (this.activeIndex !== this._tabFocusIndex) {\n // Bail if the setter refused to set activeIndex to tabFocusIndex\n // because it means that the item at tabFocusIndex cannot be opened (for\n // example, it has an empty menu)\n return;\n }\n this.openActiveMenu();\n return;\n }\n\n // Escape\n if (kc === 27) {\n this._closeChildMenu();\n this._focusItemAt(this.activeIndex);\n return;\n }\n\n // Left or Right Arrow\n if (kc === 37 || kc === 39) {\n let direction = kc === 37 ? -1 : 1;\n let start = this._tabFocusIndex + direction;\n let n = this._menus.length;\n for (let i = 0; i < n; i++) {\n let index = (n + start + direction * i) % n;\n if (this._menus[index].items.length) {\n this._focusItemAt(index);\n return;\n }\n }\n return;\n }\n\n // Get the pressed key character.\n let key = getKeyboardLayout().keyForKeydownEvent(event);\n\n // Bail if the key is not valid.\n if (!key) {\n return;\n }\n\n // Search for the next best matching mnemonic item.\n let start = this._activeIndex + 1;\n let result = Private.findMnemonic(this._menus, key, start);\n\n // Handle the requested mnemonic based on the search results.\n // If exactly one mnemonic is matched, that menu is opened.\n // Otherwise, the next mnemonic is activated if available,\n // followed by the auto mnemonic if available.\n if (result.index !== -1 && !result.multiple) {\n this.activeIndex = result.index;\n this.openActiveMenu();\n } else if (result.index !== -1) {\n this.activeIndex = result.index;\n this._focusItemAt(this.activeIndex);\n } else if (result.auto !== -1) {\n this.activeIndex = result.auto;\n this._focusItemAt(this.activeIndex);\n }\n }\n\n /**\n * Handle the `'mousedown'` event for the menu bar.\n */\n private _evtMouseDown(event: MouseEvent): void {\n // Bail if the mouse press was not on the menu bar. This can occur\n // when the document listener is installed for an active menu bar.\n if (!ElementExt.hitTest(this.node, event.clientX, event.clientY)) {\n return;\n }\n\n // Stop the propagation of the event. Immediate propagation is\n // also stopped so that an open menu does not handle the event.\n event.stopPropagation();\n event.stopImmediatePropagation();\n\n // Check if the mouse is over one of the menu items.\n let index = ArrayExt.findFirstIndex(this.contentNode.children, node => {\n return ElementExt.hitTest(node, event.clientX, event.clientY);\n });\n\n // If the press was not on an item, close the child menu.\n if (index === -1) {\n this._closeChildMenu();\n return;\n }\n\n // If the press was not the left mouse button, do nothing further.\n if (event.button !== 0) {\n return;\n }\n\n // Otherwise, toggle the open state of the child menu.\n if (this._childMenu) {\n this._closeChildMenu();\n this.activeIndex = index;\n } else {\n // If we don't call preventDefault() here, then the item in the menu\n // bar will take focus over the menu that is being opened.\n event.preventDefault();\n const position = this._positionForMenu(index);\n Menu.saveWindowData();\n // Begin DOM modifications.\n this.activeIndex = index;\n this._openChildMenu(position);\n }\n }\n\n /**\n * Handle the `'mousemove'` event for the menu bar.\n */\n private _evtMouseMove(event: MouseEvent): void {\n // Check if the mouse is over one of the menu items.\n let index = ArrayExt.findFirstIndex(this.contentNode.children, node => {\n return ElementExt.hitTest(node, event.clientX, event.clientY);\n });\n\n // Bail early if the active index will not change.\n if (index === this._activeIndex) {\n return;\n }\n\n // Bail early if a child menu is open and the mouse is not over\n // an item. This allows the child menu to be kept open when the\n // mouse is over the empty part of the menu bar.\n if (index === -1 && this._childMenu) {\n return;\n }\n\n // Get position for the new menu >before< updating active index.\n const position =\n index >= 0 && this._childMenu ? this._positionForMenu(index) : null;\n\n // Before any modification, update window data.\n Menu.saveWindowData();\n\n // Begin DOM modifications.\n\n // Update the active index to the hovered item.\n this.activeIndex = index;\n\n // Open the new menu if a menu is already open.\n if (position) {\n this._openChildMenu(position);\n }\n }\n\n /**\n * Find initial position for the menu based on menubar item position.\n *\n * NOTE: this should be called before updating active index to avoid\n * an additional layout and style invalidation as changing active\n * index modifies DOM.\n */\n private _positionForMenu(index: number): Private.IPosition {\n let itemNode = this.contentNode.children[index];\n let { left, bottom } = (itemNode as HTMLElement).getBoundingClientRect();\n return {\n top: bottom,\n left\n };\n }\n\n /**\n * Handle the `'focusout'` event for the menu bar.\n */\n private _evtFocusOut(event: FocusEvent): void {\n // Reset the active index if there is no open menu and the menubar is losing focus.\n if (!this._childMenu && !this.node.contains(event.relatedTarget as Node)) {\n this.activeIndex = -1;\n }\n }\n\n /**\n * Focus an item in the menu bar.\n *\n * #### Notes\n * Does not open the associated menu.\n */\n private _focusItemAt(index: number): void {\n const itemNode = this.contentNode.childNodes[index] as HTMLElement | void;\n if (itemNode) {\n itemNode.focus();\n }\n }\n\n /**\n * Open the child menu at the active index immediately.\n *\n * If a different child menu is already open, it will be closed,\n * even if there is no active menu.\n */\n private _openChildMenu(options: { left?: number; top?: number } = {}): void {\n // If there is no active menu, close the current menu.\n let newMenu = this.activeMenu;\n if (!newMenu) {\n this._closeChildMenu();\n return;\n }\n\n // Bail if there is no effective menu change.\n let oldMenu = this._childMenu;\n if (oldMenu === newMenu) {\n return;\n }\n\n // Swap the internal menu reference.\n this._childMenu = newMenu;\n\n // Close the current menu, or setup for the new menu.\n if (oldMenu) {\n oldMenu.close();\n } else {\n document.addEventListener('mousedown', this, true);\n }\n\n // Update the tab focus index and ensure the menu bar is updated.\n this._tabFocusIndex = this.activeIndex;\n MessageLoop.sendMessage(this, Widget.Msg.UpdateRequest);\n\n // Get the positioning data for the new menu.\n let { left, top } = options;\n if (typeof left === 'undefined' || typeof top === 'undefined') {\n ({ left, top } = this._positionForMenu(this._activeIndex));\n }\n // Begin DOM modifications\n\n if (!oldMenu) {\n // Continue setup for new menu\n this.addClass('lm-mod-active');\n }\n\n // Open the new menu at the computed location.\n if (newMenu.items.length > 0) {\n newMenu.open(left, top, this._forceItemsPosition);\n }\n }\n\n /**\n * Close the child menu immediately.\n *\n * This is a no-op if a child menu is not open.\n */\n private _closeChildMenu(): void {\n // Bail if no child menu is open.\n if (!this._childMenu) {\n return;\n }\n // Remove the active class from the menu bar.\n this.removeClass('lm-mod-active');\n\n // Remove the document listeners.\n document.removeEventListener('mousedown', this, true);\n\n // Clear the internal menu reference.\n let menu = this._childMenu;\n this._childMenu = null;\n\n // Close the menu.\n menu.close();\n\n // Reset the active index.\n this.activeIndex = -1;\n }\n\n /**\n * Handle the `aboutToClose` signal of a menu.\n */\n private _onMenuAboutToClose(sender: Menu): void {\n // Bail if the sender is not the child menu.\n if (sender !== this._childMenu) {\n return;\n }\n\n // Remove the active class from the menu bar.\n this.removeClass('lm-mod-active');\n\n // Remove the document listeners.\n document.removeEventListener('mousedown', this, true);\n\n // Clear the internal menu reference.\n this._childMenu = null;\n\n // Reset the active index.\n this.activeIndex = -1;\n }\n\n /**\n * Handle the `menuRequested` signal of a child menu.\n */\n private _onMenuMenuRequested(sender: Menu, args: 'next' | 'previous'): void {\n // Bail if the sender is not the child menu.\n if (sender !== this._childMenu) {\n return;\n }\n\n // Look up the active index and menu count.\n let i = this._activeIndex;\n let n = this._menus.length;\n\n // Active the next requested index.\n switch (args) {\n case 'next':\n this.activeIndex = i === n - 1 ? 0 : i + 1;\n break;\n case 'previous':\n this.activeIndex = i === 0 ? n - 1 : i - 1;\n break;\n }\n\n // Open the active menu.\n this.openActiveMenu();\n }\n\n /**\n * Handle the `changed` signal of a title object.\n */\n private _onTitleChanged(): void {\n this.update();\n }\n\n // Track the index of the item that is currently focused or hovered. -1 means nothing focused or hovered.\n private _activeIndex = -1;\n // Track which item can be focused using the TAB key. Unlike _activeIndex will\n // always point to a menuitem. Whenever you update this value, it's important\n // to follow it with an \"update-request\" message so that the `tabindex`\n // attribute on each menubar item gets properly updated.\n private _tabFocusIndex = 0;\n private _forceItemsPosition: Menu.IOpenOptions;\n private _overflowMenuOptions: IOverflowMenuOptions;\n private _menus: Menu[] = [];\n private _childMenu: Menu | null = null;\n private _overflowMenu: Menu | null = null;\n private _menuItemSizes: number[] = [];\n private _overflowIndex: number = -1;\n}\n\n/**\n * The namespace for the `MenuBar` class statics.\n */\nexport namespace MenuBar {\n /**\n * An options object for creating a menu bar.\n */\n export interface IOptions {\n /**\n * A custom renderer for creating menu bar content.\n *\n * The default is a shared renderer instance.\n */\n renderer?: IRenderer;\n /**\n * Whether to force the position of the menu. The MenuBar forces the\n * coordinates of its menus by default. With this option you can disable it.\n *\n * Setting to `false` will enable the logic which repositions the\n * coordinates of the menu if it will not fit entirely on screen.\n *\n * The default is `true`.\n */\n forceItemsPosition?: Menu.IOpenOptions;\n /**\n * Whether to add a overflow menu if there's overflow.\n *\n * Setting to `true` will enable the logic that creates an overflow menu\n * to show the menu items that don't fit entirely on the screen.\n *\n * The default is `true`.\n */\n overflowMenuOptions?: IOverflowMenuOptions;\n }\n\n /**\n * An object which holds the data to render a menu bar item.\n */\n export interface IRenderData {\n /**\n * The title to be rendered.\n */\n readonly title: Title;\n\n /**\n * Whether the item is the active item.\n */\n readonly active: boolean;\n\n /**\n * Whether the user can tab to the item.\n */\n readonly tabbable: boolean;\n\n /**\n * Whether the item is disabled.\n *\n * #### Notes\n * A disabled item cannot be active.\n * A disabled item cannot be focussed.\n */\n readonly disabled?: boolean;\n\n readonly onfocus?: (event: FocusEvent) => void;\n }\n\n /**\n * A renderer for use with a menu bar.\n */\n export interface IRenderer {\n /**\n * Render the virtual element for a menu bar item.\n *\n * @param data - The data to use for rendering the item.\n *\n * @returns A virtual element representing the item.\n */\n renderItem(data: IRenderData): VirtualElement;\n }\n\n /**\n * The default implementation of `IRenderer`.\n *\n * #### Notes\n * Subclasses are free to reimplement rendering methods as needed.\n */\n export class Renderer implements IRenderer {\n /**\n * Render the virtual element for a menu bar item.\n *\n * @param data - The data to use for rendering the item.\n *\n * @returns A virtual element representing the item.\n */\n renderItem(data: IRenderData): VirtualElement {\n let className = this.createItemClass(data);\n let dataset = this.createItemDataset(data);\n let aria = this.createItemARIA(data);\n return h.li(\n {\n className,\n dataset,\n ...(data.disabled ? {} : { tabindex: data.tabbable ? '0' : '-1' }),\n onfocus: data.onfocus,\n ...aria\n },\n this.renderIcon(data),\n this.renderLabel(data)\n );\n }\n\n /**\n * Render the icon element for a menu bar item.\n *\n * @param data - The data to use for rendering the icon.\n *\n * @returns A virtual element representing the item icon.\n */\n renderIcon(data: IRenderData): VirtualElement {\n let className = this.createIconClass(data);\n\n // If data.title.icon is undefined, it will be ignored.\n return h.div({ className }, data.title.icon!, data.title.iconLabel);\n }\n\n /**\n * Render the label element for a menu item.\n *\n * @param data - The data to use for rendering the label.\n *\n * @returns A virtual element representing the item label.\n */\n renderLabel(data: IRenderData): VirtualElement {\n let content = this.formatLabel(data);\n return h.div({ className: 'lm-MenuBar-itemLabel' }, content);\n }\n\n /**\n * Create the class name for the menu bar item.\n *\n * @param data - The data to use for the class name.\n *\n * @returns The full class name for the menu item.\n */\n createItemClass(data: IRenderData): string {\n let name = 'lm-MenuBar-item';\n if (data.title.className) {\n name += ` ${data.title.className}`;\n }\n if (data.active && !data.disabled) {\n name += ' lm-mod-active';\n }\n return name;\n }\n\n /**\n * Create the dataset for a menu bar item.\n *\n * @param data - The data to use for the item.\n *\n * @returns The dataset for the menu bar item.\n */\n createItemDataset(data: IRenderData): ElementDataset {\n return data.title.dataset;\n }\n\n /**\n * Create the aria attributes for menu bar item.\n *\n * @param data - The data to use for the aria attributes.\n *\n * @returns The aria attributes object for the item.\n */\n createItemARIA(data: IRenderData): ElementARIAAttrs {\n return {\n role: 'menuitem',\n 'aria-haspopup': 'true',\n 'aria-disabled': data.disabled ? 'true' : 'false'\n };\n }\n\n /**\n * Create the class name for the menu bar item icon.\n *\n * @param data - The data to use for the class name.\n *\n * @returns The full class name for the item icon.\n */\n createIconClass(data: IRenderData): string {\n let name = 'lm-MenuBar-itemIcon';\n let extra = data.title.iconClass;\n return extra ? `${name} ${extra}` : name;\n }\n\n /**\n * Create the render content for the label node.\n *\n * @param data - The data to use for the label content.\n *\n * @returns The content to add to the label node.\n */\n formatLabel(data: IRenderData): h.Child {\n // Fetch the label text and mnemonic index.\n let { label, mnemonic } = data.title;\n\n // If the index is out of range, do not modify the label.\n if (mnemonic < 0 || mnemonic >= label.length) {\n return label;\n }\n\n // Split the label into parts.\n let prefix = label.slice(0, mnemonic);\n let suffix = label.slice(mnemonic + 1);\n let char = label[mnemonic];\n\n // Wrap the mnemonic character in a span.\n let span = h.span({ className: 'lm-MenuBar-itemMnemonic' }, char);\n\n // Return the content parts.\n return [prefix, span, suffix];\n }\n }\n\n /**\n * The default `Renderer` instance.\n */\n export const defaultRenderer = new Renderer();\n}\n\n/**\n * Options for overflow menu.\n */\nexport interface IOverflowMenuOptions {\n /**\n * Determines if a overflow menu appears when the menu items overflow.\n *\n * Defaults to `true`.\n */\n isVisible: boolean;\n /**\n * Determines the title of the overflow menu.\n *\n * Default: `...`.\n */\n title?: string;\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * Create the DOM node for a menu bar.\n */\n export function createNode(): HTMLDivElement {\n let node = document.createElement('div');\n let content = document.createElement('ul');\n content.className = 'lm-MenuBar-content';\n node.appendChild(content);\n content.setAttribute('role', 'menubar');\n return node;\n }\n\n /**\n * Position for the menu relative to top-left screen corner.\n */\n export interface IPosition {\n /**\n * Pixels right from screen origin.\n */\n left: number;\n /**\n * Pixels down from screen origin.\n */\n top: number;\n }\n\n /**\n * The results of a mnemonic search.\n */\n export interface IMnemonicResult {\n /**\n * The index of the first matching mnemonic item, or `-1`.\n */\n index: number;\n\n /**\n * Whether multiple mnemonic items matched.\n */\n multiple: boolean;\n\n /**\n * The index of the first auto matched non-mnemonic item.\n */\n auto: number;\n }\n\n /**\n * Find the best matching mnemonic item.\n *\n * The search starts at the given index and wraps around.\n */\n export function findMnemonic(\n menus: ReadonlyArray,\n key: string,\n start: number\n ): IMnemonicResult {\n // Setup the result variables.\n let index = -1;\n let auto = -1;\n let multiple = false;\n\n // Normalize the key to upper case.\n let upperKey = key.toUpperCase();\n\n // Search the items from the given start index.\n for (let i = 0, n = menus.length; i < n; ++i) {\n // Compute the wrapped index.\n let k = (i + start) % n;\n\n // Look up the menu title.\n let title = menus[k].title;\n\n // Ignore titles with an empty label.\n if (title.label.length === 0) {\n continue;\n }\n\n // Look up the mnemonic index for the label.\n let mn = title.mnemonic;\n\n // Handle a valid mnemonic index.\n if (mn >= 0 && mn < title.label.length) {\n if (title.label[mn].toUpperCase() === upperKey) {\n if (index === -1) {\n index = k;\n } else {\n multiple = true;\n }\n }\n continue;\n }\n\n // Finally, handle the auto index if possible.\n if (auto === -1 && title.label[0].toUpperCase() === upperKey) {\n auto = k;\n }\n }\n\n // Return the search results.\n return { index, multiple, auto };\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { IDisposable } from '@lumino/disposable';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Drag } from '@lumino/dragdrop';\n\nimport { Message } from '@lumino/messaging';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { Widget } from './widget';\n\n/**\n * A widget which implements a canonical scroll bar.\n */\nexport class ScrollBar extends Widget {\n /**\n * Construct a new scroll bar.\n *\n * @param options - The options for initializing the scroll bar.\n */\n constructor(options: ScrollBar.IOptions = {}) {\n super({ node: Private.createNode() });\n this.addClass('lm-ScrollBar');\n this.setFlag(Widget.Flag.DisallowLayout);\n\n // Set the orientation.\n this._orientation = options.orientation || 'vertical';\n this.dataset['orientation'] = this._orientation;\n\n // Parse the rest of the options.\n if (options.maximum !== undefined) {\n this._maximum = Math.max(0, options.maximum);\n }\n if (options.page !== undefined) {\n this._page = Math.max(0, options.page);\n }\n if (options.value !== undefined) {\n this._value = Math.max(0, Math.min(options.value, this._maximum));\n }\n }\n\n /**\n * A signal emitted when the user moves the scroll thumb.\n *\n * #### Notes\n * The payload is the current value of the scroll bar.\n */\n get thumbMoved(): ISignal {\n return this._thumbMoved;\n }\n\n /**\n * A signal emitted when the user clicks a step button.\n *\n * #### Notes\n * The payload is whether a decrease or increase is requested.\n */\n get stepRequested(): ISignal {\n return this._stepRequested;\n }\n\n /**\n * A signal emitted when the user clicks the scroll track.\n *\n * #### Notes\n * The payload is whether a decrease or increase is requested.\n */\n get pageRequested(): ISignal {\n return this._pageRequested;\n }\n\n /**\n * Get the orientation of the scroll bar.\n */\n get orientation(): ScrollBar.Orientation {\n return this._orientation;\n }\n\n /**\n * Set the orientation of the scroll bar.\n */\n set orientation(value: ScrollBar.Orientation) {\n // Do nothing if the orientation does not change.\n if (this._orientation === value) {\n return;\n }\n\n // Release the mouse before making changes.\n this._releaseMouse();\n\n // Update the internal orientation.\n this._orientation = value;\n this.dataset['orientation'] = value;\n\n // Schedule an update the scroll bar.\n this.update();\n }\n\n /**\n * Get the current value of the scroll bar.\n */\n get value(): number {\n return this._value;\n }\n\n /**\n * Set the current value of the scroll bar.\n *\n * #### Notes\n * The value will be clamped to the range `[0, maximum]`.\n */\n set value(value: number) {\n // Clamp the value to the allowable range.\n value = Math.max(0, Math.min(value, this._maximum));\n\n // Do nothing if the value does not change.\n if (this._value === value) {\n return;\n }\n\n // Update the internal value.\n this._value = value;\n\n // Schedule an update the scroll bar.\n this.update();\n }\n\n /**\n * Get the page size of the scroll bar.\n *\n * #### Notes\n * The page size is the amount of visible content in the scrolled\n * region, expressed in data units. It determines the size of the\n * scroll bar thumb.\n */\n get page(): number {\n return this._page;\n }\n\n /**\n * Set the page size of the scroll bar.\n *\n * #### Notes\n * The page size will be clamped to the range `[0, Infinity]`.\n */\n set page(value: number) {\n // Clamp the page size to the allowable range.\n value = Math.max(0, value);\n\n // Do nothing if the value does not change.\n if (this._page === value) {\n return;\n }\n\n // Update the internal page size.\n this._page = value;\n\n // Schedule an update the scroll bar.\n this.update();\n }\n\n /**\n * Get the maximum value of the scroll bar.\n */\n get maximum(): number {\n return this._maximum;\n }\n\n /**\n * Set the maximum value of the scroll bar.\n *\n * #### Notes\n * The max size will be clamped to the range `[0, Infinity]`.\n */\n set maximum(value: number) {\n // Clamp the value to the allowable range.\n value = Math.max(0, value);\n\n // Do nothing if the value does not change.\n if (this._maximum === value) {\n return;\n }\n\n // Update the internal values.\n this._maximum = value;\n\n // Clamp the current value to the new range.\n this._value = Math.min(this._value, value);\n\n // Schedule an update the scroll bar.\n this.update();\n }\n\n /**\n * The scroll bar decrement button node.\n *\n * #### Notes\n * Modifying this node directly can lead to undefined behavior.\n */\n get decrementNode(): HTMLDivElement {\n return this.node.getElementsByClassName(\n 'lm-ScrollBar-button'\n )[0] as HTMLDivElement;\n }\n\n /**\n * The scroll bar increment button node.\n *\n * #### Notes\n * Modifying this node directly can lead to undefined behavior.\n */\n get incrementNode(): HTMLDivElement {\n return this.node.getElementsByClassName(\n 'lm-ScrollBar-button'\n )[1] as HTMLDivElement;\n }\n\n /**\n * The scroll bar track node.\n *\n * #### Notes\n * Modifying this node directly can lead to undefined behavior.\n */\n get trackNode(): HTMLDivElement {\n return this.node.getElementsByClassName(\n 'lm-ScrollBar-track'\n )[0] as HTMLDivElement;\n }\n\n /**\n * The scroll bar thumb node.\n *\n * #### Notes\n * Modifying this node directly can lead to undefined behavior.\n */\n get thumbNode(): HTMLDivElement {\n return this.node.getElementsByClassName(\n 'lm-ScrollBar-thumb'\n )[0] as HTMLDivElement;\n }\n\n /**\n * Handle the DOM events for the scroll bar.\n *\n * @param event - The DOM event sent to the scroll bar.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the scroll bar's DOM node.\n *\n * This should not be called directly by user code.\n */\n handleEvent(event: Event): void {\n switch (event.type) {\n case 'mousedown':\n this._evtMouseDown(event as MouseEvent);\n break;\n case 'mousemove':\n this._evtMouseMove(event as MouseEvent);\n break;\n case 'mouseup':\n this._evtMouseUp(event as MouseEvent);\n break;\n case 'keydown':\n this._evtKeyDown(event as KeyboardEvent);\n break;\n case 'contextmenu':\n event.preventDefault();\n event.stopPropagation();\n break;\n }\n }\n\n /**\n * A method invoked on a 'before-attach' message.\n */\n protected onBeforeAttach(msg: Message): void {\n this.node.addEventListener('mousedown', this);\n this.update();\n }\n\n /**\n * A method invoked on an 'after-detach' message.\n */\n protected onAfterDetach(msg: Message): void {\n this.node.removeEventListener('mousedown', this);\n this._releaseMouse();\n }\n\n /**\n * A method invoked on an 'update-request' message.\n */\n protected onUpdateRequest(msg: Message): void {\n // Convert the value and page into percentages.\n let value = (this._value * 100) / this._maximum;\n let page = (this._page * 100) / (this._page + this._maximum);\n\n // Clamp the value and page to the relevant range.\n value = Math.max(0, Math.min(value, 100));\n page = Math.max(0, Math.min(page, 100));\n\n // Fetch the thumb style.\n let thumbStyle = this.thumbNode.style;\n\n // Update the thumb style for the current orientation.\n if (this._orientation === 'horizontal') {\n thumbStyle.top = '';\n thumbStyle.height = '';\n thumbStyle.left = `${value}%`;\n thumbStyle.width = `${page}%`;\n thumbStyle.transform = `translate(${-value}%, 0%)`;\n } else {\n thumbStyle.left = '';\n thumbStyle.width = '';\n thumbStyle.top = `${value}%`;\n thumbStyle.height = `${page}%`;\n thumbStyle.transform = `translate(0%, ${-value}%)`;\n }\n }\n\n /**\n * Handle the `'keydown'` event for the scroll bar.\n */\n private _evtKeyDown(event: KeyboardEvent): void {\n // Stop all input events during drag.\n event.preventDefault();\n event.stopPropagation();\n\n // Ignore anything except the `Escape` key.\n if (event.keyCode !== 27) {\n return;\n }\n\n // Fetch the previous scroll value.\n let value = this._pressData ? this._pressData.value : -1;\n\n // Release the mouse.\n this._releaseMouse();\n\n // Restore the old scroll value if possible.\n if (value !== -1) {\n this._moveThumb(value);\n }\n }\n\n /**\n * Handle the `'mousedown'` event for the scroll bar.\n */\n private _evtMouseDown(event: MouseEvent): void {\n // Do nothing if it's not a left mouse press.\n if (event.button !== 0) {\n return;\n }\n\n // Send an activate request to the scroll bar. This can be\n // used by message hooks to activate something relevant.\n this.activate();\n\n // Do nothing if the mouse is already captured.\n if (this._pressData) {\n return;\n }\n\n // Find the pressed scroll bar part.\n let part = Private.findPart(this, event.target as HTMLElement);\n\n // Do nothing if the part is not of interest.\n if (!part) {\n return;\n }\n\n // Stop the event propagation.\n event.preventDefault();\n event.stopPropagation();\n\n // Override the mouse cursor.\n let override = Drag.overrideCursor('default');\n\n // Set up the press data.\n this._pressData = {\n part,\n override,\n delta: -1,\n value: -1,\n mouseX: event.clientX,\n mouseY: event.clientY\n };\n\n // Add the extra event listeners.\n document.addEventListener('mousemove', this, true);\n document.addEventListener('mouseup', this, true);\n document.addEventListener('keydown', this, true);\n document.addEventListener('contextmenu', this, true);\n\n // Handle a thumb press.\n if (part === 'thumb') {\n // Fetch the thumb node.\n let thumbNode = this.thumbNode;\n\n // Fetch the client rect for the thumb.\n let thumbRect = thumbNode.getBoundingClientRect();\n\n // Update the press data delta for the current orientation.\n if (this._orientation === 'horizontal') {\n this._pressData.delta = event.clientX - thumbRect.left;\n } else {\n this._pressData.delta = event.clientY - thumbRect.top;\n }\n\n // Add the active class to the thumb node.\n thumbNode.classList.add('lm-mod-active');\n\n // Store the current value in the press data.\n this._pressData.value = this._value;\n\n // Finished.\n return;\n }\n\n // Handle a track press.\n if (part === 'track') {\n // Fetch the client rect for the thumb.\n let thumbRect = this.thumbNode.getBoundingClientRect();\n\n // Determine the direction for the page request.\n let dir: 'decrement' | 'increment';\n if (this._orientation === 'horizontal') {\n dir = event.clientX < thumbRect.left ? 'decrement' : 'increment';\n } else {\n dir = event.clientY < thumbRect.top ? 'decrement' : 'increment';\n }\n\n // Start the repeat timer.\n this._repeatTimer = window.setTimeout(this._onRepeat, 350);\n\n // Emit the page requested signal.\n this._pageRequested.emit(dir);\n\n // Finished.\n return;\n }\n\n // Handle a decrement button press.\n if (part === 'decrement') {\n // Add the active class to the decrement node.\n this.decrementNode.classList.add('lm-mod-active');\n\n // Start the repeat timer.\n this._repeatTimer = window.setTimeout(this._onRepeat, 350);\n\n // Emit the step requested signal.\n this._stepRequested.emit('decrement');\n\n // Finished.\n return;\n }\n\n // Handle an increment button press.\n if (part === 'increment') {\n // Add the active class to the increment node.\n this.incrementNode.classList.add('lm-mod-active');\n\n // Start the repeat timer.\n this._repeatTimer = window.setTimeout(this._onRepeat, 350);\n\n // Emit the step requested signal.\n this._stepRequested.emit('increment');\n\n // Finished.\n return;\n }\n }\n\n /**\n * Handle the `'mousemove'` event for the scroll bar.\n */\n private _evtMouseMove(event: MouseEvent): void {\n // Do nothing if no drag is in progress.\n if (!this._pressData) {\n return;\n }\n\n // Stop the event propagation.\n event.preventDefault();\n event.stopPropagation();\n\n // Update the mouse position.\n this._pressData.mouseX = event.clientX;\n this._pressData.mouseY = event.clientY;\n\n // Bail if the thumb is not being dragged.\n if (this._pressData.part !== 'thumb') {\n return;\n }\n\n // Get the client rect for the thumb and track.\n let thumbRect = this.thumbNode.getBoundingClientRect();\n let trackRect = this.trackNode.getBoundingClientRect();\n\n // Fetch the scroll geometry based on the orientation.\n let trackPos: number;\n let trackSpan: number;\n if (this._orientation === 'horizontal') {\n trackPos = event.clientX - trackRect.left - this._pressData.delta;\n trackSpan = trackRect.width - thumbRect.width;\n } else {\n trackPos = event.clientY - trackRect.top - this._pressData.delta;\n trackSpan = trackRect.height - thumbRect.height;\n }\n\n // Compute the desired value from the scroll geometry.\n let value = trackSpan === 0 ? 0 : (trackPos * this._maximum) / trackSpan;\n\n // Move the thumb to the computed value.\n this._moveThumb(value);\n }\n\n /**\n * Handle the `'mouseup'` event for the scroll bar.\n */\n private _evtMouseUp(event: MouseEvent): void {\n // Do nothing if it's not a left mouse release.\n if (event.button !== 0) {\n return;\n }\n\n // Stop the event propagation.\n event.preventDefault();\n event.stopPropagation();\n\n // Release the mouse.\n this._releaseMouse();\n }\n\n /**\n * Release the mouse and restore the node states.\n */\n private _releaseMouse(): void {\n // Bail if there is no press data.\n if (!this._pressData) {\n return;\n }\n\n // Clear the repeat timer.\n clearTimeout(this._repeatTimer);\n this._repeatTimer = -1;\n\n // Clear the press data.\n this._pressData.override.dispose();\n this._pressData = null;\n\n // Remove the extra event listeners.\n document.removeEventListener('mousemove', this, true);\n document.removeEventListener('mouseup', this, true);\n document.removeEventListener('keydown', this, true);\n document.removeEventListener('contextmenu', this, true);\n\n // Remove the active classes from the nodes.\n this.thumbNode.classList.remove('lm-mod-active');\n this.decrementNode.classList.remove('lm-mod-active');\n this.incrementNode.classList.remove('lm-mod-active');\n }\n\n /**\n * Move the thumb to the specified position.\n */\n private _moveThumb(value: number): void {\n // Clamp the value to the allowed range.\n value = Math.max(0, Math.min(value, this._maximum));\n\n // Bail if the value does not change.\n if (this._value === value) {\n return;\n }\n\n // Update the internal value.\n this._value = value;\n\n // Schedule an update of the scroll bar.\n this.update();\n\n // Emit the thumb moved signal.\n this._thumbMoved.emit(value);\n }\n\n /**\n * A timeout callback for repeating the mouse press.\n */\n private _onRepeat = () => {\n // Clear the repeat timer id.\n this._repeatTimer = -1;\n\n // Bail if the mouse has been released.\n if (!this._pressData) {\n return;\n }\n\n // Look up the part that was pressed.\n let part = this._pressData.part;\n\n // Bail if the thumb was pressed.\n if (part === 'thumb') {\n return;\n }\n\n // Schedule the timer for another repeat.\n this._repeatTimer = window.setTimeout(this._onRepeat, 20);\n\n // Get the current mouse position.\n let mouseX = this._pressData.mouseX;\n let mouseY = this._pressData.mouseY;\n\n // Handle a decrement button repeat.\n if (part === 'decrement') {\n // Bail if the mouse is not over the button.\n if (!ElementExt.hitTest(this.decrementNode, mouseX, mouseY)) {\n return;\n }\n\n // Emit the step requested signal.\n this._stepRequested.emit('decrement');\n\n // Finished.\n return;\n }\n\n // Handle an increment button repeat.\n if (part === 'increment') {\n // Bail if the mouse is not over the button.\n if (!ElementExt.hitTest(this.incrementNode, mouseX, mouseY)) {\n return;\n }\n\n // Emit the step requested signal.\n this._stepRequested.emit('increment');\n\n // Finished.\n return;\n }\n\n // Handle a track repeat.\n if (part === 'track') {\n // Bail if the mouse is not over the track.\n if (!ElementExt.hitTest(this.trackNode, mouseX, mouseY)) {\n return;\n }\n\n // Fetch the thumb node.\n let thumbNode = this.thumbNode;\n\n // Bail if the mouse is over the thumb.\n if (ElementExt.hitTest(thumbNode, mouseX, mouseY)) {\n return;\n }\n\n // Fetch the client rect for the thumb.\n let thumbRect = thumbNode.getBoundingClientRect();\n\n // Determine the direction for the page request.\n let dir: 'decrement' | 'increment';\n if (this._orientation === 'horizontal') {\n dir = mouseX < thumbRect.left ? 'decrement' : 'increment';\n } else {\n dir = mouseY < thumbRect.top ? 'decrement' : 'increment';\n }\n\n // Emit the page requested signal.\n this._pageRequested.emit(dir);\n\n // Finished.\n return;\n }\n };\n\n private _value = 0;\n private _page = 10;\n private _maximum = 100;\n private _repeatTimer = -1;\n private _orientation: ScrollBar.Orientation;\n private _pressData: Private.IPressData | null = null;\n private _thumbMoved = new Signal(this);\n private _stepRequested = new Signal(this);\n private _pageRequested = new Signal(this);\n}\n\n/**\n * The namespace for the `ScrollBar` class statics.\n */\nexport namespace ScrollBar {\n /**\n * A type alias for a scroll bar orientation.\n */\n export type Orientation = 'horizontal' | 'vertical';\n\n /**\n * An options object for creating a scroll bar.\n */\n export interface IOptions {\n /**\n * The orientation of the scroll bar.\n *\n * The default is `'vertical'`.\n */\n orientation?: Orientation;\n\n /**\n * The value for the scroll bar.\n *\n * The default is `0`.\n */\n value?: number;\n\n /**\n * The page size for the scroll bar.\n *\n * The default is `10`.\n */\n page?: number;\n\n /**\n * The maximum value for the scroll bar.\n *\n * The default is `100`.\n */\n maximum?: number;\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * A type alias for the parts of a scroll bar.\n */\n export type ScrollBarPart = 'thumb' | 'track' | 'decrement' | 'increment';\n\n /**\n * An object which holds mouse press data.\n */\n export interface IPressData {\n /**\n * The scroll bar part which was pressed.\n */\n part: ScrollBarPart;\n\n /**\n * The offset of the press in thumb coordinates, or -1.\n */\n delta: number;\n\n /**\n * The scroll value at the time the thumb was pressed, or -1.\n */\n value: number;\n\n /**\n * The disposable which will clear the override cursor.\n */\n override: IDisposable;\n\n /**\n * The current X position of the mouse.\n */\n mouseX: number;\n\n /**\n * The current Y position of the mouse.\n */\n mouseY: number;\n }\n\n /**\n * Create the DOM node for a scroll bar.\n */\n export function createNode(): HTMLElement {\n let node = document.createElement('div');\n let decrement = document.createElement('div');\n let increment = document.createElement('div');\n let track = document.createElement('div');\n let thumb = document.createElement('div');\n decrement.className = 'lm-ScrollBar-button';\n increment.className = 'lm-ScrollBar-button';\n decrement.dataset['action'] = 'decrement';\n increment.dataset['action'] = 'increment';\n track.className = 'lm-ScrollBar-track';\n thumb.className = 'lm-ScrollBar-thumb';\n track.appendChild(thumb);\n node.appendChild(decrement);\n node.appendChild(track);\n node.appendChild(increment);\n return node;\n }\n\n /**\n * Find the scroll bar part which contains the given target.\n */\n export function findPart(\n scrollBar: ScrollBar,\n target: HTMLElement\n ): ScrollBarPart | null {\n // Test the thumb.\n if (scrollBar.thumbNode.contains(target)) {\n return 'thumb';\n }\n\n // Test the track.\n if (scrollBar.trackNode.contains(target)) {\n return 'track';\n }\n\n // Test the decrement button.\n if (scrollBar.decrementNode.contains(target)) {\n return 'decrement';\n }\n\n // Test the increment button.\n if (scrollBar.incrementNode.contains(target)) {\n return 'increment';\n }\n\n // Indicate no match.\n return null;\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { MessageLoop } from '@lumino/messaging';\n\nimport { Layout } from './layout';\n\nimport { Widget } from './widget';\n\n/**\n * A concrete layout implementation which holds a single widget.\n *\n * #### Notes\n * This class is useful for creating simple container widgets which\n * hold a single child. The child should be positioned with CSS.\n */\nexport class SingletonLayout extends Layout {\n /**\n * Dispose of the resources held by the layout.\n */\n dispose(): void {\n if (this._widget) {\n let widget = this._widget;\n this._widget = null;\n widget.dispose();\n }\n super.dispose();\n }\n\n /**\n * Get the child widget for the layout.\n */\n get widget(): Widget | null {\n return this._widget;\n }\n\n /**\n * Set the child widget for the layout.\n *\n * #### Notes\n * Setting the child widget will cause the old child widget to be\n * automatically disposed. If that is not desired, set the parent\n * of the old child to `null` before assigning a new child.\n */\n set widget(widget: Widget | null) {\n // Remove the widget from its current parent. This is a no-op\n // if the widget's parent is already the layout parent widget.\n if (widget) {\n widget.parent = this.parent;\n }\n\n // Bail early if the widget does not change.\n if (this._widget === widget) {\n return;\n }\n\n // Dispose of the old child widget.\n if (this._widget) {\n this._widget.dispose();\n }\n\n // Update the internal widget.\n this._widget = widget;\n\n // Attach the new child widget if needed.\n if (this.parent && widget) {\n this.attachWidget(widget);\n }\n }\n\n /**\n * Create an iterator over the widgets in the layout.\n *\n * @returns A new iterator over the widgets in the layout.\n */\n *[Symbol.iterator](): IterableIterator {\n if (this._widget) {\n yield this._widget;\n }\n }\n\n /**\n * Remove a widget from the layout.\n *\n * @param widget - The widget to remove from the layout.\n *\n * #### Notes\n * A widget is automatically removed from the layout when its `parent`\n * is set to `null`. This method should only be invoked directly when\n * removing a widget from a layout which has yet to be installed on a\n * parent widget.\n *\n * This method does *not* modify the widget's `parent`.\n */\n removeWidget(widget: Widget): void {\n // Bail early if the widget does not exist in the layout.\n if (this._widget !== widget) {\n return;\n }\n\n // Clear the internal widget.\n this._widget = null;\n\n // If the layout is parented, detach the widget from the DOM.\n if (this.parent) {\n this.detachWidget(widget);\n }\n }\n\n /**\n * Perform layout initialization which requires the parent widget.\n */\n protected init(): void {\n super.init();\n for (const widget of this) {\n this.attachWidget(widget);\n }\n }\n\n /**\n * Attach a widget to the parent's DOM node.\n *\n * @param widget - The widget to attach to the parent.\n *\n * #### Notes\n * This method is called automatically by the single layout at the\n * appropriate time. It should not be called directly by user code.\n *\n * The default implementation adds the widgets's node to the parent's\n * node at the proper location, and sends the appropriate attach\n * messages to the widget if the parent is attached to the DOM.\n *\n * Subclasses may reimplement this method to control how the widget's\n * node is added to the parent's node.\n */\n protected attachWidget(widget: Widget): void {\n // Send a `'before-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n }\n\n // Add the widget's node to the parent.\n this.parent!.node.appendChild(widget.node);\n\n // Send an `'after-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n }\n\n /**\n * Detach a widget from the parent's DOM node.\n *\n * @param widget - The widget to detach from the parent.\n *\n * #### Notes\n * This method is called automatically by the single layout at the\n * appropriate time. It should not be called directly by user code.\n *\n * The default implementation removes the widget's node from the\n * parent's node, and sends the appropriate detach messages to the\n * widget if the parent is attached to the DOM.\n *\n * Subclasses may reimplement this method to control how the widget's\n * node is removed from the parent's node.\n */\n protected detachWidget(widget: Widget): void {\n // Send a `'before-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n }\n\n // Remove the widget's node from the parent.\n this.parent!.node.removeChild(widget.node);\n\n // Send an `'after-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n }\n\n private _widget: Widget | null = null;\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { Layout, LayoutItem } from './layout';\n\nimport { PanelLayout } from './panellayout';\n\nimport { Widget } from './widget';\n\n/**\n * A layout where visible widgets are stacked atop one another.\n *\n * #### Notes\n * The Z-order of the visible widgets follows their layout order.\n */\nexport class StackedLayout extends PanelLayout {\n constructor(options: StackedLayout.IOptions = {}) {\n super(options);\n this._hiddenMode =\n options.hiddenMode !== undefined\n ? options.hiddenMode\n : Widget.HiddenMode.Display;\n }\n\n /**\n * The method for hiding widgets.\n *\n * #### Notes\n * If there is only one child widget, `Display` hiding mode will be used\n * regardless of this setting.\n */\n get hiddenMode(): Widget.HiddenMode {\n return this._hiddenMode;\n }\n\n /**\n * Set the method for hiding widgets.\n *\n * #### Notes\n * If there is only one child widget, `Display` hiding mode will be used\n * regardless of this setting.\n */\n set hiddenMode(v: Widget.HiddenMode) {\n if (this._hiddenMode === v) {\n return;\n }\n this._hiddenMode = v;\n if (this.widgets.length > 1) {\n this.widgets.forEach(w => {\n w.hiddenMode = this._hiddenMode;\n });\n }\n }\n\n /**\n * Dispose of the resources held by the layout.\n */\n dispose(): void {\n // Dispose of the layout items.\n for (const item of this._items) {\n item.dispose();\n }\n\n // Clear the layout state.\n this._box = null;\n this._items.length = 0;\n\n // Dispose of the rest of the layout.\n super.dispose();\n }\n\n /**\n * Attach a widget to the parent's DOM node.\n *\n * @param index - The current index of the widget in the layout.\n *\n * @param widget - The widget to attach to the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected attachWidget(index: number, widget: Widget): void {\n // Using transform create an additional layer in the pixel pipeline\n // to limit the number of layer, it is set only if there is more than one widget.\n if (\n this._hiddenMode === Widget.HiddenMode.Scale &&\n this._items.length > 0\n ) {\n if (this._items.length === 1) {\n this.widgets[0].hiddenMode = Widget.HiddenMode.Scale;\n }\n widget.hiddenMode = Widget.HiddenMode.Scale;\n } else {\n widget.hiddenMode = Widget.HiddenMode.Display;\n }\n\n // Create and add a new layout item for the widget.\n ArrayExt.insert(this._items, index, new LayoutItem(widget));\n\n // Send a `'before-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n }\n\n // Add the widget's node to the parent.\n this.parent!.node.appendChild(widget.node);\n\n // Send an `'after-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n\n // Post a fit request for the parent widget.\n this.parent!.fit();\n }\n\n /**\n * Move a widget in the parent's DOM node.\n *\n * @param fromIndex - The previous index of the widget in the layout.\n *\n * @param toIndex - The current index of the widget in the layout.\n *\n * @param widget - The widget to move in the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected moveWidget(\n fromIndex: number,\n toIndex: number,\n widget: Widget\n ): void {\n // Move the layout item for the widget.\n ArrayExt.move(this._items, fromIndex, toIndex);\n\n // Post an update request for the parent widget.\n this.parent!.update();\n }\n\n /**\n * Detach a widget from the parent's DOM node.\n *\n * @param index - The previous index of the widget in the layout.\n *\n * @param widget - The widget to detach from the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected detachWidget(index: number, widget: Widget): void {\n // Remove the layout item for the widget.\n let item = ArrayExt.removeAt(this._items, index);\n\n // Send a `'before-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n }\n\n // Remove the widget's node from the parent.\n this.parent!.node.removeChild(widget.node);\n\n // Send an `'after-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n\n // Reset the z-index for the widget.\n item!.widget.node.style.zIndex = '';\n\n // Reset the hidden mode for the widget.\n if (this._hiddenMode === Widget.HiddenMode.Scale) {\n widget.hiddenMode = Widget.HiddenMode.Display;\n\n // Reset the hidden mode for the first widget if necessary.\n if (this._items.length === 1) {\n this._items[0].widget.hiddenMode = Widget.HiddenMode.Display;\n }\n }\n\n // Dispose of the layout item.\n item!.dispose();\n\n // Post a fit request for the parent widget.\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'before-show'` message.\n */\n protected onBeforeShow(msg: Message): void {\n super.onBeforeShow(msg);\n this.parent!.update();\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n super.onBeforeAttach(msg);\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-shown'` message.\n */\n protected onChildShown(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-hidden'` message.\n */\n protected onChildHidden(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'resize'` message.\n */\n protected onResize(msg: Widget.ResizeMessage): void {\n if (this.parent!.isVisible) {\n this._update(msg.width, msg.height);\n }\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n protected onUpdateRequest(msg: Message): void {\n if (this.parent!.isVisible) {\n this._update(-1, -1);\n }\n }\n\n /**\n * A message handler invoked on a `'fit-request'` message.\n */\n protected onFitRequest(msg: Message): void {\n if (this.parent!.isAttached) {\n this._fit();\n }\n }\n\n /**\n * Fit the layout to the total size required by the widgets.\n */\n private _fit(): void {\n // Set up the computed minimum size.\n let minW = 0;\n let minH = 0;\n\n // Update the computed minimum size.\n for (let i = 0, n = this._items.length; i < n; ++i) {\n // Fetch the item.\n let item = this._items[i];\n\n // Ignore hidden items.\n if (item.isHidden) {\n continue;\n }\n\n // Update the size limits for the item.\n item.fit();\n\n // Update the computed minimum size.\n minW = Math.max(minW, item.minWidth);\n minH = Math.max(minH, item.minHeight);\n }\n\n // Update the box sizing and add it to the computed min size.\n let box = (this._box = ElementExt.boxSizing(this.parent!.node));\n minW += box.horizontalSum;\n minH += box.verticalSum;\n\n // Update the parent's min size constraints.\n let style = this.parent!.node.style;\n style.minWidth = `${minW}px`;\n style.minHeight = `${minH}px`;\n\n // Set the dirty flag to ensure only a single update occurs.\n this._dirty = true;\n\n // Notify the ancestor that it should fit immediately. This may\n // cause a resize of the parent, fulfilling the required update.\n if (this.parent!.parent) {\n MessageLoop.sendMessage(this.parent!.parent!, Widget.Msg.FitRequest);\n }\n\n // If the dirty flag is still set, the parent was not resized.\n // Trigger the required update on the parent widget immediately.\n if (this._dirty) {\n MessageLoop.sendMessage(this.parent!, Widget.Msg.UpdateRequest);\n }\n }\n\n /**\n * Update the layout position and size of the widgets.\n *\n * The parent offset dimensions should be `-1` if unknown.\n */\n private _update(offsetWidth: number, offsetHeight: number): void {\n // Clear the dirty flag to indicate the update occurred.\n this._dirty = false;\n\n // Compute the visible item count.\n let nVisible = 0;\n for (let i = 0, n = this._items.length; i < n; ++i) {\n nVisible += +!this._items[i].isHidden;\n }\n\n // Bail early if there are no visible items to layout.\n if (nVisible === 0) {\n return;\n }\n\n // Measure the parent if the offset dimensions are unknown.\n if (offsetWidth < 0) {\n offsetWidth = this.parent!.node.offsetWidth;\n }\n if (offsetHeight < 0) {\n offsetHeight = this.parent!.node.offsetHeight;\n }\n\n // Ensure the parent box sizing data is computed.\n if (!this._box) {\n this._box = ElementExt.boxSizing(this.parent!.node);\n }\n\n // Compute the actual layout bounds adjusted for border and padding.\n let top = this._box.paddingTop;\n let left = this._box.paddingLeft;\n let width = offsetWidth - this._box.horizontalSum;\n let height = offsetHeight - this._box.verticalSum;\n\n // Update the widget stacking order and layout geometry.\n for (let i = 0, n = this._items.length; i < n; ++i) {\n // Fetch the item.\n let item = this._items[i];\n\n // Ignore hidden items.\n if (item.isHidden) {\n continue;\n }\n\n // Set the z-index for the widget.\n item.widget.node.style.zIndex = `${i}`;\n\n // Update the item geometry.\n item.update(left, top, width, height);\n }\n }\n\n private _dirty = false;\n private _items: LayoutItem[] = [];\n private _box: ElementExt.IBoxSizing | null = null;\n private _hiddenMode: Widget.HiddenMode;\n}\n\n/**\n * The namespace for the `StackedLayout` class statics.\n */\nexport namespace StackedLayout {\n /**\n * An options object for initializing a stacked layout.\n */\n export interface IOptions extends Layout.IOptions {\n /**\n * The method for hiding widgets.\n *\n * The default is `Widget.HiddenMode.Display`.\n */\n hiddenMode?: Widget.HiddenMode;\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { Panel } from './panel';\n\nimport { StackedLayout } from './stackedlayout';\n\nimport { Widget } from './widget';\n\n/**\n * A panel where visible widgets are stacked atop one another.\n *\n * #### Notes\n * This class provides a convenience wrapper around a {@link StackedLayout}.\n */\nexport class StackedPanel extends Panel {\n /**\n * Construct a new stacked panel.\n *\n * @param options - The options for initializing the panel.\n */\n constructor(options: StackedPanel.IOptions = {}) {\n super({ layout: Private.createLayout(options) });\n this.addClass('lm-StackedPanel');\n }\n\n /**\n * The method for hiding widgets.\n *\n * #### Notes\n * If there is only one child widget, `Display` hiding mode will be used\n * regardless of this setting.\n */\n get hiddenMode(): Widget.HiddenMode {\n return (this.layout as StackedLayout).hiddenMode;\n }\n\n /**\n * Set the method for hiding widgets.\n *\n * #### Notes\n * If there is only one child widget, `Display` hiding mode will be used\n * regardless of this setting.\n */\n set hiddenMode(v: Widget.HiddenMode) {\n (this.layout as StackedLayout).hiddenMode = v;\n }\n\n /**\n * A signal emitted when a widget is removed from a stacked panel.\n */\n get widgetRemoved(): ISignal {\n return this._widgetRemoved;\n }\n\n /**\n * A message handler invoked on a `'child-added'` message.\n */\n protected onChildAdded(msg: Widget.ChildMessage): void {\n msg.child.addClass('lm-StackedPanel-child');\n }\n\n /**\n * A message handler invoked on a `'child-removed'` message.\n */\n protected onChildRemoved(msg: Widget.ChildMessage): void {\n msg.child.removeClass('lm-StackedPanel-child');\n this._widgetRemoved.emit(msg.child);\n }\n\n private _widgetRemoved = new Signal(this);\n}\n\n/**\n * The namespace for the `StackedPanel` class statics.\n */\nexport namespace StackedPanel {\n /**\n * An options object for creating a stacked panel.\n */\n export interface IOptions {\n /**\n * The stacked layout to use for the stacked panel.\n *\n * The default is a new `StackedLayout`.\n */\n layout?: StackedLayout;\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * Create a stacked layout for the given panel options.\n */\n export function createLayout(options: StackedPanel.IOptions): StackedLayout {\n return options.layout || new StackedLayout();\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { Platform } from '@lumino/domutils';\n\nimport { MessageLoop } from '@lumino/messaging';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { BoxLayout } from './boxlayout';\n\nimport { StackedPanel } from './stackedpanel';\n\nimport { TabBar } from './tabbar';\n\nimport { Widget } from './widget';\n\n/**\n * A widget which combines a `TabBar` and a `StackedPanel`.\n *\n * #### Notes\n * This is a simple panel which handles the common case of a tab bar\n * placed next to a content area. The selected tab controls the widget\n * which is shown in the content area.\n *\n * For use cases which require more control than is provided by this\n * panel, the `TabBar` widget may be used independently.\n */\nexport class TabPanel extends Widget {\n /**\n * Construct a new tab panel.\n *\n * @param options - The options for initializing the tab panel.\n */\n constructor(options: TabPanel.IOptions = {}) {\n super();\n this.addClass('lm-TabPanel');\n\n // Create the tab bar and stacked panel.\n this.tabBar = new TabBar(options);\n this.tabBar.addClass('lm-TabPanel-tabBar');\n this.stackedPanel = new StackedPanel();\n this.stackedPanel.addClass('lm-TabPanel-stackedPanel');\n\n // Connect the tab bar signal handlers.\n this.tabBar.tabMoved.connect(this._onTabMoved, this);\n this.tabBar.currentChanged.connect(this._onCurrentChanged, this);\n this.tabBar.tabCloseRequested.connect(this._onTabCloseRequested, this);\n this.tabBar.tabActivateRequested.connect(\n this._onTabActivateRequested,\n this\n );\n this.tabBar.addRequested.connect(this._onTabAddRequested, this);\n\n // Connect the stacked panel signal handlers.\n this.stackedPanel.widgetRemoved.connect(this._onWidgetRemoved, this);\n\n // Get the data related to the placement.\n this._tabPlacement = options.tabPlacement || 'top';\n let direction = Private.directionFromPlacement(this._tabPlacement);\n let orientation = Private.orientationFromPlacement(this._tabPlacement);\n\n // Configure the tab bar for the placement.\n this.tabBar.orientation = orientation;\n this.tabBar.dataset['placement'] = this._tabPlacement;\n\n // Create the box layout.\n let layout = new BoxLayout({ direction, spacing: 0 });\n\n // Set the stretch factors for the child widgets.\n BoxLayout.setStretch(this.tabBar, 0);\n BoxLayout.setStretch(this.stackedPanel, 1);\n\n // Add the child widgets to the layout.\n layout.addWidget(this.tabBar);\n layout.addWidget(this.stackedPanel);\n\n // Install the layout on the tab panel.\n this.layout = layout;\n }\n\n /**\n * A signal emitted when the current tab is changed.\n *\n * #### Notes\n * This signal is emitted when the currently selected tab is changed\n * either through user or programmatic interaction.\n *\n * Notably, this signal is not emitted when the index of the current\n * tab changes due to tabs being inserted, removed, or moved. It is\n * only emitted when the actual current tab node is changed.\n */\n get currentChanged(): ISignal {\n return this._currentChanged;\n }\n\n /**\n * Get the index of the currently selected tab.\n *\n * #### Notes\n * This will be `-1` if no tab is selected.\n */\n get currentIndex(): number {\n return this.tabBar.currentIndex;\n }\n\n /**\n * Set the index of the currently selected tab.\n *\n * #### Notes\n * If the index is out of range, it will be set to `-1`.\n */\n set currentIndex(value: number) {\n this.tabBar.currentIndex = value;\n }\n\n /**\n * Get the currently selected widget.\n *\n * #### Notes\n * This will be `null` if there is no selected tab.\n */\n get currentWidget(): Widget | null {\n let title = this.tabBar.currentTitle;\n return title ? title.owner : null;\n }\n\n /**\n * Set the currently selected widget.\n *\n * #### Notes\n * If the widget is not in the panel, it will be set to `null`.\n */\n set currentWidget(value: Widget | null) {\n this.tabBar.currentTitle = value ? value.title : null;\n }\n\n /**\n * Get the whether the tabs are movable by the user.\n *\n * #### Notes\n * Tabs can always be moved programmatically.\n */\n get tabsMovable(): boolean {\n return this.tabBar.tabsMovable;\n }\n\n /**\n * Set the whether the tabs are movable by the user.\n *\n * #### Notes\n * Tabs can always be moved programmatically.\n */\n set tabsMovable(value: boolean) {\n this.tabBar.tabsMovable = value;\n }\n\n /**\n * Get the whether the add button is enabled.\n *\n */\n get addButtonEnabled(): boolean {\n return this.tabBar.addButtonEnabled;\n }\n\n /**\n * Set the whether the add button is enabled.\n *\n */\n set addButtonEnabled(value: boolean) {\n this.tabBar.addButtonEnabled = value;\n }\n\n /**\n * Get the tab placement for the tab panel.\n *\n * #### Notes\n * This controls the position of the tab bar relative to the content.\n */\n get tabPlacement(): TabPanel.TabPlacement {\n return this._tabPlacement;\n }\n\n /**\n * Set the tab placement for the tab panel.\n *\n * #### Notes\n * This controls the position of the tab bar relative to the content.\n */\n set tabPlacement(value: TabPanel.TabPlacement) {\n // Bail if the placement does not change.\n if (this._tabPlacement === value) {\n return;\n }\n\n // Update the internal value.\n this._tabPlacement = value;\n\n // Get the values related to the placement.\n let direction = Private.directionFromPlacement(value);\n let orientation = Private.orientationFromPlacement(value);\n\n // Configure the tab bar for the placement.\n this.tabBar.orientation = orientation;\n this.tabBar.dataset['placement'] = value;\n\n // Update the layout direction.\n (this.layout as BoxLayout).direction = direction;\n }\n\n /**\n * A signal emitted when the add button on a tab bar is clicked.\n *\n */\n get addRequested(): ISignal> {\n return this._addRequested;\n }\n\n /**\n * The tab bar used by the tab panel.\n *\n * #### Notes\n * Modifying the tab bar directly can lead to undefined behavior.\n */\n readonly tabBar: TabBar;\n\n /**\n * The stacked panel used by the tab panel.\n *\n * #### Notes\n * Modifying the panel directly can lead to undefined behavior.\n */\n readonly stackedPanel: StackedPanel;\n\n /**\n * A read-only array of the widgets in the panel.\n */\n get widgets(): ReadonlyArray {\n return this.stackedPanel.widgets;\n }\n\n /**\n * Add a widget to the end of the tab panel.\n *\n * @param widget - The widget to add to the tab panel.\n *\n * #### Notes\n * If the widget is already contained in the panel, it will be moved.\n *\n * The widget's `title` is used to populate the tab.\n */\n addWidget(widget: Widget): void {\n this.insertWidget(this.widgets.length, widget);\n }\n\n /**\n * Insert a widget into the tab panel at a specified index.\n *\n * @param index - The index at which to insert the widget.\n *\n * @param widget - The widget to insert into to the tab panel.\n *\n * #### Notes\n * If the widget is already contained in the panel, it will be moved.\n *\n * The widget's `title` is used to populate the tab.\n */\n insertWidget(index: number, widget: Widget): void {\n if (widget !== this.currentWidget) {\n widget.hide();\n }\n this.stackedPanel.insertWidget(index, widget);\n this.tabBar.insertTab(index, widget.title);\n\n widget.node.setAttribute('role', 'tabpanel');\n\n let renderer = this.tabBar.renderer;\n if (renderer instanceof TabBar.Renderer) {\n let tabId = renderer.createTabKey({\n title: widget.title,\n current: false,\n zIndex: 0\n });\n widget.node.setAttribute('aria-labelledby', tabId);\n }\n }\n\n /**\n * Handle the `currentChanged` signal from the tab bar.\n */\n private _onCurrentChanged(\n sender: TabBar,\n args: TabBar.ICurrentChangedArgs\n ): void {\n // Extract the previous and current title from the args.\n let { previousIndex, previousTitle, currentIndex, currentTitle } = args;\n\n // Extract the widgets from the titles.\n let previousWidget = previousTitle ? previousTitle.owner : null;\n let currentWidget = currentTitle ? currentTitle.owner : null;\n\n // Hide the previous widget.\n if (previousWidget) {\n previousWidget.hide();\n }\n\n // Show the current widget.\n if (currentWidget) {\n currentWidget.show();\n }\n\n // Emit the `currentChanged` signal for the tab panel.\n this._currentChanged.emit({\n previousIndex,\n previousWidget,\n currentIndex,\n currentWidget\n });\n\n // Flush the message loop on IE and Edge to prevent flicker.\n if (Platform.IS_EDGE || Platform.IS_IE) {\n MessageLoop.flush();\n }\n }\n\n /**\n * Handle the `tabAddRequested` signal from the tab bar.\n */\n private _onTabAddRequested(sender: TabBar, args: void): void {\n this._addRequested.emit(sender);\n }\n\n /**\n * Handle the `tabActivateRequested` signal from the tab bar.\n */\n private _onTabActivateRequested(\n sender: TabBar,\n args: TabBar.ITabActivateRequestedArgs\n ): void {\n args.title.owner.activate();\n }\n\n /**\n * Handle the `tabCloseRequested` signal from the tab bar.\n */\n private _onTabCloseRequested(\n sender: TabBar,\n args: TabBar.ITabCloseRequestedArgs\n ): void {\n args.title.owner.close();\n }\n\n /**\n * Handle the `tabMoved` signal from the tab bar.\n */\n private _onTabMoved(\n sender: TabBar,\n args: TabBar.ITabMovedArgs\n ): void {\n this.stackedPanel.insertWidget(args.toIndex, args.title.owner);\n }\n\n /**\n * Handle the `widgetRemoved` signal from the stacked panel.\n */\n private _onWidgetRemoved(sender: StackedPanel, widget: Widget): void {\n widget.node.removeAttribute('role');\n widget.node.removeAttribute('aria-labelledby');\n this.tabBar.removeTab(widget.title);\n }\n\n private _tabPlacement: TabPanel.TabPlacement;\n private _currentChanged = new Signal(\n this\n );\n\n private _addRequested = new Signal>(this);\n}\n\n/**\n * The namespace for the `TabPanel` class statics.\n */\nexport namespace TabPanel {\n /**\n * A type alias for tab placement in a tab bar.\n */\n export type TabPlacement =\n | /**\n * The tabs are placed as a row above the content.\n */\n 'top'\n\n /**\n * The tabs are placed as a column to the left of the content.\n */\n | 'left'\n\n /**\n * The tabs are placed as a column to the right of the content.\n */\n | 'right'\n\n /**\n * The tabs are placed as a row below the content.\n */\n | 'bottom';\n\n /**\n * An options object for initializing a tab panel.\n */\n export interface IOptions {\n /**\n * The document to use with the tab panel.\n *\n * The default is the global `document` instance.\n */\n document?: Document | ShadowRoot;\n\n /**\n * Whether the tabs are movable by the user.\n *\n * The default is `false`.\n */\n tabsMovable?: boolean;\n\n /**\n * Whether the button to add new tabs is enabled.\n *\n * The default is `false`.\n */\n addButtonEnabled?: boolean;\n\n /**\n * The placement of the tab bar relative to the content.\n *\n * The default is `'top'`.\n */\n tabPlacement?: TabPlacement;\n\n /**\n * The renderer for the panel's tab bar.\n *\n * The default is a shared renderer instance.\n */\n renderer?: TabBar.IRenderer;\n }\n\n /**\n * The arguments object for the `currentChanged` signal.\n */\n export interface ICurrentChangedArgs {\n /**\n * The previously selected index.\n */\n previousIndex: number;\n\n /**\n * The previously selected widget.\n */\n previousWidget: Widget | null;\n\n /**\n * The currently selected index.\n */\n currentIndex: number;\n\n /**\n * The currently selected widget.\n */\n currentWidget: Widget | null;\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * Convert a tab placement to tab bar orientation.\n */\n export function orientationFromPlacement(\n plc: TabPanel.TabPlacement\n ): TabBar.Orientation {\n return placementToOrientationMap[plc];\n }\n\n /**\n * Convert a tab placement to a box layout direction.\n */\n export function directionFromPlacement(\n plc: TabPanel.TabPlacement\n ): BoxLayout.Direction {\n return placementToDirectionMap[plc];\n }\n\n /**\n * A mapping of tab placement to tab bar orientation.\n */\n const placementToOrientationMap: { [key: string]: TabBar.Orientation } = {\n top: 'horizontal',\n left: 'vertical',\n right: 'vertical',\n bottom: 'horizontal'\n };\n\n /**\n * A mapping of tab placement to box layout direction.\n */\n const placementToDirectionMap: { [key: string]: BoxLayout.Direction } = {\n top: 'top-to-bottom',\n left: 'left-to-right',\n right: 'right-to-left',\n bottom: 'bottom-to-top'\n };\n}\n"],"names":["Private","Utils"],"mappings":";;;;;;;;;;;;AAAA;AACA;AACA;;;;;;AAM+E;AAE/E;;;;;;;;;AASG;MACU,QAAQ,CAAA;AAArB,IAAA,WAAA,GAAA;AACE;;;;;;;;;;;;AAYG;QACH,IAAQ,CAAA,QAAA,GAAG,CAAC,CAAC;AAEb;;;;;;;;;;;;AAYG;QACH,IAAO,CAAA,OAAA,GAAG,CAAC,CAAC;AAEZ;;;;;;;;;;;;AAYG;QACH,IAAO,CAAA,OAAA,GAAG,QAAQ,CAAC;AAEnB;;;;;;;;;;;;;;;AAeG;QACH,IAAO,CAAA,OAAA,GAAG,CAAC,CAAC;AAEZ;;;;;;;;;;;AAWG;QACH,IAAI,CAAA,IAAA,GAAG,CAAC,CAAC;AAET;;;;;;;AAOG;QACH,IAAI,CAAA,IAAA,GAAG,KAAK,CAAC;KACd;AAAA,CAAA;AAED;;AAEG;AACG,IAAW,UA0XhB;AA1XD,CAAA,UAAiB,SAAS,EAAA;AACxB;;;;;;;;;;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,OAAO,EAAA;AACf;;AAEG;IACH,SAAgB,wBAAwB,CACtC,GAA0B,EAAA;AAE1B,QAAA,OAAO,yBAAyB,CAAC,GAAG,CAAC,CAAC;KACvC;AAJe,IAAA,OAAA,CAAA,wBAAwB,2BAIvC,CAAA;AAED;;AAEG;IACH,SAAgB,sBAAsB,CACpC,GAA0B,EAAA;AAE1B,QAAA,OAAO,uBAAuB,CAAC,GAAG,CAAC,CAAC;KACrC;AAJe,IAAA,OAAA,CAAA,sBAAsB,yBAIrC,CAAA;AAED;;AAEG;AACH,IAAA,MAAM,yBAAyB,GAA0C;AACvE,QAAA,GAAG,EAAE,YAAY;AACjB,QAAA,IAAI,EAAE,UAAU;AAChB,QAAA,KAAK,EAAE,UAAU;AACjB,QAAA,MAAM,EAAE,YAAY;KACrB,CAAC;AAEF;;AAEG;AACH,IAAA,MAAM,uBAAuB,GAA2C;AACtE,QAAA,GAAG,EAAE,eAAe;AACpB,QAAA,IAAI,EAAE,eAAe;AACrB,QAAA,KAAK,EAAE,eAAe;AACtB,QAAA,MAAM,EAAE,eAAe;KACxB,CAAC;AACJ,CAAC,EAtCS,OAAO,KAAP,OAAO,GAsChB,EAAA,CAAA,CAAA;;;;"} +\ No newline at end of file ++{"version":3,"file":"index.es6.js","sources":["../src/boxengine.ts","../src/title.ts","../src/widget.ts","../src/layout.ts","../src/panellayout.ts","../src/utils.ts","../src/splitlayout.ts","../src/accordionlayout.ts","../src/panel.ts","../src/splitpanel.ts","../src/accordionpanel.ts","../src/boxlayout.ts","../src/boxpanel.ts","../src/commandpalette.ts","../src/menu.ts","../src/contextmenu.ts","../src/tabbar.ts","../src/docklayout.ts","../src/dockpanel.ts","../src/focustracker.ts","../src/gridlayout.ts","../src/menubar.ts","../src/scrollbar.ts","../src/singletonlayout.ts","../src/stackedlayout.ts","../src/stackedpanel.ts","../src/tabpanel.ts"],"sourcesContent":["// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n\n/**\n * A sizer object for use with the box engine layout functions.\n *\n * #### Notes\n * A box sizer holds the geometry information for an object along an\n * arbitrary layout orientation.\n *\n * For best performance, this class should be treated as a raw data\n * struct. It should not typically be subclassed.\n */\nexport class BoxSizer {\n /**\n * The preferred size for the sizer.\n *\n * #### Notes\n * The sizer will be given this initial size subject to its size\n * bounds. The sizer will not deviate from this size unless such\n * deviation is required to fit into the available layout space.\n *\n * There is no limit to this value, but it will be clamped to the\n * bounds defined by {@link minSize} and {@link maxSize}.\n *\n * The default value is `0`.\n */\n sizeHint = 0;\n\n /**\n * The minimum size of the sizer.\n *\n * #### Notes\n * The sizer will never be sized less than this value, even if\n * it means the sizer will overflow the available layout space.\n *\n * It is assumed that this value lies in the range `[0, Infinity)`\n * and that it is `<=` to {@link maxSize}. Failure to adhere to this\n * constraint will yield undefined results.\n *\n * The default value is `0`.\n */\n minSize = 0;\n\n /**\n * The maximum size of the sizer.\n *\n * #### Notes\n * The sizer will never be sized greater than this value, even if\n * it means the sizer will underflow the available layout space.\n *\n * It is assumed that this value lies in the range `[0, Infinity]`\n * and that it is `>=` to {@link minSize}. Failure to adhere to this\n * constraint will yield undefined results.\n *\n * The default value is `Infinity`.\n */\n maxSize = Infinity;\n\n /**\n * The stretch factor for the sizer.\n *\n * #### Notes\n * This controls how much the sizer stretches relative to its sibling\n * sizers when layout space is distributed. A stretch factor of zero\n * is special and will cause the sizer to only be resized after all\n * other sizers with a stretch factor greater than zero have been\n * resized to their limits.\n *\n * It is assumed that this value is an integer that lies in the range\n * `[0, Infinity)`. Failure to adhere to this constraint will yield\n * undefined results.\n *\n * The default value is `1`.\n */\n stretch = 1;\n\n /**\n * The computed size of the sizer.\n *\n * #### Notes\n * This value is the output of a call to {@link BoxEngine.calc}. It represents\n * the computed size for the object along the layout orientation,\n * and will always lie in the range `[minSize, maxSize]`.\n *\n * This value is output only.\n *\n * Changing this value will have no effect.\n */\n size = 0;\n\n /**\n * An internal storage property for the layout algorithm.\n *\n * #### Notes\n * This value is used as temporary storage by the layout algorithm.\n *\n * Changing this value will have no effect.\n */\n done = false;\n}\n\n/**\n * The namespace for the box engine layout functions.\n */\nexport namespace BoxEngine {\n /**\n * Calculate the optimal layout sizes for a sequence of box sizers.\n *\n * This distributes the available layout space among the box sizers\n * according to the following algorithm:\n *\n * 1. Initialize the sizers's size to its size hint and compute the\n * sums for each of size hint, min size, and max size.\n *\n * 2. If the total size hint equals the available space, return.\n *\n * 3. If the available space is less than the total min size, set all\n * sizers to their min size and return.\n *\n * 4. If the available space is greater than the total max size, set\n * all sizers to their max size and return.\n *\n * 5. If the layout space is less than the total size hint, distribute\n * the negative delta as follows:\n *\n * a. Shrink each sizer with a stretch factor greater than zero by\n * an amount proportional to the negative space and the sum of\n * stretch factors. If the sizer reaches its min size, remove\n * it and its stretch factor from the computation.\n *\n * b. If after adjusting all stretch sizers there remains negative\n * space, distribute the space equally among the sizers with a\n * stretch factor of zero. If a sizer reaches its min size,\n * remove it from the computation.\n *\n * 6. If the layout space is greater than the total size hint,\n * distribute the positive delta as follows:\n *\n * a. Expand each sizer with a stretch factor greater than zero by\n * an amount proportional to the postive space and the sum of\n * stretch factors. If the sizer reaches its max size, remove\n * it and its stretch factor from the computation.\n *\n * b. If after adjusting all stretch sizers there remains positive\n * space, distribute the space equally among the sizers with a\n * stretch factor of zero. If a sizer reaches its max size,\n * remove it from the computation.\n *\n * 7. return\n *\n * @param sizers - The sizers for a particular layout line.\n *\n * @param space - The available layout space for the sizers.\n *\n * @returns The delta between the provided available space and the\n * actual consumed space. This value will be zero if the sizers\n * can be adjusted to fit, negative if the available space is too\n * small, and positive if the available space is too large.\n *\n * #### Notes\n * The {@link BoxSizer.size} of each sizer is updated with the computed size.\n *\n * This function can be called at any time to recompute the layout for\n * an existing sequence of sizers. The previously computed results will\n * have no effect on the new output. It is therefore not necessary to\n * create new sizer objects on each resize event.\n */\n export function calc(sizers: ArrayLike, space: number): number {\n // Bail early if there is nothing to do.\n let count = sizers.length;\n if (count === 0) {\n return space;\n }\n\n // Setup the size and stretch counters.\n let totalMin = 0;\n let totalMax = 0;\n let totalSize = 0;\n let totalStretch = 0;\n let stretchCount = 0;\n\n // Setup the sizers and compute the totals.\n for (let i = 0; i < count; ++i) {\n let sizer = sizers[i];\n let min = sizer.minSize;\n let max = sizer.maxSize;\n let hint = sizer.sizeHint;\n sizer.done = false;\n sizer.size = Math.max(min, Math.min(hint, max));\n totalSize += sizer.size;\n totalMin += min;\n totalMax += max;\n if (sizer.stretch > 0) {\n totalStretch += sizer.stretch;\n stretchCount++;\n }\n }\n\n // If the space is equal to the total size, return early.\n if (space === totalSize) {\n return 0;\n }\n\n // If the space is less than the total min, minimize each sizer.\n if (space <= totalMin) {\n for (let i = 0; i < count; ++i) {\n let sizer = sizers[i];\n sizer.size = sizer.minSize;\n }\n return space - totalMin;\n }\n\n // If the space is greater than the total max, maximize each sizer.\n if (space >= totalMax) {\n for (let i = 0; i < count; ++i) {\n let sizer = sizers[i];\n sizer.size = sizer.maxSize;\n }\n return space - totalMax;\n }\n\n // The loops below perform sub-pixel precision sizing. A near zero\n // value is used for compares instead of zero to ensure that the\n // loop terminates when the subdivided space is reasonably small.\n let nearZero = 0.01;\n\n // A counter which is decremented each time a sizer is resized to\n // its limit. This ensures the loops terminate even if there is\n // space remaining to distribute.\n let notDoneCount = count;\n\n // Distribute negative delta space.\n if (space < totalSize) {\n // Shrink each stretchable sizer by an amount proportional to its\n // stretch factor. If a sizer reaches its min size it's marked as\n // done. The loop progresses in phases where each sizer is given\n // a chance to consume its fair share for the pass, regardless of\n // whether a sizer before it reached its limit. This continues\n // until the stretchable sizers or the free space is exhausted.\n let freeSpace = totalSize - space;\n while (stretchCount > 0 && freeSpace > nearZero) {\n let distSpace = freeSpace;\n let distStretch = totalStretch;\n for (let i = 0; i < count; ++i) {\n let sizer = sizers[i];\n if (sizer.done || sizer.stretch === 0) {\n continue;\n }\n let amt = (sizer.stretch * distSpace) / distStretch;\n if (sizer.size - amt <= sizer.minSize) {\n freeSpace -= sizer.size - sizer.minSize;\n totalStretch -= sizer.stretch;\n sizer.size = sizer.minSize;\n sizer.done = true;\n notDoneCount--;\n stretchCount--;\n } else {\n freeSpace -= amt;\n sizer.size -= amt;\n }\n }\n }\n // Distribute any remaining space evenly among the non-stretchable\n // sizers. This progresses in phases in the same manner as above.\n while (notDoneCount > 0 && freeSpace > nearZero) {\n let amt = freeSpace / notDoneCount;\n for (let i = 0; i < count; ++i) {\n let sizer = sizers[i];\n if (sizer.done) {\n continue;\n }\n if (sizer.size - amt <= sizer.minSize) {\n freeSpace -= sizer.size - sizer.minSize;\n sizer.size = sizer.minSize;\n sizer.done = true;\n notDoneCount--;\n } else {\n freeSpace -= amt;\n sizer.size -= amt;\n }\n }\n }\n }\n // Distribute positive delta space.\n else {\n // Expand each stretchable sizer by an amount proportional to its\n // stretch factor. If a sizer reaches its max size it's marked as\n // done. The loop progresses in phases where each sizer is given\n // a chance to consume its fair share for the pass, regardless of\n // whether a sizer before it reached its limit. This continues\n // until the stretchable sizers or the free space is exhausted.\n let freeSpace = space - totalSize;\n while (stretchCount > 0 && freeSpace > nearZero) {\n let distSpace = freeSpace;\n let distStretch = totalStretch;\n for (let i = 0; i < count; ++i) {\n let sizer = sizers[i];\n if (sizer.done || sizer.stretch === 0) {\n continue;\n }\n let amt = (sizer.stretch * distSpace) / distStretch;\n if (sizer.size + amt >= sizer.maxSize) {\n freeSpace -= sizer.maxSize - sizer.size;\n totalStretch -= sizer.stretch;\n sizer.size = sizer.maxSize;\n sizer.done = true;\n notDoneCount--;\n stretchCount--;\n } else {\n freeSpace -= amt;\n sizer.size += amt;\n }\n }\n }\n // Distribute any remaining space evenly among the non-stretchable\n // sizers. This progresses in phases in the same manner as above.\n while (notDoneCount > 0 && freeSpace > nearZero) {\n let amt = freeSpace / notDoneCount;\n for (let i = 0; i < count; ++i) {\n let sizer = sizers[i];\n if (sizer.done) {\n continue;\n }\n if (sizer.size + amt >= sizer.maxSize) {\n freeSpace -= sizer.maxSize - sizer.size;\n sizer.size = sizer.maxSize;\n sizer.done = true;\n notDoneCount--;\n } else {\n freeSpace -= amt;\n sizer.size += amt;\n }\n }\n }\n }\n\n // Indicate that the consumed space equals the available space.\n return 0;\n }\n\n /**\n * Adjust a sizer by a delta and update its neighbors accordingly.\n *\n * @param sizers - The sizers which should be adjusted.\n *\n * @param index - The index of the sizer to grow.\n *\n * @param delta - The amount to adjust the sizer, positive or negative.\n *\n * #### Notes\n * This will adjust the indicated sizer by the specified amount, along\n * with the sizes of the appropriate neighbors, subject to the limits\n * specified by each of the sizers.\n *\n * This is useful when implementing box layouts where the boundaries\n * between the sizers are interactively adjustable by the user.\n */\n export function adjust(\n sizers: ArrayLike,\n index: number,\n delta: number\n ): void {\n // Bail early when there is nothing to do.\n if (sizers.length === 0 || delta === 0) {\n return;\n }\n\n // Dispatch to the proper implementation.\n if (delta > 0) {\n growSizer(sizers, index, delta);\n } else {\n shrinkSizer(sizers, index, -delta);\n }\n }\n\n /**\n * Grow a sizer by a positive delta and adjust neighbors.\n */\n function growSizer(\n sizers: ArrayLike,\n index: number,\n delta: number\n ): void {\n // Compute how much the items to the left can expand.\n let growLimit = 0;\n for (let i = 0; i <= index; ++i) {\n let sizer = sizers[i];\n growLimit += sizer.maxSize - sizer.size;\n }\n\n // Compute how much the items to the right can shrink.\n let shrinkLimit = 0;\n for (let i = index + 1, n = sizers.length; i < n; ++i) {\n let sizer = sizers[i];\n shrinkLimit += sizer.size - sizer.minSize;\n }\n\n // Clamp the delta adjustment to the limits.\n delta = Math.min(delta, growLimit, shrinkLimit);\n\n // Grow the sizers to the left by the delta.\n let grow = delta;\n for (let i = index; i >= 0 && grow > 0; --i) {\n let sizer = sizers[i];\n let limit = sizer.maxSize - sizer.size;\n if (limit >= grow) {\n sizer.sizeHint = sizer.size + grow;\n grow = 0;\n } else {\n sizer.sizeHint = sizer.size + limit;\n grow -= limit;\n }\n }\n\n // Shrink the sizers to the right by the delta.\n let shrink = delta;\n for (let i = index + 1, n = sizers.length; i < n && shrink > 0; ++i) {\n let sizer = sizers[i];\n let limit = sizer.size - sizer.minSize;\n if (limit >= shrink) {\n sizer.sizeHint = sizer.size - shrink;\n shrink = 0;\n } else {\n sizer.sizeHint = sizer.size - limit;\n shrink -= limit;\n }\n }\n }\n\n /**\n * Shrink a sizer by a positive delta and adjust neighbors.\n */\n function shrinkSizer(\n sizers: ArrayLike,\n index: number,\n delta: number\n ): void {\n // Compute how much the items to the right can expand.\n let growLimit = 0;\n for (let i = index + 1, n = sizers.length; i < n; ++i) {\n let sizer = sizers[i];\n growLimit += sizer.maxSize - sizer.size;\n }\n\n // Compute how much the items to the left can shrink.\n let shrinkLimit = 0;\n for (let i = 0; i <= index; ++i) {\n let sizer = sizers[i];\n shrinkLimit += sizer.size - sizer.minSize;\n }\n\n // Clamp the delta adjustment to the limits.\n delta = Math.min(delta, growLimit, shrinkLimit);\n\n // Grow the sizers to the right by the delta.\n let grow = delta;\n for (let i = index + 1, n = sizers.length; i < n && grow > 0; ++i) {\n let sizer = sizers[i];\n let limit = sizer.maxSize - sizer.size;\n if (limit >= grow) {\n sizer.sizeHint = sizer.size + grow;\n grow = 0;\n } else {\n sizer.sizeHint = sizer.size + limit;\n grow -= limit;\n }\n }\n\n // Shrink the sizers to the left by the delta.\n let shrink = delta;\n for (let i = index; i >= 0 && shrink > 0; --i) {\n let sizer = sizers[i];\n let limit = sizer.size - sizer.minSize;\n if (limit >= shrink) {\n sizer.sizeHint = sizer.size - shrink;\n shrink = 0;\n } else {\n sizer.sizeHint = sizer.size - limit;\n shrink -= limit;\n }\n }\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { IDisposable } from '@lumino/disposable';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { VirtualElement } from '@lumino/virtualdom';\n\n/**\n * An object which holds data related to an object's title.\n *\n * #### Notes\n * A title object is intended to hold the data necessary to display a\n * header for a particular object. A common example is the `TabPanel`,\n * which uses the widget title to populate the tab for a child widget.\n *\n * It is the responsibility of the owner to call the title disposal.\n */\nexport class Title implements IDisposable {\n /**\n * Construct a new title.\n *\n * @param options - The options for initializing the title.\n */\n constructor(options: Title.IOptions) {\n this.owner = options.owner;\n if (options.label !== undefined) {\n this._label = options.label;\n }\n if (options.mnemonic !== undefined) {\n this._mnemonic = options.mnemonic;\n }\n if (options.icon !== undefined) {\n this._icon = options.icon;\n }\n\n if (options.iconClass !== undefined) {\n this._iconClass = options.iconClass;\n }\n if (options.iconLabel !== undefined) {\n this._iconLabel = options.iconLabel;\n }\n if (options.caption !== undefined) {\n this._caption = options.caption;\n }\n if (options.className !== undefined) {\n this._className = options.className;\n }\n if (options.closable !== undefined) {\n this._closable = options.closable;\n }\n this._dataset = options.dataset || {};\n }\n\n /**\n * A signal emitted when the state of the title changes.\n */\n get changed(): ISignal {\n return this._changed;\n }\n\n /**\n * The object which owns the title.\n */\n readonly owner: T;\n\n /**\n * Get the label for the title.\n *\n * #### Notes\n * The default value is an empty string.\n */\n get label(): string {\n return this._label;\n }\n\n /**\n * Set the label for the title.\n */\n set label(value: string) {\n if (this._label === value) {\n return;\n }\n this._label = value;\n this._changed.emit(undefined);\n }\n\n /**\n * Get the mnemonic index for the title.\n *\n * #### Notes\n * The default value is `-1`.\n */\n get mnemonic(): number {\n return this._mnemonic;\n }\n\n /**\n * Set the mnemonic index for the title.\n */\n set mnemonic(value: number) {\n if (this._mnemonic === value) {\n return;\n }\n this._mnemonic = value;\n this._changed.emit(undefined);\n }\n\n /**\n * Get the icon renderer for the title.\n *\n * #### Notes\n * The default value is undefined.\n */\n get icon(): VirtualElement.IRenderer | undefined {\n return this._icon;\n }\n\n /**\n * Set the icon renderer for the title.\n *\n * #### Notes\n * A renderer is an object that supplies a render and unrender function.\n */\n set icon(value: VirtualElement.IRenderer | undefined) {\n if (this._icon === value) {\n return;\n }\n this._icon = value;\n this._changed.emit(undefined);\n }\n\n /**\n * Get the icon class name for the title.\n *\n * #### Notes\n * The default value is an empty string.\n */\n get iconClass(): string {\n return this._iconClass;\n }\n\n /**\n * Set the icon class name for the title.\n *\n * #### Notes\n * Multiple class names can be separated with whitespace.\n */\n set iconClass(value: string) {\n if (this._iconClass === value) {\n return;\n }\n this._iconClass = value;\n this._changed.emit(undefined);\n }\n\n /**\n * Get the icon label for the title.\n *\n * #### Notes\n * The default value is an empty string.\n */\n get iconLabel(): string {\n return this._iconLabel;\n }\n\n /**\n * Set the icon label for the title.\n *\n * #### Notes\n * Multiple class names can be separated with whitespace.\n */\n set iconLabel(value: string) {\n if (this._iconLabel === value) {\n return;\n }\n this._iconLabel = value;\n this._changed.emit(undefined);\n }\n\n /**\n * Get the caption for the title.\n *\n * #### Notes\n * The default value is an empty string.\n */\n get caption(): string {\n return this._caption;\n }\n\n /**\n * Set the caption for the title.\n */\n set caption(value: string) {\n if (this._caption === value) {\n return;\n }\n this._caption = value;\n this._changed.emit(undefined);\n }\n\n /**\n * Get the extra class name for the title.\n *\n * #### Notes\n * The default value is an empty string.\n */\n get className(): string {\n return this._className;\n }\n\n /**\n * Set the extra class name for the title.\n *\n * #### Notes\n * Multiple class names can be separated with whitespace.\n */\n set className(value: string) {\n if (this._className === value) {\n return;\n }\n this._className = value;\n this._changed.emit(undefined);\n }\n\n /**\n * Get the closable state for the title.\n *\n * #### Notes\n * The default value is `false`.\n */\n get closable(): boolean {\n return this._closable;\n }\n\n /**\n * Set the closable state for the title.\n *\n * #### Notes\n * This controls the presence of a close icon when applicable.\n */\n set closable(value: boolean) {\n if (this._closable === value) {\n return;\n }\n this._closable = value;\n this._changed.emit(undefined);\n }\n\n /**\n * Get the dataset for the title.\n *\n * #### Notes\n * The default value is an empty dataset.\n */\n get dataset(): Title.Dataset {\n return this._dataset;\n }\n\n /**\n * Set the dataset for the title.\n *\n * #### Notes\n * This controls the data attributes when applicable.\n */\n set dataset(value: Title.Dataset) {\n if (this._dataset === value) {\n return;\n }\n this._dataset = value;\n this._changed.emit(undefined);\n }\n\n /**\n * Test whether the title has been disposed.\n */\n get isDisposed(): boolean {\n return this._isDisposed;\n }\n\n /**\n * Dispose of the resources held by the title.\n *\n * #### Notes\n * It is the responsibility of the owner to call the title disposal.\n */\n dispose(): void {\n if (this.isDisposed) {\n return;\n }\n this._isDisposed = true;\n\n Signal.clearData(this);\n }\n\n private _label = '';\n private _caption = '';\n private _mnemonic = -1;\n private _icon: VirtualElement.IRenderer | undefined = undefined;\n private _iconClass = '';\n private _iconLabel = '';\n private _className = '';\n private _closable = false;\n private _dataset: Title.Dataset;\n private _changed = new Signal(this);\n private _isDisposed = false;\n}\n\n/**\n * The namespace for the `Title` class statics.\n */\nexport namespace Title {\n /**\n * A type alias for a simple immutable string dataset.\n */\n export type Dataset = { readonly [key: string]: string };\n\n /**\n * An options object for initializing a title.\n */\n export interface IOptions {\n /**\n * The object which owns the title.\n */\n owner: T;\n\n /**\n * The label for the title.\n */\n label?: string;\n\n /**\n * The mnemonic index for the title.\n */\n mnemonic?: number;\n\n /**\n * The icon renderer for the title.\n */\n icon?: VirtualElement.IRenderer;\n\n /**\n * The icon class name for the title.\n */\n iconClass?: string;\n\n /**\n * The icon label for the title.\n */\n iconLabel?: string;\n\n /**\n * The caption for the title.\n */\n caption?: string;\n\n /**\n * The extra class name for the title.\n */\n className?: string;\n\n /**\n * The closable state for the title.\n */\n closable?: boolean;\n\n /**\n * The dataset for the title.\n */\n dataset?: Dataset;\n }\n}\n","/* eslint-disable @typescript-eslint/no-empty-function */\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { IObservableDisposable } from '@lumino/disposable';\n\nimport {\n ConflatableMessage,\n IMessageHandler,\n Message,\n MessageLoop\n} from '@lumino/messaging';\n\nimport { AttachedProperty } from '@lumino/properties';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { Layout } from './layout';\n\nimport { Title } from './title';\n\n/**\n * The base class of the lumino widget hierarchy.\n *\n * #### Notes\n * This class will typically be subclassed in order to create a useful\n * widget. However, it can be used directly to host externally created\n * content.\n */\nexport class Widget implements IMessageHandler, IObservableDisposable {\n /**\n * Construct a new widget.\n *\n * @param options - The options for initializing the widget.\n */\n constructor(options: Widget.IOptions = {}) {\n this.node = Private.createNode(options);\n this.addClass('lm-Widget');\n }\n\n /**\n * Dispose of the widget and its descendant widgets.\n *\n * #### Notes\n * It is unsafe to use the widget after it has been disposed.\n *\n * All calls made to this method after the first are a no-op.\n */\n dispose(): void {\n // Do nothing if the widget is already disposed.\n if (this.isDisposed) {\n return;\n }\n\n // Set the disposed flag and emit the disposed signal.\n this.setFlag(Widget.Flag.IsDisposed);\n this._disposed.emit(undefined);\n\n // Remove or detach the widget if necessary.\n if (this.parent) {\n this.parent = null;\n } else if (this.isAttached) {\n Widget.detach(this);\n }\n\n // Dispose of the widget layout.\n if (this._layout) {\n this._layout.dispose();\n this._layout = null;\n }\n\n // Dispose the title\n this.title.dispose();\n\n // Clear the extra data associated with the widget.\n Signal.clearData(this);\n MessageLoop.clearData(this);\n AttachedProperty.clearData(this);\n }\n\n /**\n * A signal emitted when the widget is disposed.\n */\n get disposed(): ISignal {\n return this._disposed;\n }\n\n /**\n * Get the DOM node owned by the widget.\n */\n readonly node: HTMLElement;\n\n /**\n * Test whether the widget has been disposed.\n */\n get isDisposed(): boolean {\n return this.testFlag(Widget.Flag.IsDisposed);\n }\n\n /**\n * Test whether the widget's node is attached to the DOM.\n */\n get isAttached(): boolean {\n return this.testFlag(Widget.Flag.IsAttached);\n }\n\n /**\n * Test whether the widget is explicitly hidden.\n *\n * #### Notes\n * You should prefer `!{@link isVisible}` over `{@link isHidden}` if you want to know if the\n * widget is hidden as this does not test if the widget is hidden because one of its ancestors is hidden.\n */\n get isHidden(): boolean {\n return this.testFlag(Widget.Flag.IsHidden);\n }\n\n /**\n * Test whether the widget is visible.\n *\n * #### Notes\n * A widget is visible when it is attached to the DOM, is not\n * explicitly hidden, and has no explicitly hidden ancestors.\n *\n * Since 2.7.0, this does not rely on the {@link Widget.Flag.IsVisible} flag.\n * It recursively checks the visibility of all parent widgets.\n */\n get isVisible(): boolean {\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n let parent: Widget | null = this;\n do {\n if (parent.isHidden || !parent.isAttached) {\n return false;\n }\n parent = parent.parent;\n } while (parent != null);\n return true;\n }\n\n /**\n * The title object for the widget.\n *\n * #### Notes\n * The title object is used by some container widgets when displaying\n * the widget alongside some title, such as a tab panel or side bar.\n *\n * Since not all widgets will use the title, it is created on demand.\n *\n * The `owner` property of the title is set to this widget.\n */\n get title(): Title {\n return Private.titleProperty.get(this);\n }\n\n /**\n * Get the id of the widget's DOM node.\n */\n get id(): string {\n return this.node.id;\n }\n\n /**\n * Set the id of the widget's DOM node.\n */\n set id(value: string) {\n this.node.id = value;\n }\n\n /**\n * The dataset for the widget's DOM node.\n */\n get dataset(): DOMStringMap {\n return this.node.dataset;\n }\n\n /**\n * Get the method for hiding the widget.\n */\n get hiddenMode(): Widget.HiddenMode {\n return this._hiddenMode;\n }\n\n /**\n * Set the method for hiding the widget.\n */\n set hiddenMode(value: Widget.HiddenMode) {\n if (this._hiddenMode === value) {\n return;\n }\n\n if (this.isHidden) {\n // Reset styles set by previous mode.\n this._toggleHidden(false);\n }\n\n if (value == Widget.HiddenMode.Scale) {\n this.node.style.willChange = 'transform';\n } else {\n this.node.style.willChange = 'auto';\n }\n\n this._hiddenMode = value;\n\n if (this.isHidden) {\n // Set styles for new mode.\n this._toggleHidden(true);\n }\n }\n\n /**\n * Get the parent of the widget.\n */\n get parent(): Widget | null {\n return this._parent;\n }\n\n /**\n * Set the parent of the widget.\n *\n * #### Notes\n * Children are typically added to a widget by using a layout, which\n * means user code will not normally set the parent widget directly.\n *\n * The widget will be automatically removed from its old parent.\n *\n * This is a no-op if there is no effective parent change.\n */\n set parent(value: Widget | null) {\n if (this._parent === value) {\n return;\n }\n if (value && this.contains(value)) {\n throw new Error('Invalid parent widget.');\n }\n if (this._parent && !this._parent.isDisposed) {\n let msg = new Widget.ChildMessage('child-removed', this);\n MessageLoop.sendMessage(this._parent, msg);\n }\n this._parent = value;\n if (this._parent && !this._parent.isDisposed) {\n let msg = new Widget.ChildMessage('child-added', this);\n MessageLoop.sendMessage(this._parent, msg);\n }\n if (!this.isDisposed) {\n MessageLoop.sendMessage(this, Widget.Msg.ParentChanged);\n }\n }\n\n /**\n * Get the layout for the widget.\n */\n get layout(): Layout | null {\n return this._layout;\n }\n\n /**\n * Set the layout for the widget.\n *\n * #### Notes\n * The layout is single-use only. It cannot be changed after the\n * first assignment.\n *\n * The layout is disposed automatically when the widget is disposed.\n */\n set layout(value: Layout | null) {\n if (this._layout === value) {\n return;\n }\n if (this.testFlag(Widget.Flag.DisallowLayout)) {\n throw new Error('Cannot set widget layout.');\n }\n if (this._layout) {\n throw new Error('Cannot change widget layout.');\n }\n if (value!.parent) {\n throw new Error('Cannot change layout parent.');\n }\n this._layout = value;\n value!.parent = this;\n }\n\n /**\n * Create an iterator over the widget's children.\n *\n * @returns A new iterator over the children of the widget.\n *\n * #### Notes\n * The widget must have a populated layout in order to have children.\n *\n * If a layout is not installed, the returned iterator will be empty.\n */\n *children(): IterableIterator {\n if (this._layout) {\n yield* this._layout;\n }\n }\n\n /**\n * Test whether a widget is a descendant of this widget.\n *\n * @param widget - The descendant widget of interest.\n *\n * @returns `true` if the widget is a descendant, `false` otherwise.\n */\n contains(widget: Widget): boolean {\n for (let value: Widget | null = widget; value; value = value._parent) {\n if (value === this) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * Test whether the widget's DOM node has the given class name.\n *\n * @param name - The class name of interest.\n *\n * @returns `true` if the node has the class, `false` otherwise.\n */\n hasClass(name: string): boolean {\n return this.node.classList.contains(name);\n }\n\n /**\n * Add a class name to the widget's DOM node.\n *\n * @param name - The class name to add to the node.\n *\n * #### Notes\n * If the class name is already added to the node, this is a no-op.\n *\n * The class name must not contain whitespace.\n */\n addClass(name: string): void {\n this.node.classList.add(name);\n }\n\n /**\n * Remove a class name from the widget's DOM node.\n *\n * @param name - The class name to remove from the node.\n *\n * #### Notes\n * If the class name is not yet added to the node, this is a no-op.\n *\n * The class name must not contain whitespace.\n */\n removeClass(name: string): void {\n this.node.classList.remove(name);\n }\n\n /**\n * Toggle a class name on the widget's DOM node.\n *\n * @param name - The class name to toggle on the node.\n *\n * @param force - Whether to force add the class (`true`) or force\n * remove the class (`false`). If not provided, the presence of\n * the class will be toggled from its current state.\n *\n * @returns `true` if the class is now present, `false` otherwise.\n *\n * #### Notes\n * The class name must not contain whitespace.\n */\n toggleClass(name: string, force?: boolean): boolean {\n if (force === true) {\n this.node.classList.add(name);\n return true;\n }\n if (force === false) {\n this.node.classList.remove(name);\n return false;\n }\n return this.node.classList.toggle(name);\n }\n\n /**\n * Post an `'update-request'` message to the widget.\n *\n * #### Notes\n * This is a simple convenience method for posting the message.\n */\n update(): void {\n MessageLoop.postMessage(this, Widget.Msg.UpdateRequest);\n }\n\n /**\n * Post a `'fit-request'` message to the widget.\n *\n * #### Notes\n * This is a simple convenience method for posting the message.\n */\n fit(): void {\n MessageLoop.postMessage(this, Widget.Msg.FitRequest);\n }\n\n /**\n * Post an `'activate-request'` message to the widget.\n *\n * #### Notes\n * This is a simple convenience method for posting the message.\n */\n activate(): void {\n MessageLoop.postMessage(this, Widget.Msg.ActivateRequest);\n }\n\n /**\n * Send a `'close-request'` message to the widget.\n *\n * #### Notes\n * This is a simple convenience method for sending the message.\n */\n close(): void {\n MessageLoop.sendMessage(this, Widget.Msg.CloseRequest);\n }\n\n /**\n * Show the widget and make it visible to its parent widget.\n *\n * #### Notes\n * This causes the {@link isHidden} property to be `false`.\n *\n * If the widget is not explicitly hidden, this is a no-op.\n */\n show(): void {\n if (!this.testFlag(Widget.Flag.IsHidden)) {\n return;\n }\n if (this.isAttached && (!this.parent || this.parent.isVisible)) {\n MessageLoop.sendMessage(this, Widget.Msg.BeforeShow);\n }\n this.clearFlag(Widget.Flag.IsHidden);\n this._toggleHidden(false);\n\n if (this.isAttached && (!this.parent || this.parent.isVisible)) {\n MessageLoop.sendMessage(this, Widget.Msg.AfterShow);\n }\n if (this.parent) {\n let msg = new Widget.ChildMessage('child-shown', this);\n MessageLoop.sendMessage(this.parent, msg);\n }\n }\n\n /**\n * Hide the widget and make it hidden to its parent widget.\n *\n * #### Notes\n * This causes the {@link isHidden} property to be `true`.\n *\n * If the widget is explicitly hidden, this is a no-op.\n */\n hide(): void {\n if (this.testFlag(Widget.Flag.IsHidden)) {\n return;\n }\n if (this.isAttached && (!this.parent || this.parent.isVisible)) {\n MessageLoop.sendMessage(this, Widget.Msg.BeforeHide);\n }\n this.setFlag(Widget.Flag.IsHidden);\n this._toggleHidden(true);\n\n if (this.isAttached && (!this.parent || this.parent.isVisible)) {\n MessageLoop.sendMessage(this, Widget.Msg.AfterHide);\n }\n if (this.parent) {\n let msg = new Widget.ChildMessage('child-hidden', this);\n MessageLoop.sendMessage(this.parent, msg);\n }\n }\n\n /**\n * Show or hide the widget according to a boolean value.\n *\n * @param hidden - `true` to hide the widget, or `false` to show it.\n *\n * #### Notes\n * This is a convenience method for `hide()` and `show()`.\n */\n setHidden(hidden: boolean): void {\n if (hidden) {\n this.hide();\n } else {\n this.show();\n }\n }\n\n /**\n * Test whether the given widget flag is set.\n *\n * #### Notes\n * This will not typically be called directly by user code.\n *\n * Since 2.7.0, {@link Widget.Flag.IsVisible} is deprecated.\n * It will be removed in a future version.\n */\n testFlag(flag: Widget.Flag): boolean {\n return (this._flags & flag) !== 0;\n }\n\n /**\n * Set the given widget flag.\n *\n * #### Notes\n * This will not typically be called directly by user code.\n *\n * Since 2.7.0, {@link Widget.Flag.IsVisible} is deprecated.\n * It will be removed in a future version.\n */\n setFlag(flag: Widget.Flag): void {\n this._flags |= flag;\n }\n\n /**\n * Clear the given widget flag.\n *\n * #### Notes\n * This will not typically be called directly by user code.\n *\n * Since 2.7.0, {@link Widget.Flag.IsVisible} is deprecated.\n * It will be removed in a future version.\n */\n clearFlag(flag: Widget.Flag): void {\n this._flags &= ~flag;\n }\n\n /**\n * Process a message sent to the widget.\n *\n * @param msg - The message sent to the widget.\n *\n * #### Notes\n * Subclasses may reimplement this method as needed.\n */\n processMessage(msg: Message): void {\n switch (msg.type) {\n case 'resize':\n this.notifyLayout(msg);\n this.onResize(msg as Widget.ResizeMessage);\n break;\n case 'update-request':\n this.notifyLayout(msg);\n this.onUpdateRequest(msg);\n break;\n case 'fit-request':\n this.notifyLayout(msg);\n this.onFitRequest(msg);\n break;\n case 'before-show':\n this.notifyLayout(msg);\n this.onBeforeShow(msg);\n break;\n case 'after-show':\n this.setFlag(Widget.Flag.IsVisible);\n this.notifyLayout(msg);\n this.onAfterShow(msg);\n break;\n case 'before-hide':\n this.notifyLayout(msg);\n this.onBeforeHide(msg);\n break;\n case 'after-hide':\n this.clearFlag(Widget.Flag.IsVisible);\n this.notifyLayout(msg);\n this.onAfterHide(msg);\n break;\n case 'before-attach':\n this.notifyLayout(msg);\n this.onBeforeAttach(msg);\n break;\n case 'after-attach':\n if (!this.isHidden && (!this.parent || this.parent.isVisible)) {\n this.setFlag(Widget.Flag.IsVisible);\n }\n this.setFlag(Widget.Flag.IsAttached);\n this.notifyLayout(msg);\n this.onAfterAttach(msg);\n break;\n case 'before-detach':\n this.notifyLayout(msg);\n this.onBeforeDetach(msg);\n break;\n case 'after-detach':\n this.clearFlag(Widget.Flag.IsVisible);\n this.clearFlag(Widget.Flag.IsAttached);\n this.notifyLayout(msg);\n this.onAfterDetach(msg);\n break;\n case 'activate-request':\n this.notifyLayout(msg);\n this.onActivateRequest(msg);\n break;\n case 'close-request':\n this.notifyLayout(msg);\n this.onCloseRequest(msg);\n break;\n case 'child-added':\n this.notifyLayout(msg);\n this.onChildAdded(msg as Widget.ChildMessage);\n break;\n case 'child-removed':\n this.notifyLayout(msg);\n this.onChildRemoved(msg as Widget.ChildMessage);\n break;\n default:\n this.notifyLayout(msg);\n break;\n }\n }\n\n /**\n * Invoke the message processing routine of the widget's layout.\n *\n * @param msg - The message to dispatch to the layout.\n *\n * #### Notes\n * This is a no-op if the widget does not have a layout.\n *\n * This will not typically be called directly by user code.\n */\n protected notifyLayout(msg: Message): void {\n if (this._layout) {\n this._layout.processParentMessage(msg);\n }\n }\n\n /**\n * A message handler invoked on a `'close-request'` message.\n *\n * #### Notes\n * The default implementation unparents or detaches the widget.\n */\n protected onCloseRequest(msg: Message): void {\n if (this.parent) {\n this.parent = null;\n } else if (this.isAttached) {\n Widget.detach(this);\n }\n }\n\n /**\n * A message handler invoked on a `'resize'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onResize(msg: Widget.ResizeMessage): void {}\n\n /**\n * A message handler invoked on an `'update-request'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onUpdateRequest(msg: Message): void {}\n\n /**\n * A message handler invoked on a `'fit-request'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onFitRequest(msg: Message): void {}\n\n /**\n * A message handler invoked on an `'activate-request'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onActivateRequest(msg: Message): void {}\n\n /**\n * A message handler invoked on a `'before-show'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onBeforeShow(msg: Message): void {}\n\n /**\n * A message handler invoked on an `'after-show'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onAfterShow(msg: Message): void {}\n\n /**\n * A message handler invoked on a `'before-hide'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onBeforeHide(msg: Message): void {}\n\n /**\n * A message handler invoked on an `'after-hide'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onAfterHide(msg: Message): void {}\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onBeforeAttach(msg: Message): void {}\n\n /**\n * A message handler invoked on an `'after-attach'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onAfterAttach(msg: Message): void {}\n\n /**\n * A message handler invoked on a `'before-detach'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onBeforeDetach(msg: Message): void {}\n\n /**\n * A message handler invoked on an `'after-detach'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onAfterDetach(msg: Message): void {}\n\n /**\n * A message handler invoked on a `'child-added'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onChildAdded(msg: Widget.ChildMessage): void {}\n\n /**\n * A message handler invoked on a `'child-removed'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onChildRemoved(msg: Widget.ChildMessage): void {}\n\n private _toggleHidden(hidden: boolean) {\n if (hidden) {\n switch (this._hiddenMode) {\n case Widget.HiddenMode.Display:\n this.addClass('lm-mod-hidden');\n break;\n case Widget.HiddenMode.Scale:\n this.node.style.transform = 'scale(0)';\n this.node.setAttribute('aria-hidden', 'true');\n break;\n case Widget.HiddenMode.ContentVisibility:\n // @ts-expect-error content-visibility unknown by DOM lib types\n this.node.style.contentVisibility = 'hidden';\n this.node.style.zIndex = '-1';\n break;\n }\n } else {\n switch (this._hiddenMode) {\n case Widget.HiddenMode.Display:\n this.removeClass('lm-mod-hidden');\n break;\n case Widget.HiddenMode.Scale:\n this.node.style.transform = '';\n this.node.removeAttribute('aria-hidden');\n break;\n case Widget.HiddenMode.ContentVisibility:\n // @ts-expect-error content-visibility unknown by DOM lib types\n this.node.style.contentVisibility = '';\n this.node.style.zIndex = '';\n break;\n }\n }\n }\n\n private _flags = 0;\n private _layout: Layout | null = null;\n private _parent: Widget | null = null;\n private _disposed = new Signal(this);\n private _hiddenMode: Widget.HiddenMode = Widget.HiddenMode.Display;\n}\n\n/**\n * The namespace for the `Widget` class statics.\n */\nexport namespace Widget {\n /**\n * An options object for initializing a widget.\n */\n export interface IOptions {\n /**\n * The optional node to use for the widget.\n *\n * If a node is provided, the widget will assume full ownership\n * and control of the node, as if it had created the node itself.\n *\n * The default is a new `
`.\n */\n node?: HTMLElement;\n\n /**\n * The optional element tag, used for constructing the widget's node.\n *\n * If a pre-constructed node is provided via the `node` arg, this\n * value is ignored.\n */\n tag?: keyof HTMLElementTagNameMap;\n }\n\n /**\n * The method for hiding the widget.\n *\n * The default is Display.\n *\n * Using `Scale` will often increase performance as most browsers will not\n * trigger style computation for the `transform` action. This should be used\n * sparingly and tested, since increasing the number of composition layers\n * may slow things down.\n *\n * To ensure the transformation does not trigger style recomputation, you\n * may need to set the widget CSS style `will-change: transform`. This\n * should be used only when needed as it may overwhelm the browser with a\n * high number of layers. See\n * https://developer.mozilla.org/en-US/docs/Web/CSS/will-change\n */\n export enum HiddenMode {\n /**\n * Set a `lm-mod-hidden` CSS class to hide the widget using `display:none`\n * CSS from the standard Lumino CSS.\n */\n Display = 0,\n\n /**\n * Hide the widget by setting the `transform` to `'scale(0)'`.\n */\n Scale,\n\n /**\n *Hide the widget by setting the `content-visibility` to `'hidden'`.\n */\n ContentVisibility\n }\n\n /**\n * An enum of widget bit flags.\n */\n export enum Flag {\n /**\n * The widget has been disposed.\n */\n IsDisposed = 0x1,\n\n /**\n * The widget is attached to the DOM.\n */\n IsAttached = 0x2,\n\n /**\n * The widget is hidden.\n */\n IsHidden = 0x4,\n\n /**\n * The widget is visible.\n *\n * @deprecated since 2.7.0, apply that flag consistently was not reliable\n * so it was dropped in favor of a recursive check of the visibility of all parents.\n */\n IsVisible = 0x8,\n\n /**\n * A layout cannot be set on the widget.\n */\n DisallowLayout = 0x10\n }\n\n /**\n * A collection of stateless messages related to widgets.\n */\n export namespace Msg {\n /**\n * A singleton `'before-show'` message.\n *\n * #### Notes\n * This message is sent to a widget before it becomes visible.\n *\n * This message is **not** sent when the widget is being attached.\n */\n export const BeforeShow = new Message('before-show');\n\n /**\n * A singleton `'after-show'` message.\n *\n * #### Notes\n * This message is sent to a widget after it becomes visible.\n *\n * This message is **not** sent when the widget is being attached.\n */\n export const AfterShow = new Message('after-show');\n\n /**\n * A singleton `'before-hide'` message.\n *\n * #### Notes\n * This message is sent to a widget before it becomes not-visible.\n *\n * This message is **not** sent when the widget is being detached.\n */\n export const BeforeHide = new Message('before-hide');\n\n /**\n * A singleton `'after-hide'` message.\n *\n * #### Notes\n * This message is sent to a widget after it becomes not-visible.\n *\n * This message is **not** sent when the widget is being detached.\n */\n export const AfterHide = new Message('after-hide');\n\n /**\n * A singleton `'before-attach'` message.\n *\n * #### Notes\n * This message is sent to a widget before it is attached.\n */\n export const BeforeAttach = new Message('before-attach');\n\n /**\n * A singleton `'after-attach'` message.\n *\n * #### Notes\n * This message is sent to a widget after it is attached.\n */\n export const AfterAttach = new Message('after-attach');\n\n /**\n * A singleton `'before-detach'` message.\n *\n * #### Notes\n * This message is sent to a widget before it is detached.\n */\n export const BeforeDetach = new Message('before-detach');\n\n /**\n * A singleton `'after-detach'` message.\n *\n * #### Notes\n * This message is sent to a widget after it is detached.\n */\n export const AfterDetach = new Message('after-detach');\n\n /**\n * A singleton `'parent-changed'` message.\n *\n * #### Notes\n * This message is sent to a widget when its parent has changed.\n */\n export const ParentChanged = new Message('parent-changed');\n\n /**\n * A singleton conflatable `'update-request'` message.\n *\n * #### Notes\n * This message can be dispatched to supporting widgets in order to\n * update their content based on the current widget state. Not all\n * widgets will respond to messages of this type.\n *\n * For widgets with a layout, this message will inform the layout to\n * update the position and size of its child widgets.\n */\n export const UpdateRequest = new ConflatableMessage('update-request');\n\n /**\n * A singleton conflatable `'fit-request'` message.\n *\n * #### Notes\n * For widgets with a layout, this message will inform the layout to\n * recalculate its size constraints to fit the space requirements of\n * its child widgets, and to update their position and size. Not all\n * layouts will respond to messages of this type.\n */\n export const FitRequest = new ConflatableMessage('fit-request');\n\n /**\n * A singleton conflatable `'activate-request'` message.\n *\n * #### Notes\n * This message should be dispatched to a widget when it should\n * perform the actions necessary to activate the widget, which\n * may include focusing its node or descendant node.\n */\n export const ActivateRequest = new ConflatableMessage('activate-request');\n\n /**\n * A singleton conflatable `'close-request'` message.\n *\n * #### Notes\n * This message should be dispatched to a widget when it should close\n * and remove itself from the widget hierarchy.\n */\n export const CloseRequest = new ConflatableMessage('close-request');\n }\n\n /**\n * A message class for child related messages.\n */\n export class ChildMessage extends Message {\n /**\n * Construct a new child message.\n *\n * @param type - The message type.\n *\n * @param child - The child widget for the message.\n */\n constructor(type: string, child: Widget) {\n super(type);\n this.child = child;\n }\n\n /**\n * The child widget for the message.\n */\n readonly child: Widget;\n }\n\n /**\n * A message class for `'resize'` messages.\n */\n export class ResizeMessage extends Message {\n /**\n * Construct a new resize message.\n *\n * @param width - The **offset width** of the widget, or `-1` if\n * the width is not known.\n *\n * @param height - The **offset height** of the widget, or `-1` if\n * the height is not known.\n */\n constructor(width: number, height: number) {\n super('resize');\n this.width = width;\n this.height = height;\n }\n\n /**\n * The offset width of the widget.\n *\n * #### Notes\n * This will be `-1` if the width is unknown.\n */\n readonly width: number;\n\n /**\n * The offset height of the widget.\n *\n * #### Notes\n * This will be `-1` if the height is unknown.\n */\n readonly height: number;\n }\n\n /**\n * The namespace for the `ResizeMessage` class statics.\n */\n export namespace ResizeMessage {\n /**\n * A singleton `'resize'` message with an unknown size.\n */\n export const UnknownSize = new ResizeMessage(-1, -1);\n }\n\n /**\n * Attach a widget to a host DOM node.\n *\n * @param widget - The widget of interest.\n *\n * @param host - The DOM node to use as the widget's host.\n *\n * @param ref - The child of `host` to use as the reference element.\n * If this is provided, the widget will be inserted before this\n * node in the host. The default is `null`, which will cause the\n * widget to be added as the last child of the host.\n *\n * #### Notes\n * This will throw an error if the widget is not a root widget, if\n * the widget is already attached, or if the host is not attached\n * to the DOM.\n */\n export function attach(\n widget: Widget,\n host: HTMLElement,\n ref: HTMLElement | null = null\n ): void {\n if (widget.parent) {\n throw new Error('Cannot attach a child widget.');\n }\n if (widget.isAttached || widget.node.isConnected) {\n throw new Error('Widget is already attached.');\n }\n if (!host.isConnected) {\n throw new Error('Host is not attached.');\n }\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n host.insertBefore(widget.node, ref);\n MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n\n /**\n * Detach the widget from its host DOM node.\n *\n * @param widget - The widget of interest.\n *\n * #### Notes\n * This will throw an error if the widget is not a root widget,\n * or if the widget is not attached to the DOM.\n */\n export function detach(widget: Widget): void {\n if (widget.parent) {\n throw new Error('Cannot detach a child widget.');\n }\n if (!widget.isAttached || !widget.node.isConnected) {\n throw new Error('Widget is not attached.');\n }\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n widget.node.parentNode!.removeChild(widget.node);\n MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * An attached property for the widget title object.\n */\n export const titleProperty = new AttachedProperty>({\n name: 'title',\n create: owner => new Title({ owner })\n });\n\n /**\n * Create a DOM node for the given widget options.\n */\n export function createNode(options: Widget.IOptions): HTMLElement {\n return options.node || document.createElement(options.tag || 'div');\n }\n}\n","/* eslint-disable @typescript-eslint/no-empty-function */\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { IDisposable } from '@lumino/disposable';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { AttachedProperty } from '@lumino/properties';\n\nimport { Signal } from '@lumino/signaling';\n\nimport { Widget } from './widget';\n\n/**\n * An abstract base class for creating lumino layouts.\n *\n * #### Notes\n * A layout is used to add widgets to a parent and to arrange those\n * widgets within the parent's DOM node.\n *\n * This class implements the base functionality which is required of\n * nearly all layouts. It must be subclassed in order to be useful.\n *\n * Notably, this class does not define a uniform interface for adding\n * widgets to the layout. A subclass should define that API in a way\n * which is meaningful for its intended use.\n */\nexport abstract class Layout implements Iterable, IDisposable {\n /**\n * Construct a new layout.\n *\n * @param options - The options for initializing the layout.\n */\n constructor(options: Layout.IOptions = {}) {\n this._fitPolicy = options.fitPolicy || 'set-min-size';\n }\n\n /**\n * Dispose of the resources held by the layout.\n *\n * #### Notes\n * This should be reimplemented to clear and dispose of the widgets.\n *\n * All reimplementations should call the superclass method.\n *\n * This method is called automatically when the parent is disposed.\n */\n dispose(): void {\n this._parent = null;\n this._disposed = true;\n Signal.clearData(this);\n AttachedProperty.clearData(this);\n }\n\n /**\n * Test whether the layout is disposed.\n */\n get isDisposed(): boolean {\n return this._disposed;\n }\n\n /**\n * Get the parent widget of the layout.\n */\n get parent(): Widget | null {\n return this._parent;\n }\n\n /**\n * Set the parent widget of the layout.\n *\n * #### Notes\n * This is set automatically when installing the layout on the parent\n * widget. The parent widget should not be set directly by user code.\n */\n set parent(value: Widget | null) {\n if (this._parent === value) {\n return;\n }\n if (this._parent) {\n throw new Error('Cannot change parent widget.');\n }\n if (value!.layout !== this) {\n throw new Error('Invalid parent widget.');\n }\n this._parent = value;\n this.init();\n }\n\n /**\n * Get the fit policy for the layout.\n *\n * #### Notes\n * The fit policy controls the computed size constraints which are\n * applied to the parent widget by the layout.\n *\n * Some layout implementations may ignore the fit policy.\n */\n get fitPolicy(): Layout.FitPolicy {\n return this._fitPolicy;\n }\n\n /**\n * Set the fit policy for the layout.\n *\n * #### Notes\n * The fit policy controls the computed size constraints which are\n * applied to the parent widget by the layout.\n *\n * Some layout implementations may ignore the fit policy.\n *\n * Changing the fit policy will clear the current size constraint\n * for the parent widget and then re-fit the parent.\n */\n set fitPolicy(value: Layout.FitPolicy) {\n // Bail if the policy does not change\n if (this._fitPolicy === value) {\n return;\n }\n\n // Update the internal policy.\n this._fitPolicy = value;\n\n // Clear the size constraints and schedule a fit of the parent.\n if (this._parent) {\n let style = this._parent.node.style;\n style.minWidth = '';\n style.minHeight = '';\n style.maxWidth = '';\n style.maxHeight = '';\n this._parent.fit();\n }\n }\n\n /**\n * Create an iterator over the widgets in the layout.\n *\n * @returns A new iterator over the widgets in the layout.\n *\n * #### Notes\n * This abstract method must be implemented by a subclass.\n */\n abstract [Symbol.iterator](): IterableIterator;\n\n /**\n * Remove a widget from the layout.\n *\n * @param widget - The widget to remove from the layout.\n *\n * #### Notes\n * A widget is automatically removed from the layout when its `parent`\n * is set to `null`. This method should only be invoked directly when\n * removing a widget from a layout which has yet to be installed on a\n * parent widget.\n *\n * This method should *not* modify the widget's `parent`.\n */\n abstract removeWidget(widget: Widget): void;\n\n /**\n * Process a message sent to the parent widget.\n *\n * @param msg - The message sent to the parent widget.\n *\n * #### Notes\n * This method is called by the parent widget to process a message.\n *\n * Subclasses may reimplement this method as needed.\n */\n processParentMessage(msg: Message): void {\n switch (msg.type) {\n case 'resize':\n this.onResize(msg as Widget.ResizeMessage);\n break;\n case 'update-request':\n this.onUpdateRequest(msg);\n break;\n case 'fit-request':\n this.onFitRequest(msg);\n break;\n case 'before-show':\n this.onBeforeShow(msg);\n break;\n case 'after-show':\n this.onAfterShow(msg);\n break;\n case 'before-hide':\n this.onBeforeHide(msg);\n break;\n case 'after-hide':\n this.onAfterHide(msg);\n break;\n case 'before-attach':\n this.onBeforeAttach(msg);\n break;\n case 'after-attach':\n this.onAfterAttach(msg);\n break;\n case 'before-detach':\n this.onBeforeDetach(msg);\n break;\n case 'after-detach':\n this.onAfterDetach(msg);\n break;\n case 'child-removed':\n this.onChildRemoved(msg as Widget.ChildMessage);\n break;\n case 'child-shown':\n this.onChildShown(msg as Widget.ChildMessage);\n break;\n case 'child-hidden':\n this.onChildHidden(msg as Widget.ChildMessage);\n break;\n }\n }\n\n /**\n * Perform layout initialization which requires the parent widget.\n *\n * #### Notes\n * This method is invoked immediately after the layout is installed\n * on the parent widget.\n *\n * The default implementation reparents all of the widgets to the\n * layout parent widget.\n *\n * Subclasses should reimplement this method and attach the child\n * widget nodes to the parent widget's node.\n */\n protected init(): void {\n for (const widget of this) {\n widget.parent = this.parent;\n }\n }\n\n /**\n * A message handler invoked on a `'resize'` message.\n *\n * #### Notes\n * The layout should ensure that its widgets are resized according\n * to the specified layout space, and that they are sent a `'resize'`\n * message if appropriate.\n *\n * The default implementation of this method sends an `UnknownSize`\n * resize message to all widgets.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onResize(msg: Widget.ResizeMessage): void {\n for (const widget of this) {\n MessageLoop.sendMessage(widget, Widget.ResizeMessage.UnknownSize);\n }\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n *\n * #### Notes\n * The layout should ensure that its widgets are resized according\n * to the available layout space, and that they are sent a `'resize'`\n * message if appropriate.\n *\n * The default implementation of this method sends an `UnknownSize`\n * resize message to all widgets.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onUpdateRequest(msg: Message): void {\n for (const widget of this) {\n MessageLoop.sendMessage(widget, Widget.ResizeMessage.UnknownSize);\n }\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n *\n * #### Notes\n * The default implementation of this method forwards the message\n * to all widgets. It assumes all widget nodes are attached to the\n * parent widget node.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onBeforeAttach(msg: Message): void {\n for (const widget of this) {\n MessageLoop.sendMessage(widget, msg);\n }\n }\n\n /**\n * A message handler invoked on an `'after-attach'` message.\n *\n * #### Notes\n * The default implementation of this method forwards the message\n * to all widgets. It assumes all widget nodes are attached to the\n * parent widget node.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onAfterAttach(msg: Message): void {\n for (const widget of this) {\n MessageLoop.sendMessage(widget, msg);\n }\n }\n\n /**\n * A message handler invoked on a `'before-detach'` message.\n *\n * #### Notes\n * The default implementation of this method forwards the message\n * to all widgets. It assumes all widget nodes are attached to the\n * parent widget node.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onBeforeDetach(msg: Message): void {\n for (const widget of this) {\n MessageLoop.sendMessage(widget, msg);\n }\n }\n\n /**\n * A message handler invoked on an `'after-detach'` message.\n *\n * #### Notes\n * The default implementation of this method forwards the message\n * to all widgets. It assumes all widget nodes are attached to the\n * parent widget node.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onAfterDetach(msg: Message): void {\n for (const widget of this) {\n MessageLoop.sendMessage(widget, msg);\n }\n }\n\n /**\n * A message handler invoked on a `'before-show'` message.\n *\n * #### Notes\n * The default implementation of this method forwards the message to\n * all non-hidden widgets. It assumes all widget nodes are attached\n * to the parent widget node.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onBeforeShow(msg: Message): void {\n for (const widget of this) {\n if (!widget.isHidden) {\n MessageLoop.sendMessage(widget, msg);\n }\n }\n }\n\n /**\n * A message handler invoked on an `'after-show'` message.\n *\n * #### Notes\n * The default implementation of this method forwards the message to\n * all non-hidden widgets. It assumes all widget nodes are attached\n * to the parent widget node.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onAfterShow(msg: Message): void {\n for (const widget of this) {\n if (!widget.isHidden) {\n MessageLoop.sendMessage(widget, msg);\n }\n }\n }\n\n /**\n * A message handler invoked on a `'before-hide'` message.\n *\n * #### Notes\n * The default implementation of this method forwards the message to\n * all non-hidden widgets. It assumes all widget nodes are attached\n * to the parent widget node.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onBeforeHide(msg: Message): void {\n for (const widget of this) {\n if (!widget.isHidden) {\n MessageLoop.sendMessage(widget, msg);\n }\n }\n }\n\n /**\n * A message handler invoked on an `'after-hide'` message.\n *\n * #### Notes\n * The default implementation of this method forwards the message to\n * all non-hidden widgets. It assumes all widget nodes are attached\n * to the parent widget node.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onAfterHide(msg: Message): void {\n for (const widget of this) {\n if (!widget.isHidden) {\n MessageLoop.sendMessage(widget, msg);\n }\n }\n }\n\n /**\n * A message handler invoked on a `'child-removed'` message.\n *\n * #### Notes\n * This will remove the child widget from the layout.\n *\n * Subclasses should **not** typically reimplement this method.\n */\n protected onChildRemoved(msg: Widget.ChildMessage): void {\n this.removeWidget(msg.child);\n }\n\n /**\n * A message handler invoked on a `'fit-request'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onFitRequest(msg: Message): void {}\n\n /**\n * A message handler invoked on a `'child-shown'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onChildShown(msg: Widget.ChildMessage): void {}\n\n /**\n * A message handler invoked on a `'child-hidden'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onChildHidden(msg: Widget.ChildMessage): void {}\n\n private _disposed = false;\n private _fitPolicy: Layout.FitPolicy;\n private _parent: Widget | null = null;\n}\n\n/**\n * The namespace for the `Layout` class statics.\n */\nexport namespace Layout {\n /**\n * A type alias for the layout fit policy.\n *\n * #### Notes\n * The fit policy controls the computed size constraints which are\n * applied to the parent widget by the layout.\n *\n * Some layout implementations may ignore the fit policy.\n */\n export type FitPolicy =\n | /**\n * No size constraint will be applied to the parent widget.\n */\n 'set-no-constraint'\n\n /**\n * The computed min size will be applied to the parent widget.\n */\n | 'set-min-size';\n\n /**\n * An options object for initializing a layout.\n */\n export interface IOptions {\n /**\n * The fit policy for the layout.\n *\n * The default is `'set-min-size'`.\n */\n fitPolicy?: FitPolicy;\n }\n\n /**\n * A type alias for the horizontal alignment of a widget.\n */\n export type HorizontalAlignment = 'left' | 'center' | 'right';\n\n /**\n * A type alias for the vertical alignment of a widget.\n */\n export type VerticalAlignment = 'top' | 'center' | 'bottom';\n\n /**\n * Get the horizontal alignment for a widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The horizontal alignment for the widget.\n *\n * #### Notes\n * If the layout width allocated to a widget is larger than its max\n * width, the horizontal alignment controls how the widget is placed\n * within the extra horizontal space.\n *\n * If the allocated width is less than the widget's max width, the\n * horizontal alignment has no effect.\n *\n * Some layout implementations may ignore horizontal alignment.\n */\n export function getHorizontalAlignment(widget: Widget): HorizontalAlignment {\n return Private.horizontalAlignmentProperty.get(widget);\n }\n\n /**\n * Set the horizontal alignment for a widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the horizontal alignment.\n *\n * #### Notes\n * If the layout width allocated to a widget is larger than its max\n * width, the horizontal alignment controls how the widget is placed\n * within the extra horizontal space.\n *\n * If the allocated width is less than the widget's max width, the\n * horizontal alignment has no effect.\n *\n * Some layout implementations may ignore horizontal alignment.\n *\n * Changing the horizontal alignment will post an `update-request`\n * message to widget's parent, provided the parent has a layout\n * installed.\n */\n export function setHorizontalAlignment(\n widget: Widget,\n value: HorizontalAlignment\n ): void {\n Private.horizontalAlignmentProperty.set(widget, value);\n }\n\n /**\n * Get the vertical alignment for a widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The vertical alignment for the widget.\n *\n * #### Notes\n * If the layout height allocated to a widget is larger than its max\n * height, the vertical alignment controls how the widget is placed\n * within the extra vertical space.\n *\n * If the allocated height is less than the widget's max height, the\n * vertical alignment has no effect.\n *\n * Some layout implementations may ignore vertical alignment.\n */\n export function getVerticalAlignment(widget: Widget): VerticalAlignment {\n return Private.verticalAlignmentProperty.get(widget);\n }\n\n /**\n * Set the vertical alignment for a widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the vertical alignment.\n *\n * #### Notes\n * If the layout height allocated to a widget is larger than its max\n * height, the vertical alignment controls how the widget is placed\n * within the extra vertical space.\n *\n * If the allocated height is less than the widget's max height, the\n * vertical alignment has no effect.\n *\n * Some layout implementations may ignore vertical alignment.\n *\n * Changing the horizontal alignment will post an `update-request`\n * message to widget's parent, provided the parent has a layout\n * installed.\n */\n export function setVerticalAlignment(\n widget: Widget,\n value: VerticalAlignment\n ): void {\n Private.verticalAlignmentProperty.set(widget, value);\n }\n}\n\n/**\n * An object which assists in the absolute layout of widgets.\n *\n * #### Notes\n * This class is useful when implementing a layout which arranges its\n * widgets using absolute positioning.\n *\n * This class is used by nearly all of the built-in lumino layouts.\n */\nexport class LayoutItem implements IDisposable {\n /**\n * Construct a new layout item.\n *\n * @param widget - The widget to be managed by the item.\n *\n * #### Notes\n * The widget will be set to absolute positioning.\n * The widget will use strict CSS containment.\n */\n constructor(widget: Widget) {\n this.widget = widget;\n this.widget.node.style.position = 'absolute';\n this.widget.node.style.contain = 'strict';\n }\n\n /**\n * Dispose of the the layout item.\n *\n * #### Notes\n * This will reset the positioning of the widget.\n */\n dispose(): void {\n // Do nothing if the item is already disposed.\n if (this._disposed) {\n return;\n }\n\n // Mark the item as disposed.\n this._disposed = true;\n\n // Reset the widget style.\n let style = this.widget.node.style;\n style.position = '';\n style.top = '';\n style.left = '';\n style.width = '';\n style.height = '';\n style.contain = '';\n }\n\n /**\n * The widget managed by the layout item.\n */\n readonly widget: Widget;\n\n /**\n * The computed minimum width of the widget.\n *\n * #### Notes\n * This value can be updated by calling the `fit` method.\n */\n get minWidth(): number {\n return this._minWidth;\n }\n\n /**\n * The computed minimum height of the widget.\n *\n * #### Notes\n * This value can be updated by calling the `fit` method.\n */\n get minHeight(): number {\n return this._minHeight;\n }\n\n /**\n * The computed maximum width of the widget.\n *\n * #### Notes\n * This value can be updated by calling the `fit` method.\n */\n get maxWidth(): number {\n return this._maxWidth;\n }\n\n /**\n * The computed maximum height of the widget.\n *\n * #### Notes\n * This value can be updated by calling the `fit` method.\n */\n get maxHeight(): number {\n return this._maxHeight;\n }\n\n /**\n * Whether the layout item is disposed.\n */\n get isDisposed(): boolean {\n return this._disposed;\n }\n\n /**\n * Whether the managed widget is hidden.\n */\n get isHidden(): boolean {\n return this.widget.isHidden;\n }\n\n /**\n * Whether the managed widget is visible.\n */\n get isVisible(): boolean {\n return this.widget.isVisible;\n }\n\n /**\n * Whether the managed widget is attached.\n */\n get isAttached(): boolean {\n return this.widget.isAttached;\n }\n\n /**\n * Update the computed size limits of the managed widget.\n */\n fit(): void {\n let limits = ElementExt.sizeLimits(this.widget.node);\n this._minWidth = limits.minWidth;\n this._minHeight = limits.minHeight;\n this._maxWidth = limits.maxWidth;\n this._maxHeight = limits.maxHeight;\n }\n\n /**\n * Update the position and size of the managed widget.\n *\n * @param left - The left edge position of the layout box.\n *\n * @param top - The top edge position of the layout box.\n *\n * @param width - The width of the layout box.\n *\n * @param height - The height of the layout box.\n */\n update(left: number, top: number, width: number, height: number): void {\n // Clamp the size to the computed size limits.\n let clampW = Math.max(this._minWidth, Math.min(width, this._maxWidth));\n let clampH = Math.max(this._minHeight, Math.min(height, this._maxHeight));\n\n // Adjust the left edge for the horizontal alignment, if needed.\n if (clampW < width) {\n switch (Layout.getHorizontalAlignment(this.widget)) {\n case 'left':\n break;\n case 'center':\n left += (width - clampW) / 2;\n break;\n case 'right':\n left += width - clampW;\n break;\n default:\n throw 'unreachable';\n }\n }\n\n // Adjust the top edge for the vertical alignment, if needed.\n if (clampH < height) {\n switch (Layout.getVerticalAlignment(this.widget)) {\n case 'top':\n break;\n case 'center':\n top += (height - clampH) / 2;\n break;\n case 'bottom':\n top += height - clampH;\n break;\n default:\n throw 'unreachable';\n }\n }\n\n // Set up the resize variables.\n let resized = false;\n let style = this.widget.node.style;\n\n // Update the top edge of the widget if needed.\n if (this._top !== top) {\n this._top = top;\n style.top = `${top}px`;\n }\n\n // Update the left edge of the widget if needed.\n if (this._left !== left) {\n this._left = left;\n style.left = `${left}px`;\n }\n\n // Update the width of the widget if needed.\n if (this._width !== clampW) {\n resized = true;\n this._width = clampW;\n style.width = `${clampW}px`;\n }\n\n // Update the height of the widget if needed.\n if (this._height !== clampH) {\n resized = true;\n this._height = clampH;\n style.height = `${clampH}px`;\n }\n\n // Send a resize message to the widget if needed.\n if (resized) {\n let msg = new Widget.ResizeMessage(clampW, clampH);\n MessageLoop.sendMessage(this.widget, msg);\n }\n }\n\n private _top = NaN;\n private _left = NaN;\n private _width = NaN;\n private _height = NaN;\n private _minWidth = 0;\n private _minHeight = 0;\n private _maxWidth = Infinity;\n private _maxHeight = Infinity;\n private _disposed = false;\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * The attached property for a widget horizontal alignment.\n */\n export const horizontalAlignmentProperty = new AttachedProperty<\n Widget,\n Layout.HorizontalAlignment\n >({\n name: 'horizontalAlignment',\n create: () => 'center',\n changed: onAlignmentChanged\n });\n\n /**\n * The attached property for a widget vertical alignment.\n */\n export const verticalAlignmentProperty = new AttachedProperty<\n Widget,\n Layout.VerticalAlignment\n >({\n name: 'verticalAlignment',\n create: () => 'top',\n changed: onAlignmentChanged\n });\n\n /**\n * The change handler for the attached alignment properties.\n */\n function onAlignmentChanged(child: Widget): void {\n if (child.parent && child.parent.layout) {\n child.parent.update();\n }\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { MessageLoop } from '@lumino/messaging';\n\nimport { Layout } from './layout';\n\nimport { Widget } from './widget';\n\n/**\n * A concrete layout implementation suitable for many use cases.\n *\n * #### Notes\n * This class is suitable as a base class for implementing a variety of\n * layouts, but can also be used directly with standard CSS to layout a\n * collection of widgets.\n */\nexport class PanelLayout extends Layout {\n /**\n * Dispose of the resources held by the layout.\n *\n * #### Notes\n * This will clear and dispose all widgets in the layout.\n *\n * All reimplementations should call the superclass method.\n *\n * This method is called automatically when the parent is disposed.\n */\n dispose(): void {\n while (this._widgets.length > 0) {\n this._widgets.pop()!.dispose();\n }\n super.dispose();\n }\n\n /**\n * A read-only array of the widgets in the layout.\n */\n get widgets(): ReadonlyArray {\n return this._widgets;\n }\n\n /**\n * Create an iterator over the widgets in the layout.\n *\n * @returns A new iterator over the widgets in the layout.\n */\n *[Symbol.iterator](): IterableIterator {\n yield* this._widgets;\n }\n\n /**\n * Add a widget to the end of the layout.\n *\n * @param widget - The widget to add to the layout.\n *\n * #### Notes\n * If the widget is already contained in the layout, it will be moved.\n */\n addWidget(widget: Widget): void {\n this.insertWidget(this._widgets.length, widget);\n }\n\n /**\n * Insert a widget into the layout at the specified index.\n *\n * @param index - The index at which to insert the widget.\n *\n * @param widget - The widget to insert into the layout.\n *\n * #### Notes\n * The index will be clamped to the bounds of the widgets.\n *\n * If the widget is already added to the layout, it will be moved.\n *\n * #### Undefined Behavior\n * An `index` which is non-integral.\n */\n insertWidget(index: number, widget: Widget): void {\n // Remove the widget from its current parent. This is a no-op\n // if the widget's parent is already the layout parent widget.\n widget.parent = this.parent;\n\n // Look up the current index of the widget.\n let i = this._widgets.indexOf(widget);\n\n // Clamp the insert index to the array bounds.\n let j = Math.max(0, Math.min(index, this._widgets.length));\n\n // If the widget is not in the array, insert it.\n if (i === -1) {\n // Insert the widget into the array.\n ArrayExt.insert(this._widgets, j, widget);\n\n // If the layout is parented, attach the widget to the DOM.\n if (this.parent) {\n this.attachWidget(j, widget);\n }\n\n // There is nothing more to do.\n return;\n }\n\n // Otherwise, the widget exists in the array and should be moved.\n\n // Adjust the index if the location is at the end of the array.\n if (j === this._widgets.length) {\n j--;\n }\n\n // Bail if there is no effective move.\n if (i === j) {\n return;\n }\n\n // Move the widget to the new location.\n ArrayExt.move(this._widgets, i, j);\n\n // If the layout is parented, move the widget in the DOM.\n if (this.parent) {\n this.moveWidget(i, j, widget);\n }\n }\n\n /**\n * Remove a widget from the layout.\n *\n * @param widget - The widget to remove from the layout.\n *\n * #### Notes\n * A widget is automatically removed from the layout when its `parent`\n * is set to `null`. This method should only be invoked directly when\n * removing a widget from a layout which has yet to be installed on a\n * parent widget.\n *\n * This method does *not* modify the widget's `parent`.\n */\n removeWidget(widget: Widget): void {\n this.removeWidgetAt(this._widgets.indexOf(widget));\n }\n\n /**\n * Remove the widget at a given index from the layout.\n *\n * @param index - The index of the widget to remove.\n *\n * #### Notes\n * A widget is automatically removed from the layout when its `parent`\n * is set to `null`. This method should only be invoked directly when\n * removing a widget from a layout which has yet to be installed on a\n * parent widget.\n *\n * This method does *not* modify the widget's `parent`.\n *\n * #### Undefined Behavior\n * An `index` which is non-integral.\n */\n removeWidgetAt(index: number): void {\n // Remove the widget from the array.\n let widget = ArrayExt.removeAt(this._widgets, index);\n\n // If the layout is parented, detach the widget from the DOM.\n if (widget && this.parent) {\n this.detachWidget(index, widget);\n }\n }\n\n /**\n * Perform layout initialization which requires the parent widget.\n */\n protected init(): void {\n super.init();\n let index = 0;\n for (const widget of this) {\n this.attachWidget(index++, widget);\n }\n }\n\n /**\n * Attach a widget to the parent's DOM node.\n *\n * @param index - The current index of the widget in the layout.\n *\n * @param widget - The widget to attach to the parent.\n *\n * #### Notes\n * This method is called automatically by the panel layout at the\n * appropriate time. It should not be called directly by user code.\n *\n * The default implementation adds the widgets's node to the parent's\n * node at the proper location, and sends the appropriate attach\n * messages to the widget if the parent is attached to the DOM.\n *\n * Subclasses may reimplement this method to control how the widget's\n * node is added to the parent's node.\n */\n protected attachWidget(index: number, widget: Widget): void {\n // Look up the next sibling reference node.\n let ref = this.parent!.node.children[index];\n\n // Send a `'before-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n }\n\n // Insert the widget's node before the sibling.\n this.parent!.node.insertBefore(widget.node, ref);\n\n // Send an `'after-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n }\n\n /**\n * Move a widget in the parent's DOM node.\n *\n * @param fromIndex - The previous index of the widget in the layout.\n *\n * @param toIndex - The current index of the widget in the layout.\n *\n * @param widget - The widget to move in the parent.\n *\n * #### Notes\n * This method is called automatically by the panel layout at the\n * appropriate time. It should not be called directly by user code.\n *\n * The default implementation moves the widget's node to the proper\n * location in the parent's node and sends the appropriate attach and\n * detach messages to the widget if the parent is attached to the DOM.\n *\n * Subclasses may reimplement this method to control how the widget's\n * node is moved in the parent's node.\n */\n protected moveWidget(\n fromIndex: number,\n toIndex: number,\n widget: Widget\n ): void {\n // Send a `'before-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n }\n\n // Remove the widget's node from the parent.\n this.parent!.node.removeChild(widget.node);\n\n // Send an `'after-detach'` and message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n\n // Look up the next sibling reference node.\n let ref = this.parent!.node.children[toIndex];\n\n // Send a `'before-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n }\n\n // Insert the widget's node before the sibling.\n this.parent!.node.insertBefore(widget.node, ref);\n\n // Send an `'after-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n }\n\n /**\n * Detach a widget from the parent's DOM node.\n *\n * @param index - The previous index of the widget in the layout.\n *\n * @param widget - The widget to detach from the parent.\n *\n * #### Notes\n * This method is called automatically by the panel layout at the\n * appropriate time. It should not be called directly by user code.\n *\n * The default implementation removes the widget's node from the\n * parent's node, and sends the appropriate detach messages to the\n * widget if the parent is attached to the DOM.\n *\n * Subclasses may reimplement this method to control how the widget's\n * node is removed from the parent's node.\n */\n protected detachWidget(index: number, widget: Widget): void {\n // Send a `'before-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n }\n\n // Remove the widget's node from the parent.\n this.parent!.node.removeChild(widget.node);\n\n // Send an `'after-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n }\n\n private _widgets: Widget[] = [];\n}\n","/*\n * Copyright (c) Jupyter Development Team.\n * Distributed under the terms of the Modified BSD License.\n */\n\nexport namespace Utils {\n /**\n * Clamp a dimension value to an integer >= 0.\n */\n export function clampDimension(value: number): number {\n return Math.max(0, Math.floor(value));\n }\n}\n\nexport default Utils;\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { AttachedProperty } from '@lumino/properties';\n\nimport { BoxEngine, BoxSizer } from './boxengine';\n\nimport { LayoutItem } from './layout';\n\nimport { PanelLayout } from './panellayout';\n\nimport { Utils } from './utils';\n\nimport { Widget } from './widget';\n\n/**\n * A layout which arranges its widgets into resizable sections.\n */\nexport class SplitLayout extends PanelLayout {\n /**\n * Construct a new split layout.\n *\n * @param options - The options for initializing the layout.\n */\n constructor(options: SplitLayout.IOptions) {\n super();\n this.renderer = options.renderer;\n if (options.orientation !== undefined) {\n this._orientation = options.orientation;\n }\n if (options.alignment !== undefined) {\n this._alignment = options.alignment;\n }\n if (options.spacing !== undefined) {\n this._spacing = Utils.clampDimension(options.spacing);\n }\n }\n\n /**\n * Dispose of the resources held by the layout.\n */\n dispose(): void {\n // Dispose of the layout items.\n for (const item of this._items) {\n item.dispose();\n }\n\n // Clear the layout state.\n this._box = null;\n this._items.length = 0;\n this._sizers.length = 0;\n this._handles.length = 0;\n\n // Dispose of the rest of the layout.\n super.dispose();\n }\n\n /**\n * The renderer used by the split layout.\n */\n readonly renderer: SplitLayout.IRenderer;\n\n /**\n * Get the layout orientation for the split layout.\n */\n get orientation(): SplitLayout.Orientation {\n return this._orientation;\n }\n\n /**\n * Set the layout orientation for the split layout.\n */\n set orientation(value: SplitLayout.Orientation) {\n if (this._orientation === value) {\n return;\n }\n this._orientation = value;\n if (!this.parent) {\n return;\n }\n this.parent.dataset['orientation'] = value;\n this.parent.fit();\n }\n\n /**\n * Get the content alignment for the split layout.\n *\n * #### Notes\n * This is the alignment of the widgets in the layout direction.\n *\n * The alignment has no effect if the widgets can expand to fill the\n * entire split layout.\n */\n get alignment(): SplitLayout.Alignment {\n return this._alignment;\n }\n\n /**\n * Set the content alignment for the split layout.\n *\n * #### Notes\n * This is the alignment of the widgets in the layout direction.\n *\n * The alignment has no effect if the widgets can expand to fill the\n * entire split layout.\n */\n set alignment(value: SplitLayout.Alignment) {\n if (this._alignment === value) {\n return;\n }\n this._alignment = value;\n if (!this.parent) {\n return;\n }\n this.parent.dataset['alignment'] = value;\n this.parent.update();\n }\n\n /**\n * Get the inter-element spacing for the split layout.\n */\n get spacing(): number {\n return this._spacing;\n }\n\n /**\n * Set the inter-element spacing for the split layout.\n */\n set spacing(value: number) {\n value = Utils.clampDimension(value);\n if (this._spacing === value) {\n return;\n }\n this._spacing = value;\n if (!this.parent) {\n return;\n }\n this.parent.fit();\n }\n\n /**\n * A read-only array of the split handles in the layout.\n */\n get handles(): ReadonlyArray {\n return this._handles;\n }\n\n /**\n * Get the absolute sizes of the widgets in the layout.\n *\n * @returns A new array of the absolute sizes of the widgets.\n *\n * This method **does not** measure the DOM nodes.\n */\n absoluteSizes(): number[] {\n return this._sizers.map(sizer => sizer.size);\n }\n\n /**\n * Get the relative sizes of the widgets in the layout.\n *\n * @returns A new array of the relative sizes of the widgets.\n *\n * #### Notes\n * The returned sizes reflect the sizes of the widgets normalized\n * relative to their siblings.\n *\n * This method **does not** measure the DOM nodes.\n */\n relativeSizes(): number[] {\n return Private.normalize(this._sizers.map(sizer => sizer.size));\n }\n\n /**\n * Set the relative sizes for the widgets in the layout.\n *\n * @param sizes - The relative sizes for the widgets in the panel.\n * @param update - Update the layout after setting relative sizes.\n * Default is True.\n *\n * #### Notes\n * Extra values are ignored, too few will yield an undefined layout.\n *\n * The actual geometry of the DOM nodes is updated asynchronously.\n */\n setRelativeSizes(sizes: number[], update = true): void {\n // Copy the sizes and pad with zeros as needed.\n let n = this._sizers.length;\n let temp = sizes.slice(0, n);\n while (temp.length < n) {\n temp.push(0);\n }\n\n // Normalize the padded sizes.\n let normed = Private.normalize(temp);\n\n // Apply the normalized sizes to the sizers.\n for (let i = 0; i < n; ++i) {\n let sizer = this._sizers[i];\n sizer.sizeHint = normed[i];\n sizer.size = normed[i];\n }\n\n // Set the flag indicating the sizes are normalized.\n this._hasNormedSizes = true;\n\n // Trigger an update of the parent widget.\n if (update && this.parent) {\n this.parent.update();\n }\n }\n\n /**\n * Move the offset position of a split handle.\n *\n * @param index - The index of the handle of the interest.\n *\n * @param position - The desired offset position of the handle.\n *\n * #### Notes\n * The position is relative to the offset parent.\n *\n * This will move the handle as close as possible to the desired\n * position. The sibling widgets will be adjusted as necessary.\n */\n moveHandle(index: number, position: number): void {\n // Bail if the index is invalid or the handle is hidden.\n let handle = this._handles[index];\n if (!handle || handle.classList.contains('lm-mod-hidden')) {\n return;\n }\n\n // Compute the desired delta movement for the handle.\n let delta: number;\n if (this._orientation === 'horizontal') {\n delta = position - handle.offsetLeft;\n } else {\n delta = position - handle.offsetTop;\n }\n\n // Bail if there is no handle movement.\n if (delta === 0) {\n return;\n }\n\n // Prevent widget resizing unless needed.\n for (let sizer of this._sizers) {\n if (sizer.size > 0) {\n sizer.sizeHint = sizer.size;\n }\n }\n\n // Adjust the sizers to reflect the handle movement.\n BoxEngine.adjust(this._sizers, index, delta);\n\n // Update the layout of the widgets.\n if (this.parent) {\n this.parent.update();\n }\n }\n\n /**\n * Perform layout initialization which requires the parent widget.\n */\n protected init(): void {\n this.parent!.dataset['orientation'] = this.orientation;\n this.parent!.dataset['alignment'] = this.alignment;\n super.init();\n }\n\n /**\n * Attach a widget to the parent's DOM node.\n *\n * @param index - The current index of the widget in the layout.\n *\n * @param widget - The widget to attach to the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected attachWidget(index: number, widget: Widget): void {\n // Create the item, handle, and sizer for the new widget.\n let item = new LayoutItem(widget);\n let handle = Private.createHandle(this.renderer);\n let average = Private.averageSize(this._sizers);\n let sizer = Private.createSizer(average);\n\n // Insert the item, handle, and sizer into the internal arrays.\n ArrayExt.insert(this._items, index, item);\n ArrayExt.insert(this._sizers, index, sizer);\n ArrayExt.insert(this._handles, index, handle);\n\n // Send a `'before-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n }\n\n // Add the widget and handle nodes to the parent.\n this.parent!.node.appendChild(widget.node);\n this.parent!.node.appendChild(handle);\n\n // Send an `'after-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n\n // Post a fit request for the parent widget.\n this.parent!.fit();\n }\n\n /**\n * Move a widget in the parent's DOM node.\n *\n * @param fromIndex - The previous index of the widget in the layout.\n *\n * @param toIndex - The current index of the widget in the layout.\n *\n * @param widget - The widget to move in the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected moveWidget(\n fromIndex: number,\n toIndex: number,\n widget: Widget\n ): void {\n // Move the item, sizer, and handle for the widget.\n ArrayExt.move(this._items, fromIndex, toIndex);\n ArrayExt.move(this._sizers, fromIndex, toIndex);\n ArrayExt.move(this._handles, fromIndex, toIndex);\n\n // Post a fit request to the parent to show/hide last handle.\n this.parent!.fit();\n }\n\n /**\n * Detach a widget from the parent's DOM node.\n *\n * @param index - The previous index of the widget in the layout.\n *\n * @param widget - The widget to detach from the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected detachWidget(index: number, widget: Widget): void {\n // Remove the item, handle, and sizer for the widget.\n let item = ArrayExt.removeAt(this._items, index);\n let handle = ArrayExt.removeAt(this._handles, index);\n ArrayExt.removeAt(this._sizers, index);\n\n // Send a `'before-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n }\n\n // Remove the widget and handle nodes from the parent.\n this.parent!.node.removeChild(widget.node);\n this.parent!.node.removeChild(handle!);\n\n // Send an `'after-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n\n // Dispose of the layout item.\n item!.dispose();\n\n // Post a fit request for the parent widget.\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'before-show'` message.\n */\n protected onBeforeShow(msg: Message): void {\n super.onBeforeShow(msg);\n this.parent!.update();\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n super.onBeforeAttach(msg);\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-shown'` message.\n */\n protected onChildShown(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-hidden'` message.\n */\n protected onChildHidden(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'resize'` message.\n */\n protected onResize(msg: Widget.ResizeMessage): void {\n if (this.parent!.isVisible) {\n this._update(msg.width, msg.height);\n }\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n protected onUpdateRequest(msg: Message): void {\n if (this.parent!.isVisible) {\n this._update(-1, -1);\n }\n }\n\n /**\n * A message handler invoked on a `'fit-request'` message.\n */\n protected onFitRequest(msg: Message): void {\n if (this.parent!.isAttached) {\n this._fit();\n }\n }\n\n /**\n * Update the item position.\n *\n * @param i Item index\n * @param isHorizontal Whether the layout is horizontal or not\n * @param left Left position in pixels\n * @param top Top position in pixels\n * @param height Item height\n * @param width Item width\n * @param size Item size\n */\n protected updateItemPosition(\n i: number,\n isHorizontal: boolean,\n left: number,\n top: number,\n height: number,\n width: number,\n size: number\n ): void {\n const item = this._items[i];\n if (item.isHidden) {\n return;\n }\n\n // Fetch the style for the handle.\n let handleStyle = this._handles[i].style;\n\n // Update the widget and handle, and advance the relevant edge.\n if (isHorizontal) {\n left += this.widgetOffset;\n item.update(left, top, size, height);\n left += size;\n handleStyle.top = `${top}px`;\n handleStyle.left = `${left}px`;\n handleStyle.width = `${this._spacing}px`;\n handleStyle.height = `${height}px`;\n } else {\n top += this.widgetOffset;\n item.update(left, top, width, size);\n top += size;\n handleStyle.top = `${top}px`;\n handleStyle.left = `${left}px`;\n handleStyle.width = `${width}px`;\n handleStyle.height = `${this._spacing}px`;\n }\n }\n\n /**\n * Fit the layout to the total size required by the widgets.\n */\n private _fit(): void {\n // Update the handles and track the visible widget count.\n let nVisible = 0;\n let lastHandleIndex = -1;\n for (let i = 0, n = this._items.length; i < n; ++i) {\n if (this._items[i].isHidden) {\n this._handles[i].classList.add('lm-mod-hidden');\n } else {\n this._handles[i].classList.remove('lm-mod-hidden');\n lastHandleIndex = i;\n nVisible++;\n }\n }\n\n // Hide the handle for the last visible widget.\n if (lastHandleIndex !== -1) {\n this._handles[lastHandleIndex].classList.add('lm-mod-hidden');\n }\n\n // Update the fixed space for the visible items.\n this._fixed =\n this._spacing * Math.max(0, nVisible - 1) +\n this.widgetOffset * this._items.length;\n\n // Setup the computed minimum size.\n let horz = this._orientation === 'horizontal';\n let minW = horz ? this._fixed : 0;\n let minH = horz ? 0 : this._fixed;\n\n // Update the sizers and computed size limits.\n for (let i = 0, n = this._items.length; i < n; ++i) {\n // Fetch the item and corresponding box sizer.\n let item = this._items[i];\n let sizer = this._sizers[i];\n\n // Prevent resizing unless necessary.\n if (sizer.size > 0) {\n sizer.sizeHint = sizer.size;\n }\n\n // If the item is hidden, it should consume zero size.\n if (item.isHidden) {\n sizer.minSize = 0;\n sizer.maxSize = 0;\n continue;\n }\n\n // Update the size limits for the item.\n item.fit();\n\n // Update the stretch factor.\n sizer.stretch = SplitLayout.getStretch(item.widget);\n\n // Update the sizer limits and computed min size.\n if (horz) {\n sizer.minSize = item.minWidth;\n sizer.maxSize = item.maxWidth;\n minW += item.minWidth;\n minH = Math.max(minH, item.minHeight);\n } else {\n sizer.minSize = item.minHeight;\n sizer.maxSize = item.maxHeight;\n minH += item.minHeight;\n minW = Math.max(minW, item.minWidth);\n }\n }\n\n // Update the box sizing and add it to the computed min size.\n let box = (this._box = ElementExt.boxSizing(this.parent!.node));\n minW += box.horizontalSum;\n minH += box.verticalSum;\n\n // Update the parent's min size constraints.\n let style = this.parent!.node.style;\n style.minWidth = `${minW}px`;\n style.minHeight = `${minH}px`;\n\n // Set the dirty flag to ensure only a single update occurs.\n this._dirty = true;\n\n // Notify the ancestor that it should fit immediately. This may\n // cause a resize of the parent, fulfilling the required update.\n if (this.parent!.parent) {\n MessageLoop.sendMessage(this.parent!.parent!, Widget.Msg.FitRequest);\n }\n\n // If the dirty flag is still set, the parent was not resized.\n // Trigger the required update on the parent widget immediately.\n if (this._dirty) {\n MessageLoop.sendMessage(this.parent!, Widget.Msg.UpdateRequest);\n }\n }\n\n /**\n * Update the layout position and size of the widgets.\n *\n * The parent offset dimensions should be `-1` if unknown.\n */\n private _update(offsetWidth: number, offsetHeight: number): void {\n // Clear the dirty flag to indicate the update occurred.\n this._dirty = false;\n\n // Compute the visible item count.\n let nVisible = 0;\n for (let i = 0, n = this._items.length; i < n; ++i) {\n nVisible += +!this._items[i].isHidden;\n }\n\n // Bail early if there are no visible items to layout.\n if (nVisible === 0 && this.widgetOffset === 0) {\n return;\n }\n\n // Measure the parent if the offset dimensions are unknown.\n if (offsetWidth < 0) {\n offsetWidth = this.parent!.node.offsetWidth;\n }\n if (offsetHeight < 0) {\n offsetHeight = this.parent!.node.offsetHeight;\n }\n\n // Ensure the parent box sizing data is computed.\n if (!this._box) {\n this._box = ElementExt.boxSizing(this.parent!.node);\n }\n\n // Compute the actual layout bounds adjusted for border and padding.\n let top = this._box.paddingTop;\n let left = this._box.paddingLeft;\n let width = offsetWidth - this._box.horizontalSum;\n let height = offsetHeight - this._box.verticalSum;\n\n // Set up the variables for justification and alignment offset.\n let extra = 0;\n let offset = 0;\n let horz = this._orientation === 'horizontal';\n\n if (nVisible > 0) {\n // Compute the adjusted layout space.\n let space: number;\n if (horz) {\n // left += this.widgetOffset;\n space = Math.max(0, width - this._fixed);\n } else {\n // top += this.widgetOffset;\n space = Math.max(0, height - this._fixed);\n }\n\n // Scale the size hints if they are normalized.\n if (this._hasNormedSizes) {\n for (let sizer of this._sizers) {\n sizer.sizeHint *= space;\n }\n this._hasNormedSizes = false;\n }\n\n // Distribute the layout space to the box sizers.\n let delta = BoxEngine.calc(this._sizers, space);\n\n // Account for alignment if there is extra layout space.\n if (delta > 0) {\n switch (this._alignment) {\n case 'start':\n break;\n case 'center':\n extra = 0;\n offset = delta / 2;\n break;\n case 'end':\n extra = 0;\n offset = delta;\n break;\n case 'justify':\n extra = delta / nVisible;\n offset = 0;\n break;\n default:\n throw 'unreachable';\n }\n }\n }\n\n // Layout the items using the computed box sizes.\n for (let i = 0, n = this._items.length; i < n; ++i) {\n // Fetch the item.\n const item = this._items[i];\n\n // Fetch the computed size for the widget.\n const size = item.isHidden ? 0 : this._sizers[i].size + extra;\n\n this.updateItemPosition(\n i,\n horz,\n horz ? left + offset : left,\n horz ? top : top + offset,\n height,\n width,\n size\n );\n\n const fullOffset =\n this.widgetOffset +\n (this._handles[i].classList.contains('lm-mod-hidden')\n ? 0\n : this._spacing);\n\n if (horz) {\n left += size + fullOffset;\n } else {\n top += size + fullOffset;\n }\n }\n }\n\n protected widgetOffset = 0;\n private _fixed = 0;\n private _spacing = 4;\n private _dirty = false;\n private _hasNormedSizes = false;\n private _sizers: BoxSizer[] = [];\n private _items: LayoutItem[] = [];\n private _handles: HTMLDivElement[] = [];\n private _box: ElementExt.IBoxSizing | null = null;\n private _alignment: SplitLayout.Alignment = 'start';\n private _orientation: SplitLayout.Orientation = 'horizontal';\n}\n\n/**\n * The namespace for the `SplitLayout` class statics.\n */\nexport namespace SplitLayout {\n /**\n * A type alias for a split layout orientation.\n */\n export type Orientation = 'horizontal' | 'vertical';\n\n /**\n * A type alias for a split layout alignment.\n */\n export type Alignment = 'start' | 'center' | 'end' | 'justify';\n\n /**\n * An options object for initializing a split layout.\n */\n export interface IOptions {\n /**\n * The renderer to use for the split layout.\n */\n renderer: IRenderer;\n\n /**\n * The orientation of the layout.\n *\n * Possible values are documented in {@link SplitLayout.Orientation}.\n *\n * The default is `'horizontal'`.\n */\n orientation?: Orientation;\n\n /**\n * The content alignment of the layout.\n *\n * Possible values are documented in {@link SplitLayout.Alignment}.\n *\n * The default is `'start'`.\n */\n alignment?: Alignment;\n\n /**\n * The spacing between items in the layout.\n *\n * The default is `4`.\n */\n spacing?: number;\n }\n\n /**\n * A renderer for use with a split layout.\n */\n export interface IRenderer {\n /**\n * Create a new handle for use with a split layout.\n *\n * @returns A new handle element.\n */\n createHandle(): HTMLDivElement;\n }\n\n /**\n * Get the split layout stretch factor for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The split layout stretch factor for the widget.\n */\n export function getStretch(widget: Widget): number {\n return Private.stretchProperty.get(widget);\n }\n\n /**\n * Set the split layout stretch factor for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the stretch factor.\n */\n export function setStretch(widget: Widget, value: number): void {\n Private.stretchProperty.set(widget, value);\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * The property descriptor for a widget stretch factor.\n */\n export const stretchProperty = new AttachedProperty({\n name: 'stretch',\n create: () => 0,\n coerce: (owner, value) => Math.max(0, Math.floor(value)),\n changed: onChildSizingChanged\n });\n\n /**\n * Create a new box sizer with the given size hint.\n */\n export function createSizer(size: number): BoxSizer {\n let sizer = new BoxSizer();\n sizer.sizeHint = Math.floor(size);\n return sizer;\n }\n\n /**\n * Create a new split handle node using the given renderer.\n */\n export function createHandle(\n renderer: SplitLayout.IRenderer\n ): HTMLDivElement {\n let handle = renderer.createHandle();\n handle.style.position = 'absolute';\n // Do not use size containment to allow the handle to fill the available space\n handle.style.contain = 'style';\n return handle;\n }\n\n /**\n * Compute the average size of an array of box sizers.\n */\n export function averageSize(sizers: BoxSizer[]): number {\n return sizers.reduce((v, s) => v + s.size, 0) / sizers.length || 0;\n }\n\n /**\n * Normalize an array of values.\n */\n export function normalize(values: number[]): number[] {\n let n = values.length;\n if (n === 0) {\n return [];\n }\n let sum = values.reduce((a, b) => a + Math.abs(b), 0);\n return sum === 0 ? values.map(v => 1 / n) : values.map(v => v / sum);\n }\n\n /**\n * The change handler for the attached sizing properties.\n */\n function onChildSizingChanged(child: Widget): void {\n if (child.parent && child.parent.layout instanceof SplitLayout) {\n child.parent.fit();\n }\n }\n}\n","/*\n * Copyright (c) Jupyter Development Team.\n * Distributed under the terms of the Modified BSD License.\n */\n\nimport { ArrayExt } from '@lumino/algorithm';\nimport { UUID } from '@lumino/coreutils';\nimport { SplitLayout } from './splitlayout';\nimport { Title } from './title';\nimport Utils from './utils';\nimport { Widget } from './widget';\n\n/**\n * A layout which arranges its widgets into collapsible resizable sections.\n */\nexport class AccordionLayout extends SplitLayout {\n /**\n * Construct a new accordion layout.\n *\n * @param options - The options for initializing the layout.\n *\n * #### Notes\n * The default orientation will be vertical.\n *\n * Titles must be rotated for horizontal accordion panel using CSS: see accordionpanel.css\n */\n constructor(options: AccordionLayout.IOptions) {\n super({ ...options, orientation: options.orientation || 'vertical' });\n this.titleSpace = options.titleSpace || 22;\n }\n\n /**\n * The section title height or width depending on the orientation.\n */\n get titleSpace(): number {\n return this.widgetOffset;\n }\n set titleSpace(value: number) {\n value = Utils.clampDimension(value);\n if (this.widgetOffset === value) {\n return;\n }\n this.widgetOffset = value;\n if (!this.parent) {\n return;\n }\n this.parent.fit();\n }\n\n /**\n * A read-only array of the section titles in the panel.\n */\n get titles(): ReadonlyArray {\n return this._titles;\n }\n\n /**\n * Dispose of the resources held by the layout.\n */\n dispose(): void {\n if (this.isDisposed) {\n return;\n }\n\n // Clear the layout state.\n this._titles.length = 0;\n\n // Dispose of the rest of the layout.\n super.dispose();\n }\n\n /**\n * The renderer used by the accordion layout.\n */\n readonly renderer: AccordionLayout.IRenderer;\n\n public updateTitle(index: number, widget: Widget): void {\n const oldTitle = this._titles[index];\n const expanded = oldTitle.classList.contains('lm-mod-expanded');\n const newTitle = Private.createTitle(this.renderer, widget.title, expanded);\n this._titles[index] = newTitle;\n\n // Add the title node to the parent before the widget.\n this.parent!.node.replaceChild(newTitle, oldTitle);\n }\n\n /**\n * Insert a widget into the layout at the specified index.\n *\n * @param index - The index at which to insert the widget.\n *\n * @param widget - The widget to insert into the layout.\n *\n * #### Notes\n * The index will be clamped to the bounds of the widgets.\n *\n * If the widget is already added to the layout, it will be moved.\n *\n * #### Undefined Behavior\n * An `index` which is non-integral.\n */\n insertWidget(index: number, widget: Widget): void {\n if (!widget.id) {\n widget.id = `id-${UUID.uuid4()}`;\n }\n super.insertWidget(index, widget);\n }\n\n /**\n * Attach a widget to the parent's DOM node.\n *\n * @param index - The current index of the widget in the layout.\n *\n * @param widget - The widget to attach to the parent.\n */\n protected attachWidget(index: number, widget: Widget): void {\n const title = Private.createTitle(this.renderer, widget.title);\n\n ArrayExt.insert(this._titles, index, title);\n\n // Add the title node to the parent before the widget.\n this.parent!.node.appendChild(title);\n\n widget.node.setAttribute('role', 'region');\n widget.node.setAttribute('aria-labelledby', title.id);\n\n super.attachWidget(index, widget);\n }\n\n /**\n * Move a widget in the parent's DOM node.\n *\n * @param fromIndex - The previous index of the widget in the layout.\n *\n * @param toIndex - The current index of the widget in the layout.\n *\n * @param widget - The widget to move in the parent.\n */\n protected moveWidget(\n fromIndex: number,\n toIndex: number,\n widget: Widget\n ): void {\n ArrayExt.move(this._titles, fromIndex, toIndex);\n super.moveWidget(fromIndex, toIndex, widget);\n }\n\n /**\n * Detach a widget from the parent's DOM node.\n *\n * @param index - The previous index of the widget in the layout.\n *\n * @param widget - The widget to detach from the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected detachWidget(index: number, widget: Widget): void {\n const title = ArrayExt.removeAt(this._titles, index);\n\n this.parent!.node.removeChild(title!);\n\n super.detachWidget(index, widget);\n }\n\n /**\n * Update the item position.\n *\n * @param i Item index\n * @param isHorizontal Whether the layout is horizontal or not\n * @param left Left position in pixels\n * @param top Top position in pixels\n * @param height Item height\n * @param width Item width\n * @param size Item size\n */\n protected updateItemPosition(\n i: number,\n isHorizontal: boolean,\n left: number,\n top: number,\n height: number,\n width: number,\n size: number\n ): void {\n const titleStyle = this._titles[i].style;\n\n // Titles must be rotated for horizontal accordion panel using CSS: see accordionpanel.css\n titleStyle.top = `${top}px`;\n titleStyle.left = `${left}px`;\n titleStyle.height = `${this.widgetOffset}px`;\n if (isHorizontal) {\n titleStyle.width = `${height}px`;\n } else {\n titleStyle.width = `${width}px`;\n }\n\n super.updateItemPosition(i, isHorizontal, left, top, height, width, size);\n }\n\n private _titles: HTMLElement[] = [];\n}\n\nexport namespace AccordionLayout {\n /**\n * A type alias for a accordion layout orientation.\n */\n export type Orientation = SplitLayout.Orientation;\n\n /**\n * A type alias for a accordion layout alignment.\n */\n export type Alignment = SplitLayout.Alignment;\n\n /**\n * An options object for initializing a accordion layout.\n */\n export interface IOptions extends SplitLayout.IOptions {\n /**\n * The renderer to use for the accordion layout.\n */\n renderer: IRenderer;\n\n /**\n * The section title height or width depending on the orientation.\n *\n * The default is `22`.\n */\n titleSpace?: number;\n }\n\n /**\n * A renderer for use with an accordion layout.\n */\n export interface IRenderer extends SplitLayout.IRenderer {\n /**\n * Common class name for all accordion titles.\n */\n readonly titleClassName: string;\n\n /**\n * Render the element for a section title.\n *\n * @param title - The data to use for rendering the section title.\n *\n * @returns A element representing the section title.\n */\n createSectionTitle(title: Title): HTMLElement;\n }\n}\n\nnamespace Private {\n /**\n * Create the title HTML element.\n *\n * @param renderer Accordion renderer\n * @param data Widget title\n * @returns Title HTML element\n */\n export function createTitle(\n renderer: AccordionLayout.IRenderer,\n data: Title,\n expanded: boolean = true\n ): HTMLElement {\n const title = renderer.createSectionTitle(data);\n title.style.position = 'absolute';\n title.style.contain = 'strict';\n title.setAttribute('aria-label', `${data.label} Section`);\n title.setAttribute('aria-expanded', expanded ? 'true' : 'false');\n title.setAttribute('aria-controls', data.owner.id);\n if (expanded) {\n title.classList.add('lm-mod-expanded');\n }\n return title;\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { PanelLayout } from './panellayout';\n\nimport { Widget } from './widget';\n\n/**\n * A simple and convenient panel widget class.\n *\n * #### Notes\n * This class is suitable as a base class for implementing a variety of\n * convenience panel widgets, but can also be used directly with CSS to\n * arrange a collection of widgets.\n *\n * This class provides a convenience wrapper around a {@link PanelLayout}.\n */\nexport class Panel extends Widget {\n /**\n * Construct a new panel.\n *\n * @param options - The options for initializing the panel.\n */\n constructor(options: Panel.IOptions = {}) {\n super();\n this.addClass('lm-Panel');\n this.layout = Private.createLayout(options);\n }\n\n /**\n * A read-only array of the widgets in the panel.\n */\n get widgets(): ReadonlyArray {\n return (this.layout as PanelLayout).widgets;\n }\n\n /**\n * Add a widget to the end of the panel.\n *\n * @param widget - The widget to add to the panel.\n *\n * #### Notes\n * If the widget is already contained in the panel, it will be moved.\n */\n addWidget(widget: Widget): void {\n (this.layout as PanelLayout).addWidget(widget);\n }\n\n /**\n * Insert a widget at the specified index.\n *\n * @param index - The index at which to insert the widget.\n *\n * @param widget - The widget to insert into to the panel.\n *\n * #### Notes\n * If the widget is already contained in the panel, it will be moved.\n */\n insertWidget(index: number, widget: Widget): void {\n (this.layout as PanelLayout).insertWidget(index, widget);\n }\n}\n\n/**\n * The namespace for the `Panel` class statics.\n */\nexport namespace Panel {\n /**\n * An options object for creating a panel.\n */\n export interface IOptions {\n /**\n * The panel layout to use for the panel.\n *\n * The default is a new `PanelLayout`.\n */\n layout?: PanelLayout;\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * Create a panel layout for the given panel options.\n */\n export function createLayout(options: Panel.IOptions): PanelLayout {\n return options.layout || new PanelLayout();\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { IDisposable } from '@lumino/disposable';\n\nimport { Drag } from '@lumino/dragdrop';\n\nimport { Message } from '@lumino/messaging';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { Panel } from './panel';\n\nimport { SplitLayout } from './splitlayout';\n\nimport { Widget } from './widget';\n\n/**\n * A panel which arranges its widgets into resizable sections.\n *\n * #### Notes\n * This class provides a convenience wrapper around a {@link SplitLayout}.\n */\nexport class SplitPanel extends Panel {\n /**\n * Construct a new split panel.\n *\n * @param options - The options for initializing the split panel.\n */\n constructor(options: SplitPanel.IOptions = {}) {\n super({ layout: Private.createLayout(options) });\n this.addClass('lm-SplitPanel');\n }\n\n /**\n * Dispose of the resources held by the panel.\n */\n dispose(): void {\n this._releaseMouse();\n super.dispose();\n }\n\n /**\n * Get the layout orientation for the split panel.\n */\n get orientation(): SplitPanel.Orientation {\n return (this.layout as SplitLayout).orientation;\n }\n\n /**\n * Set the layout orientation for the split panel.\n */\n set orientation(value: SplitPanel.Orientation) {\n (this.layout as SplitLayout).orientation = value;\n }\n\n /**\n * Get the content alignment for the split panel.\n *\n * #### Notes\n * This is the alignment of the widgets in the layout direction.\n *\n * The alignment has no effect if the widgets can expand to fill the\n * entire split panel.\n */\n get alignment(): SplitPanel.Alignment {\n return (this.layout as SplitLayout).alignment;\n }\n\n /**\n * Set the content alignment for the split panel.\n *\n * #### Notes\n * This is the alignment of the widgets in the layout direction.\n *\n * The alignment has no effect if the widgets can expand to fill the\n * entire split panel.\n */\n set alignment(value: SplitPanel.Alignment) {\n (this.layout as SplitLayout).alignment = value;\n }\n\n /**\n * Get the inter-element spacing for the split panel.\n */\n get spacing(): number {\n return (this.layout as SplitLayout).spacing;\n }\n\n /**\n * Set the inter-element spacing for the split panel.\n */\n set spacing(value: number) {\n (this.layout as SplitLayout).spacing = value;\n }\n\n /**\n * The renderer used by the split panel.\n */\n get renderer(): SplitPanel.IRenderer {\n return (this.layout as SplitLayout).renderer;\n }\n\n /**\n * A signal emitted when a split handle has moved.\n */\n get handleMoved(): ISignal {\n return this._handleMoved;\n }\n\n /**\n * A read-only array of the split handles in the panel.\n */\n get handles(): ReadonlyArray {\n return (this.layout as SplitLayout).handles;\n }\n\n /**\n * Get the relative sizes of the widgets in the panel.\n *\n * @returns A new array of the relative sizes of the widgets.\n *\n * #### Notes\n * The returned sizes reflect the sizes of the widgets normalized\n * relative to their siblings.\n *\n * This method **does not** measure the DOM nodes.\n */\n relativeSizes(): number[] {\n return (this.layout as SplitLayout).relativeSizes();\n }\n\n /**\n * Set the relative sizes for the widgets in the panel.\n *\n * @param sizes - The relative sizes for the widgets in the panel.\n * @param update - Update the layout after setting relative sizes.\n * Default is True.\n *\n * #### Notes\n * Extra values are ignored, too few will yield an undefined layout.\n *\n * The actual geometry of the DOM nodes is updated asynchronously.\n */\n setRelativeSizes(sizes: number[], update = true): void {\n (this.layout as SplitLayout).setRelativeSizes(sizes, update);\n }\n\n /**\n * Handle the DOM events for the split panel.\n *\n * @param event - The DOM event sent to the panel.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the panel's DOM node. It should\n * not be called directly by user code.\n */\n handleEvent(event: Event): void {\n switch (event.type) {\n case 'pointerdown':\n this._evtPointerDown(event as PointerEvent);\n break;\n case 'pointermove':\n this._evtPointerMove(event as PointerEvent);\n break;\n case 'pointerup':\n this._evtPointerUp(event as PointerEvent);\n break;\n case 'keydown':\n this._evtKeyDown(event as KeyboardEvent);\n break;\n case 'contextmenu':\n event.preventDefault();\n event.stopPropagation();\n break;\n }\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n this.node.addEventListener('pointerdown', this);\n }\n\n /**\n * A message handler invoked on an `'after-detach'` message.\n */\n protected onAfterDetach(msg: Message): void {\n this.node.removeEventListener('pointerdown', this);\n this._releaseMouse();\n }\n\n /**\n * A message handler invoked on a `'child-added'` message.\n */\n protected onChildAdded(msg: Widget.ChildMessage): void {\n msg.child.addClass('lm-SplitPanel-child');\n this._releaseMouse();\n }\n\n /**\n * A message handler invoked on a `'child-removed'` message.\n */\n protected onChildRemoved(msg: Widget.ChildMessage): void {\n msg.child.removeClass('lm-SplitPanel-child');\n this._releaseMouse();\n }\n\n /**\n * Handle the `'keydown'` event for the split panel.\n */\n private _evtKeyDown(event: KeyboardEvent): void {\n // Stop input events during drag.\n if (this._pressData) {\n event.preventDefault();\n event.stopPropagation();\n }\n\n // Release the mouse if `Escape` is pressed.\n if (event.keyCode === 27) {\n this._releaseMouse();\n }\n }\n\n /**\n * Handle the `'pointerdown'` event for the split panel.\n */\n private _evtPointerDown(event: PointerEvent): void {\n // Do nothing if the primary button is not pressed.\n if (event.button !== 0) {\n return;\n }\n\n // Find the handle which contains the target, if any.\n let layout = this.layout as SplitLayout;\n let index = ArrayExt.findFirstIndex(layout.handles, handle => {\n return handle.contains(event.target as HTMLElement);\n });\n\n // Bail early if the mouse press was not on a handle.\n if (index === -1) {\n return;\n }\n\n // Stop the event when a split handle is pressed.\n event.preventDefault();\n event.stopPropagation();\n\n // Add the extra document listeners.\n document.addEventListener('pointerup', this, true);\n document.addEventListener('pointermove', this, true);\n document.addEventListener('keydown', this, true);\n document.addEventListener('contextmenu', this, true);\n\n // Compute the offset delta for the handle press.\n let delta: number;\n let handle = layout.handles[index];\n let rect = handle.getBoundingClientRect();\n if (layout.orientation === 'horizontal') {\n delta = event.clientX - rect.left;\n } else {\n delta = event.clientY - rect.top;\n }\n\n // Override the cursor and store the press data.\n let style = window.getComputedStyle(handle);\n let override = Drag.overrideCursor(style.cursor!);\n this._pressData = { index, delta, override };\n }\n\n /**\n * Handle the `'pointermove'` event for the split panel.\n */\n private _evtPointerMove(event: PointerEvent): void {\n // Stop the event when dragging a split handle.\n event.preventDefault();\n event.stopPropagation();\n\n // Compute the desired offset position for the handle.\n let pos: number;\n let layout = this.layout as SplitLayout;\n let rect = this.node.getBoundingClientRect();\n if (layout.orientation === 'horizontal') {\n pos = event.clientX - rect.left - this._pressData!.delta;\n } else {\n pos = event.clientY - rect.top - this._pressData!.delta;\n }\n\n // Move the handle as close to the desired position as possible.\n layout.moveHandle(this._pressData!.index, pos);\n }\n\n /**\n * Handle the `'pointerup'` event for the split panel.\n */\n private _evtPointerUp(event: PointerEvent): void {\n // Do nothing if the primary button is not released.\n if (event.button !== 0) {\n return;\n }\n\n // Stop the event when releasing a handle.\n event.preventDefault();\n event.stopPropagation();\n\n // Finalize the mouse release.\n this._releaseMouse();\n }\n\n /**\n * Release the mouse grab for the split panel.\n */\n private _releaseMouse(): void {\n // Bail early if no drag is in progress.\n if (!this._pressData) {\n return;\n }\n\n // Clear the override cursor.\n this._pressData.override.dispose();\n this._pressData = null;\n\n // Emit the handle moved signal.\n this._handleMoved.emit();\n\n // Remove the extra document listeners.\n document.removeEventListener('keydown', this, true);\n document.removeEventListener('pointerup', this, true);\n document.removeEventListener('pointermove', this, true);\n document.removeEventListener('contextmenu', this, true);\n }\n\n private _handleMoved = new Signal(this);\n private _pressData: Private.IPressData | null = null;\n}\n\n/**\n * The namespace for the `SplitPanel` class statics.\n */\nexport namespace SplitPanel {\n /**\n * A type alias for a split panel orientation.\n */\n export type Orientation = SplitLayout.Orientation;\n\n /**\n * A type alias for a split panel alignment.\n */\n export type Alignment = SplitLayout.Alignment;\n\n /**\n * A type alias for a split panel renderer.\n */\n export type IRenderer = SplitLayout.IRenderer;\n\n /**\n * An options object for initializing a split panel.\n */\n export interface IOptions {\n /**\n * The renderer to use for the split panel.\n *\n * The default is a shared renderer instance.\n */\n renderer?: IRenderer;\n\n /**\n * The layout orientation of the panel.\n *\n * The default is `'horizontal'`.\n */\n orientation?: Orientation;\n\n /**\n * The content alignment of the panel.\n *\n * The default is `'start'`.\n */\n alignment?: Alignment;\n\n /**\n * The spacing between items in the panel.\n *\n * The default is `4`.\n */\n spacing?: number;\n\n /**\n * The split layout to use for the split panel.\n *\n * If this is provided, the other options are ignored.\n *\n * The default is a new `SplitLayout`.\n */\n layout?: SplitLayout;\n }\n\n /**\n * The default implementation of `IRenderer`.\n */\n export class Renderer implements IRenderer {\n /**\n * Create a new handle for use with a split panel.\n *\n * @returns A new handle element for a split panel.\n */\n createHandle(): HTMLDivElement {\n let handle = document.createElement('div');\n handle.className = 'lm-SplitPanel-handle';\n return handle;\n }\n }\n\n /**\n * The default `Renderer` instance.\n */\n export const defaultRenderer = new Renderer();\n\n /**\n * Get the split panel stretch factor for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The split panel stretch factor for the widget.\n */\n export function getStretch(widget: Widget): number {\n return SplitLayout.getStretch(widget);\n }\n\n /**\n * Set the split panel stretch factor for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the stretch factor.\n */\n export function setStretch(widget: Widget, value: number): void {\n SplitLayout.setStretch(widget, value);\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * An object which holds mouse press data.\n */\n export interface IPressData {\n /**\n * The index of the pressed handle.\n */\n index: number;\n\n /**\n * The offset of the press in handle coordinates.\n */\n delta: number;\n\n /**\n * The disposable which will clear the override cursor.\n */\n override: IDisposable;\n }\n\n /**\n * Create a split layout for the given panel options.\n */\n export function createLayout(options: SplitPanel.IOptions): SplitLayout {\n return (\n options.layout ||\n new SplitLayout({\n renderer: options.renderer || SplitPanel.defaultRenderer,\n orientation: options.orientation,\n alignment: options.alignment,\n spacing: options.spacing\n })\n );\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n\nimport { ArrayExt } from '@lumino/algorithm';\nimport { Message } from '@lumino/messaging';\nimport { ISignal, Signal } from '@lumino/signaling';\nimport { AccordionLayout } from './accordionlayout';\nimport { SplitLayout } from './splitlayout';\nimport { SplitPanel } from './splitpanel';\nimport { Title } from './title';\nimport { Widget } from './widget';\n\n/**\n * A panel which arranges its widgets into resizable sections separated by a title widget.\n *\n * #### Notes\n * This class provides a convenience wrapper around {@link AccordionLayout}.\n *\n * See also the related [example](../../examples/accordionpanel/index.html) and\n * its [source](https://github.com/jupyterlab/lumino/tree/main/examples/example-accordionpanel).\n */\nexport class AccordionPanel extends SplitPanel {\n /**\n * Construct a new accordion panel.\n *\n * @param options - The options for initializing the accordion panel.\n *\n */\n constructor(options: AccordionPanel.IOptions = {}) {\n super({ ...options, layout: Private.createLayout(options) });\n this.addClass('lm-AccordionPanel');\n }\n\n /**\n * The renderer used by the accordion panel.\n */\n get renderer(): AccordionPanel.IRenderer {\n return (this.layout as AccordionLayout).renderer;\n }\n\n /**\n * The section title space.\n *\n * This is the height if the panel is vertical and the width if it is\n * horizontal.\n */\n get titleSpace(): number {\n return (this.layout as AccordionLayout).titleSpace;\n }\n set titleSpace(value: number) {\n (this.layout as AccordionLayout).titleSpace = value;\n }\n\n /**\n * A read-only array of the section titles in the panel.\n */\n get titles(): ReadonlyArray {\n return (this.layout as AccordionLayout).titles;\n }\n\n /**\n * A signal emitted when a widget of the AccordionPanel is collapsed or expanded.\n */\n get expansionToggled(): ISignal {\n return this._expansionToggled;\n }\n\n /**\n * Add a widget to the end of the panel.\n *\n * @param widget - The widget to add to the panel.\n *\n * #### Notes\n * If the widget is already contained in the panel, it will be moved.\n */\n addWidget(widget: Widget): void {\n super.addWidget(widget);\n widget.title.changed.connect(this._onTitleChanged, this);\n }\n\n /**\n * Collapse the widget at position `index`.\n *\n * #### Notes\n * If no widget is found for `index`, this will bail.\n *\n * @param index Widget index\n */\n collapse(index: number): void {\n const widget = (this.layout as AccordionLayout).widgets[index];\n\n if (widget && !widget.isHidden) {\n this._toggleExpansion(index);\n }\n }\n\n /**\n * Expand the widget at position `index`.\n *\n * #### Notes\n * If no widget is found for `index`, this will bail.\n *\n * @param index Widget index\n */\n expand(index: number): void {\n const widget = (this.layout as AccordionLayout).widgets[index];\n\n if (widget && widget.isHidden) {\n this._toggleExpansion(index);\n }\n }\n\n /**\n * Insert a widget at the specified index.\n *\n * @param index - The index at which to insert the widget.\n *\n * @param widget - The widget to insert into to the panel.\n *\n * #### Notes\n * If the widget is already contained in the panel, it will be moved.\n */\n insertWidget(index: number, widget: Widget): void {\n super.insertWidget(index, widget);\n widget.title.changed.connect(this._onTitleChanged, this);\n }\n\n /**\n * Handle the DOM events for the accordion panel.\n *\n * @param event - The DOM event sent to the panel.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the panel's DOM node. It should\n * not be called directly by user code.\n */\n handleEvent(event: Event): void {\n super.handleEvent(event);\n switch (event.type) {\n case 'click':\n this._evtClick(event as MouseEvent);\n break;\n case 'keydown':\n this._eventKeyDown(event as KeyboardEvent);\n break;\n }\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n this.node.addEventListener('click', this);\n this.node.addEventListener('keydown', this);\n super.onBeforeAttach(msg);\n }\n\n /**\n * A message handler invoked on an `'after-detach'` message.\n */\n protected onAfterDetach(msg: Message): void {\n super.onAfterDetach(msg);\n this.node.removeEventListener('click', this);\n this.node.removeEventListener('keydown', this);\n }\n\n /**\n * Handle the `changed` signal of a title object.\n */\n private _onTitleChanged(sender: Title): void {\n const index = ArrayExt.findFirstIndex(this.widgets, widget => {\n return widget.contains(sender.owner);\n });\n\n if (index >= 0) {\n (this.layout as AccordionLayout).updateTitle(index, sender.owner);\n this.update();\n }\n }\n\n /**\n * Compute the size of widgets in this panel on the title click event.\n * On closing, the size of the widget is cached and we will try to expand\n * the last opened widget.\n * On opening, we will use the cached size if it is available to restore the\n * widget.\n * In both cases, if we can not compute the size of widgets, we will let\n * `SplitLayout` decide.\n *\n * @param index - The index of widget to be opened of closed\n *\n * @returns Relative size of widgets in this panel, if this size can\n * not be computed, return `undefined`\n */\n private _computeWidgetSize(index: number): number[] | undefined {\n const layout = this.layout as AccordionLayout;\n\n const widget = layout.widgets[index];\n if (!widget) {\n return undefined;\n }\n const isHidden = widget.isHidden;\n const widgetSizes = layout.absoluteSizes();\n const delta = (isHidden ? -1 : 1) * this.spacing;\n const totalSize = widgetSizes.reduce(\n (prev: number, curr: number) => prev + curr\n );\n\n let newSize = [...widgetSizes];\n\n if (!isHidden) {\n // Hide the widget\n const currentSize = widgetSizes[index];\n\n this._widgetSizesCache.set(widget, currentSize);\n newSize[index] = 0;\n\n const widgetToCollapse = newSize.map(sz => sz > 0).lastIndexOf(true);\n if (widgetToCollapse === -1) {\n // All widget are closed, let the `SplitLayout` compute widget sizes.\n return undefined;\n }\n\n newSize[widgetToCollapse] =\n widgetSizes[widgetToCollapse] + currentSize + delta;\n } else {\n // Show the widget\n const previousSize = this._widgetSizesCache.get(widget);\n if (!previousSize) {\n // Previous size is unavailable, let the `SplitLayout` compute widget sizes.\n return undefined;\n }\n newSize[index] += previousSize;\n\n const widgetToCollapse = newSize\n .map(sz => sz - previousSize > 0)\n .lastIndexOf(true);\n if (widgetToCollapse === -1) {\n // Can not reduce the size of one widget, reduce all opened widgets\n // proportionally with its size.\n newSize.forEach((_, idx) => {\n if (idx !== index) {\n newSize[idx] -=\n (widgetSizes[idx] / totalSize) * (previousSize - delta);\n }\n });\n } else {\n newSize[widgetToCollapse] -= previousSize - delta;\n }\n }\n return newSize.map(sz => sz / (totalSize + delta));\n }\n /**\n * Handle the `'click'` event for the accordion panel\n */\n private _evtClick(event: MouseEvent): void {\n const target = event.target as HTMLElement | null;\n\n if (target) {\n const index = ArrayExt.findFirstIndex(this.titles, title => {\n return title.contains(target);\n });\n\n if (index >= 0) {\n event.preventDefault();\n event.stopPropagation();\n this._toggleExpansion(index);\n }\n }\n }\n\n /**\n * Handle the `'keydown'` event for the accordion panel.\n */\n private _eventKeyDown(event: KeyboardEvent): void {\n if (event.defaultPrevented) {\n return;\n }\n\n const target = event.target as HTMLElement | null;\n let handled = false;\n if (target) {\n const index = ArrayExt.findFirstIndex(this.titles, title => {\n return title.contains(target);\n });\n\n if (index >= 0) {\n const keyCode = event.keyCode.toString();\n\n // If Space or Enter is pressed on title, emulate click event\n if (event.key.match(/Space|Enter/) || keyCode.match(/13|32/)) {\n target.click();\n handled = true;\n } else if (\n this.orientation === 'horizontal'\n ? event.key.match(/ArrowLeft|ArrowRight/) || keyCode.match(/37|39/)\n : event.key.match(/ArrowUp|ArrowDown/) || keyCode.match(/38|40/)\n ) {\n // If Up or Down (for vertical) / Left or Right (for horizontal) is pressed on title, loop on titles\n const direction =\n event.key.match(/ArrowLeft|ArrowUp/) || keyCode.match(/37|38/)\n ? -1\n : 1;\n const length = this.titles.length;\n const newIndex = (index + length + direction) % length;\n\n this.titles[newIndex].focus();\n handled = true;\n } else if (event.key === 'End' || keyCode === '35') {\n // If End is pressed on title, focus on the last title\n this.titles[this.titles.length - 1].focus();\n handled = true;\n } else if (event.key === 'Home' || keyCode === '36') {\n // If Home is pressed on title, focus on the first title\n this.titles[0].focus();\n handled = true;\n }\n }\n\n if (handled) {\n event.preventDefault();\n }\n }\n }\n\n private _toggleExpansion(index: number) {\n const title = this.titles[index];\n const widget = (this.layout as AccordionLayout).widgets[index];\n\n const newSize = this._computeWidgetSize(index);\n if (newSize) {\n this.setRelativeSizes(newSize, false);\n }\n\n if (widget.isHidden) {\n title.classList.add('lm-mod-expanded');\n title.setAttribute('aria-expanded', 'true');\n widget.show();\n } else {\n title.classList.remove('lm-mod-expanded');\n title.setAttribute('aria-expanded', 'false');\n widget.hide();\n }\n\n // Emit the expansion state signal.\n this._expansionToggled.emit(index);\n }\n\n private _widgetSizesCache: WeakMap = new WeakMap();\n private _expansionToggled = new Signal(this);\n}\n\n/**\n * The namespace for the `AccordionPanel` class statics.\n */\nexport namespace AccordionPanel {\n /**\n * A type alias for a accordion panel orientation.\n */\n export type Orientation = SplitLayout.Orientation;\n\n /**\n * A type alias for a accordion panel alignment.\n */\n export type Alignment = SplitLayout.Alignment;\n\n /**\n * A type alias for a accordion panel renderer.\n */\n export type IRenderer = AccordionLayout.IRenderer;\n\n /**\n * An options object for initializing a accordion panel.\n */\n export interface IOptions extends Partial {\n /**\n * The accordion layout to use for the accordion panel.\n *\n * If this is provided, the other options are ignored.\n *\n * The default is a new `AccordionLayout`.\n */\n layout?: AccordionLayout;\n }\n\n /**\n * The default implementation of `IRenderer`.\n */\n export class Renderer extends SplitPanel.Renderer implements IRenderer {\n constructor() {\n super();\n this._uuid = ++Renderer._nInstance;\n }\n /**\n * A selector which matches any title node in the accordion.\n */\n readonly titleClassName = 'lm-AccordionPanel-title';\n\n /**\n * Render the collapse indicator for a section title.\n *\n * @param data - The data to use for rendering the section title.\n *\n * @returns A element representing the collapse indicator.\n */\n createCollapseIcon(data: Title): HTMLElement {\n return document.createElement('span');\n }\n\n /**\n * Render the element for a section title.\n *\n * @param data - The data to use for rendering the section title.\n *\n * @returns A element representing the section title.\n */\n createSectionTitle(data: Title): HTMLElement {\n const handle = document.createElement('h3');\n handle.setAttribute('tabindex', '0');\n handle.id = this.createTitleKey(data);\n handle.className = this.titleClassName;\n for (const aData in data.dataset) {\n handle.dataset[aData] = data.dataset[aData];\n }\n\n const collapser = handle.appendChild(this.createCollapseIcon(data));\n collapser.className = 'lm-AccordionPanel-titleCollapser';\n\n const label = handle.appendChild(document.createElement('span'));\n label.className = 'lm-AccordionPanel-titleLabel';\n label.textContent = data.label;\n label.title = data.caption || data.label;\n\n return handle;\n }\n\n /**\n * Create a unique render key for the title.\n *\n * @param data - The data to use for the title.\n *\n * @returns The unique render key for the title.\n *\n * #### Notes\n * This method caches the key against the section title the first time\n * the key is generated.\n */\n createTitleKey(data: Title): string {\n let key = this._titleKeys.get(data);\n if (key === undefined) {\n key = `title-key-${this._uuid}-${this._titleID++}`;\n this._titleKeys.set(data, key);\n }\n return key;\n }\n\n private static _nInstance = 0;\n private readonly _uuid: number;\n private _titleID = 0;\n private _titleKeys = new WeakMap, string>();\n }\n\n /**\n * The default `Renderer` instance.\n */\n export const defaultRenderer = new Renderer();\n}\n\nnamespace Private {\n /**\n * Create an accordion layout for the given panel options.\n *\n * @param options Panel options\n * @returns Panel layout\n */\n export function createLayout(\n options: AccordionPanel.IOptions\n ): AccordionLayout {\n return (\n options.layout ||\n new AccordionLayout({\n renderer: options.renderer || AccordionPanel.defaultRenderer,\n orientation: options.orientation,\n alignment: options.alignment,\n spacing: options.spacing,\n titleSpace: options.titleSpace\n })\n );\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { AttachedProperty } from '@lumino/properties';\n\nimport { BoxEngine, BoxSizer } from './boxengine';\n\nimport { LayoutItem } from './layout';\n\nimport { PanelLayout } from './panellayout';\n\nimport Utils from './utils';\n\nimport { Widget } from './widget';\n\n/**\n * A layout which arranges its widgets in a single row or column.\n */\nexport class BoxLayout extends PanelLayout {\n /**\n * Construct a new box layout.\n *\n * @param options - The options for initializing the layout.\n */\n constructor(options: BoxLayout.IOptions = {}) {\n super();\n if (options.direction !== undefined) {\n this._direction = options.direction;\n }\n if (options.alignment !== undefined) {\n this._alignment = options.alignment;\n }\n if (options.spacing !== undefined) {\n this._spacing = Utils.clampDimension(options.spacing);\n }\n }\n\n /**\n * Dispose of the resources held by the layout.\n */\n dispose(): void {\n // Dispose of the layout items.\n for (const item of this._items) {\n item.dispose();\n }\n\n // Clear the layout state.\n this._box = null;\n this._items.length = 0;\n this._sizers.length = 0;\n\n // Dispose of the rest of the layout.\n super.dispose();\n }\n\n /**\n * Get the layout direction for the box layout.\n */\n get direction(): BoxLayout.Direction {\n return this._direction;\n }\n\n /**\n * Set the layout direction for the box layout.\n */\n set direction(value: BoxLayout.Direction) {\n if (this._direction === value) {\n return;\n }\n this._direction = value;\n if (!this.parent) {\n return;\n }\n this.parent.dataset['direction'] = value;\n this.parent.fit();\n }\n\n /**\n * Get the content alignment for the box layout.\n *\n * #### Notes\n * This is the alignment of the widgets in the layout direction.\n *\n * The alignment has no effect if the widgets can expand to fill the\n * entire box layout.\n */\n get alignment(): BoxLayout.Alignment {\n return this._alignment;\n }\n\n /**\n * Set the content alignment for the box layout.\n *\n * #### Notes\n * This is the alignment of the widgets in the layout direction.\n *\n * The alignment has no effect if the widgets can expand to fill the\n * entire box layout.\n */\n set alignment(value: BoxLayout.Alignment) {\n if (this._alignment === value) {\n return;\n }\n this._alignment = value;\n if (!this.parent) {\n return;\n }\n this.parent.dataset['alignment'] = value;\n this.parent.update();\n }\n\n /**\n * Get the inter-element spacing for the box layout.\n */\n get spacing(): number {\n return this._spacing;\n }\n\n /**\n * Set the inter-element spacing for the box layout.\n */\n set spacing(value: number) {\n value = Utils.clampDimension(value);\n if (this._spacing === value) {\n return;\n }\n this._spacing = value;\n if (!this.parent) {\n return;\n }\n this.parent.fit();\n }\n\n /**\n * Perform layout initialization which requires the parent widget.\n */\n protected init(): void {\n this.parent!.dataset['direction'] = this.direction;\n this.parent!.dataset['alignment'] = this.alignment;\n super.init();\n }\n\n /**\n * Attach a widget to the parent's DOM node.\n *\n * @param index - The current index of the widget in the layout.\n *\n * @param widget - The widget to attach to the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected attachWidget(index: number, widget: Widget): void {\n // Create and add a new layout item for the widget.\n ArrayExt.insert(this._items, index, new LayoutItem(widget));\n\n // Create and add a new sizer for the widget.\n ArrayExt.insert(this._sizers, index, new BoxSizer());\n\n // Send a `'before-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n }\n\n // Add the widget's node to the parent.\n this.parent!.node.appendChild(widget.node);\n\n // Send an `'after-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n\n // Post a fit request for the parent widget.\n this.parent!.fit();\n }\n\n /**\n * Move a widget in the parent's DOM node.\n *\n * @param fromIndex - The previous index of the widget in the layout.\n *\n * @param toIndex - The current index of the widget in the layout.\n *\n * @param widget - The widget to move in the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected moveWidget(\n fromIndex: number,\n toIndex: number,\n widget: Widget\n ): void {\n // Move the layout item for the widget.\n ArrayExt.move(this._items, fromIndex, toIndex);\n\n // Move the sizer for the widget.\n ArrayExt.move(this._sizers, fromIndex, toIndex);\n\n // Post an update request for the parent widget.\n this.parent!.update();\n }\n\n /**\n * Detach a widget from the parent's DOM node.\n *\n * @param index - The previous index of the widget in the layout.\n *\n * @param widget - The widget to detach from the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected detachWidget(index: number, widget: Widget): void {\n // Remove the layout item for the widget.\n let item = ArrayExt.removeAt(this._items, index);\n\n // Remove the sizer for the widget.\n ArrayExt.removeAt(this._sizers, index);\n\n // Send a `'before-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n }\n\n // Remove the widget's node from the parent.\n this.parent!.node.removeChild(widget.node);\n\n // Send an `'after-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n\n // Dispose of the layout item.\n item!.dispose();\n\n // Post a fit request for the parent widget.\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'before-show'` message.\n */\n protected onBeforeShow(msg: Message): void {\n super.onBeforeShow(msg);\n this.parent!.update();\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n super.onBeforeAttach(msg);\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-shown'` message.\n */\n protected onChildShown(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-hidden'` message.\n */\n protected onChildHidden(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'resize'` message.\n */\n protected onResize(msg: Widget.ResizeMessage): void {\n if (this.parent!.isVisible) {\n this._update(msg.width, msg.height);\n }\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n protected onUpdateRequest(msg: Message): void {\n if (this.parent!.isVisible) {\n this._update(-1, -1);\n }\n }\n\n /**\n * A message handler invoked on a `'fit-request'` message.\n */\n protected onFitRequest(msg: Message): void {\n if (this.parent!.isAttached) {\n this._fit();\n }\n }\n\n /**\n * Fit the layout to the total size required by the widgets.\n */\n private _fit(): void {\n // Compute the visible item count.\n let nVisible = 0;\n for (let i = 0, n = this._items.length; i < n; ++i) {\n nVisible += +!this._items[i].isHidden;\n }\n\n // Update the fixed space for the visible items.\n this._fixed = this._spacing * Math.max(0, nVisible - 1);\n\n // Setup the computed minimum size.\n let horz = Private.isHorizontal(this._direction);\n let minW = horz ? this._fixed : 0;\n let minH = horz ? 0 : this._fixed;\n\n // Update the sizers and computed minimum size.\n for (let i = 0, n = this._items.length; i < n; ++i) {\n // Fetch the item and corresponding box sizer.\n let item = this._items[i];\n let sizer = this._sizers[i];\n\n // If the item is hidden, it should consume zero size.\n if (item.isHidden) {\n sizer.minSize = 0;\n sizer.maxSize = 0;\n continue;\n }\n\n // Update the size limits for the item.\n item.fit();\n\n // Update the size basis and stretch factor.\n sizer.sizeHint = BoxLayout.getSizeBasis(item.widget);\n sizer.stretch = BoxLayout.getStretch(item.widget);\n\n // Update the sizer limits and computed min size.\n if (horz) {\n sizer.minSize = item.minWidth;\n sizer.maxSize = item.maxWidth;\n minW += item.minWidth;\n minH = Math.max(minH, item.minHeight);\n } else {\n sizer.minSize = item.minHeight;\n sizer.maxSize = item.maxHeight;\n minH += item.minHeight;\n minW = Math.max(minW, item.minWidth);\n }\n }\n\n // Update the box sizing and add it to the computed min size.\n let box = (this._box = ElementExt.boxSizing(this.parent!.node));\n minW += box.horizontalSum;\n minH += box.verticalSum;\n\n // Update the parent's min size constraints.\n let style = this.parent!.node.style;\n style.minWidth = `${minW}px`;\n style.minHeight = `${minH}px`;\n\n // Set the dirty flag to ensure only a single update occurs.\n this._dirty = true;\n\n // Notify the ancestor that it should fit immediately. This may\n // cause a resize of the parent, fulfilling the required update.\n if (this.parent!.parent) {\n MessageLoop.sendMessage(this.parent!.parent!, Widget.Msg.FitRequest);\n }\n\n // If the dirty flag is still set, the parent was not resized.\n // Trigger the required update on the parent widget immediately.\n if (this._dirty) {\n MessageLoop.sendMessage(this.parent!, Widget.Msg.UpdateRequest);\n }\n }\n\n /**\n * Update the layout position and size of the widgets.\n *\n * The parent offset dimensions should be `-1` if unknown.\n */\n private _update(offsetWidth: number, offsetHeight: number): void {\n // Clear the dirty flag to indicate the update occurred.\n this._dirty = false;\n\n // Compute the visible item count.\n let nVisible = 0;\n for (let i = 0, n = this._items.length; i < n; ++i) {\n nVisible += +!this._items[i].isHidden;\n }\n\n // Bail early if there are no visible items to layout.\n if (nVisible === 0) {\n return;\n }\n\n // Measure the parent if the offset dimensions are unknown.\n if (offsetWidth < 0) {\n offsetWidth = this.parent!.node.offsetWidth;\n }\n if (offsetHeight < 0) {\n offsetHeight = this.parent!.node.offsetHeight;\n }\n\n // Ensure the parent box sizing data is computed.\n if (!this._box) {\n this._box = ElementExt.boxSizing(this.parent!.node);\n }\n\n // Compute the layout area adjusted for border and padding.\n let top = this._box.paddingTop;\n let left = this._box.paddingLeft;\n let width = offsetWidth - this._box.horizontalSum;\n let height = offsetHeight - this._box.verticalSum;\n\n // Distribute the layout space and adjust the start position.\n let delta: number;\n switch (this._direction) {\n case 'left-to-right':\n delta = BoxEngine.calc(this._sizers, Math.max(0, width - this._fixed));\n break;\n case 'top-to-bottom':\n delta = BoxEngine.calc(this._sizers, Math.max(0, height - this._fixed));\n break;\n case 'right-to-left':\n delta = BoxEngine.calc(this._sizers, Math.max(0, width - this._fixed));\n left += width;\n break;\n case 'bottom-to-top':\n delta = BoxEngine.calc(this._sizers, Math.max(0, height - this._fixed));\n top += height;\n break;\n default:\n throw 'unreachable';\n }\n\n // Setup the variables for justification and alignment offset.\n let extra = 0;\n let offset = 0;\n\n // Account for alignment if there is extra layout space.\n if (delta > 0) {\n switch (this._alignment) {\n case 'start':\n break;\n case 'center':\n extra = 0;\n offset = delta / 2;\n break;\n case 'end':\n extra = 0;\n offset = delta;\n break;\n case 'justify':\n extra = delta / nVisible;\n offset = 0;\n break;\n default:\n throw 'unreachable';\n }\n }\n\n // Layout the items using the computed box sizes.\n for (let i = 0, n = this._items.length; i < n; ++i) {\n // Fetch the item.\n let item = this._items[i];\n\n // Ignore hidden items.\n if (item.isHidden) {\n continue;\n }\n\n // Fetch the computed size for the widget.\n let size = this._sizers[i].size;\n\n // Update the widget geometry and advance the relevant edge.\n switch (this._direction) {\n case 'left-to-right':\n item.update(left + offset, top, size + extra, height);\n left += size + extra + this._spacing;\n break;\n case 'top-to-bottom':\n item.update(left, top + offset, width, size + extra);\n top += size + extra + this._spacing;\n break;\n case 'right-to-left':\n item.update(left - offset - size - extra, top, size + extra, height);\n left -= size + extra + this._spacing;\n break;\n case 'bottom-to-top':\n item.update(left, top - offset - size - extra, width, size + extra);\n top -= size + extra + this._spacing;\n break;\n default:\n throw 'unreachable';\n }\n }\n }\n\n private _fixed = 0;\n private _spacing = 4;\n private _dirty = false;\n private _sizers: BoxSizer[] = [];\n private _items: LayoutItem[] = [];\n private _box: ElementExt.IBoxSizing | null = null;\n private _alignment: BoxLayout.Alignment = 'start';\n private _direction: BoxLayout.Direction = 'top-to-bottom';\n}\n\n/**\n * The namespace for the `BoxLayout` class statics.\n */\nexport namespace BoxLayout {\n /**\n * A type alias for a box layout direction.\n */\n export type Direction =\n | 'left-to-right'\n | 'right-to-left'\n | 'top-to-bottom'\n | 'bottom-to-top';\n\n /**\n * A type alias for a box layout alignment.\n */\n export type Alignment = 'start' | 'center' | 'end' | 'justify';\n\n /**\n * An options object for initializing a box layout.\n */\n export interface IOptions {\n /**\n * The direction of the layout.\n *\n * The default is `'top-to-bottom'`.\n */\n direction?: Direction;\n\n /**\n * The content alignment of the layout.\n *\n * The default is `'start'`.\n */\n alignment?: Alignment;\n\n /**\n * The spacing between items in the layout.\n *\n * The default is `4`.\n */\n spacing?: number;\n }\n\n /**\n * Get the box layout stretch factor for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The box layout stretch factor for the widget.\n */\n export function getStretch(widget: Widget): number {\n return Private.stretchProperty.get(widget);\n }\n\n /**\n * Set the box layout stretch factor for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the stretch factor.\n */\n export function setStretch(widget: Widget, value: number): void {\n Private.stretchProperty.set(widget, value);\n }\n\n /**\n * Get the box layout size basis for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The box layout size basis for the widget.\n */\n export function getSizeBasis(widget: Widget): number {\n return Private.sizeBasisProperty.get(widget);\n }\n\n /**\n * Set the box layout size basis for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the size basis.\n */\n export function setSizeBasis(widget: Widget, value: number): void {\n Private.sizeBasisProperty.set(widget, value);\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * The property descriptor for a widget stretch factor.\n */\n export const stretchProperty = new AttachedProperty({\n name: 'stretch',\n create: () => 0,\n coerce: (owner, value) => Math.max(0, Math.floor(value)),\n changed: onChildSizingChanged\n });\n\n /**\n * The property descriptor for a widget size basis.\n */\n export const sizeBasisProperty = new AttachedProperty({\n name: 'sizeBasis',\n create: () => 0,\n coerce: (owner, value) => Math.max(0, Math.floor(value)),\n changed: onChildSizingChanged\n });\n\n /**\n * Test whether a direction has horizontal orientation.\n */\n export function isHorizontal(dir: BoxLayout.Direction): boolean {\n return dir === 'left-to-right' || dir === 'right-to-left';\n }\n\n /**\n * Clamp a spacing value to an integer >= 0.\n */\n export function clampSpacing(value: number): number {\n return Math.max(0, Math.floor(value));\n }\n\n /**\n * The change handler for the attached sizing properties.\n */\n function onChildSizingChanged(child: Widget): void {\n if (child.parent && child.parent.layout instanceof BoxLayout) {\n child.parent.fit();\n }\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { BoxLayout } from './boxlayout';\n\nimport { Panel } from './panel';\n\nimport { Widget } from './widget';\n\n/**\n * A panel which arranges its widgets in a single row or column.\n *\n * #### Notes\n * This class provides a convenience wrapper around a {@link BoxLayout}.\n */\nexport class BoxPanel extends Panel {\n /**\n * Construct a new box panel.\n *\n * @param options - The options for initializing the box panel.\n */\n constructor(options: BoxPanel.IOptions = {}) {\n super({ layout: Private.createLayout(options) });\n this.addClass('lm-BoxPanel');\n }\n\n /**\n * Get the layout direction for the box panel.\n */\n get direction(): BoxPanel.Direction {\n return (this.layout as BoxLayout).direction;\n }\n\n /**\n * Set the layout direction for the box panel.\n */\n set direction(value: BoxPanel.Direction) {\n (this.layout as BoxLayout).direction = value;\n }\n\n /**\n * Get the content alignment for the box panel.\n *\n * #### Notes\n * This is the alignment of the widgets in the layout direction.\n *\n * The alignment has no effect if the widgets can expand to fill the\n * entire box layout.\n */\n get alignment(): BoxPanel.Alignment {\n return (this.layout as BoxLayout).alignment;\n }\n\n /**\n * Set the content alignment for the box panel.\n *\n * #### Notes\n * This is the alignment of the widgets in the layout direction.\n *\n * The alignment has no effect if the widgets can expand to fill the\n * entire box layout.\n */\n set alignment(value: BoxPanel.Alignment) {\n (this.layout as BoxLayout).alignment = value;\n }\n\n /**\n * Get the inter-element spacing for the box panel.\n */\n get spacing(): number {\n return (this.layout as BoxLayout).spacing;\n }\n\n /**\n * Set the inter-element spacing for the box panel.\n */\n set spacing(value: number) {\n (this.layout as BoxLayout).spacing = value;\n }\n\n /**\n * A message handler invoked on a `'child-added'` message.\n */\n protected onChildAdded(msg: Widget.ChildMessage): void {\n msg.child.addClass('lm-BoxPanel-child');\n }\n\n /**\n * A message handler invoked on a `'child-removed'` message.\n */\n protected onChildRemoved(msg: Widget.ChildMessage): void {\n msg.child.removeClass('lm-BoxPanel-child');\n }\n}\n\n/**\n * The namespace for the `BoxPanel` class statics.\n */\nexport namespace BoxPanel {\n /**\n * A type alias for a box panel direction.\n */\n export type Direction = BoxLayout.Direction;\n\n /**\n * A type alias for a box panel alignment.\n */\n export type Alignment = BoxLayout.Alignment;\n\n /**\n * An options object for initializing a box panel.\n */\n export interface IOptions {\n /**\n * The layout direction of the panel.\n *\n * Possible values are documented in {@link BoxLayout.Direction}.\n *\n * The default is `'top-to-bottom'`.\n */\n direction?: Direction;\n\n /**\n * The content alignment of the panel.\n *\n * Possible values are documented in {@link BoxLayout.Alignment}.\n *\n * The default is `'start'`.\n */\n alignment?: Alignment;\n\n /**\n * The spacing between items in the panel.\n *\n * The default is `4`.\n */\n spacing?: number;\n\n /**\n * The box layout to use for the box panel.\n *\n * If this is provided, the other options are ignored.\n *\n * The default is a new `BoxLayout`.\n */\n layout?: BoxLayout;\n }\n\n /**\n * Get the box panel stretch factor for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The box panel stretch factor for the widget.\n */\n export function getStretch(widget: Widget): number {\n return BoxLayout.getStretch(widget);\n }\n\n /**\n * Set the box panel stretch factor for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the stretch factor.\n */\n export function setStretch(widget: Widget, value: number): void {\n BoxLayout.setStretch(widget, value);\n }\n\n /**\n * Get the box panel size basis for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The box panel size basis for the widget.\n */\n export function getSizeBasis(widget: Widget): number {\n return BoxLayout.getSizeBasis(widget);\n }\n\n /**\n * Set the box panel size basis for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the size basis.\n */\n export function setSizeBasis(widget: Widget, value: number): void {\n BoxLayout.setSizeBasis(widget, value);\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * Create a box layout for the given panel options.\n */\n export function createLayout(options: BoxPanel.IOptions): BoxLayout {\n return options.layout || new BoxLayout(options);\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt, StringExt } from '@lumino/algorithm';\n\nimport { JSONExt, ReadonlyJSONObject } from '@lumino/coreutils';\n\nimport { CommandRegistry } from '@lumino/commands';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message } from '@lumino/messaging';\n\nimport {\n ElementDataset,\n h,\n VirtualDOM,\n VirtualElement\n} from '@lumino/virtualdom';\n\nimport { Widget } from './widget';\n\n/**\n * A widget which displays command items as a searchable palette.\n */\nexport class CommandPalette extends Widget {\n /**\n * Construct a new command palette.\n *\n * @param options - The options for initializing the palette.\n */\n constructor(options: CommandPalette.IOptions) {\n super({ node: Private.createNode() });\n this.addClass('lm-CommandPalette');\n this.setFlag(Widget.Flag.DisallowLayout);\n this.commands = options.commands;\n this.renderer = options.renderer || CommandPalette.defaultRenderer;\n this.commands.commandChanged.connect(this._onGenericChange, this);\n this.commands.keyBindingChanged.connect(this._onGenericChange, this);\n }\n\n /**\n * Dispose of the resources held by the widget.\n */\n dispose(): void {\n this._items.length = 0;\n this._results = null;\n super.dispose();\n }\n\n /**\n * The command registry used by the command palette.\n */\n readonly commands: CommandRegistry;\n\n /**\n * The renderer used by the command palette.\n */\n readonly renderer: CommandPalette.IRenderer;\n\n /**\n * The command palette search node.\n *\n * #### Notes\n * This is the node which contains the search-related elements.\n */\n get searchNode(): HTMLDivElement {\n return this.node.getElementsByClassName(\n 'lm-CommandPalette-search'\n )[0] as HTMLDivElement;\n }\n\n /**\n * The command palette input node.\n *\n * #### Notes\n * This is the actual input node for the search area.\n */\n get inputNode(): HTMLInputElement {\n return this.node.getElementsByClassName(\n 'lm-CommandPalette-input'\n )[0] as HTMLInputElement;\n }\n\n /**\n * The command palette content node.\n *\n * #### Notes\n * This is the node which holds the command item nodes.\n *\n * Modifying this node directly can lead to undefined behavior.\n */\n get contentNode(): HTMLUListElement {\n return this.node.getElementsByClassName(\n 'lm-CommandPalette-content'\n )[0] as HTMLUListElement;\n }\n\n /**\n * A read-only array of the command items in the palette.\n */\n get items(): ReadonlyArray {\n return this._items;\n }\n\n /**\n * Add a command item to the command palette.\n *\n * @param options - The options for creating the command item.\n *\n * @returns The command item added to the palette.\n */\n addItem(options: CommandPalette.IItemOptions): CommandPalette.IItem {\n // Create a new command item for the options.\n let item = Private.createItem(this.commands, options);\n\n // Add the item to the array.\n this._items.push(item);\n\n // Refresh the search results.\n this.refresh();\n\n // Return the item added to the palette.\n return item;\n }\n\n /**\n * Adds command items to the command palette.\n *\n * @param items - An array of options for creating each command item.\n *\n * @returns The command items added to the palette.\n */\n addItems(items: CommandPalette.IItemOptions[]): CommandPalette.IItem[] {\n const newItems = items.map(item => Private.createItem(this.commands, item));\n newItems.forEach(item => this._items.push(item));\n this.refresh();\n return newItems;\n }\n\n /**\n * Remove an item from the command palette.\n *\n * @param item - The item to remove from the palette.\n *\n * #### Notes\n * This is a no-op if the item is not in the palette.\n */\n removeItem(item: CommandPalette.IItem): void {\n this.removeItemAt(this._items.indexOf(item));\n }\n\n /**\n * Remove the item at a given index from the command palette.\n *\n * @param index - The index of the item to remove.\n *\n * #### Notes\n * This is a no-op if the index is out of range.\n */\n removeItemAt(index: number): void {\n // Remove the item from the array.\n let item = ArrayExt.removeAt(this._items, index);\n\n // Bail if the index is out of range.\n if (!item) {\n return;\n }\n\n // Refresh the search results.\n this.refresh();\n }\n\n /**\n * Remove all items from the command palette.\n */\n clearItems(): void {\n // Bail if there is nothing to remove.\n if (this._items.length === 0) {\n return;\n }\n\n // Clear the array of items.\n this._items.length = 0;\n\n // Refresh the search results.\n this.refresh();\n }\n\n /**\n * Clear the search results and schedule an update.\n *\n * #### Notes\n * This should be called whenever the search results of the palette\n * should be updated.\n *\n * This is typically called automatically by the palette as needed,\n * but can be called manually if the input text is programatically\n * changed.\n *\n * The rendered results are updated asynchronously.\n */\n refresh(): void {\n this._results = null;\n if (this.inputNode.value !== '') {\n let clear = this.node.getElementsByClassName(\n 'lm-close-icon'\n )[0] as HTMLInputElement;\n clear.style.display = 'inherit';\n } else {\n let clear = this.node.getElementsByClassName(\n 'lm-close-icon'\n )[0] as HTMLInputElement;\n clear.style.display = 'none';\n }\n this.update();\n }\n\n /**\n * Handle the DOM events for the command palette.\n *\n * @param event - The DOM event sent to the command palette.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the command palette's DOM node.\n * It should not be called directly by user code.\n */\n handleEvent(event: Event): void {\n switch (event.type) {\n case 'click':\n this._evtClick(event as MouseEvent);\n break;\n case 'keydown':\n this._evtKeyDown(event as KeyboardEvent);\n break;\n case 'input':\n this.refresh();\n break;\n case 'focus':\n case 'blur':\n this._toggleFocused();\n break;\n }\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n this.node.addEventListener('click', this);\n this.node.addEventListener('keydown', this);\n this.node.addEventListener('input', this);\n this.node.addEventListener('focus', this, true);\n this.node.addEventListener('blur', this, true);\n }\n\n /**\n * A message handler invoked on an `'after-detach'` message.\n */\n protected onAfterDetach(msg: Message): void {\n this.node.removeEventListener('click', this);\n this.node.removeEventListener('keydown', this);\n this.node.removeEventListener('input', this);\n this.node.removeEventListener('focus', this, true);\n this.node.removeEventListener('blur', this, true);\n }\n\n /**\n * A message handler invoked on an `'after-show'` message.\n */\n protected onAfterShow(msg: Message): void {\n this.update();\n super.onAfterShow(msg);\n }\n\n /**\n * A message handler invoked on an `'activate-request'` message.\n */\n protected onActivateRequest(msg: Message): void {\n if (this.isAttached) {\n let input = this.inputNode;\n input.focus();\n input.select();\n }\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n protected onUpdateRequest(msg: Message): void {\n if (!this.isVisible) {\n // Ensure to clear the content if the widget is hidden\n VirtualDOM.render(null, this.contentNode);\n return;\n }\n\n // Fetch the current query text and content node.\n let query = this.inputNode.value;\n let contentNode = this.contentNode;\n\n // Ensure the search results are generated.\n let results = this._results;\n if (!results) {\n // Generate and store the new search results.\n results = this._results = Private.search(this._items, query);\n\n // Reset the active index.\n this._activeIndex = query\n ? ArrayExt.findFirstIndex(results, Private.canActivate)\n : -1;\n }\n\n // If there is no query and no results, clear the content.\n if (!query && results.length === 0) {\n VirtualDOM.render(null, contentNode);\n return;\n }\n\n // If the is a query but no results, render the empty message.\n if (query && results.length === 0) {\n let content = this.renderer.renderEmptyMessage({ query });\n VirtualDOM.render(content, contentNode);\n return;\n }\n\n // Create the render content for the search results.\n let renderer = this.renderer;\n let activeIndex = this._activeIndex;\n let content = new Array(results.length);\n for (let i = 0, n = results.length; i < n; ++i) {\n let result = results[i];\n if (result.type === 'header') {\n let indices = result.indices;\n let category = result.category;\n content[i] = renderer.renderHeader({ category, indices });\n } else {\n let item = result.item;\n let indices = result.indices;\n let active = i === activeIndex;\n content[i] = renderer.renderItem({ item, indices, active });\n }\n }\n\n // Render the search result content.\n VirtualDOM.render(content, contentNode);\n\n // Adjust the scroll position as needed.\n if (activeIndex < 0 || activeIndex >= results.length) {\n contentNode.scrollTop = 0;\n } else {\n let element = contentNode.children[activeIndex];\n ElementExt.scrollIntoViewIfNeeded(contentNode, element);\n }\n }\n\n /**\n * Handle the `'click'` event for the command palette.\n */\n private _evtClick(event: MouseEvent): void {\n // Bail if the click is not the left button.\n if (event.button !== 0) {\n return;\n }\n\n // Clear input if the target is clear button\n if ((event.target as HTMLElement).classList.contains('lm-close-icon')) {\n this.inputNode.value = '';\n this.refresh();\n return;\n }\n\n // Find the index of the item which was clicked.\n let index = ArrayExt.findFirstIndex(this.contentNode.children, node => {\n return node.contains(event.target as HTMLElement);\n });\n\n // Bail if the click was not on an item.\n if (index === -1) {\n return;\n }\n\n // Kill the event when a content item is clicked.\n event.preventDefault();\n event.stopPropagation();\n\n // Execute the item if possible.\n this._execute(index);\n }\n\n /**\n * Handle the `'keydown'` event for the command palette.\n */\n private _evtKeyDown(event: KeyboardEvent): void {\n if (event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) {\n return;\n }\n switch (event.keyCode) {\n case 13: // Enter\n event.preventDefault();\n event.stopPropagation();\n this._execute(this._activeIndex);\n break;\n case 38: // Up Arrow\n event.preventDefault();\n event.stopPropagation();\n this._activatePreviousItem();\n break;\n case 40: // Down Arrow\n event.preventDefault();\n event.stopPropagation();\n this._activateNextItem();\n break;\n }\n }\n\n /**\n * Activate the next enabled command item.\n */\n private _activateNextItem(): void {\n // Bail if there are no search results.\n if (!this._results || this._results.length === 0) {\n return;\n }\n\n // Find the next enabled item index.\n let ai = this._activeIndex;\n let n = this._results.length;\n let start = ai < n - 1 ? ai + 1 : 0;\n let stop = start === 0 ? n - 1 : start - 1;\n this._activeIndex = ArrayExt.findFirstIndex(\n this._results,\n Private.canActivate,\n start,\n stop\n );\n\n // Schedule an update of the items.\n this.update();\n }\n\n /**\n * Activate the previous enabled command item.\n */\n private _activatePreviousItem(): void {\n // Bail if there are no search results.\n if (!this._results || this._results.length === 0) {\n return;\n }\n\n // Find the previous enabled item index.\n let ai = this._activeIndex;\n let n = this._results.length;\n let start = ai <= 0 ? n - 1 : ai - 1;\n let stop = start === n - 1 ? 0 : start + 1;\n this._activeIndex = ArrayExt.findLastIndex(\n this._results,\n Private.canActivate,\n start,\n stop\n );\n\n // Schedule an update of the items.\n this.update();\n }\n\n /**\n * Execute the command item at the given index, if possible.\n */\n private _execute(index: number): void {\n // Bail if there are no search results.\n if (!this._results) {\n return;\n }\n\n // Bail if the index is out of range.\n let part = this._results[index];\n if (!part) {\n return;\n }\n\n // Update the search text if the item is a header.\n if (part.type === 'header') {\n let input = this.inputNode;\n input.value = `${part.category.toLowerCase()} `;\n input.focus();\n this.refresh();\n return;\n }\n\n // Bail if item is not enabled.\n if (!part.item.isEnabled) {\n return;\n }\n\n // Execute the item.\n this.commands.execute(part.item.command, part.item.args);\n\n // Clear the query text.\n this.inputNode.value = '';\n\n // Refresh the search results.\n this.refresh();\n }\n\n /**\n * Toggle the focused modifier based on the input node focus state.\n */\n private _toggleFocused(): void {\n let focused = document.activeElement === this.inputNode;\n this.toggleClass('lm-mod-focused', focused);\n }\n\n /**\n * A signal handler for generic command changes.\n */\n private _onGenericChange(): void {\n this.refresh();\n }\n\n private _activeIndex = -1;\n private _items: CommandPalette.IItem[] = [];\n private _results: Private.SearchResult[] | null = null;\n}\n\n/**\n * The namespace for the `CommandPalette` class statics.\n */\nexport namespace CommandPalette {\n /**\n * An options object for creating a command palette.\n */\n export interface IOptions {\n /**\n * The command registry for use with the command palette.\n */\n commands: CommandRegistry;\n\n /**\n * A custom renderer for use with the command palette.\n *\n * The default is a shared renderer instance.\n */\n renderer?: IRenderer;\n }\n\n /**\n * An options object for creating a command item.\n */\n export interface IItemOptions {\n /**\n * The category for the item.\n */\n category: string;\n\n /**\n * The command to execute when the item is triggered.\n */\n command: string;\n\n /**\n * The arguments for the command.\n *\n * The default value is an empty object.\n */\n args?: ReadonlyJSONObject;\n\n /**\n * The rank for the command item.\n *\n * The rank is used as a tie-breaker when ordering command items\n * for display. Items are sorted in the following order:\n * 1. Text match (lower is better)\n * 2. Category (locale order)\n * 3. Rank (lower is better)\n * 4. Label (locale order)\n *\n * The default rank is `Infinity`.\n */\n rank?: number;\n }\n\n /**\n * An object which represents an item in a command palette.\n *\n * #### Notes\n * Item objects are created automatically by a command palette.\n */\n export interface IItem {\n /**\n * The command to execute when the item is triggered.\n */\n readonly command: string;\n\n /**\n * The arguments for the command.\n */\n readonly args: ReadonlyJSONObject;\n\n /**\n * The category for the command item.\n */\n readonly category: string;\n\n /**\n * The rank for the command item.\n */\n readonly rank: number;\n\n /**\n * The display label for the command item.\n */\n readonly label: string;\n\n /**\n * The display caption for the command item.\n */\n readonly caption: string;\n\n /**\n * The icon renderer for the command item.\n */\n readonly icon: VirtualElement.IRenderer | undefined;\n\n /**\n * The icon class for the command item.\n */\n readonly iconClass: string;\n\n /**\n * The icon label for the command item.\n */\n readonly iconLabel: string;\n\n /**\n * The extra class name for the command item.\n */\n readonly className: string;\n\n /**\n * The dataset for the command item.\n */\n readonly dataset: CommandRegistry.Dataset;\n\n /**\n * Whether the command item is enabled.\n */\n readonly isEnabled: boolean;\n\n /**\n * Whether the command item is toggled.\n */\n readonly isToggled: boolean;\n\n /**\n * Whether the command item is toggleable.\n */\n readonly isToggleable: boolean;\n\n /**\n * Whether the command item is visible.\n */\n readonly isVisible: boolean;\n\n /**\n * The key binding for the command item.\n */\n readonly keyBinding: CommandRegistry.IKeyBinding | null;\n }\n\n /**\n * The render data for a command palette header.\n */\n export interface IHeaderRenderData {\n /**\n * The category of the header.\n */\n readonly category: string;\n\n /**\n * The indices of the matched characters in the category.\n */\n readonly indices: ReadonlyArray | null;\n }\n\n /**\n * The render data for a command palette item.\n */\n export interface IItemRenderData {\n /**\n * The command palette item to render.\n */\n readonly item: IItem;\n\n /**\n * The indices of the matched characters in the label.\n */\n readonly indices: ReadonlyArray | null;\n\n /**\n * Whether the item is the active item.\n */\n readonly active: boolean;\n }\n\n /**\n * The render data for a command palette empty message.\n */\n export interface IEmptyMessageRenderData {\n /**\n * The query which failed to match any commands.\n */\n query: string;\n }\n\n /**\n * A renderer for use with a command palette.\n */\n export interface IRenderer {\n /**\n * Render the virtual element for a command palette header.\n *\n * @param data - The data to use for rendering the header.\n *\n * @returns A virtual element representing the header.\n */\n renderHeader(data: IHeaderRenderData): VirtualElement;\n\n /**\n * Render the virtual element for a command palette item.\n *\n * @param data - The data to use for rendering the item.\n *\n * @returns A virtual element representing the item.\n *\n * #### Notes\n * The command palette will not render invisible items.\n */\n renderItem(data: IItemRenderData): VirtualElement;\n\n /**\n * Render the empty results message for a command palette.\n *\n * @param data - The data to use for rendering the message.\n *\n * @returns A virtual element representing the message.\n */\n renderEmptyMessage(data: IEmptyMessageRenderData): VirtualElement;\n }\n\n /**\n * The default implementation of `IRenderer`.\n */\n export class Renderer implements IRenderer {\n /**\n * Render the virtual element for a command palette header.\n *\n * @param data - The data to use for rendering the header.\n *\n * @returns A virtual element representing the header.\n */\n renderHeader(data: IHeaderRenderData): VirtualElement {\n let content = this.formatHeader(data);\n return h.li({ className: 'lm-CommandPalette-header' }, content);\n }\n\n /**\n * Render the virtual element for a command palette item.\n *\n * @param data - The data to use for rendering the item.\n *\n * @returns A virtual element representing the item.\n */\n renderItem(data: IItemRenderData): VirtualElement {\n let className = this.createItemClass(data);\n let dataset = this.createItemDataset(data);\n if (data.item.isToggleable) {\n return h.li(\n {\n className,\n dataset,\n role: 'menuitemcheckbox',\n 'aria-checked': `${data.item.isToggled}`\n },\n this.renderItemIcon(data),\n this.renderItemContent(data),\n this.renderItemShortcut(data)\n );\n }\n return h.li(\n {\n className,\n dataset,\n role: 'menuitem'\n },\n this.renderItemIcon(data),\n this.renderItemContent(data),\n this.renderItemShortcut(data)\n );\n }\n\n /**\n * Render the empty results message for a command palette.\n *\n * @param data - The data to use for rendering the message.\n *\n * @returns A virtual element representing the message.\n */\n renderEmptyMessage(data: IEmptyMessageRenderData): VirtualElement {\n let content = this.formatEmptyMessage(data);\n return h.li({ className: 'lm-CommandPalette-emptyMessage' }, content);\n }\n\n /**\n * Render the icon for a command palette item.\n *\n * @param data - The data to use for rendering the icon.\n *\n * @returns A virtual element representing the icon.\n */\n renderItemIcon(data: IItemRenderData): VirtualElement {\n let className = this.createIconClass(data);\n\n // If data.item.icon is undefined, it will be ignored.\n return h.div({ className }, data.item.icon!, data.item.iconLabel);\n }\n\n /**\n * Render the content for a command palette item.\n *\n * @param data - The data to use for rendering the content.\n *\n * @returns A virtual element representing the content.\n */\n renderItemContent(data: IItemRenderData): VirtualElement {\n return h.div(\n { className: 'lm-CommandPalette-itemContent' },\n this.renderItemLabel(data),\n this.renderItemCaption(data)\n );\n }\n\n /**\n * Render the label for a command palette item.\n *\n * @param data - The data to use for rendering the label.\n *\n * @returns A virtual element representing the label.\n */\n renderItemLabel(data: IItemRenderData): VirtualElement {\n let content = this.formatItemLabel(data);\n return h.div({ className: 'lm-CommandPalette-itemLabel' }, content);\n }\n\n /**\n * Render the caption for a command palette item.\n *\n * @param data - The data to use for rendering the caption.\n *\n * @returns A virtual element representing the caption.\n */\n renderItemCaption(data: IItemRenderData): VirtualElement {\n let content = this.formatItemCaption(data);\n return h.div({ className: 'lm-CommandPalette-itemCaption' }, content);\n }\n\n /**\n * Render the shortcut for a command palette item.\n *\n * @param data - The data to use for rendering the shortcut.\n *\n * @returns A virtual element representing the shortcut.\n */\n renderItemShortcut(data: IItemRenderData): VirtualElement {\n let content = this.formatItemShortcut(data);\n return h.div({ className: 'lm-CommandPalette-itemShortcut' }, content);\n }\n\n /**\n * Create the class name for the command palette item.\n *\n * @param data - The data to use for the class name.\n *\n * @returns The full class name for the command palette item.\n */\n createItemClass(data: IItemRenderData): string {\n // Set up the initial class name.\n let name = 'lm-CommandPalette-item';\n\n // Add the boolean state classes.\n if (!data.item.isEnabled) {\n name += ' lm-mod-disabled';\n }\n if (data.item.isToggled) {\n name += ' lm-mod-toggled';\n }\n if (data.active) {\n name += ' lm-mod-active';\n }\n\n // Add the extra class.\n let extra = data.item.className;\n if (extra) {\n name += ` ${extra}`;\n }\n\n // Return the complete class name.\n return name;\n }\n\n /**\n * Create the dataset for the command palette item.\n *\n * @param data - The data to use for creating the dataset.\n *\n * @returns The dataset for the command palette item.\n */\n createItemDataset(data: IItemRenderData): ElementDataset {\n return { ...data.item.dataset, command: data.item.command };\n }\n\n /**\n * Create the class name for the command item icon.\n *\n * @param data - The data to use for the class name.\n *\n * @returns The full class name for the item icon.\n */\n createIconClass(data: IItemRenderData): string {\n let name = 'lm-CommandPalette-itemIcon';\n let extra = data.item.iconClass;\n return extra ? `${name} ${extra}` : name;\n }\n\n /**\n * Create the render content for the header node.\n *\n * @param data - The data to use for the header content.\n *\n * @returns The content to add to the header node.\n */\n formatHeader(data: IHeaderRenderData): h.Child {\n if (!data.indices || data.indices.length === 0) {\n return data.category;\n }\n return StringExt.highlight(data.category, data.indices, h.mark);\n }\n\n /**\n * Create the render content for the empty message node.\n *\n * @param data - The data to use for the empty message content.\n *\n * @returns The content to add to the empty message node.\n */\n formatEmptyMessage(data: IEmptyMessageRenderData): h.Child {\n return `No commands found that match '${data.query}'`;\n }\n\n /**\n * Create the render content for the item shortcut node.\n *\n * @param data - The data to use for the shortcut content.\n *\n * @returns The content to add to the shortcut node.\n */\n formatItemShortcut(data: IItemRenderData): h.Child {\n let kb = data.item.keyBinding;\n return kb ? CommandRegistry.formatKeystroke(kb.keys) : null;\n }\n\n /**\n * Create the render content for the item label node.\n *\n * @param data - The data to use for the label content.\n *\n * @returns The content to add to the label node.\n */\n formatItemLabel(data: IItemRenderData): h.Child {\n if (!data.indices || data.indices.length === 0) {\n return data.item.label;\n }\n return StringExt.highlight(data.item.label, data.indices, h.mark);\n }\n\n /**\n * Create the render content for the item caption node.\n *\n * @param data - The data to use for the caption content.\n *\n * @returns The content to add to the caption node.\n */\n formatItemCaption(data: IItemRenderData): h.Child {\n return data.item.caption;\n }\n }\n\n /**\n * The default `Renderer` instance.\n */\n export const defaultRenderer = new Renderer();\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * Create the DOM node for a command palette.\n */\n export function createNode(): HTMLDivElement {\n let node = document.createElement('div');\n let search = document.createElement('div');\n let wrapper = document.createElement('div');\n let input = document.createElement('input');\n let content = document.createElement('ul');\n let clear = document.createElement('button');\n search.className = 'lm-CommandPalette-search';\n wrapper.className = 'lm-CommandPalette-wrapper';\n input.className = 'lm-CommandPalette-input';\n clear.className = 'lm-close-icon';\n\n content.className = 'lm-CommandPalette-content';\n content.setAttribute('role', 'menu');\n input.spellcheck = false;\n wrapper.appendChild(input);\n wrapper.appendChild(clear);\n search.appendChild(wrapper);\n node.appendChild(search);\n node.appendChild(content);\n return node;\n }\n\n /**\n * Create a new command item from a command registry and options.\n */\n export function createItem(\n commands: CommandRegistry,\n options: CommandPalette.IItemOptions\n ): CommandPalette.IItem {\n return new CommandItem(commands, options);\n }\n\n /**\n * A search result object for a header label.\n */\n export interface IHeaderResult {\n /**\n * The discriminated type of the object.\n */\n readonly type: 'header';\n\n /**\n * The category for the header.\n */\n readonly category: string;\n\n /**\n * The indices of the matched category characters.\n */\n readonly indices: ReadonlyArray | null;\n }\n\n /**\n * A search result object for a command item.\n */\n export interface IItemResult {\n /**\n * The discriminated type of the object.\n */\n readonly type: 'item';\n\n /**\n * The command item which was matched.\n */\n readonly item: CommandPalette.IItem;\n\n /**\n * The indices of the matched label characters.\n */\n readonly indices: ReadonlyArray | null;\n }\n\n /**\n * A type alias for a search result item.\n */\n export type SearchResult = IHeaderResult | IItemResult;\n\n /**\n * Search an array of command items for fuzzy matches.\n */\n export function search(\n items: CommandPalette.IItem[],\n query: string\n ): SearchResult[] {\n // Fuzzy match the items for the query.\n let scores = matchItems(items, query);\n\n // Sort the items based on their score.\n scores.sort(scoreCmp);\n\n // Create the results for the search.\n return createResults(scores);\n }\n\n /**\n * Test whether a result item can be activated.\n */\n export function canActivate(result: SearchResult): boolean {\n return result.type === 'item' && result.item.isEnabled;\n }\n\n /**\n * Normalize a category for a command item.\n */\n function normalizeCategory(category: string): string {\n return category.trim().replace(/\\s+/g, ' ');\n }\n\n /**\n * Normalize the query text for a fuzzy search.\n */\n function normalizeQuery(text: string): string {\n return text.replace(/\\s+/g, '').toLowerCase();\n }\n\n /**\n * An enum of the supported match types.\n */\n const enum MatchType {\n Label,\n Category,\n Split,\n Default\n }\n\n /**\n * A text match score with associated command item.\n */\n interface IScore {\n /**\n * The numerical type for the text match.\n */\n matchType: MatchType;\n\n /**\n * The numerical score for the text match.\n */\n score: number;\n\n /**\n * The indices of the matched category characters.\n */\n categoryIndices: number[] | null;\n\n /**\n * The indices of the matched label characters.\n */\n labelIndices: number[] | null;\n\n /**\n * The command item associated with the match.\n */\n item: CommandPalette.IItem;\n }\n\n /**\n * Perform a fuzzy match on an array of command items.\n */\n function matchItems(items: CommandPalette.IItem[], query: string): IScore[] {\n // Normalize the query text to lower case with no whitespace.\n query = normalizeQuery(query);\n\n // Create the array to hold the scores.\n let scores: IScore[] = [];\n\n // Iterate over the items and match against the query.\n for (let i = 0, n = items.length; i < n; ++i) {\n // Ignore items which are not visible.\n let item = items[i];\n if (!item.isVisible) {\n continue;\n }\n\n // If the query is empty, all items are matched by default.\n if (!query) {\n scores.push({\n matchType: MatchType.Default,\n categoryIndices: null,\n labelIndices: null,\n score: 0,\n item\n });\n continue;\n }\n\n // Run the fuzzy search for the item and query.\n let score = fuzzySearch(item, query);\n\n // Ignore the item if it is not a match.\n if (!score) {\n continue;\n }\n\n // Penalize disabled items.\n // TODO - push disabled items all the way down in sort cmp?\n if (!item.isEnabled) {\n score.score += 1000;\n }\n\n // Add the score to the results.\n scores.push(score);\n }\n\n // Return the final array of scores.\n return scores;\n }\n\n /**\n * Perform a fuzzy search on a single command item.\n */\n function fuzzySearch(\n item: CommandPalette.IItem,\n query: string\n ): IScore | null {\n // Create the source text to be searched.\n let category = item.category.toLowerCase();\n let label = item.label.toLowerCase();\n let source = `${category} ${label}`;\n\n // Set up the match score and indices array.\n let score = Infinity;\n let indices: number[] | null = null;\n\n // The regex for search word boundaries\n let rgx = /\\b\\w/g;\n\n // Search the source by word boundary.\n // eslint-disable-next-line no-constant-condition\n while (true) {\n // Find the next word boundary in the source.\n let rgxMatch = rgx.exec(source);\n\n // Break if there is no more source context.\n if (!rgxMatch) {\n break;\n }\n\n // Run the string match on the relevant substring.\n let match = StringExt.matchSumOfDeltas(source, query, rgxMatch.index);\n\n // Break if there is no match.\n if (!match) {\n break;\n }\n\n // Update the match if the score is better.\n if (match.score <= score) {\n score = match.score;\n indices = match.indices;\n }\n }\n\n // Bail if there was no match.\n if (!indices || score === Infinity) {\n return null;\n }\n\n // Compute the pivot index between category and label text.\n let pivot = category.length + 1;\n\n // Find the slice index to separate matched indices.\n let j = ArrayExt.lowerBound(indices, pivot, (a, b) => a - b);\n\n // Extract the matched category and label indices.\n let categoryIndices = indices.slice(0, j);\n let labelIndices = indices.slice(j);\n\n // Adjust the label indices for the pivot offset.\n for (let i = 0, n = labelIndices.length; i < n; ++i) {\n labelIndices[i] -= pivot;\n }\n\n // Handle a pure label match.\n if (categoryIndices.length === 0) {\n return {\n matchType: MatchType.Label,\n categoryIndices: null,\n labelIndices,\n score,\n item\n };\n }\n\n // Handle a pure category match.\n if (labelIndices.length === 0) {\n return {\n matchType: MatchType.Category,\n categoryIndices,\n labelIndices: null,\n score,\n item\n };\n }\n\n // Handle a split match.\n return {\n matchType: MatchType.Split,\n categoryIndices,\n labelIndices,\n score,\n item\n };\n }\n\n /**\n * A sort comparison function for a match score.\n */\n function scoreCmp(a: IScore, b: IScore): number {\n // First compare based on the match type\n let m1 = a.matchType - b.matchType;\n if (m1 !== 0) {\n return m1;\n }\n\n // Otherwise, compare based on the match score.\n let d1 = a.score - b.score;\n if (d1 !== 0) {\n return d1;\n }\n\n // Find the match index based on the match type.\n let i1 = 0;\n let i2 = 0;\n switch (a.matchType) {\n case MatchType.Label:\n i1 = a.labelIndices![0];\n i2 = b.labelIndices![0];\n break;\n case MatchType.Category:\n case MatchType.Split:\n i1 = a.categoryIndices![0];\n i2 = b.categoryIndices![0];\n break;\n }\n\n // Compare based on the match index.\n if (i1 !== i2) {\n return i1 - i2;\n }\n\n // Otherwise, compare by category.\n let d2 = a.item.category.localeCompare(b.item.category);\n if (d2 !== 0) {\n return d2;\n }\n\n // Otherwise, compare by rank.\n let r1 = a.item.rank;\n let r2 = b.item.rank;\n if (r1 !== r2) {\n return r1 < r2 ? -1 : 1; // Infinity safe\n }\n\n // Finally, compare by label.\n return a.item.label.localeCompare(b.item.label);\n }\n\n /**\n * Create the results from an array of sorted scores.\n */\n function createResults(scores: IScore[]): SearchResult[] {\n // Set up the search results array.\n let results: SearchResult[] = [];\n\n // Iterate over each score in the array.\n for (let i = 0, n = scores.length; i < n; ++i) {\n // Extract the current item and indices.\n let { item, categoryIndices, labelIndices } = scores[i];\n\n // Extract the category for the current item.\n let category = item.category;\n\n // Is this the same category as the preceding result?\n if (i === 0 || category !== scores[i - 1].item.category) {\n // Add the header result for the category.\n results.push({ type: 'header', category, indices: categoryIndices });\n }\n\n // Create the item result for the score.\n results.push({ type: 'item', item, indices: labelIndices });\n }\n\n // Return the final results.\n return results;\n }\n\n /**\n * A concrete implementation of `CommandPalette.IItem`.\n */\n class CommandItem implements CommandPalette.IItem {\n /**\n * Construct a new command item.\n */\n constructor(\n commands: CommandRegistry,\n options: CommandPalette.IItemOptions\n ) {\n this._commands = commands;\n this.category = normalizeCategory(options.category);\n this.command = options.command;\n this.args = options.args || JSONExt.emptyObject;\n this.rank = options.rank !== undefined ? options.rank : Infinity;\n }\n\n /**\n * The category for the command item.\n */\n readonly category: string;\n\n /**\n * The command to execute when the item is triggered.\n */\n readonly command: string;\n\n /**\n * The arguments for the command.\n */\n readonly args: ReadonlyJSONObject;\n\n /**\n * The rank for the command item.\n */\n readonly rank: number;\n\n /**\n * The display label for the command item.\n */\n get label(): string {\n return this._commands.label(this.command, this.args);\n }\n\n /**\n * The icon renderer for the command item.\n */\n get icon(): VirtualElement.IRenderer | undefined {\n return this._commands.icon(this.command, this.args);\n }\n\n /**\n * The icon class for the command item.\n */\n get iconClass(): string {\n return this._commands.iconClass(this.command, this.args);\n }\n\n /**\n * The icon label for the command item.\n */\n get iconLabel(): string {\n return this._commands.iconLabel(this.command, this.args);\n }\n\n /**\n * The display caption for the command item.\n */\n get caption(): string {\n return this._commands.caption(this.command, this.args);\n }\n\n /**\n * The extra class name for the command item.\n */\n get className(): string {\n return this._commands.className(this.command, this.args);\n }\n\n /**\n * The dataset for the command item.\n */\n get dataset(): CommandRegistry.Dataset {\n return this._commands.dataset(this.command, this.args);\n }\n\n /**\n * Whether the command item is enabled.\n */\n get isEnabled(): boolean {\n return this._commands.isEnabled(this.command, this.args);\n }\n\n /**\n * Whether the command item is toggled.\n */\n get isToggled(): boolean {\n return this._commands.isToggled(this.command, this.args);\n }\n\n /**\n * Whether the command item is toggleable.\n */\n get isToggleable(): boolean {\n return this._commands.isToggleable(this.command, this.args);\n }\n\n /**\n * Whether the command item is visible.\n */\n get isVisible(): boolean {\n return this._commands.isVisible(this.command, this.args);\n }\n\n /**\n * The key binding for the command item.\n */\n get keyBinding(): CommandRegistry.IKeyBinding | null {\n let { command, args } = this;\n return (\n ArrayExt.findLastValue(this._commands.keyBindings, kb => {\n return kb.command === command && JSONExt.deepEqual(kb.args, args);\n }) || null\n );\n }\n\n private _commands: CommandRegistry;\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { CommandRegistry } from '@lumino/commands';\n\nimport { JSONExt, ReadonlyJSONObject } from '@lumino/coreutils';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { getKeyboardLayout } from '@lumino/keyboard';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport {\n ARIAAttrNames,\n ElementARIAAttrs,\n ElementDataset,\n h,\n VirtualDOM,\n VirtualElement\n} from '@lumino/virtualdom';\n\nimport { Widget } from './widget';\n\ninterface IWindowData {\n pageXOffset: number;\n pageYOffset: number;\n clientWidth: number;\n clientHeight: number;\n}\n\n/**\n * A widget which displays items as a canonical menu.\n */\nexport class Menu extends Widget {\n /**\n * Construct a new menu.\n *\n * @param options - The options for initializing the menu.\n */\n constructor(options: Menu.IOptions) {\n super({ node: Private.createNode() });\n this.addClass('lm-Menu');\n this.setFlag(Widget.Flag.DisallowLayout);\n this.commands = options.commands;\n this.renderer = options.renderer || Menu.defaultRenderer;\n }\n\n /**\n * Dispose of the resources held by the menu.\n */\n dispose(): void {\n this.close();\n this._items.length = 0;\n super.dispose();\n }\n\n /**\n * A signal emitted just before the menu is closed.\n *\n * #### Notes\n * This signal is emitted when the menu receives a `'close-request'`\n * message, just before it removes itself from the DOM.\n *\n * This signal is not emitted if the menu is already detached from\n * the DOM when it receives the `'close-request'` message.\n */\n get aboutToClose(): ISignal {\n return this._aboutToClose;\n }\n\n /**\n * A signal emitted when a new menu is requested by the user.\n *\n * #### Notes\n * This signal is emitted whenever the user presses the right or left\n * arrow keys, and a submenu cannot be opened or closed in response.\n *\n * This signal is useful when implementing menu bars in order to open\n * the next or previous menu in response to a user key press.\n *\n * This signal is only emitted for the root menu in a hierarchy.\n */\n get menuRequested(): ISignal {\n return this._menuRequested;\n }\n\n /**\n * The command registry used by the menu.\n */\n readonly commands: CommandRegistry;\n\n /**\n * The renderer used by the menu.\n */\n readonly renderer: Menu.IRenderer;\n\n /**\n * The parent menu of the menu.\n *\n * #### Notes\n * This is `null` unless the menu is an open submenu.\n */\n get parentMenu(): Menu | null {\n return this._parentMenu;\n }\n\n /**\n * The child menu of the menu.\n *\n * #### Notes\n * This is `null` unless the menu has an open submenu.\n */\n get childMenu(): Menu | null {\n return this._childMenu;\n }\n\n /**\n * The root menu of the menu hierarchy.\n */\n get rootMenu(): Menu {\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n let menu: Menu = this;\n while (menu._parentMenu) {\n menu = menu._parentMenu;\n }\n return menu;\n }\n\n /**\n * The leaf menu of the menu hierarchy.\n */\n get leafMenu(): Menu {\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n let menu: Menu = this;\n while (menu._childMenu) {\n menu = menu._childMenu;\n }\n return menu;\n }\n\n /**\n * The menu content node.\n *\n * #### Notes\n * This is the node which holds the menu item nodes.\n *\n * Modifying this node directly can lead to undefined behavior.\n */\n get contentNode(): HTMLUListElement {\n return this.node.getElementsByClassName(\n 'lm-Menu-content'\n )[0] as HTMLUListElement;\n }\n\n /**\n * Get the currently active menu item.\n */\n get activeItem(): Menu.IItem | null {\n return this._items[this._activeIndex] || null;\n }\n\n /**\n * Set the currently active menu item.\n *\n * #### Notes\n * If the item cannot be activated, the item will be set to `null`.\n */\n set activeItem(value: Menu.IItem | null) {\n this.activeIndex = value ? this._items.indexOf(value) : -1;\n }\n\n /**\n * Get the index of the currently active menu item.\n *\n * #### Notes\n * This will be `-1` if no menu item is active.\n */\n get activeIndex(): number {\n return this._activeIndex;\n }\n\n /**\n * Set the index of the currently active menu item.\n *\n * #### Notes\n * If the item cannot be activated, the index will be set to `-1`.\n */\n set activeIndex(value: number) {\n // Adjust the value for an out of range index.\n if (value < 0 || value >= this._items.length) {\n value = -1;\n }\n\n // Ensure the item can be activated.\n if (value !== -1 && !Private.canActivate(this._items[value])) {\n value = -1;\n }\n\n // Bail if the index will not change.\n if (this._activeIndex === value) {\n return;\n }\n\n // Update the active index.\n this._activeIndex = value;\n\n // Make active element in focus\n if (\n this._activeIndex >= 0 &&\n this.contentNode.childNodes[this._activeIndex]\n ) {\n (this.contentNode.childNodes[this._activeIndex] as HTMLElement).focus();\n }\n\n // schedule an update of the items.\n this.update();\n }\n\n /**\n * A read-only array of the menu items in the menu.\n */\n get items(): ReadonlyArray {\n return this._items;\n }\n\n /**\n * Activate the next selectable item in the menu.\n *\n * #### Notes\n * If no item is selectable, the index will be set to `-1`.\n */\n activateNextItem(): void {\n let n = this._items.length;\n let ai = this._activeIndex;\n let start = ai < n - 1 ? ai + 1 : 0;\n let stop = start === 0 ? n - 1 : start - 1;\n this.activeIndex = ArrayExt.findFirstIndex(\n this._items,\n Private.canActivate,\n start,\n stop\n );\n }\n\n /**\n * Activate the previous selectable item in the menu.\n *\n * #### Notes\n * If no item is selectable, the index will be set to `-1`.\n */\n activatePreviousItem(): void {\n let n = this._items.length;\n let ai = this._activeIndex;\n let start = ai <= 0 ? n - 1 : ai - 1;\n let stop = start === n - 1 ? 0 : start + 1;\n this.activeIndex = ArrayExt.findLastIndex(\n this._items,\n Private.canActivate,\n start,\n stop\n );\n }\n\n /**\n * Trigger the active menu item.\n *\n * #### Notes\n * If the active item is a submenu, it will be opened and the first\n * item will be activated.\n *\n * If the active item is a command, the command will be executed.\n *\n * If the menu is not attached, this is a no-op.\n *\n * If there is no active item, this is a no-op.\n */\n triggerActiveItem(): void {\n // Bail if the menu is not attached.\n if (!this.isAttached) {\n return;\n }\n\n // Bail if there is no active item.\n let item = this.activeItem;\n if (!item) {\n return;\n }\n\n // Cancel the pending timers.\n this._cancelOpenTimer();\n this._cancelCloseTimer();\n\n // If the item is a submenu, open it.\n if (item.type === 'submenu') {\n this._openChildMenu(true);\n return;\n }\n\n // Close the root menu before executing the command.\n this.rootMenu.close();\n\n // Execute the command for the item.\n let { command, args } = item;\n if (this.commands.isEnabled(command, args)) {\n this.commands.execute(command, args);\n } else {\n console.log(`Command '${command}' is disabled.`);\n }\n }\n\n /**\n * Add a menu item to the end of the menu.\n *\n * @param options - The options for creating the menu item.\n *\n * @returns The menu item added to the menu.\n */\n addItem(options: Menu.IItemOptions): Menu.IItem {\n return this.insertItem(this._items.length, options);\n }\n\n /**\n * Insert a menu item into the menu at the specified index.\n *\n * @param index - The index at which to insert the item.\n *\n * @param options - The options for creating the menu item.\n *\n * @returns The menu item added to the menu.\n *\n * #### Notes\n * The index will be clamped to the bounds of the items.\n */\n insertItem(index: number, options: Menu.IItemOptions): Menu.IItem {\n // Close the menu if it's attached.\n if (this.isAttached) {\n this.close();\n }\n\n // Reset the active index.\n this.activeIndex = -1;\n\n // Clamp the insert index to the array bounds.\n let i = Math.max(0, Math.min(index, this._items.length));\n\n // Create the item for the options.\n let item = Private.createItem(this, options);\n\n // Insert the item into the array.\n ArrayExt.insert(this._items, i, item);\n\n // Schedule an update of the items.\n this.update();\n\n // Return the item added to the menu.\n return item;\n }\n\n /**\n * Remove an item from the menu.\n *\n * @param item - The item to remove from the menu.\n *\n * #### Notes\n * This is a no-op if the item is not in the menu.\n */\n removeItem(item: Menu.IItem): void {\n this.removeItemAt(this._items.indexOf(item));\n }\n\n /**\n * Remove the item at a given index from the menu.\n *\n * @param index - The index of the item to remove.\n *\n * #### Notes\n * This is a no-op if the index is out of range.\n */\n removeItemAt(index: number): void {\n // Close the menu if it's attached.\n if (this.isAttached) {\n this.close();\n }\n\n // Reset the active index.\n this.activeIndex = -1;\n\n // Remove the item from the array.\n let item = ArrayExt.removeAt(this._items, index);\n\n // Bail if the index is out of range.\n if (!item) {\n return;\n }\n\n // Schedule an update of the items.\n this.update();\n }\n\n /**\n * Remove all menu items from the menu.\n */\n clearItems(): void {\n // Close the menu if it's attached.\n if (this.isAttached) {\n this.close();\n }\n\n // Reset the active index.\n this.activeIndex = -1;\n\n // Bail if there is nothing to remove.\n if (this._items.length === 0) {\n return;\n }\n\n // Clear the items.\n this._items.length = 0;\n\n // Schedule an update of the items.\n this.update();\n }\n\n /**\n * Open the menu at the specified location.\n *\n * @param x - The client X coordinate of the menu location.\n *\n * @param y - The client Y coordinate of the menu location.\n *\n * @param options - The additional options for opening the menu.\n *\n * #### Notes\n * The menu will be opened at the given location unless it will not\n * fully fit on the screen. If it will not fit, it will be adjusted\n * to fit naturally on the screen.\n *\n * The menu will be attached under the `host` element in the DOM\n * (or `document.body` if `host` is `null`) and before the `ref`\n * element (or as the last child of `host` if `ref` is `null`).\n * The menu may be displayed outside of the `host` element\n * following the rules of CSS absolute positioning.\n *\n * This is a no-op if the menu is already attached to the DOM.\n */\n open(x: number, y: number, options: Menu.IOpenOptions = {}): void {\n // Bail early if the menu is already attached.\n if (this.isAttached) {\n return;\n }\n\n // Extract the menu options.\n let forceX = options.forceX || false;\n let forceY = options.forceY || false;\n const host = options.host ?? null;\n const ref = options.ref ?? null;\n const horizontalAlignment =\n options.horizontalAlignment ??\n (document.documentElement.dir === 'rtl' ? 'right' : 'left');\n\n // Open the menu as a root menu.\n Private.openRootMenu(\n this,\n x,\n y,\n forceX,\n forceY,\n horizontalAlignment,\n host,\n ref\n );\n\n // Activate the menu to accept keyboard input.\n this.activate();\n }\n\n /**\n * Handle the DOM events for the menu.\n *\n * @param event - The DOM event sent to the menu.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the menu's DOM nodes. It should\n * not be called directly by user code.\n */\n handleEvent(event: Event): void {\n switch (event.type) {\n case 'keydown':\n this._evtKeyDown(event as KeyboardEvent);\n break;\n case 'mouseup':\n this._evtMouseUp(event as MouseEvent);\n break;\n case 'mousemove':\n this._evtMouseMove(event as MouseEvent);\n break;\n case 'mouseenter':\n this._evtMouseEnter(event as MouseEvent);\n break;\n case 'mouseleave':\n this._evtMouseLeave(event as MouseEvent);\n break;\n case 'mousedown':\n this._evtMouseDown(event as MouseEvent);\n break;\n case 'contextmenu':\n event.preventDefault();\n event.stopPropagation();\n break;\n }\n }\n\n /**\n * A message handler invoked on a `'after-attach'` message.\n */\n protected override onAfterAttach(msg: Message): void {\n this.node.addEventListener('keydown', this);\n this.node.addEventListener('mouseup', this);\n this.node.addEventListener('mousemove', this);\n this.node.addEventListener('mouseenter', this);\n this.node.addEventListener('mouseleave', this);\n this.node.addEventListener('contextmenu', this);\n this.node.ownerDocument.addEventListener('mousedown', this, true);\n }\n\n /**\n * A message handler invoked on an `'before-detach'` message.\n */\n protected override onBeforeDetach(msg: Message): void {\n this.node.removeEventListener('keydown', this);\n this.node.removeEventListener('mouseup', this);\n this.node.removeEventListener('mousemove', this);\n this.node.removeEventListener('mouseenter', this);\n this.node.removeEventListener('mouseleave', this);\n this.node.removeEventListener('contextmenu', this);\n this.node.ownerDocument.removeEventListener('mousedown', this, true);\n }\n\n /**\n * A message handler invoked on an `'activate-request'` message.\n */\n protected onActivateRequest(msg: Message): void {\n if (this.isAttached) {\n this.node.focus();\n }\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n protected onUpdateRequest(msg: Message): void {\n let items = this._items;\n let renderer = this.renderer;\n let activeIndex = this._activeIndex;\n let collapsedFlags = Private.computeCollapsed(items);\n let content = new Array(items.length);\n for (let i = 0, n = items.length; i < n; ++i) {\n let item = items[i];\n let active = i === activeIndex;\n let collapsed = collapsedFlags[i];\n content[i] = renderer.renderItem({\n item,\n active,\n collapsed,\n onfocus: () => {\n this.activeIndex = i;\n }\n });\n }\n VirtualDOM.render(content, this.contentNode);\n }\n\n /**\n * A message handler invoked on a `'close-request'` message.\n */\n protected onCloseRequest(msg: Message): void {\n // Cancel the pending timers.\n this._cancelOpenTimer();\n this._cancelCloseTimer();\n\n // Reset the active index.\n this.activeIndex = -1;\n\n // Close any open child menu.\n let childMenu = this._childMenu;\n if (childMenu) {\n this._childIndex = -1;\n this._childMenu = null;\n childMenu._parentMenu = null;\n childMenu.close();\n }\n\n // Remove this menu from its parent and activate the parent.\n let parentMenu = this._parentMenu;\n if (parentMenu) {\n this._parentMenu = null;\n parentMenu._childIndex = -1;\n parentMenu._childMenu = null;\n parentMenu.activate();\n }\n\n // Emit the `aboutToClose` signal if the menu is attached.\n if (this.isAttached) {\n this._aboutToClose.emit(undefined);\n }\n\n // Finish closing the menu.\n super.onCloseRequest(msg);\n }\n\n /**\n * Handle the `'keydown'` event for the menu.\n *\n * #### Notes\n * This listener is attached to the menu node.\n */\n private _evtKeyDown(event: KeyboardEvent): void {\n // A menu handles all keydown events.\n event.preventDefault();\n event.stopPropagation();\n\n // Fetch the key code for the event.\n let kc = event.keyCode;\n\n // Enter\n if (kc === 13) {\n this.triggerActiveItem();\n return;\n }\n\n // Escape\n if (kc === 27) {\n this.close();\n return;\n }\n\n // Left Arrow\n if (kc === 37) {\n if (this._parentMenu) {\n this.close();\n } else {\n this._menuRequested.emit('previous');\n }\n return;\n }\n\n // Up Arrow\n if (kc === 38) {\n this.activatePreviousItem();\n return;\n }\n\n // Right Arrow\n if (kc === 39) {\n let item = this.activeItem;\n if (item && item.type === 'submenu') {\n this.triggerActiveItem();\n } else {\n this.rootMenu._menuRequested.emit('next');\n }\n return;\n }\n\n // Down Arrow\n if (kc === 40) {\n this.activateNextItem();\n return;\n }\n\n // Get the pressed key character.\n let key = getKeyboardLayout().keyForKeydownEvent(event);\n\n // Bail if the key is not valid.\n if (!key) {\n return;\n }\n\n // Search for the next best matching mnemonic item.\n let start = this._activeIndex + 1;\n let result = Private.findMnemonic(this._items, key, start);\n\n // Handle the requested mnemonic based on the search results.\n // If exactly one mnemonic is matched, that item is triggered.\n // Otherwise, the next mnemonic is activated if available,\n // followed by the auto mnemonic if available.\n if (result.index !== -1 && !result.multiple) {\n this.activeIndex = result.index;\n this.triggerActiveItem();\n } else if (result.index !== -1) {\n this.activeIndex = result.index;\n } else if (result.auto !== -1) {\n this.activeIndex = result.auto;\n }\n }\n\n /**\n * Handle the `'mouseup'` event for the menu.\n *\n * #### Notes\n * This listener is attached to the menu node.\n */\n private _evtMouseUp(event: MouseEvent): void {\n if (event.button !== 0) {\n return;\n }\n event.preventDefault();\n event.stopPropagation();\n this.triggerActiveItem();\n }\n\n /**\n * Handle the `'mousemove'` event for the menu.\n *\n * #### Notes\n * This listener is attached to the menu node.\n */\n private _evtMouseMove(event: MouseEvent): void {\n // Hit test the item nodes for the item under the mouse.\n let index = ArrayExt.findFirstIndex(this.contentNode.children, node => {\n return ElementExt.hitTest(node, event.clientX, event.clientY);\n });\n\n // Bail early if the mouse is already over the active index.\n if (index === this._activeIndex) {\n return;\n }\n\n // Update and coerce the active index.\n this.activeIndex = index;\n index = this.activeIndex;\n\n // If the index is the current child index, cancel the timers.\n if (index === this._childIndex) {\n this._cancelOpenTimer();\n this._cancelCloseTimer();\n return;\n }\n\n // If a child menu is currently open, start the close timer.\n if (this._childIndex !== -1) {\n this._startCloseTimer();\n }\n\n // Cancel the open timer to give a full delay for opening.\n this._cancelOpenTimer();\n\n // Bail if the active item is not a valid submenu item.\n let item = this.activeItem;\n if (!item || item.type !== 'submenu' || !item.submenu) {\n return;\n }\n\n // Start the open timer to open the active item submenu.\n this._startOpenTimer();\n }\n\n /**\n * Handle the `'mouseenter'` event for the menu.\n *\n * #### Notes\n * This listener is attached to the menu node.\n */\n private _evtMouseEnter(event: MouseEvent): void {\n // Synchronize the active ancestor items.\n for (let menu = this._parentMenu; menu; menu = menu._parentMenu) {\n menu._cancelOpenTimer();\n menu._cancelCloseTimer();\n menu.activeIndex = menu._childIndex;\n }\n }\n\n /**\n * Handle the `'mouseleave'` event for the menu.\n *\n * #### Notes\n * This listener is attached to the menu node.\n */\n private _evtMouseLeave(event: MouseEvent): void {\n // Cancel any pending submenu opening.\n this._cancelOpenTimer();\n\n // If there is no open child menu, just reset the active index.\n if (!this._childMenu) {\n this.activeIndex = -1;\n return;\n }\n\n // If the mouse is over the child menu, cancel the close timer.\n let { clientX, clientY } = event;\n if (ElementExt.hitTest(this._childMenu.node, clientX, clientY)) {\n this._cancelCloseTimer();\n return;\n }\n\n // Otherwise, reset the active index and start the close timer.\n this.activeIndex = -1;\n this._startCloseTimer();\n }\n\n /**\n * Handle the `'mousedown'` event for the menu.\n *\n * #### Notes\n * This listener is attached to the document node.\n */\n private _evtMouseDown(event: MouseEvent): void {\n // Bail if the menu is not a root menu.\n if (this._parentMenu) {\n return;\n }\n\n // The mouse button which is pressed is irrelevant. If the press\n // is not on a menu, the entire hierarchy is closed and the event\n // is allowed to propagate. This allows other code to act on the\n // event, such as focusing the clicked element.\n if (Private.hitTestMenus(this, event.clientX, event.clientY)) {\n event.preventDefault();\n event.stopPropagation();\n } else {\n this.close();\n }\n }\n\n /**\n * Open the child menu at the active index immediately.\n *\n * If a different child menu is already open, it will be closed,\n * even if the active item is not a valid submenu.\n */\n private _openChildMenu(activateFirst = false): void {\n // If the item is not a valid submenu, close the child menu.\n let item = this.activeItem;\n if (!item || item.type !== 'submenu' || !item.submenu) {\n this._closeChildMenu();\n return;\n }\n\n // Do nothing if the child menu will not change.\n let submenu = item.submenu;\n if (submenu === this._childMenu) {\n return;\n }\n\n // Prior to any DOM modifications save window data\n Menu.saveWindowData();\n\n // Ensure the current child menu is closed.\n this._closeChildMenu();\n\n // Update the private child state.\n this._childMenu = submenu;\n this._childIndex = this._activeIndex;\n\n // Set the parent menu reference for the child.\n submenu._parentMenu = this;\n\n // Ensure the menu is updated and lookup the item node.\n MessageLoop.sendMessage(this, Widget.Msg.UpdateRequest);\n let itemNode = this.contentNode.children[this._activeIndex];\n\n // Open the submenu at the active node.\n Private.openSubmenu(submenu, itemNode as HTMLElement);\n\n // Activate the first item if desired.\n if (activateFirst) {\n submenu.activeIndex = -1;\n submenu.activateNextItem();\n }\n\n // Activate the child menu.\n submenu.activate();\n }\n\n /**\n * Close the child menu immediately.\n *\n * This is a no-op if a child menu is not open.\n */\n private _closeChildMenu(): void {\n if (this._childMenu) {\n this._childMenu.close();\n }\n }\n\n /**\n * Start the open timer, unless it is already pending.\n */\n private _startOpenTimer(): void {\n if (this._openTimerID === 0) {\n this._openTimerID = window.setTimeout(() => {\n this._openTimerID = 0;\n this._openChildMenu();\n }, Private.TIMER_DELAY);\n }\n }\n\n /**\n * Start the close timer, unless it is already pending.\n */\n private _startCloseTimer(): void {\n if (this._closeTimerID === 0) {\n this._closeTimerID = window.setTimeout(() => {\n this._closeTimerID = 0;\n this._closeChildMenu();\n }, Private.TIMER_DELAY);\n }\n }\n\n /**\n * Cancel the open timer, if the timer is pending.\n */\n private _cancelOpenTimer(): void {\n if (this._openTimerID !== 0) {\n clearTimeout(this._openTimerID);\n this._openTimerID = 0;\n }\n }\n\n /**\n * Cancel the close timer, if the timer is pending.\n */\n private _cancelCloseTimer(): void {\n if (this._closeTimerID !== 0) {\n clearTimeout(this._closeTimerID);\n this._closeTimerID = 0;\n }\n }\n\n /**\n * Save window data used for menu positioning in transient cache.\n *\n * In order to avoid layout trashing it is recommended to invoke this\n * method immediately prior to opening the menu and any DOM modifications\n * (like closing previously visible menu, or adding a class to menu widget).\n *\n * The transient cache will be released upon `open()` call.\n */\n static saveWindowData(): void {\n Private.saveWindowData();\n }\n\n private _childIndex = -1;\n private _activeIndex = -1;\n private _openTimerID = 0;\n private _closeTimerID = 0;\n private _items: Menu.IItem[] = [];\n private _childMenu: Menu | null = null;\n private _parentMenu: Menu | null = null;\n private _aboutToClose = new Signal(this);\n private _menuRequested = new Signal(this);\n}\n\n/**\n * The namespace for the `Menu` class statics.\n */\nexport namespace Menu {\n /**\n * An options object for creating a menu.\n */\n export interface IOptions {\n /**\n * The command registry for use with the menu.\n */\n commands: CommandRegistry;\n\n /**\n * A custom renderer for use with the menu.\n *\n * The default is a shared renderer instance.\n */\n renderer?: IRenderer;\n }\n\n /**\n * An options object for the `open` method on a menu.\n */\n export interface IOpenOptions {\n /**\n * Whether to force the X position of the menu.\n *\n * Setting to `true` will disable the logic which repositions the\n * X coordinate of the menu if it will not fit entirely on screen.\n *\n * The default is `false`.\n */\n forceX?: boolean;\n\n /**\n * Whether to force the Y position of the menu.\n *\n * Setting to `true` will disable the logic which repositions the\n * Y coordinate of the menu if it will not fit entirely on screen.\n *\n * The default is `false`.\n */\n forceY?: boolean;\n\n /**\n * The DOM node to use as the menu's host.\n *\n * If not specified then uses `document.body`.\n */\n host?: HTMLElement;\n\n /**\n * The child of `host` to use as the reference element.\n * If this is provided, the menu will be inserted before this\n * node in the host. The default is `null`, which will cause the\n * menu to be added as the last child of the host.\n */\n ref?: HTMLElement;\n\n /**\n * The alignment of the menu.\n *\n * The default is `'left'` unless the document `dir` attribute is `'rtl'`\n */\n horizontalAlignment?: 'left' | 'right';\n }\n\n /**\n * A type alias for a menu item type.\n */\n export type ItemType = 'command' | 'submenu' | 'separator';\n\n /**\n * An options object for creating a menu item.\n */\n export interface IItemOptions {\n /**\n * The type of the menu item.\n *\n * The default value is `'command'`.\n */\n type?: ItemType;\n\n /**\n * The command to execute when the item is triggered.\n *\n * The default value is an empty string.\n */\n command?: string;\n\n /**\n * The arguments for the command.\n *\n * The default value is an empty object.\n */\n args?: ReadonlyJSONObject;\n\n /**\n * The submenu for a `'submenu'` type item.\n *\n * The default value is `null`.\n */\n submenu?: Menu | null;\n }\n\n /**\n * An object which represents a menu item.\n *\n * #### Notes\n * Item objects are created automatically by a menu.\n */\n export interface IItem {\n /**\n * The type of the menu item.\n */\n readonly type: ItemType;\n\n /**\n * The command to execute when the item is triggered.\n */\n readonly command: string;\n\n /**\n * The arguments for the command.\n */\n readonly args: ReadonlyJSONObject;\n\n /**\n * The submenu for a `'submenu'` type item.\n */\n readonly submenu: Menu | null;\n\n /**\n * The display label for the menu item.\n */\n readonly label: string;\n\n /**\n * The mnemonic index for the menu item.\n */\n readonly mnemonic: number;\n\n /**\n * The icon renderer for the menu item.\n */\n readonly icon: VirtualElement.IRenderer | undefined;\n\n /**\n * The icon class for the menu item.\n */\n readonly iconClass: string;\n\n /**\n * The icon label for the menu item.\n */\n readonly iconLabel: string;\n\n /**\n * The display caption for the menu item.\n */\n readonly caption: string;\n\n /**\n * The extra class name for the menu item.\n */\n readonly className: string;\n\n /**\n * The dataset for the menu item.\n */\n readonly dataset: CommandRegistry.Dataset;\n\n /**\n * Whether the menu item is enabled.\n */\n readonly isEnabled: boolean;\n\n /**\n * Whether the menu item is toggled.\n */\n readonly isToggled: boolean;\n\n /**\n * Whether the menu item is visible.\n */\n readonly isVisible: boolean;\n\n /**\n * The key binding for the menu item.\n */\n readonly keyBinding: CommandRegistry.IKeyBinding | null;\n }\n\n /**\n * An object which holds the data to render a menu item.\n */\n export interface IRenderData {\n /**\n * The item to be rendered.\n */\n readonly item: IItem;\n\n /**\n * Whether the item is the active item.\n */\n readonly active: boolean;\n\n /**\n * Whether the item should be collapsed.\n */\n readonly collapsed: boolean;\n\n /**\n * Handler for when element is in focus.\n */\n readonly onfocus?: () => void;\n }\n\n /**\n * A renderer for use with a menu.\n */\n export interface IRenderer {\n /**\n * Render the virtual element for a menu item.\n *\n * @param data - The data to use for rendering the item.\n *\n * @returns A virtual element representing the item.\n */\n renderItem(data: IRenderData): VirtualElement;\n }\n\n /**\n * The default implementation of `IRenderer`.\n *\n * #### Notes\n * Subclasses are free to reimplement rendering methods as needed.\n */\n export class Renderer implements IRenderer {\n /**\n * Render the virtual element for a menu item.\n *\n * @param data - The data to use for rendering the item.\n *\n * @returns A virtual element representing the item.\n */\n renderItem(data: IRenderData): VirtualElement {\n let className = this.createItemClass(data);\n let dataset = this.createItemDataset(data);\n let aria = this.createItemARIA(data);\n return h.li(\n {\n className,\n dataset,\n tabindex: '0',\n onfocus: data.onfocus,\n ...aria\n },\n this.renderIcon(data),\n this.renderLabel(data),\n this.renderShortcut(data),\n this.renderSubmenu(data)\n );\n }\n\n /**\n * Render the icon element for a menu item.\n *\n * @param data - The data to use for rendering the icon.\n *\n * @returns A virtual element representing the item icon.\n */\n renderIcon(data: IRenderData): VirtualElement {\n let className = this.createIconClass(data);\n\n // If data.item.icon is undefined, it will be ignored.\n return h.div({ className }, data.item.icon!, data.item.iconLabel);\n }\n\n /**\n * Render the label element for a menu item.\n *\n * @param data - The data to use for rendering the label.\n *\n * @returns A virtual element representing the item label.\n */\n renderLabel(data: IRenderData): VirtualElement {\n let content = this.formatLabel(data);\n return h.div({ className: 'lm-Menu-itemLabel' }, content);\n }\n\n /**\n * Render the shortcut element for a menu item.\n *\n * @param data - The data to use for rendering the shortcut.\n *\n * @returns A virtual element representing the item shortcut.\n */\n renderShortcut(data: IRenderData): VirtualElement {\n let content = this.formatShortcut(data);\n return h.div({ className: 'lm-Menu-itemShortcut' }, content);\n }\n\n /**\n * Render the submenu icon element for a menu item.\n *\n * @param data - The data to use for rendering the submenu icon.\n *\n * @returns A virtual element representing the submenu icon.\n */\n renderSubmenu(data: IRenderData): VirtualElement {\n return h.div({ className: 'lm-Menu-itemSubmenuIcon' });\n }\n\n /**\n * Create the class name for the menu item.\n *\n * @param data - The data to use for the class name.\n *\n * @returns The full class name for the menu item.\n */\n createItemClass(data: IRenderData): string {\n // Setup the initial class name.\n let name = 'lm-Menu-item';\n\n // Add the boolean state classes.\n if (!data.item.isEnabled) {\n name += ' lm-mod-disabled';\n }\n if (data.item.isToggled) {\n name += ' lm-mod-toggled';\n }\n if (!data.item.isVisible) {\n name += ' lm-mod-hidden';\n }\n if (data.active) {\n name += ' lm-mod-active';\n }\n if (data.collapsed) {\n name += ' lm-mod-collapsed';\n }\n\n // Add the extra class.\n let extra = data.item.className;\n if (extra) {\n name += ` ${extra}`;\n }\n\n // Return the complete class name.\n return name;\n }\n\n /**\n * Create the dataset for the menu item.\n *\n * @param data - The data to use for creating the dataset.\n *\n * @returns The dataset for the menu item.\n */\n createItemDataset(data: IRenderData): ElementDataset {\n let result: ElementDataset;\n let { type, command, dataset } = data.item;\n if (type === 'command') {\n result = { ...dataset, type, command };\n } else {\n result = { ...dataset, type };\n }\n return result;\n }\n\n /**\n * Create the class name for the menu item icon.\n *\n * @param data - The data to use for the class name.\n *\n * @returns The full class name for the item icon.\n */\n createIconClass(data: IRenderData): string {\n let name = 'lm-Menu-itemIcon';\n let extra = data.item.iconClass;\n return extra ? `${name} ${extra}` : name;\n }\n\n /**\n * Create the aria attributes for menu item.\n *\n * @param data - The data to use for the aria attributes.\n *\n * @returns The aria attributes object for the item.\n */\n createItemARIA(data: IRenderData): ElementARIAAttrs {\n let aria: { [T in ARIAAttrNames]?: string } = {};\n switch (data.item.type) {\n case 'separator':\n aria.role = 'presentation';\n break;\n case 'submenu':\n aria['aria-haspopup'] = 'true';\n if (!data.item.isEnabled) {\n aria['aria-disabled'] = 'true';\n }\n break;\n default:\n if (!data.item.isEnabled) {\n aria['aria-disabled'] = 'true';\n }\n if (data.item.isToggled) {\n aria.role = 'menuitemcheckbox';\n aria['aria-checked'] = 'true';\n } else {\n aria.role = 'menuitem';\n }\n }\n return aria;\n }\n\n /**\n * Create the render content for the label node.\n *\n * @param data - The data to use for the label content.\n *\n * @returns The content to add to the label node.\n */\n formatLabel(data: IRenderData): h.Child {\n // Fetch the label text and mnemonic index.\n let { label, mnemonic } = data.item;\n\n // If the index is out of range, do not modify the label.\n if (mnemonic < 0 || mnemonic >= label.length) {\n return label;\n }\n\n // Split the label into parts.\n let prefix = label.slice(0, mnemonic);\n let suffix = label.slice(mnemonic + 1);\n let char = label[mnemonic];\n\n // Wrap the mnemonic character in a span.\n let span = h.span({ className: 'lm-Menu-itemMnemonic' }, char);\n\n // Return the content parts.\n return [prefix, span, suffix];\n }\n\n /**\n * Create the render content for the shortcut node.\n *\n * @param data - The data to use for the shortcut content.\n *\n * @returns The content to add to the shortcut node.\n */\n formatShortcut(data: IRenderData): h.Child {\n let kb = data.item.keyBinding;\n return kb ? CommandRegistry.formatKeystroke(kb.keys) : null;\n }\n }\n\n /**\n * The default `Renderer` instance.\n */\n export const defaultRenderer = new Renderer();\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * The ms delay for opening and closing a submenu.\n */\n export const TIMER_DELAY = 300;\n\n /**\n * The horizontal pixel overlap for an open submenu.\n */\n export const SUBMENU_OVERLAP = 3;\n\n function getWindowData(element: HTMLElement): IWindowData {\n\n return _getWindowData(element);\n }\n\n /**\n * Store window data in transient cache.\n *\n * The transient cache will be released upon `getWindowData()` call.\n * If this function is called multiple times, the cache will be\n * retained until as many calls to `getWindowData()` were made.\n *\n * Note: should be called before any DOM modifications.\n */\n export function saveWindowData(): void {\n }\n\n /**\n * Create the DOM node for a menu.\n */\n export function createNode(): HTMLDivElement {\n let node = document.createElement('div');\n let content = document.createElement('ul');\n content.className = 'lm-Menu-content';\n node.appendChild(content);\n content.setAttribute('role', 'menu');\n node.tabIndex = 0;\n return node;\n }\n\n /**\n * Test whether a menu item can be activated.\n */\n export function canActivate(item: Menu.IItem): boolean {\n return item.type !== 'separator' && item.isEnabled && item.isVisible;\n }\n\n /**\n * Create a new menu item for an owner menu.\n */\n export function createItem(\n owner: Menu,\n options: Menu.IItemOptions\n ): Menu.IItem {\n return new MenuItem(owner.commands, options);\n }\n\n /**\n * Hit test a menu hierarchy starting at the given root.\n */\n export function hitTestMenus(menu: Menu, x: number, y: number): boolean {\n for (let temp: Menu | null = menu; temp; temp = temp.childMenu) {\n if (ElementExt.hitTest(temp.node, x, y)) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * Compute which extra separator items should be collapsed.\n */\n export function computeCollapsed(\n items: ReadonlyArray\n ): boolean[] {\n // Allocate the return array and fill it with `false`.\n let result = new Array(items.length);\n ArrayExt.fill(result, false);\n\n // Collapse the leading separators.\n let k1 = 0;\n let n = items.length;\n for (; k1 < n; ++k1) {\n let item = items[k1];\n if (!item.isVisible) {\n continue;\n }\n if (item.type !== 'separator') {\n break;\n }\n result[k1] = true;\n }\n\n // Hide the trailing separators.\n let k2 = n - 1;\n for (; k2 >= 0; --k2) {\n let item = items[k2];\n if (!item.isVisible) {\n continue;\n }\n if (item.type !== 'separator') {\n break;\n }\n result[k2] = true;\n }\n\n // Hide the remaining consecutive separators.\n let hide = false;\n while (++k1 < k2) {\n let item = items[k1];\n if (!item.isVisible) {\n continue;\n }\n if (item.type !== 'separator') {\n hide = false;\n } else if (hide) {\n result[k1] = true;\n } else {\n hide = true;\n }\n }\n\n // Return the resulting flags.\n return result;\n }\n\n function _getWindowData(element: HTMLElement): IWindowData {\n return {\n pageXOffset: element.ownerDocument.defaultView?.window.scrollX || 0,\n pageYOffset: element.ownerDocument.defaultView?.window.scrollY || 0,\n clientWidth: element.ownerDocument.documentElement.clientWidth,\n clientHeight: element.ownerDocument.documentElement.clientHeight\n };\n }\n\n /**\n * Open a menu as a root menu at the target location.\n */\n export function openRootMenu(\n menu: Menu,\n x: number,\n y: number,\n forceX: boolean,\n forceY: boolean,\n horizontalAlignment: 'left' | 'right',\n host: HTMLElement | null,\n ref: HTMLElement | null\n ): void {\n // Get the current position and size of the main viewport.\n const windowData = getWindowData(host || menu.node);\n let px = windowData.pageXOffset;\n let py = windowData.pageYOffset;\n let cw = windowData.clientWidth;\n let ch = windowData.clientHeight;\n\n // Ensure the menu is updated before attaching and measuring.\n MessageLoop.sendMessage(menu, Widget.Msg.UpdateRequest);\n\n // Compute the maximum allowed height for the menu.\n let maxHeight = ch - (forceY ? y : 0);\n\n // Fetch common variables.\n let node = menu.node;\n let style = node.style;\n style.top = '0';\n style.left = '0';\n\n // Clear the menu geometry and prepare it for measuring.\n style.opacity = '0';\n style.maxHeight = `${maxHeight}px`;\n\n // Attach the menu to the document.\n Widget.attach(menu, host || document.body, ref);\n\n // Measure the size of the menu.\n let { width, height } = node.getBoundingClientRect();\n\n // align the menu to the right of the target if requested or language is RTL\n if (horizontalAlignment === 'right') {\n x -= width;\n }\n\n // Adjust the X position of the menu to fit on-screen.\n if (!forceX && x + width > px + cw) {\n x = px + cw - width;\n }\n\n // Adjust the Y position of the menu to fit on-screen.\n if (!forceY && y + height > py + ch) {\n if (y > py + ch) {\n y = py + ch - height;\n } else {\n y = y - height;\n }\n }\n\n // Update the position of the menu to the computed position.\n style.transform = `translate(${Math.max(0, x)}px, ${Math.max(0, y)}px`;\n\n // Finally, make the menu visible on the screen.\n style.opacity = '1';\n }\n\n /**\n * Open a menu as a submenu using an item node for positioning.\n */\n export function openSubmenu(submenu: Menu, itemNode: HTMLElement): void {\n // Get the current position and size of the main viewport.\n const windowData = getWindowData(itemNode);\n let px = windowData.pageXOffset;\n let py = windowData.pageYOffset;\n let cw = windowData.clientWidth;\n let ch = windowData.clientHeight;\n\n // Ensure the menu is updated before opening.\n MessageLoop.sendMessage(submenu, Widget.Msg.UpdateRequest);\n\n // Compute the maximum allowed height for the menu.\n let maxHeight = ch;\n\n // Fetch common variables.\n let node = submenu.node;\n let style = node.style;\n\n // Clear the menu geometry and prepare it for measuring.\n style.opacity = '0';\n style.maxHeight = `${maxHeight}px`;\n\n // Attach the menu to the document.\n Widget.attach(submenu, itemNode.ownerDocument.body);\n\n // Measure the size of the menu.\n let { width, height } = node.getBoundingClientRect();\n\n // Compute the box sizing for the menu.\n let box = ElementExt.boxSizing(submenu.node);\n\n // Get the bounding rect for the target item node.\n let itemRect = itemNode.getBoundingClientRect();\n\n // Compute the target X position.\n let x = itemRect.right - SUBMENU_OVERLAP;\n\n // Adjust the X position to fit on the screen.\n if (x + width > px + cw) {\n x = itemRect.left + SUBMENU_OVERLAP - width;\n }\n\n // Compute the target Y position.\n let y = itemRect.top - box.borderTop - box.paddingTop;\n\n // Adjust the Y position to fit on the screen.\n if (y + height > py + ch) {\n y = itemRect.bottom + box.borderBottom + box.paddingBottom - height;\n }\n\n style.top = '0';\n style.left = '0';\n // Update the position of the menu to the computed position.\n style.transform = `translate(${Math.max(0, x)}px, ${Math.max(0, y)}px`;\n\n // Finally, make the menu visible on the screen.\n style.opacity = '1';\n }\n\n /**\n * The results of a mnemonic search.\n */\n export interface IMnemonicResult {\n /**\n * The index of the first matching mnemonic item, or `-1`.\n */\n index: number;\n\n /**\n * Whether multiple mnemonic items matched.\n */\n multiple: boolean;\n\n /**\n * The index of the first auto matched non-mnemonic item.\n */\n auto: number;\n }\n\n /**\n * Find the best matching mnemonic item.\n *\n * The search starts at the given index and wraps around.\n */\n export function findMnemonic(\n items: ReadonlyArray,\n key: string,\n start: number\n ): IMnemonicResult {\n // Setup the result variables.\n let index = -1;\n let auto = -1;\n let multiple = false;\n\n // Normalize the key to upper case.\n let upperKey = key.toUpperCase();\n\n // Search the items from the given start index.\n for (let i = 0, n = items.length; i < n; ++i) {\n // Compute the wrapped index.\n let k = (i + start) % n;\n\n // Lookup the item\n let item = items[k];\n\n // Ignore items which cannot be activated.\n if (!canActivate(item)) {\n continue;\n }\n\n // Ignore items with an empty label.\n let label = item.label;\n if (label.length === 0) {\n continue;\n }\n\n // Lookup the mnemonic index for the label.\n let mn = item.mnemonic;\n\n // Handle a valid mnemonic index.\n if (mn >= 0 && mn < label.length) {\n if (label[mn].toUpperCase() === upperKey) {\n if (index === -1) {\n index = k;\n } else {\n multiple = true;\n }\n }\n continue;\n }\n\n // Finally, handle the auto index if possible.\n if (auto === -1 && label[0].toUpperCase() === upperKey) {\n auto = k;\n }\n }\n\n // Return the search results.\n return { index, multiple, auto };\n }\n\n /**\n * A concrete implementation of `Menu.IItem`.\n */\n class MenuItem implements Menu.IItem {\n /**\n * Construct a new menu item.\n */\n constructor(commands: CommandRegistry, options: Menu.IItemOptions) {\n this._commands = commands;\n this.type = options.type || 'command';\n this.command = options.command || '';\n this.args = options.args || JSONExt.emptyObject;\n this.submenu = options.submenu || null;\n }\n\n /**\n * The type of the menu item.\n */\n readonly type: Menu.ItemType;\n\n /**\n * The command to execute when the item is triggered.\n */\n readonly command: string;\n\n /**\n * The arguments for the command.\n */\n readonly args: ReadonlyJSONObject;\n\n /**\n * The submenu for a `'submenu'` type item.\n */\n readonly submenu: Menu | null;\n\n /**\n * The display label for the menu item.\n */\n get label(): string {\n if (this.type === 'command') {\n return this._commands.label(this.command, this.args);\n }\n if (this.type === 'submenu' && this.submenu) {\n return this.submenu.title.label;\n }\n return '';\n }\n\n /**\n * The mnemonic index for the menu item.\n */\n get mnemonic(): number {\n if (this.type === 'command') {\n return this._commands.mnemonic(this.command, this.args);\n }\n if (this.type === 'submenu' && this.submenu) {\n return this.submenu.title.mnemonic;\n }\n return -1;\n }\n\n /**\n * The icon renderer for the menu item.\n */\n get icon(): VirtualElement.IRenderer | undefined {\n if (this.type === 'command') {\n return this._commands.icon(this.command, this.args);\n }\n if (this.type === 'submenu' && this.submenu) {\n return this.submenu.title.icon;\n }\n return undefined;\n }\n\n /**\n * The icon class for the menu item.\n */\n get iconClass(): string {\n if (this.type === 'command') {\n return this._commands.iconClass(this.command, this.args);\n }\n if (this.type === 'submenu' && this.submenu) {\n return this.submenu.title.iconClass;\n }\n return '';\n }\n\n /**\n * The icon label for the menu item.\n */\n get iconLabel(): string {\n if (this.type === 'command') {\n return this._commands.iconLabel(this.command, this.args);\n }\n if (this.type === 'submenu' && this.submenu) {\n return this.submenu.title.iconLabel;\n }\n return '';\n }\n\n /**\n * The display caption for the menu item.\n */\n get caption(): string {\n if (this.type === 'command') {\n return this._commands.caption(this.command, this.args);\n }\n if (this.type === 'submenu' && this.submenu) {\n return this.submenu.title.caption;\n }\n return '';\n }\n\n /**\n * The extra class name for the menu item.\n */\n get className(): string {\n if (this.type === 'command') {\n return this._commands.className(this.command, this.args);\n }\n if (this.type === 'submenu' && this.submenu) {\n return this.submenu.title.className;\n }\n return '';\n }\n\n /**\n * The dataset for the menu item.\n */\n get dataset(): CommandRegistry.Dataset {\n if (this.type === 'command') {\n return this._commands.dataset(this.command, this.args);\n }\n if (this.type === 'submenu' && this.submenu) {\n return this.submenu.title.dataset;\n }\n return {};\n }\n\n /**\n * Whether the menu item is enabled.\n */\n get isEnabled(): boolean {\n if (this.type === 'command') {\n return this._commands.isEnabled(this.command, this.args);\n }\n if (this.type === 'submenu') {\n return this.submenu !== null;\n }\n return true;\n }\n\n /**\n * Whether the menu item is toggled.\n */\n get isToggled(): boolean {\n if (this.type === 'command') {\n return this._commands.isToggled(this.command, this.args);\n }\n return false;\n }\n\n /**\n * Whether the menu item is visible.\n */\n get isVisible(): boolean {\n if (this.type === 'command') {\n return this._commands.isVisible(this.command, this.args);\n }\n if (this.type === 'submenu') {\n return this.submenu !== null;\n }\n return true;\n }\n\n /**\n * The key binding for the menu item.\n */\n get keyBinding(): CommandRegistry.IKeyBinding | null {\n if (this.type === 'command') {\n let { command, args } = this;\n return (\n ArrayExt.findLastValue(this._commands.keyBindings, kb => {\n return kb.command === command && JSONExt.deepEqual(kb.args, args);\n }) || null\n );\n }\n return null;\n }\n\n private _commands: CommandRegistry;\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { CommandRegistry } from '@lumino/commands';\n\nimport { DisposableDelegate, IDisposable } from '@lumino/disposable';\n\nimport { Selector } from '@lumino/domutils';\n\nimport { Menu } from './menu';\n\n/**\n * An object which implements a universal context menu.\n *\n * #### Notes\n * The items shown in the context menu are determined by CSS selector\n * matching against the DOM hierarchy at the site of the mouse click.\n * This is similar in concept to how keyboard shortcuts are matched\n * in the command registry.\n */\nexport class ContextMenu {\n /**\n * Construct a new context menu.\n *\n * @param options - The options for initializing the menu.\n */\n constructor(options: ContextMenu.IOptions) {\n const { groupByTarget, sortBySelector, ...others } = options;\n this.menu = new Menu(others);\n this._groupByTarget = groupByTarget !== false;\n this._sortBySelector = sortBySelector !== false;\n }\n\n /**\n * The menu widget which displays the matched context items.\n */\n readonly menu: Menu;\n\n /**\n * Add an item to the context menu.\n *\n * @param options - The options for creating the item.\n *\n * @returns A disposable which will remove the item from the menu.\n */\n addItem(options: ContextMenu.IItemOptions): IDisposable {\n // Create an item from the given options.\n let item = Private.createItem(options, this._idTick++);\n\n // Add the item to the internal array.\n this._items.push(item);\n\n // Return a disposable which will remove the item.\n return new DisposableDelegate(() => {\n ArrayExt.removeFirstOf(this._items, item);\n });\n }\n\n /**\n * Open the context menu in response to a `'contextmenu'` event.\n *\n * @param event - The `'contextmenu'` event of interest.\n *\n * @returns `true` if the menu was opened, or `false` if no items\n * matched the event and the menu was not opened.\n *\n * #### Notes\n * This method will populate the context menu with items which match\n * the propagation path of the event, then open the menu at the mouse\n * position indicated by the event.\n */\n open(event: MouseEvent): boolean {\n // Prior to any DOM modifications update the window data.\n Menu.saveWindowData();\n\n // Clear the current contents of the context menu.\n this.menu.clearItems();\n\n // Bail early if there are no items to match.\n if (this._items.length === 0) {\n return false;\n }\n\n // Find the matching items for the event.\n let items = Private.matchItems(\n this._items,\n event,\n this._groupByTarget,\n this._sortBySelector\n );\n\n // Bail if there are no matching items.\n if (!items || items.length === 0) {\n return false;\n }\n\n // Add the filtered items to the menu.\n for (const item of items) {\n this.menu.addItem(item);\n }\n\n // Open the context menu at the current mouse position.\n this.menu.open(event.clientX, event.clientY);\n\n // Indicate success.\n return true;\n }\n\n private _groupByTarget: boolean = true;\n private _idTick = 0;\n private _items: Private.IItem[] = [];\n private _sortBySelector: boolean = true;\n}\n\n/**\n * The namespace for the `ContextMenu` class statics.\n */\nexport namespace ContextMenu {\n /**\n * An options object for initializing a context menu.\n */\n export interface IOptions {\n /**\n * The command registry to use with the context menu.\n */\n commands: CommandRegistry;\n\n /**\n * A custom renderer for use with the context menu.\n */\n renderer?: Menu.IRenderer;\n\n /**\n * Whether to sort by selector and rank or only rank.\n *\n * Default true.\n */\n sortBySelector?: boolean;\n\n /**\n * Whether to group items following the DOM hierarchy.\n *\n * Default true.\n *\n * #### Note\n * If true, when the mouse event occurs on element `span` within `div.top`,\n * the items matching `div.top` will be shown before the ones matching `body`.\n */\n groupByTarget?: boolean;\n }\n\n /**\n * An options object for creating a context menu item.\n */\n export interface IItemOptions extends Menu.IItemOptions {\n /**\n * The CSS selector for the context menu item.\n *\n * The context menu item will only be displayed in the context menu\n * when the selector matches a node on the propagation path of the\n * contextmenu event. This allows the menu item to be restricted to\n * user-defined contexts.\n *\n * The selector must not contain commas.\n */\n selector: string;\n\n /**\n * The rank for the item.\n *\n * The rank is used as a tie-breaker when ordering context menu\n * items for display. Items are sorted in the following order:\n * 1. Depth in the DOM tree (deeper is better)\n * 2. Selector specificity (higher is better)\n * 3. Rank (lower is better)\n * 4. Insertion order\n *\n * The default rank is `Infinity`.\n */\n rank?: number;\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * A normalized item for a context menu.\n */\n export interface IItem extends Menu.IItemOptions {\n /**\n * The selector for the item.\n */\n selector: string;\n\n /**\n * The rank for the item.\n */\n rank: number;\n\n /**\n * The tie-breaking id for the item.\n */\n id: number;\n }\n\n /**\n * Create a normalized context menu item from an options object.\n */\n export function createItem(\n options: ContextMenu.IItemOptions,\n id: number\n ): IItem {\n let selector = validateSelector(options.selector);\n let rank = options.rank !== undefined ? options.rank : Infinity;\n return { ...options, selector, rank, id };\n }\n\n /**\n * Find the items which match a context menu event.\n *\n * The results are sorted by DOM level, specificity, and rank.\n */\n export function matchItems(\n items: IItem[],\n event: MouseEvent,\n groupByTarget: boolean,\n sortBySelector: boolean\n ): IItem[] | null {\n // Look up the target of the event.\n let target = event.target as Element | null;\n\n // Bail if there is no target.\n if (!target) {\n return null;\n }\n\n // Look up the current target of the event.\n let currentTarget = event.currentTarget as Element | null;\n\n // Bail if there is no current target.\n if (!currentTarget) {\n return null;\n }\n\n // There are some third party libraries that cause the `target` to\n // be detached from the DOM before lumino can process the event.\n // If that happens, search for a new target node by point. If that\n // node is still dangling, bail.\n if (!currentTarget.contains(target)) {\n target = document.elementFromPoint(event.clientX, event.clientY);\n if (!target || !currentTarget.contains(target)) {\n return null;\n }\n }\n\n // Set up the result array.\n let result: IItem[] = [];\n\n // Copy the items array to allow in-place modification.\n let availableItems: Array = items.slice();\n\n // Walk up the DOM hierarchy searching for matches.\n while (target !== null) {\n // Set up the match array for this DOM level.\n let matches: IItem[] = [];\n\n // Search the remaining items for matches.\n for (let i = 0, n = availableItems.length; i < n; ++i) {\n // Fetch the item.\n let item = availableItems[i];\n\n // Skip items which are already consumed.\n if (!item) {\n continue;\n }\n\n // Skip items which do not match the element.\n if (!Selector.matches(target, item.selector)) {\n continue;\n }\n\n // Add the matched item to the result for this DOM level.\n matches.push(item);\n\n // Mark the item as consumed.\n availableItems[i] = null;\n }\n\n // Sort the matches for this level and add them to the results.\n if (matches.length !== 0) {\n if (groupByTarget) {\n matches.sort(sortBySelector ? itemCmp : itemCmpRank);\n }\n result.push(...matches);\n }\n\n // Stop searching at the limits of the DOM range.\n if (target === currentTarget) {\n break;\n }\n\n // Step to the parent DOM level.\n target = target.parentElement;\n }\n\n if (!groupByTarget) {\n result.sort(sortBySelector ? itemCmp : itemCmpRank);\n }\n\n // Return the matched and sorted results.\n return result;\n }\n\n /**\n * Validate the selector for a menu item.\n *\n * This returns the validated selector, or throws if the selector is\n * invalid or contains commas.\n */\n function validateSelector(selector: string): string {\n if (selector.indexOf(',') !== -1) {\n throw new Error(`Selector cannot contain commas: ${selector}`);\n }\n if (!Selector.isValid(selector)) {\n throw new Error(`Invalid selector: ${selector}`);\n }\n return selector;\n }\n\n /**\n * A sort comparison function for a context menu item by ranks.\n */\n function itemCmpRank(a: IItem, b: IItem): number {\n // Sort based on rank.\n let r1 = a.rank;\n let r2 = b.rank;\n if (r1 !== r2) {\n return r1 < r2 ? -1 : 1; // Infinity-safe\n }\n\n // When all else fails, sort by item id.\n return a.id - b.id;\n }\n\n /**\n * A sort comparison function for a context menu item by selectors and ranks.\n */\n function itemCmp(a: IItem, b: IItem): number {\n // Sort first based on selector specificity.\n let s1 = Selector.calculateSpecificity(a.selector);\n let s2 = Selector.calculateSpecificity(b.selector);\n if (s1 !== s2) {\n return s2 - s1;\n }\n\n // If specificities are equal\n return itemCmpRank(a, b);\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { IDisposable } from '@lumino/disposable';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Drag } from '@lumino/dragdrop';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport {\n ElementARIAAttrs,\n ElementBaseAttrs,\n ElementDataset,\n ElementInlineStyle,\n h,\n VirtualDOM,\n VirtualElement\n} from '@lumino/virtualdom';\n\nimport { Title } from './title';\n\nimport { Widget } from './widget';\n\nconst ARROW_KEYS = [\n 'ArrowLeft',\n 'ArrowUp',\n 'ArrowRight',\n 'ArrowDown',\n 'Home',\n 'End'\n];\n\n/**\n * A widget which displays titles as a single row or column of tabs.\n *\n * #### Notes\n * If CSS transforms are used to rotate nodes for vertically oriented\n * text, then tab dragging will not work correctly. The `tabsMovable`\n * property should be set to `false` when rotating nodes from CSS.\n */\nexport class TabBar extends Widget {\n /**\n * Construct a new tab bar.\n *\n * @param options - The options for initializing the tab bar.\n */\n constructor(options: TabBar.IOptions = {}) {\n super({ node: Private.createNode() });\n this.addClass('lm-TabBar');\n this.contentNode.setAttribute('role', 'tablist');\n this.setFlag(Widget.Flag.DisallowLayout);\n this._document = options.document || document;\n this.tabsMovable = options.tabsMovable || false;\n this.titlesEditable = options.titlesEditable || false;\n this.allowDeselect = options.allowDeselect || false;\n this.addButtonEnabled = options.addButtonEnabled || false;\n this.insertBehavior = options.insertBehavior || 'select-tab-if-needed';\n this.name = options.name || '';\n this.orientation = options.orientation || 'horizontal';\n this.removeBehavior = options.removeBehavior || 'select-tab-after';\n this.renderer = options.renderer || TabBar.defaultRenderer;\n }\n\n /**\n * Dispose of the resources held by the widget.\n */\n dispose(): void {\n this._releaseMouse();\n this._titles.length = 0;\n this._previousTitle = null;\n super.dispose();\n }\n\n /**\n * A signal emitted when the current tab is changed.\n *\n * #### Notes\n * This signal is emitted when the currently selected tab is changed\n * either through user or programmatic interaction.\n *\n * Notably, this signal is not emitted when the index of the current\n * tab changes due to tabs being inserted, removed, or moved. It is\n * only emitted when the actual current tab node is changed.\n */\n get currentChanged(): ISignal> {\n return this._currentChanged;\n }\n\n /**\n * A signal emitted when a tab is moved by the user.\n *\n * #### Notes\n * This signal is emitted when a tab is moved by user interaction.\n *\n * This signal is not emitted when a tab is moved programmatically.\n */\n get tabMoved(): ISignal> {\n return this._tabMoved;\n }\n\n /**\n * A signal emitted when a tab is clicked by the user.\n *\n * #### Notes\n * If the clicked tab is not the current tab, the clicked tab will be\n * made current and the `currentChanged` signal will be emitted first.\n *\n * This signal is emitted even if the clicked tab is the current tab.\n */\n get tabActivateRequested(): ISignal<\n this,\n TabBar.ITabActivateRequestedArgs\n > {\n return this._tabActivateRequested;\n }\n\n /**\n * A signal emitted when the tab bar add button is clicked.\n */\n get addRequested(): ISignal {\n return this._addRequested;\n }\n\n /**\n * A signal emitted when a tab close icon is clicked.\n *\n * #### Notes\n * This signal is not emitted unless the tab title is `closable`.\n */\n get tabCloseRequested(): ISignal> {\n return this._tabCloseRequested;\n }\n\n /**\n * A signal emitted when a tab is dragged beyond the detach threshold.\n *\n * #### Notes\n * This signal is emitted when the user drags a tab with the mouse,\n * and mouse is dragged beyond the detach threshold.\n *\n * The consumer of the signal should call `releaseMouse` and remove\n * the tab in order to complete the detach.\n *\n * This signal is only emitted once per drag cycle.\n */\n get tabDetachRequested(): ISignal> {\n return this._tabDetachRequested;\n }\n\n /**\n * The renderer used by the tab bar.\n */\n readonly renderer: TabBar.IRenderer;\n\n /**\n * The document to use with the tab bar.\n *\n * The default is the global `document` instance.\n */\n get document(): Document | ShadowRoot {\n return this._document;\n }\n\n /**\n * Whether the tabs are movable by the user.\n *\n * #### Notes\n * Tabs can always be moved programmatically.\n */\n tabsMovable: boolean;\n\n /**\n * Whether the titles can be user-edited.\n *\n */\n get titlesEditable(): boolean {\n return this._titlesEditable;\n }\n\n /**\n * Set whether titles can be user edited.\n *\n */\n set titlesEditable(value: boolean) {\n this._titlesEditable = value;\n }\n\n /**\n * Whether a tab can be deselected by the user.\n *\n * #### Notes\n * Tabs can be always be deselected programmatically.\n */\n allowDeselect: boolean;\n\n /**\n * The selection behavior when inserting a tab.\n */\n insertBehavior: TabBar.InsertBehavior;\n\n /**\n * The selection behavior when removing a tab.\n */\n removeBehavior: TabBar.RemoveBehavior;\n\n /**\n * Get the currently selected title.\n *\n * #### Notes\n * This will be `null` if no tab is selected.\n */\n get currentTitle(): Title | null {\n return this._titles[this._currentIndex] || null;\n }\n\n /**\n * Set the currently selected title.\n *\n * #### Notes\n * If the title does not exist, the title will be set to `null`.\n */\n set currentTitle(value: Title | null) {\n this.currentIndex = value ? this._titles.indexOf(value) : -1;\n }\n\n /**\n * Get the index of the currently selected tab.\n *\n * #### Notes\n * This will be `-1` if no tab is selected.\n */\n get currentIndex(): number {\n return this._currentIndex;\n }\n\n /**\n * Set the index of the currently selected tab.\n *\n * #### Notes\n * If the value is out of range, the index will be set to `-1`.\n */\n set currentIndex(value: number) {\n // Adjust for an out of range index.\n if (value < 0 || value >= this._titles.length) {\n value = -1;\n }\n\n // Bail early if the index will not change.\n if (this._currentIndex === value) {\n return;\n }\n\n // Look up the previous index and title.\n let pi = this._currentIndex;\n let pt = this._titles[pi] || null;\n\n // Look up the current index and title.\n let ci = value;\n let ct = this._titles[ci] || null;\n\n // Update the current index and previous title.\n this._currentIndex = ci;\n this._previousTitle = pt;\n\n // Schedule an update of the tabs.\n this.update();\n\n // Emit the current changed signal.\n this._currentChanged.emit({\n previousIndex: pi,\n previousTitle: pt,\n currentIndex: ci,\n currentTitle: ct\n });\n }\n\n /**\n * Get the name of the tab bar.\n */\n get name(): string {\n return this._name;\n }\n\n /**\n * Set the name of the tab bar.\n */\n set name(value: string) {\n this._name = value;\n if (value) {\n this.contentNode.setAttribute('aria-label', value);\n } else {\n this.contentNode.removeAttribute('aria-label');\n }\n }\n\n /**\n * Get the orientation of the tab bar.\n *\n * #### Notes\n * This controls whether the tabs are arranged in a row or column.\n */\n get orientation(): TabBar.Orientation {\n return this._orientation;\n }\n\n /**\n * Set the orientation of the tab bar.\n *\n * #### Notes\n * This controls whether the tabs are arranged in a row or column.\n */\n set orientation(value: TabBar.Orientation) {\n // Do nothing if the orientation does not change.\n if (this._orientation === value) {\n return;\n }\n\n // Release the mouse before making any changes.\n this._releaseMouse();\n\n // Toggle the orientation values.\n this._orientation = value;\n this.dataset['orientation'] = value;\n this.contentNode.setAttribute('aria-orientation', value);\n }\n\n /**\n * Whether the add button is enabled.\n */\n get addButtonEnabled(): boolean {\n return this._addButtonEnabled;\n }\n\n /**\n * Set whether the add button is enabled.\n */\n set addButtonEnabled(value: boolean) {\n // Do nothing if the value does not change.\n if (this._addButtonEnabled === value) {\n return;\n }\n\n this._addButtonEnabled = value;\n if (value) {\n this.addButtonNode.classList.remove('lm-mod-hidden');\n } else {\n this.addButtonNode.classList.add('lm-mod-hidden');\n }\n }\n\n /**\n * A read-only array of the titles in the tab bar.\n */\n get titles(): ReadonlyArray> {\n return this._titles;\n }\n\n /**\n * The tab bar content node.\n *\n * #### Notes\n * This is the node which holds the tab nodes.\n *\n * Modifying this node directly can lead to undefined behavior.\n */\n get contentNode(): HTMLUListElement {\n return this.node.getElementsByClassName(\n 'lm-TabBar-content'\n )[0] as HTMLUListElement;\n }\n\n /**\n * The tab bar add button node.\n *\n * #### Notes\n * This is the node which holds the add button.\n *\n * Modifying this node directly can lead to undefined behavior.\n */\n get addButtonNode(): HTMLDivElement {\n return this.node.getElementsByClassName(\n 'lm-TabBar-addButton'\n )[0] as HTMLDivElement;\n }\n\n /**\n * Add a tab to the end of the tab bar.\n *\n * @param value - The title which holds the data for the tab,\n * or an options object to convert to a title.\n *\n * @returns The title object added to the tab bar.\n *\n * #### Notes\n * If the title is already added to the tab bar, it will be moved.\n */\n addTab(value: Title | Title.IOptions): Title {\n return this.insertTab(this._titles.length, value);\n }\n\n /**\n * Insert a tab into the tab bar at the specified index.\n *\n * @param index - The index at which to insert the tab.\n *\n * @param value - The title which holds the data for the tab,\n * or an options object to convert to a title.\n *\n * @returns The title object added to the tab bar.\n *\n * #### Notes\n * The index will be clamped to the bounds of the tabs.\n *\n * If the title is already added to the tab bar, it will be moved.\n */\n insertTab(index: number, value: Title | Title.IOptions): Title {\n // Release the mouse before making any changes.\n this._releaseMouse();\n\n // Coerce the value to a title.\n let title = Private.asTitle(value);\n\n // Look up the index of the title.\n let i = this._titles.indexOf(title);\n\n // Clamp the insert index to the array bounds.\n let j = Math.max(0, Math.min(index, this._titles.length));\n\n // If the title is not in the array, insert it.\n if (i === -1) {\n // Insert the title into the array.\n ArrayExt.insert(this._titles, j, title);\n\n // Connect to the title changed signal.\n title.changed.connect(this._onTitleChanged, this);\n\n // Schedule an update of the tabs.\n this.update();\n\n // Adjust the current index for the insert.\n this._adjustCurrentForInsert(j, title);\n\n // Return the title added to the tab bar.\n return title;\n }\n\n // Otherwise, the title exists in the array and should be moved.\n\n // Adjust the index if the location is at the end of the array.\n if (j === this._titles.length) {\n j--;\n }\n\n // Bail if there is no effective move.\n if (i === j) {\n return title;\n }\n\n // Move the title to the new location.\n ArrayExt.move(this._titles, i, j);\n\n // Schedule an update of the tabs.\n this.update();\n\n // Adjust the current index for the move.\n this._adjustCurrentForMove(i, j);\n\n // Return the title added to the tab bar.\n return title;\n }\n\n /**\n * Remove a tab from the tab bar.\n *\n * @param title - The title for the tab to remove.\n *\n * #### Notes\n * This is a no-op if the title is not in the tab bar.\n */\n removeTab(title: Title): void {\n this.removeTabAt(this._titles.indexOf(title));\n }\n\n /**\n * Remove the tab at a given index from the tab bar.\n *\n * @param index - The index of the tab to remove.\n *\n * #### Notes\n * This is a no-op if the index is out of range.\n */\n removeTabAt(index: number): void {\n // Release the mouse before making any changes.\n this._releaseMouse();\n\n // Remove the title from the array.\n let title = ArrayExt.removeAt(this._titles, index);\n\n // Bail if the index is out of range.\n if (!title) {\n return;\n }\n\n // Disconnect from the title changed signal.\n title.changed.disconnect(this._onTitleChanged, this);\n\n // Clear the previous title if it's being removed.\n if (title === this._previousTitle) {\n this._previousTitle = null;\n }\n\n // Schedule an update of the tabs.\n this.update();\n\n // Adjust the current index for the remove.\n this._adjustCurrentForRemove(index, title);\n }\n\n /**\n * Remove all tabs from the tab bar.\n */\n clearTabs(): void {\n // Bail if there is nothing to remove.\n if (this._titles.length === 0) {\n return;\n }\n\n // Release the mouse before making any changes.\n this._releaseMouse();\n\n // Disconnect from the title changed signals.\n for (let title of this._titles) {\n title.changed.disconnect(this._onTitleChanged, this);\n }\n\n // Get the current index and title.\n let pi = this.currentIndex;\n let pt = this.currentTitle;\n\n // Reset the current index and previous title.\n this._currentIndex = -1;\n this._previousTitle = null;\n\n // Clear the title array.\n this._titles.length = 0;\n\n // Schedule an update of the tabs.\n this.update();\n\n // If no tab was selected, there's nothing else to do.\n if (pi === -1) {\n return;\n }\n\n // Emit the current changed signal.\n this._currentChanged.emit({\n previousIndex: pi,\n previousTitle: pt,\n currentIndex: -1,\n currentTitle: null\n });\n }\n\n /**\n * Release the mouse and restore the non-dragged tab positions.\n *\n * #### Notes\n * This will cause the tab bar to stop handling mouse events and to\n * restore the tabs to their non-dragged positions.\n */\n releaseMouse(): void {\n this._releaseMouse();\n }\n\n /**\n * Handle the DOM events for the tab bar.\n *\n * @param event - The DOM event sent to the tab bar.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the tab bar's DOM node.\n *\n * This should not be called directly by user code.\n */\n handleEvent(event: Event): void {\n switch (event.type) {\n case 'pointerdown':\n this._evtPointerDown(event as PointerEvent);\n break;\n case 'pointermove':\n this._evtPointerMove(event as PointerEvent);\n break;\n case 'pointerup':\n this._evtPointerUp(event as PointerEvent);\n break;\n case 'dblclick':\n this._evtDblClick(event as MouseEvent);\n break;\n case 'keydown':\n event.eventPhase === Event.CAPTURING_PHASE\n ? this._evtKeyDownCapturing(event as KeyboardEvent)\n : this._evtKeyDown(event as KeyboardEvent);\n break;\n case 'contextmenu':\n event.preventDefault();\n event.stopPropagation();\n break;\n }\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n this.node.addEventListener('pointerdown', this);\n this.node.addEventListener('dblclick', this);\n this.node.addEventListener('keydown', this);\n }\n\n /**\n * A message handler invoked on an `'after-detach'` message.\n */\n protected onAfterDetach(msg: Message): void {\n this.node.removeEventListener('pointerdown', this);\n this.node.removeEventListener('dblclick', this);\n this.node.removeEventListener('keydown', this);\n this._releaseMouse();\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n protected onUpdateRequest(msg: Message): void {\n let titles = this._titles;\n let renderer = this.renderer;\n let currentTitle = this.currentTitle;\n let content = new Array(titles.length);\n // Keep the tabindex=\"0\" attribute to the tab which handled it before the update.\n // If the add button handles it, no need to do anything. If no element of the tab\n // bar handles it, set it on the current or the first tab to ensure one element\n // handles it after update.\n const tabHandlingTabindex =\n this._getCurrentTabindex() ??\n (this._currentIndex > -1 ? this._currentIndex : 0);\n\n for (let i = 0, n = titles.length; i < n; ++i) {\n let title = titles[i];\n let current = title === currentTitle;\n let zIndex = current ? n : n - i - 1;\n let tabIndex = tabHandlingTabindex === i ? 0 : -1;\n content[i] = renderer.renderTab({ title, current, zIndex, tabIndex });\n }\n VirtualDOM.render(content, this.contentNode);\n }\n\n /**\n * Get the index of the tab which handles tabindex=\"0\".\n * If the add button handles tabindex=\"0\", -1 is returned.\n * If none of the previous handles tabindex=\"0\", null is returned.\n */\n private _getCurrentTabindex(): number | null {\n let index = null;\n const elemTabindex = this.contentNode.querySelector('li[tabindex=\"0\"]');\n if (elemTabindex) {\n index = [...this.contentNode.children].indexOf(elemTabindex);\n } else if (\n this._addButtonEnabled &&\n this.addButtonNode.getAttribute('tabindex') === '0'\n ) {\n index = -1;\n }\n return index;\n }\n\n /**\n * Handle the `'dblclick'` event for the tab bar.\n */\n private _evtDblClick(event: MouseEvent): void {\n // Do nothing if titles are not editable\n if (!this.titlesEditable) {\n return;\n }\n\n let tabs = this.contentNode.children;\n\n // Find the index of the targeted tab.\n let index = ArrayExt.findFirstIndex(tabs, tab => {\n return ElementExt.hitTest(tab, event.clientX, event.clientY);\n });\n\n // Do nothing if the press is not on a tab.\n if (index === -1) {\n return;\n }\n\n let title = this.titles[index];\n let label = tabs[index].querySelector('.lm-TabBar-tabLabel') as HTMLElement;\n if (label && label.contains(event.target as HTMLElement)) {\n let value = title.label || '';\n\n // Clear the label element\n let oldValue = label.innerHTML;\n label.innerHTML = '';\n\n let input = document.createElement('input');\n input.classList.add('lm-TabBar-tabInput');\n input.value = value;\n label.appendChild(input);\n\n let onblur = () => {\n input.removeEventListener('blur', onblur);\n label.innerHTML = oldValue;\n this.node.addEventListener('keydown', this);\n };\n\n input.addEventListener('dblclick', (event: Event) =>\n event.stopPropagation()\n );\n input.addEventListener('blur', onblur);\n input.addEventListener('keydown', (event: KeyboardEvent) => {\n if (event.key === 'Enter') {\n if (input.value !== '') {\n title.label = title.caption = input.value;\n }\n onblur();\n } else if (event.key === 'Escape') {\n onblur();\n }\n });\n this.node.removeEventListener('keydown', this);\n input.select();\n input.focus();\n\n if (label.children.length > 0) {\n (label.children[0] as HTMLElement).focus();\n }\n }\n }\n\n /**\n * Handle the `'keydown'` event for the tab bar at capturing phase.\n */\n private _evtKeyDownCapturing(event: KeyboardEvent): void {\n if (event.eventPhase !== Event.CAPTURING_PHASE) {\n return;\n }\n\n // Stop all input events during drag.\n event.preventDefault();\n event.stopPropagation();\n\n // Release the mouse if `Escape` is pressed.\n if (event.key === 'Escape') {\n this._releaseMouse();\n }\n }\n\n /**\n * Handle the `'keydown'` event for the tab bar at target phase.\n */\n private _evtKeyDown(event: KeyboardEvent): void {\n // Allow for navigation using tab key\n if (event.key === 'Tab' || event.eventPhase === Event.CAPTURING_PHASE) {\n return;\n }\n\n // Check if Enter or Spacebar key has been pressed and open that tab\n if (\n event.key === 'Enter' ||\n event.key === 'Spacebar' ||\n event.key === ' '\n ) {\n // Get focus element that is in focus by the tab key\n const focusedElement = document.activeElement;\n\n // Test first if the focus is on the add button node\n if (\n this.addButtonEnabled &&\n this.addButtonNode.contains(focusedElement)\n ) {\n event.preventDefault();\n event.stopPropagation();\n this._addRequested.emit();\n } else {\n const index = ArrayExt.findFirstIndex(this.contentNode.children, tab =>\n tab.contains(focusedElement)\n );\n if (index >= 0) {\n event.preventDefault();\n event.stopPropagation();\n this.currentIndex = index;\n }\n }\n // Handle the arrow keys to switch tabs.\n } else if (ARROW_KEYS.includes(event.key)) {\n // Create a list of all focusable elements in the tab bar.\n const focusable: Element[] = [...this.contentNode.children];\n if (this.addButtonEnabled) {\n focusable.push(this.addButtonNode);\n }\n // If the tab bar contains only one element, nothing to do.\n if (focusable.length <= 1) {\n return;\n }\n event.preventDefault();\n event.stopPropagation();\n\n // Get the current focused element.\n let focusedIndex = focusable.indexOf(document.activeElement as Element);\n if (focusedIndex === -1) {\n focusedIndex = this._currentIndex;\n }\n\n // Find the next element to focus on.\n let nextFocused: Element | null | undefined;\n if (\n (event.key === 'ArrowRight' && this._orientation === 'horizontal') ||\n (event.key === 'ArrowDown' && this._orientation === 'vertical')\n ) {\n nextFocused = focusable[focusedIndex + 1] ?? focusable[0];\n } else if (\n (event.key === 'ArrowLeft' && this._orientation === 'horizontal') ||\n (event.key === 'ArrowUp' && this._orientation === 'vertical')\n ) {\n nextFocused =\n focusable[focusedIndex - 1] ?? focusable[focusable.length - 1];\n } else if (event.key === 'Home') {\n nextFocused = focusable[0];\n } else if (event.key === 'End') {\n nextFocused = focusable[focusable.length - 1];\n }\n\n // Change the focused element and the tabindex value.\n if (nextFocused) {\n focusable[focusedIndex]?.setAttribute('tabindex', '-1');\n nextFocused?.setAttribute('tabindex', '0');\n (nextFocused as HTMLElement).focus();\n }\n }\n }\n\n /**\n * Handle the `'pointerdown'` event for the tab bar.\n */\n private _evtPointerDown(event: PointerEvent | MouseEvent): void {\n // Do nothing if it's not a left or middle mouse press.\n if (event.button !== 0 && event.button !== 1) {\n return;\n }\n\n // Do nothing if a drag is in progress.\n if (this._dragData) {\n return;\n }\n\n // Do nothing if a title editable input was clicked.\n if (\n (event.target as HTMLElement).classList.contains('lm-TabBar-tabInput')\n ) {\n return;\n }\n\n // Check if the add button was clicked.\n let addButtonClicked =\n this.addButtonEnabled &&\n this.addButtonNode.contains(event.target as HTMLElement);\n\n // Lookup the tab nodes.\n let tabs = this.contentNode.children;\n\n // Find the index of the pressed tab.\n let index = ArrayExt.findFirstIndex(tabs, tab => {\n return ElementExt.hitTest(tab, event.clientX, event.clientY);\n });\n\n // Do nothing if the press is not on a tab or the add button.\n if (index === -1 && !addButtonClicked) {\n return;\n }\n\n // Pressing on a tab stops the event propagation.\n event.preventDefault();\n event.stopPropagation();\n\n // Initialize the non-measured parts of the drag data.\n this._dragData = {\n tab: tabs[index] as HTMLElement,\n index: index,\n pressX: event.clientX,\n pressY: event.clientY,\n tabPos: -1,\n tabSize: -1,\n tabPressPos: -1,\n targetIndex: -1,\n tabLayout: null,\n contentRect: null,\n override: null,\n dragActive: false,\n dragAborted: false,\n detachRequested: false\n };\n\n // Add the document pointer up listener.\n this.document.addEventListener('pointerup', this, true);\n\n // Do nothing else if the middle button or add button is clicked.\n if (event.button === 1 || addButtonClicked) {\n return;\n }\n\n // Do nothing else if the close icon is clicked.\n let icon = tabs[index].querySelector(this.renderer.closeIconSelector);\n if (icon && icon.contains(event.target as HTMLElement)) {\n return;\n }\n\n // Add the extra listeners if the tabs are movable.\n if (this.tabsMovable) {\n this.document.addEventListener('pointermove', this, true);\n this.document.addEventListener('keydown', this, true);\n this.document.addEventListener('contextmenu', this, true);\n }\n\n // Update the current index as appropriate.\n if (this.allowDeselect && this.currentIndex === index) {\n this.currentIndex = -1;\n } else {\n this.currentIndex = index;\n }\n\n // Do nothing else if there is no current tab.\n if (this.currentIndex === -1) {\n return;\n }\n\n // Emit the tab activate request signal.\n this._tabActivateRequested.emit({\n index: this.currentIndex,\n title: this.currentTitle!\n });\n }\n\n /**\n * Handle the `'pointermove'` event for the tab bar.\n */\n private _evtPointerMove(event: PointerEvent | MouseEvent): void {\n // Do nothing if no drag is in progress.\n let data = this._dragData;\n if (!data) {\n return;\n }\n\n // Suppress the event during a drag.\n event.preventDefault();\n event.stopPropagation();\n\n // Lookup the tab nodes.\n let tabs = this.contentNode.children;\n\n // Bail early if the drag threshold has not been met.\n if (!data.dragActive && !Private.dragExceeded(data, event)) {\n return;\n }\n\n // Activate the drag if necessary.\n if (!data.dragActive) {\n // Fill in the rest of the drag data measurements.\n let tabRect = data.tab.getBoundingClientRect();\n if (this._orientation === 'horizontal') {\n data.tabPos = data.tab.offsetLeft;\n data.tabSize = tabRect.width;\n data.tabPressPos = data.pressX - tabRect.left;\n } else {\n data.tabPos = data.tab.offsetTop;\n data.tabSize = tabRect.height;\n data.tabPressPos = data.pressY - tabRect.top;\n }\n data.tabPressOffset = {\n x: data.pressX - tabRect.left,\n y: data.pressY - tabRect.top\n };\n data.tabLayout = Private.snapTabLayout(tabs, this._orientation);\n data.contentRect = this.contentNode.getBoundingClientRect();\n data.override = Drag.overrideCursor('default');\n\n // Add the dragging style classes.\n data.tab.classList.add('lm-mod-dragging');\n this.addClass('lm-mod-dragging');\n\n // Mark the drag as active.\n data.dragActive = true;\n }\n\n // Emit the detach requested signal if the threshold is exceeded.\n if (!data.detachRequested && Private.detachExceeded(data, event)) {\n // Only emit the signal once per drag cycle.\n data.detachRequested = true;\n\n // Setup the arguments for the signal.\n let index = data.index;\n let clientX = event.clientX;\n let clientY = event.clientY;\n let tab = tabs[index] as HTMLElement;\n let title = this._titles[index];\n\n // Emit the tab detach requested signal.\n this._tabDetachRequested.emit({\n index,\n title,\n tab,\n clientX,\n clientY,\n offset: data.tabPressOffset\n });\n\n // Bail if the signal handler aborted the drag.\n if (data.dragAborted) {\n return;\n }\n }\n\n // Update the positions of the tabs.\n Private.layoutTabs(tabs, data, event, this._orientation);\n }\n\n /**\n * Handle the `'pointerup'` event for the document.\n */\n private _evtPointerUp(event: PointerEvent | MouseEvent): void {\n // Do nothing if it's not a left or middle mouse release.\n if (event.button !== 0 && event.button !== 1) {\n return;\n }\n\n // Do nothing if no drag is in progress.\n const data = this._dragData;\n if (!data) {\n return;\n }\n\n // Stop the event propagation.\n event.preventDefault();\n event.stopPropagation();\n\n // Remove the extra mouse event listeners.\n this.document.removeEventListener('pointermove', this, true);\n this.document.removeEventListener('pointerup', this, true);\n this.document.removeEventListener('keydown', this, true);\n this.document.removeEventListener('contextmenu', this, true);\n\n // Handle a release when the drag is not active.\n if (!data.dragActive) {\n // Clear the drag data.\n this._dragData = null;\n\n // Handle clicking the add button.\n let addButtonClicked =\n this.addButtonEnabled &&\n this.addButtonNode.contains(event.target as HTMLElement);\n if (addButtonClicked) {\n this._addRequested.emit(undefined);\n return;\n }\n\n // Lookup the tab nodes.\n let tabs = this.contentNode.children;\n\n // Find the index of the released tab.\n let index = ArrayExt.findFirstIndex(tabs, tab => {\n return ElementExt.hitTest(tab, event.clientX, event.clientY);\n });\n\n // Do nothing if the release is not on the original pressed tab.\n if (index !== data.index) {\n return;\n }\n\n // Ignore the release if the title is not closable.\n let title = this._titles[index];\n if (!title.closable) {\n return;\n }\n\n // Emit the close requested signal if the middle button is released.\n if (event.button === 1) {\n this._tabCloseRequested.emit({ index, title });\n return;\n }\n\n // Emit the close requested signal if the close icon was released.\n let icon = tabs[index].querySelector(this.renderer.closeIconSelector);\n if (icon && icon.contains(event.target as HTMLElement)) {\n this._tabCloseRequested.emit({ index, title });\n return;\n }\n\n // Otherwise, there is nothing left to do.\n return;\n }\n\n // Do nothing if the left button is not released.\n if (event.button !== 0) {\n return;\n }\n\n // Position the tab at its final resting position.\n Private.finalizeTabPosition(data, this._orientation);\n\n // Remove the dragging class from the tab so it can be transitioned.\n data.tab.classList.remove('lm-mod-dragging');\n\n // Parse the transition duration for releasing the tab.\n let duration = Private.parseTransitionDuration(data.tab);\n\n // Complete the release on a timer to allow the tab to transition.\n setTimeout(() => {\n // Do nothing if the drag has been aborted.\n if (data.dragAborted) {\n return;\n }\n\n // Clear the drag data reference.\n this._dragData = null;\n\n // Reset the positions of the tabs.\n Private.resetTabPositions(this.contentNode.children, this._orientation);\n\n // Clear the cursor grab.\n data.override!.dispose();\n\n // Remove the remaining dragging style.\n this.removeClass('lm-mod-dragging');\n\n // If the tab was not moved, there is nothing else to do.\n let i = data.index;\n let j = data.targetIndex;\n if (j === -1 || i === j) {\n return;\n }\n\n // Move the title to the new locations.\n ArrayExt.move(this._titles, i, j);\n\n // Adjust the current index for the move.\n this._adjustCurrentForMove(i, j);\n\n // Emit the tab moved signal.\n this._tabMoved.emit({\n fromIndex: i,\n toIndex: j,\n title: this._titles[j]\n });\n\n // Update the tabs immediately to prevent flicker.\n MessageLoop.sendMessage(this, Widget.Msg.UpdateRequest);\n }, duration);\n }\n\n /**\n * Release the mouse and restore the non-dragged tab positions.\n */\n private _releaseMouse(): void {\n // Do nothing if no drag is in progress.\n let data = this._dragData;\n if (!data) {\n return;\n }\n\n // Clear the drag data reference.\n this._dragData = null;\n\n // Remove the extra document event listeners.\n this.document.removeEventListener('pointermove', this, true);\n this.document.removeEventListener('pointerup', this, true);\n this.document.removeEventListener('keydown', this, true);\n this.document.removeEventListener('contextmenu', this, true);\n\n // Indicate the drag has been aborted. This allows the mouse\n // event handlers to return early when the drag is canceled.\n data.dragAborted = true;\n\n // If the drag is not active, there's nothing more to do.\n if (!data.dragActive) {\n return;\n }\n\n // Reset the tabs to their non-dragged positions.\n Private.resetTabPositions(this.contentNode.children, this._orientation);\n\n // Clear the cursor override.\n data.override!.dispose();\n\n // Clear the dragging style classes.\n data.tab.classList.remove('lm-mod-dragging');\n this.removeClass('lm-mod-dragging');\n }\n\n /**\n * Adjust the current index for a tab insert operation.\n *\n * This method accounts for the tab bar's insertion behavior when\n * adjusting the current index and emitting the changed signal.\n */\n private _adjustCurrentForInsert(i: number, title: Title): void {\n // Lookup commonly used variables.\n let ct = this.currentTitle;\n let ci = this._currentIndex;\n let bh = this.insertBehavior;\n\n // TODO: do we need to do an update to update the aria-selected attribute?\n\n // Handle the behavior where the new tab is always selected,\n // or the behavior where the new tab is selected if needed.\n if (bh === 'select-tab' || (bh === 'select-tab-if-needed' && ci === -1)) {\n this._currentIndex = i;\n this._previousTitle = ct;\n this._currentChanged.emit({\n previousIndex: ci,\n previousTitle: ct,\n currentIndex: i,\n currentTitle: title\n });\n return;\n }\n\n // Otherwise, silently adjust the current index if needed.\n if (ci >= i) {\n this._currentIndex++;\n }\n }\n\n /**\n * Adjust the current index for a tab move operation.\n *\n * This method will not cause the actual current tab to change.\n * It silently adjusts the index to account for the given move.\n */\n private _adjustCurrentForMove(i: number, j: number): void {\n if (this._currentIndex === i) {\n this._currentIndex = j;\n } else if (this._currentIndex < i && this._currentIndex >= j) {\n this._currentIndex++;\n } else if (this._currentIndex > i && this._currentIndex <= j) {\n this._currentIndex--;\n }\n }\n\n /**\n * Adjust the current index for a tab remove operation.\n *\n * This method accounts for the tab bar's remove behavior when\n * adjusting the current index and emitting the changed signal.\n */\n private _adjustCurrentForRemove(i: number, title: Title): void {\n // Lookup commonly used variables.\n let ci = this._currentIndex;\n let bh = this.removeBehavior;\n\n // Silently adjust the index if the current tab is not removed.\n if (ci !== i) {\n if (ci > i) {\n this._currentIndex--;\n }\n return;\n }\n\n // TODO: do we need to do an update to adjust the aria-selected value?\n\n // No tab gets selected if the tab bar is empty.\n if (this._titles.length === 0) {\n this._currentIndex = -1;\n this._currentChanged.emit({\n previousIndex: i,\n previousTitle: title,\n currentIndex: -1,\n currentTitle: null\n });\n return;\n }\n\n // Handle behavior where the next sibling tab is selected.\n if (bh === 'select-tab-after') {\n this._currentIndex = Math.min(i, this._titles.length - 1);\n this._currentChanged.emit({\n previousIndex: i,\n previousTitle: title,\n currentIndex: this._currentIndex,\n currentTitle: this.currentTitle\n });\n return;\n }\n\n // Handle behavior where the previous sibling tab is selected.\n if (bh === 'select-tab-before') {\n this._currentIndex = Math.max(0, i - 1);\n this._currentChanged.emit({\n previousIndex: i,\n previousTitle: title,\n currentIndex: this._currentIndex,\n currentTitle: this.currentTitle\n });\n return;\n }\n\n // Handle behavior where the previous history tab is selected.\n if (bh === 'select-previous-tab') {\n if (this._previousTitle) {\n this._currentIndex = this._titles.indexOf(this._previousTitle);\n this._previousTitle = null;\n } else {\n this._currentIndex = Math.min(i, this._titles.length - 1);\n }\n this._currentChanged.emit({\n previousIndex: i,\n previousTitle: title,\n currentIndex: this._currentIndex,\n currentTitle: this.currentTitle\n });\n return;\n }\n\n // Otherwise, no tab gets selected.\n this._currentIndex = -1;\n this._currentChanged.emit({\n previousIndex: i,\n previousTitle: title,\n currentIndex: -1,\n currentTitle: null\n });\n }\n\n /**\n * Handle the `changed` signal of a title object.\n */\n private _onTitleChanged(sender: Title): void {\n this.update();\n }\n\n private _name: string;\n private _currentIndex = -1;\n private _titles: Title[] = [];\n private _orientation: TabBar.Orientation;\n private _document: Document | ShadowRoot;\n private _titlesEditable: boolean = false;\n private _previousTitle: Title | null = null;\n private _dragData: Private.IDragData | null = null;\n private _addButtonEnabled: boolean = false;\n private _tabMoved = new Signal>(this);\n private _currentChanged = new Signal>(\n this\n );\n private _addRequested = new Signal(this);\n private _tabCloseRequested = new Signal<\n this,\n TabBar.ITabCloseRequestedArgs\n >(this);\n private _tabDetachRequested = new Signal<\n this,\n TabBar.ITabDetachRequestedArgs\n >(this);\n private _tabActivateRequested = new Signal<\n this,\n TabBar.ITabActivateRequestedArgs\n >(this);\n}\n\n/**\n * The namespace for the `TabBar` class statics.\n */\nexport namespace TabBar {\n /**\n * A type alias for a tab bar orientation.\n */\n export type Orientation =\n | /**\n * The tabs are arranged in a single row, left-to-right.\n *\n * The tab text orientation is horizontal.\n */\n 'horizontal'\n\n /**\n * The tabs are arranged in a single column, top-to-bottom.\n *\n * The tab text orientation is horizontal.\n */\n | 'vertical';\n\n /**\n * A type alias for the selection behavior on tab insert.\n */\n export type InsertBehavior =\n | /**\n * The selected tab will not be changed.\n */\n 'none'\n\n /**\n * The inserted tab will be selected.\n */\n | 'select-tab'\n\n /**\n * The inserted tab will be selected if the current tab is null.\n */\n | 'select-tab-if-needed';\n\n /**\n * A type alias for the selection behavior on tab remove.\n */\n export type RemoveBehavior =\n | /**\n * No tab will be selected.\n */\n 'none'\n\n /**\n * The tab after the removed tab will be selected if possible.\n */\n | 'select-tab-after'\n\n /**\n * The tab before the removed tab will be selected if possible.\n */\n | 'select-tab-before'\n\n /**\n * The previously selected tab will be selected if possible.\n */\n | 'select-previous-tab';\n\n /**\n * An options object for creating a tab bar.\n */\n export interface IOptions {\n /**\n * The document to use with the tab bar.\n *\n * The default is the global `document` instance.\n */\n\n document?: Document | ShadowRoot;\n\n /**\n * Name of the tab bar.\n *\n * This is used for accessibility reasons. The default is the empty string.\n */\n name?: string;\n\n /**\n * The layout orientation of the tab bar.\n *\n * The default is `horizontal`.\n */\n orientation?: TabBar.Orientation;\n\n /**\n * Whether the tabs are movable by the user.\n *\n * The default is `false`.\n */\n tabsMovable?: boolean;\n\n /**\n * Whether a tab can be deselected by the user.\n *\n * The default is `false`.\n */\n allowDeselect?: boolean;\n\n /**\n * Whether the titles can be directly edited by the user.\n *\n * The default is `false`.\n */\n titlesEditable?: boolean;\n\n /**\n * Whether the add button is enabled.\n *\n * The default is `false`.\n */\n addButtonEnabled?: boolean;\n\n /**\n * The selection behavior when inserting a tab.\n *\n * The default is `'select-tab-if-needed'`.\n */\n insertBehavior?: TabBar.InsertBehavior;\n\n /**\n * The selection behavior when removing a tab.\n *\n * The default is `'select-tab-after'`.\n */\n removeBehavior?: TabBar.RemoveBehavior;\n\n /**\n * A renderer to use with the tab bar.\n *\n * The default is a shared renderer instance.\n */\n renderer?: IRenderer;\n }\n\n /**\n * The arguments object for the `currentChanged` signal.\n */\n export interface ICurrentChangedArgs {\n /**\n * The previously selected index.\n */\n readonly previousIndex: number;\n\n /**\n * The previously selected title.\n */\n readonly previousTitle: Title | null;\n\n /**\n * The currently selected index.\n */\n readonly currentIndex: number;\n\n /**\n * The currently selected title.\n */\n readonly currentTitle: Title | null;\n }\n\n /**\n * The arguments object for the `tabMoved` signal.\n */\n export interface ITabMovedArgs {\n /**\n * The previous index of the tab.\n */\n readonly fromIndex: number;\n\n /**\n * The current index of the tab.\n */\n readonly toIndex: number;\n\n /**\n * The title for the tab.\n */\n readonly title: Title;\n }\n\n /**\n * The arguments object for the `tabActivateRequested` signal.\n */\n export interface ITabActivateRequestedArgs {\n /**\n * The index of the tab to activate.\n */\n readonly index: number;\n\n /**\n * The title for the tab.\n */\n readonly title: Title;\n }\n\n /**\n * The arguments object for the `tabCloseRequested` signal.\n */\n export interface ITabCloseRequestedArgs {\n /**\n * The index of the tab to close.\n */\n readonly index: number;\n\n /**\n * The title for the tab.\n */\n readonly title: Title;\n }\n\n /**\n * The arguments object for the `tabDetachRequested` signal.\n */\n export interface ITabDetachRequestedArgs {\n /**\n * The index of the tab to detach.\n */\n readonly index: number;\n\n /**\n * The title for the tab.\n */\n readonly title: Title;\n\n /**\n * The node representing the tab.\n */\n readonly tab: HTMLElement;\n\n /**\n * The current client X position of the mouse.\n */\n readonly clientX: number;\n\n /**\n * The current client Y position of the mouse.\n */\n readonly clientY: number;\n\n /**\n * The mouse position in the tab coordinate.\n */\n readonly offset?: { x: number; y: number };\n }\n\n /**\n * An object which holds the data to render a tab.\n */\n export interface IRenderData {\n /**\n * The title associated with the tab.\n */\n readonly title: Title;\n\n /**\n * Whether the tab is the current tab.\n */\n readonly current: boolean;\n\n /**\n * The z-index for the tab.\n */\n readonly zIndex: number;\n\n /**\n * The tabindex value for the tab.\n */\n readonly tabIndex?: number;\n }\n\n /**\n * A renderer for use with a tab bar.\n */\n export interface IRenderer {\n /**\n * A selector which matches the close icon node in a tab.\n */\n readonly closeIconSelector: string;\n\n /**\n * Render the virtual element for a tab.\n *\n * @param data - The data to use for rendering the tab.\n *\n * @returns A virtual element representing the tab.\n */\n renderTab(data: IRenderData): VirtualElement;\n }\n\n /**\n * The default implementation of `IRenderer`.\n *\n * #### Notes\n * Subclasses are free to reimplement rendering methods as needed.\n */\n export class Renderer implements IRenderer {\n constructor() {\n this._uuid = ++Renderer._nInstance;\n }\n /**\n * A selector which matches the close icon node in a tab.\n */\n readonly closeIconSelector = '.lm-TabBar-tabCloseIcon';\n\n /**\n * Render the virtual element for a tab.\n *\n * @param data - The data to use for rendering the tab.\n *\n * @returns A virtual element representing the tab.\n */\n renderTab(data: IRenderData): VirtualElement {\n let title = data.title.caption;\n let key = this.createTabKey(data);\n let id = key;\n let style = this.createTabStyle(data);\n let className = this.createTabClass(data);\n let dataset = this.createTabDataset(data);\n let aria = this.createTabARIA(data);\n if (data.title.closable) {\n return h.li(\n { id, key, className, title, style, dataset, ...aria },\n this.renderIcon(data),\n this.renderLabel(data),\n this.renderCloseIcon(data)\n );\n } else {\n return h.li(\n { id, key, className, title, style, dataset, ...aria },\n this.renderIcon(data),\n this.renderLabel(data)\n );\n }\n }\n\n /**\n * Render the icon element for a tab.\n *\n * @param data - The data to use for rendering the tab.\n *\n * @returns A virtual element representing the tab icon.\n */\n renderIcon(data: IRenderData): VirtualElement {\n const { title } = data;\n let className = this.createIconClass(data);\n\n // If title.icon is undefined, it will be ignored.\n return h.div({ className }, title.icon!, title.iconLabel);\n }\n\n /**\n * Render the label element for a tab.\n *\n * @param data - The data to use for rendering the tab.\n *\n * @returns A virtual element representing the tab label.\n */\n renderLabel(data: IRenderData): VirtualElement {\n return h.div({ className: 'lm-TabBar-tabLabel' }, data.title.label);\n }\n\n /**\n * Render the close icon element for a tab.\n *\n * @param data - The data to use for rendering the tab.\n *\n * @returns A virtual element representing the tab close icon.\n */\n renderCloseIcon(data: IRenderData): VirtualElement {\n return h.div({ className: 'lm-TabBar-tabCloseIcon' });\n }\n\n /**\n * Create a unique render key for the tab.\n *\n * @param data - The data to use for the tab.\n *\n * @returns The unique render key for the tab.\n *\n * #### Notes\n * This method caches the key against the tab title the first time\n * the key is generated. This enables efficient rendering of moved\n * tabs and avoids subtle hover style artifacts.\n */\n createTabKey(data: IRenderData): string {\n let key = this._tabKeys.get(data.title);\n if (key === undefined) {\n key = `tab-key-${this._uuid}-${this._tabID++}`;\n this._tabKeys.set(data.title, key);\n }\n return key;\n }\n\n /**\n * Create the inline style object for a tab.\n *\n * @param data - The data to use for the tab.\n *\n * @returns The inline style data for the tab.\n */\n createTabStyle(data: IRenderData): ElementInlineStyle {\n return { zIndex: `${data.zIndex}` };\n }\n\n /**\n * Create the class name for the tab.\n *\n * @param data - The data to use for the tab.\n *\n * @returns The full class name for the tab.\n */\n createTabClass(data: IRenderData): string {\n let name = 'lm-TabBar-tab';\n if (data.title.className) {\n name += ` ${data.title.className}`;\n }\n if (data.title.closable) {\n name += ' lm-mod-closable';\n }\n if (data.current) {\n name += ' lm-mod-current';\n }\n return name;\n }\n\n /**\n * Create the dataset for a tab.\n *\n * @param data - The data to use for the tab.\n *\n * @returns The dataset for the tab.\n */\n createTabDataset(data: IRenderData): ElementDataset {\n return data.title.dataset;\n }\n\n /**\n * Create the ARIA attributes for a tab.\n *\n * @param data - The data to use for the tab.\n *\n * @returns The ARIA attributes for the tab.\n */\n createTabARIA(data: IRenderData): ElementARIAAttrs | ElementBaseAttrs {\n return {\n role: 'tab',\n 'aria-selected': data.current.toString(),\n tabindex: `${data.tabIndex ?? '-1'}`\n };\n }\n\n /**\n * Create the class name for the tab icon.\n *\n * @param data - The data to use for the tab.\n *\n * @returns The full class name for the tab icon.\n */\n createIconClass(data: IRenderData): string {\n let name = 'lm-TabBar-tabIcon';\n let extra = data.title.iconClass;\n return extra ? `${name} ${extra}` : name;\n }\n\n private static _nInstance = 0;\n private readonly _uuid: number;\n private _tabID = 0;\n private _tabKeys = new WeakMap, string>();\n }\n\n /**\n * The default `Renderer` instance.\n */\n export const defaultRenderer = new Renderer();\n\n /**\n * A selector which matches the add button node in the tab bar.\n */\n export const addButtonSelector = '.lm-TabBar-addButton';\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * The start drag distance threshold.\n */\n export const DRAG_THRESHOLD = 5;\n\n /**\n * The detach distance threshold.\n */\n export const DETACH_THRESHOLD = 20;\n\n /**\n * A struct which holds the drag data for a tab bar.\n */\n export interface IDragData {\n /**\n * The tab node being dragged.\n */\n tab: HTMLElement;\n\n /**\n * The index of the tab being dragged.\n */\n index: number;\n\n /**\n * The mouse press client X position.\n */\n pressX: number;\n\n /**\n * The mouse press client Y position.\n */\n pressY: number;\n\n /**\n * The offset left/top of the tab being dragged.\n *\n * This will be `-1` if the drag is not active.\n */\n tabPos: number;\n\n /**\n * The offset width/height of the tab being dragged.\n *\n * This will be `-1` if the drag is not active.\n */\n tabSize: number;\n\n /**\n * The original mouse X/Y position in tab coordinates.\n *\n * This will be `-1` if the drag is not active.\n */\n tabPressPos: number;\n\n /**\n * The original mouse position in tab coordinates.\n *\n * This is undefined if the drag is not active.\n */\n tabPressOffset?: { x: number; y: number };\n\n /**\n * The tab target index upon mouse release.\n *\n * This will be `-1` if the drag is not active.\n */\n targetIndex: number;\n\n /**\n * The array of tab layout objects snapped at drag start.\n *\n * This will be `null` if the drag is not active.\n */\n tabLayout: ITabLayout[] | null;\n\n /**\n * The bounding client rect of the tab bar content node.\n *\n * This will be `null` if the drag is not active.\n */\n contentRect: DOMRect | null;\n\n /**\n * The disposable to clean up the cursor override.\n *\n * This will be `null` if the drag is not active.\n */\n override: IDisposable | null;\n\n /**\n * Whether the drag is currently active.\n */\n dragActive: boolean;\n\n /**\n * Whether the drag has been aborted.\n */\n dragAborted: boolean;\n\n /**\n * Whether a detach request as been made.\n */\n detachRequested: boolean;\n }\n\n /**\n * An object which holds layout data for a tab.\n */\n export interface ITabLayout {\n /**\n * The left/top margin value for the tab.\n */\n margin: number;\n\n /**\n * The offset left/top position of the tab.\n */\n pos: number;\n\n /**\n * The offset width/height of the tab.\n */\n size: number;\n }\n\n /**\n * Create the DOM node for a tab bar.\n */\n export function createNode(): HTMLDivElement {\n let node = document.createElement('div');\n let content = document.createElement('ul');\n content.setAttribute('role', 'tablist');\n content.className = 'lm-TabBar-content';\n node.appendChild(content);\n\n let add = document.createElement('div');\n add.className = 'lm-TabBar-addButton lm-mod-hidden';\n add.setAttribute('tabindex', '-1');\n add.setAttribute('role', 'button');\n node.appendChild(add);\n return node;\n }\n\n /**\n * Coerce a title or options into a real title.\n */\n export function asTitle(value: Title | Title.IOptions): Title {\n return value instanceof Title ? value : new Title(value);\n }\n\n /**\n * Parse the transition duration for a tab node.\n */\n export function parseTransitionDuration(tab: HTMLElement): number {\n let style = window.getComputedStyle(tab);\n return 1000 * (parseFloat(style.transitionDuration!) || 0);\n }\n\n /**\n * Get a snapshot of the current tab layout values.\n */\n export function snapTabLayout(\n tabs: HTMLCollection,\n orientation: TabBar.Orientation\n ): ITabLayout[] {\n let layout = new Array(tabs.length);\n for (let i = 0, n = tabs.length; i < n; ++i) {\n let node = tabs[i] as HTMLElement;\n let style = window.getComputedStyle(node);\n if (orientation === 'horizontal') {\n layout[i] = {\n pos: node.offsetLeft,\n size: node.offsetWidth,\n margin: parseFloat(style.marginLeft!) || 0\n };\n } else {\n layout[i] = {\n pos: node.offsetTop,\n size: node.offsetHeight,\n margin: parseFloat(style.marginTop!) || 0\n };\n }\n }\n return layout;\n }\n\n /**\n * Test if the event exceeds the drag threshold.\n */\n export function dragExceeded(data: IDragData, event: MouseEvent): boolean {\n let dx = Math.abs(event.clientX - data.pressX);\n let dy = Math.abs(event.clientY - data.pressY);\n return dx >= DRAG_THRESHOLD || dy >= DRAG_THRESHOLD;\n }\n\n /**\n * Test if the event exceeds the drag detach threshold.\n */\n export function detachExceeded(data: IDragData, event: MouseEvent): boolean {\n let rect = data.contentRect!;\n return (\n event.clientX < rect.left - DETACH_THRESHOLD ||\n event.clientX >= rect.right + DETACH_THRESHOLD ||\n event.clientY < rect.top - DETACH_THRESHOLD ||\n event.clientY >= rect.bottom + DETACH_THRESHOLD\n );\n }\n\n /**\n * Update the relative tab positions and computed target index.\n */\n export function layoutTabs(\n tabs: HTMLCollection,\n data: IDragData,\n event: MouseEvent,\n orientation: TabBar.Orientation\n ): void {\n // Compute the orientation-sensitive values.\n let pressPos: number;\n let localPos: number;\n let clientPos: number;\n let clientSize: number;\n if (orientation === 'horizontal') {\n pressPos = data.pressX;\n localPos = event.clientX - data.contentRect!.left;\n clientPos = event.clientX;\n clientSize = data.contentRect!.width;\n } else {\n pressPos = data.pressY;\n localPos = event.clientY - data.contentRect!.top;\n clientPos = event.clientY;\n clientSize = data.contentRect!.height;\n }\n\n // Compute the target data.\n let targetIndex = data.index;\n let targetPos = localPos - data.tabPressPos;\n let targetEnd = targetPos + data.tabSize;\n\n // Update the relative tab positions.\n for (let i = 0, n = tabs.length; i < n; ++i) {\n let pxPos: string;\n let layout = data.tabLayout![i];\n let threshold = layout.pos + (layout.size >> 1);\n if (i < data.index && targetPos < threshold) {\n pxPos = `${data.tabSize + data.tabLayout![i + 1].margin}px`;\n targetIndex = Math.min(targetIndex, i);\n } else if (i > data.index && targetEnd > threshold) {\n pxPos = `${-data.tabSize - layout.margin}px`;\n targetIndex = Math.max(targetIndex, i);\n } else if (i === data.index) {\n let ideal = clientPos - pressPos;\n let limit = clientSize - (data.tabPos + data.tabSize);\n pxPos = `${Math.max(-data.tabPos, Math.min(ideal, limit))}px`;\n } else {\n pxPos = '';\n }\n if (orientation === 'horizontal') {\n (tabs[i] as HTMLElement).style.left = pxPos;\n } else {\n (tabs[i] as HTMLElement).style.top = pxPos;\n }\n }\n\n // Update the computed target index.\n data.targetIndex = targetIndex;\n }\n\n /**\n * Position the drag tab at its final resting relative position.\n */\n export function finalizeTabPosition(\n data: IDragData,\n orientation: TabBar.Orientation\n ): void {\n // Compute the orientation-sensitive client size.\n let clientSize: number;\n if (orientation === 'horizontal') {\n clientSize = data.contentRect!.width;\n } else {\n clientSize = data.contentRect!.height;\n }\n\n // Compute the ideal final tab position.\n let ideal: number;\n if (data.targetIndex === data.index) {\n ideal = 0;\n } else if (data.targetIndex > data.index) {\n let tgt = data.tabLayout![data.targetIndex];\n ideal = tgt.pos + tgt.size - data.tabSize - data.tabPos;\n } else {\n let tgt = data.tabLayout![data.targetIndex];\n ideal = tgt.pos - data.tabPos;\n }\n\n // Compute the tab position limit.\n let limit = clientSize - (data.tabPos + data.tabSize);\n let final = Math.max(-data.tabPos, Math.min(ideal, limit));\n\n // Set the final orientation-sensitive position.\n if (orientation === 'horizontal') {\n data.tab.style.left = `${final}px`;\n } else {\n data.tab.style.top = `${final}px`;\n }\n }\n\n /**\n * Reset the relative positions of the given tabs.\n */\n export function resetTabPositions(\n tabs: HTMLCollection,\n orientation: TabBar.Orientation\n ): void {\n for (const tab of tabs) {\n if (orientation === 'horizontal') {\n (tab as HTMLElement).style.left = '';\n } else {\n (tab as HTMLElement).style.top = '';\n }\n }\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt, empty } from '@lumino/algorithm';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { BoxEngine, BoxSizer } from './boxengine';\n\nimport { Layout, LayoutItem } from './layout';\n\nimport { TabBar } from './tabbar';\n\nimport Utils from './utils';\n\nimport { Widget } from './widget';\n\n/**\n * A layout which provides a flexible docking arrangement.\n *\n * #### Notes\n * The consumer of this layout is responsible for handling all signals\n * from the generated tab bars and managing the visibility of widgets\n * and tab bars as needed.\n */\nexport class DockLayout extends Layout {\n /**\n * Construct a new dock layout.\n *\n * @param options - The options for initializing the layout.\n */\n constructor(options: DockLayout.IOptions) {\n super();\n this.renderer = options.renderer;\n if (options.spacing !== undefined) {\n this._spacing = Utils.clampDimension(options.spacing);\n }\n this._document = options.document || document;\n this._hiddenMode =\n options.hiddenMode !== undefined\n ? options.hiddenMode\n : Widget.HiddenMode.Display;\n }\n\n /**\n * Dispose of the resources held by the layout.\n *\n * #### Notes\n * This will clear and dispose all widgets in the layout.\n */\n dispose(): void {\n // Get an iterator over the widgets in the layout.\n let widgets = this[Symbol.iterator]();\n\n // Dispose of the layout items.\n this._items.forEach(item => {\n item.dispose();\n });\n\n // Clear the layout state before disposing the widgets.\n this._box = null;\n this._root = null;\n this._items.clear();\n\n // Dispose of the widgets contained in the old layout root.\n for (const widget of widgets) {\n widget.dispose();\n }\n\n // Dispose of the base class.\n super.dispose();\n }\n\n /**\n * The renderer used by the dock layout.\n */\n readonly renderer: DockLayout.IRenderer;\n\n /**\n * The method for hiding child widgets.\n *\n * #### Notes\n * If there is only one child widget, `Display` hiding mode will be used\n * regardless of this setting.\n */\n get hiddenMode(): Widget.HiddenMode {\n return this._hiddenMode;\n }\n set hiddenMode(v: Widget.HiddenMode) {\n if (this._hiddenMode === v) {\n return;\n }\n this._hiddenMode = v;\n for (const bar of this.tabBars()) {\n if (bar.titles.length > 1) {\n for (const title of bar.titles) {\n title.owner.hiddenMode = this._hiddenMode;\n }\n }\n }\n }\n\n /**\n * Get the inter-element spacing for the dock layout.\n */\n get spacing(): number {\n return this._spacing;\n }\n\n /**\n * Set the inter-element spacing for the dock layout.\n */\n set spacing(value: number) {\n value = Utils.clampDimension(value);\n if (this._spacing === value) {\n return;\n }\n this._spacing = value;\n if (!this.parent) {\n return;\n }\n this.parent.fit();\n }\n\n /**\n * Whether the dock layout is empty.\n */\n get isEmpty(): boolean {\n return this._root === null;\n }\n\n /**\n * Create an iterator over all widgets in the layout.\n *\n * @returns A new iterator over the widgets in the layout.\n *\n * #### Notes\n * This iterator includes the generated tab bars.\n */\n [Symbol.iterator](): IterableIterator {\n return this._root ? this._root.iterAllWidgets() : empty();\n }\n\n /**\n * Create an iterator over the user widgets in the layout.\n *\n * @returns A new iterator over the user widgets in the layout.\n *\n * #### Notes\n * This iterator does not include the generated tab bars.\n */\n widgets(): IterableIterator {\n return this._root ? this._root.iterUserWidgets() : empty();\n }\n\n /**\n * Create an iterator over the selected widgets in the layout.\n *\n * @returns A new iterator over the selected user widgets.\n *\n * #### Notes\n * This iterator yields the widgets corresponding to the current tab\n * of each tab bar in the layout.\n */\n selectedWidgets(): IterableIterator {\n return this._root ? this._root.iterSelectedWidgets() : empty();\n }\n\n /**\n * Create an iterator over the tab bars in the layout.\n *\n * @returns A new iterator over the tab bars in the layout.\n *\n * #### Notes\n * This iterator does not include the user widgets.\n */\n tabBars(): IterableIterator> {\n return this._root ? this._root.iterTabBars() : empty();\n }\n\n /**\n * Create an iterator over the handles in the layout.\n *\n * @returns A new iterator over the handles in the layout.\n */\n handles(): IterableIterator {\n return this._root ? this._root.iterHandles() : empty();\n }\n\n /**\n * Move a handle to the given offset position.\n *\n * @param handle - The handle to move.\n *\n * @param offsetX - The desired offset X position of the handle.\n *\n * @param offsetY - The desired offset Y position of the handle.\n *\n * #### Notes\n * If the given handle is not contained in the layout, this is no-op.\n *\n * The handle will be moved as close as possible to the desired\n * position without violating any of the layout constraints.\n *\n * Only one of the coordinates is used depending on the orientation\n * of the handle. This method accepts both coordinates to make it\n * easy to invoke from a mouse move event without needing to know\n * the handle orientation.\n */\n moveHandle(handle: HTMLDivElement, offsetX: number, offsetY: number): void {\n // Bail early if there is no root or if the handle is hidden.\n let hidden = handle.classList.contains('lm-mod-hidden');\n if (!this._root || hidden) {\n return;\n }\n\n // Lookup the split node for the handle.\n let data = this._root.findSplitNode(handle);\n if (!data) {\n return;\n }\n\n // Compute the desired delta movement for the handle.\n let delta: number;\n if (data.node.orientation === 'horizontal') {\n delta = offsetX - handle.offsetLeft;\n } else {\n delta = offsetY - handle.offsetTop;\n }\n\n // Bail if there is no handle movement.\n if (delta === 0) {\n return;\n }\n\n // Prevent sibling resizing unless needed.\n data.node.holdSizes();\n\n // Adjust the sizers to reflect the handle movement.\n BoxEngine.adjust(data.node.sizers, data.index, delta);\n\n // Update the layout of the widgets.\n if (this.parent) {\n this.parent.update();\n }\n }\n\n /**\n * Save the current configuration of the dock layout.\n *\n * @returns A new config object for the current layout state.\n *\n * #### Notes\n * The return value can be provided to the `restoreLayout` method\n * in order to restore the layout to its current configuration.\n */\n saveLayout(): DockLayout.ILayoutConfig {\n // Bail early if there is no root.\n if (!this._root) {\n return { main: null };\n }\n\n // Hold the current sizes in the layout tree.\n this._root.holdAllSizes();\n\n // Return the layout config.\n return { main: this._root.createConfig() };\n }\n\n /**\n * Restore the layout to a previously saved configuration.\n *\n * @param config - The layout configuration to restore.\n *\n * #### Notes\n * Widgets which currently belong to the layout but which are not\n * contained in the config will be unparented.\n */\n restoreLayout(config: DockLayout.ILayoutConfig): void {\n // Create the widget set for validating the config.\n let widgetSet = new Set();\n\n // Normalize the main area config and collect the widgets.\n let mainConfig: DockLayout.AreaConfig | null;\n if (config.main) {\n mainConfig = Private.normalizeAreaConfig(config.main, widgetSet);\n } else {\n mainConfig = null;\n }\n\n // Create iterators over the old content.\n let oldWidgets = this.widgets();\n let oldTabBars = this.tabBars();\n let oldHandles = this.handles();\n\n // Clear the root before removing the old content.\n this._root = null;\n\n // Unparent the old widgets which are not in the new config.\n for (const widget of oldWidgets) {\n if (!widgetSet.has(widget)) {\n widget.parent = null;\n }\n }\n\n // Dispose of the old tab bars.\n for (const tabBar of oldTabBars) {\n tabBar.dispose();\n }\n\n // Remove the old handles.\n for (const handle of oldHandles) {\n if (handle.parentNode) {\n handle.parentNode.removeChild(handle);\n }\n }\n\n // Reparent the new widgets to the current parent.\n for (const widget of widgetSet) {\n widget.parent = this.parent;\n }\n\n // Create the root node for the new config.\n if (mainConfig) {\n this._root = Private.realizeAreaConfig(\n mainConfig,\n {\n // Ignoring optional `document` argument as we must reuse `this._document`\n createTabBar: (document?: Document | ShadowRoot) =>\n this._createTabBar(),\n createHandle: () => this._createHandle()\n },\n this._document\n );\n } else {\n this._root = null;\n }\n\n // If there is no parent, there is nothing more to do.\n if (!this.parent) {\n return;\n }\n\n // Attach the new widgets to the parent.\n widgetSet.forEach(widget => {\n this.attachWidget(widget);\n });\n\n // Post a fit request to the parent.\n this.parent.fit();\n }\n\n /**\n * Add a widget to the dock layout.\n *\n * @param widget - The widget to add to the dock layout.\n *\n * @param options - The additional options for adding the widget.\n *\n * #### Notes\n * The widget will be moved if it is already contained in the layout.\n *\n * An error will be thrown if the reference widget is invalid.\n */\n addWidget(widget: Widget, options: DockLayout.IAddOptions = {}): void {\n // Parse the options.\n let ref = options.ref || null;\n let mode = options.mode || 'tab-after';\n\n // Find the tab node which holds the reference widget.\n let refNode: Private.TabLayoutNode | null = null;\n if (this._root && ref) {\n refNode = this._root.findTabNode(ref);\n }\n\n // Throw an error if the reference widget is invalid.\n if (ref && !refNode) {\n throw new Error('Reference widget is not in the layout.');\n }\n\n // Reparent the widget to the current layout parent.\n widget.parent = this.parent;\n\n // Insert the widget according to the insert mode.\n switch (mode) {\n case 'tab-after':\n this._insertTab(widget, ref, refNode, true);\n break;\n case 'tab-before':\n this._insertTab(widget, ref, refNode, false);\n break;\n case 'split-top':\n this._insertSplit(widget, ref, refNode, 'vertical', false);\n break;\n case 'split-left':\n this._insertSplit(widget, ref, refNode, 'horizontal', false);\n break;\n case 'split-right':\n this._insertSplit(widget, ref, refNode, 'horizontal', true);\n break;\n case 'split-bottom':\n this._insertSplit(widget, ref, refNode, 'vertical', true);\n break;\n case 'merge-top':\n this._insertSplit(widget, ref, refNode, 'vertical', false, true);\n break;\n case 'merge-left':\n this._insertSplit(widget, ref, refNode, 'horizontal', false, true);\n break;\n case 'merge-right':\n this._insertSplit(widget, ref, refNode, 'horizontal', true, true);\n break;\n case 'merge-bottom':\n this._insertSplit(widget, ref, refNode, 'vertical', true, true);\n break;\n }\n\n // Do nothing else if there is no parent widget.\n if (!this.parent) {\n return;\n }\n\n // Ensure the widget is attached to the parent widget.\n this.attachWidget(widget);\n\n // Post a fit request for the parent widget.\n this.parent.fit();\n }\n\n /**\n * Remove a widget from the layout.\n *\n * @param widget - The widget to remove from the layout.\n *\n * #### Notes\n * A widget is automatically removed from the layout when its `parent`\n * is set to `null`. This method should only be invoked directly when\n * removing a widget from a layout which has yet to be installed on a\n * parent widget.\n *\n * This method does *not* modify the widget's `parent`.\n */\n removeWidget(widget: Widget): void {\n // Remove the widget from its current layout location.\n this._removeWidget(widget);\n\n // Do nothing else if there is no parent widget.\n if (!this.parent) {\n return;\n }\n\n // Detach the widget from the parent widget.\n this.detachWidget(widget);\n\n // Post a fit request for the parent widget.\n this.parent.fit();\n }\n\n /**\n * Find the tab area which contains the given client position.\n *\n * @param clientX - The client X position of interest.\n *\n * @param clientY - The client Y position of interest.\n *\n * @returns The geometry of the tab area at the given position, or\n * `null` if there is no tab area at the given position.\n */\n hitTestTabAreas(\n clientX: number,\n clientY: number\n ): DockLayout.ITabAreaGeometry | null {\n // Bail early if hit testing cannot produce valid results.\n if (!this._root || !this.parent || !this.parent.isVisible) {\n return null;\n }\n\n // Ensure the parent box sizing data is computed.\n if (!this._box) {\n this._box = ElementExt.boxSizing(this.parent.node);\n }\n\n // Convert from client to local coordinates.\n let rect = this.parent.node.getBoundingClientRect();\n let x = clientX - rect.left - this._box.borderLeft;\n let y = clientY - rect.top - this._box.borderTop;\n\n // Find the tab layout node at the local position.\n let tabNode = this._root.hitTestTabNodes(x, y);\n\n // Bail if a tab layout node was not found.\n if (!tabNode) {\n return null;\n }\n\n // Extract the data from the tab node.\n let { tabBar, top, left, width, height } = tabNode;\n\n // Compute the right and bottom edges of the tab area.\n let borderWidth = this._box.borderLeft + this._box.borderRight;\n let borderHeight = this._box.borderTop + this._box.borderBottom;\n let right = rect.width - borderWidth - (left + width);\n let bottom = rect.height - borderHeight - (top + height);\n\n // Return the hit test results.\n return { tabBar, x, y, top, left, right, bottom, width, height };\n }\n\n /**\n * Perform layout initialization which requires the parent widget.\n */\n protected init(): void {\n // Perform superclass initialization.\n super.init();\n\n // Attach each widget to the parent.\n for (const widget of this) {\n this.attachWidget(widget);\n }\n\n // Attach each handle to the parent.\n for (const handle of this.handles()) {\n this.parent!.node.appendChild(handle);\n }\n\n // Post a fit request for the parent widget.\n this.parent!.fit();\n }\n\n /**\n * Attach the widget to the layout parent widget.\n *\n * @param widget - The widget to attach to the parent.\n *\n * #### Notes\n * This is a no-op if the widget is already attached.\n */\n protected attachWidget(widget: Widget): void {\n // Do nothing if the widget is already attached.\n if (this.parent!.node === widget.node.parentNode) {\n return;\n }\n\n // Create the layout item for the widget.\n this._items.set(widget, new LayoutItem(widget));\n\n // Send a `'before-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n }\n\n // Add the widget's node to the parent.\n this.parent!.node.appendChild(widget.node);\n\n // Send an `'after-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n }\n\n /**\n * Detach the widget from the layout parent widget.\n *\n * @param widget - The widget to detach from the parent.\n *\n * #### Notes\n * This is a no-op if the widget is not attached.\n */\n protected detachWidget(widget: Widget): void {\n // Do nothing if the widget is not attached.\n if (this.parent!.node !== widget.node.parentNode) {\n return;\n }\n\n // Send a `'before-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n }\n\n // Remove the widget's node from the parent.\n this.parent!.node.removeChild(widget.node);\n\n // Send an `'after-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n\n // Delete the layout item for the widget.\n let item = this._items.get(widget);\n if (item) {\n this._items.delete(widget);\n item.dispose();\n }\n }\n\n /**\n * A message handler invoked on a `'before-show'` message.\n */\n protected onBeforeShow(msg: Message): void {\n super.onBeforeShow(msg);\n this.parent!.update();\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n super.onBeforeAttach(msg);\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-shown'` message.\n */\n protected onChildShown(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-hidden'` message.\n */\n protected onChildHidden(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'resize'` message.\n */\n protected onResize(msg: Widget.ResizeMessage): void {\n if (this.parent!.isVisible) {\n this._update(msg.width, msg.height);\n }\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n protected onUpdateRequest(msg: Message): void {\n if (this.parent!.isVisible) {\n this._update(-1, -1);\n }\n }\n\n /**\n * A message handler invoked on a `'fit-request'` message.\n */\n protected onFitRequest(msg: Message): void {\n if (this.parent!.isAttached) {\n this._fit();\n }\n }\n\n /**\n * Remove the specified widget from the layout structure.\n *\n * #### Notes\n * This is a no-op if the widget is not in the layout tree.\n *\n * This does not detach the widget from the parent node.\n */\n private _removeWidget(widget: Widget): void {\n // Bail early if there is no layout root.\n if (!this._root) {\n return;\n }\n\n // Find the tab node which contains the given widget.\n let tabNode = this._root.findTabNode(widget);\n\n // Bail early if the tab node is not found.\n if (!tabNode) {\n return;\n }\n\n Private.removeAria(widget);\n\n // If there are multiple tabs, just remove the widget's tab.\n if (tabNode.tabBar.titles.length > 1) {\n tabNode.tabBar.removeTab(widget.title);\n if (\n this._hiddenMode === Widget.HiddenMode.Scale &&\n tabNode.tabBar.titles.length == 1\n ) {\n const existingWidget = tabNode.tabBar.titles[0].owner;\n existingWidget.hiddenMode = Widget.HiddenMode.Display;\n }\n return;\n }\n\n // Otherwise, the tab node needs to be removed...\n\n // Dispose the tab bar.\n tabNode.tabBar.dispose();\n\n // Handle the case where the tab node is the root.\n if (this._root === tabNode) {\n this._root = null;\n return;\n }\n\n // Otherwise, remove the tab node from its parent...\n\n // Prevent widget resizing unless needed.\n this._root.holdAllSizes();\n\n // Clear the parent reference on the tab node.\n let splitNode = tabNode.parent!;\n tabNode.parent = null;\n\n // Remove the tab node from its parent split node.\n let i = ArrayExt.removeFirstOf(splitNode.children, tabNode);\n let handle = ArrayExt.removeAt(splitNode.handles, i)!;\n ArrayExt.removeAt(splitNode.sizers, i);\n\n // Remove the handle from its parent DOM node.\n if (handle.parentNode) {\n handle.parentNode.removeChild(handle);\n }\n\n // If there are multiple children, just update the handles.\n if (splitNode.children.length > 1) {\n splitNode.syncHandles();\n return;\n }\n\n // Otherwise, the split node also needs to be removed...\n\n // Clear the parent reference on the split node.\n let maybeParent = splitNode.parent;\n splitNode.parent = null;\n\n // Lookup the remaining child node and handle.\n let childNode = splitNode.children[0];\n let childHandle = splitNode.handles[0];\n\n // Clear the split node data.\n splitNode.children.length = 0;\n splitNode.handles.length = 0;\n splitNode.sizers.length = 0;\n\n // Remove the child handle from its parent node.\n if (childHandle.parentNode) {\n childHandle.parentNode.removeChild(childHandle);\n }\n\n // Handle the case where the split node is the root.\n if (this._root === splitNode) {\n childNode.parent = null;\n this._root = childNode;\n return;\n }\n\n // Otherwise, move the child node to the parent node...\n let parentNode = maybeParent!;\n\n // Lookup the index of the split node.\n let j = parentNode.children.indexOf(splitNode);\n\n // Handle the case where the child node is a tab node.\n if (childNode instanceof Private.TabLayoutNode) {\n childNode.parent = parentNode;\n parentNode.children[j] = childNode;\n return;\n }\n\n // Remove the split data from the parent.\n let splitHandle = ArrayExt.removeAt(parentNode.handles, j)!;\n ArrayExt.removeAt(parentNode.children, j);\n ArrayExt.removeAt(parentNode.sizers, j);\n\n // Remove the handle from its parent node.\n if (splitHandle.parentNode) {\n splitHandle.parentNode.removeChild(splitHandle);\n }\n\n // The child node and the split parent node will have the same\n // orientation. Merge the grand-children with the parent node.\n for (let i = 0, n = childNode.children.length; i < n; ++i) {\n let gChild = childNode.children[i];\n let gHandle = childNode.handles[i];\n let gSizer = childNode.sizers[i];\n ArrayExt.insert(parentNode.children, j + i, gChild);\n ArrayExt.insert(parentNode.handles, j + i, gHandle);\n ArrayExt.insert(parentNode.sizers, j + i, gSizer);\n gChild.parent = parentNode;\n }\n\n // Clear the child node.\n childNode.children.length = 0;\n childNode.handles.length = 0;\n childNode.sizers.length = 0;\n childNode.parent = null;\n\n // Sync the handles on the parent node.\n parentNode.syncHandles();\n }\n\n /**\n * Create the tab layout node to hold the widget.\n */\n private _createTabNode(widget: Widget): Private.TabLayoutNode {\n let tabNode = new Private.TabLayoutNode(this._createTabBar());\n tabNode.tabBar.addTab(widget.title);\n Private.addAria(widget, tabNode.tabBar);\n return tabNode;\n }\n\n /**\n * Insert a widget next to an existing tab.\n *\n * #### Notes\n * This does not attach the widget to the parent widget.\n */\n private _insertTab(\n widget: Widget,\n ref: Widget | null,\n refNode: Private.TabLayoutNode | null,\n after: boolean\n ): void {\n // Do nothing if the tab is inserted next to itself.\n if (widget === ref) {\n return;\n }\n\n // Create the root if it does not exist.\n if (!this._root) {\n let tabNode = new Private.TabLayoutNode(this._createTabBar());\n tabNode.tabBar.addTab(widget.title);\n this._root = tabNode;\n Private.addAria(widget, tabNode.tabBar);\n return;\n }\n\n // Use the first tab node as the ref node if needed.\n if (!refNode) {\n refNode = this._root.findFirstTabNode()!;\n }\n\n // If the widget is not contained in the ref node, ensure it is\n // removed from the layout and hidden before being added again.\n if (refNode.tabBar.titles.indexOf(widget.title) === -1) {\n this._removeWidget(widget);\n widget.hide();\n }\n\n // Lookup the target index for inserting the tab.\n let index: number;\n if (ref) {\n index = refNode.tabBar.titles.indexOf(ref.title);\n } else {\n index = refNode.tabBar.currentIndex;\n }\n\n // Using transform create an additional layer in the pixel pipeline\n // to limit the number of layer, it is set only if there is more than one widget.\n if (this._hiddenMode === Widget.HiddenMode.Scale) {\n if (refNode.tabBar.titles.length === 0) {\n // Singular tab should use display mode to limit number of layers.\n widget.hiddenMode = Widget.HiddenMode.Display;\n } else if (refNode.tabBar.titles.length == 1) {\n // If we are adding a second tab, switch the existing tab back to scale.\n const existingWidget = refNode.tabBar.titles[0].owner;\n existingWidget.hiddenMode = Widget.HiddenMode.Scale;\n } else {\n // For the third and subsequent tabs no special action is needed.\n widget.hiddenMode = Widget.HiddenMode.Scale;\n }\n } else {\n // For all other modes just propagate the current mode.\n widget.hiddenMode = this._hiddenMode;\n }\n\n // Insert the widget's tab relative to the target index.\n refNode.tabBar.insertTab(index + (after ? 1 : 0), widget.title);\n Private.addAria(widget, refNode.tabBar);\n }\n\n /**\n * Insert a widget as a new split area.\n *\n * #### Notes\n * This does not attach the widget to the parent widget.\n */\n private _insertSplit(\n widget: Widget,\n ref: Widget | null,\n refNode: Private.TabLayoutNode | null,\n orientation: Private.Orientation,\n after: boolean,\n merge: boolean = false\n ): void {\n // Do nothing if there is no effective split.\n if (widget === ref && refNode && refNode.tabBar.titles.length === 1) {\n return;\n }\n\n // Ensure the widget is removed from the current layout.\n this._removeWidget(widget);\n\n // Set the root if it does not exist.\n if (!this._root) {\n this._root = this._createTabNode(widget);\n return;\n }\n\n // If the ref node parent is null, split the root.\n if (!refNode || !refNode.parent) {\n // Ensure the root is split with the correct orientation.\n let root = this._splitRoot(orientation);\n\n // Determine the insert index for the new tab node.\n let i = after ? root.children.length : 0;\n\n // Normalize the split node.\n root.normalizeSizes();\n\n // Create the sizer for new tab node.\n let sizer = Private.createSizer(refNode ? 1 : Private.GOLDEN_RATIO);\n\n // Insert the tab node sized to the golden ratio.\n let tabNode = this._createTabNode(widget);\n ArrayExt.insert(root.children, i, tabNode);\n ArrayExt.insert(root.sizers, i, sizer);\n ArrayExt.insert(root.handles, i, this._createHandle());\n tabNode.parent = root;\n\n // Re-normalize the split node to maintain the ratios.\n root.normalizeSizes();\n\n // Finally, synchronize the visibility of the handles.\n root.syncHandles();\n return;\n }\n\n // Lookup the split node for the ref widget.\n let splitNode = refNode.parent;\n\n // If the split node already had the correct orientation,\n // the widget can be inserted into the split node directly.\n if (splitNode.orientation === orientation) {\n // Find the index of the ref node.\n let i = splitNode.children.indexOf(refNode);\n\n // Conditionally reuse a tab layout found in the wanted position.\n if (merge) {\n let j = i + (after ? 1 : -1);\n let sibling = splitNode.children[j];\n if (sibling instanceof Private.TabLayoutNode) {\n this._insertTab(widget, null, sibling, true);\n ++sibling.tabBar.currentIndex;\n return;\n }\n }\n\n // Normalize the split node.\n splitNode.normalizeSizes();\n\n // Consume half the space for the insert location.\n let s = (splitNode.sizers[i].sizeHint /= 2);\n\n // Insert the tab node sized to the other half.\n let j = i + (after ? 1 : 0);\n let tabNode = this._createTabNode(widget);\n ArrayExt.insert(splitNode.children, j, tabNode);\n ArrayExt.insert(splitNode.sizers, j, Private.createSizer(s));\n ArrayExt.insert(splitNode.handles, j, this._createHandle());\n tabNode.parent = splitNode;\n\n // Finally, synchronize the visibility of the handles.\n splitNode.syncHandles();\n return;\n }\n\n // Remove the ref node from the split node.\n let i = ArrayExt.removeFirstOf(splitNode.children, refNode);\n\n // Create a new normalized split node for the children.\n let childNode = new Private.SplitLayoutNode(orientation);\n childNode.normalized = true;\n\n // Add the ref node sized to half the space.\n childNode.children.push(refNode);\n childNode.sizers.push(Private.createSizer(0.5));\n childNode.handles.push(this._createHandle());\n refNode.parent = childNode;\n\n // Add the tab node sized to the other half.\n let j = after ? 1 : 0;\n let tabNode = this._createTabNode(widget);\n ArrayExt.insert(childNode.children, j, tabNode);\n ArrayExt.insert(childNode.sizers, j, Private.createSizer(0.5));\n ArrayExt.insert(childNode.handles, j, this._createHandle());\n tabNode.parent = childNode;\n\n // Synchronize the visibility of the handles.\n childNode.syncHandles();\n\n // Finally, add the new child node to the original split node.\n ArrayExt.insert(splitNode.children, i, childNode);\n childNode.parent = splitNode;\n }\n\n /**\n * Ensure the root is a split node with the given orientation.\n */\n private _splitRoot(\n orientation: Private.Orientation\n ): Private.SplitLayoutNode {\n // Bail early if the root already meets the requirements.\n let oldRoot = this._root;\n if (oldRoot instanceof Private.SplitLayoutNode) {\n if (oldRoot.orientation === orientation) {\n return oldRoot;\n }\n }\n\n // Create a new root node with the specified orientation.\n let newRoot = (this._root = new Private.SplitLayoutNode(orientation));\n\n // Add the old root to the new root.\n if (oldRoot) {\n newRoot.children.push(oldRoot);\n newRoot.sizers.push(Private.createSizer(0));\n newRoot.handles.push(this._createHandle());\n oldRoot.parent = newRoot;\n }\n\n // Return the new root as a convenience.\n return newRoot;\n }\n\n /**\n * Fit the layout to the total size required by the widgets.\n */\n private _fit(): void {\n // Set up the computed minimum size.\n let minW = 0;\n let minH = 0;\n\n // Update the size limits for the layout tree.\n if (this._root) {\n let limits = this._root.fit(this._spacing, this._items);\n minW = limits.minWidth;\n minH = limits.minHeight;\n }\n\n // Update the box sizing and add it to the computed min size.\n let box = (this._box = ElementExt.boxSizing(this.parent!.node));\n minW += box.horizontalSum;\n minH += box.verticalSum;\n\n // Update the parent's min size constraints.\n let style = this.parent!.node.style;\n style.minWidth = `${minW}px`;\n style.minHeight = `${minH}px`;\n\n // Set the dirty flag to ensure only a single update occurs.\n this._dirty = true;\n\n // Notify the ancestor that it should fit immediately. This may\n // cause a resize of the parent, fulfilling the required update.\n if (this.parent!.parent) {\n MessageLoop.sendMessage(this.parent!.parent!, Widget.Msg.FitRequest);\n }\n\n // If the dirty flag is still set, the parent was not resized.\n // Trigger the required update on the parent widget immediately.\n if (this._dirty) {\n MessageLoop.sendMessage(this.parent!, Widget.Msg.UpdateRequest);\n }\n }\n\n /**\n * Update the layout position and size of the widgets.\n *\n * The parent offset dimensions should be `-1` if unknown.\n */\n private _update(offsetWidth: number, offsetHeight: number): void {\n // Clear the dirty flag to indicate the update occurred.\n this._dirty = false;\n\n // Bail early if there is no root layout node.\n if (!this._root) {\n return;\n }\n\n // Measure the parent if the offset dimensions are unknown.\n if (offsetWidth < 0) {\n offsetWidth = this.parent!.node.offsetWidth;\n }\n if (offsetHeight < 0) {\n offsetHeight = this.parent!.node.offsetHeight;\n }\n\n // Ensure the parent box sizing data is computed.\n if (!this._box) {\n this._box = ElementExt.boxSizing(this.parent!.node);\n }\n\n // Compute the actual layout bounds adjusted for border and padding.\n let x = this._box.paddingTop;\n let y = this._box.paddingLeft;\n let width = offsetWidth - this._box.horizontalSum;\n let height = offsetHeight - this._box.verticalSum;\n\n // Update the geometry of the layout tree.\n this._root.update(x, y, width, height, this._spacing, this._items);\n }\n\n /**\n * Create a new tab bar for use by the dock layout.\n *\n * #### Notes\n * The tab bar will be attached to the parent if it exists.\n */\n private _createTabBar(): TabBar {\n // Create the tab bar using the renderer.\n let tabBar = this.renderer.createTabBar(this._document);\n\n // Enforce necessary tab bar behavior.\n tabBar.orientation = 'horizontal';\n\n // Attach the tab bar to the parent if possible.\n if (this.parent) {\n this.attachWidget(tabBar);\n }\n\n // Return the initialized tab bar.\n return tabBar;\n }\n\n /**\n * Create a new handle for the dock layout.\n *\n * #### Notes\n * The handle will be attached to the parent if it exists.\n */\n private _createHandle(): HTMLDivElement {\n // Create the handle using the renderer.\n let handle = this.renderer.createHandle();\n\n // Initialize the handle layout behavior.\n let style = handle.style;\n style.position = 'absolute';\n style.contain = 'strict';\n style.top = '0';\n style.left = '0';\n style.width = '0';\n style.height = '0';\n\n // Attach the handle to the parent if it exists.\n if (this.parent) {\n this.parent.node.appendChild(handle);\n }\n\n // Return the initialized handle.\n return handle;\n }\n\n private _spacing = 4;\n private _dirty = false;\n private _root: Private.LayoutNode | null = null;\n private _box: ElementExt.IBoxSizing | null = null;\n private _document: Document | ShadowRoot;\n private _hiddenMode: Widget.HiddenMode;\n private _items: Private.ItemMap = new Map();\n}\n\n/**\n * The namespace for the `DockLayout` class statics.\n */\nexport namespace DockLayout {\n /**\n * An options object for creating a dock layout.\n */\n export interface IOptions {\n /**\n * The document to use with the dock panel.\n *\n * The default is the global `document` instance.\n */\n document?: Document | ShadowRoot;\n\n /**\n * The method for hiding widgets.\n *\n * The default is `Widget.HiddenMode.Display`.\n */\n hiddenMode?: Widget.HiddenMode;\n\n /**\n * The renderer to use for the dock layout.\n */\n renderer: IRenderer;\n\n /**\n * The spacing between items in the layout.\n *\n * The default is `4`.\n */\n spacing?: number;\n }\n\n /**\n * A renderer for use with a dock layout.\n */\n export interface IRenderer {\n /**\n * Create a new tab bar for use with a dock layout.\n *\n * @returns A new tab bar for a dock layout.\n */\n createTabBar(document?: Document | ShadowRoot): TabBar;\n\n /**\n * Create a new handle node for use with a dock layout.\n *\n * @returns A new handle node for a dock layout.\n */\n createHandle(): HTMLDivElement;\n }\n\n /**\n * A type alias for the supported insertion modes.\n *\n * An insert mode is used to specify how a widget should be added\n * to the dock layout relative to a reference widget.\n */\n export type InsertMode =\n | /**\n * The area to the top of the reference widget.\n *\n * The widget will be inserted just above the reference widget.\n *\n * If the reference widget is null or invalid, the widget will be\n * inserted at the top edge of the dock layout.\n */\n 'split-top'\n\n /**\n * The area to the left of the reference widget.\n *\n * The widget will be inserted just left of the reference widget.\n *\n * If the reference widget is null or invalid, the widget will be\n * inserted at the left edge of the dock layout.\n */\n | 'split-left'\n\n /**\n * The area to the right of the reference widget.\n *\n * The widget will be inserted just right of the reference widget.\n *\n * If the reference widget is null or invalid, the widget will be\n * inserted at the right edge of the dock layout.\n */\n | 'split-right'\n\n /**\n * The area to the bottom of the reference widget.\n *\n * The widget will be inserted just below the reference widget.\n *\n * If the reference widget is null or invalid, the widget will be\n * inserted at the bottom edge of the dock layout.\n */\n | 'split-bottom'\n\n /**\n * Like `split-top` but if a tab layout exists above the reference widget,\n * it behaves like `tab-after` with reference to that instead.\n */\n | 'merge-top'\n\n /**\n * Like `split-left` but if a tab layout exists left of the reference widget,\n * it behaves like `tab-after` with reference to that instead.\n */\n | 'merge-left'\n\n /**\n * Like `split-right` but if a tab layout exists right of the reference widget,\n * it behaves like `tab-after` with reference to that instead.\n */\n | 'merge-right'\n\n /**\n * Like `split-bottom` but if a tab layout exists below the reference widget,\n * it behaves like `tab-after` with reference to that instead.\n */\n | 'merge-bottom'\n\n /**\n * The tab position before the reference widget.\n *\n * The widget will be added as a tab before the reference widget.\n *\n * If the reference widget is null or invalid, a sensible default\n * will be used.\n */\n | 'tab-before'\n\n /**\n * The tab position after the reference widget.\n *\n * The widget will be added as a tab after the reference widget.\n *\n * If the reference widget is null or invalid, a sensible default\n * will be used.\n */\n | 'tab-after';\n\n /**\n * An options object for adding a widget to the dock layout.\n */\n export interface IAddOptions {\n /**\n * The insertion mode for adding the widget.\n *\n * The default is `'tab-after'`.\n */\n mode?: InsertMode;\n\n /**\n * The reference widget for the insert location.\n *\n * The default is `null`.\n */\n ref?: Widget | null;\n }\n\n /**\n * A layout config object for a tab area.\n */\n export interface ITabAreaConfig {\n /**\n * The discriminated type of the config object.\n */\n type: 'tab-area';\n\n /**\n * The widgets contained in the tab area.\n */\n widgets: Widget[];\n\n /**\n * The index of the selected tab.\n */\n currentIndex: number;\n }\n\n /**\n * A layout config object for a split area.\n */\n export interface ISplitAreaConfig {\n /**\n * The discriminated type of the config object.\n */\n type: 'split-area';\n\n /**\n * The orientation of the split area.\n */\n orientation: 'horizontal' | 'vertical';\n\n /**\n * The children in the split area.\n */\n children: AreaConfig[];\n\n /**\n * The relative sizes of the children.\n */\n sizes: number[];\n }\n\n /**\n * A type alias for a general area config.\n */\n export type AreaConfig = ITabAreaConfig | ISplitAreaConfig;\n\n /**\n * A dock layout configuration object.\n */\n export interface ILayoutConfig {\n /**\n * The layout config for the main dock area.\n */\n main: AreaConfig | null;\n }\n\n /**\n * An object which represents the geometry of a tab area.\n */\n export interface ITabAreaGeometry {\n /**\n * The tab bar for the tab area.\n */\n tabBar: TabBar;\n\n /**\n * The local X position of the hit test in the dock area.\n *\n * #### Notes\n * This is the distance from the left edge of the layout parent\n * widget, to the local X coordinate of the hit test query.\n */\n x: number;\n\n /**\n * The local Y position of the hit test in the dock area.\n *\n * #### Notes\n * This is the distance from the top edge of the layout parent\n * widget, to the local Y coordinate of the hit test query.\n */\n y: number;\n\n /**\n * The local coordinate of the top edge of the tab area.\n *\n * #### Notes\n * This is the distance from the top edge of the layout parent\n * widget, to the top edge of the tab area.\n */\n top: number;\n\n /**\n * The local coordinate of the left edge of the tab area.\n *\n * #### Notes\n * This is the distance from the left edge of the layout parent\n * widget, to the left edge of the tab area.\n */\n left: number;\n\n /**\n * The local coordinate of the right edge of the tab area.\n *\n * #### Notes\n * This is the distance from the right edge of the layout parent\n * widget, to the right edge of the tab area.\n */\n right: number;\n\n /**\n * The local coordinate of the bottom edge of the tab area.\n *\n * #### Notes\n * This is the distance from the bottom edge of the layout parent\n * widget, to the bottom edge of the tab area.\n */\n bottom: number;\n\n /**\n * The width of the tab area.\n *\n * #### Notes\n * This is total width allocated for the tab area.\n */\n width: number;\n\n /**\n * The height of the tab area.\n *\n * #### Notes\n * This is total height allocated for the tab area.\n */\n height: number;\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * A fraction used for sizing root panels; ~= `1 / golden_ratio`.\n */\n export const GOLDEN_RATIO = 0.618;\n\n /**\n * A type alias for a dock layout node.\n */\n export type LayoutNode = TabLayoutNode | SplitLayoutNode;\n\n /**\n * A type alias for the orientation of a split layout node.\n */\n export type Orientation = 'horizontal' | 'vertical';\n\n /**\n * A type alias for a layout item map.\n */\n export type ItemMap = Map;\n\n /**\n * Create a box sizer with an initial size hint.\n */\n export function createSizer(hint: number): BoxSizer {\n let sizer = new BoxSizer();\n sizer.sizeHint = hint;\n sizer.size = hint;\n return sizer;\n }\n\n /**\n * Normalize an area config object and collect the visited widgets.\n */\n export function normalizeAreaConfig(\n config: DockLayout.AreaConfig,\n widgetSet: Set\n ): DockLayout.AreaConfig | null {\n let result: DockLayout.AreaConfig | null;\n if (config.type === 'tab-area') {\n result = normalizeTabAreaConfig(config, widgetSet);\n } else {\n result = normalizeSplitAreaConfig(config, widgetSet);\n }\n return result;\n }\n\n /**\n * Convert a normalized area config into a layout tree.\n */\n export function realizeAreaConfig(\n config: DockLayout.AreaConfig,\n renderer: DockLayout.IRenderer,\n document: Document | ShadowRoot\n ): LayoutNode {\n let node: LayoutNode;\n if (config.type === 'tab-area') {\n node = realizeTabAreaConfig(config, renderer, document);\n } else {\n node = realizeSplitAreaConfig(config, renderer, document);\n }\n return node;\n }\n\n /**\n * A layout node which holds the data for a tabbed area.\n */\n export class TabLayoutNode {\n /**\n * Construct a new tab layout node.\n *\n * @param tabBar - The tab bar to use for the layout node.\n */\n constructor(tabBar: TabBar) {\n let tabSizer = new BoxSizer();\n let widgetSizer = new BoxSizer();\n tabSizer.stretch = 0;\n widgetSizer.stretch = 1;\n this.tabBar = tabBar;\n this.sizers = [tabSizer, widgetSizer];\n }\n\n /**\n * The parent of the layout node.\n */\n parent: SplitLayoutNode | null = null;\n\n /**\n * The tab bar for the layout node.\n */\n readonly tabBar: TabBar;\n\n /**\n * The sizers for the layout node.\n */\n readonly sizers: [BoxSizer, BoxSizer];\n\n /**\n * The most recent value for the `top` edge of the layout box.\n */\n get top(): number {\n return this._top;\n }\n\n /**\n * The most recent value for the `left` edge of the layout box.\n */\n get left(): number {\n return this._left;\n }\n\n /**\n * The most recent value for the `width` of the layout box.\n */\n get width(): number {\n return this._width;\n }\n\n /**\n * The most recent value for the `height` of the layout box.\n */\n get height(): number {\n return this._height;\n }\n\n /**\n * Create an iterator for all widgets in the layout tree.\n */\n *iterAllWidgets(): IterableIterator {\n yield this.tabBar;\n yield* this.iterUserWidgets();\n }\n\n /**\n * Create an iterator for the user widgets in the layout tree.\n */\n *iterUserWidgets(): IterableIterator {\n for (const title of this.tabBar.titles) {\n yield title.owner;\n }\n }\n\n /**\n * Create an iterator for the selected widgets in the layout tree.\n */\n *iterSelectedWidgets(): IterableIterator {\n let title = this.tabBar.currentTitle;\n if (title) {\n yield title.owner;\n }\n }\n\n /**\n * Create an iterator for the tab bars in the layout tree.\n */\n *iterTabBars(): IterableIterator> {\n yield this.tabBar;\n }\n\n /**\n * Create an iterator for the handles in the layout tree.\n */\n // eslint-disable-next-line require-yield\n *iterHandles(): IterableIterator {\n return;\n }\n\n /**\n * Find the tab layout node which contains the given widget.\n */\n findTabNode(widget: Widget): TabLayoutNode | null {\n return this.tabBar.titles.indexOf(widget.title) !== -1 ? this : null;\n }\n\n /**\n * Find the split layout node which contains the given handle.\n */\n findSplitNode(\n handle: HTMLDivElement\n ): { index: number; node: SplitLayoutNode } | null {\n return null;\n }\n\n /**\n * Find the first tab layout node in a layout tree.\n */\n findFirstTabNode(): TabLayoutNode | null {\n return this;\n }\n\n /**\n * Find the tab layout node which contains the local point.\n */\n hitTestTabNodes(x: number, y: number): TabLayoutNode | null {\n if (x < this._left || x >= this._left + this._width) {\n return null;\n }\n if (y < this._top || y >= this._top + this._height) {\n return null;\n }\n return this;\n }\n\n /**\n * Create a configuration object for the layout tree.\n */\n createConfig(): DockLayout.ITabAreaConfig {\n let widgets = this.tabBar.titles.map(title => title.owner);\n let currentIndex = this.tabBar.currentIndex;\n return { type: 'tab-area', widgets, currentIndex };\n }\n\n /**\n * Recursively hold all of the sizes in the layout tree.\n *\n * This ignores the sizers of tab layout nodes.\n */\n holdAllSizes(): void {\n return;\n }\n\n /**\n * Fit the layout tree.\n */\n fit(spacing: number, items: ItemMap): ElementExt.ISizeLimits {\n // Set up the limit variables.\n let minWidth = 0;\n let minHeight = 0;\n let maxWidth = Infinity;\n let maxHeight = Infinity;\n\n // Lookup the tab bar layout item.\n let tabBarItem = items.get(this.tabBar);\n\n // Lookup the widget layout item.\n let current = this.tabBar.currentTitle;\n let widgetItem = current ? items.get(current.owner) : undefined;\n\n // Lookup the tab bar and widget sizers.\n let [tabBarSizer, widgetSizer] = this.sizers;\n\n // Update the tab bar limits.\n if (tabBarItem) {\n tabBarItem.fit();\n }\n\n // Update the widget limits.\n if (widgetItem) {\n widgetItem.fit();\n }\n\n // Update the results and sizer for the tab bar.\n if (tabBarItem && !tabBarItem.isHidden) {\n minWidth = Math.max(minWidth, tabBarItem.minWidth);\n minHeight += tabBarItem.minHeight;\n tabBarSizer.minSize = tabBarItem.minHeight;\n tabBarSizer.maxSize = tabBarItem.maxHeight;\n } else {\n tabBarSizer.minSize = 0;\n tabBarSizer.maxSize = 0;\n }\n\n // Update the results and sizer for the current widget.\n if (widgetItem && !widgetItem.isHidden) {\n minWidth = Math.max(minWidth, widgetItem.minWidth);\n minHeight += widgetItem.minHeight;\n widgetSizer.minSize = widgetItem.minHeight;\n widgetSizer.maxSize = Infinity;\n } else {\n widgetSizer.minSize = 0;\n widgetSizer.maxSize = Infinity;\n }\n\n // Return the computed size limits for the layout node.\n return { minWidth, minHeight, maxWidth, maxHeight };\n }\n\n /**\n * Update the layout tree.\n */\n update(\n left: number,\n top: number,\n width: number,\n height: number,\n spacing: number,\n items: ItemMap\n ): void {\n // Update the layout box values.\n this._top = top;\n this._left = left;\n this._width = width;\n this._height = height;\n\n // Lookup the tab bar layout item.\n let tabBarItem = items.get(this.tabBar);\n\n // Lookup the widget layout item.\n let current = this.tabBar.currentTitle;\n let widgetItem = current ? items.get(current.owner) : undefined;\n\n // Distribute the layout space to the sizers.\n BoxEngine.calc(this.sizers, height);\n\n // Update the tab bar item using the computed size.\n if (tabBarItem && !tabBarItem.isHidden) {\n let size = this.sizers[0].size;\n tabBarItem.update(left, top, width, size);\n top += size;\n }\n\n // Layout the widget using the computed size.\n if (widgetItem && !widgetItem.isHidden) {\n let size = this.sizers[1].size;\n widgetItem.update(left, top, width, size);\n }\n }\n\n private _top = 0;\n private _left = 0;\n private _width = 0;\n private _height = 0;\n }\n\n /**\n * A layout node which holds the data for a split area.\n */\n export class SplitLayoutNode {\n /**\n * Construct a new split layout node.\n *\n * @param orientation - The orientation of the node.\n */\n constructor(orientation: Orientation) {\n this.orientation = orientation;\n }\n\n /**\n * The parent of the layout node.\n */\n parent: SplitLayoutNode | null = null;\n\n /**\n * Whether the sizers have been normalized.\n */\n normalized = false;\n\n /**\n * The orientation of the node.\n */\n readonly orientation: Orientation;\n\n /**\n * The child nodes for the split node.\n */\n readonly children: LayoutNode[] = [];\n\n /**\n * The box sizers for the layout children.\n */\n readonly sizers: BoxSizer[] = [];\n\n /**\n * The handles for the layout children.\n */\n readonly handles: HTMLDivElement[] = [];\n\n /**\n * Create an iterator for all widgets in the layout tree.\n */\n *iterAllWidgets(): IterableIterator {\n for (const child of this.children) {\n yield* child.iterAllWidgets();\n }\n }\n\n /**\n * Create an iterator for the user widgets in the layout tree.\n */\n *iterUserWidgets(): IterableIterator {\n for (const child of this.children) {\n yield* child.iterUserWidgets();\n }\n }\n\n /**\n * Create an iterator for the selected widgets in the layout tree.\n */\n *iterSelectedWidgets(): IterableIterator {\n for (const child of this.children) {\n yield* child.iterSelectedWidgets();\n }\n }\n\n /**\n * Create an iterator for the tab bars in the layout tree.\n */\n *iterTabBars(): IterableIterator> {\n for (const child of this.children) {\n yield* child.iterTabBars();\n }\n }\n\n /**\n * Create an iterator for the handles in the layout tree.\n */\n *iterHandles(): IterableIterator {\n yield* this.handles;\n for (const child of this.children) {\n yield* child.iterHandles();\n }\n }\n\n /**\n * Find the tab layout node which contains the given widget.\n */\n findTabNode(widget: Widget): TabLayoutNode | null {\n for (let i = 0, n = this.children.length; i < n; ++i) {\n let result = this.children[i].findTabNode(widget);\n if (result) {\n return result;\n }\n }\n return null;\n }\n\n /**\n * Find the split layout node which contains the given handle.\n */\n findSplitNode(\n handle: HTMLDivElement\n ): { index: number; node: SplitLayoutNode } | null {\n let index = this.handles.indexOf(handle);\n if (index !== -1) {\n return { index, node: this };\n }\n for (let i = 0, n = this.children.length; i < n; ++i) {\n let result = this.children[i].findSplitNode(handle);\n if (result) {\n return result;\n }\n }\n return null;\n }\n\n /**\n * Find the first tab layout node in a layout tree.\n */\n findFirstTabNode(): TabLayoutNode | null {\n if (this.children.length === 0) {\n return null;\n }\n return this.children[0].findFirstTabNode();\n }\n\n /**\n * Find the tab layout node which contains the local point.\n */\n hitTestTabNodes(x: number, y: number): TabLayoutNode | null {\n for (let i = 0, n = this.children.length; i < n; ++i) {\n let result = this.children[i].hitTestTabNodes(x, y);\n if (result) {\n return result;\n }\n }\n return null;\n }\n\n /**\n * Create a configuration object for the layout tree.\n */\n createConfig(): DockLayout.ISplitAreaConfig {\n let orientation = this.orientation;\n let sizes = this.createNormalizedSizes();\n let children = this.children.map(child => child.createConfig());\n return { type: 'split-area', orientation, children, sizes };\n }\n\n /**\n * Sync the visibility and orientation of the handles.\n */\n syncHandles(): void {\n this.handles.forEach((handle, i) => {\n handle.setAttribute('data-orientation', this.orientation);\n if (i === this.handles.length - 1) {\n handle.classList.add('lm-mod-hidden');\n } else {\n handle.classList.remove('lm-mod-hidden');\n }\n });\n }\n\n /**\n * Hold the current sizes of the box sizers.\n *\n * This sets the size hint of each sizer to its current size.\n */\n holdSizes(): void {\n for (const sizer of this.sizers) {\n sizer.sizeHint = sizer.size;\n }\n }\n\n /**\n * Recursively hold all of the sizes in the layout tree.\n *\n * This ignores the sizers of tab layout nodes.\n */\n holdAllSizes(): void {\n for (const child of this.children) {\n child.holdAllSizes();\n }\n this.holdSizes();\n }\n\n /**\n * Normalize the sizes of the split layout node.\n */\n normalizeSizes(): void {\n // Bail early if the sizers are empty.\n let n = this.sizers.length;\n if (n === 0) {\n return;\n }\n\n // Hold the current sizes of the sizers.\n this.holdSizes();\n\n // Compute the sum of the sizes.\n let sum = this.sizers.reduce((v, sizer) => v + sizer.sizeHint, 0);\n\n // Normalize the sizes based on the sum.\n if (sum === 0) {\n for (const sizer of this.sizers) {\n sizer.size = sizer.sizeHint = 1 / n;\n }\n } else {\n for (const sizer of this.sizers) {\n sizer.size = sizer.sizeHint /= sum;\n }\n }\n\n // Mark the sizes as normalized.\n this.normalized = true;\n }\n\n /**\n * Snap the normalized sizes of the split layout node.\n */\n createNormalizedSizes(): number[] {\n // Bail early if the sizers are empty.\n let n = this.sizers.length;\n if (n === 0) {\n return [];\n }\n\n // Grab the current sizes of the sizers.\n let sizes = this.sizers.map(sizer => sizer.size);\n\n // Compute the sum of the sizes.\n let sum = sizes.reduce((v, size) => v + size, 0);\n\n // Normalize the sizes based on the sum.\n if (sum === 0) {\n for (let i = sizes.length - 1; i > -1; i--) {\n sizes[i] = 1 / n;\n }\n } else {\n for (let i = sizes.length - 1; i > -1; i--) {\n sizes[i] /= sum;\n }\n }\n\n // Return the normalized sizes.\n return sizes;\n }\n\n /**\n * Fit the layout tree.\n */\n fit(spacing: number, items: ItemMap): ElementExt.ISizeLimits {\n // Compute the required fixed space.\n let horizontal = this.orientation === 'horizontal';\n let fixed = Math.max(0, this.children.length - 1) * spacing;\n\n // Set up the limit variables.\n let minWidth = horizontal ? fixed : 0;\n let minHeight = horizontal ? 0 : fixed;\n let maxWidth = Infinity;\n let maxHeight = Infinity;\n\n // Fit the children and update the limits.\n for (let i = 0, n = this.children.length; i < n; ++i) {\n let limits = this.children[i].fit(spacing, items);\n if (horizontal) {\n minHeight = Math.max(minHeight, limits.minHeight);\n minWidth += limits.minWidth;\n this.sizers[i].minSize = limits.minWidth;\n } else {\n minWidth = Math.max(minWidth, limits.minWidth);\n minHeight += limits.minHeight;\n this.sizers[i].minSize = limits.minHeight;\n }\n }\n\n // Return the computed limits for the layout node.\n return { minWidth, minHeight, maxWidth, maxHeight };\n }\n\n /**\n * Update the layout tree.\n */\n update(\n left: number,\n top: number,\n width: number,\n height: number,\n spacing: number,\n items: ItemMap\n ): void {\n // Compute the available layout space.\n let horizontal = this.orientation === 'horizontal';\n let fixed = Math.max(0, this.children.length - 1) * spacing;\n let space = Math.max(0, (horizontal ? width : height) - fixed);\n\n // De-normalize the sizes if needed.\n if (this.normalized) {\n for (const sizer of this.sizers) {\n sizer.sizeHint *= space;\n }\n this.normalized = false;\n }\n\n // Distribute the layout space to the sizers.\n BoxEngine.calc(this.sizers, space);\n\n // Update the geometry of the child nodes and handles.\n for (let i = 0, n = this.children.length; i < n; ++i) {\n let child = this.children[i];\n let size = this.sizers[i].size;\n let handleStyle = this.handles[i].style;\n if (horizontal) {\n child.update(left, top, size, height, spacing, items);\n left += size;\n handleStyle.top = `${top}px`;\n handleStyle.left = `${left}px`;\n handleStyle.width = `${spacing}px`;\n handleStyle.height = `${height}px`;\n left += spacing;\n } else {\n child.update(left, top, width, size, spacing, items);\n top += size;\n handleStyle.top = `${top}px`;\n handleStyle.left = `${left}px`;\n handleStyle.width = `${width}px`;\n handleStyle.height = `${spacing}px`;\n top += spacing;\n }\n }\n }\n }\n\n export function addAria(widget: Widget, tabBar: TabBar): void {\n widget.node.setAttribute('role', 'tabpanel');\n let renderer = tabBar.renderer;\n if (renderer instanceof TabBar.Renderer) {\n let tabId = renderer.createTabKey({\n title: widget.title,\n current: false,\n zIndex: 0\n });\n widget.node.setAttribute('aria-labelledby', tabId);\n }\n }\n\n export function removeAria(widget: Widget): void {\n widget.node.removeAttribute('role');\n widget.node.removeAttribute('aria-labelledby');\n }\n\n /**\n * Normalize a tab area config and collect the visited widgets.\n */\n function normalizeTabAreaConfig(\n config: DockLayout.ITabAreaConfig,\n widgetSet: Set\n ): DockLayout.ITabAreaConfig | null {\n // Bail early if there is no content.\n if (config.widgets.length === 0) {\n return null;\n }\n\n // Setup the filtered widgets array.\n let widgets: Widget[] = [];\n\n // Filter the config for unique widgets.\n for (const widget of config.widgets) {\n if (!widgetSet.has(widget)) {\n widgetSet.add(widget);\n widgets.push(widget);\n }\n }\n\n // Bail if there are no effective widgets.\n if (widgets.length === 0) {\n return null;\n }\n\n // Normalize the current index.\n let index = config.currentIndex;\n if (index !== -1 && (index < 0 || index >= widgets.length)) {\n index = 0;\n }\n\n // Return a normalized config object.\n return { type: 'tab-area', widgets, currentIndex: index };\n }\n\n /**\n * Normalize a split area config and collect the visited widgets.\n */\n function normalizeSplitAreaConfig(\n config: DockLayout.ISplitAreaConfig,\n widgetSet: Set\n ): DockLayout.AreaConfig | null {\n // Set up the result variables.\n let orientation = config.orientation;\n let children: DockLayout.AreaConfig[] = [];\n let sizes: number[] = [];\n\n // Normalize the config children.\n for (let i = 0, n = config.children.length; i < n; ++i) {\n // Normalize the child config.\n let child = normalizeAreaConfig(config.children[i], widgetSet);\n\n // Ignore an empty child.\n if (!child) {\n continue;\n }\n\n // Add the child or hoist its content as appropriate.\n if (child.type === 'tab-area' || child.orientation !== orientation) {\n children.push(child);\n sizes.push(Math.abs(config.sizes[i] || 0));\n } else {\n children.push(...child.children);\n sizes.push(...child.sizes);\n }\n }\n\n // Bail if there are no effective children.\n if (children.length === 0) {\n return null;\n }\n\n // If there is only one effective child, return that child.\n if (children.length === 1) {\n return children[0];\n }\n\n // Return a normalized config object.\n return { type: 'split-area', orientation, children, sizes };\n }\n\n /**\n * Convert a normalized tab area config into a layout tree.\n */\n function realizeTabAreaConfig(\n config: DockLayout.ITabAreaConfig,\n renderer: DockLayout.IRenderer,\n document: Document | ShadowRoot\n ): TabLayoutNode {\n // Create the tab bar for the layout node.\n let tabBar = renderer.createTabBar(document);\n\n // Hide each widget and add it to the tab bar.\n for (const widget of config.widgets) {\n widget.hide();\n tabBar.addTab(widget.title);\n Private.addAria(widget, tabBar);\n }\n\n // Set the current index of the tab bar.\n tabBar.currentIndex = config.currentIndex;\n\n // Return the new tab layout node.\n return new TabLayoutNode(tabBar);\n }\n\n /**\n * Convert a normalized split area config into a layout tree.\n */\n function realizeSplitAreaConfig(\n config: DockLayout.ISplitAreaConfig,\n renderer: DockLayout.IRenderer,\n document: Document | ShadowRoot\n ): SplitLayoutNode {\n // Create the split layout node.\n let node = new SplitLayoutNode(config.orientation);\n\n // Add each child to the layout node.\n config.children.forEach((child, i) => {\n // Create the child data for the layout node.\n let childNode = realizeAreaConfig(child, renderer, document);\n let sizer = createSizer(config.sizes[i]);\n let handle = renderer.createHandle();\n\n // Add the child data to the layout node.\n node.children.push(childNode);\n node.handles.push(handle);\n node.sizers.push(sizer);\n\n // Update the parent for the child node.\n childNode.parent = node;\n });\n\n // Synchronize the handle state for the layout node.\n node.syncHandles();\n\n // Normalize the sizes for the layout node.\n node.normalizeSizes();\n\n // Return the new layout node.\n return node;\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { find } from '@lumino/algorithm';\n\nimport { MimeData } from '@lumino/coreutils';\n\nimport { IDisposable } from '@lumino/disposable';\n\nimport { ElementExt, Platform } from '@lumino/domutils';\n\nimport { Drag } from '@lumino/dragdrop';\n\nimport { ConflatableMessage, Message, MessageLoop } from '@lumino/messaging';\n\nimport { AttachedProperty } from '@lumino/properties';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { DockLayout } from './docklayout';\n\nimport { TabBar } from './tabbar';\n\nimport { Widget } from './widget';\n\n/**\n * A widget which provides a flexible docking area for widgets.\n *\n * #### Notes\n * See also the related [example](../../examples/dockpanel/index.html) and\n * its [source](https://github.com/jupyterlab/lumino/tree/main/examples/example-dockpanel).\n */\nexport class DockPanel extends Widget {\n /**\n * Construct a new dock panel.\n *\n * @param options - The options for initializing the panel.\n */\n constructor(options: DockPanel.IOptions = {}) {\n super();\n this.addClass('lm-DockPanel');\n this._document = options.document || document;\n this._mode = options.mode || 'multiple-document';\n this._renderer = options.renderer || DockPanel.defaultRenderer;\n this._edges = options.edges || Private.DEFAULT_EDGES;\n if (options.tabsMovable !== undefined) {\n this._tabsMovable = options.tabsMovable;\n }\n if (options.tabsConstrained !== undefined) {\n this._tabsConstrained = options.tabsConstrained;\n }\n if (options.addButtonEnabled !== undefined) {\n this._addButtonEnabled = options.addButtonEnabled;\n }\n\n // Toggle the CSS mode attribute.\n this.dataset['mode'] = this._mode;\n\n // Create the delegate renderer for the layout.\n let renderer: DockPanel.IRenderer = {\n createTabBar: () => this._createTabBar(),\n createHandle: () => this._createHandle()\n };\n\n // Set up the dock layout for the panel.\n this.layout = new DockLayout({\n document: this._document,\n renderer,\n spacing: options.spacing,\n hiddenMode: options.hiddenMode\n });\n\n // Set up the overlay drop indicator.\n this.overlay = options.overlay || new DockPanel.Overlay();\n this.node.appendChild(this.overlay.node);\n }\n\n /**\n * Dispose of the resources held by the panel.\n */\n dispose(): void {\n // Ensure the mouse is released.\n this._releaseMouse();\n\n // Hide the overlay.\n this.overlay.hide(0);\n\n // Cancel a drag if one is in progress.\n if (this._drag) {\n this._drag.dispose();\n }\n\n // Dispose of the base class.\n super.dispose();\n }\n\n /**\n * The method for hiding widgets.\n */\n get hiddenMode(): Widget.HiddenMode {\n return (this.layout as DockLayout).hiddenMode;\n }\n\n /**\n * Set the method for hiding widgets.\n */\n set hiddenMode(v: Widget.HiddenMode) {\n (this.layout as DockLayout).hiddenMode = v;\n }\n\n /**\n * A signal emitted when the layout configuration is modified.\n *\n * #### Notes\n * This signal is emitted whenever the current layout configuration\n * may have changed.\n *\n * This signal is emitted asynchronously in a collapsed fashion, so\n * that multiple synchronous modifications results in only a single\n * emit of the signal.\n */\n get layoutModified(): ISignal {\n return this._layoutModified;\n }\n\n /**\n * A signal emitted when the add button on a tab bar is clicked.\n *\n */\n get addRequested(): ISignal> {\n return this._addRequested;\n }\n\n /**\n * The overlay used by the dock panel.\n */\n readonly overlay: DockPanel.IOverlay;\n\n /**\n * The renderer used by the dock panel.\n */\n get renderer(): DockPanel.IRenderer {\n return (this.layout as DockLayout).renderer;\n }\n\n /**\n * Get the spacing between the widgets.\n */\n get spacing(): number {\n return (this.layout as DockLayout).spacing;\n }\n\n /**\n * Set the spacing between the widgets.\n */\n set spacing(value: number) {\n (this.layout as DockLayout).spacing = value;\n }\n\n /**\n * Get the mode for the dock panel.\n */\n get mode(): DockPanel.Mode {\n return this._mode;\n }\n\n /**\n * Set the mode for the dock panel.\n *\n * #### Notes\n * Changing the mode is a destructive operation with respect to the\n * panel's layout configuration. If layout state must be preserved,\n * save the current layout config before changing the mode.\n */\n set mode(value: DockPanel.Mode) {\n // Bail early if the mode does not change.\n if (this._mode === value) {\n return;\n }\n\n // Update the internal mode.\n this._mode = value;\n\n // Toggle the CSS mode attribute.\n this.dataset['mode'] = value;\n\n // Get the layout for the panel.\n let layout = this.layout as DockLayout;\n\n // Configure the layout for the specified mode.\n switch (value) {\n case 'multiple-document':\n for (const tabBar of layout.tabBars()) {\n tabBar.show();\n }\n break;\n case 'single-document':\n layout.restoreLayout(Private.createSingleDocumentConfig(this));\n break;\n default:\n throw 'unreachable';\n }\n\n // Schedule an emit of the layout modified signal.\n MessageLoop.postMessage(this, Private.LayoutModified);\n }\n\n /**\n * Whether the tabs can be dragged / moved at runtime.\n */\n get tabsMovable(): boolean {\n return this._tabsMovable;\n }\n\n /**\n * Enable / Disable draggable / movable tabs.\n */\n set tabsMovable(value: boolean) {\n this._tabsMovable = value;\n for (const tabBar of this.tabBars()) {\n tabBar.tabsMovable = value;\n }\n }\n\n /**\n * Whether the tabs are constrained to their source dock panel\n */\n get tabsConstrained(): boolean {\n return this._tabsConstrained;\n }\n\n /**\n * Constrain/Allow tabs to be dragged outside of this dock panel\n */\n set tabsConstrained(value: boolean) {\n this._tabsConstrained = value;\n }\n\n /**\n * Whether the add buttons for each tab bar are enabled.\n */\n get addButtonEnabled(): boolean {\n return this._addButtonEnabled;\n }\n\n /**\n * Set whether the add buttons for each tab bar are enabled.\n */\n set addButtonEnabled(value: boolean) {\n this._addButtonEnabled = value;\n for (const tabBar of this.tabBars()) {\n tabBar.addButtonEnabled = value;\n }\n }\n\n /**\n * Whether the dock panel is empty.\n */\n get isEmpty(): boolean {\n return (this.layout as DockLayout).isEmpty;\n }\n\n /**\n * Create an iterator over the user widgets in the panel.\n *\n * @returns A new iterator over the user widgets in the panel.\n *\n * #### Notes\n * This iterator does not include the generated tab bars.\n */\n *widgets(): IterableIterator {\n yield* (this.layout as DockLayout).widgets();\n }\n\n /**\n * Create an iterator over the selected widgets in the panel.\n *\n * @returns A new iterator over the selected user widgets.\n *\n * #### Notes\n * This iterator yields the widgets corresponding to the current tab\n * of each tab bar in the panel.\n */\n *selectedWidgets(): IterableIterator {\n yield* (this.layout as DockLayout).selectedWidgets();\n }\n\n /**\n * Create an iterator over the tab bars in the panel.\n *\n * @returns A new iterator over the tab bars in the panel.\n *\n * #### Notes\n * This iterator does not include the user widgets.\n */\n *tabBars(): IterableIterator> {\n yield* (this.layout as DockLayout).tabBars();\n }\n\n /**\n * Create an iterator over the handles in the panel.\n *\n * @returns A new iterator over the handles in the panel.\n */\n *handles(): IterableIterator {\n yield* (this.layout as DockLayout).handles();\n }\n\n /**\n * Select a specific widget in the dock panel.\n *\n * @param widget - The widget of interest.\n *\n * #### Notes\n * This will make the widget the current widget in its tab area.\n */\n selectWidget(widget: Widget): void {\n // Find the tab bar which contains the widget.\n let tabBar = find(this.tabBars(), bar => {\n return bar.titles.indexOf(widget.title) !== -1;\n });\n\n // Throw an error if no tab bar is found.\n if (!tabBar) {\n throw new Error('Widget is not contained in the dock panel.');\n }\n\n // Ensure the widget is the current widget.\n tabBar.currentTitle = widget.title;\n }\n\n /**\n * Activate a specified widget in the dock panel.\n *\n * @param widget - The widget of interest.\n *\n * #### Notes\n * This will select and activate the given widget.\n */\n activateWidget(widget: Widget): void {\n this.selectWidget(widget);\n widget.activate();\n }\n\n /**\n * Save the current layout configuration of the dock panel.\n *\n * @returns A new config object for the current layout state.\n *\n * #### Notes\n * The return value can be provided to the `restoreLayout` method\n * in order to restore the layout to its current configuration.\n */\n saveLayout(): DockPanel.ILayoutConfig {\n return (this.layout as DockLayout).saveLayout();\n }\n\n /**\n * Restore the layout to a previously saved configuration.\n *\n * @param config - The layout configuration to restore.\n *\n * #### Notes\n * Widgets which currently belong to the layout but which are not\n * contained in the config will be unparented.\n *\n * The dock panel automatically reverts to `'multiple-document'`\n * mode when a layout config is restored.\n */\n restoreLayout(config: DockPanel.ILayoutConfig): void {\n // Reset the mode.\n this._mode = 'multiple-document';\n\n // Restore the layout.\n (this.layout as DockLayout).restoreLayout(config);\n\n // Flush the message loop on IE and Edge to prevent flicker.\n if (Platform.IS_EDGE || Platform.IS_IE) {\n MessageLoop.flush();\n }\n\n // Schedule an emit of the layout modified signal.\n MessageLoop.postMessage(this, Private.LayoutModified);\n }\n\n /**\n * Add a widget to the dock panel.\n *\n * @param widget - The widget to add to the dock panel.\n *\n * @param options - The additional options for adding the widget.\n *\n * #### Notes\n * If the panel is in single document mode, the options are ignored\n * and the widget is always added as tab in the hidden tab bar.\n */\n addWidget(widget: Widget, options: DockPanel.IAddOptions = {}): void {\n // Add the widget to the layout.\n if (this._mode === 'single-document') {\n (this.layout as DockLayout).addWidget(widget);\n } else {\n (this.layout as DockLayout).addWidget(widget, options);\n }\n\n // Schedule an emit of the layout modified signal.\n MessageLoop.postMessage(this, Private.LayoutModified);\n }\n\n /**\n * Process a message sent to the widget.\n *\n * @param msg - The message sent to the widget.\n */\n processMessage(msg: Message): void {\n if (msg.type === 'layout-modified') {\n this._layoutModified.emit(undefined);\n } else {\n super.processMessage(msg);\n }\n }\n\n /**\n * Handle the DOM events for the dock panel.\n *\n * @param event - The DOM event sent to the panel.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the panel's DOM node. It should\n * not be called directly by user code.\n */\n handleEvent(event: Event): void {\n switch (event.type) {\n case 'lm-dragenter':\n this._evtDragEnter(event as Drag.Event);\n break;\n case 'lm-dragleave':\n this._evtDragLeave(event as Drag.Event);\n break;\n case 'lm-dragover':\n this._evtDragOver(event as Drag.Event);\n break;\n case 'lm-drop':\n this._evtDrop(event as Drag.Event);\n break;\n case 'pointerdown':\n this._evtPointerDown(event as PointerEvent);\n break;\n case 'pointermove':\n this._evtPointerMove(event as PointerEvent);\n break;\n case 'pointerup':\n this._evtPointerUp(event as PointerEvent);\n break;\n case 'keydown':\n this._evtKeyDown(event as KeyboardEvent);\n break;\n case 'contextmenu':\n event.preventDefault();\n event.stopPropagation();\n break;\n }\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n this.node.addEventListener('lm-dragenter', this);\n this.node.addEventListener('lm-dragleave', this);\n this.node.addEventListener('lm-dragover', this);\n this.node.addEventListener('lm-drop', this);\n this.node.addEventListener('pointerdown', this);\n }\n\n /**\n * A message handler invoked on an `'after-detach'` message.\n */\n protected onAfterDetach(msg: Message): void {\n this.node.removeEventListener('lm-dragenter', this);\n this.node.removeEventListener('lm-dragleave', this);\n this.node.removeEventListener('lm-dragover', this);\n this.node.removeEventListener('lm-drop', this);\n this.node.removeEventListener('pointerdown', this);\n this._releaseMouse();\n }\n\n /**\n * A message handler invoked on a `'child-added'` message.\n */\n protected onChildAdded(msg: Widget.ChildMessage): void {\n // Ignore the generated tab bars.\n if (Private.isGeneratedTabBarProperty.get(msg.child)) {\n return;\n }\n\n // Add the widget class to the child.\n msg.child.addClass('lm-DockPanel-widget');\n }\n\n /**\n * A message handler invoked on a `'child-removed'` message.\n */\n protected onChildRemoved(msg: Widget.ChildMessage): void {\n // Ignore the generated tab bars.\n if (Private.isGeneratedTabBarProperty.get(msg.child)) {\n return;\n }\n\n // Remove the widget class from the child.\n msg.child.removeClass('lm-DockPanel-widget');\n\n // Schedule an emit of the layout modified signal.\n MessageLoop.postMessage(this, Private.LayoutModified);\n }\n\n /**\n * Handle the `'lm-dragenter'` event for the dock panel.\n */\n private _evtDragEnter(event: Drag.Event): void {\n // If the factory mime type is present, mark the event as\n // handled in order to get the rest of the drag events.\n if (event.mimeData.hasData('application/vnd.lumino.widget-factory')) {\n event.preventDefault();\n event.stopPropagation();\n }\n }\n\n /**\n * Handle the `'lm-dragleave'` event for the dock panel.\n */\n private _evtDragLeave(event: Drag.Event): void {\n // Mark the event as handled.\n event.preventDefault();\n\n if (this._tabsConstrained && event.source !== this) return;\n\n event.stopPropagation();\n\n // The new target might be a descendant, so we might still handle the drop.\n // Hide asynchronously so that if a lm-dragover event bubbles up to us, the\n // hide is cancelled by the lm-dragover handler's show overlay logic.\n this.overlay.hide(1);\n }\n\n /**\n * Handle the `'lm-dragover'` event for the dock panel.\n */\n private _evtDragOver(event: Drag.Event): void {\n // Mark the event as handled.\n event.preventDefault();\n\n // Show the drop indicator overlay and update the drop\n // action based on the drop target zone under the mouse.\n if (\n (this._tabsConstrained && event.source !== this) ||\n this._showOverlay(event.clientX, event.clientY) === 'invalid'\n ) {\n event.dropAction = 'none';\n } else {\n event.stopPropagation();\n event.dropAction = event.proposedAction;\n }\n }\n\n /**\n * Handle the `'lm-drop'` event for the dock panel.\n */\n private _evtDrop(event: Drag.Event): void {\n // Mark the event as handled.\n event.preventDefault();\n\n // Hide the drop indicator overlay.\n this.overlay.hide(0);\n\n // Bail if the proposed action is to do nothing.\n if (event.proposedAction === 'none') {\n event.dropAction = 'none';\n return;\n }\n\n // Find the drop target under the mouse.\n let { clientX, clientY } = event;\n let { zone, target } = Private.findDropTarget(\n this,\n clientX,\n clientY,\n this._edges\n );\n\n // Bail if the drop zone is invalid.\n if (\n (this._tabsConstrained && event.source !== this) ||\n zone === 'invalid'\n ) {\n event.dropAction = 'none';\n return;\n }\n\n // Bail if the factory mime type has invalid data.\n let mimeData = event.mimeData;\n let factory = mimeData.getData('application/vnd.lumino.widget-factory');\n if (typeof factory !== 'function') {\n event.dropAction = 'none';\n return;\n }\n\n // Bail if the factory does not produce a widget.\n let widget = factory();\n if (!(widget instanceof Widget)) {\n event.dropAction = 'none';\n return;\n }\n\n // Bail if the widget is an ancestor of the dock panel.\n if (widget.contains(this)) {\n event.dropAction = 'none';\n return;\n }\n\n // Find the reference widget for the drop target.\n let ref = target ? Private.getDropRef(target.tabBar) : null;\n\n // Add the widget according to the indicated drop zone.\n switch (zone) {\n case 'root-all':\n this.addWidget(widget);\n break;\n case 'root-top':\n this.addWidget(widget, { mode: 'split-top' });\n break;\n case 'root-left':\n this.addWidget(widget, { mode: 'split-left' });\n break;\n case 'root-right':\n this.addWidget(widget, { mode: 'split-right' });\n break;\n case 'root-bottom':\n this.addWidget(widget, { mode: 'split-bottom' });\n break;\n case 'widget-all':\n this.addWidget(widget, { mode: 'tab-after', ref });\n break;\n case 'widget-top':\n this.addWidget(widget, { mode: 'split-top', ref });\n break;\n case 'widget-left':\n this.addWidget(widget, { mode: 'split-left', ref });\n break;\n case 'widget-right':\n this.addWidget(widget, { mode: 'split-right', ref });\n break;\n case 'widget-bottom':\n this.addWidget(widget, { mode: 'split-bottom', ref });\n break;\n case 'widget-tab':\n this.addWidget(widget, { mode: 'tab-after', ref });\n break;\n default:\n throw 'unreachable';\n }\n\n // Accept the proposed drop action.\n event.dropAction = event.proposedAction;\n\n // Stop propagation if we have not bailed so far.\n event.stopPropagation();\n\n // Activate the dropped widget.\n this.activateWidget(widget);\n }\n\n /**\n * Handle the `'keydown'` event for the dock panel.\n */\n private _evtKeyDown(event: KeyboardEvent): void {\n // Stop input events during drag.\n event.preventDefault();\n event.stopPropagation();\n\n // Release the mouse if `Escape` is pressed.\n if (event.keyCode === 27) {\n // Finalize the mouse release.\n this._releaseMouse();\n\n // Schedule an emit of the layout modified signal.\n MessageLoop.postMessage(this, Private.LayoutModified);\n }\n }\n\n /**\n * Handle the `'pointerdown'` event for the dock panel.\n */\n private _evtPointerDown(event: PointerEvent): void {\n // Do nothing if the left mouse button is not pressed.\n if (event.button !== 0) {\n return;\n }\n\n // Find the handle which contains the mouse target, if any.\n let layout = this.layout as DockLayout;\n let target = event.target as HTMLElement;\n let handle = find(layout.handles(), handle => handle.contains(target));\n if (!handle) {\n return;\n }\n\n // Stop the event when a handle is pressed.\n event.preventDefault();\n event.stopPropagation();\n\n // Add the extra document listeners.\n this._document.addEventListener('keydown', this, true);\n this._document.addEventListener('pointerup', this, true);\n this._document.addEventListener('pointermove', this, true);\n this._document.addEventListener('contextmenu', this, true);\n\n // Compute the offset deltas for the handle press.\n let rect = handle.getBoundingClientRect();\n let deltaX = event.clientX - rect.left;\n let deltaY = event.clientY - rect.top;\n\n // Override the cursor and store the press data.\n let style = window.getComputedStyle(handle);\n let override = Drag.overrideCursor(style.cursor!, this._document);\n this._pressData = { handle, deltaX, deltaY, override };\n }\n\n /**\n * Handle the `'pointermove'` event for the dock panel.\n */\n private _evtPointerMove(event: PointerEvent): void {\n // Bail early if no drag is in progress.\n if (!this._pressData) {\n return;\n }\n\n // Stop the event when dragging a handle.\n event.preventDefault();\n event.stopPropagation();\n\n // Compute the desired offset position for the handle.\n let rect = this.node.getBoundingClientRect();\n let xPos = event.clientX - rect.left - this._pressData.deltaX;\n let yPos = event.clientY - rect.top - this._pressData.deltaY;\n\n // Set the handle as close to the desired position as possible.\n let layout = this.layout as DockLayout;\n layout.moveHandle(this._pressData.handle, xPos, yPos);\n }\n\n /**\n * Handle the `'pointerup'` event for the dock panel.\n */\n private _evtPointerUp(event: PointerEvent): void {\n // Do nothing if the left mouse button is not released.\n if (event.button !== 0) {\n return;\n }\n\n // Stop the event when releasing a handle.\n event.preventDefault();\n event.stopPropagation();\n\n // Finalize the mouse release.\n this._releaseMouse();\n\n // Schedule an emit of the layout modified signal.\n MessageLoop.postMessage(this, Private.LayoutModified);\n }\n\n /**\n * Release the mouse grab for the dock panel.\n */\n private _releaseMouse(): void {\n // Bail early if no drag is in progress.\n if (!this._pressData) {\n return;\n }\n\n // Clear the override cursor.\n this._pressData.override.dispose();\n this._pressData = null;\n\n // Remove the extra document listeners.\n this._document.removeEventListener('keydown', this, true);\n this._document.removeEventListener('pointerup', this, true);\n this._document.removeEventListener('pointermove', this, true);\n this._document.removeEventListener('contextmenu', this, true);\n }\n\n /**\n * Show the overlay indicator at the given client position.\n *\n * Returns the drop zone at the specified client position.\n *\n * #### Notes\n * If the position is not over a valid zone, the overlay is hidden.\n */\n private _showOverlay(clientX: number, clientY: number): Private.DropZone {\n // Find the dock target for the given client position.\n let { zone, target } = Private.findDropTarget(\n this,\n clientX,\n clientY,\n this._edges\n );\n\n // If the drop zone is invalid, hide the overlay and bail.\n if (zone === 'invalid') {\n this.overlay.hide(100);\n return zone;\n }\n\n // Setup the variables needed to compute the overlay geometry.\n let top: number;\n let left: number;\n let right: number;\n let bottom: number;\n let box = ElementExt.boxSizing(this.node); // TODO cache this?\n let rect = this.node.getBoundingClientRect();\n\n // Compute the overlay geometry based on the dock zone.\n switch (zone) {\n case 'root-all':\n top = box.paddingTop;\n left = box.paddingLeft;\n right = box.paddingRight;\n bottom = box.paddingBottom;\n break;\n case 'root-top':\n top = box.paddingTop;\n left = box.paddingLeft;\n right = box.paddingRight;\n bottom = rect.height * Private.GOLDEN_RATIO;\n break;\n case 'root-left':\n top = box.paddingTop;\n left = box.paddingLeft;\n right = rect.width * Private.GOLDEN_RATIO;\n bottom = box.paddingBottom;\n break;\n case 'root-right':\n top = box.paddingTop;\n left = rect.width * Private.GOLDEN_RATIO;\n right = box.paddingRight;\n bottom = box.paddingBottom;\n break;\n case 'root-bottom':\n top = rect.height * Private.GOLDEN_RATIO;\n left = box.paddingLeft;\n right = box.paddingRight;\n bottom = box.paddingBottom;\n break;\n case 'widget-all':\n top = target!.top;\n left = target!.left;\n right = target!.right;\n bottom = target!.bottom;\n break;\n case 'widget-top':\n top = target!.top;\n left = target!.left;\n right = target!.right;\n bottom = target!.bottom + target!.height / 2;\n break;\n case 'widget-left':\n top = target!.top;\n left = target!.left;\n right = target!.right + target!.width / 2;\n bottom = target!.bottom;\n break;\n case 'widget-right':\n top = target!.top;\n left = target!.left + target!.width / 2;\n right = target!.right;\n bottom = target!.bottom;\n break;\n case 'widget-bottom':\n top = target!.top + target!.height / 2;\n left = target!.left;\n right = target!.right;\n bottom = target!.bottom;\n break;\n case 'widget-tab': {\n const tabHeight = target!.tabBar.node.getBoundingClientRect().height;\n top = target!.top;\n left = target!.left;\n right = target!.right;\n bottom = target!.bottom + target!.height - tabHeight;\n break;\n }\n default:\n throw 'unreachable';\n }\n\n // Show the overlay with the computed geometry.\n this.overlay.show({ top, left, right, bottom });\n\n // Finally, return the computed drop zone.\n return zone;\n }\n\n /**\n * Create a new tab bar for use by the panel.\n */\n private _createTabBar(): TabBar {\n // Create the tab bar.\n let tabBar = this._renderer.createTabBar(this._document);\n\n // Set the generated tab bar property for the tab bar.\n Private.isGeneratedTabBarProperty.set(tabBar, true);\n\n // Hide the tab bar when in single document mode.\n if (this._mode === 'single-document') {\n tabBar.hide();\n }\n\n // Enforce necessary tab bar behavior.\n // TODO do we really want to enforce *all* of these?\n tabBar.tabsMovable = this._tabsMovable;\n tabBar.allowDeselect = false;\n tabBar.addButtonEnabled = this._addButtonEnabled;\n tabBar.removeBehavior = 'select-previous-tab';\n tabBar.insertBehavior = 'select-tab-if-needed';\n\n // Connect the signal handlers for the tab bar.\n tabBar.tabMoved.connect(this._onTabMoved, this);\n tabBar.currentChanged.connect(this._onCurrentChanged, this);\n tabBar.tabCloseRequested.connect(this._onTabCloseRequested, this);\n tabBar.tabDetachRequested.connect(this._onTabDetachRequested, this);\n tabBar.tabActivateRequested.connect(this._onTabActivateRequested, this);\n tabBar.addRequested.connect(this._onTabAddRequested, this);\n\n // Return the initialized tab bar.\n return tabBar;\n }\n\n /**\n * Create a new handle for use by the panel.\n */\n private _createHandle(): HTMLDivElement {\n return this._renderer.createHandle();\n }\n\n /**\n * Handle the `tabMoved` signal from a tab bar.\n */\n private _onTabMoved(): void {\n MessageLoop.postMessage(this, Private.LayoutModified);\n }\n\n /**\n * Handle the `currentChanged` signal from a tab bar.\n */\n private _onCurrentChanged(\n sender: TabBar,\n args: TabBar.ICurrentChangedArgs\n ): void {\n // Extract the previous and current title from the args.\n let { previousTitle, currentTitle } = args;\n\n // Hide the previous widget.\n if (previousTitle) {\n previousTitle.owner.hide();\n }\n\n // Show the current widget.\n if (currentTitle) {\n currentTitle.owner.show();\n }\n\n // Flush the message loop on IE and Edge to prevent flicker.\n if (Platform.IS_EDGE || Platform.IS_IE) {\n MessageLoop.flush();\n }\n\n // Schedule an emit of the layout modified signal.\n MessageLoop.postMessage(this, Private.LayoutModified);\n }\n\n /**\n * Handle the `addRequested` signal from a tab bar.\n */\n private _onTabAddRequested(sender: TabBar): void {\n this._addRequested.emit(sender);\n }\n\n /**\n * Handle the `tabActivateRequested` signal from a tab bar.\n */\n private _onTabActivateRequested(\n sender: TabBar,\n args: TabBar.ITabActivateRequestedArgs\n ): void {\n args.title.owner.activate();\n }\n\n /**\n * Handle the `tabCloseRequested` signal from a tab bar.\n */\n private _onTabCloseRequested(\n sender: TabBar,\n args: TabBar.ITabCloseRequestedArgs\n ): void {\n args.title.owner.close();\n }\n\n /**\n * Handle the `tabDetachRequested` signal from a tab bar.\n */\n private _onTabDetachRequested(\n sender: TabBar,\n args: TabBar.ITabDetachRequestedArgs\n ): void {\n // Do nothing if a drag is already in progress.\n if (this._drag) {\n return;\n }\n\n // Release the tab bar's hold on the mouse.\n sender.releaseMouse();\n\n // Extract the data from the args.\n let { title, tab, clientX, clientY, offset } = args;\n\n // Setup the mime data for the drag operation.\n let mimeData = new MimeData();\n let factory = () => title.owner;\n mimeData.setData('application/vnd.lumino.widget-factory', factory);\n\n // Create the drag image for the drag operation.\n let dragImage = tab.cloneNode(true) as HTMLElement;\n if (offset) {\n dragImage.style.top = `-${offset.y}px`;\n dragImage.style.left = `-${offset.x}px`;\n }\n\n // Create the drag object to manage the drag-drop operation.\n this._drag = new Drag({\n document: this._document,\n mimeData,\n dragImage,\n proposedAction: 'move',\n supportedActions: 'move',\n source: this\n });\n\n // Hide the tab node in the original tab.\n tab.classList.add('lm-mod-hidden');\n let cleanup = () => {\n this._drag = null;\n tab.classList.remove('lm-mod-hidden');\n };\n\n // Start the drag operation and cleanup when done.\n this._drag.start(clientX, clientY).then(cleanup);\n }\n\n private _edges: DockPanel.IEdges;\n private _document: Document | ShadowRoot;\n private _mode: DockPanel.Mode;\n private _drag: Drag | null = null;\n private _renderer: DockPanel.IRenderer;\n private _tabsMovable: boolean = true;\n private _tabsConstrained: boolean = false;\n private _addButtonEnabled: boolean = false;\n private _pressData: Private.IPressData | null = null;\n private _layoutModified = new Signal(this);\n\n private _addRequested = new Signal>(this);\n}\n\n/**\n * The namespace for the `DockPanel` class statics.\n */\nexport namespace DockPanel {\n /**\n * An options object for creating a dock panel.\n */\n export interface IOptions {\n /**\n * The document to use with the dock panel.\n *\n * The default is the global `document` instance.\n */\n\n document?: Document | ShadowRoot;\n /**\n * The overlay to use with the dock panel.\n *\n * The default is a new `Overlay` instance.\n */\n overlay?: IOverlay;\n\n /**\n * The renderer to use for the dock panel.\n *\n * The default is a shared renderer instance.\n */\n renderer?: IRenderer;\n\n /**\n * The spacing between the items in the panel.\n *\n * The default is `4`.\n */\n spacing?: number;\n\n /**\n * The mode for the dock panel.\n *\n * The default is `'multiple-document'`.\n */\n mode?: DockPanel.Mode;\n\n /**\n * The sizes of the edge drop zones, in pixels.\n * If not given, default values will be used.\n */\n edges?: IEdges;\n\n /**\n * The method for hiding widgets.\n *\n * The default is `Widget.HiddenMode.Display`.\n */\n hiddenMode?: Widget.HiddenMode;\n\n /**\n * Allow tabs to be draggable / movable by user.\n *\n * The default is `'true'`.\n */\n tabsMovable?: boolean;\n\n /**\n * Constrain tabs to this dock panel\n *\n * The default is `'false'`.\n */\n tabsConstrained?: boolean;\n\n /**\n * Enable add buttons in each of the dock panel's tab bars.\n *\n * The default is `'false'`.\n */\n addButtonEnabled?: boolean;\n }\n\n /**\n * The sizes of the edge drop zones, in pixels.\n */\n export interface IEdges {\n /**\n * The size of the top edge drop zone.\n */\n top: number;\n\n /**\n * The size of the right edge drop zone.\n */\n right: number;\n\n /**\n * The size of the bottom edge drop zone.\n */\n bottom: number;\n\n /**\n * The size of the left edge drop zone.\n */\n left: number;\n }\n\n /**\n * A type alias for the supported dock panel modes.\n */\n export type Mode =\n | /**\n * The single document mode.\n *\n * In this mode, only a single widget is visible at a time, and that\n * widget fills the available layout space. No tab bars are visible.\n */\n 'single-document'\n\n /**\n * The multiple document mode.\n *\n * In this mode, multiple documents are displayed in separate tab\n * areas, and those areas can be individually resized by the user.\n */\n | 'multiple-document';\n\n /**\n * A type alias for a layout configuration object.\n */\n export type ILayoutConfig = DockLayout.ILayoutConfig;\n\n /**\n * A type alias for the supported insertion modes.\n */\n export type InsertMode = DockLayout.InsertMode;\n\n /**\n * A type alias for the add widget options.\n */\n export type IAddOptions = DockLayout.IAddOptions;\n\n /**\n * An object which holds the geometry for overlay positioning.\n */\n export interface IOverlayGeometry {\n /**\n * The distance between the overlay and parent top edges.\n */\n top: number;\n\n /**\n * The distance between the overlay and parent left edges.\n */\n left: number;\n\n /**\n * The distance between the overlay and parent right edges.\n */\n right: number;\n\n /**\n * The distance between the overlay and parent bottom edges.\n */\n bottom: number;\n }\n\n /**\n * An object which manages the overlay node for a dock panel.\n */\n export interface IOverlay {\n /**\n * The DOM node for the overlay.\n */\n readonly node: HTMLDivElement;\n\n /**\n * Show the overlay using the given overlay geometry.\n *\n * @param geo - The desired geometry for the overlay.\n *\n * #### Notes\n * The given geometry values assume the node will use absolute\n * positioning.\n *\n * This is called on every mouse move event during a drag in order\n * to update the position of the overlay. It should be efficient.\n */\n show(geo: IOverlayGeometry): void;\n\n /**\n * Hide the overlay node.\n *\n * @param delay - The delay (in ms) before hiding the overlay.\n * A delay value <= 0 should hide the overlay immediately.\n *\n * #### Notes\n * This is called whenever the overlay node should been hidden.\n */\n hide(delay: number): void;\n }\n\n /**\n * A concrete implementation of `IOverlay`.\n *\n * This is the default overlay implementation for a dock panel.\n */\n export class Overlay implements IOverlay {\n /**\n * Construct a new overlay.\n */\n constructor() {\n this.node = document.createElement('div');\n this.node.classList.add('lm-DockPanel-overlay');\n this.node.classList.add('lm-mod-hidden');\n this.node.style.position = 'absolute';\n this.node.style.contain = 'strict';\n }\n\n /**\n * The DOM node for the overlay.\n */\n readonly node: HTMLDivElement;\n\n /**\n * Show the overlay using the given overlay geometry.\n *\n * @param geo - The desired geometry for the overlay.\n */\n show(geo: IOverlayGeometry): void {\n // Update the position of the overlay.\n let style = this.node.style;\n style.top = `${geo.top}px`;\n style.left = `${geo.left}px`;\n style.right = `${geo.right}px`;\n style.bottom = `${geo.bottom}px`;\n\n // Clear any pending hide timer.\n clearTimeout(this._timer);\n this._timer = -1;\n\n // If the overlay is already visible, we're done.\n if (!this._hidden) {\n return;\n }\n\n // Clear the hidden flag.\n this._hidden = false;\n\n // Finally, show the overlay.\n this.node.classList.remove('lm-mod-hidden');\n }\n\n /**\n * Hide the overlay node.\n *\n * @param delay - The delay (in ms) before hiding the overlay.\n * A delay value <= 0 will hide the overlay immediately.\n */\n hide(delay: number): void {\n // Do nothing if the overlay is already hidden.\n if (this._hidden) {\n return;\n }\n\n // Hide immediately if the delay is <= 0.\n if (delay <= 0) {\n clearTimeout(this._timer);\n this._timer = -1;\n this._hidden = true;\n this.node.classList.add('lm-mod-hidden');\n return;\n }\n\n // Do nothing if a hide is already pending.\n if (this._timer !== -1) {\n return;\n }\n\n // Otherwise setup the hide timer.\n this._timer = window.setTimeout(() => {\n this._timer = -1;\n this._hidden = true;\n this.node.classList.add('lm-mod-hidden');\n }, delay);\n }\n\n private _timer = -1;\n private _hidden = true;\n }\n\n /**\n * A type alias for a dock panel renderer;\n */\n export type IRenderer = DockLayout.IRenderer;\n\n /**\n * The default implementation of `IRenderer`.\n */\n export class Renderer implements IRenderer {\n /**\n * Create a new tab bar for use with a dock panel.\n *\n * @returns A new tab bar for a dock panel.\n */\n createTabBar(document?: Document | ShadowRoot): TabBar {\n let bar = new TabBar({ document });\n bar.addClass('lm-DockPanel-tabBar');\n return bar;\n }\n\n /**\n * Create a new handle node for use with a dock panel.\n *\n * @returns A new handle node for a dock panel.\n */\n createHandle(): HTMLDivElement {\n let handle = document.createElement('div');\n handle.className = 'lm-DockPanel-handle';\n return handle;\n }\n }\n\n /**\n * The default `Renderer` instance.\n */\n export const defaultRenderer = new Renderer();\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * A fraction used for sizing root panels; ~= `1 / golden_ratio`.\n */\n export const GOLDEN_RATIO = 0.618;\n\n /**\n * The default sizes for the edge drop zones, in pixels.\n */\n export const DEFAULT_EDGES = {\n /**\n * The size of the top edge dock zone for the root panel, in pixels.\n * This is different from the others to distinguish between the top\n * tab bar and the top root zone.\n */\n top: 12,\n\n /**\n * The size of the edge dock zone for the root panel, in pixels.\n */\n right: 40,\n\n /**\n * The size of the edge dock zone for the root panel, in pixels.\n */\n bottom: 40,\n\n /**\n * The size of the edge dock zone for the root panel, in pixels.\n */\n left: 40\n };\n\n /**\n * A singleton `'layout-modified'` conflatable message.\n */\n export const LayoutModified = new ConflatableMessage('layout-modified');\n\n /**\n * An object which holds mouse press data.\n */\n export interface IPressData {\n /**\n * The handle which was pressed.\n */\n handle: HTMLDivElement;\n\n /**\n * The X offset of the press in handle coordinates.\n */\n deltaX: number;\n\n /**\n * The Y offset of the press in handle coordinates.\n */\n deltaY: number;\n\n /**\n * The disposable which will clear the override cursor.\n */\n override: IDisposable;\n }\n\n /**\n * A type alias for a drop zone.\n */\n export type DropZone =\n | /**\n * An invalid drop zone.\n */\n 'invalid'\n\n /**\n * The entirety of the root dock area.\n */\n | 'root-all'\n\n /**\n * The top portion of the root dock area.\n */\n | 'root-top'\n\n /**\n * The left portion of the root dock area.\n */\n | 'root-left'\n\n /**\n * The right portion of the root dock area.\n */\n | 'root-right'\n\n /**\n * The bottom portion of the root dock area.\n */\n | 'root-bottom'\n\n /**\n * The entirety of a tabbed widget area.\n */\n | 'widget-all'\n\n /**\n * The top portion of tabbed widget area.\n */\n | 'widget-top'\n\n /**\n * The left portion of tabbed widget area.\n */\n | 'widget-left'\n\n /**\n * The right portion of tabbed widget area.\n */\n | 'widget-right'\n\n /**\n * The bottom portion of tabbed widget area.\n */\n | 'widget-bottom'\n\n /**\n * The the bar of a tabbed widget area.\n */\n | 'widget-tab';\n\n /**\n * An object which holds the drop target zone and widget.\n */\n export interface IDropTarget {\n /**\n * The semantic zone for the mouse position.\n */\n zone: DropZone;\n\n /**\n * The tab area geometry for the drop zone, or `null`.\n */\n target: DockLayout.ITabAreaGeometry | null;\n }\n\n /**\n * An attached property used to track generated tab bars.\n */\n export const isGeneratedTabBarProperty = new AttachedProperty<\n Widget,\n boolean\n >({\n name: 'isGeneratedTabBar',\n create: () => false\n });\n\n /**\n * Create a single document config for the widgets in a dock panel.\n */\n export function createSingleDocumentConfig(\n panel: DockPanel\n ): DockPanel.ILayoutConfig {\n // Return an empty config if the panel is empty.\n if (panel.isEmpty) {\n return { main: null };\n }\n\n // Get a flat array of the widgets in the panel.\n let widgets = Array.from(panel.widgets());\n\n // Get the first selected widget in the panel.\n let selected = panel.selectedWidgets().next().value;\n\n // Compute the current index for the new config.\n let currentIndex = selected ? widgets.indexOf(selected) : -1;\n\n // Return the single document config.\n return { main: { type: 'tab-area', widgets, currentIndex } };\n }\n\n /**\n * Find the drop target at the given client position.\n */\n export function findDropTarget(\n panel: DockPanel,\n clientX: number,\n clientY: number,\n edges: DockPanel.IEdges\n ): IDropTarget {\n // Bail if the mouse is not over the dock panel.\n if (!ElementExt.hitTest(panel.node, clientX, clientY)) {\n return { zone: 'invalid', target: null };\n }\n\n // Look up the layout for the panel.\n let layout = panel.layout as DockLayout;\n\n // If the layout is empty, indicate the entire root drop zone.\n if (layout.isEmpty) {\n return { zone: 'root-all', target: null };\n }\n\n // Test the edge zones when in multiple document mode.\n if (panel.mode === 'multiple-document') {\n // Get the client rect for the dock panel.\n let panelRect = panel.node.getBoundingClientRect();\n\n // Compute the distance to each edge of the panel.\n let pl = clientX - panelRect.left + 1;\n let pt = clientY - panelRect.top + 1;\n let pr = panelRect.right - clientX;\n let pb = panelRect.bottom - clientY;\n\n // Find the minimum distance to an edge.\n let pd = Math.min(pt, pr, pb, pl);\n\n // Return a root zone if the mouse is within an edge.\n switch (pd) {\n case pt:\n if (pt < edges.top) {\n return { zone: 'root-top', target: null };\n }\n break;\n case pr:\n if (pr < edges.right) {\n return { zone: 'root-right', target: null };\n }\n break;\n case pb:\n if (pb < edges.bottom) {\n return { zone: 'root-bottom', target: null };\n }\n break;\n case pl:\n if (pl < edges.left) {\n return { zone: 'root-left', target: null };\n }\n break;\n default:\n throw 'unreachable';\n }\n }\n\n // Hit test the dock layout at the given client position.\n let target = layout.hitTestTabAreas(clientX, clientY);\n\n // Bail if no target area was found.\n if (!target) {\n return { zone: 'invalid', target: null };\n }\n\n // Return the whole tab area when in single document mode.\n if (panel.mode === 'single-document') {\n return { zone: 'widget-all', target };\n }\n\n // Compute the distance to each edge of the tab area.\n let al = target.x - target.left + 1;\n let at = target.y - target.top + 1;\n let ar = target.left + target.width - target.x;\n let ab = target.top + target.height - target.y;\n\n const tabHeight = target.tabBar.node.getBoundingClientRect().height;\n if (at < tabHeight) {\n return { zone: 'widget-tab', target };\n }\n\n // Get the X and Y edge sizes for the area.\n let rx = Math.round(target.width / 3);\n let ry = Math.round(target.height / 3);\n\n // If the mouse is not within an edge, indicate the entire area.\n if (al > rx && ar > rx && at > ry && ab > ry) {\n return { zone: 'widget-all', target };\n }\n\n // Scale the distances by the slenderness ratio.\n al /= rx;\n at /= ry;\n ar /= rx;\n ab /= ry;\n\n // Find the minimum distance to the area edge.\n let ad = Math.min(al, at, ar, ab);\n\n // Find the widget zone for the area edge.\n let zone: DropZone;\n switch (ad) {\n case al:\n zone = 'widget-left';\n break;\n case at:\n zone = 'widget-top';\n break;\n case ar:\n zone = 'widget-right';\n break;\n case ab:\n zone = 'widget-bottom';\n break;\n default:\n throw 'unreachable';\n }\n\n // Return the final drop target.\n return { zone, target };\n }\n\n /**\n * Get the drop reference widget for a tab bar.\n */\n export function getDropRef(tabBar: TabBar): Widget | null {\n if (tabBar.titles.length === 0) {\n return null;\n }\n if (tabBar.currentTitle) {\n return tabBar.currentTitle.owner;\n }\n return tabBar.titles[tabBar.titles.length - 1].owner;\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt, find, max } from '@lumino/algorithm';\n\nimport { IDisposable } from '@lumino/disposable';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { Widget } from './widget';\n\n/**\n * A class which tracks focus among a set of widgets.\n *\n * This class is useful when code needs to keep track of the most\n * recently focused widget(s) among a set of related widgets.\n */\nexport class FocusTracker implements IDisposable {\n /**\n * Dispose of the resources held by the tracker.\n */\n dispose(): void {\n // Do nothing if the tracker is already disposed.\n if (this._counter < 0) {\n return;\n }\n\n // Mark the tracker as disposed.\n this._counter = -1;\n\n // Clear the connections for the tracker.\n Signal.clearData(this);\n\n // Remove all event listeners.\n for (const widget of this._widgets) {\n widget.node.removeEventListener('focus', this, true);\n widget.node.removeEventListener('blur', this, true);\n }\n\n // Clear the internal data structures.\n this._activeWidget = null;\n this._currentWidget = null;\n this._nodes.clear();\n this._numbers.clear();\n this._widgets.length = 0;\n }\n\n /**\n * A signal emitted when the current widget has changed.\n */\n get currentChanged(): ISignal> {\n return this._currentChanged;\n }\n\n /**\n * A signal emitted when the active widget has changed.\n */\n get activeChanged(): ISignal> {\n return this._activeChanged;\n }\n\n /**\n * A flag indicating whether the tracker is disposed.\n */\n get isDisposed(): boolean {\n return this._counter < 0;\n }\n\n /**\n * The current widget in the tracker.\n *\n * #### Notes\n * The current widget is the widget among the tracked widgets which\n * has the *descendant node* which has most recently been focused.\n *\n * The current widget will not be updated if the node loses focus. It\n * will only be updated when a different tracked widget gains focus.\n *\n * If the current widget is removed from the tracker, the previous\n * current widget will be restored.\n *\n * This behavior is intended to follow a user's conceptual model of\n * a semantically \"current\" widget, where the \"last thing of type X\"\n * to be interacted with is the \"current instance of X\", regardless\n * of whether that instance still has focus.\n */\n get currentWidget(): T | null {\n return this._currentWidget;\n }\n\n /**\n * The active widget in the tracker.\n *\n * #### Notes\n * The active widget is the widget among the tracked widgets which\n * has the *descendant node* which is currently focused.\n */\n get activeWidget(): T | null {\n return this._activeWidget;\n }\n\n /**\n * A read only array of the widgets being tracked.\n */\n get widgets(): ReadonlyArray {\n return this._widgets;\n }\n\n /**\n * Get the focus number for a particular widget in the tracker.\n *\n * @param widget - The widget of interest.\n *\n * @returns The focus number for the given widget, or `-1` if the\n * widget has not had focus since being added to the tracker, or\n * is not contained by the tracker.\n *\n * #### Notes\n * The focus number indicates the relative order in which the widgets\n * have gained focus. A widget with a larger number has gained focus\n * more recently than a widget with a smaller number.\n *\n * The `currentWidget` will always have the largest focus number.\n *\n * All widgets start with a focus number of `-1`, which indicates that\n * the widget has not been focused since being added to the tracker.\n */\n focusNumber(widget: T): number {\n let n = this._numbers.get(widget);\n return n === undefined ? -1 : n;\n }\n\n /**\n * Test whether the focus tracker contains a given widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns `true` if the widget is tracked, `false` otherwise.\n */\n has(widget: T): boolean {\n return this._numbers.has(widget);\n }\n\n /**\n * Add a widget to the focus tracker.\n *\n * @param widget - The widget of interest.\n *\n * #### Notes\n * A widget will be automatically removed from the tracker if it\n * is disposed after being added.\n *\n * If the widget is already tracked, this is a no-op.\n */\n add(widget: T): void {\n // Do nothing if the widget is already tracked.\n if (this._numbers.has(widget)) {\n return;\n }\n\n // Test whether the widget has focus.\n let focused = widget.node.contains(document.activeElement);\n\n // Set up the initial focus number.\n let n = focused ? this._counter++ : -1;\n\n // Add the widget to the internal data structures.\n this._widgets.push(widget);\n this._numbers.set(widget, n);\n this._nodes.set(widget.node, widget);\n\n // Set up the event listeners. The capturing phase must be used\n // since the 'focus' and 'blur' events don't bubble and Firefox\n // doesn't support the 'focusin' or 'focusout' events.\n widget.node.addEventListener('focus', this, true);\n widget.node.addEventListener('blur', this, true);\n\n // Connect the disposed signal handler.\n widget.disposed.connect(this._onWidgetDisposed, this);\n\n // Set the current and active widgets if needed.\n if (focused) {\n this._setWidgets(widget, widget);\n }\n }\n\n /**\n * Remove a widget from the focus tracker.\n *\n * #### Notes\n * If the widget is the `currentWidget`, the previous current widget\n * will become the new `currentWidget`.\n *\n * A widget will be automatically removed from the tracker if it\n * is disposed after being added.\n *\n * If the widget is not tracked, this is a no-op.\n */\n remove(widget: T): void {\n // Bail early if the widget is not tracked.\n if (!this._numbers.has(widget)) {\n return;\n }\n\n // Disconnect the disposed signal handler.\n widget.disposed.disconnect(this._onWidgetDisposed, this);\n\n // Remove the event listeners.\n widget.node.removeEventListener('focus', this, true);\n widget.node.removeEventListener('blur', this, true);\n\n // Remove the widget from the internal data structures.\n ArrayExt.removeFirstOf(this._widgets, widget);\n this._nodes.delete(widget.node);\n this._numbers.delete(widget);\n\n // Bail early if the widget is not the current widget.\n if (this._currentWidget !== widget) {\n return;\n }\n\n // Filter the widgets for those which have had focus.\n let valid = this._widgets.filter(w => this._numbers.get(w) !== -1);\n\n // Get the valid widget with the max focus number.\n let previous =\n max(valid, (first, second) => {\n let a = this._numbers.get(first)!;\n let b = this._numbers.get(second)!;\n return a - b;\n }) || null;\n\n // Set the current and active widgets.\n this._setWidgets(previous, null);\n }\n\n /**\n * Handle the DOM events for the focus tracker.\n *\n * @param event - The DOM event sent to the panel.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the tracked nodes. It should\n * not be called directly by user code.\n */\n handleEvent(event: Event): void {\n switch (event.type) {\n case 'focus':\n this._evtFocus(event as FocusEvent);\n break;\n case 'blur':\n this._evtBlur(event as FocusEvent);\n break;\n }\n }\n\n /**\n * Set the current and active widgets for the tracker.\n */\n private _setWidgets(current: T | null, active: T | null): void {\n // Swap the current widget.\n let oldCurrent = this._currentWidget;\n this._currentWidget = current;\n\n // Swap the active widget.\n let oldActive = this._activeWidget;\n this._activeWidget = active;\n\n // Emit the `currentChanged` signal if needed.\n if (oldCurrent !== current) {\n this._currentChanged.emit({ oldValue: oldCurrent, newValue: current });\n }\n\n // Emit the `activeChanged` signal if needed.\n if (oldActive !== active) {\n this._activeChanged.emit({ oldValue: oldActive, newValue: active });\n }\n }\n\n /**\n * Handle the `'focus'` event for a tracked widget.\n */\n private _evtFocus(event: FocusEvent): void {\n // Find the widget which gained focus, which is known to exist.\n let widget = this._nodes.get(event.currentTarget as HTMLElement)!;\n\n // Update the focus number if necessary.\n if (widget !== this._currentWidget) {\n this._numbers.set(widget, this._counter++);\n }\n\n // Set the current and active widgets.\n this._setWidgets(widget, widget);\n }\n\n /**\n * Handle the `'blur'` event for a tracked widget.\n */\n private _evtBlur(event: FocusEvent): void {\n // Find the widget which lost focus, which is known to exist.\n let widget = this._nodes.get(event.currentTarget as HTMLElement)!;\n\n // Get the node which being focused after this blur.\n let focusTarget = event.relatedTarget as HTMLElement;\n\n // If no other node is being focused, clear the active widget.\n if (!focusTarget) {\n this._setWidgets(this._currentWidget, null);\n return;\n }\n\n // Bail if the focus widget is not changing.\n if (widget.node.contains(focusTarget)) {\n return;\n }\n\n // If no tracked widget is being focused, clear the active widget.\n if (!find(this._widgets, w => w.node.contains(focusTarget))) {\n this._setWidgets(this._currentWidget, null);\n return;\n }\n }\n\n /**\n * Handle the `disposed` signal for a tracked widget.\n */\n private _onWidgetDisposed(sender: T): void {\n this.remove(sender);\n }\n\n private _counter = 0;\n private _widgets: T[] = [];\n private _activeWidget: T | null = null;\n private _currentWidget: T | null = null;\n private _numbers = new Map();\n private _nodes = new Map();\n private _activeChanged = new Signal>(this);\n private _currentChanged = new Signal>(\n this\n );\n}\n\n/**\n * The namespace for the `FocusTracker` class statics.\n */\nexport namespace FocusTracker {\n /**\n * An arguments object for the changed signals.\n */\n export interface IChangedArgs {\n /**\n * The old value for the widget.\n */\n oldValue: T | null;\n\n /**\n * The new value for the widget.\n */\n newValue: T | null;\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { AttachedProperty } from '@lumino/properties';\n\nimport { BoxEngine, BoxSizer } from './boxengine';\n\nimport { Layout, LayoutItem } from './layout';\n\nimport { Widget } from './widget';\n\n/**\n * A layout which arranges its widgets in a grid.\n */\nexport class GridLayout extends Layout {\n /**\n * Construct a new grid layout.\n *\n * @param options - The options for initializing the layout.\n */\n constructor(options: GridLayout.IOptions = {}) {\n super(options);\n if (options.rowCount !== undefined) {\n Private.reallocSizers(this._rowSizers, options.rowCount);\n }\n if (options.columnCount !== undefined) {\n Private.reallocSizers(this._columnSizers, options.columnCount);\n }\n if (options.rowSpacing !== undefined) {\n this._rowSpacing = Private.clampValue(options.rowSpacing);\n }\n if (options.columnSpacing !== undefined) {\n this._columnSpacing = Private.clampValue(options.columnSpacing);\n }\n }\n\n /**\n * Dispose of the resources held by the layout.\n */\n dispose(): void {\n // Dispose of the widgets and layout items.\n for (const item of this._items) {\n let widget = item.widget;\n item.dispose();\n widget.dispose();\n }\n\n // Clear the layout state.\n this._box = null;\n this._items.length = 0;\n this._rowStarts.length = 0;\n this._rowSizers.length = 0;\n this._columnStarts.length = 0;\n this._columnSizers.length = 0;\n\n // Dispose of the rest of the layout.\n super.dispose();\n }\n\n /**\n * Get the number of rows in the layout.\n */\n get rowCount(): number {\n return this._rowSizers.length;\n }\n\n /**\n * Set the number of rows in the layout.\n *\n * #### Notes\n * The minimum row count is `1`.\n */\n set rowCount(value: number) {\n // Do nothing if the row count does not change.\n if (value === this.rowCount) {\n return;\n }\n\n // Reallocate the row sizers.\n Private.reallocSizers(this._rowSizers, value);\n\n // Schedule a fit of the parent.\n if (this.parent) {\n this.parent.fit();\n }\n }\n\n /**\n * Get the number of columns in the layout.\n */\n get columnCount(): number {\n return this._columnSizers.length;\n }\n\n /**\n * Set the number of columns in the layout.\n *\n * #### Notes\n * The minimum column count is `1`.\n */\n set columnCount(value: number) {\n // Do nothing if the column count does not change.\n if (value === this.columnCount) {\n return;\n }\n\n // Reallocate the column sizers.\n Private.reallocSizers(this._columnSizers, value);\n\n // Schedule a fit of the parent.\n if (this.parent) {\n this.parent.fit();\n }\n }\n\n /**\n * Get the row spacing for the layout.\n */\n get rowSpacing(): number {\n return this._rowSpacing;\n }\n\n /**\n * Set the row spacing for the layout.\n */\n set rowSpacing(value: number) {\n // Clamp the spacing to the allowed range.\n value = Private.clampValue(value);\n\n // Bail if the spacing does not change\n if (this._rowSpacing === value) {\n return;\n }\n\n // Update the internal spacing.\n this._rowSpacing = value;\n\n // Schedule a fit of the parent.\n if (this.parent) {\n this.parent.fit();\n }\n }\n\n /**\n * Get the column spacing for the layout.\n */\n get columnSpacing(): number {\n return this._columnSpacing;\n }\n\n /**\n * Set the col spacing for the layout.\n */\n set columnSpacing(value: number) {\n // Clamp the spacing to the allowed range.\n value = Private.clampValue(value);\n\n // Bail if the spacing does not change\n if (this._columnSpacing === value) {\n return;\n }\n\n // Update the internal spacing.\n this._columnSpacing = value;\n\n // Schedule a fit of the parent.\n if (this.parent) {\n this.parent.fit();\n }\n }\n\n /**\n * Get the stretch factor for a specific row.\n *\n * @param index - The row index of interest.\n *\n * @returns The stretch factor for the row.\n *\n * #### Notes\n * This returns `-1` if the index is out of range.\n */\n rowStretch(index: number): number {\n let sizer = this._rowSizers[index];\n return sizer ? sizer.stretch : -1;\n }\n\n /**\n * Set the stretch factor for a specific row.\n *\n * @param index - The row index of interest.\n *\n * @param value - The stretch factor for the row.\n *\n * #### Notes\n * This is a no-op if the index is out of range.\n */\n setRowStretch(index: number, value: number): void {\n // Look up the row sizer.\n let sizer = this._rowSizers[index];\n\n // Bail if the index is out of range.\n if (!sizer) {\n return;\n }\n\n // Clamp the value to the allowed range.\n value = Private.clampValue(value);\n\n // Bail if the stretch does not change.\n if (sizer.stretch === value) {\n return;\n }\n\n // Update the sizer stretch.\n sizer.stretch = value;\n\n // Schedule an update of the parent.\n if (this.parent) {\n this.parent.update();\n }\n }\n\n /**\n * Get the stretch factor for a specific column.\n *\n * @param index - The column index of interest.\n *\n * @returns The stretch factor for the column.\n *\n * #### Notes\n * This returns `-1` if the index is out of range.\n */\n columnStretch(index: number): number {\n let sizer = this._columnSizers[index];\n return sizer ? sizer.stretch : -1;\n }\n\n /**\n * Set the stretch factor for a specific column.\n *\n * @param index - The column index of interest.\n *\n * @param value - The stretch factor for the column.\n *\n * #### Notes\n * This is a no-op if the index is out of range.\n */\n setColumnStretch(index: number, value: number): void {\n // Look up the column sizer.\n let sizer = this._columnSizers[index];\n\n // Bail if the index is out of range.\n if (!sizer) {\n return;\n }\n\n // Clamp the value to the allowed range.\n value = Private.clampValue(value);\n\n // Bail if the stretch does not change.\n if (sizer.stretch === value) {\n return;\n }\n\n // Update the sizer stretch.\n sizer.stretch = value;\n\n // Schedule an update of the parent.\n if (this.parent) {\n this.parent.update();\n }\n }\n\n /**\n * Create an iterator over the widgets in the layout.\n *\n * @returns A new iterator over the widgets in the layout.\n */\n *[Symbol.iterator](): IterableIterator {\n for (const item of this._items) {\n yield item.widget;\n }\n }\n\n /**\n * Add a widget to the grid layout.\n *\n * @param widget - The widget to add to the layout.\n *\n * #### Notes\n * If the widget is already contained in the layout, this is no-op.\n */\n addWidget(widget: Widget): void {\n // Look up the index for the widget.\n let i = ArrayExt.findFirstIndex(this._items, it => it.widget === widget);\n\n // Bail if the widget is already in the layout.\n if (i !== -1) {\n return;\n }\n\n // Add the widget to the layout.\n this._items.push(new LayoutItem(widget));\n\n // Attach the widget to the parent.\n if (this.parent) {\n this.attachWidget(widget);\n }\n }\n\n /**\n * Remove a widget from the grid layout.\n *\n * @param widget - The widget to remove from the layout.\n *\n * #### Notes\n * A widget is automatically removed from the layout when its `parent`\n * is set to `null`. This method should only be invoked directly when\n * removing a widget from a layout which has yet to be installed on a\n * parent widget.\n *\n * This method does *not* modify the widget's `parent`.\n */\n removeWidget(widget: Widget): void {\n // Look up the index for the widget.\n let i = ArrayExt.findFirstIndex(this._items, it => it.widget === widget);\n\n // Bail if the widget is not in the layout.\n if (i === -1) {\n return;\n }\n\n // Remove the widget from the layout.\n let item = ArrayExt.removeAt(this._items, i)!;\n\n // Detach the widget from the parent.\n if (this.parent) {\n this.detachWidget(widget);\n }\n\n // Dispose the layout item.\n item.dispose();\n }\n\n /**\n * Perform layout initialization which requires the parent widget.\n */\n protected init(): void {\n super.init();\n for (const widget of this) {\n this.attachWidget(widget);\n }\n }\n\n /**\n * Attach a widget to the parent's DOM node.\n *\n * @param widget - The widget to attach to the parent.\n */\n protected attachWidget(widget: Widget): void {\n // Send a `'before-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n }\n\n // Add the widget's node to the parent.\n this.parent!.node.appendChild(widget.node);\n\n // Send an `'after-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n\n // Post a fit request for the parent widget.\n this.parent!.fit();\n }\n\n /**\n * Detach a widget from the parent's DOM node.\n *\n * @param widget - The widget to detach from the parent.\n */\n protected detachWidget(widget: Widget): void {\n // Send a `'before-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n }\n\n // Remove the widget's node from the parent.\n this.parent!.node.removeChild(widget.node);\n\n // Send an `'after-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n\n // Post a fit request for the parent widget.\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'before-show'` message.\n */\n protected onBeforeShow(msg: Message): void {\n super.onBeforeShow(msg);\n this.parent!.update();\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n super.onBeforeAttach(msg);\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-shown'` message.\n */\n protected onChildShown(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-hidden'` message.\n */\n protected onChildHidden(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'resize'` message.\n */\n protected onResize(msg: Widget.ResizeMessage): void {\n if (this.parent!.isVisible) {\n this._update(msg.width, msg.height);\n }\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n protected onUpdateRequest(msg: Message): void {\n if (this.parent!.isVisible) {\n this._update(-1, -1);\n }\n }\n\n /**\n * A message handler invoked on a `'fit-request'` message.\n */\n protected onFitRequest(msg: Message): void {\n if (this.parent!.isAttached) {\n this._fit();\n }\n }\n\n /**\n * Fit the layout to the total size required by the widgets.\n */\n private _fit(): void {\n // Reset the min sizes of the sizers.\n for (let i = 0, n = this.rowCount; i < n; ++i) {\n this._rowSizers[i].minSize = 0;\n }\n for (let i = 0, n = this.columnCount; i < n; ++i) {\n this._columnSizers[i].minSize = 0;\n }\n\n // Filter for the visible layout items.\n let items = this._items.filter(it => !it.isHidden);\n\n // Fit the layout items.\n for (let i = 0, n = items.length; i < n; ++i) {\n items[i].fit();\n }\n\n // Get the max row and column index.\n let maxRow = this.rowCount - 1;\n let maxCol = this.columnCount - 1;\n\n // Sort the items by row span.\n items.sort(Private.rowSpanCmp);\n\n // Update the min sizes of the row sizers.\n for (let i = 0, n = items.length; i < n; ++i) {\n // Fetch the item.\n let item = items[i];\n\n // Get the row bounds for the item.\n let config = GridLayout.getCellConfig(item.widget);\n let r1 = Math.min(config.row, maxRow);\n let r2 = Math.min(config.row + config.rowSpan - 1, maxRow);\n\n // Distribute the minimum height to the sizers as needed.\n Private.distributeMin(this._rowSizers, r1, r2, item.minHeight);\n }\n\n // Sort the items by column span.\n items.sort(Private.columnSpanCmp);\n\n // Update the min sizes of the column sizers.\n for (let i = 0, n = items.length; i < n; ++i) {\n // Fetch the item.\n let item = items[i];\n\n // Get the column bounds for the item.\n let config = GridLayout.getCellConfig(item.widget);\n let c1 = Math.min(config.column, maxCol);\n let c2 = Math.min(config.column + config.columnSpan - 1, maxCol);\n\n // Distribute the minimum width to the sizers as needed.\n Private.distributeMin(this._columnSizers, c1, c2, item.minWidth);\n }\n\n // If no size constraint is needed, just update the parent.\n if (this.fitPolicy === 'set-no-constraint') {\n MessageLoop.sendMessage(this.parent!, Widget.Msg.UpdateRequest);\n return;\n }\n\n // Set up the computed min size.\n let minH = maxRow * this._rowSpacing;\n let minW = maxCol * this._columnSpacing;\n\n // Add the sizer minimums to the computed min size.\n for (let i = 0, n = this.rowCount; i < n; ++i) {\n minH += this._rowSizers[i].minSize;\n }\n for (let i = 0, n = this.columnCount; i < n; ++i) {\n minW += this._columnSizers[i].minSize;\n }\n\n // Update the box sizing and add it to the computed min size.\n let box = (this._box = ElementExt.boxSizing(this.parent!.node));\n minW += box.horizontalSum;\n minH += box.verticalSum;\n\n // Update the parent's min size constraints.\n let style = this.parent!.node.style;\n style.minWidth = `${minW}px`;\n style.minHeight = `${minH}px`;\n\n // Set the dirty flag to ensure only a single update occurs.\n this._dirty = true;\n\n // Notify the ancestor that it should fit immediately. This may\n // cause a resize of the parent, fulfilling the required update.\n if (this.parent!.parent) {\n MessageLoop.sendMessage(this.parent!.parent!, Widget.Msg.FitRequest);\n }\n\n // If the dirty flag is still set, the parent was not resized.\n // Trigger the required update on the parent widget immediately.\n if (this._dirty) {\n MessageLoop.sendMessage(this.parent!, Widget.Msg.UpdateRequest);\n }\n }\n\n /**\n * Update the layout position and size of the widgets.\n *\n * The parent offset dimensions should be `-1` if unknown.\n */\n private _update(offsetWidth: number, offsetHeight: number): void {\n // Clear the dirty flag to indicate the update occurred.\n this._dirty = false;\n\n // Measure the parent if the offset dimensions are unknown.\n if (offsetWidth < 0) {\n offsetWidth = this.parent!.node.offsetWidth;\n }\n if (offsetHeight < 0) {\n offsetHeight = this.parent!.node.offsetHeight;\n }\n\n // Ensure the parent box sizing data is computed.\n if (!this._box) {\n this._box = ElementExt.boxSizing(this.parent!.node);\n }\n\n // Compute the layout area adjusted for border and padding.\n let top = this._box.paddingTop;\n let left = this._box.paddingLeft;\n let width = offsetWidth - this._box.horizontalSum;\n let height = offsetHeight - this._box.verticalSum;\n\n // Get the max row and column index.\n let maxRow = this.rowCount - 1;\n let maxCol = this.columnCount - 1;\n\n // Compute the total fixed row and column space.\n let fixedRowSpace = maxRow * this._rowSpacing;\n let fixedColSpace = maxCol * this._columnSpacing;\n\n // Distribute the available space to the box sizers.\n BoxEngine.calc(this._rowSizers, Math.max(0, height - fixedRowSpace));\n BoxEngine.calc(this._columnSizers, Math.max(0, width - fixedColSpace));\n\n // Update the row start positions.\n for (let i = 0, pos = top, n = this.rowCount; i < n; ++i) {\n this._rowStarts[i] = pos;\n pos += this._rowSizers[i].size + this._rowSpacing;\n }\n\n // Update the column start positions.\n for (let i = 0, pos = left, n = this.columnCount; i < n; ++i) {\n this._columnStarts[i] = pos;\n pos += this._columnSizers[i].size + this._columnSpacing;\n }\n\n // Update the geometry of the layout items.\n for (let i = 0, n = this._items.length; i < n; ++i) {\n // Fetch the item.\n let item = this._items[i];\n\n // Ignore hidden items.\n if (item.isHidden) {\n continue;\n }\n\n // Fetch the cell bounds for the widget.\n let config = GridLayout.getCellConfig(item.widget);\n let r1 = Math.min(config.row, maxRow);\n let c1 = Math.min(config.column, maxCol);\n let r2 = Math.min(config.row + config.rowSpan - 1, maxRow);\n let c2 = Math.min(config.column + config.columnSpan - 1, maxCol);\n\n // Compute the cell geometry.\n let x = this._columnStarts[c1];\n let y = this._rowStarts[r1];\n let w = this._columnStarts[c2] + this._columnSizers[c2].size - x;\n let h = this._rowStarts[r2] + this._rowSizers[r2].size - y;\n\n // Update the geometry of the layout item.\n item.update(x, y, w, h);\n }\n }\n\n private _dirty = false;\n private _rowSpacing = 4;\n private _columnSpacing = 4;\n private _items: LayoutItem[] = [];\n private _rowStarts: number[] = [];\n private _columnStarts: number[] = [];\n private _rowSizers: BoxSizer[] = [new BoxSizer()];\n private _columnSizers: BoxSizer[] = [new BoxSizer()];\n private _box: ElementExt.IBoxSizing | null = null;\n}\n\n/**\n * The namespace for the `GridLayout` class statics.\n */\nexport namespace GridLayout {\n /**\n * An options object for initializing a grid layout.\n */\n export interface IOptions extends Layout.IOptions {\n /**\n * The initial row count for the layout.\n *\n * The default is `1`.\n */\n rowCount?: number;\n\n /**\n * The initial column count for the layout.\n *\n * The default is `1`.\n */\n columnCount?: number;\n\n /**\n * The spacing between rows in the layout.\n *\n * The default is `4`.\n */\n rowSpacing?: number;\n\n /**\n * The spacing between columns in the layout.\n *\n * The default is `4`.\n */\n columnSpacing?: number;\n }\n\n /**\n * An object which holds the cell configuration for a widget.\n */\n export interface ICellConfig {\n /**\n * The row index for the widget.\n */\n readonly row: number;\n\n /**\n * The column index for the widget.\n */\n readonly column: number;\n\n /**\n * The row span for the widget.\n */\n readonly rowSpan: number;\n\n /**\n * The column span for the widget.\n */\n readonly columnSpan: number;\n }\n\n /**\n * Get the cell config for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The cell config for the widget.\n */\n export function getCellConfig(widget: Widget): ICellConfig {\n return Private.cellConfigProperty.get(widget);\n }\n\n /**\n * Set the cell config for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the cell config.\n */\n export function setCellConfig(\n widget: Widget,\n value: Partial\n ): void {\n Private.cellConfigProperty.set(widget, Private.normalizeConfig(value));\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * The property descriptor for the widget cell config.\n */\n export const cellConfigProperty = new AttachedProperty<\n Widget,\n GridLayout.ICellConfig\n >({\n name: 'cellConfig',\n create: () => ({ row: 0, column: 0, rowSpan: 1, columnSpan: 1 }),\n changed: onChildCellConfigChanged\n });\n\n /**\n * Normalize a partial cell config object.\n */\n export function normalizeConfig(\n config: Partial\n ): GridLayout.ICellConfig {\n let row = Math.max(0, Math.floor(config.row || 0));\n let column = Math.max(0, Math.floor(config.column || 0));\n let rowSpan = Math.max(1, Math.floor(config.rowSpan || 0));\n let columnSpan = Math.max(1, Math.floor(config.columnSpan || 0));\n return { row, column, rowSpan, columnSpan };\n }\n\n /**\n * Clamp a value to an integer >= 0.\n */\n export function clampValue(value: number): number {\n return Math.max(0, Math.floor(value));\n }\n\n /**\n * A sort comparison function for row spans.\n */\n export function rowSpanCmp(a: LayoutItem, b: LayoutItem): number {\n let c1 = cellConfigProperty.get(a.widget);\n let c2 = cellConfigProperty.get(b.widget);\n return c1.rowSpan - c2.rowSpan;\n }\n\n /**\n * A sort comparison function for column spans.\n */\n export function columnSpanCmp(a: LayoutItem, b: LayoutItem): number {\n let c1 = cellConfigProperty.get(a.widget);\n let c2 = cellConfigProperty.get(b.widget);\n return c1.columnSpan - c2.columnSpan;\n }\n\n /**\n * Reallocate the box sizers for the given grid dimensions.\n */\n export function reallocSizers(sizers: BoxSizer[], count: number): void {\n // Coerce the count to the valid range.\n count = Math.max(1, Math.floor(count));\n\n // Add the missing sizers.\n while (sizers.length < count) {\n sizers.push(new BoxSizer());\n }\n\n // Remove the extra sizers.\n if (sizers.length > count) {\n sizers.length = count;\n }\n }\n\n /**\n * Distribute a min size constraint across a range of sizers.\n */\n export function distributeMin(\n sizers: BoxSizer[],\n i1: number,\n i2: number,\n minSize: number\n ): void {\n // Sanity check the indices.\n if (i2 < i1) {\n return;\n }\n\n // Handle the simple case of no cell span.\n if (i1 === i2) {\n let sizer = sizers[i1];\n sizer.minSize = Math.max(sizer.minSize, minSize);\n return;\n }\n\n // Compute the total current min size of the span.\n let totalMin = 0;\n for (let i = i1; i <= i2; ++i) {\n totalMin += sizers[i].minSize;\n }\n\n // Do nothing if the total is greater than the required.\n if (totalMin >= minSize) {\n return;\n }\n\n // Compute the portion of the space to allocate to each sizer.\n let portion = (minSize - totalMin) / (i2 - i1 + 1);\n\n // Add the portion to each sizer.\n for (let i = i1; i <= i2; ++i) {\n sizers[i].minSize += portion;\n }\n }\n\n /**\n * The change handler for the child cell config property.\n */\n function onChildCellConfigChanged(child: Widget): void {\n if (child.parent && child.parent.layout instanceof GridLayout) {\n child.parent.fit();\n }\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { getKeyboardLayout } from '@lumino/keyboard';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { CommandRegistry } from '@lumino/commands';\n\nimport {\n ElementARIAAttrs,\n ElementDataset,\n h,\n VirtualDOM,\n VirtualElement\n} from '@lumino/virtualdom';\n\nimport { Menu } from './menu';\n\nimport { Title } from './title';\n\nimport { Widget } from './widget';\n\n/**\n * A widget which displays menus as a canonical menu bar.\n *\n * #### Notes\n * See also the related [example](../../examples/menubar/index.html) and\n * its [source](https://github.com/jupyterlab/lumino/tree/main/examples/example-menubar).\n */\nexport class MenuBar extends Widget {\n /**\n * Construct a new menu bar.\n *\n * @param options - The options for initializing the menu bar.\n */\n constructor(options: MenuBar.IOptions = {}) {\n super({ node: Private.createNode() });\n this.addClass('lm-MenuBar');\n this.setFlag(Widget.Flag.DisallowLayout);\n this.renderer = options.renderer || MenuBar.defaultRenderer;\n this._forceItemsPosition = options.forceItemsPosition || {\n forceX: true,\n forceY: true\n };\n this._overflowMenuOptions = options.overflowMenuOptions || {\n isVisible: true\n };\n }\n\n /**\n * Dispose of the resources held by the widget.\n */\n dispose(): void {\n this._closeChildMenu();\n this._menus.length = 0;\n super.dispose();\n }\n\n /**\n * The renderer used by the menu bar.\n */\n readonly renderer: MenuBar.IRenderer;\n\n /**\n * The child menu of the menu bar.\n *\n * #### Notes\n * This will be `null` if the menu bar does not have an open menu.\n */\n get childMenu(): Menu | null {\n return this._childMenu;\n }\n\n /**\n * The overflow index of the menu bar.\n */\n get overflowIndex(): number {\n return this._overflowIndex;\n }\n\n /**\n * The overflow menu of the menu bar.\n */\n get overflowMenu(): Menu | null {\n return this._overflowMenu;\n }\n\n /**\n * Get the menu bar content node.\n *\n * #### Notes\n * This is the node which holds the menu title nodes.\n *\n * Modifying this node directly can lead to undefined behavior.\n */\n get contentNode(): HTMLUListElement {\n return this.node.getElementsByClassName(\n 'lm-MenuBar-content'\n )[0] as HTMLUListElement;\n }\n\n /**\n * Get the currently active menu.\n */\n get activeMenu(): Menu | null {\n return this._menus[this._activeIndex] || null;\n }\n\n /**\n * Set the currently active menu.\n *\n * #### Notes\n * If the menu does not exist, the menu will be set to `null`.\n */\n set activeMenu(value: Menu | null) {\n this.activeIndex = value ? this._menus.indexOf(value) : -1;\n }\n\n /**\n * Get the index of the currently active menu.\n *\n * #### Notes\n * This will be `-1` if no menu is active.\n */\n get activeIndex(): number {\n return this._activeIndex;\n }\n\n /**\n * Set the index of the currently active menu.\n *\n * #### Notes\n * If the menu cannot be activated, the index will be set to `-1`.\n */\n set activeIndex(value: number) {\n // Adjust the value for an out of range index.\n if (value < 0 || value >= this._menus.length) {\n value = -1;\n }\n\n // An empty menu cannot be active\n if (value > -1 && this._menus[value].items.length === 0) {\n value = -1;\n }\n\n // Bail early if the index will not change.\n if (this._activeIndex === value) {\n return;\n }\n\n // Update the active index.\n this._activeIndex = value;\n\n // Schedule an update of the items.\n this.update();\n }\n\n /**\n * A read-only array of the menus in the menu bar.\n */\n get menus(): ReadonlyArray {\n return this._menus;\n }\n\n /**\n * Open the active menu and activate its first menu item.\n *\n * #### Notes\n * If there is no active menu, this is a no-op.\n */\n openActiveMenu(): void {\n // Bail early if there is no active item.\n if (this._activeIndex === -1) {\n return;\n }\n\n // Open the child menu.\n this._openChildMenu();\n\n // Activate the first item in the child menu.\n if (this._childMenu) {\n this._childMenu.activeIndex = -1;\n this._childMenu.activateNextItem();\n }\n }\n\n /**\n * Add a menu to the end of the menu bar.\n *\n * @param menu - The menu to add to the menu bar.\n *\n * #### Notes\n * If the menu is already added to the menu bar, it will be moved.\n */\n addMenu(menu: Menu, update: boolean = true): void {\n this.insertMenu(this._menus.length, menu, update);\n }\n\n /**\n * Insert a menu into the menu bar at the specified index.\n *\n * @param index - The index at which to insert the menu.\n *\n * @param menu - The menu to insert into the menu bar.\n *\n * #### Notes\n * The index will be clamped to the bounds of the menus.\n *\n * If the menu is already added to the menu bar, it will be moved.\n */\n insertMenu(index: number, menu: Menu, update: boolean = true): void {\n // Close the child menu before making changes.\n this._closeChildMenu();\n\n // Look up the index of the menu.\n let i = this._menus.indexOf(menu);\n\n // Clamp the insert index to the array bounds.\n let j = Math.max(0, Math.min(index, this._menus.length));\n\n // If the menu is not in the array, insert it.\n if (i === -1) {\n // Insert the menu into the array.\n ArrayExt.insert(this._menus, j, menu);\n\n // Add the styling class to the menu.\n menu.addClass('lm-MenuBar-menu');\n\n // Connect to the menu signals.\n menu.aboutToClose.connect(this._onMenuAboutToClose, this);\n menu.menuRequested.connect(this._onMenuMenuRequested, this);\n menu.title.changed.connect(this._onTitleChanged, this);\n\n // Schedule an update of the items.\n if (update) {\n this.update();\n }\n\n // There is nothing more to do.\n return;\n }\n\n // Otherwise, the menu exists in the array and should be moved.\n\n // Adjust the index if the location is at the end of the array.\n if (j === this._menus.length) {\n j--;\n }\n\n // Bail if there is no effective move.\n if (i === j) {\n return;\n }\n\n // Move the menu to the new locations.\n ArrayExt.move(this._menus, i, j);\n\n // Schedule an update of the items.\n if (update) {\n this.update();\n }\n }\n\n /**\n * Remove a menu from the menu bar.\n *\n * @param menu - The menu to remove from the menu bar.\n *\n * #### Notes\n * This is a no-op if the menu is not in the menu bar.\n */\n removeMenu(menu: Menu, update: boolean = true): void {\n this.removeMenuAt(this._menus.indexOf(menu), update);\n }\n\n /**\n * Remove the menu at a given index from the menu bar.\n *\n * @param index - The index of the menu to remove.\n *\n * #### Notes\n * This is a no-op if the index is out of range.\n */\n removeMenuAt(index: number, update: boolean = true): void {\n // Close the child menu before making changes.\n this._closeChildMenu();\n\n // Remove the menu from the array.\n let menu = ArrayExt.removeAt(this._menus, index);\n\n // Bail if the index is out of range.\n if (!menu) {\n return;\n }\n\n // Disconnect from the menu signals.\n menu.aboutToClose.disconnect(this._onMenuAboutToClose, this);\n menu.menuRequested.disconnect(this._onMenuMenuRequested, this);\n menu.title.changed.disconnect(this._onTitleChanged, this);\n\n // Remove the styling class from the menu.\n menu.removeClass('lm-MenuBar-menu');\n\n // Schedule an update of the items.\n if (update) {\n this.update();\n }\n }\n\n /**\n * Remove all menus from the menu bar.\n */\n clearMenus(): void {\n // Bail if there is nothing to remove.\n if (this._menus.length === 0) {\n return;\n }\n\n // Close the child menu before making changes.\n this._closeChildMenu();\n\n // Disconnect from the menu signals and remove the styling class.\n for (let menu of this._menus) {\n menu.aboutToClose.disconnect(this._onMenuAboutToClose, this);\n menu.menuRequested.disconnect(this._onMenuMenuRequested, this);\n menu.title.changed.disconnect(this._onTitleChanged, this);\n menu.removeClass('lm-MenuBar-menu');\n }\n\n // Clear the menus array.\n this._menus.length = 0;\n\n // Schedule an update of the items.\n this.update();\n }\n\n /**\n * Handle the DOM events for the menu bar.\n *\n * @param event - The DOM event sent to the menu bar.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the menu bar's DOM nodes. It\n * should not be called directly by user code.\n */\n handleEvent(event: Event): void {\n switch (event.type) {\n case 'keydown':\n this._evtKeyDown(event as KeyboardEvent);\n break;\n case 'mousedown':\n this._evtMouseDown(event as MouseEvent);\n break;\n case 'mousemove':\n case 'mouseleave':\n this._evtMouseMove(event as MouseEvent);\n break;\n case 'focusout':\n this._evtFocusOut(event as FocusEvent);\n break;\n case 'contextmenu':\n event.preventDefault();\n event.stopPropagation();\n break;\n }\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n this.node.addEventListener('keydown', this);\n this.node.addEventListener('mousedown', this);\n this.node.addEventListener('mousemove', this);\n this.node.addEventListener('mouseleave', this);\n this.node.addEventListener('focusout', this);\n this.node.addEventListener('contextmenu', this);\n }\n\n /**\n * A message handler invoked on an `'after-detach'` message.\n */\n protected onAfterDetach(msg: Message): void {\n this.node.removeEventListener('keydown', this);\n this.node.removeEventListener('mousedown', this);\n this.node.removeEventListener('mousemove', this);\n this.node.removeEventListener('mouseleave', this);\n this.node.removeEventListener('focusout', this);\n this.node.removeEventListener('contextmenu', this);\n this._closeChildMenu();\n }\n\n /**\n * A message handler invoked on an `'activate-request'` message.\n */\n protected onActivateRequest(msg: Message): void {\n if (this.isAttached) {\n this._focusItemAt(0);\n }\n }\n\n /**\n * A message handler invoked on a `'resize'` message.\n */\n protected onResize(msg: Widget.ResizeMessage): void {\n this.update();\n super.onResize(msg);\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n protected onUpdateRequest(msg: Message): void {\n let menus = this._menus;\n let renderer = this.renderer;\n let activeIndex = this._activeIndex;\n let tabFocusIndex =\n this._tabFocusIndex >= 0 && this._tabFocusIndex < menus.length\n ? this._tabFocusIndex\n : 0;\n let length = this._overflowIndex > -1 ? this._overflowIndex : menus.length;\n let totalMenuSize = 0;\n let isVisible = false;\n\n // Check that the overflow menu doesn't count\n length = this._overflowMenu !== null ? length - 1 : length;\n let content = new Array(length);\n\n // Render visible menus\n for (let i = 0; i < length; ++i) {\n content[i] = renderer.renderItem({\n title: menus[i].title,\n active: i === activeIndex,\n tabbable: i === tabFocusIndex,\n disabled: menus[i].items.length === 0,\n onfocus: () => {\n this._tabFocusIndex = i;\n this.activeIndex = i;\n }\n });\n // Calculate size of current menu\n totalMenuSize += this._menuItemSizes[i];\n // Check if overflow menu is already rendered\n if (menus[i].title.label === this._overflowMenuOptions.title) {\n isVisible = true;\n length--;\n }\n }\n // Render overflow menu if needed and active\n if (this._overflowMenuOptions.isVisible) {\n if (this._overflowIndex > -1 && !isVisible) {\n // Create overflow menu\n if (this._overflowMenu === null) {\n const overflowMenuTitle = this._overflowMenuOptions.title ?? '...';\n this._overflowMenu = new Menu({ commands: new CommandRegistry() });\n this._overflowMenu.title.label = overflowMenuTitle;\n this._overflowMenu.title.mnemonic = 0;\n this.addMenu(this._overflowMenu, false);\n }\n // Move menus to overflow menu\n for (let i = menus.length - 2; i >= length; i--) {\n const submenu = this.menus[i];\n submenu.title.mnemonic = 0;\n this._overflowMenu.insertItem(0, {\n type: 'submenu',\n submenu: submenu\n });\n this.removeMenu(submenu, false);\n }\n content[length] = renderer.renderItem({\n title: this._overflowMenu.title,\n active: length === activeIndex && menus[length].items.length !== 0,\n tabbable: length === tabFocusIndex,\n disabled: menus[length].items.length === 0,\n onfocus: () => {\n this._tabFocusIndex = length;\n this.activeIndex = length;\n }\n });\n length++;\n } else if (this._overflowMenu !== null) {\n // Remove submenus from overflow menu\n let overflowMenuItems = this._overflowMenu.items;\n let screenSize = this.node.offsetWidth;\n let n = this._overflowMenu.items.length;\n for (let i = 0; i < n; ++i) {\n let index = menus.length - 1 - i;\n if (screenSize - totalMenuSize > this._menuItemSizes[index]) {\n let menu = overflowMenuItems[0].submenu as Menu;\n this._overflowMenu.removeItemAt(0);\n this.insertMenu(length, menu, false);\n content[length] = renderer.renderItem({\n title: menu.title,\n active: false,\n tabbable: length === tabFocusIndex,\n disabled: menus[length].items.length === 0,\n onfocus: () => {\n this._tabFocusIndex = length;\n this.activeIndex = length;\n }\n });\n length++;\n }\n }\n if (this._overflowMenu.items.length === 0) {\n this.removeMenu(this._overflowMenu, false);\n content.pop();\n this._overflowMenu = null;\n this._overflowIndex = -1;\n }\n }\n }\n VirtualDOM.render(content, this.contentNode);\n this._updateOverflowIndex();\n }\n\n /**\n * Calculate and update the current overflow index.\n */\n private _updateOverflowIndex(): void {\n if (!this._overflowMenuOptions.isVisible) {\n return;\n }\n\n // Get elements visible in the main menu bar\n const itemMenus = this.contentNode.childNodes;\n let screenSize = this.node.offsetWidth;\n let totalMenuSize = 0;\n let index = -1;\n let n = itemMenus.length;\n\n if (this._menuItemSizes.length == 0) {\n // Check if it is the first resize and get info about menu items sizes\n for (let i = 0; i < n; i++) {\n let item = itemMenus[i] as HTMLLIElement;\n // Add sizes to array\n totalMenuSize += item.offsetWidth;\n this._menuItemSizes.push(item.offsetWidth);\n if (totalMenuSize > screenSize && index === -1) {\n index = i;\n }\n }\n } else {\n // Calculate current menu size\n for (let i = 0; i < this._menuItemSizes.length; i++) {\n totalMenuSize += this._menuItemSizes[i];\n if (totalMenuSize > screenSize) {\n index = i;\n break;\n }\n }\n }\n this._overflowIndex = index;\n }\n\n /**\n * Handle the `'keydown'` event for the menu bar.\n *\n * #### Notes\n * All keys are trapped except the tab key that is ignored.\n */\n private _evtKeyDown(event: KeyboardEvent): void {\n // Fetch the key code for the event.\n let kc = event.keyCode;\n\n // Reset the active index on tab, but do not trap the tab key.\n if (kc === 9) {\n this.activeIndex = -1;\n return;\n }\n\n // A menu bar handles all other keydown events.\n event.preventDefault();\n event.stopPropagation();\n\n // Enter, Space, Up Arrow, Down Arrow\n if (kc === 13 || kc === 32 || kc === 38 || kc === 40) {\n // The active index may have changed (for example, user hovers over an\n // item with the mouse), so be sure to use the focus index.\n this.activeIndex = this._tabFocusIndex;\n if (this.activeIndex !== this._tabFocusIndex) {\n // Bail if the setter refused to set activeIndex to tabFocusIndex\n // because it means that the item at tabFocusIndex cannot be opened (for\n // example, it has an empty menu)\n return;\n }\n this.openActiveMenu();\n return;\n }\n\n // Escape\n if (kc === 27) {\n this._closeChildMenu();\n this._focusItemAt(this.activeIndex);\n return;\n }\n\n // Left or Right Arrow\n if (kc === 37 || kc === 39) {\n let direction = kc === 37 ? -1 : 1;\n let start = this._tabFocusIndex + direction;\n let n = this._menus.length;\n for (let i = 0; i < n; i++) {\n let index = (n + start + direction * i) % n;\n if (this._menus[index].items.length) {\n this._focusItemAt(index);\n return;\n }\n }\n return;\n }\n\n // Get the pressed key character.\n let key = getKeyboardLayout().keyForKeydownEvent(event);\n\n // Bail if the key is not valid.\n if (!key) {\n return;\n }\n\n // Search for the next best matching mnemonic item.\n let start = this._activeIndex + 1;\n let result = Private.findMnemonic(this._menus, key, start);\n\n // Handle the requested mnemonic based on the search results.\n // If exactly one mnemonic is matched, that menu is opened.\n // Otherwise, the next mnemonic is activated if available,\n // followed by the auto mnemonic if available.\n if (result.index !== -1 && !result.multiple) {\n this.activeIndex = result.index;\n this.openActiveMenu();\n } else if (result.index !== -1) {\n this.activeIndex = result.index;\n this._focusItemAt(this.activeIndex);\n } else if (result.auto !== -1) {\n this.activeIndex = result.auto;\n this._focusItemAt(this.activeIndex);\n }\n }\n\n /**\n * Handle the `'mousedown'` event for the menu bar.\n */\n private _evtMouseDown(event: MouseEvent): void {\n // Bail if the mouse press was not on the menu bar. This can occur\n // when the document listener is installed for an active menu bar.\n if (!ElementExt.hitTest(this.node, event.clientX, event.clientY)) {\n return;\n }\n\n // Stop the propagation of the event. Immediate propagation is\n // also stopped so that an open menu does not handle the event.\n event.stopPropagation();\n event.stopImmediatePropagation();\n\n // Check if the mouse is over one of the menu items.\n let index = ArrayExt.findFirstIndex(this.contentNode.children, node => {\n return ElementExt.hitTest(node, event.clientX, event.clientY);\n });\n\n // If the press was not on an item, close the child menu.\n if (index === -1) {\n this._closeChildMenu();\n return;\n }\n\n // If the press was not the left mouse button, do nothing further.\n if (event.button !== 0) {\n return;\n }\n\n // Otherwise, toggle the open state of the child menu.\n if (this._childMenu) {\n this._closeChildMenu();\n this.activeIndex = index;\n } else {\n // If we don't call preventDefault() here, then the item in the menu\n // bar will take focus over the menu that is being opened.\n event.preventDefault();\n const position = this._positionForMenu(index);\n Menu.saveWindowData();\n // Begin DOM modifications.\n this.activeIndex = index;\n this._openChildMenu(position);\n }\n }\n\n /**\n * Handle the `'mousemove'` event for the menu bar.\n */\n private _evtMouseMove(event: MouseEvent): void {\n // Check if the mouse is over one of the menu items.\n let index = ArrayExt.findFirstIndex(this.contentNode.children, node => {\n return ElementExt.hitTest(node, event.clientX, event.clientY);\n });\n\n // Bail early if the active index will not change.\n if (index === this._activeIndex) {\n return;\n }\n\n // Bail early if a child menu is open and the mouse is not over\n // an item. This allows the child menu to be kept open when the\n // mouse is over the empty part of the menu bar.\n if (index === -1 && this._childMenu) {\n return;\n }\n\n // Get position for the new menu >before< updating active index.\n const position =\n index >= 0 && this._childMenu ? this._positionForMenu(index) : null;\n\n // Before any modification, update window data.\n Menu.saveWindowData();\n\n // Begin DOM modifications.\n\n // Update the active index to the hovered item.\n this.activeIndex = index;\n\n // Open the new menu if a menu is already open.\n if (position) {\n this._openChildMenu(position);\n }\n }\n\n /**\n * Find initial position for the menu based on menubar item position.\n *\n * NOTE: this should be called before updating active index to avoid\n * an additional layout and style invalidation as changing active\n * index modifies DOM.\n */\n private _positionForMenu(index: number): Private.IPosition {\n let itemNode = this.contentNode.children[index];\n let { left, bottom } = (itemNode as HTMLElement).getBoundingClientRect();\n return {\n top: bottom,\n left\n };\n }\n\n /**\n * Handle the `'focusout'` event for the menu bar.\n */\n private _evtFocusOut(event: FocusEvent): void {\n // Reset the active index if there is no open menu and the menubar is losing focus.\n if (!this._childMenu && !this.node.contains(event.relatedTarget as Node)) {\n this.activeIndex = -1;\n }\n }\n\n /**\n * Focus an item in the menu bar.\n *\n * #### Notes\n * Does not open the associated menu.\n */\n private _focusItemAt(index: number): void {\n const itemNode = this.contentNode.childNodes[index] as HTMLElement | void;\n if (itemNode) {\n itemNode.focus();\n }\n }\n\n /**\n * Open the child menu at the active index immediately.\n *\n * If a different child menu is already open, it will be closed,\n * even if there is no active menu.\n */\n private _openChildMenu(options: { left?: number; top?: number } = {}): void {\n // If there is no active menu, close the current menu.\n let newMenu = this.activeMenu;\n if (!newMenu) {\n this._closeChildMenu();\n return;\n }\n\n // Bail if there is no effective menu change.\n let oldMenu = this._childMenu;\n if (oldMenu === newMenu) {\n return;\n }\n\n // Swap the internal menu reference.\n this._childMenu = newMenu;\n\n // Close the current menu, or setup for the new menu.\n if (oldMenu) {\n oldMenu.close();\n } else {\n document.addEventListener('mousedown', this, true);\n }\n\n // Update the tab focus index and ensure the menu bar is updated.\n this._tabFocusIndex = this.activeIndex;\n MessageLoop.sendMessage(this, Widget.Msg.UpdateRequest);\n\n // Get the positioning data for the new menu.\n let { left, top } = options;\n if (typeof left === 'undefined' || typeof top === 'undefined') {\n ({ left, top } = this._positionForMenu(this._activeIndex));\n }\n // Begin DOM modifications\n\n if (!oldMenu) {\n // Continue setup for new menu\n this.addClass('lm-mod-active');\n }\n\n // Open the new menu at the computed location.\n if (newMenu.items.length > 0) {\n newMenu.open(left, top, this._forceItemsPosition);\n }\n }\n\n /**\n * Close the child menu immediately.\n *\n * This is a no-op if a child menu is not open.\n */\n private _closeChildMenu(): void {\n // Bail if no child menu is open.\n if (!this._childMenu) {\n return;\n }\n // Remove the active class from the menu bar.\n this.removeClass('lm-mod-active');\n\n // Remove the document listeners.\n document.removeEventListener('mousedown', this, true);\n\n // Clear the internal menu reference.\n let menu = this._childMenu;\n this._childMenu = null;\n\n // Close the menu.\n menu.close();\n\n // Reset the active index.\n this.activeIndex = -1;\n }\n\n /**\n * Handle the `aboutToClose` signal of a menu.\n */\n private _onMenuAboutToClose(sender: Menu): void {\n // Bail if the sender is not the child menu.\n if (sender !== this._childMenu) {\n return;\n }\n\n // Remove the active class from the menu bar.\n this.removeClass('lm-mod-active');\n\n // Remove the document listeners.\n document.removeEventListener('mousedown', this, true);\n\n // Clear the internal menu reference.\n this._childMenu = null;\n\n // Reset the active index.\n this.activeIndex = -1;\n }\n\n /**\n * Handle the `menuRequested` signal of a child menu.\n */\n private _onMenuMenuRequested(sender: Menu, args: 'next' | 'previous'): void {\n // Bail if the sender is not the child menu.\n if (sender !== this._childMenu) {\n return;\n }\n\n // Look up the active index and menu count.\n let i = this._activeIndex;\n let n = this._menus.length;\n\n // Active the next requested index.\n switch (args) {\n case 'next':\n this.activeIndex = i === n - 1 ? 0 : i + 1;\n break;\n case 'previous':\n this.activeIndex = i === 0 ? n - 1 : i - 1;\n break;\n }\n\n // Open the active menu.\n this.openActiveMenu();\n }\n\n /**\n * Handle the `changed` signal of a title object.\n */\n private _onTitleChanged(): void {\n this.update();\n }\n\n // Track the index of the item that is currently focused or hovered. -1 means nothing focused or hovered.\n private _activeIndex = -1;\n // Track which item can be focused using the TAB key. Unlike _activeIndex will\n // always point to a menuitem. Whenever you update this value, it's important\n // to follow it with an \"update-request\" message so that the `tabindex`\n // attribute on each menubar item gets properly updated.\n private _tabFocusIndex = 0;\n private _forceItemsPosition: Menu.IOpenOptions;\n private _overflowMenuOptions: IOverflowMenuOptions;\n private _menus: Menu[] = [];\n private _childMenu: Menu | null = null;\n private _overflowMenu: Menu | null = null;\n private _menuItemSizes: number[] = [];\n private _overflowIndex: number = -1;\n}\n\n/**\n * The namespace for the `MenuBar` class statics.\n */\nexport namespace MenuBar {\n /**\n * An options object for creating a menu bar.\n */\n export interface IOptions {\n /**\n * A custom renderer for creating menu bar content.\n *\n * The default is a shared renderer instance.\n */\n renderer?: IRenderer;\n /**\n * Whether to force the position of the menu. The MenuBar forces the\n * coordinates of its menus by default. With this option you can disable it.\n *\n * Setting to `false` will enable the logic which repositions the\n * coordinates of the menu if it will not fit entirely on screen.\n *\n * The default is `true`.\n */\n forceItemsPosition?: Menu.IOpenOptions;\n /**\n * Whether to add a overflow menu if there's overflow.\n *\n * Setting to `true` will enable the logic that creates an overflow menu\n * to show the menu items that don't fit entirely on the screen.\n *\n * The default is `true`.\n */\n overflowMenuOptions?: IOverflowMenuOptions;\n }\n\n /**\n * An object which holds the data to render a menu bar item.\n */\n export interface IRenderData {\n /**\n * The title to be rendered.\n */\n readonly title: Title;\n\n /**\n * Whether the item is the active item.\n */\n readonly active: boolean;\n\n /**\n * Whether the user can tab to the item.\n */\n readonly tabbable: boolean;\n\n /**\n * Whether the item is disabled.\n *\n * #### Notes\n * A disabled item cannot be active.\n * A disabled item cannot be focussed.\n */\n readonly disabled?: boolean;\n\n readonly onfocus?: (event: FocusEvent) => void;\n }\n\n /**\n * A renderer for use with a menu bar.\n */\n export interface IRenderer {\n /**\n * Render the virtual element for a menu bar item.\n *\n * @param data - The data to use for rendering the item.\n *\n * @returns A virtual element representing the item.\n */\n renderItem(data: IRenderData): VirtualElement;\n }\n\n /**\n * The default implementation of `IRenderer`.\n *\n * #### Notes\n * Subclasses are free to reimplement rendering methods as needed.\n */\n export class Renderer implements IRenderer {\n /**\n * Render the virtual element for a menu bar item.\n *\n * @param data - The data to use for rendering the item.\n *\n * @returns A virtual element representing the item.\n */\n renderItem(data: IRenderData): VirtualElement {\n let className = this.createItemClass(data);\n let dataset = this.createItemDataset(data);\n let aria = this.createItemARIA(data);\n return h.li(\n {\n className,\n dataset,\n ...(data.disabled ? {} : { tabindex: data.tabbable ? '0' : '-1' }),\n onfocus: data.onfocus,\n ...aria\n },\n this.renderIcon(data),\n this.renderLabel(data)\n );\n }\n\n /**\n * Render the icon element for a menu bar item.\n *\n * @param data - The data to use for rendering the icon.\n *\n * @returns A virtual element representing the item icon.\n */\n renderIcon(data: IRenderData): VirtualElement {\n let className = this.createIconClass(data);\n\n // If data.title.icon is undefined, it will be ignored.\n return h.div({ className }, data.title.icon!, data.title.iconLabel);\n }\n\n /**\n * Render the label element for a menu item.\n *\n * @param data - The data to use for rendering the label.\n *\n * @returns A virtual element representing the item label.\n */\n renderLabel(data: IRenderData): VirtualElement {\n let content = this.formatLabel(data);\n return h.div({ className: 'lm-MenuBar-itemLabel' }, content);\n }\n\n /**\n * Create the class name for the menu bar item.\n *\n * @param data - The data to use for the class name.\n *\n * @returns The full class name for the menu item.\n */\n createItemClass(data: IRenderData): string {\n let name = 'lm-MenuBar-item';\n if (data.title.className) {\n name += ` ${data.title.className}`;\n }\n if (data.active && !data.disabled) {\n name += ' lm-mod-active';\n }\n return name;\n }\n\n /**\n * Create the dataset for a menu bar item.\n *\n * @param data - The data to use for the item.\n *\n * @returns The dataset for the menu bar item.\n */\n createItemDataset(data: IRenderData): ElementDataset {\n return data.title.dataset;\n }\n\n /**\n * Create the aria attributes for menu bar item.\n *\n * @param data - The data to use for the aria attributes.\n *\n * @returns The aria attributes object for the item.\n */\n createItemARIA(data: IRenderData): ElementARIAAttrs {\n return {\n role: 'menuitem',\n 'aria-haspopup': 'true',\n 'aria-disabled': data.disabled ? 'true' : 'false'\n };\n }\n\n /**\n * Create the class name for the menu bar item icon.\n *\n * @param data - The data to use for the class name.\n *\n * @returns The full class name for the item icon.\n */\n createIconClass(data: IRenderData): string {\n let name = 'lm-MenuBar-itemIcon';\n let extra = data.title.iconClass;\n return extra ? `${name} ${extra}` : name;\n }\n\n /**\n * Create the render content for the label node.\n *\n * @param data - The data to use for the label content.\n *\n * @returns The content to add to the label node.\n */\n formatLabel(data: IRenderData): h.Child {\n // Fetch the label text and mnemonic index.\n let { label, mnemonic } = data.title;\n\n // If the index is out of range, do not modify the label.\n if (mnemonic < 0 || mnemonic >= label.length) {\n return label;\n }\n\n // Split the label into parts.\n let prefix = label.slice(0, mnemonic);\n let suffix = label.slice(mnemonic + 1);\n let char = label[mnemonic];\n\n // Wrap the mnemonic character in a span.\n let span = h.span({ className: 'lm-MenuBar-itemMnemonic' }, char);\n\n // Return the content parts.\n return [prefix, span, suffix];\n }\n }\n\n /**\n * The default `Renderer` instance.\n */\n export const defaultRenderer = new Renderer();\n}\n\n/**\n * Options for overflow menu.\n */\nexport interface IOverflowMenuOptions {\n /**\n * Determines if a overflow menu appears when the menu items overflow.\n *\n * Defaults to `true`.\n */\n isVisible: boolean;\n /**\n * Determines the title of the overflow menu.\n *\n * Default: `...`.\n */\n title?: string;\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * Create the DOM node for a menu bar.\n */\n export function createNode(): HTMLDivElement {\n let node = document.createElement('div');\n let content = document.createElement('ul');\n content.className = 'lm-MenuBar-content';\n node.appendChild(content);\n content.setAttribute('role', 'menubar');\n return node;\n }\n\n /**\n * Position for the menu relative to top-left screen corner.\n */\n export interface IPosition {\n /**\n * Pixels right from screen origin.\n */\n left: number;\n /**\n * Pixels down from screen origin.\n */\n top: number;\n }\n\n /**\n * The results of a mnemonic search.\n */\n export interface IMnemonicResult {\n /**\n * The index of the first matching mnemonic item, or `-1`.\n */\n index: number;\n\n /**\n * Whether multiple mnemonic items matched.\n */\n multiple: boolean;\n\n /**\n * The index of the first auto matched non-mnemonic item.\n */\n auto: number;\n }\n\n /**\n * Find the best matching mnemonic item.\n *\n * The search starts at the given index and wraps around.\n */\n export function findMnemonic(\n menus: ReadonlyArray,\n key: string,\n start: number\n ): IMnemonicResult {\n // Setup the result variables.\n let index = -1;\n let auto = -1;\n let multiple = false;\n\n // Normalize the key to upper case.\n let upperKey = key.toUpperCase();\n\n // Search the items from the given start index.\n for (let i = 0, n = menus.length; i < n; ++i) {\n // Compute the wrapped index.\n let k = (i + start) % n;\n\n // Look up the menu title.\n let title = menus[k].title;\n\n // Ignore titles with an empty label.\n if (title.label.length === 0) {\n continue;\n }\n\n // Look up the mnemonic index for the label.\n let mn = title.mnemonic;\n\n // Handle a valid mnemonic index.\n if (mn >= 0 && mn < title.label.length) {\n if (title.label[mn].toUpperCase() === upperKey) {\n if (index === -1) {\n index = k;\n } else {\n multiple = true;\n }\n }\n continue;\n }\n\n // Finally, handle the auto index if possible.\n if (auto === -1 && title.label[0].toUpperCase() === upperKey) {\n auto = k;\n }\n }\n\n // Return the search results.\n return { index, multiple, auto };\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { IDisposable } from '@lumino/disposable';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Drag } from '@lumino/dragdrop';\n\nimport { Message } from '@lumino/messaging';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { Widget } from './widget';\n\n/**\n * A widget which implements a canonical scroll bar.\n */\nexport class ScrollBar extends Widget {\n /**\n * Construct a new scroll bar.\n *\n * @param options - The options for initializing the scroll bar.\n */\n constructor(options: ScrollBar.IOptions = {}) {\n super({ node: Private.createNode() });\n this.addClass('lm-ScrollBar');\n this.setFlag(Widget.Flag.DisallowLayout);\n\n // Set the orientation.\n this._orientation = options.orientation || 'vertical';\n this.dataset['orientation'] = this._orientation;\n\n // Parse the rest of the options.\n if (options.maximum !== undefined) {\n this._maximum = Math.max(0, options.maximum);\n }\n if (options.page !== undefined) {\n this._page = Math.max(0, options.page);\n }\n if (options.value !== undefined) {\n this._value = Math.max(0, Math.min(options.value, this._maximum));\n }\n }\n\n /**\n * A signal emitted when the user moves the scroll thumb.\n *\n * #### Notes\n * The payload is the current value of the scroll bar.\n */\n get thumbMoved(): ISignal {\n return this._thumbMoved;\n }\n\n /**\n * A signal emitted when the user clicks a step button.\n *\n * #### Notes\n * The payload is whether a decrease or increase is requested.\n */\n get stepRequested(): ISignal {\n return this._stepRequested;\n }\n\n /**\n * A signal emitted when the user clicks the scroll track.\n *\n * #### Notes\n * The payload is whether a decrease or increase is requested.\n */\n get pageRequested(): ISignal {\n return this._pageRequested;\n }\n\n /**\n * Get the orientation of the scroll bar.\n */\n get orientation(): ScrollBar.Orientation {\n return this._orientation;\n }\n\n /**\n * Set the orientation of the scroll bar.\n */\n set orientation(value: ScrollBar.Orientation) {\n // Do nothing if the orientation does not change.\n if (this._orientation === value) {\n return;\n }\n\n // Release the mouse before making changes.\n this._releaseMouse();\n\n // Update the internal orientation.\n this._orientation = value;\n this.dataset['orientation'] = value;\n\n // Schedule an update the scroll bar.\n this.update();\n }\n\n /**\n * Get the current value of the scroll bar.\n */\n get value(): number {\n return this._value;\n }\n\n /**\n * Set the current value of the scroll bar.\n *\n * #### Notes\n * The value will be clamped to the range `[0, maximum]`.\n */\n set value(value: number) {\n // Clamp the value to the allowable range.\n value = Math.max(0, Math.min(value, this._maximum));\n\n // Do nothing if the value does not change.\n if (this._value === value) {\n return;\n }\n\n // Update the internal value.\n this._value = value;\n\n // Schedule an update the scroll bar.\n this.update();\n }\n\n /**\n * Get the page size of the scroll bar.\n *\n * #### Notes\n * The page size is the amount of visible content in the scrolled\n * region, expressed in data units. It determines the size of the\n * scroll bar thumb.\n */\n get page(): number {\n return this._page;\n }\n\n /**\n * Set the page size of the scroll bar.\n *\n * #### Notes\n * The page size will be clamped to the range `[0, Infinity]`.\n */\n set page(value: number) {\n // Clamp the page size to the allowable range.\n value = Math.max(0, value);\n\n // Do nothing if the value does not change.\n if (this._page === value) {\n return;\n }\n\n // Update the internal page size.\n this._page = value;\n\n // Schedule an update the scroll bar.\n this.update();\n }\n\n /**\n * Get the maximum value of the scroll bar.\n */\n get maximum(): number {\n return this._maximum;\n }\n\n /**\n * Set the maximum value of the scroll bar.\n *\n * #### Notes\n * The max size will be clamped to the range `[0, Infinity]`.\n */\n set maximum(value: number) {\n // Clamp the value to the allowable range.\n value = Math.max(0, value);\n\n // Do nothing if the value does not change.\n if (this._maximum === value) {\n return;\n }\n\n // Update the internal values.\n this._maximum = value;\n\n // Clamp the current value to the new range.\n this._value = Math.min(this._value, value);\n\n // Schedule an update the scroll bar.\n this.update();\n }\n\n /**\n * The scroll bar decrement button node.\n *\n * #### Notes\n * Modifying this node directly can lead to undefined behavior.\n */\n get decrementNode(): HTMLDivElement {\n return this.node.getElementsByClassName(\n 'lm-ScrollBar-button'\n )[0] as HTMLDivElement;\n }\n\n /**\n * The scroll bar increment button node.\n *\n * #### Notes\n * Modifying this node directly can lead to undefined behavior.\n */\n get incrementNode(): HTMLDivElement {\n return this.node.getElementsByClassName(\n 'lm-ScrollBar-button'\n )[1] as HTMLDivElement;\n }\n\n /**\n * The scroll bar track node.\n *\n * #### Notes\n * Modifying this node directly can lead to undefined behavior.\n */\n get trackNode(): HTMLDivElement {\n return this.node.getElementsByClassName(\n 'lm-ScrollBar-track'\n )[0] as HTMLDivElement;\n }\n\n /**\n * The scroll bar thumb node.\n *\n * #### Notes\n * Modifying this node directly can lead to undefined behavior.\n */\n get thumbNode(): HTMLDivElement {\n return this.node.getElementsByClassName(\n 'lm-ScrollBar-thumb'\n )[0] as HTMLDivElement;\n }\n\n /**\n * Handle the DOM events for the scroll bar.\n *\n * @param event - The DOM event sent to the scroll bar.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the scroll bar's DOM node.\n *\n * This should not be called directly by user code.\n */\n handleEvent(event: Event): void {\n switch (event.type) {\n case 'mousedown':\n this._evtMouseDown(event as MouseEvent);\n break;\n case 'mousemove':\n this._evtMouseMove(event as MouseEvent);\n break;\n case 'mouseup':\n this._evtMouseUp(event as MouseEvent);\n break;\n case 'keydown':\n this._evtKeyDown(event as KeyboardEvent);\n break;\n case 'contextmenu':\n event.preventDefault();\n event.stopPropagation();\n break;\n }\n }\n\n /**\n * A method invoked on a 'before-attach' message.\n */\n protected onBeforeAttach(msg: Message): void {\n this.node.addEventListener('mousedown', this);\n this.update();\n }\n\n /**\n * A method invoked on an 'after-detach' message.\n */\n protected onAfterDetach(msg: Message): void {\n this.node.removeEventListener('mousedown', this);\n this._releaseMouse();\n }\n\n /**\n * A method invoked on an 'update-request' message.\n */\n protected onUpdateRequest(msg: Message): void {\n // Convert the value and page into percentages.\n let value = (this._value * 100) / this._maximum;\n let page = (this._page * 100) / (this._page + this._maximum);\n\n // Clamp the value and page to the relevant range.\n value = Math.max(0, Math.min(value, 100));\n page = Math.max(0, Math.min(page, 100));\n\n // Fetch the thumb style.\n let thumbStyle = this.thumbNode.style;\n\n // Update the thumb style for the current orientation.\n if (this._orientation === 'horizontal') {\n thumbStyle.top = '';\n thumbStyle.height = '';\n thumbStyle.left = `${value}%`;\n thumbStyle.width = `${page}%`;\n thumbStyle.transform = `translate(${-value}%, 0%)`;\n } else {\n thumbStyle.left = '';\n thumbStyle.width = '';\n thumbStyle.top = `${value}%`;\n thumbStyle.height = `${page}%`;\n thumbStyle.transform = `translate(0%, ${-value}%)`;\n }\n }\n\n /**\n * Handle the `'keydown'` event for the scroll bar.\n */\n private _evtKeyDown(event: KeyboardEvent): void {\n // Stop all input events during drag.\n event.preventDefault();\n event.stopPropagation();\n\n // Ignore anything except the `Escape` key.\n if (event.keyCode !== 27) {\n return;\n }\n\n // Fetch the previous scroll value.\n let value = this._pressData ? this._pressData.value : -1;\n\n // Release the mouse.\n this._releaseMouse();\n\n // Restore the old scroll value if possible.\n if (value !== -1) {\n this._moveThumb(value);\n }\n }\n\n /**\n * Handle the `'mousedown'` event for the scroll bar.\n */\n private _evtMouseDown(event: MouseEvent): void {\n // Do nothing if it's not a left mouse press.\n if (event.button !== 0) {\n return;\n }\n\n // Send an activate request to the scroll bar. This can be\n // used by message hooks to activate something relevant.\n this.activate();\n\n // Do nothing if the mouse is already captured.\n if (this._pressData) {\n return;\n }\n\n // Find the pressed scroll bar part.\n let part = Private.findPart(this, event.target as HTMLElement);\n\n // Do nothing if the part is not of interest.\n if (!part) {\n return;\n }\n\n // Stop the event propagation.\n event.preventDefault();\n event.stopPropagation();\n\n // Override the mouse cursor.\n let override = Drag.overrideCursor('default');\n\n // Set up the press data.\n this._pressData = {\n part,\n override,\n delta: -1,\n value: -1,\n mouseX: event.clientX,\n mouseY: event.clientY\n };\n\n // Add the extra event listeners.\n document.addEventListener('mousemove', this, true);\n document.addEventListener('mouseup', this, true);\n document.addEventListener('keydown', this, true);\n document.addEventListener('contextmenu', this, true);\n\n // Handle a thumb press.\n if (part === 'thumb') {\n // Fetch the thumb node.\n let thumbNode = this.thumbNode;\n\n // Fetch the client rect for the thumb.\n let thumbRect = thumbNode.getBoundingClientRect();\n\n // Update the press data delta for the current orientation.\n if (this._orientation === 'horizontal') {\n this._pressData.delta = event.clientX - thumbRect.left;\n } else {\n this._pressData.delta = event.clientY - thumbRect.top;\n }\n\n // Add the active class to the thumb node.\n thumbNode.classList.add('lm-mod-active');\n\n // Store the current value in the press data.\n this._pressData.value = this._value;\n\n // Finished.\n return;\n }\n\n // Handle a track press.\n if (part === 'track') {\n // Fetch the client rect for the thumb.\n let thumbRect = this.thumbNode.getBoundingClientRect();\n\n // Determine the direction for the page request.\n let dir: 'decrement' | 'increment';\n if (this._orientation === 'horizontal') {\n dir = event.clientX < thumbRect.left ? 'decrement' : 'increment';\n } else {\n dir = event.clientY < thumbRect.top ? 'decrement' : 'increment';\n }\n\n // Start the repeat timer.\n this._repeatTimer = window.setTimeout(this._onRepeat, 350);\n\n // Emit the page requested signal.\n this._pageRequested.emit(dir);\n\n // Finished.\n return;\n }\n\n // Handle a decrement button press.\n if (part === 'decrement') {\n // Add the active class to the decrement node.\n this.decrementNode.classList.add('lm-mod-active');\n\n // Start the repeat timer.\n this._repeatTimer = window.setTimeout(this._onRepeat, 350);\n\n // Emit the step requested signal.\n this._stepRequested.emit('decrement');\n\n // Finished.\n return;\n }\n\n // Handle an increment button press.\n if (part === 'increment') {\n // Add the active class to the increment node.\n this.incrementNode.classList.add('lm-mod-active');\n\n // Start the repeat timer.\n this._repeatTimer = window.setTimeout(this._onRepeat, 350);\n\n // Emit the step requested signal.\n this._stepRequested.emit('increment');\n\n // Finished.\n return;\n }\n }\n\n /**\n * Handle the `'mousemove'` event for the scroll bar.\n */\n private _evtMouseMove(event: MouseEvent): void {\n // Do nothing if no drag is in progress.\n if (!this._pressData) {\n return;\n }\n\n // Stop the event propagation.\n event.preventDefault();\n event.stopPropagation();\n\n // Update the mouse position.\n this._pressData.mouseX = event.clientX;\n this._pressData.mouseY = event.clientY;\n\n // Bail if the thumb is not being dragged.\n if (this._pressData.part !== 'thumb') {\n return;\n }\n\n // Get the client rect for the thumb and track.\n let thumbRect = this.thumbNode.getBoundingClientRect();\n let trackRect = this.trackNode.getBoundingClientRect();\n\n // Fetch the scroll geometry based on the orientation.\n let trackPos: number;\n let trackSpan: number;\n if (this._orientation === 'horizontal') {\n trackPos = event.clientX - trackRect.left - this._pressData.delta;\n trackSpan = trackRect.width - thumbRect.width;\n } else {\n trackPos = event.clientY - trackRect.top - this._pressData.delta;\n trackSpan = trackRect.height - thumbRect.height;\n }\n\n // Compute the desired value from the scroll geometry.\n let value = trackSpan === 0 ? 0 : (trackPos * this._maximum) / trackSpan;\n\n // Move the thumb to the computed value.\n this._moveThumb(value);\n }\n\n /**\n * Handle the `'mouseup'` event for the scroll bar.\n */\n private _evtMouseUp(event: MouseEvent): void {\n // Do nothing if it's not a left mouse release.\n if (event.button !== 0) {\n return;\n }\n\n // Stop the event propagation.\n event.preventDefault();\n event.stopPropagation();\n\n // Release the mouse.\n this._releaseMouse();\n }\n\n /**\n * Release the mouse and restore the node states.\n */\n private _releaseMouse(): void {\n // Bail if there is no press data.\n if (!this._pressData) {\n return;\n }\n\n // Clear the repeat timer.\n clearTimeout(this._repeatTimer);\n this._repeatTimer = -1;\n\n // Clear the press data.\n this._pressData.override.dispose();\n this._pressData = null;\n\n // Remove the extra event listeners.\n document.removeEventListener('mousemove', this, true);\n document.removeEventListener('mouseup', this, true);\n document.removeEventListener('keydown', this, true);\n document.removeEventListener('contextmenu', this, true);\n\n // Remove the active classes from the nodes.\n this.thumbNode.classList.remove('lm-mod-active');\n this.decrementNode.classList.remove('lm-mod-active');\n this.incrementNode.classList.remove('lm-mod-active');\n }\n\n /**\n * Move the thumb to the specified position.\n */\n private _moveThumb(value: number): void {\n // Clamp the value to the allowed range.\n value = Math.max(0, Math.min(value, this._maximum));\n\n // Bail if the value does not change.\n if (this._value === value) {\n return;\n }\n\n // Update the internal value.\n this._value = value;\n\n // Schedule an update of the scroll bar.\n this.update();\n\n // Emit the thumb moved signal.\n this._thumbMoved.emit(value);\n }\n\n /**\n * A timeout callback for repeating the mouse press.\n */\n private _onRepeat = () => {\n // Clear the repeat timer id.\n this._repeatTimer = -1;\n\n // Bail if the mouse has been released.\n if (!this._pressData) {\n return;\n }\n\n // Look up the part that was pressed.\n let part = this._pressData.part;\n\n // Bail if the thumb was pressed.\n if (part === 'thumb') {\n return;\n }\n\n // Schedule the timer for another repeat.\n this._repeatTimer = window.setTimeout(this._onRepeat, 20);\n\n // Get the current mouse position.\n let mouseX = this._pressData.mouseX;\n let mouseY = this._pressData.mouseY;\n\n // Handle a decrement button repeat.\n if (part === 'decrement') {\n // Bail if the mouse is not over the button.\n if (!ElementExt.hitTest(this.decrementNode, mouseX, mouseY)) {\n return;\n }\n\n // Emit the step requested signal.\n this._stepRequested.emit('decrement');\n\n // Finished.\n return;\n }\n\n // Handle an increment button repeat.\n if (part === 'increment') {\n // Bail if the mouse is not over the button.\n if (!ElementExt.hitTest(this.incrementNode, mouseX, mouseY)) {\n return;\n }\n\n // Emit the step requested signal.\n this._stepRequested.emit('increment');\n\n // Finished.\n return;\n }\n\n // Handle a track repeat.\n if (part === 'track') {\n // Bail if the mouse is not over the track.\n if (!ElementExt.hitTest(this.trackNode, mouseX, mouseY)) {\n return;\n }\n\n // Fetch the thumb node.\n let thumbNode = this.thumbNode;\n\n // Bail if the mouse is over the thumb.\n if (ElementExt.hitTest(thumbNode, mouseX, mouseY)) {\n return;\n }\n\n // Fetch the client rect for the thumb.\n let thumbRect = thumbNode.getBoundingClientRect();\n\n // Determine the direction for the page request.\n let dir: 'decrement' | 'increment';\n if (this._orientation === 'horizontal') {\n dir = mouseX < thumbRect.left ? 'decrement' : 'increment';\n } else {\n dir = mouseY < thumbRect.top ? 'decrement' : 'increment';\n }\n\n // Emit the page requested signal.\n this._pageRequested.emit(dir);\n\n // Finished.\n return;\n }\n };\n\n private _value = 0;\n private _page = 10;\n private _maximum = 100;\n private _repeatTimer = -1;\n private _orientation: ScrollBar.Orientation;\n private _pressData: Private.IPressData | null = null;\n private _thumbMoved = new Signal(this);\n private _stepRequested = new Signal(this);\n private _pageRequested = new Signal(this);\n}\n\n/**\n * The namespace for the `ScrollBar` class statics.\n */\nexport namespace ScrollBar {\n /**\n * A type alias for a scroll bar orientation.\n */\n export type Orientation = 'horizontal' | 'vertical';\n\n /**\n * An options object for creating a scroll bar.\n */\n export interface IOptions {\n /**\n * The orientation of the scroll bar.\n *\n * The default is `'vertical'`.\n */\n orientation?: Orientation;\n\n /**\n * The value for the scroll bar.\n *\n * The default is `0`.\n */\n value?: number;\n\n /**\n * The page size for the scroll bar.\n *\n * The default is `10`.\n */\n page?: number;\n\n /**\n * The maximum value for the scroll bar.\n *\n * The default is `100`.\n */\n maximum?: number;\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * A type alias for the parts of a scroll bar.\n */\n export type ScrollBarPart = 'thumb' | 'track' | 'decrement' | 'increment';\n\n /**\n * An object which holds mouse press data.\n */\n export interface IPressData {\n /**\n * The scroll bar part which was pressed.\n */\n part: ScrollBarPart;\n\n /**\n * The offset of the press in thumb coordinates, or -1.\n */\n delta: number;\n\n /**\n * The scroll value at the time the thumb was pressed, or -1.\n */\n value: number;\n\n /**\n * The disposable which will clear the override cursor.\n */\n override: IDisposable;\n\n /**\n * The current X position of the mouse.\n */\n mouseX: number;\n\n /**\n * The current Y position of the mouse.\n */\n mouseY: number;\n }\n\n /**\n * Create the DOM node for a scroll bar.\n */\n export function createNode(): HTMLElement {\n let node = document.createElement('div');\n let decrement = document.createElement('div');\n let increment = document.createElement('div');\n let track = document.createElement('div');\n let thumb = document.createElement('div');\n decrement.className = 'lm-ScrollBar-button';\n increment.className = 'lm-ScrollBar-button';\n decrement.dataset['action'] = 'decrement';\n increment.dataset['action'] = 'increment';\n track.className = 'lm-ScrollBar-track';\n thumb.className = 'lm-ScrollBar-thumb';\n track.appendChild(thumb);\n node.appendChild(decrement);\n node.appendChild(track);\n node.appendChild(increment);\n return node;\n }\n\n /**\n * Find the scroll bar part which contains the given target.\n */\n export function findPart(\n scrollBar: ScrollBar,\n target: HTMLElement\n ): ScrollBarPart | null {\n // Test the thumb.\n if (scrollBar.thumbNode.contains(target)) {\n return 'thumb';\n }\n\n // Test the track.\n if (scrollBar.trackNode.contains(target)) {\n return 'track';\n }\n\n // Test the decrement button.\n if (scrollBar.decrementNode.contains(target)) {\n return 'decrement';\n }\n\n // Test the increment button.\n if (scrollBar.incrementNode.contains(target)) {\n return 'increment';\n }\n\n // Indicate no match.\n return null;\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { MessageLoop } from '@lumino/messaging';\n\nimport { Layout } from './layout';\n\nimport { Widget } from './widget';\n\n/**\n * A concrete layout implementation which holds a single widget.\n *\n * #### Notes\n * This class is useful for creating simple container widgets which\n * hold a single child. The child should be positioned with CSS.\n */\nexport class SingletonLayout extends Layout {\n /**\n * Dispose of the resources held by the layout.\n */\n dispose(): void {\n if (this._widget) {\n let widget = this._widget;\n this._widget = null;\n widget.dispose();\n }\n super.dispose();\n }\n\n /**\n * Get the child widget for the layout.\n */\n get widget(): Widget | null {\n return this._widget;\n }\n\n /**\n * Set the child widget for the layout.\n *\n * #### Notes\n * Setting the child widget will cause the old child widget to be\n * automatically disposed. If that is not desired, set the parent\n * of the old child to `null` before assigning a new child.\n */\n set widget(widget: Widget | null) {\n // Remove the widget from its current parent. This is a no-op\n // if the widget's parent is already the layout parent widget.\n if (widget) {\n widget.parent = this.parent;\n }\n\n // Bail early if the widget does not change.\n if (this._widget === widget) {\n return;\n }\n\n // Dispose of the old child widget.\n if (this._widget) {\n this._widget.dispose();\n }\n\n // Update the internal widget.\n this._widget = widget;\n\n // Attach the new child widget if needed.\n if (this.parent && widget) {\n this.attachWidget(widget);\n }\n }\n\n /**\n * Create an iterator over the widgets in the layout.\n *\n * @returns A new iterator over the widgets in the layout.\n */\n *[Symbol.iterator](): IterableIterator {\n if (this._widget) {\n yield this._widget;\n }\n }\n\n /**\n * Remove a widget from the layout.\n *\n * @param widget - The widget to remove from the layout.\n *\n * #### Notes\n * A widget is automatically removed from the layout when its `parent`\n * is set to `null`. This method should only be invoked directly when\n * removing a widget from a layout which has yet to be installed on a\n * parent widget.\n *\n * This method does *not* modify the widget's `parent`.\n */\n removeWidget(widget: Widget): void {\n // Bail early if the widget does not exist in the layout.\n if (this._widget !== widget) {\n return;\n }\n\n // Clear the internal widget.\n this._widget = null;\n\n // If the layout is parented, detach the widget from the DOM.\n if (this.parent) {\n this.detachWidget(widget);\n }\n }\n\n /**\n * Perform layout initialization which requires the parent widget.\n */\n protected init(): void {\n super.init();\n for (const widget of this) {\n this.attachWidget(widget);\n }\n }\n\n /**\n * Attach a widget to the parent's DOM node.\n *\n * @param widget - The widget to attach to the parent.\n *\n * #### Notes\n * This method is called automatically by the single layout at the\n * appropriate time. It should not be called directly by user code.\n *\n * The default implementation adds the widgets's node to the parent's\n * node at the proper location, and sends the appropriate attach\n * messages to the widget if the parent is attached to the DOM.\n *\n * Subclasses may reimplement this method to control how the widget's\n * node is added to the parent's node.\n */\n protected attachWidget(widget: Widget): void {\n // Send a `'before-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n }\n\n // Add the widget's node to the parent.\n this.parent!.node.appendChild(widget.node);\n\n // Send an `'after-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n }\n\n /**\n * Detach a widget from the parent's DOM node.\n *\n * @param widget - The widget to detach from the parent.\n *\n * #### Notes\n * This method is called automatically by the single layout at the\n * appropriate time. It should not be called directly by user code.\n *\n * The default implementation removes the widget's node from the\n * parent's node, and sends the appropriate detach messages to the\n * widget if the parent is attached to the DOM.\n *\n * Subclasses may reimplement this method to control how the widget's\n * node is removed from the parent's node.\n */\n protected detachWidget(widget: Widget): void {\n // Send a `'before-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n }\n\n // Remove the widget's node from the parent.\n this.parent!.node.removeChild(widget.node);\n\n // Send an `'after-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n }\n\n private _widget: Widget | null = null;\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { Layout, LayoutItem } from './layout';\n\nimport { PanelLayout } from './panellayout';\n\nimport { Widget } from './widget';\n\n/**\n * A layout where visible widgets are stacked atop one another.\n *\n * #### Notes\n * The Z-order of the visible widgets follows their layout order.\n */\nexport class StackedLayout extends PanelLayout {\n constructor(options: StackedLayout.IOptions = {}) {\n super(options);\n this._hiddenMode =\n options.hiddenMode !== undefined\n ? options.hiddenMode\n : Widget.HiddenMode.Display;\n }\n\n /**\n * The method for hiding widgets.\n *\n * #### Notes\n * If there is only one child widget, `Display` hiding mode will be used\n * regardless of this setting.\n */\n get hiddenMode(): Widget.HiddenMode {\n return this._hiddenMode;\n }\n\n /**\n * Set the method for hiding widgets.\n *\n * #### Notes\n * If there is only one child widget, `Display` hiding mode will be used\n * regardless of this setting.\n */\n set hiddenMode(v: Widget.HiddenMode) {\n if (this._hiddenMode === v) {\n return;\n }\n this._hiddenMode = v;\n if (this.widgets.length > 1) {\n this.widgets.forEach(w => {\n w.hiddenMode = this._hiddenMode;\n });\n }\n }\n\n /**\n * Dispose of the resources held by the layout.\n */\n dispose(): void {\n // Dispose of the layout items.\n for (const item of this._items) {\n item.dispose();\n }\n\n // Clear the layout state.\n this._box = null;\n this._items.length = 0;\n\n // Dispose of the rest of the layout.\n super.dispose();\n }\n\n /**\n * Attach a widget to the parent's DOM node.\n *\n * @param index - The current index of the widget in the layout.\n *\n * @param widget - The widget to attach to the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected attachWidget(index: number, widget: Widget): void {\n // Using transform create an additional layer in the pixel pipeline\n // to limit the number of layer, it is set only if there is more than one widget.\n if (\n this._hiddenMode === Widget.HiddenMode.Scale &&\n this._items.length > 0\n ) {\n if (this._items.length === 1) {\n this.widgets[0].hiddenMode = Widget.HiddenMode.Scale;\n }\n widget.hiddenMode = Widget.HiddenMode.Scale;\n } else {\n widget.hiddenMode = Widget.HiddenMode.Display;\n }\n\n // Create and add a new layout item for the widget.\n ArrayExt.insert(this._items, index, new LayoutItem(widget));\n\n // Send a `'before-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n }\n\n // Add the widget's node to the parent.\n this.parent!.node.appendChild(widget.node);\n\n // Send an `'after-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n\n // Post a fit request for the parent widget.\n this.parent!.fit();\n }\n\n /**\n * Move a widget in the parent's DOM node.\n *\n * @param fromIndex - The previous index of the widget in the layout.\n *\n * @param toIndex - The current index of the widget in the layout.\n *\n * @param widget - The widget to move in the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected moveWidget(\n fromIndex: number,\n toIndex: number,\n widget: Widget\n ): void {\n // Move the layout item for the widget.\n ArrayExt.move(this._items, fromIndex, toIndex);\n\n // Post an update request for the parent widget.\n this.parent!.update();\n }\n\n /**\n * Detach a widget from the parent's DOM node.\n *\n * @param index - The previous index of the widget in the layout.\n *\n * @param widget - The widget to detach from the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected detachWidget(index: number, widget: Widget): void {\n // Remove the layout item for the widget.\n let item = ArrayExt.removeAt(this._items, index);\n\n // Send a `'before-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n }\n\n // Remove the widget's node from the parent.\n this.parent!.node.removeChild(widget.node);\n\n // Send an `'after-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n\n // Reset the z-index for the widget.\n item!.widget.node.style.zIndex = '';\n\n // Reset the hidden mode for the widget.\n if (this._hiddenMode === Widget.HiddenMode.Scale) {\n widget.hiddenMode = Widget.HiddenMode.Display;\n\n // Reset the hidden mode for the first widget if necessary.\n if (this._items.length === 1) {\n this._items[0].widget.hiddenMode = Widget.HiddenMode.Display;\n }\n }\n\n // Dispose of the layout item.\n item!.dispose();\n\n // Post a fit request for the parent widget.\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'before-show'` message.\n */\n protected onBeforeShow(msg: Message): void {\n super.onBeforeShow(msg);\n this.parent!.update();\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n super.onBeforeAttach(msg);\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-shown'` message.\n */\n protected onChildShown(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-hidden'` message.\n */\n protected onChildHidden(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'resize'` message.\n */\n protected onResize(msg: Widget.ResizeMessage): void {\n if (this.parent!.isVisible) {\n this._update(msg.width, msg.height);\n }\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n protected onUpdateRequest(msg: Message): void {\n if (this.parent!.isVisible) {\n this._update(-1, -1);\n }\n }\n\n /**\n * A message handler invoked on a `'fit-request'` message.\n */\n protected onFitRequest(msg: Message): void {\n if (this.parent!.isAttached) {\n this._fit();\n }\n }\n\n /**\n * Fit the layout to the total size required by the widgets.\n */\n private _fit(): void {\n // Set up the computed minimum size.\n let minW = 0;\n let minH = 0;\n\n // Update the computed minimum size.\n for (let i = 0, n = this._items.length; i < n; ++i) {\n // Fetch the item.\n let item = this._items[i];\n\n // Ignore hidden items.\n if (item.isHidden) {\n continue;\n }\n\n // Update the size limits for the item.\n item.fit();\n\n // Update the computed minimum size.\n minW = Math.max(minW, item.minWidth);\n minH = Math.max(minH, item.minHeight);\n }\n\n // Update the box sizing and add it to the computed min size.\n let box = (this._box = ElementExt.boxSizing(this.parent!.node));\n minW += box.horizontalSum;\n minH += box.verticalSum;\n\n // Update the parent's min size constraints.\n let style = this.parent!.node.style;\n style.minWidth = `${minW}px`;\n style.minHeight = `${minH}px`;\n\n // Set the dirty flag to ensure only a single update occurs.\n this._dirty = true;\n\n // Notify the ancestor that it should fit immediately. This may\n // cause a resize of the parent, fulfilling the required update.\n if (this.parent!.parent) {\n MessageLoop.sendMessage(this.parent!.parent!, Widget.Msg.FitRequest);\n }\n\n // If the dirty flag is still set, the parent was not resized.\n // Trigger the required update on the parent widget immediately.\n if (this._dirty) {\n MessageLoop.sendMessage(this.parent!, Widget.Msg.UpdateRequest);\n }\n }\n\n /**\n * Update the layout position and size of the widgets.\n *\n * The parent offset dimensions should be `-1` if unknown.\n */\n private _update(offsetWidth: number, offsetHeight: number): void {\n // Clear the dirty flag to indicate the update occurred.\n this._dirty = false;\n\n // Compute the visible item count.\n let nVisible = 0;\n for (let i = 0, n = this._items.length; i < n; ++i) {\n nVisible += +!this._items[i].isHidden;\n }\n\n // Bail early if there are no visible items to layout.\n if (nVisible === 0) {\n return;\n }\n\n // Measure the parent if the offset dimensions are unknown.\n if (offsetWidth < 0) {\n offsetWidth = this.parent!.node.offsetWidth;\n }\n if (offsetHeight < 0) {\n offsetHeight = this.parent!.node.offsetHeight;\n }\n\n // Ensure the parent box sizing data is computed.\n if (!this._box) {\n this._box = ElementExt.boxSizing(this.parent!.node);\n }\n\n // Compute the actual layout bounds adjusted for border and padding.\n let top = this._box.paddingTop;\n let left = this._box.paddingLeft;\n let width = offsetWidth - this._box.horizontalSum;\n let height = offsetHeight - this._box.verticalSum;\n\n // Update the widget stacking order and layout geometry.\n for (let i = 0, n = this._items.length; i < n; ++i) {\n // Fetch the item.\n let item = this._items[i];\n\n // Ignore hidden items.\n if (item.isHidden) {\n continue;\n }\n\n // Set the z-index for the widget.\n item.widget.node.style.zIndex = `${i}`;\n\n // Update the item geometry.\n item.update(left, top, width, height);\n }\n }\n\n private _dirty = false;\n private _items: LayoutItem[] = [];\n private _box: ElementExt.IBoxSizing | null = null;\n private _hiddenMode: Widget.HiddenMode;\n}\n\n/**\n * The namespace for the `StackedLayout` class statics.\n */\nexport namespace StackedLayout {\n /**\n * An options object for initializing a stacked layout.\n */\n export interface IOptions extends Layout.IOptions {\n /**\n * The method for hiding widgets.\n *\n * The default is `Widget.HiddenMode.Display`.\n */\n hiddenMode?: Widget.HiddenMode;\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { Panel } from './panel';\n\nimport { StackedLayout } from './stackedlayout';\n\nimport { Widget } from './widget';\n\n/**\n * A panel where visible widgets are stacked atop one another.\n *\n * #### Notes\n * This class provides a convenience wrapper around a {@link StackedLayout}.\n */\nexport class StackedPanel extends Panel {\n /**\n * Construct a new stacked panel.\n *\n * @param options - The options for initializing the panel.\n */\n constructor(options: StackedPanel.IOptions = {}) {\n super({ layout: Private.createLayout(options) });\n this.addClass('lm-StackedPanel');\n }\n\n /**\n * The method for hiding widgets.\n *\n * #### Notes\n * If there is only one child widget, `Display` hiding mode will be used\n * regardless of this setting.\n */\n get hiddenMode(): Widget.HiddenMode {\n return (this.layout as StackedLayout).hiddenMode;\n }\n\n /**\n * Set the method for hiding widgets.\n *\n * #### Notes\n * If there is only one child widget, `Display` hiding mode will be used\n * regardless of this setting.\n */\n set hiddenMode(v: Widget.HiddenMode) {\n (this.layout as StackedLayout).hiddenMode = v;\n }\n\n /**\n * A signal emitted when a widget is removed from a stacked panel.\n */\n get widgetRemoved(): ISignal {\n return this._widgetRemoved;\n }\n\n /**\n * A message handler invoked on a `'child-added'` message.\n */\n protected onChildAdded(msg: Widget.ChildMessage): void {\n msg.child.addClass('lm-StackedPanel-child');\n }\n\n /**\n * A message handler invoked on a `'child-removed'` message.\n */\n protected onChildRemoved(msg: Widget.ChildMessage): void {\n msg.child.removeClass('lm-StackedPanel-child');\n this._widgetRemoved.emit(msg.child);\n }\n\n private _widgetRemoved = new Signal(this);\n}\n\n/**\n * The namespace for the `StackedPanel` class statics.\n */\nexport namespace StackedPanel {\n /**\n * An options object for creating a stacked panel.\n */\n export interface IOptions {\n /**\n * The stacked layout to use for the stacked panel.\n *\n * The default is a new `StackedLayout`.\n */\n layout?: StackedLayout;\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * Create a stacked layout for the given panel options.\n */\n export function createLayout(options: StackedPanel.IOptions): StackedLayout {\n return options.layout || new StackedLayout();\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { Platform } from '@lumino/domutils';\n\nimport { MessageLoop } from '@lumino/messaging';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { BoxLayout } from './boxlayout';\n\nimport { StackedPanel } from './stackedpanel';\n\nimport { TabBar } from './tabbar';\n\nimport { Widget } from './widget';\n\n/**\n * A widget which combines a `TabBar` and a `StackedPanel`.\n *\n * #### Notes\n * This is a simple panel which handles the common case of a tab bar\n * placed next to a content area. The selected tab controls the widget\n * which is shown in the content area.\n *\n * For use cases which require more control than is provided by this\n * panel, the `TabBar` widget may be used independently.\n */\nexport class TabPanel extends Widget {\n /**\n * Construct a new tab panel.\n *\n * @param options - The options for initializing the tab panel.\n */\n constructor(options: TabPanel.IOptions = {}) {\n super();\n this.addClass('lm-TabPanel');\n\n // Create the tab bar and stacked panel.\n this.tabBar = new TabBar(options);\n this.tabBar.addClass('lm-TabPanel-tabBar');\n this.stackedPanel = new StackedPanel();\n this.stackedPanel.addClass('lm-TabPanel-stackedPanel');\n\n // Connect the tab bar signal handlers.\n this.tabBar.tabMoved.connect(this._onTabMoved, this);\n this.tabBar.currentChanged.connect(this._onCurrentChanged, this);\n this.tabBar.tabCloseRequested.connect(this._onTabCloseRequested, this);\n this.tabBar.tabActivateRequested.connect(\n this._onTabActivateRequested,\n this\n );\n this.tabBar.addRequested.connect(this._onTabAddRequested, this);\n\n // Connect the stacked panel signal handlers.\n this.stackedPanel.widgetRemoved.connect(this._onWidgetRemoved, this);\n\n // Get the data related to the placement.\n this._tabPlacement = options.tabPlacement || 'top';\n let direction = Private.directionFromPlacement(this._tabPlacement);\n let orientation = Private.orientationFromPlacement(this._tabPlacement);\n\n // Configure the tab bar for the placement.\n this.tabBar.orientation = orientation;\n this.tabBar.dataset['placement'] = this._tabPlacement;\n\n // Create the box layout.\n let layout = new BoxLayout({ direction, spacing: 0 });\n\n // Set the stretch factors for the child widgets.\n BoxLayout.setStretch(this.tabBar, 0);\n BoxLayout.setStretch(this.stackedPanel, 1);\n\n // Add the child widgets to the layout.\n layout.addWidget(this.tabBar);\n layout.addWidget(this.stackedPanel);\n\n // Install the layout on the tab panel.\n this.layout = layout;\n }\n\n /**\n * A signal emitted when the current tab is changed.\n *\n * #### Notes\n * This signal is emitted when the currently selected tab is changed\n * either through user or programmatic interaction.\n *\n * Notably, this signal is not emitted when the index of the current\n * tab changes due to tabs being inserted, removed, or moved. It is\n * only emitted when the actual current tab node is changed.\n */\n get currentChanged(): ISignal {\n return this._currentChanged;\n }\n\n /**\n * Get the index of the currently selected tab.\n *\n * #### Notes\n * This will be `-1` if no tab is selected.\n */\n get currentIndex(): number {\n return this.tabBar.currentIndex;\n }\n\n /**\n * Set the index of the currently selected tab.\n *\n * #### Notes\n * If the index is out of range, it will be set to `-1`.\n */\n set currentIndex(value: number) {\n this.tabBar.currentIndex = value;\n }\n\n /**\n * Get the currently selected widget.\n *\n * #### Notes\n * This will be `null` if there is no selected tab.\n */\n get currentWidget(): Widget | null {\n let title = this.tabBar.currentTitle;\n return title ? title.owner : null;\n }\n\n /**\n * Set the currently selected widget.\n *\n * #### Notes\n * If the widget is not in the panel, it will be set to `null`.\n */\n set currentWidget(value: Widget | null) {\n this.tabBar.currentTitle = value ? value.title : null;\n }\n\n /**\n * Get the whether the tabs are movable by the user.\n *\n * #### Notes\n * Tabs can always be moved programmatically.\n */\n get tabsMovable(): boolean {\n return this.tabBar.tabsMovable;\n }\n\n /**\n * Set the whether the tabs are movable by the user.\n *\n * #### Notes\n * Tabs can always be moved programmatically.\n */\n set tabsMovable(value: boolean) {\n this.tabBar.tabsMovable = value;\n }\n\n /**\n * Get the whether the add button is enabled.\n *\n */\n get addButtonEnabled(): boolean {\n return this.tabBar.addButtonEnabled;\n }\n\n /**\n * Set the whether the add button is enabled.\n *\n */\n set addButtonEnabled(value: boolean) {\n this.tabBar.addButtonEnabled = value;\n }\n\n /**\n * Get the tab placement for the tab panel.\n *\n * #### Notes\n * This controls the position of the tab bar relative to the content.\n */\n get tabPlacement(): TabPanel.TabPlacement {\n return this._tabPlacement;\n }\n\n /**\n * Set the tab placement for the tab panel.\n *\n * #### Notes\n * This controls the position of the tab bar relative to the content.\n */\n set tabPlacement(value: TabPanel.TabPlacement) {\n // Bail if the placement does not change.\n if (this._tabPlacement === value) {\n return;\n }\n\n // Update the internal value.\n this._tabPlacement = value;\n\n // Get the values related to the placement.\n let direction = Private.directionFromPlacement(value);\n let orientation = Private.orientationFromPlacement(value);\n\n // Configure the tab bar for the placement.\n this.tabBar.orientation = orientation;\n this.tabBar.dataset['placement'] = value;\n\n // Update the layout direction.\n (this.layout as BoxLayout).direction = direction;\n }\n\n /**\n * A signal emitted when the add button on a tab bar is clicked.\n *\n */\n get addRequested(): ISignal> {\n return this._addRequested;\n }\n\n /**\n * The tab bar used by the tab panel.\n *\n * #### Notes\n * Modifying the tab bar directly can lead to undefined behavior.\n */\n readonly tabBar: TabBar;\n\n /**\n * The stacked panel used by the tab panel.\n *\n * #### Notes\n * Modifying the panel directly can lead to undefined behavior.\n */\n readonly stackedPanel: StackedPanel;\n\n /**\n * A read-only array of the widgets in the panel.\n */\n get widgets(): ReadonlyArray {\n return this.stackedPanel.widgets;\n }\n\n /**\n * Add a widget to the end of the tab panel.\n *\n * @param widget - The widget to add to the tab panel.\n *\n * #### Notes\n * If the widget is already contained in the panel, it will be moved.\n *\n * The widget's `title` is used to populate the tab.\n */\n addWidget(widget: Widget): void {\n this.insertWidget(this.widgets.length, widget);\n }\n\n /**\n * Insert a widget into the tab panel at a specified index.\n *\n * @param index - The index at which to insert the widget.\n *\n * @param widget - The widget to insert into to the tab panel.\n *\n * #### Notes\n * If the widget is already contained in the panel, it will be moved.\n *\n * The widget's `title` is used to populate the tab.\n */\n insertWidget(index: number, widget: Widget): void {\n if (widget !== this.currentWidget) {\n widget.hide();\n }\n this.stackedPanel.insertWidget(index, widget);\n this.tabBar.insertTab(index, widget.title);\n\n widget.node.setAttribute('role', 'tabpanel');\n\n let renderer = this.tabBar.renderer;\n if (renderer instanceof TabBar.Renderer) {\n let tabId = renderer.createTabKey({\n title: widget.title,\n current: false,\n zIndex: 0\n });\n widget.node.setAttribute('aria-labelledby', tabId);\n }\n }\n\n /**\n * Handle the `currentChanged` signal from the tab bar.\n */\n private _onCurrentChanged(\n sender: TabBar,\n args: TabBar.ICurrentChangedArgs\n ): void {\n // Extract the previous and current title from the args.\n let { previousIndex, previousTitle, currentIndex, currentTitle } = args;\n\n // Extract the widgets from the titles.\n let previousWidget = previousTitle ? previousTitle.owner : null;\n let currentWidget = currentTitle ? currentTitle.owner : null;\n\n // Hide the previous widget.\n if (previousWidget) {\n previousWidget.hide();\n }\n\n // Show the current widget.\n if (currentWidget) {\n currentWidget.show();\n }\n\n // Emit the `currentChanged` signal for the tab panel.\n this._currentChanged.emit({\n previousIndex,\n previousWidget,\n currentIndex,\n currentWidget\n });\n\n // Flush the message loop on IE and Edge to prevent flicker.\n if (Platform.IS_EDGE || Platform.IS_IE) {\n MessageLoop.flush();\n }\n }\n\n /**\n * Handle the `tabAddRequested` signal from the tab bar.\n */\n private _onTabAddRequested(sender: TabBar, args: void): void {\n this._addRequested.emit(sender);\n }\n\n /**\n * Handle the `tabActivateRequested` signal from the tab bar.\n */\n private _onTabActivateRequested(\n sender: TabBar,\n args: TabBar.ITabActivateRequestedArgs\n ): void {\n args.title.owner.activate();\n }\n\n /**\n * Handle the `tabCloseRequested` signal from the tab bar.\n */\n private _onTabCloseRequested(\n sender: TabBar,\n args: TabBar.ITabCloseRequestedArgs\n ): void {\n args.title.owner.close();\n }\n\n /**\n * Handle the `tabMoved` signal from the tab bar.\n */\n private _onTabMoved(\n sender: TabBar,\n args: TabBar.ITabMovedArgs\n ): void {\n this.stackedPanel.insertWidget(args.toIndex, args.title.owner);\n }\n\n /**\n * Handle the `widgetRemoved` signal from the stacked panel.\n */\n private _onWidgetRemoved(sender: StackedPanel, widget: Widget): void {\n widget.node.removeAttribute('role');\n widget.node.removeAttribute('aria-labelledby');\n this.tabBar.removeTab(widget.title);\n }\n\n private _tabPlacement: TabPanel.TabPlacement;\n private _currentChanged = new Signal(\n this\n );\n\n private _addRequested = new Signal>(this);\n}\n\n/**\n * The namespace for the `TabPanel` class statics.\n */\nexport namespace TabPanel {\n /**\n * A type alias for tab placement in a tab bar.\n */\n export type TabPlacement =\n | /**\n * The tabs are placed as a row above the content.\n */\n 'top'\n\n /**\n * The tabs are placed as a column to the left of the content.\n */\n | 'left'\n\n /**\n * The tabs are placed as a column to the right of the content.\n */\n | 'right'\n\n /**\n * The tabs are placed as a row below the content.\n */\n | 'bottom';\n\n /**\n * An options object for initializing a tab panel.\n */\n export interface IOptions {\n /**\n * The document to use with the tab panel.\n *\n * The default is the global `document` instance.\n */\n document?: Document | ShadowRoot;\n\n /**\n * Whether the tabs are movable by the user.\n *\n * The default is `false`.\n */\n tabsMovable?: boolean;\n\n /**\n * Whether the button to add new tabs is enabled.\n *\n * The default is `false`.\n */\n addButtonEnabled?: boolean;\n\n /**\n * The placement of the tab bar relative to the content.\n *\n * The default is `'top'`.\n */\n tabPlacement?: TabPlacement;\n\n /**\n * The renderer for the panel's tab bar.\n *\n * The default is a shared renderer instance.\n */\n renderer?: TabBar.IRenderer;\n }\n\n /**\n * The arguments object for the `currentChanged` signal.\n */\n export interface ICurrentChangedArgs {\n /**\n * The previously selected index.\n */\n previousIndex: number;\n\n /**\n * The previously selected widget.\n */\n previousWidget: Widget | null;\n\n /**\n * The currently selected index.\n */\n currentIndex: number;\n\n /**\n * The currently selected widget.\n */\n currentWidget: Widget | null;\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * Convert a tab placement to tab bar orientation.\n */\n export function orientationFromPlacement(\n plc: TabPanel.TabPlacement\n ): TabBar.Orientation {\n return placementToOrientationMap[plc];\n }\n\n /**\n * Convert a tab placement to a box layout direction.\n */\n export function directionFromPlacement(\n plc: TabPanel.TabPlacement\n ): BoxLayout.Direction {\n return placementToDirectionMap[plc];\n }\n\n /**\n * A mapping of tab placement to tab bar orientation.\n */\n const placementToOrientationMap: { [key: string]: TabBar.Orientation } = {\n top: 'horizontal',\n left: 'vertical',\n right: 'vertical',\n bottom: 'horizontal'\n };\n\n /**\n * A mapping of tab placement to box layout direction.\n */\n const placementToDirectionMap: { [key: string]: BoxLayout.Direction } = {\n top: 'top-to-bottom',\n left: 'left-to-right',\n right: 'right-to-left',\n bottom: 'bottom-to-top'\n };\n}\n"],"names":["Private","Utils"],"mappings":";;;;;;;;;;;;AAAA;AACA;AACA;;;;;;AAM+E;AAE/E;;;;;;;;;AASG;MACU,QAAQ,CAAA;AAArB,IAAA,WAAA,GAAA;AACE;;;;;;;;;;;;AAYG;QACH,IAAQ,CAAA,QAAA,GAAG,CAAC,CAAC;AAEb;;;;;;;;;;;;AAYG;QACH,IAAO,CAAA,OAAA,GAAG,CAAC,CAAC;AAEZ;;;;;;;;;;;;AAYG;QACH,IAAO,CAAA,OAAA,GAAG,QAAQ,CAAC;AAEnB;;;;;;;;;;;;;;;AAeG;QACH,I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e;AACpB,QAAA,IAAI,EAAE,eAAe;AACrB,QAAA,KAAK,EAAE,eAAe;AACtB,QAAA,MAAM,EAAE,eAAe;KACxB,CAAC;AACJ,CAAC,EAtCS,OAAO,KAAP,OAAO,GAsChB,EAAA,CAAA,CAAA;;;;"} +\ No newline at end of file +diff --git a/node_modules/@lumino/widgets/dist/index.js b/node_modules/@lumino/widgets/dist/index.js +index dfbdf6e..ccd0554 100644 +--- a/node_modules/@lumino/widgets/dist/index.js ++++ b/node_modules/@lumino/widgets/dist/index.js +@@ -6546,28 +6546,28 @@ + } + } + /** +- * A message handler invoked on a `'before-attach'` message. ++ * A message handler invoked on a `'after-attach'` message. + */ +- onBeforeAttach(msg) { ++ onAfterAttach(msg) { + this.node.addEventListener('keydown', this); + this.node.addEventListener('mouseup', this); + this.node.addEventListener('mousemove', this); + this.node.addEventListener('mouseenter', this); + this.node.addEventListener('mouseleave', this); + this.node.addEventListener('contextmenu', this); +- document.addEventListener('mousedown', this, true); ++ this.node.ownerDocument.addEventListener('mousedown', this, true); + } + /** +- * A message handler invoked on an `'after-detach'` message. ++ * A message handler invoked on an `'before-detach'` message. + */ +- onAfterDetach(msg) { ++ onBeforeDetach(msg) { + this.node.removeEventListener('keydown', this); + this.node.removeEventListener('mouseup', this); + this.node.removeEventListener('mousemove', this); + this.node.removeEventListener('mouseenter', this); + this.node.removeEventListener('mouseleave', this); + this.node.removeEventListener('contextmenu', this); +- document.removeEventListener('mousedown', this, true); ++ this.node.ownerDocument.removeEventListener('mousedown', this, true); + } + /** + * A message handler invoked on an `'activate-request'` message. +@@ -7151,15 +7151,8 @@ + * The horizontal pixel overlap for an open submenu. + */ + Private.SUBMENU_OVERLAP = 3; +- let transientWindowDataCache = null; +- let transientCacheCounter = 0; +- function getWindowData() { +- // if transient cache is in use, take one from it +- if (transientCacheCounter > 0) { +- transientCacheCounter--; +- return transientWindowDataCache; +- } +- return _getWindowData(); ++ function getWindowData(element) { ++ return _getWindowData(element); + } + /** + * Store window data in transient cache. +@@ -7171,8 +7164,6 @@ + * Note: should be called before any DOM modifications. + */ + function saveWindowData() { +- transientWindowDataCache = _getWindowData(); +- transientCacheCounter++; + } + Private.saveWindowData = saveWindowData; + /** +@@ -7267,12 +7258,13 @@ + return result; + } + Private.computeCollapsed = computeCollapsed; +- function _getWindowData() { ++ function _getWindowData(element) { ++ var _a, _b; + return { +- pageXOffset: window.pageXOffset, +- pageYOffset: window.pageYOffset, +- clientWidth: document.documentElement.clientWidth, +- clientHeight: document.documentElement.clientHeight ++ pageXOffset: ((_a = element.ownerDocument.defaultView) === null || _a === void 0 ? void 0 : _a.window.scrollX) || 0, ++ pageYOffset: ((_b = element.ownerDocument.defaultView) === null || _b === void 0 ? void 0 : _b.window.scrollY) || 0, ++ clientWidth: element.ownerDocument.documentElement.clientWidth, ++ clientHeight: element.ownerDocument.documentElement.clientHeight + }; + } + /** +@@ -7280,7 +7272,7 @@ + */ + function openRootMenu(menu, x, y, forceX, forceY, horizontalAlignment, host, ref) { + // Get the current position and size of the main viewport. +- const windowData = getWindowData(); ++ const windowData = getWindowData(host || menu.node); + let px = windowData.pageXOffset; + let py = windowData.pageYOffset; + let cw = windowData.clientWidth; +@@ -7292,6 +7284,8 @@ + // Fetch common variables. + let node = menu.node; + let style = node.style; ++ style.top = '0'; ++ style.left = '0'; + // Clear the menu geometry and prepare it for measuring. + style.opacity = '0'; + style.maxHeight = `${maxHeight}px`; +@@ -7327,7 +7321,7 @@ + */ + function openSubmenu(submenu, itemNode) { + // Get the current position and size of the main viewport. +- const windowData = getWindowData(); ++ const windowData = getWindowData(itemNode); + let px = windowData.pageXOffset; + let py = windowData.pageYOffset; + let cw = windowData.clientWidth; +@@ -7343,7 +7337,7 @@ + style.opacity = '0'; + style.maxHeight = `${maxHeight}px`; + // Attach the menu to the document. +- Widget.attach(submenu, document.body); ++ Widget.attach(submenu, itemNode.ownerDocument.body); + // Measure the size of the menu. + let { width, height } = node.getBoundingClientRect(); + // Compute the box sizing for the menu. +@@ -7362,6 +7356,8 @@ + if (y + height > py + ch) { + y = itemRect.bottom + box.borderBottom + box.paddingBottom - height; + } ++ style.top = '0'; ++ style.left = '0'; + // Update the position of the menu to the computed position. + style.transform = `translate(${Math.max(0, x)}px, ${Math.max(0, y)}px`; + // Finally, make the menu visible on the screen. +diff --git a/node_modules/@lumino/widgets/dist/index.js.map b/node_modules/@lumino/widgets/dist/index.js.map +index 8e76140..24b3ea3 100644 +--- a/node_modules/@lumino/widgets/dist/index.js.map ++++ b/node_modules/@lumino/widgets/dist/index.js.map +@@ -1 +1 @@ +-{"version":3,"file":"index.js","sources":["../src/boxengine.ts","../src/title.ts","../src/widget.ts","../src/layout.ts","../src/panellayout.ts","../src/utils.ts","../src/splitlayout.ts","../src/accordionlayout.ts","../src/panel.ts","../src/splitpanel.ts","../src/accordionpanel.ts","../src/boxlayout.ts","../src/boxpanel.ts","../src/commandpalette.ts","../src/menu.ts","../src/contextmenu.ts","../src/tabbar.ts","../src/docklayout.ts","../src/dockpanel.ts","../src/focustracker.ts","../src/gridlayout.ts","../src/menubar.ts","../src/scrollbar.ts","../src/singletonlayout.ts","../src/stackedlayout.ts","../src/stackedpanel.ts","../src/tabpanel.ts"],"sourcesContent":["// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n\n/**\n * A sizer object for use with the box engine layout functions.\n *\n * #### Notes\n * A box sizer holds the geometry information for an object along an\n * arbitrary layout orientation.\n *\n * For best performance, this class should be treated as a raw data\n * struct. It should not typically be subclassed.\n */\nexport class BoxSizer {\n /**\n * The preferred size for the sizer.\n *\n * #### Notes\n * The sizer will be given this initial size subject to its size\n * bounds. The sizer will not deviate from this size unless such\n * deviation is required to fit into the available layout space.\n *\n * There is no limit to this value, but it will be clamped to the\n * bounds defined by {@link minSize} and {@link maxSize}.\n *\n * The default value is `0`.\n */\n sizeHint = 0;\n\n /**\n * The minimum size of the sizer.\n *\n * #### Notes\n * The sizer will never be sized less than this value, even if\n * it means the sizer will overflow the available layout space.\n *\n * It is assumed that this value lies in the range `[0, Infinity)`\n * and that it is `<=` to {@link maxSize}. Failure to adhere to this\n * constraint will yield undefined results.\n *\n * The default value is `0`.\n */\n minSize = 0;\n\n /**\n * The maximum size of the sizer.\n *\n * #### Notes\n * The sizer will never be sized greater than this value, even if\n * it means the sizer will underflow the available layout space.\n *\n * It is assumed that this value lies in the range `[0, Infinity]`\n * and that it is `>=` to {@link minSize}. Failure to adhere to this\n * constraint will yield undefined results.\n *\n * The default value is `Infinity`.\n */\n maxSize = Infinity;\n\n /**\n * The stretch factor for the sizer.\n *\n * #### Notes\n * This controls how much the sizer stretches relative to its sibling\n * sizers when layout space is distributed. A stretch factor of zero\n * is special and will cause the sizer to only be resized after all\n * other sizers with a stretch factor greater than zero have been\n * resized to their limits.\n *\n * It is assumed that this value is an integer that lies in the range\n * `[0, Infinity)`. Failure to adhere to this constraint will yield\n * undefined results.\n *\n * The default value is `1`.\n */\n stretch = 1;\n\n /**\n * The computed size of the sizer.\n *\n * #### Notes\n * This value is the output of a call to {@link BoxEngine.calc}. It represents\n * the computed size for the object along the layout orientation,\n * and will always lie in the range `[minSize, maxSize]`.\n *\n * This value is output only.\n *\n * Changing this value will have no effect.\n */\n size = 0;\n\n /**\n * An internal storage property for the layout algorithm.\n *\n * #### Notes\n * This value is used as temporary storage by the layout algorithm.\n *\n * Changing this value will have no effect.\n */\n done = false;\n}\n\n/**\n * The namespace for the box engine layout functions.\n */\nexport namespace BoxEngine {\n /**\n * Calculate the optimal layout sizes for a sequence of box sizers.\n *\n * This distributes the available layout space among the box sizers\n * according to the following algorithm:\n *\n * 1. Initialize the sizers's size to its size hint and compute the\n * sums for each of size hint, min size, and max size.\n *\n * 2. If the total size hint equals the available space, return.\n *\n * 3. If the available space is less than the total min size, set all\n * sizers to their min size and return.\n *\n * 4. If the available space is greater than the total max size, set\n * all sizers to their max size and return.\n *\n * 5. If the layout space is less than the total size hint, distribute\n * the negative delta as follows:\n *\n * a. Shrink each sizer with a stretch factor greater than zero by\n * an amount proportional to the negative space and the sum of\n * stretch factors. If the sizer reaches its min size, remove\n * it and its stretch factor from the computation.\n *\n * b. If after adjusting all stretch sizers there remains negative\n * space, distribute the space equally among the sizers with a\n * stretch factor of zero. If a sizer reaches its min size,\n * remove it from the computation.\n *\n * 6. If the layout space is greater than the total size hint,\n * distribute the positive delta as follows:\n *\n * a. Expand each sizer with a stretch factor greater than zero by\n * an amount proportional to the postive space and the sum of\n * stretch factors. If the sizer reaches its max size, remove\n * it and its stretch factor from the computation.\n *\n * b. If after adjusting all stretch sizers there remains positive\n * space, distribute the space equally among the sizers with a\n * stretch factor of zero. If a sizer reaches its max size,\n * remove it from the computation.\n *\n * 7. return\n *\n * @param sizers - The sizers for a particular layout line.\n *\n * @param space - The available layout space for the sizers.\n *\n * @returns The delta between the provided available space and the\n * actual consumed space. This value will be zero if the sizers\n * can be adjusted to fit, negative if the available space is too\n * small, and positive if the available space is too large.\n *\n * #### Notes\n * The {@link BoxSizer.size} of each sizer is updated with the computed size.\n *\n * This function can be called at any time to recompute the layout for\n * an existing sequence of sizers. The previously computed results will\n * have no effect on the new output. It is therefore not necessary to\n * create new sizer objects on each resize event.\n */\n export function calc(sizers: ArrayLike, space: number): number {\n // Bail early if there is nothing to do.\n let count = sizers.length;\n if (count === 0) {\n return space;\n }\n\n // Setup the size and stretch counters.\n let totalMin = 0;\n let totalMax = 0;\n let totalSize = 0;\n let totalStretch = 0;\n let stretchCount = 0;\n\n // Setup the sizers and compute the totals.\n for (let i = 0; i < count; ++i) {\n let sizer = sizers[i];\n let min = sizer.minSize;\n let max = sizer.maxSize;\n let hint = sizer.sizeHint;\n sizer.done = false;\n sizer.size = Math.max(min, Math.min(hint, max));\n totalSize += sizer.size;\n totalMin += min;\n totalMax += max;\n if (sizer.stretch > 0) {\n totalStretch += sizer.stretch;\n stretchCount++;\n }\n }\n\n // If the space is equal to the total size, return early.\n if (space === totalSize) {\n return 0;\n }\n\n // If the space is less than the total min, minimize each sizer.\n if (space <= totalMin) {\n for (let i = 0; i < count; ++i) {\n let sizer = sizers[i];\n sizer.size = sizer.minSize;\n }\n return space - totalMin;\n }\n\n // If the space is greater than the total max, maximize each sizer.\n if (space >= totalMax) {\n for (let i = 0; i < count; ++i) {\n let sizer = sizers[i];\n sizer.size = sizer.maxSize;\n }\n return space - totalMax;\n }\n\n // The loops below perform sub-pixel precision sizing. A near zero\n // value is used for compares instead of zero to ensure that the\n // loop terminates when the subdivided space is reasonably small.\n let nearZero = 0.01;\n\n // A counter which is decremented each time a sizer is resized to\n // its limit. This ensures the loops terminate even if there is\n // space remaining to distribute.\n let notDoneCount = count;\n\n // Distribute negative delta space.\n if (space < totalSize) {\n // Shrink each stretchable sizer by an amount proportional to its\n // stretch factor. If a sizer reaches its min size it's marked as\n // done. The loop progresses in phases where each sizer is given\n // a chance to consume its fair share for the pass, regardless of\n // whether a sizer before it reached its limit. This continues\n // until the stretchable sizers or the free space is exhausted.\n let freeSpace = totalSize - space;\n while (stretchCount > 0 && freeSpace > nearZero) {\n let distSpace = freeSpace;\n let distStretch = totalStretch;\n for (let i = 0; i < count; ++i) {\n let sizer = sizers[i];\n if (sizer.done || sizer.stretch === 0) {\n continue;\n }\n let amt = (sizer.stretch * distSpace) / distStretch;\n if (sizer.size - amt <= sizer.minSize) {\n freeSpace -= sizer.size - sizer.minSize;\n totalStretch -= sizer.stretch;\n sizer.size = sizer.minSize;\n sizer.done = true;\n notDoneCount--;\n stretchCount--;\n } else {\n freeSpace -= amt;\n sizer.size -= amt;\n }\n }\n }\n // Distribute any remaining space evenly among the non-stretchable\n // sizers. This progresses in phases in the same manner as above.\n while (notDoneCount > 0 && freeSpace > nearZero) {\n let amt = freeSpace / notDoneCount;\n for (let i = 0; i < count; ++i) {\n let sizer = sizers[i];\n if (sizer.done) {\n continue;\n }\n if (sizer.size - amt <= sizer.minSize) {\n freeSpace -= sizer.size - sizer.minSize;\n sizer.size = sizer.minSize;\n sizer.done = true;\n notDoneCount--;\n } else {\n freeSpace -= amt;\n sizer.size -= amt;\n }\n }\n }\n }\n // Distribute positive delta space.\n else {\n // Expand each stretchable sizer by an amount proportional to its\n // stretch factor. If a sizer reaches its max size it's marked as\n // done. The loop progresses in phases where each sizer is given\n // a chance to consume its fair share for the pass, regardless of\n // whether a sizer before it reached its limit. This continues\n // until the stretchable sizers or the free space is exhausted.\n let freeSpace = space - totalSize;\n while (stretchCount > 0 && freeSpace > nearZero) {\n let distSpace = freeSpace;\n let distStretch = totalStretch;\n for (let i = 0; i < count; ++i) {\n let sizer = sizers[i];\n if (sizer.done || sizer.stretch === 0) {\n continue;\n }\n let amt = (sizer.stretch * distSpace) / distStretch;\n if (sizer.size + amt >= sizer.maxSize) {\n freeSpace -= sizer.maxSize - sizer.size;\n totalStretch -= sizer.stretch;\n sizer.size = sizer.maxSize;\n sizer.done = true;\n notDoneCount--;\n stretchCount--;\n } else {\n freeSpace -= amt;\n sizer.size += amt;\n }\n }\n }\n // Distribute any remaining space evenly among the non-stretchable\n // sizers. This progresses in phases in the same manner as above.\n while (notDoneCount > 0 && freeSpace > nearZero) {\n let amt = freeSpace / notDoneCount;\n for (let i = 0; i < count; ++i) {\n let sizer = sizers[i];\n if (sizer.done) {\n continue;\n }\n if (sizer.size + amt >= sizer.maxSize) {\n freeSpace -= sizer.maxSize - sizer.size;\n sizer.size = sizer.maxSize;\n sizer.done = true;\n notDoneCount--;\n } else {\n freeSpace -= amt;\n sizer.size += amt;\n }\n }\n }\n }\n\n // Indicate that the consumed space equals the available space.\n return 0;\n }\n\n /**\n * Adjust a sizer by a delta and update its neighbors accordingly.\n *\n * @param sizers - The sizers which should be adjusted.\n *\n * @param index - The index of the sizer to grow.\n *\n * @param delta - The amount to adjust the sizer, positive or negative.\n *\n * #### Notes\n * This will adjust the indicated sizer by the specified amount, along\n * with the sizes of the appropriate neighbors, subject to the limits\n * specified by each of the sizers.\n *\n * This is useful when implementing box layouts where the boundaries\n * between the sizers are interactively adjustable by the user.\n */\n export function adjust(\n sizers: ArrayLike,\n index: number,\n delta: number\n ): void {\n // Bail early when there is nothing to do.\n if (sizers.length === 0 || delta === 0) {\n return;\n }\n\n // Dispatch to the proper implementation.\n if (delta > 0) {\n growSizer(sizers, index, delta);\n } else {\n shrinkSizer(sizers, index, -delta);\n }\n }\n\n /**\n * Grow a sizer by a positive delta and adjust neighbors.\n */\n function growSizer(\n sizers: ArrayLike,\n index: number,\n delta: number\n ): void {\n // Compute how much the items to the left can expand.\n let growLimit = 0;\n for (let i = 0; i <= index; ++i) {\n let sizer = sizers[i];\n growLimit += sizer.maxSize - sizer.size;\n }\n\n // Compute how much the items to the right can shrink.\n let shrinkLimit = 0;\n for (let i = index + 1, n = sizers.length; i < n; ++i) {\n let sizer = sizers[i];\n shrinkLimit += sizer.size - sizer.minSize;\n }\n\n // Clamp the delta adjustment to the limits.\n delta = Math.min(delta, growLimit, shrinkLimit);\n\n // Grow the sizers to the left by the delta.\n let grow = delta;\n for (let i = index; i >= 0 && grow > 0; --i) {\n let sizer = sizers[i];\n let limit = sizer.maxSize - sizer.size;\n if (limit >= grow) {\n sizer.sizeHint = sizer.size + grow;\n grow = 0;\n } else {\n sizer.sizeHint = sizer.size + limit;\n grow -= limit;\n }\n }\n\n // Shrink the sizers to the right by the delta.\n let shrink = delta;\n for (let i = index + 1, n = sizers.length; i < n && shrink > 0; ++i) {\n let sizer = sizers[i];\n let limit = sizer.size - sizer.minSize;\n if (limit >= shrink) {\n sizer.sizeHint = sizer.size - shrink;\n shrink = 0;\n } else {\n sizer.sizeHint = sizer.size - limit;\n shrink -= limit;\n }\n }\n }\n\n /**\n * Shrink a sizer by a positive delta and adjust neighbors.\n */\n function shrinkSizer(\n sizers: ArrayLike,\n index: number,\n delta: number\n ): void {\n // Compute how much the items to the right can expand.\n let growLimit = 0;\n for (let i = index + 1, n = sizers.length; i < n; ++i) {\n let sizer = sizers[i];\n growLimit += sizer.maxSize - sizer.size;\n }\n\n // Compute how much the items to the left can shrink.\n let shrinkLimit = 0;\n for (let i = 0; i <= index; ++i) {\n let sizer = sizers[i];\n shrinkLimit += sizer.size - sizer.minSize;\n }\n\n // Clamp the delta adjustment to the limits.\n delta = Math.min(delta, growLimit, shrinkLimit);\n\n // Grow the sizers to the right by the delta.\n let grow = delta;\n for (let i = index + 1, n = sizers.length; i < n && grow > 0; ++i) {\n let sizer = sizers[i];\n let limit = sizer.maxSize - sizer.size;\n if (limit >= grow) {\n sizer.sizeHint = sizer.size + grow;\n grow = 0;\n } else {\n sizer.sizeHint = sizer.size + limit;\n grow -= limit;\n }\n }\n\n // Shrink the sizers to the left by the delta.\n let shrink = delta;\n for (let i = index; i >= 0 && shrink > 0; --i) {\n let sizer = sizers[i];\n let limit = sizer.size - sizer.minSize;\n if (limit >= shrink) {\n sizer.sizeHint = sizer.size - shrink;\n shrink = 0;\n } else {\n sizer.sizeHint = sizer.size - limit;\n shrink -= limit;\n }\n }\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { IDisposable } from '@lumino/disposable';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { VirtualElement } from '@lumino/virtualdom';\n\n/**\n * An object which holds data related to an object's title.\n *\n * #### Notes\n * A title object is intended to hold the data necessary to display a\n * header for a particular object. A common example is the `TabPanel`,\n * which uses the widget title to populate the tab for a child widget.\n *\n * It is the responsibility of the owner to call the title disposal.\n */\nexport class Title implements IDisposable {\n /**\n * Construct a new title.\n *\n * @param options - The options for initializing the title.\n */\n constructor(options: Title.IOptions) {\n this.owner = options.owner;\n if (options.label !== undefined) {\n this._label = options.label;\n }\n if (options.mnemonic !== undefined) {\n this._mnemonic = options.mnemonic;\n }\n if (options.icon !== undefined) {\n this._icon = options.icon;\n }\n\n if (options.iconClass !== undefined) {\n this._iconClass = options.iconClass;\n }\n if (options.iconLabel !== undefined) {\n this._iconLabel = options.iconLabel;\n }\n if (options.caption !== undefined) {\n this._caption = options.caption;\n }\n if (options.className !== undefined) {\n this._className = options.className;\n }\n if (options.closable !== undefined) {\n this._closable = options.closable;\n }\n this._dataset = options.dataset || {};\n }\n\n /**\n * A signal emitted when the state of the title changes.\n */\n get changed(): ISignal {\n return this._changed;\n }\n\n /**\n * The object which owns the title.\n */\n readonly owner: T;\n\n /**\n * Get the label for the title.\n *\n * #### Notes\n * The default value is an empty string.\n */\n get label(): string {\n return this._label;\n }\n\n /**\n * Set the label for the title.\n */\n set label(value: string) {\n if (this._label === value) {\n return;\n }\n this._label = value;\n this._changed.emit(undefined);\n }\n\n /**\n * Get the mnemonic index for the title.\n *\n * #### Notes\n * The default value is `-1`.\n */\n get mnemonic(): number {\n return this._mnemonic;\n }\n\n /**\n * Set the mnemonic index for the title.\n */\n set mnemonic(value: number) {\n if (this._mnemonic === value) {\n return;\n }\n this._mnemonic = value;\n this._changed.emit(undefined);\n }\n\n /**\n * Get the icon renderer for the title.\n *\n * #### Notes\n * The default value is undefined.\n */\n get icon(): VirtualElement.IRenderer | undefined {\n return this._icon;\n }\n\n /**\n * Set the icon renderer for the title.\n *\n * #### Notes\n * A renderer is an object that supplies a render and unrender function.\n */\n set icon(value: VirtualElement.IRenderer | undefined) {\n if (this._icon === value) {\n return;\n }\n this._icon = value;\n this._changed.emit(undefined);\n }\n\n /**\n * Get the icon class name for the title.\n *\n * #### Notes\n * The default value is an empty string.\n */\n get iconClass(): string {\n return this._iconClass;\n }\n\n /**\n * Set the icon class name for the title.\n *\n * #### Notes\n * Multiple class names can be separated with whitespace.\n */\n set iconClass(value: string) {\n if (this._iconClass === value) {\n return;\n }\n this._iconClass = value;\n this._changed.emit(undefined);\n }\n\n /**\n * Get the icon label for the title.\n *\n * #### Notes\n * The default value is an empty string.\n */\n get iconLabel(): string {\n return this._iconLabel;\n }\n\n /**\n * Set the icon label for the title.\n *\n * #### Notes\n * Multiple class names can be separated with whitespace.\n */\n set iconLabel(value: string) {\n if (this._iconLabel === value) {\n return;\n }\n this._iconLabel = value;\n this._changed.emit(undefined);\n }\n\n /**\n * Get the caption for the title.\n *\n * #### Notes\n * The default value is an empty string.\n */\n get caption(): string {\n return this._caption;\n }\n\n /**\n * Set the caption for the title.\n */\n set caption(value: string) {\n if (this._caption === value) {\n return;\n }\n this._caption = value;\n this._changed.emit(undefined);\n }\n\n /**\n * Get the extra class name for the title.\n *\n * #### Notes\n * The default value is an empty string.\n */\n get className(): string {\n return this._className;\n }\n\n /**\n * Set the extra class name for the title.\n *\n * #### Notes\n * Multiple class names can be separated with whitespace.\n */\n set className(value: string) {\n if (this._className === value) {\n return;\n }\n this._className = value;\n this._changed.emit(undefined);\n }\n\n /**\n * Get the closable state for the title.\n *\n * #### Notes\n * The default value is `false`.\n */\n get closable(): boolean {\n return this._closable;\n }\n\n /**\n * Set the closable state for the title.\n *\n * #### Notes\n * This controls the presence of a close icon when applicable.\n */\n set closable(value: boolean) {\n if (this._closable === value) {\n return;\n }\n this._closable = value;\n this._changed.emit(undefined);\n }\n\n /**\n * Get the dataset for the title.\n *\n * #### Notes\n * The default value is an empty dataset.\n */\n get dataset(): Title.Dataset {\n return this._dataset;\n }\n\n /**\n * Set the dataset for the title.\n *\n * #### Notes\n * This controls the data attributes when applicable.\n */\n set dataset(value: Title.Dataset) {\n if (this._dataset === value) {\n return;\n }\n this._dataset = value;\n this._changed.emit(undefined);\n }\n\n /**\n * Test whether the title has been disposed.\n */\n get isDisposed(): boolean {\n return this._isDisposed;\n }\n\n /**\n * Dispose of the resources held by the title.\n *\n * #### Notes\n * It is the responsibility of the owner to call the title disposal.\n */\n dispose(): void {\n if (this.isDisposed) {\n return;\n }\n this._isDisposed = true;\n\n Signal.clearData(this);\n }\n\n private _label = '';\n private _caption = '';\n private _mnemonic = -1;\n private _icon: VirtualElement.IRenderer | undefined = undefined;\n private _iconClass = '';\n private _iconLabel = '';\n private _className = '';\n private _closable = false;\n private _dataset: Title.Dataset;\n private _changed = new Signal(this);\n private _isDisposed = false;\n}\n\n/**\n * The namespace for the `Title` class statics.\n */\nexport namespace Title {\n /**\n * A type alias for a simple immutable string dataset.\n */\n export type Dataset = { readonly [key: string]: string };\n\n /**\n * An options object for initializing a title.\n */\n export interface IOptions {\n /**\n * The object which owns the title.\n */\n owner: T;\n\n /**\n * The label for the title.\n */\n label?: string;\n\n /**\n * The mnemonic index for the title.\n */\n mnemonic?: number;\n\n /**\n * The icon renderer for the title.\n */\n icon?: VirtualElement.IRenderer;\n\n /**\n * The icon class name for the title.\n */\n iconClass?: string;\n\n /**\n * The icon label for the title.\n */\n iconLabel?: string;\n\n /**\n * The caption for the title.\n */\n caption?: string;\n\n /**\n * The extra class name for the title.\n */\n className?: string;\n\n /**\n * The closable state for the title.\n */\n closable?: boolean;\n\n /**\n * The dataset for the title.\n */\n dataset?: Dataset;\n }\n}\n","/* eslint-disable @typescript-eslint/no-empty-function */\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { IObservableDisposable } from '@lumino/disposable';\n\nimport {\n ConflatableMessage,\n IMessageHandler,\n Message,\n MessageLoop\n} from '@lumino/messaging';\n\nimport { AttachedProperty } from '@lumino/properties';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { Layout } from './layout';\n\nimport { Title } from './title';\n\n/**\n * The base class of the lumino widget hierarchy.\n *\n * #### Notes\n * This class will typically be subclassed in order to create a useful\n * widget. However, it can be used directly to host externally created\n * content.\n */\nexport class Widget implements IMessageHandler, IObservableDisposable {\n /**\n * Construct a new widget.\n *\n * @param options - The options for initializing the widget.\n */\n constructor(options: Widget.IOptions = {}) {\n this.node = Private.createNode(options);\n this.addClass('lm-Widget');\n }\n\n /**\n * Dispose of the widget and its descendant widgets.\n *\n * #### Notes\n * It is unsafe to use the widget after it has been disposed.\n *\n * All calls made to this method after the first are a no-op.\n */\n dispose(): void {\n // Do nothing if the widget is already disposed.\n if (this.isDisposed) {\n return;\n }\n\n // Set the disposed flag and emit the disposed signal.\n this.setFlag(Widget.Flag.IsDisposed);\n this._disposed.emit(undefined);\n\n // Remove or detach the widget if necessary.\n if (this.parent) {\n this.parent = null;\n } else if (this.isAttached) {\n Widget.detach(this);\n }\n\n // Dispose of the widget layout.\n if (this._layout) {\n this._layout.dispose();\n this._layout = null;\n }\n\n // Dispose the title\n this.title.dispose();\n\n // Clear the extra data associated with the widget.\n Signal.clearData(this);\n MessageLoop.clearData(this);\n AttachedProperty.clearData(this);\n }\n\n /**\n * A signal emitted when the widget is disposed.\n */\n get disposed(): ISignal {\n return this._disposed;\n }\n\n /**\n * Get the DOM node owned by the widget.\n */\n readonly node: HTMLElement;\n\n /**\n * Test whether the widget has been disposed.\n */\n get isDisposed(): boolean {\n return this.testFlag(Widget.Flag.IsDisposed);\n }\n\n /**\n * Test whether the widget's node is attached to the DOM.\n */\n get isAttached(): boolean {\n return this.testFlag(Widget.Flag.IsAttached);\n }\n\n /**\n * Test whether the widget is explicitly hidden.\n *\n * #### Notes\n * You should prefer `!{@link isVisible}` over `{@link isHidden}` if you want to know if the\n * widget is hidden as this does not test if the widget is hidden because one of its ancestors is hidden.\n */\n get isHidden(): boolean {\n return this.testFlag(Widget.Flag.IsHidden);\n }\n\n /**\n * Test whether the widget is visible.\n *\n * #### Notes\n * A widget is visible when it is attached to the DOM, is not\n * explicitly hidden, and has no explicitly hidden ancestors.\n *\n * Since 2.7.0, this does not rely on the {@link Widget.Flag.IsVisible} flag.\n * It recursively checks the visibility of all parent widgets.\n */\n get isVisible(): boolean {\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n let parent: Widget | null = this;\n do {\n if (parent.isHidden || !parent.isAttached) {\n return false;\n }\n parent = parent.parent;\n } while (parent != null);\n return true;\n }\n\n /**\n * The title object for the widget.\n *\n * #### Notes\n * The title object is used by some container widgets when displaying\n * the widget alongside some title, such as a tab panel or side bar.\n *\n * Since not all widgets will use the title, it is created on demand.\n *\n * The `owner` property of the title is set to this widget.\n */\n get title(): Title {\n return Private.titleProperty.get(this);\n }\n\n /**\n * Get the id of the widget's DOM node.\n */\n get id(): string {\n return this.node.id;\n }\n\n /**\n * Set the id of the widget's DOM node.\n */\n set id(value: string) {\n this.node.id = value;\n }\n\n /**\n * The dataset for the widget's DOM node.\n */\n get dataset(): DOMStringMap {\n return this.node.dataset;\n }\n\n /**\n * Get the method for hiding the widget.\n */\n get hiddenMode(): Widget.HiddenMode {\n return this._hiddenMode;\n }\n\n /**\n * Set the method for hiding the widget.\n */\n set hiddenMode(value: Widget.HiddenMode) {\n if (this._hiddenMode === value) {\n return;\n }\n\n if (this.isHidden) {\n // Reset styles set by previous mode.\n this._toggleHidden(false);\n }\n\n if (value == Widget.HiddenMode.Scale) {\n this.node.style.willChange = 'transform';\n } else {\n this.node.style.willChange = 'auto';\n }\n\n this._hiddenMode = value;\n\n if (this.isHidden) {\n // Set styles for new mode.\n this._toggleHidden(true);\n }\n }\n\n /**\n * Get the parent of the widget.\n */\n get parent(): Widget | null {\n return this._parent;\n }\n\n /**\n * Set the parent of the widget.\n *\n * #### Notes\n * Children are typically added to a widget by using a layout, which\n * means user code will not normally set the parent widget directly.\n *\n * The widget will be automatically removed from its old parent.\n *\n * This is a no-op if there is no effective parent change.\n */\n set parent(value: Widget | null) {\n if (this._parent === value) {\n return;\n }\n if (value && this.contains(value)) {\n throw new Error('Invalid parent widget.');\n }\n if (this._parent && !this._parent.isDisposed) {\n let msg = new Widget.ChildMessage('child-removed', this);\n MessageLoop.sendMessage(this._parent, msg);\n }\n this._parent = value;\n if (this._parent && !this._parent.isDisposed) {\n let msg = new Widget.ChildMessage('child-added', this);\n MessageLoop.sendMessage(this._parent, msg);\n }\n if (!this.isDisposed) {\n MessageLoop.sendMessage(this, Widget.Msg.ParentChanged);\n }\n }\n\n /**\n * Get the layout for the widget.\n */\n get layout(): Layout | null {\n return this._layout;\n }\n\n /**\n * Set the layout for the widget.\n *\n * #### Notes\n * The layout is single-use only. It cannot be changed after the\n * first assignment.\n *\n * The layout is disposed automatically when the widget is disposed.\n */\n set layout(value: Layout | null) {\n if (this._layout === value) {\n return;\n }\n if (this.testFlag(Widget.Flag.DisallowLayout)) {\n throw new Error('Cannot set widget layout.');\n }\n if (this._layout) {\n throw new Error('Cannot change widget layout.');\n }\n if (value!.parent) {\n throw new Error('Cannot change layout parent.');\n }\n this._layout = value;\n value!.parent = this;\n }\n\n /**\n * Create an iterator over the widget's children.\n *\n * @returns A new iterator over the children of the widget.\n *\n * #### Notes\n * The widget must have a populated layout in order to have children.\n *\n * If a layout is not installed, the returned iterator will be empty.\n */\n *children(): IterableIterator {\n if (this._layout) {\n yield* this._layout;\n }\n }\n\n /**\n * Test whether a widget is a descendant of this widget.\n *\n * @param widget - The descendant widget of interest.\n *\n * @returns `true` if the widget is a descendant, `false` otherwise.\n */\n contains(widget: Widget): boolean {\n for (let value: Widget | null = widget; value; value = value._parent) {\n if (value === this) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * Test whether the widget's DOM node has the given class name.\n *\n * @param name - The class name of interest.\n *\n * @returns `true` if the node has the class, `false` otherwise.\n */\n hasClass(name: string): boolean {\n return this.node.classList.contains(name);\n }\n\n /**\n * Add a class name to the widget's DOM node.\n *\n * @param name - The class name to add to the node.\n *\n * #### Notes\n * If the class name is already added to the node, this is a no-op.\n *\n * The class name must not contain whitespace.\n */\n addClass(name: string): void {\n this.node.classList.add(name);\n }\n\n /**\n * Remove a class name from the widget's DOM node.\n *\n * @param name - The class name to remove from the node.\n *\n * #### Notes\n * If the class name is not yet added to the node, this is a no-op.\n *\n * The class name must not contain whitespace.\n */\n removeClass(name: string): void {\n this.node.classList.remove(name);\n }\n\n /**\n * Toggle a class name on the widget's DOM node.\n *\n * @param name - The class name to toggle on the node.\n *\n * @param force - Whether to force add the class (`true`) or force\n * remove the class (`false`). If not provided, the presence of\n * the class will be toggled from its current state.\n *\n * @returns `true` if the class is now present, `false` otherwise.\n *\n * #### Notes\n * The class name must not contain whitespace.\n */\n toggleClass(name: string, force?: boolean): boolean {\n if (force === true) {\n this.node.classList.add(name);\n return true;\n }\n if (force === false) {\n this.node.classList.remove(name);\n return false;\n }\n return this.node.classList.toggle(name);\n }\n\n /**\n * Post an `'update-request'` message to the widget.\n *\n * #### Notes\n * This is a simple convenience method for posting the message.\n */\n update(): void {\n MessageLoop.postMessage(this, Widget.Msg.UpdateRequest);\n }\n\n /**\n * Post a `'fit-request'` message to the widget.\n *\n * #### Notes\n * This is a simple convenience method for posting the message.\n */\n fit(): void {\n MessageLoop.postMessage(this, Widget.Msg.FitRequest);\n }\n\n /**\n * Post an `'activate-request'` message to the widget.\n *\n * #### Notes\n * This is a simple convenience method for posting the message.\n */\n activate(): void {\n MessageLoop.postMessage(this, Widget.Msg.ActivateRequest);\n }\n\n /**\n * Send a `'close-request'` message to the widget.\n *\n * #### Notes\n * This is a simple convenience method for sending the message.\n */\n close(): void {\n MessageLoop.sendMessage(this, Widget.Msg.CloseRequest);\n }\n\n /**\n * Show the widget and make it visible to its parent widget.\n *\n * #### Notes\n * This causes the {@link isHidden} property to be `false`.\n *\n * If the widget is not explicitly hidden, this is a no-op.\n */\n show(): void {\n if (!this.testFlag(Widget.Flag.IsHidden)) {\n return;\n }\n if (this.isAttached && (!this.parent || this.parent.isVisible)) {\n MessageLoop.sendMessage(this, Widget.Msg.BeforeShow);\n }\n this.clearFlag(Widget.Flag.IsHidden);\n this._toggleHidden(false);\n\n if (this.isAttached && (!this.parent || this.parent.isVisible)) {\n MessageLoop.sendMessage(this, Widget.Msg.AfterShow);\n }\n if (this.parent) {\n let msg = new Widget.ChildMessage('child-shown', this);\n MessageLoop.sendMessage(this.parent, msg);\n }\n }\n\n /**\n * Hide the widget and make it hidden to its parent widget.\n *\n * #### Notes\n * This causes the {@link isHidden} property to be `true`.\n *\n * If the widget is explicitly hidden, this is a no-op.\n */\n hide(): void {\n if (this.testFlag(Widget.Flag.IsHidden)) {\n return;\n }\n if (this.isAttached && (!this.parent || this.parent.isVisible)) {\n MessageLoop.sendMessage(this, Widget.Msg.BeforeHide);\n }\n this.setFlag(Widget.Flag.IsHidden);\n this._toggleHidden(true);\n\n if (this.isAttached && (!this.parent || this.parent.isVisible)) {\n MessageLoop.sendMessage(this, Widget.Msg.AfterHide);\n }\n if (this.parent) {\n let msg = new Widget.ChildMessage('child-hidden', this);\n MessageLoop.sendMessage(this.parent, msg);\n }\n }\n\n /**\n * Show or hide the widget according to a boolean value.\n *\n * @param hidden - `true` to hide the widget, or `false` to show it.\n *\n * #### Notes\n * This is a convenience method for `hide()` and `show()`.\n */\n setHidden(hidden: boolean): void {\n if (hidden) {\n this.hide();\n } else {\n this.show();\n }\n }\n\n /**\n * Test whether the given widget flag is set.\n *\n * #### Notes\n * This will not typically be called directly by user code.\n *\n * Since 2.7.0, {@link Widget.Flag.IsVisible} is deprecated.\n * It will be removed in a future version.\n */\n testFlag(flag: Widget.Flag): boolean {\n return (this._flags & flag) !== 0;\n }\n\n /**\n * Set the given widget flag.\n *\n * #### Notes\n * This will not typically be called directly by user code.\n *\n * Since 2.7.0, {@link Widget.Flag.IsVisible} is deprecated.\n * It will be removed in a future version.\n */\n setFlag(flag: Widget.Flag): void {\n this._flags |= flag;\n }\n\n /**\n * Clear the given widget flag.\n *\n * #### Notes\n * This will not typically be called directly by user code.\n *\n * Since 2.7.0, {@link Widget.Flag.IsVisible} is deprecated.\n * It will be removed in a future version.\n */\n clearFlag(flag: Widget.Flag): void {\n this._flags &= ~flag;\n }\n\n /**\n * Process a message sent to the widget.\n *\n * @param msg - The message sent to the widget.\n *\n * #### Notes\n * Subclasses may reimplement this method as needed.\n */\n processMessage(msg: Message): void {\n switch (msg.type) {\n case 'resize':\n this.notifyLayout(msg);\n this.onResize(msg as Widget.ResizeMessage);\n break;\n case 'update-request':\n this.notifyLayout(msg);\n this.onUpdateRequest(msg);\n break;\n case 'fit-request':\n this.notifyLayout(msg);\n this.onFitRequest(msg);\n break;\n case 'before-show':\n this.notifyLayout(msg);\n this.onBeforeShow(msg);\n break;\n case 'after-show':\n this.setFlag(Widget.Flag.IsVisible);\n this.notifyLayout(msg);\n this.onAfterShow(msg);\n break;\n case 'before-hide':\n this.notifyLayout(msg);\n this.onBeforeHide(msg);\n break;\n case 'after-hide':\n this.clearFlag(Widget.Flag.IsVisible);\n this.notifyLayout(msg);\n this.onAfterHide(msg);\n break;\n case 'before-attach':\n this.notifyLayout(msg);\n this.onBeforeAttach(msg);\n break;\n case 'after-attach':\n if (!this.isHidden && (!this.parent || this.parent.isVisible)) {\n this.setFlag(Widget.Flag.IsVisible);\n }\n this.setFlag(Widget.Flag.IsAttached);\n this.notifyLayout(msg);\n this.onAfterAttach(msg);\n break;\n case 'before-detach':\n this.notifyLayout(msg);\n this.onBeforeDetach(msg);\n break;\n case 'after-detach':\n this.clearFlag(Widget.Flag.IsVisible);\n this.clearFlag(Widget.Flag.IsAttached);\n this.notifyLayout(msg);\n this.onAfterDetach(msg);\n break;\n case 'activate-request':\n this.notifyLayout(msg);\n this.onActivateRequest(msg);\n break;\n case 'close-request':\n this.notifyLayout(msg);\n this.onCloseRequest(msg);\n break;\n case 'child-added':\n this.notifyLayout(msg);\n this.onChildAdded(msg as Widget.ChildMessage);\n break;\n case 'child-removed':\n this.notifyLayout(msg);\n this.onChildRemoved(msg as Widget.ChildMessage);\n break;\n default:\n this.notifyLayout(msg);\n break;\n }\n }\n\n /**\n * Invoke the message processing routine of the widget's layout.\n *\n * @param msg - The message to dispatch to the layout.\n *\n * #### Notes\n * This is a no-op if the widget does not have a layout.\n *\n * This will not typically be called directly by user code.\n */\n protected notifyLayout(msg: Message): void {\n if (this._layout) {\n this._layout.processParentMessage(msg);\n }\n }\n\n /**\n * A message handler invoked on a `'close-request'` message.\n *\n * #### Notes\n * The default implementation unparents or detaches the widget.\n */\n protected onCloseRequest(msg: Message): void {\n if (this.parent) {\n this.parent = null;\n } else if (this.isAttached) {\n Widget.detach(this);\n }\n }\n\n /**\n * A message handler invoked on a `'resize'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onResize(msg: Widget.ResizeMessage): void {}\n\n /**\n * A message handler invoked on an `'update-request'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onUpdateRequest(msg: Message): void {}\n\n /**\n * A message handler invoked on a `'fit-request'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onFitRequest(msg: Message): void {}\n\n /**\n * A message handler invoked on an `'activate-request'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onActivateRequest(msg: Message): void {}\n\n /**\n * A message handler invoked on a `'before-show'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onBeforeShow(msg: Message): void {}\n\n /**\n * A message handler invoked on an `'after-show'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onAfterShow(msg: Message): void {}\n\n /**\n * A message handler invoked on a `'before-hide'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onBeforeHide(msg: Message): void {}\n\n /**\n * A message handler invoked on an `'after-hide'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onAfterHide(msg: Message): void {}\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onBeforeAttach(msg: Message): void {}\n\n /**\n * A message handler invoked on an `'after-attach'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onAfterAttach(msg: Message): void {}\n\n /**\n * A message handler invoked on a `'before-detach'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onBeforeDetach(msg: Message): void {}\n\n /**\n * A message handler invoked on an `'after-detach'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onAfterDetach(msg: Message): void {}\n\n /**\n * A message handler invoked on a `'child-added'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onChildAdded(msg: Widget.ChildMessage): void {}\n\n /**\n * A message handler invoked on a `'child-removed'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onChildRemoved(msg: Widget.ChildMessage): void {}\n\n private _toggleHidden(hidden: boolean) {\n if (hidden) {\n switch (this._hiddenMode) {\n case Widget.HiddenMode.Display:\n this.addClass('lm-mod-hidden');\n break;\n case Widget.HiddenMode.Scale:\n this.node.style.transform = 'scale(0)';\n this.node.setAttribute('aria-hidden', 'true');\n break;\n case Widget.HiddenMode.ContentVisibility:\n // @ts-expect-error content-visibility unknown by DOM lib types\n this.node.style.contentVisibility = 'hidden';\n this.node.style.zIndex = '-1';\n break;\n }\n } else {\n switch (this._hiddenMode) {\n case Widget.HiddenMode.Display:\n this.removeClass('lm-mod-hidden');\n break;\n case Widget.HiddenMode.Scale:\n this.node.style.transform = '';\n this.node.removeAttribute('aria-hidden');\n break;\n case Widget.HiddenMode.ContentVisibility:\n // @ts-expect-error content-visibility unknown by DOM lib types\n this.node.style.contentVisibility = '';\n this.node.style.zIndex = '';\n break;\n }\n }\n }\n\n private _flags = 0;\n private _layout: Layout | null = null;\n private _parent: Widget | null = null;\n private _disposed = new Signal(this);\n private _hiddenMode: Widget.HiddenMode = Widget.HiddenMode.Display;\n}\n\n/**\n * The namespace for the `Widget` class statics.\n */\nexport namespace Widget {\n /**\n * An options object for initializing a widget.\n */\n export interface IOptions {\n /**\n * The optional node to use for the widget.\n *\n * If a node is provided, the widget will assume full ownership\n * and control of the node, as if it had created the node itself.\n *\n * The default is a new `
`.\n */\n node?: HTMLElement;\n\n /**\n * The optional element tag, used for constructing the widget's node.\n *\n * If a pre-constructed node is provided via the `node` arg, this\n * value is ignored.\n */\n tag?: keyof HTMLElementTagNameMap;\n }\n\n /**\n * The method for hiding the widget.\n *\n * The default is Display.\n *\n * Using `Scale` will often increase performance as most browsers will not\n * trigger style computation for the `transform` action. This should be used\n * sparingly and tested, since increasing the number of composition layers\n * may slow things down.\n *\n * To ensure the transformation does not trigger style recomputation, you\n * may need to set the widget CSS style `will-change: transform`. This\n * should be used only when needed as it may overwhelm the browser with a\n * high number of layers. See\n * https://developer.mozilla.org/en-US/docs/Web/CSS/will-change\n */\n export enum HiddenMode {\n /**\n * Set a `lm-mod-hidden` CSS class to hide the widget using `display:none`\n * CSS from the standard Lumino CSS.\n */\n Display = 0,\n\n /**\n * Hide the widget by setting the `transform` to `'scale(0)'`.\n */\n Scale,\n\n /**\n *Hide the widget by setting the `content-visibility` to `'hidden'`.\n */\n ContentVisibility\n }\n\n /**\n * An enum of widget bit flags.\n */\n export enum Flag {\n /**\n * The widget has been disposed.\n */\n IsDisposed = 0x1,\n\n /**\n * The widget is attached to the DOM.\n */\n IsAttached = 0x2,\n\n /**\n * The widget is hidden.\n */\n IsHidden = 0x4,\n\n /**\n * The widget is visible.\n *\n * @deprecated since 2.7.0, apply that flag consistently was not reliable\n * so it was dropped in favor of a recursive check of the visibility of all parents.\n */\n IsVisible = 0x8,\n\n /**\n * A layout cannot be set on the widget.\n */\n DisallowLayout = 0x10\n }\n\n /**\n * A collection of stateless messages related to widgets.\n */\n export namespace Msg {\n /**\n * A singleton `'before-show'` message.\n *\n * #### Notes\n * This message is sent to a widget before it becomes visible.\n *\n * This message is **not** sent when the widget is being attached.\n */\n export const BeforeShow = new Message('before-show');\n\n /**\n * A singleton `'after-show'` message.\n *\n * #### Notes\n * This message is sent to a widget after it becomes visible.\n *\n * This message is **not** sent when the widget is being attached.\n */\n export const AfterShow = new Message('after-show');\n\n /**\n * A singleton `'before-hide'` message.\n *\n * #### Notes\n * This message is sent to a widget before it becomes not-visible.\n *\n * This message is **not** sent when the widget is being detached.\n */\n export const BeforeHide = new Message('before-hide');\n\n /**\n * A singleton `'after-hide'` message.\n *\n * #### Notes\n * This message is sent to a widget after it becomes not-visible.\n *\n * This message is **not** sent when the widget is being detached.\n */\n export const AfterHide = new Message('after-hide');\n\n /**\n * A singleton `'before-attach'` message.\n *\n * #### Notes\n * This message is sent to a widget before it is attached.\n */\n export const BeforeAttach = new Message('before-attach');\n\n /**\n * A singleton `'after-attach'` message.\n *\n * #### Notes\n * This message is sent to a widget after it is attached.\n */\n export const AfterAttach = new Message('after-attach');\n\n /**\n * A singleton `'before-detach'` message.\n *\n * #### Notes\n * This message is sent to a widget before it is detached.\n */\n export const BeforeDetach = new Message('before-detach');\n\n /**\n * A singleton `'after-detach'` message.\n *\n * #### Notes\n * This message is sent to a widget after it is detached.\n */\n export const AfterDetach = new Message('after-detach');\n\n /**\n * A singleton `'parent-changed'` message.\n *\n * #### Notes\n * This message is sent to a widget when its parent has changed.\n */\n export const ParentChanged = new Message('parent-changed');\n\n /**\n * A singleton conflatable `'update-request'` message.\n *\n * #### Notes\n * This message can be dispatched to supporting widgets in order to\n * update their content based on the current widget state. Not all\n * widgets will respond to messages of this type.\n *\n * For widgets with a layout, this message will inform the layout to\n * update the position and size of its child widgets.\n */\n export const UpdateRequest = new ConflatableMessage('update-request');\n\n /**\n * A singleton conflatable `'fit-request'` message.\n *\n * #### Notes\n * For widgets with a layout, this message will inform the layout to\n * recalculate its size constraints to fit the space requirements of\n * its child widgets, and to update their position and size. Not all\n * layouts will respond to messages of this type.\n */\n export const FitRequest = new ConflatableMessage('fit-request');\n\n /**\n * A singleton conflatable `'activate-request'` message.\n *\n * #### Notes\n * This message should be dispatched to a widget when it should\n * perform the actions necessary to activate the widget, which\n * may include focusing its node or descendant node.\n */\n export const ActivateRequest = new ConflatableMessage('activate-request');\n\n /**\n * A singleton conflatable `'close-request'` message.\n *\n * #### Notes\n * This message should be dispatched to a widget when it should close\n * and remove itself from the widget hierarchy.\n */\n export const CloseRequest = new ConflatableMessage('close-request');\n }\n\n /**\n * A message class for child related messages.\n */\n export class ChildMessage extends Message {\n /**\n * Construct a new child message.\n *\n * @param type - The message type.\n *\n * @param child - The child widget for the message.\n */\n constructor(type: string, child: Widget) {\n super(type);\n this.child = child;\n }\n\n /**\n * The child widget for the message.\n */\n readonly child: Widget;\n }\n\n /**\n * A message class for `'resize'` messages.\n */\n export class ResizeMessage extends Message {\n /**\n * Construct a new resize message.\n *\n * @param width - The **offset width** of the widget, or `-1` if\n * the width is not known.\n *\n * @param height - The **offset height** of the widget, or `-1` if\n * the height is not known.\n */\n constructor(width: number, height: number) {\n super('resize');\n this.width = width;\n this.height = height;\n }\n\n /**\n * The offset width of the widget.\n *\n * #### Notes\n * This will be `-1` if the width is unknown.\n */\n readonly width: number;\n\n /**\n * The offset height of the widget.\n *\n * #### Notes\n * This will be `-1` if the height is unknown.\n */\n readonly height: number;\n }\n\n /**\n * The namespace for the `ResizeMessage` class statics.\n */\n export namespace ResizeMessage {\n /**\n * A singleton `'resize'` message with an unknown size.\n */\n export const UnknownSize = new ResizeMessage(-1, -1);\n }\n\n /**\n * Attach a widget to a host DOM node.\n *\n * @param widget - The widget of interest.\n *\n * @param host - The DOM node to use as the widget's host.\n *\n * @param ref - The child of `host` to use as the reference element.\n * If this is provided, the widget will be inserted before this\n * node in the host. The default is `null`, which will cause the\n * widget to be added as the last child of the host.\n *\n * #### Notes\n * This will throw an error if the widget is not a root widget, if\n * the widget is already attached, or if the host is not attached\n * to the DOM.\n */\n export function attach(\n widget: Widget,\n host: HTMLElement,\n ref: HTMLElement | null = null\n ): void {\n if (widget.parent) {\n throw new Error('Cannot attach a child widget.');\n }\n if (widget.isAttached || widget.node.isConnected) {\n throw new Error('Widget is already attached.');\n }\n if (!host.isConnected) {\n throw new Error('Host is not attached.');\n }\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n host.insertBefore(widget.node, ref);\n MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n\n /**\n * Detach the widget from its host DOM node.\n *\n * @param widget - The widget of interest.\n *\n * #### Notes\n * This will throw an error if the widget is not a root widget,\n * or if the widget is not attached to the DOM.\n */\n export function detach(widget: Widget): void {\n if (widget.parent) {\n throw new Error('Cannot detach a child widget.');\n }\n if (!widget.isAttached || !widget.node.isConnected) {\n throw new Error('Widget is not attached.');\n }\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n widget.node.parentNode!.removeChild(widget.node);\n MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * An attached property for the widget title object.\n */\n export const titleProperty = new AttachedProperty>({\n name: 'title',\n create: owner => new Title({ owner })\n });\n\n /**\n * Create a DOM node for the given widget options.\n */\n export function createNode(options: Widget.IOptions): HTMLElement {\n return options.node || document.createElement(options.tag || 'div');\n }\n}\n","/* eslint-disable @typescript-eslint/no-empty-function */\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { IDisposable } from '@lumino/disposable';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { AttachedProperty } from '@lumino/properties';\n\nimport { Signal } from '@lumino/signaling';\n\nimport { Widget } from './widget';\n\n/**\n * An abstract base class for creating lumino layouts.\n *\n * #### Notes\n * A layout is used to add widgets to a parent and to arrange those\n * widgets within the parent's DOM node.\n *\n * This class implements the base functionality which is required of\n * nearly all layouts. It must be subclassed in order to be useful.\n *\n * Notably, this class does not define a uniform interface for adding\n * widgets to the layout. A subclass should define that API in a way\n * which is meaningful for its intended use.\n */\nexport abstract class Layout implements Iterable, IDisposable {\n /**\n * Construct a new layout.\n *\n * @param options - The options for initializing the layout.\n */\n constructor(options: Layout.IOptions = {}) {\n this._fitPolicy = options.fitPolicy || 'set-min-size';\n }\n\n /**\n * Dispose of the resources held by the layout.\n *\n * #### Notes\n * This should be reimplemented to clear and dispose of the widgets.\n *\n * All reimplementations should call the superclass method.\n *\n * This method is called automatically when the parent is disposed.\n */\n dispose(): void {\n this._parent = null;\n this._disposed = true;\n Signal.clearData(this);\n AttachedProperty.clearData(this);\n }\n\n /**\n * Test whether the layout is disposed.\n */\n get isDisposed(): boolean {\n return this._disposed;\n }\n\n /**\n * Get the parent widget of the layout.\n */\n get parent(): Widget | null {\n return this._parent;\n }\n\n /**\n * Set the parent widget of the layout.\n *\n * #### Notes\n * This is set automatically when installing the layout on the parent\n * widget. The parent widget should not be set directly by user code.\n */\n set parent(value: Widget | null) {\n if (this._parent === value) {\n return;\n }\n if (this._parent) {\n throw new Error('Cannot change parent widget.');\n }\n if (value!.layout !== this) {\n throw new Error('Invalid parent widget.');\n }\n this._parent = value;\n this.init();\n }\n\n /**\n * Get the fit policy for the layout.\n *\n * #### Notes\n * The fit policy controls the computed size constraints which are\n * applied to the parent widget by the layout.\n *\n * Some layout implementations may ignore the fit policy.\n */\n get fitPolicy(): Layout.FitPolicy {\n return this._fitPolicy;\n }\n\n /**\n * Set the fit policy for the layout.\n *\n * #### Notes\n * The fit policy controls the computed size constraints which are\n * applied to the parent widget by the layout.\n *\n * Some layout implementations may ignore the fit policy.\n *\n * Changing the fit policy will clear the current size constraint\n * for the parent widget and then re-fit the parent.\n */\n set fitPolicy(value: Layout.FitPolicy) {\n // Bail if the policy does not change\n if (this._fitPolicy === value) {\n return;\n }\n\n // Update the internal policy.\n this._fitPolicy = value;\n\n // Clear the size constraints and schedule a fit of the parent.\n if (this._parent) {\n let style = this._parent.node.style;\n style.minWidth = '';\n style.minHeight = '';\n style.maxWidth = '';\n style.maxHeight = '';\n this._parent.fit();\n }\n }\n\n /**\n * Create an iterator over the widgets in the layout.\n *\n * @returns A new iterator over the widgets in the layout.\n *\n * #### Notes\n * This abstract method must be implemented by a subclass.\n */\n abstract [Symbol.iterator](): IterableIterator;\n\n /**\n * Remove a widget from the layout.\n *\n * @param widget - The widget to remove from the layout.\n *\n * #### Notes\n * A widget is automatically removed from the layout when its `parent`\n * is set to `null`. This method should only be invoked directly when\n * removing a widget from a layout which has yet to be installed on a\n * parent widget.\n *\n * This method should *not* modify the widget's `parent`.\n */\n abstract removeWidget(widget: Widget): void;\n\n /**\n * Process a message sent to the parent widget.\n *\n * @param msg - The message sent to the parent widget.\n *\n * #### Notes\n * This method is called by the parent widget to process a message.\n *\n * Subclasses may reimplement this method as needed.\n */\n processParentMessage(msg: Message): void {\n switch (msg.type) {\n case 'resize':\n this.onResize(msg as Widget.ResizeMessage);\n break;\n case 'update-request':\n this.onUpdateRequest(msg);\n break;\n case 'fit-request':\n this.onFitRequest(msg);\n break;\n case 'before-show':\n this.onBeforeShow(msg);\n break;\n case 'after-show':\n this.onAfterShow(msg);\n break;\n case 'before-hide':\n this.onBeforeHide(msg);\n break;\n case 'after-hide':\n this.onAfterHide(msg);\n break;\n case 'before-attach':\n this.onBeforeAttach(msg);\n break;\n case 'after-attach':\n this.onAfterAttach(msg);\n break;\n case 'before-detach':\n this.onBeforeDetach(msg);\n break;\n case 'after-detach':\n this.onAfterDetach(msg);\n break;\n case 'child-removed':\n this.onChildRemoved(msg as Widget.ChildMessage);\n break;\n case 'child-shown':\n this.onChildShown(msg as Widget.ChildMessage);\n break;\n case 'child-hidden':\n this.onChildHidden(msg as Widget.ChildMessage);\n break;\n }\n }\n\n /**\n * Perform layout initialization which requires the parent widget.\n *\n * #### Notes\n * This method is invoked immediately after the layout is installed\n * on the parent widget.\n *\n * The default implementation reparents all of the widgets to the\n * layout parent widget.\n *\n * Subclasses should reimplement this method and attach the child\n * widget nodes to the parent widget's node.\n */\n protected init(): void {\n for (const widget of this) {\n widget.parent = this.parent;\n }\n }\n\n /**\n * A message handler invoked on a `'resize'` message.\n *\n * #### Notes\n * The layout should ensure that its widgets are resized according\n * to the specified layout space, and that they are sent a `'resize'`\n * message if appropriate.\n *\n * The default implementation of this method sends an `UnknownSize`\n * resize message to all widgets.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onResize(msg: Widget.ResizeMessage): void {\n for (const widget of this) {\n MessageLoop.sendMessage(widget, Widget.ResizeMessage.UnknownSize);\n }\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n *\n * #### Notes\n * The layout should ensure that its widgets are resized according\n * to the available layout space, and that they are sent a `'resize'`\n * message if appropriate.\n *\n * The default implementation of this method sends an `UnknownSize`\n * resize message to all widgets.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onUpdateRequest(msg: Message): void {\n for (const widget of this) {\n MessageLoop.sendMessage(widget, Widget.ResizeMessage.UnknownSize);\n }\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n *\n * #### Notes\n * The default implementation of this method forwards the message\n * to all widgets. It assumes all widget nodes are attached to the\n * parent widget node.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onBeforeAttach(msg: Message): void {\n for (const widget of this) {\n MessageLoop.sendMessage(widget, msg);\n }\n }\n\n /**\n * A message handler invoked on an `'after-attach'` message.\n *\n * #### Notes\n * The default implementation of this method forwards the message\n * to all widgets. It assumes all widget nodes are attached to the\n * parent widget node.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onAfterAttach(msg: Message): void {\n for (const widget of this) {\n MessageLoop.sendMessage(widget, msg);\n }\n }\n\n /**\n * A message handler invoked on a `'before-detach'` message.\n *\n * #### Notes\n * The default implementation of this method forwards the message\n * to all widgets. It assumes all widget nodes are attached to the\n * parent widget node.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onBeforeDetach(msg: Message): void {\n for (const widget of this) {\n MessageLoop.sendMessage(widget, msg);\n }\n }\n\n /**\n * A message handler invoked on an `'after-detach'` message.\n *\n * #### Notes\n * The default implementation of this method forwards the message\n * to all widgets. It assumes all widget nodes are attached to the\n * parent widget node.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onAfterDetach(msg: Message): void {\n for (const widget of this) {\n MessageLoop.sendMessage(widget, msg);\n }\n }\n\n /**\n * A message handler invoked on a `'before-show'` message.\n *\n * #### Notes\n * The default implementation of this method forwards the message to\n * all non-hidden widgets. It assumes all widget nodes are attached\n * to the parent widget node.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onBeforeShow(msg: Message): void {\n for (const widget of this) {\n if (!widget.isHidden) {\n MessageLoop.sendMessage(widget, msg);\n }\n }\n }\n\n /**\n * A message handler invoked on an `'after-show'` message.\n *\n * #### Notes\n * The default implementation of this method forwards the message to\n * all non-hidden widgets. It assumes all widget nodes are attached\n * to the parent widget node.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onAfterShow(msg: Message): void {\n for (const widget of this) {\n if (!widget.isHidden) {\n MessageLoop.sendMessage(widget, msg);\n }\n }\n }\n\n /**\n * A message handler invoked on a `'before-hide'` message.\n *\n * #### Notes\n * The default implementation of this method forwards the message to\n * all non-hidden widgets. It assumes all widget nodes are attached\n * to the parent widget node.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onBeforeHide(msg: Message): void {\n for (const widget of this) {\n if (!widget.isHidden) {\n MessageLoop.sendMessage(widget, msg);\n }\n }\n }\n\n /**\n * A message handler invoked on an `'after-hide'` message.\n *\n * #### Notes\n * The default implementation of this method forwards the message to\n * all non-hidden widgets. It assumes all widget nodes are attached\n * to the parent widget node.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onAfterHide(msg: Message): void {\n for (const widget of this) {\n if (!widget.isHidden) {\n MessageLoop.sendMessage(widget, msg);\n }\n }\n }\n\n /**\n * A message handler invoked on a `'child-removed'` message.\n *\n * #### Notes\n * This will remove the child widget from the layout.\n *\n * Subclasses should **not** typically reimplement this method.\n */\n protected onChildRemoved(msg: Widget.ChildMessage): void {\n this.removeWidget(msg.child);\n }\n\n /**\n * A message handler invoked on a `'fit-request'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onFitRequest(msg: Message): void {}\n\n /**\n * A message handler invoked on a `'child-shown'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onChildShown(msg: Widget.ChildMessage): void {}\n\n /**\n * A message handler invoked on a `'child-hidden'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onChildHidden(msg: Widget.ChildMessage): void {}\n\n private _disposed = false;\n private _fitPolicy: Layout.FitPolicy;\n private _parent: Widget | null = null;\n}\n\n/**\n * The namespace for the `Layout` class statics.\n */\nexport namespace Layout {\n /**\n * A type alias for the layout fit policy.\n *\n * #### Notes\n * The fit policy controls the computed size constraints which are\n * applied to the parent widget by the layout.\n *\n * Some layout implementations may ignore the fit policy.\n */\n export type FitPolicy =\n | /**\n * No size constraint will be applied to the parent widget.\n */\n 'set-no-constraint'\n\n /**\n * The computed min size will be applied to the parent widget.\n */\n | 'set-min-size';\n\n /**\n * An options object for initializing a layout.\n */\n export interface IOptions {\n /**\n * The fit policy for the layout.\n *\n * The default is `'set-min-size'`.\n */\n fitPolicy?: FitPolicy;\n }\n\n /**\n * A type alias for the horizontal alignment of a widget.\n */\n export type HorizontalAlignment = 'left' | 'center' | 'right';\n\n /**\n * A type alias for the vertical alignment of a widget.\n */\n export type VerticalAlignment = 'top' | 'center' | 'bottom';\n\n /**\n * Get the horizontal alignment for a widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The horizontal alignment for the widget.\n *\n * #### Notes\n * If the layout width allocated to a widget is larger than its max\n * width, the horizontal alignment controls how the widget is placed\n * within the extra horizontal space.\n *\n * If the allocated width is less than the widget's max width, the\n * horizontal alignment has no effect.\n *\n * Some layout implementations may ignore horizontal alignment.\n */\n export function getHorizontalAlignment(widget: Widget): HorizontalAlignment {\n return Private.horizontalAlignmentProperty.get(widget);\n }\n\n /**\n * Set the horizontal alignment for a widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the horizontal alignment.\n *\n * #### Notes\n * If the layout width allocated to a widget is larger than its max\n * width, the horizontal alignment controls how the widget is placed\n * within the extra horizontal space.\n *\n * If the allocated width is less than the widget's max width, the\n * horizontal alignment has no effect.\n *\n * Some layout implementations may ignore horizontal alignment.\n *\n * Changing the horizontal alignment will post an `update-request`\n * message to widget's parent, provided the parent has a layout\n * installed.\n */\n export function setHorizontalAlignment(\n widget: Widget,\n value: HorizontalAlignment\n ): void {\n Private.horizontalAlignmentProperty.set(widget, value);\n }\n\n /**\n * Get the vertical alignment for a widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The vertical alignment for the widget.\n *\n * #### Notes\n * If the layout height allocated to a widget is larger than its max\n * height, the vertical alignment controls how the widget is placed\n * within the extra vertical space.\n *\n * If the allocated height is less than the widget's max height, the\n * vertical alignment has no effect.\n *\n * Some layout implementations may ignore vertical alignment.\n */\n export function getVerticalAlignment(widget: Widget): VerticalAlignment {\n return Private.verticalAlignmentProperty.get(widget);\n }\n\n /**\n * Set the vertical alignment for a widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the vertical alignment.\n *\n * #### Notes\n * If the layout height allocated to a widget is larger than its max\n * height, the vertical alignment controls how the widget is placed\n * within the extra vertical space.\n *\n * If the allocated height is less than the widget's max height, the\n * vertical alignment has no effect.\n *\n * Some layout implementations may ignore vertical alignment.\n *\n * Changing the horizontal alignment will post an `update-request`\n * message to widget's parent, provided the parent has a layout\n * installed.\n */\n export function setVerticalAlignment(\n widget: Widget,\n value: VerticalAlignment\n ): void {\n Private.verticalAlignmentProperty.set(widget, value);\n }\n}\n\n/**\n * An object which assists in the absolute layout of widgets.\n *\n * #### Notes\n * This class is useful when implementing a layout which arranges its\n * widgets using absolute positioning.\n *\n * This class is used by nearly all of the built-in lumino layouts.\n */\nexport class LayoutItem implements IDisposable {\n /**\n * Construct a new layout item.\n *\n * @param widget - The widget to be managed by the item.\n *\n * #### Notes\n * The widget will be set to absolute positioning.\n * The widget will use strict CSS containment.\n */\n constructor(widget: Widget) {\n this.widget = widget;\n this.widget.node.style.position = 'absolute';\n this.widget.node.style.contain = 'strict';\n }\n\n /**\n * Dispose of the the layout item.\n *\n * #### Notes\n * This will reset the positioning of the widget.\n */\n dispose(): void {\n // Do nothing if the item is already disposed.\n if (this._disposed) {\n return;\n }\n\n // Mark the item as disposed.\n this._disposed = true;\n\n // Reset the widget style.\n let style = this.widget.node.style;\n style.position = '';\n style.top = '';\n style.left = '';\n style.width = '';\n style.height = '';\n style.contain = '';\n }\n\n /**\n * The widget managed by the layout item.\n */\n readonly widget: Widget;\n\n /**\n * The computed minimum width of the widget.\n *\n * #### Notes\n * This value can be updated by calling the `fit` method.\n */\n get minWidth(): number {\n return this._minWidth;\n }\n\n /**\n * The computed minimum height of the widget.\n *\n * #### Notes\n * This value can be updated by calling the `fit` method.\n */\n get minHeight(): number {\n return this._minHeight;\n }\n\n /**\n * The computed maximum width of the widget.\n *\n * #### Notes\n * This value can be updated by calling the `fit` method.\n */\n get maxWidth(): number {\n return this._maxWidth;\n }\n\n /**\n * The computed maximum height of the widget.\n *\n * #### Notes\n * This value can be updated by calling the `fit` method.\n */\n get maxHeight(): number {\n return this._maxHeight;\n }\n\n /**\n * Whether the layout item is disposed.\n */\n get isDisposed(): boolean {\n return this._disposed;\n }\n\n /**\n * Whether the managed widget is hidden.\n */\n get isHidden(): boolean {\n return this.widget.isHidden;\n }\n\n /**\n * Whether the managed widget is visible.\n */\n get isVisible(): boolean {\n return this.widget.isVisible;\n }\n\n /**\n * Whether the managed widget is attached.\n */\n get isAttached(): boolean {\n return this.widget.isAttached;\n }\n\n /**\n * Update the computed size limits of the managed widget.\n */\n fit(): void {\n let limits = ElementExt.sizeLimits(this.widget.node);\n this._minWidth = limits.minWidth;\n this._minHeight = limits.minHeight;\n this._maxWidth = limits.maxWidth;\n this._maxHeight = limits.maxHeight;\n }\n\n /**\n * Update the position and size of the managed widget.\n *\n * @param left - The left edge position of the layout box.\n *\n * @param top - The top edge position of the layout box.\n *\n * @param width - The width of the layout box.\n *\n * @param height - The height of the layout box.\n */\n update(left: number, top: number, width: number, height: number): void {\n // Clamp the size to the computed size limits.\n let clampW = Math.max(this._minWidth, Math.min(width, this._maxWidth));\n let clampH = Math.max(this._minHeight, Math.min(height, this._maxHeight));\n\n // Adjust the left edge for the horizontal alignment, if needed.\n if (clampW < width) {\n switch (Layout.getHorizontalAlignment(this.widget)) {\n case 'left':\n break;\n case 'center':\n left += (width - clampW) / 2;\n break;\n case 'right':\n left += width - clampW;\n break;\n default:\n throw 'unreachable';\n }\n }\n\n // Adjust the top edge for the vertical alignment, if needed.\n if (clampH < height) {\n switch (Layout.getVerticalAlignment(this.widget)) {\n case 'top':\n break;\n case 'center':\n top += (height - clampH) / 2;\n break;\n case 'bottom':\n top += height - clampH;\n break;\n default:\n throw 'unreachable';\n }\n }\n\n // Set up the resize variables.\n let resized = false;\n let style = this.widget.node.style;\n\n // Update the top edge of the widget if needed.\n if (this._top !== top) {\n this._top = top;\n style.top = `${top}px`;\n }\n\n // Update the left edge of the widget if needed.\n if (this._left !== left) {\n this._left = left;\n style.left = `${left}px`;\n }\n\n // Update the width of the widget if needed.\n if (this._width !== clampW) {\n resized = true;\n this._width = clampW;\n style.width = `${clampW}px`;\n }\n\n // Update the height of the widget if needed.\n if (this._height !== clampH) {\n resized = true;\n this._height = clampH;\n style.height = `${clampH}px`;\n }\n\n // Send a resize message to the widget if needed.\n if (resized) {\n let msg = new Widget.ResizeMessage(clampW, clampH);\n MessageLoop.sendMessage(this.widget, msg);\n }\n }\n\n private _top = NaN;\n private _left = NaN;\n private _width = NaN;\n private _height = NaN;\n private _minWidth = 0;\n private _minHeight = 0;\n private _maxWidth = Infinity;\n private _maxHeight = Infinity;\n private _disposed = false;\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * The attached property for a widget horizontal alignment.\n */\n export const horizontalAlignmentProperty = new AttachedProperty<\n Widget,\n Layout.HorizontalAlignment\n >({\n name: 'horizontalAlignment',\n create: () => 'center',\n changed: onAlignmentChanged\n });\n\n /**\n * The attached property for a widget vertical alignment.\n */\n export const verticalAlignmentProperty = new AttachedProperty<\n Widget,\n Layout.VerticalAlignment\n >({\n name: 'verticalAlignment',\n create: () => 'top',\n changed: onAlignmentChanged\n });\n\n /**\n * The change handler for the attached alignment properties.\n */\n function onAlignmentChanged(child: Widget): void {\n if (child.parent && child.parent.layout) {\n child.parent.update();\n }\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { MessageLoop } from '@lumino/messaging';\n\nimport { Layout } from './layout';\n\nimport { Widget } from './widget';\n\n/**\n * A concrete layout implementation suitable for many use cases.\n *\n * #### Notes\n * This class is suitable as a base class for implementing a variety of\n * layouts, but can also be used directly with standard CSS to layout a\n * collection of widgets.\n */\nexport class PanelLayout extends Layout {\n /**\n * Dispose of the resources held by the layout.\n *\n * #### Notes\n * This will clear and dispose all widgets in the layout.\n *\n * All reimplementations should call the superclass method.\n *\n * This method is called automatically when the parent is disposed.\n */\n dispose(): void {\n while (this._widgets.length > 0) {\n this._widgets.pop()!.dispose();\n }\n super.dispose();\n }\n\n /**\n * A read-only array of the widgets in the layout.\n */\n get widgets(): ReadonlyArray {\n return this._widgets;\n }\n\n /**\n * Create an iterator over the widgets in the layout.\n *\n * @returns A new iterator over the widgets in the layout.\n */\n *[Symbol.iterator](): IterableIterator {\n yield* this._widgets;\n }\n\n /**\n * Add a widget to the end of the layout.\n *\n * @param widget - The widget to add to the layout.\n *\n * #### Notes\n * If the widget is already contained in the layout, it will be moved.\n */\n addWidget(widget: Widget): void {\n this.insertWidget(this._widgets.length, widget);\n }\n\n /**\n * Insert a widget into the layout at the specified index.\n *\n * @param index - The index at which to insert the widget.\n *\n * @param widget - The widget to insert into the layout.\n *\n * #### Notes\n * The index will be clamped to the bounds of the widgets.\n *\n * If the widget is already added to the layout, it will be moved.\n *\n * #### Undefined Behavior\n * An `index` which is non-integral.\n */\n insertWidget(index: number, widget: Widget): void {\n // Remove the widget from its current parent. This is a no-op\n // if the widget's parent is already the layout parent widget.\n widget.parent = this.parent;\n\n // Look up the current index of the widget.\n let i = this._widgets.indexOf(widget);\n\n // Clamp the insert index to the array bounds.\n let j = Math.max(0, Math.min(index, this._widgets.length));\n\n // If the widget is not in the array, insert it.\n if (i === -1) {\n // Insert the widget into the array.\n ArrayExt.insert(this._widgets, j, widget);\n\n // If the layout is parented, attach the widget to the DOM.\n if (this.parent) {\n this.attachWidget(j, widget);\n }\n\n // There is nothing more to do.\n return;\n }\n\n // Otherwise, the widget exists in the array and should be moved.\n\n // Adjust the index if the location is at the end of the array.\n if (j === this._widgets.length) {\n j--;\n }\n\n // Bail if there is no effective move.\n if (i === j) {\n return;\n }\n\n // Move the widget to the new location.\n ArrayExt.move(this._widgets, i, j);\n\n // If the layout is parented, move the widget in the DOM.\n if (this.parent) {\n this.moveWidget(i, j, widget);\n }\n }\n\n /**\n * Remove a widget from the layout.\n *\n * @param widget - The widget to remove from the layout.\n *\n * #### Notes\n * A widget is automatically removed from the layout when its `parent`\n * is set to `null`. This method should only be invoked directly when\n * removing a widget from a layout which has yet to be installed on a\n * parent widget.\n *\n * This method does *not* modify the widget's `parent`.\n */\n removeWidget(widget: Widget): void {\n this.removeWidgetAt(this._widgets.indexOf(widget));\n }\n\n /**\n * Remove the widget at a given index from the layout.\n *\n * @param index - The index of the widget to remove.\n *\n * #### Notes\n * A widget is automatically removed from the layout when its `parent`\n * is set to `null`. This method should only be invoked directly when\n * removing a widget from a layout which has yet to be installed on a\n * parent widget.\n *\n * This method does *not* modify the widget's `parent`.\n *\n * #### Undefined Behavior\n * An `index` which is non-integral.\n */\n removeWidgetAt(index: number): void {\n // Remove the widget from the array.\n let widget = ArrayExt.removeAt(this._widgets, index);\n\n // If the layout is parented, detach the widget from the DOM.\n if (widget && this.parent) {\n this.detachWidget(index, widget);\n }\n }\n\n /**\n * Perform layout initialization which requires the parent widget.\n */\n protected init(): void {\n super.init();\n let index = 0;\n for (const widget of this) {\n this.attachWidget(index++, widget);\n }\n }\n\n /**\n * Attach a widget to the parent's DOM node.\n *\n * @param index - The current index of the widget in the layout.\n *\n * @param widget - The widget to attach to the parent.\n *\n * #### Notes\n * This method is called automatically by the panel layout at the\n * appropriate time. It should not be called directly by user code.\n *\n * The default implementation adds the widgets's node to the parent's\n * node at the proper location, and sends the appropriate attach\n * messages to the widget if the parent is attached to the DOM.\n *\n * Subclasses may reimplement this method to control how the widget's\n * node is added to the parent's node.\n */\n protected attachWidget(index: number, widget: Widget): void {\n // Look up the next sibling reference node.\n let ref = this.parent!.node.children[index];\n\n // Send a `'before-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n }\n\n // Insert the widget's node before the sibling.\n this.parent!.node.insertBefore(widget.node, ref);\n\n // Send an `'after-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n }\n\n /**\n * Move a widget in the parent's DOM node.\n *\n * @param fromIndex - The previous index of the widget in the layout.\n *\n * @param toIndex - The current index of the widget in the layout.\n *\n * @param widget - The widget to move in the parent.\n *\n * #### Notes\n * This method is called automatically by the panel layout at the\n * appropriate time. It should not be called directly by user code.\n *\n * The default implementation moves the widget's node to the proper\n * location in the parent's node and sends the appropriate attach and\n * detach messages to the widget if the parent is attached to the DOM.\n *\n * Subclasses may reimplement this method to control how the widget's\n * node is moved in the parent's node.\n */\n protected moveWidget(\n fromIndex: number,\n toIndex: number,\n widget: Widget\n ): void {\n // Send a `'before-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n }\n\n // Remove the widget's node from the parent.\n this.parent!.node.removeChild(widget.node);\n\n // Send an `'after-detach'` and message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n\n // Look up the next sibling reference node.\n let ref = this.parent!.node.children[toIndex];\n\n // Send a `'before-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n }\n\n // Insert the widget's node before the sibling.\n this.parent!.node.insertBefore(widget.node, ref);\n\n // Send an `'after-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n }\n\n /**\n * Detach a widget from the parent's DOM node.\n *\n * @param index - The previous index of the widget in the layout.\n *\n * @param widget - The widget to detach from the parent.\n *\n * #### Notes\n * This method is called automatically by the panel layout at the\n * appropriate time. It should not be called directly by user code.\n *\n * The default implementation removes the widget's node from the\n * parent's node, and sends the appropriate detach messages to the\n * widget if the parent is attached to the DOM.\n *\n * Subclasses may reimplement this method to control how the widget's\n * node is removed from the parent's node.\n */\n protected detachWidget(index: number, widget: Widget): void {\n // Send a `'before-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n }\n\n // Remove the widget's node from the parent.\n this.parent!.node.removeChild(widget.node);\n\n // Send an `'after-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n }\n\n private _widgets: Widget[] = [];\n}\n","/*\n * Copyright (c) Jupyter Development Team.\n * Distributed under the terms of the Modified BSD License.\n */\n\nexport namespace Utils {\n /**\n * Clamp a dimension value to an integer >= 0.\n */\n export function clampDimension(value: number): number {\n return Math.max(0, Math.floor(value));\n }\n}\n\nexport default Utils;\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { AttachedProperty } from '@lumino/properties';\n\nimport { BoxEngine, BoxSizer } from './boxengine';\n\nimport { LayoutItem } from './layout';\n\nimport { PanelLayout } from './panellayout';\n\nimport { Utils } from './utils';\n\nimport { Widget } from './widget';\n\n/**\n * A layout which arranges its widgets into resizable sections.\n */\nexport class SplitLayout extends PanelLayout {\n /**\n * Construct a new split layout.\n *\n * @param options - The options for initializing the layout.\n */\n constructor(options: SplitLayout.IOptions) {\n super();\n this.renderer = options.renderer;\n if (options.orientation !== undefined) {\n this._orientation = options.orientation;\n }\n if (options.alignment !== undefined) {\n this._alignment = options.alignment;\n }\n if (options.spacing !== undefined) {\n this._spacing = Utils.clampDimension(options.spacing);\n }\n }\n\n /**\n * Dispose of the resources held by the layout.\n */\n dispose(): void {\n // Dispose of the layout items.\n for (const item of this._items) {\n item.dispose();\n }\n\n // Clear the layout state.\n this._box = null;\n this._items.length = 0;\n this._sizers.length = 0;\n this._handles.length = 0;\n\n // Dispose of the rest of the layout.\n super.dispose();\n }\n\n /**\n * The renderer used by the split layout.\n */\n readonly renderer: SplitLayout.IRenderer;\n\n /**\n * Get the layout orientation for the split layout.\n */\n get orientation(): SplitLayout.Orientation {\n return this._orientation;\n }\n\n /**\n * Set the layout orientation for the split layout.\n */\n set orientation(value: SplitLayout.Orientation) {\n if (this._orientation === value) {\n return;\n }\n this._orientation = value;\n if (!this.parent) {\n return;\n }\n this.parent.dataset['orientation'] = value;\n this.parent.fit();\n }\n\n /**\n * Get the content alignment for the split layout.\n *\n * #### Notes\n * This is the alignment of the widgets in the layout direction.\n *\n * The alignment has no effect if the widgets can expand to fill the\n * entire split layout.\n */\n get alignment(): SplitLayout.Alignment {\n return this._alignment;\n }\n\n /**\n * Set the content alignment for the split layout.\n *\n * #### Notes\n * This is the alignment of the widgets in the layout direction.\n *\n * The alignment has no effect if the widgets can expand to fill the\n * entire split layout.\n */\n set alignment(value: SplitLayout.Alignment) {\n if (this._alignment === value) {\n return;\n }\n this._alignment = value;\n if (!this.parent) {\n return;\n }\n this.parent.dataset['alignment'] = value;\n this.parent.update();\n }\n\n /**\n * Get the inter-element spacing for the split layout.\n */\n get spacing(): number {\n return this._spacing;\n }\n\n /**\n * Set the inter-element spacing for the split layout.\n */\n set spacing(value: number) {\n value = Utils.clampDimension(value);\n if (this._spacing === value) {\n return;\n }\n this._spacing = value;\n if (!this.parent) {\n return;\n }\n this.parent.fit();\n }\n\n /**\n * A read-only array of the split handles in the layout.\n */\n get handles(): ReadonlyArray {\n return this._handles;\n }\n\n /**\n * Get the absolute sizes of the widgets in the layout.\n *\n * @returns A new array of the absolute sizes of the widgets.\n *\n * This method **does not** measure the DOM nodes.\n */\n absoluteSizes(): number[] {\n return this._sizers.map(sizer => sizer.size);\n }\n\n /**\n * Get the relative sizes of the widgets in the layout.\n *\n * @returns A new array of the relative sizes of the widgets.\n *\n * #### Notes\n * The returned sizes reflect the sizes of the widgets normalized\n * relative to their siblings.\n *\n * This method **does not** measure the DOM nodes.\n */\n relativeSizes(): number[] {\n return Private.normalize(this._sizers.map(sizer => sizer.size));\n }\n\n /**\n * Set the relative sizes for the widgets in the layout.\n *\n * @param sizes - The relative sizes for the widgets in the panel.\n * @param update - Update the layout after setting relative sizes.\n * Default is True.\n *\n * #### Notes\n * Extra values are ignored, too few will yield an undefined layout.\n *\n * The actual geometry of the DOM nodes is updated asynchronously.\n */\n setRelativeSizes(sizes: number[], update = true): void {\n // Copy the sizes and pad with zeros as needed.\n let n = this._sizers.length;\n let temp = sizes.slice(0, n);\n while (temp.length < n) {\n temp.push(0);\n }\n\n // Normalize the padded sizes.\n let normed = Private.normalize(temp);\n\n // Apply the normalized sizes to the sizers.\n for (let i = 0; i < n; ++i) {\n let sizer = this._sizers[i];\n sizer.sizeHint = normed[i];\n sizer.size = normed[i];\n }\n\n // Set the flag indicating the sizes are normalized.\n this._hasNormedSizes = true;\n\n // Trigger an update of the parent widget.\n if (update && this.parent) {\n this.parent.update();\n }\n }\n\n /**\n * Move the offset position of a split handle.\n *\n * @param index - The index of the handle of the interest.\n *\n * @param position - The desired offset position of the handle.\n *\n * #### Notes\n * The position is relative to the offset parent.\n *\n * This will move the handle as close as possible to the desired\n * position. The sibling widgets will be adjusted as necessary.\n */\n moveHandle(index: number, position: number): void {\n // Bail if the index is invalid or the handle is hidden.\n let handle = this._handles[index];\n if (!handle || handle.classList.contains('lm-mod-hidden')) {\n return;\n }\n\n // Compute the desired delta movement for the handle.\n let delta: number;\n if (this._orientation === 'horizontal') {\n delta = position - handle.offsetLeft;\n } else {\n delta = position - handle.offsetTop;\n }\n\n // Bail if there is no handle movement.\n if (delta === 0) {\n return;\n }\n\n // Prevent widget resizing unless needed.\n for (let sizer of this._sizers) {\n if (sizer.size > 0) {\n sizer.sizeHint = sizer.size;\n }\n }\n\n // Adjust the sizers to reflect the handle movement.\n BoxEngine.adjust(this._sizers, index, delta);\n\n // Update the layout of the widgets.\n if (this.parent) {\n this.parent.update();\n }\n }\n\n /**\n * Perform layout initialization which requires the parent widget.\n */\n protected init(): void {\n this.parent!.dataset['orientation'] = this.orientation;\n this.parent!.dataset['alignment'] = this.alignment;\n super.init();\n }\n\n /**\n * Attach a widget to the parent's DOM node.\n *\n * @param index - The current index of the widget in the layout.\n *\n * @param widget - The widget to attach to the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected attachWidget(index: number, widget: Widget): void {\n // Create the item, handle, and sizer for the new widget.\n let item = new LayoutItem(widget);\n let handle = Private.createHandle(this.renderer);\n let average = Private.averageSize(this._sizers);\n let sizer = Private.createSizer(average);\n\n // Insert the item, handle, and sizer into the internal arrays.\n ArrayExt.insert(this._items, index, item);\n ArrayExt.insert(this._sizers, index, sizer);\n ArrayExt.insert(this._handles, index, handle);\n\n // Send a `'before-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n }\n\n // Add the widget and handle nodes to the parent.\n this.parent!.node.appendChild(widget.node);\n this.parent!.node.appendChild(handle);\n\n // Send an `'after-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n\n // Post a fit request for the parent widget.\n this.parent!.fit();\n }\n\n /**\n * Move a widget in the parent's DOM node.\n *\n * @param fromIndex - The previous index of the widget in the layout.\n *\n * @param toIndex - The current index of the widget in the layout.\n *\n * @param widget - The widget to move in the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected moveWidget(\n fromIndex: number,\n toIndex: number,\n widget: Widget\n ): void {\n // Move the item, sizer, and handle for the widget.\n ArrayExt.move(this._items, fromIndex, toIndex);\n ArrayExt.move(this._sizers, fromIndex, toIndex);\n ArrayExt.move(this._handles, fromIndex, toIndex);\n\n // Post a fit request to the parent to show/hide last handle.\n this.parent!.fit();\n }\n\n /**\n * Detach a widget from the parent's DOM node.\n *\n * @param index - The previous index of the widget in the layout.\n *\n * @param widget - The widget to detach from the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected detachWidget(index: number, widget: Widget): void {\n // Remove the item, handle, and sizer for the widget.\n let item = ArrayExt.removeAt(this._items, index);\n let handle = ArrayExt.removeAt(this._handles, index);\n ArrayExt.removeAt(this._sizers, index);\n\n // Send a `'before-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n }\n\n // Remove the widget and handle nodes from the parent.\n this.parent!.node.removeChild(widget.node);\n this.parent!.node.removeChild(handle!);\n\n // Send an `'after-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n\n // Dispose of the layout item.\n item!.dispose();\n\n // Post a fit request for the parent widget.\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'before-show'` message.\n */\n protected onBeforeShow(msg: Message): void {\n super.onBeforeShow(msg);\n this.parent!.update();\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n super.onBeforeAttach(msg);\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-shown'` message.\n */\n protected onChildShown(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-hidden'` message.\n */\n protected onChildHidden(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'resize'` message.\n */\n protected onResize(msg: Widget.ResizeMessage): void {\n if (this.parent!.isVisible) {\n this._update(msg.width, msg.height);\n }\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n protected onUpdateRequest(msg: Message): void {\n if (this.parent!.isVisible) {\n this._update(-1, -1);\n }\n }\n\n /**\n * A message handler invoked on a `'fit-request'` message.\n */\n protected onFitRequest(msg: Message): void {\n if (this.parent!.isAttached) {\n this._fit();\n }\n }\n\n /**\n * Update the item position.\n *\n * @param i Item index\n * @param isHorizontal Whether the layout is horizontal or not\n * @param left Left position in pixels\n * @param top Top position in pixels\n * @param height Item height\n * @param width Item width\n * @param size Item size\n */\n protected updateItemPosition(\n i: number,\n isHorizontal: boolean,\n left: number,\n top: number,\n height: number,\n width: number,\n size: number\n ): void {\n const item = this._items[i];\n if (item.isHidden) {\n return;\n }\n\n // Fetch the style for the handle.\n let handleStyle = this._handles[i].style;\n\n // Update the widget and handle, and advance the relevant edge.\n if (isHorizontal) {\n left += this.widgetOffset;\n item.update(left, top, size, height);\n left += size;\n handleStyle.top = `${top}px`;\n handleStyle.left = `${left}px`;\n handleStyle.width = `${this._spacing}px`;\n handleStyle.height = `${height}px`;\n } else {\n top += this.widgetOffset;\n item.update(left, top, width, size);\n top += size;\n handleStyle.top = `${top}px`;\n handleStyle.left = `${left}px`;\n handleStyle.width = `${width}px`;\n handleStyle.height = `${this._spacing}px`;\n }\n }\n\n /**\n * Fit the layout to the total size required by the widgets.\n */\n private _fit(): void {\n // Update the handles and track the visible widget count.\n let nVisible = 0;\n let lastHandleIndex = -1;\n for (let i = 0, n = this._items.length; i < n; ++i) {\n if (this._items[i].isHidden) {\n this._handles[i].classList.add('lm-mod-hidden');\n } else {\n this._handles[i].classList.remove('lm-mod-hidden');\n lastHandleIndex = i;\n nVisible++;\n }\n }\n\n // Hide the handle for the last visible widget.\n if (lastHandleIndex !== -1) {\n this._handles[lastHandleIndex].classList.add('lm-mod-hidden');\n }\n\n // Update the fixed space for the visible items.\n this._fixed =\n this._spacing * Math.max(0, nVisible - 1) +\n this.widgetOffset * this._items.length;\n\n // Setup the computed minimum size.\n let horz = this._orientation === 'horizontal';\n let minW = horz ? this._fixed : 0;\n let minH = horz ? 0 : this._fixed;\n\n // Update the sizers and computed size limits.\n for (let i = 0, n = this._items.length; i < n; ++i) {\n // Fetch the item and corresponding box sizer.\n let item = this._items[i];\n let sizer = this._sizers[i];\n\n // Prevent resizing unless necessary.\n if (sizer.size > 0) {\n sizer.sizeHint = sizer.size;\n }\n\n // If the item is hidden, it should consume zero size.\n if (item.isHidden) {\n sizer.minSize = 0;\n sizer.maxSize = 0;\n continue;\n }\n\n // Update the size limits for the item.\n item.fit();\n\n // Update the stretch factor.\n sizer.stretch = SplitLayout.getStretch(item.widget);\n\n // Update the sizer limits and computed min size.\n if (horz) {\n sizer.minSize = item.minWidth;\n sizer.maxSize = item.maxWidth;\n minW += item.minWidth;\n minH = Math.max(minH, item.minHeight);\n } else {\n sizer.minSize = item.minHeight;\n sizer.maxSize = item.maxHeight;\n minH += item.minHeight;\n minW = Math.max(minW, item.minWidth);\n }\n }\n\n // Update the box sizing and add it to the computed min size.\n let box = (this._box = ElementExt.boxSizing(this.parent!.node));\n minW += box.horizontalSum;\n minH += box.verticalSum;\n\n // Update the parent's min size constraints.\n let style = this.parent!.node.style;\n style.minWidth = `${minW}px`;\n style.minHeight = `${minH}px`;\n\n // Set the dirty flag to ensure only a single update occurs.\n this._dirty = true;\n\n // Notify the ancestor that it should fit immediately. This may\n // cause a resize of the parent, fulfilling the required update.\n if (this.parent!.parent) {\n MessageLoop.sendMessage(this.parent!.parent!, Widget.Msg.FitRequest);\n }\n\n // If the dirty flag is still set, the parent was not resized.\n // Trigger the required update on the parent widget immediately.\n if (this._dirty) {\n MessageLoop.sendMessage(this.parent!, Widget.Msg.UpdateRequest);\n }\n }\n\n /**\n * Update the layout position and size of the widgets.\n *\n * The parent offset dimensions should be `-1` if unknown.\n */\n private _update(offsetWidth: number, offsetHeight: number): void {\n // Clear the dirty flag to indicate the update occurred.\n this._dirty = false;\n\n // Compute the visible item count.\n let nVisible = 0;\n for (let i = 0, n = this._items.length; i < n; ++i) {\n nVisible += +!this._items[i].isHidden;\n }\n\n // Bail early if there are no visible items to layout.\n if (nVisible === 0 && this.widgetOffset === 0) {\n return;\n }\n\n // Measure the parent if the offset dimensions are unknown.\n if (offsetWidth < 0) {\n offsetWidth = this.parent!.node.offsetWidth;\n }\n if (offsetHeight < 0) {\n offsetHeight = this.parent!.node.offsetHeight;\n }\n\n // Ensure the parent box sizing data is computed.\n if (!this._box) {\n this._box = ElementExt.boxSizing(this.parent!.node);\n }\n\n // Compute the actual layout bounds adjusted for border and padding.\n let top = this._box.paddingTop;\n let left = this._box.paddingLeft;\n let width = offsetWidth - this._box.horizontalSum;\n let height = offsetHeight - this._box.verticalSum;\n\n // Set up the variables for justification and alignment offset.\n let extra = 0;\n let offset = 0;\n let horz = this._orientation === 'horizontal';\n\n if (nVisible > 0) {\n // Compute the adjusted layout space.\n let space: number;\n if (horz) {\n // left += this.widgetOffset;\n space = Math.max(0, width - this._fixed);\n } else {\n // top += this.widgetOffset;\n space = Math.max(0, height - this._fixed);\n }\n\n // Scale the size hints if they are normalized.\n if (this._hasNormedSizes) {\n for (let sizer of this._sizers) {\n sizer.sizeHint *= space;\n }\n this._hasNormedSizes = false;\n }\n\n // Distribute the layout space to the box sizers.\n let delta = BoxEngine.calc(this._sizers, space);\n\n // Account for alignment if there is extra layout space.\n if (delta > 0) {\n switch (this._alignment) {\n case 'start':\n break;\n case 'center':\n extra = 0;\n offset = delta / 2;\n break;\n case 'end':\n extra = 0;\n offset = delta;\n break;\n case 'justify':\n extra = delta / nVisible;\n offset = 0;\n break;\n default:\n throw 'unreachable';\n }\n }\n }\n\n // Layout the items using the computed box sizes.\n for (let i = 0, n = this._items.length; i < n; ++i) {\n // Fetch the item.\n const item = this._items[i];\n\n // Fetch the computed size for the widget.\n const size = item.isHidden ? 0 : this._sizers[i].size + extra;\n\n this.updateItemPosition(\n i,\n horz,\n horz ? left + offset : left,\n horz ? top : top + offset,\n height,\n width,\n size\n );\n\n const fullOffset =\n this.widgetOffset +\n (this._handles[i].classList.contains('lm-mod-hidden')\n ? 0\n : this._spacing);\n\n if (horz) {\n left += size + fullOffset;\n } else {\n top += size + fullOffset;\n }\n }\n }\n\n protected widgetOffset = 0;\n private _fixed = 0;\n private _spacing = 4;\n private _dirty = false;\n private _hasNormedSizes = false;\n private _sizers: BoxSizer[] = [];\n private _items: LayoutItem[] = [];\n private _handles: HTMLDivElement[] = [];\n private _box: ElementExt.IBoxSizing | null = null;\n private _alignment: SplitLayout.Alignment = 'start';\n private _orientation: SplitLayout.Orientation = 'horizontal';\n}\n\n/**\n * The namespace for the `SplitLayout` class statics.\n */\nexport namespace SplitLayout {\n /**\n * A type alias for a split layout orientation.\n */\n export type Orientation = 'horizontal' | 'vertical';\n\n /**\n * A type alias for a split layout alignment.\n */\n export type Alignment = 'start' | 'center' | 'end' | 'justify';\n\n /**\n * An options object for initializing a split layout.\n */\n export interface IOptions {\n /**\n * The renderer to use for the split layout.\n */\n renderer: IRenderer;\n\n /**\n * The orientation of the layout.\n *\n * Possible values are documented in {@link SplitLayout.Orientation}.\n *\n * The default is `'horizontal'`.\n */\n orientation?: Orientation;\n\n /**\n * The content alignment of the layout.\n *\n * Possible values are documented in {@link SplitLayout.Alignment}.\n *\n * The default is `'start'`.\n */\n alignment?: Alignment;\n\n /**\n * The spacing between items in the layout.\n *\n * The default is `4`.\n */\n spacing?: number;\n }\n\n /**\n * A renderer for use with a split layout.\n */\n export interface IRenderer {\n /**\n * Create a new handle for use with a split layout.\n *\n * @returns A new handle element.\n */\n createHandle(): HTMLDivElement;\n }\n\n /**\n * Get the split layout stretch factor for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The split layout stretch factor for the widget.\n */\n export function getStretch(widget: Widget): number {\n return Private.stretchProperty.get(widget);\n }\n\n /**\n * Set the split layout stretch factor for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the stretch factor.\n */\n export function setStretch(widget: Widget, value: number): void {\n Private.stretchProperty.set(widget, value);\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * The property descriptor for a widget stretch factor.\n */\n export const stretchProperty = new AttachedProperty({\n name: 'stretch',\n create: () => 0,\n coerce: (owner, value) => Math.max(0, Math.floor(value)),\n changed: onChildSizingChanged\n });\n\n /**\n * Create a new box sizer with the given size hint.\n */\n export function createSizer(size: number): BoxSizer {\n let sizer = new BoxSizer();\n sizer.sizeHint = Math.floor(size);\n return sizer;\n }\n\n /**\n * Create a new split handle node using the given renderer.\n */\n export function createHandle(\n renderer: SplitLayout.IRenderer\n ): HTMLDivElement {\n let handle = renderer.createHandle();\n handle.style.position = 'absolute';\n // Do not use size containment to allow the handle to fill the available space\n handle.style.contain = 'style';\n return handle;\n }\n\n /**\n * Compute the average size of an array of box sizers.\n */\n export function averageSize(sizers: BoxSizer[]): number {\n return sizers.reduce((v, s) => v + s.size, 0) / sizers.length || 0;\n }\n\n /**\n * Normalize an array of values.\n */\n export function normalize(values: number[]): number[] {\n let n = values.length;\n if (n === 0) {\n return [];\n }\n let sum = values.reduce((a, b) => a + Math.abs(b), 0);\n return sum === 0 ? values.map(v => 1 / n) : values.map(v => v / sum);\n }\n\n /**\n * The change handler for the attached sizing properties.\n */\n function onChildSizingChanged(child: Widget): void {\n if (child.parent && child.parent.layout instanceof SplitLayout) {\n child.parent.fit();\n }\n }\n}\n","/*\n * Copyright (c) Jupyter Development Team.\n * Distributed under the terms of the Modified BSD License.\n */\n\nimport { ArrayExt } from '@lumino/algorithm';\nimport { UUID } from '@lumino/coreutils';\nimport { SplitLayout } from './splitlayout';\nimport { Title } from './title';\nimport Utils from './utils';\nimport { Widget } from './widget';\n\n/**\n * A layout which arranges its widgets into collapsible resizable sections.\n */\nexport class AccordionLayout extends SplitLayout {\n /**\n * Construct a new accordion layout.\n *\n * @param options - The options for initializing the layout.\n *\n * #### Notes\n * The default orientation will be vertical.\n *\n * Titles must be rotated for horizontal accordion panel using CSS: see accordionpanel.css\n */\n constructor(options: AccordionLayout.IOptions) {\n super({ ...options, orientation: options.orientation || 'vertical' });\n this.titleSpace = options.titleSpace || 22;\n }\n\n /**\n * The section title height or width depending on the orientation.\n */\n get titleSpace(): number {\n return this.widgetOffset;\n }\n set titleSpace(value: number) {\n value = Utils.clampDimension(value);\n if (this.widgetOffset === value) {\n return;\n }\n this.widgetOffset = value;\n if (!this.parent) {\n return;\n }\n this.parent.fit();\n }\n\n /**\n * A read-only array of the section titles in the panel.\n */\n get titles(): ReadonlyArray {\n return this._titles;\n }\n\n /**\n * Dispose of the resources held by the layout.\n */\n dispose(): void {\n if (this.isDisposed) {\n return;\n }\n\n // Clear the layout state.\n this._titles.length = 0;\n\n // Dispose of the rest of the layout.\n super.dispose();\n }\n\n /**\n * The renderer used by the accordion layout.\n */\n readonly renderer: AccordionLayout.IRenderer;\n\n public updateTitle(index: number, widget: Widget): void {\n const oldTitle = this._titles[index];\n const expanded = oldTitle.classList.contains('lm-mod-expanded');\n const newTitle = Private.createTitle(this.renderer, widget.title, expanded);\n this._titles[index] = newTitle;\n\n // Add the title node to the parent before the widget.\n this.parent!.node.replaceChild(newTitle, oldTitle);\n }\n\n /**\n * Insert a widget into the layout at the specified index.\n *\n * @param index - The index at which to insert the widget.\n *\n * @param widget - The widget to insert into the layout.\n *\n * #### Notes\n * The index will be clamped to the bounds of the widgets.\n *\n * If the widget is already added to the layout, it will be moved.\n *\n * #### Undefined Behavior\n * An `index` which is non-integral.\n */\n insertWidget(index: number, widget: Widget): void {\n if (!widget.id) {\n widget.id = `id-${UUID.uuid4()}`;\n }\n super.insertWidget(index, widget);\n }\n\n /**\n * Attach a widget to the parent's DOM node.\n *\n * @param index - The current index of the widget in the layout.\n *\n * @param widget - The widget to attach to the parent.\n */\n protected attachWidget(index: number, widget: Widget): void {\n const title = Private.createTitle(this.renderer, widget.title);\n\n ArrayExt.insert(this._titles, index, title);\n\n // Add the title node to the parent before the widget.\n this.parent!.node.appendChild(title);\n\n widget.node.setAttribute('role', 'region');\n widget.node.setAttribute('aria-labelledby', title.id);\n\n super.attachWidget(index, widget);\n }\n\n /**\n * Move a widget in the parent's DOM node.\n *\n * @param fromIndex - The previous index of the widget in the layout.\n *\n * @param toIndex - The current index of the widget in the layout.\n *\n * @param widget - The widget to move in the parent.\n */\n protected moveWidget(\n fromIndex: number,\n toIndex: number,\n widget: Widget\n ): void {\n ArrayExt.move(this._titles, fromIndex, toIndex);\n super.moveWidget(fromIndex, toIndex, widget);\n }\n\n /**\n * Detach a widget from the parent's DOM node.\n *\n * @param index - The previous index of the widget in the layout.\n *\n * @param widget - The widget to detach from the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected detachWidget(index: number, widget: Widget): void {\n const title = ArrayExt.removeAt(this._titles, index);\n\n this.parent!.node.removeChild(title!);\n\n super.detachWidget(index, widget);\n }\n\n /**\n * Update the item position.\n *\n * @param i Item index\n * @param isHorizontal Whether the layout is horizontal or not\n * @param left Left position in pixels\n * @param top Top position in pixels\n * @param height Item height\n * @param width Item width\n * @param size Item size\n */\n protected updateItemPosition(\n i: number,\n isHorizontal: boolean,\n left: number,\n top: number,\n height: number,\n width: number,\n size: number\n ): void {\n const titleStyle = this._titles[i].style;\n\n // Titles must be rotated for horizontal accordion panel using CSS: see accordionpanel.css\n titleStyle.top = `${top}px`;\n titleStyle.left = `${left}px`;\n titleStyle.height = `${this.widgetOffset}px`;\n if (isHorizontal) {\n titleStyle.width = `${height}px`;\n } else {\n titleStyle.width = `${width}px`;\n }\n\n super.updateItemPosition(i, isHorizontal, left, top, height, width, size);\n }\n\n private _titles: HTMLElement[] = [];\n}\n\nexport namespace AccordionLayout {\n /**\n * A type alias for a accordion layout orientation.\n */\n export type Orientation = SplitLayout.Orientation;\n\n /**\n * A type alias for a accordion layout alignment.\n */\n export type Alignment = SplitLayout.Alignment;\n\n /**\n * An options object for initializing a accordion layout.\n */\n export interface IOptions extends SplitLayout.IOptions {\n /**\n * The renderer to use for the accordion layout.\n */\n renderer: IRenderer;\n\n /**\n * The section title height or width depending on the orientation.\n *\n * The default is `22`.\n */\n titleSpace?: number;\n }\n\n /**\n * A renderer for use with an accordion layout.\n */\n export interface IRenderer extends SplitLayout.IRenderer {\n /**\n * Common class name for all accordion titles.\n */\n readonly titleClassName: string;\n\n /**\n * Render the element for a section title.\n *\n * @param title - The data to use for rendering the section title.\n *\n * @returns A element representing the section title.\n */\n createSectionTitle(title: Title): HTMLElement;\n }\n}\n\nnamespace Private {\n /**\n * Create the title HTML element.\n *\n * @param renderer Accordion renderer\n * @param data Widget title\n * @returns Title HTML element\n */\n export function createTitle(\n renderer: AccordionLayout.IRenderer,\n data: Title,\n expanded: boolean = true\n ): HTMLElement {\n const title = renderer.createSectionTitle(data);\n title.style.position = 'absolute';\n title.style.contain = 'strict';\n title.setAttribute('aria-label', `${data.label} Section`);\n title.setAttribute('aria-expanded', expanded ? 'true' : 'false');\n title.setAttribute('aria-controls', data.owner.id);\n if (expanded) {\n title.classList.add('lm-mod-expanded');\n }\n return title;\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { PanelLayout } from './panellayout';\n\nimport { Widget } from './widget';\n\n/**\n * A simple and convenient panel widget class.\n *\n * #### Notes\n * This class is suitable as a base class for implementing a variety of\n * convenience panel widgets, but can also be used directly with CSS to\n * arrange a collection of widgets.\n *\n * This class provides a convenience wrapper around a {@link PanelLayout}.\n */\nexport class Panel extends Widget {\n /**\n * Construct a new panel.\n *\n * @param options - The options for initializing the panel.\n */\n constructor(options: Panel.IOptions = {}) {\n super();\n this.addClass('lm-Panel');\n this.layout = Private.createLayout(options);\n }\n\n /**\n * A read-only array of the widgets in the panel.\n */\n get widgets(): ReadonlyArray {\n return (this.layout as PanelLayout).widgets;\n }\n\n /**\n * Add a widget to the end of the panel.\n *\n * @param widget - The widget to add to the panel.\n *\n * #### Notes\n * If the widget is already contained in the panel, it will be moved.\n */\n addWidget(widget: Widget): void {\n (this.layout as PanelLayout).addWidget(widget);\n }\n\n /**\n * Insert a widget at the specified index.\n *\n * @param index - The index at which to insert the widget.\n *\n * @param widget - The widget to insert into to the panel.\n *\n * #### Notes\n * If the widget is already contained in the panel, it will be moved.\n */\n insertWidget(index: number, widget: Widget): void {\n (this.layout as PanelLayout).insertWidget(index, widget);\n }\n}\n\n/**\n * The namespace for the `Panel` class statics.\n */\nexport namespace Panel {\n /**\n * An options object for creating a panel.\n */\n export interface IOptions {\n /**\n * The panel layout to use for the panel.\n *\n * The default is a new `PanelLayout`.\n */\n layout?: PanelLayout;\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * Create a panel layout for the given panel options.\n */\n export function createLayout(options: Panel.IOptions): PanelLayout {\n return options.layout || new PanelLayout();\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { IDisposable } from '@lumino/disposable';\n\nimport { Drag } from '@lumino/dragdrop';\n\nimport { Message } from '@lumino/messaging';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { Panel } from './panel';\n\nimport { SplitLayout } from './splitlayout';\n\nimport { Widget } from './widget';\n\n/**\n * A panel which arranges its widgets into resizable sections.\n *\n * #### Notes\n * This class provides a convenience wrapper around a {@link SplitLayout}.\n */\nexport class SplitPanel extends Panel {\n /**\n * Construct a new split panel.\n *\n * @param options - The options for initializing the split panel.\n */\n constructor(options: SplitPanel.IOptions = {}) {\n super({ layout: Private.createLayout(options) });\n this.addClass('lm-SplitPanel');\n }\n\n /**\n * Dispose of the resources held by the panel.\n */\n dispose(): void {\n this._releaseMouse();\n super.dispose();\n }\n\n /**\n * Get the layout orientation for the split panel.\n */\n get orientation(): SplitPanel.Orientation {\n return (this.layout as SplitLayout).orientation;\n }\n\n /**\n * Set the layout orientation for the split panel.\n */\n set orientation(value: SplitPanel.Orientation) {\n (this.layout as SplitLayout).orientation = value;\n }\n\n /**\n * Get the content alignment for the split panel.\n *\n * #### Notes\n * This is the alignment of the widgets in the layout direction.\n *\n * The alignment has no effect if the widgets can expand to fill the\n * entire split panel.\n */\n get alignment(): SplitPanel.Alignment {\n return (this.layout as SplitLayout).alignment;\n }\n\n /**\n * Set the content alignment for the split panel.\n *\n * #### Notes\n * This is the alignment of the widgets in the layout direction.\n *\n * The alignment has no effect if the widgets can expand to fill the\n * entire split panel.\n */\n set alignment(value: SplitPanel.Alignment) {\n (this.layout as SplitLayout).alignment = value;\n }\n\n /**\n * Get the inter-element spacing for the split panel.\n */\n get spacing(): number {\n return (this.layout as SplitLayout).spacing;\n }\n\n /**\n * Set the inter-element spacing for the split panel.\n */\n set spacing(value: number) {\n (this.layout as SplitLayout).spacing = value;\n }\n\n /**\n * The renderer used by the split panel.\n */\n get renderer(): SplitPanel.IRenderer {\n return (this.layout as SplitLayout).renderer;\n }\n\n /**\n * A signal emitted when a split handle has moved.\n */\n get handleMoved(): ISignal {\n return this._handleMoved;\n }\n\n /**\n * A read-only array of the split handles in the panel.\n */\n get handles(): ReadonlyArray {\n return (this.layout as SplitLayout).handles;\n }\n\n /**\n * Get the relative sizes of the widgets in the panel.\n *\n * @returns A new array of the relative sizes of the widgets.\n *\n * #### Notes\n * The returned sizes reflect the sizes of the widgets normalized\n * relative to their siblings.\n *\n * This method **does not** measure the DOM nodes.\n */\n relativeSizes(): number[] {\n return (this.layout as SplitLayout).relativeSizes();\n }\n\n /**\n * Set the relative sizes for the widgets in the panel.\n *\n * @param sizes - The relative sizes for the widgets in the panel.\n * @param update - Update the layout after setting relative sizes.\n * Default is True.\n *\n * #### Notes\n * Extra values are ignored, too few will yield an undefined layout.\n *\n * The actual geometry of the DOM nodes is updated asynchronously.\n */\n setRelativeSizes(sizes: number[], update = true): void {\n (this.layout as SplitLayout).setRelativeSizes(sizes, update);\n }\n\n /**\n * Handle the DOM events for the split panel.\n *\n * @param event - The DOM event sent to the panel.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the panel's DOM node. It should\n * not be called directly by user code.\n */\n handleEvent(event: Event): void {\n switch (event.type) {\n case 'pointerdown':\n this._evtPointerDown(event as PointerEvent);\n break;\n case 'pointermove':\n this._evtPointerMove(event as PointerEvent);\n break;\n case 'pointerup':\n this._evtPointerUp(event as PointerEvent);\n break;\n case 'keydown':\n this._evtKeyDown(event as KeyboardEvent);\n break;\n case 'contextmenu':\n event.preventDefault();\n event.stopPropagation();\n break;\n }\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n this.node.addEventListener('pointerdown', this);\n }\n\n /**\n * A message handler invoked on an `'after-detach'` message.\n */\n protected onAfterDetach(msg: Message): void {\n this.node.removeEventListener('pointerdown', this);\n this._releaseMouse();\n }\n\n /**\n * A message handler invoked on a `'child-added'` message.\n */\n protected onChildAdded(msg: Widget.ChildMessage): void {\n msg.child.addClass('lm-SplitPanel-child');\n this._releaseMouse();\n }\n\n /**\n * A message handler invoked on a `'child-removed'` message.\n */\n protected onChildRemoved(msg: Widget.ChildMessage): void {\n msg.child.removeClass('lm-SplitPanel-child');\n this._releaseMouse();\n }\n\n /**\n * Handle the `'keydown'` event for the split panel.\n */\n private _evtKeyDown(event: KeyboardEvent): void {\n // Stop input events during drag.\n if (this._pressData) {\n event.preventDefault();\n event.stopPropagation();\n }\n\n // Release the mouse if `Escape` is pressed.\n if (event.keyCode === 27) {\n this._releaseMouse();\n }\n }\n\n /**\n * Handle the `'pointerdown'` event for the split panel.\n */\n private _evtPointerDown(event: PointerEvent): void {\n // Do nothing if the primary button is not pressed.\n if (event.button !== 0) {\n return;\n }\n\n // Find the handle which contains the target, if any.\n let layout = this.layout as SplitLayout;\n let index = ArrayExt.findFirstIndex(layout.handles, handle => {\n return handle.contains(event.target as HTMLElement);\n });\n\n // Bail early if the mouse press was not on a handle.\n if (index === -1) {\n return;\n }\n\n // Stop the event when a split handle is pressed.\n event.preventDefault();\n event.stopPropagation();\n\n // Add the extra document listeners.\n document.addEventListener('pointerup', this, true);\n document.addEventListener('pointermove', this, true);\n document.addEventListener('keydown', this, true);\n document.addEventListener('contextmenu', this, true);\n\n // Compute the offset delta for the handle press.\n let delta: number;\n let handle = layout.handles[index];\n let rect = handle.getBoundingClientRect();\n if (layout.orientation === 'horizontal') {\n delta = event.clientX - rect.left;\n } else {\n delta = event.clientY - rect.top;\n }\n\n // Override the cursor and store the press data.\n let style = window.getComputedStyle(handle);\n let override = Drag.overrideCursor(style.cursor!);\n this._pressData = { index, delta, override };\n }\n\n /**\n * Handle the `'pointermove'` event for the split panel.\n */\n private _evtPointerMove(event: PointerEvent): void {\n // Stop the event when dragging a split handle.\n event.preventDefault();\n event.stopPropagation();\n\n // Compute the desired offset position for the handle.\n let pos: number;\n let layout = this.layout as SplitLayout;\n let rect = this.node.getBoundingClientRect();\n if (layout.orientation === 'horizontal') {\n pos = event.clientX - rect.left - this._pressData!.delta;\n } else {\n pos = event.clientY - rect.top - this._pressData!.delta;\n }\n\n // Move the handle as close to the desired position as possible.\n layout.moveHandle(this._pressData!.index, pos);\n }\n\n /**\n * Handle the `'pointerup'` event for the split panel.\n */\n private _evtPointerUp(event: PointerEvent): void {\n // Do nothing if the primary button is not released.\n if (event.button !== 0) {\n return;\n }\n\n // Stop the event when releasing a handle.\n event.preventDefault();\n event.stopPropagation();\n\n // Finalize the mouse release.\n this._releaseMouse();\n }\n\n /**\n * Release the mouse grab for the split panel.\n */\n private _releaseMouse(): void {\n // Bail early if no drag is in progress.\n if (!this._pressData) {\n return;\n }\n\n // Clear the override cursor.\n this._pressData.override.dispose();\n this._pressData = null;\n\n // Emit the handle moved signal.\n this._handleMoved.emit();\n\n // Remove the extra document listeners.\n document.removeEventListener('keydown', this, true);\n document.removeEventListener('pointerup', this, true);\n document.removeEventListener('pointermove', this, true);\n document.removeEventListener('contextmenu', this, true);\n }\n\n private _handleMoved = new Signal(this);\n private _pressData: Private.IPressData | null = null;\n}\n\n/**\n * The namespace for the `SplitPanel` class statics.\n */\nexport namespace SplitPanel {\n /**\n * A type alias for a split panel orientation.\n */\n export type Orientation = SplitLayout.Orientation;\n\n /**\n * A type alias for a split panel alignment.\n */\n export type Alignment = SplitLayout.Alignment;\n\n /**\n * A type alias for a split panel renderer.\n */\n export type IRenderer = SplitLayout.IRenderer;\n\n /**\n * An options object for initializing a split panel.\n */\n export interface IOptions {\n /**\n * The renderer to use for the split panel.\n *\n * The default is a shared renderer instance.\n */\n renderer?: IRenderer;\n\n /**\n * The layout orientation of the panel.\n *\n * The default is `'horizontal'`.\n */\n orientation?: Orientation;\n\n /**\n * The content alignment of the panel.\n *\n * The default is `'start'`.\n */\n alignment?: Alignment;\n\n /**\n * The spacing between items in the panel.\n *\n * The default is `4`.\n */\n spacing?: number;\n\n /**\n * The split layout to use for the split panel.\n *\n * If this is provided, the other options are ignored.\n *\n * The default is a new `SplitLayout`.\n */\n layout?: SplitLayout;\n }\n\n /**\n * The default implementation of `IRenderer`.\n */\n export class Renderer implements IRenderer {\n /**\n * Create a new handle for use with a split panel.\n *\n * @returns A new handle element for a split panel.\n */\n createHandle(): HTMLDivElement {\n let handle = document.createElement('div');\n handle.className = 'lm-SplitPanel-handle';\n return handle;\n }\n }\n\n /**\n * The default `Renderer` instance.\n */\n export const defaultRenderer = new Renderer();\n\n /**\n * Get the split panel stretch factor for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The split panel stretch factor for the widget.\n */\n export function getStretch(widget: Widget): number {\n return SplitLayout.getStretch(widget);\n }\n\n /**\n * Set the split panel stretch factor for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the stretch factor.\n */\n export function setStretch(widget: Widget, value: number): void {\n SplitLayout.setStretch(widget, value);\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * An object which holds mouse press data.\n */\n export interface IPressData {\n /**\n * The index of the pressed handle.\n */\n index: number;\n\n /**\n * The offset of the press in handle coordinates.\n */\n delta: number;\n\n /**\n * The disposable which will clear the override cursor.\n */\n override: IDisposable;\n }\n\n /**\n * Create a split layout for the given panel options.\n */\n export function createLayout(options: SplitPanel.IOptions): SplitLayout {\n return (\n options.layout ||\n new SplitLayout({\n renderer: options.renderer || SplitPanel.defaultRenderer,\n orientation: options.orientation,\n alignment: options.alignment,\n spacing: options.spacing\n })\n );\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n\nimport { ArrayExt } from '@lumino/algorithm';\nimport { Message } from '@lumino/messaging';\nimport { ISignal, Signal } from '@lumino/signaling';\nimport { AccordionLayout } from './accordionlayout';\nimport { SplitLayout } from './splitlayout';\nimport { SplitPanel } from './splitpanel';\nimport { Title } from './title';\nimport { Widget } from './widget';\n\n/**\n * A panel which arranges its widgets into resizable sections separated by a title widget.\n *\n * #### Notes\n * This class provides a convenience wrapper around {@link AccordionLayout}.\n *\n * See also the related [example](../../examples/accordionpanel/index.html) and\n * its [source](https://github.com/jupyterlab/lumino/tree/main/examples/example-accordionpanel).\n */\nexport class AccordionPanel extends SplitPanel {\n /**\n * Construct a new accordion panel.\n *\n * @param options - The options for initializing the accordion panel.\n *\n */\n constructor(options: AccordionPanel.IOptions = {}) {\n super({ ...options, layout: Private.createLayout(options) });\n this.addClass('lm-AccordionPanel');\n }\n\n /**\n * The renderer used by the accordion panel.\n */\n get renderer(): AccordionPanel.IRenderer {\n return (this.layout as AccordionLayout).renderer;\n }\n\n /**\n * The section title space.\n *\n * This is the height if the panel is vertical and the width if it is\n * horizontal.\n */\n get titleSpace(): number {\n return (this.layout as AccordionLayout).titleSpace;\n }\n set titleSpace(value: number) {\n (this.layout as AccordionLayout).titleSpace = value;\n }\n\n /**\n * A read-only array of the section titles in the panel.\n */\n get titles(): ReadonlyArray {\n return (this.layout as AccordionLayout).titles;\n }\n\n /**\n * A signal emitted when a widget of the AccordionPanel is collapsed or expanded.\n */\n get expansionToggled(): ISignal {\n return this._expansionToggled;\n }\n\n /**\n * Add a widget to the end of the panel.\n *\n * @param widget - The widget to add to the panel.\n *\n * #### Notes\n * If the widget is already contained in the panel, it will be moved.\n */\n addWidget(widget: Widget): void {\n super.addWidget(widget);\n widget.title.changed.connect(this._onTitleChanged, this);\n }\n\n /**\n * Collapse the widget at position `index`.\n *\n * #### Notes\n * If no widget is found for `index`, this will bail.\n *\n * @param index Widget index\n */\n collapse(index: number): void {\n const widget = (this.layout as AccordionLayout).widgets[index];\n\n if (widget && !widget.isHidden) {\n this._toggleExpansion(index);\n }\n }\n\n /**\n * Expand the widget at position `index`.\n *\n * #### Notes\n * If no widget is found for `index`, this will bail.\n *\n * @param index Widget index\n */\n expand(index: number): void {\n const widget = (this.layout as AccordionLayout).widgets[index];\n\n if (widget && widget.isHidden) {\n this._toggleExpansion(index);\n }\n }\n\n /**\n * Insert a widget at the specified index.\n *\n * @param index - The index at which to insert the widget.\n *\n * @param widget - The widget to insert into to the panel.\n *\n * #### Notes\n * If the widget is already contained in the panel, it will be moved.\n */\n insertWidget(index: number, widget: Widget): void {\n super.insertWidget(index, widget);\n widget.title.changed.connect(this._onTitleChanged, this);\n }\n\n /**\n * Handle the DOM events for the accordion panel.\n *\n * @param event - The DOM event sent to the panel.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the panel's DOM node. It should\n * not be called directly by user code.\n */\n handleEvent(event: Event): void {\n super.handleEvent(event);\n switch (event.type) {\n case 'click':\n this._evtClick(event as MouseEvent);\n break;\n case 'keydown':\n this._eventKeyDown(event as KeyboardEvent);\n break;\n }\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n this.node.addEventListener('click', this);\n this.node.addEventListener('keydown', this);\n super.onBeforeAttach(msg);\n }\n\n /**\n * A message handler invoked on an `'after-detach'` message.\n */\n protected onAfterDetach(msg: Message): void {\n super.onAfterDetach(msg);\n this.node.removeEventListener('click', this);\n this.node.removeEventListener('keydown', this);\n }\n\n /**\n * Handle the `changed` signal of a title object.\n */\n private _onTitleChanged(sender: Title): void {\n const index = ArrayExt.findFirstIndex(this.widgets, widget => {\n return widget.contains(sender.owner);\n });\n\n if (index >= 0) {\n (this.layout as AccordionLayout).updateTitle(index, sender.owner);\n this.update();\n }\n }\n\n /**\n * Compute the size of widgets in this panel on the title click event.\n * On closing, the size of the widget is cached and we will try to expand\n * the last opened widget.\n * On opening, we will use the cached size if it is available to restore the\n * widget.\n * In both cases, if we can not compute the size of widgets, we will let\n * `SplitLayout` decide.\n *\n * @param index - The index of widget to be opened of closed\n *\n * @returns Relative size of widgets in this panel, if this size can\n * not be computed, return `undefined`\n */\n private _computeWidgetSize(index: number): number[] | undefined {\n const layout = this.layout as AccordionLayout;\n\n const widget = layout.widgets[index];\n if (!widget) {\n return undefined;\n }\n const isHidden = widget.isHidden;\n const widgetSizes = layout.absoluteSizes();\n const delta = (isHidden ? -1 : 1) * this.spacing;\n const totalSize = widgetSizes.reduce(\n (prev: number, curr: number) => prev + curr\n );\n\n let newSize = [...widgetSizes];\n\n if (!isHidden) {\n // Hide the widget\n const currentSize = widgetSizes[index];\n\n this._widgetSizesCache.set(widget, currentSize);\n newSize[index] = 0;\n\n const widgetToCollapse = newSize.map(sz => sz > 0).lastIndexOf(true);\n if (widgetToCollapse === -1) {\n // All widget are closed, let the `SplitLayout` compute widget sizes.\n return undefined;\n }\n\n newSize[widgetToCollapse] =\n widgetSizes[widgetToCollapse] + currentSize + delta;\n } else {\n // Show the widget\n const previousSize = this._widgetSizesCache.get(widget);\n if (!previousSize) {\n // Previous size is unavailable, let the `SplitLayout` compute widget sizes.\n return undefined;\n }\n newSize[index] += previousSize;\n\n const widgetToCollapse = newSize\n .map(sz => sz - previousSize > 0)\n .lastIndexOf(true);\n if (widgetToCollapse === -1) {\n // Can not reduce the size of one widget, reduce all opened widgets\n // proportionally with its size.\n newSize.forEach((_, idx) => {\n if (idx !== index) {\n newSize[idx] -=\n (widgetSizes[idx] / totalSize) * (previousSize - delta);\n }\n });\n } else {\n newSize[widgetToCollapse] -= previousSize - delta;\n }\n }\n return newSize.map(sz => sz / (totalSize + delta));\n }\n /**\n * Handle the `'click'` event for the accordion panel\n */\n private _evtClick(event: MouseEvent): void {\n const target = event.target as HTMLElement | null;\n\n if (target) {\n const index = ArrayExt.findFirstIndex(this.titles, title => {\n return title.contains(target);\n });\n\n if (index >= 0) {\n event.preventDefault();\n event.stopPropagation();\n this._toggleExpansion(index);\n }\n }\n }\n\n /**\n * Handle the `'keydown'` event for the accordion panel.\n */\n private _eventKeyDown(event: KeyboardEvent): void {\n if (event.defaultPrevented) {\n return;\n }\n\n const target = event.target as HTMLElement | null;\n let handled = false;\n if (target) {\n const index = ArrayExt.findFirstIndex(this.titles, title => {\n return title.contains(target);\n });\n\n if (index >= 0) {\n const keyCode = event.keyCode.toString();\n\n // If Space or Enter is pressed on title, emulate click event\n if (event.key.match(/Space|Enter/) || keyCode.match(/13|32/)) {\n target.click();\n handled = true;\n } else if (\n this.orientation === 'horizontal'\n ? event.key.match(/ArrowLeft|ArrowRight/) || keyCode.match(/37|39/)\n : event.key.match(/ArrowUp|ArrowDown/) || keyCode.match(/38|40/)\n ) {\n // If Up or Down (for vertical) / Left or Right (for horizontal) is pressed on title, loop on titles\n const direction =\n event.key.match(/ArrowLeft|ArrowUp/) || keyCode.match(/37|38/)\n ? -1\n : 1;\n const length = this.titles.length;\n const newIndex = (index + length + direction) % length;\n\n this.titles[newIndex].focus();\n handled = true;\n } else if (event.key === 'End' || keyCode === '35') {\n // If End is pressed on title, focus on the last title\n this.titles[this.titles.length - 1].focus();\n handled = true;\n } else if (event.key === 'Home' || keyCode === '36') {\n // If Home is pressed on title, focus on the first title\n this.titles[0].focus();\n handled = true;\n }\n }\n\n if (handled) {\n event.preventDefault();\n }\n }\n }\n\n private _toggleExpansion(index: number) {\n const title = this.titles[index];\n const widget = (this.layout as AccordionLayout).widgets[index];\n\n const newSize = this._computeWidgetSize(index);\n if (newSize) {\n this.setRelativeSizes(newSize, false);\n }\n\n if (widget.isHidden) {\n title.classList.add('lm-mod-expanded');\n title.setAttribute('aria-expanded', 'true');\n widget.show();\n } else {\n title.classList.remove('lm-mod-expanded');\n title.setAttribute('aria-expanded', 'false');\n widget.hide();\n }\n\n // Emit the expansion state signal.\n this._expansionToggled.emit(index);\n }\n\n private _widgetSizesCache: WeakMap = new WeakMap();\n private _expansionToggled = new Signal(this);\n}\n\n/**\n * The namespace for the `AccordionPanel` class statics.\n */\nexport namespace AccordionPanel {\n /**\n * A type alias for a accordion panel orientation.\n */\n export type Orientation = SplitLayout.Orientation;\n\n /**\n * A type alias for a accordion panel alignment.\n */\n export type Alignment = SplitLayout.Alignment;\n\n /**\n * A type alias for a accordion panel renderer.\n */\n export type IRenderer = AccordionLayout.IRenderer;\n\n /**\n * An options object for initializing a accordion panel.\n */\n export interface IOptions extends Partial {\n /**\n * The accordion layout to use for the accordion panel.\n *\n * If this is provided, the other options are ignored.\n *\n * The default is a new `AccordionLayout`.\n */\n layout?: AccordionLayout;\n }\n\n /**\n * The default implementation of `IRenderer`.\n */\n export class Renderer extends SplitPanel.Renderer implements IRenderer {\n constructor() {\n super();\n this._uuid = ++Renderer._nInstance;\n }\n /**\n * A selector which matches any title node in the accordion.\n */\n readonly titleClassName = 'lm-AccordionPanel-title';\n\n /**\n * Render the collapse indicator for a section title.\n *\n * @param data - The data to use for rendering the section title.\n *\n * @returns A element representing the collapse indicator.\n */\n createCollapseIcon(data: Title): HTMLElement {\n return document.createElement('span');\n }\n\n /**\n * Render the element for a section title.\n *\n * @param data - The data to use for rendering the section title.\n *\n * @returns A element representing the section title.\n */\n createSectionTitle(data: Title): HTMLElement {\n const handle = document.createElement('h3');\n handle.setAttribute('tabindex', '0');\n handle.id = this.createTitleKey(data);\n handle.className = this.titleClassName;\n for (const aData in data.dataset) {\n handle.dataset[aData] = data.dataset[aData];\n }\n\n const collapser = handle.appendChild(this.createCollapseIcon(data));\n collapser.className = 'lm-AccordionPanel-titleCollapser';\n\n const label = handle.appendChild(document.createElement('span'));\n label.className = 'lm-AccordionPanel-titleLabel';\n label.textContent = data.label;\n label.title = data.caption || data.label;\n\n return handle;\n }\n\n /**\n * Create a unique render key for the title.\n *\n * @param data - The data to use for the title.\n *\n * @returns The unique render key for the title.\n *\n * #### Notes\n * This method caches the key against the section title the first time\n * the key is generated.\n */\n createTitleKey(data: Title): string {\n let key = this._titleKeys.get(data);\n if (key === undefined) {\n key = `title-key-${this._uuid}-${this._titleID++}`;\n this._titleKeys.set(data, key);\n }\n return key;\n }\n\n private static _nInstance = 0;\n private readonly _uuid: number;\n private _titleID = 0;\n private _titleKeys = new WeakMap, string>();\n }\n\n /**\n * The default `Renderer` instance.\n */\n export const defaultRenderer = new Renderer();\n}\n\nnamespace Private {\n /**\n * Create an accordion layout for the given panel options.\n *\n * @param options Panel options\n * @returns Panel layout\n */\n export function createLayout(\n options: AccordionPanel.IOptions\n ): AccordionLayout {\n return (\n options.layout ||\n new AccordionLayout({\n renderer: options.renderer || AccordionPanel.defaultRenderer,\n orientation: options.orientation,\n alignment: options.alignment,\n spacing: options.spacing,\n titleSpace: options.titleSpace\n })\n );\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { AttachedProperty } from '@lumino/properties';\n\nimport { BoxEngine, BoxSizer } from './boxengine';\n\nimport { LayoutItem } from './layout';\n\nimport { PanelLayout } from './panellayout';\n\nimport Utils from './utils';\n\nimport { Widget } from './widget';\n\n/**\n * A layout which arranges its widgets in a single row or column.\n */\nexport class BoxLayout extends PanelLayout {\n /**\n * Construct a new box layout.\n *\n * @param options - The options for initializing the layout.\n */\n constructor(options: BoxLayout.IOptions = {}) {\n super();\n if (options.direction !== undefined) {\n this._direction = options.direction;\n }\n if (options.alignment !== undefined) {\n this._alignment = options.alignment;\n }\n if (options.spacing !== undefined) {\n this._spacing = Utils.clampDimension(options.spacing);\n }\n }\n\n /**\n * Dispose of the resources held by the layout.\n */\n dispose(): void {\n // Dispose of the layout items.\n for (const item of this._items) {\n item.dispose();\n }\n\n // Clear the layout state.\n this._box = null;\n this._items.length = 0;\n this._sizers.length = 0;\n\n // Dispose of the rest of the layout.\n super.dispose();\n }\n\n /**\n * Get the layout direction for the box layout.\n */\n get direction(): BoxLayout.Direction {\n return this._direction;\n }\n\n /**\n * Set the layout direction for the box layout.\n */\n set direction(value: BoxLayout.Direction) {\n if (this._direction === value) {\n return;\n }\n this._direction = value;\n if (!this.parent) {\n return;\n }\n this.parent.dataset['direction'] = value;\n this.parent.fit();\n }\n\n /**\n * Get the content alignment for the box layout.\n *\n * #### Notes\n * This is the alignment of the widgets in the layout direction.\n *\n * The alignment has no effect if the widgets can expand to fill the\n * entire box layout.\n */\n get alignment(): BoxLayout.Alignment {\n return this._alignment;\n }\n\n /**\n * Set the content alignment for the box layout.\n *\n * #### Notes\n * This is the alignment of the widgets in the layout direction.\n *\n * The alignment has no effect if the widgets can expand to fill the\n * entire box layout.\n */\n set alignment(value: BoxLayout.Alignment) {\n if (this._alignment === value) {\n return;\n }\n this._alignment = value;\n if (!this.parent) {\n return;\n }\n this.parent.dataset['alignment'] = value;\n this.parent.update();\n }\n\n /**\n * Get the inter-element spacing for the box layout.\n */\n get spacing(): number {\n return this._spacing;\n }\n\n /**\n * Set the inter-element spacing for the box layout.\n */\n set spacing(value: number) {\n value = Utils.clampDimension(value);\n if (this._spacing === value) {\n return;\n }\n this._spacing = value;\n if (!this.parent) {\n return;\n }\n this.parent.fit();\n }\n\n /**\n * Perform layout initialization which requires the parent widget.\n */\n protected init(): void {\n this.parent!.dataset['direction'] = this.direction;\n this.parent!.dataset['alignment'] = this.alignment;\n super.init();\n }\n\n /**\n * Attach a widget to the parent's DOM node.\n *\n * @param index - The current index of the widget in the layout.\n *\n * @param widget - The widget to attach to the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected attachWidget(index: number, widget: Widget): void {\n // Create and add a new layout item for the widget.\n ArrayExt.insert(this._items, index, new LayoutItem(widget));\n\n // Create and add a new sizer for the widget.\n ArrayExt.insert(this._sizers, index, new BoxSizer());\n\n // Send a `'before-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n }\n\n // Add the widget's node to the parent.\n this.parent!.node.appendChild(widget.node);\n\n // Send an `'after-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n\n // Post a fit request for the parent widget.\n this.parent!.fit();\n }\n\n /**\n * Move a widget in the parent's DOM node.\n *\n * @param fromIndex - The previous index of the widget in the layout.\n *\n * @param toIndex - The current index of the widget in the layout.\n *\n * @param widget - The widget to move in the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected moveWidget(\n fromIndex: number,\n toIndex: number,\n widget: Widget\n ): void {\n // Move the layout item for the widget.\n ArrayExt.move(this._items, fromIndex, toIndex);\n\n // Move the sizer for the widget.\n ArrayExt.move(this._sizers, fromIndex, toIndex);\n\n // Post an update request for the parent widget.\n this.parent!.update();\n }\n\n /**\n * Detach a widget from the parent's DOM node.\n *\n * @param index - The previous index of the widget in the layout.\n *\n * @param widget - The widget to detach from the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected detachWidget(index: number, widget: Widget): void {\n // Remove the layout item for the widget.\n let item = ArrayExt.removeAt(this._items, index);\n\n // Remove the sizer for the widget.\n ArrayExt.removeAt(this._sizers, index);\n\n // Send a `'before-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n }\n\n // Remove the widget's node from the parent.\n this.parent!.node.removeChild(widget.node);\n\n // Send an `'after-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n\n // Dispose of the layout item.\n item!.dispose();\n\n // Post a fit request for the parent widget.\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'before-show'` message.\n */\n protected onBeforeShow(msg: Message): void {\n super.onBeforeShow(msg);\n this.parent!.update();\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n super.onBeforeAttach(msg);\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-shown'` message.\n */\n protected onChildShown(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-hidden'` message.\n */\n protected onChildHidden(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'resize'` message.\n */\n protected onResize(msg: Widget.ResizeMessage): void {\n if (this.parent!.isVisible) {\n this._update(msg.width, msg.height);\n }\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n protected onUpdateRequest(msg: Message): void {\n if (this.parent!.isVisible) {\n this._update(-1, -1);\n }\n }\n\n /**\n * A message handler invoked on a `'fit-request'` message.\n */\n protected onFitRequest(msg: Message): void {\n if (this.parent!.isAttached) {\n this._fit();\n }\n }\n\n /**\n * Fit the layout to the total size required by the widgets.\n */\n private _fit(): void {\n // Compute the visible item count.\n let nVisible = 0;\n for (let i = 0, n = this._items.length; i < n; ++i) {\n nVisible += +!this._items[i].isHidden;\n }\n\n // Update the fixed space for the visible items.\n this._fixed = this._spacing * Math.max(0, nVisible - 1);\n\n // Setup the computed minimum size.\n let horz = Private.isHorizontal(this._direction);\n let minW = horz ? this._fixed : 0;\n let minH = horz ? 0 : this._fixed;\n\n // Update the sizers and computed minimum size.\n for (let i = 0, n = this._items.length; i < n; ++i) {\n // Fetch the item and corresponding box sizer.\n let item = this._items[i];\n let sizer = this._sizers[i];\n\n // If the item is hidden, it should consume zero size.\n if (item.isHidden) {\n sizer.minSize = 0;\n sizer.maxSize = 0;\n continue;\n }\n\n // Update the size limits for the item.\n item.fit();\n\n // Update the size basis and stretch factor.\n sizer.sizeHint = BoxLayout.getSizeBasis(item.widget);\n sizer.stretch = BoxLayout.getStretch(item.widget);\n\n // Update the sizer limits and computed min size.\n if (horz) {\n sizer.minSize = item.minWidth;\n sizer.maxSize = item.maxWidth;\n minW += item.minWidth;\n minH = Math.max(minH, item.minHeight);\n } else {\n sizer.minSize = item.minHeight;\n sizer.maxSize = item.maxHeight;\n minH += item.minHeight;\n minW = Math.max(minW, item.minWidth);\n }\n }\n\n // Update the box sizing and add it to the computed min size.\n let box = (this._box = ElementExt.boxSizing(this.parent!.node));\n minW += box.horizontalSum;\n minH += box.verticalSum;\n\n // Update the parent's min size constraints.\n let style = this.parent!.node.style;\n style.minWidth = `${minW}px`;\n style.minHeight = `${minH}px`;\n\n // Set the dirty flag to ensure only a single update occurs.\n this._dirty = true;\n\n // Notify the ancestor that it should fit immediately. This may\n // cause a resize of the parent, fulfilling the required update.\n if (this.parent!.parent) {\n MessageLoop.sendMessage(this.parent!.parent!, Widget.Msg.FitRequest);\n }\n\n // If the dirty flag is still set, the parent was not resized.\n // Trigger the required update on the parent widget immediately.\n if (this._dirty) {\n MessageLoop.sendMessage(this.parent!, Widget.Msg.UpdateRequest);\n }\n }\n\n /**\n * Update the layout position and size of the widgets.\n *\n * The parent offset dimensions should be `-1` if unknown.\n */\n private _update(offsetWidth: number, offsetHeight: number): void {\n // Clear the dirty flag to indicate the update occurred.\n this._dirty = false;\n\n // Compute the visible item count.\n let nVisible = 0;\n for (let i = 0, n = this._items.length; i < n; ++i) {\n nVisible += +!this._items[i].isHidden;\n }\n\n // Bail early if there are no visible items to layout.\n if (nVisible === 0) {\n return;\n }\n\n // Measure the parent if the offset dimensions are unknown.\n if (offsetWidth < 0) {\n offsetWidth = this.parent!.node.offsetWidth;\n }\n if (offsetHeight < 0) {\n offsetHeight = this.parent!.node.offsetHeight;\n }\n\n // Ensure the parent box sizing data is computed.\n if (!this._box) {\n this._box = ElementExt.boxSizing(this.parent!.node);\n }\n\n // Compute the layout area adjusted for border and padding.\n let top = this._box.paddingTop;\n let left = this._box.paddingLeft;\n let width = offsetWidth - this._box.horizontalSum;\n let height = offsetHeight - this._box.verticalSum;\n\n // Distribute the layout space and adjust the start position.\n let delta: number;\n switch (this._direction) {\n case 'left-to-right':\n delta = BoxEngine.calc(this._sizers, Math.max(0, width - this._fixed));\n break;\n case 'top-to-bottom':\n delta = BoxEngine.calc(this._sizers, Math.max(0, height - this._fixed));\n break;\n case 'right-to-left':\n delta = BoxEngine.calc(this._sizers, Math.max(0, width - this._fixed));\n left += width;\n break;\n case 'bottom-to-top':\n delta = BoxEngine.calc(this._sizers, Math.max(0, height - this._fixed));\n top += height;\n break;\n default:\n throw 'unreachable';\n }\n\n // Setup the variables for justification and alignment offset.\n let extra = 0;\n let offset = 0;\n\n // Account for alignment if there is extra layout space.\n if (delta > 0) {\n switch (this._alignment) {\n case 'start':\n break;\n case 'center':\n extra = 0;\n offset = delta / 2;\n break;\n case 'end':\n extra = 0;\n offset = delta;\n break;\n case 'justify':\n extra = delta / nVisible;\n offset = 0;\n break;\n default:\n throw 'unreachable';\n }\n }\n\n // Layout the items using the computed box sizes.\n for (let i = 0, n = this._items.length; i < n; ++i) {\n // Fetch the item.\n let item = this._items[i];\n\n // Ignore hidden items.\n if (item.isHidden) {\n continue;\n }\n\n // Fetch the computed size for the widget.\n let size = this._sizers[i].size;\n\n // Update the widget geometry and advance the relevant edge.\n switch (this._direction) {\n case 'left-to-right':\n item.update(left + offset, top, size + extra, height);\n left += size + extra + this._spacing;\n break;\n case 'top-to-bottom':\n item.update(left, top + offset, width, size + extra);\n top += size + extra + this._spacing;\n break;\n case 'right-to-left':\n item.update(left - offset - size - extra, top, size + extra, height);\n left -= size + extra + this._spacing;\n break;\n case 'bottom-to-top':\n item.update(left, top - offset - size - extra, width, size + extra);\n top -= size + extra + this._spacing;\n break;\n default:\n throw 'unreachable';\n }\n }\n }\n\n private _fixed = 0;\n private _spacing = 4;\n private _dirty = false;\n private _sizers: BoxSizer[] = [];\n private _items: LayoutItem[] = [];\n private _box: ElementExt.IBoxSizing | null = null;\n private _alignment: BoxLayout.Alignment = 'start';\n private _direction: BoxLayout.Direction = 'top-to-bottom';\n}\n\n/**\n * The namespace for the `BoxLayout` class statics.\n */\nexport namespace BoxLayout {\n /**\n * A type alias for a box layout direction.\n */\n export type Direction =\n | 'left-to-right'\n | 'right-to-left'\n | 'top-to-bottom'\n | 'bottom-to-top';\n\n /**\n * A type alias for a box layout alignment.\n */\n export type Alignment = 'start' | 'center' | 'end' | 'justify';\n\n /**\n * An options object for initializing a box layout.\n */\n export interface IOptions {\n /**\n * The direction of the layout.\n *\n * The default is `'top-to-bottom'`.\n */\n direction?: Direction;\n\n /**\n * The content alignment of the layout.\n *\n * The default is `'start'`.\n */\n alignment?: Alignment;\n\n /**\n * The spacing between items in the layout.\n *\n * The default is `4`.\n */\n spacing?: number;\n }\n\n /**\n * Get the box layout stretch factor for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The box layout stretch factor for the widget.\n */\n export function getStretch(widget: Widget): number {\n return Private.stretchProperty.get(widget);\n }\n\n /**\n * Set the box layout stretch factor for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the stretch factor.\n */\n export function setStretch(widget: Widget, value: number): void {\n Private.stretchProperty.set(widget, value);\n }\n\n /**\n * Get the box layout size basis for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The box layout size basis for the widget.\n */\n export function getSizeBasis(widget: Widget): number {\n return Private.sizeBasisProperty.get(widget);\n }\n\n /**\n * Set the box layout size basis for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the size basis.\n */\n export function setSizeBasis(widget: Widget, value: number): void {\n Private.sizeBasisProperty.set(widget, value);\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * The property descriptor for a widget stretch factor.\n */\n export const stretchProperty = new AttachedProperty({\n name: 'stretch',\n create: () => 0,\n coerce: (owner, value) => Math.max(0, Math.floor(value)),\n changed: onChildSizingChanged\n });\n\n /**\n * The property descriptor for a widget size basis.\n */\n export const sizeBasisProperty = new AttachedProperty({\n name: 'sizeBasis',\n create: () => 0,\n coerce: (owner, value) => Math.max(0, Math.floor(value)),\n changed: onChildSizingChanged\n });\n\n /**\n * Test whether a direction has horizontal orientation.\n */\n export function isHorizontal(dir: BoxLayout.Direction): boolean {\n return dir === 'left-to-right' || dir === 'right-to-left';\n }\n\n /**\n * Clamp a spacing value to an integer >= 0.\n */\n export function clampSpacing(value: number): number {\n return Math.max(0, Math.floor(value));\n }\n\n /**\n * The change handler for the attached sizing properties.\n */\n function onChildSizingChanged(child: Widget): void {\n if (child.parent && child.parent.layout instanceof BoxLayout) {\n child.parent.fit();\n }\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { BoxLayout } from './boxlayout';\n\nimport { Panel } from './panel';\n\nimport { Widget } from './widget';\n\n/**\n * A panel which arranges its widgets in a single row or column.\n *\n * #### Notes\n * This class provides a convenience wrapper around a {@link BoxLayout}.\n */\nexport class BoxPanel extends Panel {\n /**\n * Construct a new box panel.\n *\n * @param options - The options for initializing the box panel.\n */\n constructor(options: BoxPanel.IOptions = {}) {\n super({ layout: Private.createLayout(options) });\n this.addClass('lm-BoxPanel');\n }\n\n /**\n * Get the layout direction for the box panel.\n */\n get direction(): BoxPanel.Direction {\n return (this.layout as BoxLayout).direction;\n }\n\n /**\n * Set the layout direction for the box panel.\n */\n set direction(value: BoxPanel.Direction) {\n (this.layout as BoxLayout).direction = value;\n }\n\n /**\n * Get the content alignment for the box panel.\n *\n * #### Notes\n * This is the alignment of the widgets in the layout direction.\n *\n * The alignment has no effect if the widgets can expand to fill the\n * entire box layout.\n */\n get alignment(): BoxPanel.Alignment {\n return (this.layout as BoxLayout).alignment;\n }\n\n /**\n * Set the content alignment for the box panel.\n *\n * #### Notes\n * This is the alignment of the widgets in the layout direction.\n *\n * The alignment has no effect if the widgets can expand to fill the\n * entire box layout.\n */\n set alignment(value: BoxPanel.Alignment) {\n (this.layout as BoxLayout).alignment = value;\n }\n\n /**\n * Get the inter-element spacing for the box panel.\n */\n get spacing(): number {\n return (this.layout as BoxLayout).spacing;\n }\n\n /**\n * Set the inter-element spacing for the box panel.\n */\n set spacing(value: number) {\n (this.layout as BoxLayout).spacing = value;\n }\n\n /**\n * A message handler invoked on a `'child-added'` message.\n */\n protected onChildAdded(msg: Widget.ChildMessage): void {\n msg.child.addClass('lm-BoxPanel-child');\n }\n\n /**\n * A message handler invoked on a `'child-removed'` message.\n */\n protected onChildRemoved(msg: Widget.ChildMessage): void {\n msg.child.removeClass('lm-BoxPanel-child');\n }\n}\n\n/**\n * The namespace for the `BoxPanel` class statics.\n */\nexport namespace BoxPanel {\n /**\n * A type alias for a box panel direction.\n */\n export type Direction = BoxLayout.Direction;\n\n /**\n * A type alias for a box panel alignment.\n */\n export type Alignment = BoxLayout.Alignment;\n\n /**\n * An options object for initializing a box panel.\n */\n export interface IOptions {\n /**\n * The layout direction of the panel.\n *\n * Possible values are documented in {@link BoxLayout.Direction}.\n *\n * The default is `'top-to-bottom'`.\n */\n direction?: Direction;\n\n /**\n * The content alignment of the panel.\n *\n * Possible values are documented in {@link BoxLayout.Alignment}.\n *\n * The default is `'start'`.\n */\n alignment?: Alignment;\n\n /**\n * The spacing between items in the panel.\n *\n * The default is `4`.\n */\n spacing?: number;\n\n /**\n * The box layout to use for the box panel.\n *\n * If this is provided, the other options are ignored.\n *\n * The default is a new `BoxLayout`.\n */\n layout?: BoxLayout;\n }\n\n /**\n * Get the box panel stretch factor for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The box panel stretch factor for the widget.\n */\n export function getStretch(widget: Widget): number {\n return BoxLayout.getStretch(widget);\n }\n\n /**\n * Set the box panel stretch factor for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the stretch factor.\n */\n export function setStretch(widget: Widget, value: number): void {\n BoxLayout.setStretch(widget, value);\n }\n\n /**\n * Get the box panel size basis for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The box panel size basis for the widget.\n */\n export function getSizeBasis(widget: Widget): number {\n return BoxLayout.getSizeBasis(widget);\n }\n\n /**\n * Set the box panel size basis for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the size basis.\n */\n export function setSizeBasis(widget: Widget, value: number): void {\n BoxLayout.setSizeBasis(widget, value);\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * Create a box layout for the given panel options.\n */\n export function createLayout(options: BoxPanel.IOptions): BoxLayout {\n return options.layout || new BoxLayout(options);\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt, StringExt } from '@lumino/algorithm';\n\nimport { JSONExt, ReadonlyJSONObject } from '@lumino/coreutils';\n\nimport { CommandRegistry } from '@lumino/commands';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message } from '@lumino/messaging';\n\nimport {\n ElementDataset,\n h,\n VirtualDOM,\n VirtualElement\n} from '@lumino/virtualdom';\n\nimport { Widget } from './widget';\n\n/**\n * A widget which displays command items as a searchable palette.\n */\nexport class CommandPalette extends Widget {\n /**\n * Construct a new command palette.\n *\n * @param options - The options for initializing the palette.\n */\n constructor(options: CommandPalette.IOptions) {\n super({ node: Private.createNode() });\n this.addClass('lm-CommandPalette');\n this.setFlag(Widget.Flag.DisallowLayout);\n this.commands = options.commands;\n this.renderer = options.renderer || CommandPalette.defaultRenderer;\n this.commands.commandChanged.connect(this._onGenericChange, this);\n this.commands.keyBindingChanged.connect(this._onGenericChange, this);\n }\n\n /**\n * Dispose of the resources held by the widget.\n */\n dispose(): void {\n this._items.length = 0;\n this._results = null;\n super.dispose();\n }\n\n /**\n * The command registry used by the command palette.\n */\n readonly commands: CommandRegistry;\n\n /**\n * The renderer used by the command palette.\n */\n readonly renderer: CommandPalette.IRenderer;\n\n /**\n * The command palette search node.\n *\n * #### Notes\n * This is the node which contains the search-related elements.\n */\n get searchNode(): HTMLDivElement {\n return this.node.getElementsByClassName(\n 'lm-CommandPalette-search'\n )[0] as HTMLDivElement;\n }\n\n /**\n * The command palette input node.\n *\n * #### Notes\n * This is the actual input node for the search area.\n */\n get inputNode(): HTMLInputElement {\n return this.node.getElementsByClassName(\n 'lm-CommandPalette-input'\n )[0] as HTMLInputElement;\n }\n\n /**\n * The command palette content node.\n *\n * #### Notes\n * This is the node which holds the command item nodes.\n *\n * Modifying this node directly can lead to undefined behavior.\n */\n get contentNode(): HTMLUListElement {\n return this.node.getElementsByClassName(\n 'lm-CommandPalette-content'\n )[0] as HTMLUListElement;\n }\n\n /**\n * A read-only array of the command items in the palette.\n */\n get items(): ReadonlyArray {\n return this._items;\n }\n\n /**\n * Add a command item to the command palette.\n *\n * @param options - The options for creating the command item.\n *\n * @returns The command item added to the palette.\n */\n addItem(options: CommandPalette.IItemOptions): CommandPalette.IItem {\n // Create a new command item for the options.\n let item = Private.createItem(this.commands, options);\n\n // Add the item to the array.\n this._items.push(item);\n\n // Refresh the search results.\n this.refresh();\n\n // Return the item added to the palette.\n return item;\n }\n\n /**\n * Adds command items to the command palette.\n *\n * @param items - An array of options for creating each command item.\n *\n * @returns The command items added to the palette.\n */\n addItems(items: CommandPalette.IItemOptions[]): CommandPalette.IItem[] {\n const newItems = items.map(item => Private.createItem(this.commands, item));\n newItems.forEach(item => this._items.push(item));\n this.refresh();\n return newItems;\n }\n\n /**\n * Remove an item from the command palette.\n *\n * @param item - The item to remove from the palette.\n *\n * #### Notes\n * This is a no-op if the item is not in the palette.\n */\n removeItem(item: CommandPalette.IItem): void {\n this.removeItemAt(this._items.indexOf(item));\n }\n\n /**\n * Remove the item at a given index from the command palette.\n *\n * @param index - The index of the item to remove.\n *\n * #### Notes\n * This is a no-op if the index is out of range.\n */\n removeItemAt(index: number): void {\n // Remove the item from the array.\n let item = ArrayExt.removeAt(this._items, index);\n\n // Bail if the index is out of range.\n if (!item) {\n return;\n }\n\n // Refresh the search results.\n this.refresh();\n }\n\n /**\n * Remove all items from the command palette.\n */\n clearItems(): void {\n // Bail if there is nothing to remove.\n if (this._items.length === 0) {\n return;\n }\n\n // Clear the array of items.\n this._items.length = 0;\n\n // Refresh the search results.\n this.refresh();\n }\n\n /**\n * Clear the search results and schedule an update.\n *\n * #### Notes\n * This should be called whenever the search results of the palette\n * should be updated.\n *\n * This is typically called automatically by the palette as needed,\n * but can be called manually if the input text is programatically\n * changed.\n *\n * The rendered results are updated asynchronously.\n */\n refresh(): void {\n this._results = null;\n if (this.inputNode.value !== '') {\n let clear = this.node.getElementsByClassName(\n 'lm-close-icon'\n )[0] as HTMLInputElement;\n clear.style.display = 'inherit';\n } else {\n let clear = this.node.getElementsByClassName(\n 'lm-close-icon'\n )[0] as HTMLInputElement;\n clear.style.display = 'none';\n }\n this.update();\n }\n\n /**\n * Handle the DOM events for the command palette.\n *\n * @param event - The DOM event sent to the command palette.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the command palette's DOM node.\n * It should not be called directly by user code.\n */\n handleEvent(event: Event): void {\n switch (event.type) {\n case 'click':\n this._evtClick(event as MouseEvent);\n break;\n case 'keydown':\n this._evtKeyDown(event as KeyboardEvent);\n break;\n case 'input':\n this.refresh();\n break;\n case 'focus':\n case 'blur':\n this._toggleFocused();\n break;\n }\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n this.node.addEventListener('click', this);\n this.node.addEventListener('keydown', this);\n this.node.addEventListener('input', this);\n this.node.addEventListener('focus', this, true);\n this.node.addEventListener('blur', this, true);\n }\n\n /**\n * A message handler invoked on an `'after-detach'` message.\n */\n protected onAfterDetach(msg: Message): void {\n this.node.removeEventListener('click', this);\n this.node.removeEventListener('keydown', this);\n this.node.removeEventListener('input', this);\n this.node.removeEventListener('focus', this, true);\n this.node.removeEventListener('blur', this, true);\n }\n\n /**\n * A message handler invoked on an `'after-show'` message.\n */\n protected onAfterShow(msg: Message): void {\n this.update();\n super.onAfterShow(msg);\n }\n\n /**\n * A message handler invoked on an `'activate-request'` message.\n */\n protected onActivateRequest(msg: Message): void {\n if (this.isAttached) {\n let input = this.inputNode;\n input.focus();\n input.select();\n }\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n protected onUpdateRequest(msg: Message): void {\n if (!this.isVisible) {\n // Ensure to clear the content if the widget is hidden\n VirtualDOM.render(null, this.contentNode);\n return;\n }\n\n // Fetch the current query text and content node.\n let query = this.inputNode.value;\n let contentNode = this.contentNode;\n\n // Ensure the search results are generated.\n let results = this._results;\n if (!results) {\n // Generate and store the new search results.\n results = this._results = Private.search(this._items, query);\n\n // Reset the active index.\n this._activeIndex = query\n ? ArrayExt.findFirstIndex(results, Private.canActivate)\n : -1;\n }\n\n // If there is no query and no results, clear the content.\n if (!query && results.length === 0) {\n VirtualDOM.render(null, contentNode);\n return;\n }\n\n // If the is a query but no results, render the empty message.\n if (query && results.length === 0) {\n let content = this.renderer.renderEmptyMessage({ query });\n VirtualDOM.render(content, contentNode);\n return;\n }\n\n // Create the render content for the search results.\n let renderer = this.renderer;\n let activeIndex = this._activeIndex;\n let content = new Array(results.length);\n for (let i = 0, n = results.length; i < n; ++i) {\n let result = results[i];\n if (result.type === 'header') {\n let indices = result.indices;\n let category = result.category;\n content[i] = renderer.renderHeader({ category, indices });\n } else {\n let item = result.item;\n let indices = result.indices;\n let active = i === activeIndex;\n content[i] = renderer.renderItem({ item, indices, active });\n }\n }\n\n // Render the search result content.\n VirtualDOM.render(content, contentNode);\n\n // Adjust the scroll position as needed.\n if (activeIndex < 0 || activeIndex >= results.length) {\n contentNode.scrollTop = 0;\n } else {\n let element = contentNode.children[activeIndex];\n ElementExt.scrollIntoViewIfNeeded(contentNode, element);\n }\n }\n\n /**\n * Handle the `'click'` event for the command palette.\n */\n private _evtClick(event: MouseEvent): void {\n // Bail if the click is not the left button.\n if (event.button !== 0) {\n return;\n }\n\n // Clear input if the target is clear button\n if ((event.target as HTMLElement).classList.contains('lm-close-icon')) {\n this.inputNode.value = '';\n this.refresh();\n return;\n }\n\n // Find the index of the item which was clicked.\n let index = ArrayExt.findFirstIndex(this.contentNode.children, node => {\n return node.contains(event.target as HTMLElement);\n });\n\n // Bail if the click was not on an item.\n if (index === -1) {\n return;\n }\n\n // Kill the event when a content item is clicked.\n event.preventDefault();\n event.stopPropagation();\n\n // Execute the item if possible.\n this._execute(index);\n }\n\n /**\n * Handle the `'keydown'` event for the command palette.\n */\n private _evtKeyDown(event: KeyboardEvent): void {\n if (event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) {\n return;\n }\n switch (event.keyCode) {\n case 13: // Enter\n event.preventDefault();\n event.stopPropagation();\n this._execute(this._activeIndex);\n break;\n case 38: // Up Arrow\n event.preventDefault();\n event.stopPropagation();\n this._activatePreviousItem();\n break;\n case 40: // Down Arrow\n event.preventDefault();\n event.stopPropagation();\n this._activateNextItem();\n break;\n }\n }\n\n /**\n * Activate the next enabled command item.\n */\n private _activateNextItem(): void {\n // Bail if there are no search results.\n if (!this._results || this._results.length === 0) {\n return;\n }\n\n // Find the next enabled item index.\n let ai = this._activeIndex;\n let n = this._results.length;\n let start = ai < n - 1 ? ai + 1 : 0;\n let stop = start === 0 ? n - 1 : start - 1;\n this._activeIndex = ArrayExt.findFirstIndex(\n this._results,\n Private.canActivate,\n start,\n stop\n );\n\n // Schedule an update of the items.\n this.update();\n }\n\n /**\n * Activate the previous enabled command item.\n */\n private _activatePreviousItem(): void {\n // Bail if there are no search results.\n if (!this._results || this._results.length === 0) {\n return;\n }\n\n // Find the previous enabled item index.\n let ai = this._activeIndex;\n let n = this._results.length;\n let start = ai <= 0 ? n - 1 : ai - 1;\n let stop = start === n - 1 ? 0 : start + 1;\n this._activeIndex = ArrayExt.findLastIndex(\n this._results,\n Private.canActivate,\n start,\n stop\n );\n\n // Schedule an update of the items.\n this.update();\n }\n\n /**\n * Execute the command item at the given index, if possible.\n */\n private _execute(index: number): void {\n // Bail if there are no search results.\n if (!this._results) {\n return;\n }\n\n // Bail if the index is out of range.\n let part = this._results[index];\n if (!part) {\n return;\n }\n\n // Update the search text if the item is a header.\n if (part.type === 'header') {\n let input = this.inputNode;\n input.value = `${part.category.toLowerCase()} `;\n input.focus();\n this.refresh();\n return;\n }\n\n // Bail if item is not enabled.\n if (!part.item.isEnabled) {\n return;\n }\n\n // Execute the item.\n this.commands.execute(part.item.command, part.item.args);\n\n // Clear the query text.\n this.inputNode.value = '';\n\n // Refresh the search results.\n this.refresh();\n }\n\n /**\n * Toggle the focused modifier based on the input node focus state.\n */\n private _toggleFocused(): void {\n let focused = document.activeElement === this.inputNode;\n this.toggleClass('lm-mod-focused', focused);\n }\n\n /**\n * A signal handler for generic command changes.\n */\n private _onGenericChange(): void {\n this.refresh();\n }\n\n private _activeIndex = -1;\n private _items: CommandPalette.IItem[] = [];\n private _results: Private.SearchResult[] | null = null;\n}\n\n/**\n * The namespace for the `CommandPalette` class statics.\n */\nexport namespace CommandPalette {\n /**\n * An options object for creating a command palette.\n */\n export interface IOptions {\n /**\n * The command registry for use with the command palette.\n */\n commands: CommandRegistry;\n\n /**\n * A custom renderer for use with the command palette.\n *\n * The default is a shared renderer instance.\n */\n renderer?: IRenderer;\n }\n\n /**\n * An options object for creating a command item.\n */\n export interface IItemOptions {\n /**\n * The category for the item.\n */\n category: string;\n\n /**\n * The command to execute when the item is triggered.\n */\n command: string;\n\n /**\n * The arguments for the command.\n *\n * The default value is an empty object.\n */\n args?: ReadonlyJSONObject;\n\n /**\n * The rank for the command item.\n *\n * The rank is used as a tie-breaker when ordering command items\n * for display. Items are sorted in the following order:\n * 1. Text match (lower is better)\n * 2. Category (locale order)\n * 3. Rank (lower is better)\n * 4. Label (locale order)\n *\n * The default rank is `Infinity`.\n */\n rank?: number;\n }\n\n /**\n * An object which represents an item in a command palette.\n *\n * #### Notes\n * Item objects are created automatically by a command palette.\n */\n export interface IItem {\n /**\n * The command to execute when the item is triggered.\n */\n readonly command: string;\n\n /**\n * The arguments for the command.\n */\n readonly args: ReadonlyJSONObject;\n\n /**\n * The category for the command item.\n */\n readonly category: string;\n\n /**\n * The rank for the command item.\n */\n readonly rank: number;\n\n /**\n * The display label for the command item.\n */\n readonly label: string;\n\n /**\n * The display caption for the command item.\n */\n readonly caption: string;\n\n /**\n * The icon renderer for the command item.\n */\n readonly icon: VirtualElement.IRenderer | undefined;\n\n /**\n * The icon class for the command item.\n */\n readonly iconClass: string;\n\n /**\n * The icon label for the command item.\n */\n readonly iconLabel: string;\n\n /**\n * The extra class name for the command item.\n */\n readonly className: string;\n\n /**\n * The dataset for the command item.\n */\n readonly dataset: CommandRegistry.Dataset;\n\n /**\n * Whether the command item is enabled.\n */\n readonly isEnabled: boolean;\n\n /**\n * Whether the command item is toggled.\n */\n readonly isToggled: boolean;\n\n /**\n * Whether the command item is toggleable.\n */\n readonly isToggleable: boolean;\n\n /**\n * Whether the command item is visible.\n */\n readonly isVisible: boolean;\n\n /**\n * The key binding for the command item.\n */\n readonly keyBinding: CommandRegistry.IKeyBinding | null;\n }\n\n /**\n * The render data for a command palette header.\n */\n export interface IHeaderRenderData {\n /**\n * The category of the header.\n */\n readonly category: string;\n\n /**\n * The indices of the matched characters in the category.\n */\n readonly indices: ReadonlyArray | null;\n }\n\n /**\n * The render data for a command palette item.\n */\n export interface IItemRenderData {\n /**\n * The command palette item to render.\n */\n readonly item: IItem;\n\n /**\n * The indices of the matched characters in the label.\n */\n readonly indices: ReadonlyArray | null;\n\n /**\n * Whether the item is the active item.\n */\n readonly active: boolean;\n }\n\n /**\n * The render data for a command palette empty message.\n */\n export interface IEmptyMessageRenderData {\n /**\n * The query which failed to match any commands.\n */\n query: string;\n }\n\n /**\n * A renderer for use with a command palette.\n */\n export interface IRenderer {\n /**\n * Render the virtual element for a command palette header.\n *\n * @param data - The data to use for rendering the header.\n *\n * @returns A virtual element representing the header.\n */\n renderHeader(data: IHeaderRenderData): VirtualElement;\n\n /**\n * Render the virtual element for a command palette item.\n *\n * @param data - The data to use for rendering the item.\n *\n * @returns A virtual element representing the item.\n *\n * #### Notes\n * The command palette will not render invisible items.\n */\n renderItem(data: IItemRenderData): VirtualElement;\n\n /**\n * Render the empty results message for a command palette.\n *\n * @param data - The data to use for rendering the message.\n *\n * @returns A virtual element representing the message.\n */\n renderEmptyMessage(data: IEmptyMessageRenderData): VirtualElement;\n }\n\n /**\n * The default implementation of `IRenderer`.\n */\n export class Renderer implements IRenderer {\n /**\n * Render the virtual element for a command palette header.\n *\n * @param data - The data to use for rendering the header.\n *\n * @returns A virtual element representing the header.\n */\n renderHeader(data: IHeaderRenderData): VirtualElement {\n let content = this.formatHeader(data);\n return h.li({ className: 'lm-CommandPalette-header' }, content);\n }\n\n /**\n * Render the virtual element for a command palette item.\n *\n * @param data - The data to use for rendering the item.\n *\n * @returns A virtual element representing the item.\n */\n renderItem(data: IItemRenderData): VirtualElement {\n let className = this.createItemClass(data);\n let dataset = this.createItemDataset(data);\n if (data.item.isToggleable) {\n return h.li(\n {\n className,\n dataset,\n role: 'menuitemcheckbox',\n 'aria-checked': `${data.item.isToggled}`\n },\n this.renderItemIcon(data),\n this.renderItemContent(data),\n this.renderItemShortcut(data)\n );\n }\n return h.li(\n {\n className,\n dataset,\n role: 'menuitem'\n },\n this.renderItemIcon(data),\n this.renderItemContent(data),\n this.renderItemShortcut(data)\n );\n }\n\n /**\n * Render the empty results message for a command palette.\n *\n * @param data - The data to use for rendering the message.\n *\n * @returns A virtual element representing the message.\n */\n renderEmptyMessage(data: IEmptyMessageRenderData): VirtualElement {\n let content = this.formatEmptyMessage(data);\n return h.li({ className: 'lm-CommandPalette-emptyMessage' }, content);\n }\n\n /**\n * Render the icon for a command palette item.\n *\n * @param data - The data to use for rendering the icon.\n *\n * @returns A virtual element representing the icon.\n */\n renderItemIcon(data: IItemRenderData): VirtualElement {\n let className = this.createIconClass(data);\n\n // If data.item.icon is undefined, it will be ignored.\n return h.div({ className }, data.item.icon!, data.item.iconLabel);\n }\n\n /**\n * Render the content for a command palette item.\n *\n * @param data - The data to use for rendering the content.\n *\n * @returns A virtual element representing the content.\n */\n renderItemContent(data: IItemRenderData): VirtualElement {\n return h.div(\n { className: 'lm-CommandPalette-itemContent' },\n this.renderItemLabel(data),\n this.renderItemCaption(data)\n );\n }\n\n /**\n * Render the label for a command palette item.\n *\n * @param data - The data to use for rendering the label.\n *\n * @returns A virtual element representing the label.\n */\n renderItemLabel(data: IItemRenderData): VirtualElement {\n let content = this.formatItemLabel(data);\n return h.div({ className: 'lm-CommandPalette-itemLabel' }, content);\n }\n\n /**\n * Render the caption for a command palette item.\n *\n * @param data - The data to use for rendering the caption.\n *\n * @returns A virtual element representing the caption.\n */\n renderItemCaption(data: IItemRenderData): VirtualElement {\n let content = this.formatItemCaption(data);\n return h.div({ className: 'lm-CommandPalette-itemCaption' }, content);\n }\n\n /**\n * Render the shortcut for a command palette item.\n *\n * @param data - The data to use for rendering the shortcut.\n *\n * @returns A virtual element representing the shortcut.\n */\n renderItemShortcut(data: IItemRenderData): VirtualElement {\n let content = this.formatItemShortcut(data);\n return h.div({ className: 'lm-CommandPalette-itemShortcut' }, content);\n }\n\n /**\n * Create the class name for the command palette item.\n *\n * @param data - The data to use for the class name.\n *\n * @returns The full class name for the command palette item.\n */\n createItemClass(data: IItemRenderData): string {\n // Set up the initial class name.\n let name = 'lm-CommandPalette-item';\n\n // Add the boolean state classes.\n if (!data.item.isEnabled) {\n name += ' lm-mod-disabled';\n }\n if (data.item.isToggled) {\n name += ' lm-mod-toggled';\n }\n if (data.active) {\n name += ' lm-mod-active';\n }\n\n // Add the extra class.\n let extra = data.item.className;\n if (extra) {\n name += ` ${extra}`;\n }\n\n // Return the complete class name.\n return name;\n }\n\n /**\n * Create the dataset for the command palette item.\n *\n * @param data - The data to use for creating the dataset.\n *\n * @returns The dataset for the command palette item.\n */\n createItemDataset(data: IItemRenderData): ElementDataset {\n return { ...data.item.dataset, command: data.item.command };\n }\n\n /**\n * Create the class name for the command item icon.\n *\n * @param data - The data to use for the class name.\n *\n * @returns The full class name for the item icon.\n */\n createIconClass(data: IItemRenderData): string {\n let name = 'lm-CommandPalette-itemIcon';\n let extra = data.item.iconClass;\n return extra ? `${name} ${extra}` : name;\n }\n\n /**\n * Create the render content for the header node.\n *\n * @param data - The data to use for the header content.\n *\n * @returns The content to add to the header node.\n */\n formatHeader(data: IHeaderRenderData): h.Child {\n if (!data.indices || data.indices.length === 0) {\n return data.category;\n }\n return StringExt.highlight(data.category, data.indices, h.mark);\n }\n\n /**\n * Create the render content for the empty message node.\n *\n * @param data - The data to use for the empty message content.\n *\n * @returns The content to add to the empty message node.\n */\n formatEmptyMessage(data: IEmptyMessageRenderData): h.Child {\n return `No commands found that match '${data.query}'`;\n }\n\n /**\n * Create the render content for the item shortcut node.\n *\n * @param data - The data to use for the shortcut content.\n *\n * @returns The content to add to the shortcut node.\n */\n formatItemShortcut(data: IItemRenderData): h.Child {\n let kb = data.item.keyBinding;\n return kb ? CommandRegistry.formatKeystroke(kb.keys) : null;\n }\n\n /**\n * Create the render content for the item label node.\n *\n * @param data - The data to use for the label content.\n *\n * @returns The content to add to the label node.\n */\n formatItemLabel(data: IItemRenderData): h.Child {\n if (!data.indices || data.indices.length === 0) {\n return data.item.label;\n }\n return StringExt.highlight(data.item.label, data.indices, h.mark);\n }\n\n /**\n * Create the render content for the item caption node.\n *\n * @param data - The data to use for the caption content.\n *\n * @returns The content to add to the caption node.\n */\n formatItemCaption(data: IItemRenderData): h.Child {\n return data.item.caption;\n }\n }\n\n /**\n * The default `Renderer` instance.\n */\n export const defaultRenderer = new Renderer();\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * Create the DOM node for a command palette.\n */\n export function createNode(): HTMLDivElement {\n let node = document.createElement('div');\n let search = document.createElement('div');\n let wrapper = document.createElement('div');\n let input = document.createElement('input');\n let content = document.createElement('ul');\n let clear = document.createElement('button');\n search.className = 'lm-CommandPalette-search';\n wrapper.className = 'lm-CommandPalette-wrapper';\n input.className = 'lm-CommandPalette-input';\n clear.className = 'lm-close-icon';\n\n content.className = 'lm-CommandPalette-content';\n content.setAttribute('role', 'menu');\n input.spellcheck = false;\n wrapper.appendChild(input);\n wrapper.appendChild(clear);\n search.appendChild(wrapper);\n node.appendChild(search);\n node.appendChild(content);\n return node;\n }\n\n /**\n * Create a new command item from a command registry and options.\n */\n export function createItem(\n commands: CommandRegistry,\n options: CommandPalette.IItemOptions\n ): CommandPalette.IItem {\n return new CommandItem(commands, options);\n }\n\n /**\n * A search result object for a header label.\n */\n export interface IHeaderResult {\n /**\n * The discriminated type of the object.\n */\n readonly type: 'header';\n\n /**\n * The category for the header.\n */\n readonly category: string;\n\n /**\n * The indices of the matched category characters.\n */\n readonly indices: ReadonlyArray | null;\n }\n\n /**\n * A search result object for a command item.\n */\n export interface IItemResult {\n /**\n * The discriminated type of the object.\n */\n readonly type: 'item';\n\n /**\n * The command item which was matched.\n */\n readonly item: CommandPalette.IItem;\n\n /**\n * The indices of the matched label characters.\n */\n readonly indices: ReadonlyArray | null;\n }\n\n /**\n * A type alias for a search result item.\n */\n export type SearchResult = IHeaderResult | IItemResult;\n\n /**\n * Search an array of command items for fuzzy matches.\n */\n export function search(\n items: CommandPalette.IItem[],\n query: string\n ): SearchResult[] {\n // Fuzzy match the items for the query.\n let scores = matchItems(items, query);\n\n // Sort the items based on their score.\n scores.sort(scoreCmp);\n\n // Create the results for the search.\n return createResults(scores);\n }\n\n /**\n * Test whether a result item can be activated.\n */\n export function canActivate(result: SearchResult): boolean {\n return result.type === 'item' && result.item.isEnabled;\n }\n\n /**\n * Normalize a category for a command item.\n */\n function normalizeCategory(category: string): string {\n return category.trim().replace(/\\s+/g, ' ');\n }\n\n /**\n * Normalize the query text for a fuzzy search.\n */\n function normalizeQuery(text: string): string {\n return text.replace(/\\s+/g, '').toLowerCase();\n }\n\n /**\n * An enum of the supported match types.\n */\n const enum MatchType {\n Label,\n Category,\n Split,\n Default\n }\n\n /**\n * A text match score with associated command item.\n */\n interface IScore {\n /**\n * The numerical type for the text match.\n */\n matchType: MatchType;\n\n /**\n * The numerical score for the text match.\n */\n score: number;\n\n /**\n * The indices of the matched category characters.\n */\n categoryIndices: number[] | null;\n\n /**\n * The indices of the matched label characters.\n */\n labelIndices: number[] | null;\n\n /**\n * The command item associated with the match.\n */\n item: CommandPalette.IItem;\n }\n\n /**\n * Perform a fuzzy match on an array of command items.\n */\n function matchItems(items: CommandPalette.IItem[], query: string): IScore[] {\n // Normalize the query text to lower case with no whitespace.\n query = normalizeQuery(query);\n\n // Create the array to hold the scores.\n let scores: IScore[] = [];\n\n // Iterate over the items and match against the query.\n for (let i = 0, n = items.length; i < n; ++i) {\n // Ignore items which are not visible.\n let item = items[i];\n if (!item.isVisible) {\n continue;\n }\n\n // If the query is empty, all items are matched by default.\n if (!query) {\n scores.push({\n matchType: MatchType.Default,\n categoryIndices: null,\n labelIndices: null,\n score: 0,\n item\n });\n continue;\n }\n\n // Run the fuzzy search for the item and query.\n let score = fuzzySearch(item, query);\n\n // Ignore the item if it is not a match.\n if (!score) {\n continue;\n }\n\n // Penalize disabled items.\n // TODO - push disabled items all the way down in sort cmp?\n if (!item.isEnabled) {\n score.score += 1000;\n }\n\n // Add the score to the results.\n scores.push(score);\n }\n\n // Return the final array of scores.\n return scores;\n }\n\n /**\n * Perform a fuzzy search on a single command item.\n */\n function fuzzySearch(\n item: CommandPalette.IItem,\n query: string\n ): IScore | null {\n // Create the source text to be searched.\n let category = item.category.toLowerCase();\n let label = item.label.toLowerCase();\n let source = `${category} ${label}`;\n\n // Set up the match score and indices array.\n let score = Infinity;\n let indices: number[] | null = null;\n\n // The regex for search word boundaries\n let rgx = /\\b\\w/g;\n\n // Search the source by word boundary.\n // eslint-disable-next-line no-constant-condition\n while (true) {\n // Find the next word boundary in the source.\n let rgxMatch = rgx.exec(source);\n\n // Break if there is no more source context.\n if (!rgxMatch) {\n break;\n }\n\n // Run the string match on the relevant substring.\n let match = StringExt.matchSumOfDeltas(source, query, rgxMatch.index);\n\n // Break if there is no match.\n if (!match) {\n break;\n }\n\n // Update the match if the score is better.\n if (match.score <= score) {\n score = match.score;\n indices = match.indices;\n }\n }\n\n // Bail if there was no match.\n if (!indices || score === Infinity) {\n return null;\n }\n\n // Compute the pivot index between category and label text.\n let pivot = category.length + 1;\n\n // Find the slice index to separate matched indices.\n let j = ArrayExt.lowerBound(indices, pivot, (a, b) => a - b);\n\n // Extract the matched category and label indices.\n let categoryIndices = indices.slice(0, j);\n let labelIndices = indices.slice(j);\n\n // Adjust the label indices for the pivot offset.\n for (let i = 0, n = labelIndices.length; i < n; ++i) {\n labelIndices[i] -= pivot;\n }\n\n // Handle a pure label match.\n if (categoryIndices.length === 0) {\n return {\n matchType: MatchType.Label,\n categoryIndices: null,\n labelIndices,\n score,\n item\n };\n }\n\n // Handle a pure category match.\n if (labelIndices.length === 0) {\n return {\n matchType: MatchType.Category,\n categoryIndices,\n labelIndices: null,\n score,\n item\n };\n }\n\n // Handle a split match.\n return {\n matchType: MatchType.Split,\n categoryIndices,\n labelIndices,\n score,\n item\n };\n }\n\n /**\n * A sort comparison function for a match score.\n */\n function scoreCmp(a: IScore, b: IScore): number {\n // First compare based on the match type\n let m1 = a.matchType - b.matchType;\n if (m1 !== 0) {\n return m1;\n }\n\n // Otherwise, compare based on the match score.\n let d1 = a.score - b.score;\n if (d1 !== 0) {\n return d1;\n }\n\n // Find the match index based on the match type.\n let i1 = 0;\n let i2 = 0;\n switch (a.matchType) {\n case MatchType.Label:\n i1 = a.labelIndices![0];\n i2 = b.labelIndices![0];\n break;\n case MatchType.Category:\n case MatchType.Split:\n i1 = a.categoryIndices![0];\n i2 = b.categoryIndices![0];\n break;\n }\n\n // Compare based on the match index.\n if (i1 !== i2) {\n return i1 - i2;\n }\n\n // Otherwise, compare by category.\n let d2 = a.item.category.localeCompare(b.item.category);\n if (d2 !== 0) {\n return d2;\n }\n\n // Otherwise, compare by rank.\n let r1 = a.item.rank;\n let r2 = b.item.rank;\n if (r1 !== r2) {\n return r1 < r2 ? -1 : 1; // Infinity safe\n }\n\n // Finally, compare by label.\n return a.item.label.localeCompare(b.item.label);\n }\n\n /**\n * Create the results from an array of sorted scores.\n */\n function createResults(scores: IScore[]): SearchResult[] {\n // Set up the search results array.\n let results: SearchResult[] = [];\n\n // Iterate over each score in the array.\n for (let i = 0, n = scores.length; i < n; ++i) {\n // Extract the current item and indices.\n let { item, categoryIndices, labelIndices } = scores[i];\n\n // Extract the category for the current item.\n let category = item.category;\n\n // Is this the same category as the preceding result?\n if (i === 0 || category !== scores[i - 1].item.category) {\n // Add the header result for the category.\n results.push({ type: 'header', category, indices: categoryIndices });\n }\n\n // Create the item result for the score.\n results.push({ type: 'item', item, indices: labelIndices });\n }\n\n // Return the final results.\n return results;\n }\n\n /**\n * A concrete implementation of `CommandPalette.IItem`.\n */\n class CommandItem implements CommandPalette.IItem {\n /**\n * Construct a new command item.\n */\n constructor(\n commands: CommandRegistry,\n options: CommandPalette.IItemOptions\n ) {\n this._commands = commands;\n this.category = normalizeCategory(options.category);\n this.command = options.command;\n this.args = options.args || JSONExt.emptyObject;\n this.rank = options.rank !== undefined ? options.rank : Infinity;\n }\n\n /**\n * The category for the command item.\n */\n readonly category: string;\n\n /**\n * The command to execute when the item is triggered.\n */\n readonly command: string;\n\n /**\n * The arguments for the command.\n */\n readonly args: ReadonlyJSONObject;\n\n /**\n * The rank for the command item.\n */\n readonly rank: number;\n\n /**\n * The display label for the command item.\n */\n get label(): string {\n return this._commands.label(this.command, this.args);\n }\n\n /**\n * The icon renderer for the command item.\n */\n get icon(): VirtualElement.IRenderer | undefined {\n return this._commands.icon(this.command, this.args);\n }\n\n /**\n * The icon class for the command item.\n */\n get iconClass(): string {\n return this._commands.iconClass(this.command, this.args);\n }\n\n /**\n * The icon label for the command item.\n */\n get iconLabel(): string {\n return this._commands.iconLabel(this.command, this.args);\n }\n\n /**\n * The display caption for the command item.\n */\n get caption(): string {\n return this._commands.caption(this.command, this.args);\n }\n\n /**\n * The extra class name for the command item.\n */\n get className(): string {\n return this._commands.className(this.command, this.args);\n }\n\n /**\n * The dataset for the command item.\n */\n get dataset(): CommandRegistry.Dataset {\n return this._commands.dataset(this.command, this.args);\n }\n\n /**\n * Whether the command item is enabled.\n */\n get isEnabled(): boolean {\n return this._commands.isEnabled(this.command, this.args);\n }\n\n /**\n * Whether the command item is toggled.\n */\n get isToggled(): boolean {\n return this._commands.isToggled(this.command, this.args);\n }\n\n /**\n * Whether the command item is toggleable.\n */\n get isToggleable(): boolean {\n return this._commands.isToggleable(this.command, this.args);\n }\n\n /**\n * Whether the command item is visible.\n */\n get isVisible(): boolean {\n return this._commands.isVisible(this.command, this.args);\n }\n\n /**\n * The key binding for the command item.\n */\n get keyBinding(): CommandRegistry.IKeyBinding | null {\n let { command, args } = this;\n return (\n ArrayExt.findLastValue(this._commands.keyBindings, kb => {\n return kb.command === command && JSONExt.deepEqual(kb.args, args);\n }) || null\n );\n }\n\n private _commands: CommandRegistry;\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { CommandRegistry } from '@lumino/commands';\n\nimport { JSONExt, ReadonlyJSONObject } from '@lumino/coreutils';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { getKeyboardLayout } from '@lumino/keyboard';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport {\n ARIAAttrNames,\n ElementARIAAttrs,\n ElementDataset,\n h,\n VirtualDOM,\n VirtualElement\n} from '@lumino/virtualdom';\n\nimport { Widget } from './widget';\n\ninterface IWindowData {\n pageXOffset: number;\n pageYOffset: number;\n clientWidth: number;\n clientHeight: number;\n}\n\n/**\n * A widget which displays items as a canonical menu.\n */\nexport class Menu extends Widget {\n /**\n * Construct a new menu.\n *\n * @param options - The options for initializing the menu.\n */\n constructor(options: Menu.IOptions) {\n super({ node: Private.createNode() });\n this.addClass('lm-Menu');\n this.setFlag(Widget.Flag.DisallowLayout);\n this.commands = options.commands;\n this.renderer = options.renderer || Menu.defaultRenderer;\n }\n\n /**\n * Dispose of the resources held by the menu.\n */\n dispose(): void {\n this.close();\n this._items.length = 0;\n super.dispose();\n }\n\n /**\n * A signal emitted just before the menu is closed.\n *\n * #### Notes\n * This signal is emitted when the menu receives a `'close-request'`\n * message, just before it removes itself from the DOM.\n *\n * This signal is not emitted if the menu is already detached from\n * the DOM when it receives the `'close-request'` message.\n */\n get aboutToClose(): ISignal {\n return this._aboutToClose;\n }\n\n /**\n * A signal emitted when a new menu is requested by the user.\n *\n * #### Notes\n * This signal is emitted whenever the user presses the right or left\n * arrow keys, and a submenu cannot be opened or closed in response.\n *\n * This signal is useful when implementing menu bars in order to open\n * the next or previous menu in response to a user key press.\n *\n * This signal is only emitted for the root menu in a hierarchy.\n */\n get menuRequested(): ISignal {\n return this._menuRequested;\n }\n\n /**\n * The command registry used by the menu.\n */\n readonly commands: CommandRegistry;\n\n /**\n * The renderer used by the menu.\n */\n readonly renderer: Menu.IRenderer;\n\n /**\n * The parent menu of the menu.\n *\n * #### Notes\n * This is `null` unless the menu is an open submenu.\n */\n get parentMenu(): Menu | null {\n return this._parentMenu;\n }\n\n /**\n * The child menu of the menu.\n *\n * #### Notes\n * This is `null` unless the menu has an open submenu.\n */\n get childMenu(): Menu | null {\n return this._childMenu;\n }\n\n /**\n * The root menu of the menu hierarchy.\n */\n get rootMenu(): Menu {\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n let menu: Menu = this;\n while (menu._parentMenu) {\n menu = menu._parentMenu;\n }\n return menu;\n }\n\n /**\n * The leaf menu of the menu hierarchy.\n */\n get leafMenu(): Menu {\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n let menu: Menu = this;\n while (menu._childMenu) {\n menu = menu._childMenu;\n }\n return menu;\n }\n\n /**\n * The menu content node.\n *\n * #### Notes\n * This is the node which holds the menu item nodes.\n *\n * Modifying this node directly can lead to undefined behavior.\n */\n get contentNode(): HTMLUListElement {\n return this.node.getElementsByClassName(\n 'lm-Menu-content'\n )[0] as HTMLUListElement;\n }\n\n /**\n * Get the currently active menu item.\n */\n get activeItem(): Menu.IItem | null {\n return this._items[this._activeIndex] || null;\n }\n\n /**\n * Set the currently active menu item.\n *\n * #### Notes\n * If the item cannot be activated, the item will be set to `null`.\n */\n set activeItem(value: Menu.IItem | null) {\n this.activeIndex = value ? this._items.indexOf(value) : -1;\n }\n\n /**\n * Get the index of the currently active menu item.\n *\n * #### Notes\n * This will be `-1` if no menu item is active.\n */\n get activeIndex(): number {\n return this._activeIndex;\n }\n\n /**\n * Set the index of the currently active menu item.\n *\n * #### Notes\n * If the item cannot be activated, the index will be set to `-1`.\n */\n set activeIndex(value: number) {\n // Adjust the value for an out of range index.\n if (value < 0 || value >= this._items.length) {\n value = -1;\n }\n\n // Ensure the item can be activated.\n if (value !== -1 && !Private.canActivate(this._items[value])) {\n value = -1;\n }\n\n // Bail if the index will not change.\n if (this._activeIndex === value) {\n return;\n }\n\n // Update the active index.\n this._activeIndex = value;\n\n // Make active element in focus\n if (\n this._activeIndex >= 0 &&\n this.contentNode.childNodes[this._activeIndex]\n ) {\n (this.contentNode.childNodes[this._activeIndex] as HTMLElement).focus();\n }\n\n // schedule an update of the items.\n this.update();\n }\n\n /**\n * A read-only array of the menu items in the menu.\n */\n get items(): ReadonlyArray {\n return this._items;\n }\n\n /**\n * Activate the next selectable item in the menu.\n *\n * #### Notes\n * If no item is selectable, the index will be set to `-1`.\n */\n activateNextItem(): void {\n let n = this._items.length;\n let ai = this._activeIndex;\n let start = ai < n - 1 ? ai + 1 : 0;\n let stop = start === 0 ? n - 1 : start - 1;\n this.activeIndex = ArrayExt.findFirstIndex(\n this._items,\n Private.canActivate,\n start,\n stop\n );\n }\n\n /**\n * Activate the previous selectable item in the menu.\n *\n * #### Notes\n * If no item is selectable, the index will be set to `-1`.\n */\n activatePreviousItem(): void {\n let n = this._items.length;\n let ai = this._activeIndex;\n let start = ai <= 0 ? n - 1 : ai - 1;\n let stop = start === n - 1 ? 0 : start + 1;\n this.activeIndex = ArrayExt.findLastIndex(\n this._items,\n Private.canActivate,\n start,\n stop\n );\n }\n\n /**\n * Trigger the active menu item.\n *\n * #### Notes\n * If the active item is a submenu, it will be opened and the first\n * item will be activated.\n *\n * If the active item is a command, the command will be executed.\n *\n * If the menu is not attached, this is a no-op.\n *\n * If there is no active item, this is a no-op.\n */\n triggerActiveItem(): void {\n // Bail if the menu is not attached.\n if (!this.isAttached) {\n return;\n }\n\n // Bail if there is no active item.\n let item = this.activeItem;\n if (!item) {\n return;\n }\n\n // Cancel the pending timers.\n this._cancelOpenTimer();\n this._cancelCloseTimer();\n\n // If the item is a submenu, open it.\n if (item.type === 'submenu') {\n this._openChildMenu(true);\n return;\n }\n\n // Close the root menu before executing the command.\n this.rootMenu.close();\n\n // Execute the command for the item.\n let { command, args } = item;\n if (this.commands.isEnabled(command, args)) {\n this.commands.execute(command, args);\n } else {\n console.log(`Command '${command}' is disabled.`);\n }\n }\n\n /**\n * Add a menu item to the end of the menu.\n *\n * @param options - The options for creating the menu item.\n *\n * @returns The menu item added to the menu.\n */\n addItem(options: Menu.IItemOptions): Menu.IItem {\n return this.insertItem(this._items.length, options);\n }\n\n /**\n * Insert a menu item into the menu at the specified index.\n *\n * @param index - The index at which to insert the item.\n *\n * @param options - The options for creating the menu item.\n *\n * @returns The menu item added to the menu.\n *\n * #### Notes\n * The index will be clamped to the bounds of the items.\n */\n insertItem(index: number, options: Menu.IItemOptions): Menu.IItem {\n // Close the menu if it's attached.\n if (this.isAttached) {\n this.close();\n }\n\n // Reset the active index.\n this.activeIndex = -1;\n\n // Clamp the insert index to the array bounds.\n let i = Math.max(0, Math.min(index, this._items.length));\n\n // Create the item for the options.\n let item = Private.createItem(this, options);\n\n // Insert the item into the array.\n ArrayExt.insert(this._items, i, item);\n\n // Schedule an update of the items.\n this.update();\n\n // Return the item added to the menu.\n return item;\n }\n\n /**\n * Remove an item from the menu.\n *\n * @param item - The item to remove from the menu.\n *\n * #### Notes\n * This is a no-op if the item is not in the menu.\n */\n removeItem(item: Menu.IItem): void {\n this.removeItemAt(this._items.indexOf(item));\n }\n\n /**\n * Remove the item at a given index from the menu.\n *\n * @param index - The index of the item to remove.\n *\n * #### Notes\n * This is a no-op if the index is out of range.\n */\n removeItemAt(index: number): void {\n // Close the menu if it's attached.\n if (this.isAttached) {\n this.close();\n }\n\n // Reset the active index.\n this.activeIndex = -1;\n\n // Remove the item from the array.\n let item = ArrayExt.removeAt(this._items, index);\n\n // Bail if the index is out of range.\n if (!item) {\n return;\n }\n\n // Schedule an update of the items.\n this.update();\n }\n\n /**\n * Remove all menu items from the menu.\n */\n clearItems(): void {\n // Close the menu if it's attached.\n if (this.isAttached) {\n this.close();\n }\n\n // Reset the active index.\n this.activeIndex = -1;\n\n // Bail if there is nothing to remove.\n if (this._items.length === 0) {\n return;\n }\n\n // Clear the items.\n this._items.length = 0;\n\n // Schedule an update of the items.\n this.update();\n }\n\n /**\n * Open the menu at the specified location.\n *\n * @param x - The client X coordinate of the menu location.\n *\n * @param y - The client Y coordinate of the menu location.\n *\n * @param options - The additional options for opening the menu.\n *\n * #### Notes\n * The menu will be opened at the given location unless it will not\n * fully fit on the screen. If it will not fit, it will be adjusted\n * to fit naturally on the screen.\n *\n * The menu will be attached under the `host` element in the DOM\n * (or `document.body` if `host` is `null`) and before the `ref`\n * element (or as the last child of `host` if `ref` is `null`).\n * The menu may be displayed outside of the `host` element\n * following the rules of CSS absolute positioning.\n *\n * This is a no-op if the menu is already attached to the DOM.\n */\n open(x: number, y: number, options: Menu.IOpenOptions = {}): void {\n // Bail early if the menu is already attached.\n if (this.isAttached) {\n return;\n }\n\n // Extract the menu options.\n let forceX = options.forceX || false;\n let forceY = options.forceY || false;\n const host = options.host ?? null;\n const ref = options.ref ?? null;\n const horizontalAlignment =\n options.horizontalAlignment ??\n (document.documentElement.dir === 'rtl' ? 'right' : 'left');\n\n // Open the menu as a root menu.\n Private.openRootMenu(\n this,\n x,\n y,\n forceX,\n forceY,\n horizontalAlignment,\n host,\n ref\n );\n\n // Activate the menu to accept keyboard input.\n this.activate();\n }\n\n /**\n * Handle the DOM events for the menu.\n *\n * @param event - The DOM event sent to the menu.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the menu's DOM nodes. It should\n * not be called directly by user code.\n */\n handleEvent(event: Event): void {\n switch (event.type) {\n case 'keydown':\n this._evtKeyDown(event as KeyboardEvent);\n break;\n case 'mouseup':\n this._evtMouseUp(event as MouseEvent);\n break;\n case 'mousemove':\n this._evtMouseMove(event as MouseEvent);\n break;\n case 'mouseenter':\n this._evtMouseEnter(event as MouseEvent);\n break;\n case 'mouseleave':\n this._evtMouseLeave(event as MouseEvent);\n break;\n case 'mousedown':\n this._evtMouseDown(event as MouseEvent);\n break;\n case 'contextmenu':\n event.preventDefault();\n event.stopPropagation();\n break;\n }\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n this.node.addEventListener('keydown', this);\n this.node.addEventListener('mouseup', this);\n this.node.addEventListener('mousemove', this);\n this.node.addEventListener('mouseenter', this);\n this.node.addEventListener('mouseleave', this);\n this.node.addEventListener('contextmenu', this);\n document.addEventListener('mousedown', this, true);\n }\n\n /**\n * A message handler invoked on an `'after-detach'` message.\n */\n protected onAfterDetach(msg: Message): void {\n this.node.removeEventListener('keydown', this);\n this.node.removeEventListener('mouseup', this);\n this.node.removeEventListener('mousemove', this);\n this.node.removeEventListener('mouseenter', this);\n this.node.removeEventListener('mouseleave', this);\n this.node.removeEventListener('contextmenu', this);\n document.removeEventListener('mousedown', this, true);\n }\n\n /**\n * A message handler invoked on an `'activate-request'` message.\n */\n protected onActivateRequest(msg: Message): void {\n if (this.isAttached) {\n this.node.focus();\n }\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n protected onUpdateRequest(msg: Message): void {\n let items = this._items;\n let renderer = this.renderer;\n let activeIndex = this._activeIndex;\n let collapsedFlags = Private.computeCollapsed(items);\n let content = new Array(items.length);\n for (let i = 0, n = items.length; i < n; ++i) {\n let item = items[i];\n let active = i === activeIndex;\n let collapsed = collapsedFlags[i];\n content[i] = renderer.renderItem({\n item,\n active,\n collapsed,\n onfocus: () => {\n this.activeIndex = i;\n }\n });\n }\n VirtualDOM.render(content, this.contentNode);\n }\n\n /**\n * A message handler invoked on a `'close-request'` message.\n */\n protected onCloseRequest(msg: Message): void {\n // Cancel the pending timers.\n this._cancelOpenTimer();\n this._cancelCloseTimer();\n\n // Reset the active index.\n this.activeIndex = -1;\n\n // Close any open child menu.\n let childMenu = this._childMenu;\n if (childMenu) {\n this._childIndex = -1;\n this._childMenu = null;\n childMenu._parentMenu = null;\n childMenu.close();\n }\n\n // Remove this menu from its parent and activate the parent.\n let parentMenu = this._parentMenu;\n if (parentMenu) {\n this._parentMenu = null;\n parentMenu._childIndex = -1;\n parentMenu._childMenu = null;\n parentMenu.activate();\n }\n\n // Emit the `aboutToClose` signal if the menu is attached.\n if (this.isAttached) {\n this._aboutToClose.emit(undefined);\n }\n\n // Finish closing the menu.\n super.onCloseRequest(msg);\n }\n\n /**\n * Handle the `'keydown'` event for the menu.\n *\n * #### Notes\n * This listener is attached to the menu node.\n */\n private _evtKeyDown(event: KeyboardEvent): void {\n // A menu handles all keydown events.\n event.preventDefault();\n event.stopPropagation();\n\n // Fetch the key code for the event.\n let kc = event.keyCode;\n\n // Enter\n if (kc === 13) {\n this.triggerActiveItem();\n return;\n }\n\n // Escape\n if (kc === 27) {\n this.close();\n return;\n }\n\n // Left Arrow\n if (kc === 37) {\n if (this._parentMenu) {\n this.close();\n } else {\n this._menuRequested.emit('previous');\n }\n return;\n }\n\n // Up Arrow\n if (kc === 38) {\n this.activatePreviousItem();\n return;\n }\n\n // Right Arrow\n if (kc === 39) {\n let item = this.activeItem;\n if (item && item.type === 'submenu') {\n this.triggerActiveItem();\n } else {\n this.rootMenu._menuRequested.emit('next');\n }\n return;\n }\n\n // Down Arrow\n if (kc === 40) {\n this.activateNextItem();\n return;\n }\n\n // Get the pressed key character.\n let key = getKeyboardLayout().keyForKeydownEvent(event);\n\n // Bail if the key is not valid.\n if (!key) {\n return;\n }\n\n // Search for the next best matching mnemonic item.\n let start = this._activeIndex + 1;\n let result = Private.findMnemonic(this._items, key, start);\n\n // Handle the requested mnemonic based on the search results.\n // If exactly one mnemonic is matched, that item is triggered.\n // Otherwise, the next mnemonic is activated if available,\n // followed by the auto mnemonic if available.\n if (result.index !== -1 && !result.multiple) {\n this.activeIndex = result.index;\n this.triggerActiveItem();\n } else if (result.index !== -1) {\n this.activeIndex = result.index;\n } else if (result.auto !== -1) {\n this.activeIndex = result.auto;\n }\n }\n\n /**\n * Handle the `'mouseup'` event for the menu.\n *\n * #### Notes\n * This listener is attached to the menu node.\n */\n private _evtMouseUp(event: MouseEvent): void {\n if (event.button !== 0) {\n return;\n }\n event.preventDefault();\n event.stopPropagation();\n this.triggerActiveItem();\n }\n\n /**\n * Handle the `'mousemove'` event for the menu.\n *\n * #### Notes\n * This listener is attached to the menu node.\n */\n private _evtMouseMove(event: MouseEvent): void {\n // Hit test the item nodes for the item under the mouse.\n let index = ArrayExt.findFirstIndex(this.contentNode.children, node => {\n return ElementExt.hitTest(node, event.clientX, event.clientY);\n });\n\n // Bail early if the mouse is already over the active index.\n if (index === this._activeIndex) {\n return;\n }\n\n // Update and coerce the active index.\n this.activeIndex = index;\n index = this.activeIndex;\n\n // If the index is the current child index, cancel the timers.\n if (index === this._childIndex) {\n this._cancelOpenTimer();\n this._cancelCloseTimer();\n return;\n }\n\n // If a child menu is currently open, start the close timer.\n if (this._childIndex !== -1) {\n this._startCloseTimer();\n }\n\n // Cancel the open timer to give a full delay for opening.\n this._cancelOpenTimer();\n\n // Bail if the active item is not a valid submenu item.\n let item = this.activeItem;\n if (!item || item.type !== 'submenu' || !item.submenu) {\n return;\n }\n\n // Start the open timer to open the active item submenu.\n this._startOpenTimer();\n }\n\n /**\n * Handle the `'mouseenter'` event for the menu.\n *\n * #### Notes\n * This listener is attached to the menu node.\n */\n private _evtMouseEnter(event: MouseEvent): void {\n // Synchronize the active ancestor items.\n for (let menu = this._parentMenu; menu; menu = menu._parentMenu) {\n menu._cancelOpenTimer();\n menu._cancelCloseTimer();\n menu.activeIndex = menu._childIndex;\n }\n }\n\n /**\n * Handle the `'mouseleave'` event for the menu.\n *\n * #### Notes\n * This listener is attached to the menu node.\n */\n private _evtMouseLeave(event: MouseEvent): void {\n // Cancel any pending submenu opening.\n this._cancelOpenTimer();\n\n // If there is no open child menu, just reset the active index.\n if (!this._childMenu) {\n this.activeIndex = -1;\n return;\n }\n\n // If the mouse is over the child menu, cancel the close timer.\n let { clientX, clientY } = event;\n if (ElementExt.hitTest(this._childMenu.node, clientX, clientY)) {\n this._cancelCloseTimer();\n return;\n }\n\n // Otherwise, reset the active index and start the close timer.\n this.activeIndex = -1;\n this._startCloseTimer();\n }\n\n /**\n * Handle the `'mousedown'` event for the menu.\n *\n * #### Notes\n * This listener is attached to the document node.\n */\n private _evtMouseDown(event: MouseEvent): void {\n // Bail if the menu is not a root menu.\n if (this._parentMenu) {\n return;\n }\n\n // The mouse button which is pressed is irrelevant. If the press\n // is not on a menu, the entire hierarchy is closed and the event\n // is allowed to propagate. This allows other code to act on the\n // event, such as focusing the clicked element.\n if (Private.hitTestMenus(this, event.clientX, event.clientY)) {\n event.preventDefault();\n event.stopPropagation();\n } else {\n this.close();\n }\n }\n\n /**\n * Open the child menu at the active index immediately.\n *\n * If a different child menu is already open, it will be closed,\n * even if the active item is not a valid submenu.\n */\n private _openChildMenu(activateFirst = false): void {\n // If the item is not a valid submenu, close the child menu.\n let item = this.activeItem;\n if (!item || item.type !== 'submenu' || !item.submenu) {\n this._closeChildMenu();\n return;\n }\n\n // Do nothing if the child menu will not change.\n let submenu = item.submenu;\n if (submenu === this._childMenu) {\n return;\n }\n\n // Prior to any DOM modifications save window data\n Menu.saveWindowData();\n\n // Ensure the current child menu is closed.\n this._closeChildMenu();\n\n // Update the private child state.\n this._childMenu = submenu;\n this._childIndex = this._activeIndex;\n\n // Set the parent menu reference for the child.\n submenu._parentMenu = this;\n\n // Ensure the menu is updated and lookup the item node.\n MessageLoop.sendMessage(this, Widget.Msg.UpdateRequest);\n let itemNode = this.contentNode.children[this._activeIndex];\n\n // Open the submenu at the active node.\n Private.openSubmenu(submenu, itemNode as HTMLElement);\n\n // Activate the first item if desired.\n if (activateFirst) {\n submenu.activeIndex = -1;\n submenu.activateNextItem();\n }\n\n // Activate the child menu.\n submenu.activate();\n }\n\n /**\n * Close the child menu immediately.\n *\n * This is a no-op if a child menu is not open.\n */\n private _closeChildMenu(): void {\n if (this._childMenu) {\n this._childMenu.close();\n }\n }\n\n /**\n * Start the open timer, unless it is already pending.\n */\n private _startOpenTimer(): void {\n if (this._openTimerID === 0) {\n this._openTimerID = window.setTimeout(() => {\n this._openTimerID = 0;\n this._openChildMenu();\n }, Private.TIMER_DELAY);\n }\n }\n\n /**\n * Start the close timer, unless it is already pending.\n */\n private _startCloseTimer(): void {\n if (this._closeTimerID === 0) {\n this._closeTimerID = window.setTimeout(() => {\n this._closeTimerID = 0;\n this._closeChildMenu();\n }, Private.TIMER_DELAY);\n }\n }\n\n /**\n * Cancel the open timer, if the timer is pending.\n */\n private _cancelOpenTimer(): void {\n if (this._openTimerID !== 0) {\n clearTimeout(this._openTimerID);\n this._openTimerID = 0;\n }\n }\n\n /**\n * Cancel the close timer, if the timer is pending.\n */\n private _cancelCloseTimer(): void {\n if (this._closeTimerID !== 0) {\n clearTimeout(this._closeTimerID);\n this._closeTimerID = 0;\n }\n }\n\n /**\n * Save window data used for menu positioning in transient cache.\n *\n * In order to avoid layout trashing it is recommended to invoke this\n * method immediately prior to opening the menu and any DOM modifications\n * (like closing previously visible menu, or adding a class to menu widget).\n *\n * The transient cache will be released upon `open()` call.\n */\n static saveWindowData(): void {\n Private.saveWindowData();\n }\n\n private _childIndex = -1;\n private _activeIndex = -1;\n private _openTimerID = 0;\n private _closeTimerID = 0;\n private _items: Menu.IItem[] = [];\n private _childMenu: Menu | null = null;\n private _parentMenu: Menu | null = null;\n private _aboutToClose = new Signal(this);\n private _menuRequested = new Signal(this);\n}\n\n/**\n * The namespace for the `Menu` class statics.\n */\nexport namespace Menu {\n /**\n * An options object for creating a menu.\n */\n export interface IOptions {\n /**\n * The command registry for use with the menu.\n */\n commands: CommandRegistry;\n\n /**\n * A custom renderer for use with the menu.\n *\n * The default is a shared renderer instance.\n */\n renderer?: IRenderer;\n }\n\n /**\n * An options object for the `open` method on a menu.\n */\n export interface IOpenOptions {\n /**\n * Whether to force the X position of the menu.\n *\n * Setting to `true` will disable the logic which repositions the\n * X coordinate of the menu if it will not fit entirely on screen.\n *\n * The default is `false`.\n */\n forceX?: boolean;\n\n /**\n * Whether to force the Y position of the menu.\n *\n * Setting to `true` will disable the logic which repositions the\n * Y coordinate of the menu if it will not fit entirely on screen.\n *\n * The default is `false`.\n */\n forceY?: boolean;\n\n /**\n * The DOM node to use as the menu's host.\n *\n * If not specified then uses `document.body`.\n */\n host?: HTMLElement;\n\n /**\n * The child of `host` to use as the reference element.\n * If this is provided, the menu will be inserted before this\n * node in the host. The default is `null`, which will cause the\n * menu to be added as the last child of the host.\n */\n ref?: HTMLElement;\n\n /**\n * The alignment of the menu.\n *\n * The default is `'left'` unless the document `dir` attribute is `'rtl'`\n */\n horizontalAlignment?: 'left' | 'right';\n }\n\n /**\n * A type alias for a menu item type.\n */\n export type ItemType = 'command' | 'submenu' | 'separator';\n\n /**\n * An options object for creating a menu item.\n */\n export interface IItemOptions {\n /**\n * The type of the menu item.\n *\n * The default value is `'command'`.\n */\n type?: ItemType;\n\n /**\n * The command to execute when the item is triggered.\n *\n * The default value is an empty string.\n */\n command?: string;\n\n /**\n * The arguments for the command.\n *\n * The default value is an empty object.\n */\n args?: ReadonlyJSONObject;\n\n /**\n * The submenu for a `'submenu'` type item.\n *\n * The default value is `null`.\n */\n submenu?: Menu | null;\n }\n\n /**\n * An object which represents a menu item.\n *\n * #### Notes\n * Item objects are created automatically by a menu.\n */\n export interface IItem {\n /**\n * The type of the menu item.\n */\n readonly type: ItemType;\n\n /**\n * The command to execute when the item is triggered.\n */\n readonly command: string;\n\n /**\n * The arguments for the command.\n */\n readonly args: ReadonlyJSONObject;\n\n /**\n * The submenu for a `'submenu'` type item.\n */\n readonly submenu: Menu | null;\n\n /**\n * The display label for the menu item.\n */\n readonly label: string;\n\n /**\n * The mnemonic index for the menu item.\n */\n readonly mnemonic: number;\n\n /**\n * The icon renderer for the menu item.\n */\n readonly icon: VirtualElement.IRenderer | undefined;\n\n /**\n * The icon class for the menu item.\n */\n readonly iconClass: string;\n\n /**\n * The icon label for the menu item.\n */\n readonly iconLabel: string;\n\n /**\n * The display caption for the menu item.\n */\n readonly caption: string;\n\n /**\n * The extra class name for the menu item.\n */\n readonly className: string;\n\n /**\n * The dataset for the menu item.\n */\n readonly dataset: CommandRegistry.Dataset;\n\n /**\n * Whether the menu item is enabled.\n */\n readonly isEnabled: boolean;\n\n /**\n * Whether the menu item is toggled.\n */\n readonly isToggled: boolean;\n\n /**\n * Whether the menu item is visible.\n */\n readonly isVisible: boolean;\n\n /**\n * The key binding for the menu item.\n */\n readonly keyBinding: CommandRegistry.IKeyBinding | null;\n }\n\n /**\n * An object which holds the data to render a menu item.\n */\n export interface IRenderData {\n /**\n * The item to be rendered.\n */\n readonly item: IItem;\n\n /**\n * Whether the item is the active item.\n */\n readonly active: boolean;\n\n /**\n * Whether the item should be collapsed.\n */\n readonly collapsed: boolean;\n\n /**\n * Handler for when element is in focus.\n */\n readonly onfocus?: () => void;\n }\n\n /**\n * A renderer for use with a menu.\n */\n export interface IRenderer {\n /**\n * Render the virtual element for a menu item.\n *\n * @param data - The data to use for rendering the item.\n *\n * @returns A virtual element representing the item.\n */\n renderItem(data: IRenderData): VirtualElement;\n }\n\n /**\n * The default implementation of `IRenderer`.\n *\n * #### Notes\n * Subclasses are free to reimplement rendering methods as needed.\n */\n export class Renderer implements IRenderer {\n /**\n * Render the virtual element for a menu item.\n *\n * @param data - The data to use for rendering the item.\n *\n * @returns A virtual element representing the item.\n */\n renderItem(data: IRenderData): VirtualElement {\n let className = this.createItemClass(data);\n let dataset = this.createItemDataset(data);\n let aria = this.createItemARIA(data);\n return h.li(\n {\n className,\n dataset,\n tabindex: '0',\n onfocus: data.onfocus,\n ...aria\n },\n this.renderIcon(data),\n this.renderLabel(data),\n this.renderShortcut(data),\n this.renderSubmenu(data)\n );\n }\n\n /**\n * Render the icon element for a menu item.\n *\n * @param data - The data to use for rendering the icon.\n *\n * @returns A virtual element representing the item icon.\n */\n renderIcon(data: IRenderData): VirtualElement {\n let className = this.createIconClass(data);\n\n // If data.item.icon is undefined, it will be ignored.\n return h.div({ className }, data.item.icon!, data.item.iconLabel);\n }\n\n /**\n * Render the label element for a menu item.\n *\n * @param data - The data to use for rendering the label.\n *\n * @returns A virtual element representing the item label.\n */\n renderLabel(data: IRenderData): VirtualElement {\n let content = this.formatLabel(data);\n return h.div({ className: 'lm-Menu-itemLabel' }, content);\n }\n\n /**\n * Render the shortcut element for a menu item.\n *\n * @param data - The data to use for rendering the shortcut.\n *\n * @returns A virtual element representing the item shortcut.\n */\n renderShortcut(data: IRenderData): VirtualElement {\n let content = this.formatShortcut(data);\n return h.div({ className: 'lm-Menu-itemShortcut' }, content);\n }\n\n /**\n * Render the submenu icon element for a menu item.\n *\n * @param data - The data to use for rendering the submenu icon.\n *\n * @returns A virtual element representing the submenu icon.\n */\n renderSubmenu(data: IRenderData): VirtualElement {\n return h.div({ className: 'lm-Menu-itemSubmenuIcon' });\n }\n\n /**\n * Create the class name for the menu item.\n *\n * @param data - The data to use for the class name.\n *\n * @returns The full class name for the menu item.\n */\n createItemClass(data: IRenderData): string {\n // Setup the initial class name.\n let name = 'lm-Menu-item';\n\n // Add the boolean state classes.\n if (!data.item.isEnabled) {\n name += ' lm-mod-disabled';\n }\n if (data.item.isToggled) {\n name += ' lm-mod-toggled';\n }\n if (!data.item.isVisible) {\n name += ' lm-mod-hidden';\n }\n if (data.active) {\n name += ' lm-mod-active';\n }\n if (data.collapsed) {\n name += ' lm-mod-collapsed';\n }\n\n // Add the extra class.\n let extra = data.item.className;\n if (extra) {\n name += ` ${extra}`;\n }\n\n // Return the complete class name.\n return name;\n }\n\n /**\n * Create the dataset for the menu item.\n *\n * @param data - The data to use for creating the dataset.\n *\n * @returns The dataset for the menu item.\n */\n createItemDataset(data: IRenderData): ElementDataset {\n let result: ElementDataset;\n let { type, command, dataset } = data.item;\n if (type === 'command') {\n result = { ...dataset, type, command };\n } else {\n result = { ...dataset, type };\n }\n return result;\n }\n\n /**\n * Create the class name for the menu item icon.\n *\n * @param data - The data to use for the class name.\n *\n * @returns The full class name for the item icon.\n */\n createIconClass(data: IRenderData): string {\n let name = 'lm-Menu-itemIcon';\n let extra = data.item.iconClass;\n return extra ? `${name} ${extra}` : name;\n }\n\n /**\n * Create the aria attributes for menu item.\n *\n * @param data - The data to use for the aria attributes.\n *\n * @returns The aria attributes object for the item.\n */\n createItemARIA(data: IRenderData): ElementARIAAttrs {\n let aria: { [T in ARIAAttrNames]?: string } = {};\n switch (data.item.type) {\n case 'separator':\n aria.role = 'presentation';\n break;\n case 'submenu':\n aria['aria-haspopup'] = 'true';\n if (!data.item.isEnabled) {\n aria['aria-disabled'] = 'true';\n }\n break;\n default:\n if (!data.item.isEnabled) {\n aria['aria-disabled'] = 'true';\n }\n if (data.item.isToggled) {\n aria.role = 'menuitemcheckbox';\n aria['aria-checked'] = 'true';\n } else {\n aria.role = 'menuitem';\n }\n }\n return aria;\n }\n\n /**\n * Create the render content for the label node.\n *\n * @param data - The data to use for the label content.\n *\n * @returns The content to add to the label node.\n */\n formatLabel(data: IRenderData): h.Child {\n // Fetch the label text and mnemonic index.\n let { label, mnemonic } = data.item;\n\n // If the index is out of range, do not modify the label.\n if (mnemonic < 0 || mnemonic >= label.length) {\n return label;\n }\n\n // Split the label into parts.\n let prefix = label.slice(0, mnemonic);\n let suffix = label.slice(mnemonic + 1);\n let char = label[mnemonic];\n\n // Wrap the mnemonic character in a span.\n let span = h.span({ className: 'lm-Menu-itemMnemonic' }, char);\n\n // Return the content parts.\n return [prefix, span, suffix];\n }\n\n /**\n * Create the render content for the shortcut node.\n *\n * @param data - The data to use for the shortcut content.\n *\n * @returns The content to add to the shortcut node.\n */\n formatShortcut(data: IRenderData): h.Child {\n let kb = data.item.keyBinding;\n return kb ? CommandRegistry.formatKeystroke(kb.keys) : null;\n }\n }\n\n /**\n * The default `Renderer` instance.\n */\n export const defaultRenderer = new Renderer();\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * The ms delay for opening and closing a submenu.\n */\n export const TIMER_DELAY = 300;\n\n /**\n * The horizontal pixel overlap for an open submenu.\n */\n export const SUBMENU_OVERLAP = 3;\n\n let transientWindowDataCache: IWindowData | null = null;\n let transientCacheCounter: number = 0;\n\n function getWindowData(): IWindowData {\n // if transient cache is in use, take one from it\n if (transientCacheCounter > 0) {\n transientCacheCounter--;\n return transientWindowDataCache!;\n }\n return _getWindowData();\n }\n\n /**\n * Store window data in transient cache.\n *\n * The transient cache will be released upon `getWindowData()` call.\n * If this function is called multiple times, the cache will be\n * retained until as many calls to `getWindowData()` were made.\n *\n * Note: should be called before any DOM modifications.\n */\n export function saveWindowData(): void {\n transientWindowDataCache = _getWindowData();\n transientCacheCounter++;\n }\n\n /**\n * Create the DOM node for a menu.\n */\n export function createNode(): HTMLDivElement {\n let node = document.createElement('div');\n let content = document.createElement('ul');\n content.className = 'lm-Menu-content';\n node.appendChild(content);\n content.setAttribute('role', 'menu');\n node.tabIndex = 0;\n return node;\n }\n\n /**\n * Test whether a menu item can be activated.\n */\n export function canActivate(item: Menu.IItem): boolean {\n return item.type !== 'separator' && item.isEnabled && item.isVisible;\n }\n\n /**\n * Create a new menu item for an owner menu.\n */\n export function createItem(\n owner: Menu,\n options: Menu.IItemOptions\n ): Menu.IItem {\n return new MenuItem(owner.commands, options);\n }\n\n /**\n * Hit test a menu hierarchy starting at the given root.\n */\n export function hitTestMenus(menu: Menu, x: number, y: number): boolean {\n for (let temp: Menu | null = menu; temp; temp = temp.childMenu) {\n if (ElementExt.hitTest(temp.node, x, y)) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * Compute which extra separator items should be collapsed.\n */\n export function computeCollapsed(\n items: ReadonlyArray\n ): boolean[] {\n // Allocate the return array and fill it with `false`.\n let result = new Array(items.length);\n ArrayExt.fill(result, false);\n\n // Collapse the leading separators.\n let k1 = 0;\n let n = items.length;\n for (; k1 < n; ++k1) {\n let item = items[k1];\n if (!item.isVisible) {\n continue;\n }\n if (item.type !== 'separator') {\n break;\n }\n result[k1] = true;\n }\n\n // Hide the trailing separators.\n let k2 = n - 1;\n for (; k2 >= 0; --k2) {\n let item = items[k2];\n if (!item.isVisible) {\n continue;\n }\n if (item.type !== 'separator') {\n break;\n }\n result[k2] = true;\n }\n\n // Hide the remaining consecutive separators.\n let hide = false;\n while (++k1 < k2) {\n let item = items[k1];\n if (!item.isVisible) {\n continue;\n }\n if (item.type !== 'separator') {\n hide = false;\n } else if (hide) {\n result[k1] = true;\n } else {\n hide = true;\n }\n }\n\n // Return the resulting flags.\n return result;\n }\n\n function _getWindowData(): IWindowData {\n return {\n pageXOffset: window.pageXOffset,\n pageYOffset: window.pageYOffset,\n clientWidth: document.documentElement.clientWidth,\n clientHeight: document.documentElement.clientHeight\n };\n }\n\n /**\n * Open a menu as a root menu at the target location.\n */\n export function openRootMenu(\n menu: Menu,\n x: number,\n y: number,\n forceX: boolean,\n forceY: boolean,\n horizontalAlignment: 'left' | 'right',\n host: HTMLElement | null,\n ref: HTMLElement | null\n ): void {\n // Get the current position and size of the main viewport.\n const windowData = getWindowData();\n let px = windowData.pageXOffset;\n let py = windowData.pageYOffset;\n let cw = windowData.clientWidth;\n let ch = windowData.clientHeight;\n\n // Ensure the menu is updated before attaching and measuring.\n MessageLoop.sendMessage(menu, Widget.Msg.UpdateRequest);\n\n // Compute the maximum allowed height for the menu.\n let maxHeight = ch - (forceY ? y : 0);\n\n // Fetch common variables.\n let node = menu.node;\n let style = node.style;\n\n // Clear the menu geometry and prepare it for measuring.\n style.opacity = '0';\n style.maxHeight = `${maxHeight}px`;\n\n // Attach the menu to the document.\n Widget.attach(menu, host || document.body, ref);\n\n // Measure the size of the menu.\n let { width, height } = node.getBoundingClientRect();\n\n // align the menu to the right of the target if requested or language is RTL\n if (horizontalAlignment === 'right') {\n x -= width;\n }\n\n // Adjust the X position of the menu to fit on-screen.\n if (!forceX && x + width > px + cw) {\n x = px + cw - width;\n }\n\n // Adjust the Y position of the menu to fit on-screen.\n if (!forceY && y + height > py + ch) {\n if (y > py + ch) {\n y = py + ch - height;\n } else {\n y = y - height;\n }\n }\n\n // Update the position of the menu to the computed position.\n style.transform = `translate(${Math.max(0, x)}px, ${Math.max(0, y)}px`;\n\n // Finally, make the menu visible on the screen.\n style.opacity = '1';\n }\n\n /**\n * Open a menu as a submenu using an item node for positioning.\n */\n export function openSubmenu(submenu: Menu, itemNode: HTMLElement): void {\n // Get the current position and size of the main viewport.\n const windowData = getWindowData();\n let px = windowData.pageXOffset;\n let py = windowData.pageYOffset;\n let cw = windowData.clientWidth;\n let ch = windowData.clientHeight;\n\n // Ensure the menu is updated before opening.\n MessageLoop.sendMessage(submenu, Widget.Msg.UpdateRequest);\n\n // Compute the maximum allowed height for the menu.\n let maxHeight = ch;\n\n // Fetch common variables.\n let node = submenu.node;\n let style = node.style;\n\n // Clear the menu geometry and prepare it for measuring.\n style.opacity = '0';\n style.maxHeight = `${maxHeight}px`;\n\n // Attach the menu to the document.\n Widget.attach(submenu, document.body);\n\n // Measure the size of the menu.\n let { width, height } = node.getBoundingClientRect();\n\n // Compute the box sizing for the menu.\n let box = ElementExt.boxSizing(submenu.node);\n\n // Get the bounding rect for the target item node.\n let itemRect = itemNode.getBoundingClientRect();\n\n // Compute the target X position.\n let x = itemRect.right - SUBMENU_OVERLAP;\n\n // Adjust the X position to fit on the screen.\n if (x + width > px + cw) {\n x = itemRect.left + SUBMENU_OVERLAP - width;\n }\n\n // Compute the target Y position.\n let y = itemRect.top - box.borderTop - box.paddingTop;\n\n // Adjust the Y position to fit on the screen.\n if (y + height > py + ch) {\n y = itemRect.bottom + box.borderBottom + box.paddingBottom - height;\n }\n\n // Update the position of the menu to the computed position.\n style.transform = `translate(${Math.max(0, x)}px, ${Math.max(0, y)}px`;\n\n // Finally, make the menu visible on the screen.\n style.opacity = '1';\n }\n\n /**\n * The results of a mnemonic search.\n */\n export interface IMnemonicResult {\n /**\n * The index of the first matching mnemonic item, or `-1`.\n */\n index: number;\n\n /**\n * Whether multiple mnemonic items matched.\n */\n multiple: boolean;\n\n /**\n * The index of the first auto matched non-mnemonic item.\n */\n auto: number;\n }\n\n /**\n * Find the best matching mnemonic item.\n *\n * The search starts at the given index and wraps around.\n */\n export function findMnemonic(\n items: ReadonlyArray,\n key: string,\n start: number\n ): IMnemonicResult {\n // Setup the result variables.\n let index = -1;\n let auto = -1;\n let multiple = false;\n\n // Normalize the key to upper case.\n let upperKey = key.toUpperCase();\n\n // Search the items from the given start index.\n for (let i = 0, n = items.length; i < n; ++i) {\n // Compute the wrapped index.\n let k = (i + start) % n;\n\n // Lookup the item\n let item = items[k];\n\n // Ignore items which cannot be activated.\n if (!canActivate(item)) {\n continue;\n }\n\n // Ignore items with an empty label.\n let label = item.label;\n if (label.length === 0) {\n continue;\n }\n\n // Lookup the mnemonic index for the label.\n let mn = item.mnemonic;\n\n // Handle a valid mnemonic index.\n if (mn >= 0 && mn < label.length) {\n if (label[mn].toUpperCase() === upperKey) {\n if (index === -1) {\n index = k;\n } else {\n multiple = true;\n }\n }\n continue;\n }\n\n // Finally, handle the auto index if possible.\n if (auto === -1 && label[0].toUpperCase() === upperKey) {\n auto = k;\n }\n }\n\n // Return the search results.\n return { index, multiple, auto };\n }\n\n /**\n * A concrete implementation of `Menu.IItem`.\n */\n class MenuItem implements Menu.IItem {\n /**\n * Construct a new menu item.\n */\n constructor(commands: CommandRegistry, options: Menu.IItemOptions) {\n this._commands = commands;\n this.type = options.type || 'command';\n this.command = options.command || '';\n this.args = options.args || JSONExt.emptyObject;\n this.submenu = options.submenu || null;\n }\n\n /**\n * The type of the menu item.\n */\n readonly type: Menu.ItemType;\n\n /**\n * The command to execute when the item is triggered.\n */\n readonly command: string;\n\n /**\n * The arguments for the command.\n */\n readonly args: ReadonlyJSONObject;\n\n /**\n * The submenu for a `'submenu'` type item.\n */\n readonly submenu: Menu | null;\n\n /**\n * The display label for the menu item.\n */\n get label(): string {\n if (this.type === 'command') {\n return this._commands.label(this.command, this.args);\n }\n if (this.type === 'submenu' && this.submenu) {\n return this.submenu.title.label;\n }\n return '';\n }\n\n /**\n * The mnemonic index for the menu item.\n */\n get mnemonic(): number {\n if (this.type === 'command') {\n return this._commands.mnemonic(this.command, this.args);\n }\n if (this.type === 'submenu' && this.submenu) {\n return this.submenu.title.mnemonic;\n }\n return -1;\n }\n\n /**\n * The icon renderer for the menu item.\n */\n get icon(): VirtualElement.IRenderer | undefined {\n if (this.type === 'command') {\n return this._commands.icon(this.command, this.args);\n }\n if (this.type === 'submenu' && this.submenu) {\n return this.submenu.title.icon;\n }\n return undefined;\n }\n\n /**\n * The icon class for the menu item.\n */\n get iconClass(): string {\n if (this.type === 'command') {\n return this._commands.iconClass(this.command, this.args);\n }\n if (this.type === 'submenu' && this.submenu) {\n return this.submenu.title.iconClass;\n }\n return '';\n }\n\n /**\n * The icon label for the menu item.\n */\n get iconLabel(): string {\n if (this.type === 'command') {\n return this._commands.iconLabel(this.command, this.args);\n }\n if (this.type === 'submenu' && this.submenu) {\n return this.submenu.title.iconLabel;\n }\n return '';\n }\n\n /**\n * The display caption for the menu item.\n */\n get caption(): string {\n if (this.type === 'command') {\n return this._commands.caption(this.command, this.args);\n }\n if (this.type === 'submenu' && this.submenu) {\n return this.submenu.title.caption;\n }\n return '';\n }\n\n /**\n * The extra class name for the menu item.\n */\n get className(): string {\n if (this.type === 'command') {\n return this._commands.className(this.command, this.args);\n }\n if (this.type === 'submenu' && this.submenu) {\n return this.submenu.title.className;\n }\n return '';\n }\n\n /**\n * The dataset for the menu item.\n */\n get dataset(): CommandRegistry.Dataset {\n if (this.type === 'command') {\n return this._commands.dataset(this.command, this.args);\n }\n if (this.type === 'submenu' && this.submenu) {\n return this.submenu.title.dataset;\n }\n return {};\n }\n\n /**\n * Whether the menu item is enabled.\n */\n get isEnabled(): boolean {\n if (this.type === 'command') {\n return this._commands.isEnabled(this.command, this.args);\n }\n if (this.type === 'submenu') {\n return this.submenu !== null;\n }\n return true;\n }\n\n /**\n * Whether the menu item is toggled.\n */\n get isToggled(): boolean {\n if (this.type === 'command') {\n return this._commands.isToggled(this.command, this.args);\n }\n return false;\n }\n\n /**\n * Whether the menu item is visible.\n */\n get isVisible(): boolean {\n if (this.type === 'command') {\n return this._commands.isVisible(this.command, this.args);\n }\n if (this.type === 'submenu') {\n return this.submenu !== null;\n }\n return true;\n }\n\n /**\n * The key binding for the menu item.\n */\n get keyBinding(): CommandRegistry.IKeyBinding | null {\n if (this.type === 'command') {\n let { command, args } = this;\n return (\n ArrayExt.findLastValue(this._commands.keyBindings, kb => {\n return kb.command === command && JSONExt.deepEqual(kb.args, args);\n }) || null\n );\n }\n return null;\n }\n\n private _commands: CommandRegistry;\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { CommandRegistry } from '@lumino/commands';\n\nimport { DisposableDelegate, IDisposable } from '@lumino/disposable';\n\nimport { Selector } from '@lumino/domutils';\n\nimport { Menu } from './menu';\n\n/**\n * An object which implements a universal context menu.\n *\n * #### Notes\n * The items shown in the context menu are determined by CSS selector\n * matching against the DOM hierarchy at the site of the mouse click.\n * This is similar in concept to how keyboard shortcuts are matched\n * in the command registry.\n */\nexport class ContextMenu {\n /**\n * Construct a new context menu.\n *\n * @param options - The options for initializing the menu.\n */\n constructor(options: ContextMenu.IOptions) {\n const { groupByTarget, sortBySelector, ...others } = options;\n this.menu = new Menu(others);\n this._groupByTarget = groupByTarget !== false;\n this._sortBySelector = sortBySelector !== false;\n }\n\n /**\n * The menu widget which displays the matched context items.\n */\n readonly menu: Menu;\n\n /**\n * Add an item to the context menu.\n *\n * @param options - The options for creating the item.\n *\n * @returns A disposable which will remove the item from the menu.\n */\n addItem(options: ContextMenu.IItemOptions): IDisposable {\n // Create an item from the given options.\n let item = Private.createItem(options, this._idTick++);\n\n // Add the item to the internal array.\n this._items.push(item);\n\n // Return a disposable which will remove the item.\n return new DisposableDelegate(() => {\n ArrayExt.removeFirstOf(this._items, item);\n });\n }\n\n /**\n * Open the context menu in response to a `'contextmenu'` event.\n *\n * @param event - The `'contextmenu'` event of interest.\n *\n * @returns `true` if the menu was opened, or `false` if no items\n * matched the event and the menu was not opened.\n *\n * #### Notes\n * This method will populate the context menu with items which match\n * the propagation path of the event, then open the menu at the mouse\n * position indicated by the event.\n */\n open(event: MouseEvent): boolean {\n // Prior to any DOM modifications update the window data.\n Menu.saveWindowData();\n\n // Clear the current contents of the context menu.\n this.menu.clearItems();\n\n // Bail early if there are no items to match.\n if (this._items.length === 0) {\n return false;\n }\n\n // Find the matching items for the event.\n let items = Private.matchItems(\n this._items,\n event,\n this._groupByTarget,\n this._sortBySelector\n );\n\n // Bail if there are no matching items.\n if (!items || items.length === 0) {\n return false;\n }\n\n // Add the filtered items to the menu.\n for (const item of items) {\n this.menu.addItem(item);\n }\n\n // Open the context menu at the current mouse position.\n this.menu.open(event.clientX, event.clientY);\n\n // Indicate success.\n return true;\n }\n\n private _groupByTarget: boolean = true;\n private _idTick = 0;\n private _items: Private.IItem[] = [];\n private _sortBySelector: boolean = true;\n}\n\n/**\n * The namespace for the `ContextMenu` class statics.\n */\nexport namespace ContextMenu {\n /**\n * An options object for initializing a context menu.\n */\n export interface IOptions {\n /**\n * The command registry to use with the context menu.\n */\n commands: CommandRegistry;\n\n /**\n * A custom renderer for use with the context menu.\n */\n renderer?: Menu.IRenderer;\n\n /**\n * Whether to sort by selector and rank or only rank.\n *\n * Default true.\n */\n sortBySelector?: boolean;\n\n /**\n * Whether to group items following the DOM hierarchy.\n *\n * Default true.\n *\n * #### Note\n * If true, when the mouse event occurs on element `span` within `div.top`,\n * the items matching `div.top` will be shown before the ones matching `body`.\n */\n groupByTarget?: boolean;\n }\n\n /**\n * An options object for creating a context menu item.\n */\n export interface IItemOptions extends Menu.IItemOptions {\n /**\n * The CSS selector for the context menu item.\n *\n * The context menu item will only be displayed in the context menu\n * when the selector matches a node on the propagation path of the\n * contextmenu event. This allows the menu item to be restricted to\n * user-defined contexts.\n *\n * The selector must not contain commas.\n */\n selector: string;\n\n /**\n * The rank for the item.\n *\n * The rank is used as a tie-breaker when ordering context menu\n * items for display. Items are sorted in the following order:\n * 1. Depth in the DOM tree (deeper is better)\n * 2. Selector specificity (higher is better)\n * 3. Rank (lower is better)\n * 4. Insertion order\n *\n * The default rank is `Infinity`.\n */\n rank?: number;\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * A normalized item for a context menu.\n */\n export interface IItem extends Menu.IItemOptions {\n /**\n * The selector for the item.\n */\n selector: string;\n\n /**\n * The rank for the item.\n */\n rank: number;\n\n /**\n * The tie-breaking id for the item.\n */\n id: number;\n }\n\n /**\n * Create a normalized context menu item from an options object.\n */\n export function createItem(\n options: ContextMenu.IItemOptions,\n id: number\n ): IItem {\n let selector = validateSelector(options.selector);\n let rank = options.rank !== undefined ? options.rank : Infinity;\n return { ...options, selector, rank, id };\n }\n\n /**\n * Find the items which match a context menu event.\n *\n * The results are sorted by DOM level, specificity, and rank.\n */\n export function matchItems(\n items: IItem[],\n event: MouseEvent,\n groupByTarget: boolean,\n sortBySelector: boolean\n ): IItem[] | null {\n // Look up the target of the event.\n let target = event.target as Element | null;\n\n // Bail if there is no target.\n if (!target) {\n return null;\n }\n\n // Look up the current target of the event.\n let currentTarget = event.currentTarget as Element | null;\n\n // Bail if there is no current target.\n if (!currentTarget) {\n return null;\n }\n\n // There are some third party libraries that cause the `target` to\n // be detached from the DOM before lumino can process the event.\n // If that happens, search for a new target node by point. If that\n // node is still dangling, bail.\n if (!currentTarget.contains(target)) {\n target = document.elementFromPoint(event.clientX, event.clientY);\n if (!target || !currentTarget.contains(target)) {\n return null;\n }\n }\n\n // Set up the result array.\n let result: IItem[] = [];\n\n // Copy the items array to allow in-place modification.\n let availableItems: Array = items.slice();\n\n // Walk up the DOM hierarchy searching for matches.\n while (target !== null) {\n // Set up the match array for this DOM level.\n let matches: IItem[] = [];\n\n // Search the remaining items for matches.\n for (let i = 0, n = availableItems.length; i < n; ++i) {\n // Fetch the item.\n let item = availableItems[i];\n\n // Skip items which are already consumed.\n if (!item) {\n continue;\n }\n\n // Skip items which do not match the element.\n if (!Selector.matches(target, item.selector)) {\n continue;\n }\n\n // Add the matched item to the result for this DOM level.\n matches.push(item);\n\n // Mark the item as consumed.\n availableItems[i] = null;\n }\n\n // Sort the matches for this level and add them to the results.\n if (matches.length !== 0) {\n if (groupByTarget) {\n matches.sort(sortBySelector ? itemCmp : itemCmpRank);\n }\n result.push(...matches);\n }\n\n // Stop searching at the limits of the DOM range.\n if (target === currentTarget) {\n break;\n }\n\n // Step to the parent DOM level.\n target = target.parentElement;\n }\n\n if (!groupByTarget) {\n result.sort(sortBySelector ? itemCmp : itemCmpRank);\n }\n\n // Return the matched and sorted results.\n return result;\n }\n\n /**\n * Validate the selector for a menu item.\n *\n * This returns the validated selector, or throws if the selector is\n * invalid or contains commas.\n */\n function validateSelector(selector: string): string {\n if (selector.indexOf(',') !== -1) {\n throw new Error(`Selector cannot contain commas: ${selector}`);\n }\n if (!Selector.isValid(selector)) {\n throw new Error(`Invalid selector: ${selector}`);\n }\n return selector;\n }\n\n /**\n * A sort comparison function for a context menu item by ranks.\n */\n function itemCmpRank(a: IItem, b: IItem): number {\n // Sort based on rank.\n let r1 = a.rank;\n let r2 = b.rank;\n if (r1 !== r2) {\n return r1 < r2 ? -1 : 1; // Infinity-safe\n }\n\n // When all else fails, sort by item id.\n return a.id - b.id;\n }\n\n /**\n * A sort comparison function for a context menu item by selectors and ranks.\n */\n function itemCmp(a: IItem, b: IItem): number {\n // Sort first based on selector specificity.\n let s1 = Selector.calculateSpecificity(a.selector);\n let s2 = Selector.calculateSpecificity(b.selector);\n if (s1 !== s2) {\n return s2 - s1;\n }\n\n // If specificities are equal\n return itemCmpRank(a, b);\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { IDisposable } from '@lumino/disposable';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Drag } from '@lumino/dragdrop';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport {\n ElementARIAAttrs,\n ElementBaseAttrs,\n ElementDataset,\n ElementInlineStyle,\n h,\n VirtualDOM,\n VirtualElement\n} from '@lumino/virtualdom';\n\nimport { Title } from './title';\n\nimport { Widget } from './widget';\n\nconst ARROW_KEYS = [\n 'ArrowLeft',\n 'ArrowUp',\n 'ArrowRight',\n 'ArrowDown',\n 'Home',\n 'End'\n];\n\n/**\n * A widget which displays titles as a single row or column of tabs.\n *\n * #### Notes\n * If CSS transforms are used to rotate nodes for vertically oriented\n * text, then tab dragging will not work correctly. The `tabsMovable`\n * property should be set to `false` when rotating nodes from CSS.\n */\nexport class TabBar extends Widget {\n /**\n * Construct a new tab bar.\n *\n * @param options - The options for initializing the tab bar.\n */\n constructor(options: TabBar.IOptions = {}) {\n super({ node: Private.createNode() });\n this.addClass('lm-TabBar');\n this.contentNode.setAttribute('role', 'tablist');\n this.setFlag(Widget.Flag.DisallowLayout);\n this._document = options.document || document;\n this.tabsMovable = options.tabsMovable || false;\n this.titlesEditable = options.titlesEditable || false;\n this.allowDeselect = options.allowDeselect || false;\n this.addButtonEnabled = options.addButtonEnabled || false;\n this.insertBehavior = options.insertBehavior || 'select-tab-if-needed';\n this.name = options.name || '';\n this.orientation = options.orientation || 'horizontal';\n this.removeBehavior = options.removeBehavior || 'select-tab-after';\n this.renderer = options.renderer || TabBar.defaultRenderer;\n }\n\n /**\n * Dispose of the resources held by the widget.\n */\n dispose(): void {\n this._releaseMouse();\n this._titles.length = 0;\n this._previousTitle = null;\n super.dispose();\n }\n\n /**\n * A signal emitted when the current tab is changed.\n *\n * #### Notes\n * This signal is emitted when the currently selected tab is changed\n * either through user or programmatic interaction.\n *\n * Notably, this signal is not emitted when the index of the current\n * tab changes due to tabs being inserted, removed, or moved. It is\n * only emitted when the actual current tab node is changed.\n */\n get currentChanged(): ISignal> {\n return this._currentChanged;\n }\n\n /**\n * A signal emitted when a tab is moved by the user.\n *\n * #### Notes\n * This signal is emitted when a tab is moved by user interaction.\n *\n * This signal is not emitted when a tab is moved programmatically.\n */\n get tabMoved(): ISignal> {\n return this._tabMoved;\n }\n\n /**\n * A signal emitted when a tab is clicked by the user.\n *\n * #### Notes\n * If the clicked tab is not the current tab, the clicked tab will be\n * made current and the `currentChanged` signal will be emitted first.\n *\n * This signal is emitted even if the clicked tab is the current tab.\n */\n get tabActivateRequested(): ISignal<\n this,\n TabBar.ITabActivateRequestedArgs\n > {\n return this._tabActivateRequested;\n }\n\n /**\n * A signal emitted when the tab bar add button is clicked.\n */\n get addRequested(): ISignal {\n return this._addRequested;\n }\n\n /**\n * A signal emitted when a tab close icon is clicked.\n *\n * #### Notes\n * This signal is not emitted unless the tab title is `closable`.\n */\n get tabCloseRequested(): ISignal> {\n return this._tabCloseRequested;\n }\n\n /**\n * A signal emitted when a tab is dragged beyond the detach threshold.\n *\n * #### Notes\n * This signal is emitted when the user drags a tab with the mouse,\n * and mouse is dragged beyond the detach threshold.\n *\n * The consumer of the signal should call `releaseMouse` and remove\n * the tab in order to complete the detach.\n *\n * This signal is only emitted once per drag cycle.\n */\n get tabDetachRequested(): ISignal> {\n return this._tabDetachRequested;\n }\n\n /**\n * The renderer used by the tab bar.\n */\n readonly renderer: TabBar.IRenderer;\n\n /**\n * The document to use with the tab bar.\n *\n * The default is the global `document` instance.\n */\n get document(): Document | ShadowRoot {\n return this._document;\n }\n\n /**\n * Whether the tabs are movable by the user.\n *\n * #### Notes\n * Tabs can always be moved programmatically.\n */\n tabsMovable: boolean;\n\n /**\n * Whether the titles can be user-edited.\n *\n */\n get titlesEditable(): boolean {\n return this._titlesEditable;\n }\n\n /**\n * Set whether titles can be user edited.\n *\n */\n set titlesEditable(value: boolean) {\n this._titlesEditable = value;\n }\n\n /**\n * Whether a tab can be deselected by the user.\n *\n * #### Notes\n * Tabs can be always be deselected programmatically.\n */\n allowDeselect: boolean;\n\n /**\n * The selection behavior when inserting a tab.\n */\n insertBehavior: TabBar.InsertBehavior;\n\n /**\n * The selection behavior when removing a tab.\n */\n removeBehavior: TabBar.RemoveBehavior;\n\n /**\n * Get the currently selected title.\n *\n * #### Notes\n * This will be `null` if no tab is selected.\n */\n get currentTitle(): Title | null {\n return this._titles[this._currentIndex] || null;\n }\n\n /**\n * Set the currently selected title.\n *\n * #### Notes\n * If the title does not exist, the title will be set to `null`.\n */\n set currentTitle(value: Title | null) {\n this.currentIndex = value ? this._titles.indexOf(value) : -1;\n }\n\n /**\n * Get the index of the currently selected tab.\n *\n * #### Notes\n * This will be `-1` if no tab is selected.\n */\n get currentIndex(): number {\n return this._currentIndex;\n }\n\n /**\n * Set the index of the currently selected tab.\n *\n * #### Notes\n * If the value is out of range, the index will be set to `-1`.\n */\n set currentIndex(value: number) {\n // Adjust for an out of range index.\n if (value < 0 || value >= this._titles.length) {\n value = -1;\n }\n\n // Bail early if the index will not change.\n if (this._currentIndex === value) {\n return;\n }\n\n // Look up the previous index and title.\n let pi = this._currentIndex;\n let pt = this._titles[pi] || null;\n\n // Look up the current index and title.\n let ci = value;\n let ct = this._titles[ci] || null;\n\n // Update the current index and previous title.\n this._currentIndex = ci;\n this._previousTitle = pt;\n\n // Schedule an update of the tabs.\n this.update();\n\n // Emit the current changed signal.\n this._currentChanged.emit({\n previousIndex: pi,\n previousTitle: pt,\n currentIndex: ci,\n currentTitle: ct\n });\n }\n\n /**\n * Get the name of the tab bar.\n */\n get name(): string {\n return this._name;\n }\n\n /**\n * Set the name of the tab bar.\n */\n set name(value: string) {\n this._name = value;\n if (value) {\n this.contentNode.setAttribute('aria-label', value);\n } else {\n this.contentNode.removeAttribute('aria-label');\n }\n }\n\n /**\n * Get the orientation of the tab bar.\n *\n * #### Notes\n * This controls whether the tabs are arranged in a row or column.\n */\n get orientation(): TabBar.Orientation {\n return this._orientation;\n }\n\n /**\n * Set the orientation of the tab bar.\n *\n * #### Notes\n * This controls whether the tabs are arranged in a row or column.\n */\n set orientation(value: TabBar.Orientation) {\n // Do nothing if the orientation does not change.\n if (this._orientation === value) {\n return;\n }\n\n // Release the mouse before making any changes.\n this._releaseMouse();\n\n // Toggle the orientation values.\n this._orientation = value;\n this.dataset['orientation'] = value;\n this.contentNode.setAttribute('aria-orientation', value);\n }\n\n /**\n * Whether the add button is enabled.\n */\n get addButtonEnabled(): boolean {\n return this._addButtonEnabled;\n }\n\n /**\n * Set whether the add button is enabled.\n */\n set addButtonEnabled(value: boolean) {\n // Do nothing if the value does not change.\n if (this._addButtonEnabled === value) {\n return;\n }\n\n this._addButtonEnabled = value;\n if (value) {\n this.addButtonNode.classList.remove('lm-mod-hidden');\n } else {\n this.addButtonNode.classList.add('lm-mod-hidden');\n }\n }\n\n /**\n * A read-only array of the titles in the tab bar.\n */\n get titles(): ReadonlyArray> {\n return this._titles;\n }\n\n /**\n * The tab bar content node.\n *\n * #### Notes\n * This is the node which holds the tab nodes.\n *\n * Modifying this node directly can lead to undefined behavior.\n */\n get contentNode(): HTMLUListElement {\n return this.node.getElementsByClassName(\n 'lm-TabBar-content'\n )[0] as HTMLUListElement;\n }\n\n /**\n * The tab bar add button node.\n *\n * #### Notes\n * This is the node which holds the add button.\n *\n * Modifying this node directly can lead to undefined behavior.\n */\n get addButtonNode(): HTMLDivElement {\n return this.node.getElementsByClassName(\n 'lm-TabBar-addButton'\n )[0] as HTMLDivElement;\n }\n\n /**\n * Add a tab to the end of the tab bar.\n *\n * @param value - The title which holds the data for the tab,\n * or an options object to convert to a title.\n *\n * @returns The title object added to the tab bar.\n *\n * #### Notes\n * If the title is already added to the tab bar, it will be moved.\n */\n addTab(value: Title | Title.IOptions): Title {\n return this.insertTab(this._titles.length, value);\n }\n\n /**\n * Insert a tab into the tab bar at the specified index.\n *\n * @param index - The index at which to insert the tab.\n *\n * @param value - The title which holds the data for the tab,\n * or an options object to convert to a title.\n *\n * @returns The title object added to the tab bar.\n *\n * #### Notes\n * The index will be clamped to the bounds of the tabs.\n *\n * If the title is already added to the tab bar, it will be moved.\n */\n insertTab(index: number, value: Title | Title.IOptions): Title {\n // Release the mouse before making any changes.\n this._releaseMouse();\n\n // Coerce the value to a title.\n let title = Private.asTitle(value);\n\n // Look up the index of the title.\n let i = this._titles.indexOf(title);\n\n // Clamp the insert index to the array bounds.\n let j = Math.max(0, Math.min(index, this._titles.length));\n\n // If the title is not in the array, insert it.\n if (i === -1) {\n // Insert the title into the array.\n ArrayExt.insert(this._titles, j, title);\n\n // Connect to the title changed signal.\n title.changed.connect(this._onTitleChanged, this);\n\n // Schedule an update of the tabs.\n this.update();\n\n // Adjust the current index for the insert.\n this._adjustCurrentForInsert(j, title);\n\n // Return the title added to the tab bar.\n return title;\n }\n\n // Otherwise, the title exists in the array and should be moved.\n\n // Adjust the index if the location is at the end of the array.\n if (j === this._titles.length) {\n j--;\n }\n\n // Bail if there is no effective move.\n if (i === j) {\n return title;\n }\n\n // Move the title to the new location.\n ArrayExt.move(this._titles, i, j);\n\n // Schedule an update of the tabs.\n this.update();\n\n // Adjust the current index for the move.\n this._adjustCurrentForMove(i, j);\n\n // Return the title added to the tab bar.\n return title;\n }\n\n /**\n * Remove a tab from the tab bar.\n *\n * @param title - The title for the tab to remove.\n *\n * #### Notes\n * This is a no-op if the title is not in the tab bar.\n */\n removeTab(title: Title): void {\n this.removeTabAt(this._titles.indexOf(title));\n }\n\n /**\n * Remove the tab at a given index from the tab bar.\n *\n * @param index - The index of the tab to remove.\n *\n * #### Notes\n * This is a no-op if the index is out of range.\n */\n removeTabAt(index: number): void {\n // Release the mouse before making any changes.\n this._releaseMouse();\n\n // Remove the title from the array.\n let title = ArrayExt.removeAt(this._titles, index);\n\n // Bail if the index is out of range.\n if (!title) {\n return;\n }\n\n // Disconnect from the title changed signal.\n title.changed.disconnect(this._onTitleChanged, this);\n\n // Clear the previous title if it's being removed.\n if (title === this._previousTitle) {\n this._previousTitle = null;\n }\n\n // Schedule an update of the tabs.\n this.update();\n\n // Adjust the current index for the remove.\n this._adjustCurrentForRemove(index, title);\n }\n\n /**\n * Remove all tabs from the tab bar.\n */\n clearTabs(): void {\n // Bail if there is nothing to remove.\n if (this._titles.length === 0) {\n return;\n }\n\n // Release the mouse before making any changes.\n this._releaseMouse();\n\n // Disconnect from the title changed signals.\n for (let title of this._titles) {\n title.changed.disconnect(this._onTitleChanged, this);\n }\n\n // Get the current index and title.\n let pi = this.currentIndex;\n let pt = this.currentTitle;\n\n // Reset the current index and previous title.\n this._currentIndex = -1;\n this._previousTitle = null;\n\n // Clear the title array.\n this._titles.length = 0;\n\n // Schedule an update of the tabs.\n this.update();\n\n // If no tab was selected, there's nothing else to do.\n if (pi === -1) {\n return;\n }\n\n // Emit the current changed signal.\n this._currentChanged.emit({\n previousIndex: pi,\n previousTitle: pt,\n currentIndex: -1,\n currentTitle: null\n });\n }\n\n /**\n * Release the mouse and restore the non-dragged tab positions.\n *\n * #### Notes\n * This will cause the tab bar to stop handling mouse events and to\n * restore the tabs to their non-dragged positions.\n */\n releaseMouse(): void {\n this._releaseMouse();\n }\n\n /**\n * Handle the DOM events for the tab bar.\n *\n * @param event - The DOM event sent to the tab bar.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the tab bar's DOM node.\n *\n * This should not be called directly by user code.\n */\n handleEvent(event: Event): void {\n switch (event.type) {\n case 'pointerdown':\n this._evtPointerDown(event as PointerEvent);\n break;\n case 'pointermove':\n this._evtPointerMove(event as PointerEvent);\n break;\n case 'pointerup':\n this._evtPointerUp(event as PointerEvent);\n break;\n case 'dblclick':\n this._evtDblClick(event as MouseEvent);\n break;\n case 'keydown':\n event.eventPhase === Event.CAPTURING_PHASE\n ? this._evtKeyDownCapturing(event as KeyboardEvent)\n : this._evtKeyDown(event as KeyboardEvent);\n break;\n case 'contextmenu':\n event.preventDefault();\n event.stopPropagation();\n break;\n }\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n this.node.addEventListener('pointerdown', this);\n this.node.addEventListener('dblclick', this);\n this.node.addEventListener('keydown', this);\n }\n\n /**\n * A message handler invoked on an `'after-detach'` message.\n */\n protected onAfterDetach(msg: Message): void {\n this.node.removeEventListener('pointerdown', this);\n this.node.removeEventListener('dblclick', this);\n this.node.removeEventListener('keydown', this);\n this._releaseMouse();\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n protected onUpdateRequest(msg: Message): void {\n let titles = this._titles;\n let renderer = this.renderer;\n let currentTitle = this.currentTitle;\n let content = new Array(titles.length);\n // Keep the tabindex=\"0\" attribute to the tab which handled it before the update.\n // If the add button handles it, no need to do anything. If no element of the tab\n // bar handles it, set it on the current or the first tab to ensure one element\n // handles it after update.\n const tabHandlingTabindex =\n this._getCurrentTabindex() ??\n (this._currentIndex > -1 ? this._currentIndex : 0);\n\n for (let i = 0, n = titles.length; i < n; ++i) {\n let title = titles[i];\n let current = title === currentTitle;\n let zIndex = current ? n : n - i - 1;\n let tabIndex = tabHandlingTabindex === i ? 0 : -1;\n content[i] = renderer.renderTab({ title, current, zIndex, tabIndex });\n }\n VirtualDOM.render(content, this.contentNode);\n }\n\n /**\n * Get the index of the tab which handles tabindex=\"0\".\n * If the add button handles tabindex=\"0\", -1 is returned.\n * If none of the previous handles tabindex=\"0\", null is returned.\n */\n private _getCurrentTabindex(): number | null {\n let index = null;\n const elemTabindex = this.contentNode.querySelector('li[tabindex=\"0\"]');\n if (elemTabindex) {\n index = [...this.contentNode.children].indexOf(elemTabindex);\n } else if (\n this._addButtonEnabled &&\n this.addButtonNode.getAttribute('tabindex') === '0'\n ) {\n index = -1;\n }\n return index;\n }\n\n /**\n * Handle the `'dblclick'` event for the tab bar.\n */\n private _evtDblClick(event: MouseEvent): void {\n // Do nothing if titles are not editable\n if (!this.titlesEditable) {\n return;\n }\n\n let tabs = this.contentNode.children;\n\n // Find the index of the targeted tab.\n let index = ArrayExt.findFirstIndex(tabs, tab => {\n return ElementExt.hitTest(tab, event.clientX, event.clientY);\n });\n\n // Do nothing if the press is not on a tab.\n if (index === -1) {\n return;\n }\n\n let title = this.titles[index];\n let label = tabs[index].querySelector('.lm-TabBar-tabLabel') as HTMLElement;\n if (label && label.contains(event.target as HTMLElement)) {\n let value = title.label || '';\n\n // Clear the label element\n let oldValue = label.innerHTML;\n label.innerHTML = '';\n\n let input = document.createElement('input');\n input.classList.add('lm-TabBar-tabInput');\n input.value = value;\n label.appendChild(input);\n\n let onblur = () => {\n input.removeEventListener('blur', onblur);\n label.innerHTML = oldValue;\n this.node.addEventListener('keydown', this);\n };\n\n input.addEventListener('dblclick', (event: Event) =>\n event.stopPropagation()\n );\n input.addEventListener('blur', onblur);\n input.addEventListener('keydown', (event: KeyboardEvent) => {\n if (event.key === 'Enter') {\n if (input.value !== '') {\n title.label = title.caption = input.value;\n }\n onblur();\n } else if (event.key === 'Escape') {\n onblur();\n }\n });\n this.node.removeEventListener('keydown', this);\n input.select();\n input.focus();\n\n if (label.children.length > 0) {\n (label.children[0] as HTMLElement).focus();\n }\n }\n }\n\n /**\n * Handle the `'keydown'` event for the tab bar at capturing phase.\n */\n private _evtKeyDownCapturing(event: KeyboardEvent): void {\n if (event.eventPhase !== Event.CAPTURING_PHASE) {\n return;\n }\n\n // Stop all input events during drag.\n event.preventDefault();\n event.stopPropagation();\n\n // Release the mouse if `Escape` is pressed.\n if (event.key === 'Escape') {\n this._releaseMouse();\n }\n }\n\n /**\n * Handle the `'keydown'` event for the tab bar at target phase.\n */\n private _evtKeyDown(event: KeyboardEvent): void {\n // Allow for navigation using tab key\n if (event.key === 'Tab' || event.eventPhase === Event.CAPTURING_PHASE) {\n return;\n }\n\n // Check if Enter or Spacebar key has been pressed and open that tab\n if (\n event.key === 'Enter' ||\n event.key === 'Spacebar' ||\n event.key === ' '\n ) {\n // Get focus element that is in focus by the tab key\n const focusedElement = document.activeElement;\n\n // Test first if the focus is on the add button node\n if (\n this.addButtonEnabled &&\n this.addButtonNode.contains(focusedElement)\n ) {\n event.preventDefault();\n event.stopPropagation();\n this._addRequested.emit();\n } else {\n const index = ArrayExt.findFirstIndex(this.contentNode.children, tab =>\n tab.contains(focusedElement)\n );\n if (index >= 0) {\n event.preventDefault();\n event.stopPropagation();\n this.currentIndex = index;\n }\n }\n // Handle the arrow keys to switch tabs.\n } else if (ARROW_KEYS.includes(event.key)) {\n // Create a list of all focusable elements in the tab bar.\n const focusable: Element[] = [...this.contentNode.children];\n if (this.addButtonEnabled) {\n focusable.push(this.addButtonNode);\n }\n // If the tab bar contains only one element, nothing to do.\n if (focusable.length <= 1) {\n return;\n }\n event.preventDefault();\n event.stopPropagation();\n\n // Get the current focused element.\n let focusedIndex = focusable.indexOf(document.activeElement as Element);\n if (focusedIndex === -1) {\n focusedIndex = this._currentIndex;\n }\n\n // Find the next element to focus on.\n let nextFocused: Element | null | undefined;\n if (\n (event.key === 'ArrowRight' && this._orientation === 'horizontal') ||\n (event.key === 'ArrowDown' && this._orientation === 'vertical')\n ) {\n nextFocused = focusable[focusedIndex + 1] ?? focusable[0];\n } else if (\n (event.key === 'ArrowLeft' && this._orientation === 'horizontal') ||\n (event.key === 'ArrowUp' && this._orientation === 'vertical')\n ) {\n nextFocused =\n focusable[focusedIndex - 1] ?? focusable[focusable.length - 1];\n } else if (event.key === 'Home') {\n nextFocused = focusable[0];\n } else if (event.key === 'End') {\n nextFocused = focusable[focusable.length - 1];\n }\n\n // Change the focused element and the tabindex value.\n if (nextFocused) {\n focusable[focusedIndex]?.setAttribute('tabindex', '-1');\n nextFocused?.setAttribute('tabindex', '0');\n (nextFocused as HTMLElement).focus();\n }\n }\n }\n\n /**\n * Handle the `'pointerdown'` event for the tab bar.\n */\n private _evtPointerDown(event: PointerEvent | MouseEvent): void {\n // Do nothing if it's not a left or middle mouse press.\n if (event.button !== 0 && event.button !== 1) {\n return;\n }\n\n // Do nothing if a drag is in progress.\n if (this._dragData) {\n return;\n }\n\n // Do nothing if a title editable input was clicked.\n if (\n (event.target as HTMLElement).classList.contains('lm-TabBar-tabInput')\n ) {\n return;\n }\n\n // Check if the add button was clicked.\n let addButtonClicked =\n this.addButtonEnabled &&\n this.addButtonNode.contains(event.target as HTMLElement);\n\n // Lookup the tab nodes.\n let tabs = this.contentNode.children;\n\n // Find the index of the pressed tab.\n let index = ArrayExt.findFirstIndex(tabs, tab => {\n return ElementExt.hitTest(tab, event.clientX, event.clientY);\n });\n\n // Do nothing if the press is not on a tab or the add button.\n if (index === -1 && !addButtonClicked) {\n return;\n }\n\n // Pressing on a tab stops the event propagation.\n event.preventDefault();\n event.stopPropagation();\n\n // Initialize the non-measured parts of the drag data.\n this._dragData = {\n tab: tabs[index] as HTMLElement,\n index: index,\n pressX: event.clientX,\n pressY: event.clientY,\n tabPos: -1,\n tabSize: -1,\n tabPressPos: -1,\n targetIndex: -1,\n tabLayout: null,\n contentRect: null,\n override: null,\n dragActive: false,\n dragAborted: false,\n detachRequested: false\n };\n\n // Add the document pointer up listener.\n this.document.addEventListener('pointerup', this, true);\n\n // Do nothing else if the middle button or add button is clicked.\n if (event.button === 1 || addButtonClicked) {\n return;\n }\n\n // Do nothing else if the close icon is clicked.\n let icon = tabs[index].querySelector(this.renderer.closeIconSelector);\n if (icon && icon.contains(event.target as HTMLElement)) {\n return;\n }\n\n // Add the extra listeners if the tabs are movable.\n if (this.tabsMovable) {\n this.document.addEventListener('pointermove', this, true);\n this.document.addEventListener('keydown', this, true);\n this.document.addEventListener('contextmenu', this, true);\n }\n\n // Update the current index as appropriate.\n if (this.allowDeselect && this.currentIndex === index) {\n this.currentIndex = -1;\n } else {\n this.currentIndex = index;\n }\n\n // Do nothing else if there is no current tab.\n if (this.currentIndex === -1) {\n return;\n }\n\n // Emit the tab activate request signal.\n this._tabActivateRequested.emit({\n index: this.currentIndex,\n title: this.currentTitle!\n });\n }\n\n /**\n * Handle the `'pointermove'` event for the tab bar.\n */\n private _evtPointerMove(event: PointerEvent | MouseEvent): void {\n // Do nothing if no drag is in progress.\n let data = this._dragData;\n if (!data) {\n return;\n }\n\n // Suppress the event during a drag.\n event.preventDefault();\n event.stopPropagation();\n\n // Lookup the tab nodes.\n let tabs = this.contentNode.children;\n\n // Bail early if the drag threshold has not been met.\n if (!data.dragActive && !Private.dragExceeded(data, event)) {\n return;\n }\n\n // Activate the drag if necessary.\n if (!data.dragActive) {\n // Fill in the rest of the drag data measurements.\n let tabRect = data.tab.getBoundingClientRect();\n if (this._orientation === 'horizontal') {\n data.tabPos = data.tab.offsetLeft;\n data.tabSize = tabRect.width;\n data.tabPressPos = data.pressX - tabRect.left;\n } else {\n data.tabPos = data.tab.offsetTop;\n data.tabSize = tabRect.height;\n data.tabPressPos = data.pressY - tabRect.top;\n }\n data.tabPressOffset = {\n x: data.pressX - tabRect.left,\n y: data.pressY - tabRect.top\n };\n data.tabLayout = Private.snapTabLayout(tabs, this._orientation);\n data.contentRect = this.contentNode.getBoundingClientRect();\n data.override = Drag.overrideCursor('default');\n\n // Add the dragging style classes.\n data.tab.classList.add('lm-mod-dragging');\n this.addClass('lm-mod-dragging');\n\n // Mark the drag as active.\n data.dragActive = true;\n }\n\n // Emit the detach requested signal if the threshold is exceeded.\n if (!data.detachRequested && Private.detachExceeded(data, event)) {\n // Only emit the signal once per drag cycle.\n data.detachRequested = true;\n\n // Setup the arguments for the signal.\n let index = data.index;\n let clientX = event.clientX;\n let clientY = event.clientY;\n let tab = tabs[index] as HTMLElement;\n let title = this._titles[index];\n\n // Emit the tab detach requested signal.\n this._tabDetachRequested.emit({\n index,\n title,\n tab,\n clientX,\n clientY,\n offset: data.tabPressOffset\n });\n\n // Bail if the signal handler aborted the drag.\n if (data.dragAborted) {\n return;\n }\n }\n\n // Update the positions of the tabs.\n Private.layoutTabs(tabs, data, event, this._orientation);\n }\n\n /**\n * Handle the `'pointerup'` event for the document.\n */\n private _evtPointerUp(event: PointerEvent | MouseEvent): void {\n // Do nothing if it's not a left or middle mouse release.\n if (event.button !== 0 && event.button !== 1) {\n return;\n }\n\n // Do nothing if no drag is in progress.\n const data = this._dragData;\n if (!data) {\n return;\n }\n\n // Stop the event propagation.\n event.preventDefault();\n event.stopPropagation();\n\n // Remove the extra mouse event listeners.\n this.document.removeEventListener('pointermove', this, true);\n this.document.removeEventListener('pointerup', this, true);\n this.document.removeEventListener('keydown', this, true);\n this.document.removeEventListener('contextmenu', this, true);\n\n // Handle a release when the drag is not active.\n if (!data.dragActive) {\n // Clear the drag data.\n this._dragData = null;\n\n // Handle clicking the add button.\n let addButtonClicked =\n this.addButtonEnabled &&\n this.addButtonNode.contains(event.target as HTMLElement);\n if (addButtonClicked) {\n this._addRequested.emit(undefined);\n return;\n }\n\n // Lookup the tab nodes.\n let tabs = this.contentNode.children;\n\n // Find the index of the released tab.\n let index = ArrayExt.findFirstIndex(tabs, tab => {\n return ElementExt.hitTest(tab, event.clientX, event.clientY);\n });\n\n // Do nothing if the release is not on the original pressed tab.\n if (index !== data.index) {\n return;\n }\n\n // Ignore the release if the title is not closable.\n let title = this._titles[index];\n if (!title.closable) {\n return;\n }\n\n // Emit the close requested signal if the middle button is released.\n if (event.button === 1) {\n this._tabCloseRequested.emit({ index, title });\n return;\n }\n\n // Emit the close requested signal if the close icon was released.\n let icon = tabs[index].querySelector(this.renderer.closeIconSelector);\n if (icon && icon.contains(event.target as HTMLElement)) {\n this._tabCloseRequested.emit({ index, title });\n return;\n }\n\n // Otherwise, there is nothing left to do.\n return;\n }\n\n // Do nothing if the left button is not released.\n if (event.button !== 0) {\n return;\n }\n\n // Position the tab at its final resting position.\n Private.finalizeTabPosition(data, this._orientation);\n\n // Remove the dragging class from the tab so it can be transitioned.\n data.tab.classList.remove('lm-mod-dragging');\n\n // Parse the transition duration for releasing the tab.\n let duration = Private.parseTransitionDuration(data.tab);\n\n // Complete the release on a timer to allow the tab to transition.\n setTimeout(() => {\n // Do nothing if the drag has been aborted.\n if (data.dragAborted) {\n return;\n }\n\n // Clear the drag data reference.\n this._dragData = null;\n\n // Reset the positions of the tabs.\n Private.resetTabPositions(this.contentNode.children, this._orientation);\n\n // Clear the cursor grab.\n data.override!.dispose();\n\n // Remove the remaining dragging style.\n this.removeClass('lm-mod-dragging');\n\n // If the tab was not moved, there is nothing else to do.\n let i = data.index;\n let j = data.targetIndex;\n if (j === -1 || i === j) {\n return;\n }\n\n // Move the title to the new locations.\n ArrayExt.move(this._titles, i, j);\n\n // Adjust the current index for the move.\n this._adjustCurrentForMove(i, j);\n\n // Emit the tab moved signal.\n this._tabMoved.emit({\n fromIndex: i,\n toIndex: j,\n title: this._titles[j]\n });\n\n // Update the tabs immediately to prevent flicker.\n MessageLoop.sendMessage(this, Widget.Msg.UpdateRequest);\n }, duration);\n }\n\n /**\n * Release the mouse and restore the non-dragged tab positions.\n */\n private _releaseMouse(): void {\n // Do nothing if no drag is in progress.\n let data = this._dragData;\n if (!data) {\n return;\n }\n\n // Clear the drag data reference.\n this._dragData = null;\n\n // Remove the extra document event listeners.\n this.document.removeEventListener('pointermove', this, true);\n this.document.removeEventListener('pointerup', this, true);\n this.document.removeEventListener('keydown', this, true);\n this.document.removeEventListener('contextmenu', this, true);\n\n // Indicate the drag has been aborted. This allows the mouse\n // event handlers to return early when the drag is canceled.\n data.dragAborted = true;\n\n // If the drag is not active, there's nothing more to do.\n if (!data.dragActive) {\n return;\n }\n\n // Reset the tabs to their non-dragged positions.\n Private.resetTabPositions(this.contentNode.children, this._orientation);\n\n // Clear the cursor override.\n data.override!.dispose();\n\n // Clear the dragging style classes.\n data.tab.classList.remove('lm-mod-dragging');\n this.removeClass('lm-mod-dragging');\n }\n\n /**\n * Adjust the current index for a tab insert operation.\n *\n * This method accounts for the tab bar's insertion behavior when\n * adjusting the current index and emitting the changed signal.\n */\n private _adjustCurrentForInsert(i: number, title: Title): void {\n // Lookup commonly used variables.\n let ct = this.currentTitle;\n let ci = this._currentIndex;\n let bh = this.insertBehavior;\n\n // TODO: do we need to do an update to update the aria-selected attribute?\n\n // Handle the behavior where the new tab is always selected,\n // or the behavior where the new tab is selected if needed.\n if (bh === 'select-tab' || (bh === 'select-tab-if-needed' && ci === -1)) {\n this._currentIndex = i;\n this._previousTitle = ct;\n this._currentChanged.emit({\n previousIndex: ci,\n previousTitle: ct,\n currentIndex: i,\n currentTitle: title\n });\n return;\n }\n\n // Otherwise, silently adjust the current index if needed.\n if (ci >= i) {\n this._currentIndex++;\n }\n }\n\n /**\n * Adjust the current index for a tab move operation.\n *\n * This method will not cause the actual current tab to change.\n * It silently adjusts the index to account for the given move.\n */\n private _adjustCurrentForMove(i: number, j: number): void {\n if (this._currentIndex === i) {\n this._currentIndex = j;\n } else if (this._currentIndex < i && this._currentIndex >= j) {\n this._currentIndex++;\n } else if (this._currentIndex > i && this._currentIndex <= j) {\n this._currentIndex--;\n }\n }\n\n /**\n * Adjust the current index for a tab remove operation.\n *\n * This method accounts for the tab bar's remove behavior when\n * adjusting the current index and emitting the changed signal.\n */\n private _adjustCurrentForRemove(i: number, title: Title): void {\n // Lookup commonly used variables.\n let ci = this._currentIndex;\n let bh = this.removeBehavior;\n\n // Silently adjust the index if the current tab is not removed.\n if (ci !== i) {\n if (ci > i) {\n this._currentIndex--;\n }\n return;\n }\n\n // TODO: do we need to do an update to adjust the aria-selected value?\n\n // No tab gets selected if the tab bar is empty.\n if (this._titles.length === 0) {\n this._currentIndex = -1;\n this._currentChanged.emit({\n previousIndex: i,\n previousTitle: title,\n currentIndex: -1,\n currentTitle: null\n });\n return;\n }\n\n // Handle behavior where the next sibling tab is selected.\n if (bh === 'select-tab-after') {\n this._currentIndex = Math.min(i, this._titles.length - 1);\n this._currentChanged.emit({\n previousIndex: i,\n previousTitle: title,\n currentIndex: this._currentIndex,\n currentTitle: this.currentTitle\n });\n return;\n }\n\n // Handle behavior where the previous sibling tab is selected.\n if (bh === 'select-tab-before') {\n this._currentIndex = Math.max(0, i - 1);\n this._currentChanged.emit({\n previousIndex: i,\n previousTitle: title,\n currentIndex: this._currentIndex,\n currentTitle: this.currentTitle\n });\n return;\n }\n\n // Handle behavior where the previous history tab is selected.\n if (bh === 'select-previous-tab') {\n if (this._previousTitle) {\n this._currentIndex = this._titles.indexOf(this._previousTitle);\n this._previousTitle = null;\n } else {\n this._currentIndex = Math.min(i, this._titles.length - 1);\n }\n this._currentChanged.emit({\n previousIndex: i,\n previousTitle: title,\n currentIndex: this._currentIndex,\n currentTitle: this.currentTitle\n });\n return;\n }\n\n // Otherwise, no tab gets selected.\n this._currentIndex = -1;\n this._currentChanged.emit({\n previousIndex: i,\n previousTitle: title,\n currentIndex: -1,\n currentTitle: null\n });\n }\n\n /**\n * Handle the `changed` signal of a title object.\n */\n private _onTitleChanged(sender: Title): void {\n this.update();\n }\n\n private _name: string;\n private _currentIndex = -1;\n private _titles: Title[] = [];\n private _orientation: TabBar.Orientation;\n private _document: Document | ShadowRoot;\n private _titlesEditable: boolean = false;\n private _previousTitle: Title | null = null;\n private _dragData: Private.IDragData | null = null;\n private _addButtonEnabled: boolean = false;\n private _tabMoved = new Signal>(this);\n private _currentChanged = new Signal>(\n this\n );\n private _addRequested = new Signal(this);\n private _tabCloseRequested = new Signal<\n this,\n TabBar.ITabCloseRequestedArgs\n >(this);\n private _tabDetachRequested = new Signal<\n this,\n TabBar.ITabDetachRequestedArgs\n >(this);\n private _tabActivateRequested = new Signal<\n this,\n TabBar.ITabActivateRequestedArgs\n >(this);\n}\n\n/**\n * The namespace for the `TabBar` class statics.\n */\nexport namespace TabBar {\n /**\n * A type alias for a tab bar orientation.\n */\n export type Orientation =\n | /**\n * The tabs are arranged in a single row, left-to-right.\n *\n * The tab text orientation is horizontal.\n */\n 'horizontal'\n\n /**\n * The tabs are arranged in a single column, top-to-bottom.\n *\n * The tab text orientation is horizontal.\n */\n | 'vertical';\n\n /**\n * A type alias for the selection behavior on tab insert.\n */\n export type InsertBehavior =\n | /**\n * The selected tab will not be changed.\n */\n 'none'\n\n /**\n * The inserted tab will be selected.\n */\n | 'select-tab'\n\n /**\n * The inserted tab will be selected if the current tab is null.\n */\n | 'select-tab-if-needed';\n\n /**\n * A type alias for the selection behavior on tab remove.\n */\n export type RemoveBehavior =\n | /**\n * No tab will be selected.\n */\n 'none'\n\n /**\n * The tab after the removed tab will be selected if possible.\n */\n | 'select-tab-after'\n\n /**\n * The tab before the removed tab will be selected if possible.\n */\n | 'select-tab-before'\n\n /**\n * The previously selected tab will be selected if possible.\n */\n | 'select-previous-tab';\n\n /**\n * An options object for creating a tab bar.\n */\n export interface IOptions {\n /**\n * The document to use with the tab bar.\n *\n * The default is the global `document` instance.\n */\n\n document?: Document | ShadowRoot;\n\n /**\n * Name of the tab bar.\n *\n * This is used for accessibility reasons. The default is the empty string.\n */\n name?: string;\n\n /**\n * The layout orientation of the tab bar.\n *\n * The default is `horizontal`.\n */\n orientation?: TabBar.Orientation;\n\n /**\n * Whether the tabs are movable by the user.\n *\n * The default is `false`.\n */\n tabsMovable?: boolean;\n\n /**\n * Whether a tab can be deselected by the user.\n *\n * The default is `false`.\n */\n allowDeselect?: boolean;\n\n /**\n * Whether the titles can be directly edited by the user.\n *\n * The default is `false`.\n */\n titlesEditable?: boolean;\n\n /**\n * Whether the add button is enabled.\n *\n * The default is `false`.\n */\n addButtonEnabled?: boolean;\n\n /**\n * The selection behavior when inserting a tab.\n *\n * The default is `'select-tab-if-needed'`.\n */\n insertBehavior?: TabBar.InsertBehavior;\n\n /**\n * The selection behavior when removing a tab.\n *\n * The default is `'select-tab-after'`.\n */\n removeBehavior?: TabBar.RemoveBehavior;\n\n /**\n * A renderer to use with the tab bar.\n *\n * The default is a shared renderer instance.\n */\n renderer?: IRenderer;\n }\n\n /**\n * The arguments object for the `currentChanged` signal.\n */\n export interface ICurrentChangedArgs {\n /**\n * The previously selected index.\n */\n readonly previousIndex: number;\n\n /**\n * The previously selected title.\n */\n readonly previousTitle: Title | null;\n\n /**\n * The currently selected index.\n */\n readonly currentIndex: number;\n\n /**\n * The currently selected title.\n */\n readonly currentTitle: Title | null;\n }\n\n /**\n * The arguments object for the `tabMoved` signal.\n */\n export interface ITabMovedArgs {\n /**\n * The previous index of the tab.\n */\n readonly fromIndex: number;\n\n /**\n * The current index of the tab.\n */\n readonly toIndex: number;\n\n /**\n * The title for the tab.\n */\n readonly title: Title;\n }\n\n /**\n * The arguments object for the `tabActivateRequested` signal.\n */\n export interface ITabActivateRequestedArgs {\n /**\n * The index of the tab to activate.\n */\n readonly index: number;\n\n /**\n * The title for the tab.\n */\n readonly title: Title;\n }\n\n /**\n * The arguments object for the `tabCloseRequested` signal.\n */\n export interface ITabCloseRequestedArgs {\n /**\n * The index of the tab to close.\n */\n readonly index: number;\n\n /**\n * The title for the tab.\n */\n readonly title: Title;\n }\n\n /**\n * The arguments object for the `tabDetachRequested` signal.\n */\n export interface ITabDetachRequestedArgs {\n /**\n * The index of the tab to detach.\n */\n readonly index: number;\n\n /**\n * The title for the tab.\n */\n readonly title: Title;\n\n /**\n * The node representing the tab.\n */\n readonly tab: HTMLElement;\n\n /**\n * The current client X position of the mouse.\n */\n readonly clientX: number;\n\n /**\n * The current client Y position of the mouse.\n */\n readonly clientY: number;\n\n /**\n * The mouse position in the tab coordinate.\n */\n readonly offset?: { x: number; y: number };\n }\n\n /**\n * An object which holds the data to render a tab.\n */\n export interface IRenderData {\n /**\n * The title associated with the tab.\n */\n readonly title: Title;\n\n /**\n * Whether the tab is the current tab.\n */\n readonly current: boolean;\n\n /**\n * The z-index for the tab.\n */\n readonly zIndex: number;\n\n /**\n * The tabindex value for the tab.\n */\n readonly tabIndex?: number;\n }\n\n /**\n * A renderer for use with a tab bar.\n */\n export interface IRenderer {\n /**\n * A selector which matches the close icon node in a tab.\n */\n readonly closeIconSelector: string;\n\n /**\n * Render the virtual element for a tab.\n *\n * @param data - The data to use for rendering the tab.\n *\n * @returns A virtual element representing the tab.\n */\n renderTab(data: IRenderData): VirtualElement;\n }\n\n /**\n * The default implementation of `IRenderer`.\n *\n * #### Notes\n * Subclasses are free to reimplement rendering methods as needed.\n */\n export class Renderer implements IRenderer {\n constructor() {\n this._uuid = ++Renderer._nInstance;\n }\n /**\n * A selector which matches the close icon node in a tab.\n */\n readonly closeIconSelector = '.lm-TabBar-tabCloseIcon';\n\n /**\n * Render the virtual element for a tab.\n *\n * @param data - The data to use for rendering the tab.\n *\n * @returns A virtual element representing the tab.\n */\n renderTab(data: IRenderData): VirtualElement {\n let title = data.title.caption;\n let key = this.createTabKey(data);\n let id = key;\n let style = this.createTabStyle(data);\n let className = this.createTabClass(data);\n let dataset = this.createTabDataset(data);\n let aria = this.createTabARIA(data);\n if (data.title.closable) {\n return h.li(\n { id, key, className, title, style, dataset, ...aria },\n this.renderIcon(data),\n this.renderLabel(data),\n this.renderCloseIcon(data)\n );\n } else {\n return h.li(\n { id, key, className, title, style, dataset, ...aria },\n this.renderIcon(data),\n this.renderLabel(data)\n );\n }\n }\n\n /**\n * Render the icon element for a tab.\n *\n * @param data - The data to use for rendering the tab.\n *\n * @returns A virtual element representing the tab icon.\n */\n renderIcon(data: IRenderData): VirtualElement {\n const { title } = data;\n let className = this.createIconClass(data);\n\n // If title.icon is undefined, it will be ignored.\n return h.div({ className }, title.icon!, title.iconLabel);\n }\n\n /**\n * Render the label element for a tab.\n *\n * @param data - The data to use for rendering the tab.\n *\n * @returns A virtual element representing the tab label.\n */\n renderLabel(data: IRenderData): VirtualElement {\n return h.div({ className: 'lm-TabBar-tabLabel' }, data.title.label);\n }\n\n /**\n * Render the close icon element for a tab.\n *\n * @param data - The data to use for rendering the tab.\n *\n * @returns A virtual element representing the tab close icon.\n */\n renderCloseIcon(data: IRenderData): VirtualElement {\n return h.div({ className: 'lm-TabBar-tabCloseIcon' });\n }\n\n /**\n * Create a unique render key for the tab.\n *\n * @param data - The data to use for the tab.\n *\n * @returns The unique render key for the tab.\n *\n * #### Notes\n * This method caches the key against the tab title the first time\n * the key is generated. This enables efficient rendering of moved\n * tabs and avoids subtle hover style artifacts.\n */\n createTabKey(data: IRenderData): string {\n let key = this._tabKeys.get(data.title);\n if (key === undefined) {\n key = `tab-key-${this._uuid}-${this._tabID++}`;\n this._tabKeys.set(data.title, key);\n }\n return key;\n }\n\n /**\n * Create the inline style object for a tab.\n *\n * @param data - The data to use for the tab.\n *\n * @returns The inline style data for the tab.\n */\n createTabStyle(data: IRenderData): ElementInlineStyle {\n return { zIndex: `${data.zIndex}` };\n }\n\n /**\n * Create the class name for the tab.\n *\n * @param data - The data to use for the tab.\n *\n * @returns The full class name for the tab.\n */\n createTabClass(data: IRenderData): string {\n let name = 'lm-TabBar-tab';\n if (data.title.className) {\n name += ` ${data.title.className}`;\n }\n if (data.title.closable) {\n name += ' lm-mod-closable';\n }\n if (data.current) {\n name += ' lm-mod-current';\n }\n return name;\n }\n\n /**\n * Create the dataset for a tab.\n *\n * @param data - The data to use for the tab.\n *\n * @returns The dataset for the tab.\n */\n createTabDataset(data: IRenderData): ElementDataset {\n return data.title.dataset;\n }\n\n /**\n * Create the ARIA attributes for a tab.\n *\n * @param data - The data to use for the tab.\n *\n * @returns The ARIA attributes for the tab.\n */\n createTabARIA(data: IRenderData): ElementARIAAttrs | ElementBaseAttrs {\n return {\n role: 'tab',\n 'aria-selected': data.current.toString(),\n tabindex: `${data.tabIndex ?? '-1'}`\n };\n }\n\n /**\n * Create the class name for the tab icon.\n *\n * @param data - The data to use for the tab.\n *\n * @returns The full class name for the tab icon.\n */\n createIconClass(data: IRenderData): string {\n let name = 'lm-TabBar-tabIcon';\n let extra = data.title.iconClass;\n return extra ? `${name} ${extra}` : name;\n }\n\n private static _nInstance = 0;\n private readonly _uuid: number;\n private _tabID = 0;\n private _tabKeys = new WeakMap, string>();\n }\n\n /**\n * The default `Renderer` instance.\n */\n export const defaultRenderer = new Renderer();\n\n /**\n * A selector which matches the add button node in the tab bar.\n */\n export const addButtonSelector = '.lm-TabBar-addButton';\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * The start drag distance threshold.\n */\n export const DRAG_THRESHOLD = 5;\n\n /**\n * The detach distance threshold.\n */\n export const DETACH_THRESHOLD = 20;\n\n /**\n * A struct which holds the drag data for a tab bar.\n */\n export interface IDragData {\n /**\n * The tab node being dragged.\n */\n tab: HTMLElement;\n\n /**\n * The index of the tab being dragged.\n */\n index: number;\n\n /**\n * The mouse press client X position.\n */\n pressX: number;\n\n /**\n * The mouse press client Y position.\n */\n pressY: number;\n\n /**\n * The offset left/top of the tab being dragged.\n *\n * This will be `-1` if the drag is not active.\n */\n tabPos: number;\n\n /**\n * The offset width/height of the tab being dragged.\n *\n * This will be `-1` if the drag is not active.\n */\n tabSize: number;\n\n /**\n * The original mouse X/Y position in tab coordinates.\n *\n * This will be `-1` if the drag is not active.\n */\n tabPressPos: number;\n\n /**\n * The original mouse position in tab coordinates.\n *\n * This is undefined if the drag is not active.\n */\n tabPressOffset?: { x: number; y: number };\n\n /**\n * The tab target index upon mouse release.\n *\n * This will be `-1` if the drag is not active.\n */\n targetIndex: number;\n\n /**\n * The array of tab layout objects snapped at drag start.\n *\n * This will be `null` if the drag is not active.\n */\n tabLayout: ITabLayout[] | null;\n\n /**\n * The bounding client rect of the tab bar content node.\n *\n * This will be `null` if the drag is not active.\n */\n contentRect: DOMRect | null;\n\n /**\n * The disposable to clean up the cursor override.\n *\n * This will be `null` if the drag is not active.\n */\n override: IDisposable | null;\n\n /**\n * Whether the drag is currently active.\n */\n dragActive: boolean;\n\n /**\n * Whether the drag has been aborted.\n */\n dragAborted: boolean;\n\n /**\n * Whether a detach request as been made.\n */\n detachRequested: boolean;\n }\n\n /**\n * An object which holds layout data for a tab.\n */\n export interface ITabLayout {\n /**\n * The left/top margin value for the tab.\n */\n margin: number;\n\n /**\n * The offset left/top position of the tab.\n */\n pos: number;\n\n /**\n * The offset width/height of the tab.\n */\n size: number;\n }\n\n /**\n * Create the DOM node for a tab bar.\n */\n export function createNode(): HTMLDivElement {\n let node = document.createElement('div');\n let content = document.createElement('ul');\n content.setAttribute('role', 'tablist');\n content.className = 'lm-TabBar-content';\n node.appendChild(content);\n\n let add = document.createElement('div');\n add.className = 'lm-TabBar-addButton lm-mod-hidden';\n add.setAttribute('tabindex', '-1');\n add.setAttribute('role', 'button');\n node.appendChild(add);\n return node;\n }\n\n /**\n * Coerce a title or options into a real title.\n */\n export function asTitle(value: Title | Title.IOptions): Title {\n return value instanceof Title ? value : new Title(value);\n }\n\n /**\n * Parse the transition duration for a tab node.\n */\n export function parseTransitionDuration(tab: HTMLElement): number {\n let style = window.getComputedStyle(tab);\n return 1000 * (parseFloat(style.transitionDuration!) || 0);\n }\n\n /**\n * Get a snapshot of the current tab layout values.\n */\n export function snapTabLayout(\n tabs: HTMLCollection,\n orientation: TabBar.Orientation\n ): ITabLayout[] {\n let layout = new Array(tabs.length);\n for (let i = 0, n = tabs.length; i < n; ++i) {\n let node = tabs[i] as HTMLElement;\n let style = window.getComputedStyle(node);\n if (orientation === 'horizontal') {\n layout[i] = {\n pos: node.offsetLeft,\n size: node.offsetWidth,\n margin: parseFloat(style.marginLeft!) || 0\n };\n } else {\n layout[i] = {\n pos: node.offsetTop,\n size: node.offsetHeight,\n margin: parseFloat(style.marginTop!) || 0\n };\n }\n }\n return layout;\n }\n\n /**\n * Test if the event exceeds the drag threshold.\n */\n export function dragExceeded(data: IDragData, event: MouseEvent): boolean {\n let dx = Math.abs(event.clientX - data.pressX);\n let dy = Math.abs(event.clientY - data.pressY);\n return dx >= DRAG_THRESHOLD || dy >= DRAG_THRESHOLD;\n }\n\n /**\n * Test if the event exceeds the drag detach threshold.\n */\n export function detachExceeded(data: IDragData, event: MouseEvent): boolean {\n let rect = data.contentRect!;\n return (\n event.clientX < rect.left - DETACH_THRESHOLD ||\n event.clientX >= rect.right + DETACH_THRESHOLD ||\n event.clientY < rect.top - DETACH_THRESHOLD ||\n event.clientY >= rect.bottom + DETACH_THRESHOLD\n );\n }\n\n /**\n * Update the relative tab positions and computed target index.\n */\n export function layoutTabs(\n tabs: HTMLCollection,\n data: IDragData,\n event: MouseEvent,\n orientation: TabBar.Orientation\n ): void {\n // Compute the orientation-sensitive values.\n let pressPos: number;\n let localPos: number;\n let clientPos: number;\n let clientSize: number;\n if (orientation === 'horizontal') {\n pressPos = data.pressX;\n localPos = event.clientX - data.contentRect!.left;\n clientPos = event.clientX;\n clientSize = data.contentRect!.width;\n } else {\n pressPos = data.pressY;\n localPos = event.clientY - data.contentRect!.top;\n clientPos = event.clientY;\n clientSize = data.contentRect!.height;\n }\n\n // Compute the target data.\n let targetIndex = data.index;\n let targetPos = localPos - data.tabPressPos;\n let targetEnd = targetPos + data.tabSize;\n\n // Update the relative tab positions.\n for (let i = 0, n = tabs.length; i < n; ++i) {\n let pxPos: string;\n let layout = data.tabLayout![i];\n let threshold = layout.pos + (layout.size >> 1);\n if (i < data.index && targetPos < threshold) {\n pxPos = `${data.tabSize + data.tabLayout![i + 1].margin}px`;\n targetIndex = Math.min(targetIndex, i);\n } else if (i > data.index && targetEnd > threshold) {\n pxPos = `${-data.tabSize - layout.margin}px`;\n targetIndex = Math.max(targetIndex, i);\n } else if (i === data.index) {\n let ideal = clientPos - pressPos;\n let limit = clientSize - (data.tabPos + data.tabSize);\n pxPos = `${Math.max(-data.tabPos, Math.min(ideal, limit))}px`;\n } else {\n pxPos = '';\n }\n if (orientation === 'horizontal') {\n (tabs[i] as HTMLElement).style.left = pxPos;\n } else {\n (tabs[i] as HTMLElement).style.top = pxPos;\n }\n }\n\n // Update the computed target index.\n data.targetIndex = targetIndex;\n }\n\n /**\n * Position the drag tab at its final resting relative position.\n */\n export function finalizeTabPosition(\n data: IDragData,\n orientation: TabBar.Orientation\n ): void {\n // Compute the orientation-sensitive client size.\n let clientSize: number;\n if (orientation === 'horizontal') {\n clientSize = data.contentRect!.width;\n } else {\n clientSize = data.contentRect!.height;\n }\n\n // Compute the ideal final tab position.\n let ideal: number;\n if (data.targetIndex === data.index) {\n ideal = 0;\n } else if (data.targetIndex > data.index) {\n let tgt = data.tabLayout![data.targetIndex];\n ideal = tgt.pos + tgt.size - data.tabSize - data.tabPos;\n } else {\n let tgt = data.tabLayout![data.targetIndex];\n ideal = tgt.pos - data.tabPos;\n }\n\n // Compute the tab position limit.\n let limit = clientSize - (data.tabPos + data.tabSize);\n let final = Math.max(-data.tabPos, Math.min(ideal, limit));\n\n // Set the final orientation-sensitive position.\n if (orientation === 'horizontal') {\n data.tab.style.left = `${final}px`;\n } else {\n data.tab.style.top = `${final}px`;\n }\n }\n\n /**\n * Reset the relative positions of the given tabs.\n */\n export function resetTabPositions(\n tabs: HTMLCollection,\n orientation: TabBar.Orientation\n ): void {\n for (const tab of tabs) {\n if (orientation === 'horizontal') {\n (tab as HTMLElement).style.left = '';\n } else {\n (tab as HTMLElement).style.top = '';\n }\n }\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt, empty } from '@lumino/algorithm';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { BoxEngine, BoxSizer } from './boxengine';\n\nimport { Layout, LayoutItem } from './layout';\n\nimport { TabBar } from './tabbar';\n\nimport Utils from './utils';\n\nimport { Widget } from './widget';\n\n/**\n * A layout which provides a flexible docking arrangement.\n *\n * #### Notes\n * The consumer of this layout is responsible for handling all signals\n * from the generated tab bars and managing the visibility of widgets\n * and tab bars as needed.\n */\nexport class DockLayout extends Layout {\n /**\n * Construct a new dock layout.\n *\n * @param options - The options for initializing the layout.\n */\n constructor(options: DockLayout.IOptions) {\n super();\n this.renderer = options.renderer;\n if (options.spacing !== undefined) {\n this._spacing = Utils.clampDimension(options.spacing);\n }\n this._document = options.document || document;\n this._hiddenMode =\n options.hiddenMode !== undefined\n ? options.hiddenMode\n : Widget.HiddenMode.Display;\n }\n\n /**\n * Dispose of the resources held by the layout.\n *\n * #### Notes\n * This will clear and dispose all widgets in the layout.\n */\n dispose(): void {\n // Get an iterator over the widgets in the layout.\n let widgets = this[Symbol.iterator]();\n\n // Dispose of the layout items.\n this._items.forEach(item => {\n item.dispose();\n });\n\n // Clear the layout state before disposing the widgets.\n this._box = null;\n this._root = null;\n this._items.clear();\n\n // Dispose of the widgets contained in the old layout root.\n for (const widget of widgets) {\n widget.dispose();\n }\n\n // Dispose of the base class.\n super.dispose();\n }\n\n /**\n * The renderer used by the dock layout.\n */\n readonly renderer: DockLayout.IRenderer;\n\n /**\n * The method for hiding child widgets.\n *\n * #### Notes\n * If there is only one child widget, `Display` hiding mode will be used\n * regardless of this setting.\n */\n get hiddenMode(): Widget.HiddenMode {\n return this._hiddenMode;\n }\n set hiddenMode(v: Widget.HiddenMode) {\n if (this._hiddenMode === v) {\n return;\n }\n this._hiddenMode = v;\n for (const bar of this.tabBars()) {\n if (bar.titles.length > 1) {\n for (const title of bar.titles) {\n title.owner.hiddenMode = this._hiddenMode;\n }\n }\n }\n }\n\n /**\n * Get the inter-element spacing for the dock layout.\n */\n get spacing(): number {\n return this._spacing;\n }\n\n /**\n * Set the inter-element spacing for the dock layout.\n */\n set spacing(value: number) {\n value = Utils.clampDimension(value);\n if (this._spacing === value) {\n return;\n }\n this._spacing = value;\n if (!this.parent) {\n return;\n }\n this.parent.fit();\n }\n\n /**\n * Whether the dock layout is empty.\n */\n get isEmpty(): boolean {\n return this._root === null;\n }\n\n /**\n * Create an iterator over all widgets in the layout.\n *\n * @returns A new iterator over the widgets in the layout.\n *\n * #### Notes\n * This iterator includes the generated tab bars.\n */\n [Symbol.iterator](): IterableIterator {\n return this._root ? this._root.iterAllWidgets() : empty();\n }\n\n /**\n * Create an iterator over the user widgets in the layout.\n *\n * @returns A new iterator over the user widgets in the layout.\n *\n * #### Notes\n * This iterator does not include the generated tab bars.\n */\n widgets(): IterableIterator {\n return this._root ? this._root.iterUserWidgets() : empty();\n }\n\n /**\n * Create an iterator over the selected widgets in the layout.\n *\n * @returns A new iterator over the selected user widgets.\n *\n * #### Notes\n * This iterator yields the widgets corresponding to the current tab\n * of each tab bar in the layout.\n */\n selectedWidgets(): IterableIterator {\n return this._root ? this._root.iterSelectedWidgets() : empty();\n }\n\n /**\n * Create an iterator over the tab bars in the layout.\n *\n * @returns A new iterator over the tab bars in the layout.\n *\n * #### Notes\n * This iterator does not include the user widgets.\n */\n tabBars(): IterableIterator> {\n return this._root ? this._root.iterTabBars() : empty();\n }\n\n /**\n * Create an iterator over the handles in the layout.\n *\n * @returns A new iterator over the handles in the layout.\n */\n handles(): IterableIterator {\n return this._root ? this._root.iterHandles() : empty();\n }\n\n /**\n * Move a handle to the given offset position.\n *\n * @param handle - The handle to move.\n *\n * @param offsetX - The desired offset X position of the handle.\n *\n * @param offsetY - The desired offset Y position of the handle.\n *\n * #### Notes\n * If the given handle is not contained in the layout, this is no-op.\n *\n * The handle will be moved as close as possible to the desired\n * position without violating any of the layout constraints.\n *\n * Only one of the coordinates is used depending on the orientation\n * of the handle. This method accepts both coordinates to make it\n * easy to invoke from a mouse move event without needing to know\n * the handle orientation.\n */\n moveHandle(handle: HTMLDivElement, offsetX: number, offsetY: number): void {\n // Bail early if there is no root or if the handle is hidden.\n let hidden = handle.classList.contains('lm-mod-hidden');\n if (!this._root || hidden) {\n return;\n }\n\n // Lookup the split node for the handle.\n let data = this._root.findSplitNode(handle);\n if (!data) {\n return;\n }\n\n // Compute the desired delta movement for the handle.\n let delta: number;\n if (data.node.orientation === 'horizontal') {\n delta = offsetX - handle.offsetLeft;\n } else {\n delta = offsetY - handle.offsetTop;\n }\n\n // Bail if there is no handle movement.\n if (delta === 0) {\n return;\n }\n\n // Prevent sibling resizing unless needed.\n data.node.holdSizes();\n\n // Adjust the sizers to reflect the handle movement.\n BoxEngine.adjust(data.node.sizers, data.index, delta);\n\n // Update the layout of the widgets.\n if (this.parent) {\n this.parent.update();\n }\n }\n\n /**\n * Save the current configuration of the dock layout.\n *\n * @returns A new config object for the current layout state.\n *\n * #### Notes\n * The return value can be provided to the `restoreLayout` method\n * in order to restore the layout to its current configuration.\n */\n saveLayout(): DockLayout.ILayoutConfig {\n // Bail early if there is no root.\n if (!this._root) {\n return { main: null };\n }\n\n // Hold the current sizes in the layout tree.\n this._root.holdAllSizes();\n\n // Return the layout config.\n return { main: this._root.createConfig() };\n }\n\n /**\n * Restore the layout to a previously saved configuration.\n *\n * @param config - The layout configuration to restore.\n *\n * #### Notes\n * Widgets which currently belong to the layout but which are not\n * contained in the config will be unparented.\n */\n restoreLayout(config: DockLayout.ILayoutConfig): void {\n // Create the widget set for validating the config.\n let widgetSet = new Set();\n\n // Normalize the main area config and collect the widgets.\n let mainConfig: DockLayout.AreaConfig | null;\n if (config.main) {\n mainConfig = Private.normalizeAreaConfig(config.main, widgetSet);\n } else {\n mainConfig = null;\n }\n\n // Create iterators over the old content.\n let oldWidgets = this.widgets();\n let oldTabBars = this.tabBars();\n let oldHandles = this.handles();\n\n // Clear the root before removing the old content.\n this._root = null;\n\n // Unparent the old widgets which are not in the new config.\n for (const widget of oldWidgets) {\n if (!widgetSet.has(widget)) {\n widget.parent = null;\n }\n }\n\n // Dispose of the old tab bars.\n for (const tabBar of oldTabBars) {\n tabBar.dispose();\n }\n\n // Remove the old handles.\n for (const handle of oldHandles) {\n if (handle.parentNode) {\n handle.parentNode.removeChild(handle);\n }\n }\n\n // Reparent the new widgets to the current parent.\n for (const widget of widgetSet) {\n widget.parent = this.parent;\n }\n\n // Create the root node for the new config.\n if (mainConfig) {\n this._root = Private.realizeAreaConfig(\n mainConfig,\n {\n // Ignoring optional `document` argument as we must reuse `this._document`\n createTabBar: (document?: Document | ShadowRoot) =>\n this._createTabBar(),\n createHandle: () => this._createHandle()\n },\n this._document\n );\n } else {\n this._root = null;\n }\n\n // If there is no parent, there is nothing more to do.\n if (!this.parent) {\n return;\n }\n\n // Attach the new widgets to the parent.\n widgetSet.forEach(widget => {\n this.attachWidget(widget);\n });\n\n // Post a fit request to the parent.\n this.parent.fit();\n }\n\n /**\n * Add a widget to the dock layout.\n *\n * @param widget - The widget to add to the dock layout.\n *\n * @param options - The additional options for adding the widget.\n *\n * #### Notes\n * The widget will be moved if it is already contained in the layout.\n *\n * An error will be thrown if the reference widget is invalid.\n */\n addWidget(widget: Widget, options: DockLayout.IAddOptions = {}): void {\n // Parse the options.\n let ref = options.ref || null;\n let mode = options.mode || 'tab-after';\n\n // Find the tab node which holds the reference widget.\n let refNode: Private.TabLayoutNode | null = null;\n if (this._root && ref) {\n refNode = this._root.findTabNode(ref);\n }\n\n // Throw an error if the reference widget is invalid.\n if (ref && !refNode) {\n throw new Error('Reference widget is not in the layout.');\n }\n\n // Reparent the widget to the current layout parent.\n widget.parent = this.parent;\n\n // Insert the widget according to the insert mode.\n switch (mode) {\n case 'tab-after':\n this._insertTab(widget, ref, refNode, true);\n break;\n case 'tab-before':\n this._insertTab(widget, ref, refNode, false);\n break;\n case 'split-top':\n this._insertSplit(widget, ref, refNode, 'vertical', false);\n break;\n case 'split-left':\n this._insertSplit(widget, ref, refNode, 'horizontal', false);\n break;\n case 'split-right':\n this._insertSplit(widget, ref, refNode, 'horizontal', true);\n break;\n case 'split-bottom':\n this._insertSplit(widget, ref, refNode, 'vertical', true);\n break;\n case 'merge-top':\n this._insertSplit(widget, ref, refNode, 'vertical', false, true);\n break;\n case 'merge-left':\n this._insertSplit(widget, ref, refNode, 'horizontal', false, true);\n break;\n case 'merge-right':\n this._insertSplit(widget, ref, refNode, 'horizontal', true, true);\n break;\n case 'merge-bottom':\n this._insertSplit(widget, ref, refNode, 'vertical', true, true);\n break;\n }\n\n // Do nothing else if there is no parent widget.\n if (!this.parent) {\n return;\n }\n\n // Ensure the widget is attached to the parent widget.\n this.attachWidget(widget);\n\n // Post a fit request for the parent widget.\n this.parent.fit();\n }\n\n /**\n * Remove a widget from the layout.\n *\n * @param widget - The widget to remove from the layout.\n *\n * #### Notes\n * A widget is automatically removed from the layout when its `parent`\n * is set to `null`. This method should only be invoked directly when\n * removing a widget from a layout which has yet to be installed on a\n * parent widget.\n *\n * This method does *not* modify the widget's `parent`.\n */\n removeWidget(widget: Widget): void {\n // Remove the widget from its current layout location.\n this._removeWidget(widget);\n\n // Do nothing else if there is no parent widget.\n if (!this.parent) {\n return;\n }\n\n // Detach the widget from the parent widget.\n this.detachWidget(widget);\n\n // Post a fit request for the parent widget.\n this.parent.fit();\n }\n\n /**\n * Find the tab area which contains the given client position.\n *\n * @param clientX - The client X position of interest.\n *\n * @param clientY - The client Y position of interest.\n *\n * @returns The geometry of the tab area at the given position, or\n * `null` if there is no tab area at the given position.\n */\n hitTestTabAreas(\n clientX: number,\n clientY: number\n ): DockLayout.ITabAreaGeometry | null {\n // Bail early if hit testing cannot produce valid results.\n if (!this._root || !this.parent || !this.parent.isVisible) {\n return null;\n }\n\n // Ensure the parent box sizing data is computed.\n if (!this._box) {\n this._box = ElementExt.boxSizing(this.parent.node);\n }\n\n // Convert from client to local coordinates.\n let rect = this.parent.node.getBoundingClientRect();\n let x = clientX - rect.left - this._box.borderLeft;\n let y = clientY - rect.top - this._box.borderTop;\n\n // Find the tab layout node at the local position.\n let tabNode = this._root.hitTestTabNodes(x, y);\n\n // Bail if a tab layout node was not found.\n if (!tabNode) {\n return null;\n }\n\n // Extract the data from the tab node.\n let { tabBar, top, left, width, height } = tabNode;\n\n // Compute the right and bottom edges of the tab area.\n let borderWidth = this._box.borderLeft + this._box.borderRight;\n let borderHeight = this._box.borderTop + this._box.borderBottom;\n let right = rect.width - borderWidth - (left + width);\n let bottom = rect.height - borderHeight - (top + height);\n\n // Return the hit test results.\n return { tabBar, x, y, top, left, right, bottom, width, height };\n }\n\n /**\n * Perform layout initialization which requires the parent widget.\n */\n protected init(): void {\n // Perform superclass initialization.\n super.init();\n\n // Attach each widget to the parent.\n for (const widget of this) {\n this.attachWidget(widget);\n }\n\n // Attach each handle to the parent.\n for (const handle of this.handles()) {\n this.parent!.node.appendChild(handle);\n }\n\n // Post a fit request for the parent widget.\n this.parent!.fit();\n }\n\n /**\n * Attach the widget to the layout parent widget.\n *\n * @param widget - The widget to attach to the parent.\n *\n * #### Notes\n * This is a no-op if the widget is already attached.\n */\n protected attachWidget(widget: Widget): void {\n // Do nothing if the widget is already attached.\n if (this.parent!.node === widget.node.parentNode) {\n return;\n }\n\n // Create the layout item for the widget.\n this._items.set(widget, new LayoutItem(widget));\n\n // Send a `'before-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n }\n\n // Add the widget's node to the parent.\n this.parent!.node.appendChild(widget.node);\n\n // Send an `'after-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n }\n\n /**\n * Detach the widget from the layout parent widget.\n *\n * @param widget - The widget to detach from the parent.\n *\n * #### Notes\n * This is a no-op if the widget is not attached.\n */\n protected detachWidget(widget: Widget): void {\n // Do nothing if the widget is not attached.\n if (this.parent!.node !== widget.node.parentNode) {\n return;\n }\n\n // Send a `'before-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n }\n\n // Remove the widget's node from the parent.\n this.parent!.node.removeChild(widget.node);\n\n // Send an `'after-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n\n // Delete the layout item for the widget.\n let item = this._items.get(widget);\n if (item) {\n this._items.delete(widget);\n item.dispose();\n }\n }\n\n /**\n * A message handler invoked on a `'before-show'` message.\n */\n protected onBeforeShow(msg: Message): void {\n super.onBeforeShow(msg);\n this.parent!.update();\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n super.onBeforeAttach(msg);\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-shown'` message.\n */\n protected onChildShown(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-hidden'` message.\n */\n protected onChildHidden(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'resize'` message.\n */\n protected onResize(msg: Widget.ResizeMessage): void {\n if (this.parent!.isVisible) {\n this._update(msg.width, msg.height);\n }\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n protected onUpdateRequest(msg: Message): void {\n if (this.parent!.isVisible) {\n this._update(-1, -1);\n }\n }\n\n /**\n * A message handler invoked on a `'fit-request'` message.\n */\n protected onFitRequest(msg: Message): void {\n if (this.parent!.isAttached) {\n this._fit();\n }\n }\n\n /**\n * Remove the specified widget from the layout structure.\n *\n * #### Notes\n * This is a no-op if the widget is not in the layout tree.\n *\n * This does not detach the widget from the parent node.\n */\n private _removeWidget(widget: Widget): void {\n // Bail early if there is no layout root.\n if (!this._root) {\n return;\n }\n\n // Find the tab node which contains the given widget.\n let tabNode = this._root.findTabNode(widget);\n\n // Bail early if the tab node is not found.\n if (!tabNode) {\n return;\n }\n\n Private.removeAria(widget);\n\n // If there are multiple tabs, just remove the widget's tab.\n if (tabNode.tabBar.titles.length > 1) {\n tabNode.tabBar.removeTab(widget.title);\n if (\n this._hiddenMode === Widget.HiddenMode.Scale &&\n tabNode.tabBar.titles.length == 1\n ) {\n const existingWidget = tabNode.tabBar.titles[0].owner;\n existingWidget.hiddenMode = Widget.HiddenMode.Display;\n }\n return;\n }\n\n // Otherwise, the tab node needs to be removed...\n\n // Dispose the tab bar.\n tabNode.tabBar.dispose();\n\n // Handle the case where the tab node is the root.\n if (this._root === tabNode) {\n this._root = null;\n return;\n }\n\n // Otherwise, remove the tab node from its parent...\n\n // Prevent widget resizing unless needed.\n this._root.holdAllSizes();\n\n // Clear the parent reference on the tab node.\n let splitNode = tabNode.parent!;\n tabNode.parent = null;\n\n // Remove the tab node from its parent split node.\n let i = ArrayExt.removeFirstOf(splitNode.children, tabNode);\n let handle = ArrayExt.removeAt(splitNode.handles, i)!;\n ArrayExt.removeAt(splitNode.sizers, i);\n\n // Remove the handle from its parent DOM node.\n if (handle.parentNode) {\n handle.parentNode.removeChild(handle);\n }\n\n // If there are multiple children, just update the handles.\n if (splitNode.children.length > 1) {\n splitNode.syncHandles();\n return;\n }\n\n // Otherwise, the split node also needs to be removed...\n\n // Clear the parent reference on the split node.\n let maybeParent = splitNode.parent;\n splitNode.parent = null;\n\n // Lookup the remaining child node and handle.\n let childNode = splitNode.children[0];\n let childHandle = splitNode.handles[0];\n\n // Clear the split node data.\n splitNode.children.length = 0;\n splitNode.handles.length = 0;\n splitNode.sizers.length = 0;\n\n // Remove the child handle from its parent node.\n if (childHandle.parentNode) {\n childHandle.parentNode.removeChild(childHandle);\n }\n\n // Handle the case where the split node is the root.\n if (this._root === splitNode) {\n childNode.parent = null;\n this._root = childNode;\n return;\n }\n\n // Otherwise, move the child node to the parent node...\n let parentNode = maybeParent!;\n\n // Lookup the index of the split node.\n let j = parentNode.children.indexOf(splitNode);\n\n // Handle the case where the child node is a tab node.\n if (childNode instanceof Private.TabLayoutNode) {\n childNode.parent = parentNode;\n parentNode.children[j] = childNode;\n return;\n }\n\n // Remove the split data from the parent.\n let splitHandle = ArrayExt.removeAt(parentNode.handles, j)!;\n ArrayExt.removeAt(parentNode.children, j);\n ArrayExt.removeAt(parentNode.sizers, j);\n\n // Remove the handle from its parent node.\n if (splitHandle.parentNode) {\n splitHandle.parentNode.removeChild(splitHandle);\n }\n\n // The child node and the split parent node will have the same\n // orientation. Merge the grand-children with the parent node.\n for (let i = 0, n = childNode.children.length; i < n; ++i) {\n let gChild = childNode.children[i];\n let gHandle = childNode.handles[i];\n let gSizer = childNode.sizers[i];\n ArrayExt.insert(parentNode.children, j + i, gChild);\n ArrayExt.insert(parentNode.handles, j + i, gHandle);\n ArrayExt.insert(parentNode.sizers, j + i, gSizer);\n gChild.parent = parentNode;\n }\n\n // Clear the child node.\n childNode.children.length = 0;\n childNode.handles.length = 0;\n childNode.sizers.length = 0;\n childNode.parent = null;\n\n // Sync the handles on the parent node.\n parentNode.syncHandles();\n }\n\n /**\n * Create the tab layout node to hold the widget.\n */\n private _createTabNode(widget: Widget): Private.TabLayoutNode {\n let tabNode = new Private.TabLayoutNode(this._createTabBar());\n tabNode.tabBar.addTab(widget.title);\n Private.addAria(widget, tabNode.tabBar);\n return tabNode;\n }\n\n /**\n * Insert a widget next to an existing tab.\n *\n * #### Notes\n * This does not attach the widget to the parent widget.\n */\n private _insertTab(\n widget: Widget,\n ref: Widget | null,\n refNode: Private.TabLayoutNode | null,\n after: boolean\n ): void {\n // Do nothing if the tab is inserted next to itself.\n if (widget === ref) {\n return;\n }\n\n // Create the root if it does not exist.\n if (!this._root) {\n let tabNode = new Private.TabLayoutNode(this._createTabBar());\n tabNode.tabBar.addTab(widget.title);\n this._root = tabNode;\n Private.addAria(widget, tabNode.tabBar);\n return;\n }\n\n // Use the first tab node as the ref node if needed.\n if (!refNode) {\n refNode = this._root.findFirstTabNode()!;\n }\n\n // If the widget is not contained in the ref node, ensure it is\n // removed from the layout and hidden before being added again.\n if (refNode.tabBar.titles.indexOf(widget.title) === -1) {\n this._removeWidget(widget);\n widget.hide();\n }\n\n // Lookup the target index for inserting the tab.\n let index: number;\n if (ref) {\n index = refNode.tabBar.titles.indexOf(ref.title);\n } else {\n index = refNode.tabBar.currentIndex;\n }\n\n // Using transform create an additional layer in the pixel pipeline\n // to limit the number of layer, it is set only if there is more than one widget.\n if (this._hiddenMode === Widget.HiddenMode.Scale) {\n if (refNode.tabBar.titles.length === 0) {\n // Singular tab should use display mode to limit number of layers.\n widget.hiddenMode = Widget.HiddenMode.Display;\n } else if (refNode.tabBar.titles.length == 1) {\n // If we are adding a second tab, switch the existing tab back to scale.\n const existingWidget = refNode.tabBar.titles[0].owner;\n existingWidget.hiddenMode = Widget.HiddenMode.Scale;\n } else {\n // For the third and subsequent tabs no special action is needed.\n widget.hiddenMode = Widget.HiddenMode.Scale;\n }\n } else {\n // For all other modes just propagate the current mode.\n widget.hiddenMode = this._hiddenMode;\n }\n\n // Insert the widget's tab relative to the target index.\n refNode.tabBar.insertTab(index + (after ? 1 : 0), widget.title);\n Private.addAria(widget, refNode.tabBar);\n }\n\n /**\n * Insert a widget as a new split area.\n *\n * #### Notes\n * This does not attach the widget to the parent widget.\n */\n private _insertSplit(\n widget: Widget,\n ref: Widget | null,\n refNode: Private.TabLayoutNode | null,\n orientation: Private.Orientation,\n after: boolean,\n merge: boolean = false\n ): void {\n // Do nothing if there is no effective split.\n if (widget === ref && refNode && refNode.tabBar.titles.length === 1) {\n return;\n }\n\n // Ensure the widget is removed from the current layout.\n this._removeWidget(widget);\n\n // Set the root if it does not exist.\n if (!this._root) {\n this._root = this._createTabNode(widget);\n return;\n }\n\n // If the ref node parent is null, split the root.\n if (!refNode || !refNode.parent) {\n // Ensure the root is split with the correct orientation.\n let root = this._splitRoot(orientation);\n\n // Determine the insert index for the new tab node.\n let i = after ? root.children.length : 0;\n\n // Normalize the split node.\n root.normalizeSizes();\n\n // Create the sizer for new tab node.\n let sizer = Private.createSizer(refNode ? 1 : Private.GOLDEN_RATIO);\n\n // Insert the tab node sized to the golden ratio.\n let tabNode = this._createTabNode(widget);\n ArrayExt.insert(root.children, i, tabNode);\n ArrayExt.insert(root.sizers, i, sizer);\n ArrayExt.insert(root.handles, i, this._createHandle());\n tabNode.parent = root;\n\n // Re-normalize the split node to maintain the ratios.\n root.normalizeSizes();\n\n // Finally, synchronize the visibility of the handles.\n root.syncHandles();\n return;\n }\n\n // Lookup the split node for the ref widget.\n let splitNode = refNode.parent;\n\n // If the split node already had the correct orientation,\n // the widget can be inserted into the split node directly.\n if (splitNode.orientation === orientation) {\n // Find the index of the ref node.\n let i = splitNode.children.indexOf(refNode);\n\n // Conditionally reuse a tab layout found in the wanted position.\n if (merge) {\n let j = i + (after ? 1 : -1);\n let sibling = splitNode.children[j];\n if (sibling instanceof Private.TabLayoutNode) {\n this._insertTab(widget, null, sibling, true);\n ++sibling.tabBar.currentIndex;\n return;\n }\n }\n\n // Normalize the split node.\n splitNode.normalizeSizes();\n\n // Consume half the space for the insert location.\n let s = (splitNode.sizers[i].sizeHint /= 2);\n\n // Insert the tab node sized to the other half.\n let j = i + (after ? 1 : 0);\n let tabNode = this._createTabNode(widget);\n ArrayExt.insert(splitNode.children, j, tabNode);\n ArrayExt.insert(splitNode.sizers, j, Private.createSizer(s));\n ArrayExt.insert(splitNode.handles, j, this._createHandle());\n tabNode.parent = splitNode;\n\n // Finally, synchronize the visibility of the handles.\n splitNode.syncHandles();\n return;\n }\n\n // Remove the ref node from the split node.\n let i = ArrayExt.removeFirstOf(splitNode.children, refNode);\n\n // Create a new normalized split node for the children.\n let childNode = new Private.SplitLayoutNode(orientation);\n childNode.normalized = true;\n\n // Add the ref node sized to half the space.\n childNode.children.push(refNode);\n childNode.sizers.push(Private.createSizer(0.5));\n childNode.handles.push(this._createHandle());\n refNode.parent = childNode;\n\n // Add the tab node sized to the other half.\n let j = after ? 1 : 0;\n let tabNode = this._createTabNode(widget);\n ArrayExt.insert(childNode.children, j, tabNode);\n ArrayExt.insert(childNode.sizers, j, Private.createSizer(0.5));\n ArrayExt.insert(childNode.handles, j, this._createHandle());\n tabNode.parent = childNode;\n\n // Synchronize the visibility of the handles.\n childNode.syncHandles();\n\n // Finally, add the new child node to the original split node.\n ArrayExt.insert(splitNode.children, i, childNode);\n childNode.parent = splitNode;\n }\n\n /**\n * Ensure the root is a split node with the given orientation.\n */\n private _splitRoot(\n orientation: Private.Orientation\n ): Private.SplitLayoutNode {\n // Bail early if the root already meets the requirements.\n let oldRoot = this._root;\n if (oldRoot instanceof Private.SplitLayoutNode) {\n if (oldRoot.orientation === orientation) {\n return oldRoot;\n }\n }\n\n // Create a new root node with the specified orientation.\n let newRoot = (this._root = new Private.SplitLayoutNode(orientation));\n\n // Add the old root to the new root.\n if (oldRoot) {\n newRoot.children.push(oldRoot);\n newRoot.sizers.push(Private.createSizer(0));\n newRoot.handles.push(this._createHandle());\n oldRoot.parent = newRoot;\n }\n\n // Return the new root as a convenience.\n return newRoot;\n }\n\n /**\n * Fit the layout to the total size required by the widgets.\n */\n private _fit(): void {\n // Set up the computed minimum size.\n let minW = 0;\n let minH = 0;\n\n // Update the size limits for the layout tree.\n if (this._root) {\n let limits = this._root.fit(this._spacing, this._items);\n minW = limits.minWidth;\n minH = limits.minHeight;\n }\n\n // Update the box sizing and add it to the computed min size.\n let box = (this._box = ElementExt.boxSizing(this.parent!.node));\n minW += box.horizontalSum;\n minH += box.verticalSum;\n\n // Update the parent's min size constraints.\n let style = this.parent!.node.style;\n style.minWidth = `${minW}px`;\n style.minHeight = `${minH}px`;\n\n // Set the dirty flag to ensure only a single update occurs.\n this._dirty = true;\n\n // Notify the ancestor that it should fit immediately. This may\n // cause a resize of the parent, fulfilling the required update.\n if (this.parent!.parent) {\n MessageLoop.sendMessage(this.parent!.parent!, Widget.Msg.FitRequest);\n }\n\n // If the dirty flag is still set, the parent was not resized.\n // Trigger the required update on the parent widget immediately.\n if (this._dirty) {\n MessageLoop.sendMessage(this.parent!, Widget.Msg.UpdateRequest);\n }\n }\n\n /**\n * Update the layout position and size of the widgets.\n *\n * The parent offset dimensions should be `-1` if unknown.\n */\n private _update(offsetWidth: number, offsetHeight: number): void {\n // Clear the dirty flag to indicate the update occurred.\n this._dirty = false;\n\n // Bail early if there is no root layout node.\n if (!this._root) {\n return;\n }\n\n // Measure the parent if the offset dimensions are unknown.\n if (offsetWidth < 0) {\n offsetWidth = this.parent!.node.offsetWidth;\n }\n if (offsetHeight < 0) {\n offsetHeight = this.parent!.node.offsetHeight;\n }\n\n // Ensure the parent box sizing data is computed.\n if (!this._box) {\n this._box = ElementExt.boxSizing(this.parent!.node);\n }\n\n // Compute the actual layout bounds adjusted for border and padding.\n let x = this._box.paddingTop;\n let y = this._box.paddingLeft;\n let width = offsetWidth - this._box.horizontalSum;\n let height = offsetHeight - this._box.verticalSum;\n\n // Update the geometry of the layout tree.\n this._root.update(x, y, width, height, this._spacing, this._items);\n }\n\n /**\n * Create a new tab bar for use by the dock layout.\n *\n * #### Notes\n * The tab bar will be attached to the parent if it exists.\n */\n private _createTabBar(): TabBar {\n // Create the tab bar using the renderer.\n let tabBar = this.renderer.createTabBar(this._document);\n\n // Enforce necessary tab bar behavior.\n tabBar.orientation = 'horizontal';\n\n // Attach the tab bar to the parent if possible.\n if (this.parent) {\n this.attachWidget(tabBar);\n }\n\n // Return the initialized tab bar.\n return tabBar;\n }\n\n /**\n * Create a new handle for the dock layout.\n *\n * #### Notes\n * The handle will be attached to the parent if it exists.\n */\n private _createHandle(): HTMLDivElement {\n // Create the handle using the renderer.\n let handle = this.renderer.createHandle();\n\n // Initialize the handle layout behavior.\n let style = handle.style;\n style.position = 'absolute';\n style.contain = 'strict';\n style.top = '0';\n style.left = '0';\n style.width = '0';\n style.height = '0';\n\n // Attach the handle to the parent if it exists.\n if (this.parent) {\n this.parent.node.appendChild(handle);\n }\n\n // Return the initialized handle.\n return handle;\n }\n\n private _spacing = 4;\n private _dirty = false;\n private _root: Private.LayoutNode | null = null;\n private _box: ElementExt.IBoxSizing | null = null;\n private _document: Document | ShadowRoot;\n private _hiddenMode: Widget.HiddenMode;\n private _items: Private.ItemMap = new Map();\n}\n\n/**\n * The namespace for the `DockLayout` class statics.\n */\nexport namespace DockLayout {\n /**\n * An options object for creating a dock layout.\n */\n export interface IOptions {\n /**\n * The document to use with the dock panel.\n *\n * The default is the global `document` instance.\n */\n document?: Document | ShadowRoot;\n\n /**\n * The method for hiding widgets.\n *\n * The default is `Widget.HiddenMode.Display`.\n */\n hiddenMode?: Widget.HiddenMode;\n\n /**\n * The renderer to use for the dock layout.\n */\n renderer: IRenderer;\n\n /**\n * The spacing between items in the layout.\n *\n * The default is `4`.\n */\n spacing?: number;\n }\n\n /**\n * A renderer for use with a dock layout.\n */\n export interface IRenderer {\n /**\n * Create a new tab bar for use with a dock layout.\n *\n * @returns A new tab bar for a dock layout.\n */\n createTabBar(document?: Document | ShadowRoot): TabBar;\n\n /**\n * Create a new handle node for use with a dock layout.\n *\n * @returns A new handle node for a dock layout.\n */\n createHandle(): HTMLDivElement;\n }\n\n /**\n * A type alias for the supported insertion modes.\n *\n * An insert mode is used to specify how a widget should be added\n * to the dock layout relative to a reference widget.\n */\n export type InsertMode =\n | /**\n * The area to the top of the reference widget.\n *\n * The widget will be inserted just above the reference widget.\n *\n * If the reference widget is null or invalid, the widget will be\n * inserted at the top edge of the dock layout.\n */\n 'split-top'\n\n /**\n * The area to the left of the reference widget.\n *\n * The widget will be inserted just left of the reference widget.\n *\n * If the reference widget is null or invalid, the widget will be\n * inserted at the left edge of the dock layout.\n */\n | 'split-left'\n\n /**\n * The area to the right of the reference widget.\n *\n * The widget will be inserted just right of the reference widget.\n *\n * If the reference widget is null or invalid, the widget will be\n * inserted at the right edge of the dock layout.\n */\n | 'split-right'\n\n /**\n * The area to the bottom of the reference widget.\n *\n * The widget will be inserted just below the reference widget.\n *\n * If the reference widget is null or invalid, the widget will be\n * inserted at the bottom edge of the dock layout.\n */\n | 'split-bottom'\n\n /**\n * Like `split-top` but if a tab layout exists above the reference widget,\n * it behaves like `tab-after` with reference to that instead.\n */\n | 'merge-top'\n\n /**\n * Like `split-left` but if a tab layout exists left of the reference widget,\n * it behaves like `tab-after` with reference to that instead.\n */\n | 'merge-left'\n\n /**\n * Like `split-right` but if a tab layout exists right of the reference widget,\n * it behaves like `tab-after` with reference to that instead.\n */\n | 'merge-right'\n\n /**\n * Like `split-bottom` but if a tab layout exists below the reference widget,\n * it behaves like `tab-after` with reference to that instead.\n */\n | 'merge-bottom'\n\n /**\n * The tab position before the reference widget.\n *\n * The widget will be added as a tab before the reference widget.\n *\n * If the reference widget is null or invalid, a sensible default\n * will be used.\n */\n | 'tab-before'\n\n /**\n * The tab position after the reference widget.\n *\n * The widget will be added as a tab after the reference widget.\n *\n * If the reference widget is null or invalid, a sensible default\n * will be used.\n */\n | 'tab-after';\n\n /**\n * An options object for adding a widget to the dock layout.\n */\n export interface IAddOptions {\n /**\n * The insertion mode for adding the widget.\n *\n * The default is `'tab-after'`.\n */\n mode?: InsertMode;\n\n /**\n * The reference widget for the insert location.\n *\n * The default is `null`.\n */\n ref?: Widget | null;\n }\n\n /**\n * A layout config object for a tab area.\n */\n export interface ITabAreaConfig {\n /**\n * The discriminated type of the config object.\n */\n type: 'tab-area';\n\n /**\n * The widgets contained in the tab area.\n */\n widgets: Widget[];\n\n /**\n * The index of the selected tab.\n */\n currentIndex: number;\n }\n\n /**\n * A layout config object for a split area.\n */\n export interface ISplitAreaConfig {\n /**\n * The discriminated type of the config object.\n */\n type: 'split-area';\n\n /**\n * The orientation of the split area.\n */\n orientation: 'horizontal' | 'vertical';\n\n /**\n * The children in the split area.\n */\n children: AreaConfig[];\n\n /**\n * The relative sizes of the children.\n */\n sizes: number[];\n }\n\n /**\n * A type alias for a general area config.\n */\n export type AreaConfig = ITabAreaConfig | ISplitAreaConfig;\n\n /**\n * A dock layout configuration object.\n */\n export interface ILayoutConfig {\n /**\n * The layout config for the main dock area.\n */\n main: AreaConfig | null;\n }\n\n /**\n * An object which represents the geometry of a tab area.\n */\n export interface ITabAreaGeometry {\n /**\n * The tab bar for the tab area.\n */\n tabBar: TabBar;\n\n /**\n * The local X position of the hit test in the dock area.\n *\n * #### Notes\n * This is the distance from the left edge of the layout parent\n * widget, to the local X coordinate of the hit test query.\n */\n x: number;\n\n /**\n * The local Y position of the hit test in the dock area.\n *\n * #### Notes\n * This is the distance from the top edge of the layout parent\n * widget, to the local Y coordinate of the hit test query.\n */\n y: number;\n\n /**\n * The local coordinate of the top edge of the tab area.\n *\n * #### Notes\n * This is the distance from the top edge of the layout parent\n * widget, to the top edge of the tab area.\n */\n top: number;\n\n /**\n * The local coordinate of the left edge of the tab area.\n *\n * #### Notes\n * This is the distance from the left edge of the layout parent\n * widget, to the left edge of the tab area.\n */\n left: number;\n\n /**\n * The local coordinate of the right edge of the tab area.\n *\n * #### Notes\n * This is the distance from the right edge of the layout parent\n * widget, to the right edge of the tab area.\n */\n right: number;\n\n /**\n * The local coordinate of the bottom edge of the tab area.\n *\n * #### Notes\n * This is the distance from the bottom edge of the layout parent\n * widget, to the bottom edge of the tab area.\n */\n bottom: number;\n\n /**\n * The width of the tab area.\n *\n * #### Notes\n * This is total width allocated for the tab area.\n */\n width: number;\n\n /**\n * The height of the tab area.\n *\n * #### Notes\n * This is total height allocated for the tab area.\n */\n height: number;\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * A fraction used for sizing root panels; ~= `1 / golden_ratio`.\n */\n export const GOLDEN_RATIO = 0.618;\n\n /**\n * A type alias for a dock layout node.\n */\n export type LayoutNode = TabLayoutNode | SplitLayoutNode;\n\n /**\n * A type alias for the orientation of a split layout node.\n */\n export type Orientation = 'horizontal' | 'vertical';\n\n /**\n * A type alias for a layout item map.\n */\n export type ItemMap = Map;\n\n /**\n * Create a box sizer with an initial size hint.\n */\n export function createSizer(hint: number): BoxSizer {\n let sizer = new BoxSizer();\n sizer.sizeHint = hint;\n sizer.size = hint;\n return sizer;\n }\n\n /**\n * Normalize an area config object and collect the visited widgets.\n */\n export function normalizeAreaConfig(\n config: DockLayout.AreaConfig,\n widgetSet: Set\n ): DockLayout.AreaConfig | null {\n let result: DockLayout.AreaConfig | null;\n if (config.type === 'tab-area') {\n result = normalizeTabAreaConfig(config, widgetSet);\n } else {\n result = normalizeSplitAreaConfig(config, widgetSet);\n }\n return result;\n }\n\n /**\n * Convert a normalized area config into a layout tree.\n */\n export function realizeAreaConfig(\n config: DockLayout.AreaConfig,\n renderer: DockLayout.IRenderer,\n document: Document | ShadowRoot\n ): LayoutNode {\n let node: LayoutNode;\n if (config.type === 'tab-area') {\n node = realizeTabAreaConfig(config, renderer, document);\n } else {\n node = realizeSplitAreaConfig(config, renderer, document);\n }\n return node;\n }\n\n /**\n * A layout node which holds the data for a tabbed area.\n */\n export class TabLayoutNode {\n /**\n * Construct a new tab layout node.\n *\n * @param tabBar - The tab bar to use for the layout node.\n */\n constructor(tabBar: TabBar) {\n let tabSizer = new BoxSizer();\n let widgetSizer = new BoxSizer();\n tabSizer.stretch = 0;\n widgetSizer.stretch = 1;\n this.tabBar = tabBar;\n this.sizers = [tabSizer, widgetSizer];\n }\n\n /**\n * The parent of the layout node.\n */\n parent: SplitLayoutNode | null = null;\n\n /**\n * The tab bar for the layout node.\n */\n readonly tabBar: TabBar;\n\n /**\n * The sizers for the layout node.\n */\n readonly sizers: [BoxSizer, BoxSizer];\n\n /**\n * The most recent value for the `top` edge of the layout box.\n */\n get top(): number {\n return this._top;\n }\n\n /**\n * The most recent value for the `left` edge of the layout box.\n */\n get left(): number {\n return this._left;\n }\n\n /**\n * The most recent value for the `width` of the layout box.\n */\n get width(): number {\n return this._width;\n }\n\n /**\n * The most recent value for the `height` of the layout box.\n */\n get height(): number {\n return this._height;\n }\n\n /**\n * Create an iterator for all widgets in the layout tree.\n */\n *iterAllWidgets(): IterableIterator {\n yield this.tabBar;\n yield* this.iterUserWidgets();\n }\n\n /**\n * Create an iterator for the user widgets in the layout tree.\n */\n *iterUserWidgets(): IterableIterator {\n for (const title of this.tabBar.titles) {\n yield title.owner;\n }\n }\n\n /**\n * Create an iterator for the selected widgets in the layout tree.\n */\n *iterSelectedWidgets(): IterableIterator {\n let title = this.tabBar.currentTitle;\n if (title) {\n yield title.owner;\n }\n }\n\n /**\n * Create an iterator for the tab bars in the layout tree.\n */\n *iterTabBars(): IterableIterator> {\n yield this.tabBar;\n }\n\n /**\n * Create an iterator for the handles in the layout tree.\n */\n // eslint-disable-next-line require-yield\n *iterHandles(): IterableIterator {\n return;\n }\n\n /**\n * Find the tab layout node which contains the given widget.\n */\n findTabNode(widget: Widget): TabLayoutNode | null {\n return this.tabBar.titles.indexOf(widget.title) !== -1 ? this : null;\n }\n\n /**\n * Find the split layout node which contains the given handle.\n */\n findSplitNode(\n handle: HTMLDivElement\n ): { index: number; node: SplitLayoutNode } | null {\n return null;\n }\n\n /**\n * Find the first tab layout node in a layout tree.\n */\n findFirstTabNode(): TabLayoutNode | null {\n return this;\n }\n\n /**\n * Find the tab layout node which contains the local point.\n */\n hitTestTabNodes(x: number, y: number): TabLayoutNode | null {\n if (x < this._left || x >= this._left + this._width) {\n return null;\n }\n if (y < this._top || y >= this._top + this._height) {\n return null;\n }\n return this;\n }\n\n /**\n * Create a configuration object for the layout tree.\n */\n createConfig(): DockLayout.ITabAreaConfig {\n let widgets = this.tabBar.titles.map(title => title.owner);\n let currentIndex = this.tabBar.currentIndex;\n return { type: 'tab-area', widgets, currentIndex };\n }\n\n /**\n * Recursively hold all of the sizes in the layout tree.\n *\n * This ignores the sizers of tab layout nodes.\n */\n holdAllSizes(): void {\n return;\n }\n\n /**\n * Fit the layout tree.\n */\n fit(spacing: number, items: ItemMap): ElementExt.ISizeLimits {\n // Set up the limit variables.\n let minWidth = 0;\n let minHeight = 0;\n let maxWidth = Infinity;\n let maxHeight = Infinity;\n\n // Lookup the tab bar layout item.\n let tabBarItem = items.get(this.tabBar);\n\n // Lookup the widget layout item.\n let current = this.tabBar.currentTitle;\n let widgetItem = current ? items.get(current.owner) : undefined;\n\n // Lookup the tab bar and widget sizers.\n let [tabBarSizer, widgetSizer] = this.sizers;\n\n // Update the tab bar limits.\n if (tabBarItem) {\n tabBarItem.fit();\n }\n\n // Update the widget limits.\n if (widgetItem) {\n widgetItem.fit();\n }\n\n // Update the results and sizer for the tab bar.\n if (tabBarItem && !tabBarItem.isHidden) {\n minWidth = Math.max(minWidth, tabBarItem.minWidth);\n minHeight += tabBarItem.minHeight;\n tabBarSizer.minSize = tabBarItem.minHeight;\n tabBarSizer.maxSize = tabBarItem.maxHeight;\n } else {\n tabBarSizer.minSize = 0;\n tabBarSizer.maxSize = 0;\n }\n\n // Update the results and sizer for the current widget.\n if (widgetItem && !widgetItem.isHidden) {\n minWidth = Math.max(minWidth, widgetItem.minWidth);\n minHeight += widgetItem.minHeight;\n widgetSizer.minSize = widgetItem.minHeight;\n widgetSizer.maxSize = Infinity;\n } else {\n widgetSizer.minSize = 0;\n widgetSizer.maxSize = Infinity;\n }\n\n // Return the computed size limits for the layout node.\n return { minWidth, minHeight, maxWidth, maxHeight };\n }\n\n /**\n * Update the layout tree.\n */\n update(\n left: number,\n top: number,\n width: number,\n height: number,\n spacing: number,\n items: ItemMap\n ): void {\n // Update the layout box values.\n this._top = top;\n this._left = left;\n this._width = width;\n this._height = height;\n\n // Lookup the tab bar layout item.\n let tabBarItem = items.get(this.tabBar);\n\n // Lookup the widget layout item.\n let current = this.tabBar.currentTitle;\n let widgetItem = current ? items.get(current.owner) : undefined;\n\n // Distribute the layout space to the sizers.\n BoxEngine.calc(this.sizers, height);\n\n // Update the tab bar item using the computed size.\n if (tabBarItem && !tabBarItem.isHidden) {\n let size = this.sizers[0].size;\n tabBarItem.update(left, top, width, size);\n top += size;\n }\n\n // Layout the widget using the computed size.\n if (widgetItem && !widgetItem.isHidden) {\n let size = this.sizers[1].size;\n widgetItem.update(left, top, width, size);\n }\n }\n\n private _top = 0;\n private _left = 0;\n private _width = 0;\n private _height = 0;\n }\n\n /**\n * A layout node which holds the data for a split area.\n */\n export class SplitLayoutNode {\n /**\n * Construct a new split layout node.\n *\n * @param orientation - The orientation of the node.\n */\n constructor(orientation: Orientation) {\n this.orientation = orientation;\n }\n\n /**\n * The parent of the layout node.\n */\n parent: SplitLayoutNode | null = null;\n\n /**\n * Whether the sizers have been normalized.\n */\n normalized = false;\n\n /**\n * The orientation of the node.\n */\n readonly orientation: Orientation;\n\n /**\n * The child nodes for the split node.\n */\n readonly children: LayoutNode[] = [];\n\n /**\n * The box sizers for the layout children.\n */\n readonly sizers: BoxSizer[] = [];\n\n /**\n * The handles for the layout children.\n */\n readonly handles: HTMLDivElement[] = [];\n\n /**\n * Create an iterator for all widgets in the layout tree.\n */\n *iterAllWidgets(): IterableIterator {\n for (const child of this.children) {\n yield* child.iterAllWidgets();\n }\n }\n\n /**\n * Create an iterator for the user widgets in the layout tree.\n */\n *iterUserWidgets(): IterableIterator {\n for (const child of this.children) {\n yield* child.iterUserWidgets();\n }\n }\n\n /**\n * Create an iterator for the selected widgets in the layout tree.\n */\n *iterSelectedWidgets(): IterableIterator {\n for (const child of this.children) {\n yield* child.iterSelectedWidgets();\n }\n }\n\n /**\n * Create an iterator for the tab bars in the layout tree.\n */\n *iterTabBars(): IterableIterator> {\n for (const child of this.children) {\n yield* child.iterTabBars();\n }\n }\n\n /**\n * Create an iterator for the handles in the layout tree.\n */\n *iterHandles(): IterableIterator {\n yield* this.handles;\n for (const child of this.children) {\n yield* child.iterHandles();\n }\n }\n\n /**\n * Find the tab layout node which contains the given widget.\n */\n findTabNode(widget: Widget): TabLayoutNode | null {\n for (let i = 0, n = this.children.length; i < n; ++i) {\n let result = this.children[i].findTabNode(widget);\n if (result) {\n return result;\n }\n }\n return null;\n }\n\n /**\n * Find the split layout node which contains the given handle.\n */\n findSplitNode(\n handle: HTMLDivElement\n ): { index: number; node: SplitLayoutNode } | null {\n let index = this.handles.indexOf(handle);\n if (index !== -1) {\n return { index, node: this };\n }\n for (let i = 0, n = this.children.length; i < n; ++i) {\n let result = this.children[i].findSplitNode(handle);\n if (result) {\n return result;\n }\n }\n return null;\n }\n\n /**\n * Find the first tab layout node in a layout tree.\n */\n findFirstTabNode(): TabLayoutNode | null {\n if (this.children.length === 0) {\n return null;\n }\n return this.children[0].findFirstTabNode();\n }\n\n /**\n * Find the tab layout node which contains the local point.\n */\n hitTestTabNodes(x: number, y: number): TabLayoutNode | null {\n for (let i = 0, n = this.children.length; i < n; ++i) {\n let result = this.children[i].hitTestTabNodes(x, y);\n if (result) {\n return result;\n }\n }\n return null;\n }\n\n /**\n * Create a configuration object for the layout tree.\n */\n createConfig(): DockLayout.ISplitAreaConfig {\n let orientation = this.orientation;\n let sizes = this.createNormalizedSizes();\n let children = this.children.map(child => child.createConfig());\n return { type: 'split-area', orientation, children, sizes };\n }\n\n /**\n * Sync the visibility and orientation of the handles.\n */\n syncHandles(): void {\n this.handles.forEach((handle, i) => {\n handle.setAttribute('data-orientation', this.orientation);\n if (i === this.handles.length - 1) {\n handle.classList.add('lm-mod-hidden');\n } else {\n handle.classList.remove('lm-mod-hidden');\n }\n });\n }\n\n /**\n * Hold the current sizes of the box sizers.\n *\n * This sets the size hint of each sizer to its current size.\n */\n holdSizes(): void {\n for (const sizer of this.sizers) {\n sizer.sizeHint = sizer.size;\n }\n }\n\n /**\n * Recursively hold all of the sizes in the layout tree.\n *\n * This ignores the sizers of tab layout nodes.\n */\n holdAllSizes(): void {\n for (const child of this.children) {\n child.holdAllSizes();\n }\n this.holdSizes();\n }\n\n /**\n * Normalize the sizes of the split layout node.\n */\n normalizeSizes(): void {\n // Bail early if the sizers are empty.\n let n = this.sizers.length;\n if (n === 0) {\n return;\n }\n\n // Hold the current sizes of the sizers.\n this.holdSizes();\n\n // Compute the sum of the sizes.\n let sum = this.sizers.reduce((v, sizer) => v + sizer.sizeHint, 0);\n\n // Normalize the sizes based on the sum.\n if (sum === 0) {\n for (const sizer of this.sizers) {\n sizer.size = sizer.sizeHint = 1 / n;\n }\n } else {\n for (const sizer of this.sizers) {\n sizer.size = sizer.sizeHint /= sum;\n }\n }\n\n // Mark the sizes as normalized.\n this.normalized = true;\n }\n\n /**\n * Snap the normalized sizes of the split layout node.\n */\n createNormalizedSizes(): number[] {\n // Bail early if the sizers are empty.\n let n = this.sizers.length;\n if (n === 0) {\n return [];\n }\n\n // Grab the current sizes of the sizers.\n let sizes = this.sizers.map(sizer => sizer.size);\n\n // Compute the sum of the sizes.\n let sum = sizes.reduce((v, size) => v + size, 0);\n\n // Normalize the sizes based on the sum.\n if (sum === 0) {\n for (let i = sizes.length - 1; i > -1; i--) {\n sizes[i] = 1 / n;\n }\n } else {\n for (let i = sizes.length - 1; i > -1; i--) {\n sizes[i] /= sum;\n }\n }\n\n // Return the normalized sizes.\n return sizes;\n }\n\n /**\n * Fit the layout tree.\n */\n fit(spacing: number, items: ItemMap): ElementExt.ISizeLimits {\n // Compute the required fixed space.\n let horizontal = this.orientation === 'horizontal';\n let fixed = Math.max(0, this.children.length - 1) * spacing;\n\n // Set up the limit variables.\n let minWidth = horizontal ? fixed : 0;\n let minHeight = horizontal ? 0 : fixed;\n let maxWidth = Infinity;\n let maxHeight = Infinity;\n\n // Fit the children and update the limits.\n for (let i = 0, n = this.children.length; i < n; ++i) {\n let limits = this.children[i].fit(spacing, items);\n if (horizontal) {\n minHeight = Math.max(minHeight, limits.minHeight);\n minWidth += limits.minWidth;\n this.sizers[i].minSize = limits.minWidth;\n } else {\n minWidth = Math.max(minWidth, limits.minWidth);\n minHeight += limits.minHeight;\n this.sizers[i].minSize = limits.minHeight;\n }\n }\n\n // Return the computed limits for the layout node.\n return { minWidth, minHeight, maxWidth, maxHeight };\n }\n\n /**\n * Update the layout tree.\n */\n update(\n left: number,\n top: number,\n width: number,\n height: number,\n spacing: number,\n items: ItemMap\n ): void {\n // Compute the available layout space.\n let horizontal = this.orientation === 'horizontal';\n let fixed = Math.max(0, this.children.length - 1) * spacing;\n let space = Math.max(0, (horizontal ? width : height) - fixed);\n\n // De-normalize the sizes if needed.\n if (this.normalized) {\n for (const sizer of this.sizers) {\n sizer.sizeHint *= space;\n }\n this.normalized = false;\n }\n\n // Distribute the layout space to the sizers.\n BoxEngine.calc(this.sizers, space);\n\n // Update the geometry of the child nodes and handles.\n for (let i = 0, n = this.children.length; i < n; ++i) {\n let child = this.children[i];\n let size = this.sizers[i].size;\n let handleStyle = this.handles[i].style;\n if (horizontal) {\n child.update(left, top, size, height, spacing, items);\n left += size;\n handleStyle.top = `${top}px`;\n handleStyle.left = `${left}px`;\n handleStyle.width = `${spacing}px`;\n handleStyle.height = `${height}px`;\n left += spacing;\n } else {\n child.update(left, top, width, size, spacing, items);\n top += size;\n handleStyle.top = `${top}px`;\n handleStyle.left = `${left}px`;\n handleStyle.width = `${width}px`;\n handleStyle.height = `${spacing}px`;\n top += spacing;\n }\n }\n }\n }\n\n export function addAria(widget: Widget, tabBar: TabBar): void {\n widget.node.setAttribute('role', 'tabpanel');\n let renderer = tabBar.renderer;\n if (renderer instanceof TabBar.Renderer) {\n let tabId = renderer.createTabKey({\n title: widget.title,\n current: false,\n zIndex: 0\n });\n widget.node.setAttribute('aria-labelledby', tabId);\n }\n }\n\n export function removeAria(widget: Widget): void {\n widget.node.removeAttribute('role');\n widget.node.removeAttribute('aria-labelledby');\n }\n\n /**\n * Normalize a tab area config and collect the visited widgets.\n */\n function normalizeTabAreaConfig(\n config: DockLayout.ITabAreaConfig,\n widgetSet: Set\n ): DockLayout.ITabAreaConfig | null {\n // Bail early if there is no content.\n if (config.widgets.length === 0) {\n return null;\n }\n\n // Setup the filtered widgets array.\n let widgets: Widget[] = [];\n\n // Filter the config for unique widgets.\n for (const widget of config.widgets) {\n if (!widgetSet.has(widget)) {\n widgetSet.add(widget);\n widgets.push(widget);\n }\n }\n\n // Bail if there are no effective widgets.\n if (widgets.length === 0) {\n return null;\n }\n\n // Normalize the current index.\n let index = config.currentIndex;\n if (index !== -1 && (index < 0 || index >= widgets.length)) {\n index = 0;\n }\n\n // Return a normalized config object.\n return { type: 'tab-area', widgets, currentIndex: index };\n }\n\n /**\n * Normalize a split area config and collect the visited widgets.\n */\n function normalizeSplitAreaConfig(\n config: DockLayout.ISplitAreaConfig,\n widgetSet: Set\n ): DockLayout.AreaConfig | null {\n // Set up the result variables.\n let orientation = config.orientation;\n let children: DockLayout.AreaConfig[] = [];\n let sizes: number[] = [];\n\n // Normalize the config children.\n for (let i = 0, n = config.children.length; i < n; ++i) {\n // Normalize the child config.\n let child = normalizeAreaConfig(config.children[i], widgetSet);\n\n // Ignore an empty child.\n if (!child) {\n continue;\n }\n\n // Add the child or hoist its content as appropriate.\n if (child.type === 'tab-area' || child.orientation !== orientation) {\n children.push(child);\n sizes.push(Math.abs(config.sizes[i] || 0));\n } else {\n children.push(...child.children);\n sizes.push(...child.sizes);\n }\n }\n\n // Bail if there are no effective children.\n if (children.length === 0) {\n return null;\n }\n\n // If there is only one effective child, return that child.\n if (children.length === 1) {\n return children[0];\n }\n\n // Return a normalized config object.\n return { type: 'split-area', orientation, children, sizes };\n }\n\n /**\n * Convert a normalized tab area config into a layout tree.\n */\n function realizeTabAreaConfig(\n config: DockLayout.ITabAreaConfig,\n renderer: DockLayout.IRenderer,\n document: Document | ShadowRoot\n ): TabLayoutNode {\n // Create the tab bar for the layout node.\n let tabBar = renderer.createTabBar(document);\n\n // Hide each widget and add it to the tab bar.\n for (const widget of config.widgets) {\n widget.hide();\n tabBar.addTab(widget.title);\n Private.addAria(widget, tabBar);\n }\n\n // Set the current index of the tab bar.\n tabBar.currentIndex = config.currentIndex;\n\n // Return the new tab layout node.\n return new TabLayoutNode(tabBar);\n }\n\n /**\n * Convert a normalized split area config into a layout tree.\n */\n function realizeSplitAreaConfig(\n config: DockLayout.ISplitAreaConfig,\n renderer: DockLayout.IRenderer,\n document: Document | ShadowRoot\n ): SplitLayoutNode {\n // Create the split layout node.\n let node = new SplitLayoutNode(config.orientation);\n\n // Add each child to the layout node.\n config.children.forEach((child, i) => {\n // Create the child data for the layout node.\n let childNode = realizeAreaConfig(child, renderer, document);\n let sizer = createSizer(config.sizes[i]);\n let handle = renderer.createHandle();\n\n // Add the child data to the layout node.\n node.children.push(childNode);\n node.handles.push(handle);\n node.sizers.push(sizer);\n\n // Update the parent for the child node.\n childNode.parent = node;\n });\n\n // Synchronize the handle state for the layout node.\n node.syncHandles();\n\n // Normalize the sizes for the layout node.\n node.normalizeSizes();\n\n // Return the new layout node.\n return node;\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { find } from '@lumino/algorithm';\n\nimport { MimeData } from '@lumino/coreutils';\n\nimport { IDisposable } from '@lumino/disposable';\n\nimport { ElementExt, Platform } from '@lumino/domutils';\n\nimport { Drag } from '@lumino/dragdrop';\n\nimport { ConflatableMessage, Message, MessageLoop } from '@lumino/messaging';\n\nimport { AttachedProperty } from '@lumino/properties';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { DockLayout } from './docklayout';\n\nimport { TabBar } from './tabbar';\n\nimport { Widget } from './widget';\n\n/**\n * A widget which provides a flexible docking area for widgets.\n *\n * #### Notes\n * See also the related [example](../../examples/dockpanel/index.html) and\n * its [source](https://github.com/jupyterlab/lumino/tree/main/examples/example-dockpanel).\n */\nexport class DockPanel extends Widget {\n /**\n * Construct a new dock panel.\n *\n * @param options - The options for initializing the panel.\n */\n constructor(options: DockPanel.IOptions = {}) {\n super();\n this.addClass('lm-DockPanel');\n this._document = options.document || document;\n this._mode = options.mode || 'multiple-document';\n this._renderer = options.renderer || DockPanel.defaultRenderer;\n this._edges = options.edges || Private.DEFAULT_EDGES;\n if (options.tabsMovable !== undefined) {\n this._tabsMovable = options.tabsMovable;\n }\n if (options.tabsConstrained !== undefined) {\n this._tabsConstrained = options.tabsConstrained;\n }\n if (options.addButtonEnabled !== undefined) {\n this._addButtonEnabled = options.addButtonEnabled;\n }\n\n // Toggle the CSS mode attribute.\n this.dataset['mode'] = this._mode;\n\n // Create the delegate renderer for the layout.\n let renderer: DockPanel.IRenderer = {\n createTabBar: () => this._createTabBar(),\n createHandle: () => this._createHandle()\n };\n\n // Set up the dock layout for the panel.\n this.layout = new DockLayout({\n document: this._document,\n renderer,\n spacing: options.spacing,\n hiddenMode: options.hiddenMode\n });\n\n // Set up the overlay drop indicator.\n this.overlay = options.overlay || new DockPanel.Overlay();\n this.node.appendChild(this.overlay.node);\n }\n\n /**\n * Dispose of the resources held by the panel.\n */\n dispose(): void {\n // Ensure the mouse is released.\n this._releaseMouse();\n\n // Hide the overlay.\n this.overlay.hide(0);\n\n // Cancel a drag if one is in progress.\n if (this._drag) {\n this._drag.dispose();\n }\n\n // Dispose of the base class.\n super.dispose();\n }\n\n /**\n * The method for hiding widgets.\n */\n get hiddenMode(): Widget.HiddenMode {\n return (this.layout as DockLayout).hiddenMode;\n }\n\n /**\n * Set the method for hiding widgets.\n */\n set hiddenMode(v: Widget.HiddenMode) {\n (this.layout as DockLayout).hiddenMode = v;\n }\n\n /**\n * A signal emitted when the layout configuration is modified.\n *\n * #### Notes\n * This signal is emitted whenever the current layout configuration\n * may have changed.\n *\n * This signal is emitted asynchronously in a collapsed fashion, so\n * that multiple synchronous modifications results in only a single\n * emit of the signal.\n */\n get layoutModified(): ISignal {\n return this._layoutModified;\n }\n\n /**\n * A signal emitted when the add button on a tab bar is clicked.\n *\n */\n get addRequested(): ISignal> {\n return this._addRequested;\n }\n\n /**\n * The overlay used by the dock panel.\n */\n readonly overlay: DockPanel.IOverlay;\n\n /**\n * The renderer used by the dock panel.\n */\n get renderer(): DockPanel.IRenderer {\n return (this.layout as DockLayout).renderer;\n }\n\n /**\n * Get the spacing between the widgets.\n */\n get spacing(): number {\n return (this.layout as DockLayout).spacing;\n }\n\n /**\n * Set the spacing between the widgets.\n */\n set spacing(value: number) {\n (this.layout as DockLayout).spacing = value;\n }\n\n /**\n * Get the mode for the dock panel.\n */\n get mode(): DockPanel.Mode {\n return this._mode;\n }\n\n /**\n * Set the mode for the dock panel.\n *\n * #### Notes\n * Changing the mode is a destructive operation with respect to the\n * panel's layout configuration. If layout state must be preserved,\n * save the current layout config before changing the mode.\n */\n set mode(value: DockPanel.Mode) {\n // Bail early if the mode does not change.\n if (this._mode === value) {\n return;\n }\n\n // Update the internal mode.\n this._mode = value;\n\n // Toggle the CSS mode attribute.\n this.dataset['mode'] = value;\n\n // Get the layout for the panel.\n let layout = this.layout as DockLayout;\n\n // Configure the layout for the specified mode.\n switch (value) {\n case 'multiple-document':\n for (const tabBar of layout.tabBars()) {\n tabBar.show();\n }\n break;\n case 'single-document':\n layout.restoreLayout(Private.createSingleDocumentConfig(this));\n break;\n default:\n throw 'unreachable';\n }\n\n // Schedule an emit of the layout modified signal.\n MessageLoop.postMessage(this, Private.LayoutModified);\n }\n\n /**\n * Whether the tabs can be dragged / moved at runtime.\n */\n get tabsMovable(): boolean {\n return this._tabsMovable;\n }\n\n /**\n * Enable / Disable draggable / movable tabs.\n */\n set tabsMovable(value: boolean) {\n this._tabsMovable = value;\n for (const tabBar of this.tabBars()) {\n tabBar.tabsMovable = value;\n }\n }\n\n /**\n * Whether the tabs are constrained to their source dock panel\n */\n get tabsConstrained(): boolean {\n return this._tabsConstrained;\n }\n\n /**\n * Constrain/Allow tabs to be dragged outside of this dock panel\n */\n set tabsConstrained(value: boolean) {\n this._tabsConstrained = value;\n }\n\n /**\n * Whether the add buttons for each tab bar are enabled.\n */\n get addButtonEnabled(): boolean {\n return this._addButtonEnabled;\n }\n\n /**\n * Set whether the add buttons for each tab bar are enabled.\n */\n set addButtonEnabled(value: boolean) {\n this._addButtonEnabled = value;\n for (const tabBar of this.tabBars()) {\n tabBar.addButtonEnabled = value;\n }\n }\n\n /**\n * Whether the dock panel is empty.\n */\n get isEmpty(): boolean {\n return (this.layout as DockLayout).isEmpty;\n }\n\n /**\n * Create an iterator over the user widgets in the panel.\n *\n * @returns A new iterator over the user widgets in the panel.\n *\n * #### Notes\n * This iterator does not include the generated tab bars.\n */\n *widgets(): IterableIterator {\n yield* (this.layout as DockLayout).widgets();\n }\n\n /**\n * Create an iterator over the selected widgets in the panel.\n *\n * @returns A new iterator over the selected user widgets.\n *\n * #### Notes\n * This iterator yields the widgets corresponding to the current tab\n * of each tab bar in the panel.\n */\n *selectedWidgets(): IterableIterator {\n yield* (this.layout as DockLayout).selectedWidgets();\n }\n\n /**\n * Create an iterator over the tab bars in the panel.\n *\n * @returns A new iterator over the tab bars in the panel.\n *\n * #### Notes\n * This iterator does not include the user widgets.\n */\n *tabBars(): IterableIterator> {\n yield* (this.layout as DockLayout).tabBars();\n }\n\n /**\n * Create an iterator over the handles in the panel.\n *\n * @returns A new iterator over the handles in the panel.\n */\n *handles(): IterableIterator {\n yield* (this.layout as DockLayout).handles();\n }\n\n /**\n * Select a specific widget in the dock panel.\n *\n * @param widget - The widget of interest.\n *\n * #### Notes\n * This will make the widget the current widget in its tab area.\n */\n selectWidget(widget: Widget): void {\n // Find the tab bar which contains the widget.\n let tabBar = find(this.tabBars(), bar => {\n return bar.titles.indexOf(widget.title) !== -1;\n });\n\n // Throw an error if no tab bar is found.\n if (!tabBar) {\n throw new Error('Widget is not contained in the dock panel.');\n }\n\n // Ensure the widget is the current widget.\n tabBar.currentTitle = widget.title;\n }\n\n /**\n * Activate a specified widget in the dock panel.\n *\n * @param widget - The widget of interest.\n *\n * #### Notes\n * This will select and activate the given widget.\n */\n activateWidget(widget: Widget): void {\n this.selectWidget(widget);\n widget.activate();\n }\n\n /**\n * Save the current layout configuration of the dock panel.\n *\n * @returns A new config object for the current layout state.\n *\n * #### Notes\n * The return value can be provided to the `restoreLayout` method\n * in order to restore the layout to its current configuration.\n */\n saveLayout(): DockPanel.ILayoutConfig {\n return (this.layout as DockLayout).saveLayout();\n }\n\n /**\n * Restore the layout to a previously saved configuration.\n *\n * @param config - The layout configuration to restore.\n *\n * #### Notes\n * Widgets which currently belong to the layout but which are not\n * contained in the config will be unparented.\n *\n * The dock panel automatically reverts to `'multiple-document'`\n * mode when a layout config is restored.\n */\n restoreLayout(config: DockPanel.ILayoutConfig): void {\n // Reset the mode.\n this._mode = 'multiple-document';\n\n // Restore the layout.\n (this.layout as DockLayout).restoreLayout(config);\n\n // Flush the message loop on IE and Edge to prevent flicker.\n if (Platform.IS_EDGE || Platform.IS_IE) {\n MessageLoop.flush();\n }\n\n // Schedule an emit of the layout modified signal.\n MessageLoop.postMessage(this, Private.LayoutModified);\n }\n\n /**\n * Add a widget to the dock panel.\n *\n * @param widget - The widget to add to the dock panel.\n *\n * @param options - The additional options for adding the widget.\n *\n * #### Notes\n * If the panel is in single document mode, the options are ignored\n * and the widget is always added as tab in the hidden tab bar.\n */\n addWidget(widget: Widget, options: DockPanel.IAddOptions = {}): void {\n // Add the widget to the layout.\n if (this._mode === 'single-document') {\n (this.layout as DockLayout).addWidget(widget);\n } else {\n (this.layout as DockLayout).addWidget(widget, options);\n }\n\n // Schedule an emit of the layout modified signal.\n MessageLoop.postMessage(this, Private.LayoutModified);\n }\n\n /**\n * Process a message sent to the widget.\n *\n * @param msg - The message sent to the widget.\n */\n processMessage(msg: Message): void {\n if (msg.type === 'layout-modified') {\n this._layoutModified.emit(undefined);\n } else {\n super.processMessage(msg);\n }\n }\n\n /**\n * Handle the DOM events for the dock panel.\n *\n * @param event - The DOM event sent to the panel.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the panel's DOM node. It should\n * not be called directly by user code.\n */\n handleEvent(event: Event): void {\n switch (event.type) {\n case 'lm-dragenter':\n this._evtDragEnter(event as Drag.Event);\n break;\n case 'lm-dragleave':\n this._evtDragLeave(event as Drag.Event);\n break;\n case 'lm-dragover':\n this._evtDragOver(event as Drag.Event);\n break;\n case 'lm-drop':\n this._evtDrop(event as Drag.Event);\n break;\n case 'pointerdown':\n this._evtPointerDown(event as PointerEvent);\n break;\n case 'pointermove':\n this._evtPointerMove(event as PointerEvent);\n break;\n case 'pointerup':\n this._evtPointerUp(event as PointerEvent);\n break;\n case 'keydown':\n this._evtKeyDown(event as KeyboardEvent);\n break;\n case 'contextmenu':\n event.preventDefault();\n event.stopPropagation();\n break;\n }\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n this.node.addEventListener('lm-dragenter', this);\n this.node.addEventListener('lm-dragleave', this);\n this.node.addEventListener('lm-dragover', this);\n this.node.addEventListener('lm-drop', this);\n this.node.addEventListener('pointerdown', this);\n }\n\n /**\n * A message handler invoked on an `'after-detach'` message.\n */\n protected onAfterDetach(msg: Message): void {\n this.node.removeEventListener('lm-dragenter', this);\n this.node.removeEventListener('lm-dragleave', this);\n this.node.removeEventListener('lm-dragover', this);\n this.node.removeEventListener('lm-drop', this);\n this.node.removeEventListener('pointerdown', this);\n this._releaseMouse();\n }\n\n /**\n * A message handler invoked on a `'child-added'` message.\n */\n protected onChildAdded(msg: Widget.ChildMessage): void {\n // Ignore the generated tab bars.\n if (Private.isGeneratedTabBarProperty.get(msg.child)) {\n return;\n }\n\n // Add the widget class to the child.\n msg.child.addClass('lm-DockPanel-widget');\n }\n\n /**\n * A message handler invoked on a `'child-removed'` message.\n */\n protected onChildRemoved(msg: Widget.ChildMessage): void {\n // Ignore the generated tab bars.\n if (Private.isGeneratedTabBarProperty.get(msg.child)) {\n return;\n }\n\n // Remove the widget class from the child.\n msg.child.removeClass('lm-DockPanel-widget');\n\n // Schedule an emit of the layout modified signal.\n MessageLoop.postMessage(this, Private.LayoutModified);\n }\n\n /**\n * Handle the `'lm-dragenter'` event for the dock panel.\n */\n private _evtDragEnter(event: Drag.Event): void {\n // If the factory mime type is present, mark the event as\n // handled in order to get the rest of the drag events.\n if (event.mimeData.hasData('application/vnd.lumino.widget-factory')) {\n event.preventDefault();\n event.stopPropagation();\n }\n }\n\n /**\n * Handle the `'lm-dragleave'` event for the dock panel.\n */\n private _evtDragLeave(event: Drag.Event): void {\n // Mark the event as handled.\n event.preventDefault();\n\n if (this._tabsConstrained && event.source !== this) return;\n\n event.stopPropagation();\n\n // The new target might be a descendant, so we might still handle the drop.\n // Hide asynchronously so that if a lm-dragover event bubbles up to us, the\n // hide is cancelled by the lm-dragover handler's show overlay logic.\n this.overlay.hide(1);\n }\n\n /**\n * Handle the `'lm-dragover'` event for the dock panel.\n */\n private _evtDragOver(event: Drag.Event): void {\n // Mark the event as handled.\n event.preventDefault();\n\n // Show the drop indicator overlay and update the drop\n // action based on the drop target zone under the mouse.\n if (\n (this._tabsConstrained && event.source !== this) ||\n this._showOverlay(event.clientX, event.clientY) === 'invalid'\n ) {\n event.dropAction = 'none';\n } else {\n event.stopPropagation();\n event.dropAction = event.proposedAction;\n }\n }\n\n /**\n * Handle the `'lm-drop'` event for the dock panel.\n */\n private _evtDrop(event: Drag.Event): void {\n // Mark the event as handled.\n event.preventDefault();\n\n // Hide the drop indicator overlay.\n this.overlay.hide(0);\n\n // Bail if the proposed action is to do nothing.\n if (event.proposedAction === 'none') {\n event.dropAction = 'none';\n return;\n }\n\n // Find the drop target under the mouse.\n let { clientX, clientY } = event;\n let { zone, target } = Private.findDropTarget(\n this,\n clientX,\n clientY,\n this._edges\n );\n\n // Bail if the drop zone is invalid.\n if (\n (this._tabsConstrained && event.source !== this) ||\n zone === 'invalid'\n ) {\n event.dropAction = 'none';\n return;\n }\n\n // Bail if the factory mime type has invalid data.\n let mimeData = event.mimeData;\n let factory = mimeData.getData('application/vnd.lumino.widget-factory');\n if (typeof factory !== 'function') {\n event.dropAction = 'none';\n return;\n }\n\n // Bail if the factory does not produce a widget.\n let widget = factory();\n if (!(widget instanceof Widget)) {\n event.dropAction = 'none';\n return;\n }\n\n // Bail if the widget is an ancestor of the dock panel.\n if (widget.contains(this)) {\n event.dropAction = 'none';\n return;\n }\n\n // Find the reference widget for the drop target.\n let ref = target ? Private.getDropRef(target.tabBar) : null;\n\n // Add the widget according to the indicated drop zone.\n switch (zone) {\n case 'root-all':\n this.addWidget(widget);\n break;\n case 'root-top':\n this.addWidget(widget, { mode: 'split-top' });\n break;\n case 'root-left':\n this.addWidget(widget, { mode: 'split-left' });\n break;\n case 'root-right':\n this.addWidget(widget, { mode: 'split-right' });\n break;\n case 'root-bottom':\n this.addWidget(widget, { mode: 'split-bottom' });\n break;\n case 'widget-all':\n this.addWidget(widget, { mode: 'tab-after', ref });\n break;\n case 'widget-top':\n this.addWidget(widget, { mode: 'split-top', ref });\n break;\n case 'widget-left':\n this.addWidget(widget, { mode: 'split-left', ref });\n break;\n case 'widget-right':\n this.addWidget(widget, { mode: 'split-right', ref });\n break;\n case 'widget-bottom':\n this.addWidget(widget, { mode: 'split-bottom', ref });\n break;\n case 'widget-tab':\n this.addWidget(widget, { mode: 'tab-after', ref });\n break;\n default:\n throw 'unreachable';\n }\n\n // Accept the proposed drop action.\n event.dropAction = event.proposedAction;\n\n // Stop propagation if we have not bailed so far.\n event.stopPropagation();\n\n // Activate the dropped widget.\n this.activateWidget(widget);\n }\n\n /**\n * Handle the `'keydown'` event for the dock panel.\n */\n private _evtKeyDown(event: KeyboardEvent): void {\n // Stop input events during drag.\n event.preventDefault();\n event.stopPropagation();\n\n // Release the mouse if `Escape` is pressed.\n if (event.keyCode === 27) {\n // Finalize the mouse release.\n this._releaseMouse();\n\n // Schedule an emit of the layout modified signal.\n MessageLoop.postMessage(this, Private.LayoutModified);\n }\n }\n\n /**\n * Handle the `'pointerdown'` event for the dock panel.\n */\n private _evtPointerDown(event: PointerEvent): void {\n // Do nothing if the left mouse button is not pressed.\n if (event.button !== 0) {\n return;\n }\n\n // Find the handle which contains the mouse target, if any.\n let layout = this.layout as DockLayout;\n let target = event.target as HTMLElement;\n let handle = find(layout.handles(), handle => handle.contains(target));\n if (!handle) {\n return;\n }\n\n // Stop the event when a handle is pressed.\n event.preventDefault();\n event.stopPropagation();\n\n // Add the extra document listeners.\n this._document.addEventListener('keydown', this, true);\n this._document.addEventListener('pointerup', this, true);\n this._document.addEventListener('pointermove', this, true);\n this._document.addEventListener('contextmenu', this, true);\n\n // Compute the offset deltas for the handle press.\n let rect = handle.getBoundingClientRect();\n let deltaX = event.clientX - rect.left;\n let deltaY = event.clientY - rect.top;\n\n // Override the cursor and store the press data.\n let style = window.getComputedStyle(handle);\n let override = Drag.overrideCursor(style.cursor!, this._document);\n this._pressData = { handle, deltaX, deltaY, override };\n }\n\n /**\n * Handle the `'pointermove'` event for the dock panel.\n */\n private _evtPointerMove(event: PointerEvent): void {\n // Bail early if no drag is in progress.\n if (!this._pressData) {\n return;\n }\n\n // Stop the event when dragging a handle.\n event.preventDefault();\n event.stopPropagation();\n\n // Compute the desired offset position for the handle.\n let rect = this.node.getBoundingClientRect();\n let xPos = event.clientX - rect.left - this._pressData.deltaX;\n let yPos = event.clientY - rect.top - this._pressData.deltaY;\n\n // Set the handle as close to the desired position as possible.\n let layout = this.layout as DockLayout;\n layout.moveHandle(this._pressData.handle, xPos, yPos);\n }\n\n /**\n * Handle the `'pointerup'` event for the dock panel.\n */\n private _evtPointerUp(event: PointerEvent): void {\n // Do nothing if the left mouse button is not released.\n if (event.button !== 0) {\n return;\n }\n\n // Stop the event when releasing a handle.\n event.preventDefault();\n event.stopPropagation();\n\n // Finalize the mouse release.\n this._releaseMouse();\n\n // Schedule an emit of the layout modified signal.\n MessageLoop.postMessage(this, Private.LayoutModified);\n }\n\n /**\n * Release the mouse grab for the dock panel.\n */\n private _releaseMouse(): void {\n // Bail early if no drag is in progress.\n if (!this._pressData) {\n return;\n }\n\n // Clear the override cursor.\n this._pressData.override.dispose();\n this._pressData = null;\n\n // Remove the extra document listeners.\n this._document.removeEventListener('keydown', this, true);\n this._document.removeEventListener('pointerup', this, true);\n this._document.removeEventListener('pointermove', this, true);\n this._document.removeEventListener('contextmenu', this, true);\n }\n\n /**\n * Show the overlay indicator at the given client position.\n *\n * Returns the drop zone at the specified client position.\n *\n * #### Notes\n * If the position is not over a valid zone, the overlay is hidden.\n */\n private _showOverlay(clientX: number, clientY: number): Private.DropZone {\n // Find the dock target for the given client position.\n let { zone, target } = Private.findDropTarget(\n this,\n clientX,\n clientY,\n this._edges\n );\n\n // If the drop zone is invalid, hide the overlay and bail.\n if (zone === 'invalid') {\n this.overlay.hide(100);\n return zone;\n }\n\n // Setup the variables needed to compute the overlay geometry.\n let top: number;\n let left: number;\n let right: number;\n let bottom: number;\n let box = ElementExt.boxSizing(this.node); // TODO cache this?\n let rect = this.node.getBoundingClientRect();\n\n // Compute the overlay geometry based on the dock zone.\n switch (zone) {\n case 'root-all':\n top = box.paddingTop;\n left = box.paddingLeft;\n right = box.paddingRight;\n bottom = box.paddingBottom;\n break;\n case 'root-top':\n top = box.paddingTop;\n left = box.paddingLeft;\n right = box.paddingRight;\n bottom = rect.height * Private.GOLDEN_RATIO;\n break;\n case 'root-left':\n top = box.paddingTop;\n left = box.paddingLeft;\n right = rect.width * Private.GOLDEN_RATIO;\n bottom = box.paddingBottom;\n break;\n case 'root-right':\n top = box.paddingTop;\n left = rect.width * Private.GOLDEN_RATIO;\n right = box.paddingRight;\n bottom = box.paddingBottom;\n break;\n case 'root-bottom':\n top = rect.height * Private.GOLDEN_RATIO;\n left = box.paddingLeft;\n right = box.paddingRight;\n bottom = box.paddingBottom;\n break;\n case 'widget-all':\n top = target!.top;\n left = target!.left;\n right = target!.right;\n bottom = target!.bottom;\n break;\n case 'widget-top':\n top = target!.top;\n left = target!.left;\n right = target!.right;\n bottom = target!.bottom + target!.height / 2;\n break;\n case 'widget-left':\n top = target!.top;\n left = target!.left;\n right = target!.right + target!.width / 2;\n bottom = target!.bottom;\n break;\n case 'widget-right':\n top = target!.top;\n left = target!.left + target!.width / 2;\n right = target!.right;\n bottom = target!.bottom;\n break;\n case 'widget-bottom':\n top = target!.top + target!.height / 2;\n left = target!.left;\n right = target!.right;\n bottom = target!.bottom;\n break;\n case 'widget-tab': {\n const tabHeight = target!.tabBar.node.getBoundingClientRect().height;\n top = target!.top;\n left = target!.left;\n right = target!.right;\n bottom = target!.bottom + target!.height - tabHeight;\n break;\n }\n default:\n throw 'unreachable';\n }\n\n // Show the overlay with the computed geometry.\n this.overlay.show({ top, left, right, bottom });\n\n // Finally, return the computed drop zone.\n return zone;\n }\n\n /**\n * Create a new tab bar for use by the panel.\n */\n private _createTabBar(): TabBar {\n // Create the tab bar.\n let tabBar = this._renderer.createTabBar(this._document);\n\n // Set the generated tab bar property for the tab bar.\n Private.isGeneratedTabBarProperty.set(tabBar, true);\n\n // Hide the tab bar when in single document mode.\n if (this._mode === 'single-document') {\n tabBar.hide();\n }\n\n // Enforce necessary tab bar behavior.\n // TODO do we really want to enforce *all* of these?\n tabBar.tabsMovable = this._tabsMovable;\n tabBar.allowDeselect = false;\n tabBar.addButtonEnabled = this._addButtonEnabled;\n tabBar.removeBehavior = 'select-previous-tab';\n tabBar.insertBehavior = 'select-tab-if-needed';\n\n // Connect the signal handlers for the tab bar.\n tabBar.tabMoved.connect(this._onTabMoved, this);\n tabBar.currentChanged.connect(this._onCurrentChanged, this);\n tabBar.tabCloseRequested.connect(this._onTabCloseRequested, this);\n tabBar.tabDetachRequested.connect(this._onTabDetachRequested, this);\n tabBar.tabActivateRequested.connect(this._onTabActivateRequested, this);\n tabBar.addRequested.connect(this._onTabAddRequested, this);\n\n // Return the initialized tab bar.\n return tabBar;\n }\n\n /**\n * Create a new handle for use by the panel.\n */\n private _createHandle(): HTMLDivElement {\n return this._renderer.createHandle();\n }\n\n /**\n * Handle the `tabMoved` signal from a tab bar.\n */\n private _onTabMoved(): void {\n MessageLoop.postMessage(this, Private.LayoutModified);\n }\n\n /**\n * Handle the `currentChanged` signal from a tab bar.\n */\n private _onCurrentChanged(\n sender: TabBar,\n args: TabBar.ICurrentChangedArgs\n ): void {\n // Extract the previous and current title from the args.\n let { previousTitle, currentTitle } = args;\n\n // Hide the previous widget.\n if (previousTitle) {\n previousTitle.owner.hide();\n }\n\n // Show the current widget.\n if (currentTitle) {\n currentTitle.owner.show();\n }\n\n // Flush the message loop on IE and Edge to prevent flicker.\n if (Platform.IS_EDGE || Platform.IS_IE) {\n MessageLoop.flush();\n }\n\n // Schedule an emit of the layout modified signal.\n MessageLoop.postMessage(this, Private.LayoutModified);\n }\n\n /**\n * Handle the `addRequested` signal from a tab bar.\n */\n private _onTabAddRequested(sender: TabBar): void {\n this._addRequested.emit(sender);\n }\n\n /**\n * Handle the `tabActivateRequested` signal from a tab bar.\n */\n private _onTabActivateRequested(\n sender: TabBar,\n args: TabBar.ITabActivateRequestedArgs\n ): void {\n args.title.owner.activate();\n }\n\n /**\n * Handle the `tabCloseRequested` signal from a tab bar.\n */\n private _onTabCloseRequested(\n sender: TabBar,\n args: TabBar.ITabCloseRequestedArgs\n ): void {\n args.title.owner.close();\n }\n\n /**\n * Handle the `tabDetachRequested` signal from a tab bar.\n */\n private _onTabDetachRequested(\n sender: TabBar,\n args: TabBar.ITabDetachRequestedArgs\n ): void {\n // Do nothing if a drag is already in progress.\n if (this._drag) {\n return;\n }\n\n // Release the tab bar's hold on the mouse.\n sender.releaseMouse();\n\n // Extract the data from the args.\n let { title, tab, clientX, clientY, offset } = args;\n\n // Setup the mime data for the drag operation.\n let mimeData = new MimeData();\n let factory = () => title.owner;\n mimeData.setData('application/vnd.lumino.widget-factory', factory);\n\n // Create the drag image for the drag operation.\n let dragImage = tab.cloneNode(true) as HTMLElement;\n if (offset) {\n dragImage.style.top = `-${offset.y}px`;\n dragImage.style.left = `-${offset.x}px`;\n }\n\n // Create the drag object to manage the drag-drop operation.\n this._drag = new Drag({\n document: this._document,\n mimeData,\n dragImage,\n proposedAction: 'move',\n supportedActions: 'move',\n source: this\n });\n\n // Hide the tab node in the original tab.\n tab.classList.add('lm-mod-hidden');\n let cleanup = () => {\n this._drag = null;\n tab.classList.remove('lm-mod-hidden');\n };\n\n // Start the drag operation and cleanup when done.\n this._drag.start(clientX, clientY).then(cleanup);\n }\n\n private _edges: DockPanel.IEdges;\n private _document: Document | ShadowRoot;\n private _mode: DockPanel.Mode;\n private _drag: Drag | null = null;\n private _renderer: DockPanel.IRenderer;\n private _tabsMovable: boolean = true;\n private _tabsConstrained: boolean = false;\n private _addButtonEnabled: boolean = false;\n private _pressData: Private.IPressData | null = null;\n private _layoutModified = new Signal(this);\n\n private _addRequested = new Signal>(this);\n}\n\n/**\n * The namespace for the `DockPanel` class statics.\n */\nexport namespace DockPanel {\n /**\n * An options object for creating a dock panel.\n */\n export interface IOptions {\n /**\n * The document to use with the dock panel.\n *\n * The default is the global `document` instance.\n */\n\n document?: Document | ShadowRoot;\n /**\n * The overlay to use with the dock panel.\n *\n * The default is a new `Overlay` instance.\n */\n overlay?: IOverlay;\n\n /**\n * The renderer to use for the dock panel.\n *\n * The default is a shared renderer instance.\n */\n renderer?: IRenderer;\n\n /**\n * The spacing between the items in the panel.\n *\n * The default is `4`.\n */\n spacing?: number;\n\n /**\n * The mode for the dock panel.\n *\n * The default is `'multiple-document'`.\n */\n mode?: DockPanel.Mode;\n\n /**\n * The sizes of the edge drop zones, in pixels.\n * If not given, default values will be used.\n */\n edges?: IEdges;\n\n /**\n * The method for hiding widgets.\n *\n * The default is `Widget.HiddenMode.Display`.\n */\n hiddenMode?: Widget.HiddenMode;\n\n /**\n * Allow tabs to be draggable / movable by user.\n *\n * The default is `'true'`.\n */\n tabsMovable?: boolean;\n\n /**\n * Constrain tabs to this dock panel\n *\n * The default is `'false'`.\n */\n tabsConstrained?: boolean;\n\n /**\n * Enable add buttons in each of the dock panel's tab bars.\n *\n * The default is `'false'`.\n */\n addButtonEnabled?: boolean;\n }\n\n /**\n * The sizes of the edge drop zones, in pixels.\n */\n export interface IEdges {\n /**\n * The size of the top edge drop zone.\n */\n top: number;\n\n /**\n * The size of the right edge drop zone.\n */\n right: number;\n\n /**\n * The size of the bottom edge drop zone.\n */\n bottom: number;\n\n /**\n * The size of the left edge drop zone.\n */\n left: number;\n }\n\n /**\n * A type alias for the supported dock panel modes.\n */\n export type Mode =\n | /**\n * The single document mode.\n *\n * In this mode, only a single widget is visible at a time, and that\n * widget fills the available layout space. No tab bars are visible.\n */\n 'single-document'\n\n /**\n * The multiple document mode.\n *\n * In this mode, multiple documents are displayed in separate tab\n * areas, and those areas can be individually resized by the user.\n */\n | 'multiple-document';\n\n /**\n * A type alias for a layout configuration object.\n */\n export type ILayoutConfig = DockLayout.ILayoutConfig;\n\n /**\n * A type alias for the supported insertion modes.\n */\n export type InsertMode = DockLayout.InsertMode;\n\n /**\n * A type alias for the add widget options.\n */\n export type IAddOptions = DockLayout.IAddOptions;\n\n /**\n * An object which holds the geometry for overlay positioning.\n */\n export interface IOverlayGeometry {\n /**\n * The distance between the overlay and parent top edges.\n */\n top: number;\n\n /**\n * The distance between the overlay and parent left edges.\n */\n left: number;\n\n /**\n * The distance between the overlay and parent right edges.\n */\n right: number;\n\n /**\n * The distance between the overlay and parent bottom edges.\n */\n bottom: number;\n }\n\n /**\n * An object which manages the overlay node for a dock panel.\n */\n export interface IOverlay {\n /**\n * The DOM node for the overlay.\n */\n readonly node: HTMLDivElement;\n\n /**\n * Show the overlay using the given overlay geometry.\n *\n * @param geo - The desired geometry for the overlay.\n *\n * #### Notes\n * The given geometry values assume the node will use absolute\n * positioning.\n *\n * This is called on every mouse move event during a drag in order\n * to update the position of the overlay. It should be efficient.\n */\n show(geo: IOverlayGeometry): void;\n\n /**\n * Hide the overlay node.\n *\n * @param delay - The delay (in ms) before hiding the overlay.\n * A delay value <= 0 should hide the overlay immediately.\n *\n * #### Notes\n * This is called whenever the overlay node should been hidden.\n */\n hide(delay: number): void;\n }\n\n /**\n * A concrete implementation of `IOverlay`.\n *\n * This is the default overlay implementation for a dock panel.\n */\n export class Overlay implements IOverlay {\n /**\n * Construct a new overlay.\n */\n constructor() {\n this.node = document.createElement('div');\n this.node.classList.add('lm-DockPanel-overlay');\n this.node.classList.add('lm-mod-hidden');\n this.node.style.position = 'absolute';\n this.node.style.contain = 'strict';\n }\n\n /**\n * The DOM node for the overlay.\n */\n readonly node: HTMLDivElement;\n\n /**\n * Show the overlay using the given overlay geometry.\n *\n * @param geo - The desired geometry for the overlay.\n */\n show(geo: IOverlayGeometry): void {\n // Update the position of the overlay.\n let style = this.node.style;\n style.top = `${geo.top}px`;\n style.left = `${geo.left}px`;\n style.right = `${geo.right}px`;\n style.bottom = `${geo.bottom}px`;\n\n // Clear any pending hide timer.\n clearTimeout(this._timer);\n this._timer = -1;\n\n // If the overlay is already visible, we're done.\n if (!this._hidden) {\n return;\n }\n\n // Clear the hidden flag.\n this._hidden = false;\n\n // Finally, show the overlay.\n this.node.classList.remove('lm-mod-hidden');\n }\n\n /**\n * Hide the overlay node.\n *\n * @param delay - The delay (in ms) before hiding the overlay.\n * A delay value <= 0 will hide the overlay immediately.\n */\n hide(delay: number): void {\n // Do nothing if the overlay is already hidden.\n if (this._hidden) {\n return;\n }\n\n // Hide immediately if the delay is <= 0.\n if (delay <= 0) {\n clearTimeout(this._timer);\n this._timer = -1;\n this._hidden = true;\n this.node.classList.add('lm-mod-hidden');\n return;\n }\n\n // Do nothing if a hide is already pending.\n if (this._timer !== -1) {\n return;\n }\n\n // Otherwise setup the hide timer.\n this._timer = window.setTimeout(() => {\n this._timer = -1;\n this._hidden = true;\n this.node.classList.add('lm-mod-hidden');\n }, delay);\n }\n\n private _timer = -1;\n private _hidden = true;\n }\n\n /**\n * A type alias for a dock panel renderer;\n */\n export type IRenderer = DockLayout.IRenderer;\n\n /**\n * The default implementation of `IRenderer`.\n */\n export class Renderer implements IRenderer {\n /**\n * Create a new tab bar for use with a dock panel.\n *\n * @returns A new tab bar for a dock panel.\n */\n createTabBar(document?: Document | ShadowRoot): TabBar {\n let bar = new TabBar({ document });\n bar.addClass('lm-DockPanel-tabBar');\n return bar;\n }\n\n /**\n * Create a new handle node for use with a dock panel.\n *\n * @returns A new handle node for a dock panel.\n */\n createHandle(): HTMLDivElement {\n let handle = document.createElement('div');\n handle.className = 'lm-DockPanel-handle';\n return handle;\n }\n }\n\n /**\n * The default `Renderer` instance.\n */\n export const defaultRenderer = new Renderer();\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * A fraction used for sizing root panels; ~= `1 / golden_ratio`.\n */\n export const GOLDEN_RATIO = 0.618;\n\n /**\n * The default sizes for the edge drop zones, in pixels.\n */\n export const DEFAULT_EDGES = {\n /**\n * The size of the top edge dock zone for the root panel, in pixels.\n * This is different from the others to distinguish between the top\n * tab bar and the top root zone.\n */\n top: 12,\n\n /**\n * The size of the edge dock zone for the root panel, in pixels.\n */\n right: 40,\n\n /**\n * The size of the edge dock zone for the root panel, in pixels.\n */\n bottom: 40,\n\n /**\n * The size of the edge dock zone for the root panel, in pixels.\n */\n left: 40\n };\n\n /**\n * A singleton `'layout-modified'` conflatable message.\n */\n export const LayoutModified = new ConflatableMessage('layout-modified');\n\n /**\n * An object which holds mouse press data.\n */\n export interface IPressData {\n /**\n * The handle which was pressed.\n */\n handle: HTMLDivElement;\n\n /**\n * The X offset of the press in handle coordinates.\n */\n deltaX: number;\n\n /**\n * The Y offset of the press in handle coordinates.\n */\n deltaY: number;\n\n /**\n * The disposable which will clear the override cursor.\n */\n override: IDisposable;\n }\n\n /**\n * A type alias for a drop zone.\n */\n export type DropZone =\n | /**\n * An invalid drop zone.\n */\n 'invalid'\n\n /**\n * The entirety of the root dock area.\n */\n | 'root-all'\n\n /**\n * The top portion of the root dock area.\n */\n | 'root-top'\n\n /**\n * The left portion of the root dock area.\n */\n | 'root-left'\n\n /**\n * The right portion of the root dock area.\n */\n | 'root-right'\n\n /**\n * The bottom portion of the root dock area.\n */\n | 'root-bottom'\n\n /**\n * The entirety of a tabbed widget area.\n */\n | 'widget-all'\n\n /**\n * The top portion of tabbed widget area.\n */\n | 'widget-top'\n\n /**\n * The left portion of tabbed widget area.\n */\n | 'widget-left'\n\n /**\n * The right portion of tabbed widget area.\n */\n | 'widget-right'\n\n /**\n * The bottom portion of tabbed widget area.\n */\n | 'widget-bottom'\n\n /**\n * The the bar of a tabbed widget area.\n */\n | 'widget-tab';\n\n /**\n * An object which holds the drop target zone and widget.\n */\n export interface IDropTarget {\n /**\n * The semantic zone for the mouse position.\n */\n zone: DropZone;\n\n /**\n * The tab area geometry for the drop zone, or `null`.\n */\n target: DockLayout.ITabAreaGeometry | null;\n }\n\n /**\n * An attached property used to track generated tab bars.\n */\n export const isGeneratedTabBarProperty = new AttachedProperty<\n Widget,\n boolean\n >({\n name: 'isGeneratedTabBar',\n create: () => false\n });\n\n /**\n * Create a single document config for the widgets in a dock panel.\n */\n export function createSingleDocumentConfig(\n panel: DockPanel\n ): DockPanel.ILayoutConfig {\n // Return an empty config if the panel is empty.\n if (panel.isEmpty) {\n return { main: null };\n }\n\n // Get a flat array of the widgets in the panel.\n let widgets = Array.from(panel.widgets());\n\n // Get the first selected widget in the panel.\n let selected = panel.selectedWidgets().next().value;\n\n // Compute the current index for the new config.\n let currentIndex = selected ? widgets.indexOf(selected) : -1;\n\n // Return the single document config.\n return { main: { type: 'tab-area', widgets, currentIndex } };\n }\n\n /**\n * Find the drop target at the given client position.\n */\n export function findDropTarget(\n panel: DockPanel,\n clientX: number,\n clientY: number,\n edges: DockPanel.IEdges\n ): IDropTarget {\n // Bail if the mouse is not over the dock panel.\n if (!ElementExt.hitTest(panel.node, clientX, clientY)) {\n return { zone: 'invalid', target: null };\n }\n\n // Look up the layout for the panel.\n let layout = panel.layout as DockLayout;\n\n // If the layout is empty, indicate the entire root drop zone.\n if (layout.isEmpty) {\n return { zone: 'root-all', target: null };\n }\n\n // Test the edge zones when in multiple document mode.\n if (panel.mode === 'multiple-document') {\n // Get the client rect for the dock panel.\n let panelRect = panel.node.getBoundingClientRect();\n\n // Compute the distance to each edge of the panel.\n let pl = clientX - panelRect.left + 1;\n let pt = clientY - panelRect.top + 1;\n let pr = panelRect.right - clientX;\n let pb = panelRect.bottom - clientY;\n\n // Find the minimum distance to an edge.\n let pd = Math.min(pt, pr, pb, pl);\n\n // Return a root zone if the mouse is within an edge.\n switch (pd) {\n case pt:\n if (pt < edges.top) {\n return { zone: 'root-top', target: null };\n }\n break;\n case pr:\n if (pr < edges.right) {\n return { zone: 'root-right', target: null };\n }\n break;\n case pb:\n if (pb < edges.bottom) {\n return { zone: 'root-bottom', target: null };\n }\n break;\n case pl:\n if (pl < edges.left) {\n return { zone: 'root-left', target: null };\n }\n break;\n default:\n throw 'unreachable';\n }\n }\n\n // Hit test the dock layout at the given client position.\n let target = layout.hitTestTabAreas(clientX, clientY);\n\n // Bail if no target area was found.\n if (!target) {\n return { zone: 'invalid', target: null };\n }\n\n // Return the whole tab area when in single document mode.\n if (panel.mode === 'single-document') {\n return { zone: 'widget-all', target };\n }\n\n // Compute the distance to each edge of the tab area.\n let al = target.x - target.left + 1;\n let at = target.y - target.top + 1;\n let ar = target.left + target.width - target.x;\n let ab = target.top + target.height - target.y;\n\n const tabHeight = target.tabBar.node.getBoundingClientRect().height;\n if (at < tabHeight) {\n return { zone: 'widget-tab', target };\n }\n\n // Get the X and Y edge sizes for the area.\n let rx = Math.round(target.width / 3);\n let ry = Math.round(target.height / 3);\n\n // If the mouse is not within an edge, indicate the entire area.\n if (al > rx && ar > rx && at > ry && ab > ry) {\n return { zone: 'widget-all', target };\n }\n\n // Scale the distances by the slenderness ratio.\n al /= rx;\n at /= ry;\n ar /= rx;\n ab /= ry;\n\n // Find the minimum distance to the area edge.\n let ad = Math.min(al, at, ar, ab);\n\n // Find the widget zone for the area edge.\n let zone: DropZone;\n switch (ad) {\n case al:\n zone = 'widget-left';\n break;\n case at:\n zone = 'widget-top';\n break;\n case ar:\n zone = 'widget-right';\n break;\n case ab:\n zone = 'widget-bottom';\n break;\n default:\n throw 'unreachable';\n }\n\n // Return the final drop target.\n return { zone, target };\n }\n\n /**\n * Get the drop reference widget for a tab bar.\n */\n export function getDropRef(tabBar: TabBar): Widget | null {\n if (tabBar.titles.length === 0) {\n return null;\n }\n if (tabBar.currentTitle) {\n return tabBar.currentTitle.owner;\n }\n return tabBar.titles[tabBar.titles.length - 1].owner;\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt, find, max } from '@lumino/algorithm';\n\nimport { IDisposable } from '@lumino/disposable';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { Widget } from './widget';\n\n/**\n * A class which tracks focus among a set of widgets.\n *\n * This class is useful when code needs to keep track of the most\n * recently focused widget(s) among a set of related widgets.\n */\nexport class FocusTracker implements IDisposable {\n /**\n * Dispose of the resources held by the tracker.\n */\n dispose(): void {\n // Do nothing if the tracker is already disposed.\n if (this._counter < 0) {\n return;\n }\n\n // Mark the tracker as disposed.\n this._counter = -1;\n\n // Clear the connections for the tracker.\n Signal.clearData(this);\n\n // Remove all event listeners.\n for (const widget of this._widgets) {\n widget.node.removeEventListener('focus', this, true);\n widget.node.removeEventListener('blur', this, true);\n }\n\n // Clear the internal data structures.\n this._activeWidget = null;\n this._currentWidget = null;\n this._nodes.clear();\n this._numbers.clear();\n this._widgets.length = 0;\n }\n\n /**\n * A signal emitted when the current widget has changed.\n */\n get currentChanged(): ISignal> {\n return this._currentChanged;\n }\n\n /**\n * A signal emitted when the active widget has changed.\n */\n get activeChanged(): ISignal> {\n return this._activeChanged;\n }\n\n /**\n * A flag indicating whether the tracker is disposed.\n */\n get isDisposed(): boolean {\n return this._counter < 0;\n }\n\n /**\n * The current widget in the tracker.\n *\n * #### Notes\n * The current widget is the widget among the tracked widgets which\n * has the *descendant node* which has most recently been focused.\n *\n * The current widget will not be updated if the node loses focus. It\n * will only be updated when a different tracked widget gains focus.\n *\n * If the current widget is removed from the tracker, the previous\n * current widget will be restored.\n *\n * This behavior is intended to follow a user's conceptual model of\n * a semantically \"current\" widget, where the \"last thing of type X\"\n * to be interacted with is the \"current instance of X\", regardless\n * of whether that instance still has focus.\n */\n get currentWidget(): T | null {\n return this._currentWidget;\n }\n\n /**\n * The active widget in the tracker.\n *\n * #### Notes\n * The active widget is the widget among the tracked widgets which\n * has the *descendant node* which is currently focused.\n */\n get activeWidget(): T | null {\n return this._activeWidget;\n }\n\n /**\n * A read only array of the widgets being tracked.\n */\n get widgets(): ReadonlyArray {\n return this._widgets;\n }\n\n /**\n * Get the focus number for a particular widget in the tracker.\n *\n * @param widget - The widget of interest.\n *\n * @returns The focus number for the given widget, or `-1` if the\n * widget has not had focus since being added to the tracker, or\n * is not contained by the tracker.\n *\n * #### Notes\n * The focus number indicates the relative order in which the widgets\n * have gained focus. A widget with a larger number has gained focus\n * more recently than a widget with a smaller number.\n *\n * The `currentWidget` will always have the largest focus number.\n *\n * All widgets start with a focus number of `-1`, which indicates that\n * the widget has not been focused since being added to the tracker.\n */\n focusNumber(widget: T): number {\n let n = this._numbers.get(widget);\n return n === undefined ? -1 : n;\n }\n\n /**\n * Test whether the focus tracker contains a given widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns `true` if the widget is tracked, `false` otherwise.\n */\n has(widget: T): boolean {\n return this._numbers.has(widget);\n }\n\n /**\n * Add a widget to the focus tracker.\n *\n * @param widget - The widget of interest.\n *\n * #### Notes\n * A widget will be automatically removed from the tracker if it\n * is disposed after being added.\n *\n * If the widget is already tracked, this is a no-op.\n */\n add(widget: T): void {\n // Do nothing if the widget is already tracked.\n if (this._numbers.has(widget)) {\n return;\n }\n\n // Test whether the widget has focus.\n let focused = widget.node.contains(document.activeElement);\n\n // Set up the initial focus number.\n let n = focused ? this._counter++ : -1;\n\n // Add the widget to the internal data structures.\n this._widgets.push(widget);\n this._numbers.set(widget, n);\n this._nodes.set(widget.node, widget);\n\n // Set up the event listeners. The capturing phase must be used\n // since the 'focus' and 'blur' events don't bubble and Firefox\n // doesn't support the 'focusin' or 'focusout' events.\n widget.node.addEventListener('focus', this, true);\n widget.node.addEventListener('blur', this, true);\n\n // Connect the disposed signal handler.\n widget.disposed.connect(this._onWidgetDisposed, this);\n\n // Set the current and active widgets if needed.\n if (focused) {\n this._setWidgets(widget, widget);\n }\n }\n\n /**\n * Remove a widget from the focus tracker.\n *\n * #### Notes\n * If the widget is the `currentWidget`, the previous current widget\n * will become the new `currentWidget`.\n *\n * A widget will be automatically removed from the tracker if it\n * is disposed after being added.\n *\n * If the widget is not tracked, this is a no-op.\n */\n remove(widget: T): void {\n // Bail early if the widget is not tracked.\n if (!this._numbers.has(widget)) {\n return;\n }\n\n // Disconnect the disposed signal handler.\n widget.disposed.disconnect(this._onWidgetDisposed, this);\n\n // Remove the event listeners.\n widget.node.removeEventListener('focus', this, true);\n widget.node.removeEventListener('blur', this, true);\n\n // Remove the widget from the internal data structures.\n ArrayExt.removeFirstOf(this._widgets, widget);\n this._nodes.delete(widget.node);\n this._numbers.delete(widget);\n\n // Bail early if the widget is not the current widget.\n if (this._currentWidget !== widget) {\n return;\n }\n\n // Filter the widgets for those which have had focus.\n let valid = this._widgets.filter(w => this._numbers.get(w) !== -1);\n\n // Get the valid widget with the max focus number.\n let previous =\n max(valid, (first, second) => {\n let a = this._numbers.get(first)!;\n let b = this._numbers.get(second)!;\n return a - b;\n }) || null;\n\n // Set the current and active widgets.\n this._setWidgets(previous, null);\n }\n\n /**\n * Handle the DOM events for the focus tracker.\n *\n * @param event - The DOM event sent to the panel.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the tracked nodes. It should\n * not be called directly by user code.\n */\n handleEvent(event: Event): void {\n switch (event.type) {\n case 'focus':\n this._evtFocus(event as FocusEvent);\n break;\n case 'blur':\n this._evtBlur(event as FocusEvent);\n break;\n }\n }\n\n /**\n * Set the current and active widgets for the tracker.\n */\n private _setWidgets(current: T | null, active: T | null): void {\n // Swap the current widget.\n let oldCurrent = this._currentWidget;\n this._currentWidget = current;\n\n // Swap the active widget.\n let oldActive = this._activeWidget;\n this._activeWidget = active;\n\n // Emit the `currentChanged` signal if needed.\n if (oldCurrent !== current) {\n this._currentChanged.emit({ oldValue: oldCurrent, newValue: current });\n }\n\n // Emit the `activeChanged` signal if needed.\n if (oldActive !== active) {\n this._activeChanged.emit({ oldValue: oldActive, newValue: active });\n }\n }\n\n /**\n * Handle the `'focus'` event for a tracked widget.\n */\n private _evtFocus(event: FocusEvent): void {\n // Find the widget which gained focus, which is known to exist.\n let widget = this._nodes.get(event.currentTarget as HTMLElement)!;\n\n // Update the focus number if necessary.\n if (widget !== this._currentWidget) {\n this._numbers.set(widget, this._counter++);\n }\n\n // Set the current and active widgets.\n this._setWidgets(widget, widget);\n }\n\n /**\n * Handle the `'blur'` event for a tracked widget.\n */\n private _evtBlur(event: FocusEvent): void {\n // Find the widget which lost focus, which is known to exist.\n let widget = this._nodes.get(event.currentTarget as HTMLElement)!;\n\n // Get the node which being focused after this blur.\n let focusTarget = event.relatedTarget as HTMLElement;\n\n // If no other node is being focused, clear the active widget.\n if (!focusTarget) {\n this._setWidgets(this._currentWidget, null);\n return;\n }\n\n // Bail if the focus widget is not changing.\n if (widget.node.contains(focusTarget)) {\n return;\n }\n\n // If no tracked widget is being focused, clear the active widget.\n if (!find(this._widgets, w => w.node.contains(focusTarget))) {\n this._setWidgets(this._currentWidget, null);\n return;\n }\n }\n\n /**\n * Handle the `disposed` signal for a tracked widget.\n */\n private _onWidgetDisposed(sender: T): void {\n this.remove(sender);\n }\n\n private _counter = 0;\n private _widgets: T[] = [];\n private _activeWidget: T | null = null;\n private _currentWidget: T | null = null;\n private _numbers = new Map();\n private _nodes = new Map();\n private _activeChanged = new Signal>(this);\n private _currentChanged = new Signal>(\n this\n );\n}\n\n/**\n * The namespace for the `FocusTracker` class statics.\n */\nexport namespace FocusTracker {\n /**\n * An arguments object for the changed signals.\n */\n export interface IChangedArgs {\n /**\n * The old value for the widget.\n */\n oldValue: T | null;\n\n /**\n * The new value for the widget.\n */\n newValue: T | null;\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { AttachedProperty } from '@lumino/properties';\n\nimport { BoxEngine, BoxSizer } from './boxengine';\n\nimport { Layout, LayoutItem } from './layout';\n\nimport { Widget } from './widget';\n\n/**\n * A layout which arranges its widgets in a grid.\n */\nexport class GridLayout extends Layout {\n /**\n * Construct a new grid layout.\n *\n * @param options - The options for initializing the layout.\n */\n constructor(options: GridLayout.IOptions = {}) {\n super(options);\n if (options.rowCount !== undefined) {\n Private.reallocSizers(this._rowSizers, options.rowCount);\n }\n if (options.columnCount !== undefined) {\n Private.reallocSizers(this._columnSizers, options.columnCount);\n }\n if (options.rowSpacing !== undefined) {\n this._rowSpacing = Private.clampValue(options.rowSpacing);\n }\n if (options.columnSpacing !== undefined) {\n this._columnSpacing = Private.clampValue(options.columnSpacing);\n }\n }\n\n /**\n * Dispose of the resources held by the layout.\n */\n dispose(): void {\n // Dispose of the widgets and layout items.\n for (const item of this._items) {\n let widget = item.widget;\n item.dispose();\n widget.dispose();\n }\n\n // Clear the layout state.\n this._box = null;\n this._items.length = 0;\n this._rowStarts.length = 0;\n this._rowSizers.length = 0;\n this._columnStarts.length = 0;\n this._columnSizers.length = 0;\n\n // Dispose of the rest of the layout.\n super.dispose();\n }\n\n /**\n * Get the number of rows in the layout.\n */\n get rowCount(): number {\n return this._rowSizers.length;\n }\n\n /**\n * Set the number of rows in the layout.\n *\n * #### Notes\n * The minimum row count is `1`.\n */\n set rowCount(value: number) {\n // Do nothing if the row count does not change.\n if (value === this.rowCount) {\n return;\n }\n\n // Reallocate the row sizers.\n Private.reallocSizers(this._rowSizers, value);\n\n // Schedule a fit of the parent.\n if (this.parent) {\n this.parent.fit();\n }\n }\n\n /**\n * Get the number of columns in the layout.\n */\n get columnCount(): number {\n return this._columnSizers.length;\n }\n\n /**\n * Set the number of columns in the layout.\n *\n * #### Notes\n * The minimum column count is `1`.\n */\n set columnCount(value: number) {\n // Do nothing if the column count does not change.\n if (value === this.columnCount) {\n return;\n }\n\n // Reallocate the column sizers.\n Private.reallocSizers(this._columnSizers, value);\n\n // Schedule a fit of the parent.\n if (this.parent) {\n this.parent.fit();\n }\n }\n\n /**\n * Get the row spacing for the layout.\n */\n get rowSpacing(): number {\n return this._rowSpacing;\n }\n\n /**\n * Set the row spacing for the layout.\n */\n set rowSpacing(value: number) {\n // Clamp the spacing to the allowed range.\n value = Private.clampValue(value);\n\n // Bail if the spacing does not change\n if (this._rowSpacing === value) {\n return;\n }\n\n // Update the internal spacing.\n this._rowSpacing = value;\n\n // Schedule a fit of the parent.\n if (this.parent) {\n this.parent.fit();\n }\n }\n\n /**\n * Get the column spacing for the layout.\n */\n get columnSpacing(): number {\n return this._columnSpacing;\n }\n\n /**\n * Set the col spacing for the layout.\n */\n set columnSpacing(value: number) {\n // Clamp the spacing to the allowed range.\n value = Private.clampValue(value);\n\n // Bail if the spacing does not change\n if (this._columnSpacing === value) {\n return;\n }\n\n // Update the internal spacing.\n this._columnSpacing = value;\n\n // Schedule a fit of the parent.\n if (this.parent) {\n this.parent.fit();\n }\n }\n\n /**\n * Get the stretch factor for a specific row.\n *\n * @param index - The row index of interest.\n *\n * @returns The stretch factor for the row.\n *\n * #### Notes\n * This returns `-1` if the index is out of range.\n */\n rowStretch(index: number): number {\n let sizer = this._rowSizers[index];\n return sizer ? sizer.stretch : -1;\n }\n\n /**\n * Set the stretch factor for a specific row.\n *\n * @param index - The row index of interest.\n *\n * @param value - The stretch factor for the row.\n *\n * #### Notes\n * This is a no-op if the index is out of range.\n */\n setRowStretch(index: number, value: number): void {\n // Look up the row sizer.\n let sizer = this._rowSizers[index];\n\n // Bail if the index is out of range.\n if (!sizer) {\n return;\n }\n\n // Clamp the value to the allowed range.\n value = Private.clampValue(value);\n\n // Bail if the stretch does not change.\n if (sizer.stretch === value) {\n return;\n }\n\n // Update the sizer stretch.\n sizer.stretch = value;\n\n // Schedule an update of the parent.\n if (this.parent) {\n this.parent.update();\n }\n }\n\n /**\n * Get the stretch factor for a specific column.\n *\n * @param index - The column index of interest.\n *\n * @returns The stretch factor for the column.\n *\n * #### Notes\n * This returns `-1` if the index is out of range.\n */\n columnStretch(index: number): number {\n let sizer = this._columnSizers[index];\n return sizer ? sizer.stretch : -1;\n }\n\n /**\n * Set the stretch factor for a specific column.\n *\n * @param index - The column index of interest.\n *\n * @param value - The stretch factor for the column.\n *\n * #### Notes\n * This is a no-op if the index is out of range.\n */\n setColumnStretch(index: number, value: number): void {\n // Look up the column sizer.\n let sizer = this._columnSizers[index];\n\n // Bail if the index is out of range.\n if (!sizer) {\n return;\n }\n\n // Clamp the value to the allowed range.\n value = Private.clampValue(value);\n\n // Bail if the stretch does not change.\n if (sizer.stretch === value) {\n return;\n }\n\n // Update the sizer stretch.\n sizer.stretch = value;\n\n // Schedule an update of the parent.\n if (this.parent) {\n this.parent.update();\n }\n }\n\n /**\n * Create an iterator over the widgets in the layout.\n *\n * @returns A new iterator over the widgets in the layout.\n */\n *[Symbol.iterator](): IterableIterator {\n for (const item of this._items) {\n yield item.widget;\n }\n }\n\n /**\n * Add a widget to the grid layout.\n *\n * @param widget - The widget to add to the layout.\n *\n * #### Notes\n * If the widget is already contained in the layout, this is no-op.\n */\n addWidget(widget: Widget): void {\n // Look up the index for the widget.\n let i = ArrayExt.findFirstIndex(this._items, it => it.widget === widget);\n\n // Bail if the widget is already in the layout.\n if (i !== -1) {\n return;\n }\n\n // Add the widget to the layout.\n this._items.push(new LayoutItem(widget));\n\n // Attach the widget to the parent.\n if (this.parent) {\n this.attachWidget(widget);\n }\n }\n\n /**\n * Remove a widget from the grid layout.\n *\n * @param widget - The widget to remove from the layout.\n *\n * #### Notes\n * A widget is automatically removed from the layout when its `parent`\n * is set to `null`. This method should only be invoked directly when\n * removing a widget from a layout which has yet to be installed on a\n * parent widget.\n *\n * This method does *not* modify the widget's `parent`.\n */\n removeWidget(widget: Widget): void {\n // Look up the index for the widget.\n let i = ArrayExt.findFirstIndex(this._items, it => it.widget === widget);\n\n // Bail if the widget is not in the layout.\n if (i === -1) {\n return;\n }\n\n // Remove the widget from the layout.\n let item = ArrayExt.removeAt(this._items, i)!;\n\n // Detach the widget from the parent.\n if (this.parent) {\n this.detachWidget(widget);\n }\n\n // Dispose the layout item.\n item.dispose();\n }\n\n /**\n * Perform layout initialization which requires the parent widget.\n */\n protected init(): void {\n super.init();\n for (const widget of this) {\n this.attachWidget(widget);\n }\n }\n\n /**\n * Attach a widget to the parent's DOM node.\n *\n * @param widget - The widget to attach to the parent.\n */\n protected attachWidget(widget: Widget): void {\n // Send a `'before-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n }\n\n // Add the widget's node to the parent.\n this.parent!.node.appendChild(widget.node);\n\n // Send an `'after-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n\n // Post a fit request for the parent widget.\n this.parent!.fit();\n }\n\n /**\n * Detach a widget from the parent's DOM node.\n *\n * @param widget - The widget to detach from the parent.\n */\n protected detachWidget(widget: Widget): void {\n // Send a `'before-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n }\n\n // Remove the widget's node from the parent.\n this.parent!.node.removeChild(widget.node);\n\n // Send an `'after-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n\n // Post a fit request for the parent widget.\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'before-show'` message.\n */\n protected onBeforeShow(msg: Message): void {\n super.onBeforeShow(msg);\n this.parent!.update();\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n super.onBeforeAttach(msg);\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-shown'` message.\n */\n protected onChildShown(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-hidden'` message.\n */\n protected onChildHidden(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'resize'` message.\n */\n protected onResize(msg: Widget.ResizeMessage): void {\n if (this.parent!.isVisible) {\n this._update(msg.width, msg.height);\n }\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n protected onUpdateRequest(msg: Message): void {\n if (this.parent!.isVisible) {\n this._update(-1, -1);\n }\n }\n\n /**\n * A message handler invoked on a `'fit-request'` message.\n */\n protected onFitRequest(msg: Message): void {\n if (this.parent!.isAttached) {\n this._fit();\n }\n }\n\n /**\n * Fit the layout to the total size required by the widgets.\n */\n private _fit(): void {\n // Reset the min sizes of the sizers.\n for (let i = 0, n = this.rowCount; i < n; ++i) {\n this._rowSizers[i].minSize = 0;\n }\n for (let i = 0, n = this.columnCount; i < n; ++i) {\n this._columnSizers[i].minSize = 0;\n }\n\n // Filter for the visible layout items.\n let items = this._items.filter(it => !it.isHidden);\n\n // Fit the layout items.\n for (let i = 0, n = items.length; i < n; ++i) {\n items[i].fit();\n }\n\n // Get the max row and column index.\n let maxRow = this.rowCount - 1;\n let maxCol = this.columnCount - 1;\n\n // Sort the items by row span.\n items.sort(Private.rowSpanCmp);\n\n // Update the min sizes of the row sizers.\n for (let i = 0, n = items.length; i < n; ++i) {\n // Fetch the item.\n let item = items[i];\n\n // Get the row bounds for the item.\n let config = GridLayout.getCellConfig(item.widget);\n let r1 = Math.min(config.row, maxRow);\n let r2 = Math.min(config.row + config.rowSpan - 1, maxRow);\n\n // Distribute the minimum height to the sizers as needed.\n Private.distributeMin(this._rowSizers, r1, r2, item.minHeight);\n }\n\n // Sort the items by column span.\n items.sort(Private.columnSpanCmp);\n\n // Update the min sizes of the column sizers.\n for (let i = 0, n = items.length; i < n; ++i) {\n // Fetch the item.\n let item = items[i];\n\n // Get the column bounds for the item.\n let config = GridLayout.getCellConfig(item.widget);\n let c1 = Math.min(config.column, maxCol);\n let c2 = Math.min(config.column + config.columnSpan - 1, maxCol);\n\n // Distribute the minimum width to the sizers as needed.\n Private.distributeMin(this._columnSizers, c1, c2, item.minWidth);\n }\n\n // If no size constraint is needed, just update the parent.\n if (this.fitPolicy === 'set-no-constraint') {\n MessageLoop.sendMessage(this.parent!, Widget.Msg.UpdateRequest);\n return;\n }\n\n // Set up the computed min size.\n let minH = maxRow * this._rowSpacing;\n let minW = maxCol * this._columnSpacing;\n\n // Add the sizer minimums to the computed min size.\n for (let i = 0, n = this.rowCount; i < n; ++i) {\n minH += this._rowSizers[i].minSize;\n }\n for (let i = 0, n = this.columnCount; i < n; ++i) {\n minW += this._columnSizers[i].minSize;\n }\n\n // Update the box sizing and add it to the computed min size.\n let box = (this._box = ElementExt.boxSizing(this.parent!.node));\n minW += box.horizontalSum;\n minH += box.verticalSum;\n\n // Update the parent's min size constraints.\n let style = this.parent!.node.style;\n style.minWidth = `${minW}px`;\n style.minHeight = `${minH}px`;\n\n // Set the dirty flag to ensure only a single update occurs.\n this._dirty = true;\n\n // Notify the ancestor that it should fit immediately. This may\n // cause a resize of the parent, fulfilling the required update.\n if (this.parent!.parent) {\n MessageLoop.sendMessage(this.parent!.parent!, Widget.Msg.FitRequest);\n }\n\n // If the dirty flag is still set, the parent was not resized.\n // Trigger the required update on the parent widget immediately.\n if (this._dirty) {\n MessageLoop.sendMessage(this.parent!, Widget.Msg.UpdateRequest);\n }\n }\n\n /**\n * Update the layout position and size of the widgets.\n *\n * The parent offset dimensions should be `-1` if unknown.\n */\n private _update(offsetWidth: number, offsetHeight: number): void {\n // Clear the dirty flag to indicate the update occurred.\n this._dirty = false;\n\n // Measure the parent if the offset dimensions are unknown.\n if (offsetWidth < 0) {\n offsetWidth = this.parent!.node.offsetWidth;\n }\n if (offsetHeight < 0) {\n offsetHeight = this.parent!.node.offsetHeight;\n }\n\n // Ensure the parent box sizing data is computed.\n if (!this._box) {\n this._box = ElementExt.boxSizing(this.parent!.node);\n }\n\n // Compute the layout area adjusted for border and padding.\n let top = this._box.paddingTop;\n let left = this._box.paddingLeft;\n let width = offsetWidth - this._box.horizontalSum;\n let height = offsetHeight - this._box.verticalSum;\n\n // Get the max row and column index.\n let maxRow = this.rowCount - 1;\n let maxCol = this.columnCount - 1;\n\n // Compute the total fixed row and column space.\n let fixedRowSpace = maxRow * this._rowSpacing;\n let fixedColSpace = maxCol * this._columnSpacing;\n\n // Distribute the available space to the box sizers.\n BoxEngine.calc(this._rowSizers, Math.max(0, height - fixedRowSpace));\n BoxEngine.calc(this._columnSizers, Math.max(0, width - fixedColSpace));\n\n // Update the row start positions.\n for (let i = 0, pos = top, n = this.rowCount; i < n; ++i) {\n this._rowStarts[i] = pos;\n pos += this._rowSizers[i].size + this._rowSpacing;\n }\n\n // Update the column start positions.\n for (let i = 0, pos = left, n = this.columnCount; i < n; ++i) {\n this._columnStarts[i] = pos;\n pos += this._columnSizers[i].size + this._columnSpacing;\n }\n\n // Update the geometry of the layout items.\n for (let i = 0, n = this._items.length; i < n; ++i) {\n // Fetch the item.\n let item = this._items[i];\n\n // Ignore hidden items.\n if (item.isHidden) {\n continue;\n }\n\n // Fetch the cell bounds for the widget.\n let config = GridLayout.getCellConfig(item.widget);\n let r1 = Math.min(config.row, maxRow);\n let c1 = Math.min(config.column, maxCol);\n let r2 = Math.min(config.row + config.rowSpan - 1, maxRow);\n let c2 = Math.min(config.column + config.columnSpan - 1, maxCol);\n\n // Compute the cell geometry.\n let x = this._columnStarts[c1];\n let y = this._rowStarts[r1];\n let w = this._columnStarts[c2] + this._columnSizers[c2].size - x;\n let h = this._rowStarts[r2] + this._rowSizers[r2].size - y;\n\n // Update the geometry of the layout item.\n item.update(x, y, w, h);\n }\n }\n\n private _dirty = false;\n private _rowSpacing = 4;\n private _columnSpacing = 4;\n private _items: LayoutItem[] = [];\n private _rowStarts: number[] = [];\n private _columnStarts: number[] = [];\n private _rowSizers: BoxSizer[] = [new BoxSizer()];\n private _columnSizers: BoxSizer[] = [new BoxSizer()];\n private _box: ElementExt.IBoxSizing | null = null;\n}\n\n/**\n * The namespace for the `GridLayout` class statics.\n */\nexport namespace GridLayout {\n /**\n * An options object for initializing a grid layout.\n */\n export interface IOptions extends Layout.IOptions {\n /**\n * The initial row count for the layout.\n *\n * The default is `1`.\n */\n rowCount?: number;\n\n /**\n * The initial column count for the layout.\n *\n * The default is `1`.\n */\n columnCount?: number;\n\n /**\n * The spacing between rows in the layout.\n *\n * The default is `4`.\n */\n rowSpacing?: number;\n\n /**\n * The spacing between columns in the layout.\n *\n * The default is `4`.\n */\n columnSpacing?: number;\n }\n\n /**\n * An object which holds the cell configuration for a widget.\n */\n export interface ICellConfig {\n /**\n * The row index for the widget.\n */\n readonly row: number;\n\n /**\n * The column index for the widget.\n */\n readonly column: number;\n\n /**\n * The row span for the widget.\n */\n readonly rowSpan: number;\n\n /**\n * The column span for the widget.\n */\n readonly columnSpan: number;\n }\n\n /**\n * Get the cell config for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The cell config for the widget.\n */\n export function getCellConfig(widget: Widget): ICellConfig {\n return Private.cellConfigProperty.get(widget);\n }\n\n /**\n * Set the cell config for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the cell config.\n */\n export function setCellConfig(\n widget: Widget,\n value: Partial\n ): void {\n Private.cellConfigProperty.set(widget, Private.normalizeConfig(value));\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * The property descriptor for the widget cell config.\n */\n export const cellConfigProperty = new AttachedProperty<\n Widget,\n GridLayout.ICellConfig\n >({\n name: 'cellConfig',\n create: () => ({ row: 0, column: 0, rowSpan: 1, columnSpan: 1 }),\n changed: onChildCellConfigChanged\n });\n\n /**\n * Normalize a partial cell config object.\n */\n export function normalizeConfig(\n config: Partial\n ): GridLayout.ICellConfig {\n let row = Math.max(0, Math.floor(config.row || 0));\n let column = Math.max(0, Math.floor(config.column || 0));\n let rowSpan = Math.max(1, Math.floor(config.rowSpan || 0));\n let columnSpan = Math.max(1, Math.floor(config.columnSpan || 0));\n return { row, column, rowSpan, columnSpan };\n }\n\n /**\n * Clamp a value to an integer >= 0.\n */\n export function clampValue(value: number): number {\n return Math.max(0, Math.floor(value));\n }\n\n /**\n * A sort comparison function for row spans.\n */\n export function rowSpanCmp(a: LayoutItem, b: LayoutItem): number {\n let c1 = cellConfigProperty.get(a.widget);\n let c2 = cellConfigProperty.get(b.widget);\n return c1.rowSpan - c2.rowSpan;\n }\n\n /**\n * A sort comparison function for column spans.\n */\n export function columnSpanCmp(a: LayoutItem, b: LayoutItem): number {\n let c1 = cellConfigProperty.get(a.widget);\n let c2 = cellConfigProperty.get(b.widget);\n return c1.columnSpan - c2.columnSpan;\n }\n\n /**\n * Reallocate the box sizers for the given grid dimensions.\n */\n export function reallocSizers(sizers: BoxSizer[], count: number): void {\n // Coerce the count to the valid range.\n count = Math.max(1, Math.floor(count));\n\n // Add the missing sizers.\n while (sizers.length < count) {\n sizers.push(new BoxSizer());\n }\n\n // Remove the extra sizers.\n if (sizers.length > count) {\n sizers.length = count;\n }\n }\n\n /**\n * Distribute a min size constraint across a range of sizers.\n */\n export function distributeMin(\n sizers: BoxSizer[],\n i1: number,\n i2: number,\n minSize: number\n ): void {\n // Sanity check the indices.\n if (i2 < i1) {\n return;\n }\n\n // Handle the simple case of no cell span.\n if (i1 === i2) {\n let sizer = sizers[i1];\n sizer.minSize = Math.max(sizer.minSize, minSize);\n return;\n }\n\n // Compute the total current min size of the span.\n let totalMin = 0;\n for (let i = i1; i <= i2; ++i) {\n totalMin += sizers[i].minSize;\n }\n\n // Do nothing if the total is greater than the required.\n if (totalMin >= minSize) {\n return;\n }\n\n // Compute the portion of the space to allocate to each sizer.\n let portion = (minSize - totalMin) / (i2 - i1 + 1);\n\n // Add the portion to each sizer.\n for (let i = i1; i <= i2; ++i) {\n sizers[i].minSize += portion;\n }\n }\n\n /**\n * The change handler for the child cell config property.\n */\n function onChildCellConfigChanged(child: Widget): void {\n if (child.parent && child.parent.layout instanceof GridLayout) {\n child.parent.fit();\n }\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { getKeyboardLayout } from '@lumino/keyboard';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { CommandRegistry } from '@lumino/commands';\n\nimport {\n ElementARIAAttrs,\n ElementDataset,\n h,\n VirtualDOM,\n VirtualElement\n} from '@lumino/virtualdom';\n\nimport { Menu } from './menu';\n\nimport { Title } from './title';\n\nimport { Widget } from './widget';\n\n/**\n * A widget which displays menus as a canonical menu bar.\n *\n * #### Notes\n * See also the related [example](../../examples/menubar/index.html) and\n * its [source](https://github.com/jupyterlab/lumino/tree/main/examples/example-menubar).\n */\nexport class MenuBar extends Widget {\n /**\n * Construct a new menu bar.\n *\n * @param options - The options for initializing the menu bar.\n */\n constructor(options: MenuBar.IOptions = {}) {\n super({ node: Private.createNode() });\n this.addClass('lm-MenuBar');\n this.setFlag(Widget.Flag.DisallowLayout);\n this.renderer = options.renderer || MenuBar.defaultRenderer;\n this._forceItemsPosition = options.forceItemsPosition || {\n forceX: true,\n forceY: true\n };\n this._overflowMenuOptions = options.overflowMenuOptions || {\n isVisible: true\n };\n }\n\n /**\n * Dispose of the resources held by the widget.\n */\n dispose(): void {\n this._closeChildMenu();\n this._menus.length = 0;\n super.dispose();\n }\n\n /**\n * The renderer used by the menu bar.\n */\n readonly renderer: MenuBar.IRenderer;\n\n /**\n * The child menu of the menu bar.\n *\n * #### Notes\n * This will be `null` if the menu bar does not have an open menu.\n */\n get childMenu(): Menu | null {\n return this._childMenu;\n }\n\n /**\n * The overflow index of the menu bar.\n */\n get overflowIndex(): number {\n return this._overflowIndex;\n }\n\n /**\n * The overflow menu of the menu bar.\n */\n get overflowMenu(): Menu | null {\n return this._overflowMenu;\n }\n\n /**\n * Get the menu bar content node.\n *\n * #### Notes\n * This is the node which holds the menu title nodes.\n *\n * Modifying this node directly can lead to undefined behavior.\n */\n get contentNode(): HTMLUListElement {\n return this.node.getElementsByClassName(\n 'lm-MenuBar-content'\n )[0] as HTMLUListElement;\n }\n\n /**\n * Get the currently active menu.\n */\n get activeMenu(): Menu | null {\n return this._menus[this._activeIndex] || null;\n }\n\n /**\n * Set the currently active menu.\n *\n * #### Notes\n * If the menu does not exist, the menu will be set to `null`.\n */\n set activeMenu(value: Menu | null) {\n this.activeIndex = value ? this._menus.indexOf(value) : -1;\n }\n\n /**\n * Get the index of the currently active menu.\n *\n * #### Notes\n * This will be `-1` if no menu is active.\n */\n get activeIndex(): number {\n return this._activeIndex;\n }\n\n /**\n * Set the index of the currently active menu.\n *\n * #### Notes\n * If the menu cannot be activated, the index will be set to `-1`.\n */\n set activeIndex(value: number) {\n // Adjust the value for an out of range index.\n if (value < 0 || value >= this._menus.length) {\n value = -1;\n }\n\n // An empty menu cannot be active\n if (value > -1 && this._menus[value].items.length === 0) {\n value = -1;\n }\n\n // Bail early if the index will not change.\n if (this._activeIndex === value) {\n return;\n }\n\n // Update the active index.\n this._activeIndex = value;\n\n // Schedule an update of the items.\n this.update();\n }\n\n /**\n * A read-only array of the menus in the menu bar.\n */\n get menus(): ReadonlyArray {\n return this._menus;\n }\n\n /**\n * Open the active menu and activate its first menu item.\n *\n * #### Notes\n * If there is no active menu, this is a no-op.\n */\n openActiveMenu(): void {\n // Bail early if there is no active item.\n if (this._activeIndex === -1) {\n return;\n }\n\n // Open the child menu.\n this._openChildMenu();\n\n // Activate the first item in the child menu.\n if (this._childMenu) {\n this._childMenu.activeIndex = -1;\n this._childMenu.activateNextItem();\n }\n }\n\n /**\n * Add a menu to the end of the menu bar.\n *\n * @param menu - The menu to add to the menu bar.\n *\n * #### Notes\n * If the menu is already added to the menu bar, it will be moved.\n */\n addMenu(menu: Menu, update: boolean = true): void {\n this.insertMenu(this._menus.length, menu, update);\n }\n\n /**\n * Insert a menu into the menu bar at the specified index.\n *\n * @param index - The index at which to insert the menu.\n *\n * @param menu - The menu to insert into the menu bar.\n *\n * #### Notes\n * The index will be clamped to the bounds of the menus.\n *\n * If the menu is already added to the menu bar, it will be moved.\n */\n insertMenu(index: number, menu: Menu, update: boolean = true): void {\n // Close the child menu before making changes.\n this._closeChildMenu();\n\n // Look up the index of the menu.\n let i = this._menus.indexOf(menu);\n\n // Clamp the insert index to the array bounds.\n let j = Math.max(0, Math.min(index, this._menus.length));\n\n // If the menu is not in the array, insert it.\n if (i === -1) {\n // Insert the menu into the array.\n ArrayExt.insert(this._menus, j, menu);\n\n // Add the styling class to the menu.\n menu.addClass('lm-MenuBar-menu');\n\n // Connect to the menu signals.\n menu.aboutToClose.connect(this._onMenuAboutToClose, this);\n menu.menuRequested.connect(this._onMenuMenuRequested, this);\n menu.title.changed.connect(this._onTitleChanged, this);\n\n // Schedule an update of the items.\n if (update) {\n this.update();\n }\n\n // There is nothing more to do.\n return;\n }\n\n // Otherwise, the menu exists in the array and should be moved.\n\n // Adjust the index if the location is at the end of the array.\n if (j === this._menus.length) {\n j--;\n }\n\n // Bail if there is no effective move.\n if (i === j) {\n return;\n }\n\n // Move the menu to the new locations.\n ArrayExt.move(this._menus, i, j);\n\n // Schedule an update of the items.\n if (update) {\n this.update();\n }\n }\n\n /**\n * Remove a menu from the menu bar.\n *\n * @param menu - The menu to remove from the menu bar.\n *\n * #### Notes\n * This is a no-op if the menu is not in the menu bar.\n */\n removeMenu(menu: Menu, update: boolean = true): void {\n this.removeMenuAt(this._menus.indexOf(menu), update);\n }\n\n /**\n * Remove the menu at a given index from the menu bar.\n *\n * @param index - The index of the menu to remove.\n *\n * #### Notes\n * This is a no-op if the index is out of range.\n */\n removeMenuAt(index: number, update: boolean = true): void {\n // Close the child menu before making changes.\n this._closeChildMenu();\n\n // Remove the menu from the array.\n let menu = ArrayExt.removeAt(this._menus, index);\n\n // Bail if the index is out of range.\n if (!menu) {\n return;\n }\n\n // Disconnect from the menu signals.\n menu.aboutToClose.disconnect(this._onMenuAboutToClose, this);\n menu.menuRequested.disconnect(this._onMenuMenuRequested, this);\n menu.title.changed.disconnect(this._onTitleChanged, this);\n\n // Remove the styling class from the menu.\n menu.removeClass('lm-MenuBar-menu');\n\n // Schedule an update of the items.\n if (update) {\n this.update();\n }\n }\n\n /**\n * Remove all menus from the menu bar.\n */\n clearMenus(): void {\n // Bail if there is nothing to remove.\n if (this._menus.length === 0) {\n return;\n }\n\n // Close the child menu before making changes.\n this._closeChildMenu();\n\n // Disconnect from the menu signals and remove the styling class.\n for (let menu of this._menus) {\n menu.aboutToClose.disconnect(this._onMenuAboutToClose, this);\n menu.menuRequested.disconnect(this._onMenuMenuRequested, this);\n menu.title.changed.disconnect(this._onTitleChanged, this);\n menu.removeClass('lm-MenuBar-menu');\n }\n\n // Clear the menus array.\n this._menus.length = 0;\n\n // Schedule an update of the items.\n this.update();\n }\n\n /**\n * Handle the DOM events for the menu bar.\n *\n * @param event - The DOM event sent to the menu bar.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the menu bar's DOM nodes. It\n * should not be called directly by user code.\n */\n handleEvent(event: Event): void {\n switch (event.type) {\n case 'keydown':\n this._evtKeyDown(event as KeyboardEvent);\n break;\n case 'mousedown':\n this._evtMouseDown(event as MouseEvent);\n break;\n case 'mousemove':\n case 'mouseleave':\n this._evtMouseMove(event as MouseEvent);\n break;\n case 'focusout':\n this._evtFocusOut(event as FocusEvent);\n break;\n case 'contextmenu':\n event.preventDefault();\n event.stopPropagation();\n break;\n }\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n this.node.addEventListener('keydown', this);\n this.node.addEventListener('mousedown', this);\n this.node.addEventListener('mousemove', this);\n this.node.addEventListener('mouseleave', this);\n this.node.addEventListener('focusout', this);\n this.node.addEventListener('contextmenu', this);\n }\n\n /**\n * A message handler invoked on an `'after-detach'` message.\n */\n protected onAfterDetach(msg: Message): void {\n this.node.removeEventListener('keydown', this);\n this.node.removeEventListener('mousedown', this);\n this.node.removeEventListener('mousemove', this);\n this.node.removeEventListener('mouseleave', this);\n this.node.removeEventListener('focusout', this);\n this.node.removeEventListener('contextmenu', this);\n this._closeChildMenu();\n }\n\n /**\n * A message handler invoked on an `'activate-request'` message.\n */\n protected onActivateRequest(msg: Message): void {\n if (this.isAttached) {\n this._focusItemAt(0);\n }\n }\n\n /**\n * A message handler invoked on a `'resize'` message.\n */\n protected onResize(msg: Widget.ResizeMessage): void {\n this.update();\n super.onResize(msg);\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n protected onUpdateRequest(msg: Message): void {\n let menus = this._menus;\n let renderer = this.renderer;\n let activeIndex = this._activeIndex;\n let tabFocusIndex =\n this._tabFocusIndex >= 0 && this._tabFocusIndex < menus.length\n ? this._tabFocusIndex\n : 0;\n let length = this._overflowIndex > -1 ? this._overflowIndex : menus.length;\n let totalMenuSize = 0;\n let isVisible = false;\n\n // Check that the overflow menu doesn't count\n length = this._overflowMenu !== null ? length - 1 : length;\n let content = new Array(length);\n\n // Render visible menus\n for (let i = 0; i < length; ++i) {\n content[i] = renderer.renderItem({\n title: menus[i].title,\n active: i === activeIndex,\n tabbable: i === tabFocusIndex,\n disabled: menus[i].items.length === 0,\n onfocus: () => {\n this._tabFocusIndex = i;\n this.activeIndex = i;\n }\n });\n // Calculate size of current menu\n totalMenuSize += this._menuItemSizes[i];\n // Check if overflow menu is already rendered\n if (menus[i].title.label === this._overflowMenuOptions.title) {\n isVisible = true;\n length--;\n }\n }\n // Render overflow menu if needed and active\n if (this._overflowMenuOptions.isVisible) {\n if (this._overflowIndex > -1 && !isVisible) {\n // Create overflow menu\n if (this._overflowMenu === null) {\n const overflowMenuTitle = this._overflowMenuOptions.title ?? '...';\n this._overflowMenu = new Menu({ commands: new CommandRegistry() });\n this._overflowMenu.title.label = overflowMenuTitle;\n this._overflowMenu.title.mnemonic = 0;\n this.addMenu(this._overflowMenu, false);\n }\n // Move menus to overflow menu\n for (let i = menus.length - 2; i >= length; i--) {\n const submenu = this.menus[i];\n submenu.title.mnemonic = 0;\n this._overflowMenu.insertItem(0, {\n type: 'submenu',\n submenu: submenu\n });\n this.removeMenu(submenu, false);\n }\n content[length] = renderer.renderItem({\n title: this._overflowMenu.title,\n active: length === activeIndex && menus[length].items.length !== 0,\n tabbable: length === tabFocusIndex,\n disabled: menus[length].items.length === 0,\n onfocus: () => {\n this._tabFocusIndex = length;\n this.activeIndex = length;\n }\n });\n length++;\n } else if (this._overflowMenu !== null) {\n // Remove submenus from overflow menu\n let overflowMenuItems = this._overflowMenu.items;\n let screenSize = this.node.offsetWidth;\n let n = this._overflowMenu.items.length;\n for (let i = 0; i < n; ++i) {\n let index = menus.length - 1 - i;\n if (screenSize - totalMenuSize > this._menuItemSizes[index]) {\n let menu = overflowMenuItems[0].submenu as Menu;\n this._overflowMenu.removeItemAt(0);\n this.insertMenu(length, menu, false);\n content[length] = renderer.renderItem({\n title: menu.title,\n active: false,\n tabbable: length === tabFocusIndex,\n disabled: menus[length].items.length === 0,\n onfocus: () => {\n this._tabFocusIndex = length;\n this.activeIndex = length;\n }\n });\n length++;\n }\n }\n if (this._overflowMenu.items.length === 0) {\n this.removeMenu(this._overflowMenu, false);\n content.pop();\n this._overflowMenu = null;\n this._overflowIndex = -1;\n }\n }\n }\n VirtualDOM.render(content, this.contentNode);\n this._updateOverflowIndex();\n }\n\n /**\n * Calculate and update the current overflow index.\n */\n private _updateOverflowIndex(): void {\n if (!this._overflowMenuOptions.isVisible) {\n return;\n }\n\n // Get elements visible in the main menu bar\n const itemMenus = this.contentNode.childNodes;\n let screenSize = this.node.offsetWidth;\n let totalMenuSize = 0;\n let index = -1;\n let n = itemMenus.length;\n\n if (this._menuItemSizes.length == 0) {\n // Check if it is the first resize and get info about menu items sizes\n for (let i = 0; i < n; i++) {\n let item = itemMenus[i] as HTMLLIElement;\n // Add sizes to array\n totalMenuSize += item.offsetWidth;\n this._menuItemSizes.push(item.offsetWidth);\n if (totalMenuSize > screenSize && index === -1) {\n index = i;\n }\n }\n } else {\n // Calculate current menu size\n for (let i = 0; i < this._menuItemSizes.length; i++) {\n totalMenuSize += this._menuItemSizes[i];\n if (totalMenuSize > screenSize) {\n index = i;\n break;\n }\n }\n }\n this._overflowIndex = index;\n }\n\n /**\n * Handle the `'keydown'` event for the menu bar.\n *\n * #### Notes\n * All keys are trapped except the tab key that is ignored.\n */\n private _evtKeyDown(event: KeyboardEvent): void {\n // Fetch the key code for the event.\n let kc = event.keyCode;\n\n // Reset the active index on tab, but do not trap the tab key.\n if (kc === 9) {\n this.activeIndex = -1;\n return;\n }\n\n // A menu bar handles all other keydown events.\n event.preventDefault();\n event.stopPropagation();\n\n // Enter, Space, Up Arrow, Down Arrow\n if (kc === 13 || kc === 32 || kc === 38 || kc === 40) {\n // The active index may have changed (for example, user hovers over an\n // item with the mouse), so be sure to use the focus index.\n this.activeIndex = this._tabFocusIndex;\n if (this.activeIndex !== this._tabFocusIndex) {\n // Bail if the setter refused to set activeIndex to tabFocusIndex\n // because it means that the item at tabFocusIndex cannot be opened (for\n // example, it has an empty menu)\n return;\n }\n this.openActiveMenu();\n return;\n }\n\n // Escape\n if (kc === 27) {\n this._closeChildMenu();\n this._focusItemAt(this.activeIndex);\n return;\n }\n\n // Left or Right Arrow\n if (kc === 37 || kc === 39) {\n let direction = kc === 37 ? -1 : 1;\n let start = this._tabFocusIndex + direction;\n let n = this._menus.length;\n for (let i = 0; i < n; i++) {\n let index = (n + start + direction * i) % n;\n if (this._menus[index].items.length) {\n this._focusItemAt(index);\n return;\n }\n }\n return;\n }\n\n // Get the pressed key character.\n let key = getKeyboardLayout().keyForKeydownEvent(event);\n\n // Bail if the key is not valid.\n if (!key) {\n return;\n }\n\n // Search for the next best matching mnemonic item.\n let start = this._activeIndex + 1;\n let result = Private.findMnemonic(this._menus, key, start);\n\n // Handle the requested mnemonic based on the search results.\n // If exactly one mnemonic is matched, that menu is opened.\n // Otherwise, the next mnemonic is activated if available,\n // followed by the auto mnemonic if available.\n if (result.index !== -1 && !result.multiple) {\n this.activeIndex = result.index;\n this.openActiveMenu();\n } else if (result.index !== -1) {\n this.activeIndex = result.index;\n this._focusItemAt(this.activeIndex);\n } else if (result.auto !== -1) {\n this.activeIndex = result.auto;\n this._focusItemAt(this.activeIndex);\n }\n }\n\n /**\n * Handle the `'mousedown'` event for the menu bar.\n */\n private _evtMouseDown(event: MouseEvent): void {\n // Bail if the mouse press was not on the menu bar. This can occur\n // when the document listener is installed for an active menu bar.\n if (!ElementExt.hitTest(this.node, event.clientX, event.clientY)) {\n return;\n }\n\n // Stop the propagation of the event. Immediate propagation is\n // also stopped so that an open menu does not handle the event.\n event.stopPropagation();\n event.stopImmediatePropagation();\n\n // Check if the mouse is over one of the menu items.\n let index = ArrayExt.findFirstIndex(this.contentNode.children, node => {\n return ElementExt.hitTest(node, event.clientX, event.clientY);\n });\n\n // If the press was not on an item, close the child menu.\n if (index === -1) {\n this._closeChildMenu();\n return;\n }\n\n // If the press was not the left mouse button, do nothing further.\n if (event.button !== 0) {\n return;\n }\n\n // Otherwise, toggle the open state of the child menu.\n if (this._childMenu) {\n this._closeChildMenu();\n this.activeIndex = index;\n } else {\n // If we don't call preventDefault() here, then the item in the menu\n // bar will take focus over the menu that is being opened.\n event.preventDefault();\n const position = this._positionForMenu(index);\n Menu.saveWindowData();\n // Begin DOM modifications.\n this.activeIndex = index;\n this._openChildMenu(position);\n }\n }\n\n /**\n * Handle the `'mousemove'` event for the menu bar.\n */\n private _evtMouseMove(event: MouseEvent): void {\n // Check if the mouse is over one of the menu items.\n let index = ArrayExt.findFirstIndex(this.contentNode.children, node => {\n return ElementExt.hitTest(node, event.clientX, event.clientY);\n });\n\n // Bail early if the active index will not change.\n if (index === this._activeIndex) {\n return;\n }\n\n // Bail early if a child menu is open and the mouse is not over\n // an item. This allows the child menu to be kept open when the\n // mouse is over the empty part of the menu bar.\n if (index === -1 && this._childMenu) {\n return;\n }\n\n // Get position for the new menu >before< updating active index.\n const position =\n index >= 0 && this._childMenu ? this._positionForMenu(index) : null;\n\n // Before any modification, update window data.\n Menu.saveWindowData();\n\n // Begin DOM modifications.\n\n // Update the active index to the hovered item.\n this.activeIndex = index;\n\n // Open the new menu if a menu is already open.\n if (position) {\n this._openChildMenu(position);\n }\n }\n\n /**\n * Find initial position for the menu based on menubar item position.\n *\n * NOTE: this should be called before updating active index to avoid\n * an additional layout and style invalidation as changing active\n * index modifies DOM.\n */\n private _positionForMenu(index: number): Private.IPosition {\n let itemNode = this.contentNode.children[index];\n let { left, bottom } = (itemNode as HTMLElement).getBoundingClientRect();\n return {\n top: bottom,\n left\n };\n }\n\n /**\n * Handle the `'focusout'` event for the menu bar.\n */\n private _evtFocusOut(event: FocusEvent): void {\n // Reset the active index if there is no open menu and the menubar is losing focus.\n if (!this._childMenu && !this.node.contains(event.relatedTarget as Node)) {\n this.activeIndex = -1;\n }\n }\n\n /**\n * Focus an item in the menu bar.\n *\n * #### Notes\n * Does not open the associated menu.\n */\n private _focusItemAt(index: number): void {\n const itemNode = this.contentNode.childNodes[index] as HTMLElement | void;\n if (itemNode) {\n itemNode.focus();\n }\n }\n\n /**\n * Open the child menu at the active index immediately.\n *\n * If a different child menu is already open, it will be closed,\n * even if there is no active menu.\n */\n private _openChildMenu(options: { left?: number; top?: number } = {}): void {\n // If there is no active menu, close the current menu.\n let newMenu = this.activeMenu;\n if (!newMenu) {\n this._closeChildMenu();\n return;\n }\n\n // Bail if there is no effective menu change.\n let oldMenu = this._childMenu;\n if (oldMenu === newMenu) {\n return;\n }\n\n // Swap the internal menu reference.\n this._childMenu = newMenu;\n\n // Close the current menu, or setup for the new menu.\n if (oldMenu) {\n oldMenu.close();\n } else {\n document.addEventListener('mousedown', this, true);\n }\n\n // Update the tab focus index and ensure the menu bar is updated.\n this._tabFocusIndex = this.activeIndex;\n MessageLoop.sendMessage(this, Widget.Msg.UpdateRequest);\n\n // Get the positioning data for the new menu.\n let { left, top } = options;\n if (typeof left === 'undefined' || typeof top === 'undefined') {\n ({ left, top } = this._positionForMenu(this._activeIndex));\n }\n // Begin DOM modifications\n\n if (!oldMenu) {\n // Continue setup for new menu\n this.addClass('lm-mod-active');\n }\n\n // Open the new menu at the computed location.\n if (newMenu.items.length > 0) {\n newMenu.open(left, top, this._forceItemsPosition);\n }\n }\n\n /**\n * Close the child menu immediately.\n *\n * This is a no-op if a child menu is not open.\n */\n private _closeChildMenu(): void {\n // Bail if no child menu is open.\n if (!this._childMenu) {\n return;\n }\n // Remove the active class from the menu bar.\n this.removeClass('lm-mod-active');\n\n // Remove the document listeners.\n document.removeEventListener('mousedown', this, true);\n\n // Clear the internal menu reference.\n let menu = this._childMenu;\n this._childMenu = null;\n\n // Close the menu.\n menu.close();\n\n // Reset the active index.\n this.activeIndex = -1;\n }\n\n /**\n * Handle the `aboutToClose` signal of a menu.\n */\n private _onMenuAboutToClose(sender: Menu): void {\n // Bail if the sender is not the child menu.\n if (sender !== this._childMenu) {\n return;\n }\n\n // Remove the active class from the menu bar.\n this.removeClass('lm-mod-active');\n\n // Remove the document listeners.\n document.removeEventListener('mousedown', this, true);\n\n // Clear the internal menu reference.\n this._childMenu = null;\n\n // Reset the active index.\n this.activeIndex = -1;\n }\n\n /**\n * Handle the `menuRequested` signal of a child menu.\n */\n private _onMenuMenuRequested(sender: Menu, args: 'next' | 'previous'): void {\n // Bail if the sender is not the child menu.\n if (sender !== this._childMenu) {\n return;\n }\n\n // Look up the active index and menu count.\n let i = this._activeIndex;\n let n = this._menus.length;\n\n // Active the next requested index.\n switch (args) {\n case 'next':\n this.activeIndex = i === n - 1 ? 0 : i + 1;\n break;\n case 'previous':\n this.activeIndex = i === 0 ? n - 1 : i - 1;\n break;\n }\n\n // Open the active menu.\n this.openActiveMenu();\n }\n\n /**\n * Handle the `changed` signal of a title object.\n */\n private _onTitleChanged(): void {\n this.update();\n }\n\n // Track the index of the item that is currently focused or hovered. -1 means nothing focused or hovered.\n private _activeIndex = -1;\n // Track which item can be focused using the TAB key. Unlike _activeIndex will\n // always point to a menuitem. Whenever you update this value, it's important\n // to follow it with an \"update-request\" message so that the `tabindex`\n // attribute on each menubar item gets properly updated.\n private _tabFocusIndex = 0;\n private _forceItemsPosition: Menu.IOpenOptions;\n private _overflowMenuOptions: IOverflowMenuOptions;\n private _menus: Menu[] = [];\n private _childMenu: Menu | null = null;\n private _overflowMenu: Menu | null = null;\n private _menuItemSizes: number[] = [];\n private _overflowIndex: number = -1;\n}\n\n/**\n * The namespace for the `MenuBar` class statics.\n */\nexport namespace MenuBar {\n /**\n * An options object for creating a menu bar.\n */\n export interface IOptions {\n /**\n * A custom renderer for creating menu bar content.\n *\n * The default is a shared renderer instance.\n */\n renderer?: IRenderer;\n /**\n * Whether to force the position of the menu. The MenuBar forces the\n * coordinates of its menus by default. With this option you can disable it.\n *\n * Setting to `false` will enable the logic which repositions the\n * coordinates of the menu if it will not fit entirely on screen.\n *\n * The default is `true`.\n */\n forceItemsPosition?: Menu.IOpenOptions;\n /**\n * Whether to add a overflow menu if there's overflow.\n *\n * Setting to `true` will enable the logic that creates an overflow menu\n * to show the menu items that don't fit entirely on the screen.\n *\n * The default is `true`.\n */\n overflowMenuOptions?: IOverflowMenuOptions;\n }\n\n /**\n * An object which holds the data to render a menu bar item.\n */\n export interface IRenderData {\n /**\n * The title to be rendered.\n */\n readonly title: Title;\n\n /**\n * Whether the item is the active item.\n */\n readonly active: boolean;\n\n /**\n * Whether the user can tab to the item.\n */\n readonly tabbable: boolean;\n\n /**\n * Whether the item is disabled.\n *\n * #### Notes\n * A disabled item cannot be active.\n * A disabled item cannot be focussed.\n */\n readonly disabled?: boolean;\n\n readonly onfocus?: (event: FocusEvent) => void;\n }\n\n /**\n * A renderer for use with a menu bar.\n */\n export interface IRenderer {\n /**\n * Render the virtual element for a menu bar item.\n *\n * @param data - The data to use for rendering the item.\n *\n * @returns A virtual element representing the item.\n */\n renderItem(data: IRenderData): VirtualElement;\n }\n\n /**\n * The default implementation of `IRenderer`.\n *\n * #### Notes\n * Subclasses are free to reimplement rendering methods as needed.\n */\n export class Renderer implements IRenderer {\n /**\n * Render the virtual element for a menu bar item.\n *\n * @param data - The data to use for rendering the item.\n *\n * @returns A virtual element representing the item.\n */\n renderItem(data: IRenderData): VirtualElement {\n let className = this.createItemClass(data);\n let dataset = this.createItemDataset(data);\n let aria = this.createItemARIA(data);\n return h.li(\n {\n className,\n dataset,\n ...(data.disabled ? {} : { tabindex: data.tabbable ? '0' : '-1' }),\n onfocus: data.onfocus,\n ...aria\n },\n this.renderIcon(data),\n this.renderLabel(data)\n );\n }\n\n /**\n * Render the icon element for a menu bar item.\n *\n * @param data - The data to use for rendering the icon.\n *\n * @returns A virtual element representing the item icon.\n */\n renderIcon(data: IRenderData): VirtualElement {\n let className = this.createIconClass(data);\n\n // If data.title.icon is undefined, it will be ignored.\n return h.div({ className }, data.title.icon!, data.title.iconLabel);\n }\n\n /**\n * Render the label element for a menu item.\n *\n * @param data - The data to use for rendering the label.\n *\n * @returns A virtual element representing the item label.\n */\n renderLabel(data: IRenderData): VirtualElement {\n let content = this.formatLabel(data);\n return h.div({ className: 'lm-MenuBar-itemLabel' }, content);\n }\n\n /**\n * Create the class name for the menu bar item.\n *\n * @param data - The data to use for the class name.\n *\n * @returns The full class name for the menu item.\n */\n createItemClass(data: IRenderData): string {\n let name = 'lm-MenuBar-item';\n if (data.title.className) {\n name += ` ${data.title.className}`;\n }\n if (data.active && !data.disabled) {\n name += ' lm-mod-active';\n }\n return name;\n }\n\n /**\n * Create the dataset for a menu bar item.\n *\n * @param data - The data to use for the item.\n *\n * @returns The dataset for the menu bar item.\n */\n createItemDataset(data: IRenderData): ElementDataset {\n return data.title.dataset;\n }\n\n /**\n * Create the aria attributes for menu bar item.\n *\n * @param data - The data to use for the aria attributes.\n *\n * @returns The aria attributes object for the item.\n */\n createItemARIA(data: IRenderData): ElementARIAAttrs {\n return {\n role: 'menuitem',\n 'aria-haspopup': 'true',\n 'aria-disabled': data.disabled ? 'true' : 'false'\n };\n }\n\n /**\n * Create the class name for the menu bar item icon.\n *\n * @param data - The data to use for the class name.\n *\n * @returns The full class name for the item icon.\n */\n createIconClass(data: IRenderData): string {\n let name = 'lm-MenuBar-itemIcon';\n let extra = data.title.iconClass;\n return extra ? `${name} ${extra}` : name;\n }\n\n /**\n * Create the render content for the label node.\n *\n * @param data - The data to use for the label content.\n *\n * @returns The content to add to the label node.\n */\n formatLabel(data: IRenderData): h.Child {\n // Fetch the label text and mnemonic index.\n let { label, mnemonic } = data.title;\n\n // If the index is out of range, do not modify the label.\n if (mnemonic < 0 || mnemonic >= label.length) {\n return label;\n }\n\n // Split the label into parts.\n let prefix = label.slice(0, mnemonic);\n let suffix = label.slice(mnemonic + 1);\n let char = label[mnemonic];\n\n // Wrap the mnemonic character in a span.\n let span = h.span({ className: 'lm-MenuBar-itemMnemonic' }, char);\n\n // Return the content parts.\n return [prefix, span, suffix];\n }\n }\n\n /**\n * The default `Renderer` instance.\n */\n export const defaultRenderer = new Renderer();\n}\n\n/**\n * Options for overflow menu.\n */\nexport interface IOverflowMenuOptions {\n /**\n * Determines if a overflow menu appears when the menu items overflow.\n *\n * Defaults to `true`.\n */\n isVisible: boolean;\n /**\n * Determines the title of the overflow menu.\n *\n * Default: `...`.\n */\n title?: string;\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * Create the DOM node for a menu bar.\n */\n export function createNode(): HTMLDivElement {\n let node = document.createElement('div');\n let content = document.createElement('ul');\n content.className = 'lm-MenuBar-content';\n node.appendChild(content);\n content.setAttribute('role', 'menubar');\n return node;\n }\n\n /**\n * Position for the menu relative to top-left screen corner.\n */\n export interface IPosition {\n /**\n * Pixels right from screen origin.\n */\n left: number;\n /**\n * Pixels down from screen origin.\n */\n top: number;\n }\n\n /**\n * The results of a mnemonic search.\n */\n export interface IMnemonicResult {\n /**\n * The index of the first matching mnemonic item, or `-1`.\n */\n index: number;\n\n /**\n * Whether multiple mnemonic items matched.\n */\n multiple: boolean;\n\n /**\n * The index of the first auto matched non-mnemonic item.\n */\n auto: number;\n }\n\n /**\n * Find the best matching mnemonic item.\n *\n * The search starts at the given index and wraps around.\n */\n export function findMnemonic(\n menus: ReadonlyArray,\n key: string,\n start: number\n ): IMnemonicResult {\n // Setup the result variables.\n let index = -1;\n let auto = -1;\n let multiple = false;\n\n // Normalize the key to upper case.\n let upperKey = key.toUpperCase();\n\n // Search the items from the given start index.\n for (let i = 0, n = menus.length; i < n; ++i) {\n // Compute the wrapped index.\n let k = (i + start) % n;\n\n // Look up the menu title.\n let title = menus[k].title;\n\n // Ignore titles with an empty label.\n if (title.label.length === 0) {\n continue;\n }\n\n // Look up the mnemonic index for the label.\n let mn = title.mnemonic;\n\n // Handle a valid mnemonic index.\n if (mn >= 0 && mn < title.label.length) {\n if (title.label[mn].toUpperCase() === upperKey) {\n if (index === -1) {\n index = k;\n } else {\n multiple = true;\n }\n }\n continue;\n }\n\n // Finally, handle the auto index if possible.\n if (auto === -1 && title.label[0].toUpperCase() === upperKey) {\n auto = k;\n }\n }\n\n // Return the search results.\n return { index, multiple, auto };\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { IDisposable } from '@lumino/disposable';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Drag } from '@lumino/dragdrop';\n\nimport { Message } from '@lumino/messaging';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { Widget } from './widget';\n\n/**\n * A widget which implements a canonical scroll bar.\n */\nexport class ScrollBar extends Widget {\n /**\n * Construct a new scroll bar.\n *\n * @param options - The options for initializing the scroll bar.\n */\n constructor(options: ScrollBar.IOptions = {}) {\n super({ node: Private.createNode() });\n this.addClass('lm-ScrollBar');\n this.setFlag(Widget.Flag.DisallowLayout);\n\n // Set the orientation.\n this._orientation = options.orientation || 'vertical';\n this.dataset['orientation'] = this._orientation;\n\n // Parse the rest of the options.\n if (options.maximum !== undefined) {\n this._maximum = Math.max(0, options.maximum);\n }\n if (options.page !== undefined) {\n this._page = Math.max(0, options.page);\n }\n if (options.value !== undefined) {\n this._value = Math.max(0, Math.min(options.value, this._maximum));\n }\n }\n\n /**\n * A signal emitted when the user moves the scroll thumb.\n *\n * #### Notes\n * The payload is the current value of the scroll bar.\n */\n get thumbMoved(): ISignal {\n return this._thumbMoved;\n }\n\n /**\n * A signal emitted when the user clicks a step button.\n *\n * #### Notes\n * The payload is whether a decrease or increase is requested.\n */\n get stepRequested(): ISignal {\n return this._stepRequested;\n }\n\n /**\n * A signal emitted when the user clicks the scroll track.\n *\n * #### Notes\n * The payload is whether a decrease or increase is requested.\n */\n get pageRequested(): ISignal {\n return this._pageRequested;\n }\n\n /**\n * Get the orientation of the scroll bar.\n */\n get orientation(): ScrollBar.Orientation {\n return this._orientation;\n }\n\n /**\n * Set the orientation of the scroll bar.\n */\n set orientation(value: ScrollBar.Orientation) {\n // Do nothing if the orientation does not change.\n if (this._orientation === value) {\n return;\n }\n\n // Release the mouse before making changes.\n this._releaseMouse();\n\n // Update the internal orientation.\n this._orientation = value;\n this.dataset['orientation'] = value;\n\n // Schedule an update the scroll bar.\n this.update();\n }\n\n /**\n * Get the current value of the scroll bar.\n */\n get value(): number {\n return this._value;\n }\n\n /**\n * Set the current value of the scroll bar.\n *\n * #### Notes\n * The value will be clamped to the range `[0, maximum]`.\n */\n set value(value: number) {\n // Clamp the value to the allowable range.\n value = Math.max(0, Math.min(value, this._maximum));\n\n // Do nothing if the value does not change.\n if (this._value === value) {\n return;\n }\n\n // Update the internal value.\n this._value = value;\n\n // Schedule an update the scroll bar.\n this.update();\n }\n\n /**\n * Get the page size of the scroll bar.\n *\n * #### Notes\n * The page size is the amount of visible content in the scrolled\n * region, expressed in data units. It determines the size of the\n * scroll bar thumb.\n */\n get page(): number {\n return this._page;\n }\n\n /**\n * Set the page size of the scroll bar.\n *\n * #### Notes\n * The page size will be clamped to the range `[0, Infinity]`.\n */\n set page(value: number) {\n // Clamp the page size to the allowable range.\n value = Math.max(0, value);\n\n // Do nothing if the value does not change.\n if (this._page === value) {\n return;\n }\n\n // Update the internal page size.\n this._page = value;\n\n // Schedule an update the scroll bar.\n this.update();\n }\n\n /**\n * Get the maximum value of the scroll bar.\n */\n get maximum(): number {\n return this._maximum;\n }\n\n /**\n * Set the maximum value of the scroll bar.\n *\n * #### Notes\n * The max size will be clamped to the range `[0, Infinity]`.\n */\n set maximum(value: number) {\n // Clamp the value to the allowable range.\n value = Math.max(0, value);\n\n // Do nothing if the value does not change.\n if (this._maximum === value) {\n return;\n }\n\n // Update the internal values.\n this._maximum = value;\n\n // Clamp the current value to the new range.\n this._value = Math.min(this._value, value);\n\n // Schedule an update the scroll bar.\n this.update();\n }\n\n /**\n * The scroll bar decrement button node.\n *\n * #### Notes\n * Modifying this node directly can lead to undefined behavior.\n */\n get decrementNode(): HTMLDivElement {\n return this.node.getElementsByClassName(\n 'lm-ScrollBar-button'\n )[0] as HTMLDivElement;\n }\n\n /**\n * The scroll bar increment button node.\n *\n * #### Notes\n * Modifying this node directly can lead to undefined behavior.\n */\n get incrementNode(): HTMLDivElement {\n return this.node.getElementsByClassName(\n 'lm-ScrollBar-button'\n )[1] as HTMLDivElement;\n }\n\n /**\n * The scroll bar track node.\n *\n * #### Notes\n * Modifying this node directly can lead to undefined behavior.\n */\n get trackNode(): HTMLDivElement {\n return this.node.getElementsByClassName(\n 'lm-ScrollBar-track'\n )[0] as HTMLDivElement;\n }\n\n /**\n * The scroll bar thumb node.\n *\n * #### Notes\n * Modifying this node directly can lead to undefined behavior.\n */\n get thumbNode(): HTMLDivElement {\n return this.node.getElementsByClassName(\n 'lm-ScrollBar-thumb'\n )[0] as HTMLDivElement;\n }\n\n /**\n * Handle the DOM events for the scroll bar.\n *\n * @param event - The DOM event sent to the scroll bar.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the scroll bar's DOM node.\n *\n * This should not be called directly by user code.\n */\n handleEvent(event: Event): void {\n switch (event.type) {\n case 'mousedown':\n this._evtMouseDown(event as MouseEvent);\n break;\n case 'mousemove':\n this._evtMouseMove(event as MouseEvent);\n break;\n case 'mouseup':\n this._evtMouseUp(event as MouseEvent);\n break;\n case 'keydown':\n this._evtKeyDown(event as KeyboardEvent);\n break;\n case 'contextmenu':\n event.preventDefault();\n event.stopPropagation();\n break;\n }\n }\n\n /**\n * A method invoked on a 'before-attach' message.\n */\n protected onBeforeAttach(msg: Message): void {\n this.node.addEventListener('mousedown', this);\n this.update();\n }\n\n /**\n * A method invoked on an 'after-detach' message.\n */\n protected onAfterDetach(msg: Message): void {\n this.node.removeEventListener('mousedown', this);\n this._releaseMouse();\n }\n\n /**\n * A method invoked on an 'update-request' message.\n */\n protected onUpdateRequest(msg: Message): void {\n // Convert the value and page into percentages.\n let value = (this._value * 100) / this._maximum;\n let page = (this._page * 100) / (this._page + this._maximum);\n\n // Clamp the value and page to the relevant range.\n value = Math.max(0, Math.min(value, 100));\n page = Math.max(0, Math.min(page, 100));\n\n // Fetch the thumb style.\n let thumbStyle = this.thumbNode.style;\n\n // Update the thumb style for the current orientation.\n if (this._orientation === 'horizontal') {\n thumbStyle.top = '';\n thumbStyle.height = '';\n thumbStyle.left = `${value}%`;\n thumbStyle.width = `${page}%`;\n thumbStyle.transform = `translate(${-value}%, 0%)`;\n } else {\n thumbStyle.left = '';\n thumbStyle.width = '';\n thumbStyle.top = `${value}%`;\n thumbStyle.height = `${page}%`;\n thumbStyle.transform = `translate(0%, ${-value}%)`;\n }\n }\n\n /**\n * Handle the `'keydown'` event for the scroll bar.\n */\n private _evtKeyDown(event: KeyboardEvent): void {\n // Stop all input events during drag.\n event.preventDefault();\n event.stopPropagation();\n\n // Ignore anything except the `Escape` key.\n if (event.keyCode !== 27) {\n return;\n }\n\n // Fetch the previous scroll value.\n let value = this._pressData ? this._pressData.value : -1;\n\n // Release the mouse.\n this._releaseMouse();\n\n // Restore the old scroll value if possible.\n if (value !== -1) {\n this._moveThumb(value);\n }\n }\n\n /**\n * Handle the `'mousedown'` event for the scroll bar.\n */\n private _evtMouseDown(event: MouseEvent): void {\n // Do nothing if it's not a left mouse press.\n if (event.button !== 0) {\n return;\n }\n\n // Send an activate request to the scroll bar. This can be\n // used by message hooks to activate something relevant.\n this.activate();\n\n // Do nothing if the mouse is already captured.\n if (this._pressData) {\n return;\n }\n\n // Find the pressed scroll bar part.\n let part = Private.findPart(this, event.target as HTMLElement);\n\n // Do nothing if the part is not of interest.\n if (!part) {\n return;\n }\n\n // Stop the event propagation.\n event.preventDefault();\n event.stopPropagation();\n\n // Override the mouse cursor.\n let override = Drag.overrideCursor('default');\n\n // Set up the press data.\n this._pressData = {\n part,\n override,\n delta: -1,\n value: -1,\n mouseX: event.clientX,\n mouseY: event.clientY\n };\n\n // Add the extra event listeners.\n document.addEventListener('mousemove', this, true);\n document.addEventListener('mouseup', this, true);\n document.addEventListener('keydown', this, true);\n document.addEventListener('contextmenu', this, true);\n\n // Handle a thumb press.\n if (part === 'thumb') {\n // Fetch the thumb node.\n let thumbNode = this.thumbNode;\n\n // Fetch the client rect for the thumb.\n let thumbRect = thumbNode.getBoundingClientRect();\n\n // Update the press data delta for the current orientation.\n if (this._orientation === 'horizontal') {\n this._pressData.delta = event.clientX - thumbRect.left;\n } else {\n this._pressData.delta = event.clientY - thumbRect.top;\n }\n\n // Add the active class to the thumb node.\n thumbNode.classList.add('lm-mod-active');\n\n // Store the current value in the press data.\n this._pressData.value = this._value;\n\n // Finished.\n return;\n }\n\n // Handle a track press.\n if (part === 'track') {\n // Fetch the client rect for the thumb.\n let thumbRect = this.thumbNode.getBoundingClientRect();\n\n // Determine the direction for the page request.\n let dir: 'decrement' | 'increment';\n if (this._orientation === 'horizontal') {\n dir = event.clientX < thumbRect.left ? 'decrement' : 'increment';\n } else {\n dir = event.clientY < thumbRect.top ? 'decrement' : 'increment';\n }\n\n // Start the repeat timer.\n this._repeatTimer = window.setTimeout(this._onRepeat, 350);\n\n // Emit the page requested signal.\n this._pageRequested.emit(dir);\n\n // Finished.\n return;\n }\n\n // Handle a decrement button press.\n if (part === 'decrement') {\n // Add the active class to the decrement node.\n this.decrementNode.classList.add('lm-mod-active');\n\n // Start the repeat timer.\n this._repeatTimer = window.setTimeout(this._onRepeat, 350);\n\n // Emit the step requested signal.\n this._stepRequested.emit('decrement');\n\n // Finished.\n return;\n }\n\n // Handle an increment button press.\n if (part === 'increment') {\n // Add the active class to the increment node.\n this.incrementNode.classList.add('lm-mod-active');\n\n // Start the repeat timer.\n this._repeatTimer = window.setTimeout(this._onRepeat, 350);\n\n // Emit the step requested signal.\n this._stepRequested.emit('increment');\n\n // Finished.\n return;\n }\n }\n\n /**\n * Handle the `'mousemove'` event for the scroll bar.\n */\n private _evtMouseMove(event: MouseEvent): void {\n // Do nothing if no drag is in progress.\n if (!this._pressData) {\n return;\n }\n\n // Stop the event propagation.\n event.preventDefault();\n event.stopPropagation();\n\n // Update the mouse position.\n this._pressData.mouseX = event.clientX;\n this._pressData.mouseY = event.clientY;\n\n // Bail if the thumb is not being dragged.\n if (this._pressData.part !== 'thumb') {\n return;\n }\n\n // Get the client rect for the thumb and track.\n let thumbRect = this.thumbNode.getBoundingClientRect();\n let trackRect = this.trackNode.getBoundingClientRect();\n\n // Fetch the scroll geometry based on the orientation.\n let trackPos: number;\n let trackSpan: number;\n if (this._orientation === 'horizontal') {\n trackPos = event.clientX - trackRect.left - this._pressData.delta;\n trackSpan = trackRect.width - thumbRect.width;\n } else {\n trackPos = event.clientY - trackRect.top - this._pressData.delta;\n trackSpan = trackRect.height - thumbRect.height;\n }\n\n // Compute the desired value from the scroll geometry.\n let value = trackSpan === 0 ? 0 : (trackPos * this._maximum) / trackSpan;\n\n // Move the thumb to the computed value.\n this._moveThumb(value);\n }\n\n /**\n * Handle the `'mouseup'` event for the scroll bar.\n */\n private _evtMouseUp(event: MouseEvent): void {\n // Do nothing if it's not a left mouse release.\n if (event.button !== 0) {\n return;\n }\n\n // Stop the event propagation.\n event.preventDefault();\n event.stopPropagation();\n\n // Release the mouse.\n this._releaseMouse();\n }\n\n /**\n * Release the mouse and restore the node states.\n */\n private _releaseMouse(): void {\n // Bail if there is no press data.\n if (!this._pressData) {\n return;\n }\n\n // Clear the repeat timer.\n clearTimeout(this._repeatTimer);\n this._repeatTimer = -1;\n\n // Clear the press data.\n this._pressData.override.dispose();\n this._pressData = null;\n\n // Remove the extra event listeners.\n document.removeEventListener('mousemove', this, true);\n document.removeEventListener('mouseup', this, true);\n document.removeEventListener('keydown', this, true);\n document.removeEventListener('contextmenu', this, true);\n\n // Remove the active classes from the nodes.\n this.thumbNode.classList.remove('lm-mod-active');\n this.decrementNode.classList.remove('lm-mod-active');\n this.incrementNode.classList.remove('lm-mod-active');\n }\n\n /**\n * Move the thumb to the specified position.\n */\n private _moveThumb(value: number): void {\n // Clamp the value to the allowed range.\n value = Math.max(0, Math.min(value, this._maximum));\n\n // Bail if the value does not change.\n if (this._value === value) {\n return;\n }\n\n // Update the internal value.\n this._value = value;\n\n // Schedule an update of the scroll bar.\n this.update();\n\n // Emit the thumb moved signal.\n this._thumbMoved.emit(value);\n }\n\n /**\n * A timeout callback for repeating the mouse press.\n */\n private _onRepeat = () => {\n // Clear the repeat timer id.\n this._repeatTimer = -1;\n\n // Bail if the mouse has been released.\n if (!this._pressData) {\n return;\n }\n\n // Look up the part that was pressed.\n let part = this._pressData.part;\n\n // Bail if the thumb was pressed.\n if (part === 'thumb') {\n return;\n }\n\n // Schedule the timer for another repeat.\n this._repeatTimer = window.setTimeout(this._onRepeat, 20);\n\n // Get the current mouse position.\n let mouseX = this._pressData.mouseX;\n let mouseY = this._pressData.mouseY;\n\n // Handle a decrement button repeat.\n if (part === 'decrement') {\n // Bail if the mouse is not over the button.\n if (!ElementExt.hitTest(this.decrementNode, mouseX, mouseY)) {\n return;\n }\n\n // Emit the step requested signal.\n this._stepRequested.emit('decrement');\n\n // Finished.\n return;\n }\n\n // Handle an increment button repeat.\n if (part === 'increment') {\n // Bail if the mouse is not over the button.\n if (!ElementExt.hitTest(this.incrementNode, mouseX, mouseY)) {\n return;\n }\n\n // Emit the step requested signal.\n this._stepRequested.emit('increment');\n\n // Finished.\n return;\n }\n\n // Handle a track repeat.\n if (part === 'track') {\n // Bail if the mouse is not over the track.\n if (!ElementExt.hitTest(this.trackNode, mouseX, mouseY)) {\n return;\n }\n\n // Fetch the thumb node.\n let thumbNode = this.thumbNode;\n\n // Bail if the mouse is over the thumb.\n if (ElementExt.hitTest(thumbNode, mouseX, mouseY)) {\n return;\n }\n\n // Fetch the client rect for the thumb.\n let thumbRect = thumbNode.getBoundingClientRect();\n\n // Determine the direction for the page request.\n let dir: 'decrement' | 'increment';\n if (this._orientation === 'horizontal') {\n dir = mouseX < thumbRect.left ? 'decrement' : 'increment';\n } else {\n dir = mouseY < thumbRect.top ? 'decrement' : 'increment';\n }\n\n // Emit the page requested signal.\n this._pageRequested.emit(dir);\n\n // Finished.\n return;\n }\n };\n\n private _value = 0;\n private _page = 10;\n private _maximum = 100;\n private _repeatTimer = -1;\n private _orientation: ScrollBar.Orientation;\n private _pressData: Private.IPressData | null = null;\n private _thumbMoved = new Signal(this);\n private _stepRequested = new Signal(this);\n private _pageRequested = new Signal(this);\n}\n\n/**\n * The namespace for the `ScrollBar` class statics.\n */\nexport namespace ScrollBar {\n /**\n * A type alias for a scroll bar orientation.\n */\n export type Orientation = 'horizontal' | 'vertical';\n\n /**\n * An options object for creating a scroll bar.\n */\n export interface IOptions {\n /**\n * The orientation of the scroll bar.\n *\n * The default is `'vertical'`.\n */\n orientation?: Orientation;\n\n /**\n * The value for the scroll bar.\n *\n * The default is `0`.\n */\n value?: number;\n\n /**\n * The page size for the scroll bar.\n *\n * The default is `10`.\n */\n page?: number;\n\n /**\n * The maximum value for the scroll bar.\n *\n * The default is `100`.\n */\n maximum?: number;\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * A type alias for the parts of a scroll bar.\n */\n export type ScrollBarPart = 'thumb' | 'track' | 'decrement' | 'increment';\n\n /**\n * An object which holds mouse press data.\n */\n export interface IPressData {\n /**\n * The scroll bar part which was pressed.\n */\n part: ScrollBarPart;\n\n /**\n * The offset of the press in thumb coordinates, or -1.\n */\n delta: number;\n\n /**\n * The scroll value at the time the thumb was pressed, or -1.\n */\n value: number;\n\n /**\n * The disposable which will clear the override cursor.\n */\n override: IDisposable;\n\n /**\n * The current X position of the mouse.\n */\n mouseX: number;\n\n /**\n * The current Y position of the mouse.\n */\n mouseY: number;\n }\n\n /**\n * Create the DOM node for a scroll bar.\n */\n export function createNode(): HTMLElement {\n let node = document.createElement('div');\n let decrement = document.createElement('div');\n let increment = document.createElement('div');\n let track = document.createElement('div');\n let thumb = document.createElement('div');\n decrement.className = 'lm-ScrollBar-button';\n increment.className = 'lm-ScrollBar-button';\n decrement.dataset['action'] = 'decrement';\n increment.dataset['action'] = 'increment';\n track.className = 'lm-ScrollBar-track';\n thumb.className = 'lm-ScrollBar-thumb';\n track.appendChild(thumb);\n node.appendChild(decrement);\n node.appendChild(track);\n node.appendChild(increment);\n return node;\n }\n\n /**\n * Find the scroll bar part which contains the given target.\n */\n export function findPart(\n scrollBar: ScrollBar,\n target: HTMLElement\n ): ScrollBarPart | null {\n // Test the thumb.\n if (scrollBar.thumbNode.contains(target)) {\n return 'thumb';\n }\n\n // Test the track.\n if (scrollBar.trackNode.contains(target)) {\n return 'track';\n }\n\n // Test the decrement button.\n if (scrollBar.decrementNode.contains(target)) {\n return 'decrement';\n }\n\n // Test the increment button.\n if (scrollBar.incrementNode.contains(target)) {\n return 'increment';\n }\n\n // Indicate no match.\n return null;\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { MessageLoop } from '@lumino/messaging';\n\nimport { Layout } from './layout';\n\nimport { Widget } from './widget';\n\n/**\n * A concrete layout implementation which holds a single widget.\n *\n * #### Notes\n * This class is useful for creating simple container widgets which\n * hold a single child. The child should be positioned with CSS.\n */\nexport class SingletonLayout extends Layout {\n /**\n * Dispose of the resources held by the layout.\n */\n dispose(): void {\n if (this._widget) {\n let widget = this._widget;\n this._widget = null;\n widget.dispose();\n }\n super.dispose();\n }\n\n /**\n * Get the child widget for the layout.\n */\n get widget(): Widget | null {\n return this._widget;\n }\n\n /**\n * Set the child widget for the layout.\n *\n * #### Notes\n * Setting the child widget will cause the old child widget to be\n * automatically disposed. If that is not desired, set the parent\n * of the old child to `null` before assigning a new child.\n */\n set widget(widget: Widget | null) {\n // Remove the widget from its current parent. This is a no-op\n // if the widget's parent is already the layout parent widget.\n if (widget) {\n widget.parent = this.parent;\n }\n\n // Bail early if the widget does not change.\n if (this._widget === widget) {\n return;\n }\n\n // Dispose of the old child widget.\n if (this._widget) {\n this._widget.dispose();\n }\n\n // Update the internal widget.\n this._widget = widget;\n\n // Attach the new child widget if needed.\n if (this.parent && widget) {\n this.attachWidget(widget);\n }\n }\n\n /**\n * Create an iterator over the widgets in the layout.\n *\n * @returns A new iterator over the widgets in the layout.\n */\n *[Symbol.iterator](): IterableIterator {\n if (this._widget) {\n yield this._widget;\n }\n }\n\n /**\n * Remove a widget from the layout.\n *\n * @param widget - The widget to remove from the layout.\n *\n * #### Notes\n * A widget is automatically removed from the layout when its `parent`\n * is set to `null`. This method should only be invoked directly when\n * removing a widget from a layout which has yet to be installed on a\n * parent widget.\n *\n * This method does *not* modify the widget's `parent`.\n */\n removeWidget(widget: Widget): void {\n // Bail early if the widget does not exist in the layout.\n if (this._widget !== widget) {\n return;\n }\n\n // Clear the internal widget.\n this._widget = null;\n\n // If the layout is parented, detach the widget from the DOM.\n if (this.parent) {\n this.detachWidget(widget);\n }\n }\n\n /**\n * Perform layout initialization which requires the parent widget.\n */\n protected init(): void {\n super.init();\n for (const widget of this) {\n this.attachWidget(widget);\n }\n }\n\n /**\n * Attach a widget to the parent's DOM node.\n *\n * @param widget - The widget to attach to the parent.\n *\n * #### Notes\n * This method is called automatically by the single layout at the\n * appropriate time. It should not be called directly by user code.\n *\n * The default implementation adds the widgets's node to the parent's\n * node at the proper location, and sends the appropriate attach\n * messages to the widget if the parent is attached to the DOM.\n *\n * Subclasses may reimplement this method to control how the widget's\n * node is added to the parent's node.\n */\n protected attachWidget(widget: Widget): void {\n // Send a `'before-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n }\n\n // Add the widget's node to the parent.\n this.parent!.node.appendChild(widget.node);\n\n // Send an `'after-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n }\n\n /**\n * Detach a widget from the parent's DOM node.\n *\n * @param widget - The widget to detach from the parent.\n *\n * #### Notes\n * This method is called automatically by the single layout at the\n * appropriate time. It should not be called directly by user code.\n *\n * The default implementation removes the widget's node from the\n * parent's node, and sends the appropriate detach messages to the\n * widget if the parent is attached to the DOM.\n *\n * Subclasses may reimplement this method to control how the widget's\n * node is removed from the parent's node.\n */\n protected detachWidget(widget: Widget): void {\n // Send a `'before-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n }\n\n // Remove the widget's node from the parent.\n this.parent!.node.removeChild(widget.node);\n\n // Send an `'after-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n }\n\n private _widget: Widget | null = null;\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { Layout, LayoutItem } from './layout';\n\nimport { PanelLayout } from './panellayout';\n\nimport { Widget } from './widget';\n\n/**\n * A layout where visible widgets are stacked atop one another.\n *\n * #### Notes\n * The Z-order of the visible widgets follows their layout order.\n */\nexport class StackedLayout extends PanelLayout {\n constructor(options: StackedLayout.IOptions = {}) {\n super(options);\n this._hiddenMode =\n options.hiddenMode !== undefined\n ? options.hiddenMode\n : Widget.HiddenMode.Display;\n }\n\n /**\n * The method for hiding widgets.\n *\n * #### Notes\n * If there is only one child widget, `Display` hiding mode will be used\n * regardless of this setting.\n */\n get hiddenMode(): Widget.HiddenMode {\n return this._hiddenMode;\n }\n\n /**\n * Set the method for hiding widgets.\n *\n * #### Notes\n * If there is only one child widget, `Display` hiding mode will be used\n * regardless of this setting.\n */\n set hiddenMode(v: Widget.HiddenMode) {\n if (this._hiddenMode === v) {\n return;\n }\n this._hiddenMode = v;\n if (this.widgets.length > 1) {\n this.widgets.forEach(w => {\n w.hiddenMode = this._hiddenMode;\n });\n }\n }\n\n /**\n * Dispose of the resources held by the layout.\n */\n dispose(): void {\n // Dispose of the layout items.\n for (const item of this._items) {\n item.dispose();\n }\n\n // Clear the layout state.\n this._box = null;\n this._items.length = 0;\n\n // Dispose of the rest of the layout.\n super.dispose();\n }\n\n /**\n * Attach a widget to the parent's DOM node.\n *\n * @param index - The current index of the widget in the layout.\n *\n * @param widget - The widget to attach to the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected attachWidget(index: number, widget: Widget): void {\n // Using transform create an additional layer in the pixel pipeline\n // to limit the number of layer, it is set only if there is more than one widget.\n if (\n this._hiddenMode === Widget.HiddenMode.Scale &&\n this._items.length > 0\n ) {\n if (this._items.length === 1) {\n this.widgets[0].hiddenMode = Widget.HiddenMode.Scale;\n }\n widget.hiddenMode = Widget.HiddenMode.Scale;\n } else {\n widget.hiddenMode = Widget.HiddenMode.Display;\n }\n\n // Create and add a new layout item for the widget.\n ArrayExt.insert(this._items, index, new LayoutItem(widget));\n\n // Send a `'before-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n }\n\n // Add the widget's node to the parent.\n this.parent!.node.appendChild(widget.node);\n\n // Send an `'after-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n\n // Post a fit request for the parent widget.\n this.parent!.fit();\n }\n\n /**\n * Move a widget in the parent's DOM node.\n *\n * @param fromIndex - The previous index of the widget in the layout.\n *\n * @param toIndex - The current index of the widget in the layout.\n *\n * @param widget - The widget to move in the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected moveWidget(\n fromIndex: number,\n toIndex: number,\n widget: Widget\n ): void {\n // Move the layout item for the widget.\n ArrayExt.move(this._items, fromIndex, toIndex);\n\n // Post an update request for the parent widget.\n this.parent!.update();\n }\n\n /**\n * Detach a widget from the parent's DOM node.\n *\n * @param index - The previous index of the widget in the layout.\n *\n * @param widget - The widget to detach from the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected detachWidget(index: number, widget: Widget): void {\n // Remove the layout item for the widget.\n let item = ArrayExt.removeAt(this._items, index);\n\n // Send a `'before-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n }\n\n // Remove the widget's node from the parent.\n this.parent!.node.removeChild(widget.node);\n\n // Send an `'after-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n\n // Reset the z-index for the widget.\n item!.widget.node.style.zIndex = '';\n\n // Reset the hidden mode for the widget.\n if (this._hiddenMode === Widget.HiddenMode.Scale) {\n widget.hiddenMode = Widget.HiddenMode.Display;\n\n // Reset the hidden mode for the first widget if necessary.\n if (this._items.length === 1) {\n this._items[0].widget.hiddenMode = Widget.HiddenMode.Display;\n }\n }\n\n // Dispose of the layout item.\n item!.dispose();\n\n // Post a fit request for the parent widget.\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'before-show'` message.\n */\n protected onBeforeShow(msg: Message): void {\n super.onBeforeShow(msg);\n this.parent!.update();\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n super.onBeforeAttach(msg);\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-shown'` message.\n */\n protected onChildShown(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-hidden'` message.\n */\n protected onChildHidden(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'resize'` message.\n */\n protected onResize(msg: Widget.ResizeMessage): void {\n if (this.parent!.isVisible) {\n this._update(msg.width, msg.height);\n }\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n protected onUpdateRequest(msg: Message): void {\n if (this.parent!.isVisible) {\n this._update(-1, -1);\n }\n }\n\n /**\n * A message handler invoked on a `'fit-request'` message.\n */\n protected onFitRequest(msg: Message): void {\n if (this.parent!.isAttached) {\n this._fit();\n }\n }\n\n /**\n * Fit the layout to the total size required by the widgets.\n */\n private _fit(): void {\n // Set up the computed minimum size.\n let minW = 0;\n let minH = 0;\n\n // Update the computed minimum size.\n for (let i = 0, n = this._items.length; i < n; ++i) {\n // Fetch the item.\n let item = this._items[i];\n\n // Ignore hidden items.\n if (item.isHidden) {\n continue;\n }\n\n // Update the size limits for the item.\n item.fit();\n\n // Update the computed minimum size.\n minW = Math.max(minW, item.minWidth);\n minH = Math.max(minH, item.minHeight);\n }\n\n // Update the box sizing and add it to the computed min size.\n let box = (this._box = ElementExt.boxSizing(this.parent!.node));\n minW += box.horizontalSum;\n minH += box.verticalSum;\n\n // Update the parent's min size constraints.\n let style = this.parent!.node.style;\n style.minWidth = `${minW}px`;\n style.minHeight = `${minH}px`;\n\n // Set the dirty flag to ensure only a single update occurs.\n this._dirty = true;\n\n // Notify the ancestor that it should fit immediately. This may\n // cause a resize of the parent, fulfilling the required update.\n if (this.parent!.parent) {\n MessageLoop.sendMessage(this.parent!.parent!, Widget.Msg.FitRequest);\n }\n\n // If the dirty flag is still set, the parent was not resized.\n // Trigger the required update on the parent widget immediately.\n if (this._dirty) {\n MessageLoop.sendMessage(this.parent!, Widget.Msg.UpdateRequest);\n }\n }\n\n /**\n * Update the layout position and size of the widgets.\n *\n * The parent offset dimensions should be `-1` if unknown.\n */\n private _update(offsetWidth: number, offsetHeight: number): void {\n // Clear the dirty flag to indicate the update occurred.\n this._dirty = false;\n\n // Compute the visible item count.\n let nVisible = 0;\n for (let i = 0, n = this._items.length; i < n; ++i) {\n nVisible += +!this._items[i].isHidden;\n }\n\n // Bail early if there are no visible items to layout.\n if (nVisible === 0) {\n return;\n }\n\n // Measure the parent if the offset dimensions are unknown.\n if (offsetWidth < 0) {\n offsetWidth = this.parent!.node.offsetWidth;\n }\n if (offsetHeight < 0) {\n offsetHeight = this.parent!.node.offsetHeight;\n }\n\n // Ensure the parent box sizing data is computed.\n if (!this._box) {\n this._box = ElementExt.boxSizing(this.parent!.node);\n }\n\n // Compute the actual layout bounds adjusted for border and padding.\n let top = this._box.paddingTop;\n let left = this._box.paddingLeft;\n let width = offsetWidth - this._box.horizontalSum;\n let height = offsetHeight - this._box.verticalSum;\n\n // Update the widget stacking order and layout geometry.\n for (let i = 0, n = this._items.length; i < n; ++i) {\n // Fetch the item.\n let item = this._items[i];\n\n // Ignore hidden items.\n if (item.isHidden) {\n continue;\n }\n\n // Set the z-index for the widget.\n item.widget.node.style.zIndex = `${i}`;\n\n // Update the item geometry.\n item.update(left, top, width, height);\n }\n }\n\n private _dirty = false;\n private _items: LayoutItem[] = [];\n private _box: ElementExt.IBoxSizing | null = null;\n private _hiddenMode: Widget.HiddenMode;\n}\n\n/**\n * The namespace for the `StackedLayout` class statics.\n */\nexport namespace StackedLayout {\n /**\n * An options object for initializing a stacked layout.\n */\n export interface IOptions extends Layout.IOptions {\n /**\n * The method for hiding widgets.\n *\n * The default is `Widget.HiddenMode.Display`.\n */\n hiddenMode?: Widget.HiddenMode;\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { Panel } from './panel';\n\nimport { StackedLayout } from './stackedlayout';\n\nimport { Widget } from './widget';\n\n/**\n * A panel where visible widgets are stacked atop one another.\n *\n * #### Notes\n * This class provides a convenience wrapper around a {@link StackedLayout}.\n */\nexport class StackedPanel extends Panel {\n /**\n * Construct a new stacked panel.\n *\n * @param options - The options for initializing the panel.\n */\n constructor(options: StackedPanel.IOptions = {}) {\n super({ layout: Private.createLayout(options) });\n this.addClass('lm-StackedPanel');\n }\n\n /**\n * The method for hiding widgets.\n *\n * #### Notes\n * If there is only one child widget, `Display` hiding mode will be used\n * regardless of this setting.\n */\n get hiddenMode(): Widget.HiddenMode {\n return (this.layout as StackedLayout).hiddenMode;\n }\n\n /**\n * Set the method for hiding widgets.\n *\n * #### Notes\n * If there is only one child widget, `Display` hiding mode will be used\n * regardless of this setting.\n */\n set hiddenMode(v: Widget.HiddenMode) {\n (this.layout as StackedLayout).hiddenMode = v;\n }\n\n /**\n * A signal emitted when a widget is removed from a stacked panel.\n */\n get widgetRemoved(): ISignal {\n return this._widgetRemoved;\n }\n\n /**\n * A message handler invoked on a `'child-added'` message.\n */\n protected onChildAdded(msg: Widget.ChildMessage): void {\n msg.child.addClass('lm-StackedPanel-child');\n }\n\n /**\n * A message handler invoked on a `'child-removed'` message.\n */\n protected onChildRemoved(msg: Widget.ChildMessage): void {\n msg.child.removeClass('lm-StackedPanel-child');\n this._widgetRemoved.emit(msg.child);\n }\n\n private _widgetRemoved = new Signal(this);\n}\n\n/**\n * The namespace for the `StackedPanel` class statics.\n */\nexport namespace StackedPanel {\n /**\n * An options object for creating a stacked panel.\n */\n export interface IOptions {\n /**\n * The stacked layout to use for the stacked panel.\n *\n * The default is a new `StackedLayout`.\n */\n layout?: StackedLayout;\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * Create a stacked layout for the given panel options.\n */\n export function createLayout(options: StackedPanel.IOptions): StackedLayout {\n return options.layout || new StackedLayout();\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { Platform } from '@lumino/domutils';\n\nimport { MessageLoop } from '@lumino/messaging';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { BoxLayout } from './boxlayout';\n\nimport { StackedPanel } from './stackedpanel';\n\nimport { TabBar } from './tabbar';\n\nimport { Widget } from './widget';\n\n/**\n * A widget which combines a `TabBar` and a `StackedPanel`.\n *\n * #### Notes\n * This is a simple panel which handles the common case of a tab bar\n * placed next to a content area. The selected tab controls the widget\n * which is shown in the content area.\n *\n * For use cases which require more control than is provided by this\n * panel, the `TabBar` widget may be used independently.\n */\nexport class TabPanel extends Widget {\n /**\n * Construct a new tab panel.\n *\n * @param options - The options for initializing the tab panel.\n */\n constructor(options: TabPanel.IOptions = {}) {\n super();\n this.addClass('lm-TabPanel');\n\n // Create the tab bar and stacked panel.\n this.tabBar = new TabBar(options);\n this.tabBar.addClass('lm-TabPanel-tabBar');\n this.stackedPanel = new StackedPanel();\n this.stackedPanel.addClass('lm-TabPanel-stackedPanel');\n\n // Connect the tab bar signal handlers.\n this.tabBar.tabMoved.connect(this._onTabMoved, this);\n this.tabBar.currentChanged.connect(this._onCurrentChanged, this);\n this.tabBar.tabCloseRequested.connect(this._onTabCloseRequested, this);\n this.tabBar.tabActivateRequested.connect(\n this._onTabActivateRequested,\n this\n );\n this.tabBar.addRequested.connect(this._onTabAddRequested, this);\n\n // Connect the stacked panel signal handlers.\n this.stackedPanel.widgetRemoved.connect(this._onWidgetRemoved, this);\n\n // Get the data related to the placement.\n this._tabPlacement = options.tabPlacement || 'top';\n let direction = Private.directionFromPlacement(this._tabPlacement);\n let orientation = Private.orientationFromPlacement(this._tabPlacement);\n\n // Configure the tab bar for the placement.\n this.tabBar.orientation = orientation;\n this.tabBar.dataset['placement'] = this._tabPlacement;\n\n // Create the box layout.\n let layout = new BoxLayout({ direction, spacing: 0 });\n\n // Set the stretch factors for the child widgets.\n BoxLayout.setStretch(this.tabBar, 0);\n BoxLayout.setStretch(this.stackedPanel, 1);\n\n // Add the child widgets to the layout.\n layout.addWidget(this.tabBar);\n layout.addWidget(this.stackedPanel);\n\n // Install the layout on the tab panel.\n this.layout = layout;\n }\n\n /**\n * A signal emitted when the current tab is changed.\n *\n * #### Notes\n * This signal is emitted when the currently selected tab is changed\n * either through user or programmatic interaction.\n *\n * Notably, this signal is not emitted when the index of the current\n * tab changes due to tabs being inserted, removed, or moved. It is\n * only emitted when the actual current tab node is changed.\n */\n get currentChanged(): ISignal {\n return this._currentChanged;\n }\n\n /**\n * Get the index of the currently selected tab.\n *\n * #### Notes\n * This will be `-1` if no tab is selected.\n */\n get currentIndex(): number {\n return this.tabBar.currentIndex;\n }\n\n /**\n * Set the index of the currently selected tab.\n *\n * #### Notes\n * If the index is out of range, it will be set to `-1`.\n */\n set currentIndex(value: number) {\n this.tabBar.currentIndex = value;\n }\n\n /**\n * Get the currently selected widget.\n *\n * #### Notes\n * This will be `null` if there is no selected tab.\n */\n get currentWidget(): Widget | null {\n let title = this.tabBar.currentTitle;\n return title ? title.owner : null;\n }\n\n /**\n * Set the currently selected widget.\n *\n * #### Notes\n * If the widget is not in the panel, it will be set to `null`.\n */\n set currentWidget(value: Widget | null) {\n this.tabBar.currentTitle = value ? value.title : null;\n }\n\n /**\n * Get the whether the tabs are movable by the user.\n *\n * #### Notes\n * Tabs can always be moved programmatically.\n */\n get tabsMovable(): boolean {\n return this.tabBar.tabsMovable;\n }\n\n /**\n * Set the whether the tabs are movable by the user.\n *\n * #### Notes\n * Tabs can always be moved programmatically.\n */\n set tabsMovable(value: boolean) {\n this.tabBar.tabsMovable = value;\n }\n\n /**\n * Get the whether the add button is enabled.\n *\n */\n get addButtonEnabled(): boolean {\n return this.tabBar.addButtonEnabled;\n }\n\n /**\n * Set the whether the add button is enabled.\n *\n */\n set addButtonEnabled(value: boolean) {\n this.tabBar.addButtonEnabled = value;\n }\n\n /**\n * Get the tab placement for the tab panel.\n *\n * #### Notes\n * This controls the position of the tab bar relative to the content.\n */\n get tabPlacement(): TabPanel.TabPlacement {\n return this._tabPlacement;\n }\n\n /**\n * Set the tab placement for the tab panel.\n *\n * #### Notes\n * This controls the position of the tab bar relative to the content.\n */\n set tabPlacement(value: TabPanel.TabPlacement) {\n // Bail if the placement does not change.\n if (this._tabPlacement === value) {\n return;\n }\n\n // Update the internal value.\n this._tabPlacement = value;\n\n // Get the values related to the placement.\n let direction = Private.directionFromPlacement(value);\n let orientation = Private.orientationFromPlacement(value);\n\n // Configure the tab bar for the placement.\n this.tabBar.orientation = orientation;\n this.tabBar.dataset['placement'] = value;\n\n // Update the layout direction.\n (this.layout as BoxLayout).direction = direction;\n }\n\n /**\n * A signal emitted when the add button on a tab bar is clicked.\n *\n */\n get addRequested(): ISignal> {\n return this._addRequested;\n }\n\n /**\n * The tab bar used by the tab panel.\n *\n * #### Notes\n * Modifying the tab bar directly can lead to undefined behavior.\n */\n readonly tabBar: TabBar;\n\n /**\n * The stacked panel used by the tab panel.\n *\n * #### Notes\n * Modifying the panel directly can lead to undefined behavior.\n */\n readonly stackedPanel: StackedPanel;\n\n /**\n * A read-only array of the widgets in the panel.\n */\n get widgets(): ReadonlyArray {\n return this.stackedPanel.widgets;\n }\n\n /**\n * Add a widget to the end of the tab panel.\n *\n * @param widget - The widget to add to the tab panel.\n *\n * #### Notes\n * If the widget is already contained in the panel, it will be moved.\n *\n * The widget's `title` is used to populate the tab.\n */\n addWidget(widget: Widget): void {\n this.insertWidget(this.widgets.length, widget);\n }\n\n /**\n * Insert a widget into the tab panel at a specified index.\n *\n * @param index - The index at which to insert the widget.\n *\n * @param widget - The widget to insert into to the tab panel.\n *\n * #### Notes\n * If the widget is already contained in the panel, it will be moved.\n *\n * The widget's `title` is used to populate the tab.\n */\n insertWidget(index: number, widget: Widget): void {\n if (widget !== this.currentWidget) {\n widget.hide();\n }\n this.stackedPanel.insertWidget(index, widget);\n this.tabBar.insertTab(index, widget.title);\n\n widget.node.setAttribute('role', 'tabpanel');\n\n let renderer = this.tabBar.renderer;\n if (renderer instanceof TabBar.Renderer) {\n let tabId = renderer.createTabKey({\n title: widget.title,\n current: false,\n zIndex: 0\n });\n widget.node.setAttribute('aria-labelledby', tabId);\n }\n }\n\n /**\n * Handle the `currentChanged` signal from the tab bar.\n */\n private _onCurrentChanged(\n sender: TabBar,\n args: TabBar.ICurrentChangedArgs\n ): void {\n // Extract the previous and current title from the args.\n let { previousIndex, previousTitle, currentIndex, currentTitle } = args;\n\n // Extract the widgets from the titles.\n let previousWidget = previousTitle ? previousTitle.owner : null;\n let currentWidget = currentTitle ? currentTitle.owner : null;\n\n // Hide the previous widget.\n if (previousWidget) {\n previousWidget.hide();\n }\n\n // Show the current widget.\n if (currentWidget) {\n currentWidget.show();\n }\n\n // Emit the `currentChanged` signal for the tab panel.\n this._currentChanged.emit({\n previousIndex,\n previousWidget,\n currentIndex,\n currentWidget\n });\n\n // Flush the message loop on IE and Edge to prevent flicker.\n if (Platform.IS_EDGE || Platform.IS_IE) {\n MessageLoop.flush();\n }\n }\n\n /**\n * Handle the `tabAddRequested` signal from the tab bar.\n */\n private _onTabAddRequested(sender: TabBar, args: void): void {\n this._addRequested.emit(sender);\n }\n\n /**\n * Handle the `tabActivateRequested` signal from the tab bar.\n */\n private _onTabActivateRequested(\n sender: TabBar,\n args: TabBar.ITabActivateRequestedArgs\n ): void {\n args.title.owner.activate();\n }\n\n /**\n * Handle the `tabCloseRequested` signal from the tab bar.\n */\n private _onTabCloseRequested(\n sender: TabBar,\n args: TabBar.ITabCloseRequestedArgs\n ): void {\n args.title.owner.close();\n }\n\n /**\n * Handle the `tabMoved` signal from the tab bar.\n */\n private _onTabMoved(\n sender: TabBar,\n args: TabBar.ITabMovedArgs\n ): void {\n this.stackedPanel.insertWidget(args.toIndex, args.title.owner);\n }\n\n /**\n * Handle the `widgetRemoved` signal from the stacked panel.\n */\n private _onWidgetRemoved(sender: StackedPanel, widget: Widget): void {\n widget.node.removeAttribute('role');\n widget.node.removeAttribute('aria-labelledby');\n this.tabBar.removeTab(widget.title);\n }\n\n private _tabPlacement: TabPanel.TabPlacement;\n private _currentChanged = new Signal(\n this\n );\n\n private _addRequested = new Signal>(this);\n}\n\n/**\n * The namespace for the `TabPanel` class statics.\n */\nexport namespace TabPanel {\n /**\n * A type alias for tab placement in a tab bar.\n */\n export type TabPlacement =\n | /**\n * The tabs are placed as a row above the content.\n */\n 'top'\n\n /**\n * The tabs are placed as a column to the left of the content.\n */\n | 'left'\n\n /**\n * The tabs are placed as a column to the right of the content.\n */\n | 'right'\n\n /**\n * The tabs are placed as a row below the content.\n */\n | 'bottom';\n\n /**\n * An options object for initializing a tab panel.\n */\n export interface IOptions {\n /**\n * The document to use with the tab panel.\n *\n * The default is the global `document` instance.\n */\n document?: Document | ShadowRoot;\n\n /**\n * Whether the tabs are movable by the user.\n *\n * The default is `false`.\n */\n tabsMovable?: boolean;\n\n /**\n * Whether the button to add new tabs is enabled.\n *\n * The default is `false`.\n */\n addButtonEnabled?: boolean;\n\n /**\n * The placement of the tab bar relative to the content.\n *\n * The default is `'top'`.\n */\n tabPlacement?: TabPlacement;\n\n /**\n * The renderer for the panel's tab bar.\n *\n * The default is a shared renderer instance.\n */\n renderer?: TabBar.IRenderer;\n }\n\n /**\n * The arguments object for the `currentChanged` signal.\n */\n export interface ICurrentChangedArgs {\n /**\n * The previously selected index.\n */\n previousIndex: number;\n\n /**\n * The previously selected widget.\n */\n previousWidget: Widget | null;\n\n /**\n * The currently selected index.\n */\n currentIndex: number;\n\n /**\n * The currently selected widget.\n */\n currentWidget: Widget | null;\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * Convert a tab placement to tab bar orientation.\n */\n export function orientationFromPlacement(\n plc: TabPanel.TabPlacement\n ): TabBar.Orientation {\n return placementToOrientationMap[plc];\n }\n\n /**\n * Convert a tab placement to a box layout direction.\n */\n export function directionFromPlacement(\n plc: TabPanel.TabPlacement\n ): BoxLayout.Direction {\n return placementToDirectionMap[plc];\n }\n\n /**\n * A mapping of tab placement to tab bar orientation.\n */\n const placementToOrientationMap: { [key: string]: TabBar.Orientation } = {\n top: 'horizontal',\n left: 'vertical',\n right: 'vertical',\n bottom: 'horizontal'\n };\n\n /**\n * A mapping of tab placement to box layout direction.\n */\n const placementToDirectionMap: { [key: string]: BoxLayout.Direction } = {\n top: 'top-to-bottom',\n left: 'left-to-right',\n right: 'right-to-left',\n bottom: 'bottom-to-top'\n };\n}\n"],"names":["BoxEngine","Signal","Private","MessageLoop","AttachedProperty","Message","ConflatableMessage","ElementExt","ArrayExt","Utils","UUID","Drag","VirtualDOM","h","StringExt","CommandRegistry","JSONExt","getKeyboardLayout","DisposableDelegate","Selector","empty","find","Platform","MimeData","max"],"mappings":";;;;;;IAAA;IACA;IACA;;;;;;IAM+E;IAE/E;;;;;;;;;IASG;UACU,QAAQ,CAAA;IAArB,IAAA,WAAA,GAAA;IACE;;;;;;;;;;;;IAYG;YACH,IAAQ,CAAA,QAAA,GAAG,CAAC,CAAC;IAEb;;;;;;;;;;;;IAYG;YACH,IAAO,CAAA,OAAA,GAAG,CAAC,CAAC;IAEZ;;;;;;;;;;;;IAYG;YACH,IAAO,CAAA,OAAA,GAAG,QAAQ,CAAC;IAEnB;;;;;;;;;;;;;;;IAeG;YACH,IAAO,CAAA,OAAA,GAAG,CAAC,CAAC;IAEZ;;;;;;;;;;;IAWG;YACH,IAAI,CAAA,IAAA,GAAG,CAAC,CAAC;IAET;;;;;;;IAOG;YACH,IAAI,CAAA,IAAA,GAAG,KAAK,CAAC;SACd;IAAA,CAAA;IAED;;IAEG;AACcA,+BA0XhB;IA1XD,CAAA,UAAiB,SAAS,EAAA;IACxB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AsChB,EAAA,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} +\ No newline at end of file ++{"version":3,"file":"index.js","sources":["../src/boxengine.ts","../src/title.ts","../src/widget.ts","../src/layout.ts","../src/panellayout.ts","../src/utils.ts","../src/splitlayout.ts","../src/accordionlayout.ts","../src/panel.ts","../src/splitpanel.ts","../src/accordionpanel.ts","../src/boxlayout.ts","../src/boxpanel.ts","../src/commandpalette.ts","../src/menu.ts","../src/contextmenu.ts","../src/tabbar.ts","../src/docklayout.ts","../src/dockpanel.ts","../src/focustracker.ts","../src/gridlayout.ts","../src/menubar.ts","../src/scrollbar.ts","../src/singletonlayout.ts","../src/stackedlayout.ts","../src/stackedpanel.ts","../src/tabpanel.ts"],"sourcesContent":["// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n\n/**\n * A sizer object for use with the box engine layout functions.\n *\n * #### Notes\n * A box sizer holds the geometry information for an object along an\n * arbitrary layout orientation.\n *\n * For best performance, this class should be treated as a raw data\n * struct. It should not typically be subclassed.\n */\nexport class BoxSizer {\n /**\n * The preferred size for the sizer.\n *\n * #### Notes\n * The sizer will be given this initial size subject to its size\n * bounds. The sizer will not deviate from this size unless such\n * deviation is required to fit into the available layout space.\n *\n * There is no limit to this value, but it will be clamped to the\n * bounds defined by {@link minSize} and {@link maxSize}.\n *\n * The default value is `0`.\n */\n sizeHint = 0;\n\n /**\n * The minimum size of the sizer.\n *\n * #### Notes\n * The sizer will never be sized less than this value, even if\n * it means the sizer will overflow the available layout space.\n *\n * It is assumed that this value lies in the range `[0, Infinity)`\n * and that it is `<=` to {@link maxSize}. Failure to adhere to this\n * constraint will yield undefined results.\n *\n * The default value is `0`.\n */\n minSize = 0;\n\n /**\n * The maximum size of the sizer.\n *\n * #### Notes\n * The sizer will never be sized greater than this value, even if\n * it means the sizer will underflow the available layout space.\n *\n * It is assumed that this value lies in the range `[0, Infinity]`\n * and that it is `>=` to {@link minSize}. Failure to adhere to this\n * constraint will yield undefined results.\n *\n * The default value is `Infinity`.\n */\n maxSize = Infinity;\n\n /**\n * The stretch factor for the sizer.\n *\n * #### Notes\n * This controls how much the sizer stretches relative to its sibling\n * sizers when layout space is distributed. A stretch factor of zero\n * is special and will cause the sizer to only be resized after all\n * other sizers with a stretch factor greater than zero have been\n * resized to their limits.\n *\n * It is assumed that this value is an integer that lies in the range\n * `[0, Infinity)`. Failure to adhere to this constraint will yield\n * undefined results.\n *\n * The default value is `1`.\n */\n stretch = 1;\n\n /**\n * The computed size of the sizer.\n *\n * #### Notes\n * This value is the output of a call to {@link BoxEngine.calc}. It represents\n * the computed size for the object along the layout orientation,\n * and will always lie in the range `[minSize, maxSize]`.\n *\n * This value is output only.\n *\n * Changing this value will have no effect.\n */\n size = 0;\n\n /**\n * An internal storage property for the layout algorithm.\n *\n * #### Notes\n * This value is used as temporary storage by the layout algorithm.\n *\n * Changing this value will have no effect.\n */\n done = false;\n}\n\n/**\n * The namespace for the box engine layout functions.\n */\nexport namespace BoxEngine {\n /**\n * Calculate the optimal layout sizes for a sequence of box sizers.\n *\n * This distributes the available layout space among the box sizers\n * according to the following algorithm:\n *\n * 1. Initialize the sizers's size to its size hint and compute the\n * sums for each of size hint, min size, and max size.\n *\n * 2. If the total size hint equals the available space, return.\n *\n * 3. If the available space is less than the total min size, set all\n * sizers to their min size and return.\n *\n * 4. If the available space is greater than the total max size, set\n * all sizers to their max size and return.\n *\n * 5. If the layout space is less than the total size hint, distribute\n * the negative delta as follows:\n *\n * a. Shrink each sizer with a stretch factor greater than zero by\n * an amount proportional to the negative space and the sum of\n * stretch factors. If the sizer reaches its min size, remove\n * it and its stretch factor from the computation.\n *\n * b. If after adjusting all stretch sizers there remains negative\n * space, distribute the space equally among the sizers with a\n * stretch factor of zero. If a sizer reaches its min size,\n * remove it from the computation.\n *\n * 6. If the layout space is greater than the total size hint,\n * distribute the positive delta as follows:\n *\n * a. Expand each sizer with a stretch factor greater than zero by\n * an amount proportional to the postive space and the sum of\n * stretch factors. If the sizer reaches its max size, remove\n * it and its stretch factor from the computation.\n *\n * b. If after adjusting all stretch sizers there remains positive\n * space, distribute the space equally among the sizers with a\n * stretch factor of zero. If a sizer reaches its max size,\n * remove it from the computation.\n *\n * 7. return\n *\n * @param sizers - The sizers for a particular layout line.\n *\n * @param space - The available layout space for the sizers.\n *\n * @returns The delta between the provided available space and the\n * actual consumed space. This value will be zero if the sizers\n * can be adjusted to fit, negative if the available space is too\n * small, and positive if the available space is too large.\n *\n * #### Notes\n * The {@link BoxSizer.size} of each sizer is updated with the computed size.\n *\n * This function can be called at any time to recompute the layout for\n * an existing sequence of sizers. The previously computed results will\n * have no effect on the new output. It is therefore not necessary to\n * create new sizer objects on each resize event.\n */\n export function calc(sizers: ArrayLike, space: number): number {\n // Bail early if there is nothing to do.\n let count = sizers.length;\n if (count === 0) {\n return space;\n }\n\n // Setup the size and stretch counters.\n let totalMin = 0;\n let totalMax = 0;\n let totalSize = 0;\n let totalStretch = 0;\n let stretchCount = 0;\n\n // Setup the sizers and compute the totals.\n for (let i = 0; i < count; ++i) {\n let sizer = sizers[i];\n let min = sizer.minSize;\n let max = sizer.maxSize;\n let hint = sizer.sizeHint;\n sizer.done = false;\n sizer.size = Math.max(min, Math.min(hint, max));\n totalSize += sizer.size;\n totalMin += min;\n totalMax += max;\n if (sizer.stretch > 0) {\n totalStretch += sizer.stretch;\n stretchCount++;\n }\n }\n\n // If the space is equal to the total size, return early.\n if (space === totalSize) {\n return 0;\n }\n\n // If the space is less than the total min, minimize each sizer.\n if (space <= totalMin) {\n for (let i = 0; i < count; ++i) {\n let sizer = sizers[i];\n sizer.size = sizer.minSize;\n }\n return space - totalMin;\n }\n\n // If the space is greater than the total max, maximize each sizer.\n if (space >= totalMax) {\n for (let i = 0; i < count; ++i) {\n let sizer = sizers[i];\n sizer.size = sizer.maxSize;\n }\n return space - totalMax;\n }\n\n // The loops below perform sub-pixel precision sizing. A near zero\n // value is used for compares instead of zero to ensure that the\n // loop terminates when the subdivided space is reasonably small.\n let nearZero = 0.01;\n\n // A counter which is decremented each time a sizer is resized to\n // its limit. This ensures the loops terminate even if there is\n // space remaining to distribute.\n let notDoneCount = count;\n\n // Distribute negative delta space.\n if (space < totalSize) {\n // Shrink each stretchable sizer by an amount proportional to its\n // stretch factor. If a sizer reaches its min size it's marked as\n // done. The loop progresses in phases where each sizer is given\n // a chance to consume its fair share for the pass, regardless of\n // whether a sizer before it reached its limit. This continues\n // until the stretchable sizers or the free space is exhausted.\n let freeSpace = totalSize - space;\n while (stretchCount > 0 && freeSpace > nearZero) {\n let distSpace = freeSpace;\n let distStretch = totalStretch;\n for (let i = 0; i < count; ++i) {\n let sizer = sizers[i];\n if (sizer.done || sizer.stretch === 0) {\n continue;\n }\n let amt = (sizer.stretch * distSpace) / distStretch;\n if (sizer.size - amt <= sizer.minSize) {\n freeSpace -= sizer.size - sizer.minSize;\n totalStretch -= sizer.stretch;\n sizer.size = sizer.minSize;\n sizer.done = true;\n notDoneCount--;\n stretchCount--;\n } else {\n freeSpace -= amt;\n sizer.size -= amt;\n }\n }\n }\n // Distribute any remaining space evenly among the non-stretchable\n // sizers. This progresses in phases in the same manner as above.\n while (notDoneCount > 0 && freeSpace > nearZero) {\n let amt = freeSpace / notDoneCount;\n for (let i = 0; i < count; ++i) {\n let sizer = sizers[i];\n if (sizer.done) {\n continue;\n }\n if (sizer.size - amt <= sizer.minSize) {\n freeSpace -= sizer.size - sizer.minSize;\n sizer.size = sizer.minSize;\n sizer.done = true;\n notDoneCount--;\n } else {\n freeSpace -= amt;\n sizer.size -= amt;\n }\n }\n }\n }\n // Distribute positive delta space.\n else {\n // Expand each stretchable sizer by an amount proportional to its\n // stretch factor. If a sizer reaches its max size it's marked as\n // done. The loop progresses in phases where each sizer is given\n // a chance to consume its fair share for the pass, regardless of\n // whether a sizer before it reached its limit. This continues\n // until the stretchable sizers or the free space is exhausted.\n let freeSpace = space - totalSize;\n while (stretchCount > 0 && freeSpace > nearZero) {\n let distSpace = freeSpace;\n let distStretch = totalStretch;\n for (let i = 0; i < count; ++i) {\n let sizer = sizers[i];\n if (sizer.done || sizer.stretch === 0) {\n continue;\n }\n let amt = (sizer.stretch * distSpace) / distStretch;\n if (sizer.size + amt >= sizer.maxSize) {\n freeSpace -= sizer.maxSize - sizer.size;\n totalStretch -= sizer.stretch;\n sizer.size = sizer.maxSize;\n sizer.done = true;\n notDoneCount--;\n stretchCount--;\n } else {\n freeSpace -= amt;\n sizer.size += amt;\n }\n }\n }\n // Distribute any remaining space evenly among the non-stretchable\n // sizers. This progresses in phases in the same manner as above.\n while (notDoneCount > 0 && freeSpace > nearZero) {\n let amt = freeSpace / notDoneCount;\n for (let i = 0; i < count; ++i) {\n let sizer = sizers[i];\n if (sizer.done) {\n continue;\n }\n if (sizer.size + amt >= sizer.maxSize) {\n freeSpace -= sizer.maxSize - sizer.size;\n sizer.size = sizer.maxSize;\n sizer.done = true;\n notDoneCount--;\n } else {\n freeSpace -= amt;\n sizer.size += amt;\n }\n }\n }\n }\n\n // Indicate that the consumed space equals the available space.\n return 0;\n }\n\n /**\n * Adjust a sizer by a delta and update its neighbors accordingly.\n *\n * @param sizers - The sizers which should be adjusted.\n *\n * @param index - The index of the sizer to grow.\n *\n * @param delta - The amount to adjust the sizer, positive or negative.\n *\n * #### Notes\n * This will adjust the indicated sizer by the specified amount, along\n * with the sizes of the appropriate neighbors, subject to the limits\n * specified by each of the sizers.\n *\n * This is useful when implementing box layouts where the boundaries\n * between the sizers are interactively adjustable by the user.\n */\n export function adjust(\n sizers: ArrayLike,\n index: number,\n delta: number\n ): void {\n // Bail early when there is nothing to do.\n if (sizers.length === 0 || delta === 0) {\n return;\n }\n\n // Dispatch to the proper implementation.\n if (delta > 0) {\n growSizer(sizers, index, delta);\n } else {\n shrinkSizer(sizers, index, -delta);\n }\n }\n\n /**\n * Grow a sizer by a positive delta and adjust neighbors.\n */\n function growSizer(\n sizers: ArrayLike,\n index: number,\n delta: number\n ): void {\n // Compute how much the items to the left can expand.\n let growLimit = 0;\n for (let i = 0; i <= index; ++i) {\n let sizer = sizers[i];\n growLimit += sizer.maxSize - sizer.size;\n }\n\n // Compute how much the items to the right can shrink.\n let shrinkLimit = 0;\n for (let i = index + 1, n = sizers.length; i < n; ++i) {\n let sizer = sizers[i];\n shrinkLimit += sizer.size - sizer.minSize;\n }\n\n // Clamp the delta adjustment to the limits.\n delta = Math.min(delta, growLimit, shrinkLimit);\n\n // Grow the sizers to the left by the delta.\n let grow = delta;\n for (let i = index; i >= 0 && grow > 0; --i) {\n let sizer = sizers[i];\n let limit = sizer.maxSize - sizer.size;\n if (limit >= grow) {\n sizer.sizeHint = sizer.size + grow;\n grow = 0;\n } else {\n sizer.sizeHint = sizer.size + limit;\n grow -= limit;\n }\n }\n\n // Shrink the sizers to the right by the delta.\n let shrink = delta;\n for (let i = index + 1, n = sizers.length; i < n && shrink > 0; ++i) {\n let sizer = sizers[i];\n let limit = sizer.size - sizer.minSize;\n if (limit >= shrink) {\n sizer.sizeHint = sizer.size - shrink;\n shrink = 0;\n } else {\n sizer.sizeHint = sizer.size - limit;\n shrink -= limit;\n }\n }\n }\n\n /**\n * Shrink a sizer by a positive delta and adjust neighbors.\n */\n function shrinkSizer(\n sizers: ArrayLike,\n index: number,\n delta: number\n ): void {\n // Compute how much the items to the right can expand.\n let growLimit = 0;\n for (let i = index + 1, n = sizers.length; i < n; ++i) {\n let sizer = sizers[i];\n growLimit += sizer.maxSize - sizer.size;\n }\n\n // Compute how much the items to the left can shrink.\n let shrinkLimit = 0;\n for (let i = 0; i <= index; ++i) {\n let sizer = sizers[i];\n shrinkLimit += sizer.size - sizer.minSize;\n }\n\n // Clamp the delta adjustment to the limits.\n delta = Math.min(delta, growLimit, shrinkLimit);\n\n // Grow the sizers to the right by the delta.\n let grow = delta;\n for (let i = index + 1, n = sizers.length; i < n && grow > 0; ++i) {\n let sizer = sizers[i];\n let limit = sizer.maxSize - sizer.size;\n if (limit >= grow) {\n sizer.sizeHint = sizer.size + grow;\n grow = 0;\n } else {\n sizer.sizeHint = sizer.size + limit;\n grow -= limit;\n }\n }\n\n // Shrink the sizers to the left by the delta.\n let shrink = delta;\n for (let i = index; i >= 0 && shrink > 0; --i) {\n let sizer = sizers[i];\n let limit = sizer.size - sizer.minSize;\n if (limit >= shrink) {\n sizer.sizeHint = sizer.size - shrink;\n shrink = 0;\n } else {\n sizer.sizeHint = sizer.size - limit;\n shrink -= limit;\n }\n }\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { IDisposable } from '@lumino/disposable';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { VirtualElement } from '@lumino/virtualdom';\n\n/**\n * An object which holds data related to an object's title.\n *\n * #### Notes\n * A title object is intended to hold the data necessary to display a\n * header for a particular object. A common example is the `TabPanel`,\n * which uses the widget title to populate the tab for a child widget.\n *\n * It is the responsibility of the owner to call the title disposal.\n */\nexport class Title implements IDisposable {\n /**\n * Construct a new title.\n *\n * @param options - The options for initializing the title.\n */\n constructor(options: Title.IOptions) {\n this.owner = options.owner;\n if (options.label !== undefined) {\n this._label = options.label;\n }\n if (options.mnemonic !== undefined) {\n this._mnemonic = options.mnemonic;\n }\n if (options.icon !== undefined) {\n this._icon = options.icon;\n }\n\n if (options.iconClass !== undefined) {\n this._iconClass = options.iconClass;\n }\n if (options.iconLabel !== undefined) {\n this._iconLabel = options.iconLabel;\n }\n if (options.caption !== undefined) {\n this._caption = options.caption;\n }\n if (options.className !== undefined) {\n this._className = options.className;\n }\n if (options.closable !== undefined) {\n this._closable = options.closable;\n }\n this._dataset = options.dataset || {};\n }\n\n /**\n * A signal emitted when the state of the title changes.\n */\n get changed(): ISignal {\n return this._changed;\n }\n\n /**\n * The object which owns the title.\n */\n readonly owner: T;\n\n /**\n * Get the label for the title.\n *\n * #### Notes\n * The default value is an empty string.\n */\n get label(): string {\n return this._label;\n }\n\n /**\n * Set the label for the title.\n */\n set label(value: string) {\n if (this._label === value) {\n return;\n }\n this._label = value;\n this._changed.emit(undefined);\n }\n\n /**\n * Get the mnemonic index for the title.\n *\n * #### Notes\n * The default value is `-1`.\n */\n get mnemonic(): number {\n return this._mnemonic;\n }\n\n /**\n * Set the mnemonic index for the title.\n */\n set mnemonic(value: number) {\n if (this._mnemonic === value) {\n return;\n }\n this._mnemonic = value;\n this._changed.emit(undefined);\n }\n\n /**\n * Get the icon renderer for the title.\n *\n * #### Notes\n * The default value is undefined.\n */\n get icon(): VirtualElement.IRenderer | undefined {\n return this._icon;\n }\n\n /**\n * Set the icon renderer for the title.\n *\n * #### Notes\n * A renderer is an object that supplies a render and unrender function.\n */\n set icon(value: VirtualElement.IRenderer | undefined) {\n if (this._icon === value) {\n return;\n }\n this._icon = value;\n this._changed.emit(undefined);\n }\n\n /**\n * Get the icon class name for the title.\n *\n * #### Notes\n * The default value is an empty string.\n */\n get iconClass(): string {\n return this._iconClass;\n }\n\n /**\n * Set the icon class name for the title.\n *\n * #### Notes\n * Multiple class names can be separated with whitespace.\n */\n set iconClass(value: string) {\n if (this._iconClass === value) {\n return;\n }\n this._iconClass = value;\n this._changed.emit(undefined);\n }\n\n /**\n * Get the icon label for the title.\n *\n * #### Notes\n * The default value is an empty string.\n */\n get iconLabel(): string {\n return this._iconLabel;\n }\n\n /**\n * Set the icon label for the title.\n *\n * #### Notes\n * Multiple class names can be separated with whitespace.\n */\n set iconLabel(value: string) {\n if (this._iconLabel === value) {\n return;\n }\n this._iconLabel = value;\n this._changed.emit(undefined);\n }\n\n /**\n * Get the caption for the title.\n *\n * #### Notes\n * The default value is an empty string.\n */\n get caption(): string {\n return this._caption;\n }\n\n /**\n * Set the caption for the title.\n */\n set caption(value: string) {\n if (this._caption === value) {\n return;\n }\n this._caption = value;\n this._changed.emit(undefined);\n }\n\n /**\n * Get the extra class name for the title.\n *\n * #### Notes\n * The default value is an empty string.\n */\n get className(): string {\n return this._className;\n }\n\n /**\n * Set the extra class name for the title.\n *\n * #### Notes\n * Multiple class names can be separated with whitespace.\n */\n set className(value: string) {\n if (this._className === value) {\n return;\n }\n this._className = value;\n this._changed.emit(undefined);\n }\n\n /**\n * Get the closable state for the title.\n *\n * #### Notes\n * The default value is `false`.\n */\n get closable(): boolean {\n return this._closable;\n }\n\n /**\n * Set the closable state for the title.\n *\n * #### Notes\n * This controls the presence of a close icon when applicable.\n */\n set closable(value: boolean) {\n if (this._closable === value) {\n return;\n }\n this._closable = value;\n this._changed.emit(undefined);\n }\n\n /**\n * Get the dataset for the title.\n *\n * #### Notes\n * The default value is an empty dataset.\n */\n get dataset(): Title.Dataset {\n return this._dataset;\n }\n\n /**\n * Set the dataset for the title.\n *\n * #### Notes\n * This controls the data attributes when applicable.\n */\n set dataset(value: Title.Dataset) {\n if (this._dataset === value) {\n return;\n }\n this._dataset = value;\n this._changed.emit(undefined);\n }\n\n /**\n * Test whether the title has been disposed.\n */\n get isDisposed(): boolean {\n return this._isDisposed;\n }\n\n /**\n * Dispose of the resources held by the title.\n *\n * #### Notes\n * It is the responsibility of the owner to call the title disposal.\n */\n dispose(): void {\n if (this.isDisposed) {\n return;\n }\n this._isDisposed = true;\n\n Signal.clearData(this);\n }\n\n private _label = '';\n private _caption = '';\n private _mnemonic = -1;\n private _icon: VirtualElement.IRenderer | undefined = undefined;\n private _iconClass = '';\n private _iconLabel = '';\n private _className = '';\n private _closable = false;\n private _dataset: Title.Dataset;\n private _changed = new Signal(this);\n private _isDisposed = false;\n}\n\n/**\n * The namespace for the `Title` class statics.\n */\nexport namespace Title {\n /**\n * A type alias for a simple immutable string dataset.\n */\n export type Dataset = { readonly [key: string]: string };\n\n /**\n * An options object for initializing a title.\n */\n export interface IOptions {\n /**\n * The object which owns the title.\n */\n owner: T;\n\n /**\n * The label for the title.\n */\n label?: string;\n\n /**\n * The mnemonic index for the title.\n */\n mnemonic?: number;\n\n /**\n * The icon renderer for the title.\n */\n icon?: VirtualElement.IRenderer;\n\n /**\n * The icon class name for the title.\n */\n iconClass?: string;\n\n /**\n * The icon label for the title.\n */\n iconLabel?: string;\n\n /**\n * The caption for the title.\n */\n caption?: string;\n\n /**\n * The extra class name for the title.\n */\n className?: string;\n\n /**\n * The closable state for the title.\n */\n closable?: boolean;\n\n /**\n * The dataset for the title.\n */\n dataset?: Dataset;\n }\n}\n","/* eslint-disable @typescript-eslint/no-empty-function */\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { IObservableDisposable } from '@lumino/disposable';\n\nimport {\n ConflatableMessage,\n IMessageHandler,\n Message,\n MessageLoop\n} from '@lumino/messaging';\n\nimport { AttachedProperty } from '@lumino/properties';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { Layout } from './layout';\n\nimport { Title } from './title';\n\n/**\n * The base class of the lumino widget hierarchy.\n *\n * #### Notes\n * This class will typically be subclassed in order to create a useful\n * widget. However, it can be used directly to host externally created\n * content.\n */\nexport class Widget implements IMessageHandler, IObservableDisposable {\n /**\n * Construct a new widget.\n *\n * @param options - The options for initializing the widget.\n */\n constructor(options: Widget.IOptions = {}) {\n this.node = Private.createNode(options);\n this.addClass('lm-Widget');\n }\n\n /**\n * Dispose of the widget and its descendant widgets.\n *\n * #### Notes\n * It is unsafe to use the widget after it has been disposed.\n *\n * All calls made to this method after the first are a no-op.\n */\n dispose(): void {\n // Do nothing if the widget is already disposed.\n if (this.isDisposed) {\n return;\n }\n\n // Set the disposed flag and emit the disposed signal.\n this.setFlag(Widget.Flag.IsDisposed);\n this._disposed.emit(undefined);\n\n // Remove or detach the widget if necessary.\n if (this.parent) {\n this.parent = null;\n } else if (this.isAttached) {\n Widget.detach(this);\n }\n\n // Dispose of the widget layout.\n if (this._layout) {\n this._layout.dispose();\n this._layout = null;\n }\n\n // Dispose the title\n this.title.dispose();\n\n // Clear the extra data associated with the widget.\n Signal.clearData(this);\n MessageLoop.clearData(this);\n AttachedProperty.clearData(this);\n }\n\n /**\n * A signal emitted when the widget is disposed.\n */\n get disposed(): ISignal {\n return this._disposed;\n }\n\n /**\n * Get the DOM node owned by the widget.\n */\n readonly node: HTMLElement;\n\n /**\n * Test whether the widget has been disposed.\n */\n get isDisposed(): boolean {\n return this.testFlag(Widget.Flag.IsDisposed);\n }\n\n /**\n * Test whether the widget's node is attached to the DOM.\n */\n get isAttached(): boolean {\n return this.testFlag(Widget.Flag.IsAttached);\n }\n\n /**\n * Test whether the widget is explicitly hidden.\n *\n * #### Notes\n * You should prefer `!{@link isVisible}` over `{@link isHidden}` if you want to know if the\n * widget is hidden as this does not test if the widget is hidden because one of its ancestors is hidden.\n */\n get isHidden(): boolean {\n return this.testFlag(Widget.Flag.IsHidden);\n }\n\n /**\n * Test whether the widget is visible.\n *\n * #### Notes\n * A widget is visible when it is attached to the DOM, is not\n * explicitly hidden, and has no explicitly hidden ancestors.\n *\n * Since 2.7.0, this does not rely on the {@link Widget.Flag.IsVisible} flag.\n * It recursively checks the visibility of all parent widgets.\n */\n get isVisible(): boolean {\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n let parent: Widget | null = this;\n do {\n if (parent.isHidden || !parent.isAttached) {\n return false;\n }\n parent = parent.parent;\n } while (parent != null);\n return true;\n }\n\n /**\n * The title object for the widget.\n *\n * #### Notes\n * The title object is used by some container widgets when displaying\n * the widget alongside some title, such as a tab panel or side bar.\n *\n * Since not all widgets will use the title, it is created on demand.\n *\n * The `owner` property of the title is set to this widget.\n */\n get title(): Title {\n return Private.titleProperty.get(this);\n }\n\n /**\n * Get the id of the widget's DOM node.\n */\n get id(): string {\n return this.node.id;\n }\n\n /**\n * Set the id of the widget's DOM node.\n */\n set id(value: string) {\n this.node.id = value;\n }\n\n /**\n * The dataset for the widget's DOM node.\n */\n get dataset(): DOMStringMap {\n return this.node.dataset;\n }\n\n /**\n * Get the method for hiding the widget.\n */\n get hiddenMode(): Widget.HiddenMode {\n return this._hiddenMode;\n }\n\n /**\n * Set the method for hiding the widget.\n */\n set hiddenMode(value: Widget.HiddenMode) {\n if (this._hiddenMode === value) {\n return;\n }\n\n if (this.isHidden) {\n // Reset styles set by previous mode.\n this._toggleHidden(false);\n }\n\n if (value == Widget.HiddenMode.Scale) {\n this.node.style.willChange = 'transform';\n } else {\n this.node.style.willChange = 'auto';\n }\n\n this._hiddenMode = value;\n\n if (this.isHidden) {\n // Set styles for new mode.\n this._toggleHidden(true);\n }\n }\n\n /**\n * Get the parent of the widget.\n */\n get parent(): Widget | null {\n return this._parent;\n }\n\n /**\n * Set the parent of the widget.\n *\n * #### Notes\n * Children are typically added to a widget by using a layout, which\n * means user code will not normally set the parent widget directly.\n *\n * The widget will be automatically removed from its old parent.\n *\n * This is a no-op if there is no effective parent change.\n */\n set parent(value: Widget | null) {\n if (this._parent === value) {\n return;\n }\n if (value && this.contains(value)) {\n throw new Error('Invalid parent widget.');\n }\n if (this._parent && !this._parent.isDisposed) {\n let msg = new Widget.ChildMessage('child-removed', this);\n MessageLoop.sendMessage(this._parent, msg);\n }\n this._parent = value;\n if (this._parent && !this._parent.isDisposed) {\n let msg = new Widget.ChildMessage('child-added', this);\n MessageLoop.sendMessage(this._parent, msg);\n }\n if (!this.isDisposed) {\n MessageLoop.sendMessage(this, Widget.Msg.ParentChanged);\n }\n }\n\n /**\n * Get the layout for the widget.\n */\n get layout(): Layout | null {\n return this._layout;\n }\n\n /**\n * Set the layout for the widget.\n *\n * #### Notes\n * The layout is single-use only. It cannot be changed after the\n * first assignment.\n *\n * The layout is disposed automatically when the widget is disposed.\n */\n set layout(value: Layout | null) {\n if (this._layout === value) {\n return;\n }\n if (this.testFlag(Widget.Flag.DisallowLayout)) {\n throw new Error('Cannot set widget layout.');\n }\n if (this._layout) {\n throw new Error('Cannot change widget layout.');\n }\n if (value!.parent) {\n throw new Error('Cannot change layout parent.');\n }\n this._layout = value;\n value!.parent = this;\n }\n\n /**\n * Create an iterator over the widget's children.\n *\n * @returns A new iterator over the children of the widget.\n *\n * #### Notes\n * The widget must have a populated layout in order to have children.\n *\n * If a layout is not installed, the returned iterator will be empty.\n */\n *children(): IterableIterator {\n if (this._layout) {\n yield* this._layout;\n }\n }\n\n /**\n * Test whether a widget is a descendant of this widget.\n *\n * @param widget - The descendant widget of interest.\n *\n * @returns `true` if the widget is a descendant, `false` otherwise.\n */\n contains(widget: Widget): boolean {\n for (let value: Widget | null = widget; value; value = value._parent) {\n if (value === this) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * Test whether the widget's DOM node has the given class name.\n *\n * @param name - The class name of interest.\n *\n * @returns `true` if the node has the class, `false` otherwise.\n */\n hasClass(name: string): boolean {\n return this.node.classList.contains(name);\n }\n\n /**\n * Add a class name to the widget's DOM node.\n *\n * @param name - The class name to add to the node.\n *\n * #### Notes\n * If the class name is already added to the node, this is a no-op.\n *\n * The class name must not contain whitespace.\n */\n addClass(name: string): void {\n this.node.classList.add(name);\n }\n\n /**\n * Remove a class name from the widget's DOM node.\n *\n * @param name - The class name to remove from the node.\n *\n * #### Notes\n * If the class name is not yet added to the node, this is a no-op.\n *\n * The class name must not contain whitespace.\n */\n removeClass(name: string): void {\n this.node.classList.remove(name);\n }\n\n /**\n * Toggle a class name on the widget's DOM node.\n *\n * @param name - The class name to toggle on the node.\n *\n * @param force - Whether to force add the class (`true`) or force\n * remove the class (`false`). If not provided, the presence of\n * the class will be toggled from its current state.\n *\n * @returns `true` if the class is now present, `false` otherwise.\n *\n * #### Notes\n * The class name must not contain whitespace.\n */\n toggleClass(name: string, force?: boolean): boolean {\n if (force === true) {\n this.node.classList.add(name);\n return true;\n }\n if (force === false) {\n this.node.classList.remove(name);\n return false;\n }\n return this.node.classList.toggle(name);\n }\n\n /**\n * Post an `'update-request'` message to the widget.\n *\n * #### Notes\n * This is a simple convenience method for posting the message.\n */\n update(): void {\n MessageLoop.postMessage(this, Widget.Msg.UpdateRequest);\n }\n\n /**\n * Post a `'fit-request'` message to the widget.\n *\n * #### Notes\n * This is a simple convenience method for posting the message.\n */\n fit(): void {\n MessageLoop.postMessage(this, Widget.Msg.FitRequest);\n }\n\n /**\n * Post an `'activate-request'` message to the widget.\n *\n * #### Notes\n * This is a simple convenience method for posting the message.\n */\n activate(): void {\n MessageLoop.postMessage(this, Widget.Msg.ActivateRequest);\n }\n\n /**\n * Send a `'close-request'` message to the widget.\n *\n * #### Notes\n * This is a simple convenience method for sending the message.\n */\n close(): void {\n MessageLoop.sendMessage(this, Widget.Msg.CloseRequest);\n }\n\n /**\n * Show the widget and make it visible to its parent widget.\n *\n * #### Notes\n * This causes the {@link isHidden} property to be `false`.\n *\n * If the widget is not explicitly hidden, this is a no-op.\n */\n show(): void {\n if (!this.testFlag(Widget.Flag.IsHidden)) {\n return;\n }\n if (this.isAttached && (!this.parent || this.parent.isVisible)) {\n MessageLoop.sendMessage(this, Widget.Msg.BeforeShow);\n }\n this.clearFlag(Widget.Flag.IsHidden);\n this._toggleHidden(false);\n\n if (this.isAttached && (!this.parent || this.parent.isVisible)) {\n MessageLoop.sendMessage(this, Widget.Msg.AfterShow);\n }\n if (this.parent) {\n let msg = new Widget.ChildMessage('child-shown', this);\n MessageLoop.sendMessage(this.parent, msg);\n }\n }\n\n /**\n * Hide the widget and make it hidden to its parent widget.\n *\n * #### Notes\n * This causes the {@link isHidden} property to be `true`.\n *\n * If the widget is explicitly hidden, this is a no-op.\n */\n hide(): void {\n if (this.testFlag(Widget.Flag.IsHidden)) {\n return;\n }\n if (this.isAttached && (!this.parent || this.parent.isVisible)) {\n MessageLoop.sendMessage(this, Widget.Msg.BeforeHide);\n }\n this.setFlag(Widget.Flag.IsHidden);\n this._toggleHidden(true);\n\n if (this.isAttached && (!this.parent || this.parent.isVisible)) {\n MessageLoop.sendMessage(this, Widget.Msg.AfterHide);\n }\n if (this.parent) {\n let msg = new Widget.ChildMessage('child-hidden', this);\n MessageLoop.sendMessage(this.parent, msg);\n }\n }\n\n /**\n * Show or hide the widget according to a boolean value.\n *\n * @param hidden - `true` to hide the widget, or `false` to show it.\n *\n * #### Notes\n * This is a convenience method for `hide()` and `show()`.\n */\n setHidden(hidden: boolean): void {\n if (hidden) {\n this.hide();\n } else {\n this.show();\n }\n }\n\n /**\n * Test whether the given widget flag is set.\n *\n * #### Notes\n * This will not typically be called directly by user code.\n *\n * Since 2.7.0, {@link Widget.Flag.IsVisible} is deprecated.\n * It will be removed in a future version.\n */\n testFlag(flag: Widget.Flag): boolean {\n return (this._flags & flag) !== 0;\n }\n\n /**\n * Set the given widget flag.\n *\n * #### Notes\n * This will not typically be called directly by user code.\n *\n * Since 2.7.0, {@link Widget.Flag.IsVisible} is deprecated.\n * It will be removed in a future version.\n */\n setFlag(flag: Widget.Flag): void {\n this._flags |= flag;\n }\n\n /**\n * Clear the given widget flag.\n *\n * #### Notes\n * This will not typically be called directly by user code.\n *\n * Since 2.7.0, {@link Widget.Flag.IsVisible} is deprecated.\n * It will be removed in a future version.\n */\n clearFlag(flag: Widget.Flag): void {\n this._flags &= ~flag;\n }\n\n /**\n * Process a message sent to the widget.\n *\n * @param msg - The message sent to the widget.\n *\n * #### Notes\n * Subclasses may reimplement this method as needed.\n */\n processMessage(msg: Message): void {\n switch (msg.type) {\n case 'resize':\n this.notifyLayout(msg);\n this.onResize(msg as Widget.ResizeMessage);\n break;\n case 'update-request':\n this.notifyLayout(msg);\n this.onUpdateRequest(msg);\n break;\n case 'fit-request':\n this.notifyLayout(msg);\n this.onFitRequest(msg);\n break;\n case 'before-show':\n this.notifyLayout(msg);\n this.onBeforeShow(msg);\n break;\n case 'after-show':\n this.setFlag(Widget.Flag.IsVisible);\n this.notifyLayout(msg);\n this.onAfterShow(msg);\n break;\n case 'before-hide':\n this.notifyLayout(msg);\n this.onBeforeHide(msg);\n break;\n case 'after-hide':\n this.clearFlag(Widget.Flag.IsVisible);\n this.notifyLayout(msg);\n this.onAfterHide(msg);\n break;\n case 'before-attach':\n this.notifyLayout(msg);\n this.onBeforeAttach(msg);\n break;\n case 'after-attach':\n if (!this.isHidden && (!this.parent || this.parent.isVisible)) {\n this.setFlag(Widget.Flag.IsVisible);\n }\n this.setFlag(Widget.Flag.IsAttached);\n this.notifyLayout(msg);\n this.onAfterAttach(msg);\n break;\n case 'before-detach':\n this.notifyLayout(msg);\n this.onBeforeDetach(msg);\n break;\n case 'after-detach':\n this.clearFlag(Widget.Flag.IsVisible);\n this.clearFlag(Widget.Flag.IsAttached);\n this.notifyLayout(msg);\n this.onAfterDetach(msg);\n break;\n case 'activate-request':\n this.notifyLayout(msg);\n this.onActivateRequest(msg);\n break;\n case 'close-request':\n this.notifyLayout(msg);\n this.onCloseRequest(msg);\n break;\n case 'child-added':\n this.notifyLayout(msg);\n this.onChildAdded(msg as Widget.ChildMessage);\n break;\n case 'child-removed':\n this.notifyLayout(msg);\n this.onChildRemoved(msg as Widget.ChildMessage);\n break;\n default:\n this.notifyLayout(msg);\n break;\n }\n }\n\n /**\n * Invoke the message processing routine of the widget's layout.\n *\n * @param msg - The message to dispatch to the layout.\n *\n * #### Notes\n * This is a no-op if the widget does not have a layout.\n *\n * This will not typically be called directly by user code.\n */\n protected notifyLayout(msg: Message): void {\n if (this._layout) {\n this._layout.processParentMessage(msg);\n }\n }\n\n /**\n * A message handler invoked on a `'close-request'` message.\n *\n * #### Notes\n * The default implementation unparents or detaches the widget.\n */\n protected onCloseRequest(msg: Message): void {\n if (this.parent) {\n this.parent = null;\n } else if (this.isAttached) {\n Widget.detach(this);\n }\n }\n\n /**\n * A message handler invoked on a `'resize'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onResize(msg: Widget.ResizeMessage): void {}\n\n /**\n * A message handler invoked on an `'update-request'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onUpdateRequest(msg: Message): void {}\n\n /**\n * A message handler invoked on a `'fit-request'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onFitRequest(msg: Message): void {}\n\n /**\n * A message handler invoked on an `'activate-request'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onActivateRequest(msg: Message): void {}\n\n /**\n * A message handler invoked on a `'before-show'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onBeforeShow(msg: Message): void {}\n\n /**\n * A message handler invoked on an `'after-show'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onAfterShow(msg: Message): void {}\n\n /**\n * A message handler invoked on a `'before-hide'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onBeforeHide(msg: Message): void {}\n\n /**\n * A message handler invoked on an `'after-hide'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onAfterHide(msg: Message): void {}\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onBeforeAttach(msg: Message): void {}\n\n /**\n * A message handler invoked on an `'after-attach'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onAfterAttach(msg: Message): void {}\n\n /**\n * A message handler invoked on a `'before-detach'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onBeforeDetach(msg: Message): void {}\n\n /**\n * A message handler invoked on an `'after-detach'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onAfterDetach(msg: Message): void {}\n\n /**\n * A message handler invoked on a `'child-added'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onChildAdded(msg: Widget.ChildMessage): void {}\n\n /**\n * A message handler invoked on a `'child-removed'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onChildRemoved(msg: Widget.ChildMessage): void {}\n\n private _toggleHidden(hidden: boolean) {\n if (hidden) {\n switch (this._hiddenMode) {\n case Widget.HiddenMode.Display:\n this.addClass('lm-mod-hidden');\n break;\n case Widget.HiddenMode.Scale:\n this.node.style.transform = 'scale(0)';\n this.node.setAttribute('aria-hidden', 'true');\n break;\n case Widget.HiddenMode.ContentVisibility:\n // @ts-expect-error content-visibility unknown by DOM lib types\n this.node.style.contentVisibility = 'hidden';\n this.node.style.zIndex = '-1';\n break;\n }\n } else {\n switch (this._hiddenMode) {\n case Widget.HiddenMode.Display:\n this.removeClass('lm-mod-hidden');\n break;\n case Widget.HiddenMode.Scale:\n this.node.style.transform = '';\n this.node.removeAttribute('aria-hidden');\n break;\n case Widget.HiddenMode.ContentVisibility:\n // @ts-expect-error content-visibility unknown by DOM lib types\n this.node.style.contentVisibility = '';\n this.node.style.zIndex = '';\n break;\n }\n }\n }\n\n private _flags = 0;\n private _layout: Layout | null = null;\n private _parent: Widget | null = null;\n private _disposed = new Signal(this);\n private _hiddenMode: Widget.HiddenMode = Widget.HiddenMode.Display;\n}\n\n/**\n * The namespace for the `Widget` class statics.\n */\nexport namespace Widget {\n /**\n * An options object for initializing a widget.\n */\n export interface IOptions {\n /**\n * The optional node to use for the widget.\n *\n * If a node is provided, the widget will assume full ownership\n * and control of the node, as if it had created the node itself.\n *\n * The default is a new `
`.\n */\n node?: HTMLElement;\n\n /**\n * The optional element tag, used for constructing the widget's node.\n *\n * If a pre-constructed node is provided via the `node` arg, this\n * value is ignored.\n */\n tag?: keyof HTMLElementTagNameMap;\n }\n\n /**\n * The method for hiding the widget.\n *\n * The default is Display.\n *\n * Using `Scale` will often increase performance as most browsers will not\n * trigger style computation for the `transform` action. This should be used\n * sparingly and tested, since increasing the number of composition layers\n * may slow things down.\n *\n * To ensure the transformation does not trigger style recomputation, you\n * may need to set the widget CSS style `will-change: transform`. This\n * should be used only when needed as it may overwhelm the browser with a\n * high number of layers. See\n * https://developer.mozilla.org/en-US/docs/Web/CSS/will-change\n */\n export enum HiddenMode {\n /**\n * Set a `lm-mod-hidden` CSS class to hide the widget using `display:none`\n * CSS from the standard Lumino CSS.\n */\n Display = 0,\n\n /**\n * Hide the widget by setting the `transform` to `'scale(0)'`.\n */\n Scale,\n\n /**\n *Hide the widget by setting the `content-visibility` to `'hidden'`.\n */\n ContentVisibility\n }\n\n /**\n * An enum of widget bit flags.\n */\n export enum Flag {\n /**\n * The widget has been disposed.\n */\n IsDisposed = 0x1,\n\n /**\n * The widget is attached to the DOM.\n */\n IsAttached = 0x2,\n\n /**\n * The widget is hidden.\n */\n IsHidden = 0x4,\n\n /**\n * The widget is visible.\n *\n * @deprecated since 2.7.0, apply that flag consistently was not reliable\n * so it was dropped in favor of a recursive check of the visibility of all parents.\n */\n IsVisible = 0x8,\n\n /**\n * A layout cannot be set on the widget.\n */\n DisallowLayout = 0x10\n }\n\n /**\n * A collection of stateless messages related to widgets.\n */\n export namespace Msg {\n /**\n * A singleton `'before-show'` message.\n *\n * #### Notes\n * This message is sent to a widget before it becomes visible.\n *\n * This message is **not** sent when the widget is being attached.\n */\n export const BeforeShow = new Message('before-show');\n\n /**\n * A singleton `'after-show'` message.\n *\n * #### Notes\n * This message is sent to a widget after it becomes visible.\n *\n * This message is **not** sent when the widget is being attached.\n */\n export const AfterShow = new Message('after-show');\n\n /**\n * A singleton `'before-hide'` message.\n *\n * #### Notes\n * This message is sent to a widget before it becomes not-visible.\n *\n * This message is **not** sent when the widget is being detached.\n */\n export const BeforeHide = new Message('before-hide');\n\n /**\n * A singleton `'after-hide'` message.\n *\n * #### Notes\n * This message is sent to a widget after it becomes not-visible.\n *\n * This message is **not** sent when the widget is being detached.\n */\n export const AfterHide = new Message('after-hide');\n\n /**\n * A singleton `'before-attach'` message.\n *\n * #### Notes\n * This message is sent to a widget before it is attached.\n */\n export const BeforeAttach = new Message('before-attach');\n\n /**\n * A singleton `'after-attach'` message.\n *\n * #### Notes\n * This message is sent to a widget after it is attached.\n */\n export const AfterAttach = new Message('after-attach');\n\n /**\n * A singleton `'before-detach'` message.\n *\n * #### Notes\n * This message is sent to a widget before it is detached.\n */\n export const BeforeDetach = new Message('before-detach');\n\n /**\n * A singleton `'after-detach'` message.\n *\n * #### Notes\n * This message is sent to a widget after it is detached.\n */\n export const AfterDetach = new Message('after-detach');\n\n /**\n * A singleton `'parent-changed'` message.\n *\n * #### Notes\n * This message is sent to a widget when its parent has changed.\n */\n export const ParentChanged = new Message('parent-changed');\n\n /**\n * A singleton conflatable `'update-request'` message.\n *\n * #### Notes\n * This message can be dispatched to supporting widgets in order to\n * update their content based on the current widget state. Not all\n * widgets will respond to messages of this type.\n *\n * For widgets with a layout, this message will inform the layout to\n * update the position and size of its child widgets.\n */\n export const UpdateRequest = new ConflatableMessage('update-request');\n\n /**\n * A singleton conflatable `'fit-request'` message.\n *\n * #### Notes\n * For widgets with a layout, this message will inform the layout to\n * recalculate its size constraints to fit the space requirements of\n * its child widgets, and to update their position and size. Not all\n * layouts will respond to messages of this type.\n */\n export const FitRequest = new ConflatableMessage('fit-request');\n\n /**\n * A singleton conflatable `'activate-request'` message.\n *\n * #### Notes\n * This message should be dispatched to a widget when it should\n * perform the actions necessary to activate the widget, which\n * may include focusing its node or descendant node.\n */\n export const ActivateRequest = new ConflatableMessage('activate-request');\n\n /**\n * A singleton conflatable `'close-request'` message.\n *\n * #### Notes\n * This message should be dispatched to a widget when it should close\n * and remove itself from the widget hierarchy.\n */\n export const CloseRequest = new ConflatableMessage('close-request');\n }\n\n /**\n * A message class for child related messages.\n */\n export class ChildMessage extends Message {\n /**\n * Construct a new child message.\n *\n * @param type - The message type.\n *\n * @param child - The child widget for the message.\n */\n constructor(type: string, child: Widget) {\n super(type);\n this.child = child;\n }\n\n /**\n * The child widget for the message.\n */\n readonly child: Widget;\n }\n\n /**\n * A message class for `'resize'` messages.\n */\n export class ResizeMessage extends Message {\n /**\n * Construct a new resize message.\n *\n * @param width - The **offset width** of the widget, or `-1` if\n * the width is not known.\n *\n * @param height - The **offset height** of the widget, or `-1` if\n * the height is not known.\n */\n constructor(width: number, height: number) {\n super('resize');\n this.width = width;\n this.height = height;\n }\n\n /**\n * The offset width of the widget.\n *\n * #### Notes\n * This will be `-1` if the width is unknown.\n */\n readonly width: number;\n\n /**\n * The offset height of the widget.\n *\n * #### Notes\n * This will be `-1` if the height is unknown.\n */\n readonly height: number;\n }\n\n /**\n * The namespace for the `ResizeMessage` class statics.\n */\n export namespace ResizeMessage {\n /**\n * A singleton `'resize'` message with an unknown size.\n */\n export const UnknownSize = new ResizeMessage(-1, -1);\n }\n\n /**\n * Attach a widget to a host DOM node.\n *\n * @param widget - The widget of interest.\n *\n * @param host - The DOM node to use as the widget's host.\n *\n * @param ref - The child of `host` to use as the reference element.\n * If this is provided, the widget will be inserted before this\n * node in the host. The default is `null`, which will cause the\n * widget to be added as the last child of the host.\n *\n * #### Notes\n * This will throw an error if the widget is not a root widget, if\n * the widget is already attached, or if the host is not attached\n * to the DOM.\n */\n export function attach(\n widget: Widget,\n host: HTMLElement,\n ref: HTMLElement | null = null\n ): void {\n if (widget.parent) {\n throw new Error('Cannot attach a child widget.');\n }\n if (widget.isAttached || widget.node.isConnected) {\n throw new Error('Widget is already attached.');\n }\n if (!host.isConnected) {\n throw new Error('Host is not attached.');\n }\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n host.insertBefore(widget.node, ref);\n MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n\n /**\n * Detach the widget from its host DOM node.\n *\n * @param widget - The widget of interest.\n *\n * #### Notes\n * This will throw an error if the widget is not a root widget,\n * or if the widget is not attached to the DOM.\n */\n export function detach(widget: Widget): void {\n if (widget.parent) {\n throw new Error('Cannot detach a child widget.');\n }\n if (!widget.isAttached || !widget.node.isConnected) {\n throw new Error('Widget is not attached.');\n }\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n widget.node.parentNode!.removeChild(widget.node);\n MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * An attached property for the widget title object.\n */\n export const titleProperty = new AttachedProperty>({\n name: 'title',\n create: owner => new Title({ owner })\n });\n\n /**\n * Create a DOM node for the given widget options.\n */\n export function createNode(options: Widget.IOptions): HTMLElement {\n return options.node || document.createElement(options.tag || 'div');\n }\n}\n","/* eslint-disable @typescript-eslint/no-empty-function */\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { IDisposable } from '@lumino/disposable';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { AttachedProperty } from '@lumino/properties';\n\nimport { Signal } from '@lumino/signaling';\n\nimport { Widget } from './widget';\n\n/**\n * An abstract base class for creating lumino layouts.\n *\n * #### Notes\n * A layout is used to add widgets to a parent and to arrange those\n * widgets within the parent's DOM node.\n *\n * This class implements the base functionality which is required of\n * nearly all layouts. It must be subclassed in order to be useful.\n *\n * Notably, this class does not define a uniform interface for adding\n * widgets to the layout. A subclass should define that API in a way\n * which is meaningful for its intended use.\n */\nexport abstract class Layout implements Iterable, IDisposable {\n /**\n * Construct a new layout.\n *\n * @param options - The options for initializing the layout.\n */\n constructor(options: Layout.IOptions = {}) {\n this._fitPolicy = options.fitPolicy || 'set-min-size';\n }\n\n /**\n * Dispose of the resources held by the layout.\n *\n * #### Notes\n * This should be reimplemented to clear and dispose of the widgets.\n *\n * All reimplementations should call the superclass method.\n *\n * This method is called automatically when the parent is disposed.\n */\n dispose(): void {\n this._parent = null;\n this._disposed = true;\n Signal.clearData(this);\n AttachedProperty.clearData(this);\n }\n\n /**\n * Test whether the layout is disposed.\n */\n get isDisposed(): boolean {\n return this._disposed;\n }\n\n /**\n * Get the parent widget of the layout.\n */\n get parent(): Widget | null {\n return this._parent;\n }\n\n /**\n * Set the parent widget of the layout.\n *\n * #### Notes\n * This is set automatically when installing the layout on the parent\n * widget. The parent widget should not be set directly by user code.\n */\n set parent(value: Widget | null) {\n if (this._parent === value) {\n return;\n }\n if (this._parent) {\n throw new Error('Cannot change parent widget.');\n }\n if (value!.layout !== this) {\n throw new Error('Invalid parent widget.');\n }\n this._parent = value;\n this.init();\n }\n\n /**\n * Get the fit policy for the layout.\n *\n * #### Notes\n * The fit policy controls the computed size constraints which are\n * applied to the parent widget by the layout.\n *\n * Some layout implementations may ignore the fit policy.\n */\n get fitPolicy(): Layout.FitPolicy {\n return this._fitPolicy;\n }\n\n /**\n * Set the fit policy for the layout.\n *\n * #### Notes\n * The fit policy controls the computed size constraints which are\n * applied to the parent widget by the layout.\n *\n * Some layout implementations may ignore the fit policy.\n *\n * Changing the fit policy will clear the current size constraint\n * for the parent widget and then re-fit the parent.\n */\n set fitPolicy(value: Layout.FitPolicy) {\n // Bail if the policy does not change\n if (this._fitPolicy === value) {\n return;\n }\n\n // Update the internal policy.\n this._fitPolicy = value;\n\n // Clear the size constraints and schedule a fit of the parent.\n if (this._parent) {\n let style = this._parent.node.style;\n style.minWidth = '';\n style.minHeight = '';\n style.maxWidth = '';\n style.maxHeight = '';\n this._parent.fit();\n }\n }\n\n /**\n * Create an iterator over the widgets in the layout.\n *\n * @returns A new iterator over the widgets in the layout.\n *\n * #### Notes\n * This abstract method must be implemented by a subclass.\n */\n abstract [Symbol.iterator](): IterableIterator;\n\n /**\n * Remove a widget from the layout.\n *\n * @param widget - The widget to remove from the layout.\n *\n * #### Notes\n * A widget is automatically removed from the layout when its `parent`\n * is set to `null`. This method should only be invoked directly when\n * removing a widget from a layout which has yet to be installed on a\n * parent widget.\n *\n * This method should *not* modify the widget's `parent`.\n */\n abstract removeWidget(widget: Widget): void;\n\n /**\n * Process a message sent to the parent widget.\n *\n * @param msg - The message sent to the parent widget.\n *\n * #### Notes\n * This method is called by the parent widget to process a message.\n *\n * Subclasses may reimplement this method as needed.\n */\n processParentMessage(msg: Message): void {\n switch (msg.type) {\n case 'resize':\n this.onResize(msg as Widget.ResizeMessage);\n break;\n case 'update-request':\n this.onUpdateRequest(msg);\n break;\n case 'fit-request':\n this.onFitRequest(msg);\n break;\n case 'before-show':\n this.onBeforeShow(msg);\n break;\n case 'after-show':\n this.onAfterShow(msg);\n break;\n case 'before-hide':\n this.onBeforeHide(msg);\n break;\n case 'after-hide':\n this.onAfterHide(msg);\n break;\n case 'before-attach':\n this.onBeforeAttach(msg);\n break;\n case 'after-attach':\n this.onAfterAttach(msg);\n break;\n case 'before-detach':\n this.onBeforeDetach(msg);\n break;\n case 'after-detach':\n this.onAfterDetach(msg);\n break;\n case 'child-removed':\n this.onChildRemoved(msg as Widget.ChildMessage);\n break;\n case 'child-shown':\n this.onChildShown(msg as Widget.ChildMessage);\n break;\n case 'child-hidden':\n this.onChildHidden(msg as Widget.ChildMessage);\n break;\n }\n }\n\n /**\n * Perform layout initialization which requires the parent widget.\n *\n * #### Notes\n * This method is invoked immediately after the layout is installed\n * on the parent widget.\n *\n * The default implementation reparents all of the widgets to the\n * layout parent widget.\n *\n * Subclasses should reimplement this method and attach the child\n * widget nodes to the parent widget's node.\n */\n protected init(): void {\n for (const widget of this) {\n widget.parent = this.parent;\n }\n }\n\n /**\n * A message handler invoked on a `'resize'` message.\n *\n * #### Notes\n * The layout should ensure that its widgets are resized according\n * to the specified layout space, and that they are sent a `'resize'`\n * message if appropriate.\n *\n * The default implementation of this method sends an `UnknownSize`\n * resize message to all widgets.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onResize(msg: Widget.ResizeMessage): void {\n for (const widget of this) {\n MessageLoop.sendMessage(widget, Widget.ResizeMessage.UnknownSize);\n }\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n *\n * #### Notes\n * The layout should ensure that its widgets are resized according\n * to the available layout space, and that they are sent a `'resize'`\n * message if appropriate.\n *\n * The default implementation of this method sends an `UnknownSize`\n * resize message to all widgets.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onUpdateRequest(msg: Message): void {\n for (const widget of this) {\n MessageLoop.sendMessage(widget, Widget.ResizeMessage.UnknownSize);\n }\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n *\n * #### Notes\n * The default implementation of this method forwards the message\n * to all widgets. It assumes all widget nodes are attached to the\n * parent widget node.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onBeforeAttach(msg: Message): void {\n for (const widget of this) {\n MessageLoop.sendMessage(widget, msg);\n }\n }\n\n /**\n * A message handler invoked on an `'after-attach'` message.\n *\n * #### Notes\n * The default implementation of this method forwards the message\n * to all widgets. It assumes all widget nodes are attached to the\n * parent widget node.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onAfterAttach(msg: Message): void {\n for (const widget of this) {\n MessageLoop.sendMessage(widget, msg);\n }\n }\n\n /**\n * A message handler invoked on a `'before-detach'` message.\n *\n * #### Notes\n * The default implementation of this method forwards the message\n * to all widgets. It assumes all widget nodes are attached to the\n * parent widget node.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onBeforeDetach(msg: Message): void {\n for (const widget of this) {\n MessageLoop.sendMessage(widget, msg);\n }\n }\n\n /**\n * A message handler invoked on an `'after-detach'` message.\n *\n * #### Notes\n * The default implementation of this method forwards the message\n * to all widgets. It assumes all widget nodes are attached to the\n * parent widget node.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onAfterDetach(msg: Message): void {\n for (const widget of this) {\n MessageLoop.sendMessage(widget, msg);\n }\n }\n\n /**\n * A message handler invoked on a `'before-show'` message.\n *\n * #### Notes\n * The default implementation of this method forwards the message to\n * all non-hidden widgets. It assumes all widget nodes are attached\n * to the parent widget node.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onBeforeShow(msg: Message): void {\n for (const widget of this) {\n if (!widget.isHidden) {\n MessageLoop.sendMessage(widget, msg);\n }\n }\n }\n\n /**\n * A message handler invoked on an `'after-show'` message.\n *\n * #### Notes\n * The default implementation of this method forwards the message to\n * all non-hidden widgets. It assumes all widget nodes are attached\n * to the parent widget node.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onAfterShow(msg: Message): void {\n for (const widget of this) {\n if (!widget.isHidden) {\n MessageLoop.sendMessage(widget, msg);\n }\n }\n }\n\n /**\n * A message handler invoked on a `'before-hide'` message.\n *\n * #### Notes\n * The default implementation of this method forwards the message to\n * all non-hidden widgets. It assumes all widget nodes are attached\n * to the parent widget node.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onBeforeHide(msg: Message): void {\n for (const widget of this) {\n if (!widget.isHidden) {\n MessageLoop.sendMessage(widget, msg);\n }\n }\n }\n\n /**\n * A message handler invoked on an `'after-hide'` message.\n *\n * #### Notes\n * The default implementation of this method forwards the message to\n * all non-hidden widgets. It assumes all widget nodes are attached\n * to the parent widget node.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onAfterHide(msg: Message): void {\n for (const widget of this) {\n if (!widget.isHidden) {\n MessageLoop.sendMessage(widget, msg);\n }\n }\n }\n\n /**\n * A message handler invoked on a `'child-removed'` message.\n *\n * #### Notes\n * This will remove the child widget from the layout.\n *\n * Subclasses should **not** typically reimplement this method.\n */\n protected onChildRemoved(msg: Widget.ChildMessage): void {\n this.removeWidget(msg.child);\n }\n\n /**\n * A message handler invoked on a `'fit-request'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onFitRequest(msg: Message): void {}\n\n /**\n * A message handler invoked on a `'child-shown'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onChildShown(msg: Widget.ChildMessage): void {}\n\n /**\n * A message handler invoked on a `'child-hidden'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onChildHidden(msg: Widget.ChildMessage): void {}\n\n private _disposed = false;\n private _fitPolicy: Layout.FitPolicy;\n private _parent: Widget | null = null;\n}\n\n/**\n * The namespace for the `Layout` class statics.\n */\nexport namespace Layout {\n /**\n * A type alias for the layout fit policy.\n *\n * #### Notes\n * The fit policy controls the computed size constraints which are\n * applied to the parent widget by the layout.\n *\n * Some layout implementations may ignore the fit policy.\n */\n export type FitPolicy =\n | /**\n * No size constraint will be applied to the parent widget.\n */\n 'set-no-constraint'\n\n /**\n * The computed min size will be applied to the parent widget.\n */\n | 'set-min-size';\n\n /**\n * An options object for initializing a layout.\n */\n export interface IOptions {\n /**\n * The fit policy for the layout.\n *\n * The default is `'set-min-size'`.\n */\n fitPolicy?: FitPolicy;\n }\n\n /**\n * A type alias for the horizontal alignment of a widget.\n */\n export type HorizontalAlignment = 'left' | 'center' | 'right';\n\n /**\n * A type alias for the vertical alignment of a widget.\n */\n export type VerticalAlignment = 'top' | 'center' | 'bottom';\n\n /**\n * Get the horizontal alignment for a widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The horizontal alignment for the widget.\n *\n * #### Notes\n * If the layout width allocated to a widget is larger than its max\n * width, the horizontal alignment controls how the widget is placed\n * within the extra horizontal space.\n *\n * If the allocated width is less than the widget's max width, the\n * horizontal alignment has no effect.\n *\n * Some layout implementations may ignore horizontal alignment.\n */\n export function getHorizontalAlignment(widget: Widget): HorizontalAlignment {\n return Private.horizontalAlignmentProperty.get(widget);\n }\n\n /**\n * Set the horizontal alignment for a widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the horizontal alignment.\n *\n * #### Notes\n * If the layout width allocated to a widget is larger than its max\n * width, the horizontal alignment controls how the widget is placed\n * within the extra horizontal space.\n *\n * If the allocated width is less than the widget's max width, the\n * horizontal alignment has no effect.\n *\n * Some layout implementations may ignore horizontal alignment.\n *\n * Changing the horizontal alignment will post an `update-request`\n * message to widget's parent, provided the parent has a layout\n * installed.\n */\n export function setHorizontalAlignment(\n widget: Widget,\n value: HorizontalAlignment\n ): void {\n Private.horizontalAlignmentProperty.set(widget, value);\n }\n\n /**\n * Get the vertical alignment for a widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The vertical alignment for the widget.\n *\n * #### Notes\n * If the layout height allocated to a widget is larger than its max\n * height, the vertical alignment controls how the widget is placed\n * within the extra vertical space.\n *\n * If the allocated height is less than the widget's max height, the\n * vertical alignment has no effect.\n *\n * Some layout implementations may ignore vertical alignment.\n */\n export function getVerticalAlignment(widget: Widget): VerticalAlignment {\n return Private.verticalAlignmentProperty.get(widget);\n }\n\n /**\n * Set the vertical alignment for a widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the vertical alignment.\n *\n * #### Notes\n * If the layout height allocated to a widget is larger than its max\n * height, the vertical alignment controls how the widget is placed\n * within the extra vertical space.\n *\n * If the allocated height is less than the widget's max height, the\n * vertical alignment has no effect.\n *\n * Some layout implementations may ignore vertical alignment.\n *\n * Changing the horizontal alignment will post an `update-request`\n * message to widget's parent, provided the parent has a layout\n * installed.\n */\n export function setVerticalAlignment(\n widget: Widget,\n value: VerticalAlignment\n ): void {\n Private.verticalAlignmentProperty.set(widget, value);\n }\n}\n\n/**\n * An object which assists in the absolute layout of widgets.\n *\n * #### Notes\n * This class is useful when implementing a layout which arranges its\n * widgets using absolute positioning.\n *\n * This class is used by nearly all of the built-in lumino layouts.\n */\nexport class LayoutItem implements IDisposable {\n /**\n * Construct a new layout item.\n *\n * @param widget - The widget to be managed by the item.\n *\n * #### Notes\n * The widget will be set to absolute positioning.\n * The widget will use strict CSS containment.\n */\n constructor(widget: Widget) {\n this.widget = widget;\n this.widget.node.style.position = 'absolute';\n this.widget.node.style.contain = 'strict';\n }\n\n /**\n * Dispose of the the layout item.\n *\n * #### Notes\n * This will reset the positioning of the widget.\n */\n dispose(): void {\n // Do nothing if the item is already disposed.\n if (this._disposed) {\n return;\n }\n\n // Mark the item as disposed.\n this._disposed = true;\n\n // Reset the widget style.\n let style = this.widget.node.style;\n style.position = '';\n style.top = '';\n style.left = '';\n style.width = '';\n style.height = '';\n style.contain = '';\n }\n\n /**\n * The widget managed by the layout item.\n */\n readonly widget: Widget;\n\n /**\n * The computed minimum width of the widget.\n *\n * #### Notes\n * This value can be updated by calling the `fit` method.\n */\n get minWidth(): number {\n return this._minWidth;\n }\n\n /**\n * The computed minimum height of the widget.\n *\n * #### Notes\n * This value can be updated by calling the `fit` method.\n */\n get minHeight(): number {\n return this._minHeight;\n }\n\n /**\n * The computed maximum width of the widget.\n *\n * #### Notes\n * This value can be updated by calling the `fit` method.\n */\n get maxWidth(): number {\n return this._maxWidth;\n }\n\n /**\n * The computed maximum height of the widget.\n *\n * #### Notes\n * This value can be updated by calling the `fit` method.\n */\n get maxHeight(): number {\n return this._maxHeight;\n }\n\n /**\n * Whether the layout item is disposed.\n */\n get isDisposed(): boolean {\n return this._disposed;\n }\n\n /**\n * Whether the managed widget is hidden.\n */\n get isHidden(): boolean {\n return this.widget.isHidden;\n }\n\n /**\n * Whether the managed widget is visible.\n */\n get isVisible(): boolean {\n return this.widget.isVisible;\n }\n\n /**\n * Whether the managed widget is attached.\n */\n get isAttached(): boolean {\n return this.widget.isAttached;\n }\n\n /**\n * Update the computed size limits of the managed widget.\n */\n fit(): void {\n let limits = ElementExt.sizeLimits(this.widget.node);\n this._minWidth = limits.minWidth;\n this._minHeight = limits.minHeight;\n this._maxWidth = limits.maxWidth;\n this._maxHeight = limits.maxHeight;\n }\n\n /**\n * Update the position and size of the managed widget.\n *\n * @param left - The left edge position of the layout box.\n *\n * @param top - The top edge position of the layout box.\n *\n * @param width - The width of the layout box.\n *\n * @param height - The height of the layout box.\n */\n update(left: number, top: number, width: number, height: number): void {\n // Clamp the size to the computed size limits.\n let clampW = Math.max(this._minWidth, Math.min(width, this._maxWidth));\n let clampH = Math.max(this._minHeight, Math.min(height, this._maxHeight));\n\n // Adjust the left edge for the horizontal alignment, if needed.\n if (clampW < width) {\n switch (Layout.getHorizontalAlignment(this.widget)) {\n case 'left':\n break;\n case 'center':\n left += (width - clampW) / 2;\n break;\n case 'right':\n left += width - clampW;\n break;\n default:\n throw 'unreachable';\n }\n }\n\n // Adjust the top edge for the vertical alignment, if needed.\n if (clampH < height) {\n switch (Layout.getVerticalAlignment(this.widget)) {\n case 'top':\n break;\n case 'center':\n top += (height - clampH) / 2;\n break;\n case 'bottom':\n top += height - clampH;\n break;\n default:\n throw 'unreachable';\n }\n }\n\n // Set up the resize variables.\n let resized = false;\n let style = this.widget.node.style;\n\n // Update the top edge of the widget if needed.\n if (this._top !== top) {\n this._top = top;\n style.top = `${top}px`;\n }\n\n // Update the left edge of the widget if needed.\n if (this._left !== left) {\n this._left = left;\n style.left = `${left}px`;\n }\n\n // Update the width of the widget if needed.\n if (this._width !== clampW) {\n resized = true;\n this._width = clampW;\n style.width = `${clampW}px`;\n }\n\n // Update the height of the widget if needed.\n if (this._height !== clampH) {\n resized = true;\n this._height = clampH;\n style.height = `${clampH}px`;\n }\n\n // Send a resize message to the widget if needed.\n if (resized) {\n let msg = new Widget.ResizeMessage(clampW, clampH);\n MessageLoop.sendMessage(this.widget, msg);\n }\n }\n\n private _top = NaN;\n private _left = NaN;\n private _width = NaN;\n private _height = NaN;\n private _minWidth = 0;\n private _minHeight = 0;\n private _maxWidth = Infinity;\n private _maxHeight = Infinity;\n private _disposed = false;\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * The attached property for a widget horizontal alignment.\n */\n export const horizontalAlignmentProperty = new AttachedProperty<\n Widget,\n Layout.HorizontalAlignment\n >({\n name: 'horizontalAlignment',\n create: () => 'center',\n changed: onAlignmentChanged\n });\n\n /**\n * The attached property for a widget vertical alignment.\n */\n export const verticalAlignmentProperty = new AttachedProperty<\n Widget,\n Layout.VerticalAlignment\n >({\n name: 'verticalAlignment',\n create: () => 'top',\n changed: onAlignmentChanged\n });\n\n /**\n * The change handler for the attached alignment properties.\n */\n function onAlignmentChanged(child: Widget): void {\n if (child.parent && child.parent.layout) {\n child.parent.update();\n }\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { MessageLoop } from '@lumino/messaging';\n\nimport { Layout } from './layout';\n\nimport { Widget } from './widget';\n\n/**\n * A concrete layout implementation suitable for many use cases.\n *\n * #### Notes\n * This class is suitable as a base class for implementing a variety of\n * layouts, but can also be used directly with standard CSS to layout a\n * collection of widgets.\n */\nexport class PanelLayout extends Layout {\n /**\n * Dispose of the resources held by the layout.\n *\n * #### Notes\n * This will clear and dispose all widgets in the layout.\n *\n * All reimplementations should call the superclass method.\n *\n * This method is called automatically when the parent is disposed.\n */\n dispose(): void {\n while (this._widgets.length > 0) {\n this._widgets.pop()!.dispose();\n }\n super.dispose();\n }\n\n /**\n * A read-only array of the widgets in the layout.\n */\n get widgets(): ReadonlyArray {\n return this._widgets;\n }\n\n /**\n * Create an iterator over the widgets in the layout.\n *\n * @returns A new iterator over the widgets in the layout.\n */\n *[Symbol.iterator](): IterableIterator {\n yield* this._widgets;\n }\n\n /**\n * Add a widget to the end of the layout.\n *\n * @param widget - The widget to add to the layout.\n *\n * #### Notes\n * If the widget is already contained in the layout, it will be moved.\n */\n addWidget(widget: Widget): void {\n this.insertWidget(this._widgets.length, widget);\n }\n\n /**\n * Insert a widget into the layout at the specified index.\n *\n * @param index - The index at which to insert the widget.\n *\n * @param widget - The widget to insert into the layout.\n *\n * #### Notes\n * The index will be clamped to the bounds of the widgets.\n *\n * If the widget is already added to the layout, it will be moved.\n *\n * #### Undefined Behavior\n * An `index` which is non-integral.\n */\n insertWidget(index: number, widget: Widget): void {\n // Remove the widget from its current parent. This is a no-op\n // if the widget's parent is already the layout parent widget.\n widget.parent = this.parent;\n\n // Look up the current index of the widget.\n let i = this._widgets.indexOf(widget);\n\n // Clamp the insert index to the array bounds.\n let j = Math.max(0, Math.min(index, this._widgets.length));\n\n // If the widget is not in the array, insert it.\n if (i === -1) {\n // Insert the widget into the array.\n ArrayExt.insert(this._widgets, j, widget);\n\n // If the layout is parented, attach the widget to the DOM.\n if (this.parent) {\n this.attachWidget(j, widget);\n }\n\n // There is nothing more to do.\n return;\n }\n\n // Otherwise, the widget exists in the array and should be moved.\n\n // Adjust the index if the location is at the end of the array.\n if (j === this._widgets.length) {\n j--;\n }\n\n // Bail if there is no effective move.\n if (i === j) {\n return;\n }\n\n // Move the widget to the new location.\n ArrayExt.move(this._widgets, i, j);\n\n // If the layout is parented, move the widget in the DOM.\n if (this.parent) {\n this.moveWidget(i, j, widget);\n }\n }\n\n /**\n * Remove a widget from the layout.\n *\n * @param widget - The widget to remove from the layout.\n *\n * #### Notes\n * A widget is automatically removed from the layout when its `parent`\n * is set to `null`. This method should only be invoked directly when\n * removing a widget from a layout which has yet to be installed on a\n * parent widget.\n *\n * This method does *not* modify the widget's `parent`.\n */\n removeWidget(widget: Widget): void {\n this.removeWidgetAt(this._widgets.indexOf(widget));\n }\n\n /**\n * Remove the widget at a given index from the layout.\n *\n * @param index - The index of the widget to remove.\n *\n * #### Notes\n * A widget is automatically removed from the layout when its `parent`\n * is set to `null`. This method should only be invoked directly when\n * removing a widget from a layout which has yet to be installed on a\n * parent widget.\n *\n * This method does *not* modify the widget's `parent`.\n *\n * #### Undefined Behavior\n * An `index` which is non-integral.\n */\n removeWidgetAt(index: number): void {\n // Remove the widget from the array.\n let widget = ArrayExt.removeAt(this._widgets, index);\n\n // If the layout is parented, detach the widget from the DOM.\n if (widget && this.parent) {\n this.detachWidget(index, widget);\n }\n }\n\n /**\n * Perform layout initialization which requires the parent widget.\n */\n protected init(): void {\n super.init();\n let index = 0;\n for (const widget of this) {\n this.attachWidget(index++, widget);\n }\n }\n\n /**\n * Attach a widget to the parent's DOM node.\n *\n * @param index - The current index of the widget in the layout.\n *\n * @param widget - The widget to attach to the parent.\n *\n * #### Notes\n * This method is called automatically by the panel layout at the\n * appropriate time. It should not be called directly by user code.\n *\n * The default implementation adds the widgets's node to the parent's\n * node at the proper location, and sends the appropriate attach\n * messages to the widget if the parent is attached to the DOM.\n *\n * Subclasses may reimplement this method to control how the widget's\n * node is added to the parent's node.\n */\n protected attachWidget(index: number, widget: Widget): void {\n // Look up the next sibling reference node.\n let ref = this.parent!.node.children[index];\n\n // Send a `'before-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n }\n\n // Insert the widget's node before the sibling.\n this.parent!.node.insertBefore(widget.node, ref);\n\n // Send an `'after-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n }\n\n /**\n * Move a widget in the parent's DOM node.\n *\n * @param fromIndex - The previous index of the widget in the layout.\n *\n * @param toIndex - The current index of the widget in the layout.\n *\n * @param widget - The widget to move in the parent.\n *\n * #### Notes\n * This method is called automatically by the panel layout at the\n * appropriate time. It should not be called directly by user code.\n *\n * The default implementation moves the widget's node to the proper\n * location in the parent's node and sends the appropriate attach and\n * detach messages to the widget if the parent is attached to the DOM.\n *\n * Subclasses may reimplement this method to control how the widget's\n * node is moved in the parent's node.\n */\n protected moveWidget(\n fromIndex: number,\n toIndex: number,\n widget: Widget\n ): void {\n // Send a `'before-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n }\n\n // Remove the widget's node from the parent.\n this.parent!.node.removeChild(widget.node);\n\n // Send an `'after-detach'` and message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n\n // Look up the next sibling reference node.\n let ref = this.parent!.node.children[toIndex];\n\n // Send a `'before-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n }\n\n // Insert the widget's node before the sibling.\n this.parent!.node.insertBefore(widget.node, ref);\n\n // Send an `'after-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n }\n\n /**\n * Detach a widget from the parent's DOM node.\n *\n * @param index - The previous index of the widget in the layout.\n *\n * @param widget - The widget to detach from the parent.\n *\n * #### Notes\n * This method is called automatically by the panel layout at the\n * appropriate time. It should not be called directly by user code.\n *\n * The default implementation removes the widget's node from the\n * parent's node, and sends the appropriate detach messages to the\n * widget if the parent is attached to the DOM.\n *\n * Subclasses may reimplement this method to control how the widget's\n * node is removed from the parent's node.\n */\n protected detachWidget(index: number, widget: Widget): void {\n // Send a `'before-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n }\n\n // Remove the widget's node from the parent.\n this.parent!.node.removeChild(widget.node);\n\n // Send an `'after-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n }\n\n private _widgets: Widget[] = [];\n}\n","/*\n * Copyright (c) Jupyter Development Team.\n * Distributed under the terms of the Modified BSD License.\n */\n\nexport namespace Utils {\n /**\n * Clamp a dimension value to an integer >= 0.\n */\n export function clampDimension(value: number): number {\n return Math.max(0, Math.floor(value));\n }\n}\n\nexport default Utils;\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { AttachedProperty } from '@lumino/properties';\n\nimport { BoxEngine, BoxSizer } from './boxengine';\n\nimport { LayoutItem } from './layout';\n\nimport { PanelLayout } from './panellayout';\n\nimport { Utils } from './utils';\n\nimport { Widget } from './widget';\n\n/**\n * A layout which arranges its widgets into resizable sections.\n */\nexport class SplitLayout extends PanelLayout {\n /**\n * Construct a new split layout.\n *\n * @param options - The options for initializing the layout.\n */\n constructor(options: SplitLayout.IOptions) {\n super();\n this.renderer = options.renderer;\n if (options.orientation !== undefined) {\n this._orientation = options.orientation;\n }\n if (options.alignment !== undefined) {\n this._alignment = options.alignment;\n }\n if (options.spacing !== undefined) {\n this._spacing = Utils.clampDimension(options.spacing);\n }\n }\n\n /**\n * Dispose of the resources held by the layout.\n */\n dispose(): void {\n // Dispose of the layout items.\n for (const item of this._items) {\n item.dispose();\n }\n\n // Clear the layout state.\n this._box = null;\n this._items.length = 0;\n this._sizers.length = 0;\n this._handles.length = 0;\n\n // Dispose of the rest of the layout.\n super.dispose();\n }\n\n /**\n * The renderer used by the split layout.\n */\n readonly renderer: SplitLayout.IRenderer;\n\n /**\n * Get the layout orientation for the split layout.\n */\n get orientation(): SplitLayout.Orientation {\n return this._orientation;\n }\n\n /**\n * Set the layout orientation for the split layout.\n */\n set orientation(value: SplitLayout.Orientation) {\n if (this._orientation === value) {\n return;\n }\n this._orientation = value;\n if (!this.parent) {\n return;\n }\n this.parent.dataset['orientation'] = value;\n this.parent.fit();\n }\n\n /**\n * Get the content alignment for the split layout.\n *\n * #### Notes\n * This is the alignment of the widgets in the layout direction.\n *\n * The alignment has no effect if the widgets can expand to fill the\n * entire split layout.\n */\n get alignment(): SplitLayout.Alignment {\n return this._alignment;\n }\n\n /**\n * Set the content alignment for the split layout.\n *\n * #### Notes\n * This is the alignment of the widgets in the layout direction.\n *\n * The alignment has no effect if the widgets can expand to fill the\n * entire split layout.\n */\n set alignment(value: SplitLayout.Alignment) {\n if (this._alignment === value) {\n return;\n }\n this._alignment = value;\n if (!this.parent) {\n return;\n }\n this.parent.dataset['alignment'] = value;\n this.parent.update();\n }\n\n /**\n * Get the inter-element spacing for the split layout.\n */\n get spacing(): number {\n return this._spacing;\n }\n\n /**\n * Set the inter-element spacing for the split layout.\n */\n set spacing(value: number) {\n value = Utils.clampDimension(value);\n if (this._spacing === value) {\n return;\n }\n this._spacing = value;\n if (!this.parent) {\n return;\n }\n this.parent.fit();\n }\n\n /**\n * A read-only array of the split handles in the layout.\n */\n get handles(): ReadonlyArray {\n return this._handles;\n }\n\n /**\n * Get the absolute sizes of the widgets in the layout.\n *\n * @returns A new array of the absolute sizes of the widgets.\n *\n * This method **does not** measure the DOM nodes.\n */\n absoluteSizes(): number[] {\n return this._sizers.map(sizer => sizer.size);\n }\n\n /**\n * Get the relative sizes of the widgets in the layout.\n *\n * @returns A new array of the relative sizes of the widgets.\n *\n * #### Notes\n * The returned sizes reflect the sizes of the widgets normalized\n * relative to their siblings.\n *\n * This method **does not** measure the DOM nodes.\n */\n relativeSizes(): number[] {\n return Private.normalize(this._sizers.map(sizer => sizer.size));\n }\n\n /**\n * Set the relative sizes for the widgets in the layout.\n *\n * @param sizes - The relative sizes for the widgets in the panel.\n * @param update - Update the layout after setting relative sizes.\n * Default is True.\n *\n * #### Notes\n * Extra values are ignored, too few will yield an undefined layout.\n *\n * The actual geometry of the DOM nodes is updated asynchronously.\n */\n setRelativeSizes(sizes: number[], update = true): void {\n // Copy the sizes and pad with zeros as needed.\n let n = this._sizers.length;\n let temp = sizes.slice(0, n);\n while (temp.length < n) {\n temp.push(0);\n }\n\n // Normalize the padded sizes.\n let normed = Private.normalize(temp);\n\n // Apply the normalized sizes to the sizers.\n for (let i = 0; i < n; ++i) {\n let sizer = this._sizers[i];\n sizer.sizeHint = normed[i];\n sizer.size = normed[i];\n }\n\n // Set the flag indicating the sizes are normalized.\n this._hasNormedSizes = true;\n\n // Trigger an update of the parent widget.\n if (update && this.parent) {\n this.parent.update();\n }\n }\n\n /**\n * Move the offset position of a split handle.\n *\n * @param index - The index of the handle of the interest.\n *\n * @param position - The desired offset position of the handle.\n *\n * #### Notes\n * The position is relative to the offset parent.\n *\n * This will move the handle as close as possible to the desired\n * position. The sibling widgets will be adjusted as necessary.\n */\n moveHandle(index: number, position: number): void {\n // Bail if the index is invalid or the handle is hidden.\n let handle = this._handles[index];\n if (!handle || handle.classList.contains('lm-mod-hidden')) {\n return;\n }\n\n // Compute the desired delta movement for the handle.\n let delta: number;\n if (this._orientation === 'horizontal') {\n delta = position - handle.offsetLeft;\n } else {\n delta = position - handle.offsetTop;\n }\n\n // Bail if there is no handle movement.\n if (delta === 0) {\n return;\n }\n\n // Prevent widget resizing unless needed.\n for (let sizer of this._sizers) {\n if (sizer.size > 0) {\n sizer.sizeHint = sizer.size;\n }\n }\n\n // Adjust the sizers to reflect the handle movement.\n BoxEngine.adjust(this._sizers, index, delta);\n\n // Update the layout of the widgets.\n if (this.parent) {\n this.parent.update();\n }\n }\n\n /**\n * Perform layout initialization which requires the parent widget.\n */\n protected init(): void {\n this.parent!.dataset['orientation'] = this.orientation;\n this.parent!.dataset['alignment'] = this.alignment;\n super.init();\n }\n\n /**\n * Attach a widget to the parent's DOM node.\n *\n * @param index - The current index of the widget in the layout.\n *\n * @param widget - The widget to attach to the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected attachWidget(index: number, widget: Widget): void {\n // Create the item, handle, and sizer for the new widget.\n let item = new LayoutItem(widget);\n let handle = Private.createHandle(this.renderer);\n let average = Private.averageSize(this._sizers);\n let sizer = Private.createSizer(average);\n\n // Insert the item, handle, and sizer into the internal arrays.\n ArrayExt.insert(this._items, index, item);\n ArrayExt.insert(this._sizers, index, sizer);\n ArrayExt.insert(this._handles, index, handle);\n\n // Send a `'before-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n }\n\n // Add the widget and handle nodes to the parent.\n this.parent!.node.appendChild(widget.node);\n this.parent!.node.appendChild(handle);\n\n // Send an `'after-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n\n // Post a fit request for the parent widget.\n this.parent!.fit();\n }\n\n /**\n * Move a widget in the parent's DOM node.\n *\n * @param fromIndex - The previous index of the widget in the layout.\n *\n * @param toIndex - The current index of the widget in the layout.\n *\n * @param widget - The widget to move in the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected moveWidget(\n fromIndex: number,\n toIndex: number,\n widget: Widget\n ): void {\n // Move the item, sizer, and handle for the widget.\n ArrayExt.move(this._items, fromIndex, toIndex);\n ArrayExt.move(this._sizers, fromIndex, toIndex);\n ArrayExt.move(this._handles, fromIndex, toIndex);\n\n // Post a fit request to the parent to show/hide last handle.\n this.parent!.fit();\n }\n\n /**\n * Detach a widget from the parent's DOM node.\n *\n * @param index - The previous index of the widget in the layout.\n *\n * @param widget - The widget to detach from the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected detachWidget(index: number, widget: Widget): void {\n // Remove the item, handle, and sizer for the widget.\n let item = ArrayExt.removeAt(this._items, index);\n let handle = ArrayExt.removeAt(this._handles, index);\n ArrayExt.removeAt(this._sizers, index);\n\n // Send a `'before-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n }\n\n // Remove the widget and handle nodes from the parent.\n this.parent!.node.removeChild(widget.node);\n this.parent!.node.removeChild(handle!);\n\n // Send an `'after-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n\n // Dispose of the layout item.\n item!.dispose();\n\n // Post a fit request for the parent widget.\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'before-show'` message.\n */\n protected onBeforeShow(msg: Message): void {\n super.onBeforeShow(msg);\n this.parent!.update();\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n super.onBeforeAttach(msg);\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-shown'` message.\n */\n protected onChildShown(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-hidden'` message.\n */\n protected onChildHidden(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'resize'` message.\n */\n protected onResize(msg: Widget.ResizeMessage): void {\n if (this.parent!.isVisible) {\n this._update(msg.width, msg.height);\n }\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n protected onUpdateRequest(msg: Message): void {\n if (this.parent!.isVisible) {\n this._update(-1, -1);\n }\n }\n\n /**\n * A message handler invoked on a `'fit-request'` message.\n */\n protected onFitRequest(msg: Message): void {\n if (this.parent!.isAttached) {\n this._fit();\n }\n }\n\n /**\n * Update the item position.\n *\n * @param i Item index\n * @param isHorizontal Whether the layout is horizontal or not\n * @param left Left position in pixels\n * @param top Top position in pixels\n * @param height Item height\n * @param width Item width\n * @param size Item size\n */\n protected updateItemPosition(\n i: number,\n isHorizontal: boolean,\n left: number,\n top: number,\n height: number,\n width: number,\n size: number\n ): void {\n const item = this._items[i];\n if (item.isHidden) {\n return;\n }\n\n // Fetch the style for the handle.\n let handleStyle = this._handles[i].style;\n\n // Update the widget and handle, and advance the relevant edge.\n if (isHorizontal) {\n left += this.widgetOffset;\n item.update(left, top, size, height);\n left += size;\n handleStyle.top = `${top}px`;\n handleStyle.left = `${left}px`;\n handleStyle.width = `${this._spacing}px`;\n handleStyle.height = `${height}px`;\n } else {\n top += this.widgetOffset;\n item.update(left, top, width, size);\n top += size;\n handleStyle.top = `${top}px`;\n handleStyle.left = `${left}px`;\n handleStyle.width = `${width}px`;\n handleStyle.height = `${this._spacing}px`;\n }\n }\n\n /**\n * Fit the layout to the total size required by the widgets.\n */\n private _fit(): void {\n // Update the handles and track the visible widget count.\n let nVisible = 0;\n let lastHandleIndex = -1;\n for (let i = 0, n = this._items.length; i < n; ++i) {\n if (this._items[i].isHidden) {\n this._handles[i].classList.add('lm-mod-hidden');\n } else {\n this._handles[i].classList.remove('lm-mod-hidden');\n lastHandleIndex = i;\n nVisible++;\n }\n }\n\n // Hide the handle for the last visible widget.\n if (lastHandleIndex !== -1) {\n this._handles[lastHandleIndex].classList.add('lm-mod-hidden');\n }\n\n // Update the fixed space for the visible items.\n this._fixed =\n this._spacing * Math.max(0, nVisible - 1) +\n this.widgetOffset * this._items.length;\n\n // Setup the computed minimum size.\n let horz = this._orientation === 'horizontal';\n let minW = horz ? this._fixed : 0;\n let minH = horz ? 0 : this._fixed;\n\n // Update the sizers and computed size limits.\n for (let i = 0, n = this._items.length; i < n; ++i) {\n // Fetch the item and corresponding box sizer.\n let item = this._items[i];\n let sizer = this._sizers[i];\n\n // Prevent resizing unless necessary.\n if (sizer.size > 0) {\n sizer.sizeHint = sizer.size;\n }\n\n // If the item is hidden, it should consume zero size.\n if (item.isHidden) {\n sizer.minSize = 0;\n sizer.maxSize = 0;\n continue;\n }\n\n // Update the size limits for the item.\n item.fit();\n\n // Update the stretch factor.\n sizer.stretch = SplitLayout.getStretch(item.widget);\n\n // Update the sizer limits and computed min size.\n if (horz) {\n sizer.minSize = item.minWidth;\n sizer.maxSize = item.maxWidth;\n minW += item.minWidth;\n minH = Math.max(minH, item.minHeight);\n } else {\n sizer.minSize = item.minHeight;\n sizer.maxSize = item.maxHeight;\n minH += item.minHeight;\n minW = Math.max(minW, item.minWidth);\n }\n }\n\n // Update the box sizing and add it to the computed min size.\n let box = (this._box = ElementExt.boxSizing(this.parent!.node));\n minW += box.horizontalSum;\n minH += box.verticalSum;\n\n // Update the parent's min size constraints.\n let style = this.parent!.node.style;\n style.minWidth = `${minW}px`;\n style.minHeight = `${minH}px`;\n\n // Set the dirty flag to ensure only a single update occurs.\n this._dirty = true;\n\n // Notify the ancestor that it should fit immediately. This may\n // cause a resize of the parent, fulfilling the required update.\n if (this.parent!.parent) {\n MessageLoop.sendMessage(this.parent!.parent!, Widget.Msg.FitRequest);\n }\n\n // If the dirty flag is still set, the parent was not resized.\n // Trigger the required update on the parent widget immediately.\n if (this._dirty) {\n MessageLoop.sendMessage(this.parent!, Widget.Msg.UpdateRequest);\n }\n }\n\n /**\n * Update the layout position and size of the widgets.\n *\n * The parent offset dimensions should be `-1` if unknown.\n */\n private _update(offsetWidth: number, offsetHeight: number): void {\n // Clear the dirty flag to indicate the update occurred.\n this._dirty = false;\n\n // Compute the visible item count.\n let nVisible = 0;\n for (let i = 0, n = this._items.length; i < n; ++i) {\n nVisible += +!this._items[i].isHidden;\n }\n\n // Bail early if there are no visible items to layout.\n if (nVisible === 0 && this.widgetOffset === 0) {\n return;\n }\n\n // Measure the parent if the offset dimensions are unknown.\n if (offsetWidth < 0) {\n offsetWidth = this.parent!.node.offsetWidth;\n }\n if (offsetHeight < 0) {\n offsetHeight = this.parent!.node.offsetHeight;\n }\n\n // Ensure the parent box sizing data is computed.\n if (!this._box) {\n this._box = ElementExt.boxSizing(this.parent!.node);\n }\n\n // Compute the actual layout bounds adjusted for border and padding.\n let top = this._box.paddingTop;\n let left = this._box.paddingLeft;\n let width = offsetWidth - this._box.horizontalSum;\n let height = offsetHeight - this._box.verticalSum;\n\n // Set up the variables for justification and alignment offset.\n let extra = 0;\n let offset = 0;\n let horz = this._orientation === 'horizontal';\n\n if (nVisible > 0) {\n // Compute the adjusted layout space.\n let space: number;\n if (horz) {\n // left += this.widgetOffset;\n space = Math.max(0, width - this._fixed);\n } else {\n // top += this.widgetOffset;\n space = Math.max(0, height - this._fixed);\n }\n\n // Scale the size hints if they are normalized.\n if (this._hasNormedSizes) {\n for (let sizer of this._sizers) {\n sizer.sizeHint *= space;\n }\n this._hasNormedSizes = false;\n }\n\n // Distribute the layout space to the box sizers.\n let delta = BoxEngine.calc(this._sizers, space);\n\n // Account for alignment if there is extra layout space.\n if (delta > 0) {\n switch (this._alignment) {\n case 'start':\n break;\n case 'center':\n extra = 0;\n offset = delta / 2;\n break;\n case 'end':\n extra = 0;\n offset = delta;\n break;\n case 'justify':\n extra = delta / nVisible;\n offset = 0;\n break;\n default:\n throw 'unreachable';\n }\n }\n }\n\n // Layout the items using the computed box sizes.\n for (let i = 0, n = this._items.length; i < n; ++i) {\n // Fetch the item.\n const item = this._items[i];\n\n // Fetch the computed size for the widget.\n const size = item.isHidden ? 0 : this._sizers[i].size + extra;\n\n this.updateItemPosition(\n i,\n horz,\n horz ? left + offset : left,\n horz ? top : top + offset,\n height,\n width,\n size\n );\n\n const fullOffset =\n this.widgetOffset +\n (this._handles[i].classList.contains('lm-mod-hidden')\n ? 0\n : this._spacing);\n\n if (horz) {\n left += size + fullOffset;\n } else {\n top += size + fullOffset;\n }\n }\n }\n\n protected widgetOffset = 0;\n private _fixed = 0;\n private _spacing = 4;\n private _dirty = false;\n private _hasNormedSizes = false;\n private _sizers: BoxSizer[] = [];\n private _items: LayoutItem[] = [];\n private _handles: HTMLDivElement[] = [];\n private _box: ElementExt.IBoxSizing | null = null;\n private _alignment: SplitLayout.Alignment = 'start';\n private _orientation: SplitLayout.Orientation = 'horizontal';\n}\n\n/**\n * The namespace for the `SplitLayout` class statics.\n */\nexport namespace SplitLayout {\n /**\n * A type alias for a split layout orientation.\n */\n export type Orientation = 'horizontal' | 'vertical';\n\n /**\n * A type alias for a split layout alignment.\n */\n export type Alignment = 'start' | 'center' | 'end' | 'justify';\n\n /**\n * An options object for initializing a split layout.\n */\n export interface IOptions {\n /**\n * The renderer to use for the split layout.\n */\n renderer: IRenderer;\n\n /**\n * The orientation of the layout.\n *\n * Possible values are documented in {@link SplitLayout.Orientation}.\n *\n * The default is `'horizontal'`.\n */\n orientation?: Orientation;\n\n /**\n * The content alignment of the layout.\n *\n * Possible values are documented in {@link SplitLayout.Alignment}.\n *\n * The default is `'start'`.\n */\n alignment?: Alignment;\n\n /**\n * The spacing between items in the layout.\n *\n * The default is `4`.\n */\n spacing?: number;\n }\n\n /**\n * A renderer for use with a split layout.\n */\n export interface IRenderer {\n /**\n * Create a new handle for use with a split layout.\n *\n * @returns A new handle element.\n */\n createHandle(): HTMLDivElement;\n }\n\n /**\n * Get the split layout stretch factor for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The split layout stretch factor for the widget.\n */\n export function getStretch(widget: Widget): number {\n return Private.stretchProperty.get(widget);\n }\n\n /**\n * Set the split layout stretch factor for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the stretch factor.\n */\n export function setStretch(widget: Widget, value: number): void {\n Private.stretchProperty.set(widget, value);\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * The property descriptor for a widget stretch factor.\n */\n export const stretchProperty = new AttachedProperty({\n name: 'stretch',\n create: () => 0,\n coerce: (owner, value) => Math.max(0, Math.floor(value)),\n changed: onChildSizingChanged\n });\n\n /**\n * Create a new box sizer with the given size hint.\n */\n export function createSizer(size: number): BoxSizer {\n let sizer = new BoxSizer();\n sizer.sizeHint = Math.floor(size);\n return sizer;\n }\n\n /**\n * Create a new split handle node using the given renderer.\n */\n export function createHandle(\n renderer: SplitLayout.IRenderer\n ): HTMLDivElement {\n let handle = renderer.createHandle();\n handle.style.position = 'absolute';\n // Do not use size containment to allow the handle to fill the available space\n handle.style.contain = 'style';\n return handle;\n }\n\n /**\n * Compute the average size of an array of box sizers.\n */\n export function averageSize(sizers: BoxSizer[]): number {\n return sizers.reduce((v, s) => v + s.size, 0) / sizers.length || 0;\n }\n\n /**\n * Normalize an array of values.\n */\n export function normalize(values: number[]): number[] {\n let n = values.length;\n if (n === 0) {\n return [];\n }\n let sum = values.reduce((a, b) => a + Math.abs(b), 0);\n return sum === 0 ? values.map(v => 1 / n) : values.map(v => v / sum);\n }\n\n /**\n * The change handler for the attached sizing properties.\n */\n function onChildSizingChanged(child: Widget): void {\n if (child.parent && child.parent.layout instanceof SplitLayout) {\n child.parent.fit();\n }\n }\n}\n","/*\n * Copyright (c) Jupyter Development Team.\n * Distributed under the terms of the Modified BSD License.\n */\n\nimport { ArrayExt } from '@lumino/algorithm';\nimport { UUID } from '@lumino/coreutils';\nimport { SplitLayout } from './splitlayout';\nimport { Title } from './title';\nimport Utils from './utils';\nimport { Widget } from './widget';\n\n/**\n * A layout which arranges its widgets into collapsible resizable sections.\n */\nexport class AccordionLayout extends SplitLayout {\n /**\n * Construct a new accordion layout.\n *\n * @param options - The options for initializing the layout.\n *\n * #### Notes\n * The default orientation will be vertical.\n *\n * Titles must be rotated for horizontal accordion panel using CSS: see accordionpanel.css\n */\n constructor(options: AccordionLayout.IOptions) {\n super({ ...options, orientation: options.orientation || 'vertical' });\n this.titleSpace = options.titleSpace || 22;\n }\n\n /**\n * The section title height or width depending on the orientation.\n */\n get titleSpace(): number {\n return this.widgetOffset;\n }\n set titleSpace(value: number) {\n value = Utils.clampDimension(value);\n if (this.widgetOffset === value) {\n return;\n }\n this.widgetOffset = value;\n if (!this.parent) {\n return;\n }\n this.parent.fit();\n }\n\n /**\n * A read-only array of the section titles in the panel.\n */\n get titles(): ReadonlyArray {\n return this._titles;\n }\n\n /**\n * Dispose of the resources held by the layout.\n */\n dispose(): void {\n if (this.isDisposed) {\n return;\n }\n\n // Clear the layout state.\n this._titles.length = 0;\n\n // Dispose of the rest of the layout.\n super.dispose();\n }\n\n /**\n * The renderer used by the accordion layout.\n */\n readonly renderer: AccordionLayout.IRenderer;\n\n public updateTitle(index: number, widget: Widget): void {\n const oldTitle = this._titles[index];\n const expanded = oldTitle.classList.contains('lm-mod-expanded');\n const newTitle = Private.createTitle(this.renderer, widget.title, expanded);\n this._titles[index] = newTitle;\n\n // Add the title node to the parent before the widget.\n this.parent!.node.replaceChild(newTitle, oldTitle);\n }\n\n /**\n * Insert a widget into the layout at the specified index.\n *\n * @param index - The index at which to insert the widget.\n *\n * @param widget - The widget to insert into the layout.\n *\n * #### Notes\n * The index will be clamped to the bounds of the widgets.\n *\n * If the widget is already added to the layout, it will be moved.\n *\n * #### Undefined Behavior\n * An `index` which is non-integral.\n */\n insertWidget(index: number, widget: Widget): void {\n if (!widget.id) {\n widget.id = `id-${UUID.uuid4()}`;\n }\n super.insertWidget(index, widget);\n }\n\n /**\n * Attach a widget to the parent's DOM node.\n *\n * @param index - The current index of the widget in the layout.\n *\n * @param widget - The widget to attach to the parent.\n */\n protected attachWidget(index: number, widget: Widget): void {\n const title = Private.createTitle(this.renderer, widget.title);\n\n ArrayExt.insert(this._titles, index, title);\n\n // Add the title node to the parent before the widget.\n this.parent!.node.appendChild(title);\n\n widget.node.setAttribute('role', 'region');\n widget.node.setAttribute('aria-labelledby', title.id);\n\n super.attachWidget(index, widget);\n }\n\n /**\n * Move a widget in the parent's DOM node.\n *\n * @param fromIndex - The previous index of the widget in the layout.\n *\n * @param toIndex - The current index of the widget in the layout.\n *\n * @param widget - The widget to move in the parent.\n */\n protected moveWidget(\n fromIndex: number,\n toIndex: number,\n widget: Widget\n ): void {\n ArrayExt.move(this._titles, fromIndex, toIndex);\n super.moveWidget(fromIndex, toIndex, widget);\n }\n\n /**\n * Detach a widget from the parent's DOM node.\n *\n * @param index - The previous index of the widget in the layout.\n *\n * @param widget - The widget to detach from the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected detachWidget(index: number, widget: Widget): void {\n const title = ArrayExt.removeAt(this._titles, index);\n\n this.parent!.node.removeChild(title!);\n\n super.detachWidget(index, widget);\n }\n\n /**\n * Update the item position.\n *\n * @param i Item index\n * @param isHorizontal Whether the layout is horizontal or not\n * @param left Left position in pixels\n * @param top Top position in pixels\n * @param height Item height\n * @param width Item width\n * @param size Item size\n */\n protected updateItemPosition(\n i: number,\n isHorizontal: boolean,\n left: number,\n top: number,\n height: number,\n width: number,\n size: number\n ): void {\n const titleStyle = this._titles[i].style;\n\n // Titles must be rotated for horizontal accordion panel using CSS: see accordionpanel.css\n titleStyle.top = `${top}px`;\n titleStyle.left = `${left}px`;\n titleStyle.height = `${this.widgetOffset}px`;\n if (isHorizontal) {\n titleStyle.width = `${height}px`;\n } else {\n titleStyle.width = `${width}px`;\n }\n\n super.updateItemPosition(i, isHorizontal, left, top, height, width, size);\n }\n\n private _titles: HTMLElement[] = [];\n}\n\nexport namespace AccordionLayout {\n /**\n * A type alias for a accordion layout orientation.\n */\n export type Orientation = SplitLayout.Orientation;\n\n /**\n * A type alias for a accordion layout alignment.\n */\n export type Alignment = SplitLayout.Alignment;\n\n /**\n * An options object for initializing a accordion layout.\n */\n export interface IOptions extends SplitLayout.IOptions {\n /**\n * The renderer to use for the accordion layout.\n */\n renderer: IRenderer;\n\n /**\n * The section title height or width depending on the orientation.\n *\n * The default is `22`.\n */\n titleSpace?: number;\n }\n\n /**\n * A renderer for use with an accordion layout.\n */\n export interface IRenderer extends SplitLayout.IRenderer {\n /**\n * Common class name for all accordion titles.\n */\n readonly titleClassName: string;\n\n /**\n * Render the element for a section title.\n *\n * @param title - The data to use for rendering the section title.\n *\n * @returns A element representing the section title.\n */\n createSectionTitle(title: Title): HTMLElement;\n }\n}\n\nnamespace Private {\n /**\n * Create the title HTML element.\n *\n * @param renderer Accordion renderer\n * @param data Widget title\n * @returns Title HTML element\n */\n export function createTitle(\n renderer: AccordionLayout.IRenderer,\n data: Title,\n expanded: boolean = true\n ): HTMLElement {\n const title = renderer.createSectionTitle(data);\n title.style.position = 'absolute';\n title.style.contain = 'strict';\n title.setAttribute('aria-label', `${data.label} Section`);\n title.setAttribute('aria-expanded', expanded ? 'true' : 'false');\n title.setAttribute('aria-controls', data.owner.id);\n if (expanded) {\n title.classList.add('lm-mod-expanded');\n }\n return title;\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { PanelLayout } from './panellayout';\n\nimport { Widget } from './widget';\n\n/**\n * A simple and convenient panel widget class.\n *\n * #### Notes\n * This class is suitable as a base class for implementing a variety of\n * convenience panel widgets, but can also be used directly with CSS to\n * arrange a collection of widgets.\n *\n * This class provides a convenience wrapper around a {@link PanelLayout}.\n */\nexport class Panel extends Widget {\n /**\n * Construct a new panel.\n *\n * @param options - The options for initializing the panel.\n */\n constructor(options: Panel.IOptions = {}) {\n super();\n this.addClass('lm-Panel');\n this.layout = Private.createLayout(options);\n }\n\n /**\n * A read-only array of the widgets in the panel.\n */\n get widgets(): ReadonlyArray {\n return (this.layout as PanelLayout).widgets;\n }\n\n /**\n * Add a widget to the end of the panel.\n *\n * @param widget - The widget to add to the panel.\n *\n * #### Notes\n * If the widget is already contained in the panel, it will be moved.\n */\n addWidget(widget: Widget): void {\n (this.layout as PanelLayout).addWidget(widget);\n }\n\n /**\n * Insert a widget at the specified index.\n *\n * @param index - The index at which to insert the widget.\n *\n * @param widget - The widget to insert into to the panel.\n *\n * #### Notes\n * If the widget is already contained in the panel, it will be moved.\n */\n insertWidget(index: number, widget: Widget): void {\n (this.layout as PanelLayout).insertWidget(index, widget);\n }\n}\n\n/**\n * The namespace for the `Panel` class statics.\n */\nexport namespace Panel {\n /**\n * An options object for creating a panel.\n */\n export interface IOptions {\n /**\n * The panel layout to use for the panel.\n *\n * The default is a new `PanelLayout`.\n */\n layout?: PanelLayout;\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * Create a panel layout for the given panel options.\n */\n export function createLayout(options: Panel.IOptions): PanelLayout {\n return options.layout || new PanelLayout();\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { IDisposable } from '@lumino/disposable';\n\nimport { Drag } from '@lumino/dragdrop';\n\nimport { Message } from '@lumino/messaging';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { Panel } from './panel';\n\nimport { SplitLayout } from './splitlayout';\n\nimport { Widget } from './widget';\n\n/**\n * A panel which arranges its widgets into resizable sections.\n *\n * #### Notes\n * This class provides a convenience wrapper around a {@link SplitLayout}.\n */\nexport class SplitPanel extends Panel {\n /**\n * Construct a new split panel.\n *\n * @param options - The options for initializing the split panel.\n */\n constructor(options: SplitPanel.IOptions = {}) {\n super({ layout: Private.createLayout(options) });\n this.addClass('lm-SplitPanel');\n }\n\n /**\n * Dispose of the resources held by the panel.\n */\n dispose(): void {\n this._releaseMouse();\n super.dispose();\n }\n\n /**\n * Get the layout orientation for the split panel.\n */\n get orientation(): SplitPanel.Orientation {\n return (this.layout as SplitLayout).orientation;\n }\n\n /**\n * Set the layout orientation for the split panel.\n */\n set orientation(value: SplitPanel.Orientation) {\n (this.layout as SplitLayout).orientation = value;\n }\n\n /**\n * Get the content alignment for the split panel.\n *\n * #### Notes\n * This is the alignment of the widgets in the layout direction.\n *\n * The alignment has no effect if the widgets can expand to fill the\n * entire split panel.\n */\n get alignment(): SplitPanel.Alignment {\n return (this.layout as SplitLayout).alignment;\n }\n\n /**\n * Set the content alignment for the split panel.\n *\n * #### Notes\n * This is the alignment of the widgets in the layout direction.\n *\n * The alignment has no effect if the widgets can expand to fill the\n * entire split panel.\n */\n set alignment(value: SplitPanel.Alignment) {\n (this.layout as SplitLayout).alignment = value;\n }\n\n /**\n * Get the inter-element spacing for the split panel.\n */\n get spacing(): number {\n return (this.layout as SplitLayout).spacing;\n }\n\n /**\n * Set the inter-element spacing for the split panel.\n */\n set spacing(value: number) {\n (this.layout as SplitLayout).spacing = value;\n }\n\n /**\n * The renderer used by the split panel.\n */\n get renderer(): SplitPanel.IRenderer {\n return (this.layout as SplitLayout).renderer;\n }\n\n /**\n * A signal emitted when a split handle has moved.\n */\n get handleMoved(): ISignal {\n return this._handleMoved;\n }\n\n /**\n * A read-only array of the split handles in the panel.\n */\n get handles(): ReadonlyArray {\n return (this.layout as SplitLayout).handles;\n }\n\n /**\n * Get the relative sizes of the widgets in the panel.\n *\n * @returns A new array of the relative sizes of the widgets.\n *\n * #### Notes\n * The returned sizes reflect the sizes of the widgets normalized\n * relative to their siblings.\n *\n * This method **does not** measure the DOM nodes.\n */\n relativeSizes(): number[] {\n return (this.layout as SplitLayout).relativeSizes();\n }\n\n /**\n * Set the relative sizes for the widgets in the panel.\n *\n * @param sizes - The relative sizes for the widgets in the panel.\n * @param update - Update the layout after setting relative sizes.\n * Default is True.\n *\n * #### Notes\n * Extra values are ignored, too few will yield an undefined layout.\n *\n * The actual geometry of the DOM nodes is updated asynchronously.\n */\n setRelativeSizes(sizes: number[], update = true): void {\n (this.layout as SplitLayout).setRelativeSizes(sizes, update);\n }\n\n /**\n * Handle the DOM events for the split panel.\n *\n * @param event - The DOM event sent to the panel.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the panel's DOM node. It should\n * not be called directly by user code.\n */\n handleEvent(event: Event): void {\n switch (event.type) {\n case 'pointerdown':\n this._evtPointerDown(event as PointerEvent);\n break;\n case 'pointermove':\n this._evtPointerMove(event as PointerEvent);\n break;\n case 'pointerup':\n this._evtPointerUp(event as PointerEvent);\n break;\n case 'keydown':\n this._evtKeyDown(event as KeyboardEvent);\n break;\n case 'contextmenu':\n event.preventDefault();\n event.stopPropagation();\n break;\n }\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n this.node.addEventListener('pointerdown', this);\n }\n\n /**\n * A message handler invoked on an `'after-detach'` message.\n */\n protected onAfterDetach(msg: Message): void {\n this.node.removeEventListener('pointerdown', this);\n this._releaseMouse();\n }\n\n /**\n * A message handler invoked on a `'child-added'` message.\n */\n protected onChildAdded(msg: Widget.ChildMessage): void {\n msg.child.addClass('lm-SplitPanel-child');\n this._releaseMouse();\n }\n\n /**\n * A message handler invoked on a `'child-removed'` message.\n */\n protected onChildRemoved(msg: Widget.ChildMessage): void {\n msg.child.removeClass('lm-SplitPanel-child');\n this._releaseMouse();\n }\n\n /**\n * Handle the `'keydown'` event for the split panel.\n */\n private _evtKeyDown(event: KeyboardEvent): void {\n // Stop input events during drag.\n if (this._pressData) {\n event.preventDefault();\n event.stopPropagation();\n }\n\n // Release the mouse if `Escape` is pressed.\n if (event.keyCode === 27) {\n this._releaseMouse();\n }\n }\n\n /**\n * Handle the `'pointerdown'` event for the split panel.\n */\n private _evtPointerDown(event: PointerEvent): void {\n // Do nothing if the primary button is not pressed.\n if (event.button !== 0) {\n return;\n }\n\n // Find the handle which contains the target, if any.\n let layout = this.layout as SplitLayout;\n let index = ArrayExt.findFirstIndex(layout.handles, handle => {\n return handle.contains(event.target as HTMLElement);\n });\n\n // Bail early if the mouse press was not on a handle.\n if (index === -1) {\n return;\n }\n\n // Stop the event when a split handle is pressed.\n event.preventDefault();\n event.stopPropagation();\n\n // Add the extra document listeners.\n document.addEventListener('pointerup', this, true);\n document.addEventListener('pointermove', this, true);\n document.addEventListener('keydown', this, true);\n document.addEventListener('contextmenu', this, true);\n\n // Compute the offset delta for the handle press.\n let delta: number;\n let handle = layout.handles[index];\n let rect = handle.getBoundingClientRect();\n if (layout.orientation === 'horizontal') {\n delta = event.clientX - rect.left;\n } else {\n delta = event.clientY - rect.top;\n }\n\n // Override the cursor and store the press data.\n let style = window.getComputedStyle(handle);\n let override = Drag.overrideCursor(style.cursor!);\n this._pressData = { index, delta, override };\n }\n\n /**\n * Handle the `'pointermove'` event for the split panel.\n */\n private _evtPointerMove(event: PointerEvent): void {\n // Stop the event when dragging a split handle.\n event.preventDefault();\n event.stopPropagation();\n\n // Compute the desired offset position for the handle.\n let pos: number;\n let layout = this.layout as SplitLayout;\n let rect = this.node.getBoundingClientRect();\n if (layout.orientation === 'horizontal') {\n pos = event.clientX - rect.left - this._pressData!.delta;\n } else {\n pos = event.clientY - rect.top - this._pressData!.delta;\n }\n\n // Move the handle as close to the desired position as possible.\n layout.moveHandle(this._pressData!.index, pos);\n }\n\n /**\n * Handle the `'pointerup'` event for the split panel.\n */\n private _evtPointerUp(event: PointerEvent): void {\n // Do nothing if the primary button is not released.\n if (event.button !== 0) {\n return;\n }\n\n // Stop the event when releasing a handle.\n event.preventDefault();\n event.stopPropagation();\n\n // Finalize the mouse release.\n this._releaseMouse();\n }\n\n /**\n * Release the mouse grab for the split panel.\n */\n private _releaseMouse(): void {\n // Bail early if no drag is in progress.\n if (!this._pressData) {\n return;\n }\n\n // Clear the override cursor.\n this._pressData.override.dispose();\n this._pressData = null;\n\n // Emit the handle moved signal.\n this._handleMoved.emit();\n\n // Remove the extra document listeners.\n document.removeEventListener('keydown', this, true);\n document.removeEventListener('pointerup', this, true);\n document.removeEventListener('pointermove', this, true);\n document.removeEventListener('contextmenu', this, true);\n }\n\n private _handleMoved = new Signal(this);\n private _pressData: Private.IPressData | null = null;\n}\n\n/**\n * The namespace for the `SplitPanel` class statics.\n */\nexport namespace SplitPanel {\n /**\n * A type alias for a split panel orientation.\n */\n export type Orientation = SplitLayout.Orientation;\n\n /**\n * A type alias for a split panel alignment.\n */\n export type Alignment = SplitLayout.Alignment;\n\n /**\n * A type alias for a split panel renderer.\n */\n export type IRenderer = SplitLayout.IRenderer;\n\n /**\n * An options object for initializing a split panel.\n */\n export interface IOptions {\n /**\n * The renderer to use for the split panel.\n *\n * The default is a shared renderer instance.\n */\n renderer?: IRenderer;\n\n /**\n * The layout orientation of the panel.\n *\n * The default is `'horizontal'`.\n */\n orientation?: Orientation;\n\n /**\n * The content alignment of the panel.\n *\n * The default is `'start'`.\n */\n alignment?: Alignment;\n\n /**\n * The spacing between items in the panel.\n *\n * The default is `4`.\n */\n spacing?: number;\n\n /**\n * The split layout to use for the split panel.\n *\n * If this is provided, the other options are ignored.\n *\n * The default is a new `SplitLayout`.\n */\n layout?: SplitLayout;\n }\n\n /**\n * The default implementation of `IRenderer`.\n */\n export class Renderer implements IRenderer {\n /**\n * Create a new handle for use with a split panel.\n *\n * @returns A new handle element for a split panel.\n */\n createHandle(): HTMLDivElement {\n let handle = document.createElement('div');\n handle.className = 'lm-SplitPanel-handle';\n return handle;\n }\n }\n\n /**\n * The default `Renderer` instance.\n */\n export const defaultRenderer = new Renderer();\n\n /**\n * Get the split panel stretch factor for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The split panel stretch factor for the widget.\n */\n export function getStretch(widget: Widget): number {\n return SplitLayout.getStretch(widget);\n }\n\n /**\n * Set the split panel stretch factor for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the stretch factor.\n */\n export function setStretch(widget: Widget, value: number): void {\n SplitLayout.setStretch(widget, value);\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * An object which holds mouse press data.\n */\n export interface IPressData {\n /**\n * The index of the pressed handle.\n */\n index: number;\n\n /**\n * The offset of the press in handle coordinates.\n */\n delta: number;\n\n /**\n * The disposable which will clear the override cursor.\n */\n override: IDisposable;\n }\n\n /**\n * Create a split layout for the given panel options.\n */\n export function createLayout(options: SplitPanel.IOptions): SplitLayout {\n return (\n options.layout ||\n new SplitLayout({\n renderer: options.renderer || SplitPanel.defaultRenderer,\n orientation: options.orientation,\n alignment: options.alignment,\n spacing: options.spacing\n })\n );\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n\nimport { ArrayExt } from '@lumino/algorithm';\nimport { Message } from '@lumino/messaging';\nimport { ISignal, Signal } from '@lumino/signaling';\nimport { AccordionLayout } from './accordionlayout';\nimport { SplitLayout } from './splitlayout';\nimport { SplitPanel } from './splitpanel';\nimport { Title } from './title';\nimport { Widget } from './widget';\n\n/**\n * A panel which arranges its widgets into resizable sections separated by a title widget.\n *\n * #### Notes\n * This class provides a convenience wrapper around {@link AccordionLayout}.\n *\n * See also the related [example](../../examples/accordionpanel/index.html) and\n * its [source](https://github.com/jupyterlab/lumino/tree/main/examples/example-accordionpanel).\n */\nexport class AccordionPanel extends SplitPanel {\n /**\n * Construct a new accordion panel.\n *\n * @param options - The options for initializing the accordion panel.\n *\n */\n constructor(options: AccordionPanel.IOptions = {}) {\n super({ ...options, layout: Private.createLayout(options) });\n this.addClass('lm-AccordionPanel');\n }\n\n /**\n * The renderer used by the accordion panel.\n */\n get renderer(): AccordionPanel.IRenderer {\n return (this.layout as AccordionLayout).renderer;\n }\n\n /**\n * The section title space.\n *\n * This is the height if the panel is vertical and the width if it is\n * horizontal.\n */\n get titleSpace(): number {\n return (this.layout as AccordionLayout).titleSpace;\n }\n set titleSpace(value: number) {\n (this.layout as AccordionLayout).titleSpace = value;\n }\n\n /**\n * A read-only array of the section titles in the panel.\n */\n get titles(): ReadonlyArray {\n return (this.layout as AccordionLayout).titles;\n }\n\n /**\n * A signal emitted when a widget of the AccordionPanel is collapsed or expanded.\n */\n get expansionToggled(): ISignal {\n return this._expansionToggled;\n }\n\n /**\n * Add a widget to the end of the panel.\n *\n * @param widget - The widget to add to the panel.\n *\n * #### Notes\n * If the widget is already contained in the panel, it will be moved.\n */\n addWidget(widget: Widget): void {\n super.addWidget(widget);\n widget.title.changed.connect(this._onTitleChanged, this);\n }\n\n /**\n * Collapse the widget at position `index`.\n *\n * #### Notes\n * If no widget is found for `index`, this will bail.\n *\n * @param index Widget index\n */\n collapse(index: number): void {\n const widget = (this.layout as AccordionLayout).widgets[index];\n\n if (widget && !widget.isHidden) {\n this._toggleExpansion(index);\n }\n }\n\n /**\n * Expand the widget at position `index`.\n *\n * #### Notes\n * If no widget is found for `index`, this will bail.\n *\n * @param index Widget index\n */\n expand(index: number): void {\n const widget = (this.layout as AccordionLayout).widgets[index];\n\n if (widget && widget.isHidden) {\n this._toggleExpansion(index);\n }\n }\n\n /**\n * Insert a widget at the specified index.\n *\n * @param index - The index at which to insert the widget.\n *\n * @param widget - The widget to insert into to the panel.\n *\n * #### Notes\n * If the widget is already contained in the panel, it will be moved.\n */\n insertWidget(index: number, widget: Widget): void {\n super.insertWidget(index, widget);\n widget.title.changed.connect(this._onTitleChanged, this);\n }\n\n /**\n * Handle the DOM events for the accordion panel.\n *\n * @param event - The DOM event sent to the panel.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the panel's DOM node. It should\n * not be called directly by user code.\n */\n handleEvent(event: Event): void {\n super.handleEvent(event);\n switch (event.type) {\n case 'click':\n this._evtClick(event as MouseEvent);\n break;\n case 'keydown':\n this._eventKeyDown(event as KeyboardEvent);\n break;\n }\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n this.node.addEventListener('click', this);\n this.node.addEventListener('keydown', this);\n super.onBeforeAttach(msg);\n }\n\n /**\n * A message handler invoked on an `'after-detach'` message.\n */\n protected onAfterDetach(msg: Message): void {\n super.onAfterDetach(msg);\n this.node.removeEventListener('click', this);\n this.node.removeEventListener('keydown', this);\n }\n\n /**\n * Handle the `changed` signal of a title object.\n */\n private _onTitleChanged(sender: Title): void {\n const index = ArrayExt.findFirstIndex(this.widgets, widget => {\n return widget.contains(sender.owner);\n });\n\n if (index >= 0) {\n (this.layout as AccordionLayout).updateTitle(index, sender.owner);\n this.update();\n }\n }\n\n /**\n * Compute the size of widgets in this panel on the title click event.\n * On closing, the size of the widget is cached and we will try to expand\n * the last opened widget.\n * On opening, we will use the cached size if it is available to restore the\n * widget.\n * In both cases, if we can not compute the size of widgets, we will let\n * `SplitLayout` decide.\n *\n * @param index - The index of widget to be opened of closed\n *\n * @returns Relative size of widgets in this panel, if this size can\n * not be computed, return `undefined`\n */\n private _computeWidgetSize(index: number): number[] | undefined {\n const layout = this.layout as AccordionLayout;\n\n const widget = layout.widgets[index];\n if (!widget) {\n return undefined;\n }\n const isHidden = widget.isHidden;\n const widgetSizes = layout.absoluteSizes();\n const delta = (isHidden ? -1 : 1) * this.spacing;\n const totalSize = widgetSizes.reduce(\n (prev: number, curr: number) => prev + curr\n );\n\n let newSize = [...widgetSizes];\n\n if (!isHidden) {\n // Hide the widget\n const currentSize = widgetSizes[index];\n\n this._widgetSizesCache.set(widget, currentSize);\n newSize[index] = 0;\n\n const widgetToCollapse = newSize.map(sz => sz > 0).lastIndexOf(true);\n if (widgetToCollapse === -1) {\n // All widget are closed, let the `SplitLayout` compute widget sizes.\n return undefined;\n }\n\n newSize[widgetToCollapse] =\n widgetSizes[widgetToCollapse] + currentSize + delta;\n } else {\n // Show the widget\n const previousSize = this._widgetSizesCache.get(widget);\n if (!previousSize) {\n // Previous size is unavailable, let the `SplitLayout` compute widget sizes.\n return undefined;\n }\n newSize[index] += previousSize;\n\n const widgetToCollapse = newSize\n .map(sz => sz - previousSize > 0)\n .lastIndexOf(true);\n if (widgetToCollapse === -1) {\n // Can not reduce the size of one widget, reduce all opened widgets\n // proportionally with its size.\n newSize.forEach((_, idx) => {\n if (idx !== index) {\n newSize[idx] -=\n (widgetSizes[idx] / totalSize) * (previousSize - delta);\n }\n });\n } else {\n newSize[widgetToCollapse] -= previousSize - delta;\n }\n }\n return newSize.map(sz => sz / (totalSize + delta));\n }\n /**\n * Handle the `'click'` event for the accordion panel\n */\n private _evtClick(event: MouseEvent): void {\n const target = event.target as HTMLElement | null;\n\n if (target) {\n const index = ArrayExt.findFirstIndex(this.titles, title => {\n return title.contains(target);\n });\n\n if (index >= 0) {\n event.preventDefault();\n event.stopPropagation();\n this._toggleExpansion(index);\n }\n }\n }\n\n /**\n * Handle the `'keydown'` event for the accordion panel.\n */\n private _eventKeyDown(event: KeyboardEvent): void {\n if (event.defaultPrevented) {\n return;\n }\n\n const target = event.target as HTMLElement | null;\n let handled = false;\n if (target) {\n const index = ArrayExt.findFirstIndex(this.titles, title => {\n return title.contains(target);\n });\n\n if (index >= 0) {\n const keyCode = event.keyCode.toString();\n\n // If Space or Enter is pressed on title, emulate click event\n if (event.key.match(/Space|Enter/) || keyCode.match(/13|32/)) {\n target.click();\n handled = true;\n } else if (\n this.orientation === 'horizontal'\n ? event.key.match(/ArrowLeft|ArrowRight/) || keyCode.match(/37|39/)\n : event.key.match(/ArrowUp|ArrowDown/) || keyCode.match(/38|40/)\n ) {\n // If Up or Down (for vertical) / Left or Right (for horizontal) is pressed on title, loop on titles\n const direction =\n event.key.match(/ArrowLeft|ArrowUp/) || keyCode.match(/37|38/)\n ? -1\n : 1;\n const length = this.titles.length;\n const newIndex = (index + length + direction) % length;\n\n this.titles[newIndex].focus();\n handled = true;\n } else if (event.key === 'End' || keyCode === '35') {\n // If End is pressed on title, focus on the last title\n this.titles[this.titles.length - 1].focus();\n handled = true;\n } else if (event.key === 'Home' || keyCode === '36') {\n // If Home is pressed on title, focus on the first title\n this.titles[0].focus();\n handled = true;\n }\n }\n\n if (handled) {\n event.preventDefault();\n }\n }\n }\n\n private _toggleExpansion(index: number) {\n const title = this.titles[index];\n const widget = (this.layout as AccordionLayout).widgets[index];\n\n const newSize = this._computeWidgetSize(index);\n if (newSize) {\n this.setRelativeSizes(newSize, false);\n }\n\n if (widget.isHidden) {\n title.classList.add('lm-mod-expanded');\n title.setAttribute('aria-expanded', 'true');\n widget.show();\n } else {\n title.classList.remove('lm-mod-expanded');\n title.setAttribute('aria-expanded', 'false');\n widget.hide();\n }\n\n // Emit the expansion state signal.\n this._expansionToggled.emit(index);\n }\n\n private _widgetSizesCache: WeakMap = new WeakMap();\n private _expansionToggled = new Signal(this);\n}\n\n/**\n * The namespace for the `AccordionPanel` class statics.\n */\nexport namespace AccordionPanel {\n /**\n * A type alias for a accordion panel orientation.\n */\n export type Orientation = SplitLayout.Orientation;\n\n /**\n * A type alias for a accordion panel alignment.\n */\n export type Alignment = SplitLayout.Alignment;\n\n /**\n * A type alias for a accordion panel renderer.\n */\n export type IRenderer = AccordionLayout.IRenderer;\n\n /**\n * An options object for initializing a accordion panel.\n */\n export interface IOptions extends Partial {\n /**\n * The accordion layout to use for the accordion panel.\n *\n * If this is provided, the other options are ignored.\n *\n * The default is a new `AccordionLayout`.\n */\n layout?: AccordionLayout;\n }\n\n /**\n * The default implementation of `IRenderer`.\n */\n export class Renderer extends SplitPanel.Renderer implements IRenderer {\n constructor() {\n super();\n this._uuid = ++Renderer._nInstance;\n }\n /**\n * A selector which matches any title node in the accordion.\n */\n readonly titleClassName = 'lm-AccordionPanel-title';\n\n /**\n * Render the collapse indicator for a section title.\n *\n * @param data - The data to use for rendering the section title.\n *\n * @returns A element representing the collapse indicator.\n */\n createCollapseIcon(data: Title): HTMLElement {\n return document.createElement('span');\n }\n\n /**\n * Render the element for a section title.\n *\n * @param data - The data to use for rendering the section title.\n *\n * @returns A element representing the section title.\n */\n createSectionTitle(data: Title): HTMLElement {\n const handle = document.createElement('h3');\n handle.setAttribute('tabindex', '0');\n handle.id = this.createTitleKey(data);\n handle.className = this.titleClassName;\n for (const aData in data.dataset) {\n handle.dataset[aData] = data.dataset[aData];\n }\n\n const collapser = handle.appendChild(this.createCollapseIcon(data));\n collapser.className = 'lm-AccordionPanel-titleCollapser';\n\n const label = handle.appendChild(document.createElement('span'));\n label.className = 'lm-AccordionPanel-titleLabel';\n label.textContent = data.label;\n label.title = data.caption || data.label;\n\n return handle;\n }\n\n /**\n * Create a unique render key for the title.\n *\n * @param data - The data to use for the title.\n *\n * @returns The unique render key for the title.\n *\n * #### Notes\n * This method caches the key against the section title the first time\n * the key is generated.\n */\n createTitleKey(data: Title): string {\n let key = this._titleKeys.get(data);\n if (key === undefined) {\n key = `title-key-${this._uuid}-${this._titleID++}`;\n this._titleKeys.set(data, key);\n }\n return key;\n }\n\n private static _nInstance = 0;\n private readonly _uuid: number;\n private _titleID = 0;\n private _titleKeys = new WeakMap, string>();\n }\n\n /**\n * The default `Renderer` instance.\n */\n export const defaultRenderer = new Renderer();\n}\n\nnamespace Private {\n /**\n * Create an accordion layout for the given panel options.\n *\n * @param options Panel options\n * @returns Panel layout\n */\n export function createLayout(\n options: AccordionPanel.IOptions\n ): AccordionLayout {\n return (\n options.layout ||\n new AccordionLayout({\n renderer: options.renderer || AccordionPanel.defaultRenderer,\n orientation: options.orientation,\n alignment: options.alignment,\n spacing: options.spacing,\n titleSpace: options.titleSpace\n })\n );\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { AttachedProperty } from '@lumino/properties';\n\nimport { BoxEngine, BoxSizer } from './boxengine';\n\nimport { LayoutItem } from './layout';\n\nimport { PanelLayout } from './panellayout';\n\nimport Utils from './utils';\n\nimport { Widget } from './widget';\n\n/**\n * A layout which arranges its widgets in a single row or column.\n */\nexport class BoxLayout extends PanelLayout {\n /**\n * Construct a new box layout.\n *\n * @param options - The options for initializing the layout.\n */\n constructor(options: BoxLayout.IOptions = {}) {\n super();\n if (options.direction !== undefined) {\n this._direction = options.direction;\n }\n if (options.alignment !== undefined) {\n this._alignment = options.alignment;\n }\n if (options.spacing !== undefined) {\n this._spacing = Utils.clampDimension(options.spacing);\n }\n }\n\n /**\n * Dispose of the resources held by the layout.\n */\n dispose(): void {\n // Dispose of the layout items.\n for (const item of this._items) {\n item.dispose();\n }\n\n // Clear the layout state.\n this._box = null;\n this._items.length = 0;\n this._sizers.length = 0;\n\n // Dispose of the rest of the layout.\n super.dispose();\n }\n\n /**\n * Get the layout direction for the box layout.\n */\n get direction(): BoxLayout.Direction {\n return this._direction;\n }\n\n /**\n * Set the layout direction for the box layout.\n */\n set direction(value: BoxLayout.Direction) {\n if (this._direction === value) {\n return;\n }\n this._direction = value;\n if (!this.parent) {\n return;\n }\n this.parent.dataset['direction'] = value;\n this.parent.fit();\n }\n\n /**\n * Get the content alignment for the box layout.\n *\n * #### Notes\n * This is the alignment of the widgets in the layout direction.\n *\n * The alignment has no effect if the widgets can expand to fill the\n * entire box layout.\n */\n get alignment(): BoxLayout.Alignment {\n return this._alignment;\n }\n\n /**\n * Set the content alignment for the box layout.\n *\n * #### Notes\n * This is the alignment of the widgets in the layout direction.\n *\n * The alignment has no effect if the widgets can expand to fill the\n * entire box layout.\n */\n set alignment(value: BoxLayout.Alignment) {\n if (this._alignment === value) {\n return;\n }\n this._alignment = value;\n if (!this.parent) {\n return;\n }\n this.parent.dataset['alignment'] = value;\n this.parent.update();\n }\n\n /**\n * Get the inter-element spacing for the box layout.\n */\n get spacing(): number {\n return this._spacing;\n }\n\n /**\n * Set the inter-element spacing for the box layout.\n */\n set spacing(value: number) {\n value = Utils.clampDimension(value);\n if (this._spacing === value) {\n return;\n }\n this._spacing = value;\n if (!this.parent) {\n return;\n }\n this.parent.fit();\n }\n\n /**\n * Perform layout initialization which requires the parent widget.\n */\n protected init(): void {\n this.parent!.dataset['direction'] = this.direction;\n this.parent!.dataset['alignment'] = this.alignment;\n super.init();\n }\n\n /**\n * Attach a widget to the parent's DOM node.\n *\n * @param index - The current index of the widget in the layout.\n *\n * @param widget - The widget to attach to the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected attachWidget(index: number, widget: Widget): void {\n // Create and add a new layout item for the widget.\n ArrayExt.insert(this._items, index, new LayoutItem(widget));\n\n // Create and add a new sizer for the widget.\n ArrayExt.insert(this._sizers, index, new BoxSizer());\n\n // Send a `'before-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n }\n\n // Add the widget's node to the parent.\n this.parent!.node.appendChild(widget.node);\n\n // Send an `'after-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n\n // Post a fit request for the parent widget.\n this.parent!.fit();\n }\n\n /**\n * Move a widget in the parent's DOM node.\n *\n * @param fromIndex - The previous index of the widget in the layout.\n *\n * @param toIndex - The current index of the widget in the layout.\n *\n * @param widget - The widget to move in the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected moveWidget(\n fromIndex: number,\n toIndex: number,\n widget: Widget\n ): void {\n // Move the layout item for the widget.\n ArrayExt.move(this._items, fromIndex, toIndex);\n\n // Move the sizer for the widget.\n ArrayExt.move(this._sizers, fromIndex, toIndex);\n\n // Post an update request for the parent widget.\n this.parent!.update();\n }\n\n /**\n * Detach a widget from the parent's DOM node.\n *\n * @param index - The previous index of the widget in the layout.\n *\n * @param widget - The widget to detach from the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected detachWidget(index: number, widget: Widget): void {\n // Remove the layout item for the widget.\n let item = ArrayExt.removeAt(this._items, index);\n\n // Remove the sizer for the widget.\n ArrayExt.removeAt(this._sizers, index);\n\n // Send a `'before-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n }\n\n // Remove the widget's node from the parent.\n this.parent!.node.removeChild(widget.node);\n\n // Send an `'after-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n\n // Dispose of the layout item.\n item!.dispose();\n\n // Post a fit request for the parent widget.\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'before-show'` message.\n */\n protected onBeforeShow(msg: Message): void {\n super.onBeforeShow(msg);\n this.parent!.update();\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n super.onBeforeAttach(msg);\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-shown'` message.\n */\n protected onChildShown(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-hidden'` message.\n */\n protected onChildHidden(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'resize'` message.\n */\n protected onResize(msg: Widget.ResizeMessage): void {\n if (this.parent!.isVisible) {\n this._update(msg.width, msg.height);\n }\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n protected onUpdateRequest(msg: Message): void {\n if (this.parent!.isVisible) {\n this._update(-1, -1);\n }\n }\n\n /**\n * A message handler invoked on a `'fit-request'` message.\n */\n protected onFitRequest(msg: Message): void {\n if (this.parent!.isAttached) {\n this._fit();\n }\n }\n\n /**\n * Fit the layout to the total size required by the widgets.\n */\n private _fit(): void {\n // Compute the visible item count.\n let nVisible = 0;\n for (let i = 0, n = this._items.length; i < n; ++i) {\n nVisible += +!this._items[i].isHidden;\n }\n\n // Update the fixed space for the visible items.\n this._fixed = this._spacing * Math.max(0, nVisible - 1);\n\n // Setup the computed minimum size.\n let horz = Private.isHorizontal(this._direction);\n let minW = horz ? this._fixed : 0;\n let minH = horz ? 0 : this._fixed;\n\n // Update the sizers and computed minimum size.\n for (let i = 0, n = this._items.length; i < n; ++i) {\n // Fetch the item and corresponding box sizer.\n let item = this._items[i];\n let sizer = this._sizers[i];\n\n // If the item is hidden, it should consume zero size.\n if (item.isHidden) {\n sizer.minSize = 0;\n sizer.maxSize = 0;\n continue;\n }\n\n // Update the size limits for the item.\n item.fit();\n\n // Update the size basis and stretch factor.\n sizer.sizeHint = BoxLayout.getSizeBasis(item.widget);\n sizer.stretch = BoxLayout.getStretch(item.widget);\n\n // Update the sizer limits and computed min size.\n if (horz) {\n sizer.minSize = item.minWidth;\n sizer.maxSize = item.maxWidth;\n minW += item.minWidth;\n minH = Math.max(minH, item.minHeight);\n } else {\n sizer.minSize = item.minHeight;\n sizer.maxSize = item.maxHeight;\n minH += item.minHeight;\n minW = Math.max(minW, item.minWidth);\n }\n }\n\n // Update the box sizing and add it to the computed min size.\n let box = (this._box = ElementExt.boxSizing(this.parent!.node));\n minW += box.horizontalSum;\n minH += box.verticalSum;\n\n // Update the parent's min size constraints.\n let style = this.parent!.node.style;\n style.minWidth = `${minW}px`;\n style.minHeight = `${minH}px`;\n\n // Set the dirty flag to ensure only a single update occurs.\n this._dirty = true;\n\n // Notify the ancestor that it should fit immediately. This may\n // cause a resize of the parent, fulfilling the required update.\n if (this.parent!.parent) {\n MessageLoop.sendMessage(this.parent!.parent!, Widget.Msg.FitRequest);\n }\n\n // If the dirty flag is still set, the parent was not resized.\n // Trigger the required update on the parent widget immediately.\n if (this._dirty) {\n MessageLoop.sendMessage(this.parent!, Widget.Msg.UpdateRequest);\n }\n }\n\n /**\n * Update the layout position and size of the widgets.\n *\n * The parent offset dimensions should be `-1` if unknown.\n */\n private _update(offsetWidth: number, offsetHeight: number): void {\n // Clear the dirty flag to indicate the update occurred.\n this._dirty = false;\n\n // Compute the visible item count.\n let nVisible = 0;\n for (let i = 0, n = this._items.length; i < n; ++i) {\n nVisible += +!this._items[i].isHidden;\n }\n\n // Bail early if there are no visible items to layout.\n if (nVisible === 0) {\n return;\n }\n\n // Measure the parent if the offset dimensions are unknown.\n if (offsetWidth < 0) {\n offsetWidth = this.parent!.node.offsetWidth;\n }\n if (offsetHeight < 0) {\n offsetHeight = this.parent!.node.offsetHeight;\n }\n\n // Ensure the parent box sizing data is computed.\n if (!this._box) {\n this._box = ElementExt.boxSizing(this.parent!.node);\n }\n\n // Compute the layout area adjusted for border and padding.\n let top = this._box.paddingTop;\n let left = this._box.paddingLeft;\n let width = offsetWidth - this._box.horizontalSum;\n let height = offsetHeight - this._box.verticalSum;\n\n // Distribute the layout space and adjust the start position.\n let delta: number;\n switch (this._direction) {\n case 'left-to-right':\n delta = BoxEngine.calc(this._sizers, Math.max(0, width - this._fixed));\n break;\n case 'top-to-bottom':\n delta = BoxEngine.calc(this._sizers, Math.max(0, height - this._fixed));\n break;\n case 'right-to-left':\n delta = BoxEngine.calc(this._sizers, Math.max(0, width - this._fixed));\n left += width;\n break;\n case 'bottom-to-top':\n delta = BoxEngine.calc(this._sizers, Math.max(0, height - this._fixed));\n top += height;\n break;\n default:\n throw 'unreachable';\n }\n\n // Setup the variables for justification and alignment offset.\n let extra = 0;\n let offset = 0;\n\n // Account for alignment if there is extra layout space.\n if (delta > 0) {\n switch (this._alignment) {\n case 'start':\n break;\n case 'center':\n extra = 0;\n offset = delta / 2;\n break;\n case 'end':\n extra = 0;\n offset = delta;\n break;\n case 'justify':\n extra = delta / nVisible;\n offset = 0;\n break;\n default:\n throw 'unreachable';\n }\n }\n\n // Layout the items using the computed box sizes.\n for (let i = 0, n = this._items.length; i < n; ++i) {\n // Fetch the item.\n let item = this._items[i];\n\n // Ignore hidden items.\n if (item.isHidden) {\n continue;\n }\n\n // Fetch the computed size for the widget.\n let size = this._sizers[i].size;\n\n // Update the widget geometry and advance the relevant edge.\n switch (this._direction) {\n case 'left-to-right':\n item.update(left + offset, top, size + extra, height);\n left += size + extra + this._spacing;\n break;\n case 'top-to-bottom':\n item.update(left, top + offset, width, size + extra);\n top += size + extra + this._spacing;\n break;\n case 'right-to-left':\n item.update(left - offset - size - extra, top, size + extra, height);\n left -= size + extra + this._spacing;\n break;\n case 'bottom-to-top':\n item.update(left, top - offset - size - extra, width, size + extra);\n top -= size + extra + this._spacing;\n break;\n default:\n throw 'unreachable';\n }\n }\n }\n\n private _fixed = 0;\n private _spacing = 4;\n private _dirty = false;\n private _sizers: BoxSizer[] = [];\n private _items: LayoutItem[] = [];\n private _box: ElementExt.IBoxSizing | null = null;\n private _alignment: BoxLayout.Alignment = 'start';\n private _direction: BoxLayout.Direction = 'top-to-bottom';\n}\n\n/**\n * The namespace for the `BoxLayout` class statics.\n */\nexport namespace BoxLayout {\n /**\n * A type alias for a box layout direction.\n */\n export type Direction =\n | 'left-to-right'\n | 'right-to-left'\n | 'top-to-bottom'\n | 'bottom-to-top';\n\n /**\n * A type alias for a box layout alignment.\n */\n export type Alignment = 'start' | 'center' | 'end' | 'justify';\n\n /**\n * An options object for initializing a box layout.\n */\n export interface IOptions {\n /**\n * The direction of the layout.\n *\n * The default is `'top-to-bottom'`.\n */\n direction?: Direction;\n\n /**\n * The content alignment of the layout.\n *\n * The default is `'start'`.\n */\n alignment?: Alignment;\n\n /**\n * The spacing between items in the layout.\n *\n * The default is `4`.\n */\n spacing?: number;\n }\n\n /**\n * Get the box layout stretch factor for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The box layout stretch factor for the widget.\n */\n export function getStretch(widget: Widget): number {\n return Private.stretchProperty.get(widget);\n }\n\n /**\n * Set the box layout stretch factor for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the stretch factor.\n */\n export function setStretch(widget: Widget, value: number): void {\n Private.stretchProperty.set(widget, value);\n }\n\n /**\n * Get the box layout size basis for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The box layout size basis for the widget.\n */\n export function getSizeBasis(widget: Widget): number {\n return Private.sizeBasisProperty.get(widget);\n }\n\n /**\n * Set the box layout size basis for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the size basis.\n */\n export function setSizeBasis(widget: Widget, value: number): void {\n Private.sizeBasisProperty.set(widget, value);\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * The property descriptor for a widget stretch factor.\n */\n export const stretchProperty = new AttachedProperty({\n name: 'stretch',\n create: () => 0,\n coerce: (owner, value) => Math.max(0, Math.floor(value)),\n changed: onChildSizingChanged\n });\n\n /**\n * The property descriptor for a widget size basis.\n */\n export const sizeBasisProperty = new AttachedProperty({\n name: 'sizeBasis',\n create: () => 0,\n coerce: (owner, value) => Math.max(0, Math.floor(value)),\n changed: onChildSizingChanged\n });\n\n /**\n * Test whether a direction has horizontal orientation.\n */\n export function isHorizontal(dir: BoxLayout.Direction): boolean {\n return dir === 'left-to-right' || dir === 'right-to-left';\n }\n\n /**\n * Clamp a spacing value to an integer >= 0.\n */\n export function clampSpacing(value: number): number {\n return Math.max(0, Math.floor(value));\n }\n\n /**\n * The change handler for the attached sizing properties.\n */\n function onChildSizingChanged(child: Widget): void {\n if (child.parent && child.parent.layout instanceof BoxLayout) {\n child.parent.fit();\n }\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { BoxLayout } from './boxlayout';\n\nimport { Panel } from './panel';\n\nimport { Widget } from './widget';\n\n/**\n * A panel which arranges its widgets in a single row or column.\n *\n * #### Notes\n * This class provides a convenience wrapper around a {@link BoxLayout}.\n */\nexport class BoxPanel extends Panel {\n /**\n * Construct a new box panel.\n *\n * @param options - The options for initializing the box panel.\n */\n constructor(options: BoxPanel.IOptions = {}) {\n super({ layout: Private.createLayout(options) });\n this.addClass('lm-BoxPanel');\n }\n\n /**\n * Get the layout direction for the box panel.\n */\n get direction(): BoxPanel.Direction {\n return (this.layout as BoxLayout).direction;\n }\n\n /**\n * Set the layout direction for the box panel.\n */\n set direction(value: BoxPanel.Direction) {\n (this.layout as BoxLayout).direction = value;\n }\n\n /**\n * Get the content alignment for the box panel.\n *\n * #### Notes\n * This is the alignment of the widgets in the layout direction.\n *\n * The alignment has no effect if the widgets can expand to fill the\n * entire box layout.\n */\n get alignment(): BoxPanel.Alignment {\n return (this.layout as BoxLayout).alignment;\n }\n\n /**\n * Set the content alignment for the box panel.\n *\n * #### Notes\n * This is the alignment of the widgets in the layout direction.\n *\n * The alignment has no effect if the widgets can expand to fill the\n * entire box layout.\n */\n set alignment(value: BoxPanel.Alignment) {\n (this.layout as BoxLayout).alignment = value;\n }\n\n /**\n * Get the inter-element spacing for the box panel.\n */\n get spacing(): number {\n return (this.layout as BoxLayout).spacing;\n }\n\n /**\n * Set the inter-element spacing for the box panel.\n */\n set spacing(value: number) {\n (this.layout as BoxLayout).spacing = value;\n }\n\n /**\n * A message handler invoked on a `'child-added'` message.\n */\n protected onChildAdded(msg: Widget.ChildMessage): void {\n msg.child.addClass('lm-BoxPanel-child');\n }\n\n /**\n * A message handler invoked on a `'child-removed'` message.\n */\n protected onChildRemoved(msg: Widget.ChildMessage): void {\n msg.child.removeClass('lm-BoxPanel-child');\n }\n}\n\n/**\n * The namespace for the `BoxPanel` class statics.\n */\nexport namespace BoxPanel {\n /**\n * A type alias for a box panel direction.\n */\n export type Direction = BoxLayout.Direction;\n\n /**\n * A type alias for a box panel alignment.\n */\n export type Alignment = BoxLayout.Alignment;\n\n /**\n * An options object for initializing a box panel.\n */\n export interface IOptions {\n /**\n * The layout direction of the panel.\n *\n * Possible values are documented in {@link BoxLayout.Direction}.\n *\n * The default is `'top-to-bottom'`.\n */\n direction?: Direction;\n\n /**\n * The content alignment of the panel.\n *\n * Possible values are documented in {@link BoxLayout.Alignment}.\n *\n * The default is `'start'`.\n */\n alignment?: Alignment;\n\n /**\n * The spacing between items in the panel.\n *\n * The default is `4`.\n */\n spacing?: number;\n\n /**\n * The box layout to use for the box panel.\n *\n * If this is provided, the other options are ignored.\n *\n * The default is a new `BoxLayout`.\n */\n layout?: BoxLayout;\n }\n\n /**\n * Get the box panel stretch factor for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The box panel stretch factor for the widget.\n */\n export function getStretch(widget: Widget): number {\n return BoxLayout.getStretch(widget);\n }\n\n /**\n * Set the box panel stretch factor for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the stretch factor.\n */\n export function setStretch(widget: Widget, value: number): void {\n BoxLayout.setStretch(widget, value);\n }\n\n /**\n * Get the box panel size basis for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The box panel size basis for the widget.\n */\n export function getSizeBasis(widget: Widget): number {\n return BoxLayout.getSizeBasis(widget);\n }\n\n /**\n * Set the box panel size basis for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the size basis.\n */\n export function setSizeBasis(widget: Widget, value: number): void {\n BoxLayout.setSizeBasis(widget, value);\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * Create a box layout for the given panel options.\n */\n export function createLayout(options: BoxPanel.IOptions): BoxLayout {\n return options.layout || new BoxLayout(options);\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt, StringExt } from '@lumino/algorithm';\n\nimport { JSONExt, ReadonlyJSONObject } from '@lumino/coreutils';\n\nimport { CommandRegistry } from '@lumino/commands';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message } from '@lumino/messaging';\n\nimport {\n ElementDataset,\n h,\n VirtualDOM,\n VirtualElement\n} from '@lumino/virtualdom';\n\nimport { Widget } from './widget';\n\n/**\n * A widget which displays command items as a searchable palette.\n */\nexport class CommandPalette extends Widget {\n /**\n * Construct a new command palette.\n *\n * @param options - The options for initializing the palette.\n */\n constructor(options: CommandPalette.IOptions) {\n super({ node: Private.createNode() });\n this.addClass('lm-CommandPalette');\n this.setFlag(Widget.Flag.DisallowLayout);\n this.commands = options.commands;\n this.renderer = options.renderer || CommandPalette.defaultRenderer;\n this.commands.commandChanged.connect(this._onGenericChange, this);\n this.commands.keyBindingChanged.connect(this._onGenericChange, this);\n }\n\n /**\n * Dispose of the resources held by the widget.\n */\n dispose(): void {\n this._items.length = 0;\n this._results = null;\n super.dispose();\n }\n\n /**\n * The command registry used by the command palette.\n */\n readonly commands: CommandRegistry;\n\n /**\n * The renderer used by the command palette.\n */\n readonly renderer: CommandPalette.IRenderer;\n\n /**\n * The command palette search node.\n *\n * #### Notes\n * This is the node which contains the search-related elements.\n */\n get searchNode(): HTMLDivElement {\n return this.node.getElementsByClassName(\n 'lm-CommandPalette-search'\n )[0] as HTMLDivElement;\n }\n\n /**\n * The command palette input node.\n *\n * #### Notes\n * This is the actual input node for the search area.\n */\n get inputNode(): HTMLInputElement {\n return this.node.getElementsByClassName(\n 'lm-CommandPalette-input'\n )[0] as HTMLInputElement;\n }\n\n /**\n * The command palette content node.\n *\n * #### Notes\n * This is the node which holds the command item nodes.\n *\n * Modifying this node directly can lead to undefined behavior.\n */\n get contentNode(): HTMLUListElement {\n return this.node.getElementsByClassName(\n 'lm-CommandPalette-content'\n )[0] as HTMLUListElement;\n }\n\n /**\n * A read-only array of the command items in the palette.\n */\n get items(): ReadonlyArray {\n return this._items;\n }\n\n /**\n * Add a command item to the command palette.\n *\n * @param options - The options for creating the command item.\n *\n * @returns The command item added to the palette.\n */\n addItem(options: CommandPalette.IItemOptions): CommandPalette.IItem {\n // Create a new command item for the options.\n let item = Private.createItem(this.commands, options);\n\n // Add the item to the array.\n this._items.push(item);\n\n // Refresh the search results.\n this.refresh();\n\n // Return the item added to the palette.\n return item;\n }\n\n /**\n * Adds command items to the command palette.\n *\n * @param items - An array of options for creating each command item.\n *\n * @returns The command items added to the palette.\n */\n addItems(items: CommandPalette.IItemOptions[]): CommandPalette.IItem[] {\n const newItems = items.map(item => Private.createItem(this.commands, item));\n newItems.forEach(item => this._items.push(item));\n this.refresh();\n return newItems;\n }\n\n /**\n * Remove an item from the command palette.\n *\n * @param item - The item to remove from the palette.\n *\n * #### Notes\n * This is a no-op if the item is not in the palette.\n */\n removeItem(item: CommandPalette.IItem): void {\n this.removeItemAt(this._items.indexOf(item));\n }\n\n /**\n * Remove the item at a given index from the command palette.\n *\n * @param index - The index of the item to remove.\n *\n * #### Notes\n * This is a no-op if the index is out of range.\n */\n removeItemAt(index: number): void {\n // Remove the item from the array.\n let item = ArrayExt.removeAt(this._items, index);\n\n // Bail if the index is out of range.\n if (!item) {\n return;\n }\n\n // Refresh the search results.\n this.refresh();\n }\n\n /**\n * Remove all items from the command palette.\n */\n clearItems(): void {\n // Bail if there is nothing to remove.\n if (this._items.length === 0) {\n return;\n }\n\n // Clear the array of items.\n this._items.length = 0;\n\n // Refresh the search results.\n this.refresh();\n }\n\n /**\n * Clear the search results and schedule an update.\n *\n * #### Notes\n * This should be called whenever the search results of the palette\n * should be updated.\n *\n * This is typically called automatically by the palette as needed,\n * but can be called manually if the input text is programatically\n * changed.\n *\n * The rendered results are updated asynchronously.\n */\n refresh(): void {\n this._results = null;\n if (this.inputNode.value !== '') {\n let clear = this.node.getElementsByClassName(\n 'lm-close-icon'\n )[0] as HTMLInputElement;\n clear.style.display = 'inherit';\n } else {\n let clear = this.node.getElementsByClassName(\n 'lm-close-icon'\n )[0] as HTMLInputElement;\n clear.style.display = 'none';\n }\n this.update();\n }\n\n /**\n * Handle the DOM events for the command palette.\n *\n * @param event - The DOM event sent to the command palette.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the command palette's DOM node.\n * It should not be called directly by user code.\n */\n handleEvent(event: Event): void {\n switch (event.type) {\n case 'click':\n this._evtClick(event as MouseEvent);\n break;\n case 'keydown':\n this._evtKeyDown(event as KeyboardEvent);\n break;\n case 'input':\n this.refresh();\n break;\n case 'focus':\n case 'blur':\n this._toggleFocused();\n break;\n }\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n this.node.addEventListener('click', this);\n this.node.addEventListener('keydown', this);\n this.node.addEventListener('input', this);\n this.node.addEventListener('focus', this, true);\n this.node.addEventListener('blur', this, true);\n }\n\n /**\n * A message handler invoked on an `'after-detach'` message.\n */\n protected onAfterDetach(msg: Message): void {\n this.node.removeEventListener('click', this);\n this.node.removeEventListener('keydown', this);\n this.node.removeEventListener('input', this);\n this.node.removeEventListener('focus', this, true);\n this.node.removeEventListener('blur', this, true);\n }\n\n /**\n * A message handler invoked on an `'after-show'` message.\n */\n protected onAfterShow(msg: Message): void {\n this.update();\n super.onAfterShow(msg);\n }\n\n /**\n * A message handler invoked on an `'activate-request'` message.\n */\n protected onActivateRequest(msg: Message): void {\n if (this.isAttached) {\n let input = this.inputNode;\n input.focus();\n input.select();\n }\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n protected onUpdateRequest(msg: Message): void {\n if (!this.isVisible) {\n // Ensure to clear the content if the widget is hidden\n VirtualDOM.render(null, this.contentNode);\n return;\n }\n\n // Fetch the current query text and content node.\n let query = this.inputNode.value;\n let contentNode = this.contentNode;\n\n // Ensure the search results are generated.\n let results = this._results;\n if (!results) {\n // Generate and store the new search results.\n results = this._results = Private.search(this._items, query);\n\n // Reset the active index.\n this._activeIndex = query\n ? ArrayExt.findFirstIndex(results, Private.canActivate)\n : -1;\n }\n\n // If there is no query and no results, clear the content.\n if (!query && results.length === 0) {\n VirtualDOM.render(null, contentNode);\n return;\n }\n\n // If the is a query but no results, render the empty message.\n if (query && results.length === 0) {\n let content = this.renderer.renderEmptyMessage({ query });\n VirtualDOM.render(content, contentNode);\n return;\n }\n\n // Create the render content for the search results.\n let renderer = this.renderer;\n let activeIndex = this._activeIndex;\n let content = new Array(results.length);\n for (let i = 0, n = results.length; i < n; ++i) {\n let result = results[i];\n if (result.type === 'header') {\n let indices = result.indices;\n let category = result.category;\n content[i] = renderer.renderHeader({ category, indices });\n } else {\n let item = result.item;\n let indices = result.indices;\n let active = i === activeIndex;\n content[i] = renderer.renderItem({ item, indices, active });\n }\n }\n\n // Render the search result content.\n VirtualDOM.render(content, contentNode);\n\n // Adjust the scroll position as needed.\n if (activeIndex < 0 || activeIndex >= results.length) {\n contentNode.scrollTop = 0;\n } else {\n let element = contentNode.children[activeIndex];\n ElementExt.scrollIntoViewIfNeeded(contentNode, element);\n }\n }\n\n /**\n * Handle the `'click'` event for the command palette.\n */\n private _evtClick(event: MouseEvent): void {\n // Bail if the click is not the left button.\n if (event.button !== 0) {\n return;\n }\n\n // Clear input if the target is clear button\n if ((event.target as HTMLElement).classList.contains('lm-close-icon')) {\n this.inputNode.value = '';\n this.refresh();\n return;\n }\n\n // Find the index of the item which was clicked.\n let index = ArrayExt.findFirstIndex(this.contentNode.children, node => {\n return node.contains(event.target as HTMLElement);\n });\n\n // Bail if the click was not on an item.\n if (index === -1) {\n return;\n }\n\n // Kill the event when a content item is clicked.\n event.preventDefault();\n event.stopPropagation();\n\n // Execute the item if possible.\n this._execute(index);\n }\n\n /**\n * Handle the `'keydown'` event for the command palette.\n */\n private _evtKeyDown(event: KeyboardEvent): void {\n if (event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) {\n return;\n }\n switch (event.keyCode) {\n case 13: // Enter\n event.preventDefault();\n event.stopPropagation();\n this._execute(this._activeIndex);\n break;\n case 38: // Up Arrow\n event.preventDefault();\n event.stopPropagation();\n this._activatePreviousItem();\n break;\n case 40: // Down Arrow\n event.preventDefault();\n event.stopPropagation();\n this._activateNextItem();\n break;\n }\n }\n\n /**\n * Activate the next enabled command item.\n */\n private _activateNextItem(): void {\n // Bail if there are no search results.\n if (!this._results || this._results.length === 0) {\n return;\n }\n\n // Find the next enabled item index.\n let ai = this._activeIndex;\n let n = this._results.length;\n let start = ai < n - 1 ? ai + 1 : 0;\n let stop = start === 0 ? n - 1 : start - 1;\n this._activeIndex = ArrayExt.findFirstIndex(\n this._results,\n Private.canActivate,\n start,\n stop\n );\n\n // Schedule an update of the items.\n this.update();\n }\n\n /**\n * Activate the previous enabled command item.\n */\n private _activatePreviousItem(): void {\n // Bail if there are no search results.\n if (!this._results || this._results.length === 0) {\n return;\n }\n\n // Find the previous enabled item index.\n let ai = this._activeIndex;\n let n = this._results.length;\n let start = ai <= 0 ? n - 1 : ai - 1;\n let stop = start === n - 1 ? 0 : start + 1;\n this._activeIndex = ArrayExt.findLastIndex(\n this._results,\n Private.canActivate,\n start,\n stop\n );\n\n // Schedule an update of the items.\n this.update();\n }\n\n /**\n * Execute the command item at the given index, if possible.\n */\n private _execute(index: number): void {\n // Bail if there are no search results.\n if (!this._results) {\n return;\n }\n\n // Bail if the index is out of range.\n let part = this._results[index];\n if (!part) {\n return;\n }\n\n // Update the search text if the item is a header.\n if (part.type === 'header') {\n let input = this.inputNode;\n input.value = `${part.category.toLowerCase()} `;\n input.focus();\n this.refresh();\n return;\n }\n\n // Bail if item is not enabled.\n if (!part.item.isEnabled) {\n return;\n }\n\n // Execute the item.\n this.commands.execute(part.item.command, part.item.args);\n\n // Clear the query text.\n this.inputNode.value = '';\n\n // Refresh the search results.\n this.refresh();\n }\n\n /**\n * Toggle the focused modifier based on the input node focus state.\n */\n private _toggleFocused(): void {\n let focused = document.activeElement === this.inputNode;\n this.toggleClass('lm-mod-focused', focused);\n }\n\n /**\n * A signal handler for generic command changes.\n */\n private _onGenericChange(): void {\n this.refresh();\n }\n\n private _activeIndex = -1;\n private _items: CommandPalette.IItem[] = [];\n private _results: Private.SearchResult[] | null = null;\n}\n\n/**\n * The namespace for the `CommandPalette` class statics.\n */\nexport namespace CommandPalette {\n /**\n * An options object for creating a command palette.\n */\n export interface IOptions {\n /**\n * The command registry for use with the command palette.\n */\n commands: CommandRegistry;\n\n /**\n * A custom renderer for use with the command palette.\n *\n * The default is a shared renderer instance.\n */\n renderer?: IRenderer;\n }\n\n /**\n * An options object for creating a command item.\n */\n export interface IItemOptions {\n /**\n * The category for the item.\n */\n category: string;\n\n /**\n * The command to execute when the item is triggered.\n */\n command: string;\n\n /**\n * The arguments for the command.\n *\n * The default value is an empty object.\n */\n args?: ReadonlyJSONObject;\n\n /**\n * The rank for the command item.\n *\n * The rank is used as a tie-breaker when ordering command items\n * for display. Items are sorted in the following order:\n * 1. Text match (lower is better)\n * 2. Category (locale order)\n * 3. Rank (lower is better)\n * 4. Label (locale order)\n *\n * The default rank is `Infinity`.\n */\n rank?: number;\n }\n\n /**\n * An object which represents an item in a command palette.\n *\n * #### Notes\n * Item objects are created automatically by a command palette.\n */\n export interface IItem {\n /**\n * The command to execute when the item is triggered.\n */\n readonly command: string;\n\n /**\n * The arguments for the command.\n */\n readonly args: ReadonlyJSONObject;\n\n /**\n * The category for the command item.\n */\n readonly category: string;\n\n /**\n * The rank for the command item.\n */\n readonly rank: number;\n\n /**\n * The display label for the command item.\n */\n readonly label: string;\n\n /**\n * The display caption for the command item.\n */\n readonly caption: string;\n\n /**\n * The icon renderer for the command item.\n */\n readonly icon: VirtualElement.IRenderer | undefined;\n\n /**\n * The icon class for the command item.\n */\n readonly iconClass: string;\n\n /**\n * The icon label for the command item.\n */\n readonly iconLabel: string;\n\n /**\n * The extra class name for the command item.\n */\n readonly className: string;\n\n /**\n * The dataset for the command item.\n */\n readonly dataset: CommandRegistry.Dataset;\n\n /**\n * Whether the command item is enabled.\n */\n readonly isEnabled: boolean;\n\n /**\n * Whether the command item is toggled.\n */\n readonly isToggled: boolean;\n\n /**\n * Whether the command item is toggleable.\n */\n readonly isToggleable: boolean;\n\n /**\n * Whether the command item is visible.\n */\n readonly isVisible: boolean;\n\n /**\n * The key binding for the command item.\n */\n readonly keyBinding: CommandRegistry.IKeyBinding | null;\n }\n\n /**\n * The render data for a command palette header.\n */\n export interface IHeaderRenderData {\n /**\n * The category of the header.\n */\n readonly category: string;\n\n /**\n * The indices of the matched characters in the category.\n */\n readonly indices: ReadonlyArray | null;\n }\n\n /**\n * The render data for a command palette item.\n */\n export interface IItemRenderData {\n /**\n * The command palette item to render.\n */\n readonly item: IItem;\n\n /**\n * The indices of the matched characters in the label.\n */\n readonly indices: ReadonlyArray | null;\n\n /**\n * Whether the item is the active item.\n */\n readonly active: boolean;\n }\n\n /**\n * The render data for a command palette empty message.\n */\n export interface IEmptyMessageRenderData {\n /**\n * The query which failed to match any commands.\n */\n query: string;\n }\n\n /**\n * A renderer for use with a command palette.\n */\n export interface IRenderer {\n /**\n * Render the virtual element for a command palette header.\n *\n * @param data - The data to use for rendering the header.\n *\n * @returns A virtual element representing the header.\n */\n renderHeader(data: IHeaderRenderData): VirtualElement;\n\n /**\n * Render the virtual element for a command palette item.\n *\n * @param data - The data to use for rendering the item.\n *\n * @returns A virtual element representing the item.\n *\n * #### Notes\n * The command palette will not render invisible items.\n */\n renderItem(data: IItemRenderData): VirtualElement;\n\n /**\n * Render the empty results message for a command palette.\n *\n * @param data - The data to use for rendering the message.\n *\n * @returns A virtual element representing the message.\n */\n renderEmptyMessage(data: IEmptyMessageRenderData): VirtualElement;\n }\n\n /**\n * The default implementation of `IRenderer`.\n */\n export class Renderer implements IRenderer {\n /**\n * Render the virtual element for a command palette header.\n *\n * @param data - The data to use for rendering the header.\n *\n * @returns A virtual element representing the header.\n */\n renderHeader(data: IHeaderRenderData): VirtualElement {\n let content = this.formatHeader(data);\n return h.li({ className: 'lm-CommandPalette-header' }, content);\n }\n\n /**\n * Render the virtual element for a command palette item.\n *\n * @param data - The data to use for rendering the item.\n *\n * @returns A virtual element representing the item.\n */\n renderItem(data: IItemRenderData): VirtualElement {\n let className = this.createItemClass(data);\n let dataset = this.createItemDataset(data);\n if (data.item.isToggleable) {\n return h.li(\n {\n className,\n dataset,\n role: 'menuitemcheckbox',\n 'aria-checked': `${data.item.isToggled}`\n },\n this.renderItemIcon(data),\n this.renderItemContent(data),\n this.renderItemShortcut(data)\n );\n }\n return h.li(\n {\n className,\n dataset,\n role: 'menuitem'\n },\n this.renderItemIcon(data),\n this.renderItemContent(data),\n this.renderItemShortcut(data)\n );\n }\n\n /**\n * Render the empty results message for a command palette.\n *\n * @param data - The data to use for rendering the message.\n *\n * @returns A virtual element representing the message.\n */\n renderEmptyMessage(data: IEmptyMessageRenderData): VirtualElement {\n let content = this.formatEmptyMessage(data);\n return h.li({ className: 'lm-CommandPalette-emptyMessage' }, content);\n }\n\n /**\n * Render the icon for a command palette item.\n *\n * @param data - The data to use for rendering the icon.\n *\n * @returns A virtual element representing the icon.\n */\n renderItemIcon(data: IItemRenderData): VirtualElement {\n let className = this.createIconClass(data);\n\n // If data.item.icon is undefined, it will be ignored.\n return h.div({ className }, data.item.icon!, data.item.iconLabel);\n }\n\n /**\n * Render the content for a command palette item.\n *\n * @param data - The data to use for rendering the content.\n *\n * @returns A virtual element representing the content.\n */\n renderItemContent(data: IItemRenderData): VirtualElement {\n return h.div(\n { className: 'lm-CommandPalette-itemContent' },\n this.renderItemLabel(data),\n this.renderItemCaption(data)\n );\n }\n\n /**\n * Render the label for a command palette item.\n *\n * @param data - The data to use for rendering the label.\n *\n * @returns A virtual element representing the label.\n */\n renderItemLabel(data: IItemRenderData): VirtualElement {\n let content = this.formatItemLabel(data);\n return h.div({ className: 'lm-CommandPalette-itemLabel' }, content);\n }\n\n /**\n * Render the caption for a command palette item.\n *\n * @param data - The data to use for rendering the caption.\n *\n * @returns A virtual element representing the caption.\n */\n renderItemCaption(data: IItemRenderData): VirtualElement {\n let content = this.formatItemCaption(data);\n return h.div({ className: 'lm-CommandPalette-itemCaption' }, content);\n }\n\n /**\n * Render the shortcut for a command palette item.\n *\n * @param data - The data to use for rendering the shortcut.\n *\n * @returns A virtual element representing the shortcut.\n */\n renderItemShortcut(data: IItemRenderData): VirtualElement {\n let content = this.formatItemShortcut(data);\n return h.div({ className: 'lm-CommandPalette-itemShortcut' }, content);\n }\n\n /**\n * Create the class name for the command palette item.\n *\n * @param data - The data to use for the class name.\n *\n * @returns The full class name for the command palette item.\n */\n createItemClass(data: IItemRenderData): string {\n // Set up the initial class name.\n let name = 'lm-CommandPalette-item';\n\n // Add the boolean state classes.\n if (!data.item.isEnabled) {\n name += ' lm-mod-disabled';\n }\n if (data.item.isToggled) {\n name += ' lm-mod-toggled';\n }\n if (data.active) {\n name += ' lm-mod-active';\n }\n\n // Add the extra class.\n let extra = data.item.className;\n if (extra) {\n name += ` ${extra}`;\n }\n\n // Return the complete class name.\n return name;\n }\n\n /**\n * Create the dataset for the command palette item.\n *\n * @param data - The data to use for creating the dataset.\n *\n * @returns The dataset for the command palette item.\n */\n createItemDataset(data: IItemRenderData): ElementDataset {\n return { ...data.item.dataset, command: data.item.command };\n }\n\n /**\n * Create the class name for the command item icon.\n *\n * @param data - The data to use for the class name.\n *\n * @returns The full class name for the item icon.\n */\n createIconClass(data: IItemRenderData): string {\n let name = 'lm-CommandPalette-itemIcon';\n let extra = data.item.iconClass;\n return extra ? `${name} ${extra}` : name;\n }\n\n /**\n * Create the render content for the header node.\n *\n * @param data - The data to use for the header content.\n *\n * @returns The content to add to the header node.\n */\n formatHeader(data: IHeaderRenderData): h.Child {\n if (!data.indices || data.indices.length === 0) {\n return data.category;\n }\n return StringExt.highlight(data.category, data.indices, h.mark);\n }\n\n /**\n * Create the render content for the empty message node.\n *\n * @param data - The data to use for the empty message content.\n *\n * @returns The content to add to the empty message node.\n */\n formatEmptyMessage(data: IEmptyMessageRenderData): h.Child {\n return `No commands found that match '${data.query}'`;\n }\n\n /**\n * Create the render content for the item shortcut node.\n *\n * @param data - The data to use for the shortcut content.\n *\n * @returns The content to add to the shortcut node.\n */\n formatItemShortcut(data: IItemRenderData): h.Child {\n let kb = data.item.keyBinding;\n return kb ? CommandRegistry.formatKeystroke(kb.keys) : null;\n }\n\n /**\n * Create the render content for the item label node.\n *\n * @param data - The data to use for the label content.\n *\n * @returns The content to add to the label node.\n */\n formatItemLabel(data: IItemRenderData): h.Child {\n if (!data.indices || data.indices.length === 0) {\n return data.item.label;\n }\n return StringExt.highlight(data.item.label, data.indices, h.mark);\n }\n\n /**\n * Create the render content for the item caption node.\n *\n * @param data - The data to use for the caption content.\n *\n * @returns The content to add to the caption node.\n */\n formatItemCaption(data: IItemRenderData): h.Child {\n return data.item.caption;\n }\n }\n\n /**\n * The default `Renderer` instance.\n */\n export const defaultRenderer = new Renderer();\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * Create the DOM node for a command palette.\n */\n export function createNode(): HTMLDivElement {\n let node = document.createElement('div');\n let search = document.createElement('div');\n let wrapper = document.createElement('div');\n let input = document.createElement('input');\n let content = document.createElement('ul');\n let clear = document.createElement('button');\n search.className = 'lm-CommandPalette-search';\n wrapper.className = 'lm-CommandPalette-wrapper';\n input.className = 'lm-CommandPalette-input';\n clear.className = 'lm-close-icon';\n\n content.className = 'lm-CommandPalette-content';\n content.setAttribute('role', 'menu');\n input.spellcheck = false;\n wrapper.appendChild(input);\n wrapper.appendChild(clear);\n search.appendChild(wrapper);\n node.appendChild(search);\n node.appendChild(content);\n return node;\n }\n\n /**\n * Create a new command item from a command registry and options.\n */\n export function createItem(\n commands: CommandRegistry,\n options: CommandPalette.IItemOptions\n ): CommandPalette.IItem {\n return new CommandItem(commands, options);\n }\n\n /**\n * A search result object for a header label.\n */\n export interface IHeaderResult {\n /**\n * The discriminated type of the object.\n */\n readonly type: 'header';\n\n /**\n * The category for the header.\n */\n readonly category: string;\n\n /**\n * The indices of the matched category characters.\n */\n readonly indices: ReadonlyArray | null;\n }\n\n /**\n * A search result object for a command item.\n */\n export interface IItemResult {\n /**\n * The discriminated type of the object.\n */\n readonly type: 'item';\n\n /**\n * The command item which was matched.\n */\n readonly item: CommandPalette.IItem;\n\n /**\n * The indices of the matched label characters.\n */\n readonly indices: ReadonlyArray | null;\n }\n\n /**\n * A type alias for a search result item.\n */\n export type SearchResult = IHeaderResult | IItemResult;\n\n /**\n * Search an array of command items for fuzzy matches.\n */\n export function search(\n items: CommandPalette.IItem[],\n query: string\n ): SearchResult[] {\n // Fuzzy match the items for the query.\n let scores = matchItems(items, query);\n\n // Sort the items based on their score.\n scores.sort(scoreCmp);\n\n // Create the results for the search.\n return createResults(scores);\n }\n\n /**\n * Test whether a result item can be activated.\n */\n export function canActivate(result: SearchResult): boolean {\n return result.type === 'item' && result.item.isEnabled;\n }\n\n /**\n * Normalize a category for a command item.\n */\n function normalizeCategory(category: string): string {\n return category.trim().replace(/\\s+/g, ' ');\n }\n\n /**\n * Normalize the query text for a fuzzy search.\n */\n function normalizeQuery(text: string): string {\n return text.replace(/\\s+/g, '').toLowerCase();\n }\n\n /**\n * An enum of the supported match types.\n */\n const enum MatchType {\n Label,\n Category,\n Split,\n Default\n }\n\n /**\n * A text match score with associated command item.\n */\n interface IScore {\n /**\n * The numerical type for the text match.\n */\n matchType: MatchType;\n\n /**\n * The numerical score for the text match.\n */\n score: number;\n\n /**\n * The indices of the matched category characters.\n */\n categoryIndices: number[] | null;\n\n /**\n * The indices of the matched label characters.\n */\n labelIndices: number[] | null;\n\n /**\n * The command item associated with the match.\n */\n item: CommandPalette.IItem;\n }\n\n /**\n * Perform a fuzzy match on an array of command items.\n */\n function matchItems(items: CommandPalette.IItem[], query: string): IScore[] {\n // Normalize the query text to lower case with no whitespace.\n query = normalizeQuery(query);\n\n // Create the array to hold the scores.\n let scores: IScore[] = [];\n\n // Iterate over the items and match against the query.\n for (let i = 0, n = items.length; i < n; ++i) {\n // Ignore items which are not visible.\n let item = items[i];\n if (!item.isVisible) {\n continue;\n }\n\n // If the query is empty, all items are matched by default.\n if (!query) {\n scores.push({\n matchType: MatchType.Default,\n categoryIndices: null,\n labelIndices: null,\n score: 0,\n item\n });\n continue;\n }\n\n // Run the fuzzy search for the item and query.\n let score = fuzzySearch(item, query);\n\n // Ignore the item if it is not a match.\n if (!score) {\n continue;\n }\n\n // Penalize disabled items.\n // TODO - push disabled items all the way down in sort cmp?\n if (!item.isEnabled) {\n score.score += 1000;\n }\n\n // Add the score to the results.\n scores.push(score);\n }\n\n // Return the final array of scores.\n return scores;\n }\n\n /**\n * Perform a fuzzy search on a single command item.\n */\n function fuzzySearch(\n item: CommandPalette.IItem,\n query: string\n ): IScore | null {\n // Create the source text to be searched.\n let category = item.category.toLowerCase();\n let label = item.label.toLowerCase();\n let source = `${category} ${label}`;\n\n // Set up the match score and indices array.\n let score = Infinity;\n let indices: number[] | null = null;\n\n // The regex for search word boundaries\n let rgx = /\\b\\w/g;\n\n // Search the source by word boundary.\n // eslint-disable-next-line no-constant-condition\n while (true) {\n // Find the next word boundary in the source.\n let rgxMatch = rgx.exec(source);\n\n // Break if there is no more source context.\n if (!rgxMatch) {\n break;\n }\n\n // Run the string match on the relevant substring.\n let match = StringExt.matchSumOfDeltas(source, query, rgxMatch.index);\n\n // Break if there is no match.\n if (!match) {\n break;\n }\n\n // Update the match if the score is better.\n if (match.score <= score) {\n score = match.score;\n indices = match.indices;\n }\n }\n\n // Bail if there was no match.\n if (!indices || score === Infinity) {\n return null;\n }\n\n // Compute the pivot index between category and label text.\n let pivot = category.length + 1;\n\n // Find the slice index to separate matched indices.\n let j = ArrayExt.lowerBound(indices, pivot, (a, b) => a - b);\n\n // Extract the matched category and label indices.\n let categoryIndices = indices.slice(0, j);\n let labelIndices = indices.slice(j);\n\n // Adjust the label indices for the pivot offset.\n for (let i = 0, n = labelIndices.length; i < n; ++i) {\n labelIndices[i] -= pivot;\n }\n\n // Handle a pure label match.\n if (categoryIndices.length === 0) {\n return {\n matchType: MatchType.Label,\n categoryIndices: null,\n labelIndices,\n score,\n item\n };\n }\n\n // Handle a pure category match.\n if (labelIndices.length === 0) {\n return {\n matchType: MatchType.Category,\n categoryIndices,\n labelIndices: null,\n score,\n item\n };\n }\n\n // Handle a split match.\n return {\n matchType: MatchType.Split,\n categoryIndices,\n labelIndices,\n score,\n item\n };\n }\n\n /**\n * A sort comparison function for a match score.\n */\n function scoreCmp(a: IScore, b: IScore): number {\n // First compare based on the match type\n let m1 = a.matchType - b.matchType;\n if (m1 !== 0) {\n return m1;\n }\n\n // Otherwise, compare based on the match score.\n let d1 = a.score - b.score;\n if (d1 !== 0) {\n return d1;\n }\n\n // Find the match index based on the match type.\n let i1 = 0;\n let i2 = 0;\n switch (a.matchType) {\n case MatchType.Label:\n i1 = a.labelIndices![0];\n i2 = b.labelIndices![0];\n break;\n case MatchType.Category:\n case MatchType.Split:\n i1 = a.categoryIndices![0];\n i2 = b.categoryIndices![0];\n break;\n }\n\n // Compare based on the match index.\n if (i1 !== i2) {\n return i1 - i2;\n }\n\n // Otherwise, compare by category.\n let d2 = a.item.category.localeCompare(b.item.category);\n if (d2 !== 0) {\n return d2;\n }\n\n // Otherwise, compare by rank.\n let r1 = a.item.rank;\n let r2 = b.item.rank;\n if (r1 !== r2) {\n return r1 < r2 ? -1 : 1; // Infinity safe\n }\n\n // Finally, compare by label.\n return a.item.label.localeCompare(b.item.label);\n }\n\n /**\n * Create the results from an array of sorted scores.\n */\n function createResults(scores: IScore[]): SearchResult[] {\n // Set up the search results array.\n let results: SearchResult[] = [];\n\n // Iterate over each score in the array.\n for (let i = 0, n = scores.length; i < n; ++i) {\n // Extract the current item and indices.\n let { item, categoryIndices, labelIndices } = scores[i];\n\n // Extract the category for the current item.\n let category = item.category;\n\n // Is this the same category as the preceding result?\n if (i === 0 || category !== scores[i - 1].item.category) {\n // Add the header result for the category.\n results.push({ type: 'header', category, indices: categoryIndices });\n }\n\n // Create the item result for the score.\n results.push({ type: 'item', item, indices: labelIndices });\n }\n\n // Return the final results.\n return results;\n }\n\n /**\n * A concrete implementation of `CommandPalette.IItem`.\n */\n class CommandItem implements CommandPalette.IItem {\n /**\n * Construct a new command item.\n */\n constructor(\n commands: CommandRegistry,\n options: CommandPalette.IItemOptions\n ) {\n this._commands = commands;\n this.category = normalizeCategory(options.category);\n this.command = options.command;\n this.args = options.args || JSONExt.emptyObject;\n this.rank = options.rank !== undefined ? options.rank : Infinity;\n }\n\n /**\n * The category for the command item.\n */\n readonly category: string;\n\n /**\n * The command to execute when the item is triggered.\n */\n readonly command: string;\n\n /**\n * The arguments for the command.\n */\n readonly args: ReadonlyJSONObject;\n\n /**\n * The rank for the command item.\n */\n readonly rank: number;\n\n /**\n * The display label for the command item.\n */\n get label(): string {\n return this._commands.label(this.command, this.args);\n }\n\n /**\n * The icon renderer for the command item.\n */\n get icon(): VirtualElement.IRenderer | undefined {\n return this._commands.icon(this.command, this.args);\n }\n\n /**\n * The icon class for the command item.\n */\n get iconClass(): string {\n return this._commands.iconClass(this.command, this.args);\n }\n\n /**\n * The icon label for the command item.\n */\n get iconLabel(): string {\n return this._commands.iconLabel(this.command, this.args);\n }\n\n /**\n * The display caption for the command item.\n */\n get caption(): string {\n return this._commands.caption(this.command, this.args);\n }\n\n /**\n * The extra class name for the command item.\n */\n get className(): string {\n return this._commands.className(this.command, this.args);\n }\n\n /**\n * The dataset for the command item.\n */\n get dataset(): CommandRegistry.Dataset {\n return this._commands.dataset(this.command, this.args);\n }\n\n /**\n * Whether the command item is enabled.\n */\n get isEnabled(): boolean {\n return this._commands.isEnabled(this.command, this.args);\n }\n\n /**\n * Whether the command item is toggled.\n */\n get isToggled(): boolean {\n return this._commands.isToggled(this.command, this.args);\n }\n\n /**\n * Whether the command item is toggleable.\n */\n get isToggleable(): boolean {\n return this._commands.isToggleable(this.command, this.args);\n }\n\n /**\n * Whether the command item is visible.\n */\n get isVisible(): boolean {\n return this._commands.isVisible(this.command, this.args);\n }\n\n /**\n * The key binding for the command item.\n */\n get keyBinding(): CommandRegistry.IKeyBinding | null {\n let { command, args } = this;\n return (\n ArrayExt.findLastValue(this._commands.keyBindings, kb => {\n return kb.command === command && JSONExt.deepEqual(kb.args, args);\n }) || null\n );\n }\n\n private _commands: CommandRegistry;\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { CommandRegistry } from '@lumino/commands';\n\nimport { JSONExt, ReadonlyJSONObject } from '@lumino/coreutils';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { getKeyboardLayout } from '@lumino/keyboard';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport {\n ARIAAttrNames,\n ElementARIAAttrs,\n ElementDataset,\n h,\n VirtualDOM,\n VirtualElement\n} from '@lumino/virtualdom';\n\nimport { Widget } from './widget';\n\ninterface IWindowData {\n pageXOffset: number;\n pageYOffset: number;\n clientWidth: number;\n clientHeight: number;\n}\n\n/**\n * A widget which displays items as a canonical menu.\n */\nexport class Menu extends Widget {\n /**\n * Construct a new menu.\n *\n * @param options - The options for initializing the menu.\n */\n constructor(options: Menu.IOptions) {\n super({ node: Private.createNode() });\n this.addClass('lm-Menu');\n this.setFlag(Widget.Flag.DisallowLayout);\n this.commands = options.commands;\n this.renderer = options.renderer || Menu.defaultRenderer;\n }\n\n /**\n * Dispose of the resources held by the menu.\n */\n dispose(): void {\n this.close();\n this._items.length = 0;\n super.dispose();\n }\n\n /**\n * A signal emitted just before the menu is closed.\n *\n * #### Notes\n * This signal is emitted when the menu receives a `'close-request'`\n * message, just before it removes itself from the DOM.\n *\n * This signal is not emitted if the menu is already detached from\n * the DOM when it receives the `'close-request'` message.\n */\n get aboutToClose(): ISignal {\n return this._aboutToClose;\n }\n\n /**\n * A signal emitted when a new menu is requested by the user.\n *\n * #### Notes\n * This signal is emitted whenever the user presses the right or left\n * arrow keys, and a submenu cannot be opened or closed in response.\n *\n * This signal is useful when implementing menu bars in order to open\n * the next or previous menu in response to a user key press.\n *\n * This signal is only emitted for the root menu in a hierarchy.\n */\n get menuRequested(): ISignal {\n return this._menuRequested;\n }\n\n /**\n * The command registry used by the menu.\n */\n readonly commands: CommandRegistry;\n\n /**\n * The renderer used by the menu.\n */\n readonly renderer: Menu.IRenderer;\n\n /**\n * The parent menu of the menu.\n *\n * #### Notes\n * This is `null` unless the menu is an open submenu.\n */\n get parentMenu(): Menu | null {\n return this._parentMenu;\n }\n\n /**\n * The child menu of the menu.\n *\n * #### Notes\n * This is `null` unless the menu has an open submenu.\n */\n get childMenu(): Menu | null {\n return this._childMenu;\n }\n\n /**\n * The root menu of the menu hierarchy.\n */\n get rootMenu(): Menu {\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n let menu: Menu = this;\n while (menu._parentMenu) {\n menu = menu._parentMenu;\n }\n return menu;\n }\n\n /**\n * The leaf menu of the menu hierarchy.\n */\n get leafMenu(): Menu {\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n let menu: Menu = this;\n while (menu._childMenu) {\n menu = menu._childMenu;\n }\n return menu;\n }\n\n /**\n * The menu content node.\n *\n * #### Notes\n * This is the node which holds the menu item nodes.\n *\n * Modifying this node directly can lead to undefined behavior.\n */\n get contentNode(): HTMLUListElement {\n return this.node.getElementsByClassName(\n 'lm-Menu-content'\n )[0] as HTMLUListElement;\n }\n\n /**\n * Get the currently active menu item.\n */\n get activeItem(): Menu.IItem | null {\n return this._items[this._activeIndex] || null;\n }\n\n /**\n * Set the currently active menu item.\n *\n * #### Notes\n * If the item cannot be activated, the item will be set to `null`.\n */\n set activeItem(value: Menu.IItem | null) {\n this.activeIndex = value ? this._items.indexOf(value) : -1;\n }\n\n /**\n * Get the index of the currently active menu item.\n *\n * #### Notes\n * This will be `-1` if no menu item is active.\n */\n get activeIndex(): number {\n return this._activeIndex;\n }\n\n /**\n * Set the index of the currently active menu item.\n *\n * #### Notes\n * If the item cannot be activated, the index will be set to `-1`.\n */\n set activeIndex(value: number) {\n // Adjust the value for an out of range index.\n if (value < 0 || value >= this._items.length) {\n value = -1;\n }\n\n // Ensure the item can be activated.\n if (value !== -1 && !Private.canActivate(this._items[value])) {\n value = -1;\n }\n\n // Bail if the index will not change.\n if (this._activeIndex === value) {\n return;\n }\n\n // Update the active index.\n this._activeIndex = value;\n\n // Make active element in focus\n if (\n this._activeIndex >= 0 &&\n this.contentNode.childNodes[this._activeIndex]\n ) {\n (this.contentNode.childNodes[this._activeIndex] as HTMLElement).focus();\n }\n\n // schedule an update of the items.\n this.update();\n }\n\n /**\n * A read-only array of the menu items in the menu.\n */\n get items(): ReadonlyArray {\n return this._items;\n }\n\n /**\n * Activate the next selectable item in the menu.\n *\n * #### Notes\n * If no item is selectable, the index will be set to `-1`.\n */\n activateNextItem(): void {\n let n = this._items.length;\n let ai = this._activeIndex;\n let start = ai < n - 1 ? ai + 1 : 0;\n let stop = start === 0 ? n - 1 : start - 1;\n this.activeIndex = ArrayExt.findFirstIndex(\n this._items,\n Private.canActivate,\n start,\n stop\n );\n }\n\n /**\n * Activate the previous selectable item in the menu.\n *\n * #### Notes\n * If no item is selectable, the index will be set to `-1`.\n */\n activatePreviousItem(): void {\n let n = this._items.length;\n let ai = this._activeIndex;\n let start = ai <= 0 ? n - 1 : ai - 1;\n let stop = start === n - 1 ? 0 : start + 1;\n this.activeIndex = ArrayExt.findLastIndex(\n this._items,\n Private.canActivate,\n start,\n stop\n );\n }\n\n /**\n * Trigger the active menu item.\n *\n * #### Notes\n * If the active item is a submenu, it will be opened and the first\n * item will be activated.\n *\n * If the active item is a command, the command will be executed.\n *\n * If the menu is not attached, this is a no-op.\n *\n * If there is no active item, this is a no-op.\n */\n triggerActiveItem(): void {\n // Bail if the menu is not attached.\n if (!this.isAttached) {\n return;\n }\n\n // Bail if there is no active item.\n let item = this.activeItem;\n if (!item) {\n return;\n }\n\n // Cancel the pending timers.\n this._cancelOpenTimer();\n this._cancelCloseTimer();\n\n // If the item is a submenu, open it.\n if (item.type === 'submenu') {\n this._openChildMenu(true);\n return;\n }\n\n // Close the root menu before executing the command.\n this.rootMenu.close();\n\n // Execute the command for the item.\n let { command, args } = item;\n if (this.commands.isEnabled(command, args)) {\n this.commands.execute(command, args);\n } else {\n console.log(`Command '${command}' is disabled.`);\n }\n }\n\n /**\n * Add a menu item to the end of the menu.\n *\n * @param options - The options for creating the menu item.\n *\n * @returns The menu item added to the menu.\n */\n addItem(options: Menu.IItemOptions): Menu.IItem {\n return this.insertItem(this._items.length, options);\n }\n\n /**\n * Insert a menu item into the menu at the specified index.\n *\n * @param index - The index at which to insert the item.\n *\n * @param options - The options for creating the menu item.\n *\n * @returns The menu item added to the menu.\n *\n * #### Notes\n * The index will be clamped to the bounds of the items.\n */\n insertItem(index: number, options: Menu.IItemOptions): Menu.IItem {\n // Close the menu if it's attached.\n if (this.isAttached) {\n this.close();\n }\n\n // Reset the active index.\n this.activeIndex = -1;\n\n // Clamp the insert index to the array bounds.\n let i = Math.max(0, Math.min(index, this._items.length));\n\n // Create the item for the options.\n let item = Private.createItem(this, options);\n\n // Insert the item into the array.\n ArrayExt.insert(this._items, i, item);\n\n // Schedule an update of the items.\n this.update();\n\n // Return the item added to the menu.\n return item;\n }\n\n /**\n * Remove an item from the menu.\n *\n * @param item - The item to remove from the menu.\n *\n * #### Notes\n * This is a no-op if the item is not in the menu.\n */\n removeItem(item: Menu.IItem): void {\n this.removeItemAt(this._items.indexOf(item));\n }\n\n /**\n * Remove the item at a given index from the menu.\n *\n * @param index - The index of the item to remove.\n *\n * #### Notes\n * This is a no-op if the index is out of range.\n */\n removeItemAt(index: number): void {\n // Close the menu if it's attached.\n if (this.isAttached) {\n this.close();\n }\n\n // Reset the active index.\n this.activeIndex = -1;\n\n // Remove the item from the array.\n let item = ArrayExt.removeAt(this._items, index);\n\n // Bail if the index is out of range.\n if (!item) {\n return;\n }\n\n // Schedule an update of the items.\n this.update();\n }\n\n /**\n * Remove all menu items from the menu.\n */\n clearItems(): void {\n // Close the menu if it's attached.\n if (this.isAttached) {\n this.close();\n }\n\n // Reset the active index.\n this.activeIndex = -1;\n\n // Bail if there is nothing to remove.\n if (this._items.length === 0) {\n return;\n }\n\n // Clear the items.\n this._items.length = 0;\n\n // Schedule an update of the items.\n this.update();\n }\n\n /**\n * Open the menu at the specified location.\n *\n * @param x - The client X coordinate of the menu location.\n *\n * @param y - The client Y coordinate of the menu location.\n *\n * @param options - The additional options for opening the menu.\n *\n * #### Notes\n * The menu will be opened at the given location unless it will not\n * fully fit on the screen. If it will not fit, it will be adjusted\n * to fit naturally on the screen.\n *\n * The menu will be attached under the `host` element in the DOM\n * (or `document.body` if `host` is `null`) and before the `ref`\n * element (or as the last child of `host` if `ref` is `null`).\n * The menu may be displayed outside of the `host` element\n * following the rules of CSS absolute positioning.\n *\n * This is a no-op if the menu is already attached to the DOM.\n */\n open(x: number, y: number, options: Menu.IOpenOptions = {}): void {\n // Bail early if the menu is already attached.\n if (this.isAttached) {\n return;\n }\n\n // Extract the menu options.\n let forceX = options.forceX || false;\n let forceY = options.forceY || false;\n const host = options.host ?? null;\n const ref = options.ref ?? null;\n const horizontalAlignment =\n options.horizontalAlignment ??\n (document.documentElement.dir === 'rtl' ? 'right' : 'left');\n\n // Open the menu as a root menu.\n Private.openRootMenu(\n this,\n x,\n y,\n forceX,\n forceY,\n horizontalAlignment,\n host,\n ref\n );\n\n // Activate the menu to accept keyboard input.\n this.activate();\n }\n\n /**\n * Handle the DOM events for the menu.\n *\n * @param event - The DOM event sent to the menu.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the menu's DOM nodes. It should\n * not be called directly by user code.\n */\n handleEvent(event: Event): void {\n switch (event.type) {\n case 'keydown':\n this._evtKeyDown(event as KeyboardEvent);\n break;\n case 'mouseup':\n this._evtMouseUp(event as MouseEvent);\n break;\n case 'mousemove':\n this._evtMouseMove(event as MouseEvent);\n break;\n case 'mouseenter':\n this._evtMouseEnter(event as MouseEvent);\n break;\n case 'mouseleave':\n this._evtMouseLeave(event as MouseEvent);\n break;\n case 'mousedown':\n this._evtMouseDown(event as MouseEvent);\n break;\n case 'contextmenu':\n event.preventDefault();\n event.stopPropagation();\n break;\n }\n }\n\n /**\n * A message handler invoked on a `'after-attach'` message.\n */\n protected override onAfterAttach(msg: Message): void {\n this.node.addEventListener('keydown', this);\n this.node.addEventListener('mouseup', this);\n this.node.addEventListener('mousemove', this);\n this.node.addEventListener('mouseenter', this);\n this.node.addEventListener('mouseleave', this);\n this.node.addEventListener('contextmenu', this);\n this.node.ownerDocument.addEventListener('mousedown', this, true);\n }\n\n /**\n * A message handler invoked on an `'before-detach'` message.\n */\n protected override onBeforeDetach(msg: Message): void {\n this.node.removeEventListener('keydown', this);\n this.node.removeEventListener('mouseup', this);\n this.node.removeEventListener('mousemove', this);\n this.node.removeEventListener('mouseenter', this);\n this.node.removeEventListener('mouseleave', this);\n this.node.removeEventListener('contextmenu', this);\n this.node.ownerDocument.removeEventListener('mousedown', this, true);\n }\n\n /**\n * A message handler invoked on an `'activate-request'` message.\n */\n protected onActivateRequest(msg: Message): void {\n if (this.isAttached) {\n this.node.focus();\n }\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n protected onUpdateRequest(msg: Message): void {\n let items = this._items;\n let renderer = this.renderer;\n let activeIndex = this._activeIndex;\n let collapsedFlags = Private.computeCollapsed(items);\n let content = new Array(items.length);\n for (let i = 0, n = items.length; i < n; ++i) {\n let item = items[i];\n let active = i === activeIndex;\n let collapsed = collapsedFlags[i];\n content[i] = renderer.renderItem({\n item,\n active,\n collapsed,\n onfocus: () => {\n this.activeIndex = i;\n }\n });\n }\n VirtualDOM.render(content, this.contentNode);\n }\n\n /**\n * A message handler invoked on a `'close-request'` message.\n */\n protected onCloseRequest(msg: Message): void {\n // Cancel the pending timers.\n this._cancelOpenTimer();\n this._cancelCloseTimer();\n\n // Reset the active index.\n this.activeIndex = -1;\n\n // Close any open child menu.\n let childMenu = this._childMenu;\n if (childMenu) {\n this._childIndex = -1;\n this._childMenu = null;\n childMenu._parentMenu = null;\n childMenu.close();\n }\n\n // Remove this menu from its parent and activate the parent.\n let parentMenu = this._parentMenu;\n if (parentMenu) {\n this._parentMenu = null;\n parentMenu._childIndex = -1;\n parentMenu._childMenu = null;\n parentMenu.activate();\n }\n\n // Emit the `aboutToClose` signal if the menu is attached.\n if (this.isAttached) {\n this._aboutToClose.emit(undefined);\n }\n\n // Finish closing the menu.\n super.onCloseRequest(msg);\n }\n\n /**\n * Handle the `'keydown'` event for the menu.\n *\n * #### Notes\n * This listener is attached to the menu node.\n */\n private _evtKeyDown(event: KeyboardEvent): void {\n // A menu handles all keydown events.\n event.preventDefault();\n event.stopPropagation();\n\n // Fetch the key code for the event.\n let kc = event.keyCode;\n\n // Enter\n if (kc === 13) {\n this.triggerActiveItem();\n return;\n }\n\n // Escape\n if (kc === 27) {\n this.close();\n return;\n }\n\n // Left Arrow\n if (kc === 37) {\n if (this._parentMenu) {\n this.close();\n } else {\n this._menuRequested.emit('previous');\n }\n return;\n }\n\n // Up Arrow\n if (kc === 38) {\n this.activatePreviousItem();\n return;\n }\n\n // Right Arrow\n if (kc === 39) {\n let item = this.activeItem;\n if (item && item.type === 'submenu') {\n this.triggerActiveItem();\n } else {\n this.rootMenu._menuRequested.emit('next');\n }\n return;\n }\n\n // Down Arrow\n if (kc === 40) {\n this.activateNextItem();\n return;\n }\n\n // Get the pressed key character.\n let key = getKeyboardLayout().keyForKeydownEvent(event);\n\n // Bail if the key is not valid.\n if (!key) {\n return;\n }\n\n // Search for the next best matching mnemonic item.\n let start = this._activeIndex + 1;\n let result = Private.findMnemonic(this._items, key, start);\n\n // Handle the requested mnemonic based on the search results.\n // If exactly one mnemonic is matched, that item is triggered.\n // Otherwise, the next mnemonic is activated if available,\n // followed by the auto mnemonic if available.\n if (result.index !== -1 && !result.multiple) {\n this.activeIndex = result.index;\n this.triggerActiveItem();\n } else if (result.index !== -1) {\n this.activeIndex = result.index;\n } else if (result.auto !== -1) {\n this.activeIndex = result.auto;\n }\n }\n\n /**\n * Handle the `'mouseup'` event for the menu.\n *\n * #### Notes\n * This listener is attached to the menu node.\n */\n private _evtMouseUp(event: MouseEvent): void {\n if (event.button !== 0) {\n return;\n }\n event.preventDefault();\n event.stopPropagation();\n this.triggerActiveItem();\n }\n\n /**\n * Handle the `'mousemove'` event for the menu.\n *\n * #### Notes\n * This listener is attached to the menu node.\n */\n private _evtMouseMove(event: MouseEvent): void {\n // Hit test the item nodes for the item under the mouse.\n let index = ArrayExt.findFirstIndex(this.contentNode.children, node => {\n return ElementExt.hitTest(node, event.clientX, event.clientY);\n });\n\n // Bail early if the mouse is already over the active index.\n if (index === this._activeIndex) {\n return;\n }\n\n // Update and coerce the active index.\n this.activeIndex = index;\n index = this.activeIndex;\n\n // If the index is the current child index, cancel the timers.\n if (index === this._childIndex) {\n this._cancelOpenTimer();\n this._cancelCloseTimer();\n return;\n }\n\n // If a child menu is currently open, start the close timer.\n if (this._childIndex !== -1) {\n this._startCloseTimer();\n }\n\n // Cancel the open timer to give a full delay for opening.\n this._cancelOpenTimer();\n\n // Bail if the active item is not a valid submenu item.\n let item = this.activeItem;\n if (!item || item.type !== 'submenu' || !item.submenu) {\n return;\n }\n\n // Start the open timer to open the active item submenu.\n this._startOpenTimer();\n }\n\n /**\n * Handle the `'mouseenter'` event for the menu.\n *\n * #### Notes\n * This listener is attached to the menu node.\n */\n private _evtMouseEnter(event: MouseEvent): void {\n // Synchronize the active ancestor items.\n for (let menu = this._parentMenu; menu; menu = menu._parentMenu) {\n menu._cancelOpenTimer();\n menu._cancelCloseTimer();\n menu.activeIndex = menu._childIndex;\n }\n }\n\n /**\n * Handle the `'mouseleave'` event for the menu.\n *\n * #### Notes\n * This listener is attached to the menu node.\n */\n private _evtMouseLeave(event: MouseEvent): void {\n // Cancel any pending submenu opening.\n this._cancelOpenTimer();\n\n // If there is no open child menu, just reset the active index.\n if (!this._childMenu) {\n this.activeIndex = -1;\n return;\n }\n\n // If the mouse is over the child menu, cancel the close timer.\n let { clientX, clientY } = event;\n if (ElementExt.hitTest(this._childMenu.node, clientX, clientY)) {\n this._cancelCloseTimer();\n return;\n }\n\n // Otherwise, reset the active index and start the close timer.\n this.activeIndex = -1;\n this._startCloseTimer();\n }\n\n /**\n * Handle the `'mousedown'` event for the menu.\n *\n * #### Notes\n * This listener is attached to the document node.\n */\n private _evtMouseDown(event: MouseEvent): void {\n // Bail if the menu is not a root menu.\n if (this._parentMenu) {\n return;\n }\n\n // The mouse button which is pressed is irrelevant. If the press\n // is not on a menu, the entire hierarchy is closed and the event\n // is allowed to propagate. This allows other code to act on the\n // event, such as focusing the clicked element.\n if (Private.hitTestMenus(this, event.clientX, event.clientY)) {\n event.preventDefault();\n event.stopPropagation();\n } else {\n this.close();\n }\n }\n\n /**\n * Open the child menu at the active index immediately.\n *\n * If a different child menu is already open, it will be closed,\n * even if the active item is not a valid submenu.\n */\n private _openChildMenu(activateFirst = false): void {\n // If the item is not a valid submenu, close the child menu.\n let item = this.activeItem;\n if (!item || item.type !== 'submenu' || !item.submenu) {\n this._closeChildMenu();\n return;\n }\n\n // Do nothing if the child menu will not change.\n let submenu = item.submenu;\n if (submenu === this._childMenu) {\n return;\n }\n\n // Prior to any DOM modifications save window data\n Menu.saveWindowData();\n\n // Ensure the current child menu is closed.\n this._closeChildMenu();\n\n // Update the private child state.\n this._childMenu = submenu;\n this._childIndex = this._activeIndex;\n\n // Set the parent menu reference for the child.\n submenu._parentMenu = this;\n\n // Ensure the menu is updated and lookup the item node.\n MessageLoop.sendMessage(this, Widget.Msg.UpdateRequest);\n let itemNode = this.contentNode.children[this._activeIndex];\n\n // Open the submenu at the active node.\n Private.openSubmenu(submenu, itemNode as HTMLElement);\n\n // Activate the first item if desired.\n if (activateFirst) {\n submenu.activeIndex = -1;\n submenu.activateNextItem();\n }\n\n // Activate the child menu.\n submenu.activate();\n }\n\n /**\n * Close the child menu immediately.\n *\n * This is a no-op if a child menu is not open.\n */\n private _closeChildMenu(): void {\n if (this._childMenu) {\n this._childMenu.close();\n }\n }\n\n /**\n * Start the open timer, unless it is already pending.\n */\n private _startOpenTimer(): void {\n if (this._openTimerID === 0) {\n this._openTimerID = window.setTimeout(() => {\n this._openTimerID = 0;\n this._openChildMenu();\n }, Private.TIMER_DELAY);\n }\n }\n\n /**\n * Start the close timer, unless it is already pending.\n */\n private _startCloseTimer(): void {\n if (this._closeTimerID === 0) {\n this._closeTimerID = window.setTimeout(() => {\n this._closeTimerID = 0;\n this._closeChildMenu();\n }, Private.TIMER_DELAY);\n }\n }\n\n /**\n * Cancel the open timer, if the timer is pending.\n */\n private _cancelOpenTimer(): void {\n if (this._openTimerID !== 0) {\n clearTimeout(this._openTimerID);\n this._openTimerID = 0;\n }\n }\n\n /**\n * Cancel the close timer, if the timer is pending.\n */\n private _cancelCloseTimer(): void {\n if (this._closeTimerID !== 0) {\n clearTimeout(this._closeTimerID);\n this._closeTimerID = 0;\n }\n }\n\n /**\n * Save window data used for menu positioning in transient cache.\n *\n * In order to avoid layout trashing it is recommended to invoke this\n * method immediately prior to opening the menu and any DOM modifications\n * (like closing previously visible menu, or adding a class to menu widget).\n *\n * The transient cache will be released upon `open()` call.\n */\n static saveWindowData(): void {\n Private.saveWindowData();\n }\n\n private _childIndex = -1;\n private _activeIndex = -1;\n private _openTimerID = 0;\n private _closeTimerID = 0;\n private _items: Menu.IItem[] = [];\n private _childMenu: Menu | null = null;\n private _parentMenu: Menu | null = null;\n private _aboutToClose = new Signal(this);\n private _menuRequested = new Signal(this);\n}\n\n/**\n * The namespace for the `Menu` class statics.\n */\nexport namespace Menu {\n /**\n * An options object for creating a menu.\n */\n export interface IOptions {\n /**\n * The command registry for use with the menu.\n */\n commands: CommandRegistry;\n\n /**\n * A custom renderer for use with the menu.\n *\n * The default is a shared renderer instance.\n */\n renderer?: IRenderer;\n }\n\n /**\n * An options object for the `open` method on a menu.\n */\n export interface IOpenOptions {\n /**\n * Whether to force the X position of the menu.\n *\n * Setting to `true` will disable the logic which repositions the\n * X coordinate of the menu if it will not fit entirely on screen.\n *\n * The default is `false`.\n */\n forceX?: boolean;\n\n /**\n * Whether to force the Y position of the menu.\n *\n * Setting to `true` will disable the logic which repositions the\n * Y coordinate of the menu if it will not fit entirely on screen.\n *\n * The default is `false`.\n */\n forceY?: boolean;\n\n /**\n * The DOM node to use as the menu's host.\n *\n * If not specified then uses `document.body`.\n */\n host?: HTMLElement;\n\n /**\n * The child of `host` to use as the reference element.\n * If this is provided, the menu will be inserted before this\n * node in the host. The default is `null`, which will cause the\n * menu to be added as the last child of the host.\n */\n ref?: HTMLElement;\n\n /**\n * The alignment of the menu.\n *\n * The default is `'left'` unless the document `dir` attribute is `'rtl'`\n */\n horizontalAlignment?: 'left' | 'right';\n }\n\n /**\n * A type alias for a menu item type.\n */\n export type ItemType = 'command' | 'submenu' | 'separator';\n\n /**\n * An options object for creating a menu item.\n */\n export interface IItemOptions {\n /**\n * The type of the menu item.\n *\n * The default value is `'command'`.\n */\n type?: ItemType;\n\n /**\n * The command to execute when the item is triggered.\n *\n * The default value is an empty string.\n */\n command?: string;\n\n /**\n * The arguments for the command.\n *\n * The default value is an empty object.\n */\n args?: ReadonlyJSONObject;\n\n /**\n * The submenu for a `'submenu'` type item.\n *\n * The default value is `null`.\n */\n submenu?: Menu | null;\n }\n\n /**\n * An object which represents a menu item.\n *\n * #### Notes\n * Item objects are created automatically by a menu.\n */\n export interface IItem {\n /**\n * The type of the menu item.\n */\n readonly type: ItemType;\n\n /**\n * The command to execute when the item is triggered.\n */\n readonly command: string;\n\n /**\n * The arguments for the command.\n */\n readonly args: ReadonlyJSONObject;\n\n /**\n * The submenu for a `'submenu'` type item.\n */\n readonly submenu: Menu | null;\n\n /**\n * The display label for the menu item.\n */\n readonly label: string;\n\n /**\n * The mnemonic index for the menu item.\n */\n readonly mnemonic: number;\n\n /**\n * The icon renderer for the menu item.\n */\n readonly icon: VirtualElement.IRenderer | undefined;\n\n /**\n * The icon class for the menu item.\n */\n readonly iconClass: string;\n\n /**\n * The icon label for the menu item.\n */\n readonly iconLabel: string;\n\n /**\n * The display caption for the menu item.\n */\n readonly caption: string;\n\n /**\n * The extra class name for the menu item.\n */\n readonly className: string;\n\n /**\n * The dataset for the menu item.\n */\n readonly dataset: CommandRegistry.Dataset;\n\n /**\n * Whether the menu item is enabled.\n */\n readonly isEnabled: boolean;\n\n /**\n * Whether the menu item is toggled.\n */\n readonly isToggled: boolean;\n\n /**\n * Whether the menu item is visible.\n */\n readonly isVisible: boolean;\n\n /**\n * The key binding for the menu item.\n */\n readonly keyBinding: CommandRegistry.IKeyBinding | null;\n }\n\n /**\n * An object which holds the data to render a menu item.\n */\n export interface IRenderData {\n /**\n * The item to be rendered.\n */\n readonly item: IItem;\n\n /**\n * Whether the item is the active item.\n */\n readonly active: boolean;\n\n /**\n * Whether the item should be collapsed.\n */\n readonly collapsed: boolean;\n\n /**\n * Handler for when element is in focus.\n */\n readonly onfocus?: () => void;\n }\n\n /**\n * A renderer for use with a menu.\n */\n export interface IRenderer {\n /**\n * Render the virtual element for a menu item.\n *\n * @param data - The data to use for rendering the item.\n *\n * @returns A virtual element representing the item.\n */\n renderItem(data: IRenderData): VirtualElement;\n }\n\n /**\n * The default implementation of `IRenderer`.\n *\n * #### Notes\n * Subclasses are free to reimplement rendering methods as needed.\n */\n export class Renderer implements IRenderer {\n /**\n * Render the virtual element for a menu item.\n *\n * @param data - The data to use for rendering the item.\n *\n * @returns A virtual element representing the item.\n */\n renderItem(data: IRenderData): VirtualElement {\n let className = this.createItemClass(data);\n let dataset = this.createItemDataset(data);\n let aria = this.createItemARIA(data);\n return h.li(\n {\n className,\n dataset,\n tabindex: '0',\n onfocus: data.onfocus,\n ...aria\n },\n this.renderIcon(data),\n this.renderLabel(data),\n this.renderShortcut(data),\n this.renderSubmenu(data)\n );\n }\n\n /**\n * Render the icon element for a menu item.\n *\n * @param data - The data to use for rendering the icon.\n *\n * @returns A virtual element representing the item icon.\n */\n renderIcon(data: IRenderData): VirtualElement {\n let className = this.createIconClass(data);\n\n // If data.item.icon is undefined, it will be ignored.\n return h.div({ className }, data.item.icon!, data.item.iconLabel);\n }\n\n /**\n * Render the label element for a menu item.\n *\n * @param data - The data to use for rendering the label.\n *\n * @returns A virtual element representing the item label.\n */\n renderLabel(data: IRenderData): VirtualElement {\n let content = this.formatLabel(data);\n return h.div({ className: 'lm-Menu-itemLabel' }, content);\n }\n\n /**\n * Render the shortcut element for a menu item.\n *\n * @param data - The data to use for rendering the shortcut.\n *\n * @returns A virtual element representing the item shortcut.\n */\n renderShortcut(data: IRenderData): VirtualElement {\n let content = this.formatShortcut(data);\n return h.div({ className: 'lm-Menu-itemShortcut' }, content);\n }\n\n /**\n * Render the submenu icon element for a menu item.\n *\n * @param data - The data to use for rendering the submenu icon.\n *\n * @returns A virtual element representing the submenu icon.\n */\n renderSubmenu(data: IRenderData): VirtualElement {\n return h.div({ className: 'lm-Menu-itemSubmenuIcon' });\n }\n\n /**\n * Create the class name for the menu item.\n *\n * @param data - The data to use for the class name.\n *\n * @returns The full class name for the menu item.\n */\n createItemClass(data: IRenderData): string {\n // Setup the initial class name.\n let name = 'lm-Menu-item';\n\n // Add the boolean state classes.\n if (!data.item.isEnabled) {\n name += ' lm-mod-disabled';\n }\n if (data.item.isToggled) {\n name += ' lm-mod-toggled';\n }\n if (!data.item.isVisible) {\n name += ' lm-mod-hidden';\n }\n if (data.active) {\n name += ' lm-mod-active';\n }\n if (data.collapsed) {\n name += ' lm-mod-collapsed';\n }\n\n // Add the extra class.\n let extra = data.item.className;\n if (extra) {\n name += ` ${extra}`;\n }\n\n // Return the complete class name.\n return name;\n }\n\n /**\n * Create the dataset for the menu item.\n *\n * @param data - The data to use for creating the dataset.\n *\n * @returns The dataset for the menu item.\n */\n createItemDataset(data: IRenderData): ElementDataset {\n let result: ElementDataset;\n let { type, command, dataset } = data.item;\n if (type === 'command') {\n result = { ...dataset, type, command };\n } else {\n result = { ...dataset, type };\n }\n return result;\n }\n\n /**\n * Create the class name for the menu item icon.\n *\n * @param data - The data to use for the class name.\n *\n * @returns The full class name for the item icon.\n */\n createIconClass(data: IRenderData): string {\n let name = 'lm-Menu-itemIcon';\n let extra = data.item.iconClass;\n return extra ? `${name} ${extra}` : name;\n }\n\n /**\n * Create the aria attributes for menu item.\n *\n * @param data - The data to use for the aria attributes.\n *\n * @returns The aria attributes object for the item.\n */\n createItemARIA(data: IRenderData): ElementARIAAttrs {\n let aria: { [T in ARIAAttrNames]?: string } = {};\n switch (data.item.type) {\n case 'separator':\n aria.role = 'presentation';\n break;\n case 'submenu':\n aria['aria-haspopup'] = 'true';\n if (!data.item.isEnabled) {\n aria['aria-disabled'] = 'true';\n }\n break;\n default:\n if (!data.item.isEnabled) {\n aria['aria-disabled'] = 'true';\n }\n if (data.item.isToggled) {\n aria.role = 'menuitemcheckbox';\n aria['aria-checked'] = 'true';\n } else {\n aria.role = 'menuitem';\n }\n }\n return aria;\n }\n\n /**\n * Create the render content for the label node.\n *\n * @param data - The data to use for the label content.\n *\n * @returns The content to add to the label node.\n */\n formatLabel(data: IRenderData): h.Child {\n // Fetch the label text and mnemonic index.\n let { label, mnemonic } = data.item;\n\n // If the index is out of range, do not modify the label.\n if (mnemonic < 0 || mnemonic >= label.length) {\n return label;\n }\n\n // Split the label into parts.\n let prefix = label.slice(0, mnemonic);\n let suffix = label.slice(mnemonic + 1);\n let char = label[mnemonic];\n\n // Wrap the mnemonic character in a span.\n let span = h.span({ className: 'lm-Menu-itemMnemonic' }, char);\n\n // Return the content parts.\n return [prefix, span, suffix];\n }\n\n /**\n * Create the render content for the shortcut node.\n *\n * @param data - The data to use for the shortcut content.\n *\n * @returns The content to add to the shortcut node.\n */\n formatShortcut(data: IRenderData): h.Child {\n let kb = data.item.keyBinding;\n return kb ? CommandRegistry.formatKeystroke(kb.keys) : null;\n }\n }\n\n /**\n * The default `Renderer` instance.\n */\n export const defaultRenderer = new Renderer();\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * The ms delay for opening and closing a submenu.\n */\n export const TIMER_DELAY = 300;\n\n /**\n * The horizontal pixel overlap for an open submenu.\n */\n export const SUBMENU_OVERLAP = 3;\n\n function getWindowData(element: HTMLElement): IWindowData {\n\n return _getWindowData(element);\n }\n\n /**\n * Store window data in transient cache.\n *\n * The transient cache will be released upon `getWindowData()` call.\n * If this function is called multiple times, the cache will be\n * retained until as many calls to `getWindowData()` were made.\n *\n * Note: should be called before any DOM modifications.\n */\n export function saveWindowData(): void {\n }\n\n /**\n * Create the DOM node for a menu.\n */\n export function createNode(): HTMLDivElement {\n let node = document.createElement('div');\n let content = document.createElement('ul');\n content.className = 'lm-Menu-content';\n node.appendChild(content);\n content.setAttribute('role', 'menu');\n node.tabIndex = 0;\n return node;\n }\n\n /**\n * Test whether a menu item can be activated.\n */\n export function canActivate(item: Menu.IItem): boolean {\n return item.type !== 'separator' && item.isEnabled && item.isVisible;\n }\n\n /**\n * Create a new menu item for an owner menu.\n */\n export function createItem(\n owner: Menu,\n options: Menu.IItemOptions\n ): Menu.IItem {\n return new MenuItem(owner.commands, options);\n }\n\n /**\n * Hit test a menu hierarchy starting at the given root.\n */\n export function hitTestMenus(menu: Menu, x: number, y: number): boolean {\n for (let temp: Menu | null = menu; temp; temp = temp.childMenu) {\n if (ElementExt.hitTest(temp.node, x, y)) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * Compute which extra separator items should be collapsed.\n */\n export function computeCollapsed(\n items: ReadonlyArray\n ): boolean[] {\n // Allocate the return array and fill it with `false`.\n let result = new Array(items.length);\n ArrayExt.fill(result, false);\n\n // Collapse the leading separators.\n let k1 = 0;\n let n = items.length;\n for (; k1 < n; ++k1) {\n let item = items[k1];\n if (!item.isVisible) {\n continue;\n }\n if (item.type !== 'separator') {\n break;\n }\n result[k1] = true;\n }\n\n // Hide the trailing separators.\n let k2 = n - 1;\n for (; k2 >= 0; --k2) {\n let item = items[k2];\n if (!item.isVisible) {\n continue;\n }\n if (item.type !== 'separator') {\n break;\n }\n result[k2] = true;\n }\n\n // Hide the remaining consecutive separators.\n let hide = false;\n while (++k1 < k2) {\n let item = items[k1];\n if (!item.isVisible) {\n continue;\n }\n if (item.type !== 'separator') {\n hide = false;\n } else if (hide) {\n result[k1] = true;\n } else {\n hide = true;\n }\n }\n\n // Return the resulting flags.\n return result;\n }\n\n function _getWindowData(element: HTMLElement): IWindowData {\n return {\n pageXOffset: element.ownerDocument.defaultView?.window.scrollX || 0,\n pageYOffset: element.ownerDocument.defaultView?.window.scrollY || 0,\n clientWidth: element.ownerDocument.documentElement.clientWidth,\n clientHeight: element.ownerDocument.documentElement.clientHeight\n };\n }\n\n /**\n * Open a menu as a root menu at the target location.\n */\n export function openRootMenu(\n menu: Menu,\n x: number,\n y: number,\n forceX: boolean,\n forceY: boolean,\n horizontalAlignment: 'left' | 'right',\n host: HTMLElement | null,\n ref: HTMLElement | null\n ): void {\n // Get the current position and size of the main viewport.\n const windowData = getWindowData(host || menu.node);\n let px = windowData.pageXOffset;\n let py = windowData.pageYOffset;\n let cw = windowData.clientWidth;\n let ch = windowData.clientHeight;\n\n // Ensure the menu is updated before attaching and measuring.\n MessageLoop.sendMessage(menu, Widget.Msg.UpdateRequest);\n\n // Compute the maximum allowed height for the menu.\n let maxHeight = ch - (forceY ? y : 0);\n\n // Fetch common variables.\n let node = menu.node;\n let style = node.style;\n style.top = '0';\n style.left = '0';\n\n // Clear the menu geometry and prepare it for measuring.\n style.opacity = '0';\n style.maxHeight = `${maxHeight}px`;\n\n // Attach the menu to the document.\n Widget.attach(menu, host || document.body, ref);\n\n // Measure the size of the menu.\n let { width, height } = node.getBoundingClientRect();\n\n // align the menu to the right of the target if requested or language is RTL\n if (horizontalAlignment === 'right') {\n x -= width;\n }\n\n // Adjust the X position of the menu to fit on-screen.\n if (!forceX && x + width > px + cw) {\n x = px + cw - width;\n }\n\n // Adjust the Y position of the menu to fit on-screen.\n if (!forceY && y + height > py + ch) {\n if (y > py + ch) {\n y = py + ch - height;\n } else {\n y = y - height;\n }\n }\n\n // Update the position of the menu to the computed position.\n style.transform = `translate(${Math.max(0, x)}px, ${Math.max(0, y)}px`;\n\n // Finally, make the menu visible on the screen.\n style.opacity = '1';\n }\n\n /**\n * Open a menu as a submenu using an item node for positioning.\n */\n export function openSubmenu(submenu: Menu, itemNode: HTMLElement): void {\n // Get the current position and size of the main viewport.\n const windowData = getWindowData(itemNode);\n let px = windowData.pageXOffset;\n let py = windowData.pageYOffset;\n let cw = windowData.clientWidth;\n let ch = windowData.clientHeight;\n\n // Ensure the menu is updated before opening.\n MessageLoop.sendMessage(submenu, Widget.Msg.UpdateRequest);\n\n // Compute the maximum allowed height for the menu.\n let maxHeight = ch;\n\n // Fetch common variables.\n let node = submenu.node;\n let style = node.style;\n\n // Clear the menu geometry and prepare it for measuring.\n style.opacity = '0';\n style.maxHeight = `${maxHeight}px`;\n\n // Attach the menu to the document.\n Widget.attach(submenu, itemNode.ownerDocument.body);\n\n // Measure the size of the menu.\n let { width, height } = node.getBoundingClientRect();\n\n // Compute the box sizing for the menu.\n let box = ElementExt.boxSizing(submenu.node);\n\n // Get the bounding rect for the target item node.\n let itemRect = itemNode.getBoundingClientRect();\n\n // Compute the target X position.\n let x = itemRect.right - SUBMENU_OVERLAP;\n\n // Adjust the X position to fit on the screen.\n if (x + width > px + cw) {\n x = itemRect.left + SUBMENU_OVERLAP - width;\n }\n\n // Compute the target Y position.\n let y = itemRect.top - box.borderTop - box.paddingTop;\n\n // Adjust the Y position to fit on the screen.\n if (y + height > py + ch) {\n y = itemRect.bottom + box.borderBottom + box.paddingBottom - height;\n }\n\n style.top = '0';\n style.left = '0';\n // Update the position of the menu to the computed position.\n style.transform = `translate(${Math.max(0, x)}px, ${Math.max(0, y)}px`;\n\n // Finally, make the menu visible on the screen.\n style.opacity = '1';\n }\n\n /**\n * The results of a mnemonic search.\n */\n export interface IMnemonicResult {\n /**\n * The index of the first matching mnemonic item, or `-1`.\n */\n index: number;\n\n /**\n * Whether multiple mnemonic items matched.\n */\n multiple: boolean;\n\n /**\n * The index of the first auto matched non-mnemonic item.\n */\n auto: number;\n }\n\n /**\n * Find the best matching mnemonic item.\n *\n * The search starts at the given index and wraps around.\n */\n export function findMnemonic(\n items: ReadonlyArray,\n key: string,\n start: number\n ): IMnemonicResult {\n // Setup the result variables.\n let index = -1;\n let auto = -1;\n let multiple = false;\n\n // Normalize the key to upper case.\n let upperKey = key.toUpperCase();\n\n // Search the items from the given start index.\n for (let i = 0, n = items.length; i < n; ++i) {\n // Compute the wrapped index.\n let k = (i + start) % n;\n\n // Lookup the item\n let item = items[k];\n\n // Ignore items which cannot be activated.\n if (!canActivate(item)) {\n continue;\n }\n\n // Ignore items with an empty label.\n let label = item.label;\n if (label.length === 0) {\n continue;\n }\n\n // Lookup the mnemonic index for the label.\n let mn = item.mnemonic;\n\n // Handle a valid mnemonic index.\n if (mn >= 0 && mn < label.length) {\n if (label[mn].toUpperCase() === upperKey) {\n if (index === -1) {\n index = k;\n } else {\n multiple = true;\n }\n }\n continue;\n }\n\n // Finally, handle the auto index if possible.\n if (auto === -1 && label[0].toUpperCase() === upperKey) {\n auto = k;\n }\n }\n\n // Return the search results.\n return { index, multiple, auto };\n }\n\n /**\n * A concrete implementation of `Menu.IItem`.\n */\n class MenuItem implements Menu.IItem {\n /**\n * Construct a new menu item.\n */\n constructor(commands: CommandRegistry, options: Menu.IItemOptions) {\n this._commands = commands;\n this.type = options.type || 'command';\n this.command = options.command || '';\n this.args = options.args || JSONExt.emptyObject;\n this.submenu = options.submenu || null;\n }\n\n /**\n * The type of the menu item.\n */\n readonly type: Menu.ItemType;\n\n /**\n * The command to execute when the item is triggered.\n */\n readonly command: string;\n\n /**\n * The arguments for the command.\n */\n readonly args: ReadonlyJSONObject;\n\n /**\n * The submenu for a `'submenu'` type item.\n */\n readonly submenu: Menu | null;\n\n /**\n * The display label for the menu item.\n */\n get label(): string {\n if (this.type === 'command') {\n return this._commands.label(this.command, this.args);\n }\n if (this.type === 'submenu' && this.submenu) {\n return this.submenu.title.label;\n }\n return '';\n }\n\n /**\n * The mnemonic index for the menu item.\n */\n get mnemonic(): number {\n if (this.type === 'command') {\n return this._commands.mnemonic(this.command, this.args);\n }\n if (this.type === 'submenu' && this.submenu) {\n return this.submenu.title.mnemonic;\n }\n return -1;\n }\n\n /**\n * The icon renderer for the menu item.\n */\n get icon(): VirtualElement.IRenderer | undefined {\n if (this.type === 'command') {\n return this._commands.icon(this.command, this.args);\n }\n if (this.type === 'submenu' && this.submenu) {\n return this.submenu.title.icon;\n }\n return undefined;\n }\n\n /**\n * The icon class for the menu item.\n */\n get iconClass(): string {\n if (this.type === 'command') {\n return this._commands.iconClass(this.command, this.args);\n }\n if (this.type === 'submenu' && this.submenu) {\n return this.submenu.title.iconClass;\n }\n return '';\n }\n\n /**\n * The icon label for the menu item.\n */\n get iconLabel(): string {\n if (this.type === 'command') {\n return this._commands.iconLabel(this.command, this.args);\n }\n if (this.type === 'submenu' && this.submenu) {\n return this.submenu.title.iconLabel;\n }\n return '';\n }\n\n /**\n * The display caption for the menu item.\n */\n get caption(): string {\n if (this.type === 'command') {\n return this._commands.caption(this.command, this.args);\n }\n if (this.type === 'submenu' && this.submenu) {\n return this.submenu.title.caption;\n }\n return '';\n }\n\n /**\n * The extra class name for the menu item.\n */\n get className(): string {\n if (this.type === 'command') {\n return this._commands.className(this.command, this.args);\n }\n if (this.type === 'submenu' && this.submenu) {\n return this.submenu.title.className;\n }\n return '';\n }\n\n /**\n * The dataset for the menu item.\n */\n get dataset(): CommandRegistry.Dataset {\n if (this.type === 'command') {\n return this._commands.dataset(this.command, this.args);\n }\n if (this.type === 'submenu' && this.submenu) {\n return this.submenu.title.dataset;\n }\n return {};\n }\n\n /**\n * Whether the menu item is enabled.\n */\n get isEnabled(): boolean {\n if (this.type === 'command') {\n return this._commands.isEnabled(this.command, this.args);\n }\n if (this.type === 'submenu') {\n return this.submenu !== null;\n }\n return true;\n }\n\n /**\n * Whether the menu item is toggled.\n */\n get isToggled(): boolean {\n if (this.type === 'command') {\n return this._commands.isToggled(this.command, this.args);\n }\n return false;\n }\n\n /**\n * Whether the menu item is visible.\n */\n get isVisible(): boolean {\n if (this.type === 'command') {\n return this._commands.isVisible(this.command, this.args);\n }\n if (this.type === 'submenu') {\n return this.submenu !== null;\n }\n return true;\n }\n\n /**\n * The key binding for the menu item.\n */\n get keyBinding(): CommandRegistry.IKeyBinding | null {\n if (this.type === 'command') {\n let { command, args } = this;\n return (\n ArrayExt.findLastValue(this._commands.keyBindings, kb => {\n return kb.command === command && JSONExt.deepEqual(kb.args, args);\n }) || null\n );\n }\n return null;\n }\n\n private _commands: CommandRegistry;\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { CommandRegistry } from '@lumino/commands';\n\nimport { DisposableDelegate, IDisposable } from '@lumino/disposable';\n\nimport { Selector } from '@lumino/domutils';\n\nimport { Menu } from './menu';\n\n/**\n * An object which implements a universal context menu.\n *\n * #### Notes\n * The items shown in the context menu are determined by CSS selector\n * matching against the DOM hierarchy at the site of the mouse click.\n * This is similar in concept to how keyboard shortcuts are matched\n * in the command registry.\n */\nexport class ContextMenu {\n /**\n * Construct a new context menu.\n *\n * @param options - The options for initializing the menu.\n */\n constructor(options: ContextMenu.IOptions) {\n const { groupByTarget, sortBySelector, ...others } = options;\n this.menu = new Menu(others);\n this._groupByTarget = groupByTarget !== false;\n this._sortBySelector = sortBySelector !== false;\n }\n\n /**\n * The menu widget which displays the matched context items.\n */\n readonly menu: Menu;\n\n /**\n * Add an item to the context menu.\n *\n * @param options - The options for creating the item.\n *\n * @returns A disposable which will remove the item from the menu.\n */\n addItem(options: ContextMenu.IItemOptions): IDisposable {\n // Create an item from the given options.\n let item = Private.createItem(options, this._idTick++);\n\n // Add the item to the internal array.\n this._items.push(item);\n\n // Return a disposable which will remove the item.\n return new DisposableDelegate(() => {\n ArrayExt.removeFirstOf(this._items, item);\n });\n }\n\n /**\n * Open the context menu in response to a `'contextmenu'` event.\n *\n * @param event - The `'contextmenu'` event of interest.\n *\n * @returns `true` if the menu was opened, or `false` if no items\n * matched the event and the menu was not opened.\n *\n * #### Notes\n * This method will populate the context menu with items which match\n * the propagation path of the event, then open the menu at the mouse\n * position indicated by the event.\n */\n open(event: MouseEvent): boolean {\n // Prior to any DOM modifications update the window data.\n Menu.saveWindowData();\n\n // Clear the current contents of the context menu.\n this.menu.clearItems();\n\n // Bail early if there are no items to match.\n if (this._items.length === 0) {\n return false;\n }\n\n // Find the matching items for the event.\n let items = Private.matchItems(\n this._items,\n event,\n this._groupByTarget,\n this._sortBySelector\n );\n\n // Bail if there are no matching items.\n if (!items || items.length === 0) {\n return false;\n }\n\n // Add the filtered items to the menu.\n for (const item of items) {\n this.menu.addItem(item);\n }\n\n // Open the context menu at the current mouse position.\n this.menu.open(event.clientX, event.clientY);\n\n // Indicate success.\n return true;\n }\n\n private _groupByTarget: boolean = true;\n private _idTick = 0;\n private _items: Private.IItem[] = [];\n private _sortBySelector: boolean = true;\n}\n\n/**\n * The namespace for the `ContextMenu` class statics.\n */\nexport namespace ContextMenu {\n /**\n * An options object for initializing a context menu.\n */\n export interface IOptions {\n /**\n * The command registry to use with the context menu.\n */\n commands: CommandRegistry;\n\n /**\n * A custom renderer for use with the context menu.\n */\n renderer?: Menu.IRenderer;\n\n /**\n * Whether to sort by selector and rank or only rank.\n *\n * Default true.\n */\n sortBySelector?: boolean;\n\n /**\n * Whether to group items following the DOM hierarchy.\n *\n * Default true.\n *\n * #### Note\n * If true, when the mouse event occurs on element `span` within `div.top`,\n * the items matching `div.top` will be shown before the ones matching `body`.\n */\n groupByTarget?: boolean;\n }\n\n /**\n * An options object for creating a context menu item.\n */\n export interface IItemOptions extends Menu.IItemOptions {\n /**\n * The CSS selector for the context menu item.\n *\n * The context menu item will only be displayed in the context menu\n * when the selector matches a node on the propagation path of the\n * contextmenu event. This allows the menu item to be restricted to\n * user-defined contexts.\n *\n * The selector must not contain commas.\n */\n selector: string;\n\n /**\n * The rank for the item.\n *\n * The rank is used as a tie-breaker when ordering context menu\n * items for display. Items are sorted in the following order:\n * 1. Depth in the DOM tree (deeper is better)\n * 2. Selector specificity (higher is better)\n * 3. Rank (lower is better)\n * 4. Insertion order\n *\n * The default rank is `Infinity`.\n */\n rank?: number;\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * A normalized item for a context menu.\n */\n export interface IItem extends Menu.IItemOptions {\n /**\n * The selector for the item.\n */\n selector: string;\n\n /**\n * The rank for the item.\n */\n rank: number;\n\n /**\n * The tie-breaking id for the item.\n */\n id: number;\n }\n\n /**\n * Create a normalized context menu item from an options object.\n */\n export function createItem(\n options: ContextMenu.IItemOptions,\n id: number\n ): IItem {\n let selector = validateSelector(options.selector);\n let rank = options.rank !== undefined ? options.rank : Infinity;\n return { ...options, selector, rank, id };\n }\n\n /**\n * Find the items which match a context menu event.\n *\n * The results are sorted by DOM level, specificity, and rank.\n */\n export function matchItems(\n items: IItem[],\n event: MouseEvent,\n groupByTarget: boolean,\n sortBySelector: boolean\n ): IItem[] | null {\n // Look up the target of the event.\n let target = event.target as Element | null;\n\n // Bail if there is no target.\n if (!target) {\n return null;\n }\n\n // Look up the current target of the event.\n let currentTarget = event.currentTarget as Element | null;\n\n // Bail if there is no current target.\n if (!currentTarget) {\n return null;\n }\n\n // There are some third party libraries that cause the `target` to\n // be detached from the DOM before lumino can process the event.\n // If that happens, search for a new target node by point. If that\n // node is still dangling, bail.\n if (!currentTarget.contains(target)) {\n target = document.elementFromPoint(event.clientX, event.clientY);\n if (!target || !currentTarget.contains(target)) {\n return null;\n }\n }\n\n // Set up the result array.\n let result: IItem[] = [];\n\n // Copy the items array to allow in-place modification.\n let availableItems: Array = items.slice();\n\n // Walk up the DOM hierarchy searching for matches.\n while (target !== null) {\n // Set up the match array for this DOM level.\n let matches: IItem[] = [];\n\n // Search the remaining items for matches.\n for (let i = 0, n = availableItems.length; i < n; ++i) {\n // Fetch the item.\n let item = availableItems[i];\n\n // Skip items which are already consumed.\n if (!item) {\n continue;\n }\n\n // Skip items which do not match the element.\n if (!Selector.matches(target, item.selector)) {\n continue;\n }\n\n // Add the matched item to the result for this DOM level.\n matches.push(item);\n\n // Mark the item as consumed.\n availableItems[i] = null;\n }\n\n // Sort the matches for this level and add them to the results.\n if (matches.length !== 0) {\n if (groupByTarget) {\n matches.sort(sortBySelector ? itemCmp : itemCmpRank);\n }\n result.push(...matches);\n }\n\n // Stop searching at the limits of the DOM range.\n if (target === currentTarget) {\n break;\n }\n\n // Step to the parent DOM level.\n target = target.parentElement;\n }\n\n if (!groupByTarget) {\n result.sort(sortBySelector ? itemCmp : itemCmpRank);\n }\n\n // Return the matched and sorted results.\n return result;\n }\n\n /**\n * Validate the selector for a menu item.\n *\n * This returns the validated selector, or throws if the selector is\n * invalid or contains commas.\n */\n function validateSelector(selector: string): string {\n if (selector.indexOf(',') !== -1) {\n throw new Error(`Selector cannot contain commas: ${selector}`);\n }\n if (!Selector.isValid(selector)) {\n throw new Error(`Invalid selector: ${selector}`);\n }\n return selector;\n }\n\n /**\n * A sort comparison function for a context menu item by ranks.\n */\n function itemCmpRank(a: IItem, b: IItem): number {\n // Sort based on rank.\n let r1 = a.rank;\n let r2 = b.rank;\n if (r1 !== r2) {\n return r1 < r2 ? -1 : 1; // Infinity-safe\n }\n\n // When all else fails, sort by item id.\n return a.id - b.id;\n }\n\n /**\n * A sort comparison function for a context menu item by selectors and ranks.\n */\n function itemCmp(a: IItem, b: IItem): number {\n // Sort first based on selector specificity.\n let s1 = Selector.calculateSpecificity(a.selector);\n let s2 = Selector.calculateSpecificity(b.selector);\n if (s1 !== s2) {\n return s2 - s1;\n }\n\n // If specificities are equal\n return itemCmpRank(a, b);\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { IDisposable } from '@lumino/disposable';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Drag } from '@lumino/dragdrop';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport {\n ElementARIAAttrs,\n ElementBaseAttrs,\n ElementDataset,\n ElementInlineStyle,\n h,\n VirtualDOM,\n VirtualElement\n} from '@lumino/virtualdom';\n\nimport { Title } from './title';\n\nimport { Widget } from './widget';\n\nconst ARROW_KEYS = [\n 'ArrowLeft',\n 'ArrowUp',\n 'ArrowRight',\n 'ArrowDown',\n 'Home',\n 'End'\n];\n\n/**\n * A widget which displays titles as a single row or column of tabs.\n *\n * #### Notes\n * If CSS transforms are used to rotate nodes for vertically oriented\n * text, then tab dragging will not work correctly. The `tabsMovable`\n * property should be set to `false` when rotating nodes from CSS.\n */\nexport class TabBar extends Widget {\n /**\n * Construct a new tab bar.\n *\n * @param options - The options for initializing the tab bar.\n */\n constructor(options: TabBar.IOptions = {}) {\n super({ node: Private.createNode() });\n this.addClass('lm-TabBar');\n this.contentNode.setAttribute('role', 'tablist');\n this.setFlag(Widget.Flag.DisallowLayout);\n this._document = options.document || document;\n this.tabsMovable = options.tabsMovable || false;\n this.titlesEditable = options.titlesEditable || false;\n this.allowDeselect = options.allowDeselect || false;\n this.addButtonEnabled = options.addButtonEnabled || false;\n this.insertBehavior = options.insertBehavior || 'select-tab-if-needed';\n this.name = options.name || '';\n this.orientation = options.orientation || 'horizontal';\n this.removeBehavior = options.removeBehavior || 'select-tab-after';\n this.renderer = options.renderer || TabBar.defaultRenderer;\n }\n\n /**\n * Dispose of the resources held by the widget.\n */\n dispose(): void {\n this._releaseMouse();\n this._titles.length = 0;\n this._previousTitle = null;\n super.dispose();\n }\n\n /**\n * A signal emitted when the current tab is changed.\n *\n * #### Notes\n * This signal is emitted when the currently selected tab is changed\n * either through user or programmatic interaction.\n *\n * Notably, this signal is not emitted when the index of the current\n * tab changes due to tabs being inserted, removed, or moved. It is\n * only emitted when the actual current tab node is changed.\n */\n get currentChanged(): ISignal> {\n return this._currentChanged;\n }\n\n /**\n * A signal emitted when a tab is moved by the user.\n *\n * #### Notes\n * This signal is emitted when a tab is moved by user interaction.\n *\n * This signal is not emitted when a tab is moved programmatically.\n */\n get tabMoved(): ISignal> {\n return this._tabMoved;\n }\n\n /**\n * A signal emitted when a tab is clicked by the user.\n *\n * #### Notes\n * If the clicked tab is not the current tab, the clicked tab will be\n * made current and the `currentChanged` signal will be emitted first.\n *\n * This signal is emitted even if the clicked tab is the current tab.\n */\n get tabActivateRequested(): ISignal<\n this,\n TabBar.ITabActivateRequestedArgs\n > {\n return this._tabActivateRequested;\n }\n\n /**\n * A signal emitted when the tab bar add button is clicked.\n */\n get addRequested(): ISignal {\n return this._addRequested;\n }\n\n /**\n * A signal emitted when a tab close icon is clicked.\n *\n * #### Notes\n * This signal is not emitted unless the tab title is `closable`.\n */\n get tabCloseRequested(): ISignal> {\n return this._tabCloseRequested;\n }\n\n /**\n * A signal emitted when a tab is dragged beyond the detach threshold.\n *\n * #### Notes\n * This signal is emitted when the user drags a tab with the mouse,\n * and mouse is dragged beyond the detach threshold.\n *\n * The consumer of the signal should call `releaseMouse` and remove\n * the tab in order to complete the detach.\n *\n * This signal is only emitted once per drag cycle.\n */\n get tabDetachRequested(): ISignal> {\n return this._tabDetachRequested;\n }\n\n /**\n * The renderer used by the tab bar.\n */\n readonly renderer: TabBar.IRenderer;\n\n /**\n * The document to use with the tab bar.\n *\n * The default is the global `document` instance.\n */\n get document(): Document | ShadowRoot {\n return this._document;\n }\n\n /**\n * Whether the tabs are movable by the user.\n *\n * #### Notes\n * Tabs can always be moved programmatically.\n */\n tabsMovable: boolean;\n\n /**\n * Whether the titles can be user-edited.\n *\n */\n get titlesEditable(): boolean {\n return this._titlesEditable;\n }\n\n /**\n * Set whether titles can be user edited.\n *\n */\n set titlesEditable(value: boolean) {\n this._titlesEditable = value;\n }\n\n /**\n * Whether a tab can be deselected by the user.\n *\n * #### Notes\n * Tabs can be always be deselected programmatically.\n */\n allowDeselect: boolean;\n\n /**\n * The selection behavior when inserting a tab.\n */\n insertBehavior: TabBar.InsertBehavior;\n\n /**\n * The selection behavior when removing a tab.\n */\n removeBehavior: TabBar.RemoveBehavior;\n\n /**\n * Get the currently selected title.\n *\n * #### Notes\n * This will be `null` if no tab is selected.\n */\n get currentTitle(): Title | null {\n return this._titles[this._currentIndex] || null;\n }\n\n /**\n * Set the currently selected title.\n *\n * #### Notes\n * If the title does not exist, the title will be set to `null`.\n */\n set currentTitle(value: Title | null) {\n this.currentIndex = value ? this._titles.indexOf(value) : -1;\n }\n\n /**\n * Get the index of the currently selected tab.\n *\n * #### Notes\n * This will be `-1` if no tab is selected.\n */\n get currentIndex(): number {\n return this._currentIndex;\n }\n\n /**\n * Set the index of the currently selected tab.\n *\n * #### Notes\n * If the value is out of range, the index will be set to `-1`.\n */\n set currentIndex(value: number) {\n // Adjust for an out of range index.\n if (value < 0 || value >= this._titles.length) {\n value = -1;\n }\n\n // Bail early if the index will not change.\n if (this._currentIndex === value) {\n return;\n }\n\n // Look up the previous index and title.\n let pi = this._currentIndex;\n let pt = this._titles[pi] || null;\n\n // Look up the current index and title.\n let ci = value;\n let ct = this._titles[ci] || null;\n\n // Update the current index and previous title.\n this._currentIndex = ci;\n this._previousTitle = pt;\n\n // Schedule an update of the tabs.\n this.update();\n\n // Emit the current changed signal.\n this._currentChanged.emit({\n previousIndex: pi,\n previousTitle: pt,\n currentIndex: ci,\n currentTitle: ct\n });\n }\n\n /**\n * Get the name of the tab bar.\n */\n get name(): string {\n return this._name;\n }\n\n /**\n * Set the name of the tab bar.\n */\n set name(value: string) {\n this._name = value;\n if (value) {\n this.contentNode.setAttribute('aria-label', value);\n } else {\n this.contentNode.removeAttribute('aria-label');\n }\n }\n\n /**\n * Get the orientation of the tab bar.\n *\n * #### Notes\n * This controls whether the tabs are arranged in a row or column.\n */\n get orientation(): TabBar.Orientation {\n return this._orientation;\n }\n\n /**\n * Set the orientation of the tab bar.\n *\n * #### Notes\n * This controls whether the tabs are arranged in a row or column.\n */\n set orientation(value: TabBar.Orientation) {\n // Do nothing if the orientation does not change.\n if (this._orientation === value) {\n return;\n }\n\n // Release the mouse before making any changes.\n this._releaseMouse();\n\n // Toggle the orientation values.\n this._orientation = value;\n this.dataset['orientation'] = value;\n this.contentNode.setAttribute('aria-orientation', value);\n }\n\n /**\n * Whether the add button is enabled.\n */\n get addButtonEnabled(): boolean {\n return this._addButtonEnabled;\n }\n\n /**\n * Set whether the add button is enabled.\n */\n set addButtonEnabled(value: boolean) {\n // Do nothing if the value does not change.\n if (this._addButtonEnabled === value) {\n return;\n }\n\n this._addButtonEnabled = value;\n if (value) {\n this.addButtonNode.classList.remove('lm-mod-hidden');\n } else {\n this.addButtonNode.classList.add('lm-mod-hidden');\n }\n }\n\n /**\n * A read-only array of the titles in the tab bar.\n */\n get titles(): ReadonlyArray> {\n return this._titles;\n }\n\n /**\n * The tab bar content node.\n *\n * #### Notes\n * This is the node which holds the tab nodes.\n *\n * Modifying this node directly can lead to undefined behavior.\n */\n get contentNode(): HTMLUListElement {\n return this.node.getElementsByClassName(\n 'lm-TabBar-content'\n )[0] as HTMLUListElement;\n }\n\n /**\n * The tab bar add button node.\n *\n * #### Notes\n * This is the node which holds the add button.\n *\n * Modifying this node directly can lead to undefined behavior.\n */\n get addButtonNode(): HTMLDivElement {\n return this.node.getElementsByClassName(\n 'lm-TabBar-addButton'\n )[0] as HTMLDivElement;\n }\n\n /**\n * Add a tab to the end of the tab bar.\n *\n * @param value - The title which holds the data for the tab,\n * or an options object to convert to a title.\n *\n * @returns The title object added to the tab bar.\n *\n * #### Notes\n * If the title is already added to the tab bar, it will be moved.\n */\n addTab(value: Title | Title.IOptions): Title {\n return this.insertTab(this._titles.length, value);\n }\n\n /**\n * Insert a tab into the tab bar at the specified index.\n *\n * @param index - The index at which to insert the tab.\n *\n * @param value - The title which holds the data for the tab,\n * or an options object to convert to a title.\n *\n * @returns The title object added to the tab bar.\n *\n * #### Notes\n * The index will be clamped to the bounds of the tabs.\n *\n * If the title is already added to the tab bar, it will be moved.\n */\n insertTab(index: number, value: Title | Title.IOptions): Title {\n // Release the mouse before making any changes.\n this._releaseMouse();\n\n // Coerce the value to a title.\n let title = Private.asTitle(value);\n\n // Look up the index of the title.\n let i = this._titles.indexOf(title);\n\n // Clamp the insert index to the array bounds.\n let j = Math.max(0, Math.min(index, this._titles.length));\n\n // If the title is not in the array, insert it.\n if (i === -1) {\n // Insert the title into the array.\n ArrayExt.insert(this._titles, j, title);\n\n // Connect to the title changed signal.\n title.changed.connect(this._onTitleChanged, this);\n\n // Schedule an update of the tabs.\n this.update();\n\n // Adjust the current index for the insert.\n this._adjustCurrentForInsert(j, title);\n\n // Return the title added to the tab bar.\n return title;\n }\n\n // Otherwise, the title exists in the array and should be moved.\n\n // Adjust the index if the location is at the end of the array.\n if (j === this._titles.length) {\n j--;\n }\n\n // Bail if there is no effective move.\n if (i === j) {\n return title;\n }\n\n // Move the title to the new location.\n ArrayExt.move(this._titles, i, j);\n\n // Schedule an update of the tabs.\n this.update();\n\n // Adjust the current index for the move.\n this._adjustCurrentForMove(i, j);\n\n // Return the title added to the tab bar.\n return title;\n }\n\n /**\n * Remove a tab from the tab bar.\n *\n * @param title - The title for the tab to remove.\n *\n * #### Notes\n * This is a no-op if the title is not in the tab bar.\n */\n removeTab(title: Title): void {\n this.removeTabAt(this._titles.indexOf(title));\n }\n\n /**\n * Remove the tab at a given index from the tab bar.\n *\n * @param index - The index of the tab to remove.\n *\n * #### Notes\n * This is a no-op if the index is out of range.\n */\n removeTabAt(index: number): void {\n // Release the mouse before making any changes.\n this._releaseMouse();\n\n // Remove the title from the array.\n let title = ArrayExt.removeAt(this._titles, index);\n\n // Bail if the index is out of range.\n if (!title) {\n return;\n }\n\n // Disconnect from the title changed signal.\n title.changed.disconnect(this._onTitleChanged, this);\n\n // Clear the previous title if it's being removed.\n if (title === this._previousTitle) {\n this._previousTitle = null;\n }\n\n // Schedule an update of the tabs.\n this.update();\n\n // Adjust the current index for the remove.\n this._adjustCurrentForRemove(index, title);\n }\n\n /**\n * Remove all tabs from the tab bar.\n */\n clearTabs(): void {\n // Bail if there is nothing to remove.\n if (this._titles.length === 0) {\n return;\n }\n\n // Release the mouse before making any changes.\n this._releaseMouse();\n\n // Disconnect from the title changed signals.\n for (let title of this._titles) {\n title.changed.disconnect(this._onTitleChanged, this);\n }\n\n // Get the current index and title.\n let pi = this.currentIndex;\n let pt = this.currentTitle;\n\n // Reset the current index and previous title.\n this._currentIndex = -1;\n this._previousTitle = null;\n\n // Clear the title array.\n this._titles.length = 0;\n\n // Schedule an update of the tabs.\n this.update();\n\n // If no tab was selected, there's nothing else to do.\n if (pi === -1) {\n return;\n }\n\n // Emit the current changed signal.\n this._currentChanged.emit({\n previousIndex: pi,\n previousTitle: pt,\n currentIndex: -1,\n currentTitle: null\n });\n }\n\n /**\n * Release the mouse and restore the non-dragged tab positions.\n *\n * #### Notes\n * This will cause the tab bar to stop handling mouse events and to\n * restore the tabs to their non-dragged positions.\n */\n releaseMouse(): void {\n this._releaseMouse();\n }\n\n /**\n * Handle the DOM events for the tab bar.\n *\n * @param event - The DOM event sent to the tab bar.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the tab bar's DOM node.\n *\n * This should not be called directly by user code.\n */\n handleEvent(event: Event): void {\n switch (event.type) {\n case 'pointerdown':\n this._evtPointerDown(event as PointerEvent);\n break;\n case 'pointermove':\n this._evtPointerMove(event as PointerEvent);\n break;\n case 'pointerup':\n this._evtPointerUp(event as PointerEvent);\n break;\n case 'dblclick':\n this._evtDblClick(event as MouseEvent);\n break;\n case 'keydown':\n event.eventPhase === Event.CAPTURING_PHASE\n ? this._evtKeyDownCapturing(event as KeyboardEvent)\n : this._evtKeyDown(event as KeyboardEvent);\n break;\n case 'contextmenu':\n event.preventDefault();\n event.stopPropagation();\n break;\n }\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n this.node.addEventListener('pointerdown', this);\n this.node.addEventListener('dblclick', this);\n this.node.addEventListener('keydown', this);\n }\n\n /**\n * A message handler invoked on an `'after-detach'` message.\n */\n protected onAfterDetach(msg: Message): void {\n this.node.removeEventListener('pointerdown', this);\n this.node.removeEventListener('dblclick', this);\n this.node.removeEventListener('keydown', this);\n this._releaseMouse();\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n protected onUpdateRequest(msg: Message): void {\n let titles = this._titles;\n let renderer = this.renderer;\n let currentTitle = this.currentTitle;\n let content = new Array(titles.length);\n // Keep the tabindex=\"0\" attribute to the tab which handled it before the update.\n // If the add button handles it, no need to do anything. If no element of the tab\n // bar handles it, set it on the current or the first tab to ensure one element\n // handles it after update.\n const tabHandlingTabindex =\n this._getCurrentTabindex() ??\n (this._currentIndex > -1 ? this._currentIndex : 0);\n\n for (let i = 0, n = titles.length; i < n; ++i) {\n let title = titles[i];\n let current = title === currentTitle;\n let zIndex = current ? n : n - i - 1;\n let tabIndex = tabHandlingTabindex === i ? 0 : -1;\n content[i] = renderer.renderTab({ title, current, zIndex, tabIndex });\n }\n VirtualDOM.render(content, this.contentNode);\n }\n\n /**\n * Get the index of the tab which handles tabindex=\"0\".\n * If the add button handles tabindex=\"0\", -1 is returned.\n * If none of the previous handles tabindex=\"0\", null is returned.\n */\n private _getCurrentTabindex(): number | null {\n let index = null;\n const elemTabindex = this.contentNode.querySelector('li[tabindex=\"0\"]');\n if (elemTabindex) {\n index = [...this.contentNode.children].indexOf(elemTabindex);\n } else if (\n this._addButtonEnabled &&\n this.addButtonNode.getAttribute('tabindex') === '0'\n ) {\n index = -1;\n }\n return index;\n }\n\n /**\n * Handle the `'dblclick'` event for the tab bar.\n */\n private _evtDblClick(event: MouseEvent): void {\n // Do nothing if titles are not editable\n if (!this.titlesEditable) {\n return;\n }\n\n let tabs = this.contentNode.children;\n\n // Find the index of the targeted tab.\n let index = ArrayExt.findFirstIndex(tabs, tab => {\n return ElementExt.hitTest(tab, event.clientX, event.clientY);\n });\n\n // Do nothing if the press is not on a tab.\n if (index === -1) {\n return;\n }\n\n let title = this.titles[index];\n let label = tabs[index].querySelector('.lm-TabBar-tabLabel') as HTMLElement;\n if (label && label.contains(event.target as HTMLElement)) {\n let value = title.label || '';\n\n // Clear the label element\n let oldValue = label.innerHTML;\n label.innerHTML = '';\n\n let input = document.createElement('input');\n input.classList.add('lm-TabBar-tabInput');\n input.value = value;\n label.appendChild(input);\n\n let onblur = () => {\n input.removeEventListener('blur', onblur);\n label.innerHTML = oldValue;\n this.node.addEventListener('keydown', this);\n };\n\n input.addEventListener('dblclick', (event: Event) =>\n event.stopPropagation()\n );\n input.addEventListener('blur', onblur);\n input.addEventListener('keydown', (event: KeyboardEvent) => {\n if (event.key === 'Enter') {\n if (input.value !== '') {\n title.label = title.caption = input.value;\n }\n onblur();\n } else if (event.key === 'Escape') {\n onblur();\n }\n });\n this.node.removeEventListener('keydown', this);\n input.select();\n input.focus();\n\n if (label.children.length > 0) {\n (label.children[0] as HTMLElement).focus();\n }\n }\n }\n\n /**\n * Handle the `'keydown'` event for the tab bar at capturing phase.\n */\n private _evtKeyDownCapturing(event: KeyboardEvent): void {\n if (event.eventPhase !== Event.CAPTURING_PHASE) {\n return;\n }\n\n // Stop all input events during drag.\n event.preventDefault();\n event.stopPropagation();\n\n // Release the mouse if `Escape` is pressed.\n if (event.key === 'Escape') {\n this._releaseMouse();\n }\n }\n\n /**\n * Handle the `'keydown'` event for the tab bar at target phase.\n */\n private _evtKeyDown(event: KeyboardEvent): void {\n // Allow for navigation using tab key\n if (event.key === 'Tab' || event.eventPhase === Event.CAPTURING_PHASE) {\n return;\n }\n\n // Check if Enter or Spacebar key has been pressed and open that tab\n if (\n event.key === 'Enter' ||\n event.key === 'Spacebar' ||\n event.key === ' '\n ) {\n // Get focus element that is in focus by the tab key\n const focusedElement = document.activeElement;\n\n // Test first if the focus is on the add button node\n if (\n this.addButtonEnabled &&\n this.addButtonNode.contains(focusedElement)\n ) {\n event.preventDefault();\n event.stopPropagation();\n this._addRequested.emit();\n } else {\n const index = ArrayExt.findFirstIndex(this.contentNode.children, tab =>\n tab.contains(focusedElement)\n );\n if (index >= 0) {\n event.preventDefault();\n event.stopPropagation();\n this.currentIndex = index;\n }\n }\n // Handle the arrow keys to switch tabs.\n } else if (ARROW_KEYS.includes(event.key)) {\n // Create a list of all focusable elements in the tab bar.\n const focusable: Element[] = [...this.contentNode.children];\n if (this.addButtonEnabled) {\n focusable.push(this.addButtonNode);\n }\n // If the tab bar contains only one element, nothing to do.\n if (focusable.length <= 1) {\n return;\n }\n event.preventDefault();\n event.stopPropagation();\n\n // Get the current focused element.\n let focusedIndex = focusable.indexOf(document.activeElement as Element);\n if (focusedIndex === -1) {\n focusedIndex = this._currentIndex;\n }\n\n // Find the next element to focus on.\n let nextFocused: Element | null | undefined;\n if (\n (event.key === 'ArrowRight' && this._orientation === 'horizontal') ||\n (event.key === 'ArrowDown' && this._orientation === 'vertical')\n ) {\n nextFocused = focusable[focusedIndex + 1] ?? focusable[0];\n } else if (\n (event.key === 'ArrowLeft' && this._orientation === 'horizontal') ||\n (event.key === 'ArrowUp' && this._orientation === 'vertical')\n ) {\n nextFocused =\n focusable[focusedIndex - 1] ?? focusable[focusable.length - 1];\n } else if (event.key === 'Home') {\n nextFocused = focusable[0];\n } else if (event.key === 'End') {\n nextFocused = focusable[focusable.length - 1];\n }\n\n // Change the focused element and the tabindex value.\n if (nextFocused) {\n focusable[focusedIndex]?.setAttribute('tabindex', '-1');\n nextFocused?.setAttribute('tabindex', '0');\n (nextFocused as HTMLElement).focus();\n }\n }\n }\n\n /**\n * Handle the `'pointerdown'` event for the tab bar.\n */\n private _evtPointerDown(event: PointerEvent | MouseEvent): void {\n // Do nothing if it's not a left or middle mouse press.\n if (event.button !== 0 && event.button !== 1) {\n return;\n }\n\n // Do nothing if a drag is in progress.\n if (this._dragData) {\n return;\n }\n\n // Do nothing if a title editable input was clicked.\n if (\n (event.target as HTMLElement).classList.contains('lm-TabBar-tabInput')\n ) {\n return;\n }\n\n // Check if the add button was clicked.\n let addButtonClicked =\n this.addButtonEnabled &&\n this.addButtonNode.contains(event.target as HTMLElement);\n\n // Lookup the tab nodes.\n let tabs = this.contentNode.children;\n\n // Find the index of the pressed tab.\n let index = ArrayExt.findFirstIndex(tabs, tab => {\n return ElementExt.hitTest(tab, event.clientX, event.clientY);\n });\n\n // Do nothing if the press is not on a tab or the add button.\n if (index === -1 && !addButtonClicked) {\n return;\n }\n\n // Pressing on a tab stops the event propagation.\n event.preventDefault();\n event.stopPropagation();\n\n // Initialize the non-measured parts of the drag data.\n this._dragData = {\n tab: tabs[index] as HTMLElement,\n index: index,\n pressX: event.clientX,\n pressY: event.clientY,\n tabPos: -1,\n tabSize: -1,\n tabPressPos: -1,\n targetIndex: -1,\n tabLayout: null,\n contentRect: null,\n override: null,\n dragActive: false,\n dragAborted: false,\n detachRequested: false\n };\n\n // Add the document pointer up listener.\n this.document.addEventListener('pointerup', this, true);\n\n // Do nothing else if the middle button or add button is clicked.\n if (event.button === 1 || addButtonClicked) {\n return;\n }\n\n // Do nothing else if the close icon is clicked.\n let icon = tabs[index].querySelector(this.renderer.closeIconSelector);\n if (icon && icon.contains(event.target as HTMLElement)) {\n return;\n }\n\n // Add the extra listeners if the tabs are movable.\n if (this.tabsMovable) {\n this.document.addEventListener('pointermove', this, true);\n this.document.addEventListener('keydown', this, true);\n this.document.addEventListener('contextmenu', this, true);\n }\n\n // Update the current index as appropriate.\n if (this.allowDeselect && this.currentIndex === index) {\n this.currentIndex = -1;\n } else {\n this.currentIndex = index;\n }\n\n // Do nothing else if there is no current tab.\n if (this.currentIndex === -1) {\n return;\n }\n\n // Emit the tab activate request signal.\n this._tabActivateRequested.emit({\n index: this.currentIndex,\n title: this.currentTitle!\n });\n }\n\n /**\n * Handle the `'pointermove'` event for the tab bar.\n */\n private _evtPointerMove(event: PointerEvent | MouseEvent): void {\n // Do nothing if no drag is in progress.\n let data = this._dragData;\n if (!data) {\n return;\n }\n\n // Suppress the event during a drag.\n event.preventDefault();\n event.stopPropagation();\n\n // Lookup the tab nodes.\n let tabs = this.contentNode.children;\n\n // Bail early if the drag threshold has not been met.\n if (!data.dragActive && !Private.dragExceeded(data, event)) {\n return;\n }\n\n // Activate the drag if necessary.\n if (!data.dragActive) {\n // Fill in the rest of the drag data measurements.\n let tabRect = data.tab.getBoundingClientRect();\n if (this._orientation === 'horizontal') {\n data.tabPos = data.tab.offsetLeft;\n data.tabSize = tabRect.width;\n data.tabPressPos = data.pressX - tabRect.left;\n } else {\n data.tabPos = data.tab.offsetTop;\n data.tabSize = tabRect.height;\n data.tabPressPos = data.pressY - tabRect.top;\n }\n data.tabPressOffset = {\n x: data.pressX - tabRect.left,\n y: data.pressY - tabRect.top\n };\n data.tabLayout = Private.snapTabLayout(tabs, this._orientation);\n data.contentRect = this.contentNode.getBoundingClientRect();\n data.override = Drag.overrideCursor('default');\n\n // Add the dragging style classes.\n data.tab.classList.add('lm-mod-dragging');\n this.addClass('lm-mod-dragging');\n\n // Mark the drag as active.\n data.dragActive = true;\n }\n\n // Emit the detach requested signal if the threshold is exceeded.\n if (!data.detachRequested && Private.detachExceeded(data, event)) {\n // Only emit the signal once per drag cycle.\n data.detachRequested = true;\n\n // Setup the arguments for the signal.\n let index = data.index;\n let clientX = event.clientX;\n let clientY = event.clientY;\n let tab = tabs[index] as HTMLElement;\n let title = this._titles[index];\n\n // Emit the tab detach requested signal.\n this._tabDetachRequested.emit({\n index,\n title,\n tab,\n clientX,\n clientY,\n offset: data.tabPressOffset\n });\n\n // Bail if the signal handler aborted the drag.\n if (data.dragAborted) {\n return;\n }\n }\n\n // Update the positions of the tabs.\n Private.layoutTabs(tabs, data, event, this._orientation);\n }\n\n /**\n * Handle the `'pointerup'` event for the document.\n */\n private _evtPointerUp(event: PointerEvent | MouseEvent): void {\n // Do nothing if it's not a left or middle mouse release.\n if (event.button !== 0 && event.button !== 1) {\n return;\n }\n\n // Do nothing if no drag is in progress.\n const data = this._dragData;\n if (!data) {\n return;\n }\n\n // Stop the event propagation.\n event.preventDefault();\n event.stopPropagation();\n\n // Remove the extra mouse event listeners.\n this.document.removeEventListener('pointermove', this, true);\n this.document.removeEventListener('pointerup', this, true);\n this.document.removeEventListener('keydown', this, true);\n this.document.removeEventListener('contextmenu', this, true);\n\n // Handle a release when the drag is not active.\n if (!data.dragActive) {\n // Clear the drag data.\n this._dragData = null;\n\n // Handle clicking the add button.\n let addButtonClicked =\n this.addButtonEnabled &&\n this.addButtonNode.contains(event.target as HTMLElement);\n if (addButtonClicked) {\n this._addRequested.emit(undefined);\n return;\n }\n\n // Lookup the tab nodes.\n let tabs = this.contentNode.children;\n\n // Find the index of the released tab.\n let index = ArrayExt.findFirstIndex(tabs, tab => {\n return ElementExt.hitTest(tab, event.clientX, event.clientY);\n });\n\n // Do nothing if the release is not on the original pressed tab.\n if (index !== data.index) {\n return;\n }\n\n // Ignore the release if the title is not closable.\n let title = this._titles[index];\n if (!title.closable) {\n return;\n }\n\n // Emit the close requested signal if the middle button is released.\n if (event.button === 1) {\n this._tabCloseRequested.emit({ index, title });\n return;\n }\n\n // Emit the close requested signal if the close icon was released.\n let icon = tabs[index].querySelector(this.renderer.closeIconSelector);\n if (icon && icon.contains(event.target as HTMLElement)) {\n this._tabCloseRequested.emit({ index, title });\n return;\n }\n\n // Otherwise, there is nothing left to do.\n return;\n }\n\n // Do nothing if the left button is not released.\n if (event.button !== 0) {\n return;\n }\n\n // Position the tab at its final resting position.\n Private.finalizeTabPosition(data, this._orientation);\n\n // Remove the dragging class from the tab so it can be transitioned.\n data.tab.classList.remove('lm-mod-dragging');\n\n // Parse the transition duration for releasing the tab.\n let duration = Private.parseTransitionDuration(data.tab);\n\n // Complete the release on a timer to allow the tab to transition.\n setTimeout(() => {\n // Do nothing if the drag has been aborted.\n if (data.dragAborted) {\n return;\n }\n\n // Clear the drag data reference.\n this._dragData = null;\n\n // Reset the positions of the tabs.\n Private.resetTabPositions(this.contentNode.children, this._orientation);\n\n // Clear the cursor grab.\n data.override!.dispose();\n\n // Remove the remaining dragging style.\n this.removeClass('lm-mod-dragging');\n\n // If the tab was not moved, there is nothing else to do.\n let i = data.index;\n let j = data.targetIndex;\n if (j === -1 || i === j) {\n return;\n }\n\n // Move the title to the new locations.\n ArrayExt.move(this._titles, i, j);\n\n // Adjust the current index for the move.\n this._adjustCurrentForMove(i, j);\n\n // Emit the tab moved signal.\n this._tabMoved.emit({\n fromIndex: i,\n toIndex: j,\n title: this._titles[j]\n });\n\n // Update the tabs immediately to prevent flicker.\n MessageLoop.sendMessage(this, Widget.Msg.UpdateRequest);\n }, duration);\n }\n\n /**\n * Release the mouse and restore the non-dragged tab positions.\n */\n private _releaseMouse(): void {\n // Do nothing if no drag is in progress.\n let data = this._dragData;\n if (!data) {\n return;\n }\n\n // Clear the drag data reference.\n this._dragData = null;\n\n // Remove the extra document event listeners.\n this.document.removeEventListener('pointermove', this, true);\n this.document.removeEventListener('pointerup', this, true);\n this.document.removeEventListener('keydown', this, true);\n this.document.removeEventListener('contextmenu', this, true);\n\n // Indicate the drag has been aborted. This allows the mouse\n // event handlers to return early when the drag is canceled.\n data.dragAborted = true;\n\n // If the drag is not active, there's nothing more to do.\n if (!data.dragActive) {\n return;\n }\n\n // Reset the tabs to their non-dragged positions.\n Private.resetTabPositions(this.contentNode.children, this._orientation);\n\n // Clear the cursor override.\n data.override!.dispose();\n\n // Clear the dragging style classes.\n data.tab.classList.remove('lm-mod-dragging');\n this.removeClass('lm-mod-dragging');\n }\n\n /**\n * Adjust the current index for a tab insert operation.\n *\n * This method accounts for the tab bar's insertion behavior when\n * adjusting the current index and emitting the changed signal.\n */\n private _adjustCurrentForInsert(i: number, title: Title): void {\n // Lookup commonly used variables.\n let ct = this.currentTitle;\n let ci = this._currentIndex;\n let bh = this.insertBehavior;\n\n // TODO: do we need to do an update to update the aria-selected attribute?\n\n // Handle the behavior where the new tab is always selected,\n // or the behavior where the new tab is selected if needed.\n if (bh === 'select-tab' || (bh === 'select-tab-if-needed' && ci === -1)) {\n this._currentIndex = i;\n this._previousTitle = ct;\n this._currentChanged.emit({\n previousIndex: ci,\n previousTitle: ct,\n currentIndex: i,\n currentTitle: title\n });\n return;\n }\n\n // Otherwise, silently adjust the current index if needed.\n if (ci >= i) {\n this._currentIndex++;\n }\n }\n\n /**\n * Adjust the current index for a tab move operation.\n *\n * This method will not cause the actual current tab to change.\n * It silently adjusts the index to account for the given move.\n */\n private _adjustCurrentForMove(i: number, j: number): void {\n if (this._currentIndex === i) {\n this._currentIndex = j;\n } else if (this._currentIndex < i && this._currentIndex >= j) {\n this._currentIndex++;\n } else if (this._currentIndex > i && this._currentIndex <= j) {\n this._currentIndex--;\n }\n }\n\n /**\n * Adjust the current index for a tab remove operation.\n *\n * This method accounts for the tab bar's remove behavior when\n * adjusting the current index and emitting the changed signal.\n */\n private _adjustCurrentForRemove(i: number, title: Title): void {\n // Lookup commonly used variables.\n let ci = this._currentIndex;\n let bh = this.removeBehavior;\n\n // Silently adjust the index if the current tab is not removed.\n if (ci !== i) {\n if (ci > i) {\n this._currentIndex--;\n }\n return;\n }\n\n // TODO: do we need to do an update to adjust the aria-selected value?\n\n // No tab gets selected if the tab bar is empty.\n if (this._titles.length === 0) {\n this._currentIndex = -1;\n this._currentChanged.emit({\n previousIndex: i,\n previousTitle: title,\n currentIndex: -1,\n currentTitle: null\n });\n return;\n }\n\n // Handle behavior where the next sibling tab is selected.\n if (bh === 'select-tab-after') {\n this._currentIndex = Math.min(i, this._titles.length - 1);\n this._currentChanged.emit({\n previousIndex: i,\n previousTitle: title,\n currentIndex: this._currentIndex,\n currentTitle: this.currentTitle\n });\n return;\n }\n\n // Handle behavior where the previous sibling tab is selected.\n if (bh === 'select-tab-before') {\n this._currentIndex = Math.max(0, i - 1);\n this._currentChanged.emit({\n previousIndex: i,\n previousTitle: title,\n currentIndex: this._currentIndex,\n currentTitle: this.currentTitle\n });\n return;\n }\n\n // Handle behavior where the previous history tab is selected.\n if (bh === 'select-previous-tab') {\n if (this._previousTitle) {\n this._currentIndex = this._titles.indexOf(this._previousTitle);\n this._previousTitle = null;\n } else {\n this._currentIndex = Math.min(i, this._titles.length - 1);\n }\n this._currentChanged.emit({\n previousIndex: i,\n previousTitle: title,\n currentIndex: this._currentIndex,\n currentTitle: this.currentTitle\n });\n return;\n }\n\n // Otherwise, no tab gets selected.\n this._currentIndex = -1;\n this._currentChanged.emit({\n previousIndex: i,\n previousTitle: title,\n currentIndex: -1,\n currentTitle: null\n });\n }\n\n /**\n * Handle the `changed` signal of a title object.\n */\n private _onTitleChanged(sender: Title): void {\n this.update();\n }\n\n private _name: string;\n private _currentIndex = -1;\n private _titles: Title[] = [];\n private _orientation: TabBar.Orientation;\n private _document: Document | ShadowRoot;\n private _titlesEditable: boolean = false;\n private _previousTitle: Title | null = null;\n private _dragData: Private.IDragData | null = null;\n private _addButtonEnabled: boolean = false;\n private _tabMoved = new Signal>(this);\n private _currentChanged = new Signal>(\n this\n );\n private _addRequested = new Signal(this);\n private _tabCloseRequested = new Signal<\n this,\n TabBar.ITabCloseRequestedArgs\n >(this);\n private _tabDetachRequested = new Signal<\n this,\n TabBar.ITabDetachRequestedArgs\n >(this);\n private _tabActivateRequested = new Signal<\n this,\n TabBar.ITabActivateRequestedArgs\n >(this);\n}\n\n/**\n * The namespace for the `TabBar` class statics.\n */\nexport namespace TabBar {\n /**\n * A type alias for a tab bar orientation.\n */\n export type Orientation =\n | /**\n * The tabs are arranged in a single row, left-to-right.\n *\n * The tab text orientation is horizontal.\n */\n 'horizontal'\n\n /**\n * The tabs are arranged in a single column, top-to-bottom.\n *\n * The tab text orientation is horizontal.\n */\n | 'vertical';\n\n /**\n * A type alias for the selection behavior on tab insert.\n */\n export type InsertBehavior =\n | /**\n * The selected tab will not be changed.\n */\n 'none'\n\n /**\n * The inserted tab will be selected.\n */\n | 'select-tab'\n\n /**\n * The inserted tab will be selected if the current tab is null.\n */\n | 'select-tab-if-needed';\n\n /**\n * A type alias for the selection behavior on tab remove.\n */\n export type RemoveBehavior =\n | /**\n * No tab will be selected.\n */\n 'none'\n\n /**\n * The tab after the removed tab will be selected if possible.\n */\n | 'select-tab-after'\n\n /**\n * The tab before the removed tab will be selected if possible.\n */\n | 'select-tab-before'\n\n /**\n * The previously selected tab will be selected if possible.\n */\n | 'select-previous-tab';\n\n /**\n * An options object for creating a tab bar.\n */\n export interface IOptions {\n /**\n * The document to use with the tab bar.\n *\n * The default is the global `document` instance.\n */\n\n document?: Document | ShadowRoot;\n\n /**\n * Name of the tab bar.\n *\n * This is used for accessibility reasons. The default is the empty string.\n */\n name?: string;\n\n /**\n * The layout orientation of the tab bar.\n *\n * The default is `horizontal`.\n */\n orientation?: TabBar.Orientation;\n\n /**\n * Whether the tabs are movable by the user.\n *\n * The default is `false`.\n */\n tabsMovable?: boolean;\n\n /**\n * Whether a tab can be deselected by the user.\n *\n * The default is `false`.\n */\n allowDeselect?: boolean;\n\n /**\n * Whether the titles can be directly edited by the user.\n *\n * The default is `false`.\n */\n titlesEditable?: boolean;\n\n /**\n * Whether the add button is enabled.\n *\n * The default is `false`.\n */\n addButtonEnabled?: boolean;\n\n /**\n * The selection behavior when inserting a tab.\n *\n * The default is `'select-tab-if-needed'`.\n */\n insertBehavior?: TabBar.InsertBehavior;\n\n /**\n * The selection behavior when removing a tab.\n *\n * The default is `'select-tab-after'`.\n */\n removeBehavior?: TabBar.RemoveBehavior;\n\n /**\n * A renderer to use with the tab bar.\n *\n * The default is a shared renderer instance.\n */\n renderer?: IRenderer;\n }\n\n /**\n * The arguments object for the `currentChanged` signal.\n */\n export interface ICurrentChangedArgs {\n /**\n * The previously selected index.\n */\n readonly previousIndex: number;\n\n /**\n * The previously selected title.\n */\n readonly previousTitle: Title | null;\n\n /**\n * The currently selected index.\n */\n readonly currentIndex: number;\n\n /**\n * The currently selected title.\n */\n readonly currentTitle: Title | null;\n }\n\n /**\n * The arguments object for the `tabMoved` signal.\n */\n export interface ITabMovedArgs {\n /**\n * The previous index of the tab.\n */\n readonly fromIndex: number;\n\n /**\n * The current index of the tab.\n */\n readonly toIndex: number;\n\n /**\n * The title for the tab.\n */\n readonly title: Title;\n }\n\n /**\n * The arguments object for the `tabActivateRequested` signal.\n */\n export interface ITabActivateRequestedArgs {\n /**\n * The index of the tab to activate.\n */\n readonly index: number;\n\n /**\n * The title for the tab.\n */\n readonly title: Title;\n }\n\n /**\n * The arguments object for the `tabCloseRequested` signal.\n */\n export interface ITabCloseRequestedArgs {\n /**\n * The index of the tab to close.\n */\n readonly index: number;\n\n /**\n * The title for the tab.\n */\n readonly title: Title;\n }\n\n /**\n * The arguments object for the `tabDetachRequested` signal.\n */\n export interface ITabDetachRequestedArgs {\n /**\n * The index of the tab to detach.\n */\n readonly index: number;\n\n /**\n * The title for the tab.\n */\n readonly title: Title;\n\n /**\n * The node representing the tab.\n */\n readonly tab: HTMLElement;\n\n /**\n * The current client X position of the mouse.\n */\n readonly clientX: number;\n\n /**\n * The current client Y position of the mouse.\n */\n readonly clientY: number;\n\n /**\n * The mouse position in the tab coordinate.\n */\n readonly offset?: { x: number; y: number };\n }\n\n /**\n * An object which holds the data to render a tab.\n */\n export interface IRenderData {\n /**\n * The title associated with the tab.\n */\n readonly title: Title;\n\n /**\n * Whether the tab is the current tab.\n */\n readonly current: boolean;\n\n /**\n * The z-index for the tab.\n */\n readonly zIndex: number;\n\n /**\n * The tabindex value for the tab.\n */\n readonly tabIndex?: number;\n }\n\n /**\n * A renderer for use with a tab bar.\n */\n export interface IRenderer {\n /**\n * A selector which matches the close icon node in a tab.\n */\n readonly closeIconSelector: string;\n\n /**\n * Render the virtual element for a tab.\n *\n * @param data - The data to use for rendering the tab.\n *\n * @returns A virtual element representing the tab.\n */\n renderTab(data: IRenderData): VirtualElement;\n }\n\n /**\n * The default implementation of `IRenderer`.\n *\n * #### Notes\n * Subclasses are free to reimplement rendering methods as needed.\n */\n export class Renderer implements IRenderer {\n constructor() {\n this._uuid = ++Renderer._nInstance;\n }\n /**\n * A selector which matches the close icon node in a tab.\n */\n readonly closeIconSelector = '.lm-TabBar-tabCloseIcon';\n\n /**\n * Render the virtual element for a tab.\n *\n * @param data - The data to use for rendering the tab.\n *\n * @returns A virtual element representing the tab.\n */\n renderTab(data: IRenderData): VirtualElement {\n let title = data.title.caption;\n let key = this.createTabKey(data);\n let id = key;\n let style = this.createTabStyle(data);\n let className = this.createTabClass(data);\n let dataset = this.createTabDataset(data);\n let aria = this.createTabARIA(data);\n if (data.title.closable) {\n return h.li(\n { id, key, className, title, style, dataset, ...aria },\n this.renderIcon(data),\n this.renderLabel(data),\n this.renderCloseIcon(data)\n );\n } else {\n return h.li(\n { id, key, className, title, style, dataset, ...aria },\n this.renderIcon(data),\n this.renderLabel(data)\n );\n }\n }\n\n /**\n * Render the icon element for a tab.\n *\n * @param data - The data to use for rendering the tab.\n *\n * @returns A virtual element representing the tab icon.\n */\n renderIcon(data: IRenderData): VirtualElement {\n const { title } = data;\n let className = this.createIconClass(data);\n\n // If title.icon is undefined, it will be ignored.\n return h.div({ className }, title.icon!, title.iconLabel);\n }\n\n /**\n * Render the label element for a tab.\n *\n * @param data - The data to use for rendering the tab.\n *\n * @returns A virtual element representing the tab label.\n */\n renderLabel(data: IRenderData): VirtualElement {\n return h.div({ className: 'lm-TabBar-tabLabel' }, data.title.label);\n }\n\n /**\n * Render the close icon element for a tab.\n *\n * @param data - The data to use for rendering the tab.\n *\n * @returns A virtual element representing the tab close icon.\n */\n renderCloseIcon(data: IRenderData): VirtualElement {\n return h.div({ className: 'lm-TabBar-tabCloseIcon' });\n }\n\n /**\n * Create a unique render key for the tab.\n *\n * @param data - The data to use for the tab.\n *\n * @returns The unique render key for the tab.\n *\n * #### Notes\n * This method caches the key against the tab title the first time\n * the key is generated. This enables efficient rendering of moved\n * tabs and avoids subtle hover style artifacts.\n */\n createTabKey(data: IRenderData): string {\n let key = this._tabKeys.get(data.title);\n if (key === undefined) {\n key = `tab-key-${this._uuid}-${this._tabID++}`;\n this._tabKeys.set(data.title, key);\n }\n return key;\n }\n\n /**\n * Create the inline style object for a tab.\n *\n * @param data - The data to use for the tab.\n *\n * @returns The inline style data for the tab.\n */\n createTabStyle(data: IRenderData): ElementInlineStyle {\n return { zIndex: `${data.zIndex}` };\n }\n\n /**\n * Create the class name for the tab.\n *\n * @param data - The data to use for the tab.\n *\n * @returns The full class name for the tab.\n */\n createTabClass(data: IRenderData): string {\n let name = 'lm-TabBar-tab';\n if (data.title.className) {\n name += ` ${data.title.className}`;\n }\n if (data.title.closable) {\n name += ' lm-mod-closable';\n }\n if (data.current) {\n name += ' lm-mod-current';\n }\n return name;\n }\n\n /**\n * Create the dataset for a tab.\n *\n * @param data - The data to use for the tab.\n *\n * @returns The dataset for the tab.\n */\n createTabDataset(data: IRenderData): ElementDataset {\n return data.title.dataset;\n }\n\n /**\n * Create the ARIA attributes for a tab.\n *\n * @param data - The data to use for the tab.\n *\n * @returns The ARIA attributes for the tab.\n */\n createTabARIA(data: IRenderData): ElementARIAAttrs | ElementBaseAttrs {\n return {\n role: 'tab',\n 'aria-selected': data.current.toString(),\n tabindex: `${data.tabIndex ?? '-1'}`\n };\n }\n\n /**\n * Create the class name for the tab icon.\n *\n * @param data - The data to use for the tab.\n *\n * @returns The full class name for the tab icon.\n */\n createIconClass(data: IRenderData): string {\n let name = 'lm-TabBar-tabIcon';\n let extra = data.title.iconClass;\n return extra ? `${name} ${extra}` : name;\n }\n\n private static _nInstance = 0;\n private readonly _uuid: number;\n private _tabID = 0;\n private _tabKeys = new WeakMap, string>();\n }\n\n /**\n * The default `Renderer` instance.\n */\n export const defaultRenderer = new Renderer();\n\n /**\n * A selector which matches the add button node in the tab bar.\n */\n export const addButtonSelector = '.lm-TabBar-addButton';\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * The start drag distance threshold.\n */\n export const DRAG_THRESHOLD = 5;\n\n /**\n * The detach distance threshold.\n */\n export const DETACH_THRESHOLD = 20;\n\n /**\n * A struct which holds the drag data for a tab bar.\n */\n export interface IDragData {\n /**\n * The tab node being dragged.\n */\n tab: HTMLElement;\n\n /**\n * The index of the tab being dragged.\n */\n index: number;\n\n /**\n * The mouse press client X position.\n */\n pressX: number;\n\n /**\n * The mouse press client Y position.\n */\n pressY: number;\n\n /**\n * The offset left/top of the tab being dragged.\n *\n * This will be `-1` if the drag is not active.\n */\n tabPos: number;\n\n /**\n * The offset width/height of the tab being dragged.\n *\n * This will be `-1` if the drag is not active.\n */\n tabSize: number;\n\n /**\n * The original mouse X/Y position in tab coordinates.\n *\n * This will be `-1` if the drag is not active.\n */\n tabPressPos: number;\n\n /**\n * The original mouse position in tab coordinates.\n *\n * This is undefined if the drag is not active.\n */\n tabPressOffset?: { x: number; y: number };\n\n /**\n * The tab target index upon mouse release.\n *\n * This will be `-1` if the drag is not active.\n */\n targetIndex: number;\n\n /**\n * The array of tab layout objects snapped at drag start.\n *\n * This will be `null` if the drag is not active.\n */\n tabLayout: ITabLayout[] | null;\n\n /**\n * The bounding client rect of the tab bar content node.\n *\n * This will be `null` if the drag is not active.\n */\n contentRect: DOMRect | null;\n\n /**\n * The disposable to clean up the cursor override.\n *\n * This will be `null` if the drag is not active.\n */\n override: IDisposable | null;\n\n /**\n * Whether the drag is currently active.\n */\n dragActive: boolean;\n\n /**\n * Whether the drag has been aborted.\n */\n dragAborted: boolean;\n\n /**\n * Whether a detach request as been made.\n */\n detachRequested: boolean;\n }\n\n /**\n * An object which holds layout data for a tab.\n */\n export interface ITabLayout {\n /**\n * The left/top margin value for the tab.\n */\n margin: number;\n\n /**\n * The offset left/top position of the tab.\n */\n pos: number;\n\n /**\n * The offset width/height of the tab.\n */\n size: number;\n }\n\n /**\n * Create the DOM node for a tab bar.\n */\n export function createNode(): HTMLDivElement {\n let node = document.createElement('div');\n let content = document.createElement('ul');\n content.setAttribute('role', 'tablist');\n content.className = 'lm-TabBar-content';\n node.appendChild(content);\n\n let add = document.createElement('div');\n add.className = 'lm-TabBar-addButton lm-mod-hidden';\n add.setAttribute('tabindex', '-1');\n add.setAttribute('role', 'button');\n node.appendChild(add);\n return node;\n }\n\n /**\n * Coerce a title or options into a real title.\n */\n export function asTitle(value: Title | Title.IOptions): Title {\n return value instanceof Title ? value : new Title(value);\n }\n\n /**\n * Parse the transition duration for a tab node.\n */\n export function parseTransitionDuration(tab: HTMLElement): number {\n let style = window.getComputedStyle(tab);\n return 1000 * (parseFloat(style.transitionDuration!) || 0);\n }\n\n /**\n * Get a snapshot of the current tab layout values.\n */\n export function snapTabLayout(\n tabs: HTMLCollection,\n orientation: TabBar.Orientation\n ): ITabLayout[] {\n let layout = new Array(tabs.length);\n for (let i = 0, n = tabs.length; i < n; ++i) {\n let node = tabs[i] as HTMLElement;\n let style = window.getComputedStyle(node);\n if (orientation === 'horizontal') {\n layout[i] = {\n pos: node.offsetLeft,\n size: node.offsetWidth,\n margin: parseFloat(style.marginLeft!) || 0\n };\n } else {\n layout[i] = {\n pos: node.offsetTop,\n size: node.offsetHeight,\n margin: parseFloat(style.marginTop!) || 0\n };\n }\n }\n return layout;\n }\n\n /**\n * Test if the event exceeds the drag threshold.\n */\n export function dragExceeded(data: IDragData, event: MouseEvent): boolean {\n let dx = Math.abs(event.clientX - data.pressX);\n let dy = Math.abs(event.clientY - data.pressY);\n return dx >= DRAG_THRESHOLD || dy >= DRAG_THRESHOLD;\n }\n\n /**\n * Test if the event exceeds the drag detach threshold.\n */\n export function detachExceeded(data: IDragData, event: MouseEvent): boolean {\n let rect = data.contentRect!;\n return (\n event.clientX < rect.left - DETACH_THRESHOLD ||\n event.clientX >= rect.right + DETACH_THRESHOLD ||\n event.clientY < rect.top - DETACH_THRESHOLD ||\n event.clientY >= rect.bottom + DETACH_THRESHOLD\n );\n }\n\n /**\n * Update the relative tab positions and computed target index.\n */\n export function layoutTabs(\n tabs: HTMLCollection,\n data: IDragData,\n event: MouseEvent,\n orientation: TabBar.Orientation\n ): void {\n // Compute the orientation-sensitive values.\n let pressPos: number;\n let localPos: number;\n let clientPos: number;\n let clientSize: number;\n if (orientation === 'horizontal') {\n pressPos = data.pressX;\n localPos = event.clientX - data.contentRect!.left;\n clientPos = event.clientX;\n clientSize = data.contentRect!.width;\n } else {\n pressPos = data.pressY;\n localPos = event.clientY - data.contentRect!.top;\n clientPos = event.clientY;\n clientSize = data.contentRect!.height;\n }\n\n // Compute the target data.\n let targetIndex = data.index;\n let targetPos = localPos - data.tabPressPos;\n let targetEnd = targetPos + data.tabSize;\n\n // Update the relative tab positions.\n for (let i = 0, n = tabs.length; i < n; ++i) {\n let pxPos: string;\n let layout = data.tabLayout![i];\n let threshold = layout.pos + (layout.size >> 1);\n if (i < data.index && targetPos < threshold) {\n pxPos = `${data.tabSize + data.tabLayout![i + 1].margin}px`;\n targetIndex = Math.min(targetIndex, i);\n } else if (i > data.index && targetEnd > threshold) {\n pxPos = `${-data.tabSize - layout.margin}px`;\n targetIndex = Math.max(targetIndex, i);\n } else if (i === data.index) {\n let ideal = clientPos - pressPos;\n let limit = clientSize - (data.tabPos + data.tabSize);\n pxPos = `${Math.max(-data.tabPos, Math.min(ideal, limit))}px`;\n } else {\n pxPos = '';\n }\n if (orientation === 'horizontal') {\n (tabs[i] as HTMLElement).style.left = pxPos;\n } else {\n (tabs[i] as HTMLElement).style.top = pxPos;\n }\n }\n\n // Update the computed target index.\n data.targetIndex = targetIndex;\n }\n\n /**\n * Position the drag tab at its final resting relative position.\n */\n export function finalizeTabPosition(\n data: IDragData,\n orientation: TabBar.Orientation\n ): void {\n // Compute the orientation-sensitive client size.\n let clientSize: number;\n if (orientation === 'horizontal') {\n clientSize = data.contentRect!.width;\n } else {\n clientSize = data.contentRect!.height;\n }\n\n // Compute the ideal final tab position.\n let ideal: number;\n if (data.targetIndex === data.index) {\n ideal = 0;\n } else if (data.targetIndex > data.index) {\n let tgt = data.tabLayout![data.targetIndex];\n ideal = tgt.pos + tgt.size - data.tabSize - data.tabPos;\n } else {\n let tgt = data.tabLayout![data.targetIndex];\n ideal = tgt.pos - data.tabPos;\n }\n\n // Compute the tab position limit.\n let limit = clientSize - (data.tabPos + data.tabSize);\n let final = Math.max(-data.tabPos, Math.min(ideal, limit));\n\n // Set the final orientation-sensitive position.\n if (orientation === 'horizontal') {\n data.tab.style.left = `${final}px`;\n } else {\n data.tab.style.top = `${final}px`;\n }\n }\n\n /**\n * Reset the relative positions of the given tabs.\n */\n export function resetTabPositions(\n tabs: HTMLCollection,\n orientation: TabBar.Orientation\n ): void {\n for (const tab of tabs) {\n if (orientation === 'horizontal') {\n (tab as HTMLElement).style.left = '';\n } else {\n (tab as HTMLElement).style.top = '';\n }\n }\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt, empty } from '@lumino/algorithm';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { BoxEngine, BoxSizer } from './boxengine';\n\nimport { Layout, LayoutItem } from './layout';\n\nimport { TabBar } from './tabbar';\n\nimport Utils from './utils';\n\nimport { Widget } from './widget';\n\n/**\n * A layout which provides a flexible docking arrangement.\n *\n * #### Notes\n * The consumer of this layout is responsible for handling all signals\n * from the generated tab bars and managing the visibility of widgets\n * and tab bars as needed.\n */\nexport class DockLayout extends Layout {\n /**\n * Construct a new dock layout.\n *\n * @param options - The options for initializing the layout.\n */\n constructor(options: DockLayout.IOptions) {\n super();\n this.renderer = options.renderer;\n if (options.spacing !== undefined) {\n this._spacing = Utils.clampDimension(options.spacing);\n }\n this._document = options.document || document;\n this._hiddenMode =\n options.hiddenMode !== undefined\n ? options.hiddenMode\n : Widget.HiddenMode.Display;\n }\n\n /**\n * Dispose of the resources held by the layout.\n *\n * #### Notes\n * This will clear and dispose all widgets in the layout.\n */\n dispose(): void {\n // Get an iterator over the widgets in the layout.\n let widgets = this[Symbol.iterator]();\n\n // Dispose of the layout items.\n this._items.forEach(item => {\n item.dispose();\n });\n\n // Clear the layout state before disposing the widgets.\n this._box = null;\n this._root = null;\n this._items.clear();\n\n // Dispose of the widgets contained in the old layout root.\n for (const widget of widgets) {\n widget.dispose();\n }\n\n // Dispose of the base class.\n super.dispose();\n }\n\n /**\n * The renderer used by the dock layout.\n */\n readonly renderer: DockLayout.IRenderer;\n\n /**\n * The method for hiding child widgets.\n *\n * #### Notes\n * If there is only one child widget, `Display` hiding mode will be used\n * regardless of this setting.\n */\n get hiddenMode(): Widget.HiddenMode {\n return this._hiddenMode;\n }\n set hiddenMode(v: Widget.HiddenMode) {\n if (this._hiddenMode === v) {\n return;\n }\n this._hiddenMode = v;\n for (const bar of this.tabBars()) {\n if (bar.titles.length > 1) {\n for (const title of bar.titles) {\n title.owner.hiddenMode = this._hiddenMode;\n }\n }\n }\n }\n\n /**\n * Get the inter-element spacing for the dock layout.\n */\n get spacing(): number {\n return this._spacing;\n }\n\n /**\n * Set the inter-element spacing for the dock layout.\n */\n set spacing(value: number) {\n value = Utils.clampDimension(value);\n if (this._spacing === value) {\n return;\n }\n this._spacing = value;\n if (!this.parent) {\n return;\n }\n this.parent.fit();\n }\n\n /**\n * Whether the dock layout is empty.\n */\n get isEmpty(): boolean {\n return this._root === null;\n }\n\n /**\n * Create an iterator over all widgets in the layout.\n *\n * @returns A new iterator over the widgets in the layout.\n *\n * #### Notes\n * This iterator includes the generated tab bars.\n */\n [Symbol.iterator](): IterableIterator {\n return this._root ? this._root.iterAllWidgets() : empty();\n }\n\n /**\n * Create an iterator over the user widgets in the layout.\n *\n * @returns A new iterator over the user widgets in the layout.\n *\n * #### Notes\n * This iterator does not include the generated tab bars.\n */\n widgets(): IterableIterator {\n return this._root ? this._root.iterUserWidgets() : empty();\n }\n\n /**\n * Create an iterator over the selected widgets in the layout.\n *\n * @returns A new iterator over the selected user widgets.\n *\n * #### Notes\n * This iterator yields the widgets corresponding to the current tab\n * of each tab bar in the layout.\n */\n selectedWidgets(): IterableIterator {\n return this._root ? this._root.iterSelectedWidgets() : empty();\n }\n\n /**\n * Create an iterator over the tab bars in the layout.\n *\n * @returns A new iterator over the tab bars in the layout.\n *\n * #### Notes\n * This iterator does not include the user widgets.\n */\n tabBars(): IterableIterator> {\n return this._root ? this._root.iterTabBars() : empty();\n }\n\n /**\n * Create an iterator over the handles in the layout.\n *\n * @returns A new iterator over the handles in the layout.\n */\n handles(): IterableIterator {\n return this._root ? this._root.iterHandles() : empty();\n }\n\n /**\n * Move a handle to the given offset position.\n *\n * @param handle - The handle to move.\n *\n * @param offsetX - The desired offset X position of the handle.\n *\n * @param offsetY - The desired offset Y position of the handle.\n *\n * #### Notes\n * If the given handle is not contained in the layout, this is no-op.\n *\n * The handle will be moved as close as possible to the desired\n * position without violating any of the layout constraints.\n *\n * Only one of the coordinates is used depending on the orientation\n * of the handle. This method accepts both coordinates to make it\n * easy to invoke from a mouse move event without needing to know\n * the handle orientation.\n */\n moveHandle(handle: HTMLDivElement, offsetX: number, offsetY: number): void {\n // Bail early if there is no root or if the handle is hidden.\n let hidden = handle.classList.contains('lm-mod-hidden');\n if (!this._root || hidden) {\n return;\n }\n\n // Lookup the split node for the handle.\n let data = this._root.findSplitNode(handle);\n if (!data) {\n return;\n }\n\n // Compute the desired delta movement for the handle.\n let delta: number;\n if (data.node.orientation === 'horizontal') {\n delta = offsetX - handle.offsetLeft;\n } else {\n delta = offsetY - handle.offsetTop;\n }\n\n // Bail if there is no handle movement.\n if (delta === 0) {\n return;\n }\n\n // Prevent sibling resizing unless needed.\n data.node.holdSizes();\n\n // Adjust the sizers to reflect the handle movement.\n BoxEngine.adjust(data.node.sizers, data.index, delta);\n\n // Update the layout of the widgets.\n if (this.parent) {\n this.parent.update();\n }\n }\n\n /**\n * Save the current configuration of the dock layout.\n *\n * @returns A new config object for the current layout state.\n *\n * #### Notes\n * The return value can be provided to the `restoreLayout` method\n * in order to restore the layout to its current configuration.\n */\n saveLayout(): DockLayout.ILayoutConfig {\n // Bail early if there is no root.\n if (!this._root) {\n return { main: null };\n }\n\n // Hold the current sizes in the layout tree.\n this._root.holdAllSizes();\n\n // Return the layout config.\n return { main: this._root.createConfig() };\n }\n\n /**\n * Restore the layout to a previously saved configuration.\n *\n * @param config - The layout configuration to restore.\n *\n * #### Notes\n * Widgets which currently belong to the layout but which are not\n * contained in the config will be unparented.\n */\n restoreLayout(config: DockLayout.ILayoutConfig): void {\n // Create the widget set for validating the config.\n let widgetSet = new Set();\n\n // Normalize the main area config and collect the widgets.\n let mainConfig: DockLayout.AreaConfig | null;\n if (config.main) {\n mainConfig = Private.normalizeAreaConfig(config.main, widgetSet);\n } else {\n mainConfig = null;\n }\n\n // Create iterators over the old content.\n let oldWidgets = this.widgets();\n let oldTabBars = this.tabBars();\n let oldHandles = this.handles();\n\n // Clear the root before removing the old content.\n this._root = null;\n\n // Unparent the old widgets which are not in the new config.\n for (const widget of oldWidgets) {\n if (!widgetSet.has(widget)) {\n widget.parent = null;\n }\n }\n\n // Dispose of the old tab bars.\n for (const tabBar of oldTabBars) {\n tabBar.dispose();\n }\n\n // Remove the old handles.\n for (const handle of oldHandles) {\n if (handle.parentNode) {\n handle.parentNode.removeChild(handle);\n }\n }\n\n // Reparent the new widgets to the current parent.\n for (const widget of widgetSet) {\n widget.parent = this.parent;\n }\n\n // Create the root node for the new config.\n if (mainConfig) {\n this._root = Private.realizeAreaConfig(\n mainConfig,\n {\n // Ignoring optional `document` argument as we must reuse `this._document`\n createTabBar: (document?: Document | ShadowRoot) =>\n this._createTabBar(),\n createHandle: () => this._createHandle()\n },\n this._document\n );\n } else {\n this._root = null;\n }\n\n // If there is no parent, there is nothing more to do.\n if (!this.parent) {\n return;\n }\n\n // Attach the new widgets to the parent.\n widgetSet.forEach(widget => {\n this.attachWidget(widget);\n });\n\n // Post a fit request to the parent.\n this.parent.fit();\n }\n\n /**\n * Add a widget to the dock layout.\n *\n * @param widget - The widget to add to the dock layout.\n *\n * @param options - The additional options for adding the widget.\n *\n * #### Notes\n * The widget will be moved if it is already contained in the layout.\n *\n * An error will be thrown if the reference widget is invalid.\n */\n addWidget(widget: Widget, options: DockLayout.IAddOptions = {}): void {\n // Parse the options.\n let ref = options.ref || null;\n let mode = options.mode || 'tab-after';\n\n // Find the tab node which holds the reference widget.\n let refNode: Private.TabLayoutNode | null = null;\n if (this._root && ref) {\n refNode = this._root.findTabNode(ref);\n }\n\n // Throw an error if the reference widget is invalid.\n if (ref && !refNode) {\n throw new Error('Reference widget is not in the layout.');\n }\n\n // Reparent the widget to the current layout parent.\n widget.parent = this.parent;\n\n // Insert the widget according to the insert mode.\n switch (mode) {\n case 'tab-after':\n this._insertTab(widget, ref, refNode, true);\n break;\n case 'tab-before':\n this._insertTab(widget, ref, refNode, false);\n break;\n case 'split-top':\n this._insertSplit(widget, ref, refNode, 'vertical', false);\n break;\n case 'split-left':\n this._insertSplit(widget, ref, refNode, 'horizontal', false);\n break;\n case 'split-right':\n this._insertSplit(widget, ref, refNode, 'horizontal', true);\n break;\n case 'split-bottom':\n this._insertSplit(widget, ref, refNode, 'vertical', true);\n break;\n case 'merge-top':\n this._insertSplit(widget, ref, refNode, 'vertical', false, true);\n break;\n case 'merge-left':\n this._insertSplit(widget, ref, refNode, 'horizontal', false, true);\n break;\n case 'merge-right':\n this._insertSplit(widget, ref, refNode, 'horizontal', true, true);\n break;\n case 'merge-bottom':\n this._insertSplit(widget, ref, refNode, 'vertical', true, true);\n break;\n }\n\n // Do nothing else if there is no parent widget.\n if (!this.parent) {\n return;\n }\n\n // Ensure the widget is attached to the parent widget.\n this.attachWidget(widget);\n\n // Post a fit request for the parent widget.\n this.parent.fit();\n }\n\n /**\n * Remove a widget from the layout.\n *\n * @param widget - The widget to remove from the layout.\n *\n * #### Notes\n * A widget is automatically removed from the layout when its `parent`\n * is set to `null`. This method should only be invoked directly when\n * removing a widget from a layout which has yet to be installed on a\n * parent widget.\n *\n * This method does *not* modify the widget's `parent`.\n */\n removeWidget(widget: Widget): void {\n // Remove the widget from its current layout location.\n this._removeWidget(widget);\n\n // Do nothing else if there is no parent widget.\n if (!this.parent) {\n return;\n }\n\n // Detach the widget from the parent widget.\n this.detachWidget(widget);\n\n // Post a fit request for the parent widget.\n this.parent.fit();\n }\n\n /**\n * Find the tab area which contains the given client position.\n *\n * @param clientX - The client X position of interest.\n *\n * @param clientY - The client Y position of interest.\n *\n * @returns The geometry of the tab area at the given position, or\n * `null` if there is no tab area at the given position.\n */\n hitTestTabAreas(\n clientX: number,\n clientY: number\n ): DockLayout.ITabAreaGeometry | null {\n // Bail early if hit testing cannot produce valid results.\n if (!this._root || !this.parent || !this.parent.isVisible) {\n return null;\n }\n\n // Ensure the parent box sizing data is computed.\n if (!this._box) {\n this._box = ElementExt.boxSizing(this.parent.node);\n }\n\n // Convert from client to local coordinates.\n let rect = this.parent.node.getBoundingClientRect();\n let x = clientX - rect.left - this._box.borderLeft;\n let y = clientY - rect.top - this._box.borderTop;\n\n // Find the tab layout node at the local position.\n let tabNode = this._root.hitTestTabNodes(x, y);\n\n // Bail if a tab layout node was not found.\n if (!tabNode) {\n return null;\n }\n\n // Extract the data from the tab node.\n let { tabBar, top, left, width, height } = tabNode;\n\n // Compute the right and bottom edges of the tab area.\n let borderWidth = this._box.borderLeft + this._box.borderRight;\n let borderHeight = this._box.borderTop + this._box.borderBottom;\n let right = rect.width - borderWidth - (left + width);\n let bottom = rect.height - borderHeight - (top + height);\n\n // Return the hit test results.\n return { tabBar, x, y, top, left, right, bottom, width, height };\n }\n\n /**\n * Perform layout initialization which requires the parent widget.\n */\n protected init(): void {\n // Perform superclass initialization.\n super.init();\n\n // Attach each widget to the parent.\n for (const widget of this) {\n this.attachWidget(widget);\n }\n\n // Attach each handle to the parent.\n for (const handle of this.handles()) {\n this.parent!.node.appendChild(handle);\n }\n\n // Post a fit request for the parent widget.\n this.parent!.fit();\n }\n\n /**\n * Attach the widget to the layout parent widget.\n *\n * @param widget - The widget to attach to the parent.\n *\n * #### Notes\n * This is a no-op if the widget is already attached.\n */\n protected attachWidget(widget: Widget): void {\n // Do nothing if the widget is already attached.\n if (this.parent!.node === widget.node.parentNode) {\n return;\n }\n\n // Create the layout item for the widget.\n this._items.set(widget, new LayoutItem(widget));\n\n // Send a `'before-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n }\n\n // Add the widget's node to the parent.\n this.parent!.node.appendChild(widget.node);\n\n // Send an `'after-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n }\n\n /**\n * Detach the widget from the layout parent widget.\n *\n * @param widget - The widget to detach from the parent.\n *\n * #### Notes\n * This is a no-op if the widget is not attached.\n */\n protected detachWidget(widget: Widget): void {\n // Do nothing if the widget is not attached.\n if (this.parent!.node !== widget.node.parentNode) {\n return;\n }\n\n // Send a `'before-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n }\n\n // Remove the widget's node from the parent.\n this.parent!.node.removeChild(widget.node);\n\n // Send an `'after-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n\n // Delete the layout item for the widget.\n let item = this._items.get(widget);\n if (item) {\n this._items.delete(widget);\n item.dispose();\n }\n }\n\n /**\n * A message handler invoked on a `'before-show'` message.\n */\n protected onBeforeShow(msg: Message): void {\n super.onBeforeShow(msg);\n this.parent!.update();\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n super.onBeforeAttach(msg);\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-shown'` message.\n */\n protected onChildShown(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-hidden'` message.\n */\n protected onChildHidden(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'resize'` message.\n */\n protected onResize(msg: Widget.ResizeMessage): void {\n if (this.parent!.isVisible) {\n this._update(msg.width, msg.height);\n }\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n protected onUpdateRequest(msg: Message): void {\n if (this.parent!.isVisible) {\n this._update(-1, -1);\n }\n }\n\n /**\n * A message handler invoked on a `'fit-request'` message.\n */\n protected onFitRequest(msg: Message): void {\n if (this.parent!.isAttached) {\n this._fit();\n }\n }\n\n /**\n * Remove the specified widget from the layout structure.\n *\n * #### Notes\n * This is a no-op if the widget is not in the layout tree.\n *\n * This does not detach the widget from the parent node.\n */\n private _removeWidget(widget: Widget): void {\n // Bail early if there is no layout root.\n if (!this._root) {\n return;\n }\n\n // Find the tab node which contains the given widget.\n let tabNode = this._root.findTabNode(widget);\n\n // Bail early if the tab node is not found.\n if (!tabNode) {\n return;\n }\n\n Private.removeAria(widget);\n\n // If there are multiple tabs, just remove the widget's tab.\n if (tabNode.tabBar.titles.length > 1) {\n tabNode.tabBar.removeTab(widget.title);\n if (\n this._hiddenMode === Widget.HiddenMode.Scale &&\n tabNode.tabBar.titles.length == 1\n ) {\n const existingWidget = tabNode.tabBar.titles[0].owner;\n existingWidget.hiddenMode = Widget.HiddenMode.Display;\n }\n return;\n }\n\n // Otherwise, the tab node needs to be removed...\n\n // Dispose the tab bar.\n tabNode.tabBar.dispose();\n\n // Handle the case where the tab node is the root.\n if (this._root === tabNode) {\n this._root = null;\n return;\n }\n\n // Otherwise, remove the tab node from its parent...\n\n // Prevent widget resizing unless needed.\n this._root.holdAllSizes();\n\n // Clear the parent reference on the tab node.\n let splitNode = tabNode.parent!;\n tabNode.parent = null;\n\n // Remove the tab node from its parent split node.\n let i = ArrayExt.removeFirstOf(splitNode.children, tabNode);\n let handle = ArrayExt.removeAt(splitNode.handles, i)!;\n ArrayExt.removeAt(splitNode.sizers, i);\n\n // Remove the handle from its parent DOM node.\n if (handle.parentNode) {\n handle.parentNode.removeChild(handle);\n }\n\n // If there are multiple children, just update the handles.\n if (splitNode.children.length > 1) {\n splitNode.syncHandles();\n return;\n }\n\n // Otherwise, the split node also needs to be removed...\n\n // Clear the parent reference on the split node.\n let maybeParent = splitNode.parent;\n splitNode.parent = null;\n\n // Lookup the remaining child node and handle.\n let childNode = splitNode.children[0];\n let childHandle = splitNode.handles[0];\n\n // Clear the split node data.\n splitNode.children.length = 0;\n splitNode.handles.length = 0;\n splitNode.sizers.length = 0;\n\n // Remove the child handle from its parent node.\n if (childHandle.parentNode) {\n childHandle.parentNode.removeChild(childHandle);\n }\n\n // Handle the case where the split node is the root.\n if (this._root === splitNode) {\n childNode.parent = null;\n this._root = childNode;\n return;\n }\n\n // Otherwise, move the child node to the parent node...\n let parentNode = maybeParent!;\n\n // Lookup the index of the split node.\n let j = parentNode.children.indexOf(splitNode);\n\n // Handle the case where the child node is a tab node.\n if (childNode instanceof Private.TabLayoutNode) {\n childNode.parent = parentNode;\n parentNode.children[j] = childNode;\n return;\n }\n\n // Remove the split data from the parent.\n let splitHandle = ArrayExt.removeAt(parentNode.handles, j)!;\n ArrayExt.removeAt(parentNode.children, j);\n ArrayExt.removeAt(parentNode.sizers, j);\n\n // Remove the handle from its parent node.\n if (splitHandle.parentNode) {\n splitHandle.parentNode.removeChild(splitHandle);\n }\n\n // The child node and the split parent node will have the same\n // orientation. Merge the grand-children with the parent node.\n for (let i = 0, n = childNode.children.length; i < n; ++i) {\n let gChild = childNode.children[i];\n let gHandle = childNode.handles[i];\n let gSizer = childNode.sizers[i];\n ArrayExt.insert(parentNode.children, j + i, gChild);\n ArrayExt.insert(parentNode.handles, j + i, gHandle);\n ArrayExt.insert(parentNode.sizers, j + i, gSizer);\n gChild.parent = parentNode;\n }\n\n // Clear the child node.\n childNode.children.length = 0;\n childNode.handles.length = 0;\n childNode.sizers.length = 0;\n childNode.parent = null;\n\n // Sync the handles on the parent node.\n parentNode.syncHandles();\n }\n\n /**\n * Create the tab layout node to hold the widget.\n */\n private _createTabNode(widget: Widget): Private.TabLayoutNode {\n let tabNode = new Private.TabLayoutNode(this._createTabBar());\n tabNode.tabBar.addTab(widget.title);\n Private.addAria(widget, tabNode.tabBar);\n return tabNode;\n }\n\n /**\n * Insert a widget next to an existing tab.\n *\n * #### Notes\n * This does not attach the widget to the parent widget.\n */\n private _insertTab(\n widget: Widget,\n ref: Widget | null,\n refNode: Private.TabLayoutNode | null,\n after: boolean\n ): void {\n // Do nothing if the tab is inserted next to itself.\n if (widget === ref) {\n return;\n }\n\n // Create the root if it does not exist.\n if (!this._root) {\n let tabNode = new Private.TabLayoutNode(this._createTabBar());\n tabNode.tabBar.addTab(widget.title);\n this._root = tabNode;\n Private.addAria(widget, tabNode.tabBar);\n return;\n }\n\n // Use the first tab node as the ref node if needed.\n if (!refNode) {\n refNode = this._root.findFirstTabNode()!;\n }\n\n // If the widget is not contained in the ref node, ensure it is\n // removed from the layout and hidden before being added again.\n if (refNode.tabBar.titles.indexOf(widget.title) === -1) {\n this._removeWidget(widget);\n widget.hide();\n }\n\n // Lookup the target index for inserting the tab.\n let index: number;\n if (ref) {\n index = refNode.tabBar.titles.indexOf(ref.title);\n } else {\n index = refNode.tabBar.currentIndex;\n }\n\n // Using transform create an additional layer in the pixel pipeline\n // to limit the number of layer, it is set only if there is more than one widget.\n if (this._hiddenMode === Widget.HiddenMode.Scale) {\n if (refNode.tabBar.titles.length === 0) {\n // Singular tab should use display mode to limit number of layers.\n widget.hiddenMode = Widget.HiddenMode.Display;\n } else if (refNode.tabBar.titles.length == 1) {\n // If we are adding a second tab, switch the existing tab back to scale.\n const existingWidget = refNode.tabBar.titles[0].owner;\n existingWidget.hiddenMode = Widget.HiddenMode.Scale;\n } else {\n // For the third and subsequent tabs no special action is needed.\n widget.hiddenMode = Widget.HiddenMode.Scale;\n }\n } else {\n // For all other modes just propagate the current mode.\n widget.hiddenMode = this._hiddenMode;\n }\n\n // Insert the widget's tab relative to the target index.\n refNode.tabBar.insertTab(index + (after ? 1 : 0), widget.title);\n Private.addAria(widget, refNode.tabBar);\n }\n\n /**\n * Insert a widget as a new split area.\n *\n * #### Notes\n * This does not attach the widget to the parent widget.\n */\n private _insertSplit(\n widget: Widget,\n ref: Widget | null,\n refNode: Private.TabLayoutNode | null,\n orientation: Private.Orientation,\n after: boolean,\n merge: boolean = false\n ): void {\n // Do nothing if there is no effective split.\n if (widget === ref && refNode && refNode.tabBar.titles.length === 1) {\n return;\n }\n\n // Ensure the widget is removed from the current layout.\n this._removeWidget(widget);\n\n // Set the root if it does not exist.\n if (!this._root) {\n this._root = this._createTabNode(widget);\n return;\n }\n\n // If the ref node parent is null, split the root.\n if (!refNode || !refNode.parent) {\n // Ensure the root is split with the correct orientation.\n let root = this._splitRoot(orientation);\n\n // Determine the insert index for the new tab node.\n let i = after ? root.children.length : 0;\n\n // Normalize the split node.\n root.normalizeSizes();\n\n // Create the sizer for new tab node.\n let sizer = Private.createSizer(refNode ? 1 : Private.GOLDEN_RATIO);\n\n // Insert the tab node sized to the golden ratio.\n let tabNode = this._createTabNode(widget);\n ArrayExt.insert(root.children, i, tabNode);\n ArrayExt.insert(root.sizers, i, sizer);\n ArrayExt.insert(root.handles, i, this._createHandle());\n tabNode.parent = root;\n\n // Re-normalize the split node to maintain the ratios.\n root.normalizeSizes();\n\n // Finally, synchronize the visibility of the handles.\n root.syncHandles();\n return;\n }\n\n // Lookup the split node for the ref widget.\n let splitNode = refNode.parent;\n\n // If the split node already had the correct orientation,\n // the widget can be inserted into the split node directly.\n if (splitNode.orientation === orientation) {\n // Find the index of the ref node.\n let i = splitNode.children.indexOf(refNode);\n\n // Conditionally reuse a tab layout found in the wanted position.\n if (merge) {\n let j = i + (after ? 1 : -1);\n let sibling = splitNode.children[j];\n if (sibling instanceof Private.TabLayoutNode) {\n this._insertTab(widget, null, sibling, true);\n ++sibling.tabBar.currentIndex;\n return;\n }\n }\n\n // Normalize the split node.\n splitNode.normalizeSizes();\n\n // Consume half the space for the insert location.\n let s = (splitNode.sizers[i].sizeHint /= 2);\n\n // Insert the tab node sized to the other half.\n let j = i + (after ? 1 : 0);\n let tabNode = this._createTabNode(widget);\n ArrayExt.insert(splitNode.children, j, tabNode);\n ArrayExt.insert(splitNode.sizers, j, Private.createSizer(s));\n ArrayExt.insert(splitNode.handles, j, this._createHandle());\n tabNode.parent = splitNode;\n\n // Finally, synchronize the visibility of the handles.\n splitNode.syncHandles();\n return;\n }\n\n // Remove the ref node from the split node.\n let i = ArrayExt.removeFirstOf(splitNode.children, refNode);\n\n // Create a new normalized split node for the children.\n let childNode = new Private.SplitLayoutNode(orientation);\n childNode.normalized = true;\n\n // Add the ref node sized to half the space.\n childNode.children.push(refNode);\n childNode.sizers.push(Private.createSizer(0.5));\n childNode.handles.push(this._createHandle());\n refNode.parent = childNode;\n\n // Add the tab node sized to the other half.\n let j = after ? 1 : 0;\n let tabNode = this._createTabNode(widget);\n ArrayExt.insert(childNode.children, j, tabNode);\n ArrayExt.insert(childNode.sizers, j, Private.createSizer(0.5));\n ArrayExt.insert(childNode.handles, j, this._createHandle());\n tabNode.parent = childNode;\n\n // Synchronize the visibility of the handles.\n childNode.syncHandles();\n\n // Finally, add the new child node to the original split node.\n ArrayExt.insert(splitNode.children, i, childNode);\n childNode.parent = splitNode;\n }\n\n /**\n * Ensure the root is a split node with the given orientation.\n */\n private _splitRoot(\n orientation: Private.Orientation\n ): Private.SplitLayoutNode {\n // Bail early if the root already meets the requirements.\n let oldRoot = this._root;\n if (oldRoot instanceof Private.SplitLayoutNode) {\n if (oldRoot.orientation === orientation) {\n return oldRoot;\n }\n }\n\n // Create a new root node with the specified orientation.\n let newRoot = (this._root = new Private.SplitLayoutNode(orientation));\n\n // Add the old root to the new root.\n if (oldRoot) {\n newRoot.children.push(oldRoot);\n newRoot.sizers.push(Private.createSizer(0));\n newRoot.handles.push(this._createHandle());\n oldRoot.parent = newRoot;\n }\n\n // Return the new root as a convenience.\n return newRoot;\n }\n\n /**\n * Fit the layout to the total size required by the widgets.\n */\n private _fit(): void {\n // Set up the computed minimum size.\n let minW = 0;\n let minH = 0;\n\n // Update the size limits for the layout tree.\n if (this._root) {\n let limits = this._root.fit(this._spacing, this._items);\n minW = limits.minWidth;\n minH = limits.minHeight;\n }\n\n // Update the box sizing and add it to the computed min size.\n let box = (this._box = ElementExt.boxSizing(this.parent!.node));\n minW += box.horizontalSum;\n minH += box.verticalSum;\n\n // Update the parent's min size constraints.\n let style = this.parent!.node.style;\n style.minWidth = `${minW}px`;\n style.minHeight = `${minH}px`;\n\n // Set the dirty flag to ensure only a single update occurs.\n this._dirty = true;\n\n // Notify the ancestor that it should fit immediately. This may\n // cause a resize of the parent, fulfilling the required update.\n if (this.parent!.parent) {\n MessageLoop.sendMessage(this.parent!.parent!, Widget.Msg.FitRequest);\n }\n\n // If the dirty flag is still set, the parent was not resized.\n // Trigger the required update on the parent widget immediately.\n if (this._dirty) {\n MessageLoop.sendMessage(this.parent!, Widget.Msg.UpdateRequest);\n }\n }\n\n /**\n * Update the layout position and size of the widgets.\n *\n * The parent offset dimensions should be `-1` if unknown.\n */\n private _update(offsetWidth: number, offsetHeight: number): void {\n // Clear the dirty flag to indicate the update occurred.\n this._dirty = false;\n\n // Bail early if there is no root layout node.\n if (!this._root) {\n return;\n }\n\n // Measure the parent if the offset dimensions are unknown.\n if (offsetWidth < 0) {\n offsetWidth = this.parent!.node.offsetWidth;\n }\n if (offsetHeight < 0) {\n offsetHeight = this.parent!.node.offsetHeight;\n }\n\n // Ensure the parent box sizing data is computed.\n if (!this._box) {\n this._box = ElementExt.boxSizing(this.parent!.node);\n }\n\n // Compute the actual layout bounds adjusted for border and padding.\n let x = this._box.paddingTop;\n let y = this._box.paddingLeft;\n let width = offsetWidth - this._box.horizontalSum;\n let height = offsetHeight - this._box.verticalSum;\n\n // Update the geometry of the layout tree.\n this._root.update(x, y, width, height, this._spacing, this._items);\n }\n\n /**\n * Create a new tab bar for use by the dock layout.\n *\n * #### Notes\n * The tab bar will be attached to the parent if it exists.\n */\n private _createTabBar(): TabBar {\n // Create the tab bar using the renderer.\n let tabBar = this.renderer.createTabBar(this._document);\n\n // Enforce necessary tab bar behavior.\n tabBar.orientation = 'horizontal';\n\n // Attach the tab bar to the parent if possible.\n if (this.parent) {\n this.attachWidget(tabBar);\n }\n\n // Return the initialized tab bar.\n return tabBar;\n }\n\n /**\n * Create a new handle for the dock layout.\n *\n * #### Notes\n * The handle will be attached to the parent if it exists.\n */\n private _createHandle(): HTMLDivElement {\n // Create the handle using the renderer.\n let handle = this.renderer.createHandle();\n\n // Initialize the handle layout behavior.\n let style = handle.style;\n style.position = 'absolute';\n style.contain = 'strict';\n style.top = '0';\n style.left = '0';\n style.width = '0';\n style.height = '0';\n\n // Attach the handle to the parent if it exists.\n if (this.parent) {\n this.parent.node.appendChild(handle);\n }\n\n // Return the initialized handle.\n return handle;\n }\n\n private _spacing = 4;\n private _dirty = false;\n private _root: Private.LayoutNode | null = null;\n private _box: ElementExt.IBoxSizing | null = null;\n private _document: Document | ShadowRoot;\n private _hiddenMode: Widget.HiddenMode;\n private _items: Private.ItemMap = new Map();\n}\n\n/**\n * The namespace for the `DockLayout` class statics.\n */\nexport namespace DockLayout {\n /**\n * An options object for creating a dock layout.\n */\n export interface IOptions {\n /**\n * The document to use with the dock panel.\n *\n * The default is the global `document` instance.\n */\n document?: Document | ShadowRoot;\n\n /**\n * The method for hiding widgets.\n *\n * The default is `Widget.HiddenMode.Display`.\n */\n hiddenMode?: Widget.HiddenMode;\n\n /**\n * The renderer to use for the dock layout.\n */\n renderer: IRenderer;\n\n /**\n * The spacing between items in the layout.\n *\n * The default is `4`.\n */\n spacing?: number;\n }\n\n /**\n * A renderer for use with a dock layout.\n */\n export interface IRenderer {\n /**\n * Create a new tab bar for use with a dock layout.\n *\n * @returns A new tab bar for a dock layout.\n */\n createTabBar(document?: Document | ShadowRoot): TabBar;\n\n /**\n * Create a new handle node for use with a dock layout.\n *\n * @returns A new handle node for a dock layout.\n */\n createHandle(): HTMLDivElement;\n }\n\n /**\n * A type alias for the supported insertion modes.\n *\n * An insert mode is used to specify how a widget should be added\n * to the dock layout relative to a reference widget.\n */\n export type InsertMode =\n | /**\n * The area to the top of the reference widget.\n *\n * The widget will be inserted just above the reference widget.\n *\n * If the reference widget is null or invalid, the widget will be\n * inserted at the top edge of the dock layout.\n */\n 'split-top'\n\n /**\n * The area to the left of the reference widget.\n *\n * The widget will be inserted just left of the reference widget.\n *\n * If the reference widget is null or invalid, the widget will be\n * inserted at the left edge of the dock layout.\n */\n | 'split-left'\n\n /**\n * The area to the right of the reference widget.\n *\n * The widget will be inserted just right of the reference widget.\n *\n * If the reference widget is null or invalid, the widget will be\n * inserted at the right edge of the dock layout.\n */\n | 'split-right'\n\n /**\n * The area to the bottom of the reference widget.\n *\n * The widget will be inserted just below the reference widget.\n *\n * If the reference widget is null or invalid, the widget will be\n * inserted at the bottom edge of the dock layout.\n */\n | 'split-bottom'\n\n /**\n * Like `split-top` but if a tab layout exists above the reference widget,\n * it behaves like `tab-after` with reference to that instead.\n */\n | 'merge-top'\n\n /**\n * Like `split-left` but if a tab layout exists left of the reference widget,\n * it behaves like `tab-after` with reference to that instead.\n */\n | 'merge-left'\n\n /**\n * Like `split-right` but if a tab layout exists right of the reference widget,\n * it behaves like `tab-after` with reference to that instead.\n */\n | 'merge-right'\n\n /**\n * Like `split-bottom` but if a tab layout exists below the reference widget,\n * it behaves like `tab-after` with reference to that instead.\n */\n | 'merge-bottom'\n\n /**\n * The tab position before the reference widget.\n *\n * The widget will be added as a tab before the reference widget.\n *\n * If the reference widget is null or invalid, a sensible default\n * will be used.\n */\n | 'tab-before'\n\n /**\n * The tab position after the reference widget.\n *\n * The widget will be added as a tab after the reference widget.\n *\n * If the reference widget is null or invalid, a sensible default\n * will be used.\n */\n | 'tab-after';\n\n /**\n * An options object for adding a widget to the dock layout.\n */\n export interface IAddOptions {\n /**\n * The insertion mode for adding the widget.\n *\n * The default is `'tab-after'`.\n */\n mode?: InsertMode;\n\n /**\n * The reference widget for the insert location.\n *\n * The default is `null`.\n */\n ref?: Widget | null;\n }\n\n /**\n * A layout config object for a tab area.\n */\n export interface ITabAreaConfig {\n /**\n * The discriminated type of the config object.\n */\n type: 'tab-area';\n\n /**\n * The widgets contained in the tab area.\n */\n widgets: Widget[];\n\n /**\n * The index of the selected tab.\n */\n currentIndex: number;\n }\n\n /**\n * A layout config object for a split area.\n */\n export interface ISplitAreaConfig {\n /**\n * The discriminated type of the config object.\n */\n type: 'split-area';\n\n /**\n * The orientation of the split area.\n */\n orientation: 'horizontal' | 'vertical';\n\n /**\n * The children in the split area.\n */\n children: AreaConfig[];\n\n /**\n * The relative sizes of the children.\n */\n sizes: number[];\n }\n\n /**\n * A type alias for a general area config.\n */\n export type AreaConfig = ITabAreaConfig | ISplitAreaConfig;\n\n /**\n * A dock layout configuration object.\n */\n export interface ILayoutConfig {\n /**\n * The layout config for the main dock area.\n */\n main: AreaConfig | null;\n }\n\n /**\n * An object which represents the geometry of a tab area.\n */\n export interface ITabAreaGeometry {\n /**\n * The tab bar for the tab area.\n */\n tabBar: TabBar;\n\n /**\n * The local X position of the hit test in the dock area.\n *\n * #### Notes\n * This is the distance from the left edge of the layout parent\n * widget, to the local X coordinate of the hit test query.\n */\n x: number;\n\n /**\n * The local Y position of the hit test in the dock area.\n *\n * #### Notes\n * This is the distance from the top edge of the layout parent\n * widget, to the local Y coordinate of the hit test query.\n */\n y: number;\n\n /**\n * The local coordinate of the top edge of the tab area.\n *\n * #### Notes\n * This is the distance from the top edge of the layout parent\n * widget, to the top edge of the tab area.\n */\n top: number;\n\n /**\n * The local coordinate of the left edge of the tab area.\n *\n * #### Notes\n * This is the distance from the left edge of the layout parent\n * widget, to the left edge of the tab area.\n */\n left: number;\n\n /**\n * The local coordinate of the right edge of the tab area.\n *\n * #### Notes\n * This is the distance from the right edge of the layout parent\n * widget, to the right edge of the tab area.\n */\n right: number;\n\n /**\n * The local coordinate of the bottom edge of the tab area.\n *\n * #### Notes\n * This is the distance from the bottom edge of the layout parent\n * widget, to the bottom edge of the tab area.\n */\n bottom: number;\n\n /**\n * The width of the tab area.\n *\n * #### Notes\n * This is total width allocated for the tab area.\n */\n width: number;\n\n /**\n * The height of the tab area.\n *\n * #### Notes\n * This is total height allocated for the tab area.\n */\n height: number;\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * A fraction used for sizing root panels; ~= `1 / golden_ratio`.\n */\n export const GOLDEN_RATIO = 0.618;\n\n /**\n * A type alias for a dock layout node.\n */\n export type LayoutNode = TabLayoutNode | SplitLayoutNode;\n\n /**\n * A type alias for the orientation of a split layout node.\n */\n export type Orientation = 'horizontal' | 'vertical';\n\n /**\n * A type alias for a layout item map.\n */\n export type ItemMap = Map;\n\n /**\n * Create a box sizer with an initial size hint.\n */\n export function createSizer(hint: number): BoxSizer {\n let sizer = new BoxSizer();\n sizer.sizeHint = hint;\n sizer.size = hint;\n return sizer;\n }\n\n /**\n * Normalize an area config object and collect the visited widgets.\n */\n export function normalizeAreaConfig(\n config: DockLayout.AreaConfig,\n widgetSet: Set\n ): DockLayout.AreaConfig | null {\n let result: DockLayout.AreaConfig | null;\n if (config.type === 'tab-area') {\n result = normalizeTabAreaConfig(config, widgetSet);\n } else {\n result = normalizeSplitAreaConfig(config, widgetSet);\n }\n return result;\n }\n\n /**\n * Convert a normalized area config into a layout tree.\n */\n export function realizeAreaConfig(\n config: DockLayout.AreaConfig,\n renderer: DockLayout.IRenderer,\n document: Document | ShadowRoot\n ): LayoutNode {\n let node: LayoutNode;\n if (config.type === 'tab-area') {\n node = realizeTabAreaConfig(config, renderer, document);\n } else {\n node = realizeSplitAreaConfig(config, renderer, document);\n }\n return node;\n }\n\n /**\n * A layout node which holds the data for a tabbed area.\n */\n export class TabLayoutNode {\n /**\n * Construct a new tab layout node.\n *\n * @param tabBar - The tab bar to use for the layout node.\n */\n constructor(tabBar: TabBar) {\n let tabSizer = new BoxSizer();\n let widgetSizer = new BoxSizer();\n tabSizer.stretch = 0;\n widgetSizer.stretch = 1;\n this.tabBar = tabBar;\n this.sizers = [tabSizer, widgetSizer];\n }\n\n /**\n * The parent of the layout node.\n */\n parent: SplitLayoutNode | null = null;\n\n /**\n * The tab bar for the layout node.\n */\n readonly tabBar: TabBar;\n\n /**\n * The sizers for the layout node.\n */\n readonly sizers: [BoxSizer, BoxSizer];\n\n /**\n * The most recent value for the `top` edge of the layout box.\n */\n get top(): number {\n return this._top;\n }\n\n /**\n * The most recent value for the `left` edge of the layout box.\n */\n get left(): number {\n return this._left;\n }\n\n /**\n * The most recent value for the `width` of the layout box.\n */\n get width(): number {\n return this._width;\n }\n\n /**\n * The most recent value for the `height` of the layout box.\n */\n get height(): number {\n return this._height;\n }\n\n /**\n * Create an iterator for all widgets in the layout tree.\n */\n *iterAllWidgets(): IterableIterator {\n yield this.tabBar;\n yield* this.iterUserWidgets();\n }\n\n /**\n * Create an iterator for the user widgets in the layout tree.\n */\n *iterUserWidgets(): IterableIterator {\n for (const title of this.tabBar.titles) {\n yield title.owner;\n }\n }\n\n /**\n * Create an iterator for the selected widgets in the layout tree.\n */\n *iterSelectedWidgets(): IterableIterator {\n let title = this.tabBar.currentTitle;\n if (title) {\n yield title.owner;\n }\n }\n\n /**\n * Create an iterator for the tab bars in the layout tree.\n */\n *iterTabBars(): IterableIterator> {\n yield this.tabBar;\n }\n\n /**\n * Create an iterator for the handles in the layout tree.\n */\n // eslint-disable-next-line require-yield\n *iterHandles(): IterableIterator {\n return;\n }\n\n /**\n * Find the tab layout node which contains the given widget.\n */\n findTabNode(widget: Widget): TabLayoutNode | null {\n return this.tabBar.titles.indexOf(widget.title) !== -1 ? this : null;\n }\n\n /**\n * Find the split layout node which contains the given handle.\n */\n findSplitNode(\n handle: HTMLDivElement\n ): { index: number; node: SplitLayoutNode } | null {\n return null;\n }\n\n /**\n * Find the first tab layout node in a layout tree.\n */\n findFirstTabNode(): TabLayoutNode | null {\n return this;\n }\n\n /**\n * Find the tab layout node which contains the local point.\n */\n hitTestTabNodes(x: number, y: number): TabLayoutNode | null {\n if (x < this._left || x >= this._left + this._width) {\n return null;\n }\n if (y < this._top || y >= this._top + this._height) {\n return null;\n }\n return this;\n }\n\n /**\n * Create a configuration object for the layout tree.\n */\n createConfig(): DockLayout.ITabAreaConfig {\n let widgets = this.tabBar.titles.map(title => title.owner);\n let currentIndex = this.tabBar.currentIndex;\n return { type: 'tab-area', widgets, currentIndex };\n }\n\n /**\n * Recursively hold all of the sizes in the layout tree.\n *\n * This ignores the sizers of tab layout nodes.\n */\n holdAllSizes(): void {\n return;\n }\n\n /**\n * Fit the layout tree.\n */\n fit(spacing: number, items: ItemMap): ElementExt.ISizeLimits {\n // Set up the limit variables.\n let minWidth = 0;\n let minHeight = 0;\n let maxWidth = Infinity;\n let maxHeight = Infinity;\n\n // Lookup the tab bar layout item.\n let tabBarItem = items.get(this.tabBar);\n\n // Lookup the widget layout item.\n let current = this.tabBar.currentTitle;\n let widgetItem = current ? items.get(current.owner) : undefined;\n\n // Lookup the tab bar and widget sizers.\n let [tabBarSizer, widgetSizer] = this.sizers;\n\n // Update the tab bar limits.\n if (tabBarItem) {\n tabBarItem.fit();\n }\n\n // Update the widget limits.\n if (widgetItem) {\n widgetItem.fit();\n }\n\n // Update the results and sizer for the tab bar.\n if (tabBarItem && !tabBarItem.isHidden) {\n minWidth = Math.max(minWidth, tabBarItem.minWidth);\n minHeight += tabBarItem.minHeight;\n tabBarSizer.minSize = tabBarItem.minHeight;\n tabBarSizer.maxSize = tabBarItem.maxHeight;\n } else {\n tabBarSizer.minSize = 0;\n tabBarSizer.maxSize = 0;\n }\n\n // Update the results and sizer for the current widget.\n if (widgetItem && !widgetItem.isHidden) {\n minWidth = Math.max(minWidth, widgetItem.minWidth);\n minHeight += widgetItem.minHeight;\n widgetSizer.minSize = widgetItem.minHeight;\n widgetSizer.maxSize = Infinity;\n } else {\n widgetSizer.minSize = 0;\n widgetSizer.maxSize = Infinity;\n }\n\n // Return the computed size limits for the layout node.\n return { minWidth, minHeight, maxWidth, maxHeight };\n }\n\n /**\n * Update the layout tree.\n */\n update(\n left: number,\n top: number,\n width: number,\n height: number,\n spacing: number,\n items: ItemMap\n ): void {\n // Update the layout box values.\n this._top = top;\n this._left = left;\n this._width = width;\n this._height = height;\n\n // Lookup the tab bar layout item.\n let tabBarItem = items.get(this.tabBar);\n\n // Lookup the widget layout item.\n let current = this.tabBar.currentTitle;\n let widgetItem = current ? items.get(current.owner) : undefined;\n\n // Distribute the layout space to the sizers.\n BoxEngine.calc(this.sizers, height);\n\n // Update the tab bar item using the computed size.\n if (tabBarItem && !tabBarItem.isHidden) {\n let size = this.sizers[0].size;\n tabBarItem.update(left, top, width, size);\n top += size;\n }\n\n // Layout the widget using the computed size.\n if (widgetItem && !widgetItem.isHidden) {\n let size = this.sizers[1].size;\n widgetItem.update(left, top, width, size);\n }\n }\n\n private _top = 0;\n private _left = 0;\n private _width = 0;\n private _height = 0;\n }\n\n /**\n * A layout node which holds the data for a split area.\n */\n export class SplitLayoutNode {\n /**\n * Construct a new split layout node.\n *\n * @param orientation - The orientation of the node.\n */\n constructor(orientation: Orientation) {\n this.orientation = orientation;\n }\n\n /**\n * The parent of the layout node.\n */\n parent: SplitLayoutNode | null = null;\n\n /**\n * Whether the sizers have been normalized.\n */\n normalized = false;\n\n /**\n * The orientation of the node.\n */\n readonly orientation: Orientation;\n\n /**\n * The child nodes for the split node.\n */\n readonly children: LayoutNode[] = [];\n\n /**\n * The box sizers for the layout children.\n */\n readonly sizers: BoxSizer[] = [];\n\n /**\n * The handles for the layout children.\n */\n readonly handles: HTMLDivElement[] = [];\n\n /**\n * Create an iterator for all widgets in the layout tree.\n */\n *iterAllWidgets(): IterableIterator {\n for (const child of this.children) {\n yield* child.iterAllWidgets();\n }\n }\n\n /**\n * Create an iterator for the user widgets in the layout tree.\n */\n *iterUserWidgets(): IterableIterator {\n for (const child of this.children) {\n yield* child.iterUserWidgets();\n }\n }\n\n /**\n * Create an iterator for the selected widgets in the layout tree.\n */\n *iterSelectedWidgets(): IterableIterator {\n for (const child of this.children) {\n yield* child.iterSelectedWidgets();\n }\n }\n\n /**\n * Create an iterator for the tab bars in the layout tree.\n */\n *iterTabBars(): IterableIterator> {\n for (const child of this.children) {\n yield* child.iterTabBars();\n }\n }\n\n /**\n * Create an iterator for the handles in the layout tree.\n */\n *iterHandles(): IterableIterator {\n yield* this.handles;\n for (const child of this.children) {\n yield* child.iterHandles();\n }\n }\n\n /**\n * Find the tab layout node which contains the given widget.\n */\n findTabNode(widget: Widget): TabLayoutNode | null {\n for (let i = 0, n = this.children.length; i < n; ++i) {\n let result = this.children[i].findTabNode(widget);\n if (result) {\n return result;\n }\n }\n return null;\n }\n\n /**\n * Find the split layout node which contains the given handle.\n */\n findSplitNode(\n handle: HTMLDivElement\n ): { index: number; node: SplitLayoutNode } | null {\n let index = this.handles.indexOf(handle);\n if (index !== -1) {\n return { index, node: this };\n }\n for (let i = 0, n = this.children.length; i < n; ++i) {\n let result = this.children[i].findSplitNode(handle);\n if (result) {\n return result;\n }\n }\n return null;\n }\n\n /**\n * Find the first tab layout node in a layout tree.\n */\n findFirstTabNode(): TabLayoutNode | null {\n if (this.children.length === 0) {\n return null;\n }\n return this.children[0].findFirstTabNode();\n }\n\n /**\n * Find the tab layout node which contains the local point.\n */\n hitTestTabNodes(x: number, y: number): TabLayoutNode | null {\n for (let i = 0, n = this.children.length; i < n; ++i) {\n let result = this.children[i].hitTestTabNodes(x, y);\n if (result) {\n return result;\n }\n }\n return null;\n }\n\n /**\n * Create a configuration object for the layout tree.\n */\n createConfig(): DockLayout.ISplitAreaConfig {\n let orientation = this.orientation;\n let sizes = this.createNormalizedSizes();\n let children = this.children.map(child => child.createConfig());\n return { type: 'split-area', orientation, children, sizes };\n }\n\n /**\n * Sync the visibility and orientation of the handles.\n */\n syncHandles(): void {\n this.handles.forEach((handle, i) => {\n handle.setAttribute('data-orientation', this.orientation);\n if (i === this.handles.length - 1) {\n handle.classList.add('lm-mod-hidden');\n } else {\n handle.classList.remove('lm-mod-hidden');\n }\n });\n }\n\n /**\n * Hold the current sizes of the box sizers.\n *\n * This sets the size hint of each sizer to its current size.\n */\n holdSizes(): void {\n for (const sizer of this.sizers) {\n sizer.sizeHint = sizer.size;\n }\n }\n\n /**\n * Recursively hold all of the sizes in the layout tree.\n *\n * This ignores the sizers of tab layout nodes.\n */\n holdAllSizes(): void {\n for (const child of this.children) {\n child.holdAllSizes();\n }\n this.holdSizes();\n }\n\n /**\n * Normalize the sizes of the split layout node.\n */\n normalizeSizes(): void {\n // Bail early if the sizers are empty.\n let n = this.sizers.length;\n if (n === 0) {\n return;\n }\n\n // Hold the current sizes of the sizers.\n this.holdSizes();\n\n // Compute the sum of the sizes.\n let sum = this.sizers.reduce((v, sizer) => v + sizer.sizeHint, 0);\n\n // Normalize the sizes based on the sum.\n if (sum === 0) {\n for (const sizer of this.sizers) {\n sizer.size = sizer.sizeHint = 1 / n;\n }\n } else {\n for (const sizer of this.sizers) {\n sizer.size = sizer.sizeHint /= sum;\n }\n }\n\n // Mark the sizes as normalized.\n this.normalized = true;\n }\n\n /**\n * Snap the normalized sizes of the split layout node.\n */\n createNormalizedSizes(): number[] {\n // Bail early if the sizers are empty.\n let n = this.sizers.length;\n if (n === 0) {\n return [];\n }\n\n // Grab the current sizes of the sizers.\n let sizes = this.sizers.map(sizer => sizer.size);\n\n // Compute the sum of the sizes.\n let sum = sizes.reduce((v, size) => v + size, 0);\n\n // Normalize the sizes based on the sum.\n if (sum === 0) {\n for (let i = sizes.length - 1; i > -1; i--) {\n sizes[i] = 1 / n;\n }\n } else {\n for (let i = sizes.length - 1; i > -1; i--) {\n sizes[i] /= sum;\n }\n }\n\n // Return the normalized sizes.\n return sizes;\n }\n\n /**\n * Fit the layout tree.\n */\n fit(spacing: number, items: ItemMap): ElementExt.ISizeLimits {\n // Compute the required fixed space.\n let horizontal = this.orientation === 'horizontal';\n let fixed = Math.max(0, this.children.length - 1) * spacing;\n\n // Set up the limit variables.\n let minWidth = horizontal ? fixed : 0;\n let minHeight = horizontal ? 0 : fixed;\n let maxWidth = Infinity;\n let maxHeight = Infinity;\n\n // Fit the children and update the limits.\n for (let i = 0, n = this.children.length; i < n; ++i) {\n let limits = this.children[i].fit(spacing, items);\n if (horizontal) {\n minHeight = Math.max(minHeight, limits.minHeight);\n minWidth += limits.minWidth;\n this.sizers[i].minSize = limits.minWidth;\n } else {\n minWidth = Math.max(minWidth, limits.minWidth);\n minHeight += limits.minHeight;\n this.sizers[i].minSize = limits.minHeight;\n }\n }\n\n // Return the computed limits for the layout node.\n return { minWidth, minHeight, maxWidth, maxHeight };\n }\n\n /**\n * Update the layout tree.\n */\n update(\n left: number,\n top: number,\n width: number,\n height: number,\n spacing: number,\n items: ItemMap\n ): void {\n // Compute the available layout space.\n let horizontal = this.orientation === 'horizontal';\n let fixed = Math.max(0, this.children.length - 1) * spacing;\n let space = Math.max(0, (horizontal ? width : height) - fixed);\n\n // De-normalize the sizes if needed.\n if (this.normalized) {\n for (const sizer of this.sizers) {\n sizer.sizeHint *= space;\n }\n this.normalized = false;\n }\n\n // Distribute the layout space to the sizers.\n BoxEngine.calc(this.sizers, space);\n\n // Update the geometry of the child nodes and handles.\n for (let i = 0, n = this.children.length; i < n; ++i) {\n let child = this.children[i];\n let size = this.sizers[i].size;\n let handleStyle = this.handles[i].style;\n if (horizontal) {\n child.update(left, top, size, height, spacing, items);\n left += size;\n handleStyle.top = `${top}px`;\n handleStyle.left = `${left}px`;\n handleStyle.width = `${spacing}px`;\n handleStyle.height = `${height}px`;\n left += spacing;\n } else {\n child.update(left, top, width, size, spacing, items);\n top += size;\n handleStyle.top = `${top}px`;\n handleStyle.left = `${left}px`;\n handleStyle.width = `${width}px`;\n handleStyle.height = `${spacing}px`;\n top += spacing;\n }\n }\n }\n }\n\n export function addAria(widget: Widget, tabBar: TabBar): void {\n widget.node.setAttribute('role', 'tabpanel');\n let renderer = tabBar.renderer;\n if (renderer instanceof TabBar.Renderer) {\n let tabId = renderer.createTabKey({\n title: widget.title,\n current: false,\n zIndex: 0\n });\n widget.node.setAttribute('aria-labelledby', tabId);\n }\n }\n\n export function removeAria(widget: Widget): void {\n widget.node.removeAttribute('role');\n widget.node.removeAttribute('aria-labelledby');\n }\n\n /**\n * Normalize a tab area config and collect the visited widgets.\n */\n function normalizeTabAreaConfig(\n config: DockLayout.ITabAreaConfig,\n widgetSet: Set\n ): DockLayout.ITabAreaConfig | null {\n // Bail early if there is no content.\n if (config.widgets.length === 0) {\n return null;\n }\n\n // Setup the filtered widgets array.\n let widgets: Widget[] = [];\n\n // Filter the config for unique widgets.\n for (const widget of config.widgets) {\n if (!widgetSet.has(widget)) {\n widgetSet.add(widget);\n widgets.push(widget);\n }\n }\n\n // Bail if there are no effective widgets.\n if (widgets.length === 0) {\n return null;\n }\n\n // Normalize the current index.\n let index = config.currentIndex;\n if (index !== -1 && (index < 0 || index >= widgets.length)) {\n index = 0;\n }\n\n // Return a normalized config object.\n return { type: 'tab-area', widgets, currentIndex: index };\n }\n\n /**\n * Normalize a split area config and collect the visited widgets.\n */\n function normalizeSplitAreaConfig(\n config: DockLayout.ISplitAreaConfig,\n widgetSet: Set\n ): DockLayout.AreaConfig | null {\n // Set up the result variables.\n let orientation = config.orientation;\n let children: DockLayout.AreaConfig[] = [];\n let sizes: number[] = [];\n\n // Normalize the config children.\n for (let i = 0, n = config.children.length; i < n; ++i) {\n // Normalize the child config.\n let child = normalizeAreaConfig(config.children[i], widgetSet);\n\n // Ignore an empty child.\n if (!child) {\n continue;\n }\n\n // Add the child or hoist its content as appropriate.\n if (child.type === 'tab-area' || child.orientation !== orientation) {\n children.push(child);\n sizes.push(Math.abs(config.sizes[i] || 0));\n } else {\n children.push(...child.children);\n sizes.push(...child.sizes);\n }\n }\n\n // Bail if there are no effective children.\n if (children.length === 0) {\n return null;\n }\n\n // If there is only one effective child, return that child.\n if (children.length === 1) {\n return children[0];\n }\n\n // Return a normalized config object.\n return { type: 'split-area', orientation, children, sizes };\n }\n\n /**\n * Convert a normalized tab area config into a layout tree.\n */\n function realizeTabAreaConfig(\n config: DockLayout.ITabAreaConfig,\n renderer: DockLayout.IRenderer,\n document: Document | ShadowRoot\n ): TabLayoutNode {\n // Create the tab bar for the layout node.\n let tabBar = renderer.createTabBar(document);\n\n // Hide each widget and add it to the tab bar.\n for (const widget of config.widgets) {\n widget.hide();\n tabBar.addTab(widget.title);\n Private.addAria(widget, tabBar);\n }\n\n // Set the current index of the tab bar.\n tabBar.currentIndex = config.currentIndex;\n\n // Return the new tab layout node.\n return new TabLayoutNode(tabBar);\n }\n\n /**\n * Convert a normalized split area config into a layout tree.\n */\n function realizeSplitAreaConfig(\n config: DockLayout.ISplitAreaConfig,\n renderer: DockLayout.IRenderer,\n document: Document | ShadowRoot\n ): SplitLayoutNode {\n // Create the split layout node.\n let node = new SplitLayoutNode(config.orientation);\n\n // Add each child to the layout node.\n config.children.forEach((child, i) => {\n // Create the child data for the layout node.\n let childNode = realizeAreaConfig(child, renderer, document);\n let sizer = createSizer(config.sizes[i]);\n let handle = renderer.createHandle();\n\n // Add the child data to the layout node.\n node.children.push(childNode);\n node.handles.push(handle);\n node.sizers.push(sizer);\n\n // Update the parent for the child node.\n childNode.parent = node;\n });\n\n // Synchronize the handle state for the layout node.\n node.syncHandles();\n\n // Normalize the sizes for the layout node.\n node.normalizeSizes();\n\n // Return the new layout node.\n return node;\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { find } from '@lumino/algorithm';\n\nimport { MimeData } from '@lumino/coreutils';\n\nimport { IDisposable } from '@lumino/disposable';\n\nimport { ElementExt, Platform } from '@lumino/domutils';\n\nimport { Drag } from '@lumino/dragdrop';\n\nimport { ConflatableMessage, Message, MessageLoop } from '@lumino/messaging';\n\nimport { AttachedProperty } from '@lumino/properties';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { DockLayout } from './docklayout';\n\nimport { TabBar } from './tabbar';\n\nimport { Widget } from './widget';\n\n/**\n * A widget which provides a flexible docking area for widgets.\n *\n * #### Notes\n * See also the related [example](../../examples/dockpanel/index.html) and\n * its [source](https://github.com/jupyterlab/lumino/tree/main/examples/example-dockpanel).\n */\nexport class DockPanel extends Widget {\n /**\n * Construct a new dock panel.\n *\n * @param options - The options for initializing the panel.\n */\n constructor(options: DockPanel.IOptions = {}) {\n super();\n this.addClass('lm-DockPanel');\n this._document = options.document || document;\n this._mode = options.mode || 'multiple-document';\n this._renderer = options.renderer || DockPanel.defaultRenderer;\n this._edges = options.edges || Private.DEFAULT_EDGES;\n if (options.tabsMovable !== undefined) {\n this._tabsMovable = options.tabsMovable;\n }\n if (options.tabsConstrained !== undefined) {\n this._tabsConstrained = options.tabsConstrained;\n }\n if (options.addButtonEnabled !== undefined) {\n this._addButtonEnabled = options.addButtonEnabled;\n }\n\n // Toggle the CSS mode attribute.\n this.dataset['mode'] = this._mode;\n\n // Create the delegate renderer for the layout.\n let renderer: DockPanel.IRenderer = {\n createTabBar: () => this._createTabBar(),\n createHandle: () => this._createHandle()\n };\n\n // Set up the dock layout for the panel.\n this.layout = new DockLayout({\n document: this._document,\n renderer,\n spacing: options.spacing,\n hiddenMode: options.hiddenMode\n });\n\n // Set up the overlay drop indicator.\n this.overlay = options.overlay || new DockPanel.Overlay();\n this.node.appendChild(this.overlay.node);\n }\n\n /**\n * Dispose of the resources held by the panel.\n */\n dispose(): void {\n // Ensure the mouse is released.\n this._releaseMouse();\n\n // Hide the overlay.\n this.overlay.hide(0);\n\n // Cancel a drag if one is in progress.\n if (this._drag) {\n this._drag.dispose();\n }\n\n // Dispose of the base class.\n super.dispose();\n }\n\n /**\n * The method for hiding widgets.\n */\n get hiddenMode(): Widget.HiddenMode {\n return (this.layout as DockLayout).hiddenMode;\n }\n\n /**\n * Set the method for hiding widgets.\n */\n set hiddenMode(v: Widget.HiddenMode) {\n (this.layout as DockLayout).hiddenMode = v;\n }\n\n /**\n * A signal emitted when the layout configuration is modified.\n *\n * #### Notes\n * This signal is emitted whenever the current layout configuration\n * may have changed.\n *\n * This signal is emitted asynchronously in a collapsed fashion, so\n * that multiple synchronous modifications results in only a single\n * emit of the signal.\n */\n get layoutModified(): ISignal {\n return this._layoutModified;\n }\n\n /**\n * A signal emitted when the add button on a tab bar is clicked.\n *\n */\n get addRequested(): ISignal> {\n return this._addRequested;\n }\n\n /**\n * The overlay used by the dock panel.\n */\n readonly overlay: DockPanel.IOverlay;\n\n /**\n * The renderer used by the dock panel.\n */\n get renderer(): DockPanel.IRenderer {\n return (this.layout as DockLayout).renderer;\n }\n\n /**\n * Get the spacing between the widgets.\n */\n get spacing(): number {\n return (this.layout as DockLayout).spacing;\n }\n\n /**\n * Set the spacing between the widgets.\n */\n set spacing(value: number) {\n (this.layout as DockLayout).spacing = value;\n }\n\n /**\n * Get the mode for the dock panel.\n */\n get mode(): DockPanel.Mode {\n return this._mode;\n }\n\n /**\n * Set the mode for the dock panel.\n *\n * #### Notes\n * Changing the mode is a destructive operation with respect to the\n * panel's layout configuration. If layout state must be preserved,\n * save the current layout config before changing the mode.\n */\n set mode(value: DockPanel.Mode) {\n // Bail early if the mode does not change.\n if (this._mode === value) {\n return;\n }\n\n // Update the internal mode.\n this._mode = value;\n\n // Toggle the CSS mode attribute.\n this.dataset['mode'] = value;\n\n // Get the layout for the panel.\n let layout = this.layout as DockLayout;\n\n // Configure the layout for the specified mode.\n switch (value) {\n case 'multiple-document':\n for (const tabBar of layout.tabBars()) {\n tabBar.show();\n }\n break;\n case 'single-document':\n layout.restoreLayout(Private.createSingleDocumentConfig(this));\n break;\n default:\n throw 'unreachable';\n }\n\n // Schedule an emit of the layout modified signal.\n MessageLoop.postMessage(this, Private.LayoutModified);\n }\n\n /**\n * Whether the tabs can be dragged / moved at runtime.\n */\n get tabsMovable(): boolean {\n return this._tabsMovable;\n }\n\n /**\n * Enable / Disable draggable / movable tabs.\n */\n set tabsMovable(value: boolean) {\n this._tabsMovable = value;\n for (const tabBar of this.tabBars()) {\n tabBar.tabsMovable = value;\n }\n }\n\n /**\n * Whether the tabs are constrained to their source dock panel\n */\n get tabsConstrained(): boolean {\n return this._tabsConstrained;\n }\n\n /**\n * Constrain/Allow tabs to be dragged outside of this dock panel\n */\n set tabsConstrained(value: boolean) {\n this._tabsConstrained = value;\n }\n\n /**\n * Whether the add buttons for each tab bar are enabled.\n */\n get addButtonEnabled(): boolean {\n return this._addButtonEnabled;\n }\n\n /**\n * Set whether the add buttons for each tab bar are enabled.\n */\n set addButtonEnabled(value: boolean) {\n this._addButtonEnabled = value;\n for (const tabBar of this.tabBars()) {\n tabBar.addButtonEnabled = value;\n }\n }\n\n /**\n * Whether the dock panel is empty.\n */\n get isEmpty(): boolean {\n return (this.layout as DockLayout).isEmpty;\n }\n\n /**\n * Create an iterator over the user widgets in the panel.\n *\n * @returns A new iterator over the user widgets in the panel.\n *\n * #### Notes\n * This iterator does not include the generated tab bars.\n */\n *widgets(): IterableIterator {\n yield* (this.layout as DockLayout).widgets();\n }\n\n /**\n * Create an iterator over the selected widgets in the panel.\n *\n * @returns A new iterator over the selected user widgets.\n *\n * #### Notes\n * This iterator yields the widgets corresponding to the current tab\n * of each tab bar in the panel.\n */\n *selectedWidgets(): IterableIterator {\n yield* (this.layout as DockLayout).selectedWidgets();\n }\n\n /**\n * Create an iterator over the tab bars in the panel.\n *\n * @returns A new iterator over the tab bars in the panel.\n *\n * #### Notes\n * This iterator does not include the user widgets.\n */\n *tabBars(): IterableIterator> {\n yield* (this.layout as DockLayout).tabBars();\n }\n\n /**\n * Create an iterator over the handles in the panel.\n *\n * @returns A new iterator over the handles in the panel.\n */\n *handles(): IterableIterator {\n yield* (this.layout as DockLayout).handles();\n }\n\n /**\n * Select a specific widget in the dock panel.\n *\n * @param widget - The widget of interest.\n *\n * #### Notes\n * This will make the widget the current widget in its tab area.\n */\n selectWidget(widget: Widget): void {\n // Find the tab bar which contains the widget.\n let tabBar = find(this.tabBars(), bar => {\n return bar.titles.indexOf(widget.title) !== -1;\n });\n\n // Throw an error if no tab bar is found.\n if (!tabBar) {\n throw new Error('Widget is not contained in the dock panel.');\n }\n\n // Ensure the widget is the current widget.\n tabBar.currentTitle = widget.title;\n }\n\n /**\n * Activate a specified widget in the dock panel.\n *\n * @param widget - The widget of interest.\n *\n * #### Notes\n * This will select and activate the given widget.\n */\n activateWidget(widget: Widget): void {\n this.selectWidget(widget);\n widget.activate();\n }\n\n /**\n * Save the current layout configuration of the dock panel.\n *\n * @returns A new config object for the current layout state.\n *\n * #### Notes\n * The return value can be provided to the `restoreLayout` method\n * in order to restore the layout to its current configuration.\n */\n saveLayout(): DockPanel.ILayoutConfig {\n return (this.layout as DockLayout).saveLayout();\n }\n\n /**\n * Restore the layout to a previously saved configuration.\n *\n * @param config - The layout configuration to restore.\n *\n * #### Notes\n * Widgets which currently belong to the layout but which are not\n * contained in the config will be unparented.\n *\n * The dock panel automatically reverts to `'multiple-document'`\n * mode when a layout config is restored.\n */\n restoreLayout(config: DockPanel.ILayoutConfig): void {\n // Reset the mode.\n this._mode = 'multiple-document';\n\n // Restore the layout.\n (this.layout as DockLayout).restoreLayout(config);\n\n // Flush the message loop on IE and Edge to prevent flicker.\n if (Platform.IS_EDGE || Platform.IS_IE) {\n MessageLoop.flush();\n }\n\n // Schedule an emit of the layout modified signal.\n MessageLoop.postMessage(this, Private.LayoutModified);\n }\n\n /**\n * Add a widget to the dock panel.\n *\n * @param widget - The widget to add to the dock panel.\n *\n * @param options - The additional options for adding the widget.\n *\n * #### Notes\n * If the panel is in single document mode, the options are ignored\n * and the widget is always added as tab in the hidden tab bar.\n */\n addWidget(widget: Widget, options: DockPanel.IAddOptions = {}): void {\n // Add the widget to the layout.\n if (this._mode === 'single-document') {\n (this.layout as DockLayout).addWidget(widget);\n } else {\n (this.layout as DockLayout).addWidget(widget, options);\n }\n\n // Schedule an emit of the layout modified signal.\n MessageLoop.postMessage(this, Private.LayoutModified);\n }\n\n /**\n * Process a message sent to the widget.\n *\n * @param msg - The message sent to the widget.\n */\n processMessage(msg: Message): void {\n if (msg.type === 'layout-modified') {\n this._layoutModified.emit(undefined);\n } else {\n super.processMessage(msg);\n }\n }\n\n /**\n * Handle the DOM events for the dock panel.\n *\n * @param event - The DOM event sent to the panel.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the panel's DOM node. It should\n * not be called directly by user code.\n */\n handleEvent(event: Event): void {\n switch (event.type) {\n case 'lm-dragenter':\n this._evtDragEnter(event as Drag.Event);\n break;\n case 'lm-dragleave':\n this._evtDragLeave(event as Drag.Event);\n break;\n case 'lm-dragover':\n this._evtDragOver(event as Drag.Event);\n break;\n case 'lm-drop':\n this._evtDrop(event as Drag.Event);\n break;\n case 'pointerdown':\n this._evtPointerDown(event as PointerEvent);\n break;\n case 'pointermove':\n this._evtPointerMove(event as PointerEvent);\n break;\n case 'pointerup':\n this._evtPointerUp(event as PointerEvent);\n break;\n case 'keydown':\n this._evtKeyDown(event as KeyboardEvent);\n break;\n case 'contextmenu':\n event.preventDefault();\n event.stopPropagation();\n break;\n }\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n this.node.addEventListener('lm-dragenter', this);\n this.node.addEventListener('lm-dragleave', this);\n this.node.addEventListener('lm-dragover', this);\n this.node.addEventListener('lm-drop', this);\n this.node.addEventListener('pointerdown', this);\n }\n\n /**\n * A message handler invoked on an `'after-detach'` message.\n */\n protected onAfterDetach(msg: Message): void {\n this.node.removeEventListener('lm-dragenter', this);\n this.node.removeEventListener('lm-dragleave', this);\n this.node.removeEventListener('lm-dragover', this);\n this.node.removeEventListener('lm-drop', this);\n this.node.removeEventListener('pointerdown', this);\n this._releaseMouse();\n }\n\n /**\n * A message handler invoked on a `'child-added'` message.\n */\n protected onChildAdded(msg: Widget.ChildMessage): void {\n // Ignore the generated tab bars.\n if (Private.isGeneratedTabBarProperty.get(msg.child)) {\n return;\n }\n\n // Add the widget class to the child.\n msg.child.addClass('lm-DockPanel-widget');\n }\n\n /**\n * A message handler invoked on a `'child-removed'` message.\n */\n protected onChildRemoved(msg: Widget.ChildMessage): void {\n // Ignore the generated tab bars.\n if (Private.isGeneratedTabBarProperty.get(msg.child)) {\n return;\n }\n\n // Remove the widget class from the child.\n msg.child.removeClass('lm-DockPanel-widget');\n\n // Schedule an emit of the layout modified signal.\n MessageLoop.postMessage(this, Private.LayoutModified);\n }\n\n /**\n * Handle the `'lm-dragenter'` event for the dock panel.\n */\n private _evtDragEnter(event: Drag.Event): void {\n // If the factory mime type is present, mark the event as\n // handled in order to get the rest of the drag events.\n if (event.mimeData.hasData('application/vnd.lumino.widget-factory')) {\n event.preventDefault();\n event.stopPropagation();\n }\n }\n\n /**\n * Handle the `'lm-dragleave'` event for the dock panel.\n */\n private _evtDragLeave(event: Drag.Event): void {\n // Mark the event as handled.\n event.preventDefault();\n\n if (this._tabsConstrained && event.source !== this) return;\n\n event.stopPropagation();\n\n // The new target might be a descendant, so we might still handle the drop.\n // Hide asynchronously so that if a lm-dragover event bubbles up to us, the\n // hide is cancelled by the lm-dragover handler's show overlay logic.\n this.overlay.hide(1);\n }\n\n /**\n * Handle the `'lm-dragover'` event for the dock panel.\n */\n private _evtDragOver(event: Drag.Event): void {\n // Mark the event as handled.\n event.preventDefault();\n\n // Show the drop indicator overlay and update the drop\n // action based on the drop target zone under the mouse.\n if (\n (this._tabsConstrained && event.source !== this) ||\n this._showOverlay(event.clientX, event.clientY) === 'invalid'\n ) {\n event.dropAction = 'none';\n } else {\n event.stopPropagation();\n event.dropAction = event.proposedAction;\n }\n }\n\n /**\n * Handle the `'lm-drop'` event for the dock panel.\n */\n private _evtDrop(event: Drag.Event): void {\n // Mark the event as handled.\n event.preventDefault();\n\n // Hide the drop indicator overlay.\n this.overlay.hide(0);\n\n // Bail if the proposed action is to do nothing.\n if (event.proposedAction === 'none') {\n event.dropAction = 'none';\n return;\n }\n\n // Find the drop target under the mouse.\n let { clientX, clientY } = event;\n let { zone, target } = Private.findDropTarget(\n this,\n clientX,\n clientY,\n this._edges\n );\n\n // Bail if the drop zone is invalid.\n if (\n (this._tabsConstrained && event.source !== this) ||\n zone === 'invalid'\n ) {\n event.dropAction = 'none';\n return;\n }\n\n // Bail if the factory mime type has invalid data.\n let mimeData = event.mimeData;\n let factory = mimeData.getData('application/vnd.lumino.widget-factory');\n if (typeof factory !== 'function') {\n event.dropAction = 'none';\n return;\n }\n\n // Bail if the factory does not produce a widget.\n let widget = factory();\n if (!(widget instanceof Widget)) {\n event.dropAction = 'none';\n return;\n }\n\n // Bail if the widget is an ancestor of the dock panel.\n if (widget.contains(this)) {\n event.dropAction = 'none';\n return;\n }\n\n // Find the reference widget for the drop target.\n let ref = target ? Private.getDropRef(target.tabBar) : null;\n\n // Add the widget according to the indicated drop zone.\n switch (zone) {\n case 'root-all':\n this.addWidget(widget);\n break;\n case 'root-top':\n this.addWidget(widget, { mode: 'split-top' });\n break;\n case 'root-left':\n this.addWidget(widget, { mode: 'split-left' });\n break;\n case 'root-right':\n this.addWidget(widget, { mode: 'split-right' });\n break;\n case 'root-bottom':\n this.addWidget(widget, { mode: 'split-bottom' });\n break;\n case 'widget-all':\n this.addWidget(widget, { mode: 'tab-after', ref });\n break;\n case 'widget-top':\n this.addWidget(widget, { mode: 'split-top', ref });\n break;\n case 'widget-left':\n this.addWidget(widget, { mode: 'split-left', ref });\n break;\n case 'widget-right':\n this.addWidget(widget, { mode: 'split-right', ref });\n break;\n case 'widget-bottom':\n this.addWidget(widget, { mode: 'split-bottom', ref });\n break;\n case 'widget-tab':\n this.addWidget(widget, { mode: 'tab-after', ref });\n break;\n default:\n throw 'unreachable';\n }\n\n // Accept the proposed drop action.\n event.dropAction = event.proposedAction;\n\n // Stop propagation if we have not bailed so far.\n event.stopPropagation();\n\n // Activate the dropped widget.\n this.activateWidget(widget);\n }\n\n /**\n * Handle the `'keydown'` event for the dock panel.\n */\n private _evtKeyDown(event: KeyboardEvent): void {\n // Stop input events during drag.\n event.preventDefault();\n event.stopPropagation();\n\n // Release the mouse if `Escape` is pressed.\n if (event.keyCode === 27) {\n // Finalize the mouse release.\n this._releaseMouse();\n\n // Schedule an emit of the layout modified signal.\n MessageLoop.postMessage(this, Private.LayoutModified);\n }\n }\n\n /**\n * Handle the `'pointerdown'` event for the dock panel.\n */\n private _evtPointerDown(event: PointerEvent): void {\n // Do nothing if the left mouse button is not pressed.\n if (event.button !== 0) {\n return;\n }\n\n // Find the handle which contains the mouse target, if any.\n let layout = this.layout as DockLayout;\n let target = event.target as HTMLElement;\n let handle = find(layout.handles(), handle => handle.contains(target));\n if (!handle) {\n return;\n }\n\n // Stop the event when a handle is pressed.\n event.preventDefault();\n event.stopPropagation();\n\n // Add the extra document listeners.\n this._document.addEventListener('keydown', this, true);\n this._document.addEventListener('pointerup', this, true);\n this._document.addEventListener('pointermove', this, true);\n this._document.addEventListener('contextmenu', this, true);\n\n // Compute the offset deltas for the handle press.\n let rect = handle.getBoundingClientRect();\n let deltaX = event.clientX - rect.left;\n let deltaY = event.clientY - rect.top;\n\n // Override the cursor and store the press data.\n let style = window.getComputedStyle(handle);\n let override = Drag.overrideCursor(style.cursor!, this._document);\n this._pressData = { handle, deltaX, deltaY, override };\n }\n\n /**\n * Handle the `'pointermove'` event for the dock panel.\n */\n private _evtPointerMove(event: PointerEvent): void {\n // Bail early if no drag is in progress.\n if (!this._pressData) {\n return;\n }\n\n // Stop the event when dragging a handle.\n event.preventDefault();\n event.stopPropagation();\n\n // Compute the desired offset position for the handle.\n let rect = this.node.getBoundingClientRect();\n let xPos = event.clientX - rect.left - this._pressData.deltaX;\n let yPos = event.clientY - rect.top - this._pressData.deltaY;\n\n // Set the handle as close to the desired position as possible.\n let layout = this.layout as DockLayout;\n layout.moveHandle(this._pressData.handle, xPos, yPos);\n }\n\n /**\n * Handle the `'pointerup'` event for the dock panel.\n */\n private _evtPointerUp(event: PointerEvent): void {\n // Do nothing if the left mouse button is not released.\n if (event.button !== 0) {\n return;\n }\n\n // Stop the event when releasing a handle.\n event.preventDefault();\n event.stopPropagation();\n\n // Finalize the mouse release.\n this._releaseMouse();\n\n // Schedule an emit of the layout modified signal.\n MessageLoop.postMessage(this, Private.LayoutModified);\n }\n\n /**\n * Release the mouse grab for the dock panel.\n */\n private _releaseMouse(): void {\n // Bail early if no drag is in progress.\n if (!this._pressData) {\n return;\n }\n\n // Clear the override cursor.\n this._pressData.override.dispose();\n this._pressData = null;\n\n // Remove the extra document listeners.\n this._document.removeEventListener('keydown', this, true);\n this._document.removeEventListener('pointerup', this, true);\n this._document.removeEventListener('pointermove', this, true);\n this._document.removeEventListener('contextmenu', this, true);\n }\n\n /**\n * Show the overlay indicator at the given client position.\n *\n * Returns the drop zone at the specified client position.\n *\n * #### Notes\n * If the position is not over a valid zone, the overlay is hidden.\n */\n private _showOverlay(clientX: number, clientY: number): Private.DropZone {\n // Find the dock target for the given client position.\n let { zone, target } = Private.findDropTarget(\n this,\n clientX,\n clientY,\n this._edges\n );\n\n // If the drop zone is invalid, hide the overlay and bail.\n if (zone === 'invalid') {\n this.overlay.hide(100);\n return zone;\n }\n\n // Setup the variables needed to compute the overlay geometry.\n let top: number;\n let left: number;\n let right: number;\n let bottom: number;\n let box = ElementExt.boxSizing(this.node); // TODO cache this?\n let rect = this.node.getBoundingClientRect();\n\n // Compute the overlay geometry based on the dock zone.\n switch (zone) {\n case 'root-all':\n top = box.paddingTop;\n left = box.paddingLeft;\n right = box.paddingRight;\n bottom = box.paddingBottom;\n break;\n case 'root-top':\n top = box.paddingTop;\n left = box.paddingLeft;\n right = box.paddingRight;\n bottom = rect.height * Private.GOLDEN_RATIO;\n break;\n case 'root-left':\n top = box.paddingTop;\n left = box.paddingLeft;\n right = rect.width * Private.GOLDEN_RATIO;\n bottom = box.paddingBottom;\n break;\n case 'root-right':\n top = box.paddingTop;\n left = rect.width * Private.GOLDEN_RATIO;\n right = box.paddingRight;\n bottom = box.paddingBottom;\n break;\n case 'root-bottom':\n top = rect.height * Private.GOLDEN_RATIO;\n left = box.paddingLeft;\n right = box.paddingRight;\n bottom = box.paddingBottom;\n break;\n case 'widget-all':\n top = target!.top;\n left = target!.left;\n right = target!.right;\n bottom = target!.bottom;\n break;\n case 'widget-top':\n top = target!.top;\n left = target!.left;\n right = target!.right;\n bottom = target!.bottom + target!.height / 2;\n break;\n case 'widget-left':\n top = target!.top;\n left = target!.left;\n right = target!.right + target!.width / 2;\n bottom = target!.bottom;\n break;\n case 'widget-right':\n top = target!.top;\n left = target!.left + target!.width / 2;\n right = target!.right;\n bottom = target!.bottom;\n break;\n case 'widget-bottom':\n top = target!.top + target!.height / 2;\n left = target!.left;\n right = target!.right;\n bottom = target!.bottom;\n break;\n case 'widget-tab': {\n const tabHeight = target!.tabBar.node.getBoundingClientRect().height;\n top = target!.top;\n left = target!.left;\n right = target!.right;\n bottom = target!.bottom + target!.height - tabHeight;\n break;\n }\n default:\n throw 'unreachable';\n }\n\n // Show the overlay with the computed geometry.\n this.overlay.show({ top, left, right, bottom });\n\n // Finally, return the computed drop zone.\n return zone;\n }\n\n /**\n * Create a new tab bar for use by the panel.\n */\n private _createTabBar(): TabBar {\n // Create the tab bar.\n let tabBar = this._renderer.createTabBar(this._document);\n\n // Set the generated tab bar property for the tab bar.\n Private.isGeneratedTabBarProperty.set(tabBar, true);\n\n // Hide the tab bar when in single document mode.\n if (this._mode === 'single-document') {\n tabBar.hide();\n }\n\n // Enforce necessary tab bar behavior.\n // TODO do we really want to enforce *all* of these?\n tabBar.tabsMovable = this._tabsMovable;\n tabBar.allowDeselect = false;\n tabBar.addButtonEnabled = this._addButtonEnabled;\n tabBar.removeBehavior = 'select-previous-tab';\n tabBar.insertBehavior = 'select-tab-if-needed';\n\n // Connect the signal handlers for the tab bar.\n tabBar.tabMoved.connect(this._onTabMoved, this);\n tabBar.currentChanged.connect(this._onCurrentChanged, this);\n tabBar.tabCloseRequested.connect(this._onTabCloseRequested, this);\n tabBar.tabDetachRequested.connect(this._onTabDetachRequested, this);\n tabBar.tabActivateRequested.connect(this._onTabActivateRequested, this);\n tabBar.addRequested.connect(this._onTabAddRequested, this);\n\n // Return the initialized tab bar.\n return tabBar;\n }\n\n /**\n * Create a new handle for use by the panel.\n */\n private _createHandle(): HTMLDivElement {\n return this._renderer.createHandle();\n }\n\n /**\n * Handle the `tabMoved` signal from a tab bar.\n */\n private _onTabMoved(): void {\n MessageLoop.postMessage(this, Private.LayoutModified);\n }\n\n /**\n * Handle the `currentChanged` signal from a tab bar.\n */\n private _onCurrentChanged(\n sender: TabBar,\n args: TabBar.ICurrentChangedArgs\n ): void {\n // Extract the previous and current title from the args.\n let { previousTitle, currentTitle } = args;\n\n // Hide the previous widget.\n if (previousTitle) {\n previousTitle.owner.hide();\n }\n\n // Show the current widget.\n if (currentTitle) {\n currentTitle.owner.show();\n }\n\n // Flush the message loop on IE and Edge to prevent flicker.\n if (Platform.IS_EDGE || Platform.IS_IE) {\n MessageLoop.flush();\n }\n\n // Schedule an emit of the layout modified signal.\n MessageLoop.postMessage(this, Private.LayoutModified);\n }\n\n /**\n * Handle the `addRequested` signal from a tab bar.\n */\n private _onTabAddRequested(sender: TabBar): void {\n this._addRequested.emit(sender);\n }\n\n /**\n * Handle the `tabActivateRequested` signal from a tab bar.\n */\n private _onTabActivateRequested(\n sender: TabBar,\n args: TabBar.ITabActivateRequestedArgs\n ): void {\n args.title.owner.activate();\n }\n\n /**\n * Handle the `tabCloseRequested` signal from a tab bar.\n */\n private _onTabCloseRequested(\n sender: TabBar,\n args: TabBar.ITabCloseRequestedArgs\n ): void {\n args.title.owner.close();\n }\n\n /**\n * Handle the `tabDetachRequested` signal from a tab bar.\n */\n private _onTabDetachRequested(\n sender: TabBar,\n args: TabBar.ITabDetachRequestedArgs\n ): void {\n // Do nothing if a drag is already in progress.\n if (this._drag) {\n return;\n }\n\n // Release the tab bar's hold on the mouse.\n sender.releaseMouse();\n\n // Extract the data from the args.\n let { title, tab, clientX, clientY, offset } = args;\n\n // Setup the mime data for the drag operation.\n let mimeData = new MimeData();\n let factory = () => title.owner;\n mimeData.setData('application/vnd.lumino.widget-factory', factory);\n\n // Create the drag image for the drag operation.\n let dragImage = tab.cloneNode(true) as HTMLElement;\n if (offset) {\n dragImage.style.top = `-${offset.y}px`;\n dragImage.style.left = `-${offset.x}px`;\n }\n\n // Create the drag object to manage the drag-drop operation.\n this._drag = new Drag({\n document: this._document,\n mimeData,\n dragImage,\n proposedAction: 'move',\n supportedActions: 'move',\n source: this\n });\n\n // Hide the tab node in the original tab.\n tab.classList.add('lm-mod-hidden');\n let cleanup = () => {\n this._drag = null;\n tab.classList.remove('lm-mod-hidden');\n };\n\n // Start the drag operation and cleanup when done.\n this._drag.start(clientX, clientY).then(cleanup);\n }\n\n private _edges: DockPanel.IEdges;\n private _document: Document | ShadowRoot;\n private _mode: DockPanel.Mode;\n private _drag: Drag | null = null;\n private _renderer: DockPanel.IRenderer;\n private _tabsMovable: boolean = true;\n private _tabsConstrained: boolean = false;\n private _addButtonEnabled: boolean = false;\n private _pressData: Private.IPressData | null = null;\n private _layoutModified = new Signal(this);\n\n private _addRequested = new Signal>(this);\n}\n\n/**\n * The namespace for the `DockPanel` class statics.\n */\nexport namespace DockPanel {\n /**\n * An options object for creating a dock panel.\n */\n export interface IOptions {\n /**\n * The document to use with the dock panel.\n *\n * The default is the global `document` instance.\n */\n\n document?: Document | ShadowRoot;\n /**\n * The overlay to use with the dock panel.\n *\n * The default is a new `Overlay` instance.\n */\n overlay?: IOverlay;\n\n /**\n * The renderer to use for the dock panel.\n *\n * The default is a shared renderer instance.\n */\n renderer?: IRenderer;\n\n /**\n * The spacing between the items in the panel.\n *\n * The default is `4`.\n */\n spacing?: number;\n\n /**\n * The mode for the dock panel.\n *\n * The default is `'multiple-document'`.\n */\n mode?: DockPanel.Mode;\n\n /**\n * The sizes of the edge drop zones, in pixels.\n * If not given, default values will be used.\n */\n edges?: IEdges;\n\n /**\n * The method for hiding widgets.\n *\n * The default is `Widget.HiddenMode.Display`.\n */\n hiddenMode?: Widget.HiddenMode;\n\n /**\n * Allow tabs to be draggable / movable by user.\n *\n * The default is `'true'`.\n */\n tabsMovable?: boolean;\n\n /**\n * Constrain tabs to this dock panel\n *\n * The default is `'false'`.\n */\n tabsConstrained?: boolean;\n\n /**\n * Enable add buttons in each of the dock panel's tab bars.\n *\n * The default is `'false'`.\n */\n addButtonEnabled?: boolean;\n }\n\n /**\n * The sizes of the edge drop zones, in pixels.\n */\n export interface IEdges {\n /**\n * The size of the top edge drop zone.\n */\n top: number;\n\n /**\n * The size of the right edge drop zone.\n */\n right: number;\n\n /**\n * The size of the bottom edge drop zone.\n */\n bottom: number;\n\n /**\n * The size of the left edge drop zone.\n */\n left: number;\n }\n\n /**\n * A type alias for the supported dock panel modes.\n */\n export type Mode =\n | /**\n * The single document mode.\n *\n * In this mode, only a single widget is visible at a time, and that\n * widget fills the available layout space. No tab bars are visible.\n */\n 'single-document'\n\n /**\n * The multiple document mode.\n *\n * In this mode, multiple documents are displayed in separate tab\n * areas, and those areas can be individually resized by the user.\n */\n | 'multiple-document';\n\n /**\n * A type alias for a layout configuration object.\n */\n export type ILayoutConfig = DockLayout.ILayoutConfig;\n\n /**\n * A type alias for the supported insertion modes.\n */\n export type InsertMode = DockLayout.InsertMode;\n\n /**\n * A type alias for the add widget options.\n */\n export type IAddOptions = DockLayout.IAddOptions;\n\n /**\n * An object which holds the geometry for overlay positioning.\n */\n export interface IOverlayGeometry {\n /**\n * The distance between the overlay and parent top edges.\n */\n top: number;\n\n /**\n * The distance between the overlay and parent left edges.\n */\n left: number;\n\n /**\n * The distance between the overlay and parent right edges.\n */\n right: number;\n\n /**\n * The distance between the overlay and parent bottom edges.\n */\n bottom: number;\n }\n\n /**\n * An object which manages the overlay node for a dock panel.\n */\n export interface IOverlay {\n /**\n * The DOM node for the overlay.\n */\n readonly node: HTMLDivElement;\n\n /**\n * Show the overlay using the given overlay geometry.\n *\n * @param geo - The desired geometry for the overlay.\n *\n * #### Notes\n * The given geometry values assume the node will use absolute\n * positioning.\n *\n * This is called on every mouse move event during a drag in order\n * to update the position of the overlay. It should be efficient.\n */\n show(geo: IOverlayGeometry): void;\n\n /**\n * Hide the overlay node.\n *\n * @param delay - The delay (in ms) before hiding the overlay.\n * A delay value <= 0 should hide the overlay immediately.\n *\n * #### Notes\n * This is called whenever the overlay node should been hidden.\n */\n hide(delay: number): void;\n }\n\n /**\n * A concrete implementation of `IOverlay`.\n *\n * This is the default overlay implementation for a dock panel.\n */\n export class Overlay implements IOverlay {\n /**\n * Construct a new overlay.\n */\n constructor() {\n this.node = document.createElement('div');\n this.node.classList.add('lm-DockPanel-overlay');\n this.node.classList.add('lm-mod-hidden');\n this.node.style.position = 'absolute';\n this.node.style.contain = 'strict';\n }\n\n /**\n * The DOM node for the overlay.\n */\n readonly node: HTMLDivElement;\n\n /**\n * Show the overlay using the given overlay geometry.\n *\n * @param geo - The desired geometry for the overlay.\n */\n show(geo: IOverlayGeometry): void {\n // Update the position of the overlay.\n let style = this.node.style;\n style.top = `${geo.top}px`;\n style.left = `${geo.left}px`;\n style.right = `${geo.right}px`;\n style.bottom = `${geo.bottom}px`;\n\n // Clear any pending hide timer.\n clearTimeout(this._timer);\n this._timer = -1;\n\n // If the overlay is already visible, we're done.\n if (!this._hidden) {\n return;\n }\n\n // Clear the hidden flag.\n this._hidden = false;\n\n // Finally, show the overlay.\n this.node.classList.remove('lm-mod-hidden');\n }\n\n /**\n * Hide the overlay node.\n *\n * @param delay - The delay (in ms) before hiding the overlay.\n * A delay value <= 0 will hide the overlay immediately.\n */\n hide(delay: number): void {\n // Do nothing if the overlay is already hidden.\n if (this._hidden) {\n return;\n }\n\n // Hide immediately if the delay is <= 0.\n if (delay <= 0) {\n clearTimeout(this._timer);\n this._timer = -1;\n this._hidden = true;\n this.node.classList.add('lm-mod-hidden');\n return;\n }\n\n // Do nothing if a hide is already pending.\n if (this._timer !== -1) {\n return;\n }\n\n // Otherwise setup the hide timer.\n this._timer = window.setTimeout(() => {\n this._timer = -1;\n this._hidden = true;\n this.node.classList.add('lm-mod-hidden');\n }, delay);\n }\n\n private _timer = -1;\n private _hidden = true;\n }\n\n /**\n * A type alias for a dock panel renderer;\n */\n export type IRenderer = DockLayout.IRenderer;\n\n /**\n * The default implementation of `IRenderer`.\n */\n export class Renderer implements IRenderer {\n /**\n * Create a new tab bar for use with a dock panel.\n *\n * @returns A new tab bar for a dock panel.\n */\n createTabBar(document?: Document | ShadowRoot): TabBar {\n let bar = new TabBar({ document });\n bar.addClass('lm-DockPanel-tabBar');\n return bar;\n }\n\n /**\n * Create a new handle node for use with a dock panel.\n *\n * @returns A new handle node for a dock panel.\n */\n createHandle(): HTMLDivElement {\n let handle = document.createElement('div');\n handle.className = 'lm-DockPanel-handle';\n return handle;\n }\n }\n\n /**\n * The default `Renderer` instance.\n */\n export const defaultRenderer = new Renderer();\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * A fraction used for sizing root panels; ~= `1 / golden_ratio`.\n */\n export const GOLDEN_RATIO = 0.618;\n\n /**\n * The default sizes for the edge drop zones, in pixels.\n */\n export const DEFAULT_EDGES = {\n /**\n * The size of the top edge dock zone for the root panel, in pixels.\n * This is different from the others to distinguish between the top\n * tab bar and the top root zone.\n */\n top: 12,\n\n /**\n * The size of the edge dock zone for the root panel, in pixels.\n */\n right: 40,\n\n /**\n * The size of the edge dock zone for the root panel, in pixels.\n */\n bottom: 40,\n\n /**\n * The size of the edge dock zone for the root panel, in pixels.\n */\n left: 40\n };\n\n /**\n * A singleton `'layout-modified'` conflatable message.\n */\n export const LayoutModified = new ConflatableMessage('layout-modified');\n\n /**\n * An object which holds mouse press data.\n */\n export interface IPressData {\n /**\n * The handle which was pressed.\n */\n handle: HTMLDivElement;\n\n /**\n * The X offset of the press in handle coordinates.\n */\n deltaX: number;\n\n /**\n * The Y offset of the press in handle coordinates.\n */\n deltaY: number;\n\n /**\n * The disposable which will clear the override cursor.\n */\n override: IDisposable;\n }\n\n /**\n * A type alias for a drop zone.\n */\n export type DropZone =\n | /**\n * An invalid drop zone.\n */\n 'invalid'\n\n /**\n * The entirety of the root dock area.\n */\n | 'root-all'\n\n /**\n * The top portion of the root dock area.\n */\n | 'root-top'\n\n /**\n * The left portion of the root dock area.\n */\n | 'root-left'\n\n /**\n * The right portion of the root dock area.\n */\n | 'root-right'\n\n /**\n * The bottom portion of the root dock area.\n */\n | 'root-bottom'\n\n /**\n * The entirety of a tabbed widget area.\n */\n | 'widget-all'\n\n /**\n * The top portion of tabbed widget area.\n */\n | 'widget-top'\n\n /**\n * The left portion of tabbed widget area.\n */\n | 'widget-left'\n\n /**\n * The right portion of tabbed widget area.\n */\n | 'widget-right'\n\n /**\n * The bottom portion of tabbed widget area.\n */\n | 'widget-bottom'\n\n /**\n * The the bar of a tabbed widget area.\n */\n | 'widget-tab';\n\n /**\n * An object which holds the drop target zone and widget.\n */\n export interface IDropTarget {\n /**\n * The semantic zone for the mouse position.\n */\n zone: DropZone;\n\n /**\n * The tab area geometry for the drop zone, or `null`.\n */\n target: DockLayout.ITabAreaGeometry | null;\n }\n\n /**\n * An attached property used to track generated tab bars.\n */\n export const isGeneratedTabBarProperty = new AttachedProperty<\n Widget,\n boolean\n >({\n name: 'isGeneratedTabBar',\n create: () => false\n });\n\n /**\n * Create a single document config for the widgets in a dock panel.\n */\n export function createSingleDocumentConfig(\n panel: DockPanel\n ): DockPanel.ILayoutConfig {\n // Return an empty config if the panel is empty.\n if (panel.isEmpty) {\n return { main: null };\n }\n\n // Get a flat array of the widgets in the panel.\n let widgets = Array.from(panel.widgets());\n\n // Get the first selected widget in the panel.\n let selected = panel.selectedWidgets().next().value;\n\n // Compute the current index for the new config.\n let currentIndex = selected ? widgets.indexOf(selected) : -1;\n\n // Return the single document config.\n return { main: { type: 'tab-area', widgets, currentIndex } };\n }\n\n /**\n * Find the drop target at the given client position.\n */\n export function findDropTarget(\n panel: DockPanel,\n clientX: number,\n clientY: number,\n edges: DockPanel.IEdges\n ): IDropTarget {\n // Bail if the mouse is not over the dock panel.\n if (!ElementExt.hitTest(panel.node, clientX, clientY)) {\n return { zone: 'invalid', target: null };\n }\n\n // Look up the layout for the panel.\n let layout = panel.layout as DockLayout;\n\n // If the layout is empty, indicate the entire root drop zone.\n if (layout.isEmpty) {\n return { zone: 'root-all', target: null };\n }\n\n // Test the edge zones when in multiple document mode.\n if (panel.mode === 'multiple-document') {\n // Get the client rect for the dock panel.\n let panelRect = panel.node.getBoundingClientRect();\n\n // Compute the distance to each edge of the panel.\n let pl = clientX - panelRect.left + 1;\n let pt = clientY - panelRect.top + 1;\n let pr = panelRect.right - clientX;\n let pb = panelRect.bottom - clientY;\n\n // Find the minimum distance to an edge.\n let pd = Math.min(pt, pr, pb, pl);\n\n // Return a root zone if the mouse is within an edge.\n switch (pd) {\n case pt:\n if (pt < edges.top) {\n return { zone: 'root-top', target: null };\n }\n break;\n case pr:\n if (pr < edges.right) {\n return { zone: 'root-right', target: null };\n }\n break;\n case pb:\n if (pb < edges.bottom) {\n return { zone: 'root-bottom', target: null };\n }\n break;\n case pl:\n if (pl < edges.left) {\n return { zone: 'root-left', target: null };\n }\n break;\n default:\n throw 'unreachable';\n }\n }\n\n // Hit test the dock layout at the given client position.\n let target = layout.hitTestTabAreas(clientX, clientY);\n\n // Bail if no target area was found.\n if (!target) {\n return { zone: 'invalid', target: null };\n }\n\n // Return the whole tab area when in single document mode.\n if (panel.mode === 'single-document') {\n return { zone: 'widget-all', target };\n }\n\n // Compute the distance to each edge of the tab area.\n let al = target.x - target.left + 1;\n let at = target.y - target.top + 1;\n let ar = target.left + target.width - target.x;\n let ab = target.top + target.height - target.y;\n\n const tabHeight = target.tabBar.node.getBoundingClientRect().height;\n if (at < tabHeight) {\n return { zone: 'widget-tab', target };\n }\n\n // Get the X and Y edge sizes for the area.\n let rx = Math.round(target.width / 3);\n let ry = Math.round(target.height / 3);\n\n // If the mouse is not within an edge, indicate the entire area.\n if (al > rx && ar > rx && at > ry && ab > ry) {\n return { zone: 'widget-all', target };\n }\n\n // Scale the distances by the slenderness ratio.\n al /= rx;\n at /= ry;\n ar /= rx;\n ab /= ry;\n\n // Find the minimum distance to the area edge.\n let ad = Math.min(al, at, ar, ab);\n\n // Find the widget zone for the area edge.\n let zone: DropZone;\n switch (ad) {\n case al:\n zone = 'widget-left';\n break;\n case at:\n zone = 'widget-top';\n break;\n case ar:\n zone = 'widget-right';\n break;\n case ab:\n zone = 'widget-bottom';\n break;\n default:\n throw 'unreachable';\n }\n\n // Return the final drop target.\n return { zone, target };\n }\n\n /**\n * Get the drop reference widget for a tab bar.\n */\n export function getDropRef(tabBar: TabBar): Widget | null {\n if (tabBar.titles.length === 0) {\n return null;\n }\n if (tabBar.currentTitle) {\n return tabBar.currentTitle.owner;\n }\n return tabBar.titles[tabBar.titles.length - 1].owner;\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt, find, max } from '@lumino/algorithm';\n\nimport { IDisposable } from '@lumino/disposable';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { Widget } from './widget';\n\n/**\n * A class which tracks focus among a set of widgets.\n *\n * This class is useful when code needs to keep track of the most\n * recently focused widget(s) among a set of related widgets.\n */\nexport class FocusTracker implements IDisposable {\n /**\n * Dispose of the resources held by the tracker.\n */\n dispose(): void {\n // Do nothing if the tracker is already disposed.\n if (this._counter < 0) {\n return;\n }\n\n // Mark the tracker as disposed.\n this._counter = -1;\n\n // Clear the connections for the tracker.\n Signal.clearData(this);\n\n // Remove all event listeners.\n for (const widget of this._widgets) {\n widget.node.removeEventListener('focus', this, true);\n widget.node.removeEventListener('blur', this, true);\n }\n\n // Clear the internal data structures.\n this._activeWidget = null;\n this._currentWidget = null;\n this._nodes.clear();\n this._numbers.clear();\n this._widgets.length = 0;\n }\n\n /**\n * A signal emitted when the current widget has changed.\n */\n get currentChanged(): ISignal> {\n return this._currentChanged;\n }\n\n /**\n * A signal emitted when the active widget has changed.\n */\n get activeChanged(): ISignal> {\n return this._activeChanged;\n }\n\n /**\n * A flag indicating whether the tracker is disposed.\n */\n get isDisposed(): boolean {\n return this._counter < 0;\n }\n\n /**\n * The current widget in the tracker.\n *\n * #### Notes\n * The current widget is the widget among the tracked widgets which\n * has the *descendant node* which has most recently been focused.\n *\n * The current widget will not be updated if the node loses focus. It\n * will only be updated when a different tracked widget gains focus.\n *\n * If the current widget is removed from the tracker, the previous\n * current widget will be restored.\n *\n * This behavior is intended to follow a user's conceptual model of\n * a semantically \"current\" widget, where the \"last thing of type X\"\n * to be interacted with is the \"current instance of X\", regardless\n * of whether that instance still has focus.\n */\n get currentWidget(): T | null {\n return this._currentWidget;\n }\n\n /**\n * The active widget in the tracker.\n *\n * #### Notes\n * The active widget is the widget among the tracked widgets which\n * has the *descendant node* which is currently focused.\n */\n get activeWidget(): T | null {\n return this._activeWidget;\n }\n\n /**\n * A read only array of the widgets being tracked.\n */\n get widgets(): ReadonlyArray {\n return this._widgets;\n }\n\n /**\n * Get the focus number for a particular widget in the tracker.\n *\n * @param widget - The widget of interest.\n *\n * @returns The focus number for the given widget, or `-1` if the\n * widget has not had focus since being added to the tracker, or\n * is not contained by the tracker.\n *\n * #### Notes\n * The focus number indicates the relative order in which the widgets\n * have gained focus. A widget with a larger number has gained focus\n * more recently than a widget with a smaller number.\n *\n * The `currentWidget` will always have the largest focus number.\n *\n * All widgets start with a focus number of `-1`, which indicates that\n * the widget has not been focused since being added to the tracker.\n */\n focusNumber(widget: T): number {\n let n = this._numbers.get(widget);\n return n === undefined ? -1 : n;\n }\n\n /**\n * Test whether the focus tracker contains a given widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns `true` if the widget is tracked, `false` otherwise.\n */\n has(widget: T): boolean {\n return this._numbers.has(widget);\n }\n\n /**\n * Add a widget to the focus tracker.\n *\n * @param widget - The widget of interest.\n *\n * #### Notes\n * A widget will be automatically removed from the tracker if it\n * is disposed after being added.\n *\n * If the widget is already tracked, this is a no-op.\n */\n add(widget: T): void {\n // Do nothing if the widget is already tracked.\n if (this._numbers.has(widget)) {\n return;\n }\n\n // Test whether the widget has focus.\n let focused = widget.node.contains(document.activeElement);\n\n // Set up the initial focus number.\n let n = focused ? this._counter++ : -1;\n\n // Add the widget to the internal data structures.\n this._widgets.push(widget);\n this._numbers.set(widget, n);\n this._nodes.set(widget.node, widget);\n\n // Set up the event listeners. The capturing phase must be used\n // since the 'focus' and 'blur' events don't bubble and Firefox\n // doesn't support the 'focusin' or 'focusout' events.\n widget.node.addEventListener('focus', this, true);\n widget.node.addEventListener('blur', this, true);\n\n // Connect the disposed signal handler.\n widget.disposed.connect(this._onWidgetDisposed, this);\n\n // Set the current and active widgets if needed.\n if (focused) {\n this._setWidgets(widget, widget);\n }\n }\n\n /**\n * Remove a widget from the focus tracker.\n *\n * #### Notes\n * If the widget is the `currentWidget`, the previous current widget\n * will become the new `currentWidget`.\n *\n * A widget will be automatically removed from the tracker if it\n * is disposed after being added.\n *\n * If the widget is not tracked, this is a no-op.\n */\n remove(widget: T): void {\n // Bail early if the widget is not tracked.\n if (!this._numbers.has(widget)) {\n return;\n }\n\n // Disconnect the disposed signal handler.\n widget.disposed.disconnect(this._onWidgetDisposed, this);\n\n // Remove the event listeners.\n widget.node.removeEventListener('focus', this, true);\n widget.node.removeEventListener('blur', this, true);\n\n // Remove the widget from the internal data structures.\n ArrayExt.removeFirstOf(this._widgets, widget);\n this._nodes.delete(widget.node);\n this._numbers.delete(widget);\n\n // Bail early if the widget is not the current widget.\n if (this._currentWidget !== widget) {\n return;\n }\n\n // Filter the widgets for those which have had focus.\n let valid = this._widgets.filter(w => this._numbers.get(w) !== -1);\n\n // Get the valid widget with the max focus number.\n let previous =\n max(valid, (first, second) => {\n let a = this._numbers.get(first)!;\n let b = this._numbers.get(second)!;\n return a - b;\n }) || null;\n\n // Set the current and active widgets.\n this._setWidgets(previous, null);\n }\n\n /**\n * Handle the DOM events for the focus tracker.\n *\n * @param event - The DOM event sent to the panel.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the tracked nodes. It should\n * not be called directly by user code.\n */\n handleEvent(event: Event): void {\n switch (event.type) {\n case 'focus':\n this._evtFocus(event as FocusEvent);\n break;\n case 'blur':\n this._evtBlur(event as FocusEvent);\n break;\n }\n }\n\n /**\n * Set the current and active widgets for the tracker.\n */\n private _setWidgets(current: T | null, active: T | null): void {\n // Swap the current widget.\n let oldCurrent = this._currentWidget;\n this._currentWidget = current;\n\n // Swap the active widget.\n let oldActive = this._activeWidget;\n this._activeWidget = active;\n\n // Emit the `currentChanged` signal if needed.\n if (oldCurrent !== current) {\n this._currentChanged.emit({ oldValue: oldCurrent, newValue: current });\n }\n\n // Emit the `activeChanged` signal if needed.\n if (oldActive !== active) {\n this._activeChanged.emit({ oldValue: oldActive, newValue: active });\n }\n }\n\n /**\n * Handle the `'focus'` event for a tracked widget.\n */\n private _evtFocus(event: FocusEvent): void {\n // Find the widget which gained focus, which is known to exist.\n let widget = this._nodes.get(event.currentTarget as HTMLElement)!;\n\n // Update the focus number if necessary.\n if (widget !== this._currentWidget) {\n this._numbers.set(widget, this._counter++);\n }\n\n // Set the current and active widgets.\n this._setWidgets(widget, widget);\n }\n\n /**\n * Handle the `'blur'` event for a tracked widget.\n */\n private _evtBlur(event: FocusEvent): void {\n // Find the widget which lost focus, which is known to exist.\n let widget = this._nodes.get(event.currentTarget as HTMLElement)!;\n\n // Get the node which being focused after this blur.\n let focusTarget = event.relatedTarget as HTMLElement;\n\n // If no other node is being focused, clear the active widget.\n if (!focusTarget) {\n this._setWidgets(this._currentWidget, null);\n return;\n }\n\n // Bail if the focus widget is not changing.\n if (widget.node.contains(focusTarget)) {\n return;\n }\n\n // If no tracked widget is being focused, clear the active widget.\n if (!find(this._widgets, w => w.node.contains(focusTarget))) {\n this._setWidgets(this._currentWidget, null);\n return;\n }\n }\n\n /**\n * Handle the `disposed` signal for a tracked widget.\n */\n private _onWidgetDisposed(sender: T): void {\n this.remove(sender);\n }\n\n private _counter = 0;\n private _widgets: T[] = [];\n private _activeWidget: T | null = null;\n private _currentWidget: T | null = null;\n private _numbers = new Map();\n private _nodes = new Map();\n private _activeChanged = new Signal>(this);\n private _currentChanged = new Signal>(\n this\n );\n}\n\n/**\n * The namespace for the `FocusTracker` class statics.\n */\nexport namespace FocusTracker {\n /**\n * An arguments object for the changed signals.\n */\n export interface IChangedArgs {\n /**\n * The old value for the widget.\n */\n oldValue: T | null;\n\n /**\n * The new value for the widget.\n */\n newValue: T | null;\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { AttachedProperty } from '@lumino/properties';\n\nimport { BoxEngine, BoxSizer } from './boxengine';\n\nimport { Layout, LayoutItem } from './layout';\n\nimport { Widget } from './widget';\n\n/**\n * A layout which arranges its widgets in a grid.\n */\nexport class GridLayout extends Layout {\n /**\n * Construct a new grid layout.\n *\n * @param options - The options for initializing the layout.\n */\n constructor(options: GridLayout.IOptions = {}) {\n super(options);\n if (options.rowCount !== undefined) {\n Private.reallocSizers(this._rowSizers, options.rowCount);\n }\n if (options.columnCount !== undefined) {\n Private.reallocSizers(this._columnSizers, options.columnCount);\n }\n if (options.rowSpacing !== undefined) {\n this._rowSpacing = Private.clampValue(options.rowSpacing);\n }\n if (options.columnSpacing !== undefined) {\n this._columnSpacing = Private.clampValue(options.columnSpacing);\n }\n }\n\n /**\n * Dispose of the resources held by the layout.\n */\n dispose(): void {\n // Dispose of the widgets and layout items.\n for (const item of this._items) {\n let widget = item.widget;\n item.dispose();\n widget.dispose();\n }\n\n // Clear the layout state.\n this._box = null;\n this._items.length = 0;\n this._rowStarts.length = 0;\n this._rowSizers.length = 0;\n this._columnStarts.length = 0;\n this._columnSizers.length = 0;\n\n // Dispose of the rest of the layout.\n super.dispose();\n }\n\n /**\n * Get the number of rows in the layout.\n */\n get rowCount(): number {\n return this._rowSizers.length;\n }\n\n /**\n * Set the number of rows in the layout.\n *\n * #### Notes\n * The minimum row count is `1`.\n */\n set rowCount(value: number) {\n // Do nothing if the row count does not change.\n if (value === this.rowCount) {\n return;\n }\n\n // Reallocate the row sizers.\n Private.reallocSizers(this._rowSizers, value);\n\n // Schedule a fit of the parent.\n if (this.parent) {\n this.parent.fit();\n }\n }\n\n /**\n * Get the number of columns in the layout.\n */\n get columnCount(): number {\n return this._columnSizers.length;\n }\n\n /**\n * Set the number of columns in the layout.\n *\n * #### Notes\n * The minimum column count is `1`.\n */\n set columnCount(value: number) {\n // Do nothing if the column count does not change.\n if (value === this.columnCount) {\n return;\n }\n\n // Reallocate the column sizers.\n Private.reallocSizers(this._columnSizers, value);\n\n // Schedule a fit of the parent.\n if (this.parent) {\n this.parent.fit();\n }\n }\n\n /**\n * Get the row spacing for the layout.\n */\n get rowSpacing(): number {\n return this._rowSpacing;\n }\n\n /**\n * Set the row spacing for the layout.\n */\n set rowSpacing(value: number) {\n // Clamp the spacing to the allowed range.\n value = Private.clampValue(value);\n\n // Bail if the spacing does not change\n if (this._rowSpacing === value) {\n return;\n }\n\n // Update the internal spacing.\n this._rowSpacing = value;\n\n // Schedule a fit of the parent.\n if (this.parent) {\n this.parent.fit();\n }\n }\n\n /**\n * Get the column spacing for the layout.\n */\n get columnSpacing(): number {\n return this._columnSpacing;\n }\n\n /**\n * Set the col spacing for the layout.\n */\n set columnSpacing(value: number) {\n // Clamp the spacing to the allowed range.\n value = Private.clampValue(value);\n\n // Bail if the spacing does not change\n if (this._columnSpacing === value) {\n return;\n }\n\n // Update the internal spacing.\n this._columnSpacing = value;\n\n // Schedule a fit of the parent.\n if (this.parent) {\n this.parent.fit();\n }\n }\n\n /**\n * Get the stretch factor for a specific row.\n *\n * @param index - The row index of interest.\n *\n * @returns The stretch factor for the row.\n *\n * #### Notes\n * This returns `-1` if the index is out of range.\n */\n rowStretch(index: number): number {\n let sizer = this._rowSizers[index];\n return sizer ? sizer.stretch : -1;\n }\n\n /**\n * Set the stretch factor for a specific row.\n *\n * @param index - The row index of interest.\n *\n * @param value - The stretch factor for the row.\n *\n * #### Notes\n * This is a no-op if the index is out of range.\n */\n setRowStretch(index: number, value: number): void {\n // Look up the row sizer.\n let sizer = this._rowSizers[index];\n\n // Bail if the index is out of range.\n if (!sizer) {\n return;\n }\n\n // Clamp the value to the allowed range.\n value = Private.clampValue(value);\n\n // Bail if the stretch does not change.\n if (sizer.stretch === value) {\n return;\n }\n\n // Update the sizer stretch.\n sizer.stretch = value;\n\n // Schedule an update of the parent.\n if (this.parent) {\n this.parent.update();\n }\n }\n\n /**\n * Get the stretch factor for a specific column.\n *\n * @param index - The column index of interest.\n *\n * @returns The stretch factor for the column.\n *\n * #### Notes\n * This returns `-1` if the index is out of range.\n */\n columnStretch(index: number): number {\n let sizer = this._columnSizers[index];\n return sizer ? sizer.stretch : -1;\n }\n\n /**\n * Set the stretch factor for a specific column.\n *\n * @param index - The column index of interest.\n *\n * @param value - The stretch factor for the column.\n *\n * #### Notes\n * This is a no-op if the index is out of range.\n */\n setColumnStretch(index: number, value: number): void {\n // Look up the column sizer.\n let sizer = this._columnSizers[index];\n\n // Bail if the index is out of range.\n if (!sizer) {\n return;\n }\n\n // Clamp the value to the allowed range.\n value = Private.clampValue(value);\n\n // Bail if the stretch does not change.\n if (sizer.stretch === value) {\n return;\n }\n\n // Update the sizer stretch.\n sizer.stretch = value;\n\n // Schedule an update of the parent.\n if (this.parent) {\n this.parent.update();\n }\n }\n\n /**\n * Create an iterator over the widgets in the layout.\n *\n * @returns A new iterator over the widgets in the layout.\n */\n *[Symbol.iterator](): IterableIterator {\n for (const item of this._items) {\n yield item.widget;\n }\n }\n\n /**\n * Add a widget to the grid layout.\n *\n * @param widget - The widget to add to the layout.\n *\n * #### Notes\n * If the widget is already contained in the layout, this is no-op.\n */\n addWidget(widget: Widget): void {\n // Look up the index for the widget.\n let i = ArrayExt.findFirstIndex(this._items, it => it.widget === widget);\n\n // Bail if the widget is already in the layout.\n if (i !== -1) {\n return;\n }\n\n // Add the widget to the layout.\n this._items.push(new LayoutItem(widget));\n\n // Attach the widget to the parent.\n if (this.parent) {\n this.attachWidget(widget);\n }\n }\n\n /**\n * Remove a widget from the grid layout.\n *\n * @param widget - The widget to remove from the layout.\n *\n * #### Notes\n * A widget is automatically removed from the layout when its `parent`\n * is set to `null`. This method should only be invoked directly when\n * removing a widget from a layout which has yet to be installed on a\n * parent widget.\n *\n * This method does *not* modify the widget's `parent`.\n */\n removeWidget(widget: Widget): void {\n // Look up the index for the widget.\n let i = ArrayExt.findFirstIndex(this._items, it => it.widget === widget);\n\n // Bail if the widget is not in the layout.\n if (i === -1) {\n return;\n }\n\n // Remove the widget from the layout.\n let item = ArrayExt.removeAt(this._items, i)!;\n\n // Detach the widget from the parent.\n if (this.parent) {\n this.detachWidget(widget);\n }\n\n // Dispose the layout item.\n item.dispose();\n }\n\n /**\n * Perform layout initialization which requires the parent widget.\n */\n protected init(): void {\n super.init();\n for (const widget of this) {\n this.attachWidget(widget);\n }\n }\n\n /**\n * Attach a widget to the parent's DOM node.\n *\n * @param widget - The widget to attach to the parent.\n */\n protected attachWidget(widget: Widget): void {\n // Send a `'before-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n }\n\n // Add the widget's node to the parent.\n this.parent!.node.appendChild(widget.node);\n\n // Send an `'after-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n\n // Post a fit request for the parent widget.\n this.parent!.fit();\n }\n\n /**\n * Detach a widget from the parent's DOM node.\n *\n * @param widget - The widget to detach from the parent.\n */\n protected detachWidget(widget: Widget): void {\n // Send a `'before-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n }\n\n // Remove the widget's node from the parent.\n this.parent!.node.removeChild(widget.node);\n\n // Send an `'after-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n\n // Post a fit request for the parent widget.\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'before-show'` message.\n */\n protected onBeforeShow(msg: Message): void {\n super.onBeforeShow(msg);\n this.parent!.update();\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n super.onBeforeAttach(msg);\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-shown'` message.\n */\n protected onChildShown(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-hidden'` message.\n */\n protected onChildHidden(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'resize'` message.\n */\n protected onResize(msg: Widget.ResizeMessage): void {\n if (this.parent!.isVisible) {\n this._update(msg.width, msg.height);\n }\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n protected onUpdateRequest(msg: Message): void {\n if (this.parent!.isVisible) {\n this._update(-1, -1);\n }\n }\n\n /**\n * A message handler invoked on a `'fit-request'` message.\n */\n protected onFitRequest(msg: Message): void {\n if (this.parent!.isAttached) {\n this._fit();\n }\n }\n\n /**\n * Fit the layout to the total size required by the widgets.\n */\n private _fit(): void {\n // Reset the min sizes of the sizers.\n for (let i = 0, n = this.rowCount; i < n; ++i) {\n this._rowSizers[i].minSize = 0;\n }\n for (let i = 0, n = this.columnCount; i < n; ++i) {\n this._columnSizers[i].minSize = 0;\n }\n\n // Filter for the visible layout items.\n let items = this._items.filter(it => !it.isHidden);\n\n // Fit the layout items.\n for (let i = 0, n = items.length; i < n; ++i) {\n items[i].fit();\n }\n\n // Get the max row and column index.\n let maxRow = this.rowCount - 1;\n let maxCol = this.columnCount - 1;\n\n // Sort the items by row span.\n items.sort(Private.rowSpanCmp);\n\n // Update the min sizes of the row sizers.\n for (let i = 0, n = items.length; i < n; ++i) {\n // Fetch the item.\n let item = items[i];\n\n // Get the row bounds for the item.\n let config = GridLayout.getCellConfig(item.widget);\n let r1 = Math.min(config.row, maxRow);\n let r2 = Math.min(config.row + config.rowSpan - 1, maxRow);\n\n // Distribute the minimum height to the sizers as needed.\n Private.distributeMin(this._rowSizers, r1, r2, item.minHeight);\n }\n\n // Sort the items by column span.\n items.sort(Private.columnSpanCmp);\n\n // Update the min sizes of the column sizers.\n for (let i = 0, n = items.length; i < n; ++i) {\n // Fetch the item.\n let item = items[i];\n\n // Get the column bounds for the item.\n let config = GridLayout.getCellConfig(item.widget);\n let c1 = Math.min(config.column, maxCol);\n let c2 = Math.min(config.column + config.columnSpan - 1, maxCol);\n\n // Distribute the minimum width to the sizers as needed.\n Private.distributeMin(this._columnSizers, c1, c2, item.minWidth);\n }\n\n // If no size constraint is needed, just update the parent.\n if (this.fitPolicy === 'set-no-constraint') {\n MessageLoop.sendMessage(this.parent!, Widget.Msg.UpdateRequest);\n return;\n }\n\n // Set up the computed min size.\n let minH = maxRow * this._rowSpacing;\n let minW = maxCol * this._columnSpacing;\n\n // Add the sizer minimums to the computed min size.\n for (let i = 0, n = this.rowCount; i < n; ++i) {\n minH += this._rowSizers[i].minSize;\n }\n for (let i = 0, n = this.columnCount; i < n; ++i) {\n minW += this._columnSizers[i].minSize;\n }\n\n // Update the box sizing and add it to the computed min size.\n let box = (this._box = ElementExt.boxSizing(this.parent!.node));\n minW += box.horizontalSum;\n minH += box.verticalSum;\n\n // Update the parent's min size constraints.\n let style = this.parent!.node.style;\n style.minWidth = `${minW}px`;\n style.minHeight = `${minH}px`;\n\n // Set the dirty flag to ensure only a single update occurs.\n this._dirty = true;\n\n // Notify the ancestor that it should fit immediately. This may\n // cause a resize of the parent, fulfilling the required update.\n if (this.parent!.parent) {\n MessageLoop.sendMessage(this.parent!.parent!, Widget.Msg.FitRequest);\n }\n\n // If the dirty flag is still set, the parent was not resized.\n // Trigger the required update on the parent widget immediately.\n if (this._dirty) {\n MessageLoop.sendMessage(this.parent!, Widget.Msg.UpdateRequest);\n }\n }\n\n /**\n * Update the layout position and size of the widgets.\n *\n * The parent offset dimensions should be `-1` if unknown.\n */\n private _update(offsetWidth: number, offsetHeight: number): void {\n // Clear the dirty flag to indicate the update occurred.\n this._dirty = false;\n\n // Measure the parent if the offset dimensions are unknown.\n if (offsetWidth < 0) {\n offsetWidth = this.parent!.node.offsetWidth;\n }\n if (offsetHeight < 0) {\n offsetHeight = this.parent!.node.offsetHeight;\n }\n\n // Ensure the parent box sizing data is computed.\n if (!this._box) {\n this._box = ElementExt.boxSizing(this.parent!.node);\n }\n\n // Compute the layout area adjusted for border and padding.\n let top = this._box.paddingTop;\n let left = this._box.paddingLeft;\n let width = offsetWidth - this._box.horizontalSum;\n let height = offsetHeight - this._box.verticalSum;\n\n // Get the max row and column index.\n let maxRow = this.rowCount - 1;\n let maxCol = this.columnCount - 1;\n\n // Compute the total fixed row and column space.\n let fixedRowSpace = maxRow * this._rowSpacing;\n let fixedColSpace = maxCol * this._columnSpacing;\n\n // Distribute the available space to the box sizers.\n BoxEngine.calc(this._rowSizers, Math.max(0, height - fixedRowSpace));\n BoxEngine.calc(this._columnSizers, Math.max(0, width - fixedColSpace));\n\n // Update the row start positions.\n for (let i = 0, pos = top, n = this.rowCount; i < n; ++i) {\n this._rowStarts[i] = pos;\n pos += this._rowSizers[i].size + this._rowSpacing;\n }\n\n // Update the column start positions.\n for (let i = 0, pos = left, n = this.columnCount; i < n; ++i) {\n this._columnStarts[i] = pos;\n pos += this._columnSizers[i].size + this._columnSpacing;\n }\n\n // Update the geometry of the layout items.\n for (let i = 0, n = this._items.length; i < n; ++i) {\n // Fetch the item.\n let item = this._items[i];\n\n // Ignore hidden items.\n if (item.isHidden) {\n continue;\n }\n\n // Fetch the cell bounds for the widget.\n let config = GridLayout.getCellConfig(item.widget);\n let r1 = Math.min(config.row, maxRow);\n let c1 = Math.min(config.column, maxCol);\n let r2 = Math.min(config.row + config.rowSpan - 1, maxRow);\n let c2 = Math.min(config.column + config.columnSpan - 1, maxCol);\n\n // Compute the cell geometry.\n let x = this._columnStarts[c1];\n let y = this._rowStarts[r1];\n let w = this._columnStarts[c2] + this._columnSizers[c2].size - x;\n let h = this._rowStarts[r2] + this._rowSizers[r2].size - y;\n\n // Update the geometry of the layout item.\n item.update(x, y, w, h);\n }\n }\n\n private _dirty = false;\n private _rowSpacing = 4;\n private _columnSpacing = 4;\n private _items: LayoutItem[] = [];\n private _rowStarts: number[] = [];\n private _columnStarts: number[] = [];\n private _rowSizers: BoxSizer[] = [new BoxSizer()];\n private _columnSizers: BoxSizer[] = [new BoxSizer()];\n private _box: ElementExt.IBoxSizing | null = null;\n}\n\n/**\n * The namespace for the `GridLayout` class statics.\n */\nexport namespace GridLayout {\n /**\n * An options object for initializing a grid layout.\n */\n export interface IOptions extends Layout.IOptions {\n /**\n * The initial row count for the layout.\n *\n * The default is `1`.\n */\n rowCount?: number;\n\n /**\n * The initial column count for the layout.\n *\n * The default is `1`.\n */\n columnCount?: number;\n\n /**\n * The spacing between rows in the layout.\n *\n * The default is `4`.\n */\n rowSpacing?: number;\n\n /**\n * The spacing between columns in the layout.\n *\n * The default is `4`.\n */\n columnSpacing?: number;\n }\n\n /**\n * An object which holds the cell configuration for a widget.\n */\n export interface ICellConfig {\n /**\n * The row index for the widget.\n */\n readonly row: number;\n\n /**\n * The column index for the widget.\n */\n readonly column: number;\n\n /**\n * The row span for the widget.\n */\n readonly rowSpan: number;\n\n /**\n * The column span for the widget.\n */\n readonly columnSpan: number;\n }\n\n /**\n * Get the cell config for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The cell config for the widget.\n */\n export function getCellConfig(widget: Widget): ICellConfig {\n return Private.cellConfigProperty.get(widget);\n }\n\n /**\n * Set the cell config for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the cell config.\n */\n export function setCellConfig(\n widget: Widget,\n value: Partial\n ): void {\n Private.cellConfigProperty.set(widget, Private.normalizeConfig(value));\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * The property descriptor for the widget cell config.\n */\n export const cellConfigProperty = new AttachedProperty<\n Widget,\n GridLayout.ICellConfig\n >({\n name: 'cellConfig',\n create: () => ({ row: 0, column: 0, rowSpan: 1, columnSpan: 1 }),\n changed: onChildCellConfigChanged\n });\n\n /**\n * Normalize a partial cell config object.\n */\n export function normalizeConfig(\n config: Partial\n ): GridLayout.ICellConfig {\n let row = Math.max(0, Math.floor(config.row || 0));\n let column = Math.max(0, Math.floor(config.column || 0));\n let rowSpan = Math.max(1, Math.floor(config.rowSpan || 0));\n let columnSpan = Math.max(1, Math.floor(config.columnSpan || 0));\n return { row, column, rowSpan, columnSpan };\n }\n\n /**\n * Clamp a value to an integer >= 0.\n */\n export function clampValue(value: number): number {\n return Math.max(0, Math.floor(value));\n }\n\n /**\n * A sort comparison function for row spans.\n */\n export function rowSpanCmp(a: LayoutItem, b: LayoutItem): number {\n let c1 = cellConfigProperty.get(a.widget);\n let c2 = cellConfigProperty.get(b.widget);\n return c1.rowSpan - c2.rowSpan;\n }\n\n /**\n * A sort comparison function for column spans.\n */\n export function columnSpanCmp(a: LayoutItem, b: LayoutItem): number {\n let c1 = cellConfigProperty.get(a.widget);\n let c2 = cellConfigProperty.get(b.widget);\n return c1.columnSpan - c2.columnSpan;\n }\n\n /**\n * Reallocate the box sizers for the given grid dimensions.\n */\n export function reallocSizers(sizers: BoxSizer[], count: number): void {\n // Coerce the count to the valid range.\n count = Math.max(1, Math.floor(count));\n\n // Add the missing sizers.\n while (sizers.length < count) {\n sizers.push(new BoxSizer());\n }\n\n // Remove the extra sizers.\n if (sizers.length > count) {\n sizers.length = count;\n }\n }\n\n /**\n * Distribute a min size constraint across a range of sizers.\n */\n export function distributeMin(\n sizers: BoxSizer[],\n i1: number,\n i2: number,\n minSize: number\n ): void {\n // Sanity check the indices.\n if (i2 < i1) {\n return;\n }\n\n // Handle the simple case of no cell span.\n if (i1 === i2) {\n let sizer = sizers[i1];\n sizer.minSize = Math.max(sizer.minSize, minSize);\n return;\n }\n\n // Compute the total current min size of the span.\n let totalMin = 0;\n for (let i = i1; i <= i2; ++i) {\n totalMin += sizers[i].minSize;\n }\n\n // Do nothing if the total is greater than the required.\n if (totalMin >= minSize) {\n return;\n }\n\n // Compute the portion of the space to allocate to each sizer.\n let portion = (minSize - totalMin) / (i2 - i1 + 1);\n\n // Add the portion to each sizer.\n for (let i = i1; i <= i2; ++i) {\n sizers[i].minSize += portion;\n }\n }\n\n /**\n * The change handler for the child cell config property.\n */\n function onChildCellConfigChanged(child: Widget): void {\n if (child.parent && child.parent.layout instanceof GridLayout) {\n child.parent.fit();\n }\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { getKeyboardLayout } from '@lumino/keyboard';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { CommandRegistry } from '@lumino/commands';\n\nimport {\n ElementARIAAttrs,\n ElementDataset,\n h,\n VirtualDOM,\n VirtualElement\n} from '@lumino/virtualdom';\n\nimport { Menu } from './menu';\n\nimport { Title } from './title';\n\nimport { Widget } from './widget';\n\n/**\n * A widget which displays menus as a canonical menu bar.\n *\n * #### Notes\n * See also the related [example](../../examples/menubar/index.html) and\n * its [source](https://github.com/jupyterlab/lumino/tree/main/examples/example-menubar).\n */\nexport class MenuBar extends Widget {\n /**\n * Construct a new menu bar.\n *\n * @param options - The options for initializing the menu bar.\n */\n constructor(options: MenuBar.IOptions = {}) {\n super({ node: Private.createNode() });\n this.addClass('lm-MenuBar');\n this.setFlag(Widget.Flag.DisallowLayout);\n this.renderer = options.renderer || MenuBar.defaultRenderer;\n this._forceItemsPosition = options.forceItemsPosition || {\n forceX: true,\n forceY: true\n };\n this._overflowMenuOptions = options.overflowMenuOptions || {\n isVisible: true\n };\n }\n\n /**\n * Dispose of the resources held by the widget.\n */\n dispose(): void {\n this._closeChildMenu();\n this._menus.length = 0;\n super.dispose();\n }\n\n /**\n * The renderer used by the menu bar.\n */\n readonly renderer: MenuBar.IRenderer;\n\n /**\n * The child menu of the menu bar.\n *\n * #### Notes\n * This will be `null` if the menu bar does not have an open menu.\n */\n get childMenu(): Menu | null {\n return this._childMenu;\n }\n\n /**\n * The overflow index of the menu bar.\n */\n get overflowIndex(): number {\n return this._overflowIndex;\n }\n\n /**\n * The overflow menu of the menu bar.\n */\n get overflowMenu(): Menu | null {\n return this._overflowMenu;\n }\n\n /**\n * Get the menu bar content node.\n *\n * #### Notes\n * This is the node which holds the menu title nodes.\n *\n * Modifying this node directly can lead to undefined behavior.\n */\n get contentNode(): HTMLUListElement {\n return this.node.getElementsByClassName(\n 'lm-MenuBar-content'\n )[0] as HTMLUListElement;\n }\n\n /**\n * Get the currently active menu.\n */\n get activeMenu(): Menu | null {\n return this._menus[this._activeIndex] || null;\n }\n\n /**\n * Set the currently active menu.\n *\n * #### Notes\n * If the menu does not exist, the menu will be set to `null`.\n */\n set activeMenu(value: Menu | null) {\n this.activeIndex = value ? this._menus.indexOf(value) : -1;\n }\n\n /**\n * Get the index of the currently active menu.\n *\n * #### Notes\n * This will be `-1` if no menu is active.\n */\n get activeIndex(): number {\n return this._activeIndex;\n }\n\n /**\n * Set the index of the currently active menu.\n *\n * #### Notes\n * If the menu cannot be activated, the index will be set to `-1`.\n */\n set activeIndex(value: number) {\n // Adjust the value for an out of range index.\n if (value < 0 || value >= this._menus.length) {\n value = -1;\n }\n\n // An empty menu cannot be active\n if (value > -1 && this._menus[value].items.length === 0) {\n value = -1;\n }\n\n // Bail early if the index will not change.\n if (this._activeIndex === value) {\n return;\n }\n\n // Update the active index.\n this._activeIndex = value;\n\n // Schedule an update of the items.\n this.update();\n }\n\n /**\n * A read-only array of the menus in the menu bar.\n */\n get menus(): ReadonlyArray {\n return this._menus;\n }\n\n /**\n * Open the active menu and activate its first menu item.\n *\n * #### Notes\n * If there is no active menu, this is a no-op.\n */\n openActiveMenu(): void {\n // Bail early if there is no active item.\n if (this._activeIndex === -1) {\n return;\n }\n\n // Open the child menu.\n this._openChildMenu();\n\n // Activate the first item in the child menu.\n if (this._childMenu) {\n this._childMenu.activeIndex = -1;\n this._childMenu.activateNextItem();\n }\n }\n\n /**\n * Add a menu to the end of the menu bar.\n *\n * @param menu - The menu to add to the menu bar.\n *\n * #### Notes\n * If the menu is already added to the menu bar, it will be moved.\n */\n addMenu(menu: Menu, update: boolean = true): void {\n this.insertMenu(this._menus.length, menu, update);\n }\n\n /**\n * Insert a menu into the menu bar at the specified index.\n *\n * @param index - The index at which to insert the menu.\n *\n * @param menu - The menu to insert into the menu bar.\n *\n * #### Notes\n * The index will be clamped to the bounds of the menus.\n *\n * If the menu is already added to the menu bar, it will be moved.\n */\n insertMenu(index: number, menu: Menu, update: boolean = true): void {\n // Close the child menu before making changes.\n this._closeChildMenu();\n\n // Look up the index of the menu.\n let i = this._menus.indexOf(menu);\n\n // Clamp the insert index to the array bounds.\n let j = Math.max(0, Math.min(index, this._menus.length));\n\n // If the menu is not in the array, insert it.\n if (i === -1) {\n // Insert the menu into the array.\n ArrayExt.insert(this._menus, j, menu);\n\n // Add the styling class to the menu.\n menu.addClass('lm-MenuBar-menu');\n\n // Connect to the menu signals.\n menu.aboutToClose.connect(this._onMenuAboutToClose, this);\n menu.menuRequested.connect(this._onMenuMenuRequested, this);\n menu.title.changed.connect(this._onTitleChanged, this);\n\n // Schedule an update of the items.\n if (update) {\n this.update();\n }\n\n // There is nothing more to do.\n return;\n }\n\n // Otherwise, the menu exists in the array and should be moved.\n\n // Adjust the index if the location is at the end of the array.\n if (j === this._menus.length) {\n j--;\n }\n\n // Bail if there is no effective move.\n if (i === j) {\n return;\n }\n\n // Move the menu to the new locations.\n ArrayExt.move(this._menus, i, j);\n\n // Schedule an update of the items.\n if (update) {\n this.update();\n }\n }\n\n /**\n * Remove a menu from the menu bar.\n *\n * @param menu - The menu to remove from the menu bar.\n *\n * #### Notes\n * This is a no-op if the menu is not in the menu bar.\n */\n removeMenu(menu: Menu, update: boolean = true): void {\n this.removeMenuAt(this._menus.indexOf(menu), update);\n }\n\n /**\n * Remove the menu at a given index from the menu bar.\n *\n * @param index - The index of the menu to remove.\n *\n * #### Notes\n * This is a no-op if the index is out of range.\n */\n removeMenuAt(index: number, update: boolean = true): void {\n // Close the child menu before making changes.\n this._closeChildMenu();\n\n // Remove the menu from the array.\n let menu = ArrayExt.removeAt(this._menus, index);\n\n // Bail if the index is out of range.\n if (!menu) {\n return;\n }\n\n // Disconnect from the menu signals.\n menu.aboutToClose.disconnect(this._onMenuAboutToClose, this);\n menu.menuRequested.disconnect(this._onMenuMenuRequested, this);\n menu.title.changed.disconnect(this._onTitleChanged, this);\n\n // Remove the styling class from the menu.\n menu.removeClass('lm-MenuBar-menu');\n\n // Schedule an update of the items.\n if (update) {\n this.update();\n }\n }\n\n /**\n * Remove all menus from the menu bar.\n */\n clearMenus(): void {\n // Bail if there is nothing to remove.\n if (this._menus.length === 0) {\n return;\n }\n\n // Close the child menu before making changes.\n this._closeChildMenu();\n\n // Disconnect from the menu signals and remove the styling class.\n for (let menu of this._menus) {\n menu.aboutToClose.disconnect(this._onMenuAboutToClose, this);\n menu.menuRequested.disconnect(this._onMenuMenuRequested, this);\n menu.title.changed.disconnect(this._onTitleChanged, this);\n menu.removeClass('lm-MenuBar-menu');\n }\n\n // Clear the menus array.\n this._menus.length = 0;\n\n // Schedule an update of the items.\n this.update();\n }\n\n /**\n * Handle the DOM events for the menu bar.\n *\n * @param event - The DOM event sent to the menu bar.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the menu bar's DOM nodes. It\n * should not be called directly by user code.\n */\n handleEvent(event: Event): void {\n switch (event.type) {\n case 'keydown':\n this._evtKeyDown(event as KeyboardEvent);\n break;\n case 'mousedown':\n this._evtMouseDown(event as MouseEvent);\n break;\n case 'mousemove':\n case 'mouseleave':\n this._evtMouseMove(event as MouseEvent);\n break;\n case 'focusout':\n this._evtFocusOut(event as FocusEvent);\n break;\n case 'contextmenu':\n event.preventDefault();\n event.stopPropagation();\n break;\n }\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n this.node.addEventListener('keydown', this);\n this.node.addEventListener('mousedown', this);\n this.node.addEventListener('mousemove', this);\n this.node.addEventListener('mouseleave', this);\n this.node.addEventListener('focusout', this);\n this.node.addEventListener('contextmenu', this);\n }\n\n /**\n * A message handler invoked on an `'after-detach'` message.\n */\n protected onAfterDetach(msg: Message): void {\n this.node.removeEventListener('keydown', this);\n this.node.removeEventListener('mousedown', this);\n this.node.removeEventListener('mousemove', this);\n this.node.removeEventListener('mouseleave', this);\n this.node.removeEventListener('focusout', this);\n this.node.removeEventListener('contextmenu', this);\n this._closeChildMenu();\n }\n\n /**\n * A message handler invoked on an `'activate-request'` message.\n */\n protected onActivateRequest(msg: Message): void {\n if (this.isAttached) {\n this._focusItemAt(0);\n }\n }\n\n /**\n * A message handler invoked on a `'resize'` message.\n */\n protected onResize(msg: Widget.ResizeMessage): void {\n this.update();\n super.onResize(msg);\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n protected onUpdateRequest(msg: Message): void {\n let menus = this._menus;\n let renderer = this.renderer;\n let activeIndex = this._activeIndex;\n let tabFocusIndex =\n this._tabFocusIndex >= 0 && this._tabFocusIndex < menus.length\n ? this._tabFocusIndex\n : 0;\n let length = this._overflowIndex > -1 ? this._overflowIndex : menus.length;\n let totalMenuSize = 0;\n let isVisible = false;\n\n // Check that the overflow menu doesn't count\n length = this._overflowMenu !== null ? length - 1 : length;\n let content = new Array(length);\n\n // Render visible menus\n for (let i = 0; i < length; ++i) {\n content[i] = renderer.renderItem({\n title: menus[i].title,\n active: i === activeIndex,\n tabbable: i === tabFocusIndex,\n disabled: menus[i].items.length === 0,\n onfocus: () => {\n this._tabFocusIndex = i;\n this.activeIndex = i;\n }\n });\n // Calculate size of current menu\n totalMenuSize += this._menuItemSizes[i];\n // Check if overflow menu is already rendered\n if (menus[i].title.label === this._overflowMenuOptions.title) {\n isVisible = true;\n length--;\n }\n }\n // Render overflow menu if needed and active\n if (this._overflowMenuOptions.isVisible) {\n if (this._overflowIndex > -1 && !isVisible) {\n // Create overflow menu\n if (this._overflowMenu === null) {\n const overflowMenuTitle = this._overflowMenuOptions.title ?? '...';\n this._overflowMenu = new Menu({ commands: new CommandRegistry() });\n this._overflowMenu.title.label = overflowMenuTitle;\n this._overflowMenu.title.mnemonic = 0;\n this.addMenu(this._overflowMenu, false);\n }\n // Move menus to overflow menu\n for (let i = menus.length - 2; i >= length; i--) {\n const submenu = this.menus[i];\n submenu.title.mnemonic = 0;\n this._overflowMenu.insertItem(0, {\n type: 'submenu',\n submenu: submenu\n });\n this.removeMenu(submenu, false);\n }\n content[length] = renderer.renderItem({\n title: this._overflowMenu.title,\n active: length === activeIndex && menus[length].items.length !== 0,\n tabbable: length === tabFocusIndex,\n disabled: menus[length].items.length === 0,\n onfocus: () => {\n this._tabFocusIndex = length;\n this.activeIndex = length;\n }\n });\n length++;\n } else if (this._overflowMenu !== null) {\n // Remove submenus from overflow menu\n let overflowMenuItems = this._overflowMenu.items;\n let screenSize = this.node.offsetWidth;\n let n = this._overflowMenu.items.length;\n for (let i = 0; i < n; ++i) {\n let index = menus.length - 1 - i;\n if (screenSize - totalMenuSize > this._menuItemSizes[index]) {\n let menu = overflowMenuItems[0].submenu as Menu;\n this._overflowMenu.removeItemAt(0);\n this.insertMenu(length, menu, false);\n content[length] = renderer.renderItem({\n title: menu.title,\n active: false,\n tabbable: length === tabFocusIndex,\n disabled: menus[length].items.length === 0,\n onfocus: () => {\n this._tabFocusIndex = length;\n this.activeIndex = length;\n }\n });\n length++;\n }\n }\n if (this._overflowMenu.items.length === 0) {\n this.removeMenu(this._overflowMenu, false);\n content.pop();\n this._overflowMenu = null;\n this._overflowIndex = -1;\n }\n }\n }\n VirtualDOM.render(content, this.contentNode);\n this._updateOverflowIndex();\n }\n\n /**\n * Calculate and update the current overflow index.\n */\n private _updateOverflowIndex(): void {\n if (!this._overflowMenuOptions.isVisible) {\n return;\n }\n\n // Get elements visible in the main menu bar\n const itemMenus = this.contentNode.childNodes;\n let screenSize = this.node.offsetWidth;\n let totalMenuSize = 0;\n let index = -1;\n let n = itemMenus.length;\n\n if (this._menuItemSizes.length == 0) {\n // Check if it is the first resize and get info about menu items sizes\n for (let i = 0; i < n; i++) {\n let item = itemMenus[i] as HTMLLIElement;\n // Add sizes to array\n totalMenuSize += item.offsetWidth;\n this._menuItemSizes.push(item.offsetWidth);\n if (totalMenuSize > screenSize && index === -1) {\n index = i;\n }\n }\n } else {\n // Calculate current menu size\n for (let i = 0; i < this._menuItemSizes.length; i++) {\n totalMenuSize += this._menuItemSizes[i];\n if (totalMenuSize > screenSize) {\n index = i;\n break;\n }\n }\n }\n this._overflowIndex = index;\n }\n\n /**\n * Handle the `'keydown'` event for the menu bar.\n *\n * #### Notes\n * All keys are trapped except the tab key that is ignored.\n */\n private _evtKeyDown(event: KeyboardEvent): void {\n // Fetch the key code for the event.\n let kc = event.keyCode;\n\n // Reset the active index on tab, but do not trap the tab key.\n if (kc === 9) {\n this.activeIndex = -1;\n return;\n }\n\n // A menu bar handles all other keydown events.\n event.preventDefault();\n event.stopPropagation();\n\n // Enter, Space, Up Arrow, Down Arrow\n if (kc === 13 || kc === 32 || kc === 38 || kc === 40) {\n // The active index may have changed (for example, user hovers over an\n // item with the mouse), so be sure to use the focus index.\n this.activeIndex = this._tabFocusIndex;\n if (this.activeIndex !== this._tabFocusIndex) {\n // Bail if the setter refused to set activeIndex to tabFocusIndex\n // because it means that the item at tabFocusIndex cannot be opened (for\n // example, it has an empty menu)\n return;\n }\n this.openActiveMenu();\n return;\n }\n\n // Escape\n if (kc === 27) {\n this._closeChildMenu();\n this._focusItemAt(this.activeIndex);\n return;\n }\n\n // Left or Right Arrow\n if (kc === 37 || kc === 39) {\n let direction = kc === 37 ? -1 : 1;\n let start = this._tabFocusIndex + direction;\n let n = this._menus.length;\n for (let i = 0; i < n; i++) {\n let index = (n + start + direction * i) % n;\n if (this._menus[index].items.length) {\n this._focusItemAt(index);\n return;\n }\n }\n return;\n }\n\n // Get the pressed key character.\n let key = getKeyboardLayout().keyForKeydownEvent(event);\n\n // Bail if the key is not valid.\n if (!key) {\n return;\n }\n\n // Search for the next best matching mnemonic item.\n let start = this._activeIndex + 1;\n let result = Private.findMnemonic(this._menus, key, start);\n\n // Handle the requested mnemonic based on the search results.\n // If exactly one mnemonic is matched, that menu is opened.\n // Otherwise, the next mnemonic is activated if available,\n // followed by the auto mnemonic if available.\n if (result.index !== -1 && !result.multiple) {\n this.activeIndex = result.index;\n this.openActiveMenu();\n } else if (result.index !== -1) {\n this.activeIndex = result.index;\n this._focusItemAt(this.activeIndex);\n } else if (result.auto !== -1) {\n this.activeIndex = result.auto;\n this._focusItemAt(this.activeIndex);\n }\n }\n\n /**\n * Handle the `'mousedown'` event for the menu bar.\n */\n private _evtMouseDown(event: MouseEvent): void {\n // Bail if the mouse press was not on the menu bar. This can occur\n // when the document listener is installed for an active menu bar.\n if (!ElementExt.hitTest(this.node, event.clientX, event.clientY)) {\n return;\n }\n\n // Stop the propagation of the event. Immediate propagation is\n // also stopped so that an open menu does not handle the event.\n event.stopPropagation();\n event.stopImmediatePropagation();\n\n // Check if the mouse is over one of the menu items.\n let index = ArrayExt.findFirstIndex(this.contentNode.children, node => {\n return ElementExt.hitTest(node, event.clientX, event.clientY);\n });\n\n // If the press was not on an item, close the child menu.\n if (index === -1) {\n this._closeChildMenu();\n return;\n }\n\n // If the press was not the left mouse button, do nothing further.\n if (event.button !== 0) {\n return;\n }\n\n // Otherwise, toggle the open state of the child menu.\n if (this._childMenu) {\n this._closeChildMenu();\n this.activeIndex = index;\n } else {\n // If we don't call preventDefault() here, then the item in the menu\n // bar will take focus over the menu that is being opened.\n event.preventDefault();\n const position = this._positionForMenu(index);\n Menu.saveWindowData();\n // Begin DOM modifications.\n this.activeIndex = index;\n this._openChildMenu(position);\n }\n }\n\n /**\n * Handle the `'mousemove'` event for the menu bar.\n */\n private _evtMouseMove(event: MouseEvent): void {\n // Check if the mouse is over one of the menu items.\n let index = ArrayExt.findFirstIndex(this.contentNode.children, node => {\n return ElementExt.hitTest(node, event.clientX, event.clientY);\n });\n\n // Bail early if the active index will not change.\n if (index === this._activeIndex) {\n return;\n }\n\n // Bail early if a child menu is open and the mouse is not over\n // an item. This allows the child menu to be kept open when the\n // mouse is over the empty part of the menu bar.\n if (index === -1 && this._childMenu) {\n return;\n }\n\n // Get position for the new menu >before< updating active index.\n const position =\n index >= 0 && this._childMenu ? this._positionForMenu(index) : null;\n\n // Before any modification, update window data.\n Menu.saveWindowData();\n\n // Begin DOM modifications.\n\n // Update the active index to the hovered item.\n this.activeIndex = index;\n\n // Open the new menu if a menu is already open.\n if (position) {\n this._openChildMenu(position);\n }\n }\n\n /**\n * Find initial position for the menu based on menubar item position.\n *\n * NOTE: this should be called before updating active index to avoid\n * an additional layout and style invalidation as changing active\n * index modifies DOM.\n */\n private _positionForMenu(index: number): Private.IPosition {\n let itemNode = this.contentNode.children[index];\n let { left, bottom } = (itemNode as HTMLElement).getBoundingClientRect();\n return {\n top: bottom,\n left\n };\n }\n\n /**\n * Handle the `'focusout'` event for the menu bar.\n */\n private _evtFocusOut(event: FocusEvent): void {\n // Reset the active index if there is no open menu and the menubar is losing focus.\n if (!this._childMenu && !this.node.contains(event.relatedTarget as Node)) {\n this.activeIndex = -1;\n }\n }\n\n /**\n * Focus an item in the menu bar.\n *\n * #### Notes\n * Does not open the associated menu.\n */\n private _focusItemAt(index: number): void {\n const itemNode = this.contentNode.childNodes[index] as HTMLElement | void;\n if (itemNode) {\n itemNode.focus();\n }\n }\n\n /**\n * Open the child menu at the active index immediately.\n *\n * If a different child menu is already open, it will be closed,\n * even if there is no active menu.\n */\n private _openChildMenu(options: { left?: number; top?: number } = {}): void {\n // If there is no active menu, close the current menu.\n let newMenu = this.activeMenu;\n if (!newMenu) {\n this._closeChildMenu();\n return;\n }\n\n // Bail if there is no effective menu change.\n let oldMenu = this._childMenu;\n if (oldMenu === newMenu) {\n return;\n }\n\n // Swap the internal menu reference.\n this._childMenu = newMenu;\n\n // Close the current menu, or setup for the new menu.\n if (oldMenu) {\n oldMenu.close();\n } else {\n document.addEventListener('mousedown', this, true);\n }\n\n // Update the tab focus index and ensure the menu bar is updated.\n this._tabFocusIndex = this.activeIndex;\n MessageLoop.sendMessage(this, Widget.Msg.UpdateRequest);\n\n // Get the positioning data for the new menu.\n let { left, top } = options;\n if (typeof left === 'undefined' || typeof top === 'undefined') {\n ({ left, top } = this._positionForMenu(this._activeIndex));\n }\n // Begin DOM modifications\n\n if (!oldMenu) {\n // Continue setup for new menu\n this.addClass('lm-mod-active');\n }\n\n // Open the new menu at the computed location.\n if (newMenu.items.length > 0) {\n newMenu.open(left, top, this._forceItemsPosition);\n }\n }\n\n /**\n * Close the child menu immediately.\n *\n * This is a no-op if a child menu is not open.\n */\n private _closeChildMenu(): void {\n // Bail if no child menu is open.\n if (!this._childMenu) {\n return;\n }\n // Remove the active class from the menu bar.\n this.removeClass('lm-mod-active');\n\n // Remove the document listeners.\n document.removeEventListener('mousedown', this, true);\n\n // Clear the internal menu reference.\n let menu = this._childMenu;\n this._childMenu = null;\n\n // Close the menu.\n menu.close();\n\n // Reset the active index.\n this.activeIndex = -1;\n }\n\n /**\n * Handle the `aboutToClose` signal of a menu.\n */\n private _onMenuAboutToClose(sender: Menu): void {\n // Bail if the sender is not the child menu.\n if (sender !== this._childMenu) {\n return;\n }\n\n // Remove the active class from the menu bar.\n this.removeClass('lm-mod-active');\n\n // Remove the document listeners.\n document.removeEventListener('mousedown', this, true);\n\n // Clear the internal menu reference.\n this._childMenu = null;\n\n // Reset the active index.\n this.activeIndex = -1;\n }\n\n /**\n * Handle the `menuRequested` signal of a child menu.\n */\n private _onMenuMenuRequested(sender: Menu, args: 'next' | 'previous'): void {\n // Bail if the sender is not the child menu.\n if (sender !== this._childMenu) {\n return;\n }\n\n // Look up the active index and menu count.\n let i = this._activeIndex;\n let n = this._menus.length;\n\n // Active the next requested index.\n switch (args) {\n case 'next':\n this.activeIndex = i === n - 1 ? 0 : i + 1;\n break;\n case 'previous':\n this.activeIndex = i === 0 ? n - 1 : i - 1;\n break;\n }\n\n // Open the active menu.\n this.openActiveMenu();\n }\n\n /**\n * Handle the `changed` signal of a title object.\n */\n private _onTitleChanged(): void {\n this.update();\n }\n\n // Track the index of the item that is currently focused or hovered. -1 means nothing focused or hovered.\n private _activeIndex = -1;\n // Track which item can be focused using the TAB key. Unlike _activeIndex will\n // always point to a menuitem. Whenever you update this value, it's important\n // to follow it with an \"update-request\" message so that the `tabindex`\n // attribute on each menubar item gets properly updated.\n private _tabFocusIndex = 0;\n private _forceItemsPosition: Menu.IOpenOptions;\n private _overflowMenuOptions: IOverflowMenuOptions;\n private _menus: Menu[] = [];\n private _childMenu: Menu | null = null;\n private _overflowMenu: Menu | null = null;\n private _menuItemSizes: number[] = [];\n private _overflowIndex: number = -1;\n}\n\n/**\n * The namespace for the `MenuBar` class statics.\n */\nexport namespace MenuBar {\n /**\n * An options object for creating a menu bar.\n */\n export interface IOptions {\n /**\n * A custom renderer for creating menu bar content.\n *\n * The default is a shared renderer instance.\n */\n renderer?: IRenderer;\n /**\n * Whether to force the position of the menu. The MenuBar forces the\n * coordinates of its menus by default. With this option you can disable it.\n *\n * Setting to `false` will enable the logic which repositions the\n * coordinates of the menu if it will not fit entirely on screen.\n *\n * The default is `true`.\n */\n forceItemsPosition?: Menu.IOpenOptions;\n /**\n * Whether to add a overflow menu if there's overflow.\n *\n * Setting to `true` will enable the logic that creates an overflow menu\n * to show the menu items that don't fit entirely on the screen.\n *\n * The default is `true`.\n */\n overflowMenuOptions?: IOverflowMenuOptions;\n }\n\n /**\n * An object which holds the data to render a menu bar item.\n */\n export interface IRenderData {\n /**\n * The title to be rendered.\n */\n readonly title: Title;\n\n /**\n * Whether the item is the active item.\n */\n readonly active: boolean;\n\n /**\n * Whether the user can tab to the item.\n */\n readonly tabbable: boolean;\n\n /**\n * Whether the item is disabled.\n *\n * #### Notes\n * A disabled item cannot be active.\n * A disabled item cannot be focussed.\n */\n readonly disabled?: boolean;\n\n readonly onfocus?: (event: FocusEvent) => void;\n }\n\n /**\n * A renderer for use with a menu bar.\n */\n export interface IRenderer {\n /**\n * Render the virtual element for a menu bar item.\n *\n * @param data - The data to use for rendering the item.\n *\n * @returns A virtual element representing the item.\n */\n renderItem(data: IRenderData): VirtualElement;\n }\n\n /**\n * The default implementation of `IRenderer`.\n *\n * #### Notes\n * Subclasses are free to reimplement rendering methods as needed.\n */\n export class Renderer implements IRenderer {\n /**\n * Render the virtual element for a menu bar item.\n *\n * @param data - The data to use for rendering the item.\n *\n * @returns A virtual element representing the item.\n */\n renderItem(data: IRenderData): VirtualElement {\n let className = this.createItemClass(data);\n let dataset = this.createItemDataset(data);\n let aria = this.createItemARIA(data);\n return h.li(\n {\n className,\n dataset,\n ...(data.disabled ? {} : { tabindex: data.tabbable ? '0' : '-1' }),\n onfocus: data.onfocus,\n ...aria\n },\n this.renderIcon(data),\n this.renderLabel(data)\n );\n }\n\n /**\n * Render the icon element for a menu bar item.\n *\n * @param data - The data to use for rendering the icon.\n *\n * @returns A virtual element representing the item icon.\n */\n renderIcon(data: IRenderData): VirtualElement {\n let className = this.createIconClass(data);\n\n // If data.title.icon is undefined, it will be ignored.\n return h.div({ className }, data.title.icon!, data.title.iconLabel);\n }\n\n /**\n * Render the label element for a menu item.\n *\n * @param data - The data to use for rendering the label.\n *\n * @returns A virtual element representing the item label.\n */\n renderLabel(data: IRenderData): VirtualElement {\n let content = this.formatLabel(data);\n return h.div({ className: 'lm-MenuBar-itemLabel' }, content);\n }\n\n /**\n * Create the class name for the menu bar item.\n *\n * @param data - The data to use for the class name.\n *\n * @returns The full class name for the menu item.\n */\n createItemClass(data: IRenderData): string {\n let name = 'lm-MenuBar-item';\n if (data.title.className) {\n name += ` ${data.title.className}`;\n }\n if (data.active && !data.disabled) {\n name += ' lm-mod-active';\n }\n return name;\n }\n\n /**\n * Create the dataset for a menu bar item.\n *\n * @param data - The data to use for the item.\n *\n * @returns The dataset for the menu bar item.\n */\n createItemDataset(data: IRenderData): ElementDataset {\n return data.title.dataset;\n }\n\n /**\n * Create the aria attributes for menu bar item.\n *\n * @param data - The data to use for the aria attributes.\n *\n * @returns The aria attributes object for the item.\n */\n createItemARIA(data: IRenderData): ElementARIAAttrs {\n return {\n role: 'menuitem',\n 'aria-haspopup': 'true',\n 'aria-disabled': data.disabled ? 'true' : 'false'\n };\n }\n\n /**\n * Create the class name for the menu bar item icon.\n *\n * @param data - The data to use for the class name.\n *\n * @returns The full class name for the item icon.\n */\n createIconClass(data: IRenderData): string {\n let name = 'lm-MenuBar-itemIcon';\n let extra = data.title.iconClass;\n return extra ? `${name} ${extra}` : name;\n }\n\n /**\n * Create the render content for the label node.\n *\n * @param data - The data to use for the label content.\n *\n * @returns The content to add to the label node.\n */\n formatLabel(data: IRenderData): h.Child {\n // Fetch the label text and mnemonic index.\n let { label, mnemonic } = data.title;\n\n // If the index is out of range, do not modify the label.\n if (mnemonic < 0 || mnemonic >= label.length) {\n return label;\n }\n\n // Split the label into parts.\n let prefix = label.slice(0, mnemonic);\n let suffix = label.slice(mnemonic + 1);\n let char = label[mnemonic];\n\n // Wrap the mnemonic character in a span.\n let span = h.span({ className: 'lm-MenuBar-itemMnemonic' }, char);\n\n // Return the content parts.\n return [prefix, span, suffix];\n }\n }\n\n /**\n * The default `Renderer` instance.\n */\n export const defaultRenderer = new Renderer();\n}\n\n/**\n * Options for overflow menu.\n */\nexport interface IOverflowMenuOptions {\n /**\n * Determines if a overflow menu appears when the menu items overflow.\n *\n * Defaults to `true`.\n */\n isVisible: boolean;\n /**\n * Determines the title of the overflow menu.\n *\n * Default: `...`.\n */\n title?: string;\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * Create the DOM node for a menu bar.\n */\n export function createNode(): HTMLDivElement {\n let node = document.createElement('div');\n let content = document.createElement('ul');\n content.className = 'lm-MenuBar-content';\n node.appendChild(content);\n content.setAttribute('role', 'menubar');\n return node;\n }\n\n /**\n * Position for the menu relative to top-left screen corner.\n */\n export interface IPosition {\n /**\n * Pixels right from screen origin.\n */\n left: number;\n /**\n * Pixels down from screen origin.\n */\n top: number;\n }\n\n /**\n * The results of a mnemonic search.\n */\n export interface IMnemonicResult {\n /**\n * The index of the first matching mnemonic item, or `-1`.\n */\n index: number;\n\n /**\n * Whether multiple mnemonic items matched.\n */\n multiple: boolean;\n\n /**\n * The index of the first auto matched non-mnemonic item.\n */\n auto: number;\n }\n\n /**\n * Find the best matching mnemonic item.\n *\n * The search starts at the given index and wraps around.\n */\n export function findMnemonic(\n menus: ReadonlyArray,\n key: string,\n start: number\n ): IMnemonicResult {\n // Setup the result variables.\n let index = -1;\n let auto = -1;\n let multiple = false;\n\n // Normalize the key to upper case.\n let upperKey = key.toUpperCase();\n\n // Search the items from the given start index.\n for (let i = 0, n = menus.length; i < n; ++i) {\n // Compute the wrapped index.\n let k = (i + start) % n;\n\n // Look up the menu title.\n let title = menus[k].title;\n\n // Ignore titles with an empty label.\n if (title.label.length === 0) {\n continue;\n }\n\n // Look up the mnemonic index for the label.\n let mn = title.mnemonic;\n\n // Handle a valid mnemonic index.\n if (mn >= 0 && mn < title.label.length) {\n if (title.label[mn].toUpperCase() === upperKey) {\n if (index === -1) {\n index = k;\n } else {\n multiple = true;\n }\n }\n continue;\n }\n\n // Finally, handle the auto index if possible.\n if (auto === -1 && title.label[0].toUpperCase() === upperKey) {\n auto = k;\n }\n }\n\n // Return the search results.\n return { index, multiple, auto };\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { IDisposable } from '@lumino/disposable';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Drag } from '@lumino/dragdrop';\n\nimport { Message } from '@lumino/messaging';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { Widget } from './widget';\n\n/**\n * A widget which implements a canonical scroll bar.\n */\nexport class ScrollBar extends Widget {\n /**\n * Construct a new scroll bar.\n *\n * @param options - The options for initializing the scroll bar.\n */\n constructor(options: ScrollBar.IOptions = {}) {\n super({ node: Private.createNode() });\n this.addClass('lm-ScrollBar');\n this.setFlag(Widget.Flag.DisallowLayout);\n\n // Set the orientation.\n this._orientation = options.orientation || 'vertical';\n this.dataset['orientation'] = this._orientation;\n\n // Parse the rest of the options.\n if (options.maximum !== undefined) {\n this._maximum = Math.max(0, options.maximum);\n }\n if (options.page !== undefined) {\n this._page = Math.max(0, options.page);\n }\n if (options.value !== undefined) {\n this._value = Math.max(0, Math.min(options.value, this._maximum));\n }\n }\n\n /**\n * A signal emitted when the user moves the scroll thumb.\n *\n * #### Notes\n * The payload is the current value of the scroll bar.\n */\n get thumbMoved(): ISignal {\n return this._thumbMoved;\n }\n\n /**\n * A signal emitted when the user clicks a step button.\n *\n * #### Notes\n * The payload is whether a decrease or increase is requested.\n */\n get stepRequested(): ISignal {\n return this._stepRequested;\n }\n\n /**\n * A signal emitted when the user clicks the scroll track.\n *\n * #### Notes\n * The payload is whether a decrease or increase is requested.\n */\n get pageRequested(): ISignal {\n return this._pageRequested;\n }\n\n /**\n * Get the orientation of the scroll bar.\n */\n get orientation(): ScrollBar.Orientation {\n return this._orientation;\n }\n\n /**\n * Set the orientation of the scroll bar.\n */\n set orientation(value: ScrollBar.Orientation) {\n // Do nothing if the orientation does not change.\n if (this._orientation === value) {\n return;\n }\n\n // Release the mouse before making changes.\n this._releaseMouse();\n\n // Update the internal orientation.\n this._orientation = value;\n this.dataset['orientation'] = value;\n\n // Schedule an update the scroll bar.\n this.update();\n }\n\n /**\n * Get the current value of the scroll bar.\n */\n get value(): number {\n return this._value;\n }\n\n /**\n * Set the current value of the scroll bar.\n *\n * #### Notes\n * The value will be clamped to the range `[0, maximum]`.\n */\n set value(value: number) {\n // Clamp the value to the allowable range.\n value = Math.max(0, Math.min(value, this._maximum));\n\n // Do nothing if the value does not change.\n if (this._value === value) {\n return;\n }\n\n // Update the internal value.\n this._value = value;\n\n // Schedule an update the scroll bar.\n this.update();\n }\n\n /**\n * Get the page size of the scroll bar.\n *\n * #### Notes\n * The page size is the amount of visible content in the scrolled\n * region, expressed in data units. It determines the size of the\n * scroll bar thumb.\n */\n get page(): number {\n return this._page;\n }\n\n /**\n * Set the page size of the scroll bar.\n *\n * #### Notes\n * The page size will be clamped to the range `[0, Infinity]`.\n */\n set page(value: number) {\n // Clamp the page size to the allowable range.\n value = Math.max(0, value);\n\n // Do nothing if the value does not change.\n if (this._page === value) {\n return;\n }\n\n // Update the internal page size.\n this._page = value;\n\n // Schedule an update the scroll bar.\n this.update();\n }\n\n /**\n * Get the maximum value of the scroll bar.\n */\n get maximum(): number {\n return this._maximum;\n }\n\n /**\n * Set the maximum value of the scroll bar.\n *\n * #### Notes\n * The max size will be clamped to the range `[0, Infinity]`.\n */\n set maximum(value: number) {\n // Clamp the value to the allowable range.\n value = Math.max(0, value);\n\n // Do nothing if the value does not change.\n if (this._maximum === value) {\n return;\n }\n\n // Update the internal values.\n this._maximum = value;\n\n // Clamp the current value to the new range.\n this._value = Math.min(this._value, value);\n\n // Schedule an update the scroll bar.\n this.update();\n }\n\n /**\n * The scroll bar decrement button node.\n *\n * #### Notes\n * Modifying this node directly can lead to undefined behavior.\n */\n get decrementNode(): HTMLDivElement {\n return this.node.getElementsByClassName(\n 'lm-ScrollBar-button'\n )[0] as HTMLDivElement;\n }\n\n /**\n * The scroll bar increment button node.\n *\n * #### Notes\n * Modifying this node directly can lead to undefined behavior.\n */\n get incrementNode(): HTMLDivElement {\n return this.node.getElementsByClassName(\n 'lm-ScrollBar-button'\n )[1] as HTMLDivElement;\n }\n\n /**\n * The scroll bar track node.\n *\n * #### Notes\n * Modifying this node directly can lead to undefined behavior.\n */\n get trackNode(): HTMLDivElement {\n return this.node.getElementsByClassName(\n 'lm-ScrollBar-track'\n )[0] as HTMLDivElement;\n }\n\n /**\n * The scroll bar thumb node.\n *\n * #### Notes\n * Modifying this node directly can lead to undefined behavior.\n */\n get thumbNode(): HTMLDivElement {\n return this.node.getElementsByClassName(\n 'lm-ScrollBar-thumb'\n )[0] as HTMLDivElement;\n }\n\n /**\n * Handle the DOM events for the scroll bar.\n *\n * @param event - The DOM event sent to the scroll bar.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the scroll bar's DOM node.\n *\n * This should not be called directly by user code.\n */\n handleEvent(event: Event): void {\n switch (event.type) {\n case 'mousedown':\n this._evtMouseDown(event as MouseEvent);\n break;\n case 'mousemove':\n this._evtMouseMove(event as MouseEvent);\n break;\n case 'mouseup':\n this._evtMouseUp(event as MouseEvent);\n break;\n case 'keydown':\n this._evtKeyDown(event as KeyboardEvent);\n break;\n case 'contextmenu':\n event.preventDefault();\n event.stopPropagation();\n break;\n }\n }\n\n /**\n * A method invoked on a 'before-attach' message.\n */\n protected onBeforeAttach(msg: Message): void {\n this.node.addEventListener('mousedown', this);\n this.update();\n }\n\n /**\n * A method invoked on an 'after-detach' message.\n */\n protected onAfterDetach(msg: Message): void {\n this.node.removeEventListener('mousedown', this);\n this._releaseMouse();\n }\n\n /**\n * A method invoked on an 'update-request' message.\n */\n protected onUpdateRequest(msg: Message): void {\n // Convert the value and page into percentages.\n let value = (this._value * 100) / this._maximum;\n let page = (this._page * 100) / (this._page + this._maximum);\n\n // Clamp the value and page to the relevant range.\n value = Math.max(0, Math.min(value, 100));\n page = Math.max(0, Math.min(page, 100));\n\n // Fetch the thumb style.\n let thumbStyle = this.thumbNode.style;\n\n // Update the thumb style for the current orientation.\n if (this._orientation === 'horizontal') {\n thumbStyle.top = '';\n thumbStyle.height = '';\n thumbStyle.left = `${value}%`;\n thumbStyle.width = `${page}%`;\n thumbStyle.transform = `translate(${-value}%, 0%)`;\n } else {\n thumbStyle.left = '';\n thumbStyle.width = '';\n thumbStyle.top = `${value}%`;\n thumbStyle.height = `${page}%`;\n thumbStyle.transform = `translate(0%, ${-value}%)`;\n }\n }\n\n /**\n * Handle the `'keydown'` event for the scroll bar.\n */\n private _evtKeyDown(event: KeyboardEvent): void {\n // Stop all input events during drag.\n event.preventDefault();\n event.stopPropagation();\n\n // Ignore anything except the `Escape` key.\n if (event.keyCode !== 27) {\n return;\n }\n\n // Fetch the previous scroll value.\n let value = this._pressData ? this._pressData.value : -1;\n\n // Release the mouse.\n this._releaseMouse();\n\n // Restore the old scroll value if possible.\n if (value !== -1) {\n this._moveThumb(value);\n }\n }\n\n /**\n * Handle the `'mousedown'` event for the scroll bar.\n */\n private _evtMouseDown(event: MouseEvent): void {\n // Do nothing if it's not a left mouse press.\n if (event.button !== 0) {\n return;\n }\n\n // Send an activate request to the scroll bar. This can be\n // used by message hooks to activate something relevant.\n this.activate();\n\n // Do nothing if the mouse is already captured.\n if (this._pressData) {\n return;\n }\n\n // Find the pressed scroll bar part.\n let part = Private.findPart(this, event.target as HTMLElement);\n\n // Do nothing if the part is not of interest.\n if (!part) {\n return;\n }\n\n // Stop the event propagation.\n event.preventDefault();\n event.stopPropagation();\n\n // Override the mouse cursor.\n let override = Drag.overrideCursor('default');\n\n // Set up the press data.\n this._pressData = {\n part,\n override,\n delta: -1,\n value: -1,\n mouseX: event.clientX,\n mouseY: event.clientY\n };\n\n // Add the extra event listeners.\n document.addEventListener('mousemove', this, true);\n document.addEventListener('mouseup', this, true);\n document.addEventListener('keydown', this, true);\n document.addEventListener('contextmenu', this, true);\n\n // Handle a thumb press.\n if (part === 'thumb') {\n // Fetch the thumb node.\n let thumbNode = this.thumbNode;\n\n // Fetch the client rect for the thumb.\n let thumbRect = thumbNode.getBoundingClientRect();\n\n // Update the press data delta for the current orientation.\n if (this._orientation === 'horizontal') {\n this._pressData.delta = event.clientX - thumbRect.left;\n } else {\n this._pressData.delta = event.clientY - thumbRect.top;\n }\n\n // Add the active class to the thumb node.\n thumbNode.classList.add('lm-mod-active');\n\n // Store the current value in the press data.\n this._pressData.value = this._value;\n\n // Finished.\n return;\n }\n\n // Handle a track press.\n if (part === 'track') {\n // Fetch the client rect for the thumb.\n let thumbRect = this.thumbNode.getBoundingClientRect();\n\n // Determine the direction for the page request.\n let dir: 'decrement' | 'increment';\n if (this._orientation === 'horizontal') {\n dir = event.clientX < thumbRect.left ? 'decrement' : 'increment';\n } else {\n dir = event.clientY < thumbRect.top ? 'decrement' : 'increment';\n }\n\n // Start the repeat timer.\n this._repeatTimer = window.setTimeout(this._onRepeat, 350);\n\n // Emit the page requested signal.\n this._pageRequested.emit(dir);\n\n // Finished.\n return;\n }\n\n // Handle a decrement button press.\n if (part === 'decrement') {\n // Add the active class to the decrement node.\n this.decrementNode.classList.add('lm-mod-active');\n\n // Start the repeat timer.\n this._repeatTimer = window.setTimeout(this._onRepeat, 350);\n\n // Emit the step requested signal.\n this._stepRequested.emit('decrement');\n\n // Finished.\n return;\n }\n\n // Handle an increment button press.\n if (part === 'increment') {\n // Add the active class to the increment node.\n this.incrementNode.classList.add('lm-mod-active');\n\n // Start the repeat timer.\n this._repeatTimer = window.setTimeout(this._onRepeat, 350);\n\n // Emit the step requested signal.\n this._stepRequested.emit('increment');\n\n // Finished.\n return;\n }\n }\n\n /**\n * Handle the `'mousemove'` event for the scroll bar.\n */\n private _evtMouseMove(event: MouseEvent): void {\n // Do nothing if no drag is in progress.\n if (!this._pressData) {\n return;\n }\n\n // Stop the event propagation.\n event.preventDefault();\n event.stopPropagation();\n\n // Update the mouse position.\n this._pressData.mouseX = event.clientX;\n this._pressData.mouseY = event.clientY;\n\n // Bail if the thumb is not being dragged.\n if (this._pressData.part !== 'thumb') {\n return;\n }\n\n // Get the client rect for the thumb and track.\n let thumbRect = this.thumbNode.getBoundingClientRect();\n let trackRect = this.trackNode.getBoundingClientRect();\n\n // Fetch the scroll geometry based on the orientation.\n let trackPos: number;\n let trackSpan: number;\n if (this._orientation === 'horizontal') {\n trackPos = event.clientX - trackRect.left - this._pressData.delta;\n trackSpan = trackRect.width - thumbRect.width;\n } else {\n trackPos = event.clientY - trackRect.top - this._pressData.delta;\n trackSpan = trackRect.height - thumbRect.height;\n }\n\n // Compute the desired value from the scroll geometry.\n let value = trackSpan === 0 ? 0 : (trackPos * this._maximum) / trackSpan;\n\n // Move the thumb to the computed value.\n this._moveThumb(value);\n }\n\n /**\n * Handle the `'mouseup'` event for the scroll bar.\n */\n private _evtMouseUp(event: MouseEvent): void {\n // Do nothing if it's not a left mouse release.\n if (event.button !== 0) {\n return;\n }\n\n // Stop the event propagation.\n event.preventDefault();\n event.stopPropagation();\n\n // Release the mouse.\n this._releaseMouse();\n }\n\n /**\n * Release the mouse and restore the node states.\n */\n private _releaseMouse(): void {\n // Bail if there is no press data.\n if (!this._pressData) {\n return;\n }\n\n // Clear the repeat timer.\n clearTimeout(this._repeatTimer);\n this._repeatTimer = -1;\n\n // Clear the press data.\n this._pressData.override.dispose();\n this._pressData = null;\n\n // Remove the extra event listeners.\n document.removeEventListener('mousemove', this, true);\n document.removeEventListener('mouseup', this, true);\n document.removeEventListener('keydown', this, true);\n document.removeEventListener('contextmenu', this, true);\n\n // Remove the active classes from the nodes.\n this.thumbNode.classList.remove('lm-mod-active');\n this.decrementNode.classList.remove('lm-mod-active');\n this.incrementNode.classList.remove('lm-mod-active');\n }\n\n /**\n * Move the thumb to the specified position.\n */\n private _moveThumb(value: number): void {\n // Clamp the value to the allowed range.\n value = Math.max(0, Math.min(value, this._maximum));\n\n // Bail if the value does not change.\n if (this._value === value) {\n return;\n }\n\n // Update the internal value.\n this._value = value;\n\n // Schedule an update of the scroll bar.\n this.update();\n\n // Emit the thumb moved signal.\n this._thumbMoved.emit(value);\n }\n\n /**\n * A timeout callback for repeating the mouse press.\n */\n private _onRepeat = () => {\n // Clear the repeat timer id.\n this._repeatTimer = -1;\n\n // Bail if the mouse has been released.\n if (!this._pressData) {\n return;\n }\n\n // Look up the part that was pressed.\n let part = this._pressData.part;\n\n // Bail if the thumb was pressed.\n if (part === 'thumb') {\n return;\n }\n\n // Schedule the timer for another repeat.\n this._repeatTimer = window.setTimeout(this._onRepeat, 20);\n\n // Get the current mouse position.\n let mouseX = this._pressData.mouseX;\n let mouseY = this._pressData.mouseY;\n\n // Handle a decrement button repeat.\n if (part === 'decrement') {\n // Bail if the mouse is not over the button.\n if (!ElementExt.hitTest(this.decrementNode, mouseX, mouseY)) {\n return;\n }\n\n // Emit the step requested signal.\n this._stepRequested.emit('decrement');\n\n // Finished.\n return;\n }\n\n // Handle an increment button repeat.\n if (part === 'increment') {\n // Bail if the mouse is not over the button.\n if (!ElementExt.hitTest(this.incrementNode, mouseX, mouseY)) {\n return;\n }\n\n // Emit the step requested signal.\n this._stepRequested.emit('increment');\n\n // Finished.\n return;\n }\n\n // Handle a track repeat.\n if (part === 'track') {\n // Bail if the mouse is not over the track.\n if (!ElementExt.hitTest(this.trackNode, mouseX, mouseY)) {\n return;\n }\n\n // Fetch the thumb node.\n let thumbNode = this.thumbNode;\n\n // Bail if the mouse is over the thumb.\n if (ElementExt.hitTest(thumbNode, mouseX, mouseY)) {\n return;\n }\n\n // Fetch the client rect for the thumb.\n let thumbRect = thumbNode.getBoundingClientRect();\n\n // Determine the direction for the page request.\n let dir: 'decrement' | 'increment';\n if (this._orientation === 'horizontal') {\n dir = mouseX < thumbRect.left ? 'decrement' : 'increment';\n } else {\n dir = mouseY < thumbRect.top ? 'decrement' : 'increment';\n }\n\n // Emit the page requested signal.\n this._pageRequested.emit(dir);\n\n // Finished.\n return;\n }\n };\n\n private _value = 0;\n private _page = 10;\n private _maximum = 100;\n private _repeatTimer = -1;\n private _orientation: ScrollBar.Orientation;\n private _pressData: Private.IPressData | null = null;\n private _thumbMoved = new Signal(this);\n private _stepRequested = new Signal(this);\n private _pageRequested = new Signal(this);\n}\n\n/**\n * The namespace for the `ScrollBar` class statics.\n */\nexport namespace ScrollBar {\n /**\n * A type alias for a scroll bar orientation.\n */\n export type Orientation = 'horizontal' | 'vertical';\n\n /**\n * An options object for creating a scroll bar.\n */\n export interface IOptions {\n /**\n * The orientation of the scroll bar.\n *\n * The default is `'vertical'`.\n */\n orientation?: Orientation;\n\n /**\n * The value for the scroll bar.\n *\n * The default is `0`.\n */\n value?: number;\n\n /**\n * The page size for the scroll bar.\n *\n * The default is `10`.\n */\n page?: number;\n\n /**\n * The maximum value for the scroll bar.\n *\n * The default is `100`.\n */\n maximum?: number;\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * A type alias for the parts of a scroll bar.\n */\n export type ScrollBarPart = 'thumb' | 'track' | 'decrement' | 'increment';\n\n /**\n * An object which holds mouse press data.\n */\n export interface IPressData {\n /**\n * The scroll bar part which was pressed.\n */\n part: ScrollBarPart;\n\n /**\n * The offset of the press in thumb coordinates, or -1.\n */\n delta: number;\n\n /**\n * The scroll value at the time the thumb was pressed, or -1.\n */\n value: number;\n\n /**\n * The disposable which will clear the override cursor.\n */\n override: IDisposable;\n\n /**\n * The current X position of the mouse.\n */\n mouseX: number;\n\n /**\n * The current Y position of the mouse.\n */\n mouseY: number;\n }\n\n /**\n * Create the DOM node for a scroll bar.\n */\n export function createNode(): HTMLElement {\n let node = document.createElement('div');\n let decrement = document.createElement('div');\n let increment = document.createElement('div');\n let track = document.createElement('div');\n let thumb = document.createElement('div');\n decrement.className = 'lm-ScrollBar-button';\n increment.className = 'lm-ScrollBar-button';\n decrement.dataset['action'] = 'decrement';\n increment.dataset['action'] = 'increment';\n track.className = 'lm-ScrollBar-track';\n thumb.className = 'lm-ScrollBar-thumb';\n track.appendChild(thumb);\n node.appendChild(decrement);\n node.appendChild(track);\n node.appendChild(increment);\n return node;\n }\n\n /**\n * Find the scroll bar part which contains the given target.\n */\n export function findPart(\n scrollBar: ScrollBar,\n target: HTMLElement\n ): ScrollBarPart | null {\n // Test the thumb.\n if (scrollBar.thumbNode.contains(target)) {\n return 'thumb';\n }\n\n // Test the track.\n if (scrollBar.trackNode.contains(target)) {\n return 'track';\n }\n\n // Test the decrement button.\n if (scrollBar.decrementNode.contains(target)) {\n return 'decrement';\n }\n\n // Test the increment button.\n if (scrollBar.incrementNode.contains(target)) {\n return 'increment';\n }\n\n // Indicate no match.\n return null;\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { MessageLoop } from '@lumino/messaging';\n\nimport { Layout } from './layout';\n\nimport { Widget } from './widget';\n\n/**\n * A concrete layout implementation which holds a single widget.\n *\n * #### Notes\n * This class is useful for creating simple container widgets which\n * hold a single child. The child should be positioned with CSS.\n */\nexport class SingletonLayout extends Layout {\n /**\n * Dispose of the resources held by the layout.\n */\n dispose(): void {\n if (this._widget) {\n let widget = this._widget;\n this._widget = null;\n widget.dispose();\n }\n super.dispose();\n }\n\n /**\n * Get the child widget for the layout.\n */\n get widget(): Widget | null {\n return this._widget;\n }\n\n /**\n * Set the child widget for the layout.\n *\n * #### Notes\n * Setting the child widget will cause the old child widget to be\n * automatically disposed. If that is not desired, set the parent\n * of the old child to `null` before assigning a new child.\n */\n set widget(widget: Widget | null) {\n // Remove the widget from its current parent. This is a no-op\n // if the widget's parent is already the layout parent widget.\n if (widget) {\n widget.parent = this.parent;\n }\n\n // Bail early if the widget does not change.\n if (this._widget === widget) {\n return;\n }\n\n // Dispose of the old child widget.\n if (this._widget) {\n this._widget.dispose();\n }\n\n // Update the internal widget.\n this._widget = widget;\n\n // Attach the new child widget if needed.\n if (this.parent && widget) {\n this.attachWidget(widget);\n }\n }\n\n /**\n * Create an iterator over the widgets in the layout.\n *\n * @returns A new iterator over the widgets in the layout.\n */\n *[Symbol.iterator](): IterableIterator {\n if (this._widget) {\n yield this._widget;\n }\n }\n\n /**\n * Remove a widget from the layout.\n *\n * @param widget - The widget to remove from the layout.\n *\n * #### Notes\n * A widget is automatically removed from the layout when its `parent`\n * is set to `null`. This method should only be invoked directly when\n * removing a widget from a layout which has yet to be installed on a\n * parent widget.\n *\n * This method does *not* modify the widget's `parent`.\n */\n removeWidget(widget: Widget): void {\n // Bail early if the widget does not exist in the layout.\n if (this._widget !== widget) {\n return;\n }\n\n // Clear the internal widget.\n this._widget = null;\n\n // If the layout is parented, detach the widget from the DOM.\n if (this.parent) {\n this.detachWidget(widget);\n }\n }\n\n /**\n * Perform layout initialization which requires the parent widget.\n */\n protected init(): void {\n super.init();\n for (const widget of this) {\n this.attachWidget(widget);\n }\n }\n\n /**\n * Attach a widget to the parent's DOM node.\n *\n * @param widget - The widget to attach to the parent.\n *\n * #### Notes\n * This method is called automatically by the single layout at the\n * appropriate time. It should not be called directly by user code.\n *\n * The default implementation adds the widgets's node to the parent's\n * node at the proper location, and sends the appropriate attach\n * messages to the widget if the parent is attached to the DOM.\n *\n * Subclasses may reimplement this method to control how the widget's\n * node is added to the parent's node.\n */\n protected attachWidget(widget: Widget): void {\n // Send a `'before-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n }\n\n // Add the widget's node to the parent.\n this.parent!.node.appendChild(widget.node);\n\n // Send an `'after-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n }\n\n /**\n * Detach a widget from the parent's DOM node.\n *\n * @param widget - The widget to detach from the parent.\n *\n * #### Notes\n * This method is called automatically by the single layout at the\n * appropriate time. It should not be called directly by user code.\n *\n * The default implementation removes the widget's node from the\n * parent's node, and sends the appropriate detach messages to the\n * widget if the parent is attached to the DOM.\n *\n * Subclasses may reimplement this method to control how the widget's\n * node is removed from the parent's node.\n */\n protected detachWidget(widget: Widget): void {\n // Send a `'before-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n }\n\n // Remove the widget's node from the parent.\n this.parent!.node.removeChild(widget.node);\n\n // Send an `'after-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n }\n\n private _widget: Widget | null = null;\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { Layout, LayoutItem } from './layout';\n\nimport { PanelLayout } from './panellayout';\n\nimport { Widget } from './widget';\n\n/**\n * A layout where visible widgets are stacked atop one another.\n *\n * #### Notes\n * The Z-order of the visible widgets follows their layout order.\n */\nexport class StackedLayout extends PanelLayout {\n constructor(options: StackedLayout.IOptions = {}) {\n super(options);\n this._hiddenMode =\n options.hiddenMode !== undefined\n ? options.hiddenMode\n : Widget.HiddenMode.Display;\n }\n\n /**\n * The method for hiding widgets.\n *\n * #### Notes\n * If there is only one child widget, `Display` hiding mode will be used\n * regardless of this setting.\n */\n get hiddenMode(): Widget.HiddenMode {\n return this._hiddenMode;\n }\n\n /**\n * Set the method for hiding widgets.\n *\n * #### Notes\n * If there is only one child widget, `Display` hiding mode will be used\n * regardless of this setting.\n */\n set hiddenMode(v: Widget.HiddenMode) {\n if (this._hiddenMode === v) {\n return;\n }\n this._hiddenMode = v;\n if (this.widgets.length > 1) {\n this.widgets.forEach(w => {\n w.hiddenMode = this._hiddenMode;\n });\n }\n }\n\n /**\n * Dispose of the resources held by the layout.\n */\n dispose(): void {\n // Dispose of the layout items.\n for (const item of this._items) {\n item.dispose();\n }\n\n // Clear the layout state.\n this._box = null;\n this._items.length = 0;\n\n // Dispose of the rest of the layout.\n super.dispose();\n }\n\n /**\n * Attach a widget to the parent's DOM node.\n *\n * @param index - The current index of the widget in the layout.\n *\n * @param widget - The widget to attach to the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected attachWidget(index: number, widget: Widget): void {\n // Using transform create an additional layer in the pixel pipeline\n // to limit the number of layer, it is set only if there is more than one widget.\n if (\n this._hiddenMode === Widget.HiddenMode.Scale &&\n this._items.length > 0\n ) {\n if (this._items.length === 1) {\n this.widgets[0].hiddenMode = Widget.HiddenMode.Scale;\n }\n widget.hiddenMode = Widget.HiddenMode.Scale;\n } else {\n widget.hiddenMode = Widget.HiddenMode.Display;\n }\n\n // Create and add a new layout item for the widget.\n ArrayExt.insert(this._items, index, new LayoutItem(widget));\n\n // Send a `'before-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n }\n\n // Add the widget's node to the parent.\n this.parent!.node.appendChild(widget.node);\n\n // Send an `'after-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n\n // Post a fit request for the parent widget.\n this.parent!.fit();\n }\n\n /**\n * Move a widget in the parent's DOM node.\n *\n * @param fromIndex - The previous index of the widget in the layout.\n *\n * @param toIndex - The current index of the widget in the layout.\n *\n * @param widget - The widget to move in the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected moveWidget(\n fromIndex: number,\n toIndex: number,\n widget: Widget\n ): void {\n // Move the layout item for the widget.\n ArrayExt.move(this._items, fromIndex, toIndex);\n\n // Post an update request for the parent widget.\n this.parent!.update();\n }\n\n /**\n * Detach a widget from the parent's DOM node.\n *\n * @param index - The previous index of the widget in the layout.\n *\n * @param widget - The widget to detach from the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected detachWidget(index: number, widget: Widget): void {\n // Remove the layout item for the widget.\n let item = ArrayExt.removeAt(this._items, index);\n\n // Send a `'before-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n }\n\n // Remove the widget's node from the parent.\n this.parent!.node.removeChild(widget.node);\n\n // Send an `'after-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n\n // Reset the z-index for the widget.\n item!.widget.node.style.zIndex = '';\n\n // Reset the hidden mode for the widget.\n if (this._hiddenMode === Widget.HiddenMode.Scale) {\n widget.hiddenMode = Widget.HiddenMode.Display;\n\n // Reset the hidden mode for the first widget if necessary.\n if (this._items.length === 1) {\n this._items[0].widget.hiddenMode = Widget.HiddenMode.Display;\n }\n }\n\n // Dispose of the layout item.\n item!.dispose();\n\n // Post a fit request for the parent widget.\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'before-show'` message.\n */\n protected onBeforeShow(msg: Message): void {\n super.onBeforeShow(msg);\n this.parent!.update();\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n super.onBeforeAttach(msg);\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-shown'` message.\n */\n protected onChildShown(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-hidden'` message.\n */\n protected onChildHidden(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'resize'` message.\n */\n protected onResize(msg: Widget.ResizeMessage): void {\n if (this.parent!.isVisible) {\n this._update(msg.width, msg.height);\n }\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n protected onUpdateRequest(msg: Message): void {\n if (this.parent!.isVisible) {\n this._update(-1, -1);\n }\n }\n\n /**\n * A message handler invoked on a `'fit-request'` message.\n */\n protected onFitRequest(msg: Message): void {\n if (this.parent!.isAttached) {\n this._fit();\n }\n }\n\n /**\n * Fit the layout to the total size required by the widgets.\n */\n private _fit(): void {\n // Set up the computed minimum size.\n let minW = 0;\n let minH = 0;\n\n // Update the computed minimum size.\n for (let i = 0, n = this._items.length; i < n; ++i) {\n // Fetch the item.\n let item = this._items[i];\n\n // Ignore hidden items.\n if (item.isHidden) {\n continue;\n }\n\n // Update the size limits for the item.\n item.fit();\n\n // Update the computed minimum size.\n minW = Math.max(minW, item.minWidth);\n minH = Math.max(minH, item.minHeight);\n }\n\n // Update the box sizing and add it to the computed min size.\n let box = (this._box = ElementExt.boxSizing(this.parent!.node));\n minW += box.horizontalSum;\n minH += box.verticalSum;\n\n // Update the parent's min size constraints.\n let style = this.parent!.node.style;\n style.minWidth = `${minW}px`;\n style.minHeight = `${minH}px`;\n\n // Set the dirty flag to ensure only a single update occurs.\n this._dirty = true;\n\n // Notify the ancestor that it should fit immediately. This may\n // cause a resize of the parent, fulfilling the required update.\n if (this.parent!.parent) {\n MessageLoop.sendMessage(this.parent!.parent!, Widget.Msg.FitRequest);\n }\n\n // If the dirty flag is still set, the parent was not resized.\n // Trigger the required update on the parent widget immediately.\n if (this._dirty) {\n MessageLoop.sendMessage(this.parent!, Widget.Msg.UpdateRequest);\n }\n }\n\n /**\n * Update the layout position and size of the widgets.\n *\n * The parent offset dimensions should be `-1` if unknown.\n */\n private _update(offsetWidth: number, offsetHeight: number): void {\n // Clear the dirty flag to indicate the update occurred.\n this._dirty = false;\n\n // Compute the visible item count.\n let nVisible = 0;\n for (let i = 0, n = this._items.length; i < n; ++i) {\n nVisible += +!this._items[i].isHidden;\n }\n\n // Bail early if there are no visible items to layout.\n if (nVisible === 0) {\n return;\n }\n\n // Measure the parent if the offset dimensions are unknown.\n if (offsetWidth < 0) {\n offsetWidth = this.parent!.node.offsetWidth;\n }\n if (offsetHeight < 0) {\n offsetHeight = this.parent!.node.offsetHeight;\n }\n\n // Ensure the parent box sizing data is computed.\n if (!this._box) {\n this._box = ElementExt.boxSizing(this.parent!.node);\n }\n\n // Compute the actual layout bounds adjusted for border and padding.\n let top = this._box.paddingTop;\n let left = this._box.paddingLeft;\n let width = offsetWidth - this._box.horizontalSum;\n let height = offsetHeight - this._box.verticalSum;\n\n // Update the widget stacking order and layout geometry.\n for (let i = 0, n = this._items.length; i < n; ++i) {\n // Fetch the item.\n let item = this._items[i];\n\n // Ignore hidden items.\n if (item.isHidden) {\n continue;\n }\n\n // Set the z-index for the widget.\n item.widget.node.style.zIndex = `${i}`;\n\n // Update the item geometry.\n item.update(left, top, width, height);\n }\n }\n\n private _dirty = false;\n private _items: LayoutItem[] = [];\n private _box: ElementExt.IBoxSizing | null = null;\n private _hiddenMode: Widget.HiddenMode;\n}\n\n/**\n * The namespace for the `StackedLayout` class statics.\n */\nexport namespace StackedLayout {\n /**\n * An options object for initializing a stacked layout.\n */\n export interface IOptions extends Layout.IOptions {\n /**\n * The method for hiding widgets.\n *\n * The default is `Widget.HiddenMode.Display`.\n */\n hiddenMode?: Widget.HiddenMode;\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { Panel } from './panel';\n\nimport { StackedLayout } from './stackedlayout';\n\nimport { Widget } from './widget';\n\n/**\n * A panel where visible widgets are stacked atop one another.\n *\n * #### Notes\n * This class provides a convenience wrapper around a {@link StackedLayout}.\n */\nexport class StackedPanel extends Panel {\n /**\n * Construct a new stacked panel.\n *\n * @param options - The options for initializing the panel.\n */\n constructor(options: StackedPanel.IOptions = {}) {\n super({ layout: Private.createLayout(options) });\n this.addClass('lm-StackedPanel');\n }\n\n /**\n * The method for hiding widgets.\n *\n * #### Notes\n * If there is only one child widget, `Display` hiding mode will be used\n * regardless of this setting.\n */\n get hiddenMode(): Widget.HiddenMode {\n return (this.layout as StackedLayout).hiddenMode;\n }\n\n /**\n * Set the method for hiding widgets.\n *\n * #### Notes\n * If there is only one child widget, `Display` hiding mode will be used\n * regardless of this setting.\n */\n set hiddenMode(v: Widget.HiddenMode) {\n (this.layout as StackedLayout).hiddenMode = v;\n }\n\n /**\n * A signal emitted when a widget is removed from a stacked panel.\n */\n get widgetRemoved(): ISignal {\n return this._widgetRemoved;\n }\n\n /**\n * A message handler invoked on a `'child-added'` message.\n */\n protected onChildAdded(msg: Widget.ChildMessage): void {\n msg.child.addClass('lm-StackedPanel-child');\n }\n\n /**\n * A message handler invoked on a `'child-removed'` message.\n */\n protected onChildRemoved(msg: Widget.ChildMessage): void {\n msg.child.removeClass('lm-StackedPanel-child');\n this._widgetRemoved.emit(msg.child);\n }\n\n private _widgetRemoved = new Signal(this);\n}\n\n/**\n * The namespace for the `StackedPanel` class statics.\n */\nexport namespace StackedPanel {\n /**\n * An options object for creating a stacked panel.\n */\n export interface IOptions {\n /**\n * The stacked layout to use for the stacked panel.\n *\n * The default is a new `StackedLayout`.\n */\n layout?: StackedLayout;\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * Create a stacked layout for the given panel options.\n */\n export function createLayout(options: StackedPanel.IOptions): StackedLayout {\n return options.layout || new StackedLayout();\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { Platform } from '@lumino/domutils';\n\nimport { MessageLoop } from '@lumino/messaging';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { BoxLayout } from './boxlayout';\n\nimport { StackedPanel } from './stackedpanel';\n\nimport { TabBar } from './tabbar';\n\nimport { Widget } from './widget';\n\n/**\n * A widget which combines a `TabBar` and a `StackedPanel`.\n *\n * #### Notes\n * This is a simple panel which handles the common case of a tab bar\n * placed next to a content area. The selected tab controls the widget\n * which is shown in the content area.\n *\n * For use cases which require more control than is provided by this\n * panel, the `TabBar` widget may be used independently.\n */\nexport class TabPanel extends Widget {\n /**\n * Construct a new tab panel.\n *\n * @param options - The options for initializing the tab panel.\n */\n constructor(options: TabPanel.IOptions = {}) {\n super();\n this.addClass('lm-TabPanel');\n\n // Create the tab bar and stacked panel.\n this.tabBar = new TabBar(options);\n this.tabBar.addClass('lm-TabPanel-tabBar');\n this.stackedPanel = new StackedPanel();\n this.stackedPanel.addClass('lm-TabPanel-stackedPanel');\n\n // Connect the tab bar signal handlers.\n this.tabBar.tabMoved.connect(this._onTabMoved, this);\n this.tabBar.currentChanged.connect(this._onCurrentChanged, this);\n this.tabBar.tabCloseRequested.connect(this._onTabCloseRequested, this);\n this.tabBar.tabActivateRequested.connect(\n this._onTabActivateRequested,\n this\n );\n this.tabBar.addRequested.connect(this._onTabAddRequested, this);\n\n // Connect the stacked panel signal handlers.\n this.stackedPanel.widgetRemoved.connect(this._onWidgetRemoved, this);\n\n // Get the data related to the placement.\n this._tabPlacement = options.tabPlacement || 'top';\n let direction = Private.directionFromPlacement(this._tabPlacement);\n let orientation = Private.orientationFromPlacement(this._tabPlacement);\n\n // Configure the tab bar for the placement.\n this.tabBar.orientation = orientation;\n this.tabBar.dataset['placement'] = this._tabPlacement;\n\n // Create the box layout.\n let layout = new BoxLayout({ direction, spacing: 0 });\n\n // Set the stretch factors for the child widgets.\n BoxLayout.setStretch(this.tabBar, 0);\n BoxLayout.setStretch(this.stackedPanel, 1);\n\n // Add the child widgets to the layout.\n layout.addWidget(this.tabBar);\n layout.addWidget(this.stackedPanel);\n\n // Install the layout on the tab panel.\n this.layout = layout;\n }\n\n /**\n * A signal emitted when the current tab is changed.\n *\n * #### Notes\n * This signal is emitted when the currently selected tab is changed\n * either through user or programmatic interaction.\n *\n * Notably, this signal is not emitted when the index of the current\n * tab changes due to tabs being inserted, removed, or moved. It is\n * only emitted when the actual current tab node is changed.\n */\n get currentChanged(): ISignal {\n return this._currentChanged;\n }\n\n /**\n * Get the index of the currently selected tab.\n *\n * #### Notes\n * This will be `-1` if no tab is selected.\n */\n get currentIndex(): number {\n return this.tabBar.currentIndex;\n }\n\n /**\n * Set the index of the currently selected tab.\n *\n * #### Notes\n * If the index is out of range, it will be set to `-1`.\n */\n set currentIndex(value: number) {\n this.tabBar.currentIndex = value;\n }\n\n /**\n * Get the currently selected widget.\n *\n * #### Notes\n * This will be `null` if there is no selected tab.\n */\n get currentWidget(): Widget | null {\n let title = this.tabBar.currentTitle;\n return title ? title.owner : null;\n }\n\n /**\n * Set the currently selected widget.\n *\n * #### Notes\n * If the widget is not in the panel, it will be set to `null`.\n */\n set currentWidget(value: Widget | null) {\n this.tabBar.currentTitle = value ? value.title : null;\n }\n\n /**\n * Get the whether the tabs are movable by the user.\n *\n * #### Notes\n * Tabs can always be moved programmatically.\n */\n get tabsMovable(): boolean {\n return this.tabBar.tabsMovable;\n }\n\n /**\n * Set the whether the tabs are movable by the user.\n *\n * #### Notes\n * Tabs can always be moved programmatically.\n */\n set tabsMovable(value: boolean) {\n this.tabBar.tabsMovable = value;\n }\n\n /**\n * Get the whether the add button is enabled.\n *\n */\n get addButtonEnabled(): boolean {\n return this.tabBar.addButtonEnabled;\n }\n\n /**\n * Set the whether the add button is enabled.\n *\n */\n set addButtonEnabled(value: boolean) {\n this.tabBar.addButtonEnabled = value;\n }\n\n /**\n * Get the tab placement for the tab panel.\n *\n * #### Notes\n * This controls the position of the tab bar relative to the content.\n */\n get tabPlacement(): TabPanel.TabPlacement {\n return this._tabPlacement;\n }\n\n /**\n * Set the tab placement for the tab panel.\n *\n * #### Notes\n * This controls the position of the tab bar relative to the content.\n */\n set tabPlacement(value: TabPanel.TabPlacement) {\n // Bail if the placement does not change.\n if (this._tabPlacement === value) {\n return;\n }\n\n // Update the internal value.\n this._tabPlacement = value;\n\n // Get the values related to the placement.\n let direction = Private.directionFromPlacement(value);\n let orientation = Private.orientationFromPlacement(value);\n\n // Configure the tab bar for the placement.\n this.tabBar.orientation = orientation;\n this.tabBar.dataset['placement'] = value;\n\n // Update the layout direction.\n (this.layout as BoxLayout).direction = direction;\n }\n\n /**\n * A signal emitted when the add button on a tab bar is clicked.\n *\n */\n get addRequested(): ISignal> {\n return this._addRequested;\n }\n\n /**\n * The tab bar used by the tab panel.\n *\n * #### Notes\n * Modifying the tab bar directly can lead to undefined behavior.\n */\n readonly tabBar: TabBar;\n\n /**\n * The stacked panel used by the tab panel.\n *\n * #### Notes\n * Modifying the panel directly can lead to undefined behavior.\n */\n readonly stackedPanel: StackedPanel;\n\n /**\n * A read-only array of the widgets in the panel.\n */\n get widgets(): ReadonlyArray {\n return this.stackedPanel.widgets;\n }\n\n /**\n * Add a widget to the end of the tab panel.\n *\n * @param widget - The widget to add to the tab panel.\n *\n * #### Notes\n * If the widget is already contained in the panel, it will be moved.\n *\n * The widget's `title` is used to populate the tab.\n */\n addWidget(widget: Widget): void {\n this.insertWidget(this.widgets.length, widget);\n }\n\n /**\n * Insert a widget into the tab panel at a specified index.\n *\n * @param index - The index at which to insert the widget.\n *\n * @param widget - The widget to insert into to the tab panel.\n *\n * #### Notes\n * If the widget is already contained in the panel, it will be moved.\n *\n * The widget's `title` is used to populate the tab.\n */\n insertWidget(index: number, widget: Widget): void {\n if (widget !== this.currentWidget) {\n widget.hide();\n }\n this.stackedPanel.insertWidget(index, widget);\n this.tabBar.insertTab(index, widget.title);\n\n widget.node.setAttribute('role', 'tabpanel');\n\n let renderer = this.tabBar.renderer;\n if (renderer instanceof TabBar.Renderer) {\n let tabId = renderer.createTabKey({\n title: widget.title,\n current: false,\n zIndex: 0\n });\n widget.node.setAttribute('aria-labelledby', tabId);\n }\n }\n\n /**\n * Handle the `currentChanged` signal from the tab bar.\n */\n private _onCurrentChanged(\n sender: TabBar,\n args: TabBar.ICurrentChangedArgs\n ): void {\n // Extract the previous and current title from the args.\n let { previousIndex, previousTitle, currentIndex, currentTitle } = args;\n\n // Extract the widgets from the titles.\n let previousWidget = previousTitle ? previousTitle.owner : null;\n let currentWidget = currentTitle ? currentTitle.owner : null;\n\n // Hide the previous widget.\n if (previousWidget) {\n previousWidget.hide();\n }\n\n // Show the current widget.\n if (currentWidget) {\n currentWidget.show();\n }\n\n // Emit the `currentChanged` signal for the tab panel.\n this._currentChanged.emit({\n previousIndex,\n previousWidget,\n currentIndex,\n currentWidget\n });\n\n // Flush the message loop on IE and Edge to prevent flicker.\n if (Platform.IS_EDGE || Platform.IS_IE) {\n MessageLoop.flush();\n }\n }\n\n /**\n * Handle the `tabAddRequested` signal from the tab bar.\n */\n private _onTabAddRequested(sender: TabBar, args: void): void {\n this._addRequested.emit(sender);\n }\n\n /**\n * Handle the `tabActivateRequested` signal from the tab bar.\n */\n private _onTabActivateRequested(\n sender: TabBar,\n args: TabBar.ITabActivateRequestedArgs\n ): void {\n args.title.owner.activate();\n }\n\n /**\n * Handle the `tabCloseRequested` signal from the tab bar.\n */\n private _onTabCloseRequested(\n sender: TabBar,\n args: TabBar.ITabCloseRequestedArgs\n ): void {\n args.title.owner.close();\n }\n\n /**\n * Handle the `tabMoved` signal from the tab bar.\n */\n private _onTabMoved(\n sender: TabBar,\n args: TabBar.ITabMovedArgs\n ): void {\n this.stackedPanel.insertWidget(args.toIndex, args.title.owner);\n }\n\n /**\n * Handle the `widgetRemoved` signal from the stacked panel.\n */\n private _onWidgetRemoved(sender: StackedPanel, widget: Widget): void {\n widget.node.removeAttribute('role');\n widget.node.removeAttribute('aria-labelledby');\n this.tabBar.removeTab(widget.title);\n }\n\n private _tabPlacement: TabPanel.TabPlacement;\n private _currentChanged = new Signal(\n this\n );\n\n private _addRequested = new Signal>(this);\n}\n\n/**\n * The namespace for the `TabPanel` class statics.\n */\nexport namespace TabPanel {\n /**\n * A type alias for tab placement in a tab bar.\n */\n export type TabPlacement =\n | /**\n * The tabs are placed as a row above the content.\n */\n 'top'\n\n /**\n * The tabs are placed as a column to the left of the content.\n */\n | 'left'\n\n /**\n * The tabs are placed as a column to the right of the content.\n */\n | 'right'\n\n /**\n * The tabs are placed as a row below the content.\n */\n | 'bottom';\n\n /**\n * An options object for initializing a tab panel.\n */\n export interface IOptions {\n /**\n * The document to use with the tab panel.\n *\n * The default is the global `document` instance.\n */\n document?: Document | ShadowRoot;\n\n /**\n * Whether the tabs are movable by the user.\n *\n * The default is `false`.\n */\n tabsMovable?: boolean;\n\n /**\n * Whether the button to add new tabs is enabled.\n *\n * The default is `false`.\n */\n addButtonEnabled?: boolean;\n\n /**\n * The placement of the tab bar relative to the content.\n *\n * The default is `'top'`.\n */\n tabPlacement?: TabPlacement;\n\n /**\n * The renderer for the panel's tab bar.\n *\n * The default is a shared renderer instance.\n */\n renderer?: TabBar.IRenderer;\n }\n\n /**\n * The arguments object for the `currentChanged` signal.\n */\n export interface ICurrentChangedArgs {\n /**\n * The previously selected index.\n */\n previousIndex: number;\n\n /**\n * The previously selected widget.\n */\n previousWidget: Widget | null;\n\n /**\n * The currently selected index.\n */\n currentIndex: number;\n\n /**\n * The currently selected widget.\n */\n currentWidget: Widget | null;\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * Convert a tab placement to tab bar orientation.\n */\n export function orientationFromPlacement(\n plc: TabPanel.TabPlacement\n ): TabBar.Orientation {\n return placementToOrientationMap[plc];\n }\n\n /**\n * Convert a tab placement to a box layout direction.\n */\n export function directionFromPlacement(\n plc: TabPanel.TabPlacement\n ): BoxLayout.Direction {\n return placementToDirectionMap[plc];\n }\n\n /**\n * A mapping of tab placement to tab bar orientation.\n */\n const placementToOrientationMap: { [key: string]: TabBar.Orientation } = {\n top: 'horizontal',\n left: 'vertical',\n right: 'vertical',\n bottom: 'horizontal'\n };\n\n /**\n * A mapping of tab placement to box layout direction.\n */\n const placementToDirectionMap: { [key: string]: BoxLayout.Direction } = {\n top: 'top-to-bottom',\n left: 'left-to-right',\n right: 'right-to-left',\n bottom: 'bottom-to-top'\n };\n}\n"],"names":["BoxEngine","Signal","Private","MessageLoop","AttachedProperty","Message","ConflatableMessage","ElementExt","ArrayExt","Utils","UUID","Drag","VirtualDOM","h","StringExt","CommandRegistry","JSONExt","getKeyboardLayout","DisposableDelegate","Selector","empty","find","Platform","MimeData","max"],"mappings":";;;;;;IAAA;IACA;IACA;;;;;;IAM+E;IAE/E;;;;;;;;;IASG;UACU,QAAQ,CAAA;IAArB,IAAA,WAAA,GAAA;IACE;;;;;;;;;;;;IAYG;YACH,IAAQ,CAAA,QAAA,GAAG,CAAC,CAAC;IAEb;;;;;;;;;;;;IAYG;YACH,IAAO,CAAA,OAAA,GAAG,CAAC,CAAC;IAEZ;;;;;;;;;;;;IAYG;YACH,IAAO,CAAA,OAAA,GAAG,QAAQ,CAAC;IAEnB;;;;;;;;;;;;;;;IAeG;YACH,IAAO,CAAA,OAAA,GAAG,CAAC,CAAC;IAEZ;;;;;;;;;;;IAWG;YACH,IAAI,CAAA,IAAA,GAAG,CAAC,CAAC;IAET;;;;;;;IAOG;YACH,IAAI,CAAA,IAAA,GAAG,KAAK,CAAC;SACd;IAAA,CAAA;IAED;;IAEG;AACcA,+BA0XhB;IA1XD,CAAA,UAAiB,SAAS,EAAA;IACxB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA6DG;IACH,IAAA,SAAgB,IAAI,CAAC,MAA2B,EAAE,KAAa,EAAA;;IAE7D,QAAA,IAAI,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC;YAC1B,IAAI,KAAK,KAAK,CAAC,EAAE;IACf,YAAA,OAAO,KAAK,CAAC;IACd,SAAA;;YAGD,IAAI,QAAQ,GAAG,CAA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AA,IAAI,EAAE,eAAe;IACrB,QAAA,KAAK,EAAE,eAAe;IACtB,QAAA,MAAM,EAAE,eAAe;SACxB,CAAC;IACJ,CAAC,EAtCS,OAAO,KAAP,OAAO,GAsChB,EAAA,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} +\ No newline at end of file +diff --git a/node_modules/@lumino/widgets/dist/index.min.js b/node_modules/@lumino/widgets/dist/index.min.js +index a8be66a..94ead69 100644 +--- a/node_modules/@lumino/widgets/dist/index.min.js ++++ b/node_modules/@lumino/widgets/dist/index.min.js +@@ -1,2 +1,2 @@ +-!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@lumino/algorithm"),require("@lumino/coreutils"),require("@lumino/domutils"),require("@lumino/messaging"),require("@lumino/properties"),require("@lumino/signaling"),require("@lumino/dragdrop"),require("@lumino/commands"),require("@lumino/virtualdom"),require("@lumino/disposable"),require("@lumino/keyboard")):"function"==typeof define&&define.amd?define(["exports","@lumino/algorithm","@lumino/coreutils","@lumino/domutils","@lumino/messaging","@lumino/properties","@lumino/signaling","@lumino/dragdrop","@lumino/commands","@lumino/virtualdom","@lumino/disposable","@lumino/keyboard"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).lumino_widgets={},e.lumino_algorithm,e.lumino_coreutils,e.lumino_domutils,e.lumino_messaging,e.lumino_properties,e.lumino_signaling,e.lumino_dragdrop,e.lumino_commands,e.lumino_virtualdom,e.lumino_disposable,e.lumino_keyboard)}(this,(function(e,t,i,s,n,a,r,o,h,d,l,c){"use strict";class u{constructor(){this.sizeHint=0,this.minSize=0,this.maxSize=1/0,this.stretch=1,this.size=0,this.done=!1}}var m,g,p,_;e.BoxEngine=void 0,(m=e.BoxEngine||(e.BoxEngine={})).calc=function(e,t){let i=e.length;if(0===i)return t;let s=0,n=0,a=0,r=0,o=0;for(let t=0;t0&&(r+=i.stretch,o++)}if(t===a)return 0;if(t<=s){for(let t=0;t=n){for(let t=0;t0&&s>h;){let t=s,n=r;for(let a=0;a0&&s>h;){let t=s/d;for(let n=0;n0&&s>h;){let t=s,n=r;for(let a=0;a=i.maxSize?(s-=i.maxSize-i.size,r-=i.stretch,i.size=i.maxSize,i.done=!0,d--,o--):(s-=h,i.size+=h)}}for(;d>0&&s>h;){let t=s/d;for(let n=0;n=i.maxSize?(s-=i.maxSize-i.size,i.size=i.maxSize,i.done=!0,d--):(s-=t,i.size+=t))}}}return 0},m.adjust=function(e,t,i){0!==e.length&&0!==i&&(i>0?function(e,t,i){let s=0;for(let i=0;i<=t;++i){let t=e[i];s+=t.maxSize-t.size}let n=0;for(let i=t+1,s=e.length;i=0&&a>0;--i){let t=e[i],s=t.maxSize-t.size;s>=a?(t.sizeHint=t.size+a,a=0):(t.sizeHint=t.size+s,a-=s)}let r=i;for(let i=t+1,s=e.length;i0;++i){let t=e[i],s=t.size-t.minSize;s>=r?(t.sizeHint=t.size-r,r=0):(t.sizeHint=t.size-s,r-=s)}}(e,t,i):function(e,t,i){let s=0;for(let i=t+1,n=e.length;i0;++i){let t=e[i],s=t.maxSize-t.size;s>=a?(t.sizeHint=t.size+a,a=0):(t.sizeHint=t.size+s,a-=s)}let r=i;for(let i=t;i>=0&&r>0;--i){let t=e[i],s=t.size-t.minSize;s>=r?(t.sizeHint=t.size-r,r=0):(t.sizeHint=t.size-s,r-=s)}}(e,t,-i))};class f{constructor(e){this._label="",this._caption="",this._mnemonic=-1,this._icon=void 0,this._iconClass="",this._iconLabel="",this._className="",this._closable=!1,this._changed=new r.Signal(this),this._isDisposed=!1,this.owner=e.owner,void 0!==e.label&&(this._label=e.label),void 0!==e.mnemonic&&(this._mnemonic=e.mnemonic),void 0!==e.icon&&(this._icon=e.icon),void 0!==e.iconClass&&(this._iconClass=e.iconClass),void 0!==e.iconLabel&&(this._iconLabel=e.iconLabel),void 0!==e.caption&&(this._caption=e.caption),void 0!==e.className&&(this._className=e.className),void 0!==e.closable&&(this._closable=e.closable),this._dataset=e.dataset||{}}get changed(){return this._changed}get label(){return this._label}set label(e){this._label!==e&&(this._label=e,this._changed.emit(void 0))}get mnemonic(){return this._mnemonic}set mnemonic(e){this._mnemonic!==e&&(this._mnemonic=e,this._changed.emit(void 0))}get icon(){return this._icon}set icon(e){this._icon!==e&&(this._icon=e,this._changed.emit(void 0))}get iconClass(){return this._iconClass}set iconClass(e){this._iconClass!==e&&(this._iconClass=e,this._changed.emit(void 0))}get iconLabel(){return this._iconLabel}set iconLabel(e){this._iconLabel!==e&&(this._iconLabel=e,this._changed.emit(void 0))}get caption(){return this._caption}set caption(e){this._caption!==e&&(this._caption=e,this._changed.emit(void 0))}get className(){return this._className}set className(e){this._className!==e&&(this._className=e,this._changed.emit(void 0))}get closable(){return this._closable}set closable(e){this._closable!==e&&(this._closable=e,this._changed.emit(void 0))}get dataset(){return this._dataset}set dataset(e){this._dataset!==e&&(this._dataset=e,this._changed.emit(void 0))}get isDisposed(){return this._isDisposed}dispose(){this.isDisposed||(this._isDisposed=!0,r.Signal.clearData(this))}}class b{constructor(e={}){this._flags=0,this._layout=null,this._parent=null,this._disposed=new r.Signal(this),this._hiddenMode=b.HiddenMode.Display,this.node=g.createNode(e),this.addClass("lm-Widget")}dispose(){this.isDisposed||(this.setFlag(b.Flag.IsDisposed),this._disposed.emit(void 0),this.parent?this.parent=null:this.isAttached&&b.detach(this),this._layout&&(this._layout.dispose(),this._layout=null),this.title.dispose(),r.Signal.clearData(this),n.MessageLoop.clearData(this),a.AttachedProperty.clearData(this))}get disposed(){return this._disposed}get isDisposed(){return this.testFlag(b.Flag.IsDisposed)}get isAttached(){return this.testFlag(b.Flag.IsAttached)}get isHidden(){return this.testFlag(b.Flag.IsHidden)}get isVisible(){let e=this;do{if(e.isHidden||!e.isAttached)return!1;e=e.parent}while(null!=e);return!0}get title(){return g.titleProperty.get(this)}get id(){return this.node.id}set id(e){this.node.id=e}get dataset(){return this.node.dataset}get hiddenMode(){return this._hiddenMode}set hiddenMode(e){this._hiddenMode!==e&&(this.isHidden&&this._toggleHidden(!1),e==b.HiddenMode.Scale?this.node.style.willChange="transform":this.node.style.willChange="auto",this._hiddenMode=e,this.isHidden&&this._toggleHidden(!0))}get parent(){return this._parent}set parent(e){if(this._parent!==e){if(e&&this.contains(e))throw new Error("Invalid parent widget.");if(this._parent&&!this._parent.isDisposed){let e=new b.ChildMessage("child-removed",this);n.MessageLoop.sendMessage(this._parent,e)}if(this._parent=e,this._parent&&!this._parent.isDisposed){let e=new b.ChildMessage("child-added",this);n.MessageLoop.sendMessage(this._parent,e)}this.isDisposed||n.MessageLoop.sendMessage(this,b.Msg.ParentChanged)}}get layout(){return this._layout}set layout(e){if(this._layout!==e){if(this.testFlag(b.Flag.DisallowLayout))throw new Error("Cannot set widget layout.");if(this._layout)throw new Error("Cannot change widget layout.");if(e.parent)throw new Error("Cannot change layout parent.");this._layout=e,e.parent=this}}*children(){this._layout&&(yield*this._layout)}contains(e){for(let t=e;t;t=t._parent)if(t===this)return!0;return!1}hasClass(e){return this.node.classList.contains(e)}addClass(e){this.node.classList.add(e)}removeClass(e){this.node.classList.remove(e)}toggleClass(e,t){return!0===t?(this.node.classList.add(e),!0):!1===t?(this.node.classList.remove(e),!1):this.node.classList.toggle(e)}update(){n.MessageLoop.postMessage(this,b.Msg.UpdateRequest)}fit(){n.MessageLoop.postMessage(this,b.Msg.FitRequest)}activate(){n.MessageLoop.postMessage(this,b.Msg.ActivateRequest)}close(){n.MessageLoop.sendMessage(this,b.Msg.CloseRequest)}show(){if(this.testFlag(b.Flag.IsHidden)&&(!this.isAttached||this.parent&&!this.parent.isVisible||n.MessageLoop.sendMessage(this,b.Msg.BeforeShow),this.clearFlag(b.Flag.IsHidden),this._toggleHidden(!1),!this.isAttached||this.parent&&!this.parent.isVisible||n.MessageLoop.sendMessage(this,b.Msg.AfterShow),this.parent)){let e=new b.ChildMessage("child-shown",this);n.MessageLoop.sendMessage(this.parent,e)}}hide(){if(!this.testFlag(b.Flag.IsHidden)&&(!this.isAttached||this.parent&&!this.parent.isVisible||n.MessageLoop.sendMessage(this,b.Msg.BeforeHide),this.setFlag(b.Flag.IsHidden),this._toggleHidden(!0),!this.isAttached||this.parent&&!this.parent.isVisible||n.MessageLoop.sendMessage(this,b.Msg.AfterHide),this.parent)){let e=new b.ChildMessage("child-hidden",this);n.MessageLoop.sendMessage(this.parent,e)}}setHidden(e){e?this.hide():this.show()}testFlag(e){return 0!=(this._flags&e)}setFlag(e){this._flags|=e}clearFlag(e){this._flags&=~e}processMessage(e){switch(e.type){case"resize":this.notifyLayout(e),this.onResize(e);break;case"update-request":this.notifyLayout(e),this.onUpdateRequest(e);break;case"fit-request":this.notifyLayout(e),this.onFitRequest(e);break;case"before-show":this.notifyLayout(e),this.onBeforeShow(e);break;case"after-show":this.setFlag(b.Flag.IsVisible),this.notifyLayout(e),this.onAfterShow(e);break;case"before-hide":this.notifyLayout(e),this.onBeforeHide(e);break;case"after-hide":this.clearFlag(b.Flag.IsVisible),this.notifyLayout(e),this.onAfterHide(e);break;case"before-attach":this.notifyLayout(e),this.onBeforeAttach(e);break;case"after-attach":this.isHidden||this.parent&&!this.parent.isVisible||this.setFlag(b.Flag.IsVisible),this.setFlag(b.Flag.IsAttached),this.notifyLayout(e),this.onAfterAttach(e);break;case"before-detach":this.notifyLayout(e),this.onBeforeDetach(e);break;case"after-detach":this.clearFlag(b.Flag.IsVisible),this.clearFlag(b.Flag.IsAttached),this.notifyLayout(e),this.onAfterDetach(e);break;case"activate-request":this.notifyLayout(e),this.onActivateRequest(e);break;case"close-request":this.notifyLayout(e),this.onCloseRequest(e);break;case"child-added":this.notifyLayout(e),this.onChildAdded(e);break;case"child-removed":this.notifyLayout(e),this.onChildRemoved(e);break;default:this.notifyLayout(e)}}notifyLayout(e){this._layout&&this._layout.processParentMessage(e)}onCloseRequest(e){this.parent?this.parent=null:this.isAttached&&b.detach(this)}onResize(e){}onUpdateRequest(e){}onFitRequest(e){}onActivateRequest(e){}onBeforeShow(e){}onAfterShow(e){}onBeforeHide(e){}onAfterHide(e){}onBeforeAttach(e){}onAfterAttach(e){}onBeforeDetach(e){}onAfterDetach(e){}onChildAdded(e){}onChildRemoved(e){}_toggleHidden(e){if(e)switch(this._hiddenMode){case b.HiddenMode.Display:this.addClass("lm-mod-hidden");break;case b.HiddenMode.Scale:this.node.style.transform="scale(0)",this.node.setAttribute("aria-hidden","true");break;case b.HiddenMode.ContentVisibility:this.node.style.contentVisibility="hidden",this.node.style.zIndex="-1"}else switch(this._hiddenMode){case b.HiddenMode.Display:this.removeClass("lm-mod-hidden");break;case b.HiddenMode.Scale:this.node.style.transform="",this.node.removeAttribute("aria-hidden");break;case b.HiddenMode.ContentVisibility:this.node.style.contentVisibility="",this.node.style.zIndex=""}}}!function(e){var t,i,s;(t=e.HiddenMode||(e.HiddenMode={}))[t.Display=0]="Display",t[t.Scale=1]="Scale",t[t.ContentVisibility=2]="ContentVisibility",(i=e.Flag||(e.Flag={}))[i.IsDisposed=1]="IsDisposed",i[i.IsAttached=2]="IsAttached",i[i.IsHidden=4]="IsHidden",i[i.IsVisible=8]="IsVisible",i[i.DisallowLayout=16]="DisallowLayout",(s=e.Msg||(e.Msg={})).BeforeShow=new n.Message("before-show"),s.AfterShow=new n.Message("after-show"),s.BeforeHide=new n.Message("before-hide"),s.AfterHide=new n.Message("after-hide"),s.BeforeAttach=new n.Message("before-attach"),s.AfterAttach=new n.Message("after-attach"),s.BeforeDetach=new n.Message("before-detach"),s.AfterDetach=new n.Message("after-detach"),s.ParentChanged=new n.Message("parent-changed"),s.UpdateRequest=new n.ConflatableMessage("update-request"),s.FitRequest=new n.ConflatableMessage("fit-request"),s.ActivateRequest=new n.ConflatableMessage("activate-request"),s.CloseRequest=new n.ConflatableMessage("close-request");class a extends n.Message{constructor(e,t){super(e),this.child=t}}e.ChildMessage=a;class r extends n.Message{constructor(e,t){super("resize"),this.width=e,this.height=t}}e.ResizeMessage=r,function(e){e.UnknownSize=new e(-1,-1)}(r=e.ResizeMessage||(e.ResizeMessage={})),e.attach=function(t,i,s=null){if(t.parent)throw new Error("Cannot attach a child widget.");if(t.isAttached||t.node.isConnected)throw new Error("Widget is already attached.");if(!i.isConnected)throw new Error("Host is not attached.");n.MessageLoop.sendMessage(t,e.Msg.BeforeAttach),i.insertBefore(t.node,s),n.MessageLoop.sendMessage(t,e.Msg.AfterAttach)},e.detach=function(t){if(t.parent)throw new Error("Cannot detach a child widget.");if(!t.isAttached||!t.node.isConnected)throw new Error("Widget is not attached.");n.MessageLoop.sendMessage(t,e.Msg.BeforeDetach),t.node.parentNode.removeChild(t.node),n.MessageLoop.sendMessage(t,e.Msg.AfterDetach)}}(b||(b={})),function(e){e.titleProperty=new a.AttachedProperty({name:"title",create:e=>new f({owner:e})}),e.createNode=function(e){return e.node||document.createElement(e.tag||"div")}}(g||(g={}));class v{constructor(e={}){this._disposed=!1,this._parent=null,this._fitPolicy=e.fitPolicy||"set-min-size"}dispose(){this._parent=null,this._disposed=!0,r.Signal.clearData(this),a.AttachedProperty.clearData(this)}get isDisposed(){return this._disposed}get parent(){return this._parent}set parent(e){if(this._parent!==e){if(this._parent)throw new Error("Cannot change parent widget.");if(e.layout!==this)throw new Error("Invalid parent widget.");this._parent=e,this.init()}}get fitPolicy(){return this._fitPolicy}set fitPolicy(e){if(this._fitPolicy!==e&&(this._fitPolicy=e,this._parent)){let e=this._parent.node.style;e.minWidth="",e.minHeight="",e.maxWidth="",e.maxHeight="",this._parent.fit()}}processParentMessage(e){switch(e.type){case"resize":this.onResize(e);break;case"update-request":this.onUpdateRequest(e);break;case"fit-request":this.onFitRequest(e);break;case"before-show":this.onBeforeShow(e);break;case"after-show":this.onAfterShow(e);break;case"before-hide":this.onBeforeHide(e);break;case"after-hide":this.onAfterHide(e);break;case"before-attach":this.onBeforeAttach(e);break;case"after-attach":this.onAfterAttach(e);break;case"before-detach":this.onBeforeDetach(e);break;case"after-detach":this.onAfterDetach(e);break;case"child-removed":this.onChildRemoved(e);break;case"child-shown":this.onChildShown(e);break;case"child-hidden":this.onChildHidden(e)}}init(){for(const e of this)e.parent=this.parent}onResize(e){for(const e of this)n.MessageLoop.sendMessage(e,b.ResizeMessage.UnknownSize)}onUpdateRequest(e){for(const e of this)n.MessageLoop.sendMessage(e,b.ResizeMessage.UnknownSize)}onBeforeAttach(e){for(const t of this)n.MessageLoop.sendMessage(t,e)}onAfterAttach(e){for(const t of this)n.MessageLoop.sendMessage(t,e)}onBeforeDetach(e){for(const t of this)n.MessageLoop.sendMessage(t,e)}onAfterDetach(e){for(const t of this)n.MessageLoop.sendMessage(t,e)}onBeforeShow(e){for(const t of this)t.isHidden||n.MessageLoop.sendMessage(t,e)}onAfterShow(e){for(const t of this)t.isHidden||n.MessageLoop.sendMessage(t,e)}onBeforeHide(e){for(const t of this)t.isHidden||n.MessageLoop.sendMessage(t,e)}onAfterHide(e){for(const t of this)t.isHidden||n.MessageLoop.sendMessage(t,e)}onChildRemoved(e){this.removeWidget(e.child)}onFitRequest(e){}onChildShown(e){}onChildHidden(e){}}!function(e){e.getHorizontalAlignment=function(e){return p.horizontalAlignmentProperty.get(e)},e.setHorizontalAlignment=function(e,t){p.horizontalAlignmentProperty.set(e,t)},e.getVerticalAlignment=function(e){return p.verticalAlignmentProperty.get(e)},e.setVerticalAlignment=function(e,t){p.verticalAlignmentProperty.set(e,t)}}(v||(v={}));class x{constructor(e){this._top=NaN,this._left=NaN,this._width=NaN,this._height=NaN,this._minWidth=0,this._minHeight=0,this._maxWidth=1/0,this._maxHeight=1/0,this._disposed=!1,this.widget=e,this.widget.node.style.position="absolute",this.widget.node.style.contain="strict"}dispose(){if(this._disposed)return;this._disposed=!0;let e=this.widget.node.style;e.position="",e.top="",e.left="",e.width="",e.height="",e.contain=""}get minWidth(){return this._minWidth}get minHeight(){return this._minHeight}get maxWidth(){return this._maxWidth}get maxHeight(){return this._maxHeight}get isDisposed(){return this._disposed}get isHidden(){return this.widget.isHidden}get isVisible(){return this.widget.isVisible}get isAttached(){return this.widget.isAttached}fit(){let e=s.ElementExt.sizeLimits(this.widget.node);this._minWidth=e.minWidth,this._minHeight=e.minHeight,this._maxWidth=e.maxWidth,this._maxHeight=e.maxHeight}update(e,t,i,s){let a=Math.max(this._minWidth,Math.min(i,this._maxWidth)),r=Math.max(this._minHeight,Math.min(s,this._maxHeight));if(a"center",changed:t}),e.verticalAlignmentProperty=new a.AttachedProperty({name:"verticalAlignment",create:()=>"top",changed:t})}(p||(p={}));class M extends v{constructor(){super(...arguments),this._widgets=[]}dispose(){for(;this._widgets.length>0;)this._widgets.pop().dispose();super.dispose()}get widgets(){return this._widgets}*[Symbol.iterator](){yield*this._widgets}addWidget(e){this.insertWidget(this._widgets.length,e)}insertWidget(e,i){i.parent=this.parent;let s=this._widgets.indexOf(i),n=Math.max(0,Math.min(e,this._widgets.length));if(-1===s)return t.ArrayExt.insert(this._widgets,n,i),void(this.parent&&this.attachWidget(n,i));n===this._widgets.length&&n--,s!==n&&(t.ArrayExt.move(this._widgets,s,n),this.parent&&this.moveWidget(s,n,i))}removeWidget(e){this.removeWidgetAt(this._widgets.indexOf(e))}removeWidgetAt(e){let i=t.ArrayExt.removeAt(this._widgets,e);i&&this.parent&&this.detachWidget(e,i)}init(){super.init();let e=0;for(const t of this)this.attachWidget(e++,t)}attachWidget(e,t){let i=this.parent.node.children[e];this.parent.isAttached&&n.MessageLoop.sendMessage(t,b.Msg.BeforeAttach),this.parent.node.insertBefore(t.node,i),this.parent.isAttached&&n.MessageLoop.sendMessage(t,b.Msg.AfterAttach)}moveWidget(e,t,i){this.parent.isAttached&&n.MessageLoop.sendMessage(i,b.Msg.BeforeDetach),this.parent.node.removeChild(i.node),this.parent.isAttached&&n.MessageLoop.sendMessage(i,b.Msg.AfterDetach);let s=this.parent.node.children[t];this.parent.isAttached&&n.MessageLoop.sendMessage(i,b.Msg.BeforeAttach),this.parent.node.insertBefore(i.node,s),this.parent.isAttached&&n.MessageLoop.sendMessage(i,b.Msg.AfterAttach)}detachWidget(e,t){this.parent.isAttached&&n.MessageLoop.sendMessage(t,b.Msg.BeforeDetach),this.parent.node.removeChild(t.node),this.parent.isAttached&&n.MessageLoop.sendMessage(t,b.Msg.AfterDetach)}}!function(e){e.clampDimension=function(e){return Math.max(0,Math.floor(e))}}(_||(_={}));var y,w,A,E,C,S,I,z,L,T,D=_;class B extends M{constructor(e){super(),this.widgetOffset=0,this._fixed=0,this._spacing=4,this._dirty=!1,this._hasNormedSizes=!1,this._sizers=[],this._items=[],this._handles=[],this._box=null,this._alignment="start",this._orientation="horizontal",this.renderer=e.renderer,void 0!==e.orientation&&(this._orientation=e.orientation),void 0!==e.alignment&&(this._alignment=e.alignment),void 0!==e.spacing&&(this._spacing=_.clampDimension(e.spacing))}dispose(){for(const e of this._items)e.dispose();this._box=null,this._items.length=0,this._sizers.length=0,this._handles.length=0,super.dispose()}get orientation(){return this._orientation}set orientation(e){this._orientation!==e&&(this._orientation=e,this.parent&&(this.parent.dataset.orientation=e,this.parent.fit()))}get alignment(){return this._alignment}set alignment(e){this._alignment!==e&&(this._alignment=e,this.parent&&(this.parent.dataset.alignment=e,this.parent.update()))}get spacing(){return this._spacing}set spacing(e){e=_.clampDimension(e),this._spacing!==e&&(this._spacing=e,this.parent&&this.parent.fit())}get handles(){return this._handles}absoluteSizes(){return this._sizers.map((e=>e.size))}relativeSizes(){return y.normalize(this._sizers.map((e=>e.size)))}setRelativeSizes(e,t=!0){let i=this._sizers.length,s=e.slice(0,i);for(;s.length0&&(e.sizeHint=e.size);e.BoxEngine.adjust(this._sizers,t,s),this.parent&&this.parent.update()}}init(){this.parent.dataset.orientation=this.orientation,this.parent.dataset.alignment=this.alignment,super.init()}attachWidget(e,i){let s=new x(i),a=y.createHandle(this.renderer),r=y.averageSize(this._sizers),o=y.createSizer(r);t.ArrayExt.insert(this._items,e,s),t.ArrayExt.insert(this._sizers,e,o),t.ArrayExt.insert(this._handles,e,a),this.parent.isAttached&&n.MessageLoop.sendMessage(i,b.Msg.BeforeAttach),this.parent.node.appendChild(i.node),this.parent.node.appendChild(a),this.parent.isAttached&&n.MessageLoop.sendMessage(i,b.Msg.AfterAttach),this.parent.fit()}moveWidget(e,i,s){t.ArrayExt.move(this._items,e,i),t.ArrayExt.move(this._sizers,e,i),t.ArrayExt.move(this._handles,e,i),this.parent.fit()}detachWidget(e,i){let s=t.ArrayExt.removeAt(this._items,e),a=t.ArrayExt.removeAt(this._handles,e);t.ArrayExt.removeAt(this._sizers,e),this.parent.isAttached&&n.MessageLoop.sendMessage(i,b.Msg.BeforeDetach),this.parent.node.removeChild(i.node),this.parent.node.removeChild(a),this.parent.isAttached&&n.MessageLoop.sendMessage(i,b.Msg.AfterDetach),s.dispose(),this.parent.fit()}onBeforeShow(e){super.onBeforeShow(e),this.parent.update()}onBeforeAttach(e){super.onBeforeAttach(e),this.parent.fit()}onChildShown(e){this.parent.fit()}onChildHidden(e){this.parent.fit()}onResize(e){this.parent.isVisible&&this._update(e.width,e.height)}onUpdateRequest(e){this.parent.isVisible&&this._update(-1,-1)}onFitRequest(e){this.parent.isAttached&&this._fit()}updateItemPosition(e,t,i,s,n,a,r){const o=this._items[e];if(o.isHidden)return;let h=this._handles[e].style;t?(i+=this.widgetOffset,o.update(i,s,r,n),i+=r,h.top=`${s}px`,h.left=`${i}px`,h.width=`${this._spacing}px`,h.height=`${n}px`):(s+=this.widgetOffset,o.update(i,s,a,r),s+=r,h.top=`${s}px`,h.left=`${i}px`,h.width=`${a}px`,h.height=`${this._spacing}px`)}_fit(){let e=0,t=-1;for(let i=0,s=this._items.length;i0&&(s.sizeHint=s.size),t.isHidden?(s.minSize=0,s.maxSize=0):(t.fit(),s.stretch=B.getStretch(t.widget),i?(s.minSize=t.minWidth,s.maxSize=t.maxWidth,a+=t.minWidth,r=Math.max(r,t.minHeight)):(s.minSize=t.minHeight,s.maxSize=t.maxHeight,r+=t.minHeight,a=Math.max(a,t.minWidth)))}let o=this._box=s.ElementExt.boxSizing(this.parent.node);a+=o.horizontalSum,r+=o.verticalSum;let h=this.parent.node.style;h.minWidth=`${a}px`,h.minHeight=`${r}px`,this._dirty=!0,this.parent.parent&&n.MessageLoop.sendMessage(this.parent.parent,b.Msg.FitRequest),this._dirty&&n.MessageLoop.sendMessage(this.parent,b.Msg.UpdateRequest)}_update(t,i){this._dirty=!1;let n=0;for(let e=0,t=this._items.length;e0){let t;if(t=c?Math.max(0,o-this._fixed):Math.max(0,h-this._fixed),this._hasNormedSizes){for(let e of this._sizers)e.sizeHint*=t;this._hasNormedSizes=!1}let i=e.BoxEngine.calc(this._sizers,t);if(i>0)switch(this._alignment){case"start":break;case"center":d=0,l=i/2;break;case"end":d=0,l=i;break;case"justify":d=i/n,l=0;break;default:throw"unreachable"}}for(let e=0,t=this._items.length;e0,coerce:(e,t)=>Math.max(0,Math.floor(t)),changed:function(e){e.parent&&e.parent.layout instanceof B&&e.parent.fit()}}),e.createSizer=function(e){let t=new u;return t.sizeHint=Math.floor(e),t},e.createHandle=function(e){let t=e.createHandle();return t.style.position="absolute",t.style.contain="style",t},e.averageSize=function(e){return e.reduce(((e,t)=>e+t.size),0)/e.length||0},e.normalize=function(e){let t=e.length;if(0===t)return[];let i=e.reduce(((e,t)=>e+Math.abs(t)),0);return 0===i?e.map((e=>1/t)):e.map((e=>e/i))}}(y||(y={}));class k extends B{constructor(e){super({...e,orientation:e.orientation||"vertical"}),this._titles=[],this.titleSpace=e.titleSpace||22}get titleSpace(){return this.widgetOffset}set titleSpace(e){e=D.clampDimension(e),this.widgetOffset!==e&&(this.widgetOffset=e,this.parent&&this.parent.fit())}get titles(){return this._titles}dispose(){this.isDisposed||(this._titles.length=0,super.dispose())}updateTitle(e,t){const i=this._titles[e],s=i.classList.contains("lm-mod-expanded"),n=w.createTitle(this.renderer,t.title,s);this._titles[e]=n,this.parent.node.replaceChild(n,i)}insertWidget(e,t){t.id||(t.id=`id-${i.UUID.uuid4()}`),super.insertWidget(e,t)}attachWidget(e,i){const s=w.createTitle(this.renderer,i.title);t.ArrayExt.insert(this._titles,e,s),this.parent.node.appendChild(s),i.node.setAttribute("role","region"),i.node.setAttribute("aria-labelledby",s.id),super.attachWidget(e,i)}moveWidget(e,i,s){t.ArrayExt.move(this._titles,e,i),super.moveWidget(e,i,s)}detachWidget(e,i){const s=t.ArrayExt.removeAt(this._titles,e);this.parent.node.removeChild(s),super.detachWidget(e,i)}updateItemPosition(e,t,i,s,n,a,r){const o=this._titles[e].style;o.top=`${s}px`,o.left=`${i}px`,o.height=`${this.widgetOffset}px`,o.width=t?`${n}px`:`${a}px`,super.updateItemPosition(e,t,i,s,n,a,r)}}!function(e){e.createTitle=function(e,t,i=!0){const s=e.createSectionTitle(t);return s.style.position="absolute",s.style.contain="strict",s.setAttribute("aria-label",`${t.label} Section`),s.setAttribute("aria-expanded",i?"true":"false"),s.setAttribute("aria-controls",t.owner.id),i&&s.classList.add("lm-mod-expanded"),s}}(w||(w={}));class R extends b{constructor(e={}){super(),this.addClass("lm-Panel"),this.layout=A.createLayout(e)}get widgets(){return this.layout.widgets}addWidget(e){this.layout.addWidget(e)}insertWidget(e,t){this.layout.insertWidget(e,t)}}!function(e){e.createLayout=function(e){return e.layout||new M}}(A||(A={}));class N extends R{constructor(e={}){super({layout:E.createLayout(e)}),this._handleMoved=new r.Signal(this),this._pressData=null,this.addClass("lm-SplitPanel")}dispose(){this._releaseMouse(),super.dispose()}get orientation(){return this.layout.orientation}set orientation(e){this.layout.orientation=e}get alignment(){return this.layout.alignment}set alignment(e){this.layout.alignment=e}get spacing(){return this.layout.spacing}set spacing(e){this.layout.spacing=e}get renderer(){return this.layout.renderer}get handleMoved(){return this._handleMoved}get handles(){return this.layout.handles}relativeSizes(){return this.layout.relativeSizes()}setRelativeSizes(e,t=!0){this.layout.setRelativeSizes(e,t)}handleEvent(e){switch(e.type){case"pointerdown":this._evtPointerDown(e);break;case"pointermove":this._evtPointerMove(e);break;case"pointerup":this._evtPointerUp(e);break;case"keydown":this._evtKeyDown(e);break;case"contextmenu":e.preventDefault(),e.stopPropagation()}}onBeforeAttach(e){this.node.addEventListener("pointerdown",this)}onAfterDetach(e){this.node.removeEventListener("pointerdown",this),this._releaseMouse()}onChildAdded(e){e.child.addClass("lm-SplitPanel-child"),this._releaseMouse()}onChildRemoved(e){e.child.removeClass("lm-SplitPanel-child"),this._releaseMouse()}_evtKeyDown(e){this._pressData&&(e.preventDefault(),e.stopPropagation()),27===e.keyCode&&this._releaseMouse()}_evtPointerDown(e){if(0!==e.button)return;let i,s=this.layout,n=t.ArrayExt.findFirstIndex(s.handles,(t=>t.contains(e.target)));if(-1===n)return;e.preventDefault(),e.stopPropagation(),document.addEventListener("pointerup",this,!0),document.addEventListener("pointermove",this,!0),document.addEventListener("keydown",this,!0),document.addEventListener("contextmenu",this,!0);let a=s.handles[n],r=a.getBoundingClientRect();i="horizontal"===s.orientation?e.clientX-r.left:e.clientY-r.top;let h=window.getComputedStyle(a),d=o.Drag.overrideCursor(h.cursor);this._pressData={index:n,delta:i,override:d}}_evtPointerMove(e){let t;e.preventDefault(),e.stopPropagation();let i=this.layout,s=this.node.getBoundingClientRect();t="horizontal"===i.orientation?e.clientX-s.left-this._pressData.delta:e.clientY-s.top-this._pressData.delta,i.moveHandle(this._pressData.index,t)}_evtPointerUp(e){0===e.button&&(e.preventDefault(),e.stopPropagation(),this._releaseMouse())}_releaseMouse(){this._pressData&&(this._pressData.override.dispose(),this._pressData=null,this._handleMoved.emit(),document.removeEventListener("keydown",this,!0),document.removeEventListener("pointerup",this,!0),document.removeEventListener("pointermove",this,!0),document.removeEventListener("contextmenu",this,!0))}}!function(e){class t{createHandle(){let e=document.createElement("div");return e.className="lm-SplitPanel-handle",e}}e.Renderer=t,e.defaultRenderer=new t,e.getStretch=function(e){return B.getStretch(e)},e.setStretch=function(e,t){B.setStretch(e,t)}}(N||(N={})),function(e){e.createLayout=function(e){return e.layout||new B({renderer:e.renderer||N.defaultRenderer,orientation:e.orientation,alignment:e.alignment,spacing:e.spacing})}}(E||(E={}));class H extends N{constructor(e={}){super({...e,layout:C.createLayout(e)}),this._widgetSizesCache=new WeakMap,this._expansionToggled=new r.Signal(this),this.addClass("lm-AccordionPanel")}get renderer(){return this.layout.renderer}get titleSpace(){return this.layout.titleSpace}set titleSpace(e){this.layout.titleSpace=e}get titles(){return this.layout.titles}get expansionToggled(){return this._expansionToggled}addWidget(e){super.addWidget(e),e.title.changed.connect(this._onTitleChanged,this)}collapse(e){const t=this.layout.widgets[e];t&&!t.isHidden&&this._toggleExpansion(e)}expand(e){const t=this.layout.widgets[e];t&&t.isHidden&&this._toggleExpansion(e)}insertWidget(e,t){super.insertWidget(e,t),t.title.changed.connect(this._onTitleChanged,this)}handleEvent(e){switch(super.handleEvent(e),e.type){case"click":this._evtClick(e);break;case"keydown":this._eventKeyDown(e)}}onBeforeAttach(e){this.node.addEventListener("click",this),this.node.addEventListener("keydown",this),super.onBeforeAttach(e)}onAfterDetach(e){super.onAfterDetach(e),this.node.removeEventListener("click",this),this.node.removeEventListener("keydown",this)}_onTitleChanged(e){const i=t.ArrayExt.findFirstIndex(this.widgets,(t=>t.contains(e.owner)));i>=0&&(this.layout.updateTitle(i,e.owner),this.update())}_computeWidgetSize(e){const t=this.layout,i=t.widgets[e];if(!i)return;const s=i.isHidden,n=t.absoluteSizes(),a=(s?-1:1)*this.spacing,r=n.reduce(((e,t)=>e+t));let o=[...n];if(s){const t=this._widgetSizesCache.get(i);if(!t)return;o[e]+=t;const s=o.map((e=>e-t>0)).lastIndexOf(!0);-1===s?o.forEach(((i,s)=>{s!==e&&(o[s]-=n[s]/r*(t-a))})):o[s]-=t-a}else{const t=n[e];this._widgetSizesCache.set(i,t),o[e]=0;const s=o.map((e=>e>0)).lastIndexOf(!0);if(-1===s)return;o[s]=n[s]+t+a}return o.map((e=>e/(r+a)))}_evtClick(e){const i=e.target;if(i){const s=t.ArrayExt.findFirstIndex(this.titles,(e=>e.contains(i)));s>=0&&(e.preventDefault(),e.stopPropagation(),this._toggleExpansion(s))}}_eventKeyDown(e){if(e.defaultPrevented)return;const i=e.target;let s=!1;if(i){const n=t.ArrayExt.findFirstIndex(this.titles,(e=>e.contains(i)));if(n>=0){const t=e.keyCode.toString();if(e.key.match(/Space|Enter/)||t.match(/13|32/))i.click(),s=!0;else if("horizontal"===this.orientation?e.key.match(/ArrowLeft|ArrowRight/)||t.match(/37|39/):e.key.match(/ArrowUp|ArrowDown/)||t.match(/38|40/)){const i=e.key.match(/ArrowLeft|ArrowUp/)||t.match(/37|38/)?-1:1,a=this.titles.length,r=(n+a+i)%a;this.titles[r].focus(),s=!0}else"End"===e.key||"35"===t?(this.titles[this.titles.length-1].focus(),s=!0):"Home"!==e.key&&"36"!==t||(this.titles[0].focus(),s=!0)}s&&e.preventDefault()}}_toggleExpansion(e){const t=this.titles[e],i=this.layout.widgets[e],s=this._computeWidgetSize(e);s&&this.setRelativeSizes(s,!1),i.isHidden?(t.classList.add("lm-mod-expanded"),t.setAttribute("aria-expanded","true"),i.show()):(t.classList.remove("lm-mod-expanded"),t.setAttribute("aria-expanded","false"),i.hide()),this._expansionToggled.emit(e)}}!function(e){class t extends N.Renderer{constructor(){super(),this.titleClassName="lm-AccordionPanel-title",this._titleID=0,this._titleKeys=new WeakMap,this._uuid=++t._nInstance}createCollapseIcon(e){return document.createElement("span")}createSectionTitle(e){const t=document.createElement("h3");t.setAttribute("tabindex","0"),t.id=this.createTitleKey(e),t.className=this.titleClassName;for(const i in e.dataset)t.dataset[i]=e.dataset[i];t.appendChild(this.createCollapseIcon(e)).className="lm-AccordionPanel-titleCollapser";const i=t.appendChild(document.createElement("span"));return i.className="lm-AccordionPanel-titleLabel",i.textContent=e.label,i.title=e.caption||e.label,t}createTitleKey(e){let t=this._titleKeys.get(e);return void 0===t&&(t=`title-key-${this._uuid}-${this._titleID++}`,this._titleKeys.set(e,t)),t}}t._nInstance=0,e.Renderer=t,e.defaultRenderer=new t}(H||(H={})),function(e){e.createLayout=function(e){return e.layout||new k({renderer:e.renderer||H.defaultRenderer,orientation:e.orientation,alignment:e.alignment,spacing:e.spacing,titleSpace:e.titleSpace})}}(C||(C={}));class P extends M{constructor(e={}){super(),this._fixed=0,this._spacing=4,this._dirty=!1,this._sizers=[],this._items=[],this._box=null,this._alignment="start",this._direction="top-to-bottom",void 0!==e.direction&&(this._direction=e.direction),void 0!==e.alignment&&(this._alignment=e.alignment),void 0!==e.spacing&&(this._spacing=D.clampDimension(e.spacing))}dispose(){for(const e of this._items)e.dispose();this._box=null,this._items.length=0,this._sizers.length=0,super.dispose()}get direction(){return this._direction}set direction(e){this._direction!==e&&(this._direction=e,this.parent&&(this.parent.dataset.direction=e,this.parent.fit()))}get alignment(){return this._alignment}set alignment(e){this._alignment!==e&&(this._alignment=e,this.parent&&(this.parent.dataset.alignment=e,this.parent.update()))}get spacing(){return this._spacing}set spacing(e){e=D.clampDimension(e),this._spacing!==e&&(this._spacing=e,this.parent&&this.parent.fit())}init(){this.parent.dataset.direction=this.direction,this.parent.dataset.alignment=this.alignment,super.init()}attachWidget(e,i){t.ArrayExt.insert(this._items,e,new x(i)),t.ArrayExt.insert(this._sizers,e,new u),this.parent.isAttached&&n.MessageLoop.sendMessage(i,b.Msg.BeforeAttach),this.parent.node.appendChild(i.node),this.parent.isAttached&&n.MessageLoop.sendMessage(i,b.Msg.AfterAttach),this.parent.fit()}moveWidget(e,i,s){t.ArrayExt.move(this._items,e,i),t.ArrayExt.move(this._sizers,e,i),this.parent.update()}detachWidget(e,i){let s=t.ArrayExt.removeAt(this._items,e);t.ArrayExt.removeAt(this._sizers,e),this.parent.isAttached&&n.MessageLoop.sendMessage(i,b.Msg.BeforeDetach),this.parent.node.removeChild(i.node),this.parent.isAttached&&n.MessageLoop.sendMessage(i,b.Msg.AfterDetach),s.dispose(),this.parent.fit()}onBeforeShow(e){super.onBeforeShow(e),this.parent.update()}onBeforeAttach(e){super.onBeforeAttach(e),this.parent.fit()}onChildShown(e){this.parent.fit()}onChildHidden(e){this.parent.fit()}onResize(e){this.parent.isVisible&&this._update(e.width,e.height)}onUpdateRequest(e){this.parent.isVisible&&this._update(-1,-1)}onFitRequest(e){this.parent.isAttached&&this._fit()}_fit(){let e=0;for(let t=0,i=this._items.length;t0)switch(this._alignment){case"start":break;case"center":l=0,c=a/2;break;case"end":l=0,c=a;break;case"justify":l=a/n,c=0;break;default:throw"unreachable"}for(let e=0,t=this._items.length;e0,coerce:(e,t)=>Math.max(0,Math.floor(t)),changed:t}),e.sizeBasisProperty=new a.AttachedProperty({name:"sizeBasis",create:()=>0,coerce:(e,t)=>Math.max(0,Math.floor(t)),changed:t}),e.isHorizontal=function(e){return"left-to-right"===e||"right-to-left"===e},e.clampSpacing=function(e){return Math.max(0,Math.floor(e))}}(S||(S={}));class W extends R{constructor(e={}){super({layout:I.createLayout(e)}),this.addClass("lm-BoxPanel")}get direction(){return this.layout.direction}set direction(e){this.layout.direction=e}get alignment(){return this.layout.alignment}set alignment(e){this.layout.alignment=e}get spacing(){return this.layout.spacing}set spacing(e){this.layout.spacing=e}onChildAdded(e){e.child.addClass("lm-BoxPanel-child")}onChildRemoved(e){e.child.removeClass("lm-BoxPanel-child")}}!function(e){e.getStretch=function(e){return P.getStretch(e)},e.setStretch=function(e,t){P.setStretch(e,t)},e.getSizeBasis=function(e){return P.getSizeBasis(e)},e.setSizeBasis=function(e,t){P.setSizeBasis(e,t)}}(W||(W={})),function(e){e.createLayout=function(e){return e.layout||new P(e)}}(I||(I={}));class q extends b{constructor(e){super({node:z.createNode()}),this._activeIndex=-1,this._items=[],this._results=null,this.addClass("lm-CommandPalette"),this.setFlag(b.Flag.DisallowLayout),this.commands=e.commands,this.renderer=e.renderer||q.defaultRenderer,this.commands.commandChanged.connect(this._onGenericChange,this),this.commands.keyBindingChanged.connect(this._onGenericChange,this)}dispose(){this._items.length=0,this._results=null,super.dispose()}get searchNode(){return this.node.getElementsByClassName("lm-CommandPalette-search")[0]}get inputNode(){return this.node.getElementsByClassName("lm-CommandPalette-input")[0]}get contentNode(){return this.node.getElementsByClassName("lm-CommandPalette-content")[0]}get items(){return this._items}addItem(e){let t=z.createItem(this.commands,e);return this._items.push(t),this.refresh(),t}addItems(e){const t=e.map((e=>z.createItem(this.commands,e)));return t.forEach((e=>this._items.push(e))),this.refresh(),t}removeItem(e){this.removeItemAt(this._items.indexOf(e))}removeItemAt(e){t.ArrayExt.removeAt(this._items,e)&&this.refresh()}clearItems(){0!==this._items.length&&(this._items.length=0,this.refresh())}refresh(){if(this._results=null,""!==this.inputNode.value){this.node.getElementsByClassName("lm-close-icon")[0].style.display="inherit"}else{this.node.getElementsByClassName("lm-close-icon")[0].style.display="none"}this.update()}handleEvent(e){switch(e.type){case"click":this._evtClick(e);break;case"keydown":this._evtKeyDown(e);break;case"input":this.refresh();break;case"focus":case"blur":this._toggleFocused()}}onBeforeAttach(e){this.node.addEventListener("click",this),this.node.addEventListener("keydown",this),this.node.addEventListener("input",this),this.node.addEventListener("focus",this,!0),this.node.addEventListener("blur",this,!0)}onAfterDetach(e){this.node.removeEventListener("click",this),this.node.removeEventListener("keydown",this),this.node.removeEventListener("input",this),this.node.removeEventListener("focus",this,!0),this.node.removeEventListener("blur",this,!0)}onAfterShow(e){this.update(),super.onAfterShow(e)}onActivateRequest(e){if(this.isAttached){let e=this.inputNode;e.focus(),e.select()}}onUpdateRequest(e){if(!this.isVisible)return void d.VirtualDOM.render(null,this.contentNode);let i=this.inputNode.value,n=this.contentNode,a=this._results;if(a||(a=this._results=z.search(this._items,i),this._activeIndex=i?t.ArrayExt.findFirstIndex(a,z.canActivate):-1),!i&&0===a.length)return void d.VirtualDOM.render(null,n);if(i&&0===a.length){let e=this.renderer.renderEmptyMessage({query:i});return void d.VirtualDOM.render(e,n)}let r=this.renderer,o=this._activeIndex,h=new Array(a.length);for(let e=0,t=a.length;e=a.length)n.scrollTop=0;else{let e=n.children[o];s.ElementExt.scrollIntoViewIfNeeded(n,e)}}_evtClick(e){if(0!==e.button)return;if(e.target.classList.contains("lm-close-icon"))return this.inputNode.value="",void this.refresh();let i=t.ArrayExt.findFirstIndex(this.contentNode.children,(t=>t.contains(e.target)));-1!==i&&(e.preventDefault(),e.stopPropagation(),this._execute(i))}_evtKeyDown(e){if(!(e.altKey||e.ctrlKey||e.metaKey||e.shiftKey))switch(e.keyCode){case 13:e.preventDefault(),e.stopPropagation(),this._execute(this._activeIndex);break;case 38:e.preventDefault(),e.stopPropagation(),this._activatePreviousItem();break;case 40:e.preventDefault(),e.stopPropagation(),this._activateNextItem()}}_activateNextItem(){if(!this._results||0===this._results.length)return;let e=this._activeIndex,i=this._results.length,s=ee-t)),l=r.slice(0,d),c=r.slice(d);for(let e=0,t=c.length;et.command===e&&i.JSONExt.deepEqual(t.args,s)))||null}}}(z||(z={}));class F extends b{constructor(e){super({node:L.createNode()}),this._childIndex=-1,this._activeIndex=-1,this._openTimerID=0,this._closeTimerID=0,this._items=[],this._childMenu=null,this._parentMenu=null,this._aboutToClose=new r.Signal(this),this._menuRequested=new r.Signal(this),this.addClass("lm-Menu"),this.setFlag(b.Flag.DisallowLayout),this.commands=e.commands,this.renderer=e.renderer||F.defaultRenderer}dispose(){this.close(),this._items.length=0,super.dispose()}get aboutToClose(){return this._aboutToClose}get menuRequested(){return this._menuRequested}get parentMenu(){return this._parentMenu}get childMenu(){return this._childMenu}get rootMenu(){let e=this;for(;e._parentMenu;)e=e._parentMenu;return e}get leafMenu(){let e=this;for(;e._childMenu;)e=e._childMenu;return e}get contentNode(){return this.node.getElementsByClassName("lm-Menu-content")[0]}get activeItem(){return this._items[this._activeIndex]||null}set activeItem(e){this.activeIndex=e?this._items.indexOf(e):-1}get activeIndex(){return this._activeIndex}set activeIndex(e){(e<0||e>=this._items.length)&&(e=-1),-1===e||L.canActivate(this._items[e])||(e=-1),this._activeIndex!==e&&(this._activeIndex=e,this._activeIndex>=0&&this.contentNode.childNodes[this._activeIndex]&&this.contentNode.childNodes[this._activeIndex].focus(),this.update())}get items(){return this._items}activateNextItem(){let e=this._items.length,i=this._activeIndex,s=i{this.activeIndex=e}})}d.VirtualDOM.render(a,this.contentNode)}onCloseRequest(e){this._cancelOpenTimer(),this._cancelCloseTimer(),this.activeIndex=-1;let t=this._childMenu;t&&(this._childIndex=-1,this._childMenu=null,t._parentMenu=null,t.close());let i=this._parentMenu;i&&(this._parentMenu=null,i._childIndex=-1,i._childMenu=null,i.activate()),this.isAttached&&this._aboutToClose.emit(void 0),super.onCloseRequest(e)}_evtKeyDown(e){e.preventDefault(),e.stopPropagation();let t=e.keyCode;if(13===t)return void this.triggerActiveItem();if(27===t)return void this.close();if(37===t)return void(this._parentMenu?this.close():this._menuRequested.emit("previous"));if(38===t)return void this.activatePreviousItem();if(39===t){let e=this.activeItem;return void(e&&"submenu"===e.type?this.triggerActiveItem():this.rootMenu._menuRequested.emit("next"))}if(40===t)return void this.activateNextItem();let i=c.getKeyboardLayout().keyForKeydownEvent(e);if(!i)return;let s=this._activeIndex+1,n=L.findMnemonic(this._items,i,s);-1===n.index||n.multiple?-1!==n.index?this.activeIndex=n.index:-1!==n.auto&&(this.activeIndex=n.auto):(this.activeIndex=n.index,this.triggerActiveItem())}_evtMouseUp(e){0===e.button&&(e.preventDefault(),e.stopPropagation(),this.triggerActiveItem())}_evtMouseMove(e){let i=t.ArrayExt.findFirstIndex(this.contentNode.children,(t=>s.ElementExt.hitTest(t,e.clientX,e.clientY)));if(i===this._activeIndex)return;if(this.activeIndex=i,i=this.activeIndex,i===this._childIndex)return this._cancelOpenTimer(),void this._cancelCloseTimer();-1!==this._childIndex&&this._startCloseTimer(),this._cancelOpenTimer();let n=this.activeItem;n&&"submenu"===n.type&&n.submenu&&this._startOpenTimer()}_evtMouseEnter(e){for(let e=this._parentMenu;e;e=e._parentMenu)e._cancelOpenTimer(),e._cancelCloseTimer(),e.activeIndex=e._childIndex}_evtMouseLeave(e){if(this._cancelOpenTimer(),!this._childMenu)return void(this.activeIndex=-1);let{clientX:t,clientY:i}=e;s.ElementExt.hitTest(this._childMenu.node,t,i)?this._cancelCloseTimer():(this.activeIndex=-1,this._startCloseTimer())}_evtMouseDown(e){this._parentMenu||(L.hitTestMenus(this,e.clientX,e.clientY)?(e.preventDefault(),e.stopPropagation()):this.close())}_openChildMenu(e=!1){let t=this.activeItem;if(!t||"submenu"!==t.type||!t.submenu)return void this._closeChildMenu();let i=t.submenu;if(i===this._childMenu)return;F.saveWindowData(),this._closeChildMenu(),this._childMenu=i,this._childIndex=this._activeIndex,i._parentMenu=this,n.MessageLoop.sendMessage(this,b.Msg.UpdateRequest);let s=this.contentNode.children[this._activeIndex];L.openSubmenu(i,s),e&&(i.activeIndex=-1,i.activateNextItem()),i.activate()}_closeChildMenu(){this._childMenu&&this._childMenu.close()}_startOpenTimer(){0===this._openTimerID&&(this._openTimerID=window.setTimeout((()=>{this._openTimerID=0,this._openChildMenu()}),L.TIMER_DELAY))}_startCloseTimer(){0===this._closeTimerID&&(this._closeTimerID=window.setTimeout((()=>{this._closeTimerID=0,this._closeChildMenu()}),L.TIMER_DELAY))}_cancelOpenTimer(){0!==this._openTimerID&&(clearTimeout(this._openTimerID),this._openTimerID=0)}_cancelCloseTimer(){0!==this._closeTimerID&&(clearTimeout(this._closeTimerID),this._closeTimerID=0)}static saveWindowData(){L.saveWindowData()}}!function(e){class t{renderItem(e){let t=this.createItemClass(e),i=this.createItemDataset(e),s=this.createItemARIA(e);return d.h.li({className:t,dataset:i,tabindex:"0",onfocus:e.onfocus,...s},this.renderIcon(e),this.renderLabel(e),this.renderShortcut(e),this.renderSubmenu(e))}renderIcon(e){let t=this.createIconClass(e);return d.h.div({className:t},e.item.icon,e.item.iconLabel)}renderLabel(e){let t=this.formatLabel(e);return d.h.div({className:"lm-Menu-itemLabel"},t)}renderShortcut(e){let t=this.formatShortcut(e);return d.h.div({className:"lm-Menu-itemShortcut"},t)}renderSubmenu(e){return d.h.div({className:"lm-Menu-itemSubmenuIcon"})}createItemClass(e){let t="lm-Menu-item";e.item.isEnabled||(t+=" lm-mod-disabled"),e.item.isToggled&&(t+=" lm-mod-toggled"),e.item.isVisible||(t+=" lm-mod-hidden"),e.active&&(t+=" lm-mod-active"),e.collapsed&&(t+=" lm-mod-collapsed");let i=e.item.className;return i&&(t+=` ${i}`),t}createItemDataset(e){let t,{type:i,command:s,dataset:n}=e.item;return t="command"===i?{...n,type:i,command:s}:{...n,type:i},t}createIconClass(e){let t="lm-Menu-itemIcon",i=e.item.iconClass;return i?`${t} ${i}`:t}createItemARIA(e){let t={};switch(e.item.type){case"separator":t.role="presentation";break;case"submenu":t["aria-haspopup"]="true",e.item.isEnabled||(t["aria-disabled"]="true");break;default:e.item.isEnabled||(t["aria-disabled"]="true"),e.item.isToggled?(t.role="menuitemcheckbox",t["aria-checked"]="true"):t.role="menuitem"}return t}formatLabel(e){let{label:t,mnemonic:i}=e.item;if(i<0||i>=t.length)return t;let s=t.slice(0,i),n=t.slice(i+1),a=t[i];return[s,d.h.span({className:"lm-Menu-itemMnemonic"},a),n]}formatShortcut(e){let t=e.item.keyBinding;return t?h.CommandRegistry.formatKeystroke(t.keys):null}}e.Renderer=t,e.defaultRenderer=new t}(F||(F={})),function(e){e.TIMER_DELAY=300,e.SUBMENU_OVERLAP=3;let a=null,r=0;function o(){return r>0?(r--,a):d()}function h(e){return"separator"!==e.type&&e.isEnabled&&e.isVisible}function d(){return{pageXOffset:window.pageXOffset,pageYOffset:window.pageYOffset,clientWidth:document.documentElement.clientWidth,clientHeight:document.documentElement.clientHeight}}e.saveWindowData=function(){a=d(),r++},e.createNode=function(){let e=document.createElement("div"),t=document.createElement("ul");return t.className="lm-Menu-content",e.appendChild(t),t.setAttribute("role","menu"),e.tabIndex=0,e},e.canActivate=h,e.createItem=function(e,t){return new l(e.commands,t)},e.hitTestMenus=function(e,t,i){for(let n=e;n;n=n.childMenu)if(s.ElementExt.hitTest(n.node,t,i))return!0;return!1},e.computeCollapsed=function(e){let i=new Array(e.length);t.ArrayExt.fill(i,!1);let s=0,n=e.length;for(;s=0;--a){let t=e[a];if(t.isVisible){if("separator"!==t.type)break;i[a]=!0}}let r=!1;for(;++sc+m&&(t=c+m-v),!a&&i+x>u+g&&(i>u+g?i=u+g-x:i-=x),f.transform=`translate(${Math.max(0,t)}px, ${Math.max(0,i)}px`,f.opacity="1"},e.openSubmenu=function(t,i){const a=o();let r=a.pageXOffset,h=a.pageYOffset,d=a.clientWidth,l=a.clientHeight;n.MessageLoop.sendMessage(t,b.Msg.UpdateRequest);let c=l,u=t.node,m=u.style;m.opacity="0",m.maxHeight=`${c}px`,b.attach(t,document.body);let{width:g,height:p}=u.getBoundingClientRect(),_=s.ElementExt.boxSizing(t.node),f=i.getBoundingClientRect(),v=f.right-e.SUBMENU_OVERLAP;v+g>r+d&&(v=f.left+e.SUBMENU_OVERLAP-g);let x=f.top-_.borderTop-_.paddingTop;x+p>h+l&&(x=f.bottom+_.borderBottom+_.paddingBottom-p),m.transform=`translate(${Math.max(0,v)}px, ${Math.max(0,x)}px`,m.opacity="1"},e.findMnemonic=function(e,t,i){let s=-1,n=-1,a=!1,r=t.toUpperCase();for(let t=0,o=e.length;t=0&&ut.command===e&&i.JSONExt.deepEqual(t.args,s)))||null}return null}}}(L||(L={}));!function(e){function t(e,t){let i=e.rank,s=t.rank;return i!==s?i=this._titles.length)&&(e=-1),this._currentIndex===e)return;let t=this._currentIndex,i=this._titles[t]||null,s=e,n=this._titles[s]||null;this._currentIndex=s,this._previousTitle=i,this.update(),this._currentChanged.emit({previousIndex:t,previousTitle:i,currentIndex:s,currentTitle:n})}get name(){return this._name}set name(e){this._name=e,e?this.contentNode.setAttribute("aria-label",e):this.contentNode.removeAttribute("aria-label")}get orientation(){return this._orientation}set orientation(e){this._orientation!==e&&(this._releaseMouse(),this._orientation=e,this.dataset.orientation=e,this.contentNode.setAttribute("aria-orientation",e))}get addButtonEnabled(){return this._addButtonEnabled}set addButtonEnabled(e){this._addButtonEnabled!==e&&(this._addButtonEnabled=e,e?this.addButtonNode.classList.remove("lm-mod-hidden"):this.addButtonNode.classList.add("lm-mod-hidden"))}get titles(){return this._titles}get contentNode(){return this.node.getElementsByClassName("lm-TabBar-content")[0]}get addButtonNode(){return this.node.getElementsByClassName("lm-TabBar-addButton")[0]}addTab(e){return this.insertTab(this._titles.length,e)}insertTab(e,i){this._releaseMouse();let s=V.asTitle(i),n=this._titles.indexOf(s),a=Math.max(0,Math.min(e,this._titles.length));return-1===n?(t.ArrayExt.insert(this._titles,a,s),s.changed.connect(this._onTitleChanged,this),this.update(),this._adjustCurrentForInsert(a,s),s):(a===this._titles.length&&a--,n===a||(t.ArrayExt.move(this._titles,n,a),this.update(),this._adjustCurrentForMove(n,a)),s)}removeTab(e){this.removeTabAt(this._titles.indexOf(e))}removeTabAt(e){this._releaseMouse();let i=t.ArrayExt.removeAt(this._titles,e);i&&(i.changed.disconnect(this._onTitleChanged,this),i===this._previousTitle&&(this._previousTitle=null),this.update(),this._adjustCurrentForRemove(e,i))}clearTabs(){if(0===this._titles.length)return;this._releaseMouse();for(let e of this._titles)e.changed.disconnect(this._onTitleChanged,this);let e=this.currentIndex,t=this.currentTitle;this._currentIndex=-1,this._previousTitle=null,this._titles.length=0,this.update(),-1!==e&&this._currentChanged.emit({previousIndex:e,previousTitle:t,currentIndex:-1,currentTitle:null})}releaseMouse(){this._releaseMouse()}handleEvent(e){switch(e.type){case"pointerdown":this._evtPointerDown(e);break;case"pointermove":this._evtPointerMove(e);break;case"pointerup":this._evtPointerUp(e);break;case"dblclick":this._evtDblClick(e);break;case"keydown":e.eventPhase===Event.CAPTURING_PHASE?this._evtKeyDownCapturing(e):this._evtKeyDown(e);break;case"contextmenu":e.preventDefault(),e.stopPropagation()}}onBeforeAttach(e){this.node.addEventListener("pointerdown",this),this.node.addEventListener("dblclick",this),this.node.addEventListener("keydown",this)}onAfterDetach(e){this.node.removeEventListener("pointerdown",this),this.node.removeEventListener("dblclick",this),this.node.removeEventListener("keydown",this),this._releaseMouse()}onUpdateRequest(e){var t;let i=this._titles,s=this.renderer,n=this.currentTitle,a=new Array(i.length);const r=null!==(t=this._getCurrentTabindex())&&void 0!==t?t:this._currentIndex>-1?this._currentIndex:0;for(let e=0,t=i.length;es.ElementExt.hitTest(t,e.clientX,e.clientY)));if(-1===n)return;let a=this.titles[n],r=i[n].querySelector(".lm-TabBar-tabLabel");if(r&&r.contains(e.target)){let e=a.label||"",t=r.innerHTML;r.innerHTML="";let i=document.createElement("input");i.classList.add("lm-TabBar-tabInput"),i.value=e,r.appendChild(i);let s=()=>{i.removeEventListener("blur",s),r.innerHTML=t,this.node.addEventListener("keydown",this)};i.addEventListener("dblclick",(e=>e.stopPropagation())),i.addEventListener("blur",s),i.addEventListener("keydown",(e=>{"Enter"===e.key?(""!==i.value&&(a.label=a.caption=i.value),s()):"Escape"===e.key&&s()})),this.node.removeEventListener("keydown",this),i.select(),i.focus(),r.children.length>0&&r.children[0].focus()}}_evtKeyDownCapturing(e){e.eventPhase===Event.CAPTURING_PHASE&&(e.preventDefault(),e.stopPropagation(),"Escape"===e.key&&this._releaseMouse())}_evtKeyDown(e){var i,s,n;if("Tab"!==e.key&&e.eventPhase!==Event.CAPTURING_PHASE)if("Enter"===e.key||"Spacebar"===e.key||" "===e.key){const i=document.activeElement;if(this.addButtonEnabled&&this.addButtonNode.contains(i))e.preventDefault(),e.stopPropagation(),this._addRequested.emit();else{const s=t.ArrayExt.findFirstIndex(this.contentNode.children,(e=>e.contains(i)));s>=0&&(e.preventDefault(),e.stopPropagation(),this.currentIndex=s)}}else if(O.includes(e.key)){const t=[...this.contentNode.children];if(this.addButtonEnabled&&t.push(this.addButtonNode),t.length<=1)return;e.preventDefault(),e.stopPropagation();let a,r=t.indexOf(document.activeElement);-1===r&&(r=this._currentIndex),"ArrowRight"===e.key&&"horizontal"===this._orientation||"ArrowDown"===e.key&&"vertical"===this._orientation?a=null!==(i=t[r+1])&&void 0!==i?i:t[0]:"ArrowLeft"===e.key&&"horizontal"===this._orientation||"ArrowUp"===e.key&&"vertical"===this._orientation?a=null!==(s=t[r-1])&&void 0!==s?s:t[t.length-1]:"Home"===e.key?a=t[0]:"End"===e.key&&(a=t[t.length-1]),a&&(null===(n=t[r])||void 0===n||n.setAttribute("tabindex","-1"),null==a||a.setAttribute("tabindex","0"),a.focus())}}_evtPointerDown(e){if(0!==e.button&&1!==e.button)return;if(this._dragData)return;if(e.target.classList.contains("lm-TabBar-tabInput"))return;let i=this.addButtonEnabled&&this.addButtonNode.contains(e.target),n=this.contentNode.children,a=t.ArrayExt.findFirstIndex(n,(t=>s.ElementExt.hitTest(t,e.clientX,e.clientY)));if(-1===a&&!i)return;if(e.preventDefault(),e.stopPropagation(),this._dragData={tab:n[a],index:a,pressX:e.clientX,pressY:e.clientY,tabPos:-1,tabSize:-1,tabPressPos:-1,targetIndex:-1,tabLayout:null,contentRect:null,override:null,dragActive:!1,dragAborted:!1,detachRequested:!1},this.document.addEventListener("pointerup",this,!0),1===e.button||i)return;let r=n[a].querySelector(this.renderer.closeIconSelector);r&&r.contains(e.target)||(this.tabsMovable&&(this.document.addEventListener("pointermove",this,!0),this.document.addEventListener("keydown",this,!0),this.document.addEventListener("contextmenu",this,!0)),this.allowDeselect&&this.currentIndex===a?this.currentIndex=-1:this.currentIndex=a,-1!==this.currentIndex&&this._tabActivateRequested.emit({index:this.currentIndex,title:this.currentTitle}))}_evtPointerMove(e){let t=this._dragData;if(!t)return;e.preventDefault(),e.stopPropagation();let i=this.contentNode.children;if(t.dragActive||V.dragExceeded(t,e)){if(!t.dragActive){let e=t.tab.getBoundingClientRect();"horizontal"===this._orientation?(t.tabPos=t.tab.offsetLeft,t.tabSize=e.width,t.tabPressPos=t.pressX-e.left):(t.tabPos=t.tab.offsetTop,t.tabSize=e.height,t.tabPressPos=t.pressY-e.top),t.tabPressOffset={x:t.pressX-e.left,y:t.pressY-e.top},t.tabLayout=V.snapTabLayout(i,this._orientation),t.contentRect=this.contentNode.getBoundingClientRect(),t.override=o.Drag.overrideCursor("default"),t.tab.classList.add("lm-mod-dragging"),this.addClass("lm-mod-dragging"),t.dragActive=!0}if(!t.detachRequested&&V.detachExceeded(t,e)){t.detachRequested=!0;let s=t.index,n=e.clientX,a=e.clientY,r=i[s],o=this._titles[s];if(this._tabDetachRequested.emit({index:s,title:o,tab:r,clientX:n,clientY:a,offset:t.tabPressOffset}),t.dragAborted)return}V.layoutTabs(i,t,e,this._orientation)}}_evtPointerUp(e){if(0!==e.button&&1!==e.button)return;const i=this._dragData;if(!i)return;if(e.preventDefault(),e.stopPropagation(),this.document.removeEventListener("pointermove",this,!0),this.document.removeEventListener("pointerup",this,!0),this.document.removeEventListener("keydown",this,!0),this.document.removeEventListener("contextmenu",this,!0),!i.dragActive){if(this._dragData=null,this.addButtonEnabled&&this.addButtonNode.contains(e.target))return void this._addRequested.emit(void 0);let n=this.contentNode.children,a=t.ArrayExt.findFirstIndex(n,(t=>s.ElementExt.hitTest(t,e.clientX,e.clientY)));if(a!==i.index)return;let r=this._titles[a];if(!r.closable)return;if(1===e.button)return void this._tabCloseRequested.emit({index:a,title:r});let o=n[a].querySelector(this.renderer.closeIconSelector);return o&&o.contains(e.target)?void this._tabCloseRequested.emit({index:a,title:r}):void 0}if(0!==e.button)return;V.finalizeTabPosition(i,this._orientation),i.tab.classList.remove("lm-mod-dragging");let a=V.parseTransitionDuration(i.tab);setTimeout((()=>{if(i.dragAborted)return;this._dragData=null,V.resetTabPositions(this.contentNode.children,this._orientation),i.override.dispose(),this.removeClass("lm-mod-dragging");let e=i.index,s=i.targetIndex;-1!==s&&e!==s&&(t.ArrayExt.move(this._titles,e,s),this._adjustCurrentForMove(e,s),this._tabMoved.emit({fromIndex:e,toIndex:s,title:this._titles[s]}),n.MessageLoop.sendMessage(this,b.Msg.UpdateRequest))}),a)}_releaseMouse(){let e=this._dragData;e&&(this._dragData=null,this.document.removeEventListener("pointermove",this,!0),this.document.removeEventListener("pointerup",this,!0),this.document.removeEventListener("keydown",this,!0),this.document.removeEventListener("contextmenu",this,!0),e.dragAborted=!0,e.dragActive&&(V.resetTabPositions(this.contentNode.children,this._orientation),e.override.dispose(),e.tab.classList.remove("lm-mod-dragging"),this.removeClass("lm-mod-dragging")))}_adjustCurrentForInsert(e,t){let i=this.currentTitle,s=this._currentIndex,n=this.insertBehavior;if("select-tab"===n||"select-tab-if-needed"===n&&-1===s)return this._currentIndex=e,this._previousTitle=i,void this._currentChanged.emit({previousIndex:s,previousTitle:i,currentIndex:e,currentTitle:t});s>=e&&this._currentIndex++}_adjustCurrentForMove(e,t){this._currentIndex===e?this._currentIndex=t:this._currentIndex=t?this._currentIndex++:this._currentIndex>e&&this._currentIndex<=t&&this._currentIndex--}_adjustCurrentForRemove(e,t){let i=this._currentIndex,s=this.removeBehavior;if(i===e){if(0===this._titles.length)return this._currentIndex=-1,void this._currentChanged.emit({previousIndex:e,previousTitle:t,currentIndex:-1,currentTitle:null});if("select-tab-after"===s)return this._currentIndex=Math.min(e,this._titles.length-1),void this._currentChanged.emit({previousIndex:e,previousTitle:t,currentIndex:this._currentIndex,currentTitle:this.currentTitle});if("select-tab-before"===s)return this._currentIndex=Math.max(0,e-1),void this._currentChanged.emit({previousIndex:e,previousTitle:t,currentIndex:this._currentIndex,currentTitle:this.currentTitle});if("select-previous-tab"===s)return this._previousTitle?(this._currentIndex=this._titles.indexOf(this._previousTitle),this._previousTitle=null):this._currentIndex=Math.min(e,this._titles.length-1),void this._currentChanged.emit({previousIndex:e,previousTitle:t,currentIndex:this._currentIndex,currentTitle:this.currentTitle});this._currentIndex=-1,this._currentChanged.emit({previousIndex:e,previousTitle:t,currentIndex:-1,currentTitle:null})}else i>e&&this._currentIndex--}_onTitleChanged(e){this.update()}}var V,U,Y,X,K,G,j,J;!function(e){class t{constructor(){this.closeIconSelector=".lm-TabBar-tabCloseIcon",this._tabID=0,this._tabKeys=new WeakMap,this._uuid=++t._nInstance}renderTab(e){let t=e.title.caption,i=this.createTabKey(e),s=i,n=this.createTabStyle(e),a=this.createTabClass(e),r=this.createTabDataset(e),o=this.createTabARIA(e);return e.title.closable?d.h.li({id:s,key:i,className:a,title:t,style:n,dataset:r,...o},this.renderIcon(e),this.renderLabel(e),this.renderCloseIcon(e)):d.h.li({id:s,key:i,className:a,title:t,style:n,dataset:r,...o},this.renderIcon(e),this.renderLabel(e))}renderIcon(e){const{title:t}=e;let i=this.createIconClass(e);return d.h.div({className:i},t.icon,t.iconLabel)}renderLabel(e){return d.h.div({className:"lm-TabBar-tabLabel"},e.title.label)}renderCloseIcon(e){return d.h.div({className:"lm-TabBar-tabCloseIcon"})}createTabKey(e){let t=this._tabKeys.get(e.title);return void 0===t&&(t=`tab-key-${this._uuid}-${this._tabID++}`,this._tabKeys.set(e.title,t)),t}createTabStyle(e){return{zIndex:`${e.zIndex}`}}createTabClass(e){let t="lm-TabBar-tab";return e.title.className&&(t+=` ${e.title.className}`),e.title.closable&&(t+=" lm-mod-closable"),e.current&&(t+=" lm-mod-current"),t}createTabDataset(e){return e.title.dataset}createTabARIA(e){var t;return{role:"tab","aria-selected":e.current.toString(),tabindex:`${null!==(t=e.tabIndex)&&void 0!==t?t:"-1"}`}}createIconClass(e){let t="lm-TabBar-tabIcon",i=e.title.iconClass;return i?`${t} ${i}`:t}}t._nInstance=0,e.Renderer=t,e.defaultRenderer=new t,e.addButtonSelector=".lm-TabBar-addButton"}($||($={})),function(e){e.DRAG_THRESHOLD=5,e.DETACH_THRESHOLD=20,e.createNode=function(){let e=document.createElement("div"),t=document.createElement("ul");t.setAttribute("role","tablist"),t.className="lm-TabBar-content",e.appendChild(t);let i=document.createElement("div");return i.className="lm-TabBar-addButton lm-mod-hidden",i.setAttribute("tabindex","-1"),i.setAttribute("role","button"),e.appendChild(i),e},e.asTitle=function(e){return e instanceof f?e:new f(e)},e.parseTransitionDuration=function(e){let t=window.getComputedStyle(e);return 1e3*(parseFloat(t.transitionDuration)||0)},e.snapTabLayout=function(e,t){let i=new Array(e.length);for(let s=0,n=e.length;s=e.DRAG_THRESHOLD||n>=e.DRAG_THRESHOLD},e.detachExceeded=function(t,i){let s=t.contentRect;return i.clientX=s.right+e.DETACH_THRESHOLD||i.clientY=s.bottom+e.DETACH_THRESHOLD},e.layoutTabs=function(e,t,i,s){let n,a,r,o;"horizontal"===s?(n=t.pressX,a=i.clientX-t.contentRect.left,r=i.clientX,o=t.contentRect.width):(n=t.pressY,a=i.clientY-t.contentRect.top,r=i.clientY,o=t.contentRect.height);let h=t.index,d=a-t.tabPressPos,l=d+t.tabSize;for(let i=0,a=e.length;i>1);if(it.index&&l>u)a=-t.tabSize-c.margin+"px",h=Math.max(h,i);else if(i===t.index){let e=r-n,i=o-(t.tabPos+t.tabSize);a=`${Math.max(-t.tabPos,Math.min(e,i))}px`}else a="";"horizontal"===s?e[i].style.left=a:e[i].style.top=a}t.targetIndex=h},e.finalizeTabPosition=function(e,t){let i,s;if(i="horizontal"===t?e.contentRect.width:e.contentRect.height,e.targetIndex===e.index)s=0;else if(e.targetIndex>e.index){let t=e.tabLayout[e.targetIndex];s=t.pos+t.size-e.tabSize-e.tabPos}else{s=e.tabLayout[e.targetIndex].pos-e.tabPos}let n=i-(e.tabPos+e.tabSize),a=Math.max(-e.tabPos,Math.min(s,n));"horizontal"===t?e.tab.style.left=`${a}px`:e.tab.style.top=`${a}px`},e.resetTabPositions=function(e,t){for(const i of e)"horizontal"===t?i.style.left="":i.style.top=""}}(V||(V={}));class Q extends v{constructor(e){super(),this._spacing=4,this._dirty=!1,this._root=null,this._box=null,this._items=new Map,this.renderer=e.renderer,void 0!==e.spacing&&(this._spacing=D.clampDimension(e.spacing)),this._document=e.document||document,this._hiddenMode=void 0!==e.hiddenMode?e.hiddenMode:b.HiddenMode.Display}dispose(){let e=this[Symbol.iterator]();this._items.forEach((e=>{e.dispose()})),this._box=null,this._root=null,this._items.clear();for(const t of e)t.dispose();super.dispose()}get hiddenMode(){return this._hiddenMode}set hiddenMode(e){if(this._hiddenMode!==e){this._hiddenMode=e;for(const e of this.tabBars())if(e.titles.length>1)for(const t of e.titles)t.owner.hiddenMode=this._hiddenMode}}get spacing(){return this._spacing}set spacing(e){e=D.clampDimension(e),this._spacing!==e&&(this._spacing=e,this.parent&&this.parent.fit())}get isEmpty(){return null===this._root}[Symbol.iterator](){return this._root?this._root.iterAllWidgets():t.empty()}widgets(){return this._root?this._root.iterUserWidgets():t.empty()}selectedWidgets(){return this._root?this._root.iterSelectedWidgets():t.empty()}tabBars(){return this._root?this._root.iterTabBars():t.empty()}handles(){return this._root?this._root.iterHandles():t.empty()}moveHandle(t,i,s){let n=t.classList.contains("lm-mod-hidden");if(!this._root||n)return;let a,r=this._root.findSplitNode(t);r&&(a="horizontal"===r.node.orientation?i-t.offsetLeft:s-t.offsetTop,0!==a&&(r.node.holdSizes(),e.BoxEngine.adjust(r.node.sizers,r.index,a),this.parent&&this.parent.update()))}saveLayout(){return this._root?(this._root.holdAllSizes(),{main:this._root.createConfig()}):{main:null}}restoreLayout(e){let t,i=new Set;t=e.main?U.normalizeAreaConfig(e.main,i):null;let s=this.widgets(),n=this.tabBars(),a=this.handles();this._root=null;for(const e of s)i.has(e)||(e.parent=null);for(const e of n)e.dispose();for(const e of a)e.parentNode&&e.parentNode.removeChild(e);for(const e of i)e.parent=this.parent;this._root=t?U.realizeAreaConfig(t,{createTabBar:e=>this._createTabBar(),createHandle:()=>this._createHandle()},this._document):null,this.parent&&(i.forEach((e=>{this.attachWidget(e)})),this.parent.fit())}addWidget(e,t={}){let i=t.ref||null,s=t.mode||"tab-after",n=null;if(this._root&&i&&(n=this._root.findTabNode(i)),i&&!n)throw new Error("Reference widget is not in the layout.");switch(e.parent=this.parent,s){case"tab-after":this._insertTab(e,i,n,!0);break;case"tab-before":this._insertTab(e,i,n,!1);break;case"split-top":this._insertSplit(e,i,n,"vertical",!1);break;case"split-left":this._insertSplit(e,i,n,"horizontal",!1);break;case"split-right":this._insertSplit(e,i,n,"horizontal",!0);break;case"split-bottom":this._insertSplit(e,i,n,"vertical",!0);break;case"merge-top":this._insertSplit(e,i,n,"vertical",!1,!0);break;case"merge-left":this._insertSplit(e,i,n,"horizontal",!1,!0);break;case"merge-right":this._insertSplit(e,i,n,"horizontal",!0,!0);break;case"merge-bottom":this._insertSplit(e,i,n,"vertical",!0,!0)}this.parent&&(this.attachWidget(e),this.parent.fit())}removeWidget(e){this._removeWidget(e),this.parent&&(this.detachWidget(e),this.parent.fit())}hitTestTabAreas(e,t){if(!this._root||!this.parent||!this.parent.isVisible)return null;this._box||(this._box=s.ElementExt.boxSizing(this.parent.node));let i=this.parent.node.getBoundingClientRect(),n=e-i.left-this._box.borderLeft,a=t-i.top-this._box.borderTop,r=this._root.hitTestTabNodes(n,a);if(!r)return null;let{tabBar:o,top:h,left:d,width:l,height:c}=r,u=this._box.borderLeft+this._box.borderRight,m=this._box.borderTop+this._box.borderBottom;return{tabBar:o,x:n,y:a,top:h,left:d,right:i.width-u-(d+l),bottom:i.height-m-(h+c),width:l,height:c}}init(){super.init();for(const e of this)this.attachWidget(e);for(const e of this.handles())this.parent.node.appendChild(e);this.parent.fit()}attachWidget(e){this.parent.node!==e.node.parentNode&&(this._items.set(e,new x(e)),this.parent.isAttached&&n.MessageLoop.sendMessage(e,b.Msg.BeforeAttach),this.parent.node.appendChild(e.node),this.parent.isAttached&&n.MessageLoop.sendMessage(e,b.Msg.AfterAttach))}detachWidget(e){if(this.parent.node!==e.node.parentNode)return;this.parent.isAttached&&n.MessageLoop.sendMessage(e,b.Msg.BeforeDetach),this.parent.node.removeChild(e.node),this.parent.isAttached&&n.MessageLoop.sendMessage(e,b.Msg.AfterDetach);let t=this._items.get(e);t&&(this._items.delete(e),t.dispose())}onBeforeShow(e){super.onBeforeShow(e),this.parent.update()}onBeforeAttach(e){super.onBeforeAttach(e),this.parent.fit()}onChildShown(e){this.parent.fit()}onChildHidden(e){this.parent.fit()}onResize(e){this.parent.isVisible&&this._update(e.width,e.height)}onUpdateRequest(e){this.parent.isVisible&&this._update(-1,-1)}onFitRequest(e){this.parent.isAttached&&this._fit()}_removeWidget(e){if(!this._root)return;let i=this._root.findTabNode(e);if(!i)return;if(U.removeAria(e),i.tabBar.titles.length>1){if(i.tabBar.removeTab(e.title),this._hiddenMode===b.HiddenMode.Scale&&1==i.tabBar.titles.length){i.tabBar.titles[0].owner.hiddenMode=b.HiddenMode.Display}return}if(i.tabBar.dispose(),this._root===i)return void(this._root=null);this._root.holdAllSizes();let s=i.parent;i.parent=null;let n=t.ArrayExt.removeFirstOf(s.children,i),a=t.ArrayExt.removeAt(s.handles,n);if(t.ArrayExt.removeAt(s.sizers,n),a.parentNode&&a.parentNode.removeChild(a),s.children.length>1)return void s.syncHandles();let r=s.parent;s.parent=null;let o=s.children[0],h=s.handles[0];if(s.children.length=0,s.handles.length=0,s.sizers.length=0,h.parentNode&&h.parentNode.removeChild(h),this._root===s)return o.parent=null,void(this._root=o);let d=r,l=d.children.indexOf(s);if(o instanceof U.TabLayoutNode)return o.parent=d,void(d.children[l]=o);let c=t.ArrayExt.removeAt(d.handles,l);t.ArrayExt.removeAt(d.children,l),t.ArrayExt.removeAt(d.sizers,l),c.parentNode&&c.parentNode.removeChild(c);for(let e=0,i=o.children.length;e=i.length)&&(s=0);return{type:"tab-area",widgets:i,currentIndex:s}}(e,t):function(e,t){let i=e.orientation,n=[],a=[];for(let r=0,o=e.children.length;r{let h=n(r,t,s),d=i(e.sizes[o]),l=t.createHandle();a.children.push(h),a.handles.push(l),a.sizers.push(d),h.parent=a})),a.syncHandles(),a.normalizeSizes(),a}(e,s,o),h}t.GOLDEN_RATIO=.618,t.createSizer=i,t.normalizeAreaConfig=s,t.realizeAreaConfig=n;class a{constructor(e){this.parent=null,this._top=0,this._left=0,this._width=0,this._height=0;let t=new u,i=new u;t.stretch=0,i.stretch=1,this.tabBar=e,this.sizers=[t,i]}get top(){return this._top}get left(){return this._left}get width(){return this._width}get height(){return this._height}*iterAllWidgets(){yield this.tabBar,yield*this.iterUserWidgets()}*iterUserWidgets(){for(const e of this.tabBar.titles)yield e.owner}*iterSelectedWidgets(){let e=this.tabBar.currentTitle;e&&(yield e.owner)}*iterTabBars(){yield this.tabBar}*iterHandles(){}findTabNode(e){return-1!==this.tabBar.titles.indexOf(e.title)?this:null}findSplitNode(e){return null}findFirstTabNode(){return this}hitTestTabNodes(e,t){return e=this._left+this._width||t=this._top+this._height?null:this}createConfig(){return{type:"tab-area",widgets:this.tabBar.titles.map((e=>e.owner)),currentIndex:this.tabBar.currentIndex}}holdAllSizes(){}fit(e,t){let i=0,s=0,n=t.get(this.tabBar),a=this.tabBar.currentTitle,r=a?t.get(a.owner):void 0,[o,h]=this.sizers;return n&&n.fit(),r&&r.fit(),n&&!n.isHidden?(i=Math.max(i,n.minWidth),s+=n.minHeight,o.minSize=n.minHeight,o.maxSize=n.maxHeight):(o.minSize=0,o.maxSize=0),r&&!r.isHidden?(i=Math.max(i,r.minWidth),s+=r.minHeight,h.minSize=r.minHeight,h.maxSize=1/0):(h.minSize=0,h.maxSize=1/0),{minWidth:i,minHeight:s,maxWidth:Infinity,maxHeight:Infinity}}update(t,i,s,n,a,r){this._top=i,this._left=t,this._width=s,this._height=n;let o=r.get(this.tabBar),h=this.tabBar.currentTitle,d=h?r.get(h.owner):void 0;if(e.BoxEngine.calc(this.sizers,n),o&&!o.isHidden){let e=this.sizers[0].size;o.update(t,i,s,e),i+=e}if(d&&!d.isHidden){let e=this.sizers[1].size;d.update(t,i,s,e)}}}t.TabLayoutNode=a;class r{constructor(e){this.parent=null,this.normalized=!1,this.children=[],this.sizers=[],this.handles=[],this.orientation=e}*iterAllWidgets(){for(const e of this.children)yield*e.iterAllWidgets()}*iterUserWidgets(){for(const e of this.children)yield*e.iterUserWidgets()}*iterSelectedWidgets(){for(const e of this.children)yield*e.iterSelectedWidgets()}*iterTabBars(){for(const e of this.children)yield*e.iterTabBars()}*iterHandles(){yield*this.handles;for(const e of this.children)yield*e.iterHandles()}findTabNode(e){for(let t=0,i=this.children.length;te.createConfig())),sizes:t}}syncHandles(){this.handles.forEach(((e,t)=>{e.setAttribute("data-orientation",this.orientation),t===this.handles.length-1?e.classList.add("lm-mod-hidden"):e.classList.remove("lm-mod-hidden")}))}holdSizes(){for(const e of this.sizers)e.sizeHint=e.size}holdAllSizes(){for(const e of this.children)e.holdAllSizes();this.holdSizes()}normalizeSizes(){let e=this.sizers.length;if(0===e)return;this.holdSizes();let t=this.sizers.reduce(((e,t)=>e+t.sizeHint),0);if(0===t)for(const t of this.sizers)t.size=t.sizeHint=1/e;else for(const e of this.sizers)e.size=e.sizeHint/=t;this.normalized=!0}createNormalizedSizes(){let e=this.sizers.length;if(0===e)return[];let t=this.sizers.map((e=>e.size)),i=t.reduce(((e,t)=>e+t),0);if(0===i)for(let i=t.length-1;i>-1;i--)t[i]=1/e;else for(let e=t.length-1;e>-1;e--)t[e]/=i;return t}fit(e,t){let i="horizontal"===this.orientation,s=Math.max(0,this.children.length-1)*e,n=i?s:0,a=i?0:s;for(let s=0,r=this.children.length;sthis._createTabBar(),createHandle:()=>this._createHandle()};this.layout=new Q({document:this._document,renderer:t,spacing:e.spacing,hiddenMode:e.hiddenMode}),this.overlay=e.overlay||new Z.Overlay,this.node.appendChild(this.overlay.node)}dispose(){this._releaseMouse(),this.overlay.hide(0),this._drag&&this._drag.dispose(),super.dispose()}get hiddenMode(){return this.layout.hiddenMode}set hiddenMode(e){this.layout.hiddenMode=e}get layoutModified(){return this._layoutModified}get addRequested(){return this._addRequested}get renderer(){return this.layout.renderer}get spacing(){return this.layout.spacing}set spacing(e){this.layout.spacing=e}get mode(){return this._mode}set mode(e){if(this._mode===e)return;this._mode=e,this.dataset.mode=e;let t=this.layout;switch(e){case"multiple-document":for(const e of t.tabBars())e.show();break;case"single-document":t.restoreLayout(Y.createSingleDocumentConfig(this));break;default:throw"unreachable"}n.MessageLoop.postMessage(this,Y.LayoutModified)}get tabsMovable(){return this._tabsMovable}set tabsMovable(e){this._tabsMovable=e;for(const t of this.tabBars())t.tabsMovable=e}get tabsConstrained(){return this._tabsConstrained}set tabsConstrained(e){this._tabsConstrained=e}get addButtonEnabled(){return this._addButtonEnabled}set addButtonEnabled(e){this._addButtonEnabled=e;for(const t of this.tabBars())t.addButtonEnabled=e}get isEmpty(){return this.layout.isEmpty}*widgets(){yield*this.layout.widgets()}*selectedWidgets(){yield*this.layout.selectedWidgets()}*tabBars(){yield*this.layout.tabBars()}*handles(){yield*this.layout.handles()}selectWidget(e){let i=t.find(this.tabBars(),(t=>-1!==t.titles.indexOf(e.title)));if(!i)throw new Error("Widget is not contained in the dock panel.");i.currentTitle=e.title}activateWidget(e){this.selectWidget(e),e.activate()}saveLayout(){return this.layout.saveLayout()}restoreLayout(e){this._mode="multiple-document",this.layout.restoreLayout(e),(s.Platform.IS_EDGE||s.Platform.IS_IE)&&n.MessageLoop.flush(),n.MessageLoop.postMessage(this,Y.LayoutModified)}addWidget(e,t={}){"single-document"===this._mode?this.layout.addWidget(e):this.layout.addWidget(e,t),n.MessageLoop.postMessage(this,Y.LayoutModified)}processMessage(e){"layout-modified"===e.type?this._layoutModified.emit(void 0):super.processMessage(e)}handleEvent(e){switch(e.type){case"lm-dragenter":this._evtDragEnter(e);break;case"lm-dragleave":this._evtDragLeave(e);break;case"lm-dragover":this._evtDragOver(e);break;case"lm-drop":this._evtDrop(e);break;case"pointerdown":this._evtPointerDown(e);break;case"pointermove":this._evtPointerMove(e);break;case"pointerup":this._evtPointerUp(e);break;case"keydown":this._evtKeyDown(e);break;case"contextmenu":e.preventDefault(),e.stopPropagation()}}onBeforeAttach(e){this.node.addEventListener("lm-dragenter",this),this.node.addEventListener("lm-dragleave",this),this.node.addEventListener("lm-dragover",this),this.node.addEventListener("lm-drop",this),this.node.addEventListener("pointerdown",this)}onAfterDetach(e){this.node.removeEventListener("lm-dragenter",this),this.node.removeEventListener("lm-dragleave",this),this.node.removeEventListener("lm-dragover",this),this.node.removeEventListener("lm-drop",this),this.node.removeEventListener("pointerdown",this),this._releaseMouse()}onChildAdded(e){Y.isGeneratedTabBarProperty.get(e.child)||e.child.addClass("lm-DockPanel-widget")}onChildRemoved(e){Y.isGeneratedTabBarProperty.get(e.child)||(e.child.removeClass("lm-DockPanel-widget"),n.MessageLoop.postMessage(this,Y.LayoutModified))}_evtDragEnter(e){e.mimeData.hasData("application/vnd.lumino.widget-factory")&&(e.preventDefault(),e.stopPropagation())}_evtDragLeave(e){e.preventDefault(),this._tabsConstrained&&e.source!==this||(e.stopPropagation(),this.overlay.hide(1))}_evtDragOver(e){e.preventDefault(),this._tabsConstrained&&e.source!==this||"invalid"===this._showOverlay(e.clientX,e.clientY)?e.dropAction="none":(e.stopPropagation(),e.dropAction=e.proposedAction)}_evtDrop(e){if(e.preventDefault(),this.overlay.hide(0),"none"===e.proposedAction)return void(e.dropAction="none");let{clientX:t,clientY:i}=e,{zone:s,target:n}=Y.findDropTarget(this,t,i,this._edges);if(this._tabsConstrained&&e.source!==this||"invalid"===s)return void(e.dropAction="none");let a=e.mimeData.getData("application/vnd.lumino.widget-factory");if("function"!=typeof a)return void(e.dropAction="none");let r=a();if(!(r instanceof b))return void(e.dropAction="none");if(r.contains(this))return void(e.dropAction="none");let o=n?Y.getDropRef(n.tabBar):null;switch(s){case"root-all":this.addWidget(r);break;case"root-top":this.addWidget(r,{mode:"split-top"});break;case"root-left":this.addWidget(r,{mode:"split-left"});break;case"root-right":this.addWidget(r,{mode:"split-right"});break;case"root-bottom":this.addWidget(r,{mode:"split-bottom"});break;case"widget-all":case"widget-tab":this.addWidget(r,{mode:"tab-after",ref:o});break;case"widget-top":this.addWidget(r,{mode:"split-top",ref:o});break;case"widget-left":this.addWidget(r,{mode:"split-left",ref:o});break;case"widget-right":this.addWidget(r,{mode:"split-right",ref:o});break;case"widget-bottom":this.addWidget(r,{mode:"split-bottom",ref:o});break;default:throw"unreachable"}e.dropAction=e.proposedAction,e.stopPropagation(),this.activateWidget(r)}_evtKeyDown(e){e.preventDefault(),e.stopPropagation(),27===e.keyCode&&(this._releaseMouse(),n.MessageLoop.postMessage(this,Y.LayoutModified))}_evtPointerDown(e){if(0!==e.button)return;let i=this.layout,s=e.target,n=t.find(i.handles(),(e=>e.contains(s)));if(!n)return;e.preventDefault(),e.stopPropagation(),this._document.addEventListener("keydown",this,!0),this._document.addEventListener("pointerup",this,!0),this._document.addEventListener("pointermove",this,!0),this._document.addEventListener("contextmenu",this,!0);let a=n.getBoundingClientRect(),r=e.clientX-a.left,h=e.clientY-a.top,d=window.getComputedStyle(n),l=o.Drag.overrideCursor(d.cursor,this._document);this._pressData={handle:n,deltaX:r,deltaY:h,override:l}}_evtPointerMove(e){if(!this._pressData)return;e.preventDefault(),e.stopPropagation();let t=this.node.getBoundingClientRect(),i=e.clientX-t.left-this._pressData.deltaX,s=e.clientY-t.top-this._pressData.deltaY;this.layout.moveHandle(this._pressData.handle,i,s)}_evtPointerUp(e){0===e.button&&(e.preventDefault(),e.stopPropagation(),this._releaseMouse(),n.MessageLoop.postMessage(this,Y.LayoutModified))}_releaseMouse(){this._pressData&&(this._pressData.override.dispose(),this._pressData=null,this._document.removeEventListener("keydown",this,!0),this._document.removeEventListener("pointerup",this,!0),this._document.removeEventListener("pointermove",this,!0),this._document.removeEventListener("contextmenu",this,!0))}_showOverlay(e,t){let i,n,a,r,{zone:o,target:h}=Y.findDropTarget(this,e,t,this._edges);if("invalid"===o)return this.overlay.hide(100),o;let d=s.ElementExt.boxSizing(this.node),l=this.node.getBoundingClientRect();switch(o){case"root-all":i=d.paddingTop,n=d.paddingLeft,a=d.paddingRight,r=d.paddingBottom;break;case"root-top":i=d.paddingTop,n=d.paddingLeft,a=d.paddingRight,r=l.height*Y.GOLDEN_RATIO;break;case"root-left":i=d.paddingTop,n=d.paddingLeft,a=l.width*Y.GOLDEN_RATIO,r=d.paddingBottom;break;case"root-right":i=d.paddingTop,n=l.width*Y.GOLDEN_RATIO,a=d.paddingRight,r=d.paddingBottom;break;case"root-bottom":i=l.height*Y.GOLDEN_RATIO,n=d.paddingLeft,a=d.paddingRight,r=d.paddingBottom;break;case"widget-all":i=h.top,n=h.left,a=h.right,r=h.bottom;break;case"widget-top":i=h.top,n=h.left,a=h.right,r=h.bottom+h.height/2;break;case"widget-left":i=h.top,n=h.left,a=h.right+h.width/2,r=h.bottom;break;case"widget-right":i=h.top,n=h.left+h.width/2,a=h.right,r=h.bottom;break;case"widget-bottom":i=h.top+h.height/2,n=h.left,a=h.right,r=h.bottom;break;case"widget-tab":{const e=h.tabBar.node.getBoundingClientRect().height;i=h.top,n=h.left,a=h.right,r=h.bottom+h.height-e;break}default:throw"unreachable"}return this.overlay.show({top:i,left:n,right:a,bottom:r}),o}_createTabBar(){let e=this._renderer.createTabBar(this._document);return Y.isGeneratedTabBarProperty.set(e,!0),"single-document"===this._mode&&e.hide(),e.tabsMovable=this._tabsMovable,e.allowDeselect=!1,e.addButtonEnabled=this._addButtonEnabled,e.removeBehavior="select-previous-tab",e.insertBehavior="select-tab-if-needed",e.tabMoved.connect(this._onTabMoved,this),e.currentChanged.connect(this._onCurrentChanged,this),e.tabCloseRequested.connect(this._onTabCloseRequested,this),e.tabDetachRequested.connect(this._onTabDetachRequested,this),e.tabActivateRequested.connect(this._onTabActivateRequested,this),e.addRequested.connect(this._onTabAddRequested,this),e}_createHandle(){return this._renderer.createHandle()}_onTabMoved(){n.MessageLoop.postMessage(this,Y.LayoutModified)}_onCurrentChanged(e,t){let{previousTitle:i,currentTitle:a}=t;i&&i.owner.hide(),a&&a.owner.show(),(s.Platform.IS_EDGE||s.Platform.IS_IE)&&n.MessageLoop.flush(),n.MessageLoop.postMessage(this,Y.LayoutModified)}_onTabAddRequested(e){this._addRequested.emit(e)}_onTabActivateRequested(e,t){t.title.owner.activate()}_onTabCloseRequested(e,t){t.title.owner.close()}_onTabDetachRequested(e,t){if(this._drag)return;e.releaseMouse();let{title:s,tab:n,clientX:a,clientY:r,offset:h}=t,d=new i.MimeData;d.setData("application/vnd.lumino.widget-factory",(()=>s.owner));let l=n.cloneNode(!0);h&&(l.style.top=`-${h.y}px`,l.style.left=`-${h.x}px`),this._drag=new o.Drag({document:this._document,mimeData:d,dragImage:l,proposedAction:"move",supportedActions:"move",source:this}),n.classList.add("lm-mod-hidden");this._drag.start(a,r).then((()=>{this._drag=null,n.classList.remove("lm-mod-hidden")}))}}!function(e){e.Overlay=class{constructor(){this._timer=-1,this._hidden=!0,this.node=document.createElement("div"),this.node.classList.add("lm-DockPanel-overlay"),this.node.classList.add("lm-mod-hidden"),this.node.style.position="absolute",this.node.style.contain="strict"}show(e){let t=this.node.style;t.top=`${e.top}px`,t.left=`${e.left}px`,t.right=`${e.right}px`,t.bottom=`${e.bottom}px`,clearTimeout(this._timer),this._timer=-1,this._hidden&&(this._hidden=!1,this.node.classList.remove("lm-mod-hidden"))}hide(e){if(!this._hidden)return e<=0?(clearTimeout(this._timer),this._timer=-1,this._hidden=!0,void this.node.classList.add("lm-mod-hidden")):void(-1===this._timer&&(this._timer=window.setTimeout((()=>{this._timer=-1,this._hidden=!0,this.node.classList.add("lm-mod-hidden")}),e)))}};class t{createTabBar(e){let t=new $({document:e});return t.addClass("lm-DockPanel-tabBar"),t}createHandle(){let e=document.createElement("div");return e.className="lm-DockPanel-handle",e}}e.Renderer=t,e.defaultRenderer=new t}(Z||(Z={})),function(e){e.GOLDEN_RATIO=.618,e.DEFAULT_EDGES={top:12,right:40,bottom:40,left:40},e.LayoutModified=new n.ConflatableMessage("layout-modified"),e.isGeneratedTabBarProperty=new a.AttachedProperty({name:"isGeneratedTabBar",create:()=>!1}),e.createSingleDocumentConfig=function(e){if(e.isEmpty)return{main:null};let t=Array.from(e.widgets()),i=e.selectedWidgets().next().value,s=i?t.indexOf(i):-1;return{main:{type:"tab-area",widgets:t,currentIndex:s}}},e.findDropTarget=function(e,t,i,n){if(!s.ElementExt.hitTest(e.node,t,i))return{zone:"invalid",target:null};let a=e.layout;if(a.isEmpty)return{zone:"root-all",target:null};if("multiple-document"===e.mode){let s=e.node.getBoundingClientRect(),a=t-s.left+1,r=i-s.top+1,o=s.right-t,h=s.bottom-i;switch(Math.min(r,o,h,a)){case r:if(ru&&d>u&&h>m&&l>m)return{zone:"widget-all",target:r};switch(o/=u,h/=m,d/=u,l/=m,Math.min(o,h,d,l)){case o:c="widget-left";break;case h:c="widget-top";break;case d:c="widget-right";break;case l:c="widget-bottom";break;default:throw"unreachable"}return{zone:c,target:r}},e.getDropRef=function(e){return 0===e.titles.length?null:e.currentTitle?e.currentTitle.owner:e.titles[e.titles.length-1].owner}}(Y||(Y={}));class ee extends v{constructor(e={}){super(e),this._dirty=!1,this._rowSpacing=4,this._columnSpacing=4,this._items=[],this._rowStarts=[],this._columnStarts=[],this._rowSizers=[new u],this._columnSizers=[new u],this._box=null,void 0!==e.rowCount&&X.reallocSizers(this._rowSizers,e.rowCount),void 0!==e.columnCount&&X.reallocSizers(this._columnSizers,e.columnCount),void 0!==e.rowSpacing&&(this._rowSpacing=X.clampValue(e.rowSpacing)),void 0!==e.columnSpacing&&(this._columnSpacing=X.clampValue(e.columnSpacing))}dispose(){for(const e of this._items){let t=e.widget;e.dispose(),t.dispose()}this._box=null,this._items.length=0,this._rowStarts.length=0,this._rowSizers.length=0,this._columnStarts.length=0,this._columnSizers.length=0,super.dispose()}get rowCount(){return this._rowSizers.length}set rowCount(e){e!==this.rowCount&&(X.reallocSizers(this._rowSizers,e),this.parent&&this.parent.fit())}get columnCount(){return this._columnSizers.length}set columnCount(e){e!==this.columnCount&&(X.reallocSizers(this._columnSizers,e),this.parent&&this.parent.fit())}get rowSpacing(){return this._rowSpacing}set rowSpacing(e){e=X.clampValue(e),this._rowSpacing!==e&&(this._rowSpacing=e,this.parent&&this.parent.fit())}get columnSpacing(){return this._columnSpacing}set columnSpacing(e){e=X.clampValue(e),this._columnSpacing!==e&&(this._columnSpacing=e,this.parent&&this.parent.fit())}rowStretch(e){let t=this._rowSizers[e];return t?t.stretch:-1}setRowStretch(e,t){let i=this._rowSizers[e];i&&(t=X.clampValue(t),i.stretch!==t&&(i.stretch=t,this.parent&&this.parent.update()))}columnStretch(e){let t=this._columnSizers[e];return t?t.stretch:-1}setColumnStretch(e,t){let i=this._columnSizers[e];i&&(t=X.clampValue(t),i.stretch!==t&&(i.stretch=t,this.parent&&this.parent.update()))}*[Symbol.iterator](){for(const e of this._items)yield e.widget}addWidget(e){-1===t.ArrayExt.findFirstIndex(this._items,(t=>t.widget===e))&&(this._items.push(new x(e)),this.parent&&this.attachWidget(e))}removeWidget(e){let i=t.ArrayExt.findFirstIndex(this._items,(t=>t.widget===e));if(-1===i)return;let s=t.ArrayExt.removeAt(this._items,i);this.parent&&this.detachWidget(e),s.dispose()}init(){super.init();for(const e of this)this.attachWidget(e)}attachWidget(e){this.parent.isAttached&&n.MessageLoop.sendMessage(e,b.Msg.BeforeAttach),this.parent.node.appendChild(e.node),this.parent.isAttached&&n.MessageLoop.sendMessage(e,b.Msg.AfterAttach),this.parent.fit()}detachWidget(e){this.parent.isAttached&&n.MessageLoop.sendMessage(e,b.Msg.BeforeDetach),this.parent.node.removeChild(e.node),this.parent.isAttached&&n.MessageLoop.sendMessage(e,b.Msg.AfterDetach),this.parent.fit()}onBeforeShow(e){super.onBeforeShow(e),this.parent.update()}onBeforeAttach(e){super.onBeforeAttach(e),this.parent.fit()}onChildShown(e){this.parent.fit()}onChildHidden(e){this.parent.fit()}onResize(e){this.parent.isVisible&&this._update(e.width,e.height)}onUpdateRequest(e){this.parent.isVisible&&this._update(-1,-1)}onFitRequest(e){this.parent.isAttached&&this._fit()}_fit(){for(let e=0,t=this.rowCount;e!e.isHidden));for(let t=0,i=e.length;t({row:0,column:0,rowSpan:1,columnSpan:1}),changed:function(e){e.parent&&e.parent.layout instanceof ee&&e.parent.fit()}}),e.normalizeConfig=function(e){return{row:Math.max(0,Math.floor(e.row||0)),column:Math.max(0,Math.floor(e.column||0)),rowSpan:Math.max(1,Math.floor(e.rowSpan||0)),columnSpan:Math.max(1,Math.floor(e.columnSpan||0))}},e.clampValue=function(e){return Math.max(0,Math.floor(e))},e.rowSpanCmp=function(t,i){let s=e.cellConfigProperty.get(t.widget),n=e.cellConfigProperty.get(i.widget);return s.rowSpan-n.rowSpan},e.columnSpanCmp=function(t,i){let s=e.cellConfigProperty.get(t.widget),n=e.cellConfigProperty.get(i.widget);return s.columnSpan-n.columnSpan},e.reallocSizers=function(e,t){for(t=Math.max(1,Math.floor(t));e.lengtht&&(e.length=t)},e.distributeMin=function(e,t,i,s){if(i=s)return;let a=(s-n)/(i-t+1);for(let s=t;s<=i;++s)e[s].minSize+=a}}(X||(X={}));class te extends b{constructor(e={}){super({node:K.createNode()}),this._activeIndex=-1,this._tabFocusIndex=0,this._menus=[],this._childMenu=null,this._overflowMenu=null,this._menuItemSizes=[],this._overflowIndex=-1,this.addClass("lm-MenuBar"),this.setFlag(b.Flag.DisallowLayout),this.renderer=e.renderer||te.defaultRenderer,this._forceItemsPosition=e.forceItemsPosition||{forceX:!0,forceY:!0},this._overflowMenuOptions=e.overflowMenuOptions||{isVisible:!0}}dispose(){this._closeChildMenu(),this._menus.length=0,super.dispose()}get childMenu(){return this._childMenu}get overflowIndex(){return this._overflowIndex}get overflowMenu(){return this._overflowMenu}get contentNode(){return this.node.getElementsByClassName("lm-MenuBar-content")[0]}get activeMenu(){return this._menus[this._activeIndex]||null}set activeMenu(e){this.activeIndex=e?this._menus.indexOf(e):-1}get activeIndex(){return this._activeIndex}set activeIndex(e){(e<0||e>=this._menus.length)&&(e=-1),e>-1&&0===this._menus[e].items.length&&(e=-1),this._activeIndex!==e&&(this._activeIndex=e,this.update())}get menus(){return this._menus}openActiveMenu(){-1!==this._activeIndex&&(this._openChildMenu(),this._childMenu&&(this._childMenu.activeIndex=-1,this._childMenu.activateNextItem()))}addMenu(e,t=!0){this.insertMenu(this._menus.length,e,t)}insertMenu(e,i,s=!0){this._closeChildMenu();let n=this._menus.indexOf(i),a=Math.max(0,Math.min(e,this._menus.length));if(-1===n)return t.ArrayExt.insert(this._menus,a,i),i.addClass("lm-MenuBar-menu"),i.aboutToClose.connect(this._onMenuAboutToClose,this),i.menuRequested.connect(this._onMenuMenuRequested,this),i.title.changed.connect(this._onTitleChanged,this),void(s&&this.update());a===this._menus.length&&a--,n!==a&&(t.ArrayExt.move(this._menus,n,a),s&&this.update())}removeMenu(e,t=!0){this.removeMenuAt(this._menus.indexOf(e),t)}removeMenuAt(e,i=!0){this._closeChildMenu();let s=t.ArrayExt.removeAt(this._menus,e);s&&(s.aboutToClose.disconnect(this._onMenuAboutToClose,this),s.menuRequested.disconnect(this._onMenuMenuRequested,this),s.title.changed.disconnect(this._onTitleChanged,this),s.removeClass("lm-MenuBar-menu"),i&&this.update())}clearMenus(){if(0!==this._menus.length){this._closeChildMenu();for(let e of this._menus)e.aboutToClose.disconnect(this._onMenuAboutToClose,this),e.menuRequested.disconnect(this._onMenuMenuRequested,this),e.title.changed.disconnect(this._onTitleChanged,this),e.removeClass("lm-MenuBar-menu");this._menus.length=0,this.update()}}handleEvent(e){switch(e.type){case"keydown":this._evtKeyDown(e);break;case"mousedown":this._evtMouseDown(e);break;case"mousemove":case"mouseleave":this._evtMouseMove(e);break;case"focusout":this._evtFocusOut(e);break;case"contextmenu":e.preventDefault(),e.stopPropagation()}}onBeforeAttach(e){this.node.addEventListener("keydown",this),this.node.addEventListener("mousedown",this),this.node.addEventListener("mousemove",this),this.node.addEventListener("mouseleave",this),this.node.addEventListener("focusout",this),this.node.addEventListener("contextmenu",this)}onAfterDetach(e){this.node.removeEventListener("keydown",this),this.node.removeEventListener("mousedown",this),this.node.removeEventListener("mousemove",this),this.node.removeEventListener("mouseleave",this),this.node.removeEventListener("focusout",this),this.node.removeEventListener("contextmenu",this),this._closeChildMenu()}onActivateRequest(e){this.isAttached&&this._focusItemAt(0)}onResize(e){this.update(),super.onResize(e)}onUpdateRequest(e){var t;let i=this._menus,s=this.renderer,n=this._activeIndex,a=this._tabFocusIndex>=0&&this._tabFocusIndex-1?this._overflowIndex:i.length,o=0,l=!1;r=null!==this._overflowMenu?r-1:r;let c=new Array(r);for(let e=0;e{this._tabFocusIndex=e,this.activeIndex=e}}),o+=this._menuItemSizes[e],i[e].title.label===this._overflowMenuOptions.title&&(l=!0,r--);if(this._overflowMenuOptions.isVisible)if(this._overflowIndex>-1&&!l){if(null===this._overflowMenu){const e=null!==(t=this._overflowMenuOptions.title)&&void 0!==t?t:"...";this._overflowMenu=new F({commands:new h.CommandRegistry}),this._overflowMenu.title.label=e,this._overflowMenu.title.mnemonic=0,this.addMenu(this._overflowMenu,!1)}for(let e=i.length-2;e>=r;e--){const t=this.menus[e];t.title.mnemonic=0,this._overflowMenu.insertItem(0,{type:"submenu",submenu:t}),this.removeMenu(t,!1)}c[r]=s.renderItem({title:this._overflowMenu.title,active:r===n&&0!==i[r].items.length,tabbable:r===a,disabled:0===i[r].items.length,onfocus:()=>{this._tabFocusIndex=r,this.activeIndex=r}}),r++}else if(null!==this._overflowMenu){let e=this._overflowMenu.items,t=this.node.offsetWidth,n=this._overflowMenu.items.length;for(let h=0;hthis._menuItemSizes[n]){let t=e[0].submenu;this._overflowMenu.removeItemAt(0),this.insertMenu(r,t,!1),c[r]=s.renderItem({title:t.title,active:!1,tabbable:r===a,disabled:0===i[r].items.length,onfocus:()=>{this._tabFocusIndex=r,this.activeIndex=r}}),r++}}0===this._overflowMenu.items.length&&(this.removeMenu(this._overflowMenu,!1),c.pop(),this._overflowMenu=null,this._overflowIndex=-1)}d.VirtualDOM.render(c,this.contentNode),this._updateOverflowIndex()}_updateOverflowIndex(){if(!this._overflowMenuOptions.isVisible)return;const e=this.contentNode.childNodes;let t=this.node.offsetWidth,i=0,s=-1,n=e.length;if(0==this._menuItemSizes.length)for(let a=0;at&&-1===s&&(s=a)}else for(let e=0;et){s=e;break}this._overflowIndex=s}_evtKeyDown(e){let t=e.keyCode;if(9===t)return void(this.activeIndex=-1);if(e.preventDefault(),e.stopPropagation(),13===t||32===t||38===t||40===t){if(this.activeIndex=this._tabFocusIndex,this.activeIndex!==this._tabFocusIndex)return;return void this.openActiveMenu()}if(27===t)return this._closeChildMenu(),void this._focusItemAt(this.activeIndex);if(37===t||39===t){let e=37===t?-1:1,i=this._tabFocusIndex+e,s=this._menus.length;for(let t=0;ts.ElementExt.hitTest(t,e.clientX,e.clientY)));if(-1!==i){if(0===e.button)if(this._childMenu)this._closeChildMenu(),this.activeIndex=i;else{e.preventDefault();const t=this._positionForMenu(i);F.saveWindowData(),this.activeIndex=i,this._openChildMenu(t)}}else this._closeChildMenu()}_evtMouseMove(e){let i=t.ArrayExt.findFirstIndex(this.contentNode.children,(t=>s.ElementExt.hitTest(t,e.clientX,e.clientY)));if(i===this._activeIndex)return;if(-1===i&&this._childMenu)return;const n=i>=0&&this._childMenu?this._positionForMenu(i):null;F.saveWindowData(),this.activeIndex=i,n&&this._openChildMenu(n)}_positionForMenu(e){let t=this.contentNode.children[e],{left:i,bottom:s}=t.getBoundingClientRect();return{top:s,left:i}}_evtFocusOut(e){this._childMenu||this.node.contains(e.relatedTarget)||(this.activeIndex=-1)}_focusItemAt(e){const t=this.contentNode.childNodes[e];t&&t.focus()}_openChildMenu(e={}){let t=this.activeMenu;if(!t)return void this._closeChildMenu();let i=this._childMenu;if(i===t)return;this._childMenu=t,i?i.close():document.addEventListener("mousedown",this,!0),this._tabFocusIndex=this.activeIndex,n.MessageLoop.sendMessage(this,b.Msg.UpdateRequest);let{left:s,top:a}=e;void 0!==s&&void 0!==a||({left:s,top:a}=this._positionForMenu(this._activeIndex)),i||this.addClass("lm-mod-active"),t.items.length>0&&t.open(s,a,this._forceItemsPosition)}_closeChildMenu(){if(!this._childMenu)return;this.removeClass("lm-mod-active"),document.removeEventListener("mousedown",this,!0);let e=this._childMenu;this._childMenu=null,e.close(),this.activeIndex=-1}_onMenuAboutToClose(e){e===this._childMenu&&(this.removeClass("lm-mod-active"),document.removeEventListener("mousedown",this,!0),this._childMenu=null,this.activeIndex=-1)}_onMenuMenuRequested(e,t){if(e!==this._childMenu)return;let i=this._activeIndex,s=this._menus.length;switch(t){case"next":this.activeIndex=i===s-1?0:i+1;break;case"previous":this.activeIndex=0===i?s-1:i-1}this.openActiveMenu()}_onTitleChanged(){this.update()}}!function(e){class t{renderItem(e){let t=this.createItemClass(e),i=this.createItemDataset(e),s=this.createItemARIA(e);return d.h.li({className:t,dataset:i,...e.disabled?{}:{tabindex:e.tabbable?"0":"-1"},onfocus:e.onfocus,...s},this.renderIcon(e),this.renderLabel(e))}renderIcon(e){let t=this.createIconClass(e);return d.h.div({className:t},e.title.icon,e.title.iconLabel)}renderLabel(e){let t=this.formatLabel(e);return d.h.div({className:"lm-MenuBar-itemLabel"},t)}createItemClass(e){let t="lm-MenuBar-item";return e.title.className&&(t+=` ${e.title.className}`),e.active&&!e.disabled&&(t+=" lm-mod-active"),t}createItemDataset(e){return e.title.dataset}createItemARIA(e){return{role:"menuitem","aria-haspopup":"true","aria-disabled":e.disabled?"true":"false"}}createIconClass(e){let t="lm-MenuBar-itemIcon",i=e.title.iconClass;return i?`${t} ${i}`:t}formatLabel(e){let{label:t,mnemonic:i}=e.title;if(i<0||i>=t.length)return t;let s=t.slice(0,i),n=t.slice(i+1),a=t[i];return[s,d.h.span({className:"lm-MenuBar-itemMnemonic"},a),n]}}e.Renderer=t,e.defaultRenderer=new t}(te||(te={})),function(e){e.createNode=function(){let e=document.createElement("div"),t=document.createElement("ul");return t.className="lm-MenuBar-content",e.appendChild(t),t.setAttribute("role","menubar"),e},e.findMnemonic=function(e,t,i){let s=-1,n=-1,a=!1,r=t.toUpperCase();for(let t=0,o=e.length;t=0&&l1&&this.widgets.forEach((e=>{e.hiddenMode=this._hiddenMode})))}dispose(){for(const e of this._items)e.dispose();this._box=null,this._items.length=0,super.dispose()}attachWidget(e,i){this._hiddenMode===b.HiddenMode.Scale&&this._items.length>0?(1===this._items.length&&(this.widgets[0].hiddenMode=b.HiddenMode.Scale),i.hiddenMode=b.HiddenMode.Scale):i.hiddenMode=b.HiddenMode.Display,t.ArrayExt.insert(this._items,e,new x(i)),this.parent.isAttached&&n.MessageLoop.sendMessage(i,b.Msg.BeforeAttach),this.parent.node.appendChild(i.node),this.parent.isAttached&&n.MessageLoop.sendMessage(i,b.Msg.AfterAttach),this.parent.fit()}moveWidget(e,i,s){t.ArrayExt.move(this._items,e,i),this.parent.update()}detachWidget(e,i){let s=t.ArrayExt.removeAt(this._items,e);this.parent.isAttached&&n.MessageLoop.sendMessage(i,b.Msg.BeforeDetach),this.parent.node.removeChild(i.node),this.parent.isAttached&&n.MessageLoop.sendMessage(i,b.Msg.AfterDetach),s.widget.node.style.zIndex="",this._hiddenMode===b.HiddenMode.Scale&&(i.hiddenMode=b.HiddenMode.Display,1===this._items.length&&(this._items[0].widget.hiddenMode=b.HiddenMode.Display)),s.dispose(),this.parent.fit()}onBeforeShow(e){super.onBeforeShow(e),this.parent.update()}onBeforeAttach(e){super.onBeforeAttach(e),this.parent.fit()}onChildShown(e){this.parent.fit()}onChildHidden(e){this.parent.fit()}onResize(e){this.parent.isVisible&&this._update(e.width,e.height)}onUpdateRequest(e){this.parent.isVisible&&this._update(-1,-1)}onFitRequest(e){this.parent.isAttached&&this._fit()}_fit(){let e=0,t=0;for(let i=0,s=this._items.length;i{t.ArrayExt.removeFirstOf(this._items,i)}))}open(e){if(F.saveWindowData(),this.menu.clearItems(),0===this._items.length)return!1;let t=T.matchItems(this._items,e,this._groupByTarget,this._sortBySelector);if(!t||0===t.length)return!1;for(const e of t)this.menu.addItem(e);return this.menu.open(e.clientX,e.clientY),!0}},e.DockLayout=Q,e.DockPanel=Z,e.FocusTracker=class{constructor(){this._counter=0,this._widgets=[],this._activeWidget=null,this._currentWidget=null,this._numbers=new Map,this._nodes=new Map,this._activeChanged=new r.Signal(this),this._currentChanged=new r.Signal(this)}dispose(){if(!(this._counter<0)){this._counter=-1,r.Signal.clearData(this);for(const e of this._widgets)e.node.removeEventListener("focus",this,!0),e.node.removeEventListener("blur",this,!0);this._activeWidget=null,this._currentWidget=null,this._nodes.clear(),this._numbers.clear(),this._widgets.length=0}}get currentChanged(){return this._currentChanged}get activeChanged(){return this._activeChanged}get isDisposed(){return this._counter<0}get currentWidget(){return this._currentWidget}get activeWidget(){return this._activeWidget}get widgets(){return this._widgets}focusNumber(e){let t=this._numbers.get(e);return void 0===t?-1:t}has(e){return this._numbers.has(e)}add(e){if(this._numbers.has(e))return;let t=e.node.contains(document.activeElement),i=t?this._counter++:-1;this._widgets.push(e),this._numbers.set(e,i),this._nodes.set(e.node,e),e.node.addEventListener("focus",this,!0),e.node.addEventListener("blur",this,!0),e.disposed.connect(this._onWidgetDisposed,this),t&&this._setWidgets(e,e)}remove(e){if(!this._numbers.has(e))return;if(e.disposed.disconnect(this._onWidgetDisposed,this),e.node.removeEventListener("focus",this,!0),e.node.removeEventListener("blur",this,!0),t.ArrayExt.removeFirstOf(this._widgets,e),this._nodes.delete(e.node),this._numbers.delete(e),this._currentWidget!==e)return;let i=this._widgets.filter((e=>-1!==this._numbers.get(e))),s=t.max(i,((e,t)=>this._numbers.get(e)-this._numbers.get(t)))||null;this._setWidgets(s,null)}handleEvent(e){switch(e.type){case"focus":this._evtFocus(e);break;case"blur":this._evtBlur(e)}}_setWidgets(e,t){let i=this._currentWidget;this._currentWidget=e;let s=this._activeWidget;this._activeWidget=t,i!==e&&this._currentChanged.emit({oldValue:i,newValue:e}),s!==t&&this._activeChanged.emit({oldValue:s,newValue:t})}_evtFocus(e){let t=this._nodes.get(e.currentTarget);t!==this._currentWidget&&this._numbers.set(t,this._counter++),this._setWidgets(t,t)}_evtBlur(e){let i=this._nodes.get(e.currentTarget),s=e.relatedTarget;s&&(i.node.contains(s)||t.find(this._widgets,(e=>e.node.contains(s))))||this._setWidgets(this._currentWidget,null)}_onWidgetDisposed(e){this.remove(e)}},e.GridLayout=ee,e.Layout=v,e.LayoutItem=x,e.Menu=F,e.MenuBar=te,e.Panel=R,e.PanelLayout=M,e.ScrollBar=class extends b{constructor(e={}){super({node:G.createNode()}),this._onRepeat=()=>{if(this._repeatTimer=-1,!this._pressData)return;let e=this._pressData.part;if("thumb"===e)return;this._repeatTimer=window.setTimeout(this._onRepeat,20);let t=this._pressData.mouseX,i=this._pressData.mouseY;if("decrement"!==e)if("increment"!==e){if("track"===e){if(!s.ElementExt.hitTest(this.trackNode,t,i))return;let e=this.thumbNode;if(s.ElementExt.hitTest(e,t,i))return;let n,a=e.getBoundingClientRect();return n="horizontal"===this._orientation?t0&&(r+=i.stretch,o++)}if(t===a)return 0;if(t<=s){for(let t=0;t=n){for(let t=0;t0&&s>h;){let t=s,n=r;for(let a=0;a0&&s>h;){let t=s/d;for(let n=0;n0&&s>h;){let t=s,n=r;for(let a=0;a=i.maxSize?(s-=i.maxSize-i.size,r-=i.stretch,i.size=i.maxSize,i.done=!0,d--,o--):(s-=h,i.size+=h)}}for(;d>0&&s>h;){let t=s/d;for(let n=0;n=i.maxSize?(s-=i.maxSize-i.size,i.size=i.maxSize,i.done=!0,d--):(s-=t,i.size+=t))}}}return 0},m.adjust=function(e,t,i){0!==e.length&&0!==i&&(i>0?function(e,t,i){let s=0;for(let i=0;i<=t;++i){let t=e[i];s+=t.maxSize-t.size}let n=0;for(let i=t+1,s=e.length;i=0&&a>0;--i){let t=e[i],s=t.maxSize-t.size;s>=a?(t.sizeHint=t.size+a,a=0):(t.sizeHint=t.size+s,a-=s)}let r=i;for(let i=t+1,s=e.length;i0;++i){let t=e[i],s=t.size-t.minSize;s>=r?(t.sizeHint=t.size-r,r=0):(t.sizeHint=t.size-s,r-=s)}}(e,t,i):function(e,t,i){let s=0;for(let i=t+1,n=e.length;i0;++i){let t=e[i],s=t.maxSize-t.size;s>=a?(t.sizeHint=t.size+a,a=0):(t.sizeHint=t.size+s,a-=s)}let r=i;for(let i=t;i>=0&&r>0;--i){let t=e[i],s=t.size-t.minSize;s>=r?(t.sizeHint=t.size-r,r=0):(t.sizeHint=t.size-s,r-=s)}}(e,t,-i))};class f{constructor(e){this._label="",this._caption="",this._mnemonic=-1,this._icon=void 0,this._iconClass="",this._iconLabel="",this._className="",this._closable=!1,this._changed=new r.Signal(this),this._isDisposed=!1,this.owner=e.owner,void 0!==e.label&&(this._label=e.label),void 0!==e.mnemonic&&(this._mnemonic=e.mnemonic),void 0!==e.icon&&(this._icon=e.icon),void 0!==e.iconClass&&(this._iconClass=e.iconClass),void 0!==e.iconLabel&&(this._iconLabel=e.iconLabel),void 0!==e.caption&&(this._caption=e.caption),void 0!==e.className&&(this._className=e.className),void 0!==e.closable&&(this._closable=e.closable),this._dataset=e.dataset||{}}get changed(){return this._changed}get label(){return this._label}set label(e){this._label!==e&&(this._label=e,this._changed.emit(void 0))}get mnemonic(){return this._mnemonic}set mnemonic(e){this._mnemonic!==e&&(this._mnemonic=e,this._changed.emit(void 0))}get icon(){return this._icon}set icon(e){this._icon!==e&&(this._icon=e,this._changed.emit(void 0))}get iconClass(){return this._iconClass}set iconClass(e){this._iconClass!==e&&(this._iconClass=e,this._changed.emit(void 0))}get iconLabel(){return this._iconLabel}set iconLabel(e){this._iconLabel!==e&&(this._iconLabel=e,this._changed.emit(void 0))}get caption(){return this._caption}set caption(e){this._caption!==e&&(this._caption=e,this._changed.emit(void 0))}get className(){return this._className}set className(e){this._className!==e&&(this._className=e,this._changed.emit(void 0))}get closable(){return this._closable}set closable(e){this._closable!==e&&(this._closable=e,this._changed.emit(void 0))}get dataset(){return this._dataset}set dataset(e){this._dataset!==e&&(this._dataset=e,this._changed.emit(void 0))}get isDisposed(){return this._isDisposed}dispose(){this.isDisposed||(this._isDisposed=!0,r.Signal.clearData(this))}}class b{constructor(e={}){this._flags=0,this._layout=null,this._parent=null,this._disposed=new r.Signal(this),this._hiddenMode=b.HiddenMode.Display,this.node=g.createNode(e),this.addClass("lm-Widget")}dispose(){this.isDisposed||(this.setFlag(b.Flag.IsDisposed),this._disposed.emit(void 0),this.parent?this.parent=null:this.isAttached&&b.detach(this),this._layout&&(this._layout.dispose(),this._layout=null),this.title.dispose(),r.Signal.clearData(this),n.MessageLoop.clearData(this),a.AttachedProperty.clearData(this))}get disposed(){return this._disposed}get isDisposed(){return this.testFlag(b.Flag.IsDisposed)}get isAttached(){return this.testFlag(b.Flag.IsAttached)}get isHidden(){return this.testFlag(b.Flag.IsHidden)}get isVisible(){let e=this;do{if(e.isHidden||!e.isAttached)return!1;e=e.parent}while(null!=e);return!0}get title(){return g.titleProperty.get(this)}get id(){return this.node.id}set id(e){this.node.id=e}get dataset(){return this.node.dataset}get hiddenMode(){return this._hiddenMode}set hiddenMode(e){this._hiddenMode!==e&&(this.isHidden&&this._toggleHidden(!1),e==b.HiddenMode.Scale?this.node.style.willChange="transform":this.node.style.willChange="auto",this._hiddenMode=e,this.isHidden&&this._toggleHidden(!0))}get parent(){return this._parent}set parent(e){if(this._parent!==e){if(e&&this.contains(e))throw new Error("Invalid parent widget.");if(this._parent&&!this._parent.isDisposed){let e=new b.ChildMessage("child-removed",this);n.MessageLoop.sendMessage(this._parent,e)}if(this._parent=e,this._parent&&!this._parent.isDisposed){let e=new b.ChildMessage("child-added",this);n.MessageLoop.sendMessage(this._parent,e)}this.isDisposed||n.MessageLoop.sendMessage(this,b.Msg.ParentChanged)}}get layout(){return this._layout}set layout(e){if(this._layout!==e){if(this.testFlag(b.Flag.DisallowLayout))throw new Error("Cannot set widget layout.");if(this._layout)throw new Error("Cannot change widget layout.");if(e.parent)throw new Error("Cannot change layout parent.");this._layout=e,e.parent=this}}*children(){this._layout&&(yield*this._layout)}contains(e){for(let t=e;t;t=t._parent)if(t===this)return!0;return!1}hasClass(e){return this.node.classList.contains(e)}addClass(e){this.node.classList.add(e)}removeClass(e){this.node.classList.remove(e)}toggleClass(e,t){return!0===t?(this.node.classList.add(e),!0):!1===t?(this.node.classList.remove(e),!1):this.node.classList.toggle(e)}update(){n.MessageLoop.postMessage(this,b.Msg.UpdateRequest)}fit(){n.MessageLoop.postMessage(this,b.Msg.FitRequest)}activate(){n.MessageLoop.postMessage(this,b.Msg.ActivateRequest)}close(){n.MessageLoop.sendMessage(this,b.Msg.CloseRequest)}show(){if(this.testFlag(b.Flag.IsHidden)&&(!this.isAttached||this.parent&&!this.parent.isVisible||n.MessageLoop.sendMessage(this,b.Msg.BeforeShow),this.clearFlag(b.Flag.IsHidden),this._toggleHidden(!1),!this.isAttached||this.parent&&!this.parent.isVisible||n.MessageLoop.sendMessage(this,b.Msg.AfterShow),this.parent)){let e=new b.ChildMessage("child-shown",this);n.MessageLoop.sendMessage(this.parent,e)}}hide(){if(!this.testFlag(b.Flag.IsHidden)&&(!this.isAttached||this.parent&&!this.parent.isVisible||n.MessageLoop.sendMessage(this,b.Msg.BeforeHide),this.setFlag(b.Flag.IsHidden),this._toggleHidden(!0),!this.isAttached||this.parent&&!this.parent.isVisible||n.MessageLoop.sendMessage(this,b.Msg.AfterHide),this.parent)){let e=new b.ChildMessage("child-hidden",this);n.MessageLoop.sendMessage(this.parent,e)}}setHidden(e){e?this.hide():this.show()}testFlag(e){return 0!=(this._flags&e)}setFlag(e){this._flags|=e}clearFlag(e){this._flags&=~e}processMessage(e){switch(e.type){case"resize":this.notifyLayout(e),this.onResize(e);break;case"update-request":this.notifyLayout(e),this.onUpdateRequest(e);break;case"fit-request":this.notifyLayout(e),this.onFitRequest(e);break;case"before-show":this.notifyLayout(e),this.onBeforeShow(e);break;case"after-show":this.setFlag(b.Flag.IsVisible),this.notifyLayout(e),this.onAfterShow(e);break;case"before-hide":this.notifyLayout(e),this.onBeforeHide(e);break;case"after-hide":this.clearFlag(b.Flag.IsVisible),this.notifyLayout(e),this.onAfterHide(e);break;case"before-attach":this.notifyLayout(e),this.onBeforeAttach(e);break;case"after-attach":this.isHidden||this.parent&&!this.parent.isVisible||this.setFlag(b.Flag.IsVisible),this.setFlag(b.Flag.IsAttached),this.notifyLayout(e),this.onAfterAttach(e);break;case"before-detach":this.notifyLayout(e),this.onBeforeDetach(e);break;case"after-detach":this.clearFlag(b.Flag.IsVisible),this.clearFlag(b.Flag.IsAttached),this.notifyLayout(e),this.onAfterDetach(e);break;case"activate-request":this.notifyLayout(e),this.onActivateRequest(e);break;case"close-request":this.notifyLayout(e),this.onCloseRequest(e);break;case"child-added":this.notifyLayout(e),this.onChildAdded(e);break;case"child-removed":this.notifyLayout(e),this.onChildRemoved(e);break;default:this.notifyLayout(e)}}notifyLayout(e){this._layout&&this._layout.processParentMessage(e)}onCloseRequest(e){this.parent?this.parent=null:this.isAttached&&b.detach(this)}onResize(e){}onUpdateRequest(e){}onFitRequest(e){}onActivateRequest(e){}onBeforeShow(e){}onAfterShow(e){}onBeforeHide(e){}onAfterHide(e){}onBeforeAttach(e){}onAfterAttach(e){}onBeforeDetach(e){}onAfterDetach(e){}onChildAdded(e){}onChildRemoved(e){}_toggleHidden(e){if(e)switch(this._hiddenMode){case b.HiddenMode.Display:this.addClass("lm-mod-hidden");break;case b.HiddenMode.Scale:this.node.style.transform="scale(0)",this.node.setAttribute("aria-hidden","true");break;case b.HiddenMode.ContentVisibility:this.node.style.contentVisibility="hidden",this.node.style.zIndex="-1"}else switch(this._hiddenMode){case b.HiddenMode.Display:this.removeClass("lm-mod-hidden");break;case b.HiddenMode.Scale:this.node.style.transform="",this.node.removeAttribute("aria-hidden");break;case b.HiddenMode.ContentVisibility:this.node.style.contentVisibility="",this.node.style.zIndex=""}}}!function(e){var t,i,s;(t=e.HiddenMode||(e.HiddenMode={}))[t.Display=0]="Display",t[t.Scale=1]="Scale",t[t.ContentVisibility=2]="ContentVisibility",(i=e.Flag||(e.Flag={}))[i.IsDisposed=1]="IsDisposed",i[i.IsAttached=2]="IsAttached",i[i.IsHidden=4]="IsHidden",i[i.IsVisible=8]="IsVisible",i[i.DisallowLayout=16]="DisallowLayout",(s=e.Msg||(e.Msg={})).BeforeShow=new n.Message("before-show"),s.AfterShow=new n.Message("after-show"),s.BeforeHide=new n.Message("before-hide"),s.AfterHide=new n.Message("after-hide"),s.BeforeAttach=new n.Message("before-attach"),s.AfterAttach=new n.Message("after-attach"),s.BeforeDetach=new n.Message("before-detach"),s.AfterDetach=new n.Message("after-detach"),s.ParentChanged=new n.Message("parent-changed"),s.UpdateRequest=new n.ConflatableMessage("update-request"),s.FitRequest=new n.ConflatableMessage("fit-request"),s.ActivateRequest=new n.ConflatableMessage("activate-request"),s.CloseRequest=new n.ConflatableMessage("close-request");class a extends n.Message{constructor(e,t){super(e),this.child=t}}e.ChildMessage=a;class r extends n.Message{constructor(e,t){super("resize"),this.width=e,this.height=t}}e.ResizeMessage=r,function(e){e.UnknownSize=new e(-1,-1)}(r=e.ResizeMessage||(e.ResizeMessage={})),e.attach=function(t,i,s=null){if(t.parent)throw new Error("Cannot attach a child widget.");if(t.isAttached||t.node.isConnected)throw new Error("Widget is already attached.");if(!i.isConnected)throw new Error("Host is not attached.");n.MessageLoop.sendMessage(t,e.Msg.BeforeAttach),i.insertBefore(t.node,s),n.MessageLoop.sendMessage(t,e.Msg.AfterAttach)},e.detach=function(t){if(t.parent)throw new Error("Cannot detach a child widget.");if(!t.isAttached||!t.node.isConnected)throw new Error("Widget is not attached.");n.MessageLoop.sendMessage(t,e.Msg.BeforeDetach),t.node.parentNode.removeChild(t.node),n.MessageLoop.sendMessage(t,e.Msg.AfterDetach)}}(b||(b={})),function(e){e.titleProperty=new a.AttachedProperty({name:"title",create:e=>new f({owner:e})}),e.createNode=function(e){return e.node||document.createElement(e.tag||"div")}}(g||(g={}));class v{constructor(e={}){this._disposed=!1,this._parent=null,this._fitPolicy=e.fitPolicy||"set-min-size"}dispose(){this._parent=null,this._disposed=!0,r.Signal.clearData(this),a.AttachedProperty.clearData(this)}get isDisposed(){return this._disposed}get parent(){return this._parent}set parent(e){if(this._parent!==e){if(this._parent)throw new Error("Cannot change parent widget.");if(e.layout!==this)throw new Error("Invalid parent widget.");this._parent=e,this.init()}}get fitPolicy(){return this._fitPolicy}set fitPolicy(e){if(this._fitPolicy!==e&&(this._fitPolicy=e,this._parent)){let e=this._parent.node.style;e.minWidth="",e.minHeight="",e.maxWidth="",e.maxHeight="",this._parent.fit()}}processParentMessage(e){switch(e.type){case"resize":this.onResize(e);break;case"update-request":this.onUpdateRequest(e);break;case"fit-request":this.onFitRequest(e);break;case"before-show":this.onBeforeShow(e);break;case"after-show":this.onAfterShow(e);break;case"before-hide":this.onBeforeHide(e);break;case"after-hide":this.onAfterHide(e);break;case"before-attach":this.onBeforeAttach(e);break;case"after-attach":this.onAfterAttach(e);break;case"before-detach":this.onBeforeDetach(e);break;case"after-detach":this.onAfterDetach(e);break;case"child-removed":this.onChildRemoved(e);break;case"child-shown":this.onChildShown(e);break;case"child-hidden":this.onChildHidden(e)}}init(){for(const e of this)e.parent=this.parent}onResize(e){for(const e of this)n.MessageLoop.sendMessage(e,b.ResizeMessage.UnknownSize)}onUpdateRequest(e){for(const e of this)n.MessageLoop.sendMessage(e,b.ResizeMessage.UnknownSize)}onBeforeAttach(e){for(const t of this)n.MessageLoop.sendMessage(t,e)}onAfterAttach(e){for(const t of this)n.MessageLoop.sendMessage(t,e)}onBeforeDetach(e){for(const t of this)n.MessageLoop.sendMessage(t,e)}onAfterDetach(e){for(const t of this)n.MessageLoop.sendMessage(t,e)}onBeforeShow(e){for(const t of this)t.isHidden||n.MessageLoop.sendMessage(t,e)}onAfterShow(e){for(const t of this)t.isHidden||n.MessageLoop.sendMessage(t,e)}onBeforeHide(e){for(const t of this)t.isHidden||n.MessageLoop.sendMessage(t,e)}onAfterHide(e){for(const t of this)t.isHidden||n.MessageLoop.sendMessage(t,e)}onChildRemoved(e){this.removeWidget(e.child)}onFitRequest(e){}onChildShown(e){}onChildHidden(e){}}!function(e){e.getHorizontalAlignment=function(e){return p.horizontalAlignmentProperty.get(e)},e.setHorizontalAlignment=function(e,t){p.horizontalAlignmentProperty.set(e,t)},e.getVerticalAlignment=function(e){return p.verticalAlignmentProperty.get(e)},e.setVerticalAlignment=function(e,t){p.verticalAlignmentProperty.set(e,t)}}(v||(v={}));class x{constructor(e){this._top=NaN,this._left=NaN,this._width=NaN,this._height=NaN,this._minWidth=0,this._minHeight=0,this._maxWidth=1/0,this._maxHeight=1/0,this._disposed=!1,this.widget=e,this.widget.node.style.position="absolute",this.widget.node.style.contain="strict"}dispose(){if(this._disposed)return;this._disposed=!0;let e=this.widget.node.style;e.position="",e.top="",e.left="",e.width="",e.height="",e.contain=""}get minWidth(){return this._minWidth}get minHeight(){return this._minHeight}get maxWidth(){return this._maxWidth}get maxHeight(){return this._maxHeight}get isDisposed(){return this._disposed}get isHidden(){return this.widget.isHidden}get isVisible(){return this.widget.isVisible}get isAttached(){return this.widget.isAttached}fit(){let e=s.ElementExt.sizeLimits(this.widget.node);this._minWidth=e.minWidth,this._minHeight=e.minHeight,this._maxWidth=e.maxWidth,this._maxHeight=e.maxHeight}update(e,t,i,s){let a=Math.max(this._minWidth,Math.min(i,this._maxWidth)),r=Math.max(this._minHeight,Math.min(s,this._maxHeight));if(a"center",changed:t}),e.verticalAlignmentProperty=new a.AttachedProperty({name:"verticalAlignment",create:()=>"top",changed:t})}(p||(p={}));class M extends v{constructor(){super(...arguments),this._widgets=[]}dispose(){for(;this._widgets.length>0;)this._widgets.pop().dispose();super.dispose()}get widgets(){return this._widgets}*[Symbol.iterator](){yield*this._widgets}addWidget(e){this.insertWidget(this._widgets.length,e)}insertWidget(e,i){i.parent=this.parent;let s=this._widgets.indexOf(i),n=Math.max(0,Math.min(e,this._widgets.length));if(-1===s)return t.ArrayExt.insert(this._widgets,n,i),void(this.parent&&this.attachWidget(n,i));n===this._widgets.length&&n--,s!==n&&(t.ArrayExt.move(this._widgets,s,n),this.parent&&this.moveWidget(s,n,i))}removeWidget(e){this.removeWidgetAt(this._widgets.indexOf(e))}removeWidgetAt(e){let i=t.ArrayExt.removeAt(this._widgets,e);i&&this.parent&&this.detachWidget(e,i)}init(){super.init();let e=0;for(const t of this)this.attachWidget(e++,t)}attachWidget(e,t){let i=this.parent.node.children[e];this.parent.isAttached&&n.MessageLoop.sendMessage(t,b.Msg.BeforeAttach),this.parent.node.insertBefore(t.node,i),this.parent.isAttached&&n.MessageLoop.sendMessage(t,b.Msg.AfterAttach)}moveWidget(e,t,i){this.parent.isAttached&&n.MessageLoop.sendMessage(i,b.Msg.BeforeDetach),this.parent.node.removeChild(i.node),this.parent.isAttached&&n.MessageLoop.sendMessage(i,b.Msg.AfterDetach);let s=this.parent.node.children[t];this.parent.isAttached&&n.MessageLoop.sendMessage(i,b.Msg.BeforeAttach),this.parent.node.insertBefore(i.node,s),this.parent.isAttached&&n.MessageLoop.sendMessage(i,b.Msg.AfterAttach)}detachWidget(e,t){this.parent.isAttached&&n.MessageLoop.sendMessage(t,b.Msg.BeforeDetach),this.parent.node.removeChild(t.node),this.parent.isAttached&&n.MessageLoop.sendMessage(t,b.Msg.AfterDetach)}}!function(e){e.clampDimension=function(e){return Math.max(0,Math.floor(e))}}(_||(_={}));var y,w,A,E,C,S,I,z,L,T,D=_;class B extends M{constructor(e){super(),this.widgetOffset=0,this._fixed=0,this._spacing=4,this._dirty=!1,this._hasNormedSizes=!1,this._sizers=[],this._items=[],this._handles=[],this._box=null,this._alignment="start",this._orientation="horizontal",this.renderer=e.renderer,void 0!==e.orientation&&(this._orientation=e.orientation),void 0!==e.alignment&&(this._alignment=e.alignment),void 0!==e.spacing&&(this._spacing=_.clampDimension(e.spacing))}dispose(){for(const e of this._items)e.dispose();this._box=null,this._items.length=0,this._sizers.length=0,this._handles.length=0,super.dispose()}get orientation(){return this._orientation}set orientation(e){this._orientation!==e&&(this._orientation=e,this.parent&&(this.parent.dataset.orientation=e,this.parent.fit()))}get alignment(){return this._alignment}set alignment(e){this._alignment!==e&&(this._alignment=e,this.parent&&(this.parent.dataset.alignment=e,this.parent.update()))}get spacing(){return this._spacing}set spacing(e){e=_.clampDimension(e),this._spacing!==e&&(this._spacing=e,this.parent&&this.parent.fit())}get handles(){return this._handles}absoluteSizes(){return this._sizers.map((e=>e.size))}relativeSizes(){return y.normalize(this._sizers.map((e=>e.size)))}setRelativeSizes(e,t=!0){let i=this._sizers.length,s=e.slice(0,i);for(;s.length0&&(e.sizeHint=e.size);e.BoxEngine.adjust(this._sizers,t,s),this.parent&&this.parent.update()}}init(){this.parent.dataset.orientation=this.orientation,this.parent.dataset.alignment=this.alignment,super.init()}attachWidget(e,i){let s=new x(i),a=y.createHandle(this.renderer),r=y.averageSize(this._sizers),o=y.createSizer(r);t.ArrayExt.insert(this._items,e,s),t.ArrayExt.insert(this._sizers,e,o),t.ArrayExt.insert(this._handles,e,a),this.parent.isAttached&&n.MessageLoop.sendMessage(i,b.Msg.BeforeAttach),this.parent.node.appendChild(i.node),this.parent.node.appendChild(a),this.parent.isAttached&&n.MessageLoop.sendMessage(i,b.Msg.AfterAttach),this.parent.fit()}moveWidget(e,i,s){t.ArrayExt.move(this._items,e,i),t.ArrayExt.move(this._sizers,e,i),t.ArrayExt.move(this._handles,e,i),this.parent.fit()}detachWidget(e,i){let s=t.ArrayExt.removeAt(this._items,e),a=t.ArrayExt.removeAt(this._handles,e);t.ArrayExt.removeAt(this._sizers,e),this.parent.isAttached&&n.MessageLoop.sendMessage(i,b.Msg.BeforeDetach),this.parent.node.removeChild(i.node),this.parent.node.removeChild(a),this.parent.isAttached&&n.MessageLoop.sendMessage(i,b.Msg.AfterDetach),s.dispose(),this.parent.fit()}onBeforeShow(e){super.onBeforeShow(e),this.parent.update()}onBeforeAttach(e){super.onBeforeAttach(e),this.parent.fit()}onChildShown(e){this.parent.fit()}onChildHidden(e){this.parent.fit()}onResize(e){this.parent.isVisible&&this._update(e.width,e.height)}onUpdateRequest(e){this.parent.isVisible&&this._update(-1,-1)}onFitRequest(e){this.parent.isAttached&&this._fit()}updateItemPosition(e,t,i,s,n,a,r){const o=this._items[e];if(o.isHidden)return;let h=this._handles[e].style;t?(i+=this.widgetOffset,o.update(i,s,r,n),i+=r,h.top=`${s}px`,h.left=`${i}px`,h.width=`${this._spacing}px`,h.height=`${n}px`):(s+=this.widgetOffset,o.update(i,s,a,r),s+=r,h.top=`${s}px`,h.left=`${i}px`,h.width=`${a}px`,h.height=`${this._spacing}px`)}_fit(){let e=0,t=-1;for(let i=0,s=this._items.length;i0&&(s.sizeHint=s.size),t.isHidden?(s.minSize=0,s.maxSize=0):(t.fit(),s.stretch=B.getStretch(t.widget),i?(s.minSize=t.minWidth,s.maxSize=t.maxWidth,a+=t.minWidth,r=Math.max(r,t.minHeight)):(s.minSize=t.minHeight,s.maxSize=t.maxHeight,r+=t.minHeight,a=Math.max(a,t.minWidth)))}let o=this._box=s.ElementExt.boxSizing(this.parent.node);a+=o.horizontalSum,r+=o.verticalSum;let h=this.parent.node.style;h.minWidth=`${a}px`,h.minHeight=`${r}px`,this._dirty=!0,this.parent.parent&&n.MessageLoop.sendMessage(this.parent.parent,b.Msg.FitRequest),this._dirty&&n.MessageLoop.sendMessage(this.parent,b.Msg.UpdateRequest)}_update(t,i){this._dirty=!1;let n=0;for(let e=0,t=this._items.length;e0){let t;if(t=c?Math.max(0,o-this._fixed):Math.max(0,h-this._fixed),this._hasNormedSizes){for(let e of this._sizers)e.sizeHint*=t;this._hasNormedSizes=!1}let i=e.BoxEngine.calc(this._sizers,t);if(i>0)switch(this._alignment){case"start":break;case"center":d=0,l=i/2;break;case"end":d=0,l=i;break;case"justify":d=i/n,l=0;break;default:throw"unreachable"}}for(let e=0,t=this._items.length;e0,coerce:(e,t)=>Math.max(0,Math.floor(t)),changed:function(e){e.parent&&e.parent.layout instanceof B&&e.parent.fit()}}),e.createSizer=function(e){let t=new u;return t.sizeHint=Math.floor(e),t},e.createHandle=function(e){let t=e.createHandle();return t.style.position="absolute",t.style.contain="style",t},e.averageSize=function(e){return e.reduce(((e,t)=>e+t.size),0)/e.length||0},e.normalize=function(e){let t=e.length;if(0===t)return[];let i=e.reduce(((e,t)=>e+Math.abs(t)),0);return 0===i?e.map((e=>1/t)):e.map((e=>e/i))}}(y||(y={}));class k extends B{constructor(e){super({...e,orientation:e.orientation||"vertical"}),this._titles=[],this.titleSpace=e.titleSpace||22}get titleSpace(){return this.widgetOffset}set titleSpace(e){e=D.clampDimension(e),this.widgetOffset!==e&&(this.widgetOffset=e,this.parent&&this.parent.fit())}get titles(){return this._titles}dispose(){this.isDisposed||(this._titles.length=0,super.dispose())}updateTitle(e,t){const i=this._titles[e],s=i.classList.contains("lm-mod-expanded"),n=w.createTitle(this.renderer,t.title,s);this._titles[e]=n,this.parent.node.replaceChild(n,i)}insertWidget(e,t){t.id||(t.id=`id-${i.UUID.uuid4()}`),super.insertWidget(e,t)}attachWidget(e,i){const s=w.createTitle(this.renderer,i.title);t.ArrayExt.insert(this._titles,e,s),this.parent.node.appendChild(s),i.node.setAttribute("role","region"),i.node.setAttribute("aria-labelledby",s.id),super.attachWidget(e,i)}moveWidget(e,i,s){t.ArrayExt.move(this._titles,e,i),super.moveWidget(e,i,s)}detachWidget(e,i){const s=t.ArrayExt.removeAt(this._titles,e);this.parent.node.removeChild(s),super.detachWidget(e,i)}updateItemPosition(e,t,i,s,n,a,r){const o=this._titles[e].style;o.top=`${s}px`,o.left=`${i}px`,o.height=`${this.widgetOffset}px`,o.width=t?`${n}px`:`${a}px`,super.updateItemPosition(e,t,i,s,n,a,r)}}!function(e){e.createTitle=function(e,t,i=!0){const s=e.createSectionTitle(t);return s.style.position="absolute",s.style.contain="strict",s.setAttribute("aria-label",`${t.label} Section`),s.setAttribute("aria-expanded",i?"true":"false"),s.setAttribute("aria-controls",t.owner.id),i&&s.classList.add("lm-mod-expanded"),s}}(w||(w={}));class R extends b{constructor(e={}){super(),this.addClass("lm-Panel"),this.layout=A.createLayout(e)}get widgets(){return this.layout.widgets}addWidget(e){this.layout.addWidget(e)}insertWidget(e,t){this.layout.insertWidget(e,t)}}!function(e){e.createLayout=function(e){return e.layout||new M}}(A||(A={}));class N extends R{constructor(e={}){super({layout:E.createLayout(e)}),this._handleMoved=new r.Signal(this),this._pressData=null,this.addClass("lm-SplitPanel")}dispose(){this._releaseMouse(),super.dispose()}get orientation(){return this.layout.orientation}set orientation(e){this.layout.orientation=e}get alignment(){return this.layout.alignment}set alignment(e){this.layout.alignment=e}get spacing(){return this.layout.spacing}set spacing(e){this.layout.spacing=e}get renderer(){return this.layout.renderer}get handleMoved(){return this._handleMoved}get handles(){return this.layout.handles}relativeSizes(){return this.layout.relativeSizes()}setRelativeSizes(e,t=!0){this.layout.setRelativeSizes(e,t)}handleEvent(e){switch(e.type){case"pointerdown":this._evtPointerDown(e);break;case"pointermove":this._evtPointerMove(e);break;case"pointerup":this._evtPointerUp(e);break;case"keydown":this._evtKeyDown(e);break;case"contextmenu":e.preventDefault(),e.stopPropagation()}}onBeforeAttach(e){this.node.addEventListener("pointerdown",this)}onAfterDetach(e){this.node.removeEventListener("pointerdown",this),this._releaseMouse()}onChildAdded(e){e.child.addClass("lm-SplitPanel-child"),this._releaseMouse()}onChildRemoved(e){e.child.removeClass("lm-SplitPanel-child"),this._releaseMouse()}_evtKeyDown(e){this._pressData&&(e.preventDefault(),e.stopPropagation()),27===e.keyCode&&this._releaseMouse()}_evtPointerDown(e){if(0!==e.button)return;let i,s=this.layout,n=t.ArrayExt.findFirstIndex(s.handles,(t=>t.contains(e.target)));if(-1===n)return;e.preventDefault(),e.stopPropagation(),document.addEventListener("pointerup",this,!0),document.addEventListener("pointermove",this,!0),document.addEventListener("keydown",this,!0),document.addEventListener("contextmenu",this,!0);let a=s.handles[n],r=a.getBoundingClientRect();i="horizontal"===s.orientation?e.clientX-r.left:e.clientY-r.top;let h=window.getComputedStyle(a),d=o.Drag.overrideCursor(h.cursor);this._pressData={index:n,delta:i,override:d}}_evtPointerMove(e){let t;e.preventDefault(),e.stopPropagation();let i=this.layout,s=this.node.getBoundingClientRect();t="horizontal"===i.orientation?e.clientX-s.left-this._pressData.delta:e.clientY-s.top-this._pressData.delta,i.moveHandle(this._pressData.index,t)}_evtPointerUp(e){0===e.button&&(e.preventDefault(),e.stopPropagation(),this._releaseMouse())}_releaseMouse(){this._pressData&&(this._pressData.override.dispose(),this._pressData=null,this._handleMoved.emit(),document.removeEventListener("keydown",this,!0),document.removeEventListener("pointerup",this,!0),document.removeEventListener("pointermove",this,!0),document.removeEventListener("contextmenu",this,!0))}}!function(e){class t{createHandle(){let e=document.createElement("div");return e.className="lm-SplitPanel-handle",e}}e.Renderer=t,e.defaultRenderer=new t,e.getStretch=function(e){return B.getStretch(e)},e.setStretch=function(e,t){B.setStretch(e,t)}}(N||(N={})),function(e){e.createLayout=function(e){return e.layout||new B({renderer:e.renderer||N.defaultRenderer,orientation:e.orientation,alignment:e.alignment,spacing:e.spacing})}}(E||(E={}));class H extends N{constructor(e={}){super({...e,layout:C.createLayout(e)}),this._widgetSizesCache=new WeakMap,this._expansionToggled=new r.Signal(this),this.addClass("lm-AccordionPanel")}get renderer(){return this.layout.renderer}get titleSpace(){return this.layout.titleSpace}set titleSpace(e){this.layout.titleSpace=e}get titles(){return this.layout.titles}get expansionToggled(){return this._expansionToggled}addWidget(e){super.addWidget(e),e.title.changed.connect(this._onTitleChanged,this)}collapse(e){const t=this.layout.widgets[e];t&&!t.isHidden&&this._toggleExpansion(e)}expand(e){const t=this.layout.widgets[e];t&&t.isHidden&&this._toggleExpansion(e)}insertWidget(e,t){super.insertWidget(e,t),t.title.changed.connect(this._onTitleChanged,this)}handleEvent(e){switch(super.handleEvent(e),e.type){case"click":this._evtClick(e);break;case"keydown":this._eventKeyDown(e)}}onBeforeAttach(e){this.node.addEventListener("click",this),this.node.addEventListener("keydown",this),super.onBeforeAttach(e)}onAfterDetach(e){super.onAfterDetach(e),this.node.removeEventListener("click",this),this.node.removeEventListener("keydown",this)}_onTitleChanged(e){const i=t.ArrayExt.findFirstIndex(this.widgets,(t=>t.contains(e.owner)));i>=0&&(this.layout.updateTitle(i,e.owner),this.update())}_computeWidgetSize(e){const t=this.layout,i=t.widgets[e];if(!i)return;const s=i.isHidden,n=t.absoluteSizes(),a=(s?-1:1)*this.spacing,r=n.reduce(((e,t)=>e+t));let o=[...n];if(s){const t=this._widgetSizesCache.get(i);if(!t)return;o[e]+=t;const s=o.map((e=>e-t>0)).lastIndexOf(!0);-1===s?o.forEach(((i,s)=>{s!==e&&(o[s]-=n[s]/r*(t-a))})):o[s]-=t-a}else{const t=n[e];this._widgetSizesCache.set(i,t),o[e]=0;const s=o.map((e=>e>0)).lastIndexOf(!0);if(-1===s)return;o[s]=n[s]+t+a}return o.map((e=>e/(r+a)))}_evtClick(e){const i=e.target;if(i){const s=t.ArrayExt.findFirstIndex(this.titles,(e=>e.contains(i)));s>=0&&(e.preventDefault(),e.stopPropagation(),this._toggleExpansion(s))}}_eventKeyDown(e){if(e.defaultPrevented)return;const i=e.target;let s=!1;if(i){const n=t.ArrayExt.findFirstIndex(this.titles,(e=>e.contains(i)));if(n>=0){const t=e.keyCode.toString();if(e.key.match(/Space|Enter/)||t.match(/13|32/))i.click(),s=!0;else if("horizontal"===this.orientation?e.key.match(/ArrowLeft|ArrowRight/)||t.match(/37|39/):e.key.match(/ArrowUp|ArrowDown/)||t.match(/38|40/)){const i=e.key.match(/ArrowLeft|ArrowUp/)||t.match(/37|38/)?-1:1,a=this.titles.length,r=(n+a+i)%a;this.titles[r].focus(),s=!0}else"End"===e.key||"35"===t?(this.titles[this.titles.length-1].focus(),s=!0):"Home"!==e.key&&"36"!==t||(this.titles[0].focus(),s=!0)}s&&e.preventDefault()}}_toggleExpansion(e){const t=this.titles[e],i=this.layout.widgets[e],s=this._computeWidgetSize(e);s&&this.setRelativeSizes(s,!1),i.isHidden?(t.classList.add("lm-mod-expanded"),t.setAttribute("aria-expanded","true"),i.show()):(t.classList.remove("lm-mod-expanded"),t.setAttribute("aria-expanded","false"),i.hide()),this._expansionToggled.emit(e)}}!function(e){class t extends N.Renderer{constructor(){super(),this.titleClassName="lm-AccordionPanel-title",this._titleID=0,this._titleKeys=new WeakMap,this._uuid=++t._nInstance}createCollapseIcon(e){return document.createElement("span")}createSectionTitle(e){const t=document.createElement("h3");t.setAttribute("tabindex","0"),t.id=this.createTitleKey(e),t.className=this.titleClassName;for(const i in e.dataset)t.dataset[i]=e.dataset[i];t.appendChild(this.createCollapseIcon(e)).className="lm-AccordionPanel-titleCollapser";const i=t.appendChild(document.createElement("span"));return i.className="lm-AccordionPanel-titleLabel",i.textContent=e.label,i.title=e.caption||e.label,t}createTitleKey(e){let t=this._titleKeys.get(e);return void 0===t&&(t=`title-key-${this._uuid}-${this._titleID++}`,this._titleKeys.set(e,t)),t}}t._nInstance=0,e.Renderer=t,e.defaultRenderer=new t}(H||(H={})),function(e){e.createLayout=function(e){return e.layout||new k({renderer:e.renderer||H.defaultRenderer,orientation:e.orientation,alignment:e.alignment,spacing:e.spacing,titleSpace:e.titleSpace})}}(C||(C={}));class P extends M{constructor(e={}){super(),this._fixed=0,this._spacing=4,this._dirty=!1,this._sizers=[],this._items=[],this._box=null,this._alignment="start",this._direction="top-to-bottom",void 0!==e.direction&&(this._direction=e.direction),void 0!==e.alignment&&(this._alignment=e.alignment),void 0!==e.spacing&&(this._spacing=D.clampDimension(e.spacing))}dispose(){for(const e of this._items)e.dispose();this._box=null,this._items.length=0,this._sizers.length=0,super.dispose()}get direction(){return this._direction}set direction(e){this._direction!==e&&(this._direction=e,this.parent&&(this.parent.dataset.direction=e,this.parent.fit()))}get alignment(){return this._alignment}set alignment(e){this._alignment!==e&&(this._alignment=e,this.parent&&(this.parent.dataset.alignment=e,this.parent.update()))}get spacing(){return this._spacing}set spacing(e){e=D.clampDimension(e),this._spacing!==e&&(this._spacing=e,this.parent&&this.parent.fit())}init(){this.parent.dataset.direction=this.direction,this.parent.dataset.alignment=this.alignment,super.init()}attachWidget(e,i){t.ArrayExt.insert(this._items,e,new x(i)),t.ArrayExt.insert(this._sizers,e,new u),this.parent.isAttached&&n.MessageLoop.sendMessage(i,b.Msg.BeforeAttach),this.parent.node.appendChild(i.node),this.parent.isAttached&&n.MessageLoop.sendMessage(i,b.Msg.AfterAttach),this.parent.fit()}moveWidget(e,i,s){t.ArrayExt.move(this._items,e,i),t.ArrayExt.move(this._sizers,e,i),this.parent.update()}detachWidget(e,i){let s=t.ArrayExt.removeAt(this._items,e);t.ArrayExt.removeAt(this._sizers,e),this.parent.isAttached&&n.MessageLoop.sendMessage(i,b.Msg.BeforeDetach),this.parent.node.removeChild(i.node),this.parent.isAttached&&n.MessageLoop.sendMessage(i,b.Msg.AfterDetach),s.dispose(),this.parent.fit()}onBeforeShow(e){super.onBeforeShow(e),this.parent.update()}onBeforeAttach(e){super.onBeforeAttach(e),this.parent.fit()}onChildShown(e){this.parent.fit()}onChildHidden(e){this.parent.fit()}onResize(e){this.parent.isVisible&&this._update(e.width,e.height)}onUpdateRequest(e){this.parent.isVisible&&this._update(-1,-1)}onFitRequest(e){this.parent.isAttached&&this._fit()}_fit(){let e=0;for(let t=0,i=this._items.length;t0)switch(this._alignment){case"start":break;case"center":l=0,c=a/2;break;case"end":l=0,c=a;break;case"justify":l=a/n,c=0;break;default:throw"unreachable"}for(let e=0,t=this._items.length;e0,coerce:(e,t)=>Math.max(0,Math.floor(t)),changed:t}),e.sizeBasisProperty=new a.AttachedProperty({name:"sizeBasis",create:()=>0,coerce:(e,t)=>Math.max(0,Math.floor(t)),changed:t}),e.isHorizontal=function(e){return"left-to-right"===e||"right-to-left"===e},e.clampSpacing=function(e){return Math.max(0,Math.floor(e))}}(S||(S={}));class W extends R{constructor(e={}){super({layout:I.createLayout(e)}),this.addClass("lm-BoxPanel")}get direction(){return this.layout.direction}set direction(e){this.layout.direction=e}get alignment(){return this.layout.alignment}set alignment(e){this.layout.alignment=e}get spacing(){return this.layout.spacing}set spacing(e){this.layout.spacing=e}onChildAdded(e){e.child.addClass("lm-BoxPanel-child")}onChildRemoved(e){e.child.removeClass("lm-BoxPanel-child")}}!function(e){e.getStretch=function(e){return P.getStretch(e)},e.setStretch=function(e,t){P.setStretch(e,t)},e.getSizeBasis=function(e){return P.getSizeBasis(e)},e.setSizeBasis=function(e,t){P.setSizeBasis(e,t)}}(W||(W={})),function(e){e.createLayout=function(e){return e.layout||new P(e)}}(I||(I={}));class q extends b{constructor(e){super({node:z.createNode()}),this._activeIndex=-1,this._items=[],this._results=null,this.addClass("lm-CommandPalette"),this.setFlag(b.Flag.DisallowLayout),this.commands=e.commands,this.renderer=e.renderer||q.defaultRenderer,this.commands.commandChanged.connect(this._onGenericChange,this),this.commands.keyBindingChanged.connect(this._onGenericChange,this)}dispose(){this._items.length=0,this._results=null,super.dispose()}get searchNode(){return this.node.getElementsByClassName("lm-CommandPalette-search")[0]}get inputNode(){return this.node.getElementsByClassName("lm-CommandPalette-input")[0]}get contentNode(){return this.node.getElementsByClassName("lm-CommandPalette-content")[0]}get items(){return this._items}addItem(e){let t=z.createItem(this.commands,e);return this._items.push(t),this.refresh(),t}addItems(e){const t=e.map((e=>z.createItem(this.commands,e)));return t.forEach((e=>this._items.push(e))),this.refresh(),t}removeItem(e){this.removeItemAt(this._items.indexOf(e))}removeItemAt(e){t.ArrayExt.removeAt(this._items,e)&&this.refresh()}clearItems(){0!==this._items.length&&(this._items.length=0,this.refresh())}refresh(){if(this._results=null,""!==this.inputNode.value){this.node.getElementsByClassName("lm-close-icon")[0].style.display="inherit"}else{this.node.getElementsByClassName("lm-close-icon")[0].style.display="none"}this.update()}handleEvent(e){switch(e.type){case"click":this._evtClick(e);break;case"keydown":this._evtKeyDown(e);break;case"input":this.refresh();break;case"focus":case"blur":this._toggleFocused()}}onBeforeAttach(e){this.node.addEventListener("click",this),this.node.addEventListener("keydown",this),this.node.addEventListener("input",this),this.node.addEventListener("focus",this,!0),this.node.addEventListener("blur",this,!0)}onAfterDetach(e){this.node.removeEventListener("click",this),this.node.removeEventListener("keydown",this),this.node.removeEventListener("input",this),this.node.removeEventListener("focus",this,!0),this.node.removeEventListener("blur",this,!0)}onAfterShow(e){this.update(),super.onAfterShow(e)}onActivateRequest(e){if(this.isAttached){let e=this.inputNode;e.focus(),e.select()}}onUpdateRequest(e){if(!this.isVisible)return void d.VirtualDOM.render(null,this.contentNode);let i=this.inputNode.value,n=this.contentNode,a=this._results;if(a||(a=this._results=z.search(this._items,i),this._activeIndex=i?t.ArrayExt.findFirstIndex(a,z.canActivate):-1),!i&&0===a.length)return void d.VirtualDOM.render(null,n);if(i&&0===a.length){let e=this.renderer.renderEmptyMessage({query:i});return void d.VirtualDOM.render(e,n)}let r=this.renderer,o=this._activeIndex,h=new Array(a.length);for(let e=0,t=a.length;e=a.length)n.scrollTop=0;else{let e=n.children[o];s.ElementExt.scrollIntoViewIfNeeded(n,e)}}_evtClick(e){if(0!==e.button)return;if(e.target.classList.contains("lm-close-icon"))return this.inputNode.value="",void this.refresh();let i=t.ArrayExt.findFirstIndex(this.contentNode.children,(t=>t.contains(e.target)));-1!==i&&(e.preventDefault(),e.stopPropagation(),this._execute(i))}_evtKeyDown(e){if(!(e.altKey||e.ctrlKey||e.metaKey||e.shiftKey))switch(e.keyCode){case 13:e.preventDefault(),e.stopPropagation(),this._execute(this._activeIndex);break;case 38:e.preventDefault(),e.stopPropagation(),this._activatePreviousItem();break;case 40:e.preventDefault(),e.stopPropagation(),this._activateNextItem()}}_activateNextItem(){if(!this._results||0===this._results.length)return;let e=this._activeIndex,i=this._results.length,s=ee-t)),l=r.slice(0,d),c=r.slice(d);for(let e=0,t=c.length;et.command===e&&i.JSONExt.deepEqual(t.args,s)))||null}}}(z||(z={}));class F extends b{constructor(e){super({node:L.createNode()}),this._childIndex=-1,this._activeIndex=-1,this._openTimerID=0,this._closeTimerID=0,this._items=[],this._childMenu=null,this._parentMenu=null,this._aboutToClose=new r.Signal(this),this._menuRequested=new r.Signal(this),this.addClass("lm-Menu"),this.setFlag(b.Flag.DisallowLayout),this.commands=e.commands,this.renderer=e.renderer||F.defaultRenderer}dispose(){this.close(),this._items.length=0,super.dispose()}get aboutToClose(){return this._aboutToClose}get menuRequested(){return this._menuRequested}get parentMenu(){return this._parentMenu}get childMenu(){return this._childMenu}get rootMenu(){let e=this;for(;e._parentMenu;)e=e._parentMenu;return e}get leafMenu(){let e=this;for(;e._childMenu;)e=e._childMenu;return e}get contentNode(){return this.node.getElementsByClassName("lm-Menu-content")[0]}get activeItem(){return this._items[this._activeIndex]||null}set activeItem(e){this.activeIndex=e?this._items.indexOf(e):-1}get activeIndex(){return this._activeIndex}set activeIndex(e){(e<0||e>=this._items.length)&&(e=-1),-1===e||L.canActivate(this._items[e])||(e=-1),this._activeIndex!==e&&(this._activeIndex=e,this._activeIndex>=0&&this.contentNode.childNodes[this._activeIndex]&&this.contentNode.childNodes[this._activeIndex].focus(),this.update())}get items(){return this._items}activateNextItem(){let e=this._items.length,i=this._activeIndex,s=i{this.activeIndex=e}})}d.VirtualDOM.render(a,this.contentNode)}onCloseRequest(e){this._cancelOpenTimer(),this._cancelCloseTimer(),this.activeIndex=-1;let t=this._childMenu;t&&(this._childIndex=-1,this._childMenu=null,t._parentMenu=null,t.close());let i=this._parentMenu;i&&(this._parentMenu=null,i._childIndex=-1,i._childMenu=null,i.activate()),this.isAttached&&this._aboutToClose.emit(void 0),super.onCloseRequest(e)}_evtKeyDown(e){e.preventDefault(),e.stopPropagation();let t=e.keyCode;if(13===t)return void this.triggerActiveItem();if(27===t)return void this.close();if(37===t)return void(this._parentMenu?this.close():this._menuRequested.emit("previous"));if(38===t)return void this.activatePreviousItem();if(39===t){let e=this.activeItem;return void(e&&"submenu"===e.type?this.triggerActiveItem():this.rootMenu._menuRequested.emit("next"))}if(40===t)return void this.activateNextItem();let i=c.getKeyboardLayout().keyForKeydownEvent(e);if(!i)return;let s=this._activeIndex+1,n=L.findMnemonic(this._items,i,s);-1===n.index||n.multiple?-1!==n.index?this.activeIndex=n.index:-1!==n.auto&&(this.activeIndex=n.auto):(this.activeIndex=n.index,this.triggerActiveItem())}_evtMouseUp(e){0===e.button&&(e.preventDefault(),e.stopPropagation(),this.triggerActiveItem())}_evtMouseMove(e){let i=t.ArrayExt.findFirstIndex(this.contentNode.children,(t=>s.ElementExt.hitTest(t,e.clientX,e.clientY)));if(i===this._activeIndex)return;if(this.activeIndex=i,i=this.activeIndex,i===this._childIndex)return this._cancelOpenTimer(),void this._cancelCloseTimer();-1!==this._childIndex&&this._startCloseTimer(),this._cancelOpenTimer();let n=this.activeItem;n&&"submenu"===n.type&&n.submenu&&this._startOpenTimer()}_evtMouseEnter(e){for(let e=this._parentMenu;e;e=e._parentMenu)e._cancelOpenTimer(),e._cancelCloseTimer(),e.activeIndex=e._childIndex}_evtMouseLeave(e){if(this._cancelOpenTimer(),!this._childMenu)return void(this.activeIndex=-1);let{clientX:t,clientY:i}=e;s.ElementExt.hitTest(this._childMenu.node,t,i)?this._cancelCloseTimer():(this.activeIndex=-1,this._startCloseTimer())}_evtMouseDown(e){this._parentMenu||(L.hitTestMenus(this,e.clientX,e.clientY)?(e.preventDefault(),e.stopPropagation()):this.close())}_openChildMenu(e=!1){let t=this.activeItem;if(!t||"submenu"!==t.type||!t.submenu)return void this._closeChildMenu();let i=t.submenu;if(i===this._childMenu)return;F.saveWindowData(),this._closeChildMenu(),this._childMenu=i,this._childIndex=this._activeIndex,i._parentMenu=this,n.MessageLoop.sendMessage(this,b.Msg.UpdateRequest);let s=this.contentNode.children[this._activeIndex];L.openSubmenu(i,s),e&&(i.activeIndex=-1,i.activateNextItem()),i.activate()}_closeChildMenu(){this._childMenu&&this._childMenu.close()}_startOpenTimer(){0===this._openTimerID&&(this._openTimerID=window.setTimeout((()=>{this._openTimerID=0,this._openChildMenu()}),L.TIMER_DELAY))}_startCloseTimer(){0===this._closeTimerID&&(this._closeTimerID=window.setTimeout((()=>{this._closeTimerID=0,this._closeChildMenu()}),L.TIMER_DELAY))}_cancelOpenTimer(){0!==this._openTimerID&&(clearTimeout(this._openTimerID),this._openTimerID=0)}_cancelCloseTimer(){0!==this._closeTimerID&&(clearTimeout(this._closeTimerID),this._closeTimerID=0)}static saveWindowData(){L.saveWindowData()}}!function(e){class t{renderItem(e){let t=this.createItemClass(e),i=this.createItemDataset(e),s=this.createItemARIA(e);return d.h.li({className:t,dataset:i,tabindex:"0",onfocus:e.onfocus,...s},this.renderIcon(e),this.renderLabel(e),this.renderShortcut(e),this.renderSubmenu(e))}renderIcon(e){let t=this.createIconClass(e);return d.h.div({className:t},e.item.icon,e.item.iconLabel)}renderLabel(e){let t=this.formatLabel(e);return d.h.div({className:"lm-Menu-itemLabel"},t)}renderShortcut(e){let t=this.formatShortcut(e);return d.h.div({className:"lm-Menu-itemShortcut"},t)}renderSubmenu(e){return d.h.div({className:"lm-Menu-itemSubmenuIcon"})}createItemClass(e){let t="lm-Menu-item";e.item.isEnabled||(t+=" lm-mod-disabled"),e.item.isToggled&&(t+=" lm-mod-toggled"),e.item.isVisible||(t+=" lm-mod-hidden"),e.active&&(t+=" lm-mod-active"),e.collapsed&&(t+=" lm-mod-collapsed");let i=e.item.className;return i&&(t+=` ${i}`),t}createItemDataset(e){let t,{type:i,command:s,dataset:n}=e.item;return t="command"===i?{...n,type:i,command:s}:{...n,type:i},t}createIconClass(e){let t="lm-Menu-itemIcon",i=e.item.iconClass;return i?`${t} ${i}`:t}createItemARIA(e){let t={};switch(e.item.type){case"separator":t.role="presentation";break;case"submenu":t["aria-haspopup"]="true",e.item.isEnabled||(t["aria-disabled"]="true");break;default:e.item.isEnabled||(t["aria-disabled"]="true"),e.item.isToggled?(t.role="menuitemcheckbox",t["aria-checked"]="true"):t.role="menuitem"}return t}formatLabel(e){let{label:t,mnemonic:i}=e.item;if(i<0||i>=t.length)return t;let s=t.slice(0,i),n=t.slice(i+1),a=t[i];return[s,d.h.span({className:"lm-Menu-itemMnemonic"},a),n]}formatShortcut(e){let t=e.item.keyBinding;return t?h.CommandRegistry.formatKeystroke(t.keys):null}}e.Renderer=t,e.defaultRenderer=new t}(F||(F={})),function(e){function a(e){return function(e){var t,i;return{pageXOffset:(null===(t=e.ownerDocument.defaultView)||void 0===t?void 0:t.window.scrollX)||0,pageYOffset:(null===(i=e.ownerDocument.defaultView)||void 0===i?void 0:i.window.scrollY)||0,clientWidth:e.ownerDocument.documentElement.clientWidth,clientHeight:e.ownerDocument.documentElement.clientHeight}}(e)}function r(e){return"separator"!==e.type&&e.isEnabled&&e.isVisible}e.TIMER_DELAY=300,e.SUBMENU_OVERLAP=3,e.saveWindowData=function(){},e.createNode=function(){let e=document.createElement("div"),t=document.createElement("ul");return t.className="lm-Menu-content",e.appendChild(t),t.setAttribute("role","menu"),e.tabIndex=0,e},e.canActivate=r,e.createItem=function(e,t){return new o(e.commands,t)},e.hitTestMenus=function(e,t,i){for(let n=e;n;n=n.childMenu)if(s.ElementExt.hitTest(n.node,t,i))return!0;return!1},e.computeCollapsed=function(e){let i=new Array(e.length);t.ArrayExt.fill(i,!1);let s=0,n=e.length;for(;s=0;--a){let t=e[a];if(t.isVisible){if("separator"!==t.type)break;i[a]=!0}}let r=!1;for(;++sc+m&&(t=c+m-v),!r&&i+x>u+g&&(i>u+g?i=u+g-x:i-=x),f.transform=`translate(${Math.max(0,t)}px, ${Math.max(0,i)}px`,f.opacity="1"},e.openSubmenu=function(t,i){const r=a(i);let o=r.pageXOffset,h=r.pageYOffset,d=r.clientWidth,l=r.clientHeight;n.MessageLoop.sendMessage(t,b.Msg.UpdateRequest);let c=l,u=t.node,m=u.style;m.opacity="0",m.maxHeight=`${c}px`,b.attach(t,i.ownerDocument.body);let{width:g,height:p}=u.getBoundingClientRect(),_=s.ElementExt.boxSizing(t.node),f=i.getBoundingClientRect(),v=f.right-e.SUBMENU_OVERLAP;v+g>o+d&&(v=f.left+e.SUBMENU_OVERLAP-g);let x=f.top-_.borderTop-_.paddingTop;x+p>h+l&&(x=f.bottom+_.borderBottom+_.paddingBottom-p),m.top="0",m.left="0",m.transform=`translate(${Math.max(0,v)}px, ${Math.max(0,x)}px`,m.opacity="1"},e.findMnemonic=function(e,t,i){let s=-1,n=-1,a=!1,o=t.toUpperCase();for(let t=0,h=e.length;t=0&&ut.command===e&&i.JSONExt.deepEqual(t.args,s)))||null}return null}}}(L||(L={}));!function(e){function t(e,t){let i=e.rank,s=t.rank;return i!==s?i=this._titles.length)&&(e=-1),this._currentIndex===e)return;let t=this._currentIndex,i=this._titles[t]||null,s=e,n=this._titles[s]||null;this._currentIndex=s,this._previousTitle=i,this.update(),this._currentChanged.emit({previousIndex:t,previousTitle:i,currentIndex:s,currentTitle:n})}get name(){return this._name}set name(e){this._name=e,e?this.contentNode.setAttribute("aria-label",e):this.contentNode.removeAttribute("aria-label")}get orientation(){return this._orientation}set orientation(e){this._orientation!==e&&(this._releaseMouse(),this._orientation=e,this.dataset.orientation=e,this.contentNode.setAttribute("aria-orientation",e))}get addButtonEnabled(){return this._addButtonEnabled}set addButtonEnabled(e){this._addButtonEnabled!==e&&(this._addButtonEnabled=e,e?this.addButtonNode.classList.remove("lm-mod-hidden"):this.addButtonNode.classList.add("lm-mod-hidden"))}get titles(){return this._titles}get contentNode(){return this.node.getElementsByClassName("lm-TabBar-content")[0]}get addButtonNode(){return this.node.getElementsByClassName("lm-TabBar-addButton")[0]}addTab(e){return this.insertTab(this._titles.length,e)}insertTab(e,i){this._releaseMouse();let s=V.asTitle(i),n=this._titles.indexOf(s),a=Math.max(0,Math.min(e,this._titles.length));return-1===n?(t.ArrayExt.insert(this._titles,a,s),s.changed.connect(this._onTitleChanged,this),this.update(),this._adjustCurrentForInsert(a,s),s):(a===this._titles.length&&a--,n===a||(t.ArrayExt.move(this._titles,n,a),this.update(),this._adjustCurrentForMove(n,a)),s)}removeTab(e){this.removeTabAt(this._titles.indexOf(e))}removeTabAt(e){this._releaseMouse();let i=t.ArrayExt.removeAt(this._titles,e);i&&(i.changed.disconnect(this._onTitleChanged,this),i===this._previousTitle&&(this._previousTitle=null),this.update(),this._adjustCurrentForRemove(e,i))}clearTabs(){if(0===this._titles.length)return;this._releaseMouse();for(let e of this._titles)e.changed.disconnect(this._onTitleChanged,this);let e=this.currentIndex,t=this.currentTitle;this._currentIndex=-1,this._previousTitle=null,this._titles.length=0,this.update(),-1!==e&&this._currentChanged.emit({previousIndex:e,previousTitle:t,currentIndex:-1,currentTitle:null})}releaseMouse(){this._releaseMouse()}handleEvent(e){switch(e.type){case"pointerdown":this._evtPointerDown(e);break;case"pointermove":this._evtPointerMove(e);break;case"pointerup":this._evtPointerUp(e);break;case"dblclick":this._evtDblClick(e);break;case"keydown":e.eventPhase===Event.CAPTURING_PHASE?this._evtKeyDownCapturing(e):this._evtKeyDown(e);break;case"contextmenu":e.preventDefault(),e.stopPropagation()}}onBeforeAttach(e){this.node.addEventListener("pointerdown",this),this.node.addEventListener("dblclick",this),this.node.addEventListener("keydown",this)}onAfterDetach(e){this.node.removeEventListener("pointerdown",this),this.node.removeEventListener("dblclick",this),this.node.removeEventListener("keydown",this),this._releaseMouse()}onUpdateRequest(e){var t;let i=this._titles,s=this.renderer,n=this.currentTitle,a=new Array(i.length);const r=null!==(t=this._getCurrentTabindex())&&void 0!==t?t:this._currentIndex>-1?this._currentIndex:0;for(let e=0,t=i.length;es.ElementExt.hitTest(t,e.clientX,e.clientY)));if(-1===n)return;let a=this.titles[n],r=i[n].querySelector(".lm-TabBar-tabLabel");if(r&&r.contains(e.target)){let e=a.label||"",t=r.innerHTML;r.innerHTML="";let i=document.createElement("input");i.classList.add("lm-TabBar-tabInput"),i.value=e,r.appendChild(i);let s=()=>{i.removeEventListener("blur",s),r.innerHTML=t,this.node.addEventListener("keydown",this)};i.addEventListener("dblclick",(e=>e.stopPropagation())),i.addEventListener("blur",s),i.addEventListener("keydown",(e=>{"Enter"===e.key?(""!==i.value&&(a.label=a.caption=i.value),s()):"Escape"===e.key&&s()})),this.node.removeEventListener("keydown",this),i.select(),i.focus(),r.children.length>0&&r.children[0].focus()}}_evtKeyDownCapturing(e){e.eventPhase===Event.CAPTURING_PHASE&&(e.preventDefault(),e.stopPropagation(),"Escape"===e.key&&this._releaseMouse())}_evtKeyDown(e){var i,s,n;if("Tab"!==e.key&&e.eventPhase!==Event.CAPTURING_PHASE)if("Enter"===e.key||"Spacebar"===e.key||" "===e.key){const i=document.activeElement;if(this.addButtonEnabled&&this.addButtonNode.contains(i))e.preventDefault(),e.stopPropagation(),this._addRequested.emit();else{const s=t.ArrayExt.findFirstIndex(this.contentNode.children,(e=>e.contains(i)));s>=0&&(e.preventDefault(),e.stopPropagation(),this.currentIndex=s)}}else if(O.includes(e.key)){const t=[...this.contentNode.children];if(this.addButtonEnabled&&t.push(this.addButtonNode),t.length<=1)return;e.preventDefault(),e.stopPropagation();let a,r=t.indexOf(document.activeElement);-1===r&&(r=this._currentIndex),"ArrowRight"===e.key&&"horizontal"===this._orientation||"ArrowDown"===e.key&&"vertical"===this._orientation?a=null!==(i=t[r+1])&&void 0!==i?i:t[0]:"ArrowLeft"===e.key&&"horizontal"===this._orientation||"ArrowUp"===e.key&&"vertical"===this._orientation?a=null!==(s=t[r-1])&&void 0!==s?s:t[t.length-1]:"Home"===e.key?a=t[0]:"End"===e.key&&(a=t[t.length-1]),a&&(null===(n=t[r])||void 0===n||n.setAttribute("tabindex","-1"),null==a||a.setAttribute("tabindex","0"),a.focus())}}_evtPointerDown(e){if(0!==e.button&&1!==e.button)return;if(this._dragData)return;if(e.target.classList.contains("lm-TabBar-tabInput"))return;let i=this.addButtonEnabled&&this.addButtonNode.contains(e.target),n=this.contentNode.children,a=t.ArrayExt.findFirstIndex(n,(t=>s.ElementExt.hitTest(t,e.clientX,e.clientY)));if(-1===a&&!i)return;if(e.preventDefault(),e.stopPropagation(),this._dragData={tab:n[a],index:a,pressX:e.clientX,pressY:e.clientY,tabPos:-1,tabSize:-1,tabPressPos:-1,targetIndex:-1,tabLayout:null,contentRect:null,override:null,dragActive:!1,dragAborted:!1,detachRequested:!1},this.document.addEventListener("pointerup",this,!0),1===e.button||i)return;let r=n[a].querySelector(this.renderer.closeIconSelector);r&&r.contains(e.target)||(this.tabsMovable&&(this.document.addEventListener("pointermove",this,!0),this.document.addEventListener("keydown",this,!0),this.document.addEventListener("contextmenu",this,!0)),this.allowDeselect&&this.currentIndex===a?this.currentIndex=-1:this.currentIndex=a,-1!==this.currentIndex&&this._tabActivateRequested.emit({index:this.currentIndex,title:this.currentTitle}))}_evtPointerMove(e){let t=this._dragData;if(!t)return;e.preventDefault(),e.stopPropagation();let i=this.contentNode.children;if(t.dragActive||V.dragExceeded(t,e)){if(!t.dragActive){let e=t.tab.getBoundingClientRect();"horizontal"===this._orientation?(t.tabPos=t.tab.offsetLeft,t.tabSize=e.width,t.tabPressPos=t.pressX-e.left):(t.tabPos=t.tab.offsetTop,t.tabSize=e.height,t.tabPressPos=t.pressY-e.top),t.tabPressOffset={x:t.pressX-e.left,y:t.pressY-e.top},t.tabLayout=V.snapTabLayout(i,this._orientation),t.contentRect=this.contentNode.getBoundingClientRect(),t.override=o.Drag.overrideCursor("default"),t.tab.classList.add("lm-mod-dragging"),this.addClass("lm-mod-dragging"),t.dragActive=!0}if(!t.detachRequested&&V.detachExceeded(t,e)){t.detachRequested=!0;let s=t.index,n=e.clientX,a=e.clientY,r=i[s],o=this._titles[s];if(this._tabDetachRequested.emit({index:s,title:o,tab:r,clientX:n,clientY:a,offset:t.tabPressOffset}),t.dragAborted)return}V.layoutTabs(i,t,e,this._orientation)}}_evtPointerUp(e){if(0!==e.button&&1!==e.button)return;const i=this._dragData;if(!i)return;if(e.preventDefault(),e.stopPropagation(),this.document.removeEventListener("pointermove",this,!0),this.document.removeEventListener("pointerup",this,!0),this.document.removeEventListener("keydown",this,!0),this.document.removeEventListener("contextmenu",this,!0),!i.dragActive){if(this._dragData=null,this.addButtonEnabled&&this.addButtonNode.contains(e.target))return void this._addRequested.emit(void 0);let n=this.contentNode.children,a=t.ArrayExt.findFirstIndex(n,(t=>s.ElementExt.hitTest(t,e.clientX,e.clientY)));if(a!==i.index)return;let r=this._titles[a];if(!r.closable)return;if(1===e.button)return void this._tabCloseRequested.emit({index:a,title:r});let o=n[a].querySelector(this.renderer.closeIconSelector);return o&&o.contains(e.target)?void this._tabCloseRequested.emit({index:a,title:r}):void 0}if(0!==e.button)return;V.finalizeTabPosition(i,this._orientation),i.tab.classList.remove("lm-mod-dragging");let a=V.parseTransitionDuration(i.tab);setTimeout((()=>{if(i.dragAborted)return;this._dragData=null,V.resetTabPositions(this.contentNode.children,this._orientation),i.override.dispose(),this.removeClass("lm-mod-dragging");let e=i.index,s=i.targetIndex;-1!==s&&e!==s&&(t.ArrayExt.move(this._titles,e,s),this._adjustCurrentForMove(e,s),this._tabMoved.emit({fromIndex:e,toIndex:s,title:this._titles[s]}),n.MessageLoop.sendMessage(this,b.Msg.UpdateRequest))}),a)}_releaseMouse(){let e=this._dragData;e&&(this._dragData=null,this.document.removeEventListener("pointermove",this,!0),this.document.removeEventListener("pointerup",this,!0),this.document.removeEventListener("keydown",this,!0),this.document.removeEventListener("contextmenu",this,!0),e.dragAborted=!0,e.dragActive&&(V.resetTabPositions(this.contentNode.children,this._orientation),e.override.dispose(),e.tab.classList.remove("lm-mod-dragging"),this.removeClass("lm-mod-dragging")))}_adjustCurrentForInsert(e,t){let i=this.currentTitle,s=this._currentIndex,n=this.insertBehavior;if("select-tab"===n||"select-tab-if-needed"===n&&-1===s)return this._currentIndex=e,this._previousTitle=i,void this._currentChanged.emit({previousIndex:s,previousTitle:i,currentIndex:e,currentTitle:t});s>=e&&this._currentIndex++}_adjustCurrentForMove(e,t){this._currentIndex===e?this._currentIndex=t:this._currentIndex=t?this._currentIndex++:this._currentIndex>e&&this._currentIndex<=t&&this._currentIndex--}_adjustCurrentForRemove(e,t){let i=this._currentIndex,s=this.removeBehavior;if(i===e){if(0===this._titles.length)return this._currentIndex=-1,void this._currentChanged.emit({previousIndex:e,previousTitle:t,currentIndex:-1,currentTitle:null});if("select-tab-after"===s)return this._currentIndex=Math.min(e,this._titles.length-1),void this._currentChanged.emit({previousIndex:e,previousTitle:t,currentIndex:this._currentIndex,currentTitle:this.currentTitle});if("select-tab-before"===s)return this._currentIndex=Math.max(0,e-1),void this._currentChanged.emit({previousIndex:e,previousTitle:t,currentIndex:this._currentIndex,currentTitle:this.currentTitle});if("select-previous-tab"===s)return this._previousTitle?(this._currentIndex=this._titles.indexOf(this._previousTitle),this._previousTitle=null):this._currentIndex=Math.min(e,this._titles.length-1),void this._currentChanged.emit({previousIndex:e,previousTitle:t,currentIndex:this._currentIndex,currentTitle:this.currentTitle});this._currentIndex=-1,this._currentChanged.emit({previousIndex:e,previousTitle:t,currentIndex:-1,currentTitle:null})}else i>e&&this._currentIndex--}_onTitleChanged(e){this.update()}}var V,U,Y,X,K,G,j,J;!function(e){class t{constructor(){this.closeIconSelector=".lm-TabBar-tabCloseIcon",this._tabID=0,this._tabKeys=new WeakMap,this._uuid=++t._nInstance}renderTab(e){let t=e.title.caption,i=this.createTabKey(e),s=i,n=this.createTabStyle(e),a=this.createTabClass(e),r=this.createTabDataset(e),o=this.createTabARIA(e);return e.title.closable?d.h.li({id:s,key:i,className:a,title:t,style:n,dataset:r,...o},this.renderIcon(e),this.renderLabel(e),this.renderCloseIcon(e)):d.h.li({id:s,key:i,className:a,title:t,style:n,dataset:r,...o},this.renderIcon(e),this.renderLabel(e))}renderIcon(e){const{title:t}=e;let i=this.createIconClass(e);return d.h.div({className:i},t.icon,t.iconLabel)}renderLabel(e){return d.h.div({className:"lm-TabBar-tabLabel"},e.title.label)}renderCloseIcon(e){return d.h.div({className:"lm-TabBar-tabCloseIcon"})}createTabKey(e){let t=this._tabKeys.get(e.title);return void 0===t&&(t=`tab-key-${this._uuid}-${this._tabID++}`,this._tabKeys.set(e.title,t)),t}createTabStyle(e){return{zIndex:`${e.zIndex}`}}createTabClass(e){let t="lm-TabBar-tab";return e.title.className&&(t+=` ${e.title.className}`),e.title.closable&&(t+=" lm-mod-closable"),e.current&&(t+=" lm-mod-current"),t}createTabDataset(e){return e.title.dataset}createTabARIA(e){var t;return{role:"tab","aria-selected":e.current.toString(),tabindex:`${null!==(t=e.tabIndex)&&void 0!==t?t:"-1"}`}}createIconClass(e){let t="lm-TabBar-tabIcon",i=e.title.iconClass;return i?`${t} ${i}`:t}}t._nInstance=0,e.Renderer=t,e.defaultRenderer=new t,e.addButtonSelector=".lm-TabBar-addButton"}($||($={})),function(e){e.DRAG_THRESHOLD=5,e.DETACH_THRESHOLD=20,e.createNode=function(){let e=document.createElement("div"),t=document.createElement("ul");t.setAttribute("role","tablist"),t.className="lm-TabBar-content",e.appendChild(t);let i=document.createElement("div");return i.className="lm-TabBar-addButton lm-mod-hidden",i.setAttribute("tabindex","-1"),i.setAttribute("role","button"),e.appendChild(i),e},e.asTitle=function(e){return e instanceof f?e:new f(e)},e.parseTransitionDuration=function(e){let t=window.getComputedStyle(e);return 1e3*(parseFloat(t.transitionDuration)||0)},e.snapTabLayout=function(e,t){let i=new Array(e.length);for(let s=0,n=e.length;s=e.DRAG_THRESHOLD||n>=e.DRAG_THRESHOLD},e.detachExceeded=function(t,i){let s=t.contentRect;return i.clientX=s.right+e.DETACH_THRESHOLD||i.clientY=s.bottom+e.DETACH_THRESHOLD},e.layoutTabs=function(e,t,i,s){let n,a,r,o;"horizontal"===s?(n=t.pressX,a=i.clientX-t.contentRect.left,r=i.clientX,o=t.contentRect.width):(n=t.pressY,a=i.clientY-t.contentRect.top,r=i.clientY,o=t.contentRect.height);let h=t.index,d=a-t.tabPressPos,l=d+t.tabSize;for(let i=0,a=e.length;i>1);if(it.index&&l>u)a=-t.tabSize-c.margin+"px",h=Math.max(h,i);else if(i===t.index){let e=r-n,i=o-(t.tabPos+t.tabSize);a=`${Math.max(-t.tabPos,Math.min(e,i))}px`}else a="";"horizontal"===s?e[i].style.left=a:e[i].style.top=a}t.targetIndex=h},e.finalizeTabPosition=function(e,t){let i,s;if(i="horizontal"===t?e.contentRect.width:e.contentRect.height,e.targetIndex===e.index)s=0;else if(e.targetIndex>e.index){let t=e.tabLayout[e.targetIndex];s=t.pos+t.size-e.tabSize-e.tabPos}else{s=e.tabLayout[e.targetIndex].pos-e.tabPos}let n=i-(e.tabPos+e.tabSize),a=Math.max(-e.tabPos,Math.min(s,n));"horizontal"===t?e.tab.style.left=`${a}px`:e.tab.style.top=`${a}px`},e.resetTabPositions=function(e,t){for(const i of e)"horizontal"===t?i.style.left="":i.style.top=""}}(V||(V={}));class Q extends v{constructor(e){super(),this._spacing=4,this._dirty=!1,this._root=null,this._box=null,this._items=new Map,this.renderer=e.renderer,void 0!==e.spacing&&(this._spacing=D.clampDimension(e.spacing)),this._document=e.document||document,this._hiddenMode=void 0!==e.hiddenMode?e.hiddenMode:b.HiddenMode.Display}dispose(){let e=this[Symbol.iterator]();this._items.forEach((e=>{e.dispose()})),this._box=null,this._root=null,this._items.clear();for(const t of e)t.dispose();super.dispose()}get hiddenMode(){return this._hiddenMode}set hiddenMode(e){if(this._hiddenMode!==e){this._hiddenMode=e;for(const e of this.tabBars())if(e.titles.length>1)for(const t of e.titles)t.owner.hiddenMode=this._hiddenMode}}get spacing(){return this._spacing}set spacing(e){e=D.clampDimension(e),this._spacing!==e&&(this._spacing=e,this.parent&&this.parent.fit())}get isEmpty(){return null===this._root}[Symbol.iterator](){return this._root?this._root.iterAllWidgets():t.empty()}widgets(){return this._root?this._root.iterUserWidgets():t.empty()}selectedWidgets(){return this._root?this._root.iterSelectedWidgets():t.empty()}tabBars(){return this._root?this._root.iterTabBars():t.empty()}handles(){return this._root?this._root.iterHandles():t.empty()}moveHandle(t,i,s){let n=t.classList.contains("lm-mod-hidden");if(!this._root||n)return;let a,r=this._root.findSplitNode(t);r&&(a="horizontal"===r.node.orientation?i-t.offsetLeft:s-t.offsetTop,0!==a&&(r.node.holdSizes(),e.BoxEngine.adjust(r.node.sizers,r.index,a),this.parent&&this.parent.update()))}saveLayout(){return this._root?(this._root.holdAllSizes(),{main:this._root.createConfig()}):{main:null}}restoreLayout(e){let t,i=new Set;t=e.main?U.normalizeAreaConfig(e.main,i):null;let s=this.widgets(),n=this.tabBars(),a=this.handles();this._root=null;for(const e of s)i.has(e)||(e.parent=null);for(const e of n)e.dispose();for(const e of a)e.parentNode&&e.parentNode.removeChild(e);for(const e of i)e.parent=this.parent;this._root=t?U.realizeAreaConfig(t,{createTabBar:e=>this._createTabBar(),createHandle:()=>this._createHandle()},this._document):null,this.parent&&(i.forEach((e=>{this.attachWidget(e)})),this.parent.fit())}addWidget(e,t={}){let i=t.ref||null,s=t.mode||"tab-after",n=null;if(this._root&&i&&(n=this._root.findTabNode(i)),i&&!n)throw new Error("Reference widget is not in the layout.");switch(e.parent=this.parent,s){case"tab-after":this._insertTab(e,i,n,!0);break;case"tab-before":this._insertTab(e,i,n,!1);break;case"split-top":this._insertSplit(e,i,n,"vertical",!1);break;case"split-left":this._insertSplit(e,i,n,"horizontal",!1);break;case"split-right":this._insertSplit(e,i,n,"horizontal",!0);break;case"split-bottom":this._insertSplit(e,i,n,"vertical",!0);break;case"merge-top":this._insertSplit(e,i,n,"vertical",!1,!0);break;case"merge-left":this._insertSplit(e,i,n,"horizontal",!1,!0);break;case"merge-right":this._insertSplit(e,i,n,"horizontal",!0,!0);break;case"merge-bottom":this._insertSplit(e,i,n,"vertical",!0,!0)}this.parent&&(this.attachWidget(e),this.parent.fit())}removeWidget(e){this._removeWidget(e),this.parent&&(this.detachWidget(e),this.parent.fit())}hitTestTabAreas(e,t){if(!this._root||!this.parent||!this.parent.isVisible)return null;this._box||(this._box=s.ElementExt.boxSizing(this.parent.node));let i=this.parent.node.getBoundingClientRect(),n=e-i.left-this._box.borderLeft,a=t-i.top-this._box.borderTop,r=this._root.hitTestTabNodes(n,a);if(!r)return null;let{tabBar:o,top:h,left:d,width:l,height:c}=r,u=this._box.borderLeft+this._box.borderRight,m=this._box.borderTop+this._box.borderBottom;return{tabBar:o,x:n,y:a,top:h,left:d,right:i.width-u-(d+l),bottom:i.height-m-(h+c),width:l,height:c}}init(){super.init();for(const e of this)this.attachWidget(e);for(const e of this.handles())this.parent.node.appendChild(e);this.parent.fit()}attachWidget(e){this.parent.node!==e.node.parentNode&&(this._items.set(e,new x(e)),this.parent.isAttached&&n.MessageLoop.sendMessage(e,b.Msg.BeforeAttach),this.parent.node.appendChild(e.node),this.parent.isAttached&&n.MessageLoop.sendMessage(e,b.Msg.AfterAttach))}detachWidget(e){if(this.parent.node!==e.node.parentNode)return;this.parent.isAttached&&n.MessageLoop.sendMessage(e,b.Msg.BeforeDetach),this.parent.node.removeChild(e.node),this.parent.isAttached&&n.MessageLoop.sendMessage(e,b.Msg.AfterDetach);let t=this._items.get(e);t&&(this._items.delete(e),t.dispose())}onBeforeShow(e){super.onBeforeShow(e),this.parent.update()}onBeforeAttach(e){super.onBeforeAttach(e),this.parent.fit()}onChildShown(e){this.parent.fit()}onChildHidden(e){this.parent.fit()}onResize(e){this.parent.isVisible&&this._update(e.width,e.height)}onUpdateRequest(e){this.parent.isVisible&&this._update(-1,-1)}onFitRequest(e){this.parent.isAttached&&this._fit()}_removeWidget(e){if(!this._root)return;let i=this._root.findTabNode(e);if(!i)return;if(U.removeAria(e),i.tabBar.titles.length>1){if(i.tabBar.removeTab(e.title),this._hiddenMode===b.HiddenMode.Scale&&1==i.tabBar.titles.length){i.tabBar.titles[0].owner.hiddenMode=b.HiddenMode.Display}return}if(i.tabBar.dispose(),this._root===i)return void(this._root=null);this._root.holdAllSizes();let s=i.parent;i.parent=null;let n=t.ArrayExt.removeFirstOf(s.children,i),a=t.ArrayExt.removeAt(s.handles,n);if(t.ArrayExt.removeAt(s.sizers,n),a.parentNode&&a.parentNode.removeChild(a),s.children.length>1)return void s.syncHandles();let r=s.parent;s.parent=null;let o=s.children[0],h=s.handles[0];if(s.children.length=0,s.handles.length=0,s.sizers.length=0,h.parentNode&&h.parentNode.removeChild(h),this._root===s)return o.parent=null,void(this._root=o);let d=r,l=d.children.indexOf(s);if(o instanceof U.TabLayoutNode)return o.parent=d,void(d.children[l]=o);let c=t.ArrayExt.removeAt(d.handles,l);t.ArrayExt.removeAt(d.children,l),t.ArrayExt.removeAt(d.sizers,l),c.parentNode&&c.parentNode.removeChild(c);for(let e=0,i=o.children.length;e=i.length)&&(s=0);return{type:"tab-area",widgets:i,currentIndex:s}}(e,t):function(e,t){let i=e.orientation,n=[],a=[];for(let r=0,o=e.children.length;r{let h=n(r,t,s),d=i(e.sizes[o]),l=t.createHandle();a.children.push(h),a.handles.push(l),a.sizers.push(d),h.parent=a})),a.syncHandles(),a.normalizeSizes(),a}(e,s,o),h}t.GOLDEN_RATIO=.618,t.createSizer=i,t.normalizeAreaConfig=s,t.realizeAreaConfig=n;class a{constructor(e){this.parent=null,this._top=0,this._left=0,this._width=0,this._height=0;let t=new u,i=new u;t.stretch=0,i.stretch=1,this.tabBar=e,this.sizers=[t,i]}get top(){return this._top}get left(){return this._left}get width(){return this._width}get height(){return this._height}*iterAllWidgets(){yield this.tabBar,yield*this.iterUserWidgets()}*iterUserWidgets(){for(const e of this.tabBar.titles)yield e.owner}*iterSelectedWidgets(){let e=this.tabBar.currentTitle;e&&(yield e.owner)}*iterTabBars(){yield this.tabBar}*iterHandles(){}findTabNode(e){return-1!==this.tabBar.titles.indexOf(e.title)?this:null}findSplitNode(e){return null}findFirstTabNode(){return this}hitTestTabNodes(e,t){return e=this._left+this._width||t=this._top+this._height?null:this}createConfig(){return{type:"tab-area",widgets:this.tabBar.titles.map((e=>e.owner)),currentIndex:this.tabBar.currentIndex}}holdAllSizes(){}fit(e,t){let i=0,s=0,n=t.get(this.tabBar),a=this.tabBar.currentTitle,r=a?t.get(a.owner):void 0,[o,h]=this.sizers;return n&&n.fit(),r&&r.fit(),n&&!n.isHidden?(i=Math.max(i,n.minWidth),s+=n.minHeight,o.minSize=n.minHeight,o.maxSize=n.maxHeight):(o.minSize=0,o.maxSize=0),r&&!r.isHidden?(i=Math.max(i,r.minWidth),s+=r.minHeight,h.minSize=r.minHeight,h.maxSize=1/0):(h.minSize=0,h.maxSize=1/0),{minWidth:i,minHeight:s,maxWidth:Infinity,maxHeight:Infinity}}update(t,i,s,n,a,r){this._top=i,this._left=t,this._width=s,this._height=n;let o=r.get(this.tabBar),h=this.tabBar.currentTitle,d=h?r.get(h.owner):void 0;if(e.BoxEngine.calc(this.sizers,n),o&&!o.isHidden){let e=this.sizers[0].size;o.update(t,i,s,e),i+=e}if(d&&!d.isHidden){let e=this.sizers[1].size;d.update(t,i,s,e)}}}t.TabLayoutNode=a;class r{constructor(e){this.parent=null,this.normalized=!1,this.children=[],this.sizers=[],this.handles=[],this.orientation=e}*iterAllWidgets(){for(const e of this.children)yield*e.iterAllWidgets()}*iterUserWidgets(){for(const e of this.children)yield*e.iterUserWidgets()}*iterSelectedWidgets(){for(const e of this.children)yield*e.iterSelectedWidgets()}*iterTabBars(){for(const e of this.children)yield*e.iterTabBars()}*iterHandles(){yield*this.handles;for(const e of this.children)yield*e.iterHandles()}findTabNode(e){for(let t=0,i=this.children.length;te.createConfig())),sizes:t}}syncHandles(){this.handles.forEach(((e,t)=>{e.setAttribute("data-orientation",this.orientation),t===this.handles.length-1?e.classList.add("lm-mod-hidden"):e.classList.remove("lm-mod-hidden")}))}holdSizes(){for(const e of this.sizers)e.sizeHint=e.size}holdAllSizes(){for(const e of this.children)e.holdAllSizes();this.holdSizes()}normalizeSizes(){let e=this.sizers.length;if(0===e)return;this.holdSizes();let t=this.sizers.reduce(((e,t)=>e+t.sizeHint),0);if(0===t)for(const t of this.sizers)t.size=t.sizeHint=1/e;else for(const e of this.sizers)e.size=e.sizeHint/=t;this.normalized=!0}createNormalizedSizes(){let e=this.sizers.length;if(0===e)return[];let t=this.sizers.map((e=>e.size)),i=t.reduce(((e,t)=>e+t),0);if(0===i)for(let i=t.length-1;i>-1;i--)t[i]=1/e;else for(let e=t.length-1;e>-1;e--)t[e]/=i;return t}fit(e,t){let i="horizontal"===this.orientation,s=Math.max(0,this.children.length-1)*e,n=i?s:0,a=i?0:s;for(let s=0,r=this.children.length;sthis._createTabBar(),createHandle:()=>this._createHandle()};this.layout=new Q({document:this._document,renderer:t,spacing:e.spacing,hiddenMode:e.hiddenMode}),this.overlay=e.overlay||new Z.Overlay,this.node.appendChild(this.overlay.node)}dispose(){this._releaseMouse(),this.overlay.hide(0),this._drag&&this._drag.dispose(),super.dispose()}get hiddenMode(){return this.layout.hiddenMode}set hiddenMode(e){this.layout.hiddenMode=e}get layoutModified(){return this._layoutModified}get addRequested(){return this._addRequested}get renderer(){return this.layout.renderer}get spacing(){return this.layout.spacing}set spacing(e){this.layout.spacing=e}get mode(){return this._mode}set mode(e){if(this._mode===e)return;this._mode=e,this.dataset.mode=e;let t=this.layout;switch(e){case"multiple-document":for(const e of t.tabBars())e.show();break;case"single-document":t.restoreLayout(Y.createSingleDocumentConfig(this));break;default:throw"unreachable"}n.MessageLoop.postMessage(this,Y.LayoutModified)}get tabsMovable(){return this._tabsMovable}set tabsMovable(e){this._tabsMovable=e;for(const t of this.tabBars())t.tabsMovable=e}get tabsConstrained(){return this._tabsConstrained}set tabsConstrained(e){this._tabsConstrained=e}get addButtonEnabled(){return this._addButtonEnabled}set addButtonEnabled(e){this._addButtonEnabled=e;for(const t of this.tabBars())t.addButtonEnabled=e}get isEmpty(){return this.layout.isEmpty}*widgets(){yield*this.layout.widgets()}*selectedWidgets(){yield*this.layout.selectedWidgets()}*tabBars(){yield*this.layout.tabBars()}*handles(){yield*this.layout.handles()}selectWidget(e){let i=t.find(this.tabBars(),(t=>-1!==t.titles.indexOf(e.title)));if(!i)throw new Error("Widget is not contained in the dock panel.");i.currentTitle=e.title}activateWidget(e){this.selectWidget(e),e.activate()}saveLayout(){return this.layout.saveLayout()}restoreLayout(e){this._mode="multiple-document",this.layout.restoreLayout(e),(s.Platform.IS_EDGE||s.Platform.IS_IE)&&n.MessageLoop.flush(),n.MessageLoop.postMessage(this,Y.LayoutModified)}addWidget(e,t={}){"single-document"===this._mode?this.layout.addWidget(e):this.layout.addWidget(e,t),n.MessageLoop.postMessage(this,Y.LayoutModified)}processMessage(e){"layout-modified"===e.type?this._layoutModified.emit(void 0):super.processMessage(e)}handleEvent(e){switch(e.type){case"lm-dragenter":this._evtDragEnter(e);break;case"lm-dragleave":this._evtDragLeave(e);break;case"lm-dragover":this._evtDragOver(e);break;case"lm-drop":this._evtDrop(e);break;case"pointerdown":this._evtPointerDown(e);break;case"pointermove":this._evtPointerMove(e);break;case"pointerup":this._evtPointerUp(e);break;case"keydown":this._evtKeyDown(e);break;case"contextmenu":e.preventDefault(),e.stopPropagation()}}onBeforeAttach(e){this.node.addEventListener("lm-dragenter",this),this.node.addEventListener("lm-dragleave",this),this.node.addEventListener("lm-dragover",this),this.node.addEventListener("lm-drop",this),this.node.addEventListener("pointerdown",this)}onAfterDetach(e){this.node.removeEventListener("lm-dragenter",this),this.node.removeEventListener("lm-dragleave",this),this.node.removeEventListener("lm-dragover",this),this.node.removeEventListener("lm-drop",this),this.node.removeEventListener("pointerdown",this),this._releaseMouse()}onChildAdded(e){Y.isGeneratedTabBarProperty.get(e.child)||e.child.addClass("lm-DockPanel-widget")}onChildRemoved(e){Y.isGeneratedTabBarProperty.get(e.child)||(e.child.removeClass("lm-DockPanel-widget"),n.MessageLoop.postMessage(this,Y.LayoutModified))}_evtDragEnter(e){e.mimeData.hasData("application/vnd.lumino.widget-factory")&&(e.preventDefault(),e.stopPropagation())}_evtDragLeave(e){e.preventDefault(),this._tabsConstrained&&e.source!==this||(e.stopPropagation(),this.overlay.hide(1))}_evtDragOver(e){e.preventDefault(),this._tabsConstrained&&e.source!==this||"invalid"===this._showOverlay(e.clientX,e.clientY)?e.dropAction="none":(e.stopPropagation(),e.dropAction=e.proposedAction)}_evtDrop(e){if(e.preventDefault(),this.overlay.hide(0),"none"===e.proposedAction)return void(e.dropAction="none");let{clientX:t,clientY:i}=e,{zone:s,target:n}=Y.findDropTarget(this,t,i,this._edges);if(this._tabsConstrained&&e.source!==this||"invalid"===s)return void(e.dropAction="none");let a=e.mimeData.getData("application/vnd.lumino.widget-factory");if("function"!=typeof a)return void(e.dropAction="none");let r=a();if(!(r instanceof b))return void(e.dropAction="none");if(r.contains(this))return void(e.dropAction="none");let o=n?Y.getDropRef(n.tabBar):null;switch(s){case"root-all":this.addWidget(r);break;case"root-top":this.addWidget(r,{mode:"split-top"});break;case"root-left":this.addWidget(r,{mode:"split-left"});break;case"root-right":this.addWidget(r,{mode:"split-right"});break;case"root-bottom":this.addWidget(r,{mode:"split-bottom"});break;case"widget-all":case"widget-tab":this.addWidget(r,{mode:"tab-after",ref:o});break;case"widget-top":this.addWidget(r,{mode:"split-top",ref:o});break;case"widget-left":this.addWidget(r,{mode:"split-left",ref:o});break;case"widget-right":this.addWidget(r,{mode:"split-right",ref:o});break;case"widget-bottom":this.addWidget(r,{mode:"split-bottom",ref:o});break;default:throw"unreachable"}e.dropAction=e.proposedAction,e.stopPropagation(),this.activateWidget(r)}_evtKeyDown(e){e.preventDefault(),e.stopPropagation(),27===e.keyCode&&(this._releaseMouse(),n.MessageLoop.postMessage(this,Y.LayoutModified))}_evtPointerDown(e){if(0!==e.button)return;let i=this.layout,s=e.target,n=t.find(i.handles(),(e=>e.contains(s)));if(!n)return;e.preventDefault(),e.stopPropagation(),this._document.addEventListener("keydown",this,!0),this._document.addEventListener("pointerup",this,!0),this._document.addEventListener("pointermove",this,!0),this._document.addEventListener("contextmenu",this,!0);let a=n.getBoundingClientRect(),r=e.clientX-a.left,h=e.clientY-a.top,d=window.getComputedStyle(n),l=o.Drag.overrideCursor(d.cursor,this._document);this._pressData={handle:n,deltaX:r,deltaY:h,override:l}}_evtPointerMove(e){if(!this._pressData)return;e.preventDefault(),e.stopPropagation();let t=this.node.getBoundingClientRect(),i=e.clientX-t.left-this._pressData.deltaX,s=e.clientY-t.top-this._pressData.deltaY;this.layout.moveHandle(this._pressData.handle,i,s)}_evtPointerUp(e){0===e.button&&(e.preventDefault(),e.stopPropagation(),this._releaseMouse(),n.MessageLoop.postMessage(this,Y.LayoutModified))}_releaseMouse(){this._pressData&&(this._pressData.override.dispose(),this._pressData=null,this._document.removeEventListener("keydown",this,!0),this._document.removeEventListener("pointerup",this,!0),this._document.removeEventListener("pointermove",this,!0),this._document.removeEventListener("contextmenu",this,!0))}_showOverlay(e,t){let i,n,a,r,{zone:o,target:h}=Y.findDropTarget(this,e,t,this._edges);if("invalid"===o)return this.overlay.hide(100),o;let d=s.ElementExt.boxSizing(this.node),l=this.node.getBoundingClientRect();switch(o){case"root-all":i=d.paddingTop,n=d.paddingLeft,a=d.paddingRight,r=d.paddingBottom;break;case"root-top":i=d.paddingTop,n=d.paddingLeft,a=d.paddingRight,r=l.height*Y.GOLDEN_RATIO;break;case"root-left":i=d.paddingTop,n=d.paddingLeft,a=l.width*Y.GOLDEN_RATIO,r=d.paddingBottom;break;case"root-right":i=d.paddingTop,n=l.width*Y.GOLDEN_RATIO,a=d.paddingRight,r=d.paddingBottom;break;case"root-bottom":i=l.height*Y.GOLDEN_RATIO,n=d.paddingLeft,a=d.paddingRight,r=d.paddingBottom;break;case"widget-all":i=h.top,n=h.left,a=h.right,r=h.bottom;break;case"widget-top":i=h.top,n=h.left,a=h.right,r=h.bottom+h.height/2;break;case"widget-left":i=h.top,n=h.left,a=h.right+h.width/2,r=h.bottom;break;case"widget-right":i=h.top,n=h.left+h.width/2,a=h.right,r=h.bottom;break;case"widget-bottom":i=h.top+h.height/2,n=h.left,a=h.right,r=h.bottom;break;case"widget-tab":{const e=h.tabBar.node.getBoundingClientRect().height;i=h.top,n=h.left,a=h.right,r=h.bottom+h.height-e;break}default:throw"unreachable"}return this.overlay.show({top:i,left:n,right:a,bottom:r}),o}_createTabBar(){let e=this._renderer.createTabBar(this._document);return Y.isGeneratedTabBarProperty.set(e,!0),"single-document"===this._mode&&e.hide(),e.tabsMovable=this._tabsMovable,e.allowDeselect=!1,e.addButtonEnabled=this._addButtonEnabled,e.removeBehavior="select-previous-tab",e.insertBehavior="select-tab-if-needed",e.tabMoved.connect(this._onTabMoved,this),e.currentChanged.connect(this._onCurrentChanged,this),e.tabCloseRequested.connect(this._onTabCloseRequested,this),e.tabDetachRequested.connect(this._onTabDetachRequested,this),e.tabActivateRequested.connect(this._onTabActivateRequested,this),e.addRequested.connect(this._onTabAddRequested,this),e}_createHandle(){return this._renderer.createHandle()}_onTabMoved(){n.MessageLoop.postMessage(this,Y.LayoutModified)}_onCurrentChanged(e,t){let{previousTitle:i,currentTitle:a}=t;i&&i.owner.hide(),a&&a.owner.show(),(s.Platform.IS_EDGE||s.Platform.IS_IE)&&n.MessageLoop.flush(),n.MessageLoop.postMessage(this,Y.LayoutModified)}_onTabAddRequested(e){this._addRequested.emit(e)}_onTabActivateRequested(e,t){t.title.owner.activate()}_onTabCloseRequested(e,t){t.title.owner.close()}_onTabDetachRequested(e,t){if(this._drag)return;e.releaseMouse();let{title:s,tab:n,clientX:a,clientY:r,offset:h}=t,d=new i.MimeData;d.setData("application/vnd.lumino.widget-factory",(()=>s.owner));let l=n.cloneNode(!0);h&&(l.style.top=`-${h.y}px`,l.style.left=`-${h.x}px`),this._drag=new o.Drag({document:this._document,mimeData:d,dragImage:l,proposedAction:"move",supportedActions:"move",source:this}),n.classList.add("lm-mod-hidden");this._drag.start(a,r).then((()=>{this._drag=null,n.classList.remove("lm-mod-hidden")}))}}!function(e){e.Overlay=class{constructor(){this._timer=-1,this._hidden=!0,this.node=document.createElement("div"),this.node.classList.add("lm-DockPanel-overlay"),this.node.classList.add("lm-mod-hidden"),this.node.style.position="absolute",this.node.style.contain="strict"}show(e){let t=this.node.style;t.top=`${e.top}px`,t.left=`${e.left}px`,t.right=`${e.right}px`,t.bottom=`${e.bottom}px`,clearTimeout(this._timer),this._timer=-1,this._hidden&&(this._hidden=!1,this.node.classList.remove("lm-mod-hidden"))}hide(e){if(!this._hidden)return e<=0?(clearTimeout(this._timer),this._timer=-1,this._hidden=!0,void this.node.classList.add("lm-mod-hidden")):void(-1===this._timer&&(this._timer=window.setTimeout((()=>{this._timer=-1,this._hidden=!0,this.node.classList.add("lm-mod-hidden")}),e)))}};class t{createTabBar(e){let t=new $({document:e});return t.addClass("lm-DockPanel-tabBar"),t}createHandle(){let e=document.createElement("div");return e.className="lm-DockPanel-handle",e}}e.Renderer=t,e.defaultRenderer=new t}(Z||(Z={})),function(e){e.GOLDEN_RATIO=.618,e.DEFAULT_EDGES={top:12,right:40,bottom:40,left:40},e.LayoutModified=new n.ConflatableMessage("layout-modified"),e.isGeneratedTabBarProperty=new a.AttachedProperty({name:"isGeneratedTabBar",create:()=>!1}),e.createSingleDocumentConfig=function(e){if(e.isEmpty)return{main:null};let t=Array.from(e.widgets()),i=e.selectedWidgets().next().value,s=i?t.indexOf(i):-1;return{main:{type:"tab-area",widgets:t,currentIndex:s}}},e.findDropTarget=function(e,t,i,n){if(!s.ElementExt.hitTest(e.node,t,i))return{zone:"invalid",target:null};let a=e.layout;if(a.isEmpty)return{zone:"root-all",target:null};if("multiple-document"===e.mode){let s=e.node.getBoundingClientRect(),a=t-s.left+1,r=i-s.top+1,o=s.right-t,h=s.bottom-i;switch(Math.min(r,o,h,a)){case r:if(ru&&d>u&&h>m&&l>m)return{zone:"widget-all",target:r};switch(o/=u,h/=m,d/=u,l/=m,Math.min(o,h,d,l)){case o:c="widget-left";break;case h:c="widget-top";break;case d:c="widget-right";break;case l:c="widget-bottom";break;default:throw"unreachable"}return{zone:c,target:r}},e.getDropRef=function(e){return 0===e.titles.length?null:e.currentTitle?e.currentTitle.owner:e.titles[e.titles.length-1].owner}}(Y||(Y={}));class ee extends v{constructor(e={}){super(e),this._dirty=!1,this._rowSpacing=4,this._columnSpacing=4,this._items=[],this._rowStarts=[],this._columnStarts=[],this._rowSizers=[new u],this._columnSizers=[new u],this._box=null,void 0!==e.rowCount&&X.reallocSizers(this._rowSizers,e.rowCount),void 0!==e.columnCount&&X.reallocSizers(this._columnSizers,e.columnCount),void 0!==e.rowSpacing&&(this._rowSpacing=X.clampValue(e.rowSpacing)),void 0!==e.columnSpacing&&(this._columnSpacing=X.clampValue(e.columnSpacing))}dispose(){for(const e of this._items){let t=e.widget;e.dispose(),t.dispose()}this._box=null,this._items.length=0,this._rowStarts.length=0,this._rowSizers.length=0,this._columnStarts.length=0,this._columnSizers.length=0,super.dispose()}get rowCount(){return this._rowSizers.length}set rowCount(e){e!==this.rowCount&&(X.reallocSizers(this._rowSizers,e),this.parent&&this.parent.fit())}get columnCount(){return this._columnSizers.length}set columnCount(e){e!==this.columnCount&&(X.reallocSizers(this._columnSizers,e),this.parent&&this.parent.fit())}get rowSpacing(){return this._rowSpacing}set rowSpacing(e){e=X.clampValue(e),this._rowSpacing!==e&&(this._rowSpacing=e,this.parent&&this.parent.fit())}get columnSpacing(){return this._columnSpacing}set columnSpacing(e){e=X.clampValue(e),this._columnSpacing!==e&&(this._columnSpacing=e,this.parent&&this.parent.fit())}rowStretch(e){let t=this._rowSizers[e];return t?t.stretch:-1}setRowStretch(e,t){let i=this._rowSizers[e];i&&(t=X.clampValue(t),i.stretch!==t&&(i.stretch=t,this.parent&&this.parent.update()))}columnStretch(e){let t=this._columnSizers[e];return t?t.stretch:-1}setColumnStretch(e,t){let i=this._columnSizers[e];i&&(t=X.clampValue(t),i.stretch!==t&&(i.stretch=t,this.parent&&this.parent.update()))}*[Symbol.iterator](){for(const e of this._items)yield e.widget}addWidget(e){-1===t.ArrayExt.findFirstIndex(this._items,(t=>t.widget===e))&&(this._items.push(new x(e)),this.parent&&this.attachWidget(e))}removeWidget(e){let i=t.ArrayExt.findFirstIndex(this._items,(t=>t.widget===e));if(-1===i)return;let s=t.ArrayExt.removeAt(this._items,i);this.parent&&this.detachWidget(e),s.dispose()}init(){super.init();for(const e of this)this.attachWidget(e)}attachWidget(e){this.parent.isAttached&&n.MessageLoop.sendMessage(e,b.Msg.BeforeAttach),this.parent.node.appendChild(e.node),this.parent.isAttached&&n.MessageLoop.sendMessage(e,b.Msg.AfterAttach),this.parent.fit()}detachWidget(e){this.parent.isAttached&&n.MessageLoop.sendMessage(e,b.Msg.BeforeDetach),this.parent.node.removeChild(e.node),this.parent.isAttached&&n.MessageLoop.sendMessage(e,b.Msg.AfterDetach),this.parent.fit()}onBeforeShow(e){super.onBeforeShow(e),this.parent.update()}onBeforeAttach(e){super.onBeforeAttach(e),this.parent.fit()}onChildShown(e){this.parent.fit()}onChildHidden(e){this.parent.fit()}onResize(e){this.parent.isVisible&&this._update(e.width,e.height)}onUpdateRequest(e){this.parent.isVisible&&this._update(-1,-1)}onFitRequest(e){this.parent.isAttached&&this._fit()}_fit(){for(let e=0,t=this.rowCount;e!e.isHidden));for(let t=0,i=e.length;t({row:0,column:0,rowSpan:1,columnSpan:1}),changed:function(e){e.parent&&e.parent.layout instanceof ee&&e.parent.fit()}}),e.normalizeConfig=function(e){return{row:Math.max(0,Math.floor(e.row||0)),column:Math.max(0,Math.floor(e.column||0)),rowSpan:Math.max(1,Math.floor(e.rowSpan||0)),columnSpan:Math.max(1,Math.floor(e.columnSpan||0))}},e.clampValue=function(e){return Math.max(0,Math.floor(e))},e.rowSpanCmp=function(t,i){let s=e.cellConfigProperty.get(t.widget),n=e.cellConfigProperty.get(i.widget);return s.rowSpan-n.rowSpan},e.columnSpanCmp=function(t,i){let s=e.cellConfigProperty.get(t.widget),n=e.cellConfigProperty.get(i.widget);return s.columnSpan-n.columnSpan},e.reallocSizers=function(e,t){for(t=Math.max(1,Math.floor(t));e.lengtht&&(e.length=t)},e.distributeMin=function(e,t,i,s){if(i=s)return;let a=(s-n)/(i-t+1);for(let s=t;s<=i;++s)e[s].minSize+=a}}(X||(X={}));class te extends b{constructor(e={}){super({node:K.createNode()}),this._activeIndex=-1,this._tabFocusIndex=0,this._menus=[],this._childMenu=null,this._overflowMenu=null,this._menuItemSizes=[],this._overflowIndex=-1,this.addClass("lm-MenuBar"),this.setFlag(b.Flag.DisallowLayout),this.renderer=e.renderer||te.defaultRenderer,this._forceItemsPosition=e.forceItemsPosition||{forceX:!0,forceY:!0},this._overflowMenuOptions=e.overflowMenuOptions||{isVisible:!0}}dispose(){this._closeChildMenu(),this._menus.length=0,super.dispose()}get childMenu(){return this._childMenu}get overflowIndex(){return this._overflowIndex}get overflowMenu(){return this._overflowMenu}get contentNode(){return this.node.getElementsByClassName("lm-MenuBar-content")[0]}get activeMenu(){return this._menus[this._activeIndex]||null}set activeMenu(e){this.activeIndex=e?this._menus.indexOf(e):-1}get activeIndex(){return this._activeIndex}set activeIndex(e){(e<0||e>=this._menus.length)&&(e=-1),e>-1&&0===this._menus[e].items.length&&(e=-1),this._activeIndex!==e&&(this._activeIndex=e,this.update())}get menus(){return this._menus}openActiveMenu(){-1!==this._activeIndex&&(this._openChildMenu(),this._childMenu&&(this._childMenu.activeIndex=-1,this._childMenu.activateNextItem()))}addMenu(e,t=!0){this.insertMenu(this._menus.length,e,t)}insertMenu(e,i,s=!0){this._closeChildMenu();let n=this._menus.indexOf(i),a=Math.max(0,Math.min(e,this._menus.length));if(-1===n)return t.ArrayExt.insert(this._menus,a,i),i.addClass("lm-MenuBar-menu"),i.aboutToClose.connect(this._onMenuAboutToClose,this),i.menuRequested.connect(this._onMenuMenuRequested,this),i.title.changed.connect(this._onTitleChanged,this),void(s&&this.update());a===this._menus.length&&a--,n!==a&&(t.ArrayExt.move(this._menus,n,a),s&&this.update())}removeMenu(e,t=!0){this.removeMenuAt(this._menus.indexOf(e),t)}removeMenuAt(e,i=!0){this._closeChildMenu();let s=t.ArrayExt.removeAt(this._menus,e);s&&(s.aboutToClose.disconnect(this._onMenuAboutToClose,this),s.menuRequested.disconnect(this._onMenuMenuRequested,this),s.title.changed.disconnect(this._onTitleChanged,this),s.removeClass("lm-MenuBar-menu"),i&&this.update())}clearMenus(){if(0!==this._menus.length){this._closeChildMenu();for(let e of this._menus)e.aboutToClose.disconnect(this._onMenuAboutToClose,this),e.menuRequested.disconnect(this._onMenuMenuRequested,this),e.title.changed.disconnect(this._onTitleChanged,this),e.removeClass("lm-MenuBar-menu");this._menus.length=0,this.update()}}handleEvent(e){switch(e.type){case"keydown":this._evtKeyDown(e);break;case"mousedown":this._evtMouseDown(e);break;case"mousemove":case"mouseleave":this._evtMouseMove(e);break;case"focusout":this._evtFocusOut(e);break;case"contextmenu":e.preventDefault(),e.stopPropagation()}}onBeforeAttach(e){this.node.addEventListener("keydown",this),this.node.addEventListener("mousedown",this),this.node.addEventListener("mousemove",this),this.node.addEventListener("mouseleave",this),this.node.addEventListener("focusout",this),this.node.addEventListener("contextmenu",this)}onAfterDetach(e){this.node.removeEventListener("keydown",this),this.node.removeEventListener("mousedown",this),this.node.removeEventListener("mousemove",this),this.node.removeEventListener("mouseleave",this),this.node.removeEventListener("focusout",this),this.node.removeEventListener("contextmenu",this),this._closeChildMenu()}onActivateRequest(e){this.isAttached&&this._focusItemAt(0)}onResize(e){this.update(),super.onResize(e)}onUpdateRequest(e){var t;let i=this._menus,s=this.renderer,n=this._activeIndex,a=this._tabFocusIndex>=0&&this._tabFocusIndex-1?this._overflowIndex:i.length,o=0,l=!1;r=null!==this._overflowMenu?r-1:r;let c=new Array(r);for(let e=0;e{this._tabFocusIndex=e,this.activeIndex=e}}),o+=this._menuItemSizes[e],i[e].title.label===this._overflowMenuOptions.title&&(l=!0,r--);if(this._overflowMenuOptions.isVisible)if(this._overflowIndex>-1&&!l){if(null===this._overflowMenu){const e=null!==(t=this._overflowMenuOptions.title)&&void 0!==t?t:"...";this._overflowMenu=new F({commands:new h.CommandRegistry}),this._overflowMenu.title.label=e,this._overflowMenu.title.mnemonic=0,this.addMenu(this._overflowMenu,!1)}for(let e=i.length-2;e>=r;e--){const t=this.menus[e];t.title.mnemonic=0,this._overflowMenu.insertItem(0,{type:"submenu",submenu:t}),this.removeMenu(t,!1)}c[r]=s.renderItem({title:this._overflowMenu.title,active:r===n&&0!==i[r].items.length,tabbable:r===a,disabled:0===i[r].items.length,onfocus:()=>{this._tabFocusIndex=r,this.activeIndex=r}}),r++}else if(null!==this._overflowMenu){let e=this._overflowMenu.items,t=this.node.offsetWidth,n=this._overflowMenu.items.length;for(let h=0;hthis._menuItemSizes[n]){let t=e[0].submenu;this._overflowMenu.removeItemAt(0),this.insertMenu(r,t,!1),c[r]=s.renderItem({title:t.title,active:!1,tabbable:r===a,disabled:0===i[r].items.length,onfocus:()=>{this._tabFocusIndex=r,this.activeIndex=r}}),r++}}0===this._overflowMenu.items.length&&(this.removeMenu(this._overflowMenu,!1),c.pop(),this._overflowMenu=null,this._overflowIndex=-1)}d.VirtualDOM.render(c,this.contentNode),this._updateOverflowIndex()}_updateOverflowIndex(){if(!this._overflowMenuOptions.isVisible)return;const e=this.contentNode.childNodes;let t=this.node.offsetWidth,i=0,s=-1,n=e.length;if(0==this._menuItemSizes.length)for(let a=0;at&&-1===s&&(s=a)}else for(let e=0;et){s=e;break}this._overflowIndex=s}_evtKeyDown(e){let t=e.keyCode;if(9===t)return void(this.activeIndex=-1);if(e.preventDefault(),e.stopPropagation(),13===t||32===t||38===t||40===t){if(this.activeIndex=this._tabFocusIndex,this.activeIndex!==this._tabFocusIndex)return;return void this.openActiveMenu()}if(27===t)return this._closeChildMenu(),void this._focusItemAt(this.activeIndex);if(37===t||39===t){let e=37===t?-1:1,i=this._tabFocusIndex+e,s=this._menus.length;for(let t=0;ts.ElementExt.hitTest(t,e.clientX,e.clientY)));if(-1!==i){if(0===e.button)if(this._childMenu)this._closeChildMenu(),this.activeIndex=i;else{e.preventDefault();const t=this._positionForMenu(i);F.saveWindowData(),this.activeIndex=i,this._openChildMenu(t)}}else this._closeChildMenu()}_evtMouseMove(e){let i=t.ArrayExt.findFirstIndex(this.contentNode.children,(t=>s.ElementExt.hitTest(t,e.clientX,e.clientY)));if(i===this._activeIndex)return;if(-1===i&&this._childMenu)return;const n=i>=0&&this._childMenu?this._positionForMenu(i):null;F.saveWindowData(),this.activeIndex=i,n&&this._openChildMenu(n)}_positionForMenu(e){let t=this.contentNode.children[e],{left:i,bottom:s}=t.getBoundingClientRect();return{top:s,left:i}}_evtFocusOut(e){this._childMenu||this.node.contains(e.relatedTarget)||(this.activeIndex=-1)}_focusItemAt(e){const t=this.contentNode.childNodes[e];t&&t.focus()}_openChildMenu(e={}){let t=this.activeMenu;if(!t)return void this._closeChildMenu();let i=this._childMenu;if(i===t)return;this._childMenu=t,i?i.close():document.addEventListener("mousedown",this,!0),this._tabFocusIndex=this.activeIndex,n.MessageLoop.sendMessage(this,b.Msg.UpdateRequest);let{left:s,top:a}=e;void 0!==s&&void 0!==a||({left:s,top:a}=this._positionForMenu(this._activeIndex)),i||this.addClass("lm-mod-active"),t.items.length>0&&t.open(s,a,this._forceItemsPosition)}_closeChildMenu(){if(!this._childMenu)return;this.removeClass("lm-mod-active"),document.removeEventListener("mousedown",this,!0);let e=this._childMenu;this._childMenu=null,e.close(),this.activeIndex=-1}_onMenuAboutToClose(e){e===this._childMenu&&(this.removeClass("lm-mod-active"),document.removeEventListener("mousedown",this,!0),this._childMenu=null,this.activeIndex=-1)}_onMenuMenuRequested(e,t){if(e!==this._childMenu)return;let i=this._activeIndex,s=this._menus.length;switch(t){case"next":this.activeIndex=i===s-1?0:i+1;break;case"previous":this.activeIndex=0===i?s-1:i-1}this.openActiveMenu()}_onTitleChanged(){this.update()}}!function(e){class t{renderItem(e){let t=this.createItemClass(e),i=this.createItemDataset(e),s=this.createItemARIA(e);return d.h.li({className:t,dataset:i,...e.disabled?{}:{tabindex:e.tabbable?"0":"-1"},onfocus:e.onfocus,...s},this.renderIcon(e),this.renderLabel(e))}renderIcon(e){let t=this.createIconClass(e);return d.h.div({className:t},e.title.icon,e.title.iconLabel)}renderLabel(e){let t=this.formatLabel(e);return d.h.div({className:"lm-MenuBar-itemLabel"},t)}createItemClass(e){let t="lm-MenuBar-item";return e.title.className&&(t+=` ${e.title.className}`),e.active&&!e.disabled&&(t+=" lm-mod-active"),t}createItemDataset(e){return e.title.dataset}createItemARIA(e){return{role:"menuitem","aria-haspopup":"true","aria-disabled":e.disabled?"true":"false"}}createIconClass(e){let t="lm-MenuBar-itemIcon",i=e.title.iconClass;return i?`${t} ${i}`:t}formatLabel(e){let{label:t,mnemonic:i}=e.title;if(i<0||i>=t.length)return t;let s=t.slice(0,i),n=t.slice(i+1),a=t[i];return[s,d.h.span({className:"lm-MenuBar-itemMnemonic"},a),n]}}e.Renderer=t,e.defaultRenderer=new t}(te||(te={})),function(e){e.createNode=function(){let e=document.createElement("div"),t=document.createElement("ul");return t.className="lm-MenuBar-content",e.appendChild(t),t.setAttribute("role","menubar"),e},e.findMnemonic=function(e,t,i){let s=-1,n=-1,a=!1,r=t.toUpperCase();for(let t=0,o=e.length;t=0&&l1&&this.widgets.forEach((e=>{e.hiddenMode=this._hiddenMode})))}dispose(){for(const e of this._items)e.dispose();this._box=null,this._items.length=0,super.dispose()}attachWidget(e,i){this._hiddenMode===b.HiddenMode.Scale&&this._items.length>0?(1===this._items.length&&(this.widgets[0].hiddenMode=b.HiddenMode.Scale),i.hiddenMode=b.HiddenMode.Scale):i.hiddenMode=b.HiddenMode.Display,t.ArrayExt.insert(this._items,e,new x(i)),this.parent.isAttached&&n.MessageLoop.sendMessage(i,b.Msg.BeforeAttach),this.parent.node.appendChild(i.node),this.parent.isAttached&&n.MessageLoop.sendMessage(i,b.Msg.AfterAttach),this.parent.fit()}moveWidget(e,i,s){t.ArrayExt.move(this._items,e,i),this.parent.update()}detachWidget(e,i){let s=t.ArrayExt.removeAt(this._items,e);this.parent.isAttached&&n.MessageLoop.sendMessage(i,b.Msg.BeforeDetach),this.parent.node.removeChild(i.node),this.parent.isAttached&&n.MessageLoop.sendMessage(i,b.Msg.AfterDetach),s.widget.node.style.zIndex="",this._hiddenMode===b.HiddenMode.Scale&&(i.hiddenMode=b.HiddenMode.Display,1===this._items.length&&(this._items[0].widget.hiddenMode=b.HiddenMode.Display)),s.dispose(),this.parent.fit()}onBeforeShow(e){super.onBeforeShow(e),this.parent.update()}onBeforeAttach(e){super.onBeforeAttach(e),this.parent.fit()}onChildShown(e){this.parent.fit()}onChildHidden(e){this.parent.fit()}onResize(e){this.parent.isVisible&&this._update(e.width,e.height)}onUpdateRequest(e){this.parent.isVisible&&this._update(-1,-1)}onFitRequest(e){this.parent.isAttached&&this._fit()}_fit(){let e=0,t=0;for(let i=0,s=this._items.length;i{t.ArrayExt.removeFirstOf(this._items,i)}))}open(e){if(F.saveWindowData(),this.menu.clearItems(),0===this._items.length)return!1;let t=T.matchItems(this._items,e,this._groupByTarget,this._sortBySelector);if(!t||0===t.length)return!1;for(const e of t)this.menu.addItem(e);return this.menu.open(e.clientX,e.clientY),!0}},e.DockLayout=Q,e.DockPanel=Z,e.FocusTracker=class{constructor(){this._counter=0,this._widgets=[],this._activeWidget=null,this._currentWidget=null,this._numbers=new Map,this._nodes=new Map,this._activeChanged=new r.Signal(this),this._currentChanged=new r.Signal(this)}dispose(){if(!(this._counter<0)){this._counter=-1,r.Signal.clearData(this);for(const e of this._widgets)e.node.removeEventListener("focus",this,!0),e.node.removeEventListener("blur",this,!0);this._activeWidget=null,this._currentWidget=null,this._nodes.clear(),this._numbers.clear(),this._widgets.length=0}}get currentChanged(){return this._currentChanged}get activeChanged(){return this._activeChanged}get isDisposed(){return this._counter<0}get currentWidget(){return this._currentWidget}get activeWidget(){return this._activeWidget}get widgets(){return this._widgets}focusNumber(e){let t=this._numbers.get(e);return void 0===t?-1:t}has(e){return this._numbers.has(e)}add(e){if(this._numbers.has(e))return;let t=e.node.contains(document.activeElement),i=t?this._counter++:-1;this._widgets.push(e),this._numbers.set(e,i),this._nodes.set(e.node,e),e.node.addEventListener("focus",this,!0),e.node.addEventListener("blur",this,!0),e.disposed.connect(this._onWidgetDisposed,this),t&&this._setWidgets(e,e)}remove(e){if(!this._numbers.has(e))return;if(e.disposed.disconnect(this._onWidgetDisposed,this),e.node.removeEventListener("focus",this,!0),e.node.removeEventListener("blur",this,!0),t.ArrayExt.removeFirstOf(this._widgets,e),this._nodes.delete(e.node),this._numbers.delete(e),this._currentWidget!==e)return;let i=this._widgets.filter((e=>-1!==this._numbers.get(e))),s=t.max(i,((e,t)=>this._numbers.get(e)-this._numbers.get(t)))||null;this._setWidgets(s,null)}handleEvent(e){switch(e.type){case"focus":this._evtFocus(e);break;case"blur":this._evtBlur(e)}}_setWidgets(e,t){let i=this._currentWidget;this._currentWidget=e;let s=this._activeWidget;this._activeWidget=t,i!==e&&this._currentChanged.emit({oldValue:i,newValue:e}),s!==t&&this._activeChanged.emit({oldValue:s,newValue:t})}_evtFocus(e){let t=this._nodes.get(e.currentTarget);t!==this._currentWidget&&this._numbers.set(t,this._counter++),this._setWidgets(t,t)}_evtBlur(e){let i=this._nodes.get(e.currentTarget),s=e.relatedTarget;s&&(i.node.contains(s)||t.find(this._widgets,(e=>e.node.contains(s))))||this._setWidgets(this._currentWidget,null)}_onWidgetDisposed(e){this.remove(e)}},e.GridLayout=ee,e.Layout=v,e.LayoutItem=x,e.Menu=F,e.MenuBar=te,e.Panel=R,e.PanelLayout=M,e.ScrollBar=class extends b{constructor(e={}){super({node:G.createNode()}),this._onRepeat=()=>{if(this._repeatTimer=-1,!this._pressData)return;let e=this._pressData.part;if("thumb"===e)return;this._repeatTimer=window.setTimeout(this._onRepeat,20);let t=this._pressData.mouseX,i=this._pressData.mouseY;if("decrement"!==e)if("increment"!==e){if("track"===e){if(!s.ElementExt.hitTest(this.trackNode,t,i))return;let e=this.thumbNode;if(s.ElementExt.hitTest(e,t,i))return;let n,a=e.getBoundingClientRect();return n="horizontal"===this._orientation?t=` to {@link minSize}. Failure to adhere to this\n * constraint will yield undefined results.\n *\n * The default value is `Infinity`.\n */\n maxSize = Infinity;\n\n /**\n * The stretch factor for the sizer.\n *\n * #### Notes\n * This controls how much the sizer stretches relative to its sibling\n * sizers when layout space is distributed. A stretch factor of zero\n * is special and will cause the sizer to only be resized after all\n * other sizers with a stretch factor greater than zero have been\n * resized to their limits.\n *\n * It is assumed that this value is an integer that lies in the range\n * `[0, Infinity)`. Failure to adhere to this constraint will yield\n * undefined results.\n *\n * The default value is `1`.\n */\n stretch = 1;\n\n /**\n * The computed size of the sizer.\n *\n * #### Notes\n * This value is the output of a call to {@link BoxEngine.calc}. It represents\n * the computed size for the object along the layout orientation,\n * and will always lie in the range `[minSize, maxSize]`.\n *\n * This value is output only.\n *\n * Changing this value will have no effect.\n */\n size = 0;\n\n /**\n * An internal storage property for the layout algorithm.\n *\n * #### Notes\n * This value is used as temporary storage by the layout algorithm.\n *\n * Changing this value will have no effect.\n */\n done = false;\n}\n\n/**\n * The namespace for the box engine layout functions.\n */\nexport namespace BoxEngine {\n /**\n * Calculate the optimal layout sizes for a sequence of box sizers.\n *\n * This distributes the available layout space among the box sizers\n * according to the following algorithm:\n *\n * 1. Initialize the sizers's size to its size hint and compute the\n * sums for each of size hint, min size, and max size.\n *\n * 2. If the total size hint equals the available space, return.\n *\n * 3. If the available space is less than the total min size, set all\n * sizers to their min size and return.\n *\n * 4. If the available space is greater than the total max size, set\n * all sizers to their max size and return.\n *\n * 5. If the layout space is less than the total size hint, distribute\n * the negative delta as follows:\n *\n * a. Shrink each sizer with a stretch factor greater than zero by\n * an amount proportional to the negative space and the sum of\n * stretch factors. If the sizer reaches its min size, remove\n * it and its stretch factor from the computation.\n *\n * b. If after adjusting all stretch sizers there remains negative\n * space, distribute the space equally among the sizers with a\n * stretch factor of zero. If a sizer reaches its min size,\n * remove it from the computation.\n *\n * 6. If the layout space is greater than the total size hint,\n * distribute the positive delta as follows:\n *\n * a. Expand each sizer with a stretch factor greater than zero by\n * an amount proportional to the postive space and the sum of\n * stretch factors. If the sizer reaches its max size, remove\n * it and its stretch factor from the computation.\n *\n * b. If after adjusting all stretch sizers there remains positive\n * space, distribute the space equally among the sizers with a\n * stretch factor of zero. If a sizer reaches its max size,\n * remove it from the computation.\n *\n * 7. return\n *\n * @param sizers - The sizers for a particular layout line.\n *\n * @param space - The available layout space for the sizers.\n *\n * @returns The delta between the provided available space and the\n * actual consumed space. This value will be zero if the sizers\n * can be adjusted to fit, negative if the available space is too\n * small, and positive if the available space is too large.\n *\n * #### Notes\n * The {@link BoxSizer.size} of each sizer is updated with the computed size.\n *\n * This function can be called at any time to recompute the layout for\n * an existing sequence of sizers. The previously computed results will\n * have no effect on the new output. It is therefore not necessary to\n * create new sizer objects on each resize event.\n */\n export function calc(sizers: ArrayLike, space: number): number {\n // Bail early if there is nothing to do.\n let count = sizers.length;\n if (count === 0) {\n return space;\n }\n\n // Setup the size and stretch counters.\n let totalMin = 0;\n let totalMax = 0;\n let totalSize = 0;\n let totalStretch = 0;\n let stretchCount = 0;\n\n // Setup the sizers and compute the totals.\n for (let i = 0; i < count; ++i) {\n let sizer = sizers[i];\n let min = sizer.minSize;\n let max = sizer.maxSize;\n let hint = sizer.sizeHint;\n sizer.done = false;\n sizer.size = Math.max(min, Math.min(hint, max));\n totalSize += sizer.size;\n totalMin += min;\n totalMax += max;\n if (sizer.stretch > 0) {\n totalStretch += sizer.stretch;\n stretchCount++;\n }\n }\n\n // If the space is equal to the total size, return early.\n if (space === totalSize) {\n return 0;\n }\n\n // If the space is less than the total min, minimize each sizer.\n if (space <= totalMin) {\n for (let i = 0; i < count; ++i) {\n let sizer = sizers[i];\n sizer.size = sizer.minSize;\n }\n return space - totalMin;\n }\n\n // If the space is greater than the total max, maximize each sizer.\n if (space >= totalMax) {\n for (let i = 0; i < count; ++i) {\n let sizer = sizers[i];\n sizer.size = sizer.maxSize;\n }\n return space - totalMax;\n }\n\n // The loops below perform sub-pixel precision sizing. A near zero\n // value is used for compares instead of zero to ensure that the\n // loop terminates when the subdivided space is reasonably small.\n let nearZero = 0.01;\n\n // A counter which is decremented each time a sizer is resized to\n // its limit. This ensures the loops terminate even if there is\n // space remaining to distribute.\n let notDoneCount = count;\n\n // Distribute negative delta space.\n if (space < totalSize) {\n // Shrink each stretchable sizer by an amount proportional to its\n // stretch factor. If a sizer reaches its min size it's marked as\n // done. The loop progresses in phases where each sizer is given\n // a chance to consume its fair share for the pass, regardless of\n // whether a sizer before it reached its limit. This continues\n // until the stretchable sizers or the free space is exhausted.\n let freeSpace = totalSize - space;\n while (stretchCount > 0 && freeSpace > nearZero) {\n let distSpace = freeSpace;\n let distStretch = totalStretch;\n for (let i = 0; i < count; ++i) {\n let sizer = sizers[i];\n if (sizer.done || sizer.stretch === 0) {\n continue;\n }\n let amt = (sizer.stretch * distSpace) / distStretch;\n if (sizer.size - amt <= sizer.minSize) {\n freeSpace -= sizer.size - sizer.minSize;\n totalStretch -= sizer.stretch;\n sizer.size = sizer.minSize;\n sizer.done = true;\n notDoneCount--;\n stretchCount--;\n } else {\n freeSpace -= amt;\n sizer.size -= amt;\n }\n }\n }\n // Distribute any remaining space evenly among the non-stretchable\n // sizers. This progresses in phases in the same manner as above.\n while (notDoneCount > 0 && freeSpace > nearZero) {\n let amt = freeSpace / notDoneCount;\n for (let i = 0; i < count; ++i) {\n let sizer = sizers[i];\n if (sizer.done) {\n continue;\n }\n if (sizer.size - amt <= sizer.minSize) {\n freeSpace -= sizer.size - sizer.minSize;\n sizer.size = sizer.minSize;\n sizer.done = true;\n notDoneCount--;\n } else {\n freeSpace -= amt;\n sizer.size -= amt;\n }\n }\n }\n }\n // Distribute positive delta space.\n else {\n // Expand each stretchable sizer by an amount proportional to its\n // stretch factor. If a sizer reaches its max size it's marked as\n // done. The loop progresses in phases where each sizer is given\n // a chance to consume its fair share for the pass, regardless of\n // whether a sizer before it reached its limit. This continues\n // until the stretchable sizers or the free space is exhausted.\n let freeSpace = space - totalSize;\n while (stretchCount > 0 && freeSpace > nearZero) {\n let distSpace = freeSpace;\n let distStretch = totalStretch;\n for (let i = 0; i < count; ++i) {\n let sizer = sizers[i];\n if (sizer.done || sizer.stretch === 0) {\n continue;\n }\n let amt = (sizer.stretch * distSpace) / distStretch;\n if (sizer.size + amt >= sizer.maxSize) {\n freeSpace -= sizer.maxSize - sizer.size;\n totalStretch -= sizer.stretch;\n sizer.size = sizer.maxSize;\n sizer.done = true;\n notDoneCount--;\n stretchCount--;\n } else {\n freeSpace -= amt;\n sizer.size += amt;\n }\n }\n }\n // Distribute any remaining space evenly among the non-stretchable\n // sizers. This progresses in phases in the same manner as above.\n while (notDoneCount > 0 && freeSpace > nearZero) {\n let amt = freeSpace / notDoneCount;\n for (let i = 0; i < count; ++i) {\n let sizer = sizers[i];\n if (sizer.done) {\n continue;\n }\n if (sizer.size + amt >= sizer.maxSize) {\n freeSpace -= sizer.maxSize - sizer.size;\n sizer.size = sizer.maxSize;\n sizer.done = true;\n notDoneCount--;\n } else {\n freeSpace -= amt;\n sizer.size += amt;\n }\n }\n }\n }\n\n // Indicate that the consumed space equals the available space.\n return 0;\n }\n\n /**\n * Adjust a sizer by a delta and update its neighbors accordingly.\n *\n * @param sizers - The sizers which should be adjusted.\n *\n * @param index - The index of the sizer to grow.\n *\n * @param delta - The amount to adjust the sizer, positive or negative.\n *\n * #### Notes\n * This will adjust the indicated sizer by the specified amount, along\n * with the sizes of the appropriate neighbors, subject to the limits\n * specified by each of the sizers.\n *\n * This is useful when implementing box layouts where the boundaries\n * between the sizers are interactively adjustable by the user.\n */\n export function adjust(\n sizers: ArrayLike,\n index: number,\n delta: number\n ): void {\n // Bail early when there is nothing to do.\n if (sizers.length === 0 || delta === 0) {\n return;\n }\n\n // Dispatch to the proper implementation.\n if (delta > 0) {\n growSizer(sizers, index, delta);\n } else {\n shrinkSizer(sizers, index, -delta);\n }\n }\n\n /**\n * Grow a sizer by a positive delta and adjust neighbors.\n */\n function growSizer(\n sizers: ArrayLike,\n index: number,\n delta: number\n ): void {\n // Compute how much the items to the left can expand.\n let growLimit = 0;\n for (let i = 0; i <= index; ++i) {\n let sizer = sizers[i];\n growLimit += sizer.maxSize - sizer.size;\n }\n\n // Compute how much the items to the right can shrink.\n let shrinkLimit = 0;\n for (let i = index + 1, n = sizers.length; i < n; ++i) {\n let sizer = sizers[i];\n shrinkLimit += sizer.size - sizer.minSize;\n }\n\n // Clamp the delta adjustment to the limits.\n delta = Math.min(delta, growLimit, shrinkLimit);\n\n // Grow the sizers to the left by the delta.\n let grow = delta;\n for (let i = index; i >= 0 && grow > 0; --i) {\n let sizer = sizers[i];\n let limit = sizer.maxSize - sizer.size;\n if (limit >= grow) {\n sizer.sizeHint = sizer.size + grow;\n grow = 0;\n } else {\n sizer.sizeHint = sizer.size + limit;\n grow -= limit;\n }\n }\n\n // Shrink the sizers to the right by the delta.\n let shrink = delta;\n for (let i = index + 1, n = sizers.length; i < n && shrink > 0; ++i) {\n let sizer = sizers[i];\n let limit = sizer.size - sizer.minSize;\n if (limit >= shrink) {\n sizer.sizeHint = sizer.size - shrink;\n shrink = 0;\n } else {\n sizer.sizeHint = sizer.size - limit;\n shrink -= limit;\n }\n }\n }\n\n /**\n * Shrink a sizer by a positive delta and adjust neighbors.\n */\n function shrinkSizer(\n sizers: ArrayLike,\n index: number,\n delta: number\n ): void {\n // Compute how much the items to the right can expand.\n let growLimit = 0;\n for (let i = index + 1, n = sizers.length; i < n; ++i) {\n let sizer = sizers[i];\n growLimit += sizer.maxSize - sizer.size;\n }\n\n // Compute how much the items to the left can shrink.\n let shrinkLimit = 0;\n for (let i = 0; i <= index; ++i) {\n let sizer = sizers[i];\n shrinkLimit += sizer.size - sizer.minSize;\n }\n\n // Clamp the delta adjustment to the limits.\n delta = Math.min(delta, growLimit, shrinkLimit);\n\n // Grow the sizers to the right by the delta.\n let grow = delta;\n for (let i = index + 1, n = sizers.length; i < n && grow > 0; ++i) {\n let sizer = sizers[i];\n let limit = sizer.maxSize - sizer.size;\n if (limit >= grow) {\n sizer.sizeHint = sizer.size + grow;\n grow = 0;\n } else {\n sizer.sizeHint = sizer.size + limit;\n grow -= limit;\n }\n }\n\n // Shrink the sizers to the left by the delta.\n let shrink = delta;\n for (let i = index; i >= 0 && shrink > 0; --i) {\n let sizer = sizers[i];\n let limit = sizer.size - sizer.minSize;\n if (limit >= shrink) {\n sizer.sizeHint = sizer.size - shrink;\n shrink = 0;\n } else {\n sizer.sizeHint = sizer.size - limit;\n shrink -= limit;\n }\n }\n }\n}\n","/* eslint-disable @typescript-eslint/no-empty-function */\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { IObservableDisposable } from '@lumino/disposable';\n\nimport {\n ConflatableMessage,\n IMessageHandler,\n Message,\n MessageLoop\n} from '@lumino/messaging';\n\nimport { AttachedProperty } from '@lumino/properties';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { Layout } from './layout';\n\nimport { Title } from './title';\n\n/**\n * The base class of the lumino widget hierarchy.\n *\n * #### Notes\n * This class will typically be subclassed in order to create a useful\n * widget. However, it can be used directly to host externally created\n * content.\n */\nexport class Widget implements IMessageHandler, IObservableDisposable {\n /**\n * Construct a new widget.\n *\n * @param options - The options for initializing the widget.\n */\n constructor(options: Widget.IOptions = {}) {\n this.node = Private.createNode(options);\n this.addClass('lm-Widget');\n }\n\n /**\n * Dispose of the widget and its descendant widgets.\n *\n * #### Notes\n * It is unsafe to use the widget after it has been disposed.\n *\n * All calls made to this method after the first are a no-op.\n */\n dispose(): void {\n // Do nothing if the widget is already disposed.\n if (this.isDisposed) {\n return;\n }\n\n // Set the disposed flag and emit the disposed signal.\n this.setFlag(Widget.Flag.IsDisposed);\n this._disposed.emit(undefined);\n\n // Remove or detach the widget if necessary.\n if (this.parent) {\n this.parent = null;\n } else if (this.isAttached) {\n Widget.detach(this);\n }\n\n // Dispose of the widget layout.\n if (this._layout) {\n this._layout.dispose();\n this._layout = null;\n }\n\n // Dispose the title\n this.title.dispose();\n\n // Clear the extra data associated with the widget.\n Signal.clearData(this);\n MessageLoop.clearData(this);\n AttachedProperty.clearData(this);\n }\n\n /**\n * A signal emitted when the widget is disposed.\n */\n get disposed(): ISignal {\n return this._disposed;\n }\n\n /**\n * Get the DOM node owned by the widget.\n */\n readonly node: HTMLElement;\n\n /**\n * Test whether the widget has been disposed.\n */\n get isDisposed(): boolean {\n return this.testFlag(Widget.Flag.IsDisposed);\n }\n\n /**\n * Test whether the widget's node is attached to the DOM.\n */\n get isAttached(): boolean {\n return this.testFlag(Widget.Flag.IsAttached);\n }\n\n /**\n * Test whether the widget is explicitly hidden.\n *\n * #### Notes\n * You should prefer `!{@link isVisible}` over `{@link isHidden}` if you want to know if the\n * widget is hidden as this does not test if the widget is hidden because one of its ancestors is hidden.\n */\n get isHidden(): boolean {\n return this.testFlag(Widget.Flag.IsHidden);\n }\n\n /**\n * Test whether the widget is visible.\n *\n * #### Notes\n * A widget is visible when it is attached to the DOM, is not\n * explicitly hidden, and has no explicitly hidden ancestors.\n *\n * Since 2.7.0, this does not rely on the {@link Widget.Flag.IsVisible} flag.\n * It recursively checks the visibility of all parent widgets.\n */\n get isVisible(): boolean {\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n let parent: Widget | null = this;\n do {\n if (parent.isHidden || !parent.isAttached) {\n return false;\n }\n parent = parent.parent;\n } while (parent != null);\n return true;\n }\n\n /**\n * The title object for the widget.\n *\n * #### Notes\n * The title object is used by some container widgets when displaying\n * the widget alongside some title, such as a tab panel or side bar.\n *\n * Since not all widgets will use the title, it is created on demand.\n *\n * The `owner` property of the title is set to this widget.\n */\n get title(): Title {\n return Private.titleProperty.get(this);\n }\n\n /**\n * Get the id of the widget's DOM node.\n */\n get id(): string {\n return this.node.id;\n }\n\n /**\n * Set the id of the widget's DOM node.\n */\n set id(value: string) {\n this.node.id = value;\n }\n\n /**\n * The dataset for the widget's DOM node.\n */\n get dataset(): DOMStringMap {\n return this.node.dataset;\n }\n\n /**\n * Get the method for hiding the widget.\n */\n get hiddenMode(): Widget.HiddenMode {\n return this._hiddenMode;\n }\n\n /**\n * Set the method for hiding the widget.\n */\n set hiddenMode(value: Widget.HiddenMode) {\n if (this._hiddenMode === value) {\n return;\n }\n\n if (this.isHidden) {\n // Reset styles set by previous mode.\n this._toggleHidden(false);\n }\n\n if (value == Widget.HiddenMode.Scale) {\n this.node.style.willChange = 'transform';\n } else {\n this.node.style.willChange = 'auto';\n }\n\n this._hiddenMode = value;\n\n if (this.isHidden) {\n // Set styles for new mode.\n this._toggleHidden(true);\n }\n }\n\n /**\n * Get the parent of the widget.\n */\n get parent(): Widget | null {\n return this._parent;\n }\n\n /**\n * Set the parent of the widget.\n *\n * #### Notes\n * Children are typically added to a widget by using a layout, which\n * means user code will not normally set the parent widget directly.\n *\n * The widget will be automatically removed from its old parent.\n *\n * This is a no-op if there is no effective parent change.\n */\n set parent(value: Widget | null) {\n if (this._parent === value) {\n return;\n }\n if (value && this.contains(value)) {\n throw new Error('Invalid parent widget.');\n }\n if (this._parent && !this._parent.isDisposed) {\n let msg = new Widget.ChildMessage('child-removed', this);\n MessageLoop.sendMessage(this._parent, msg);\n }\n this._parent = value;\n if (this._parent && !this._parent.isDisposed) {\n let msg = new Widget.ChildMessage('child-added', this);\n MessageLoop.sendMessage(this._parent, msg);\n }\n if (!this.isDisposed) {\n MessageLoop.sendMessage(this, Widget.Msg.ParentChanged);\n }\n }\n\n /**\n * Get the layout for the widget.\n */\n get layout(): Layout | null {\n return this._layout;\n }\n\n /**\n * Set the layout for the widget.\n *\n * #### Notes\n * The layout is single-use only. It cannot be changed after the\n * first assignment.\n *\n * The layout is disposed automatically when the widget is disposed.\n */\n set layout(value: Layout | null) {\n if (this._layout === value) {\n return;\n }\n if (this.testFlag(Widget.Flag.DisallowLayout)) {\n throw new Error('Cannot set widget layout.');\n }\n if (this._layout) {\n throw new Error('Cannot change widget layout.');\n }\n if (value!.parent) {\n throw new Error('Cannot change layout parent.');\n }\n this._layout = value;\n value!.parent = this;\n }\n\n /**\n * Create an iterator over the widget's children.\n *\n * @returns A new iterator over the children of the widget.\n *\n * #### Notes\n * The widget must have a populated layout in order to have children.\n *\n * If a layout is not installed, the returned iterator will be empty.\n */\n *children(): IterableIterator {\n if (this._layout) {\n yield* this._layout;\n }\n }\n\n /**\n * Test whether a widget is a descendant of this widget.\n *\n * @param widget - The descendant widget of interest.\n *\n * @returns `true` if the widget is a descendant, `false` otherwise.\n */\n contains(widget: Widget): boolean {\n for (let value: Widget | null = widget; value; value = value._parent) {\n if (value === this) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * Test whether the widget's DOM node has the given class name.\n *\n * @param name - The class name of interest.\n *\n * @returns `true` if the node has the class, `false` otherwise.\n */\n hasClass(name: string): boolean {\n return this.node.classList.contains(name);\n }\n\n /**\n * Add a class name to the widget's DOM node.\n *\n * @param name - The class name to add to the node.\n *\n * #### Notes\n * If the class name is already added to the node, this is a no-op.\n *\n * The class name must not contain whitespace.\n */\n addClass(name: string): void {\n this.node.classList.add(name);\n }\n\n /**\n * Remove a class name from the widget's DOM node.\n *\n * @param name - The class name to remove from the node.\n *\n * #### Notes\n * If the class name is not yet added to the node, this is a no-op.\n *\n * The class name must not contain whitespace.\n */\n removeClass(name: string): void {\n this.node.classList.remove(name);\n }\n\n /**\n * Toggle a class name on the widget's DOM node.\n *\n * @param name - The class name to toggle on the node.\n *\n * @param force - Whether to force add the class (`true`) or force\n * remove the class (`false`). If not provided, the presence of\n * the class will be toggled from its current state.\n *\n * @returns `true` if the class is now present, `false` otherwise.\n *\n * #### Notes\n * The class name must not contain whitespace.\n */\n toggleClass(name: string, force?: boolean): boolean {\n if (force === true) {\n this.node.classList.add(name);\n return true;\n }\n if (force === false) {\n this.node.classList.remove(name);\n return false;\n }\n return this.node.classList.toggle(name);\n }\n\n /**\n * Post an `'update-request'` message to the widget.\n *\n * #### Notes\n * This is a simple convenience method for posting the message.\n */\n update(): void {\n MessageLoop.postMessage(this, Widget.Msg.UpdateRequest);\n }\n\n /**\n * Post a `'fit-request'` message to the widget.\n *\n * #### Notes\n * This is a simple convenience method for posting the message.\n */\n fit(): void {\n MessageLoop.postMessage(this, Widget.Msg.FitRequest);\n }\n\n /**\n * Post an `'activate-request'` message to the widget.\n *\n * #### Notes\n * This is a simple convenience method for posting the message.\n */\n activate(): void {\n MessageLoop.postMessage(this, Widget.Msg.ActivateRequest);\n }\n\n /**\n * Send a `'close-request'` message to the widget.\n *\n * #### Notes\n * This is a simple convenience method for sending the message.\n */\n close(): void {\n MessageLoop.sendMessage(this, Widget.Msg.CloseRequest);\n }\n\n /**\n * Show the widget and make it visible to its parent widget.\n *\n * #### Notes\n * This causes the {@link isHidden} property to be `false`.\n *\n * If the widget is not explicitly hidden, this is a no-op.\n */\n show(): void {\n if (!this.testFlag(Widget.Flag.IsHidden)) {\n return;\n }\n if (this.isAttached && (!this.parent || this.parent.isVisible)) {\n MessageLoop.sendMessage(this, Widget.Msg.BeforeShow);\n }\n this.clearFlag(Widget.Flag.IsHidden);\n this._toggleHidden(false);\n\n if (this.isAttached && (!this.parent || this.parent.isVisible)) {\n MessageLoop.sendMessage(this, Widget.Msg.AfterShow);\n }\n if (this.parent) {\n let msg = new Widget.ChildMessage('child-shown', this);\n MessageLoop.sendMessage(this.parent, msg);\n }\n }\n\n /**\n * Hide the widget and make it hidden to its parent widget.\n *\n * #### Notes\n * This causes the {@link isHidden} property to be `true`.\n *\n * If the widget is explicitly hidden, this is a no-op.\n */\n hide(): void {\n if (this.testFlag(Widget.Flag.IsHidden)) {\n return;\n }\n if (this.isAttached && (!this.parent || this.parent.isVisible)) {\n MessageLoop.sendMessage(this, Widget.Msg.BeforeHide);\n }\n this.setFlag(Widget.Flag.IsHidden);\n this._toggleHidden(true);\n\n if (this.isAttached && (!this.parent || this.parent.isVisible)) {\n MessageLoop.sendMessage(this, Widget.Msg.AfterHide);\n }\n if (this.parent) {\n let msg = new Widget.ChildMessage('child-hidden', this);\n MessageLoop.sendMessage(this.parent, msg);\n }\n }\n\n /**\n * Show or hide the widget according to a boolean value.\n *\n * @param hidden - `true` to hide the widget, or `false` to show it.\n *\n * #### Notes\n * This is a convenience method for `hide()` and `show()`.\n */\n setHidden(hidden: boolean): void {\n if (hidden) {\n this.hide();\n } else {\n this.show();\n }\n }\n\n /**\n * Test whether the given widget flag is set.\n *\n * #### Notes\n * This will not typically be called directly by user code.\n *\n * Since 2.7.0, {@link Widget.Flag.IsVisible} is deprecated.\n * It will be removed in a future version.\n */\n testFlag(flag: Widget.Flag): boolean {\n return (this._flags & flag) !== 0;\n }\n\n /**\n * Set the given widget flag.\n *\n * #### Notes\n * This will not typically be called directly by user code.\n *\n * Since 2.7.0, {@link Widget.Flag.IsVisible} is deprecated.\n * It will be removed in a future version.\n */\n setFlag(flag: Widget.Flag): void {\n this._flags |= flag;\n }\n\n /**\n * Clear the given widget flag.\n *\n * #### Notes\n * This will not typically be called directly by user code.\n *\n * Since 2.7.0, {@link Widget.Flag.IsVisible} is deprecated.\n * It will be removed in a future version.\n */\n clearFlag(flag: Widget.Flag): void {\n this._flags &= ~flag;\n }\n\n /**\n * Process a message sent to the widget.\n *\n * @param msg - The message sent to the widget.\n *\n * #### Notes\n * Subclasses may reimplement this method as needed.\n */\n processMessage(msg: Message): void {\n switch (msg.type) {\n case 'resize':\n this.notifyLayout(msg);\n this.onResize(msg as Widget.ResizeMessage);\n break;\n case 'update-request':\n this.notifyLayout(msg);\n this.onUpdateRequest(msg);\n break;\n case 'fit-request':\n this.notifyLayout(msg);\n this.onFitRequest(msg);\n break;\n case 'before-show':\n this.notifyLayout(msg);\n this.onBeforeShow(msg);\n break;\n case 'after-show':\n this.setFlag(Widget.Flag.IsVisible);\n this.notifyLayout(msg);\n this.onAfterShow(msg);\n break;\n case 'before-hide':\n this.notifyLayout(msg);\n this.onBeforeHide(msg);\n break;\n case 'after-hide':\n this.clearFlag(Widget.Flag.IsVisible);\n this.notifyLayout(msg);\n this.onAfterHide(msg);\n break;\n case 'before-attach':\n this.notifyLayout(msg);\n this.onBeforeAttach(msg);\n break;\n case 'after-attach':\n if (!this.isHidden && (!this.parent || this.parent.isVisible)) {\n this.setFlag(Widget.Flag.IsVisible);\n }\n this.setFlag(Widget.Flag.IsAttached);\n this.notifyLayout(msg);\n this.onAfterAttach(msg);\n break;\n case 'before-detach':\n this.notifyLayout(msg);\n this.onBeforeDetach(msg);\n break;\n case 'after-detach':\n this.clearFlag(Widget.Flag.IsVisible);\n this.clearFlag(Widget.Flag.IsAttached);\n this.notifyLayout(msg);\n this.onAfterDetach(msg);\n break;\n case 'activate-request':\n this.notifyLayout(msg);\n this.onActivateRequest(msg);\n break;\n case 'close-request':\n this.notifyLayout(msg);\n this.onCloseRequest(msg);\n break;\n case 'child-added':\n this.notifyLayout(msg);\n this.onChildAdded(msg as Widget.ChildMessage);\n break;\n case 'child-removed':\n this.notifyLayout(msg);\n this.onChildRemoved(msg as Widget.ChildMessage);\n break;\n default:\n this.notifyLayout(msg);\n break;\n }\n }\n\n /**\n * Invoke the message processing routine of the widget's layout.\n *\n * @param msg - The message to dispatch to the layout.\n *\n * #### Notes\n * This is a no-op if the widget does not have a layout.\n *\n * This will not typically be called directly by user code.\n */\n protected notifyLayout(msg: Message): void {\n if (this._layout) {\n this._layout.processParentMessage(msg);\n }\n }\n\n /**\n * A message handler invoked on a `'close-request'` message.\n *\n * #### Notes\n * The default implementation unparents or detaches the widget.\n */\n protected onCloseRequest(msg: Message): void {\n if (this.parent) {\n this.parent = null;\n } else if (this.isAttached) {\n Widget.detach(this);\n }\n }\n\n /**\n * A message handler invoked on a `'resize'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onResize(msg: Widget.ResizeMessage): void {}\n\n /**\n * A message handler invoked on an `'update-request'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onUpdateRequest(msg: Message): void {}\n\n /**\n * A message handler invoked on a `'fit-request'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onFitRequest(msg: Message): void {}\n\n /**\n * A message handler invoked on an `'activate-request'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onActivateRequest(msg: Message): void {}\n\n /**\n * A message handler invoked on a `'before-show'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onBeforeShow(msg: Message): void {}\n\n /**\n * A message handler invoked on an `'after-show'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onAfterShow(msg: Message): void {}\n\n /**\n * A message handler invoked on a `'before-hide'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onBeforeHide(msg: Message): void {}\n\n /**\n * A message handler invoked on an `'after-hide'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onAfterHide(msg: Message): void {}\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onBeforeAttach(msg: Message): void {}\n\n /**\n * A message handler invoked on an `'after-attach'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onAfterAttach(msg: Message): void {}\n\n /**\n * A message handler invoked on a `'before-detach'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onBeforeDetach(msg: Message): void {}\n\n /**\n * A message handler invoked on an `'after-detach'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onAfterDetach(msg: Message): void {}\n\n /**\n * A message handler invoked on a `'child-added'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onChildAdded(msg: Widget.ChildMessage): void {}\n\n /**\n * A message handler invoked on a `'child-removed'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onChildRemoved(msg: Widget.ChildMessage): void {}\n\n private _toggleHidden(hidden: boolean) {\n if (hidden) {\n switch (this._hiddenMode) {\n case Widget.HiddenMode.Display:\n this.addClass('lm-mod-hidden');\n break;\n case Widget.HiddenMode.Scale:\n this.node.style.transform = 'scale(0)';\n this.node.setAttribute('aria-hidden', 'true');\n break;\n case Widget.HiddenMode.ContentVisibility:\n // @ts-expect-error content-visibility unknown by DOM lib types\n this.node.style.contentVisibility = 'hidden';\n this.node.style.zIndex = '-1';\n break;\n }\n } else {\n switch (this._hiddenMode) {\n case Widget.HiddenMode.Display:\n this.removeClass('lm-mod-hidden');\n break;\n case Widget.HiddenMode.Scale:\n this.node.style.transform = '';\n this.node.removeAttribute('aria-hidden');\n break;\n case Widget.HiddenMode.ContentVisibility:\n // @ts-expect-error content-visibility unknown by DOM lib types\n this.node.style.contentVisibility = '';\n this.node.style.zIndex = '';\n break;\n }\n }\n }\n\n private _flags = 0;\n private _layout: Layout | null = null;\n private _parent: Widget | null = null;\n private _disposed = new Signal(this);\n private _hiddenMode: Widget.HiddenMode = Widget.HiddenMode.Display;\n}\n\n/**\n * The namespace for the `Widget` class statics.\n */\nexport namespace Widget {\n /**\n * An options object for initializing a widget.\n */\n export interface IOptions {\n /**\n * The optional node to use for the widget.\n *\n * If a node is provided, the widget will assume full ownership\n * and control of the node, as if it had created the node itself.\n *\n * The default is a new `
`.\n */\n node?: HTMLElement;\n\n /**\n * The optional element tag, used for constructing the widget's node.\n *\n * If a pre-constructed node is provided via the `node` arg, this\n * value is ignored.\n */\n tag?: keyof HTMLElementTagNameMap;\n }\n\n /**\n * The method for hiding the widget.\n *\n * The default is Display.\n *\n * Using `Scale` will often increase performance as most browsers will not\n * trigger style computation for the `transform` action. This should be used\n * sparingly and tested, since increasing the number of composition layers\n * may slow things down.\n *\n * To ensure the transformation does not trigger style recomputation, you\n * may need to set the widget CSS style `will-change: transform`. This\n * should be used only when needed as it may overwhelm the browser with a\n * high number of layers. See\n * https://developer.mozilla.org/en-US/docs/Web/CSS/will-change\n */\n export enum HiddenMode {\n /**\n * Set a `lm-mod-hidden` CSS class to hide the widget using `display:none`\n * CSS from the standard Lumino CSS.\n */\n Display = 0,\n\n /**\n * Hide the widget by setting the `transform` to `'scale(0)'`.\n */\n Scale,\n\n /**\n *Hide the widget by setting the `content-visibility` to `'hidden'`.\n */\n ContentVisibility\n }\n\n /**\n * An enum of widget bit flags.\n */\n export enum Flag {\n /**\n * The widget has been disposed.\n */\n IsDisposed = 0x1,\n\n /**\n * The widget is attached to the DOM.\n */\n IsAttached = 0x2,\n\n /**\n * The widget is hidden.\n */\n IsHidden = 0x4,\n\n /**\n * The widget is visible.\n *\n * @deprecated since 2.7.0, apply that flag consistently was not reliable\n * so it was dropped in favor of a recursive check of the visibility of all parents.\n */\n IsVisible = 0x8,\n\n /**\n * A layout cannot be set on the widget.\n */\n DisallowLayout = 0x10\n }\n\n /**\n * A collection of stateless messages related to widgets.\n */\n export namespace Msg {\n /**\n * A singleton `'before-show'` message.\n *\n * #### Notes\n * This message is sent to a widget before it becomes visible.\n *\n * This message is **not** sent when the widget is being attached.\n */\n export const BeforeShow = new Message('before-show');\n\n /**\n * A singleton `'after-show'` message.\n *\n * #### Notes\n * This message is sent to a widget after it becomes visible.\n *\n * This message is **not** sent when the widget is being attached.\n */\n export const AfterShow = new Message('after-show');\n\n /**\n * A singleton `'before-hide'` message.\n *\n * #### Notes\n * This message is sent to a widget before it becomes not-visible.\n *\n * This message is **not** sent when the widget is being detached.\n */\n export const BeforeHide = new Message('before-hide');\n\n /**\n * A singleton `'after-hide'` message.\n *\n * #### Notes\n * This message is sent to a widget after it becomes not-visible.\n *\n * This message is **not** sent when the widget is being detached.\n */\n export const AfterHide = new Message('after-hide');\n\n /**\n * A singleton `'before-attach'` message.\n *\n * #### Notes\n * This message is sent to a widget before it is attached.\n */\n export const BeforeAttach = new Message('before-attach');\n\n /**\n * A singleton `'after-attach'` message.\n *\n * #### Notes\n * This message is sent to a widget after it is attached.\n */\n export const AfterAttach = new Message('after-attach');\n\n /**\n * A singleton `'before-detach'` message.\n *\n * #### Notes\n * This message is sent to a widget before it is detached.\n */\n export const BeforeDetach = new Message('before-detach');\n\n /**\n * A singleton `'after-detach'` message.\n *\n * #### Notes\n * This message is sent to a widget after it is detached.\n */\n export const AfterDetach = new Message('after-detach');\n\n /**\n * A singleton `'parent-changed'` message.\n *\n * #### Notes\n * This message is sent to a widget when its parent has changed.\n */\n export const ParentChanged = new Message('parent-changed');\n\n /**\n * A singleton conflatable `'update-request'` message.\n *\n * #### Notes\n * This message can be dispatched to supporting widgets in order to\n * update their content based on the current widget state. Not all\n * widgets will respond to messages of this type.\n *\n * For widgets with a layout, this message will inform the layout to\n * update the position and size of its child widgets.\n */\n export const UpdateRequest = new ConflatableMessage('update-request');\n\n /**\n * A singleton conflatable `'fit-request'` message.\n *\n * #### Notes\n * For widgets with a layout, this message will inform the layout to\n * recalculate its size constraints to fit the space requirements of\n * its child widgets, and to update their position and size. Not all\n * layouts will respond to messages of this type.\n */\n export const FitRequest = new ConflatableMessage('fit-request');\n\n /**\n * A singleton conflatable `'activate-request'` message.\n *\n * #### Notes\n * This message should be dispatched to a widget when it should\n * perform the actions necessary to activate the widget, which\n * may include focusing its node or descendant node.\n */\n export const ActivateRequest = new ConflatableMessage('activate-request');\n\n /**\n * A singleton conflatable `'close-request'` message.\n *\n * #### Notes\n * This message should be dispatched to a widget when it should close\n * and remove itself from the widget hierarchy.\n */\n export const CloseRequest = new ConflatableMessage('close-request');\n }\n\n /**\n * A message class for child related messages.\n */\n export class ChildMessage extends Message {\n /**\n * Construct a new child message.\n *\n * @param type - The message type.\n *\n * @param child - The child widget for the message.\n */\n constructor(type: string, child: Widget) {\n super(type);\n this.child = child;\n }\n\n /**\n * The child widget for the message.\n */\n readonly child: Widget;\n }\n\n /**\n * A message class for `'resize'` messages.\n */\n export class ResizeMessage extends Message {\n /**\n * Construct a new resize message.\n *\n * @param width - The **offset width** of the widget, or `-1` if\n * the width is not known.\n *\n * @param height - The **offset height** of the widget, or `-1` if\n * the height is not known.\n */\n constructor(width: number, height: number) {\n super('resize');\n this.width = width;\n this.height = height;\n }\n\n /**\n * The offset width of the widget.\n *\n * #### Notes\n * This will be `-1` if the width is unknown.\n */\n readonly width: number;\n\n /**\n * The offset height of the widget.\n *\n * #### Notes\n * This will be `-1` if the height is unknown.\n */\n readonly height: number;\n }\n\n /**\n * The namespace for the `ResizeMessage` class statics.\n */\n export namespace ResizeMessage {\n /**\n * A singleton `'resize'` message with an unknown size.\n */\n export const UnknownSize = new ResizeMessage(-1, -1);\n }\n\n /**\n * Attach a widget to a host DOM node.\n *\n * @param widget - The widget of interest.\n *\n * @param host - The DOM node to use as the widget's host.\n *\n * @param ref - The child of `host` to use as the reference element.\n * If this is provided, the widget will be inserted before this\n * node in the host. The default is `null`, which will cause the\n * widget to be added as the last child of the host.\n *\n * #### Notes\n * This will throw an error if the widget is not a root widget, if\n * the widget is already attached, or if the host is not attached\n * to the DOM.\n */\n export function attach(\n widget: Widget,\n host: HTMLElement,\n ref: HTMLElement | null = null\n ): void {\n if (widget.parent) {\n throw new Error('Cannot attach a child widget.');\n }\n if (widget.isAttached || widget.node.isConnected) {\n throw new Error('Widget is already attached.');\n }\n if (!host.isConnected) {\n throw new Error('Host is not attached.');\n }\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n host.insertBefore(widget.node, ref);\n MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n\n /**\n * Detach the widget from its host DOM node.\n *\n * @param widget - The widget of interest.\n *\n * #### Notes\n * This will throw an error if the widget is not a root widget,\n * or if the widget is not attached to the DOM.\n */\n export function detach(widget: Widget): void {\n if (widget.parent) {\n throw new Error('Cannot detach a child widget.');\n }\n if (!widget.isAttached || !widget.node.isConnected) {\n throw new Error('Widget is not attached.');\n }\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n widget.node.parentNode!.removeChild(widget.node);\n MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * An attached property for the widget title object.\n */\n export const titleProperty = new AttachedProperty>({\n name: 'title',\n create: owner => new Title({ owner })\n });\n\n /**\n * Create a DOM node for the given widget options.\n */\n export function createNode(options: Widget.IOptions): HTMLElement {\n return options.node || document.createElement(options.tag || 'div');\n }\n}\n","/* eslint-disable @typescript-eslint/no-empty-function */\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { IDisposable } from '@lumino/disposable';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { AttachedProperty } from '@lumino/properties';\n\nimport { Signal } from '@lumino/signaling';\n\nimport { Widget } from './widget';\n\n/**\n * An abstract base class for creating lumino layouts.\n *\n * #### Notes\n * A layout is used to add widgets to a parent and to arrange those\n * widgets within the parent's DOM node.\n *\n * This class implements the base functionality which is required of\n * nearly all layouts. It must be subclassed in order to be useful.\n *\n * Notably, this class does not define a uniform interface for adding\n * widgets to the layout. A subclass should define that API in a way\n * which is meaningful for its intended use.\n */\nexport abstract class Layout implements Iterable, IDisposable {\n /**\n * Construct a new layout.\n *\n * @param options - The options for initializing the layout.\n */\n constructor(options: Layout.IOptions = {}) {\n this._fitPolicy = options.fitPolicy || 'set-min-size';\n }\n\n /**\n * Dispose of the resources held by the layout.\n *\n * #### Notes\n * This should be reimplemented to clear and dispose of the widgets.\n *\n * All reimplementations should call the superclass method.\n *\n * This method is called automatically when the parent is disposed.\n */\n dispose(): void {\n this._parent = null;\n this._disposed = true;\n Signal.clearData(this);\n AttachedProperty.clearData(this);\n }\n\n /**\n * Test whether the layout is disposed.\n */\n get isDisposed(): boolean {\n return this._disposed;\n }\n\n /**\n * Get the parent widget of the layout.\n */\n get parent(): Widget | null {\n return this._parent;\n }\n\n /**\n * Set the parent widget of the layout.\n *\n * #### Notes\n * This is set automatically when installing the layout on the parent\n * widget. The parent widget should not be set directly by user code.\n */\n set parent(value: Widget | null) {\n if (this._parent === value) {\n return;\n }\n if (this._parent) {\n throw new Error('Cannot change parent widget.');\n }\n if (value!.layout !== this) {\n throw new Error('Invalid parent widget.');\n }\n this._parent = value;\n this.init();\n }\n\n /**\n * Get the fit policy for the layout.\n *\n * #### Notes\n * The fit policy controls the computed size constraints which are\n * applied to the parent widget by the layout.\n *\n * Some layout implementations may ignore the fit policy.\n */\n get fitPolicy(): Layout.FitPolicy {\n return this._fitPolicy;\n }\n\n /**\n * Set the fit policy for the layout.\n *\n * #### Notes\n * The fit policy controls the computed size constraints which are\n * applied to the parent widget by the layout.\n *\n * Some layout implementations may ignore the fit policy.\n *\n * Changing the fit policy will clear the current size constraint\n * for the parent widget and then re-fit the parent.\n */\n set fitPolicy(value: Layout.FitPolicy) {\n // Bail if the policy does not change\n if (this._fitPolicy === value) {\n return;\n }\n\n // Update the internal policy.\n this._fitPolicy = value;\n\n // Clear the size constraints and schedule a fit of the parent.\n if (this._parent) {\n let style = this._parent.node.style;\n style.minWidth = '';\n style.minHeight = '';\n style.maxWidth = '';\n style.maxHeight = '';\n this._parent.fit();\n }\n }\n\n /**\n * Create an iterator over the widgets in the layout.\n *\n * @returns A new iterator over the widgets in the layout.\n *\n * #### Notes\n * This abstract method must be implemented by a subclass.\n */\n abstract [Symbol.iterator](): IterableIterator;\n\n /**\n * Remove a widget from the layout.\n *\n * @param widget - The widget to remove from the layout.\n *\n * #### Notes\n * A widget is automatically removed from the layout when its `parent`\n * is set to `null`. This method should only be invoked directly when\n * removing a widget from a layout which has yet to be installed on a\n * parent widget.\n *\n * This method should *not* modify the widget's `parent`.\n */\n abstract removeWidget(widget: Widget): void;\n\n /**\n * Process a message sent to the parent widget.\n *\n * @param msg - The message sent to the parent widget.\n *\n * #### Notes\n * This method is called by the parent widget to process a message.\n *\n * Subclasses may reimplement this method as needed.\n */\n processParentMessage(msg: Message): void {\n switch (msg.type) {\n case 'resize':\n this.onResize(msg as Widget.ResizeMessage);\n break;\n case 'update-request':\n this.onUpdateRequest(msg);\n break;\n case 'fit-request':\n this.onFitRequest(msg);\n break;\n case 'before-show':\n this.onBeforeShow(msg);\n break;\n case 'after-show':\n this.onAfterShow(msg);\n break;\n case 'before-hide':\n this.onBeforeHide(msg);\n break;\n case 'after-hide':\n this.onAfterHide(msg);\n break;\n case 'before-attach':\n this.onBeforeAttach(msg);\n break;\n case 'after-attach':\n this.onAfterAttach(msg);\n break;\n case 'before-detach':\n this.onBeforeDetach(msg);\n break;\n case 'after-detach':\n this.onAfterDetach(msg);\n break;\n case 'child-removed':\n this.onChildRemoved(msg as Widget.ChildMessage);\n break;\n case 'child-shown':\n this.onChildShown(msg as Widget.ChildMessage);\n break;\n case 'child-hidden':\n this.onChildHidden(msg as Widget.ChildMessage);\n break;\n }\n }\n\n /**\n * Perform layout initialization which requires the parent widget.\n *\n * #### Notes\n * This method is invoked immediately after the layout is installed\n * on the parent widget.\n *\n * The default implementation reparents all of the widgets to the\n * layout parent widget.\n *\n * Subclasses should reimplement this method and attach the child\n * widget nodes to the parent widget's node.\n */\n protected init(): void {\n for (const widget of this) {\n widget.parent = this.parent;\n }\n }\n\n /**\n * A message handler invoked on a `'resize'` message.\n *\n * #### Notes\n * The layout should ensure that its widgets are resized according\n * to the specified layout space, and that they are sent a `'resize'`\n * message if appropriate.\n *\n * The default implementation of this method sends an `UnknownSize`\n * resize message to all widgets.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onResize(msg: Widget.ResizeMessage): void {\n for (const widget of this) {\n MessageLoop.sendMessage(widget, Widget.ResizeMessage.UnknownSize);\n }\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n *\n * #### Notes\n * The layout should ensure that its widgets are resized according\n * to the available layout space, and that they are sent a `'resize'`\n * message if appropriate.\n *\n * The default implementation of this method sends an `UnknownSize`\n * resize message to all widgets.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onUpdateRequest(msg: Message): void {\n for (const widget of this) {\n MessageLoop.sendMessage(widget, Widget.ResizeMessage.UnknownSize);\n }\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n *\n * #### Notes\n * The default implementation of this method forwards the message\n * to all widgets. It assumes all widget nodes are attached to the\n * parent widget node.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onBeforeAttach(msg: Message): void {\n for (const widget of this) {\n MessageLoop.sendMessage(widget, msg);\n }\n }\n\n /**\n * A message handler invoked on an `'after-attach'` message.\n *\n * #### Notes\n * The default implementation of this method forwards the message\n * to all widgets. It assumes all widget nodes are attached to the\n * parent widget node.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onAfterAttach(msg: Message): void {\n for (const widget of this) {\n MessageLoop.sendMessage(widget, msg);\n }\n }\n\n /**\n * A message handler invoked on a `'before-detach'` message.\n *\n * #### Notes\n * The default implementation of this method forwards the message\n * to all widgets. It assumes all widget nodes are attached to the\n * parent widget node.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onBeforeDetach(msg: Message): void {\n for (const widget of this) {\n MessageLoop.sendMessage(widget, msg);\n }\n }\n\n /**\n * A message handler invoked on an `'after-detach'` message.\n *\n * #### Notes\n * The default implementation of this method forwards the message\n * to all widgets. It assumes all widget nodes are attached to the\n * parent widget node.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onAfterDetach(msg: Message): void {\n for (const widget of this) {\n MessageLoop.sendMessage(widget, msg);\n }\n }\n\n /**\n * A message handler invoked on a `'before-show'` message.\n *\n * #### Notes\n * The default implementation of this method forwards the message to\n * all non-hidden widgets. It assumes all widget nodes are attached\n * to the parent widget node.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onBeforeShow(msg: Message): void {\n for (const widget of this) {\n if (!widget.isHidden) {\n MessageLoop.sendMessage(widget, msg);\n }\n }\n }\n\n /**\n * A message handler invoked on an `'after-show'` message.\n *\n * #### Notes\n * The default implementation of this method forwards the message to\n * all non-hidden widgets. It assumes all widget nodes are attached\n * to the parent widget node.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onAfterShow(msg: Message): void {\n for (const widget of this) {\n if (!widget.isHidden) {\n MessageLoop.sendMessage(widget, msg);\n }\n }\n }\n\n /**\n * A message handler invoked on a `'before-hide'` message.\n *\n * #### Notes\n * The default implementation of this method forwards the message to\n * all non-hidden widgets. It assumes all widget nodes are attached\n * to the parent widget node.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onBeforeHide(msg: Message): void {\n for (const widget of this) {\n if (!widget.isHidden) {\n MessageLoop.sendMessage(widget, msg);\n }\n }\n }\n\n /**\n * A message handler invoked on an `'after-hide'` message.\n *\n * #### Notes\n * The default implementation of this method forwards the message to\n * all non-hidden widgets. It assumes all widget nodes are attached\n * to the parent widget node.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onAfterHide(msg: Message): void {\n for (const widget of this) {\n if (!widget.isHidden) {\n MessageLoop.sendMessage(widget, msg);\n }\n }\n }\n\n /**\n * A message handler invoked on a `'child-removed'` message.\n *\n * #### Notes\n * This will remove the child widget from the layout.\n *\n * Subclasses should **not** typically reimplement this method.\n */\n protected onChildRemoved(msg: Widget.ChildMessage): void {\n this.removeWidget(msg.child);\n }\n\n /**\n * A message handler invoked on a `'fit-request'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onFitRequest(msg: Message): void {}\n\n /**\n * A message handler invoked on a `'child-shown'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onChildShown(msg: Widget.ChildMessage): void {}\n\n /**\n * A message handler invoked on a `'child-hidden'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onChildHidden(msg: Widget.ChildMessage): void {}\n\n private _disposed = false;\n private _fitPolicy: Layout.FitPolicy;\n private _parent: Widget | null = null;\n}\n\n/**\n * The namespace for the `Layout` class statics.\n */\nexport namespace Layout {\n /**\n * A type alias for the layout fit policy.\n *\n * #### Notes\n * The fit policy controls the computed size constraints which are\n * applied to the parent widget by the layout.\n *\n * Some layout implementations may ignore the fit policy.\n */\n export type FitPolicy =\n | /**\n * No size constraint will be applied to the parent widget.\n */\n 'set-no-constraint'\n\n /**\n * The computed min size will be applied to the parent widget.\n */\n | 'set-min-size';\n\n /**\n * An options object for initializing a layout.\n */\n export interface IOptions {\n /**\n * The fit policy for the layout.\n *\n * The default is `'set-min-size'`.\n */\n fitPolicy?: FitPolicy;\n }\n\n /**\n * A type alias for the horizontal alignment of a widget.\n */\n export type HorizontalAlignment = 'left' | 'center' | 'right';\n\n /**\n * A type alias for the vertical alignment of a widget.\n */\n export type VerticalAlignment = 'top' | 'center' | 'bottom';\n\n /**\n * Get the horizontal alignment for a widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The horizontal alignment for the widget.\n *\n * #### Notes\n * If the layout width allocated to a widget is larger than its max\n * width, the horizontal alignment controls how the widget is placed\n * within the extra horizontal space.\n *\n * If the allocated width is less than the widget's max width, the\n * horizontal alignment has no effect.\n *\n * Some layout implementations may ignore horizontal alignment.\n */\n export function getHorizontalAlignment(widget: Widget): HorizontalAlignment {\n return Private.horizontalAlignmentProperty.get(widget);\n }\n\n /**\n * Set the horizontal alignment for a widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the horizontal alignment.\n *\n * #### Notes\n * If the layout width allocated to a widget is larger than its max\n * width, the horizontal alignment controls how the widget is placed\n * within the extra horizontal space.\n *\n * If the allocated width is less than the widget's max width, the\n * horizontal alignment has no effect.\n *\n * Some layout implementations may ignore horizontal alignment.\n *\n * Changing the horizontal alignment will post an `update-request`\n * message to widget's parent, provided the parent has a layout\n * installed.\n */\n export function setHorizontalAlignment(\n widget: Widget,\n value: HorizontalAlignment\n ): void {\n Private.horizontalAlignmentProperty.set(widget, value);\n }\n\n /**\n * Get the vertical alignment for a widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The vertical alignment for the widget.\n *\n * #### Notes\n * If the layout height allocated to a widget is larger than its max\n * height, the vertical alignment controls how the widget is placed\n * within the extra vertical space.\n *\n * If the allocated height is less than the widget's max height, the\n * vertical alignment has no effect.\n *\n * Some layout implementations may ignore vertical alignment.\n */\n export function getVerticalAlignment(widget: Widget): VerticalAlignment {\n return Private.verticalAlignmentProperty.get(widget);\n }\n\n /**\n * Set the vertical alignment for a widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the vertical alignment.\n *\n * #### Notes\n * If the layout height allocated to a widget is larger than its max\n * height, the vertical alignment controls how the widget is placed\n * within the extra vertical space.\n *\n * If the allocated height is less than the widget's max height, the\n * vertical alignment has no effect.\n *\n * Some layout implementations may ignore vertical alignment.\n *\n * Changing the horizontal alignment will post an `update-request`\n * message to widget's parent, provided the parent has a layout\n * installed.\n */\n export function setVerticalAlignment(\n widget: Widget,\n value: VerticalAlignment\n ): void {\n Private.verticalAlignmentProperty.set(widget, value);\n }\n}\n\n/**\n * An object which assists in the absolute layout of widgets.\n *\n * #### Notes\n * This class is useful when implementing a layout which arranges its\n * widgets using absolute positioning.\n *\n * This class is used by nearly all of the built-in lumino layouts.\n */\nexport class LayoutItem implements IDisposable {\n /**\n * Construct a new layout item.\n *\n * @param widget - The widget to be managed by the item.\n *\n * #### Notes\n * The widget will be set to absolute positioning.\n * The widget will use strict CSS containment.\n */\n constructor(widget: Widget) {\n this.widget = widget;\n this.widget.node.style.position = 'absolute';\n this.widget.node.style.contain = 'strict';\n }\n\n /**\n * Dispose of the the layout item.\n *\n * #### Notes\n * This will reset the positioning of the widget.\n */\n dispose(): void {\n // Do nothing if the item is already disposed.\n if (this._disposed) {\n return;\n }\n\n // Mark the item as disposed.\n this._disposed = true;\n\n // Reset the widget style.\n let style = this.widget.node.style;\n style.position = '';\n style.top = '';\n style.left = '';\n style.width = '';\n style.height = '';\n style.contain = '';\n }\n\n /**\n * The widget managed by the layout item.\n */\n readonly widget: Widget;\n\n /**\n * The computed minimum width of the widget.\n *\n * #### Notes\n * This value can be updated by calling the `fit` method.\n */\n get minWidth(): number {\n return this._minWidth;\n }\n\n /**\n * The computed minimum height of the widget.\n *\n * #### Notes\n * This value can be updated by calling the `fit` method.\n */\n get minHeight(): number {\n return this._minHeight;\n }\n\n /**\n * The computed maximum width of the widget.\n *\n * #### Notes\n * This value can be updated by calling the `fit` method.\n */\n get maxWidth(): number {\n return this._maxWidth;\n }\n\n /**\n * The computed maximum height of the widget.\n *\n * #### Notes\n * This value can be updated by calling the `fit` method.\n */\n get maxHeight(): number {\n return this._maxHeight;\n }\n\n /**\n * Whether the layout item is disposed.\n */\n get isDisposed(): boolean {\n return this._disposed;\n }\n\n /**\n * Whether the managed widget is hidden.\n */\n get isHidden(): boolean {\n return this.widget.isHidden;\n }\n\n /**\n * Whether the managed widget is visible.\n */\n get isVisible(): boolean {\n return this.widget.isVisible;\n }\n\n /**\n * Whether the managed widget is attached.\n */\n get isAttached(): boolean {\n return this.widget.isAttached;\n }\n\n /**\n * Update the computed size limits of the managed widget.\n */\n fit(): void {\n let limits = ElementExt.sizeLimits(this.widget.node);\n this._minWidth = limits.minWidth;\n this._minHeight = limits.minHeight;\n this._maxWidth = limits.maxWidth;\n this._maxHeight = limits.maxHeight;\n }\n\n /**\n * Update the position and size of the managed widget.\n *\n * @param left - The left edge position of the layout box.\n *\n * @param top - The top edge position of the layout box.\n *\n * @param width - The width of the layout box.\n *\n * @param height - The height of the layout box.\n */\n update(left: number, top: number, width: number, height: number): void {\n // Clamp the size to the computed size limits.\n let clampW = Math.max(this._minWidth, Math.min(width, this._maxWidth));\n let clampH = Math.max(this._minHeight, Math.min(height, this._maxHeight));\n\n // Adjust the left edge for the horizontal alignment, if needed.\n if (clampW < width) {\n switch (Layout.getHorizontalAlignment(this.widget)) {\n case 'left':\n break;\n case 'center':\n left += (width - clampW) / 2;\n break;\n case 'right':\n left += width - clampW;\n break;\n default:\n throw 'unreachable';\n }\n }\n\n // Adjust the top edge for the vertical alignment, if needed.\n if (clampH < height) {\n switch (Layout.getVerticalAlignment(this.widget)) {\n case 'top':\n break;\n case 'center':\n top += (height - clampH) / 2;\n break;\n case 'bottom':\n top += height - clampH;\n break;\n default:\n throw 'unreachable';\n }\n }\n\n // Set up the resize variables.\n let resized = false;\n let style = this.widget.node.style;\n\n // Update the top edge of the widget if needed.\n if (this._top !== top) {\n this._top = top;\n style.top = `${top}px`;\n }\n\n // Update the left edge of the widget if needed.\n if (this._left !== left) {\n this._left = left;\n style.left = `${left}px`;\n }\n\n // Update the width of the widget if needed.\n if (this._width !== clampW) {\n resized = true;\n this._width = clampW;\n style.width = `${clampW}px`;\n }\n\n // Update the height of the widget if needed.\n if (this._height !== clampH) {\n resized = true;\n this._height = clampH;\n style.height = `${clampH}px`;\n }\n\n // Send a resize message to the widget if needed.\n if (resized) {\n let msg = new Widget.ResizeMessage(clampW, clampH);\n MessageLoop.sendMessage(this.widget, msg);\n }\n }\n\n private _top = NaN;\n private _left = NaN;\n private _width = NaN;\n private _height = NaN;\n private _minWidth = 0;\n private _minHeight = 0;\n private _maxWidth = Infinity;\n private _maxHeight = Infinity;\n private _disposed = false;\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * The attached property for a widget horizontal alignment.\n */\n export const horizontalAlignmentProperty = new AttachedProperty<\n Widget,\n Layout.HorizontalAlignment\n >({\n name: 'horizontalAlignment',\n create: () => 'center',\n changed: onAlignmentChanged\n });\n\n /**\n * The attached property for a widget vertical alignment.\n */\n export const verticalAlignmentProperty = new AttachedProperty<\n Widget,\n Layout.VerticalAlignment\n >({\n name: 'verticalAlignment',\n create: () => 'top',\n changed: onAlignmentChanged\n });\n\n /**\n * The change handler for the attached alignment properties.\n */\n function onAlignmentChanged(child: Widget): void {\n if (child.parent && child.parent.layout) {\n child.parent.update();\n }\n }\n}\n","/*\n * Copyright (c) Jupyter Development Team.\n * Distributed under the terms of the Modified BSD License.\n */\n\nexport namespace Utils {\n /**\n * Clamp a dimension value to an integer >= 0.\n */\n export function clampDimension(value: number): number {\n return Math.max(0, Math.floor(value));\n }\n}\n\nexport default Utils;\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { IDisposable } from '@lumino/disposable';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { VirtualElement } from '@lumino/virtualdom';\n\n/**\n * An object which holds data related to an object's title.\n *\n * #### Notes\n * A title object is intended to hold the data necessary to display a\n * header for a particular object. A common example is the `TabPanel`,\n * which uses the widget title to populate the tab for a child widget.\n *\n * It is the responsibility of the owner to call the title disposal.\n */\nexport class Title implements IDisposable {\n /**\n * Construct a new title.\n *\n * @param options - The options for initializing the title.\n */\n constructor(options: Title.IOptions) {\n this.owner = options.owner;\n if (options.label !== undefined) {\n this._label = options.label;\n }\n if (options.mnemonic !== undefined) {\n this._mnemonic = options.mnemonic;\n }\n if (options.icon !== undefined) {\n this._icon = options.icon;\n }\n\n if (options.iconClass !== undefined) {\n this._iconClass = options.iconClass;\n }\n if (options.iconLabel !== undefined) {\n this._iconLabel = options.iconLabel;\n }\n if (options.caption !== undefined) {\n this._caption = options.caption;\n }\n if (options.className !== undefined) {\n this._className = options.className;\n }\n if (options.closable !== undefined) {\n this._closable = options.closable;\n }\n this._dataset = options.dataset || {};\n }\n\n /**\n * A signal emitted when the state of the title changes.\n */\n get changed(): ISignal {\n return this._changed;\n }\n\n /**\n * The object which owns the title.\n */\n readonly owner: T;\n\n /**\n * Get the label for the title.\n *\n * #### Notes\n * The default value is an empty string.\n */\n get label(): string {\n return this._label;\n }\n\n /**\n * Set the label for the title.\n */\n set label(value: string) {\n if (this._label === value) {\n return;\n }\n this._label = value;\n this._changed.emit(undefined);\n }\n\n /**\n * Get the mnemonic index for the title.\n *\n * #### Notes\n * The default value is `-1`.\n */\n get mnemonic(): number {\n return this._mnemonic;\n }\n\n /**\n * Set the mnemonic index for the title.\n */\n set mnemonic(value: number) {\n if (this._mnemonic === value) {\n return;\n }\n this._mnemonic = value;\n this._changed.emit(undefined);\n }\n\n /**\n * Get the icon renderer for the title.\n *\n * #### Notes\n * The default value is undefined.\n */\n get icon(): VirtualElement.IRenderer | undefined {\n return this._icon;\n }\n\n /**\n * Set the icon renderer for the title.\n *\n * #### Notes\n * A renderer is an object that supplies a render and unrender function.\n */\n set icon(value: VirtualElement.IRenderer | undefined) {\n if (this._icon === value) {\n return;\n }\n this._icon = value;\n this._changed.emit(undefined);\n }\n\n /**\n * Get the icon class name for the title.\n *\n * #### Notes\n * The default value is an empty string.\n */\n get iconClass(): string {\n return this._iconClass;\n }\n\n /**\n * Set the icon class name for the title.\n *\n * #### Notes\n * Multiple class names can be separated with whitespace.\n */\n set iconClass(value: string) {\n if (this._iconClass === value) {\n return;\n }\n this._iconClass = value;\n this._changed.emit(undefined);\n }\n\n /**\n * Get the icon label for the title.\n *\n * #### Notes\n * The default value is an empty string.\n */\n get iconLabel(): string {\n return this._iconLabel;\n }\n\n /**\n * Set the icon label for the title.\n *\n * #### Notes\n * Multiple class names can be separated with whitespace.\n */\n set iconLabel(value: string) {\n if (this._iconLabel === value) {\n return;\n }\n this._iconLabel = value;\n this._changed.emit(undefined);\n }\n\n /**\n * Get the caption for the title.\n *\n * #### Notes\n * The default value is an empty string.\n */\n get caption(): string {\n return this._caption;\n }\n\n /**\n * Set the caption for the title.\n */\n set caption(value: string) {\n if (this._caption === value) {\n return;\n }\n this._caption = value;\n this._changed.emit(undefined);\n }\n\n /**\n * Get the extra class name for the title.\n *\n * #### Notes\n * The default value is an empty string.\n */\n get className(): string {\n return this._className;\n }\n\n /**\n * Set the extra class name for the title.\n *\n * #### Notes\n * Multiple class names can be separated with whitespace.\n */\n set className(value: string) {\n if (this._className === value) {\n return;\n }\n this._className = value;\n this._changed.emit(undefined);\n }\n\n /**\n * Get the closable state for the title.\n *\n * #### Notes\n * The default value is `false`.\n */\n get closable(): boolean {\n return this._closable;\n }\n\n /**\n * Set the closable state for the title.\n *\n * #### Notes\n * This controls the presence of a close icon when applicable.\n */\n set closable(value: boolean) {\n if (this._closable === value) {\n return;\n }\n this._closable = value;\n this._changed.emit(undefined);\n }\n\n /**\n * Get the dataset for the title.\n *\n * #### Notes\n * The default value is an empty dataset.\n */\n get dataset(): Title.Dataset {\n return this._dataset;\n }\n\n /**\n * Set the dataset for the title.\n *\n * #### Notes\n * This controls the data attributes when applicable.\n */\n set dataset(value: Title.Dataset) {\n if (this._dataset === value) {\n return;\n }\n this._dataset = value;\n this._changed.emit(undefined);\n }\n\n /**\n * Test whether the title has been disposed.\n */\n get isDisposed(): boolean {\n return this._isDisposed;\n }\n\n /**\n * Dispose of the resources held by the title.\n *\n * #### Notes\n * It is the responsibility of the owner to call the title disposal.\n */\n dispose(): void {\n if (this.isDisposed) {\n return;\n }\n this._isDisposed = true;\n\n Signal.clearData(this);\n }\n\n private _label = '';\n private _caption = '';\n private _mnemonic = -1;\n private _icon: VirtualElement.IRenderer | undefined = undefined;\n private _iconClass = '';\n private _iconLabel = '';\n private _className = '';\n private _closable = false;\n private _dataset: Title.Dataset;\n private _changed = new Signal(this);\n private _isDisposed = false;\n}\n\n/**\n * The namespace for the `Title` class statics.\n */\nexport namespace Title {\n /**\n * A type alias for a simple immutable string dataset.\n */\n export type Dataset = { readonly [key: string]: string };\n\n /**\n * An options object for initializing a title.\n */\n export interface IOptions {\n /**\n * The object which owns the title.\n */\n owner: T;\n\n /**\n * The label for the title.\n */\n label?: string;\n\n /**\n * The mnemonic index for the title.\n */\n mnemonic?: number;\n\n /**\n * The icon renderer for the title.\n */\n icon?: VirtualElement.IRenderer;\n\n /**\n * The icon class name for the title.\n */\n iconClass?: string;\n\n /**\n * The icon label for the title.\n */\n iconLabel?: string;\n\n /**\n * The caption for the title.\n */\n caption?: string;\n\n /**\n * The extra class name for the title.\n */\n className?: string;\n\n /**\n * The closable state for the title.\n */\n closable?: boolean;\n\n /**\n * The dataset for the title.\n */\n dataset?: Dataset;\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { MessageLoop } from '@lumino/messaging';\n\nimport { Layout } from './layout';\n\nimport { Widget } from './widget';\n\n/**\n * A concrete layout implementation suitable for many use cases.\n *\n * #### Notes\n * This class is suitable as a base class for implementing a variety of\n * layouts, but can also be used directly with standard CSS to layout a\n * collection of widgets.\n */\nexport class PanelLayout extends Layout {\n /**\n * Dispose of the resources held by the layout.\n *\n * #### Notes\n * This will clear and dispose all widgets in the layout.\n *\n * All reimplementations should call the superclass method.\n *\n * This method is called automatically when the parent is disposed.\n */\n dispose(): void {\n while (this._widgets.length > 0) {\n this._widgets.pop()!.dispose();\n }\n super.dispose();\n }\n\n /**\n * A read-only array of the widgets in the layout.\n */\n get widgets(): ReadonlyArray {\n return this._widgets;\n }\n\n /**\n * Create an iterator over the widgets in the layout.\n *\n * @returns A new iterator over the widgets in the layout.\n */\n *[Symbol.iterator](): IterableIterator {\n yield* this._widgets;\n }\n\n /**\n * Add a widget to the end of the layout.\n *\n * @param widget - The widget to add to the layout.\n *\n * #### Notes\n * If the widget is already contained in the layout, it will be moved.\n */\n addWidget(widget: Widget): void {\n this.insertWidget(this._widgets.length, widget);\n }\n\n /**\n * Insert a widget into the layout at the specified index.\n *\n * @param index - The index at which to insert the widget.\n *\n * @param widget - The widget to insert into the layout.\n *\n * #### Notes\n * The index will be clamped to the bounds of the widgets.\n *\n * If the widget is already added to the layout, it will be moved.\n *\n * #### Undefined Behavior\n * An `index` which is non-integral.\n */\n insertWidget(index: number, widget: Widget): void {\n // Remove the widget from its current parent. This is a no-op\n // if the widget's parent is already the layout parent widget.\n widget.parent = this.parent;\n\n // Look up the current index of the widget.\n let i = this._widgets.indexOf(widget);\n\n // Clamp the insert index to the array bounds.\n let j = Math.max(0, Math.min(index, this._widgets.length));\n\n // If the widget is not in the array, insert it.\n if (i === -1) {\n // Insert the widget into the array.\n ArrayExt.insert(this._widgets, j, widget);\n\n // If the layout is parented, attach the widget to the DOM.\n if (this.parent) {\n this.attachWidget(j, widget);\n }\n\n // There is nothing more to do.\n return;\n }\n\n // Otherwise, the widget exists in the array and should be moved.\n\n // Adjust the index if the location is at the end of the array.\n if (j === this._widgets.length) {\n j--;\n }\n\n // Bail if there is no effective move.\n if (i === j) {\n return;\n }\n\n // Move the widget to the new location.\n ArrayExt.move(this._widgets, i, j);\n\n // If the layout is parented, move the widget in the DOM.\n if (this.parent) {\n this.moveWidget(i, j, widget);\n }\n }\n\n /**\n * Remove a widget from the layout.\n *\n * @param widget - The widget to remove from the layout.\n *\n * #### Notes\n * A widget is automatically removed from the layout when its `parent`\n * is set to `null`. This method should only be invoked directly when\n * removing a widget from a layout which has yet to be installed on a\n * parent widget.\n *\n * This method does *not* modify the widget's `parent`.\n */\n removeWidget(widget: Widget): void {\n this.removeWidgetAt(this._widgets.indexOf(widget));\n }\n\n /**\n * Remove the widget at a given index from the layout.\n *\n * @param index - The index of the widget to remove.\n *\n * #### Notes\n * A widget is automatically removed from the layout when its `parent`\n * is set to `null`. This method should only be invoked directly when\n * removing a widget from a layout which has yet to be installed on a\n * parent widget.\n *\n * This method does *not* modify the widget's `parent`.\n *\n * #### Undefined Behavior\n * An `index` which is non-integral.\n */\n removeWidgetAt(index: number): void {\n // Remove the widget from the array.\n let widget = ArrayExt.removeAt(this._widgets, index);\n\n // If the layout is parented, detach the widget from the DOM.\n if (widget && this.parent) {\n this.detachWidget(index, widget);\n }\n }\n\n /**\n * Perform layout initialization which requires the parent widget.\n */\n protected init(): void {\n super.init();\n let index = 0;\n for (const widget of this) {\n this.attachWidget(index++, widget);\n }\n }\n\n /**\n * Attach a widget to the parent's DOM node.\n *\n * @param index - The current index of the widget in the layout.\n *\n * @param widget - The widget to attach to the parent.\n *\n * #### Notes\n * This method is called automatically by the panel layout at the\n * appropriate time. It should not be called directly by user code.\n *\n * The default implementation adds the widgets's node to the parent's\n * node at the proper location, and sends the appropriate attach\n * messages to the widget if the parent is attached to the DOM.\n *\n * Subclasses may reimplement this method to control how the widget's\n * node is added to the parent's node.\n */\n protected attachWidget(index: number, widget: Widget): void {\n // Look up the next sibling reference node.\n let ref = this.parent!.node.children[index];\n\n // Send a `'before-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n }\n\n // Insert the widget's node before the sibling.\n this.parent!.node.insertBefore(widget.node, ref);\n\n // Send an `'after-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n }\n\n /**\n * Move a widget in the parent's DOM node.\n *\n * @param fromIndex - The previous index of the widget in the layout.\n *\n * @param toIndex - The current index of the widget in the layout.\n *\n * @param widget - The widget to move in the parent.\n *\n * #### Notes\n * This method is called automatically by the panel layout at the\n * appropriate time. It should not be called directly by user code.\n *\n * The default implementation moves the widget's node to the proper\n * location in the parent's node and sends the appropriate attach and\n * detach messages to the widget if the parent is attached to the DOM.\n *\n * Subclasses may reimplement this method to control how the widget's\n * node is moved in the parent's node.\n */\n protected moveWidget(\n fromIndex: number,\n toIndex: number,\n widget: Widget\n ): void {\n // Send a `'before-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n }\n\n // Remove the widget's node from the parent.\n this.parent!.node.removeChild(widget.node);\n\n // Send an `'after-detach'` and message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n\n // Look up the next sibling reference node.\n let ref = this.parent!.node.children[toIndex];\n\n // Send a `'before-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n }\n\n // Insert the widget's node before the sibling.\n this.parent!.node.insertBefore(widget.node, ref);\n\n // Send an `'after-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n }\n\n /**\n * Detach a widget from the parent's DOM node.\n *\n * @param index - The previous index of the widget in the layout.\n *\n * @param widget - The widget to detach from the parent.\n *\n * #### Notes\n * This method is called automatically by the panel layout at the\n * appropriate time. It should not be called directly by user code.\n *\n * The default implementation removes the widget's node from the\n * parent's node, and sends the appropriate detach messages to the\n * widget if the parent is attached to the DOM.\n *\n * Subclasses may reimplement this method to control how the widget's\n * node is removed from the parent's node.\n */\n protected detachWidget(index: number, widget: Widget): void {\n // Send a `'before-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n }\n\n // Remove the widget's node from the parent.\n this.parent!.node.removeChild(widget.node);\n\n // Send an `'after-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n }\n\n private _widgets: Widget[] = [];\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { AttachedProperty } from '@lumino/properties';\n\nimport { BoxEngine, BoxSizer } from './boxengine';\n\nimport { LayoutItem } from './layout';\n\nimport { PanelLayout } from './panellayout';\n\nimport { Utils } from './utils';\n\nimport { Widget } from './widget';\n\n/**\n * A layout which arranges its widgets into resizable sections.\n */\nexport class SplitLayout extends PanelLayout {\n /**\n * Construct a new split layout.\n *\n * @param options - The options for initializing the layout.\n */\n constructor(options: SplitLayout.IOptions) {\n super();\n this.renderer = options.renderer;\n if (options.orientation !== undefined) {\n this._orientation = options.orientation;\n }\n if (options.alignment !== undefined) {\n this._alignment = options.alignment;\n }\n if (options.spacing !== undefined) {\n this._spacing = Utils.clampDimension(options.spacing);\n }\n }\n\n /**\n * Dispose of the resources held by the layout.\n */\n dispose(): void {\n // Dispose of the layout items.\n for (const item of this._items) {\n item.dispose();\n }\n\n // Clear the layout state.\n this._box = null;\n this._items.length = 0;\n this._sizers.length = 0;\n this._handles.length = 0;\n\n // Dispose of the rest of the layout.\n super.dispose();\n }\n\n /**\n * The renderer used by the split layout.\n */\n readonly renderer: SplitLayout.IRenderer;\n\n /**\n * Get the layout orientation for the split layout.\n */\n get orientation(): SplitLayout.Orientation {\n return this._orientation;\n }\n\n /**\n * Set the layout orientation for the split layout.\n */\n set orientation(value: SplitLayout.Orientation) {\n if (this._orientation === value) {\n return;\n }\n this._orientation = value;\n if (!this.parent) {\n return;\n }\n this.parent.dataset['orientation'] = value;\n this.parent.fit();\n }\n\n /**\n * Get the content alignment for the split layout.\n *\n * #### Notes\n * This is the alignment of the widgets in the layout direction.\n *\n * The alignment has no effect if the widgets can expand to fill the\n * entire split layout.\n */\n get alignment(): SplitLayout.Alignment {\n return this._alignment;\n }\n\n /**\n * Set the content alignment for the split layout.\n *\n * #### Notes\n * This is the alignment of the widgets in the layout direction.\n *\n * The alignment has no effect if the widgets can expand to fill the\n * entire split layout.\n */\n set alignment(value: SplitLayout.Alignment) {\n if (this._alignment === value) {\n return;\n }\n this._alignment = value;\n if (!this.parent) {\n return;\n }\n this.parent.dataset['alignment'] = value;\n this.parent.update();\n }\n\n /**\n * Get the inter-element spacing for the split layout.\n */\n get spacing(): number {\n return this._spacing;\n }\n\n /**\n * Set the inter-element spacing for the split layout.\n */\n set spacing(value: number) {\n value = Utils.clampDimension(value);\n if (this._spacing === value) {\n return;\n }\n this._spacing = value;\n if (!this.parent) {\n return;\n }\n this.parent.fit();\n }\n\n /**\n * A read-only array of the split handles in the layout.\n */\n get handles(): ReadonlyArray {\n return this._handles;\n }\n\n /**\n * Get the absolute sizes of the widgets in the layout.\n *\n * @returns A new array of the absolute sizes of the widgets.\n *\n * This method **does not** measure the DOM nodes.\n */\n absoluteSizes(): number[] {\n return this._sizers.map(sizer => sizer.size);\n }\n\n /**\n * Get the relative sizes of the widgets in the layout.\n *\n * @returns A new array of the relative sizes of the widgets.\n *\n * #### Notes\n * The returned sizes reflect the sizes of the widgets normalized\n * relative to their siblings.\n *\n * This method **does not** measure the DOM nodes.\n */\n relativeSizes(): number[] {\n return Private.normalize(this._sizers.map(sizer => sizer.size));\n }\n\n /**\n * Set the relative sizes for the widgets in the layout.\n *\n * @param sizes - The relative sizes for the widgets in the panel.\n * @param update - Update the layout after setting relative sizes.\n * Default is True.\n *\n * #### Notes\n * Extra values are ignored, too few will yield an undefined layout.\n *\n * The actual geometry of the DOM nodes is updated asynchronously.\n */\n setRelativeSizes(sizes: number[], update = true): void {\n // Copy the sizes and pad with zeros as needed.\n let n = this._sizers.length;\n let temp = sizes.slice(0, n);\n while (temp.length < n) {\n temp.push(0);\n }\n\n // Normalize the padded sizes.\n let normed = Private.normalize(temp);\n\n // Apply the normalized sizes to the sizers.\n for (let i = 0; i < n; ++i) {\n let sizer = this._sizers[i];\n sizer.sizeHint = normed[i];\n sizer.size = normed[i];\n }\n\n // Set the flag indicating the sizes are normalized.\n this._hasNormedSizes = true;\n\n // Trigger an update of the parent widget.\n if (update && this.parent) {\n this.parent.update();\n }\n }\n\n /**\n * Move the offset position of a split handle.\n *\n * @param index - The index of the handle of the interest.\n *\n * @param position - The desired offset position of the handle.\n *\n * #### Notes\n * The position is relative to the offset parent.\n *\n * This will move the handle as close as possible to the desired\n * position. The sibling widgets will be adjusted as necessary.\n */\n moveHandle(index: number, position: number): void {\n // Bail if the index is invalid or the handle is hidden.\n let handle = this._handles[index];\n if (!handle || handle.classList.contains('lm-mod-hidden')) {\n return;\n }\n\n // Compute the desired delta movement for the handle.\n let delta: number;\n if (this._orientation === 'horizontal') {\n delta = position - handle.offsetLeft;\n } else {\n delta = position - handle.offsetTop;\n }\n\n // Bail if there is no handle movement.\n if (delta === 0) {\n return;\n }\n\n // Prevent widget resizing unless needed.\n for (let sizer of this._sizers) {\n if (sizer.size > 0) {\n sizer.sizeHint = sizer.size;\n }\n }\n\n // Adjust the sizers to reflect the handle movement.\n BoxEngine.adjust(this._sizers, index, delta);\n\n // Update the layout of the widgets.\n if (this.parent) {\n this.parent.update();\n }\n }\n\n /**\n * Perform layout initialization which requires the parent widget.\n */\n protected init(): void {\n this.parent!.dataset['orientation'] = this.orientation;\n this.parent!.dataset['alignment'] = this.alignment;\n super.init();\n }\n\n /**\n * Attach a widget to the parent's DOM node.\n *\n * @param index - The current index of the widget in the layout.\n *\n * @param widget - The widget to attach to the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected attachWidget(index: number, widget: Widget): void {\n // Create the item, handle, and sizer for the new widget.\n let item = new LayoutItem(widget);\n let handle = Private.createHandle(this.renderer);\n let average = Private.averageSize(this._sizers);\n let sizer = Private.createSizer(average);\n\n // Insert the item, handle, and sizer into the internal arrays.\n ArrayExt.insert(this._items, index, item);\n ArrayExt.insert(this._sizers, index, sizer);\n ArrayExt.insert(this._handles, index, handle);\n\n // Send a `'before-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n }\n\n // Add the widget and handle nodes to the parent.\n this.parent!.node.appendChild(widget.node);\n this.parent!.node.appendChild(handle);\n\n // Send an `'after-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n\n // Post a fit request for the parent widget.\n this.parent!.fit();\n }\n\n /**\n * Move a widget in the parent's DOM node.\n *\n * @param fromIndex - The previous index of the widget in the layout.\n *\n * @param toIndex - The current index of the widget in the layout.\n *\n * @param widget - The widget to move in the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected moveWidget(\n fromIndex: number,\n toIndex: number,\n widget: Widget\n ): void {\n // Move the item, sizer, and handle for the widget.\n ArrayExt.move(this._items, fromIndex, toIndex);\n ArrayExt.move(this._sizers, fromIndex, toIndex);\n ArrayExt.move(this._handles, fromIndex, toIndex);\n\n // Post a fit request to the parent to show/hide last handle.\n this.parent!.fit();\n }\n\n /**\n * Detach a widget from the parent's DOM node.\n *\n * @param index - The previous index of the widget in the layout.\n *\n * @param widget - The widget to detach from the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected detachWidget(index: number, widget: Widget): void {\n // Remove the item, handle, and sizer for the widget.\n let item = ArrayExt.removeAt(this._items, index);\n let handle = ArrayExt.removeAt(this._handles, index);\n ArrayExt.removeAt(this._sizers, index);\n\n // Send a `'before-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n }\n\n // Remove the widget and handle nodes from the parent.\n this.parent!.node.removeChild(widget.node);\n this.parent!.node.removeChild(handle!);\n\n // Send an `'after-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n\n // Dispose of the layout item.\n item!.dispose();\n\n // Post a fit request for the parent widget.\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'before-show'` message.\n */\n protected onBeforeShow(msg: Message): void {\n super.onBeforeShow(msg);\n this.parent!.update();\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n super.onBeforeAttach(msg);\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-shown'` message.\n */\n protected onChildShown(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-hidden'` message.\n */\n protected onChildHidden(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'resize'` message.\n */\n protected onResize(msg: Widget.ResizeMessage): void {\n if (this.parent!.isVisible) {\n this._update(msg.width, msg.height);\n }\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n protected onUpdateRequest(msg: Message): void {\n if (this.parent!.isVisible) {\n this._update(-1, -1);\n }\n }\n\n /**\n * A message handler invoked on a `'fit-request'` message.\n */\n protected onFitRequest(msg: Message): void {\n if (this.parent!.isAttached) {\n this._fit();\n }\n }\n\n /**\n * Update the item position.\n *\n * @param i Item index\n * @param isHorizontal Whether the layout is horizontal or not\n * @param left Left position in pixels\n * @param top Top position in pixels\n * @param height Item height\n * @param width Item width\n * @param size Item size\n */\n protected updateItemPosition(\n i: number,\n isHorizontal: boolean,\n left: number,\n top: number,\n height: number,\n width: number,\n size: number\n ): void {\n const item = this._items[i];\n if (item.isHidden) {\n return;\n }\n\n // Fetch the style for the handle.\n let handleStyle = this._handles[i].style;\n\n // Update the widget and handle, and advance the relevant edge.\n if (isHorizontal) {\n left += this.widgetOffset;\n item.update(left, top, size, height);\n left += size;\n handleStyle.top = `${top}px`;\n handleStyle.left = `${left}px`;\n handleStyle.width = `${this._spacing}px`;\n handleStyle.height = `${height}px`;\n } else {\n top += this.widgetOffset;\n item.update(left, top, width, size);\n top += size;\n handleStyle.top = `${top}px`;\n handleStyle.left = `${left}px`;\n handleStyle.width = `${width}px`;\n handleStyle.height = `${this._spacing}px`;\n }\n }\n\n /**\n * Fit the layout to the total size required by the widgets.\n */\n private _fit(): void {\n // Update the handles and track the visible widget count.\n let nVisible = 0;\n let lastHandleIndex = -1;\n for (let i = 0, n = this._items.length; i < n; ++i) {\n if (this._items[i].isHidden) {\n this._handles[i].classList.add('lm-mod-hidden');\n } else {\n this._handles[i].classList.remove('lm-mod-hidden');\n lastHandleIndex = i;\n nVisible++;\n }\n }\n\n // Hide the handle for the last visible widget.\n if (lastHandleIndex !== -1) {\n this._handles[lastHandleIndex].classList.add('lm-mod-hidden');\n }\n\n // Update the fixed space for the visible items.\n this._fixed =\n this._spacing * Math.max(0, nVisible - 1) +\n this.widgetOffset * this._items.length;\n\n // Setup the computed minimum size.\n let horz = this._orientation === 'horizontal';\n let minW = horz ? this._fixed : 0;\n let minH = horz ? 0 : this._fixed;\n\n // Update the sizers and computed size limits.\n for (let i = 0, n = this._items.length; i < n; ++i) {\n // Fetch the item and corresponding box sizer.\n let item = this._items[i];\n let sizer = this._sizers[i];\n\n // Prevent resizing unless necessary.\n if (sizer.size > 0) {\n sizer.sizeHint = sizer.size;\n }\n\n // If the item is hidden, it should consume zero size.\n if (item.isHidden) {\n sizer.minSize = 0;\n sizer.maxSize = 0;\n continue;\n }\n\n // Update the size limits for the item.\n item.fit();\n\n // Update the stretch factor.\n sizer.stretch = SplitLayout.getStretch(item.widget);\n\n // Update the sizer limits and computed min size.\n if (horz) {\n sizer.minSize = item.minWidth;\n sizer.maxSize = item.maxWidth;\n minW += item.minWidth;\n minH = Math.max(minH, item.minHeight);\n } else {\n sizer.minSize = item.minHeight;\n sizer.maxSize = item.maxHeight;\n minH += item.minHeight;\n minW = Math.max(minW, item.minWidth);\n }\n }\n\n // Update the box sizing and add it to the computed min size.\n let box = (this._box = ElementExt.boxSizing(this.parent!.node));\n minW += box.horizontalSum;\n minH += box.verticalSum;\n\n // Update the parent's min size constraints.\n let style = this.parent!.node.style;\n style.minWidth = `${minW}px`;\n style.minHeight = `${minH}px`;\n\n // Set the dirty flag to ensure only a single update occurs.\n this._dirty = true;\n\n // Notify the ancestor that it should fit immediately. This may\n // cause a resize of the parent, fulfilling the required update.\n if (this.parent!.parent) {\n MessageLoop.sendMessage(this.parent!.parent!, Widget.Msg.FitRequest);\n }\n\n // If the dirty flag is still set, the parent was not resized.\n // Trigger the required update on the parent widget immediately.\n if (this._dirty) {\n MessageLoop.sendMessage(this.parent!, Widget.Msg.UpdateRequest);\n }\n }\n\n /**\n * Update the layout position and size of the widgets.\n *\n * The parent offset dimensions should be `-1` if unknown.\n */\n private _update(offsetWidth: number, offsetHeight: number): void {\n // Clear the dirty flag to indicate the update occurred.\n this._dirty = false;\n\n // Compute the visible item count.\n let nVisible = 0;\n for (let i = 0, n = this._items.length; i < n; ++i) {\n nVisible += +!this._items[i].isHidden;\n }\n\n // Bail early if there are no visible items to layout.\n if (nVisible === 0 && this.widgetOffset === 0) {\n return;\n }\n\n // Measure the parent if the offset dimensions are unknown.\n if (offsetWidth < 0) {\n offsetWidth = this.parent!.node.offsetWidth;\n }\n if (offsetHeight < 0) {\n offsetHeight = this.parent!.node.offsetHeight;\n }\n\n // Ensure the parent box sizing data is computed.\n if (!this._box) {\n this._box = ElementExt.boxSizing(this.parent!.node);\n }\n\n // Compute the actual layout bounds adjusted for border and padding.\n let top = this._box.paddingTop;\n let left = this._box.paddingLeft;\n let width = offsetWidth - this._box.horizontalSum;\n let height = offsetHeight - this._box.verticalSum;\n\n // Set up the variables for justification and alignment offset.\n let extra = 0;\n let offset = 0;\n let horz = this._orientation === 'horizontal';\n\n if (nVisible > 0) {\n // Compute the adjusted layout space.\n let space: number;\n if (horz) {\n // left += this.widgetOffset;\n space = Math.max(0, width - this._fixed);\n } else {\n // top += this.widgetOffset;\n space = Math.max(0, height - this._fixed);\n }\n\n // Scale the size hints if they are normalized.\n if (this._hasNormedSizes) {\n for (let sizer of this._sizers) {\n sizer.sizeHint *= space;\n }\n this._hasNormedSizes = false;\n }\n\n // Distribute the layout space to the box sizers.\n let delta = BoxEngine.calc(this._sizers, space);\n\n // Account for alignment if there is extra layout space.\n if (delta > 0) {\n switch (this._alignment) {\n case 'start':\n break;\n case 'center':\n extra = 0;\n offset = delta / 2;\n break;\n case 'end':\n extra = 0;\n offset = delta;\n break;\n case 'justify':\n extra = delta / nVisible;\n offset = 0;\n break;\n default:\n throw 'unreachable';\n }\n }\n }\n\n // Layout the items using the computed box sizes.\n for (let i = 0, n = this._items.length; i < n; ++i) {\n // Fetch the item.\n const item = this._items[i];\n\n // Fetch the computed size for the widget.\n const size = item.isHidden ? 0 : this._sizers[i].size + extra;\n\n this.updateItemPosition(\n i,\n horz,\n horz ? left + offset : left,\n horz ? top : top + offset,\n height,\n width,\n size\n );\n\n const fullOffset =\n this.widgetOffset +\n (this._handles[i].classList.contains('lm-mod-hidden')\n ? 0\n : this._spacing);\n\n if (horz) {\n left += size + fullOffset;\n } else {\n top += size + fullOffset;\n }\n }\n }\n\n protected widgetOffset = 0;\n private _fixed = 0;\n private _spacing = 4;\n private _dirty = false;\n private _hasNormedSizes = false;\n private _sizers: BoxSizer[] = [];\n private _items: LayoutItem[] = [];\n private _handles: HTMLDivElement[] = [];\n private _box: ElementExt.IBoxSizing | null = null;\n private _alignment: SplitLayout.Alignment = 'start';\n private _orientation: SplitLayout.Orientation = 'horizontal';\n}\n\n/**\n * The namespace for the `SplitLayout` class statics.\n */\nexport namespace SplitLayout {\n /**\n * A type alias for a split layout orientation.\n */\n export type Orientation = 'horizontal' | 'vertical';\n\n /**\n * A type alias for a split layout alignment.\n */\n export type Alignment = 'start' | 'center' | 'end' | 'justify';\n\n /**\n * An options object for initializing a split layout.\n */\n export interface IOptions {\n /**\n * The renderer to use for the split layout.\n */\n renderer: IRenderer;\n\n /**\n * The orientation of the layout.\n *\n * Possible values are documented in {@link SplitLayout.Orientation}.\n *\n * The default is `'horizontal'`.\n */\n orientation?: Orientation;\n\n /**\n * The content alignment of the layout.\n *\n * Possible values are documented in {@link SplitLayout.Alignment}.\n *\n * The default is `'start'`.\n */\n alignment?: Alignment;\n\n /**\n * The spacing between items in the layout.\n *\n * The default is `4`.\n */\n spacing?: number;\n }\n\n /**\n * A renderer for use with a split layout.\n */\n export interface IRenderer {\n /**\n * Create a new handle for use with a split layout.\n *\n * @returns A new handle element.\n */\n createHandle(): HTMLDivElement;\n }\n\n /**\n * Get the split layout stretch factor for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The split layout stretch factor for the widget.\n */\n export function getStretch(widget: Widget): number {\n return Private.stretchProperty.get(widget);\n }\n\n /**\n * Set the split layout stretch factor for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the stretch factor.\n */\n export function setStretch(widget: Widget, value: number): void {\n Private.stretchProperty.set(widget, value);\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * The property descriptor for a widget stretch factor.\n */\n export const stretchProperty = new AttachedProperty({\n name: 'stretch',\n create: () => 0,\n coerce: (owner, value) => Math.max(0, Math.floor(value)),\n changed: onChildSizingChanged\n });\n\n /**\n * Create a new box sizer with the given size hint.\n */\n export function createSizer(size: number): BoxSizer {\n let sizer = new BoxSizer();\n sizer.sizeHint = Math.floor(size);\n return sizer;\n }\n\n /**\n * Create a new split handle node using the given renderer.\n */\n export function createHandle(\n renderer: SplitLayout.IRenderer\n ): HTMLDivElement {\n let handle = renderer.createHandle();\n handle.style.position = 'absolute';\n // Do not use size containment to allow the handle to fill the available space\n handle.style.contain = 'style';\n return handle;\n }\n\n /**\n * Compute the average size of an array of box sizers.\n */\n export function averageSize(sizers: BoxSizer[]): number {\n return sizers.reduce((v, s) => v + s.size, 0) / sizers.length || 0;\n }\n\n /**\n * Normalize an array of values.\n */\n export function normalize(values: number[]): number[] {\n let n = values.length;\n if (n === 0) {\n return [];\n }\n let sum = values.reduce((a, b) => a + Math.abs(b), 0);\n return sum === 0 ? values.map(v => 1 / n) : values.map(v => v / sum);\n }\n\n /**\n * The change handler for the attached sizing properties.\n */\n function onChildSizingChanged(child: Widget): void {\n if (child.parent && child.parent.layout instanceof SplitLayout) {\n child.parent.fit();\n }\n }\n}\n","/*\n * Copyright (c) Jupyter Development Team.\n * Distributed under the terms of the Modified BSD License.\n */\n\nimport { ArrayExt } from '@lumino/algorithm';\nimport { UUID } from '@lumino/coreutils';\nimport { SplitLayout } from './splitlayout';\nimport { Title } from './title';\nimport Utils from './utils';\nimport { Widget } from './widget';\n\n/**\n * A layout which arranges its widgets into collapsible resizable sections.\n */\nexport class AccordionLayout extends SplitLayout {\n /**\n * Construct a new accordion layout.\n *\n * @param options - The options for initializing the layout.\n *\n * #### Notes\n * The default orientation will be vertical.\n *\n * Titles must be rotated for horizontal accordion panel using CSS: see accordionpanel.css\n */\n constructor(options: AccordionLayout.IOptions) {\n super({ ...options, orientation: options.orientation || 'vertical' });\n this.titleSpace = options.titleSpace || 22;\n }\n\n /**\n * The section title height or width depending on the orientation.\n */\n get titleSpace(): number {\n return this.widgetOffset;\n }\n set titleSpace(value: number) {\n value = Utils.clampDimension(value);\n if (this.widgetOffset === value) {\n return;\n }\n this.widgetOffset = value;\n if (!this.parent) {\n return;\n }\n this.parent.fit();\n }\n\n /**\n * A read-only array of the section titles in the panel.\n */\n get titles(): ReadonlyArray {\n return this._titles;\n }\n\n /**\n * Dispose of the resources held by the layout.\n */\n dispose(): void {\n if (this.isDisposed) {\n return;\n }\n\n // Clear the layout state.\n this._titles.length = 0;\n\n // Dispose of the rest of the layout.\n super.dispose();\n }\n\n /**\n * The renderer used by the accordion layout.\n */\n readonly renderer: AccordionLayout.IRenderer;\n\n public updateTitle(index: number, widget: Widget): void {\n const oldTitle = this._titles[index];\n const expanded = oldTitle.classList.contains('lm-mod-expanded');\n const newTitle = Private.createTitle(this.renderer, widget.title, expanded);\n this._titles[index] = newTitle;\n\n // Add the title node to the parent before the widget.\n this.parent!.node.replaceChild(newTitle, oldTitle);\n }\n\n /**\n * Insert a widget into the layout at the specified index.\n *\n * @param index - The index at which to insert the widget.\n *\n * @param widget - The widget to insert into the layout.\n *\n * #### Notes\n * The index will be clamped to the bounds of the widgets.\n *\n * If the widget is already added to the layout, it will be moved.\n *\n * #### Undefined Behavior\n * An `index` which is non-integral.\n */\n insertWidget(index: number, widget: Widget): void {\n if (!widget.id) {\n widget.id = `id-${UUID.uuid4()}`;\n }\n super.insertWidget(index, widget);\n }\n\n /**\n * Attach a widget to the parent's DOM node.\n *\n * @param index - The current index of the widget in the layout.\n *\n * @param widget - The widget to attach to the parent.\n */\n protected attachWidget(index: number, widget: Widget): void {\n const title = Private.createTitle(this.renderer, widget.title);\n\n ArrayExt.insert(this._titles, index, title);\n\n // Add the title node to the parent before the widget.\n this.parent!.node.appendChild(title);\n\n widget.node.setAttribute('role', 'region');\n widget.node.setAttribute('aria-labelledby', title.id);\n\n super.attachWidget(index, widget);\n }\n\n /**\n * Move a widget in the parent's DOM node.\n *\n * @param fromIndex - The previous index of the widget in the layout.\n *\n * @param toIndex - The current index of the widget in the layout.\n *\n * @param widget - The widget to move in the parent.\n */\n protected moveWidget(\n fromIndex: number,\n toIndex: number,\n widget: Widget\n ): void {\n ArrayExt.move(this._titles, fromIndex, toIndex);\n super.moveWidget(fromIndex, toIndex, widget);\n }\n\n /**\n * Detach a widget from the parent's DOM node.\n *\n * @param index - The previous index of the widget in the layout.\n *\n * @param widget - The widget to detach from the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected detachWidget(index: number, widget: Widget): void {\n const title = ArrayExt.removeAt(this._titles, index);\n\n this.parent!.node.removeChild(title!);\n\n super.detachWidget(index, widget);\n }\n\n /**\n * Update the item position.\n *\n * @param i Item index\n * @param isHorizontal Whether the layout is horizontal or not\n * @param left Left position in pixels\n * @param top Top position in pixels\n * @param height Item height\n * @param width Item width\n * @param size Item size\n */\n protected updateItemPosition(\n i: number,\n isHorizontal: boolean,\n left: number,\n top: number,\n height: number,\n width: number,\n size: number\n ): void {\n const titleStyle = this._titles[i].style;\n\n // Titles must be rotated for horizontal accordion panel using CSS: see accordionpanel.css\n titleStyle.top = `${top}px`;\n titleStyle.left = `${left}px`;\n titleStyle.height = `${this.widgetOffset}px`;\n if (isHorizontal) {\n titleStyle.width = `${height}px`;\n } else {\n titleStyle.width = `${width}px`;\n }\n\n super.updateItemPosition(i, isHorizontal, left, top, height, width, size);\n }\n\n private _titles: HTMLElement[] = [];\n}\n\nexport namespace AccordionLayout {\n /**\n * A type alias for a accordion layout orientation.\n */\n export type Orientation = SplitLayout.Orientation;\n\n /**\n * A type alias for a accordion layout alignment.\n */\n export type Alignment = SplitLayout.Alignment;\n\n /**\n * An options object for initializing a accordion layout.\n */\n export interface IOptions extends SplitLayout.IOptions {\n /**\n * The renderer to use for the accordion layout.\n */\n renderer: IRenderer;\n\n /**\n * The section title height or width depending on the orientation.\n *\n * The default is `22`.\n */\n titleSpace?: number;\n }\n\n /**\n * A renderer for use with an accordion layout.\n */\n export interface IRenderer extends SplitLayout.IRenderer {\n /**\n * Common class name for all accordion titles.\n */\n readonly titleClassName: string;\n\n /**\n * Render the element for a section title.\n *\n * @param title - The data to use for rendering the section title.\n *\n * @returns A element representing the section title.\n */\n createSectionTitle(title: Title): HTMLElement;\n }\n}\n\nnamespace Private {\n /**\n * Create the title HTML element.\n *\n * @param renderer Accordion renderer\n * @param data Widget title\n * @returns Title HTML element\n */\n export function createTitle(\n renderer: AccordionLayout.IRenderer,\n data: Title,\n expanded: boolean = true\n ): HTMLElement {\n const title = renderer.createSectionTitle(data);\n title.style.position = 'absolute';\n title.style.contain = 'strict';\n title.setAttribute('aria-label', `${data.label} Section`);\n title.setAttribute('aria-expanded', expanded ? 'true' : 'false');\n title.setAttribute('aria-controls', data.owner.id);\n if (expanded) {\n title.classList.add('lm-mod-expanded');\n }\n return title;\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { PanelLayout } from './panellayout';\n\nimport { Widget } from './widget';\n\n/**\n * A simple and convenient panel widget class.\n *\n * #### Notes\n * This class is suitable as a base class for implementing a variety of\n * convenience panel widgets, but can also be used directly with CSS to\n * arrange a collection of widgets.\n *\n * This class provides a convenience wrapper around a {@link PanelLayout}.\n */\nexport class Panel extends Widget {\n /**\n * Construct a new panel.\n *\n * @param options - The options for initializing the panel.\n */\n constructor(options: Panel.IOptions = {}) {\n super();\n this.addClass('lm-Panel');\n this.layout = Private.createLayout(options);\n }\n\n /**\n * A read-only array of the widgets in the panel.\n */\n get widgets(): ReadonlyArray {\n return (this.layout as PanelLayout).widgets;\n }\n\n /**\n * Add a widget to the end of the panel.\n *\n * @param widget - The widget to add to the panel.\n *\n * #### Notes\n * If the widget is already contained in the panel, it will be moved.\n */\n addWidget(widget: Widget): void {\n (this.layout as PanelLayout).addWidget(widget);\n }\n\n /**\n * Insert a widget at the specified index.\n *\n * @param index - The index at which to insert the widget.\n *\n * @param widget - The widget to insert into to the panel.\n *\n * #### Notes\n * If the widget is already contained in the panel, it will be moved.\n */\n insertWidget(index: number, widget: Widget): void {\n (this.layout as PanelLayout).insertWidget(index, widget);\n }\n}\n\n/**\n * The namespace for the `Panel` class statics.\n */\nexport namespace Panel {\n /**\n * An options object for creating a panel.\n */\n export interface IOptions {\n /**\n * The panel layout to use for the panel.\n *\n * The default is a new `PanelLayout`.\n */\n layout?: PanelLayout;\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * Create a panel layout for the given panel options.\n */\n export function createLayout(options: Panel.IOptions): PanelLayout {\n return options.layout || new PanelLayout();\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { IDisposable } from '@lumino/disposable';\n\nimport { Drag } from '@lumino/dragdrop';\n\nimport { Message } from '@lumino/messaging';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { Panel } from './panel';\n\nimport { SplitLayout } from './splitlayout';\n\nimport { Widget } from './widget';\n\n/**\n * A panel which arranges its widgets into resizable sections.\n *\n * #### Notes\n * This class provides a convenience wrapper around a {@link SplitLayout}.\n */\nexport class SplitPanel extends Panel {\n /**\n * Construct a new split panel.\n *\n * @param options - The options for initializing the split panel.\n */\n constructor(options: SplitPanel.IOptions = {}) {\n super({ layout: Private.createLayout(options) });\n this.addClass('lm-SplitPanel');\n }\n\n /**\n * Dispose of the resources held by the panel.\n */\n dispose(): void {\n this._releaseMouse();\n super.dispose();\n }\n\n /**\n * Get the layout orientation for the split panel.\n */\n get orientation(): SplitPanel.Orientation {\n return (this.layout as SplitLayout).orientation;\n }\n\n /**\n * Set the layout orientation for the split panel.\n */\n set orientation(value: SplitPanel.Orientation) {\n (this.layout as SplitLayout).orientation = value;\n }\n\n /**\n * Get the content alignment for the split panel.\n *\n * #### Notes\n * This is the alignment of the widgets in the layout direction.\n *\n * The alignment has no effect if the widgets can expand to fill the\n * entire split panel.\n */\n get alignment(): SplitPanel.Alignment {\n return (this.layout as SplitLayout).alignment;\n }\n\n /**\n * Set the content alignment for the split panel.\n *\n * #### Notes\n * This is the alignment of the widgets in the layout direction.\n *\n * The alignment has no effect if the widgets can expand to fill the\n * entire split panel.\n */\n set alignment(value: SplitPanel.Alignment) {\n (this.layout as SplitLayout).alignment = value;\n }\n\n /**\n * Get the inter-element spacing for the split panel.\n */\n get spacing(): number {\n return (this.layout as SplitLayout).spacing;\n }\n\n /**\n * Set the inter-element spacing for the split panel.\n */\n set spacing(value: number) {\n (this.layout as SplitLayout).spacing = value;\n }\n\n /**\n * The renderer used by the split panel.\n */\n get renderer(): SplitPanel.IRenderer {\n return (this.layout as SplitLayout).renderer;\n }\n\n /**\n * A signal emitted when a split handle has moved.\n */\n get handleMoved(): ISignal {\n return this._handleMoved;\n }\n\n /**\n * A read-only array of the split handles in the panel.\n */\n get handles(): ReadonlyArray {\n return (this.layout as SplitLayout).handles;\n }\n\n /**\n * Get the relative sizes of the widgets in the panel.\n *\n * @returns A new array of the relative sizes of the widgets.\n *\n * #### Notes\n * The returned sizes reflect the sizes of the widgets normalized\n * relative to their siblings.\n *\n * This method **does not** measure the DOM nodes.\n */\n relativeSizes(): number[] {\n return (this.layout as SplitLayout).relativeSizes();\n }\n\n /**\n * Set the relative sizes for the widgets in the panel.\n *\n * @param sizes - The relative sizes for the widgets in the panel.\n * @param update - Update the layout after setting relative sizes.\n * Default is True.\n *\n * #### Notes\n * Extra values are ignored, too few will yield an undefined layout.\n *\n * The actual geometry of the DOM nodes is updated asynchronously.\n */\n setRelativeSizes(sizes: number[], update = true): void {\n (this.layout as SplitLayout).setRelativeSizes(sizes, update);\n }\n\n /**\n * Handle the DOM events for the split panel.\n *\n * @param event - The DOM event sent to the panel.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the panel's DOM node. It should\n * not be called directly by user code.\n */\n handleEvent(event: Event): void {\n switch (event.type) {\n case 'pointerdown':\n this._evtPointerDown(event as PointerEvent);\n break;\n case 'pointermove':\n this._evtPointerMove(event as PointerEvent);\n break;\n case 'pointerup':\n this._evtPointerUp(event as PointerEvent);\n break;\n case 'keydown':\n this._evtKeyDown(event as KeyboardEvent);\n break;\n case 'contextmenu':\n event.preventDefault();\n event.stopPropagation();\n break;\n }\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n this.node.addEventListener('pointerdown', this);\n }\n\n /**\n * A message handler invoked on an `'after-detach'` message.\n */\n protected onAfterDetach(msg: Message): void {\n this.node.removeEventListener('pointerdown', this);\n this._releaseMouse();\n }\n\n /**\n * A message handler invoked on a `'child-added'` message.\n */\n protected onChildAdded(msg: Widget.ChildMessage): void {\n msg.child.addClass('lm-SplitPanel-child');\n this._releaseMouse();\n }\n\n /**\n * A message handler invoked on a `'child-removed'` message.\n */\n protected onChildRemoved(msg: Widget.ChildMessage): void {\n msg.child.removeClass('lm-SplitPanel-child');\n this._releaseMouse();\n }\n\n /**\n * Handle the `'keydown'` event for the split panel.\n */\n private _evtKeyDown(event: KeyboardEvent): void {\n // Stop input events during drag.\n if (this._pressData) {\n event.preventDefault();\n event.stopPropagation();\n }\n\n // Release the mouse if `Escape` is pressed.\n if (event.keyCode === 27) {\n this._releaseMouse();\n }\n }\n\n /**\n * Handle the `'pointerdown'` event for the split panel.\n */\n private _evtPointerDown(event: PointerEvent): void {\n // Do nothing if the primary button is not pressed.\n if (event.button !== 0) {\n return;\n }\n\n // Find the handle which contains the target, if any.\n let layout = this.layout as SplitLayout;\n let index = ArrayExt.findFirstIndex(layout.handles, handle => {\n return handle.contains(event.target as HTMLElement);\n });\n\n // Bail early if the mouse press was not on a handle.\n if (index === -1) {\n return;\n }\n\n // Stop the event when a split handle is pressed.\n event.preventDefault();\n event.stopPropagation();\n\n // Add the extra document listeners.\n document.addEventListener('pointerup', this, true);\n document.addEventListener('pointermove', this, true);\n document.addEventListener('keydown', this, true);\n document.addEventListener('contextmenu', this, true);\n\n // Compute the offset delta for the handle press.\n let delta: number;\n let handle = layout.handles[index];\n let rect = handle.getBoundingClientRect();\n if (layout.orientation === 'horizontal') {\n delta = event.clientX - rect.left;\n } else {\n delta = event.clientY - rect.top;\n }\n\n // Override the cursor and store the press data.\n let style = window.getComputedStyle(handle);\n let override = Drag.overrideCursor(style.cursor!);\n this._pressData = { index, delta, override };\n }\n\n /**\n * Handle the `'pointermove'` event for the split panel.\n */\n private _evtPointerMove(event: PointerEvent): void {\n // Stop the event when dragging a split handle.\n event.preventDefault();\n event.stopPropagation();\n\n // Compute the desired offset position for the handle.\n let pos: number;\n let layout = this.layout as SplitLayout;\n let rect = this.node.getBoundingClientRect();\n if (layout.orientation === 'horizontal') {\n pos = event.clientX - rect.left - this._pressData!.delta;\n } else {\n pos = event.clientY - rect.top - this._pressData!.delta;\n }\n\n // Move the handle as close to the desired position as possible.\n layout.moveHandle(this._pressData!.index, pos);\n }\n\n /**\n * Handle the `'pointerup'` event for the split panel.\n */\n private _evtPointerUp(event: PointerEvent): void {\n // Do nothing if the primary button is not released.\n if (event.button !== 0) {\n return;\n }\n\n // Stop the event when releasing a handle.\n event.preventDefault();\n event.stopPropagation();\n\n // Finalize the mouse release.\n this._releaseMouse();\n }\n\n /**\n * Release the mouse grab for the split panel.\n */\n private _releaseMouse(): void {\n // Bail early if no drag is in progress.\n if (!this._pressData) {\n return;\n }\n\n // Clear the override cursor.\n this._pressData.override.dispose();\n this._pressData = null;\n\n // Emit the handle moved signal.\n this._handleMoved.emit();\n\n // Remove the extra document listeners.\n document.removeEventListener('keydown', this, true);\n document.removeEventListener('pointerup', this, true);\n document.removeEventListener('pointermove', this, true);\n document.removeEventListener('contextmenu', this, true);\n }\n\n private _handleMoved = new Signal(this);\n private _pressData: Private.IPressData | null = null;\n}\n\n/**\n * The namespace for the `SplitPanel` class statics.\n */\nexport namespace SplitPanel {\n /**\n * A type alias for a split panel orientation.\n */\n export type Orientation = SplitLayout.Orientation;\n\n /**\n * A type alias for a split panel alignment.\n */\n export type Alignment = SplitLayout.Alignment;\n\n /**\n * A type alias for a split panel renderer.\n */\n export type IRenderer = SplitLayout.IRenderer;\n\n /**\n * An options object for initializing a split panel.\n */\n export interface IOptions {\n /**\n * The renderer to use for the split panel.\n *\n * The default is a shared renderer instance.\n */\n renderer?: IRenderer;\n\n /**\n * The layout orientation of the panel.\n *\n * The default is `'horizontal'`.\n */\n orientation?: Orientation;\n\n /**\n * The content alignment of the panel.\n *\n * The default is `'start'`.\n */\n alignment?: Alignment;\n\n /**\n * The spacing between items in the panel.\n *\n * The default is `4`.\n */\n spacing?: number;\n\n /**\n * The split layout to use for the split panel.\n *\n * If this is provided, the other options are ignored.\n *\n * The default is a new `SplitLayout`.\n */\n layout?: SplitLayout;\n }\n\n /**\n * The default implementation of `IRenderer`.\n */\n export class Renderer implements IRenderer {\n /**\n * Create a new handle for use with a split panel.\n *\n * @returns A new handle element for a split panel.\n */\n createHandle(): HTMLDivElement {\n let handle = document.createElement('div');\n handle.className = 'lm-SplitPanel-handle';\n return handle;\n }\n }\n\n /**\n * The default `Renderer` instance.\n */\n export const defaultRenderer = new Renderer();\n\n /**\n * Get the split panel stretch factor for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The split panel stretch factor for the widget.\n */\n export function getStretch(widget: Widget): number {\n return SplitLayout.getStretch(widget);\n }\n\n /**\n * Set the split panel stretch factor for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the stretch factor.\n */\n export function setStretch(widget: Widget, value: number): void {\n SplitLayout.setStretch(widget, value);\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * An object which holds mouse press data.\n */\n export interface IPressData {\n /**\n * The index of the pressed handle.\n */\n index: number;\n\n /**\n * The offset of the press in handle coordinates.\n */\n delta: number;\n\n /**\n * The disposable which will clear the override cursor.\n */\n override: IDisposable;\n }\n\n /**\n * Create a split layout for the given panel options.\n */\n export function createLayout(options: SplitPanel.IOptions): SplitLayout {\n return (\n options.layout ||\n new SplitLayout({\n renderer: options.renderer || SplitPanel.defaultRenderer,\n orientation: options.orientation,\n alignment: options.alignment,\n spacing: options.spacing\n })\n );\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n\nimport { ArrayExt } from '@lumino/algorithm';\nimport { Message } from '@lumino/messaging';\nimport { ISignal, Signal } from '@lumino/signaling';\nimport { AccordionLayout } from './accordionlayout';\nimport { SplitLayout } from './splitlayout';\nimport { SplitPanel } from './splitpanel';\nimport { Title } from './title';\nimport { Widget } from './widget';\n\n/**\n * A panel which arranges its widgets into resizable sections separated by a title widget.\n *\n * #### Notes\n * This class provides a convenience wrapper around {@link AccordionLayout}.\n *\n * See also the related [example](../../examples/accordionpanel/index.html) and\n * its [source](https://github.com/jupyterlab/lumino/tree/main/examples/example-accordionpanel).\n */\nexport class AccordionPanel extends SplitPanel {\n /**\n * Construct a new accordion panel.\n *\n * @param options - The options for initializing the accordion panel.\n *\n */\n constructor(options: AccordionPanel.IOptions = {}) {\n super({ ...options, layout: Private.createLayout(options) });\n this.addClass('lm-AccordionPanel');\n }\n\n /**\n * The renderer used by the accordion panel.\n */\n get renderer(): AccordionPanel.IRenderer {\n return (this.layout as AccordionLayout).renderer;\n }\n\n /**\n * The section title space.\n *\n * This is the height if the panel is vertical and the width if it is\n * horizontal.\n */\n get titleSpace(): number {\n return (this.layout as AccordionLayout).titleSpace;\n }\n set titleSpace(value: number) {\n (this.layout as AccordionLayout).titleSpace = value;\n }\n\n /**\n * A read-only array of the section titles in the panel.\n */\n get titles(): ReadonlyArray {\n return (this.layout as AccordionLayout).titles;\n }\n\n /**\n * A signal emitted when a widget of the AccordionPanel is collapsed or expanded.\n */\n get expansionToggled(): ISignal {\n return this._expansionToggled;\n }\n\n /**\n * Add a widget to the end of the panel.\n *\n * @param widget - The widget to add to the panel.\n *\n * #### Notes\n * If the widget is already contained in the panel, it will be moved.\n */\n addWidget(widget: Widget): void {\n super.addWidget(widget);\n widget.title.changed.connect(this._onTitleChanged, this);\n }\n\n /**\n * Collapse the widget at position `index`.\n *\n * #### Notes\n * If no widget is found for `index`, this will bail.\n *\n * @param index Widget index\n */\n collapse(index: number): void {\n const widget = (this.layout as AccordionLayout).widgets[index];\n\n if (widget && !widget.isHidden) {\n this._toggleExpansion(index);\n }\n }\n\n /**\n * Expand the widget at position `index`.\n *\n * #### Notes\n * If no widget is found for `index`, this will bail.\n *\n * @param index Widget index\n */\n expand(index: number): void {\n const widget = (this.layout as AccordionLayout).widgets[index];\n\n if (widget && widget.isHidden) {\n this._toggleExpansion(index);\n }\n }\n\n /**\n * Insert a widget at the specified index.\n *\n * @param index - The index at which to insert the widget.\n *\n * @param widget - The widget to insert into to the panel.\n *\n * #### Notes\n * If the widget is already contained in the panel, it will be moved.\n */\n insertWidget(index: number, widget: Widget): void {\n super.insertWidget(index, widget);\n widget.title.changed.connect(this._onTitleChanged, this);\n }\n\n /**\n * Handle the DOM events for the accordion panel.\n *\n * @param event - The DOM event sent to the panel.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the panel's DOM node. It should\n * not be called directly by user code.\n */\n handleEvent(event: Event): void {\n super.handleEvent(event);\n switch (event.type) {\n case 'click':\n this._evtClick(event as MouseEvent);\n break;\n case 'keydown':\n this._eventKeyDown(event as KeyboardEvent);\n break;\n }\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n this.node.addEventListener('click', this);\n this.node.addEventListener('keydown', this);\n super.onBeforeAttach(msg);\n }\n\n /**\n * A message handler invoked on an `'after-detach'` message.\n */\n protected onAfterDetach(msg: Message): void {\n super.onAfterDetach(msg);\n this.node.removeEventListener('click', this);\n this.node.removeEventListener('keydown', this);\n }\n\n /**\n * Handle the `changed` signal of a title object.\n */\n private _onTitleChanged(sender: Title): void {\n const index = ArrayExt.findFirstIndex(this.widgets, widget => {\n return widget.contains(sender.owner);\n });\n\n if (index >= 0) {\n (this.layout as AccordionLayout).updateTitle(index, sender.owner);\n this.update();\n }\n }\n\n /**\n * Compute the size of widgets in this panel on the title click event.\n * On closing, the size of the widget is cached and we will try to expand\n * the last opened widget.\n * On opening, we will use the cached size if it is available to restore the\n * widget.\n * In both cases, if we can not compute the size of widgets, we will let\n * `SplitLayout` decide.\n *\n * @param index - The index of widget to be opened of closed\n *\n * @returns Relative size of widgets in this panel, if this size can\n * not be computed, return `undefined`\n */\n private _computeWidgetSize(index: number): number[] | undefined {\n const layout = this.layout as AccordionLayout;\n\n const widget = layout.widgets[index];\n if (!widget) {\n return undefined;\n }\n const isHidden = widget.isHidden;\n const widgetSizes = layout.absoluteSizes();\n const delta = (isHidden ? -1 : 1) * this.spacing;\n const totalSize = widgetSizes.reduce(\n (prev: number, curr: number) => prev + curr\n );\n\n let newSize = [...widgetSizes];\n\n if (!isHidden) {\n // Hide the widget\n const currentSize = widgetSizes[index];\n\n this._widgetSizesCache.set(widget, currentSize);\n newSize[index] = 0;\n\n const widgetToCollapse = newSize.map(sz => sz > 0).lastIndexOf(true);\n if (widgetToCollapse === -1) {\n // All widget are closed, let the `SplitLayout` compute widget sizes.\n return undefined;\n }\n\n newSize[widgetToCollapse] =\n widgetSizes[widgetToCollapse] + currentSize + delta;\n } else {\n // Show the widget\n const previousSize = this._widgetSizesCache.get(widget);\n if (!previousSize) {\n // Previous size is unavailable, let the `SplitLayout` compute widget sizes.\n return undefined;\n }\n newSize[index] += previousSize;\n\n const widgetToCollapse = newSize\n .map(sz => sz - previousSize > 0)\n .lastIndexOf(true);\n if (widgetToCollapse === -1) {\n // Can not reduce the size of one widget, reduce all opened widgets\n // proportionally with its size.\n newSize.forEach((_, idx) => {\n if (idx !== index) {\n newSize[idx] -=\n (widgetSizes[idx] / totalSize) * (previousSize - delta);\n }\n });\n } else {\n newSize[widgetToCollapse] -= previousSize - delta;\n }\n }\n return newSize.map(sz => sz / (totalSize + delta));\n }\n /**\n * Handle the `'click'` event for the accordion panel\n */\n private _evtClick(event: MouseEvent): void {\n const target = event.target as HTMLElement | null;\n\n if (target) {\n const index = ArrayExt.findFirstIndex(this.titles, title => {\n return title.contains(target);\n });\n\n if (index >= 0) {\n event.preventDefault();\n event.stopPropagation();\n this._toggleExpansion(index);\n }\n }\n }\n\n /**\n * Handle the `'keydown'` event for the accordion panel.\n */\n private _eventKeyDown(event: KeyboardEvent): void {\n if (event.defaultPrevented) {\n return;\n }\n\n const target = event.target as HTMLElement | null;\n let handled = false;\n if (target) {\n const index = ArrayExt.findFirstIndex(this.titles, title => {\n return title.contains(target);\n });\n\n if (index >= 0) {\n const keyCode = event.keyCode.toString();\n\n // If Space or Enter is pressed on title, emulate click event\n if (event.key.match(/Space|Enter/) || keyCode.match(/13|32/)) {\n target.click();\n handled = true;\n } else if (\n this.orientation === 'horizontal'\n ? event.key.match(/ArrowLeft|ArrowRight/) || keyCode.match(/37|39/)\n : event.key.match(/ArrowUp|ArrowDown/) || keyCode.match(/38|40/)\n ) {\n // If Up or Down (for vertical) / Left or Right (for horizontal) is pressed on title, loop on titles\n const direction =\n event.key.match(/ArrowLeft|ArrowUp/) || keyCode.match(/37|38/)\n ? -1\n : 1;\n const length = this.titles.length;\n const newIndex = (index + length + direction) % length;\n\n this.titles[newIndex].focus();\n handled = true;\n } else if (event.key === 'End' || keyCode === '35') {\n // If End is pressed on title, focus on the last title\n this.titles[this.titles.length - 1].focus();\n handled = true;\n } else if (event.key === 'Home' || keyCode === '36') {\n // If Home is pressed on title, focus on the first title\n this.titles[0].focus();\n handled = true;\n }\n }\n\n if (handled) {\n event.preventDefault();\n }\n }\n }\n\n private _toggleExpansion(index: number) {\n const title = this.titles[index];\n const widget = (this.layout as AccordionLayout).widgets[index];\n\n const newSize = this._computeWidgetSize(index);\n if (newSize) {\n this.setRelativeSizes(newSize, false);\n }\n\n if (widget.isHidden) {\n title.classList.add('lm-mod-expanded');\n title.setAttribute('aria-expanded', 'true');\n widget.show();\n } else {\n title.classList.remove('lm-mod-expanded');\n title.setAttribute('aria-expanded', 'false');\n widget.hide();\n }\n\n // Emit the expansion state signal.\n this._expansionToggled.emit(index);\n }\n\n private _widgetSizesCache: WeakMap = new WeakMap();\n private _expansionToggled = new Signal(this);\n}\n\n/**\n * The namespace for the `AccordionPanel` class statics.\n */\nexport namespace AccordionPanel {\n /**\n * A type alias for a accordion panel orientation.\n */\n export type Orientation = SplitLayout.Orientation;\n\n /**\n * A type alias for a accordion panel alignment.\n */\n export type Alignment = SplitLayout.Alignment;\n\n /**\n * A type alias for a accordion panel renderer.\n */\n export type IRenderer = AccordionLayout.IRenderer;\n\n /**\n * An options object for initializing a accordion panel.\n */\n export interface IOptions extends Partial {\n /**\n * The accordion layout to use for the accordion panel.\n *\n * If this is provided, the other options are ignored.\n *\n * The default is a new `AccordionLayout`.\n */\n layout?: AccordionLayout;\n }\n\n /**\n * The default implementation of `IRenderer`.\n */\n export class Renderer extends SplitPanel.Renderer implements IRenderer {\n constructor() {\n super();\n this._uuid = ++Renderer._nInstance;\n }\n /**\n * A selector which matches any title node in the accordion.\n */\n readonly titleClassName = 'lm-AccordionPanel-title';\n\n /**\n * Render the collapse indicator for a section title.\n *\n * @param data - The data to use for rendering the section title.\n *\n * @returns A element representing the collapse indicator.\n */\n createCollapseIcon(data: Title): HTMLElement {\n return document.createElement('span');\n }\n\n /**\n * Render the element for a section title.\n *\n * @param data - The data to use for rendering the section title.\n *\n * @returns A element representing the section title.\n */\n createSectionTitle(data: Title): HTMLElement {\n const handle = document.createElement('h3');\n handle.setAttribute('tabindex', '0');\n handle.id = this.createTitleKey(data);\n handle.className = this.titleClassName;\n for (const aData in data.dataset) {\n handle.dataset[aData] = data.dataset[aData];\n }\n\n const collapser = handle.appendChild(this.createCollapseIcon(data));\n collapser.className = 'lm-AccordionPanel-titleCollapser';\n\n const label = handle.appendChild(document.createElement('span'));\n label.className = 'lm-AccordionPanel-titleLabel';\n label.textContent = data.label;\n label.title = data.caption || data.label;\n\n return handle;\n }\n\n /**\n * Create a unique render key for the title.\n *\n * @param data - The data to use for the title.\n *\n * @returns The unique render key for the title.\n *\n * #### Notes\n * This method caches the key against the section title the first time\n * the key is generated.\n */\n createTitleKey(data: Title): string {\n let key = this._titleKeys.get(data);\n if (key === undefined) {\n key = `title-key-${this._uuid}-${this._titleID++}`;\n this._titleKeys.set(data, key);\n }\n return key;\n }\n\n private static _nInstance = 0;\n private readonly _uuid: number;\n private _titleID = 0;\n private _titleKeys = new WeakMap, string>();\n }\n\n /**\n * The default `Renderer` instance.\n */\n export const defaultRenderer = new Renderer();\n}\n\nnamespace Private {\n /**\n * Create an accordion layout for the given panel options.\n *\n * @param options Panel options\n * @returns Panel layout\n */\n export function createLayout(\n options: AccordionPanel.IOptions\n ): AccordionLayout {\n return (\n options.layout ||\n new AccordionLayout({\n renderer: options.renderer || AccordionPanel.defaultRenderer,\n orientation: options.orientation,\n alignment: options.alignment,\n spacing: options.spacing,\n titleSpace: options.titleSpace\n })\n );\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { AttachedProperty } from '@lumino/properties';\n\nimport { BoxEngine, BoxSizer } from './boxengine';\n\nimport { LayoutItem } from './layout';\n\nimport { PanelLayout } from './panellayout';\n\nimport Utils from './utils';\n\nimport { Widget } from './widget';\n\n/**\n * A layout which arranges its widgets in a single row or column.\n */\nexport class BoxLayout extends PanelLayout {\n /**\n * Construct a new box layout.\n *\n * @param options - The options for initializing the layout.\n */\n constructor(options: BoxLayout.IOptions = {}) {\n super();\n if (options.direction !== undefined) {\n this._direction = options.direction;\n }\n if (options.alignment !== undefined) {\n this._alignment = options.alignment;\n }\n if (options.spacing !== undefined) {\n this._spacing = Utils.clampDimension(options.spacing);\n }\n }\n\n /**\n * Dispose of the resources held by the layout.\n */\n dispose(): void {\n // Dispose of the layout items.\n for (const item of this._items) {\n item.dispose();\n }\n\n // Clear the layout state.\n this._box = null;\n this._items.length = 0;\n this._sizers.length = 0;\n\n // Dispose of the rest of the layout.\n super.dispose();\n }\n\n /**\n * Get the layout direction for the box layout.\n */\n get direction(): BoxLayout.Direction {\n return this._direction;\n }\n\n /**\n * Set the layout direction for the box layout.\n */\n set direction(value: BoxLayout.Direction) {\n if (this._direction === value) {\n return;\n }\n this._direction = value;\n if (!this.parent) {\n return;\n }\n this.parent.dataset['direction'] = value;\n this.parent.fit();\n }\n\n /**\n * Get the content alignment for the box layout.\n *\n * #### Notes\n * This is the alignment of the widgets in the layout direction.\n *\n * The alignment has no effect if the widgets can expand to fill the\n * entire box layout.\n */\n get alignment(): BoxLayout.Alignment {\n return this._alignment;\n }\n\n /**\n * Set the content alignment for the box layout.\n *\n * #### Notes\n * This is the alignment of the widgets in the layout direction.\n *\n * The alignment has no effect if the widgets can expand to fill the\n * entire box layout.\n */\n set alignment(value: BoxLayout.Alignment) {\n if (this._alignment === value) {\n return;\n }\n this._alignment = value;\n if (!this.parent) {\n return;\n }\n this.parent.dataset['alignment'] = value;\n this.parent.update();\n }\n\n /**\n * Get the inter-element spacing for the box layout.\n */\n get spacing(): number {\n return this._spacing;\n }\n\n /**\n * Set the inter-element spacing for the box layout.\n */\n set spacing(value: number) {\n value = Utils.clampDimension(value);\n if (this._spacing === value) {\n return;\n }\n this._spacing = value;\n if (!this.parent) {\n return;\n }\n this.parent.fit();\n }\n\n /**\n * Perform layout initialization which requires the parent widget.\n */\n protected init(): void {\n this.parent!.dataset['direction'] = this.direction;\n this.parent!.dataset['alignment'] = this.alignment;\n super.init();\n }\n\n /**\n * Attach a widget to the parent's DOM node.\n *\n * @param index - The current index of the widget in the layout.\n *\n * @param widget - The widget to attach to the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected attachWidget(index: number, widget: Widget): void {\n // Create and add a new layout item for the widget.\n ArrayExt.insert(this._items, index, new LayoutItem(widget));\n\n // Create and add a new sizer for the widget.\n ArrayExt.insert(this._sizers, index, new BoxSizer());\n\n // Send a `'before-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n }\n\n // Add the widget's node to the parent.\n this.parent!.node.appendChild(widget.node);\n\n // Send an `'after-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n\n // Post a fit request for the parent widget.\n this.parent!.fit();\n }\n\n /**\n * Move a widget in the parent's DOM node.\n *\n * @param fromIndex - The previous index of the widget in the layout.\n *\n * @param toIndex - The current index of the widget in the layout.\n *\n * @param widget - The widget to move in the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected moveWidget(\n fromIndex: number,\n toIndex: number,\n widget: Widget\n ): void {\n // Move the layout item for the widget.\n ArrayExt.move(this._items, fromIndex, toIndex);\n\n // Move the sizer for the widget.\n ArrayExt.move(this._sizers, fromIndex, toIndex);\n\n // Post an update request for the parent widget.\n this.parent!.update();\n }\n\n /**\n * Detach a widget from the parent's DOM node.\n *\n * @param index - The previous index of the widget in the layout.\n *\n * @param widget - The widget to detach from the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected detachWidget(index: number, widget: Widget): void {\n // Remove the layout item for the widget.\n let item = ArrayExt.removeAt(this._items, index);\n\n // Remove the sizer for the widget.\n ArrayExt.removeAt(this._sizers, index);\n\n // Send a `'before-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n }\n\n // Remove the widget's node from the parent.\n this.parent!.node.removeChild(widget.node);\n\n // Send an `'after-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n\n // Dispose of the layout item.\n item!.dispose();\n\n // Post a fit request for the parent widget.\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'before-show'` message.\n */\n protected onBeforeShow(msg: Message): void {\n super.onBeforeShow(msg);\n this.parent!.update();\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n super.onBeforeAttach(msg);\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-shown'` message.\n */\n protected onChildShown(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-hidden'` message.\n */\n protected onChildHidden(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'resize'` message.\n */\n protected onResize(msg: Widget.ResizeMessage): void {\n if (this.parent!.isVisible) {\n this._update(msg.width, msg.height);\n }\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n protected onUpdateRequest(msg: Message): void {\n if (this.parent!.isVisible) {\n this._update(-1, -1);\n }\n }\n\n /**\n * A message handler invoked on a `'fit-request'` message.\n */\n protected onFitRequest(msg: Message): void {\n if (this.parent!.isAttached) {\n this._fit();\n }\n }\n\n /**\n * Fit the layout to the total size required by the widgets.\n */\n private _fit(): void {\n // Compute the visible item count.\n let nVisible = 0;\n for (let i = 0, n = this._items.length; i < n; ++i) {\n nVisible += +!this._items[i].isHidden;\n }\n\n // Update the fixed space for the visible items.\n this._fixed = this._spacing * Math.max(0, nVisible - 1);\n\n // Setup the computed minimum size.\n let horz = Private.isHorizontal(this._direction);\n let minW = horz ? this._fixed : 0;\n let minH = horz ? 0 : this._fixed;\n\n // Update the sizers and computed minimum size.\n for (let i = 0, n = this._items.length; i < n; ++i) {\n // Fetch the item and corresponding box sizer.\n let item = this._items[i];\n let sizer = this._sizers[i];\n\n // If the item is hidden, it should consume zero size.\n if (item.isHidden) {\n sizer.minSize = 0;\n sizer.maxSize = 0;\n continue;\n }\n\n // Update the size limits for the item.\n item.fit();\n\n // Update the size basis and stretch factor.\n sizer.sizeHint = BoxLayout.getSizeBasis(item.widget);\n sizer.stretch = BoxLayout.getStretch(item.widget);\n\n // Update the sizer limits and computed min size.\n if (horz) {\n sizer.minSize = item.minWidth;\n sizer.maxSize = item.maxWidth;\n minW += item.minWidth;\n minH = Math.max(minH, item.minHeight);\n } else {\n sizer.minSize = item.minHeight;\n sizer.maxSize = item.maxHeight;\n minH += item.minHeight;\n minW = Math.max(minW, item.minWidth);\n }\n }\n\n // Update the box sizing and add it to the computed min size.\n let box = (this._box = ElementExt.boxSizing(this.parent!.node));\n minW += box.horizontalSum;\n minH += box.verticalSum;\n\n // Update the parent's min size constraints.\n let style = this.parent!.node.style;\n style.minWidth = `${minW}px`;\n style.minHeight = `${minH}px`;\n\n // Set the dirty flag to ensure only a single update occurs.\n this._dirty = true;\n\n // Notify the ancestor that it should fit immediately. This may\n // cause a resize of the parent, fulfilling the required update.\n if (this.parent!.parent) {\n MessageLoop.sendMessage(this.parent!.parent!, Widget.Msg.FitRequest);\n }\n\n // If the dirty flag is still set, the parent was not resized.\n // Trigger the required update on the parent widget immediately.\n if (this._dirty) {\n MessageLoop.sendMessage(this.parent!, Widget.Msg.UpdateRequest);\n }\n }\n\n /**\n * Update the layout position and size of the widgets.\n *\n * The parent offset dimensions should be `-1` if unknown.\n */\n private _update(offsetWidth: number, offsetHeight: number): void {\n // Clear the dirty flag to indicate the update occurred.\n this._dirty = false;\n\n // Compute the visible item count.\n let nVisible = 0;\n for (let i = 0, n = this._items.length; i < n; ++i) {\n nVisible += +!this._items[i].isHidden;\n }\n\n // Bail early if there are no visible items to layout.\n if (nVisible === 0) {\n return;\n }\n\n // Measure the parent if the offset dimensions are unknown.\n if (offsetWidth < 0) {\n offsetWidth = this.parent!.node.offsetWidth;\n }\n if (offsetHeight < 0) {\n offsetHeight = this.parent!.node.offsetHeight;\n }\n\n // Ensure the parent box sizing data is computed.\n if (!this._box) {\n this._box = ElementExt.boxSizing(this.parent!.node);\n }\n\n // Compute the layout area adjusted for border and padding.\n let top = this._box.paddingTop;\n let left = this._box.paddingLeft;\n let width = offsetWidth - this._box.horizontalSum;\n let height = offsetHeight - this._box.verticalSum;\n\n // Distribute the layout space and adjust the start position.\n let delta: number;\n switch (this._direction) {\n case 'left-to-right':\n delta = BoxEngine.calc(this._sizers, Math.max(0, width - this._fixed));\n break;\n case 'top-to-bottom':\n delta = BoxEngine.calc(this._sizers, Math.max(0, height - this._fixed));\n break;\n case 'right-to-left':\n delta = BoxEngine.calc(this._sizers, Math.max(0, width - this._fixed));\n left += width;\n break;\n case 'bottom-to-top':\n delta = BoxEngine.calc(this._sizers, Math.max(0, height - this._fixed));\n top += height;\n break;\n default:\n throw 'unreachable';\n }\n\n // Setup the variables for justification and alignment offset.\n let extra = 0;\n let offset = 0;\n\n // Account for alignment if there is extra layout space.\n if (delta > 0) {\n switch (this._alignment) {\n case 'start':\n break;\n case 'center':\n extra = 0;\n offset = delta / 2;\n break;\n case 'end':\n extra = 0;\n offset = delta;\n break;\n case 'justify':\n extra = delta / nVisible;\n offset = 0;\n break;\n default:\n throw 'unreachable';\n }\n }\n\n // Layout the items using the computed box sizes.\n for (let i = 0, n = this._items.length; i < n; ++i) {\n // Fetch the item.\n let item = this._items[i];\n\n // Ignore hidden items.\n if (item.isHidden) {\n continue;\n }\n\n // Fetch the computed size for the widget.\n let size = this._sizers[i].size;\n\n // Update the widget geometry and advance the relevant edge.\n switch (this._direction) {\n case 'left-to-right':\n item.update(left + offset, top, size + extra, height);\n left += size + extra + this._spacing;\n break;\n case 'top-to-bottom':\n item.update(left, top + offset, width, size + extra);\n top += size + extra + this._spacing;\n break;\n case 'right-to-left':\n item.update(left - offset - size - extra, top, size + extra, height);\n left -= size + extra + this._spacing;\n break;\n case 'bottom-to-top':\n item.update(left, top - offset - size - extra, width, size + extra);\n top -= size + extra + this._spacing;\n break;\n default:\n throw 'unreachable';\n }\n }\n }\n\n private _fixed = 0;\n private _spacing = 4;\n private _dirty = false;\n private _sizers: BoxSizer[] = [];\n private _items: LayoutItem[] = [];\n private _box: ElementExt.IBoxSizing | null = null;\n private _alignment: BoxLayout.Alignment = 'start';\n private _direction: BoxLayout.Direction = 'top-to-bottom';\n}\n\n/**\n * The namespace for the `BoxLayout` class statics.\n */\nexport namespace BoxLayout {\n /**\n * A type alias for a box layout direction.\n */\n export type Direction =\n | 'left-to-right'\n | 'right-to-left'\n | 'top-to-bottom'\n | 'bottom-to-top';\n\n /**\n * A type alias for a box layout alignment.\n */\n export type Alignment = 'start' | 'center' | 'end' | 'justify';\n\n /**\n * An options object for initializing a box layout.\n */\n export interface IOptions {\n /**\n * The direction of the layout.\n *\n * The default is `'top-to-bottom'`.\n */\n direction?: Direction;\n\n /**\n * The content alignment of the layout.\n *\n * The default is `'start'`.\n */\n alignment?: Alignment;\n\n /**\n * The spacing between items in the layout.\n *\n * The default is `4`.\n */\n spacing?: number;\n }\n\n /**\n * Get the box layout stretch factor for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The box layout stretch factor for the widget.\n */\n export function getStretch(widget: Widget): number {\n return Private.stretchProperty.get(widget);\n }\n\n /**\n * Set the box layout stretch factor for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the stretch factor.\n */\n export function setStretch(widget: Widget, value: number): void {\n Private.stretchProperty.set(widget, value);\n }\n\n /**\n * Get the box layout size basis for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The box layout size basis for the widget.\n */\n export function getSizeBasis(widget: Widget): number {\n return Private.sizeBasisProperty.get(widget);\n }\n\n /**\n * Set the box layout size basis for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the size basis.\n */\n export function setSizeBasis(widget: Widget, value: number): void {\n Private.sizeBasisProperty.set(widget, value);\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * The property descriptor for a widget stretch factor.\n */\n export const stretchProperty = new AttachedProperty({\n name: 'stretch',\n create: () => 0,\n coerce: (owner, value) => Math.max(0, Math.floor(value)),\n changed: onChildSizingChanged\n });\n\n /**\n * The property descriptor for a widget size basis.\n */\n export const sizeBasisProperty = new AttachedProperty({\n name: 'sizeBasis',\n create: () => 0,\n coerce: (owner, value) => Math.max(0, Math.floor(value)),\n changed: onChildSizingChanged\n });\n\n /**\n * Test whether a direction has horizontal orientation.\n */\n export function isHorizontal(dir: BoxLayout.Direction): boolean {\n return dir === 'left-to-right' || dir === 'right-to-left';\n }\n\n /**\n * Clamp a spacing value to an integer >= 0.\n */\n export function clampSpacing(value: number): number {\n return Math.max(0, Math.floor(value));\n }\n\n /**\n * The change handler for the attached sizing properties.\n */\n function onChildSizingChanged(child: Widget): void {\n if (child.parent && child.parent.layout instanceof BoxLayout) {\n child.parent.fit();\n }\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { BoxLayout } from './boxlayout';\n\nimport { Panel } from './panel';\n\nimport { Widget } from './widget';\n\n/**\n * A panel which arranges its widgets in a single row or column.\n *\n * #### Notes\n * This class provides a convenience wrapper around a {@link BoxLayout}.\n */\nexport class BoxPanel extends Panel {\n /**\n * Construct a new box panel.\n *\n * @param options - The options for initializing the box panel.\n */\n constructor(options: BoxPanel.IOptions = {}) {\n super({ layout: Private.createLayout(options) });\n this.addClass('lm-BoxPanel');\n }\n\n /**\n * Get the layout direction for the box panel.\n */\n get direction(): BoxPanel.Direction {\n return (this.layout as BoxLayout).direction;\n }\n\n /**\n * Set the layout direction for the box panel.\n */\n set direction(value: BoxPanel.Direction) {\n (this.layout as BoxLayout).direction = value;\n }\n\n /**\n * Get the content alignment for the box panel.\n *\n * #### Notes\n * This is the alignment of the widgets in the layout direction.\n *\n * The alignment has no effect if the widgets can expand to fill the\n * entire box layout.\n */\n get alignment(): BoxPanel.Alignment {\n return (this.layout as BoxLayout).alignment;\n }\n\n /**\n * Set the content alignment for the box panel.\n *\n * #### Notes\n * This is the alignment of the widgets in the layout direction.\n *\n * The alignment has no effect if the widgets can expand to fill the\n * entire box layout.\n */\n set alignment(value: BoxPanel.Alignment) {\n (this.layout as BoxLayout).alignment = value;\n }\n\n /**\n * Get the inter-element spacing for the box panel.\n */\n get spacing(): number {\n return (this.layout as BoxLayout).spacing;\n }\n\n /**\n * Set the inter-element spacing for the box panel.\n */\n set spacing(value: number) {\n (this.layout as BoxLayout).spacing = value;\n }\n\n /**\n * A message handler invoked on a `'child-added'` message.\n */\n protected onChildAdded(msg: Widget.ChildMessage): void {\n msg.child.addClass('lm-BoxPanel-child');\n }\n\n /**\n * A message handler invoked on a `'child-removed'` message.\n */\n protected onChildRemoved(msg: Widget.ChildMessage): void {\n msg.child.removeClass('lm-BoxPanel-child');\n }\n}\n\n/**\n * The namespace for the `BoxPanel` class statics.\n */\nexport namespace BoxPanel {\n /**\n * A type alias for a box panel direction.\n */\n export type Direction = BoxLayout.Direction;\n\n /**\n * A type alias for a box panel alignment.\n */\n export type Alignment = BoxLayout.Alignment;\n\n /**\n * An options object for initializing a box panel.\n */\n export interface IOptions {\n /**\n * The layout direction of the panel.\n *\n * Possible values are documented in {@link BoxLayout.Direction}.\n *\n * The default is `'top-to-bottom'`.\n */\n direction?: Direction;\n\n /**\n * The content alignment of the panel.\n *\n * Possible values are documented in {@link BoxLayout.Alignment}.\n *\n * The default is `'start'`.\n */\n alignment?: Alignment;\n\n /**\n * The spacing between items in the panel.\n *\n * The default is `4`.\n */\n spacing?: number;\n\n /**\n * The box layout to use for the box panel.\n *\n * If this is provided, the other options are ignored.\n *\n * The default is a new `BoxLayout`.\n */\n layout?: BoxLayout;\n }\n\n /**\n * Get the box panel stretch factor for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The box panel stretch factor for the widget.\n */\n export function getStretch(widget: Widget): number {\n return BoxLayout.getStretch(widget);\n }\n\n /**\n * Set the box panel stretch factor for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the stretch factor.\n */\n export function setStretch(widget: Widget, value: number): void {\n BoxLayout.setStretch(widget, value);\n }\n\n /**\n * Get the box panel size basis for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The box panel size basis for the widget.\n */\n export function getSizeBasis(widget: Widget): number {\n return BoxLayout.getSizeBasis(widget);\n }\n\n /**\n * Set the box panel size basis for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the size basis.\n */\n export function setSizeBasis(widget: Widget, value: number): void {\n BoxLayout.setSizeBasis(widget, value);\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * Create a box layout for the given panel options.\n */\n export function createLayout(options: BoxPanel.IOptions): BoxLayout {\n return options.layout || new BoxLayout(options);\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt, StringExt } from '@lumino/algorithm';\n\nimport { JSONExt, ReadonlyJSONObject } from '@lumino/coreutils';\n\nimport { CommandRegistry } from '@lumino/commands';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message } from '@lumino/messaging';\n\nimport {\n ElementDataset,\n h,\n VirtualDOM,\n VirtualElement\n} from '@lumino/virtualdom';\n\nimport { Widget } from './widget';\n\n/**\n * A widget which displays command items as a searchable palette.\n */\nexport class CommandPalette extends Widget {\n /**\n * Construct a new command palette.\n *\n * @param options - The options for initializing the palette.\n */\n constructor(options: CommandPalette.IOptions) {\n super({ node: Private.createNode() });\n this.addClass('lm-CommandPalette');\n this.setFlag(Widget.Flag.DisallowLayout);\n this.commands = options.commands;\n this.renderer = options.renderer || CommandPalette.defaultRenderer;\n this.commands.commandChanged.connect(this._onGenericChange, this);\n this.commands.keyBindingChanged.connect(this._onGenericChange, this);\n }\n\n /**\n * Dispose of the resources held by the widget.\n */\n dispose(): void {\n this._items.length = 0;\n this._results = null;\n super.dispose();\n }\n\n /**\n * The command registry used by the command palette.\n */\n readonly commands: CommandRegistry;\n\n /**\n * The renderer used by the command palette.\n */\n readonly renderer: CommandPalette.IRenderer;\n\n /**\n * The command palette search node.\n *\n * #### Notes\n * This is the node which contains the search-related elements.\n */\n get searchNode(): HTMLDivElement {\n return this.node.getElementsByClassName(\n 'lm-CommandPalette-search'\n )[0] as HTMLDivElement;\n }\n\n /**\n * The command palette input node.\n *\n * #### Notes\n * This is the actual input node for the search area.\n */\n get inputNode(): HTMLInputElement {\n return this.node.getElementsByClassName(\n 'lm-CommandPalette-input'\n )[0] as HTMLInputElement;\n }\n\n /**\n * The command palette content node.\n *\n * #### Notes\n * This is the node which holds the command item nodes.\n *\n * Modifying this node directly can lead to undefined behavior.\n */\n get contentNode(): HTMLUListElement {\n return this.node.getElementsByClassName(\n 'lm-CommandPalette-content'\n )[0] as HTMLUListElement;\n }\n\n /**\n * A read-only array of the command items in the palette.\n */\n get items(): ReadonlyArray {\n return this._items;\n }\n\n /**\n * Add a command item to the command palette.\n *\n * @param options - The options for creating the command item.\n *\n * @returns The command item added to the palette.\n */\n addItem(options: CommandPalette.IItemOptions): CommandPalette.IItem {\n // Create a new command item for the options.\n let item = Private.createItem(this.commands, options);\n\n // Add the item to the array.\n this._items.push(item);\n\n // Refresh the search results.\n this.refresh();\n\n // Return the item added to the palette.\n return item;\n }\n\n /**\n * Adds command items to the command palette.\n *\n * @param items - An array of options for creating each command item.\n *\n * @returns The command items added to the palette.\n */\n addItems(items: CommandPalette.IItemOptions[]): CommandPalette.IItem[] {\n const newItems = items.map(item => Private.createItem(this.commands, item));\n newItems.forEach(item => this._items.push(item));\n this.refresh();\n return newItems;\n }\n\n /**\n * Remove an item from the command palette.\n *\n * @param item - The item to remove from the palette.\n *\n * #### Notes\n * This is a no-op if the item is not in the palette.\n */\n removeItem(item: CommandPalette.IItem): void {\n this.removeItemAt(this._items.indexOf(item));\n }\n\n /**\n * Remove the item at a given index from the command palette.\n *\n * @param index - The index of the item to remove.\n *\n * #### Notes\n * This is a no-op if the index is out of range.\n */\n removeItemAt(index: number): void {\n // Remove the item from the array.\n let item = ArrayExt.removeAt(this._items, index);\n\n // Bail if the index is out of range.\n if (!item) {\n return;\n }\n\n // Refresh the search results.\n this.refresh();\n }\n\n /**\n * Remove all items from the command palette.\n */\n clearItems(): void {\n // Bail if there is nothing to remove.\n if (this._items.length === 0) {\n return;\n }\n\n // Clear the array of items.\n this._items.length = 0;\n\n // Refresh the search results.\n this.refresh();\n }\n\n /**\n * Clear the search results and schedule an update.\n *\n * #### Notes\n * This should be called whenever the search results of the palette\n * should be updated.\n *\n * This is typically called automatically by the palette as needed,\n * but can be called manually if the input text is programatically\n * changed.\n *\n * The rendered results are updated asynchronously.\n */\n refresh(): void {\n this._results = null;\n if (this.inputNode.value !== '') {\n let clear = this.node.getElementsByClassName(\n 'lm-close-icon'\n )[0] as HTMLInputElement;\n clear.style.display = 'inherit';\n } else {\n let clear = this.node.getElementsByClassName(\n 'lm-close-icon'\n )[0] as HTMLInputElement;\n clear.style.display = 'none';\n }\n this.update();\n }\n\n /**\n * Handle the DOM events for the command palette.\n *\n * @param event - The DOM event sent to the command palette.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the command palette's DOM node.\n * It should not be called directly by user code.\n */\n handleEvent(event: Event): void {\n switch (event.type) {\n case 'click':\n this._evtClick(event as MouseEvent);\n break;\n case 'keydown':\n this._evtKeyDown(event as KeyboardEvent);\n break;\n case 'input':\n this.refresh();\n break;\n case 'focus':\n case 'blur':\n this._toggleFocused();\n break;\n }\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n this.node.addEventListener('click', this);\n this.node.addEventListener('keydown', this);\n this.node.addEventListener('input', this);\n this.node.addEventListener('focus', this, true);\n this.node.addEventListener('blur', this, true);\n }\n\n /**\n * A message handler invoked on an `'after-detach'` message.\n */\n protected onAfterDetach(msg: Message): void {\n this.node.removeEventListener('click', this);\n this.node.removeEventListener('keydown', this);\n this.node.removeEventListener('input', this);\n this.node.removeEventListener('focus', this, true);\n this.node.removeEventListener('blur', this, true);\n }\n\n /**\n * A message handler invoked on an `'after-show'` message.\n */\n protected onAfterShow(msg: Message): void {\n this.update();\n super.onAfterShow(msg);\n }\n\n /**\n * A message handler invoked on an `'activate-request'` message.\n */\n protected onActivateRequest(msg: Message): void {\n if (this.isAttached) {\n let input = this.inputNode;\n input.focus();\n input.select();\n }\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n protected onUpdateRequest(msg: Message): void {\n if (!this.isVisible) {\n // Ensure to clear the content if the widget is hidden\n VirtualDOM.render(null, this.contentNode);\n return;\n }\n\n // Fetch the current query text and content node.\n let query = this.inputNode.value;\n let contentNode = this.contentNode;\n\n // Ensure the search results are generated.\n let results = this._results;\n if (!results) {\n // Generate and store the new search results.\n results = this._results = Private.search(this._items, query);\n\n // Reset the active index.\n this._activeIndex = query\n ? ArrayExt.findFirstIndex(results, Private.canActivate)\n : -1;\n }\n\n // If there is no query and no results, clear the content.\n if (!query && results.length === 0) {\n VirtualDOM.render(null, contentNode);\n return;\n }\n\n // If the is a query but no results, render the empty message.\n if (query && results.length === 0) {\n let content = this.renderer.renderEmptyMessage({ query });\n VirtualDOM.render(content, contentNode);\n return;\n }\n\n // Create the render content for the search results.\n let renderer = this.renderer;\n let activeIndex = this._activeIndex;\n let content = new Array(results.length);\n for (let i = 0, n = results.length; i < n; ++i) {\n let result = results[i];\n if (result.type === 'header') {\n let indices = result.indices;\n let category = result.category;\n content[i] = renderer.renderHeader({ category, indices });\n } else {\n let item = result.item;\n let indices = result.indices;\n let active = i === activeIndex;\n content[i] = renderer.renderItem({ item, indices, active });\n }\n }\n\n // Render the search result content.\n VirtualDOM.render(content, contentNode);\n\n // Adjust the scroll position as needed.\n if (activeIndex < 0 || activeIndex >= results.length) {\n contentNode.scrollTop = 0;\n } else {\n let element = contentNode.children[activeIndex];\n ElementExt.scrollIntoViewIfNeeded(contentNode, element);\n }\n }\n\n /**\n * Handle the `'click'` event for the command palette.\n */\n private _evtClick(event: MouseEvent): void {\n // Bail if the click is not the left button.\n if (event.button !== 0) {\n return;\n }\n\n // Clear input if the target is clear button\n if ((event.target as HTMLElement).classList.contains('lm-close-icon')) {\n this.inputNode.value = '';\n this.refresh();\n return;\n }\n\n // Find the index of the item which was clicked.\n let index = ArrayExt.findFirstIndex(this.contentNode.children, node => {\n return node.contains(event.target as HTMLElement);\n });\n\n // Bail if the click was not on an item.\n if (index === -1) {\n return;\n }\n\n // Kill the event when a content item is clicked.\n event.preventDefault();\n event.stopPropagation();\n\n // Execute the item if possible.\n this._execute(index);\n }\n\n /**\n * Handle the `'keydown'` event for the command palette.\n */\n private _evtKeyDown(event: KeyboardEvent): void {\n if (event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) {\n return;\n }\n switch (event.keyCode) {\n case 13: // Enter\n event.preventDefault();\n event.stopPropagation();\n this._execute(this._activeIndex);\n break;\n case 38: // Up Arrow\n event.preventDefault();\n event.stopPropagation();\n this._activatePreviousItem();\n break;\n case 40: // Down Arrow\n event.preventDefault();\n event.stopPropagation();\n this._activateNextItem();\n break;\n }\n }\n\n /**\n * Activate the next enabled command item.\n */\n private _activateNextItem(): void {\n // Bail if there are no search results.\n if (!this._results || this._results.length === 0) {\n return;\n }\n\n // Find the next enabled item index.\n let ai = this._activeIndex;\n let n = this._results.length;\n let start = ai < n - 1 ? ai + 1 : 0;\n let stop = start === 0 ? n - 1 : start - 1;\n this._activeIndex = ArrayExt.findFirstIndex(\n this._results,\n Private.canActivate,\n start,\n stop\n );\n\n // Schedule an update of the items.\n this.update();\n }\n\n /**\n * Activate the previous enabled command item.\n */\n private _activatePreviousItem(): void {\n // Bail if there are no search results.\n if (!this._results || this._results.length === 0) {\n return;\n }\n\n // Find the previous enabled item index.\n let ai = this._activeIndex;\n let n = this._results.length;\n let start = ai <= 0 ? n - 1 : ai - 1;\n let stop = start === n - 1 ? 0 : start + 1;\n this._activeIndex = ArrayExt.findLastIndex(\n this._results,\n Private.canActivate,\n start,\n stop\n );\n\n // Schedule an update of the items.\n this.update();\n }\n\n /**\n * Execute the command item at the given index, if possible.\n */\n private _execute(index: number): void {\n // Bail if there are no search results.\n if (!this._results) {\n return;\n }\n\n // Bail if the index is out of range.\n let part = this._results[index];\n if (!part) {\n return;\n }\n\n // Update the search text if the item is a header.\n if (part.type === 'header') {\n let input = this.inputNode;\n input.value = `${part.category.toLowerCase()} `;\n input.focus();\n this.refresh();\n return;\n }\n\n // Bail if item is not enabled.\n if (!part.item.isEnabled) {\n return;\n }\n\n // Execute the item.\n this.commands.execute(part.item.command, part.item.args);\n\n // Clear the query text.\n this.inputNode.value = '';\n\n // Refresh the search results.\n this.refresh();\n }\n\n /**\n * Toggle the focused modifier based on the input node focus state.\n */\n private _toggleFocused(): void {\n let focused = document.activeElement === this.inputNode;\n this.toggleClass('lm-mod-focused', focused);\n }\n\n /**\n * A signal handler for generic command changes.\n */\n private _onGenericChange(): void {\n this.refresh();\n }\n\n private _activeIndex = -1;\n private _items: CommandPalette.IItem[] = [];\n private _results: Private.SearchResult[] | null = null;\n}\n\n/**\n * The namespace for the `CommandPalette` class statics.\n */\nexport namespace CommandPalette {\n /**\n * An options object for creating a command palette.\n */\n export interface IOptions {\n /**\n * The command registry for use with the command palette.\n */\n commands: CommandRegistry;\n\n /**\n * A custom renderer for use with the command palette.\n *\n * The default is a shared renderer instance.\n */\n renderer?: IRenderer;\n }\n\n /**\n * An options object for creating a command item.\n */\n export interface IItemOptions {\n /**\n * The category for the item.\n */\n category: string;\n\n /**\n * The command to execute when the item is triggered.\n */\n command: string;\n\n /**\n * The arguments for the command.\n *\n * The default value is an empty object.\n */\n args?: ReadonlyJSONObject;\n\n /**\n * The rank for the command item.\n *\n * The rank is used as a tie-breaker when ordering command items\n * for display. Items are sorted in the following order:\n * 1. Text match (lower is better)\n * 2. Category (locale order)\n * 3. Rank (lower is better)\n * 4. Label (locale order)\n *\n * The default rank is `Infinity`.\n */\n rank?: number;\n }\n\n /**\n * An object which represents an item in a command palette.\n *\n * #### Notes\n * Item objects are created automatically by a command palette.\n */\n export interface IItem {\n /**\n * The command to execute when the item is triggered.\n */\n readonly command: string;\n\n /**\n * The arguments for the command.\n */\n readonly args: ReadonlyJSONObject;\n\n /**\n * The category for the command item.\n */\n readonly category: string;\n\n /**\n * The rank for the command item.\n */\n readonly rank: number;\n\n /**\n * The display label for the command item.\n */\n readonly label: string;\n\n /**\n * The display caption for the command item.\n */\n readonly caption: string;\n\n /**\n * The icon renderer for the command item.\n */\n readonly icon: VirtualElement.IRenderer | undefined;\n\n /**\n * The icon class for the command item.\n */\n readonly iconClass: string;\n\n /**\n * The icon label for the command item.\n */\n readonly iconLabel: string;\n\n /**\n * The extra class name for the command item.\n */\n readonly className: string;\n\n /**\n * The dataset for the command item.\n */\n readonly dataset: CommandRegistry.Dataset;\n\n /**\n * Whether the command item is enabled.\n */\n readonly isEnabled: boolean;\n\n /**\n * Whether the command item is toggled.\n */\n readonly isToggled: boolean;\n\n /**\n * Whether the command item is toggleable.\n */\n readonly isToggleable: boolean;\n\n /**\n * Whether the command item is visible.\n */\n readonly isVisible: boolean;\n\n /**\n * The key binding for the command item.\n */\n readonly keyBinding: CommandRegistry.IKeyBinding | null;\n }\n\n /**\n * The render data for a command palette header.\n */\n export interface IHeaderRenderData {\n /**\n * The category of the header.\n */\n readonly category: string;\n\n /**\n * The indices of the matched characters in the category.\n */\n readonly indices: ReadonlyArray | null;\n }\n\n /**\n * The render data for a command palette item.\n */\n export interface IItemRenderData {\n /**\n * The command palette item to render.\n */\n readonly item: IItem;\n\n /**\n * The indices of the matched characters in the label.\n */\n readonly indices: ReadonlyArray | null;\n\n /**\n * Whether the item is the active item.\n */\n readonly active: boolean;\n }\n\n /**\n * The render data for a command palette empty message.\n */\n export interface IEmptyMessageRenderData {\n /**\n * The query which failed to match any commands.\n */\n query: string;\n }\n\n /**\n * A renderer for use with a command palette.\n */\n export interface IRenderer {\n /**\n * Render the virtual element for a command palette header.\n *\n * @param data - The data to use for rendering the header.\n *\n * @returns A virtual element representing the header.\n */\n renderHeader(data: IHeaderRenderData): VirtualElement;\n\n /**\n * Render the virtual element for a command palette item.\n *\n * @param data - The data to use for rendering the item.\n *\n * @returns A virtual element representing the item.\n *\n * #### Notes\n * The command palette will not render invisible items.\n */\n renderItem(data: IItemRenderData): VirtualElement;\n\n /**\n * Render the empty results message for a command palette.\n *\n * @param data - The data to use for rendering the message.\n *\n * @returns A virtual element representing the message.\n */\n renderEmptyMessage(data: IEmptyMessageRenderData): VirtualElement;\n }\n\n /**\n * The default implementation of `IRenderer`.\n */\n export class Renderer implements IRenderer {\n /**\n * Render the virtual element for a command palette header.\n *\n * @param data - The data to use for rendering the header.\n *\n * @returns A virtual element representing the header.\n */\n renderHeader(data: IHeaderRenderData): VirtualElement {\n let content = this.formatHeader(data);\n return h.li({ className: 'lm-CommandPalette-header' }, content);\n }\n\n /**\n * Render the virtual element for a command palette item.\n *\n * @param data - The data to use for rendering the item.\n *\n * @returns A virtual element representing the item.\n */\n renderItem(data: IItemRenderData): VirtualElement {\n let className = this.createItemClass(data);\n let dataset = this.createItemDataset(data);\n if (data.item.isToggleable) {\n return h.li(\n {\n className,\n dataset,\n role: 'menuitemcheckbox',\n 'aria-checked': `${data.item.isToggled}`\n },\n this.renderItemIcon(data),\n this.renderItemContent(data),\n this.renderItemShortcut(data)\n );\n }\n return h.li(\n {\n className,\n dataset,\n role: 'menuitem'\n },\n this.renderItemIcon(data),\n this.renderItemContent(data),\n this.renderItemShortcut(data)\n );\n }\n\n /**\n * Render the empty results message for a command palette.\n *\n * @param data - The data to use for rendering the message.\n *\n * @returns A virtual element representing the message.\n */\n renderEmptyMessage(data: IEmptyMessageRenderData): VirtualElement {\n let content = this.formatEmptyMessage(data);\n return h.li({ className: 'lm-CommandPalette-emptyMessage' }, content);\n }\n\n /**\n * Render the icon for a command palette item.\n *\n * @param data - The data to use for rendering the icon.\n *\n * @returns A virtual element representing the icon.\n */\n renderItemIcon(data: IItemRenderData): VirtualElement {\n let className = this.createIconClass(data);\n\n // If data.item.icon is undefined, it will be ignored.\n return h.div({ className }, data.item.icon!, data.item.iconLabel);\n }\n\n /**\n * Render the content for a command palette item.\n *\n * @param data - The data to use for rendering the content.\n *\n * @returns A virtual element representing the content.\n */\n renderItemContent(data: IItemRenderData): VirtualElement {\n return h.div(\n { className: 'lm-CommandPalette-itemContent' },\n this.renderItemLabel(data),\n this.renderItemCaption(data)\n );\n }\n\n /**\n * Render the label for a command palette item.\n *\n * @param data - The data to use for rendering the label.\n *\n * @returns A virtual element representing the label.\n */\n renderItemLabel(data: IItemRenderData): VirtualElement {\n let content = this.formatItemLabel(data);\n return h.div({ className: 'lm-CommandPalette-itemLabel' }, content);\n }\n\n /**\n * Render the caption for a command palette item.\n *\n * @param data - The data to use for rendering the caption.\n *\n * @returns A virtual element representing the caption.\n */\n renderItemCaption(data: IItemRenderData): VirtualElement {\n let content = this.formatItemCaption(data);\n return h.div({ className: 'lm-CommandPalette-itemCaption' }, content);\n }\n\n /**\n * Render the shortcut for a command palette item.\n *\n * @param data - The data to use for rendering the shortcut.\n *\n * @returns A virtual element representing the shortcut.\n */\n renderItemShortcut(data: IItemRenderData): VirtualElement {\n let content = this.formatItemShortcut(data);\n return h.div({ className: 'lm-CommandPalette-itemShortcut' }, content);\n }\n\n /**\n * Create the class name for the command palette item.\n *\n * @param data - The data to use for the class name.\n *\n * @returns The full class name for the command palette item.\n */\n createItemClass(data: IItemRenderData): string {\n // Set up the initial class name.\n let name = 'lm-CommandPalette-item';\n\n // Add the boolean state classes.\n if (!data.item.isEnabled) {\n name += ' lm-mod-disabled';\n }\n if (data.item.isToggled) {\n name += ' lm-mod-toggled';\n }\n if (data.active) {\n name += ' lm-mod-active';\n }\n\n // Add the extra class.\n let extra = data.item.className;\n if (extra) {\n name += ` ${extra}`;\n }\n\n // Return the complete class name.\n return name;\n }\n\n /**\n * Create the dataset for the command palette item.\n *\n * @param data - The data to use for creating the dataset.\n *\n * @returns The dataset for the command palette item.\n */\n createItemDataset(data: IItemRenderData): ElementDataset {\n return { ...data.item.dataset, command: data.item.command };\n }\n\n /**\n * Create the class name for the command item icon.\n *\n * @param data - The data to use for the class name.\n *\n * @returns The full class name for the item icon.\n */\n createIconClass(data: IItemRenderData): string {\n let name = 'lm-CommandPalette-itemIcon';\n let extra = data.item.iconClass;\n return extra ? `${name} ${extra}` : name;\n }\n\n /**\n * Create the render content for the header node.\n *\n * @param data - The data to use for the header content.\n *\n * @returns The content to add to the header node.\n */\n formatHeader(data: IHeaderRenderData): h.Child {\n if (!data.indices || data.indices.length === 0) {\n return data.category;\n }\n return StringExt.highlight(data.category, data.indices, h.mark);\n }\n\n /**\n * Create the render content for the empty message node.\n *\n * @param data - The data to use for the empty message content.\n *\n * @returns The content to add to the empty message node.\n */\n formatEmptyMessage(data: IEmptyMessageRenderData): h.Child {\n return `No commands found that match '${data.query}'`;\n }\n\n /**\n * Create the render content for the item shortcut node.\n *\n * @param data - The data to use for the shortcut content.\n *\n * @returns The content to add to the shortcut node.\n */\n formatItemShortcut(data: IItemRenderData): h.Child {\n let kb = data.item.keyBinding;\n return kb ? CommandRegistry.formatKeystroke(kb.keys) : null;\n }\n\n /**\n * Create the render content for the item label node.\n *\n * @param data - The data to use for the label content.\n *\n * @returns The content to add to the label node.\n */\n formatItemLabel(data: IItemRenderData): h.Child {\n if (!data.indices || data.indices.length === 0) {\n return data.item.label;\n }\n return StringExt.highlight(data.item.label, data.indices, h.mark);\n }\n\n /**\n * Create the render content for the item caption node.\n *\n * @param data - The data to use for the caption content.\n *\n * @returns The content to add to the caption node.\n */\n formatItemCaption(data: IItemRenderData): h.Child {\n return data.item.caption;\n }\n }\n\n /**\n * The default `Renderer` instance.\n */\n export const defaultRenderer = new Renderer();\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * Create the DOM node for a command palette.\n */\n export function createNode(): HTMLDivElement {\n let node = document.createElement('div');\n let search = document.createElement('div');\n let wrapper = document.createElement('div');\n let input = document.createElement('input');\n let content = document.createElement('ul');\n let clear = document.createElement('button');\n search.className = 'lm-CommandPalette-search';\n wrapper.className = 'lm-CommandPalette-wrapper';\n input.className = 'lm-CommandPalette-input';\n clear.className = 'lm-close-icon';\n\n content.className = 'lm-CommandPalette-content';\n content.setAttribute('role', 'menu');\n input.spellcheck = false;\n wrapper.appendChild(input);\n wrapper.appendChild(clear);\n search.appendChild(wrapper);\n node.appendChild(search);\n node.appendChild(content);\n return node;\n }\n\n /**\n * Create a new command item from a command registry and options.\n */\n export function createItem(\n commands: CommandRegistry,\n options: CommandPalette.IItemOptions\n ): CommandPalette.IItem {\n return new CommandItem(commands, options);\n }\n\n /**\n * A search result object for a header label.\n */\n export interface IHeaderResult {\n /**\n * The discriminated type of the object.\n */\n readonly type: 'header';\n\n /**\n * The category for the header.\n */\n readonly category: string;\n\n /**\n * The indices of the matched category characters.\n */\n readonly indices: ReadonlyArray | null;\n }\n\n /**\n * A search result object for a command item.\n */\n export interface IItemResult {\n /**\n * The discriminated type of the object.\n */\n readonly type: 'item';\n\n /**\n * The command item which was matched.\n */\n readonly item: CommandPalette.IItem;\n\n /**\n * The indices of the matched label characters.\n */\n readonly indices: ReadonlyArray | null;\n }\n\n /**\n * A type alias for a search result item.\n */\n export type SearchResult = IHeaderResult | IItemResult;\n\n /**\n * Search an array of command items for fuzzy matches.\n */\n export function search(\n items: CommandPalette.IItem[],\n query: string\n ): SearchResult[] {\n // Fuzzy match the items for the query.\n let scores = matchItems(items, query);\n\n // Sort the items based on their score.\n scores.sort(scoreCmp);\n\n // Create the results for the search.\n return createResults(scores);\n }\n\n /**\n * Test whether a result item can be activated.\n */\n export function canActivate(result: SearchResult): boolean {\n return result.type === 'item' && result.item.isEnabled;\n }\n\n /**\n * Normalize a category for a command item.\n */\n function normalizeCategory(category: string): string {\n return category.trim().replace(/\\s+/g, ' ');\n }\n\n /**\n * Normalize the query text for a fuzzy search.\n */\n function normalizeQuery(text: string): string {\n return text.replace(/\\s+/g, '').toLowerCase();\n }\n\n /**\n * An enum of the supported match types.\n */\n const enum MatchType {\n Label,\n Category,\n Split,\n Default\n }\n\n /**\n * A text match score with associated command item.\n */\n interface IScore {\n /**\n * The numerical type for the text match.\n */\n matchType: MatchType;\n\n /**\n * The numerical score for the text match.\n */\n score: number;\n\n /**\n * The indices of the matched category characters.\n */\n categoryIndices: number[] | null;\n\n /**\n * The indices of the matched label characters.\n */\n labelIndices: number[] | null;\n\n /**\n * The command item associated with the match.\n */\n item: CommandPalette.IItem;\n }\n\n /**\n * Perform a fuzzy match on an array of command items.\n */\n function matchItems(items: CommandPalette.IItem[], query: string): IScore[] {\n // Normalize the query text to lower case with no whitespace.\n query = normalizeQuery(query);\n\n // Create the array to hold the scores.\n let scores: IScore[] = [];\n\n // Iterate over the items and match against the query.\n for (let i = 0, n = items.length; i < n; ++i) {\n // Ignore items which are not visible.\n let item = items[i];\n if (!item.isVisible) {\n continue;\n }\n\n // If the query is empty, all items are matched by default.\n if (!query) {\n scores.push({\n matchType: MatchType.Default,\n categoryIndices: null,\n labelIndices: null,\n score: 0,\n item\n });\n continue;\n }\n\n // Run the fuzzy search for the item and query.\n let score = fuzzySearch(item, query);\n\n // Ignore the item if it is not a match.\n if (!score) {\n continue;\n }\n\n // Penalize disabled items.\n // TODO - push disabled items all the way down in sort cmp?\n if (!item.isEnabled) {\n score.score += 1000;\n }\n\n // Add the score to the results.\n scores.push(score);\n }\n\n // Return the final array of scores.\n return scores;\n }\n\n /**\n * Perform a fuzzy search on a single command item.\n */\n function fuzzySearch(\n item: CommandPalette.IItem,\n query: string\n ): IScore | null {\n // Create the source text to be searched.\n let category = item.category.toLowerCase();\n let label = item.label.toLowerCase();\n let source = `${category} ${label}`;\n\n // Set up the match score and indices array.\n let score = Infinity;\n let indices: number[] | null = null;\n\n // The regex for search word boundaries\n let rgx = /\\b\\w/g;\n\n // Search the source by word boundary.\n // eslint-disable-next-line no-constant-condition\n while (true) {\n // Find the next word boundary in the source.\n let rgxMatch = rgx.exec(source);\n\n // Break if there is no more source context.\n if (!rgxMatch) {\n break;\n }\n\n // Run the string match on the relevant substring.\n let match = StringExt.matchSumOfDeltas(source, query, rgxMatch.index);\n\n // Break if there is no match.\n if (!match) {\n break;\n }\n\n // Update the match if the score is better.\n if (match.score <= score) {\n score = match.score;\n indices = match.indices;\n }\n }\n\n // Bail if there was no match.\n if (!indices || score === Infinity) {\n return null;\n }\n\n // Compute the pivot index between category and label text.\n let pivot = category.length + 1;\n\n // Find the slice index to separate matched indices.\n let j = ArrayExt.lowerBound(indices, pivot, (a, b) => a - b);\n\n // Extract the matched category and label indices.\n let categoryIndices = indices.slice(0, j);\n let labelIndices = indices.slice(j);\n\n // Adjust the label indices for the pivot offset.\n for (let i = 0, n = labelIndices.length; i < n; ++i) {\n labelIndices[i] -= pivot;\n }\n\n // Handle a pure label match.\n if (categoryIndices.length === 0) {\n return {\n matchType: MatchType.Label,\n categoryIndices: null,\n labelIndices,\n score,\n item\n };\n }\n\n // Handle a pure category match.\n if (labelIndices.length === 0) {\n return {\n matchType: MatchType.Category,\n categoryIndices,\n labelIndices: null,\n score,\n item\n };\n }\n\n // Handle a split match.\n return {\n matchType: MatchType.Split,\n categoryIndices,\n labelIndices,\n score,\n item\n };\n }\n\n /**\n * A sort comparison function for a match score.\n */\n function scoreCmp(a: IScore, b: IScore): number {\n // First compare based on the match type\n let m1 = a.matchType - b.matchType;\n if (m1 !== 0) {\n return m1;\n }\n\n // Otherwise, compare based on the match score.\n let d1 = a.score - b.score;\n if (d1 !== 0) {\n return d1;\n }\n\n // Find the match index based on the match type.\n let i1 = 0;\n let i2 = 0;\n switch (a.matchType) {\n case MatchType.Label:\n i1 = a.labelIndices![0];\n i2 = b.labelIndices![0];\n break;\n case MatchType.Category:\n case MatchType.Split:\n i1 = a.categoryIndices![0];\n i2 = b.categoryIndices![0];\n break;\n }\n\n // Compare based on the match index.\n if (i1 !== i2) {\n return i1 - i2;\n }\n\n // Otherwise, compare by category.\n let d2 = a.item.category.localeCompare(b.item.category);\n if (d2 !== 0) {\n return d2;\n }\n\n // Otherwise, compare by rank.\n let r1 = a.item.rank;\n let r2 = b.item.rank;\n if (r1 !== r2) {\n return r1 < r2 ? -1 : 1; // Infinity safe\n }\n\n // Finally, compare by label.\n return a.item.label.localeCompare(b.item.label);\n }\n\n /**\n * Create the results from an array of sorted scores.\n */\n function createResults(scores: IScore[]): SearchResult[] {\n // Set up the search results array.\n let results: SearchResult[] = [];\n\n // Iterate over each score in the array.\n for (let i = 0, n = scores.length; i < n; ++i) {\n // Extract the current item and indices.\n let { item, categoryIndices, labelIndices } = scores[i];\n\n // Extract the category for the current item.\n let category = item.category;\n\n // Is this the same category as the preceding result?\n if (i === 0 || category !== scores[i - 1].item.category) {\n // Add the header result for the category.\n results.push({ type: 'header', category, indices: categoryIndices });\n }\n\n // Create the item result for the score.\n results.push({ type: 'item', item, indices: labelIndices });\n }\n\n // Return the final results.\n return results;\n }\n\n /**\n * A concrete implementation of `CommandPalette.IItem`.\n */\n class CommandItem implements CommandPalette.IItem {\n /**\n * Construct a new command item.\n */\n constructor(\n commands: CommandRegistry,\n options: CommandPalette.IItemOptions\n ) {\n this._commands = commands;\n this.category = normalizeCategory(options.category);\n this.command = options.command;\n this.args = options.args || JSONExt.emptyObject;\n this.rank = options.rank !== undefined ? options.rank : Infinity;\n }\n\n /**\n * The category for the command item.\n */\n readonly category: string;\n\n /**\n * The command to execute when the item is triggered.\n */\n readonly command: string;\n\n /**\n * The arguments for the command.\n */\n readonly args: ReadonlyJSONObject;\n\n /**\n * The rank for the command item.\n */\n readonly rank: number;\n\n /**\n * The display label for the command item.\n */\n get label(): string {\n return this._commands.label(this.command, this.args);\n }\n\n /**\n * The icon renderer for the command item.\n */\n get icon(): VirtualElement.IRenderer | undefined {\n return this._commands.icon(this.command, this.args);\n }\n\n /**\n * The icon class for the command item.\n */\n get iconClass(): string {\n return this._commands.iconClass(this.command, this.args);\n }\n\n /**\n * The icon label for the command item.\n */\n get iconLabel(): string {\n return this._commands.iconLabel(this.command, this.args);\n }\n\n /**\n * The display caption for the command item.\n */\n get caption(): string {\n return this._commands.caption(this.command, this.args);\n }\n\n /**\n * The extra class name for the command item.\n */\n get className(): string {\n return this._commands.className(this.command, this.args);\n }\n\n /**\n * The dataset for the command item.\n */\n get dataset(): CommandRegistry.Dataset {\n return this._commands.dataset(this.command, this.args);\n }\n\n /**\n * Whether the command item is enabled.\n */\n get isEnabled(): boolean {\n return this._commands.isEnabled(this.command, this.args);\n }\n\n /**\n * Whether the command item is toggled.\n */\n get isToggled(): boolean {\n return this._commands.isToggled(this.command, this.args);\n }\n\n /**\n * Whether the command item is toggleable.\n */\n get isToggleable(): boolean {\n return this._commands.isToggleable(this.command, this.args);\n }\n\n /**\n * Whether the command item is visible.\n */\n get isVisible(): boolean {\n return this._commands.isVisible(this.command, this.args);\n }\n\n /**\n * The key binding for the command item.\n */\n get keyBinding(): CommandRegistry.IKeyBinding | null {\n let { command, args } = this;\n return (\n ArrayExt.findLastValue(this._commands.keyBindings, kb => {\n return kb.command === command && JSONExt.deepEqual(kb.args, args);\n }) || null\n );\n }\n\n private _commands: CommandRegistry;\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { CommandRegistry } from '@lumino/commands';\n\nimport { JSONExt, ReadonlyJSONObject } from '@lumino/coreutils';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { getKeyboardLayout } from '@lumino/keyboard';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport {\n ARIAAttrNames,\n ElementARIAAttrs,\n ElementDataset,\n h,\n VirtualDOM,\n VirtualElement\n} from '@lumino/virtualdom';\n\nimport { Widget } from './widget';\n\ninterface IWindowData {\n pageXOffset: number;\n pageYOffset: number;\n clientWidth: number;\n clientHeight: number;\n}\n\n/**\n * A widget which displays items as a canonical menu.\n */\nexport class Menu extends Widget {\n /**\n * Construct a new menu.\n *\n * @param options - The options for initializing the menu.\n */\n constructor(options: Menu.IOptions) {\n super({ node: Private.createNode() });\n this.addClass('lm-Menu');\n this.setFlag(Widget.Flag.DisallowLayout);\n this.commands = options.commands;\n this.renderer = options.renderer || Menu.defaultRenderer;\n }\n\n /**\n * Dispose of the resources held by the menu.\n */\n dispose(): void {\n this.close();\n this._items.length = 0;\n super.dispose();\n }\n\n /**\n * A signal emitted just before the menu is closed.\n *\n * #### Notes\n * This signal is emitted when the menu receives a `'close-request'`\n * message, just before it removes itself from the DOM.\n *\n * This signal is not emitted if the menu is already detached from\n * the DOM when it receives the `'close-request'` message.\n */\n get aboutToClose(): ISignal {\n return this._aboutToClose;\n }\n\n /**\n * A signal emitted when a new menu is requested by the user.\n *\n * #### Notes\n * This signal is emitted whenever the user presses the right or left\n * arrow keys, and a submenu cannot be opened or closed in response.\n *\n * This signal is useful when implementing menu bars in order to open\n * the next or previous menu in response to a user key press.\n *\n * This signal is only emitted for the root menu in a hierarchy.\n */\n get menuRequested(): ISignal {\n return this._menuRequested;\n }\n\n /**\n * The command registry used by the menu.\n */\n readonly commands: CommandRegistry;\n\n /**\n * The renderer used by the menu.\n */\n readonly renderer: Menu.IRenderer;\n\n /**\n * The parent menu of the menu.\n *\n * #### Notes\n * This is `null` unless the menu is an open submenu.\n */\n get parentMenu(): Menu | null {\n return this._parentMenu;\n }\n\n /**\n * The child menu of the menu.\n *\n * #### Notes\n * This is `null` unless the menu has an open submenu.\n */\n get childMenu(): Menu | null {\n return this._childMenu;\n }\n\n /**\n * The root menu of the menu hierarchy.\n */\n get rootMenu(): Menu {\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n let menu: Menu = this;\n while (menu._parentMenu) {\n menu = menu._parentMenu;\n }\n return menu;\n }\n\n /**\n * The leaf menu of the menu hierarchy.\n */\n get leafMenu(): Menu {\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n let menu: Menu = this;\n while (menu._childMenu) {\n menu = menu._childMenu;\n }\n return menu;\n }\n\n /**\n * The menu content node.\n *\n * #### Notes\n * This is the node which holds the menu item nodes.\n *\n * Modifying this node directly can lead to undefined behavior.\n */\n get contentNode(): HTMLUListElement {\n return this.node.getElementsByClassName(\n 'lm-Menu-content'\n )[0] as HTMLUListElement;\n }\n\n /**\n * Get the currently active menu item.\n */\n get activeItem(): Menu.IItem | null {\n return this._items[this._activeIndex] || null;\n }\n\n /**\n * Set the currently active menu item.\n *\n * #### Notes\n * If the item cannot be activated, the item will be set to `null`.\n */\n set activeItem(value: Menu.IItem | null) {\n this.activeIndex = value ? this._items.indexOf(value) : -1;\n }\n\n /**\n * Get the index of the currently active menu item.\n *\n * #### Notes\n * This will be `-1` if no menu item is active.\n */\n get activeIndex(): number {\n return this._activeIndex;\n }\n\n /**\n * Set the index of the currently active menu item.\n *\n * #### Notes\n * If the item cannot be activated, the index will be set to `-1`.\n */\n set activeIndex(value: number) {\n // Adjust the value for an out of range index.\n if (value < 0 || value >= this._items.length) {\n value = -1;\n }\n\n // Ensure the item can be activated.\n if (value !== -1 && !Private.canActivate(this._items[value])) {\n value = -1;\n }\n\n // Bail if the index will not change.\n if (this._activeIndex === value) {\n return;\n }\n\n // Update the active index.\n this._activeIndex = value;\n\n // Make active element in focus\n if (\n this._activeIndex >= 0 &&\n this.contentNode.childNodes[this._activeIndex]\n ) {\n (this.contentNode.childNodes[this._activeIndex] as HTMLElement).focus();\n }\n\n // schedule an update of the items.\n this.update();\n }\n\n /**\n * A read-only array of the menu items in the menu.\n */\n get items(): ReadonlyArray {\n return this._items;\n }\n\n /**\n * Activate the next selectable item in the menu.\n *\n * #### Notes\n * If no item is selectable, the index will be set to `-1`.\n */\n activateNextItem(): void {\n let n = this._items.length;\n let ai = this._activeIndex;\n let start = ai < n - 1 ? ai + 1 : 0;\n let stop = start === 0 ? n - 1 : start - 1;\n this.activeIndex = ArrayExt.findFirstIndex(\n this._items,\n Private.canActivate,\n start,\n stop\n );\n }\n\n /**\n * Activate the previous selectable item in the menu.\n *\n * #### Notes\n * If no item is selectable, the index will be set to `-1`.\n */\n activatePreviousItem(): void {\n let n = this._items.length;\n let ai = this._activeIndex;\n let start = ai <= 0 ? n - 1 : ai - 1;\n let stop = start === n - 1 ? 0 : start + 1;\n this.activeIndex = ArrayExt.findLastIndex(\n this._items,\n Private.canActivate,\n start,\n stop\n );\n }\n\n /**\n * Trigger the active menu item.\n *\n * #### Notes\n * If the active item is a submenu, it will be opened and the first\n * item will be activated.\n *\n * If the active item is a command, the command will be executed.\n *\n * If the menu is not attached, this is a no-op.\n *\n * If there is no active item, this is a no-op.\n */\n triggerActiveItem(): void {\n // Bail if the menu is not attached.\n if (!this.isAttached) {\n return;\n }\n\n // Bail if there is no active item.\n let item = this.activeItem;\n if (!item) {\n return;\n }\n\n // Cancel the pending timers.\n this._cancelOpenTimer();\n this._cancelCloseTimer();\n\n // If the item is a submenu, open it.\n if (item.type === 'submenu') {\n this._openChildMenu(true);\n return;\n }\n\n // Close the root menu before executing the command.\n this.rootMenu.close();\n\n // Execute the command for the item.\n let { command, args } = item;\n if (this.commands.isEnabled(command, args)) {\n this.commands.execute(command, args);\n } else {\n console.log(`Command '${command}' is disabled.`);\n }\n }\n\n /**\n * Add a menu item to the end of the menu.\n *\n * @param options - The options for creating the menu item.\n *\n * @returns The menu item added to the menu.\n */\n addItem(options: Menu.IItemOptions): Menu.IItem {\n return this.insertItem(this._items.length, options);\n }\n\n /**\n * Insert a menu item into the menu at the specified index.\n *\n * @param index - The index at which to insert the item.\n *\n * @param options - The options for creating the menu item.\n *\n * @returns The menu item added to the menu.\n *\n * #### Notes\n * The index will be clamped to the bounds of the items.\n */\n insertItem(index: number, options: Menu.IItemOptions): Menu.IItem {\n // Close the menu if it's attached.\n if (this.isAttached) {\n this.close();\n }\n\n // Reset the active index.\n this.activeIndex = -1;\n\n // Clamp the insert index to the array bounds.\n let i = Math.max(0, Math.min(index, this._items.length));\n\n // Create the item for the options.\n let item = Private.createItem(this, options);\n\n // Insert the item into the array.\n ArrayExt.insert(this._items, i, item);\n\n // Schedule an update of the items.\n this.update();\n\n // Return the item added to the menu.\n return item;\n }\n\n /**\n * Remove an item from the menu.\n *\n * @param item - The item to remove from the menu.\n *\n * #### Notes\n * This is a no-op if the item is not in the menu.\n */\n removeItem(item: Menu.IItem): void {\n this.removeItemAt(this._items.indexOf(item));\n }\n\n /**\n * Remove the item at a given index from the menu.\n *\n * @param index - The index of the item to remove.\n *\n * #### Notes\n * This is a no-op if the index is out of range.\n */\n removeItemAt(index: number): void {\n // Close the menu if it's attached.\n if (this.isAttached) {\n this.close();\n }\n\n // Reset the active index.\n this.activeIndex = -1;\n\n // Remove the item from the array.\n let item = ArrayExt.removeAt(this._items, index);\n\n // Bail if the index is out of range.\n if (!item) {\n return;\n }\n\n // Schedule an update of the items.\n this.update();\n }\n\n /**\n * Remove all menu items from the menu.\n */\n clearItems(): void {\n // Close the menu if it's attached.\n if (this.isAttached) {\n this.close();\n }\n\n // Reset the active index.\n this.activeIndex = -1;\n\n // Bail if there is nothing to remove.\n if (this._items.length === 0) {\n return;\n }\n\n // Clear the items.\n this._items.length = 0;\n\n // Schedule an update of the items.\n this.update();\n }\n\n /**\n * Open the menu at the specified location.\n *\n * @param x - The client X coordinate of the menu location.\n *\n * @param y - The client Y coordinate of the menu location.\n *\n * @param options - The additional options for opening the menu.\n *\n * #### Notes\n * The menu will be opened at the given location unless it will not\n * fully fit on the screen. If it will not fit, it will be adjusted\n * to fit naturally on the screen.\n *\n * The menu will be attached under the `host` element in the DOM\n * (or `document.body` if `host` is `null`) and before the `ref`\n * element (or as the last child of `host` if `ref` is `null`).\n * The menu may be displayed outside of the `host` element\n * following the rules of CSS absolute positioning.\n *\n * This is a no-op if the menu is already attached to the DOM.\n */\n open(x: number, y: number, options: Menu.IOpenOptions = {}): void {\n // Bail early if the menu is already attached.\n if (this.isAttached) {\n return;\n }\n\n // Extract the menu options.\n let forceX = options.forceX || false;\n let forceY = options.forceY || false;\n const host = options.host ?? null;\n const ref = options.ref ?? null;\n const horizontalAlignment =\n options.horizontalAlignment ??\n (document.documentElement.dir === 'rtl' ? 'right' : 'left');\n\n // Open the menu as a root menu.\n Private.openRootMenu(\n this,\n x,\n y,\n forceX,\n forceY,\n horizontalAlignment,\n host,\n ref\n );\n\n // Activate the menu to accept keyboard input.\n this.activate();\n }\n\n /**\n * Handle the DOM events for the menu.\n *\n * @param event - The DOM event sent to the menu.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the menu's DOM nodes. It should\n * not be called directly by user code.\n */\n handleEvent(event: Event): void {\n switch (event.type) {\n case 'keydown':\n this._evtKeyDown(event as KeyboardEvent);\n break;\n case 'mouseup':\n this._evtMouseUp(event as MouseEvent);\n break;\n case 'mousemove':\n this._evtMouseMove(event as MouseEvent);\n break;\n case 'mouseenter':\n this._evtMouseEnter(event as MouseEvent);\n break;\n case 'mouseleave':\n this._evtMouseLeave(event as MouseEvent);\n break;\n case 'mousedown':\n this._evtMouseDown(event as MouseEvent);\n break;\n case 'contextmenu':\n event.preventDefault();\n event.stopPropagation();\n break;\n }\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n this.node.addEventListener('keydown', this);\n this.node.addEventListener('mouseup', this);\n this.node.addEventListener('mousemove', this);\n this.node.addEventListener('mouseenter', this);\n this.node.addEventListener('mouseleave', this);\n this.node.addEventListener('contextmenu', this);\n document.addEventListener('mousedown', this, true);\n }\n\n /**\n * A message handler invoked on an `'after-detach'` message.\n */\n protected onAfterDetach(msg: Message): void {\n this.node.removeEventListener('keydown', this);\n this.node.removeEventListener('mouseup', this);\n this.node.removeEventListener('mousemove', this);\n this.node.removeEventListener('mouseenter', this);\n this.node.removeEventListener('mouseleave', this);\n this.node.removeEventListener('contextmenu', this);\n document.removeEventListener('mousedown', this, true);\n }\n\n /**\n * A message handler invoked on an `'activate-request'` message.\n */\n protected onActivateRequest(msg: Message): void {\n if (this.isAttached) {\n this.node.focus();\n }\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n protected onUpdateRequest(msg: Message): void {\n let items = this._items;\n let renderer = this.renderer;\n let activeIndex = this._activeIndex;\n let collapsedFlags = Private.computeCollapsed(items);\n let content = new Array(items.length);\n for (let i = 0, n = items.length; i < n; ++i) {\n let item = items[i];\n let active = i === activeIndex;\n let collapsed = collapsedFlags[i];\n content[i] = renderer.renderItem({\n item,\n active,\n collapsed,\n onfocus: () => {\n this.activeIndex = i;\n }\n });\n }\n VirtualDOM.render(content, this.contentNode);\n }\n\n /**\n * A message handler invoked on a `'close-request'` message.\n */\n protected onCloseRequest(msg: Message): void {\n // Cancel the pending timers.\n this._cancelOpenTimer();\n this._cancelCloseTimer();\n\n // Reset the active index.\n this.activeIndex = -1;\n\n // Close any open child menu.\n let childMenu = this._childMenu;\n if (childMenu) {\n this._childIndex = -1;\n this._childMenu = null;\n childMenu._parentMenu = null;\n childMenu.close();\n }\n\n // Remove this menu from its parent and activate the parent.\n let parentMenu = this._parentMenu;\n if (parentMenu) {\n this._parentMenu = null;\n parentMenu._childIndex = -1;\n parentMenu._childMenu = null;\n parentMenu.activate();\n }\n\n // Emit the `aboutToClose` signal if the menu is attached.\n if (this.isAttached) {\n this._aboutToClose.emit(undefined);\n }\n\n // Finish closing the menu.\n super.onCloseRequest(msg);\n }\n\n /**\n * Handle the `'keydown'` event for the menu.\n *\n * #### Notes\n * This listener is attached to the menu node.\n */\n private _evtKeyDown(event: KeyboardEvent): void {\n // A menu handles all keydown events.\n event.preventDefault();\n event.stopPropagation();\n\n // Fetch the key code for the event.\n let kc = event.keyCode;\n\n // Enter\n if (kc === 13) {\n this.triggerActiveItem();\n return;\n }\n\n // Escape\n if (kc === 27) {\n this.close();\n return;\n }\n\n // Left Arrow\n if (kc === 37) {\n if (this._parentMenu) {\n this.close();\n } else {\n this._menuRequested.emit('previous');\n }\n return;\n }\n\n // Up Arrow\n if (kc === 38) {\n this.activatePreviousItem();\n return;\n }\n\n // Right Arrow\n if (kc === 39) {\n let item = this.activeItem;\n if (item && item.type === 'submenu') {\n this.triggerActiveItem();\n } else {\n this.rootMenu._menuRequested.emit('next');\n }\n return;\n }\n\n // Down Arrow\n if (kc === 40) {\n this.activateNextItem();\n return;\n }\n\n // Get the pressed key character.\n let key = getKeyboardLayout().keyForKeydownEvent(event);\n\n // Bail if the key is not valid.\n if (!key) {\n return;\n }\n\n // Search for the next best matching mnemonic item.\n let start = this._activeIndex + 1;\n let result = Private.findMnemonic(this._items, key, start);\n\n // Handle the requested mnemonic based on the search results.\n // If exactly one mnemonic is matched, that item is triggered.\n // Otherwise, the next mnemonic is activated if available,\n // followed by the auto mnemonic if available.\n if (result.index !== -1 && !result.multiple) {\n this.activeIndex = result.index;\n this.triggerActiveItem();\n } else if (result.index !== -1) {\n this.activeIndex = result.index;\n } else if (result.auto !== -1) {\n this.activeIndex = result.auto;\n }\n }\n\n /**\n * Handle the `'mouseup'` event for the menu.\n *\n * #### Notes\n * This listener is attached to the menu node.\n */\n private _evtMouseUp(event: MouseEvent): void {\n if (event.button !== 0) {\n return;\n }\n event.preventDefault();\n event.stopPropagation();\n this.triggerActiveItem();\n }\n\n /**\n * Handle the `'mousemove'` event for the menu.\n *\n * #### Notes\n * This listener is attached to the menu node.\n */\n private _evtMouseMove(event: MouseEvent): void {\n // Hit test the item nodes for the item under the mouse.\n let index = ArrayExt.findFirstIndex(this.contentNode.children, node => {\n return ElementExt.hitTest(node, event.clientX, event.clientY);\n });\n\n // Bail early if the mouse is already over the active index.\n if (index === this._activeIndex) {\n return;\n }\n\n // Update and coerce the active index.\n this.activeIndex = index;\n index = this.activeIndex;\n\n // If the index is the current child index, cancel the timers.\n if (index === this._childIndex) {\n this._cancelOpenTimer();\n this._cancelCloseTimer();\n return;\n }\n\n // If a child menu is currently open, start the close timer.\n if (this._childIndex !== -1) {\n this._startCloseTimer();\n }\n\n // Cancel the open timer to give a full delay for opening.\n this._cancelOpenTimer();\n\n // Bail if the active item is not a valid submenu item.\n let item = this.activeItem;\n if (!item || item.type !== 'submenu' || !item.submenu) {\n return;\n }\n\n // Start the open timer to open the active item submenu.\n this._startOpenTimer();\n }\n\n /**\n * Handle the `'mouseenter'` event for the menu.\n *\n * #### Notes\n * This listener is attached to the menu node.\n */\n private _evtMouseEnter(event: MouseEvent): void {\n // Synchronize the active ancestor items.\n for (let menu = this._parentMenu; menu; menu = menu._parentMenu) {\n menu._cancelOpenTimer();\n menu._cancelCloseTimer();\n menu.activeIndex = menu._childIndex;\n }\n }\n\n /**\n * Handle the `'mouseleave'` event for the menu.\n *\n * #### Notes\n * This listener is attached to the menu node.\n */\n private _evtMouseLeave(event: MouseEvent): void {\n // Cancel any pending submenu opening.\n this._cancelOpenTimer();\n\n // If there is no open child menu, just reset the active index.\n if (!this._childMenu) {\n this.activeIndex = -1;\n return;\n }\n\n // If the mouse is over the child menu, cancel the close timer.\n let { clientX, clientY } = event;\n if (ElementExt.hitTest(this._childMenu.node, clientX, clientY)) {\n this._cancelCloseTimer();\n return;\n }\n\n // Otherwise, reset the active index and start the close timer.\n this.activeIndex = -1;\n this._startCloseTimer();\n }\n\n /**\n * Handle the `'mousedown'` event for the menu.\n *\n * #### Notes\n * This listener is attached to the document node.\n */\n private _evtMouseDown(event: MouseEvent): void {\n // Bail if the menu is not a root menu.\n if (this._parentMenu) {\n return;\n }\n\n // The mouse button which is pressed is irrelevant. If the press\n // is not on a menu, the entire hierarchy is closed and the event\n // is allowed to propagate. This allows other code to act on the\n // event, such as focusing the clicked element.\n if (Private.hitTestMenus(this, event.clientX, event.clientY)) {\n event.preventDefault();\n event.stopPropagation();\n } else {\n this.close();\n }\n }\n\n /**\n * Open the child menu at the active index immediately.\n *\n * If a different child menu is already open, it will be closed,\n * even if the active item is not a valid submenu.\n */\n private _openChildMenu(activateFirst = false): void {\n // If the item is not a valid submenu, close the child menu.\n let item = this.activeItem;\n if (!item || item.type !== 'submenu' || !item.submenu) {\n this._closeChildMenu();\n return;\n }\n\n // Do nothing if the child menu will not change.\n let submenu = item.submenu;\n if (submenu === this._childMenu) {\n return;\n }\n\n // Prior to any DOM modifications save window data\n Menu.saveWindowData();\n\n // Ensure the current child menu is closed.\n this._closeChildMenu();\n\n // Update the private child state.\n this._childMenu = submenu;\n this._childIndex = this._activeIndex;\n\n // Set the parent menu reference for the child.\n submenu._parentMenu = this;\n\n // Ensure the menu is updated and lookup the item node.\n MessageLoop.sendMessage(this, Widget.Msg.UpdateRequest);\n let itemNode = this.contentNode.children[this._activeIndex];\n\n // Open the submenu at the active node.\n Private.openSubmenu(submenu, itemNode as HTMLElement);\n\n // Activate the first item if desired.\n if (activateFirst) {\n submenu.activeIndex = -1;\n submenu.activateNextItem();\n }\n\n // Activate the child menu.\n submenu.activate();\n }\n\n /**\n * Close the child menu immediately.\n *\n * This is a no-op if a child menu is not open.\n */\n private _closeChildMenu(): void {\n if (this._childMenu) {\n this._childMenu.close();\n }\n }\n\n /**\n * Start the open timer, unless it is already pending.\n */\n private _startOpenTimer(): void {\n if (this._openTimerID === 0) {\n this._openTimerID = window.setTimeout(() => {\n this._openTimerID = 0;\n this._openChildMenu();\n }, Private.TIMER_DELAY);\n }\n }\n\n /**\n * Start the close timer, unless it is already pending.\n */\n private _startCloseTimer(): void {\n if (this._closeTimerID === 0) {\n this._closeTimerID = window.setTimeout(() => {\n this._closeTimerID = 0;\n this._closeChildMenu();\n }, Private.TIMER_DELAY);\n }\n }\n\n /**\n * Cancel the open timer, if the timer is pending.\n */\n private _cancelOpenTimer(): void {\n if (this._openTimerID !== 0) {\n clearTimeout(this._openTimerID);\n this._openTimerID = 0;\n }\n }\n\n /**\n * Cancel the close timer, if the timer is pending.\n */\n private _cancelCloseTimer(): void {\n if (this._closeTimerID !== 0) {\n clearTimeout(this._closeTimerID);\n this._closeTimerID = 0;\n }\n }\n\n /**\n * Save window data used for menu positioning in transient cache.\n *\n * In order to avoid layout trashing it is recommended to invoke this\n * method immediately prior to opening the menu and any DOM modifications\n * (like closing previously visible menu, or adding a class to menu widget).\n *\n * The transient cache will be released upon `open()` call.\n */\n static saveWindowData(): void {\n Private.saveWindowData();\n }\n\n private _childIndex = -1;\n private _activeIndex = -1;\n private _openTimerID = 0;\n private _closeTimerID = 0;\n private _items: Menu.IItem[] = [];\n private _childMenu: Menu | null = null;\n private _parentMenu: Menu | null = null;\n private _aboutToClose = new Signal(this);\n private _menuRequested = new Signal(this);\n}\n\n/**\n * The namespace for the `Menu` class statics.\n */\nexport namespace Menu {\n /**\n * An options object for creating a menu.\n */\n export interface IOptions {\n /**\n * The command registry for use with the menu.\n */\n commands: CommandRegistry;\n\n /**\n * A custom renderer for use with the menu.\n *\n * The default is a shared renderer instance.\n */\n renderer?: IRenderer;\n }\n\n /**\n * An options object for the `open` method on a menu.\n */\n export interface IOpenOptions {\n /**\n * Whether to force the X position of the menu.\n *\n * Setting to `true` will disable the logic which repositions the\n * X coordinate of the menu if it will not fit entirely on screen.\n *\n * The default is `false`.\n */\n forceX?: boolean;\n\n /**\n * Whether to force the Y position of the menu.\n *\n * Setting to `true` will disable the logic which repositions the\n * Y coordinate of the menu if it will not fit entirely on screen.\n *\n * The default is `false`.\n */\n forceY?: boolean;\n\n /**\n * The DOM node to use as the menu's host.\n *\n * If not specified then uses `document.body`.\n */\n host?: HTMLElement;\n\n /**\n * The child of `host` to use as the reference element.\n * If this is provided, the menu will be inserted before this\n * node in the host. The default is `null`, which will cause the\n * menu to be added as the last child of the host.\n */\n ref?: HTMLElement;\n\n /**\n * The alignment of the menu.\n *\n * The default is `'left'` unless the document `dir` attribute is `'rtl'`\n */\n horizontalAlignment?: 'left' | 'right';\n }\n\n /**\n * A type alias for a menu item type.\n */\n export type ItemType = 'command' | 'submenu' | 'separator';\n\n /**\n * An options object for creating a menu item.\n */\n export interface IItemOptions {\n /**\n * The type of the menu item.\n *\n * The default value is `'command'`.\n */\n type?: ItemType;\n\n /**\n * The command to execute when the item is triggered.\n *\n * The default value is an empty string.\n */\n command?: string;\n\n /**\n * The arguments for the command.\n *\n * The default value is an empty object.\n */\n args?: ReadonlyJSONObject;\n\n /**\n * The submenu for a `'submenu'` type item.\n *\n * The default value is `null`.\n */\n submenu?: Menu | null;\n }\n\n /**\n * An object which represents a menu item.\n *\n * #### Notes\n * Item objects are created automatically by a menu.\n */\n export interface IItem {\n /**\n * The type of the menu item.\n */\n readonly type: ItemType;\n\n /**\n * The command to execute when the item is triggered.\n */\n readonly command: string;\n\n /**\n * The arguments for the command.\n */\n readonly args: ReadonlyJSONObject;\n\n /**\n * The submenu for a `'submenu'` type item.\n */\n readonly submenu: Menu | null;\n\n /**\n * The display label for the menu item.\n */\n readonly label: string;\n\n /**\n * The mnemonic index for the menu item.\n */\n readonly mnemonic: number;\n\n /**\n * The icon renderer for the menu item.\n */\n readonly icon: VirtualElement.IRenderer | undefined;\n\n /**\n * The icon class for the menu item.\n */\n readonly iconClass: string;\n\n /**\n * The icon label for the menu item.\n */\n readonly iconLabel: string;\n\n /**\n * The display caption for the menu item.\n */\n readonly caption: string;\n\n /**\n * The extra class name for the menu item.\n */\n readonly className: string;\n\n /**\n * The dataset for the menu item.\n */\n readonly dataset: CommandRegistry.Dataset;\n\n /**\n * Whether the menu item is enabled.\n */\n readonly isEnabled: boolean;\n\n /**\n * Whether the menu item is toggled.\n */\n readonly isToggled: boolean;\n\n /**\n * Whether the menu item is visible.\n */\n readonly isVisible: boolean;\n\n /**\n * The key binding for the menu item.\n */\n readonly keyBinding: CommandRegistry.IKeyBinding | null;\n }\n\n /**\n * An object which holds the data to render a menu item.\n */\n export interface IRenderData {\n /**\n * The item to be rendered.\n */\n readonly item: IItem;\n\n /**\n * Whether the item is the active item.\n */\n readonly active: boolean;\n\n /**\n * Whether the item should be collapsed.\n */\n readonly collapsed: boolean;\n\n /**\n * Handler for when element is in focus.\n */\n readonly onfocus?: () => void;\n }\n\n /**\n * A renderer for use with a menu.\n */\n export interface IRenderer {\n /**\n * Render the virtual element for a menu item.\n *\n * @param data - The data to use for rendering the item.\n *\n * @returns A virtual element representing the item.\n */\n renderItem(data: IRenderData): VirtualElement;\n }\n\n /**\n * The default implementation of `IRenderer`.\n *\n * #### Notes\n * Subclasses are free to reimplement rendering methods as needed.\n */\n export class Renderer implements IRenderer {\n /**\n * Render the virtual element for a menu item.\n *\n * @param data - The data to use for rendering the item.\n *\n * @returns A virtual element representing the item.\n */\n renderItem(data: IRenderData): VirtualElement {\n let className = this.createItemClass(data);\n let dataset = this.createItemDataset(data);\n let aria = this.createItemARIA(data);\n return h.li(\n {\n className,\n dataset,\n tabindex: '0',\n onfocus: data.onfocus,\n ...aria\n },\n this.renderIcon(data),\n this.renderLabel(data),\n this.renderShortcut(data),\n this.renderSubmenu(data)\n );\n }\n\n /**\n * Render the icon element for a menu item.\n *\n * @param data - The data to use for rendering the icon.\n *\n * @returns A virtual element representing the item icon.\n */\n renderIcon(data: IRenderData): VirtualElement {\n let className = this.createIconClass(data);\n\n // If data.item.icon is undefined, it will be ignored.\n return h.div({ className }, data.item.icon!, data.item.iconLabel);\n }\n\n /**\n * Render the label element for a menu item.\n *\n * @param data - The data to use for rendering the label.\n *\n * @returns A virtual element representing the item label.\n */\n renderLabel(data: IRenderData): VirtualElement {\n let content = this.formatLabel(data);\n return h.div({ className: 'lm-Menu-itemLabel' }, content);\n }\n\n /**\n * Render the shortcut element for a menu item.\n *\n * @param data - The data to use for rendering the shortcut.\n *\n * @returns A virtual element representing the item shortcut.\n */\n renderShortcut(data: IRenderData): VirtualElement {\n let content = this.formatShortcut(data);\n return h.div({ className: 'lm-Menu-itemShortcut' }, content);\n }\n\n /**\n * Render the submenu icon element for a menu item.\n *\n * @param data - The data to use for rendering the submenu icon.\n *\n * @returns A virtual element representing the submenu icon.\n */\n renderSubmenu(data: IRenderData): VirtualElement {\n return h.div({ className: 'lm-Menu-itemSubmenuIcon' });\n }\n\n /**\n * Create the class name for the menu item.\n *\n * @param data - The data to use for the class name.\n *\n * @returns The full class name for the menu item.\n */\n createItemClass(data: IRenderData): string {\n // Setup the initial class name.\n let name = 'lm-Menu-item';\n\n // Add the boolean state classes.\n if (!data.item.isEnabled) {\n name += ' lm-mod-disabled';\n }\n if (data.item.isToggled) {\n name += ' lm-mod-toggled';\n }\n if (!data.item.isVisible) {\n name += ' lm-mod-hidden';\n }\n if (data.active) {\n name += ' lm-mod-active';\n }\n if (data.collapsed) {\n name += ' lm-mod-collapsed';\n }\n\n // Add the extra class.\n let extra = data.item.className;\n if (extra) {\n name += ` ${extra}`;\n }\n\n // Return the complete class name.\n return name;\n }\n\n /**\n * Create the dataset for the menu item.\n *\n * @param data - The data to use for creating the dataset.\n *\n * @returns The dataset for the menu item.\n */\n createItemDataset(data: IRenderData): ElementDataset {\n let result: ElementDataset;\n let { type, command, dataset } = data.item;\n if (type === 'command') {\n result = { ...dataset, type, command };\n } else {\n result = { ...dataset, type };\n }\n return result;\n }\n\n /**\n * Create the class name for the menu item icon.\n *\n * @param data - The data to use for the class name.\n *\n * @returns The full class name for the item icon.\n */\n createIconClass(data: IRenderData): string {\n let name = 'lm-Menu-itemIcon';\n let extra = data.item.iconClass;\n return extra ? `${name} ${extra}` : name;\n }\n\n /**\n * Create the aria attributes for menu item.\n *\n * @param data - The data to use for the aria attributes.\n *\n * @returns The aria attributes object for the item.\n */\n createItemARIA(data: IRenderData): ElementARIAAttrs {\n let aria: { [T in ARIAAttrNames]?: string } = {};\n switch (data.item.type) {\n case 'separator':\n aria.role = 'presentation';\n break;\n case 'submenu':\n aria['aria-haspopup'] = 'true';\n if (!data.item.isEnabled) {\n aria['aria-disabled'] = 'true';\n }\n break;\n default:\n if (!data.item.isEnabled) {\n aria['aria-disabled'] = 'true';\n }\n if (data.item.isToggled) {\n aria.role = 'menuitemcheckbox';\n aria['aria-checked'] = 'true';\n } else {\n aria.role = 'menuitem';\n }\n }\n return aria;\n }\n\n /**\n * Create the render content for the label node.\n *\n * @param data - The data to use for the label content.\n *\n * @returns The content to add to the label node.\n */\n formatLabel(data: IRenderData): h.Child {\n // Fetch the label text and mnemonic index.\n let { label, mnemonic } = data.item;\n\n // If the index is out of range, do not modify the label.\n if (mnemonic < 0 || mnemonic >= label.length) {\n return label;\n }\n\n // Split the label into parts.\n let prefix = label.slice(0, mnemonic);\n let suffix = label.slice(mnemonic + 1);\n let char = label[mnemonic];\n\n // Wrap the mnemonic character in a span.\n let span = h.span({ className: 'lm-Menu-itemMnemonic' }, char);\n\n // Return the content parts.\n return [prefix, span, suffix];\n }\n\n /**\n * Create the render content for the shortcut node.\n *\n * @param data - The data to use for the shortcut content.\n *\n * @returns The content to add to the shortcut node.\n */\n formatShortcut(data: IRenderData): h.Child {\n let kb = data.item.keyBinding;\n return kb ? CommandRegistry.formatKeystroke(kb.keys) : null;\n }\n }\n\n /**\n * The default `Renderer` instance.\n */\n export const defaultRenderer = new Renderer();\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * The ms delay for opening and closing a submenu.\n */\n export const TIMER_DELAY = 300;\n\n /**\n * The horizontal pixel overlap for an open submenu.\n */\n export const SUBMENU_OVERLAP = 3;\n\n let transientWindowDataCache: IWindowData | null = null;\n let transientCacheCounter: number = 0;\n\n function getWindowData(): IWindowData {\n // if transient cache is in use, take one from it\n if (transientCacheCounter > 0) {\n transientCacheCounter--;\n return transientWindowDataCache!;\n }\n return _getWindowData();\n }\n\n /**\n * Store window data in transient cache.\n *\n * The transient cache will be released upon `getWindowData()` call.\n * If this function is called multiple times, the cache will be\n * retained until as many calls to `getWindowData()` were made.\n *\n * Note: should be called before any DOM modifications.\n */\n export function saveWindowData(): void {\n transientWindowDataCache = _getWindowData();\n transientCacheCounter++;\n }\n\n /**\n * Create the DOM node for a menu.\n */\n export function createNode(): HTMLDivElement {\n let node = document.createElement('div');\n let content = document.createElement('ul');\n content.className = 'lm-Menu-content';\n node.appendChild(content);\n content.setAttribute('role', 'menu');\n node.tabIndex = 0;\n return node;\n }\n\n /**\n * Test whether a menu item can be activated.\n */\n export function canActivate(item: Menu.IItem): boolean {\n return item.type !== 'separator' && item.isEnabled && item.isVisible;\n }\n\n /**\n * Create a new menu item for an owner menu.\n */\n export function createItem(\n owner: Menu,\n options: Menu.IItemOptions\n ): Menu.IItem {\n return new MenuItem(owner.commands, options);\n }\n\n /**\n * Hit test a menu hierarchy starting at the given root.\n */\n export function hitTestMenus(menu: Menu, x: number, y: number): boolean {\n for (let temp: Menu | null = menu; temp; temp = temp.childMenu) {\n if (ElementExt.hitTest(temp.node, x, y)) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * Compute which extra separator items should be collapsed.\n */\n export function computeCollapsed(\n items: ReadonlyArray\n ): boolean[] {\n // Allocate the return array and fill it with `false`.\n let result = new Array(items.length);\n ArrayExt.fill(result, false);\n\n // Collapse the leading separators.\n let k1 = 0;\n let n = items.length;\n for (; k1 < n; ++k1) {\n let item = items[k1];\n if (!item.isVisible) {\n continue;\n }\n if (item.type !== 'separator') {\n break;\n }\n result[k1] = true;\n }\n\n // Hide the trailing separators.\n let k2 = n - 1;\n for (; k2 >= 0; --k2) {\n let item = items[k2];\n if (!item.isVisible) {\n continue;\n }\n if (item.type !== 'separator') {\n break;\n }\n result[k2] = true;\n }\n\n // Hide the remaining consecutive separators.\n let hide = false;\n while (++k1 < k2) {\n let item = items[k1];\n if (!item.isVisible) {\n continue;\n }\n if (item.type !== 'separator') {\n hide = false;\n } else if (hide) {\n result[k1] = true;\n } else {\n hide = true;\n }\n }\n\n // Return the resulting flags.\n return result;\n }\n\n function _getWindowData(): IWindowData {\n return {\n pageXOffset: window.pageXOffset,\n pageYOffset: window.pageYOffset,\n clientWidth: document.documentElement.clientWidth,\n clientHeight: document.documentElement.clientHeight\n };\n }\n\n /**\n * Open a menu as a root menu at the target location.\n */\n export function openRootMenu(\n menu: Menu,\n x: number,\n y: number,\n forceX: boolean,\n forceY: boolean,\n horizontalAlignment: 'left' | 'right',\n host: HTMLElement | null,\n ref: HTMLElement | null\n ): void {\n // Get the current position and size of the main viewport.\n const windowData = getWindowData();\n let px = windowData.pageXOffset;\n let py = windowData.pageYOffset;\n let cw = windowData.clientWidth;\n let ch = windowData.clientHeight;\n\n // Ensure the menu is updated before attaching and measuring.\n MessageLoop.sendMessage(menu, Widget.Msg.UpdateRequest);\n\n // Compute the maximum allowed height for the menu.\n let maxHeight = ch - (forceY ? y : 0);\n\n // Fetch common variables.\n let node = menu.node;\n let style = node.style;\n\n // Clear the menu geometry and prepare it for measuring.\n style.opacity = '0';\n style.maxHeight = `${maxHeight}px`;\n\n // Attach the menu to the document.\n Widget.attach(menu, host || document.body, ref);\n\n // Measure the size of the menu.\n let { width, height } = node.getBoundingClientRect();\n\n // align the menu to the right of the target if requested or language is RTL\n if (horizontalAlignment === 'right') {\n x -= width;\n }\n\n // Adjust the X position of the menu to fit on-screen.\n if (!forceX && x + width > px + cw) {\n x = px + cw - width;\n }\n\n // Adjust the Y position of the menu to fit on-screen.\n if (!forceY && y + height > py + ch) {\n if (y > py + ch) {\n y = py + ch - height;\n } else {\n y = y - height;\n }\n }\n\n // Update the position of the menu to the computed position.\n style.transform = `translate(${Math.max(0, x)}px, ${Math.max(0, y)}px`;\n\n // Finally, make the menu visible on the screen.\n style.opacity = '1';\n }\n\n /**\n * Open a menu as a submenu using an item node for positioning.\n */\n export function openSubmenu(submenu: Menu, itemNode: HTMLElement): void {\n // Get the current position and size of the main viewport.\n const windowData = getWindowData();\n let px = windowData.pageXOffset;\n let py = windowData.pageYOffset;\n let cw = windowData.clientWidth;\n let ch = windowData.clientHeight;\n\n // Ensure the menu is updated before opening.\n MessageLoop.sendMessage(submenu, Widget.Msg.UpdateRequest);\n\n // Compute the maximum allowed height for the menu.\n let maxHeight = ch;\n\n // Fetch common variables.\n let node = submenu.node;\n let style = node.style;\n\n // Clear the menu geometry and prepare it for measuring.\n style.opacity = '0';\n style.maxHeight = `${maxHeight}px`;\n\n // Attach the menu to the document.\n Widget.attach(submenu, document.body);\n\n // Measure the size of the menu.\n let { width, height } = node.getBoundingClientRect();\n\n // Compute the box sizing for the menu.\n let box = ElementExt.boxSizing(submenu.node);\n\n // Get the bounding rect for the target item node.\n let itemRect = itemNode.getBoundingClientRect();\n\n // Compute the target X position.\n let x = itemRect.right - SUBMENU_OVERLAP;\n\n // Adjust the X position to fit on the screen.\n if (x + width > px + cw) {\n x = itemRect.left + SUBMENU_OVERLAP - width;\n }\n\n // Compute the target Y position.\n let y = itemRect.top - box.borderTop - box.paddingTop;\n\n // Adjust the Y position to fit on the screen.\n if (y + height > py + ch) {\n y = itemRect.bottom + box.borderBottom + box.paddingBottom - height;\n }\n\n // Update the position of the menu to the computed position.\n style.transform = `translate(${Math.max(0, x)}px, ${Math.max(0, y)}px`;\n\n // Finally, make the menu visible on the screen.\n style.opacity = '1';\n }\n\n /**\n * The results of a mnemonic search.\n */\n export interface IMnemonicResult {\n /**\n * The index of the first matching mnemonic item, or `-1`.\n */\n index: number;\n\n /**\n * Whether multiple mnemonic items matched.\n */\n multiple: boolean;\n\n /**\n * The index of the first auto matched non-mnemonic item.\n */\n auto: number;\n }\n\n /**\n * Find the best matching mnemonic item.\n *\n * The search starts at the given index and wraps around.\n */\n export function findMnemonic(\n items: ReadonlyArray,\n key: string,\n start: number\n ): IMnemonicResult {\n // Setup the result variables.\n let index = -1;\n let auto = -1;\n let multiple = false;\n\n // Normalize the key to upper case.\n let upperKey = key.toUpperCase();\n\n // Search the items from the given start index.\n for (let i = 0, n = items.length; i < n; ++i) {\n // Compute the wrapped index.\n let k = (i + start) % n;\n\n // Lookup the item\n let item = items[k];\n\n // Ignore items which cannot be activated.\n if (!canActivate(item)) {\n continue;\n }\n\n // Ignore items with an empty label.\n let label = item.label;\n if (label.length === 0) {\n continue;\n }\n\n // Lookup the mnemonic index for the label.\n let mn = item.mnemonic;\n\n // Handle a valid mnemonic index.\n if (mn >= 0 && mn < label.length) {\n if (label[mn].toUpperCase() === upperKey) {\n if (index === -1) {\n index = k;\n } else {\n multiple = true;\n }\n }\n continue;\n }\n\n // Finally, handle the auto index if possible.\n if (auto === -1 && label[0].toUpperCase() === upperKey) {\n auto = k;\n }\n }\n\n // Return the search results.\n return { index, multiple, auto };\n }\n\n /**\n * A concrete implementation of `Menu.IItem`.\n */\n class MenuItem implements Menu.IItem {\n /**\n * Construct a new menu item.\n */\n constructor(commands: CommandRegistry, options: Menu.IItemOptions) {\n this._commands = commands;\n this.type = options.type || 'command';\n this.command = options.command || '';\n this.args = options.args || JSONExt.emptyObject;\n this.submenu = options.submenu || null;\n }\n\n /**\n * The type of the menu item.\n */\n readonly type: Menu.ItemType;\n\n /**\n * The command to execute when the item is triggered.\n */\n readonly command: string;\n\n /**\n * The arguments for the command.\n */\n readonly args: ReadonlyJSONObject;\n\n /**\n * The submenu for a `'submenu'` type item.\n */\n readonly submenu: Menu | null;\n\n /**\n * The display label for the menu item.\n */\n get label(): string {\n if (this.type === 'command') {\n return this._commands.label(this.command, this.args);\n }\n if (this.type === 'submenu' && this.submenu) {\n return this.submenu.title.label;\n }\n return '';\n }\n\n /**\n * The mnemonic index for the menu item.\n */\n get mnemonic(): number {\n if (this.type === 'command') {\n return this._commands.mnemonic(this.command, this.args);\n }\n if (this.type === 'submenu' && this.submenu) {\n return this.submenu.title.mnemonic;\n }\n return -1;\n }\n\n /**\n * The icon renderer for the menu item.\n */\n get icon(): VirtualElement.IRenderer | undefined {\n if (this.type === 'command') {\n return this._commands.icon(this.command, this.args);\n }\n if (this.type === 'submenu' && this.submenu) {\n return this.submenu.title.icon;\n }\n return undefined;\n }\n\n /**\n * The icon class for the menu item.\n */\n get iconClass(): string {\n if (this.type === 'command') {\n return this._commands.iconClass(this.command, this.args);\n }\n if (this.type === 'submenu' && this.submenu) {\n return this.submenu.title.iconClass;\n }\n return '';\n }\n\n /**\n * The icon label for the menu item.\n */\n get iconLabel(): string {\n if (this.type === 'command') {\n return this._commands.iconLabel(this.command, this.args);\n }\n if (this.type === 'submenu' && this.submenu) {\n return this.submenu.title.iconLabel;\n }\n return '';\n }\n\n /**\n * The display caption for the menu item.\n */\n get caption(): string {\n if (this.type === 'command') {\n return this._commands.caption(this.command, this.args);\n }\n if (this.type === 'submenu' && this.submenu) {\n return this.submenu.title.caption;\n }\n return '';\n }\n\n /**\n * The extra class name for the menu item.\n */\n get className(): string {\n if (this.type === 'command') {\n return this._commands.className(this.command, this.args);\n }\n if (this.type === 'submenu' && this.submenu) {\n return this.submenu.title.className;\n }\n return '';\n }\n\n /**\n * The dataset for the menu item.\n */\n get dataset(): CommandRegistry.Dataset {\n if (this.type === 'command') {\n return this._commands.dataset(this.command, this.args);\n }\n if (this.type === 'submenu' && this.submenu) {\n return this.submenu.title.dataset;\n }\n return {};\n }\n\n /**\n * Whether the menu item is enabled.\n */\n get isEnabled(): boolean {\n if (this.type === 'command') {\n return this._commands.isEnabled(this.command, this.args);\n }\n if (this.type === 'submenu') {\n return this.submenu !== null;\n }\n return true;\n }\n\n /**\n * Whether the menu item is toggled.\n */\n get isToggled(): boolean {\n if (this.type === 'command') {\n return this._commands.isToggled(this.command, this.args);\n }\n return false;\n }\n\n /**\n * Whether the menu item is visible.\n */\n get isVisible(): boolean {\n if (this.type === 'command') {\n return this._commands.isVisible(this.command, this.args);\n }\n if (this.type === 'submenu') {\n return this.submenu !== null;\n }\n return true;\n }\n\n /**\n * The key binding for the menu item.\n */\n get keyBinding(): CommandRegistry.IKeyBinding | null {\n if (this.type === 'command') {\n let { command, args } = this;\n return (\n ArrayExt.findLastValue(this._commands.keyBindings, kb => {\n return kb.command === command && JSONExt.deepEqual(kb.args, args);\n }) || null\n );\n }\n return null;\n }\n\n private _commands: CommandRegistry;\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { CommandRegistry } from '@lumino/commands';\n\nimport { DisposableDelegate, IDisposable } from '@lumino/disposable';\n\nimport { Selector } from '@lumino/domutils';\n\nimport { Menu } from './menu';\n\n/**\n * An object which implements a universal context menu.\n *\n * #### Notes\n * The items shown in the context menu are determined by CSS selector\n * matching against the DOM hierarchy at the site of the mouse click.\n * This is similar in concept to how keyboard shortcuts are matched\n * in the command registry.\n */\nexport class ContextMenu {\n /**\n * Construct a new context menu.\n *\n * @param options - The options for initializing the menu.\n */\n constructor(options: ContextMenu.IOptions) {\n const { groupByTarget, sortBySelector, ...others } = options;\n this.menu = new Menu(others);\n this._groupByTarget = groupByTarget !== false;\n this._sortBySelector = sortBySelector !== false;\n }\n\n /**\n * The menu widget which displays the matched context items.\n */\n readonly menu: Menu;\n\n /**\n * Add an item to the context menu.\n *\n * @param options - The options for creating the item.\n *\n * @returns A disposable which will remove the item from the menu.\n */\n addItem(options: ContextMenu.IItemOptions): IDisposable {\n // Create an item from the given options.\n let item = Private.createItem(options, this._idTick++);\n\n // Add the item to the internal array.\n this._items.push(item);\n\n // Return a disposable which will remove the item.\n return new DisposableDelegate(() => {\n ArrayExt.removeFirstOf(this._items, item);\n });\n }\n\n /**\n * Open the context menu in response to a `'contextmenu'` event.\n *\n * @param event - The `'contextmenu'` event of interest.\n *\n * @returns `true` if the menu was opened, or `false` if no items\n * matched the event and the menu was not opened.\n *\n * #### Notes\n * This method will populate the context menu with items which match\n * the propagation path of the event, then open the menu at the mouse\n * position indicated by the event.\n */\n open(event: MouseEvent): boolean {\n // Prior to any DOM modifications update the window data.\n Menu.saveWindowData();\n\n // Clear the current contents of the context menu.\n this.menu.clearItems();\n\n // Bail early if there are no items to match.\n if (this._items.length === 0) {\n return false;\n }\n\n // Find the matching items for the event.\n let items = Private.matchItems(\n this._items,\n event,\n this._groupByTarget,\n this._sortBySelector\n );\n\n // Bail if there are no matching items.\n if (!items || items.length === 0) {\n return false;\n }\n\n // Add the filtered items to the menu.\n for (const item of items) {\n this.menu.addItem(item);\n }\n\n // Open the context menu at the current mouse position.\n this.menu.open(event.clientX, event.clientY);\n\n // Indicate success.\n return true;\n }\n\n private _groupByTarget: boolean = true;\n private _idTick = 0;\n private _items: Private.IItem[] = [];\n private _sortBySelector: boolean = true;\n}\n\n/**\n * The namespace for the `ContextMenu` class statics.\n */\nexport namespace ContextMenu {\n /**\n * An options object for initializing a context menu.\n */\n export interface IOptions {\n /**\n * The command registry to use with the context menu.\n */\n commands: CommandRegistry;\n\n /**\n * A custom renderer for use with the context menu.\n */\n renderer?: Menu.IRenderer;\n\n /**\n * Whether to sort by selector and rank or only rank.\n *\n * Default true.\n */\n sortBySelector?: boolean;\n\n /**\n * Whether to group items following the DOM hierarchy.\n *\n * Default true.\n *\n * #### Note\n * If true, when the mouse event occurs on element `span` within `div.top`,\n * the items matching `div.top` will be shown before the ones matching `body`.\n */\n groupByTarget?: boolean;\n }\n\n /**\n * An options object for creating a context menu item.\n */\n export interface IItemOptions extends Menu.IItemOptions {\n /**\n * The CSS selector for the context menu item.\n *\n * The context menu item will only be displayed in the context menu\n * when the selector matches a node on the propagation path of the\n * contextmenu event. This allows the menu item to be restricted to\n * user-defined contexts.\n *\n * The selector must not contain commas.\n */\n selector: string;\n\n /**\n * The rank for the item.\n *\n * The rank is used as a tie-breaker when ordering context menu\n * items for display. Items are sorted in the following order:\n * 1. Depth in the DOM tree (deeper is better)\n * 2. Selector specificity (higher is better)\n * 3. Rank (lower is better)\n * 4. Insertion order\n *\n * The default rank is `Infinity`.\n */\n rank?: number;\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * A normalized item for a context menu.\n */\n export interface IItem extends Menu.IItemOptions {\n /**\n * The selector for the item.\n */\n selector: string;\n\n /**\n * The rank for the item.\n */\n rank: number;\n\n /**\n * The tie-breaking id for the item.\n */\n id: number;\n }\n\n /**\n * Create a normalized context menu item from an options object.\n */\n export function createItem(\n options: ContextMenu.IItemOptions,\n id: number\n ): IItem {\n let selector = validateSelector(options.selector);\n let rank = options.rank !== undefined ? options.rank : Infinity;\n return { ...options, selector, rank, id };\n }\n\n /**\n * Find the items which match a context menu event.\n *\n * The results are sorted by DOM level, specificity, and rank.\n */\n export function matchItems(\n items: IItem[],\n event: MouseEvent,\n groupByTarget: boolean,\n sortBySelector: boolean\n ): IItem[] | null {\n // Look up the target of the event.\n let target = event.target as Element | null;\n\n // Bail if there is no target.\n if (!target) {\n return null;\n }\n\n // Look up the current target of the event.\n let currentTarget = event.currentTarget as Element | null;\n\n // Bail if there is no current target.\n if (!currentTarget) {\n return null;\n }\n\n // There are some third party libraries that cause the `target` to\n // be detached from the DOM before lumino can process the event.\n // If that happens, search for a new target node by point. If that\n // node is still dangling, bail.\n if (!currentTarget.contains(target)) {\n target = document.elementFromPoint(event.clientX, event.clientY);\n if (!target || !currentTarget.contains(target)) {\n return null;\n }\n }\n\n // Set up the result array.\n let result: IItem[] = [];\n\n // Copy the items array to allow in-place modification.\n let availableItems: Array = items.slice();\n\n // Walk up the DOM hierarchy searching for matches.\n while (target !== null) {\n // Set up the match array for this DOM level.\n let matches: IItem[] = [];\n\n // Search the remaining items for matches.\n for (let i = 0, n = availableItems.length; i < n; ++i) {\n // Fetch the item.\n let item = availableItems[i];\n\n // Skip items which are already consumed.\n if (!item) {\n continue;\n }\n\n // Skip items which do not match the element.\n if (!Selector.matches(target, item.selector)) {\n continue;\n }\n\n // Add the matched item to the result for this DOM level.\n matches.push(item);\n\n // Mark the item as consumed.\n availableItems[i] = null;\n }\n\n // Sort the matches for this level and add them to the results.\n if (matches.length !== 0) {\n if (groupByTarget) {\n matches.sort(sortBySelector ? itemCmp : itemCmpRank);\n }\n result.push(...matches);\n }\n\n // Stop searching at the limits of the DOM range.\n if (target === currentTarget) {\n break;\n }\n\n // Step to the parent DOM level.\n target = target.parentElement;\n }\n\n if (!groupByTarget) {\n result.sort(sortBySelector ? itemCmp : itemCmpRank);\n }\n\n // Return the matched and sorted results.\n return result;\n }\n\n /**\n * Validate the selector for a menu item.\n *\n * This returns the validated selector, or throws if the selector is\n * invalid or contains commas.\n */\n function validateSelector(selector: string): string {\n if (selector.indexOf(',') !== -1) {\n throw new Error(`Selector cannot contain commas: ${selector}`);\n }\n if (!Selector.isValid(selector)) {\n throw new Error(`Invalid selector: ${selector}`);\n }\n return selector;\n }\n\n /**\n * A sort comparison function for a context menu item by ranks.\n */\n function itemCmpRank(a: IItem, b: IItem): number {\n // Sort based on rank.\n let r1 = a.rank;\n let r2 = b.rank;\n if (r1 !== r2) {\n return r1 < r2 ? -1 : 1; // Infinity-safe\n }\n\n // When all else fails, sort by item id.\n return a.id - b.id;\n }\n\n /**\n * A sort comparison function for a context menu item by selectors and ranks.\n */\n function itemCmp(a: IItem, b: IItem): number {\n // Sort first based on selector specificity.\n let s1 = Selector.calculateSpecificity(a.selector);\n let s2 = Selector.calculateSpecificity(b.selector);\n if (s1 !== s2) {\n return s2 - s1;\n }\n\n // If specificities are equal\n return itemCmpRank(a, b);\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { IDisposable } from '@lumino/disposable';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Drag } from '@lumino/dragdrop';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport {\n ElementARIAAttrs,\n ElementBaseAttrs,\n ElementDataset,\n ElementInlineStyle,\n h,\n VirtualDOM,\n VirtualElement\n} from '@lumino/virtualdom';\n\nimport { Title } from './title';\n\nimport { Widget } from './widget';\n\nconst ARROW_KEYS = [\n 'ArrowLeft',\n 'ArrowUp',\n 'ArrowRight',\n 'ArrowDown',\n 'Home',\n 'End'\n];\n\n/**\n * A widget which displays titles as a single row or column of tabs.\n *\n * #### Notes\n * If CSS transforms are used to rotate nodes for vertically oriented\n * text, then tab dragging will not work correctly. The `tabsMovable`\n * property should be set to `false` when rotating nodes from CSS.\n */\nexport class TabBar extends Widget {\n /**\n * Construct a new tab bar.\n *\n * @param options - The options for initializing the tab bar.\n */\n constructor(options: TabBar.IOptions = {}) {\n super({ node: Private.createNode() });\n this.addClass('lm-TabBar');\n this.contentNode.setAttribute('role', 'tablist');\n this.setFlag(Widget.Flag.DisallowLayout);\n this._document = options.document || document;\n this.tabsMovable = options.tabsMovable || false;\n this.titlesEditable = options.titlesEditable || false;\n this.allowDeselect = options.allowDeselect || false;\n this.addButtonEnabled = options.addButtonEnabled || false;\n this.insertBehavior = options.insertBehavior || 'select-tab-if-needed';\n this.name = options.name || '';\n this.orientation = options.orientation || 'horizontal';\n this.removeBehavior = options.removeBehavior || 'select-tab-after';\n this.renderer = options.renderer || TabBar.defaultRenderer;\n }\n\n /**\n * Dispose of the resources held by the widget.\n */\n dispose(): void {\n this._releaseMouse();\n this._titles.length = 0;\n this._previousTitle = null;\n super.dispose();\n }\n\n /**\n * A signal emitted when the current tab is changed.\n *\n * #### Notes\n * This signal is emitted when the currently selected tab is changed\n * either through user or programmatic interaction.\n *\n * Notably, this signal is not emitted when the index of the current\n * tab changes due to tabs being inserted, removed, or moved. It is\n * only emitted when the actual current tab node is changed.\n */\n get currentChanged(): ISignal> {\n return this._currentChanged;\n }\n\n /**\n * A signal emitted when a tab is moved by the user.\n *\n * #### Notes\n * This signal is emitted when a tab is moved by user interaction.\n *\n * This signal is not emitted when a tab is moved programmatically.\n */\n get tabMoved(): ISignal> {\n return this._tabMoved;\n }\n\n /**\n * A signal emitted when a tab is clicked by the user.\n *\n * #### Notes\n * If the clicked tab is not the current tab, the clicked tab will be\n * made current and the `currentChanged` signal will be emitted first.\n *\n * This signal is emitted even if the clicked tab is the current tab.\n */\n get tabActivateRequested(): ISignal<\n this,\n TabBar.ITabActivateRequestedArgs\n > {\n return this._tabActivateRequested;\n }\n\n /**\n * A signal emitted when the tab bar add button is clicked.\n */\n get addRequested(): ISignal {\n return this._addRequested;\n }\n\n /**\n * A signal emitted when a tab close icon is clicked.\n *\n * #### Notes\n * This signal is not emitted unless the tab title is `closable`.\n */\n get tabCloseRequested(): ISignal> {\n return this._tabCloseRequested;\n }\n\n /**\n * A signal emitted when a tab is dragged beyond the detach threshold.\n *\n * #### Notes\n * This signal is emitted when the user drags a tab with the mouse,\n * and mouse is dragged beyond the detach threshold.\n *\n * The consumer of the signal should call `releaseMouse` and remove\n * the tab in order to complete the detach.\n *\n * This signal is only emitted once per drag cycle.\n */\n get tabDetachRequested(): ISignal> {\n return this._tabDetachRequested;\n }\n\n /**\n * The renderer used by the tab bar.\n */\n readonly renderer: TabBar.IRenderer;\n\n /**\n * The document to use with the tab bar.\n *\n * The default is the global `document` instance.\n */\n get document(): Document | ShadowRoot {\n return this._document;\n }\n\n /**\n * Whether the tabs are movable by the user.\n *\n * #### Notes\n * Tabs can always be moved programmatically.\n */\n tabsMovable: boolean;\n\n /**\n * Whether the titles can be user-edited.\n *\n */\n get titlesEditable(): boolean {\n return this._titlesEditable;\n }\n\n /**\n * Set whether titles can be user edited.\n *\n */\n set titlesEditable(value: boolean) {\n this._titlesEditable = value;\n }\n\n /**\n * Whether a tab can be deselected by the user.\n *\n * #### Notes\n * Tabs can be always be deselected programmatically.\n */\n allowDeselect: boolean;\n\n /**\n * The selection behavior when inserting a tab.\n */\n insertBehavior: TabBar.InsertBehavior;\n\n /**\n * The selection behavior when removing a tab.\n */\n removeBehavior: TabBar.RemoveBehavior;\n\n /**\n * Get the currently selected title.\n *\n * #### Notes\n * This will be `null` if no tab is selected.\n */\n get currentTitle(): Title | null {\n return this._titles[this._currentIndex] || null;\n }\n\n /**\n * Set the currently selected title.\n *\n * #### Notes\n * If the title does not exist, the title will be set to `null`.\n */\n set currentTitle(value: Title | null) {\n this.currentIndex = value ? this._titles.indexOf(value) : -1;\n }\n\n /**\n * Get the index of the currently selected tab.\n *\n * #### Notes\n * This will be `-1` if no tab is selected.\n */\n get currentIndex(): number {\n return this._currentIndex;\n }\n\n /**\n * Set the index of the currently selected tab.\n *\n * #### Notes\n * If the value is out of range, the index will be set to `-1`.\n */\n set currentIndex(value: number) {\n // Adjust for an out of range index.\n if (value < 0 || value >= this._titles.length) {\n value = -1;\n }\n\n // Bail early if the index will not change.\n if (this._currentIndex === value) {\n return;\n }\n\n // Look up the previous index and title.\n let pi = this._currentIndex;\n let pt = this._titles[pi] || null;\n\n // Look up the current index and title.\n let ci = value;\n let ct = this._titles[ci] || null;\n\n // Update the current index and previous title.\n this._currentIndex = ci;\n this._previousTitle = pt;\n\n // Schedule an update of the tabs.\n this.update();\n\n // Emit the current changed signal.\n this._currentChanged.emit({\n previousIndex: pi,\n previousTitle: pt,\n currentIndex: ci,\n currentTitle: ct\n });\n }\n\n /**\n * Get the name of the tab bar.\n */\n get name(): string {\n return this._name;\n }\n\n /**\n * Set the name of the tab bar.\n */\n set name(value: string) {\n this._name = value;\n if (value) {\n this.contentNode.setAttribute('aria-label', value);\n } else {\n this.contentNode.removeAttribute('aria-label');\n }\n }\n\n /**\n * Get the orientation of the tab bar.\n *\n * #### Notes\n * This controls whether the tabs are arranged in a row or column.\n */\n get orientation(): TabBar.Orientation {\n return this._orientation;\n }\n\n /**\n * Set the orientation of the tab bar.\n *\n * #### Notes\n * This controls whether the tabs are arranged in a row or column.\n */\n set orientation(value: TabBar.Orientation) {\n // Do nothing if the orientation does not change.\n if (this._orientation === value) {\n return;\n }\n\n // Release the mouse before making any changes.\n this._releaseMouse();\n\n // Toggle the orientation values.\n this._orientation = value;\n this.dataset['orientation'] = value;\n this.contentNode.setAttribute('aria-orientation', value);\n }\n\n /**\n * Whether the add button is enabled.\n */\n get addButtonEnabled(): boolean {\n return this._addButtonEnabled;\n }\n\n /**\n * Set whether the add button is enabled.\n */\n set addButtonEnabled(value: boolean) {\n // Do nothing if the value does not change.\n if (this._addButtonEnabled === value) {\n return;\n }\n\n this._addButtonEnabled = value;\n if (value) {\n this.addButtonNode.classList.remove('lm-mod-hidden');\n } else {\n this.addButtonNode.classList.add('lm-mod-hidden');\n }\n }\n\n /**\n * A read-only array of the titles in the tab bar.\n */\n get titles(): ReadonlyArray> {\n return this._titles;\n }\n\n /**\n * The tab bar content node.\n *\n * #### Notes\n * This is the node which holds the tab nodes.\n *\n * Modifying this node directly can lead to undefined behavior.\n */\n get contentNode(): HTMLUListElement {\n return this.node.getElementsByClassName(\n 'lm-TabBar-content'\n )[0] as HTMLUListElement;\n }\n\n /**\n * The tab bar add button node.\n *\n * #### Notes\n * This is the node which holds the add button.\n *\n * Modifying this node directly can lead to undefined behavior.\n */\n get addButtonNode(): HTMLDivElement {\n return this.node.getElementsByClassName(\n 'lm-TabBar-addButton'\n )[0] as HTMLDivElement;\n }\n\n /**\n * Add a tab to the end of the tab bar.\n *\n * @param value - The title which holds the data for the tab,\n * or an options object to convert to a title.\n *\n * @returns The title object added to the tab bar.\n *\n * #### Notes\n * If the title is already added to the tab bar, it will be moved.\n */\n addTab(value: Title | Title.IOptions): Title {\n return this.insertTab(this._titles.length, value);\n }\n\n /**\n * Insert a tab into the tab bar at the specified index.\n *\n * @param index - The index at which to insert the tab.\n *\n * @param value - The title which holds the data for the tab,\n * or an options object to convert to a title.\n *\n * @returns The title object added to the tab bar.\n *\n * #### Notes\n * The index will be clamped to the bounds of the tabs.\n *\n * If the title is already added to the tab bar, it will be moved.\n */\n insertTab(index: number, value: Title | Title.IOptions): Title {\n // Release the mouse before making any changes.\n this._releaseMouse();\n\n // Coerce the value to a title.\n let title = Private.asTitle(value);\n\n // Look up the index of the title.\n let i = this._titles.indexOf(title);\n\n // Clamp the insert index to the array bounds.\n let j = Math.max(0, Math.min(index, this._titles.length));\n\n // If the title is not in the array, insert it.\n if (i === -1) {\n // Insert the title into the array.\n ArrayExt.insert(this._titles, j, title);\n\n // Connect to the title changed signal.\n title.changed.connect(this._onTitleChanged, this);\n\n // Schedule an update of the tabs.\n this.update();\n\n // Adjust the current index for the insert.\n this._adjustCurrentForInsert(j, title);\n\n // Return the title added to the tab bar.\n return title;\n }\n\n // Otherwise, the title exists in the array and should be moved.\n\n // Adjust the index if the location is at the end of the array.\n if (j === this._titles.length) {\n j--;\n }\n\n // Bail if there is no effective move.\n if (i === j) {\n return title;\n }\n\n // Move the title to the new location.\n ArrayExt.move(this._titles, i, j);\n\n // Schedule an update of the tabs.\n this.update();\n\n // Adjust the current index for the move.\n this._adjustCurrentForMove(i, j);\n\n // Return the title added to the tab bar.\n return title;\n }\n\n /**\n * Remove a tab from the tab bar.\n *\n * @param title - The title for the tab to remove.\n *\n * #### Notes\n * This is a no-op if the title is not in the tab bar.\n */\n removeTab(title: Title): void {\n this.removeTabAt(this._titles.indexOf(title));\n }\n\n /**\n * Remove the tab at a given index from the tab bar.\n *\n * @param index - The index of the tab to remove.\n *\n * #### Notes\n * This is a no-op if the index is out of range.\n */\n removeTabAt(index: number): void {\n // Release the mouse before making any changes.\n this._releaseMouse();\n\n // Remove the title from the array.\n let title = ArrayExt.removeAt(this._titles, index);\n\n // Bail if the index is out of range.\n if (!title) {\n return;\n }\n\n // Disconnect from the title changed signal.\n title.changed.disconnect(this._onTitleChanged, this);\n\n // Clear the previous title if it's being removed.\n if (title === this._previousTitle) {\n this._previousTitle = null;\n }\n\n // Schedule an update of the tabs.\n this.update();\n\n // Adjust the current index for the remove.\n this._adjustCurrentForRemove(index, title);\n }\n\n /**\n * Remove all tabs from the tab bar.\n */\n clearTabs(): void {\n // Bail if there is nothing to remove.\n if (this._titles.length === 0) {\n return;\n }\n\n // Release the mouse before making any changes.\n this._releaseMouse();\n\n // Disconnect from the title changed signals.\n for (let title of this._titles) {\n title.changed.disconnect(this._onTitleChanged, this);\n }\n\n // Get the current index and title.\n let pi = this.currentIndex;\n let pt = this.currentTitle;\n\n // Reset the current index and previous title.\n this._currentIndex = -1;\n this._previousTitle = null;\n\n // Clear the title array.\n this._titles.length = 0;\n\n // Schedule an update of the tabs.\n this.update();\n\n // If no tab was selected, there's nothing else to do.\n if (pi === -1) {\n return;\n }\n\n // Emit the current changed signal.\n this._currentChanged.emit({\n previousIndex: pi,\n previousTitle: pt,\n currentIndex: -1,\n currentTitle: null\n });\n }\n\n /**\n * Release the mouse and restore the non-dragged tab positions.\n *\n * #### Notes\n * This will cause the tab bar to stop handling mouse events and to\n * restore the tabs to their non-dragged positions.\n */\n releaseMouse(): void {\n this._releaseMouse();\n }\n\n /**\n * Handle the DOM events for the tab bar.\n *\n * @param event - The DOM event sent to the tab bar.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the tab bar's DOM node.\n *\n * This should not be called directly by user code.\n */\n handleEvent(event: Event): void {\n switch (event.type) {\n case 'pointerdown':\n this._evtPointerDown(event as PointerEvent);\n break;\n case 'pointermove':\n this._evtPointerMove(event as PointerEvent);\n break;\n case 'pointerup':\n this._evtPointerUp(event as PointerEvent);\n break;\n case 'dblclick':\n this._evtDblClick(event as MouseEvent);\n break;\n case 'keydown':\n event.eventPhase === Event.CAPTURING_PHASE\n ? this._evtKeyDownCapturing(event as KeyboardEvent)\n : this._evtKeyDown(event as KeyboardEvent);\n break;\n case 'contextmenu':\n event.preventDefault();\n event.stopPropagation();\n break;\n }\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n this.node.addEventListener('pointerdown', this);\n this.node.addEventListener('dblclick', this);\n this.node.addEventListener('keydown', this);\n }\n\n /**\n * A message handler invoked on an `'after-detach'` message.\n */\n protected onAfterDetach(msg: Message): void {\n this.node.removeEventListener('pointerdown', this);\n this.node.removeEventListener('dblclick', this);\n this.node.removeEventListener('keydown', this);\n this._releaseMouse();\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n protected onUpdateRequest(msg: Message): void {\n let titles = this._titles;\n let renderer = this.renderer;\n let currentTitle = this.currentTitle;\n let content = new Array(titles.length);\n // Keep the tabindex=\"0\" attribute to the tab which handled it before the update.\n // If the add button handles it, no need to do anything. If no element of the tab\n // bar handles it, set it on the current or the first tab to ensure one element\n // handles it after update.\n const tabHandlingTabindex =\n this._getCurrentTabindex() ??\n (this._currentIndex > -1 ? this._currentIndex : 0);\n\n for (let i = 0, n = titles.length; i < n; ++i) {\n let title = titles[i];\n let current = title === currentTitle;\n let zIndex = current ? n : n - i - 1;\n let tabIndex = tabHandlingTabindex === i ? 0 : -1;\n content[i] = renderer.renderTab({ title, current, zIndex, tabIndex });\n }\n VirtualDOM.render(content, this.contentNode);\n }\n\n /**\n * Get the index of the tab which handles tabindex=\"0\".\n * If the add button handles tabindex=\"0\", -1 is returned.\n * If none of the previous handles tabindex=\"0\", null is returned.\n */\n private _getCurrentTabindex(): number | null {\n let index = null;\n const elemTabindex = this.contentNode.querySelector('li[tabindex=\"0\"]');\n if (elemTabindex) {\n index = [...this.contentNode.children].indexOf(elemTabindex);\n } else if (\n this._addButtonEnabled &&\n this.addButtonNode.getAttribute('tabindex') === '0'\n ) {\n index = -1;\n }\n return index;\n }\n\n /**\n * Handle the `'dblclick'` event for the tab bar.\n */\n private _evtDblClick(event: MouseEvent): void {\n // Do nothing if titles are not editable\n if (!this.titlesEditable) {\n return;\n }\n\n let tabs = this.contentNode.children;\n\n // Find the index of the targeted tab.\n let index = ArrayExt.findFirstIndex(tabs, tab => {\n return ElementExt.hitTest(tab, event.clientX, event.clientY);\n });\n\n // Do nothing if the press is not on a tab.\n if (index === -1) {\n return;\n }\n\n let title = this.titles[index];\n let label = tabs[index].querySelector('.lm-TabBar-tabLabel') as HTMLElement;\n if (label && label.contains(event.target as HTMLElement)) {\n let value = title.label || '';\n\n // Clear the label element\n let oldValue = label.innerHTML;\n label.innerHTML = '';\n\n let input = document.createElement('input');\n input.classList.add('lm-TabBar-tabInput');\n input.value = value;\n label.appendChild(input);\n\n let onblur = () => {\n input.removeEventListener('blur', onblur);\n label.innerHTML = oldValue;\n this.node.addEventListener('keydown', this);\n };\n\n input.addEventListener('dblclick', (event: Event) =>\n event.stopPropagation()\n );\n input.addEventListener('blur', onblur);\n input.addEventListener('keydown', (event: KeyboardEvent) => {\n if (event.key === 'Enter') {\n if (input.value !== '') {\n title.label = title.caption = input.value;\n }\n onblur();\n } else if (event.key === 'Escape') {\n onblur();\n }\n });\n this.node.removeEventListener('keydown', this);\n input.select();\n input.focus();\n\n if (label.children.length > 0) {\n (label.children[0] as HTMLElement).focus();\n }\n }\n }\n\n /**\n * Handle the `'keydown'` event for the tab bar at capturing phase.\n */\n private _evtKeyDownCapturing(event: KeyboardEvent): void {\n if (event.eventPhase !== Event.CAPTURING_PHASE) {\n return;\n }\n\n // Stop all input events during drag.\n event.preventDefault();\n event.stopPropagation();\n\n // Release the mouse if `Escape` is pressed.\n if (event.key === 'Escape') {\n this._releaseMouse();\n }\n }\n\n /**\n * Handle the `'keydown'` event for the tab bar at target phase.\n */\n private _evtKeyDown(event: KeyboardEvent): void {\n // Allow for navigation using tab key\n if (event.key === 'Tab' || event.eventPhase === Event.CAPTURING_PHASE) {\n return;\n }\n\n // Check if Enter or Spacebar key has been pressed and open that tab\n if (\n event.key === 'Enter' ||\n event.key === 'Spacebar' ||\n event.key === ' '\n ) {\n // Get focus element that is in focus by the tab key\n const focusedElement = document.activeElement;\n\n // Test first if the focus is on the add button node\n if (\n this.addButtonEnabled &&\n this.addButtonNode.contains(focusedElement)\n ) {\n event.preventDefault();\n event.stopPropagation();\n this._addRequested.emit();\n } else {\n const index = ArrayExt.findFirstIndex(this.contentNode.children, tab =>\n tab.contains(focusedElement)\n );\n if (index >= 0) {\n event.preventDefault();\n event.stopPropagation();\n this.currentIndex = index;\n }\n }\n // Handle the arrow keys to switch tabs.\n } else if (ARROW_KEYS.includes(event.key)) {\n // Create a list of all focusable elements in the tab bar.\n const focusable: Element[] = [...this.contentNode.children];\n if (this.addButtonEnabled) {\n focusable.push(this.addButtonNode);\n }\n // If the tab bar contains only one element, nothing to do.\n if (focusable.length <= 1) {\n return;\n }\n event.preventDefault();\n event.stopPropagation();\n\n // Get the current focused element.\n let focusedIndex = focusable.indexOf(document.activeElement as Element);\n if (focusedIndex === -1) {\n focusedIndex = this._currentIndex;\n }\n\n // Find the next element to focus on.\n let nextFocused: Element | null | undefined;\n if (\n (event.key === 'ArrowRight' && this._orientation === 'horizontal') ||\n (event.key === 'ArrowDown' && this._orientation === 'vertical')\n ) {\n nextFocused = focusable[focusedIndex + 1] ?? focusable[0];\n } else if (\n (event.key === 'ArrowLeft' && this._orientation === 'horizontal') ||\n (event.key === 'ArrowUp' && this._orientation === 'vertical')\n ) {\n nextFocused =\n focusable[focusedIndex - 1] ?? focusable[focusable.length - 1];\n } else if (event.key === 'Home') {\n nextFocused = focusable[0];\n } else if (event.key === 'End') {\n nextFocused = focusable[focusable.length - 1];\n }\n\n // Change the focused element and the tabindex value.\n if (nextFocused) {\n focusable[focusedIndex]?.setAttribute('tabindex', '-1');\n nextFocused?.setAttribute('tabindex', '0');\n (nextFocused as HTMLElement).focus();\n }\n }\n }\n\n /**\n * Handle the `'pointerdown'` event for the tab bar.\n */\n private _evtPointerDown(event: PointerEvent | MouseEvent): void {\n // Do nothing if it's not a left or middle mouse press.\n if (event.button !== 0 && event.button !== 1) {\n return;\n }\n\n // Do nothing if a drag is in progress.\n if (this._dragData) {\n return;\n }\n\n // Do nothing if a title editable input was clicked.\n if (\n (event.target as HTMLElement).classList.contains('lm-TabBar-tabInput')\n ) {\n return;\n }\n\n // Check if the add button was clicked.\n let addButtonClicked =\n this.addButtonEnabled &&\n this.addButtonNode.contains(event.target as HTMLElement);\n\n // Lookup the tab nodes.\n let tabs = this.contentNode.children;\n\n // Find the index of the pressed tab.\n let index = ArrayExt.findFirstIndex(tabs, tab => {\n return ElementExt.hitTest(tab, event.clientX, event.clientY);\n });\n\n // Do nothing if the press is not on a tab or the add button.\n if (index === -1 && !addButtonClicked) {\n return;\n }\n\n // Pressing on a tab stops the event propagation.\n event.preventDefault();\n event.stopPropagation();\n\n // Initialize the non-measured parts of the drag data.\n this._dragData = {\n tab: tabs[index] as HTMLElement,\n index: index,\n pressX: event.clientX,\n pressY: event.clientY,\n tabPos: -1,\n tabSize: -1,\n tabPressPos: -1,\n targetIndex: -1,\n tabLayout: null,\n contentRect: null,\n override: null,\n dragActive: false,\n dragAborted: false,\n detachRequested: false\n };\n\n // Add the document pointer up listener.\n this.document.addEventListener('pointerup', this, true);\n\n // Do nothing else if the middle button or add button is clicked.\n if (event.button === 1 || addButtonClicked) {\n return;\n }\n\n // Do nothing else if the close icon is clicked.\n let icon = tabs[index].querySelector(this.renderer.closeIconSelector);\n if (icon && icon.contains(event.target as HTMLElement)) {\n return;\n }\n\n // Add the extra listeners if the tabs are movable.\n if (this.tabsMovable) {\n this.document.addEventListener('pointermove', this, true);\n this.document.addEventListener('keydown', this, true);\n this.document.addEventListener('contextmenu', this, true);\n }\n\n // Update the current index as appropriate.\n if (this.allowDeselect && this.currentIndex === index) {\n this.currentIndex = -1;\n } else {\n this.currentIndex = index;\n }\n\n // Do nothing else if there is no current tab.\n if (this.currentIndex === -1) {\n return;\n }\n\n // Emit the tab activate request signal.\n this._tabActivateRequested.emit({\n index: this.currentIndex,\n title: this.currentTitle!\n });\n }\n\n /**\n * Handle the `'pointermove'` event for the tab bar.\n */\n private _evtPointerMove(event: PointerEvent | MouseEvent): void {\n // Do nothing if no drag is in progress.\n let data = this._dragData;\n if (!data) {\n return;\n }\n\n // Suppress the event during a drag.\n event.preventDefault();\n event.stopPropagation();\n\n // Lookup the tab nodes.\n let tabs = this.contentNode.children;\n\n // Bail early if the drag threshold has not been met.\n if (!data.dragActive && !Private.dragExceeded(data, event)) {\n return;\n }\n\n // Activate the drag if necessary.\n if (!data.dragActive) {\n // Fill in the rest of the drag data measurements.\n let tabRect = data.tab.getBoundingClientRect();\n if (this._orientation === 'horizontal') {\n data.tabPos = data.tab.offsetLeft;\n data.tabSize = tabRect.width;\n data.tabPressPos = data.pressX - tabRect.left;\n } else {\n data.tabPos = data.tab.offsetTop;\n data.tabSize = tabRect.height;\n data.tabPressPos = data.pressY - tabRect.top;\n }\n data.tabPressOffset = {\n x: data.pressX - tabRect.left,\n y: data.pressY - tabRect.top\n };\n data.tabLayout = Private.snapTabLayout(tabs, this._orientation);\n data.contentRect = this.contentNode.getBoundingClientRect();\n data.override = Drag.overrideCursor('default');\n\n // Add the dragging style classes.\n data.tab.classList.add('lm-mod-dragging');\n this.addClass('lm-mod-dragging');\n\n // Mark the drag as active.\n data.dragActive = true;\n }\n\n // Emit the detach requested signal if the threshold is exceeded.\n if (!data.detachRequested && Private.detachExceeded(data, event)) {\n // Only emit the signal once per drag cycle.\n data.detachRequested = true;\n\n // Setup the arguments for the signal.\n let index = data.index;\n let clientX = event.clientX;\n let clientY = event.clientY;\n let tab = tabs[index] as HTMLElement;\n let title = this._titles[index];\n\n // Emit the tab detach requested signal.\n this._tabDetachRequested.emit({\n index,\n title,\n tab,\n clientX,\n clientY,\n offset: data.tabPressOffset\n });\n\n // Bail if the signal handler aborted the drag.\n if (data.dragAborted) {\n return;\n }\n }\n\n // Update the positions of the tabs.\n Private.layoutTabs(tabs, data, event, this._orientation);\n }\n\n /**\n * Handle the `'pointerup'` event for the document.\n */\n private _evtPointerUp(event: PointerEvent | MouseEvent): void {\n // Do nothing if it's not a left or middle mouse release.\n if (event.button !== 0 && event.button !== 1) {\n return;\n }\n\n // Do nothing if no drag is in progress.\n const data = this._dragData;\n if (!data) {\n return;\n }\n\n // Stop the event propagation.\n event.preventDefault();\n event.stopPropagation();\n\n // Remove the extra mouse event listeners.\n this.document.removeEventListener('pointermove', this, true);\n this.document.removeEventListener('pointerup', this, true);\n this.document.removeEventListener('keydown', this, true);\n this.document.removeEventListener('contextmenu', this, true);\n\n // Handle a release when the drag is not active.\n if (!data.dragActive) {\n // Clear the drag data.\n this._dragData = null;\n\n // Handle clicking the add button.\n let addButtonClicked =\n this.addButtonEnabled &&\n this.addButtonNode.contains(event.target as HTMLElement);\n if (addButtonClicked) {\n this._addRequested.emit(undefined);\n return;\n }\n\n // Lookup the tab nodes.\n let tabs = this.contentNode.children;\n\n // Find the index of the released tab.\n let index = ArrayExt.findFirstIndex(tabs, tab => {\n return ElementExt.hitTest(tab, event.clientX, event.clientY);\n });\n\n // Do nothing if the release is not on the original pressed tab.\n if (index !== data.index) {\n return;\n }\n\n // Ignore the release if the title is not closable.\n let title = this._titles[index];\n if (!title.closable) {\n return;\n }\n\n // Emit the close requested signal if the middle button is released.\n if (event.button === 1) {\n this._tabCloseRequested.emit({ index, title });\n return;\n }\n\n // Emit the close requested signal if the close icon was released.\n let icon = tabs[index].querySelector(this.renderer.closeIconSelector);\n if (icon && icon.contains(event.target as HTMLElement)) {\n this._tabCloseRequested.emit({ index, title });\n return;\n }\n\n // Otherwise, there is nothing left to do.\n return;\n }\n\n // Do nothing if the left button is not released.\n if (event.button !== 0) {\n return;\n }\n\n // Position the tab at its final resting position.\n Private.finalizeTabPosition(data, this._orientation);\n\n // Remove the dragging class from the tab so it can be transitioned.\n data.tab.classList.remove('lm-mod-dragging');\n\n // Parse the transition duration for releasing the tab.\n let duration = Private.parseTransitionDuration(data.tab);\n\n // Complete the release on a timer to allow the tab to transition.\n setTimeout(() => {\n // Do nothing if the drag has been aborted.\n if (data.dragAborted) {\n return;\n }\n\n // Clear the drag data reference.\n this._dragData = null;\n\n // Reset the positions of the tabs.\n Private.resetTabPositions(this.contentNode.children, this._orientation);\n\n // Clear the cursor grab.\n data.override!.dispose();\n\n // Remove the remaining dragging style.\n this.removeClass('lm-mod-dragging');\n\n // If the tab was not moved, there is nothing else to do.\n let i = data.index;\n let j = data.targetIndex;\n if (j === -1 || i === j) {\n return;\n }\n\n // Move the title to the new locations.\n ArrayExt.move(this._titles, i, j);\n\n // Adjust the current index for the move.\n this._adjustCurrentForMove(i, j);\n\n // Emit the tab moved signal.\n this._tabMoved.emit({\n fromIndex: i,\n toIndex: j,\n title: this._titles[j]\n });\n\n // Update the tabs immediately to prevent flicker.\n MessageLoop.sendMessage(this, Widget.Msg.UpdateRequest);\n }, duration);\n }\n\n /**\n * Release the mouse and restore the non-dragged tab positions.\n */\n private _releaseMouse(): void {\n // Do nothing if no drag is in progress.\n let data = this._dragData;\n if (!data) {\n return;\n }\n\n // Clear the drag data reference.\n this._dragData = null;\n\n // Remove the extra document event listeners.\n this.document.removeEventListener('pointermove', this, true);\n this.document.removeEventListener('pointerup', this, true);\n this.document.removeEventListener('keydown', this, true);\n this.document.removeEventListener('contextmenu', this, true);\n\n // Indicate the drag has been aborted. This allows the mouse\n // event handlers to return early when the drag is canceled.\n data.dragAborted = true;\n\n // If the drag is not active, there's nothing more to do.\n if (!data.dragActive) {\n return;\n }\n\n // Reset the tabs to their non-dragged positions.\n Private.resetTabPositions(this.contentNode.children, this._orientation);\n\n // Clear the cursor override.\n data.override!.dispose();\n\n // Clear the dragging style classes.\n data.tab.classList.remove('lm-mod-dragging');\n this.removeClass('lm-mod-dragging');\n }\n\n /**\n * Adjust the current index for a tab insert operation.\n *\n * This method accounts for the tab bar's insertion behavior when\n * adjusting the current index and emitting the changed signal.\n */\n private _adjustCurrentForInsert(i: number, title: Title): void {\n // Lookup commonly used variables.\n let ct = this.currentTitle;\n let ci = this._currentIndex;\n let bh = this.insertBehavior;\n\n // TODO: do we need to do an update to update the aria-selected attribute?\n\n // Handle the behavior where the new tab is always selected,\n // or the behavior where the new tab is selected if needed.\n if (bh === 'select-tab' || (bh === 'select-tab-if-needed' && ci === -1)) {\n this._currentIndex = i;\n this._previousTitle = ct;\n this._currentChanged.emit({\n previousIndex: ci,\n previousTitle: ct,\n currentIndex: i,\n currentTitle: title\n });\n return;\n }\n\n // Otherwise, silently adjust the current index if needed.\n if (ci >= i) {\n this._currentIndex++;\n }\n }\n\n /**\n * Adjust the current index for a tab move operation.\n *\n * This method will not cause the actual current tab to change.\n * It silently adjusts the index to account for the given move.\n */\n private _adjustCurrentForMove(i: number, j: number): void {\n if (this._currentIndex === i) {\n this._currentIndex = j;\n } else if (this._currentIndex < i && this._currentIndex >= j) {\n this._currentIndex++;\n } else if (this._currentIndex > i && this._currentIndex <= j) {\n this._currentIndex--;\n }\n }\n\n /**\n * Adjust the current index for a tab remove operation.\n *\n * This method accounts for the tab bar's remove behavior when\n * adjusting the current index and emitting the changed signal.\n */\n private _adjustCurrentForRemove(i: number, title: Title): void {\n // Lookup commonly used variables.\n let ci = this._currentIndex;\n let bh = this.removeBehavior;\n\n // Silently adjust the index if the current tab is not removed.\n if (ci !== i) {\n if (ci > i) {\n this._currentIndex--;\n }\n return;\n }\n\n // TODO: do we need to do an update to adjust the aria-selected value?\n\n // No tab gets selected if the tab bar is empty.\n if (this._titles.length === 0) {\n this._currentIndex = -1;\n this._currentChanged.emit({\n previousIndex: i,\n previousTitle: title,\n currentIndex: -1,\n currentTitle: null\n });\n return;\n }\n\n // Handle behavior where the next sibling tab is selected.\n if (bh === 'select-tab-after') {\n this._currentIndex = Math.min(i, this._titles.length - 1);\n this._currentChanged.emit({\n previousIndex: i,\n previousTitle: title,\n currentIndex: this._currentIndex,\n currentTitle: this.currentTitle\n });\n return;\n }\n\n // Handle behavior where the previous sibling tab is selected.\n if (bh === 'select-tab-before') {\n this._currentIndex = Math.max(0, i - 1);\n this._currentChanged.emit({\n previousIndex: i,\n previousTitle: title,\n currentIndex: this._currentIndex,\n currentTitle: this.currentTitle\n });\n return;\n }\n\n // Handle behavior where the previous history tab is selected.\n if (bh === 'select-previous-tab') {\n if (this._previousTitle) {\n this._currentIndex = this._titles.indexOf(this._previousTitle);\n this._previousTitle = null;\n } else {\n this._currentIndex = Math.min(i, this._titles.length - 1);\n }\n this._currentChanged.emit({\n previousIndex: i,\n previousTitle: title,\n currentIndex: this._currentIndex,\n currentTitle: this.currentTitle\n });\n return;\n }\n\n // Otherwise, no tab gets selected.\n this._currentIndex = -1;\n this._currentChanged.emit({\n previousIndex: i,\n previousTitle: title,\n currentIndex: -1,\n currentTitle: null\n });\n }\n\n /**\n * Handle the `changed` signal of a title object.\n */\n private _onTitleChanged(sender: Title): void {\n this.update();\n }\n\n private _name: string;\n private _currentIndex = -1;\n private _titles: Title[] = [];\n private _orientation: TabBar.Orientation;\n private _document: Document | ShadowRoot;\n private _titlesEditable: boolean = false;\n private _previousTitle: Title | null = null;\n private _dragData: Private.IDragData | null = null;\n private _addButtonEnabled: boolean = false;\n private _tabMoved = new Signal>(this);\n private _currentChanged = new Signal>(\n this\n );\n private _addRequested = new Signal(this);\n private _tabCloseRequested = new Signal<\n this,\n TabBar.ITabCloseRequestedArgs\n >(this);\n private _tabDetachRequested = new Signal<\n this,\n TabBar.ITabDetachRequestedArgs\n >(this);\n private _tabActivateRequested = new Signal<\n this,\n TabBar.ITabActivateRequestedArgs\n >(this);\n}\n\n/**\n * The namespace for the `TabBar` class statics.\n */\nexport namespace TabBar {\n /**\n * A type alias for a tab bar orientation.\n */\n export type Orientation =\n | /**\n * The tabs are arranged in a single row, left-to-right.\n *\n * The tab text orientation is horizontal.\n */\n 'horizontal'\n\n /**\n * The tabs are arranged in a single column, top-to-bottom.\n *\n * The tab text orientation is horizontal.\n */\n | 'vertical';\n\n /**\n * A type alias for the selection behavior on tab insert.\n */\n export type InsertBehavior =\n | /**\n * The selected tab will not be changed.\n */\n 'none'\n\n /**\n * The inserted tab will be selected.\n */\n | 'select-tab'\n\n /**\n * The inserted tab will be selected if the current tab is null.\n */\n | 'select-tab-if-needed';\n\n /**\n * A type alias for the selection behavior on tab remove.\n */\n export type RemoveBehavior =\n | /**\n * No tab will be selected.\n */\n 'none'\n\n /**\n * The tab after the removed tab will be selected if possible.\n */\n | 'select-tab-after'\n\n /**\n * The tab before the removed tab will be selected if possible.\n */\n | 'select-tab-before'\n\n /**\n * The previously selected tab will be selected if possible.\n */\n | 'select-previous-tab';\n\n /**\n * An options object for creating a tab bar.\n */\n export interface IOptions {\n /**\n * The document to use with the tab bar.\n *\n * The default is the global `document` instance.\n */\n\n document?: Document | ShadowRoot;\n\n /**\n * Name of the tab bar.\n *\n * This is used for accessibility reasons. The default is the empty string.\n */\n name?: string;\n\n /**\n * The layout orientation of the tab bar.\n *\n * The default is `horizontal`.\n */\n orientation?: TabBar.Orientation;\n\n /**\n * Whether the tabs are movable by the user.\n *\n * The default is `false`.\n */\n tabsMovable?: boolean;\n\n /**\n * Whether a tab can be deselected by the user.\n *\n * The default is `false`.\n */\n allowDeselect?: boolean;\n\n /**\n * Whether the titles can be directly edited by the user.\n *\n * The default is `false`.\n */\n titlesEditable?: boolean;\n\n /**\n * Whether the add button is enabled.\n *\n * The default is `false`.\n */\n addButtonEnabled?: boolean;\n\n /**\n * The selection behavior when inserting a tab.\n *\n * The default is `'select-tab-if-needed'`.\n */\n insertBehavior?: TabBar.InsertBehavior;\n\n /**\n * The selection behavior when removing a tab.\n *\n * The default is `'select-tab-after'`.\n */\n removeBehavior?: TabBar.RemoveBehavior;\n\n /**\n * A renderer to use with the tab bar.\n *\n * The default is a shared renderer instance.\n */\n renderer?: IRenderer;\n }\n\n /**\n * The arguments object for the `currentChanged` signal.\n */\n export interface ICurrentChangedArgs {\n /**\n * The previously selected index.\n */\n readonly previousIndex: number;\n\n /**\n * The previously selected title.\n */\n readonly previousTitle: Title | null;\n\n /**\n * The currently selected index.\n */\n readonly currentIndex: number;\n\n /**\n * The currently selected title.\n */\n readonly currentTitle: Title | null;\n }\n\n /**\n * The arguments object for the `tabMoved` signal.\n */\n export interface ITabMovedArgs {\n /**\n * The previous index of the tab.\n */\n readonly fromIndex: number;\n\n /**\n * The current index of the tab.\n */\n readonly toIndex: number;\n\n /**\n * The title for the tab.\n */\n readonly title: Title;\n }\n\n /**\n * The arguments object for the `tabActivateRequested` signal.\n */\n export interface ITabActivateRequestedArgs {\n /**\n * The index of the tab to activate.\n */\n readonly index: number;\n\n /**\n * The title for the tab.\n */\n readonly title: Title;\n }\n\n /**\n * The arguments object for the `tabCloseRequested` signal.\n */\n export interface ITabCloseRequestedArgs {\n /**\n * The index of the tab to close.\n */\n readonly index: number;\n\n /**\n * The title for the tab.\n */\n readonly title: Title;\n }\n\n /**\n * The arguments object for the `tabDetachRequested` signal.\n */\n export interface ITabDetachRequestedArgs {\n /**\n * The index of the tab to detach.\n */\n readonly index: number;\n\n /**\n * The title for the tab.\n */\n readonly title: Title;\n\n /**\n * The node representing the tab.\n */\n readonly tab: HTMLElement;\n\n /**\n * The current client X position of the mouse.\n */\n readonly clientX: number;\n\n /**\n * The current client Y position of the mouse.\n */\n readonly clientY: number;\n\n /**\n * The mouse position in the tab coordinate.\n */\n readonly offset?: { x: number; y: number };\n }\n\n /**\n * An object which holds the data to render a tab.\n */\n export interface IRenderData {\n /**\n * The title associated with the tab.\n */\n readonly title: Title;\n\n /**\n * Whether the tab is the current tab.\n */\n readonly current: boolean;\n\n /**\n * The z-index for the tab.\n */\n readonly zIndex: number;\n\n /**\n * The tabindex value for the tab.\n */\n readonly tabIndex?: number;\n }\n\n /**\n * A renderer for use with a tab bar.\n */\n export interface IRenderer {\n /**\n * A selector which matches the close icon node in a tab.\n */\n readonly closeIconSelector: string;\n\n /**\n * Render the virtual element for a tab.\n *\n * @param data - The data to use for rendering the tab.\n *\n * @returns A virtual element representing the tab.\n */\n renderTab(data: IRenderData): VirtualElement;\n }\n\n /**\n * The default implementation of `IRenderer`.\n *\n * #### Notes\n * Subclasses are free to reimplement rendering methods as needed.\n */\n export class Renderer implements IRenderer {\n constructor() {\n this._uuid = ++Renderer._nInstance;\n }\n /**\n * A selector which matches the close icon node in a tab.\n */\n readonly closeIconSelector = '.lm-TabBar-tabCloseIcon';\n\n /**\n * Render the virtual element for a tab.\n *\n * @param data - The data to use for rendering the tab.\n *\n * @returns A virtual element representing the tab.\n */\n renderTab(data: IRenderData): VirtualElement {\n let title = data.title.caption;\n let key = this.createTabKey(data);\n let id = key;\n let style = this.createTabStyle(data);\n let className = this.createTabClass(data);\n let dataset = this.createTabDataset(data);\n let aria = this.createTabARIA(data);\n if (data.title.closable) {\n return h.li(\n { id, key, className, title, style, dataset, ...aria },\n this.renderIcon(data),\n this.renderLabel(data),\n this.renderCloseIcon(data)\n );\n } else {\n return h.li(\n { id, key, className, title, style, dataset, ...aria },\n this.renderIcon(data),\n this.renderLabel(data)\n );\n }\n }\n\n /**\n * Render the icon element for a tab.\n *\n * @param data - The data to use for rendering the tab.\n *\n * @returns A virtual element representing the tab icon.\n */\n renderIcon(data: IRenderData): VirtualElement {\n const { title } = data;\n let className = this.createIconClass(data);\n\n // If title.icon is undefined, it will be ignored.\n return h.div({ className }, title.icon!, title.iconLabel);\n }\n\n /**\n * Render the label element for a tab.\n *\n * @param data - The data to use for rendering the tab.\n *\n * @returns A virtual element representing the tab label.\n */\n renderLabel(data: IRenderData): VirtualElement {\n return h.div({ className: 'lm-TabBar-tabLabel' }, data.title.label);\n }\n\n /**\n * Render the close icon element for a tab.\n *\n * @param data - The data to use for rendering the tab.\n *\n * @returns A virtual element representing the tab close icon.\n */\n renderCloseIcon(data: IRenderData): VirtualElement {\n return h.div({ className: 'lm-TabBar-tabCloseIcon' });\n }\n\n /**\n * Create a unique render key for the tab.\n *\n * @param data - The data to use for the tab.\n *\n * @returns The unique render key for the tab.\n *\n * #### Notes\n * This method caches the key against the tab title the first time\n * the key is generated. This enables efficient rendering of moved\n * tabs and avoids subtle hover style artifacts.\n */\n createTabKey(data: IRenderData): string {\n let key = this._tabKeys.get(data.title);\n if (key === undefined) {\n key = `tab-key-${this._uuid}-${this._tabID++}`;\n this._tabKeys.set(data.title, key);\n }\n return key;\n }\n\n /**\n * Create the inline style object for a tab.\n *\n * @param data - The data to use for the tab.\n *\n * @returns The inline style data for the tab.\n */\n createTabStyle(data: IRenderData): ElementInlineStyle {\n return { zIndex: `${data.zIndex}` };\n }\n\n /**\n * Create the class name for the tab.\n *\n * @param data - The data to use for the tab.\n *\n * @returns The full class name for the tab.\n */\n createTabClass(data: IRenderData): string {\n let name = 'lm-TabBar-tab';\n if (data.title.className) {\n name += ` ${data.title.className}`;\n }\n if (data.title.closable) {\n name += ' lm-mod-closable';\n }\n if (data.current) {\n name += ' lm-mod-current';\n }\n return name;\n }\n\n /**\n * Create the dataset for a tab.\n *\n * @param data - The data to use for the tab.\n *\n * @returns The dataset for the tab.\n */\n createTabDataset(data: IRenderData): ElementDataset {\n return data.title.dataset;\n }\n\n /**\n * Create the ARIA attributes for a tab.\n *\n * @param data - The data to use for the tab.\n *\n * @returns The ARIA attributes for the tab.\n */\n createTabARIA(data: IRenderData): ElementARIAAttrs | ElementBaseAttrs {\n return {\n role: 'tab',\n 'aria-selected': data.current.toString(),\n tabindex: `${data.tabIndex ?? '-1'}`\n };\n }\n\n /**\n * Create the class name for the tab icon.\n *\n * @param data - The data to use for the tab.\n *\n * @returns The full class name for the tab icon.\n */\n createIconClass(data: IRenderData): string {\n let name = 'lm-TabBar-tabIcon';\n let extra = data.title.iconClass;\n return extra ? `${name} ${extra}` : name;\n }\n\n private static _nInstance = 0;\n private readonly _uuid: number;\n private _tabID = 0;\n private _tabKeys = new WeakMap, string>();\n }\n\n /**\n * The default `Renderer` instance.\n */\n export const defaultRenderer = new Renderer();\n\n /**\n * A selector which matches the add button node in the tab bar.\n */\n export const addButtonSelector = '.lm-TabBar-addButton';\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * The start drag distance threshold.\n */\n export const DRAG_THRESHOLD = 5;\n\n /**\n * The detach distance threshold.\n */\n export const DETACH_THRESHOLD = 20;\n\n /**\n * A struct which holds the drag data for a tab bar.\n */\n export interface IDragData {\n /**\n * The tab node being dragged.\n */\n tab: HTMLElement;\n\n /**\n * The index of the tab being dragged.\n */\n index: number;\n\n /**\n * The mouse press client X position.\n */\n pressX: number;\n\n /**\n * The mouse press client Y position.\n */\n pressY: number;\n\n /**\n * The offset left/top of the tab being dragged.\n *\n * This will be `-1` if the drag is not active.\n */\n tabPos: number;\n\n /**\n * The offset width/height of the tab being dragged.\n *\n * This will be `-1` if the drag is not active.\n */\n tabSize: number;\n\n /**\n * The original mouse X/Y position in tab coordinates.\n *\n * This will be `-1` if the drag is not active.\n */\n tabPressPos: number;\n\n /**\n * The original mouse position in tab coordinates.\n *\n * This is undefined if the drag is not active.\n */\n tabPressOffset?: { x: number; y: number };\n\n /**\n * The tab target index upon mouse release.\n *\n * This will be `-1` if the drag is not active.\n */\n targetIndex: number;\n\n /**\n * The array of tab layout objects snapped at drag start.\n *\n * This will be `null` if the drag is not active.\n */\n tabLayout: ITabLayout[] | null;\n\n /**\n * The bounding client rect of the tab bar content node.\n *\n * This will be `null` if the drag is not active.\n */\n contentRect: DOMRect | null;\n\n /**\n * The disposable to clean up the cursor override.\n *\n * This will be `null` if the drag is not active.\n */\n override: IDisposable | null;\n\n /**\n * Whether the drag is currently active.\n */\n dragActive: boolean;\n\n /**\n * Whether the drag has been aborted.\n */\n dragAborted: boolean;\n\n /**\n * Whether a detach request as been made.\n */\n detachRequested: boolean;\n }\n\n /**\n * An object which holds layout data for a tab.\n */\n export interface ITabLayout {\n /**\n * The left/top margin value for the tab.\n */\n margin: number;\n\n /**\n * The offset left/top position of the tab.\n */\n pos: number;\n\n /**\n * The offset width/height of the tab.\n */\n size: number;\n }\n\n /**\n * Create the DOM node for a tab bar.\n */\n export function createNode(): HTMLDivElement {\n let node = document.createElement('div');\n let content = document.createElement('ul');\n content.setAttribute('role', 'tablist');\n content.className = 'lm-TabBar-content';\n node.appendChild(content);\n\n let add = document.createElement('div');\n add.className = 'lm-TabBar-addButton lm-mod-hidden';\n add.setAttribute('tabindex', '-1');\n add.setAttribute('role', 'button');\n node.appendChild(add);\n return node;\n }\n\n /**\n * Coerce a title or options into a real title.\n */\n export function asTitle(value: Title | Title.IOptions): Title {\n return value instanceof Title ? value : new Title(value);\n }\n\n /**\n * Parse the transition duration for a tab node.\n */\n export function parseTransitionDuration(tab: HTMLElement): number {\n let style = window.getComputedStyle(tab);\n return 1000 * (parseFloat(style.transitionDuration!) || 0);\n }\n\n /**\n * Get a snapshot of the current tab layout values.\n */\n export function snapTabLayout(\n tabs: HTMLCollection,\n orientation: TabBar.Orientation\n ): ITabLayout[] {\n let layout = new Array(tabs.length);\n for (let i = 0, n = tabs.length; i < n; ++i) {\n let node = tabs[i] as HTMLElement;\n let style = window.getComputedStyle(node);\n if (orientation === 'horizontal') {\n layout[i] = {\n pos: node.offsetLeft,\n size: node.offsetWidth,\n margin: parseFloat(style.marginLeft!) || 0\n };\n } else {\n layout[i] = {\n pos: node.offsetTop,\n size: node.offsetHeight,\n margin: parseFloat(style.marginTop!) || 0\n };\n }\n }\n return layout;\n }\n\n /**\n * Test if the event exceeds the drag threshold.\n */\n export function dragExceeded(data: IDragData, event: MouseEvent): boolean {\n let dx = Math.abs(event.clientX - data.pressX);\n let dy = Math.abs(event.clientY - data.pressY);\n return dx >= DRAG_THRESHOLD || dy >= DRAG_THRESHOLD;\n }\n\n /**\n * Test if the event exceeds the drag detach threshold.\n */\n export function detachExceeded(data: IDragData, event: MouseEvent): boolean {\n let rect = data.contentRect!;\n return (\n event.clientX < rect.left - DETACH_THRESHOLD ||\n event.clientX >= rect.right + DETACH_THRESHOLD ||\n event.clientY < rect.top - DETACH_THRESHOLD ||\n event.clientY >= rect.bottom + DETACH_THRESHOLD\n );\n }\n\n /**\n * Update the relative tab positions and computed target index.\n */\n export function layoutTabs(\n tabs: HTMLCollection,\n data: IDragData,\n event: MouseEvent,\n orientation: TabBar.Orientation\n ): void {\n // Compute the orientation-sensitive values.\n let pressPos: number;\n let localPos: number;\n let clientPos: number;\n let clientSize: number;\n if (orientation === 'horizontal') {\n pressPos = data.pressX;\n localPos = event.clientX - data.contentRect!.left;\n clientPos = event.clientX;\n clientSize = data.contentRect!.width;\n } else {\n pressPos = data.pressY;\n localPos = event.clientY - data.contentRect!.top;\n clientPos = event.clientY;\n clientSize = data.contentRect!.height;\n }\n\n // Compute the target data.\n let targetIndex = data.index;\n let targetPos = localPos - data.tabPressPos;\n let targetEnd = targetPos + data.tabSize;\n\n // Update the relative tab positions.\n for (let i = 0, n = tabs.length; i < n; ++i) {\n let pxPos: string;\n let layout = data.tabLayout![i];\n let threshold = layout.pos + (layout.size >> 1);\n if (i < data.index && targetPos < threshold) {\n pxPos = `${data.tabSize + data.tabLayout![i + 1].margin}px`;\n targetIndex = Math.min(targetIndex, i);\n } else if (i > data.index && targetEnd > threshold) {\n pxPos = `${-data.tabSize - layout.margin}px`;\n targetIndex = Math.max(targetIndex, i);\n } else if (i === data.index) {\n let ideal = clientPos - pressPos;\n let limit = clientSize - (data.tabPos + data.tabSize);\n pxPos = `${Math.max(-data.tabPos, Math.min(ideal, limit))}px`;\n } else {\n pxPos = '';\n }\n if (orientation === 'horizontal') {\n (tabs[i] as HTMLElement).style.left = pxPos;\n } else {\n (tabs[i] as HTMLElement).style.top = pxPos;\n }\n }\n\n // Update the computed target index.\n data.targetIndex = targetIndex;\n }\n\n /**\n * Position the drag tab at its final resting relative position.\n */\n export function finalizeTabPosition(\n data: IDragData,\n orientation: TabBar.Orientation\n ): void {\n // Compute the orientation-sensitive client size.\n let clientSize: number;\n if (orientation === 'horizontal') {\n clientSize = data.contentRect!.width;\n } else {\n clientSize = data.contentRect!.height;\n }\n\n // Compute the ideal final tab position.\n let ideal: number;\n if (data.targetIndex === data.index) {\n ideal = 0;\n } else if (data.targetIndex > data.index) {\n let tgt = data.tabLayout![data.targetIndex];\n ideal = tgt.pos + tgt.size - data.tabSize - data.tabPos;\n } else {\n let tgt = data.tabLayout![data.targetIndex];\n ideal = tgt.pos - data.tabPos;\n }\n\n // Compute the tab position limit.\n let limit = clientSize - (data.tabPos + data.tabSize);\n let final = Math.max(-data.tabPos, Math.min(ideal, limit));\n\n // Set the final orientation-sensitive position.\n if (orientation === 'horizontal') {\n data.tab.style.left = `${final}px`;\n } else {\n data.tab.style.top = `${final}px`;\n }\n }\n\n /**\n * Reset the relative positions of the given tabs.\n */\n export function resetTabPositions(\n tabs: HTMLCollection,\n orientation: TabBar.Orientation\n ): void {\n for (const tab of tabs) {\n if (orientation === 'horizontal') {\n (tab as HTMLElement).style.left = '';\n } else {\n (tab as HTMLElement).style.top = '';\n }\n }\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt, empty } from '@lumino/algorithm';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { BoxEngine, BoxSizer } from './boxengine';\n\nimport { Layout, LayoutItem } from './layout';\n\nimport { TabBar } from './tabbar';\n\nimport Utils from './utils';\n\nimport { Widget } from './widget';\n\n/**\n * A layout which provides a flexible docking arrangement.\n *\n * #### Notes\n * The consumer of this layout is responsible for handling all signals\n * from the generated tab bars and managing the visibility of widgets\n * and tab bars as needed.\n */\nexport class DockLayout extends Layout {\n /**\n * Construct a new dock layout.\n *\n * @param options - The options for initializing the layout.\n */\n constructor(options: DockLayout.IOptions) {\n super();\n this.renderer = options.renderer;\n if (options.spacing !== undefined) {\n this._spacing = Utils.clampDimension(options.spacing);\n }\n this._document = options.document || document;\n this._hiddenMode =\n options.hiddenMode !== undefined\n ? options.hiddenMode\n : Widget.HiddenMode.Display;\n }\n\n /**\n * Dispose of the resources held by the layout.\n *\n * #### Notes\n * This will clear and dispose all widgets in the layout.\n */\n dispose(): void {\n // Get an iterator over the widgets in the layout.\n let widgets = this[Symbol.iterator]();\n\n // Dispose of the layout items.\n this._items.forEach(item => {\n item.dispose();\n });\n\n // Clear the layout state before disposing the widgets.\n this._box = null;\n this._root = null;\n this._items.clear();\n\n // Dispose of the widgets contained in the old layout root.\n for (const widget of widgets) {\n widget.dispose();\n }\n\n // Dispose of the base class.\n super.dispose();\n }\n\n /**\n * The renderer used by the dock layout.\n */\n readonly renderer: DockLayout.IRenderer;\n\n /**\n * The method for hiding child widgets.\n *\n * #### Notes\n * If there is only one child widget, `Display` hiding mode will be used\n * regardless of this setting.\n */\n get hiddenMode(): Widget.HiddenMode {\n return this._hiddenMode;\n }\n set hiddenMode(v: Widget.HiddenMode) {\n if (this._hiddenMode === v) {\n return;\n }\n this._hiddenMode = v;\n for (const bar of this.tabBars()) {\n if (bar.titles.length > 1) {\n for (const title of bar.titles) {\n title.owner.hiddenMode = this._hiddenMode;\n }\n }\n }\n }\n\n /**\n * Get the inter-element spacing for the dock layout.\n */\n get spacing(): number {\n return this._spacing;\n }\n\n /**\n * Set the inter-element spacing for the dock layout.\n */\n set spacing(value: number) {\n value = Utils.clampDimension(value);\n if (this._spacing === value) {\n return;\n }\n this._spacing = value;\n if (!this.parent) {\n return;\n }\n this.parent.fit();\n }\n\n /**\n * Whether the dock layout is empty.\n */\n get isEmpty(): boolean {\n return this._root === null;\n }\n\n /**\n * Create an iterator over all widgets in the layout.\n *\n * @returns A new iterator over the widgets in the layout.\n *\n * #### Notes\n * This iterator includes the generated tab bars.\n */\n [Symbol.iterator](): IterableIterator {\n return this._root ? this._root.iterAllWidgets() : empty();\n }\n\n /**\n * Create an iterator over the user widgets in the layout.\n *\n * @returns A new iterator over the user widgets in the layout.\n *\n * #### Notes\n * This iterator does not include the generated tab bars.\n */\n widgets(): IterableIterator {\n return this._root ? this._root.iterUserWidgets() : empty();\n }\n\n /**\n * Create an iterator over the selected widgets in the layout.\n *\n * @returns A new iterator over the selected user widgets.\n *\n * #### Notes\n * This iterator yields the widgets corresponding to the current tab\n * of each tab bar in the layout.\n */\n selectedWidgets(): IterableIterator {\n return this._root ? this._root.iterSelectedWidgets() : empty();\n }\n\n /**\n * Create an iterator over the tab bars in the layout.\n *\n * @returns A new iterator over the tab bars in the layout.\n *\n * #### Notes\n * This iterator does not include the user widgets.\n */\n tabBars(): IterableIterator> {\n return this._root ? this._root.iterTabBars() : empty();\n }\n\n /**\n * Create an iterator over the handles in the layout.\n *\n * @returns A new iterator over the handles in the layout.\n */\n handles(): IterableIterator {\n return this._root ? this._root.iterHandles() : empty();\n }\n\n /**\n * Move a handle to the given offset position.\n *\n * @param handle - The handle to move.\n *\n * @param offsetX - The desired offset X position of the handle.\n *\n * @param offsetY - The desired offset Y position of the handle.\n *\n * #### Notes\n * If the given handle is not contained in the layout, this is no-op.\n *\n * The handle will be moved as close as possible to the desired\n * position without violating any of the layout constraints.\n *\n * Only one of the coordinates is used depending on the orientation\n * of the handle. This method accepts both coordinates to make it\n * easy to invoke from a mouse move event without needing to know\n * the handle orientation.\n */\n moveHandle(handle: HTMLDivElement, offsetX: number, offsetY: number): void {\n // Bail early if there is no root or if the handle is hidden.\n let hidden = handle.classList.contains('lm-mod-hidden');\n if (!this._root || hidden) {\n return;\n }\n\n // Lookup the split node for the handle.\n let data = this._root.findSplitNode(handle);\n if (!data) {\n return;\n }\n\n // Compute the desired delta movement for the handle.\n let delta: number;\n if (data.node.orientation === 'horizontal') {\n delta = offsetX - handle.offsetLeft;\n } else {\n delta = offsetY - handle.offsetTop;\n }\n\n // Bail if there is no handle movement.\n if (delta === 0) {\n return;\n }\n\n // Prevent sibling resizing unless needed.\n data.node.holdSizes();\n\n // Adjust the sizers to reflect the handle movement.\n BoxEngine.adjust(data.node.sizers, data.index, delta);\n\n // Update the layout of the widgets.\n if (this.parent) {\n this.parent.update();\n }\n }\n\n /**\n * Save the current configuration of the dock layout.\n *\n * @returns A new config object for the current layout state.\n *\n * #### Notes\n * The return value can be provided to the `restoreLayout` method\n * in order to restore the layout to its current configuration.\n */\n saveLayout(): DockLayout.ILayoutConfig {\n // Bail early if there is no root.\n if (!this._root) {\n return { main: null };\n }\n\n // Hold the current sizes in the layout tree.\n this._root.holdAllSizes();\n\n // Return the layout config.\n return { main: this._root.createConfig() };\n }\n\n /**\n * Restore the layout to a previously saved configuration.\n *\n * @param config - The layout configuration to restore.\n *\n * #### Notes\n * Widgets which currently belong to the layout but which are not\n * contained in the config will be unparented.\n */\n restoreLayout(config: DockLayout.ILayoutConfig): void {\n // Create the widget set for validating the config.\n let widgetSet = new Set();\n\n // Normalize the main area config and collect the widgets.\n let mainConfig: DockLayout.AreaConfig | null;\n if (config.main) {\n mainConfig = Private.normalizeAreaConfig(config.main, widgetSet);\n } else {\n mainConfig = null;\n }\n\n // Create iterators over the old content.\n let oldWidgets = this.widgets();\n let oldTabBars = this.tabBars();\n let oldHandles = this.handles();\n\n // Clear the root before removing the old content.\n this._root = null;\n\n // Unparent the old widgets which are not in the new config.\n for (const widget of oldWidgets) {\n if (!widgetSet.has(widget)) {\n widget.parent = null;\n }\n }\n\n // Dispose of the old tab bars.\n for (const tabBar of oldTabBars) {\n tabBar.dispose();\n }\n\n // Remove the old handles.\n for (const handle of oldHandles) {\n if (handle.parentNode) {\n handle.parentNode.removeChild(handle);\n }\n }\n\n // Reparent the new widgets to the current parent.\n for (const widget of widgetSet) {\n widget.parent = this.parent;\n }\n\n // Create the root node for the new config.\n if (mainConfig) {\n this._root = Private.realizeAreaConfig(\n mainConfig,\n {\n // Ignoring optional `document` argument as we must reuse `this._document`\n createTabBar: (document?: Document | ShadowRoot) =>\n this._createTabBar(),\n createHandle: () => this._createHandle()\n },\n this._document\n );\n } else {\n this._root = null;\n }\n\n // If there is no parent, there is nothing more to do.\n if (!this.parent) {\n return;\n }\n\n // Attach the new widgets to the parent.\n widgetSet.forEach(widget => {\n this.attachWidget(widget);\n });\n\n // Post a fit request to the parent.\n this.parent.fit();\n }\n\n /**\n * Add a widget to the dock layout.\n *\n * @param widget - The widget to add to the dock layout.\n *\n * @param options - The additional options for adding the widget.\n *\n * #### Notes\n * The widget will be moved if it is already contained in the layout.\n *\n * An error will be thrown if the reference widget is invalid.\n */\n addWidget(widget: Widget, options: DockLayout.IAddOptions = {}): void {\n // Parse the options.\n let ref = options.ref || null;\n let mode = options.mode || 'tab-after';\n\n // Find the tab node which holds the reference widget.\n let refNode: Private.TabLayoutNode | null = null;\n if (this._root && ref) {\n refNode = this._root.findTabNode(ref);\n }\n\n // Throw an error if the reference widget is invalid.\n if (ref && !refNode) {\n throw new Error('Reference widget is not in the layout.');\n }\n\n // Reparent the widget to the current layout parent.\n widget.parent = this.parent;\n\n // Insert the widget according to the insert mode.\n switch (mode) {\n case 'tab-after':\n this._insertTab(widget, ref, refNode, true);\n break;\n case 'tab-before':\n this._insertTab(widget, ref, refNode, false);\n break;\n case 'split-top':\n this._insertSplit(widget, ref, refNode, 'vertical', false);\n break;\n case 'split-left':\n this._insertSplit(widget, ref, refNode, 'horizontal', false);\n break;\n case 'split-right':\n this._insertSplit(widget, ref, refNode, 'horizontal', true);\n break;\n case 'split-bottom':\n this._insertSplit(widget, ref, refNode, 'vertical', true);\n break;\n case 'merge-top':\n this._insertSplit(widget, ref, refNode, 'vertical', false, true);\n break;\n case 'merge-left':\n this._insertSplit(widget, ref, refNode, 'horizontal', false, true);\n break;\n case 'merge-right':\n this._insertSplit(widget, ref, refNode, 'horizontal', true, true);\n break;\n case 'merge-bottom':\n this._insertSplit(widget, ref, refNode, 'vertical', true, true);\n break;\n }\n\n // Do nothing else if there is no parent widget.\n if (!this.parent) {\n return;\n }\n\n // Ensure the widget is attached to the parent widget.\n this.attachWidget(widget);\n\n // Post a fit request for the parent widget.\n this.parent.fit();\n }\n\n /**\n * Remove a widget from the layout.\n *\n * @param widget - The widget to remove from the layout.\n *\n * #### Notes\n * A widget is automatically removed from the layout when its `parent`\n * is set to `null`. This method should only be invoked directly when\n * removing a widget from a layout which has yet to be installed on a\n * parent widget.\n *\n * This method does *not* modify the widget's `parent`.\n */\n removeWidget(widget: Widget): void {\n // Remove the widget from its current layout location.\n this._removeWidget(widget);\n\n // Do nothing else if there is no parent widget.\n if (!this.parent) {\n return;\n }\n\n // Detach the widget from the parent widget.\n this.detachWidget(widget);\n\n // Post a fit request for the parent widget.\n this.parent.fit();\n }\n\n /**\n * Find the tab area which contains the given client position.\n *\n * @param clientX - The client X position of interest.\n *\n * @param clientY - The client Y position of interest.\n *\n * @returns The geometry of the tab area at the given position, or\n * `null` if there is no tab area at the given position.\n */\n hitTestTabAreas(\n clientX: number,\n clientY: number\n ): DockLayout.ITabAreaGeometry | null {\n // Bail early if hit testing cannot produce valid results.\n if (!this._root || !this.parent || !this.parent.isVisible) {\n return null;\n }\n\n // Ensure the parent box sizing data is computed.\n if (!this._box) {\n this._box = ElementExt.boxSizing(this.parent.node);\n }\n\n // Convert from client to local coordinates.\n let rect = this.parent.node.getBoundingClientRect();\n let x = clientX - rect.left - this._box.borderLeft;\n let y = clientY - rect.top - this._box.borderTop;\n\n // Find the tab layout node at the local position.\n let tabNode = this._root.hitTestTabNodes(x, y);\n\n // Bail if a tab layout node was not found.\n if (!tabNode) {\n return null;\n }\n\n // Extract the data from the tab node.\n let { tabBar, top, left, width, height } = tabNode;\n\n // Compute the right and bottom edges of the tab area.\n let borderWidth = this._box.borderLeft + this._box.borderRight;\n let borderHeight = this._box.borderTop + this._box.borderBottom;\n let right = rect.width - borderWidth - (left + width);\n let bottom = rect.height - borderHeight - (top + height);\n\n // Return the hit test results.\n return { tabBar, x, y, top, left, right, bottom, width, height };\n }\n\n /**\n * Perform layout initialization which requires the parent widget.\n */\n protected init(): void {\n // Perform superclass initialization.\n super.init();\n\n // Attach each widget to the parent.\n for (const widget of this) {\n this.attachWidget(widget);\n }\n\n // Attach each handle to the parent.\n for (const handle of this.handles()) {\n this.parent!.node.appendChild(handle);\n }\n\n // Post a fit request for the parent widget.\n this.parent!.fit();\n }\n\n /**\n * Attach the widget to the layout parent widget.\n *\n * @param widget - The widget to attach to the parent.\n *\n * #### Notes\n * This is a no-op if the widget is already attached.\n */\n protected attachWidget(widget: Widget): void {\n // Do nothing if the widget is already attached.\n if (this.parent!.node === widget.node.parentNode) {\n return;\n }\n\n // Create the layout item for the widget.\n this._items.set(widget, new LayoutItem(widget));\n\n // Send a `'before-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n }\n\n // Add the widget's node to the parent.\n this.parent!.node.appendChild(widget.node);\n\n // Send an `'after-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n }\n\n /**\n * Detach the widget from the layout parent widget.\n *\n * @param widget - The widget to detach from the parent.\n *\n * #### Notes\n * This is a no-op if the widget is not attached.\n */\n protected detachWidget(widget: Widget): void {\n // Do nothing if the widget is not attached.\n if (this.parent!.node !== widget.node.parentNode) {\n return;\n }\n\n // Send a `'before-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n }\n\n // Remove the widget's node from the parent.\n this.parent!.node.removeChild(widget.node);\n\n // Send an `'after-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n\n // Delete the layout item for the widget.\n let item = this._items.get(widget);\n if (item) {\n this._items.delete(widget);\n item.dispose();\n }\n }\n\n /**\n * A message handler invoked on a `'before-show'` message.\n */\n protected onBeforeShow(msg: Message): void {\n super.onBeforeShow(msg);\n this.parent!.update();\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n super.onBeforeAttach(msg);\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-shown'` message.\n */\n protected onChildShown(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-hidden'` message.\n */\n protected onChildHidden(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'resize'` message.\n */\n protected onResize(msg: Widget.ResizeMessage): void {\n if (this.parent!.isVisible) {\n this._update(msg.width, msg.height);\n }\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n protected onUpdateRequest(msg: Message): void {\n if (this.parent!.isVisible) {\n this._update(-1, -1);\n }\n }\n\n /**\n * A message handler invoked on a `'fit-request'` message.\n */\n protected onFitRequest(msg: Message): void {\n if (this.parent!.isAttached) {\n this._fit();\n }\n }\n\n /**\n * Remove the specified widget from the layout structure.\n *\n * #### Notes\n * This is a no-op if the widget is not in the layout tree.\n *\n * This does not detach the widget from the parent node.\n */\n private _removeWidget(widget: Widget): void {\n // Bail early if there is no layout root.\n if (!this._root) {\n return;\n }\n\n // Find the tab node which contains the given widget.\n let tabNode = this._root.findTabNode(widget);\n\n // Bail early if the tab node is not found.\n if (!tabNode) {\n return;\n }\n\n Private.removeAria(widget);\n\n // If there are multiple tabs, just remove the widget's tab.\n if (tabNode.tabBar.titles.length > 1) {\n tabNode.tabBar.removeTab(widget.title);\n if (\n this._hiddenMode === Widget.HiddenMode.Scale &&\n tabNode.tabBar.titles.length == 1\n ) {\n const existingWidget = tabNode.tabBar.titles[0].owner;\n existingWidget.hiddenMode = Widget.HiddenMode.Display;\n }\n return;\n }\n\n // Otherwise, the tab node needs to be removed...\n\n // Dispose the tab bar.\n tabNode.tabBar.dispose();\n\n // Handle the case where the tab node is the root.\n if (this._root === tabNode) {\n this._root = null;\n return;\n }\n\n // Otherwise, remove the tab node from its parent...\n\n // Prevent widget resizing unless needed.\n this._root.holdAllSizes();\n\n // Clear the parent reference on the tab node.\n let splitNode = tabNode.parent!;\n tabNode.parent = null;\n\n // Remove the tab node from its parent split node.\n let i = ArrayExt.removeFirstOf(splitNode.children, tabNode);\n let handle = ArrayExt.removeAt(splitNode.handles, i)!;\n ArrayExt.removeAt(splitNode.sizers, i);\n\n // Remove the handle from its parent DOM node.\n if (handle.parentNode) {\n handle.parentNode.removeChild(handle);\n }\n\n // If there are multiple children, just update the handles.\n if (splitNode.children.length > 1) {\n splitNode.syncHandles();\n return;\n }\n\n // Otherwise, the split node also needs to be removed...\n\n // Clear the parent reference on the split node.\n let maybeParent = splitNode.parent;\n splitNode.parent = null;\n\n // Lookup the remaining child node and handle.\n let childNode = splitNode.children[0];\n let childHandle = splitNode.handles[0];\n\n // Clear the split node data.\n splitNode.children.length = 0;\n splitNode.handles.length = 0;\n splitNode.sizers.length = 0;\n\n // Remove the child handle from its parent node.\n if (childHandle.parentNode) {\n childHandle.parentNode.removeChild(childHandle);\n }\n\n // Handle the case where the split node is the root.\n if (this._root === splitNode) {\n childNode.parent = null;\n this._root = childNode;\n return;\n }\n\n // Otherwise, move the child node to the parent node...\n let parentNode = maybeParent!;\n\n // Lookup the index of the split node.\n let j = parentNode.children.indexOf(splitNode);\n\n // Handle the case where the child node is a tab node.\n if (childNode instanceof Private.TabLayoutNode) {\n childNode.parent = parentNode;\n parentNode.children[j] = childNode;\n return;\n }\n\n // Remove the split data from the parent.\n let splitHandle = ArrayExt.removeAt(parentNode.handles, j)!;\n ArrayExt.removeAt(parentNode.children, j);\n ArrayExt.removeAt(parentNode.sizers, j);\n\n // Remove the handle from its parent node.\n if (splitHandle.parentNode) {\n splitHandle.parentNode.removeChild(splitHandle);\n }\n\n // The child node and the split parent node will have the same\n // orientation. Merge the grand-children with the parent node.\n for (let i = 0, n = childNode.children.length; i < n; ++i) {\n let gChild = childNode.children[i];\n let gHandle = childNode.handles[i];\n let gSizer = childNode.sizers[i];\n ArrayExt.insert(parentNode.children, j + i, gChild);\n ArrayExt.insert(parentNode.handles, j + i, gHandle);\n ArrayExt.insert(parentNode.sizers, j + i, gSizer);\n gChild.parent = parentNode;\n }\n\n // Clear the child node.\n childNode.children.length = 0;\n childNode.handles.length = 0;\n childNode.sizers.length = 0;\n childNode.parent = null;\n\n // Sync the handles on the parent node.\n parentNode.syncHandles();\n }\n\n /**\n * Create the tab layout node to hold the widget.\n */\n private _createTabNode(widget: Widget): Private.TabLayoutNode {\n let tabNode = new Private.TabLayoutNode(this._createTabBar());\n tabNode.tabBar.addTab(widget.title);\n Private.addAria(widget, tabNode.tabBar);\n return tabNode;\n }\n\n /**\n * Insert a widget next to an existing tab.\n *\n * #### Notes\n * This does not attach the widget to the parent widget.\n */\n private _insertTab(\n widget: Widget,\n ref: Widget | null,\n refNode: Private.TabLayoutNode | null,\n after: boolean\n ): void {\n // Do nothing if the tab is inserted next to itself.\n if (widget === ref) {\n return;\n }\n\n // Create the root if it does not exist.\n if (!this._root) {\n let tabNode = new Private.TabLayoutNode(this._createTabBar());\n tabNode.tabBar.addTab(widget.title);\n this._root = tabNode;\n Private.addAria(widget, tabNode.tabBar);\n return;\n }\n\n // Use the first tab node as the ref node if needed.\n if (!refNode) {\n refNode = this._root.findFirstTabNode()!;\n }\n\n // If the widget is not contained in the ref node, ensure it is\n // removed from the layout and hidden before being added again.\n if (refNode.tabBar.titles.indexOf(widget.title) === -1) {\n this._removeWidget(widget);\n widget.hide();\n }\n\n // Lookup the target index for inserting the tab.\n let index: number;\n if (ref) {\n index = refNode.tabBar.titles.indexOf(ref.title);\n } else {\n index = refNode.tabBar.currentIndex;\n }\n\n // Using transform create an additional layer in the pixel pipeline\n // to limit the number of layer, it is set only if there is more than one widget.\n if (this._hiddenMode === Widget.HiddenMode.Scale) {\n if (refNode.tabBar.titles.length === 0) {\n // Singular tab should use display mode to limit number of layers.\n widget.hiddenMode = Widget.HiddenMode.Display;\n } else if (refNode.tabBar.titles.length == 1) {\n // If we are adding a second tab, switch the existing tab back to scale.\n const existingWidget = refNode.tabBar.titles[0].owner;\n existingWidget.hiddenMode = Widget.HiddenMode.Scale;\n } else {\n // For the third and subsequent tabs no special action is needed.\n widget.hiddenMode = Widget.HiddenMode.Scale;\n }\n } else {\n // For all other modes just propagate the current mode.\n widget.hiddenMode = this._hiddenMode;\n }\n\n // Insert the widget's tab relative to the target index.\n refNode.tabBar.insertTab(index + (after ? 1 : 0), widget.title);\n Private.addAria(widget, refNode.tabBar);\n }\n\n /**\n * Insert a widget as a new split area.\n *\n * #### Notes\n * This does not attach the widget to the parent widget.\n */\n private _insertSplit(\n widget: Widget,\n ref: Widget | null,\n refNode: Private.TabLayoutNode | null,\n orientation: Private.Orientation,\n after: boolean,\n merge: boolean = false\n ): void {\n // Do nothing if there is no effective split.\n if (widget === ref && refNode && refNode.tabBar.titles.length === 1) {\n return;\n }\n\n // Ensure the widget is removed from the current layout.\n this._removeWidget(widget);\n\n // Set the root if it does not exist.\n if (!this._root) {\n this._root = this._createTabNode(widget);\n return;\n }\n\n // If the ref node parent is null, split the root.\n if (!refNode || !refNode.parent) {\n // Ensure the root is split with the correct orientation.\n let root = this._splitRoot(orientation);\n\n // Determine the insert index for the new tab node.\n let i = after ? root.children.length : 0;\n\n // Normalize the split node.\n root.normalizeSizes();\n\n // Create the sizer for new tab node.\n let sizer = Private.createSizer(refNode ? 1 : Private.GOLDEN_RATIO);\n\n // Insert the tab node sized to the golden ratio.\n let tabNode = this._createTabNode(widget);\n ArrayExt.insert(root.children, i, tabNode);\n ArrayExt.insert(root.sizers, i, sizer);\n ArrayExt.insert(root.handles, i, this._createHandle());\n tabNode.parent = root;\n\n // Re-normalize the split node to maintain the ratios.\n root.normalizeSizes();\n\n // Finally, synchronize the visibility of the handles.\n root.syncHandles();\n return;\n }\n\n // Lookup the split node for the ref widget.\n let splitNode = refNode.parent;\n\n // If the split node already had the correct orientation,\n // the widget can be inserted into the split node directly.\n if (splitNode.orientation === orientation) {\n // Find the index of the ref node.\n let i = splitNode.children.indexOf(refNode);\n\n // Conditionally reuse a tab layout found in the wanted position.\n if (merge) {\n let j = i + (after ? 1 : -1);\n let sibling = splitNode.children[j];\n if (sibling instanceof Private.TabLayoutNode) {\n this._insertTab(widget, null, sibling, true);\n ++sibling.tabBar.currentIndex;\n return;\n }\n }\n\n // Normalize the split node.\n splitNode.normalizeSizes();\n\n // Consume half the space for the insert location.\n let s = (splitNode.sizers[i].sizeHint /= 2);\n\n // Insert the tab node sized to the other half.\n let j = i + (after ? 1 : 0);\n let tabNode = this._createTabNode(widget);\n ArrayExt.insert(splitNode.children, j, tabNode);\n ArrayExt.insert(splitNode.sizers, j, Private.createSizer(s));\n ArrayExt.insert(splitNode.handles, j, this._createHandle());\n tabNode.parent = splitNode;\n\n // Finally, synchronize the visibility of the handles.\n splitNode.syncHandles();\n return;\n }\n\n // Remove the ref node from the split node.\n let i = ArrayExt.removeFirstOf(splitNode.children, refNode);\n\n // Create a new normalized split node for the children.\n let childNode = new Private.SplitLayoutNode(orientation);\n childNode.normalized = true;\n\n // Add the ref node sized to half the space.\n childNode.children.push(refNode);\n childNode.sizers.push(Private.createSizer(0.5));\n childNode.handles.push(this._createHandle());\n refNode.parent = childNode;\n\n // Add the tab node sized to the other half.\n let j = after ? 1 : 0;\n let tabNode = this._createTabNode(widget);\n ArrayExt.insert(childNode.children, j, tabNode);\n ArrayExt.insert(childNode.sizers, j, Private.createSizer(0.5));\n ArrayExt.insert(childNode.handles, j, this._createHandle());\n tabNode.parent = childNode;\n\n // Synchronize the visibility of the handles.\n childNode.syncHandles();\n\n // Finally, add the new child node to the original split node.\n ArrayExt.insert(splitNode.children, i, childNode);\n childNode.parent = splitNode;\n }\n\n /**\n * Ensure the root is a split node with the given orientation.\n */\n private _splitRoot(\n orientation: Private.Orientation\n ): Private.SplitLayoutNode {\n // Bail early if the root already meets the requirements.\n let oldRoot = this._root;\n if (oldRoot instanceof Private.SplitLayoutNode) {\n if (oldRoot.orientation === orientation) {\n return oldRoot;\n }\n }\n\n // Create a new root node with the specified orientation.\n let newRoot = (this._root = new Private.SplitLayoutNode(orientation));\n\n // Add the old root to the new root.\n if (oldRoot) {\n newRoot.children.push(oldRoot);\n newRoot.sizers.push(Private.createSizer(0));\n newRoot.handles.push(this._createHandle());\n oldRoot.parent = newRoot;\n }\n\n // Return the new root as a convenience.\n return newRoot;\n }\n\n /**\n * Fit the layout to the total size required by the widgets.\n */\n private _fit(): void {\n // Set up the computed minimum size.\n let minW = 0;\n let minH = 0;\n\n // Update the size limits for the layout tree.\n if (this._root) {\n let limits = this._root.fit(this._spacing, this._items);\n minW = limits.minWidth;\n minH = limits.minHeight;\n }\n\n // Update the box sizing and add it to the computed min size.\n let box = (this._box = ElementExt.boxSizing(this.parent!.node));\n minW += box.horizontalSum;\n minH += box.verticalSum;\n\n // Update the parent's min size constraints.\n let style = this.parent!.node.style;\n style.minWidth = `${minW}px`;\n style.minHeight = `${minH}px`;\n\n // Set the dirty flag to ensure only a single update occurs.\n this._dirty = true;\n\n // Notify the ancestor that it should fit immediately. This may\n // cause a resize of the parent, fulfilling the required update.\n if (this.parent!.parent) {\n MessageLoop.sendMessage(this.parent!.parent!, Widget.Msg.FitRequest);\n }\n\n // If the dirty flag is still set, the parent was not resized.\n // Trigger the required update on the parent widget immediately.\n if (this._dirty) {\n MessageLoop.sendMessage(this.parent!, Widget.Msg.UpdateRequest);\n }\n }\n\n /**\n * Update the layout position and size of the widgets.\n *\n * The parent offset dimensions should be `-1` if unknown.\n */\n private _update(offsetWidth: number, offsetHeight: number): void {\n // Clear the dirty flag to indicate the update occurred.\n this._dirty = false;\n\n // Bail early if there is no root layout node.\n if (!this._root) {\n return;\n }\n\n // Measure the parent if the offset dimensions are unknown.\n if (offsetWidth < 0) {\n offsetWidth = this.parent!.node.offsetWidth;\n }\n if (offsetHeight < 0) {\n offsetHeight = this.parent!.node.offsetHeight;\n }\n\n // Ensure the parent box sizing data is computed.\n if (!this._box) {\n this._box = ElementExt.boxSizing(this.parent!.node);\n }\n\n // Compute the actual layout bounds adjusted for border and padding.\n let x = this._box.paddingTop;\n let y = this._box.paddingLeft;\n let width = offsetWidth - this._box.horizontalSum;\n let height = offsetHeight - this._box.verticalSum;\n\n // Update the geometry of the layout tree.\n this._root.update(x, y, width, height, this._spacing, this._items);\n }\n\n /**\n * Create a new tab bar for use by the dock layout.\n *\n * #### Notes\n * The tab bar will be attached to the parent if it exists.\n */\n private _createTabBar(): TabBar {\n // Create the tab bar using the renderer.\n let tabBar = this.renderer.createTabBar(this._document);\n\n // Enforce necessary tab bar behavior.\n tabBar.orientation = 'horizontal';\n\n // Attach the tab bar to the parent if possible.\n if (this.parent) {\n this.attachWidget(tabBar);\n }\n\n // Return the initialized tab bar.\n return tabBar;\n }\n\n /**\n * Create a new handle for the dock layout.\n *\n * #### Notes\n * The handle will be attached to the parent if it exists.\n */\n private _createHandle(): HTMLDivElement {\n // Create the handle using the renderer.\n let handle = this.renderer.createHandle();\n\n // Initialize the handle layout behavior.\n let style = handle.style;\n style.position = 'absolute';\n style.contain = 'strict';\n style.top = '0';\n style.left = '0';\n style.width = '0';\n style.height = '0';\n\n // Attach the handle to the parent if it exists.\n if (this.parent) {\n this.parent.node.appendChild(handle);\n }\n\n // Return the initialized handle.\n return handle;\n }\n\n private _spacing = 4;\n private _dirty = false;\n private _root: Private.LayoutNode | null = null;\n private _box: ElementExt.IBoxSizing | null = null;\n private _document: Document | ShadowRoot;\n private _hiddenMode: Widget.HiddenMode;\n private _items: Private.ItemMap = new Map();\n}\n\n/**\n * The namespace for the `DockLayout` class statics.\n */\nexport namespace DockLayout {\n /**\n * An options object for creating a dock layout.\n */\n export interface IOptions {\n /**\n * The document to use with the dock panel.\n *\n * The default is the global `document` instance.\n */\n document?: Document | ShadowRoot;\n\n /**\n * The method for hiding widgets.\n *\n * The default is `Widget.HiddenMode.Display`.\n */\n hiddenMode?: Widget.HiddenMode;\n\n /**\n * The renderer to use for the dock layout.\n */\n renderer: IRenderer;\n\n /**\n * The spacing between items in the layout.\n *\n * The default is `4`.\n */\n spacing?: number;\n }\n\n /**\n * A renderer for use with a dock layout.\n */\n export interface IRenderer {\n /**\n * Create a new tab bar for use with a dock layout.\n *\n * @returns A new tab bar for a dock layout.\n */\n createTabBar(document?: Document | ShadowRoot): TabBar;\n\n /**\n * Create a new handle node for use with a dock layout.\n *\n * @returns A new handle node for a dock layout.\n */\n createHandle(): HTMLDivElement;\n }\n\n /**\n * A type alias for the supported insertion modes.\n *\n * An insert mode is used to specify how a widget should be added\n * to the dock layout relative to a reference widget.\n */\n export type InsertMode =\n | /**\n * The area to the top of the reference widget.\n *\n * The widget will be inserted just above the reference widget.\n *\n * If the reference widget is null or invalid, the widget will be\n * inserted at the top edge of the dock layout.\n */\n 'split-top'\n\n /**\n * The area to the left of the reference widget.\n *\n * The widget will be inserted just left of the reference widget.\n *\n * If the reference widget is null or invalid, the widget will be\n * inserted at the left edge of the dock layout.\n */\n | 'split-left'\n\n /**\n * The area to the right of the reference widget.\n *\n * The widget will be inserted just right of the reference widget.\n *\n * If the reference widget is null or invalid, the widget will be\n * inserted at the right edge of the dock layout.\n */\n | 'split-right'\n\n /**\n * The area to the bottom of the reference widget.\n *\n * The widget will be inserted just below the reference widget.\n *\n * If the reference widget is null or invalid, the widget will be\n * inserted at the bottom edge of the dock layout.\n */\n | 'split-bottom'\n\n /**\n * Like `split-top` but if a tab layout exists above the reference widget,\n * it behaves like `tab-after` with reference to that instead.\n */\n | 'merge-top'\n\n /**\n * Like `split-left` but if a tab layout exists left of the reference widget,\n * it behaves like `tab-after` with reference to that instead.\n */\n | 'merge-left'\n\n /**\n * Like `split-right` but if a tab layout exists right of the reference widget,\n * it behaves like `tab-after` with reference to that instead.\n */\n | 'merge-right'\n\n /**\n * Like `split-bottom` but if a tab layout exists below the reference widget,\n * it behaves like `tab-after` with reference to that instead.\n */\n | 'merge-bottom'\n\n /**\n * The tab position before the reference widget.\n *\n * The widget will be added as a tab before the reference widget.\n *\n * If the reference widget is null or invalid, a sensible default\n * will be used.\n */\n | 'tab-before'\n\n /**\n * The tab position after the reference widget.\n *\n * The widget will be added as a tab after the reference widget.\n *\n * If the reference widget is null or invalid, a sensible default\n * will be used.\n */\n | 'tab-after';\n\n /**\n * An options object for adding a widget to the dock layout.\n */\n export interface IAddOptions {\n /**\n * The insertion mode for adding the widget.\n *\n * The default is `'tab-after'`.\n */\n mode?: InsertMode;\n\n /**\n * The reference widget for the insert location.\n *\n * The default is `null`.\n */\n ref?: Widget | null;\n }\n\n /**\n * A layout config object for a tab area.\n */\n export interface ITabAreaConfig {\n /**\n * The discriminated type of the config object.\n */\n type: 'tab-area';\n\n /**\n * The widgets contained in the tab area.\n */\n widgets: Widget[];\n\n /**\n * The index of the selected tab.\n */\n currentIndex: number;\n }\n\n /**\n * A layout config object for a split area.\n */\n export interface ISplitAreaConfig {\n /**\n * The discriminated type of the config object.\n */\n type: 'split-area';\n\n /**\n * The orientation of the split area.\n */\n orientation: 'horizontal' | 'vertical';\n\n /**\n * The children in the split area.\n */\n children: AreaConfig[];\n\n /**\n * The relative sizes of the children.\n */\n sizes: number[];\n }\n\n /**\n * A type alias for a general area config.\n */\n export type AreaConfig = ITabAreaConfig | ISplitAreaConfig;\n\n /**\n * A dock layout configuration object.\n */\n export interface ILayoutConfig {\n /**\n * The layout config for the main dock area.\n */\n main: AreaConfig | null;\n }\n\n /**\n * An object which represents the geometry of a tab area.\n */\n export interface ITabAreaGeometry {\n /**\n * The tab bar for the tab area.\n */\n tabBar: TabBar;\n\n /**\n * The local X position of the hit test in the dock area.\n *\n * #### Notes\n * This is the distance from the left edge of the layout parent\n * widget, to the local X coordinate of the hit test query.\n */\n x: number;\n\n /**\n * The local Y position of the hit test in the dock area.\n *\n * #### Notes\n * This is the distance from the top edge of the layout parent\n * widget, to the local Y coordinate of the hit test query.\n */\n y: number;\n\n /**\n * The local coordinate of the top edge of the tab area.\n *\n * #### Notes\n * This is the distance from the top edge of the layout parent\n * widget, to the top edge of the tab area.\n */\n top: number;\n\n /**\n * The local coordinate of the left edge of the tab area.\n *\n * #### Notes\n * This is the distance from the left edge of the layout parent\n * widget, to the left edge of the tab area.\n */\n left: number;\n\n /**\n * The local coordinate of the right edge of the tab area.\n *\n * #### Notes\n * This is the distance from the right edge of the layout parent\n * widget, to the right edge of the tab area.\n */\n right: number;\n\n /**\n * The local coordinate of the bottom edge of the tab area.\n *\n * #### Notes\n * This is the distance from the bottom edge of the layout parent\n * widget, to the bottom edge of the tab area.\n */\n bottom: number;\n\n /**\n * The width of the tab area.\n *\n * #### Notes\n * This is total width allocated for the tab area.\n */\n width: number;\n\n /**\n * The height of the tab area.\n *\n * #### Notes\n * This is total height allocated for the tab area.\n */\n height: number;\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * A fraction used for sizing root panels; ~= `1 / golden_ratio`.\n */\n export const GOLDEN_RATIO = 0.618;\n\n /**\n * A type alias for a dock layout node.\n */\n export type LayoutNode = TabLayoutNode | SplitLayoutNode;\n\n /**\n * A type alias for the orientation of a split layout node.\n */\n export type Orientation = 'horizontal' | 'vertical';\n\n /**\n * A type alias for a layout item map.\n */\n export type ItemMap = Map;\n\n /**\n * Create a box sizer with an initial size hint.\n */\n export function createSizer(hint: number): BoxSizer {\n let sizer = new BoxSizer();\n sizer.sizeHint = hint;\n sizer.size = hint;\n return sizer;\n }\n\n /**\n * Normalize an area config object and collect the visited widgets.\n */\n export function normalizeAreaConfig(\n config: DockLayout.AreaConfig,\n widgetSet: Set\n ): DockLayout.AreaConfig | null {\n let result: DockLayout.AreaConfig | null;\n if (config.type === 'tab-area') {\n result = normalizeTabAreaConfig(config, widgetSet);\n } else {\n result = normalizeSplitAreaConfig(config, widgetSet);\n }\n return result;\n }\n\n /**\n * Convert a normalized area config into a layout tree.\n */\n export function realizeAreaConfig(\n config: DockLayout.AreaConfig,\n renderer: DockLayout.IRenderer,\n document: Document | ShadowRoot\n ): LayoutNode {\n let node: LayoutNode;\n if (config.type === 'tab-area') {\n node = realizeTabAreaConfig(config, renderer, document);\n } else {\n node = realizeSplitAreaConfig(config, renderer, document);\n }\n return node;\n }\n\n /**\n * A layout node which holds the data for a tabbed area.\n */\n export class TabLayoutNode {\n /**\n * Construct a new tab layout node.\n *\n * @param tabBar - The tab bar to use for the layout node.\n */\n constructor(tabBar: TabBar) {\n let tabSizer = new BoxSizer();\n let widgetSizer = new BoxSizer();\n tabSizer.stretch = 0;\n widgetSizer.stretch = 1;\n this.tabBar = tabBar;\n this.sizers = [tabSizer, widgetSizer];\n }\n\n /**\n * The parent of the layout node.\n */\n parent: SplitLayoutNode | null = null;\n\n /**\n * The tab bar for the layout node.\n */\n readonly tabBar: TabBar;\n\n /**\n * The sizers for the layout node.\n */\n readonly sizers: [BoxSizer, BoxSizer];\n\n /**\n * The most recent value for the `top` edge of the layout box.\n */\n get top(): number {\n return this._top;\n }\n\n /**\n * The most recent value for the `left` edge of the layout box.\n */\n get left(): number {\n return this._left;\n }\n\n /**\n * The most recent value for the `width` of the layout box.\n */\n get width(): number {\n return this._width;\n }\n\n /**\n * The most recent value for the `height` of the layout box.\n */\n get height(): number {\n return this._height;\n }\n\n /**\n * Create an iterator for all widgets in the layout tree.\n */\n *iterAllWidgets(): IterableIterator {\n yield this.tabBar;\n yield* this.iterUserWidgets();\n }\n\n /**\n * Create an iterator for the user widgets in the layout tree.\n */\n *iterUserWidgets(): IterableIterator {\n for (const title of this.tabBar.titles) {\n yield title.owner;\n }\n }\n\n /**\n * Create an iterator for the selected widgets in the layout tree.\n */\n *iterSelectedWidgets(): IterableIterator {\n let title = this.tabBar.currentTitle;\n if (title) {\n yield title.owner;\n }\n }\n\n /**\n * Create an iterator for the tab bars in the layout tree.\n */\n *iterTabBars(): IterableIterator> {\n yield this.tabBar;\n }\n\n /**\n * Create an iterator for the handles in the layout tree.\n */\n // eslint-disable-next-line require-yield\n *iterHandles(): IterableIterator {\n return;\n }\n\n /**\n * Find the tab layout node which contains the given widget.\n */\n findTabNode(widget: Widget): TabLayoutNode | null {\n return this.tabBar.titles.indexOf(widget.title) !== -1 ? this : null;\n }\n\n /**\n * Find the split layout node which contains the given handle.\n */\n findSplitNode(\n handle: HTMLDivElement\n ): { index: number; node: SplitLayoutNode } | null {\n return null;\n }\n\n /**\n * Find the first tab layout node in a layout tree.\n */\n findFirstTabNode(): TabLayoutNode | null {\n return this;\n }\n\n /**\n * Find the tab layout node which contains the local point.\n */\n hitTestTabNodes(x: number, y: number): TabLayoutNode | null {\n if (x < this._left || x >= this._left + this._width) {\n return null;\n }\n if (y < this._top || y >= this._top + this._height) {\n return null;\n }\n return this;\n }\n\n /**\n * Create a configuration object for the layout tree.\n */\n createConfig(): DockLayout.ITabAreaConfig {\n let widgets = this.tabBar.titles.map(title => title.owner);\n let currentIndex = this.tabBar.currentIndex;\n return { type: 'tab-area', widgets, currentIndex };\n }\n\n /**\n * Recursively hold all of the sizes in the layout tree.\n *\n * This ignores the sizers of tab layout nodes.\n */\n holdAllSizes(): void {\n return;\n }\n\n /**\n * Fit the layout tree.\n */\n fit(spacing: number, items: ItemMap): ElementExt.ISizeLimits {\n // Set up the limit variables.\n let minWidth = 0;\n let minHeight = 0;\n let maxWidth = Infinity;\n let maxHeight = Infinity;\n\n // Lookup the tab bar layout item.\n let tabBarItem = items.get(this.tabBar);\n\n // Lookup the widget layout item.\n let current = this.tabBar.currentTitle;\n let widgetItem = current ? items.get(current.owner) : undefined;\n\n // Lookup the tab bar and widget sizers.\n let [tabBarSizer, widgetSizer] = this.sizers;\n\n // Update the tab bar limits.\n if (tabBarItem) {\n tabBarItem.fit();\n }\n\n // Update the widget limits.\n if (widgetItem) {\n widgetItem.fit();\n }\n\n // Update the results and sizer for the tab bar.\n if (tabBarItem && !tabBarItem.isHidden) {\n minWidth = Math.max(minWidth, tabBarItem.minWidth);\n minHeight += tabBarItem.minHeight;\n tabBarSizer.minSize = tabBarItem.minHeight;\n tabBarSizer.maxSize = tabBarItem.maxHeight;\n } else {\n tabBarSizer.minSize = 0;\n tabBarSizer.maxSize = 0;\n }\n\n // Update the results and sizer for the current widget.\n if (widgetItem && !widgetItem.isHidden) {\n minWidth = Math.max(minWidth, widgetItem.minWidth);\n minHeight += widgetItem.minHeight;\n widgetSizer.minSize = widgetItem.minHeight;\n widgetSizer.maxSize = Infinity;\n } else {\n widgetSizer.minSize = 0;\n widgetSizer.maxSize = Infinity;\n }\n\n // Return the computed size limits for the layout node.\n return { minWidth, minHeight, maxWidth, maxHeight };\n }\n\n /**\n * Update the layout tree.\n */\n update(\n left: number,\n top: number,\n width: number,\n height: number,\n spacing: number,\n items: ItemMap\n ): void {\n // Update the layout box values.\n this._top = top;\n this._left = left;\n this._width = width;\n this._height = height;\n\n // Lookup the tab bar layout item.\n let tabBarItem = items.get(this.tabBar);\n\n // Lookup the widget layout item.\n let current = this.tabBar.currentTitle;\n let widgetItem = current ? items.get(current.owner) : undefined;\n\n // Distribute the layout space to the sizers.\n BoxEngine.calc(this.sizers, height);\n\n // Update the tab bar item using the computed size.\n if (tabBarItem && !tabBarItem.isHidden) {\n let size = this.sizers[0].size;\n tabBarItem.update(left, top, width, size);\n top += size;\n }\n\n // Layout the widget using the computed size.\n if (widgetItem && !widgetItem.isHidden) {\n let size = this.sizers[1].size;\n widgetItem.update(left, top, width, size);\n }\n }\n\n private _top = 0;\n private _left = 0;\n private _width = 0;\n private _height = 0;\n }\n\n /**\n * A layout node which holds the data for a split area.\n */\n export class SplitLayoutNode {\n /**\n * Construct a new split layout node.\n *\n * @param orientation - The orientation of the node.\n */\n constructor(orientation: Orientation) {\n this.orientation = orientation;\n }\n\n /**\n * The parent of the layout node.\n */\n parent: SplitLayoutNode | null = null;\n\n /**\n * Whether the sizers have been normalized.\n */\n normalized = false;\n\n /**\n * The orientation of the node.\n */\n readonly orientation: Orientation;\n\n /**\n * The child nodes for the split node.\n */\n readonly children: LayoutNode[] = [];\n\n /**\n * The box sizers for the layout children.\n */\n readonly sizers: BoxSizer[] = [];\n\n /**\n * The handles for the layout children.\n */\n readonly handles: HTMLDivElement[] = [];\n\n /**\n * Create an iterator for all widgets in the layout tree.\n */\n *iterAllWidgets(): IterableIterator {\n for (const child of this.children) {\n yield* child.iterAllWidgets();\n }\n }\n\n /**\n * Create an iterator for the user widgets in the layout tree.\n */\n *iterUserWidgets(): IterableIterator {\n for (const child of this.children) {\n yield* child.iterUserWidgets();\n }\n }\n\n /**\n * Create an iterator for the selected widgets in the layout tree.\n */\n *iterSelectedWidgets(): IterableIterator {\n for (const child of this.children) {\n yield* child.iterSelectedWidgets();\n }\n }\n\n /**\n * Create an iterator for the tab bars in the layout tree.\n */\n *iterTabBars(): IterableIterator> {\n for (const child of this.children) {\n yield* child.iterTabBars();\n }\n }\n\n /**\n * Create an iterator for the handles in the layout tree.\n */\n *iterHandles(): IterableIterator {\n yield* this.handles;\n for (const child of this.children) {\n yield* child.iterHandles();\n }\n }\n\n /**\n * Find the tab layout node which contains the given widget.\n */\n findTabNode(widget: Widget): TabLayoutNode | null {\n for (let i = 0, n = this.children.length; i < n; ++i) {\n let result = this.children[i].findTabNode(widget);\n if (result) {\n return result;\n }\n }\n return null;\n }\n\n /**\n * Find the split layout node which contains the given handle.\n */\n findSplitNode(\n handle: HTMLDivElement\n ): { index: number; node: SplitLayoutNode } | null {\n let index = this.handles.indexOf(handle);\n if (index !== -1) {\n return { index, node: this };\n }\n for (let i = 0, n = this.children.length; i < n; ++i) {\n let result = this.children[i].findSplitNode(handle);\n if (result) {\n return result;\n }\n }\n return null;\n }\n\n /**\n * Find the first tab layout node in a layout tree.\n */\n findFirstTabNode(): TabLayoutNode | null {\n if (this.children.length === 0) {\n return null;\n }\n return this.children[0].findFirstTabNode();\n }\n\n /**\n * Find the tab layout node which contains the local point.\n */\n hitTestTabNodes(x: number, y: number): TabLayoutNode | null {\n for (let i = 0, n = this.children.length; i < n; ++i) {\n let result = this.children[i].hitTestTabNodes(x, y);\n if (result) {\n return result;\n }\n }\n return null;\n }\n\n /**\n * Create a configuration object for the layout tree.\n */\n createConfig(): DockLayout.ISplitAreaConfig {\n let orientation = this.orientation;\n let sizes = this.createNormalizedSizes();\n let children = this.children.map(child => child.createConfig());\n return { type: 'split-area', orientation, children, sizes };\n }\n\n /**\n * Sync the visibility and orientation of the handles.\n */\n syncHandles(): void {\n this.handles.forEach((handle, i) => {\n handle.setAttribute('data-orientation', this.orientation);\n if (i === this.handles.length - 1) {\n handle.classList.add('lm-mod-hidden');\n } else {\n handle.classList.remove('lm-mod-hidden');\n }\n });\n }\n\n /**\n * Hold the current sizes of the box sizers.\n *\n * This sets the size hint of each sizer to its current size.\n */\n holdSizes(): void {\n for (const sizer of this.sizers) {\n sizer.sizeHint = sizer.size;\n }\n }\n\n /**\n * Recursively hold all of the sizes in the layout tree.\n *\n * This ignores the sizers of tab layout nodes.\n */\n holdAllSizes(): void {\n for (const child of this.children) {\n child.holdAllSizes();\n }\n this.holdSizes();\n }\n\n /**\n * Normalize the sizes of the split layout node.\n */\n normalizeSizes(): void {\n // Bail early if the sizers are empty.\n let n = this.sizers.length;\n if (n === 0) {\n return;\n }\n\n // Hold the current sizes of the sizers.\n this.holdSizes();\n\n // Compute the sum of the sizes.\n let sum = this.sizers.reduce((v, sizer) => v + sizer.sizeHint, 0);\n\n // Normalize the sizes based on the sum.\n if (sum === 0) {\n for (const sizer of this.sizers) {\n sizer.size = sizer.sizeHint = 1 / n;\n }\n } else {\n for (const sizer of this.sizers) {\n sizer.size = sizer.sizeHint /= sum;\n }\n }\n\n // Mark the sizes as normalized.\n this.normalized = true;\n }\n\n /**\n * Snap the normalized sizes of the split layout node.\n */\n createNormalizedSizes(): number[] {\n // Bail early if the sizers are empty.\n let n = this.sizers.length;\n if (n === 0) {\n return [];\n }\n\n // Grab the current sizes of the sizers.\n let sizes = this.sizers.map(sizer => sizer.size);\n\n // Compute the sum of the sizes.\n let sum = sizes.reduce((v, size) => v + size, 0);\n\n // Normalize the sizes based on the sum.\n if (sum === 0) {\n for (let i = sizes.length - 1; i > -1; i--) {\n sizes[i] = 1 / n;\n }\n } else {\n for (let i = sizes.length - 1; i > -1; i--) {\n sizes[i] /= sum;\n }\n }\n\n // Return the normalized sizes.\n return sizes;\n }\n\n /**\n * Fit the layout tree.\n */\n fit(spacing: number, items: ItemMap): ElementExt.ISizeLimits {\n // Compute the required fixed space.\n let horizontal = this.orientation === 'horizontal';\n let fixed = Math.max(0, this.children.length - 1) * spacing;\n\n // Set up the limit variables.\n let minWidth = horizontal ? fixed : 0;\n let minHeight = horizontal ? 0 : fixed;\n let maxWidth = Infinity;\n let maxHeight = Infinity;\n\n // Fit the children and update the limits.\n for (let i = 0, n = this.children.length; i < n; ++i) {\n let limits = this.children[i].fit(spacing, items);\n if (horizontal) {\n minHeight = Math.max(minHeight, limits.minHeight);\n minWidth += limits.minWidth;\n this.sizers[i].minSize = limits.minWidth;\n } else {\n minWidth = Math.max(minWidth, limits.minWidth);\n minHeight += limits.minHeight;\n this.sizers[i].minSize = limits.minHeight;\n }\n }\n\n // Return the computed limits for the layout node.\n return { minWidth, minHeight, maxWidth, maxHeight };\n }\n\n /**\n * Update the layout tree.\n */\n update(\n left: number,\n top: number,\n width: number,\n height: number,\n spacing: number,\n items: ItemMap\n ): void {\n // Compute the available layout space.\n let horizontal = this.orientation === 'horizontal';\n let fixed = Math.max(0, this.children.length - 1) * spacing;\n let space = Math.max(0, (horizontal ? width : height) - fixed);\n\n // De-normalize the sizes if needed.\n if (this.normalized) {\n for (const sizer of this.sizers) {\n sizer.sizeHint *= space;\n }\n this.normalized = false;\n }\n\n // Distribute the layout space to the sizers.\n BoxEngine.calc(this.sizers, space);\n\n // Update the geometry of the child nodes and handles.\n for (let i = 0, n = this.children.length; i < n; ++i) {\n let child = this.children[i];\n let size = this.sizers[i].size;\n let handleStyle = this.handles[i].style;\n if (horizontal) {\n child.update(left, top, size, height, spacing, items);\n left += size;\n handleStyle.top = `${top}px`;\n handleStyle.left = `${left}px`;\n handleStyle.width = `${spacing}px`;\n handleStyle.height = `${height}px`;\n left += spacing;\n } else {\n child.update(left, top, width, size, spacing, items);\n top += size;\n handleStyle.top = `${top}px`;\n handleStyle.left = `${left}px`;\n handleStyle.width = `${width}px`;\n handleStyle.height = `${spacing}px`;\n top += spacing;\n }\n }\n }\n }\n\n export function addAria(widget: Widget, tabBar: TabBar): void {\n widget.node.setAttribute('role', 'tabpanel');\n let renderer = tabBar.renderer;\n if (renderer instanceof TabBar.Renderer) {\n let tabId = renderer.createTabKey({\n title: widget.title,\n current: false,\n zIndex: 0\n });\n widget.node.setAttribute('aria-labelledby', tabId);\n }\n }\n\n export function removeAria(widget: Widget): void {\n widget.node.removeAttribute('role');\n widget.node.removeAttribute('aria-labelledby');\n }\n\n /**\n * Normalize a tab area config and collect the visited widgets.\n */\n function normalizeTabAreaConfig(\n config: DockLayout.ITabAreaConfig,\n widgetSet: Set\n ): DockLayout.ITabAreaConfig | null {\n // Bail early if there is no content.\n if (config.widgets.length === 0) {\n return null;\n }\n\n // Setup the filtered widgets array.\n let widgets: Widget[] = [];\n\n // Filter the config for unique widgets.\n for (const widget of config.widgets) {\n if (!widgetSet.has(widget)) {\n widgetSet.add(widget);\n widgets.push(widget);\n }\n }\n\n // Bail if there are no effective widgets.\n if (widgets.length === 0) {\n return null;\n }\n\n // Normalize the current index.\n let index = config.currentIndex;\n if (index !== -1 && (index < 0 || index >= widgets.length)) {\n index = 0;\n }\n\n // Return a normalized config object.\n return { type: 'tab-area', widgets, currentIndex: index };\n }\n\n /**\n * Normalize a split area config and collect the visited widgets.\n */\n function normalizeSplitAreaConfig(\n config: DockLayout.ISplitAreaConfig,\n widgetSet: Set\n ): DockLayout.AreaConfig | null {\n // Set up the result variables.\n let orientation = config.orientation;\n let children: DockLayout.AreaConfig[] = [];\n let sizes: number[] = [];\n\n // Normalize the config children.\n for (let i = 0, n = config.children.length; i < n; ++i) {\n // Normalize the child config.\n let child = normalizeAreaConfig(config.children[i], widgetSet);\n\n // Ignore an empty child.\n if (!child) {\n continue;\n }\n\n // Add the child or hoist its content as appropriate.\n if (child.type === 'tab-area' || child.orientation !== orientation) {\n children.push(child);\n sizes.push(Math.abs(config.sizes[i] || 0));\n } else {\n children.push(...child.children);\n sizes.push(...child.sizes);\n }\n }\n\n // Bail if there are no effective children.\n if (children.length === 0) {\n return null;\n }\n\n // If there is only one effective child, return that child.\n if (children.length === 1) {\n return children[0];\n }\n\n // Return a normalized config object.\n return { type: 'split-area', orientation, children, sizes };\n }\n\n /**\n * Convert a normalized tab area config into a layout tree.\n */\n function realizeTabAreaConfig(\n config: DockLayout.ITabAreaConfig,\n renderer: DockLayout.IRenderer,\n document: Document | ShadowRoot\n ): TabLayoutNode {\n // Create the tab bar for the layout node.\n let tabBar = renderer.createTabBar(document);\n\n // Hide each widget and add it to the tab bar.\n for (const widget of config.widgets) {\n widget.hide();\n tabBar.addTab(widget.title);\n Private.addAria(widget, tabBar);\n }\n\n // Set the current index of the tab bar.\n tabBar.currentIndex = config.currentIndex;\n\n // Return the new tab layout node.\n return new TabLayoutNode(tabBar);\n }\n\n /**\n * Convert a normalized split area config into a layout tree.\n */\n function realizeSplitAreaConfig(\n config: DockLayout.ISplitAreaConfig,\n renderer: DockLayout.IRenderer,\n document: Document | ShadowRoot\n ): SplitLayoutNode {\n // Create the split layout node.\n let node = new SplitLayoutNode(config.orientation);\n\n // Add each child to the layout node.\n config.children.forEach((child, i) => {\n // Create the child data for the layout node.\n let childNode = realizeAreaConfig(child, renderer, document);\n let sizer = createSizer(config.sizes[i]);\n let handle = renderer.createHandle();\n\n // Add the child data to the layout node.\n node.children.push(childNode);\n node.handles.push(handle);\n node.sizers.push(sizer);\n\n // Update the parent for the child node.\n childNode.parent = node;\n });\n\n // Synchronize the handle state for the layout node.\n node.syncHandles();\n\n // Normalize the sizes for the layout node.\n node.normalizeSizes();\n\n // Return the new layout node.\n return node;\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { find } from '@lumino/algorithm';\n\nimport { MimeData } from '@lumino/coreutils';\n\nimport { IDisposable } from '@lumino/disposable';\n\nimport { ElementExt, Platform } from '@lumino/domutils';\n\nimport { Drag } from '@lumino/dragdrop';\n\nimport { ConflatableMessage, Message, MessageLoop } from '@lumino/messaging';\n\nimport { AttachedProperty } from '@lumino/properties';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { DockLayout } from './docklayout';\n\nimport { TabBar } from './tabbar';\n\nimport { Widget } from './widget';\n\n/**\n * A widget which provides a flexible docking area for widgets.\n *\n * #### Notes\n * See also the related [example](../../examples/dockpanel/index.html) and\n * its [source](https://github.com/jupyterlab/lumino/tree/main/examples/example-dockpanel).\n */\nexport class DockPanel extends Widget {\n /**\n * Construct a new dock panel.\n *\n * @param options - The options for initializing the panel.\n */\n constructor(options: DockPanel.IOptions = {}) {\n super();\n this.addClass('lm-DockPanel');\n this._document = options.document || document;\n this._mode = options.mode || 'multiple-document';\n this._renderer = options.renderer || DockPanel.defaultRenderer;\n this._edges = options.edges || Private.DEFAULT_EDGES;\n if (options.tabsMovable !== undefined) {\n this._tabsMovable = options.tabsMovable;\n }\n if (options.tabsConstrained !== undefined) {\n this._tabsConstrained = options.tabsConstrained;\n }\n if (options.addButtonEnabled !== undefined) {\n this._addButtonEnabled = options.addButtonEnabled;\n }\n\n // Toggle the CSS mode attribute.\n this.dataset['mode'] = this._mode;\n\n // Create the delegate renderer for the layout.\n let renderer: DockPanel.IRenderer = {\n createTabBar: () => this._createTabBar(),\n createHandle: () => this._createHandle()\n };\n\n // Set up the dock layout for the panel.\n this.layout = new DockLayout({\n document: this._document,\n renderer,\n spacing: options.spacing,\n hiddenMode: options.hiddenMode\n });\n\n // Set up the overlay drop indicator.\n this.overlay = options.overlay || new DockPanel.Overlay();\n this.node.appendChild(this.overlay.node);\n }\n\n /**\n * Dispose of the resources held by the panel.\n */\n dispose(): void {\n // Ensure the mouse is released.\n this._releaseMouse();\n\n // Hide the overlay.\n this.overlay.hide(0);\n\n // Cancel a drag if one is in progress.\n if (this._drag) {\n this._drag.dispose();\n }\n\n // Dispose of the base class.\n super.dispose();\n }\n\n /**\n * The method for hiding widgets.\n */\n get hiddenMode(): Widget.HiddenMode {\n return (this.layout as DockLayout).hiddenMode;\n }\n\n /**\n * Set the method for hiding widgets.\n */\n set hiddenMode(v: Widget.HiddenMode) {\n (this.layout as DockLayout).hiddenMode = v;\n }\n\n /**\n * A signal emitted when the layout configuration is modified.\n *\n * #### Notes\n * This signal is emitted whenever the current layout configuration\n * may have changed.\n *\n * This signal is emitted asynchronously in a collapsed fashion, so\n * that multiple synchronous modifications results in only a single\n * emit of the signal.\n */\n get layoutModified(): ISignal {\n return this._layoutModified;\n }\n\n /**\n * A signal emitted when the add button on a tab bar is clicked.\n *\n */\n get addRequested(): ISignal> {\n return this._addRequested;\n }\n\n /**\n * The overlay used by the dock panel.\n */\n readonly overlay: DockPanel.IOverlay;\n\n /**\n * The renderer used by the dock panel.\n */\n get renderer(): DockPanel.IRenderer {\n return (this.layout as DockLayout).renderer;\n }\n\n /**\n * Get the spacing between the widgets.\n */\n get spacing(): number {\n return (this.layout as DockLayout).spacing;\n }\n\n /**\n * Set the spacing between the widgets.\n */\n set spacing(value: number) {\n (this.layout as DockLayout).spacing = value;\n }\n\n /**\n * Get the mode for the dock panel.\n */\n get mode(): DockPanel.Mode {\n return this._mode;\n }\n\n /**\n * Set the mode for the dock panel.\n *\n * #### Notes\n * Changing the mode is a destructive operation with respect to the\n * panel's layout configuration. If layout state must be preserved,\n * save the current layout config before changing the mode.\n */\n set mode(value: DockPanel.Mode) {\n // Bail early if the mode does not change.\n if (this._mode === value) {\n return;\n }\n\n // Update the internal mode.\n this._mode = value;\n\n // Toggle the CSS mode attribute.\n this.dataset['mode'] = value;\n\n // Get the layout for the panel.\n let layout = this.layout as DockLayout;\n\n // Configure the layout for the specified mode.\n switch (value) {\n case 'multiple-document':\n for (const tabBar of layout.tabBars()) {\n tabBar.show();\n }\n break;\n case 'single-document':\n layout.restoreLayout(Private.createSingleDocumentConfig(this));\n break;\n default:\n throw 'unreachable';\n }\n\n // Schedule an emit of the layout modified signal.\n MessageLoop.postMessage(this, Private.LayoutModified);\n }\n\n /**\n * Whether the tabs can be dragged / moved at runtime.\n */\n get tabsMovable(): boolean {\n return this._tabsMovable;\n }\n\n /**\n * Enable / Disable draggable / movable tabs.\n */\n set tabsMovable(value: boolean) {\n this._tabsMovable = value;\n for (const tabBar of this.tabBars()) {\n tabBar.tabsMovable = value;\n }\n }\n\n /**\n * Whether the tabs are constrained to their source dock panel\n */\n get tabsConstrained(): boolean {\n return this._tabsConstrained;\n }\n\n /**\n * Constrain/Allow tabs to be dragged outside of this dock panel\n */\n set tabsConstrained(value: boolean) {\n this._tabsConstrained = value;\n }\n\n /**\n * Whether the add buttons for each tab bar are enabled.\n */\n get addButtonEnabled(): boolean {\n return this._addButtonEnabled;\n }\n\n /**\n * Set whether the add buttons for each tab bar are enabled.\n */\n set addButtonEnabled(value: boolean) {\n this._addButtonEnabled = value;\n for (const tabBar of this.tabBars()) {\n tabBar.addButtonEnabled = value;\n }\n }\n\n /**\n * Whether the dock panel is empty.\n */\n get isEmpty(): boolean {\n return (this.layout as DockLayout).isEmpty;\n }\n\n /**\n * Create an iterator over the user widgets in the panel.\n *\n * @returns A new iterator over the user widgets in the panel.\n *\n * #### Notes\n * This iterator does not include the generated tab bars.\n */\n *widgets(): IterableIterator {\n yield* (this.layout as DockLayout).widgets();\n }\n\n /**\n * Create an iterator over the selected widgets in the panel.\n *\n * @returns A new iterator over the selected user widgets.\n *\n * #### Notes\n * This iterator yields the widgets corresponding to the current tab\n * of each tab bar in the panel.\n */\n *selectedWidgets(): IterableIterator {\n yield* (this.layout as DockLayout).selectedWidgets();\n }\n\n /**\n * Create an iterator over the tab bars in the panel.\n *\n * @returns A new iterator over the tab bars in the panel.\n *\n * #### Notes\n * This iterator does not include the user widgets.\n */\n *tabBars(): IterableIterator> {\n yield* (this.layout as DockLayout).tabBars();\n }\n\n /**\n * Create an iterator over the handles in the panel.\n *\n * @returns A new iterator over the handles in the panel.\n */\n *handles(): IterableIterator {\n yield* (this.layout as DockLayout).handles();\n }\n\n /**\n * Select a specific widget in the dock panel.\n *\n * @param widget - The widget of interest.\n *\n * #### Notes\n * This will make the widget the current widget in its tab area.\n */\n selectWidget(widget: Widget): void {\n // Find the tab bar which contains the widget.\n let tabBar = find(this.tabBars(), bar => {\n return bar.titles.indexOf(widget.title) !== -1;\n });\n\n // Throw an error if no tab bar is found.\n if (!tabBar) {\n throw new Error('Widget is not contained in the dock panel.');\n }\n\n // Ensure the widget is the current widget.\n tabBar.currentTitle = widget.title;\n }\n\n /**\n * Activate a specified widget in the dock panel.\n *\n * @param widget - The widget of interest.\n *\n * #### Notes\n * This will select and activate the given widget.\n */\n activateWidget(widget: Widget): void {\n this.selectWidget(widget);\n widget.activate();\n }\n\n /**\n * Save the current layout configuration of the dock panel.\n *\n * @returns A new config object for the current layout state.\n *\n * #### Notes\n * The return value can be provided to the `restoreLayout` method\n * in order to restore the layout to its current configuration.\n */\n saveLayout(): DockPanel.ILayoutConfig {\n return (this.layout as DockLayout).saveLayout();\n }\n\n /**\n * Restore the layout to a previously saved configuration.\n *\n * @param config - The layout configuration to restore.\n *\n * #### Notes\n * Widgets which currently belong to the layout but which are not\n * contained in the config will be unparented.\n *\n * The dock panel automatically reverts to `'multiple-document'`\n * mode when a layout config is restored.\n */\n restoreLayout(config: DockPanel.ILayoutConfig): void {\n // Reset the mode.\n this._mode = 'multiple-document';\n\n // Restore the layout.\n (this.layout as DockLayout).restoreLayout(config);\n\n // Flush the message loop on IE and Edge to prevent flicker.\n if (Platform.IS_EDGE || Platform.IS_IE) {\n MessageLoop.flush();\n }\n\n // Schedule an emit of the layout modified signal.\n MessageLoop.postMessage(this, Private.LayoutModified);\n }\n\n /**\n * Add a widget to the dock panel.\n *\n * @param widget - The widget to add to the dock panel.\n *\n * @param options - The additional options for adding the widget.\n *\n * #### Notes\n * If the panel is in single document mode, the options are ignored\n * and the widget is always added as tab in the hidden tab bar.\n */\n addWidget(widget: Widget, options: DockPanel.IAddOptions = {}): void {\n // Add the widget to the layout.\n if (this._mode === 'single-document') {\n (this.layout as DockLayout).addWidget(widget);\n } else {\n (this.layout as DockLayout).addWidget(widget, options);\n }\n\n // Schedule an emit of the layout modified signal.\n MessageLoop.postMessage(this, Private.LayoutModified);\n }\n\n /**\n * Process a message sent to the widget.\n *\n * @param msg - The message sent to the widget.\n */\n processMessage(msg: Message): void {\n if (msg.type === 'layout-modified') {\n this._layoutModified.emit(undefined);\n } else {\n super.processMessage(msg);\n }\n }\n\n /**\n * Handle the DOM events for the dock panel.\n *\n * @param event - The DOM event sent to the panel.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the panel's DOM node. It should\n * not be called directly by user code.\n */\n handleEvent(event: Event): void {\n switch (event.type) {\n case 'lm-dragenter':\n this._evtDragEnter(event as Drag.Event);\n break;\n case 'lm-dragleave':\n this._evtDragLeave(event as Drag.Event);\n break;\n case 'lm-dragover':\n this._evtDragOver(event as Drag.Event);\n break;\n case 'lm-drop':\n this._evtDrop(event as Drag.Event);\n break;\n case 'pointerdown':\n this._evtPointerDown(event as PointerEvent);\n break;\n case 'pointermove':\n this._evtPointerMove(event as PointerEvent);\n break;\n case 'pointerup':\n this._evtPointerUp(event as PointerEvent);\n break;\n case 'keydown':\n this._evtKeyDown(event as KeyboardEvent);\n break;\n case 'contextmenu':\n event.preventDefault();\n event.stopPropagation();\n break;\n }\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n this.node.addEventListener('lm-dragenter', this);\n this.node.addEventListener('lm-dragleave', this);\n this.node.addEventListener('lm-dragover', this);\n this.node.addEventListener('lm-drop', this);\n this.node.addEventListener('pointerdown', this);\n }\n\n /**\n * A message handler invoked on an `'after-detach'` message.\n */\n protected onAfterDetach(msg: Message): void {\n this.node.removeEventListener('lm-dragenter', this);\n this.node.removeEventListener('lm-dragleave', this);\n this.node.removeEventListener('lm-dragover', this);\n this.node.removeEventListener('lm-drop', this);\n this.node.removeEventListener('pointerdown', this);\n this._releaseMouse();\n }\n\n /**\n * A message handler invoked on a `'child-added'` message.\n */\n protected onChildAdded(msg: Widget.ChildMessage): void {\n // Ignore the generated tab bars.\n if (Private.isGeneratedTabBarProperty.get(msg.child)) {\n return;\n }\n\n // Add the widget class to the child.\n msg.child.addClass('lm-DockPanel-widget');\n }\n\n /**\n * A message handler invoked on a `'child-removed'` message.\n */\n protected onChildRemoved(msg: Widget.ChildMessage): void {\n // Ignore the generated tab bars.\n if (Private.isGeneratedTabBarProperty.get(msg.child)) {\n return;\n }\n\n // Remove the widget class from the child.\n msg.child.removeClass('lm-DockPanel-widget');\n\n // Schedule an emit of the layout modified signal.\n MessageLoop.postMessage(this, Private.LayoutModified);\n }\n\n /**\n * Handle the `'lm-dragenter'` event for the dock panel.\n */\n private _evtDragEnter(event: Drag.Event): void {\n // If the factory mime type is present, mark the event as\n // handled in order to get the rest of the drag events.\n if (event.mimeData.hasData('application/vnd.lumino.widget-factory')) {\n event.preventDefault();\n event.stopPropagation();\n }\n }\n\n /**\n * Handle the `'lm-dragleave'` event for the dock panel.\n */\n private _evtDragLeave(event: Drag.Event): void {\n // Mark the event as handled.\n event.preventDefault();\n\n if (this._tabsConstrained && event.source !== this) return;\n\n event.stopPropagation();\n\n // The new target might be a descendant, so we might still handle the drop.\n // Hide asynchronously so that if a lm-dragover event bubbles up to us, the\n // hide is cancelled by the lm-dragover handler's show overlay logic.\n this.overlay.hide(1);\n }\n\n /**\n * Handle the `'lm-dragover'` event for the dock panel.\n */\n private _evtDragOver(event: Drag.Event): void {\n // Mark the event as handled.\n event.preventDefault();\n\n // Show the drop indicator overlay and update the drop\n // action based on the drop target zone under the mouse.\n if (\n (this._tabsConstrained && event.source !== this) ||\n this._showOverlay(event.clientX, event.clientY) === 'invalid'\n ) {\n event.dropAction = 'none';\n } else {\n event.stopPropagation();\n event.dropAction = event.proposedAction;\n }\n }\n\n /**\n * Handle the `'lm-drop'` event for the dock panel.\n */\n private _evtDrop(event: Drag.Event): void {\n // Mark the event as handled.\n event.preventDefault();\n\n // Hide the drop indicator overlay.\n this.overlay.hide(0);\n\n // Bail if the proposed action is to do nothing.\n if (event.proposedAction === 'none') {\n event.dropAction = 'none';\n return;\n }\n\n // Find the drop target under the mouse.\n let { clientX, clientY } = event;\n let { zone, target } = Private.findDropTarget(\n this,\n clientX,\n clientY,\n this._edges\n );\n\n // Bail if the drop zone is invalid.\n if (\n (this._tabsConstrained && event.source !== this) ||\n zone === 'invalid'\n ) {\n event.dropAction = 'none';\n return;\n }\n\n // Bail if the factory mime type has invalid data.\n let mimeData = event.mimeData;\n let factory = mimeData.getData('application/vnd.lumino.widget-factory');\n if (typeof factory !== 'function') {\n event.dropAction = 'none';\n return;\n }\n\n // Bail if the factory does not produce a widget.\n let widget = factory();\n if (!(widget instanceof Widget)) {\n event.dropAction = 'none';\n return;\n }\n\n // Bail if the widget is an ancestor of the dock panel.\n if (widget.contains(this)) {\n event.dropAction = 'none';\n return;\n }\n\n // Find the reference widget for the drop target.\n let ref = target ? Private.getDropRef(target.tabBar) : null;\n\n // Add the widget according to the indicated drop zone.\n switch (zone) {\n case 'root-all':\n this.addWidget(widget);\n break;\n case 'root-top':\n this.addWidget(widget, { mode: 'split-top' });\n break;\n case 'root-left':\n this.addWidget(widget, { mode: 'split-left' });\n break;\n case 'root-right':\n this.addWidget(widget, { mode: 'split-right' });\n break;\n case 'root-bottom':\n this.addWidget(widget, { mode: 'split-bottom' });\n break;\n case 'widget-all':\n this.addWidget(widget, { mode: 'tab-after', ref });\n break;\n case 'widget-top':\n this.addWidget(widget, { mode: 'split-top', ref });\n break;\n case 'widget-left':\n this.addWidget(widget, { mode: 'split-left', ref });\n break;\n case 'widget-right':\n this.addWidget(widget, { mode: 'split-right', ref });\n break;\n case 'widget-bottom':\n this.addWidget(widget, { mode: 'split-bottom', ref });\n break;\n case 'widget-tab':\n this.addWidget(widget, { mode: 'tab-after', ref });\n break;\n default:\n throw 'unreachable';\n }\n\n // Accept the proposed drop action.\n event.dropAction = event.proposedAction;\n\n // Stop propagation if we have not bailed so far.\n event.stopPropagation();\n\n // Activate the dropped widget.\n this.activateWidget(widget);\n }\n\n /**\n * Handle the `'keydown'` event for the dock panel.\n */\n private _evtKeyDown(event: KeyboardEvent): void {\n // Stop input events during drag.\n event.preventDefault();\n event.stopPropagation();\n\n // Release the mouse if `Escape` is pressed.\n if (event.keyCode === 27) {\n // Finalize the mouse release.\n this._releaseMouse();\n\n // Schedule an emit of the layout modified signal.\n MessageLoop.postMessage(this, Private.LayoutModified);\n }\n }\n\n /**\n * Handle the `'pointerdown'` event for the dock panel.\n */\n private _evtPointerDown(event: PointerEvent): void {\n // Do nothing if the left mouse button is not pressed.\n if (event.button !== 0) {\n return;\n }\n\n // Find the handle which contains the mouse target, if any.\n let layout = this.layout as DockLayout;\n let target = event.target as HTMLElement;\n let handle = find(layout.handles(), handle => handle.contains(target));\n if (!handle) {\n return;\n }\n\n // Stop the event when a handle is pressed.\n event.preventDefault();\n event.stopPropagation();\n\n // Add the extra document listeners.\n this._document.addEventListener('keydown', this, true);\n this._document.addEventListener('pointerup', this, true);\n this._document.addEventListener('pointermove', this, true);\n this._document.addEventListener('contextmenu', this, true);\n\n // Compute the offset deltas for the handle press.\n let rect = handle.getBoundingClientRect();\n let deltaX = event.clientX - rect.left;\n let deltaY = event.clientY - rect.top;\n\n // Override the cursor and store the press data.\n let style = window.getComputedStyle(handle);\n let override = Drag.overrideCursor(style.cursor!, this._document);\n this._pressData = { handle, deltaX, deltaY, override };\n }\n\n /**\n * Handle the `'pointermove'` event for the dock panel.\n */\n private _evtPointerMove(event: PointerEvent): void {\n // Bail early if no drag is in progress.\n if (!this._pressData) {\n return;\n }\n\n // Stop the event when dragging a handle.\n event.preventDefault();\n event.stopPropagation();\n\n // Compute the desired offset position for the handle.\n let rect = this.node.getBoundingClientRect();\n let xPos = event.clientX - rect.left - this._pressData.deltaX;\n let yPos = event.clientY - rect.top - this._pressData.deltaY;\n\n // Set the handle as close to the desired position as possible.\n let layout = this.layout as DockLayout;\n layout.moveHandle(this._pressData.handle, xPos, yPos);\n }\n\n /**\n * Handle the `'pointerup'` event for the dock panel.\n */\n private _evtPointerUp(event: PointerEvent): void {\n // Do nothing if the left mouse button is not released.\n if (event.button !== 0) {\n return;\n }\n\n // Stop the event when releasing a handle.\n event.preventDefault();\n event.stopPropagation();\n\n // Finalize the mouse release.\n this._releaseMouse();\n\n // Schedule an emit of the layout modified signal.\n MessageLoop.postMessage(this, Private.LayoutModified);\n }\n\n /**\n * Release the mouse grab for the dock panel.\n */\n private _releaseMouse(): void {\n // Bail early if no drag is in progress.\n if (!this._pressData) {\n return;\n }\n\n // Clear the override cursor.\n this._pressData.override.dispose();\n this._pressData = null;\n\n // Remove the extra document listeners.\n this._document.removeEventListener('keydown', this, true);\n this._document.removeEventListener('pointerup', this, true);\n this._document.removeEventListener('pointermove', this, true);\n this._document.removeEventListener('contextmenu', this, true);\n }\n\n /**\n * Show the overlay indicator at the given client position.\n *\n * Returns the drop zone at the specified client position.\n *\n * #### Notes\n * If the position is not over a valid zone, the overlay is hidden.\n */\n private _showOverlay(clientX: number, clientY: number): Private.DropZone {\n // Find the dock target for the given client position.\n let { zone, target } = Private.findDropTarget(\n this,\n clientX,\n clientY,\n this._edges\n );\n\n // If the drop zone is invalid, hide the overlay and bail.\n if (zone === 'invalid') {\n this.overlay.hide(100);\n return zone;\n }\n\n // Setup the variables needed to compute the overlay geometry.\n let top: number;\n let left: number;\n let right: number;\n let bottom: number;\n let box = ElementExt.boxSizing(this.node); // TODO cache this?\n let rect = this.node.getBoundingClientRect();\n\n // Compute the overlay geometry based on the dock zone.\n switch (zone) {\n case 'root-all':\n top = box.paddingTop;\n left = box.paddingLeft;\n right = box.paddingRight;\n bottom = box.paddingBottom;\n break;\n case 'root-top':\n top = box.paddingTop;\n left = box.paddingLeft;\n right = box.paddingRight;\n bottom = rect.height * Private.GOLDEN_RATIO;\n break;\n case 'root-left':\n top = box.paddingTop;\n left = box.paddingLeft;\n right = rect.width * Private.GOLDEN_RATIO;\n bottom = box.paddingBottom;\n break;\n case 'root-right':\n top = box.paddingTop;\n left = rect.width * Private.GOLDEN_RATIO;\n right = box.paddingRight;\n bottom = box.paddingBottom;\n break;\n case 'root-bottom':\n top = rect.height * Private.GOLDEN_RATIO;\n left = box.paddingLeft;\n right = box.paddingRight;\n bottom = box.paddingBottom;\n break;\n case 'widget-all':\n top = target!.top;\n left = target!.left;\n right = target!.right;\n bottom = target!.bottom;\n break;\n case 'widget-top':\n top = target!.top;\n left = target!.left;\n right = target!.right;\n bottom = target!.bottom + target!.height / 2;\n break;\n case 'widget-left':\n top = target!.top;\n left = target!.left;\n right = target!.right + target!.width / 2;\n bottom = target!.bottom;\n break;\n case 'widget-right':\n top = target!.top;\n left = target!.left + target!.width / 2;\n right = target!.right;\n bottom = target!.bottom;\n break;\n case 'widget-bottom':\n top = target!.top + target!.height / 2;\n left = target!.left;\n right = target!.right;\n bottom = target!.bottom;\n break;\n case 'widget-tab': {\n const tabHeight = target!.tabBar.node.getBoundingClientRect().height;\n top = target!.top;\n left = target!.left;\n right = target!.right;\n bottom = target!.bottom + target!.height - tabHeight;\n break;\n }\n default:\n throw 'unreachable';\n }\n\n // Show the overlay with the computed geometry.\n this.overlay.show({ top, left, right, bottom });\n\n // Finally, return the computed drop zone.\n return zone;\n }\n\n /**\n * Create a new tab bar for use by the panel.\n */\n private _createTabBar(): TabBar {\n // Create the tab bar.\n let tabBar = this._renderer.createTabBar(this._document);\n\n // Set the generated tab bar property for the tab bar.\n Private.isGeneratedTabBarProperty.set(tabBar, true);\n\n // Hide the tab bar when in single document mode.\n if (this._mode === 'single-document') {\n tabBar.hide();\n }\n\n // Enforce necessary tab bar behavior.\n // TODO do we really want to enforce *all* of these?\n tabBar.tabsMovable = this._tabsMovable;\n tabBar.allowDeselect = false;\n tabBar.addButtonEnabled = this._addButtonEnabled;\n tabBar.removeBehavior = 'select-previous-tab';\n tabBar.insertBehavior = 'select-tab-if-needed';\n\n // Connect the signal handlers for the tab bar.\n tabBar.tabMoved.connect(this._onTabMoved, this);\n tabBar.currentChanged.connect(this._onCurrentChanged, this);\n tabBar.tabCloseRequested.connect(this._onTabCloseRequested, this);\n tabBar.tabDetachRequested.connect(this._onTabDetachRequested, this);\n tabBar.tabActivateRequested.connect(this._onTabActivateRequested, this);\n tabBar.addRequested.connect(this._onTabAddRequested, this);\n\n // Return the initialized tab bar.\n return tabBar;\n }\n\n /**\n * Create a new handle for use by the panel.\n */\n private _createHandle(): HTMLDivElement {\n return this._renderer.createHandle();\n }\n\n /**\n * Handle the `tabMoved` signal from a tab bar.\n */\n private _onTabMoved(): void {\n MessageLoop.postMessage(this, Private.LayoutModified);\n }\n\n /**\n * Handle the `currentChanged` signal from a tab bar.\n */\n private _onCurrentChanged(\n sender: TabBar,\n args: TabBar.ICurrentChangedArgs\n ): void {\n // Extract the previous and current title from the args.\n let { previousTitle, currentTitle } = args;\n\n // Hide the previous widget.\n if (previousTitle) {\n previousTitle.owner.hide();\n }\n\n // Show the current widget.\n if (currentTitle) {\n currentTitle.owner.show();\n }\n\n // Flush the message loop on IE and Edge to prevent flicker.\n if (Platform.IS_EDGE || Platform.IS_IE) {\n MessageLoop.flush();\n }\n\n // Schedule an emit of the layout modified signal.\n MessageLoop.postMessage(this, Private.LayoutModified);\n }\n\n /**\n * Handle the `addRequested` signal from a tab bar.\n */\n private _onTabAddRequested(sender: TabBar): void {\n this._addRequested.emit(sender);\n }\n\n /**\n * Handle the `tabActivateRequested` signal from a tab bar.\n */\n private _onTabActivateRequested(\n sender: TabBar,\n args: TabBar.ITabActivateRequestedArgs\n ): void {\n args.title.owner.activate();\n }\n\n /**\n * Handle the `tabCloseRequested` signal from a tab bar.\n */\n private _onTabCloseRequested(\n sender: TabBar,\n args: TabBar.ITabCloseRequestedArgs\n ): void {\n args.title.owner.close();\n }\n\n /**\n * Handle the `tabDetachRequested` signal from a tab bar.\n */\n private _onTabDetachRequested(\n sender: TabBar,\n args: TabBar.ITabDetachRequestedArgs\n ): void {\n // Do nothing if a drag is already in progress.\n if (this._drag) {\n return;\n }\n\n // Release the tab bar's hold on the mouse.\n sender.releaseMouse();\n\n // Extract the data from the args.\n let { title, tab, clientX, clientY, offset } = args;\n\n // Setup the mime data for the drag operation.\n let mimeData = new MimeData();\n let factory = () => title.owner;\n mimeData.setData('application/vnd.lumino.widget-factory', factory);\n\n // Create the drag image for the drag operation.\n let dragImage = tab.cloneNode(true) as HTMLElement;\n if (offset) {\n dragImage.style.top = `-${offset.y}px`;\n dragImage.style.left = `-${offset.x}px`;\n }\n\n // Create the drag object to manage the drag-drop operation.\n this._drag = new Drag({\n document: this._document,\n mimeData,\n dragImage,\n proposedAction: 'move',\n supportedActions: 'move',\n source: this\n });\n\n // Hide the tab node in the original tab.\n tab.classList.add('lm-mod-hidden');\n let cleanup = () => {\n this._drag = null;\n tab.classList.remove('lm-mod-hidden');\n };\n\n // Start the drag operation and cleanup when done.\n this._drag.start(clientX, clientY).then(cleanup);\n }\n\n private _edges: DockPanel.IEdges;\n private _document: Document | ShadowRoot;\n private _mode: DockPanel.Mode;\n private _drag: Drag | null = null;\n private _renderer: DockPanel.IRenderer;\n private _tabsMovable: boolean = true;\n private _tabsConstrained: boolean = false;\n private _addButtonEnabled: boolean = false;\n private _pressData: Private.IPressData | null = null;\n private _layoutModified = new Signal(this);\n\n private _addRequested = new Signal>(this);\n}\n\n/**\n * The namespace for the `DockPanel` class statics.\n */\nexport namespace DockPanel {\n /**\n * An options object for creating a dock panel.\n */\n export interface IOptions {\n /**\n * The document to use with the dock panel.\n *\n * The default is the global `document` instance.\n */\n\n document?: Document | ShadowRoot;\n /**\n * The overlay to use with the dock panel.\n *\n * The default is a new `Overlay` instance.\n */\n overlay?: IOverlay;\n\n /**\n * The renderer to use for the dock panel.\n *\n * The default is a shared renderer instance.\n */\n renderer?: IRenderer;\n\n /**\n * The spacing between the items in the panel.\n *\n * The default is `4`.\n */\n spacing?: number;\n\n /**\n * The mode for the dock panel.\n *\n * The default is `'multiple-document'`.\n */\n mode?: DockPanel.Mode;\n\n /**\n * The sizes of the edge drop zones, in pixels.\n * If not given, default values will be used.\n */\n edges?: IEdges;\n\n /**\n * The method for hiding widgets.\n *\n * The default is `Widget.HiddenMode.Display`.\n */\n hiddenMode?: Widget.HiddenMode;\n\n /**\n * Allow tabs to be draggable / movable by user.\n *\n * The default is `'true'`.\n */\n tabsMovable?: boolean;\n\n /**\n * Constrain tabs to this dock panel\n *\n * The default is `'false'`.\n */\n tabsConstrained?: boolean;\n\n /**\n * Enable add buttons in each of the dock panel's tab bars.\n *\n * The default is `'false'`.\n */\n addButtonEnabled?: boolean;\n }\n\n /**\n * The sizes of the edge drop zones, in pixels.\n */\n export interface IEdges {\n /**\n * The size of the top edge drop zone.\n */\n top: number;\n\n /**\n * The size of the right edge drop zone.\n */\n right: number;\n\n /**\n * The size of the bottom edge drop zone.\n */\n bottom: number;\n\n /**\n * The size of the left edge drop zone.\n */\n left: number;\n }\n\n /**\n * A type alias for the supported dock panel modes.\n */\n export type Mode =\n | /**\n * The single document mode.\n *\n * In this mode, only a single widget is visible at a time, and that\n * widget fills the available layout space. No tab bars are visible.\n */\n 'single-document'\n\n /**\n * The multiple document mode.\n *\n * In this mode, multiple documents are displayed in separate tab\n * areas, and those areas can be individually resized by the user.\n */\n | 'multiple-document';\n\n /**\n * A type alias for a layout configuration object.\n */\n export type ILayoutConfig = DockLayout.ILayoutConfig;\n\n /**\n * A type alias for the supported insertion modes.\n */\n export type InsertMode = DockLayout.InsertMode;\n\n /**\n * A type alias for the add widget options.\n */\n export type IAddOptions = DockLayout.IAddOptions;\n\n /**\n * An object which holds the geometry for overlay positioning.\n */\n export interface IOverlayGeometry {\n /**\n * The distance between the overlay and parent top edges.\n */\n top: number;\n\n /**\n * The distance between the overlay and parent left edges.\n */\n left: number;\n\n /**\n * The distance between the overlay and parent right edges.\n */\n right: number;\n\n /**\n * The distance between the overlay and parent bottom edges.\n */\n bottom: number;\n }\n\n /**\n * An object which manages the overlay node for a dock panel.\n */\n export interface IOverlay {\n /**\n * The DOM node for the overlay.\n */\n readonly node: HTMLDivElement;\n\n /**\n * Show the overlay using the given overlay geometry.\n *\n * @param geo - The desired geometry for the overlay.\n *\n * #### Notes\n * The given geometry values assume the node will use absolute\n * positioning.\n *\n * This is called on every mouse move event during a drag in order\n * to update the position of the overlay. It should be efficient.\n */\n show(geo: IOverlayGeometry): void;\n\n /**\n * Hide the overlay node.\n *\n * @param delay - The delay (in ms) before hiding the overlay.\n * A delay value <= 0 should hide the overlay immediately.\n *\n * #### Notes\n * This is called whenever the overlay node should been hidden.\n */\n hide(delay: number): void;\n }\n\n /**\n * A concrete implementation of `IOverlay`.\n *\n * This is the default overlay implementation for a dock panel.\n */\n export class Overlay implements IOverlay {\n /**\n * Construct a new overlay.\n */\n constructor() {\n this.node = document.createElement('div');\n this.node.classList.add('lm-DockPanel-overlay');\n this.node.classList.add('lm-mod-hidden');\n this.node.style.position = 'absolute';\n this.node.style.contain = 'strict';\n }\n\n /**\n * The DOM node for the overlay.\n */\n readonly node: HTMLDivElement;\n\n /**\n * Show the overlay using the given overlay geometry.\n *\n * @param geo - The desired geometry for the overlay.\n */\n show(geo: IOverlayGeometry): void {\n // Update the position of the overlay.\n let style = this.node.style;\n style.top = `${geo.top}px`;\n style.left = `${geo.left}px`;\n style.right = `${geo.right}px`;\n style.bottom = `${geo.bottom}px`;\n\n // Clear any pending hide timer.\n clearTimeout(this._timer);\n this._timer = -1;\n\n // If the overlay is already visible, we're done.\n if (!this._hidden) {\n return;\n }\n\n // Clear the hidden flag.\n this._hidden = false;\n\n // Finally, show the overlay.\n this.node.classList.remove('lm-mod-hidden');\n }\n\n /**\n * Hide the overlay node.\n *\n * @param delay - The delay (in ms) before hiding the overlay.\n * A delay value <= 0 will hide the overlay immediately.\n */\n hide(delay: number): void {\n // Do nothing if the overlay is already hidden.\n if (this._hidden) {\n return;\n }\n\n // Hide immediately if the delay is <= 0.\n if (delay <= 0) {\n clearTimeout(this._timer);\n this._timer = -1;\n this._hidden = true;\n this.node.classList.add('lm-mod-hidden');\n return;\n }\n\n // Do nothing if a hide is already pending.\n if (this._timer !== -1) {\n return;\n }\n\n // Otherwise setup the hide timer.\n this._timer = window.setTimeout(() => {\n this._timer = -1;\n this._hidden = true;\n this.node.classList.add('lm-mod-hidden');\n }, delay);\n }\n\n private _timer = -1;\n private _hidden = true;\n }\n\n /**\n * A type alias for a dock panel renderer;\n */\n export type IRenderer = DockLayout.IRenderer;\n\n /**\n * The default implementation of `IRenderer`.\n */\n export class Renderer implements IRenderer {\n /**\n * Create a new tab bar for use with a dock panel.\n *\n * @returns A new tab bar for a dock panel.\n */\n createTabBar(document?: Document | ShadowRoot): TabBar {\n let bar = new TabBar({ document });\n bar.addClass('lm-DockPanel-tabBar');\n return bar;\n }\n\n /**\n * Create a new handle node for use with a dock panel.\n *\n * @returns A new handle node for a dock panel.\n */\n createHandle(): HTMLDivElement {\n let handle = document.createElement('div');\n handle.className = 'lm-DockPanel-handle';\n return handle;\n }\n }\n\n /**\n * The default `Renderer` instance.\n */\n export const defaultRenderer = new Renderer();\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * A fraction used for sizing root panels; ~= `1 / golden_ratio`.\n */\n export const GOLDEN_RATIO = 0.618;\n\n /**\n * The default sizes for the edge drop zones, in pixels.\n */\n export const DEFAULT_EDGES = {\n /**\n * The size of the top edge dock zone for the root panel, in pixels.\n * This is different from the others to distinguish between the top\n * tab bar and the top root zone.\n */\n top: 12,\n\n /**\n * The size of the edge dock zone for the root panel, in pixels.\n */\n right: 40,\n\n /**\n * The size of the edge dock zone for the root panel, in pixels.\n */\n bottom: 40,\n\n /**\n * The size of the edge dock zone for the root panel, in pixels.\n */\n left: 40\n };\n\n /**\n * A singleton `'layout-modified'` conflatable message.\n */\n export const LayoutModified = new ConflatableMessage('layout-modified');\n\n /**\n * An object which holds mouse press data.\n */\n export interface IPressData {\n /**\n * The handle which was pressed.\n */\n handle: HTMLDivElement;\n\n /**\n * The X offset of the press in handle coordinates.\n */\n deltaX: number;\n\n /**\n * The Y offset of the press in handle coordinates.\n */\n deltaY: number;\n\n /**\n * The disposable which will clear the override cursor.\n */\n override: IDisposable;\n }\n\n /**\n * A type alias for a drop zone.\n */\n export type DropZone =\n | /**\n * An invalid drop zone.\n */\n 'invalid'\n\n /**\n * The entirety of the root dock area.\n */\n | 'root-all'\n\n /**\n * The top portion of the root dock area.\n */\n | 'root-top'\n\n /**\n * The left portion of the root dock area.\n */\n | 'root-left'\n\n /**\n * The right portion of the root dock area.\n */\n | 'root-right'\n\n /**\n * The bottom portion of the root dock area.\n */\n | 'root-bottom'\n\n /**\n * The entirety of a tabbed widget area.\n */\n | 'widget-all'\n\n /**\n * The top portion of tabbed widget area.\n */\n | 'widget-top'\n\n /**\n * The left portion of tabbed widget area.\n */\n | 'widget-left'\n\n /**\n * The right portion of tabbed widget area.\n */\n | 'widget-right'\n\n /**\n * The bottom portion of tabbed widget area.\n */\n | 'widget-bottom'\n\n /**\n * The the bar of a tabbed widget area.\n */\n | 'widget-tab';\n\n /**\n * An object which holds the drop target zone and widget.\n */\n export interface IDropTarget {\n /**\n * The semantic zone for the mouse position.\n */\n zone: DropZone;\n\n /**\n * The tab area geometry for the drop zone, or `null`.\n */\n target: DockLayout.ITabAreaGeometry | null;\n }\n\n /**\n * An attached property used to track generated tab bars.\n */\n export const isGeneratedTabBarProperty = new AttachedProperty<\n Widget,\n boolean\n >({\n name: 'isGeneratedTabBar',\n create: () => false\n });\n\n /**\n * Create a single document config for the widgets in a dock panel.\n */\n export function createSingleDocumentConfig(\n panel: DockPanel\n ): DockPanel.ILayoutConfig {\n // Return an empty config if the panel is empty.\n if (panel.isEmpty) {\n return { main: null };\n }\n\n // Get a flat array of the widgets in the panel.\n let widgets = Array.from(panel.widgets());\n\n // Get the first selected widget in the panel.\n let selected = panel.selectedWidgets().next().value;\n\n // Compute the current index for the new config.\n let currentIndex = selected ? widgets.indexOf(selected) : -1;\n\n // Return the single document config.\n return { main: { type: 'tab-area', widgets, currentIndex } };\n }\n\n /**\n * Find the drop target at the given client position.\n */\n export function findDropTarget(\n panel: DockPanel,\n clientX: number,\n clientY: number,\n edges: DockPanel.IEdges\n ): IDropTarget {\n // Bail if the mouse is not over the dock panel.\n if (!ElementExt.hitTest(panel.node, clientX, clientY)) {\n return { zone: 'invalid', target: null };\n }\n\n // Look up the layout for the panel.\n let layout = panel.layout as DockLayout;\n\n // If the layout is empty, indicate the entire root drop zone.\n if (layout.isEmpty) {\n return { zone: 'root-all', target: null };\n }\n\n // Test the edge zones when in multiple document mode.\n if (panel.mode === 'multiple-document') {\n // Get the client rect for the dock panel.\n let panelRect = panel.node.getBoundingClientRect();\n\n // Compute the distance to each edge of the panel.\n let pl = clientX - panelRect.left + 1;\n let pt = clientY - panelRect.top + 1;\n let pr = panelRect.right - clientX;\n let pb = panelRect.bottom - clientY;\n\n // Find the minimum distance to an edge.\n let pd = Math.min(pt, pr, pb, pl);\n\n // Return a root zone if the mouse is within an edge.\n switch (pd) {\n case pt:\n if (pt < edges.top) {\n return { zone: 'root-top', target: null };\n }\n break;\n case pr:\n if (pr < edges.right) {\n return { zone: 'root-right', target: null };\n }\n break;\n case pb:\n if (pb < edges.bottom) {\n return { zone: 'root-bottom', target: null };\n }\n break;\n case pl:\n if (pl < edges.left) {\n return { zone: 'root-left', target: null };\n }\n break;\n default:\n throw 'unreachable';\n }\n }\n\n // Hit test the dock layout at the given client position.\n let target = layout.hitTestTabAreas(clientX, clientY);\n\n // Bail if no target area was found.\n if (!target) {\n return { zone: 'invalid', target: null };\n }\n\n // Return the whole tab area when in single document mode.\n if (panel.mode === 'single-document') {\n return { zone: 'widget-all', target };\n }\n\n // Compute the distance to each edge of the tab area.\n let al = target.x - target.left + 1;\n let at = target.y - target.top + 1;\n let ar = target.left + target.width - target.x;\n let ab = target.top + target.height - target.y;\n\n const tabHeight = target.tabBar.node.getBoundingClientRect().height;\n if (at < tabHeight) {\n return { zone: 'widget-tab', target };\n }\n\n // Get the X and Y edge sizes for the area.\n let rx = Math.round(target.width / 3);\n let ry = Math.round(target.height / 3);\n\n // If the mouse is not within an edge, indicate the entire area.\n if (al > rx && ar > rx && at > ry && ab > ry) {\n return { zone: 'widget-all', target };\n }\n\n // Scale the distances by the slenderness ratio.\n al /= rx;\n at /= ry;\n ar /= rx;\n ab /= ry;\n\n // Find the minimum distance to the area edge.\n let ad = Math.min(al, at, ar, ab);\n\n // Find the widget zone for the area edge.\n let zone: DropZone;\n switch (ad) {\n case al:\n zone = 'widget-left';\n break;\n case at:\n zone = 'widget-top';\n break;\n case ar:\n zone = 'widget-right';\n break;\n case ab:\n zone = 'widget-bottom';\n break;\n default:\n throw 'unreachable';\n }\n\n // Return the final drop target.\n return { zone, target };\n }\n\n /**\n * Get the drop reference widget for a tab bar.\n */\n export function getDropRef(tabBar: TabBar): Widget | null {\n if (tabBar.titles.length === 0) {\n return null;\n }\n if (tabBar.currentTitle) {\n return tabBar.currentTitle.owner;\n }\n return tabBar.titles[tabBar.titles.length - 1].owner;\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { AttachedProperty } from '@lumino/properties';\n\nimport { BoxEngine, BoxSizer } from './boxengine';\n\nimport { Layout, LayoutItem } from './layout';\n\nimport { Widget } from './widget';\n\n/**\n * A layout which arranges its widgets in a grid.\n */\nexport class GridLayout extends Layout {\n /**\n * Construct a new grid layout.\n *\n * @param options - The options for initializing the layout.\n */\n constructor(options: GridLayout.IOptions = {}) {\n super(options);\n if (options.rowCount !== undefined) {\n Private.reallocSizers(this._rowSizers, options.rowCount);\n }\n if (options.columnCount !== undefined) {\n Private.reallocSizers(this._columnSizers, options.columnCount);\n }\n if (options.rowSpacing !== undefined) {\n this._rowSpacing = Private.clampValue(options.rowSpacing);\n }\n if (options.columnSpacing !== undefined) {\n this._columnSpacing = Private.clampValue(options.columnSpacing);\n }\n }\n\n /**\n * Dispose of the resources held by the layout.\n */\n dispose(): void {\n // Dispose of the widgets and layout items.\n for (const item of this._items) {\n let widget = item.widget;\n item.dispose();\n widget.dispose();\n }\n\n // Clear the layout state.\n this._box = null;\n this._items.length = 0;\n this._rowStarts.length = 0;\n this._rowSizers.length = 0;\n this._columnStarts.length = 0;\n this._columnSizers.length = 0;\n\n // Dispose of the rest of the layout.\n super.dispose();\n }\n\n /**\n * Get the number of rows in the layout.\n */\n get rowCount(): number {\n return this._rowSizers.length;\n }\n\n /**\n * Set the number of rows in the layout.\n *\n * #### Notes\n * The minimum row count is `1`.\n */\n set rowCount(value: number) {\n // Do nothing if the row count does not change.\n if (value === this.rowCount) {\n return;\n }\n\n // Reallocate the row sizers.\n Private.reallocSizers(this._rowSizers, value);\n\n // Schedule a fit of the parent.\n if (this.parent) {\n this.parent.fit();\n }\n }\n\n /**\n * Get the number of columns in the layout.\n */\n get columnCount(): number {\n return this._columnSizers.length;\n }\n\n /**\n * Set the number of columns in the layout.\n *\n * #### Notes\n * The minimum column count is `1`.\n */\n set columnCount(value: number) {\n // Do nothing if the column count does not change.\n if (value === this.columnCount) {\n return;\n }\n\n // Reallocate the column sizers.\n Private.reallocSizers(this._columnSizers, value);\n\n // Schedule a fit of the parent.\n if (this.parent) {\n this.parent.fit();\n }\n }\n\n /**\n * Get the row spacing for the layout.\n */\n get rowSpacing(): number {\n return this._rowSpacing;\n }\n\n /**\n * Set the row spacing for the layout.\n */\n set rowSpacing(value: number) {\n // Clamp the spacing to the allowed range.\n value = Private.clampValue(value);\n\n // Bail if the spacing does not change\n if (this._rowSpacing === value) {\n return;\n }\n\n // Update the internal spacing.\n this._rowSpacing = value;\n\n // Schedule a fit of the parent.\n if (this.parent) {\n this.parent.fit();\n }\n }\n\n /**\n * Get the column spacing for the layout.\n */\n get columnSpacing(): number {\n return this._columnSpacing;\n }\n\n /**\n * Set the col spacing for the layout.\n */\n set columnSpacing(value: number) {\n // Clamp the spacing to the allowed range.\n value = Private.clampValue(value);\n\n // Bail if the spacing does not change\n if (this._columnSpacing === value) {\n return;\n }\n\n // Update the internal spacing.\n this._columnSpacing = value;\n\n // Schedule a fit of the parent.\n if (this.parent) {\n this.parent.fit();\n }\n }\n\n /**\n * Get the stretch factor for a specific row.\n *\n * @param index - The row index of interest.\n *\n * @returns The stretch factor for the row.\n *\n * #### Notes\n * This returns `-1` if the index is out of range.\n */\n rowStretch(index: number): number {\n let sizer = this._rowSizers[index];\n return sizer ? sizer.stretch : -1;\n }\n\n /**\n * Set the stretch factor for a specific row.\n *\n * @param index - The row index of interest.\n *\n * @param value - The stretch factor for the row.\n *\n * #### Notes\n * This is a no-op if the index is out of range.\n */\n setRowStretch(index: number, value: number): void {\n // Look up the row sizer.\n let sizer = this._rowSizers[index];\n\n // Bail if the index is out of range.\n if (!sizer) {\n return;\n }\n\n // Clamp the value to the allowed range.\n value = Private.clampValue(value);\n\n // Bail if the stretch does not change.\n if (sizer.stretch === value) {\n return;\n }\n\n // Update the sizer stretch.\n sizer.stretch = value;\n\n // Schedule an update of the parent.\n if (this.parent) {\n this.parent.update();\n }\n }\n\n /**\n * Get the stretch factor for a specific column.\n *\n * @param index - The column index of interest.\n *\n * @returns The stretch factor for the column.\n *\n * #### Notes\n * This returns `-1` if the index is out of range.\n */\n columnStretch(index: number): number {\n let sizer = this._columnSizers[index];\n return sizer ? sizer.stretch : -1;\n }\n\n /**\n * Set the stretch factor for a specific column.\n *\n * @param index - The column index of interest.\n *\n * @param value - The stretch factor for the column.\n *\n * #### Notes\n * This is a no-op if the index is out of range.\n */\n setColumnStretch(index: number, value: number): void {\n // Look up the column sizer.\n let sizer = this._columnSizers[index];\n\n // Bail if the index is out of range.\n if (!sizer) {\n return;\n }\n\n // Clamp the value to the allowed range.\n value = Private.clampValue(value);\n\n // Bail if the stretch does not change.\n if (sizer.stretch === value) {\n return;\n }\n\n // Update the sizer stretch.\n sizer.stretch = value;\n\n // Schedule an update of the parent.\n if (this.parent) {\n this.parent.update();\n }\n }\n\n /**\n * Create an iterator over the widgets in the layout.\n *\n * @returns A new iterator over the widgets in the layout.\n */\n *[Symbol.iterator](): IterableIterator {\n for (const item of this._items) {\n yield item.widget;\n }\n }\n\n /**\n * Add a widget to the grid layout.\n *\n * @param widget - The widget to add to the layout.\n *\n * #### Notes\n * If the widget is already contained in the layout, this is no-op.\n */\n addWidget(widget: Widget): void {\n // Look up the index for the widget.\n let i = ArrayExt.findFirstIndex(this._items, it => it.widget === widget);\n\n // Bail if the widget is already in the layout.\n if (i !== -1) {\n return;\n }\n\n // Add the widget to the layout.\n this._items.push(new LayoutItem(widget));\n\n // Attach the widget to the parent.\n if (this.parent) {\n this.attachWidget(widget);\n }\n }\n\n /**\n * Remove a widget from the grid layout.\n *\n * @param widget - The widget to remove from the layout.\n *\n * #### Notes\n * A widget is automatically removed from the layout when its `parent`\n * is set to `null`. This method should only be invoked directly when\n * removing a widget from a layout which has yet to be installed on a\n * parent widget.\n *\n * This method does *not* modify the widget's `parent`.\n */\n removeWidget(widget: Widget): void {\n // Look up the index for the widget.\n let i = ArrayExt.findFirstIndex(this._items, it => it.widget === widget);\n\n // Bail if the widget is not in the layout.\n if (i === -1) {\n return;\n }\n\n // Remove the widget from the layout.\n let item = ArrayExt.removeAt(this._items, i)!;\n\n // Detach the widget from the parent.\n if (this.parent) {\n this.detachWidget(widget);\n }\n\n // Dispose the layout item.\n item.dispose();\n }\n\n /**\n * Perform layout initialization which requires the parent widget.\n */\n protected init(): void {\n super.init();\n for (const widget of this) {\n this.attachWidget(widget);\n }\n }\n\n /**\n * Attach a widget to the parent's DOM node.\n *\n * @param widget - The widget to attach to the parent.\n */\n protected attachWidget(widget: Widget): void {\n // Send a `'before-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n }\n\n // Add the widget's node to the parent.\n this.parent!.node.appendChild(widget.node);\n\n // Send an `'after-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n\n // Post a fit request for the parent widget.\n this.parent!.fit();\n }\n\n /**\n * Detach a widget from the parent's DOM node.\n *\n * @param widget - The widget to detach from the parent.\n */\n protected detachWidget(widget: Widget): void {\n // Send a `'before-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n }\n\n // Remove the widget's node from the parent.\n this.parent!.node.removeChild(widget.node);\n\n // Send an `'after-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n\n // Post a fit request for the parent widget.\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'before-show'` message.\n */\n protected onBeforeShow(msg: Message): void {\n super.onBeforeShow(msg);\n this.parent!.update();\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n super.onBeforeAttach(msg);\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-shown'` message.\n */\n protected onChildShown(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-hidden'` message.\n */\n protected onChildHidden(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'resize'` message.\n */\n protected onResize(msg: Widget.ResizeMessage): void {\n if (this.parent!.isVisible) {\n this._update(msg.width, msg.height);\n }\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n protected onUpdateRequest(msg: Message): void {\n if (this.parent!.isVisible) {\n this._update(-1, -1);\n }\n }\n\n /**\n * A message handler invoked on a `'fit-request'` message.\n */\n protected onFitRequest(msg: Message): void {\n if (this.parent!.isAttached) {\n this._fit();\n }\n }\n\n /**\n * Fit the layout to the total size required by the widgets.\n */\n private _fit(): void {\n // Reset the min sizes of the sizers.\n for (let i = 0, n = this.rowCount; i < n; ++i) {\n this._rowSizers[i].minSize = 0;\n }\n for (let i = 0, n = this.columnCount; i < n; ++i) {\n this._columnSizers[i].minSize = 0;\n }\n\n // Filter for the visible layout items.\n let items = this._items.filter(it => !it.isHidden);\n\n // Fit the layout items.\n for (let i = 0, n = items.length; i < n; ++i) {\n items[i].fit();\n }\n\n // Get the max row and column index.\n let maxRow = this.rowCount - 1;\n let maxCol = this.columnCount - 1;\n\n // Sort the items by row span.\n items.sort(Private.rowSpanCmp);\n\n // Update the min sizes of the row sizers.\n for (let i = 0, n = items.length; i < n; ++i) {\n // Fetch the item.\n let item = items[i];\n\n // Get the row bounds for the item.\n let config = GridLayout.getCellConfig(item.widget);\n let r1 = Math.min(config.row, maxRow);\n let r2 = Math.min(config.row + config.rowSpan - 1, maxRow);\n\n // Distribute the minimum height to the sizers as needed.\n Private.distributeMin(this._rowSizers, r1, r2, item.minHeight);\n }\n\n // Sort the items by column span.\n items.sort(Private.columnSpanCmp);\n\n // Update the min sizes of the column sizers.\n for (let i = 0, n = items.length; i < n; ++i) {\n // Fetch the item.\n let item = items[i];\n\n // Get the column bounds for the item.\n let config = GridLayout.getCellConfig(item.widget);\n let c1 = Math.min(config.column, maxCol);\n let c2 = Math.min(config.column + config.columnSpan - 1, maxCol);\n\n // Distribute the minimum width to the sizers as needed.\n Private.distributeMin(this._columnSizers, c1, c2, item.minWidth);\n }\n\n // If no size constraint is needed, just update the parent.\n if (this.fitPolicy === 'set-no-constraint') {\n MessageLoop.sendMessage(this.parent!, Widget.Msg.UpdateRequest);\n return;\n }\n\n // Set up the computed min size.\n let minH = maxRow * this._rowSpacing;\n let minW = maxCol * this._columnSpacing;\n\n // Add the sizer minimums to the computed min size.\n for (let i = 0, n = this.rowCount; i < n; ++i) {\n minH += this._rowSizers[i].minSize;\n }\n for (let i = 0, n = this.columnCount; i < n; ++i) {\n minW += this._columnSizers[i].minSize;\n }\n\n // Update the box sizing and add it to the computed min size.\n let box = (this._box = ElementExt.boxSizing(this.parent!.node));\n minW += box.horizontalSum;\n minH += box.verticalSum;\n\n // Update the parent's min size constraints.\n let style = this.parent!.node.style;\n style.minWidth = `${minW}px`;\n style.minHeight = `${minH}px`;\n\n // Set the dirty flag to ensure only a single update occurs.\n this._dirty = true;\n\n // Notify the ancestor that it should fit immediately. This may\n // cause a resize of the parent, fulfilling the required update.\n if (this.parent!.parent) {\n MessageLoop.sendMessage(this.parent!.parent!, Widget.Msg.FitRequest);\n }\n\n // If the dirty flag is still set, the parent was not resized.\n // Trigger the required update on the parent widget immediately.\n if (this._dirty) {\n MessageLoop.sendMessage(this.parent!, Widget.Msg.UpdateRequest);\n }\n }\n\n /**\n * Update the layout position and size of the widgets.\n *\n * The parent offset dimensions should be `-1` if unknown.\n */\n private _update(offsetWidth: number, offsetHeight: number): void {\n // Clear the dirty flag to indicate the update occurred.\n this._dirty = false;\n\n // Measure the parent if the offset dimensions are unknown.\n if (offsetWidth < 0) {\n offsetWidth = this.parent!.node.offsetWidth;\n }\n if (offsetHeight < 0) {\n offsetHeight = this.parent!.node.offsetHeight;\n }\n\n // Ensure the parent box sizing data is computed.\n if (!this._box) {\n this._box = ElementExt.boxSizing(this.parent!.node);\n }\n\n // Compute the layout area adjusted for border and padding.\n let top = this._box.paddingTop;\n let left = this._box.paddingLeft;\n let width = offsetWidth - this._box.horizontalSum;\n let height = offsetHeight - this._box.verticalSum;\n\n // Get the max row and column index.\n let maxRow = this.rowCount - 1;\n let maxCol = this.columnCount - 1;\n\n // Compute the total fixed row and column space.\n let fixedRowSpace = maxRow * this._rowSpacing;\n let fixedColSpace = maxCol * this._columnSpacing;\n\n // Distribute the available space to the box sizers.\n BoxEngine.calc(this._rowSizers, Math.max(0, height - fixedRowSpace));\n BoxEngine.calc(this._columnSizers, Math.max(0, width - fixedColSpace));\n\n // Update the row start positions.\n for (let i = 0, pos = top, n = this.rowCount; i < n; ++i) {\n this._rowStarts[i] = pos;\n pos += this._rowSizers[i].size + this._rowSpacing;\n }\n\n // Update the column start positions.\n for (let i = 0, pos = left, n = this.columnCount; i < n; ++i) {\n this._columnStarts[i] = pos;\n pos += this._columnSizers[i].size + this._columnSpacing;\n }\n\n // Update the geometry of the layout items.\n for (let i = 0, n = this._items.length; i < n; ++i) {\n // Fetch the item.\n let item = this._items[i];\n\n // Ignore hidden items.\n if (item.isHidden) {\n continue;\n }\n\n // Fetch the cell bounds for the widget.\n let config = GridLayout.getCellConfig(item.widget);\n let r1 = Math.min(config.row, maxRow);\n let c1 = Math.min(config.column, maxCol);\n let r2 = Math.min(config.row + config.rowSpan - 1, maxRow);\n let c2 = Math.min(config.column + config.columnSpan - 1, maxCol);\n\n // Compute the cell geometry.\n let x = this._columnStarts[c1];\n let y = this._rowStarts[r1];\n let w = this._columnStarts[c2] + this._columnSizers[c2].size - x;\n let h = this._rowStarts[r2] + this._rowSizers[r2].size - y;\n\n // Update the geometry of the layout item.\n item.update(x, y, w, h);\n }\n }\n\n private _dirty = false;\n private _rowSpacing = 4;\n private _columnSpacing = 4;\n private _items: LayoutItem[] = [];\n private _rowStarts: number[] = [];\n private _columnStarts: number[] = [];\n private _rowSizers: BoxSizer[] = [new BoxSizer()];\n private _columnSizers: BoxSizer[] = [new BoxSizer()];\n private _box: ElementExt.IBoxSizing | null = null;\n}\n\n/**\n * The namespace for the `GridLayout` class statics.\n */\nexport namespace GridLayout {\n /**\n * An options object for initializing a grid layout.\n */\n export interface IOptions extends Layout.IOptions {\n /**\n * The initial row count for the layout.\n *\n * The default is `1`.\n */\n rowCount?: number;\n\n /**\n * The initial column count for the layout.\n *\n * The default is `1`.\n */\n columnCount?: number;\n\n /**\n * The spacing between rows in the layout.\n *\n * The default is `4`.\n */\n rowSpacing?: number;\n\n /**\n * The spacing between columns in the layout.\n *\n * The default is `4`.\n */\n columnSpacing?: number;\n }\n\n /**\n * An object which holds the cell configuration for a widget.\n */\n export interface ICellConfig {\n /**\n * The row index for the widget.\n */\n readonly row: number;\n\n /**\n * The column index for the widget.\n */\n readonly column: number;\n\n /**\n * The row span for the widget.\n */\n readonly rowSpan: number;\n\n /**\n * The column span for the widget.\n */\n readonly columnSpan: number;\n }\n\n /**\n * Get the cell config for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The cell config for the widget.\n */\n export function getCellConfig(widget: Widget): ICellConfig {\n return Private.cellConfigProperty.get(widget);\n }\n\n /**\n * Set the cell config for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the cell config.\n */\n export function setCellConfig(\n widget: Widget,\n value: Partial\n ): void {\n Private.cellConfigProperty.set(widget, Private.normalizeConfig(value));\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * The property descriptor for the widget cell config.\n */\n export const cellConfigProperty = new AttachedProperty<\n Widget,\n GridLayout.ICellConfig\n >({\n name: 'cellConfig',\n create: () => ({ row: 0, column: 0, rowSpan: 1, columnSpan: 1 }),\n changed: onChildCellConfigChanged\n });\n\n /**\n * Normalize a partial cell config object.\n */\n export function normalizeConfig(\n config: Partial\n ): GridLayout.ICellConfig {\n let row = Math.max(0, Math.floor(config.row || 0));\n let column = Math.max(0, Math.floor(config.column || 0));\n let rowSpan = Math.max(1, Math.floor(config.rowSpan || 0));\n let columnSpan = Math.max(1, Math.floor(config.columnSpan || 0));\n return { row, column, rowSpan, columnSpan };\n }\n\n /**\n * Clamp a value to an integer >= 0.\n */\n export function clampValue(value: number): number {\n return Math.max(0, Math.floor(value));\n }\n\n /**\n * A sort comparison function for row spans.\n */\n export function rowSpanCmp(a: LayoutItem, b: LayoutItem): number {\n let c1 = cellConfigProperty.get(a.widget);\n let c2 = cellConfigProperty.get(b.widget);\n return c1.rowSpan - c2.rowSpan;\n }\n\n /**\n * A sort comparison function for column spans.\n */\n export function columnSpanCmp(a: LayoutItem, b: LayoutItem): number {\n let c1 = cellConfigProperty.get(a.widget);\n let c2 = cellConfigProperty.get(b.widget);\n return c1.columnSpan - c2.columnSpan;\n }\n\n /**\n * Reallocate the box sizers for the given grid dimensions.\n */\n export function reallocSizers(sizers: BoxSizer[], count: number): void {\n // Coerce the count to the valid range.\n count = Math.max(1, Math.floor(count));\n\n // Add the missing sizers.\n while (sizers.length < count) {\n sizers.push(new BoxSizer());\n }\n\n // Remove the extra sizers.\n if (sizers.length > count) {\n sizers.length = count;\n }\n }\n\n /**\n * Distribute a min size constraint across a range of sizers.\n */\n export function distributeMin(\n sizers: BoxSizer[],\n i1: number,\n i2: number,\n minSize: number\n ): void {\n // Sanity check the indices.\n if (i2 < i1) {\n return;\n }\n\n // Handle the simple case of no cell span.\n if (i1 === i2) {\n let sizer = sizers[i1];\n sizer.minSize = Math.max(sizer.minSize, minSize);\n return;\n }\n\n // Compute the total current min size of the span.\n let totalMin = 0;\n for (let i = i1; i <= i2; ++i) {\n totalMin += sizers[i].minSize;\n }\n\n // Do nothing if the total is greater than the required.\n if (totalMin >= minSize) {\n return;\n }\n\n // Compute the portion of the space to allocate to each sizer.\n let portion = (minSize - totalMin) / (i2 - i1 + 1);\n\n // Add the portion to each sizer.\n for (let i = i1; i <= i2; ++i) {\n sizers[i].minSize += portion;\n }\n }\n\n /**\n * The change handler for the child cell config property.\n */\n function onChildCellConfigChanged(child: Widget): void {\n if (child.parent && child.parent.layout instanceof GridLayout) {\n child.parent.fit();\n }\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { getKeyboardLayout } from '@lumino/keyboard';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { CommandRegistry } from '@lumino/commands';\n\nimport {\n ElementARIAAttrs,\n ElementDataset,\n h,\n VirtualDOM,\n VirtualElement\n} from '@lumino/virtualdom';\n\nimport { Menu } from './menu';\n\nimport { Title } from './title';\n\nimport { Widget } from './widget';\n\n/**\n * A widget which displays menus as a canonical menu bar.\n *\n * #### Notes\n * See also the related [example](../../examples/menubar/index.html) and\n * its [source](https://github.com/jupyterlab/lumino/tree/main/examples/example-menubar).\n */\nexport class MenuBar extends Widget {\n /**\n * Construct a new menu bar.\n *\n * @param options - The options for initializing the menu bar.\n */\n constructor(options: MenuBar.IOptions = {}) {\n super({ node: Private.createNode() });\n this.addClass('lm-MenuBar');\n this.setFlag(Widget.Flag.DisallowLayout);\n this.renderer = options.renderer || MenuBar.defaultRenderer;\n this._forceItemsPosition = options.forceItemsPosition || {\n forceX: true,\n forceY: true\n };\n this._overflowMenuOptions = options.overflowMenuOptions || {\n isVisible: true\n };\n }\n\n /**\n * Dispose of the resources held by the widget.\n */\n dispose(): void {\n this._closeChildMenu();\n this._menus.length = 0;\n super.dispose();\n }\n\n /**\n * The renderer used by the menu bar.\n */\n readonly renderer: MenuBar.IRenderer;\n\n /**\n * The child menu of the menu bar.\n *\n * #### Notes\n * This will be `null` if the menu bar does not have an open menu.\n */\n get childMenu(): Menu | null {\n return this._childMenu;\n }\n\n /**\n * The overflow index of the menu bar.\n */\n get overflowIndex(): number {\n return this._overflowIndex;\n }\n\n /**\n * The overflow menu of the menu bar.\n */\n get overflowMenu(): Menu | null {\n return this._overflowMenu;\n }\n\n /**\n * Get the menu bar content node.\n *\n * #### Notes\n * This is the node which holds the menu title nodes.\n *\n * Modifying this node directly can lead to undefined behavior.\n */\n get contentNode(): HTMLUListElement {\n return this.node.getElementsByClassName(\n 'lm-MenuBar-content'\n )[0] as HTMLUListElement;\n }\n\n /**\n * Get the currently active menu.\n */\n get activeMenu(): Menu | null {\n return this._menus[this._activeIndex] || null;\n }\n\n /**\n * Set the currently active menu.\n *\n * #### Notes\n * If the menu does not exist, the menu will be set to `null`.\n */\n set activeMenu(value: Menu | null) {\n this.activeIndex = value ? this._menus.indexOf(value) : -1;\n }\n\n /**\n * Get the index of the currently active menu.\n *\n * #### Notes\n * This will be `-1` if no menu is active.\n */\n get activeIndex(): number {\n return this._activeIndex;\n }\n\n /**\n * Set the index of the currently active menu.\n *\n * #### Notes\n * If the menu cannot be activated, the index will be set to `-1`.\n */\n set activeIndex(value: number) {\n // Adjust the value for an out of range index.\n if (value < 0 || value >= this._menus.length) {\n value = -1;\n }\n\n // An empty menu cannot be active\n if (value > -1 && this._menus[value].items.length === 0) {\n value = -1;\n }\n\n // Bail early if the index will not change.\n if (this._activeIndex === value) {\n return;\n }\n\n // Update the active index.\n this._activeIndex = value;\n\n // Schedule an update of the items.\n this.update();\n }\n\n /**\n * A read-only array of the menus in the menu bar.\n */\n get menus(): ReadonlyArray {\n return this._menus;\n }\n\n /**\n * Open the active menu and activate its first menu item.\n *\n * #### Notes\n * If there is no active menu, this is a no-op.\n */\n openActiveMenu(): void {\n // Bail early if there is no active item.\n if (this._activeIndex === -1) {\n return;\n }\n\n // Open the child menu.\n this._openChildMenu();\n\n // Activate the first item in the child menu.\n if (this._childMenu) {\n this._childMenu.activeIndex = -1;\n this._childMenu.activateNextItem();\n }\n }\n\n /**\n * Add a menu to the end of the menu bar.\n *\n * @param menu - The menu to add to the menu bar.\n *\n * #### Notes\n * If the menu is already added to the menu bar, it will be moved.\n */\n addMenu(menu: Menu, update: boolean = true): void {\n this.insertMenu(this._menus.length, menu, update);\n }\n\n /**\n * Insert a menu into the menu bar at the specified index.\n *\n * @param index - The index at which to insert the menu.\n *\n * @param menu - The menu to insert into the menu bar.\n *\n * #### Notes\n * The index will be clamped to the bounds of the menus.\n *\n * If the menu is already added to the menu bar, it will be moved.\n */\n insertMenu(index: number, menu: Menu, update: boolean = true): void {\n // Close the child menu before making changes.\n this._closeChildMenu();\n\n // Look up the index of the menu.\n let i = this._menus.indexOf(menu);\n\n // Clamp the insert index to the array bounds.\n let j = Math.max(0, Math.min(index, this._menus.length));\n\n // If the menu is not in the array, insert it.\n if (i === -1) {\n // Insert the menu into the array.\n ArrayExt.insert(this._menus, j, menu);\n\n // Add the styling class to the menu.\n menu.addClass('lm-MenuBar-menu');\n\n // Connect to the menu signals.\n menu.aboutToClose.connect(this._onMenuAboutToClose, this);\n menu.menuRequested.connect(this._onMenuMenuRequested, this);\n menu.title.changed.connect(this._onTitleChanged, this);\n\n // Schedule an update of the items.\n if (update) {\n this.update();\n }\n\n // There is nothing more to do.\n return;\n }\n\n // Otherwise, the menu exists in the array and should be moved.\n\n // Adjust the index if the location is at the end of the array.\n if (j === this._menus.length) {\n j--;\n }\n\n // Bail if there is no effective move.\n if (i === j) {\n return;\n }\n\n // Move the menu to the new locations.\n ArrayExt.move(this._menus, i, j);\n\n // Schedule an update of the items.\n if (update) {\n this.update();\n }\n }\n\n /**\n * Remove a menu from the menu bar.\n *\n * @param menu - The menu to remove from the menu bar.\n *\n * #### Notes\n * This is a no-op if the menu is not in the menu bar.\n */\n removeMenu(menu: Menu, update: boolean = true): void {\n this.removeMenuAt(this._menus.indexOf(menu), update);\n }\n\n /**\n * Remove the menu at a given index from the menu bar.\n *\n * @param index - The index of the menu to remove.\n *\n * #### Notes\n * This is a no-op if the index is out of range.\n */\n removeMenuAt(index: number, update: boolean = true): void {\n // Close the child menu before making changes.\n this._closeChildMenu();\n\n // Remove the menu from the array.\n let menu = ArrayExt.removeAt(this._menus, index);\n\n // Bail if the index is out of range.\n if (!menu) {\n return;\n }\n\n // Disconnect from the menu signals.\n menu.aboutToClose.disconnect(this._onMenuAboutToClose, this);\n menu.menuRequested.disconnect(this._onMenuMenuRequested, this);\n menu.title.changed.disconnect(this._onTitleChanged, this);\n\n // Remove the styling class from the menu.\n menu.removeClass('lm-MenuBar-menu');\n\n // Schedule an update of the items.\n if (update) {\n this.update();\n }\n }\n\n /**\n * Remove all menus from the menu bar.\n */\n clearMenus(): void {\n // Bail if there is nothing to remove.\n if (this._menus.length === 0) {\n return;\n }\n\n // Close the child menu before making changes.\n this._closeChildMenu();\n\n // Disconnect from the menu signals and remove the styling class.\n for (let menu of this._menus) {\n menu.aboutToClose.disconnect(this._onMenuAboutToClose, this);\n menu.menuRequested.disconnect(this._onMenuMenuRequested, this);\n menu.title.changed.disconnect(this._onTitleChanged, this);\n menu.removeClass('lm-MenuBar-menu');\n }\n\n // Clear the menus array.\n this._menus.length = 0;\n\n // Schedule an update of the items.\n this.update();\n }\n\n /**\n * Handle the DOM events for the menu bar.\n *\n * @param event - The DOM event sent to the menu bar.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the menu bar's DOM nodes. It\n * should not be called directly by user code.\n */\n handleEvent(event: Event): void {\n switch (event.type) {\n case 'keydown':\n this._evtKeyDown(event as KeyboardEvent);\n break;\n case 'mousedown':\n this._evtMouseDown(event as MouseEvent);\n break;\n case 'mousemove':\n case 'mouseleave':\n this._evtMouseMove(event as MouseEvent);\n break;\n case 'focusout':\n this._evtFocusOut(event as FocusEvent);\n break;\n case 'contextmenu':\n event.preventDefault();\n event.stopPropagation();\n break;\n }\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n this.node.addEventListener('keydown', this);\n this.node.addEventListener('mousedown', this);\n this.node.addEventListener('mousemove', this);\n this.node.addEventListener('mouseleave', this);\n this.node.addEventListener('focusout', this);\n this.node.addEventListener('contextmenu', this);\n }\n\n /**\n * A message handler invoked on an `'after-detach'` message.\n */\n protected onAfterDetach(msg: Message): void {\n this.node.removeEventListener('keydown', this);\n this.node.removeEventListener('mousedown', this);\n this.node.removeEventListener('mousemove', this);\n this.node.removeEventListener('mouseleave', this);\n this.node.removeEventListener('focusout', this);\n this.node.removeEventListener('contextmenu', this);\n this._closeChildMenu();\n }\n\n /**\n * A message handler invoked on an `'activate-request'` message.\n */\n protected onActivateRequest(msg: Message): void {\n if (this.isAttached) {\n this._focusItemAt(0);\n }\n }\n\n /**\n * A message handler invoked on a `'resize'` message.\n */\n protected onResize(msg: Widget.ResizeMessage): void {\n this.update();\n super.onResize(msg);\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n protected onUpdateRequest(msg: Message): void {\n let menus = this._menus;\n let renderer = this.renderer;\n let activeIndex = this._activeIndex;\n let tabFocusIndex =\n this._tabFocusIndex >= 0 && this._tabFocusIndex < menus.length\n ? this._tabFocusIndex\n : 0;\n let length = this._overflowIndex > -1 ? this._overflowIndex : menus.length;\n let totalMenuSize = 0;\n let isVisible = false;\n\n // Check that the overflow menu doesn't count\n length = this._overflowMenu !== null ? length - 1 : length;\n let content = new Array(length);\n\n // Render visible menus\n for (let i = 0; i < length; ++i) {\n content[i] = renderer.renderItem({\n title: menus[i].title,\n active: i === activeIndex,\n tabbable: i === tabFocusIndex,\n disabled: menus[i].items.length === 0,\n onfocus: () => {\n this._tabFocusIndex = i;\n this.activeIndex = i;\n }\n });\n // Calculate size of current menu\n totalMenuSize += this._menuItemSizes[i];\n // Check if overflow menu is already rendered\n if (menus[i].title.label === this._overflowMenuOptions.title) {\n isVisible = true;\n length--;\n }\n }\n // Render overflow menu if needed and active\n if (this._overflowMenuOptions.isVisible) {\n if (this._overflowIndex > -1 && !isVisible) {\n // Create overflow menu\n if (this._overflowMenu === null) {\n const overflowMenuTitle = this._overflowMenuOptions.title ?? '...';\n this._overflowMenu = new Menu({ commands: new CommandRegistry() });\n this._overflowMenu.title.label = overflowMenuTitle;\n this._overflowMenu.title.mnemonic = 0;\n this.addMenu(this._overflowMenu, false);\n }\n // Move menus to overflow menu\n for (let i = menus.length - 2; i >= length; i--) {\n const submenu = this.menus[i];\n submenu.title.mnemonic = 0;\n this._overflowMenu.insertItem(0, {\n type: 'submenu',\n submenu: submenu\n });\n this.removeMenu(submenu, false);\n }\n content[length] = renderer.renderItem({\n title: this._overflowMenu.title,\n active: length === activeIndex && menus[length].items.length !== 0,\n tabbable: length === tabFocusIndex,\n disabled: menus[length].items.length === 0,\n onfocus: () => {\n this._tabFocusIndex = length;\n this.activeIndex = length;\n }\n });\n length++;\n } else if (this._overflowMenu !== null) {\n // Remove submenus from overflow menu\n let overflowMenuItems = this._overflowMenu.items;\n let screenSize = this.node.offsetWidth;\n let n = this._overflowMenu.items.length;\n for (let i = 0; i < n; ++i) {\n let index = menus.length - 1 - i;\n if (screenSize - totalMenuSize > this._menuItemSizes[index]) {\n let menu = overflowMenuItems[0].submenu as Menu;\n this._overflowMenu.removeItemAt(0);\n this.insertMenu(length, menu, false);\n content[length] = renderer.renderItem({\n title: menu.title,\n active: false,\n tabbable: length === tabFocusIndex,\n disabled: menus[length].items.length === 0,\n onfocus: () => {\n this._tabFocusIndex = length;\n this.activeIndex = length;\n }\n });\n length++;\n }\n }\n if (this._overflowMenu.items.length === 0) {\n this.removeMenu(this._overflowMenu, false);\n content.pop();\n this._overflowMenu = null;\n this._overflowIndex = -1;\n }\n }\n }\n VirtualDOM.render(content, this.contentNode);\n this._updateOverflowIndex();\n }\n\n /**\n * Calculate and update the current overflow index.\n */\n private _updateOverflowIndex(): void {\n if (!this._overflowMenuOptions.isVisible) {\n return;\n }\n\n // Get elements visible in the main menu bar\n const itemMenus = this.contentNode.childNodes;\n let screenSize = this.node.offsetWidth;\n let totalMenuSize = 0;\n let index = -1;\n let n = itemMenus.length;\n\n if (this._menuItemSizes.length == 0) {\n // Check if it is the first resize and get info about menu items sizes\n for (let i = 0; i < n; i++) {\n let item = itemMenus[i] as HTMLLIElement;\n // Add sizes to array\n totalMenuSize += item.offsetWidth;\n this._menuItemSizes.push(item.offsetWidth);\n if (totalMenuSize > screenSize && index === -1) {\n index = i;\n }\n }\n } else {\n // Calculate current menu size\n for (let i = 0; i < this._menuItemSizes.length; i++) {\n totalMenuSize += this._menuItemSizes[i];\n if (totalMenuSize > screenSize) {\n index = i;\n break;\n }\n }\n }\n this._overflowIndex = index;\n }\n\n /**\n * Handle the `'keydown'` event for the menu bar.\n *\n * #### Notes\n * All keys are trapped except the tab key that is ignored.\n */\n private _evtKeyDown(event: KeyboardEvent): void {\n // Fetch the key code for the event.\n let kc = event.keyCode;\n\n // Reset the active index on tab, but do not trap the tab key.\n if (kc === 9) {\n this.activeIndex = -1;\n return;\n }\n\n // A menu bar handles all other keydown events.\n event.preventDefault();\n event.stopPropagation();\n\n // Enter, Space, Up Arrow, Down Arrow\n if (kc === 13 || kc === 32 || kc === 38 || kc === 40) {\n // The active index may have changed (for example, user hovers over an\n // item with the mouse), so be sure to use the focus index.\n this.activeIndex = this._tabFocusIndex;\n if (this.activeIndex !== this._tabFocusIndex) {\n // Bail if the setter refused to set activeIndex to tabFocusIndex\n // because it means that the item at tabFocusIndex cannot be opened (for\n // example, it has an empty menu)\n return;\n }\n this.openActiveMenu();\n return;\n }\n\n // Escape\n if (kc === 27) {\n this._closeChildMenu();\n this._focusItemAt(this.activeIndex);\n return;\n }\n\n // Left or Right Arrow\n if (kc === 37 || kc === 39) {\n let direction = kc === 37 ? -1 : 1;\n let start = this._tabFocusIndex + direction;\n let n = this._menus.length;\n for (let i = 0; i < n; i++) {\n let index = (n + start + direction * i) % n;\n if (this._menus[index].items.length) {\n this._focusItemAt(index);\n return;\n }\n }\n return;\n }\n\n // Get the pressed key character.\n let key = getKeyboardLayout().keyForKeydownEvent(event);\n\n // Bail if the key is not valid.\n if (!key) {\n return;\n }\n\n // Search for the next best matching mnemonic item.\n let start = this._activeIndex + 1;\n let result = Private.findMnemonic(this._menus, key, start);\n\n // Handle the requested mnemonic based on the search results.\n // If exactly one mnemonic is matched, that menu is opened.\n // Otherwise, the next mnemonic is activated if available,\n // followed by the auto mnemonic if available.\n if (result.index !== -1 && !result.multiple) {\n this.activeIndex = result.index;\n this.openActiveMenu();\n } else if (result.index !== -1) {\n this.activeIndex = result.index;\n this._focusItemAt(this.activeIndex);\n } else if (result.auto !== -1) {\n this.activeIndex = result.auto;\n this._focusItemAt(this.activeIndex);\n }\n }\n\n /**\n * Handle the `'mousedown'` event for the menu bar.\n */\n private _evtMouseDown(event: MouseEvent): void {\n // Bail if the mouse press was not on the menu bar. This can occur\n // when the document listener is installed for an active menu bar.\n if (!ElementExt.hitTest(this.node, event.clientX, event.clientY)) {\n return;\n }\n\n // Stop the propagation of the event. Immediate propagation is\n // also stopped so that an open menu does not handle the event.\n event.stopPropagation();\n event.stopImmediatePropagation();\n\n // Check if the mouse is over one of the menu items.\n let index = ArrayExt.findFirstIndex(this.contentNode.children, node => {\n return ElementExt.hitTest(node, event.clientX, event.clientY);\n });\n\n // If the press was not on an item, close the child menu.\n if (index === -1) {\n this._closeChildMenu();\n return;\n }\n\n // If the press was not the left mouse button, do nothing further.\n if (event.button !== 0) {\n return;\n }\n\n // Otherwise, toggle the open state of the child menu.\n if (this._childMenu) {\n this._closeChildMenu();\n this.activeIndex = index;\n } else {\n // If we don't call preventDefault() here, then the item in the menu\n // bar will take focus over the menu that is being opened.\n event.preventDefault();\n const position = this._positionForMenu(index);\n Menu.saveWindowData();\n // Begin DOM modifications.\n this.activeIndex = index;\n this._openChildMenu(position);\n }\n }\n\n /**\n * Handle the `'mousemove'` event for the menu bar.\n */\n private _evtMouseMove(event: MouseEvent): void {\n // Check if the mouse is over one of the menu items.\n let index = ArrayExt.findFirstIndex(this.contentNode.children, node => {\n return ElementExt.hitTest(node, event.clientX, event.clientY);\n });\n\n // Bail early if the active index will not change.\n if (index === this._activeIndex) {\n return;\n }\n\n // Bail early if a child menu is open and the mouse is not over\n // an item. This allows the child menu to be kept open when the\n // mouse is over the empty part of the menu bar.\n if (index === -1 && this._childMenu) {\n return;\n }\n\n // Get position for the new menu >before< updating active index.\n const position =\n index >= 0 && this._childMenu ? this._positionForMenu(index) : null;\n\n // Before any modification, update window data.\n Menu.saveWindowData();\n\n // Begin DOM modifications.\n\n // Update the active index to the hovered item.\n this.activeIndex = index;\n\n // Open the new menu if a menu is already open.\n if (position) {\n this._openChildMenu(position);\n }\n }\n\n /**\n * Find initial position for the menu based on menubar item position.\n *\n * NOTE: this should be called before updating active index to avoid\n * an additional layout and style invalidation as changing active\n * index modifies DOM.\n */\n private _positionForMenu(index: number): Private.IPosition {\n let itemNode = this.contentNode.children[index];\n let { left, bottom } = (itemNode as HTMLElement).getBoundingClientRect();\n return {\n top: bottom,\n left\n };\n }\n\n /**\n * Handle the `'focusout'` event for the menu bar.\n */\n private _evtFocusOut(event: FocusEvent): void {\n // Reset the active index if there is no open menu and the menubar is losing focus.\n if (!this._childMenu && !this.node.contains(event.relatedTarget as Node)) {\n this.activeIndex = -1;\n }\n }\n\n /**\n * Focus an item in the menu bar.\n *\n * #### Notes\n * Does not open the associated menu.\n */\n private _focusItemAt(index: number): void {\n const itemNode = this.contentNode.childNodes[index] as HTMLElement | void;\n if (itemNode) {\n itemNode.focus();\n }\n }\n\n /**\n * Open the child menu at the active index immediately.\n *\n * If a different child menu is already open, it will be closed,\n * even if there is no active menu.\n */\n private _openChildMenu(options: { left?: number; top?: number } = {}): void {\n // If there is no active menu, close the current menu.\n let newMenu = this.activeMenu;\n if (!newMenu) {\n this._closeChildMenu();\n return;\n }\n\n // Bail if there is no effective menu change.\n let oldMenu = this._childMenu;\n if (oldMenu === newMenu) {\n return;\n }\n\n // Swap the internal menu reference.\n this._childMenu = newMenu;\n\n // Close the current menu, or setup for the new menu.\n if (oldMenu) {\n oldMenu.close();\n } else {\n document.addEventListener('mousedown', this, true);\n }\n\n // Update the tab focus index and ensure the menu bar is updated.\n this._tabFocusIndex = this.activeIndex;\n MessageLoop.sendMessage(this, Widget.Msg.UpdateRequest);\n\n // Get the positioning data for the new menu.\n let { left, top } = options;\n if (typeof left === 'undefined' || typeof top === 'undefined') {\n ({ left, top } = this._positionForMenu(this._activeIndex));\n }\n // Begin DOM modifications\n\n if (!oldMenu) {\n // Continue setup for new menu\n this.addClass('lm-mod-active');\n }\n\n // Open the new menu at the computed location.\n if (newMenu.items.length > 0) {\n newMenu.open(left, top, this._forceItemsPosition);\n }\n }\n\n /**\n * Close the child menu immediately.\n *\n * This is a no-op if a child menu is not open.\n */\n private _closeChildMenu(): void {\n // Bail if no child menu is open.\n if (!this._childMenu) {\n return;\n }\n // Remove the active class from the menu bar.\n this.removeClass('lm-mod-active');\n\n // Remove the document listeners.\n document.removeEventListener('mousedown', this, true);\n\n // Clear the internal menu reference.\n let menu = this._childMenu;\n this._childMenu = null;\n\n // Close the menu.\n menu.close();\n\n // Reset the active index.\n this.activeIndex = -1;\n }\n\n /**\n * Handle the `aboutToClose` signal of a menu.\n */\n private _onMenuAboutToClose(sender: Menu): void {\n // Bail if the sender is not the child menu.\n if (sender !== this._childMenu) {\n return;\n }\n\n // Remove the active class from the menu bar.\n this.removeClass('lm-mod-active');\n\n // Remove the document listeners.\n document.removeEventListener('mousedown', this, true);\n\n // Clear the internal menu reference.\n this._childMenu = null;\n\n // Reset the active index.\n this.activeIndex = -1;\n }\n\n /**\n * Handle the `menuRequested` signal of a child menu.\n */\n private _onMenuMenuRequested(sender: Menu, args: 'next' | 'previous'): void {\n // Bail if the sender is not the child menu.\n if (sender !== this._childMenu) {\n return;\n }\n\n // Look up the active index and menu count.\n let i = this._activeIndex;\n let n = this._menus.length;\n\n // Active the next requested index.\n switch (args) {\n case 'next':\n this.activeIndex = i === n - 1 ? 0 : i + 1;\n break;\n case 'previous':\n this.activeIndex = i === 0 ? n - 1 : i - 1;\n break;\n }\n\n // Open the active menu.\n this.openActiveMenu();\n }\n\n /**\n * Handle the `changed` signal of a title object.\n */\n private _onTitleChanged(): void {\n this.update();\n }\n\n // Track the index of the item that is currently focused or hovered. -1 means nothing focused or hovered.\n private _activeIndex = -1;\n // Track which item can be focused using the TAB key. Unlike _activeIndex will\n // always point to a menuitem. Whenever you update this value, it's important\n // to follow it with an \"update-request\" message so that the `tabindex`\n // attribute on each menubar item gets properly updated.\n private _tabFocusIndex = 0;\n private _forceItemsPosition: Menu.IOpenOptions;\n private _overflowMenuOptions: IOverflowMenuOptions;\n private _menus: Menu[] = [];\n private _childMenu: Menu | null = null;\n private _overflowMenu: Menu | null = null;\n private _menuItemSizes: number[] = [];\n private _overflowIndex: number = -1;\n}\n\n/**\n * The namespace for the `MenuBar` class statics.\n */\nexport namespace MenuBar {\n /**\n * An options object for creating a menu bar.\n */\n export interface IOptions {\n /**\n * A custom renderer for creating menu bar content.\n *\n * The default is a shared renderer instance.\n */\n renderer?: IRenderer;\n /**\n * Whether to force the position of the menu. The MenuBar forces the\n * coordinates of its menus by default. With this option you can disable it.\n *\n * Setting to `false` will enable the logic which repositions the\n * coordinates of the menu if it will not fit entirely on screen.\n *\n * The default is `true`.\n */\n forceItemsPosition?: Menu.IOpenOptions;\n /**\n * Whether to add a overflow menu if there's overflow.\n *\n * Setting to `true` will enable the logic that creates an overflow menu\n * to show the menu items that don't fit entirely on the screen.\n *\n * The default is `true`.\n */\n overflowMenuOptions?: IOverflowMenuOptions;\n }\n\n /**\n * An object which holds the data to render a menu bar item.\n */\n export interface IRenderData {\n /**\n * The title to be rendered.\n */\n readonly title: Title;\n\n /**\n * Whether the item is the active item.\n */\n readonly active: boolean;\n\n /**\n * Whether the user can tab to the item.\n */\n readonly tabbable: boolean;\n\n /**\n * Whether the item is disabled.\n *\n * #### Notes\n * A disabled item cannot be active.\n * A disabled item cannot be focussed.\n */\n readonly disabled?: boolean;\n\n readonly onfocus?: (event: FocusEvent) => void;\n }\n\n /**\n * A renderer for use with a menu bar.\n */\n export interface IRenderer {\n /**\n * Render the virtual element for a menu bar item.\n *\n * @param data - The data to use for rendering the item.\n *\n * @returns A virtual element representing the item.\n */\n renderItem(data: IRenderData): VirtualElement;\n }\n\n /**\n * The default implementation of `IRenderer`.\n *\n * #### Notes\n * Subclasses are free to reimplement rendering methods as needed.\n */\n export class Renderer implements IRenderer {\n /**\n * Render the virtual element for a menu bar item.\n *\n * @param data - The data to use for rendering the item.\n *\n * @returns A virtual element representing the item.\n */\n renderItem(data: IRenderData): VirtualElement {\n let className = this.createItemClass(data);\n let dataset = this.createItemDataset(data);\n let aria = this.createItemARIA(data);\n return h.li(\n {\n className,\n dataset,\n ...(data.disabled ? {} : { tabindex: data.tabbable ? '0' : '-1' }),\n onfocus: data.onfocus,\n ...aria\n },\n this.renderIcon(data),\n this.renderLabel(data)\n );\n }\n\n /**\n * Render the icon element for a menu bar item.\n *\n * @param data - The data to use for rendering the icon.\n *\n * @returns A virtual element representing the item icon.\n */\n renderIcon(data: IRenderData): VirtualElement {\n let className = this.createIconClass(data);\n\n // If data.title.icon is undefined, it will be ignored.\n return h.div({ className }, data.title.icon!, data.title.iconLabel);\n }\n\n /**\n * Render the label element for a menu item.\n *\n * @param data - The data to use for rendering the label.\n *\n * @returns A virtual element representing the item label.\n */\n renderLabel(data: IRenderData): VirtualElement {\n let content = this.formatLabel(data);\n return h.div({ className: 'lm-MenuBar-itemLabel' }, content);\n }\n\n /**\n * Create the class name for the menu bar item.\n *\n * @param data - The data to use for the class name.\n *\n * @returns The full class name for the menu item.\n */\n createItemClass(data: IRenderData): string {\n let name = 'lm-MenuBar-item';\n if (data.title.className) {\n name += ` ${data.title.className}`;\n }\n if (data.active && !data.disabled) {\n name += ' lm-mod-active';\n }\n return name;\n }\n\n /**\n * Create the dataset for a menu bar item.\n *\n * @param data - The data to use for the item.\n *\n * @returns The dataset for the menu bar item.\n */\n createItemDataset(data: IRenderData): ElementDataset {\n return data.title.dataset;\n }\n\n /**\n * Create the aria attributes for menu bar item.\n *\n * @param data - The data to use for the aria attributes.\n *\n * @returns The aria attributes object for the item.\n */\n createItemARIA(data: IRenderData): ElementARIAAttrs {\n return {\n role: 'menuitem',\n 'aria-haspopup': 'true',\n 'aria-disabled': data.disabled ? 'true' : 'false'\n };\n }\n\n /**\n * Create the class name for the menu bar item icon.\n *\n * @param data - The data to use for the class name.\n *\n * @returns The full class name for the item icon.\n */\n createIconClass(data: IRenderData): string {\n let name = 'lm-MenuBar-itemIcon';\n let extra = data.title.iconClass;\n return extra ? `${name} ${extra}` : name;\n }\n\n /**\n * Create the render content for the label node.\n *\n * @param data - The data to use for the label content.\n *\n * @returns The content to add to the label node.\n */\n formatLabel(data: IRenderData): h.Child {\n // Fetch the label text and mnemonic index.\n let { label, mnemonic } = data.title;\n\n // If the index is out of range, do not modify the label.\n if (mnemonic < 0 || mnemonic >= label.length) {\n return label;\n }\n\n // Split the label into parts.\n let prefix = label.slice(0, mnemonic);\n let suffix = label.slice(mnemonic + 1);\n let char = label[mnemonic];\n\n // Wrap the mnemonic character in a span.\n let span = h.span({ className: 'lm-MenuBar-itemMnemonic' }, char);\n\n // Return the content parts.\n return [prefix, span, suffix];\n }\n }\n\n /**\n * The default `Renderer` instance.\n */\n export const defaultRenderer = new Renderer();\n}\n\n/**\n * Options for overflow menu.\n */\nexport interface IOverflowMenuOptions {\n /**\n * Determines if a overflow menu appears when the menu items overflow.\n *\n * Defaults to `true`.\n */\n isVisible: boolean;\n /**\n * Determines the title of the overflow menu.\n *\n * Default: `...`.\n */\n title?: string;\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * Create the DOM node for a menu bar.\n */\n export function createNode(): HTMLDivElement {\n let node = document.createElement('div');\n let content = document.createElement('ul');\n content.className = 'lm-MenuBar-content';\n node.appendChild(content);\n content.setAttribute('role', 'menubar');\n return node;\n }\n\n /**\n * Position for the menu relative to top-left screen corner.\n */\n export interface IPosition {\n /**\n * Pixels right from screen origin.\n */\n left: number;\n /**\n * Pixels down from screen origin.\n */\n top: number;\n }\n\n /**\n * The results of a mnemonic search.\n */\n export interface IMnemonicResult {\n /**\n * The index of the first matching mnemonic item, or `-1`.\n */\n index: number;\n\n /**\n * Whether multiple mnemonic items matched.\n */\n multiple: boolean;\n\n /**\n * The index of the first auto matched non-mnemonic item.\n */\n auto: number;\n }\n\n /**\n * Find the best matching mnemonic item.\n *\n * The search starts at the given index and wraps around.\n */\n export function findMnemonic(\n menus: ReadonlyArray,\n key: string,\n start: number\n ): IMnemonicResult {\n // Setup the result variables.\n let index = -1;\n let auto = -1;\n let multiple = false;\n\n // Normalize the key to upper case.\n let upperKey = key.toUpperCase();\n\n // Search the items from the given start index.\n for (let i = 0, n = menus.length; i < n; ++i) {\n // Compute the wrapped index.\n let k = (i + start) % n;\n\n // Look up the menu title.\n let title = menus[k].title;\n\n // Ignore titles with an empty label.\n if (title.label.length === 0) {\n continue;\n }\n\n // Look up the mnemonic index for the label.\n let mn = title.mnemonic;\n\n // Handle a valid mnemonic index.\n if (mn >= 0 && mn < title.label.length) {\n if (title.label[mn].toUpperCase() === upperKey) {\n if (index === -1) {\n index = k;\n } else {\n multiple = true;\n }\n }\n continue;\n }\n\n // Finally, handle the auto index if possible.\n if (auto === -1 && title.label[0].toUpperCase() === upperKey) {\n auto = k;\n }\n }\n\n // Return the search results.\n return { index, multiple, auto };\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { IDisposable } from '@lumino/disposable';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Drag } from '@lumino/dragdrop';\n\nimport { Message } from '@lumino/messaging';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { Widget } from './widget';\n\n/**\n * A widget which implements a canonical scroll bar.\n */\nexport class ScrollBar extends Widget {\n /**\n * Construct a new scroll bar.\n *\n * @param options - The options for initializing the scroll bar.\n */\n constructor(options: ScrollBar.IOptions = {}) {\n super({ node: Private.createNode() });\n this.addClass('lm-ScrollBar');\n this.setFlag(Widget.Flag.DisallowLayout);\n\n // Set the orientation.\n this._orientation = options.orientation || 'vertical';\n this.dataset['orientation'] = this._orientation;\n\n // Parse the rest of the options.\n if (options.maximum !== undefined) {\n this._maximum = Math.max(0, options.maximum);\n }\n if (options.page !== undefined) {\n this._page = Math.max(0, options.page);\n }\n if (options.value !== undefined) {\n this._value = Math.max(0, Math.min(options.value, this._maximum));\n }\n }\n\n /**\n * A signal emitted when the user moves the scroll thumb.\n *\n * #### Notes\n * The payload is the current value of the scroll bar.\n */\n get thumbMoved(): ISignal {\n return this._thumbMoved;\n }\n\n /**\n * A signal emitted when the user clicks a step button.\n *\n * #### Notes\n * The payload is whether a decrease or increase is requested.\n */\n get stepRequested(): ISignal {\n return this._stepRequested;\n }\n\n /**\n * A signal emitted when the user clicks the scroll track.\n *\n * #### Notes\n * The payload is whether a decrease or increase is requested.\n */\n get pageRequested(): ISignal {\n return this._pageRequested;\n }\n\n /**\n * Get the orientation of the scroll bar.\n */\n get orientation(): ScrollBar.Orientation {\n return this._orientation;\n }\n\n /**\n * Set the orientation of the scroll bar.\n */\n set orientation(value: ScrollBar.Orientation) {\n // Do nothing if the orientation does not change.\n if (this._orientation === value) {\n return;\n }\n\n // Release the mouse before making changes.\n this._releaseMouse();\n\n // Update the internal orientation.\n this._orientation = value;\n this.dataset['orientation'] = value;\n\n // Schedule an update the scroll bar.\n this.update();\n }\n\n /**\n * Get the current value of the scroll bar.\n */\n get value(): number {\n return this._value;\n }\n\n /**\n * Set the current value of the scroll bar.\n *\n * #### Notes\n * The value will be clamped to the range `[0, maximum]`.\n */\n set value(value: number) {\n // Clamp the value to the allowable range.\n value = Math.max(0, Math.min(value, this._maximum));\n\n // Do nothing if the value does not change.\n if (this._value === value) {\n return;\n }\n\n // Update the internal value.\n this._value = value;\n\n // Schedule an update the scroll bar.\n this.update();\n }\n\n /**\n * Get the page size of the scroll bar.\n *\n * #### Notes\n * The page size is the amount of visible content in the scrolled\n * region, expressed in data units. It determines the size of the\n * scroll bar thumb.\n */\n get page(): number {\n return this._page;\n }\n\n /**\n * Set the page size of the scroll bar.\n *\n * #### Notes\n * The page size will be clamped to the range `[0, Infinity]`.\n */\n set page(value: number) {\n // Clamp the page size to the allowable range.\n value = Math.max(0, value);\n\n // Do nothing if the value does not change.\n if (this._page === value) {\n return;\n }\n\n // Update the internal page size.\n this._page = value;\n\n // Schedule an update the scroll bar.\n this.update();\n }\n\n /**\n * Get the maximum value of the scroll bar.\n */\n get maximum(): number {\n return this._maximum;\n }\n\n /**\n * Set the maximum value of the scroll bar.\n *\n * #### Notes\n * The max size will be clamped to the range `[0, Infinity]`.\n */\n set maximum(value: number) {\n // Clamp the value to the allowable range.\n value = Math.max(0, value);\n\n // Do nothing if the value does not change.\n if (this._maximum === value) {\n return;\n }\n\n // Update the internal values.\n this._maximum = value;\n\n // Clamp the current value to the new range.\n this._value = Math.min(this._value, value);\n\n // Schedule an update the scroll bar.\n this.update();\n }\n\n /**\n * The scroll bar decrement button node.\n *\n * #### Notes\n * Modifying this node directly can lead to undefined behavior.\n */\n get decrementNode(): HTMLDivElement {\n return this.node.getElementsByClassName(\n 'lm-ScrollBar-button'\n )[0] as HTMLDivElement;\n }\n\n /**\n * The scroll bar increment button node.\n *\n * #### Notes\n * Modifying this node directly can lead to undefined behavior.\n */\n get incrementNode(): HTMLDivElement {\n return this.node.getElementsByClassName(\n 'lm-ScrollBar-button'\n )[1] as HTMLDivElement;\n }\n\n /**\n * The scroll bar track node.\n *\n * #### Notes\n * Modifying this node directly can lead to undefined behavior.\n */\n get trackNode(): HTMLDivElement {\n return this.node.getElementsByClassName(\n 'lm-ScrollBar-track'\n )[0] as HTMLDivElement;\n }\n\n /**\n * The scroll bar thumb node.\n *\n * #### Notes\n * Modifying this node directly can lead to undefined behavior.\n */\n get thumbNode(): HTMLDivElement {\n return this.node.getElementsByClassName(\n 'lm-ScrollBar-thumb'\n )[0] as HTMLDivElement;\n }\n\n /**\n * Handle the DOM events for the scroll bar.\n *\n * @param event - The DOM event sent to the scroll bar.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the scroll bar's DOM node.\n *\n * This should not be called directly by user code.\n */\n handleEvent(event: Event): void {\n switch (event.type) {\n case 'mousedown':\n this._evtMouseDown(event as MouseEvent);\n break;\n case 'mousemove':\n this._evtMouseMove(event as MouseEvent);\n break;\n case 'mouseup':\n this._evtMouseUp(event as MouseEvent);\n break;\n case 'keydown':\n this._evtKeyDown(event as KeyboardEvent);\n break;\n case 'contextmenu':\n event.preventDefault();\n event.stopPropagation();\n break;\n }\n }\n\n /**\n * A method invoked on a 'before-attach' message.\n */\n protected onBeforeAttach(msg: Message): void {\n this.node.addEventListener('mousedown', this);\n this.update();\n }\n\n /**\n * A method invoked on an 'after-detach' message.\n */\n protected onAfterDetach(msg: Message): void {\n this.node.removeEventListener('mousedown', this);\n this._releaseMouse();\n }\n\n /**\n * A method invoked on an 'update-request' message.\n */\n protected onUpdateRequest(msg: Message): void {\n // Convert the value and page into percentages.\n let value = (this._value * 100) / this._maximum;\n let page = (this._page * 100) / (this._page + this._maximum);\n\n // Clamp the value and page to the relevant range.\n value = Math.max(0, Math.min(value, 100));\n page = Math.max(0, Math.min(page, 100));\n\n // Fetch the thumb style.\n let thumbStyle = this.thumbNode.style;\n\n // Update the thumb style for the current orientation.\n if (this._orientation === 'horizontal') {\n thumbStyle.top = '';\n thumbStyle.height = '';\n thumbStyle.left = `${value}%`;\n thumbStyle.width = `${page}%`;\n thumbStyle.transform = `translate(${-value}%, 0%)`;\n } else {\n thumbStyle.left = '';\n thumbStyle.width = '';\n thumbStyle.top = `${value}%`;\n thumbStyle.height = `${page}%`;\n thumbStyle.transform = `translate(0%, ${-value}%)`;\n }\n }\n\n /**\n * Handle the `'keydown'` event for the scroll bar.\n */\n private _evtKeyDown(event: KeyboardEvent): void {\n // Stop all input events during drag.\n event.preventDefault();\n event.stopPropagation();\n\n // Ignore anything except the `Escape` key.\n if (event.keyCode !== 27) {\n return;\n }\n\n // Fetch the previous scroll value.\n let value = this._pressData ? this._pressData.value : -1;\n\n // Release the mouse.\n this._releaseMouse();\n\n // Restore the old scroll value if possible.\n if (value !== -1) {\n this._moveThumb(value);\n }\n }\n\n /**\n * Handle the `'mousedown'` event for the scroll bar.\n */\n private _evtMouseDown(event: MouseEvent): void {\n // Do nothing if it's not a left mouse press.\n if (event.button !== 0) {\n return;\n }\n\n // Send an activate request to the scroll bar. This can be\n // used by message hooks to activate something relevant.\n this.activate();\n\n // Do nothing if the mouse is already captured.\n if (this._pressData) {\n return;\n }\n\n // Find the pressed scroll bar part.\n let part = Private.findPart(this, event.target as HTMLElement);\n\n // Do nothing if the part is not of interest.\n if (!part) {\n return;\n }\n\n // Stop the event propagation.\n event.preventDefault();\n event.stopPropagation();\n\n // Override the mouse cursor.\n let override = Drag.overrideCursor('default');\n\n // Set up the press data.\n this._pressData = {\n part,\n override,\n delta: -1,\n value: -1,\n mouseX: event.clientX,\n mouseY: event.clientY\n };\n\n // Add the extra event listeners.\n document.addEventListener('mousemove', this, true);\n document.addEventListener('mouseup', this, true);\n document.addEventListener('keydown', this, true);\n document.addEventListener('contextmenu', this, true);\n\n // Handle a thumb press.\n if (part === 'thumb') {\n // Fetch the thumb node.\n let thumbNode = this.thumbNode;\n\n // Fetch the client rect for the thumb.\n let thumbRect = thumbNode.getBoundingClientRect();\n\n // Update the press data delta for the current orientation.\n if (this._orientation === 'horizontal') {\n this._pressData.delta = event.clientX - thumbRect.left;\n } else {\n this._pressData.delta = event.clientY - thumbRect.top;\n }\n\n // Add the active class to the thumb node.\n thumbNode.classList.add('lm-mod-active');\n\n // Store the current value in the press data.\n this._pressData.value = this._value;\n\n // Finished.\n return;\n }\n\n // Handle a track press.\n if (part === 'track') {\n // Fetch the client rect for the thumb.\n let thumbRect = this.thumbNode.getBoundingClientRect();\n\n // Determine the direction for the page request.\n let dir: 'decrement' | 'increment';\n if (this._orientation === 'horizontal') {\n dir = event.clientX < thumbRect.left ? 'decrement' : 'increment';\n } else {\n dir = event.clientY < thumbRect.top ? 'decrement' : 'increment';\n }\n\n // Start the repeat timer.\n this._repeatTimer = window.setTimeout(this._onRepeat, 350);\n\n // Emit the page requested signal.\n this._pageRequested.emit(dir);\n\n // Finished.\n return;\n }\n\n // Handle a decrement button press.\n if (part === 'decrement') {\n // Add the active class to the decrement node.\n this.decrementNode.classList.add('lm-mod-active');\n\n // Start the repeat timer.\n this._repeatTimer = window.setTimeout(this._onRepeat, 350);\n\n // Emit the step requested signal.\n this._stepRequested.emit('decrement');\n\n // Finished.\n return;\n }\n\n // Handle an increment button press.\n if (part === 'increment') {\n // Add the active class to the increment node.\n this.incrementNode.classList.add('lm-mod-active');\n\n // Start the repeat timer.\n this._repeatTimer = window.setTimeout(this._onRepeat, 350);\n\n // Emit the step requested signal.\n this._stepRequested.emit('increment');\n\n // Finished.\n return;\n }\n }\n\n /**\n * Handle the `'mousemove'` event for the scroll bar.\n */\n private _evtMouseMove(event: MouseEvent): void {\n // Do nothing if no drag is in progress.\n if (!this._pressData) {\n return;\n }\n\n // Stop the event propagation.\n event.preventDefault();\n event.stopPropagation();\n\n // Update the mouse position.\n this._pressData.mouseX = event.clientX;\n this._pressData.mouseY = event.clientY;\n\n // Bail if the thumb is not being dragged.\n if (this._pressData.part !== 'thumb') {\n return;\n }\n\n // Get the client rect for the thumb and track.\n let thumbRect = this.thumbNode.getBoundingClientRect();\n let trackRect = this.trackNode.getBoundingClientRect();\n\n // Fetch the scroll geometry based on the orientation.\n let trackPos: number;\n let trackSpan: number;\n if (this._orientation === 'horizontal') {\n trackPos = event.clientX - trackRect.left - this._pressData.delta;\n trackSpan = trackRect.width - thumbRect.width;\n } else {\n trackPos = event.clientY - trackRect.top - this._pressData.delta;\n trackSpan = trackRect.height - thumbRect.height;\n }\n\n // Compute the desired value from the scroll geometry.\n let value = trackSpan === 0 ? 0 : (trackPos * this._maximum) / trackSpan;\n\n // Move the thumb to the computed value.\n this._moveThumb(value);\n }\n\n /**\n * Handle the `'mouseup'` event for the scroll bar.\n */\n private _evtMouseUp(event: MouseEvent): void {\n // Do nothing if it's not a left mouse release.\n if (event.button !== 0) {\n return;\n }\n\n // Stop the event propagation.\n event.preventDefault();\n event.stopPropagation();\n\n // Release the mouse.\n this._releaseMouse();\n }\n\n /**\n * Release the mouse and restore the node states.\n */\n private _releaseMouse(): void {\n // Bail if there is no press data.\n if (!this._pressData) {\n return;\n }\n\n // Clear the repeat timer.\n clearTimeout(this._repeatTimer);\n this._repeatTimer = -1;\n\n // Clear the press data.\n this._pressData.override.dispose();\n this._pressData = null;\n\n // Remove the extra event listeners.\n document.removeEventListener('mousemove', this, true);\n document.removeEventListener('mouseup', this, true);\n document.removeEventListener('keydown', this, true);\n document.removeEventListener('contextmenu', this, true);\n\n // Remove the active classes from the nodes.\n this.thumbNode.classList.remove('lm-mod-active');\n this.decrementNode.classList.remove('lm-mod-active');\n this.incrementNode.classList.remove('lm-mod-active');\n }\n\n /**\n * Move the thumb to the specified position.\n */\n private _moveThumb(value: number): void {\n // Clamp the value to the allowed range.\n value = Math.max(0, Math.min(value, this._maximum));\n\n // Bail if the value does not change.\n if (this._value === value) {\n return;\n }\n\n // Update the internal value.\n this._value = value;\n\n // Schedule an update of the scroll bar.\n this.update();\n\n // Emit the thumb moved signal.\n this._thumbMoved.emit(value);\n }\n\n /**\n * A timeout callback for repeating the mouse press.\n */\n private _onRepeat = () => {\n // Clear the repeat timer id.\n this._repeatTimer = -1;\n\n // Bail if the mouse has been released.\n if (!this._pressData) {\n return;\n }\n\n // Look up the part that was pressed.\n let part = this._pressData.part;\n\n // Bail if the thumb was pressed.\n if (part === 'thumb') {\n return;\n }\n\n // Schedule the timer for another repeat.\n this._repeatTimer = window.setTimeout(this._onRepeat, 20);\n\n // Get the current mouse position.\n let mouseX = this._pressData.mouseX;\n let mouseY = this._pressData.mouseY;\n\n // Handle a decrement button repeat.\n if (part === 'decrement') {\n // Bail if the mouse is not over the button.\n if (!ElementExt.hitTest(this.decrementNode, mouseX, mouseY)) {\n return;\n }\n\n // Emit the step requested signal.\n this._stepRequested.emit('decrement');\n\n // Finished.\n return;\n }\n\n // Handle an increment button repeat.\n if (part === 'increment') {\n // Bail if the mouse is not over the button.\n if (!ElementExt.hitTest(this.incrementNode, mouseX, mouseY)) {\n return;\n }\n\n // Emit the step requested signal.\n this._stepRequested.emit('increment');\n\n // Finished.\n return;\n }\n\n // Handle a track repeat.\n if (part === 'track') {\n // Bail if the mouse is not over the track.\n if (!ElementExt.hitTest(this.trackNode, mouseX, mouseY)) {\n return;\n }\n\n // Fetch the thumb node.\n let thumbNode = this.thumbNode;\n\n // Bail if the mouse is over the thumb.\n if (ElementExt.hitTest(thumbNode, mouseX, mouseY)) {\n return;\n }\n\n // Fetch the client rect for the thumb.\n let thumbRect = thumbNode.getBoundingClientRect();\n\n // Determine the direction for the page request.\n let dir: 'decrement' | 'increment';\n if (this._orientation === 'horizontal') {\n dir = mouseX < thumbRect.left ? 'decrement' : 'increment';\n } else {\n dir = mouseY < thumbRect.top ? 'decrement' : 'increment';\n }\n\n // Emit the page requested signal.\n this._pageRequested.emit(dir);\n\n // Finished.\n return;\n }\n };\n\n private _value = 0;\n private _page = 10;\n private _maximum = 100;\n private _repeatTimer = -1;\n private _orientation: ScrollBar.Orientation;\n private _pressData: Private.IPressData | null = null;\n private _thumbMoved = new Signal(this);\n private _stepRequested = new Signal(this);\n private _pageRequested = new Signal(this);\n}\n\n/**\n * The namespace for the `ScrollBar` class statics.\n */\nexport namespace ScrollBar {\n /**\n * A type alias for a scroll bar orientation.\n */\n export type Orientation = 'horizontal' | 'vertical';\n\n /**\n * An options object for creating a scroll bar.\n */\n export interface IOptions {\n /**\n * The orientation of the scroll bar.\n *\n * The default is `'vertical'`.\n */\n orientation?: Orientation;\n\n /**\n * The value for the scroll bar.\n *\n * The default is `0`.\n */\n value?: number;\n\n /**\n * The page size for the scroll bar.\n *\n * The default is `10`.\n */\n page?: number;\n\n /**\n * The maximum value for the scroll bar.\n *\n * The default is `100`.\n */\n maximum?: number;\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * A type alias for the parts of a scroll bar.\n */\n export type ScrollBarPart = 'thumb' | 'track' | 'decrement' | 'increment';\n\n /**\n * An object which holds mouse press data.\n */\n export interface IPressData {\n /**\n * The scroll bar part which was pressed.\n */\n part: ScrollBarPart;\n\n /**\n * The offset of the press in thumb coordinates, or -1.\n */\n delta: number;\n\n /**\n * The scroll value at the time the thumb was pressed, or -1.\n */\n value: number;\n\n /**\n * The disposable which will clear the override cursor.\n */\n override: IDisposable;\n\n /**\n * The current X position of the mouse.\n */\n mouseX: number;\n\n /**\n * The current Y position of the mouse.\n */\n mouseY: number;\n }\n\n /**\n * Create the DOM node for a scroll bar.\n */\n export function createNode(): HTMLElement {\n let node = document.createElement('div');\n let decrement = document.createElement('div');\n let increment = document.createElement('div');\n let track = document.createElement('div');\n let thumb = document.createElement('div');\n decrement.className = 'lm-ScrollBar-button';\n increment.className = 'lm-ScrollBar-button';\n decrement.dataset['action'] = 'decrement';\n increment.dataset['action'] = 'increment';\n track.className = 'lm-ScrollBar-track';\n thumb.className = 'lm-ScrollBar-thumb';\n track.appendChild(thumb);\n node.appendChild(decrement);\n node.appendChild(track);\n node.appendChild(increment);\n return node;\n }\n\n /**\n * Find the scroll bar part which contains the given target.\n */\n export function findPart(\n scrollBar: ScrollBar,\n target: HTMLElement\n ): ScrollBarPart | null {\n // Test the thumb.\n if (scrollBar.thumbNode.contains(target)) {\n return 'thumb';\n }\n\n // Test the track.\n if (scrollBar.trackNode.contains(target)) {\n return 'track';\n }\n\n // Test the decrement button.\n if (scrollBar.decrementNode.contains(target)) {\n return 'decrement';\n }\n\n // Test the increment button.\n if (scrollBar.incrementNode.contains(target)) {\n return 'increment';\n }\n\n // Indicate no match.\n return null;\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { Panel } from './panel';\n\nimport { StackedLayout } from './stackedlayout';\n\nimport { Widget } from './widget';\n\n/**\n * A panel where visible widgets are stacked atop one another.\n *\n * #### Notes\n * This class provides a convenience wrapper around a {@link StackedLayout}.\n */\nexport class StackedPanel extends Panel {\n /**\n * Construct a new stacked panel.\n *\n * @param options - The options for initializing the panel.\n */\n constructor(options: StackedPanel.IOptions = {}) {\n super({ layout: Private.createLayout(options) });\n this.addClass('lm-StackedPanel');\n }\n\n /**\n * The method for hiding widgets.\n *\n * #### Notes\n * If there is only one child widget, `Display` hiding mode will be used\n * regardless of this setting.\n */\n get hiddenMode(): Widget.HiddenMode {\n return (this.layout as StackedLayout).hiddenMode;\n }\n\n /**\n * Set the method for hiding widgets.\n *\n * #### Notes\n * If there is only one child widget, `Display` hiding mode will be used\n * regardless of this setting.\n */\n set hiddenMode(v: Widget.HiddenMode) {\n (this.layout as StackedLayout).hiddenMode = v;\n }\n\n /**\n * A signal emitted when a widget is removed from a stacked panel.\n */\n get widgetRemoved(): ISignal {\n return this._widgetRemoved;\n }\n\n /**\n * A message handler invoked on a `'child-added'` message.\n */\n protected onChildAdded(msg: Widget.ChildMessage): void {\n msg.child.addClass('lm-StackedPanel-child');\n }\n\n /**\n * A message handler invoked on a `'child-removed'` message.\n */\n protected onChildRemoved(msg: Widget.ChildMessage): void {\n msg.child.removeClass('lm-StackedPanel-child');\n this._widgetRemoved.emit(msg.child);\n }\n\n private _widgetRemoved = new Signal(this);\n}\n\n/**\n * The namespace for the `StackedPanel` class statics.\n */\nexport namespace StackedPanel {\n /**\n * An options object for creating a stacked panel.\n */\n export interface IOptions {\n /**\n * The stacked layout to use for the stacked panel.\n *\n * The default is a new `StackedLayout`.\n */\n layout?: StackedLayout;\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * Create a stacked layout for the given panel options.\n */\n export function createLayout(options: StackedPanel.IOptions): StackedLayout {\n return options.layout || new StackedLayout();\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { Platform } from '@lumino/domutils';\n\nimport { MessageLoop } from '@lumino/messaging';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { BoxLayout } from './boxlayout';\n\nimport { StackedPanel } from './stackedpanel';\n\nimport { TabBar } from './tabbar';\n\nimport { Widget } from './widget';\n\n/**\n * A widget which combines a `TabBar` and a `StackedPanel`.\n *\n * #### Notes\n * This is a simple panel which handles the common case of a tab bar\n * placed next to a content area. The selected tab controls the widget\n * which is shown in the content area.\n *\n * For use cases which require more control than is provided by this\n * panel, the `TabBar` widget may be used independently.\n */\nexport class TabPanel extends Widget {\n /**\n * Construct a new tab panel.\n *\n * @param options - The options for initializing the tab panel.\n */\n constructor(options: TabPanel.IOptions = {}) {\n super();\n this.addClass('lm-TabPanel');\n\n // Create the tab bar and stacked panel.\n this.tabBar = new TabBar(options);\n this.tabBar.addClass('lm-TabPanel-tabBar');\n this.stackedPanel = new StackedPanel();\n this.stackedPanel.addClass('lm-TabPanel-stackedPanel');\n\n // Connect the tab bar signal handlers.\n this.tabBar.tabMoved.connect(this._onTabMoved, this);\n this.tabBar.currentChanged.connect(this._onCurrentChanged, this);\n this.tabBar.tabCloseRequested.connect(this._onTabCloseRequested, this);\n this.tabBar.tabActivateRequested.connect(\n this._onTabActivateRequested,\n this\n );\n this.tabBar.addRequested.connect(this._onTabAddRequested, this);\n\n // Connect the stacked panel signal handlers.\n this.stackedPanel.widgetRemoved.connect(this._onWidgetRemoved, this);\n\n // Get the data related to the placement.\n this._tabPlacement = options.tabPlacement || 'top';\n let direction = Private.directionFromPlacement(this._tabPlacement);\n let orientation = Private.orientationFromPlacement(this._tabPlacement);\n\n // Configure the tab bar for the placement.\n this.tabBar.orientation = orientation;\n this.tabBar.dataset['placement'] = this._tabPlacement;\n\n // Create the box layout.\n let layout = new BoxLayout({ direction, spacing: 0 });\n\n // Set the stretch factors for the child widgets.\n BoxLayout.setStretch(this.tabBar, 0);\n BoxLayout.setStretch(this.stackedPanel, 1);\n\n // Add the child widgets to the layout.\n layout.addWidget(this.tabBar);\n layout.addWidget(this.stackedPanel);\n\n // Install the layout on the tab panel.\n this.layout = layout;\n }\n\n /**\n * A signal emitted when the current tab is changed.\n *\n * #### Notes\n * This signal is emitted when the currently selected tab is changed\n * either through user or programmatic interaction.\n *\n * Notably, this signal is not emitted when the index of the current\n * tab changes due to tabs being inserted, removed, or moved. It is\n * only emitted when the actual current tab node is changed.\n */\n get currentChanged(): ISignal {\n return this._currentChanged;\n }\n\n /**\n * Get the index of the currently selected tab.\n *\n * #### Notes\n * This will be `-1` if no tab is selected.\n */\n get currentIndex(): number {\n return this.tabBar.currentIndex;\n }\n\n /**\n * Set the index of the currently selected tab.\n *\n * #### Notes\n * If the index is out of range, it will be set to `-1`.\n */\n set currentIndex(value: number) {\n this.tabBar.currentIndex = value;\n }\n\n /**\n * Get the currently selected widget.\n *\n * #### Notes\n * This will be `null` if there is no selected tab.\n */\n get currentWidget(): Widget | null {\n let title = this.tabBar.currentTitle;\n return title ? title.owner : null;\n }\n\n /**\n * Set the currently selected widget.\n *\n * #### Notes\n * If the widget is not in the panel, it will be set to `null`.\n */\n set currentWidget(value: Widget | null) {\n this.tabBar.currentTitle = value ? value.title : null;\n }\n\n /**\n * Get the whether the tabs are movable by the user.\n *\n * #### Notes\n * Tabs can always be moved programmatically.\n */\n get tabsMovable(): boolean {\n return this.tabBar.tabsMovable;\n }\n\n /**\n * Set the whether the tabs are movable by the user.\n *\n * #### Notes\n * Tabs can always be moved programmatically.\n */\n set tabsMovable(value: boolean) {\n this.tabBar.tabsMovable = value;\n }\n\n /**\n * Get the whether the add button is enabled.\n *\n */\n get addButtonEnabled(): boolean {\n return this.tabBar.addButtonEnabled;\n }\n\n /**\n * Set the whether the add button is enabled.\n *\n */\n set addButtonEnabled(value: boolean) {\n this.tabBar.addButtonEnabled = value;\n }\n\n /**\n * Get the tab placement for the tab panel.\n *\n * #### Notes\n * This controls the position of the tab bar relative to the content.\n */\n get tabPlacement(): TabPanel.TabPlacement {\n return this._tabPlacement;\n }\n\n /**\n * Set the tab placement for the tab panel.\n *\n * #### Notes\n * This controls the position of the tab bar relative to the content.\n */\n set tabPlacement(value: TabPanel.TabPlacement) {\n // Bail if the placement does not change.\n if (this._tabPlacement === value) {\n return;\n }\n\n // Update the internal value.\n this._tabPlacement = value;\n\n // Get the values related to the placement.\n let direction = Private.directionFromPlacement(value);\n let orientation = Private.orientationFromPlacement(value);\n\n // Configure the tab bar for the placement.\n this.tabBar.orientation = orientation;\n this.tabBar.dataset['placement'] = value;\n\n // Update the layout direction.\n (this.layout as BoxLayout).direction = direction;\n }\n\n /**\n * A signal emitted when the add button on a tab bar is clicked.\n *\n */\n get addRequested(): ISignal> {\n return this._addRequested;\n }\n\n /**\n * The tab bar used by the tab panel.\n *\n * #### Notes\n * Modifying the tab bar directly can lead to undefined behavior.\n */\n readonly tabBar: TabBar;\n\n /**\n * The stacked panel used by the tab panel.\n *\n * #### Notes\n * Modifying the panel directly can lead to undefined behavior.\n */\n readonly stackedPanel: StackedPanel;\n\n /**\n * A read-only array of the widgets in the panel.\n */\n get widgets(): ReadonlyArray {\n return this.stackedPanel.widgets;\n }\n\n /**\n * Add a widget to the end of the tab panel.\n *\n * @param widget - The widget to add to the tab panel.\n *\n * #### Notes\n * If the widget is already contained in the panel, it will be moved.\n *\n * The widget's `title` is used to populate the tab.\n */\n addWidget(widget: Widget): void {\n this.insertWidget(this.widgets.length, widget);\n }\n\n /**\n * Insert a widget into the tab panel at a specified index.\n *\n * @param index - The index at which to insert the widget.\n *\n * @param widget - The widget to insert into to the tab panel.\n *\n * #### Notes\n * If the widget is already contained in the panel, it will be moved.\n *\n * The widget's `title` is used to populate the tab.\n */\n insertWidget(index: number, widget: Widget): void {\n if (widget !== this.currentWidget) {\n widget.hide();\n }\n this.stackedPanel.insertWidget(index, widget);\n this.tabBar.insertTab(index, widget.title);\n\n widget.node.setAttribute('role', 'tabpanel');\n\n let renderer = this.tabBar.renderer;\n if (renderer instanceof TabBar.Renderer) {\n let tabId = renderer.createTabKey({\n title: widget.title,\n current: false,\n zIndex: 0\n });\n widget.node.setAttribute('aria-labelledby', tabId);\n }\n }\n\n /**\n * Handle the `currentChanged` signal from the tab bar.\n */\n private _onCurrentChanged(\n sender: TabBar,\n args: TabBar.ICurrentChangedArgs\n ): void {\n // Extract the previous and current title from the args.\n let { previousIndex, previousTitle, currentIndex, currentTitle } = args;\n\n // Extract the widgets from the titles.\n let previousWidget = previousTitle ? previousTitle.owner : null;\n let currentWidget = currentTitle ? currentTitle.owner : null;\n\n // Hide the previous widget.\n if (previousWidget) {\n previousWidget.hide();\n }\n\n // Show the current widget.\n if (currentWidget) {\n currentWidget.show();\n }\n\n // Emit the `currentChanged` signal for the tab panel.\n this._currentChanged.emit({\n previousIndex,\n previousWidget,\n currentIndex,\n currentWidget\n });\n\n // Flush the message loop on IE and Edge to prevent flicker.\n if (Platform.IS_EDGE || Platform.IS_IE) {\n MessageLoop.flush();\n }\n }\n\n /**\n * Handle the `tabAddRequested` signal from the tab bar.\n */\n private _onTabAddRequested(sender: TabBar, args: void): void {\n this._addRequested.emit(sender);\n }\n\n /**\n * Handle the `tabActivateRequested` signal from the tab bar.\n */\n private _onTabActivateRequested(\n sender: TabBar,\n args: TabBar.ITabActivateRequestedArgs\n ): void {\n args.title.owner.activate();\n }\n\n /**\n * Handle the `tabCloseRequested` signal from the tab bar.\n */\n private _onTabCloseRequested(\n sender: TabBar,\n args: TabBar.ITabCloseRequestedArgs\n ): void {\n args.title.owner.close();\n }\n\n /**\n * Handle the `tabMoved` signal from the tab bar.\n */\n private _onTabMoved(\n sender: TabBar,\n args: TabBar.ITabMovedArgs\n ): void {\n this.stackedPanel.insertWidget(args.toIndex, args.title.owner);\n }\n\n /**\n * Handle the `widgetRemoved` signal from the stacked panel.\n */\n private _onWidgetRemoved(sender: StackedPanel, widget: Widget): void {\n widget.node.removeAttribute('role');\n widget.node.removeAttribute('aria-labelledby');\n this.tabBar.removeTab(widget.title);\n }\n\n private _tabPlacement: TabPanel.TabPlacement;\n private _currentChanged = new Signal(\n this\n );\n\n private _addRequested = new Signal>(this);\n}\n\n/**\n * The namespace for the `TabPanel` class statics.\n */\nexport namespace TabPanel {\n /**\n * A type alias for tab placement in a tab bar.\n */\n export type TabPlacement =\n | /**\n * The tabs are placed as a row above the content.\n */\n 'top'\n\n /**\n * The tabs are placed as a column to the left of the content.\n */\n | 'left'\n\n /**\n * The tabs are placed as a column to the right of the content.\n */\n | 'right'\n\n /**\n * The tabs are placed as a row below the content.\n */\n | 'bottom';\n\n /**\n * An options object for initializing a tab panel.\n */\n export interface IOptions {\n /**\n * The document to use with the tab panel.\n *\n * The default is the global `document` instance.\n */\n document?: Document | ShadowRoot;\n\n /**\n * Whether the tabs are movable by the user.\n *\n * The default is `false`.\n */\n tabsMovable?: boolean;\n\n /**\n * Whether the button to add new tabs is enabled.\n *\n * The default is `false`.\n */\n addButtonEnabled?: boolean;\n\n /**\n * The placement of the tab bar relative to the content.\n *\n * The default is `'top'`.\n */\n tabPlacement?: TabPlacement;\n\n /**\n * The renderer for the panel's tab bar.\n *\n * The default is a shared renderer instance.\n */\n renderer?: TabBar.IRenderer;\n }\n\n /**\n * The arguments object for the `currentChanged` signal.\n */\n export interface ICurrentChangedArgs {\n /**\n * The previously selected index.\n */\n previousIndex: number;\n\n /**\n * The previously selected widget.\n */\n previousWidget: Widget | null;\n\n /**\n * The currently selected index.\n */\n currentIndex: number;\n\n /**\n * The currently selected widget.\n */\n currentWidget: Widget | null;\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * Convert a tab placement to tab bar orientation.\n */\n export function orientationFromPlacement(\n plc: TabPanel.TabPlacement\n ): TabBar.Orientation {\n return placementToOrientationMap[plc];\n }\n\n /**\n * Convert a tab placement to a box layout direction.\n */\n export function directionFromPlacement(\n plc: TabPanel.TabPlacement\n ): BoxLayout.Direction {\n return placementToDirectionMap[plc];\n }\n\n /**\n * A mapping of tab placement to tab bar orientation.\n */\n const placementToOrientationMap: { [key: string]: TabBar.Orientation } = {\n top: 'horizontal',\n left: 'vertical',\n right: 'vertical',\n bottom: 'horizontal'\n };\n\n /**\n * A mapping of tab placement to box layout direction.\n */\n const placementToDirectionMap: { [key: string]: BoxLayout.Direction } = {\n top: 'top-to-bottom',\n left: 'left-to-right',\n right: 'right-to-left',\n bottom: 'bottom-to-top'\n };\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { MessageLoop } from '@lumino/messaging';\n\nimport { Layout } from './layout';\n\nimport { Widget } from './widget';\n\n/**\n * A concrete layout implementation which holds a single widget.\n *\n * #### Notes\n * This class is useful for creating simple container widgets which\n * hold a single child. The child should be positioned with CSS.\n */\nexport class SingletonLayout extends Layout {\n /**\n * Dispose of the resources held by the layout.\n */\n dispose(): void {\n if (this._widget) {\n let widget = this._widget;\n this._widget = null;\n widget.dispose();\n }\n super.dispose();\n }\n\n /**\n * Get the child widget for the layout.\n */\n get widget(): Widget | null {\n return this._widget;\n }\n\n /**\n * Set the child widget for the layout.\n *\n * #### Notes\n * Setting the child widget will cause the old child widget to be\n * automatically disposed. If that is not desired, set the parent\n * of the old child to `null` before assigning a new child.\n */\n set widget(widget: Widget | null) {\n // Remove the widget from its current parent. This is a no-op\n // if the widget's parent is already the layout parent widget.\n if (widget) {\n widget.parent = this.parent;\n }\n\n // Bail early if the widget does not change.\n if (this._widget === widget) {\n return;\n }\n\n // Dispose of the old child widget.\n if (this._widget) {\n this._widget.dispose();\n }\n\n // Update the internal widget.\n this._widget = widget;\n\n // Attach the new child widget if needed.\n if (this.parent && widget) {\n this.attachWidget(widget);\n }\n }\n\n /**\n * Create an iterator over the widgets in the layout.\n *\n * @returns A new iterator over the widgets in the layout.\n */\n *[Symbol.iterator](): IterableIterator {\n if (this._widget) {\n yield this._widget;\n }\n }\n\n /**\n * Remove a widget from the layout.\n *\n * @param widget - The widget to remove from the layout.\n *\n * #### Notes\n * A widget is automatically removed from the layout when its `parent`\n * is set to `null`. This method should only be invoked directly when\n * removing a widget from a layout which has yet to be installed on a\n * parent widget.\n *\n * This method does *not* modify the widget's `parent`.\n */\n removeWidget(widget: Widget): void {\n // Bail early if the widget does not exist in the layout.\n if (this._widget !== widget) {\n return;\n }\n\n // Clear the internal widget.\n this._widget = null;\n\n // If the layout is parented, detach the widget from the DOM.\n if (this.parent) {\n this.detachWidget(widget);\n }\n }\n\n /**\n * Perform layout initialization which requires the parent widget.\n */\n protected init(): void {\n super.init();\n for (const widget of this) {\n this.attachWidget(widget);\n }\n }\n\n /**\n * Attach a widget to the parent's DOM node.\n *\n * @param widget - The widget to attach to the parent.\n *\n * #### Notes\n * This method is called automatically by the single layout at the\n * appropriate time. It should not be called directly by user code.\n *\n * The default implementation adds the widgets's node to the parent's\n * node at the proper location, and sends the appropriate attach\n * messages to the widget if the parent is attached to the DOM.\n *\n * Subclasses may reimplement this method to control how the widget's\n * node is added to the parent's node.\n */\n protected attachWidget(widget: Widget): void {\n // Send a `'before-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n }\n\n // Add the widget's node to the parent.\n this.parent!.node.appendChild(widget.node);\n\n // Send an `'after-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n }\n\n /**\n * Detach a widget from the parent's DOM node.\n *\n * @param widget - The widget to detach from the parent.\n *\n * #### Notes\n * This method is called automatically by the single layout at the\n * appropriate time. It should not be called directly by user code.\n *\n * The default implementation removes the widget's node from the\n * parent's node, and sends the appropriate detach messages to the\n * widget if the parent is attached to the DOM.\n *\n * Subclasses may reimplement this method to control how the widget's\n * node is removed from the parent's node.\n */\n protected detachWidget(widget: Widget): void {\n // Send a `'before-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n }\n\n // Remove the widget's node from the parent.\n this.parent!.node.removeChild(widget.node);\n\n // Send an `'after-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n }\n\n private _widget: Widget | null = null;\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { Layout, LayoutItem } from './layout';\n\nimport { PanelLayout } from './panellayout';\n\nimport { Widget } from './widget';\n\n/**\n * A layout where visible widgets are stacked atop one another.\n *\n * #### Notes\n * The Z-order of the visible widgets follows their layout order.\n */\nexport class StackedLayout extends PanelLayout {\n constructor(options: StackedLayout.IOptions = {}) {\n super(options);\n this._hiddenMode =\n options.hiddenMode !== undefined\n ? options.hiddenMode\n : Widget.HiddenMode.Display;\n }\n\n /**\n * The method for hiding widgets.\n *\n * #### Notes\n * If there is only one child widget, `Display` hiding mode will be used\n * regardless of this setting.\n */\n get hiddenMode(): Widget.HiddenMode {\n return this._hiddenMode;\n }\n\n /**\n * Set the method for hiding widgets.\n *\n * #### Notes\n * If there is only one child widget, `Display` hiding mode will be used\n * regardless of this setting.\n */\n set hiddenMode(v: Widget.HiddenMode) {\n if (this._hiddenMode === v) {\n return;\n }\n this._hiddenMode = v;\n if (this.widgets.length > 1) {\n this.widgets.forEach(w => {\n w.hiddenMode = this._hiddenMode;\n });\n }\n }\n\n /**\n * Dispose of the resources held by the layout.\n */\n dispose(): void {\n // Dispose of the layout items.\n for (const item of this._items) {\n item.dispose();\n }\n\n // Clear the layout state.\n this._box = null;\n this._items.length = 0;\n\n // Dispose of the rest of the layout.\n super.dispose();\n }\n\n /**\n * Attach a widget to the parent's DOM node.\n *\n * @param index - The current index of the widget in the layout.\n *\n * @param widget - The widget to attach to the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected attachWidget(index: number, widget: Widget): void {\n // Using transform create an additional layer in the pixel pipeline\n // to limit the number of layer, it is set only if there is more than one widget.\n if (\n this._hiddenMode === Widget.HiddenMode.Scale &&\n this._items.length > 0\n ) {\n if (this._items.length === 1) {\n this.widgets[0].hiddenMode = Widget.HiddenMode.Scale;\n }\n widget.hiddenMode = Widget.HiddenMode.Scale;\n } else {\n widget.hiddenMode = Widget.HiddenMode.Display;\n }\n\n // Create and add a new layout item for the widget.\n ArrayExt.insert(this._items, index, new LayoutItem(widget));\n\n // Send a `'before-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n }\n\n // Add the widget's node to the parent.\n this.parent!.node.appendChild(widget.node);\n\n // Send an `'after-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n\n // Post a fit request for the parent widget.\n this.parent!.fit();\n }\n\n /**\n * Move a widget in the parent's DOM node.\n *\n * @param fromIndex - The previous index of the widget in the layout.\n *\n * @param toIndex - The current index of the widget in the layout.\n *\n * @param widget - The widget to move in the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected moveWidget(\n fromIndex: number,\n toIndex: number,\n widget: Widget\n ): void {\n // Move the layout item for the widget.\n ArrayExt.move(this._items, fromIndex, toIndex);\n\n // Post an update request for the parent widget.\n this.parent!.update();\n }\n\n /**\n * Detach a widget from the parent's DOM node.\n *\n * @param index - The previous index of the widget in the layout.\n *\n * @param widget - The widget to detach from the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected detachWidget(index: number, widget: Widget): void {\n // Remove the layout item for the widget.\n let item = ArrayExt.removeAt(this._items, index);\n\n // Send a `'before-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n }\n\n // Remove the widget's node from the parent.\n this.parent!.node.removeChild(widget.node);\n\n // Send an `'after-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n\n // Reset the z-index for the widget.\n item!.widget.node.style.zIndex = '';\n\n // Reset the hidden mode for the widget.\n if (this._hiddenMode === Widget.HiddenMode.Scale) {\n widget.hiddenMode = Widget.HiddenMode.Display;\n\n // Reset the hidden mode for the first widget if necessary.\n if (this._items.length === 1) {\n this._items[0].widget.hiddenMode = Widget.HiddenMode.Display;\n }\n }\n\n // Dispose of the layout item.\n item!.dispose();\n\n // Post a fit request for the parent widget.\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'before-show'` message.\n */\n protected onBeforeShow(msg: Message): void {\n super.onBeforeShow(msg);\n this.parent!.update();\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n super.onBeforeAttach(msg);\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-shown'` message.\n */\n protected onChildShown(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-hidden'` message.\n */\n protected onChildHidden(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'resize'` message.\n */\n protected onResize(msg: Widget.ResizeMessage): void {\n if (this.parent!.isVisible) {\n this._update(msg.width, msg.height);\n }\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n protected onUpdateRequest(msg: Message): void {\n if (this.parent!.isVisible) {\n this._update(-1, -1);\n }\n }\n\n /**\n * A message handler invoked on a `'fit-request'` message.\n */\n protected onFitRequest(msg: Message): void {\n if (this.parent!.isAttached) {\n this._fit();\n }\n }\n\n /**\n * Fit the layout to the total size required by the widgets.\n */\n private _fit(): void {\n // Set up the computed minimum size.\n let minW = 0;\n let minH = 0;\n\n // Update the computed minimum size.\n for (let i = 0, n = this._items.length; i < n; ++i) {\n // Fetch the item.\n let item = this._items[i];\n\n // Ignore hidden items.\n if (item.isHidden) {\n continue;\n }\n\n // Update the size limits for the item.\n item.fit();\n\n // Update the computed minimum size.\n minW = Math.max(minW, item.minWidth);\n minH = Math.max(minH, item.minHeight);\n }\n\n // Update the box sizing and add it to the computed min size.\n let box = (this._box = ElementExt.boxSizing(this.parent!.node));\n minW += box.horizontalSum;\n minH += box.verticalSum;\n\n // Update the parent's min size constraints.\n let style = this.parent!.node.style;\n style.minWidth = `${minW}px`;\n style.minHeight = `${minH}px`;\n\n // Set the dirty flag to ensure only a single update occurs.\n this._dirty = true;\n\n // Notify the ancestor that it should fit immediately. This may\n // cause a resize of the parent, fulfilling the required update.\n if (this.parent!.parent) {\n MessageLoop.sendMessage(this.parent!.parent!, Widget.Msg.FitRequest);\n }\n\n // If the dirty flag is still set, the parent was not resized.\n // Trigger the required update on the parent widget immediately.\n if (this._dirty) {\n MessageLoop.sendMessage(this.parent!, Widget.Msg.UpdateRequest);\n }\n }\n\n /**\n * Update the layout position and size of the widgets.\n *\n * The parent offset dimensions should be `-1` if unknown.\n */\n private _update(offsetWidth: number, offsetHeight: number): void {\n // Clear the dirty flag to indicate the update occurred.\n this._dirty = false;\n\n // Compute the visible item count.\n let nVisible = 0;\n for (let i = 0, n = this._items.length; i < n; ++i) {\n nVisible += +!this._items[i].isHidden;\n }\n\n // Bail early if there are no visible items to layout.\n if (nVisible === 0) {\n return;\n }\n\n // Measure the parent if the offset dimensions are unknown.\n if (offsetWidth < 0) {\n offsetWidth = this.parent!.node.offsetWidth;\n }\n if (offsetHeight < 0) {\n offsetHeight = this.parent!.node.offsetHeight;\n }\n\n // Ensure the parent box sizing data is computed.\n if (!this._box) {\n this._box = ElementExt.boxSizing(this.parent!.node);\n }\n\n // Compute the actual layout bounds adjusted for border and padding.\n let top = this._box.paddingTop;\n let left = this._box.paddingLeft;\n let width = offsetWidth - this._box.horizontalSum;\n let height = offsetHeight - this._box.verticalSum;\n\n // Update the widget stacking order and layout geometry.\n for (let i = 0, n = this._items.length; i < n; ++i) {\n // Fetch the item.\n let item = this._items[i];\n\n // Ignore hidden items.\n if (item.isHidden) {\n continue;\n }\n\n // Set the z-index for the widget.\n item.widget.node.style.zIndex = `${i}`;\n\n // Update the item geometry.\n item.update(left, top, width, height);\n }\n }\n\n private _dirty = false;\n private _items: LayoutItem[] = [];\n private _box: ElementExt.IBoxSizing | null = null;\n private _hiddenMode: Widget.HiddenMode;\n}\n\n/**\n * The namespace for the `StackedLayout` class statics.\n */\nexport namespace StackedLayout {\n /**\n * An options object for initializing a stacked layout.\n */\n export interface IOptions extends Layout.IOptions {\n /**\n * The method for hiding widgets.\n *\n * The default is `Widget.HiddenMode.Display`.\n */\n hiddenMode?: Widget.HiddenMode;\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt, find, max } from '@lumino/algorithm';\n\nimport { IDisposable } from '@lumino/disposable';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { Widget } from './widget';\n\n/**\n * A class which tracks focus among a set of widgets.\n *\n * This class is useful when code needs to keep track of the most\n * recently focused widget(s) among a set of related widgets.\n */\nexport class FocusTracker implements IDisposable {\n /**\n * Dispose of the resources held by the tracker.\n */\n dispose(): void {\n // Do nothing if the tracker is already disposed.\n if (this._counter < 0) {\n return;\n }\n\n // Mark the tracker as disposed.\n this._counter = -1;\n\n // Clear the connections for the tracker.\n Signal.clearData(this);\n\n // Remove all event listeners.\n for (const widget of this._widgets) {\n widget.node.removeEventListener('focus', this, true);\n widget.node.removeEventListener('blur', this, true);\n }\n\n // Clear the internal data structures.\n this._activeWidget = null;\n this._currentWidget = null;\n this._nodes.clear();\n this._numbers.clear();\n this._widgets.length = 0;\n }\n\n /**\n * A signal emitted when the current widget has changed.\n */\n get currentChanged(): ISignal> {\n return this._currentChanged;\n }\n\n /**\n * A signal emitted when the active widget has changed.\n */\n get activeChanged(): ISignal> {\n return this._activeChanged;\n }\n\n /**\n * A flag indicating whether the tracker is disposed.\n */\n get isDisposed(): boolean {\n return this._counter < 0;\n }\n\n /**\n * The current widget in the tracker.\n *\n * #### Notes\n * The current widget is the widget among the tracked widgets which\n * has the *descendant node* which has most recently been focused.\n *\n * The current widget will not be updated if the node loses focus. It\n * will only be updated when a different tracked widget gains focus.\n *\n * If the current widget is removed from the tracker, the previous\n * current widget will be restored.\n *\n * This behavior is intended to follow a user's conceptual model of\n * a semantically \"current\" widget, where the \"last thing of type X\"\n * to be interacted with is the \"current instance of X\", regardless\n * of whether that instance still has focus.\n */\n get currentWidget(): T | null {\n return this._currentWidget;\n }\n\n /**\n * The active widget in the tracker.\n *\n * #### Notes\n * The active widget is the widget among the tracked widgets which\n * has the *descendant node* which is currently focused.\n */\n get activeWidget(): T | null {\n return this._activeWidget;\n }\n\n /**\n * A read only array of the widgets being tracked.\n */\n get widgets(): ReadonlyArray {\n return this._widgets;\n }\n\n /**\n * Get the focus number for a particular widget in the tracker.\n *\n * @param widget - The widget of interest.\n *\n * @returns The focus number for the given widget, or `-1` if the\n * widget has not had focus since being added to the tracker, or\n * is not contained by the tracker.\n *\n * #### Notes\n * The focus number indicates the relative order in which the widgets\n * have gained focus. A widget with a larger number has gained focus\n * more recently than a widget with a smaller number.\n *\n * The `currentWidget` will always have the largest focus number.\n *\n * All widgets start with a focus number of `-1`, which indicates that\n * the widget has not been focused since being added to the tracker.\n */\n focusNumber(widget: T): number {\n let n = this._numbers.get(widget);\n return n === undefined ? -1 : n;\n }\n\n /**\n * Test whether the focus tracker contains a given widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns `true` if the widget is tracked, `false` otherwise.\n */\n has(widget: T): boolean {\n return this._numbers.has(widget);\n }\n\n /**\n * Add a widget to the focus tracker.\n *\n * @param widget - The widget of interest.\n *\n * #### Notes\n * A widget will be automatically removed from the tracker if it\n * is disposed after being added.\n *\n * If the widget is already tracked, this is a no-op.\n */\n add(widget: T): void {\n // Do nothing if the widget is already tracked.\n if (this._numbers.has(widget)) {\n return;\n }\n\n // Test whether the widget has focus.\n let focused = widget.node.contains(document.activeElement);\n\n // Set up the initial focus number.\n let n = focused ? this._counter++ : -1;\n\n // Add the widget to the internal data structures.\n this._widgets.push(widget);\n this._numbers.set(widget, n);\n this._nodes.set(widget.node, widget);\n\n // Set up the event listeners. The capturing phase must be used\n // since the 'focus' and 'blur' events don't bubble and Firefox\n // doesn't support the 'focusin' or 'focusout' events.\n widget.node.addEventListener('focus', this, true);\n widget.node.addEventListener('blur', this, true);\n\n // Connect the disposed signal handler.\n widget.disposed.connect(this._onWidgetDisposed, this);\n\n // Set the current and active widgets if needed.\n if (focused) {\n this._setWidgets(widget, widget);\n }\n }\n\n /**\n * Remove a widget from the focus tracker.\n *\n * #### Notes\n * If the widget is the `currentWidget`, the previous current widget\n * will become the new `currentWidget`.\n *\n * A widget will be automatically removed from the tracker if it\n * is disposed after being added.\n *\n * If the widget is not tracked, this is a no-op.\n */\n remove(widget: T): void {\n // Bail early if the widget is not tracked.\n if (!this._numbers.has(widget)) {\n return;\n }\n\n // Disconnect the disposed signal handler.\n widget.disposed.disconnect(this._onWidgetDisposed, this);\n\n // Remove the event listeners.\n widget.node.removeEventListener('focus', this, true);\n widget.node.removeEventListener('blur', this, true);\n\n // Remove the widget from the internal data structures.\n ArrayExt.removeFirstOf(this._widgets, widget);\n this._nodes.delete(widget.node);\n this._numbers.delete(widget);\n\n // Bail early if the widget is not the current widget.\n if (this._currentWidget !== widget) {\n return;\n }\n\n // Filter the widgets for those which have had focus.\n let valid = this._widgets.filter(w => this._numbers.get(w) !== -1);\n\n // Get the valid widget with the max focus number.\n let previous =\n max(valid, (first, second) => {\n let a = this._numbers.get(first)!;\n let b = this._numbers.get(second)!;\n return a - b;\n }) || null;\n\n // Set the current and active widgets.\n this._setWidgets(previous, null);\n }\n\n /**\n * Handle the DOM events for the focus tracker.\n *\n * @param event - The DOM event sent to the panel.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the tracked nodes. It should\n * not be called directly by user code.\n */\n handleEvent(event: Event): void {\n switch (event.type) {\n case 'focus':\n this._evtFocus(event as FocusEvent);\n break;\n case 'blur':\n this._evtBlur(event as FocusEvent);\n break;\n }\n }\n\n /**\n * Set the current and active widgets for the tracker.\n */\n private _setWidgets(current: T | null, active: T | null): void {\n // Swap the current widget.\n let oldCurrent = this._currentWidget;\n this._currentWidget = current;\n\n // Swap the active widget.\n let oldActive = this._activeWidget;\n this._activeWidget = active;\n\n // Emit the `currentChanged` signal if needed.\n if (oldCurrent !== current) {\n this._currentChanged.emit({ oldValue: oldCurrent, newValue: current });\n }\n\n // Emit the `activeChanged` signal if needed.\n if (oldActive !== active) {\n this._activeChanged.emit({ oldValue: oldActive, newValue: active });\n }\n }\n\n /**\n * Handle the `'focus'` event for a tracked widget.\n */\n private _evtFocus(event: FocusEvent): void {\n // Find the widget which gained focus, which is known to exist.\n let widget = this._nodes.get(event.currentTarget as HTMLElement)!;\n\n // Update the focus number if necessary.\n if (widget !== this._currentWidget) {\n this._numbers.set(widget, this._counter++);\n }\n\n // Set the current and active widgets.\n this._setWidgets(widget, widget);\n }\n\n /**\n * Handle the `'blur'` event for a tracked widget.\n */\n private _evtBlur(event: FocusEvent): void {\n // Find the widget which lost focus, which is known to exist.\n let widget = this._nodes.get(event.currentTarget as HTMLElement)!;\n\n // Get the node which being focused after this blur.\n let focusTarget = event.relatedTarget as HTMLElement;\n\n // If no other node is being focused, clear the active widget.\n if (!focusTarget) {\n this._setWidgets(this._currentWidget, null);\n return;\n }\n\n // Bail if the focus widget is not changing.\n if (widget.node.contains(focusTarget)) {\n return;\n }\n\n // If no tracked widget is being focused, clear the active widget.\n if (!find(this._widgets, w => w.node.contains(focusTarget))) {\n this._setWidgets(this._currentWidget, null);\n return;\n }\n }\n\n /**\n * Handle the `disposed` signal for a tracked widget.\n */\n private _onWidgetDisposed(sender: T): void {\n this.remove(sender);\n }\n\n private _counter = 0;\n private _widgets: T[] = [];\n private _activeWidget: T | null = null;\n private _currentWidget: T | null = null;\n private _numbers = new Map();\n private _nodes = new Map();\n private _activeChanged = new Signal>(this);\n private _currentChanged = new Signal>(\n this\n );\n}\n\n/**\n * The namespace for the `FocusTracker` class statics.\n */\nexport namespace FocusTracker {\n /**\n * An arguments object for the changed signals.\n */\n export interface IChangedArgs {\n /**\n * The old value for the widget.\n */\n oldValue: T | null;\n\n /**\n * The new value for the widget.\n */\n newValue: T | null;\n }\n}\n"],"mappings":"2/BAoBaA,EAAbC,cAcEC,KAAQC,SAAG,EAeXD,KAAOE,QAAG,EAeVF,KAAOG,QAAGC,IAkBVJ,KAAOK,QAAG,EAcVL,KAAIM,KAAG,EAUPN,KAAIO,MAAG,C,EAMT,IAAiBC,EC+gCPC,EC1TAA,ECh0BOC,EH2GAF,gDA0XhB,KA3TiBG,KAAhB,SAAqBC,EAA6BC,GAEhD,IAAIC,EAAQF,EAAOG,OACnB,GAAc,IAAVD,EACF,OAAOD,EAIT,IAAIG,EAAW,EACXC,EAAW,EACXC,EAAY,EACZC,EAAe,EACfC,EAAe,EAGnB,IAAK,IAAIC,EAAI,EAAGA,EAAIP,IAASO,EAAG,CAC9B,IAAIC,EAAQV,EAAOS,GACfE,EAAMD,EAAMpB,QACZsB,EAAMF,EAAMnB,QACZsB,EAAOH,EAAMrB,SACjBqB,EAAMf,MAAO,EACbe,EAAMhB,KAAOoB,KAAKF,IAAID,EAAKG,KAAKH,IAAIE,EAAMD,IAC1CN,GAAaI,EAAMhB,KACnBU,GAAYO,EACZN,GAAYO,EACRF,EAAMjB,QAAU,IAClBc,GAAgBG,EAAMjB,QACtBe,IAEH,CAGD,GAAIP,IAAUK,EACZ,OAAO,EAIT,GAAIL,GAASG,EAAU,CACrB,IAAK,IAAIK,EAAI,EAAGA,EAAIP,IAASO,EAAG,CAC9B,IAAIC,EAAQV,EAAOS,GACnBC,EAAMhB,KAAOgB,EAAMpB,OACpB,CACD,OAAOW,EAAQG,CAChB,CAGD,GAAIH,GAASI,EAAU,CACrB,IAAK,IAAII,EAAI,EAAGA,EAAIP,IAASO,EAAG,CAC9B,IAAIC,EAAQV,EAAOS,GACnBC,EAAMhB,KAAOgB,EAAMnB,OACpB,CACD,OAAOU,EAAQI,CAChB,CAKD,IAAIU,EAAW,IAKXC,EAAed,EAGnB,GAAID,EAAQK,EAAW,CAOrB,IA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BsoB,gBACAmZ,iBACAxZ,eACAgX,mBAIErK,WAASC,SAAWD,WAASE,QAC/BxzB,cAAYyzB,O,CAOR2B,mBAAmB3iB,EAAwBoG,GACjD1e,KAAKsrB,cAAc/mB,KAAK+T,E,CAMlB0iB,wBACN1iB,EACAoG,GAEAA,EAAK9Y,MAAMlC,MAAM4E,U,CAMXwyB,qBACNxiB,EACAoG,GAEAA,EAAK9Y,MAAMlC,MAAM8E,O,CAMXoyB,YACNtiB,EACAoG,GAEA1e,KAAK4lC,aAAaz2B,aAAauP,EAAK3O,QAAS2O,EAAK9Y,MAAMlC,M,CAMlDmiC,iBAAiBvtB,EAAsB/Q,GAC7CA,EAAOpC,KAAK0F,gBAAgB,QAC5BtD,EAAOpC,KAAK0F,gBAAgB,mBAC5B7K,KAAKs0B,OAAOhH,UAAU/lB,EAAO3B,M"} +\ No newline at end of file ++{"version":3,"names":["BoxSizer","constructor","this","sizeHint","minSize","maxSize","Infinity","stretch","size","done","BoxEngine","Private","Utils","calc","sizers","space","count","length","totalMin","totalMax","totalSize","totalStretch","stretchCount","i","sizer","min","max","hint","Math","nearZero","notDoneCount","freeSpace","distSpace","distStretch","amt","adjust","index","delta","growLimit","shrinkLimit","n","grow","limit","shrink","growSizer","shrinkSizer","Title","options","_label","_caption","_mnemonic","_icon","undefined","_iconClass","_iconLabel","_className","_closable","_changed","Signal","_isDisposed","owner","label","mnemonic","icon","iconClass","iconLabel","caption","className","closable","_dataset","dataset","changed","value","emit","isDisposed","dispose","clearData","Widget","_flags","_layout","_parent","_disposed","_hiddenMode","HiddenMode","Display","node","createNode","addClass","setFlag","Flag","IsDisposed","parent","isAttached","detach","title","MessageLoop","AttachedProperty","disposed","testFlag","IsAttached","isHidden","IsHidden","isVisible","titleProperty","get","id","hiddenMode","_toggleHidden","Scale","style","willChange","contains","Error","msg","ChildMessage","sendMessage","Msg","ParentChanged","layout","DisallowLayout","children","widget","hasClass","name","classList","add","removeClass","remove","toggleClass","force","toggle","update","postMessage","UpdateRequest","fit","FitRequest","activate","ActivateRequest","close","CloseRequest","show","BeforeShow","clearFlag","AfterShow","hide","BeforeHide","AfterHide","setHidden","hidden","flag","processMessage","type","notifyLayout","onResize","onUpdateRequest","onFitRequest","onBeforeShow","IsVisible","onAfterShow","onBeforeHide","onAfterHide","onBeforeAttach","onAfterAttach","onBeforeDetach","onAfterDetach","onActivateRequest","onCloseRequest","onChildAdded","onChildRemoved","processParentMessage","transform","setAttribute","ContentVisibility","contentVisibility","zIndex","removeAttribute","Message","BeforeAttach","AfterAttach","BeforeDetach","AfterDetach","ConflatableMessage","child","super","ResizeMessage","width","height","UnknownSize","attach","host","ref","isConnected","insertBefore","parentNode","removeChild","create","document","createElement","tag","Layout","_fitPolicy","fitPolicy","init","minWidth","minHeight","maxWidth","maxHeight","onChildShown","onChildHidden","removeWidget","getHorizontalAlignment","horizontalAlignmentProperty","setHorizontalAlignment","set","getVerticalAlignment","verticalAlignmentProperty","setVerticalAlignment","LayoutItem","_top","NaN","_left","_width","_height","_minWidth","_minHeight","_maxWidth","_maxHeight","position","contain","top","left","limits","ElementExt","sizeLimits","clampW","clampH","resized","onAlignmentChanged","PanelLayout","_widgets","pop","widgets","Symbol","iterator","addWidget","insertWidget","indexOf","j","ArrayExt","insert","attachWidget","move","moveWidget","removeWidgetAt","removeAt","detachWidget","fromIndex","toIndex","clampDimension","floor","Utils$1","SplitLayout","widgetOffset","_fixed","_spacing","_dirty","_hasNormedSizes","_sizers","_items","_handles","_box","_alignment","_orientation","renderer","orientation","alignment","spacing","item","handles","absoluteSizes","map","relativeSizes","normalize","setRelativeSizes","sizes","temp","slice","push","normed","moveHandle","handle","offsetLeft","offsetTop","createHandle","average","averageSize","createSizer","appendChild","_update","_fit","updateItemPosition","isHorizontal","handleStyle","nVisible","lastHandleIndex","horz","minW","minH","getStretch","box","boxSizing","horizontalSum","verticalSum","offsetWidth","offsetHeight","paddingTop","paddingLeft","extra","offset","fullOffset","stretchProperty","setStretch","coerce","reduce","v","s","values","sum","a","b","abs","AccordionLayout","_titles","titleSpace","titles","updateTitle","oldTitle","expanded","newTitle","createTitle","replaceChild","UUID","uuid4","titleStyle","data","createSectionTitle","Panel","createLayout","SplitPanel","_handleMoved","_pressData","_releaseMouse","handleMoved","handleEvent","event","_evtPointerDown","_evtPointerMove","_evtPointerUp","_evtKeyDown","preventDefault","stopPropagation","addEventListener","removeEventListener","keyCode","button","findFirstIndex","target","rect","getBoundingClientRect","clientX","clientY","window","getComputedStyle","override","Drag","overrideCursor","cursor","pos","Renderer","defaultRenderer","AccordionPanel","_widgetSizesCache","WeakMap","_expansionToggled","expansionToggled","connect","_onTitleChanged","collapse","_toggleExpansion","expand","_evtClick","_eventKeyDown","sender","_computeWidgetSize","widgetSizes","prev","curr","newSize","previousSize","widgetToCollapse","sz","lastIndexOf","forEach","_","idx","currentSize","defaultPrevented","handled","toString","key","match","click","direction","newIndex","focus","titleClassName","_titleID","_titleKeys","_uuid","_nInstance","createCollapseIcon","createTitleKey","aData","textContent","BoxLayout","_direction","getSizeBasis","sizeBasisProperty","setSizeBasis","onChildSizingChanged","dir","clampSpacing","BoxPanel","CommandPalette","_activeIndex","_results","commands","commandChanged","_onGenericChange","keyBindingChanged","searchNode","getElementsByClassName","inputNode","contentNode","items","addItem","createItem","refresh","addItems","newItems","removeItem","removeItemAt","clearItems","display","_toggleFocused","input","select","VirtualDOM","render","query","results","search","canActivate","content","renderEmptyMessage","activeIndex","Array","result","indices","category","renderHeader","active","renderItem","scrollTop","element","scrollIntoViewIfNeeded","_execute","altKey","ctrlKey","metaKey","shiftKey","_activatePreviousItem","_activateNextItem","ai","start","stop","findLastIndex","part","toLowerCase","isEnabled","execute","command","args","focused","activeElement","formatHeader","h","li","createItemClass","createItemDataset","isToggleable","role","isToggled","renderItemIcon","renderItemContent","renderItemShortcut","formatEmptyMessage","createIconClass","div","renderItemLabel","renderItemCaption","formatItemLabel","formatItemCaption","formatItemShortcut","StringExt","highlight","mark","kb","keyBinding","CommandRegistry","formatKeystroke","keys","fuzzySearch","source","score","rgx","rgxMatch","exec","matchSumOfDeltas","pivot","lowerBound","categoryIndices","labelIndices","matchType","scoreCmp","m1","d1","i1","i2","d2","localeCompare","r1","rank","r2","wrapper","clear","spellcheck","CommandItem","scores","text","replace","matchItems","sort","createResults","_commands","trim","JSONExt","emptyObject","findLastValue","keyBindings","deepEqual","Menu","_childIndex","_openTimerID","_closeTimerID","_childMenu","_parentMenu","_aboutToClose","_menuRequested","aboutToClose","menuRequested","parentMenu","childMenu","rootMenu","menu","leafMenu","activeItem","childNodes","activateNextItem","activatePreviousItem","triggerActiveItem","_cancelOpenTimer","_cancelCloseTimer","_openChildMenu","console","log","insertItem","open","x","y","forceX","forceY","_a","_b","horizontalAlignment","_c","documentElement","openRootMenu","_evtMouseUp","_evtMouseMove","_evtMouseEnter","_evtMouseLeave","_evtMouseDown","ownerDocument","collapsedFlags","computeCollapsed","collapsed","onfocus","kc","getKeyboardLayout","keyForKeydownEvent","findMnemonic","multiple","auto","hitTest","_startCloseTimer","submenu","_startOpenTimer","hitTestMenus","activateFirst","_closeChildMenu","saveWindowData","itemNode","openSubmenu","setTimeout","TIMER_DELAY","clearTimeout","static","aria","createItemARIA","tabindex","renderIcon","renderLabel","renderShortcut","renderSubmenu","formatLabel","formatShortcut","prefix","suffix","char","span","getWindowData","pageXOffset","defaultView","scrollX","pageYOffset","scrollY","clientWidth","clientHeight","_getWindowData","SUBMENU_OVERLAP","tabIndex","MenuItem","fill","k1","k2","windowData","px","py","cw","ch","opacity","body","itemRect","right","borderTop","bottom","borderBottom","paddingBottom","upperKey","toUpperCase","k","mn","itemCmpRank","itemCmp","s1","Selector","calculateSpecificity","selector","s2","isValid","validateSelector","groupByTarget","sortBySelector","currentTarget","elementFromPoint","availableItems","matches","parentElement","ARROW_KEYS","TabBar","_currentIndex","_titlesEditable","_previousTitle","_dragData","_addButtonEnabled","_tabMoved","_currentChanged","_addRequested","_tabCloseRequested","_tabDetachRequested","_tabActivateRequested","_document","tabsMovable","titlesEditable","allowDeselect","addButtonEnabled","insertBehavior","removeBehavior","currentChanged","tabMoved","tabActivateRequested","addRequested","tabCloseRequested","tabDetachRequested","currentTitle","currentIndex","pi","pt","ci","ct","previousIndex","previousTitle","_name","addButtonNode","addTab","insertTab","asTitle","_adjustCurrentForInsert","_adjustCurrentForMove","removeTab","removeTabAt","disconnect","_adjustCurrentForRemove","clearTabs","releaseMouse","_evtDblClick","eventPhase","Event","CAPTURING_PHASE","_evtKeyDownCapturing","tabHandlingTabindex","_getCurrentTabindex","current","renderTab","elemTabindex","querySelector","getAttribute","tabs","tab","oldValue","innerHTML","onblur","focusedElement","includes","focusable","nextFocused","focusedIndex","addButtonClicked","pressX","pressY","tabPos","tabSize","tabPressPos","targetIndex","tabLayout","contentRect","dragActive","dragAborted","detachRequested","closeIconSelector","dragExceeded","tabRect","tabPressOffset","snapTabLayout","detachExceeded","layoutTabs","finalizeTabPosition","duration","parseTransitionDuration","resetTabPositions","bh","_tabID","_tabKeys","createTabKey","createTabStyle","createTabClass","createTabDataset","createTabARIA","renderCloseIcon","addButtonSelector","DRAG_THRESHOLD","DETACH_THRESHOLD","parseFloat","transitionDuration","margin","marginLeft","marginTop","dx","dy","pressPos","localPos","clientPos","clientSize","targetPos","targetEnd","pxPos","threshold","ideal","tgt","final","DockLayout","_root","Map","bar","tabBars","isEmpty","iterAllWidgets","empty","iterUserWidgets","selectedWidgets","iterSelectedWidgets","iterTabBars","iterHandles","offsetX","offsetY","findSplitNode","holdSizes","saveLayout","holdAllSizes","main","createConfig","restoreLayout","config","mainConfig","widgetSet","Set","normalizeAreaConfig","oldWidgets","oldTabBars","oldHandles","has","tabBar","realizeAreaConfig","createTabBar","_createTabBar","_createHandle","mode","refNode","findTabNode","_insertTab","_insertSplit","_removeWidget","hitTestTabAreas","borderLeft","tabNode","hitTestTabNodes","borderWidth","borderRight","borderHeight","delete","removeAria","splitNode","removeFirstOf","syncHandles","maybeParent","childNode","childHandle","TabLayoutNode","splitHandle","gChild","gHandle","gSizer","_createTabNode","addAria","after","findFirstTabNode","merge","root","_splitRoot","normalizeSizes","GOLDEN_RATIO","sibling","SplitLayoutNode","normalized","oldRoot","newRoot","normalizeTabAreaConfig","normalizeSplitAreaConfig","realizeTabAreaConfig","realizeSplitAreaConfig","tabSizer","widgetSizer","tabBarItem","widgetItem","tabBarSizer","createNormalizedSizes","horizontal","fixed","tabId","DockPanel","_drag","_tabsMovable","_tabsConstrained","_layoutModified","_mode","_renderer","_edges","edges","DEFAULT_EDGES","tabsConstrained","overlay","Overlay","layoutModified","createSingleDocumentConfig","LayoutModified","selectWidget","find","activateWidget","Platform","IS_EDGE","IS_IE","flush","_evtDragEnter","_evtDragLeave","_evtDragOver","_evtDrop","isGeneratedTabBarProperty","mimeData","hasData","_showOverlay","dropAction","proposedAction","zone","findDropTarget","factory","getData","getDropRef","deltaX","deltaY","xPos","yPos","paddingRight","tabHeight","_onTabMoved","_onCurrentChanged","_onTabCloseRequested","_onTabDetachRequested","_onTabActivateRequested","_onTabAddRequested","MimeData","setData","dragImage","cloneNode","supportedActions","then","_timer","_hidden","geo","delay","panel","from","selected","next","panelRect","pl","pr","pb","al","at","ar","ab","rx","round","ry","GridLayout","_rowSpacing","_columnSpacing","_rowStarts","_columnStarts","_rowSizers","_columnSizers","rowCount","reallocSizers","columnCount","rowSpacing","clampValue","columnSpacing","rowStretch","setRowStretch","columnStretch","setColumnStretch","it","filter","maxRow","maxCol","rowSpanCmp","getCellConfig","row","rowSpan","distributeMin","columnSpanCmp","c1","column","c2","columnSpan","fixedRowSpace","fixedColSpace","w","cellConfigProperty","setCellConfig","normalizeConfig","portion","MenuBar","_tabFocusIndex","_menus","_overflowMenu","_menuItemSizes","_overflowIndex","_forceItemsPosition","forceItemsPosition","_overflowMenuOptions","overflowMenuOptions","overflowIndex","overflowMenu","activeMenu","menus","openActiveMenu","addMenu","insertMenu","_onMenuAboutToClose","_onMenuMenuRequested","removeMenu","removeMenuAt","clearMenus","_evtFocusOut","_focusItemAt","tabFocusIndex","totalMenuSize","tabbable","disabled","overflowMenuTitle","overflowMenuItems","screenSize","_updateOverflowIndex","itemMenus","stopImmediatePropagation","_positionForMenu","relatedTarget","newMenu","oldMenu","decrement","increment","track","thumb","findPart","scrollBar","thumbNode","trackNode","decrementNode","incrementNode","SingletonLayout","_widget","StackedLayout","StackedPanel","_widgetRemoved","widgetRemoved","orientationFromPlacement","plc","placementToOrientationMap","directionFromPlacement","placementToDirectionMap","_groupByTarget","_idTick","_sortBySelector","others","DisposableDelegate","_counter","_activeWidget","_currentWidget","_numbers","_nodes","_activeChanged","activeChanged","currentWidget","activeWidget","focusNumber","_onWidgetDisposed","_setWidgets","valid","previous","first","second","_evtFocus","_evtBlur","oldCurrent","oldActive","newValue","focusTarget","_onRepeat","_repeatTimer","mouseX","mouseY","thumbRect","_pageRequested","_stepRequested","_value","_page","_maximum","_thumbMoved","maximum","page","thumbMoved","stepRequested","pageRequested","thumbStyle","_moveThumb","trackPos","trackSpan","trackRect","stackedPanel","_onWidgetRemoved","_tabPlacement","tabPlacement","previousWidget"],"sources":["../src/boxengine.ts","../src/widget.ts","../src/layout.ts","../src/utils.ts","../src/title.ts","../src/panellayout.ts","../src/splitlayout.ts","../src/accordionlayout.ts","../src/panel.ts","../src/splitpanel.ts","../src/accordionpanel.ts","../src/boxlayout.ts","../src/boxpanel.ts","../src/commandpalette.ts","../src/menu.ts","../src/contextmenu.ts","../src/tabbar.ts","../src/docklayout.ts","../src/dockpanel.ts","../src/gridlayout.ts","../src/menubar.ts","../src/scrollbar.ts","../src/stackedpanel.ts","../src/tabpanel.ts","../src/singletonlayout.ts","../src/stackedlayout.ts","../src/focustracker.ts"],"sourcesContent":["// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n\n/**\n * A sizer object for use with the box engine layout functions.\n *\n * #### Notes\n * A box sizer holds the geometry information for an object along an\n * arbitrary layout orientation.\n *\n * For best performance, this class should be treated as a raw data\n * struct. It should not typically be subclassed.\n */\nexport class BoxSizer {\n /**\n * The preferred size for the sizer.\n *\n * #### Notes\n * The sizer will be given this initial size subject to its size\n * bounds. The sizer will not deviate from this size unless such\n * deviation is required to fit into the available layout space.\n *\n * There is no limit to this value, but it will be clamped to the\n * bounds defined by {@link minSize} and {@link maxSize}.\n *\n * The default value is `0`.\n */\n sizeHint = 0;\n\n /**\n * The minimum size of the sizer.\n *\n * #### Notes\n * The sizer will never be sized less than this value, even if\n * it means the sizer will overflow the available layout space.\n *\n * It is assumed that this value lies in the range `[0, Infinity)`\n * and that it is `<=` to {@link maxSize}. Failure to adhere to this\n * constraint will yield undefined results.\n *\n * The default value is `0`.\n */\n minSize = 0;\n\n /**\n * The maximum size of the sizer.\n *\n * #### Notes\n * The sizer will never be sized greater than this value, even if\n * it means the sizer will underflow the available layout space.\n *\n * It is assumed that this value lies in the range `[0, Infinity]`\n * and that it is `>=` to {@link minSize}. Failure to adhere to this\n * constraint will yield undefined results.\n *\n * The default value is `Infinity`.\n */\n maxSize = Infinity;\n\n /**\n * The stretch factor for the sizer.\n *\n * #### Notes\n * This controls how much the sizer stretches relative to its sibling\n * sizers when layout space is distributed. A stretch factor of zero\n * is special and will cause the sizer to only be resized after all\n * other sizers with a stretch factor greater than zero have been\n * resized to their limits.\n *\n * It is assumed that this value is an integer that lies in the range\n * `[0, Infinity)`. Failure to adhere to this constraint will yield\n * undefined results.\n *\n * The default value is `1`.\n */\n stretch = 1;\n\n /**\n * The computed size of the sizer.\n *\n * #### Notes\n * This value is the output of a call to {@link BoxEngine.calc}. It represents\n * the computed size for the object along the layout orientation,\n * and will always lie in the range `[minSize, maxSize]`.\n *\n * This value is output only.\n *\n * Changing this value will have no effect.\n */\n size = 0;\n\n /**\n * An internal storage property for the layout algorithm.\n *\n * #### Notes\n * This value is used as temporary storage by the layout algorithm.\n *\n * Changing this value will have no effect.\n */\n done = false;\n}\n\n/**\n * The namespace for the box engine layout functions.\n */\nexport namespace BoxEngine {\n /**\n * Calculate the optimal layout sizes for a sequence of box sizers.\n *\n * This distributes the available layout space among the box sizers\n * according to the following algorithm:\n *\n * 1. Initialize the sizers's size to its size hint and compute the\n * sums for each of size hint, min size, and max size.\n *\n * 2. If the total size hint equals the available space, return.\n *\n * 3. If the available space is less than the total min size, set all\n * sizers to their min size and return.\n *\n * 4. If the available space is greater than the total max size, set\n * all sizers to their max size and return.\n *\n * 5. If the layout space is less than the total size hint, distribute\n * the negative delta as follows:\n *\n * a. Shrink each sizer with a stretch factor greater than zero by\n * an amount proportional to the negative space and the sum of\n * stretch factors. If the sizer reaches its min size, remove\n * it and its stretch factor from the computation.\n *\n * b. If after adjusting all stretch sizers there remains negative\n * space, distribute the space equally among the sizers with a\n * stretch factor of zero. If a sizer reaches its min size,\n * remove it from the computation.\n *\n * 6. If the layout space is greater than the total size hint,\n * distribute the positive delta as follows:\n *\n * a. Expand each sizer with a stretch factor greater than zero by\n * an amount proportional to the postive space and the sum of\n * stretch factors. If the sizer reaches its max size, remove\n * it and its stretch factor from the computation.\n *\n * b. If after adjusting all stretch sizers there remains positive\n * space, distribute the space equally among the sizers with a\n * stretch factor of zero. If a sizer reaches its max size,\n * remove it from the computation.\n *\n * 7. return\n *\n * @param sizers - The sizers for a particular layout line.\n *\n * @param space - The available layout space for the sizers.\n *\n * @returns The delta between the provided available space and the\n * actual consumed space. This value will be zero if the sizers\n * can be adjusted to fit, negative if the available space is too\n * small, and positive if the available space is too large.\n *\n * #### Notes\n * The {@link BoxSizer.size} of each sizer is updated with the computed size.\n *\n * This function can be called at any time to recompute the layout for\n * an existing sequence of sizers. The previously computed results will\n * have no effect on the new output. It is therefore not necessary to\n * create new sizer objects on each resize event.\n */\n export function calc(sizers: ArrayLike, space: number): number {\n // Bail early if there is nothing to do.\n let count = sizers.length;\n if (count === 0) {\n return space;\n }\n\n // Setup the size and stretch counters.\n let totalMin = 0;\n let totalMax = 0;\n let totalSize = 0;\n let totalStretch = 0;\n let stretchCount = 0;\n\n // Setup the sizers and compute the totals.\n for (let i = 0; i < count; ++i) {\n let sizer = sizers[i];\n let min = sizer.minSize;\n let max = sizer.maxSize;\n let hint = sizer.sizeHint;\n sizer.done = false;\n sizer.size = Math.max(min, Math.min(hint, max));\n totalSize += sizer.size;\n totalMin += min;\n totalMax += max;\n if (sizer.stretch > 0) {\n totalStretch += sizer.stretch;\n stretchCount++;\n }\n }\n\n // If the space is equal to the total size, return early.\n if (space === totalSize) {\n return 0;\n }\n\n // If the space is less than the total min, minimize each sizer.\n if (space <= totalMin) {\n for (let i = 0; i < count; ++i) {\n let sizer = sizers[i];\n sizer.size = sizer.minSize;\n }\n return space - totalMin;\n }\n\n // If the space is greater than the total max, maximize each sizer.\n if (space >= totalMax) {\n for (let i = 0; i < count; ++i) {\n let sizer = sizers[i];\n sizer.size = sizer.maxSize;\n }\n return space - totalMax;\n }\n\n // The loops below perform sub-pixel precision sizing. A near zero\n // value is used for compares instead of zero to ensure that the\n // loop terminates when the subdivided space is reasonably small.\n let nearZero = 0.01;\n\n // A counter which is decremented each time a sizer is resized to\n // its limit. This ensures the loops terminate even if there is\n // space remaining to distribute.\n let notDoneCount = count;\n\n // Distribute negative delta space.\n if (space < totalSize) {\n // Shrink each stretchable sizer by an amount proportional to its\n // stretch factor. If a sizer reaches its min size it's marked as\n // done. The loop progresses in phases where each sizer is given\n // a chance to consume its fair share for the pass, regardless of\n // whether a sizer before it reached its limit. This continues\n // until the stretchable sizers or the free space is exhausted.\n let freeSpace = totalSize - space;\n while (stretchCount > 0 && freeSpace > nearZero) {\n let distSpace = freeSpace;\n let distStretch = totalStretch;\n for (let i = 0; i < count; ++i) {\n let sizer = sizers[i];\n if (sizer.done || sizer.stretch === 0) {\n continue;\n }\n let amt = (sizer.stretch * distSpace) / distStretch;\n if (sizer.size - amt <= sizer.minSize) {\n freeSpace -= sizer.size - sizer.minSize;\n totalStretch -= sizer.stretch;\n sizer.size = sizer.minSize;\n sizer.done = true;\n notDoneCount--;\n stretchCount--;\n } else {\n freeSpace -= amt;\n sizer.size -= amt;\n }\n }\n }\n // Distribute any remaining space evenly among the non-stretchable\n // sizers. This progresses in phases in the same manner as above.\n while (notDoneCount > 0 && freeSpace > nearZero) {\n let amt = freeSpace / notDoneCount;\n for (let i = 0; i < count; ++i) {\n let sizer = sizers[i];\n if (sizer.done) {\n continue;\n }\n if (sizer.size - amt <= sizer.minSize) {\n freeSpace -= sizer.size - sizer.minSize;\n sizer.size = sizer.minSize;\n sizer.done = true;\n notDoneCount--;\n } else {\n freeSpace -= amt;\n sizer.size -= amt;\n }\n }\n }\n }\n // Distribute positive delta space.\n else {\n // Expand each stretchable sizer by an amount proportional to its\n // stretch factor. If a sizer reaches its max size it's marked as\n // done. The loop progresses in phases where each sizer is given\n // a chance to consume its fair share for the pass, regardless of\n // whether a sizer before it reached its limit. This continues\n // until the stretchable sizers or the free space is exhausted.\n let freeSpace = space - totalSize;\n while (stretchCount > 0 && freeSpace > nearZero) {\n let distSpace = freeSpace;\n let distStretch = totalStretch;\n for (let i = 0; i < count; ++i) {\n let sizer = sizers[i];\n if (sizer.done || sizer.stretch === 0) {\n continue;\n }\n let amt = (sizer.stretch * distSpace) / distStretch;\n if (sizer.size + amt >= sizer.maxSize) {\n freeSpace -= sizer.maxSize - sizer.size;\n totalStretch -= sizer.stretch;\n sizer.size = sizer.maxSize;\n sizer.done = true;\n notDoneCount--;\n stretchCount--;\n } else {\n freeSpace -= amt;\n sizer.size += amt;\n }\n }\n }\n // Distribute any remaining space evenly among the non-stretchable\n // sizers. This progresses in phases in the same manner as above.\n while (notDoneCount > 0 && freeSpace > nearZero) {\n let amt = freeSpace / notDoneCount;\n for (let i = 0; i < count; ++i) {\n let sizer = sizers[i];\n if (sizer.done) {\n continue;\n }\n if (sizer.size + amt >= sizer.maxSize) {\n freeSpace -= sizer.maxSize - sizer.size;\n sizer.size = sizer.maxSize;\n sizer.done = true;\n notDoneCount--;\n } else {\n freeSpace -= amt;\n sizer.size += amt;\n }\n }\n }\n }\n\n // Indicate that the consumed space equals the available space.\n return 0;\n }\n\n /**\n * Adjust a sizer by a delta and update its neighbors accordingly.\n *\n * @param sizers - The sizers which should be adjusted.\n *\n * @param index - The index of the sizer to grow.\n *\n * @param delta - The amount to adjust the sizer, positive or negative.\n *\n * #### Notes\n * This will adjust the indicated sizer by the specified amount, along\n * with the sizes of the appropriate neighbors, subject to the limits\n * specified by each of the sizers.\n *\n * This is useful when implementing box layouts where the boundaries\n * between the sizers are interactively adjustable by the user.\n */\n export function adjust(\n sizers: ArrayLike,\n index: number,\n delta: number\n ): void {\n // Bail early when there is nothing to do.\n if (sizers.length === 0 || delta === 0) {\n return;\n }\n\n // Dispatch to the proper implementation.\n if (delta > 0) {\n growSizer(sizers, index, delta);\n } else {\n shrinkSizer(sizers, index, -delta);\n }\n }\n\n /**\n * Grow a sizer by a positive delta and adjust neighbors.\n */\n function growSizer(\n sizers: ArrayLike,\n index: number,\n delta: number\n ): void {\n // Compute how much the items to the left can expand.\n let growLimit = 0;\n for (let i = 0; i <= index; ++i) {\n let sizer = sizers[i];\n growLimit += sizer.maxSize - sizer.size;\n }\n\n // Compute how much the items to the right can shrink.\n let shrinkLimit = 0;\n for (let i = index + 1, n = sizers.length; i < n; ++i) {\n let sizer = sizers[i];\n shrinkLimit += sizer.size - sizer.minSize;\n }\n\n // Clamp the delta adjustment to the limits.\n delta = Math.min(delta, growLimit, shrinkLimit);\n\n // Grow the sizers to the left by the delta.\n let grow = delta;\n for (let i = index; i >= 0 && grow > 0; --i) {\n let sizer = sizers[i];\n let limit = sizer.maxSize - sizer.size;\n if (limit >= grow) {\n sizer.sizeHint = sizer.size + grow;\n grow = 0;\n } else {\n sizer.sizeHint = sizer.size + limit;\n grow -= limit;\n }\n }\n\n // Shrink the sizers to the right by the delta.\n let shrink = delta;\n for (let i = index + 1, n = sizers.length; i < n && shrink > 0; ++i) {\n let sizer = sizers[i];\n let limit = sizer.size - sizer.minSize;\n if (limit >= shrink) {\n sizer.sizeHint = sizer.size - shrink;\n shrink = 0;\n } else {\n sizer.sizeHint = sizer.size - limit;\n shrink -= limit;\n }\n }\n }\n\n /**\n * Shrink a sizer by a positive delta and adjust neighbors.\n */\n function shrinkSizer(\n sizers: ArrayLike,\n index: number,\n delta: number\n ): void {\n // Compute how much the items to the right can expand.\n let growLimit = 0;\n for (let i = index + 1, n = sizers.length; i < n; ++i) {\n let sizer = sizers[i];\n growLimit += sizer.maxSize - sizer.size;\n }\n\n // Compute how much the items to the left can shrink.\n let shrinkLimit = 0;\n for (let i = 0; i <= index; ++i) {\n let sizer = sizers[i];\n shrinkLimit += sizer.size - sizer.minSize;\n }\n\n // Clamp the delta adjustment to the limits.\n delta = Math.min(delta, growLimit, shrinkLimit);\n\n // Grow the sizers to the right by the delta.\n let grow = delta;\n for (let i = index + 1, n = sizers.length; i < n && grow > 0; ++i) {\n let sizer = sizers[i];\n let limit = sizer.maxSize - sizer.size;\n if (limit >= grow) {\n sizer.sizeHint = sizer.size + grow;\n grow = 0;\n } else {\n sizer.sizeHint = sizer.size + limit;\n grow -= limit;\n }\n }\n\n // Shrink the sizers to the left by the delta.\n let shrink = delta;\n for (let i = index; i >= 0 && shrink > 0; --i) {\n let sizer = sizers[i];\n let limit = sizer.size - sizer.minSize;\n if (limit >= shrink) {\n sizer.sizeHint = sizer.size - shrink;\n shrink = 0;\n } else {\n sizer.sizeHint = sizer.size - limit;\n shrink -= limit;\n }\n }\n }\n}\n","/* eslint-disable @typescript-eslint/no-empty-function */\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { IObservableDisposable } from '@lumino/disposable';\n\nimport {\n ConflatableMessage,\n IMessageHandler,\n Message,\n MessageLoop\n} from '@lumino/messaging';\n\nimport { AttachedProperty } from '@lumino/properties';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { Layout } from './layout';\n\nimport { Title } from './title';\n\n/**\n * The base class of the lumino widget hierarchy.\n *\n * #### Notes\n * This class will typically be subclassed in order to create a useful\n * widget. However, it can be used directly to host externally created\n * content.\n */\nexport class Widget implements IMessageHandler, IObservableDisposable {\n /**\n * Construct a new widget.\n *\n * @param options - The options for initializing the widget.\n */\n constructor(options: Widget.IOptions = {}) {\n this.node = Private.createNode(options);\n this.addClass('lm-Widget');\n }\n\n /**\n * Dispose of the widget and its descendant widgets.\n *\n * #### Notes\n * It is unsafe to use the widget after it has been disposed.\n *\n * All calls made to this method after the first are a no-op.\n */\n dispose(): void {\n // Do nothing if the widget is already disposed.\n if (this.isDisposed) {\n return;\n }\n\n // Set the disposed flag and emit the disposed signal.\n this.setFlag(Widget.Flag.IsDisposed);\n this._disposed.emit(undefined);\n\n // Remove or detach the widget if necessary.\n if (this.parent) {\n this.parent = null;\n } else if (this.isAttached) {\n Widget.detach(this);\n }\n\n // Dispose of the widget layout.\n if (this._layout) {\n this._layout.dispose();\n this._layout = null;\n }\n\n // Dispose the title\n this.title.dispose();\n\n // Clear the extra data associated with the widget.\n Signal.clearData(this);\n MessageLoop.clearData(this);\n AttachedProperty.clearData(this);\n }\n\n /**\n * A signal emitted when the widget is disposed.\n */\n get disposed(): ISignal {\n return this._disposed;\n }\n\n /**\n * Get the DOM node owned by the widget.\n */\n readonly node: HTMLElement;\n\n /**\n * Test whether the widget has been disposed.\n */\n get isDisposed(): boolean {\n return this.testFlag(Widget.Flag.IsDisposed);\n }\n\n /**\n * Test whether the widget's node is attached to the DOM.\n */\n get isAttached(): boolean {\n return this.testFlag(Widget.Flag.IsAttached);\n }\n\n /**\n * Test whether the widget is explicitly hidden.\n *\n * #### Notes\n * You should prefer `!{@link isVisible}` over `{@link isHidden}` if you want to know if the\n * widget is hidden as this does not test if the widget is hidden because one of its ancestors is hidden.\n */\n get isHidden(): boolean {\n return this.testFlag(Widget.Flag.IsHidden);\n }\n\n /**\n * Test whether the widget is visible.\n *\n * #### Notes\n * A widget is visible when it is attached to the DOM, is not\n * explicitly hidden, and has no explicitly hidden ancestors.\n *\n * Since 2.7.0, this does not rely on the {@link Widget.Flag.IsVisible} flag.\n * It recursively checks the visibility of all parent widgets.\n */\n get isVisible(): boolean {\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n let parent: Widget | null = this;\n do {\n if (parent.isHidden || !parent.isAttached) {\n return false;\n }\n parent = parent.parent;\n } while (parent != null);\n return true;\n }\n\n /**\n * The title object for the widget.\n *\n * #### Notes\n * The title object is used by some container widgets when displaying\n * the widget alongside some title, such as a tab panel or side bar.\n *\n * Since not all widgets will use the title, it is created on demand.\n *\n * The `owner` property of the title is set to this widget.\n */\n get title(): Title {\n return Private.titleProperty.get(this);\n }\n\n /**\n * Get the id of the widget's DOM node.\n */\n get id(): string {\n return this.node.id;\n }\n\n /**\n * Set the id of the widget's DOM node.\n */\n set id(value: string) {\n this.node.id = value;\n }\n\n /**\n * The dataset for the widget's DOM node.\n */\n get dataset(): DOMStringMap {\n return this.node.dataset;\n }\n\n /**\n * Get the method for hiding the widget.\n */\n get hiddenMode(): Widget.HiddenMode {\n return this._hiddenMode;\n }\n\n /**\n * Set the method for hiding the widget.\n */\n set hiddenMode(value: Widget.HiddenMode) {\n if (this._hiddenMode === value) {\n return;\n }\n\n if (this.isHidden) {\n // Reset styles set by previous mode.\n this._toggleHidden(false);\n }\n\n if (value == Widget.HiddenMode.Scale) {\n this.node.style.willChange = 'transform';\n } else {\n this.node.style.willChange = 'auto';\n }\n\n this._hiddenMode = value;\n\n if (this.isHidden) {\n // Set styles for new mode.\n this._toggleHidden(true);\n }\n }\n\n /**\n * Get the parent of the widget.\n */\n get parent(): Widget | null {\n return this._parent;\n }\n\n /**\n * Set the parent of the widget.\n *\n * #### Notes\n * Children are typically added to a widget by using a layout, which\n * means user code will not normally set the parent widget directly.\n *\n * The widget will be automatically removed from its old parent.\n *\n * This is a no-op if there is no effective parent change.\n */\n set parent(value: Widget | null) {\n if (this._parent === value) {\n return;\n }\n if (value && this.contains(value)) {\n throw new Error('Invalid parent widget.');\n }\n if (this._parent && !this._parent.isDisposed) {\n let msg = new Widget.ChildMessage('child-removed', this);\n MessageLoop.sendMessage(this._parent, msg);\n }\n this._parent = value;\n if (this._parent && !this._parent.isDisposed) {\n let msg = new Widget.ChildMessage('child-added', this);\n MessageLoop.sendMessage(this._parent, msg);\n }\n if (!this.isDisposed) {\n MessageLoop.sendMessage(this, Widget.Msg.ParentChanged);\n }\n }\n\n /**\n * Get the layout for the widget.\n */\n get layout(): Layout | null {\n return this._layout;\n }\n\n /**\n * Set the layout for the widget.\n *\n * #### Notes\n * The layout is single-use only. It cannot be changed after the\n * first assignment.\n *\n * The layout is disposed automatically when the widget is disposed.\n */\n set layout(value: Layout | null) {\n if (this._layout === value) {\n return;\n }\n if (this.testFlag(Widget.Flag.DisallowLayout)) {\n throw new Error('Cannot set widget layout.');\n }\n if (this._layout) {\n throw new Error('Cannot change widget layout.');\n }\n if (value!.parent) {\n throw new Error('Cannot change layout parent.');\n }\n this._layout = value;\n value!.parent = this;\n }\n\n /**\n * Create an iterator over the widget's children.\n *\n * @returns A new iterator over the children of the widget.\n *\n * #### Notes\n * The widget must have a populated layout in order to have children.\n *\n * If a layout is not installed, the returned iterator will be empty.\n */\n *children(): IterableIterator {\n if (this._layout) {\n yield* this._layout;\n }\n }\n\n /**\n * Test whether a widget is a descendant of this widget.\n *\n * @param widget - The descendant widget of interest.\n *\n * @returns `true` if the widget is a descendant, `false` otherwise.\n */\n contains(widget: Widget): boolean {\n for (let value: Widget | null = widget; value; value = value._parent) {\n if (value === this) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * Test whether the widget's DOM node has the given class name.\n *\n * @param name - The class name of interest.\n *\n * @returns `true` if the node has the class, `false` otherwise.\n */\n hasClass(name: string): boolean {\n return this.node.classList.contains(name);\n }\n\n /**\n * Add a class name to the widget's DOM node.\n *\n * @param name - The class name to add to the node.\n *\n * #### Notes\n * If the class name is already added to the node, this is a no-op.\n *\n * The class name must not contain whitespace.\n */\n addClass(name: string): void {\n this.node.classList.add(name);\n }\n\n /**\n * Remove a class name from the widget's DOM node.\n *\n * @param name - The class name to remove from the node.\n *\n * #### Notes\n * If the class name is not yet added to the node, this is a no-op.\n *\n * The class name must not contain whitespace.\n */\n removeClass(name: string): void {\n this.node.classList.remove(name);\n }\n\n /**\n * Toggle a class name on the widget's DOM node.\n *\n * @param name - The class name to toggle on the node.\n *\n * @param force - Whether to force add the class (`true`) or force\n * remove the class (`false`). If not provided, the presence of\n * the class will be toggled from its current state.\n *\n * @returns `true` if the class is now present, `false` otherwise.\n *\n * #### Notes\n * The class name must not contain whitespace.\n */\n toggleClass(name: string, force?: boolean): boolean {\n if (force === true) {\n this.node.classList.add(name);\n return true;\n }\n if (force === false) {\n this.node.classList.remove(name);\n return false;\n }\n return this.node.classList.toggle(name);\n }\n\n /**\n * Post an `'update-request'` message to the widget.\n *\n * #### Notes\n * This is a simple convenience method for posting the message.\n */\n update(): void {\n MessageLoop.postMessage(this, Widget.Msg.UpdateRequest);\n }\n\n /**\n * Post a `'fit-request'` message to the widget.\n *\n * #### Notes\n * This is a simple convenience method for posting the message.\n */\n fit(): void {\n MessageLoop.postMessage(this, Widget.Msg.FitRequest);\n }\n\n /**\n * Post an `'activate-request'` message to the widget.\n *\n * #### Notes\n * This is a simple convenience method for posting the message.\n */\n activate(): void {\n MessageLoop.postMessage(this, Widget.Msg.ActivateRequest);\n }\n\n /**\n * Send a `'close-request'` message to the widget.\n *\n * #### Notes\n * This is a simple convenience method for sending the message.\n */\n close(): void {\n MessageLoop.sendMessage(this, Widget.Msg.CloseRequest);\n }\n\n /**\n * Show the widget and make it visible to its parent widget.\n *\n * #### Notes\n * This causes the {@link isHidden} property to be `false`.\n *\n * If the widget is not explicitly hidden, this is a no-op.\n */\n show(): void {\n if (!this.testFlag(Widget.Flag.IsHidden)) {\n return;\n }\n if (this.isAttached && (!this.parent || this.parent.isVisible)) {\n MessageLoop.sendMessage(this, Widget.Msg.BeforeShow);\n }\n this.clearFlag(Widget.Flag.IsHidden);\n this._toggleHidden(false);\n\n if (this.isAttached && (!this.parent || this.parent.isVisible)) {\n MessageLoop.sendMessage(this, Widget.Msg.AfterShow);\n }\n if (this.parent) {\n let msg = new Widget.ChildMessage('child-shown', this);\n MessageLoop.sendMessage(this.parent, msg);\n }\n }\n\n /**\n * Hide the widget and make it hidden to its parent widget.\n *\n * #### Notes\n * This causes the {@link isHidden} property to be `true`.\n *\n * If the widget is explicitly hidden, this is a no-op.\n */\n hide(): void {\n if (this.testFlag(Widget.Flag.IsHidden)) {\n return;\n }\n if (this.isAttached && (!this.parent || this.parent.isVisible)) {\n MessageLoop.sendMessage(this, Widget.Msg.BeforeHide);\n }\n this.setFlag(Widget.Flag.IsHidden);\n this._toggleHidden(true);\n\n if (this.isAttached && (!this.parent || this.parent.isVisible)) {\n MessageLoop.sendMessage(this, Widget.Msg.AfterHide);\n }\n if (this.parent) {\n let msg = new Widget.ChildMessage('child-hidden', this);\n MessageLoop.sendMessage(this.parent, msg);\n }\n }\n\n /**\n * Show or hide the widget according to a boolean value.\n *\n * @param hidden - `true` to hide the widget, or `false` to show it.\n *\n * #### Notes\n * This is a convenience method for `hide()` and `show()`.\n */\n setHidden(hidden: boolean): void {\n if (hidden) {\n this.hide();\n } else {\n this.show();\n }\n }\n\n /**\n * Test whether the given widget flag is set.\n *\n * #### Notes\n * This will not typically be called directly by user code.\n *\n * Since 2.7.0, {@link Widget.Flag.IsVisible} is deprecated.\n * It will be removed in a future version.\n */\n testFlag(flag: Widget.Flag): boolean {\n return (this._flags & flag) !== 0;\n }\n\n /**\n * Set the given widget flag.\n *\n * #### Notes\n * This will not typically be called directly by user code.\n *\n * Since 2.7.0, {@link Widget.Flag.IsVisible} is deprecated.\n * It will be removed in a future version.\n */\n setFlag(flag: Widget.Flag): void {\n this._flags |= flag;\n }\n\n /**\n * Clear the given widget flag.\n *\n * #### Notes\n * This will not typically be called directly by user code.\n *\n * Since 2.7.0, {@link Widget.Flag.IsVisible} is deprecated.\n * It will be removed in a future version.\n */\n clearFlag(flag: Widget.Flag): void {\n this._flags &= ~flag;\n }\n\n /**\n * Process a message sent to the widget.\n *\n * @param msg - The message sent to the widget.\n *\n * #### Notes\n * Subclasses may reimplement this method as needed.\n */\n processMessage(msg: Message): void {\n switch (msg.type) {\n case 'resize':\n this.notifyLayout(msg);\n this.onResize(msg as Widget.ResizeMessage);\n break;\n case 'update-request':\n this.notifyLayout(msg);\n this.onUpdateRequest(msg);\n break;\n case 'fit-request':\n this.notifyLayout(msg);\n this.onFitRequest(msg);\n break;\n case 'before-show':\n this.notifyLayout(msg);\n this.onBeforeShow(msg);\n break;\n case 'after-show':\n this.setFlag(Widget.Flag.IsVisible);\n this.notifyLayout(msg);\n this.onAfterShow(msg);\n break;\n case 'before-hide':\n this.notifyLayout(msg);\n this.onBeforeHide(msg);\n break;\n case 'after-hide':\n this.clearFlag(Widget.Flag.IsVisible);\n this.notifyLayout(msg);\n this.onAfterHide(msg);\n break;\n case 'before-attach':\n this.notifyLayout(msg);\n this.onBeforeAttach(msg);\n break;\n case 'after-attach':\n if (!this.isHidden && (!this.parent || this.parent.isVisible)) {\n this.setFlag(Widget.Flag.IsVisible);\n }\n this.setFlag(Widget.Flag.IsAttached);\n this.notifyLayout(msg);\n this.onAfterAttach(msg);\n break;\n case 'before-detach':\n this.notifyLayout(msg);\n this.onBeforeDetach(msg);\n break;\n case 'after-detach':\n this.clearFlag(Widget.Flag.IsVisible);\n this.clearFlag(Widget.Flag.IsAttached);\n this.notifyLayout(msg);\n this.onAfterDetach(msg);\n break;\n case 'activate-request':\n this.notifyLayout(msg);\n this.onActivateRequest(msg);\n break;\n case 'close-request':\n this.notifyLayout(msg);\n this.onCloseRequest(msg);\n break;\n case 'child-added':\n this.notifyLayout(msg);\n this.onChildAdded(msg as Widget.ChildMessage);\n break;\n case 'child-removed':\n this.notifyLayout(msg);\n this.onChildRemoved(msg as Widget.ChildMessage);\n break;\n default:\n this.notifyLayout(msg);\n break;\n }\n }\n\n /**\n * Invoke the message processing routine of the widget's layout.\n *\n * @param msg - The message to dispatch to the layout.\n *\n * #### Notes\n * This is a no-op if the widget does not have a layout.\n *\n * This will not typically be called directly by user code.\n */\n protected notifyLayout(msg: Message): void {\n if (this._layout) {\n this._layout.processParentMessage(msg);\n }\n }\n\n /**\n * A message handler invoked on a `'close-request'` message.\n *\n * #### Notes\n * The default implementation unparents or detaches the widget.\n */\n protected onCloseRequest(msg: Message): void {\n if (this.parent) {\n this.parent = null;\n } else if (this.isAttached) {\n Widget.detach(this);\n }\n }\n\n /**\n * A message handler invoked on a `'resize'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onResize(msg: Widget.ResizeMessage): void {}\n\n /**\n * A message handler invoked on an `'update-request'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onUpdateRequest(msg: Message): void {}\n\n /**\n * A message handler invoked on a `'fit-request'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onFitRequest(msg: Message): void {}\n\n /**\n * A message handler invoked on an `'activate-request'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onActivateRequest(msg: Message): void {}\n\n /**\n * A message handler invoked on a `'before-show'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onBeforeShow(msg: Message): void {}\n\n /**\n * A message handler invoked on an `'after-show'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onAfterShow(msg: Message): void {}\n\n /**\n * A message handler invoked on a `'before-hide'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onBeforeHide(msg: Message): void {}\n\n /**\n * A message handler invoked on an `'after-hide'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onAfterHide(msg: Message): void {}\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onBeforeAttach(msg: Message): void {}\n\n /**\n * A message handler invoked on an `'after-attach'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onAfterAttach(msg: Message): void {}\n\n /**\n * A message handler invoked on a `'before-detach'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onBeforeDetach(msg: Message): void {}\n\n /**\n * A message handler invoked on an `'after-detach'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onAfterDetach(msg: Message): void {}\n\n /**\n * A message handler invoked on a `'child-added'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onChildAdded(msg: Widget.ChildMessage): void {}\n\n /**\n * A message handler invoked on a `'child-removed'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onChildRemoved(msg: Widget.ChildMessage): void {}\n\n private _toggleHidden(hidden: boolean) {\n if (hidden) {\n switch (this._hiddenMode) {\n case Widget.HiddenMode.Display:\n this.addClass('lm-mod-hidden');\n break;\n case Widget.HiddenMode.Scale:\n this.node.style.transform = 'scale(0)';\n this.node.setAttribute('aria-hidden', 'true');\n break;\n case Widget.HiddenMode.ContentVisibility:\n // @ts-expect-error content-visibility unknown by DOM lib types\n this.node.style.contentVisibility = 'hidden';\n this.node.style.zIndex = '-1';\n break;\n }\n } else {\n switch (this._hiddenMode) {\n case Widget.HiddenMode.Display:\n this.removeClass('lm-mod-hidden');\n break;\n case Widget.HiddenMode.Scale:\n this.node.style.transform = '';\n this.node.removeAttribute('aria-hidden');\n break;\n case Widget.HiddenMode.ContentVisibility:\n // @ts-expect-error content-visibility unknown by DOM lib types\n this.node.style.contentVisibility = '';\n this.node.style.zIndex = '';\n break;\n }\n }\n }\n\n private _flags = 0;\n private _layout: Layout | null = null;\n private _parent: Widget | null = null;\n private _disposed = new Signal(this);\n private _hiddenMode: Widget.HiddenMode = Widget.HiddenMode.Display;\n}\n\n/**\n * The namespace for the `Widget` class statics.\n */\nexport namespace Widget {\n /**\n * An options object for initializing a widget.\n */\n export interface IOptions {\n /**\n * The optional node to use for the widget.\n *\n * If a node is provided, the widget will assume full ownership\n * and control of the node, as if it had created the node itself.\n *\n * The default is a new `
`.\n */\n node?: HTMLElement;\n\n /**\n * The optional element tag, used for constructing the widget's node.\n *\n * If a pre-constructed node is provided via the `node` arg, this\n * value is ignored.\n */\n tag?: keyof HTMLElementTagNameMap;\n }\n\n /**\n * The method for hiding the widget.\n *\n * The default is Display.\n *\n * Using `Scale` will often increase performance as most browsers will not\n * trigger style computation for the `transform` action. This should be used\n * sparingly and tested, since increasing the number of composition layers\n * may slow things down.\n *\n * To ensure the transformation does not trigger style recomputation, you\n * may need to set the widget CSS style `will-change: transform`. This\n * should be used only when needed as it may overwhelm the browser with a\n * high number of layers. See\n * https://developer.mozilla.org/en-US/docs/Web/CSS/will-change\n */\n export enum HiddenMode {\n /**\n * Set a `lm-mod-hidden` CSS class to hide the widget using `display:none`\n * CSS from the standard Lumino CSS.\n */\n Display = 0,\n\n /**\n * Hide the widget by setting the `transform` to `'scale(0)'`.\n */\n Scale,\n\n /**\n *Hide the widget by setting the `content-visibility` to `'hidden'`.\n */\n ContentVisibility\n }\n\n /**\n * An enum of widget bit flags.\n */\n export enum Flag {\n /**\n * The widget has been disposed.\n */\n IsDisposed = 0x1,\n\n /**\n * The widget is attached to the DOM.\n */\n IsAttached = 0x2,\n\n /**\n * The widget is hidden.\n */\n IsHidden = 0x4,\n\n /**\n * The widget is visible.\n *\n * @deprecated since 2.7.0, apply that flag consistently was not reliable\n * so it was dropped in favor of a recursive check of the visibility of all parents.\n */\n IsVisible = 0x8,\n\n /**\n * A layout cannot be set on the widget.\n */\n DisallowLayout = 0x10\n }\n\n /**\n * A collection of stateless messages related to widgets.\n */\n export namespace Msg {\n /**\n * A singleton `'before-show'` message.\n *\n * #### Notes\n * This message is sent to a widget before it becomes visible.\n *\n * This message is **not** sent when the widget is being attached.\n */\n export const BeforeShow = new Message('before-show');\n\n /**\n * A singleton `'after-show'` message.\n *\n * #### Notes\n * This message is sent to a widget after it becomes visible.\n *\n * This message is **not** sent when the widget is being attached.\n */\n export const AfterShow = new Message('after-show');\n\n /**\n * A singleton `'before-hide'` message.\n *\n * #### Notes\n * This message is sent to a widget before it becomes not-visible.\n *\n * This message is **not** sent when the widget is being detached.\n */\n export const BeforeHide = new Message('before-hide');\n\n /**\n * A singleton `'after-hide'` message.\n *\n * #### Notes\n * This message is sent to a widget after it becomes not-visible.\n *\n * This message is **not** sent when the widget is being detached.\n */\n export const AfterHide = new Message('after-hide');\n\n /**\n * A singleton `'before-attach'` message.\n *\n * #### Notes\n * This message is sent to a widget before it is attached.\n */\n export const BeforeAttach = new Message('before-attach');\n\n /**\n * A singleton `'after-attach'` message.\n *\n * #### Notes\n * This message is sent to a widget after it is attached.\n */\n export const AfterAttach = new Message('after-attach');\n\n /**\n * A singleton `'before-detach'` message.\n *\n * #### Notes\n * This message is sent to a widget before it is detached.\n */\n export const BeforeDetach = new Message('before-detach');\n\n /**\n * A singleton `'after-detach'` message.\n *\n * #### Notes\n * This message is sent to a widget after it is detached.\n */\n export const AfterDetach = new Message('after-detach');\n\n /**\n * A singleton `'parent-changed'` message.\n *\n * #### Notes\n * This message is sent to a widget when its parent has changed.\n */\n export const ParentChanged = new Message('parent-changed');\n\n /**\n * A singleton conflatable `'update-request'` message.\n *\n * #### Notes\n * This message can be dispatched to supporting widgets in order to\n * update their content based on the current widget state. Not all\n * widgets will respond to messages of this type.\n *\n * For widgets with a layout, this message will inform the layout to\n * update the position and size of its child widgets.\n */\n export const UpdateRequest = new ConflatableMessage('update-request');\n\n /**\n * A singleton conflatable `'fit-request'` message.\n *\n * #### Notes\n * For widgets with a layout, this message will inform the layout to\n * recalculate its size constraints to fit the space requirements of\n * its child widgets, and to update their position and size. Not all\n * layouts will respond to messages of this type.\n */\n export const FitRequest = new ConflatableMessage('fit-request');\n\n /**\n * A singleton conflatable `'activate-request'` message.\n *\n * #### Notes\n * This message should be dispatched to a widget when it should\n * perform the actions necessary to activate the widget, which\n * may include focusing its node or descendant node.\n */\n export const ActivateRequest = new ConflatableMessage('activate-request');\n\n /**\n * A singleton conflatable `'close-request'` message.\n *\n * #### Notes\n * This message should be dispatched to a widget when it should close\n * and remove itself from the widget hierarchy.\n */\n export const CloseRequest = new ConflatableMessage('close-request');\n }\n\n /**\n * A message class for child related messages.\n */\n export class ChildMessage extends Message {\n /**\n * Construct a new child message.\n *\n * @param type - The message type.\n *\n * @param child - The child widget for the message.\n */\n constructor(type: string, child: Widget) {\n super(type);\n this.child = child;\n }\n\n /**\n * The child widget for the message.\n */\n readonly child: Widget;\n }\n\n /**\n * A message class for `'resize'` messages.\n */\n export class ResizeMessage extends Message {\n /**\n * Construct a new resize message.\n *\n * @param width - The **offset width** of the widget, or `-1` if\n * the width is not known.\n *\n * @param height - The **offset height** of the widget, or `-1` if\n * the height is not known.\n */\n constructor(width: number, height: number) {\n super('resize');\n this.width = width;\n this.height = height;\n }\n\n /**\n * The offset width of the widget.\n *\n * #### Notes\n * This will be `-1` if the width is unknown.\n */\n readonly width: number;\n\n /**\n * The offset height of the widget.\n *\n * #### Notes\n * This will be `-1` if the height is unknown.\n */\n readonly height: number;\n }\n\n /**\n * The namespace for the `ResizeMessage` class statics.\n */\n export namespace ResizeMessage {\n /**\n * A singleton `'resize'` message with an unknown size.\n */\n export const UnknownSize = new ResizeMessage(-1, -1);\n }\n\n /**\n * Attach a widget to a host DOM node.\n *\n * @param widget - The widget of interest.\n *\n * @param host - The DOM node to use as the widget's host.\n *\n * @param ref - The child of `host` to use as the reference element.\n * If this is provided, the widget will be inserted before this\n * node in the host. The default is `null`, which will cause the\n * widget to be added as the last child of the host.\n *\n * #### Notes\n * This will throw an error if the widget is not a root widget, if\n * the widget is already attached, or if the host is not attached\n * to the DOM.\n */\n export function attach(\n widget: Widget,\n host: HTMLElement,\n ref: HTMLElement | null = null\n ): void {\n if (widget.parent) {\n throw new Error('Cannot attach a child widget.');\n }\n if (widget.isAttached || widget.node.isConnected) {\n throw new Error('Widget is already attached.');\n }\n if (!host.isConnected) {\n throw new Error('Host is not attached.');\n }\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n host.insertBefore(widget.node, ref);\n MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n\n /**\n * Detach the widget from its host DOM node.\n *\n * @param widget - The widget of interest.\n *\n * #### Notes\n * This will throw an error if the widget is not a root widget,\n * or if the widget is not attached to the DOM.\n */\n export function detach(widget: Widget): void {\n if (widget.parent) {\n throw new Error('Cannot detach a child widget.');\n }\n if (!widget.isAttached || !widget.node.isConnected) {\n throw new Error('Widget is not attached.');\n }\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n widget.node.parentNode!.removeChild(widget.node);\n MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * An attached property for the widget title object.\n */\n export const titleProperty = new AttachedProperty>({\n name: 'title',\n create: owner => new Title({ owner })\n });\n\n /**\n * Create a DOM node for the given widget options.\n */\n export function createNode(options: Widget.IOptions): HTMLElement {\n return options.node || document.createElement(options.tag || 'div');\n }\n}\n","/* eslint-disable @typescript-eslint/no-empty-function */\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { IDisposable } from '@lumino/disposable';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { AttachedProperty } from '@lumino/properties';\n\nimport { Signal } from '@lumino/signaling';\n\nimport { Widget } from './widget';\n\n/**\n * An abstract base class for creating lumino layouts.\n *\n * #### Notes\n * A layout is used to add widgets to a parent and to arrange those\n * widgets within the parent's DOM node.\n *\n * This class implements the base functionality which is required of\n * nearly all layouts. It must be subclassed in order to be useful.\n *\n * Notably, this class does not define a uniform interface for adding\n * widgets to the layout. A subclass should define that API in a way\n * which is meaningful for its intended use.\n */\nexport abstract class Layout implements Iterable, IDisposable {\n /**\n * Construct a new layout.\n *\n * @param options - The options for initializing the layout.\n */\n constructor(options: Layout.IOptions = {}) {\n this._fitPolicy = options.fitPolicy || 'set-min-size';\n }\n\n /**\n * Dispose of the resources held by the layout.\n *\n * #### Notes\n * This should be reimplemented to clear and dispose of the widgets.\n *\n * All reimplementations should call the superclass method.\n *\n * This method is called automatically when the parent is disposed.\n */\n dispose(): void {\n this._parent = null;\n this._disposed = true;\n Signal.clearData(this);\n AttachedProperty.clearData(this);\n }\n\n /**\n * Test whether the layout is disposed.\n */\n get isDisposed(): boolean {\n return this._disposed;\n }\n\n /**\n * Get the parent widget of the layout.\n */\n get parent(): Widget | null {\n return this._parent;\n }\n\n /**\n * Set the parent widget of the layout.\n *\n * #### Notes\n * This is set automatically when installing the layout on the parent\n * widget. The parent widget should not be set directly by user code.\n */\n set parent(value: Widget | null) {\n if (this._parent === value) {\n return;\n }\n if (this._parent) {\n throw new Error('Cannot change parent widget.');\n }\n if (value!.layout !== this) {\n throw new Error('Invalid parent widget.');\n }\n this._parent = value;\n this.init();\n }\n\n /**\n * Get the fit policy for the layout.\n *\n * #### Notes\n * The fit policy controls the computed size constraints which are\n * applied to the parent widget by the layout.\n *\n * Some layout implementations may ignore the fit policy.\n */\n get fitPolicy(): Layout.FitPolicy {\n return this._fitPolicy;\n }\n\n /**\n * Set the fit policy for the layout.\n *\n * #### Notes\n * The fit policy controls the computed size constraints which are\n * applied to the parent widget by the layout.\n *\n * Some layout implementations may ignore the fit policy.\n *\n * Changing the fit policy will clear the current size constraint\n * for the parent widget and then re-fit the parent.\n */\n set fitPolicy(value: Layout.FitPolicy) {\n // Bail if the policy does not change\n if (this._fitPolicy === value) {\n return;\n }\n\n // Update the internal policy.\n this._fitPolicy = value;\n\n // Clear the size constraints and schedule a fit of the parent.\n if (this._parent) {\n let style = this._parent.node.style;\n style.minWidth = '';\n style.minHeight = '';\n style.maxWidth = '';\n style.maxHeight = '';\n this._parent.fit();\n }\n }\n\n /**\n * Create an iterator over the widgets in the layout.\n *\n * @returns A new iterator over the widgets in the layout.\n *\n * #### Notes\n * This abstract method must be implemented by a subclass.\n */\n abstract [Symbol.iterator](): IterableIterator;\n\n /**\n * Remove a widget from the layout.\n *\n * @param widget - The widget to remove from the layout.\n *\n * #### Notes\n * A widget is automatically removed from the layout when its `parent`\n * is set to `null`. This method should only be invoked directly when\n * removing a widget from a layout which has yet to be installed on a\n * parent widget.\n *\n * This method should *not* modify the widget's `parent`.\n */\n abstract removeWidget(widget: Widget): void;\n\n /**\n * Process a message sent to the parent widget.\n *\n * @param msg - The message sent to the parent widget.\n *\n * #### Notes\n * This method is called by the parent widget to process a message.\n *\n * Subclasses may reimplement this method as needed.\n */\n processParentMessage(msg: Message): void {\n switch (msg.type) {\n case 'resize':\n this.onResize(msg as Widget.ResizeMessage);\n break;\n case 'update-request':\n this.onUpdateRequest(msg);\n break;\n case 'fit-request':\n this.onFitRequest(msg);\n break;\n case 'before-show':\n this.onBeforeShow(msg);\n break;\n case 'after-show':\n this.onAfterShow(msg);\n break;\n case 'before-hide':\n this.onBeforeHide(msg);\n break;\n case 'after-hide':\n this.onAfterHide(msg);\n break;\n case 'before-attach':\n this.onBeforeAttach(msg);\n break;\n case 'after-attach':\n this.onAfterAttach(msg);\n break;\n case 'before-detach':\n this.onBeforeDetach(msg);\n break;\n case 'after-detach':\n this.onAfterDetach(msg);\n break;\n case 'child-removed':\n this.onChildRemoved(msg as Widget.ChildMessage);\n break;\n case 'child-shown':\n this.onChildShown(msg as Widget.ChildMessage);\n break;\n case 'child-hidden':\n this.onChildHidden(msg as Widget.ChildMessage);\n break;\n }\n }\n\n /**\n * Perform layout initialization which requires the parent widget.\n *\n * #### Notes\n * This method is invoked immediately after the layout is installed\n * on the parent widget.\n *\n * The default implementation reparents all of the widgets to the\n * layout parent widget.\n *\n * Subclasses should reimplement this method and attach the child\n * widget nodes to the parent widget's node.\n */\n protected init(): void {\n for (const widget of this) {\n widget.parent = this.parent;\n }\n }\n\n /**\n * A message handler invoked on a `'resize'` message.\n *\n * #### Notes\n * The layout should ensure that its widgets are resized according\n * to the specified layout space, and that they are sent a `'resize'`\n * message if appropriate.\n *\n * The default implementation of this method sends an `UnknownSize`\n * resize message to all widgets.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onResize(msg: Widget.ResizeMessage): void {\n for (const widget of this) {\n MessageLoop.sendMessage(widget, Widget.ResizeMessage.UnknownSize);\n }\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n *\n * #### Notes\n * The layout should ensure that its widgets are resized according\n * to the available layout space, and that they are sent a `'resize'`\n * message if appropriate.\n *\n * The default implementation of this method sends an `UnknownSize`\n * resize message to all widgets.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onUpdateRequest(msg: Message): void {\n for (const widget of this) {\n MessageLoop.sendMessage(widget, Widget.ResizeMessage.UnknownSize);\n }\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n *\n * #### Notes\n * The default implementation of this method forwards the message\n * to all widgets. It assumes all widget nodes are attached to the\n * parent widget node.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onBeforeAttach(msg: Message): void {\n for (const widget of this) {\n MessageLoop.sendMessage(widget, msg);\n }\n }\n\n /**\n * A message handler invoked on an `'after-attach'` message.\n *\n * #### Notes\n * The default implementation of this method forwards the message\n * to all widgets. It assumes all widget nodes are attached to the\n * parent widget node.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onAfterAttach(msg: Message): void {\n for (const widget of this) {\n MessageLoop.sendMessage(widget, msg);\n }\n }\n\n /**\n * A message handler invoked on a `'before-detach'` message.\n *\n * #### Notes\n * The default implementation of this method forwards the message\n * to all widgets. It assumes all widget nodes are attached to the\n * parent widget node.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onBeforeDetach(msg: Message): void {\n for (const widget of this) {\n MessageLoop.sendMessage(widget, msg);\n }\n }\n\n /**\n * A message handler invoked on an `'after-detach'` message.\n *\n * #### Notes\n * The default implementation of this method forwards the message\n * to all widgets. It assumes all widget nodes are attached to the\n * parent widget node.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onAfterDetach(msg: Message): void {\n for (const widget of this) {\n MessageLoop.sendMessage(widget, msg);\n }\n }\n\n /**\n * A message handler invoked on a `'before-show'` message.\n *\n * #### Notes\n * The default implementation of this method forwards the message to\n * all non-hidden widgets. It assumes all widget nodes are attached\n * to the parent widget node.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onBeforeShow(msg: Message): void {\n for (const widget of this) {\n if (!widget.isHidden) {\n MessageLoop.sendMessage(widget, msg);\n }\n }\n }\n\n /**\n * A message handler invoked on an `'after-show'` message.\n *\n * #### Notes\n * The default implementation of this method forwards the message to\n * all non-hidden widgets. It assumes all widget nodes are attached\n * to the parent widget node.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onAfterShow(msg: Message): void {\n for (const widget of this) {\n if (!widget.isHidden) {\n MessageLoop.sendMessage(widget, msg);\n }\n }\n }\n\n /**\n * A message handler invoked on a `'before-hide'` message.\n *\n * #### Notes\n * The default implementation of this method forwards the message to\n * all non-hidden widgets. It assumes all widget nodes are attached\n * to the parent widget node.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onBeforeHide(msg: Message): void {\n for (const widget of this) {\n if (!widget.isHidden) {\n MessageLoop.sendMessage(widget, msg);\n }\n }\n }\n\n /**\n * A message handler invoked on an `'after-hide'` message.\n *\n * #### Notes\n * The default implementation of this method forwards the message to\n * all non-hidden widgets. It assumes all widget nodes are attached\n * to the parent widget node.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onAfterHide(msg: Message): void {\n for (const widget of this) {\n if (!widget.isHidden) {\n MessageLoop.sendMessage(widget, msg);\n }\n }\n }\n\n /**\n * A message handler invoked on a `'child-removed'` message.\n *\n * #### Notes\n * This will remove the child widget from the layout.\n *\n * Subclasses should **not** typically reimplement this method.\n */\n protected onChildRemoved(msg: Widget.ChildMessage): void {\n this.removeWidget(msg.child);\n }\n\n /**\n * A message handler invoked on a `'fit-request'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onFitRequest(msg: Message): void {}\n\n /**\n * A message handler invoked on a `'child-shown'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onChildShown(msg: Widget.ChildMessage): void {}\n\n /**\n * A message handler invoked on a `'child-hidden'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onChildHidden(msg: Widget.ChildMessage): void {}\n\n private _disposed = false;\n private _fitPolicy: Layout.FitPolicy;\n private _parent: Widget | null = null;\n}\n\n/**\n * The namespace for the `Layout` class statics.\n */\nexport namespace Layout {\n /**\n * A type alias for the layout fit policy.\n *\n * #### Notes\n * The fit policy controls the computed size constraints which are\n * applied to the parent widget by the layout.\n *\n * Some layout implementations may ignore the fit policy.\n */\n export type FitPolicy =\n | /**\n * No size constraint will be applied to the parent widget.\n */\n 'set-no-constraint'\n\n /**\n * The computed min size will be applied to the parent widget.\n */\n | 'set-min-size';\n\n /**\n * An options object for initializing a layout.\n */\n export interface IOptions {\n /**\n * The fit policy for the layout.\n *\n * The default is `'set-min-size'`.\n */\n fitPolicy?: FitPolicy;\n }\n\n /**\n * A type alias for the horizontal alignment of a widget.\n */\n export type HorizontalAlignment = 'left' | 'center' | 'right';\n\n /**\n * A type alias for the vertical alignment of a widget.\n */\n export type VerticalAlignment = 'top' | 'center' | 'bottom';\n\n /**\n * Get the horizontal alignment for a widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The horizontal alignment for the widget.\n *\n * #### Notes\n * If the layout width allocated to a widget is larger than its max\n * width, the horizontal alignment controls how the widget is placed\n * within the extra horizontal space.\n *\n * If the allocated width is less than the widget's max width, the\n * horizontal alignment has no effect.\n *\n * Some layout implementations may ignore horizontal alignment.\n */\n export function getHorizontalAlignment(widget: Widget): HorizontalAlignment {\n return Private.horizontalAlignmentProperty.get(widget);\n }\n\n /**\n * Set the horizontal alignment for a widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the horizontal alignment.\n *\n * #### Notes\n * If the layout width allocated to a widget is larger than its max\n * width, the horizontal alignment controls how the widget is placed\n * within the extra horizontal space.\n *\n * If the allocated width is less than the widget's max width, the\n * horizontal alignment has no effect.\n *\n * Some layout implementations may ignore horizontal alignment.\n *\n * Changing the horizontal alignment will post an `update-request`\n * message to widget's parent, provided the parent has a layout\n * installed.\n */\n export function setHorizontalAlignment(\n widget: Widget,\n value: HorizontalAlignment\n ): void {\n Private.horizontalAlignmentProperty.set(widget, value);\n }\n\n /**\n * Get the vertical alignment for a widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The vertical alignment for the widget.\n *\n * #### Notes\n * If the layout height allocated to a widget is larger than its max\n * height, the vertical alignment controls how the widget is placed\n * within the extra vertical space.\n *\n * If the allocated height is less than the widget's max height, the\n * vertical alignment has no effect.\n *\n * Some layout implementations may ignore vertical alignment.\n */\n export function getVerticalAlignment(widget: Widget): VerticalAlignment {\n return Private.verticalAlignmentProperty.get(widget);\n }\n\n /**\n * Set the vertical alignment for a widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the vertical alignment.\n *\n * #### Notes\n * If the layout height allocated to a widget is larger than its max\n * height, the vertical alignment controls how the widget is placed\n * within the extra vertical space.\n *\n * If the allocated height is less than the widget's max height, the\n * vertical alignment has no effect.\n *\n * Some layout implementations may ignore vertical alignment.\n *\n * Changing the horizontal alignment will post an `update-request`\n * message to widget's parent, provided the parent has a layout\n * installed.\n */\n export function setVerticalAlignment(\n widget: Widget,\n value: VerticalAlignment\n ): void {\n Private.verticalAlignmentProperty.set(widget, value);\n }\n}\n\n/**\n * An object which assists in the absolute layout of widgets.\n *\n * #### Notes\n * This class is useful when implementing a layout which arranges its\n * widgets using absolute positioning.\n *\n * This class is used by nearly all of the built-in lumino layouts.\n */\nexport class LayoutItem implements IDisposable {\n /**\n * Construct a new layout item.\n *\n * @param widget - The widget to be managed by the item.\n *\n * #### Notes\n * The widget will be set to absolute positioning.\n * The widget will use strict CSS containment.\n */\n constructor(widget: Widget) {\n this.widget = widget;\n this.widget.node.style.position = 'absolute';\n this.widget.node.style.contain = 'strict';\n }\n\n /**\n * Dispose of the the layout item.\n *\n * #### Notes\n * This will reset the positioning of the widget.\n */\n dispose(): void {\n // Do nothing if the item is already disposed.\n if (this._disposed) {\n return;\n }\n\n // Mark the item as disposed.\n this._disposed = true;\n\n // Reset the widget style.\n let style = this.widget.node.style;\n style.position = '';\n style.top = '';\n style.left = '';\n style.width = '';\n style.height = '';\n style.contain = '';\n }\n\n /**\n * The widget managed by the layout item.\n */\n readonly widget: Widget;\n\n /**\n * The computed minimum width of the widget.\n *\n * #### Notes\n * This value can be updated by calling the `fit` method.\n */\n get minWidth(): number {\n return this._minWidth;\n }\n\n /**\n * The computed minimum height of the widget.\n *\n * #### Notes\n * This value can be updated by calling the `fit` method.\n */\n get minHeight(): number {\n return this._minHeight;\n }\n\n /**\n * The computed maximum width of the widget.\n *\n * #### Notes\n * This value can be updated by calling the `fit` method.\n */\n get maxWidth(): number {\n return this._maxWidth;\n }\n\n /**\n * The computed maximum height of the widget.\n *\n * #### Notes\n * This value can be updated by calling the `fit` method.\n */\n get maxHeight(): number {\n return this._maxHeight;\n }\n\n /**\n * Whether the layout item is disposed.\n */\n get isDisposed(): boolean {\n return this._disposed;\n }\n\n /**\n * Whether the managed widget is hidden.\n */\n get isHidden(): boolean {\n return this.widget.isHidden;\n }\n\n /**\n * Whether the managed widget is visible.\n */\n get isVisible(): boolean {\n return this.widget.isVisible;\n }\n\n /**\n * Whether the managed widget is attached.\n */\n get isAttached(): boolean {\n return this.widget.isAttached;\n }\n\n /**\n * Update the computed size limits of the managed widget.\n */\n fit(): void {\n let limits = ElementExt.sizeLimits(this.widget.node);\n this._minWidth = limits.minWidth;\n this._minHeight = limits.minHeight;\n this._maxWidth = limits.maxWidth;\n this._maxHeight = limits.maxHeight;\n }\n\n /**\n * Update the position and size of the managed widget.\n *\n * @param left - The left edge position of the layout box.\n *\n * @param top - The top edge position of the layout box.\n *\n * @param width - The width of the layout box.\n *\n * @param height - The height of the layout box.\n */\n update(left: number, top: number, width: number, height: number): void {\n // Clamp the size to the computed size limits.\n let clampW = Math.max(this._minWidth, Math.min(width, this._maxWidth));\n let clampH = Math.max(this._minHeight, Math.min(height, this._maxHeight));\n\n // Adjust the left edge for the horizontal alignment, if needed.\n if (clampW < width) {\n switch (Layout.getHorizontalAlignment(this.widget)) {\n case 'left':\n break;\n case 'center':\n left += (width - clampW) / 2;\n break;\n case 'right':\n left += width - clampW;\n break;\n default:\n throw 'unreachable';\n }\n }\n\n // Adjust the top edge for the vertical alignment, if needed.\n if (clampH < height) {\n switch (Layout.getVerticalAlignment(this.widget)) {\n case 'top':\n break;\n case 'center':\n top += (height - clampH) / 2;\n break;\n case 'bottom':\n top += height - clampH;\n break;\n default:\n throw 'unreachable';\n }\n }\n\n // Set up the resize variables.\n let resized = false;\n let style = this.widget.node.style;\n\n // Update the top edge of the widget if needed.\n if (this._top !== top) {\n this._top = top;\n style.top = `${top}px`;\n }\n\n // Update the left edge of the widget if needed.\n if (this._left !== left) {\n this._left = left;\n style.left = `${left}px`;\n }\n\n // Update the width of the widget if needed.\n if (this._width !== clampW) {\n resized = true;\n this._width = clampW;\n style.width = `${clampW}px`;\n }\n\n // Update the height of the widget if needed.\n if (this._height !== clampH) {\n resized = true;\n this._height = clampH;\n style.height = `${clampH}px`;\n }\n\n // Send a resize message to the widget if needed.\n if (resized) {\n let msg = new Widget.ResizeMessage(clampW, clampH);\n MessageLoop.sendMessage(this.widget, msg);\n }\n }\n\n private _top = NaN;\n private _left = NaN;\n private _width = NaN;\n private _height = NaN;\n private _minWidth = 0;\n private _minHeight = 0;\n private _maxWidth = Infinity;\n private _maxHeight = Infinity;\n private _disposed = false;\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * The attached property for a widget horizontal alignment.\n */\n export const horizontalAlignmentProperty = new AttachedProperty<\n Widget,\n Layout.HorizontalAlignment\n >({\n name: 'horizontalAlignment',\n create: () => 'center',\n changed: onAlignmentChanged\n });\n\n /**\n * The attached property for a widget vertical alignment.\n */\n export const verticalAlignmentProperty = new AttachedProperty<\n Widget,\n Layout.VerticalAlignment\n >({\n name: 'verticalAlignment',\n create: () => 'top',\n changed: onAlignmentChanged\n });\n\n /**\n * The change handler for the attached alignment properties.\n */\n function onAlignmentChanged(child: Widget): void {\n if (child.parent && child.parent.layout) {\n child.parent.update();\n }\n }\n}\n","/*\n * Copyright (c) Jupyter Development Team.\n * Distributed under the terms of the Modified BSD License.\n */\n\nexport namespace Utils {\n /**\n * Clamp a dimension value to an integer >= 0.\n */\n export function clampDimension(value: number): number {\n return Math.max(0, Math.floor(value));\n }\n}\n\nexport default Utils;\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { IDisposable } from '@lumino/disposable';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { VirtualElement } from '@lumino/virtualdom';\n\n/**\n * An object which holds data related to an object's title.\n *\n * #### Notes\n * A title object is intended to hold the data necessary to display a\n * header for a particular object. A common example is the `TabPanel`,\n * which uses the widget title to populate the tab for a child widget.\n *\n * It is the responsibility of the owner to call the title disposal.\n */\nexport class Title implements IDisposable {\n /**\n * Construct a new title.\n *\n * @param options - The options for initializing the title.\n */\n constructor(options: Title.IOptions) {\n this.owner = options.owner;\n if (options.label !== undefined) {\n this._label = options.label;\n }\n if (options.mnemonic !== undefined) {\n this._mnemonic = options.mnemonic;\n }\n if (options.icon !== undefined) {\n this._icon = options.icon;\n }\n\n if (options.iconClass !== undefined) {\n this._iconClass = options.iconClass;\n }\n if (options.iconLabel !== undefined) {\n this._iconLabel = options.iconLabel;\n }\n if (options.caption !== undefined) {\n this._caption = options.caption;\n }\n if (options.className !== undefined) {\n this._className = options.className;\n }\n if (options.closable !== undefined) {\n this._closable = options.closable;\n }\n this._dataset = options.dataset || {};\n }\n\n /**\n * A signal emitted when the state of the title changes.\n */\n get changed(): ISignal {\n return this._changed;\n }\n\n /**\n * The object which owns the title.\n */\n readonly owner: T;\n\n /**\n * Get the label for the title.\n *\n * #### Notes\n * The default value is an empty string.\n */\n get label(): string {\n return this._label;\n }\n\n /**\n * Set the label for the title.\n */\n set label(value: string) {\n if (this._label === value) {\n return;\n }\n this._label = value;\n this._changed.emit(undefined);\n }\n\n /**\n * Get the mnemonic index for the title.\n *\n * #### Notes\n * The default value is `-1`.\n */\n get mnemonic(): number {\n return this._mnemonic;\n }\n\n /**\n * Set the mnemonic index for the title.\n */\n set mnemonic(value: number) {\n if (this._mnemonic === value) {\n return;\n }\n this._mnemonic = value;\n this._changed.emit(undefined);\n }\n\n /**\n * Get the icon renderer for the title.\n *\n * #### Notes\n * The default value is undefined.\n */\n get icon(): VirtualElement.IRenderer | undefined {\n return this._icon;\n }\n\n /**\n * Set the icon renderer for the title.\n *\n * #### Notes\n * A renderer is an object that supplies a render and unrender function.\n */\n set icon(value: VirtualElement.IRenderer | undefined) {\n if (this._icon === value) {\n return;\n }\n this._icon = value;\n this._changed.emit(undefined);\n }\n\n /**\n * Get the icon class name for the title.\n *\n * #### Notes\n * The default value is an empty string.\n */\n get iconClass(): string {\n return this._iconClass;\n }\n\n /**\n * Set the icon class name for the title.\n *\n * #### Notes\n * Multiple class names can be separated with whitespace.\n */\n set iconClass(value: string) {\n if (this._iconClass === value) {\n return;\n }\n this._iconClass = value;\n this._changed.emit(undefined);\n }\n\n /**\n * Get the icon label for the title.\n *\n * #### Notes\n * The default value is an empty string.\n */\n get iconLabel(): string {\n return this._iconLabel;\n }\n\n /**\n * Set the icon label for the title.\n *\n * #### Notes\n * Multiple class names can be separated with whitespace.\n */\n set iconLabel(value: string) {\n if (this._iconLabel === value) {\n return;\n }\n this._iconLabel = value;\n this._changed.emit(undefined);\n }\n\n /**\n * Get the caption for the title.\n *\n * #### Notes\n * The default value is an empty string.\n */\n get caption(): string {\n return this._caption;\n }\n\n /**\n * Set the caption for the title.\n */\n set caption(value: string) {\n if (this._caption === value) {\n return;\n }\n this._caption = value;\n this._changed.emit(undefined);\n }\n\n /**\n * Get the extra class name for the title.\n *\n * #### Notes\n * The default value is an empty string.\n */\n get className(): string {\n return this._className;\n }\n\n /**\n * Set the extra class name for the title.\n *\n * #### Notes\n * Multiple class names can be separated with whitespace.\n */\n set className(value: string) {\n if (this._className === value) {\n return;\n }\n this._className = value;\n this._changed.emit(undefined);\n }\n\n /**\n * Get the closable state for the title.\n *\n * #### Notes\n * The default value is `false`.\n */\n get closable(): boolean {\n return this._closable;\n }\n\n /**\n * Set the closable state for the title.\n *\n * #### Notes\n * This controls the presence of a close icon when applicable.\n */\n set closable(value: boolean) {\n if (this._closable === value) {\n return;\n }\n this._closable = value;\n this._changed.emit(undefined);\n }\n\n /**\n * Get the dataset for the title.\n *\n * #### Notes\n * The default value is an empty dataset.\n */\n get dataset(): Title.Dataset {\n return this._dataset;\n }\n\n /**\n * Set the dataset for the title.\n *\n * #### Notes\n * This controls the data attributes when applicable.\n */\n set dataset(value: Title.Dataset) {\n if (this._dataset === value) {\n return;\n }\n this._dataset = value;\n this._changed.emit(undefined);\n }\n\n /**\n * Test whether the title has been disposed.\n */\n get isDisposed(): boolean {\n return this._isDisposed;\n }\n\n /**\n * Dispose of the resources held by the title.\n *\n * #### Notes\n * It is the responsibility of the owner to call the title disposal.\n */\n dispose(): void {\n if (this.isDisposed) {\n return;\n }\n this._isDisposed = true;\n\n Signal.clearData(this);\n }\n\n private _label = '';\n private _caption = '';\n private _mnemonic = -1;\n private _icon: VirtualElement.IRenderer | undefined = undefined;\n private _iconClass = '';\n private _iconLabel = '';\n private _className = '';\n private _closable = false;\n private _dataset: Title.Dataset;\n private _changed = new Signal(this);\n private _isDisposed = false;\n}\n\n/**\n * The namespace for the `Title` class statics.\n */\nexport namespace Title {\n /**\n * A type alias for a simple immutable string dataset.\n */\n export type Dataset = { readonly [key: string]: string };\n\n /**\n * An options object for initializing a title.\n */\n export interface IOptions {\n /**\n * The object which owns the title.\n */\n owner: T;\n\n /**\n * The label for the title.\n */\n label?: string;\n\n /**\n * The mnemonic index for the title.\n */\n mnemonic?: number;\n\n /**\n * The icon renderer for the title.\n */\n icon?: VirtualElement.IRenderer;\n\n /**\n * The icon class name for the title.\n */\n iconClass?: string;\n\n /**\n * The icon label for the title.\n */\n iconLabel?: string;\n\n /**\n * The caption for the title.\n */\n caption?: string;\n\n /**\n * The extra class name for the title.\n */\n className?: string;\n\n /**\n * The closable state for the title.\n */\n closable?: boolean;\n\n /**\n * The dataset for the title.\n */\n dataset?: Dataset;\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { MessageLoop } from '@lumino/messaging';\n\nimport { Layout } from './layout';\n\nimport { Widget } from './widget';\n\n/**\n * A concrete layout implementation suitable for many use cases.\n *\n * #### Notes\n * This class is suitable as a base class for implementing a variety of\n * layouts, but can also be used directly with standard CSS to layout a\n * collection of widgets.\n */\nexport class PanelLayout extends Layout {\n /**\n * Dispose of the resources held by the layout.\n *\n * #### Notes\n * This will clear and dispose all widgets in the layout.\n *\n * All reimplementations should call the superclass method.\n *\n * This method is called automatically when the parent is disposed.\n */\n dispose(): void {\n while (this._widgets.length > 0) {\n this._widgets.pop()!.dispose();\n }\n super.dispose();\n }\n\n /**\n * A read-only array of the widgets in the layout.\n */\n get widgets(): ReadonlyArray {\n return this._widgets;\n }\n\n /**\n * Create an iterator over the widgets in the layout.\n *\n * @returns A new iterator over the widgets in the layout.\n */\n *[Symbol.iterator](): IterableIterator {\n yield* this._widgets;\n }\n\n /**\n * Add a widget to the end of the layout.\n *\n * @param widget - The widget to add to the layout.\n *\n * #### Notes\n * If the widget is already contained in the layout, it will be moved.\n */\n addWidget(widget: Widget): void {\n this.insertWidget(this._widgets.length, widget);\n }\n\n /**\n * Insert a widget into the layout at the specified index.\n *\n * @param index - The index at which to insert the widget.\n *\n * @param widget - The widget to insert into the layout.\n *\n * #### Notes\n * The index will be clamped to the bounds of the widgets.\n *\n * If the widget is already added to the layout, it will be moved.\n *\n * #### Undefined Behavior\n * An `index` which is non-integral.\n */\n insertWidget(index: number, widget: Widget): void {\n // Remove the widget from its current parent. This is a no-op\n // if the widget's parent is already the layout parent widget.\n widget.parent = this.parent;\n\n // Look up the current index of the widget.\n let i = this._widgets.indexOf(widget);\n\n // Clamp the insert index to the array bounds.\n let j = Math.max(0, Math.min(index, this._widgets.length));\n\n // If the widget is not in the array, insert it.\n if (i === -1) {\n // Insert the widget into the array.\n ArrayExt.insert(this._widgets, j, widget);\n\n // If the layout is parented, attach the widget to the DOM.\n if (this.parent) {\n this.attachWidget(j, widget);\n }\n\n // There is nothing more to do.\n return;\n }\n\n // Otherwise, the widget exists in the array and should be moved.\n\n // Adjust the index if the location is at the end of the array.\n if (j === this._widgets.length) {\n j--;\n }\n\n // Bail if there is no effective move.\n if (i === j) {\n return;\n }\n\n // Move the widget to the new location.\n ArrayExt.move(this._widgets, i, j);\n\n // If the layout is parented, move the widget in the DOM.\n if (this.parent) {\n this.moveWidget(i, j, widget);\n }\n }\n\n /**\n * Remove a widget from the layout.\n *\n * @param widget - The widget to remove from the layout.\n *\n * #### Notes\n * A widget is automatically removed from the layout when its `parent`\n * is set to `null`. This method should only be invoked directly when\n * removing a widget from a layout which has yet to be installed on a\n * parent widget.\n *\n * This method does *not* modify the widget's `parent`.\n */\n removeWidget(widget: Widget): void {\n this.removeWidgetAt(this._widgets.indexOf(widget));\n }\n\n /**\n * Remove the widget at a given index from the layout.\n *\n * @param index - The index of the widget to remove.\n *\n * #### Notes\n * A widget is automatically removed from the layout when its `parent`\n * is set to `null`. This method should only be invoked directly when\n * removing a widget from a layout which has yet to be installed on a\n * parent widget.\n *\n * This method does *not* modify the widget's `parent`.\n *\n * #### Undefined Behavior\n * An `index` which is non-integral.\n */\n removeWidgetAt(index: number): void {\n // Remove the widget from the array.\n let widget = ArrayExt.removeAt(this._widgets, index);\n\n // If the layout is parented, detach the widget from the DOM.\n if (widget && this.parent) {\n this.detachWidget(index, widget);\n }\n }\n\n /**\n * Perform layout initialization which requires the parent widget.\n */\n protected init(): void {\n super.init();\n let index = 0;\n for (const widget of this) {\n this.attachWidget(index++, widget);\n }\n }\n\n /**\n * Attach a widget to the parent's DOM node.\n *\n * @param index - The current index of the widget in the layout.\n *\n * @param widget - The widget to attach to the parent.\n *\n * #### Notes\n * This method is called automatically by the panel layout at the\n * appropriate time. It should not be called directly by user code.\n *\n * The default implementation adds the widgets's node to the parent's\n * node at the proper location, and sends the appropriate attach\n * messages to the widget if the parent is attached to the DOM.\n *\n * Subclasses may reimplement this method to control how the widget's\n * node is added to the parent's node.\n */\n protected attachWidget(index: number, widget: Widget): void {\n // Look up the next sibling reference node.\n let ref = this.parent!.node.children[index];\n\n // Send a `'before-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n }\n\n // Insert the widget's node before the sibling.\n this.parent!.node.insertBefore(widget.node, ref);\n\n // Send an `'after-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n }\n\n /**\n * Move a widget in the parent's DOM node.\n *\n * @param fromIndex - The previous index of the widget in the layout.\n *\n * @param toIndex - The current index of the widget in the layout.\n *\n * @param widget - The widget to move in the parent.\n *\n * #### Notes\n * This method is called automatically by the panel layout at the\n * appropriate time. It should not be called directly by user code.\n *\n * The default implementation moves the widget's node to the proper\n * location in the parent's node and sends the appropriate attach and\n * detach messages to the widget if the parent is attached to the DOM.\n *\n * Subclasses may reimplement this method to control how the widget's\n * node is moved in the parent's node.\n */\n protected moveWidget(\n fromIndex: number,\n toIndex: number,\n widget: Widget\n ): void {\n // Send a `'before-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n }\n\n // Remove the widget's node from the parent.\n this.parent!.node.removeChild(widget.node);\n\n // Send an `'after-detach'` and message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n\n // Look up the next sibling reference node.\n let ref = this.parent!.node.children[toIndex];\n\n // Send a `'before-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n }\n\n // Insert the widget's node before the sibling.\n this.parent!.node.insertBefore(widget.node, ref);\n\n // Send an `'after-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n }\n\n /**\n * Detach a widget from the parent's DOM node.\n *\n * @param index - The previous index of the widget in the layout.\n *\n * @param widget - The widget to detach from the parent.\n *\n * #### Notes\n * This method is called automatically by the panel layout at the\n * appropriate time. It should not be called directly by user code.\n *\n * The default implementation removes the widget's node from the\n * parent's node, and sends the appropriate detach messages to the\n * widget if the parent is attached to the DOM.\n *\n * Subclasses may reimplement this method to control how the widget's\n * node is removed from the parent's node.\n */\n protected detachWidget(index: number, widget: Widget): void {\n // Send a `'before-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n }\n\n // Remove the widget's node from the parent.\n this.parent!.node.removeChild(widget.node);\n\n // Send an `'after-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n }\n\n private _widgets: Widget[] = [];\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { AttachedProperty } from '@lumino/properties';\n\nimport { BoxEngine, BoxSizer } from './boxengine';\n\nimport { LayoutItem } from './layout';\n\nimport { PanelLayout } from './panellayout';\n\nimport { Utils } from './utils';\n\nimport { Widget } from './widget';\n\n/**\n * A layout which arranges its widgets into resizable sections.\n */\nexport class SplitLayout extends PanelLayout {\n /**\n * Construct a new split layout.\n *\n * @param options - The options for initializing the layout.\n */\n constructor(options: SplitLayout.IOptions) {\n super();\n this.renderer = options.renderer;\n if (options.orientation !== undefined) {\n this._orientation = options.orientation;\n }\n if (options.alignment !== undefined) {\n this._alignment = options.alignment;\n }\n if (options.spacing !== undefined) {\n this._spacing = Utils.clampDimension(options.spacing);\n }\n }\n\n /**\n * Dispose of the resources held by the layout.\n */\n dispose(): void {\n // Dispose of the layout items.\n for (const item of this._items) {\n item.dispose();\n }\n\n // Clear the layout state.\n this._box = null;\n this._items.length = 0;\n this._sizers.length = 0;\n this._handles.length = 0;\n\n // Dispose of the rest of the layout.\n super.dispose();\n }\n\n /**\n * The renderer used by the split layout.\n */\n readonly renderer: SplitLayout.IRenderer;\n\n /**\n * Get the layout orientation for the split layout.\n */\n get orientation(): SplitLayout.Orientation {\n return this._orientation;\n }\n\n /**\n * Set the layout orientation for the split layout.\n */\n set orientation(value: SplitLayout.Orientation) {\n if (this._orientation === value) {\n return;\n }\n this._orientation = value;\n if (!this.parent) {\n return;\n }\n this.parent.dataset['orientation'] = value;\n this.parent.fit();\n }\n\n /**\n * Get the content alignment for the split layout.\n *\n * #### Notes\n * This is the alignment of the widgets in the layout direction.\n *\n * The alignment has no effect if the widgets can expand to fill the\n * entire split layout.\n */\n get alignment(): SplitLayout.Alignment {\n return this._alignment;\n }\n\n /**\n * Set the content alignment for the split layout.\n *\n * #### Notes\n * This is the alignment of the widgets in the layout direction.\n *\n * The alignment has no effect if the widgets can expand to fill the\n * entire split layout.\n */\n set alignment(value: SplitLayout.Alignment) {\n if (this._alignment === value) {\n return;\n }\n this._alignment = value;\n if (!this.parent) {\n return;\n }\n this.parent.dataset['alignment'] = value;\n this.parent.update();\n }\n\n /**\n * Get the inter-element spacing for the split layout.\n */\n get spacing(): number {\n return this._spacing;\n }\n\n /**\n * Set the inter-element spacing for the split layout.\n */\n set spacing(value: number) {\n value = Utils.clampDimension(value);\n if (this._spacing === value) {\n return;\n }\n this._spacing = value;\n if (!this.parent) {\n return;\n }\n this.parent.fit();\n }\n\n /**\n * A read-only array of the split handles in the layout.\n */\n get handles(): ReadonlyArray {\n return this._handles;\n }\n\n /**\n * Get the absolute sizes of the widgets in the layout.\n *\n * @returns A new array of the absolute sizes of the widgets.\n *\n * This method **does not** measure the DOM nodes.\n */\n absoluteSizes(): number[] {\n return this._sizers.map(sizer => sizer.size);\n }\n\n /**\n * Get the relative sizes of the widgets in the layout.\n *\n * @returns A new array of the relative sizes of the widgets.\n *\n * #### Notes\n * The returned sizes reflect the sizes of the widgets normalized\n * relative to their siblings.\n *\n * This method **does not** measure the DOM nodes.\n */\n relativeSizes(): number[] {\n return Private.normalize(this._sizers.map(sizer => sizer.size));\n }\n\n /**\n * Set the relative sizes for the widgets in the layout.\n *\n * @param sizes - The relative sizes for the widgets in the panel.\n * @param update - Update the layout after setting relative sizes.\n * Default is True.\n *\n * #### Notes\n * Extra values are ignored, too few will yield an undefined layout.\n *\n * The actual geometry of the DOM nodes is updated asynchronously.\n */\n setRelativeSizes(sizes: number[], update = true): void {\n // Copy the sizes and pad with zeros as needed.\n let n = this._sizers.length;\n let temp = sizes.slice(0, n);\n while (temp.length < n) {\n temp.push(0);\n }\n\n // Normalize the padded sizes.\n let normed = Private.normalize(temp);\n\n // Apply the normalized sizes to the sizers.\n for (let i = 0; i < n; ++i) {\n let sizer = this._sizers[i];\n sizer.sizeHint = normed[i];\n sizer.size = normed[i];\n }\n\n // Set the flag indicating the sizes are normalized.\n this._hasNormedSizes = true;\n\n // Trigger an update of the parent widget.\n if (update && this.parent) {\n this.parent.update();\n }\n }\n\n /**\n * Move the offset position of a split handle.\n *\n * @param index - The index of the handle of the interest.\n *\n * @param position - The desired offset position of the handle.\n *\n * #### Notes\n * The position is relative to the offset parent.\n *\n * This will move the handle as close as possible to the desired\n * position. The sibling widgets will be adjusted as necessary.\n */\n moveHandle(index: number, position: number): void {\n // Bail if the index is invalid or the handle is hidden.\n let handle = this._handles[index];\n if (!handle || handle.classList.contains('lm-mod-hidden')) {\n return;\n }\n\n // Compute the desired delta movement for the handle.\n let delta: number;\n if (this._orientation === 'horizontal') {\n delta = position - handle.offsetLeft;\n } else {\n delta = position - handle.offsetTop;\n }\n\n // Bail if there is no handle movement.\n if (delta === 0) {\n return;\n }\n\n // Prevent widget resizing unless needed.\n for (let sizer of this._sizers) {\n if (sizer.size > 0) {\n sizer.sizeHint = sizer.size;\n }\n }\n\n // Adjust the sizers to reflect the handle movement.\n BoxEngine.adjust(this._sizers, index, delta);\n\n // Update the layout of the widgets.\n if (this.parent) {\n this.parent.update();\n }\n }\n\n /**\n * Perform layout initialization which requires the parent widget.\n */\n protected init(): void {\n this.parent!.dataset['orientation'] = this.orientation;\n this.parent!.dataset['alignment'] = this.alignment;\n super.init();\n }\n\n /**\n * Attach a widget to the parent's DOM node.\n *\n * @param index - The current index of the widget in the layout.\n *\n * @param widget - The widget to attach to the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected attachWidget(index: number, widget: Widget): void {\n // Create the item, handle, and sizer for the new widget.\n let item = new LayoutItem(widget);\n let handle = Private.createHandle(this.renderer);\n let average = Private.averageSize(this._sizers);\n let sizer = Private.createSizer(average);\n\n // Insert the item, handle, and sizer into the internal arrays.\n ArrayExt.insert(this._items, index, item);\n ArrayExt.insert(this._sizers, index, sizer);\n ArrayExt.insert(this._handles, index, handle);\n\n // Send a `'before-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n }\n\n // Add the widget and handle nodes to the parent.\n this.parent!.node.appendChild(widget.node);\n this.parent!.node.appendChild(handle);\n\n // Send an `'after-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n\n // Post a fit request for the parent widget.\n this.parent!.fit();\n }\n\n /**\n * Move a widget in the parent's DOM node.\n *\n * @param fromIndex - The previous index of the widget in the layout.\n *\n * @param toIndex - The current index of the widget in the layout.\n *\n * @param widget - The widget to move in the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected moveWidget(\n fromIndex: number,\n toIndex: number,\n widget: Widget\n ): void {\n // Move the item, sizer, and handle for the widget.\n ArrayExt.move(this._items, fromIndex, toIndex);\n ArrayExt.move(this._sizers, fromIndex, toIndex);\n ArrayExt.move(this._handles, fromIndex, toIndex);\n\n // Post a fit request to the parent to show/hide last handle.\n this.parent!.fit();\n }\n\n /**\n * Detach a widget from the parent's DOM node.\n *\n * @param index - The previous index of the widget in the layout.\n *\n * @param widget - The widget to detach from the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected detachWidget(index: number, widget: Widget): void {\n // Remove the item, handle, and sizer for the widget.\n let item = ArrayExt.removeAt(this._items, index);\n let handle = ArrayExt.removeAt(this._handles, index);\n ArrayExt.removeAt(this._sizers, index);\n\n // Send a `'before-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n }\n\n // Remove the widget and handle nodes from the parent.\n this.parent!.node.removeChild(widget.node);\n this.parent!.node.removeChild(handle!);\n\n // Send an `'after-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n\n // Dispose of the layout item.\n item!.dispose();\n\n // Post a fit request for the parent widget.\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'before-show'` message.\n */\n protected onBeforeShow(msg: Message): void {\n super.onBeforeShow(msg);\n this.parent!.update();\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n super.onBeforeAttach(msg);\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-shown'` message.\n */\n protected onChildShown(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-hidden'` message.\n */\n protected onChildHidden(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'resize'` message.\n */\n protected onResize(msg: Widget.ResizeMessage): void {\n if (this.parent!.isVisible) {\n this._update(msg.width, msg.height);\n }\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n protected onUpdateRequest(msg: Message): void {\n if (this.parent!.isVisible) {\n this._update(-1, -1);\n }\n }\n\n /**\n * A message handler invoked on a `'fit-request'` message.\n */\n protected onFitRequest(msg: Message): void {\n if (this.parent!.isAttached) {\n this._fit();\n }\n }\n\n /**\n * Update the item position.\n *\n * @param i Item index\n * @param isHorizontal Whether the layout is horizontal or not\n * @param left Left position in pixels\n * @param top Top position in pixels\n * @param height Item height\n * @param width Item width\n * @param size Item size\n */\n protected updateItemPosition(\n i: number,\n isHorizontal: boolean,\n left: number,\n top: number,\n height: number,\n width: number,\n size: number\n ): void {\n const item = this._items[i];\n if (item.isHidden) {\n return;\n }\n\n // Fetch the style for the handle.\n let handleStyle = this._handles[i].style;\n\n // Update the widget and handle, and advance the relevant edge.\n if (isHorizontal) {\n left += this.widgetOffset;\n item.update(left, top, size, height);\n left += size;\n handleStyle.top = `${top}px`;\n handleStyle.left = `${left}px`;\n handleStyle.width = `${this._spacing}px`;\n handleStyle.height = `${height}px`;\n } else {\n top += this.widgetOffset;\n item.update(left, top, width, size);\n top += size;\n handleStyle.top = `${top}px`;\n handleStyle.left = `${left}px`;\n handleStyle.width = `${width}px`;\n handleStyle.height = `${this._spacing}px`;\n }\n }\n\n /**\n * Fit the layout to the total size required by the widgets.\n */\n private _fit(): void {\n // Update the handles and track the visible widget count.\n let nVisible = 0;\n let lastHandleIndex = -1;\n for (let i = 0, n = this._items.length; i < n; ++i) {\n if (this._items[i].isHidden) {\n this._handles[i].classList.add('lm-mod-hidden');\n } else {\n this._handles[i].classList.remove('lm-mod-hidden');\n lastHandleIndex = i;\n nVisible++;\n }\n }\n\n // Hide the handle for the last visible widget.\n if (lastHandleIndex !== -1) {\n this._handles[lastHandleIndex].classList.add('lm-mod-hidden');\n }\n\n // Update the fixed space for the visible items.\n this._fixed =\n this._spacing * Math.max(0, nVisible - 1) +\n this.widgetOffset * this._items.length;\n\n // Setup the computed minimum size.\n let horz = this._orientation === 'horizontal';\n let minW = horz ? this._fixed : 0;\n let minH = horz ? 0 : this._fixed;\n\n // Update the sizers and computed size limits.\n for (let i = 0, n = this._items.length; i < n; ++i) {\n // Fetch the item and corresponding box sizer.\n let item = this._items[i];\n let sizer = this._sizers[i];\n\n // Prevent resizing unless necessary.\n if (sizer.size > 0) {\n sizer.sizeHint = sizer.size;\n }\n\n // If the item is hidden, it should consume zero size.\n if (item.isHidden) {\n sizer.minSize = 0;\n sizer.maxSize = 0;\n continue;\n }\n\n // Update the size limits for the item.\n item.fit();\n\n // Update the stretch factor.\n sizer.stretch = SplitLayout.getStretch(item.widget);\n\n // Update the sizer limits and computed min size.\n if (horz) {\n sizer.minSize = item.minWidth;\n sizer.maxSize = item.maxWidth;\n minW += item.minWidth;\n minH = Math.max(minH, item.minHeight);\n } else {\n sizer.minSize = item.minHeight;\n sizer.maxSize = item.maxHeight;\n minH += item.minHeight;\n minW = Math.max(minW, item.minWidth);\n }\n }\n\n // Update the box sizing and add it to the computed min size.\n let box = (this._box = ElementExt.boxSizing(this.parent!.node));\n minW += box.horizontalSum;\n minH += box.verticalSum;\n\n // Update the parent's min size constraints.\n let style = this.parent!.node.style;\n style.minWidth = `${minW}px`;\n style.minHeight = `${minH}px`;\n\n // Set the dirty flag to ensure only a single update occurs.\n this._dirty = true;\n\n // Notify the ancestor that it should fit immediately. This may\n // cause a resize of the parent, fulfilling the required update.\n if (this.parent!.parent) {\n MessageLoop.sendMessage(this.parent!.parent!, Widget.Msg.FitRequest);\n }\n\n // If the dirty flag is still set, the parent was not resized.\n // Trigger the required update on the parent widget immediately.\n if (this._dirty) {\n MessageLoop.sendMessage(this.parent!, Widget.Msg.UpdateRequest);\n }\n }\n\n /**\n * Update the layout position and size of the widgets.\n *\n * The parent offset dimensions should be `-1` if unknown.\n */\n private _update(offsetWidth: number, offsetHeight: number): void {\n // Clear the dirty flag to indicate the update occurred.\n this._dirty = false;\n\n // Compute the visible item count.\n let nVisible = 0;\n for (let i = 0, n = this._items.length; i < n; ++i) {\n nVisible += +!this._items[i].isHidden;\n }\n\n // Bail early if there are no visible items to layout.\n if (nVisible === 0 && this.widgetOffset === 0) {\n return;\n }\n\n // Measure the parent if the offset dimensions are unknown.\n if (offsetWidth < 0) {\n offsetWidth = this.parent!.node.offsetWidth;\n }\n if (offsetHeight < 0) {\n offsetHeight = this.parent!.node.offsetHeight;\n }\n\n // Ensure the parent box sizing data is computed.\n if (!this._box) {\n this._box = ElementExt.boxSizing(this.parent!.node);\n }\n\n // Compute the actual layout bounds adjusted for border and padding.\n let top = this._box.paddingTop;\n let left = this._box.paddingLeft;\n let width = offsetWidth - this._box.horizontalSum;\n let height = offsetHeight - this._box.verticalSum;\n\n // Set up the variables for justification and alignment offset.\n let extra = 0;\n let offset = 0;\n let horz = this._orientation === 'horizontal';\n\n if (nVisible > 0) {\n // Compute the adjusted layout space.\n let space: number;\n if (horz) {\n // left += this.widgetOffset;\n space = Math.max(0, width - this._fixed);\n } else {\n // top += this.widgetOffset;\n space = Math.max(0, height - this._fixed);\n }\n\n // Scale the size hints if they are normalized.\n if (this._hasNormedSizes) {\n for (let sizer of this._sizers) {\n sizer.sizeHint *= space;\n }\n this._hasNormedSizes = false;\n }\n\n // Distribute the layout space to the box sizers.\n let delta = BoxEngine.calc(this._sizers, space);\n\n // Account for alignment if there is extra layout space.\n if (delta > 0) {\n switch (this._alignment) {\n case 'start':\n break;\n case 'center':\n extra = 0;\n offset = delta / 2;\n break;\n case 'end':\n extra = 0;\n offset = delta;\n break;\n case 'justify':\n extra = delta / nVisible;\n offset = 0;\n break;\n default:\n throw 'unreachable';\n }\n }\n }\n\n // Layout the items using the computed box sizes.\n for (let i = 0, n = this._items.length; i < n; ++i) {\n // Fetch the item.\n const item = this._items[i];\n\n // Fetch the computed size for the widget.\n const size = item.isHidden ? 0 : this._sizers[i].size + extra;\n\n this.updateItemPosition(\n i,\n horz,\n horz ? left + offset : left,\n horz ? top : top + offset,\n height,\n width,\n size\n );\n\n const fullOffset =\n this.widgetOffset +\n (this._handles[i].classList.contains('lm-mod-hidden')\n ? 0\n : this._spacing);\n\n if (horz) {\n left += size + fullOffset;\n } else {\n top += size + fullOffset;\n }\n }\n }\n\n protected widgetOffset = 0;\n private _fixed = 0;\n private _spacing = 4;\n private _dirty = false;\n private _hasNormedSizes = false;\n private _sizers: BoxSizer[] = [];\n private _items: LayoutItem[] = [];\n private _handles: HTMLDivElement[] = [];\n private _box: ElementExt.IBoxSizing | null = null;\n private _alignment: SplitLayout.Alignment = 'start';\n private _orientation: SplitLayout.Orientation = 'horizontal';\n}\n\n/**\n * The namespace for the `SplitLayout` class statics.\n */\nexport namespace SplitLayout {\n /**\n * A type alias for a split layout orientation.\n */\n export type Orientation = 'horizontal' | 'vertical';\n\n /**\n * A type alias for a split layout alignment.\n */\n export type Alignment = 'start' | 'center' | 'end' | 'justify';\n\n /**\n * An options object for initializing a split layout.\n */\n export interface IOptions {\n /**\n * The renderer to use for the split layout.\n */\n renderer: IRenderer;\n\n /**\n * The orientation of the layout.\n *\n * Possible values are documented in {@link SplitLayout.Orientation}.\n *\n * The default is `'horizontal'`.\n */\n orientation?: Orientation;\n\n /**\n * The content alignment of the layout.\n *\n * Possible values are documented in {@link SplitLayout.Alignment}.\n *\n * The default is `'start'`.\n */\n alignment?: Alignment;\n\n /**\n * The spacing between items in the layout.\n *\n * The default is `4`.\n */\n spacing?: number;\n }\n\n /**\n * A renderer for use with a split layout.\n */\n export interface IRenderer {\n /**\n * Create a new handle for use with a split layout.\n *\n * @returns A new handle element.\n */\n createHandle(): HTMLDivElement;\n }\n\n /**\n * Get the split layout stretch factor for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The split layout stretch factor for the widget.\n */\n export function getStretch(widget: Widget): number {\n return Private.stretchProperty.get(widget);\n }\n\n /**\n * Set the split layout stretch factor for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the stretch factor.\n */\n export function setStretch(widget: Widget, value: number): void {\n Private.stretchProperty.set(widget, value);\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * The property descriptor for a widget stretch factor.\n */\n export const stretchProperty = new AttachedProperty({\n name: 'stretch',\n create: () => 0,\n coerce: (owner, value) => Math.max(0, Math.floor(value)),\n changed: onChildSizingChanged\n });\n\n /**\n * Create a new box sizer with the given size hint.\n */\n export function createSizer(size: number): BoxSizer {\n let sizer = new BoxSizer();\n sizer.sizeHint = Math.floor(size);\n return sizer;\n }\n\n /**\n * Create a new split handle node using the given renderer.\n */\n export function createHandle(\n renderer: SplitLayout.IRenderer\n ): HTMLDivElement {\n let handle = renderer.createHandle();\n handle.style.position = 'absolute';\n // Do not use size containment to allow the handle to fill the available space\n handle.style.contain = 'style';\n return handle;\n }\n\n /**\n * Compute the average size of an array of box sizers.\n */\n export function averageSize(sizers: BoxSizer[]): number {\n return sizers.reduce((v, s) => v + s.size, 0) / sizers.length || 0;\n }\n\n /**\n * Normalize an array of values.\n */\n export function normalize(values: number[]): number[] {\n let n = values.length;\n if (n === 0) {\n return [];\n }\n let sum = values.reduce((a, b) => a + Math.abs(b), 0);\n return sum === 0 ? values.map(v => 1 / n) : values.map(v => v / sum);\n }\n\n /**\n * The change handler for the attached sizing properties.\n */\n function onChildSizingChanged(child: Widget): void {\n if (child.parent && child.parent.layout instanceof SplitLayout) {\n child.parent.fit();\n }\n }\n}\n","/*\n * Copyright (c) Jupyter Development Team.\n * Distributed under the terms of the Modified BSD License.\n */\n\nimport { ArrayExt } from '@lumino/algorithm';\nimport { UUID } from '@lumino/coreutils';\nimport { SplitLayout } from './splitlayout';\nimport { Title } from './title';\nimport Utils from './utils';\nimport { Widget } from './widget';\n\n/**\n * A layout which arranges its widgets into collapsible resizable sections.\n */\nexport class AccordionLayout extends SplitLayout {\n /**\n * Construct a new accordion layout.\n *\n * @param options - The options for initializing the layout.\n *\n * #### Notes\n * The default orientation will be vertical.\n *\n * Titles must be rotated for horizontal accordion panel using CSS: see accordionpanel.css\n */\n constructor(options: AccordionLayout.IOptions) {\n super({ ...options, orientation: options.orientation || 'vertical' });\n this.titleSpace = options.titleSpace || 22;\n }\n\n /**\n * The section title height or width depending on the orientation.\n */\n get titleSpace(): number {\n return this.widgetOffset;\n }\n set titleSpace(value: number) {\n value = Utils.clampDimension(value);\n if (this.widgetOffset === value) {\n return;\n }\n this.widgetOffset = value;\n if (!this.parent) {\n return;\n }\n this.parent.fit();\n }\n\n /**\n * A read-only array of the section titles in the panel.\n */\n get titles(): ReadonlyArray {\n return this._titles;\n }\n\n /**\n * Dispose of the resources held by the layout.\n */\n dispose(): void {\n if (this.isDisposed) {\n return;\n }\n\n // Clear the layout state.\n this._titles.length = 0;\n\n // Dispose of the rest of the layout.\n super.dispose();\n }\n\n /**\n * The renderer used by the accordion layout.\n */\n readonly renderer: AccordionLayout.IRenderer;\n\n public updateTitle(index: number, widget: Widget): void {\n const oldTitle = this._titles[index];\n const expanded = oldTitle.classList.contains('lm-mod-expanded');\n const newTitle = Private.createTitle(this.renderer, widget.title, expanded);\n this._titles[index] = newTitle;\n\n // Add the title node to the parent before the widget.\n this.parent!.node.replaceChild(newTitle, oldTitle);\n }\n\n /**\n * Insert a widget into the layout at the specified index.\n *\n * @param index - The index at which to insert the widget.\n *\n * @param widget - The widget to insert into the layout.\n *\n * #### Notes\n * The index will be clamped to the bounds of the widgets.\n *\n * If the widget is already added to the layout, it will be moved.\n *\n * #### Undefined Behavior\n * An `index` which is non-integral.\n */\n insertWidget(index: number, widget: Widget): void {\n if (!widget.id) {\n widget.id = `id-${UUID.uuid4()}`;\n }\n super.insertWidget(index, widget);\n }\n\n /**\n * Attach a widget to the parent's DOM node.\n *\n * @param index - The current index of the widget in the layout.\n *\n * @param widget - The widget to attach to the parent.\n */\n protected attachWidget(index: number, widget: Widget): void {\n const title = Private.createTitle(this.renderer, widget.title);\n\n ArrayExt.insert(this._titles, index, title);\n\n // Add the title node to the parent before the widget.\n this.parent!.node.appendChild(title);\n\n widget.node.setAttribute('role', 'region');\n widget.node.setAttribute('aria-labelledby', title.id);\n\n super.attachWidget(index, widget);\n }\n\n /**\n * Move a widget in the parent's DOM node.\n *\n * @param fromIndex - The previous index of the widget in the layout.\n *\n * @param toIndex - The current index of the widget in the layout.\n *\n * @param widget - The widget to move in the parent.\n */\n protected moveWidget(\n fromIndex: number,\n toIndex: number,\n widget: Widget\n ): void {\n ArrayExt.move(this._titles, fromIndex, toIndex);\n super.moveWidget(fromIndex, toIndex, widget);\n }\n\n /**\n * Detach a widget from the parent's DOM node.\n *\n * @param index - The previous index of the widget in the layout.\n *\n * @param widget - The widget to detach from the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected detachWidget(index: number, widget: Widget): void {\n const title = ArrayExt.removeAt(this._titles, index);\n\n this.parent!.node.removeChild(title!);\n\n super.detachWidget(index, widget);\n }\n\n /**\n * Update the item position.\n *\n * @param i Item index\n * @param isHorizontal Whether the layout is horizontal or not\n * @param left Left position in pixels\n * @param top Top position in pixels\n * @param height Item height\n * @param width Item width\n * @param size Item size\n */\n protected updateItemPosition(\n i: number,\n isHorizontal: boolean,\n left: number,\n top: number,\n height: number,\n width: number,\n size: number\n ): void {\n const titleStyle = this._titles[i].style;\n\n // Titles must be rotated for horizontal accordion panel using CSS: see accordionpanel.css\n titleStyle.top = `${top}px`;\n titleStyle.left = `${left}px`;\n titleStyle.height = `${this.widgetOffset}px`;\n if (isHorizontal) {\n titleStyle.width = `${height}px`;\n } else {\n titleStyle.width = `${width}px`;\n }\n\n super.updateItemPosition(i, isHorizontal, left, top, height, width, size);\n }\n\n private _titles: HTMLElement[] = [];\n}\n\nexport namespace AccordionLayout {\n /**\n * A type alias for a accordion layout orientation.\n */\n export type Orientation = SplitLayout.Orientation;\n\n /**\n * A type alias for a accordion layout alignment.\n */\n export type Alignment = SplitLayout.Alignment;\n\n /**\n * An options object for initializing a accordion layout.\n */\n export interface IOptions extends SplitLayout.IOptions {\n /**\n * The renderer to use for the accordion layout.\n */\n renderer: IRenderer;\n\n /**\n * The section title height or width depending on the orientation.\n *\n * The default is `22`.\n */\n titleSpace?: number;\n }\n\n /**\n * A renderer for use with an accordion layout.\n */\n export interface IRenderer extends SplitLayout.IRenderer {\n /**\n * Common class name for all accordion titles.\n */\n readonly titleClassName: string;\n\n /**\n * Render the element for a section title.\n *\n * @param title - The data to use for rendering the section title.\n *\n * @returns A element representing the section title.\n */\n createSectionTitle(title: Title): HTMLElement;\n }\n}\n\nnamespace Private {\n /**\n * Create the title HTML element.\n *\n * @param renderer Accordion renderer\n * @param data Widget title\n * @returns Title HTML element\n */\n export function createTitle(\n renderer: AccordionLayout.IRenderer,\n data: Title,\n expanded: boolean = true\n ): HTMLElement {\n const title = renderer.createSectionTitle(data);\n title.style.position = 'absolute';\n title.style.contain = 'strict';\n title.setAttribute('aria-label', `${data.label} Section`);\n title.setAttribute('aria-expanded', expanded ? 'true' : 'false');\n title.setAttribute('aria-controls', data.owner.id);\n if (expanded) {\n title.classList.add('lm-mod-expanded');\n }\n return title;\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { PanelLayout } from './panellayout';\n\nimport { Widget } from './widget';\n\n/**\n * A simple and convenient panel widget class.\n *\n * #### Notes\n * This class is suitable as a base class for implementing a variety of\n * convenience panel widgets, but can also be used directly with CSS to\n * arrange a collection of widgets.\n *\n * This class provides a convenience wrapper around a {@link PanelLayout}.\n */\nexport class Panel extends Widget {\n /**\n * Construct a new panel.\n *\n * @param options - The options for initializing the panel.\n */\n constructor(options: Panel.IOptions = {}) {\n super();\n this.addClass('lm-Panel');\n this.layout = Private.createLayout(options);\n }\n\n /**\n * A read-only array of the widgets in the panel.\n */\n get widgets(): ReadonlyArray {\n return (this.layout as PanelLayout).widgets;\n }\n\n /**\n * Add a widget to the end of the panel.\n *\n * @param widget - The widget to add to the panel.\n *\n * #### Notes\n * If the widget is already contained in the panel, it will be moved.\n */\n addWidget(widget: Widget): void {\n (this.layout as PanelLayout).addWidget(widget);\n }\n\n /**\n * Insert a widget at the specified index.\n *\n * @param index - The index at which to insert the widget.\n *\n * @param widget - The widget to insert into to the panel.\n *\n * #### Notes\n * If the widget is already contained in the panel, it will be moved.\n */\n insertWidget(index: number, widget: Widget): void {\n (this.layout as PanelLayout).insertWidget(index, widget);\n }\n}\n\n/**\n * The namespace for the `Panel` class statics.\n */\nexport namespace Panel {\n /**\n * An options object for creating a panel.\n */\n export interface IOptions {\n /**\n * The panel layout to use for the panel.\n *\n * The default is a new `PanelLayout`.\n */\n layout?: PanelLayout;\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * Create a panel layout for the given panel options.\n */\n export function createLayout(options: Panel.IOptions): PanelLayout {\n return options.layout || new PanelLayout();\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { IDisposable } from '@lumino/disposable';\n\nimport { Drag } from '@lumino/dragdrop';\n\nimport { Message } from '@lumino/messaging';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { Panel } from './panel';\n\nimport { SplitLayout } from './splitlayout';\n\nimport { Widget } from './widget';\n\n/**\n * A panel which arranges its widgets into resizable sections.\n *\n * #### Notes\n * This class provides a convenience wrapper around a {@link SplitLayout}.\n */\nexport class SplitPanel extends Panel {\n /**\n * Construct a new split panel.\n *\n * @param options - The options for initializing the split panel.\n */\n constructor(options: SplitPanel.IOptions = {}) {\n super({ layout: Private.createLayout(options) });\n this.addClass('lm-SplitPanel');\n }\n\n /**\n * Dispose of the resources held by the panel.\n */\n dispose(): void {\n this._releaseMouse();\n super.dispose();\n }\n\n /**\n * Get the layout orientation for the split panel.\n */\n get orientation(): SplitPanel.Orientation {\n return (this.layout as SplitLayout).orientation;\n }\n\n /**\n * Set the layout orientation for the split panel.\n */\n set orientation(value: SplitPanel.Orientation) {\n (this.layout as SplitLayout).orientation = value;\n }\n\n /**\n * Get the content alignment for the split panel.\n *\n * #### Notes\n * This is the alignment of the widgets in the layout direction.\n *\n * The alignment has no effect if the widgets can expand to fill the\n * entire split panel.\n */\n get alignment(): SplitPanel.Alignment {\n return (this.layout as SplitLayout).alignment;\n }\n\n /**\n * Set the content alignment for the split panel.\n *\n * #### Notes\n * This is the alignment of the widgets in the layout direction.\n *\n * The alignment has no effect if the widgets can expand to fill the\n * entire split panel.\n */\n set alignment(value: SplitPanel.Alignment) {\n (this.layout as SplitLayout).alignment = value;\n }\n\n /**\n * Get the inter-element spacing for the split panel.\n */\n get spacing(): number {\n return (this.layout as SplitLayout).spacing;\n }\n\n /**\n * Set the inter-element spacing for the split panel.\n */\n set spacing(value: number) {\n (this.layout as SplitLayout).spacing = value;\n }\n\n /**\n * The renderer used by the split panel.\n */\n get renderer(): SplitPanel.IRenderer {\n return (this.layout as SplitLayout).renderer;\n }\n\n /**\n * A signal emitted when a split handle has moved.\n */\n get handleMoved(): ISignal {\n return this._handleMoved;\n }\n\n /**\n * A read-only array of the split handles in the panel.\n */\n get handles(): ReadonlyArray {\n return (this.layout as SplitLayout).handles;\n }\n\n /**\n * Get the relative sizes of the widgets in the panel.\n *\n * @returns A new array of the relative sizes of the widgets.\n *\n * #### Notes\n * The returned sizes reflect the sizes of the widgets normalized\n * relative to their siblings.\n *\n * This method **does not** measure the DOM nodes.\n */\n relativeSizes(): number[] {\n return (this.layout as SplitLayout).relativeSizes();\n }\n\n /**\n * Set the relative sizes for the widgets in the panel.\n *\n * @param sizes - The relative sizes for the widgets in the panel.\n * @param update - Update the layout after setting relative sizes.\n * Default is True.\n *\n * #### Notes\n * Extra values are ignored, too few will yield an undefined layout.\n *\n * The actual geometry of the DOM nodes is updated asynchronously.\n */\n setRelativeSizes(sizes: number[], update = true): void {\n (this.layout as SplitLayout).setRelativeSizes(sizes, update);\n }\n\n /**\n * Handle the DOM events for the split panel.\n *\n * @param event - The DOM event sent to the panel.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the panel's DOM node. It should\n * not be called directly by user code.\n */\n handleEvent(event: Event): void {\n switch (event.type) {\n case 'pointerdown':\n this._evtPointerDown(event as PointerEvent);\n break;\n case 'pointermove':\n this._evtPointerMove(event as PointerEvent);\n break;\n case 'pointerup':\n this._evtPointerUp(event as PointerEvent);\n break;\n case 'keydown':\n this._evtKeyDown(event as KeyboardEvent);\n break;\n case 'contextmenu':\n event.preventDefault();\n event.stopPropagation();\n break;\n }\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n this.node.addEventListener('pointerdown', this);\n }\n\n /**\n * A message handler invoked on an `'after-detach'` message.\n */\n protected onAfterDetach(msg: Message): void {\n this.node.removeEventListener('pointerdown', this);\n this._releaseMouse();\n }\n\n /**\n * A message handler invoked on a `'child-added'` message.\n */\n protected onChildAdded(msg: Widget.ChildMessage): void {\n msg.child.addClass('lm-SplitPanel-child');\n this._releaseMouse();\n }\n\n /**\n * A message handler invoked on a `'child-removed'` message.\n */\n protected onChildRemoved(msg: Widget.ChildMessage): void {\n msg.child.removeClass('lm-SplitPanel-child');\n this._releaseMouse();\n }\n\n /**\n * Handle the `'keydown'` event for the split panel.\n */\n private _evtKeyDown(event: KeyboardEvent): void {\n // Stop input events during drag.\n if (this._pressData) {\n event.preventDefault();\n event.stopPropagation();\n }\n\n // Release the mouse if `Escape` is pressed.\n if (event.keyCode === 27) {\n this._releaseMouse();\n }\n }\n\n /**\n * Handle the `'pointerdown'` event for the split panel.\n */\n private _evtPointerDown(event: PointerEvent): void {\n // Do nothing if the primary button is not pressed.\n if (event.button !== 0) {\n return;\n }\n\n // Find the handle which contains the target, if any.\n let layout = this.layout as SplitLayout;\n let index = ArrayExt.findFirstIndex(layout.handles, handle => {\n return handle.contains(event.target as HTMLElement);\n });\n\n // Bail early if the mouse press was not on a handle.\n if (index === -1) {\n return;\n }\n\n // Stop the event when a split handle is pressed.\n event.preventDefault();\n event.stopPropagation();\n\n // Add the extra document listeners.\n document.addEventListener('pointerup', this, true);\n document.addEventListener('pointermove', this, true);\n document.addEventListener('keydown', this, true);\n document.addEventListener('contextmenu', this, true);\n\n // Compute the offset delta for the handle press.\n let delta: number;\n let handle = layout.handles[index];\n let rect = handle.getBoundingClientRect();\n if (layout.orientation === 'horizontal') {\n delta = event.clientX - rect.left;\n } else {\n delta = event.clientY - rect.top;\n }\n\n // Override the cursor and store the press data.\n let style = window.getComputedStyle(handle);\n let override = Drag.overrideCursor(style.cursor!);\n this._pressData = { index, delta, override };\n }\n\n /**\n * Handle the `'pointermove'` event for the split panel.\n */\n private _evtPointerMove(event: PointerEvent): void {\n // Stop the event when dragging a split handle.\n event.preventDefault();\n event.stopPropagation();\n\n // Compute the desired offset position for the handle.\n let pos: number;\n let layout = this.layout as SplitLayout;\n let rect = this.node.getBoundingClientRect();\n if (layout.orientation === 'horizontal') {\n pos = event.clientX - rect.left - this._pressData!.delta;\n } else {\n pos = event.clientY - rect.top - this._pressData!.delta;\n }\n\n // Move the handle as close to the desired position as possible.\n layout.moveHandle(this._pressData!.index, pos);\n }\n\n /**\n * Handle the `'pointerup'` event for the split panel.\n */\n private _evtPointerUp(event: PointerEvent): void {\n // Do nothing if the primary button is not released.\n if (event.button !== 0) {\n return;\n }\n\n // Stop the event when releasing a handle.\n event.preventDefault();\n event.stopPropagation();\n\n // Finalize the mouse release.\n this._releaseMouse();\n }\n\n /**\n * Release the mouse grab for the split panel.\n */\n private _releaseMouse(): void {\n // Bail early if no drag is in progress.\n if (!this._pressData) {\n return;\n }\n\n // Clear the override cursor.\n this._pressData.override.dispose();\n this._pressData = null;\n\n // Emit the handle moved signal.\n this._handleMoved.emit();\n\n // Remove the extra document listeners.\n document.removeEventListener('keydown', this, true);\n document.removeEventListener('pointerup', this, true);\n document.removeEventListener('pointermove', this, true);\n document.removeEventListener('contextmenu', this, true);\n }\n\n private _handleMoved = new Signal(this);\n private _pressData: Private.IPressData | null = null;\n}\n\n/**\n * The namespace for the `SplitPanel` class statics.\n */\nexport namespace SplitPanel {\n /**\n * A type alias for a split panel orientation.\n */\n export type Orientation = SplitLayout.Orientation;\n\n /**\n * A type alias for a split panel alignment.\n */\n export type Alignment = SplitLayout.Alignment;\n\n /**\n * A type alias for a split panel renderer.\n */\n export type IRenderer = SplitLayout.IRenderer;\n\n /**\n * An options object for initializing a split panel.\n */\n export interface IOptions {\n /**\n * The renderer to use for the split panel.\n *\n * The default is a shared renderer instance.\n */\n renderer?: IRenderer;\n\n /**\n * The layout orientation of the panel.\n *\n * The default is `'horizontal'`.\n */\n orientation?: Orientation;\n\n /**\n * The content alignment of the panel.\n *\n * The default is `'start'`.\n */\n alignment?: Alignment;\n\n /**\n * The spacing between items in the panel.\n *\n * The default is `4`.\n */\n spacing?: number;\n\n /**\n * The split layout to use for the split panel.\n *\n * If this is provided, the other options are ignored.\n *\n * The default is a new `SplitLayout`.\n */\n layout?: SplitLayout;\n }\n\n /**\n * The default implementation of `IRenderer`.\n */\n export class Renderer implements IRenderer {\n /**\n * Create a new handle for use with a split panel.\n *\n * @returns A new handle element for a split panel.\n */\n createHandle(): HTMLDivElement {\n let handle = document.createElement('div');\n handle.className = 'lm-SplitPanel-handle';\n return handle;\n }\n }\n\n /**\n * The default `Renderer` instance.\n */\n export const defaultRenderer = new Renderer();\n\n /**\n * Get the split panel stretch factor for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The split panel stretch factor for the widget.\n */\n export function getStretch(widget: Widget): number {\n return SplitLayout.getStretch(widget);\n }\n\n /**\n * Set the split panel stretch factor for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the stretch factor.\n */\n export function setStretch(widget: Widget, value: number): void {\n SplitLayout.setStretch(widget, value);\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * An object which holds mouse press data.\n */\n export interface IPressData {\n /**\n * The index of the pressed handle.\n */\n index: number;\n\n /**\n * The offset of the press in handle coordinates.\n */\n delta: number;\n\n /**\n * The disposable which will clear the override cursor.\n */\n override: IDisposable;\n }\n\n /**\n * Create a split layout for the given panel options.\n */\n export function createLayout(options: SplitPanel.IOptions): SplitLayout {\n return (\n options.layout ||\n new SplitLayout({\n renderer: options.renderer || SplitPanel.defaultRenderer,\n orientation: options.orientation,\n alignment: options.alignment,\n spacing: options.spacing\n })\n );\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n\nimport { ArrayExt } from '@lumino/algorithm';\nimport { Message } from '@lumino/messaging';\nimport { ISignal, Signal } from '@lumino/signaling';\nimport { AccordionLayout } from './accordionlayout';\nimport { SplitLayout } from './splitlayout';\nimport { SplitPanel } from './splitpanel';\nimport { Title } from './title';\nimport { Widget } from './widget';\n\n/**\n * A panel which arranges its widgets into resizable sections separated by a title widget.\n *\n * #### Notes\n * This class provides a convenience wrapper around {@link AccordionLayout}.\n *\n * See also the related [example](../../examples/accordionpanel/index.html) and\n * its [source](https://github.com/jupyterlab/lumino/tree/main/examples/example-accordionpanel).\n */\nexport class AccordionPanel extends SplitPanel {\n /**\n * Construct a new accordion panel.\n *\n * @param options - The options for initializing the accordion panel.\n *\n */\n constructor(options: AccordionPanel.IOptions = {}) {\n super({ ...options, layout: Private.createLayout(options) });\n this.addClass('lm-AccordionPanel');\n }\n\n /**\n * The renderer used by the accordion panel.\n */\n get renderer(): AccordionPanel.IRenderer {\n return (this.layout as AccordionLayout).renderer;\n }\n\n /**\n * The section title space.\n *\n * This is the height if the panel is vertical and the width if it is\n * horizontal.\n */\n get titleSpace(): number {\n return (this.layout as AccordionLayout).titleSpace;\n }\n set titleSpace(value: number) {\n (this.layout as AccordionLayout).titleSpace = value;\n }\n\n /**\n * A read-only array of the section titles in the panel.\n */\n get titles(): ReadonlyArray {\n return (this.layout as AccordionLayout).titles;\n }\n\n /**\n * A signal emitted when a widget of the AccordionPanel is collapsed or expanded.\n */\n get expansionToggled(): ISignal {\n return this._expansionToggled;\n }\n\n /**\n * Add a widget to the end of the panel.\n *\n * @param widget - The widget to add to the panel.\n *\n * #### Notes\n * If the widget is already contained in the panel, it will be moved.\n */\n addWidget(widget: Widget): void {\n super.addWidget(widget);\n widget.title.changed.connect(this._onTitleChanged, this);\n }\n\n /**\n * Collapse the widget at position `index`.\n *\n * #### Notes\n * If no widget is found for `index`, this will bail.\n *\n * @param index Widget index\n */\n collapse(index: number): void {\n const widget = (this.layout as AccordionLayout).widgets[index];\n\n if (widget && !widget.isHidden) {\n this._toggleExpansion(index);\n }\n }\n\n /**\n * Expand the widget at position `index`.\n *\n * #### Notes\n * If no widget is found for `index`, this will bail.\n *\n * @param index Widget index\n */\n expand(index: number): void {\n const widget = (this.layout as AccordionLayout).widgets[index];\n\n if (widget && widget.isHidden) {\n this._toggleExpansion(index);\n }\n }\n\n /**\n * Insert a widget at the specified index.\n *\n * @param index - The index at which to insert the widget.\n *\n * @param widget - The widget to insert into to the panel.\n *\n * #### Notes\n * If the widget is already contained in the panel, it will be moved.\n */\n insertWidget(index: number, widget: Widget): void {\n super.insertWidget(index, widget);\n widget.title.changed.connect(this._onTitleChanged, this);\n }\n\n /**\n * Handle the DOM events for the accordion panel.\n *\n * @param event - The DOM event sent to the panel.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the panel's DOM node. It should\n * not be called directly by user code.\n */\n handleEvent(event: Event): void {\n super.handleEvent(event);\n switch (event.type) {\n case 'click':\n this._evtClick(event as MouseEvent);\n break;\n case 'keydown':\n this._eventKeyDown(event as KeyboardEvent);\n break;\n }\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n this.node.addEventListener('click', this);\n this.node.addEventListener('keydown', this);\n super.onBeforeAttach(msg);\n }\n\n /**\n * A message handler invoked on an `'after-detach'` message.\n */\n protected onAfterDetach(msg: Message): void {\n super.onAfterDetach(msg);\n this.node.removeEventListener('click', this);\n this.node.removeEventListener('keydown', this);\n }\n\n /**\n * Handle the `changed` signal of a title object.\n */\n private _onTitleChanged(sender: Title): void {\n const index = ArrayExt.findFirstIndex(this.widgets, widget => {\n return widget.contains(sender.owner);\n });\n\n if (index >= 0) {\n (this.layout as AccordionLayout).updateTitle(index, sender.owner);\n this.update();\n }\n }\n\n /**\n * Compute the size of widgets in this panel on the title click event.\n * On closing, the size of the widget is cached and we will try to expand\n * the last opened widget.\n * On opening, we will use the cached size if it is available to restore the\n * widget.\n * In both cases, if we can not compute the size of widgets, we will let\n * `SplitLayout` decide.\n *\n * @param index - The index of widget to be opened of closed\n *\n * @returns Relative size of widgets in this panel, if this size can\n * not be computed, return `undefined`\n */\n private _computeWidgetSize(index: number): number[] | undefined {\n const layout = this.layout as AccordionLayout;\n\n const widget = layout.widgets[index];\n if (!widget) {\n return undefined;\n }\n const isHidden = widget.isHidden;\n const widgetSizes = layout.absoluteSizes();\n const delta = (isHidden ? -1 : 1) * this.spacing;\n const totalSize = widgetSizes.reduce(\n (prev: number, curr: number) => prev + curr\n );\n\n let newSize = [...widgetSizes];\n\n if (!isHidden) {\n // Hide the widget\n const currentSize = widgetSizes[index];\n\n this._widgetSizesCache.set(widget, currentSize);\n newSize[index] = 0;\n\n const widgetToCollapse = newSize.map(sz => sz > 0).lastIndexOf(true);\n if (widgetToCollapse === -1) {\n // All widget are closed, let the `SplitLayout` compute widget sizes.\n return undefined;\n }\n\n newSize[widgetToCollapse] =\n widgetSizes[widgetToCollapse] + currentSize + delta;\n } else {\n // Show the widget\n const previousSize = this._widgetSizesCache.get(widget);\n if (!previousSize) {\n // Previous size is unavailable, let the `SplitLayout` compute widget sizes.\n return undefined;\n }\n newSize[index] += previousSize;\n\n const widgetToCollapse = newSize\n .map(sz => sz - previousSize > 0)\n .lastIndexOf(true);\n if (widgetToCollapse === -1) {\n // Can not reduce the size of one widget, reduce all opened widgets\n // proportionally with its size.\n newSize.forEach((_, idx) => {\n if (idx !== index) {\n newSize[idx] -=\n (widgetSizes[idx] / totalSize) * (previousSize - delta);\n }\n });\n } else {\n newSize[widgetToCollapse] -= previousSize - delta;\n }\n }\n return newSize.map(sz => sz / (totalSize + delta));\n }\n /**\n * Handle the `'click'` event for the accordion panel\n */\n private _evtClick(event: MouseEvent): void {\n const target = event.target as HTMLElement | null;\n\n if (target) {\n const index = ArrayExt.findFirstIndex(this.titles, title => {\n return title.contains(target);\n });\n\n if (index >= 0) {\n event.preventDefault();\n event.stopPropagation();\n this._toggleExpansion(index);\n }\n }\n }\n\n /**\n * Handle the `'keydown'` event for the accordion panel.\n */\n private _eventKeyDown(event: KeyboardEvent): void {\n if (event.defaultPrevented) {\n return;\n }\n\n const target = event.target as HTMLElement | null;\n let handled = false;\n if (target) {\n const index = ArrayExt.findFirstIndex(this.titles, title => {\n return title.contains(target);\n });\n\n if (index >= 0) {\n const keyCode = event.keyCode.toString();\n\n // If Space or Enter is pressed on title, emulate click event\n if (event.key.match(/Space|Enter/) || keyCode.match(/13|32/)) {\n target.click();\n handled = true;\n } else if (\n this.orientation === 'horizontal'\n ? event.key.match(/ArrowLeft|ArrowRight/) || keyCode.match(/37|39/)\n : event.key.match(/ArrowUp|ArrowDown/) || keyCode.match(/38|40/)\n ) {\n // If Up or Down (for vertical) / Left or Right (for horizontal) is pressed on title, loop on titles\n const direction =\n event.key.match(/ArrowLeft|ArrowUp/) || keyCode.match(/37|38/)\n ? -1\n : 1;\n const length = this.titles.length;\n const newIndex = (index + length + direction) % length;\n\n this.titles[newIndex].focus();\n handled = true;\n } else if (event.key === 'End' || keyCode === '35') {\n // If End is pressed on title, focus on the last title\n this.titles[this.titles.length - 1].focus();\n handled = true;\n } else if (event.key === 'Home' || keyCode === '36') {\n // If Home is pressed on title, focus on the first title\n this.titles[0].focus();\n handled = true;\n }\n }\n\n if (handled) {\n event.preventDefault();\n }\n }\n }\n\n private _toggleExpansion(index: number) {\n const title = this.titles[index];\n const widget = (this.layout as AccordionLayout).widgets[index];\n\n const newSize = this._computeWidgetSize(index);\n if (newSize) {\n this.setRelativeSizes(newSize, false);\n }\n\n if (widget.isHidden) {\n title.classList.add('lm-mod-expanded');\n title.setAttribute('aria-expanded', 'true');\n widget.show();\n } else {\n title.classList.remove('lm-mod-expanded');\n title.setAttribute('aria-expanded', 'false');\n widget.hide();\n }\n\n // Emit the expansion state signal.\n this._expansionToggled.emit(index);\n }\n\n private _widgetSizesCache: WeakMap = new WeakMap();\n private _expansionToggled = new Signal(this);\n}\n\n/**\n * The namespace for the `AccordionPanel` class statics.\n */\nexport namespace AccordionPanel {\n /**\n * A type alias for a accordion panel orientation.\n */\n export type Orientation = SplitLayout.Orientation;\n\n /**\n * A type alias for a accordion panel alignment.\n */\n export type Alignment = SplitLayout.Alignment;\n\n /**\n * A type alias for a accordion panel renderer.\n */\n export type IRenderer = AccordionLayout.IRenderer;\n\n /**\n * An options object for initializing a accordion panel.\n */\n export interface IOptions extends Partial {\n /**\n * The accordion layout to use for the accordion panel.\n *\n * If this is provided, the other options are ignored.\n *\n * The default is a new `AccordionLayout`.\n */\n layout?: AccordionLayout;\n }\n\n /**\n * The default implementation of `IRenderer`.\n */\n export class Renderer extends SplitPanel.Renderer implements IRenderer {\n constructor() {\n super();\n this._uuid = ++Renderer._nInstance;\n }\n /**\n * A selector which matches any title node in the accordion.\n */\n readonly titleClassName = 'lm-AccordionPanel-title';\n\n /**\n * Render the collapse indicator for a section title.\n *\n * @param data - The data to use for rendering the section title.\n *\n * @returns A element representing the collapse indicator.\n */\n createCollapseIcon(data: Title): HTMLElement {\n return document.createElement('span');\n }\n\n /**\n * Render the element for a section title.\n *\n * @param data - The data to use for rendering the section title.\n *\n * @returns A element representing the section title.\n */\n createSectionTitle(data: Title): HTMLElement {\n const handle = document.createElement('h3');\n handle.setAttribute('tabindex', '0');\n handle.id = this.createTitleKey(data);\n handle.className = this.titleClassName;\n for (const aData in data.dataset) {\n handle.dataset[aData] = data.dataset[aData];\n }\n\n const collapser = handle.appendChild(this.createCollapseIcon(data));\n collapser.className = 'lm-AccordionPanel-titleCollapser';\n\n const label = handle.appendChild(document.createElement('span'));\n label.className = 'lm-AccordionPanel-titleLabel';\n label.textContent = data.label;\n label.title = data.caption || data.label;\n\n return handle;\n }\n\n /**\n * Create a unique render key for the title.\n *\n * @param data - The data to use for the title.\n *\n * @returns The unique render key for the title.\n *\n * #### Notes\n * This method caches the key against the section title the first time\n * the key is generated.\n */\n createTitleKey(data: Title): string {\n let key = this._titleKeys.get(data);\n if (key === undefined) {\n key = `title-key-${this._uuid}-${this._titleID++}`;\n this._titleKeys.set(data, key);\n }\n return key;\n }\n\n private static _nInstance = 0;\n private readonly _uuid: number;\n private _titleID = 0;\n private _titleKeys = new WeakMap, string>();\n }\n\n /**\n * The default `Renderer` instance.\n */\n export const defaultRenderer = new Renderer();\n}\n\nnamespace Private {\n /**\n * Create an accordion layout for the given panel options.\n *\n * @param options Panel options\n * @returns Panel layout\n */\n export function createLayout(\n options: AccordionPanel.IOptions\n ): AccordionLayout {\n return (\n options.layout ||\n new AccordionLayout({\n renderer: options.renderer || AccordionPanel.defaultRenderer,\n orientation: options.orientation,\n alignment: options.alignment,\n spacing: options.spacing,\n titleSpace: options.titleSpace\n })\n );\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { AttachedProperty } from '@lumino/properties';\n\nimport { BoxEngine, BoxSizer } from './boxengine';\n\nimport { LayoutItem } from './layout';\n\nimport { PanelLayout } from './panellayout';\n\nimport Utils from './utils';\n\nimport { Widget } from './widget';\n\n/**\n * A layout which arranges its widgets in a single row or column.\n */\nexport class BoxLayout extends PanelLayout {\n /**\n * Construct a new box layout.\n *\n * @param options - The options for initializing the layout.\n */\n constructor(options: BoxLayout.IOptions = {}) {\n super();\n if (options.direction !== undefined) {\n this._direction = options.direction;\n }\n if (options.alignment !== undefined) {\n this._alignment = options.alignment;\n }\n if (options.spacing !== undefined) {\n this._spacing = Utils.clampDimension(options.spacing);\n }\n }\n\n /**\n * Dispose of the resources held by the layout.\n */\n dispose(): void {\n // Dispose of the layout items.\n for (const item of this._items) {\n item.dispose();\n }\n\n // Clear the layout state.\n this._box = null;\n this._items.length = 0;\n this._sizers.length = 0;\n\n // Dispose of the rest of the layout.\n super.dispose();\n }\n\n /**\n * Get the layout direction for the box layout.\n */\n get direction(): BoxLayout.Direction {\n return this._direction;\n }\n\n /**\n * Set the layout direction for the box layout.\n */\n set direction(value: BoxLayout.Direction) {\n if (this._direction === value) {\n return;\n }\n this._direction = value;\n if (!this.parent) {\n return;\n }\n this.parent.dataset['direction'] = value;\n this.parent.fit();\n }\n\n /**\n * Get the content alignment for the box layout.\n *\n * #### Notes\n * This is the alignment of the widgets in the layout direction.\n *\n * The alignment has no effect if the widgets can expand to fill the\n * entire box layout.\n */\n get alignment(): BoxLayout.Alignment {\n return this._alignment;\n }\n\n /**\n * Set the content alignment for the box layout.\n *\n * #### Notes\n * This is the alignment of the widgets in the layout direction.\n *\n * The alignment has no effect if the widgets can expand to fill the\n * entire box layout.\n */\n set alignment(value: BoxLayout.Alignment) {\n if (this._alignment === value) {\n return;\n }\n this._alignment = value;\n if (!this.parent) {\n return;\n }\n this.parent.dataset['alignment'] = value;\n this.parent.update();\n }\n\n /**\n * Get the inter-element spacing for the box layout.\n */\n get spacing(): number {\n return this._spacing;\n }\n\n /**\n * Set the inter-element spacing for the box layout.\n */\n set spacing(value: number) {\n value = Utils.clampDimension(value);\n if (this._spacing === value) {\n return;\n }\n this._spacing = value;\n if (!this.parent) {\n return;\n }\n this.parent.fit();\n }\n\n /**\n * Perform layout initialization which requires the parent widget.\n */\n protected init(): void {\n this.parent!.dataset['direction'] = this.direction;\n this.parent!.dataset['alignment'] = this.alignment;\n super.init();\n }\n\n /**\n * Attach a widget to the parent's DOM node.\n *\n * @param index - The current index of the widget in the layout.\n *\n * @param widget - The widget to attach to the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected attachWidget(index: number, widget: Widget): void {\n // Create and add a new layout item for the widget.\n ArrayExt.insert(this._items, index, new LayoutItem(widget));\n\n // Create and add a new sizer for the widget.\n ArrayExt.insert(this._sizers, index, new BoxSizer());\n\n // Send a `'before-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n }\n\n // Add the widget's node to the parent.\n this.parent!.node.appendChild(widget.node);\n\n // Send an `'after-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n\n // Post a fit request for the parent widget.\n this.parent!.fit();\n }\n\n /**\n * Move a widget in the parent's DOM node.\n *\n * @param fromIndex - The previous index of the widget in the layout.\n *\n * @param toIndex - The current index of the widget in the layout.\n *\n * @param widget - The widget to move in the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected moveWidget(\n fromIndex: number,\n toIndex: number,\n widget: Widget\n ): void {\n // Move the layout item for the widget.\n ArrayExt.move(this._items, fromIndex, toIndex);\n\n // Move the sizer for the widget.\n ArrayExt.move(this._sizers, fromIndex, toIndex);\n\n // Post an update request for the parent widget.\n this.parent!.update();\n }\n\n /**\n * Detach a widget from the parent's DOM node.\n *\n * @param index - The previous index of the widget in the layout.\n *\n * @param widget - The widget to detach from the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected detachWidget(index: number, widget: Widget): void {\n // Remove the layout item for the widget.\n let item = ArrayExt.removeAt(this._items, index);\n\n // Remove the sizer for the widget.\n ArrayExt.removeAt(this._sizers, index);\n\n // Send a `'before-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n }\n\n // Remove the widget's node from the parent.\n this.parent!.node.removeChild(widget.node);\n\n // Send an `'after-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n\n // Dispose of the layout item.\n item!.dispose();\n\n // Post a fit request for the parent widget.\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'before-show'` message.\n */\n protected onBeforeShow(msg: Message): void {\n super.onBeforeShow(msg);\n this.parent!.update();\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n super.onBeforeAttach(msg);\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-shown'` message.\n */\n protected onChildShown(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-hidden'` message.\n */\n protected onChildHidden(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'resize'` message.\n */\n protected onResize(msg: Widget.ResizeMessage): void {\n if (this.parent!.isVisible) {\n this._update(msg.width, msg.height);\n }\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n protected onUpdateRequest(msg: Message): void {\n if (this.parent!.isVisible) {\n this._update(-1, -1);\n }\n }\n\n /**\n * A message handler invoked on a `'fit-request'` message.\n */\n protected onFitRequest(msg: Message): void {\n if (this.parent!.isAttached) {\n this._fit();\n }\n }\n\n /**\n * Fit the layout to the total size required by the widgets.\n */\n private _fit(): void {\n // Compute the visible item count.\n let nVisible = 0;\n for (let i = 0, n = this._items.length; i < n; ++i) {\n nVisible += +!this._items[i].isHidden;\n }\n\n // Update the fixed space for the visible items.\n this._fixed = this._spacing * Math.max(0, nVisible - 1);\n\n // Setup the computed minimum size.\n let horz = Private.isHorizontal(this._direction);\n let minW = horz ? this._fixed : 0;\n let minH = horz ? 0 : this._fixed;\n\n // Update the sizers and computed minimum size.\n for (let i = 0, n = this._items.length; i < n; ++i) {\n // Fetch the item and corresponding box sizer.\n let item = this._items[i];\n let sizer = this._sizers[i];\n\n // If the item is hidden, it should consume zero size.\n if (item.isHidden) {\n sizer.minSize = 0;\n sizer.maxSize = 0;\n continue;\n }\n\n // Update the size limits for the item.\n item.fit();\n\n // Update the size basis and stretch factor.\n sizer.sizeHint = BoxLayout.getSizeBasis(item.widget);\n sizer.stretch = BoxLayout.getStretch(item.widget);\n\n // Update the sizer limits and computed min size.\n if (horz) {\n sizer.minSize = item.minWidth;\n sizer.maxSize = item.maxWidth;\n minW += item.minWidth;\n minH = Math.max(minH, item.minHeight);\n } else {\n sizer.minSize = item.minHeight;\n sizer.maxSize = item.maxHeight;\n minH += item.minHeight;\n minW = Math.max(minW, item.minWidth);\n }\n }\n\n // Update the box sizing and add it to the computed min size.\n let box = (this._box = ElementExt.boxSizing(this.parent!.node));\n minW += box.horizontalSum;\n minH += box.verticalSum;\n\n // Update the parent's min size constraints.\n let style = this.parent!.node.style;\n style.minWidth = `${minW}px`;\n style.minHeight = `${minH}px`;\n\n // Set the dirty flag to ensure only a single update occurs.\n this._dirty = true;\n\n // Notify the ancestor that it should fit immediately. This may\n // cause a resize of the parent, fulfilling the required update.\n if (this.parent!.parent) {\n MessageLoop.sendMessage(this.parent!.parent!, Widget.Msg.FitRequest);\n }\n\n // If the dirty flag is still set, the parent was not resized.\n // Trigger the required update on the parent widget immediately.\n if (this._dirty) {\n MessageLoop.sendMessage(this.parent!, Widget.Msg.UpdateRequest);\n }\n }\n\n /**\n * Update the layout position and size of the widgets.\n *\n * The parent offset dimensions should be `-1` if unknown.\n */\n private _update(offsetWidth: number, offsetHeight: number): void {\n // Clear the dirty flag to indicate the update occurred.\n this._dirty = false;\n\n // Compute the visible item count.\n let nVisible = 0;\n for (let i = 0, n = this._items.length; i < n; ++i) {\n nVisible += +!this._items[i].isHidden;\n }\n\n // Bail early if there are no visible items to layout.\n if (nVisible === 0) {\n return;\n }\n\n // Measure the parent if the offset dimensions are unknown.\n if (offsetWidth < 0) {\n offsetWidth = this.parent!.node.offsetWidth;\n }\n if (offsetHeight < 0) {\n offsetHeight = this.parent!.node.offsetHeight;\n }\n\n // Ensure the parent box sizing data is computed.\n if (!this._box) {\n this._box = ElementExt.boxSizing(this.parent!.node);\n }\n\n // Compute the layout area adjusted for border and padding.\n let top = this._box.paddingTop;\n let left = this._box.paddingLeft;\n let width = offsetWidth - this._box.horizontalSum;\n let height = offsetHeight - this._box.verticalSum;\n\n // Distribute the layout space and adjust the start position.\n let delta: number;\n switch (this._direction) {\n case 'left-to-right':\n delta = BoxEngine.calc(this._sizers, Math.max(0, width - this._fixed));\n break;\n case 'top-to-bottom':\n delta = BoxEngine.calc(this._sizers, Math.max(0, height - this._fixed));\n break;\n case 'right-to-left':\n delta = BoxEngine.calc(this._sizers, Math.max(0, width - this._fixed));\n left += width;\n break;\n case 'bottom-to-top':\n delta = BoxEngine.calc(this._sizers, Math.max(0, height - this._fixed));\n top += height;\n break;\n default:\n throw 'unreachable';\n }\n\n // Setup the variables for justification and alignment offset.\n let extra = 0;\n let offset = 0;\n\n // Account for alignment if there is extra layout space.\n if (delta > 0) {\n switch (this._alignment) {\n case 'start':\n break;\n case 'center':\n extra = 0;\n offset = delta / 2;\n break;\n case 'end':\n extra = 0;\n offset = delta;\n break;\n case 'justify':\n extra = delta / nVisible;\n offset = 0;\n break;\n default:\n throw 'unreachable';\n }\n }\n\n // Layout the items using the computed box sizes.\n for (let i = 0, n = this._items.length; i < n; ++i) {\n // Fetch the item.\n let item = this._items[i];\n\n // Ignore hidden items.\n if (item.isHidden) {\n continue;\n }\n\n // Fetch the computed size for the widget.\n let size = this._sizers[i].size;\n\n // Update the widget geometry and advance the relevant edge.\n switch (this._direction) {\n case 'left-to-right':\n item.update(left + offset, top, size + extra, height);\n left += size + extra + this._spacing;\n break;\n case 'top-to-bottom':\n item.update(left, top + offset, width, size + extra);\n top += size + extra + this._spacing;\n break;\n case 'right-to-left':\n item.update(left - offset - size - extra, top, size + extra, height);\n left -= size + extra + this._spacing;\n break;\n case 'bottom-to-top':\n item.update(left, top - offset - size - extra, width, size + extra);\n top -= size + extra + this._spacing;\n break;\n default:\n throw 'unreachable';\n }\n }\n }\n\n private _fixed = 0;\n private _spacing = 4;\n private _dirty = false;\n private _sizers: BoxSizer[] = [];\n private _items: LayoutItem[] = [];\n private _box: ElementExt.IBoxSizing | null = null;\n private _alignment: BoxLayout.Alignment = 'start';\n private _direction: BoxLayout.Direction = 'top-to-bottom';\n}\n\n/**\n * The namespace for the `BoxLayout` class statics.\n */\nexport namespace BoxLayout {\n /**\n * A type alias for a box layout direction.\n */\n export type Direction =\n | 'left-to-right'\n | 'right-to-left'\n | 'top-to-bottom'\n | 'bottom-to-top';\n\n /**\n * A type alias for a box layout alignment.\n */\n export type Alignment = 'start' | 'center' | 'end' | 'justify';\n\n /**\n * An options object for initializing a box layout.\n */\n export interface IOptions {\n /**\n * The direction of the layout.\n *\n * The default is `'top-to-bottom'`.\n */\n direction?: Direction;\n\n /**\n * The content alignment of the layout.\n *\n * The default is `'start'`.\n */\n alignment?: Alignment;\n\n /**\n * The spacing between items in the layout.\n *\n * The default is `4`.\n */\n spacing?: number;\n }\n\n /**\n * Get the box layout stretch factor for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The box layout stretch factor for the widget.\n */\n export function getStretch(widget: Widget): number {\n return Private.stretchProperty.get(widget);\n }\n\n /**\n * Set the box layout stretch factor for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the stretch factor.\n */\n export function setStretch(widget: Widget, value: number): void {\n Private.stretchProperty.set(widget, value);\n }\n\n /**\n * Get the box layout size basis for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The box layout size basis for the widget.\n */\n export function getSizeBasis(widget: Widget): number {\n return Private.sizeBasisProperty.get(widget);\n }\n\n /**\n * Set the box layout size basis for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the size basis.\n */\n export function setSizeBasis(widget: Widget, value: number): void {\n Private.sizeBasisProperty.set(widget, value);\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * The property descriptor for a widget stretch factor.\n */\n export const stretchProperty = new AttachedProperty({\n name: 'stretch',\n create: () => 0,\n coerce: (owner, value) => Math.max(0, Math.floor(value)),\n changed: onChildSizingChanged\n });\n\n /**\n * The property descriptor for a widget size basis.\n */\n export const sizeBasisProperty = new AttachedProperty({\n name: 'sizeBasis',\n create: () => 0,\n coerce: (owner, value) => Math.max(0, Math.floor(value)),\n changed: onChildSizingChanged\n });\n\n /**\n * Test whether a direction has horizontal orientation.\n */\n export function isHorizontal(dir: BoxLayout.Direction): boolean {\n return dir === 'left-to-right' || dir === 'right-to-left';\n }\n\n /**\n * Clamp a spacing value to an integer >= 0.\n */\n export function clampSpacing(value: number): number {\n return Math.max(0, Math.floor(value));\n }\n\n /**\n * The change handler for the attached sizing properties.\n */\n function onChildSizingChanged(child: Widget): void {\n if (child.parent && child.parent.layout instanceof BoxLayout) {\n child.parent.fit();\n }\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { BoxLayout } from './boxlayout';\n\nimport { Panel } from './panel';\n\nimport { Widget } from './widget';\n\n/**\n * A panel which arranges its widgets in a single row or column.\n *\n * #### Notes\n * This class provides a convenience wrapper around a {@link BoxLayout}.\n */\nexport class BoxPanel extends Panel {\n /**\n * Construct a new box panel.\n *\n * @param options - The options for initializing the box panel.\n */\n constructor(options: BoxPanel.IOptions = {}) {\n super({ layout: Private.createLayout(options) });\n this.addClass('lm-BoxPanel');\n }\n\n /**\n * Get the layout direction for the box panel.\n */\n get direction(): BoxPanel.Direction {\n return (this.layout as BoxLayout).direction;\n }\n\n /**\n * Set the layout direction for the box panel.\n */\n set direction(value: BoxPanel.Direction) {\n (this.layout as BoxLayout).direction = value;\n }\n\n /**\n * Get the content alignment for the box panel.\n *\n * #### Notes\n * This is the alignment of the widgets in the layout direction.\n *\n * The alignment has no effect if the widgets can expand to fill the\n * entire box layout.\n */\n get alignment(): BoxPanel.Alignment {\n return (this.layout as BoxLayout).alignment;\n }\n\n /**\n * Set the content alignment for the box panel.\n *\n * #### Notes\n * This is the alignment of the widgets in the layout direction.\n *\n * The alignment has no effect if the widgets can expand to fill the\n * entire box layout.\n */\n set alignment(value: BoxPanel.Alignment) {\n (this.layout as BoxLayout).alignment = value;\n }\n\n /**\n * Get the inter-element spacing for the box panel.\n */\n get spacing(): number {\n return (this.layout as BoxLayout).spacing;\n }\n\n /**\n * Set the inter-element spacing for the box panel.\n */\n set spacing(value: number) {\n (this.layout as BoxLayout).spacing = value;\n }\n\n /**\n * A message handler invoked on a `'child-added'` message.\n */\n protected onChildAdded(msg: Widget.ChildMessage): void {\n msg.child.addClass('lm-BoxPanel-child');\n }\n\n /**\n * A message handler invoked on a `'child-removed'` message.\n */\n protected onChildRemoved(msg: Widget.ChildMessage): void {\n msg.child.removeClass('lm-BoxPanel-child');\n }\n}\n\n/**\n * The namespace for the `BoxPanel` class statics.\n */\nexport namespace BoxPanel {\n /**\n * A type alias for a box panel direction.\n */\n export type Direction = BoxLayout.Direction;\n\n /**\n * A type alias for a box panel alignment.\n */\n export type Alignment = BoxLayout.Alignment;\n\n /**\n * An options object for initializing a box panel.\n */\n export interface IOptions {\n /**\n * The layout direction of the panel.\n *\n * Possible values are documented in {@link BoxLayout.Direction}.\n *\n * The default is `'top-to-bottom'`.\n */\n direction?: Direction;\n\n /**\n * The content alignment of the panel.\n *\n * Possible values are documented in {@link BoxLayout.Alignment}.\n *\n * The default is `'start'`.\n */\n alignment?: Alignment;\n\n /**\n * The spacing between items in the panel.\n *\n * The default is `4`.\n */\n spacing?: number;\n\n /**\n * The box layout to use for the box panel.\n *\n * If this is provided, the other options are ignored.\n *\n * The default is a new `BoxLayout`.\n */\n layout?: BoxLayout;\n }\n\n /**\n * Get the box panel stretch factor for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The box panel stretch factor for the widget.\n */\n export function getStretch(widget: Widget): number {\n return BoxLayout.getStretch(widget);\n }\n\n /**\n * Set the box panel stretch factor for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the stretch factor.\n */\n export function setStretch(widget: Widget, value: number): void {\n BoxLayout.setStretch(widget, value);\n }\n\n /**\n * Get the box panel size basis for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The box panel size basis for the widget.\n */\n export function getSizeBasis(widget: Widget): number {\n return BoxLayout.getSizeBasis(widget);\n }\n\n /**\n * Set the box panel size basis for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the size basis.\n */\n export function setSizeBasis(widget: Widget, value: number): void {\n BoxLayout.setSizeBasis(widget, value);\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * Create a box layout for the given panel options.\n */\n export function createLayout(options: BoxPanel.IOptions): BoxLayout {\n return options.layout || new BoxLayout(options);\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt, StringExt } from '@lumino/algorithm';\n\nimport { JSONExt, ReadonlyJSONObject } from '@lumino/coreutils';\n\nimport { CommandRegistry } from '@lumino/commands';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message } from '@lumino/messaging';\n\nimport {\n ElementDataset,\n h,\n VirtualDOM,\n VirtualElement\n} from '@lumino/virtualdom';\n\nimport { Widget } from './widget';\n\n/**\n * A widget which displays command items as a searchable palette.\n */\nexport class CommandPalette extends Widget {\n /**\n * Construct a new command palette.\n *\n * @param options - The options for initializing the palette.\n */\n constructor(options: CommandPalette.IOptions) {\n super({ node: Private.createNode() });\n this.addClass('lm-CommandPalette');\n this.setFlag(Widget.Flag.DisallowLayout);\n this.commands = options.commands;\n this.renderer = options.renderer || CommandPalette.defaultRenderer;\n this.commands.commandChanged.connect(this._onGenericChange, this);\n this.commands.keyBindingChanged.connect(this._onGenericChange, this);\n }\n\n /**\n * Dispose of the resources held by the widget.\n */\n dispose(): void {\n this._items.length = 0;\n this._results = null;\n super.dispose();\n }\n\n /**\n * The command registry used by the command palette.\n */\n readonly commands: CommandRegistry;\n\n /**\n * The renderer used by the command palette.\n */\n readonly renderer: CommandPalette.IRenderer;\n\n /**\n * The command palette search node.\n *\n * #### Notes\n * This is the node which contains the search-related elements.\n */\n get searchNode(): HTMLDivElement {\n return this.node.getElementsByClassName(\n 'lm-CommandPalette-search'\n )[0] as HTMLDivElement;\n }\n\n /**\n * The command palette input node.\n *\n * #### Notes\n * This is the actual input node for the search area.\n */\n get inputNode(): HTMLInputElement {\n return this.node.getElementsByClassName(\n 'lm-CommandPalette-input'\n )[0] as HTMLInputElement;\n }\n\n /**\n * The command palette content node.\n *\n * #### Notes\n * This is the node which holds the command item nodes.\n *\n * Modifying this node directly can lead to undefined behavior.\n */\n get contentNode(): HTMLUListElement {\n return this.node.getElementsByClassName(\n 'lm-CommandPalette-content'\n )[0] as HTMLUListElement;\n }\n\n /**\n * A read-only array of the command items in the palette.\n */\n get items(): ReadonlyArray {\n return this._items;\n }\n\n /**\n * Add a command item to the command palette.\n *\n * @param options - The options for creating the command item.\n *\n * @returns The command item added to the palette.\n */\n addItem(options: CommandPalette.IItemOptions): CommandPalette.IItem {\n // Create a new command item for the options.\n let item = Private.createItem(this.commands, options);\n\n // Add the item to the array.\n this._items.push(item);\n\n // Refresh the search results.\n this.refresh();\n\n // Return the item added to the palette.\n return item;\n }\n\n /**\n * Adds command items to the command palette.\n *\n * @param items - An array of options for creating each command item.\n *\n * @returns The command items added to the palette.\n */\n addItems(items: CommandPalette.IItemOptions[]): CommandPalette.IItem[] {\n const newItems = items.map(item => Private.createItem(this.commands, item));\n newItems.forEach(item => this._items.push(item));\n this.refresh();\n return newItems;\n }\n\n /**\n * Remove an item from the command palette.\n *\n * @param item - The item to remove from the palette.\n *\n * #### Notes\n * This is a no-op if the item is not in the palette.\n */\n removeItem(item: CommandPalette.IItem): void {\n this.removeItemAt(this._items.indexOf(item));\n }\n\n /**\n * Remove the item at a given index from the command palette.\n *\n * @param index - The index of the item to remove.\n *\n * #### Notes\n * This is a no-op if the index is out of range.\n */\n removeItemAt(index: number): void {\n // Remove the item from the array.\n let item = ArrayExt.removeAt(this._items, index);\n\n // Bail if the index is out of range.\n if (!item) {\n return;\n }\n\n // Refresh the search results.\n this.refresh();\n }\n\n /**\n * Remove all items from the command palette.\n */\n clearItems(): void {\n // Bail if there is nothing to remove.\n if (this._items.length === 0) {\n return;\n }\n\n // Clear the array of items.\n this._items.length = 0;\n\n // Refresh the search results.\n this.refresh();\n }\n\n /**\n * Clear the search results and schedule an update.\n *\n * #### Notes\n * This should be called whenever the search results of the palette\n * should be updated.\n *\n * This is typically called automatically by the palette as needed,\n * but can be called manually if the input text is programatically\n * changed.\n *\n * The rendered results are updated asynchronously.\n */\n refresh(): void {\n this._results = null;\n if (this.inputNode.value !== '') {\n let clear = this.node.getElementsByClassName(\n 'lm-close-icon'\n )[0] as HTMLInputElement;\n clear.style.display = 'inherit';\n } else {\n let clear = this.node.getElementsByClassName(\n 'lm-close-icon'\n )[0] as HTMLInputElement;\n clear.style.display = 'none';\n }\n this.update();\n }\n\n /**\n * Handle the DOM events for the command palette.\n *\n * @param event - The DOM event sent to the command palette.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the command palette's DOM node.\n * It should not be called directly by user code.\n */\n handleEvent(event: Event): void {\n switch (event.type) {\n case 'click':\n this._evtClick(event as MouseEvent);\n break;\n case 'keydown':\n this._evtKeyDown(event as KeyboardEvent);\n break;\n case 'input':\n this.refresh();\n break;\n case 'focus':\n case 'blur':\n this._toggleFocused();\n break;\n }\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n this.node.addEventListener('click', this);\n this.node.addEventListener('keydown', this);\n this.node.addEventListener('input', this);\n this.node.addEventListener('focus', this, true);\n this.node.addEventListener('blur', this, true);\n }\n\n /**\n * A message handler invoked on an `'after-detach'` message.\n */\n protected onAfterDetach(msg: Message): void {\n this.node.removeEventListener('click', this);\n this.node.removeEventListener('keydown', this);\n this.node.removeEventListener('input', this);\n this.node.removeEventListener('focus', this, true);\n this.node.removeEventListener('blur', this, true);\n }\n\n /**\n * A message handler invoked on an `'after-show'` message.\n */\n protected onAfterShow(msg: Message): void {\n this.update();\n super.onAfterShow(msg);\n }\n\n /**\n * A message handler invoked on an `'activate-request'` message.\n */\n protected onActivateRequest(msg: Message): void {\n if (this.isAttached) {\n let input = this.inputNode;\n input.focus();\n input.select();\n }\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n protected onUpdateRequest(msg: Message): void {\n if (!this.isVisible) {\n // Ensure to clear the content if the widget is hidden\n VirtualDOM.render(null, this.contentNode);\n return;\n }\n\n // Fetch the current query text and content node.\n let query = this.inputNode.value;\n let contentNode = this.contentNode;\n\n // Ensure the search results are generated.\n let results = this._results;\n if (!results) {\n // Generate and store the new search results.\n results = this._results = Private.search(this._items, query);\n\n // Reset the active index.\n this._activeIndex = query\n ? ArrayExt.findFirstIndex(results, Private.canActivate)\n : -1;\n }\n\n // If there is no query and no results, clear the content.\n if (!query && results.length === 0) {\n VirtualDOM.render(null, contentNode);\n return;\n }\n\n // If the is a query but no results, render the empty message.\n if (query && results.length === 0) {\n let content = this.renderer.renderEmptyMessage({ query });\n VirtualDOM.render(content, contentNode);\n return;\n }\n\n // Create the render content for the search results.\n let renderer = this.renderer;\n let activeIndex = this._activeIndex;\n let content = new Array(results.length);\n for (let i = 0, n = results.length; i < n; ++i) {\n let result = results[i];\n if (result.type === 'header') {\n let indices = result.indices;\n let category = result.category;\n content[i] = renderer.renderHeader({ category, indices });\n } else {\n let item = result.item;\n let indices = result.indices;\n let active = i === activeIndex;\n content[i] = renderer.renderItem({ item, indices, active });\n }\n }\n\n // Render the search result content.\n VirtualDOM.render(content, contentNode);\n\n // Adjust the scroll position as needed.\n if (activeIndex < 0 || activeIndex >= results.length) {\n contentNode.scrollTop = 0;\n } else {\n let element = contentNode.children[activeIndex];\n ElementExt.scrollIntoViewIfNeeded(contentNode, element);\n }\n }\n\n /**\n * Handle the `'click'` event for the command palette.\n */\n private _evtClick(event: MouseEvent): void {\n // Bail if the click is not the left button.\n if (event.button !== 0) {\n return;\n }\n\n // Clear input if the target is clear button\n if ((event.target as HTMLElement).classList.contains('lm-close-icon')) {\n this.inputNode.value = '';\n this.refresh();\n return;\n }\n\n // Find the index of the item which was clicked.\n let index = ArrayExt.findFirstIndex(this.contentNode.children, node => {\n return node.contains(event.target as HTMLElement);\n });\n\n // Bail if the click was not on an item.\n if (index === -1) {\n return;\n }\n\n // Kill the event when a content item is clicked.\n event.preventDefault();\n event.stopPropagation();\n\n // Execute the item if possible.\n this._execute(index);\n }\n\n /**\n * Handle the `'keydown'` event for the command palette.\n */\n private _evtKeyDown(event: KeyboardEvent): void {\n if (event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) {\n return;\n }\n switch (event.keyCode) {\n case 13: // Enter\n event.preventDefault();\n event.stopPropagation();\n this._execute(this._activeIndex);\n break;\n case 38: // Up Arrow\n event.preventDefault();\n event.stopPropagation();\n this._activatePreviousItem();\n break;\n case 40: // Down Arrow\n event.preventDefault();\n event.stopPropagation();\n this._activateNextItem();\n break;\n }\n }\n\n /**\n * Activate the next enabled command item.\n */\n private _activateNextItem(): void {\n // Bail if there are no search results.\n if (!this._results || this._results.length === 0) {\n return;\n }\n\n // Find the next enabled item index.\n let ai = this._activeIndex;\n let n = this._results.length;\n let start = ai < n - 1 ? ai + 1 : 0;\n let stop = start === 0 ? n - 1 : start - 1;\n this._activeIndex = ArrayExt.findFirstIndex(\n this._results,\n Private.canActivate,\n start,\n stop\n );\n\n // Schedule an update of the items.\n this.update();\n }\n\n /**\n * Activate the previous enabled command item.\n */\n private _activatePreviousItem(): void {\n // Bail if there are no search results.\n if (!this._results || this._results.length === 0) {\n return;\n }\n\n // Find the previous enabled item index.\n let ai = this._activeIndex;\n let n = this._results.length;\n let start = ai <= 0 ? n - 1 : ai - 1;\n let stop = start === n - 1 ? 0 : start + 1;\n this._activeIndex = ArrayExt.findLastIndex(\n this._results,\n Private.canActivate,\n start,\n stop\n );\n\n // Schedule an update of the items.\n this.update();\n }\n\n /**\n * Execute the command item at the given index, if possible.\n */\n private _execute(index: number): void {\n // Bail if there are no search results.\n if (!this._results) {\n return;\n }\n\n // Bail if the index is out of range.\n let part = this._results[index];\n if (!part) {\n return;\n }\n\n // Update the search text if the item is a header.\n if (part.type === 'header') {\n let input = this.inputNode;\n input.value = `${part.category.toLowerCase()} `;\n input.focus();\n this.refresh();\n return;\n }\n\n // Bail if item is not enabled.\n if (!part.item.isEnabled) {\n return;\n }\n\n // Execute the item.\n this.commands.execute(part.item.command, part.item.args);\n\n // Clear the query text.\n this.inputNode.value = '';\n\n // Refresh the search results.\n this.refresh();\n }\n\n /**\n * Toggle the focused modifier based on the input node focus state.\n */\n private _toggleFocused(): void {\n let focused = document.activeElement === this.inputNode;\n this.toggleClass('lm-mod-focused', focused);\n }\n\n /**\n * A signal handler for generic command changes.\n */\n private _onGenericChange(): void {\n this.refresh();\n }\n\n private _activeIndex = -1;\n private _items: CommandPalette.IItem[] = [];\n private _results: Private.SearchResult[] | null = null;\n}\n\n/**\n * The namespace for the `CommandPalette` class statics.\n */\nexport namespace CommandPalette {\n /**\n * An options object for creating a command palette.\n */\n export interface IOptions {\n /**\n * The command registry for use with the command palette.\n */\n commands: CommandRegistry;\n\n /**\n * A custom renderer for use with the command palette.\n *\n * The default is a shared renderer instance.\n */\n renderer?: IRenderer;\n }\n\n /**\n * An options object for creating a command item.\n */\n export interface IItemOptions {\n /**\n * The category for the item.\n */\n category: string;\n\n /**\n * The command to execute when the item is triggered.\n */\n command: string;\n\n /**\n * The arguments for the command.\n *\n * The default value is an empty object.\n */\n args?: ReadonlyJSONObject;\n\n /**\n * The rank for the command item.\n *\n * The rank is used as a tie-breaker when ordering command items\n * for display. Items are sorted in the following order:\n * 1. Text match (lower is better)\n * 2. Category (locale order)\n * 3. Rank (lower is better)\n * 4. Label (locale order)\n *\n * The default rank is `Infinity`.\n */\n rank?: number;\n }\n\n /**\n * An object which represents an item in a command palette.\n *\n * #### Notes\n * Item objects are created automatically by a command palette.\n */\n export interface IItem {\n /**\n * The command to execute when the item is triggered.\n */\n readonly command: string;\n\n /**\n * The arguments for the command.\n */\n readonly args: ReadonlyJSONObject;\n\n /**\n * The category for the command item.\n */\n readonly category: string;\n\n /**\n * The rank for the command item.\n */\n readonly rank: number;\n\n /**\n * The display label for the command item.\n */\n readonly label: string;\n\n /**\n * The display caption for the command item.\n */\n readonly caption: string;\n\n /**\n * The icon renderer for the command item.\n */\n readonly icon: VirtualElement.IRenderer | undefined;\n\n /**\n * The icon class for the command item.\n */\n readonly iconClass: string;\n\n /**\n * The icon label for the command item.\n */\n readonly iconLabel: string;\n\n /**\n * The extra class name for the command item.\n */\n readonly className: string;\n\n /**\n * The dataset for the command item.\n */\n readonly dataset: CommandRegistry.Dataset;\n\n /**\n * Whether the command item is enabled.\n */\n readonly isEnabled: boolean;\n\n /**\n * Whether the command item is toggled.\n */\n readonly isToggled: boolean;\n\n /**\n * Whether the command item is toggleable.\n */\n readonly isToggleable: boolean;\n\n /**\n * Whether the command item is visible.\n */\n readonly isVisible: boolean;\n\n /**\n * The key binding for the command item.\n */\n readonly keyBinding: CommandRegistry.IKeyBinding | null;\n }\n\n /**\n * The render data for a command palette header.\n */\n export interface IHeaderRenderData {\n /**\n * The category of the header.\n */\n readonly category: string;\n\n /**\n * The indices of the matched characters in the category.\n */\n readonly indices: ReadonlyArray | null;\n }\n\n /**\n * The render data for a command palette item.\n */\n export interface IItemRenderData {\n /**\n * The command palette item to render.\n */\n readonly item: IItem;\n\n /**\n * The indices of the matched characters in the label.\n */\n readonly indices: ReadonlyArray | null;\n\n /**\n * Whether the item is the active item.\n */\n readonly active: boolean;\n }\n\n /**\n * The render data for a command palette empty message.\n */\n export interface IEmptyMessageRenderData {\n /**\n * The query which failed to match any commands.\n */\n query: string;\n }\n\n /**\n * A renderer for use with a command palette.\n */\n export interface IRenderer {\n /**\n * Render the virtual element for a command palette header.\n *\n * @param data - The data to use for rendering the header.\n *\n * @returns A virtual element representing the header.\n */\n renderHeader(data: IHeaderRenderData): VirtualElement;\n\n /**\n * Render the virtual element for a command palette item.\n *\n * @param data - The data to use for rendering the item.\n *\n * @returns A virtual element representing the item.\n *\n * #### Notes\n * The command palette will not render invisible items.\n */\n renderItem(data: IItemRenderData): VirtualElement;\n\n /**\n * Render the empty results message for a command palette.\n *\n * @param data - The data to use for rendering the message.\n *\n * @returns A virtual element representing the message.\n */\n renderEmptyMessage(data: IEmptyMessageRenderData): VirtualElement;\n }\n\n /**\n * The default implementation of `IRenderer`.\n */\n export class Renderer implements IRenderer {\n /**\n * Render the virtual element for a command palette header.\n *\n * @param data - The data to use for rendering the header.\n *\n * @returns A virtual element representing the header.\n */\n renderHeader(data: IHeaderRenderData): VirtualElement {\n let content = this.formatHeader(data);\n return h.li({ className: 'lm-CommandPalette-header' }, content);\n }\n\n /**\n * Render the virtual element for a command palette item.\n *\n * @param data - The data to use for rendering the item.\n *\n * @returns A virtual element representing the item.\n */\n renderItem(data: IItemRenderData): VirtualElement {\n let className = this.createItemClass(data);\n let dataset = this.createItemDataset(data);\n if (data.item.isToggleable) {\n return h.li(\n {\n className,\n dataset,\n role: 'menuitemcheckbox',\n 'aria-checked': `${data.item.isToggled}`\n },\n this.renderItemIcon(data),\n this.renderItemContent(data),\n this.renderItemShortcut(data)\n );\n }\n return h.li(\n {\n className,\n dataset,\n role: 'menuitem'\n },\n this.renderItemIcon(data),\n this.renderItemContent(data),\n this.renderItemShortcut(data)\n );\n }\n\n /**\n * Render the empty results message for a command palette.\n *\n * @param data - The data to use for rendering the message.\n *\n * @returns A virtual element representing the message.\n */\n renderEmptyMessage(data: IEmptyMessageRenderData): VirtualElement {\n let content = this.formatEmptyMessage(data);\n return h.li({ className: 'lm-CommandPalette-emptyMessage' }, content);\n }\n\n /**\n * Render the icon for a command palette item.\n *\n * @param data - The data to use for rendering the icon.\n *\n * @returns A virtual element representing the icon.\n */\n renderItemIcon(data: IItemRenderData): VirtualElement {\n let className = this.createIconClass(data);\n\n // If data.item.icon is undefined, it will be ignored.\n return h.div({ className }, data.item.icon!, data.item.iconLabel);\n }\n\n /**\n * Render the content for a command palette item.\n *\n * @param data - The data to use for rendering the content.\n *\n * @returns A virtual element representing the content.\n */\n renderItemContent(data: IItemRenderData): VirtualElement {\n return h.div(\n { className: 'lm-CommandPalette-itemContent' },\n this.renderItemLabel(data),\n this.renderItemCaption(data)\n );\n }\n\n /**\n * Render the label for a command palette item.\n *\n * @param data - The data to use for rendering the label.\n *\n * @returns A virtual element representing the label.\n */\n renderItemLabel(data: IItemRenderData): VirtualElement {\n let content = this.formatItemLabel(data);\n return h.div({ className: 'lm-CommandPalette-itemLabel' }, content);\n }\n\n /**\n * Render the caption for a command palette item.\n *\n * @param data - The data to use for rendering the caption.\n *\n * @returns A virtual element representing the caption.\n */\n renderItemCaption(data: IItemRenderData): VirtualElement {\n let content = this.formatItemCaption(data);\n return h.div({ className: 'lm-CommandPalette-itemCaption' }, content);\n }\n\n /**\n * Render the shortcut for a command palette item.\n *\n * @param data - The data to use for rendering the shortcut.\n *\n * @returns A virtual element representing the shortcut.\n */\n renderItemShortcut(data: IItemRenderData): VirtualElement {\n let content = this.formatItemShortcut(data);\n return h.div({ className: 'lm-CommandPalette-itemShortcut' }, content);\n }\n\n /**\n * Create the class name for the command palette item.\n *\n * @param data - The data to use for the class name.\n *\n * @returns The full class name for the command palette item.\n */\n createItemClass(data: IItemRenderData): string {\n // Set up the initial class name.\n let name = 'lm-CommandPalette-item';\n\n // Add the boolean state classes.\n if (!data.item.isEnabled) {\n name += ' lm-mod-disabled';\n }\n if (data.item.isToggled) {\n name += ' lm-mod-toggled';\n }\n if (data.active) {\n name += ' lm-mod-active';\n }\n\n // Add the extra class.\n let extra = data.item.className;\n if (extra) {\n name += ` ${extra}`;\n }\n\n // Return the complete class name.\n return name;\n }\n\n /**\n * Create the dataset for the command palette item.\n *\n * @param data - The data to use for creating the dataset.\n *\n * @returns The dataset for the command palette item.\n */\n createItemDataset(data: IItemRenderData): ElementDataset {\n return { ...data.item.dataset, command: data.item.command };\n }\n\n /**\n * Create the class name for the command item icon.\n *\n * @param data - The data to use for the class name.\n *\n * @returns The full class name for the item icon.\n */\n createIconClass(data: IItemRenderData): string {\n let name = 'lm-CommandPalette-itemIcon';\n let extra = data.item.iconClass;\n return extra ? `${name} ${extra}` : name;\n }\n\n /**\n * Create the render content for the header node.\n *\n * @param data - The data to use for the header content.\n *\n * @returns The content to add to the header node.\n */\n formatHeader(data: IHeaderRenderData): h.Child {\n if (!data.indices || data.indices.length === 0) {\n return data.category;\n }\n return StringExt.highlight(data.category, data.indices, h.mark);\n }\n\n /**\n * Create the render content for the empty message node.\n *\n * @param data - The data to use for the empty message content.\n *\n * @returns The content to add to the empty message node.\n */\n formatEmptyMessage(data: IEmptyMessageRenderData): h.Child {\n return `No commands found that match '${data.query}'`;\n }\n\n /**\n * Create the render content for the item shortcut node.\n *\n * @param data - The data to use for the shortcut content.\n *\n * @returns The content to add to the shortcut node.\n */\n formatItemShortcut(data: IItemRenderData): h.Child {\n let kb = data.item.keyBinding;\n return kb ? CommandRegistry.formatKeystroke(kb.keys) : null;\n }\n\n /**\n * Create the render content for the item label node.\n *\n * @param data - The data to use for the label content.\n *\n * @returns The content to add to the label node.\n */\n formatItemLabel(data: IItemRenderData): h.Child {\n if (!data.indices || data.indices.length === 0) {\n return data.item.label;\n }\n return StringExt.highlight(data.item.label, data.indices, h.mark);\n }\n\n /**\n * Create the render content for the item caption node.\n *\n * @param data - The data to use for the caption content.\n *\n * @returns The content to add to the caption node.\n */\n formatItemCaption(data: IItemRenderData): h.Child {\n return data.item.caption;\n }\n }\n\n /**\n * The default `Renderer` instance.\n */\n export const defaultRenderer = new Renderer();\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * Create the DOM node for a command palette.\n */\n export function createNode(): HTMLDivElement {\n let node = document.createElement('div');\n let search = document.createElement('div');\n let wrapper = document.createElement('div');\n let input = document.createElement('input');\n let content = document.createElement('ul');\n let clear = document.createElement('button');\n search.className = 'lm-CommandPalette-search';\n wrapper.className = 'lm-CommandPalette-wrapper';\n input.className = 'lm-CommandPalette-input';\n clear.className = 'lm-close-icon';\n\n content.className = 'lm-CommandPalette-content';\n content.setAttribute('role', 'menu');\n input.spellcheck = false;\n wrapper.appendChild(input);\n wrapper.appendChild(clear);\n search.appendChild(wrapper);\n node.appendChild(search);\n node.appendChild(content);\n return node;\n }\n\n /**\n * Create a new command item from a command registry and options.\n */\n export function createItem(\n commands: CommandRegistry,\n options: CommandPalette.IItemOptions\n ): CommandPalette.IItem {\n return new CommandItem(commands, options);\n }\n\n /**\n * A search result object for a header label.\n */\n export interface IHeaderResult {\n /**\n * The discriminated type of the object.\n */\n readonly type: 'header';\n\n /**\n * The category for the header.\n */\n readonly category: string;\n\n /**\n * The indices of the matched category characters.\n */\n readonly indices: ReadonlyArray | null;\n }\n\n /**\n * A search result object for a command item.\n */\n export interface IItemResult {\n /**\n * The discriminated type of the object.\n */\n readonly type: 'item';\n\n /**\n * The command item which was matched.\n */\n readonly item: CommandPalette.IItem;\n\n /**\n * The indices of the matched label characters.\n */\n readonly indices: ReadonlyArray | null;\n }\n\n /**\n * A type alias for a search result item.\n */\n export type SearchResult = IHeaderResult | IItemResult;\n\n /**\n * Search an array of command items for fuzzy matches.\n */\n export function search(\n items: CommandPalette.IItem[],\n query: string\n ): SearchResult[] {\n // Fuzzy match the items for the query.\n let scores = matchItems(items, query);\n\n // Sort the items based on their score.\n scores.sort(scoreCmp);\n\n // Create the results for the search.\n return createResults(scores);\n }\n\n /**\n * Test whether a result item can be activated.\n */\n export function canActivate(result: SearchResult): boolean {\n return result.type === 'item' && result.item.isEnabled;\n }\n\n /**\n * Normalize a category for a command item.\n */\n function normalizeCategory(category: string): string {\n return category.trim().replace(/\\s+/g, ' ');\n }\n\n /**\n * Normalize the query text for a fuzzy search.\n */\n function normalizeQuery(text: string): string {\n return text.replace(/\\s+/g, '').toLowerCase();\n }\n\n /**\n * An enum of the supported match types.\n */\n const enum MatchType {\n Label,\n Category,\n Split,\n Default\n }\n\n /**\n * A text match score with associated command item.\n */\n interface IScore {\n /**\n * The numerical type for the text match.\n */\n matchType: MatchType;\n\n /**\n * The numerical score for the text match.\n */\n score: number;\n\n /**\n * The indices of the matched category characters.\n */\n categoryIndices: number[] | null;\n\n /**\n * The indices of the matched label characters.\n */\n labelIndices: number[] | null;\n\n /**\n * The command item associated with the match.\n */\n item: CommandPalette.IItem;\n }\n\n /**\n * Perform a fuzzy match on an array of command items.\n */\n function matchItems(items: CommandPalette.IItem[], query: string): IScore[] {\n // Normalize the query text to lower case with no whitespace.\n query = normalizeQuery(query);\n\n // Create the array to hold the scores.\n let scores: IScore[] = [];\n\n // Iterate over the items and match against the query.\n for (let i = 0, n = items.length; i < n; ++i) {\n // Ignore items which are not visible.\n let item = items[i];\n if (!item.isVisible) {\n continue;\n }\n\n // If the query is empty, all items are matched by default.\n if (!query) {\n scores.push({\n matchType: MatchType.Default,\n categoryIndices: null,\n labelIndices: null,\n score: 0,\n item\n });\n continue;\n }\n\n // Run the fuzzy search for the item and query.\n let score = fuzzySearch(item, query);\n\n // Ignore the item if it is not a match.\n if (!score) {\n continue;\n }\n\n // Penalize disabled items.\n // TODO - push disabled items all the way down in sort cmp?\n if (!item.isEnabled) {\n score.score += 1000;\n }\n\n // Add the score to the results.\n scores.push(score);\n }\n\n // Return the final array of scores.\n return scores;\n }\n\n /**\n * Perform a fuzzy search on a single command item.\n */\n function fuzzySearch(\n item: CommandPalette.IItem,\n query: string\n ): IScore | null {\n // Create the source text to be searched.\n let category = item.category.toLowerCase();\n let label = item.label.toLowerCase();\n let source = `${category} ${label}`;\n\n // Set up the match score and indices array.\n let score = Infinity;\n let indices: number[] | null = null;\n\n // The regex for search word boundaries\n let rgx = /\\b\\w/g;\n\n // Search the source by word boundary.\n // eslint-disable-next-line no-constant-condition\n while (true) {\n // Find the next word boundary in the source.\n let rgxMatch = rgx.exec(source);\n\n // Break if there is no more source context.\n if (!rgxMatch) {\n break;\n }\n\n // Run the string match on the relevant substring.\n let match = StringExt.matchSumOfDeltas(source, query, rgxMatch.index);\n\n // Break if there is no match.\n if (!match) {\n break;\n }\n\n // Update the match if the score is better.\n if (match.score <= score) {\n score = match.score;\n indices = match.indices;\n }\n }\n\n // Bail if there was no match.\n if (!indices || score === Infinity) {\n return null;\n }\n\n // Compute the pivot index between category and label text.\n let pivot = category.length + 1;\n\n // Find the slice index to separate matched indices.\n let j = ArrayExt.lowerBound(indices, pivot, (a, b) => a - b);\n\n // Extract the matched category and label indices.\n let categoryIndices = indices.slice(0, j);\n let labelIndices = indices.slice(j);\n\n // Adjust the label indices for the pivot offset.\n for (let i = 0, n = labelIndices.length; i < n; ++i) {\n labelIndices[i] -= pivot;\n }\n\n // Handle a pure label match.\n if (categoryIndices.length === 0) {\n return {\n matchType: MatchType.Label,\n categoryIndices: null,\n labelIndices,\n score,\n item\n };\n }\n\n // Handle a pure category match.\n if (labelIndices.length === 0) {\n return {\n matchType: MatchType.Category,\n categoryIndices,\n labelIndices: null,\n score,\n item\n };\n }\n\n // Handle a split match.\n return {\n matchType: MatchType.Split,\n categoryIndices,\n labelIndices,\n score,\n item\n };\n }\n\n /**\n * A sort comparison function for a match score.\n */\n function scoreCmp(a: IScore, b: IScore): number {\n // First compare based on the match type\n let m1 = a.matchType - b.matchType;\n if (m1 !== 0) {\n return m1;\n }\n\n // Otherwise, compare based on the match score.\n let d1 = a.score - b.score;\n if (d1 !== 0) {\n return d1;\n }\n\n // Find the match index based on the match type.\n let i1 = 0;\n let i2 = 0;\n switch (a.matchType) {\n case MatchType.Label:\n i1 = a.labelIndices![0];\n i2 = b.labelIndices![0];\n break;\n case MatchType.Category:\n case MatchType.Split:\n i1 = a.categoryIndices![0];\n i2 = b.categoryIndices![0];\n break;\n }\n\n // Compare based on the match index.\n if (i1 !== i2) {\n return i1 - i2;\n }\n\n // Otherwise, compare by category.\n let d2 = a.item.category.localeCompare(b.item.category);\n if (d2 !== 0) {\n return d2;\n }\n\n // Otherwise, compare by rank.\n let r1 = a.item.rank;\n let r2 = b.item.rank;\n if (r1 !== r2) {\n return r1 < r2 ? -1 : 1; // Infinity safe\n }\n\n // Finally, compare by label.\n return a.item.label.localeCompare(b.item.label);\n }\n\n /**\n * Create the results from an array of sorted scores.\n */\n function createResults(scores: IScore[]): SearchResult[] {\n // Set up the search results array.\n let results: SearchResult[] = [];\n\n // Iterate over each score in the array.\n for (let i = 0, n = scores.length; i < n; ++i) {\n // Extract the current item and indices.\n let { item, categoryIndices, labelIndices } = scores[i];\n\n // Extract the category for the current item.\n let category = item.category;\n\n // Is this the same category as the preceding result?\n if (i === 0 || category !== scores[i - 1].item.category) {\n // Add the header result for the category.\n results.push({ type: 'header', category, indices: categoryIndices });\n }\n\n // Create the item result for the score.\n results.push({ type: 'item', item, indices: labelIndices });\n }\n\n // Return the final results.\n return results;\n }\n\n /**\n * A concrete implementation of `CommandPalette.IItem`.\n */\n class CommandItem implements CommandPalette.IItem {\n /**\n * Construct a new command item.\n */\n constructor(\n commands: CommandRegistry,\n options: CommandPalette.IItemOptions\n ) {\n this._commands = commands;\n this.category = normalizeCategory(options.category);\n this.command = options.command;\n this.args = options.args || JSONExt.emptyObject;\n this.rank = options.rank !== undefined ? options.rank : Infinity;\n }\n\n /**\n * The category for the command item.\n */\n readonly category: string;\n\n /**\n * The command to execute when the item is triggered.\n */\n readonly command: string;\n\n /**\n * The arguments for the command.\n */\n readonly args: ReadonlyJSONObject;\n\n /**\n * The rank for the command item.\n */\n readonly rank: number;\n\n /**\n * The display label for the command item.\n */\n get label(): string {\n return this._commands.label(this.command, this.args);\n }\n\n /**\n * The icon renderer for the command item.\n */\n get icon(): VirtualElement.IRenderer | undefined {\n return this._commands.icon(this.command, this.args);\n }\n\n /**\n * The icon class for the command item.\n */\n get iconClass(): string {\n return this._commands.iconClass(this.command, this.args);\n }\n\n /**\n * The icon label for the command item.\n */\n get iconLabel(): string {\n return this._commands.iconLabel(this.command, this.args);\n }\n\n /**\n * The display caption for the command item.\n */\n get caption(): string {\n return this._commands.caption(this.command, this.args);\n }\n\n /**\n * The extra class name for the command item.\n */\n get className(): string {\n return this._commands.className(this.command, this.args);\n }\n\n /**\n * The dataset for the command item.\n */\n get dataset(): CommandRegistry.Dataset {\n return this._commands.dataset(this.command, this.args);\n }\n\n /**\n * Whether the command item is enabled.\n */\n get isEnabled(): boolean {\n return this._commands.isEnabled(this.command, this.args);\n }\n\n /**\n * Whether the command item is toggled.\n */\n get isToggled(): boolean {\n return this._commands.isToggled(this.command, this.args);\n }\n\n /**\n * Whether the command item is toggleable.\n */\n get isToggleable(): boolean {\n return this._commands.isToggleable(this.command, this.args);\n }\n\n /**\n * Whether the command item is visible.\n */\n get isVisible(): boolean {\n return this._commands.isVisible(this.command, this.args);\n }\n\n /**\n * The key binding for the command item.\n */\n get keyBinding(): CommandRegistry.IKeyBinding | null {\n let { command, args } = this;\n return (\n ArrayExt.findLastValue(this._commands.keyBindings, kb => {\n return kb.command === command && JSONExt.deepEqual(kb.args, args);\n }) || null\n );\n }\n\n private _commands: CommandRegistry;\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { CommandRegistry } from '@lumino/commands';\n\nimport { JSONExt, ReadonlyJSONObject } from '@lumino/coreutils';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { getKeyboardLayout } from '@lumino/keyboard';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport {\n ARIAAttrNames,\n ElementARIAAttrs,\n ElementDataset,\n h,\n VirtualDOM,\n VirtualElement\n} from '@lumino/virtualdom';\n\nimport { Widget } from './widget';\n\ninterface IWindowData {\n pageXOffset: number;\n pageYOffset: number;\n clientWidth: number;\n clientHeight: number;\n}\n\n/**\n * A widget which displays items as a canonical menu.\n */\nexport class Menu extends Widget {\n /**\n * Construct a new menu.\n *\n * @param options - The options for initializing the menu.\n */\n constructor(options: Menu.IOptions) {\n super({ node: Private.createNode() });\n this.addClass('lm-Menu');\n this.setFlag(Widget.Flag.DisallowLayout);\n this.commands = options.commands;\n this.renderer = options.renderer || Menu.defaultRenderer;\n }\n\n /**\n * Dispose of the resources held by the menu.\n */\n dispose(): void {\n this.close();\n this._items.length = 0;\n super.dispose();\n }\n\n /**\n * A signal emitted just before the menu is closed.\n *\n * #### Notes\n * This signal is emitted when the menu receives a `'close-request'`\n * message, just before it removes itself from the DOM.\n *\n * This signal is not emitted if the menu is already detached from\n * the DOM when it receives the `'close-request'` message.\n */\n get aboutToClose(): ISignal {\n return this._aboutToClose;\n }\n\n /**\n * A signal emitted when a new menu is requested by the user.\n *\n * #### Notes\n * This signal is emitted whenever the user presses the right or left\n * arrow keys, and a submenu cannot be opened or closed in response.\n *\n * This signal is useful when implementing menu bars in order to open\n * the next or previous menu in response to a user key press.\n *\n * This signal is only emitted for the root menu in a hierarchy.\n */\n get menuRequested(): ISignal {\n return this._menuRequested;\n }\n\n /**\n * The command registry used by the menu.\n */\n readonly commands: CommandRegistry;\n\n /**\n * The renderer used by the menu.\n */\n readonly renderer: Menu.IRenderer;\n\n /**\n * The parent menu of the menu.\n *\n * #### Notes\n * This is `null` unless the menu is an open submenu.\n */\n get parentMenu(): Menu | null {\n return this._parentMenu;\n }\n\n /**\n * The child menu of the menu.\n *\n * #### Notes\n * This is `null` unless the menu has an open submenu.\n */\n get childMenu(): Menu | null {\n return this._childMenu;\n }\n\n /**\n * The root menu of the menu hierarchy.\n */\n get rootMenu(): Menu {\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n let menu: Menu = this;\n while (menu._parentMenu) {\n menu = menu._parentMenu;\n }\n return menu;\n }\n\n /**\n * The leaf menu of the menu hierarchy.\n */\n get leafMenu(): Menu {\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n let menu: Menu = this;\n while (menu._childMenu) {\n menu = menu._childMenu;\n }\n return menu;\n }\n\n /**\n * The menu content node.\n *\n * #### Notes\n * This is the node which holds the menu item nodes.\n *\n * Modifying this node directly can lead to undefined behavior.\n */\n get contentNode(): HTMLUListElement {\n return this.node.getElementsByClassName(\n 'lm-Menu-content'\n )[0] as HTMLUListElement;\n }\n\n /**\n * Get the currently active menu item.\n */\n get activeItem(): Menu.IItem | null {\n return this._items[this._activeIndex] || null;\n }\n\n /**\n * Set the currently active menu item.\n *\n * #### Notes\n * If the item cannot be activated, the item will be set to `null`.\n */\n set activeItem(value: Menu.IItem | null) {\n this.activeIndex = value ? this._items.indexOf(value) : -1;\n }\n\n /**\n * Get the index of the currently active menu item.\n *\n * #### Notes\n * This will be `-1` if no menu item is active.\n */\n get activeIndex(): number {\n return this._activeIndex;\n }\n\n /**\n * Set the index of the currently active menu item.\n *\n * #### Notes\n * If the item cannot be activated, the index will be set to `-1`.\n */\n set activeIndex(value: number) {\n // Adjust the value for an out of range index.\n if (value < 0 || value >= this._items.length) {\n value = -1;\n }\n\n // Ensure the item can be activated.\n if (value !== -1 && !Private.canActivate(this._items[value])) {\n value = -1;\n }\n\n // Bail if the index will not change.\n if (this._activeIndex === value) {\n return;\n }\n\n // Update the active index.\n this._activeIndex = value;\n\n // Make active element in focus\n if (\n this._activeIndex >= 0 &&\n this.contentNode.childNodes[this._activeIndex]\n ) {\n (this.contentNode.childNodes[this._activeIndex] as HTMLElement).focus();\n }\n\n // schedule an update of the items.\n this.update();\n }\n\n /**\n * A read-only array of the menu items in the menu.\n */\n get items(): ReadonlyArray {\n return this._items;\n }\n\n /**\n * Activate the next selectable item in the menu.\n *\n * #### Notes\n * If no item is selectable, the index will be set to `-1`.\n */\n activateNextItem(): void {\n let n = this._items.length;\n let ai = this._activeIndex;\n let start = ai < n - 1 ? ai + 1 : 0;\n let stop = start === 0 ? n - 1 : start - 1;\n this.activeIndex = ArrayExt.findFirstIndex(\n this._items,\n Private.canActivate,\n start,\n stop\n );\n }\n\n /**\n * Activate the previous selectable item in the menu.\n *\n * #### Notes\n * If no item is selectable, the index will be set to `-1`.\n */\n activatePreviousItem(): void {\n let n = this._items.length;\n let ai = this._activeIndex;\n let start = ai <= 0 ? n - 1 : ai - 1;\n let stop = start === n - 1 ? 0 : start + 1;\n this.activeIndex = ArrayExt.findLastIndex(\n this._items,\n Private.canActivate,\n start,\n stop\n );\n }\n\n /**\n * Trigger the active menu item.\n *\n * #### Notes\n * If the active item is a submenu, it will be opened and the first\n * item will be activated.\n *\n * If the active item is a command, the command will be executed.\n *\n * If the menu is not attached, this is a no-op.\n *\n * If there is no active item, this is a no-op.\n */\n triggerActiveItem(): void {\n // Bail if the menu is not attached.\n if (!this.isAttached) {\n return;\n }\n\n // Bail if there is no active item.\n let item = this.activeItem;\n if (!item) {\n return;\n }\n\n // Cancel the pending timers.\n this._cancelOpenTimer();\n this._cancelCloseTimer();\n\n // If the item is a submenu, open it.\n if (item.type === 'submenu') {\n this._openChildMenu(true);\n return;\n }\n\n // Close the root menu before executing the command.\n this.rootMenu.close();\n\n // Execute the command for the item.\n let { command, args } = item;\n if (this.commands.isEnabled(command, args)) {\n this.commands.execute(command, args);\n } else {\n console.log(`Command '${command}' is disabled.`);\n }\n }\n\n /**\n * Add a menu item to the end of the menu.\n *\n * @param options - The options for creating the menu item.\n *\n * @returns The menu item added to the menu.\n */\n addItem(options: Menu.IItemOptions): Menu.IItem {\n return this.insertItem(this._items.length, options);\n }\n\n /**\n * Insert a menu item into the menu at the specified index.\n *\n * @param index - The index at which to insert the item.\n *\n * @param options - The options for creating the menu item.\n *\n * @returns The menu item added to the menu.\n *\n * #### Notes\n * The index will be clamped to the bounds of the items.\n */\n insertItem(index: number, options: Menu.IItemOptions): Menu.IItem {\n // Close the menu if it's attached.\n if (this.isAttached) {\n this.close();\n }\n\n // Reset the active index.\n this.activeIndex = -1;\n\n // Clamp the insert index to the array bounds.\n let i = Math.max(0, Math.min(index, this._items.length));\n\n // Create the item for the options.\n let item = Private.createItem(this, options);\n\n // Insert the item into the array.\n ArrayExt.insert(this._items, i, item);\n\n // Schedule an update of the items.\n this.update();\n\n // Return the item added to the menu.\n return item;\n }\n\n /**\n * Remove an item from the menu.\n *\n * @param item - The item to remove from the menu.\n *\n * #### Notes\n * This is a no-op if the item is not in the menu.\n */\n removeItem(item: Menu.IItem): void {\n this.removeItemAt(this._items.indexOf(item));\n }\n\n /**\n * Remove the item at a given index from the menu.\n *\n * @param index - The index of the item to remove.\n *\n * #### Notes\n * This is a no-op if the index is out of range.\n */\n removeItemAt(index: number): void {\n // Close the menu if it's attached.\n if (this.isAttached) {\n this.close();\n }\n\n // Reset the active index.\n this.activeIndex = -1;\n\n // Remove the item from the array.\n let item = ArrayExt.removeAt(this._items, index);\n\n // Bail if the index is out of range.\n if (!item) {\n return;\n }\n\n // Schedule an update of the items.\n this.update();\n }\n\n /**\n * Remove all menu items from the menu.\n */\n clearItems(): void {\n // Close the menu if it's attached.\n if (this.isAttached) {\n this.close();\n }\n\n // Reset the active index.\n this.activeIndex = -1;\n\n // Bail if there is nothing to remove.\n if (this._items.length === 0) {\n return;\n }\n\n // Clear the items.\n this._items.length = 0;\n\n // Schedule an update of the items.\n this.update();\n }\n\n /**\n * Open the menu at the specified location.\n *\n * @param x - The client X coordinate of the menu location.\n *\n * @param y - The client Y coordinate of the menu location.\n *\n * @param options - The additional options for opening the menu.\n *\n * #### Notes\n * The menu will be opened at the given location unless it will not\n * fully fit on the screen. If it will not fit, it will be adjusted\n * to fit naturally on the screen.\n *\n * The menu will be attached under the `host` element in the DOM\n * (or `document.body` if `host` is `null`) and before the `ref`\n * element (or as the last child of `host` if `ref` is `null`).\n * The menu may be displayed outside of the `host` element\n * following the rules of CSS absolute positioning.\n *\n * This is a no-op if the menu is already attached to the DOM.\n */\n open(x: number, y: number, options: Menu.IOpenOptions = {}): void {\n // Bail early if the menu is already attached.\n if (this.isAttached) {\n return;\n }\n\n // Extract the menu options.\n let forceX = options.forceX || false;\n let forceY = options.forceY || false;\n const host = options.host ?? null;\n const ref = options.ref ?? null;\n const horizontalAlignment =\n options.horizontalAlignment ??\n (document.documentElement.dir === 'rtl' ? 'right' : 'left');\n\n // Open the menu as a root menu.\n Private.openRootMenu(\n this,\n x,\n y,\n forceX,\n forceY,\n horizontalAlignment,\n host,\n ref\n );\n\n // Activate the menu to accept keyboard input.\n this.activate();\n }\n\n /**\n * Handle the DOM events for the menu.\n *\n * @param event - The DOM event sent to the menu.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the menu's DOM nodes. It should\n * not be called directly by user code.\n */\n handleEvent(event: Event): void {\n switch (event.type) {\n case 'keydown':\n this._evtKeyDown(event as KeyboardEvent);\n break;\n case 'mouseup':\n this._evtMouseUp(event as MouseEvent);\n break;\n case 'mousemove':\n this._evtMouseMove(event as MouseEvent);\n break;\n case 'mouseenter':\n this._evtMouseEnter(event as MouseEvent);\n break;\n case 'mouseleave':\n this._evtMouseLeave(event as MouseEvent);\n break;\n case 'mousedown':\n this._evtMouseDown(event as MouseEvent);\n break;\n case 'contextmenu':\n event.preventDefault();\n event.stopPropagation();\n break;\n }\n }\n\n /**\n * A message handler invoked on a `'after-attach'` message.\n */\n protected override onAfterAttach(msg: Message): void {\n this.node.addEventListener('keydown', this);\n this.node.addEventListener('mouseup', this);\n this.node.addEventListener('mousemove', this);\n this.node.addEventListener('mouseenter', this);\n this.node.addEventListener('mouseleave', this);\n this.node.addEventListener('contextmenu', this);\n this.node.ownerDocument.addEventListener('mousedown', this, true);\n }\n\n /**\n * A message handler invoked on an `'before-detach'` message.\n */\n protected override onBeforeDetach(msg: Message): void {\n this.node.removeEventListener('keydown', this);\n this.node.removeEventListener('mouseup', this);\n this.node.removeEventListener('mousemove', this);\n this.node.removeEventListener('mouseenter', this);\n this.node.removeEventListener('mouseleave', this);\n this.node.removeEventListener('contextmenu', this);\n this.node.ownerDocument.removeEventListener('mousedown', this, true);\n }\n\n /**\n * A message handler invoked on an `'activate-request'` message.\n */\n protected onActivateRequest(msg: Message): void {\n if (this.isAttached) {\n this.node.focus();\n }\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n protected onUpdateRequest(msg: Message): void {\n let items = this._items;\n let renderer = this.renderer;\n let activeIndex = this._activeIndex;\n let collapsedFlags = Private.computeCollapsed(items);\n let content = new Array(items.length);\n for (let i = 0, n = items.length; i < n; ++i) {\n let item = items[i];\n let active = i === activeIndex;\n let collapsed = collapsedFlags[i];\n content[i] = renderer.renderItem({\n item,\n active,\n collapsed,\n onfocus: () => {\n this.activeIndex = i;\n }\n });\n }\n VirtualDOM.render(content, this.contentNode);\n }\n\n /**\n * A message handler invoked on a `'close-request'` message.\n */\n protected onCloseRequest(msg: Message): void {\n // Cancel the pending timers.\n this._cancelOpenTimer();\n this._cancelCloseTimer();\n\n // Reset the active index.\n this.activeIndex = -1;\n\n // Close any open child menu.\n let childMenu = this._childMenu;\n if (childMenu) {\n this._childIndex = -1;\n this._childMenu = null;\n childMenu._parentMenu = null;\n childMenu.close();\n }\n\n // Remove this menu from its parent and activate the parent.\n let parentMenu = this._parentMenu;\n if (parentMenu) {\n this._parentMenu = null;\n parentMenu._childIndex = -1;\n parentMenu._childMenu = null;\n parentMenu.activate();\n }\n\n // Emit the `aboutToClose` signal if the menu is attached.\n if (this.isAttached) {\n this._aboutToClose.emit(undefined);\n }\n\n // Finish closing the menu.\n super.onCloseRequest(msg);\n }\n\n /**\n * Handle the `'keydown'` event for the menu.\n *\n * #### Notes\n * This listener is attached to the menu node.\n */\n private _evtKeyDown(event: KeyboardEvent): void {\n // A menu handles all keydown events.\n event.preventDefault();\n event.stopPropagation();\n\n // Fetch the key code for the event.\n let kc = event.keyCode;\n\n // Enter\n if (kc === 13) {\n this.triggerActiveItem();\n return;\n }\n\n // Escape\n if (kc === 27) {\n this.close();\n return;\n }\n\n // Left Arrow\n if (kc === 37) {\n if (this._parentMenu) {\n this.close();\n } else {\n this._menuRequested.emit('previous');\n }\n return;\n }\n\n // Up Arrow\n if (kc === 38) {\n this.activatePreviousItem();\n return;\n }\n\n // Right Arrow\n if (kc === 39) {\n let item = this.activeItem;\n if (item && item.type === 'submenu') {\n this.triggerActiveItem();\n } else {\n this.rootMenu._menuRequested.emit('next');\n }\n return;\n }\n\n // Down Arrow\n if (kc === 40) {\n this.activateNextItem();\n return;\n }\n\n // Get the pressed key character.\n let key = getKeyboardLayout().keyForKeydownEvent(event);\n\n // Bail if the key is not valid.\n if (!key) {\n return;\n }\n\n // Search for the next best matching mnemonic item.\n let start = this._activeIndex + 1;\n let result = Private.findMnemonic(this._items, key, start);\n\n // Handle the requested mnemonic based on the search results.\n // If exactly one mnemonic is matched, that item is triggered.\n // Otherwise, the next mnemonic is activated if available,\n // followed by the auto mnemonic if available.\n if (result.index !== -1 && !result.multiple) {\n this.activeIndex = result.index;\n this.triggerActiveItem();\n } else if (result.index !== -1) {\n this.activeIndex = result.index;\n } else if (result.auto !== -1) {\n this.activeIndex = result.auto;\n }\n }\n\n /**\n * Handle the `'mouseup'` event for the menu.\n *\n * #### Notes\n * This listener is attached to the menu node.\n */\n private _evtMouseUp(event: MouseEvent): void {\n if (event.button !== 0) {\n return;\n }\n event.preventDefault();\n event.stopPropagation();\n this.triggerActiveItem();\n }\n\n /**\n * Handle the `'mousemove'` event for the menu.\n *\n * #### Notes\n * This listener is attached to the menu node.\n */\n private _evtMouseMove(event: MouseEvent): void {\n // Hit test the item nodes for the item under the mouse.\n let index = ArrayExt.findFirstIndex(this.contentNode.children, node => {\n return ElementExt.hitTest(node, event.clientX, event.clientY);\n });\n\n // Bail early if the mouse is already over the active index.\n if (index === this._activeIndex) {\n return;\n }\n\n // Update and coerce the active index.\n this.activeIndex = index;\n index = this.activeIndex;\n\n // If the index is the current child index, cancel the timers.\n if (index === this._childIndex) {\n this._cancelOpenTimer();\n this._cancelCloseTimer();\n return;\n }\n\n // If a child menu is currently open, start the close timer.\n if (this._childIndex !== -1) {\n this._startCloseTimer();\n }\n\n // Cancel the open timer to give a full delay for opening.\n this._cancelOpenTimer();\n\n // Bail if the active item is not a valid submenu item.\n let item = this.activeItem;\n if (!item || item.type !== 'submenu' || !item.submenu) {\n return;\n }\n\n // Start the open timer to open the active item submenu.\n this._startOpenTimer();\n }\n\n /**\n * Handle the `'mouseenter'` event for the menu.\n *\n * #### Notes\n * This listener is attached to the menu node.\n */\n private _evtMouseEnter(event: MouseEvent): void {\n // Synchronize the active ancestor items.\n for (let menu = this._parentMenu; menu; menu = menu._parentMenu) {\n menu._cancelOpenTimer();\n menu._cancelCloseTimer();\n menu.activeIndex = menu._childIndex;\n }\n }\n\n /**\n * Handle the `'mouseleave'` event for the menu.\n *\n * #### Notes\n * This listener is attached to the menu node.\n */\n private _evtMouseLeave(event: MouseEvent): void {\n // Cancel any pending submenu opening.\n this._cancelOpenTimer();\n\n // If there is no open child menu, just reset the active index.\n if (!this._childMenu) {\n this.activeIndex = -1;\n return;\n }\n\n // If the mouse is over the child menu, cancel the close timer.\n let { clientX, clientY } = event;\n if (ElementExt.hitTest(this._childMenu.node, clientX, clientY)) {\n this._cancelCloseTimer();\n return;\n }\n\n // Otherwise, reset the active index and start the close timer.\n this.activeIndex = -1;\n this._startCloseTimer();\n }\n\n /**\n * Handle the `'mousedown'` event for the menu.\n *\n * #### Notes\n * This listener is attached to the document node.\n */\n private _evtMouseDown(event: MouseEvent): void {\n // Bail if the menu is not a root menu.\n if (this._parentMenu) {\n return;\n }\n\n // The mouse button which is pressed is irrelevant. If the press\n // is not on a menu, the entire hierarchy is closed and the event\n // is allowed to propagate. This allows other code to act on the\n // event, such as focusing the clicked element.\n if (Private.hitTestMenus(this, event.clientX, event.clientY)) {\n event.preventDefault();\n event.stopPropagation();\n } else {\n this.close();\n }\n }\n\n /**\n * Open the child menu at the active index immediately.\n *\n * If a different child menu is already open, it will be closed,\n * even if the active item is not a valid submenu.\n */\n private _openChildMenu(activateFirst = false): void {\n // If the item is not a valid submenu, close the child menu.\n let item = this.activeItem;\n if (!item || item.type !== 'submenu' || !item.submenu) {\n this._closeChildMenu();\n return;\n }\n\n // Do nothing if the child menu will not change.\n let submenu = item.submenu;\n if (submenu === this._childMenu) {\n return;\n }\n\n // Prior to any DOM modifications save window data\n Menu.saveWindowData();\n\n // Ensure the current child menu is closed.\n this._closeChildMenu();\n\n // Update the private child state.\n this._childMenu = submenu;\n this._childIndex = this._activeIndex;\n\n // Set the parent menu reference for the child.\n submenu._parentMenu = this;\n\n // Ensure the menu is updated and lookup the item node.\n MessageLoop.sendMessage(this, Widget.Msg.UpdateRequest);\n let itemNode = this.contentNode.children[this._activeIndex];\n\n // Open the submenu at the active node.\n Private.openSubmenu(submenu, itemNode as HTMLElement);\n\n // Activate the first item if desired.\n if (activateFirst) {\n submenu.activeIndex = -1;\n submenu.activateNextItem();\n }\n\n // Activate the child menu.\n submenu.activate();\n }\n\n /**\n * Close the child menu immediately.\n *\n * This is a no-op if a child menu is not open.\n */\n private _closeChildMenu(): void {\n if (this._childMenu) {\n this._childMenu.close();\n }\n }\n\n /**\n * Start the open timer, unless it is already pending.\n */\n private _startOpenTimer(): void {\n if (this._openTimerID === 0) {\n this._openTimerID = window.setTimeout(() => {\n this._openTimerID = 0;\n this._openChildMenu();\n }, Private.TIMER_DELAY);\n }\n }\n\n /**\n * Start the close timer, unless it is already pending.\n */\n private _startCloseTimer(): void {\n if (this._closeTimerID === 0) {\n this._closeTimerID = window.setTimeout(() => {\n this._closeTimerID = 0;\n this._closeChildMenu();\n }, Private.TIMER_DELAY);\n }\n }\n\n /**\n * Cancel the open timer, if the timer is pending.\n */\n private _cancelOpenTimer(): void {\n if (this._openTimerID !== 0) {\n clearTimeout(this._openTimerID);\n this._openTimerID = 0;\n }\n }\n\n /**\n * Cancel the close timer, if the timer is pending.\n */\n private _cancelCloseTimer(): void {\n if (this._closeTimerID !== 0) {\n clearTimeout(this._closeTimerID);\n this._closeTimerID = 0;\n }\n }\n\n /**\n * Save window data used for menu positioning in transient cache.\n *\n * In order to avoid layout trashing it is recommended to invoke this\n * method immediately prior to opening the menu and any DOM modifications\n * (like closing previously visible menu, or adding a class to menu widget).\n *\n * The transient cache will be released upon `open()` call.\n */\n static saveWindowData(): void {\n Private.saveWindowData();\n }\n\n private _childIndex = -1;\n private _activeIndex = -1;\n private _openTimerID = 0;\n private _closeTimerID = 0;\n private _items: Menu.IItem[] = [];\n private _childMenu: Menu | null = null;\n private _parentMenu: Menu | null = null;\n private _aboutToClose = new Signal(this);\n private _menuRequested = new Signal(this);\n}\n\n/**\n * The namespace for the `Menu` class statics.\n */\nexport namespace Menu {\n /**\n * An options object for creating a menu.\n */\n export interface IOptions {\n /**\n * The command registry for use with the menu.\n */\n commands: CommandRegistry;\n\n /**\n * A custom renderer for use with the menu.\n *\n * The default is a shared renderer instance.\n */\n renderer?: IRenderer;\n }\n\n /**\n * An options object for the `open` method on a menu.\n */\n export interface IOpenOptions {\n /**\n * Whether to force the X position of the menu.\n *\n * Setting to `true` will disable the logic which repositions the\n * X coordinate of the menu if it will not fit entirely on screen.\n *\n * The default is `false`.\n */\n forceX?: boolean;\n\n /**\n * Whether to force the Y position of the menu.\n *\n * Setting to `true` will disable the logic which repositions the\n * Y coordinate of the menu if it will not fit entirely on screen.\n *\n * The default is `false`.\n */\n forceY?: boolean;\n\n /**\n * The DOM node to use as the menu's host.\n *\n * If not specified then uses `document.body`.\n */\n host?: HTMLElement;\n\n /**\n * The child of `host` to use as the reference element.\n * If this is provided, the menu will be inserted before this\n * node in the host. The default is `null`, which will cause the\n * menu to be added as the last child of the host.\n */\n ref?: HTMLElement;\n\n /**\n * The alignment of the menu.\n *\n * The default is `'left'` unless the document `dir` attribute is `'rtl'`\n */\n horizontalAlignment?: 'left' | 'right';\n }\n\n /**\n * A type alias for a menu item type.\n */\n export type ItemType = 'command' | 'submenu' | 'separator';\n\n /**\n * An options object for creating a menu item.\n */\n export interface IItemOptions {\n /**\n * The type of the menu item.\n *\n * The default value is `'command'`.\n */\n type?: ItemType;\n\n /**\n * The command to execute when the item is triggered.\n *\n * The default value is an empty string.\n */\n command?: string;\n\n /**\n * The arguments for the command.\n *\n * The default value is an empty object.\n */\n args?: ReadonlyJSONObject;\n\n /**\n * The submenu for a `'submenu'` type item.\n *\n * The default value is `null`.\n */\n submenu?: Menu | null;\n }\n\n /**\n * An object which represents a menu item.\n *\n * #### Notes\n * Item objects are created automatically by a menu.\n */\n export interface IItem {\n /**\n * The type of the menu item.\n */\n readonly type: ItemType;\n\n /**\n * The command to execute when the item is triggered.\n */\n readonly command: string;\n\n /**\n * The arguments for the command.\n */\n readonly args: ReadonlyJSONObject;\n\n /**\n * The submenu for a `'submenu'` type item.\n */\n readonly submenu: Menu | null;\n\n /**\n * The display label for the menu item.\n */\n readonly label: string;\n\n /**\n * The mnemonic index for the menu item.\n */\n readonly mnemonic: number;\n\n /**\n * The icon renderer for the menu item.\n */\n readonly icon: VirtualElement.IRenderer | undefined;\n\n /**\n * The icon class for the menu item.\n */\n readonly iconClass: string;\n\n /**\n * The icon label for the menu item.\n */\n readonly iconLabel: string;\n\n /**\n * The display caption for the menu item.\n */\n readonly caption: string;\n\n /**\n * The extra class name for the menu item.\n */\n readonly className: string;\n\n /**\n * The dataset for the menu item.\n */\n readonly dataset: CommandRegistry.Dataset;\n\n /**\n * Whether the menu item is enabled.\n */\n readonly isEnabled: boolean;\n\n /**\n * Whether the menu item is toggled.\n */\n readonly isToggled: boolean;\n\n /**\n * Whether the menu item is visible.\n */\n readonly isVisible: boolean;\n\n /**\n * The key binding for the menu item.\n */\n readonly keyBinding: CommandRegistry.IKeyBinding | null;\n }\n\n /**\n * An object which holds the data to render a menu item.\n */\n export interface IRenderData {\n /**\n * The item to be rendered.\n */\n readonly item: IItem;\n\n /**\n * Whether the item is the active item.\n */\n readonly active: boolean;\n\n /**\n * Whether the item should be collapsed.\n */\n readonly collapsed: boolean;\n\n /**\n * Handler for when element is in focus.\n */\n readonly onfocus?: () => void;\n }\n\n /**\n * A renderer for use with a menu.\n */\n export interface IRenderer {\n /**\n * Render the virtual element for a menu item.\n *\n * @param data - The data to use for rendering the item.\n *\n * @returns A virtual element representing the item.\n */\n renderItem(data: IRenderData): VirtualElement;\n }\n\n /**\n * The default implementation of `IRenderer`.\n *\n * #### Notes\n * Subclasses are free to reimplement rendering methods as needed.\n */\n export class Renderer implements IRenderer {\n /**\n * Render the virtual element for a menu item.\n *\n * @param data - The data to use for rendering the item.\n *\n * @returns A virtual element representing the item.\n */\n renderItem(data: IRenderData): VirtualElement {\n let className = this.createItemClass(data);\n let dataset = this.createItemDataset(data);\n let aria = this.createItemARIA(data);\n return h.li(\n {\n className,\n dataset,\n tabindex: '0',\n onfocus: data.onfocus,\n ...aria\n },\n this.renderIcon(data),\n this.renderLabel(data),\n this.renderShortcut(data),\n this.renderSubmenu(data)\n );\n }\n\n /**\n * Render the icon element for a menu item.\n *\n * @param data - The data to use for rendering the icon.\n *\n * @returns A virtual element representing the item icon.\n */\n renderIcon(data: IRenderData): VirtualElement {\n let className = this.createIconClass(data);\n\n // If data.item.icon is undefined, it will be ignored.\n return h.div({ className }, data.item.icon!, data.item.iconLabel);\n }\n\n /**\n * Render the label element for a menu item.\n *\n * @param data - The data to use for rendering the label.\n *\n * @returns A virtual element representing the item label.\n */\n renderLabel(data: IRenderData): VirtualElement {\n let content = this.formatLabel(data);\n return h.div({ className: 'lm-Menu-itemLabel' }, content);\n }\n\n /**\n * Render the shortcut element for a menu item.\n *\n * @param data - The data to use for rendering the shortcut.\n *\n * @returns A virtual element representing the item shortcut.\n */\n renderShortcut(data: IRenderData): VirtualElement {\n let content = this.formatShortcut(data);\n return h.div({ className: 'lm-Menu-itemShortcut' }, content);\n }\n\n /**\n * Render the submenu icon element for a menu item.\n *\n * @param data - The data to use for rendering the submenu icon.\n *\n * @returns A virtual element representing the submenu icon.\n */\n renderSubmenu(data: IRenderData): VirtualElement {\n return h.div({ className: 'lm-Menu-itemSubmenuIcon' });\n }\n\n /**\n * Create the class name for the menu item.\n *\n * @param data - The data to use for the class name.\n *\n * @returns The full class name for the menu item.\n */\n createItemClass(data: IRenderData): string {\n // Setup the initial class name.\n let name = 'lm-Menu-item';\n\n // Add the boolean state classes.\n if (!data.item.isEnabled) {\n name += ' lm-mod-disabled';\n }\n if (data.item.isToggled) {\n name += ' lm-mod-toggled';\n }\n if (!data.item.isVisible) {\n name += ' lm-mod-hidden';\n }\n if (data.active) {\n name += ' lm-mod-active';\n }\n if (data.collapsed) {\n name += ' lm-mod-collapsed';\n }\n\n // Add the extra class.\n let extra = data.item.className;\n if (extra) {\n name += ` ${extra}`;\n }\n\n // Return the complete class name.\n return name;\n }\n\n /**\n * Create the dataset for the menu item.\n *\n * @param data - The data to use for creating the dataset.\n *\n * @returns The dataset for the menu item.\n */\n createItemDataset(data: IRenderData): ElementDataset {\n let result: ElementDataset;\n let { type, command, dataset } = data.item;\n if (type === 'command') {\n result = { ...dataset, type, command };\n } else {\n result = { ...dataset, type };\n }\n return result;\n }\n\n /**\n * Create the class name for the menu item icon.\n *\n * @param data - The data to use for the class name.\n *\n * @returns The full class name for the item icon.\n */\n createIconClass(data: IRenderData): string {\n let name = 'lm-Menu-itemIcon';\n let extra = data.item.iconClass;\n return extra ? `${name} ${extra}` : name;\n }\n\n /**\n * Create the aria attributes for menu item.\n *\n * @param data - The data to use for the aria attributes.\n *\n * @returns The aria attributes object for the item.\n */\n createItemARIA(data: IRenderData): ElementARIAAttrs {\n let aria: { [T in ARIAAttrNames]?: string } = {};\n switch (data.item.type) {\n case 'separator':\n aria.role = 'presentation';\n break;\n case 'submenu':\n aria['aria-haspopup'] = 'true';\n if (!data.item.isEnabled) {\n aria['aria-disabled'] = 'true';\n }\n break;\n default:\n if (!data.item.isEnabled) {\n aria['aria-disabled'] = 'true';\n }\n if (data.item.isToggled) {\n aria.role = 'menuitemcheckbox';\n aria['aria-checked'] = 'true';\n } else {\n aria.role = 'menuitem';\n }\n }\n return aria;\n }\n\n /**\n * Create the render content for the label node.\n *\n * @param data - The data to use for the label content.\n *\n * @returns The content to add to the label node.\n */\n formatLabel(data: IRenderData): h.Child {\n // Fetch the label text and mnemonic index.\n let { label, mnemonic } = data.item;\n\n // If the index is out of range, do not modify the label.\n if (mnemonic < 0 || mnemonic >= label.length) {\n return label;\n }\n\n // Split the label into parts.\n let prefix = label.slice(0, mnemonic);\n let suffix = label.slice(mnemonic + 1);\n let char = label[mnemonic];\n\n // Wrap the mnemonic character in a span.\n let span = h.span({ className: 'lm-Menu-itemMnemonic' }, char);\n\n // Return the content parts.\n return [prefix, span, suffix];\n }\n\n /**\n * Create the render content for the shortcut node.\n *\n * @param data - The data to use for the shortcut content.\n *\n * @returns The content to add to the shortcut node.\n */\n formatShortcut(data: IRenderData): h.Child {\n let kb = data.item.keyBinding;\n return kb ? CommandRegistry.formatKeystroke(kb.keys) : null;\n }\n }\n\n /**\n * The default `Renderer` instance.\n */\n export const defaultRenderer = new Renderer();\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * The ms delay for opening and closing a submenu.\n */\n export const TIMER_DELAY = 300;\n\n /**\n * The horizontal pixel overlap for an open submenu.\n */\n export const SUBMENU_OVERLAP = 3;\n\n function getWindowData(element: HTMLElement): IWindowData {\n\n return _getWindowData(element);\n }\n\n /**\n * Store window data in transient cache.\n *\n * The transient cache will be released upon `getWindowData()` call.\n * If this function is called multiple times, the cache will be\n * retained until as many calls to `getWindowData()` were made.\n *\n * Note: should be called before any DOM modifications.\n */\n export function saveWindowData(): void {\n }\n\n /**\n * Create the DOM node for a menu.\n */\n export function createNode(): HTMLDivElement {\n let node = document.createElement('div');\n let content = document.createElement('ul');\n content.className = 'lm-Menu-content';\n node.appendChild(content);\n content.setAttribute('role', 'menu');\n node.tabIndex = 0;\n return node;\n }\n\n /**\n * Test whether a menu item can be activated.\n */\n export function canActivate(item: Menu.IItem): boolean {\n return item.type !== 'separator' && item.isEnabled && item.isVisible;\n }\n\n /**\n * Create a new menu item for an owner menu.\n */\n export function createItem(\n owner: Menu,\n options: Menu.IItemOptions\n ): Menu.IItem {\n return new MenuItem(owner.commands, options);\n }\n\n /**\n * Hit test a menu hierarchy starting at the given root.\n */\n export function hitTestMenus(menu: Menu, x: number, y: number): boolean {\n for (let temp: Menu | null = menu; temp; temp = temp.childMenu) {\n if (ElementExt.hitTest(temp.node, x, y)) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * Compute which extra separator items should be collapsed.\n */\n export function computeCollapsed(\n items: ReadonlyArray\n ): boolean[] {\n // Allocate the return array and fill it with `false`.\n let result = new Array(items.length);\n ArrayExt.fill(result, false);\n\n // Collapse the leading separators.\n let k1 = 0;\n let n = items.length;\n for (; k1 < n; ++k1) {\n let item = items[k1];\n if (!item.isVisible) {\n continue;\n }\n if (item.type !== 'separator') {\n break;\n }\n result[k1] = true;\n }\n\n // Hide the trailing separators.\n let k2 = n - 1;\n for (; k2 >= 0; --k2) {\n let item = items[k2];\n if (!item.isVisible) {\n continue;\n }\n if (item.type !== 'separator') {\n break;\n }\n result[k2] = true;\n }\n\n // Hide the remaining consecutive separators.\n let hide = false;\n while (++k1 < k2) {\n let item = items[k1];\n if (!item.isVisible) {\n continue;\n }\n if (item.type !== 'separator') {\n hide = false;\n } else if (hide) {\n result[k1] = true;\n } else {\n hide = true;\n }\n }\n\n // Return the resulting flags.\n return result;\n }\n\n function _getWindowData(element: HTMLElement): IWindowData {\n return {\n pageXOffset: element.ownerDocument.defaultView?.window.scrollX || 0,\n pageYOffset: element.ownerDocument.defaultView?.window.scrollY || 0,\n clientWidth: element.ownerDocument.documentElement.clientWidth,\n clientHeight: element.ownerDocument.documentElement.clientHeight\n };\n }\n\n /**\n * Open a menu as a root menu at the target location.\n */\n export function openRootMenu(\n menu: Menu,\n x: number,\n y: number,\n forceX: boolean,\n forceY: boolean,\n horizontalAlignment: 'left' | 'right',\n host: HTMLElement | null,\n ref: HTMLElement | null\n ): void {\n // Get the current position and size of the main viewport.\n const windowData = getWindowData(host || menu.node);\n let px = windowData.pageXOffset;\n let py = windowData.pageYOffset;\n let cw = windowData.clientWidth;\n let ch = windowData.clientHeight;\n\n // Ensure the menu is updated before attaching and measuring.\n MessageLoop.sendMessage(menu, Widget.Msg.UpdateRequest);\n\n // Compute the maximum allowed height for the menu.\n let maxHeight = ch - (forceY ? y : 0);\n\n // Fetch common variables.\n let node = menu.node;\n let style = node.style;\n style.top = '0';\n style.left = '0';\n\n // Clear the menu geometry and prepare it for measuring.\n style.opacity = '0';\n style.maxHeight = `${maxHeight}px`;\n\n // Attach the menu to the document.\n Widget.attach(menu, host || document.body, ref);\n\n // Measure the size of the menu.\n let { width, height } = node.getBoundingClientRect();\n\n // align the menu to the right of the target if requested or language is RTL\n if (horizontalAlignment === 'right') {\n x -= width;\n }\n\n // Adjust the X position of the menu to fit on-screen.\n if (!forceX && x + width > px + cw) {\n x = px + cw - width;\n }\n\n // Adjust the Y position of the menu to fit on-screen.\n if (!forceY && y + height > py + ch) {\n if (y > py + ch) {\n y = py + ch - height;\n } else {\n y = y - height;\n }\n }\n\n // Update the position of the menu to the computed position.\n style.transform = `translate(${Math.max(0, x)}px, ${Math.max(0, y)}px`;\n\n // Finally, make the menu visible on the screen.\n style.opacity = '1';\n }\n\n /**\n * Open a menu as a submenu using an item node for positioning.\n */\n export function openSubmenu(submenu: Menu, itemNode: HTMLElement): void {\n // Get the current position and size of the main viewport.\n const windowData = getWindowData(itemNode);\n let px = windowData.pageXOffset;\n let py = windowData.pageYOffset;\n let cw = windowData.clientWidth;\n let ch = windowData.clientHeight;\n\n // Ensure the menu is updated before opening.\n MessageLoop.sendMessage(submenu, Widget.Msg.UpdateRequest);\n\n // Compute the maximum allowed height for the menu.\n let maxHeight = ch;\n\n // Fetch common variables.\n let node = submenu.node;\n let style = node.style;\n\n // Clear the menu geometry and prepare it for measuring.\n style.opacity = '0';\n style.maxHeight = `${maxHeight}px`;\n\n // Attach the menu to the document.\n Widget.attach(submenu, itemNode.ownerDocument.body);\n\n // Measure the size of the menu.\n let { width, height } = node.getBoundingClientRect();\n\n // Compute the box sizing for the menu.\n let box = ElementExt.boxSizing(submenu.node);\n\n // Get the bounding rect for the target item node.\n let itemRect = itemNode.getBoundingClientRect();\n\n // Compute the target X position.\n let x = itemRect.right - SUBMENU_OVERLAP;\n\n // Adjust the X position to fit on the screen.\n if (x + width > px + cw) {\n x = itemRect.left + SUBMENU_OVERLAP - width;\n }\n\n // Compute the target Y position.\n let y = itemRect.top - box.borderTop - box.paddingTop;\n\n // Adjust the Y position to fit on the screen.\n if (y + height > py + ch) {\n y = itemRect.bottom + box.borderBottom + box.paddingBottom - height;\n }\n\n style.top = '0';\n style.left = '0';\n // Update the position of the menu to the computed position.\n style.transform = `translate(${Math.max(0, x)}px, ${Math.max(0, y)}px`;\n\n // Finally, make the menu visible on the screen.\n style.opacity = '1';\n }\n\n /**\n * The results of a mnemonic search.\n */\n export interface IMnemonicResult {\n /**\n * The index of the first matching mnemonic item, or `-1`.\n */\n index: number;\n\n /**\n * Whether multiple mnemonic items matched.\n */\n multiple: boolean;\n\n /**\n * The index of the first auto matched non-mnemonic item.\n */\n auto: number;\n }\n\n /**\n * Find the best matching mnemonic item.\n *\n * The search starts at the given index and wraps around.\n */\n export function findMnemonic(\n items: ReadonlyArray,\n key: string,\n start: number\n ): IMnemonicResult {\n // Setup the result variables.\n let index = -1;\n let auto = -1;\n let multiple = false;\n\n // Normalize the key to upper case.\n let upperKey = key.toUpperCase();\n\n // Search the items from the given start index.\n for (let i = 0, n = items.length; i < n; ++i) {\n // Compute the wrapped index.\n let k = (i + start) % n;\n\n // Lookup the item\n let item = items[k];\n\n // Ignore items which cannot be activated.\n if (!canActivate(item)) {\n continue;\n }\n\n // Ignore items with an empty label.\n let label = item.label;\n if (label.length === 0) {\n continue;\n }\n\n // Lookup the mnemonic index for the label.\n let mn = item.mnemonic;\n\n // Handle a valid mnemonic index.\n if (mn >= 0 && mn < label.length) {\n if (label[mn].toUpperCase() === upperKey) {\n if (index === -1) {\n index = k;\n } else {\n multiple = true;\n }\n }\n continue;\n }\n\n // Finally, handle the auto index if possible.\n if (auto === -1 && label[0].toUpperCase() === upperKey) {\n auto = k;\n }\n }\n\n // Return the search results.\n return { index, multiple, auto };\n }\n\n /**\n * A concrete implementation of `Menu.IItem`.\n */\n class MenuItem implements Menu.IItem {\n /**\n * Construct a new menu item.\n */\n constructor(commands: CommandRegistry, options: Menu.IItemOptions) {\n this._commands = commands;\n this.type = options.type || 'command';\n this.command = options.command || '';\n this.args = options.args || JSONExt.emptyObject;\n this.submenu = options.submenu || null;\n }\n\n /**\n * The type of the menu item.\n */\n readonly type: Menu.ItemType;\n\n /**\n * The command to execute when the item is triggered.\n */\n readonly command: string;\n\n /**\n * The arguments for the command.\n */\n readonly args: ReadonlyJSONObject;\n\n /**\n * The submenu for a `'submenu'` type item.\n */\n readonly submenu: Menu | null;\n\n /**\n * The display label for the menu item.\n */\n get label(): string {\n if (this.type === 'command') {\n return this._commands.label(this.command, this.args);\n }\n if (this.type === 'submenu' && this.submenu) {\n return this.submenu.title.label;\n }\n return '';\n }\n\n /**\n * The mnemonic index for the menu item.\n */\n get mnemonic(): number {\n if (this.type === 'command') {\n return this._commands.mnemonic(this.command, this.args);\n }\n if (this.type === 'submenu' && this.submenu) {\n return this.submenu.title.mnemonic;\n }\n return -1;\n }\n\n /**\n * The icon renderer for the menu item.\n */\n get icon(): VirtualElement.IRenderer | undefined {\n if (this.type === 'command') {\n return this._commands.icon(this.command, this.args);\n }\n if (this.type === 'submenu' && this.submenu) {\n return this.submenu.title.icon;\n }\n return undefined;\n }\n\n /**\n * The icon class for the menu item.\n */\n get iconClass(): string {\n if (this.type === 'command') {\n return this._commands.iconClass(this.command, this.args);\n }\n if (this.type === 'submenu' && this.submenu) {\n return this.submenu.title.iconClass;\n }\n return '';\n }\n\n /**\n * The icon label for the menu item.\n */\n get iconLabel(): string {\n if (this.type === 'command') {\n return this._commands.iconLabel(this.command, this.args);\n }\n if (this.type === 'submenu' && this.submenu) {\n return this.submenu.title.iconLabel;\n }\n return '';\n }\n\n /**\n * The display caption for the menu item.\n */\n get caption(): string {\n if (this.type === 'command') {\n return this._commands.caption(this.command, this.args);\n }\n if (this.type === 'submenu' && this.submenu) {\n return this.submenu.title.caption;\n }\n return '';\n }\n\n /**\n * The extra class name for the menu item.\n */\n get className(): string {\n if (this.type === 'command') {\n return this._commands.className(this.command, this.args);\n }\n if (this.type === 'submenu' && this.submenu) {\n return this.submenu.title.className;\n }\n return '';\n }\n\n /**\n * The dataset for the menu item.\n */\n get dataset(): CommandRegistry.Dataset {\n if (this.type === 'command') {\n return this._commands.dataset(this.command, this.args);\n }\n if (this.type === 'submenu' && this.submenu) {\n return this.submenu.title.dataset;\n }\n return {};\n }\n\n /**\n * Whether the menu item is enabled.\n */\n get isEnabled(): boolean {\n if (this.type === 'command') {\n return this._commands.isEnabled(this.command, this.args);\n }\n if (this.type === 'submenu') {\n return this.submenu !== null;\n }\n return true;\n }\n\n /**\n * Whether the menu item is toggled.\n */\n get isToggled(): boolean {\n if (this.type === 'command') {\n return this._commands.isToggled(this.command, this.args);\n }\n return false;\n }\n\n /**\n * Whether the menu item is visible.\n */\n get isVisible(): boolean {\n if (this.type === 'command') {\n return this._commands.isVisible(this.command, this.args);\n }\n if (this.type === 'submenu') {\n return this.submenu !== null;\n }\n return true;\n }\n\n /**\n * The key binding for the menu item.\n */\n get keyBinding(): CommandRegistry.IKeyBinding | null {\n if (this.type === 'command') {\n let { command, args } = this;\n return (\n ArrayExt.findLastValue(this._commands.keyBindings, kb => {\n return kb.command === command && JSONExt.deepEqual(kb.args, args);\n }) || null\n );\n }\n return null;\n }\n\n private _commands: CommandRegistry;\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { CommandRegistry } from '@lumino/commands';\n\nimport { DisposableDelegate, IDisposable } from '@lumino/disposable';\n\nimport { Selector } from '@lumino/domutils';\n\nimport { Menu } from './menu';\n\n/**\n * An object which implements a universal context menu.\n *\n * #### Notes\n * The items shown in the context menu are determined by CSS selector\n * matching against the DOM hierarchy at the site of the mouse click.\n * This is similar in concept to how keyboard shortcuts are matched\n * in the command registry.\n */\nexport class ContextMenu {\n /**\n * Construct a new context menu.\n *\n * @param options - The options for initializing the menu.\n */\n constructor(options: ContextMenu.IOptions) {\n const { groupByTarget, sortBySelector, ...others } = options;\n this.menu = new Menu(others);\n this._groupByTarget = groupByTarget !== false;\n this._sortBySelector = sortBySelector !== false;\n }\n\n /**\n * The menu widget which displays the matched context items.\n */\n readonly menu: Menu;\n\n /**\n * Add an item to the context menu.\n *\n * @param options - The options for creating the item.\n *\n * @returns A disposable which will remove the item from the menu.\n */\n addItem(options: ContextMenu.IItemOptions): IDisposable {\n // Create an item from the given options.\n let item = Private.createItem(options, this._idTick++);\n\n // Add the item to the internal array.\n this._items.push(item);\n\n // Return a disposable which will remove the item.\n return new DisposableDelegate(() => {\n ArrayExt.removeFirstOf(this._items, item);\n });\n }\n\n /**\n * Open the context menu in response to a `'contextmenu'` event.\n *\n * @param event - The `'contextmenu'` event of interest.\n *\n * @returns `true` if the menu was opened, or `false` if no items\n * matched the event and the menu was not opened.\n *\n * #### Notes\n * This method will populate the context menu with items which match\n * the propagation path of the event, then open the menu at the mouse\n * position indicated by the event.\n */\n open(event: MouseEvent): boolean {\n // Prior to any DOM modifications update the window data.\n Menu.saveWindowData();\n\n // Clear the current contents of the context menu.\n this.menu.clearItems();\n\n // Bail early if there are no items to match.\n if (this._items.length === 0) {\n return false;\n }\n\n // Find the matching items for the event.\n let items = Private.matchItems(\n this._items,\n event,\n this._groupByTarget,\n this._sortBySelector\n );\n\n // Bail if there are no matching items.\n if (!items || items.length === 0) {\n return false;\n }\n\n // Add the filtered items to the menu.\n for (const item of items) {\n this.menu.addItem(item);\n }\n\n // Open the context menu at the current mouse position.\n this.menu.open(event.clientX, event.clientY);\n\n // Indicate success.\n return true;\n }\n\n private _groupByTarget: boolean = true;\n private _idTick = 0;\n private _items: Private.IItem[] = [];\n private _sortBySelector: boolean = true;\n}\n\n/**\n * The namespace for the `ContextMenu` class statics.\n */\nexport namespace ContextMenu {\n /**\n * An options object for initializing a context menu.\n */\n export interface IOptions {\n /**\n * The command registry to use with the context menu.\n */\n commands: CommandRegistry;\n\n /**\n * A custom renderer for use with the context menu.\n */\n renderer?: Menu.IRenderer;\n\n /**\n * Whether to sort by selector and rank or only rank.\n *\n * Default true.\n */\n sortBySelector?: boolean;\n\n /**\n * Whether to group items following the DOM hierarchy.\n *\n * Default true.\n *\n * #### Note\n * If true, when the mouse event occurs on element `span` within `div.top`,\n * the items matching `div.top` will be shown before the ones matching `body`.\n */\n groupByTarget?: boolean;\n }\n\n /**\n * An options object for creating a context menu item.\n */\n export interface IItemOptions extends Menu.IItemOptions {\n /**\n * The CSS selector for the context menu item.\n *\n * The context menu item will only be displayed in the context menu\n * when the selector matches a node on the propagation path of the\n * contextmenu event. This allows the menu item to be restricted to\n * user-defined contexts.\n *\n * The selector must not contain commas.\n */\n selector: string;\n\n /**\n * The rank for the item.\n *\n * The rank is used as a tie-breaker when ordering context menu\n * items for display. Items are sorted in the following order:\n * 1. Depth in the DOM tree (deeper is better)\n * 2. Selector specificity (higher is better)\n * 3. Rank (lower is better)\n * 4. Insertion order\n *\n * The default rank is `Infinity`.\n */\n rank?: number;\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * A normalized item for a context menu.\n */\n export interface IItem extends Menu.IItemOptions {\n /**\n * The selector for the item.\n */\n selector: string;\n\n /**\n * The rank for the item.\n */\n rank: number;\n\n /**\n * The tie-breaking id for the item.\n */\n id: number;\n }\n\n /**\n * Create a normalized context menu item from an options object.\n */\n export function createItem(\n options: ContextMenu.IItemOptions,\n id: number\n ): IItem {\n let selector = validateSelector(options.selector);\n let rank = options.rank !== undefined ? options.rank : Infinity;\n return { ...options, selector, rank, id };\n }\n\n /**\n * Find the items which match a context menu event.\n *\n * The results are sorted by DOM level, specificity, and rank.\n */\n export function matchItems(\n items: IItem[],\n event: MouseEvent,\n groupByTarget: boolean,\n sortBySelector: boolean\n ): IItem[] | null {\n // Look up the target of the event.\n let target = event.target as Element | null;\n\n // Bail if there is no target.\n if (!target) {\n return null;\n }\n\n // Look up the current target of the event.\n let currentTarget = event.currentTarget as Element | null;\n\n // Bail if there is no current target.\n if (!currentTarget) {\n return null;\n }\n\n // There are some third party libraries that cause the `target` to\n // be detached from the DOM before lumino can process the event.\n // If that happens, search for a new target node by point. If that\n // node is still dangling, bail.\n if (!currentTarget.contains(target)) {\n target = document.elementFromPoint(event.clientX, event.clientY);\n if (!target || !currentTarget.contains(target)) {\n return null;\n }\n }\n\n // Set up the result array.\n let result: IItem[] = [];\n\n // Copy the items array to allow in-place modification.\n let availableItems: Array = items.slice();\n\n // Walk up the DOM hierarchy searching for matches.\n while (target !== null) {\n // Set up the match array for this DOM level.\n let matches: IItem[] = [];\n\n // Search the remaining items for matches.\n for (let i = 0, n = availableItems.length; i < n; ++i) {\n // Fetch the item.\n let item = availableItems[i];\n\n // Skip items which are already consumed.\n if (!item) {\n continue;\n }\n\n // Skip items which do not match the element.\n if (!Selector.matches(target, item.selector)) {\n continue;\n }\n\n // Add the matched item to the result for this DOM level.\n matches.push(item);\n\n // Mark the item as consumed.\n availableItems[i] = null;\n }\n\n // Sort the matches for this level and add them to the results.\n if (matches.length !== 0) {\n if (groupByTarget) {\n matches.sort(sortBySelector ? itemCmp : itemCmpRank);\n }\n result.push(...matches);\n }\n\n // Stop searching at the limits of the DOM range.\n if (target === currentTarget) {\n break;\n }\n\n // Step to the parent DOM level.\n target = target.parentElement;\n }\n\n if (!groupByTarget) {\n result.sort(sortBySelector ? itemCmp : itemCmpRank);\n }\n\n // Return the matched and sorted results.\n return result;\n }\n\n /**\n * Validate the selector for a menu item.\n *\n * This returns the validated selector, or throws if the selector is\n * invalid or contains commas.\n */\n function validateSelector(selector: string): string {\n if (selector.indexOf(',') !== -1) {\n throw new Error(`Selector cannot contain commas: ${selector}`);\n }\n if (!Selector.isValid(selector)) {\n throw new Error(`Invalid selector: ${selector}`);\n }\n return selector;\n }\n\n /**\n * A sort comparison function for a context menu item by ranks.\n */\n function itemCmpRank(a: IItem, b: IItem): number {\n // Sort based on rank.\n let r1 = a.rank;\n let r2 = b.rank;\n if (r1 !== r2) {\n return r1 < r2 ? -1 : 1; // Infinity-safe\n }\n\n // When all else fails, sort by item id.\n return a.id - b.id;\n }\n\n /**\n * A sort comparison function for a context menu item by selectors and ranks.\n */\n function itemCmp(a: IItem, b: IItem): number {\n // Sort first based on selector specificity.\n let s1 = Selector.calculateSpecificity(a.selector);\n let s2 = Selector.calculateSpecificity(b.selector);\n if (s1 !== s2) {\n return s2 - s1;\n }\n\n // If specificities are equal\n return itemCmpRank(a, b);\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { IDisposable } from '@lumino/disposable';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Drag } from '@lumino/dragdrop';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport {\n ElementARIAAttrs,\n ElementBaseAttrs,\n ElementDataset,\n ElementInlineStyle,\n h,\n VirtualDOM,\n VirtualElement\n} from '@lumino/virtualdom';\n\nimport { Title } from './title';\n\nimport { Widget } from './widget';\n\nconst ARROW_KEYS = [\n 'ArrowLeft',\n 'ArrowUp',\n 'ArrowRight',\n 'ArrowDown',\n 'Home',\n 'End'\n];\n\n/**\n * A widget which displays titles as a single row or column of tabs.\n *\n * #### Notes\n * If CSS transforms are used to rotate nodes for vertically oriented\n * text, then tab dragging will not work correctly. The `tabsMovable`\n * property should be set to `false` when rotating nodes from CSS.\n */\nexport class TabBar extends Widget {\n /**\n * Construct a new tab bar.\n *\n * @param options - The options for initializing the tab bar.\n */\n constructor(options: TabBar.IOptions = {}) {\n super({ node: Private.createNode() });\n this.addClass('lm-TabBar');\n this.contentNode.setAttribute('role', 'tablist');\n this.setFlag(Widget.Flag.DisallowLayout);\n this._document = options.document || document;\n this.tabsMovable = options.tabsMovable || false;\n this.titlesEditable = options.titlesEditable || false;\n this.allowDeselect = options.allowDeselect || false;\n this.addButtonEnabled = options.addButtonEnabled || false;\n this.insertBehavior = options.insertBehavior || 'select-tab-if-needed';\n this.name = options.name || '';\n this.orientation = options.orientation || 'horizontal';\n this.removeBehavior = options.removeBehavior || 'select-tab-after';\n this.renderer = options.renderer || TabBar.defaultRenderer;\n }\n\n /**\n * Dispose of the resources held by the widget.\n */\n dispose(): void {\n this._releaseMouse();\n this._titles.length = 0;\n this._previousTitle = null;\n super.dispose();\n }\n\n /**\n * A signal emitted when the current tab is changed.\n *\n * #### Notes\n * This signal is emitted when the currently selected tab is changed\n * either through user or programmatic interaction.\n *\n * Notably, this signal is not emitted when the index of the current\n * tab changes due to tabs being inserted, removed, or moved. It is\n * only emitted when the actual current tab node is changed.\n */\n get currentChanged(): ISignal> {\n return this._currentChanged;\n }\n\n /**\n * A signal emitted when a tab is moved by the user.\n *\n * #### Notes\n * This signal is emitted when a tab is moved by user interaction.\n *\n * This signal is not emitted when a tab is moved programmatically.\n */\n get tabMoved(): ISignal> {\n return this._tabMoved;\n }\n\n /**\n * A signal emitted when a tab is clicked by the user.\n *\n * #### Notes\n * If the clicked tab is not the current tab, the clicked tab will be\n * made current and the `currentChanged` signal will be emitted first.\n *\n * This signal is emitted even if the clicked tab is the current tab.\n */\n get tabActivateRequested(): ISignal<\n this,\n TabBar.ITabActivateRequestedArgs\n > {\n return this._tabActivateRequested;\n }\n\n /**\n * A signal emitted when the tab bar add button is clicked.\n */\n get addRequested(): ISignal {\n return this._addRequested;\n }\n\n /**\n * A signal emitted when a tab close icon is clicked.\n *\n * #### Notes\n * This signal is not emitted unless the tab title is `closable`.\n */\n get tabCloseRequested(): ISignal> {\n return this._tabCloseRequested;\n }\n\n /**\n * A signal emitted when a tab is dragged beyond the detach threshold.\n *\n * #### Notes\n * This signal is emitted when the user drags a tab with the mouse,\n * and mouse is dragged beyond the detach threshold.\n *\n * The consumer of the signal should call `releaseMouse` and remove\n * the tab in order to complete the detach.\n *\n * This signal is only emitted once per drag cycle.\n */\n get tabDetachRequested(): ISignal> {\n return this._tabDetachRequested;\n }\n\n /**\n * The renderer used by the tab bar.\n */\n readonly renderer: TabBar.IRenderer;\n\n /**\n * The document to use with the tab bar.\n *\n * The default is the global `document` instance.\n */\n get document(): Document | ShadowRoot {\n return this._document;\n }\n\n /**\n * Whether the tabs are movable by the user.\n *\n * #### Notes\n * Tabs can always be moved programmatically.\n */\n tabsMovable: boolean;\n\n /**\n * Whether the titles can be user-edited.\n *\n */\n get titlesEditable(): boolean {\n return this._titlesEditable;\n }\n\n /**\n * Set whether titles can be user edited.\n *\n */\n set titlesEditable(value: boolean) {\n this._titlesEditable = value;\n }\n\n /**\n * Whether a tab can be deselected by the user.\n *\n * #### Notes\n * Tabs can be always be deselected programmatically.\n */\n allowDeselect: boolean;\n\n /**\n * The selection behavior when inserting a tab.\n */\n insertBehavior: TabBar.InsertBehavior;\n\n /**\n * The selection behavior when removing a tab.\n */\n removeBehavior: TabBar.RemoveBehavior;\n\n /**\n * Get the currently selected title.\n *\n * #### Notes\n * This will be `null` if no tab is selected.\n */\n get currentTitle(): Title | null {\n return this._titles[this._currentIndex] || null;\n }\n\n /**\n * Set the currently selected title.\n *\n * #### Notes\n * If the title does not exist, the title will be set to `null`.\n */\n set currentTitle(value: Title | null) {\n this.currentIndex = value ? this._titles.indexOf(value) : -1;\n }\n\n /**\n * Get the index of the currently selected tab.\n *\n * #### Notes\n * This will be `-1` if no tab is selected.\n */\n get currentIndex(): number {\n return this._currentIndex;\n }\n\n /**\n * Set the index of the currently selected tab.\n *\n * #### Notes\n * If the value is out of range, the index will be set to `-1`.\n */\n set currentIndex(value: number) {\n // Adjust for an out of range index.\n if (value < 0 || value >= this._titles.length) {\n value = -1;\n }\n\n // Bail early if the index will not change.\n if (this._currentIndex === value) {\n return;\n }\n\n // Look up the previous index and title.\n let pi = this._currentIndex;\n let pt = this._titles[pi] || null;\n\n // Look up the current index and title.\n let ci = value;\n let ct = this._titles[ci] || null;\n\n // Update the current index and previous title.\n this._currentIndex = ci;\n this._previousTitle = pt;\n\n // Schedule an update of the tabs.\n this.update();\n\n // Emit the current changed signal.\n this._currentChanged.emit({\n previousIndex: pi,\n previousTitle: pt,\n currentIndex: ci,\n currentTitle: ct\n });\n }\n\n /**\n * Get the name of the tab bar.\n */\n get name(): string {\n return this._name;\n }\n\n /**\n * Set the name of the tab bar.\n */\n set name(value: string) {\n this._name = value;\n if (value) {\n this.contentNode.setAttribute('aria-label', value);\n } else {\n this.contentNode.removeAttribute('aria-label');\n }\n }\n\n /**\n * Get the orientation of the tab bar.\n *\n * #### Notes\n * This controls whether the tabs are arranged in a row or column.\n */\n get orientation(): TabBar.Orientation {\n return this._orientation;\n }\n\n /**\n * Set the orientation of the tab bar.\n *\n * #### Notes\n * This controls whether the tabs are arranged in a row or column.\n */\n set orientation(value: TabBar.Orientation) {\n // Do nothing if the orientation does not change.\n if (this._orientation === value) {\n return;\n }\n\n // Release the mouse before making any changes.\n this._releaseMouse();\n\n // Toggle the orientation values.\n this._orientation = value;\n this.dataset['orientation'] = value;\n this.contentNode.setAttribute('aria-orientation', value);\n }\n\n /**\n * Whether the add button is enabled.\n */\n get addButtonEnabled(): boolean {\n return this._addButtonEnabled;\n }\n\n /**\n * Set whether the add button is enabled.\n */\n set addButtonEnabled(value: boolean) {\n // Do nothing if the value does not change.\n if (this._addButtonEnabled === value) {\n return;\n }\n\n this._addButtonEnabled = value;\n if (value) {\n this.addButtonNode.classList.remove('lm-mod-hidden');\n } else {\n this.addButtonNode.classList.add('lm-mod-hidden');\n }\n }\n\n /**\n * A read-only array of the titles in the tab bar.\n */\n get titles(): ReadonlyArray> {\n return this._titles;\n }\n\n /**\n * The tab bar content node.\n *\n * #### Notes\n * This is the node which holds the tab nodes.\n *\n * Modifying this node directly can lead to undefined behavior.\n */\n get contentNode(): HTMLUListElement {\n return this.node.getElementsByClassName(\n 'lm-TabBar-content'\n )[0] as HTMLUListElement;\n }\n\n /**\n * The tab bar add button node.\n *\n * #### Notes\n * This is the node which holds the add button.\n *\n * Modifying this node directly can lead to undefined behavior.\n */\n get addButtonNode(): HTMLDivElement {\n return this.node.getElementsByClassName(\n 'lm-TabBar-addButton'\n )[0] as HTMLDivElement;\n }\n\n /**\n * Add a tab to the end of the tab bar.\n *\n * @param value - The title which holds the data for the tab,\n * or an options object to convert to a title.\n *\n * @returns The title object added to the tab bar.\n *\n * #### Notes\n * If the title is already added to the tab bar, it will be moved.\n */\n addTab(value: Title | Title.IOptions): Title {\n return this.insertTab(this._titles.length, value);\n }\n\n /**\n * Insert a tab into the tab bar at the specified index.\n *\n * @param index - The index at which to insert the tab.\n *\n * @param value - The title which holds the data for the tab,\n * or an options object to convert to a title.\n *\n * @returns The title object added to the tab bar.\n *\n * #### Notes\n * The index will be clamped to the bounds of the tabs.\n *\n * If the title is already added to the tab bar, it will be moved.\n */\n insertTab(index: number, value: Title | Title.IOptions): Title {\n // Release the mouse before making any changes.\n this._releaseMouse();\n\n // Coerce the value to a title.\n let title = Private.asTitle(value);\n\n // Look up the index of the title.\n let i = this._titles.indexOf(title);\n\n // Clamp the insert index to the array bounds.\n let j = Math.max(0, Math.min(index, this._titles.length));\n\n // If the title is not in the array, insert it.\n if (i === -1) {\n // Insert the title into the array.\n ArrayExt.insert(this._titles, j, title);\n\n // Connect to the title changed signal.\n title.changed.connect(this._onTitleChanged, this);\n\n // Schedule an update of the tabs.\n this.update();\n\n // Adjust the current index for the insert.\n this._adjustCurrentForInsert(j, title);\n\n // Return the title added to the tab bar.\n return title;\n }\n\n // Otherwise, the title exists in the array and should be moved.\n\n // Adjust the index if the location is at the end of the array.\n if (j === this._titles.length) {\n j--;\n }\n\n // Bail if there is no effective move.\n if (i === j) {\n return title;\n }\n\n // Move the title to the new location.\n ArrayExt.move(this._titles, i, j);\n\n // Schedule an update of the tabs.\n this.update();\n\n // Adjust the current index for the move.\n this._adjustCurrentForMove(i, j);\n\n // Return the title added to the tab bar.\n return title;\n }\n\n /**\n * Remove a tab from the tab bar.\n *\n * @param title - The title for the tab to remove.\n *\n * #### Notes\n * This is a no-op if the title is not in the tab bar.\n */\n removeTab(title: Title): void {\n this.removeTabAt(this._titles.indexOf(title));\n }\n\n /**\n * Remove the tab at a given index from the tab bar.\n *\n * @param index - The index of the tab to remove.\n *\n * #### Notes\n * This is a no-op if the index is out of range.\n */\n removeTabAt(index: number): void {\n // Release the mouse before making any changes.\n this._releaseMouse();\n\n // Remove the title from the array.\n let title = ArrayExt.removeAt(this._titles, index);\n\n // Bail if the index is out of range.\n if (!title) {\n return;\n }\n\n // Disconnect from the title changed signal.\n title.changed.disconnect(this._onTitleChanged, this);\n\n // Clear the previous title if it's being removed.\n if (title === this._previousTitle) {\n this._previousTitle = null;\n }\n\n // Schedule an update of the tabs.\n this.update();\n\n // Adjust the current index for the remove.\n this._adjustCurrentForRemove(index, title);\n }\n\n /**\n * Remove all tabs from the tab bar.\n */\n clearTabs(): void {\n // Bail if there is nothing to remove.\n if (this._titles.length === 0) {\n return;\n }\n\n // Release the mouse before making any changes.\n this._releaseMouse();\n\n // Disconnect from the title changed signals.\n for (let title of this._titles) {\n title.changed.disconnect(this._onTitleChanged, this);\n }\n\n // Get the current index and title.\n let pi = this.currentIndex;\n let pt = this.currentTitle;\n\n // Reset the current index and previous title.\n this._currentIndex = -1;\n this._previousTitle = null;\n\n // Clear the title array.\n this._titles.length = 0;\n\n // Schedule an update of the tabs.\n this.update();\n\n // If no tab was selected, there's nothing else to do.\n if (pi === -1) {\n return;\n }\n\n // Emit the current changed signal.\n this._currentChanged.emit({\n previousIndex: pi,\n previousTitle: pt,\n currentIndex: -1,\n currentTitle: null\n });\n }\n\n /**\n * Release the mouse and restore the non-dragged tab positions.\n *\n * #### Notes\n * This will cause the tab bar to stop handling mouse events and to\n * restore the tabs to their non-dragged positions.\n */\n releaseMouse(): void {\n this._releaseMouse();\n }\n\n /**\n * Handle the DOM events for the tab bar.\n *\n * @param event - The DOM event sent to the tab bar.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the tab bar's DOM node.\n *\n * This should not be called directly by user code.\n */\n handleEvent(event: Event): void {\n switch (event.type) {\n case 'pointerdown':\n this._evtPointerDown(event as PointerEvent);\n break;\n case 'pointermove':\n this._evtPointerMove(event as PointerEvent);\n break;\n case 'pointerup':\n this._evtPointerUp(event as PointerEvent);\n break;\n case 'dblclick':\n this._evtDblClick(event as MouseEvent);\n break;\n case 'keydown':\n event.eventPhase === Event.CAPTURING_PHASE\n ? this._evtKeyDownCapturing(event as KeyboardEvent)\n : this._evtKeyDown(event as KeyboardEvent);\n break;\n case 'contextmenu':\n event.preventDefault();\n event.stopPropagation();\n break;\n }\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n this.node.addEventListener('pointerdown', this);\n this.node.addEventListener('dblclick', this);\n this.node.addEventListener('keydown', this);\n }\n\n /**\n * A message handler invoked on an `'after-detach'` message.\n */\n protected onAfterDetach(msg: Message): void {\n this.node.removeEventListener('pointerdown', this);\n this.node.removeEventListener('dblclick', this);\n this.node.removeEventListener('keydown', this);\n this._releaseMouse();\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n protected onUpdateRequest(msg: Message): void {\n let titles = this._titles;\n let renderer = this.renderer;\n let currentTitle = this.currentTitle;\n let content = new Array(titles.length);\n // Keep the tabindex=\"0\" attribute to the tab which handled it before the update.\n // If the add button handles it, no need to do anything. If no element of the tab\n // bar handles it, set it on the current or the first tab to ensure one element\n // handles it after update.\n const tabHandlingTabindex =\n this._getCurrentTabindex() ??\n (this._currentIndex > -1 ? this._currentIndex : 0);\n\n for (let i = 0, n = titles.length; i < n; ++i) {\n let title = titles[i];\n let current = title === currentTitle;\n let zIndex = current ? n : n - i - 1;\n let tabIndex = tabHandlingTabindex === i ? 0 : -1;\n content[i] = renderer.renderTab({ title, current, zIndex, tabIndex });\n }\n VirtualDOM.render(content, this.contentNode);\n }\n\n /**\n * Get the index of the tab which handles tabindex=\"0\".\n * If the add button handles tabindex=\"0\", -1 is returned.\n * If none of the previous handles tabindex=\"0\", null is returned.\n */\n private _getCurrentTabindex(): number | null {\n let index = null;\n const elemTabindex = this.contentNode.querySelector('li[tabindex=\"0\"]');\n if (elemTabindex) {\n index = [...this.contentNode.children].indexOf(elemTabindex);\n } else if (\n this._addButtonEnabled &&\n this.addButtonNode.getAttribute('tabindex') === '0'\n ) {\n index = -1;\n }\n return index;\n }\n\n /**\n * Handle the `'dblclick'` event for the tab bar.\n */\n private _evtDblClick(event: MouseEvent): void {\n // Do nothing if titles are not editable\n if (!this.titlesEditable) {\n return;\n }\n\n let tabs = this.contentNode.children;\n\n // Find the index of the targeted tab.\n let index = ArrayExt.findFirstIndex(tabs, tab => {\n return ElementExt.hitTest(tab, event.clientX, event.clientY);\n });\n\n // Do nothing if the press is not on a tab.\n if (index === -1) {\n return;\n }\n\n let title = this.titles[index];\n let label = tabs[index].querySelector('.lm-TabBar-tabLabel') as HTMLElement;\n if (label && label.contains(event.target as HTMLElement)) {\n let value = title.label || '';\n\n // Clear the label element\n let oldValue = label.innerHTML;\n label.innerHTML = '';\n\n let input = document.createElement('input');\n input.classList.add('lm-TabBar-tabInput');\n input.value = value;\n label.appendChild(input);\n\n let onblur = () => {\n input.removeEventListener('blur', onblur);\n label.innerHTML = oldValue;\n this.node.addEventListener('keydown', this);\n };\n\n input.addEventListener('dblclick', (event: Event) =>\n event.stopPropagation()\n );\n input.addEventListener('blur', onblur);\n input.addEventListener('keydown', (event: KeyboardEvent) => {\n if (event.key === 'Enter') {\n if (input.value !== '') {\n title.label = title.caption = input.value;\n }\n onblur();\n } else if (event.key === 'Escape') {\n onblur();\n }\n });\n this.node.removeEventListener('keydown', this);\n input.select();\n input.focus();\n\n if (label.children.length > 0) {\n (label.children[0] as HTMLElement).focus();\n }\n }\n }\n\n /**\n * Handle the `'keydown'` event for the tab bar at capturing phase.\n */\n private _evtKeyDownCapturing(event: KeyboardEvent): void {\n if (event.eventPhase !== Event.CAPTURING_PHASE) {\n return;\n }\n\n // Stop all input events during drag.\n event.preventDefault();\n event.stopPropagation();\n\n // Release the mouse if `Escape` is pressed.\n if (event.key === 'Escape') {\n this._releaseMouse();\n }\n }\n\n /**\n * Handle the `'keydown'` event for the tab bar at target phase.\n */\n private _evtKeyDown(event: KeyboardEvent): void {\n // Allow for navigation using tab key\n if (event.key === 'Tab' || event.eventPhase === Event.CAPTURING_PHASE) {\n return;\n }\n\n // Check if Enter or Spacebar key has been pressed and open that tab\n if (\n event.key === 'Enter' ||\n event.key === 'Spacebar' ||\n event.key === ' '\n ) {\n // Get focus element that is in focus by the tab key\n const focusedElement = document.activeElement;\n\n // Test first if the focus is on the add button node\n if (\n this.addButtonEnabled &&\n this.addButtonNode.contains(focusedElement)\n ) {\n event.preventDefault();\n event.stopPropagation();\n this._addRequested.emit();\n } else {\n const index = ArrayExt.findFirstIndex(this.contentNode.children, tab =>\n tab.contains(focusedElement)\n );\n if (index >= 0) {\n event.preventDefault();\n event.stopPropagation();\n this.currentIndex = index;\n }\n }\n // Handle the arrow keys to switch tabs.\n } else if (ARROW_KEYS.includes(event.key)) {\n // Create a list of all focusable elements in the tab bar.\n const focusable: Element[] = [...this.contentNode.children];\n if (this.addButtonEnabled) {\n focusable.push(this.addButtonNode);\n }\n // If the tab bar contains only one element, nothing to do.\n if (focusable.length <= 1) {\n return;\n }\n event.preventDefault();\n event.stopPropagation();\n\n // Get the current focused element.\n let focusedIndex = focusable.indexOf(document.activeElement as Element);\n if (focusedIndex === -1) {\n focusedIndex = this._currentIndex;\n }\n\n // Find the next element to focus on.\n let nextFocused: Element | null | undefined;\n if (\n (event.key === 'ArrowRight' && this._orientation === 'horizontal') ||\n (event.key === 'ArrowDown' && this._orientation === 'vertical')\n ) {\n nextFocused = focusable[focusedIndex + 1] ?? focusable[0];\n } else if (\n (event.key === 'ArrowLeft' && this._orientation === 'horizontal') ||\n (event.key === 'ArrowUp' && this._orientation === 'vertical')\n ) {\n nextFocused =\n focusable[focusedIndex - 1] ?? focusable[focusable.length - 1];\n } else if (event.key === 'Home') {\n nextFocused = focusable[0];\n } else if (event.key === 'End') {\n nextFocused = focusable[focusable.length - 1];\n }\n\n // Change the focused element and the tabindex value.\n if (nextFocused) {\n focusable[focusedIndex]?.setAttribute('tabindex', '-1');\n nextFocused?.setAttribute('tabindex', '0');\n (nextFocused as HTMLElement).focus();\n }\n }\n }\n\n /**\n * Handle the `'pointerdown'` event for the tab bar.\n */\n private _evtPointerDown(event: PointerEvent | MouseEvent): void {\n // Do nothing if it's not a left or middle mouse press.\n if (event.button !== 0 && event.button !== 1) {\n return;\n }\n\n // Do nothing if a drag is in progress.\n if (this._dragData) {\n return;\n }\n\n // Do nothing if a title editable input was clicked.\n if (\n (event.target as HTMLElement).classList.contains('lm-TabBar-tabInput')\n ) {\n return;\n }\n\n // Check if the add button was clicked.\n let addButtonClicked =\n this.addButtonEnabled &&\n this.addButtonNode.contains(event.target as HTMLElement);\n\n // Lookup the tab nodes.\n let tabs = this.contentNode.children;\n\n // Find the index of the pressed tab.\n let index = ArrayExt.findFirstIndex(tabs, tab => {\n return ElementExt.hitTest(tab, event.clientX, event.clientY);\n });\n\n // Do nothing if the press is not on a tab or the add button.\n if (index === -1 && !addButtonClicked) {\n return;\n }\n\n // Pressing on a tab stops the event propagation.\n event.preventDefault();\n event.stopPropagation();\n\n // Initialize the non-measured parts of the drag data.\n this._dragData = {\n tab: tabs[index] as HTMLElement,\n index: index,\n pressX: event.clientX,\n pressY: event.clientY,\n tabPos: -1,\n tabSize: -1,\n tabPressPos: -1,\n targetIndex: -1,\n tabLayout: null,\n contentRect: null,\n override: null,\n dragActive: false,\n dragAborted: false,\n detachRequested: false\n };\n\n // Add the document pointer up listener.\n this.document.addEventListener('pointerup', this, true);\n\n // Do nothing else if the middle button or add button is clicked.\n if (event.button === 1 || addButtonClicked) {\n return;\n }\n\n // Do nothing else if the close icon is clicked.\n let icon = tabs[index].querySelector(this.renderer.closeIconSelector);\n if (icon && icon.contains(event.target as HTMLElement)) {\n return;\n }\n\n // Add the extra listeners if the tabs are movable.\n if (this.tabsMovable) {\n this.document.addEventListener('pointermove', this, true);\n this.document.addEventListener('keydown', this, true);\n this.document.addEventListener('contextmenu', this, true);\n }\n\n // Update the current index as appropriate.\n if (this.allowDeselect && this.currentIndex === index) {\n this.currentIndex = -1;\n } else {\n this.currentIndex = index;\n }\n\n // Do nothing else if there is no current tab.\n if (this.currentIndex === -1) {\n return;\n }\n\n // Emit the tab activate request signal.\n this._tabActivateRequested.emit({\n index: this.currentIndex,\n title: this.currentTitle!\n });\n }\n\n /**\n * Handle the `'pointermove'` event for the tab bar.\n */\n private _evtPointerMove(event: PointerEvent | MouseEvent): void {\n // Do nothing if no drag is in progress.\n let data = this._dragData;\n if (!data) {\n return;\n }\n\n // Suppress the event during a drag.\n event.preventDefault();\n event.stopPropagation();\n\n // Lookup the tab nodes.\n let tabs = this.contentNode.children;\n\n // Bail early if the drag threshold has not been met.\n if (!data.dragActive && !Private.dragExceeded(data, event)) {\n return;\n }\n\n // Activate the drag if necessary.\n if (!data.dragActive) {\n // Fill in the rest of the drag data measurements.\n let tabRect = data.tab.getBoundingClientRect();\n if (this._orientation === 'horizontal') {\n data.tabPos = data.tab.offsetLeft;\n data.tabSize = tabRect.width;\n data.tabPressPos = data.pressX - tabRect.left;\n } else {\n data.tabPos = data.tab.offsetTop;\n data.tabSize = tabRect.height;\n data.tabPressPos = data.pressY - tabRect.top;\n }\n data.tabPressOffset = {\n x: data.pressX - tabRect.left,\n y: data.pressY - tabRect.top\n };\n data.tabLayout = Private.snapTabLayout(tabs, this._orientation);\n data.contentRect = this.contentNode.getBoundingClientRect();\n data.override = Drag.overrideCursor('default');\n\n // Add the dragging style classes.\n data.tab.classList.add('lm-mod-dragging');\n this.addClass('lm-mod-dragging');\n\n // Mark the drag as active.\n data.dragActive = true;\n }\n\n // Emit the detach requested signal if the threshold is exceeded.\n if (!data.detachRequested && Private.detachExceeded(data, event)) {\n // Only emit the signal once per drag cycle.\n data.detachRequested = true;\n\n // Setup the arguments for the signal.\n let index = data.index;\n let clientX = event.clientX;\n let clientY = event.clientY;\n let tab = tabs[index] as HTMLElement;\n let title = this._titles[index];\n\n // Emit the tab detach requested signal.\n this._tabDetachRequested.emit({\n index,\n title,\n tab,\n clientX,\n clientY,\n offset: data.tabPressOffset\n });\n\n // Bail if the signal handler aborted the drag.\n if (data.dragAborted) {\n return;\n }\n }\n\n // Update the positions of the tabs.\n Private.layoutTabs(tabs, data, event, this._orientation);\n }\n\n /**\n * Handle the `'pointerup'` event for the document.\n */\n private _evtPointerUp(event: PointerEvent | MouseEvent): void {\n // Do nothing if it's not a left or middle mouse release.\n if (event.button !== 0 && event.button !== 1) {\n return;\n }\n\n // Do nothing if no drag is in progress.\n const data = this._dragData;\n if (!data) {\n return;\n }\n\n // Stop the event propagation.\n event.preventDefault();\n event.stopPropagation();\n\n // Remove the extra mouse event listeners.\n this.document.removeEventListener('pointermove', this, true);\n this.document.removeEventListener('pointerup', this, true);\n this.document.removeEventListener('keydown', this, true);\n this.document.removeEventListener('contextmenu', this, true);\n\n // Handle a release when the drag is not active.\n if (!data.dragActive) {\n // Clear the drag data.\n this._dragData = null;\n\n // Handle clicking the add button.\n let addButtonClicked =\n this.addButtonEnabled &&\n this.addButtonNode.contains(event.target as HTMLElement);\n if (addButtonClicked) {\n this._addRequested.emit(undefined);\n return;\n }\n\n // Lookup the tab nodes.\n let tabs = this.contentNode.children;\n\n // Find the index of the released tab.\n let index = ArrayExt.findFirstIndex(tabs, tab => {\n return ElementExt.hitTest(tab, event.clientX, event.clientY);\n });\n\n // Do nothing if the release is not on the original pressed tab.\n if (index !== data.index) {\n return;\n }\n\n // Ignore the release if the title is not closable.\n let title = this._titles[index];\n if (!title.closable) {\n return;\n }\n\n // Emit the close requested signal if the middle button is released.\n if (event.button === 1) {\n this._tabCloseRequested.emit({ index, title });\n return;\n }\n\n // Emit the close requested signal if the close icon was released.\n let icon = tabs[index].querySelector(this.renderer.closeIconSelector);\n if (icon && icon.contains(event.target as HTMLElement)) {\n this._tabCloseRequested.emit({ index, title });\n return;\n }\n\n // Otherwise, there is nothing left to do.\n return;\n }\n\n // Do nothing if the left button is not released.\n if (event.button !== 0) {\n return;\n }\n\n // Position the tab at its final resting position.\n Private.finalizeTabPosition(data, this._orientation);\n\n // Remove the dragging class from the tab so it can be transitioned.\n data.tab.classList.remove('lm-mod-dragging');\n\n // Parse the transition duration for releasing the tab.\n let duration = Private.parseTransitionDuration(data.tab);\n\n // Complete the release on a timer to allow the tab to transition.\n setTimeout(() => {\n // Do nothing if the drag has been aborted.\n if (data.dragAborted) {\n return;\n }\n\n // Clear the drag data reference.\n this._dragData = null;\n\n // Reset the positions of the tabs.\n Private.resetTabPositions(this.contentNode.children, this._orientation);\n\n // Clear the cursor grab.\n data.override!.dispose();\n\n // Remove the remaining dragging style.\n this.removeClass('lm-mod-dragging');\n\n // If the tab was not moved, there is nothing else to do.\n let i = data.index;\n let j = data.targetIndex;\n if (j === -1 || i === j) {\n return;\n }\n\n // Move the title to the new locations.\n ArrayExt.move(this._titles, i, j);\n\n // Adjust the current index for the move.\n this._adjustCurrentForMove(i, j);\n\n // Emit the tab moved signal.\n this._tabMoved.emit({\n fromIndex: i,\n toIndex: j,\n title: this._titles[j]\n });\n\n // Update the tabs immediately to prevent flicker.\n MessageLoop.sendMessage(this, Widget.Msg.UpdateRequest);\n }, duration);\n }\n\n /**\n * Release the mouse and restore the non-dragged tab positions.\n */\n private _releaseMouse(): void {\n // Do nothing if no drag is in progress.\n let data = this._dragData;\n if (!data) {\n return;\n }\n\n // Clear the drag data reference.\n this._dragData = null;\n\n // Remove the extra document event listeners.\n this.document.removeEventListener('pointermove', this, true);\n this.document.removeEventListener('pointerup', this, true);\n this.document.removeEventListener('keydown', this, true);\n this.document.removeEventListener('contextmenu', this, true);\n\n // Indicate the drag has been aborted. This allows the mouse\n // event handlers to return early when the drag is canceled.\n data.dragAborted = true;\n\n // If the drag is not active, there's nothing more to do.\n if (!data.dragActive) {\n return;\n }\n\n // Reset the tabs to their non-dragged positions.\n Private.resetTabPositions(this.contentNode.children, this._orientation);\n\n // Clear the cursor override.\n data.override!.dispose();\n\n // Clear the dragging style classes.\n data.tab.classList.remove('lm-mod-dragging');\n this.removeClass('lm-mod-dragging');\n }\n\n /**\n * Adjust the current index for a tab insert operation.\n *\n * This method accounts for the tab bar's insertion behavior when\n * adjusting the current index and emitting the changed signal.\n */\n private _adjustCurrentForInsert(i: number, title: Title): void {\n // Lookup commonly used variables.\n let ct = this.currentTitle;\n let ci = this._currentIndex;\n let bh = this.insertBehavior;\n\n // TODO: do we need to do an update to update the aria-selected attribute?\n\n // Handle the behavior where the new tab is always selected,\n // or the behavior where the new tab is selected if needed.\n if (bh === 'select-tab' || (bh === 'select-tab-if-needed' && ci === -1)) {\n this._currentIndex = i;\n this._previousTitle = ct;\n this._currentChanged.emit({\n previousIndex: ci,\n previousTitle: ct,\n currentIndex: i,\n currentTitle: title\n });\n return;\n }\n\n // Otherwise, silently adjust the current index if needed.\n if (ci >= i) {\n this._currentIndex++;\n }\n }\n\n /**\n * Adjust the current index for a tab move operation.\n *\n * This method will not cause the actual current tab to change.\n * It silently adjusts the index to account for the given move.\n */\n private _adjustCurrentForMove(i: number, j: number): void {\n if (this._currentIndex === i) {\n this._currentIndex = j;\n } else if (this._currentIndex < i && this._currentIndex >= j) {\n this._currentIndex++;\n } else if (this._currentIndex > i && this._currentIndex <= j) {\n this._currentIndex--;\n }\n }\n\n /**\n * Adjust the current index for a tab remove operation.\n *\n * This method accounts for the tab bar's remove behavior when\n * adjusting the current index and emitting the changed signal.\n */\n private _adjustCurrentForRemove(i: number, title: Title): void {\n // Lookup commonly used variables.\n let ci = this._currentIndex;\n let bh = this.removeBehavior;\n\n // Silently adjust the index if the current tab is not removed.\n if (ci !== i) {\n if (ci > i) {\n this._currentIndex--;\n }\n return;\n }\n\n // TODO: do we need to do an update to adjust the aria-selected value?\n\n // No tab gets selected if the tab bar is empty.\n if (this._titles.length === 0) {\n this._currentIndex = -1;\n this._currentChanged.emit({\n previousIndex: i,\n previousTitle: title,\n currentIndex: -1,\n currentTitle: null\n });\n return;\n }\n\n // Handle behavior where the next sibling tab is selected.\n if (bh === 'select-tab-after') {\n this._currentIndex = Math.min(i, this._titles.length - 1);\n this._currentChanged.emit({\n previousIndex: i,\n previousTitle: title,\n currentIndex: this._currentIndex,\n currentTitle: this.currentTitle\n });\n return;\n }\n\n // Handle behavior where the previous sibling tab is selected.\n if (bh === 'select-tab-before') {\n this._currentIndex = Math.max(0, i - 1);\n this._currentChanged.emit({\n previousIndex: i,\n previousTitle: title,\n currentIndex: this._currentIndex,\n currentTitle: this.currentTitle\n });\n return;\n }\n\n // Handle behavior where the previous history tab is selected.\n if (bh === 'select-previous-tab') {\n if (this._previousTitle) {\n this._currentIndex = this._titles.indexOf(this._previousTitle);\n this._previousTitle = null;\n } else {\n this._currentIndex = Math.min(i, this._titles.length - 1);\n }\n this._currentChanged.emit({\n previousIndex: i,\n previousTitle: title,\n currentIndex: this._currentIndex,\n currentTitle: this.currentTitle\n });\n return;\n }\n\n // Otherwise, no tab gets selected.\n this._currentIndex = -1;\n this._currentChanged.emit({\n previousIndex: i,\n previousTitle: title,\n currentIndex: -1,\n currentTitle: null\n });\n }\n\n /**\n * Handle the `changed` signal of a title object.\n */\n private _onTitleChanged(sender: Title): void {\n this.update();\n }\n\n private _name: string;\n private _currentIndex = -1;\n private _titles: Title[] = [];\n private _orientation: TabBar.Orientation;\n private _document: Document | ShadowRoot;\n private _titlesEditable: boolean = false;\n private _previousTitle: Title | null = null;\n private _dragData: Private.IDragData | null = null;\n private _addButtonEnabled: boolean = false;\n private _tabMoved = new Signal>(this);\n private _currentChanged = new Signal>(\n this\n );\n private _addRequested = new Signal(this);\n private _tabCloseRequested = new Signal<\n this,\n TabBar.ITabCloseRequestedArgs\n >(this);\n private _tabDetachRequested = new Signal<\n this,\n TabBar.ITabDetachRequestedArgs\n >(this);\n private _tabActivateRequested = new Signal<\n this,\n TabBar.ITabActivateRequestedArgs\n >(this);\n}\n\n/**\n * The namespace for the `TabBar` class statics.\n */\nexport namespace TabBar {\n /**\n * A type alias for a tab bar orientation.\n */\n export type Orientation =\n | /**\n * The tabs are arranged in a single row, left-to-right.\n *\n * The tab text orientation is horizontal.\n */\n 'horizontal'\n\n /**\n * The tabs are arranged in a single column, top-to-bottom.\n *\n * The tab text orientation is horizontal.\n */\n | 'vertical';\n\n /**\n * A type alias for the selection behavior on tab insert.\n */\n export type InsertBehavior =\n | /**\n * The selected tab will not be changed.\n */\n 'none'\n\n /**\n * The inserted tab will be selected.\n */\n | 'select-tab'\n\n /**\n * The inserted tab will be selected if the current tab is null.\n */\n | 'select-tab-if-needed';\n\n /**\n * A type alias for the selection behavior on tab remove.\n */\n export type RemoveBehavior =\n | /**\n * No tab will be selected.\n */\n 'none'\n\n /**\n * The tab after the removed tab will be selected if possible.\n */\n | 'select-tab-after'\n\n /**\n * The tab before the removed tab will be selected if possible.\n */\n | 'select-tab-before'\n\n /**\n * The previously selected tab will be selected if possible.\n */\n | 'select-previous-tab';\n\n /**\n * An options object for creating a tab bar.\n */\n export interface IOptions {\n /**\n * The document to use with the tab bar.\n *\n * The default is the global `document` instance.\n */\n\n document?: Document | ShadowRoot;\n\n /**\n * Name of the tab bar.\n *\n * This is used for accessibility reasons. The default is the empty string.\n */\n name?: string;\n\n /**\n * The layout orientation of the tab bar.\n *\n * The default is `horizontal`.\n */\n orientation?: TabBar.Orientation;\n\n /**\n * Whether the tabs are movable by the user.\n *\n * The default is `false`.\n */\n tabsMovable?: boolean;\n\n /**\n * Whether a tab can be deselected by the user.\n *\n * The default is `false`.\n */\n allowDeselect?: boolean;\n\n /**\n * Whether the titles can be directly edited by the user.\n *\n * The default is `false`.\n */\n titlesEditable?: boolean;\n\n /**\n * Whether the add button is enabled.\n *\n * The default is `false`.\n */\n addButtonEnabled?: boolean;\n\n /**\n * The selection behavior when inserting a tab.\n *\n * The default is `'select-tab-if-needed'`.\n */\n insertBehavior?: TabBar.InsertBehavior;\n\n /**\n * The selection behavior when removing a tab.\n *\n * The default is `'select-tab-after'`.\n */\n removeBehavior?: TabBar.RemoveBehavior;\n\n /**\n * A renderer to use with the tab bar.\n *\n * The default is a shared renderer instance.\n */\n renderer?: IRenderer;\n }\n\n /**\n * The arguments object for the `currentChanged` signal.\n */\n export interface ICurrentChangedArgs {\n /**\n * The previously selected index.\n */\n readonly previousIndex: number;\n\n /**\n * The previously selected title.\n */\n readonly previousTitle: Title | null;\n\n /**\n * The currently selected index.\n */\n readonly currentIndex: number;\n\n /**\n * The currently selected title.\n */\n readonly currentTitle: Title | null;\n }\n\n /**\n * The arguments object for the `tabMoved` signal.\n */\n export interface ITabMovedArgs {\n /**\n * The previous index of the tab.\n */\n readonly fromIndex: number;\n\n /**\n * The current index of the tab.\n */\n readonly toIndex: number;\n\n /**\n * The title for the tab.\n */\n readonly title: Title;\n }\n\n /**\n * The arguments object for the `tabActivateRequested` signal.\n */\n export interface ITabActivateRequestedArgs {\n /**\n * The index of the tab to activate.\n */\n readonly index: number;\n\n /**\n * The title for the tab.\n */\n readonly title: Title;\n }\n\n /**\n * The arguments object for the `tabCloseRequested` signal.\n */\n export interface ITabCloseRequestedArgs {\n /**\n * The index of the tab to close.\n */\n readonly index: number;\n\n /**\n * The title for the tab.\n */\n readonly title: Title;\n }\n\n /**\n * The arguments object for the `tabDetachRequested` signal.\n */\n export interface ITabDetachRequestedArgs {\n /**\n * The index of the tab to detach.\n */\n readonly index: number;\n\n /**\n * The title for the tab.\n */\n readonly title: Title;\n\n /**\n * The node representing the tab.\n */\n readonly tab: HTMLElement;\n\n /**\n * The current client X position of the mouse.\n */\n readonly clientX: number;\n\n /**\n * The current client Y position of the mouse.\n */\n readonly clientY: number;\n\n /**\n * The mouse position in the tab coordinate.\n */\n readonly offset?: { x: number; y: number };\n }\n\n /**\n * An object which holds the data to render a tab.\n */\n export interface IRenderData {\n /**\n * The title associated with the tab.\n */\n readonly title: Title;\n\n /**\n * Whether the tab is the current tab.\n */\n readonly current: boolean;\n\n /**\n * The z-index for the tab.\n */\n readonly zIndex: number;\n\n /**\n * The tabindex value for the tab.\n */\n readonly tabIndex?: number;\n }\n\n /**\n * A renderer for use with a tab bar.\n */\n export interface IRenderer {\n /**\n * A selector which matches the close icon node in a tab.\n */\n readonly closeIconSelector: string;\n\n /**\n * Render the virtual element for a tab.\n *\n * @param data - The data to use for rendering the tab.\n *\n * @returns A virtual element representing the tab.\n */\n renderTab(data: IRenderData): VirtualElement;\n }\n\n /**\n * The default implementation of `IRenderer`.\n *\n * #### Notes\n * Subclasses are free to reimplement rendering methods as needed.\n */\n export class Renderer implements IRenderer {\n constructor() {\n this._uuid = ++Renderer._nInstance;\n }\n /**\n * A selector which matches the close icon node in a tab.\n */\n readonly closeIconSelector = '.lm-TabBar-tabCloseIcon';\n\n /**\n * Render the virtual element for a tab.\n *\n * @param data - The data to use for rendering the tab.\n *\n * @returns A virtual element representing the tab.\n */\n renderTab(data: IRenderData): VirtualElement {\n let title = data.title.caption;\n let key = this.createTabKey(data);\n let id = key;\n let style = this.createTabStyle(data);\n let className = this.createTabClass(data);\n let dataset = this.createTabDataset(data);\n let aria = this.createTabARIA(data);\n if (data.title.closable) {\n return h.li(\n { id, key, className, title, style, dataset, ...aria },\n this.renderIcon(data),\n this.renderLabel(data),\n this.renderCloseIcon(data)\n );\n } else {\n return h.li(\n { id, key, className, title, style, dataset, ...aria },\n this.renderIcon(data),\n this.renderLabel(data)\n );\n }\n }\n\n /**\n * Render the icon element for a tab.\n *\n * @param data - The data to use for rendering the tab.\n *\n * @returns A virtual element representing the tab icon.\n */\n renderIcon(data: IRenderData): VirtualElement {\n const { title } = data;\n let className = this.createIconClass(data);\n\n // If title.icon is undefined, it will be ignored.\n return h.div({ className }, title.icon!, title.iconLabel);\n }\n\n /**\n * Render the label element for a tab.\n *\n * @param data - The data to use for rendering the tab.\n *\n * @returns A virtual element representing the tab label.\n */\n renderLabel(data: IRenderData): VirtualElement {\n return h.div({ className: 'lm-TabBar-tabLabel' }, data.title.label);\n }\n\n /**\n * Render the close icon element for a tab.\n *\n * @param data - The data to use for rendering the tab.\n *\n * @returns A virtual element representing the tab close icon.\n */\n renderCloseIcon(data: IRenderData): VirtualElement {\n return h.div({ className: 'lm-TabBar-tabCloseIcon' });\n }\n\n /**\n * Create a unique render key for the tab.\n *\n * @param data - The data to use for the tab.\n *\n * @returns The unique render key for the tab.\n *\n * #### Notes\n * This method caches the key against the tab title the first time\n * the key is generated. This enables efficient rendering of moved\n * tabs and avoids subtle hover style artifacts.\n */\n createTabKey(data: IRenderData): string {\n let key = this._tabKeys.get(data.title);\n if (key === undefined) {\n key = `tab-key-${this._uuid}-${this._tabID++}`;\n this._tabKeys.set(data.title, key);\n }\n return key;\n }\n\n /**\n * Create the inline style object for a tab.\n *\n * @param data - The data to use for the tab.\n *\n * @returns The inline style data for the tab.\n */\n createTabStyle(data: IRenderData): ElementInlineStyle {\n return { zIndex: `${data.zIndex}` };\n }\n\n /**\n * Create the class name for the tab.\n *\n * @param data - The data to use for the tab.\n *\n * @returns The full class name for the tab.\n */\n createTabClass(data: IRenderData): string {\n let name = 'lm-TabBar-tab';\n if (data.title.className) {\n name += ` ${data.title.className}`;\n }\n if (data.title.closable) {\n name += ' lm-mod-closable';\n }\n if (data.current) {\n name += ' lm-mod-current';\n }\n return name;\n }\n\n /**\n * Create the dataset for a tab.\n *\n * @param data - The data to use for the tab.\n *\n * @returns The dataset for the tab.\n */\n createTabDataset(data: IRenderData): ElementDataset {\n return data.title.dataset;\n }\n\n /**\n * Create the ARIA attributes for a tab.\n *\n * @param data - The data to use for the tab.\n *\n * @returns The ARIA attributes for the tab.\n */\n createTabARIA(data: IRenderData): ElementARIAAttrs | ElementBaseAttrs {\n return {\n role: 'tab',\n 'aria-selected': data.current.toString(),\n tabindex: `${data.tabIndex ?? '-1'}`\n };\n }\n\n /**\n * Create the class name for the tab icon.\n *\n * @param data - The data to use for the tab.\n *\n * @returns The full class name for the tab icon.\n */\n createIconClass(data: IRenderData): string {\n let name = 'lm-TabBar-tabIcon';\n let extra = data.title.iconClass;\n return extra ? `${name} ${extra}` : name;\n }\n\n private static _nInstance = 0;\n private readonly _uuid: number;\n private _tabID = 0;\n private _tabKeys = new WeakMap, string>();\n }\n\n /**\n * The default `Renderer` instance.\n */\n export const defaultRenderer = new Renderer();\n\n /**\n * A selector which matches the add button node in the tab bar.\n */\n export const addButtonSelector = '.lm-TabBar-addButton';\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * The start drag distance threshold.\n */\n export const DRAG_THRESHOLD = 5;\n\n /**\n * The detach distance threshold.\n */\n export const DETACH_THRESHOLD = 20;\n\n /**\n * A struct which holds the drag data for a tab bar.\n */\n export interface IDragData {\n /**\n * The tab node being dragged.\n */\n tab: HTMLElement;\n\n /**\n * The index of the tab being dragged.\n */\n index: number;\n\n /**\n * The mouse press client X position.\n */\n pressX: number;\n\n /**\n * The mouse press client Y position.\n */\n pressY: number;\n\n /**\n * The offset left/top of the tab being dragged.\n *\n * This will be `-1` if the drag is not active.\n */\n tabPos: number;\n\n /**\n * The offset width/height of the tab being dragged.\n *\n * This will be `-1` if the drag is not active.\n */\n tabSize: number;\n\n /**\n * The original mouse X/Y position in tab coordinates.\n *\n * This will be `-1` if the drag is not active.\n */\n tabPressPos: number;\n\n /**\n * The original mouse position in tab coordinates.\n *\n * This is undefined if the drag is not active.\n */\n tabPressOffset?: { x: number; y: number };\n\n /**\n * The tab target index upon mouse release.\n *\n * This will be `-1` if the drag is not active.\n */\n targetIndex: number;\n\n /**\n * The array of tab layout objects snapped at drag start.\n *\n * This will be `null` if the drag is not active.\n */\n tabLayout: ITabLayout[] | null;\n\n /**\n * The bounding client rect of the tab bar content node.\n *\n * This will be `null` if the drag is not active.\n */\n contentRect: DOMRect | null;\n\n /**\n * The disposable to clean up the cursor override.\n *\n * This will be `null` if the drag is not active.\n */\n override: IDisposable | null;\n\n /**\n * Whether the drag is currently active.\n */\n dragActive: boolean;\n\n /**\n * Whether the drag has been aborted.\n */\n dragAborted: boolean;\n\n /**\n * Whether a detach request as been made.\n */\n detachRequested: boolean;\n }\n\n /**\n * An object which holds layout data for a tab.\n */\n export interface ITabLayout {\n /**\n * The left/top margin value for the tab.\n */\n margin: number;\n\n /**\n * The offset left/top position of the tab.\n */\n pos: number;\n\n /**\n * The offset width/height of the tab.\n */\n size: number;\n }\n\n /**\n * Create the DOM node for a tab bar.\n */\n export function createNode(): HTMLDivElement {\n let node = document.createElement('div');\n let content = document.createElement('ul');\n content.setAttribute('role', 'tablist');\n content.className = 'lm-TabBar-content';\n node.appendChild(content);\n\n let add = document.createElement('div');\n add.className = 'lm-TabBar-addButton lm-mod-hidden';\n add.setAttribute('tabindex', '-1');\n add.setAttribute('role', 'button');\n node.appendChild(add);\n return node;\n }\n\n /**\n * Coerce a title or options into a real title.\n */\n export function asTitle(value: Title | Title.IOptions): Title {\n return value instanceof Title ? value : new Title(value);\n }\n\n /**\n * Parse the transition duration for a tab node.\n */\n export function parseTransitionDuration(tab: HTMLElement): number {\n let style = window.getComputedStyle(tab);\n return 1000 * (parseFloat(style.transitionDuration!) || 0);\n }\n\n /**\n * Get a snapshot of the current tab layout values.\n */\n export function snapTabLayout(\n tabs: HTMLCollection,\n orientation: TabBar.Orientation\n ): ITabLayout[] {\n let layout = new Array(tabs.length);\n for (let i = 0, n = tabs.length; i < n; ++i) {\n let node = tabs[i] as HTMLElement;\n let style = window.getComputedStyle(node);\n if (orientation === 'horizontal') {\n layout[i] = {\n pos: node.offsetLeft,\n size: node.offsetWidth,\n margin: parseFloat(style.marginLeft!) || 0\n };\n } else {\n layout[i] = {\n pos: node.offsetTop,\n size: node.offsetHeight,\n margin: parseFloat(style.marginTop!) || 0\n };\n }\n }\n return layout;\n }\n\n /**\n * Test if the event exceeds the drag threshold.\n */\n export function dragExceeded(data: IDragData, event: MouseEvent): boolean {\n let dx = Math.abs(event.clientX - data.pressX);\n let dy = Math.abs(event.clientY - data.pressY);\n return dx >= DRAG_THRESHOLD || dy >= DRAG_THRESHOLD;\n }\n\n /**\n * Test if the event exceeds the drag detach threshold.\n */\n export function detachExceeded(data: IDragData, event: MouseEvent): boolean {\n let rect = data.contentRect!;\n return (\n event.clientX < rect.left - DETACH_THRESHOLD ||\n event.clientX >= rect.right + DETACH_THRESHOLD ||\n event.clientY < rect.top - DETACH_THRESHOLD ||\n event.clientY >= rect.bottom + DETACH_THRESHOLD\n );\n }\n\n /**\n * Update the relative tab positions and computed target index.\n */\n export function layoutTabs(\n tabs: HTMLCollection,\n data: IDragData,\n event: MouseEvent,\n orientation: TabBar.Orientation\n ): void {\n // Compute the orientation-sensitive values.\n let pressPos: number;\n let localPos: number;\n let clientPos: number;\n let clientSize: number;\n if (orientation === 'horizontal') {\n pressPos = data.pressX;\n localPos = event.clientX - data.contentRect!.left;\n clientPos = event.clientX;\n clientSize = data.contentRect!.width;\n } else {\n pressPos = data.pressY;\n localPos = event.clientY - data.contentRect!.top;\n clientPos = event.clientY;\n clientSize = data.contentRect!.height;\n }\n\n // Compute the target data.\n let targetIndex = data.index;\n let targetPos = localPos - data.tabPressPos;\n let targetEnd = targetPos + data.tabSize;\n\n // Update the relative tab positions.\n for (let i = 0, n = tabs.length; i < n; ++i) {\n let pxPos: string;\n let layout = data.tabLayout![i];\n let threshold = layout.pos + (layout.size >> 1);\n if (i < data.index && targetPos < threshold) {\n pxPos = `${data.tabSize + data.tabLayout![i + 1].margin}px`;\n targetIndex = Math.min(targetIndex, i);\n } else if (i > data.index && targetEnd > threshold) {\n pxPos = `${-data.tabSize - layout.margin}px`;\n targetIndex = Math.max(targetIndex, i);\n } else if (i === data.index) {\n let ideal = clientPos - pressPos;\n let limit = clientSize - (data.tabPos + data.tabSize);\n pxPos = `${Math.max(-data.tabPos, Math.min(ideal, limit))}px`;\n } else {\n pxPos = '';\n }\n if (orientation === 'horizontal') {\n (tabs[i] as HTMLElement).style.left = pxPos;\n } else {\n (tabs[i] as HTMLElement).style.top = pxPos;\n }\n }\n\n // Update the computed target index.\n data.targetIndex = targetIndex;\n }\n\n /**\n * Position the drag tab at its final resting relative position.\n */\n export function finalizeTabPosition(\n data: IDragData,\n orientation: TabBar.Orientation\n ): void {\n // Compute the orientation-sensitive client size.\n let clientSize: number;\n if (orientation === 'horizontal') {\n clientSize = data.contentRect!.width;\n } else {\n clientSize = data.contentRect!.height;\n }\n\n // Compute the ideal final tab position.\n let ideal: number;\n if (data.targetIndex === data.index) {\n ideal = 0;\n } else if (data.targetIndex > data.index) {\n let tgt = data.tabLayout![data.targetIndex];\n ideal = tgt.pos + tgt.size - data.tabSize - data.tabPos;\n } else {\n let tgt = data.tabLayout![data.targetIndex];\n ideal = tgt.pos - data.tabPos;\n }\n\n // Compute the tab position limit.\n let limit = clientSize - (data.tabPos + data.tabSize);\n let final = Math.max(-data.tabPos, Math.min(ideal, limit));\n\n // Set the final orientation-sensitive position.\n if (orientation === 'horizontal') {\n data.tab.style.left = `${final}px`;\n } else {\n data.tab.style.top = `${final}px`;\n }\n }\n\n /**\n * Reset the relative positions of the given tabs.\n */\n export function resetTabPositions(\n tabs: HTMLCollection,\n orientation: TabBar.Orientation\n ): void {\n for (const tab of tabs) {\n if (orientation === 'horizontal') {\n (tab as HTMLElement).style.left = '';\n } else {\n (tab as HTMLElement).style.top = '';\n }\n }\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt, empty } from '@lumino/algorithm';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { BoxEngine, BoxSizer } from './boxengine';\n\nimport { Layout, LayoutItem } from './layout';\n\nimport { TabBar } from './tabbar';\n\nimport Utils from './utils';\n\nimport { Widget } from './widget';\n\n/**\n * A layout which provides a flexible docking arrangement.\n *\n * #### Notes\n * The consumer of this layout is responsible for handling all signals\n * from the generated tab bars and managing the visibility of widgets\n * and tab bars as needed.\n */\nexport class DockLayout extends Layout {\n /**\n * Construct a new dock layout.\n *\n * @param options - The options for initializing the layout.\n */\n constructor(options: DockLayout.IOptions) {\n super();\n this.renderer = options.renderer;\n if (options.spacing !== undefined) {\n this._spacing = Utils.clampDimension(options.spacing);\n }\n this._document = options.document || document;\n this._hiddenMode =\n options.hiddenMode !== undefined\n ? options.hiddenMode\n : Widget.HiddenMode.Display;\n }\n\n /**\n * Dispose of the resources held by the layout.\n *\n * #### Notes\n * This will clear and dispose all widgets in the layout.\n */\n dispose(): void {\n // Get an iterator over the widgets in the layout.\n let widgets = this[Symbol.iterator]();\n\n // Dispose of the layout items.\n this._items.forEach(item => {\n item.dispose();\n });\n\n // Clear the layout state before disposing the widgets.\n this._box = null;\n this._root = null;\n this._items.clear();\n\n // Dispose of the widgets contained in the old layout root.\n for (const widget of widgets) {\n widget.dispose();\n }\n\n // Dispose of the base class.\n super.dispose();\n }\n\n /**\n * The renderer used by the dock layout.\n */\n readonly renderer: DockLayout.IRenderer;\n\n /**\n * The method for hiding child widgets.\n *\n * #### Notes\n * If there is only one child widget, `Display` hiding mode will be used\n * regardless of this setting.\n */\n get hiddenMode(): Widget.HiddenMode {\n return this._hiddenMode;\n }\n set hiddenMode(v: Widget.HiddenMode) {\n if (this._hiddenMode === v) {\n return;\n }\n this._hiddenMode = v;\n for (const bar of this.tabBars()) {\n if (bar.titles.length > 1) {\n for (const title of bar.titles) {\n title.owner.hiddenMode = this._hiddenMode;\n }\n }\n }\n }\n\n /**\n * Get the inter-element spacing for the dock layout.\n */\n get spacing(): number {\n return this._spacing;\n }\n\n /**\n * Set the inter-element spacing for the dock layout.\n */\n set spacing(value: number) {\n value = Utils.clampDimension(value);\n if (this._spacing === value) {\n return;\n }\n this._spacing = value;\n if (!this.parent) {\n return;\n }\n this.parent.fit();\n }\n\n /**\n * Whether the dock layout is empty.\n */\n get isEmpty(): boolean {\n return this._root === null;\n }\n\n /**\n * Create an iterator over all widgets in the layout.\n *\n * @returns A new iterator over the widgets in the layout.\n *\n * #### Notes\n * This iterator includes the generated tab bars.\n */\n [Symbol.iterator](): IterableIterator {\n return this._root ? this._root.iterAllWidgets() : empty();\n }\n\n /**\n * Create an iterator over the user widgets in the layout.\n *\n * @returns A new iterator over the user widgets in the layout.\n *\n * #### Notes\n * This iterator does not include the generated tab bars.\n */\n widgets(): IterableIterator {\n return this._root ? this._root.iterUserWidgets() : empty();\n }\n\n /**\n * Create an iterator over the selected widgets in the layout.\n *\n * @returns A new iterator over the selected user widgets.\n *\n * #### Notes\n * This iterator yields the widgets corresponding to the current tab\n * of each tab bar in the layout.\n */\n selectedWidgets(): IterableIterator {\n return this._root ? this._root.iterSelectedWidgets() : empty();\n }\n\n /**\n * Create an iterator over the tab bars in the layout.\n *\n * @returns A new iterator over the tab bars in the layout.\n *\n * #### Notes\n * This iterator does not include the user widgets.\n */\n tabBars(): IterableIterator> {\n return this._root ? this._root.iterTabBars() : empty();\n }\n\n /**\n * Create an iterator over the handles in the layout.\n *\n * @returns A new iterator over the handles in the layout.\n */\n handles(): IterableIterator {\n return this._root ? this._root.iterHandles() : empty();\n }\n\n /**\n * Move a handle to the given offset position.\n *\n * @param handle - The handle to move.\n *\n * @param offsetX - The desired offset X position of the handle.\n *\n * @param offsetY - The desired offset Y position of the handle.\n *\n * #### Notes\n * If the given handle is not contained in the layout, this is no-op.\n *\n * The handle will be moved as close as possible to the desired\n * position without violating any of the layout constraints.\n *\n * Only one of the coordinates is used depending on the orientation\n * of the handle. This method accepts both coordinates to make it\n * easy to invoke from a mouse move event without needing to know\n * the handle orientation.\n */\n moveHandle(handle: HTMLDivElement, offsetX: number, offsetY: number): void {\n // Bail early if there is no root or if the handle is hidden.\n let hidden = handle.classList.contains('lm-mod-hidden');\n if (!this._root || hidden) {\n return;\n }\n\n // Lookup the split node for the handle.\n let data = this._root.findSplitNode(handle);\n if (!data) {\n return;\n }\n\n // Compute the desired delta movement for the handle.\n let delta: number;\n if (data.node.orientation === 'horizontal') {\n delta = offsetX - handle.offsetLeft;\n } else {\n delta = offsetY - handle.offsetTop;\n }\n\n // Bail if there is no handle movement.\n if (delta === 0) {\n return;\n }\n\n // Prevent sibling resizing unless needed.\n data.node.holdSizes();\n\n // Adjust the sizers to reflect the handle movement.\n BoxEngine.adjust(data.node.sizers, data.index, delta);\n\n // Update the layout of the widgets.\n if (this.parent) {\n this.parent.update();\n }\n }\n\n /**\n * Save the current configuration of the dock layout.\n *\n * @returns A new config object for the current layout state.\n *\n * #### Notes\n * The return value can be provided to the `restoreLayout` method\n * in order to restore the layout to its current configuration.\n */\n saveLayout(): DockLayout.ILayoutConfig {\n // Bail early if there is no root.\n if (!this._root) {\n return { main: null };\n }\n\n // Hold the current sizes in the layout tree.\n this._root.holdAllSizes();\n\n // Return the layout config.\n return { main: this._root.createConfig() };\n }\n\n /**\n * Restore the layout to a previously saved configuration.\n *\n * @param config - The layout configuration to restore.\n *\n * #### Notes\n * Widgets which currently belong to the layout but which are not\n * contained in the config will be unparented.\n */\n restoreLayout(config: DockLayout.ILayoutConfig): void {\n // Create the widget set for validating the config.\n let widgetSet = new Set();\n\n // Normalize the main area config and collect the widgets.\n let mainConfig: DockLayout.AreaConfig | null;\n if (config.main) {\n mainConfig = Private.normalizeAreaConfig(config.main, widgetSet);\n } else {\n mainConfig = null;\n }\n\n // Create iterators over the old content.\n let oldWidgets = this.widgets();\n let oldTabBars = this.tabBars();\n let oldHandles = this.handles();\n\n // Clear the root before removing the old content.\n this._root = null;\n\n // Unparent the old widgets which are not in the new config.\n for (const widget of oldWidgets) {\n if (!widgetSet.has(widget)) {\n widget.parent = null;\n }\n }\n\n // Dispose of the old tab bars.\n for (const tabBar of oldTabBars) {\n tabBar.dispose();\n }\n\n // Remove the old handles.\n for (const handle of oldHandles) {\n if (handle.parentNode) {\n handle.parentNode.removeChild(handle);\n }\n }\n\n // Reparent the new widgets to the current parent.\n for (const widget of widgetSet) {\n widget.parent = this.parent;\n }\n\n // Create the root node for the new config.\n if (mainConfig) {\n this._root = Private.realizeAreaConfig(\n mainConfig,\n {\n // Ignoring optional `document` argument as we must reuse `this._document`\n createTabBar: (document?: Document | ShadowRoot) =>\n this._createTabBar(),\n createHandle: () => this._createHandle()\n },\n this._document\n );\n } else {\n this._root = null;\n }\n\n // If there is no parent, there is nothing more to do.\n if (!this.parent) {\n return;\n }\n\n // Attach the new widgets to the parent.\n widgetSet.forEach(widget => {\n this.attachWidget(widget);\n });\n\n // Post a fit request to the parent.\n this.parent.fit();\n }\n\n /**\n * Add a widget to the dock layout.\n *\n * @param widget - The widget to add to the dock layout.\n *\n * @param options - The additional options for adding the widget.\n *\n * #### Notes\n * The widget will be moved if it is already contained in the layout.\n *\n * An error will be thrown if the reference widget is invalid.\n */\n addWidget(widget: Widget, options: DockLayout.IAddOptions = {}): void {\n // Parse the options.\n let ref = options.ref || null;\n let mode = options.mode || 'tab-after';\n\n // Find the tab node which holds the reference widget.\n let refNode: Private.TabLayoutNode | null = null;\n if (this._root && ref) {\n refNode = this._root.findTabNode(ref);\n }\n\n // Throw an error if the reference widget is invalid.\n if (ref && !refNode) {\n throw new Error('Reference widget is not in the layout.');\n }\n\n // Reparent the widget to the current layout parent.\n widget.parent = this.parent;\n\n // Insert the widget according to the insert mode.\n switch (mode) {\n case 'tab-after':\n this._insertTab(widget, ref, refNode, true);\n break;\n case 'tab-before':\n this._insertTab(widget, ref, refNode, false);\n break;\n case 'split-top':\n this._insertSplit(widget, ref, refNode, 'vertical', false);\n break;\n case 'split-left':\n this._insertSplit(widget, ref, refNode, 'horizontal', false);\n break;\n case 'split-right':\n this._insertSplit(widget, ref, refNode, 'horizontal', true);\n break;\n case 'split-bottom':\n this._insertSplit(widget, ref, refNode, 'vertical', true);\n break;\n case 'merge-top':\n this._insertSplit(widget, ref, refNode, 'vertical', false, true);\n break;\n case 'merge-left':\n this._insertSplit(widget, ref, refNode, 'horizontal', false, true);\n break;\n case 'merge-right':\n this._insertSplit(widget, ref, refNode, 'horizontal', true, true);\n break;\n case 'merge-bottom':\n this._insertSplit(widget, ref, refNode, 'vertical', true, true);\n break;\n }\n\n // Do nothing else if there is no parent widget.\n if (!this.parent) {\n return;\n }\n\n // Ensure the widget is attached to the parent widget.\n this.attachWidget(widget);\n\n // Post a fit request for the parent widget.\n this.parent.fit();\n }\n\n /**\n * Remove a widget from the layout.\n *\n * @param widget - The widget to remove from the layout.\n *\n * #### Notes\n * A widget is automatically removed from the layout when its `parent`\n * is set to `null`. This method should only be invoked directly when\n * removing a widget from a layout which has yet to be installed on a\n * parent widget.\n *\n * This method does *not* modify the widget's `parent`.\n */\n removeWidget(widget: Widget): void {\n // Remove the widget from its current layout location.\n this._removeWidget(widget);\n\n // Do nothing else if there is no parent widget.\n if (!this.parent) {\n return;\n }\n\n // Detach the widget from the parent widget.\n this.detachWidget(widget);\n\n // Post a fit request for the parent widget.\n this.parent.fit();\n }\n\n /**\n * Find the tab area which contains the given client position.\n *\n * @param clientX - The client X position of interest.\n *\n * @param clientY - The client Y position of interest.\n *\n * @returns The geometry of the tab area at the given position, or\n * `null` if there is no tab area at the given position.\n */\n hitTestTabAreas(\n clientX: number,\n clientY: number\n ): DockLayout.ITabAreaGeometry | null {\n // Bail early if hit testing cannot produce valid results.\n if (!this._root || !this.parent || !this.parent.isVisible) {\n return null;\n }\n\n // Ensure the parent box sizing data is computed.\n if (!this._box) {\n this._box = ElementExt.boxSizing(this.parent.node);\n }\n\n // Convert from client to local coordinates.\n let rect = this.parent.node.getBoundingClientRect();\n let x = clientX - rect.left - this._box.borderLeft;\n let y = clientY - rect.top - this._box.borderTop;\n\n // Find the tab layout node at the local position.\n let tabNode = this._root.hitTestTabNodes(x, y);\n\n // Bail if a tab layout node was not found.\n if (!tabNode) {\n return null;\n }\n\n // Extract the data from the tab node.\n let { tabBar, top, left, width, height } = tabNode;\n\n // Compute the right and bottom edges of the tab area.\n let borderWidth = this._box.borderLeft + this._box.borderRight;\n let borderHeight = this._box.borderTop + this._box.borderBottom;\n let right = rect.width - borderWidth - (left + width);\n let bottom = rect.height - borderHeight - (top + height);\n\n // Return the hit test results.\n return { tabBar, x, y, top, left, right, bottom, width, height };\n }\n\n /**\n * Perform layout initialization which requires the parent widget.\n */\n protected init(): void {\n // Perform superclass initialization.\n super.init();\n\n // Attach each widget to the parent.\n for (const widget of this) {\n this.attachWidget(widget);\n }\n\n // Attach each handle to the parent.\n for (const handle of this.handles()) {\n this.parent!.node.appendChild(handle);\n }\n\n // Post a fit request for the parent widget.\n this.parent!.fit();\n }\n\n /**\n * Attach the widget to the layout parent widget.\n *\n * @param widget - The widget to attach to the parent.\n *\n * #### Notes\n * This is a no-op if the widget is already attached.\n */\n protected attachWidget(widget: Widget): void {\n // Do nothing if the widget is already attached.\n if (this.parent!.node === widget.node.parentNode) {\n return;\n }\n\n // Create the layout item for the widget.\n this._items.set(widget, new LayoutItem(widget));\n\n // Send a `'before-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n }\n\n // Add the widget's node to the parent.\n this.parent!.node.appendChild(widget.node);\n\n // Send an `'after-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n }\n\n /**\n * Detach the widget from the layout parent widget.\n *\n * @param widget - The widget to detach from the parent.\n *\n * #### Notes\n * This is a no-op if the widget is not attached.\n */\n protected detachWidget(widget: Widget): void {\n // Do nothing if the widget is not attached.\n if (this.parent!.node !== widget.node.parentNode) {\n return;\n }\n\n // Send a `'before-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n }\n\n // Remove the widget's node from the parent.\n this.parent!.node.removeChild(widget.node);\n\n // Send an `'after-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n\n // Delete the layout item for the widget.\n let item = this._items.get(widget);\n if (item) {\n this._items.delete(widget);\n item.dispose();\n }\n }\n\n /**\n * A message handler invoked on a `'before-show'` message.\n */\n protected onBeforeShow(msg: Message): void {\n super.onBeforeShow(msg);\n this.parent!.update();\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n super.onBeforeAttach(msg);\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-shown'` message.\n */\n protected onChildShown(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-hidden'` message.\n */\n protected onChildHidden(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'resize'` message.\n */\n protected onResize(msg: Widget.ResizeMessage): void {\n if (this.parent!.isVisible) {\n this._update(msg.width, msg.height);\n }\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n protected onUpdateRequest(msg: Message): void {\n if (this.parent!.isVisible) {\n this._update(-1, -1);\n }\n }\n\n /**\n * A message handler invoked on a `'fit-request'` message.\n */\n protected onFitRequest(msg: Message): void {\n if (this.parent!.isAttached) {\n this._fit();\n }\n }\n\n /**\n * Remove the specified widget from the layout structure.\n *\n * #### Notes\n * This is a no-op if the widget is not in the layout tree.\n *\n * This does not detach the widget from the parent node.\n */\n private _removeWidget(widget: Widget): void {\n // Bail early if there is no layout root.\n if (!this._root) {\n return;\n }\n\n // Find the tab node which contains the given widget.\n let tabNode = this._root.findTabNode(widget);\n\n // Bail early if the tab node is not found.\n if (!tabNode) {\n return;\n }\n\n Private.removeAria(widget);\n\n // If there are multiple tabs, just remove the widget's tab.\n if (tabNode.tabBar.titles.length > 1) {\n tabNode.tabBar.removeTab(widget.title);\n if (\n this._hiddenMode === Widget.HiddenMode.Scale &&\n tabNode.tabBar.titles.length == 1\n ) {\n const existingWidget = tabNode.tabBar.titles[0].owner;\n existingWidget.hiddenMode = Widget.HiddenMode.Display;\n }\n return;\n }\n\n // Otherwise, the tab node needs to be removed...\n\n // Dispose the tab bar.\n tabNode.tabBar.dispose();\n\n // Handle the case where the tab node is the root.\n if (this._root === tabNode) {\n this._root = null;\n return;\n }\n\n // Otherwise, remove the tab node from its parent...\n\n // Prevent widget resizing unless needed.\n this._root.holdAllSizes();\n\n // Clear the parent reference on the tab node.\n let splitNode = tabNode.parent!;\n tabNode.parent = null;\n\n // Remove the tab node from its parent split node.\n let i = ArrayExt.removeFirstOf(splitNode.children, tabNode);\n let handle = ArrayExt.removeAt(splitNode.handles, i)!;\n ArrayExt.removeAt(splitNode.sizers, i);\n\n // Remove the handle from its parent DOM node.\n if (handle.parentNode) {\n handle.parentNode.removeChild(handle);\n }\n\n // If there are multiple children, just update the handles.\n if (splitNode.children.length > 1) {\n splitNode.syncHandles();\n return;\n }\n\n // Otherwise, the split node also needs to be removed...\n\n // Clear the parent reference on the split node.\n let maybeParent = splitNode.parent;\n splitNode.parent = null;\n\n // Lookup the remaining child node and handle.\n let childNode = splitNode.children[0];\n let childHandle = splitNode.handles[0];\n\n // Clear the split node data.\n splitNode.children.length = 0;\n splitNode.handles.length = 0;\n splitNode.sizers.length = 0;\n\n // Remove the child handle from its parent node.\n if (childHandle.parentNode) {\n childHandle.parentNode.removeChild(childHandle);\n }\n\n // Handle the case where the split node is the root.\n if (this._root === splitNode) {\n childNode.parent = null;\n this._root = childNode;\n return;\n }\n\n // Otherwise, move the child node to the parent node...\n let parentNode = maybeParent!;\n\n // Lookup the index of the split node.\n let j = parentNode.children.indexOf(splitNode);\n\n // Handle the case where the child node is a tab node.\n if (childNode instanceof Private.TabLayoutNode) {\n childNode.parent = parentNode;\n parentNode.children[j] = childNode;\n return;\n }\n\n // Remove the split data from the parent.\n let splitHandle = ArrayExt.removeAt(parentNode.handles, j)!;\n ArrayExt.removeAt(parentNode.children, j);\n ArrayExt.removeAt(parentNode.sizers, j);\n\n // Remove the handle from its parent node.\n if (splitHandle.parentNode) {\n splitHandle.parentNode.removeChild(splitHandle);\n }\n\n // The child node and the split parent node will have the same\n // orientation. Merge the grand-children with the parent node.\n for (let i = 0, n = childNode.children.length; i < n; ++i) {\n let gChild = childNode.children[i];\n let gHandle = childNode.handles[i];\n let gSizer = childNode.sizers[i];\n ArrayExt.insert(parentNode.children, j + i, gChild);\n ArrayExt.insert(parentNode.handles, j + i, gHandle);\n ArrayExt.insert(parentNode.sizers, j + i, gSizer);\n gChild.parent = parentNode;\n }\n\n // Clear the child node.\n childNode.children.length = 0;\n childNode.handles.length = 0;\n childNode.sizers.length = 0;\n childNode.parent = null;\n\n // Sync the handles on the parent node.\n parentNode.syncHandles();\n }\n\n /**\n * Create the tab layout node to hold the widget.\n */\n private _createTabNode(widget: Widget): Private.TabLayoutNode {\n let tabNode = new Private.TabLayoutNode(this._createTabBar());\n tabNode.tabBar.addTab(widget.title);\n Private.addAria(widget, tabNode.tabBar);\n return tabNode;\n }\n\n /**\n * Insert a widget next to an existing tab.\n *\n * #### Notes\n * This does not attach the widget to the parent widget.\n */\n private _insertTab(\n widget: Widget,\n ref: Widget | null,\n refNode: Private.TabLayoutNode | null,\n after: boolean\n ): void {\n // Do nothing if the tab is inserted next to itself.\n if (widget === ref) {\n return;\n }\n\n // Create the root if it does not exist.\n if (!this._root) {\n let tabNode = new Private.TabLayoutNode(this._createTabBar());\n tabNode.tabBar.addTab(widget.title);\n this._root = tabNode;\n Private.addAria(widget, tabNode.tabBar);\n return;\n }\n\n // Use the first tab node as the ref node if needed.\n if (!refNode) {\n refNode = this._root.findFirstTabNode()!;\n }\n\n // If the widget is not contained in the ref node, ensure it is\n // removed from the layout and hidden before being added again.\n if (refNode.tabBar.titles.indexOf(widget.title) === -1) {\n this._removeWidget(widget);\n widget.hide();\n }\n\n // Lookup the target index for inserting the tab.\n let index: number;\n if (ref) {\n index = refNode.tabBar.titles.indexOf(ref.title);\n } else {\n index = refNode.tabBar.currentIndex;\n }\n\n // Using transform create an additional layer in the pixel pipeline\n // to limit the number of layer, it is set only if there is more than one widget.\n if (this._hiddenMode === Widget.HiddenMode.Scale) {\n if (refNode.tabBar.titles.length === 0) {\n // Singular tab should use display mode to limit number of layers.\n widget.hiddenMode = Widget.HiddenMode.Display;\n } else if (refNode.tabBar.titles.length == 1) {\n // If we are adding a second tab, switch the existing tab back to scale.\n const existingWidget = refNode.tabBar.titles[0].owner;\n existingWidget.hiddenMode = Widget.HiddenMode.Scale;\n } else {\n // For the third and subsequent tabs no special action is needed.\n widget.hiddenMode = Widget.HiddenMode.Scale;\n }\n } else {\n // For all other modes just propagate the current mode.\n widget.hiddenMode = this._hiddenMode;\n }\n\n // Insert the widget's tab relative to the target index.\n refNode.tabBar.insertTab(index + (after ? 1 : 0), widget.title);\n Private.addAria(widget, refNode.tabBar);\n }\n\n /**\n * Insert a widget as a new split area.\n *\n * #### Notes\n * This does not attach the widget to the parent widget.\n */\n private _insertSplit(\n widget: Widget,\n ref: Widget | null,\n refNode: Private.TabLayoutNode | null,\n orientation: Private.Orientation,\n after: boolean,\n merge: boolean = false\n ): void {\n // Do nothing if there is no effective split.\n if (widget === ref && refNode && refNode.tabBar.titles.length === 1) {\n return;\n }\n\n // Ensure the widget is removed from the current layout.\n this._removeWidget(widget);\n\n // Set the root if it does not exist.\n if (!this._root) {\n this._root = this._createTabNode(widget);\n return;\n }\n\n // If the ref node parent is null, split the root.\n if (!refNode || !refNode.parent) {\n // Ensure the root is split with the correct orientation.\n let root = this._splitRoot(orientation);\n\n // Determine the insert index for the new tab node.\n let i = after ? root.children.length : 0;\n\n // Normalize the split node.\n root.normalizeSizes();\n\n // Create the sizer for new tab node.\n let sizer = Private.createSizer(refNode ? 1 : Private.GOLDEN_RATIO);\n\n // Insert the tab node sized to the golden ratio.\n let tabNode = this._createTabNode(widget);\n ArrayExt.insert(root.children, i, tabNode);\n ArrayExt.insert(root.sizers, i, sizer);\n ArrayExt.insert(root.handles, i, this._createHandle());\n tabNode.parent = root;\n\n // Re-normalize the split node to maintain the ratios.\n root.normalizeSizes();\n\n // Finally, synchronize the visibility of the handles.\n root.syncHandles();\n return;\n }\n\n // Lookup the split node for the ref widget.\n let splitNode = refNode.parent;\n\n // If the split node already had the correct orientation,\n // the widget can be inserted into the split node directly.\n if (splitNode.orientation === orientation) {\n // Find the index of the ref node.\n let i = splitNode.children.indexOf(refNode);\n\n // Conditionally reuse a tab layout found in the wanted position.\n if (merge) {\n let j = i + (after ? 1 : -1);\n let sibling = splitNode.children[j];\n if (sibling instanceof Private.TabLayoutNode) {\n this._insertTab(widget, null, sibling, true);\n ++sibling.tabBar.currentIndex;\n return;\n }\n }\n\n // Normalize the split node.\n splitNode.normalizeSizes();\n\n // Consume half the space for the insert location.\n let s = (splitNode.sizers[i].sizeHint /= 2);\n\n // Insert the tab node sized to the other half.\n let j = i + (after ? 1 : 0);\n let tabNode = this._createTabNode(widget);\n ArrayExt.insert(splitNode.children, j, tabNode);\n ArrayExt.insert(splitNode.sizers, j, Private.createSizer(s));\n ArrayExt.insert(splitNode.handles, j, this._createHandle());\n tabNode.parent = splitNode;\n\n // Finally, synchronize the visibility of the handles.\n splitNode.syncHandles();\n return;\n }\n\n // Remove the ref node from the split node.\n let i = ArrayExt.removeFirstOf(splitNode.children, refNode);\n\n // Create a new normalized split node for the children.\n let childNode = new Private.SplitLayoutNode(orientation);\n childNode.normalized = true;\n\n // Add the ref node sized to half the space.\n childNode.children.push(refNode);\n childNode.sizers.push(Private.createSizer(0.5));\n childNode.handles.push(this._createHandle());\n refNode.parent = childNode;\n\n // Add the tab node sized to the other half.\n let j = after ? 1 : 0;\n let tabNode = this._createTabNode(widget);\n ArrayExt.insert(childNode.children, j, tabNode);\n ArrayExt.insert(childNode.sizers, j, Private.createSizer(0.5));\n ArrayExt.insert(childNode.handles, j, this._createHandle());\n tabNode.parent = childNode;\n\n // Synchronize the visibility of the handles.\n childNode.syncHandles();\n\n // Finally, add the new child node to the original split node.\n ArrayExt.insert(splitNode.children, i, childNode);\n childNode.parent = splitNode;\n }\n\n /**\n * Ensure the root is a split node with the given orientation.\n */\n private _splitRoot(\n orientation: Private.Orientation\n ): Private.SplitLayoutNode {\n // Bail early if the root already meets the requirements.\n let oldRoot = this._root;\n if (oldRoot instanceof Private.SplitLayoutNode) {\n if (oldRoot.orientation === orientation) {\n return oldRoot;\n }\n }\n\n // Create a new root node with the specified orientation.\n let newRoot = (this._root = new Private.SplitLayoutNode(orientation));\n\n // Add the old root to the new root.\n if (oldRoot) {\n newRoot.children.push(oldRoot);\n newRoot.sizers.push(Private.createSizer(0));\n newRoot.handles.push(this._createHandle());\n oldRoot.parent = newRoot;\n }\n\n // Return the new root as a convenience.\n return newRoot;\n }\n\n /**\n * Fit the layout to the total size required by the widgets.\n */\n private _fit(): void {\n // Set up the computed minimum size.\n let minW = 0;\n let minH = 0;\n\n // Update the size limits for the layout tree.\n if (this._root) {\n let limits = this._root.fit(this._spacing, this._items);\n minW = limits.minWidth;\n minH = limits.minHeight;\n }\n\n // Update the box sizing and add it to the computed min size.\n let box = (this._box = ElementExt.boxSizing(this.parent!.node));\n minW += box.horizontalSum;\n minH += box.verticalSum;\n\n // Update the parent's min size constraints.\n let style = this.parent!.node.style;\n style.minWidth = `${minW}px`;\n style.minHeight = `${minH}px`;\n\n // Set the dirty flag to ensure only a single update occurs.\n this._dirty = true;\n\n // Notify the ancestor that it should fit immediately. This may\n // cause a resize of the parent, fulfilling the required update.\n if (this.parent!.parent) {\n MessageLoop.sendMessage(this.parent!.parent!, Widget.Msg.FitRequest);\n }\n\n // If the dirty flag is still set, the parent was not resized.\n // Trigger the required update on the parent widget immediately.\n if (this._dirty) {\n MessageLoop.sendMessage(this.parent!, Widget.Msg.UpdateRequest);\n }\n }\n\n /**\n * Update the layout position and size of the widgets.\n *\n * The parent offset dimensions should be `-1` if unknown.\n */\n private _update(offsetWidth: number, offsetHeight: number): void {\n // Clear the dirty flag to indicate the update occurred.\n this._dirty = false;\n\n // Bail early if there is no root layout node.\n if (!this._root) {\n return;\n }\n\n // Measure the parent if the offset dimensions are unknown.\n if (offsetWidth < 0) {\n offsetWidth = this.parent!.node.offsetWidth;\n }\n if (offsetHeight < 0) {\n offsetHeight = this.parent!.node.offsetHeight;\n }\n\n // Ensure the parent box sizing data is computed.\n if (!this._box) {\n this._box = ElementExt.boxSizing(this.parent!.node);\n }\n\n // Compute the actual layout bounds adjusted for border and padding.\n let x = this._box.paddingTop;\n let y = this._box.paddingLeft;\n let width = offsetWidth - this._box.horizontalSum;\n let height = offsetHeight - this._box.verticalSum;\n\n // Update the geometry of the layout tree.\n this._root.update(x, y, width, height, this._spacing, this._items);\n }\n\n /**\n * Create a new tab bar for use by the dock layout.\n *\n * #### Notes\n * The tab bar will be attached to the parent if it exists.\n */\n private _createTabBar(): TabBar {\n // Create the tab bar using the renderer.\n let tabBar = this.renderer.createTabBar(this._document);\n\n // Enforce necessary tab bar behavior.\n tabBar.orientation = 'horizontal';\n\n // Attach the tab bar to the parent if possible.\n if (this.parent) {\n this.attachWidget(tabBar);\n }\n\n // Return the initialized tab bar.\n return tabBar;\n }\n\n /**\n * Create a new handle for the dock layout.\n *\n * #### Notes\n * The handle will be attached to the parent if it exists.\n */\n private _createHandle(): HTMLDivElement {\n // Create the handle using the renderer.\n let handle = this.renderer.createHandle();\n\n // Initialize the handle layout behavior.\n let style = handle.style;\n style.position = 'absolute';\n style.contain = 'strict';\n style.top = '0';\n style.left = '0';\n style.width = '0';\n style.height = '0';\n\n // Attach the handle to the parent if it exists.\n if (this.parent) {\n this.parent.node.appendChild(handle);\n }\n\n // Return the initialized handle.\n return handle;\n }\n\n private _spacing = 4;\n private _dirty = false;\n private _root: Private.LayoutNode | null = null;\n private _box: ElementExt.IBoxSizing | null = null;\n private _document: Document | ShadowRoot;\n private _hiddenMode: Widget.HiddenMode;\n private _items: Private.ItemMap = new Map();\n}\n\n/**\n * The namespace for the `DockLayout` class statics.\n */\nexport namespace DockLayout {\n /**\n * An options object for creating a dock layout.\n */\n export interface IOptions {\n /**\n * The document to use with the dock panel.\n *\n * The default is the global `document` instance.\n */\n document?: Document | ShadowRoot;\n\n /**\n * The method for hiding widgets.\n *\n * The default is `Widget.HiddenMode.Display`.\n */\n hiddenMode?: Widget.HiddenMode;\n\n /**\n * The renderer to use for the dock layout.\n */\n renderer: IRenderer;\n\n /**\n * The spacing between items in the layout.\n *\n * The default is `4`.\n */\n spacing?: number;\n }\n\n /**\n * A renderer for use with a dock layout.\n */\n export interface IRenderer {\n /**\n * Create a new tab bar for use with a dock layout.\n *\n * @returns A new tab bar for a dock layout.\n */\n createTabBar(document?: Document | ShadowRoot): TabBar;\n\n /**\n * Create a new handle node for use with a dock layout.\n *\n * @returns A new handle node for a dock layout.\n */\n createHandle(): HTMLDivElement;\n }\n\n /**\n * A type alias for the supported insertion modes.\n *\n * An insert mode is used to specify how a widget should be added\n * to the dock layout relative to a reference widget.\n */\n export type InsertMode =\n | /**\n * The area to the top of the reference widget.\n *\n * The widget will be inserted just above the reference widget.\n *\n * If the reference widget is null or invalid, the widget will be\n * inserted at the top edge of the dock layout.\n */\n 'split-top'\n\n /**\n * The area to the left of the reference widget.\n *\n * The widget will be inserted just left of the reference widget.\n *\n * If the reference widget is null or invalid, the widget will be\n * inserted at the left edge of the dock layout.\n */\n | 'split-left'\n\n /**\n * The area to the right of the reference widget.\n *\n * The widget will be inserted just right of the reference widget.\n *\n * If the reference widget is null or invalid, the widget will be\n * inserted at the right edge of the dock layout.\n */\n | 'split-right'\n\n /**\n * The area to the bottom of the reference widget.\n *\n * The widget will be inserted just below the reference widget.\n *\n * If the reference widget is null or invalid, the widget will be\n * inserted at the bottom edge of the dock layout.\n */\n | 'split-bottom'\n\n /**\n * Like `split-top` but if a tab layout exists above the reference widget,\n * it behaves like `tab-after` with reference to that instead.\n */\n | 'merge-top'\n\n /**\n * Like `split-left` but if a tab layout exists left of the reference widget,\n * it behaves like `tab-after` with reference to that instead.\n */\n | 'merge-left'\n\n /**\n * Like `split-right` but if a tab layout exists right of the reference widget,\n * it behaves like `tab-after` with reference to that instead.\n */\n | 'merge-right'\n\n /**\n * Like `split-bottom` but if a tab layout exists below the reference widget,\n * it behaves like `tab-after` with reference to that instead.\n */\n | 'merge-bottom'\n\n /**\n * The tab position before the reference widget.\n *\n * The widget will be added as a tab before the reference widget.\n *\n * If the reference widget is null or invalid, a sensible default\n * will be used.\n */\n | 'tab-before'\n\n /**\n * The tab position after the reference widget.\n *\n * The widget will be added as a tab after the reference widget.\n *\n * If the reference widget is null or invalid, a sensible default\n * will be used.\n */\n | 'tab-after';\n\n /**\n * An options object for adding a widget to the dock layout.\n */\n export interface IAddOptions {\n /**\n * The insertion mode for adding the widget.\n *\n * The default is `'tab-after'`.\n */\n mode?: InsertMode;\n\n /**\n * The reference widget for the insert location.\n *\n * The default is `null`.\n */\n ref?: Widget | null;\n }\n\n /**\n * A layout config object for a tab area.\n */\n export interface ITabAreaConfig {\n /**\n * The discriminated type of the config object.\n */\n type: 'tab-area';\n\n /**\n * The widgets contained in the tab area.\n */\n widgets: Widget[];\n\n /**\n * The index of the selected tab.\n */\n currentIndex: number;\n }\n\n /**\n * A layout config object for a split area.\n */\n export interface ISplitAreaConfig {\n /**\n * The discriminated type of the config object.\n */\n type: 'split-area';\n\n /**\n * The orientation of the split area.\n */\n orientation: 'horizontal' | 'vertical';\n\n /**\n * The children in the split area.\n */\n children: AreaConfig[];\n\n /**\n * The relative sizes of the children.\n */\n sizes: number[];\n }\n\n /**\n * A type alias for a general area config.\n */\n export type AreaConfig = ITabAreaConfig | ISplitAreaConfig;\n\n /**\n * A dock layout configuration object.\n */\n export interface ILayoutConfig {\n /**\n * The layout config for the main dock area.\n */\n main: AreaConfig | null;\n }\n\n /**\n * An object which represents the geometry of a tab area.\n */\n export interface ITabAreaGeometry {\n /**\n * The tab bar for the tab area.\n */\n tabBar: TabBar;\n\n /**\n * The local X position of the hit test in the dock area.\n *\n * #### Notes\n * This is the distance from the left edge of the layout parent\n * widget, to the local X coordinate of the hit test query.\n */\n x: number;\n\n /**\n * The local Y position of the hit test in the dock area.\n *\n * #### Notes\n * This is the distance from the top edge of the layout parent\n * widget, to the local Y coordinate of the hit test query.\n */\n y: number;\n\n /**\n * The local coordinate of the top edge of the tab area.\n *\n * #### Notes\n * This is the distance from the top edge of the layout parent\n * widget, to the top edge of the tab area.\n */\n top: number;\n\n /**\n * The local coordinate of the left edge of the tab area.\n *\n * #### Notes\n * This is the distance from the left edge of the layout parent\n * widget, to the left edge of the tab area.\n */\n left: number;\n\n /**\n * The local coordinate of the right edge of the tab area.\n *\n * #### Notes\n * This is the distance from the right edge of the layout parent\n * widget, to the right edge of the tab area.\n */\n right: number;\n\n /**\n * The local coordinate of the bottom edge of the tab area.\n *\n * #### Notes\n * This is the distance from the bottom edge of the layout parent\n * widget, to the bottom edge of the tab area.\n */\n bottom: number;\n\n /**\n * The width of the tab area.\n *\n * #### Notes\n * This is total width allocated for the tab area.\n */\n width: number;\n\n /**\n * The height of the tab area.\n *\n * #### Notes\n * This is total height allocated for the tab area.\n */\n height: number;\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * A fraction used for sizing root panels; ~= `1 / golden_ratio`.\n */\n export const GOLDEN_RATIO = 0.618;\n\n /**\n * A type alias for a dock layout node.\n */\n export type LayoutNode = TabLayoutNode | SplitLayoutNode;\n\n /**\n * A type alias for the orientation of a split layout node.\n */\n export type Orientation = 'horizontal' | 'vertical';\n\n /**\n * A type alias for a layout item map.\n */\n export type ItemMap = Map;\n\n /**\n * Create a box sizer with an initial size hint.\n */\n export function createSizer(hint: number): BoxSizer {\n let sizer = new BoxSizer();\n sizer.sizeHint = hint;\n sizer.size = hint;\n return sizer;\n }\n\n /**\n * Normalize an area config object and collect the visited widgets.\n */\n export function normalizeAreaConfig(\n config: DockLayout.AreaConfig,\n widgetSet: Set\n ): DockLayout.AreaConfig | null {\n let result: DockLayout.AreaConfig | null;\n if (config.type === 'tab-area') {\n result = normalizeTabAreaConfig(config, widgetSet);\n } else {\n result = normalizeSplitAreaConfig(config, widgetSet);\n }\n return result;\n }\n\n /**\n * Convert a normalized area config into a layout tree.\n */\n export function realizeAreaConfig(\n config: DockLayout.AreaConfig,\n renderer: DockLayout.IRenderer,\n document: Document | ShadowRoot\n ): LayoutNode {\n let node: LayoutNode;\n if (config.type === 'tab-area') {\n node = realizeTabAreaConfig(config, renderer, document);\n } else {\n node = realizeSplitAreaConfig(config, renderer, document);\n }\n return node;\n }\n\n /**\n * A layout node which holds the data for a tabbed area.\n */\n export class TabLayoutNode {\n /**\n * Construct a new tab layout node.\n *\n * @param tabBar - The tab bar to use for the layout node.\n */\n constructor(tabBar: TabBar) {\n let tabSizer = new BoxSizer();\n let widgetSizer = new BoxSizer();\n tabSizer.stretch = 0;\n widgetSizer.stretch = 1;\n this.tabBar = tabBar;\n this.sizers = [tabSizer, widgetSizer];\n }\n\n /**\n * The parent of the layout node.\n */\n parent: SplitLayoutNode | null = null;\n\n /**\n * The tab bar for the layout node.\n */\n readonly tabBar: TabBar;\n\n /**\n * The sizers for the layout node.\n */\n readonly sizers: [BoxSizer, BoxSizer];\n\n /**\n * The most recent value for the `top` edge of the layout box.\n */\n get top(): number {\n return this._top;\n }\n\n /**\n * The most recent value for the `left` edge of the layout box.\n */\n get left(): number {\n return this._left;\n }\n\n /**\n * The most recent value for the `width` of the layout box.\n */\n get width(): number {\n return this._width;\n }\n\n /**\n * The most recent value for the `height` of the layout box.\n */\n get height(): number {\n return this._height;\n }\n\n /**\n * Create an iterator for all widgets in the layout tree.\n */\n *iterAllWidgets(): IterableIterator {\n yield this.tabBar;\n yield* this.iterUserWidgets();\n }\n\n /**\n * Create an iterator for the user widgets in the layout tree.\n */\n *iterUserWidgets(): IterableIterator {\n for (const title of this.tabBar.titles) {\n yield title.owner;\n }\n }\n\n /**\n * Create an iterator for the selected widgets in the layout tree.\n */\n *iterSelectedWidgets(): IterableIterator {\n let title = this.tabBar.currentTitle;\n if (title) {\n yield title.owner;\n }\n }\n\n /**\n * Create an iterator for the tab bars in the layout tree.\n */\n *iterTabBars(): IterableIterator> {\n yield this.tabBar;\n }\n\n /**\n * Create an iterator for the handles in the layout tree.\n */\n // eslint-disable-next-line require-yield\n *iterHandles(): IterableIterator {\n return;\n }\n\n /**\n * Find the tab layout node which contains the given widget.\n */\n findTabNode(widget: Widget): TabLayoutNode | null {\n return this.tabBar.titles.indexOf(widget.title) !== -1 ? this : null;\n }\n\n /**\n * Find the split layout node which contains the given handle.\n */\n findSplitNode(\n handle: HTMLDivElement\n ): { index: number; node: SplitLayoutNode } | null {\n return null;\n }\n\n /**\n * Find the first tab layout node in a layout tree.\n */\n findFirstTabNode(): TabLayoutNode | null {\n return this;\n }\n\n /**\n * Find the tab layout node which contains the local point.\n */\n hitTestTabNodes(x: number, y: number): TabLayoutNode | null {\n if (x < this._left || x >= this._left + this._width) {\n return null;\n }\n if (y < this._top || y >= this._top + this._height) {\n return null;\n }\n return this;\n }\n\n /**\n * Create a configuration object for the layout tree.\n */\n createConfig(): DockLayout.ITabAreaConfig {\n let widgets = this.tabBar.titles.map(title => title.owner);\n let currentIndex = this.tabBar.currentIndex;\n return { type: 'tab-area', widgets, currentIndex };\n }\n\n /**\n * Recursively hold all of the sizes in the layout tree.\n *\n * This ignores the sizers of tab layout nodes.\n */\n holdAllSizes(): void {\n return;\n }\n\n /**\n * Fit the layout tree.\n */\n fit(spacing: number, items: ItemMap): ElementExt.ISizeLimits {\n // Set up the limit variables.\n let minWidth = 0;\n let minHeight = 0;\n let maxWidth = Infinity;\n let maxHeight = Infinity;\n\n // Lookup the tab bar layout item.\n let tabBarItem = items.get(this.tabBar);\n\n // Lookup the widget layout item.\n let current = this.tabBar.currentTitle;\n let widgetItem = current ? items.get(current.owner) : undefined;\n\n // Lookup the tab bar and widget sizers.\n let [tabBarSizer, widgetSizer] = this.sizers;\n\n // Update the tab bar limits.\n if (tabBarItem) {\n tabBarItem.fit();\n }\n\n // Update the widget limits.\n if (widgetItem) {\n widgetItem.fit();\n }\n\n // Update the results and sizer for the tab bar.\n if (tabBarItem && !tabBarItem.isHidden) {\n minWidth = Math.max(minWidth, tabBarItem.minWidth);\n minHeight += tabBarItem.minHeight;\n tabBarSizer.minSize = tabBarItem.minHeight;\n tabBarSizer.maxSize = tabBarItem.maxHeight;\n } else {\n tabBarSizer.minSize = 0;\n tabBarSizer.maxSize = 0;\n }\n\n // Update the results and sizer for the current widget.\n if (widgetItem && !widgetItem.isHidden) {\n minWidth = Math.max(minWidth, widgetItem.minWidth);\n minHeight += widgetItem.minHeight;\n widgetSizer.minSize = widgetItem.minHeight;\n widgetSizer.maxSize = Infinity;\n } else {\n widgetSizer.minSize = 0;\n widgetSizer.maxSize = Infinity;\n }\n\n // Return the computed size limits for the layout node.\n return { minWidth, minHeight, maxWidth, maxHeight };\n }\n\n /**\n * Update the layout tree.\n */\n update(\n left: number,\n top: number,\n width: number,\n height: number,\n spacing: number,\n items: ItemMap\n ): void {\n // Update the layout box values.\n this._top = top;\n this._left = left;\n this._width = width;\n this._height = height;\n\n // Lookup the tab bar layout item.\n let tabBarItem = items.get(this.tabBar);\n\n // Lookup the widget layout item.\n let current = this.tabBar.currentTitle;\n let widgetItem = current ? items.get(current.owner) : undefined;\n\n // Distribute the layout space to the sizers.\n BoxEngine.calc(this.sizers, height);\n\n // Update the tab bar item using the computed size.\n if (tabBarItem && !tabBarItem.isHidden) {\n let size = this.sizers[0].size;\n tabBarItem.update(left, top, width, size);\n top += size;\n }\n\n // Layout the widget using the computed size.\n if (widgetItem && !widgetItem.isHidden) {\n let size = this.sizers[1].size;\n widgetItem.update(left, top, width, size);\n }\n }\n\n private _top = 0;\n private _left = 0;\n private _width = 0;\n private _height = 0;\n }\n\n /**\n * A layout node which holds the data for a split area.\n */\n export class SplitLayoutNode {\n /**\n * Construct a new split layout node.\n *\n * @param orientation - The orientation of the node.\n */\n constructor(orientation: Orientation) {\n this.orientation = orientation;\n }\n\n /**\n * The parent of the layout node.\n */\n parent: SplitLayoutNode | null = null;\n\n /**\n * Whether the sizers have been normalized.\n */\n normalized = false;\n\n /**\n * The orientation of the node.\n */\n readonly orientation: Orientation;\n\n /**\n * The child nodes for the split node.\n */\n readonly children: LayoutNode[] = [];\n\n /**\n * The box sizers for the layout children.\n */\n readonly sizers: BoxSizer[] = [];\n\n /**\n * The handles for the layout children.\n */\n readonly handles: HTMLDivElement[] = [];\n\n /**\n * Create an iterator for all widgets in the layout tree.\n */\n *iterAllWidgets(): IterableIterator {\n for (const child of this.children) {\n yield* child.iterAllWidgets();\n }\n }\n\n /**\n * Create an iterator for the user widgets in the layout tree.\n */\n *iterUserWidgets(): IterableIterator {\n for (const child of this.children) {\n yield* child.iterUserWidgets();\n }\n }\n\n /**\n * Create an iterator for the selected widgets in the layout tree.\n */\n *iterSelectedWidgets(): IterableIterator {\n for (const child of this.children) {\n yield* child.iterSelectedWidgets();\n }\n }\n\n /**\n * Create an iterator for the tab bars in the layout tree.\n */\n *iterTabBars(): IterableIterator> {\n for (const child of this.children) {\n yield* child.iterTabBars();\n }\n }\n\n /**\n * Create an iterator for the handles in the layout tree.\n */\n *iterHandles(): IterableIterator {\n yield* this.handles;\n for (const child of this.children) {\n yield* child.iterHandles();\n }\n }\n\n /**\n * Find the tab layout node which contains the given widget.\n */\n findTabNode(widget: Widget): TabLayoutNode | null {\n for (let i = 0, n = this.children.length; i < n; ++i) {\n let result = this.children[i].findTabNode(widget);\n if (result) {\n return result;\n }\n }\n return null;\n }\n\n /**\n * Find the split layout node which contains the given handle.\n */\n findSplitNode(\n handle: HTMLDivElement\n ): { index: number; node: SplitLayoutNode } | null {\n let index = this.handles.indexOf(handle);\n if (index !== -1) {\n return { index, node: this };\n }\n for (let i = 0, n = this.children.length; i < n; ++i) {\n let result = this.children[i].findSplitNode(handle);\n if (result) {\n return result;\n }\n }\n return null;\n }\n\n /**\n * Find the first tab layout node in a layout tree.\n */\n findFirstTabNode(): TabLayoutNode | null {\n if (this.children.length === 0) {\n return null;\n }\n return this.children[0].findFirstTabNode();\n }\n\n /**\n * Find the tab layout node which contains the local point.\n */\n hitTestTabNodes(x: number, y: number): TabLayoutNode | null {\n for (let i = 0, n = this.children.length; i < n; ++i) {\n let result = this.children[i].hitTestTabNodes(x, y);\n if (result) {\n return result;\n }\n }\n return null;\n }\n\n /**\n * Create a configuration object for the layout tree.\n */\n createConfig(): DockLayout.ISplitAreaConfig {\n let orientation = this.orientation;\n let sizes = this.createNormalizedSizes();\n let children = this.children.map(child => child.createConfig());\n return { type: 'split-area', orientation, children, sizes };\n }\n\n /**\n * Sync the visibility and orientation of the handles.\n */\n syncHandles(): void {\n this.handles.forEach((handle, i) => {\n handle.setAttribute('data-orientation', this.orientation);\n if (i === this.handles.length - 1) {\n handle.classList.add('lm-mod-hidden');\n } else {\n handle.classList.remove('lm-mod-hidden');\n }\n });\n }\n\n /**\n * Hold the current sizes of the box sizers.\n *\n * This sets the size hint of each sizer to its current size.\n */\n holdSizes(): void {\n for (const sizer of this.sizers) {\n sizer.sizeHint = sizer.size;\n }\n }\n\n /**\n * Recursively hold all of the sizes in the layout tree.\n *\n * This ignores the sizers of tab layout nodes.\n */\n holdAllSizes(): void {\n for (const child of this.children) {\n child.holdAllSizes();\n }\n this.holdSizes();\n }\n\n /**\n * Normalize the sizes of the split layout node.\n */\n normalizeSizes(): void {\n // Bail early if the sizers are empty.\n let n = this.sizers.length;\n if (n === 0) {\n return;\n }\n\n // Hold the current sizes of the sizers.\n this.holdSizes();\n\n // Compute the sum of the sizes.\n let sum = this.sizers.reduce((v, sizer) => v + sizer.sizeHint, 0);\n\n // Normalize the sizes based on the sum.\n if (sum === 0) {\n for (const sizer of this.sizers) {\n sizer.size = sizer.sizeHint = 1 / n;\n }\n } else {\n for (const sizer of this.sizers) {\n sizer.size = sizer.sizeHint /= sum;\n }\n }\n\n // Mark the sizes as normalized.\n this.normalized = true;\n }\n\n /**\n * Snap the normalized sizes of the split layout node.\n */\n createNormalizedSizes(): number[] {\n // Bail early if the sizers are empty.\n let n = this.sizers.length;\n if (n === 0) {\n return [];\n }\n\n // Grab the current sizes of the sizers.\n let sizes = this.sizers.map(sizer => sizer.size);\n\n // Compute the sum of the sizes.\n let sum = sizes.reduce((v, size) => v + size, 0);\n\n // Normalize the sizes based on the sum.\n if (sum === 0) {\n for (let i = sizes.length - 1; i > -1; i--) {\n sizes[i] = 1 / n;\n }\n } else {\n for (let i = sizes.length - 1; i > -1; i--) {\n sizes[i] /= sum;\n }\n }\n\n // Return the normalized sizes.\n return sizes;\n }\n\n /**\n * Fit the layout tree.\n */\n fit(spacing: number, items: ItemMap): ElementExt.ISizeLimits {\n // Compute the required fixed space.\n let horizontal = this.orientation === 'horizontal';\n let fixed = Math.max(0, this.children.length - 1) * spacing;\n\n // Set up the limit variables.\n let minWidth = horizontal ? fixed : 0;\n let minHeight = horizontal ? 0 : fixed;\n let maxWidth = Infinity;\n let maxHeight = Infinity;\n\n // Fit the children and update the limits.\n for (let i = 0, n = this.children.length; i < n; ++i) {\n let limits = this.children[i].fit(spacing, items);\n if (horizontal) {\n minHeight = Math.max(minHeight, limits.minHeight);\n minWidth += limits.minWidth;\n this.sizers[i].minSize = limits.minWidth;\n } else {\n minWidth = Math.max(minWidth, limits.minWidth);\n minHeight += limits.minHeight;\n this.sizers[i].minSize = limits.minHeight;\n }\n }\n\n // Return the computed limits for the layout node.\n return { minWidth, minHeight, maxWidth, maxHeight };\n }\n\n /**\n * Update the layout tree.\n */\n update(\n left: number,\n top: number,\n width: number,\n height: number,\n spacing: number,\n items: ItemMap\n ): void {\n // Compute the available layout space.\n let horizontal = this.orientation === 'horizontal';\n let fixed = Math.max(0, this.children.length - 1) * spacing;\n let space = Math.max(0, (horizontal ? width : height) - fixed);\n\n // De-normalize the sizes if needed.\n if (this.normalized) {\n for (const sizer of this.sizers) {\n sizer.sizeHint *= space;\n }\n this.normalized = false;\n }\n\n // Distribute the layout space to the sizers.\n BoxEngine.calc(this.sizers, space);\n\n // Update the geometry of the child nodes and handles.\n for (let i = 0, n = this.children.length; i < n; ++i) {\n let child = this.children[i];\n let size = this.sizers[i].size;\n let handleStyle = this.handles[i].style;\n if (horizontal) {\n child.update(left, top, size, height, spacing, items);\n left += size;\n handleStyle.top = `${top}px`;\n handleStyle.left = `${left}px`;\n handleStyle.width = `${spacing}px`;\n handleStyle.height = `${height}px`;\n left += spacing;\n } else {\n child.update(left, top, width, size, spacing, items);\n top += size;\n handleStyle.top = `${top}px`;\n handleStyle.left = `${left}px`;\n handleStyle.width = `${width}px`;\n handleStyle.height = `${spacing}px`;\n top += spacing;\n }\n }\n }\n }\n\n export function addAria(widget: Widget, tabBar: TabBar): void {\n widget.node.setAttribute('role', 'tabpanel');\n let renderer = tabBar.renderer;\n if (renderer instanceof TabBar.Renderer) {\n let tabId = renderer.createTabKey({\n title: widget.title,\n current: false,\n zIndex: 0\n });\n widget.node.setAttribute('aria-labelledby', tabId);\n }\n }\n\n export function removeAria(widget: Widget): void {\n widget.node.removeAttribute('role');\n widget.node.removeAttribute('aria-labelledby');\n }\n\n /**\n * Normalize a tab area config and collect the visited widgets.\n */\n function normalizeTabAreaConfig(\n config: DockLayout.ITabAreaConfig,\n widgetSet: Set\n ): DockLayout.ITabAreaConfig | null {\n // Bail early if there is no content.\n if (config.widgets.length === 0) {\n return null;\n }\n\n // Setup the filtered widgets array.\n let widgets: Widget[] = [];\n\n // Filter the config for unique widgets.\n for (const widget of config.widgets) {\n if (!widgetSet.has(widget)) {\n widgetSet.add(widget);\n widgets.push(widget);\n }\n }\n\n // Bail if there are no effective widgets.\n if (widgets.length === 0) {\n return null;\n }\n\n // Normalize the current index.\n let index = config.currentIndex;\n if (index !== -1 && (index < 0 || index >= widgets.length)) {\n index = 0;\n }\n\n // Return a normalized config object.\n return { type: 'tab-area', widgets, currentIndex: index };\n }\n\n /**\n * Normalize a split area config and collect the visited widgets.\n */\n function normalizeSplitAreaConfig(\n config: DockLayout.ISplitAreaConfig,\n widgetSet: Set\n ): DockLayout.AreaConfig | null {\n // Set up the result variables.\n let orientation = config.orientation;\n let children: DockLayout.AreaConfig[] = [];\n let sizes: number[] = [];\n\n // Normalize the config children.\n for (let i = 0, n = config.children.length; i < n; ++i) {\n // Normalize the child config.\n let child = normalizeAreaConfig(config.children[i], widgetSet);\n\n // Ignore an empty child.\n if (!child) {\n continue;\n }\n\n // Add the child or hoist its content as appropriate.\n if (child.type === 'tab-area' || child.orientation !== orientation) {\n children.push(child);\n sizes.push(Math.abs(config.sizes[i] || 0));\n } else {\n children.push(...child.children);\n sizes.push(...child.sizes);\n }\n }\n\n // Bail if there are no effective children.\n if (children.length === 0) {\n return null;\n }\n\n // If there is only one effective child, return that child.\n if (children.length === 1) {\n return children[0];\n }\n\n // Return a normalized config object.\n return { type: 'split-area', orientation, children, sizes };\n }\n\n /**\n * Convert a normalized tab area config into a layout tree.\n */\n function realizeTabAreaConfig(\n config: DockLayout.ITabAreaConfig,\n renderer: DockLayout.IRenderer,\n document: Document | ShadowRoot\n ): TabLayoutNode {\n // Create the tab bar for the layout node.\n let tabBar = renderer.createTabBar(document);\n\n // Hide each widget and add it to the tab bar.\n for (const widget of config.widgets) {\n widget.hide();\n tabBar.addTab(widget.title);\n Private.addAria(widget, tabBar);\n }\n\n // Set the current index of the tab bar.\n tabBar.currentIndex = config.currentIndex;\n\n // Return the new tab layout node.\n return new TabLayoutNode(tabBar);\n }\n\n /**\n * Convert a normalized split area config into a layout tree.\n */\n function realizeSplitAreaConfig(\n config: DockLayout.ISplitAreaConfig,\n renderer: DockLayout.IRenderer,\n document: Document | ShadowRoot\n ): SplitLayoutNode {\n // Create the split layout node.\n let node = new SplitLayoutNode(config.orientation);\n\n // Add each child to the layout node.\n config.children.forEach((child, i) => {\n // Create the child data for the layout node.\n let childNode = realizeAreaConfig(child, renderer, document);\n let sizer = createSizer(config.sizes[i]);\n let handle = renderer.createHandle();\n\n // Add the child data to the layout node.\n node.children.push(childNode);\n node.handles.push(handle);\n node.sizers.push(sizer);\n\n // Update the parent for the child node.\n childNode.parent = node;\n });\n\n // Synchronize the handle state for the layout node.\n node.syncHandles();\n\n // Normalize the sizes for the layout node.\n node.normalizeSizes();\n\n // Return the new layout node.\n return node;\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { find } from '@lumino/algorithm';\n\nimport { MimeData } from '@lumino/coreutils';\n\nimport { IDisposable } from '@lumino/disposable';\n\nimport { ElementExt, Platform } from '@lumino/domutils';\n\nimport { Drag } from '@lumino/dragdrop';\n\nimport { ConflatableMessage, Message, MessageLoop } from '@lumino/messaging';\n\nimport { AttachedProperty } from '@lumino/properties';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { DockLayout } from './docklayout';\n\nimport { TabBar } from './tabbar';\n\nimport { Widget } from './widget';\n\n/**\n * A widget which provides a flexible docking area for widgets.\n *\n * #### Notes\n * See also the related [example](../../examples/dockpanel/index.html) and\n * its [source](https://github.com/jupyterlab/lumino/tree/main/examples/example-dockpanel).\n */\nexport class DockPanel extends Widget {\n /**\n * Construct a new dock panel.\n *\n * @param options - The options for initializing the panel.\n */\n constructor(options: DockPanel.IOptions = {}) {\n super();\n this.addClass('lm-DockPanel');\n this._document = options.document || document;\n this._mode = options.mode || 'multiple-document';\n this._renderer = options.renderer || DockPanel.defaultRenderer;\n this._edges = options.edges || Private.DEFAULT_EDGES;\n if (options.tabsMovable !== undefined) {\n this._tabsMovable = options.tabsMovable;\n }\n if (options.tabsConstrained !== undefined) {\n this._tabsConstrained = options.tabsConstrained;\n }\n if (options.addButtonEnabled !== undefined) {\n this._addButtonEnabled = options.addButtonEnabled;\n }\n\n // Toggle the CSS mode attribute.\n this.dataset['mode'] = this._mode;\n\n // Create the delegate renderer for the layout.\n let renderer: DockPanel.IRenderer = {\n createTabBar: () => this._createTabBar(),\n createHandle: () => this._createHandle()\n };\n\n // Set up the dock layout for the panel.\n this.layout = new DockLayout({\n document: this._document,\n renderer,\n spacing: options.spacing,\n hiddenMode: options.hiddenMode\n });\n\n // Set up the overlay drop indicator.\n this.overlay = options.overlay || new DockPanel.Overlay();\n this.node.appendChild(this.overlay.node);\n }\n\n /**\n * Dispose of the resources held by the panel.\n */\n dispose(): void {\n // Ensure the mouse is released.\n this._releaseMouse();\n\n // Hide the overlay.\n this.overlay.hide(0);\n\n // Cancel a drag if one is in progress.\n if (this._drag) {\n this._drag.dispose();\n }\n\n // Dispose of the base class.\n super.dispose();\n }\n\n /**\n * The method for hiding widgets.\n */\n get hiddenMode(): Widget.HiddenMode {\n return (this.layout as DockLayout).hiddenMode;\n }\n\n /**\n * Set the method for hiding widgets.\n */\n set hiddenMode(v: Widget.HiddenMode) {\n (this.layout as DockLayout).hiddenMode = v;\n }\n\n /**\n * A signal emitted when the layout configuration is modified.\n *\n * #### Notes\n * This signal is emitted whenever the current layout configuration\n * may have changed.\n *\n * This signal is emitted asynchronously in a collapsed fashion, so\n * that multiple synchronous modifications results in only a single\n * emit of the signal.\n */\n get layoutModified(): ISignal {\n return this._layoutModified;\n }\n\n /**\n * A signal emitted when the add button on a tab bar is clicked.\n *\n */\n get addRequested(): ISignal> {\n return this._addRequested;\n }\n\n /**\n * The overlay used by the dock panel.\n */\n readonly overlay: DockPanel.IOverlay;\n\n /**\n * The renderer used by the dock panel.\n */\n get renderer(): DockPanel.IRenderer {\n return (this.layout as DockLayout).renderer;\n }\n\n /**\n * Get the spacing between the widgets.\n */\n get spacing(): number {\n return (this.layout as DockLayout).spacing;\n }\n\n /**\n * Set the spacing between the widgets.\n */\n set spacing(value: number) {\n (this.layout as DockLayout).spacing = value;\n }\n\n /**\n * Get the mode for the dock panel.\n */\n get mode(): DockPanel.Mode {\n return this._mode;\n }\n\n /**\n * Set the mode for the dock panel.\n *\n * #### Notes\n * Changing the mode is a destructive operation with respect to the\n * panel's layout configuration. If layout state must be preserved,\n * save the current layout config before changing the mode.\n */\n set mode(value: DockPanel.Mode) {\n // Bail early if the mode does not change.\n if (this._mode === value) {\n return;\n }\n\n // Update the internal mode.\n this._mode = value;\n\n // Toggle the CSS mode attribute.\n this.dataset['mode'] = value;\n\n // Get the layout for the panel.\n let layout = this.layout as DockLayout;\n\n // Configure the layout for the specified mode.\n switch (value) {\n case 'multiple-document':\n for (const tabBar of layout.tabBars()) {\n tabBar.show();\n }\n break;\n case 'single-document':\n layout.restoreLayout(Private.createSingleDocumentConfig(this));\n break;\n default:\n throw 'unreachable';\n }\n\n // Schedule an emit of the layout modified signal.\n MessageLoop.postMessage(this, Private.LayoutModified);\n }\n\n /**\n * Whether the tabs can be dragged / moved at runtime.\n */\n get tabsMovable(): boolean {\n return this._tabsMovable;\n }\n\n /**\n * Enable / Disable draggable / movable tabs.\n */\n set tabsMovable(value: boolean) {\n this._tabsMovable = value;\n for (const tabBar of this.tabBars()) {\n tabBar.tabsMovable = value;\n }\n }\n\n /**\n * Whether the tabs are constrained to their source dock panel\n */\n get tabsConstrained(): boolean {\n return this._tabsConstrained;\n }\n\n /**\n * Constrain/Allow tabs to be dragged outside of this dock panel\n */\n set tabsConstrained(value: boolean) {\n this._tabsConstrained = value;\n }\n\n /**\n * Whether the add buttons for each tab bar are enabled.\n */\n get addButtonEnabled(): boolean {\n return this._addButtonEnabled;\n }\n\n /**\n * Set whether the add buttons for each tab bar are enabled.\n */\n set addButtonEnabled(value: boolean) {\n this._addButtonEnabled = value;\n for (const tabBar of this.tabBars()) {\n tabBar.addButtonEnabled = value;\n }\n }\n\n /**\n * Whether the dock panel is empty.\n */\n get isEmpty(): boolean {\n return (this.layout as DockLayout).isEmpty;\n }\n\n /**\n * Create an iterator over the user widgets in the panel.\n *\n * @returns A new iterator over the user widgets in the panel.\n *\n * #### Notes\n * This iterator does not include the generated tab bars.\n */\n *widgets(): IterableIterator {\n yield* (this.layout as DockLayout).widgets();\n }\n\n /**\n * Create an iterator over the selected widgets in the panel.\n *\n * @returns A new iterator over the selected user widgets.\n *\n * #### Notes\n * This iterator yields the widgets corresponding to the current tab\n * of each tab bar in the panel.\n */\n *selectedWidgets(): IterableIterator {\n yield* (this.layout as DockLayout).selectedWidgets();\n }\n\n /**\n * Create an iterator over the tab bars in the panel.\n *\n * @returns A new iterator over the tab bars in the panel.\n *\n * #### Notes\n * This iterator does not include the user widgets.\n */\n *tabBars(): IterableIterator> {\n yield* (this.layout as DockLayout).tabBars();\n }\n\n /**\n * Create an iterator over the handles in the panel.\n *\n * @returns A new iterator over the handles in the panel.\n */\n *handles(): IterableIterator {\n yield* (this.layout as DockLayout).handles();\n }\n\n /**\n * Select a specific widget in the dock panel.\n *\n * @param widget - The widget of interest.\n *\n * #### Notes\n * This will make the widget the current widget in its tab area.\n */\n selectWidget(widget: Widget): void {\n // Find the tab bar which contains the widget.\n let tabBar = find(this.tabBars(), bar => {\n return bar.titles.indexOf(widget.title) !== -1;\n });\n\n // Throw an error if no tab bar is found.\n if (!tabBar) {\n throw new Error('Widget is not contained in the dock panel.');\n }\n\n // Ensure the widget is the current widget.\n tabBar.currentTitle = widget.title;\n }\n\n /**\n * Activate a specified widget in the dock panel.\n *\n * @param widget - The widget of interest.\n *\n * #### Notes\n * This will select and activate the given widget.\n */\n activateWidget(widget: Widget): void {\n this.selectWidget(widget);\n widget.activate();\n }\n\n /**\n * Save the current layout configuration of the dock panel.\n *\n * @returns A new config object for the current layout state.\n *\n * #### Notes\n * The return value can be provided to the `restoreLayout` method\n * in order to restore the layout to its current configuration.\n */\n saveLayout(): DockPanel.ILayoutConfig {\n return (this.layout as DockLayout).saveLayout();\n }\n\n /**\n * Restore the layout to a previously saved configuration.\n *\n * @param config - The layout configuration to restore.\n *\n * #### Notes\n * Widgets which currently belong to the layout but which are not\n * contained in the config will be unparented.\n *\n * The dock panel automatically reverts to `'multiple-document'`\n * mode when a layout config is restored.\n */\n restoreLayout(config: DockPanel.ILayoutConfig): void {\n // Reset the mode.\n this._mode = 'multiple-document';\n\n // Restore the layout.\n (this.layout as DockLayout).restoreLayout(config);\n\n // Flush the message loop on IE and Edge to prevent flicker.\n if (Platform.IS_EDGE || Platform.IS_IE) {\n MessageLoop.flush();\n }\n\n // Schedule an emit of the layout modified signal.\n MessageLoop.postMessage(this, Private.LayoutModified);\n }\n\n /**\n * Add a widget to the dock panel.\n *\n * @param widget - The widget to add to the dock panel.\n *\n * @param options - The additional options for adding the widget.\n *\n * #### Notes\n * If the panel is in single document mode, the options are ignored\n * and the widget is always added as tab in the hidden tab bar.\n */\n addWidget(widget: Widget, options: DockPanel.IAddOptions = {}): void {\n // Add the widget to the layout.\n if (this._mode === 'single-document') {\n (this.layout as DockLayout).addWidget(widget);\n } else {\n (this.layout as DockLayout).addWidget(widget, options);\n }\n\n // Schedule an emit of the layout modified signal.\n MessageLoop.postMessage(this, Private.LayoutModified);\n }\n\n /**\n * Process a message sent to the widget.\n *\n * @param msg - The message sent to the widget.\n */\n processMessage(msg: Message): void {\n if (msg.type === 'layout-modified') {\n this._layoutModified.emit(undefined);\n } else {\n super.processMessage(msg);\n }\n }\n\n /**\n * Handle the DOM events for the dock panel.\n *\n * @param event - The DOM event sent to the panel.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the panel's DOM node. It should\n * not be called directly by user code.\n */\n handleEvent(event: Event): void {\n switch (event.type) {\n case 'lm-dragenter':\n this._evtDragEnter(event as Drag.Event);\n break;\n case 'lm-dragleave':\n this._evtDragLeave(event as Drag.Event);\n break;\n case 'lm-dragover':\n this._evtDragOver(event as Drag.Event);\n break;\n case 'lm-drop':\n this._evtDrop(event as Drag.Event);\n break;\n case 'pointerdown':\n this._evtPointerDown(event as PointerEvent);\n break;\n case 'pointermove':\n this._evtPointerMove(event as PointerEvent);\n break;\n case 'pointerup':\n this._evtPointerUp(event as PointerEvent);\n break;\n case 'keydown':\n this._evtKeyDown(event as KeyboardEvent);\n break;\n case 'contextmenu':\n event.preventDefault();\n event.stopPropagation();\n break;\n }\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n this.node.addEventListener('lm-dragenter', this);\n this.node.addEventListener('lm-dragleave', this);\n this.node.addEventListener('lm-dragover', this);\n this.node.addEventListener('lm-drop', this);\n this.node.addEventListener('pointerdown', this);\n }\n\n /**\n * A message handler invoked on an `'after-detach'` message.\n */\n protected onAfterDetach(msg: Message): void {\n this.node.removeEventListener('lm-dragenter', this);\n this.node.removeEventListener('lm-dragleave', this);\n this.node.removeEventListener('lm-dragover', this);\n this.node.removeEventListener('lm-drop', this);\n this.node.removeEventListener('pointerdown', this);\n this._releaseMouse();\n }\n\n /**\n * A message handler invoked on a `'child-added'` message.\n */\n protected onChildAdded(msg: Widget.ChildMessage): void {\n // Ignore the generated tab bars.\n if (Private.isGeneratedTabBarProperty.get(msg.child)) {\n return;\n }\n\n // Add the widget class to the child.\n msg.child.addClass('lm-DockPanel-widget');\n }\n\n /**\n * A message handler invoked on a `'child-removed'` message.\n */\n protected onChildRemoved(msg: Widget.ChildMessage): void {\n // Ignore the generated tab bars.\n if (Private.isGeneratedTabBarProperty.get(msg.child)) {\n return;\n }\n\n // Remove the widget class from the child.\n msg.child.removeClass('lm-DockPanel-widget');\n\n // Schedule an emit of the layout modified signal.\n MessageLoop.postMessage(this, Private.LayoutModified);\n }\n\n /**\n * Handle the `'lm-dragenter'` event for the dock panel.\n */\n private _evtDragEnter(event: Drag.Event): void {\n // If the factory mime type is present, mark the event as\n // handled in order to get the rest of the drag events.\n if (event.mimeData.hasData('application/vnd.lumino.widget-factory')) {\n event.preventDefault();\n event.stopPropagation();\n }\n }\n\n /**\n * Handle the `'lm-dragleave'` event for the dock panel.\n */\n private _evtDragLeave(event: Drag.Event): void {\n // Mark the event as handled.\n event.preventDefault();\n\n if (this._tabsConstrained && event.source !== this) return;\n\n event.stopPropagation();\n\n // The new target might be a descendant, so we might still handle the drop.\n // Hide asynchronously so that if a lm-dragover event bubbles up to us, the\n // hide is cancelled by the lm-dragover handler's show overlay logic.\n this.overlay.hide(1);\n }\n\n /**\n * Handle the `'lm-dragover'` event for the dock panel.\n */\n private _evtDragOver(event: Drag.Event): void {\n // Mark the event as handled.\n event.preventDefault();\n\n // Show the drop indicator overlay and update the drop\n // action based on the drop target zone under the mouse.\n if (\n (this._tabsConstrained && event.source !== this) ||\n this._showOverlay(event.clientX, event.clientY) === 'invalid'\n ) {\n event.dropAction = 'none';\n } else {\n event.stopPropagation();\n event.dropAction = event.proposedAction;\n }\n }\n\n /**\n * Handle the `'lm-drop'` event for the dock panel.\n */\n private _evtDrop(event: Drag.Event): void {\n // Mark the event as handled.\n event.preventDefault();\n\n // Hide the drop indicator overlay.\n this.overlay.hide(0);\n\n // Bail if the proposed action is to do nothing.\n if (event.proposedAction === 'none') {\n event.dropAction = 'none';\n return;\n }\n\n // Find the drop target under the mouse.\n let { clientX, clientY } = event;\n let { zone, target } = Private.findDropTarget(\n this,\n clientX,\n clientY,\n this._edges\n );\n\n // Bail if the drop zone is invalid.\n if (\n (this._tabsConstrained && event.source !== this) ||\n zone === 'invalid'\n ) {\n event.dropAction = 'none';\n return;\n }\n\n // Bail if the factory mime type has invalid data.\n let mimeData = event.mimeData;\n let factory = mimeData.getData('application/vnd.lumino.widget-factory');\n if (typeof factory !== 'function') {\n event.dropAction = 'none';\n return;\n }\n\n // Bail if the factory does not produce a widget.\n let widget = factory();\n if (!(widget instanceof Widget)) {\n event.dropAction = 'none';\n return;\n }\n\n // Bail if the widget is an ancestor of the dock panel.\n if (widget.contains(this)) {\n event.dropAction = 'none';\n return;\n }\n\n // Find the reference widget for the drop target.\n let ref = target ? Private.getDropRef(target.tabBar) : null;\n\n // Add the widget according to the indicated drop zone.\n switch (zone) {\n case 'root-all':\n this.addWidget(widget);\n break;\n case 'root-top':\n this.addWidget(widget, { mode: 'split-top' });\n break;\n case 'root-left':\n this.addWidget(widget, { mode: 'split-left' });\n break;\n case 'root-right':\n this.addWidget(widget, { mode: 'split-right' });\n break;\n case 'root-bottom':\n this.addWidget(widget, { mode: 'split-bottom' });\n break;\n case 'widget-all':\n this.addWidget(widget, { mode: 'tab-after', ref });\n break;\n case 'widget-top':\n this.addWidget(widget, { mode: 'split-top', ref });\n break;\n case 'widget-left':\n this.addWidget(widget, { mode: 'split-left', ref });\n break;\n case 'widget-right':\n this.addWidget(widget, { mode: 'split-right', ref });\n break;\n case 'widget-bottom':\n this.addWidget(widget, { mode: 'split-bottom', ref });\n break;\n case 'widget-tab':\n this.addWidget(widget, { mode: 'tab-after', ref });\n break;\n default:\n throw 'unreachable';\n }\n\n // Accept the proposed drop action.\n event.dropAction = event.proposedAction;\n\n // Stop propagation if we have not bailed so far.\n event.stopPropagation();\n\n // Activate the dropped widget.\n this.activateWidget(widget);\n }\n\n /**\n * Handle the `'keydown'` event for the dock panel.\n */\n private _evtKeyDown(event: KeyboardEvent): void {\n // Stop input events during drag.\n event.preventDefault();\n event.stopPropagation();\n\n // Release the mouse if `Escape` is pressed.\n if (event.keyCode === 27) {\n // Finalize the mouse release.\n this._releaseMouse();\n\n // Schedule an emit of the layout modified signal.\n MessageLoop.postMessage(this, Private.LayoutModified);\n }\n }\n\n /**\n * Handle the `'pointerdown'` event for the dock panel.\n */\n private _evtPointerDown(event: PointerEvent): void {\n // Do nothing if the left mouse button is not pressed.\n if (event.button !== 0) {\n return;\n }\n\n // Find the handle which contains the mouse target, if any.\n let layout = this.layout as DockLayout;\n let target = event.target as HTMLElement;\n let handle = find(layout.handles(), handle => handle.contains(target));\n if (!handle) {\n return;\n }\n\n // Stop the event when a handle is pressed.\n event.preventDefault();\n event.stopPropagation();\n\n // Add the extra document listeners.\n this._document.addEventListener('keydown', this, true);\n this._document.addEventListener('pointerup', this, true);\n this._document.addEventListener('pointermove', this, true);\n this._document.addEventListener('contextmenu', this, true);\n\n // Compute the offset deltas for the handle press.\n let rect = handle.getBoundingClientRect();\n let deltaX = event.clientX - rect.left;\n let deltaY = event.clientY - rect.top;\n\n // Override the cursor and store the press data.\n let style = window.getComputedStyle(handle);\n let override = Drag.overrideCursor(style.cursor!, this._document);\n this._pressData = { handle, deltaX, deltaY, override };\n }\n\n /**\n * Handle the `'pointermove'` event for the dock panel.\n */\n private _evtPointerMove(event: PointerEvent): void {\n // Bail early if no drag is in progress.\n if (!this._pressData) {\n return;\n }\n\n // Stop the event when dragging a handle.\n event.preventDefault();\n event.stopPropagation();\n\n // Compute the desired offset position for the handle.\n let rect = this.node.getBoundingClientRect();\n let xPos = event.clientX - rect.left - this._pressData.deltaX;\n let yPos = event.clientY - rect.top - this._pressData.deltaY;\n\n // Set the handle as close to the desired position as possible.\n let layout = this.layout as DockLayout;\n layout.moveHandle(this._pressData.handle, xPos, yPos);\n }\n\n /**\n * Handle the `'pointerup'` event for the dock panel.\n */\n private _evtPointerUp(event: PointerEvent): void {\n // Do nothing if the left mouse button is not released.\n if (event.button !== 0) {\n return;\n }\n\n // Stop the event when releasing a handle.\n event.preventDefault();\n event.stopPropagation();\n\n // Finalize the mouse release.\n this._releaseMouse();\n\n // Schedule an emit of the layout modified signal.\n MessageLoop.postMessage(this, Private.LayoutModified);\n }\n\n /**\n * Release the mouse grab for the dock panel.\n */\n private _releaseMouse(): void {\n // Bail early if no drag is in progress.\n if (!this._pressData) {\n return;\n }\n\n // Clear the override cursor.\n this._pressData.override.dispose();\n this._pressData = null;\n\n // Remove the extra document listeners.\n this._document.removeEventListener('keydown', this, true);\n this._document.removeEventListener('pointerup', this, true);\n this._document.removeEventListener('pointermove', this, true);\n this._document.removeEventListener('contextmenu', this, true);\n }\n\n /**\n * Show the overlay indicator at the given client position.\n *\n * Returns the drop zone at the specified client position.\n *\n * #### Notes\n * If the position is not over a valid zone, the overlay is hidden.\n */\n private _showOverlay(clientX: number, clientY: number): Private.DropZone {\n // Find the dock target for the given client position.\n let { zone, target } = Private.findDropTarget(\n this,\n clientX,\n clientY,\n this._edges\n );\n\n // If the drop zone is invalid, hide the overlay and bail.\n if (zone === 'invalid') {\n this.overlay.hide(100);\n return zone;\n }\n\n // Setup the variables needed to compute the overlay geometry.\n let top: number;\n let left: number;\n let right: number;\n let bottom: number;\n let box = ElementExt.boxSizing(this.node); // TODO cache this?\n let rect = this.node.getBoundingClientRect();\n\n // Compute the overlay geometry based on the dock zone.\n switch (zone) {\n case 'root-all':\n top = box.paddingTop;\n left = box.paddingLeft;\n right = box.paddingRight;\n bottom = box.paddingBottom;\n break;\n case 'root-top':\n top = box.paddingTop;\n left = box.paddingLeft;\n right = box.paddingRight;\n bottom = rect.height * Private.GOLDEN_RATIO;\n break;\n case 'root-left':\n top = box.paddingTop;\n left = box.paddingLeft;\n right = rect.width * Private.GOLDEN_RATIO;\n bottom = box.paddingBottom;\n break;\n case 'root-right':\n top = box.paddingTop;\n left = rect.width * Private.GOLDEN_RATIO;\n right = box.paddingRight;\n bottom = box.paddingBottom;\n break;\n case 'root-bottom':\n top = rect.height * Private.GOLDEN_RATIO;\n left = box.paddingLeft;\n right = box.paddingRight;\n bottom = box.paddingBottom;\n break;\n case 'widget-all':\n top = target!.top;\n left = target!.left;\n right = target!.right;\n bottom = target!.bottom;\n break;\n case 'widget-top':\n top = target!.top;\n left = target!.left;\n right = target!.right;\n bottom = target!.bottom + target!.height / 2;\n break;\n case 'widget-left':\n top = target!.top;\n left = target!.left;\n right = target!.right + target!.width / 2;\n bottom = target!.bottom;\n break;\n case 'widget-right':\n top = target!.top;\n left = target!.left + target!.width / 2;\n right = target!.right;\n bottom = target!.bottom;\n break;\n case 'widget-bottom':\n top = target!.top + target!.height / 2;\n left = target!.left;\n right = target!.right;\n bottom = target!.bottom;\n break;\n case 'widget-tab': {\n const tabHeight = target!.tabBar.node.getBoundingClientRect().height;\n top = target!.top;\n left = target!.left;\n right = target!.right;\n bottom = target!.bottom + target!.height - tabHeight;\n break;\n }\n default:\n throw 'unreachable';\n }\n\n // Show the overlay with the computed geometry.\n this.overlay.show({ top, left, right, bottom });\n\n // Finally, return the computed drop zone.\n return zone;\n }\n\n /**\n * Create a new tab bar for use by the panel.\n */\n private _createTabBar(): TabBar {\n // Create the tab bar.\n let tabBar = this._renderer.createTabBar(this._document);\n\n // Set the generated tab bar property for the tab bar.\n Private.isGeneratedTabBarProperty.set(tabBar, true);\n\n // Hide the tab bar when in single document mode.\n if (this._mode === 'single-document') {\n tabBar.hide();\n }\n\n // Enforce necessary tab bar behavior.\n // TODO do we really want to enforce *all* of these?\n tabBar.tabsMovable = this._tabsMovable;\n tabBar.allowDeselect = false;\n tabBar.addButtonEnabled = this._addButtonEnabled;\n tabBar.removeBehavior = 'select-previous-tab';\n tabBar.insertBehavior = 'select-tab-if-needed';\n\n // Connect the signal handlers for the tab bar.\n tabBar.tabMoved.connect(this._onTabMoved, this);\n tabBar.currentChanged.connect(this._onCurrentChanged, this);\n tabBar.tabCloseRequested.connect(this._onTabCloseRequested, this);\n tabBar.tabDetachRequested.connect(this._onTabDetachRequested, this);\n tabBar.tabActivateRequested.connect(this._onTabActivateRequested, this);\n tabBar.addRequested.connect(this._onTabAddRequested, this);\n\n // Return the initialized tab bar.\n return tabBar;\n }\n\n /**\n * Create a new handle for use by the panel.\n */\n private _createHandle(): HTMLDivElement {\n return this._renderer.createHandle();\n }\n\n /**\n * Handle the `tabMoved` signal from a tab bar.\n */\n private _onTabMoved(): void {\n MessageLoop.postMessage(this, Private.LayoutModified);\n }\n\n /**\n * Handle the `currentChanged` signal from a tab bar.\n */\n private _onCurrentChanged(\n sender: TabBar,\n args: TabBar.ICurrentChangedArgs\n ): void {\n // Extract the previous and current title from the args.\n let { previousTitle, currentTitle } = args;\n\n // Hide the previous widget.\n if (previousTitle) {\n previousTitle.owner.hide();\n }\n\n // Show the current widget.\n if (currentTitle) {\n currentTitle.owner.show();\n }\n\n // Flush the message loop on IE and Edge to prevent flicker.\n if (Platform.IS_EDGE || Platform.IS_IE) {\n MessageLoop.flush();\n }\n\n // Schedule an emit of the layout modified signal.\n MessageLoop.postMessage(this, Private.LayoutModified);\n }\n\n /**\n * Handle the `addRequested` signal from a tab bar.\n */\n private _onTabAddRequested(sender: TabBar): void {\n this._addRequested.emit(sender);\n }\n\n /**\n * Handle the `tabActivateRequested` signal from a tab bar.\n */\n private _onTabActivateRequested(\n sender: TabBar,\n args: TabBar.ITabActivateRequestedArgs\n ): void {\n args.title.owner.activate();\n }\n\n /**\n * Handle the `tabCloseRequested` signal from a tab bar.\n */\n private _onTabCloseRequested(\n sender: TabBar,\n args: TabBar.ITabCloseRequestedArgs\n ): void {\n args.title.owner.close();\n }\n\n /**\n * Handle the `tabDetachRequested` signal from a tab bar.\n */\n private _onTabDetachRequested(\n sender: TabBar,\n args: TabBar.ITabDetachRequestedArgs\n ): void {\n // Do nothing if a drag is already in progress.\n if (this._drag) {\n return;\n }\n\n // Release the tab bar's hold on the mouse.\n sender.releaseMouse();\n\n // Extract the data from the args.\n let { title, tab, clientX, clientY, offset } = args;\n\n // Setup the mime data for the drag operation.\n let mimeData = new MimeData();\n let factory = () => title.owner;\n mimeData.setData('application/vnd.lumino.widget-factory', factory);\n\n // Create the drag image for the drag operation.\n let dragImage = tab.cloneNode(true) as HTMLElement;\n if (offset) {\n dragImage.style.top = `-${offset.y}px`;\n dragImage.style.left = `-${offset.x}px`;\n }\n\n // Create the drag object to manage the drag-drop operation.\n this._drag = new Drag({\n document: this._document,\n mimeData,\n dragImage,\n proposedAction: 'move',\n supportedActions: 'move',\n source: this\n });\n\n // Hide the tab node in the original tab.\n tab.classList.add('lm-mod-hidden');\n let cleanup = () => {\n this._drag = null;\n tab.classList.remove('lm-mod-hidden');\n };\n\n // Start the drag operation and cleanup when done.\n this._drag.start(clientX, clientY).then(cleanup);\n }\n\n private _edges: DockPanel.IEdges;\n private _document: Document | ShadowRoot;\n private _mode: DockPanel.Mode;\n private _drag: Drag | null = null;\n private _renderer: DockPanel.IRenderer;\n private _tabsMovable: boolean = true;\n private _tabsConstrained: boolean = false;\n private _addButtonEnabled: boolean = false;\n private _pressData: Private.IPressData | null = null;\n private _layoutModified = new Signal(this);\n\n private _addRequested = new Signal>(this);\n}\n\n/**\n * The namespace for the `DockPanel` class statics.\n */\nexport namespace DockPanel {\n /**\n * An options object for creating a dock panel.\n */\n export interface IOptions {\n /**\n * The document to use with the dock panel.\n *\n * The default is the global `document` instance.\n */\n\n document?: Document | ShadowRoot;\n /**\n * The overlay to use with the dock panel.\n *\n * The default is a new `Overlay` instance.\n */\n overlay?: IOverlay;\n\n /**\n * The renderer to use for the dock panel.\n *\n * The default is a shared renderer instance.\n */\n renderer?: IRenderer;\n\n /**\n * The spacing between the items in the panel.\n *\n * The default is `4`.\n */\n spacing?: number;\n\n /**\n * The mode for the dock panel.\n *\n * The default is `'multiple-document'`.\n */\n mode?: DockPanel.Mode;\n\n /**\n * The sizes of the edge drop zones, in pixels.\n * If not given, default values will be used.\n */\n edges?: IEdges;\n\n /**\n * The method for hiding widgets.\n *\n * The default is `Widget.HiddenMode.Display`.\n */\n hiddenMode?: Widget.HiddenMode;\n\n /**\n * Allow tabs to be draggable / movable by user.\n *\n * The default is `'true'`.\n */\n tabsMovable?: boolean;\n\n /**\n * Constrain tabs to this dock panel\n *\n * The default is `'false'`.\n */\n tabsConstrained?: boolean;\n\n /**\n * Enable add buttons in each of the dock panel's tab bars.\n *\n * The default is `'false'`.\n */\n addButtonEnabled?: boolean;\n }\n\n /**\n * The sizes of the edge drop zones, in pixels.\n */\n export interface IEdges {\n /**\n * The size of the top edge drop zone.\n */\n top: number;\n\n /**\n * The size of the right edge drop zone.\n */\n right: number;\n\n /**\n * The size of the bottom edge drop zone.\n */\n bottom: number;\n\n /**\n * The size of the left edge drop zone.\n */\n left: number;\n }\n\n /**\n * A type alias for the supported dock panel modes.\n */\n export type Mode =\n | /**\n * The single document mode.\n *\n * In this mode, only a single widget is visible at a time, and that\n * widget fills the available layout space. No tab bars are visible.\n */\n 'single-document'\n\n /**\n * The multiple document mode.\n *\n * In this mode, multiple documents are displayed in separate tab\n * areas, and those areas can be individually resized by the user.\n */\n | 'multiple-document';\n\n /**\n * A type alias for a layout configuration object.\n */\n export type ILayoutConfig = DockLayout.ILayoutConfig;\n\n /**\n * A type alias for the supported insertion modes.\n */\n export type InsertMode = DockLayout.InsertMode;\n\n /**\n * A type alias for the add widget options.\n */\n export type IAddOptions = DockLayout.IAddOptions;\n\n /**\n * An object which holds the geometry for overlay positioning.\n */\n export interface IOverlayGeometry {\n /**\n * The distance between the overlay and parent top edges.\n */\n top: number;\n\n /**\n * The distance between the overlay and parent left edges.\n */\n left: number;\n\n /**\n * The distance between the overlay and parent right edges.\n */\n right: number;\n\n /**\n * The distance between the overlay and parent bottom edges.\n */\n bottom: number;\n }\n\n /**\n * An object which manages the overlay node for a dock panel.\n */\n export interface IOverlay {\n /**\n * The DOM node for the overlay.\n */\n readonly node: HTMLDivElement;\n\n /**\n * Show the overlay using the given overlay geometry.\n *\n * @param geo - The desired geometry for the overlay.\n *\n * #### Notes\n * The given geometry values assume the node will use absolute\n * positioning.\n *\n * This is called on every mouse move event during a drag in order\n * to update the position of the overlay. It should be efficient.\n */\n show(geo: IOverlayGeometry): void;\n\n /**\n * Hide the overlay node.\n *\n * @param delay - The delay (in ms) before hiding the overlay.\n * A delay value <= 0 should hide the overlay immediately.\n *\n * #### Notes\n * This is called whenever the overlay node should been hidden.\n */\n hide(delay: number): void;\n }\n\n /**\n * A concrete implementation of `IOverlay`.\n *\n * This is the default overlay implementation for a dock panel.\n */\n export class Overlay implements IOverlay {\n /**\n * Construct a new overlay.\n */\n constructor() {\n this.node = document.createElement('div');\n this.node.classList.add('lm-DockPanel-overlay');\n this.node.classList.add('lm-mod-hidden');\n this.node.style.position = 'absolute';\n this.node.style.contain = 'strict';\n }\n\n /**\n * The DOM node for the overlay.\n */\n readonly node: HTMLDivElement;\n\n /**\n * Show the overlay using the given overlay geometry.\n *\n * @param geo - The desired geometry for the overlay.\n */\n show(geo: IOverlayGeometry): void {\n // Update the position of the overlay.\n let style = this.node.style;\n style.top = `${geo.top}px`;\n style.left = `${geo.left}px`;\n style.right = `${geo.right}px`;\n style.bottom = `${geo.bottom}px`;\n\n // Clear any pending hide timer.\n clearTimeout(this._timer);\n this._timer = -1;\n\n // If the overlay is already visible, we're done.\n if (!this._hidden) {\n return;\n }\n\n // Clear the hidden flag.\n this._hidden = false;\n\n // Finally, show the overlay.\n this.node.classList.remove('lm-mod-hidden');\n }\n\n /**\n * Hide the overlay node.\n *\n * @param delay - The delay (in ms) before hiding the overlay.\n * A delay value <= 0 will hide the overlay immediately.\n */\n hide(delay: number): void {\n // Do nothing if the overlay is already hidden.\n if (this._hidden) {\n return;\n }\n\n // Hide immediately if the delay is <= 0.\n if (delay <= 0) {\n clearTimeout(this._timer);\n this._timer = -1;\n this._hidden = true;\n this.node.classList.add('lm-mod-hidden');\n return;\n }\n\n // Do nothing if a hide is already pending.\n if (this._timer !== -1) {\n return;\n }\n\n // Otherwise setup the hide timer.\n this._timer = window.setTimeout(() => {\n this._timer = -1;\n this._hidden = true;\n this.node.classList.add('lm-mod-hidden');\n }, delay);\n }\n\n private _timer = -1;\n private _hidden = true;\n }\n\n /**\n * A type alias for a dock panel renderer;\n */\n export type IRenderer = DockLayout.IRenderer;\n\n /**\n * The default implementation of `IRenderer`.\n */\n export class Renderer implements IRenderer {\n /**\n * Create a new tab bar for use with a dock panel.\n *\n * @returns A new tab bar for a dock panel.\n */\n createTabBar(document?: Document | ShadowRoot): TabBar {\n let bar = new TabBar({ document });\n bar.addClass('lm-DockPanel-tabBar');\n return bar;\n }\n\n /**\n * Create a new handle node for use with a dock panel.\n *\n * @returns A new handle node for a dock panel.\n */\n createHandle(): HTMLDivElement {\n let handle = document.createElement('div');\n handle.className = 'lm-DockPanel-handle';\n return handle;\n }\n }\n\n /**\n * The default `Renderer` instance.\n */\n export const defaultRenderer = new Renderer();\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * A fraction used for sizing root panels; ~= `1 / golden_ratio`.\n */\n export const GOLDEN_RATIO = 0.618;\n\n /**\n * The default sizes for the edge drop zones, in pixels.\n */\n export const DEFAULT_EDGES = {\n /**\n * The size of the top edge dock zone for the root panel, in pixels.\n * This is different from the others to distinguish between the top\n * tab bar and the top root zone.\n */\n top: 12,\n\n /**\n * The size of the edge dock zone for the root panel, in pixels.\n */\n right: 40,\n\n /**\n * The size of the edge dock zone for the root panel, in pixels.\n */\n bottom: 40,\n\n /**\n * The size of the edge dock zone for the root panel, in pixels.\n */\n left: 40\n };\n\n /**\n * A singleton `'layout-modified'` conflatable message.\n */\n export const LayoutModified = new ConflatableMessage('layout-modified');\n\n /**\n * An object which holds mouse press data.\n */\n export interface IPressData {\n /**\n * The handle which was pressed.\n */\n handle: HTMLDivElement;\n\n /**\n * The X offset of the press in handle coordinates.\n */\n deltaX: number;\n\n /**\n * The Y offset of the press in handle coordinates.\n */\n deltaY: number;\n\n /**\n * The disposable which will clear the override cursor.\n */\n override: IDisposable;\n }\n\n /**\n * A type alias for a drop zone.\n */\n export type DropZone =\n | /**\n * An invalid drop zone.\n */\n 'invalid'\n\n /**\n * The entirety of the root dock area.\n */\n | 'root-all'\n\n /**\n * The top portion of the root dock area.\n */\n | 'root-top'\n\n /**\n * The left portion of the root dock area.\n */\n | 'root-left'\n\n /**\n * The right portion of the root dock area.\n */\n | 'root-right'\n\n /**\n * The bottom portion of the root dock area.\n */\n | 'root-bottom'\n\n /**\n * The entirety of a tabbed widget area.\n */\n | 'widget-all'\n\n /**\n * The top portion of tabbed widget area.\n */\n | 'widget-top'\n\n /**\n * The left portion of tabbed widget area.\n */\n | 'widget-left'\n\n /**\n * The right portion of tabbed widget area.\n */\n | 'widget-right'\n\n /**\n * The bottom portion of tabbed widget area.\n */\n | 'widget-bottom'\n\n /**\n * The the bar of a tabbed widget area.\n */\n | 'widget-tab';\n\n /**\n * An object which holds the drop target zone and widget.\n */\n export interface IDropTarget {\n /**\n * The semantic zone for the mouse position.\n */\n zone: DropZone;\n\n /**\n * The tab area geometry for the drop zone, or `null`.\n */\n target: DockLayout.ITabAreaGeometry | null;\n }\n\n /**\n * An attached property used to track generated tab bars.\n */\n export const isGeneratedTabBarProperty = new AttachedProperty<\n Widget,\n boolean\n >({\n name: 'isGeneratedTabBar',\n create: () => false\n });\n\n /**\n * Create a single document config for the widgets in a dock panel.\n */\n export function createSingleDocumentConfig(\n panel: DockPanel\n ): DockPanel.ILayoutConfig {\n // Return an empty config if the panel is empty.\n if (panel.isEmpty) {\n return { main: null };\n }\n\n // Get a flat array of the widgets in the panel.\n let widgets = Array.from(panel.widgets());\n\n // Get the first selected widget in the panel.\n let selected = panel.selectedWidgets().next().value;\n\n // Compute the current index for the new config.\n let currentIndex = selected ? widgets.indexOf(selected) : -1;\n\n // Return the single document config.\n return { main: { type: 'tab-area', widgets, currentIndex } };\n }\n\n /**\n * Find the drop target at the given client position.\n */\n export function findDropTarget(\n panel: DockPanel,\n clientX: number,\n clientY: number,\n edges: DockPanel.IEdges\n ): IDropTarget {\n // Bail if the mouse is not over the dock panel.\n if (!ElementExt.hitTest(panel.node, clientX, clientY)) {\n return { zone: 'invalid', target: null };\n }\n\n // Look up the layout for the panel.\n let layout = panel.layout as DockLayout;\n\n // If the layout is empty, indicate the entire root drop zone.\n if (layout.isEmpty) {\n return { zone: 'root-all', target: null };\n }\n\n // Test the edge zones when in multiple document mode.\n if (panel.mode === 'multiple-document') {\n // Get the client rect for the dock panel.\n let panelRect = panel.node.getBoundingClientRect();\n\n // Compute the distance to each edge of the panel.\n let pl = clientX - panelRect.left + 1;\n let pt = clientY - panelRect.top + 1;\n let pr = panelRect.right - clientX;\n let pb = panelRect.bottom - clientY;\n\n // Find the minimum distance to an edge.\n let pd = Math.min(pt, pr, pb, pl);\n\n // Return a root zone if the mouse is within an edge.\n switch (pd) {\n case pt:\n if (pt < edges.top) {\n return { zone: 'root-top', target: null };\n }\n break;\n case pr:\n if (pr < edges.right) {\n return { zone: 'root-right', target: null };\n }\n break;\n case pb:\n if (pb < edges.bottom) {\n return { zone: 'root-bottom', target: null };\n }\n break;\n case pl:\n if (pl < edges.left) {\n return { zone: 'root-left', target: null };\n }\n break;\n default:\n throw 'unreachable';\n }\n }\n\n // Hit test the dock layout at the given client position.\n let target = layout.hitTestTabAreas(clientX, clientY);\n\n // Bail if no target area was found.\n if (!target) {\n return { zone: 'invalid', target: null };\n }\n\n // Return the whole tab area when in single document mode.\n if (panel.mode === 'single-document') {\n return { zone: 'widget-all', target };\n }\n\n // Compute the distance to each edge of the tab area.\n let al = target.x - target.left + 1;\n let at = target.y - target.top + 1;\n let ar = target.left + target.width - target.x;\n let ab = target.top + target.height - target.y;\n\n const tabHeight = target.tabBar.node.getBoundingClientRect().height;\n if (at < tabHeight) {\n return { zone: 'widget-tab', target };\n }\n\n // Get the X and Y edge sizes for the area.\n let rx = Math.round(target.width / 3);\n let ry = Math.round(target.height / 3);\n\n // If the mouse is not within an edge, indicate the entire area.\n if (al > rx && ar > rx && at > ry && ab > ry) {\n return { zone: 'widget-all', target };\n }\n\n // Scale the distances by the slenderness ratio.\n al /= rx;\n at /= ry;\n ar /= rx;\n ab /= ry;\n\n // Find the minimum distance to the area edge.\n let ad = Math.min(al, at, ar, ab);\n\n // Find the widget zone for the area edge.\n let zone: DropZone;\n switch (ad) {\n case al:\n zone = 'widget-left';\n break;\n case at:\n zone = 'widget-top';\n break;\n case ar:\n zone = 'widget-right';\n break;\n case ab:\n zone = 'widget-bottom';\n break;\n default:\n throw 'unreachable';\n }\n\n // Return the final drop target.\n return { zone, target };\n }\n\n /**\n * Get the drop reference widget for a tab bar.\n */\n export function getDropRef(tabBar: TabBar): Widget | null {\n if (tabBar.titles.length === 0) {\n return null;\n }\n if (tabBar.currentTitle) {\n return tabBar.currentTitle.owner;\n }\n return tabBar.titles[tabBar.titles.length - 1].owner;\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { AttachedProperty } from '@lumino/properties';\n\nimport { BoxEngine, BoxSizer } from './boxengine';\n\nimport { Layout, LayoutItem } from './layout';\n\nimport { Widget } from './widget';\n\n/**\n * A layout which arranges its widgets in a grid.\n */\nexport class GridLayout extends Layout {\n /**\n * Construct a new grid layout.\n *\n * @param options - The options for initializing the layout.\n */\n constructor(options: GridLayout.IOptions = {}) {\n super(options);\n if (options.rowCount !== undefined) {\n Private.reallocSizers(this._rowSizers, options.rowCount);\n }\n if (options.columnCount !== undefined) {\n Private.reallocSizers(this._columnSizers, options.columnCount);\n }\n if (options.rowSpacing !== undefined) {\n this._rowSpacing = Private.clampValue(options.rowSpacing);\n }\n if (options.columnSpacing !== undefined) {\n this._columnSpacing = Private.clampValue(options.columnSpacing);\n }\n }\n\n /**\n * Dispose of the resources held by the layout.\n */\n dispose(): void {\n // Dispose of the widgets and layout items.\n for (const item of this._items) {\n let widget = item.widget;\n item.dispose();\n widget.dispose();\n }\n\n // Clear the layout state.\n this._box = null;\n this._items.length = 0;\n this._rowStarts.length = 0;\n this._rowSizers.length = 0;\n this._columnStarts.length = 0;\n this._columnSizers.length = 0;\n\n // Dispose of the rest of the layout.\n super.dispose();\n }\n\n /**\n * Get the number of rows in the layout.\n */\n get rowCount(): number {\n return this._rowSizers.length;\n }\n\n /**\n * Set the number of rows in the layout.\n *\n * #### Notes\n * The minimum row count is `1`.\n */\n set rowCount(value: number) {\n // Do nothing if the row count does not change.\n if (value === this.rowCount) {\n return;\n }\n\n // Reallocate the row sizers.\n Private.reallocSizers(this._rowSizers, value);\n\n // Schedule a fit of the parent.\n if (this.parent) {\n this.parent.fit();\n }\n }\n\n /**\n * Get the number of columns in the layout.\n */\n get columnCount(): number {\n return this._columnSizers.length;\n }\n\n /**\n * Set the number of columns in the layout.\n *\n * #### Notes\n * The minimum column count is `1`.\n */\n set columnCount(value: number) {\n // Do nothing if the column count does not change.\n if (value === this.columnCount) {\n return;\n }\n\n // Reallocate the column sizers.\n Private.reallocSizers(this._columnSizers, value);\n\n // Schedule a fit of the parent.\n if (this.parent) {\n this.parent.fit();\n }\n }\n\n /**\n * Get the row spacing for the layout.\n */\n get rowSpacing(): number {\n return this._rowSpacing;\n }\n\n /**\n * Set the row spacing for the layout.\n */\n set rowSpacing(value: number) {\n // Clamp the spacing to the allowed range.\n value = Private.clampValue(value);\n\n // Bail if the spacing does not change\n if (this._rowSpacing === value) {\n return;\n }\n\n // Update the internal spacing.\n this._rowSpacing = value;\n\n // Schedule a fit of the parent.\n if (this.parent) {\n this.parent.fit();\n }\n }\n\n /**\n * Get the column spacing for the layout.\n */\n get columnSpacing(): number {\n return this._columnSpacing;\n }\n\n /**\n * Set the col spacing for the layout.\n */\n set columnSpacing(value: number) {\n // Clamp the spacing to the allowed range.\n value = Private.clampValue(value);\n\n // Bail if the spacing does not change\n if (this._columnSpacing === value) {\n return;\n }\n\n // Update the internal spacing.\n this._columnSpacing = value;\n\n // Schedule a fit of the parent.\n if (this.parent) {\n this.parent.fit();\n }\n }\n\n /**\n * Get the stretch factor for a specific row.\n *\n * @param index - The row index of interest.\n *\n * @returns The stretch factor for the row.\n *\n * #### Notes\n * This returns `-1` if the index is out of range.\n */\n rowStretch(index: number): number {\n let sizer = this._rowSizers[index];\n return sizer ? sizer.stretch : -1;\n }\n\n /**\n * Set the stretch factor for a specific row.\n *\n * @param index - The row index of interest.\n *\n * @param value - The stretch factor for the row.\n *\n * #### Notes\n * This is a no-op if the index is out of range.\n */\n setRowStretch(index: number, value: number): void {\n // Look up the row sizer.\n let sizer = this._rowSizers[index];\n\n // Bail if the index is out of range.\n if (!sizer) {\n return;\n }\n\n // Clamp the value to the allowed range.\n value = Private.clampValue(value);\n\n // Bail if the stretch does not change.\n if (sizer.stretch === value) {\n return;\n }\n\n // Update the sizer stretch.\n sizer.stretch = value;\n\n // Schedule an update of the parent.\n if (this.parent) {\n this.parent.update();\n }\n }\n\n /**\n * Get the stretch factor for a specific column.\n *\n * @param index - The column index of interest.\n *\n * @returns The stretch factor for the column.\n *\n * #### Notes\n * This returns `-1` if the index is out of range.\n */\n columnStretch(index: number): number {\n let sizer = this._columnSizers[index];\n return sizer ? sizer.stretch : -1;\n }\n\n /**\n * Set the stretch factor for a specific column.\n *\n * @param index - The column index of interest.\n *\n * @param value - The stretch factor for the column.\n *\n * #### Notes\n * This is a no-op if the index is out of range.\n */\n setColumnStretch(index: number, value: number): void {\n // Look up the column sizer.\n let sizer = this._columnSizers[index];\n\n // Bail if the index is out of range.\n if (!sizer) {\n return;\n }\n\n // Clamp the value to the allowed range.\n value = Private.clampValue(value);\n\n // Bail if the stretch does not change.\n if (sizer.stretch === value) {\n return;\n }\n\n // Update the sizer stretch.\n sizer.stretch = value;\n\n // Schedule an update of the parent.\n if (this.parent) {\n this.parent.update();\n }\n }\n\n /**\n * Create an iterator over the widgets in the layout.\n *\n * @returns A new iterator over the widgets in the layout.\n */\n *[Symbol.iterator](): IterableIterator {\n for (const item of this._items) {\n yield item.widget;\n }\n }\n\n /**\n * Add a widget to the grid layout.\n *\n * @param widget - The widget to add to the layout.\n *\n * #### Notes\n * If the widget is already contained in the layout, this is no-op.\n */\n addWidget(widget: Widget): void {\n // Look up the index for the widget.\n let i = ArrayExt.findFirstIndex(this._items, it => it.widget === widget);\n\n // Bail if the widget is already in the layout.\n if (i !== -1) {\n return;\n }\n\n // Add the widget to the layout.\n this._items.push(new LayoutItem(widget));\n\n // Attach the widget to the parent.\n if (this.parent) {\n this.attachWidget(widget);\n }\n }\n\n /**\n * Remove a widget from the grid layout.\n *\n * @param widget - The widget to remove from the layout.\n *\n * #### Notes\n * A widget is automatically removed from the layout when its `parent`\n * is set to `null`. This method should only be invoked directly when\n * removing a widget from a layout which has yet to be installed on a\n * parent widget.\n *\n * This method does *not* modify the widget's `parent`.\n */\n removeWidget(widget: Widget): void {\n // Look up the index for the widget.\n let i = ArrayExt.findFirstIndex(this._items, it => it.widget === widget);\n\n // Bail if the widget is not in the layout.\n if (i === -1) {\n return;\n }\n\n // Remove the widget from the layout.\n let item = ArrayExt.removeAt(this._items, i)!;\n\n // Detach the widget from the parent.\n if (this.parent) {\n this.detachWidget(widget);\n }\n\n // Dispose the layout item.\n item.dispose();\n }\n\n /**\n * Perform layout initialization which requires the parent widget.\n */\n protected init(): void {\n super.init();\n for (const widget of this) {\n this.attachWidget(widget);\n }\n }\n\n /**\n * Attach a widget to the parent's DOM node.\n *\n * @param widget - The widget to attach to the parent.\n */\n protected attachWidget(widget: Widget): void {\n // Send a `'before-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n }\n\n // Add the widget's node to the parent.\n this.parent!.node.appendChild(widget.node);\n\n // Send an `'after-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n\n // Post a fit request for the parent widget.\n this.parent!.fit();\n }\n\n /**\n * Detach a widget from the parent's DOM node.\n *\n * @param widget - The widget to detach from the parent.\n */\n protected detachWidget(widget: Widget): void {\n // Send a `'before-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n }\n\n // Remove the widget's node from the parent.\n this.parent!.node.removeChild(widget.node);\n\n // Send an `'after-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n\n // Post a fit request for the parent widget.\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'before-show'` message.\n */\n protected onBeforeShow(msg: Message): void {\n super.onBeforeShow(msg);\n this.parent!.update();\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n super.onBeforeAttach(msg);\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-shown'` message.\n */\n protected onChildShown(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-hidden'` message.\n */\n protected onChildHidden(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'resize'` message.\n */\n protected onResize(msg: Widget.ResizeMessage): void {\n if (this.parent!.isVisible) {\n this._update(msg.width, msg.height);\n }\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n protected onUpdateRequest(msg: Message): void {\n if (this.parent!.isVisible) {\n this._update(-1, -1);\n }\n }\n\n /**\n * A message handler invoked on a `'fit-request'` message.\n */\n protected onFitRequest(msg: Message): void {\n if (this.parent!.isAttached) {\n this._fit();\n }\n }\n\n /**\n * Fit the layout to the total size required by the widgets.\n */\n private _fit(): void {\n // Reset the min sizes of the sizers.\n for (let i = 0, n = this.rowCount; i < n; ++i) {\n this._rowSizers[i].minSize = 0;\n }\n for (let i = 0, n = this.columnCount; i < n; ++i) {\n this._columnSizers[i].minSize = 0;\n }\n\n // Filter for the visible layout items.\n let items = this._items.filter(it => !it.isHidden);\n\n // Fit the layout items.\n for (let i = 0, n = items.length; i < n; ++i) {\n items[i].fit();\n }\n\n // Get the max row and column index.\n let maxRow = this.rowCount - 1;\n let maxCol = this.columnCount - 1;\n\n // Sort the items by row span.\n items.sort(Private.rowSpanCmp);\n\n // Update the min sizes of the row sizers.\n for (let i = 0, n = items.length; i < n; ++i) {\n // Fetch the item.\n let item = items[i];\n\n // Get the row bounds for the item.\n let config = GridLayout.getCellConfig(item.widget);\n let r1 = Math.min(config.row, maxRow);\n let r2 = Math.min(config.row + config.rowSpan - 1, maxRow);\n\n // Distribute the minimum height to the sizers as needed.\n Private.distributeMin(this._rowSizers, r1, r2, item.minHeight);\n }\n\n // Sort the items by column span.\n items.sort(Private.columnSpanCmp);\n\n // Update the min sizes of the column sizers.\n for (let i = 0, n = items.length; i < n; ++i) {\n // Fetch the item.\n let item = items[i];\n\n // Get the column bounds for the item.\n let config = GridLayout.getCellConfig(item.widget);\n let c1 = Math.min(config.column, maxCol);\n let c2 = Math.min(config.column + config.columnSpan - 1, maxCol);\n\n // Distribute the minimum width to the sizers as needed.\n Private.distributeMin(this._columnSizers, c1, c2, item.minWidth);\n }\n\n // If no size constraint is needed, just update the parent.\n if (this.fitPolicy === 'set-no-constraint') {\n MessageLoop.sendMessage(this.parent!, Widget.Msg.UpdateRequest);\n return;\n }\n\n // Set up the computed min size.\n let minH = maxRow * this._rowSpacing;\n let minW = maxCol * this._columnSpacing;\n\n // Add the sizer minimums to the computed min size.\n for (let i = 0, n = this.rowCount; i < n; ++i) {\n minH += this._rowSizers[i].minSize;\n }\n for (let i = 0, n = this.columnCount; i < n; ++i) {\n minW += this._columnSizers[i].minSize;\n }\n\n // Update the box sizing and add it to the computed min size.\n let box = (this._box = ElementExt.boxSizing(this.parent!.node));\n minW += box.horizontalSum;\n minH += box.verticalSum;\n\n // Update the parent's min size constraints.\n let style = this.parent!.node.style;\n style.minWidth = `${minW}px`;\n style.minHeight = `${minH}px`;\n\n // Set the dirty flag to ensure only a single update occurs.\n this._dirty = true;\n\n // Notify the ancestor that it should fit immediately. This may\n // cause a resize of the parent, fulfilling the required update.\n if (this.parent!.parent) {\n MessageLoop.sendMessage(this.parent!.parent!, Widget.Msg.FitRequest);\n }\n\n // If the dirty flag is still set, the parent was not resized.\n // Trigger the required update on the parent widget immediately.\n if (this._dirty) {\n MessageLoop.sendMessage(this.parent!, Widget.Msg.UpdateRequest);\n }\n }\n\n /**\n * Update the layout position and size of the widgets.\n *\n * The parent offset dimensions should be `-1` if unknown.\n */\n private _update(offsetWidth: number, offsetHeight: number): void {\n // Clear the dirty flag to indicate the update occurred.\n this._dirty = false;\n\n // Measure the parent if the offset dimensions are unknown.\n if (offsetWidth < 0) {\n offsetWidth = this.parent!.node.offsetWidth;\n }\n if (offsetHeight < 0) {\n offsetHeight = this.parent!.node.offsetHeight;\n }\n\n // Ensure the parent box sizing data is computed.\n if (!this._box) {\n this._box = ElementExt.boxSizing(this.parent!.node);\n }\n\n // Compute the layout area adjusted for border and padding.\n let top = this._box.paddingTop;\n let left = this._box.paddingLeft;\n let width = offsetWidth - this._box.horizontalSum;\n let height = offsetHeight - this._box.verticalSum;\n\n // Get the max row and column index.\n let maxRow = this.rowCount - 1;\n let maxCol = this.columnCount - 1;\n\n // Compute the total fixed row and column space.\n let fixedRowSpace = maxRow * this._rowSpacing;\n let fixedColSpace = maxCol * this._columnSpacing;\n\n // Distribute the available space to the box sizers.\n BoxEngine.calc(this._rowSizers, Math.max(0, height - fixedRowSpace));\n BoxEngine.calc(this._columnSizers, Math.max(0, width - fixedColSpace));\n\n // Update the row start positions.\n for (let i = 0, pos = top, n = this.rowCount; i < n; ++i) {\n this._rowStarts[i] = pos;\n pos += this._rowSizers[i].size + this._rowSpacing;\n }\n\n // Update the column start positions.\n for (let i = 0, pos = left, n = this.columnCount; i < n; ++i) {\n this._columnStarts[i] = pos;\n pos += this._columnSizers[i].size + this._columnSpacing;\n }\n\n // Update the geometry of the layout items.\n for (let i = 0, n = this._items.length; i < n; ++i) {\n // Fetch the item.\n let item = this._items[i];\n\n // Ignore hidden items.\n if (item.isHidden) {\n continue;\n }\n\n // Fetch the cell bounds for the widget.\n let config = GridLayout.getCellConfig(item.widget);\n let r1 = Math.min(config.row, maxRow);\n let c1 = Math.min(config.column, maxCol);\n let r2 = Math.min(config.row + config.rowSpan - 1, maxRow);\n let c2 = Math.min(config.column + config.columnSpan - 1, maxCol);\n\n // Compute the cell geometry.\n let x = this._columnStarts[c1];\n let y = this._rowStarts[r1];\n let w = this._columnStarts[c2] + this._columnSizers[c2].size - x;\n let h = this._rowStarts[r2] + this._rowSizers[r2].size - y;\n\n // Update the geometry of the layout item.\n item.update(x, y, w, h);\n }\n }\n\n private _dirty = false;\n private _rowSpacing = 4;\n private _columnSpacing = 4;\n private _items: LayoutItem[] = [];\n private _rowStarts: number[] = [];\n private _columnStarts: number[] = [];\n private _rowSizers: BoxSizer[] = [new BoxSizer()];\n private _columnSizers: BoxSizer[] = [new BoxSizer()];\n private _box: ElementExt.IBoxSizing | null = null;\n}\n\n/**\n * The namespace for the `GridLayout` class statics.\n */\nexport namespace GridLayout {\n /**\n * An options object for initializing a grid layout.\n */\n export interface IOptions extends Layout.IOptions {\n /**\n * The initial row count for the layout.\n *\n * The default is `1`.\n */\n rowCount?: number;\n\n /**\n * The initial column count for the layout.\n *\n * The default is `1`.\n */\n columnCount?: number;\n\n /**\n * The spacing between rows in the layout.\n *\n * The default is `4`.\n */\n rowSpacing?: number;\n\n /**\n * The spacing between columns in the layout.\n *\n * The default is `4`.\n */\n columnSpacing?: number;\n }\n\n /**\n * An object which holds the cell configuration for a widget.\n */\n export interface ICellConfig {\n /**\n * The row index for the widget.\n */\n readonly row: number;\n\n /**\n * The column index for the widget.\n */\n readonly column: number;\n\n /**\n * The row span for the widget.\n */\n readonly rowSpan: number;\n\n /**\n * The column span for the widget.\n */\n readonly columnSpan: number;\n }\n\n /**\n * Get the cell config for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The cell config for the widget.\n */\n export function getCellConfig(widget: Widget): ICellConfig {\n return Private.cellConfigProperty.get(widget);\n }\n\n /**\n * Set the cell config for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the cell config.\n */\n export function setCellConfig(\n widget: Widget,\n value: Partial\n ): void {\n Private.cellConfigProperty.set(widget, Private.normalizeConfig(value));\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * The property descriptor for the widget cell config.\n */\n export const cellConfigProperty = new AttachedProperty<\n Widget,\n GridLayout.ICellConfig\n >({\n name: 'cellConfig',\n create: () => ({ row: 0, column: 0, rowSpan: 1, columnSpan: 1 }),\n changed: onChildCellConfigChanged\n });\n\n /**\n * Normalize a partial cell config object.\n */\n export function normalizeConfig(\n config: Partial\n ): GridLayout.ICellConfig {\n let row = Math.max(0, Math.floor(config.row || 0));\n let column = Math.max(0, Math.floor(config.column || 0));\n let rowSpan = Math.max(1, Math.floor(config.rowSpan || 0));\n let columnSpan = Math.max(1, Math.floor(config.columnSpan || 0));\n return { row, column, rowSpan, columnSpan };\n }\n\n /**\n * Clamp a value to an integer >= 0.\n */\n export function clampValue(value: number): number {\n return Math.max(0, Math.floor(value));\n }\n\n /**\n * A sort comparison function for row spans.\n */\n export function rowSpanCmp(a: LayoutItem, b: LayoutItem): number {\n let c1 = cellConfigProperty.get(a.widget);\n let c2 = cellConfigProperty.get(b.widget);\n return c1.rowSpan - c2.rowSpan;\n }\n\n /**\n * A sort comparison function for column spans.\n */\n export function columnSpanCmp(a: LayoutItem, b: LayoutItem): number {\n let c1 = cellConfigProperty.get(a.widget);\n let c2 = cellConfigProperty.get(b.widget);\n return c1.columnSpan - c2.columnSpan;\n }\n\n /**\n * Reallocate the box sizers for the given grid dimensions.\n */\n export function reallocSizers(sizers: BoxSizer[], count: number): void {\n // Coerce the count to the valid range.\n count = Math.max(1, Math.floor(count));\n\n // Add the missing sizers.\n while (sizers.length < count) {\n sizers.push(new BoxSizer());\n }\n\n // Remove the extra sizers.\n if (sizers.length > count) {\n sizers.length = count;\n }\n }\n\n /**\n * Distribute a min size constraint across a range of sizers.\n */\n export function distributeMin(\n sizers: BoxSizer[],\n i1: number,\n i2: number,\n minSize: number\n ): void {\n // Sanity check the indices.\n if (i2 < i1) {\n return;\n }\n\n // Handle the simple case of no cell span.\n if (i1 === i2) {\n let sizer = sizers[i1];\n sizer.minSize = Math.max(sizer.minSize, minSize);\n return;\n }\n\n // Compute the total current min size of the span.\n let totalMin = 0;\n for (let i = i1; i <= i2; ++i) {\n totalMin += sizers[i].minSize;\n }\n\n // Do nothing if the total is greater than the required.\n if (totalMin >= minSize) {\n return;\n }\n\n // Compute the portion of the space to allocate to each sizer.\n let portion = (minSize - totalMin) / (i2 - i1 + 1);\n\n // Add the portion to each sizer.\n for (let i = i1; i <= i2; ++i) {\n sizers[i].minSize += portion;\n }\n }\n\n /**\n * The change handler for the child cell config property.\n */\n function onChildCellConfigChanged(child: Widget): void {\n if (child.parent && child.parent.layout instanceof GridLayout) {\n child.parent.fit();\n }\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { getKeyboardLayout } from '@lumino/keyboard';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { CommandRegistry } from '@lumino/commands';\n\nimport {\n ElementARIAAttrs,\n ElementDataset,\n h,\n VirtualDOM,\n VirtualElement\n} from '@lumino/virtualdom';\n\nimport { Menu } from './menu';\n\nimport { Title } from './title';\n\nimport { Widget } from './widget';\n\n/**\n * A widget which displays menus as a canonical menu bar.\n *\n * #### Notes\n * See also the related [example](../../examples/menubar/index.html) and\n * its [source](https://github.com/jupyterlab/lumino/tree/main/examples/example-menubar).\n */\nexport class MenuBar extends Widget {\n /**\n * Construct a new menu bar.\n *\n * @param options - The options for initializing the menu bar.\n */\n constructor(options: MenuBar.IOptions = {}) {\n super({ node: Private.createNode() });\n this.addClass('lm-MenuBar');\n this.setFlag(Widget.Flag.DisallowLayout);\n this.renderer = options.renderer || MenuBar.defaultRenderer;\n this._forceItemsPosition = options.forceItemsPosition || {\n forceX: true,\n forceY: true\n };\n this._overflowMenuOptions = options.overflowMenuOptions || {\n isVisible: true\n };\n }\n\n /**\n * Dispose of the resources held by the widget.\n */\n dispose(): void {\n this._closeChildMenu();\n this._menus.length = 0;\n super.dispose();\n }\n\n /**\n * The renderer used by the menu bar.\n */\n readonly renderer: MenuBar.IRenderer;\n\n /**\n * The child menu of the menu bar.\n *\n * #### Notes\n * This will be `null` if the menu bar does not have an open menu.\n */\n get childMenu(): Menu | null {\n return this._childMenu;\n }\n\n /**\n * The overflow index of the menu bar.\n */\n get overflowIndex(): number {\n return this._overflowIndex;\n }\n\n /**\n * The overflow menu of the menu bar.\n */\n get overflowMenu(): Menu | null {\n return this._overflowMenu;\n }\n\n /**\n * Get the menu bar content node.\n *\n * #### Notes\n * This is the node which holds the menu title nodes.\n *\n * Modifying this node directly can lead to undefined behavior.\n */\n get contentNode(): HTMLUListElement {\n return this.node.getElementsByClassName(\n 'lm-MenuBar-content'\n )[0] as HTMLUListElement;\n }\n\n /**\n * Get the currently active menu.\n */\n get activeMenu(): Menu | null {\n return this._menus[this._activeIndex] || null;\n }\n\n /**\n * Set the currently active menu.\n *\n * #### Notes\n * If the menu does not exist, the menu will be set to `null`.\n */\n set activeMenu(value: Menu | null) {\n this.activeIndex = value ? this._menus.indexOf(value) : -1;\n }\n\n /**\n * Get the index of the currently active menu.\n *\n * #### Notes\n * This will be `-1` if no menu is active.\n */\n get activeIndex(): number {\n return this._activeIndex;\n }\n\n /**\n * Set the index of the currently active menu.\n *\n * #### Notes\n * If the menu cannot be activated, the index will be set to `-1`.\n */\n set activeIndex(value: number) {\n // Adjust the value for an out of range index.\n if (value < 0 || value >= this._menus.length) {\n value = -1;\n }\n\n // An empty menu cannot be active\n if (value > -1 && this._menus[value].items.length === 0) {\n value = -1;\n }\n\n // Bail early if the index will not change.\n if (this._activeIndex === value) {\n return;\n }\n\n // Update the active index.\n this._activeIndex = value;\n\n // Schedule an update of the items.\n this.update();\n }\n\n /**\n * A read-only array of the menus in the menu bar.\n */\n get menus(): ReadonlyArray {\n return this._menus;\n }\n\n /**\n * Open the active menu and activate its first menu item.\n *\n * #### Notes\n * If there is no active menu, this is a no-op.\n */\n openActiveMenu(): void {\n // Bail early if there is no active item.\n if (this._activeIndex === -1) {\n return;\n }\n\n // Open the child menu.\n this._openChildMenu();\n\n // Activate the first item in the child menu.\n if (this._childMenu) {\n this._childMenu.activeIndex = -1;\n this._childMenu.activateNextItem();\n }\n }\n\n /**\n * Add a menu to the end of the menu bar.\n *\n * @param menu - The menu to add to the menu bar.\n *\n * #### Notes\n * If the menu is already added to the menu bar, it will be moved.\n */\n addMenu(menu: Menu, update: boolean = true): void {\n this.insertMenu(this._menus.length, menu, update);\n }\n\n /**\n * Insert a menu into the menu bar at the specified index.\n *\n * @param index - The index at which to insert the menu.\n *\n * @param menu - The menu to insert into the menu bar.\n *\n * #### Notes\n * The index will be clamped to the bounds of the menus.\n *\n * If the menu is already added to the menu bar, it will be moved.\n */\n insertMenu(index: number, menu: Menu, update: boolean = true): void {\n // Close the child menu before making changes.\n this._closeChildMenu();\n\n // Look up the index of the menu.\n let i = this._menus.indexOf(menu);\n\n // Clamp the insert index to the array bounds.\n let j = Math.max(0, Math.min(index, this._menus.length));\n\n // If the menu is not in the array, insert it.\n if (i === -1) {\n // Insert the menu into the array.\n ArrayExt.insert(this._menus, j, menu);\n\n // Add the styling class to the menu.\n menu.addClass('lm-MenuBar-menu');\n\n // Connect to the menu signals.\n menu.aboutToClose.connect(this._onMenuAboutToClose, this);\n menu.menuRequested.connect(this._onMenuMenuRequested, this);\n menu.title.changed.connect(this._onTitleChanged, this);\n\n // Schedule an update of the items.\n if (update) {\n this.update();\n }\n\n // There is nothing more to do.\n return;\n }\n\n // Otherwise, the menu exists in the array and should be moved.\n\n // Adjust the index if the location is at the end of the array.\n if (j === this._menus.length) {\n j--;\n }\n\n // Bail if there is no effective move.\n if (i === j) {\n return;\n }\n\n // Move the menu to the new locations.\n ArrayExt.move(this._menus, i, j);\n\n // Schedule an update of the items.\n if (update) {\n this.update();\n }\n }\n\n /**\n * Remove a menu from the menu bar.\n *\n * @param menu - The menu to remove from the menu bar.\n *\n * #### Notes\n * This is a no-op if the menu is not in the menu bar.\n */\n removeMenu(menu: Menu, update: boolean = true): void {\n this.removeMenuAt(this._menus.indexOf(menu), update);\n }\n\n /**\n * Remove the menu at a given index from the menu bar.\n *\n * @param index - The index of the menu to remove.\n *\n * #### Notes\n * This is a no-op if the index is out of range.\n */\n removeMenuAt(index: number, update: boolean = true): void {\n // Close the child menu before making changes.\n this._closeChildMenu();\n\n // Remove the menu from the array.\n let menu = ArrayExt.removeAt(this._menus, index);\n\n // Bail if the index is out of range.\n if (!menu) {\n return;\n }\n\n // Disconnect from the menu signals.\n menu.aboutToClose.disconnect(this._onMenuAboutToClose, this);\n menu.menuRequested.disconnect(this._onMenuMenuRequested, this);\n menu.title.changed.disconnect(this._onTitleChanged, this);\n\n // Remove the styling class from the menu.\n menu.removeClass('lm-MenuBar-menu');\n\n // Schedule an update of the items.\n if (update) {\n this.update();\n }\n }\n\n /**\n * Remove all menus from the menu bar.\n */\n clearMenus(): void {\n // Bail if there is nothing to remove.\n if (this._menus.length === 0) {\n return;\n }\n\n // Close the child menu before making changes.\n this._closeChildMenu();\n\n // Disconnect from the menu signals and remove the styling class.\n for (let menu of this._menus) {\n menu.aboutToClose.disconnect(this._onMenuAboutToClose, this);\n menu.menuRequested.disconnect(this._onMenuMenuRequested, this);\n menu.title.changed.disconnect(this._onTitleChanged, this);\n menu.removeClass('lm-MenuBar-menu');\n }\n\n // Clear the menus array.\n this._menus.length = 0;\n\n // Schedule an update of the items.\n this.update();\n }\n\n /**\n * Handle the DOM events for the menu bar.\n *\n * @param event - The DOM event sent to the menu bar.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the menu bar's DOM nodes. It\n * should not be called directly by user code.\n */\n handleEvent(event: Event): void {\n switch (event.type) {\n case 'keydown':\n this._evtKeyDown(event as KeyboardEvent);\n break;\n case 'mousedown':\n this._evtMouseDown(event as MouseEvent);\n break;\n case 'mousemove':\n case 'mouseleave':\n this._evtMouseMove(event as MouseEvent);\n break;\n case 'focusout':\n this._evtFocusOut(event as FocusEvent);\n break;\n case 'contextmenu':\n event.preventDefault();\n event.stopPropagation();\n break;\n }\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n this.node.addEventListener('keydown', this);\n this.node.addEventListener('mousedown', this);\n this.node.addEventListener('mousemove', this);\n this.node.addEventListener('mouseleave', this);\n this.node.addEventListener('focusout', this);\n this.node.addEventListener('contextmenu', this);\n }\n\n /**\n * A message handler invoked on an `'after-detach'` message.\n */\n protected onAfterDetach(msg: Message): void {\n this.node.removeEventListener('keydown', this);\n this.node.removeEventListener('mousedown', this);\n this.node.removeEventListener('mousemove', this);\n this.node.removeEventListener('mouseleave', this);\n this.node.removeEventListener('focusout', this);\n this.node.removeEventListener('contextmenu', this);\n this._closeChildMenu();\n }\n\n /**\n * A message handler invoked on an `'activate-request'` message.\n */\n protected onActivateRequest(msg: Message): void {\n if (this.isAttached) {\n this._focusItemAt(0);\n }\n }\n\n /**\n * A message handler invoked on a `'resize'` message.\n */\n protected onResize(msg: Widget.ResizeMessage): void {\n this.update();\n super.onResize(msg);\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n protected onUpdateRequest(msg: Message): void {\n let menus = this._menus;\n let renderer = this.renderer;\n let activeIndex = this._activeIndex;\n let tabFocusIndex =\n this._tabFocusIndex >= 0 && this._tabFocusIndex < menus.length\n ? this._tabFocusIndex\n : 0;\n let length = this._overflowIndex > -1 ? this._overflowIndex : menus.length;\n let totalMenuSize = 0;\n let isVisible = false;\n\n // Check that the overflow menu doesn't count\n length = this._overflowMenu !== null ? length - 1 : length;\n let content = new Array(length);\n\n // Render visible menus\n for (let i = 0; i < length; ++i) {\n content[i] = renderer.renderItem({\n title: menus[i].title,\n active: i === activeIndex,\n tabbable: i === tabFocusIndex,\n disabled: menus[i].items.length === 0,\n onfocus: () => {\n this._tabFocusIndex = i;\n this.activeIndex = i;\n }\n });\n // Calculate size of current menu\n totalMenuSize += this._menuItemSizes[i];\n // Check if overflow menu is already rendered\n if (menus[i].title.label === this._overflowMenuOptions.title) {\n isVisible = true;\n length--;\n }\n }\n // Render overflow menu if needed and active\n if (this._overflowMenuOptions.isVisible) {\n if (this._overflowIndex > -1 && !isVisible) {\n // Create overflow menu\n if (this._overflowMenu === null) {\n const overflowMenuTitle = this._overflowMenuOptions.title ?? '...';\n this._overflowMenu = new Menu({ commands: new CommandRegistry() });\n this._overflowMenu.title.label = overflowMenuTitle;\n this._overflowMenu.title.mnemonic = 0;\n this.addMenu(this._overflowMenu, false);\n }\n // Move menus to overflow menu\n for (let i = menus.length - 2; i >= length; i--) {\n const submenu = this.menus[i];\n submenu.title.mnemonic = 0;\n this._overflowMenu.insertItem(0, {\n type: 'submenu',\n submenu: submenu\n });\n this.removeMenu(submenu, false);\n }\n content[length] = renderer.renderItem({\n title: this._overflowMenu.title,\n active: length === activeIndex && menus[length].items.length !== 0,\n tabbable: length === tabFocusIndex,\n disabled: menus[length].items.length === 0,\n onfocus: () => {\n this._tabFocusIndex = length;\n this.activeIndex = length;\n }\n });\n length++;\n } else if (this._overflowMenu !== null) {\n // Remove submenus from overflow menu\n let overflowMenuItems = this._overflowMenu.items;\n let screenSize = this.node.offsetWidth;\n let n = this._overflowMenu.items.length;\n for (let i = 0; i < n; ++i) {\n let index = menus.length - 1 - i;\n if (screenSize - totalMenuSize > this._menuItemSizes[index]) {\n let menu = overflowMenuItems[0].submenu as Menu;\n this._overflowMenu.removeItemAt(0);\n this.insertMenu(length, menu, false);\n content[length] = renderer.renderItem({\n title: menu.title,\n active: false,\n tabbable: length === tabFocusIndex,\n disabled: menus[length].items.length === 0,\n onfocus: () => {\n this._tabFocusIndex = length;\n this.activeIndex = length;\n }\n });\n length++;\n }\n }\n if (this._overflowMenu.items.length === 0) {\n this.removeMenu(this._overflowMenu, false);\n content.pop();\n this._overflowMenu = null;\n this._overflowIndex = -1;\n }\n }\n }\n VirtualDOM.render(content, this.contentNode);\n this._updateOverflowIndex();\n }\n\n /**\n * Calculate and update the current overflow index.\n */\n private _updateOverflowIndex(): void {\n if (!this._overflowMenuOptions.isVisible) {\n return;\n }\n\n // Get elements visible in the main menu bar\n const itemMenus = this.contentNode.childNodes;\n let screenSize = this.node.offsetWidth;\n let totalMenuSize = 0;\n let index = -1;\n let n = itemMenus.length;\n\n if (this._menuItemSizes.length == 0) {\n // Check if it is the first resize and get info about menu items sizes\n for (let i = 0; i < n; i++) {\n let item = itemMenus[i] as HTMLLIElement;\n // Add sizes to array\n totalMenuSize += item.offsetWidth;\n this._menuItemSizes.push(item.offsetWidth);\n if (totalMenuSize > screenSize && index === -1) {\n index = i;\n }\n }\n } else {\n // Calculate current menu size\n for (let i = 0; i < this._menuItemSizes.length; i++) {\n totalMenuSize += this._menuItemSizes[i];\n if (totalMenuSize > screenSize) {\n index = i;\n break;\n }\n }\n }\n this._overflowIndex = index;\n }\n\n /**\n * Handle the `'keydown'` event for the menu bar.\n *\n * #### Notes\n * All keys are trapped except the tab key that is ignored.\n */\n private _evtKeyDown(event: KeyboardEvent): void {\n // Fetch the key code for the event.\n let kc = event.keyCode;\n\n // Reset the active index on tab, but do not trap the tab key.\n if (kc === 9) {\n this.activeIndex = -1;\n return;\n }\n\n // A menu bar handles all other keydown events.\n event.preventDefault();\n event.stopPropagation();\n\n // Enter, Space, Up Arrow, Down Arrow\n if (kc === 13 || kc === 32 || kc === 38 || kc === 40) {\n // The active index may have changed (for example, user hovers over an\n // item with the mouse), so be sure to use the focus index.\n this.activeIndex = this._tabFocusIndex;\n if (this.activeIndex !== this._tabFocusIndex) {\n // Bail if the setter refused to set activeIndex to tabFocusIndex\n // because it means that the item at tabFocusIndex cannot be opened (for\n // example, it has an empty menu)\n return;\n }\n this.openActiveMenu();\n return;\n }\n\n // Escape\n if (kc === 27) {\n this._closeChildMenu();\n this._focusItemAt(this.activeIndex);\n return;\n }\n\n // Left or Right Arrow\n if (kc === 37 || kc === 39) {\n let direction = kc === 37 ? -1 : 1;\n let start = this._tabFocusIndex + direction;\n let n = this._menus.length;\n for (let i = 0; i < n; i++) {\n let index = (n + start + direction * i) % n;\n if (this._menus[index].items.length) {\n this._focusItemAt(index);\n return;\n }\n }\n return;\n }\n\n // Get the pressed key character.\n let key = getKeyboardLayout().keyForKeydownEvent(event);\n\n // Bail if the key is not valid.\n if (!key) {\n return;\n }\n\n // Search for the next best matching mnemonic item.\n let start = this._activeIndex + 1;\n let result = Private.findMnemonic(this._menus, key, start);\n\n // Handle the requested mnemonic based on the search results.\n // If exactly one mnemonic is matched, that menu is opened.\n // Otherwise, the next mnemonic is activated if available,\n // followed by the auto mnemonic if available.\n if (result.index !== -1 && !result.multiple) {\n this.activeIndex = result.index;\n this.openActiveMenu();\n } else if (result.index !== -1) {\n this.activeIndex = result.index;\n this._focusItemAt(this.activeIndex);\n } else if (result.auto !== -1) {\n this.activeIndex = result.auto;\n this._focusItemAt(this.activeIndex);\n }\n }\n\n /**\n * Handle the `'mousedown'` event for the menu bar.\n */\n private _evtMouseDown(event: MouseEvent): void {\n // Bail if the mouse press was not on the menu bar. This can occur\n // when the document listener is installed for an active menu bar.\n if (!ElementExt.hitTest(this.node, event.clientX, event.clientY)) {\n return;\n }\n\n // Stop the propagation of the event. Immediate propagation is\n // also stopped so that an open menu does not handle the event.\n event.stopPropagation();\n event.stopImmediatePropagation();\n\n // Check if the mouse is over one of the menu items.\n let index = ArrayExt.findFirstIndex(this.contentNode.children, node => {\n return ElementExt.hitTest(node, event.clientX, event.clientY);\n });\n\n // If the press was not on an item, close the child menu.\n if (index === -1) {\n this._closeChildMenu();\n return;\n }\n\n // If the press was not the left mouse button, do nothing further.\n if (event.button !== 0) {\n return;\n }\n\n // Otherwise, toggle the open state of the child menu.\n if (this._childMenu) {\n this._closeChildMenu();\n this.activeIndex = index;\n } else {\n // If we don't call preventDefault() here, then the item in the menu\n // bar will take focus over the menu that is being opened.\n event.preventDefault();\n const position = this._positionForMenu(index);\n Menu.saveWindowData();\n // Begin DOM modifications.\n this.activeIndex = index;\n this._openChildMenu(position);\n }\n }\n\n /**\n * Handle the `'mousemove'` event for the menu bar.\n */\n private _evtMouseMove(event: MouseEvent): void {\n // Check if the mouse is over one of the menu items.\n let index = ArrayExt.findFirstIndex(this.contentNode.children, node => {\n return ElementExt.hitTest(node, event.clientX, event.clientY);\n });\n\n // Bail early if the active index will not change.\n if (index === this._activeIndex) {\n return;\n }\n\n // Bail early if a child menu is open and the mouse is not over\n // an item. This allows the child menu to be kept open when the\n // mouse is over the empty part of the menu bar.\n if (index === -1 && this._childMenu) {\n return;\n }\n\n // Get position for the new menu >before< updating active index.\n const position =\n index >= 0 && this._childMenu ? this._positionForMenu(index) : null;\n\n // Before any modification, update window data.\n Menu.saveWindowData();\n\n // Begin DOM modifications.\n\n // Update the active index to the hovered item.\n this.activeIndex = index;\n\n // Open the new menu if a menu is already open.\n if (position) {\n this._openChildMenu(position);\n }\n }\n\n /**\n * Find initial position for the menu based on menubar item position.\n *\n * NOTE: this should be called before updating active index to avoid\n * an additional layout and style invalidation as changing active\n * index modifies DOM.\n */\n private _positionForMenu(index: number): Private.IPosition {\n let itemNode = this.contentNode.children[index];\n let { left, bottom } = (itemNode as HTMLElement).getBoundingClientRect();\n return {\n top: bottom,\n left\n };\n }\n\n /**\n * Handle the `'focusout'` event for the menu bar.\n */\n private _evtFocusOut(event: FocusEvent): void {\n // Reset the active index if there is no open menu and the menubar is losing focus.\n if (!this._childMenu && !this.node.contains(event.relatedTarget as Node)) {\n this.activeIndex = -1;\n }\n }\n\n /**\n * Focus an item in the menu bar.\n *\n * #### Notes\n * Does not open the associated menu.\n */\n private _focusItemAt(index: number): void {\n const itemNode = this.contentNode.childNodes[index] as HTMLElement | void;\n if (itemNode) {\n itemNode.focus();\n }\n }\n\n /**\n * Open the child menu at the active index immediately.\n *\n * If a different child menu is already open, it will be closed,\n * even if there is no active menu.\n */\n private _openChildMenu(options: { left?: number; top?: number } = {}): void {\n // If there is no active menu, close the current menu.\n let newMenu = this.activeMenu;\n if (!newMenu) {\n this._closeChildMenu();\n return;\n }\n\n // Bail if there is no effective menu change.\n let oldMenu = this._childMenu;\n if (oldMenu === newMenu) {\n return;\n }\n\n // Swap the internal menu reference.\n this._childMenu = newMenu;\n\n // Close the current menu, or setup for the new menu.\n if (oldMenu) {\n oldMenu.close();\n } else {\n document.addEventListener('mousedown', this, true);\n }\n\n // Update the tab focus index and ensure the menu bar is updated.\n this._tabFocusIndex = this.activeIndex;\n MessageLoop.sendMessage(this, Widget.Msg.UpdateRequest);\n\n // Get the positioning data for the new menu.\n let { left, top } = options;\n if (typeof left === 'undefined' || typeof top === 'undefined') {\n ({ left, top } = this._positionForMenu(this._activeIndex));\n }\n // Begin DOM modifications\n\n if (!oldMenu) {\n // Continue setup for new menu\n this.addClass('lm-mod-active');\n }\n\n // Open the new menu at the computed location.\n if (newMenu.items.length > 0) {\n newMenu.open(left, top, this._forceItemsPosition);\n }\n }\n\n /**\n * Close the child menu immediately.\n *\n * This is a no-op if a child menu is not open.\n */\n private _closeChildMenu(): void {\n // Bail if no child menu is open.\n if (!this._childMenu) {\n return;\n }\n // Remove the active class from the menu bar.\n this.removeClass('lm-mod-active');\n\n // Remove the document listeners.\n document.removeEventListener('mousedown', this, true);\n\n // Clear the internal menu reference.\n let menu = this._childMenu;\n this._childMenu = null;\n\n // Close the menu.\n menu.close();\n\n // Reset the active index.\n this.activeIndex = -1;\n }\n\n /**\n * Handle the `aboutToClose` signal of a menu.\n */\n private _onMenuAboutToClose(sender: Menu): void {\n // Bail if the sender is not the child menu.\n if (sender !== this._childMenu) {\n return;\n }\n\n // Remove the active class from the menu bar.\n this.removeClass('lm-mod-active');\n\n // Remove the document listeners.\n document.removeEventListener('mousedown', this, true);\n\n // Clear the internal menu reference.\n this._childMenu = null;\n\n // Reset the active index.\n this.activeIndex = -1;\n }\n\n /**\n * Handle the `menuRequested` signal of a child menu.\n */\n private _onMenuMenuRequested(sender: Menu, args: 'next' | 'previous'): void {\n // Bail if the sender is not the child menu.\n if (sender !== this._childMenu) {\n return;\n }\n\n // Look up the active index and menu count.\n let i = this._activeIndex;\n let n = this._menus.length;\n\n // Active the next requested index.\n switch (args) {\n case 'next':\n this.activeIndex = i === n - 1 ? 0 : i + 1;\n break;\n case 'previous':\n this.activeIndex = i === 0 ? n - 1 : i - 1;\n break;\n }\n\n // Open the active menu.\n this.openActiveMenu();\n }\n\n /**\n * Handle the `changed` signal of a title object.\n */\n private _onTitleChanged(): void {\n this.update();\n }\n\n // Track the index of the item that is currently focused or hovered. -1 means nothing focused or hovered.\n private _activeIndex = -1;\n // Track which item can be focused using the TAB key. Unlike _activeIndex will\n // always point to a menuitem. Whenever you update this value, it's important\n // to follow it with an \"update-request\" message so that the `tabindex`\n // attribute on each menubar item gets properly updated.\n private _tabFocusIndex = 0;\n private _forceItemsPosition: Menu.IOpenOptions;\n private _overflowMenuOptions: IOverflowMenuOptions;\n private _menus: Menu[] = [];\n private _childMenu: Menu | null = null;\n private _overflowMenu: Menu | null = null;\n private _menuItemSizes: number[] = [];\n private _overflowIndex: number = -1;\n}\n\n/**\n * The namespace for the `MenuBar` class statics.\n */\nexport namespace MenuBar {\n /**\n * An options object for creating a menu bar.\n */\n export interface IOptions {\n /**\n * A custom renderer for creating menu bar content.\n *\n * The default is a shared renderer instance.\n */\n renderer?: IRenderer;\n /**\n * Whether to force the position of the menu. The MenuBar forces the\n * coordinates of its menus by default. With this option you can disable it.\n *\n * Setting to `false` will enable the logic which repositions the\n * coordinates of the menu if it will not fit entirely on screen.\n *\n * The default is `true`.\n */\n forceItemsPosition?: Menu.IOpenOptions;\n /**\n * Whether to add a overflow menu if there's overflow.\n *\n * Setting to `true` will enable the logic that creates an overflow menu\n * to show the menu items that don't fit entirely on the screen.\n *\n * The default is `true`.\n */\n overflowMenuOptions?: IOverflowMenuOptions;\n }\n\n /**\n * An object which holds the data to render a menu bar item.\n */\n export interface IRenderData {\n /**\n * The title to be rendered.\n */\n readonly title: Title;\n\n /**\n * Whether the item is the active item.\n */\n readonly active: boolean;\n\n /**\n * Whether the user can tab to the item.\n */\n readonly tabbable: boolean;\n\n /**\n * Whether the item is disabled.\n *\n * #### Notes\n * A disabled item cannot be active.\n * A disabled item cannot be focussed.\n */\n readonly disabled?: boolean;\n\n readonly onfocus?: (event: FocusEvent) => void;\n }\n\n /**\n * A renderer for use with a menu bar.\n */\n export interface IRenderer {\n /**\n * Render the virtual element for a menu bar item.\n *\n * @param data - The data to use for rendering the item.\n *\n * @returns A virtual element representing the item.\n */\n renderItem(data: IRenderData): VirtualElement;\n }\n\n /**\n * The default implementation of `IRenderer`.\n *\n * #### Notes\n * Subclasses are free to reimplement rendering methods as needed.\n */\n export class Renderer implements IRenderer {\n /**\n * Render the virtual element for a menu bar item.\n *\n * @param data - The data to use for rendering the item.\n *\n * @returns A virtual element representing the item.\n */\n renderItem(data: IRenderData): VirtualElement {\n let className = this.createItemClass(data);\n let dataset = this.createItemDataset(data);\n let aria = this.createItemARIA(data);\n return h.li(\n {\n className,\n dataset,\n ...(data.disabled ? {} : { tabindex: data.tabbable ? '0' : '-1' }),\n onfocus: data.onfocus,\n ...aria\n },\n this.renderIcon(data),\n this.renderLabel(data)\n );\n }\n\n /**\n * Render the icon element for a menu bar item.\n *\n * @param data - The data to use for rendering the icon.\n *\n * @returns A virtual element representing the item icon.\n */\n renderIcon(data: IRenderData): VirtualElement {\n let className = this.createIconClass(data);\n\n // If data.title.icon is undefined, it will be ignored.\n return h.div({ className }, data.title.icon!, data.title.iconLabel);\n }\n\n /**\n * Render the label element for a menu item.\n *\n * @param data - The data to use for rendering the label.\n *\n * @returns A virtual element representing the item label.\n */\n renderLabel(data: IRenderData): VirtualElement {\n let content = this.formatLabel(data);\n return h.div({ className: 'lm-MenuBar-itemLabel' }, content);\n }\n\n /**\n * Create the class name for the menu bar item.\n *\n * @param data - The data to use for the class name.\n *\n * @returns The full class name for the menu item.\n */\n createItemClass(data: IRenderData): string {\n let name = 'lm-MenuBar-item';\n if (data.title.className) {\n name += ` ${data.title.className}`;\n }\n if (data.active && !data.disabled) {\n name += ' lm-mod-active';\n }\n return name;\n }\n\n /**\n * Create the dataset for a menu bar item.\n *\n * @param data - The data to use for the item.\n *\n * @returns The dataset for the menu bar item.\n */\n createItemDataset(data: IRenderData): ElementDataset {\n return data.title.dataset;\n }\n\n /**\n * Create the aria attributes for menu bar item.\n *\n * @param data - The data to use for the aria attributes.\n *\n * @returns The aria attributes object for the item.\n */\n createItemARIA(data: IRenderData): ElementARIAAttrs {\n return {\n role: 'menuitem',\n 'aria-haspopup': 'true',\n 'aria-disabled': data.disabled ? 'true' : 'false'\n };\n }\n\n /**\n * Create the class name for the menu bar item icon.\n *\n * @param data - The data to use for the class name.\n *\n * @returns The full class name for the item icon.\n */\n createIconClass(data: IRenderData): string {\n let name = 'lm-MenuBar-itemIcon';\n let extra = data.title.iconClass;\n return extra ? `${name} ${extra}` : name;\n }\n\n /**\n * Create the render content for the label node.\n *\n * @param data - The data to use for the label content.\n *\n * @returns The content to add to the label node.\n */\n formatLabel(data: IRenderData): h.Child {\n // Fetch the label text and mnemonic index.\n let { label, mnemonic } = data.title;\n\n // If the index is out of range, do not modify the label.\n if (mnemonic < 0 || mnemonic >= label.length) {\n return label;\n }\n\n // Split the label into parts.\n let prefix = label.slice(0, mnemonic);\n let suffix = label.slice(mnemonic + 1);\n let char = label[mnemonic];\n\n // Wrap the mnemonic character in a span.\n let span = h.span({ className: 'lm-MenuBar-itemMnemonic' }, char);\n\n // Return the content parts.\n return [prefix, span, suffix];\n }\n }\n\n /**\n * The default `Renderer` instance.\n */\n export const defaultRenderer = new Renderer();\n}\n\n/**\n * Options for overflow menu.\n */\nexport interface IOverflowMenuOptions {\n /**\n * Determines if a overflow menu appears when the menu items overflow.\n *\n * Defaults to `true`.\n */\n isVisible: boolean;\n /**\n * Determines the title of the overflow menu.\n *\n * Default: `...`.\n */\n title?: string;\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * Create the DOM node for a menu bar.\n */\n export function createNode(): HTMLDivElement {\n let node = document.createElement('div');\n let content = document.createElement('ul');\n content.className = 'lm-MenuBar-content';\n node.appendChild(content);\n content.setAttribute('role', 'menubar');\n return node;\n }\n\n /**\n * Position for the menu relative to top-left screen corner.\n */\n export interface IPosition {\n /**\n * Pixels right from screen origin.\n */\n left: number;\n /**\n * Pixels down from screen origin.\n */\n top: number;\n }\n\n /**\n * The results of a mnemonic search.\n */\n export interface IMnemonicResult {\n /**\n * The index of the first matching mnemonic item, or `-1`.\n */\n index: number;\n\n /**\n * Whether multiple mnemonic items matched.\n */\n multiple: boolean;\n\n /**\n * The index of the first auto matched non-mnemonic item.\n */\n auto: number;\n }\n\n /**\n * Find the best matching mnemonic item.\n *\n * The search starts at the given index and wraps around.\n */\n export function findMnemonic(\n menus: ReadonlyArray,\n key: string,\n start: number\n ): IMnemonicResult {\n // Setup the result variables.\n let index = -1;\n let auto = -1;\n let multiple = false;\n\n // Normalize the key to upper case.\n let upperKey = key.toUpperCase();\n\n // Search the items from the given start index.\n for (let i = 0, n = menus.length; i < n; ++i) {\n // Compute the wrapped index.\n let k = (i + start) % n;\n\n // Look up the menu title.\n let title = menus[k].title;\n\n // Ignore titles with an empty label.\n if (title.label.length === 0) {\n continue;\n }\n\n // Look up the mnemonic index for the label.\n let mn = title.mnemonic;\n\n // Handle a valid mnemonic index.\n if (mn >= 0 && mn < title.label.length) {\n if (title.label[mn].toUpperCase() === upperKey) {\n if (index === -1) {\n index = k;\n } else {\n multiple = true;\n }\n }\n continue;\n }\n\n // Finally, handle the auto index if possible.\n if (auto === -1 && title.label[0].toUpperCase() === upperKey) {\n auto = k;\n }\n }\n\n // Return the search results.\n return { index, multiple, auto };\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { IDisposable } from '@lumino/disposable';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Drag } from '@lumino/dragdrop';\n\nimport { Message } from '@lumino/messaging';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { Widget } from './widget';\n\n/**\n * A widget which implements a canonical scroll bar.\n */\nexport class ScrollBar extends Widget {\n /**\n * Construct a new scroll bar.\n *\n * @param options - The options for initializing the scroll bar.\n */\n constructor(options: ScrollBar.IOptions = {}) {\n super({ node: Private.createNode() });\n this.addClass('lm-ScrollBar');\n this.setFlag(Widget.Flag.DisallowLayout);\n\n // Set the orientation.\n this._orientation = options.orientation || 'vertical';\n this.dataset['orientation'] = this._orientation;\n\n // Parse the rest of the options.\n if (options.maximum !== undefined) {\n this._maximum = Math.max(0, options.maximum);\n }\n if (options.page !== undefined) {\n this._page = Math.max(0, options.page);\n }\n if (options.value !== undefined) {\n this._value = Math.max(0, Math.min(options.value, this._maximum));\n }\n }\n\n /**\n * A signal emitted when the user moves the scroll thumb.\n *\n * #### Notes\n * The payload is the current value of the scroll bar.\n */\n get thumbMoved(): ISignal {\n return this._thumbMoved;\n }\n\n /**\n * A signal emitted when the user clicks a step button.\n *\n * #### Notes\n * The payload is whether a decrease or increase is requested.\n */\n get stepRequested(): ISignal {\n return this._stepRequested;\n }\n\n /**\n * A signal emitted when the user clicks the scroll track.\n *\n * #### Notes\n * The payload is whether a decrease or increase is requested.\n */\n get pageRequested(): ISignal {\n return this._pageRequested;\n }\n\n /**\n * Get the orientation of the scroll bar.\n */\n get orientation(): ScrollBar.Orientation {\n return this._orientation;\n }\n\n /**\n * Set the orientation of the scroll bar.\n */\n set orientation(value: ScrollBar.Orientation) {\n // Do nothing if the orientation does not change.\n if (this._orientation === value) {\n return;\n }\n\n // Release the mouse before making changes.\n this._releaseMouse();\n\n // Update the internal orientation.\n this._orientation = value;\n this.dataset['orientation'] = value;\n\n // Schedule an update the scroll bar.\n this.update();\n }\n\n /**\n * Get the current value of the scroll bar.\n */\n get value(): number {\n return this._value;\n }\n\n /**\n * Set the current value of the scroll bar.\n *\n * #### Notes\n * The value will be clamped to the range `[0, maximum]`.\n */\n set value(value: number) {\n // Clamp the value to the allowable range.\n value = Math.max(0, Math.min(value, this._maximum));\n\n // Do nothing if the value does not change.\n if (this._value === value) {\n return;\n }\n\n // Update the internal value.\n this._value = value;\n\n // Schedule an update the scroll bar.\n this.update();\n }\n\n /**\n * Get the page size of the scroll bar.\n *\n * #### Notes\n * The page size is the amount of visible content in the scrolled\n * region, expressed in data units. It determines the size of the\n * scroll bar thumb.\n */\n get page(): number {\n return this._page;\n }\n\n /**\n * Set the page size of the scroll bar.\n *\n * #### Notes\n * The page size will be clamped to the range `[0, Infinity]`.\n */\n set page(value: number) {\n // Clamp the page size to the allowable range.\n value = Math.max(0, value);\n\n // Do nothing if the value does not change.\n if (this._page === value) {\n return;\n }\n\n // Update the internal page size.\n this._page = value;\n\n // Schedule an update the scroll bar.\n this.update();\n }\n\n /**\n * Get the maximum value of the scroll bar.\n */\n get maximum(): number {\n return this._maximum;\n }\n\n /**\n * Set the maximum value of the scroll bar.\n *\n * #### Notes\n * The max size will be clamped to the range `[0, Infinity]`.\n */\n set maximum(value: number) {\n // Clamp the value to the allowable range.\n value = Math.max(0, value);\n\n // Do nothing if the value does not change.\n if (this._maximum === value) {\n return;\n }\n\n // Update the internal values.\n this._maximum = value;\n\n // Clamp the current value to the new range.\n this._value = Math.min(this._value, value);\n\n // Schedule an update the scroll bar.\n this.update();\n }\n\n /**\n * The scroll bar decrement button node.\n *\n * #### Notes\n * Modifying this node directly can lead to undefined behavior.\n */\n get decrementNode(): HTMLDivElement {\n return this.node.getElementsByClassName(\n 'lm-ScrollBar-button'\n )[0] as HTMLDivElement;\n }\n\n /**\n * The scroll bar increment button node.\n *\n * #### Notes\n * Modifying this node directly can lead to undefined behavior.\n */\n get incrementNode(): HTMLDivElement {\n return this.node.getElementsByClassName(\n 'lm-ScrollBar-button'\n )[1] as HTMLDivElement;\n }\n\n /**\n * The scroll bar track node.\n *\n * #### Notes\n * Modifying this node directly can lead to undefined behavior.\n */\n get trackNode(): HTMLDivElement {\n return this.node.getElementsByClassName(\n 'lm-ScrollBar-track'\n )[0] as HTMLDivElement;\n }\n\n /**\n * The scroll bar thumb node.\n *\n * #### Notes\n * Modifying this node directly can lead to undefined behavior.\n */\n get thumbNode(): HTMLDivElement {\n return this.node.getElementsByClassName(\n 'lm-ScrollBar-thumb'\n )[0] as HTMLDivElement;\n }\n\n /**\n * Handle the DOM events for the scroll bar.\n *\n * @param event - The DOM event sent to the scroll bar.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the scroll bar's DOM node.\n *\n * This should not be called directly by user code.\n */\n handleEvent(event: Event): void {\n switch (event.type) {\n case 'mousedown':\n this._evtMouseDown(event as MouseEvent);\n break;\n case 'mousemove':\n this._evtMouseMove(event as MouseEvent);\n break;\n case 'mouseup':\n this._evtMouseUp(event as MouseEvent);\n break;\n case 'keydown':\n this._evtKeyDown(event as KeyboardEvent);\n break;\n case 'contextmenu':\n event.preventDefault();\n event.stopPropagation();\n break;\n }\n }\n\n /**\n * A method invoked on a 'before-attach' message.\n */\n protected onBeforeAttach(msg: Message): void {\n this.node.addEventListener('mousedown', this);\n this.update();\n }\n\n /**\n * A method invoked on an 'after-detach' message.\n */\n protected onAfterDetach(msg: Message): void {\n this.node.removeEventListener('mousedown', this);\n this._releaseMouse();\n }\n\n /**\n * A method invoked on an 'update-request' message.\n */\n protected onUpdateRequest(msg: Message): void {\n // Convert the value and page into percentages.\n let value = (this._value * 100) / this._maximum;\n let page = (this._page * 100) / (this._page + this._maximum);\n\n // Clamp the value and page to the relevant range.\n value = Math.max(0, Math.min(value, 100));\n page = Math.max(0, Math.min(page, 100));\n\n // Fetch the thumb style.\n let thumbStyle = this.thumbNode.style;\n\n // Update the thumb style for the current orientation.\n if (this._orientation === 'horizontal') {\n thumbStyle.top = '';\n thumbStyle.height = '';\n thumbStyle.left = `${value}%`;\n thumbStyle.width = `${page}%`;\n thumbStyle.transform = `translate(${-value}%, 0%)`;\n } else {\n thumbStyle.left = '';\n thumbStyle.width = '';\n thumbStyle.top = `${value}%`;\n thumbStyle.height = `${page}%`;\n thumbStyle.transform = `translate(0%, ${-value}%)`;\n }\n }\n\n /**\n * Handle the `'keydown'` event for the scroll bar.\n */\n private _evtKeyDown(event: KeyboardEvent): void {\n // Stop all input events during drag.\n event.preventDefault();\n event.stopPropagation();\n\n // Ignore anything except the `Escape` key.\n if (event.keyCode !== 27) {\n return;\n }\n\n // Fetch the previous scroll value.\n let value = this._pressData ? this._pressData.value : -1;\n\n // Release the mouse.\n this._releaseMouse();\n\n // Restore the old scroll value if possible.\n if (value !== -1) {\n this._moveThumb(value);\n }\n }\n\n /**\n * Handle the `'mousedown'` event for the scroll bar.\n */\n private _evtMouseDown(event: MouseEvent): void {\n // Do nothing if it's not a left mouse press.\n if (event.button !== 0) {\n return;\n }\n\n // Send an activate request to the scroll bar. This can be\n // used by message hooks to activate something relevant.\n this.activate();\n\n // Do nothing if the mouse is already captured.\n if (this._pressData) {\n return;\n }\n\n // Find the pressed scroll bar part.\n let part = Private.findPart(this, event.target as HTMLElement);\n\n // Do nothing if the part is not of interest.\n if (!part) {\n return;\n }\n\n // Stop the event propagation.\n event.preventDefault();\n event.stopPropagation();\n\n // Override the mouse cursor.\n let override = Drag.overrideCursor('default');\n\n // Set up the press data.\n this._pressData = {\n part,\n override,\n delta: -1,\n value: -1,\n mouseX: event.clientX,\n mouseY: event.clientY\n };\n\n // Add the extra event listeners.\n document.addEventListener('mousemove', this, true);\n document.addEventListener('mouseup', this, true);\n document.addEventListener('keydown', this, true);\n document.addEventListener('contextmenu', this, true);\n\n // Handle a thumb press.\n if (part === 'thumb') {\n // Fetch the thumb node.\n let thumbNode = this.thumbNode;\n\n // Fetch the client rect for the thumb.\n let thumbRect = thumbNode.getBoundingClientRect();\n\n // Update the press data delta for the current orientation.\n if (this._orientation === 'horizontal') {\n this._pressData.delta = event.clientX - thumbRect.left;\n } else {\n this._pressData.delta = event.clientY - thumbRect.top;\n }\n\n // Add the active class to the thumb node.\n thumbNode.classList.add('lm-mod-active');\n\n // Store the current value in the press data.\n this._pressData.value = this._value;\n\n // Finished.\n return;\n }\n\n // Handle a track press.\n if (part === 'track') {\n // Fetch the client rect for the thumb.\n let thumbRect = this.thumbNode.getBoundingClientRect();\n\n // Determine the direction for the page request.\n let dir: 'decrement' | 'increment';\n if (this._orientation === 'horizontal') {\n dir = event.clientX < thumbRect.left ? 'decrement' : 'increment';\n } else {\n dir = event.clientY < thumbRect.top ? 'decrement' : 'increment';\n }\n\n // Start the repeat timer.\n this._repeatTimer = window.setTimeout(this._onRepeat, 350);\n\n // Emit the page requested signal.\n this._pageRequested.emit(dir);\n\n // Finished.\n return;\n }\n\n // Handle a decrement button press.\n if (part === 'decrement') {\n // Add the active class to the decrement node.\n this.decrementNode.classList.add('lm-mod-active');\n\n // Start the repeat timer.\n this._repeatTimer = window.setTimeout(this._onRepeat, 350);\n\n // Emit the step requested signal.\n this._stepRequested.emit('decrement');\n\n // Finished.\n return;\n }\n\n // Handle an increment button press.\n if (part === 'increment') {\n // Add the active class to the increment node.\n this.incrementNode.classList.add('lm-mod-active');\n\n // Start the repeat timer.\n this._repeatTimer = window.setTimeout(this._onRepeat, 350);\n\n // Emit the step requested signal.\n this._stepRequested.emit('increment');\n\n // Finished.\n return;\n }\n }\n\n /**\n * Handle the `'mousemove'` event for the scroll bar.\n */\n private _evtMouseMove(event: MouseEvent): void {\n // Do nothing if no drag is in progress.\n if (!this._pressData) {\n return;\n }\n\n // Stop the event propagation.\n event.preventDefault();\n event.stopPropagation();\n\n // Update the mouse position.\n this._pressData.mouseX = event.clientX;\n this._pressData.mouseY = event.clientY;\n\n // Bail if the thumb is not being dragged.\n if (this._pressData.part !== 'thumb') {\n return;\n }\n\n // Get the client rect for the thumb and track.\n let thumbRect = this.thumbNode.getBoundingClientRect();\n let trackRect = this.trackNode.getBoundingClientRect();\n\n // Fetch the scroll geometry based on the orientation.\n let trackPos: number;\n let trackSpan: number;\n if (this._orientation === 'horizontal') {\n trackPos = event.clientX - trackRect.left - this._pressData.delta;\n trackSpan = trackRect.width - thumbRect.width;\n } else {\n trackPos = event.clientY - trackRect.top - this._pressData.delta;\n trackSpan = trackRect.height - thumbRect.height;\n }\n\n // Compute the desired value from the scroll geometry.\n let value = trackSpan === 0 ? 0 : (trackPos * this._maximum) / trackSpan;\n\n // Move the thumb to the computed value.\n this._moveThumb(value);\n }\n\n /**\n * Handle the `'mouseup'` event for the scroll bar.\n */\n private _evtMouseUp(event: MouseEvent): void {\n // Do nothing if it's not a left mouse release.\n if (event.button !== 0) {\n return;\n }\n\n // Stop the event propagation.\n event.preventDefault();\n event.stopPropagation();\n\n // Release the mouse.\n this._releaseMouse();\n }\n\n /**\n * Release the mouse and restore the node states.\n */\n private _releaseMouse(): void {\n // Bail if there is no press data.\n if (!this._pressData) {\n return;\n }\n\n // Clear the repeat timer.\n clearTimeout(this._repeatTimer);\n this._repeatTimer = -1;\n\n // Clear the press data.\n this._pressData.override.dispose();\n this._pressData = null;\n\n // Remove the extra event listeners.\n document.removeEventListener('mousemove', this, true);\n document.removeEventListener('mouseup', this, true);\n document.removeEventListener('keydown', this, true);\n document.removeEventListener('contextmenu', this, true);\n\n // Remove the active classes from the nodes.\n this.thumbNode.classList.remove('lm-mod-active');\n this.decrementNode.classList.remove('lm-mod-active');\n this.incrementNode.classList.remove('lm-mod-active');\n }\n\n /**\n * Move the thumb to the specified position.\n */\n private _moveThumb(value: number): void {\n // Clamp the value to the allowed range.\n value = Math.max(0, Math.min(value, this._maximum));\n\n // Bail if the value does not change.\n if (this._value === value) {\n return;\n }\n\n // Update the internal value.\n this._value = value;\n\n // Schedule an update of the scroll bar.\n this.update();\n\n // Emit the thumb moved signal.\n this._thumbMoved.emit(value);\n }\n\n /**\n * A timeout callback for repeating the mouse press.\n */\n private _onRepeat = () => {\n // Clear the repeat timer id.\n this._repeatTimer = -1;\n\n // Bail if the mouse has been released.\n if (!this._pressData) {\n return;\n }\n\n // Look up the part that was pressed.\n let part = this._pressData.part;\n\n // Bail if the thumb was pressed.\n if (part === 'thumb') {\n return;\n }\n\n // Schedule the timer for another repeat.\n this._repeatTimer = window.setTimeout(this._onRepeat, 20);\n\n // Get the current mouse position.\n let mouseX = this._pressData.mouseX;\n let mouseY = this._pressData.mouseY;\n\n // Handle a decrement button repeat.\n if (part === 'decrement') {\n // Bail if the mouse is not over the button.\n if (!ElementExt.hitTest(this.decrementNode, mouseX, mouseY)) {\n return;\n }\n\n // Emit the step requested signal.\n this._stepRequested.emit('decrement');\n\n // Finished.\n return;\n }\n\n // Handle an increment button repeat.\n if (part === 'increment') {\n // Bail if the mouse is not over the button.\n if (!ElementExt.hitTest(this.incrementNode, mouseX, mouseY)) {\n return;\n }\n\n // Emit the step requested signal.\n this._stepRequested.emit('increment');\n\n // Finished.\n return;\n }\n\n // Handle a track repeat.\n if (part === 'track') {\n // Bail if the mouse is not over the track.\n if (!ElementExt.hitTest(this.trackNode, mouseX, mouseY)) {\n return;\n }\n\n // Fetch the thumb node.\n let thumbNode = this.thumbNode;\n\n // Bail if the mouse is over the thumb.\n if (ElementExt.hitTest(thumbNode, mouseX, mouseY)) {\n return;\n }\n\n // Fetch the client rect for the thumb.\n let thumbRect = thumbNode.getBoundingClientRect();\n\n // Determine the direction for the page request.\n let dir: 'decrement' | 'increment';\n if (this._orientation === 'horizontal') {\n dir = mouseX < thumbRect.left ? 'decrement' : 'increment';\n } else {\n dir = mouseY < thumbRect.top ? 'decrement' : 'increment';\n }\n\n // Emit the page requested signal.\n this._pageRequested.emit(dir);\n\n // Finished.\n return;\n }\n };\n\n private _value = 0;\n private _page = 10;\n private _maximum = 100;\n private _repeatTimer = -1;\n private _orientation: ScrollBar.Orientation;\n private _pressData: Private.IPressData | null = null;\n private _thumbMoved = new Signal(this);\n private _stepRequested = new Signal(this);\n private _pageRequested = new Signal(this);\n}\n\n/**\n * The namespace for the `ScrollBar` class statics.\n */\nexport namespace ScrollBar {\n /**\n * A type alias for a scroll bar orientation.\n */\n export type Orientation = 'horizontal' | 'vertical';\n\n /**\n * An options object for creating a scroll bar.\n */\n export interface IOptions {\n /**\n * The orientation of the scroll bar.\n *\n * The default is `'vertical'`.\n */\n orientation?: Orientation;\n\n /**\n * The value for the scroll bar.\n *\n * The default is `0`.\n */\n value?: number;\n\n /**\n * The page size for the scroll bar.\n *\n * The default is `10`.\n */\n page?: number;\n\n /**\n * The maximum value for the scroll bar.\n *\n * The default is `100`.\n */\n maximum?: number;\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * A type alias for the parts of a scroll bar.\n */\n export type ScrollBarPart = 'thumb' | 'track' | 'decrement' | 'increment';\n\n /**\n * An object which holds mouse press data.\n */\n export interface IPressData {\n /**\n * The scroll bar part which was pressed.\n */\n part: ScrollBarPart;\n\n /**\n * The offset of the press in thumb coordinates, or -1.\n */\n delta: number;\n\n /**\n * The scroll value at the time the thumb was pressed, or -1.\n */\n value: number;\n\n /**\n * The disposable which will clear the override cursor.\n */\n override: IDisposable;\n\n /**\n * The current X position of the mouse.\n */\n mouseX: number;\n\n /**\n * The current Y position of the mouse.\n */\n mouseY: number;\n }\n\n /**\n * Create the DOM node for a scroll bar.\n */\n export function createNode(): HTMLElement {\n let node = document.createElement('div');\n let decrement = document.createElement('div');\n let increment = document.createElement('div');\n let track = document.createElement('div');\n let thumb = document.createElement('div');\n decrement.className = 'lm-ScrollBar-button';\n increment.className = 'lm-ScrollBar-button';\n decrement.dataset['action'] = 'decrement';\n increment.dataset['action'] = 'increment';\n track.className = 'lm-ScrollBar-track';\n thumb.className = 'lm-ScrollBar-thumb';\n track.appendChild(thumb);\n node.appendChild(decrement);\n node.appendChild(track);\n node.appendChild(increment);\n return node;\n }\n\n /**\n * Find the scroll bar part which contains the given target.\n */\n export function findPart(\n scrollBar: ScrollBar,\n target: HTMLElement\n ): ScrollBarPart | null {\n // Test the thumb.\n if (scrollBar.thumbNode.contains(target)) {\n return 'thumb';\n }\n\n // Test the track.\n if (scrollBar.trackNode.contains(target)) {\n return 'track';\n }\n\n // Test the decrement button.\n if (scrollBar.decrementNode.contains(target)) {\n return 'decrement';\n }\n\n // Test the increment button.\n if (scrollBar.incrementNode.contains(target)) {\n return 'increment';\n }\n\n // Indicate no match.\n return null;\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { Panel } from './panel';\n\nimport { StackedLayout } from './stackedlayout';\n\nimport { Widget } from './widget';\n\n/**\n * A panel where visible widgets are stacked atop one another.\n *\n * #### Notes\n * This class provides a convenience wrapper around a {@link StackedLayout}.\n */\nexport class StackedPanel extends Panel {\n /**\n * Construct a new stacked panel.\n *\n * @param options - The options for initializing the panel.\n */\n constructor(options: StackedPanel.IOptions = {}) {\n super({ layout: Private.createLayout(options) });\n this.addClass('lm-StackedPanel');\n }\n\n /**\n * The method for hiding widgets.\n *\n * #### Notes\n * If there is only one child widget, `Display` hiding mode will be used\n * regardless of this setting.\n */\n get hiddenMode(): Widget.HiddenMode {\n return (this.layout as StackedLayout).hiddenMode;\n }\n\n /**\n * Set the method for hiding widgets.\n *\n * #### Notes\n * If there is only one child widget, `Display` hiding mode will be used\n * regardless of this setting.\n */\n set hiddenMode(v: Widget.HiddenMode) {\n (this.layout as StackedLayout).hiddenMode = v;\n }\n\n /**\n * A signal emitted when a widget is removed from a stacked panel.\n */\n get widgetRemoved(): ISignal {\n return this._widgetRemoved;\n }\n\n /**\n * A message handler invoked on a `'child-added'` message.\n */\n protected onChildAdded(msg: Widget.ChildMessage): void {\n msg.child.addClass('lm-StackedPanel-child');\n }\n\n /**\n * A message handler invoked on a `'child-removed'` message.\n */\n protected onChildRemoved(msg: Widget.ChildMessage): void {\n msg.child.removeClass('lm-StackedPanel-child');\n this._widgetRemoved.emit(msg.child);\n }\n\n private _widgetRemoved = new Signal(this);\n}\n\n/**\n * The namespace for the `StackedPanel` class statics.\n */\nexport namespace StackedPanel {\n /**\n * An options object for creating a stacked panel.\n */\n export interface IOptions {\n /**\n * The stacked layout to use for the stacked panel.\n *\n * The default is a new `StackedLayout`.\n */\n layout?: StackedLayout;\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * Create a stacked layout for the given panel options.\n */\n export function createLayout(options: StackedPanel.IOptions): StackedLayout {\n return options.layout || new StackedLayout();\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { Platform } from '@lumino/domutils';\n\nimport { MessageLoop } from '@lumino/messaging';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { BoxLayout } from './boxlayout';\n\nimport { StackedPanel } from './stackedpanel';\n\nimport { TabBar } from './tabbar';\n\nimport { Widget } from './widget';\n\n/**\n * A widget which combines a `TabBar` and a `StackedPanel`.\n *\n * #### Notes\n * This is a simple panel which handles the common case of a tab bar\n * placed next to a content area. The selected tab controls the widget\n * which is shown in the content area.\n *\n * For use cases which require more control than is provided by this\n * panel, the `TabBar` widget may be used independently.\n */\nexport class TabPanel extends Widget {\n /**\n * Construct a new tab panel.\n *\n * @param options - The options for initializing the tab panel.\n */\n constructor(options: TabPanel.IOptions = {}) {\n super();\n this.addClass('lm-TabPanel');\n\n // Create the tab bar and stacked panel.\n this.tabBar = new TabBar(options);\n this.tabBar.addClass('lm-TabPanel-tabBar');\n this.stackedPanel = new StackedPanel();\n this.stackedPanel.addClass('lm-TabPanel-stackedPanel');\n\n // Connect the tab bar signal handlers.\n this.tabBar.tabMoved.connect(this._onTabMoved, this);\n this.tabBar.currentChanged.connect(this._onCurrentChanged, this);\n this.tabBar.tabCloseRequested.connect(this._onTabCloseRequested, this);\n this.tabBar.tabActivateRequested.connect(\n this._onTabActivateRequested,\n this\n );\n this.tabBar.addRequested.connect(this._onTabAddRequested, this);\n\n // Connect the stacked panel signal handlers.\n this.stackedPanel.widgetRemoved.connect(this._onWidgetRemoved, this);\n\n // Get the data related to the placement.\n this._tabPlacement = options.tabPlacement || 'top';\n let direction = Private.directionFromPlacement(this._tabPlacement);\n let orientation = Private.orientationFromPlacement(this._tabPlacement);\n\n // Configure the tab bar for the placement.\n this.tabBar.orientation = orientation;\n this.tabBar.dataset['placement'] = this._tabPlacement;\n\n // Create the box layout.\n let layout = new BoxLayout({ direction, spacing: 0 });\n\n // Set the stretch factors for the child widgets.\n BoxLayout.setStretch(this.tabBar, 0);\n BoxLayout.setStretch(this.stackedPanel, 1);\n\n // Add the child widgets to the layout.\n layout.addWidget(this.tabBar);\n layout.addWidget(this.stackedPanel);\n\n // Install the layout on the tab panel.\n this.layout = layout;\n }\n\n /**\n * A signal emitted when the current tab is changed.\n *\n * #### Notes\n * This signal is emitted when the currently selected tab is changed\n * either through user or programmatic interaction.\n *\n * Notably, this signal is not emitted when the index of the current\n * tab changes due to tabs being inserted, removed, or moved. It is\n * only emitted when the actual current tab node is changed.\n */\n get currentChanged(): ISignal {\n return this._currentChanged;\n }\n\n /**\n * Get the index of the currently selected tab.\n *\n * #### Notes\n * This will be `-1` if no tab is selected.\n */\n get currentIndex(): number {\n return this.tabBar.currentIndex;\n }\n\n /**\n * Set the index of the currently selected tab.\n *\n * #### Notes\n * If the index is out of range, it will be set to `-1`.\n */\n set currentIndex(value: number) {\n this.tabBar.currentIndex = value;\n }\n\n /**\n * Get the currently selected widget.\n *\n * #### Notes\n * This will be `null` if there is no selected tab.\n */\n get currentWidget(): Widget | null {\n let title = this.tabBar.currentTitle;\n return title ? title.owner : null;\n }\n\n /**\n * Set the currently selected widget.\n *\n * #### Notes\n * If the widget is not in the panel, it will be set to `null`.\n */\n set currentWidget(value: Widget | null) {\n this.tabBar.currentTitle = value ? value.title : null;\n }\n\n /**\n * Get the whether the tabs are movable by the user.\n *\n * #### Notes\n * Tabs can always be moved programmatically.\n */\n get tabsMovable(): boolean {\n return this.tabBar.tabsMovable;\n }\n\n /**\n * Set the whether the tabs are movable by the user.\n *\n * #### Notes\n * Tabs can always be moved programmatically.\n */\n set tabsMovable(value: boolean) {\n this.tabBar.tabsMovable = value;\n }\n\n /**\n * Get the whether the add button is enabled.\n *\n */\n get addButtonEnabled(): boolean {\n return this.tabBar.addButtonEnabled;\n }\n\n /**\n * Set the whether the add button is enabled.\n *\n */\n set addButtonEnabled(value: boolean) {\n this.tabBar.addButtonEnabled = value;\n }\n\n /**\n * Get the tab placement for the tab panel.\n *\n * #### Notes\n * This controls the position of the tab bar relative to the content.\n */\n get tabPlacement(): TabPanel.TabPlacement {\n return this._tabPlacement;\n }\n\n /**\n * Set the tab placement for the tab panel.\n *\n * #### Notes\n * This controls the position of the tab bar relative to the content.\n */\n set tabPlacement(value: TabPanel.TabPlacement) {\n // Bail if the placement does not change.\n if (this._tabPlacement === value) {\n return;\n }\n\n // Update the internal value.\n this._tabPlacement = value;\n\n // Get the values related to the placement.\n let direction = Private.directionFromPlacement(value);\n let orientation = Private.orientationFromPlacement(value);\n\n // Configure the tab bar for the placement.\n this.tabBar.orientation = orientation;\n this.tabBar.dataset['placement'] = value;\n\n // Update the layout direction.\n (this.layout as BoxLayout).direction = direction;\n }\n\n /**\n * A signal emitted when the add button on a tab bar is clicked.\n *\n */\n get addRequested(): ISignal> {\n return this._addRequested;\n }\n\n /**\n * The tab bar used by the tab panel.\n *\n * #### Notes\n * Modifying the tab bar directly can lead to undefined behavior.\n */\n readonly tabBar: TabBar;\n\n /**\n * The stacked panel used by the tab panel.\n *\n * #### Notes\n * Modifying the panel directly can lead to undefined behavior.\n */\n readonly stackedPanel: StackedPanel;\n\n /**\n * A read-only array of the widgets in the panel.\n */\n get widgets(): ReadonlyArray {\n return this.stackedPanel.widgets;\n }\n\n /**\n * Add a widget to the end of the tab panel.\n *\n * @param widget - The widget to add to the tab panel.\n *\n * #### Notes\n * If the widget is already contained in the panel, it will be moved.\n *\n * The widget's `title` is used to populate the tab.\n */\n addWidget(widget: Widget): void {\n this.insertWidget(this.widgets.length, widget);\n }\n\n /**\n * Insert a widget into the tab panel at a specified index.\n *\n * @param index - The index at which to insert the widget.\n *\n * @param widget - The widget to insert into to the tab panel.\n *\n * #### Notes\n * If the widget is already contained in the panel, it will be moved.\n *\n * The widget's `title` is used to populate the tab.\n */\n insertWidget(index: number, widget: Widget): void {\n if (widget !== this.currentWidget) {\n widget.hide();\n }\n this.stackedPanel.insertWidget(index, widget);\n this.tabBar.insertTab(index, widget.title);\n\n widget.node.setAttribute('role', 'tabpanel');\n\n let renderer = this.tabBar.renderer;\n if (renderer instanceof TabBar.Renderer) {\n let tabId = renderer.createTabKey({\n title: widget.title,\n current: false,\n zIndex: 0\n });\n widget.node.setAttribute('aria-labelledby', tabId);\n }\n }\n\n /**\n * Handle the `currentChanged` signal from the tab bar.\n */\n private _onCurrentChanged(\n sender: TabBar,\n args: TabBar.ICurrentChangedArgs\n ): void {\n // Extract the previous and current title from the args.\n let { previousIndex, previousTitle, currentIndex, currentTitle } = args;\n\n // Extract the widgets from the titles.\n let previousWidget = previousTitle ? previousTitle.owner : null;\n let currentWidget = currentTitle ? currentTitle.owner : null;\n\n // Hide the previous widget.\n if (previousWidget) {\n previousWidget.hide();\n }\n\n // Show the current widget.\n if (currentWidget) {\n currentWidget.show();\n }\n\n // Emit the `currentChanged` signal for the tab panel.\n this._currentChanged.emit({\n previousIndex,\n previousWidget,\n currentIndex,\n currentWidget\n });\n\n // Flush the message loop on IE and Edge to prevent flicker.\n if (Platform.IS_EDGE || Platform.IS_IE) {\n MessageLoop.flush();\n }\n }\n\n /**\n * Handle the `tabAddRequested` signal from the tab bar.\n */\n private _onTabAddRequested(sender: TabBar, args: void): void {\n this._addRequested.emit(sender);\n }\n\n /**\n * Handle the `tabActivateRequested` signal from the tab bar.\n */\n private _onTabActivateRequested(\n sender: TabBar,\n args: TabBar.ITabActivateRequestedArgs\n ): void {\n args.title.owner.activate();\n }\n\n /**\n * Handle the `tabCloseRequested` signal from the tab bar.\n */\n private _onTabCloseRequested(\n sender: TabBar,\n args: TabBar.ITabCloseRequestedArgs\n ): void {\n args.title.owner.close();\n }\n\n /**\n * Handle the `tabMoved` signal from the tab bar.\n */\n private _onTabMoved(\n sender: TabBar,\n args: TabBar.ITabMovedArgs\n ): void {\n this.stackedPanel.insertWidget(args.toIndex, args.title.owner);\n }\n\n /**\n * Handle the `widgetRemoved` signal from the stacked panel.\n */\n private _onWidgetRemoved(sender: StackedPanel, widget: Widget): void {\n widget.node.removeAttribute('role');\n widget.node.removeAttribute('aria-labelledby');\n this.tabBar.removeTab(widget.title);\n }\n\n private _tabPlacement: TabPanel.TabPlacement;\n private _currentChanged = new Signal(\n this\n );\n\n private _addRequested = new Signal>(this);\n}\n\n/**\n * The namespace for the `TabPanel` class statics.\n */\nexport namespace TabPanel {\n /**\n * A type alias for tab placement in a tab bar.\n */\n export type TabPlacement =\n | /**\n * The tabs are placed as a row above the content.\n */\n 'top'\n\n /**\n * The tabs are placed as a column to the left of the content.\n */\n | 'left'\n\n /**\n * The tabs are placed as a column to the right of the content.\n */\n | 'right'\n\n /**\n * The tabs are placed as a row below the content.\n */\n | 'bottom';\n\n /**\n * An options object for initializing a tab panel.\n */\n export interface IOptions {\n /**\n * The document to use with the tab panel.\n *\n * The default is the global `document` instance.\n */\n document?: Document | ShadowRoot;\n\n /**\n * Whether the tabs are movable by the user.\n *\n * The default is `false`.\n */\n tabsMovable?: boolean;\n\n /**\n * Whether the button to add new tabs is enabled.\n *\n * The default is `false`.\n */\n addButtonEnabled?: boolean;\n\n /**\n * The placement of the tab bar relative to the content.\n *\n * The default is `'top'`.\n */\n tabPlacement?: TabPlacement;\n\n /**\n * The renderer for the panel's tab bar.\n *\n * The default is a shared renderer instance.\n */\n renderer?: TabBar.IRenderer;\n }\n\n /**\n * The arguments object for the `currentChanged` signal.\n */\n export interface ICurrentChangedArgs {\n /**\n * The previously selected index.\n */\n previousIndex: number;\n\n /**\n * The previously selected widget.\n */\n previousWidget: Widget | null;\n\n /**\n * The currently selected index.\n */\n currentIndex: number;\n\n /**\n * The currently selected widget.\n */\n currentWidget: Widget | null;\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * Convert a tab placement to tab bar orientation.\n */\n export function orientationFromPlacement(\n plc: TabPanel.TabPlacement\n ): TabBar.Orientation {\n return placementToOrientationMap[plc];\n }\n\n /**\n * Convert a tab placement to a box layout direction.\n */\n export function directionFromPlacement(\n plc: TabPanel.TabPlacement\n ): BoxLayout.Direction {\n return placementToDirectionMap[plc];\n }\n\n /**\n * A mapping of tab placement to tab bar orientation.\n */\n const placementToOrientationMap: { [key: string]: TabBar.Orientation } = {\n top: 'horizontal',\n left: 'vertical',\n right: 'vertical',\n bottom: 'horizontal'\n };\n\n /**\n * A mapping of tab placement to box layout direction.\n */\n const placementToDirectionMap: { [key: string]: BoxLayout.Direction } = {\n top: 'top-to-bottom',\n left: 'left-to-right',\n right: 'right-to-left',\n bottom: 'bottom-to-top'\n };\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { MessageLoop } from '@lumino/messaging';\n\nimport { Layout } from './layout';\n\nimport { Widget } from './widget';\n\n/**\n * A concrete layout implementation which holds a single widget.\n *\n * #### Notes\n * This class is useful for creating simple container widgets which\n * hold a single child. The child should be positioned with CSS.\n */\nexport class SingletonLayout extends Layout {\n /**\n * Dispose of the resources held by the layout.\n */\n dispose(): void {\n if (this._widget) {\n let widget = this._widget;\n this._widget = null;\n widget.dispose();\n }\n super.dispose();\n }\n\n /**\n * Get the child widget for the layout.\n */\n get widget(): Widget | null {\n return this._widget;\n }\n\n /**\n * Set the child widget for the layout.\n *\n * #### Notes\n * Setting the child widget will cause the old child widget to be\n * automatically disposed. If that is not desired, set the parent\n * of the old child to `null` before assigning a new child.\n */\n set widget(widget: Widget | null) {\n // Remove the widget from its current parent. This is a no-op\n // if the widget's parent is already the layout parent widget.\n if (widget) {\n widget.parent = this.parent;\n }\n\n // Bail early if the widget does not change.\n if (this._widget === widget) {\n return;\n }\n\n // Dispose of the old child widget.\n if (this._widget) {\n this._widget.dispose();\n }\n\n // Update the internal widget.\n this._widget = widget;\n\n // Attach the new child widget if needed.\n if (this.parent && widget) {\n this.attachWidget(widget);\n }\n }\n\n /**\n * Create an iterator over the widgets in the layout.\n *\n * @returns A new iterator over the widgets in the layout.\n */\n *[Symbol.iterator](): IterableIterator {\n if (this._widget) {\n yield this._widget;\n }\n }\n\n /**\n * Remove a widget from the layout.\n *\n * @param widget - The widget to remove from the layout.\n *\n * #### Notes\n * A widget is automatically removed from the layout when its `parent`\n * is set to `null`. This method should only be invoked directly when\n * removing a widget from a layout which has yet to be installed on a\n * parent widget.\n *\n * This method does *not* modify the widget's `parent`.\n */\n removeWidget(widget: Widget): void {\n // Bail early if the widget does not exist in the layout.\n if (this._widget !== widget) {\n return;\n }\n\n // Clear the internal widget.\n this._widget = null;\n\n // If the layout is parented, detach the widget from the DOM.\n if (this.parent) {\n this.detachWidget(widget);\n }\n }\n\n /**\n * Perform layout initialization which requires the parent widget.\n */\n protected init(): void {\n super.init();\n for (const widget of this) {\n this.attachWidget(widget);\n }\n }\n\n /**\n * Attach a widget to the parent's DOM node.\n *\n * @param widget - The widget to attach to the parent.\n *\n * #### Notes\n * This method is called automatically by the single layout at the\n * appropriate time. It should not be called directly by user code.\n *\n * The default implementation adds the widgets's node to the parent's\n * node at the proper location, and sends the appropriate attach\n * messages to the widget if the parent is attached to the DOM.\n *\n * Subclasses may reimplement this method to control how the widget's\n * node is added to the parent's node.\n */\n protected attachWidget(widget: Widget): void {\n // Send a `'before-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n }\n\n // Add the widget's node to the parent.\n this.parent!.node.appendChild(widget.node);\n\n // Send an `'after-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n }\n\n /**\n * Detach a widget from the parent's DOM node.\n *\n * @param widget - The widget to detach from the parent.\n *\n * #### Notes\n * This method is called automatically by the single layout at the\n * appropriate time. It should not be called directly by user code.\n *\n * The default implementation removes the widget's node from the\n * parent's node, and sends the appropriate detach messages to the\n * widget if the parent is attached to the DOM.\n *\n * Subclasses may reimplement this method to control how the widget's\n * node is removed from the parent's node.\n */\n protected detachWidget(widget: Widget): void {\n // Send a `'before-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n }\n\n // Remove the widget's node from the parent.\n this.parent!.node.removeChild(widget.node);\n\n // Send an `'after-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n }\n\n private _widget: Widget | null = null;\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { Layout, LayoutItem } from './layout';\n\nimport { PanelLayout } from './panellayout';\n\nimport { Widget } from './widget';\n\n/**\n * A layout where visible widgets are stacked atop one another.\n *\n * #### Notes\n * The Z-order of the visible widgets follows their layout order.\n */\nexport class StackedLayout extends PanelLayout {\n constructor(options: StackedLayout.IOptions = {}) {\n super(options);\n this._hiddenMode =\n options.hiddenMode !== undefined\n ? options.hiddenMode\n : Widget.HiddenMode.Display;\n }\n\n /**\n * The method for hiding widgets.\n *\n * #### Notes\n * If there is only one child widget, `Display` hiding mode will be used\n * regardless of this setting.\n */\n get hiddenMode(): Widget.HiddenMode {\n return this._hiddenMode;\n }\n\n /**\n * Set the method for hiding widgets.\n *\n * #### Notes\n * If there is only one child widget, `Display` hiding mode will be used\n * regardless of this setting.\n */\n set hiddenMode(v: Widget.HiddenMode) {\n if (this._hiddenMode === v) {\n return;\n }\n this._hiddenMode = v;\n if (this.widgets.length > 1) {\n this.widgets.forEach(w => {\n w.hiddenMode = this._hiddenMode;\n });\n }\n }\n\n /**\n * Dispose of the resources held by the layout.\n */\n dispose(): void {\n // Dispose of the layout items.\n for (const item of this._items) {\n item.dispose();\n }\n\n // Clear the layout state.\n this._box = null;\n this._items.length = 0;\n\n // Dispose of the rest of the layout.\n super.dispose();\n }\n\n /**\n * Attach a widget to the parent's DOM node.\n *\n * @param index - The current index of the widget in the layout.\n *\n * @param widget - The widget to attach to the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected attachWidget(index: number, widget: Widget): void {\n // Using transform create an additional layer in the pixel pipeline\n // to limit the number of layer, it is set only if there is more than one widget.\n if (\n this._hiddenMode === Widget.HiddenMode.Scale &&\n this._items.length > 0\n ) {\n if (this._items.length === 1) {\n this.widgets[0].hiddenMode = Widget.HiddenMode.Scale;\n }\n widget.hiddenMode = Widget.HiddenMode.Scale;\n } else {\n widget.hiddenMode = Widget.HiddenMode.Display;\n }\n\n // Create and add a new layout item for the widget.\n ArrayExt.insert(this._items, index, new LayoutItem(widget));\n\n // Send a `'before-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n }\n\n // Add the widget's node to the parent.\n this.parent!.node.appendChild(widget.node);\n\n // Send an `'after-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n\n // Post a fit request for the parent widget.\n this.parent!.fit();\n }\n\n /**\n * Move a widget in the parent's DOM node.\n *\n * @param fromIndex - The previous index of the widget in the layout.\n *\n * @param toIndex - The current index of the widget in the layout.\n *\n * @param widget - The widget to move in the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected moveWidget(\n fromIndex: number,\n toIndex: number,\n widget: Widget\n ): void {\n // Move the layout item for the widget.\n ArrayExt.move(this._items, fromIndex, toIndex);\n\n // Post an update request for the parent widget.\n this.parent!.update();\n }\n\n /**\n * Detach a widget from the parent's DOM node.\n *\n * @param index - The previous index of the widget in the layout.\n *\n * @param widget - The widget to detach from the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected detachWidget(index: number, widget: Widget): void {\n // Remove the layout item for the widget.\n let item = ArrayExt.removeAt(this._items, index);\n\n // Send a `'before-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n }\n\n // Remove the widget's node from the parent.\n this.parent!.node.removeChild(widget.node);\n\n // Send an `'after-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n\n // Reset the z-index for the widget.\n item!.widget.node.style.zIndex = '';\n\n // Reset the hidden mode for the widget.\n if (this._hiddenMode === Widget.HiddenMode.Scale) {\n widget.hiddenMode = Widget.HiddenMode.Display;\n\n // Reset the hidden mode for the first widget if necessary.\n if (this._items.length === 1) {\n this._items[0].widget.hiddenMode = Widget.HiddenMode.Display;\n }\n }\n\n // Dispose of the layout item.\n item!.dispose();\n\n // Post a fit request for the parent widget.\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'before-show'` message.\n */\n protected onBeforeShow(msg: Message): void {\n super.onBeforeShow(msg);\n this.parent!.update();\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n super.onBeforeAttach(msg);\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-shown'` message.\n */\n protected onChildShown(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-hidden'` message.\n */\n protected onChildHidden(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'resize'` message.\n */\n protected onResize(msg: Widget.ResizeMessage): void {\n if (this.parent!.isVisible) {\n this._update(msg.width, msg.height);\n }\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n protected onUpdateRequest(msg: Message): void {\n if (this.parent!.isVisible) {\n this._update(-1, -1);\n }\n }\n\n /**\n * A message handler invoked on a `'fit-request'` message.\n */\n protected onFitRequest(msg: Message): void {\n if (this.parent!.isAttached) {\n this._fit();\n }\n }\n\n /**\n * Fit the layout to the total size required by the widgets.\n */\n private _fit(): void {\n // Set up the computed minimum size.\n let minW = 0;\n let minH = 0;\n\n // Update the computed minimum size.\n for (let i = 0, n = this._items.length; i < n; ++i) {\n // Fetch the item.\n let item = this._items[i];\n\n // Ignore hidden items.\n if (item.isHidden) {\n continue;\n }\n\n // Update the size limits for the item.\n item.fit();\n\n // Update the computed minimum size.\n minW = Math.max(minW, item.minWidth);\n minH = Math.max(minH, item.minHeight);\n }\n\n // Update the box sizing and add it to the computed min size.\n let box = (this._box = ElementExt.boxSizing(this.parent!.node));\n minW += box.horizontalSum;\n minH += box.verticalSum;\n\n // Update the parent's min size constraints.\n let style = this.parent!.node.style;\n style.minWidth = `${minW}px`;\n style.minHeight = `${minH}px`;\n\n // Set the dirty flag to ensure only a single update occurs.\n this._dirty = true;\n\n // Notify the ancestor that it should fit immediately. This may\n // cause a resize of the parent, fulfilling the required update.\n if (this.parent!.parent) {\n MessageLoop.sendMessage(this.parent!.parent!, Widget.Msg.FitRequest);\n }\n\n // If the dirty flag is still set, the parent was not resized.\n // Trigger the required update on the parent widget immediately.\n if (this._dirty) {\n MessageLoop.sendMessage(this.parent!, Widget.Msg.UpdateRequest);\n }\n }\n\n /**\n * Update the layout position and size of the widgets.\n *\n * The parent offset dimensions should be `-1` if unknown.\n */\n private _update(offsetWidth: number, offsetHeight: number): void {\n // Clear the dirty flag to indicate the update occurred.\n this._dirty = false;\n\n // Compute the visible item count.\n let nVisible = 0;\n for (let i = 0, n = this._items.length; i < n; ++i) {\n nVisible += +!this._items[i].isHidden;\n }\n\n // Bail early if there are no visible items to layout.\n if (nVisible === 0) {\n return;\n }\n\n // Measure the parent if the offset dimensions are unknown.\n if (offsetWidth < 0) {\n offsetWidth = this.parent!.node.offsetWidth;\n }\n if (offsetHeight < 0) {\n offsetHeight = this.parent!.node.offsetHeight;\n }\n\n // Ensure the parent box sizing data is computed.\n if (!this._box) {\n this._box = ElementExt.boxSizing(this.parent!.node);\n }\n\n // Compute the actual layout bounds adjusted for border and padding.\n let top = this._box.paddingTop;\n let left = this._box.paddingLeft;\n let width = offsetWidth - this._box.horizontalSum;\n let height = offsetHeight - this._box.verticalSum;\n\n // Update the widget stacking order and layout geometry.\n for (let i = 0, n = this._items.length; i < n; ++i) {\n // Fetch the item.\n let item = this._items[i];\n\n // Ignore hidden items.\n if (item.isHidden) {\n continue;\n }\n\n // Set the z-index for the widget.\n item.widget.node.style.zIndex = `${i}`;\n\n // Update the item geometry.\n item.update(left, top, width, height);\n }\n }\n\n private _dirty = false;\n private _items: LayoutItem[] = [];\n private _box: ElementExt.IBoxSizing | null = null;\n private _hiddenMode: Widget.HiddenMode;\n}\n\n/**\n * The namespace for the `StackedLayout` class statics.\n */\nexport namespace StackedLayout {\n /**\n * An options object for initializing a stacked layout.\n */\n export interface IOptions extends Layout.IOptions {\n /**\n * The method for hiding widgets.\n *\n * The default is `Widget.HiddenMode.Display`.\n */\n hiddenMode?: Widget.HiddenMode;\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt, find, max } from '@lumino/algorithm';\n\nimport { IDisposable } from '@lumino/disposable';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { Widget } from './widget';\n\n/**\n * A class which tracks focus among a set of widgets.\n *\n * This class is useful when code needs to keep track of the most\n * recently focused widget(s) among a set of related widgets.\n */\nexport class FocusTracker implements IDisposable {\n /**\n * Dispose of the resources held by the tracker.\n */\n dispose(): void {\n // Do nothing if the tracker is already disposed.\n if (this._counter < 0) {\n return;\n }\n\n // Mark the tracker as disposed.\n this._counter = -1;\n\n // Clear the connections for the tracker.\n Signal.clearData(this);\n\n // Remove all event listeners.\n for (const widget of this._widgets) {\n widget.node.removeEventListener('focus', this, true);\n widget.node.removeEventListener('blur', this, true);\n }\n\n // Clear the internal data structures.\n this._activeWidget = null;\n this._currentWidget = null;\n this._nodes.clear();\n this._numbers.clear();\n this._widgets.length = 0;\n }\n\n /**\n * A signal emitted when the current widget has changed.\n */\n get currentChanged(): ISignal> {\n return this._currentChanged;\n }\n\n /**\n * A signal emitted when the active widget has changed.\n */\n get activeChanged(): ISignal> {\n return this._activeChanged;\n }\n\n /**\n * A flag indicating whether the tracker is disposed.\n */\n get isDisposed(): boolean {\n return this._counter < 0;\n }\n\n /**\n * The current widget in the tracker.\n *\n * #### Notes\n * The current widget is the widget among the tracked widgets which\n * has the *descendant node* which has most recently been focused.\n *\n * The current widget will not be updated if the node loses focus. It\n * will only be updated when a different tracked widget gains focus.\n *\n * If the current widget is removed from the tracker, the previous\n * current widget will be restored.\n *\n * This behavior is intended to follow a user's conceptual model of\n * a semantically \"current\" widget, where the \"last thing of type X\"\n * to be interacted with is the \"current instance of X\", regardless\n * of whether that instance still has focus.\n */\n get currentWidget(): T | null {\n return this._currentWidget;\n }\n\n /**\n * The active widget in the tracker.\n *\n * #### Notes\n * The active widget is the widget among the tracked widgets which\n * has the *descendant node* which is currently focused.\n */\n get activeWidget(): T | null {\n return this._activeWidget;\n }\n\n /**\n * A read only array of the widgets being tracked.\n */\n get widgets(): ReadonlyArray {\n return this._widgets;\n }\n\n /**\n * Get the focus number for a particular widget in the tracker.\n *\n * @param widget - The widget of interest.\n *\n * @returns The focus number for the given widget, or `-1` if the\n * widget has not had focus since being added to the tracker, or\n * is not contained by the tracker.\n *\n * #### Notes\n * The focus number indicates the relative order in which the widgets\n * have gained focus. A widget with a larger number has gained focus\n * more recently than a widget with a smaller number.\n *\n * The `currentWidget` will always have the largest focus number.\n *\n * All widgets start with a focus number of `-1`, which indicates that\n * the widget has not been focused since being added to the tracker.\n */\n focusNumber(widget: T): number {\n let n = this._numbers.get(widget);\n return n === undefined ? -1 : n;\n }\n\n /**\n * Test whether the focus tracker contains a given widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns `true` if the widget is tracked, `false` otherwise.\n */\n has(widget: T): boolean {\n return this._numbers.has(widget);\n }\n\n /**\n * Add a widget to the focus tracker.\n *\n * @param widget - The widget of interest.\n *\n * #### Notes\n * A widget will be automatically removed from the tracker if it\n * is disposed after being added.\n *\n * If the widget is already tracked, this is a no-op.\n */\n add(widget: T): void {\n // Do nothing if the widget is already tracked.\n if (this._numbers.has(widget)) {\n return;\n }\n\n // Test whether the widget has focus.\n let focused = widget.node.contains(document.activeElement);\n\n // Set up the initial focus number.\n let n = focused ? this._counter++ : -1;\n\n // Add the widget to the internal data structures.\n this._widgets.push(widget);\n this._numbers.set(widget, n);\n this._nodes.set(widget.node, widget);\n\n // Set up the event listeners. The capturing phase must be used\n // since the 'focus' and 'blur' events don't bubble and Firefox\n // doesn't support the 'focusin' or 'focusout' events.\n widget.node.addEventListener('focus', this, true);\n widget.node.addEventListener('blur', this, true);\n\n // Connect the disposed signal handler.\n widget.disposed.connect(this._onWidgetDisposed, this);\n\n // Set the current and active widgets if needed.\n if (focused) {\n this._setWidgets(widget, widget);\n }\n }\n\n /**\n * Remove a widget from the focus tracker.\n *\n * #### Notes\n * If the widget is the `currentWidget`, the previous current widget\n * will become the new `currentWidget`.\n *\n * A widget will be automatically removed from the tracker if it\n * is disposed after being added.\n *\n * If the widget is not tracked, this is a no-op.\n */\n remove(widget: T): void {\n // Bail early if the widget is not tracked.\n if (!this._numbers.has(widget)) {\n return;\n }\n\n // Disconnect the disposed signal handler.\n widget.disposed.disconnect(this._onWidgetDisposed, this);\n\n // Remove the event listeners.\n widget.node.removeEventListener('focus', this, true);\n widget.node.removeEventListener('blur', this, true);\n\n // Remove the widget from the internal data structures.\n ArrayExt.removeFirstOf(this._widgets, widget);\n this._nodes.delete(widget.node);\n this._numbers.delete(widget);\n\n // Bail early if the widget is not the current widget.\n if (this._currentWidget !== widget) {\n return;\n }\n\n // Filter the widgets for those which have had focus.\n let valid = this._widgets.filter(w => this._numbers.get(w) !== -1);\n\n // Get the valid widget with the max focus number.\n let previous =\n max(valid, (first, second) => {\n let a = this._numbers.get(first)!;\n let b = this._numbers.get(second)!;\n return a - b;\n }) || null;\n\n // Set the current and active widgets.\n this._setWidgets(previous, null);\n }\n\n /**\n * Handle the DOM events for the focus tracker.\n *\n * @param event - The DOM event sent to the panel.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the tracked nodes. It should\n * not be called directly by user code.\n */\n handleEvent(event: Event): void {\n switch (event.type) {\n case 'focus':\n this._evtFocus(event as FocusEvent);\n break;\n case 'blur':\n this._evtBlur(event as FocusEvent);\n break;\n }\n }\n\n /**\n * Set the current and active widgets for the tracker.\n */\n private _setWidgets(current: T | null, active: T | null): void {\n // Swap the current widget.\n let oldCurrent = this._currentWidget;\n this._currentWidget = current;\n\n // Swap the active widget.\n let oldActive = this._activeWidget;\n this._activeWidget = active;\n\n // Emit the `currentChanged` signal if needed.\n if (oldCurrent !== current) {\n this._currentChanged.emit({ oldValue: oldCurrent, newValue: current });\n }\n\n // Emit the `activeChanged` signal if needed.\n if (oldActive !== active) {\n this._activeChanged.emit({ oldValue: oldActive, newValue: active });\n }\n }\n\n /**\n * Handle the `'focus'` event for a tracked widget.\n */\n private _evtFocus(event: FocusEvent): void {\n // Find the widget which gained focus, which is known to exist.\n let widget = this._nodes.get(event.currentTarget as HTMLElement)!;\n\n // Update the focus number if necessary.\n if (widget !== this._currentWidget) {\n this._numbers.set(widget, this._counter++);\n }\n\n // Set the current and active widgets.\n this._setWidgets(widget, widget);\n }\n\n /**\n * Handle the `'blur'` event for a tracked widget.\n */\n private _evtBlur(event: FocusEvent): void {\n // Find the widget which lost focus, which is known to exist.\n let widget = this._nodes.get(event.currentTarget as HTMLElement)!;\n\n // Get the node which being focused after this blur.\n let focusTarget = event.relatedTarget as HTMLElement;\n\n // If no other node is being focused, clear the active widget.\n if (!focusTarget) {\n this._setWidgets(this._currentWidget, null);\n return;\n }\n\n // Bail if the focus widget is not changing.\n if (widget.node.contains(focusTarget)) {\n return;\n }\n\n // If no tracked widget is being focused, clear the active widget.\n if (!find(this._widgets, w => w.node.contains(focusTarget))) {\n this._setWidgets(this._currentWidget, null);\n return;\n }\n }\n\n /**\n * Handle the `disposed` signal for a tracked widget.\n */\n private _onWidgetDisposed(sender: T): void {\n this.remove(sender);\n }\n\n private _counter = 0;\n private _widgets: T[] = [];\n private _activeWidget: T | null = null;\n private _currentWidget: T | null = null;\n private _numbers = new Map();\n private _nodes = new Map();\n private _activeChanged = new Signal>(this);\n private _currentChanged = new Signal>(\n this\n );\n}\n\n/**\n * The namespace for the `FocusTracker` class statics.\n */\nexport namespace FocusTracker {\n /**\n * An arguments object for the changed signals.\n */\n export interface IChangedArgs {\n /**\n * The old value for the widget.\n */\n oldValue: T | null;\n\n /**\n * The new value for the widget.\n */\n newValue: T | null;\n }\n}\n"],"mappings":"2/BAoBaA,EAAbC,cAcEC,KAAQC,SAAG,EAeXD,KAAOE,QAAG,EAeVF,KAAOG,QAAGC,IAkBVJ,KAAOK,QAAG,EAcVL,KAAIM,KAAG,EAUPN,KAAIO,MAAG,C,EAMT,IAAiBC,EC+gCPC,EC1TAA,ECh0BOC,EH2GAF,gDA0XhB,KA3TiBG,KAAhB,SAAqBC,EAA6BC,GAEhD,IAAIC,EAAQF,EAAOG,OACnB,GAAc,IAAVD,EACF,OAAOD,EAIT,IAAIG,EAAW,EACXC,EAAW,EACXC,EAAY,EACZC,EAAe,EACfC,EAAe,EAGnB,IAAK,IAAIC,EAAI,EAAGA,EAAIP,IAASO,EAAG,CAC9B,IAAIC,EAAQV,EAAOS,GACfE,EAAMD,EAAMp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xiB,EACAoG,GAEA1e,KAAK8lC,aAAa32B,aAAauP,EAAK3O,QAAS2O,EAAK9Y,MAAMlC,M,CAMlDqiC,iBAAiBztB,EAAsB/Q,GAC7CA,EAAOpC,KAAK0F,gBAAgB,QAC5BtD,EAAOpC,KAAK0F,gBAAgB,mBAC5B7K,KAAKw0B,OAAOhH,UAAUjmB,EAAO3B,M"} +\ No newline at end of file +diff --git a/node_modules/@lumino/widgets/src/menu.ts b/node_modules/@lumino/widgets/src/menu.ts +index 9c2a83c..816b680 100644 +--- a/node_modules/@lumino/widgets/src/menu.ts ++++ b/node_modules/@lumino/widgets/src/menu.ts +@@ -523,29 +523,29 @@ export class Menu extends Widget { + } + + /** +- * A message handler invoked on a `'before-attach'` message. ++ * A message handler invoked on a `'after-attach'` message. + */ +- protected onBeforeAttach(msg: Message): void { ++ protected override onAfterAttach(msg: Message): void { + this.node.addEventListener('keydown', this); + this.node.addEventListener('mouseup', this); + this.node.addEventListener('mousemove', this); + this.node.addEventListener('mouseenter', this); + this.node.addEventListener('mouseleave', this); + this.node.addEventListener('contextmenu', this); +- document.addEventListener('mousedown', this, true); ++ this.node.ownerDocument.addEventListener('mousedown', this, true); + } + + /** +- * A message handler invoked on an `'after-detach'` message. ++ * A message handler invoked on an `'before-detach'` message. + */ +- protected onAfterDetach(msg: Message): void { ++ protected override onBeforeDetach(msg: Message): void { + this.node.removeEventListener('keydown', this); + this.node.removeEventListener('mouseup', this); + this.node.removeEventListener('mousemove', this); + this.node.removeEventListener('mouseenter', this); + this.node.removeEventListener('mouseleave', this); + this.node.removeEventListener('contextmenu', this); +- document.removeEventListener('mousedown', this, true); ++ this.node.ownerDocument.removeEventListener('mousedown', this, true); + } + + /** +@@ -1440,16 +1440,9 @@ namespace Private { + */ + export const SUBMENU_OVERLAP = 3; + +- let transientWindowDataCache: IWindowData | null = null; +- let transientCacheCounter: number = 0; ++ function getWindowData(element: HTMLElement): IWindowData { + +- function getWindowData(): IWindowData { +- // if transient cache is in use, take one from it +- if (transientCacheCounter > 0) { +- transientCacheCounter--; +- return transientWindowDataCache!; +- } +- return _getWindowData(); ++ return _getWindowData(element); + } + + /** +@@ -1462,8 +1455,6 @@ namespace Private { + * Note: should be called before any DOM modifications. + */ + export function saveWindowData(): void { +- transientWindowDataCache = _getWindowData(); +- transientCacheCounter++; + } + + /** +@@ -1565,12 +1556,12 @@ namespace Private { + return result; + } + +- function _getWindowData(): IWindowData { ++ function _getWindowData(element: HTMLElement): IWindowData { + return { +- pageXOffset: window.pageXOffset, +- pageYOffset: window.pageYOffset, +- clientWidth: document.documentElement.clientWidth, +- clientHeight: document.documentElement.clientHeight ++ pageXOffset: element.ownerDocument.defaultView?.window.scrollX || 0, ++ pageYOffset: element.ownerDocument.defaultView?.window.scrollY || 0, ++ clientWidth: element.ownerDocument.documentElement.clientWidth, ++ clientHeight: element.ownerDocument.documentElement.clientHeight + }; + } + +@@ -1588,7 +1579,7 @@ namespace Private { + ref: HTMLElement | null + ): void { + // Get the current position and size of the main viewport. +- const windowData = getWindowData(); ++ const windowData = getWindowData(host || menu.node); + let px = windowData.pageXOffset; + let py = windowData.pageYOffset; + let cw = windowData.clientWidth; +@@ -1603,6 +1594,8 @@ namespace Private { + // Fetch common variables. + let node = menu.node; + let style = node.style; ++ style.top = '0'; ++ style.left = '0'; + + // Clear the menu geometry and prepare it for measuring. + style.opacity = '0'; +@@ -1645,7 +1638,7 @@ namespace Private { + */ + export function openSubmenu(submenu: Menu, itemNode: HTMLElement): void { + // Get the current position and size of the main viewport. +- const windowData = getWindowData(); ++ const windowData = getWindowData(itemNode); + let px = windowData.pageXOffset; + let py = windowData.pageYOffset; + let cw = windowData.clientWidth; +@@ -1666,7 +1659,7 @@ namespace Private { + style.maxHeight = `${maxHeight}px`; + + // Attach the menu to the document. +- Widget.attach(submenu, document.body); ++ Widget.attach(submenu, itemNode.ownerDocument.body); + + // Measure the size of the menu. + let { width, height } = node.getBoundingClientRect(); +@@ -1693,6 +1686,8 @@ namespace Private { + y = itemRect.bottom + box.borderBottom + box.paddingBottom - height; + } + ++ style.top = '0'; ++ style.left = '0'; + // Update the position of the menu to the computed position. + style.transform = `translate(${Math.max(0, x)}px, ${Math.max(0, y)}px`; + +diff --git a/node_modules/@lumino/widgets/types/menu.d.ts b/node_modules/@lumino/widgets/types/menu.d.ts +index bd814f1..49f72ac 100644 +--- a/node_modules/@lumino/widgets/types/menu.d.ts ++++ b/node_modules/@lumino/widgets/types/menu.d.ts +@@ -216,13 +216,13 @@ export declare class Menu extends Widget { + */ + handleEvent(event: Event): void; + /** +- * A message handler invoked on a `'before-attach'` message. ++ * A message handler invoked on a `'after-attach'` message. + */ +- protected onBeforeAttach(msg: Message): void; ++ protected onAfterAttach(msg: Message): void; + /** +- * A message handler invoked on an `'after-detach'` message. ++ * A message handler invoked on an `'before-detach'` message. + */ +- protected onAfterDetach(msg: Message): void; ++ protected onBeforeDetach(msg: Message): void; + /** + * A message handler invoked on an `'activate-request'` message. + */ diff --git a/dev-packages/cli/src/check-dependencies.ts b/dev-packages/cli/src/check-dependencies.ts new file mode 100644 index 0000000..48847f8 --- /dev/null +++ b/dev-packages/cli/src/check-dependencies.ts @@ -0,0 +1,328 @@ +// ***************************************************************************** +// Copyright (C) 2022 STMicroelectronics and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import * as fs from 'fs'; +import * as path from 'path'; +import { glob } from 'glob'; +import { create as logUpdater } from 'log-update'; +import * as chalk from 'chalk'; + +const NODE_MODULES = 'node_modules'; +const PACKAGE_JSON = 'package.json'; + +const logUpdate = logUpdater(process.stdout); + +interface CheckDependenciesOptions { + workspaces: string[] | undefined, + include: string[], + exclude: string[], + skipHoisted: boolean, + skipUniqueness: boolean, + skipSingleTheiaVersion: boolean, + onlyTheiaExtensions: boolean, + suppress: boolean +} + +/** NPM package */ +interface Package { + /** Name of the package, e.g. `@theia/core`. */ + name: string, + /** Actual resolved version of the package, e.g. `1.27.0`. */ + version: string, + /** Path of the package relative to the workspace, e.g. `node_modules/@theia/core`. */ + path: string, + /** Whether the package is hoisted or not, i.e., whether it is contained in the root `node_modules`. */ + hoisted: boolean, + /** Workspace location in which the package was found. */ + dependent: string | undefined, + /** Whether the package is a Theia extension or not */ + isTheiaExtension?: boolean, +} + +/** Issue found with a specific package. */ +interface DependencyIssue { + /** Type of the issue. */ + issueType: 'not-hoisted' | 'multiple-versions' | 'theia-version-mix', + /** Package with issue. */ + package: Package, + /** Packages related to this issue. */ + relatedPackages: Package[], + /** Severity */ + severity: 'warning' | 'error' +} + +export default function checkDependencies(options: CheckDependenciesOptions): void { + const workspaces = deriveWorkspaces(options); + logUpdate(`✅ Found ${workspaces.length} workspaces`); + + console.log('🔍 Collecting dependencies...'); + const dependencies = findAllDependencies(workspaces, options); + logUpdate(`✅ Found ${dependencies.length} dependencies`); + + console.log('🔍 Analyzing dependencies...'); + const issues = analyzeDependencies(dependencies, options); + if (issues.length <= 0) { + logUpdate('✅ No issues were found'); + process.exit(0); + } + + logUpdate('🟠 Found ' + issues.length + ' issues'); + printIssues(issues); + printHints(issues); + process.exit(options.suppress ? 0 : 1); +} + +function deriveWorkspaces(options: CheckDependenciesOptions): string[] { + const wsGlobs = options.workspaces ?? readWorkspaceGlobsFromPackageJson(); + const workspaces: string[] = []; + for (const wsGlob of wsGlobs) { + workspaces.push(...glob.sync(wsGlob + '/')); + } + return workspaces; +} + +function readWorkspaceGlobsFromPackageJson(): string[] { + const rootPackageJson = path.join(process.cwd(), PACKAGE_JSON); + if (!fs.existsSync(rootPackageJson)) { + console.error('Directory does not contain a package.json with defined workspaces'); + console.info('Run in the root of a Theia project or specify them via --workspaces'); + process.exit(1); + } + return require(rootPackageJson).workspaces ?? []; +} + +function findAllDependencies(workspaces: string[], options: CheckDependenciesOptions): Package[] { + const dependencies: Package[] = []; + dependencies.push(...findDependencies('.', options)); + for (const workspace of workspaces) { + dependencies.push(...findDependencies(workspace, options)); + } + return dependencies; +} + +function findDependencies(workspace: string, options: CheckDependenciesOptions): Package[] { + const dependent = getPackageName(path.join(process.cwd(), workspace, PACKAGE_JSON)); + const nodeModulesDir = path.join(workspace, NODE_MODULES); + const matchingPackageJsons: Package[] = []; + options.include.forEach(include => + glob.sync(`${include}/${PACKAGE_JSON}`, { + cwd: nodeModulesDir, + ignore: [ + `**/${NODE_MODULES}/**`, // node_modules folders within dependencies + `[^@]*/*/**/${PACKAGE_JSON}`, // package.json that isn't at the package root (and not in an @org) + `@*/*/*/**/${PACKAGE_JSON}`, // package.json that isn't at the package root (and in an @org) + ...options.exclude] // user-specified exclude patterns + }).forEach(packageJsonPath => { + const dependency = toDependency(packageJsonPath, nodeModulesDir, dependent); + if (!options.onlyTheiaExtensions || dependency.isTheiaExtension) { + matchingPackageJsons.push(dependency); + } + const childNodeModules: string = path.join(nodeModulesDir, packageJsonPath, '..'); + matchingPackageJsons.push(...findDependencies(childNodeModules, options)); + }) + ); + return matchingPackageJsons; +} + +function toDependency(packageJsonPath: string, nodeModulesDir: string, dependent?: string): Package { + const fullPackageJsonPath = path.join(process.cwd(), nodeModulesDir, packageJsonPath); + const name = getPackageName(fullPackageJsonPath); + const version = getPackageVersion(fullPackageJsonPath); + return { + name: name ?? packageJsonPath.replace('/' + PACKAGE_JSON, ''), + version: version ?? 'unknown', + path: path.relative(process.cwd(), fullPackageJsonPath), + hoisted: nodeModulesDir === NODE_MODULES, + dependent: dependent, + isTheiaExtension: isTheiaExtension(fullPackageJsonPath) + }; +} + +function getPackageVersion(fullPackageJsonPath: string): string | undefined { + try { + return require(fullPackageJsonPath).version; + } catch (error) { + return undefined; + } +} + +function getPackageName(fullPackageJsonPath: string): string | undefined { + try { + return require(fullPackageJsonPath).name; + } catch (error) { + return undefined; + } +} + +function isTheiaExtension(fullPackageJsonPath: string): boolean { + try { + const theiaExtension = require(fullPackageJsonPath).theiaExtensions; + return theiaExtension ? true : false; + } catch (error) { + return false; + } +} + +function analyzeDependencies(packages: Package[], options: CheckDependenciesOptions): DependencyIssue[] { + const issues: DependencyIssue[] = []; + if (!options.skipHoisted) { + issues.push(...findNotHoistedDependencies(packages, options)); + } + if (!options.skipUniqueness) { + issues.push(...findDuplicateDependencies(packages, options)); + } + if (!options.skipSingleTheiaVersion) { + issues.push(...findTheiaVersionMix(packages, options)); + } + return issues; +} + +function findNotHoistedDependencies(packages: Package[], options: CheckDependenciesOptions): DependencyIssue[] { + const issues: DependencyIssue[] = []; + const nonHoistedPackages = packages.filter(p => p.hoisted === false); + for (const nonHoistedPackage of nonHoistedPackages) { + issues.push(createNonHoistedPackageIssue(nonHoistedPackage, options)); + } + return issues; +} + +function createNonHoistedPackageIssue(nonHoistedPackage: Package, options: CheckDependenciesOptions): DependencyIssue { + return { + issueType: 'not-hoisted', + package: nonHoistedPackage, + relatedPackages: [getHoistedPackageByName(nonHoistedPackage.name)], + severity: options.suppress ? 'warning' : 'error' + }; +} + +function getHoistedPackageByName(name: string): Package { + return toDependency(path.join(name, PACKAGE_JSON), NODE_MODULES); +} + +function findDuplicateDependencies(packages: Package[], options: CheckDependenciesOptions): DependencyIssue[] { + const duplicates: string[] = []; + const packagesGroupedByName = new Map(); + for (const currentPackage of packages) { + const name = currentPackage.name; + if (!packagesGroupedByName.has(name)) { + packagesGroupedByName.set(name, []); + } + const currentPackages = packagesGroupedByName.get(name)!; + currentPackages.push(currentPackage); + if (currentPackages.length > 1 && duplicates.indexOf(name) === -1) { + duplicates.push(name); + } + } + + duplicates.sort(); + const issues: DependencyIssue[] = []; + for (const duplicate of duplicates) { + const duplicatePackages = packagesGroupedByName.get(duplicate); + if (duplicatePackages && duplicatePackages.length > 0) { + issues.push({ + issueType: 'multiple-versions', + package: duplicatePackages.pop()!, + relatedPackages: duplicatePackages, + severity: options.suppress ? 'warning' : 'error' + }); + } + } + + return issues; +} + +function findTheiaVersionMix(packages: Package[], options: CheckDependenciesOptions): DependencyIssue[] { + // @theia/monaco-editor-core is following the versions of Monaco so it can't be part of this check + const theiaPackages = packages.filter(p => p.name.startsWith('@theia/') && !p.name.startsWith('@theia/monaco-editor-core')); + let theiaVersion = undefined; + let referenceTheiaPackage = undefined; + const packagesWithOtherVersion: Package[] = []; + for (const theiaPackage of theiaPackages) { + if (!theiaVersion && theiaPackage.version) { + theiaVersion = theiaPackage.version; + referenceTheiaPackage = theiaPackage; + } else if (theiaVersion !== theiaPackage.version) { + packagesWithOtherVersion.push(theiaPackage); + } + } + + if (referenceTheiaPackage && packagesWithOtherVersion.length > 0) { + return [{ + issueType: 'theia-version-mix', + package: referenceTheiaPackage, + relatedPackages: packagesWithOtherVersion, + severity: 'error' + }]; + } + return []; +} + +function printIssues(issues: DependencyIssue[]): void { + console.log(); + const indent = issues.length.toString().length; + issues.forEach((issue, index) => { + printIssue(issue, index + 1, indent); + }); +} + +function printIssue(issue: DependencyIssue, issueNumber: number, indent: number): void { + const remainingIndent = indent - issueNumber.toString().length; + const indentString = ' '.repeat(remainingIndent + 1); + console.log(issueTitle(issue, issueNumber, indentString)); + console.log(issueDetails(issue, ' ' + ' '.repeat(indent))); + console.log(); +} + +function issueTitle(issue: DependencyIssue, issueNumber: number, indent: string): string { + const dependent = issue.package.dependent ? ` in ${chalk.blueBright(issue.package.dependent ?? 'unknown')}` : ''; + return chalk.bgWhiteBright.bold.black(`#${issueNumber}${indent}`) + ' ' + chalk.cyanBright(issue.package.name) + + dependent + chalk.dim(` [${issue.issueType}]`); +} + +function issueDetails(issue: DependencyIssue, indent: string): string { + return indent + severity(issue) + ' ' + issueMessage(issue) + '\n' + + indent + versionLine(issue.package) + '\n' + + issue.relatedPackages.map(p => indent + versionLine(p)).join('\n'); +} + +function issueMessage(issue: DependencyIssue): string { + if (issue.issueType === 'multiple-versions') { + return `Multiple versions of dependency ${chalk.bold(issue.package.name)} found.`; + } else if (issue.issueType === 'theia-version-mix') { + return `Mix of ${chalk.bold('@theia/*')} versions found.`; + } else { + return `Dependency ${chalk.bold(issue.package.name)} is not hoisted.`; + } +} + +function severity(issue: DependencyIssue): string { + return issue.severity === 'error' ? chalk.red('error') : chalk.yellow('warning'); +} + +function versionLine(pckg: Package): string { + return chalk.bold(pckg.version) + ' in ' + pckg.path; +} + +function printHints(issues: DependencyIssue[]): void { + console.log(); + if (issues.find(i => i.issueType === 'theia-version-mix')) { + console.log('⛔ A mix of Theia versions is very likely leading to a broken application.'); + } + console.log(`ℹ️ Use ${chalk.bold('npm ls ')} to find out why those multiple versions of a package are pulled.`); + console.log('ℹ️ Try to resolve those issues by finding package versions along the dependency chain that depend on compatible versions.'); + console.log(`ℹ️ Use ${chalk.bold('overrides')} in your root package.json to force specific versions as a last resort.`); + console.log(); +} diff --git a/dev-packages/cli/src/download-plugins.ts b/dev-packages/cli/src/download-plugins.ts new file mode 100644 index 0000000..aa6e2c6 --- /dev/null +++ b/dev-packages/cli/src/download-plugins.ts @@ -0,0 +1,421 @@ +// ***************************************************************************** +// Copyright (C) 2020 Ericsson and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +/* eslint-disable @typescript-eslint/no-explicit-any */ + +import { OVSXApiFilterImpl, OVSXClient, VSXTargetPlatform } from '@theia/ovsx-client'; +import * as chalk from 'chalk'; +import * as decompress from 'decompress'; +import { promises as fs } from 'fs'; +import * as path from 'path'; +import * as temp from 'temp'; +import { DEFAULT_SUPPORTED_API_VERSION } from '@theia/application-package/lib/api'; +import { RequestContext, RequestService } from '@theia/request'; +import { RateLimiter } from 'limiter'; +import escapeStringRegexp = require('escape-string-regexp'); + +temp.track(); + +/** + * Available options when downloading. + */ +export interface DownloadPluginsOptions { + /** + * Determines if a plugin should be unpacked. + * Defaults to `false`. + */ + packed?: boolean; + + /** + * Determines if failures while downloading plugins should be ignored. + * Defaults to `false`. + */ + ignoreErrors?: boolean; + + /** + * The supported vscode API version. + * Used to determine extension compatibility. + */ + apiVersion?: string; + + /** + * Fetch plugins in parallel + */ + parallel?: boolean; +} + +interface PluginDownload { + id: string, + downloadUrl: string, + version?: string | undefined +} + +export default async function downloadPlugins( + ovsxClient: OVSXClient, + rateLimiter: RateLimiter, + requestService: RequestService, + options: DownloadPluginsOptions = {} +): Promise { + const { + packed = false, + ignoreErrors = false, + apiVersion = DEFAULT_SUPPORTED_API_VERSION, + parallel = true + } = options; + + const apiFilter = new OVSXApiFilterImpl(ovsxClient, apiVersion); + + // Collect the list of failures to be appended at the end of the script. + const failures: string[] = []; + + // Resolve the `package.json` at the current working directory. + const pck = JSON.parse(await fs.readFile(path.resolve('package.json'), 'utf8')); + + // Resolve the directory for which to download the plugins. + const pluginsDir = pck.theiaPluginsDir || 'plugins'; + + // Excluded extension ids. + const excludedIds = new Set(pck.theiaPluginsExcludeIds || []); + + const parallelOrSequence = async (tasks: (() => unknown)[]) => { + if (parallel) { + await Promise.all(tasks.map(task => task())); + } else { + for (const task of tasks) { + await task(); + } + } + }; + + // Downloader wrapper + const downloadPlugin = async (plugin: PluginDownload): Promise => { + await downloadPluginAsync(requestService, rateLimiter, failures, plugin.id, plugin.downloadUrl, pluginsDir, packed, excludedIds, plugin.version); + }; + + const downloader = async (plugins: PluginDownload[]) => { + await parallelOrSequence(plugins.map(plugin => () => downloadPlugin(plugin))); + }; + + await fs.mkdir(pluginsDir, { recursive: true }); + + if (!pck.theiaPlugins) { + console.log(chalk.red('error: missing mandatory \'theiaPlugins\' property.')); + return; + } + try { + console.warn('--- downloading plugins ---'); + // Download the raw plugins defined by the `theiaPlugins` property. + // This will include both "normal" plugins as well as "extension packs". + const pluginsToDownload = Object.entries(pck.theiaPlugins) + .filter((entry: [string, unknown]): entry is [string, string] => typeof entry[1] === 'string') + .map(([id, url]) => ({ id, downloadUrl: resolveDownloadUrlPlaceholders(url) })); + await downloader(pluginsToDownload); + + const handleDependencyList = async (dependencies: (string | string[])[]) => { + // De-duplicate extension ids to only download each once: + const ids = new Set(dependencies.flat()); + await parallelOrSequence(Array.from(ids, id => async () => { + try { + await rateLimiter.removeTokens(1); + const extension = await apiFilter.findLatestCompatibleExtension({ + extensionId: id, + includeAllVersions: true, + targetPlatform + }); + const version = extension?.version; + const downloadUrl = extension?.files.download; + if (downloadUrl) { + await rateLimiter.removeTokens(1); + await downloadPlugin({ id, downloadUrl, version }); + } else { + failures.push(`No download url for extension pack ${id} (${version})`); + } + } catch (err) { + console.error(err); + failures.push(err.message); + } + })); + }; + + console.warn('--- collecting extension-packs ---'); + const extensionPacks = await collectExtensionPacks(pluginsDir, excludedIds); + if (extensionPacks.size > 0) { + console.warn(`--- resolving ${extensionPacks.size} extension-packs ---`); + await handleDependencyList(Array.from(extensionPacks.values())); + } + + console.warn('--- collecting extension dependencies ---'); + const pluginDependencies = await collectPluginDependencies(pluginsDir, excludedIds); + if (pluginDependencies.length > 0) { + console.warn(`--- resolving ${pluginDependencies.length} extension dependencies ---`); + await handleDependencyList(pluginDependencies); + } + + } finally { + temp.cleanupSync(); + } + for (const failure of failures) { + console.error(failure); + } + if (!ignoreErrors && failures.length > 0) { + throw new Error('Errors downloading some plugins. To make these errors non fatal, re-run with --ignore-errors'); + } +} + +const targetPlatform = `${process.platform}-${process.arch}` as VSXTargetPlatform; + +const placeholders: Record = { + targetPlatform +}; +function resolveDownloadUrlPlaceholders(url: string): string { + for (const [name, value] of Object.entries(placeholders)) { + url = url.replace(new RegExp(escapeStringRegexp(`\${${name}}`), 'g'), value); + } + return url; +} + +/** + * Downloads a plugin, will make multiple attempts before actually failing. + * @param requestService + * @param failures reference to an array storing all failures. + * @param plugin plugin short name. + * @param pluginUrl url to download the plugin at. + * @param target where to download the plugin in. + * @param packed whether to decompress or not. + */ +async function downloadPluginAsync( + requestService: RequestService, + rateLimiter: RateLimiter, + failures: string[], + plugin: string, + pluginUrl: string, + pluginsDir: string, + packed: boolean, + excludedIds: Set, + version?: string +): Promise { + if (!plugin) { + return; + } + let fileExt: string; + if (pluginUrl.endsWith('tar.gz')) { + fileExt = '.tar.gz'; + } else if (pluginUrl.endsWith('vsix')) { + fileExt = '.vsix'; + } else if (pluginUrl.endsWith('theia')) { + fileExt = '.theia'; // theia plugins. + } else { + failures.push(chalk.red(`error: '${plugin}' has an unsupported file type: '${pluginUrl}'`)); + return; + } + const targetPath = path.resolve(pluginsDir, `${plugin}${packed === true ? fileExt : ''}`); + + // Skip plugins which have previously been downloaded. + if (await isDownloaded(targetPath)) { + console.warn('- ' + plugin + ': already downloaded - skipping'); + return; + } + + const maxAttempts = 5; + const retryDelay = 2000; + + let attempts: number; + let lastError: Error | undefined; + let response: RequestContext | undefined; + + for (attempts = 0; attempts < maxAttempts; attempts++) { + if (attempts > 0) { + await new Promise(resolve => setTimeout(resolve, retryDelay)); + } + lastError = undefined; + try { + await rateLimiter.removeTokens(1); + response = await requestService.request({ + url: pluginUrl + }); + } catch (error) { + lastError = error; + continue; + } + const status = response.res.statusCode; + const retry = status && (status === 429 || status === 439 || status >= 500); + if (!retry) { + break; + } + } + if (lastError) { + failures.push(chalk.red(`x ${plugin}: failed to download, last error:\n ${lastError}`)); + return; + } + if (typeof response === 'undefined') { + failures.push(chalk.red(`x ${plugin}: failed to download (unknown reason)`)); + return; + } + if (response.res.statusCode !== 200) { + failures.push(chalk.red(`x ${plugin}: failed to download with: ${response.res.statusCode}`)); + return; + } + + if ((fileExt === '.vsix' || fileExt === '.theia')) { + if (packed) { + // Download .vsix without decompressing. + await fs.writeFile(targetPath, response.buffer); + } else { + await decompressVsix(targetPath, response.buffer); + } + console.warn(chalk.green(`+ ${plugin}${version ? `@${version}` : ''}: downloaded successfully ${attempts > 1 ? `(after ${attempts} attempts)` : ''}`)); + } else if (fileExt === '.tar.gz') { + // Write the downloaded tar.gz to a temporary file for decompression. + const tempFile = temp.path('theia-plugin-download'); + await fs.writeFile(tempFile, response.buffer); + // Decompress to inspect archive contents and determine handling strategy. + const files = await decompress(tempFile); + // Check if the archive is a bundle containing only .vsix files. + const allVsix = files.length > 0 && files.every(file => file.path.endsWith('.vsix')); + + if (allVsix) { + // Handle pure vsix bundle: process each vsix individually. + for (const file of files) { + const vsixName = path.basename(file.path); + const pluginId = vsixName.replace(/\.vsix$/, ''); + if (excludedIds.has(pluginId)) { + console.log(chalk.yellow(`'${pluginId}' referred to by '${plugin}' (tar.gz) is excluded because of 'theiaPluginsExcludeIds'`)); + continue; + } + const vsixTargetPath = packed + ? path.join(pluginsDir, vsixName) + : path.join(pluginsDir, pluginId); + if (await isDownloaded(vsixTargetPath)) { + console.warn('- ' + pluginId + ': already downloaded - skipping'); + continue; + } + if (packed) { + // Download .vsix without decompressing. + await fs.writeFile(vsixTargetPath, file.data); + } else { + await decompressVsix(vsixTargetPath, file.data); + } + + console.warn(chalk.green(`+ ${pluginId}: downloaded successfully ${attempts > 1 ? `(after ${attempts} attempts)` : ''}`)); + } + } else { + // Handle regular tar.gz: decompress directly to target directory. + await fs.mkdir(targetPath, { recursive: true }); + await decompress(tempFile, targetPath); + console.warn(chalk.green(`+ ${plugin}${version ? `@${version}` : ''}: downloaded successfully ${attempts > 1 ? `(after ${attempts} attempts)` : ''}`)); + } + await fs.unlink(tempFile); + } +} + +/** + * Decompresses a VSIX plugin archive to a target directory. + * + * Creates the target directory if it doesn't exist, writes the buffer content + * to a temporary file, and then extracts the archive contents to the target path. + * + * @param targetPath the directory path where the VSIX contents will be extracted. + * @param buffer the VSIX file content as a binary buffer or string. + */ +async function decompressVsix(targetPath: string, buffer: Uint8Array | string): Promise { + await fs.mkdir(targetPath, { recursive: true }); + const tempFile = temp.path('theia-plugin-download'); + await fs.writeFile(tempFile, buffer); + await decompress(tempFile, targetPath); + await fs.unlink(tempFile); +} + +/** + * Determine if the resource for the given path is already downloaded. + * @param filePath the resource path. + * + * @returns `true` if the resource is already downloaded, else `false`. + */ +async function isDownloaded(filePath: string): Promise { + return fs.stat(filePath).then(() => true, () => false); +} + +/** + * Walk the plugin directory and collect available extension paths. + * @param pluginDir the plugin directory. + * @returns the list of all available extension paths. + */ +async function collectPackageJsonPaths(pluginDir: string): Promise { + const packageJsonPathList: string[] = []; + const files = await fs.readdir(pluginDir); + // Recursively fetch the list of extension `package.json` files. + for (const file of files) { + const filePath = path.join(pluginDir, file); + if ((await fs.stat(filePath)).isDirectory()) { + packageJsonPathList.push(...await collectPackageJsonPaths(filePath)); + } else if (path.basename(filePath) === 'package.json' && !path.dirname(filePath).includes('node_modules')) { + packageJsonPathList.push(filePath); + } + } + return packageJsonPathList; +} + +/** + * Get the mapping of extension-pack paths and their included plugin ids. + * - If an extension-pack references an explicitly excluded `id` the `id` will be omitted. + * @param pluginDir the plugin directory. + * @param excludedIds the list of plugin ids to exclude. + * @returns the mapping of extension-pack paths and their included plugin ids. + */ +async function collectExtensionPacks(pluginDir: string, excludedIds: Set): Promise> { + const extensionPackPaths = new Map(); + const packageJsonPaths = await collectPackageJsonPaths(pluginDir); + await Promise.all(packageJsonPaths.map(async packageJsonPath => { + const json = JSON.parse(await fs.readFile(packageJsonPath, 'utf8')); + const extensionPack: unknown = json.extensionPack; + if (Array.isArray(extensionPack)) { + extensionPackPaths.set(packageJsonPath, extensionPack.filter(id => { + if (excludedIds.has(id)) { + console.log(chalk.yellow(`'${id}' referred to by '${json.name}' (ext pack) is excluded because of 'theiaPluginsExcludeIds'`)); + return false; // remove + } + return true; // keep + })); + } + })); + return extensionPackPaths; +} + +/** + * Get the mapping of paths and their included plugin ids. + * - If an extension-pack references an explicitly excluded `id` the `id` will be omitted. + * @param pluginDir the plugin directory. + * @param excludedIds the list of plugin ids to exclude. + * @returns the mapping of extension-pack paths and their included plugin ids. + */ +async function collectPluginDependencies(pluginDir: string, excludedIds: Set): Promise { + const dependencyIds: string[] = []; + const packageJsonPaths = await collectPackageJsonPaths(pluginDir); + await Promise.all(packageJsonPaths.map(async packageJsonPath => { + const json = JSON.parse(await fs.readFile(packageJsonPath, 'utf8')); + const extensionDependencies: unknown = json.extensionDependencies; + if (Array.isArray(extensionDependencies)) { + for (const dependency of extensionDependencies) { + if (excludedIds.has(dependency)) { + console.log(chalk.yellow(`'${dependency}' referred to by '${json.name}' is excluded because of 'theiaPluginsExcludeIds'`)); + } else { + dependencyIds.push(dependency); + } + } + } + })); + return dependencyIds; +} diff --git a/dev-packages/cli/src/run-test.ts b/dev-packages/cli/src/run-test.ts new file mode 100644 index 0000000..4e4d409 --- /dev/null +++ b/dev-packages/cli/src/run-test.ts @@ -0,0 +1,88 @@ +// ***************************************************************************** +// Copyright (C) 2020 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +/* eslint-disable @typescript-eslint/no-explicit-any */ + +import * as net from 'net'; +import * as puppeteer from 'puppeteer-core'; +import newTestPage, { TestFileOptions } from './test-page'; + +export interface TestOptions { + start: () => Promise + launch?: puppeteer.PuppeteerLaunchOptions + files?: Partial + coverage?: boolean +} + +export default async function runTest(options: TestOptions): Promise { + const { start, launch } = options; + const exit = !(launch && launch.devtools); + + const testPage = await newTestPage({ + files: options.files, + matchAppUrl: () => true, // all urls are application urls + newPage: async () => { + const browser = await puppeteer.launch(launch); + // re-use empty tab + const [tab] = await browser.pages(); + return tab; + }, + onWillRun: async () => { + const promises = []; + if (options.coverage) { + promises.push(testPage.coverage.startJSCoverage()); + promises.push(testPage.coverage.startCSSCoverage()); + } + // When launching in non-headless mode (with a UI and dev-tools open), make sure + // the app has focus, to avoid failures of tests that query the UI's state. + if (launch && launch.devtools) { + promises.push(testPage.waitForSelector('#theia-app-shell.lm-Widget.theia-ApplicationShell') + .then(e => { + // eslint-disable-next-line no-null/no-null + if (e !== null) { + e.click(); + } + })); + } + + // Clear application's local storage to avoid reusing previous state + promises.push(testPage.evaluate(() => localStorage.clear())); + await Promise.all(promises); + }, + onDidRun: async failures => { + if (options.coverage) { + console.log('collecting test coverage...'); + const [jsCoverage, cssCoverage] = await Promise.all([ + testPage.coverage.stopJSCoverage(), + testPage.coverage.stopCSSCoverage(), + ]); + require('puppeteer-to-istanbul').write([...jsCoverage, ...cssCoverage]); + } + if (exit) { + // allow a bit of time to finish printing-out test results + await new Promise(resolve => setTimeout(resolve, 1000)); + await testPage.close(); + process.exit(failures > 0 ? 1 : 0); + } + } + }); + const { address, port } = await start(); + const url = net.isIPv6(address) + ? `http://[${address}]:${port}` + : `http://${address}:${port}`; + await testPage.goto(url); + await testPage.bringToFront(); +} diff --git a/dev-packages/cli/src/test-page.ts b/dev-packages/cli/src/test-page.ts new file mode 100644 index 0000000..2f6017d --- /dev/null +++ b/dev-packages/cli/src/test-page.ts @@ -0,0 +1,138 @@ +// ***************************************************************************** +// Copyright (C) 2020 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +/* eslint-disable @typescript-eslint/no-explicit-any */ + +import * as puppeteer from 'puppeteer-core'; +const collectFiles: (options: TestFileOptions) => { files: string[] } = require('mocha/lib/cli/collect-files'); + +export interface TestFileOptions { + ignore: string[] + extension: string[] + file: string[] + recursive: boolean + sort: boolean + spec: string[] +} + +export interface TestPageOptions { + files?: Partial + newPage: () => Promise + matchAppUrl?: (url: string) => boolean + onWillRun?: () => Promise + onDidRun?: (failures: number) => Promise +} + +export default async function newTestPage(options: TestPageOptions): Promise { + const { newPage, matchAppUrl, onWillRun, onDidRun } = options; + + const fileOptions: TestFileOptions = { + ignore: options.files && options.files.ignore || [], + extension: options.files && options.files.extension || [], + file: options.files && options.files.file || [], + spec: options.files && options.files.spec || [], + recursive: options.files && options.files.recursive || false, + sort: options.files && options.files.sort || false + }; + + // quick check whether test files exist + const files = collectFiles(fileOptions); + + const page = await newPage(); + page.on('dialog', dialog => dialog.dismiss()); + page.on('pageerror', console.error); + + let theiaLoaded = false; + page.exposeFunction('fireDidUnloadTheia', () => theiaLoaded = false); + const preLoad = (frame: puppeteer.Frame) => { + const frameUrl = frame.url(); + if (matchAppUrl && !matchAppUrl(frameUrl)) { + return; + } + if (theiaLoaded) { + return; + } + console.log('loading chai...'); + theiaLoaded = true; + page.addScriptTag({ path: require.resolve('chai/chai.js') }); + page.evaluate(() => + window.addEventListener('beforeunload', () => (window as any)['fireDidUnloadTheia']()) + ); + }; + page.on('frameattached', preLoad); + page.on('framenavigated', preLoad); + + page.on('load', async () => { + if (matchAppUrl && !matchAppUrl(page.url())) { + return; + } + console.log('loading mocha...'); + // replace console.log by theia logger for mocha + await page.waitForFunction(() => !!(window as any)['theia']?.['@theia/core/lib/common/logger']?.logger, { + timeout: 30 * 1000 + }); + await page.addScriptTag({ path: require.resolve('mocha/mocha.js') }); + await page.waitForFunction(() => !!(window as any)['chai'] && !!(window as any)['mocha'] && !!(window as any)['theia'].container, { timeout: 30 * 1000 }); + + console.log('loading Theia...'); + await page.evaluate(() => { + const { FrontendApplicationStateService } = (window as any)['theia']['@theia/core/lib/browser/frontend-application-state']; + const { PreferenceService } = (window as any)['theia']['@theia/core/lib/common/preferences/preference-service']; + const { WorkspaceService } = (window as any)['theia']['@theia/workspace/lib/browser/workspace-service']; + + const container = (window as any)['theia'].container; + const frontendApplicationState = container.get(FrontendApplicationStateService); + const preferenceService = container.get(PreferenceService); + const workspaceService = container.get(WorkspaceService); + + return Promise.all([ + frontendApplicationState.reachedState('ready'), + preferenceService.ready, + workspaceService.roots + ]); + }); + + console.log('loading test files...'); + await page.evaluate(() => { + // replace require to load modules from theia namespace + (window as any)['require'] = (moduleName: string) => (window as any)['theia'][moduleName]; + mocha.setup({ + reporter: 'spec', + ui: 'bdd', + color: true, + retries: 0, + timeout: 10000 + }); + }); + + if (onWillRun) { + await onWillRun(); + } + + for (const file of files.files) { + await page.addScriptTag({ path: file }); + } + + console.log('running test files...'); + const failures = await page.evaluate(() => + new Promise(resolve => mocha.run(resolve)) + ); + if (onDidRun) { + await onDidRun(failures); + } + }); + return page; +} diff --git a/dev-packages/cli/src/theia.ts b/dev-packages/cli/src/theia.ts new file mode 100644 index 0000000..ffc6b47 --- /dev/null +++ b/dev-packages/cli/src/theia.ts @@ -0,0 +1,704 @@ +// ***************************************************************************** +// Copyright (C) 2017 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import * as fs from 'fs'; +import * as path from 'path'; +import * as temp from 'temp'; +import * as yargs from 'yargs'; +import yargsFactory = require('yargs/yargs'); +import { ApplicationPackageManager, rebuild } from '@theia/application-manager'; +import { ApplicationProps, DEFAULT_SUPPORTED_API_VERSION } from '@theia/application-package'; +import checkDependencies from './check-dependencies'; +import downloadPlugins from './download-plugins'; +import runTest from './run-test'; +import { RateLimiter } from 'limiter'; +import { LocalizationManager, extract } from '@theia/localization-manager'; +import { NodeRequestService } from '@theia/request/lib/node-request-service'; +import { ExtensionIdMatchesFilterFactory, OVSX_RATE_LIMIT, OVSXClient, OVSXHttpClient, OVSXRouterClient, RequestContainsFilterFactory } from '@theia/ovsx-client'; + +const { executablePath } = require('puppeteer'); + +process.on('unhandledRejection', (reason, promise) => { + throw reason; +}); +process.on('uncaughtException', error => { + if (error) { + console.error('Uncaught Exception: ', error.toString()); + if (error.stack) { + console.error(error.stack); + } + } + process.exit(1); +}); +theiaCli(); + +function toStringArray(argv: (string | number)[]): string[]; +function toStringArray(argv?: (string | number)[]): string[] | undefined; +function toStringArray(argv?: (string | number)[]): string[] | undefined { + return argv?.map(arg => String(arg)); +} + +function rebuildCommand(command: string, target: ApplicationProps.Target): yargs.CommandModule { + return { + command, + describe: `Rebuild/revert native node modules for "${target}"`, + builder: { + 'cacheRoot': { + type: 'string', + describe: 'Root folder where to store the .browser_modules cache' + }, + 'modules': { + alias: 'm', + type: 'array', // === `--modules/-m` can be specified multiple times + describe: 'List of modules to rebuild/revert' + }, + 'forceAbi': { + type: 'number', + describe: 'The Node ABI version to rebuild for' + } + }, + handler: ({ cacheRoot, modules, forceAbi }) => { + // Note: `modules` is actually `string[] | undefined`. + if (modules) { + // It is ergonomic to pass arguments as --modules="a,b,c,..." + // but yargs doesn't parse it this way by default. + const flattened: string[] = []; + for (const value of modules) { + if (value.includes(',')) { + flattened.push(...value.split(',').map(mod => mod.trim())); + } else { + flattened.push(value); + } + } + modules = flattened; + } + rebuild(target, { cacheRoot, modules, forceAbi }); + } + }; +} + +function defineCommonOptions(cli: yargs.Argv): yargs.Argv { + return cli + .option('app-target', { + description: 'The target application type. Overrides `theia.target` in the application\'s package.json', + choices: ['browser', 'electron', 'browser-only'] as const, + }); +} + +async function theiaCli(): Promise { + const { version } = await fs.promises.readFile(path.join(__dirname, '../package.json'), 'utf8').then(JSON.parse); + yargs.scriptName('theia').version(version); + const projectPath = process.cwd(); + // Create a sub `yargs` parser to read `app-target` without + // affecting the global `yargs` instance used by the CLI. + const { appTarget } = defineCommonOptions(yargsFactory()).help(false).parse(); + const manager = new ApplicationPackageManager({ projectPath, appTarget }); + const localizationManager = new LocalizationManager(); + const { target } = manager.pck; + defineCommonOptions(yargs) + .command<{ + theiaArgs?: (string | number)[] + }>({ + command: 'start [theia-args...]', + describe: `Start the ${target} backend`, + // Disable this command's `--help` option so that it is forwarded to Theia's CLI + builder: cli => cli.help(false) as yargs.Argv, + handler: async ({ theiaArgs }) => { + manager.start(toStringArray(theiaArgs)); + } + }) + .command({ + command: 'clean', + describe: `Clean for the ${target} target`, + handler: async () => { + await manager.clean(); + } + }) + .command({ + command: 'copy', + describe: 'Copy various files from `src-gen` to `lib`', + handler: async () => { + await manager.copy(); + } + }) + .command<{ + mode: 'development' | 'production', + splitFrontend?: boolean + }>({ + command: 'generate', + describe: `Generate various files for the ${target} target`, + builder: cli => ApplicationPackageManager.defineGeneratorOptions(cli), + handler: async ({ mode, splitFrontend }) => { + await manager.generate({ mode, splitFrontend }); + } + }) + .command<{ + mode: 'development' | 'production', + webpackHelp: boolean + splitFrontend?: boolean + webpackArgs?: (string | number)[] + }>({ + command: 'build [webpack-args...]', + describe: `Generate and bundle the ${target} frontend using webpack`, + builder: cli => ApplicationPackageManager.defineGeneratorOptions(cli) + .option('webpack-help' as 'webpackHelp', { + boolean: true, + description: 'Display Webpack\'s help', + default: false + }), + handler: async ({ mode, splitFrontend, webpackHelp, webpackArgs = [] }) => { + await manager.build( + webpackHelp + ? ['--help'] + : [ + // Forward the `mode` argument to Webpack too: + '--mode', mode, + ...toStringArray(webpackArgs) + ], + { mode, splitFrontend } + ); + } + }) + .command(rebuildCommand('rebuild', target)) + .command(rebuildCommand('rebuild:browser', 'browser')) + .command(rebuildCommand('rebuild:electron', 'electron')) + .command<{ + suppress: boolean + }>({ + command: 'check:hoisted', + describe: 'Check that all dependencies are hoisted', + builder: { + 'suppress': { + alias: 's', + describe: 'Suppress exiting with failure code', + boolean: true, + default: false + } + }, + handler: ({ suppress }) => { + checkDependencies({ + workspaces: ['packages/*'], + include: ['**'], + exclude: ['.bin/**', '.cache/**'], + skipHoisted: false, + skipUniqueness: true, + skipSingleTheiaVersion: true, + onlyTheiaExtensions: false, + suppress + }); + } + }) + .command<{ + suppress: boolean + }>({ + command: 'check:theia-version', + describe: 'Check that all dependencies have been resolved to the same Theia version', + builder: { + 'suppress': { + alias: 's', + describe: 'Suppress exiting with failure code', + boolean: true, + default: false + } + }, + handler: ({ suppress }) => { + checkDependencies({ + workspaces: undefined, + include: ['@theia/**'], + exclude: [], + skipHoisted: true, + skipUniqueness: false, + skipSingleTheiaVersion: false, + onlyTheiaExtensions: false, + suppress + }); + } + }) + .command<{ + suppress: boolean + }>({ + command: 'check:theia-extensions', + describe: 'Check uniqueness of Theia extension versions or whether they are hoisted', + builder: { + 'suppress': { + alias: 's', + describe: 'Suppress exiting with failure code', + boolean: true, + default: false + } + }, + handler: ({ suppress }) => { + checkDependencies({ + workspaces: undefined, + include: ['**'], + exclude: [], + skipHoisted: true, + skipUniqueness: false, + skipSingleTheiaVersion: true, + onlyTheiaExtensions: true, + suppress + }); + } + }) + .command<{ + workspaces: string[] | undefined, + include: string[], + exclude: string[], + skipHoisted: boolean, + skipUniqueness: boolean, + skipSingleTheiaVersion: boolean, + onlyTheiaExtensions: boolean, + suppress: boolean + }>({ + command: 'check:dependencies', + describe: 'Check uniqueness of dependency versions or whether they are hoisted', + builder: { + 'workspaces': { + alias: 'w', + describe: 'Glob patterns of workspaces to analyze, relative to `cwd`', + array: true, + defaultDescription: 'All glob patterns listed in the package.json\'s workspaces', + demandOption: false + }, + 'include': { + alias: 'i', + describe: 'Glob pattern of dependencies\' package names to be included, e.g. -i "@theia/**"', + array: true, + default: ['**'] + }, + 'exclude': { + alias: 'e', + describe: 'Glob pattern of dependencies\' package names to be excluded', + array: true, + defaultDescription: 'None', + default: [] + }, + 'skip-hoisted': { + alias: 'h', + describe: 'Skip checking whether dependencies are hoisted', + boolean: true, + default: false + }, + 'skip-uniqueness': { + alias: 'u', + describe: 'Skip checking whether all dependencies are resolved to a unique version', + boolean: true, + default: false + }, + 'skip-single-theia-version': { + alias: 't', + describe: 'Skip checking whether all @theia/* dependencies are resolved to a single version', + boolean: true, + default: false + }, + 'only-theia-extensions': { + alias: 'o', + describe: 'Only check dependencies which are Theia extensions', + boolean: true, + default: false + }, + 'suppress': { + alias: 's', + describe: 'Suppress exiting with failure code', + boolean: true, + default: false + } + }, + handler: ({ + workspaces, + include, + exclude, + skipHoisted, + skipUniqueness, + skipSingleTheiaVersion, + onlyTheiaExtensions, + suppress + }) => { + checkDependencies({ + workspaces, + include, + exclude, + skipHoisted, + skipUniqueness, + skipSingleTheiaVersion, + onlyTheiaExtensions, + suppress + }); + } + }) + .command<{ + packed: boolean + ignoreErrors: boolean + apiVersion: string + apiUrl: string + parallel: boolean + proxyUrl?: string + proxyAuthorization?: string + strictSsl: boolean + rateLimit: number + ovsxRouterConfig?: string + }>({ + command: 'download:plugins', + describe: 'Download defined external plugins', + builder: { + 'packed': { + alias: 'p', + describe: 'Controls whether to pack or unpack plugins', + boolean: true, + default: false, + }, + 'ignore-errors': { + alias: 'i', + describe: 'Ignore errors while downloading plugins', + boolean: true, + default: false, + }, + 'api-version': { + alias: 'v', + describe: 'Supported API version for plugins', + default: DEFAULT_SUPPORTED_API_VERSION + }, + 'api-url': { + alias: 'u', + describe: 'Open-VSX Registry API URL', + default: 'https://open-vsx.org/api' + }, + 'parallel': { + describe: 'Download in parallel', + boolean: true, + default: true + }, + 'rate-limit': { + describe: 'Amount of maximum open-vsx requests per second', + number: true, + default: OVSX_RATE_LIMIT + }, + 'proxy-url': { + describe: 'Proxy URL' + }, + 'proxy-authorization': { + describe: 'Proxy authorization information' + }, + 'strict-ssl': { + describe: 'Whether to enable strict SSL mode', + boolean: true, + default: false + }, + 'ovsx-router-config': { + describe: 'JSON configuration file for the OVSX router client', + type: 'string' + } + }, + handler: async ({ apiUrl, proxyUrl, proxyAuthorization, strictSsl, ovsxRouterConfig, ...options }) => { + const requestService = new NodeRequestService(); + await requestService.configure({ + proxyUrl, + proxyAuthorization, + strictSSL: strictSsl + }); + let client: OVSXClient | undefined; + const rateLimiter = new RateLimiter({ tokensPerInterval: options.rateLimit, interval: 'second' }); + if (ovsxRouterConfig) { + const routerConfig = await fs.promises.readFile(ovsxRouterConfig, 'utf8').then(JSON.parse, error => { + console.error(error); + }); + if (routerConfig) { + client = await OVSXRouterClient.FromConfig( + routerConfig, + OVSXHttpClient.createClientFactory(requestService, rateLimiter), + [RequestContainsFilterFactory, ExtensionIdMatchesFilterFactory] + ); + } + } + if (!client) { + client = new OVSXHttpClient(apiUrl, requestService, rateLimiter); + } + try { + await downloadPlugins(client, rateLimiter, requestService, options); + } catch (error) { + console.error(error); + process.exit(1); + } + process.exit(0); + }, + }) + .command<{ + freeApi?: boolean, + deeplKey: string, + file: string, + languages: string[], + sourceLanguage?: string + }>({ + command: 'nls-localize [languages...]', + describe: 'Localize json files using the DeepL API', + builder: { + 'file': { + alias: 'f', + describe: 'The source file which should be translated', + demandOption: true + }, + 'deepl-key': { + alias: 'k', + describe: 'DeepL key used for API access. See https://www.deepl.com/docs-api for more information', + demandOption: true + }, + 'free-api': { + describe: 'Indicates whether the specified DeepL API key belongs to the free API', + boolean: true, + default: false, + }, + 'source-language': { + alias: 's', + describe: 'The source language of the translation file' + } + }, + handler: async ({ freeApi, deeplKey, file, sourceLanguage, languages = [] }) => { + const success = await localizationManager.localize({ + sourceFile: file, + freeApi: freeApi ?? true, + authKey: deeplKey, + targetLanguages: languages, + sourceLanguage + }); + if (!success) { + process.exit(1); + } + } + }) + .command<{ + root: string, + output: string, + merge: boolean, + exclude?: string, + logs?: string, + files?: string[], + quiet: boolean + }>({ + command: 'nls-extract', + describe: 'Extract translation key/value pairs from source code', + builder: { + 'output': { + alias: 'o', + describe: 'Output file for the extracted translations', + demandOption: true + }, + 'root': { + alias: 'r', + describe: 'The directory which contains the source code', + default: '.' + }, + 'merge': { + alias: 'm', + describe: 'Whether to merge new with existing translation values', + boolean: true, + default: false + }, + 'exclude': { + alias: 'e', + describe: 'Allows to exclude translation keys starting with this value' + }, + 'files': { + alias: 'f', + describe: 'Glob pattern matching the files to extract from (starting from --root).', + array: true + }, + 'logs': { + alias: 'l', + describe: 'File path to a log file' + }, + 'quiet': { + alias: 'q', + describe: 'Prevents errors from being logged to console', + boolean: true, + default: false + } + }, + handler: async options => { + await extract(options); + } + }) + .command<{ + testInspect: boolean, + testExtension: string[], + testFile: string[], + testIgnore: string[], + testRecursive: boolean, + testSort: boolean, + testSpec: string[], + testCoverage: boolean + theiaArgs?: (string | number)[] + }>({ + command: 'test [theia-args...]', + builder: { + 'test-inspect': { + describe: 'Whether to auto-open a DevTools panel for test page.', + boolean: true, + default: false + }, + 'test-extension': { + describe: 'Test file extension(s) to load', + array: true, + default: ['js'] + }, + 'test-file': { + describe: 'Specify test file(s) to be loaded prior to root suite execution', + array: true, + default: [] + }, + 'test-ignore': { + describe: 'Ignore test file(s) or glob pattern(s)', + array: true, + default: [] + }, + 'test-recursive': { + describe: 'Look for tests in subdirectories', + boolean: true, + default: false + }, + 'test-sort': { + describe: 'Sort test files', + boolean: true, + default: false + }, + 'test-spec': { + describe: 'One or more test files, directories, or globs to test', + array: true, + default: ['test'] + }, + 'test-coverage': { + describe: 'Report test coverage consumable by istanbul', + boolean: true, + default: false + } + }, + handler: async ({ testInspect, testExtension, testFile, testIgnore, testRecursive, testSort, testSpec, testCoverage, theiaArgs }) => { + if (!process.env.THEIA_CONFIG_DIR) { + process.env.THEIA_CONFIG_DIR = temp.track().mkdirSync('theia-test-config-dir'); + } + const args = ['--no-sandbox']; + if (!testInspect) { + args.push('--headless=old'); + } + await runTest({ + start: () => new Promise((resolve, reject) => { + const serverProcess = manager.start(toStringArray(theiaArgs)); + serverProcess.on('message', resolve); + serverProcess.on('error', reject); + serverProcess.on('close', (code, signal) => reject(`Server process exited unexpectedly: ${code ?? signal}`)); + }), + launch: { + args: args, + // eslint-disable-next-line no-null/no-null + defaultViewport: null, // view port can take available space instead of 800x600 default + devtools: testInspect, + headless: testInspect ? false : 'shell', + executablePath: executablePath(), + protocolTimeout: 600000, + timeout: 60000 + }, + files: { + extension: testExtension, + file: testFile, + ignore: testIgnore, + recursive: testRecursive, + sort: testSort, + spec: testSpec + }, + coverage: testCoverage + }); + } + }) + .command<{ + electronVersion?: string + electronDist?: string + ffmpegPath?: string + platform?: NodeJS.Platform + }>({ + command: 'ffmpeg:replace [ffmpeg-path]', + describe: '', + builder: { + 'electronDist': { + description: 'Electron distribution location.', + }, + 'electronVersion': { + description: 'Electron version for which to pull the "clean" ffmpeg library.', + }, + 'ffmpegPath': { + description: 'Absolute path to the ffmpeg shared library.', + }, + 'platform': { + description: 'Dictates where the library is located within the Electron distribution.', + choices: ['darwin', 'linux', 'win32'] as NodeJS.Platform[], + }, + }, + handler: async options => { + const ffmpeg = await import('@theia/ffmpeg'); + await ffmpeg.replaceFfmpeg(options); + }, + }) + .command<{ + electronDist?: string + ffmpegPath?: string + json?: boolean + platform?: NodeJS.Platform + }>({ + command: 'ffmpeg:check [ffmpeg-path]', + describe: '(electron-only) Check that ffmpeg doesn\'t contain proprietary codecs', + builder: { + 'electronDist': { + description: 'Electron distribution location', + }, + 'ffmpegPath': { + describe: 'Absolute path to the ffmpeg shared library', + }, + 'json': { + description: 'Output the found codecs as JSON on stdout', + boolean: true, + }, + 'platform': { + description: 'Dictates where the library is located within the Electron distribution', + choices: ['darwin', 'linux', 'win32'] as NodeJS.Platform[], + }, + }, + handler: async options => { + const ffmpeg = await import('@theia/ffmpeg'); + await ffmpeg.checkFfmpeg(options); + }, + }) + .parserConfiguration({ + 'unknown-options-as-args': true, + }) + .strictCommands() + .demandCommand(1, 'Please run a command') + .fail((msg, err, cli) => { + process.exitCode = 1; + if (err) { + // One of the handlers threw an error: + console.error(err); + } else { + // Yargs detected a problem with commands and/or arguments while parsing: + cli.showHelp(); + console.error(msg); + } + }) + .parse(); +} diff --git a/dev-packages/cli/tsconfig.json b/dev-packages/cli/tsconfig.json new file mode 100644 index 0000000..306d9ef --- /dev/null +++ b/dev-packages/cli/tsconfig.json @@ -0,0 +1,31 @@ +{ + "extends": "../../configs/base.tsconfig", + "compilerOptions": { + "composite": true, + "rootDir": "src", + "outDir": "lib" + }, + "include": [ + "src" + ], + "references": [ + { + "path": "../application-manager" + }, + { + "path": "../application-package" + }, + { + "path": "../ffmpeg" + }, + { + "path": "../localization-manager" + }, + { + "path": "../ovsx-client" + }, + { + "path": "../request" + } + ] +} diff --git a/dev-packages/ffmpeg/.eslintrc.js b/dev-packages/ffmpeg/.eslintrc.js new file mode 100644 index 0000000..1308994 --- /dev/null +++ b/dev-packages/ffmpeg/.eslintrc.js @@ -0,0 +1,10 @@ +/** @type {import('eslint').Linter.Config} */ +module.exports = { + extends: [ + '../../configs/build.eslintrc.json' + ], + parserOptions: { + tsconfigRootDir: __dirname, + project: 'tsconfig.json' + } +}; diff --git a/dev-packages/ffmpeg/README.md b/dev-packages/ffmpeg/README.md new file mode 100644 index 0000000..781e9c9 --- /dev/null +++ b/dev-packages/ffmpeg/README.md @@ -0,0 +1,3 @@ +# `ffmeg.node` + +This is a [Node Native Addon](https://nodejs.org/docs/latest-v14.x/api/n-api.html) to dynamically link to Electron's `ffmpeg.dll` and fetch a list of included codecs. diff --git a/dev-packages/ffmpeg/binding.gyp b/dev-packages/ffmpeg/binding.gyp new file mode 100644 index 0000000..8105fe8 --- /dev/null +++ b/dev-packages/ffmpeg/binding.gyp @@ -0,0 +1,29 @@ +{ + 'targets': [{ + 'defines': ['NAPI_VERSION=2'], + 'target_name': 'ffmpeg', + 'sources': [ + 'native/ffmpeg.c', + ], + 'conditions': [ + ['OS=="linux"', { + 'sources': [ + 'native/linux-ffmpeg.c', + ], + 'libraries': [ + '-ldl', + ] + }], + ['OS=="mac"', { + 'sources': [ + 'native/mac-ffmpeg.c', + ] + }], + ['OS=="win"', { + 'sources': [ + 'native/win-ffmpeg.c', + ] + }], + ], + }], +} diff --git a/dev-packages/ffmpeg/native/ffmpeg.c b/dev-packages/ffmpeg/native/ffmpeg.c new file mode 100644 index 0000000..192cf13 --- /dev/null +++ b/dev-packages/ffmpeg/native/ffmpeg.c @@ -0,0 +1,146 @@ +// ***************************************************************************** +// Copyright (C) 2019 Ericsson and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +/** + * https://nodejs.org/docs/latest-v10.x/api/n-api.html#n_api_n_api + */ +#include + +#include + +#include "ffmpeg.h" + +/** + * Return the list of codecs registered in the FFMPEG library. + */ +napi_value codecs(napi_env env, napi_callback_info info) +{ + // We will reuse this `status` for all napi calls. + napi_status status; + char *error = NULL; + + // Get arguments. + size_t argc = 1; + napi_value argv[1]; + status = napi_get_cb_info(env, info, &argc, argv, NULL, NULL); + if (status != napi_ok || argc < 1) + { + error = "invalid arguments"; + goto error; + } + + // Get first argument as string. + char path[2048]; + status = napi_get_value_string_utf8(env, argv[0], path, 2048, NULL); + if (status != napi_ok) + { + error = "invalid string argument"; + goto error; + } + + // Load ffmpeg based on the provided path. + struct FFMPEG_Library ffmpeg = NULL_FFMPEG_LIBRARY; + char *load_error = load_ffmpeg_library(&ffmpeg, path); + if (load_error != NULL) + { + error = load_error; + goto error; + } + + // Create the JavaScript list that will be returned. + napi_value codecs; + status = napi_create_array(env, &codecs); + if (status != napi_ok) + { + error = "napi_create_array fail"; + goto error; + } + + // Iterate over the codec descriptions. + // It includes descriptions for codecs that may not be present in the library. + struct AVCodecDescriptor *descriptor = ffmpeg.avcodec_descriptor_next(NULL); + while (descriptor != NULL) + { + // Try to fetch the codec being described, returns null on missing codecs. + struct AVCodec *decoder = ffmpeg.avcodec_find_decoder(descriptor->id); + if (decoder != NULL) + { + // Create the codec object and assign the properties. + napi_value object, value; + napi_create_object(env, &object); + + // id: number + napi_create_int32(env, decoder->id, &value); + napi_set_named_property(env, object, "id", value); + + // name: string + napi_create_string_utf8(env, decoder->name, strlen(decoder->name), &value); + napi_set_named_property(env, object, "name", value); + + // longName: string + napi_create_string_utf8(env, decoder->long_name, strlen(decoder->long_name), &value); + napi_set_named_property(env, object, "longName", value); + + // Pushing into a JS array requires calling the JS method for that. + napi_value push_fn; + napi_get_named_property(env, codecs, "push", &push_fn); + napi_call_function(env, codecs, push_fn, 1, (napi_value[]){object}, NULL); + } + descriptor = ffmpeg.avcodec_descriptor_next(descriptor); + } + + // Free the ffmpeg library. + char *unload_error = unload_ffmpeg_library(&ffmpeg); + if (unload_error != NULL) + { + error = unload_error; + goto error; + } + + return codecs; + +error: + if (error != NULL) + { + napi_throw_error(env, NULL, error); + } + return NULL; +} + +/** + * https://nodejs.org/docs/latest-v10.x/api/n-api.html#n_api_module_registration + */ +napi_value initialize(napi_env env, napi_value exports) +{ + napi_status status; + napi_value function_codecs; + + status = napi_create_function(env, NULL, 0, codecs, NULL, &function_codecs); + if (status != napi_ok) + { + return NULL; + } + + status = napi_set_named_property(env, exports, "codecs", function_codecs); + if (status != napi_ok) + { + return NULL; + } + + return exports; +} + +NAPI_MODULE(NODE_GYP_MODULE_NAME, initialize); diff --git a/dev-packages/ffmpeg/native/ffmpeg.h b/dev-packages/ffmpeg/native/ffmpeg.h new file mode 100644 index 0000000..fa052ff --- /dev/null +++ b/dev-packages/ffmpeg/native/ffmpeg.h @@ -0,0 +1,80 @@ +#ifndef FFMPEG_H +#define FFMPEG_H +/** + * THIS FILE REDEFINES DATA AS RETURNED BY THE FFMPEG LIBRARY. + * HEADER FILES ARE NOT DISTRIBUTED IN OUR SETUP, HENCE THIS. + */ + +/** + * https://github.com/FFmpeg/FFmpeg/blob/release/3.2/libavutil/avutil.h#L193-L201 + */ +enum AVMediaType +{ + _UNKNOWN_DATA_AVMediaType = -1, +}; + +/** + * https://github.com/FFmpeg/FFmpeg/blob/release/3.2/libavcodec/avcodec.h#L191-L653 + */ +enum AVCodecID +{ + __UNKNOWN_DATA_AVCodecID = 0, +}; + +/** + * https://github.com/FFmpeg/FFmpeg/blob/release/3.2/libavcodec/avcodec.h#L3611-L3721 + */ +struct AVCodec +{ + const char *name, *long_name; + enum AVMediaType type; + enum AVCodecID id; +}; + +/** + * https://github.com/FFmpeg/FFmpeg/blob/release/3.2/libavcodec/avcodec.h#L660-L688 + */ +struct AVCodecDescriptor +{ + enum AVCodecID id; + enum AVMediaType type; + const char *name, *long_name; +}; + +/** + * Wrapper around the ffmpeg library that must be loaded at runtime. + */ +struct FFMPEG_Library +{ + void *handle; + + /** + * https://github.com/FFmpeg/FFmpeg/blob/release/3.2/libavcodec/avcodec.h#L6228 + * + * We use AVCodecDescriptor because it is the only structure that we can + * query on all platforms. Windows' ffmpeg.dll does not export a + * `av_codec_next` function, only `avcodec_descriptor_next`. + * Also it seems that this "descriptor" concept is the recommended API. + */ + struct AVCodecDescriptor *(*avcodec_descriptor_next)(const struct AVCodecDescriptor *); + + /** + * https://github.com/FFmpeg/FFmpeg/blob/release/3.2/libavcodec/avcodec.h#L4646 + */ + struct AVCodec *(*avcodec_find_decoder)(enum AVCodecID); +}; + +#define NULL_FFMPEG_LIBRARY \ + (struct FFMPEG_Library) { NULL, NULL, NULL } + +/** + * Loader that will inject the loaded functions into a FFMPEG_Library structure. + */ +char *load_ffmpeg_library(struct FFMPEG_Library *library, char *library_path); + +/** + * Free library. + */ +char *unload_ffmpeg_library(struct FFMPEG_Library *library); + +#endif // FFMPEG_H guard diff --git a/dev-packages/ffmpeg/native/linux-ffmpeg.c b/dev-packages/ffmpeg/native/linux-ffmpeg.c new file mode 100644 index 0000000..dd8c81c --- /dev/null +++ b/dev-packages/ffmpeg/native/linux-ffmpeg.c @@ -0,0 +1,68 @@ +// ***************************************************************************** +// Copyright (C) 2019 Ericsson and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +#ifndef LINUX_FFMPEG +#define LINUX_FFMPEG + +#include +#include + +#include "ffmpeg.h" + +char *load_ffmpeg_library(struct FFMPEG_Library *library, char *library_path) +{ + void *handle = dlopen(library_path, RTLD_NOW); + char *error = dlerror(); + if (error != NULL) + { + goto error; + } + + struct AVCodecDescriptor *(*avcodec_descriptor_next)(const struct AVCodecDescriptor *) = dlsym(handle, "avcodec_descriptor_next"); + error = dlerror(); + if (error != NULL) + { + goto error; + } + + struct AVCodec *(*avcodec_find_decoder)(enum AVCodecID) = dlsym(handle, "avcodec_find_decoder"); + error = dlerror(); + if (error != NULL) + { + goto error; + } + + library->handle = handle; + library->avcodec_descriptor_next = avcodec_descriptor_next; + library->avcodec_find_decoder = avcodec_find_decoder; + return NULL; + +error: + if (handle != NULL) + { + dlclose(handle); + } + return error; +} + +char *unload_ffmpeg_library(struct FFMPEG_Library *library) +{ + dlclose(library->handle); + *library = NULL_FFMPEG_LIBRARY; + return dlerror(); +} + +#endif // LINUX_FFMPEG guard diff --git a/dev-packages/ffmpeg/native/mac-ffmpeg.c b/dev-packages/ffmpeg/native/mac-ffmpeg.c new file mode 100644 index 0000000..4d3adb9 --- /dev/null +++ b/dev-packages/ffmpeg/native/mac-ffmpeg.c @@ -0,0 +1,26 @@ +// ***************************************************************************** +// Copyright (C) 2019 Ericsson and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +#ifndef MAC_FFMPEG +#define MAC_FFMPEG + +/** + * Mac seems to use the same libraries as Linux. + * Difference is that the compiler doesn't need to be told to use `-ldl`. + */ +#include "./linux-ffmpeg.c" + +#endif // MAC_FFMPEG guard diff --git a/dev-packages/ffmpeg/native/win-ffmpeg.c b/dev-packages/ffmpeg/native/win-ffmpeg.c new file mode 100644 index 0000000..2f819b5 --- /dev/null +++ b/dev-packages/ffmpeg/native/win-ffmpeg.c @@ -0,0 +1,77 @@ +// ***************************************************************************** +// Copyright (C) 2019 Ericsson and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** +#ifndef WIN_FFMPEG +#define WIN_FFMPEG + +#include + +#include "ffmpeg.h" + +static char *error_library_not_found = "shared library not found"; +static char *error_function_not_found = "function not found in shared library"; +static char *error_cannot_free_library = "cannot free shared library"; + +char *load_ffmpeg_library(struct FFMPEG_Library *library, char *library_path) +{ + char *error = NULL; + + HMODULE handle = LoadLibrary(library_path); + if (!handle) + { + error = error_library_not_found; + goto error; + } + + struct AVCodecDescriptor *(*av_codec_next)(const struct AVCodecDescriptor *) = (struct AVCodecDescriptor * (*)(const struct AVCodecDescriptor *)) + GetProcAddress(handle, "avcodec_descriptor_next"); + if (!av_codec_next) + { + error = error_function_not_found; + goto error; + } + + struct AVCodec *(*avcodec_find_decoder)(enum AVCodecID) = (struct AVCodec * (*)(enum AVCodecID)) + GetProcAddress(handle, "avcodec_find_decoder"); + if (!avcodec_find_decoder) + { + error = error_function_not_found; + goto error; + } + + library->handle = handle; + library->avcodec_descriptor_next = av_codec_next; + library->avcodec_find_decoder = avcodec_find_decoder; + return NULL; + +error: + if (handle) + { + FreeLibrary(handle); + } + return error; +} + +char *unload_ffmpeg_library(struct FFMPEG_Library *library) +{ + if (library->handle && FreeLibrary(library->handle)) + { + *library = NULL_FFMPEG_LIBRARY; + return NULL; + } + return error_cannot_free_library; +} + +#endif // WIN_FFMPEG guard diff --git a/dev-packages/ffmpeg/package.json b/dev-packages/ffmpeg/package.json new file mode 100644 index 0000000..25bce25 --- /dev/null +++ b/dev-packages/ffmpeg/package.json @@ -0,0 +1,40 @@ +{ + "name": "@theia/ffmpeg", + "version": "1.68.0", + "description": "Theia FFMPEG reader utility.", + "publishConfig": { + "access": "public" + }, + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "repository": { + "type": "git", + "url": "https://github.com/eclipse-theia/theia.git" + }, + "bugs": { + "url": "https://github.com/eclipse-theia/theia/issues" + }, + "homepage": "https://github.com/eclipse-theia/theia", + "main": "lib/index.js", + "files": [ + "binding.gyp", + "lib", + "native", + "src" + ], + "scripts": { + "compile": "theiaext compile", + "lint": "theiaext lint", + "build": "theiaext build", + "watch": "theiaext watch", + "clean": "theiaext clean" + }, + "dependencies": { + "@electron/get": "^2.0.0", + "tslib": "^2.6.2", + "unzipper": "^0.9.11" + }, + "devDependencies": { + "@types/unzipper": "^0.9.2" + }, + "gitHead": "21358137e41342742707f660b8e222f940a27652" +} diff --git a/dev-packages/ffmpeg/src/check-ffmpeg.ts b/dev-packages/ffmpeg/src/check-ffmpeg.ts new file mode 100644 index 0000000..c7d2a4a --- /dev/null +++ b/dev-packages/ffmpeg/src/check-ffmpeg.ts @@ -0,0 +1,56 @@ +// ***************************************************************************** +// Copyright (C) 2019 Ericsson and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import * as ffmpeg from './ffmpeg'; + +export interface CheckFfmpegOptions extends ffmpeg.FfmpegOptions { + json?: boolean +} + +export interface CheckFfmpegResult { + free: ffmpeg.Codec[], + proprietary: ffmpeg.Codec[], +} + +export const KNOWN_PROPRIETARY_CODECS = new Set(['h264', 'aac']); + +export async function checkFfmpeg(options: CheckFfmpegOptions = {}): Promise { + const { + ffmpegPath = ffmpeg.ffmpegAbsolutePath(options), + json = false, + } = options; + const codecs = ffmpeg.getFfmpegCodecs(ffmpegPath); + const free = []; + const proprietary = []; + for (const codec of codecs) { + if (KNOWN_PROPRIETARY_CODECS.has(codec.name.toLowerCase())) { + proprietary.push(codec); + } else { + free.push(codec); + } + } + if (json) { + // Pretty format JSON on stdout. + const result: CheckFfmpegResult = { free, proprietary }; + console.log(JSON.stringify(result, undefined, 2)); + } + if (proprietary.length > 0) { + // Should be displayed on stderr to not pollute the JSON on stdout. + throw new Error(`${proprietary.length} proprietary codecs found\n${proprietary.map(codec => `> ${codec.name} detected (${codec.longName})`).join('\n')}`); + } + // Print to stderr to not pollute the JSON on stdout. + console.warn(`"${ffmpegPath}" does not contain proprietary codecs (${codecs.length} found).`); +} diff --git a/dev-packages/ffmpeg/src/ffmpeg.ts b/dev-packages/ffmpeg/src/ffmpeg.ts new file mode 100644 index 0000000..bcebc2c --- /dev/null +++ b/dev-packages/ffmpeg/src/ffmpeg.ts @@ -0,0 +1,114 @@ +// ***************************************************************************** +// Copyright (C) 2019 Ericsson and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import path = require('path'); + +export interface Codec { + id: number + name: string + longName: string +} + +export interface FfmpegNativeAddon { + codecs(ffmpegPath: string): Codec[] +} + +export interface FfmpegNameAndLocation { + /** + * Name with extension of the shared library. + */ + name: string + /** + * Relative location of the file from Electron's dist root. + */ + location: string +} + +export interface FfmpegOptions { + electronVersion?: string + electronDist?: string + ffmpegPath?: string + platform?: NodeJS.Platform +} + +/** + * @internal + */ +export function _loadFfmpegNativeAddon(): FfmpegNativeAddon { + try { + return require('../build/Release/ffmpeg.node'); + } catch (error) { + if (error.code === 'MODULE_NOT_FOUND') { + return require('../build/Debug/ffmpeg.node'); + } else { + throw error; + } + } +} + +/** + * @returns name and relative path from Electron's root where FFMPEG is located at. + */ +export function ffmpegNameAndLocation({ + platform = process.platform +}: FfmpegOptions = {}): FfmpegNameAndLocation { + switch (platform) { + case 'darwin': + return { + name: 'libffmpeg.dylib', + location: 'Electron.app/Contents/Frameworks/Electron Framework.framework/Libraries/', + }; + case 'win32': + return { + name: 'ffmpeg.dll', + location: '', + }; + case 'linux': + return { + name: 'libffmpeg.so', + location: '', + }; + default: + throw new Error(`${platform} is not supported`); + } +} + +/** + * @returns relative ffmpeg shared library path from the Electron distribution root. + */ +export function ffmpegRelativePath(options: FfmpegOptions = {}): string { + const { location, name } = ffmpegNameAndLocation(options); + return path.join(location, name); +} + +/** + * @returns absolute ffmpeg shared library path. + */ +export function ffmpegAbsolutePath(options: FfmpegOptions = {}): string { + const { + electronDist = path.resolve(require.resolve('electron/package.json'), '..', 'dist') + } = options; + return path.join(electronDist, ffmpegRelativePath(options)); +} + +/** + * Dynamically link to `ffmpegPath` and use FFMPEG APIs to list the included `Codec`s. + * @param ffmpegPath absolute path the the FFMPEG shared library. + * @returns list of codecs for the given ffmpeg shared library. + */ +export function getFfmpegCodecs(ffmpegPath: string): Codec[] { + return _loadFfmpegNativeAddon().codecs(ffmpegPath); +} diff --git a/dev-packages/ffmpeg/src/hash.ts b/dev-packages/ffmpeg/src/hash.ts new file mode 100644 index 0000000..81627b5 --- /dev/null +++ b/dev-packages/ffmpeg/src/hash.ts @@ -0,0 +1,28 @@ +// ***************************************************************************** +// Copyright (C) 2021 Ericsson and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import crypto = require('crypto'); +import fs = require('fs-extra'); + +export async function hashFile(filePath: string): Promise { + return new Promise((resolve, reject) => { + const sha256 = crypto.createHash('sha256'); + fs.createReadStream(filePath) + .on('close', () => resolve(sha256.digest())) + .on('data', data => sha256.update(data)) + .on('error', reject); + }); +} diff --git a/dev-packages/ffmpeg/src/index.ts b/dev-packages/ffmpeg/src/index.ts new file mode 100644 index 0000000..38738ee --- /dev/null +++ b/dev-packages/ffmpeg/src/index.ts @@ -0,0 +1,20 @@ +// ***************************************************************************** +// Copyright (C) 2021 Ericsson and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +export * from './hash'; +export * from './ffmpeg'; +export * from './check-ffmpeg'; +export * from './replace-ffmpeg'; diff --git a/dev-packages/ffmpeg/src/replace-ffmpeg.ts b/dev-packages/ffmpeg/src/replace-ffmpeg.ts new file mode 100644 index 0000000..4f8373b --- /dev/null +++ b/dev-packages/ffmpeg/src/replace-ffmpeg.ts @@ -0,0 +1,80 @@ +// ***************************************************************************** +// Copyright (C) 2019 Ericsson and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import electronGet = require('@electron/get'); +import fs = require('fs-extra'); +import os = require('os'); +import path = require('path'); +import unzipper = require('unzipper'); +import * as ffmpeg from './ffmpeg'; +import { hashFile } from './hash'; + +export async function replaceFfmpeg(options: ffmpeg.FfmpegOptions = {}): Promise { + let shouldDownload = true; + let shouldReplace = true; + const { + name: ffmpegName, + location: ffmpegLocation, + } = ffmpeg.ffmpegNameAndLocation(options); + const { + electronDist = path.resolve(require.resolve('electron/package.json'), '..', 'dist'), + electronVersion = await readElectronVersion(electronDist), + ffmpegPath = path.resolve(electronDist, ffmpegLocation, ffmpegName), + } = options; + const ffmpegCachedPath = path.join(os.tmpdir(), `theia-cli/cache/electron-v${electronVersion}`, ffmpegName); + if (await fs.pathExists(ffmpegCachedPath)) { + shouldDownload = false; // If the file is already cached, do not download. + console.warn('Found cached ffmpeg library.'); + const [cacheHash, distHash] = await Promise.all([ + hashFile(ffmpegCachedPath), + hashFile(ffmpegPath), + ]); + if (cacheHash.equals(distHash)) { + shouldReplace = false; // If files are already the same, do not replace. + console.warn('Hashes are equal, not replacing the ffmpeg library.'); + } + } + if (shouldDownload) { + const ffmpegZipPath = await electronGet.downloadArtifact({ + version: electronVersion, + artifactName: 'ffmpeg' + }); + const ffmpegZip = await unzipper.Open.file(ffmpegZipPath); + const file = ffmpegZip.files.find(f => f.path.endsWith(ffmpegName)); + if (!file) { + throw new Error(`Archive did not contain "${ffmpegName}".`); + } + // Extract file to cache. + await fs.mkdirp(path.dirname(ffmpegCachedPath)); + await new Promise((resolve, reject) => { + file.stream() + .pipe(fs.createWriteStream(ffmpegCachedPath)) + .on('finish', resolve) + .on('error', reject); + }); + console.warn(`Downloaded ffmpeg shared library { version: "${electronVersion}", dist: "${electronDist}" }.`); + } + if (shouldReplace) { + await fs.copy(ffmpegCachedPath, ffmpegPath); + console.warn(`Successfully replaced "${ffmpegPath}".`); + } +} + +export async function readElectronVersion(electronDist: string): Promise { + const electronVersionFilePath = path.resolve(electronDist, 'version'); + const version = await fs.readFile(electronVersionFilePath, 'utf8'); + return version.trim(); +} diff --git a/dev-packages/ffmpeg/tsconfig.json b/dev-packages/ffmpeg/tsconfig.json new file mode 100644 index 0000000..b973ddb --- /dev/null +++ b/dev-packages/ffmpeg/tsconfig.json @@ -0,0 +1,12 @@ +{ + "extends": "../../configs/base.tsconfig", + "compilerOptions": { + "composite": true, + "rootDir": "src", + "outDir": "lib" + }, + "include": [ + "src" + ], + "references": [] +} diff --git a/dev-packages/localization-manager/.eslintrc.js b/dev-packages/localization-manager/.eslintrc.js new file mode 100644 index 0000000..1d7d77d --- /dev/null +++ b/dev-packages/localization-manager/.eslintrc.js @@ -0,0 +1,13 @@ +/** @type {import('eslint').Linter.Config} */ +module.exports = { + extends: [ + '../../configs/build.eslintrc.json' + ], + parserOptions: { + tsconfigRootDir: __dirname, + project: 'tsconfig.json' + }, + rules: { + 'import/no-dynamic-require': 'off' + } +}; diff --git a/dev-packages/localization-manager/README.md b/dev-packages/localization-manager/README.md new file mode 100644 index 0000000..d6d4f9f --- /dev/null +++ b/dev-packages/localization-manager/README.md @@ -0,0 +1,67 @@ +
+ +
+ +theia-ext-logo + +

ECLIPSE THEIA - LOCALIZATION-MANAGER

+ +
+ +
+ +## Description + +The `@theia/localization-manager` package is used easily create localizations of Theia and Theia extensions for different languages. It has two main use cases. + +First, it allows to extract localization keys and default values from `nls.localize` calls within the codebase using the `nls-extract` Theia-CLI command. Take this code for example: + +```ts +const hi = nls.localize('greetings/hi', 'Hello'); +const bye = nls.localize('greetings/bye', 'Bye'); +``` + +It will be converted into this JSON file (`nls.json`): + +```json +{ + "greetings": { + "hi": "Hello", + "bye": "Bye" + } +} +``` + +Afterwards, any manual or automatic translation approach can be used to translate this file into other languages. These JSON files are supposed to be picked up by `LocalizationContribution`s. + +Additionally, Theia provides a simple way to translate the generated JSON files out of the box using the [DeepL API](https://www.deepl.com/docs-api). For this, a [DeepL free or pro account](https://www.deepl.com/pro) is needed. Using the `nls-localize` command of the Theia-CLI, a target file can be translated into different languages. For example, when calling the command using the previous JSON file with the `fr` (french) language, the following `nls.fr.json` file will be created in the same directory as the translation source: + +```json +{ + "greetings": { + "hi": "Bonjour", + "bye": "Au revoir" + } +} +``` + +Only JSON entries without corresponding translations are translated using DeepL. This ensures that manual changes to the translated files aren't overwritten and only new translation entries are actually sent to DeepL. + +Use `theia nls-localize --help` for more information on how to use the command and supply DeepL API keys. + +For more information, see the [internationalization documentation](https://theia-ide.org/docs/i18n/). + +## Additional Information + +- [Theia - GitHub](https://github.com/eclipse-theia/theia) +- [Theia - Website](https://theia-ide.org/) + +## License + +- [Eclipse Public License 2.0](http://www.eclipse.org/legal/epl-2.0/) +- [一 (Secondary) GNU General Public License, version 2 with the GNU Classpath Exception](https://projects.eclipse.org/license/secondary-gpl-2.0-cp) + +## Trademark + +"Theia" is a trademark of the Eclipse Foundation + diff --git a/dev-packages/localization-manager/package.json b/dev-packages/localization-manager/package.json new file mode 100644 index 0000000..c4c6540 --- /dev/null +++ b/dev-packages/localization-manager/package.json @@ -0,0 +1,50 @@ +{ + "name": "@theia/localization-manager", + "version": "1.68.0", + "description": "Theia localization manager API.", + "publishConfig": { + "access": "public" + }, + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "repository": { + "type": "git", + "url": "https://github.com/eclipse-theia/theia.git" + }, + "bugs": { + "url": "https://github.com/eclipse-theia/theia/issues" + }, + "homepage": "https://github.com/eclipse-theia/theia", + "files": [ + "lib", + "src" + ], + "main": "lib/index.js", + "typings": "lib/index.d.ts", + "scripts": { + "build": "theiaext build", + "clean": "theiaext clean", + "compile": "theiaext compile", + "lint": "theiaext lint", + "test": "theiaext test", + "watch": "theiaext watch" + }, + "dependencies": { + "@types/bent": "^7.0.1", + "@types/fs-extra": "^4.0.2", + "bent": "^7.1.0", + "chalk": "4.0.0", + "deepmerge": "^4.2.2", + "fs-extra": "^4.0.2", + "glob": "^7.2.0", + "limiter": "^2.1.0", + "tslib": "^2.6.2", + "typescript": "~5.9.3" + }, + "devDependencies": { + "@theia/ext-scripts": "1.68.0" + }, + "nyc": { + "extends": "../../configs/nyc.json" + }, + "gitHead": "21358137e41342742707f660b8e222f940a27652" +} diff --git a/dev-packages/localization-manager/src/common.ts b/dev-packages/localization-manager/src/common.ts new file mode 100644 index 0000000..046f2f3 --- /dev/null +++ b/dev-packages/localization-manager/src/common.ts @@ -0,0 +1,27 @@ +// ***************************************************************************** +// Copyright (C) 2021 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +export interface Localization { + [key: string]: string | Localization +} + +export function sortLocalization(localization: Localization): Localization { + return Object.keys(localization).sort().reduce((result: Localization, key: string) => { + const value = localization[key]; + result[key] = typeof value === 'string' ? value : sortLocalization(value); + return result; + }, {}); +} diff --git a/dev-packages/localization-manager/src/deepl-api.ts b/dev-packages/localization-manager/src/deepl-api.ts new file mode 100644 index 0000000..1076986 --- /dev/null +++ b/dev-packages/localization-manager/src/deepl-api.ts @@ -0,0 +1,190 @@ +// ***************************************************************************** +// Copyright (C) 2021 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import * as bent from 'bent'; +import { RateLimiter } from 'limiter'; + +const post = bent('POST', 'json', 200); +// 50 is the maximum amount of translations per request +const deeplLimit = 50; +const rateLimiter = new RateLimiter({ + tokensPerInterval: 10, + interval: 'second', + fireImmediately: true +}); + +export async function deepl( + parameters: DeeplParameters +): Promise { + coerceLanguage(parameters); + const sub_domain = parameters.free_api ? 'api-free' : 'api'; + const textChunks: string[][] = []; + const textArray = [...parameters.text]; + while (textArray.length > 0) { + textChunks.push(textArray.splice(0, deeplLimit)); + } + const responses: DeeplResponse[] = await Promise.all(textChunks.map(async chunk => { + const parameterCopy: DeeplParameters = { ...parameters, text: chunk }; + const url = `https://${sub_domain}.deepl.com/v2/translate`; + const buffer = Buffer.from(toFormData(parameterCopy)); + return postWithRetry(url, parameters.auth_key, buffer, 1); + })); + const mergedResponse: DeeplResponse = { translations: [] }; + for (const response of responses) { + mergedResponse.translations.push(...response.translations); + } + for (const translation of mergedResponse.translations) { + translation.text = coerceTranslation(translation.text); + } + return mergedResponse; +} + +async function postWithRetry(url: string, key: string, buffer: Buffer, attempt: number): Promise { + try { + await rateLimiter.removeTokens(Math.min(attempt, 10)); + const response = await post(url, buffer, { + 'Content-Type': 'application/x-www-form-urlencoded', + 'User-Agent': 'Theia-Localization-Manager', + 'Authorization': 'DeepL-Auth-Key ' + key + }); + return response; + } catch (e) { + if ('message' in e && typeof e.message === 'string' && e.message.includes('Too Many Requests')) { + return postWithRetry(url, key, buffer, attempt + 1); + } + throw e; + } +} + +/** + * Coerces the target language into a form expected by Deepl. + * + * Currently only replaces `ZH-CN` with `ZH` + */ +function coerceLanguage(parameters: DeeplParameters): void { + if (parameters.target_lang === 'ZH-CN') { + parameters.target_lang = 'ZH-HANS'; + } else if (parameters.target_lang === 'ZH-TW') { + parameters.target_lang = 'ZH-HANT'; + } +} + +/** + * Coerces translated text into a form expected by VSCode/Theia. + * + * Replaces certain full-width characters with their ascii counter-part. + */ +function coerceTranslation(text: string): string { + return text + .replace(/\uff08/g, '(') + .replace(/\uff09/g, ')') + .replace(/\uff0c/g, ',') + .replace(/\uff1a/g, ':') + .replace(/\uff1b/g, ';') + .replace(/\uff1f/g, '?'); +} + +function toFormData(parameters: DeeplParameters): string { + const str: string[] = []; + for (const [key, value] of Object.entries(parameters)) { + if (typeof value === 'string') { + str.push(encodeURIComponent(key) + '=' + encodeURIComponent(value.toString())); + } else if (Array.isArray(value)) { + for (const item of value) { + str.push(encodeURIComponent(key) + '=' + encodeURIComponent(item.toString())); + } + } + } + return str.join('&'); +} + +export type DeeplLanguage = + | 'BG' + | 'CS' + | 'DA' + | 'DE' + | 'EL' + | 'EN-GB' + | 'EN-US' + | 'EN' + | 'ES' + | 'ET' + | 'FI' + | 'FR' + | 'HU' + | 'ID' + | 'IT' + | 'JA' + | 'KO' + | 'LT' + | 'LV' + | 'NB' + | 'NL' + | 'PL' + | 'PT-PT' + | 'PT-BR' + | 'PT' + | 'RO' + | 'RU' + | 'SK' + | 'SL' + | 'SV' + | 'TR' + | 'UK' + | 'ZH-CN' + | 'ZH-TW' + | 'ZH-HANS' + | 'ZH-HANT' + | 'ZH'; + +export const supportedLanguages = [ + 'BG', 'CS', 'DA', 'DE', 'EL', 'EN-GB', 'EN-US', 'EN', 'ES', 'ET', 'FI', 'FR', 'HU', 'ID', 'IT', + 'JA', 'KO', 'LT', 'LV', 'NL', 'PL', 'PT-PT', 'PT-BR', 'PT', 'RO', 'RU', 'SK', 'SL', 'SV', 'TR', 'UK', 'ZH-CN', 'ZH-TW' +]; + +// From https://code.visualstudio.com/docs/getstarted/locales#_available-locales +export const defaultLanguages = [ + 'ZH-CN', 'ZH-TW', 'FR', 'DE', 'IT', 'ES', 'JA', 'KO', 'RU', 'PT-BR', 'TR', 'PL', 'CS', 'HU' +] as const; + +export function isSupportedLanguage(language: string): language is DeeplLanguage { + return supportedLanguages.includes(language.toUpperCase()); +} + +export interface DeeplParameters { + free_api: Boolean + auth_key: string + text: string[] + source_lang?: DeeplLanguage + target_lang: DeeplLanguage + split_sentences?: '0' | '1' | 'nonewlines' + preserve_formatting?: '0' | '1' + formality?: 'default' | 'more' | 'less' + tag_handling?: string[] + non_splitting_tags?: string[] + outline_detection?: string + splitting_tags?: string[] + ignore_tags?: string[] +} + +export interface DeeplResponse { + translations: DeeplTranslation[] +} + +export interface DeeplTranslation { + detected_source_language: string + text: string +} diff --git a/dev-packages/localization-manager/src/index.ts b/dev-packages/localization-manager/src/index.ts new file mode 100644 index 0000000..c88ddd2 --- /dev/null +++ b/dev-packages/localization-manager/src/index.ts @@ -0,0 +1,19 @@ +// ***************************************************************************** +// Copyright (C) 2021 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +export * from './common'; +export * from './localization-extractor'; +export * from './localization-manager'; diff --git a/dev-packages/localization-manager/src/localization-extractor.spec.ts b/dev-packages/localization-manager/src/localization-extractor.spec.ts new file mode 100644 index 0000000..c3456c1 --- /dev/null +++ b/dev-packages/localization-manager/src/localization-extractor.spec.ts @@ -0,0 +1,151 @@ +// ***************************************************************************** +// Copyright (C) 2021 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import * as assert from 'assert'; +import { extractFromFile, ExtractionOptions } from './localization-extractor'; + +const TEST_FILE = 'test.ts'; +const quiet: ExtractionOptions = { quiet: true }; + +describe('correctly extracts from file content', () => { + + it('should extract from simple nls.localize() call', async () => { + const content = 'nls.localize("key", "value")'; + assert.deepStrictEqual(await extractFromFile(TEST_FILE, content), { + 'key': 'value' + }); + }); + + it('should extract from nested nls.localize() call', async () => { + const content = 'nls.localize("nested/key", "value")'; + assert.deepStrictEqual(await extractFromFile(TEST_FILE, content), { + 'nested': { + 'key': 'value' + } + }); + }); + + it('should extract IDs from Command.toLocalizedCommand() call', async () => { + const content = ` + Command.toLocalizedCommand({ + id: 'command-id1', + label: 'command-label1' + }); + Command.toLocalizedCommand({ + id: 'command-id2', + label: 'command-label2' + }, 'command-key'); + `; + assert.deepStrictEqual(await extractFromFile(TEST_FILE, content), { + 'command-id1': 'command-label1', + 'command-key': 'command-label2' + }); + }); + + it('should extract category from Command.toLocalizedCommand() call', async () => { + const content = ` + Command.toLocalizedCommand({ + id: 'id', + label: 'label', + category: 'category' + }, undefined, 'category-key');`; + assert.deepStrictEqual(await extractFromFile(TEST_FILE, content), { + 'id': 'label', + 'category-key': 'category' + }); + }); + + it('should merge different nls.localize() calls', async () => { + const content = ` + nls.localize('nested/key1', 'value1'); + nls.localize('nested/key2', 'value2'); + `; + assert.deepStrictEqual(await extractFromFile(TEST_FILE, content), { + 'nested': { + 'key1': 'value1', + 'key2': 'value2' + } + }); + }); + + it('should be able to resolve local references', async () => { + const content = ` + const a = 'key'; + nls.localize(a, 'value'); + `; + assert.deepStrictEqual(await extractFromFile(TEST_FILE, content), { + 'key': 'value' + }); + }); + + it('should return an error when resolving is not successful', async () => { + const content = "nls.localize(a, 'value')"; + const errors: string[] = []; + assert.deepStrictEqual(await extractFromFile(TEST_FILE, content, errors, quiet), {}); + assert.deepStrictEqual(errors, [ + "test.ts(1,14): Could not resolve reference to 'a'" + ]); + }); + + it('should return an error when resolving from an expression', async () => { + const content = "nls.localize(test.value, 'value');"; + const errors: string[] = []; + assert.deepStrictEqual(await extractFromFile(TEST_FILE, content, errors, quiet), {}); + assert.deepStrictEqual(errors, [ + "test.ts(1,14): 'test.value' is not a string constant" + ]); + }); + + it('should show error when trying to merge an object and a string', async () => { + const content = ` + nls.localize('key', 'value'); + nls.localize('key/nested', 'value'); + `.trim(); + const errors: string[] = []; + assert.deepStrictEqual(await extractFromFile(TEST_FILE, content, errors, quiet), { + 'key': 'value' + }); + assert.deepStrictEqual(errors, [ + "test.ts(2,35): String entry already exists at 'key'" + ]); + }); + + it('should show error when trying to merge a string into an object', async () => { + const content = ` + nls.localize('key/nested', 'value'); + nls.localize('key', 'value'); + `.trim(); + const errors: string[] = []; + assert.deepStrictEqual(await extractFromFile(TEST_FILE, content, errors, quiet), { + 'key': { + 'nested': 'value' + } + }); + assert.deepStrictEqual(errors, [ + "test.ts(2,28): Multiple translation keys already exist at 'key'" + ]); + }); + + it('should show error for template literals', async () => { + const content = 'nls.localize("key", `template literal value`)'; + const errors: string[] = []; + assert.deepStrictEqual(await extractFromFile(TEST_FILE, content, errors, quiet), {}); + assert.deepStrictEqual(errors, [ + "test.ts(1,20): Template literals are not supported for localization. Please use the additional arguments of the 'nls.localize' function to format strings" + ]); + }); + +}); diff --git a/dev-packages/localization-manager/src/localization-extractor.ts b/dev-packages/localization-manager/src/localization-extractor.ts new file mode 100644 index 0000000..1f2af7c --- /dev/null +++ b/dev-packages/localization-manager/src/localization-extractor.ts @@ -0,0 +1,431 @@ +// ***************************************************************************** +// Copyright (C) 2021 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import * as fs from 'fs-extra'; +import * as ts from 'typescript'; +import * as os from 'os'; +import * as path from 'path'; +import { glob } from 'glob'; +import { promisify } from 'util'; +import deepmerge = require('deepmerge'); +import { Localization, sortLocalization } from './common'; + +const globPromise = promisify(glob); + +export interface ExtractionOptions { + root?: string + output?: string + exclude?: string + logs?: string + /** List of globs matching the files to extract from. */ + files?: string[] + merge?: boolean + quiet?: boolean +} + +class SingleFileServiceHost implements ts.LanguageServiceHost { + + private file: ts.IScriptSnapshot; + private lib: ts.IScriptSnapshot; + + constructor(private options: ts.CompilerOptions, private filename: string, contents: string) { + this.file = ts.ScriptSnapshot.fromString(contents); + this.lib = ts.ScriptSnapshot.fromString(''); + } + + getCompilationSettings = () => this.options; + getScriptFileNames = () => [this.filename]; + getScriptVersion = () => '1'; + getScriptSnapshot = (name: string) => name === this.filename ? this.file : this.lib; + getCurrentDirectory = () => ''; + getDefaultLibFileName = () => 'lib.d.ts'; + readFile(file: string, encoding?: string | undefined): string | undefined { + if (file === this.filename) { + return this.file.getText(0, this.file.getLength()); + } + } + fileExists(file: string): boolean { + return this.filename === file; + } +} + +class TypeScriptError extends Error { + constructor(message: string, node: ts.Node) { + super(buildErrorMessage(message, node)); + } +} + +function buildErrorMessage(message: string, node: ts.Node): string { + const source = node.getSourceFile(); + const sourcePath = source.fileName; + const pos = source.getLineAndCharacterOfPosition(node.pos); + return `${sourcePath}(${pos.line + 1},${pos.character + 1}): ${message}`; +} + +const tsOptions: ts.CompilerOptions = { + allowJs: true +}; + +export async function extract(options: ExtractionOptions): Promise { + const cwd = path.resolve(process.env.INIT_CWD || process.cwd(), options.root ?? ''); + const files: string[] = []; + await Promise.all((options.files ?? ['**/src/**/*.{ts,tsx}']).map( + async pattern => files.push(...await globPromise(pattern, { cwd })) + )); + let localization: Localization = {}; + const errors: string[] = []; + for (const file of files) { + const filePath = path.resolve(cwd, file); + const fileName = path.relative(cwd, file).split(path.sep).join('/'); + const content = await fs.readFile(filePath, 'utf8'); + const fileLocalization = await extractFromFile(fileName, content, errors, options); + localization = deepmerge(localization, fileLocalization); + } + if (errors.length > 0 && options.logs) { + await fs.writeFile(options.logs, errors.join(os.EOL)); + } + const out = path.resolve(process.env.INIT_CWD || process.cwd(), options.output ?? ''); + if (options.merge && await fs.pathExists(out)) { + const existing = await fs.readJson(out); + localization = deepmerge(existing, localization); + } + localization = sortLocalization(localization); + await fs.mkdirs(path.dirname(out)); + await fs.writeJson(out, localization, { + spaces: 2 + }); +} + +export async function extractFromFile(file: string, content: string, errors?: string[], options?: ExtractionOptions): Promise { + const serviceHost = new SingleFileServiceHost(tsOptions, file, content); + const service = ts.createLanguageService(serviceHost); + const sourceFile = service.getProgram()!.getSourceFile(file)!; + const localization: Localization = {}; + const localizationCalls = collect(sourceFile, node => isLocalizeCall(node)); + for (const call of localizationCalls) { + try { + const extracted = extractFromLocalizeCall(call, options); + if (extracted) { + insert(localization, extracted); + } + } catch (err) { + const tsError = err as Error; + errors?.push(tsError.message); + if (!options?.quiet) { + console.log(tsError.message); + } + } + } + const localizedCommands = collect(sourceFile, node => isCommandLocalizeUtility(node)); + for (const command of localizedCommands) { + try { + const extracted = extractFromLocalizedCommandCall(command, errors, options); + const label = extracted.label; + const category = extracted.category; + if (!isExcluded(options, label[0])) { + insert(localization, label); + } + if (category && !isExcluded(options, category[0])) { + insert(localization, category); + } + } catch (err) { + const tsError = err as Error; + errors?.push(tsError.message); + if (!options?.quiet) { + console.log(tsError.message); + } + } + } + return localization; +} + +function isExcluded(options: ExtractionOptions | undefined, key: string): boolean { + return !!options?.exclude && key.startsWith(options.exclude); +} + +function insert(localization: Localization, values: [string, string, ts.Node]): void { + const key = values[0]; + const value = values[1]; + const node = values[2]; + const parts = key.split('/'); + parts.forEach((part, i) => { + let entry = localization[part]; + if (i === parts.length - 1) { + if (typeof entry === 'object') { + throw new TypeScriptError(`Multiple translation keys already exist at '${key}'`, node); + } + localization[part] = value; + } else { + if (typeof entry === 'string') { + throw new TypeScriptError(`String entry already exists at '${parts.splice(0, i + 1).join('/')}'`, node); + } + if (!entry) { + entry = {}; + } + localization[part] = entry; + localization = entry; + } + }); +} + +function collect(n: ts.Node, fn: (node: ts.Node) => boolean): ts.Node[] { + const result: ts.Node[] = []; + + function loop(node: ts.Node): void { + + const stepResult = fn(node); + + if (stepResult) { + result.push(node); + } else { + ts.forEachChild(node, loop); + } + } + + loop(n); + return result; +} + +function isLocalizeCall(node: ts.Node): boolean { + if (!ts.isCallExpression(node)) { + return false; + } + + return node.expression.getText() === 'nls.localize'; +} + +function extractFromLocalizeCall(node: ts.Node, options?: ExtractionOptions): [string, string, ts.Node] | undefined { + if (!ts.isCallExpression(node)) { + throw new TypeScriptError('Invalid node type', node); + } + const args = node.arguments; + + if (args.length < 2) { + throw new TypeScriptError('Localize call needs at least 2 arguments', node); + } + + const key = extractString(args[0]); + const value = extractString(args[1]); + + if (isExcluded(options, key)) { + return undefined; + } + + return [key, value, args[1]]; +} + +function extractFromLocalizedCommandCall(node: ts.Node, errors?: string[], options?: ExtractionOptions): { + label: [string, string, ts.Node], + category?: [string, string, ts.Node] +} { + if (!ts.isCallExpression(node)) { + throw new TypeScriptError('Invalid node type', node); + } + const args = node.arguments; + + if (args.length < 1) { + throw new TypeScriptError('Command localization call needs at least one argument', node); + } + + const commandObj = args[0]; + + if (!ts.isObjectLiteralExpression(commandObj)) { + throw new TypeScriptError('First argument of "toLocalizedCommand" needs to be an object literal', node); + } + + const properties = commandObj.properties; + const propertyMap = new Map(); + const relevantProps = ['id', 'label', 'category']; + let labelNode: ts.Node = node; + + for (const property of properties) { + if (!property.name) { + continue; + } + if (!ts.isPropertyAssignment(property)) { + throw new TypeScriptError('Only property assignments in "toLocalizedCommand" are allowed', property); + } + if (!ts.isIdentifier(property.name)) { + throw new TypeScriptError('Only identifiers are allowed as property names in "toLocalizedCommand"', property); + } + const name = property.name.text; + if (!relevantProps.includes(property.name.text)) { + continue; + } + if (property.name.text === 'label') { + labelNode = property.initializer; + } + + try { + const value = extractString(property.initializer); + propertyMap.set(name, value); + } catch (err) { + const tsError = err as Error; + errors?.push(tsError.message); + if (!options?.quiet) { + console.log(tsError.message); + } + } + } + + let labelKey = propertyMap.get('id'); + let categoryKey: string | undefined = undefined; + let categoryNode: ts.Node | undefined; + + // We have an explicit label translation key + if (args.length > 1) { + try { + const labelOverrideKey = extractStringOrUndefined(args[1]); + if (labelOverrideKey) { + labelKey = labelOverrideKey; + labelNode = args[1]; + } + } catch (err) { + const tsError = err as Error; + errors?.push(tsError.message); + if (!options?.quiet) { + console.log(tsError.message); + } + } + } + + // We have an explicit category translation key + if (args.length > 2) { + try { + categoryKey = extractStringOrUndefined(args[2]); + categoryNode = args[2]; + } catch (err) { + const tsError = err as Error; + errors?.push(tsError.message); + if (!options?.quiet) { + console.log(tsError.message); + } + } + } + + if (!labelKey) { + throw new TypeScriptError('No label key found', node); + } + + if (!propertyMap.get('label')) { + throw new TypeScriptError('No default label found', node); + } + + let categoryLocalization: [string, string, ts.Node] | undefined = undefined; + const categoryLabel = propertyMap.get('category'); + if (categoryKey && categoryLabel && categoryNode) { + categoryLocalization = [categoryKey, categoryLabel, categoryNode]; + } + + return { + label: [labelKey, propertyMap.get('label')!, labelNode], + category: categoryLocalization + }; +} + +function extractStringOrUndefined(node: ts.Expression): string | undefined { + if (node.getText() === 'undefined') { + return undefined; + } + return extractString(node); +} + +function extractString(node: ts.Expression): string { + if (ts.isIdentifier(node)) { + const reference = followReference(node); + if (!reference) { + throw new TypeScriptError(`Could not resolve reference to '${node.text}'`, node); + } + node = reference; + } + if (ts.isTemplateLiteral(node)) { + throw new TypeScriptError( + "Template literals are not supported for localization. Please use the additional arguments of the 'nls.localize' function to format strings", + node + ); + } + if (!ts.isStringLiteralLike(node)) { + throw new TypeScriptError(`'${node.getText()}' is not a string constant`, node); + } + + return unescapeString(node.text); +} + +function followReference(node: ts.Identifier): ts.Expression | undefined { + const scope = collectScope(node); + const next = scope.get(node.text); + if (next && ts.isIdentifier(next)) { + return followReference(next); + } + return next; +} + +function collectScope(node: ts.Node, map: Map = new Map()): Map { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + const locals = (node as any)['locals'] as Map; + if (locals) { + for (const [key, value] of locals.entries()) { + if (!map.has(key)) { + const declaration = value.valueDeclaration; + if (declaration && ts.isVariableDeclaration(declaration) && declaration.initializer) { + map.set(key, declaration.initializer); + } + } + } + } + if (node.parent) { + collectScope(node.parent, map); + } + return map; +} + +function isCommandLocalizeUtility(node: ts.Node): boolean { + if (!ts.isCallExpression(node)) { + return false; + } + + return node.expression.getText() === 'Command.toLocalizedCommand'; +} + +const unescapeMap: Record = { + '\'': '\'', + '"': '"', + '\\': '\\', + 'n': '\n', + 'r': '\r', + 't': '\t', + 'b': '\b', + 'f': '\f' +}; + +function unescapeString(str: string): string { + const result: string[] = []; + for (let i = 0; i < str.length; i++) { + const ch = str.charAt(i); + if (ch === '\\') { + if (i + 1 < str.length) { + const replace = unescapeMap[str.charAt(i + 1)]; + if (replace !== undefined) { + result.push(replace); + i++; + continue; + } + } + } + result.push(ch); + } + return result.join(''); +} diff --git a/dev-packages/localization-manager/src/localization-manager.spec.ts b/dev-packages/localization-manager/src/localization-manager.spec.ts new file mode 100644 index 0000000..da58cb7 --- /dev/null +++ b/dev-packages/localization-manager/src/localization-manager.spec.ts @@ -0,0 +1,91 @@ +// ***************************************************************************** +// Copyright (C) 2021 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import * as assert from 'assert'; +import { DeeplParameters, DeeplResponse } from './deepl-api'; +import { LocalizationManager, LocalizationOptions } from './localization-manager'; + +describe('localization-manager#translateLanguage', () => { + + async function mockLocalization(parameters: DeeplParameters): Promise { + return { + translations: parameters.text.map(value => ({ + detected_source_language: '', + text: `[${value}]` + })) + }; + } + + const manager = new LocalizationManager(mockLocalization); + const defaultOptions: LocalizationOptions = { + authKey: '', + freeApi: false, + sourceFile: '', + targetLanguages: ['EN'] + }; + + it('should translate a single value', async () => { + const input = { + key: 'value' + }; + const target = {}; + await manager.translateLanguage(input, target, 'EN', defaultOptions); + assert.deepStrictEqual(target, { + key: '[value]' + }); + }); + + it('should translate nested values', async () => { + const input = { + a: { + b: 'b' + }, + c: 'c' + }; + const target = {}; + await manager.translateLanguage(input, target, 'EN', defaultOptions); + assert.deepStrictEqual(target, { + a: { + b: '[b]' + }, + c: '[c]' + }); + }); + + it('should not override existing targets', async () => { + const input = { + a: 'a' + }; + const target = { + a: 'b' + }; + await manager.translateLanguage(input, target, 'EN', defaultOptions); + assert.deepStrictEqual(target, { + a: 'b' + }); + }); + + it('should keep placeholders intact', async () => { + const input = { + key: '{1} {0}' + }; + const target = {}; + await manager.translateLanguage(input, target, 'EN', defaultOptions); + assert.deepStrictEqual(target, { + key: '[{1} {0}]' + }); + }); +}); diff --git a/dev-packages/localization-manager/src/localization-manager.ts b/dev-packages/localization-manager/src/localization-manager.ts new file mode 100644 index 0000000..34081a0 --- /dev/null +++ b/dev-packages/localization-manager/src/localization-manager.ts @@ -0,0 +1,168 @@ +// ***************************************************************************** +// Copyright (C) 2021 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import * as chalk from 'chalk'; +import * as fs from 'fs-extra'; +import * as path from 'path'; +import { Localization, sortLocalization } from './common'; +import { deepl, DeeplLanguage, DeeplParameters, defaultLanguages, isSupportedLanguage } from './deepl-api'; + +export interface LocalizationOptions { + freeApi: Boolean + authKey: string + sourceFile: string + sourceLanguage?: string + targetLanguages: string[] +} + +export type LocalizationFunction = (parameters: DeeplParameters) => Promise; + +export class LocalizationManager { + + constructor(private localizationFn = deepl) { } + + async localize(options: LocalizationOptions): Promise { + let source: Localization = {}; + const cwd = process.env.INIT_CWD || process.cwd(); + const sourceFile = path.resolve(cwd, options.sourceFile); + try { + source = await fs.readJson(sourceFile); + } catch { + console.log(chalk.red(`Could not read file "${options.sourceFile}"`)); + process.exit(1); + } + const languages: string[] = []; + for (const targetLanguage of options.targetLanguages) { + if (!isSupportedLanguage(targetLanguage)) { + console.log(chalk.yellow(`Language "${targetLanguage}" is not supported for automatic localization`)); + } else { + languages.push(targetLanguage); + } + } + if (languages.length === 0) { + // No supported languages were found, default to all supported languages + console.log('No languages were specified, defaulting to all supported languages for VS Code'); + languages.push(...defaultLanguages); + } + const existingTranslations: Map = new Map(); + for (const targetLanguage of languages) { + try { + const targetPath = this.translationFileName(sourceFile, targetLanguage); + existingTranslations.set(targetLanguage, await fs.readJson(targetPath)); + } catch { + existingTranslations.set(targetLanguage, {}); + } + } + const results = await Promise.all(languages.map(language => this.translateLanguage(source, existingTranslations.get(language)!, language, options))); + let result = results.reduce((acc, val) => acc && val, true); + + for (const targetLanguage of languages) { + const targetPath = this.translationFileName(sourceFile, targetLanguage); + try { + const translation = existingTranslations.get(targetLanguage)!; + await fs.writeJson(targetPath, sortLocalization(translation), { spaces: 2 }); + } catch { + console.error(chalk.red(`Error writing translated file to '${targetPath}'`)); + result = false; + } + } + return result; + } + + protected translationFileName(original: string, language: string): string { + const directory = path.dirname(original); + const fileName = path.basename(original, '.json'); + return path.join(directory, `${fileName}.${language.toLowerCase()}.json`); + } + + async translateLanguage(source: Localization, target: Localization, targetLanguage: string, options: LocalizationOptions): Promise { + const map = this.buildLocalizationMap(source, target); + if (map.text.length > 0) { + try { + const translationResponse = await this.localizationFn({ + auth_key: options.authKey, + free_api: options.freeApi, + target_lang: targetLanguage.toUpperCase() as DeeplLanguage, + source_lang: options.sourceLanguage?.toUpperCase() as DeeplLanguage, + text: map.text.map(e => this.addIgnoreTags(e)), + tag_handling: ['xml'], + ignore_tags: ['x'] + }); + translationResponse.translations.forEach(({ text }, i) => { + map.localize(i, this.removeIgnoreTags(text)); + }); + console.log(chalk.green(`Successfully translated ${map.text.length} value${map.text.length > 1 ? 's' : ''} for language "${targetLanguage}"`)); + return true; + } catch (e) { + console.log(chalk.red(`Could not translate into language "${targetLanguage}"`), e); + return false; + } + } else { + console.log(`No translation necessary for language "${targetLanguage}"`); + return true; + } + } + + protected addIgnoreTags(text: string): string { + return text.replace(/(\{\d*\})/g, '$1'); + } + + protected removeIgnoreTags(text: string): string { + return text.replace(/(\{\d+\})<\/x>/g, '$1'); + } + + protected buildLocalizationMap(source: Localization, target: Localization): LocalizationMap { + const functionMap = new Map void>(); + const text: string[] = []; + const process = (s: Localization, t: Localization) => { + // Delete all extra keys in the target translation first + for (const key of Object.keys(t)) { + if (!(key in s)) { + delete t[key]; + } + } + for (const [key, value] of Object.entries(s)) { + if (!(key in t)) { + if (typeof value === 'string') { + functionMap.set(text.length, translation => t[key] = translation); + text.push(value); + } else { + const newLocalization: Localization = {}; + t[key] = newLocalization; + process(value, newLocalization); + } + } else if (typeof value === 'object') { + if (typeof t[key] === 'string') { + t[key] = {}; + } + process(value, t[key] as Localization); + } + } + }; + + process(source, target); + + return { + text, + localize: (index, value) => functionMap.get(index)!(value) + }; + } +} + +export interface LocalizationMap { + text: string[] + localize: (index: number, value: string) => void +} diff --git a/dev-packages/localization-manager/tsconfig.json b/dev-packages/localization-manager/tsconfig.json new file mode 100644 index 0000000..b973ddb --- /dev/null +++ b/dev-packages/localization-manager/tsconfig.json @@ -0,0 +1,12 @@ +{ + "extends": "../../configs/base.tsconfig", + "compilerOptions": { + "composite": true, + "rootDir": "src", + "outDir": "lib" + }, + "include": [ + "src" + ], + "references": [] +} diff --git a/dev-packages/native-webpack-plugin/.eslintrc.js b/dev-packages/native-webpack-plugin/.eslintrc.js new file mode 100644 index 0000000..1308994 --- /dev/null +++ b/dev-packages/native-webpack-plugin/.eslintrc.js @@ -0,0 +1,10 @@ +/** @type {import('eslint').Linter.Config} */ +module.exports = { + extends: [ + '../../configs/build.eslintrc.json' + ], + parserOptions: { + tsconfigRootDir: __dirname, + project: 'tsconfig.json' + } +}; diff --git a/dev-packages/native-webpack-plugin/README.md b/dev-packages/native-webpack-plugin/README.md new file mode 100644 index 0000000..f377298 --- /dev/null +++ b/dev-packages/native-webpack-plugin/README.md @@ -0,0 +1,30 @@ +
+ +
+ +theia-ext-logo + +

ECLIPSE THEIA - NATIVE-WEBPACK-PLUGIN

+ +
+ +
+ +## Description + +The `@theia/native-webpack-plugin` package contains a webpack plugin that is used to handle native dependencies for bundling Theia based application backends. + +## Additional Information + +- [Theia - GitHub](https://github.com/eclipse-theia/theia) +- [Theia - Website](https://theia-ide.org/) + +## License + +- [Eclipse Public License 2.0](http://www.eclipse.org/legal/epl-2.0/) +- [一 (Secondary) GNU General Public License, version 2 with the GNU Classpath Exception](https://projects.eclipse.org/license/secondary-gpl-2.0-cp) + +## Trademark + +"Theia" is a trademark of the Eclipse Foundation + diff --git a/dev-packages/native-webpack-plugin/package.json b/dev-packages/native-webpack-plugin/package.json new file mode 100644 index 0000000..af5a563 --- /dev/null +++ b/dev-packages/native-webpack-plugin/package.json @@ -0,0 +1,37 @@ +{ + "name": "@theia/native-webpack-plugin", + "version": "1.68.0", + "description": "Webpack Plugin for native dependencies of Theia.", + "publishConfig": { + "access": "public" + }, + "license": "EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0", + "repository": { + "type": "git", + "url": "https://github.com/eclipse-theia/theia.git" + }, + "bugs": { + "url": "https://github.com/eclipse-theia/theia/issues" + }, + "homepage": "https://github.com/eclipse-theia/theia", + "files": [ + "lib", + "src" + ], + "main": "lib/index.js", + "typings": "lib/index.d.ts", + "scripts": { + "build": "theiaext build", + "clean": "theiaext clean", + "compile": "theiaext compile", + "lint": "theiaext lint", + "test": "theiaext test", + "watch": "theiaext watch" + }, + "dependencies": { + "detect-libc": "^2.0.2", + "tslib": "^2.6.2", + "webpack": "^5.76.0" + }, + "gitHead": "21358137e41342742707f660b8e222f940a27652" +} diff --git a/dev-packages/native-webpack-plugin/src/index.ts b/dev-packages/native-webpack-plugin/src/index.ts new file mode 100644 index 0000000..3df49a0 --- /dev/null +++ b/dev-packages/native-webpack-plugin/src/index.ts @@ -0,0 +1,18 @@ +// ***************************************************************************** +// Copyright (C) 2023 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { NativeWebpackPlugin } from './native-webpack-plugin'; +export = NativeWebpackPlugin; diff --git a/dev-packages/native-webpack-plugin/src/monaco-webpack-plugins.ts b/dev-packages/native-webpack-plugin/src/monaco-webpack-plugins.ts new file mode 100644 index 0000000..7137dda --- /dev/null +++ b/dev-packages/native-webpack-plugin/src/monaco-webpack-plugins.ts @@ -0,0 +1,26 @@ +// ***************************************************************************** +// Copyright (C) 2023 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import * as webpack from 'webpack'; + +export class MonacoWebpackPlugin { + apply(compiler: webpack.Compiler): void { + compiler.hooks.contextModuleFactory.tap('MonacoBuildPlugin', cmf => { + cmf.hooks.contextModuleFiles.tap('MonacoBuildPlugin', files => files.filter(file => !file.endsWith('.d.ts'))); + + }); + } +} diff --git a/dev-packages/native-webpack-plugin/src/native-webpack-plugin.ts b/dev-packages/native-webpack-plugin/src/native-webpack-plugin.ts new file mode 100644 index 0000000..d77892f --- /dev/null +++ b/dev-packages/native-webpack-plugin/src/native-webpack-plugin.ts @@ -0,0 +1,214 @@ +// ***************************************************************************** +// Copyright (C) 2023 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import * as path from 'path'; +import * as fs from 'fs'; +import * as os from 'os'; + +import type { Compiler } from 'webpack'; + +const REQUIRE_RIPGREP = '@vscode/ripgrep'; +const REQUIRE_BINDINGS = 'bindings'; +const REQUIRE_PARCEL_WATCHER = './build/Release/watcher.node'; +const REQUIRE_NODE_PTY_CONPTY = '../build/Release/conpty.node'; + +export interface NativeWebpackPluginOptions { + out: string; + trash: boolean; + ripgrep: boolean; + pty: boolean; + replacements?: Record; + nativeBindings?: Record; +} + +export class NativeWebpackPlugin { + + private bindings = new Map(); + private options: NativeWebpackPluginOptions; + + constructor(options: NativeWebpackPluginOptions) { + this.options = options; + for (const [name, value] of Object.entries(options.nativeBindings ?? {})) { + this.nativeBinding(name, value); + } + } + + nativeBinding(dependency: string, nodePath: string): void { + this.bindings.set(dependency, nodePath); + } + + apply(compiler: Compiler): void { + let replacements: Record Promise> = {}; + let nodePtyIssuer: string | undefined; + let trashHelperIssuer: string | undefined; + let ripgrepIssuer: string | undefined; + compiler.hooks.initialize.tap(NativeWebpackPlugin.name, async () => { + const directory = path.resolve(compiler.outputPath, 'native-webpack-plugin'); + await fs.promises.mkdir(directory, { recursive: true }); + const bindingsFile = (issuer: string) => buildFile(directory, 'bindings.js', bindingsReplacement(issuer, Array.from(this.bindings.entries()))); + const ripgrepFile = () => buildFile(directory, 'ripgrep.js', ripgrepReplacement(this.options.out)); + replacements = { + ...(this.options.replacements ?? {}), + [REQUIRE_RIPGREP]: ripgrepFile, + [REQUIRE_BINDINGS]: bindingsFile, + [REQUIRE_PARCEL_WATCHER]: issuer => Promise.resolve(findNativeWatcherFile(issuer)) + }; + if (process.platform !== 'win32') { + // The expected conpty.node file is not available on non-windows platforms during build. + // We need to provide a stub that will be replaced by the real file at runtime. + replacements[REQUIRE_NODE_PTY_CONPTY] = () => buildFile(directory, 'conpty.js', conhostWindowsReplacement()); + } + }); + compiler.hooks.normalModuleFactory.tap( + NativeWebpackPlugin.name, + nmf => { + nmf.hooks.beforeResolve.tapPromise(NativeWebpackPlugin.name, async result => { + if (result.request === REQUIRE_RIPGREP) { + ripgrepIssuer = result.contextInfo.issuer; + } else if (result.request === 'node-pty') { + nodePtyIssuer = result.contextInfo.issuer; + } else if (result.request === 'trash') { + trashHelperIssuer = result.contextInfo.issuer; + } + for (const [file, replacement] of Object.entries(replacements)) { + if (result.request === file) { + result.request = await replacement(result.contextInfo.issuer); + } + } + }); + } + ); + compiler.hooks.afterEmit.tapPromise(NativeWebpackPlugin.name, async () => { + if (this.options.trash && trashHelperIssuer) { + await this.copyTrashHelper(trashHelperIssuer, compiler); + } + if (this.options.ripgrep && ripgrepIssuer) { + await this.copyRipgrep(ripgrepIssuer, compiler); + } + if (this.options.pty && nodePtyIssuer) { + await this.copyNodePtySpawnHelper(nodePtyIssuer, compiler); + } + }); + } + + protected async copyRipgrep(issuer: string, compiler: Compiler): Promise { + const suffix = process.platform === 'win32' ? '.exe' : ''; + const sourceFile = require.resolve(`@vscode/ripgrep/bin/rg${suffix}`, { paths: [issuer] }); + const targetFile = path.join(compiler.outputPath, this.options.out, `rg${suffix}`); + await this.copyExecutable(sourceFile, targetFile); + } + + protected async copyNodePtySpawnHelper(issuer: string, compiler: Compiler): Promise { + const targetDirectory = path.resolve(compiler.outputPath, '..', 'build', 'Release'); + if (process.platform === 'win32') { + const agentFile = require.resolve('node-pty/build/Release/winpty-agent.exe', { paths: [issuer] }); + const targetAgentFile = path.join(targetDirectory, 'winpty-agent.exe'); + await this.copyExecutable(agentFile, targetAgentFile); + const dllFile = require.resolve('node-pty/build/Release/winpty.dll', { paths: [issuer] }); + const targetDllFile = path.join(targetDirectory, 'winpty.dll'); + await this.copyExecutable(dllFile, targetDllFile); + } else if (process.platform === 'darwin') { + const sourceFile = require.resolve('node-pty/build/Release/spawn-helper', { paths: [issuer] }); + const targetFile = path.join(targetDirectory, 'spawn-helper'); + await this.copyExecutable(sourceFile, targetFile); + } + } + + protected async copyTrashHelper(issuer: string, compiler: Compiler): Promise { + let sourceFile: string | undefined; + let targetFile: string | undefined; + if (process.platform === 'win32') { + sourceFile = require.resolve('trash/lib/windows-trash.exe', { paths: [issuer] }); + targetFile = path.join(compiler.outputPath, 'windows-trash.exe'); + } else if (process.platform === 'darwin') { + sourceFile = require.resolve('trash/lib/macos-trash', { paths: [issuer] }); + targetFile = path.join(compiler.outputPath, 'macos-trash'); + } + if (sourceFile && targetFile) { + await this.copyExecutable(sourceFile, targetFile); + } + } + + protected async copyExecutable(source: string, target: string): Promise { + const targetDirectory = path.dirname(target); + await fs.promises.mkdir(targetDirectory, { recursive: true }); + await fs.promises.copyFile(source, target); + await fs.promises.chmod(target, 0o777); + } +} + +function findNativeWatcherFile(issuer: string): string { + let name = `@parcel/watcher-${process.platform}-${process.arch}`; + if (process.platform === 'linux') { + const { MUSL, family } = require('detect-libc'); + if (family === MUSL) { + name += '-musl'; + } else { + name += '-glibc'; + } + } + return require.resolve(name, { + paths: [issuer] + }); +} + +async function buildFile(root: string, name: string, content: string): Promise { + const tmpFile = path.join(root, name); + let write = true; + try { + const existing = await fs.promises.readFile(tmpFile, 'utf8'); + if (existing === content) { + // prevent writing the same content again + // this would trigger the watch mode repeatedly + write = false; + } + } catch { + // ignore + } + if (write) { + await fs.promises.writeFile(tmpFile, content); + } + return tmpFile; +} + +const ripgrepReplacement = (nativePath: string = '.'): string => ` +const path = require('path'); + +exports.rgPath = path.join(__dirname, \`./${nativePath}/rg\${process.platform === 'win32' ? '.exe' : ''}\`); +`; + +const bindingsReplacement = (issuer: string, entries: [string, string][]): string => { + const cases: string[] = []; + + for (const [module, node] of entries) { + const modulePath = require.resolve(node, { + paths: [issuer] + }); + cases.push(`${' '.repeat(8)}case '${module}': return require('${modulePath.replace(/\\/g, '/')}');`); + } + + return ` +module.exports = function (jsModule) { + switch (jsModule) { +${cases.join(os.EOL)} + } + throw new Error(\`unhandled module: "\${jsModule}"\`); +}`.trim(); +}; + +const conhostWindowsReplacement = (nativePath: string = '.'): string => ` +module.exports = __non_webpack_require__('${nativePath}/native/conpty.node'); +`; diff --git a/dev-packages/native-webpack-plugin/src/package.spec.ts b/dev-packages/native-webpack-plugin/src/package.spec.ts new file mode 100644 index 0000000..4e6f3ab --- /dev/null +++ b/dev-packages/native-webpack-plugin/src/package.spec.ts @@ -0,0 +1,28 @@ +// ***************************************************************************** +// Copyright (C) 2023 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +/* note: this bogus test file is required so that + we are able to run mocha unit tests on this + package, without having any actual unit tests in it. + This way a coverage report will be generated, + showing 0% coverage, instead of no report. + This file can be removed once we have real unit + tests in place. */ + +describe('request package', () => { + + it('should support code coverage statistics', () => true); +}); diff --git a/dev-packages/native-webpack-plugin/tsconfig.json b/dev-packages/native-webpack-plugin/tsconfig.json new file mode 100644 index 0000000..b973ddb --- /dev/null +++ b/dev-packages/native-webpack-plugin/tsconfig.json @@ -0,0 +1,12 @@ +{ + "extends": "../../configs/base.tsconfig", + "compilerOptions": { + "composite": true, + "rootDir": "src", + "outDir": "lib" + }, + "include": [ + "src" + ], + "references": [] +} diff --git a/dev-packages/ovsx-client/.eslintrc.js b/dev-packages/ovsx-client/.eslintrc.js new file mode 100644 index 0000000..1308994 --- /dev/null +++ b/dev-packages/ovsx-client/.eslintrc.js @@ -0,0 +1,10 @@ +/** @type {import('eslint').Linter.Config} */ +module.exports = { + extends: [ + '../../configs/build.eslintrc.json' + ], + parserOptions: { + tsconfigRootDir: __dirname, + project: 'tsconfig.json' + } +}; diff --git a/dev-packages/ovsx-client/README.md b/dev-packages/ovsx-client/README.md new file mode 100644 index 0000000..a2a68b5 --- /dev/null +++ b/dev-packages/ovsx-client/README.md @@ -0,0 +1,62 @@ +
+ +
+ +theia-ext-logo + +

ECLIPSE THEIA - OVSX CLIENT

+ +
+ +
+ +## Description + +The `@theia/ovsx-client` package is used to interact with `open-vsx` through its REST APIs. +The package allows clients to fetch extensions and their metadata, search the registry, and +includes the necessary logic to determine compatibility based on a provided supported API version. + +Note that this client only supports a subset of the whole OpenVSX API, only what's relevant to +clients like Theia applications. + +### `OVSXRouterClient` + +This class is an `OVSXClient` that can delegate requests to sub-clients based on some configuration (`OVSXRouterConfig`). + +```jsonc +{ + "registries": { + // `[Alias]: URL` pairs to avoid copy pasting URLs down the config + }, + "use": [ + // List of aliases/URLs to use when no filtering was applied. + ], + "rules": [ + { + "ifRequestContains": "regex matched against various fields in requests", + "ifExtensionIdMatches": "regex matched against the extension id (without version)", + "use": [/* + List of registries to forward the request to when all the + conditions are matched. + + `null` or `[]` means to not forward the request anywhere. + */] + } + ] +} +``` + +## Additional Information + +- [Theia - GitHub](https://github.com/eclipse-theia/theia) +- [Theia - Website](https://theia-ide.org/) + +## License + +- [Eclipse Public License 2.0](http://www.eclipse.org/legal/epl-2.0/) +- [一 (Secondary) GNU General Public License, version 2 with the GNU Classpath Exception](https://projects.eclipse.org/license/secondary-gpl-2.0-cp) + +## Trademark + +"Theia" is a trademark of the Eclipse Foundation + diff --git a/dev-packages/ovsx-client/package.json b/dev-packages/ovsx-client/package.json new file mode 100644 index 0000000..cbce1da --- /dev/null +++ b/dev-packages/ovsx-client/package.json @@ -0,0 +1,38 @@ +{ + "name": "@theia/ovsx-client", + "version": "1.68.0", + "description": "Theia Open-VSX Client", + "publishConfig": { + "access": "public" + }, + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "repository": { + "type": "git", + "url": "https://github.com/eclipse-theia/theia.git" + }, + "bugs": { + "url": "https://github.com/eclipse-theia/theia/issues" + }, + "homepage": "https://github.com/eclipse-theia/theia", + "files": [ + "lib", + "src" + ], + "main": "lib/index.js", + "typings": "lib/index.d.ts", + "scripts": { + "build": "theiaext build", + "clean": "theiaext clean", + "compile": "theiaext compile", + "lint": "theiaext lint", + "test": "theiaext test", + "watch": "theiaext watch" + }, + "dependencies": { + "@theia/request": "1.68.0", + "limiter": "^2.1.0", + "semver": "^7.5.4", + "tslib": "^2.6.2" + }, + "gitHead": "21358137e41342742707f660b8e222f940a27652" +} diff --git a/dev-packages/ovsx-client/src/index.ts b/dev-packages/ovsx-client/src/index.ts new file mode 100644 index 0000000..84f648c --- /dev/null +++ b/dev-packages/ovsx-client/src/index.ts @@ -0,0 +1,22 @@ +// ***************************************************************************** +// Copyright (C) 2021 Ericsson and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +export { OVSXApiFilter, OVSXApiFilterImpl, OVSXApiFilterProvider } from './ovsx-api-filter'; +export { OVSXHttpClient, OVSX_RATE_LIMIT } from './ovsx-http-client'; +export { OVSXMockClient } from './test/ovsx-mock-client'; +export { OVSXRouterClient, OVSXRouterConfig, OVSXRouterFilterFactory as FilterFactory } from './ovsx-router-client'; +export * from './ovsx-router-filters'; +export * from './ovsx-types'; diff --git a/dev-packages/ovsx-client/src/ovsx-api-filter.ts b/dev-packages/ovsx-client/src/ovsx-api-filter.ts new file mode 100644 index 0000000..17a882b --- /dev/null +++ b/dev-packages/ovsx-client/src/ovsx-api-filter.ts @@ -0,0 +1,140 @@ +// ***************************************************************************** +// Copyright (C) 2023 Ericsson and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import * as semver from 'semver'; +import { OVSXClient, VSXAllVersions, VSXBuiltinNamespaces, VSXExtensionRaw, VSXQueryOptions, VSXSearchEntry } from './ovsx-types'; + +export const OVSXApiFilterProvider = Symbol('OVSXApiFilterProvider'); + +export type OVSXApiFilterProvider = () => Promise; + +export const OVSXApiFilter = Symbol('OVSXApiFilter'); +/** + * Filter various data types based on a pre-defined supported VS Code API version. + */ +export interface OVSXApiFilter { + supportedApiVersion: string; + findLatestCompatibleExtension(query: VSXQueryOptions): Promise; + /** + * Get the latest compatible extension version: + * - A builtin extension is fetched based on the extension version which matches the API. + * - An extension satisfies compatibility if its `engines.vscode` version is supported. + * + * @param extensionId the extension id. + * @returns the data for the latest compatible extension version if available, else `undefined`. + */ + getLatestCompatibleExtension(extensions: VSXExtensionRaw[]): VSXExtensionRaw | undefined; + getLatestCompatibleVersion(searchEntry: VSXSearchEntry): VSXAllVersions | undefined; +} + +export class OVSXApiFilterImpl implements OVSXApiFilter { + + constructor( + public client: OVSXClient, + public supportedApiVersion: string + ) { } + + async findLatestCompatibleExtension(query: VSXQueryOptions): Promise { + const targetPlatform = query.targetPlatform; + if (!targetPlatform) { + return this.queryLatestCompatibleExtension(query); + } + const latestWithTargetPlatform = await this.queryLatestCompatibleExtension(query); + let latestUniversal: VSXExtensionRaw | undefined; + if (targetPlatform !== 'universal' && targetPlatform !== 'web') { + // Additionally query the universal version, as there might be a newer one available + latestUniversal = await this.queryLatestCompatibleExtension({ ...query, targetPlatform: 'universal' }); + } + if (latestWithTargetPlatform && latestUniversal) { + // Prefer the version with the target platform if it's greater or equal to the universal version + return this.versionGreaterThanOrEqualTo(latestWithTargetPlatform.version, latestUniversal.version) ? latestWithTargetPlatform : latestUniversal; + } + return latestWithTargetPlatform ?? latestUniversal; + } + + protected async queryLatestCompatibleExtension(query: VSXQueryOptions): Promise { + let offset = 0; + let size = 5; + let loop = true; + while (loop) { + const queryOptions: VSXQueryOptions = { + ...query, + offset, + size // there is a great chance that the newest version will work + }; + const results = await this.client.query(queryOptions); + const compatibleExtension = this.getLatestCompatibleExtension(results.extensions); + if (compatibleExtension) { + return compatibleExtension; + } + // Adjust offset by the amount of returned extensions + offset += results.extensions.length; + // Continue querying if there are more extensions available + loop = results.totalSize > offset; + // Adjust the size to fetch more extensions next time + size = Math.min(size * 2, 100); + } + return undefined; + } + + getLatestCompatibleExtension(extensions: VSXExtensionRaw[]): VSXExtensionRaw | undefined { + if (extensions.length === 0) { + return; + } else if (this.isBuiltinNamespace(extensions[0].namespace.toLowerCase())) { + return extensions.find(extension => this.versionGreaterThanOrEqualTo(this.supportedApiVersion, extension.version)); + } else { + return extensions.find(extension => this.supportedVscodeApiSatisfies(extension.engines?.vscode ?? '*')); + } + } + + getLatestCompatibleVersion(searchEntry: VSXSearchEntry): VSXAllVersions | undefined { + function getLatestCompatibleVersion(predicate: (allVersions: VSXAllVersions) => boolean): VSXAllVersions | undefined { + if (searchEntry.allVersions) { + return searchEntry.allVersions.find(predicate); + } + // If the allVersions field is missing then try to use the + // searchEntry as VSXAllVersions and check if it's compatible: + if (predicate(searchEntry)) { + return searchEntry; + } + } + if (this.isBuiltinNamespace(searchEntry.namespace)) { + return getLatestCompatibleVersion(allVersions => this.versionGreaterThanOrEqualTo(this.supportedApiVersion, allVersions.version)); + } else { + return getLatestCompatibleVersion(allVersions => this.supportedVscodeApiSatisfies(allVersions.engines?.vscode ?? '*')); + } + } + + protected isBuiltinNamespace(namespace: string): boolean { + return VSXBuiltinNamespaces.is(namespace); + } + + /** + * @returns `a >= b` + */ + protected versionGreaterThanOrEqualTo(a: string, b: string): boolean { + const versionA = semver.clean(a); + const versionB = semver.clean(b); + if (!versionA || !versionB) { + return false; + } + return semver.gte(versionA, versionB); + } + + protected supportedVscodeApiSatisfies(vscodeApiRange: string): boolean { + return semver.satisfies(this.supportedApiVersion, vscodeApiRange); + } +} diff --git a/dev-packages/ovsx-client/src/ovsx-http-client.ts b/dev-packages/ovsx-client/src/ovsx-http-client.ts new file mode 100644 index 0000000..e6e5c32 --- /dev/null +++ b/dev-packages/ovsx-client/src/ovsx-http-client.ts @@ -0,0 +1,89 @@ +// ***************************************************************************** +// Copyright (C) 2023 Ericsson and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { OVSXClient, VSXQueryOptions, VSXQueryResult, VSXSearchOptions, VSXSearchResult } from './ovsx-types'; +import { RequestContext, RequestService } from '@theia/request'; +import { RateLimiter } from 'limiter'; + +export const OVSX_RATE_LIMIT = 15; + +export class OVSXHttpClient implements OVSXClient { + + /** + * @param requestService + * @returns factory that will cache clients based on the requested input URL. + */ + static createClientFactory(requestService: RequestService, rateLimiter?: RateLimiter): (url: string) => OVSXClient { + // eslint-disable-next-line no-null/no-null + const cachedClients: Record = Object.create(null); + return url => cachedClients[url] ??= new this(url, requestService, rateLimiter); + } + + constructor( + protected vsxRegistryUrl: string, + protected requestService: RequestService, + protected rateLimiter = new RateLimiter({ tokensPerInterval: OVSX_RATE_LIMIT, interval: 'second' }) + ) { } + + search(searchOptions?: VSXSearchOptions): Promise { + return this.requestJson(this.buildUrl('api/-/search', searchOptions)); + } + + query(queryOptions?: VSXQueryOptions): Promise { + return this.requestJson(this.buildUrl('api/v2/-/query', queryOptions)); + } + + protected async requestJson(url: string): Promise { + const attempts = 5; + for (let i = 0; i < attempts; i++) { + // Use 1, 2, 4, 8, 16 tokens for each attempt + const tokenCount = Math.pow(2, i); + await this.rateLimiter.removeTokens(tokenCount); + const context = await this.requestService.request({ + url, + headers: { 'Accept': 'application/json' } + }); + if (context.res.statusCode === 429) { + console.warn('OVSX rate limit exceeded. Consider reducing the rate limit.'); + // If there are still more attempts left, retry the request with a higher token count + if (i < attempts - 1) { + continue; + } + } + return RequestContext.asJson(context); + } + throw new Error('Failed to fetch data from OVSX.'); + } + + protected buildUrl(url: string, query?: object): string { + return new URL(`${url}${this.buildQueryString(query)}`, this.vsxRegistryUrl).toString(); + } + + protected buildQueryString(searchQuery?: object): string { + if (!searchQuery) { + return ''; + } + let queryString = ''; + for (const [key, value] of Object.entries(searchQuery)) { + if (typeof value === 'string') { + queryString += `&${key}=${encodeURIComponent(value)}`; + } else if (typeof value === 'boolean' || typeof value === 'number') { + queryString += `&${key}=${value}`; + } + } + return queryString && '?' + queryString.slice(1); + } +} diff --git a/dev-packages/ovsx-client/src/ovsx-router-client.spec.ts b/dev-packages/ovsx-client/src/ovsx-router-client.spec.ts new file mode 100644 index 0000000..d2d9f3c --- /dev/null +++ b/dev-packages/ovsx-client/src/ovsx-router-client.spec.ts @@ -0,0 +1,126 @@ +// ***************************************************************************** +// Copyright (C) 2023 Ericsson and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +/* eslint-disable no-null/no-null */ + +import { OVSXRouterClient } from './ovsx-router-client'; +import { testClientProvider, registries, filterFactories } from './test/ovsx-router-client.spec-data'; +import { ExtensionLike } from './ovsx-types'; +import assert = require('assert'); + +describe('OVSXRouterClient', async () => { + + const router = await OVSXRouterClient.FromConfig( + { + registries, + use: ['internal', 'public', 'third'], + rules: [{ + ifRequestContains: /\btestFullStop\b/.source, + use: null, + }, + { + ifRequestContains: /\bsecret\b/.source, + use: 'internal' + }, + { + ifExtensionIdMatches: /^some\./.source, + use: 'internal' + }] + }, + testClientProvider, + filterFactories, + ); + + it('test query agglomeration', async () => { + const result = await router.query({ namespaceName: 'other' }); + assert.deepStrictEqual(result.extensions.map(ExtensionLike.id), [ + // note the order: plugins from "internal" first then from "public" + 'other.d', + 'other.e' + ]); + }); + + it('test query request filtering', async () => { + const result = await router.query({ namespaceName: 'secret' }); + assert.deepStrictEqual(result.extensions.map(ExtensionLike.id), [ + // 'secret.w' from 'public' shouldn't be returned + 'secret.x', + 'secret.y', + 'secret.z' + ]); + }); + + it('test query result filtering', async () => { + const result = await router.query({ namespaceName: 'some' }); + assert.deepStrictEqual(result.extensions.map(ExtensionLike.idWithVersion), [ + // no entry for the `some` namespace should be returned from the `public` registry + 'some.a@1.0.0' + ]); + }); + + it('test query full stop', async () => { + const result = await router.query({ extensionId: 'testFullStop.c' }); + assert.deepStrictEqual(result.extensions.length, 0); + }); + + it('test search agglomeration', async () => { + const result = await router.search({ query: 'other.' }); + assert.deepStrictEqual(result.extensions.map(ExtensionLike.id), [ + // note the order: plugins from "internal" first then from "public" + 'other.d', + 'other.e' + ]); + }); + + it('test search request filtering', async () => { + const result = await router.search({ query: 'secret.' }); + assert.deepStrictEqual(result.extensions.map(ExtensionLike.id), [ + // 'secret.w' from 'public' shouldn't be returned + 'secret.x', + 'secret.y', + 'secret.z' + ]); + }); + + it('test search result filtering', async () => { + const result = await router.search({ query: 'some.' }); + assert.deepStrictEqual(result.extensions.map(ExtensionLike.idWithVersion), [ + // no entry for the `some` namespace should be returned from the `public` registry + 'some.a@1.0.0' + ]); + }); + + it('test search full stop', async () => { + const result = await router.search({ query: 'testFullStop.c' }); + assert.deepStrictEqual(result.extensions.length, 0); + }); + + it('test config with unknown conditions', async () => { + const clientPromise = OVSXRouterClient.FromConfig( + { + use: 'not relevant', + rules: [{ + ifRequestContains: /.*/.source, + unknownCondition: /should cause an error to be thrown/.source, + use: ['internal', 'public'] + }] + }, + testClientProvider, + filterFactories + ); + assert.rejects(clientPromise, /^Error: unknown conditions:/); + }); +}); diff --git a/dev-packages/ovsx-client/src/ovsx-router-client.ts b/dev-packages/ovsx-client/src/ovsx-router-client.ts new file mode 100644 index 0000000..6b524b9 --- /dev/null +++ b/dev-packages/ovsx-client/src/ovsx-router-client.ts @@ -0,0 +1,253 @@ +// ***************************************************************************** +// Copyright (C) 2023 Ericsson and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { ExtensionLike, OVSXClient, OVSXClientProvider, VSXExtensionRaw, VSXQueryOptions, VSXQueryResult, VSXSearchEntry, VSXSearchOptions, VSXSearchResult } from './ovsx-types'; +import type { MaybePromise } from './types'; + +export interface OVSXRouterFilter { + filterSearchOptions?(searchOptions?: VSXSearchOptions): MaybePromise; + filterQueryOptions?(queryOptions?: VSXQueryOptions): MaybePromise; + filterExtension?(extension: ExtensionLike): MaybePromise; +} + +/** + * @param conditions key/value mapping of condition statements that rules may process + * @param remainingKeys keys left to be processed, remove items from it when you handled them + */ +export type OVSXRouterFilterFactory = (conditions: Readonly>, remainingKeys: Set) => MaybePromise; + +/** + * Helper function to create factories that handle a single condition key. + */ +export function createFilterFactory(conditionKey: string, factory: (conditionValue: unknown) => OVSXRouterFilter | undefined): OVSXRouterFilterFactory { + return (conditions, remainingKeys) => { + if (conditionKey in conditions) { + const filter = factory(conditions[conditionKey]); + if (filter) { + remainingKeys.delete(conditionKey); + return filter; + } + } + }; +} + +export interface OVSXRouterConfig { + /** + * Registry aliases that will be used for routing. + */ + registries?: { + [alias: string]: string + } + /** + * The registry/ies to use by default. + */ + use: string | string[] + /** + * Filters for the different phases of interfacing with a registry. + */ + rules?: OVSXRouterRule[] +} + +export interface OVSXRouterRule { + [condition: string]: unknown + use?: string | string[] | null +} + +/** + * @internal + */ +export interface OVSXRouterParsedRule { + filters: OVSXRouterFilter[] + use: string[] +} + +/** + * Route and agglomerate queries according to {@link routerConfig}. + * {@link ruleFactories} is the actual logic used to evaluate the config. + * Each rule implementation will be ran sequentially over each configured rule. + */ +export class OVSXRouterClient implements OVSXClient { + + static async FromConfig(routerConfig: OVSXRouterConfig, clientProvider: OVSXClientProvider, filterFactories: OVSXRouterFilterFactory[]): Promise { + const rules = routerConfig.rules ? await this.ParseRules(routerConfig.rules, filterFactories, routerConfig.registries) : []; + return new this( + this.ParseUse(routerConfig.use, routerConfig.registries), + clientProvider, + rules + ); + } + + protected static async ParseRules(rules: OVSXRouterRule[], filterFactories: OVSXRouterFilterFactory[], aliases?: Record): Promise { + return Promise.all(rules.map(async ({ use, ...conditions }) => { + const remainingKeys = new Set(Object.keys(conditions)); + const filters = removeNullValues(await Promise.all(filterFactories.map(filterFactory => filterFactory(conditions, remainingKeys)))); + if (remainingKeys.size > 0) { + throw new Error(`unknown conditions: ${Array.from(remainingKeys).join(', ')}`); + } + return { + filters, + use: this.ParseUse(use, aliases) + }; + })); + } + + protected static ParseUse(use: string | string[] | null | undefined, aliases?: Record): string[] { + if (typeof use === 'string') { + return [alias(use)]; + } else if (Array.isArray(use)) { + return use.map(alias); + } else { + return []; + } + function alias(aliasOrUri: string): string { + return aliases?.[aliasOrUri] ?? aliasOrUri; + } + } + + constructor( + protected readonly useDefault: string[], + protected readonly clientProvider: OVSXClientProvider, + protected readonly rules: OVSXRouterParsedRule[], + ) { } + + async search(searchOptions?: VSXSearchOptions): Promise { + return this.runRules( + filter => filter.filterSearchOptions?.(searchOptions), + rule => rule.use.length > 0 + ? this.mergedSearch(rule.use, searchOptions) + : this.emptySearchResult(searchOptions), + () => this.mergedSearch(this.useDefault, searchOptions) + ); + } + + async query(queryOptions: VSXQueryOptions = {}): Promise { + return this.runRules( + filter => filter.filterQueryOptions?.(queryOptions), + rule => rule.use.length > 0 + ? this.mergedQuery(rule.use, queryOptions) + : this.emptyQueryResult(queryOptions), + () => this.mergedQuery(this.useDefault, queryOptions) + ); + } + + protected emptySearchResult(searchOptions?: VSXSearchOptions): VSXSearchResult { + return { + extensions: [], + offset: searchOptions?.offset ?? 0 + }; + } + + protected emptyQueryResult(queryOptions?: VSXQueryOptions): VSXQueryResult { + return { + offset: 0, + totalSize: 0, + extensions: [] + }; + } + + protected async mergedQuery(registries: string[], queryOptions?: VSXQueryOptions): Promise { + return this.mergeQueryResults(await createMapping(registries, async registry => (await this.clientProvider(registry)).query(queryOptions))); + } + + protected async mergedSearch(registries: string[], searchOptions?: VSXSearchOptions): Promise { + return this.mergeSearchResults(await createMapping(registries, async registry => (await this.clientProvider(registry)).search(searchOptions))); + } + + protected async mergeSearchResults(results: Map): Promise { + const filtering = [] as Promise[]; + results.forEach((result, sourceUri) => { + filtering.push(Promise + .all(result.extensions.map(extension => this.filterExtension(sourceUri, extension))) + .then(removeNullValues) + ); + }); + return { + extensions: interleave(await Promise.all(filtering)), + offset: Math.min(...Array.from(results.values(), result => result.offset)) + }; + } + + protected async mergeQueryResults(results: Map): Promise { + const filtering = [] as Promise[]; + results.forEach((result, sourceUri) => { + result.extensions.forEach(extension => filtering.push(this.filterExtension(sourceUri, extension))); + }); + const extensions = removeNullValues(await Promise.all(filtering)); + return { + offset: 0, + totalSize: extensions.length, + extensions + }; + } + + protected async filterExtension(sourceUri: string, extension: T): Promise { + return this.runRules( + filter => filter.filterExtension?.(extension), + rule => rule.use.includes(sourceUri) ? extension : undefined, + () => extension + ); + } + + protected runRules(runFilter: (filter: OVSXRouterFilter) => unknown, onRuleMatched: (rule: OVSXRouterParsedRule) => T): Promise; + protected runRules(runFilter: (filter: OVSXRouterFilter) => unknown, onRuleMatched: (rule: OVSXRouterParsedRule) => T, onNoRuleMatched: () => U): Promise; + protected async runRules( + runFilter: (filter: OVSXRouterFilter) => unknown, + onRuleMatched: (rule: OVSXRouterParsedRule) => T, + onNoRuleMatched?: () => U + ): Promise { + for (const rule of this.rules) { + const results = removeNullValues(await Promise.all(rule.filters.map(filter => runFilter(filter)))); + if (results.length > 0 && results.every(value => value)) { + return onRuleMatched(rule); + } + } + return onNoRuleMatched?.(); + } +} + +function nonNullable(value: T | null | undefined): value is T { + // eslint-disable-next-line no-null/no-null + return typeof value !== 'undefined' && value !== null; +} + +function removeNullValues(values: (T | null | undefined)[]): T[] { + return values.filter(nonNullable); +} + +/** + * Create a map where the keys are each element from {@link values} and the + * values are the result of a mapping function applied on the key. + */ +async function createMapping(values: T[], map: (value: T, index: number) => MaybePromise, thisArg?: unknown): Promise> { + return new Map(await Promise.all(values.map(async (value, index) => [value, await map.call(thisArg, value, index)] as [T, U]))); +} + +/** + * @example + * interleave([[1, 2, 3], [4, 5], [6, 7, 8]]) === [1, 4, 6, 2, 5, 7, 3, 8] + */ +function interleave(arrays: T[][]): T[] { + const interleaved: T[] = []; + const length = Math.max(...arrays.map(array => array.length)); + for (let i = 0; i < length; i++) { + for (const array of arrays) { + if (i < array.length) { + interleaved.push(array[i]); + } + } + } + return interleaved; +} diff --git a/dev-packages/ovsx-client/src/ovsx-router-filters/abstract-reg-exp-filter.ts b/dev-packages/ovsx-client/src/ovsx-router-filters/abstract-reg-exp-filter.ts new file mode 100644 index 0000000..8e4a3a0 --- /dev/null +++ b/dev-packages/ovsx-client/src/ovsx-router-filters/abstract-reg-exp-filter.ts @@ -0,0 +1,26 @@ +// ***************************************************************************** +// Copyright (C) 2023 Ericsson and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +export abstract class AbstractRegExpFilter { + + constructor( + protected regExp: RegExp + ) { } + + protected test(value: unknown): boolean { + return typeof value === 'string' && this.regExp.test(value); + } +} diff --git a/dev-packages/ovsx-client/src/ovsx-router-filters/extension-id-matches-filter.ts b/dev-packages/ovsx-client/src/ovsx-router-filters/extension-id-matches-filter.ts new file mode 100644 index 0000000..376e199 --- /dev/null +++ b/dev-packages/ovsx-client/src/ovsx-router-filters/extension-id-matches-filter.ts @@ -0,0 +1,32 @@ +// ***************************************************************************** +// Copyright (C) 2023 Ericsson and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { createFilterFactory, OVSXRouterFilter } from '../ovsx-router-client'; +import { ExtensionLike } from '../ovsx-types'; +import { AbstractRegExpFilter } from './abstract-reg-exp-filter'; + +export const ExtensionIdMatchesFilterFactory = createFilterFactory('ifExtensionIdMatches', ifExtensionIdMatches => { + if (typeof ifExtensionIdMatches !== 'string') { + throw new TypeError(`expected a string, got: ${typeof ifExtensionIdMatches}`); + } + return new ExtensionIdMatchesFilter(new RegExp(ifExtensionIdMatches, 'i')); +}); + +export class ExtensionIdMatchesFilter extends AbstractRegExpFilter implements OVSXRouterFilter { + filterExtension(extension: ExtensionLike): boolean { + return this.test(ExtensionLike.id(extension)); + } +} diff --git a/dev-packages/ovsx-client/src/ovsx-router-filters/index.ts b/dev-packages/ovsx-client/src/ovsx-router-filters/index.ts new file mode 100644 index 0000000..ee6222f --- /dev/null +++ b/dev-packages/ovsx-client/src/ovsx-router-filters/index.ts @@ -0,0 +1,18 @@ +// ***************************************************************************** +// Copyright (C) 2023 Ericsson and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +export { ExtensionIdMatchesFilterFactory } from './extension-id-matches-filter'; +export { RequestContainsFilterFactory } from './request-contains-filter'; diff --git a/dev-packages/ovsx-client/src/ovsx-router-filters/request-contains-filter.ts b/dev-packages/ovsx-client/src/ovsx-router-filters/request-contains-filter.ts new file mode 100644 index 0000000..d08643c --- /dev/null +++ b/dev-packages/ovsx-client/src/ovsx-router-filters/request-contains-filter.ts @@ -0,0 +1,35 @@ +// ***************************************************************************** +// Copyright (C) 2023 Ericsson and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { createFilterFactory, OVSXRouterFilter } from '../ovsx-router-client'; +import { VSXQueryOptions, VSXSearchOptions } from '../ovsx-types'; +import { AbstractRegExpFilter } from './abstract-reg-exp-filter'; + +export const RequestContainsFilterFactory = createFilterFactory('ifRequestContains', ifRequestContains => { + if (typeof ifRequestContains !== 'string') { + throw new TypeError(`expected a string, got: ${typeof ifRequestContains}`); + } + return new RequestContainsFilter(new RegExp(ifRequestContains, 'i')); +}); + +export class RequestContainsFilter extends AbstractRegExpFilter implements OVSXRouterFilter { + filterSearchOptions(searchOptions?: VSXSearchOptions): boolean { + return !searchOptions || this.test(searchOptions.query) || this.test(searchOptions.category); + } + filterQueryOptions(queryOptions?: VSXQueryOptions): boolean { + return !queryOptions || Object.values(queryOptions).some(this.test, this); + } +} diff --git a/dev-packages/ovsx-client/src/ovsx-types.ts b/dev-packages/ovsx-client/src/ovsx-types.ts new file mode 100644 index 0000000..ec747eb --- /dev/null +++ b/dev-packages/ovsx-client/src/ovsx-types.ts @@ -0,0 +1,309 @@ +// ***************************************************************************** +// Copyright (C) 2020 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { MaybePromise } from './types'; + +export interface ExtensionLike { + name: string; + namespace: string; + version?: string; +} +export namespace ExtensionLike { + export function id(extension: T): `${string}.${string}` { + return `${extension.namespace}.${extension.name}`; + } + export function idWithVersion(extension: T): `${string}.${string}@${string}` { + if (!extension.version) { + throw new Error(`no valid "version" value provided for "${id(extension)}"`); + } + return `${id(extension)}@${extension.version}`; + } + // eslint-disable-next-line @typescript-eslint/no-shadow + export function fromId(id: string): ExtensionLike { + const [left, version] = id.split('@', 2); + const [namespace, name] = left.split('.', 2); + return { + name, + namespace, + version + }; + } +} + +export interface OVSXClient { + /** + * GET https://openvsx.org/api/-/search + */ + search(searchOptions?: VSXSearchOptions): Promise; + /** + * GET https://openvsx.org/api/v2/-/query + * + * Fetch one or all versions of an extension. + */ + query(queryOptions?: VSXQueryOptions): Promise; +} + +/** @deprecated since 1.31.0 use {@link VSXSearchOptions} instead */ +export type VSXSearchParam = VSXSearchOptions; +/** + * The possible options when performing a search. + * + * For available options, and default values consult the `swagger`: https://open-vsx.org/swagger-ui/index.html. + * + * Should be aligned with https://github.com/eclipse/openvsx/blob/b5694a712e07d266801394916bac30609e16d77b/server/src/main/java/org/eclipse/openvsx/RegistryAPI.java#L246-L266 + */ +export interface VSXSearchOptions { + /** + * The query text for searching. + */ + query?: string; + /** + * The extension category. + */ + category?: string; + /** + * The maximum number of entries to return. + */ + size?: number; + /** + * The number of entries to skip (usually a multiple of the page size). + */ + offset?: number; + /** + * The sort order. + */ + sortOrder?: 'asc' | 'desc'; + /** + * The sort key. + */ + sortBy?: 'averageRating' | 'downloadCount' | 'relevance' | 'timestamp'; + /** + * By default an OpenVSX registry will return the last known version of + * extensions. Setting this field to `true` will have the registry specify + * the {@link VSXExtensionRaw.allVersions} field which references all known + * versions for each returned extension. + * + * @default false + */ + includeAllVersions?: boolean; +} + +/** + * Should be aligned with https://github.com/eclipse/openvsx/blob/e8f64fe145fc05d2de1469735d50a7a90e400bc4/server/src/main/java/org/eclipse/openvsx/json/SearchResultJson.java + */ +export interface VSXSearchResult { + offset: number; + extensions: VSXSearchEntry[]; +} + +/** + * The possible options when performing a search. + * + * For available options, and default values consult the `swagger`: https://open-vsx.org/swagger-ui/index.html. + * + * Should be aligned with https://github.com/eclipse/openvsx/blob/b5694a712e07d266801394916bac30609e16d77b/server/src/main/java/org/eclipse/openvsx/json/QueryParamJson.java#L18-L46 + */ +export interface VSXQueryOptions { + namespaceName?: string; + extensionName?: string; + extensionVersion?: string; + extensionId?: string; + extensionUuid?: string; + namespaceUuid?: string; + includeAllVersions?: boolean | 'links'; + targetPlatform?: VSXTargetPlatform; + size?: number; + offset?: number; +} + +export type VSXTargetPlatform = + 'universal' | 'web' | + 'win32-x64' | 'win32-ia32' | 'win32-arm64' | + 'darwin-x64' | 'darwin-arm64' | + 'linux-x64' | 'linux-arm64' | 'linux-armhf' | + 'alpine-x64' | 'alpine-arm64' | (string & {}); + +export interface VSXQueryResult { + success?: string; + warning?: string; + error?: string; + offset: number; + totalSize: number; + extensions: VSXExtensionRaw[]; +} + +/** + * This type describes the data as found in {@link VSXSearchEntry.allVersions}. + * + * Note that this type only represents one version of a given plugin, despite the name. + */ +export interface VSXAllVersions { + url: string; + version: string; + engines?: { + [version: string]: string; + }; +} + +/** + * Should be aligned with https://github.com/eclipse/openvsx/blob/master/server/src/main/java/org/eclipse/openvsx/json/SearchEntryJson.java + */ +export interface VSXSearchEntry { + url: string; + files: { + download: string; + manifest?: string; + readme?: string; + license?: string; + icon?: string; + }; + name: string; + namespace: string; + version: string; + timestamp: string; + averageRating?: number; + downloadCount: number; + displayName?: string; + description?: string; + /** + * May be undefined when {@link VSXSearchOptions.includeAllVersions} is + * `false` or `undefined`. + */ + allVersions?: VSXAllVersions[]; +} + +export type VSXExtensionNamespaceAccess = 'public' | 'restricted'; + +/** + * Should be aligned with https://github.com/eclipse/openvsx/blob/master/server/src/main/java/org/eclipse/openvsx/json/UserJson.java + */ +export interface VSXUser { + loginName: string; + homepage?: string; +} + +export interface VSXExtensionRawFiles { + download: string; + readme?: string; + license?: string; + icon?: string; +} + +/** + * Should be aligned with https://github.com/eclipse/openvsx/blob/master/server/src/main/java/org/eclipse/openvsx/json/ExtensionJson.java + */ +export interface VSXExtensionRaw { + error?: string; + namespaceUrl: string; + reviewsUrl: string; + name: string; + namespace: string; + targetPlatform?: VSXTargetPlatform; + publishedBy: VSXUser; + preRelease: boolean; + namespaceAccess: VSXExtensionNamespaceAccess; + files: VSXExtensionRawFiles; + allVersions: { + [version: string]: string; + }; + allVersionsUrl?: string; + averageRating?: number; + downloadCount: number; + reviewCount: number; + version: string; + timestamp: string; + preview?: boolean; + verified?: boolean; + displayName?: string; + namespaceDisplayName: string; + description?: string; + categories?: string[]; + extensionKind?: string[]; + tags?: string[]; + license?: string; + homepage?: string; + repository?: string; + sponsorLink?: string; + bugs?: string; + markdown?: string; + galleryColor?: string; + galleryTheme?: string; + localizedLanguages?: string[]; + qna?: string; + badges?: VSXBadge[]; + dependencies?: VSXExtensionReference[]; + bundledExtensions?: VSXExtensionReference[]; + allTargetPlatformVersions?: VSXTargetPlatforms[]; + url?: string; + engines?: { + [engine: string]: string; + }; +} + +export interface VSXBadge { + url?: string; + href?: string; + description?: string; +} + +export interface VSXExtensionReference { + url: string; + namespace: string; + extension: string; +} + +export interface VSXTargetPlatforms { + version: string; + targetPlatforms: VSXTargetPlatform[]; +} + +export interface VSXResponseError extends Error { + statusCode: number; +} + +export namespace VSXResponseError { + export function is(error: unknown): error is VSXResponseError { + return !!error && typeof error === 'object' && typeof (error as VSXResponseError).statusCode === 'number'; + } +} + +/** + * Builtin namespaces maintained by the framework. + */ +export namespace VSXBuiltinNamespaces { + + /** + * Namespace for individual vscode builtin extensions. + */ + export const VSCODE = 'vscode'; + + /** + * Namespace for vscode builtin extension packs. + * - corresponds to: https://github.com/eclipse-theia/vscode-builtin-extensions/blob/af9cfeb2ea23e1668a8340c1c2fb5afd56be07d7/src/create-extension-pack.js#L45 + */ + export const THEIA = 'eclipse-theia'; + + /** + * Determines if the extension namespace is a builtin maintained by the framework. + * @param namespace the extension namespace to verify. + */ + export function is(namespace: string): boolean { + return namespace === VSCODE + || namespace === THEIA; + } +} + +export type OVSXClientProvider = (uri: string) => MaybePromise; diff --git a/dev-packages/ovsx-client/src/test/ovsx-mock-client.ts b/dev-packages/ovsx-client/src/test/ovsx-mock-client.ts new file mode 100644 index 0000000..6d49f08 --- /dev/null +++ b/dev-packages/ovsx-client/src/test/ovsx-mock-client.ts @@ -0,0 +1,187 @@ +// ***************************************************************************** +// Copyright (C) 2023 Ericsson and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { ExtensionLike, OVSXClient, VSXExtensionRaw, VSXQueryOptions, VSXQueryResult, VSXSearchOptions, VSXSearchResult } from '../ovsx-types'; + +/** + * Querying will only find exact matches. + * Searching will try to find the query string in various fields. + */ +export class OVSXMockClient implements OVSXClient { + + constructor( + public extensions: VSXExtensionRaw[] = [] + ) { } + + setExtensions(extensions: VSXExtensionRaw[]): this { + this.extensions = extensions; + return this; + } + + /** + * @param baseUrl required to construct the URLs required by {@link VSXExtensionRaw}. + * @param ids list of ids to generate {@link VSXExtensionRaw} from. + */ + setExtensionsFromIds(baseUrl: string, ids: string[]): this { + const now = Date.now(); + const url = new OVSXMockClient.UrlBuilder(baseUrl); + this.extensions = ids.map((extension, i) => { + const [id, version = '0.0.1'] = extension.split('@', 2); + const [namespace, name] = id.split('.', 2); + return { + allVersions: { + [version]: url.extensionUrl(namespace, name, `/${version}`) + }, + displayName: name, + downloadCount: 0, + files: { + download: url.extensionFileUrl(namespace, name, version, `/${id}-${version}.vsix`) + }, + name, + namespace, + namespaceAccess: 'public', + namespaceUrl: url.namespaceUrl(namespace), + publishedBy: { + loginName: 'mock' + }, + reviewCount: 0, + reviewsUrl: url.extensionReviewsUrl(namespace, name), + timestamp: new Date(now - ids.length + i + 1).toISOString(), + version, + description: `Mock VS Code Extension for ${id}`, + namespaceDisplayName: name, + preRelease: false + }; + }); + return this; + } + + async query(queryOptions?: VSXQueryOptions): Promise { + const extensions = this.extensions + .filter(extension => typeof queryOptions === 'object' && ( + this.compare(queryOptions.extensionId, this.id(extension)) && + this.compare(queryOptions.extensionName, extension.name) && + this.compare(queryOptions.extensionVersion, extension.version) && + this.compare(queryOptions.namespaceName, extension.namespace) + )); + return { + offset: 0, + totalSize: extensions.length, + extensions + }; + } + + async search(searchOptions?: VSXSearchOptions): Promise { + const query = searchOptions?.query; + const offset = searchOptions?.offset ?? 0; + const size = searchOptions?.size ?? 18; + const end = offset + size; + return { + offset, + extensions: this.extensions + .filter(extension => typeof query !== 'string' || ( + this.includes(query, this.id(extension)) || + this.includes(query, extension.description) || + this.includes(query, extension.displayName) + )) + .sort((a, b) => this.sort(a, b, searchOptions)) + .filter((extension, i) => i >= offset && i < end) + .map(extension => ({ + downloadCount: extension.downloadCount, + files: extension.files, + name: extension.name, + namespace: extension.namespace, + timestamp: extension.timestamp, + url: `${extension.namespaceUrl}/${extension.name}`, + version: extension.version, + })) + }; + } + + protected id(extension: ExtensionLike): string { + return `${extension.namespace}.${extension.name}`; + } + + /** + * Case sensitive. + */ + protected compare(expected?: string, value?: string): boolean { + return expected === undefined || value === undefined || expected === value; + } + + /** + * Case insensitive. + */ + protected includes(needle: string, value?: string): boolean { + return value === undefined || value.toLowerCase().includes(needle.toLowerCase()); + } + + protected sort(a: VSXExtensionRaw, b: VSXExtensionRaw, searchOptions?: VSXSearchOptions): number { + let order: number = 0; + const sortBy = searchOptions?.sortBy ?? 'relevance'; + const sortOrder = searchOptions?.sortOrder ?? 'desc'; + if (sortBy === 'averageRating') { + order = (a.averageRating ?? -1) - (b.averageRating ?? -1); + } else if (sortBy === 'downloadCount') { + order = a.downloadCount - b.downloadCount; + } else if (sortBy === 'relevance') { + order = 0; + } else if (sortBy === 'timestamp') { + order = new Date(a.timestamp).getTime() - new Date(b.timestamp).getTime(); + } + if (sortOrder === 'asc') { + order *= -1; + } + return order; + } +} +export namespace OVSXMockClient { + + /** + * URLs should respect the official OpenVSX API: + * https://open-vsx.org/swagger-ui/index.html + */ + export class UrlBuilder { + + constructor( + protected baseUrl: string + ) { } + + url(path: string): string { + return this.baseUrl + path; + } + + apiUrl(path: string): string { + return this.url(`/api${path}`); + } + + namespaceUrl(namespace: string, path = ''): string { + return this.apiUrl(`/${namespace}${path}`); + } + + extensionUrl(namespace: string, name: string, path = ''): string { + return this.apiUrl(`/${namespace}/${name}${path}`); + } + + extensionReviewsUrl(namespace: string, name: string): string { + return this.apiUrl(`/${namespace}/${name}/reviews`); + } + + extensionFileUrl(namespace: string, name: string, version: string, path = ''): string { + return this.apiUrl(`/${namespace}/${name}/${version}/file${path}`); + } + } +} diff --git a/dev-packages/ovsx-client/src/test/ovsx-router-client.spec-data.ts b/dev-packages/ovsx-client/src/test/ovsx-router-client.spec-data.ts new file mode 100644 index 0000000..3e3e5da --- /dev/null +++ b/dev-packages/ovsx-client/src/test/ovsx-router-client.spec-data.ts @@ -0,0 +1,68 @@ +// ***************************************************************************** +// Copyright (C) 2023 Ericsson and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +/* eslint-disable no-null/no-null */ + +import { OVSXMockClient } from './ovsx-mock-client'; +import { ExtensionIdMatchesFilterFactory, RequestContainsFilterFactory } from '../ovsx-router-filters'; +import { OVSXClient } from '../ovsx-types'; + +export const registries = { + internal: 'https://internal.testdomain/', + public: 'https://public.testdomain/', + third: 'https://third.testdomain/' +}; + +export const clients: Record = { + [registries.internal]: new OVSXMockClient().setExtensionsFromIds(registries.internal, [ + 'some.a@1.0.0', + 'other.d', + 'secret.x', + 'secret.y', + 'secret.z', + ...Array(50) + .fill(undefined) + .map((element, i) => `internal.autogen${i}`) + ]), + [registries.public]: new OVSXMockClient().setExtensionsFromIds(registries.public, [ + 'some.a@2.0.0', + 'some.b', + 'other.e', + 'testFullStop.c', + 'secret.w', + ...Array(50) + .fill(undefined) + .map((element, i) => `public.autogen${i}`) + ]), + [registries.third]: new OVSXMockClient().setExtensionsFromIds(registries.third, [ + ...Array(200) + .fill(undefined) + .map((element, i) => `third.autogen${i}`) + ]) +}; + +export const filterFactories = [ + RequestContainsFilterFactory, + ExtensionIdMatchesFilterFactory +]; + +export function testClientProvider(uri: string): OVSXClient { + const client = clients[uri]; + if (!client) { + throw new Error(`unknown client for URI=${uri}`); + } + return client; +}; diff --git a/dev-packages/ovsx-client/src/types.ts b/dev-packages/ovsx-client/src/types.ts new file mode 100644 index 0000000..e967366 --- /dev/null +++ b/dev-packages/ovsx-client/src/types.ts @@ -0,0 +1,17 @@ +// ***************************************************************************** +// Copyright (C) 2023 Ericsson and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +export type MaybePromise = T | PromiseLike; diff --git a/dev-packages/ovsx-client/tsconfig.json b/dev-packages/ovsx-client/tsconfig.json new file mode 100644 index 0000000..1699f09 --- /dev/null +++ b/dev-packages/ovsx-client/tsconfig.json @@ -0,0 +1,16 @@ +{ + "extends": "../../configs/base.tsconfig", + "compilerOptions": { + "composite": true, + "rootDir": "src", + "outDir": "lib" + }, + "include": [ + "src" + ], + "references": [ + { + "path": "../request" + } + ] +} diff --git a/dev-packages/private-eslint-plugin/.eslintrc.js b/dev-packages/private-eslint-plugin/.eslintrc.js new file mode 100644 index 0000000..1308994 --- /dev/null +++ b/dev-packages/private-eslint-plugin/.eslintrc.js @@ -0,0 +1,10 @@ +/** @type {import('eslint').Linter.Config} */ +module.exports = { + extends: [ + '../../configs/build.eslintrc.json' + ], + parserOptions: { + tsconfigRootDir: __dirname, + project: 'tsconfig.json' + } +}; diff --git a/dev-packages/private-eslint-plugin/README.md b/dev-packages/private-eslint-plugin/README.md new file mode 100644 index 0000000..51cb5c8 --- /dev/null +++ b/dev-packages/private-eslint-plugin/README.md @@ -0,0 +1,62 @@ +
+ +
+ +theia-ext-logo + +

ECLIPSE THEIA - ESLINT PLUGIN

+ +
+ +
+ +## Description + +The `@theia/eslint-plugin` contributes rules useful for Eclipse Theia development. +The plugin helps identify problems during development through static analysis including code quality, potential issues and code smells. + +## Rules + +### `annotation-check` + +Inversify >=6.1 requires to annotate all constructor parameters of injectable classes as otherwise runtime errors are thrown. +The rule checks that all constructor parameters of injectable classes are annotated with `@inject`, `@unmanaged` or `@multiInject`. + +### `localization-check` + +The rule prevents the following localization related issues: + +- incorrect usage of the `nls.localizeByDefault` function by using an incorrect default value. +- unnecessary call to `nls.localize` which could be replaced by `nls.localizeByDefault`. + +### `no-src-import` + +The rule prevents imports using `/src/` rather than `/lib/` as it causes build failures. +The rule helps developers more easily identify the cause of build errors caused by the incorrect import. + +#### `runtime-import-check` + +The rule prevents imports from folders meant for incompatible runtimes. +The check enforces the [code organization guidelines](https://github.com/eclipse-theia/theia/wiki/Code-Organization) of the framework and guards against invalid imports which may cause unforeseen issues downstream. + +#### `shared-dependencies` + +The rule prevents the following: + +- prevents the implicit use of a shared dependency from `@theia/core`. +- prevents extensions from depending on a shared dependency without re-using it from `@theia/core`. + +## Additional Information + +- [Theia - GitHub](https://github.com/eclipse-theia/theia) +- [Theia - Website](https://theia-ide.org/) + +## License + +- [Eclipse Public License 2.0](http://www.eclipse.org/legal/epl-2.0/) +- [一 (Secondary) GNU General Public License, version 2 with the GNU Classpath Exception](https://projects.eclipse.org/license/secondary-gpl-2.0-cp) + +## Trademark + +"Theia" is a trademark of the Eclipse Foundation + diff --git a/dev-packages/private-eslint-plugin/index.js b/dev-packages/private-eslint-plugin/index.js new file mode 100644 index 0000000..ea3c8d7 --- /dev/null +++ b/dev-packages/private-eslint-plugin/index.js @@ -0,0 +1,25 @@ +// @ts-check +// ***************************************************************************** +// Copyright (C) 2021 Ericsson and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +/** @type {{[ruleId: string]: import('eslint').Rule.RuleModule}} */ +exports.rules = { + "annotation-check": require('./rules/annotation-check'), + "localization-check": require('./rules/localization-check'), + "no-src-import": require('./rules/no-src-import'), + "runtime-import-check": require('./rules/runtime-import-check'), + "shared-dependencies": require('./rules/shared-dependencies') +}; diff --git a/dev-packages/private-eslint-plugin/package.json b/dev-packages/private-eslint-plugin/package.json new file mode 100644 index 0000000..4145822 --- /dev/null +++ b/dev-packages/private-eslint-plugin/package.json @@ -0,0 +1,16 @@ +{ + "private": true, + "name": "@theia/eslint-plugin", + "version": "1.68.0", + "description": "Custom ESLint rules for developing Theia extensions and applications", + "main": "index.js", + "scripts": { + "afterInstall": "npm run compile", + "compile": "theiaext compile" + }, + "dependencies": { + "@theia/ext-scripts": "1.68.0", + "@theia/re-exports": "1.68.0", + "js-levenshtein": "^1.1.6" + } +} diff --git a/dev-packages/private-eslint-plugin/rules/annotation-check.js b/dev-packages/private-eslint-plugin/rules/annotation-check.js new file mode 100644 index 0000000..c1da1cc --- /dev/null +++ b/dev-packages/private-eslint-plugin/rules/annotation-check.js @@ -0,0 +1,103 @@ +// @ts-check +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +/** + * @typedef {import('@typescript-eslint/utils').TSESTree.ClassDeclaration} ClassDeclaration + * @typedef {import('@typescript-eslint/utils').TSESTree.ClassElement} ClassElement + * @typedef {import('@typescript-eslint/utils').TSESTree.Decorator} Decorator + * @typedef {import('@typescript-eslint/utils').TSESTree.MethodDefinition} MethodDefinition + * @typedef {import('@typescript-eslint/utils').TSESTree.Parameter} Parameter + * @typedef {import('estree').Node} Node + * @typedef {import('eslint').Rule.RuleModule} RuleModule + */ + +/** + * Type guard to check if a ClassElement is a MethodDefinition. + * @param {ClassElement} element + * @returns {element is MethodDefinition} + */ +function isMethodDefinition(element) { + return element.type === 'MethodDefinition'; +} + +/** @type {RuleModule} */ +module.exports = { + meta: { + type: 'problem', + docs: { + description: + 'Ensure @injectable classes have annotated constructor parameters', + }, + messages: { + missingAnnotation: 'Constructor parameters in an @injectable class must be annotated with @inject, @unmanaged or @multiInject', + }, + }, + create(context) { + return { + /** + * @param {ClassDeclaration} node + */ + ClassDeclaration(node) { + // Check if the class has a decorator named `injectable` + const hasInjectableDecorator = node.decorators?.some( + (/** @type {Decorator} */ decorator) => + decorator.expression.type === 'CallExpression' && + decorator.expression.callee.type === 'Identifier' && + decorator.expression.callee.name === 'injectable' + ); + + if (hasInjectableDecorator) { + // Find the constructor method within the class body + const constructor = node.body.body.find( + member => + isMethodDefinition(member) && + member.kind === 'constructor' + ); + + if ( + constructor && + // We need to re-apply 'isMethodDefinition' here because the type guard is not properly preserved + isMethodDefinition(constructor) && + constructor.value && + constructor.value.params.length > 0 + ) { + constructor.value.params.forEach( + /** @type {Parameter} */ param => { + // Check if each constructor parameter has a decorator + const hasAnnotation = param.decorators?.some( + (/** @type {Decorator} */ decorator) => + decorator.expression.type === 'CallExpression' && + decorator.expression.callee.type === 'Identifier' && + (decorator.expression.callee.name === 'inject' || + decorator.expression.callee.name === 'unmanaged' || + decorator.expression.callee.name === 'multiInject') + ); + + if (!hasAnnotation) { + context.report({ + node: /** @type Node */ (param), + messageId: 'missingAnnotation', + }); + } + } + ); + } + } + }, + }; + }, +}; diff --git a/dev-packages/private-eslint-plugin/rules/localization-check.js b/dev-packages/private-eslint-plugin/rules/localization-check.js new file mode 100644 index 0000000..3b0c248 --- /dev/null +++ b/dev-packages/private-eslint-plugin/rules/localization-check.js @@ -0,0 +1,149 @@ +// @ts-check +// ***************************************************************************** +// Copyright (C) 2021 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +const levenshtein = require('js-levenshtein'); + +// eslint-disable-next-line import/no-extraneous-dependencies +const metadata = require('@theia/core/src/common/i18n/nls.metadata.json'); +const messages = new Set(Object.values(metadata.messages) + .reduceRight((prev, curr) => prev.concat(curr), []) + .map(e => e.replace(/&&/g, ''))); + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + meta: { + type: 'problem', + fixable: 'code', + docs: { + description: 'prevent incorrect use of \'nls.localize\'.', + }, + }, + create(context) { + return { + CallExpression(node) { + const callee = node.callee; + if (callee.type === 'Super') { + return; + } + const localizeResults = evaluateLocalize(node); + for (const { value, byDefault, node: localizeNode } of localizeResults) { + if (value !== undefined && localizeNode) { + if (byDefault && !messages.has(value)) { + let lowestDistance = Number.MAX_VALUE; + let lowestMessage = ''; + for (const message of messages) { + const distance = levenshtein(value, message); + if (distance < lowestDistance) { + lowestDistance = distance; + lowestMessage = message; + } + } + if (lowestMessage) { + const replacementValue = `'${lowestMessage.replace(/'/g, "\\'").replace(/\n/g, '\\n')}'`; + context.report({ + node: localizeNode, + message: `'${value}' is not a valid default value. Did you mean ${replacementValue}?`, + fix: function (fixer) { + return fixer.replaceText(localizeNode, replacementValue); + } + }); + } else { + context.report({ + node: localizeNode, + message: `'${value}' is not a valid default value.` + }); + } + } else if (!byDefault && messages.has(value)) { + context.report({ + node, + message: `'${value}' can be translated using the 'nls.localizeByDefault' function.`, + fix: function (fixer) { + const code = context.getSourceCode(); + const args = node.arguments.slice(1); + const argsCode = args.map(e => code.getText(e)).join(', '); + const updatedCall = `nls.localizeByDefault(${argsCode})`; + return fixer.replaceText(node, updatedCall); + } + }); + } + } + } + } + }; + + /** + * Evaluates a call expression and returns localization info. + * @param {import('estree').CallExpression} node + * @returns {Array<{value?: string, byDefault: boolean, node?: import('estree').Node}>} + */ + function evaluateLocalize(/** @type {import('estree').CallExpression} */ node) { + const callee = node.callee; + if ('object' in callee && 'name' in callee.object && 'property' in callee && 'name' in callee.property && callee.object.name === 'nls') { + if (callee.property.name === 'localize') { + const defaultTextNode = node.arguments[1]; // The default text node is the second argument for `nls.localize` + if (defaultTextNode && defaultTextNode.type === 'Literal' && typeof defaultTextNode.value === 'string') { + return [{ + node: defaultTextNode, + value: defaultTextNode.value, + byDefault: false + }]; + } + } else if (callee.property.name === 'localizeByDefault') { + const defaultTextNode = node.arguments[0]; // The default text node is the first argument for `nls.localizeByDefault` + if (defaultTextNode && defaultTextNode.type === 'Literal' && typeof defaultTextNode.value === 'string') { + return [{ + node: defaultTextNode, + value: defaultTextNode.value, + byDefault: true + }]; + } + } + } + // Check for Command.toDefaultLocalizedCommand + if ('object' in callee && 'name' in callee.object && 'property' in callee && 'name' in callee.property + && callee.object.name === 'Command' && callee.property.name === 'toDefaultLocalizedCommand') { + const commandArg = node.arguments[0]; + if (commandArg && commandArg.type === 'ObjectExpression') { + return extractDefaultLocalizedProperties(commandArg); + } + } + return []; + } + + /** + * Extracts label and category properties from a Command object that will be passed to localizeByDefault. + * @param {import('estree').ObjectExpression} objectNode + * @returns {Array<{value?: string, byDefault: boolean, node?: import('estree').Node}>} + */ + function extractDefaultLocalizedProperties(objectNode) { + const results = []; + for (const property of objectNode.properties) { + if (property.type === 'Property' && property.key.type === 'Identifier') { + const keyName = property.key.name; + if ((keyName === 'label' || keyName === 'category') && property.value.type === 'Literal' && typeof property.value.value === 'string') { + results.push({ + node: property.value, + value: property.value.value, + byDefault: true + }); + } + } + } + return results; + } + } +}; diff --git a/dev-packages/private-eslint-plugin/rules/no-src-import.js b/dev-packages/private-eslint-plugin/rules/no-src-import.js new file mode 100644 index 0000000..84dcef5 --- /dev/null +++ b/dev-packages/private-eslint-plugin/rules/no-src-import.js @@ -0,0 +1,54 @@ +// @ts-check +// ***************************************************************************** +// Copyright (C) 2021 Ericsson and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +const path = require('path'); + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + meta: { + type: 'problem', + fixable: 'code', + docs: { + description: 'prevent imports from \'src\'.', + }, + }, + create(context) { + return { + ImportDeclaration(node) { + checkModuleImport(node.source); + }, + TSExternalModuleReference(node) { + checkModuleImport(node.expression); + }, + }; + function checkModuleImport(node) { + const module = /** @type {string} */(node.value); + const extension = path.parse(module).ext; + const re = /^@theia\/\S+\/src\//; + if (re.test(module) && extension === '') { + context.report({ + node, + message: `'${module}' should not be imported with '/src/'`, + fix: function (fixer) { + const updatedModule = `'${module.replace('/src/', '/lib/')}'`; + return fixer.replaceText(node, updatedModule); + } + }); + } + } + } +}; diff --git a/dev-packages/private-eslint-plugin/rules/runtime-import-check.js b/dev-packages/private-eslint-plugin/rules/runtime-import-check.js new file mode 100644 index 0000000..503333e --- /dev/null +++ b/dev-packages/private-eslint-plugin/rules/runtime-import-check.js @@ -0,0 +1,119 @@ +// @ts-check +// ***************************************************************************** +// Copyright (C) 2021 Ericsson and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +/* eslint-disable max-len */ + +const path = require('path'); + +/** + * Runtime-specific folders according to our coding guidelines. + */ +const folders = { + common: 'common', + browser: 'browser', + node: 'node', + electronCommon: 'electron-common', + electronBrowser: 'electron-browser', + electronNode: 'electron-node', + electronMain: 'electron-main', +}; + +/** + * @typedef {object} ImportRule + * @property {string[]} allowed + * @property {string[]} restricted + */ + +/** + * @param {string} src + * @param {string[]} allowedFolders + * @returns {[string, ImportRule]} + */ +function allow(src, allowedFolders) { + const allowed = [src, ...allowedFolders]; + const restricted = Object.values(folders).filter(folder => !allowed.includes(folder)); + return [src, { allowed, restricted }]; +} + +/** + * Mapping of folders to the list of allowed/restricted folders to import from. + * @type {[string, ImportRule][]} + */ +const importRuleMapping = [ + allow(folders.common, []), + allow(folders.browser, [folders.common]), + allow(folders.node, [folders.common]), + allow(folders.electronCommon, [folders.common]), + allow(folders.electronBrowser, [folders.electronCommon, folders.browser, folders.common]), + allow(folders.electronNode, [folders.electronCommon, folders.node, folders.common]), + allow(folders.electronMain, [folders.electronCommon, folders.node, folders.common]), +]; + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + meta: { + type: 'problem', + fixable: 'code', + docs: { + description: 'prevent imports from folders meant for incompatible runtimes.', + url: 'https://github.com/eclipse-theia/theia/tree/master/doc/code-organization.md' + }, + }, + create(context) { + let relativeFilePath = path.relative(context.getCwd(), context.getFilename()); + // Normalize the path so we only deal with forward slashes. + if (process.platform === 'win32') { + relativeFilePath = relativeFilePath.replace(/\\/g, '/'); + } + // Search for a folder following our naming conventions, keep the left-most match. + // e.g. `src/electron-node/browser/node/...` should match `electron-node` + let lowestIndex = Infinity; + /** @type {ImportRule | undefined} */ + let matchedImportRule; + /** @type {string | undefined} */ + let matchedFolder; + for (const [folder, importRule] of importRuleMapping) { + const index = relativeFilePath.indexOf(`/${folder}/`); + if (index !== -1 && index < lowestIndex) { + matchedImportRule = importRule; + matchedFolder = folder; + lowestIndex = index; + } + } + // File doesn't follow our naming convention so we'll bail now. + if (matchedFolder === undefined) { + return {}; + } + return { + ImportDeclaration(node) { + checkModuleImport(node.source); + }, + TSExternalModuleReference(node) { + checkModuleImport(node.expression); + }, + }; + function checkModuleImport(node) { + const module = /** @type {string} */(node.value); + if (matchedImportRule.restricted.some(restricted => module.includes(`/${restricted}/`) || module.endsWith(`/${restricted}`))) { + context.report({ + node, + message: `'${module}' cannot be imported in '${matchedFolder}', only '${matchedImportRule.allowed.join(', ')}' ${matchedImportRule.allowed.length === 1 ? 'is' : 'are'} allowed.` + }); + } + } + }, +}; diff --git a/dev-packages/private-eslint-plugin/rules/shared-dependencies.js b/dev-packages/private-eslint-plugin/rules/shared-dependencies.js new file mode 100644 index 0000000..19560ce --- /dev/null +++ b/dev-packages/private-eslint-plugin/rules/shared-dependencies.js @@ -0,0 +1,164 @@ +// @ts-check +// ***************************************************************************** +// Copyright (C) 2021 Ericsson and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +/* eslint-disable max-len */ + +const fs = require('fs'); +const path = require('path'); +const { PackageReExports } = require('@theia/re-exports'); + +const coreReExports = PackageReExports.FromPackageSync('@theia/core'); + +/** @type {import('eslint').Rule.RuleModule} */ +module.exports = { + meta: { + type: 'problem', + fixable: 'code', + docs: { + description: 'Errors when a dependency shared by @theia/core is used implicitly, or when a package depends on a shared dependency instead of reusing it from @theia/core/shared. This rule only affects files from packages that depend on @theia/core.', + recommended: true, + }, + }, + create(context) { + const filename = context.getFilename(); + const packageJson = findPackageJson(filename); + if (packageJson && dependsOnTheiaCore(packageJson)) { + // Only show an error regarding the package.json file if this is the first + // time we detect the error, else it will error for every file of the package: + if (firstTime(packageJson.__filename)) { + const redundantDeps = getRedundantDependencies(packageJson); + if (redundantDeps.length > 0) { + context.report({ + loc: { line: 0, column: 0 }, + message: `"${packageJson.__filename}" depends on some @theia/core shared dependencies: [${redundantDeps}]`, + }); + } + } + function checkModuleImport(node) { + const moduleName = /** @type {string} */(node.value); + const reExport = coreReExports.findReExportByModuleName(moduleName); + if (reExport) { + context.report({ + node, + message: `"${moduleName}" is a @theia/core shared dependency, please use "${reExport.externalImport}" instead.`, + fix(fixer) { + if (node.range) { + const [start, end] = node.range; + // Make sure to insert text between the first quote of the string and the rest: + return fixer.insertTextBeforeRange([start + 1, end], `${coreReExports.packageName}/${reExport.reExportDir}`); + } + } + }); + } + } + return { + ImportDeclaration(node) { + checkModuleImport(node.source); + }, + TSExternalModuleReference(node) { + checkModuleImport(node.expression); + }, + }; + } + return {}; + }, +}; + +/** @type {Set} */ +const firstTimeCache = new Set(); +/** + * @param {string} key + * @returns {boolean} true if first time seeing `key` else false. + */ +function firstTime(key) { + if (firstTimeCache.has(key)) { + return false; + } else { + firstTimeCache.add(key); + return true; + } +} + +/** + * @typedef FoundPackageJson + * @property {string} __filename + * @property {{[package: string]: string}} [dependencies] + */ + +/** + * Keep a shortcut to a given package.json file based on previous crawls. + * @type {Map} + */ +const findPackageJsonCache = new Map(); +/** + * @param {string} from file path to start searching from. + * @returns {FoundPackageJson | undefined} + */ +function findPackageJson(from) { + from = path.resolve(from); + let current = fs.statSync(from).isDirectory() ? from : path.dirname(from); + // Keep track of all paths tried before eventually finding a package.json file + const tried = [current]; + while (!isRoot(path.parse(from))) { + const cached = findPackageJsonCache.get(current); + if (cached) { + return cached; + } + const packageJsonPath = path.resolve(current, 'package.json'); + if (fs.existsSync(packageJsonPath)) { + const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, { encoding: 'utf8' })); + for (const dir of tried) { + findPackageJsonCache.set(dir, packageJson); + } + packageJson['__filename'] = packageJsonPath; + return packageJson; + } + current = path.dirname(current); + tried.push(current); + } +} + +/** + * @param {path.ParsedPath} parsed + * @returns {boolean} + */ +function isRoot(parsed) { + return parsed.base === '' && parsed.dir === parsed.root; +} + +/** + * @param {object} packageJson + * @returns {boolean} + */ +function dependsOnTheiaCore(packageJson) { + return typeof packageJson.dependencies === 'object' + && '@theia/core' in packageJson.dependencies; +} + +/** + * Return a list of packages from `packageJson`'s dependencies that can be + * required using `@theia/core/(electron-)shared/...`. + * @param {object} packageJson + * @return {string[]} + */ +function getRedundantDependencies(packageJson) { + return typeof packageJson.dependencies === 'object' + ? Object.keys(packageJson.dependencies).filter( + dependency => coreReExports.findReExportsByPackageName(dependency).length > 0 + ) + : []; +} diff --git a/dev-packages/private-eslint-plugin/tsconfig.json b/dev-packages/private-eslint-plugin/tsconfig.json new file mode 100644 index 0000000..cd4d0f6 --- /dev/null +++ b/dev-packages/private-eslint-plugin/tsconfig.json @@ -0,0 +1,14 @@ +{ + "extends": "../../configs/base.tsconfig", + "compilerOptions": { + "composite": true + }, + "include": [ + "rules" + ], + "references": [ + { + "path": "../private-re-exports" + } + ] +} diff --git a/dev-packages/private-ext-scripts/README.md b/dev-packages/private-ext-scripts/README.md new file mode 100644 index 0000000..62e321e --- /dev/null +++ b/dev-packages/private-ext-scripts/README.md @@ -0,0 +1,70 @@ +
+ +
+ +theia-ext-logo + +

ECLIPSE THEIA - EXT-SCRIPTS

+ +
+ +
+ +## Description + +`theiaext` is a command line tool to run shared npm scripts in Theia packages.\ +For instance, if you want add a new `hello` script that prints `Hello World`: + +- add a new script to [./package.json](./package.json) with the `ext:` prefix. + +```json +{ + "name": "@theia/ext-scripts", + "theia-monorepo-scripts": { + "ext:hello": "echo 'Hello World'" + } +} +``` + +- install `theiaext` in your package (the actual version can be different) + +```json +{ + "name": "@theia/myextension", + "devDependencies": { + "@theia/ext-scripts": "^0.1.1" + } +} +``` + +- you should be able to call `hello` script in the context of your package: + +```shell + npx theiaext hello +```` + +- and from npm scripts of your package: + +```json +{ + "name": "@theia/myextension", + "scripts": { + "hello": "theiaext hello" + } +} +``` + +## Additional Information + +- [Theia - GitHub](https://github.com/eclipse-theia/theia) +- [Theia - Website](https://theia-ide.org/) + +## License + +- [Eclipse Public License 2.0](http://www.eclipse.org/legal/epl-2.0/) +- [一 (Secondary) GNU General Public License, version 2 with the GNU Classpath Exception](https://projects.eclipse.org/license/secondary-gpl-2.0-cp) + +## Trademark + +"Theia" is a trademark of the Eclipse Foundation + diff --git a/dev-packages/private-ext-scripts/bin/theia-ext.js b/dev-packages/private-ext-scripts/bin/theia-ext.js new file mode 100755 index 0000000..616e72b --- /dev/null +++ b/dev-packages/private-ext-scripts/bin/theia-ext.js @@ -0,0 +1,83 @@ +#!/usr/bin/env node + +// ***************************************************************************** +// Copyright (C) 2017 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** +// @ts-check +const path = require('path'); +const cp = require('child_process'); + +const extScriptsPck = require(path.resolve(__dirname, '../package.json')); + +/** + * Lookup the requested ext:script to run, returns the full command line to execute. + */ +function getExtScript() { + // process.argv is always like [0:node, 1:script, 2:...args] + const args = process.argv.slice(2); + if (!args[0]) { + throw new Error('Please specify the script that runs with theiaext command.'); + } + const scripts = extScriptsPck['theia-monorepo-scripts']; + const script = 'ext:' + args[0]; + if (!(script in scripts)) { + throw new Error('The ext script does not exist: ' + script); + } + return [scripts[script], ...args.slice(1, args.length)].join(' '); +} + +/** + * Essentially wraps `child_process.exec` into a promise. + * + * @param script Command line to run as a shell command. + */ +function run(script) { + return new Promise((resolve, reject) => { + const env = Object.assign({}, process.env); + const scriptProcess = cp.exec(script, { + cwd: process.cwd(), + env, + }); + scriptProcess.stdout.pipe(process.stdout); + scriptProcess.stderr.pipe(process.stderr); + scriptProcess.on('error', reject); + scriptProcess.on('close', resolve); + }); +} + +(async () => { + /** @type {Error | number} */ + let exitCode = 0; + let extScript = undefined; + try { + extScript = getExtScript(); + console.debug(`$ ${extScript}`); + exitCode = await run(extScript); + } catch (err) { + if (extScript) { + console.error(`Error occurred in theiaext when executing: ${extScript}\n`); + } else { + console.error('Error occurred in theiaext.'); + } + console.error(err); + exitCode = err; + } + if (typeof exitCode !== 'number') { + exitCode = 1; // Error happened without the process starting. + } else if (exitCode) { + console.error(`Exit with failure status (${exitCode}): ${extScript}`); + } + process.exit(exitCode); +})(); diff --git a/dev-packages/private-ext-scripts/bin/theia-run.js b/dev-packages/private-ext-scripts/bin/theia-run.js new file mode 100755 index 0000000..68d75f1 --- /dev/null +++ b/dev-packages/private-ext-scripts/bin/theia-run.js @@ -0,0 +1,35 @@ +#!/usr/bin/env node + +// ***************************************************************************** +// Copyright (C) 2017 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** +// @ts-check +const path = require('path'); + +// See: https://github.com/eclipse-theia/theia/issues/8779#issuecomment-733747340 +const filter = require('os').platform() === 'win32' + ? arg => arg.indexOf(path.join('ext-scripts', 'theia-run.js')) !== -1 + : arg => arg.indexOf(path.join('.bin', 'run')) !== -1 +let index = process.argv.findIndex(filter); +if (index === -1) { + // Fall back to the original logic. + // https://github.com/eclipse-theia/theia/blob/6ef08676314a2ceca93023ddd149579493ae7914/dev-packages/ext-scripts/theia-run.js#L21 + index = process.argv.findIndex(arg => arg.indexOf('run') !== -1); +} +const args = process.argv.slice(index + 1); +const scopedArgs = args.length > 1 ? [args[0], '--scope', ...args.slice(1)] : args; +process.argv = [...process.argv.slice(0, index + 1), 'run', ...scopedArgs]; + +require(path.resolve(__dirname, '..', '..', 'scripts', 'lerna')); diff --git a/dev-packages/private-ext-scripts/bin/theia-ts-clean.js b/dev-packages/private-ext-scripts/bin/theia-ts-clean.js new file mode 100755 index 0000000..9bdaa0c --- /dev/null +++ b/dev-packages/private-ext-scripts/bin/theia-ts-clean.js @@ -0,0 +1,216 @@ +#!/usr/bin/env node + +// ***************************************************************************** +// Copyright (C) 2021 Ericsson and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +// @ts-check + +const _glob = require('glob'); +const debug = require('debug')('ts-clean'); +const fs = require('fs'); +const parcelWatcher = require('@parcel/watcher'); +const path = require('path'); +const util = require('util'); +const yargs = require('yargs'); + +const glob = util.promisify(_glob); + +tsClean().catch(error => { + console.error(error); + process.exit(1); +}); + +async function tsClean() { + yargs + .command( + '$0 [globs..]', + 'cleanup TypeScript output', + cmd => cmd + .option('verbose', { + description: 'print what\'s going on', + boolean: true, + default: false, + }) + .option('dry', { + description: 'only display the files that would be deleted', + boolean: true, + default: false, + }) + .option('watch', { + description: 'run the cleanup in watch mode', + alias: 'w', + boolean: true, + default: false, + }) + .positional('globs', { + array: true, + default: [process.cwd()] + }), + async ({ dry, globs, verbose, watch }) => { + if (dry || verbose) { + debug.enabled = true; + } + await Promise.all(globs.map(async pattern => { + if (typeof pattern !== 'string') { + return; + } + const roots = await glob(pattern, { + absolute: true, + }); + await Promise.all(roots.map(async root => { + const stat = await fs.promises.stat(root); + if (!stat.isDirectory()) { + debug(`"${root}" is not a directory, skipping...`); + return; + } + const tsconfigPath = path.resolve(root, 'tsconfig.json'); + if (!await exists(tsconfigPath)) { + debug(`"${root}" is not a TypeScript package, skipping...`); + return; + } + const { + compilerOptions: { + outDir = undefined, + rootDir = undefined, + } = {}, + } = await fs.promises.readFile(tsconfigPath, 'utf8').then(JSON.parse); + if (typeof outDir !== 'string' || typeof rootDir !== 'string') { + debug(`"${tsconfigPath}" doesn't look like a compilation configuration, skipping...`); + return; + } + const src = path.resolve(root, rootDir); + const dst = path.resolve(root, outDir); + await watch + ? tsCleanWatch(src, dst, dry) + : tsCleanRun(src, dst, dry); + })); + })); + } + ) + .fail((msg, err, cli) => { + process.exitCode = 1; + if (err) { + // One of the handlers threw an error: + console.error(err); + } else { + // Yargs detected a problem with commands and/or arguments while parsing: + cli.showHelp(); + console.error(msg); + } + }) + .parse(); +} + +/** + * @param {string} src + * @param {string} dst + * @param {boolean} dry + */ +async function tsCleanWatch(src, dst, dry) { + await tsCleanRun(src, dst, dry); + await parcelWatcher.subscribe(src, async (_err, events) => { + for (const event of events) { + let absolute; + if (event.type === 'delete') { + absolute = event.path; + } else { + continue; + } + console.log('Source removed:', absolute); + const relative = path.relative(src, absolute); + // Absolute path of the expected generated files, without the original ts(x) extension. + const base = path.resolve(dst, relative).replace(/\.(tsx?)$/i, ''); + await Promise.all(generatedFilesFromBase(base).map(async file => { + debug('delete', file); + if (!dry && await exists(file)) { + await fs.promises.unlink(file).catch(debug); + } + })); + } + }); +} + +/** + * @param {string} src + * @param {string} dst + * @param {boolean} dry + */ +async function tsCleanRun(src, dst, dry) { + /** + * Generated files relative to `dst`. + */ + const files = await glob('**/*.{d.ts,d.ts.map,js,js.map}', { + absolute: false, + cwd: dst, + }); + /** + * Key is the path without extension (base) relative to `dst`. + * Value is the list of found generated files (absolute path). + * @type {Map} + */ + const bases = new Map(); + for (const file of files) { + const parse = path.parse(file); + const base = path.join(parse.dir, removeExtension(parse.base)); + let generated = bases.get(base); + if (!generated) { + bases.set(base, generated = []); + } + generated.push(path.resolve(dst, file)); + } + await Promise.all(Array.from(bases.entries(), async ([base, generated]) => { + if (await exists(src, `${base}.ts`) || await exists(src, `${base}.tsx`)) { + return; + } + console.log('Missing source:', path.resolve(src, `${base}.ts(x)`)); + await Promise.all(generated.map(async file => { + debug('delete', file); + if (!dry) { + await fs.promises.unlink(file).catch(debug); + } + })); + })); +} + +/** + * @param {string[]} parts + */ +function generatedFilesFromBase(...parts) { + const base = path.resolve(...parts); + return [ + `${base}.d.ts`, + `${base}.d.ts.map`, + `${base}.js`, + `${base}.js.map`, + ]; +} + +/** + * Removes the extension of files ending with: + * .d.ts, .d.ts.map, .js, .js.map, .ts, .tsx + * @param {string} base + */ +function removeExtension(base) { + return base.replace(/\.(d\.ts(\.map)?|js(\.map)?|tsx?)$/i, ''); +} + +/** + * @param {string[]} parts + */ +async function exists(...parts) { + return fs.promises.access(path.resolve(...parts), fs.constants.F_OK) + .then(ok => true, error => false); +} diff --git a/dev-packages/private-ext-scripts/package.json b/dev-packages/private-ext-scripts/package.json new file mode 100644 index 0000000..279c0d9 --- /dev/null +++ b/dev-packages/private-ext-scripts/package.json @@ -0,0 +1,25 @@ +{ + "private": true, + "name": "@theia/ext-scripts", + "version": "1.68.0", + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "description": "NPM scripts for Theia packages.", + "bin": { + "run": "bin/theia-run.js", + "theiaext": "bin/theia-ext.js", + "ts-clean-dangling": "bin/theia-ts-clean.js" + }, + "theia-monorepo-scripts": { + "ext:clean": "theiaext compile:clean && theiaext lint:clean && theiaext test:clean", + "ext:build": "ts-clean-dangling && tsc --build", + "ext:compile": "ts-clean-dangling && tsc --project .", + "ext:compile:clean": "rimraf lib *.tsbuildinfo", + "ext:lint": "eslint --cache=true --no-error-on-unmatched-pattern=true \"{src,test}/**/*.{ts,tsx}\"", + "ext:lint:clean": "rimraf .eslintcache", + "ext:watch": "concurrently --kill-others -n cleanup,tsc -c magenta,red \"ts-clean-dangling -w\" \"tsc -b -w --preserveWatchOutput\"", + "ext:watch:fast": "tsc -p -w", + "ext:test": "nyc mocha --config ../../configs/mocharc.yml \"./lib/**/*.*spec.js\"", + "ext:test:watch": "mocha -w --config ../../configs/mocharc.yml \"./lib/**/*.*spec.js\"", + "ext:test:clean": "rimraf .nyc_output coverage" + } +} diff --git a/dev-packages/private-re-exports/.eslintrc.js b/dev-packages/private-re-exports/.eslintrc.js new file mode 100644 index 0000000..1308994 --- /dev/null +++ b/dev-packages/private-re-exports/.eslintrc.js @@ -0,0 +1,10 @@ +/** @type {import('eslint').Linter.Config} */ +module.exports = { + extends: [ + '../../configs/build.eslintrc.json' + ], + parserOptions: { + tsconfigRootDir: __dirname, + project: 'tsconfig.json' + } +}; diff --git a/dev-packages/private-re-exports/README.md b/dev-packages/private-re-exports/README.md new file mode 100644 index 0000000..90ebfa5 --- /dev/null +++ b/dev-packages/private-re-exports/README.md @@ -0,0 +1,41 @@ +# `@theia/re-export` + +Utility package to re-export dependencies. + +This is useful when you use and expose some APIs from a dependency and want +your dependent to get access to the exact same symbols as you did. + +## `package.json` + +You can configure how the `theia-re-export` CLI will generate re-exports +through your `package.json` file with a `theiaReExports` key: + +```json +{ + "theiaReExports": { + "destination": { + "export *": [ + "packages that export via *" + ], + "export =": [ + "packages that export via =" + ], + "copy": "other-package#destination" + } + } +} +``` + +### `transitive` + +If you want to re-export packages from another package that also re-exports +its dependencies. We use this in `@theia/core` to simplify the consumption +of some optional Electron-specific dependencies. + +### `export *` + +Packages that export their symbols as `export const x = ...`. + +### `export =` + +Packages that export their symbols as a namespace like `export = ...`. diff --git a/dev-packages/private-re-exports/bin/theia-re-exports.js b/dev-packages/private-re-exports/bin/theia-re-exports.js new file mode 100755 index 0000000..9303e33 --- /dev/null +++ b/dev-packages/private-re-exports/bin/theia-re-exports.js @@ -0,0 +1,2 @@ +#!/usr/bin/env node +require('../lib/bin-theia-re-exports.js'); diff --git a/dev-packages/private-re-exports/package.json b/dev-packages/private-re-exports/package.json new file mode 100644 index 0000000..616d34f --- /dev/null +++ b/dev-packages/private-re-exports/package.json @@ -0,0 +1,39 @@ +{ + "private": true, + "name": "@theia/re-exports", + "version": "1.68.0", + "description": "Theia re-export helper functions and scripts.", + "main": "lib/index.js", + "engines": { + "node": ">= 12" + }, + "files": [ + "bin", + "lib", + "src" + ], + "bin": { + "theia-re-exports": "bin/theia-re-exports.js" + }, + "scripts": { + "afterInstall": "npm run build", + "build": "theiaext build", + "clean": "theiaext clean", + "compile": "theiaext compile", + "lint": "theiaext lint", + "test": "theiaext test", + "watch": "theiaext watch" + }, + "dependencies": { + "mustache": "^4.2.0", + "semver": "^7.5.4", + "tslib": "^2.6.2", + "yargs": "^15.3.1" + }, + "devDependencies": { + "@types/chai": "^4.3.0", + "@types/mocha": "^10.0.0", + "@types/mustache": "^4.1.2", + "typescript": "~5.9.3" + } +} diff --git a/dev-packages/private-re-exports/src/bin-package-re-exports-from-package.ts b/dev-packages/private-re-exports/src/bin-package-re-exports-from-package.ts new file mode 100644 index 0000000..efd9b6f --- /dev/null +++ b/dev-packages/private-re-exports/src/bin-package-re-exports-from-package.ts @@ -0,0 +1,23 @@ +// ***************************************************************************** +// Copyright (C) 2022 Ericsson and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { readPackageJson, parsePackageReExports } from './package-re-exports'; + +const packageName = process.argv[2].trim(); + +readPackageJson(packageName, { paths: [process.cwd()] }) + .then(([packageJsonPath, packageJson]) => parsePackageReExports(packageJsonPath, packageJson)) + .then(([packageRoot, reExports]) => console.log(JSON.stringify([packageRoot, reExports]))); diff --git a/dev-packages/private-re-exports/src/bin-theia-re-exports.ts b/dev-packages/private-re-exports/src/bin-theia-re-exports.ts new file mode 100644 index 0000000..b2e243a --- /dev/null +++ b/dev-packages/private-re-exports/src/bin-theia-re-exports.ts @@ -0,0 +1,160 @@ +// ***************************************************************************** +// Copyright (C) 2021 Ericsson and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import fs = require('fs'); +import mustache = require('mustache'); +import os = require('os'); +import path = require('path'); +import semver = require('semver'); +import yargs = require('yargs'); +import { parseModule } from './utility'; +import { ReExport, PackageReExports } from './package-re-exports'; +type EOL = '\r\n' | '\n' | '\r'; + +yargs + .command( + 'generate [packageName]', + 'Generate Theia re-exports', + cli => cli + .positional('packageName', { + type: 'string', + describe: 'Name of the package to generate the re-exports for' + }), + async ({ packageName }) => { + if (!packageName) { + packageName = JSON.parse(await readFile(path.resolve('package.json'))).name as string; + } + const packageReExports = await PackageReExports.FromPackage(packageName); + const writer = new FileWriter(findEol(await readFile(packageReExports.resolvePath('package.json')))); + await Promise.all(packageReExports.all.map(async reExport => { + const reExportPath = packageReExports.resolvePath(reExport.reExportDir, reExport.moduleName, 'index'); + await writer.write(`${reExportPath}.js`, `module.exports = require('${reExport.internalImport}');\n`); + if (reExport.reExportStyle === '*') { + const content = `export * from '${reExport.internalImport}';\n`; + await writer.write(`${reExportPath}.d.ts`, content); + } else if (reExport.reExportStyle === '=') { + const content = `import ${reExport.exportNamespace} = require('${reExport.internalImport}');\nexport = ${reExport.exportNamespace};\n`; + await writer.write(`${reExportPath}.d.ts`, content); + } else { + console.warn('unexpected re-export'); + } + })); + } + ) + .command( + 'template inputFile [packageName]', + 'Evaluate mustache templates', + cli => cli + .positional('inputFile', { + type: 'string', + describe: 'File to evaluate defined using mustache template syntax', + demandOption: true + }) + .positional('packageName', { + type: 'string', + describe: 'Name of the package to generate the re-exports for' + }), + async ({ inputFile, packageName }) => { + if (!packageName) { + packageName = JSON.parse(await readFile(path.resolve('package.json'))).name as string; + } + const template = await readFile(inputFile); + const packageReExports = await PackageReExports.FromPackage(packageName); + const eol = findEol(await readFile(packageReExports.resolvePath('package.json'))); + // Organize `ReExport`s by `reExportsDir` then by `packageName`: + const reExportsDirectories: Record> = {}; + for (const reExport of packageReExports.all) { + let reExportsPackages = reExportsDirectories[reExport.reExportDir]; + if (!reExportsPackages) { + reExportsPackages = reExportsDirectories[reExport.reExportDir] = {}; + } + let reExports = reExportsPackages[reExport.packageName]; + if (!reExports) { + reExports = reExportsPackages[reExport.packageName] = []; + } + reExports.push(reExport); + } + // Map the organized `ReExport`s into a view object for mustache: + const reExportsView: ReExportsView = { + reExportsDirectories: Object.entries(reExportsDirectories).map(([directory, reExportsPackages]) => ({ + directory, + // eslint-disable-next-line @typescript-eslint/no-shadow + packages: Object.entries(reExportsPackages).map(([packageName, reExports]) => ({ + packageName, + npmUrl: getNpmUrl(packageName, reExports[0].versionRange), + versionRange: reExports[0].versionRange, + modules: reExports.map(reExport => ({ + moduleName: reExport.moduleName, + })) + })) + })) + }; + // `console.log` replaces CRLF with LF which is problematic on Windows + process.stdout.write(convertEol(eol, mustache.render(template, reExportsView))); + } + ) + .parse(); + +interface ReExportsView { + reExportsDirectories: Array<{ + directory: string + packages: Array<{ + npmUrl: string + packageName: string + modules: Array<{ + moduleName: string + }> + versionRange: string + }> + }> +} + +function getNpmUrl(moduleName: string, versionRange: string | null | undefined): string { + const [packageName] = parseModule(moduleName); + let url = `https://www.npmjs.com/package/${packageName}`; + // Is the range a fixed version? + const version = versionRange && semver.valid(versionRange); + if (version) { + url += `/v/${version}`; + } + return url; +} + +async function readFile(filePath: string): Promise { + return fs.promises.readFile(filePath, 'utf8'); +} + +function findEol(content: string): EOL { + const match = content.match(/\r\n?|\n/); + return (match ? match[0] : os.EOL) as EOL; +} + +function convertEol(eol: EOL, content: string): string { + switch (eol) { + case '\r\n': return content.replace(/(? { + const dirPath = path.dirname(filePath); + await fs.promises.mkdir(dirPath, { recursive: true }); + await fs.promises.writeFile(filePath, convertEol(this.eol, content)); + } +} diff --git a/dev-packages/private-re-exports/src/index.ts b/dev-packages/private-re-exports/src/index.ts new file mode 100644 index 0000000..454450d --- /dev/null +++ b/dev-packages/private-re-exports/src/index.ts @@ -0,0 +1,18 @@ +// ***************************************************************************** +// Copyright (C) 2021 Ericsson and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +export * from './utility'; +export * from './package-re-exports'; diff --git a/dev-packages/private-re-exports/src/package-re-exports.ts b/dev-packages/private-re-exports/src/package-re-exports.ts new file mode 100644 index 0000000..13e4642 --- /dev/null +++ b/dev-packages/private-re-exports/src/package-re-exports.ts @@ -0,0 +1,204 @@ +// ***************************************************************************** +// Copyright (C) 2022 Ericsson and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import cp = require('child_process'); +import fs = require('fs'); +import path = require('path'); +import { PackageJson, parseModule, ReExportJson } from './utility'; + +export async function readJson(jsonPath: string): Promise { + return JSON.parse(await fs.promises.readFile(jsonPath, 'utf8')) as T; +} + +export async function readPackageJson(packageName: string, options?: { paths?: string[] }): Promise<[string, PackageJson]> { + const packageJsonPath = require.resolve(`${packageName}/package.json`, options); + const packageJson = await readJson(packageJsonPath); + return [packageJsonPath, packageJson]; +} + +export async function parsePackageReExports(packageJsonPath: string, packageJson: PackageJson): Promise<[string, ReExport[]]> { + const packageRoot = path.dirname(packageJsonPath); + const { theiaReExports } = packageJson; + if (!theiaReExports) { + return [packageRoot, []]; + } + const reExportsByExportDir: ReExport[][] = await Promise.all(Object.entries(theiaReExports).map( + async ([reExportDir, reExportJson]) => resolveTheiaReExports(packageJsonPath, packageJson, reExportDir, reExportJson)) + ); + return [packageRoot, ([] as ReExport[]).concat(...reExportsByExportDir)]; +} + +export async function resolveTheiaReExports( + packageJsonPath: string, + packageJson: PackageJson, + reExportDir: string, + reExportJson: ReExportJson +): Promise { + if (reExportJson.copy) { + const [packageName, dir] = reExportJson.copy.split('#', 2); + const [subPackageJsonPath, subPackageJson] = await readPackageJson(packageName, { paths: [path.dirname(packageJsonPath)] }); + if (!subPackageJson.theiaReExports) { + return []; + } + const reExports = await resolveTheiaReExports(subPackageJsonPath, subPackageJson, dir, subPackageJson.theiaReExports[dir]); + return reExports.map(reExport => { + reExport.reExportDir = reExportDir; + reExport.internalImport = reExport.externalImport; + reExport.externalImport = `${packageJson.name}/${reExportDir}/${reExport.moduleName}`; + return reExport; + }); + } + const reExportsStar = reExportJson['export *'] || []; + const reExportsEqual = reExportJson['export ='] || []; + return [ + ...reExportsStar.map(moduleName => { + const [packageName, subModuleName] = parseModule(moduleName); + return { + moduleName, + packageName, + subModuleName, + reExportStyle: '*', + reExportDir, + internalImport: moduleName, + externalImport: `${packageJson.name}/${reExportDir}/${moduleName}`, + hostPackageName: packageJson.name, + versionRange: getPackageVersionRange(packageJson, packageName) + }; + }), + ...reExportsEqual.map(pattern => { + const [moduleName, exportNamespace = moduleName] = pattern.split(' as ', 2); + if (!/^[a-zA-Z_]\w/.test(exportNamespace)) { + console.warn(`"${exportNamespace}" is not a valid namespace (module: ${moduleName})`); + } + const [packageName, subModuleName] = parseModule(moduleName); + return { + moduleName, + packageName, + subModuleName, + exportNamespace, + reExportStyle: '=', + reExportDir, + internalImport: moduleName, + externalImport: `${packageJson.name}/${reExportDir}/${moduleName}`, + hostPackageName: packageJson.name, + versionRange: getPackageVersionRange(packageJson, packageName), + }; + }) + ]; +} + +export function getPackageVersionRange(packageJson: PackageJson, packageName: string): string { + const range = packageJson.dependencies?.[packageName] + || packageJson.optionalDependencies?.[packageName] + || packageJson.peerDependencies?.[packageName]; + if (!range) { + throw new Error(`package not found: ${packageName}`); + } + return range; +} + +export type ReExport = ReExportStar | ReExportEqual; + +export interface ReExportInfo { + /** + * The full name of the module. e.g. '@some/dep/nested/file' + */ + moduleName: string + /** + * Name of the package the re-export is from. e.g. '@some/dep' in '@some/dep/nested/file' + */ + packageName: string + /** + * Name of the file within the package. e.g. 'nested/file' in '@some/dep/nested/file' + */ + subModuleName?: string + /** + * Name/path of the directory where the re-exports should be located. + */ + reExportDir: string + /** + * Import statement used internally for the re-export. + */ + internalImport: string + /** + * Import name dependents should use externally for the re-export. + */ + externalImport: string + /** + * Name of the package that depends on the re-export. + */ + hostPackageName: string + /** + * Version range defined by the host package depending on the re-export. + */ + versionRange: string +} + +export interface ReExportStar extends ReExportInfo { + reExportStyle: '*' +} + +export interface ReExportEqual extends ReExportInfo { + reExportStyle: '=' + /** + * Pretty name for the re-exported namespace. e.g. 'react-dom' as 'ReactDOM' + */ + exportNamespace: string +} + +export class PackageReExports { + + static async FromPackage(packageName: string): Promise { + const [packageJsonPath, packageJson] = await readPackageJson(packageName); + const [packageRoot, reExports] = await parsePackageReExports(packageJsonPath, packageJson); + return new PackageReExports(packageName, packageRoot, reExports); + } + + static FromPackageSync(packageName: string): PackageReExports { + // Some tools (e.g. eslint) don't support async operations. + // To get around this, we can spawn a sub NodeJS process that will run the asynchronous + // logic and then synchronously wait for the serialized result on the standard output. + const scriptPath = require.resolve('./bin-package-re-exports-from-package.js'); + const { stdout } = cp.spawnSync(process.platform === 'win32' ? `"${process.argv[0]}"` : process.argv[0], [...process.execArgv, scriptPath, packageName], { + env: { + ELECTRON_RUN_AS_NODE: '1' + }, + encoding: 'utf8', + stdio: ['ignore', 'pipe', 'inherit'], + shell: true + }); + const [packageRoot, reExports] = JSON.parse(stdout) as [string, ReExport[]]; + return new PackageReExports(packageName, packageRoot, reExports); + } + + constructor( + readonly packageName: string, + readonly packageRoot: string, + readonly all: readonly Readonly[] + ) { } + + findReExportByModuleName(moduleName: string): ReExport | undefined { + return this.all.find(reExport => reExport.moduleName === moduleName); + } + + findReExportsByPackageName(packageName: string): ReExport[] { + return this.all.filter(reExport => reExport.packageName === packageName); + } + + resolvePath(...parts: string[]): string { + return path.resolve(this.packageRoot, ...parts); + } +} diff --git a/dev-packages/private-re-exports/src/utility.spec.ts b/dev-packages/private-re-exports/src/utility.spec.ts new file mode 100644 index 0000000..cc292bd --- /dev/null +++ b/dev-packages/private-re-exports/src/utility.spec.ts @@ -0,0 +1,41 @@ +// ***************************************************************************** +// Copyright (C) 2022 Ericsson and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { parseModule } from './utility'; +import { expect } from 'chai'; + +describe('@theia/re-exports/lib/utility.js', () => { + + it('parseModule', () => { + expect(parseModule('a')).length(1).members(['a']); + expect(parseModule('a/')).length(1).members(['a']); + expect(parseModule('a/b')).length(2).members(['a', 'b']); + expect(parseModule('a/b/')).length(2).members(['a', 'b']); + expect(parseModule('a/b/c/d/e/f')).length(2).members(['a', 'b/c/d/e/f']); + }); + + it('parseModule with namespaced package', () => { + expect(parseModule('@a/b')).length(1).members(['@a/b']); + expect(parseModule('@a/b/')).length(1).members(['@a/b']); + expect(parseModule('@a/b/c')).length(2).members(['@a/b', 'c']); + expect(parseModule('@a/b/c/')).length(2).members(['@a/b', 'c']); + expect(parseModule('@a/b/c/d/e/f')).length(2).members(['@a/b', 'c/d/e/f']); + }); + + it('parseModule unexpected module name/format', () => { + expect(() => parseModule('@a')).throw(); + }); +}); diff --git a/dev-packages/private-re-exports/src/utility.ts b/dev-packages/private-re-exports/src/utility.ts new file mode 100644 index 0000000..799d5ac --- /dev/null +++ b/dev-packages/private-re-exports/src/utility.ts @@ -0,0 +1,54 @@ +// ***************************************************************************** +// Copyright (C) 2021 Ericsson and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +export interface PackageJson { + name: string + dependencies?: Record + peerDependencies?: Record + optionalDependencies?: Record + theiaReExports?: Record +} + +/** + * Raw re-export declaration as written in `package.json#theiaReExports[]`. + */ +export interface ReExportJson { + 'export *'?: string[] + 'export ='?: string[] + copy?: string +} + +/** + * Examples: + * - `a` => `['a']` + * - `a/b/c/...` => `['a', 'b/c/...']` + * - `@a/b` => `['@a/b']` + * - `@a/b/c/...` => `['@a/b', 'c/...']` + */ +export function parseModule(moduleName: string): [string, string?] { + const slice = moduleName.startsWith('@') ? 2 : 1; + const split = moduleName.split('/').filter(part => part.trim().length > 0); + if (split.length < slice) { + throw new Error(`Unexpected module name/format: ${JSON.stringify(moduleName)}`); + } + const packageName = split.slice(0, slice).join('/'); + if (split.length === slice) { + return [packageName]; + } else { + const subModuleName = split.slice(slice).join('/'); + return [packageName, subModuleName]; + } +} diff --git a/dev-packages/private-re-exports/tsconfig.json b/dev-packages/private-re-exports/tsconfig.json new file mode 100644 index 0000000..b973ddb --- /dev/null +++ b/dev-packages/private-re-exports/tsconfig.json @@ -0,0 +1,12 @@ +{ + "extends": "../../configs/base.tsconfig", + "compilerOptions": { + "composite": true, + "rootDir": "src", + "outDir": "lib" + }, + "include": [ + "src" + ], + "references": [] +} diff --git a/dev-packages/private-test-setup/README.md b/dev-packages/private-test-setup/README.md new file mode 100644 index 0000000..8b32550 --- /dev/null +++ b/dev-packages/private-test-setup/README.md @@ -0,0 +1,32 @@ +
+ +
+ +theia-ext-logo + +

ECLIPSE THEIA - TEST SETUP

+ +
+ +
+ +## Description + +The `@theia/test-setup` contributes a setup script for mocha executed tests in Theia. +This setup script is executed before any test file is loaded or compiled. +This is for example useful for globals which must exist before dependencies are loaded. + +## Additional Information + +- [Theia - GitHub](https://github.com/eclipse-theia/theia) +- [Theia - Website](https://theia-ide.org/) + +## License + +- [Eclipse Public License 2.0](http://www.eclipse.org/legal/epl-2.0/) +- [一 (Secondary) GNU General Public License, version 2 with the GNU Classpath Exception](https://projects.eclipse.org/license/secondary-gpl-2.0-cp) + +## Trademark + +"Theia" is a trademark of the Eclipse Foundation +https://www.eclipse.org/theia diff --git a/dev-packages/private-test-setup/package.json b/dev-packages/private-test-setup/package.json new file mode 100644 index 0000000..73267bd --- /dev/null +++ b/dev-packages/private-test-setup/package.json @@ -0,0 +1,7 @@ +{ + "private": true, + "name": "@theia/test-setup", + "version": "1.68.0", + "description": "Custom setup for mocha tests", + "main": "test-setup.js" +} diff --git a/dev-packages/private-test-setup/test-setup.js b/dev-packages/private-test-setup/test-setup.js new file mode 100644 index 0000000..702b123 --- /dev/null +++ b/dev-packages/private-test-setup/test-setup.js @@ -0,0 +1,18 @@ +// ***************************************************************************** +// Copyright (C) 2024 STMicroelectronics and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +// Mock DragEvent as '@lumino/dragdrop' already requires it at require time +global.DragEvent = class DragEvent { }; diff --git a/dev-packages/request/.eslintrc.js b/dev-packages/request/.eslintrc.js new file mode 100644 index 0000000..1308994 --- /dev/null +++ b/dev-packages/request/.eslintrc.js @@ -0,0 +1,10 @@ +/** @type {import('eslint').Linter.Config} */ +module.exports = { + extends: [ + '../../configs/build.eslintrc.json' + ], + parserOptions: { + tsconfigRootDir: __dirname, + project: 'tsconfig.json' + } +}; diff --git a/dev-packages/request/README.md b/dev-packages/request/README.md new file mode 100644 index 0000000..e6a05e0 --- /dev/null +++ b/dev-packages/request/README.md @@ -0,0 +1,30 @@ +
+ +
+ +theia-ext-logo + +

ECLIPSE THEIA - REQUEST

+ +
+ +
+ +## Description + +The `@theia/request` package is used to send proxy-aware http requests to other services. + +## Additional Information + +- [Theia - GitHub](https://github.com/eclipse-theia/theia) +- [Theia - Website](https://theia-ide.org/) + +## License + +- [Eclipse Public License 2.0](http://www.eclipse.org/legal/epl-2.0/) +- [一 (Secondary) GNU General Public License, version 2 with the GNU Classpath Exception](https://projects.eclipse.org/license/secondary-gpl-2.0-cp) + +## Trademark + +"Theia" is a trademark of the Eclipse Foundation + diff --git a/dev-packages/request/package.json b/dev-packages/request/package.json new file mode 100644 index 0000000..ecfc18f --- /dev/null +++ b/dev-packages/request/package.json @@ -0,0 +1,37 @@ +{ + "name": "@theia/request", + "version": "1.68.0", + "description": "Theia Proxy-Aware Request Service", + "publishConfig": { + "access": "public" + }, + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "repository": { + "type": "git", + "url": "https://github.com/eclipse-theia/theia.git" + }, + "bugs": { + "url": "https://github.com/eclipse-theia/theia/issues" + }, + "homepage": "https://github.com/eclipse-theia/theia", + "files": [ + "lib", + "src" + ], + "main": "lib/index.js", + "typings": "lib/index.d.ts", + "scripts": { + "build": "theiaext build", + "clean": "theiaext clean", + "compile": "theiaext compile", + "lint": "theiaext lint", + "test": "theiaext test", + "watch": "theiaext watch" + }, + "dependencies": { + "http-proxy-agent": "^5.0.0", + "https-proxy-agent": "^5.0.0", + "tslib": "^2.6.2" + }, + "gitHead": "21358137e41342742707f660b8e222f940a27652" +} diff --git a/dev-packages/request/src/common-request-service.ts b/dev-packages/request/src/common-request-service.ts new file mode 100644 index 0000000..44cb6db --- /dev/null +++ b/dev-packages/request/src/common-request-service.ts @@ -0,0 +1,127 @@ +/******************************************************************************** + * Copyright (C) 2022 TypeFox and others. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the Eclipse + * Public License v. 2.0 are satisfied: GNU General Public License, version 2 + * with the GNU Classpath Exception which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 + ********************************************************************************/ + +const textDecoder = typeof TextDecoder !== 'undefined' ? new TextDecoder() : undefined; + +export interface Headers { + [header: string]: string; +} + +export interface RequestOptions { + type?: string; + url: string; + user?: string; + password?: string; + headers?: Headers; + timeout?: number; + data?: string; + followRedirects?: number; + proxyAuthorization?: string; +} + +export interface RequestContext { + url: string; + res: { + headers: Headers; + statusCode?: number; + }; + /** + * Contains the data returned by the request. + * + * If the request was transferred from the backend to the frontend, the buffer has been compressed into a string. In every case the buffer is an {@link Uint8Array}. + */ + buffer: Uint8Array | string; +} + +export namespace RequestContext { + export function isSuccess(context: RequestContext): boolean { + return (context.res.statusCode && context.res.statusCode >= 200 && context.res.statusCode < 300) || context.res.statusCode === 1223; + } + + function hasNoContent(context: RequestContext): boolean { + return context.res.statusCode === 204; + } + + export function asText(context: RequestContext): string { + if (!isSuccess(context)) { + throw new Error(`Server returned code ${context.res.statusCode}.`); + } + if (hasNoContent(context)) { + return ''; + } + // Ensures that the buffer is an Uint8Array + context = decompress(context); + if (textDecoder) { + return textDecoder.decode(context.buffer as Uint8Array); + } else { + return context.buffer.toString(); + } + } + + export function asJson(context: RequestContext): T { + const str = asText(context); + try { + return JSON.parse(str); + } catch (err) { + err.message += ':\n' + str; + throw err; + } + } + + /** + * Convert the buffer to base64 before sending it to the frontend. + * This reduces the amount of JSON data transferred massively. + * Does nothing if the buffer is already compressed. + */ + export function compress(context: RequestContext): RequestContext { + if (context.buffer instanceof Uint8Array && Buffer !== undefined) { + context.buffer = Buffer.from(context.buffer).toString('base64'); + } + return context; + } + + /** + * Decompresses a base64 buffer into a normal array buffer + * Does nothing if the buffer is not compressed. + */ + export function decompress(context: RequestContext): RequestContext { + const buffer = context.buffer; + if (typeof buffer === 'string' && typeof atob === 'function') { + context.buffer = Uint8Array.from(atob(buffer), c => c.charCodeAt(0)); + } + return context; + } +} + +export interface RequestConfiguration { + proxyUrl?: string; + proxyAuthorization?: string; + strictSSL?: boolean; +} +export interface RequestService { + configure(config: RequestConfiguration): Promise; + request(options: RequestOptions, token?: CancellationToken): Promise; + resolveProxy(url: string): Promise +} + +export const RequestService = Symbol('RequestService'); +export const BackendRequestService = Symbol('BackendRequestService'); +export const REQUEST_SERVICE_PATH = '/services/request-service'; + +export interface CancellationToken { + readonly isCancellationRequested: boolean; + readonly onCancellationRequested: (listener: () => void) => void; +} diff --git a/dev-packages/request/src/index.ts b/dev-packages/request/src/index.ts new file mode 100644 index 0000000..28336ad --- /dev/null +++ b/dev-packages/request/src/index.ts @@ -0,0 +1,17 @@ +/******************************************************************************** + * Copyright (C) 2022 TypeFox and others. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the Eclipse + * Public License v. 2.0 are satisfied: GNU General Public License, version 2 + * with the GNU Classpath Exception which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 + ********************************************************************************/ + +export * from './common-request-service'; diff --git a/dev-packages/request/src/node-request-service.ts b/dev-packages/request/src/node-request-service.ts new file mode 100644 index 0000000..52ddb0d --- /dev/null +++ b/dev-packages/request/src/node-request-service.ts @@ -0,0 +1,176 @@ +/******************************************************************************** + * Copyright (C) 2022 TypeFox and others. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the Eclipse + * Public License v. 2.0 are satisfied: GNU General Public License, version 2 + * with the GNU Classpath Exception which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 + ********************************************************************************/ + +import * as http from 'http'; +import * as https from 'https'; +import { getProxyAgent, ProxyAgent } from './proxy'; +import { Headers, RequestConfiguration, RequestContext, RequestOptions, RequestService, CancellationToken } from './common-request-service'; +import { createGunzip } from 'zlib'; + +export interface RawRequestFunction { + (options: http.RequestOptions, callback?: (res: http.IncomingMessage) => void): http.ClientRequest; +} + +export interface NodeRequestOptions extends RequestOptions { + agent?: ProxyAgent | http.Agent | https.Agent | boolean; + strictSSL?: boolean; + getRawRequest?(options: NodeRequestOptions): RawRequestFunction; +}; + +export class NodeRequestService implements RequestService { + protected proxyUrl?: string; + protected strictSSL?: boolean; + protected authorization?: string; + + protected getNodeRequest(options: RequestOptions): RawRequestFunction { + const endpoint = new URL(options.url); + const module = endpoint.protocol === 'https:' ? https : http; + return module.request; + } + + protected async getProxyUrl(url: string): Promise { + return this.proxyUrl; + } + + async configure(config: RequestConfiguration): Promise { + if (config.proxyUrl !== undefined) { + this.proxyUrl = config.proxyUrl; + } + if (config.strictSSL !== undefined) { + this.strictSSL = config.strictSSL; + } + if (config.proxyAuthorization !== undefined) { + this.authorization = config.proxyAuthorization; + } + } + + protected async processOptions(options: NodeRequestOptions): Promise { + const { strictSSL } = this; + options.strictSSL = options.strictSSL ?? strictSSL; + const agent = options.agent ? options.agent : getProxyAgent(options.url || '', process.env, { + proxyUrl: await this.getProxyUrl(options.url), + strictSSL: options.strictSSL + }); + options.agent = agent; + + const authorization = options.proxyAuthorization || this.authorization; + if (authorization) { + options.headers = { + ...(options.headers || {}), + 'Proxy-Authorization': authorization + }; + } + + options.headers = { + 'Accept-Encoding': 'gzip', + ...(options.headers || {}), + }; + + return options; + } + + request(options: NodeRequestOptions, token?: CancellationToken): Promise { + return new Promise(async (resolve, reject) => { + options = await this.processOptions(options); + + const endpoint = new URL(options.url); + const rawRequest = options.getRawRequest + ? options.getRawRequest(options) + : this.getNodeRequest(options); + + const opts: https.RequestOptions = { + hostname: endpoint.hostname, + port: endpoint.port ? parseInt(endpoint.port) : (endpoint.protocol === 'https:' ? 443 : 80), + protocol: endpoint.protocol, + path: endpoint.pathname + endpoint.search, + method: options.type || 'GET', + headers: options.headers, + agent: options.agent as https.Agent, + rejectUnauthorized: !!options.strictSSL + }; + + if (options.user && options.password) { + opts.auth = options.user + ':' + options.password; + } + + const timeoutHandler = () => { + reject('timeout'); + }; + + const req = rawRequest(opts, async res => { + const followRedirects = options.followRedirects ?? 3; + if (res.statusCode && res.statusCode >= 300 && res.statusCode < 400 && followRedirects > 0 && res.headers.location) { + req.off('timeout', timeoutHandler); + this.request({ + ...options, + url: res.headers.location, + followRedirects: followRedirects - 1 + }, token).then(resolve, reject); + } else { + const chunks: Uint8Array[] = []; + + const stream = res.headers['content-encoding'] === 'gzip' ? res.pipe(createGunzip()) : res; + + stream.on('data', chunk => { + chunks.push(chunk); + }); + + stream.on('end', () => { + req.off('timeout', timeoutHandler); + const buffer = Buffer.concat(chunks); + resolve({ + url: options.url, + res: { + headers: res.headers as Headers, + statusCode: res.statusCode + }, + buffer + }); + }); + + stream.on('error', err => { + reject(err); + }); + } + }); + + req.on('error', err => { + reject(err); + }); + + req.on('timeout', timeoutHandler); + + if (options.timeout) { + req.setTimeout(options.timeout); + } + + if (options.data) { + req.write(options.data); + } + + req.end(); + + token?.onCancellationRequested(() => { + req.destroy(); + reject(); + }); + }); + } + + async resolveProxy(url: string): Promise { + return undefined; + } +} diff --git a/dev-packages/request/src/package.spec.ts b/dev-packages/request/src/package.spec.ts new file mode 100644 index 0000000..f69ef6d --- /dev/null +++ b/dev-packages/request/src/package.spec.ts @@ -0,0 +1,28 @@ +/******************************************************************************** + * Copyright (C) 2022 TypeFox and others. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the Eclipse + * Public License v. 2.0 are satisfied: GNU General Public License, version 2 + * with the GNU Classpath Exception which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 + ********************************************************************************/ + +/* note: this bogus test file is required so that + we are able to run mocha unit tests on this + package, without having any actual unit tests in it. + This way a coverage report will be generated, + showing 0% coverage, instead of no report. + This file can be removed once we have real unit + tests in place. */ + +describe('request package', () => { + + it('should support code coverage statistics', () => true); +}); diff --git a/dev-packages/request/src/proxy.ts b/dev-packages/request/src/proxy.ts new file mode 100644 index 0000000..d09bc46 --- /dev/null +++ b/dev-packages/request/src/proxy.ts @@ -0,0 +1,57 @@ +/******************************************************************************** + * Copyright (C) 2022 TypeFox and others. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the Eclipse + * Public License v. 2.0 are satisfied: GNU General Public License, version 2 + * with the GNU Classpath Exception which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 + ********************************************************************************/ + +import { parse as parseUrl, Url } from 'url'; +import { HttpProxyAgent } from 'http-proxy-agent'; +import { HttpsProxyAgent } from 'https-proxy-agent'; + +export type ProxyAgent = HttpProxyAgent | HttpsProxyAgent; + +function getSystemProxyURI(requestURL: Url, env: typeof process.env): string | undefined { + if (requestURL.protocol === 'http:') { + return env.HTTP_PROXY || env.http_proxy; + } else if (requestURL.protocol === 'https:') { + return env.HTTPS_PROXY || env.https_proxy || env.HTTP_PROXY || env.http_proxy; + } + + return undefined; +} + +export interface ProxySettings { + proxyUrl?: string; + strictSSL?: boolean; +} + +export function getProxyAgent(rawRequestURL: string, env: typeof process.env, options: ProxySettings = {}): ProxyAgent | undefined { + const requestURL = parseUrl(rawRequestURL); + const proxyURL = options.proxyUrl || getSystemProxyURI(requestURL, env); + + if (!proxyURL) { + return undefined; + } + + const proxyEndpoint = parseUrl(proxyURL); + + if (!/^https?:$/.test(proxyEndpoint.protocol || '')) { + return undefined; + } + + if (requestURL.protocol === 'http:') { + return new HttpProxyAgent(proxyURL, { rejectUnauthorized: !!options.strictSSL }); + } else { + return new HttpsProxyAgent(proxyURL, { rejectUnauthorized: !!options.strictSSL }); + } +} diff --git a/dev-packages/request/tsconfig.json b/dev-packages/request/tsconfig.json new file mode 100644 index 0000000..b973ddb --- /dev/null +++ b/dev-packages/request/tsconfig.json @@ -0,0 +1,12 @@ +{ + "extends": "../../configs/base.tsconfig", + "compilerOptions": { + "composite": true, + "rootDir": "src", + "outDir": "lib" + }, + "include": [ + "src" + ], + "references": [] +} diff --git a/dev.sh b/dev.sh new file mode 100755 index 0000000..f1a41d2 --- /dev/null +++ b/dev.sh @@ -0,0 +1,110 @@ +#!/bin/bash +# Local development runner for Vibn Theia IDE +# Usage: +# ./dev.sh — full install + compile + start +# ./dev.sh start — start without recompiling (fastest) +# ./dev.sh compile — recompile changed packages + start +# ./dev.sh watch — recompile ai-ide package only + start + +set -e + +SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" +WORKSPACE_DIR="${HOME}/theia-workspace" +PORT="${PORT:-3000}" + +cd "$SCRIPT_DIR" + +# Load local env vars if present +if [ -f "${SCRIPT_DIR}/../.google.env" ]; then + export $(grep -v '^#' "${SCRIPT_DIR}/../.google.env" | xargs) 2>/dev/null || true +fi + +mkdir -p "$WORKSPACE_DIR" + +MODE="${1:-full}" + +install_deps() { + if [ ! -d node_modules ]; then + echo "→ Installing dependencies (first time, takes ~5 min)..." + npm install --legacy-peer-deps + else + echo "→ Dependencies already installed." + fi +} + +compile_all() { + echo "→ Compiling all packages..." + NODE_OPTIONS="--max-old-space-size=4096" npm run compile + echo "→ Building browser bundle (webpack)..." + NODE_OPTIONS="--max-old-space-size=4096" cd examples/browser && npm run build && cd "$SCRIPT_DIR" +} + +compile_ai_ide() { + echo "→ Recompiling @theia/ai-ide only..." + cd packages/ai-ide && npx tsc -p tsconfig.json && cd "$SCRIPT_DIR" + echo "→ Rebuilding browser bundle..." + NODE_OPTIONS="--max-old-space-size=4096" cd examples/browser && npm run build && cd "$SCRIPT_DIR" +} + +start_theia() { + echo "" + echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" + echo " Vibn Theia IDE — http://localhost:${PORT}" + echo " Workspace: ${WORKSPACE_DIR}" + echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" + echo "" + + # Write local settings.json with keys from .google.env + mkdir -p "${HOME}/.theia" + cat > "${HOME}/.theia/settings.json" << SETTINGS +{ + "ai-features.AiEnable": true, + "ai-features.google.apiKey": "${GOOGLE_API_KEY:-}", + "ai-features.google.models": [ + { + "id": "gemini-2.0-flash", + "name": "Gemini 2.0 Flash", + "url": "https://generativelanguage.googleapis.com/v1beta/openai/" + } + ], + "ai-features.chat.defaultChatAgent": "Coder", + "ai-features.gitea.apiUrl": "${GITEA_API_URL:-https://git.vibnai.com}", + "ai-features.gitea.apiToken": "${GITEA_API_TOKEN:-}", + "ai-features.gitea.username": "${GITEA_USERNAME:-mark}", + "editor.fontSize": 14, + "editor.tabSize": 2, + "files.autoSave": "afterDelay", + "files.autoSaveDelay": 1000 +} +SETTINGS + + cd examples/browser + exec node ../../node_modules/@theia/cli/lib/theia start \ + "$WORKSPACE_DIR" \ + --hostname=0.0.0.0 \ + --port="${PORT}" +} + +case "$MODE" in + start) + if [ ! -d "examples/browser/lib" ]; then + echo "No compiled output found. Run './dev.sh' first." + exit 1 + fi + start_theia + ;; + compile) + install_deps + compile_ai_ide + start_theia + ;; + full) + install_deps + compile_all + start_theia + ;; + *) + echo "Usage: $0 [start|compile|full]" + exit 1 + ;; +esac diff --git a/devfile.yaml b/devfile.yaml new file mode 100644 index 0000000..0bf7d14 --- /dev/null +++ b/devfile.yaml @@ -0,0 +1,75 @@ +# A devfile to setup Theia project in Che. +# For developers who work on Theia core. + +apiVersion: 1.0.0 +metadata: + generateName: theia-dev- +projects: + - name: theia + source: + type: git + location: "https://github.com/eclipse-theia/theia.git" +components: + - alias: che-dev + type: dockerimage + image: "quay.io/eclipse/che-theia-dev:next" + mountSources: true + endpoints: + - name: "theia-dev-flow" + port: 3000 + attributes: + protocol: http + public: "true" + memoryLimit: "3.5Gi" + - id: vscode/typescript-language-features/latest + type: chePlugin + memoryLimit: 2048M + - type: cheEditor + alias: theia-editor + id: eclipse/che-theia/latest + memoryLimit: "1Gi" +commands: + - name: > + theia: Build Sources + actions: + - type: exec + component: che-dev + command: > + killall node; + npm ci && npm run build && npm run download:plugins + workdir: /projects/theia + - name: > + theia: Launch Browser Backend + actions: + - type: exec + component: che-dev + command: > + test -f /tmp/node_theiadev.pid && kill `cat /tmp/node_theiadev.pid`; + mkdir -p /tmp/theiadev_projects && + export NODE_ENV=development && + node src-gen/backend/main.js /tmp/theiadev_projects --hostname=0.0.0.0 --port=3000 --no-cluster --plugins=/projects/theia/plugins --hosted-plugin-inspect=9339 & echo $!> /tmp/node_theiadev.pid ; wait `cat /tmp/node_theiadev.pid` + workdir: /projects/theia/examples/browser + - name: > + theia: Watch Core Packages + actions: + - type: exec + component: che-dev + command: > + npm run watch:compile + workdir: /projects/theia + - name: > + theia: Watch Browser Example + actions: + - type: exec + component: che-dev + command: > + npm run watch + workdir: /projects/theia/examples/browser + - name: > + theia: Watch All + actions: + - type: exec + component: che-dev + command: > + npm run watch + workdir: ${workspaceRoot}/theia diff --git a/doc/Developing.md b/doc/Developing.md new file mode 100644 index 0000000..20be63a --- /dev/null +++ b/doc/Developing.md @@ -0,0 +1,576 @@ +This file contains tips to help you take (and understand) your first steps in +the world of Theia development. Are you in a hurry? See the +[Quick Start](#quick-start). + +# How to build Theia and the example applications + +Theia is a framework to build IDEs, so you can't really "run" Theia itself. +However, you can run the example applications included in its repository. One +is a browser-based IDE and the other is the Electron-based equivalent. + +The following instructions are for Linux and macOS. + +For Windows instructions [click here](#building-on-windows). + +- [**Prerequisites**](#prerequisites) +- [**Quick Start**](#quick-start) + - [Run with SSL](#run-the-browser-example-with-ssl) +- [**Clone the repository**](#clone-the-repository) +- [**The repository structure**](#the-repository-structure) +- [**Build core, extensions and examples packages**](#build-core-extensions-and-examples-packages) +- [**Build extension packages individually**](#build-extension-packages-individually) +- [**Run the browser-based example application**](#run-the-browser-based-example-application) +- [**Run the Electron-based example application**](#run-the-electron-based-example-application) +- [**Rebuilding**](#rebuilding) +- [**Watching**](#watching) + - [Watch the core and extension packages](#watch-the-core-and-extension-packages) + - [Watch the examples](#watch-the-examples) + - [Watch a specific package](#watch-a-specific-package) + - [Watch a specific package and its local upstream dependencies](#watch-a-specific-package-and-its-local-upstream-dependencies) +- [**Debugging**](#debugging) + - [Debug the browser example's backend](#debug-the-browser-examples-backend) + - [Debug the browser example's frontend](#debug-the-browser-examples-frontend) + - [Debug the browser example's frontend and backend at the same time](#debug-the-browser-examples-frontend-and-backend-at-the-same-time) + - [Debug the Electron example's backend](#debug-the-electron-examples-backend) + - [Debug the Electron example's frontend](#debug-the-electron-examples-frontend) + - [Debug the Electron example's frontend and backend at the same time](#debug-the-electron-examples-frontend-and-backend-at-the-same-time) + - [Debug IPC servers](#debug-ipc-servers) + - [Debug the plugin host](#debug-the-plugin-host) +- [**Profiling**](#profiling) + - [Profile the frontend process](#profile-the-frontend-process) + - [Profile the backend process](#profile-the-backend-process) + - [Profile IPC servers](#profile-ipc-servers) + - [Profile the plugin host](#profile-the-plugin-host) +- [**Testing**](#testing) +- [**Code coverage**](#code-coverage) +- [**Building on Windows**](#building-on-windows) +- [**Troubleshooting**](#troubleshooting) + - [Linux](#linux) + - [Windows](#windows) + - [macOS](#macos) + - [Root privileges errors](#root-privileges-errors) + +## Prerequisites + +- Node.js `>= 20` and `< 24`. + - If you are interested in Theia's VS Code Extension support then you should use a Node version at least compatible with the one included in the version of Electron used by [VS Code](https://github.com/microsoft/vscode). +- git (If you would like to use the Git-extension too, you will need to have git version 2.11.0 or higher.) +- Python3 is required for the build due to [`node-gyp`](https://github.com/nodejs/node-gyp/tree/v11.4.0#installation) + +Some additional tools and libraries are needed depending on your platform: + +- Linux + - [make](https://www.gnu.org/software/make/) + - [gcc](https://gcc.gnu.org/) (or another compiling toolchain) + - [pkg-config](https://www.freedesktop.org/wiki/Software/pkg-config/) + - build-essential: `sudo apt-get install build-essential` + + - [`native-keymap`](#prerequisite_native_keymap) native node module dependencies: + - Debian-based: `sudo apt-get install libx11-dev libxkbfile-dev` + - Red Hat-based: `sudo yum install libX11-devel.x86_64 libxkbfile-devel.x86_64 # or .i686` + - FreeBSD: `sudo pkg install libX11` + + - [`keytar`](#prerequisite_keytar) native node module dependencies ([reference](https://github.com/atom/node-keytar#on-linux)): + - Debian/Ubuntu: `sudo apt-get install libsecret-1-dev` + - Red Hat-based: `sudo yum install libsecret-devel` + - Arch Linux: `sudo pacman -S libsecret` + - Alpine: `apk add libsecret-dev` + +- Linux/MacOS + - [nvm](https://github.com/nvm-sh/nvm) is recommended to easily switch between Node.js versions. + +- Windows + - We recommend using [`scoop`](https://scoop.sh/). The detailed steps are [here](#building-on-windows). + +## Quick Start + +To build and run the browser example: + +```sh +git clone https://github.com/eclipse-theia/theia \ + && cd theia \ + && npm install \ + && npm run build:browser \ + && npm run download:plugins \ + && npm run start:browser +``` + +Start your browser on . + +To build and run the Electron example: + +```sh +git clone https://github.com/eclipse-theia/theia \ + && cd theia \ + && npm install \ + && npm run build:electron \ + && npm run download:plugins \ + && npm run start:electron +``` + +### Download plugins + +You can download plugins to use with the examples applications by running: + +```sh +npm run download:plugins +``` + +### Run the browser example with SSL + +To run the browser example using SSL use: + +```sh +git clone https://github.com/eclipse-theia/theia \ + && cd theia \ + && npm install \ + && npm run download:plugins \ + && npm run build:browser \ + && npm run start:browser --ssl --cert /path/to/cert.crt --certkey /path/to/certkey.key +``` + +Start your browser on . + +## Clone the repository + +```sh +git clone https://github.com/eclipse-theia/theia +``` + +The directory containing the Theia repository will now be referred to as +`$THEIA`, so if you want to copy-paste the examples, you can set the `THEIA` +variable in your shell: + +```sh +THEIA=$PWD/theia +``` + +## The repository structure + +Theia repository has multiple folders: + +- `packages` folder contains runtime packages, as the core package and extensions to it +- `dev-packages` folder contains devtime packages + - [@theia/cli](../dev-packages/cli/README.md) is a command line tool to manage Theia applications + - [@theia/ext-scripts](../dev-packages/private-ext-scripts/README.md) is a command line tool to share scripts between Theia runtime packages +- `examples` folder contains example applications, both Electron-based and browser-based +- `doc` folder provides documentation about how Theia works +- `scripts` folder contains JavaScript scripts used by npm scripts when +installing +- the root folder lists dev dependencies and wires everything together with [Lerna](https://lerna.js.org/) + +## Build core, extensions and examples packages + +You can download dependencies and build TypeScript packages using: + +```sh +npm install +npm run compile +``` + +These commands download dependencies, links and builds all TypeScript packages. + +To build the example applications: + +```sh +npm run build:browser +npm run build:browser-only +npm run build:electron + +# build all example applications at once: +npm run build:applications +``` + +To learn more and understand precisely what's going on, please look at scripts in [package.json](../package.json). + +## Build Everything + +```sh +npm run all +``` + +This will install dependencies, link and build TypeScript packages, lint, and build the example applications. + +## Build TypeScript sources + +Dependencies must be installed before running this command. + +```sh +npm run compile +``` + +## Linting + +Linting takes a lot of time, this is a limitation from ESLint. We always lint in the GitHub Workflows, but if you want to lint locally you have to do it manually: + +```sh +npm run lint # lint TypeScript sources +``` + +Note that `npm run all` does linting. + +## Build extension packages individually + +From the root: + +```sh +npx lerna run compile --scope @theia/core +``` + +From the package: + +```sh +npm run compile +``` + +## Run the browser-based example application + +We can start the application from the [examples/browser](../examples/browser) directory with: + +```sh +npm run start +``` + +This command starts the backend application listening on port `3000`. The frontend application should be available on . + +If you rebuild native Node.js packages for Electron then rollback these changes +before starting the browser example by running from the root directory: + +```sh +npm run rebuild:browser +``` + +## Run the Electron-based example application + +```sh +npm start:electron +``` + +## Rebuilding + +Rebuilds everything: TypeScript and example applications. + +```sh +npm run build +``` + +## Watching + +### Watch the core and extension packages + +To rebuild _everything_ each time a change is detected run: + +```sh +npm run watch +``` + +### Watch the examples + +To rebuild each time a change is detected in frontend or backend you can run: + +```sh +# either +npm run watch:browser + +# or +npm run watch:electron +``` + +### Watch a specific package + +You can use `npx` to watch a single package: + +```sh +npx lerna run watch --scope @theia/package-name +``` + +### Watch a specific package and its local upstream dependencies + +#### Using TypeScript build mode + +Once you have built all TypeScript packages once, making a single change and recompiling should be rather quick. + +Given this, you can efficiently watch the whole monorepo using TypeScript build mode and have it quickly compiled. + +See [Watch the core and extension packages](#watch-the-core-and-extension-packages). + +In this mode, TypeScript only compiles what changed along with its dependents. + +#### Using Theia's `run` utility + +Let assume you have to work for instance in the `@theia/navigator` extension. But you might have to apply changes in any of its upstream dependencies such as `@theia/filesystem` or `@theia/core`, you can either do `npm run watch` which could be super expensive, as it watches all the packages. Or you can do `npx run watch @theia/navigator` and `npx run watch @theia/filesystem` and `npx run watch @theia/core` in three individual shells. Or you can do the following single-liner: + +```sh +npx lerna run watch --scope @theia/navigator --include-filtered-dependencies --parallel +``` + +## Debugging + +### Debug the browser example's backend + +- Open the debug view and run the `Launch Browser Backend` configuration. + +### Debug the browser example's frontend + +- Start the backend by using `npm run start`. +- In a browser: Open and use the dev tools for debugging. +- Open the debug view and run the `Launch Browser Frontend` configuration. + +### Debug the browser example's frontend and backend at the same time + +- Open the debug view and run the `Launch Browser Backend` configuration. +- Then run the `Launch Browser Frontend` configuration. + +### Debug the Electron example's backend + +- Open the debug view and run the `Launch Electron Backend` configuration. + +### Debug the Electron example's frontend + +- Start the Electron backend + - Either open the debug view and run the `Launch Electron Backend` configuration + - Or use `npm run start`. +- Attach to the Electron Frontend + - Either open the debug view and run the `Attach to Electron Frontend` configuration + - Or in Electron: Help -> Toggle Electron Developer Tools. + +### Debug the Electron example's frontend and backend at the same time + +- Open the debug view and run the `Launch Electron Backend & Frontend` configuration. + +### Debug IPC servers + +- Pass `--${server-name}-inspect` arg to the backend server. + - For example `--nsfw-watcher-inspect=0` to inspect nsfw watcher processes with dynamic port allocation. + - All variations of `--inspect` flag are supported: . +- Attach the debugger to the logged port. + +In order to look up `server-name` run the backend server with `--log-level=debug` flag to enable logging of IPC servers instantiation. +You should be able to see message of `[${server-name}: ${server-PID}]: IPC started` format, like `[nsfw-watcher: 37557] IPC started`. + +### Debug the plugin host + +- Pass `--hosted-plugin-inspect=9339` arg to the backend server from the command line. + - Instead, you can run `Launch Browser Backend` launch configuration which is already pre-configured. +- Open the debug view and run the `Attach to Plugin Host` launch configuration. + - It connects to the plugin host if at least one extension is detected, otherwise it timeouts after 60s. + - If you want to debug the activation then enable `stopOnEntry` flag. +- Open the browser page. + + --- + +### Debugging Plugin Sources + +[click for base article](https://github.com/eclipse-theia/theia/issues/3251#issuecomment-468166533) + +The following launch configuration is meant to be used when the Theia project is opened as the main project in VS Code, the following launch configuration is added inside .vscode/launch.json. + +- The source repository of your plugin is expected under your `${workspaceFolder}/plugins` folder +- You can start the frontend from URL: +- It's suggested to update your frontend launch configuration URL to open your favorite target project in a second launch + +Launch configuration template that will start the backend process, and then attempt to connect on port 9339 to debug the plugin-host sub-process: + +```jsonc +{ + "name": "Launch VS Code extension as Theia plugin", + "type": "node", + "request": "launch", + "port": 9339, + "timeout": 100000, + "args": [ + "${workspaceFolder}/examples/browser/src-gen/backend/main.js", + "${workspaceFolder}", + "--port=3030", + "--hosted-plugin-inspect=9339", // spawn the plugin-host in debug mode + "--plugins=local-dir:${workspaceFolder}/plugins" + ], + "stopOnEntry": false, + "sourceMaps": true, + "outFiles": [ + "${workspaceFolder}/**/*.js" + ], + "internalConsoleOptions": "openOnSessionStart", + "outputCapture": "std" +} +``` + +#### Producing typescript maps for your plugin + +Enable source maps in the plugin's `tsconfig.json` + +```jsonc +{ + "compilerOptions": { + "sourceMap": true + } +} +``` + +If Webpack is used you should bundle in development mode in the `package.json` scripts to avoid minification: + +```sh +webpack --mode development +``` + +As well as enabling source map output in the **webpack.config.js** + +```js +module.exports = { + devtool: 'source-map' +} +``` + +#### Compiling and blocking typescript from walking up parent directories [(see discussion)](https://github.com/Microsoft/TypeScript/issues/13992#issuecomment-386253983) + +If you get errors while building like: + +```sh +(parent folders)/index.d.ts: error TS2300: Duplicate identifier +``` + +You can fix it by modifying your `tsconfig.json`: + +```jsonc +{ + "compilerOptions": { + "typeRoots": ["./node_modules/@types"] + } +} +``` + +## Profiling + +- Use Chrome devtools to profile both the frontend and backend (Node.js). + - For Node.js: open chrome://inspect, click the configure button and ensure target host and port are listed. +- Learn how to get and understand CPU measurements: +- Learn how to get and understand Memory measurements: +- Before taking the memory snapshot always collect garbage. +- Make sure that Chrome extensions don't distort measurements by disabling them. + - For frontend: React extension is leaking components. +- Make measurements before and after improvements to provide them as evidence on a pull request. + - Also document how to reproduce improved measurements in `How to test` section of a pull request description. +- If objects don't have a proper class, i.e. plain JSON, then find one of them in the first snapshot + and check that it is garbage collected in the diff between snapshots. + +### Profile the frontend process + +- In Browser: open the devtools. +- In Electron: Help -> Toggle Electron Developer Tools. + +### Profile the backend process + +- Pass `--inspect` arg to the backend server: . + +### Profile IPC servers + +- Pass `--${server-name}-inspect` arg to the backend server. + - For example `--nsfw-watcher-inspect=0` to inspect nsfw watcher processes with dynamic port allocation. + - All variations of `--inspect` flag are supported: . + +### Profile the plugin host + +- Pass `--hosted-plugin-inspect` arg to the backend server. + - All variations of `--inspect` flag are supported: . + +## Testing + +- See the [unit testing](Testing.md) documentation. +- See the [API integration testing](api-testing.md) documentation. + +## Code coverage + +```sh + npm run test +``` + +By default, this will generate the code coverage for the tests in an HTML +format, which can be easily viewed with your browser (Chrome/Firefox/Edge/Safari +etc.) by opening `packages//coverage/index.html`. + +## Building on Windows + +- Install [`scoop`](https://github.com/lukesampson/scoop#installation). +- Install [`nvm`](https://github.com/coreybutler/nvm-windows) with scoop: `scoop install nvm`. +- Install Node.js with `nvm`: `nvm install lts`, then use it: `nvm use lts`. You can list all available Node.js versions with `nvm list available` if you want to pick another version. +- If you need to install `windows-build-tools`, see [`Installing Windows Build Tools`](#installing-windows-build-tools). +- If you run into problems with installing the required build tools, the `node-gyp` documentation offers a useful [guide](https://github.com/nodejs/node-gyp#on-windows) how to install the dependencies manually. The versions required for building Theia are: + - Visual Studio [build tools](https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2022) 17 +- If you have multiple versions of either python or Visual Studio installed, or if the tool is not found, you may adjust the version used as described + [here](https://github.com/nodejs/node-gyp?tab=readme-ov-file#configuring-python-dependency) + +Clone, build and run Theia. +Using Git Bash as administrator: + +```sh +git clone https://github.com/eclipse-theia/theia.git \ + && cd theia \ + && npm install \ + && npm run build:browser \ + && npm run start:browser +``` + +If you do not have Git Bash installed on your system, [get one](https://gitforwindows.org/), or use `scoop`: `scoop install git`. + +### Installing Windows Build Tools + +- Previously, [`windows-build-tools`](https://github.com/felixrieseberg/windows-build-tools) is required to build Native Nodes modules on Windows. The npm package is now [`deprecated`](https://www.npmjs.com/package/windows-build-tools) because NodeJS installer can now install all the required tools that it needs, including Windows Build Tools. +- In case you need to install the tool manually, run `PowerShell` as _Administrator_ and copy paste the following: `npm --add-python-to-path install --global --production windows-build-tools`. + +## Troubleshooting + +> First make sure that you follow the steps given in the [docs](https://github.com/eclipse-theia/theia/blob/master/doc/Developing.md#run-the-browser-based-example-applicatio) correctly. + +### Linux + +The start command will start a watcher on many files in the theia directory. +To avoid ENOSPC errors, increase your default inotify watches. + +It can be done like so: + +```sh +echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p +``` + +### Windows + +If you see `LINK : fatal error LNK1104: cannot open file 'C:\\Users\\path\\to\\node.lib' [C:\path\to\theia\node_modules\drivelist\build\drivelist.vcxproj]`, then set the Visual Studio version manually with `npm config set msvs_version 2017 --global`. + +If you are facing with `EPERM: operation not permitted` or `permission denied` +errors while building, testing or running the application then; + +- You don't have write access to the installation directory. +- Try to run your command line (`PowerShell`, `GitBash`, `Cygwin` or whatever + you are using) as an administrator. +- The permissions in the NPM cache might get corrupted. Please try to run + `npm cache clean` to fix them. +- If you experience issues such as `Error: EBUSY: resource busy or locked, rename`, + try to disable (or uninstall) your anti-malware software. + See [here](https://github.com/npm/npm/issues/13461#issuecomment-282556281). +- Still having issues on Windows? File a [bug]. We are working on Linux or OS X + operating systems. Hence, we are more than happy to receive any Windows-related + feedbacks, [bug](https://github.com/eclipse-theia/theia/issues) reports. + +If you're still struggling with the build, but you use Windows 10, then you can enable the `Windows Subsystem for Linux` and you can get a Linux distro for free. + +### macOS + +You need to have the Xcode command line tools installed in order to build and run Theia. You can install the tools by running + +```sh +xcode-select --install +``` + +If you already have Xcode installed, but you see the `xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance` error, you need to run the following command to fix it: `sudo xcode-select --switch /Library/Developer/CommandLineTools`. + +The solution is the same if you have updated to `10.14` (Mojave) and you can see the `gyp: No Xcode or CLT version detected!` error. More details [here](https://github.com/nodejs/node-gyp#on-macos). + +### Root privileges errors + +When trying to install with root privileges, you might encounter errors such as +`cannot run in wd`. + +Several options are available to you: + +- Install without root privileges +- Use the `--unsafe-perm` flag: `npm install --unsafe-perm` diff --git a/doc/Migration.md b/doc/Migration.md new file mode 100644 index 0000000..b075769 --- /dev/null +++ b/doc/Migration.md @@ -0,0 +1,396 @@ +# Migration Guide + +## Description + +The following guide highlights potential migration steps necessary during `theia` upgrades discovered when adopting the framework. +Please see the latest version (`master`) for the most up-to-date information. Please contribute any issues you experienced when upgrading to a newer version of Theia to this document, even for previous releases. + +## Guide + +### General + +_Builtin Extension Pack_: + +If you are using the [`eclipse-theia.builtin-extension-pack@1.79.0`](https://open-vsx.org/extension/eclipse-theia/builtin-extension-pack) extension pack you may need to include the [`ms-vscode.js-debug`](https://open-vsx.org/extension/ms-vscode/js-debug) and [`ms-vscode.js-debug-companion`](https://open-vsx.org/extension/ms-vscode/js-debug-companion) plugins for JavaScript debug support. +There was an issue when the publishing of the pack which excluded these necessary builtins. + +For example, in your application's `package.json`: + +```json +"theiaPlugins": { + "eclipse-theia.builtin-extension-pack": "https://open-vsx.org/api/eclipse-theia/builtin-extension-pack/1.79.0/file/eclipse-theia.builtin-extension-pack-1.79.0.vsix", + "ms-vscode.js-debug": "https://open-vsx.org/api/ms-vscode/js-debug/1.78.0/file/ms-vscode.js-debug-1.78.0.vsix", + "ms-vscode.js-debug-companion": "https://open-vsx.org/api/ms-vscode/js-debug-companion/1.1.2/file/ms-vscode.js-debug-companion-1.1.2.vsix" +} +``` + +_msgpackr_: + +If you're experiencing [`maximum callstack exceeded`](https://github.com/eclipse-theia/theia/issues/12499) errors you may need to downgrade the version of `msgpackr` pulled using a [yarn resolution](https://classic.yarnpkg.com/lang/en/docs/selective-version-resolutions/). + +``` +rpc-message-encoder.ts:151 Uncaught (in promise) Error: Error during encoding: 'Maximum call stack size exceeded' + at MsgPackMessageEncoder.encode (rpc-message-encoder.ts:151:23) + at MsgPackMessageEncoder.request (rpc-message-encoder.ts:137:14) + at RpcProtocol.sendRequest (rpc-protocol.ts:161:22) + at proxy-handler.ts:74:45 +``` + +For the best results follow the version used and tested by the framework. + +For example: + +```json +"resolutions": { + "**/msgpackr": "1.8.3" +} +``` + +_socket.io-parser_: + +Prior to [`v1.31.1`](https://github.com/eclipse-theia/theia/releases/tag/v1.31.1), a [resolution](https://classic.yarnpkg.com/lang/en/docs/selective-version-resolutions/) might be necessary to work-around a recently discovered [critical vulnerability](https://security.snyk.io/vuln/SNYK-JS-SOCKETIOPARSER-3091012) in one of our runtime dependencies [socket.io-parser](https://github.com/socketio/socket.io-parser). + +For example: + +```json +"resolutions": { + "**/socket.io": "^4.5.3", + "**/socket.io-client": "^4.5.3" +} +``` + +### v1.65.0 + +### Browser-only Filesystem Improvements [#16187](https://github.com/eclipse-theia/theia/pull/16187) + +Browser-only filesystem refactored to use OPFS API with web workers. + +Key changes: + +- `OPFSFileSystemProvider` completely rewritten - extensions inheriting from old implementation need alignment +- `FileUploadService` moved from `@theia/filesystem/lib/browser/file-upload-service` to `@theia/filesystem/lib/common/upload/file-upload`, now bound with symbol key and separate `FileUploadServiceImpl` +- `FileDownloadService` moved from `file-download-data.ts` to `file-download.ts`, now bound with symbol key and separate `FileDownloadServiceImpl` +- `NodeFileUploadService` moved from `src/node/node-file-upload-service.ts` to `src/node/upload/node-file-upload-service.ts` +- `OPFSInitialization.getRootDirectory()` returns `Promise | string` instead of `Promise` - Just return the root of your filesystem as a string instead of the directory handle + +#### Make Preferences available in the backend [#### v1.62.0](https://github.com/eclipse-theia/theia/pull/16017) + +The PR makes preferences support available in the backend. Only default and user preferences can be accessed in the backend. The API has changed in the following ways: +- Many files have been moved from the "browser" folder to the "common" folder. Imports will have to be adapted +- `PreferenceSchemaProvider` has been replaced by two separate `PreferenceSchemaServiceImpl` (and corresponding interface) and `DefaultsPreferenceProvider` classes. +- Preference schema typing has been simplified: a preference schema is no longer extending IJSONSchema and typing has been adapted to strictly +use Theia types (for example for scopes) and a straight-forward extension of standard IJSONSchema for properties. This means schemas from VS Code (contributed) must be converted to Theia format. +- PrefenceSchemaService separates between adding a schema and registering a default override for a property. Also, the service uses explicit override identifiers instead of encoding the override in the preference key. The service strictly distinguishes between preference schema and the derived JSON Schema for preference files. `JSONValue` is used instead of `any` where applicable. Schema properties must be added before overrides are registered. +`PreferenceSchemaService` now has the concept of`validScopes`. In the backend, only`Default` and `User` can be used. As a consequence, a preference provider for a particular preference scope might not be bound. Do not inject a preference provider with `@inject(PreferenceProvider) @named()`, inject and use `PreferenceProviderProvider` instead. +- `PreferenceContribution` now has a `initSchema()` method in addition to the declarative Schema contribution. It is used to register overrides. + +### v1.62.0 + +#### Refactor menu nodes [#14676](https://github.com/eclipse-theia/theia/pull/14676) + +This PR makes menu nodes and tab toolbar items into active object instead of pure data descriptors. This means they can polymorphically handle concerns like enablement, visibility, command execution and rendering. This keeps concerns like conversion of parameters out of the general tool bar and menu handling code. In this way, we could get rid of the MenuCommandExecutor and MenuCommandAdapter infrastructure. +If you are simply registering toolbar items and menus, little will change for you as a Theia adopter. Mainly, some of the paremeter types have changed in menu-model-registry.ts. Menu registration has been simplified in that an independent submenu is simply a menu that is registered under a path that does not start with the MAIN_MENU_BAR prefix. +If you override any of the toolbar or menu related implementations in your product, the biggest change will be that some functionality is now delegated to the menu and too bar item implementations. If this breaks your use case, please let us know. + +### v1.38.0 + +#### Inversify 6.0 + +With Inversify 6, the library has introduced a strict split between sync and async dependency injection contexts. +Theia uses the sync dependency injection context, and therefore no async dependencies cannot be used as dependencies in Theia. + +This might require a few changes in your Theia extensions, if you've been using async dependencies before. These include: + +1. Injecting promises directly into services +2. Classes with `@postConstruct` methods which return a `Promise` instance. + +In order to work around 1., you can just wrap the promise inside of a function: + +```diff +const PromiseSymbol = Symbol(); +const promise = startLongRunningOperation(); + +-bind(PromiseSymbol).toConstantValue(promise); ++bind(PromiseSymbol).toConstantValue(() => promise); +``` + +The newly bound function needs to be handled appropriately at the injection side. + +For 2., `@postConstruct` methods can be refactored into a sync and an async method: + +```diff +-@postConstruct() +-protected async init(): Promise { +- await longRunningOperation(); +-} ++@postConstruct() ++protected init(): void { ++ this.doInit(); ++} ++ ++protected async doInit(): Promise { ++ await longRunningOperation(); ++} +``` + +Note that this release includes a few breaking changes that also perform this refactoring on our own classes. +If you've been overriding some of these `init()` methods, it might make sense to override `doInit()` instead. + +### v1.37.0 + +#### Disabled node integration and added context isolation flag in Electron renderer + +This also means that `electron-remote` can no longer be used in components in `electron-frontend` or `electron-common`. In order to use electron-related functionality from the browser, you need to expose an API via a preload script (see ). To achieve this from a Theia extension, you need to follow these steps: + +1. Define the API interface and declare an API variable on the global `window` variable. See `packages/filesystem/electron-common/electron-api.ts` for an example +2. Write a preload script module that implements the API on the renderer ("browser") side and exposes the API via `exposeInMainWorld`. You'll need to expose the API in an exported function called `preload()`. See `packages/filesystem/electron-browser/preload.ts` for an example. +3. Declare a `theiaExtensions` entry pointing to the preload script like so: + +``` +"theiaExtensions": [ + { + "preload": "lib/electron-browser/preload", +``` + +See `/packages/filesystem/package.json` for an example + +4. Implement the API on the electron-main side by contributing a `ElectronMainApplicationContribution`. See `packages/filesystem/electron-main/electron-api-main.ts` for an example. If you don't have a module contributing to the electron-main application, you may have to declare it in your package.json. + +``` +"theiaExtensions": [ + { + "preload": "lib/electron-browser/preload", + "electronMain": "lib/electron-main/electron-main-module" + } +``` + +If you are using NodeJS API in your electron browser-side code you will also have to move the code outside of the renderer process, for example +by setting up an API like described above, or, for example, by using a back-end service. + +### v1.35.0 + +#### Drop support for `Node 14` + +The framework no longer supports `Node 14` in order to better support plugins targeting the default supported VS Code API of `1.68.1`. +It is always possible to build using the `yarn --ignore-engines` workaround, but we advise against it. + +### v1.32.0 + +#### Removal of `CircularDependencyPlugin` + +We no longer enforce usage of the `CircularDependencyPlugin` in the generated webpack configuration. This plugin previously informed users of any non-fatal circular dependencies in their JavaScript imports. +Note that Theia adopters can enable the plugin again by manually adding `circular-dependency-plugin` as a dev dependency and adding the following snippet to their `webpack.config.js` file. + +```js +config[0].module.plugins.push(new CircularDependencyPlugin({ + exclude: /(node_modules)[\\\\|\/]./, + failOnError: false +})); +``` + +### v1.30.0 + +#### lerna 5.5.4 + +The `lerna` dev-dependency was upgraded one major versions, to v5.5.4. This removes a few high and severe known vulnerabilities from our development environment. See the [PR](https://github.com/eclipse-theia/theia/pull/11738) for more details. + +The upgrade was smooth in this repo, but it's possible that Theia developers/extenders, that are potentially using `lerna` differently, might need to do some adaptations. + +### v1.29.0 + +#### React 18 update + +The `react` and `react-dom` dependencies were upgraded to version 18. Some relevant changes include: + +- `ReactDOM.render` is now deprecated and is replaced by `createRoot` from `react-dom/client` +- the new API no longer supports render callbacks +- updates in promises, setTimeout, event handlers are automatically batched +- the dependency `react-virtualized` has been removed in favor of `react-virtuoso` + +### v1.24.0 + +#### node-gyp 8.4.1 + +The `electron-rebuild` dependency was upgraded which in turn upgraded `node-gyp` to `v8.4.1`. +This version of `node-gyp` does not support **Python2** (which is EOL) so **Python3** is necessary during the build. + +#### From WebSocket to Socket.io + +This is a very important change to how Theia sends and receives messages with its backend. + +This new Socket.io protocol will try to establish a WebSocket connection whenever possible, but it may also +setup HTTP polling. It may even try to connect through HTTP before attempting WebSocket. + +Make sure your network configurations support both WebSockets and/or HTTP polling. + +### Monaco 1.65.2 + +This version updates the Monaco code used in Theia to the state of VSCode 1.65.2, and it changes the way that code is consumed from ASM modules loaded and put on the +`window.monaco` object to ESM modules built into the bundle using Webpack. + +#### ASM to ESM + +Two kinds of changes may be required to consume Monaco using ESM modules. + +- If your application uses its own Webpack config rather than that generated by the @theia/dev-packages, you +will need to update that config to remove the `CopyWebpackPlugin` formerly used to place Monaco +code in the build folder and to build a separate entrypoint for the `editor.worker`. See [the changes here](https://github.com/eclipse-theia/theia/pull/10736/files#diff-b4677f3ff57d8b952eeefc10493ed3600d2737f9b5c9b0630b172472acb9c3a2) +- If your application uses its own frontend generator, you should modify the code that generates the `index.html` to load the `script` containing the bundle into the `body` element rather than the head. See [changes here](https://github.com/eclipse-theia/theia/pull/10947/files) +- References to the `window.monaco` object should be replaced with imports from `@theia/monaco-editor-core`. In most cases, simply adding an import `import * as monaco from +'@theia/monaco-editor-core'` will suffice. More complex use cases may require imports from specific parts of Monaco. Please see +[the PR](https://github.com/eclipse-theia/theia/pull/10736) for details, and please post any questions or problems there. + +Using ESM modules, it is now possible to follow imports to definitions and to the Monaco source code. This should aid in tracking down issues related to changes in Monaco discussed +below. + +#### Changes to Monaco + +The Monaco API has changed in significant ways since the last uplift. One of the most significant is the handling of overrides to services instantiated by Monaco. + +- The style of service access `monaco.StaticServices..get()` is no longer available. Instead, use `StaticServices.get()` with a service +identifier imported from `@theia/monaco-editor-core`. +- Any service overrides that should be used for all instantiations in Monaco should be passed to the first call of `StaticServices.initialize`. The first call is used to set the +services for all subsequent calls. Overrides passed to subsequent calls to `StaticServices.initialize` will be ignored. To change the overrides used, please override +[`MonacoFrontendApplicationContribution.initialize`](https://github.com/eclipse-theia/theia/pull/10736/files#diff-99d13bb12b3c33ada58d66291db38b8b9f61883822b08b228f0ebf30b457a85d). +- Services that should be used for a particular instantiation must be passed to a child of the global `IInstantiationService`. See `MonacoEditor.getInstantiationWithOverrides` +for an example. + +Other changes include a number of changes of name from `mode` -> `language` and changes of interface. Please consult [the PR](https://github.com/eclipse-theia/theia/pull/10736) or +the Monaco source code included with `@theia/monaco-editor-core`. + +#### Breaking changes in Theia + +Please see the CHANGELOG for details of changes to Theia interfaces. + +### v1.23.0 + +#### TypeScript 4.5.5 + +If you are using TypeScript <= 4.5.5 and you encounter issues when building your Theia application because your compiler fails to parse our type definitions, +then you should upgrade to TypeScript >= 4.5.5. + +#### Socket.io + +If you are deploying multiple Theia nodes behind a load balancer, you will have to enable sticky-sessions, +as it is now required by the new WebSocket implementation using Socket.io protocol. + +For more details, see the socket.io documentation about [using multiple nodes](https://socket.io/docs/v4/using-multiple-nodes/#enabling-sticky-session). + +### v1.22.0 + +#### Resolutions + +Due to a [colors.js](https://github.com/Marak/colors.js) issue, a [resolution](https://classic.yarnpkg.com/lang/en/docs/selective-version-resolutions/) may be necessary for your application in order to work around the problem: + +For example: + +```json +"resolutions": { + "**/colors": "<=1.4.0" +} +``` + +#### Electron Update + +Electron got updated from 9 to 15, this might involve some modifications in your code based on the new APIs. + +See Electron's [documentation](https://github.com/electron/electron/tree/15-x-y/docs). + +Most notably the `electron.remote` API got deprecated and replaced with a `@electron/remote` package. + +Theia makes use of that package and re-exports it as `@theia/core/electron-shared/@electron/remote`. + +See `@theia/core` re-exports [documentation](../packages/core/README.md#re-exports). + +Lastly, Electron must now be defined in your application's `package.json` under `devDependencies`. + +`theia build` will automatically add the entry and prompt you to re-install your dependencies when out of sync. + +### v1.21.0 + +#### Frontend Source Maps + +The frontend's source map naming changed. If you had something like the following in your debug configurations: + +```json + "sourceMapPathOverrides": { + "webpack://@theia/example-electron/*": "${workspaceFolder}/examples/electron/*" + } +``` + +You can delete this whole block and replace it by the following: + +```json + "webRoot": "${workspaceFolder}/examples/electron" +``` + +### v1.17.0 + +#### ES2017 + +- Theia was updated to ES2017 + - es5 VS Code extensions and Theia plugins are still supported + - If you require an es5 codebase you should be able to transpile back to es5 using webpack + - The following code transpiles back to an es2015 codebase: + + ``` + config.module.rules.push({ + test: /\.js$/, + use: { + loader: 'babel-loader', + options: { + presets: [['@babel/preset-env', { targets: { chrome: '58', ie: '11' } }]], + } + } + }); + ``` + + - Replace the targets with the ones that are needed for your use case + - Make sure to use `inversify@5.1.1`. Theia requires `inversify@^5.0.1` which means that `5.1.1` is compatible, + but your lockfile might reference an older version. + +### v1.16.0 + +[Release](https://github.com/eclipse-theia/theia/releases/tag/v1.16.0) + +- N/A. + +### v1.15.0 + +[Release](https://github.com/eclipse-theia/theia/releases/tag/v1.15.0) + +#### Keytar + +- [`keytar`](https://github.com/atom/node-keytar) was added as a dependency for the secrets API. It may require `libsecret` in your particular distribution to be functional: + - Debian/Ubuntu: `sudo apt-get install libsecret-1-dev` + - Red Hat-based: `sudo yum install libsecret-devel` + - Arch Linux: `sudo pacman -S libsecret` + - Alpine: `apk add libsecret-dev` +- It is possible that a `yarn resolution` is necessary for `keytar` to work on older distributions (the fix was added in `1.16.0` by downgrading the dependency version): + + ```json + "resolutions": { + "**/keytar": "7.6.0", + } + ``` + +- `keytar` uses [`prebuild-install`](https://github.com/prebuild/prebuild-install) to download prebuilt binaries. If you are experiencing issues where some shared libraries are missing from the system it was originally built upon, you can tell `prebuild-install` to build the native extension locally by setting the environment variable before performing `yarn`: + + ```sh + # either: + export npm_config_build_from_source=true + yarn + # or: + npm_config_build_from_source=true yarn + ``` + +#### Webpack + +- The version of webpack was upgraded from 4 to 5 and may require additional shims to work properly given an application's particular setup. +- The `webpack` dependency may need to be updated if there are errors when performing a `production` build of the application due to a bogus `webpack-sources` dependency. The valid `webpack` version includes `^5.36.2 <5.47.0`. If necessary, you can use a `yarn resolution` to fix the issue: + + ```json + "resolutions": { + "**/webpack": "5.46.0", + } + ``` diff --git a/doc/Plugin-API.md b/doc/Plugin-API.md new file mode 100644 index 0000000..54c0f91 --- /dev/null +++ b/doc/Plugin-API.md @@ -0,0 +1,250 @@ +# Theia Plugin API and VS Code extensions support + +Eclipse Theia is designed for extensibility. +Therefore, it supports [three extension mechanisms: VS Code extensions, Theia extensions, and Theia plugins](https://theia-ide.org/docs/extensions/). +In the following, we focus on the mechanics of Theia plugins and Theia’s compatibility with the [VS Code Extension API](https://code.visualstudio.com/api) in order to support running VS Code extensions in Theia. +This documentation aims to support developers extending Theia’s plugin API to either enhance the extensibility of Theia via plugins and/or increase Theia’s coverage of the VS Code Extension API – and with that the number of VS Code extensions that can be used in Theia. + +Theia plugins, as well as VS Code extensions, can be installed and removed from a Theia installation at runtime. +There are three kinds of plugins that address different extensibility use cases: + +- VS Code plugins may extend many different user-facing capabilities of Theia, such as theming, language support, debuggers, tree views, etc., via a clearly defined API. +_In the context of VS Code itself these are called "extensions", not to be confused with build-time Theia extensions._ +- Theia plugins are a superset of VS Code plugins using a largely compatible API with some additional capabilities not applicable to VS Code +- Headless plugins address application-specific extension points. +They do not extend the user-facing capabilities of Theia as the other two categories of plugins do, but support application-specific services that, in turn, often do. +More information about headless plugins [is detailed below](#headless-plugins). + +A plugin runs inside a "host process". +This is a subprocess spawned by Theia's backend to isolate the plugin from the main process. +This encapsulates the plugin to prevent it from arbitrarily accessing Theia services and potentially harm performance or functionality of Theia’s main functionality. +Instead, a plugin accesses Theia’s state and services via the plugin API, if any, provided within its host process. + +Theia’s plugin API strives to be a superset of VS Code’s extension API to enable running VS Code extensions as Theia plugins. +For many cases this already works well. +A report on API compatibility is generated daily in the [vscode-theia-comparator repository](https://github.com/eclipse-theia/vscode-theia-comparator). +Please note that the report only checks the API on an interface level – and not the compatibility of the interfaces’ implementation behaviour. +To be sure that an extension is fully supported, it is recommended to test it yourself. +Feel free to [open new issues](https://github.com/eclipse-theia/theia/issues/new/choose) for missing or incomplete API and link them in the report via a [pull request](https://github.com/eclipse-theia/vscode-theia-comparator/compare). +The report can be found here: + +[![API Compatibility](https://img.shields.io/badge/API_Compatibility-Status_Report-blue.svg?style=flat-curved)](https://eclipse-theia.github.io/vscode-theia-comparator/status.html) + +## Relevant Theia source code + +- [plugin](https://github.com/eclipse-theia/theia/tree/master/packages/plugin): Contains the API declaration of the theia plugin namespace. +- [plugin-ext](https://github.com/eclipse-theia/theia/tree/master/packages/plugin-ext): Contains both the mechanisms for running plugins and providing them with an API namespace and the implementation of the ‘theia’ plugin API. +- [plugin-ext-vscode](https://github.com/eclipse-theia/theia/tree/master/packages/plugin-ext-vscode): Contains an implementation of the VS Code plugin API. +Since VS Code and Theia APIs are largely compatible, the initialization passes on the Theia plugin API and overrides a few members in the API object to be compatible to VS Code extensions (see [plugin-ext-vscode/src/node/plugin-vscode-init.ts](https://github.com/eclipse-theia/theia/blob/master/packages/plugin-ext-vscode/src/node/plugin-vscode-init.ts)). +- [plugin-ext-headless](https://github.com/eclipse-theia/theia/tree/master/packages/plugin-ext-headless): Contains the mechanism for running "headless" plugins in a dedicated backend plugin host process. + +## API definition and exposure + +The plugin API is declared in the [plugin](https://github.com/eclipse-theia/theia/tree/master/packages/plugin) package in file [theia.d.ts](https://github.com/eclipse-theia/theia/blob/master/packages/plugin/src/theia.d.ts). + +The implementation of the API defined in the plugin package is passed to a plugin by manipulating the module loading mechanism in plugin containers to construct an API module object. +This enables Theia plugins to import the API via the `@theia/plugin` module in node or via the `theia` namespace in web workers. +For VS Code plugins, the same API is available via the `vscode` namespace as expected by them. + +Plugin containers are node processes (see [plugin-ext/src/hosted/node/plugin-host.ts](https://github.com/eclipse-theia/theia/blob/master/packages/plugin-ext/src/hosted/node/plugin-host.ts))and web workers ([plugin-ext/src/hosted/browser/worker/worker-main.ts](https://github.com/eclipse-theia/theia/blob/master/packages/plugin-ext/src/hosted/browser/worker/worker-main.ts)). +These expose the API in the following places: + +- Browser: assign API object to `window['theia']` in [plugin-ext/src/hosted/browser/worker/worker-main.ts](https://github.com/eclipse-theia/theia/blob/541b300adc029ab1dd729da1ca49179ace1447b2/packages/plugin-ext/src/hosted/browser/worker/worker-main.ts#L192). +- Back-end/Node: Override module loading for Theia plugins in [plugin-ext/src/hosted/node/scanners/backend-init-theia.ts](https://github.com/eclipse-theia/theia/blob/master/packages/plugin-ext/src/hosted/node/scanners/backend-init-theia.ts) and for VS Code plugins in [plugin-ext-vscode/src/node/plugin-vscode-init.ts](https://github.com/eclipse-theia/theia/blob/master/packages/plugin-ext-vscode/src/node/plugin-vscode-init.ts). + +**Note** that it is not necessary to adapt these for implementing new plugin API. + +## Communication between plugin API and Theia + +As the plugin runs in a separate process, the plugin API cannot directly communicate with Theia. +Instead, the plugin process and Theia’s main process communicate via RPC. + +For VS Code plugins and Theia plugins, the following "Main-Ext" pattern is used. +There is one instance of the plugin host process for each connected frontend. + +![Communication between Theia and Plugin API for VS Code Plugins](./images/plugin-api-diagram.svg) + +`Ext` refers to the code running on the plugin side inside the isolated host process. +Therefore, this code cannot directly use any Theia services (e.g. via dependency injection). +`Main` refers to code running inside the Theia frontend in the **browser** context. +Therefore, it can access any Theia service just like a [build time Theia extension](https://theia-ide.org/docs/authoring_extensions/). + +> [!NOTE] +> As the plugin hosts for VS Code plugins are scoped per frontend connection and the `Main` side resides in the browser, there is actually an indirection of the RPC communication channel via the Theia backend. +> This simply relays the messages in both directions as depicted in the diagram. + +For headless plugins, "Main-Ext" pattern is very similar, except that there is only one instance of the plugin host and the `Main` code runs in the **node** context, as there is no associated frontend context for headless plugins. + +![Communication between Theia and Plugin API for Headless Plugins](./images/headless-plugin-diagram.svg) + +As the lifecycle of a plugin starts inside its process on the `Ext` side, anything that the plugin needs from Theia (e.g. state, command execution, access to services) has to be invoked over RPC via an implementation on the `Main` side. +In the inverse direction, the same is true for code that runs on the `Main` side and that needs something from the plugin side (e.g. changing plugin state after a user input). +It needs to be invoked over RPC via an implementation on the `Ext` side. +Therefore, `Main` and `Ext` interfaces usually come in pairs (e.g. [LanguagesExt](https://github.com/eclipse-theia/theia/blob/541b300adc029ab1dd729da1ca49179ace1447b2/packages/plugin-ext/src/common/plugin-api-rpc.ts#L1401) and [LanguagesMain](https://github.com/eclipse-theia/theia/blob/541b300adc029ab1dd729da1ca49179ace1447b2/packages/plugin-ext/src/common/plugin-api-rpc.ts#L1474)). + +To communicate with each other, the implementation of each side of the API - `Main` and `Ext` - has an RPC proxy of its corresponding counterpart. +The proxy is based on the interface of the other side: `Main` implementation has a proxy of the `Ext` interface and vice versa. +The implementations do not have explicit dependencies to each other. + +### Encoding and Decoding RPC Messages + +The communication between each side of the API is governed by proxies that use an `RpcProtocol` on a given channel to transmit RPC messages such as requests and notifications. +In Theia, the encoding and decoding process of RPC messages can be customized through dedicated `RpcMessageEncoder` and `RpcMessageDecoder` classes that can be provided when a new RpcProtocol is created. +The `RpcMessageEncoder` writes RPC messages to a buffer whereas the `RpcMessageDecoder` parses a binary message from a buffer into a RPC message. + +By default, Theia uses an encoder and decoder based on [msgpackr](https://www.npmjs.com/package/msgpackr) that already properly handles many JavaScript built-in types, such as arrays and maps. +We can separately extend the encoding and decoding of our own classes by installing extensions using the `MsgPackExtensionManager` singleton, accessible from both ends of the channel. +Examples of this can be found in the [extension for Errors](https://github.com/eclipse-theia/theia/blob/72421be24d0461f811a39324579913e91056d7c4/packages/core/src/common/message-rpc/rpc-message-encoder.ts#L171) and the [extension for URI, Range and other classes](https://github.com/eclipse-theia/theia/blob/72421be24d0461f811a39324579913e91056d7c4/packages/plugin-ext/src/common/rpc-protocol.ts#L223). +We call the registration of these extensions in `index.ts` to ensure they are available early on. +Please note that msgpackr [always registers extensions globally](https://github.com/kriszyp/msgpackr/issues/93) so the extensions leak into all connections within Theia, i.e., also non-API related areas such as the frontend-backend connection. +And while the number of custom extensions is [limited to 100](https://github.com/kriszyp/msgpackr?tab=readme-ov-file#custom-extensions), checking the extensions for every single message may impact performance if there are many extensions or the conversion is very expensive. +Another hurdle is that we need to ensure that we always detect the correct type of object purely from the object shape which may prove difficult if there are hundreds of objects and custom instances from user code. +Consequently, we mainly use the msgpackr extension mechanism for very few common classes but rely on custom data transfer objects (DTOs) for the Theia plugin API, see also [Complex objects and RPC](#complex-objects-and-rpc). + +## Adding new API + +This section gives an introduction to extending Theia’s plugin API. If you want to add a complete custom plugin API in your own extension, see this [readme](https://github.com/eclipse-theia/theia/blob/master/packages/plugin-ext/doc/how-to-add-new-custom-plugin-api.md). + +For adding new API, the first step is to declare it in the [theia.d.ts](https://github.com/eclipse-theia/theia/blob/master/packages/plugin/src/theia.d.ts) file in the plugin package. +In a second step, the implementation for the new API must be made available in the returned object of the API factory in [plugin-context.ts](https://github.com/eclipse-theia/theia/blob/master/packages/plugin-ext/src/plugin/plugin-context.ts). +Typically, functions or properties returned by the API factory delegate to an `Ext` implementation that actually provides the functionality. +See the following shortened and commented excerpt from [plugin-context.ts](https://github.com/eclipse-theia/theia/blob/master/packages/plugin-ext/src/plugin/plugin-context.ts)#createAPIFactory: + +```typescript +// Creates the API factory used to create the API object for each plugin +// Implementations handed into this are shared between plugins +export function createAPIFactory( + rpc: RPCProtocol, + pluginManager: PluginManager, + envExt: EnvExtImpl, + debugExt: DebugExtImpl, + preferenceRegistryExt: PreferenceRegistryExtImpl, + editorsAndDocumentsExt: EditorsAndDocumentsExtImpl, + workspaceExt: WorkspaceExtImpl, + messageRegistryExt: MessageRegistryExt, + clipboard: ClipboardExt, + webviewExt: WebviewsExtImpl +): PluginAPIFactory { + + // Instantiation of Ext services. + // Instantiate and register with RPC so that it will be called when the main side uses its proxy. + const authenticationExt = rpc.set(MAIN_RPC_CONTEXT.AUTHENTICATION_EXT, new AuthenticationExtImpl(rpc)); + const commandRegistry = rpc.set(MAIN_RPC_CONTEXT.COMMAND_REGISTRY_EXT, new CommandRegistryImpl(rpc)); + // [...] + + // The returned function is used to create an instance of the plugin API for a plugin. + return function (plugin: InternalPlugin): typeof theia { + const authentication: typeof theia.authentication = { + // [...] + }; + + // [...] + + // Here the API is returned. Add members of the root namespace directly to the returned object. + // Each namespace is contained in its own property. + return { + version: require('../../package.json').version, + // The authentication namespace + authentication, + // [...] + // Types + StatusBarAlignment: StatusBarAlignment, + Disposable: Disposable, + EventEmitter: Emitter, + CancellationTokenSource: CancellationTokenSource, + // [...] + }; + }; +} +``` + +### Adding new Ext and Main interfaces with implementations + +`Ext` and `Main` interfaces only contain the functions called over RPC. +Further functions are just part of the implementations. +Functions to be called over RPC must start with `$`, e.g. `$executeStuff`. + +- Define `Ext` and `Main` interfaces in [plugin-ext/src/common/plugin-api-rpc.ts](https://github.com/eclipse-theia/theia/blob/master/packages/plugin-ext/src/common/plugin-api-rpc.ts). +The interfaces should be suffixed with `Ext` and `Main` correspondingly (e.g. `LanguagesMain` and `LanguagesExt`). +- In [plugin-ext/src/common/plugin-api-rpc.ts](https://github.com/eclipse-theia/theia/blob/master/packages/plugin-ext/src/common/plugin-api-rpc.ts), add a proxy identifier for the `Ext` interface to `MAIN_RPC_CONTEXT` and one for the `Main` interface to `PLUGIN_RPC_CONTEXT` +- Create the `Ext` implementation in folder [plugin-ext/src/plugin](https://github.com/eclipse-theia/theia/tree/master/packages/plugin-ext/src/plugin). +- Create the `Main` implementation in folder [plugin-ext/src/main/browser](https://github.com/eclipse-theia/theia/tree/master/packages/plugin-ext/src/main/browser). +- To communicate via RPC, each implementation has a proxy depending on the interface on the other side. +For instance, see `LanguagesExtImpl` in [plugin-ext/src/plugin/languages.ts](https://github.com/eclipse-theia/theia/blob/master/packages/plugin-ext/src/plugin/languages.ts) and `LanguagesMainImpl` in [plugin-ext/src/main/browser/languages-main.ts](https://github.com/eclipse-theia/theia/blob/master/packages/plugin-ext/src/main/browser/languages-main.ts). +They each create the proxy to the other side in their constructors by using the proxy identifiers. + +### Complex objects and RPC + +When [encoding and decoding RPC messages](#encoding-and-decoding-rpc-messages) pure DTO objects that only carry properties can always be transmitted safely. +However, due to the necessary serialization process, functions and references to other objects can never be transmitted safely. + +If functions of objects need to be invoked on the opposite side of their creation, the object needs to be cached on the creation side. +The other side receives a handle (usually an id) that can be used to invoke the functionality on the creation side. +As all cached objects are kept in memory, they should be disposed of when they are no longer needed. +For instance, in [LanguagesExtImpl#registerCodeActionsProvider](https://github.com/eclipse-theia/theia/blob/master/packages/plugin-ext/src/plugin/languages.ts) a new code action provider is created and cached on the `Ext` side and then registered on the `Main` side via its handle. +When the code action provider’s methods are later invoked on the `Main` side (e.g. in [LanguagesMainImpl#provideCodeActions](https://github.com/eclipse-theia/theia/blob/master/packages/plugin-ext/src/main/browser/languages-main.ts)), it calls the `Ext` side with this handle. +The `Ext` side then gets the cached object, executes appropriate functions and returns the results back to the `Main` side (e.g. in [LanguagesExtImpl#$provideCodeActions](https://github.com/eclipse-theia/theia/blob/master/packages/plugin-ext/src/plugin/languages.ts)). +Another example to browse are the [TaskExtImpl](https://github.com/eclipse-theia/theia/blob/master/packages/plugin-ext/src/plugin/tasks/tasks.ts) and [TaskMainImpl](https://github.com/eclipse-theia/theia/blob/master/packages/plugin-ext/src/main/browser/tasks-main.ts) classes. + +To [ensure correct type conversion](#encoding-and-decoding-rpc-messages) between the Theia backend and the plugin host we define an API protocol based on types and DTOs that can be transmitted safely. +The plugin API and its types are defined in [plugin-ext/src/common/plugin-api-rpc.ts](https://github.com/eclipse-theia/theia/blob/master/packages/plugin-ext/src/common/plugin-api-rpc.ts) with some additional conversion on the `Ext` side being defined in [plugin-ext/src/plugin/type-converters.ts](https://github.com/eclipse-theia/theia/blob/master/packages/plugin-ext/src/plugin/type-converters.ts). +Thus, this is also a good starting point to look for conversion utilities for existing types. + +### Adding new types + +New classes and other types such as enums are usually implemented in [plugin-ext/src/plugin/types-impl.ts](https://github.com/eclipse-theia/theia/blob/master/packages/plugin-ext/src/plugin/types-impl.ts). +They can be added there and then we can add them to the API object created in the API factory. + +## Headless Plugins + +The majority of plugin use cases are for extension of the Theia user experience via the VS Code compatible API provided by Theia. +These plugins use either the `vscode` API object if they use the `"vscode"` engine type in their package manifests or else the `theia` object if they use the `"theiaPlugin"` engine. +The lifecycle of these kinds of plugins is bound to _frontend connections_: for each connected frontend, the Theia backend spawns a plugin host host process dedicated to it in which these plugins are loaded and activated (as applicable to their declared activation events). +In the plugin host for a frontend connection these plugins have access to Theia services as discussed above, isolated from the main Theia backend process and from all of the other instances of the same plugin running in plugin hosts for all other frontend connections. + +Headless plugins, by contrast, are quite different in most respects: + +- They are encapsulated in a single plugin host process in the backend, separate from all frontend-connection plugin hosts. +This host is spun up only if there are any headless plugins to run in it. +- Theia does not export any default API object, analogous to `vscode` or `theia` for other plugins, as Theia itself defines no use cases for headless plugins. +Such use cases are entirely defined by the Theia-based application's requirements and reflected in its custom APIs defined [as described in this how-to document][custom-api-howto]. +- Theia supports neither any contribution points for headless plugins nor any non-trivial activation events (only `'*'` and `'onStartupFinished'`). +This is a corollary of the use cases being entirely application-specific: the application needs to define its own contribution points and activation events. +Currently this requires an application to enumerate the available deployed plugins via the [HostedPluginServer](https://github.com/eclipse-theia/theia/blob/1a56ba96fdc9b6df3a230df7b44e22e5785e3abd/packages/plugin-ext/src/common/plugin-protocol.ts#L1005) to parse their package manifests to extract application-specific contribution points and activation events, and to activate plugins via the [PluginManager::activatePlugin(pluginId)](https://github.com/eclipse-theia/theia/blob/1a56ba96fdc9b6df3a230df7b44e22e5785e3abd/packages/plugin-ext/src/common/plugin-api-rpc.ts#L182) API on the appropriate triggers. + +Thus, headless plugins are best suited to the contribution of third-party extensions of a Theia application's custom backend services, where those service are shared by all connected frontends or serve some kind of headless scenario like a CLI. + +A headless plugin may be restricted to only the headless deployment, in which case it may make this explicit by declaring the `"theiaHeadlessPlugin"` engine in its package manifest. +Alternatively, a VS Code or Theia plugin that extends the frontend user experience may also contribute a headless entrypoint for a headless deployment by identifying such entrypoint script in the `"headless"` property of the `"theiaPlugin"` object in its package manifest in addition to the `"main"` entrypoint (for VS Code plugins) or the `"theiaPlugin.backend"` entrypoint (for Theia plugins). + +The only API namespaces that are available to headless plugins are those custom APIs that are contributed by the application's custom build-time Theia extensions or by other headless plugins via the return results of their `activate()` functions. +For details of how to contribute custom API, see the [pertinent documentation][custom-api-howto]. + +[custom-api-howto]: https://github.com/eclipse-theia/theia/blob/master/packages/plugin-ext/doc/how-to-add-new-custom-plugin-api.md + +## Dependency Injection + +Both the `Main` and the `Ext` sides of the plugin API are configured using [InversifyJS](https://inversify.io) dependency injection. + +On the `Main` side, the usual mechanism is used to bind implementations of the API objects, consisting of `ContainerModule`s registered in `package.json` and loaded at start-up into Theia's Inversify `Container` by a generated script. + +On the `Ext` side, the plugin host initialization script creates and configures its Inversify `Container`. +You are encouraged to leverage this dependency injection in the definition of new API objects and the maintenance of existing ones, to promote reuse and substitutability of the various interface implementations. + +## Additional Links + +Talk by Thomas Maeder on writing plugin API: + +Adding a new custom plugin API outside of Theia plugin API: [how-to-add-new-custom-plugin-api.md](https://github.com/eclipse-theia/theia/blob/master/packages/plugin-ext/doc/how-to-add-new-custom-plugin-api.md) + +Theia Plugin Implementation wiki page: + +Writing Plugin API wiki page in the che wiki: + +Theia versus VS Code API Comparator: + +Theia's extension mechanisms: VS Code extensions, Theia extensions, and Theia plugins: + +Example of creating a custom namespace API and using in VS Code extensions: + +Example of a Theia extension defining a custom namespace API and a headless plugin that uses it: [Greeting-of-the-Day API Provider Sample](https://github.com/eclipse-theia/theia/blob/master/examples/api-provider-sample) and [Greeting-of-the-Day Client Sample Plugin](https://github.com/eclipse-theia/theia/blob/master/sample-plugins/sample-namespace/plugin-gotd) diff --git a/doc/Publishing.md b/doc/Publishing.md new file mode 100644 index 0000000..d19366c --- /dev/null +++ b/doc/Publishing.md @@ -0,0 +1,629 @@ +# Publishing Guide for Eclipse Theia Releases + +This guide details the steps for maintainers to release Eclipse Theia, including pre-release preparations, the release process, post-release steps, and troubleshooting. + +## Table of Contents + +1. [Pre-Release Steps](#1-pre-release-steps) + - [1.1 Announce Release](#11-announce-release) + - [1.2 Check for release preparation tickets](#12-check-for-release-preparation-tickets) + - [1.3 Localization](#13-localization) + - [1.4 Prepare Release Branch](#14-prepare-release-branch) + - [1.5 Update Changelog](#15-update-changelog) +2. [Release Process](#2-release-process) + - [2.1 Performing a Release](#21-performing-a-release) + - [2.2 Community Releases](#22-community-releases) +3. [Post-Release Steps](#3-post-release-steps) + - [3.1 Eclipse Release](#31-eclipse-release) + - [3.2 Announce Release Completion](#32-announce-release-completion) + - [3.3 Update Future Milestones](#33-update-future-milestones) + - [3.4 Merge Website PRs](#34-merge-website-prs) + - [3.5 Publish GitHub Pages](#35-publish-github-pages) + - [3.6 Update Major Dependencies](#36-update-major-dependencies) + - [3.7 NPM Upgrade](#37-npm-upgrade) +4. [Troubleshooting](#4-troubleshooting) + - [Failures During Publishing](#41-failures-during-publishing) + +## 1. Pre-Release Steps + + +### 1.1 Announce Release + + +#### 1.1.1 Minor Release 1.x.0 + + +- Provide a heads-up to developers and the community two days before the release. + +##### 1.1.1.1 GH Discussion + + +- Use GitHub Discussions for the announcement in the [Category Release Announcements](https://github.com/eclipse-theia/theia/discussions/new?category=release-announcements). + + Title: + + ```md + Eclipse Theia v{{version}} + ``` + + Body: + + ```md + Hey everyone 👋, + + The Eclipse Theia v{{version}} release is scheduled for **{{releaseDate}}**. + + Please use the Endgame issue below to track what’s included. + If you have any nearly-complete PRs that should to be part of the release, please mention it in the endgame issue before we start: + + - https://github.com/eclipse-theia/theia/issues/{{currentEndgameIssueNumber}} + + We'll post updates when the release begins and again once it’s finished. + Please avoid merging pull requests until we confirm the release is complete. + ``` + + - Pin discussion to the Release Announcement Category + +- Refer to [this example](https://github.com/eclipse-theia/theia/discussions/14547) for guidance. + +##### 1.1.1.2 theia-dev mailing list + + +- Also send an email to [the `theia-dev` mailing List](mailto:theia-dev@eclipse.org) (don't forget to add the link to the discussion): + + Subject: + + ```md + Eclipse Theia version v{{version}} + ``` + + Body: + + ```md + Hi everyone, + + The Eclipse Theia v{{version}} release is scheduled for {{releaseDate}}! + You can follow the progress of the release here: https://github.com/eclipse-theia/theia/discussions/{{discussionNumber}} + ``` + +#### 1.1.2 Patch Release 1.x.z + + +- Provide a heads-up to developers and the community a few hours before the release. +- Use the [Release discussion](#111-minor-release-1x0) and post a comment to announce the patch release: + + ```md + We are preparing the patch release Eclipse Theia v{{version}} + + Follow the endgame checklist here: + - https://github.com/eclipse-theia/theia/issues/{{patchEndgameIssueNumber}} + + We'll post an update once the release is finished. + ``` + +### 1.2. Check for release preparation tickets + + +Check for tickets that need to be addressed when preparing the release: + +- Prepare/resolve all tickets that are located in: + - e.g. initial publish to npm for newly added packages. + +### 1.3 Localization + + +- Perform `nls` updates before a release ([example](https://github.com/eclipse-theia/theia/pull/14373)). +- Trigger the automatic translation workflow via GitHub Actions ([workflow link](https://github.com/eclipse-theia/theia/actions/workflows/translation.yml)). +- Force-push the branch created by the bot to properly trigger CI. +- Once the PR is approved, use `Squash and merge` to finalize it. +- Restore the branch `bot/translation-update`. + +### 1.4 Prepare Release Branch + + +- Checkout `master` with the latest changes: + + ```bash + git pull + ``` + +- Confirm the latest changes are present: + + ```bash + git log + ``` + +- Create a branch with the pattern `release/major.minor.x` (e.g., `release/1.55.x`). + + ```md + release/{{majorMinor}}.x + ``` + +### 1.5 Update Changelog + + +Add entries for non-breaking changes since the last release. Breaking changes should be added by the PR, not during the release. + +Commit the changelog changes to the release branch with the message: + +```bash +docs: update changelog for {{version}} +``` + +Format: + +- Version and date as an H2 header (e.g., `## 1.55.0 - 10/31/2024`). +- Entries should: + - Be prefixed with their extension name (e.g., `[core]`). + - Start with a lowercase character and be in the past tense (e.g., 'added support...'). + - Be in alphabetical order. + - Include a link to their corresponding pull request. + - Specify contribution if applicable (e.g., Contributed on behalf of x). + - Example: `[core] added support for Node 20.x [#pr-number]() - Contributed on behalf of x`. +- Breaking changes should be in a separate section (header: `[Breaking Changes:](#breaking_changes_1.55.0)`). + +## 2. Release Process + + +### 2.1 Performing a Release + + +- Make sure the prepared Release Branch is pushed. + +### 2.1.1 GH Discussion announcement + + +- Announcement for Minor Release (x.x.0) + - Announce that the release is starting as a comment in the [Release discussion](#111-minor-release-1x0): + + ```md + The release will start now. We'll post an update once it has completed. + Please avoid merging pull requests until we confirm the release is complete. + ``` + +### 2.1.2 Newly added Theia packages - publish initially to NPM + + +_NOTE:_ New `@theia` packages must be published once manually by a Theia committer before the publish workflow can publish them. +This is due to recent changes requiring trusted workflows for npm publishing. + +It is recommend to first publish a next version of the new package, then we can publish the release properly via the recommended publish workflow. +- To publish locally, you need to: + - Ensure you are logged in to NPM (`npm login`; NPM will prompt you for an OTP (one-time password) or security key). + - Have your 2FA ready, as you will need an OTP for the publishing process to complete. +- Run `npm run publish:next` + - Optional: If you remove the `--yes` parameter from the publish script, the publishing process will ask you to confirm each step before proceeding. + +Once it is published to NPM, please update the settings of this package as follows: +- Have your security key or 2FA ready +- Go to `https://www.npmjs.com/package/@theia//access` +- Trusted `Publisher` > Select `GitHub Actions publisher` > Enter the required fields to our publish workflow (`publish-ci.yml`) +- Set `Publishing access` to `Require two-factor authentication and disallow tokens (recommended)` + +Optional: Trigger the publish workflow for the `next` version once to verify the workflow can publish the new package as expected. + +### 2.1.3 OPTION 1 (preferred): Perform the release via GH WORKFLOW + + +_NOTE:_ This publishing option is preferred, as the packages are built and signed on GitHub Actions with provenance using the trusted workflow for NPM publishing. + +- Run the [_Publish packages to NPM_](https://github.com/eclipse-theia/theia/actions/workflows/publish-ci.yml) workflow +- Choose the release branch (i.e., `release/{{majorMinor}}.x`) +- Choose the respective release type and check the input option in case it is a patch for a previous version. + +_NOTE:_ In case the automatic publishing fails (e.g., some packages are not published if step 2.1.2 was missed) you can go to Option 2, performing the release locally. +Already published packages of the version will be skipped and the missing ones will be published then. + +### 2.1.3.1 Check Package update PR + + +- The workflow automatically creates a PR to update the package versions for the release branch, see [example here](https://github.com/eclipse-theia/theia/pull/16438) +- Follow the instructions in the PR, to ensure all package versions are updated and change the author of the commits to you. +- Wait for the checks to succeed, then merge using `Rebase and Merge`. + +### 2.1.4 OPTION 2: Perform the release LOCALLY + + +_NOTE:_ Performing the release locally will publish unsigned packages to NPM. + +### 2.1.4.1 Prepare the release locally + + +- Ensure the release branch is checked out (i.e., `release/{{majorMinor}}.x`). + +- Clean the working directory: + + ```bash + git clean -xdf + ``` + +- Build the changes: + + ```bash + npm install && npm run build + ``` + +- Confirm the changes are built (ensure `@theia` extensions have their `lib/` folders). + +### 2.1.4.2 Publish the release locally + + +- The settings for publishing access were changed to the recommended: 'Require two-factor authentication and disallow tokens (recommended)'. +- To publish locally, you need to: + - Ensure you are logged in to NPM (`npm login`; NPM will prompt you for an OTP (one-time password) or security key). + - Have your 2FA ready, as you will need an OTP for the publishing process to complete. +- Optional: If you remove the `--yes` parameter from the publish scripts, the publishing process will ask you to confirm each step before proceeding.. +- For example, a sample publishing run could look like this: + + ```bash + npm run publish:next + lerna notice + ... + lerna info + + Found 1 package to publish: + - @theia/some-package => x.y.z + + ✔ Are you sure you want to publish these packages? Yes + lerna info publish Publishing packages to npm... + ✔ This operation requires a one-time password: + lerna success published @theia/some-package x.y.z + lerna notice + lerna notice 📦 @theia/some-package@x.y.z + lerna notice === Tarball Contents === + ... + lerna notice + Successfully published: + - @theia/some-package@x.y.z + lerna success published 1 package + Done in ...s. + ``` + +### 2.1.4.2.1 Minor Release 1.x.0 + + +- Perform the release: + + ```bash + npm run publish:latest + ``` + + Select the appropriate version. + +- Verify the packages are published on npm and with the correct tag. (e.g., check the core package ) + +- Remove the auth token: + + ```bash + npm logout + ``` + +### 2.1.4.2.2 Patch Release 1.x.z + + + _NOTE:_ For a patch release on an earlier version (e.g., 1.55.1 when 1.56.0 exists), use: + + ```bash + npm run publish:patch + ``` + + For a patch to the current version use: + + ```bash + npm run publish:latest + ``` + +- Verify the packages are published on npm and with the correct tag. (e.g., check the core package ) + +- Remove the auth token: + + ```bash + npm logout + ``` + +### 2.1.4.3 Prepare the release branch + + +- Ensure the release branch is still checked out (i.e., `release/{{majorMinor}}.x`). + +- Update `packages/core/README.md` in a commit ([example](https://github.com/eclipse-theia/theia/commit/21fa2ec688e4a8bcf10203d6dc0f730af43a7f58)). + + Commit message: + + ```md + core: update re-exports for v{{version}} + ``` + +- Add other changes in a commit named `v{version}`. +- Make sure to update ALL packages to the new version (search & replace) + + Commit message: + + ```md + v{{version}} + ``` + +- Push the branch. + +### 2.1.5 Native dependencies + + +- Once the release branch has been updated (package updates): + - Get the `native dependencies` + - Run the [_Package Native Dependencies_](https://github.com/eclipse-theia/theia/actions/workflows/native-dependencies.yml) GitHub Action on the release branch (You can continue while you wait). + - Download the artifacts (They are located on the build overview at the bottom). + - Extract the downloaded folders. + - Leave the dependencies for now, you will need them later. + +### 2.1.6 Create the release PR against main + + +- Create a PR against main (not needed for patch releases): + + PR Title: + + ```md + Theia v{{version}} + ``` + + - Wait for approval. + - Merge using `Rebase and Merge` (**DO NOT `Squash and Merge`**). + - Restore the release branch. + +- See for example: + +### 2.1.7 Create the annotated Git Tag + + +- Tag the publishing commit after merging (for patch releases, tag directly on the release branch): + + ```bash + git tag -a v{{version}} ${sha} -m "v{{version}}" + ``` + + _Note_: The tag needs to be annotated otherwise it might break the publishing. Check that the output of the following command is `tag` and not `commit`. + + ```bash + git for-each-ref refs/tags | grep 'v{{version}}' | awk '{print $2}' + ``` + +- Push the tag: + + ```bash + git push origin v{{version}} + ``` + +### 2.1.8 Create the GH Release - Minor Release 1.x.0 + + +- Create a GitHub release: + - Draft a release on the [releases page](https://github.com/eclipse-theia/theia/releases/new). + - Choose the appropriate `tag` and input the release title from below. + - Use `generate release notes` for contributors and format like previous releases. + - Reference the `changelog` and breaking changes. + - Attach _Native Dependencies_ artifacts (the extracted zips). + - native-dependencies-darwin-arm64.zip + - native-dependencies-linux-x64.zip + - native-dependencies-win32-x64.zip + - Mark the release as `latest` + - Select _"Publish Release"_. + - See [GitHub documentation](https://help.github.com/en/github/administering-a-repository/managing-releases-in-a-repository#creating-a-release) for details. + +Release Title: + +```md +Eclipse Theia v{{version}} +``` + +### 2.1.9 Create the GH Release - Patch Release 1.x.z + + +- Create a GitHub release: + - Draft a release on the [releases page](https://github.com/eclipse-theia/theia/releases/new). + - Choose the appropriate `tag` and input the release title from below. + - Check the previous tag is correct. + - Use `Generate release notes` for the changelog link. + - Attach _Native Dependencies_ artifacts (the extracted zips). + - native-dependencies-darwin-arm64.zip + - native-dependencies-linux-x64.zip + - native-dependencies-win32-x64.zip + - Optional: Mark the release as `latest` (_Uncheck for a patch on an OLDER version!!_). + - Select _"Publish Release"_. + - See [GitHub documentation](https://help.github.com/en/github/administering-a-repository/managing-releases-in-a-repository#creating-a-release) for details. + +Release Title: + +```md +Eclipse Theia v{{version}} +``` + +Release Body: + +```md +Based on https://github.com/eclipse-theia/theia/tree/v{{majorMinor}}.X + +Includes the following fixes: +- + +**Full Changelog**: should be generated via 'Generate release notes' +``` + +### 2.2 Community Releases + + +Community releases follow the same procedure as the regular releases. Please follow [2.1 Performing a Release](#21-performing-a-release). + +## 3. Post-Release Steps + + +### 3.1 Eclipse Release + + +- Login to [Eclipse Foundation Theia project page](https://projects.eclipse.org/projects/ecd.theia). +- Select `Release` / `Create a new release` from the menu. + - `Release Date`: Enter the date. + - `Name`: Enter the version (e.g., `1.55.0`). +- Go to Edit -> Project Plan + - Add the changelog link to `deliverables` (Link with text `Release Notes`). + - Add breaking changes link to `compatibility` (Link with text `Breaking Changes`). +- Save changes and confirm by reviewing the project page. + +### 3.2 Announce Release Completion + + +### 3.2.1 Minor Release 1.x.0 + + +- Close the endgame issue: use the comment below as closing comment. + +- Update the discussion and comment in the [Release discussion](#111-minor-release-1x0) that the release is completed: + + ```md + The [{{version}} release](https://github.com/eclipse-theia/theia/releases/tag/v{{version}}) has completed, thank you to everyone that participated and contributed! + ``` + +- Mark the message as the answer + +- Unpin discussion from the Release Announcement Category + +- Also send an email to [the `theia-dev` mailing List](mailto:theia-dev@eclipse.org): + + Subject: + + ```md + Eclipse Theia v{{version}} release + ``` + + Body: + + ```md + Hi everyone, + + The Eclipse Theia v{{version}} release has been published! + See the release on GitHub for more information: https://github.com/eclipse-theia/theia/releases/tag/v{{version}} + + Thank you to everyone that participated and contributed! + ``` + +### 3.2.2 Patch Release 1.x.z + + +- Close the endgame issue: use the comment below as closing comment. + +- Update the discussion and comment in the [Release discussion](#111-minor-release-1x0) that the release is completed: + + ```md + The [{{version}} patch release](https://github.com/eclipse-theia/theia/releases/tag/v{{version}}) has completed, thank you to everyone that participated and contributed! + ``` + +- Mark the message as the answer + +- Also send an email to [the `theia-dev` mailing List](mailto:theia-dev@eclipse.org): + + Subject: + + ```md + Eclipse Theia v{{version}} patch release + ``` + + Body: + + ```md + Hi everyone, + + The Eclipse Theia v{{version}} patch release has been published! + See the release on GitHub for more information: https://github.com/eclipse-theia/theia/releases/tag/v{{version}} + + Thank you to everyone that participated and contributed! + ``` + +### 3.3 Update Future Milestones + + +- Close the current release [milestone](https://github.com/eclipse-theia/theia/milestones). +- Create the next two milestones if they do not already exist. Releases are typically on the last Thursday of the month, with possible exceptions. + +### 3.4 Merge Website PRs + + +- Merge all [website PRs marked with label `merge with next release`](https://github.com/eclipse-theia/theia-website/labels/merge%20with%20next%20release) + +### 3.5 Publish GitHub Pages + + +- Publish the `latest` documentation with the [GitHub Pages workflow](https://github.com/eclipse-theia/theia/actions/workflows/publish-api-doc-gh-pages.yml) manually using the `manual_dispatch` job. + +### 3.6 Update Major Dependencies + + +After each release, check the following major dependencies for version updates: + +- [Node.js](https://nodejs.org/en/download/releases/) - Check for LTS versions and security updates +- [React](https://react.dev/versions) - Review latest stable releases +- [Electron](https://www.electronjs.org/docs/latest/tutorial/electron-timelines) + - Evaluate supported versions and review [Breaking changes](https://www.electronjs.org/docs/latest/breaking-changes) for anything that may affect usage. + +For each dependency requiring an update, [create a ticket](https://github.com/eclipse-theia/theia/issues/new?template=feature_request.md) using the following template: + +Title: + +```md +Update [DEPENDENCY_NAME] to version X.Y.Z +``` + +Description: + +```md +Update [DEPENDENCY_NAME] to stay up-to-date and consume (security) fixes. + +- Current version: [CURRENT_VERSION] +- Target version: [TARGET_VERSION] + +After updating the dependency, please [open a ticket for the Theia IDE](https://github.com/eclipse-theia/theia-ide/issues/new?template=feature_request.md) and assign the `toDoWithRelease` and `dependencies` labels. +This indicates that the update needs to be done in Theia IDE as well and ensures it will be addressed with the next release. +``` + +If certain updates need to be done together (e.g. new electron version requires newer node version) feel free to group the tickets together. + +Assign the ticket to @ndoschek. + +Once the ticket is created, @ndoschek will evaluate and assign it to the appropriate person for implementation. + +### 3.7 NPM Upgrade + + +Perform a `npm upgrade` on the repository after the release to update the `package-lock.json`. The upgrade helps to: + +- Better represent what adopters will pull during a release. +- Validate dependencies with our declared version ranges. +- Fix known security vulnerabilities from dependencies. + +To perform the upgrade: + +- Run `npm upgrade` at the root of the repository. +- Fix any compilation errors, typing errors, and failing tests. +- Open a PR with the changes ([example](https://github.com/eclipse-theia/theia/pull/15688)). +- Run the license check review locally +- Wait for the "IP Check" to complete ([example](https://gitlab.eclipse.org/eclipsefdn/emo-team/iplab/-/issues/9377)). + +Performing this after the release helps us to find issues with the new dependencies and gives time to perform a license check on the dependencies. + +## 4. Troubleshooting + + +### 4.1 Failures During Publishing + + +If `lerna` fails during publishing (e.g., socket errors), use the following commands to reset and retry: + +- Reset the repository: + + ```bash + git reset --hard + ``` + +- Retry publishing only the unpublished packages: + + ```bash + npx lerna publish from-package --no-git-reset --no-git-tag-version --no-push + ``` diff --git a/doc/Testing.md b/doc/Testing.md new file mode 100644 index 0000000..6b64feb --- /dev/null +++ b/doc/Testing.md @@ -0,0 +1,54 @@ +# Testing + +## Running tests + +Before running make sure to compile tests with `compile` or `watch` scripts. + +To run tests on theia run: + +`npm run test` + +This will run all CI enabled tests. + +If you want to run all tests for a particular Theia extension, execute the following command from the root: + +`npx lerna run test --scope @theia/extension-name` + +Add the following npm script to the `package.json` of the desired Theia extension, if you would like to enable the watch mode for the tests. + +```json + "test:watch": "theiaext test:watch" +``` + +After editing the `package.json` you can run the tests in watch mode with: + +`npx lerna run test:watch --scope @theia/extension-name` + +## Test directory structure + +The test directory structure is as follows: + +- `src/node/foo.ts`: Code to be tested. +- `src/node/foo.spec.ts`: Unit tests for foo.ts. +- `src/node/test/test-helper.ts`: Any mocks, fixture or utility test code + goes here. +- `src/node/foo.slow-spec.ts`: Any slow running tests such as integration + tests should be labeled as such so that they can be excluded. +- `src/browser/foo.ui-spec.ts`: UI tests. +- `test-resources`: Any resources needed for the tests like configuration + files or scripts. +- `test-resources/ui`: Resources for UI testing. +- `test-resources/slow`: Resources for slow running tests. + +## Publishing + +### Published test files + +Unit tests named as `foo.spec.ts` will be published since they're also for +documentation purposes. + +### Unpublished + +- `*ui-spec.ts` +- `*slow-spec.ts` +- `test-resources` diff --git a/doc/api-management.md b/doc/api-management.md new file mode 100644 index 0000000..ca38d67 --- /dev/null +++ b/doc/api-management.md @@ -0,0 +1,147 @@ +# API Management + +> The guidance below is for the code of the Theia framework only. End products will get better development experience by using private visibility. + +- [**Stability**](#stability) + - [**Experimental**](#experimental) + - [**Stable**](#stable) +- [**Finalization**](#finalization) +- [**Deprecation**](#deprecation) + +Theia is a framework embracing openness, extensibility, and customizability as much as possible: + +- API defaults to public visibility for clients. +- API defaults to protected for extenders. +- Language constructions prohibiting runtime access to internals are never used. + +Usually, the version management is built around API visibility. +Particularly, when a public API is broken a new major release is required. + +Since all APIs are more or less public, following the conventional approach is not practicable for Theia. +It will slow down API innovation, accumulate technical debt or require many major releases. + +Instead, we demand a major release only if a _stable_ API is broken. +Breaking an _experimental_ API is allowed in a minor release. + +## Stability + +Conceptually, an API consists of all assumptions adopters depend on to make use or extend Theia. +A stable API is based on assumptions that are not subject to change. +It does not matter whether an API is public or internal, or whether it is used a lot or never. + +> For instance, the language server protocol (LSP) depends on such data types like URIs and positions +since they don't change from language to language. It ensures its stability. + +API stability is indicated explicitly by adding `@experimental` or `@stable` js-doc tags. + +The explicit stability tag should be accompanied by `@since` tag indicating when API was added. +The `@stable` tag should mention since which version an API was finalized. + +An API without a stability tag is considered to be experimental and does not require `@since` tag. + +```ts +/** + * One does not need any annotations while working on experimental APIs. + */ +export interface ExperimentalInterface { +} + +/** + * @since 0.1.0 + * @stable since 1.0.0 + */ +export interface StableInterface { + + /** + * The same as `StableInterface`. + */ + stableMethod(): void; + + /** + * Adding new API to stable API should be explicit. + * + * @since 1.1.0 + * @experimental + */ + experimentalMethod(): void; + +} + +``` + +### Experimental + +- All new APIs should always be added as **experimental** since it's almost impossible to get [stable API](#stable) right the first time. +- Experimental APIs don't require the stability tag, but if a new member is added to [stable API](#stable) then it should be explicitly annotated. +- Experimental APIs don't require extensive documentation. It does not mean that one shouldn't document unobvious parts. +- Experimental APIs don't follow [semver](https://semver.org/#spec-item-8) semantic. +- Experimental APIs could be changed or removed without [the deprecation cycle](#deprecation) if they were not widely adopted. +- Adoption should be measured by the number of internal clients or based on the feedback of Theia contributors and committers. + +### Stable + +- [Experimental APIs](#experimental) can be graduated to `stable` via [the finalization cycle](#finalization). +- Stable APIs should be based on design decisions that are not likely to change. +- Stable APIs should have sufficient adoption. +- Stable APIs should have proper documentation. +- Stable APIs must follow [semver](https://semver.org/#spec-item-8) semantic. +- They can be changed only in a backward-compatible fashion. +- They can be removed only via [the deprecation cycle](#deprecation). + +## Finalization + +API finalization should be requested via GitHub issues with `api-finalization` label. +Such request should be resolved via a pull request following to [PR guidelines](https://github.com/eclipse-theia/theia/blob/master/doc/pull-requests.md#pull-requests). + +Finalization implies a review of the adoption, stability, and documentation of APIs. +One cannot judge stability without gaining enough experience +and provide stable documentation without API stability in the first place. + +If there is not enough adoption, then finalization should be postponed. +If it does not get adopted later, it should be considered to move APIs +from the framework to another repository managed by requesting adopters. + +> Why? Consider the case if the LSP would have a feature that can be supported only by one tool. +It is reasonable to move such a feature to a tool specific LSP extension +instead of bloating the protocol. The same applies to the framework: +If API is added and used only by one adopter, then such API has to be moved to the adopter. +It ensures control of API for such adopters and reduces the API surface of the framework. + +If APIs are based on design decisions that are subject to change, then +one could postpone finalization before such decisions are resolved. + +> Why? Some design decisions are only temporarily subject to change, for instance, +which layout framework should be used. After it is resolved, +such a design decision becomes fundamental, cannot be changed, and can be adopted. + +If it is not possible, then APIs should be refactored to hide such assumptions. + +> Why? Some design decisions are changeable by nature, for instance, for the LSP, +kind of symbols of a concrete language. In such a case, +API should be changed to operate abstract symbol data type to hide concrete symbols. + +If sufficient adoption and API stability are established, +documentation should be reviewed and completed. + +## Deprecation + +API deprecation is indicated by adding `@deprecated` js-doc tag. +The deprecation tag should mention, since which version it is deprecated, explain why and what should be used instead. + +```ts +/** + * @since 0.1.0 + * @stable since 1.0.0 + * @deprecated since 1.1.0 - because that and that, use that instead + */ +export interface DeprecatedStableInterface { + +} +``` + +Deprecated [stable API](#stable) can be removed in one of the next _major_ releases + +Deprecated [experimental API](#experimental) can be removed in one of the next _minor_ releases + +Breaking changes should be documented in [CHANGELOG](../CHANGELOG.md). Each breaking change should be justified to adopters +and guide what should be done instead. diff --git a/doc/api-testing.md b/doc/api-testing.md new file mode 100644 index 0000000..8ac9545 --- /dev/null +++ b/doc/api-testing.md @@ -0,0 +1,183 @@ +# API Integration Testing + +- [**Testing principles**](#testing-principles) +- [**Writing tests**](#writing-tests) + - [**Declaring a test suite**](#declaring-a-test-suite) + - [**Accessing application services**](#accessing-application-services) + - [**Writing a test**](#writing-a-test) +- [**Running tests**](#running-tests) +- [**Inspecting tests**](#inspecting-tests) +- [**Running a single test**](#running-a-single-test) + +Usually, integration tests are written against DOM/CSS +and executed from a separate process with frameworks like Selenium. +After experimenting with such approach we learned that +they are slow, unstable, hard to develop, debug, maintain and +miss actual issues. + +Theia comes with own integration testing framework which is designed +to overcome the shortcomings of the conventional approach: + +- tests are written against the application APIs +ensuring that completeness and timing of APIs are tested; +- tests are executed within the application process +ensuring their speed and robustness. + +## Testing principles + +- **Information Hiding**: API should provide the application object model +hiding DOM/CSS implementation details behind. +Test against the application API, not implementation details, like DOM/CSS. +- **Completeness**: API should be complete, i.e. stateful service +should provide accessor functions and events. +Instead of introducing helper test functions, implement missing APIs. +- **Extensibility**: API should be broken down to minimal interfaces +with simple functions since minimal interfaces are easy to implement and +new functionality can be developed by composing simple functions. +Watch out for complex functions that do everything in tests and implementation. +- **Convenience**: API should provide convenient functions +for typical complex tasks, such functions although +it should not be complex, but broken down to follow the extensibility principle. +Simplify tests by extracting convenient APIs. +- **Robustness**: API should provide reliable timing, e.g. if a test focuses the editor, +a function should resolve when an editor focused. +Watch out for tests which are guessing based on DOM event listeners +instead of relying on API events and promises. + +## Writing tests + +New tests should be added in `examples/api-tests` package. +This package is published to allow adopters to run tests against end products. +Tests should be decomposed to different test suite files that adopters could include only some. + +### Declaring a test suite + +All test files are loaded one by own in the application process in the global scope. +It means that they are sharing variables declared in the global scope. +To avoid name conflicts each test file should start with a declaration of the test suite +with the function scope. New variables have to be declared only within this function scope. + +```js +describe('Editors', function () { + + const { assert } = chai; + +}); +``` + +### Accessing application services + +The application is always bundled. Bundles exposing application modules via `theia` namespace. +One can access a module with `window.theia.moduleName`, where `moduleName` +is the absolute path to a module file relative to a containing package. +For instance `editor-manager.js` can be accessed with `window.theia['@theia/editor/lib/browser/editor-manager']`. +Testing framework as well injects `require` function to lookup modules. +It can be useful with enabled typescript checks for js files to write statically checked code. + +Importing symbols from an exposed module is not enough, +one has to access their implementations from the application container. +The application container is exposed via `theia` namespace as well +and can be accessed with `window.theia.container`. + +```js +// @ts-check +describe('Editors', function () { + + const { assert } = chai; + + const { EditorManager } = require('@theia/editor/lib/browser/editor-manager'); + const Uri = require('@theia/core/lib/common/uri'); + const { WorkspaceService } = require('@theia/workspace/lib/browser/workspace-service'); + + /** @type {import('inversify').Container} */ + const container = window['theia'].container; + const editorManager = container.get(EditorManager); + const workspaceService = container.get(WorkspaceService); + +}); +``` + +### Writing a test + +An example of the complete test suite can be found below. You can see how it follows design principles: + +- **Information Hiding**: the object model (EditorManager) is provided to access editors, no DOM/CSS are used. +- **Completeness**: API provides a way to access existing editors and open new editors, +there are also events notifying when a new editor get created or closed. More tests can be added to test it. +- **Extensibility**: EditorManager is not implementing everything but reuses WidgetOpenHandler and WidgetManager. +Different specialized widget managers can be built on top of it. +Improvements in WidgetOpenHandler and WidgetManager translate to all specialized widget managers. +- **Convenience**: Test is not written with using `WidgetManager.open` API, +but such logic is already encapsulated in `EditorManager.open` which allows keeping a test simple. +- **Robustness**: Test relies on `EditorManager.open` to resolve when a widget is revealed. + +```js +// @ts-check +describe('Editors', function () { + + const { assert } = chai; + + const { EditorManager } = require('@theia/editor/lib/browser/editor-manager'); + const Uri = require('@theia/core/lib/common/uri'); + const { WorkspaceService } = require('@theia/workspace/lib/browser/workspace-service'); + + /** @type {import('inversify').Container} */ + const container = window['theia'].container; + const editorManager = container.get(EditorManager); + const workspaceService = container.get(WorkspaceService); + + before(() => editorManager.closeAll({ save: false }); + + it('open', async () => { + const root = (await workspaceService.roots)[0]; + assert.equal(editorManager.all.length, 0); + await editorManager.open(new Uri.default(root.uri).resolve('package.json'), { + mode: 'reveal' + }); + assert.equal(editorManager.all.length, 1); + }); + +}); +``` + +The framework ensures that tests are executed +only when the application is ready, workspace is initialized and all preferences are loaded. + +Since tests are executed within the same process, +each test suite should take care to bring the application in the proper state. +For instance, an example test awaits when all editors are closed before testing the open function. + +## Running tests + +> See [theia CLI docs](../dev-packages/cli/README.md#testing) to learn more about how to use `test` command. + +Commands below should be executed from `examples/browser`. + +To run tests once: + + npm run test + +This command starts the browser example application and runs tests from `examples/api-tests` against it. + +### Inspecting tests + +To inspect tests: + + npm run test:debug + +This command runs tests but as well +opens the Chrome devtools that you can debug the frontend code and test files. +After doing changes to source code or tests, reload the page to run new code and tests. + +> Important! Since tests are relying on focus while running tests keep the page focused. + +To inspect tests and backend code: + + npm run test:debug --inspect + +Use the debug view to attach to the backend server for debugging as usual. + +### Running a single test + +Modify a test case to use `it.only` instead of `it` and reload the page. +One can also add `?grep=foo` query to the page URL to run only matching tests. diff --git a/doc/changelogs/CHANGELOG-2018.md b/doc/changelogs/CHANGELOG-2018.md new file mode 100644 index 0000000..32c0f8d --- /dev/null +++ b/doc/changelogs/CHANGELOG-2018.md @@ -0,0 +1,150 @@ +# Changelog 2018 + +## v0.3.18 - 20/12/2018 + +- [core] added a preference to define how to handle application exit +- [core] added a way to prevent application exit from extensions +- [core] added functionality to prevent application exit if some editors are dirty +- [core] allowed the ability to scope bindings per connection +- [core] fixed `@theia/core/lib/node/debug#DEBUG_MODE` flag to correctly detect when the runtime is inspected/debugged +- [cpp] fixed clangd being prematurely started when a build config is active +- [electron] implemented HTTP-based authentication for Git +- [electron] updated Electron to `^2.0.14` +- [electron] updated Git for Electron to fall back to embedded Git if no Git is found on the `PATH` +- [file-search] added ability to search files from multiple-root workspaces +- [file-search] improved handling when attempting to open non-existent files from the `quick-open-file` +- [filesystem] added the ability to convert URIs to platform specific paths +- [git] updated Git view to display short hash when on detached state +- [java-debug] added major enhancements to `java-debug` +- [keybinding] normalized key sequences to US layout +- [languages] added a preference for every language contribution to be able to trace the communication client <-> server +- [languages] allowed the ability to provide Language Server start options +- [languages] fixed leaking language clients +- [languages][java] reuse `jdt.ls` workspace +- [monaco] fixed keybindings on OSX +- [plug-in] added Plug-in API for language server contributions +- [plug-in] added `storagePath` Plug-in API +- [plug-in] added `tasks.registerTaskProvider` Plug-in API +- [plug-in] added `window.withProgress` Plug-in API +- [plug-in] added ability to register keybindings from a Plug-in's `package.json` +- [plug-in] added open link command +- [plug-in] added support for context menus in contributed views +- [plug-in] implemented API to get workspace folder by a given file URI +- [plug-in][languages] added ability to register a document highlight provider +- [search-in-workspace] added ability to perform 'Find in Folder...' with multiple folders simultaneously +- [search-in-workspace] added match and file count to search-in-workspace +- [search-in-workspace] added support for multiple-root workspaces +- [search-in-workspace] fixed path issues by instead using URIs +- [terminal] added ability to choose terminal root location when a workspace contains multiple roots +- [workspace] fixed long label computations for multiple-root workspaces +- [xterm] updated Xterm to `3.9.1` + +## v0.3.17 - 29/11/2018 + +- Added better widget error handling for different use cases (ex: no workspace present, no repository present, ...) +- Addressed multiple backend memory leaks +- Prefixed quick-open commands for easier categorization and searching +- Refactored `Task` menu items into the new `Terminal` menu +- [core] added `theia.applicationName` to application `package.json` and improved window title +- [core] added graceful handling of init and re-connection errors +- [core] added the keybinding `ctrl+alt+a` and `ctrl+alt+d` to switch tabs left/right +- [core] added the menu item `Find Command...` to easily trigger quick-open commands +- [core] added toolbar support for tab-bars +- [core] updated the status-bar display when offline +- [cpp] updated the keybinding for `Switch Header/Source` from `Option+o` to `Option+Command+o` when on macOS +- [debug] added the ability to fork a debug adapter +- [debug] added the ability to trace the debug adapter communication +- [debug] implemented major frontend and backend debug improvements +- [electron] miscellaneous stability and usability improvements on Electron +- [getting-started] added `Getting Started Widget` - used to view common commands, recent workspaces, and helpful links +- [lsp] added new symbol types and increased existing workspace symbol resilience +- [lsp] registered 'Restart' commands for each language server started for miscellaneous purposes +- [markers] added the context menu item `Collapse All` for problem markers +- [mini-browser] miscellaneous mini-browser improvements +- [plug-in] added Plug-in API to communicate between Theia and plugins +- [plug-in] added `languages.registerCodeLensProvider` Plug-in API +- [plug-in] added `languages.registerDocumentSymbolProvider` Plug-in API +- [plug-in] added `window.showTextDocument` Plug-in API +- [plug-in] added ability to provide custom namespaces for the Plug-in API +- [plug-in] registered a type definition provider +- [plug-in] added `tasks.registerTaskProvider` Plug-in API +- [preview-editor] added the ability to open editors in preview mode +- [process] added the ability to create new node processes through forking +- [search-in-workspace] prompted users when performing `Replace All...` to limit accidental triggering +- [search-in-workspace] fixed issue when selecting a file, the command `Find in Folder...` searches from the node's closest parent +- [terminal] added the menu item and command `Split Terminal` +- [workspace] added the ability to open multiple files simultaneously from the file navigator +- [workspace] added the context menu item `Collapse All` for the file navigator +- [workspace] included workspace path as part of the URL fragment + +## v0.3.16 - 25/10/2018 + +- Reverted [cpp] Add debugging for C/C++ programs. This feature will come back in its own cpp-specific repo +- [callhierarchy][typescript] adapt to hierarchical document symbols +- [core] added methods to un-register menus, commands and keybindings +- [debug] decoupled debug model from UI + clean up +- [markers] added ability to remove markers +- [output] added a button to clear output view +- [plug-in] Terminal.sendText API adds a new line to the text being sent to the terminal if `addNewLine` parameter wasn't specified +- [plug-in] added `DocumentLinkProvider` Plug-in API +- [terminal] added 'open in terminal' to navigator +- [windows] implemented drives selector for the file dialog + +## v0.3.15 - 27/09/2018 + +- [cpp] added debugging for C/C++ programs +- [debug] added debug toolbar +- [debug] resolved variables in configurations +- [debug] updated debug session views to act like panels +- [keymaps] added new `View Keybindings Widget` - used to view search and edit keybindings +- [languages] added TCL grammar file +- [plug-in] added `menus` contribution point +- [workspace] added multi-root workspace support with vscode compatibility + +## v0.3.13 - 30/08/2018 + +- Re-implemented additional widgets using React +- Re-implemented miscellaneous components using React +- [cpp] added a status bar button to select an active cpp build configuration +- [cpp] implemented watch changes to compile_commands.json +- [git/blame] added support for convert to toggle command +- [markers] fixed #2315: fine grain marker tree computation +- [markers] improved performance by no longer storing markers in browser local storage by default +- [terminal] updated to xterm.js 3.5.0 +- [textmate] added C/C++, Java, Python, CSS, html, less, markdown, shell, xml, yaml +- [tree] improved performance by not rendering collapsed nodes +- [ts] added support for one ls for all JavaScript related languages +- [workspace] added support for recently opened workspaces history + +## v0.3.12 - 28/06/2018 + +- New Plugin system ! + - See [design](https://github.com/theia-ide/theia/issues/1482) and [documentation](https://github.com/theia-ide/theia/blob/master/packages/plugin/API.md) for more details. +- Introducing [Task API](https://github.com/theia-ide/theia/pull/2086). + - Note, the format of tasks.json has been changed. For details, see the Task extension's [README.md](https://github.com/theia-ide/theia/blob/master/packages/task/README.md). +- Added an UI when developing plugins +- Migrated widgets to `react` +- Theia alerts you when the opening of a new tab is denied by the browser +- [core] added quick option to toggle the autosave feature +- [filesystem] added `File Download` feature +- [git] `git commit` now alerts the user if no files are staged +- [git] fixed `git` unstaging feature +- [languages] added textmate syntax coloring support (works on `.ts` files for now until more grammars are registered) +- [search-in-workspace] added new command `Search In Folder...` +- [search-in-workspace] added the missing `Search` menu item +- [workspace] fixed issue to prevent workspace root from being be deleted +- `.md` files that are edited in `diff` mode now correctly open with the editor +- `HTML` files now open in the editor by default + +## v0.3.11 - 06/06/2018 + +- Added search and replace widget +- Added the ability to delete files on OSX with cmd+backspace +- Added the ability to set more finely grained logger levels +- Fixed several memory leaks. +- [editor] changed the font in the editor +- [editor] fixed the capital `R` key (shift + r) not working in the editor +- [file-search] added support for search in hidden files +- [git] added `git sync` and `git publish` actions +- [navigator] added the ability to toggle hidden files in the navigator +- `jdt.ls` download on postinstall diff --git a/doc/changelogs/CHANGELOG-2019.md b/doc/changelogs/CHANGELOG-2019.md new file mode 100644 index 0000000..63aedf3 --- /dev/null +++ b/doc/changelogs/CHANGELOG-2019.md @@ -0,0 +1,879 @@ +# Changelog 2019 + +## v0.14.0 - 19/12/2019 + +- [application-manager] removed unnecessary `bunyan` dependency [#6651](https://github.com/eclipse-theia/theia/pull/6651) +- [bunyan] removed [`@theia/bunyan`](https://github.com/eclipse-theia/theia/tree/b92a5673de1e9d1bdc85e6200486b92394200579/packages/bunyan) extension [#6651](https://github.com/eclipse-theia/theia/pull/6651) +- [core] added handling preventing scrolling when closing dialogs [#6674](https://github.com/eclipse-theia/theia/pull/6674) +- [core] fixed `noWrapInfo` classname in applications with a subset of extensions [#6593](https://github.com/eclipse-theia/theia/pull/6593) +- [core] fixed infinite recursion when the tree root is refreshed [#6679](https://github.com/eclipse-theia/theia/pull/6679) +- [core] fixed the dispatching of keybindings when editing composition texts [#6673](https://github.com/eclipse-theia/theia/pull/6673) +- [core] removed unnecessary `@types/bunyan` dependency [#6651](https://github.com/eclipse-theia/theia/pull/6651) +- [core] updated `Close Editor` keybinding [#6635](https://github.com/eclipse-theia/theia/pull/6635) +- [core] updated `Close Window` keybinding [#6635](https://github.com/eclipse-theia/theia/pull/6635) +- [core] updated `noopener` when opening windows to avoid sharing event loops [#6683](https://github.com/eclipse-theia/theia/pull/6683) +- [core] updated handling of parting keybindings based on current context [#6752](https://github.com/eclipse-theia/theia/pull/6752) +- [core] updated the `Close All` keychord when running in Electron [#6703](https://github.com/eclipse-theia/theia/pull/6703) +- [electron] added support to explicitly close the socket when calling `onStop` [#6681](https://github.com/eclipse-theia/theia/pull/6681) +- [electron] updated menu to explicitly use application name [#6726](https://github.com/eclipse-theia/theia/pull/6726) +- [filesystem] fixed external URIs of map editor icons [#6664](https://github.com/eclipse-theia/theia/pull/6664) +- [languages] updated keybinding for `Open File` [#6690](https://github.com/eclipse-theia/theia/pull/6690) +- [messages] added tooltip to notifications statusbar item [#6766](https://github.com/eclipse-theia/theia/pull/6766) +- [messages] fixed timeout issue for notifications without actions [#6708](https://github.com/eclipse-theia/theia/pull/7086) +- [navigator] fixed eagerly load of model root before the workspace service is ready [#6679](https://github.com/eclipse-theia/theia/pull/6679) +- [plugin] added implementation to get the default shell for hosted plugins [#6657](https://github.com/eclipse-theia/theia/pull/6657) +- [plugin] added miscellaneous updates to support VS Code emacs extension [#6625](https://github.com/eclipse-theia/theia/pull/6625) +- [plugin] added miscellaneous updates to support VS Code vim extension [#6687](https://github.com/eclipse-theia/theia/pull/6687) +- [plugin] added support for allow-forms [#6695](https://github.com/eclipse-theia/theia/pull/6695) +- [plugin] added support to install VS Code extension packs [#6682](https://github.com/eclipse-theia/theia/pull/6682) +- [plugin] fixed `TaskExecution` instantiation [#6533](https://github.com/eclipse-theia/theia/pull/6533) +- [task] added prompt asking users to terminate or restart active tasks [#6668](https://github.com/eclipse-theia/theia/pull/6668) +- [task] added support for `TaskIdentifier` [#6680](https://github.com/eclipse-theia/theia/pull/6680) +- [task] added support for background tasks [#6680](https://github.com/eclipse-theia/theia/pull/6680) +- [task] added support for compound tasks [#6680](https://github.com/eclipse-theia/theia/pull/6680) +- [task] added support for tasks of detected tasks which have the same label, and different scopes in a multi-root workspace [#6718](https://github.com/eclipse-theia/theia/pull/6718) +- [task] fixed bug where custom tasks schemas were not properly updated [#6643](https://github.com/eclipse-theia/theia/pull/6643) +- [task] fixed circular dependencies [#6756](https://github.com/eclipse-theia/theia/pull/6756) +- [terminal] added mapping of localhost links to proper external links [#6663](https://github.com/eclipse-theia/theia/pull/6663) +- [workspace] updated `New File` keybinding [#6635](https://github.com/eclipse-theia/theia/pull/6635) +- [workspace] updated keybinding for `Open Workspace` [#6690](https://github.com/eclipse-theia/theia/pull/6690) + +Breaking changes: + +- [core] updated browser windows spawned through the opener-service to have `noopener` set which ultimately preventing them from accessing `window.opener`. `openNewWindow` will no longer return a Window as a result [#6683](https://github.com/eclipse-theia/theia/pull/6683) +- [debug] renamed command `COPY_VARAIBLE_AS_EXPRESSION` to `COPY_VARIABLE_AS_EXPRESSION` [#6698](https://github.com/eclipse-theia/theia/pull/6698) +- [debug] renamed command `COPY_VARAIBLE_VALUE` to `COPY_VARIABLE_VALUE` [#6698](https://github.com/eclipse-theia/theia/pull/6698) +- [debug] renamed getter method `multiSesssion` to `multiSession` [#6698](https://github.com/eclipse-theia/theia/pull/6698) +- [task] added `taskDefinitionRegistry` and `taskSourceResolver` to the constructor of `TaskRunQuickOpenItem` and `ConfigureBuildOrTestTaskQuickOpenItem` [#6718](https://github.com/eclipse-theia/theia/pull/6718) +- [task] changed the data structure of `ProvidedTaskConfigurations.tasksMap` [#6718](https://github.com/eclipse-theia/theia/pull/6718) +- [terminal] renamed `TerminalCopyOnSelectionHander` to `TerminalCopyOnSelectionHandler` [#6692](https://github.com/eclipse-theia/theia/pull/6692) + +## v0.13.0 - 28/11/2019 + +- [console] added filtering support based on severity [#6486](https://github.com/eclipse-theia/theia/pull/6486) +- [core] added functionality so that label providers can now notify that element labels and icons may have changed and should be refreshed [#5884](https://github.com/theia-ide/theia/pull/5884) +- [core] added functionality to expose all handlers for a given command [#6599](https://github.com/eclipse-theia/theia/pull/6599) +- [core] aligned `Open Preferences` and `Save As` keybindings with VS Code on Mac OS [#6620](https://github.com/eclipse-theia/theia/pull/6620) +- [core] fixed the display of toolbar item icons [#6514](https://github.com/eclipse-theia/theia/pull/6514) +- [core] switched the frontend application's shutdown hook from `window.unload` to `window.beforeunload`. [#6530](https://github.com/eclipse-theia/theia/issues/6530) +- [core] updated dependency injection cycle between `LabelProvider` and its contributions [#6608](https://github.com/eclipse-theia/theia/pull/6608) +- [core] updated handling when access is denied to the clipboard [#6516](https://github.com/eclipse-theia/theia/pull/6516) +- [core] updated scrolling of widgets when re-setting their focus [#6621](https://github.com/eclipse-theia/theia/pull/6621) +- [core] upgraded `reconnecting-websocket` to latest version [#6512](https://github.com/eclipse-theia/theia/pull/6512) +- [core] aligned `New File`, `Close Editor` and `Close Window` keybindings with VS Code across OSes [#6635](https://github.com/eclipse-theia/theia/pull/6635) +- [cpp] moved the `cpp` extension to the [`theia-cpp-extensions`](https://github.com/eclipse-theia/theia-cpp-extensions) repo [#6505](https://github.com/eclipse-theia/theia/pull/6505) +- [debug] added ability to re-use the terminal based on label and caption [#6619](https://github.com/eclipse-theia/theia/pull/6619) +- [debug] added reloading of child variable nodes on `setValue` call [#6555](https://github.com/eclipse-theia/theia/pull/6555) +- [debug] fixed breakpoint context menu behavior [#6480](https://github.com/eclipse-theia/theia/pull/6480) +- [debug] generalized the `allThreadStop` event [#6627](https://github.com/eclipse-theia/theia/pull/6627) +- [dockerfile] removed example dockerfile [#6586](https://github.com/eclipse-theia/theia/pull/6585) +- [documentation] updated 'outline-view' extension documentation [#6454](https://github.com/eclipse-theia/theia/pull/6454) +- [documentation] updated package name for libX11 for Red Hat based OS [#6632](https://github.com/eclipse-theia/theia/pull/6632) +- [editor-preview] removed unnecessary dependency to the `navigator` extension [#6648](https://github.com/eclipse-theia/theia/pull/6648) +- [editorconfig] updated trim whitespace to be respected during manual saving [#6417](https://github.com/eclipse-theia/theia/pull/6417) +- [electron] updated error logging of the rebuild [#6538](https://github.com/eclipse-theia/theia/pull/6538) +- [git] added support for `alwaysSignOff` [#6402](https://github.com/eclipse-theia/theia/pull/6402) +- [git] updated `dugite-extra` dependency [#6602](https://github.com/eclipse-theia/theia/pull/6602) +- [git] updated `find-git-exec` dependency [#6602](https://github.com/eclipse-theia/theia/pull/6602) +- [json] moved JSON grammar to the `textmate-grammars` extension [#6622](https://github.com/eclipse-theia/theia/pull/6622) +- [keymaps] removed the display of internal commands from the widget [#6594](https://github.com/eclipse-theia/theia/pull/6594) +- [monaco] added mappings from VS Code commands to internal commands [#5590](https://github.com/eclipse-theia/theia/pull/5590) +- [monaco] fixed incorrect command palette cursor position [#6435](https://github.com/eclipse-theia/theia/pull/6435) +- [monaco] fixed registration of `CodeActionProviders` [#6556](https://github.com/eclipse-theia/theia/pull/6556) +- [plugin-metrics] introduced the `plugin-metrics` extension [#6303](https://github.com/eclipse-theia/theia/pull/6303) +- [plugin] added ability to use upload services [#6554](https://github.com/eclipse-theia/theia/pull/6554) +- [plugin] added functionality to restart hosted instance if restart is called before start [#6521](https://github.com/eclipse-theia/theia/pull/6521) +- [plugin] fixed `executeCommand` argument passing [#6537](https://github.com/eclipse-theia/theia/pull/6537) +- [plugin] fixed bad type conversion with code actions [#6559](https://github.com/eclipse-theia/theia/pull/6559) +- [plugin] removed unnecessary dependency to the `mini-browser` extension [#6644](https://github.com/eclipse-theia/theia/pull/6644) +- [plugin]added ability to configure borders in the quick pick items list [#6487](https://github.com/eclipse-theia/theia/pull/6487) +- [preferences] added better handling for schema changed events [#6510](https://github.com/eclipse-theia/theia/pull/6510) +- [process] added handling for `onClose` event [#6595](https://github.com/eclipse-theia/theia/pull/6595) +- [process] updated process spawning to use defaults [#6561](https://github.com/eclipse-theia/theia/pull/6561) +- [scm] added handling when opening diff-editors to respect preference `workbench.list.openMode` [#6481](https://github.com/eclipse-theia/theia/pull/6481) +- [scm] added support to open `diff-editors` with a single-click [#6481](https://github.com/eclipse-theia/theia/pull/6481) +- [search-in-workspace] updated decorations when clearing search [#6511](https://github.com/eclipse-theia/theia/pull/6511) +- [search-in-workspace] updated resizing of results [#6576](https://github.com/eclipse-theia/theia/pull/6576) +- [task] added ability to add task sub-schemas [#6566](https://github.com/eclipse-theia/theia/pull/6566) +- [task] added ability to create `launch.json` automatically [#6490](https://github.com/eclipse-theia/theia/pull/6490) +- [task] added handling for invalid task configurations [#6515](https://github.com/eclipse-theia/theia/pull/6515) +- [task] added prompt to users to configure tasks [#6539](https://github.com/eclipse-theia/theia/pull/6539) +- [task] added support for `group` in the task config [#6522](https://github.com/eclipse-theia/theia/pull/6522) +- [task] added support for creating `tasks.json` from templates [#6391](https://github.com/eclipse-theia/theia/pull/6391) +- [task] added support for multiple user-defined problem matchers in the `tasks.json` [#6616](https://github.com/eclipse-theia/theia/pull/6616) +- [task] added support for task types in the tasks schema [#6483](https://github.com/eclipse-theia/theia/pull/6483) +- [task] updated task schemas for extensions and plugins [#6492](https://github.com/eclipse-theia/theia/pull/6492) +- [terminal] added implementation to copy text on selection [#6536](https://github.com/eclipse-theia/theia/pull/6536) +- [terminal] added support for integrated terminals [#6508](https://github.com/eclipse-theia/theia/pull/6508) +- [workspace] added path when creating a new file [#6545](https://github.com/eclipse-theia/theia/pull/6545) +- [workspace] added path when creating a new folder [#6545](https://github.com/eclipse-theia/theia/pull/6545) + +Breaking changes: + +- [core] renamed preference `list.openMode` to `workbench.list.openMode` [#6481](https://github.com/eclipse-theia/theia/pull/6481) +- [monaco] removed monaco prefix from commands [#5590](https://github.com/eclipse-theia/theia/pull/5590) +- [plugin] re-implemented webviews to align with [VS Code browser implementation](https://blog.mattbierner.com/vscode-webview-web-learnings/) [#6465](https://github.com/eclipse-theia/theia/pull/6465) + - Security: `vscode.previewHTML` is removed, see + - Security: Before all webviews were deployed on [the same origin](https://developer.mozilla.org/en-US/docs/Web/Security/Same-origin_policy) + allowing them to break out and manipulate shared data as cookies, local storage or even start service workers + for the main window as well as for each other. Now each webview will be deployed on own origin by default. + - Webview origin pattern can be configured with `THEIA_WEBVIEW_EXTERNAL_ENDPOINT` env variable. The default value is `{{uuid}}.webview.{{hostname}}`. + Here `{{uuid}}` and `{{hostname}}` are placeholders which get replaced at runtime with proper webview uuid + and [hostname](https://developer.mozilla.org/en-US/docs/Web/API/HTMLHyperlinkElementUtils/hostname) correspondingly. + - To switch to un-secure mode as before configure `THEIA_WEBVIEW_EXTERNAL_ENDPOINT` with `{{hostname}}` as a value. + You can also drop `{{uuid}}.` prefix, in this case, webviews still will be able to access each other but not the main window. + - Remote: Local URIs are resolved by default to the host serving Theia. + If you want to resolve to another host or change how remote URIs are constructed then + implement [ExternalUriService.resolve](./packages/core/src/browser/external-uri-service.ts) in a frontend module. + - Content loading: Webview HTTP endpoint is removed. Content loaded via [WebviewResourceLoader](./packages/plugin-ext/src/main/common/webview-protocol.ts) JSON-RPC service + with properly preserved resource URIs. Content is only loaded if it's allowed by WebviewOptions.localResourceRoots, otherwise, the service won't be called. + If you want to customize content loading then implement [WebviewResourceLoaderImpl](packages/plugin-ext/src/main/node/webview-resource-loader-impl.ts) in a backend module. + - Theming: Theia styles are not applied to webviews anymore + instead [VS Code way of styling](https://code.visualstudio.com/api/extension-guides/webview#theming-webview-content) should be used. + VS Code color variables also available with `--theia` prefix. + - Testing: Webview can work only in secure context because they rely on service workers to load local content and redirect local to remote requests. + Most browsers define a page as served from secure context if its url has `https` scheme. For local testing `localhost` is treated as a secure context as well. + Unfortunately, it does not work nicely in FireFox, since it does not treat subdomains of localhost as secure as well, compare to Chrome. + If you want to test with FireFox you can configure it as described [here](https://github.com/eclipse-theia/theia/pull/6465#issuecomment-556443218). +- [task] updated `TaskSchemaUpdater.update()` from asynchronous to synchronous [#6483](https://github.com/eclipse-theia/theia/pull/6483) + +## v0.12.0 - 31/10/2019 + +- [cli] added explicit `yargs` dependency [#6443](https://github.com/eclipse-theia/theia/pull/6443) +- [cli] enabled static compression of build artifacts [#6266](https://github.com/eclipse-theia/theia/pull/6266) + - to disable pass `--no-static-compression` to `theia build` or `theia watch` +- [core] fixed handling of URI#`getAllLocation` for paths without parents [#6378](https://github.com/eclipse-theia/theia/pull/6378) +- [core] fixed issue allowing valid properties to be registered despite schemas containing issues [#6341](https://github.com/eclipse-theia/theia/pull/6341) +- [core] updated quick-open menus to not perform validation when first opened [#6281](https://github.com/eclipse-theia/theia/pull/6281) +- [cpp] fixed task labels [#6419](https://github.com/eclipse-theia/theia/pull/6419) +- [cpp] fixed the execution of tasks [#6419](https://github.com/eclipse-theia/theia/pull/6419) +- [cpp] improved the installation documentation for `clangd` [#6271](https://github.com/eclipse-theia/theia/pull/6271) +- [cpp] updated overall documentation of the C/C++ extension [#6364](https://github.com/eclipse-theia/theia/pull/6364) +- [debug] added support for `preLaunchTask` and `postDebugTask` [#6247](https://github.com/eclipse-theia/theia/pull/6247) +- [electron] added option to only allow single instances of an Electron application [#6280](https://github.com/eclipse-theia/theia/pull/6280) +- [electron] fixed `confirmExit` for Electron applications [#6285](https://github.com/eclipse-theia/theia/pull/6285) +- [electron] fixed lossy storage in Electron [#6313](https://github.com/eclipse-theia/theia/pull/6313) +- [electron] upgraded Electron to version 4 [#6307](https://github.com/eclipse-theia/theia/pull/6307) +- [filesystem] fixed error handling of `nsfw` RENAMED events [#6283](https://github.com/eclipse-theia/theia/pull/6283) +- [git] added support for amending initial commits [#5451](https://github.com/eclipse-theia/theia/pull/5451) +- [git] improved git watchers to ensure they do not leak [#6352](https://github.com/eclipse-theia/theia/pull/6352) +- [json] provided empty `initializationOptions` for the JSON language server [#6398](https://github.com/eclipse-theia/theia/pull/6398) +- [keymaps] updated overall documentation of the keymaps extension [#6369](https://github.com/eclipse-theia/theia/pull/6369) +- [messages] added logic hiding the notification center when the last notification is removed [#6356](https://github.com/eclipse-theia/theia/pull/6356) +- [messages] aligned default message with VS Code [#6345](https://github.com/eclipse-theia/theia/pull/6345) +- [mini-browser] updated mini-browser to open without URL encoding [#6388](https://github.com/eclipse-theia/theia/pull/6388) +- [monaco] fixed command execution for inline editors [#6328](https://github.com/eclipse-theia/theia/pull/6328) +- [monaco] fixed incorrect preference initialization [#6450](https://github.com/eclipse-theia/theia/pull/6450) +- [monaco] rebinded keybinding for 'Go to Definition' [#6411](https://github.com/eclipse-theia/theia/pull/6411) +- [plugin] improved tree views: [#6342](https://github.com/eclipse-theia/theia/pull/6342) + - added logic to not execute commands on selection change + - added better handling of `undefined` 'treeItem.label' + - added better styling support for item actions + - added better support for descriptions + - fixed styling issues +- [plugin-ext] added `OutputChannelRegistry` interface and add it into the rpc [#6413](https://github.com/eclipse-theia/theia/pull/6413) +- [plugin-ext] added configuration attribute to `DebugSession` [#6382](https://github.com/eclipse-theia/theia/pull/6382) +- [plugin-ext] added logic to pass `pluginInfo` through the output channel append method [#6312](https://github.com/eclipse-theia/theia/pull/6312) +- [plugin-ext] added support for `globalStoragePath` Plug-in API [#6354](https://github.com/eclipse-theia/theia/pull/6354) +- [plugin-ext] added support for `vscode.executeDocumentSymbol` Plug-in API [#6291](https://github.com/eclipse-theia/theia/pull/6291) +- [plugin-ext] added the ability to use HTTP resources for tab title icons [#6270](https://github.com/eclipse-theia/theia/pull6270) +- [plugin-ext] added the disposal of webviews by handle and not widget ID [#6326](https://github.com/eclipse-theia/theia/pull/6326) +- [plugin-ext] fixed `WorkspaceEdit` conversion [#6304](https://github.com/eclipse-theia/theia/pull/6304) +- [plugin-ext] fixed `cancellable` option for `withProgress` notifications [#6365](https://github.com/eclipse-theia/theia/pull/6365) +- [plugin-ext] fixed broken 'html base href' logic in webviews [#6279](https://github.com/eclipse-theia/theia/pull/6279) +- [plugin-ext] fixed incorrect type conversion for language server types [#6351](https://github.com/eclipse-theia/theia/pull/6351) +- [plugin-ext] fixed issue where document listening started before all clients were ready [#6321](https://github.com/eclipse-theia/theia/pull/6321) +- [plugin-ext] improved error message when a plugin node crashes [#6293](https://github.com/eclipse-theia/theia/pull/6293) +- [plugin-ext] improved plugins crash error to be dependent on error type [#6335](https://github.com/eclipse-theia/theia/pull/6335) +- [plugin-ext] initialized extension storage proxy earlier avoiding sending events to the plugin manager before it is ready [#6323](https://github.com/eclipse-theia/theia/pull/6323) +- [plugin] fixed unnecessary return type of the `$executeCommand` which wrapped a Promise in another Promise [#6290](https://github.com/eclipse-theia/theia/pull/6290) +- [preferences] updated preferences widget so it can be rebinded [#6397](https://github.com/eclipse-theia/theia/pull/6397) +- [preview] fixed the resolution of relative links in markdowns [#6403](https://github.com/eclipse-theia/theia/pull/6403) +- [scm] fixed default selected SCM nodes [#6426](https://github.com/eclipse-theia/theia/pull/6426) +- [task] added content assist for input variables in tasks [#6334](https://github.com/eclipse-theia/theia/pull/6334) +- [task] added registered problem matchers to the tasks schema [#6422](https://github.com/eclipse-theia/theia/pull/6422) +- [task] added support for input variables in tasks [#6331](https://github.com/eclipse-theia/theia/pull/6331) +- [task] added the ability to access task configurations as preferences [#6268](https://github.com/eclipse-theia/theia/pull/6268) +- [terminal] added preference to control default rendering option for terminals [#6471](https://github.com/eclipse-theia/theia/pull/6471) +- [terminal] fixed the hover tooltip to always be displayed above the canvas [#6318](https://github.com/eclipse-theia/theia/pull/6318) +- [textmate-grammars] added better language support for `js`, `ts` and `jsx` files [#5976](https://github.com/eclipse-theia/theia/pull/5976) +- [workspace] deprecated `getDefaultWorkspacePath` on the `WorkspaceService` as the method name was misleading. Use `getDefaultWorkspaceUri` instead [#6432](https://github.com/eclipse-theia/theia/issues/6432) + +Breaking changes: + +- [core | monaco | task] aligned `ActionProvider` related entities with VS Code [6302](https://github.com/eclipse-theia/theia/pull/6302) +- [plugin] added handling to not block web socket with many plugins [6252](https://github.com/eclipse-theia/theia/pull/6252) + - `PluginModel` does not have anymore `contributes` and `dependencies` to avoid sending unnecessary data + - use `PluginReader.readContribution` to load contributes + - use `PluginReader.readDependencies` to load dependencies + - `PluginMetadata` does not have anymore raw package.json model to avoid sending excessive data to the frontend + - `theia.Plugin.packageJSON` throws an unsupported error for frontend plugins as a consequence. Please convert to a backend plugin if you need access to it + - `PluginManagerExt.$init` does not start plugins anymore, but only initialize the manager RPC services to avoid sending excessive initialization data, as all preferences, on each deployment + - please call `$start` to start plugins + - `PluginDeployerHandler.getPluginMetadata` is replaced with `PluginDeployerHandler.getPluginDependencies` to access plugin dependencies + - `HostedPluginServer.getDeployedMetadata` is replaced with `HostedPluginServer.getDeployedPluginIds` and `HostedPluginServer.getDeployedPlugins` to fetch first only ids of deployed plugins and then deployed metadata for only yet not loaded plugins + - `HostedPluginDeployerHandler.getDeployedFrontendMetadata` and `HostedPluginDeployerHandler.getDeployedBackendMetadata` are replaced with `HostedPluginDeployerHandler.getDeployedFrontendPluginIds`, `HostedPluginDeployerHandlergetDeployedBackendPluginIds` and `HostedPluginDeployerHandler.getDeployedPlugin` to fetch first only ids and then deployed metadata fro only yet not loaded plugins + - `PluginHost.init` can initialize plugins asynchronous, synchronous initialization is still supported + - `HostedPluginReader.doGetPluginMetadata` is renamed to `HostedPluginReader.getPluginMetadata` + - `PluginDebugAdapterContribution.languages`, `PluginDebugAdapterContribution.getSchemaAttributes` and `PluginDebugAdapterContribution.getConfigurationSnippets` are removed to prevent sending the contributions second time to the frontend. Debug contributions are loaded statically from the deployed plugin metadata instead. The same for corresponding methods in `DebugExtImpl` +- [task] removed `watchedConfigFileUris`, `watchersMap` `watcherServer`, `fileSystem`, `configFileUris`, `watchConfigurationFile()` and `unwatchConfigurationFile()` from `TaskConfigurations` class [6268](https://github.com/eclipse-theia/theia/pull/6268) +- [task] removed `configurationFileFound` from `TaskService` class. [6268](https://github.com/eclipse-theia/theia/pull/6268) + +## v0.11.0 - 29/09/2019 + +- [core] added ENTER event handler to the open button in explorer [#6158](https://github.com/eclipse-theia/theia/pull/6158) +- [core] added firing of JSON schema changed events if an underlying in-memory resource is changed [#6035](https://github.com/eclipse-theia/theia/pull/6035) +- [core] added clipboard plugin API [#5994](https://github.com/eclipse-theia/theia/pull/5994) +- [core] added command and toolbar item to disable auto sync [#5986](https://github.com/eclipse-theia/theia/pull/5986) +- [core] added handling to only update the menu if the frontend is ready [#5140](https://github.com/eclipse-theia/theia/pull/5140) +- [core] added handling to reject invalid preference schemas [#6110](https://github.com/eclipse-theia/theia/pull/6110) +- [core] added schema check to statically typed APIs [#6090](https://github.com/eclipse-theia/theia/pull/6090) +- [core] added the passing of the current widget to react tabbar toolbar items [#6220](https://github.com/eclipse-theia/theia/pull/6220) +- [core] added visual feedback to clicked toolbar items [#6099](https://github.com/eclipse-theia/theia/pull/6099) +- [core] extracted the top-panel removal into it's own method for extensibility [#6261](https://github.com/eclipse-theia/theia/pull/6261) +- [core] fixed the command palette filter to accept leading whitespaces [#6225](https://github.com/eclipse-theia/theia/pull/6225) +- [core] fixed webview theme styles [#6155](https://github.com/eclipse-theia/theia/pull/6155) +- [core] improved application initialization performance [#6172](https://github.com/eclipse-theia/theia/pull/6172) +- [core] improved warning message for 'potential memory leak' [#6173](https://github.com/eclipse-theia/theia/pull/6173) +- [core] optimized tabbar decorations rendering [#6044](https://github.com/eclipse-theia/theia/pull/6044) +- [core] added handling to prevent the default browser drag-and-drop behavior when dragging a file from the filesystem into the application [#6188](https://github.com/eclipse-theia/theia/pull/6188) +- [core] updated inversify to 5.0.1 [#6184](https://github.com/eclipse-theia/theia/pull/6184) +- [core] updated the alignment of tabbar icons for consistency [#6199](https://github.com/eclipse-theia/theia/pull/6199) +- [core] updated the display of menus to better represent the availability of menu items [#6199](https://github.com/eclipse-theia/theia/pull/6199) +- [core] updated the main area to have a default background [#6196](https://github.com/eclipse-theia/theia/pull/6196) +- [core] upgraded LSP version to 5.3.0 [#5901](https://github.com/eclipse-theia/theia/pull/5901) +- [cpp] added handling to force language client contribution restart on reconnect [#6205](https://github.com/eclipse-theia/theia/pull/6205) +- [debug] added electron backend and composite electron launch configurations [#6226](https://github.com/eclipse-theia/theia/pull/6226) +- [debug] ignored additional breakpoints returned by `setBreakpoints` request [#6044](https://github.com/eclipse-theia/theia/pull/6044) +- [docs] updated documentation on how to profile [#6087](https://github.com/eclipse-theia/theia/pull/6087) +- [docs] updated documentation to include new debug launch configurations [#6241](https://github.com/eclipse-theia/theia/pull/6241) +- [docs] updated documentations on how to debug the plugin host [#6081](https://github.com/eclipse-theia/theia/pull/6081) +- [getting-started] added ability to tab links in the getting-started widget [#6162](https://github.com/eclipse-theia/theia/pull/6162) +- [git] added better handling for attempting to perform a sign-off without the proper git config settings [#6222](https://github.com/eclipse-theia/theia/pull/6222) +- [git] fixed a bug which prevented creating branches [#6071](https://github.com/eclipse-theia/theia/pull/6071) +- [git] fixed issue to only show the list of amended commits for the correct parent [#6242](https://github.com/eclipse-theia/theia/pull/6242) +- [git] updated the git diff list to use perfect scrollbar [#6085](https://github.com/eclipse-theia/theia/pull/6085) +- [languages] added handling to avoid activation on startup if there is no other activation events [#6164](https://github.com/eclipse-theia/theia/pull/6164) +- [languages] added registration of language features even if a language is not registered [#6145](https://github.com/eclipse-theia/theia/pull/6145) +- [markers] fixed false positive tabbar decorations [#6132](https://github.com/eclipse-theia/theia/pull/6132) +- [markers] optimized problem status rendering [#6044](https://github.com/eclipse-theia/theia/pull/6044) +- [monaco] added registration of Monaco keybindings in reverse order [#6170](https://github.com/eclipse-theia/theia/pull/6170) +- [monaco] updated semantic highlighting styles and tokenization [#5941](https://github.com/eclipse-theia/theia/pull/5941) +- [monaco] upgrade Monaco version to 0.17.0 [#5901](https://github.com/eclipse-theia/theia/pull/5901) +- [plugin-dev] fixed restart instance on debug restarts [#6131](https://github.com/eclipse-theia/theia/pull/6131) +- [plugin-ext] added `onURI` as a supported activation event [#6044](https://github.com/eclipse-theia/theia/pull/6044) +- [plugin-ext] added ability to set active editor on startup [#6152](https://github.com/eclipse-theia/theia/pull/6152) +- [plugin-ext] added better mapping of dependencies to VSCode built-ins [#6207](https://github.com/eclipse-theia/theia/pull/6207) +- [plugin-ext] added handling to wait for a workspace to be ready before computing the storage paths for plugins [#6248](https://github.com/eclipse-theia/theia/pull/6248) +- [plugin-ext] added plugin ID to register commands [#6214](https://github.com/eclipse-theia/theia/pull/6214) +- [plugin-ext] added support for `contribute.keybindings` to accept objects or arrays [#6243](https://github.com/eclipse-theia/theia/pull/6243) +- [plugin-ext] added support for `vscode.extension.contributes.configuration` to be an array [#6078](https://github.com/eclipse-theia/theia/pull/6078) +- [plugin-ext] ensured that command arguments are safely passed via jsonrpc [#6044](https://github.com/eclipse-theia/theia/pull/6044) +- [plugin-ext] extracted method in PluginReader to handle missing plugin resources [#6126](https://github.com/eclipse-theia/theia/pull/6126) +- [plugin-ext] fixed SCM statusbar commands [#6236](https://github.com/eclipse-theia/theia/pull/6236) +- [plugin-ext] fixed issue where document change `rangeOffset` was not properly passed [#6044](https://github.com/eclipse-theia/theia/pull/6044) +- [plugin-ext] fixed the disposal of deploy listeners on close [#6127](https://github.com/eclipse-theia/theia/pull/6127) +- [plugin-ext] implemented SCM repository selected event [#6150](https://github.com/eclipse-theia/theia/pull/6150) +- [plugin-ext] implemented `Plugin.isActive` check [#6044](https://github.com/eclipse-theia/theia/pull/6044) +- [plugin-ext] implemented `registerDeclarationProvider` API [#6173](https://github.com/eclipse-theia/theia/pull/6173) +- [plugin-ext] implemented `vscode.env.openExternal` API [#6044](https://github.com/eclipse-theia/theia/pull/6044) +- [plugin-ext] implemented selection and visible tree view APIs [#6044](https://github.com/eclipse-theia/theia/pull/6044) +- [plugin-ext] refactored languagesMain and outputChannelRegistry to use dependency injection [#6148](https://github.com/eclipse-theia/theia/pull/6148) +- [plugin-ext] updated hidden view containers to remain hidden on startup [#6141](https://github.com/eclipse-theia/theia/pull/6141) +- [plugin-ext] updated plugin host to not crash on activation errors [#6097](https://github.com/eclipse-theia/theia/pull/6097) +- [plugin-ext] updated plugin unzipping logs to be less verbose [#6149](https://github.com/eclipse-theia/theia/pull/6149) +- [plugin] fixed issue where `withProgress` would not start task immediately [#6123](https://github.com/eclipse-theia/theia/pull/6123) +- [preferences] added handling to prevent closing preference editors with the middle mouse click [#6198](https://github.com/eclipse-theia/theia/pull/6198) +- [preferences] fixed issue where workspace configurations contributed by VSCode extensions did not take effect [#6090](https://github.com/eclipse-theia/theia/pull/6090) +- [scm] removed hover background on scm inline action buttons [#6094](https://github.com/eclipse-theia/theia/pull/6094) +- [scm] updated `scm` widget styling [#6116](https://github.com/eclipse-theia/theia/pull/6116) +- [search-in-workspace] improved the display of the search-in-workspace widget [#6199](https://github.com/eclipse-theia/theia/pull/6199) +- [search-in-workspace] updated `search-in-workspace` widget styling [#6116](https://github.com/eclipse-theia/theia/pull/6116) +- [task] added `tasks.fetchTasks()` and `tasks.executeTask()` Plug-in APIs [#6058](https://github.com/eclipse-theia/theia/pull/6058) +- [task] added ability to prompt user to choose parser to parse task output [#5877](https://github.com/eclipse-theia/theia/pull/5877) +- [textmate] updated handling to not warn if the same grammar is registered multiple times [#6125](https://github.com/eclipse-theia/theia/pull/6125) +- [vscode] added parsing view contribution `when` contexts [#6068](https://github.com/eclipse-theia/theia/pull/6068) +- [vscode] added support for active/focus view or panel `when` clause context [#6062](https://github.com/eclipse-theia/theia/pull/6062) +- [vscode] updated default vscode API version to 1.38.0 [#6112](https://github.com/eclipse-theia/theia/pull/6112) + +Breaking changes: + +- [core][monaco][plugin] added handling to reload plugins on reconnection [#6159](https://github.com/eclipse-theia/theia/pull/6159) + - Extenders should implement `Disposable` for plugin main services to handle reconnection properly + - Many APIs are refactored to return `Disposable` +- [core][plugin] added support for alternative commands in context menus [#6069](https://github.com/eclipse-theia/theia/pull/6069) +- [monaco] added support for `monaco.languages.ResourceFileEdit` [#4723](https://github.com/eclipse-theia/theia/issues/4723) +- [workspace] enable the preference `workspace.supportMultiRootWorkspace` by default [#6089](https://github.com/eclipse-theia/theia/pull/6089) + +Misc: + +This repo was moved to the `eclipse-theia` organization. Though GitHub automatically redirects from the old repo to the new one, we'll use the new one from now on in this file. + +## v0.10.0 - 29/08/2019 + +- [core] added ability to execute tasks via keybindings [#5913](https://github.com/theia-ide/theia/pull/5913) +- [core] added better handling for the `SingleTextInputDialog` `onEnter` [#5868](https://github.com/theia-ide/theia/pull/5868) +- [core] added handling for command handler errors [#5894](https://github.com/theia-ide/theia/pull/5894) +- [core] added propagation of phosphor events to view container widgets [#5817](https://github.com/theia-ide/theia/pull/5817) +- [core] added support for HTML titles for widgets in the sidebar [#5948](https://github.com/theia-ide/theia/pull/5948) +- [core] added support for path normalization [#5918](https://github.com/theia-ide/theia/pull/5918) +- [core] added the optional flag `runIfSingle` for `QuickPickOptions` [#6059](https://github.com/theia-ide/theia/pull/6059) +- [core] fixed issue where the last visible view container was not preserved [#5817](https://github.com/theia-ide/theia/pull/5817) +- [core] fixed menu bar color [#6014](https://github.com/theia-ide/theia/pull/6014) +- [core] improved `QuickInput` and `QuickInputBox` APIs [#5187](https://github.com/theia-ide/theia/pull/5187) +- [core] supported diagnostic marker in the tab bar [#5845](https://github.com/theia-ide/theia/pull/5845) +- [cpp] added support for multiple root cpp build configurations [#4603](https://github.com/theia-ide/theia/pull/4603) +- [cpp] enabled better semantic highlighting support [#5850](https://github.com/theia-ide/theia/pull/5850) +- [cpp] moved cpp grammars from the `@theia/cpp` extension to the `@theia/textmate-grammars` extension [#5803](https://github.com/theia-ide/theia/pull/5803) +- [debug] added progress indicator for the debug widget [#6009](https://github.com/theia-ide/theia/pull/6009) +- [debug] ensured that terminate flags are properly restarted [#5954](https://github.com/theia-ide/theia/pull/5954) +- [debug] fixed issue where the debug icons remain opaque after a debug session has terminated [#5933](https://github.com/theia-ide/theia/pull/5933) +- [debug] removed superfluous scrollbars [#5879](https://github.com/theia-ide/theia/pull/5879) +- [editor] added support for tab details to disambiguate identical tabs [#5775](https://github.com/theia-ide/theia/pull/5775) +- [editor] added support to re-open files with different encodings [#5371](https://github.com/theia-ide/theia/pull/5371) +- [editor] added support to set default file encoding [#5371](https://github.com/theia-ide/theia/pull/5371) +- [editor] updated editor tabbar captions for better multi-root support [#5924](https://github.com/theia-ide/theia/pull/5924) +- [file-search] improved Windows support [#6029](https://github.com/theia-ide/theia/pull/6029) +- [git] added progress indicators for scm/git operations [#5830](https://github.com/theia-ide/theia/pull/5830) +- [git] added support to initialize a workspace as a git repository [#6008](https://github.com/theia-ide/theia/pull/6008) +- [git] fixed the git-diff widget header details alignment [#5998](https://github.com/theia-ide/theia/pull/5998) +- [git] updated ls-files so it works with Git >= 2.16 [#5851](https://github.com/theia-ide/theia/pull/5851) +- [keymaps] fixed clumsy auto-suggestion dropdown [#5990](https://github.com/theia-ide/theia/pull/5990) +- [markers] added problem markers to editor tabs [#5845](https://github.com/theia-ide/theia/pull/5845) +- [markers] added the preference `problems.decorations.enabled` to control the display of problem markers in tree widgets [#6021](https://github.com/theia-ide/theia/pull/6021) +- [messages] reworked messages and added a notification center [#5830](https://github.com/theia-ide/theia/pull/5830) +- [mini-browser] added support for editor/title context menus for webviews [#6030](https://github.com/theia-ide/theia/pull/6030) +- [monaco] aligned snippet completion logic with VSCode [#5931](https://github.com/theia-ide/theia/pull/5931) +- [navigator] added support for multi-file copy [#5864](https://github.com/theia-ide/theia/pull/5864) +- [navigator] added the toolbar item `more actions...` for the explorer [#5953](https://github.com/theia-ide/theia/pull/5953) +- [navigator] added the toolbar item `refresh` to force a refresh of the explorer [#5940](https://github.com/theia-ide/theia/pull/5940) +- [outline] added `OutlineViewTreeModel` for the outline view tree widget [#5687](https://github.com/theia-ide/theia/pull/5687) +- [outline] added the toolbar item `collapse-all` for the outline widget [#5687](https://github.com/theia-ide/theia/pull/5687) +- [outline] updated the keybinding for `toggle outline view` to avoid conflict [#5707](https://github.com/theia-ide/theia/pull/5707) +- [plugin-ext] added `ignoreFocusOut` parameter support for the `QuickPick` [#5900](https://github.com/theia-ide/theia/pull/5900) +- [plugin-ext] added automatic downloading of `extensionDependencies` [#5379](https://github.com/theia-ide/theia/pull/5379) +- [plugin-ext] added support for theming webview content [#5981](https://github.com/theia-ide/theia/pull/5981) +- [plugin-ext] fixed leaking java debug process [#5281](https://github.com/theia-ide/theia/pull/5281) +- [plugin-ext] fixed plugin-ext file path error [#5929](https://github.com/theia-ide/theia/pull/5929) +- [plugin] added additional support for `QuickPick` API [#5766](https://github.com/theia-ide/theia/pull/5766) +- [plugin] added better error handling for plugins that cannot find files [#6002](https://github.com/theia-ide/theia/pull/6002) +- [plugin] added cache for command arguments to safely pass them over JSON-RPC [#5961](https://github.com/theia-ide/theia/pull/5961) +- [plugin] added view containers support [#5665](https://github.com/theia-ide/theia/pull/5665) +- [search-in-workspace] added display of leading and trailing whitespaces in the search-in-workspace results [#5989](https://github.com/theia-ide/theia/pull/5989) +- [search-in-workspace] added progress indicator for search-in-workspace [#5980](https://github.com/theia-ide/theia/pull/5980) +- [search-in-workspace] fixed clumsy auto-suggestion dropdown [#5990](https://github.com/theia-ide/theia/pull/5990) +- [search-in-workspace] fixed the alignment in the search-in-workspace result note [#5802](https://github.com/theia-ide/theia/pull/5802) +- [search-in-workspace] modified `replace-all` functionality to save changes to editors without opening them [#5600](https://github.com/theia-ide/theia/pull/5600) +- [task] added display of process tasks in the terminal [#5895](https://github.com/theia-ide/theia/pull/5895) +- [task] added multi-root support to "configure task" and customizing tasks in `tasks.json` [#5777](https://github.com/theia-ide/theia/pull/5777) +- [task] added support for VSCode task contribution points: `taskDefinitions`, `problemMatchers`, and `problemPatterns` [#5777](https://github.com/theia-ide/theia/pull/5777) +- [task] added the display of configured tasks when executing `configure tasks...` [#5472](https://github.com/theia-ide/theia/pull/5472) +- [task] allowed users to override any task properties other than the ones used in the task definition [#5777](https://github.com/theia-ide/theia/pull/5777) +- [task] changed the way that "configure task" copies the entire task config, to only writing properties that define the detected task plus [#5777](https://github.com/theia-ide/theia/pull/5777)`problemMatcher`, into `tasks.json` +- [task] displayed the customized tasks as "configured tasks" in the task quick open [#5777](https://github.com/theia-ide/theia/pull/5777) +- [task] fixed the problem where a detected task can be customized more than once [#5777](https://github.com/theia-ide/theia/pull/5777) +- [task] notified clients of TaskDefinitionRegistry on change [#5915](https://github.com/theia-ide/theia/pull/5915) +- [task] updated `isVisible` and `isEnabled` handling for `Run Selected Text` [#6018](https://github.com/theia-ide/theia/pull/6018) +- [task] added support for removing all data from tasks.json [#6033](https://github.com/theia-ide/theia/pull/6033) +- [task] updated compare task to use task definitions [#5975](https://github.com/theia-ide/theia/pull/5975) +- [terminal] added a preference `terminal.integrated.scrollback` to control the terminal scrollback [#5783](https://github.com/theia-ide/theia/pull/5783) +- [vscode] added support for `command` variable substitution [#5835](https://github.com/theia-ide/theia/pull/5835) +- [vscode] added support for `config` variable substitution [#5835](https://github.com/theia-ide/theia/pull/5835) +- [vscode] added support for `execPath` variable substitution [#5835](https://github.com/theia-ide/theia/pull/5835) +- [vscode] added support for `inputs` variable substitution for debug [#5835](https://github.com/theia-ide/theia/pull/5835) +- [vscode] added support for `selectedText` variable substitution [#5835](https://github.com/theia-ide/theia/pull/5835) +- [vscode] added support for `when` closure for views [#5855](https://github.com/theia-ide/theia/pull/5855) +- [vscode] added support for environment variable substitution [#5811](https://github.com/theia-ide/theia/pull/5811) +- [vscode] added support for workspace scoped variable substitution [#5835](https://github.com/theia-ide/theia/pull/5835) +- [vscode] fixed resolution of environment variables [#5835](https://github.com/theia-ide/theia/pull/5835) + +Breaking changes: + +- [core] refactored `TreeDecoration` to `WidgetDecoration` and moved it to shell, since it is a generic decoration that can be used by different types of widgets (currently by tree nodes and tabs) [#5845](https://github.com/theia-ide/theia/pull/5845) +- [plugin]refactored files from 'plugin-ext/src/api' moved to 'plugin-ext/src/common', renamed 'model.ts' to 'plugin-api-rpc-model.ts', 'plugin-api.ts' to 'plugin-api-rpc.ts' +- [shell][plugin] integrated view containers and views [#5665](https://github.com/theia-ide/theia/pull/5665) + - `Source Control` and `Explorer` are view containers now and previous layout data cannot be loaded for them. Because of it the layout is completely reset. +- [task] `TaskService.getConfiguredTasks()` returns `Promise` instead of `TaskConfiguration[]` [#5777](https://github.com/theia-ide/theia/pull/5777) +- [task] ensured that plugin tasks are registered before accessing them [5869](https://github.com/theia-ide/theia/pull/5869) + - `TaskProviderRegistry` and `TaskResolverRegistry` are promisified +- [task] removed `filterDuplicates()` from `TaskConfigurations` class [#5915](https://github.com/theia-ide/theia/pull/5915) +- [vscode] completed support of variable substitution [#5835](https://github.com/theia-ide/theia/pull/5835) + - inline `VariableQuickOpenItem` + +## v0.9.0 - 25/07/2019 + +- [core] added `theia-widget-noInfo` css class to be used by widgets when displaying no information messages [#5717](https://github.com/theia-ide/theia/pull/5717) +- [core] added additional options to the tree search input [#5566](https://github.com/theia-ide/theia/pull/5566) +- [core] added fix to prevent the IDE from scrolling along with the text on mobile (e.g. on iPad) [#5742](https://github.com/theia-ide/theia/pull/5742) +- [core] added view container layout changes [#5536](https://github.com/theia-ide/theia/pull/5536) +- [core] fixed the alignment of the expansion icon [#5677](https://github.com/theia-ide/theia/pull/5677) +- [core] fixed the toolbar item comparator [#5624](https://github.com/theia-ide/theia/pull/5624) +- [core] updated quick-open UI [#5733](https://github.com/theia-ide/theia/pull/5733) +- [cpp] added the ability to run `clang-tidy` as a task [#5533](https://github.com/theia-ide/theia/pull/5533) +- [debug] fixed behavior of creating launch configurations always under the '.theia' folder [#5678](https://github.com/theia-ide/theia/pull/5678) +- [debug] updated to ensure that node-based debug adapters spawn the same node executable as Theia [#5508](https://github.com/theia-ide/theia/pull/5508) +- [doc] updated `node.js` prerequisites [#5643](https://github.com/theia-ide/theia/pull/5643) +- [editor] added `Toggle Minimap` command [#5633](https://github.com/theia-ide/theia/pull/5633) +- [filesystem] disposed the clipboard copy listener [#5709](https://github.com/theia-ide/theia/pull/5709) +- [filesystem] fixed file dialog opening folder [#4868](https://github.com/theia-ide/theia/pull/4868) +- [filesystem] fixed scaling issues of save and file dialogs in small viewports [#5688](https://github.com/theia-ide/theia/pull/5688) +- [filesystem] improved the download of large files [#5466](https://github.com/theia-ide/theia/pull/5466) +- [git] improved the support for empty Git repositories in the `Git` and `Git History` view [#5484](https://github.com/theia-ide/theia/pull/5484) +- [keymaps] added the `Reset` button directly when attempting to update a command's keybinding [#5603](https://github.com/theia-ide/theia/pull/5603) +- [keymaps] aligned the keybindings widget with VSCode [#5545](https://github.com/theia-ide/theia/pull/5545) +- [markers] added support for `Information` diagnostic severity [#5763](https://github.com/theia-ide/theia/pull/5763) +- [markers] enabled single-click and keyboard arrow selection to navigate problem markers [#5646](https://github.com/theia-ide/theia/pull/5646) +- [messages] fixed the button positioning when displaying messages with a multiple lines of text [#5657](https://github.com/theia-ide/theia/pull/5657) +- [monaco] added re-detect languages on new grammar [#5754](https://github.com/theia-ide/theia/pull/5754) +- [monaco] fixed textmate highlighting when changing themes [#5728](https://github.com/theia-ide/theia/pull/5728) +- [monaco] fixed the alignment of the file icon in the quick-open menus [#5725](https://github.com/theia-ide/theia/pull/5725) +- [plugin-dev] added the path in the PluginFolder notification [#5731](https://github.com/theia-ide/theia/pull/5731) +- [plugin-dev] fixed the run/debug flow on Windows [#5608](https://github.com/theia-ide/theia/pull/5608) +- [plugin-ext] fixed the display of webview icons in the sidepanel [#5723](https://github.com/theia-ide/theia/pull/5723) +- [plugin-ext] fixed workspace name getter when no folders are opened [#5588](https://github.com/theia-ide/theia/pull/5588) +- [plugin] added support of debug activation events [#5645](https://github.com/theia-ide/theia/pull/5645) +- [plugin] fixed `converting circular structure to JSON` error [#5661](https://github.com/theia-ide/theia/pull/5661) +- [plugin] fixed auto detection of new languages [#5753](https://github.com/theia-ide/theia/issues/5753) +- [plugin] fixed plugin loading to better support modules that have immutable exports [#5520](https://github.com/theia-ide/theia/pull/5520) +- [plugin] improved `node.js` error handling [#5695](https://github.com/theia-ide/theia/pull/5695) +- [scm] fixed the alignment of the status item [#5729](https://github.com/theia-ide/theia/pull/5729) +- [search-in-workspace] added 'title' to search result nodes [#5628](https://github.com/theia-ide/theia/pull/5628) +- [search-in-workspace] added the `search.collapseResults` preference to the search-in-workspace widget [#5686](https://github.com/theia-ide/theia/pull/5686) +- [search-in-workspace] fixed issue which displayed 'No results found' while a user types their search [#5701](https://github.com/theia-ide/theia/pull/5701) +- [search-in-workspace] improved the ordering of the search results [#5669](https://github.com/theia-ide/theia/pull/5669) +- [search-in-workspace] updated the `Replace All` disabled state [#5611](https://github.com/theia-ide/theia/pull/5611) +- [security] updated the version of `lodash.mergewith` from 4.6.1 to 4.6.2 [#5700](https://github.com/theia-ide/theia/pull/5700) +- [task] added support for Linux and OSX specific command properties [#5579](https://github.com/theia-ide/theia/pull/5579) +- [task] added support for VSCode task contribution points: `taskDefinitions`, `problemMatchers`, and `problemPatterns` [#5024](https://github.com/theia-ide/theia/pull/5024) +- [task] disposed task listeners and emitters when necessary [#5024](https://github.com/theia-ide/theia/pull/5024) +- [terminal] implemented `Show All Opened Terminals` quick-open menu [#5577](https://github.com/theia-ide/theia/pull/5577) +- [terminal] updated `processId` and `cwd` to return a rejected promise instead of throwing an error [#5553](https://github.com/theia-ide/theia/pull/5553) +- [vscode] added unzipping of node_modules for built-in extensions [#5756](https://github.com/theia-ide/theia/pull/5756) +- [workspace] added handling to not re-open a workspace that is currently opened [#5632](https://github.com/theia-ide/theia/pull/5632) +- [workspace] fixed path variables on Windows [#5741](https://github.com/theia-ide/theia/pull/5741) + +Breaking changes: + +- [plugin] activate dependencies before activating a plugin [#5661](https://github.com/theia-ide/theia/pull/5661) +- [plugin] added basic support of activation events [#5622](https://github.com/theia-ide/theia/pull/5622) + - `HostedPluginSupport` is refactored to support multiple `PluginManagerExt` properly + - Theia plugins should declare the `"activationEvents": ["*"]` entry in the root of the `package.json`. Otherwise, they won't start at app startup. See [#5743](https://github.com/theia-ide/theia/issues/5743) for more details. +- [plugin] added support of `workspaceContains` activation events [#5649](https://github.com/theia-ide/theia/pull/5649) +- [plugin] fixed typo in 'HostedInstanceState' enum from RUNNNING to RUNNING in `plugin-dev` extension [#5608](https://github.com/theia-ide/theia/pull/5608) +- [plugin] removed member `processOptions` from `AbstractHostedInstanceManager` as it is not initialized or used [#5608](https://github.com/theia-ide/theia/pull/5608) + +## v0.8.0 - 27/06/2019 + +- [core] added bépo keyboard layout +- [core] added sorting to the extension names in the about dialog +- [core] added sorting to the prefixed quick-open commands +- [core] added support for octicon icons in the statusbar +- [core] allowed passing of command args to context menus +- [core] added the ability to rebind the `BrowserMenuBarContribution` +- [core] fixed issue with webview resizing +- [core] fixed label encoding for diff uris +- [cored] added `TextareaAutosize` for textarea resizing +- [debug] added throttling to the debug console output +- [debug] fixed breakpoint resizing error in the debug-widget +- [editor] added the ability to rebind the `EditorWidgetFactory` +- [editor] implemented `Show All Opened Editor` command and quick-open menu +- [editor] removed the 'dirty' state of an editor if changes are reverted +- [electron] fixed issue when exiting Electron based applications +- [electron] improved startup performance +- [filesystem] improved animation when dragging and dropping multiple files +- [keymaps] added a toolbar item to open the keymaps.json +- [keymaps] added command to `Open Keyboard Shortcuts (JSON)` +- [keymaps] added toolbar item to clear keybindings-widget search +- [keymaps] enhanced the keybindings-widget search to support different key orders +- [keymaps] fixed the display of key chords in the keybindings-widget +- [keymaps] updated the UI of the keybindings-widget when resizing +- [monaco] fixed overflow with editor hints +- [navigator] added VSCode-like compare for files +- [navigator] added ability to select for compare +- [plugin] added VSCode API to register `DebugAdapterTrackerFactory` +- [plugin] added `setTextDocumentLanguage` Plug-in API +- [preview] added scrolling synchronization between editor and preview +- [preview] fixed issue where preview images were broken +- [problems] added `copy` and `copy message` features to the problems-widget +- [problems] fixed the problem-widget markers from wrapping when resizing +- [task] added the ability to add comments in tasks.json +- [task] added the display of the source folder name for detected tasks in the quick-open +- [task] added the task label in the terminal title when executing tasks +- [task] implemented `Show Running Tasks...` command and quick-open menu +- [terminal] implemented `Terminate Task...` command and quick-open menu + +Breaking changes: + +- [core] `scheme` is mandatory for URI + - `URI.withoutScheme` is removed, in order to get a path use `URI.path` +- [core] `SelectionCommandHandler.getMulitSelection()` is renamed into `SelectionCommandHandler.getMultiSelection()` +- [debug] align commands with VS Code [#5102](https://github.com/theia-ide/theia/issues/5102) + - `debug.restart` renamed to `workbench.action.debug.restart` +- [plugin] 'Hosted mode' extracted in `plugin-dev` extension +- [preferences] removed constructor from the `FolderPreferenceProvider` class +- [preferences] renamed overridenPreferenceName to overriddenPreferenceName +- [task] `cwd`, which used to be defined directly under `Task`, is moved into `Task.options` object +- [workspace] `isMultiRootWorkspaceOpened()` is renamed into `isMultiRootWorkspaceEnabled()` +- [filesystem] Changed `FileDownloadService` API to support streaming download of huge files. + +## v0.7.0 - 30/05/2019 + +- [console] added `Clear Console` command and toolbar item +- [console] fixed issue where the debug console auto-scrolls when is it located at the bottom +- [core] added command to manually choose a keyboard layout +- [core] added functionality for the toolbar to respond to mouse events +- [core] added launch preferences support +- [core] added preference to control the number of recently used items to display +- [core] added support for recently used commands +- [core] added support for several international keyboard layouts +- [core] added the command `Clear Command History` +- [core] fixed issue allowing the load of Theia in an iframe over a protected connection +- [core] implemented auto-detection of keyboard layout based on pressed keys +- [core] updated monaco configurations on default preference changes +- [cpp] added support for OpenCL file types +- [debug] added support for debug configuration prefixed quick-open menu +- [electron] added the command `Close Window` +- [file-upload] fixed reporting uploaded URIs +- [filesystem] added support for multiple files drag and drop +- [java] added new preference to add command line arguments when starting language server +- [markers] added `Collapse All` toolbar item to the problems-widget +- [mini-browser] fixed issue where the mini-browser resizes unnecessarily +- [monaco] removed overriding dark-plus theming +- [navigator] added the command `Collapse Folders in Explorer` +- [navigator] fixed the commands `Remove Folder` and `Add Folder` +- [outline] added informative tooltips to outline view items +- [plugin-ext] added `onDidEndTaskProcess` Plug-in API +- [plugin-ext] added `onDidStartTaskProcess` Plug-in API +- [plugin-ext] added ability to match browser displayed nodes with the plugin created node +- [plugin-ext] added additional command to install VSCode extensions +- [plugin-ext] added support for inline actions +- [plugin-ext] aligned views with Theia styles +- [plugin-ext] fixed he loading of icons +- [plugin-ext] fixed issue of overriding preferences +- [plugin-ext] fixed issue to support single source deployment state +- [plugin-ext] fixed issue where the hosted plugin instance did not properly stop +- [plugin-ext] fixed plugin folder path in Windows +- [plugin-ext] fixed the rendering of png icons +- [plugin-ext] implemented command `workbench.action.reloadWindow` +- [plugin] added file management vscode commands +- [plugin] fixed plugin export +- [preferences] added additional information to the preference tooltips +- [process] added link matcher for local files +- [process] normalized task types and processes +- [tabbar] fixed widget leaking via phosphor VDOM +- [terminal] added ability to activate links with `cmd + click` +- [terminal] added support for basic link matching +- [terminal] fixed random 1px white border in Firefox +- [typescript] fixed broken code actions +- [workspace] allowed `WorkspaceCommandContribution` to be re-bindable by extensions +- [xterm] upgraded xterm to fix terminal dragging between areas + +Breaking changes: + +- [filesystem] extracted `FileUploadService` and refactored `FileTreeWidget` to use it [#5086](https://github.com/theia-ide/theia/pull/5086) + - moved `FileDownloadCommands.UPLOAD` to `FileSystemCommands.UPLOAD` +- [git] bind Git UI to SCM +- [output] moved the channel selection and clear icons to the toolbar. + - The CLEAR_BUTTON and OVERLAY constants are no longer available. Furthermore OutputChannelManager API has changed. +- [preferences] refactored to integrate launch configurations as preferences +- [scm] added Source Control Model +- [core] renamed the `src/electron-main` folder to `src/electron-node` in `@theia/core`. Removed `preventStop` from the `FrontendApplication` API. Move the `DefaultWindowService` class into its own module. + +## v0.6.0 - 30/04/2019 + +- Allowed the creation of sub-files and/or sub-folders if name has `/` +- [core] added `files.enableTrash` preference +- [core] added support for custom React toolbar widgets +- [core] added support for tail decorators +- [core] aligned the statusbar styles with VSCode +- [core] updated the prefix quick-open service to support `actionProviders` +- [cpp] added support for block comment auto-closing pairs +- [editor-preview] fixed error at application startup if no preview editors are opened +- [editor-preview] fixed the `goToDefinition` failure when in editor preview mode +- [electron] added the ability to run plugins by binding the components on the backend +- [electron] added the configure Plug-ins option to the start script +- [electron] updated Electron to include a `minWidth` and `minHeight` +- [electron] upgraded version of Electron used to version 3 +- [filesystem] added the menu item `Upload Files...` to easily upload files into a workspace +- [filesystem] implemented `Save As` including a save dialog, and new command +- [filesystem] updated the handling when attempting to perform copying when the source and target are the same +- [git] added ability to toggle `Git History` widget +- [git] fixed `Discard All` alignment when the `Git` widget is too narrow +- [git] fixed `Git History` widget alignment and behavior issues +- [git] updated the ahead/behind icons on the statusbar +- [keyboard] aligned the file and event naming conventions +- [languages] updated error type for backwards compatibility +- [plugin-ext] fixed the Plug-in path selection dialog for the hosted instance +- [plugin] added `CodeActionKind` `intersects` Plug-in API +- [plugin] added necessary Webview Plug-in APIs +- [plugin] added propagation of `thisArg` on `registerCommand` +- [plugin] added support for Gulp, Jake, Grunt Plug-in extensions +- [plugin] added support for extensions without activation functions +- [plugin] added the ability to choose through the CLI which VSCode API version to use +- [plugin] aligned `window.setStatusBarMessage` with VSCode +- [plugin] fixed `vscode.open` command by adding checks on arguments +- [plugin] fixed implementation of `vscode.diff` command +- [plugin] fixed issue where webviews were not focused or revealed properly +- [plugin] fixed memory leak on Plug-ins reload +- [plugin] fixed serialization of `Range` object +- [plugin] fixed the registration of text decoration keys +- [plugin] updated Plug-in language services to hook in monaco cancellation tokens +- [preferences] added ability to override default application preference values +- [search-in-workspace] added the ability to pass the currently selected editor text when searching +- [security] fixed XSS vulnerability +- [task] added command to clear task history +- [task] added support to configure tasks +- [task] added the ability to configure tasks +- [task] added the ability to display recently used tasks +- [task] updated the tasks quick-open menu including alignment, category labels and borders +- [terminal] updated terminal preference's minimum value for `lineHeight` and `fontSize` +- [textmate-grammars] added php grammar +- [textmate-grammars] added rust grammar +- [textmate-grammars] fixed incorrect jsx scope +- [tree] added support for icons in node tail decorators +- [workspace] allowed the creation of files and folders using recursive paths +- [workspace] fixed incorrect file-icon when displaying recent workspaces + +Breaking changes: + +- [core] added support native keyboard layouts [#4724](https://github.com/theia-ide/theia/pull/4724) +- [dialog] updated `validate` and `accept` methods so they are now Promisified [#4764](https://github.com/theia-ide/theia/pull/4764) +- [editor] turned off autoSave by default to align with VSCode [#4777](https://github.com/theia-ide/theia/pull/4777) + - default settings can be overridden in application package.json: + + ```json + { + "private": true, + "name": "myapp", + "theia": { + "frontend": { + "config": { + "preferences": { + "editor.autoSave": "on" + } + } + } + } + } + ``` + +- [electron] removed cluster mode and startup timeout setting +- [electron] updated Electron to make runtime dependencies optional [#4873](https://github.com/theia-ide/theia/pull/4873) +- [extension-manager] deprecated [#4876](https://github.com/theia-ide/theia/pull/4876) +- [node] moved to using Node.js version 10, dropping support for Node.js version 8 + +## v0.5.0 - 28/03/2019 + +- Added `scope` to task configurations to differentiate 3 things: task type, task source, and where to run tasks +- [core] added implementation for toolbar support for sidepanels and changed sidepanel tabs +- [core] added new keybinding alt+shift+w to close all main area tabs +- [core] added the ability to make sidebar widgets closable +- [core] fixed `ToolbarAwareTabBar` detachment errors +- [core] fixed broken wheel listener +- [core] improved scrollbar styling +- [core] updated tabbar toolbar to use VSCode icons +- [core] updated the UI with numerous improvements including sidepanel icons, better alignment, tabbar and menu size +- [cpp] added new `cpp.clangTidy`and `cpp.clangTidyChecks` preferences to lint cpp program when clangd v9+ is used +- [cpp] fixed properly restarting clangd language server when changing cpp build configurations +- [debug] added new debug preferences to control `view`, `console`, and `location` appearance +- [editorconfig] added support to apply properties to monaco editor when opening/switching editors +- [file-search] improved ordering and consistency of file search results +- [filesystem] added `files.associations` property +- [filesystem] improved the performance when deleting large directories +- [filesystem] upgraded `nsfw` file-watching dependency from `vscode-nsfw` to `Axosoft/nsfw` which fixes memory leaks as well as fixes issues where files are not being properly watched outside the main watched directory +- [git] fixed issue where Theia did not refresh the git view after deleting the only repository +- [git] improved the git diff navigation header to be static +- [java] improved handling of incomplete classpath commands +- [keybindings] improved the keybindings widget search and table header to be static +- [mini-browser] improved error handling of iframe errors +- [navigator] added `Collapse All` toolbar item +- [navigator] updated the navigator to handle multi-root workspaces better +- [plugin-ext] added `workspace.onDidRenameFile` Plug-in API +- [plugin-ext] added `workspace.onWillRenameFile` Plug-in API +- [plugin-ext] added `workspace.registerFileSystemProvider` Plug-in API +- [plugin-ext] added `workspace.saveAll` Plug-in API +- [plugin-ext] added `workspace.updateWorkspaceFolders` Plug-in API +- [plugin-ext] added ability to proceed `runInTerminal` requests in sidecar containers +- [plugin-ext] added the ability to get selection context after executing a command +- [plugin-ext] fixed VSCode Plug-in API incompatibilities for the `onDidChangeActiveTextEditor` event +- [plugin-ext] fixed firing the `onWillSaveTextDocument` event +- [plugin-ext] fixed issue of re-deploying already initialized plugins +- [plugin] `workspace.openTextDocument` API now respects the contributed `FileSystemProviders` +- [plugin] added support for multiple windows per backend +- [plugin] fixed progress creation +- [plugin] improved the view container to use the native toolbar +- [preferences] fixed content assist when editing `settings.json` +- [preferences] fixed parsing of settings from workspace files +- [preferences] improved overriding of default configurations +- [preview] fixed issue when opening images +- [search-in-workspace] added a new preference `search.lineNumbers` to control whether to show line numbers for search results +- [task] added ability to `Run Selected Text` +- [task] added new command to re-run the last task +- [task] added schema support for `tasks.json` +- [typehierarchy] added the new type hierarchy extension +- [typehierarchy] improved `typehierarchy` to use all levels the language server sends if available +- [workspace] added new `package.json` properties `newFIleName` and `newFileExtension` to specify default file name and extension when creating a new file +- [workspace] improved performance of the file rename action for large directories + +Breaking changes: + +- [editor] computation of resource context keys moved to core [#4531](https://github.com/theia-ide/theia/pull/4531) +- [plugin] support multiple windows per a backend [#4509](https://github.com/theia-ide/theia/issues/4509) + - Some plugin bindings are scoped per a connection now. Clients, who contribute/rebind these bindings, will need to scope them per a connection as well. +- [quick-open] disable separate fuzzy matching by default [#4549](https://github.com/theia-ide/theia/pull/4549) +- [shell] support toolbars in side bars [#4600](https://github.com/theia-ide/theia/pull/4600) + - In side bars a widget title is rendered as an icon. + +## v0.4.0 - 28/02/2019 + +- [application-manager] added support for pre-load HTML templates +- [console] added support for console `when` contexts +- [core] added support for os `when` contexts +- [core] added support for shell `when` contexts +- [core] added support for vscode closure contexts +- [core] fixed bad vertical resizing behavior +- [core] improved scrollbar visibility for the command palette +- [core] improved tab-bar display (display 'X' (close) on dirty editors when hovering over dirty icon) +- [core] improved tab-bar display (display 'X' (close) only when current editor is active, or has hover) +- [cpp] fixed `CPP_CLANGD_COMMAND` and `CPP_CLANGD_ARGS` environment variables +- [cpp] fixed the update of the active build config statusbar when preferences are updated +- [cpp] implemented the command `Create New Build Configuration` +- [cpp] implemented the command `Reset Build Configuration` +- [cpp] removed duplicate json config entry generated by the command `New Build Config` +- [debug] added support for debug mode `when` contexts +- [editor] added `Clear Editor History` command +- [editor] added support for editor `when` contexts +- [editor] added support for resource `when` contexts +- [editor] registered editor to navigation location stack when `onCurrentEditorChange` event is fired +- [electron] improved opening markdown links by opening them in the OS' default browser +- [electron] stored the last state of window geometry +- [file-search] added separator between recently opened items, and file results when executing the quick file open +- [file-search] added support for ignored globs and limit in file search +- [file-search] improved quick open file sort order +- [file-search] removed git diff editors from displaying the quick file open +- [file-search] added support for `glob` file searches +- [file-search][plugin-ext] updated `exclude` of file search +- [git] added the following git commands: `Stash`, `Apply Stash`, `Apply Latest Stash`, `Pop Stash`, `Pop Latest Stash` and `Drop Stash` +- [git] enhanced `Git Remote` command to obtain complete data +- [git] fixed refreshing the `GitView` when git repo changes +- [git] fixed the command `Git Reset` +- [git] removed bundled git from `dugite` +- [languages] fixed clash in language server session ids +- [messages] added support for notification `when` contexts +- [mini-browser] added ability to pass argument for `openUrl` command +- [monaco] added support for quick open `when` contexts +- [monaco] added support for snipped mode `when` contexts +- [navigator] added support for explorer `when` contexts +- [navigator] fixed updating the navigator context menu on `supportMultiRootWorkspace` preference change +- [plugin-ext-vscode] added ability to handle `vscode.diff` and open diff editor commands +- [plugin-ext-vscode] added vscode `setContext` command +- [plugin-ext-vscode] fixed local resource loading in webviews +- [plugin-ext] fixed `TreeView` widget registration +- [plugin-ext] fixed `onDidSelectItem` behavior for the quick pick widget +- [plugin-ext] fixed command conversions for code lens +- [plugin-ext] fixed issue of `OutputChanel.show` not displaying +- [plugin-ext] fixed miscellaneous issues in golang plugin +- [plugin-ext] implemented `onWillSaveTextDocument` event handler +- [plugin-ext][markers] added support to use problem manager to handle plugin markers +- [plugin] added `tasks.onDidEndTask` Plug-in API +- [plugin] added `tasks.taskExecutions` Plug-in API +- [plugin] added ability to display webview panel in 'left', 'right' and 'bottom' area +- [plugin] added support for `menus.commandPalette` contribution point +- [plugin] added support for `vscode.previewHtml` command +- [plugin] added support for read-only configuration index access +- [plugin] fixed issue of ensuring statusbar entry uniqueness +- [plugin] implemented inspect configuration command +- [plugin] refactored the `Command` interface by splitting into two: `CommandDescription` and `Command` +- [plugin][debug] added ability to connect to a remote debug server +- [preferences] added support for language specific preferences +- [preferences] aligned preference default values by type with vscode +- [search-in-workspace] added support for search `when` contexts +- [search-in-workspace] fixed keybinding for `Search in Workspace` widget +- [terminal] added support for font preferences +- [terminal] added support for terminal `when` contexts +- [vscode] added support for OS specific keybindings +- [vscode] implemented `commands.getCommands` +- [vscode] implemented `commands.registerTextEditorCommand` +- [vscode] implemented `workspace.rootPath` +- [workspace] added support for easier overriding of the `DefaultWorkspaceServer` +- [workspace] added support for workspace `when` contexts +- [workspace] fixed displaying the `Open With...` context menu only when more than one open handler is present +- [mini-browser] improved handling of iframe errors and time-outs + +Breaking changes: + +- menus aligned with built-in VS Code menus [#4173](https://github.com/theia-ide/theia/pull/4173) + - navigator context menu group changes: + - `1_open` and `4_new` replaced by `navigation` group + - `6_workspace` renamed to `2_workspace` group + - `5_diff` renamed to `3_compare` group + - `6_find` renamed to `4_search` group + - `2_clipboard` renamed to `5_cutcopypaste` group + - `3_move` and `7_actions` replaced by `navigation` group + - editor context menu group changes: + - `2_cut_copy_paste` renamed to `9_cutcopypaste` group +- [debug] align commands with VS Code [#4204](https://github.com/theia-ide/theia/issues/4204) + - `debug.breakpoint.toggle` renamed to `editor.debug.action.toggleBreakpoint` + - `debug.start` renamed to `workbench.action.debug.start` + - `debug.thread.continue` renamed to `workbench.action.debug.continue` + - `debug.start.noDebug` renamed to `workbench.action.debug.run` + - `debug.thread.pause` renamed to `workbench.action.debug.pause` + - `debug.thread.stepin` renamed to `workbench.action.debug.stepInto` + - `debug.thread.stepout` renamed to `workbench.action.debug.stepOut` + - `debug.thread.next` renamed to `workbench.action.debug.stepOver` + - `debug.stop` renamed to `workbench.action.debug.stop` + - `debug.editor.showHover` renamed to `editor.debug.action.showDebugHover` +- multi-root workspace support for preferences [#3247](https://github.com/theia-ide/theia/pull/3247) + - `PreferenceProvider` + - is changed from a regular class to an abstract class + - the `fireOnDidPreferencesChanged` function is deprecated. `emitPreferencesChangedEvent` function should be used instead. `fireOnDidPreferencesChanged` will be removed with the next major release. + - `PreferenceServiceImpl` + - `preferences` is deprecated. `getPreferences` function should be used instead. `preferences` will be removed with the next major release + - having `properties` property defined in the `PreferenceSchema` object is now mandatory + - `PreferenceProperty` is renamed to `PreferenceDataProperty` + - `PreferenceSchemaProvider` + - the type of `combinedSchema` property is changed from `PreferenceSchema` to `PreferenceDataSchema` + - the return type of `getCombinedSchema` function is changed from `PreferenceSchema` to `PreferenceDataSchema` + - `affects` function is added to `PreferenceChangeEvent` and `PreferenceChange` interface +- `navigator.exclude` preference is renamed to `files.exclude` [#4274](https://github.com/theia-ide/theia/pull/4274) + +## v0.3.19 - 22/01/2019 + +- [core] added `hostname` alias +- [core] added new `editor.formatOnSave` preference, to format documents on manual save +- [core] added support for setting end of line character +- [cpp] added new `cpp.clangdExecutable` and `cpp.clangdArgs` to customize language server start command +- [debug] added node debugger as a Plug-in +- [debug] added support for source breakpoints +- [git] added `discardAll` command +- [git] added `stageAll` command +- [git] added `unstageAll` command +- [git] added new `git pull` command, to pull from default configured remote +- [git] added new `git push` command, to push from default configured remote +- [git] added the ability to refresh git repositories when a change is detected within a workspace +- [java] allow the ability to rebind `JavaContribution` +- [languages] enabled INI syntax highlighting for `.properties` and `.toml` files +- [monaco] fixed cross editor navigation +- [monaco] fixed document-saving that took too long +- [monaco] improved `MonacoWorkspace.fireWillSave` performance +- [plugin] added `globalState` and `workspaceState` Plug-in API +- [plugin] added `registerColorProvider` Plug-in API +- [plugin] added `registerRenameProvider` Plug-in API +- [plugin] added `tasks.onDidStartTask` Plug-in API +- [plugin] added basic support of snippets +- [plugin] added common service to handle `when` expressions +- [plugin] added debug Plug-in API +- [plugin] added support for terminal APIs on window +- [plugin] added the ability to debug VS Code extensions +- [plugin] added the ability to get operating system connected to Plug-in +- [plugin] added the ability to provide a way to initialize workspace folders when Theia is started +- [plugin] added the ability to set the visibility of menu items through `when` expressions +- [plugin] added workspace symbols Plug-in API +- [plugin] fixed spreading of command arguments +- [preferences] added the ability to update settings schema resource on schema changes +- [search-in-workspace] fixed issue regarding child root in `search-in-workspace` when there is a multiple-root workspace +- [search-in-workspace] removed duplicates from `search-in-workspace` tree +- [security] updated xterm.js to 3.9.2 +- [task] added support to run tasks from multiple-roots +- [task] fixed cwd path +- [workspace] added multiple-root support for `WorkspaceService.getWorkspaceRootUri()` diff --git a/doc/changelogs/CHANGELOG-2020.md b/doc/changelogs/CHANGELOG-2020.md new file mode 100644 index 0000000..6364da2 --- /dev/null +++ b/doc/changelogs/CHANGELOG-2020.md @@ -0,0 +1,894 @@ +# Changelog 2020 + +## v1.9.0 - 16/12/2020 + +- [cli] updated error reporting for the `download-plugins` script [#8798](https://github.com/eclipse-theia/theia/pull/8798) +- [cli] updated the `download-plugins` script to report errors in case of unsupported file types [#8797](https://github.com/eclipse-theia/theia/pull/8797) +- [core] added support for the `workbench.editor.closeOnFileDelete` preference [#8731](https://github.com/eclipse-theia/theia/pull/8731) +- [core] fixed issue when attempting to kill the electron backend [#8809](https://github.com/eclipse-theia/theia/pull/8809) +- [core] updated tree expansion busy indicators [#8582](https://github.com/eclipse-theia/theia/pull/8582) +- [filesystem] fixed issue with pasting files/folders with the same name [#8778](https://github.com/eclipse-theia/theia/pull/8778) +- [filesystem] updated `upload` to return `FileUploadResult` [#8766](https://github.com/eclipse-theia/theia/pull/8766) +- [mini-browser] fixed issue when serving `{{hostname}}` as a pattern for `THEIA_MINI_BROWSER_HOST_PATTERN` [#8865](https://github.com/eclipse-theia/theia/pull/8865) +- [mini-browser] fixed missing resource response [#8866](https://github.com/eclipse-theia/theia/pull/8866) +- [plugin] added support for the command `workbench.extensions.installExtension` [#8745](https://github.com/eclipse-theia/theia/pull/8745) +- [plugin] corrected identification of uri schemes according to `rfc3986` [#8832](https://github.com/eclipse-theia/theia/pull/8832) +- [plugin] fixed the `reveal()` method for tree-views [#8783](https://github.com/eclipse-theia/theia/pull/8783) +- [plugin] removed unnecessary `plugin-ext` dependencies [#8831](https://github.com/eclipse-theia/theia/pull/8831) +- [plugin] updated `set html` to pass the object field instead of method argument [#8833](https://github.com/eclipse-theia/theia/pull/8833) +- [siw] added support for the `search.searchOnEditorModification` preference [#8765](https://github.com/eclipse-theia/theia/pull/8765) +- [siw] added support for the `search.searchOnType` preference [#8773](https://github.com/eclipse-theia/theia/pull/8773) + +[Breaking Changes:](#breaking_changes_1.9.0) + +- [core] `FrontendApplicationContribution.onWillStop` is now called for every contribution and will not bail early [#8863](https://github.com/eclipse-theia/theia/pull/8863) + - It will also be called when `application.confirmExit` is set to `never`. +- [`download:plugins`] errors when downloading plugins now result in build failures, unless the `--ignore-errors` flag is passed [#8788](https://github.com/eclipse-theia/theia/pull/8788) +- [plugin] `LocalDirectoryPluginDeployerResolver` has moved from `packages/plugin-ext/src/main/node/resolvers/plugin-local-dir-resolver.ts` to `packages/plugin-ext/src/main/node/resolvers/local-file-plugin-deployer-resolver.ts` and now derives from `LocalPluginDeployerResolver` [#8745](https://github.com/eclipse-theia/theia/pull/8745) +- [plugin] updated the `TreeViewsMain.$reveal` second parameter from string element id to string array element parent chain [#8783](https://github.com/eclipse-theia/theia/pull/8783) +- [plugin] removed the unused `/plugin/:path(*)` endpoint [#8831](https://github.com/eclipse-theia/theia/pull/8831) +- [task] remove bash login shell when run from task to align with vscode [#8834](https://github.com/eclipse-theia/theia/pull/8834) + +## v1.8.1 - 08/12/2020 + +- [core] added `THEIA_HOSTS` environment variable (browser applications only) [#8759](https://github.com/eclipse-theia/theia/pull/8759) + - Used to filter incoming WebSocket connections: if `Origin` header does not match the list of hosts it will be refused. + - Value is a comma-separated list of domain names including the port if not `80` nor `443`. + - Example: `app.some.domain.com,app.other.domain:12345`. + +[Breaking Changes:](#breaking_changes_1.8.1) + +- [core] deprecated `ElectronMessagingContribution`, token validation is now done in `ElectronTokenValidator` as a `WsRequestValidatorContribution` [#8759](https://github.com/eclipse-theia/theia/pull/8759) +- [mini-browser] added new unique endpoint [#8759](https://github.com/eclipse-theia/theia/pull/8759) + - `{{uuid}}.mini-browser.{{hostname}}` by default. + - Can be configured via `THEIA_MINI_BROWSER_HOST_PATTERN` environment variable. + - Clients must setup this new hostname in their DNS resolvers. + +## v1.8.0 - 26/11/2020 + +- [api-tests] fixed issue with `saveable` test suite [#8736](https://github.com/eclipse-theia/theia/pull/8736) +- [application-manager] enabled `monaco-editor.*` sourcemaps when debugging [#8744](https://github.com/eclipse-theia/theia/pull/8744) +- [console] updated the `anser` import workaround [#8741](https://github.com/eclipse-theia/theia/pull/8741) +- [core] added ability to filter tree nodes [#8540](https://github.com/eclipse-theia/theia/pull/8540) +- [debug] fixed issue where the debug-view is not properly updated when hidden [#8645](https://github.com/eclipse-theia/theia/pull/8645) +- [documentation] improved documentation for `@theia/cli` electron configurations [#8699](https://github.com/eclipse-theia/theia/pull/8699) +- [documentation] improved documentation for `BackendApplicationContribution` [#8686](https://github.com/eclipse-theia/theia/pull/8686) +- [documentation] improved documentation for `MenuContribution` [#8715](https://github.com/eclipse-theia/theia/pull/8715) +- [documentation] improved documentation for `MessageService` [#8688](https://github.com/eclipse-theia/theia/pull/8688) +- [documentation] improved documentation for `PreferenceContribution` [#8677](https://github.com/eclipse-theia/theia/pull/8677) +- [documentation] improved documentation for `Task` API [#8695](https://github.com/eclipse-theia/theia/pull/8695) +- [documentation] improved documentation for `TreeDecorator` and `TreeDecoratorService` [#8698](https://github.com/eclipse-theia/theia/pull/8698) +- [documentation] updated publishing documentation for the repository [#8719](https://github.com/eclipse-theia/theia/pull/8719) +- [editor] enabled `editor.semanticHighlighting.enabled` by default [#8593](https://github.com/eclipse-theia/theia/pull/8593) +- [electron] fixed issue with `application.confirmExit` preventing the app from closing [#8732](https://github.com/eclipse-theia/theia/pull/8732) +- [file-search] fixed issue where file-search did not properly ignore the `.git` folder [#8721](https://github.com/eclipse-theia/theia/pull/8721) +- [monaco] added ability to compare quick-open entries [#8185](https://github.com/eclipse-theia/theia/pull/8185) +- [output] improved extensibility of output channel commands [#8733](https://github.com/eclipse-theia/theia/pull/8733) +- [plugin] added ability to use `viewId` as a progress location [#8700](https://github.com/eclipse-theia/theia/pull/8700) +- [plugin] added logic to only store webviews when they have a corresponding serializer [#8680](https://github.com/eclipse-theia/theia/pull/8680) +- [plugin] added support for `activeColorTheme` and `onDidChangeActiveColorTheme` API [#8710](https://github.com/eclipse-theia/theia/pull/8710) +- [plugin] added support for semantic highlighting [#8593](https://github.com/eclipse-theia/theia/pull/8593) +- [plugin] fixed issue where problem matchers specified by task providers are not respected [#8756](https://github.com/eclipse-theia/theia/pull/8756) +- [plugin] fixed issues with the `Authentication` API [#8725](https://github.com/eclipse-theia/theia/pull/8725) +- [plugin] fixed terminating hosted instance issue [#8674](https://github.com/eclipse-theia/theia/pull/8674) +- [preview] fixed issue where empty document content was not properly rendered [#8729](https://github.com/eclipse-theia/theia/pull/8729) +- [repo] updated `eslint` and peer-dependencies to latest versions [#8770](https://github.com/eclipse-theia/theia/pull/8770) +- [search-in-workspace] added ability to perform searches in dirty editors [#8579](https://github.com/eclipse-theia/theia/pull/8579) +- [search-in-workspace] added ability to search opened editors outside the workspace [#8646](https://github.com/eclipse-theia/theia/pull/8646) +- [security] updated `yargs` dependency [#8711](https://github.com/eclipse-theia/theia/pull/8711) +- [workspace] fixed missing binding of `WorkspaceFrontendContribution` [#8734](https://github.com/eclipse-theia/theia/pull/8734) + +[Breaking Changes:](#breaking_changes_1.8.0) + +- [electron] removed `attachWillPreventUnload` method from the Electron main application. The `confirmExit` logic is handled on the frontend [#8732](https://github.com/eclipse-theia/theia/pull/8732) +- [file-search] deprecated dependency on `@theia/process` and replaced its usage by node's `child_process` API [#8721](https://github.com/eclipse-theia/theia/pull/8721) + +## v1.7.0 - 29/10/2020 + +[1.7.0 Release Milestone](https://github.com/eclipse-theia/theia/milestone/12?closed=1) + +- [core] added `Save without Formatting` command [#8543](https://github.com/eclipse-theia/theia/pull/8543) +- [core] added ability to customize `CommandQuickOpenItem` [#8648](https://github.com/eclipse-theia/theia/pull/8648) +- [core] added support for `isWeb` context when clause [#8530](https://github.com/eclipse-theia/theia/pull/8530) +- [core] added support for the `keyboard.dispatch` preference [#8609](https://github.com/eclipse-theia/theia/pull/8609) +- [core] fixed the `UriAwareCommandHandler` preventing the duplication of passed arguments [#8592](https://github.com/eclipse-theia/theia/pull/8592) +- [core] fixed transparent widget backgrounds breaking branding [#8448](https://github.com/eclipse-theia/theia/pull/8448) +- [core] improved extensibility of view containers for downstream extenders [#8619](https://github.com/eclipse-theia/theia/pull/8619) +- [core] updated `Save All` to only format dirty editors [#8554](https://github.com/eclipse-theia/theia/pull/8544) +- [debug] improved extensibility of debug event handlers [#8616](https://github.com/eclipse-theia/theia/pull/8616) +- [debug] renamed the `Debug` main menu item to `Run` [#8653](https://github.com/eclipse-theia/theia/pull/8653) +- [documentation] improved documentation for `FileService` and `FileSystemProvider` [#8596](https://github.com/eclipse-theia/theia/pull/8596) +- [documentation] improved documentation for `Keybinding` and `KeybindingContribution` [#8637](https://github.com/eclipse-theia/theia/pull/8637) +- [documentation] improved documentation for `LabelProvider` and `LabelProviderContribution` [#8569](https://github.com/eclipse-theia/theia/pull/8569) +- [documentation] improved documentation for `PreferenceService` [#8612](https://github.com/eclipse-theia/theia/pull/8612) +- [documentation] improved documentation for `WidgetManager` and `WidgetOpenHandler` [#8644](https://github.com/eclipse-theia/theia/pull/8644) +- [documentation] improved documentation for the `@theia/preview` extension [#8625](https://github.com/eclipse-theia/theia/pull/8625) +- [editor] fixed inconsistent `showTextDocument` behavior [#8588](https://github.com/eclipse-theia/theia/pull/8588) +- [electron] added handling for `SIGPIPE` errors [#8661](https://github.com/eclipse-theia/theia/pull/8661) +- [filesystem] refactored file watchers: [#8546](https://github.com/eclipse-theia/theia/pull/8546) + - Added `FileSystemWatcherService` component that should be a singleton centralizing watch requests for all clients. + - Added `FileSystemWatcherServiceDispatcher` to register yourself and listen to file change events. +- [git] updated `commit details` and `diff view` rendering to respect `list` and `tree` modes [#8084] () +- [markers] updated and enhanced the 'problem-manager' tests [#8604](https://github.com/eclipse-theia/theia/pull/8604) +- [mini-browser] updated deprecated `scrElement` usage to `target` [#8663](https://github.com/eclipse-theia/theia/pull/8663) +- [monaco] fixed race condition on monaco editor initialization [#8563](https://github.com/eclipse-theia/theia/pull/8563) +- [monaco] updated `Save All` command to format all open editors [#8551](https://github.com/eclipse-theia/theia/pull/8551) +- [navigator] added additional handling for empty multi-root workspaces [#8608](https://github.com/eclipse-theia/theia/pull/8608) +- [navigator] fixed the `doOpenNode` implementation for hidden nodes [#8659](https://github.com/eclipse-theia/theia/pull/8659) +- [plugin] added `environmentVariableCollection` to `PluginContext` [#8523](https://github.com/eclipse-theia/theia/pull/8523) +- [plugin] added `onStartupFinished` plugin activation event [#8525](https://github.com/eclipse-theia/theia/pull/8525) +- [plugin] added logic to load plugin manifests on activation [#8485](https://github.com/eclipse-theia/theia/pull/8485) +- [plugin] added support for `deprecated` strikethrough for completion items [#8553](https://github.com/eclipse-theia/theia/pull/8553) +- [plugin] bumped the default supported VS Code version to `1.50.0` [#8617](https://github.com/eclipse-theia/theia/pull/8617) +- [plugin] fixed XSS sink by sanitizing dialog `innerHTML` [#8388](https://github.com/eclipse-theia/theia/pull/8388) +- [plugin] fixed constrain types of providers [#8617](https://github.com/eclipse-theia/theia/pull/8617) +- [plugin] fixed issue related to calling the activation of an extension through another extension [#8542](https://github.com/eclipse-theia/theia/pull/8542) +- [plugin] fixed prototype pollution vulnerability [#8675](https://github.com/eclipse-theia/theia/pull/8675) +- [plugin] fixed the dismissal of menus when clicking within webviews [#8633](https://github.com/eclipse-theia/theia/pull/8633) +- [plugin] improved extensibility of `CodeEditorWidget` [#8672](https://github.com/eclipse-theia/theia/pull/8672) +- [plugin] updated `Comments` API to align with VS Code [#8539](https://github.com/eclipse-theia/theia/pull/8539) +- [plugin] updated `workspaceFolders` API to return `undefined` when no folders are opened [#8641](https://github.com/eclipse-theia/theia/pull/8641) +- [repo] added `no-tabs` rule [#8630](https://github.com/eclipse-theia/theia/pull/8630) +- [repo] reduced verbosity during build [#8642](https://github.com/eclipse-theia/theia/pull/8642) +- [repo] reduced verbosity when building individual extensions [#8642](https://github.com/eclipse-theia/theia/pull/8642) +- [repo] updated use of deprecated APIs in unit tests [#8642](https://github.com/eclipse-theia/theia/pull/8642) +- [repo] upgraded to `@types/node@12` typings [#8556](https://github.com/eclipse-theia/theia/pull/8556) +- [scm] fixed 'circular structure to JSON' error for the accept input command [#8606](https://github.com/eclipse-theia/theia/pull/8606) +- [scm] updated the commit textarea placeholder to include the current branch name [#6156](https://github.com/eclipse-theia/theia/pull/6156) +- [vsx-registry] added support for the search parameter `includeAllVersions` [#8607](https://github.com/eclipse-theia/theia/pull/8607) +- [vsx-registry] added support for the search parameter `sortBy` [#8607](https://github.com/eclipse-theia/theia/pull/8607) +- [vsx-registry] added support for the search parameter `sortOrder` [#8607](https://github.com/eclipse-theia/theia/pull/8607) +- [vsx-registry] fixed the `search` query when multiple search parameters are used [#8607](https://github.com/eclipse-theia/theia/pull/8607) +- [vsx-registry] updated the `query` API endpoint [#8570](https://github.com/eclipse-theia/theia/pull/8570) + +[Breaking Changes:](#breaking_changes_1.7.0) + +- [core] change progress notification cancelable property default from `true` to `false` [#8479](https://github.com/eclipse-theia/theia/pull/8479) +- [filesystem] `NsfwFileSystemWatcherServer` is deprecated and no longer used [#8546](https://github.com/eclipse-theia/theia/pull/8546) +- [messages] updated handling of empty notifications and progress notifications so they will not be shown [#8479](https://github.com/eclipse-theia/theia/pull/8479) +- [plugin-metrics] renamed `AnalyticsFromRequests.succesfulResponses` to `AnalyticsFromRequests.successfulResponses` [#8560](https://github.com/eclipse-theia/theia/pull/8560) +- [plugin] `CodeEditorWidgetUti.getResourceUri` is no longer exportable [#8672](https://github.com/eclipse-theia/theia/pull/8672) + +## v1.6.0 - 24/09/2020 + +- [core] added ability to un-register keybindings for a given command [#8269](https://github.com/eclipse-theia/theia/pull/8269) +- [core] added handling to only execute command via keybinding if it has an active handler [#8420](https://github.com/eclipse-theia/theia/pull/8420) +- [core] updated the triggering of `tab-bar` context-menus to open without the need to be activated beforehand [#6965](https://github.com/eclipse-theia/theia/pull/6965) +- [editor] added ability to set the default formatter [#8446](https://github.com/eclipse-theia/theia/pull/8446) +- [electron] fixed the `rebuild:electron` command for the `drivelist` native module [#8454](https://github.com/eclipse-theia/theia/pull/8454) +- [filesystem] added handling to warn Linux users when they have exhausted `Inotify` handles, along with instructions on how to fix it [#8458](https://github.com/eclipse-theia/theia/pull/8458) +- [filesystem] fixed the deprecated `FileSystem` binding to return an instantiated instance rather than the class [#8507](https://github.com/eclipse-theia/theia/pull/8507) +- [keymaps] added handling to prevent URL hash changes when editing keybindings [#8502](https://github.com/eclipse-theia/theia/pull/8502) +- [lint] added XSS sink detection eslint rules [#8481](https://github.com/eclipse-theia/theia/pull/8481) +- [output] renamed `output-widget.tsx` to `output-widget.ts` [#8499](https://github.com/eclipse-theia/theia/pull/8499) +- [output] updated logic to allow clients to customize channel creation [#8476](https://github.com/eclipse-theia/theia/pull/8476) +- [plugin] added `CompletionItemTag` enum [#8517](https://github.com/eclipse-theia/theia/pull/8517) +- [plugin] added `DebugConsoleMode` enum [#8513](https://github.com/eclipse-theia/theia/pull/8513) +- [plugin] added `authentication` plugin API [#8402](https://github.com/eclipse-theia/theia/pull/8402) +- [plugin] added `revealInExplorer` command [#8496](https://github.com/eclipse-theia/theia/pull/8496) +- [plugin] fixed issue related to getting the default value from `globalState`/`workspaceState` [#8424](https://github.com/eclipse-theia/theia/pull/8424) +- [plugin] removed superfluous channel caching for extensions [#8476](https://github.com/eclipse-theia/theia/pull/8476) +- [plugin] updated `vscode.findFiles` API to handle ignored files [#8452](https://github.com/eclipse-theia/theia/pull/8452) +- [plugin] updated plugin storage path to be FIPS-compliant [#8379](https://github.com/eclipse-theia/theia/pull/8379) +- [plugin] updated task ID generation logic [#8379](https://github.com/eclipse-theia/theia/pull/8379) +- [preferences] updated the rendering of preference category headers and leaves [#8512](https://github.com/eclipse-theia/theia/pull/8512) +- [scm] fixed activation request of the scm-widget [#8508](https://github.com/eclipse-theia/theia/pull/8508) +- [search-in-workspace] added handling to respect the `files.exclude` preference when searching [#8433](https://github.com/eclipse-theia/theia/pull/8433) +- [timeline] added the `@theia/timeline` extension [#7997](https://github.com/eclipse-theia/theia/pull/7997) + +[Breaking Changes:](#breaking_changes_1.6.0) + +- [core] context-menus for `tab-bars` now require an `Event` to be passed to execute commands without activating the shell `tab-bar` [#6965](https://github.com/eclipse-theia/theia/pull/6965) + - Removed logic from `TabBarRenderer.handleContextMenuEvent()` to support triggering context-menus without the need to activate the widget. + - When registering a command, `Event` should be passed, else commands will not work correctly as they do no longer rely on the activation of `tab-bars`. +- [core] refactored `findTitle()` and `findTabBar()` moving them from `common-frontend-contribution.ts` to `application-shell.ts` [#6965](https://github.com/eclipse-theia/theia/pull/6965) + +## v1.5.0 - 27/08/2020 + +- [application-manager] fixed issue regarding reloading electron windows [#8345](https://github.com/eclipse-theia/theia/pull/8345) +- [application-package] fixed incorrect app config defaults [#8355](https://github.com/eclipse-theia/theia/pull/8355) +- [cli] updated `download:plugins` script to use `decompress` [#8315](https://github.com/eclipse-theia/theia/pull/8315) +- [core] added `badge` count for the `problems-view` [#8156](https://github.com/eclipse-theia/theia/pull/8156) +- [core] added setting menu items to the sidebar bottom menus [#8372](https://github.com/eclipse-theia/theia/pull/8372) +- [core] added support for `badge` count tab decorations [#8156](https://github.com/eclipse-theia/theia/pull/8156) +- [core] added support for registering custom menu nodes [#8404](https://github.com/eclipse-theia/theia/pull/8404) +- [core] added support for sidebar bottom menus [#8372](https://github.com/eclipse-theia/theia/pull/8372) +- [core] added support for tree indent guidelines [#8298](https://github.com/eclipse-theia/theia/pull/8298) +- [core] fixed submenu ordering [#8377](https://github.com/eclipse-theia/theia/pull/8377) +- [core] fixed the menu widget layout [#8419](https://github.com/eclipse-theia/theia/pull/8419) +- [core] updated extensibility of `DefaultUriLabelProviderContribution` [#8281](https://github.com/eclipse-theia/theia/pull/8281) +- [debug] added `badge` count for active debug sessions [#8342](https://github.com/eclipse-theia/theia/pull/8342) +- [debug] fixed debug exception height computation [#8382](https://github.com/eclipse-theia/theia/pull/8382) +- [dependencies] updated `node-gyp` to `7.0.0` [#8216](https://github.com/eclipse-theia/theia/pull/8216) +- [documentation] updated extension documentation [#8279](https://github.com/eclipse-theia/theia/pull/8279) +- [filesystem] added handling to prevent opening files which are too large [#8152](https://github.com/eclipse-theia/theia/pull/8152) +- [filesystem] added handling to prompt end-users before opening binary files [#8152](https://github.com/eclipse-theia/theia/pull/8152) +- [keymaps] updated keymaps to use monaco models [#8313](https://github.com/eclipse-theia/theia/pull/8313) +- [monaco] added handling to prevent opening dirty editors if `autoSave` is enabled [#8329](https://github.com/eclipse-theia/theia/pull/8329) +- [monaco] updated grammar collision logging [#8418](https://github.com/eclipse-theia/theia/pull/8418) +- [monaco] upgraded to monaco `0.20.0` [#8010](https://github.com/eclipse-theia/theia/pull/8010) +- [navigator] added `badge` count for dirty editors in the `explorer` [#8316](https://github.com/eclipse-theia/theia/pull/8316) +- [navigator] updated `open` command to only be enabled for files [#8228](https://github.com/eclipse-theia/theia/pull/8228) +- [navigator] updated duplicate keybinding for opening the preferences widget [#8256](https://github.com/eclipse-theia/theia/pull/8256) +- [output] exposed `preserveFocus` to `OutputChannel#show` to reveal but not activate the widget [#8243](https://github.com/eclipse-theia/theia/pull/8243) +- [output] fixed editor resizing issue [#8362](https://github.com/eclipse-theia/theia/pull/8362) +- [plugin] added handling to prevent activating plugins eagerly on unsupported events [#8396](https://github.com/eclipse-theia/theia/pull/8396) +- [plugin] added support for `ResourceLabelFormatter` API [#8187](https://github.com/eclipse-theia/theia/pull/8187) +- [plugin] added support for `vscode.workspace.fs` API [#7908](https://github.com/eclipse-theia/theia/pull/7908) +- [plugin] fixed `local-dir` path resolution [#8385](https://github.com/eclipse-theia/theia/pull/8385) +- [plugin] marked `onFileSystem` event as supported [#8320](https://github.com/eclipse-theia/theia/pull/8320) +- [preferences] added input field validation for numbers [#8264](https://github.com/eclipse-theia/theia/pull/8264) +- [preferences] removed hardcoded constants [#8313](https://github.com/eclipse-theia/theia/pull/8313) +- [scm] added `collapse-all` command and toolbar item [#8247](https://github.com/eclipse-theia/theia/pull/8247) +- [scm] added `badge` count for the `scm-view` [#8156](https://github.com/eclipse-theia/theia/pull/8156) +- [security] fixed usage of `stylesheet.innerHTML` [#8397](https://github.com/eclipse-theia/theia/pull/8397) +- [security] updated version range of `decompress` to fix the known [security vulnerability](https://snyk.io/vuln/SNYK-JS-DECOMPRESS-557358) [#8924](https://github.com/eclipse-theia/theia/pull/8294) + - Note: the updated dependency may have a [performance impact](https://github.com/eclipse-theia/theia/pull/7715#issuecomment-667434288) on the deployment of plugins. +- [task] removed superfluous notifications when tasks are started / ended [#8331](https://github.com/eclipse-theia/theia/pull/8331) +- [tests] added api integration tests for `scm` [#8231](https://github.com/eclipse-theia/theia/pull/8231) + +- [[electron]](#1_5_0_electron_main_extension) Electron applications can now be configured/extended through `inversify`. Added new `electronMain` extension points to provide inversify container modules. [#8076](https://github.com/eclipse-theia/theia/pull/8076) + +[Breaking Changes:](#breaking_changes_1.5.0) + +- [core] removed `KeybindingRegistry#getScopedKeybindingsForCommand` [#8283](https://github.com/eclipse-theia/theia/pull/8283) +- [application-package] removed `isOutdated` from `ExtensionPackage` [#8295](https://github.com/eclipse-theia/theia/pull/8295) +- [application-package] removed `getLatestVersion` from `ExtensionPackage` [#8295](https://github.com/eclipse-theia/theia/pull/8295) +- [application-package] removed `getVersionRange` from `ExtensionPackage` [#8295](https://github.com/eclipse-theia/theia/pull/8295) +- [application-package] removed `resolveVersionRange` from `ExtensionPackage` [#8295](https://github.com/eclipse-theia/theia/pull/8295) +- [output] `OutputWidget#setInput` has been removed. The _Output_ view automatically shows the channel when calling `OutputChannel#show`. Moved the `OutputCommands` namespace from the `output-contribution` to its dedicated `output-commands` module to overcome a DI cycle. [#8243](https://github.com/eclipse-theia/theia/pull/8243) +- [example-app] updated `yarn.lock` so that the latest version of `vscode-ripgrep` is used (`v1.8.0`). This way we can benefit from the recently added support for it using proxy settings when fetching the platform-specific `ripgrep` executable, after npm package install. This should make it a lot easier to build our example application in corporate settings, behind a firewall. [#8280](https://github.com/eclipse-theia/theia/pull/8280) + - Note to downstream IDE designers: this change will not have an effect beyond the example application of the repository. If it's desirable for your product to have the latest `vscode-ripgrep`, you should do similarly in your own `yarn.lock`. + +- [[filesystem]](#1.5.0_deprecate_file_system) `FileSystem` and `FileSystemWatcher` services are deprecated [#7908](https://github.com/eclipse-theia/theia/pull/7908) + - On the backend there is no more `FileSystem` implementation. One has to use Node.js APIs instead. + - On the frontend, the `FileService` should be used instead. It was ported from VS Code for compatibility with VS Code extensions. + - On the frontend, the `EnvVariableServer` should be used instead to access the current user home and available drives. + +- [[userstorage]](#1.5.0_userstorage_as_fs_provider) `UserStorageService` was replaced by the user data fs provider [#7908](https://github.com/eclipse-theia/theia/pull/7908) + +- [[webview]](#1.5.0_webview_resource_streaming) webview resources are streamed instead of loading one by one the entire content and blocking the web socket [#8359](https://github.com/eclipse-theia/theia/pull/8359) + - Consequently, `WebviewResourceLoader` is removed. One should change `DiskFileSystemProvider` to customize resource loading instead. + +- [[user-storage]](#1.5.0_root_user_storage_uri) settings URI must start with `/user` root to satisfy expectations of `FileService` [#8313](https://github.com/eclipse-theia/theia/pull/8313) + - If you implement a custom user storage make sure to check old relative locations, otherwise it can cause user data loss. + +- [[electron]](#1_5_0_electron_window_options_ipc) Removed the `set-window-options` and `get-persisted-window-options-additions` Electron IPC handlers from the Electron Main process. + +- [[monaco]](#1.5.0_non_blocking_bulk_edit) `MonacoWorkspace.applyBulkEdit` does not open any editors anymore to avoid blocking [#8329](https://github.com/eclipse-theia/theia/pull/8329) + - Consequently, it does not accept editor opener options, and `MonacoWorkspace.openEditors` and `MonacoWorkspace.toTextEditWithEditor` are removed. + +- [[theming]](#1.5.0_declarative_default_themes) Default color and icon themes should be declared in the application `package.json`. [#8381](https://github.com/eclipse-theia/theia/pull/8381) + + ```json + "theia": { + "frontend": { + "config": { + "defaultTheme": "light", + "defaultIconTheme": "vs-seti" + } + } + }, + ``` + + - Consequently, `ThemeService` and `IconThemeService` don't allow to change the default color or icon theme anymore. + +- [[repo]](#1_5_0_drop_node_10_support) support for `Node 10` is dropped. [#8290](https://github.com/eclipse-theia/theia/pull/8290) + - From now on, Node.js `12.x` is required when building.\ + The recommended minimum version is aligned with `electron` (Node.js `12.14.1`). + +## v1.4.0 - 30/07/2020 + +- [core] added support for Node.js `12.x` [#7968](https://github.com/eclipse-theia/theia/pull/7968) + - From now on, you can use Node.js `12.x` to build Theia from sources. The recommended minimum version is aligned with `electron` (Node.js `12.14.1`). + - Support for Node.js `10.x` will be dropped in one of the forthcoming releases. +- [core] fixed handling of environment variables on Windows [#7973](https://github.com/eclipse-theia/theia/pull/7973) +- [core] fixed issue when selecting a tree node after performing a manual scroll [#8154](https://github.com/eclipse-theia/theia/pull/8154) +- [debug] added a `select and run` debug statusbar item [#8134](https://github.com/eclipse-theia/theia/pull/8134) +- [debug] added handling to perform `save` when starting a debug session [#8115](https://github.com/eclipse-theia/theia/pull/8115) +- [debug] addressed an issue not awaiting the result of the debug handler [#8117](https://github.com/eclipse-theia/theia/pull/8117) +- [editor] added handling to perform a `save all` when turning `auto-save` on [#8163](https://github.com/eclipse-theia/theia/pull/8163) +- [editor] improved extensibility of menu and keybinding contributions [#8188](https://github.com/eclipse-theia/theia/pull/8188) +- [git] fixed the opening of deleted files [#8107](https://github.com/eclipse-theia/theia/pull/8107) +- [markers] added `problems.autoReveal` preference to control sync between editors and the problem-view [#8172](https://github.com/eclipse-theia/theia/pull/8172) +- [monaco] improved extensibility of menu and keybinding contributions [#8188](https://github.com/eclipse-theia/theia/pull/8188) +- [monaco] normalized base pattern path to support different operating systems [#8268](https://github.com/eclipse-theia/theia/pull/8268) +- [monaco] removed unused dependencies [#8109](https://github.com/eclipse-theia/theia/pull/8109) +- [navigator] added `copy relative path` to the explorer context-menu and command palette [#8092](https://github.com/eclipse-theia/theia/pull/8092) +- [output] added `copy all` context-menu item for the output-view [#8057](https://github.com/eclipse-theia/theia/pull/8057) +- [plugin] added command `copyRelativeFilePath` [#8092](https://github.com/eclipse-theia/theia/pull/8092) +- [plugin] added support for `resolveDebugConfigurationWithSubstitutedVariables` API [#8253](https://github.com/eclipse-theia/theia/pull/8253) +- [plugin] added support for `vscode.workspace.findTextInFiles` API [#7868](https://github.com/eclipse-theia/theia/pull/7868) +- [plugin] added support for theme icons [#8267](https://github.com/eclipse-theia/theia/pull/8267) +- [plugin] fixed focused handling of webviews when dismissing the quick-open widget [#8137](https://github.com/eclipse-theia/theia/pull/8137) +- [plugin] fixed the display of file-icons with a dot in the name [#7680](https://github.com/eclipse-theia/theia/pull/7680) +- [plugin] fixed the modal dialog max size and text-wrapping [#8080](https://github.com/eclipse-theia/theia/pull/8080) +- [plugin] improved handling of the plugin host activation exceptions [#8103](https://github.com/eclipse-theia/theia/pull/8103) +- [plugin] removed unnecessary slash at the end of the `pluginPath` [#8045](https://github.com/eclipse-theia/theia/pull/8045) +- [plugin] updated logic to allow `Command` type in statusbar items [#8253](https://github.com/eclipse-theia/theia/pull/8253) +- [plugin] updated logic to allow `vsix` without publishers to be loaded [#8196](https://github.com/eclipse-theia/theia/pull/8196) +- [repo] removed unused resolution for `vscode-json-languageserver` [#8132](https://github.com/eclipse-theia/theia/pull/8132) +- [search-in-workspace] improved search behavior to only trigger search on input change or ENTER [#8229](https://github.com/eclipse-theia/theia/pull/8229) +- [task] fixed an issue where `onDidEndTaskProcess` was not fired for plugins when task ended [#8141](https://github.com/eclipse-theia/theia/pull/8141) +- [task] introduced a token to scope contributed tasks [#7996](https://github.com/eclipse-theia/theia/pull/7996) +- [terminal] fixed xterm issue causing an extraneous 'cursor-like' overlay element [#8204](https://github.com/eclipse-theia/theia/pull/8204) +- [test] improved api-tests by increasing timeout so plugin views can be properly prepared [#8151](https://github.com/eclipse-theia/theia/pull/8151) +- [test] updated api-tests to use tmp directory for user data [#8151](https://github.com/eclipse-theia/theia/pull/8151) +- [vsx-registry] fixed the `licenseUrl` link for builtin and installed extensions [#8095](https://github.com/eclipse-theia/theia/pull/8095) +- [vsx-registry] improved styling of the detailed extension view [#8086](https://github.com/eclipse-theia/theia/pull/8086) +- [workspace] improved extensibility of menu and keybinding contributions [#8188](https://github.com/eclipse-theia/theia/pull/8188) + +[Breaking Changes:](#breaking_changes_1.4.0) + +- [core] fixed typo (`matchKeybiding` to `matchKeybinding`) in `KeybindingRegistry` [#8193](https://github.com/eclipse-theia/theia/pull/8193) +- [preferences] removed unused variable `PreferencesWidget.COMMAND_LABEL` [#8249](https://github.com/eclipse-theia/theia/pull/8249) +- [preferences] renamed file `preference-contribution.ts` to `preferences-contribution.ts` [#8237](https://github.com/eclipse-theia/theia/pull/8237) +- [terminal] fixed typo (`rezize` to `resize`) in `TerminalWidget` [#8193](https://github.com/eclipse-theia/theia/pull/8193) + +- [[json]](#1_4_0_replace_json) replaced `@theia/json` Theia extension with `vscode.json-language-features` VS Code extension [#8112](https://github.com/eclipse-theia/theia/pull/8112) + - You can register JSON validations at application startup by implementing `JsonSchemaContribution` Theia contribution point. + - Alternatively you can provide JSON validations using VS Code [contributes.jsonValidation](https://code.visualstudio.com/api/references/contribution-points#contributes.jsonValidation) contribution point. + +- [[user-storage]](#1_4_0_absolute_user_storage_uri) settings URI must be an absolute to satisfy expectations of `vscode.json-language-features` [#8112](https://github.com/eclipse-theia/theia/pull/8112) + - If you implement a custom user storage make sure to check old relative locations, otherwise it can cause user data loss. + +- [[languages]](#1_4_0_deprecate_languages) `@theia/languages` extension is deprecated, use VS Code extensions to provide language smartness: + [#8112](https://github.com/eclipse-theia/theia/pull/8112) + +## v1.3.0 - 25/06/2020 + +- [cli] updated the download script to warn about mandatory `theiaPlugins` field [#8058](https://github.com/eclipse-theia/theia/pull/8058) +- [core] added `copy path` command [#7934](https://github.com/eclipse-theia/theia/pull/7934) +- [core] added missing `vscode-languageserver-protocol` dependency [#8036](https://github.com/eclipse-theia/theia/pull/8036) +- [core] adds support for ordering submenus [#7963](https://github.com/eclipse-theia/theia/pull/7963) +- [core] implemented a context-menu for `input` and `textArea` fields [#7943](https://github.com/eclipse-theia/theia/pull/7943) +- [core] improved sub-classing of `messaging` [#8008](https://github.com/eclipse-theia/theia/pull/8008) +- [core] updated `react` and `react-dom` to v16.8 [#7883](https://github.com/eclipse-theia/theia/pull/7883) +- [debug] added support for inline variable values [#7921](https://github.com/eclipse-theia/theia/pull/7921) +- [editor] updated the default tokenization length [#8027](https://github.com/eclipse-theia/theia/pull/8027) +- [filesystem] exposed `nsfw` to downstream `NsfwFilesystemWatcher` [#7465](https://github.com/eclipse-theia/theia/pull/7465) +- [filesystem] fixed file filter issue in the `FileDialog` [#8073](https://github.com/eclipse-theia/theia/pull/8073) +- [filesystem] improved `isInSync` method [#8044](https://github.com/eclipse-theia/theia/pull/8044) +- [filesystem] updated minimatch when ignoring to include folders starting with a dot [#8074](https://github.com/eclipse-theia/theia/pull/8074) +- [markers] added the `clear-all` command for the problems-view [#8002](https://github.com/eclipse-theia/theia/pull/8002) +- [monaco] added support for `vscode-builtin-css-language-features` [#7972](https://github.com/eclipse-theia/theia/pull/7972) +- [monaco] added support for `vscode-builtin-html-language-features` [#7972](https://github.com/eclipse-theia/theia/pull/7972) +- [monaco] exposed `toOpenModel` method [#8024](https://github.com/eclipse-theia/theia/pull/8024) +- [output] added scroll-lock to the output view [#7570](https://github.com/eclipse-theia/theia/pull/7570) +- [output] added support for special output URI characters [#8046](https://github.com/eclipse-theia/theia/pull/8046) +- [plugin] added command `copyFilePath` [#7934](https://github.com/eclipse-theia/theia/pull/7934) +- [plugin] added support for `env.uiKind` API [#8038](https://github.com/eclipse-theia/theia/pull/8038) +- [plugin] added support for `workbench.view.explorer` command [#7965](https://github.com/eclipse-theia/theia/pull/7965) +- [plugin] added support for the `Task2` class [#8000](https://github.com/eclipse-theia/theia/pull/8000) +- [plugin] added the registration of view-containers in the `open view` menu [#8034](https://github.com/eclipse-theia/theia/pull/8034) +- [plugin] fixed handling to not fail if a command returns a non-serializable result or error [#7957](https://github.com/eclipse-theia/theia/pull/7957) +- [plugin] implemented the pseudo terminal plugin API [#7925](https://github.com/eclipse-theia/theia/pull/7925) +- [plugin] improved activation of views to ensure they are ready before activated [#7957](https://github.com/eclipse-theia/theia/pull/7957) +- [preferences] fixed modified scope label for updated preferences [#8025](https://github.com/eclipse-theia/theia/pull/8025) +- [preferences] improved the statefulness of the preferences when switching scopes [#7936](https://github.com/eclipse-theia/theia/pull/7936) +- [preview] added sanitization of the markdown text for security purposes [#7971](https://github.com/eclipse-theia/theia/pull/7971) +- [scm] added multi-select support for the 'source control manager' view [#7900](https://github.com/eclipse-theia/theia/pull/7900) +- [scm] fixed the `scm` tree to sort results correctly [#8048](https://github.com/eclipse-theia/theia/pull/8048) +- [search-in-workspace] fixed incorrect or duplicate search results [#7990](https://github.com/eclipse-theia/theia/pull/7990) +- [task] added `detail` property to the task configuration schema [#8000](https://github.com/eclipse-theia/theia/pull/8000) +- [task] added support to update user-level tasks [#7928](https://github.com/eclipse-theia/theia/pull/7928) +- [task] fixed error due to incorrect `RevealKind` and `PanelKind` enums [#7982](https://github.com/eclipse-theia/theia/pull/7982) +- [task] included global tasks in the 'configure tasks' menu [#7929](https://github.com/eclipse-theia/theia/pull/7929) +- [vsx-registry] adjusted the width of the search input [#7984](https://github.com/eclipse-theia/theia/pull/7984) +- [vsx-registry] included 'extensions-view' in the default layout [#7944](https://github.com/eclipse-theia/theia/pull/7944) +- [workspace] added logic preventing arbitrary files from being opened as a workspace [#7922](https://github.com/eclipse-theia/theia/pull/7922) + +Breaking Changes: + +- [task] Widened the scope of some methods in TaskManager and TaskConfigurations from string to TaskConfigurationScope. This is only breaking for extenders, not callers. [#7928](https://github.com/eclipse-theia/theia/pull/7928) +- [shell] updated `ApplicationShell.TrackableWidgetProvider.getTrackableWidgets` to be synchronous in order to register child widgets in the same tick [#7957](https://github.com/eclipse-theia/theia/pull/7957) + - use `ApplicationShell.TrackableWidgetProvider.onDidChangeTrackableWidgets` if child widgets are added asynchronously + +## v1.2.0 - 28/05/2020 + +- [application-manager] added ability for clients to add `windowOptions` using an IPC-Event [#7803](https://github.com/eclipse-theia/theia/pull/7803) +- [application-package] added ability for clients to change the default `windowOptions` [#7803](https://github.com/eclipse-theia/theia/pull/7803) +- [cli] improved the handling of the `download:plugins` script [#7747](https://github.com/eclipse-theia/theia/pull/7747) +- [cli] support proxy settings in the `download:plugins` script [#7747](https://github.com/eclipse-theia/theia/pull/7747) +- [cli] updated the `download:plugins` script to display errors at the end of the script [#7881](https://github.com/eclipse-theia/theia/pull/7881) +- [core] added handling of nested default values in preference proxies [#6921](https://github.com/eclipse-theia/theia/pull/6921) +- [core] added handling to properly cleanup `toDisposeOnActiveChanged` [#7894](https://github.com/eclipse-theia/theia/pull/7894) +- [core] added handling to respect the keybinding scope and registration order during evaluation [#7839](https://github.com/eclipse-theia/theia/pull/7839) +- [core] added support for `next/previous` tab group commands [#7707](https://github.com/eclipse-theia/theia/pull/7707) +- [core] added support for `next/previous` tab in group commands [#7707](https://github.com/eclipse-theia/theia/pull/7707) +- [core] fixed collapsed state when restoring view-container parts [#7893](https://github.com/eclipse-theia/theia/pull/7893) +- [dependency] fixed issue with `momentjs` dependency [#7727](https://github.com/eclipse-theia/theia/pull/7727) +- [dependency] upgraded `decompress` to `4.2.0` [#7715](https://github.com/eclipse-theia/theia/pull/7715) +- [dependency] upgraded `uuid` to `8.0.0` [#7749](https://github.com/eclipse-theia/theia/pull/7749) +- [dependency] upgraded to TypeScript `3.9.2` [#7807](https://github.com/eclipse-theia/theia/pull/7807) +- [editor-preview] improved the editor-preview height [#6921](https://github.com/eclipse-theia/theia/pull/6921) +- [editor] improved focus handling of editors to default to the last visible editor [#7707](https://github.com/eclipse-theia/theia/pull/7707) +- [electron] fixed rendering of the electron context-menu [#7735](https://github.com/eclipse-theia/theia/pull/7735) +- [electron] fixed resolution of hostname placeholder [#7823](https://github.com/eclipse-theia/theia/pull/7823) +- [electron] fixed the rendering of webviews on electron [#7847](https://github.com/eclipse-theia/theia/pull/7847) +- [electron] improved rendering of electron context-menus to hide disabled menu items [#7869](https://github.com/eclipse-theia/theia/pull/7869) +- [electron] removed global shortcuts if the electron window is not focused [#7817](https://github.com/eclipse-theia/theia/pull/7817) +- [file-search] improved the handling of the quick-file open [#7846](https://github.com/eclipse-theia/theia/pull/7846) +- [filesystem] fixed issue where file-icons were not properly aligned when the file name is truncated [#7730](https://github.com/eclipse-theia/theia/pull/7730) +- [getting-started] updated the documentation urls [#7855](https://github.com/eclipse-theia/theia/pull/7855) +- [git] added handling to set upstream remote branch when pushing [#7866](https://github.com/eclipse-theia/theia/pull/7866) +- [git] fixed issue causing no repositories to be found [#7870](https://github.com/eclipse-theia/theia/pull/7870) +- [monaco] added handling of internal open calls with the `OpenerService` [#6921](https://github.com/eclipse-theia/theia/pull/6921) +- [monaco] added handling to only focus the editor if it is revealed [#7903](https://github.com/eclipse-theia/theia/pull/7903) +- [monaco] fixed issue to detect languages on mime association changes [#7805](https://github.com/eclipse-theia/theia/pull/7805) +- [monaco] fixed the border color for the find widget [#7835](https://github.com/eclipse-theia/theia/pull/7835) +- [navigator] added handling to select newly created files/folders in the explorer [#7762](https://github.com/eclipse-theia/theia/pull/7762) +- [output] improved the output-view display [#7827](https://github.com/eclipse-theia/theia/pull/7827) +- [plugin] added handling of quick pick/input cancellations [#6921](https://github.com/eclipse-theia/theia/pull/6921) +- [plugin] added support for `CompletionItem.range` shape [#7820](https://github.com/eclipse-theia/theia/pull/7820) +- [plugin] added support for `explorer.newFolder` command [#7843](https://github.com/eclipse-theia/theia/pull/7843) +- [plugin] added support for `workbench.action.revertAndCloseActiveEditor` API [#7702](https://github.com/eclipse-theia/theia/pull/7702) +- [plugin] added support for the `vscode.workspace.fs` APIs for registered filesystem providers only (not yet real file system) [#7824](https://github.com/eclipse-theia/theia/pull/7824) +- [plugin] added support for the `workbench.action.openRecent` command [#7812](https://github.com/eclipse-theia/theia/pull/7812) +- [plugin] added support for the `workspace` API `onDidCreateFiles` [#7718](https://github.com/eclipse-theia/theia/pull/7718) +- [plugin] added support for the `workspace` API `onDidDeleteFiles` [#7718](https://github.com/eclipse-theia/theia/pull/7718) +- [plugin] added support for the `workspace` API `onDidRenameFiles` [#7718](https://github.com/eclipse-theia/theia/pull/7718) +- [plugin] added support for the `workspace` API `onWillCreateFiles` [#7718](https://github.com/eclipse-theia/theia/pull/7718) +- [plugin] added support for the `workspace` API `onWillDeleteFiles` [#7718](https://github.com/eclipse-theia/theia/pull/7718) +- [plugin] added support for the `workspace` API `onWillRenameFiles` [#7718](https://github.com/eclipse-theia/theia/pull/7718) +- [plugin] added support for the command `terminal.kill` [#7906](https://github.com/eclipse-theia/theia/pull/7906) +- [plugin] added support for the command `terminalSendSequence` [#7906](https://github.com/eclipse-theia/theia/pull/7906) +- [plugin] added support for when-closures for the quick-view palette [#6921](https://github.com/eclipse-theia/theia/pull/6921) +- [plugin] fixed `registerCommand` API incompatibilities [#7296](https://github.com/eclipse-theia/theia/pull/7296) +- [plugin] fixed issue where contributed views had blank square icons on reload [#7756](https://github.com/eclipse-theia/theia/pull/7756) +- [plugin] fixed leaking filesystem resource [#6921](https://github.com/eclipse-theia/theia/pull/6921) +- [plugin] fixed potential activation deadlock [#6921](https://github.com/eclipse-theia/theia/pull/6921) +- [plugin] fixed synching of visible and active editors [#6921](https://github.com/eclipse-theia/theia/pull/6921) +- [plugin] fixed the computing of external icon urls [#6921](https://github.com/eclipse-theia/theia/pull/6921) +- [plugin] fixed the tree-view reveal [#6921](https://github.com/eclipse-theia/theia/pull/6921) +- [plugin] fixed the update of quick-pick items [#6921](https://github.com/eclipse-theia/theia/pull/6921) +- [plugin] updated handling of plugin folder paths [#7799](https://github.com/eclipse-theia/theia/pull/7799) +- [plugin] updated handling to not require non-existing plugin main [#7852](https://github.com/eclipse-theia/theia/pull/7852) +- [preferences] improved the `preferences` widget user-interface [#7105](https://github.com/eclipse-theia/theia/pull/7105) +- [scm] added `scm.defaultViewMode` preference to control the display of the `scm` widget [#7717](https://github.com/eclipse-theia/theia/pull/7717) +- [scm] added handling to refresh widget on activation [#7880](https://github.com/eclipse-theia/theia/pull/7880) +- [scm] added support for displaying the `scm` view as a tree [#7505](https://github.com/eclipse-theia/theia/pull/7505) +- [scm] fixed missing commit and amend functionality when opening a new workspace [#7769](https://github.com/eclipse-theia/theia/pull/7769) +- [scm] fixed restoring last commit message [#7818](https://github.com/eclipse-theia/theia/pull/7818) +- [task] added support for user-level task configurations [#7620](https://github.com/eclipse-theia/theia/pull/7620) +- [task] fixed task execution on macOS with `zsh` [#7889](https://github.com/eclipse-theia/theia/pull/7889) +- [task] improved order of task configurations [#7696](https://github.com/eclipse-theia/theia/pull/7696) +- [task] updated the when-closure when executing `Run Last Task` [#7890](https://github.com/eclipse-theia/theia/pull/7890) +- [terminal] added handling to detach the `TerminalSearchWidget` before disposing the `TerminalWidget` [#7882](https://github.com/eclipse-theia/theia/pull/7882) +- [workspace] added the `workspaceState` when-closure context [#7846](https://github.com/eclipse-theia/theia/pull/7846) + +Breaking changes: + +- [application-package] moved `disallowReloadKeybinding` under the `electron` subsection [#7803](https://github.com/eclipse-theia/theia/pull/7803) +- [core] `KeybindingRegistry` registers a new keybinding with a higher priority than previously in the same scope [#7839](https://github.com/eclipse-theia/theia/pull/7839) +- [scm] added support for `tree view mode` in the `scm` view [#7505](https://github.com/eclipse-theia/theia/pull/7505) + - classes that currently extend `ScmWidget` will likely require changes. +- [task] removed `taskId` from `TaskTerminalWidgetOpenerOptions` [#7765](https://github.com/eclipse-theia/theia/pull/7765) + +## v1.1.0 - 30/04/2020 + +- [application-manager] added meta tag to enable fullscreen on iOS devices [#7663](https://github.com/eclipse-theia/theia/pull/7663) +- [application-package] added warning if an unknown target is provided [#7578](https://github.com/eclipse-theia/theia/pull/7578) +- [application-package] updated default application name from 'Theia' to 'Eclipse Theia' [#7656](https://github.com/eclipse-theia/theia/pull/7656) +- [cli] improved the `download:plugins` script including performance and error handling [#7677](https://github.com/eclipse-theia/theia/pull/7677) +- [cli] updated the `download:plugins` script to include colors for better visibility [#7648](https://github.com/eclipse-theia/theia/pull/7648) +- [core] added functionality to prevent pasting into the active editor when closing a tab with a middle mouse click [#7565](https://github.com/eclipse-theia/theia/pull/7565) +- [core] added support to allow providing a custom node for ReactWidget [#7422](https://github.com/eclipse-theia/theia/pull/7422) +- [core] aligned max listeners check with VS Code expectations [#7508](https://github.com/eclipse-theia/theia/pull/7508) +- [core] fixed 'recently used commands' to be only added when triggered by the quick-command palette [#7552](https://github.com/eclipse-theia/theia/pull/7552) +- [core] fixed 'recently used commands': [#7562](https://github.com/eclipse-theia/theia/pull/7562) + - added sorting of commands based on their human-readable label + - fixed issue where recently used commands where not correctly separated by a border and groupName +- [core] fixed issue where menu args where unnecessarily wrapped into another array [#7622](https://github.com/eclipse-theia/theia/pull/7622) +- [core] fixed leaking `DisposableCollection.onDispose` event [#7508](https://github.com/eclipse-theia/theia/pull/7508) +- [core] fixed release of leaking editor from quick-open and goto references [#7508](https://github.com/eclipse-theia/theia/pull/7508) +- [core] improved display for the 'Remove Folder from Workspace` dialog [#7449](https://github.com/eclipse-theia/theia/pull/7449) +- [core] upgraded `nsfw` to 1.2.9 [#7535](https://github.com/eclipse-theia/theia/pull/7535) +- [core] upgraded `vscode-uri` to version ^2.1.1 [#7506](https://github.com/eclipse-theia/theia/pull/7506) +- [core] upgraded to LSP 6.0.0 [#7149](https://github.com/eclipse-theia/theia/pull/7149) +- [documentation] updated developing documentation for Windows [#7640](https://github.com/eclipse-theia/theia/pull/7640) +- [editor] updated binding of `EditorCommandContribution` and `EditorMenuContribution` [#7569](https://github.com/eclipse-theia/theia/pull/7569) +- [electron] added functionality to fork the backend unless `--no-cluster` flag is specified [#7386](https://github.com/eclipse-theia/theia/pull/7386) +- [electron] added functionality to pass arguments to the backend process [#7386](https://github.com/eclipse-theia/theia/pull/7386) +- [electron] fixed setting `process.versions.electron` for sub-processes [#7386](https://github.com/eclipse-theia/theia/pull/7386) +- [git] disabled the 'Git Initialize Repository' action when no workspace is opened [#7492](https://github.com/eclipse-theia/theia/pull/7492) +- [git] updated `successExitCodes` and `expectedErrors` to arrays to fix serialization [#7627](https://github.com/eclipse-theia/theia/pull/7627) +- [keymaps] updated the keybindings-widget sorting, and added category as part of the label if applicable [#7532](https://github.com/eclipse-theia/theia/pull/7532) +- [monaco] added handling to respect `editor.maxTokenizationLineLength` preference [#7618](https://github.com/eclipse-theia/theia/pull/7618) +- [monaco] fixed incorrect `isChord` call [#7468](https://github.com/eclipse-theia/theia/pull/7468) +- [monaco] reworked Monaco commands to align with VS Code [#7539](https://github.com/eclipse-theia/theia/pull/7539) +- [monaco] upgraded `onigasm` to version ^2.2.0 fixing syntax-highlighting [#7610](https://github.com/eclipse-theia/theia/pull/7610) +- [monaco] upgraded to Monaco version 0.19.3 [#7149](https://github.com/eclipse-theia/theia/pull/7149) +- [outline-view] fixed keybinding collision between toggling the outline-view and performing 'format document' on Linux [#7694](https://github.com/eclipse-theia/theia/pull/7694) +- [output] added `Select All` in the output-view [#7523](https://github.com/eclipse-theia/theia/pull/7523) +- [output] added optional argument `severity` to `OutputChannel.appendLine` method for coloring [#7549](https://github.com/eclipse-theia/theia/pull/7549) +- [plugin-ext] fixed custom icon themes and icons for Electron [#7583](https://github.com/eclipse-theia/theia/pull/7583) +- [plugin] added ability to override built-in commands [#7592](https://github.com/eclipse-theia/theia/pull/7592) +- [plugin] added additional `vscode.execute...` commands [#7563](https://github.com/eclipse-theia/theia/pull/7563) +- [plugin] added functionality preventing F1 and ctrlcmd+p hotkeys in a webview iframe [#7496](https://github.com/eclipse-theia/theia/pull/7496) +- [plugin] added functionality which makes `env.appName` reuse the value of `applicationName` (as defined in the `package.json`) [#7642](https://github.com/eclipse-theia/theia/pull/7642) +- [plugin] added sorting of plugin in the plugins-view [#7601](https://github.com/eclipse-theia/theia/pull/7601) +- [plugin] added support for `SelectionRange` and `SelectionRangeProvider` VS Code API [#7534](https://github.com/eclipse-theia/theia/pull/7534) +- [plugin] aligned message-service behavior with VS Code [#7500](https://github.com/eclipse-theia/theia/pull/7500) +- [plugin] fixed error handling when selecting an invalid node for hosted-plugins [#7636](https://github.com/eclipse-theia/theia/pull/7636) +- [plugin] fixed incompatibility issues with `SaveFileDialog` [#7461](https://github.com/eclipse-theia/theia/pull/7461) +- [plugin] fixed late textmate-grammar activation [#7544](https://github.com/eclipse-theia/theia/pull/7544) +- [plugin] fixed overriding of built-in Monaco commands [#7539](https://github.com/eclipse-theia/theia/pull/7539) +- [plugin] fixed parsing of DAP messages to match VS Code API [#7517](https://github.com/eclipse-theia/theia/pull/7517) +- [plugin] removed filtering of duplicate tasks [#7676](https://github.com/eclipse-theia/theia/pull/7676) +- [plugin] removed registration of commands provided by Monaco [#7592](https://github.com/eclipse-theia/theia/pull/7592) +- [plugin] removed unused injections of `ResourceProvider` [#7595](https://github.com/eclipse-theia/theia/pull/7595) +- [plugin] updated the VS Code API version to 1.44.0 [#7564](https://github.com/eclipse-theia/theia/pull/7564) +- [preferences] added functionality which defers change events in the same tick [#7676](https://github.com/eclipse-theia/theia/pull/7676) +- [scm] fixed `overviewRuler` and `minimap` theming for SCM decorations [#7330](https://github.com/eclipse-theia/theia/pull/7330) +- [task] added functionality which saves the scope as part of the `TaskService.lastTask` [#7553](https://github.com/eclipse-theia/theia/pull/7553) +- [task] added functionality which sets focus to the terminal that the attached task is running from [#7452](https://github.com/eclipse-theia/theia/pull/7452) +- [task] added support for `presentation.clear` in the task configuration schema [#7454](https://github.com/eclipse-theia/theia/pull/7454) +- [task] added support for `presentation.echo` in the task configuration schema [#7503](https://github.com/eclipse-theia/theia/pull/7503) +- [task] added support for `presentation.panel` in the task configuration schema [#7260](https://github.com/eclipse-theia/theia/pull/7260) +- [task] added support for `presentation.showReuseMessage` in the task configuration schema [#7454](https://github.com/eclipse-theia/theia/pull/7454) +- [task] added support for modifying existing problem matchers [#7455](https://github.com/eclipse-theia/theia/pull/7455) +- [task] added support for user-defined labels for detected tasks [#7574](https://github.com/eclipse-theia/theia/pull/7574) +- [task] fixed `presentation.reveal` and `presentation.focus` for detected tasks [#7548](https://github.com/eclipse-theia/theia/pull/7548) +- [task] fixed issue to only allow running selected texts in a user terminal [#7453](https://github.com/eclipse-theia/theia/pull/7453) +- [terminal] added new terminal preferences [#7660](https://github.com/eclipse-theia/theia/pull/7660) + - `terminal.integrated.shell.linux` + - `terminal.integrated.shell.osx` + - `terminal.integrated.shell.windows` + - `terminal.integrated.shellArgs.linux` + - `terminal.integrated.shellArgs.osx` + - `terminal.integrated.shellArgs.windows` +- [test] added API tests for the TypeScript language [#7265](https://github.com/eclipse-theia/theia/pull/7265) +- [test] fixed API tests on Windows [#7655](https://github.com/eclipse-theia/theia/pull/7655) +- [vsx-registry] fixed minor font-family inconsistency with the download count [#7380](https://github.com/eclipse-theia/theia/pull/7380) +- [vsx-registry] fixed rendering of rating and downloads if they have no value [#7380](https://github.com/eclipse-theia/theia/pull/7380) +- [vsx-registry] updated styling of extension information [#7439](https://github.com/eclipse-theia/theia/pull/7439) +- [workspace] added normalization of workspace root paths [#7598](https://github.com/eclipse-theia/theia/pull/7598) +- [workspace] fixed incorrect statusbar color when in a multi-root workspace without any root folders [#7688](https://github.com/eclipse-theia/theia/pull/7688) + +Breaking changes: + +- [core] `CommandRegistry.registerHandler` registers a new handler with a higher priority than previously [#7539](https://github.com/eclipse-theia/theia/pull/7539) +- [plugin] deprecated is now `PluginModel.packagePath` and `PluginModel.packageUri` should be used instead [#7583](https://github.com/eclipse-theia/theia/pull/7583) +- [plugin] removed `configStorage` argument from `PluginManager.registerPlugin` [#7265](https://github.com/eclipse-theia/theia/pull/7265) + - use `PluginManager.configStorage` property instead. [#7265](https://github.com/eclipse-theia/theia/pull/7265) +- [process] `TerminalProcess` doesn't handle shell quoting, the shell process arguments must be prepared from the caller [#6836](https://github.com/eclipse-theia/theia/pull/6836) + - Removed all methods related to shell escaping inside this class. You should use functions located in `@theia/process/lib/common/shell-quoting.ts` + in order to process arguments for shells. +- [process/terminal] moved shell escaping utilities into `@theia/process/lib/common/shell-quoting` and `@theia/process/lib/common/shell-command-builder` for creating shell inputs [#6836](https://github.com/eclipse-theia/theia/pull/6836) + +## v1.0.0 - 26/03/2020 + +- [core] added functionality to ensure that nodes are refreshed properly on tree expansion [#7400](https://github.com/eclipse-theia/theia/pull/7400) +- [core] added loading state for trees [#7249](https://github.com/eclipse-theia/theia/pull/7249) +- [core] added the ability to customize the layout of view-containers [#6655](https://github.com/eclipse-theia/theia/pull/6655) +- [core] added the ability to customize the stored state of view-containers [#6655](https://github.com/eclipse-theia/theia/pull/6655) +- [core] fixed keybindings for special numpad keys in editors [#7329](https://github.com/eclipse-theia/theia/pull/7329) +- [core] fixed missing progress events [#7314](https://github.com/eclipse-theia/theia/pull/7314) +- [core] updated 'close' commands to respect `widget.closable` property [#7278](https://github.com/eclipse-theia/theia/pull/7278) +- [core] updated `inputValidation` theming [#7351](https://github.com/eclipse-theia/theia/pull/7351) +- [core] updated command execution to always use `CommandService.execute` [#7326](https://github.com/eclipse-theia/theia/pull/7326) +- [debug] added functionality to lazily update of stack frames of all threads in all-stop mode [#7281](https://github.com/eclipse-theia/theia/pull/7281) +- [documentation] updated prerequisites to include `build-essential` [#7256](https://github.com/eclipse-theia/theia/pull/7256) +- [documentation] updated the readme of individual extensions to include additional information, and links to generated API docs [#7254](https://github.com/eclipse-theia/theia/pull/7254) +- [electron] updated token check to use `timingSafeEqual` [#7308](https://github.com/eclipse-theia/theia/pull/7308) +- [file-search] updated `ripgrep` to search files in hidden folders [#7333](https://github.com/eclipse-theia/theia/pull/7333) +- [git] fixed duplicate entries for 'Git History' on merge operations [#7188](https://github.com/eclipse-theia/theia/pull/7188) +- [markers] added foreground coloring of nodes in the `explorer` to reflect problem markers [#6863](https://github.com/eclipse-theia/theia/pull/6863) +- [markers] added sorting of diagnostic markers for a given resource [#7313](https://github.com/eclipse-theia/theia/pull/7313) +- [markers] updated format of diagnostic markers in the `problems-view` [#7344](https://github.com/eclipse-theia/theia/pull/7344) +- [messages] updated to disallow arbitrary HTML in message content [#7289](https://github.com/eclipse-theia/theia/pull/7289) +- [mini-browser] updated `MiniBrowserEndpoint.defaultHandler()` response for non mime-db files [#7356](https://github.com/eclipse-theia/theia/pull/7356) +- [navigator] added busy progress for the explorer [#7249](https://github.com/eclipse-theia/theia/pull/7249) +- [plugin] added `workbench.action.addRootFolder` command [#7350](https://github.com/eclipse-theia/theia/pull/7350) +- [plugin] added `workbench.action.openSettings` command [#7320](https://github.com/eclipse-theia/theia/pull/7320) +- [plugin] added frontend APIs to listen when plugins are initially loaded [#6655](https://github.com/eclipse-theia/theia/pull/6655) +- [plugin] added functionality to ensure that node-based debug adapters spawn the same node version as the framework [#7294](https://github.com/eclipse-theia/theia/pull/7294) +- [plugin] added support for User-defined plugins [#6655](https://github.com/eclipse-theia/theia/pull/6655) +- [plugin] added support for killing sub-threads run by shell scripts [#7391](https://github.com/eclipse-theia/theia/pull/7391) +- [plugin] added support for loading plugins from symbolic links [#7242](https://github.com/eclipse-theia/theia/pull/7242) +- [plugin] exposed frontend API to access loaded plugins metadata [#6655](https://github.com/eclipse-theia/theia/pull/6655) +- [plugin] fixed 'find all references' for the typescript built-in plugin [#7055](https://github.com/eclipse-theia/theia/pull/7055) +- [plugin] fixed `storagePath` to return `undefined` when necessary [#7394](https://github.com/eclipse-theia/theia/pull/7394) +- [plugin] fixed leaking plugins (codelens) [#7238](https://github.com/eclipse-theia/theia/pull/7238) +- [preferences] added a new preference to silence notifications [#7195](https://github.com/eclipse-theia/theia/pull/7195) +- [scm] fixed focus border for commit message textarea [#7340](https://github.com/eclipse-theia/theia/pull/7340) +- [terminal] added new `terminal.integrated.cursorBlinking` preference [#7284](https://github.com/eclipse-theia/theia/pull/7284) +- [terminal] added new `terminal.integrated.cursorStyle` preference [#7284](https://github.com/eclipse-theia/theia/pull/7284) +- [terminal] added new `terminal.integrated.cursorWidth` preference [#7284](https://github.com/eclipse-theia/theia/pull/7284) +- [terminal] added new `terminal.integrated.drawBoldTextInBrightColors` preference [#7284](https://github.com/eclipse-theia/theia/pull/7284) +- [terminal] added new `terminal.integrated.fastScrollSensitivity` preference [#7284](https://github.com/eclipse-theia/theia/pull/7284) +- [terminal] fixed `home`, `page-up`, `page-down` shortcuts [#7305](https://github.com/eclipse-theia/theia/pull/7305) +- [terminal] fixed color theming [#7325](https://github.com/eclipse-theia/theia/pull/7325) +- [terminal] upgraded `xterm` dependency [#7121](https://github.com/eclipse-theia/theia/pull/7121) +- [vsx-registry] added a new `vsx-registry` extension to manage plugins [#6655](https://github.com/eclipse-theia/theia/pull/6655) +- [workspace] fixed issue where `NEW_FILE` and `NEW_FOLDER` could not be triggered under certain conditions [#7302](https://github.com/eclipse-theia/theia/pull/7302) + +Breaking changes: + +- [debug] renamed `debuggingStaturBar` to `debuggingStatusBar` [#7409](https://github.com/eclipse-theia/theia/pull/7409) +- [plugin] renamed `CancelationTokenImpl` to `CancellationTokenImpl` [#7409](https://github.com/eclipse-theia/theia/pull/7409) +- [plugin] renamed `VIEW_ITEM_INLINE_MNUE` to `VIEW_ITEM_INLINE_MENU` [#7409](https://github.com/eclipse-theia/theia/pull/7409) +- [scm | git] moved the `GitHistoryWidget` (History View), and `GitNavigableListWidget` to a new packaged named `scm-extra` [#6381](https://github.com/eclipse-theia/theia/pull/6381) + - Renamed `GitHistoryWidget` to `ScmHistoryWidget` + - CSS classes have been also been moved, and renamed accordingly +- [task] removed `TaskAttachQuickOpenItem` [#7392](https://github.com/eclipse-theia/theia/pull/7392) +- [task] removed `TaskService.taskProviderRegistry` [#7418](https://github.com/eclipse-theia/theia/pull/7418) +- [task] renamed `TaskRestartRunningQuickOpenItem` to `RunningTaskQuickOpenItem` [#7392](https://github.com/eclipse-theia/theia/pull/7392) +- [terminal] renamed `handleWroleWordOptionClicked` to `handleWholeWordOptionClicked` [#7409](https://github.com/eclipse-theia/theia/pull/7409) +- [workspace] renamed `toDiposeOnUpdateCurrentWidget` to `toDisposeOnUpdateCurrentWidget` [#7409](https://github.com/eclipse-theia/theia/pull/7409) + +## v0.16.0 - 27/02/2020 + +- [cli] added an additional flag to the `download:plugins` script [#7123](https://github.com/eclipse-theia/theia/pull/7123) + - `p=true`: plugins should be preserved as they are (compressed). + - `p=false` (default): plugins should be uncompressed. +- [cli] added API to create integration test pages [#7029](https://github.com/eclipse-theia/theia/pull/7029) +- [core] added a new React-based dialog type `ReactDialog` [#6855](https://github.com/eclipse-theia/theia/pull/6855) +- [core] added ability to make the application data folder configurable [#7214](https://github.com/eclipse-theia/theia/pull/7214) +- [core] added additional commands to close main area widgets [#7101](https://github.com/eclipse-theia/theia/pull/7101) +- [core] added handling to dismiss any active menu when the quick palette is opened [#7136](https://github.com/eclipse-theia/theia/pull/7136) +- [core] added handling to ensure that disabled keybindings do not shadow enabled ones [#7022](https://github.com/eclipse-theia/theia/pull/7022) +- [core] added support for icons in a submenu [#7091](https://github.com/eclipse-theia/theia/pull/7091) +- [core] fixed 'out of sync' error [#7139](https://github.com/eclipse-theia/theia/pull/7139) +- [core] fixed import in `lsp-types.ts` [#7075](https://github.com/eclipse-theia/theia/pull/7075) +- [core] fixed set selection on right-click [#7147](https://github.com/eclipse-theia/theia/pull/7147) +- [core] fixed the `TOGGLE_MAXIMIZED` command [#7012](https://github.com/eclipse-theia/theia/pull/7012) +- [core] fixed the search-box for trees [#7089](https://github.com/eclipse-theia/theia/pull/7089) +- [core] fixed tree highlighting foreground color [#7025](https://github.com/eclipse-theia/theia/pull/7025) +- [core] updated `RecursivePartial` to allow arrays [#7201](https://github.com/eclipse-theia/theia/pull/7201) +- [core] updated the `AboutDialog` to include the `applicationName` [#7135](https://github.com/eclipse-theia/theia/pull/7135) +- [core] updated the `DialogProps` to include: [#7080](https://github.com/eclipse-theia/theia/pull/7080) + - `maxWidth`: control the maximum width allowed for a dialog. + - `wordWrap`: control the word wrapping behavior for content in the dialog. +- [core] updated the `THEIA_ENV_REGEXP_EXCLUSION` [#7085](https://github.com/eclipse-theia/theia/pull/7085) +- [debug] added ability to lazily update frames of all threads in all-stop mode [#6869](https://github.com/eclipse-theia/theia/pull/6869) +- [debug] fixed issue where breakpoints were incorrectly rendered on column 1 [#7211](https://github.com/eclipse-theia/theia/pull/7211) +- [documentation] updated code of conduct [#7161](https://github.com/eclipse-theia/theia/pull/7161) +- [editor] updated the log level for the `NavigationLocationService` [#7042](https://github.com/eclipse-theia/theia/pull/7042) +- [electron] added default properties for `OpenDialog` [#7208](https://github.com/eclipse-theia/theia/pull/7208) +- [electron] added handling so only the `BrowserWindow` can access backend HTTP services [#7205](https://github.com/eclipse-theia/theia/pull/7205) +- [electron] updated stat check handling for the save dialog [#7197](https://github.com/eclipse-theia/theia/pull/7197) +- [filesystem] updated the handling of deletions triggered by a user [#7139](https://github.com/eclipse-theia/theia/pull/7139) +- [git] added additional handling when a user attempts to amend without a previous commit [#7033](https://github.com/eclipse-theia/theia/pull/7033) +- [keymaps] updated the keyboard shortcuts widget font-size [#7060](https://github.com/eclipse-theia/theia/pull/7060) +- [markers] improved marker node descriptions [#7209](https://github.com/eclipse-theia/theia/pull/7209) +- [markers] updated marker tooltips to display full path to resource [#7207](https://github.com/eclipse-theia/theia/pull/7207) +- [mini-browser] added additional `HtmlHandler` support [#6969](https://github.com/eclipse-theia/theia/pull/6969) +- [monaco] added handling to activate a grammar only for languages with a registered grammar [#7110](https://github.com/eclipse-theia/theia/pull/7110) +- [monaco] added support for array snippet prefixes [#7177](https://github.com/eclipse-theia/theia/pull/7177) +- [monaco] close an active menubar dropdown when the quick palette is launched [#7136](https://github.com/eclipse-theia/theia/pull/7136) +- [monaco] implemented support for multiple workspace folders in `MonacoWorkspace` [#7182](https://github.com/eclipse-theia/theia/pull/7182) +- [plugin] added ability to customize the plugin host process [#7181](https://github.com/eclipse-theia/theia/pull/7181) +- [plugin] added functionality to expose the metadata scanner to the API [#7134](https://github.com/eclipse-theia/theia/pull/7134) +- [plugin] added functionality to show progress on plugin activation [#7017](https://github.com/eclipse-theia/theia/pull/7017) +- [plugin] added handling to activate a language based on created mode [#7110](https://github.com/eclipse-theia/theia/pull/7110) +- [plugin] added handling to gracefully terminate plugin host processes without an rpc connection [#7192](https://github.com/eclipse-theia/theia/pull/7192) +- [plugin] added handling to prevent error on disabled performance API [#7175](https://github.com/eclipse-theia/theia/pull/7175) +- [plugin] fixed `window.showTextDocument` to allow opening resources with `untitled` schema [#6803](https://github.com/eclipse-theia/theia/pull/6803) +- [plugin] implemented `readFile` for workspace filesystem [#6980](https://github.com/eclipse-theia/theia/pull/6980) +- [plugin] implemented `writeFile` for workspace filesystem [#6980](https://github.com/eclipse-theia/theia/pull/6980) +- [preferences] added functionality to use text models to update content [#7110](https://github.com/eclipse-theia/theia/pull/7110) +- [preferences] fixed display of file icons [#7011](https://github.com/eclipse-theia/theia/pull/7011) +- [preview] added ability to render `.markdown` files [#7234](https://github.com/eclipse-theia/theia/pull/7234) +- [repo] added two new npm scripts: [#7096](https://github.com/eclipse-theia/theia/pull/7096) + - `test:references`: fails if typescript references are out of sync. + - `prepare:references`: updates typescript references, if required. +- [repo] the `prepare` script now updates typescript references. +- [repo] updated the `prepare` script so it now updates typescript references [#7096](https://github.com/eclipse-theia/theia/pull/7096) +- [scm] fixed alignment of file icons [#7041](https://github.com/eclipse-theia/theia/pull/7041) +- [scm] fixed incorrect icon colors on hover [#7044](https://github.com/eclipse-theia/theia/pull/7044) +- [terminal] added a search widget to terminals [#5471](https://github.com/eclipse-theia/theia/pull/5471) +- [core] from now on, downstream projects can refine where the configuration files (such as `settings.json`, `keymaps.json`, `recentworkspace.json`, etc.) will be stored by Theia. [#4488](https://github.com/eclipse-theia/theia/pull/4488)\ +The default location remains the same: `~/.theia`, however it can be customized by overriding the `#getConfigDirUri` method of the `EnvVariablesServer` API. The easiest way is to subclass the `EnvVariablesServerImpl` and rebind it in your backend module: + + ```ts + // your-env-variables-server.ts: + + import { injectable } from 'inversify'; + import { EnvVariablesServerImpl } from '@theia/core/lib/node/env-variables'; + + @injectable() + export class YourEnvVariableServer extends EnvVariablesServerImpl { + + async getConfigDirUri(): Promise { + return 'file:///path/to/your/desired/config/dir'; + } + + } + + // your-backend-application-module.ts: + + import { ContainerModule } from 'inversify'; + import { EnvVariablesServer } from '@theia/core/lib/common/env-variables'; + import { YourEnvVariableServer } from './your-env-variables-server'; + + export default new ContainerModule((bind, unbind, isBound, rebind) => { + rebind(EnvVariablesServer).to(YourEnvVariableServer).inSingletonScope(); + }); + ``` + +Breaking changes: + +- [core] fixed typo (highligh -> highlight) in caption highlight fragment [#7050](https://github.com/eclipse-theia/theia/pull/7050) +- [terminal] added new abstract methods to the TerminalWidget[#7179]: `scrollLineUp`, `scrollLineDown`, `scrollToTop`, `scrollPageUp`, `scrollPageDown` +- The release includes the removal of language-specific Theia extensions and other Theia extensions that are or can be replaced by equivalent VS Code extensions. + - Migration steps are available at the following wiki page [`Consuming Builtin and External VS Code Extensions`](https://github.com/eclipse-theia/theia/wiki/Consuming-Builtin-and-External-VS-Code-Extensions). + - [debug-nodejs] removed the `@theia/debug-nodejs` extension [#6933](https://github.com/eclipse-theia/theia/pull/6933) + - The extension will no longer be maintained by the project and remains in the Git history for anyone who would like to reference it or maintain it. + - [editorconfig] removed the `@theia/editorconfig` extension [#6933](https://github.com/eclipse-theia/theia/pull/6933) + - The extension will no longer be maintained by the project and remains in the Git history for anyone who would like to reference it or maintain it. + - [java] removed the `@theia/java` extension [#6933](https://github.com/eclipse-theia/theia/pull/6933) + - The extension will no longer be maintained by the project and remains in the Git history for anyone who would like to reference it or maintain it. + - Please view the `theia-apps` [theia-java](https://github.com/theia-ide/theia-apps/tree/master/theia-java-docker) image for an example application which has been updated to + use VS Code extensions instead of `@theia/java`. + - [java-debug] removed the `@theia/java-debug` extension [#6933](https://github.com/eclipse-theia/theia/pull/6933) + - The extension will no longer be maintained by the project and remains in the Git history for anyone who would like to reference it or maintain it. + - Please view the `theia-apps` [theia-java](https://github.com/theia-ide/theia-apps/tree/master/theia-java-docker) image for an example application which has been updated to + use VS Code extensions instead of `@theia/java-debug`. + - [merge-conflicts] removed the `@theia/merge-conflicts` extension [#6933](https://github.com/eclipse-theia/theia/pull/6933) + - The extension will no longer be maintained by the project and remains in the Git history for anyone who would like to reference it or maintain it. + - [python] removed the `@theia/python` extension [#6933](https://github.com/eclipse-theia/theia/pull/6933) + - The extension will no longer be maintained by the project and remains in the Git history for anyone who would like to reference it or maintain it. + - Please view the `theia-apps` [theia-python](https://github.com/theia-ide/theia-apps/tree/master/theia-python-docker) image for an example application which has been updated to + use VS Code extensions instead of `@theia/python`. + - [textmate-grammars] removed the `@theia/textmate-grammars` extension [#6933](https://github.com/eclipse-theia/theia/pull/6933) + - The extension will no longer be maintained by the project and remains in the Git history for anyone who would like to reference it or maintain it. + - [tslint] removed the `@theia/tslint` extension [#6933](https://github.com/eclipse-theia/theia/pull/6933) + - The extension will no longer be maintained by the project and remains in the Git history for anyone who would like to reference it or maintain it. + - [typescript] removed the `@theia/typescript` extension [#6933](https://github.com/eclipse-theia/theia/pull/6933) + - The extension will no longer be maintained by the project and remains in the Git history for anyone who would like to reference it or maintain it. + - Please view the `theia-apps` [theia-typescript](https://github.com/theia-ide/theia-apps/tree/master/theia-docker) image for an example application which has been updated to + use VS Code extensions instead of `@theia/typescript`. + +## v0.15.0 - 30/01/2020 + +- [application-manager] added config to disable reloading windows [#6981](https://github.com/eclipse-theia/theia/pull/6981) +- [application-manager] added meta viewport tag [#6967](https://github.com/eclipse-theia/theia/pull/6967) +- [application-manager] fixed the circular dependency exclude path on Windows [#6893](https://github.com/eclipse-theia/theia/pull/6893) +- [console] fixed the debug console user input alignment [#6958](https://github.com/eclipse-theia/theia/pull/6958) +- [core] fixed XSS vulnerability in the browser sidebar [#6988](https://github.com/eclipse-theia/theia/pull/6988) +- [core] fixed issue to close the websocket channel when a language server connection is closed [#6854](https://github.com/eclipse-theia/theia/pull/6854) +- [core] fixed issue to exclude numpad keys from the keyboard mapping [#6881](https://github.com/eclipse-theia/theia/pull/6881) +- [core] improved formatting of performance values in the logs [#6858](https://github.com/eclipse-theia/theia/pull/6858) +- [core] updated handling of `ApplicationShell.getAreaFor` for tabbars [#6994](https://github.com/eclipse-theia/theia/pull/6994) +- [core] updated keybinding check in case full and partial bindings are registered [#6934](https://github.com/eclipse-theia/theia/pull/6934) +- [core] updated logic to collapse panels on toggle view [#6963](https://github.com/eclipse-theia/theia/pull/6963) +- [debug] added exception breakpoints support [#5774](https://github.com/eclipse-theia/theia/pull/5774) +- [debug] added function breakpoints support [#5774](https://github.com/eclipse-theia/theia/pull/5774) +- [debug] added inline breakpoints support [#5774](https://github.com/eclipse-theia/theia/pull/5774) +- [debug] added watch expression support [#5774](https://github.com/eclipse-theia/theia/pull/5774) +- [debug] fixed styling issues with the debug hover [#6887](https://github.com/eclipse-theia/theia/pull/6887) +- [documentation] updated developing documentation for Windows [#6893](https://github.com/eclipse-theia/theia/pull/6893) +- [editor] added `toggle minimap` command and menu item [#6843](https://github.com/eclipse-theia/theia/pull/6843) +- [editor] added `toggle render whitespace` command and menu item [#6843](https://github.com/eclipse-theia/theia/pull/6843) +- [editor] added `toggle word wrap` command and menu item [#6843](https://github.com/eclipse-theia/theia/pull/6843) +- [editor] added missing statusbar tooltip for `go to line` [#6770](https://github.com/eclipse-theia/theia/pull/6770) +- [editor] added missing statusbar tooltip for `select encoding` [#6770](https://github.com/eclipse-theia/theia/pull/6770) +- [editor] added missing statusbar tooltip for `select end of line sequence` [#6770](https://github.com/eclipse-theia/theia/pull/6770) +- [editor] added missing statusbar tooltip for `select indentation` [#6770](https://github.com/eclipse-theia/theia/pull/6770) +- [editor] added missing statusbar tooltip for `select language mode` [#6770](https://github.com/eclipse-theia/theia/pull/6770) +- [editor] updated the `go to line` statusbar item to trigger the `go to line` command directly [#6770](https://github.com/eclipse-theia/theia/pull/6770) +- [file-search] improved the results obtained when performing a file search [#6642](https://github.com/eclipse-theia/theia/pull/6642) +- [filesystem] fixed icon and file name alignment [#6973](https://github.com/eclipse-theia/theia/pull/6973) +- [filesystem] improved the 'file has changed' dialog [#6873](https://github.com/eclipse-theia/theia/pull/6873) +- [git] updated the `git checkout` statusbar tooltip similarly to VS Code [#6779](https://github.com/eclipse-theia/theia/pull/6779) +- [git] updated the version of `find-git-repositories` [#6850](https://github.com/eclipse-theia/theia/pull/6850) +- [keybindings] fixed an issue allowing users to change default keybindings [#6880](https://github.com/eclipse-theia/theia/pull/6880) +- [keymaps] fixed column spacing for the keybindings-widget [#6989](https://github.com/eclipse-theia/theia/pull/6989) +- [markers] added statusbar tooltip displaying the number of current problem markers by severity [#6771](https://github.com/eclipse-theia/theia/pull/6771) +- [merge-conflicts] fixed the typo present in the `merge-conflicts` command category [#6790](https://github.com/eclipse-theia/theia/pull/6790) +- [monaco] added normalization of textmate colors [#6966](https://github.com/eclipse-theia/theia/pull/6966) +- [monaco] fixed issue with the quick-pick when there are no items [#6870](https://github.com/eclipse-theia/theia/pull/6870) +- [monaco] fixed missing `await` on workspace edits file creation [#6851](https://github.com/eclipse-theia/theia/pull/6851) +- [monaco] fixed the `inspect developer token` command [#6966](https://github.com/eclipse-theia/theia/pull/6966) +- [navigator] fixed race condition on contribution initialization [#6817](https://github.com/eclipse-theia/theia/pull/6817) +- [plugin] added ability to handle `vscode.openFolder` command [#6928](https://github.com/eclipse-theia/theia/pull/6928) +- [plugin] added parallel resolution of plugin entries [#6972](https://github.com/eclipse-theia/theia/pull/6972) +- [plugin] added the automatic removal of old session logs [#6956](https://github.com/eclipse-theia/theia/pull/6956) + - By default only the last 10 (configurable using `--plugin-max-session-logs-folders=N`) session folders are retained. +- [plugin] fixed `workbench.action.closeActiveEditor` command [#6978](https://github.com/eclipse-theia/theia/pull/6978) +- [plugin] fixed header container alignment in the plugins-view [#6983](https://github.com/eclipse-theia/theia/pull/6983) +- [plugin] fixed implementation of `showTextDocument` API [#6824](https://github.com/eclipse-theia/theia/pull/6824) +- [plugin] fixed issue where tree-views were not properly displayed [#6939](https://github.com/eclipse-theia/theia/pull/6939) +- [plugin] fixed issue with `DocumentsMainImpl.toEditorOpenerOptions` [#6824](https://github.com/eclipse-theia/theia/pull/6824) +- [plugin] fixed self-hosting on Windows [#6316](https://github.com/eclipse-theia/theia/pull/6316) +- [preferences] fixed an indentation issue when using the preferences tree widget to add new preferences [#6736](https://github.com/eclipse-theia/theia/pull/6736) +- [scripts] added the ability to perform parallel lerna execution on Windows [#6893](https://github.com/eclipse-theia/theia/pull/6893) +- [search-in-workspace] improved the overall search performance [#6789](https://github.com/eclipse-theia/theia/pull/6798) +- [task] added `processId` and `terminalId` to the `TaskExitedEvent` [#6825](https://github.com/eclipse-theia/theia/pull/6825) +- [task] added a new command to `restart running task` [#6811](https://github.com/eclipse-theia/theia/pull/6811) +- [task] added support for `presentation.reveal` and `presentation.focus` [#6814](https://github.com/eclipse-theia/theia/pull/6814) +- [task] updated private accessibility of `restartTask` so it can be called by others [#6811](https://github.com/eclipse-theia/theia/pull/6811) +- [task] updated private accessibility of `terminateTask` so it can be called by others [#6811](https://github.com/eclipse-theia/theia/pull/6811) +- [terminal] added handling to always open terminal links on touchevents (e.g. when tapping a link on iPad) [#6875](https://github.com/eclipse-theia/theia/pull/6875) +- [terminal] fixed an issue regarding the `onDidChangeCurrentTerminal` event [#6799](https://github.com/eclipse-theia/theia/pull/6799) +- [terminal] fixed an issue which prevents re-using integrated terminals which have child processes spawned [#6769](https://github.com/eclipse-theia/theia/pull/6769) +- [terminal] improved the display of `new terminal` in a multi-root workspace [#6876](https://github.com/eclipse-theia/theia/pull/6876) +- [testing] added `API Integration` testing framework [#6852](https://github.com/eclipse-theia/theia/pull/6852) +- [workspace] fixed XSS vulnerability in the `new file` dialog [#6977](https://github.com/eclipse-theia/theia/pull/6977) + +Breaking changes: + +- [application-manager] updated `ApplicationPackageManager.start*` to return an instance of a server child process instead of promise [#6852](https://github.com/eclipse-theia/theia/pull/6852). +- [callhierarchy] updated CallHierarchyService to align with VS Code API [#6924](https://github.com/eclipse-theia/theia/pull/6924): + - Use LanguageSelector instead of language id. + - Use position instead of range for lookup of root symbol. + - Changed data structures to be like VS Code API. +- [cli] renamed generated webpack config to `gen-webpack.config.js` [#6852](https://github.com/eclipse-theia/theia/pull/6852). + `webpack.config.js` is generated only once. It can be edited by users to customize bundling, + but should be based on `gen-webpack.config.js` to pick any changes in the generated config. + If it does not have a reference to `gen-webpack.config.js` then it will be regenerated. +- [core] removed `virtual-renderer`. `react-renderer` should be used instead [#6885](https://github.com/eclipse-theia/theia/pull/6885) +- [core] removed `virtual-widget`. `react-widget` should be used instead [#6885](https://github.com/eclipse-theia/theia/pull/6885) +- [core] renamed method `registerComositionEventListeners()` to `registerCompositionEventListeners()` [#6961](https://github.com/eclipse-theia/theia/pull/6961) +- [debug] removed `@theia/json` dependency. Applications should explicitly depend on `@theia/json` instead [#6647](https://github.com/eclipse-theia/theia/pull/6647) +- [plugin] renamed `gererateTimeFolderName` to `generateTimeFolderName` [#6956](https://github.com/eclipse-theia/theia/pull/6956) +- [preferences] removed `@theia/json` dependency. Applications should explicitly depend on `@theia/json` instead [#6647](https://github.com/eclipse-theia/theia/pull/6647) +- [task] renamed method `getStrigifiedTaskSchema()` has been renamed to `getStringifiedTaskSchema()` [#6780](https://github.com/eclipse-theia/theia/pull/6780) +- [task] renamed method `reorgnizeTasks()` has been renamed to `reorganizeTasks()` [#6780](https://github.com/eclipse-theia/theia/pull/6780) +- Support VS Code icon and color theming. [#6475](https://github.com/eclipse-theia/theia/pull/6475) + - Theming: Before `input`, `textarea`, `select` and `button` elements were styled in an ad-hoc manner, i.e. + some were styled globally for a tag, other per a component and third with a dedicated css class name. + Now Theia does not style these elements by default, but an extension developer should decide. + Theia comes though with predefined css class names: `theia-input`, `theia-select` and `theia-button` + to style input/textarea, select and button elements correspondingly. Existing components were refactored to use them. + - Theming: Theia css colors are replaced with [VS Code colors](https://code.visualstudio.com/api/references/theme-color). + - One can reference VS Code color in css by prefixing them with `--theia` and replacing all dots with dashes. + For example `widget.shadow` color can be referenced in css with `var(--theia-widget-shadow)`. + - One can resolve a current color value programmatically with `ColorRegistry.getCurrentColor`. + - One can load a new color theme: + - in the frontend module to enable it on startup + + ```ts + MonacoThemingService.register({ + id: 'myDarkTheme', + label: 'My Dark Theme', + uiTheme: 'vs-dark', + json: require('./relative/path/to/my_theme.json'), + includes: { + './included_theme.json': require('./relative/path/to/included_theme.json') + } + }); + ``` + + - later from a file: + + ```ts + @inject(MonacoThemingService) + protected readonly monacoThemeService: MonacoThemingService; + + this.monacoThemeService.register({ + id: 'myDarkTheme', + label: 'My Dark Theme', + uiTheme: 'vs-dark', + uri: 'file:///absolute/path/to/my_theme.json' + }); + ``` + + - or install from a VS Code extension. + - One should not introduce css color variables anymore or hardcode colors in css. + - One can contribute new colors by implementing `ColorContribution` contribution point and calling `ColorRegistry.register`. + It's important that new colors are derived from existing VS Code colors if one plans to allow installation of VS Code extension contributing color themes. + Otherwise, there is no guarantee that new colors don't look alien for a random VS Code color theme. + One can derive from an existing color, just by plainly referencing it, e.g. `dark: 'widget.shadow'`, + or applying transformations, e.g. `dark: Color.lighten('widget.shadow', 0.4)`. + - One can though specify values, without deriving from VS Code colors, for new colors in their own theme. + See for example, how [Light (Theia)](packages/monaco/data/monaco-themes/vscode/light_theia.json) theme overrides colors for the activity bar. + - Labeling: `LabelProvider.getIcon` should be sync and fast to avoid blocking rendering and icon caching. + One has to pass more specific elements to get a more specific icon. For example, one cannot answer precisely from a URI + whether a folder or a file icon should be used. If a client wants to get a proper result then it should pass `FileStat` for example or + provide own `LabelProviderContribution` which derives `FileStat` from a custom data structure and then calls `LabelProvider.getIcon` again. + - Labeling: `LabelProviderContribution` methods can return `undefined` meaning that the next contribution should be tried. + - Tree: `TreeNode.name`, `TreeNode.description` and `TreeNode.icon` are deprecated and will be removed later. + One has to provide `LabelProviderContribution` implementation for a custom tree node structure. + Before these attributes have to be computed for all nodes and stored as a part of the layout. + From now on they will be computed only on demand for visible nodes. + It decreases requirements to the local storage and allows to invalidate node appearance by simply re-rendering a tree. +- Updated `example-browser` and `example-electron` applications to remove extensions which are instead contributed by VS Code builtin extensions [#6883](https://github.com/eclipse-theia/theia/pull/6883) + - Extensions removed from the example applications are deprecated and will be removed in the future. If adopters/extenders would like to continue + using the deprecated extensions, they must be self-maintained and can be accessed through the repository's Git history. + - In order to fetch plugins remotely, the `@theia/cli` script `download:plugins` can be used: + - In your `package.json` you can define: + - `theiaPluginDir`: to specify the folder in which to download plugins, in respect to your `package.json` + - `theiaPlugins`: to specify the list of plugins in the form of `"id": "url"` diff --git a/doc/changelogs/CHANGELOG-2021.md b/doc/changelogs/CHANGELOG-2021.md new file mode 100644 index 0000000..4c9ad1b --- /dev/null +++ b/doc/changelogs/CHANGELOG-2021.md @@ -0,0 +1,678 @@ +# Changelog 2021 + +## v1.21.0 - 12/16/2021 + +[1.21.0 Milestone](https://github.com/eclipse-theia/theia/milestone/29) + +- [callhierarchy] added support for the `editorHasCallHierarchyProvider` context key [#10492](https://github.com/eclipse-theia/theia/pull/10492) +- [core] `WindowService` and `ElectronMainApplication` updated to allow for asynchronous pre-exit code in `electron` [#10379](https://github.com/eclipse-theia/theia/pull/10379) +- [core] added sash option for widget resize [#10441](https://github.com/eclipse-theia/theia/pull/10441) +- [core] improved handling of close and reload events [#10379](https://github.com/eclipse-theia/theia/pull/10379) +- [core, editor, editor-preview] additional commands added to tabbar context menu for editor widgets [#10394](https://github.com/eclipse-theia/theia/pull/10394) +- [debug] added timestamps to dap traces [#10484](https://github.com/eclipse-theia/theia/pull/10484) +- [debug] refactored the debug session lifecycle [#10333](https://github.com/eclipse-theia/theia/pull/10333) +- [editor] fixed localization formatting for configuring languages [#10510](https://github.com/eclipse-theia/theia/pull/10510) +- [electron] added handling to restore last window state if it still exists [#10436](https://github.com/eclipse-theia/theia/pull/10436) +- [filesystem] fixed `createFolder` emitter for user gestures [#10460](https://github.com/eclipse-theia/theia/pull/10460) +- [markers] added support for valid range column for problem matchers [#10509](https://github.com/eclipse-theia/theia/pull/10509) +- [messages] fixed implementation for expand and collapse actions in notifications [#10471](https://github.com/eclipse-theia/theia/pull/10471) +- [mini-browser] updated `getSourceUri` to properly handle previews [#10481](https://github.com/eclipse-theia/theia/pull/10481) +- [monaco] fixed localization formatting for configuring spaces versus tabs [#10510](https://github.com/eclipse-theia/theia/pull/10510) +- [navigator] added support for symlink decorations [#10439](https://github.com/eclipse-theia/theia/pull/10439) +- [ovsx-client] added `isVersionLTE` unit tests to cover preview versions [#10530](https://github.com/eclipse-theia/theia/pull/10530) +- [plugin] added support for codicon icon references in view containers [#10491](https://github.com/eclipse-theia/theia/pull/10491) +- [plugin] added support to set theme attributes in webviews [#10493](https://github.com/eclipse-theia/theia/pull/10493) +- [plugin] fixed running plugin hosts on `electron` for `Windows` [#10518](https://github.com/eclipse-theia/theia/pull/10518) +- [preferences] updated `AbstractResourcePreferenceProvider` to handle multiple preference settings in the same tick and handle open preference files. + It will save the file exactly once, and prompt the user if the file is dirty when a programmatic setting is attempted. [#7775](https://github.com/eclipse-theia/theia/pull/7775) +- [preferences] added support for non-string enum values in schemas [#10511](https://github.com/eclipse-theia/theia/pull/10511) +- [preferences] added support for rendering markdown descriptions [#10431](https://github.com/eclipse-theia/theia/pull/10431) +- [scripts] added Electron frontend start-up performance measurement script [#10442](https://github.com/eclipse-theia/theia/pull/10442) - Contributed on behalf of STMicroelectronics +- [task] updated `OsSpecificCommand` and `ShellSpecificOptions` so they are exportable [#10547](https://github.com/eclipse-theia/theia/pull/10547) +- [vsx-registry] updated logic to open extensions with a single-click [#10498](https://github.com/eclipse-theia/theia/pull/10498) + +[Breaking Changes:](#breaking_changes_1.21.0) + +- [core/shared] removed `vscode-languageserver-types`; use `vscode-languageserver-protocol` instead [#10500](https://github.com/eclipse-theia/theia/pull/10500) +- [core] added `SelectionService` as a constructor argument of `TabBarRenderer` [#10394](https://github.com/eclipse-theia/theia/pull/10394) +- [core] removed deprecated `activeChanged` signal emitter in favor of `onDidChangeActiveWidget` [#10515](https://github.com/eclipse-theia/theia/pull/10515) +- [core] removed deprecated `currentChanged` signal emitter in favor of `onDidChangeCurrentWidget` [#10515](https://github.com/eclipse-theia/theia/pull/10515) +- [core] updated `WindowService` interface considerably [#10379](https://github.com/eclipse-theia/theia/pull/10379) + - remove `canUnload(): boolean`- it's replaced by `isSafeToShutDown(): Promise` to allow asynchronous handling in Electron. + - add `isSafeToShutDown()` - replaces `canUnload()`. + - add `setSafeToShutDown()` - ensures that next close event will not be prevented. + - add `reload()` - to allow different handling in Electron and browser. +- [editor] moved the utilities for creating and manipulating dynamic stylesheets from `editor-decoration-style.ts` to `decoration-style.ts` in `core`. + Each namespace now has its independent stylesheet. Only one rule should exist for a given selector in the provided stylesheet. [#10441](https://github.com/eclipse-theia/theia/pull/10441) +- [plugin] changed return type of `WebviewThemeDataProvider.getActiveTheme()` to `Theme` instead of `WebviewThemeType` [#10493](https://github.com/eclipse-theia/theia/pull/10493) +- [plugin] removed the application prop `resolveSystemPlugins`, builtin plugins should now be resolved at build time [#10353](https://github.com/eclipse-theia/theia/pull/10353) +- [plugin] renamed `WebviewThemeData.activeTheme` to `activeThemeType` [#10493](https://github.com/eclipse-theia/theia/pull/10493) +- [preferences] removed `PreferenceProvider#pendingChanges` field. It was previously set unreliably and caused race conditions. + If a `PreferenceProvider` needs a mechanism for deferring the resolution of `PreferenceProvider#setPreference`, it should implement its own system. + See PR for example implementation in `AbstractResourcePreferenceProvider`. [#7775](https://github.com/eclipse-theia/theia/pull/7775) +- [terminal] removed deprecated `activateTerminal` method in favor of `open`. [#10529](https://github.com/eclipse-theia/theia/pull/10529) +- [webpack] Source maps for the frontend renamed from `webpack://[namespace]/[resource-filename]...` to `webpack:///[resource-path]?[loaders]` where `resource-path` is the path to + the file relative to your application package's root [#10480](https://github.com/eclipse-theia/theia/pull/10480) + +## v1.20.0 - 11/25/2021 + +[1.20.0 Milestone](https://github.com/eclipse-theia/theia/milestone/28) + +- [application-manager] added a workaround to the upstream `electron-rebuild` bug [#10429](https://github.com/eclipse-theia/theia/pull/10429) +- [application-manager] remove unnecessary `font-awesome-webpack` dependency [#10401](https://github.com/eclipse-theia/theia/pull/10401) +- [application-manager] updated `compression-webpack-plugin` to `v9.0.0` [#10391](https://github.com/eclipse-theia/theia/pull/10391) +- [application-package] fixed `electron.isDevMode` API on Windows [#10359](https://github.com/eclipse-theia/theia/pull/10359) +- [core] added handling to disable http fallback on a successful websocket connection [#10395](https://github.com/eclipse-theia/theia/pull/10395) +- [core] added support to remove workspaces from the recently opened workspace list [#10378](https://github.com/eclipse-theia/theia/pull/10378) +- [core] fixed `runtime-import-check` errors [#10418](https://github.com/eclipse-theia/theia/pull/10418) +- [core] fixed an issue with window paths [#10226](https://github.com/eclipse-theia/theia/pull/10226) +- [core] fixed the `new window` command in the browser application [#10364](https://github.com/eclipse-theia/theia/pull/10364) +- [core] improved `Deferred` typings [#10455](https://github.com/eclipse-theia/theia/pull/10455) +- [core] simplified default vscode localizations [#10319](https://github.com/eclipse-theia/theia/pull/10319) +- [core] updated `sinon` dependency to `v12.0.0` [#10381](https://github.com/eclipse-theia/theia/pull/10381) +- [monaco] fixed visibility of selected items in the peek widget [#10307](https://github.com/eclipse-theia/theia/pull/10307) +- [navigator] added support to decorate deleted files in the open editors widget [#10361](https://github.com/eclipse-theia/theia/pull/10361) +- [plugin] fixed an issue related to `taskExecutions` not returning executions properly on startup [#10330](https://github.com/eclipse-theia/theia/pull/10330) +- [plugin] fixed an issue when calling `showInput` subsequently due to `validateInput` [#10396](https://github.com/eclipse-theia/theia/pull/10396) +- [plugin] fixed issue causing notifications to not appear [#10399](https://github.com/eclipse-theia/theia/pull/10399) +- [plugin] fixed typedoc generation for the plugin system [#10274](https://github.com/eclipse-theia/theia/pull/10274) +- [plugin] fixed visibility of inline actions when hovering tree-views [#10375](https://github.com/eclipse-theia/theia/pull/10375) +- [repo] upgraded repository `yarn.lock` [#10349](https://github.com/eclipse-theia/theia/pull/10349) +- [search-in-workspace] added functionality to preserve `find in files` history [#10438](https://github.com/eclipse-theia/theia/pull/10438) +- [search-in-workspace] added support to follow symlinks when searching [#10413](https://github.com/eclipse-theia/theia/pull/10413) +- [search-in-workspace] fixed flickering when hovering results [#10388](https://github.com/eclipse-theia/theia/pull/10388) +- [search-in-workspace] fixed issue causing the scrollbar to display without results present [#10410](https://github.com/eclipse-theia/theia/pull/10410) +- [search-in-workspace] fixed selection of results [#10371](https://github.com/eclipse-theia/theia/pull/10371) +- [task] added functionality to substitute variables in `options.env` of tasks [#10208](https://github.com/eclipse-theia/theia/pull/10208) +- [task] improved extensibility of `ProcessTaskRunner` [#10392](https://github.com/eclipse-theia/theia/pull/10392) +- [terminal] added support for the `terminal.integrated.confirmOnExit` preference [#10374](https://github.com/eclipse-theia/theia/pull/10374) +- [vsx-registry] fixed the selection of extension results [#10373](https://github.com/eclipse-theia/theia/pull/10373) + +[Breaking Changes:](#breaking_changes_1.20.0) + +- [core] `T` defaults to `void` if not specified when defining a `Deferred` [#10455](https://github.com/eclipse-theia/theia/pull/10455) +- [core] `value` is now not optional in `Deferred.resolve(value: T)` [#10455](https://github.com/eclipse-theia/theia/pull/10455) +- [plugin] renamed `HostedPluginClient` to `PluginDevClient` [#10352](https://github.com/eclipse-theia/theia/pull/10352) +- [plugin] renamed `HostedPluginServer` to `PluginDevServer` [#10352](https://github.com/eclipse-theia/theia/pull/10352) + +## v1.19.0 - 10/28/2021 + +[1.19.0 Milestone](https://github.com/eclipse-theia/theia/milestone/25) + +- [callhierarchy] updated `callhierarchy` support [#10310](https://github.com/eclipse-theia/theia/pull/10310): + - `prepareCallHierarchy` types brought closer to VSCode / LSP expectations. + - optional `data` field added to `CallHierarchyItem` and related type. +- [cli] added localization extraction to the cli [#10247](https://github.com/eclipse-theia/theia/pull/10247) +- [core] added support for `window.titleBarStyle` [#10044](https://github.com/eclipse-theia/theia/pull/10044) +- [core] added support for richer tooltip overlays [#10108](https://github.com/eclipse-theia/theia/pull/10108) +- [core] added support to drag-and-drop individual sections across view containers [#9644](https://github.com/eclipse-theia/theia/pull/9644) +- [core] fixed regressions when using `svg` icons causing them not to display [#10232](https://github.com/eclipse-theia/theia/pull/10232) +- [debug] added support for `debug.confirmOnExit` [#10270](https://github.com/eclipse-theia/theia/pull/10270) +- [debug] fixed an issue preventing `.theia/launch.json` from being re-created [#10222](https://github.com/eclipse-theia/theia/pull/10222) +- [debug] fixed the restoration of the selected configuration across application restarts [#10287](https://github.com/eclipse-theia/theia/pull/10287) +- [editor] added `close editor` command to the file main-menu [#10193](https://github.com/eclipse-theia/theia/pull/10193) +- [editor] added additional commands to the `go` main-menu [#10299](https://github.com/eclipse-theia/theia/pull/10299) +- [editor] added support for the `workbench.action.files.revert` command [#10294](https://github.com/eclipse-theia/theia/pull/10294) +- [editor] updated editor tooltips to display their full path [#10238](https://github.com/eclipse-theia/theia/pull/10238) +- [eslint-plugin] added a new rule to warn against the usage of `src` imports over `lib` [#10234](https://github.com/eclipse-theia/theia/pull/10234) +- [filesystem] added better support when uploading with existing files [#10216](https://github.com/eclipse-theia/theia/pull/10216) +- [filesystem] fixed an issue causing the open dialog not to open when a workspace is deleted [#10171](https://github.com/eclipse-theia/theia/pull/10171) +- [markers] added better ordering support for markers [#9691](https://github.com/eclipse-theia/theia/pull/9691) +- [monaco] added better theming support for label colors in the action bar [#10301](https://github.com/eclipse-theia/theia/pull/10301) +- [monaco] added support for monaco editor localizations [#10084](https://github.com/eclipse-theia/theia/pull/10084) +- [monaco] fixed styling in the monaco suggestion overlay [#10241](https://github.com/eclipse-theia/theia/pull/10241) +- [ovsx-client] fixed a mismatch in the default supported api version [#10229](https://github.com/eclipse-theia/theia/pull/10229) +- [plugin-ext] added additional startup logging for plugin starting and application loading [#10116](https://github.com/eclipse-theia/theia/pull/10116) - Contributed on behalf of STMicroelectronics +- [plugin] added `LocationLink` and `Declaration` typings [#10139](https://github.com/eclipse-theia/theia/pull/10139) +- [plugin] added localization support for plugins through language packs [#10087](https://github.com/eclipse-theia/theia/pull/10087) +- [plugin] added support for `DebugAdapterNamedPipeServer` and `DebugAdapterInlineImplementation` [#10163](https://github.com/eclipse-theia/theia/pull/10163) +- [plugin] added support for descriptions in tree-views [#10253](https://github.com/eclipse-theia/theia/pull/10253) +- [plugin] aligned the behavior of the command `workbench.action.closeActiveEditor` closer to vscode [#10193](https://github.com/eclipse-theia/theia/pull/10193) +- [plugin] fixed a `webview` regression due to `postMessage` [#10336](https://github.com/eclipse-theia/theia/pull/10336) +- [plugin] fixed a potential JSON RPC error in the `quick-open` API [#10230](https://github.com/eclipse-theia/theia/pull/10230) +- [plugin] improved display of modal dialogs [#10245](https://github.com/eclipse-theia/theia/pull/10245) +- [plugin] updated api to default to vscode over theia [#10199](https://github.com/eclipse-theia/theia/pull/10199) +- [repo] added localization support for the entire framework [#10106](https://github.com/eclipse-theia/theia/pull/10106) +- [scripts] added extension impact script [#10192](https://github.com/eclipse-theia/theia/pull/10192) - Contributed on behalf of STMicroelectronics +- [scripts] added startup performance measurement script [#9777](https://github.com/eclipse-theia/theia/pull/9777) - Contributed on behalf of STMicroelectronics +- [search-in-workspace] added support for the `replace in files` command [#10242](https://github.com/eclipse-theia/theia/pull/10242) +- [task] added handling to fill task options explicitly if `problemMatchers` is set [#10166](https://github.com/eclipse-theia/theia/pull/10166) +- [task] updated duplicated task configurations from `workspace` and `folder` scopes [#10335](https://github.com/eclipse-theia/theia/pull/10335) + +[Breaking Changes:](#breaking_changes_1.19.0) + +- [callhierarchy][plugin] retyped `callhierarchy` methods `getRootDefinition`, `$provideRootDefinition`, `provideRootDefinition`, and `prepareCallHierarchy` to allow a return of an item or an array of items [#10310](https://github.com/eclipse-theia/theia/pull/10310) +- [core] moved `DEFAULT_WINDOW_HASH` to `common/window.ts` [#10291](https://github.com/eclipse-theia/theia/pull/10291) +- [core] moved `NewWindowOptions` to `common/window.ts` [#10291](https://github.com/eclipse-theia/theia/pull/10291) +- [core] moved `nls` localization namespace from `browser` to `common`. [#10153](https://github.com/eclipse-theia/theia/pull/10153) +- [electron] `ElectronMainMenuFactory` now inherits from `BrowserMainMenuFactory` and its methods have been renamed. [#10044](https://github.com/eclipse-theia/theia/pull/10044) + - renamed `handleDefault` to `handleElectronDefault` + - renamed `createContextMenu` to `createElectronContextMenu` + - renamed `createMenuBar` to `createElectronMenuBar` +- [output] moved `output-channel` from `common` to `browser` [#10154](https://github.com/eclipse-theia/theia/pull/10154) +- [output] moved `output-preferences` from `common` to `browser` [#10154](https://github.com/eclipse-theia/theia/pull/10154) +- [ovsx-client] removed `postJson` method from `OVSXClient` [#10325](https://github.com/eclipse-theia/theia/pull/10325) +- [plugin] removed unnecessary function `getCaption` [#10253](https://github.com/eclipse-theia/theia/pull/10253) +- [view-container] updated the `ViewContainerPart` constructor to take two new parameters: `originalContainerId` and `originalContainerTitle` [#9644](https://github.com/eclipse-theia/theia/pull/9644) + - the existing `viewContainerId` parameter has been renamed to `currentContainerId` to enable drag & drop views. +- [vsx-registry] removed `OVSXAsyncClient` [#10327](https://github.com/eclipse-theia/theia/pull/10327) +- [vsx-registry] updated `VSXEnvironment` from a class to an interface and symbol implemented in both `browser` and `node` [#10327](https://github.com/eclipse-theia/theia/pull/10327) + +## v1.18.0 - 9/30/2021 + +[1.18.0 Milestone](https://github.com/eclipse-theia/theia/milestone/24) + +- [callhierarchy] added support for `SymbolTag.Deprecated` styling when rendering nodes [#10114](https://github.com/eclipse-theia/theia/pull/10114) +- [cli] added support for downloading `.theia` plugins [#10082](https://github.com/eclipse-theia/theia/pull/10082) +- [core] added support for editor `breadcrumbs` [#9920](https://github.com/eclipse-theia/theia/pull/9920) + - contributions to `breadcrumbs` contributions were added from `core`, `filesystem`, `outline-view` and `workspace`. +- [core] added support for sub-headings in view-container parts [#9909](https://github.com/eclipse-theia/theia/pull/9909) +- [core] added support to hide the statusbar [#10092](https://github.com/eclipse-theia/theia/pull/10092) +- [core] fixed font-size for the compact sidebar menu [#10180](https://github.com/eclipse-theia/theia/pull/10180) +- [core] updated menu separator styling with vscode [#10080](https://github.com/eclipse-theia/theia/pull/10080) +- [debug] added functionality to support `DebugVariables` navigation [#10165](https://github.com/eclipse-theia/theia/pull/10165) +- [debug] added support for dynamic debug configurations API [#10134](https://github.com/eclipse-theia/theia/pull/10134) +- [debug] fixed flickering when clicking toolbar items [#10062](https://github.com/eclipse-theia/theia/pull/10062) +- [debug] updated `DebugConfigurationManager` to wait for preferences being ready before initializing debug configurations [#10167](https://github.com/eclipse-theia/theia/pull/10167) +- [documentation] fixed broken roadmap links in publishing documentation [#9984](https://github.com/eclipse-theia/theia/pull/9984) +- [eslint-plugin] added new `runtime-import-check` rule to error when importing from folders meant for incompatible runtimes [#10124] +- [filesystem] fixed `canRead` implementation which caused false positives [#10131](https://github.com/eclipse-theia/theia/pull/10131) +- [filesystem] updated file dialog to properly apply the default filter [#10133](https://github.com/eclipse-theia/theia/pull/10133) +- [mini-browser] fixed issues when attempting open source or preview of resources [#10047](https://github.com/eclipse-theia/theia/pull/10047) +- [monaco] updated focused `quick-input` styling [#10074](https://github.com/eclipse-theia/theia/pull/10074) +- [monaco] updated the `QuickInputService` to properly pass `options` when calling `input` [#10096](https://github.com/eclipse-theia/theia/pull/10096) +- [outline-view] fixed minor documentation typo [#10071](https://github.com/eclipse-theia/theia/pull/10071) +- [plugin] added `DebugConsoleMode` enum [#10113](https://github.com/eclipse-theia/theia/pull/10113) +- [plugin] added deprecated `LanguageConfiguration` fields (`__characterPairSupport` and `__electricCharacterSupport`) [#10050](https://github.com/eclipse-theia/theia/pull/10050) +- [plugin] added functionality to allow downloads from webviews [#10064](https://github.com/eclipse-theia/theia/pull/10064) +- [plugin] added handling to avoid infinite redirect loop for webviews [#10064](https://github.com/eclipse-theia/theia/pull/10064) +- [plugin] added handling to check message source frame in webviews [#10202](https://github.com/eclipse-theia/theia/pull/10202) +- [plugin] added missing `CompletionItemKind` constants [#10123](https://github.com/eclipse-theia/theia/pull/10123) +- [plugin] added stub for `ExtensionMode` to not fail plugin activation [#10205](https://github.com/eclipse-theia/theia/pull/10205) +- [plugin] added stub for `setKeysForSync` to not fail plugin activation [#10205](https://github.com/eclipse-theia/theia/pull/10205) +- [plugin] added support for `CancellationError` [#10035](https://github.com/eclipse-theia/theia/pull/10035) +- [plugin] added support for callhierarchy `tags` [#10114](https://github.com/eclipse-theia/theia/pull/10114) +- [plugin] added support for the `vscode.openWith` command [#9881](https://github.com/eclipse-theia/theia/pull/9881) +- [plugin] added support for the `workbench.action.openWorkspaceConfigFile` command [#10039](https://github.com/eclipse-theia/theia/pull/10039) +- [plugin] fixed an issue where items in the `quick-pick` menu were not properly updated [#10065](https://github.com/eclipse-theia/theia/pull/10065) +- [plugin] fixed bug which prevented tree-searching in tree-views [#10097](https://github.com/eclipse-theia/theia/pull/10097) +- [plugin] fixed issue where `panel` location was not respected [#10162](https://github.com/eclipse-theia/theia/pull/10162) +- [plugin] update `instanceof ThemeIcon` to `is` method [#10012](https://github.com/eclipse-theia/theia/pull/10012) +- [plugin] updated `DocumentSelector` to correctly use a `ReadonlyArray` instead of `Array` [#10070](https://github.com/eclipse-theia/theia/pull/10070) +- [plugin] updated custom-editor opener to support `option` priority [#10158](https://github.com/eclipse-theia/theia/pull/10158) +- [plugin] updated the default vscode API from `1.50.0` to `1.53.2` [#9959](https://github.com/eclipse-theia/theia/pull/9959) +- [preview] fixed opening of markdown sources to align with vscode behavior [#10047](https://github.com/eclipse-theia/theia/pull/10047) +- [repo] added `dash-licenses` CI workflow to verify dependencies for 3PP FOSS license compatibility [#9953](https://github.com/eclipse-theia/theia/pull/9953) +- [repo] fixed `attach to electron frontend` debug launch configuration [#10101](https://github.com/eclipse-theia/theia/pull/10101) +- [repo] reworked and simplified build system for Theia development [#9710](https://github.com/eclipse-theia/theia/pull/9710) +- [repo] updated existing icons to `codicons` [#9864](https://github.com/eclipse-theia/theia/pull/9864) +- [scripts] added `ts-clean` script to help when performing major refactorings [#10156](https://github.com/eclipse-theia/theia/pull/10156) +- [task] updated `provideTasks` implementation similarly to vscode [#10061](https://github.com/eclipse-theia/theia/pull/10061) +- [task] updated `required` field to be optional in `TaskDefinition` for compatibility [#10015](https://github.com/eclipse-theia/theia/pull/10015) +- [terminal] added mouse support for GUI terminal applications (ex: vim) [#9805](https://github.com/eclipse-theia/theia/pull/9805) + +[Breaking Changes:](#breaking_changes_1.18.0) + +- [application-manager] break `rebuild` API: second argument is now an optional object instead of an optional array [#9710](https://github.com/eclipse-theia/theia/pull/9710) +- [core] `setTopPanelVisibily` renamed to `setTopPanelVisibility` [#10020](https://github.com/eclipse-theia/theia/pull/10020) +- [core] added `BreadcrumbsRendererFactory` to constructor arguments of `DockPanelRenderer` and `ToolbarAwareTabBar` [#9920](https://github.com/eclipse-theia/theia/pull/9920) +- [core] added `PreferenceService` to constructor arguments of `StatusBarImpl` [#10092](https://github.com/eclipse-theia/theia/pull/10092) +- [git] removed exports from namespace `defaultGutterStyles`, `maxWidth`, `continuationStyle`, and `highlightStyle` [#9999](https://github.com/eclipse-theia/theia/pull/9999) +- [task] `TaskDefinition.properties.required` is now optional to align with the specification [#10015](https://github.com/eclipse-theia/theia/pull/10015) + +## v1.17.2 - 9/1/2021 + +[1.17.2 Milestone](https://github.com/eclipse-theia/theia/milestone/27) + +- [core] fixed an issue which caused the top-level menu to fail to display on startup [#10034](https://github.com/eclipse-theia/theia/pull/10034) + +## v1.17.1 - 8/31/2021 + +[1.17.1 Milestone](https://github.com/eclipse-theia/theia/milestone/26) + +- [core] upgraded `inversify` to `v5.1.1` [#9979](https://github.com/eclipse-theia/theia/pull/9979) +- [electron] fixed the restoration (position and size) of windows on restart [#9995](https://github.com/eclipse-theia/theia/pull/9995) +- [electron] fixed the restoration of previous workspaces on restart [#9995](https://github.com/eclipse-theia/theia/pull/9995) +- [plugin] fixed `ThemeIcon` rendering in tree-views [#10012](https://github.com/eclipse-theia/theia/pull/10012) + +## v1.17.0 - 8/26/2021 + +[1.17.0 Milestone](https://github.com/eclipse-theia/theia/milestone/23) + +- [api-tests] added additional file-search tests [#9674](https://github.com/eclipse-theia/theia/pull/9674) +- [application-manager] updated `css-loader` dependency [#9819](https://github.com/eclipse-theia/theia/pull/9819) +- [application-manager] updated `webpack` version range [#9831](https://github.com/eclipse-theia/theia/pull/9831) +- [application-package] added support for `yarn aliases` [#9880](https://github.com/eclipse-theia/theia/pull/9880) +- [application-package] updated `deepmerge` dependency to `4.2.2` [#9405](https://github.com/eclipse-theia/theia/pull/9405) +- [cli] added the ability to declare excluded plugin ids when downloading plugins [#9956](https://github.com/eclipse-theia/theia/pull/9956) +- [cli] fixed help, argument and error handling [#9842](https://github.com/eclipse-theia/theia/pull/9842) +- [console] fixed the `selectedSession` not being properly set when first starting a debug session [#9963](https://github.com/eclipse-theia/theia/pull/9963) +- [core] added `@vscode/codicons` dependency [#9828](https://github.com/eclipse-theia/theia/pull/9828) +- [core] added functionality to disable spellcheck for input and textarea fields [#9907](https://github.com/eclipse-theia/theia/pull/9907) +- [core] added handling to prevent subsequent electron windows from overlapping [#9560](https://github.com/eclipse-theia/theia/pull/9560) +- [core] added http fallback when websockets are unavailable [#9731](https://github.com/eclipse-theia/theia/pull/9731) +- [core] added internationalization support [#9538](https://github.com/eclipse-theia/theia/pull/9538) +- [core] added support for `window.menuBarVisibility` [#9830](https://github.com/eclipse-theia/theia/pull/9830) +- [core] added support for composite tree decorations to reflect decorations from multiple providers [#9473](https://github.com/eclipse-theia/theia/pull/9473) +- [core] fixed `handleExpansionToggleDblClickEvent` binding [#9877](https://github.com/eclipse-theia/theia/pull/9877) +- [core] fixed the display of recently used items in the `quick-commands` menu [#9921](https://github.com/eclipse-theia/theia/pull/9921) +- [core] implemented `fuzzy` searching and highlighting for the quick-input [#9928](https://github.com/eclipse-theia/theia/pull/9928) +- [core] modified handling of toolbar items for `ViewContainer`s to handle `onDidChange` correctly. [#9798](https://github.com/eclipse-theia/theia/pull/9798) +- [core] updated menus to not break the layout if a referenced command is missing [#9886](https://github.com/eclipse-theia/theia/pull/9886) +- [debug] updated `DebugRequestTypes` to reflect `DAP` changes [#9833](https://github.com/eclipse-theia/theia/pull/9833) +- [documentation] added `SECURITY.md` documentation [#9804](https://github.com/eclipse-theia/theia/pull/9804) +- [documentation] introduced `migration` document to help adopters during release migrations [#9817](https://github.com/eclipse-theia/theia/pull/9817) +- [documentation] updated prerequisite documentation for `keytar` [#9807](https://github.com/eclipse-theia/theia/pull/9807) +- [dynamic-require] introduced the `dynamic-require` dev package to reduce dynamic requires for bundling [#9660](https://github.com/eclipse-theia/theia/pull/9660) +- [editor] added missing descriptions to monaco editor preferences [#9852](https://github.com/eclipse-theia/theia/pull/9852) +- [electron] added support for the `new window` command [#9519](https://github.com/eclipse-theia/theia/pull/9519) +- [file-search] fixed the display of resource paths in the `quick-file-open` menu [#9952](https://github.com/eclipse-theia/theia/pull/9952) +- [filesystem] added ability to open read-only files in electron [#9950](https://github.com/eclipse-theia/theia/pull/9950) +- [filesystem] improved `MAX_FILE_SIZE_MB` definition [#9972](https://github.com/eclipse-theia/theia/pull/9972) +- [filesystem] updated the uploading of files to use http over websockets [#9820](https://github.com/eclipse-theia/theia/pull/9820) +- [keymaps] fixed broken 'supported keys' link in readme [#9929](https://github.com/eclipse-theia/theia/pull/9929) +- [monaco] adjusted the `find-widget` font-family [#9937](https://github.com/eclipse-theia/theia/pull/9937) +- [monaco] refactored monaco interfaces behind core services [#9727](https://github.com/eclipse-theia/theia/pull/9727) +- [monaco] restored the `drop-shadow` styling for the quick-input [#9938](https://github.com/eclipse-theia/theia/pull/9938) +- [navigator] added support for opening external files by drag and dropping into the main panel [#9543](https://github.com/eclipse-theia/theia/issues/9543) +- [plugin-dev] fixed the starting of hosted plugins [#9874](https://github.com/eclipse-theia/theia/pull/9874) +- [plugin-ext] added missing `CompletionItemKind` enum values [#9908](https://github.com/eclipse-theia/theia/pull/9908) +- [plugin-ext] fixed the `selectedRepository` not being properly set in a multi-root [#9954](https://github.com/eclipse-theia/theia/pull/9954) +- [plugin-ext] improved extensibility of `PluginViewRegistry` [#9847](https://github.com/eclipse-theia/theia/pull/9847) +- [plugin-ext] updated to use correct host id for frontend hosted plugins [#9902](https://github.com/eclipse-theia/theia/pull/9902) +- [preferences] added support for `json` commands to open `settings.json` at different preference scopes [#9832](https://github.com/eclipse-theia/theia/pull/9832) +- [preferences] fixed the opening of the preferences-view [#9932](https://github.com/eclipse-theia/theia/pull/9932) +- [preferences] improved the extensibility of rebinding schemas [#9883](https://github.com/eclipse-theia/theia/pull/9883) +- [scm] added `onDidChangeCommitTemplate` event support [#9792](https://github.com/eclipse-theia/theia/pull/9792) +- [scm] fixed incorrect tree state when using the `vscode-builtin-git` plugin [#9915](https://github.com/eclipse-theia/theia/pull/9915) +- [task] introduced lock to prevent parallel task executions [#9858](https://github.com/eclipse-theia/theia/pull/9858) +- [workspace] added ability to case-sensitively rename files and folders on Windows [#9709](https://github.com/eclipse-theia/theia/pull/9709) +- [workspace] added support for url encoding [#9850](https://github.com/eclipse-theia/theia/pull/9850) + +[Breaking Changes:](#breaking_changes_1.17.0) + +- [core] `ViewContainerPart` methods and properties related to hiding and showing toolbar removed: `toHideToolbar`, `hideToolbar`, `showToolbar`, `toolbarHidden`. `ViewContainerPart` toolbars are now hidden or shown using CSS properties [#9935](https://github.com/eclipse-theia/theia/pull/9935) +- [core] `handleExpansionToggleDblClickEvent` in `TreeWidget` can no longer be overridden. Instead, `doHandleExpansionToggleDblClickEvent` can be overridden [#9877](https://github.com/eclipse-theia/theia/pull/9877) +- [core] moved from ES5 to ES2017 [#9436](https://github.com/eclipse-theia/theia/pull/9436) - Contributed on behalf of STMicroelectronics +- [core] registering toolbar items for commands that explicitly target a `ViewContainer` rather than a child widget may not behave as expected. Such registrations should be made in the `ViewContainer` by overriding the `updateToolbarItems` method and using the `registerToolbarItem` utility. See the modifications to the `scm` and `vsx-registry` packages in the PR for examples [#9798](https://github.com/eclipse-theia/theia/pull/9798) + - `VSXExtensionsContribution` no longer implements `TabBarToolbarContribution` and is not bound as such. Extensions of the class that expect such behavior should reimplement it with caution. See caveats in PR. +- [core] `SidePanelHandler.addMenu` and `SidePanelHandler.removeMenu` no longer exists, instead added `addBottomMenu` and `addTopMenu` for adding menu, `removeTopMenu` and `removeBottomMenu` for removing menu [#9830](https://github.com/eclipse-theia/theia/pull/9830) + - `SidebarBottomMenu` interface is renamed `SidebarMenu` and handles not only bottom menu's. + - Changed style class name from `theia-sidebar-bottom-menu` to `theia-sidebar-menu` + - `TheiaDockPanel` constructor takes a new parameter `preferences` + +## v1.16.0 - 7/29/2021 + +[1.16.0 Milestone](https://github.com/eclipse-theia/theia/milestone/22) + +- [bulk-edit] fixed incorrect border styling property [#9100](https://github.com/eclipse-theia/theia/pull/9100) +- [callhierarchy] added additional call-hierarchy support [#9681](https://github.com/eclipse-theia/theia/pull/9681) +- [core] downgraded `keytar` dependency to `7.2.0` for broader operating system compatibility [#9694](https://github.com/eclipse-theia/theia/pull/9694) +- [core] fixed `diff` labels [#9786](https://github.com/eclipse-theia/theia/pull/9786) +- [core] fixed file-tree scroll bug [#9713](https://github.com/eclipse-theia/theia/pull/9713) +- [core] updated `:focus` styling to remove `!important` rule for extensibility [#9700](https://github.com/eclipse-theia/theia/pull/9700) +- [core] updated `workbench.editor.closeOnFileDelete` default to `false` [#9720](https://github.com/eclipse-theia/theia/pull/9720) +- [core] updated expansion-toggle icon styling when selected [#9770](https://github.com/eclipse-theia/theia/pull/9770) +- [core] updated selected tree node styling [#9742](https://github.com/eclipse-theia/theia/pull/9742) +- [core] updated view-container to preserve the collapsed state of a tree-view when reloading the application [#9636](https://github.com/eclipse-theia/theia/pull/9636) +- [debug] added support for managing debug sessions for extensions from the debug panel (previously only possible using `Hosted Plugin` commands) [#8706](https://github.com/eclipse-theia/theia/pull/8706) +- [debug] added support for the `debugIcon.startForeground` color [#9759](https://github.com/eclipse-theia/theia/pull/9759) +- [debug] fixed behavior which incorrectly modifies the `settings.json` when adding debug configurations [#9719](https://github.com/eclipse-theia/theia/pull/9719) +- [debug | plugin] added `DebugSessionOptions` vscode API [#9613](https://github.com/eclipse-theia/theia/pull/9613) +- [documentation] updated `yarn` prerequisites [#9726](https://github.com/eclipse-theia/theia/pull/9726) +- [editor] added support for the `workbench.action.revertAndCloseActiveEditor` command [#9728](https://github.com/eclipse-theia/theia/pull/9728) +- [monaco] fixed quick-command separator when no recently used commands are present [#9783](https://github.com/eclipse-theia/theia/pull/9783) +- [monaco] support `in` operator for `when` clauses [#9492](https://github.com/eclipse-theia/theia/pull/9492) +- [monaco] updated styling in the peek-widget [#9725](https://github.com/eclipse-theia/theia/pull/9725) +- [monaco] upgraded `monaco` dependency to `0.23.0` [#9154](https://github.com/eclipse-theia/theia/pull/9154) +- [navigator] added support for `open editors` [#9284](https://github.com/eclipse-theia/theia/pull/9284) +- [plugin] added support `deprecated` diagnostic-tags [#9721](https://github.com/eclipse-theia/theia/pull/9721) +- [plugin] added support for searching in `tree-view` parts [#9703](https://github.com/eclipse-theia/theia/pull/9703) +- [plugin] added support for the `workbench.files.action.refreshFilesExplorer` command [#9738](https://github.com/eclipse-theia/theia/pull/9738) +- [plugin] aligned collapsible item behavior with vscode [#9696](https://github.com/eclipse-theia/theia/pull/9696) +- [plugin] fixed `TaskDto` conversion [#9740](https://github.com/eclipse-theia/theia/pull/9740) +- [plugin] fixed `is_electron` TypeError [#9730](https://github.com/eclipse-theia/theia/pull/9730) +- [plugin] fixed `stop` and `restart` for hosted-plugins [#9780](https://github.com/eclipse-theia/theia/pull/9780) +- [plugin] fixed custom-editor activation [#9671](https://github.com/eclipse-theia/theia/pull/9671) +- [plugin] fixed hosted-plugin dialog for the electron target [#9764](https://github.com/eclipse-theia/theia/pull/9764) +- [plugin] fixed incorrect `tree-view` item ordering [#9775](https://github.com/eclipse-theia/theia/pull/9775) +- [plugin] fixed webworker creating for frontend plugins [#9715](https://github.com/eclipse-theia/theia/pull/9715) +- [preferences] added additional open preferences commands [#9785](https://github.com/eclipse-theia/theia/pull/9785) +- [quality] fixed incorrect `src/` import statements [#9753](https://github.com/eclipse-theia/theia/pull/9753) +- [quality] fixed miscellaneous typos [#9753](https://github.com/eclipse-theia/theia/pull/9753) +- [repo] upgraded `yarn.lock` [#9683](https://github.com/eclipse-theia/theia/pull/9683) +- [scm] added tooltip support for resources [#9745](https://github.com/eclipse-theia/theia/pull/9745) +- [search-in-workspace] added history support in input fields [#9524](https://github.com/eclipse-theia/theia/pull/9524) +- [search-in-workspace] added support for the `expand-all` toolbar item [#9749](https://github.com/eclipse-theia/theia/pull/9749) +- [search-in-workspace] improved the search result message under different conditions [#9429](https://github.com/eclipse-theia/theia/pull/9429) +- [task] added support for deep task comparison [#9647](https://github.com/eclipse-theia/theia/pull/9647) +- [task] fixed fallback to `lastCwd` when `getCwdURI` fails [#9695](https://github.com/eclipse-theia/theia/pull/9695) +- [vsx-registry] fixed search input behavior [#9772](https://github.com/eclipse-theia/theia/pull/9772) +- [workspace] added support for multiple selections in `add folder to workspace` dialog [#9684](https://github.com/eclipse-theia/theia/pull/9684) + +[Notable Changes:](#notable_changes_1.16.0) + +- [application-manager] defines a new range for `webpack` (`^5.36.2 <5.47.0`). `webpack@5.47.0` depends on `webpack-sources@^3.0.1` but this new version produces bogus bundles in Theia applications. The fix works by constraining the `webpack` version range to not pull newer versions for Theia v1.16.0 meaning clients creating Theia applications will not be affected by the bundling failures caused by the new dependency. The bogus library will most likely be fixed before next release (v1.17.0) so we'll need to update the `webpack` range back to pull newer versions again (bug/performance/security updates). + +[Breaking Changes:](#breaking_changes_1.16.0) + +- [callhierarchy] `CurrentEditorAccess` is deprecated. Use the version implemented in the `editor` package instead. The services in `call-hierarchy` that previously used the local `CurrentEditorAccess` no longer do [#9681](https://github.com/eclipse-theia/theia/pull/9681) +- [debug] `DebugSession` and `PluginDebugSession` constructors accept a `parentSession` of type `DebugSession | undefined` as their 3rd parameter, offsetting every subsequent parameter by one [#9613](https://github.com/eclipse-theia/theia/pull/9613) +- [monaco] upgraded to monaco 0.23.0 including replacement of `quickOpen` API (0.20.x) with `quickInput` API (0.23.x) [#9154](https://github.com/eclipse-theia/theia/pull/9154) +- [workspace] `WorkspaceCommandContribution.addFolderToWorkspace` no longer accepts `undefined`. `WorkspaceService.addRoot` now accepts a `URI` or a `URI[]` [#9684](https://github.com/eclipse-theia/theia/pull/9684) + +## v1.15.0 - 6/30/2021 + +[1.15.0 Milestone](https://github.com/eclipse-theia/theia/milestone/21) + +- [application-package] refined the configuration typings allowing for partial `ApplicationConfig` updates [#9568](https://github.com/eclipse-theia/theia/pull/9568) +- [core] added API to filter contributions at runtime [#9317](https://github.com/eclipse-theia/theia/pull/9317) - Contributed on behalf of STMicroelectronics +- [core] added `BackendApplicationServer` which controls how to serve frontend files [#9461](https://github.com/eclipse-theia/theia/pull/9461) +- [core] added `dompurify` as a shared dependency [#9571](https://github.com/eclipse-theia/theia/pull/9571) +- [core] added handling to gracefully kill process trees on exit [#8947](https://github.com/eclipse-theia/theia/pull/8947) +- [core] added handling to make IPC debug tracing configurable [#9602](https://github.com/eclipse-theia/theia/pull/9602) +- [core] added handling to normalize environment variables before merging [#9631](https://github.com/eclipse-theia/theia/pull/9631) +- [core] added support for `expandOnlyOnExpansionToggleClick` in `TreeProps` [#9583](https://github.com/eclipse-theia/theia/pull/9583) +- [core] added support for `resourceDirName` and `resourcePath` context keys [#9499](https://github.com/eclipse-theia/theia/pull/9499) +- [core] added support for a unique id for non-command toolbar items [#9586](https://github.com/eclipse-theia/theia/pull/9586) +- [core] fixed incorrectly wrapped disposable [#9376](https://github.com/eclipse-theia/theia/pull/9376) +- [debug] fixed handling when `supportSetVariable` is disabled [#9616](https://github.com/eclipse-theia/theia/pull/9616) +- [editor-preview] refactored `editor-preview` resolving outstanding bugs [#9518](https://github.com/eclipse-theia/theia/pull/9518) + - rewrote `editor-preview`-package classes as extensions of `editor`-package classes +- [editor] updated logic to open last seen editor and not last created [#9542](https://github.com/eclipse-theia/theia/pull/9542) +- [file-search] added handling to preserve editor state when re-opening a closed editor [#9557](https://github.com/eclipse-theia/theia/pull/9557) +- [file-search] fixed issue with potential infinite recursion [#9635](https://github.com/eclipse-theia/theia/pull/9635) +- [file-search] updated default goto line and column `range` to `undefined` [#9529](https://github.com/eclipse-theia/theia/pull/9629) +- [filesystem] added logic to use a supplied filter by default [#9659](https://github.com/eclipse-theia/theia/pull/9659) +- [mini-browser] added handling to warn if deployed in an insecure context [#9563](https://github.com/eclipse-theia/theia/pull/9563) +- [monaco] fixed resizing of editor inputs [#9527](https://github.com/eclipse-theia/theia/pull/9527) +- [monaco] updated fetching of `onigasm wasm` to use `fetch` instead of old `AJAX` [#9620](https://github.com/eclipse-theia/theia/pull/9620) +- [outline] aligned expansion behavior of the `outline-view` with vscode [#9583](https://github.com/eclipse-theia/theia/pull/9583) +- [plugin] added `toJSON` implementation for `Range` and `Position` [#9652](https://github.com/eclipse-theia/theia/pull/9652) +- [plugin] added support for `secrets` plugin API [#9463](https://github.com/eclipse-theia/theia/pull/9463) +- [plugin] added support for prefix arguments when executing `workbench.action.quickOpen` [#9566](https://github.com/eclipse-theia/theia/pull/9566) +- [plugin] fixed `ELECTRON_RUN_AS_NODE` environment variable [#9283](https://github.com/eclipse-theia/theia/pull/9283) +- [plugin] fixed issue where tree-views would re-open after reload despite being explicitly closed [#9539](https://github.com/eclipse-theia/theia/pull/9539) +- [plugin] fixed tree-view selection [#9673](https://github.com/eclipse-theia/theia/pull/9673) +- [plugin] updated logic to transform `iconPath` to `url` [#9608](https://github.com/eclipse-theia/theia/pull/9608) +- [preferences] added handling to ensure that `WorkspacePreferenceProvider` waits for the `WorkspaceService` to be ready [#9531](https://github.com/eclipse-theia/theia/pull/9531) +- [preferences] fixed tab tracking when scrolling the preferences tree [#9549](https://github.com/eclipse-theia/theia/pull/9549) +- [preferences] refactored the `preferences-view` with major improvements to useability and performance [#9439](https://github.com/eclipse-theia/theia/pull/9439) +- [property-view] added unit-tests [#9630](https://github.com/eclipse-theia/theia/pull/9630) +- [repo] fixed `compile-references` script error message [#9667](https://github.com/eclipse-theia/theia/pull/9667) +- [repo] upgraded repository `yarn.lock` [#9536](https://github.com/eclipse-theia/theia/pull/9536) +- [search-in-workspace] fixed search debounce issue [#9579](https://github.com/eclipse-theia/theia/pull/9579) +- [vsx-registry] added support for `@builtin` and `@installed` search queries [#9572](https://github.com/eclipse-theia/theia/pull/9572) +- [vsx-registry] added support for `extensionPack` handling at buildtime [#9425](https://github.com/eclipse-theia/theia/pull/9425) +- [vsx-registry] added support for `extensions.json` functionality [#9043](https://github.com/eclipse-theia/theia/pull/9043) +- [vsx-registry] upgraded `sanitize-html` dependency [#9525](https://github.com/eclipse-theia/theia/pull/9525) +- [workspace] improved extensibility of `workspace-service` private members and methods [#9597](https://github.com/eclipse-theia/theia/pull/9597) + +[Breaking Changes:](#breaking_changes_1.15.0) + +- [core] added `keytar` (a native node dependency) which may require `libsecret` to be installed [#9463](https://github.com/eclipse-theia/theia/pull/9463) + - Please see [prerequisites](https://github.com/eclipse-theia/theia/blob/master/doc/Developing.md#prerequisite_keytar) for additional information. +- [core] `outline-view-tree.ts` has been renamed to `outline-view-tree-model.ts` to match class name. [#9583](https://github.com/eclipse-theia/theia/pull/9583) +- [editor-preview] `EditorPreviewWidget` now extends `EditorWidget` and `EditorPreviewManager` extends and overrides `EditorManager`. `instanceof` checks can no longer distinguish between preview and non-preview editors; use `.isPreview` field instead. [#9518](https://github.com/eclipse-theia/theia/pull/9517) +- [process] `@theia/process/lib/node/shell-process` no longer exports `mergeProcessEnv` as a raw function. Use `@theia/core/lib/node/environment-utils` and the injectable `EnvironmentUtils` class instead. +- [process] `ShellProcess` constructor takes a new `environmentUtils` parameter to handle environment operations. +- [vsx-registry] removed support for `VSXApiVersionProvider` [#9425](https://github.com/eclipse-theia/theia/pull/9425) + +## v1.14.0 - 5/27/2021 + +[1.14.0 Milestone](https://github.com/eclipse-theia/theia/milestone/20) + +- [api-samples] fixed dynamic label example [#9517](https://github.com/eclipse-theia/theia/pull/9517) +- [application-manager] upgraded to `webpack v5` [#9451](https://github.com/eclipse-theia/theia/pull/9451) +- [core] added events to notify about websocket upgrades [#9459](https://github.com/eclipse-theia/theia/pull/9459) +- [core] added support for language-specific preferences in the frontend configuration object [#9358](https://github.com/eclipse-theia/theia/pull/9358) +- [debug] fixed `Add Configurations` command behavior when an empty `launch.json` present [#9467](https://github.com/eclipse-theia/theia/pull/9467) +- [debug] fixed issue when setting non-code breakpoints [#9479](https://github.com/eclipse-theia/theia/pull/9479) +- [file-search] added support for `goto line and column` in the file search [#9478](https://github.com/eclipse-theia/theia/pull/9478) +- [filesystem] added ability to perform a `~` substitution in the browser file dialog [#9416](https://github.com/eclipse-theia/theia/pull/9416) +- [messages] added explicit handling to sanitize notification messages before rendering [#9520](https://github.com/eclipse-theia/theia/pull/9520) +- [monaco] improved styling of the `rename` input [#9419](https://github.com/eclipse-theia/theia/pull/9419) +- [output] fixed styling issue where `errors` and `warnings` were not colored [#9496](https://github.com/eclipse-theia/theia/pull/9496) +- [plugin] added support for `extensionsUri` [#9428](https://github.com/eclipse-theia/theia/pull/9428) +- [plugin] added support for `vscode.URI` APIs [#9422](https://github.com/eclipse-theia/theia/pull/9422) +- [plugin] added support for the `hosted-plugin.launchOutFiles` preference [#9176](https://github.com/eclipse-theia/theia/pull/9176) +- [plugin] aligned `FileDecoration` API with the latest version [#8911](https://github.com/eclipse-theia/theia/pull/8911) +- [plugin] improved extensibility of `replacer` and `reviver` [#9422](https://github.com/eclipse-theia/theia/pull/9422) +- [plugin] improved support for additional submenu contributions [#9371](https://github.com/eclipse-theia/theia/pull/9371) +- [preferences] updated initial reading of preference files to before the `ready` promise resolves [#9362](https://github.com/eclipse-theia/theia/pull/9362) +- [process][terminal] fixed issue where the output of short-lived tasks are not displayed [#9409](https://github.com/eclipse-theia/theia/pull/9409) +- [quality] removed duplicate implementations of `InMemoryTextResource` [#9504](https://github.com/eclipse-theia/theia/pull/9504) +- [search-in-workspace] added ability to perform searches outside workspace by specifying `include` path [#9307](https://github.com/eclipse-theia/theia/pull/9307) +- [search-in-workspace] added support for the `search.smartCase` preference to control searching behavior [#9408](https://github.com/eclipse-theia/theia/pull/9408) +- [search-in-workspace] fixed issue when revealing a result [#9504](https://github.com/eclipse-theia/theia/pull/9504) +- [search-in-workspace] improved search behavior for additional `include`/`exclude` patterns [#9307](https://github.com/eclipse-theia/theia/pull/9307) +- [search-in-workspace] updated `search and replace` to only display diff if a replace term is present [#9516](https://github.com/eclipse-theia/theia/pull/9516) +- [terminal] fixed merging of environment variables [#9437](https://github.com/eclipse-theia/theia/pull/9437) +- [terminal] removed incorrect `process.env` from the browser environment [#9452](https://github.com/eclipse-theia/theia/pull/9452) +- [vsx-registry] added handling to sanitize readme before rendering [#9424](https://github.com/eclipse-theia/theia/pull/9424) +- [vsx-registry] updated compatibility check for vscode builtins to verify compatible version rather than engine [#9486](https://github.com/eclipse-theia/theia/pull/9486) + +[Breaking Changes:](#breaking_changes_1.14.0) + +- [debug] `DebugConfigurationManager` no longer `@injects()` the `FileService` and now uses `MonacoTextModelService` instead. [#9467](https://github.com/eclipse-theia/theia/pull/9467) +- [filesystem] `ReactRenderer`, `LocationListRenderer`, and `FileDialogTreeFiltersRenderer` have been made injectable/factoritized [#9416](https://github.com/eclipse-theia/theia/pull/9416) + - `FileDialog` and its children have been updated to use property injection where appropriate and initialization inside constructor has been moved to `postConstruct` +- [vsx-registry] `VSXRegistryAPI.getLatestCompatibleVersion` now accepts `VSXSearchEntry` as a parameter [#9486](https://github.com/eclipse-theia/theia/pull/9486) + +## v1.13.0 - 4/29/2021 + +[1.13.0 Milestone](https://github.com/eclipse-theia/theia/milestone/19) + +- [console] sanitized HTML content the `ansi-console` [#9339](https://github.com/eclipse-theia/theia/pull/9339) +- [core] added `isEqual` method for `URI` [#8925](https://github.com/eclipse-theia/theia/pull/8925) +- [core] added handling to automatically reconnect websocket on offline event [#9299](https://github.com/eclipse-theia/theia/pull/9299) +- [core] added missing `useCapture` argument to `removeEventListener` [#9273](https://github.com/eclipse-theia/theia/pull/9273) +- [core] added re-export of common packages strategy [#9124](https://github.com/eclipse-theia/theia/pull/9124) +- [core] improved handling of `saveAll` by checking if a widget is dirty before saving [#9393](https://github.com/eclipse-theia/theia/pull/9393) +- [core] updated `nsfw` dependency to `^2.1.2` [#9267](https://github.com/eclipse-theia/theia/pull/9267) +- [debug] fixed hover issues for the `currentFrame` editor [#9256](https://github.com/eclipse-theia/theia/pull/9256) +- [debug] improved error messages [#9386](https://github.com/eclipse-theia/theia/pull/9386) +- [documentation] added roadmap information to the readme [#9308](https://github.com/eclipse-theia/theia/pull/9308) +- [documentation] updated pre-publishing steps [#9257](https://github.com/eclipse-theia/theia/pull/9257) +- [editor-preview] updated logic to activate editor-preview editors only if already active [#9346](https://github.com/eclipse-theia/theia/pull/9346) +- [editor] added support for `reopen closed editor` [#8925](https://github.com/eclipse-theia/theia/pull/8925) +- [editor] added support to open multiple editors for the same file [#9369](https://github.com/eclipse-theia/theia/pull/9369) + - added `split editor` command. + - added `split editor up` command. + - added `split editor down` command. + - added `split editor right` command. + - added `split editor left` command. + - added `split editor orthogonal` command. +- [electron] added command and keybinding for `toggle full screen` [#9399](https://github.com/eclipse-theia/theia/pull/9399) +- [getting-started] fixed the opening of external links in `electron` [#9390](https://github.com/eclipse-theia/theia/pull/9390) +- [getting-started] updated links to be keyboard operable [#9318](https://github.com/eclipse-theia/theia/pull/9318) +- [getting-started] updated links to not modify the URL hash [#9318](https://github.com/eclipse-theia/theia/pull/9318) +- [git] added handling to group context-menu by category [#9324](https://github.com/eclipse-theia/theia/pull/9324) +- [monaco] fixed regression which did not respect `setContext` [#9343](https://github.com/eclipse-theia/theia/pull/9343) +- [monaco] improved handling of themes on startup by using `indexedDB` if available [#9303](https://github.com/eclipse-theia/theia/pull/9303) +- [plugin] added `CodeActionTriggerKind` enum [#9368](https://github.com/eclipse-theia/theia/pull/94039368) +- [plugin] added handling for empty command `id` with available arguments [#9223](https://github.com/eclipse-theia/theia/pull/9223) +- [plugin] added support for the `CustomExecution` API [#9189](https://github.com/eclipse-theia/theia/pull/9189) +- [plugin] added support for the `PluginContext` API [#9276](https://github.com/eclipse-theia/theia/pull/9276) +- [plugin] added support to read `args` from `keybindings` [#9372](https://github.com/eclipse-theia/theia/pull/9372) +- [plugin] fixed dialog `canSelectMany` implementation [#9278](https://github.com/eclipse-theia/theia/pull/9278) +- [plugin] fixed handling for `.focus` view commands [#9364](https://github.com/eclipse-theia/theia/pull/9364) +- [plugin] refactored the `RPCProtocol` for quality [#8972](https://github.com/eclipse-theia/theia/pull/8972) +- [plugin] removed unnecessary coupling to `editor-preview` [#9302](https://github.com/eclipse-theia/theia/pull/9302) +- [plugin] updated `safeStringify` output error [#9223](https://github.com/eclipse-theia/theia/pull/9223) +- [preferences] added handling to properly re-render view when extensions which provide preferences are uninstalled [#9313](https://github.com/eclipse-theia/theia/pull/9313) +- [preferences] fixed `preference-array.css` styling due to typos [#9270](https://github.com/eclipse-theia/theia/pull/9270) +- [preferences] fixed regression for the preferences-view without plugin support [#9403](https://github.com/eclipse-theia/theia/pull/9403) +- [preferences] updated handling to activate the preferences-view when opened through the `OPEN_PREFERENCES` command [#9355](https://github.com/eclipse-theia/theia/pull/9355) +- [preferences] updated the formatting of preferences [#9381](https://github.com/eclipse-theia/theia/pull/9381) +- [task] added handling to update workspace model on workspace location change [#9331](https://github.com/eclipse-theia/theia/pull/9331) +- [task] added support for task presentation options [#9248](https://github.com/eclipse-theia/theia/pull/9248) + - added support for `presentationOptions.clear`. + - added support for `presentationOptions.echo`. + - added support for `presentationOptions.focus`. + - added support for `presentationOptions.panel`. + - added support for `presentationOptions.reveal`. + - added support for `presentationOptions.showReuseMessage`. +- [timeline] addef missing `@theia/navigator` dependency [#9267](https://github.com/eclipse-theia/theia/pull/9267) +- [vsx-registry] added `copy extension id` and `copy` commands to the extension context-menu [#9292](https://github.com/eclipse-theia/theia/pull/9292) +- [vsx-registry] added handling to preserve recently uninstalled extensions from the extensions-view until reload [#9236](https://github.com/eclipse-theia/theia/pull/9236) +- [vsx-registry] updated api compatibility handling to improve performance, and check for compatibility when installing builtins from the extensions-view [#9280](https://github.com/eclipse-theia/theia/pull/9280) +- [workspace] improved `save as...` command behavior [#9022](https://github.com/eclipse-theia/theia/pull/9022) + +[Breaking Changes:](#breaking_changes_1.13.0) + +- [workspace] `WorkspaceCommands.SAVE_AS` command no longer accepts an `URI` argument. It now uses the currently selected editor to determine the file to be saved [#9022](https://github.com/eclipse-theia/theia/pull/9022) + +## v1.12.1 - 3/29/2021 + +- [core][filesystem] Use `nsfw@^2.1.2` to fix an issue on Windows where file watching did not work at all. + +## v1.12.0 - 3/25/2021 + +[1.12.0 Milestone](https://github.com/eclipse-theia/theia/milestone/17) + +- [core] added API to remove toolbar items [#9044](https://github.com/eclipse-theia/theia/pull/9044) +- [core] added `onDidChangeActiveEmitter` when a quick-pick is accepted [#9175](https://github.com/eclipse-theia/theia/pull/9175) +- [core] added support for creating lazy preference proxies [#9169](https://github.com/eclipse-theia/theia/pull/9169) +- [core] fixed `when` clause for commands registered to the command-palette [#9188](https://github.com/eclipse-theia/theia/pull/9188) +- [core] updated connection status service to prevent false positive alerts about offline mode [#9068](https://github.com/eclipse-theia/theia/pull/9068) +- [editor] fixed issue with revealing selection when opening editors [#9004](https://github.com/eclipse-theia/theia/pull/9004) +- [electron] added `folder` dialog fallback when setting `canSelectFiles` and `canSelectFolders` dialog props simultaneously on non-OSX machines [#9179](https://github.com/eclipse-theia/theia/pull/9179) +- [electron] added support for the `window.zoomLevel` preference [#9121](https://github.com/eclipse-theia/theia/pull/9121) +- [external-terminal] added new extension to spawn external terminals in electron applications [#9186](https://github.com/eclipse-theia/theia/pull/9186) +- [filesystem] added file dialog enhancements including text input and a navigate up icon [#8748](https://github.com/eclipse-theia/theia/pull/8748) +- [filesystem] added ability for downstream applications to control file-watching [#9163](https://github.com/eclipse-theia/theia/pull/9163) +- [filesystem] fixed `electron` dialogs to set the proper `defaultPath` (cwd) [#9135](https://github.com/eclipse-theia/theia/pull/9135) +- [filesystem] fixed logic when performing copy and paste in a duplicate file/folder [#9037](https://github.com/eclipse-theia/theia/pull/9037) +- [markers] added fallback `owner` sort when sorting markers for an individual resource [#9211](https://github.com/eclipse-theia/theia/pull/9211) +- [markers] fixed the marker `copy` command to correctly set the `owner` [#9160](https://github.com/eclipse-theia/theia/pull/9160) +- [mini-browser] fixed host pattern logic for `HOST_PATTERN_ENV` [#9201](https://github.com/eclipse-theia/theia/pull/9201) +- [mini-browser] fixed virtual host env logic [#9209](https://github.com/eclipse-theia/theia/pull/9209) +- [mini-browser] removed dead/unused electron-specific code for quality [#9209](https://github.com/eclipse-theia/theia/pull/9209) +- [monaco] exposed `_preview` editor from the references widget [#9245](https://github.com/eclipse-theia/theia/pull/9245) +- [monaco] fixed editor gutter size by updating `lineNumberMinChars` [#9168](https://github.com/eclipse-theia/theia/pull/9168) +- [monaco] update fallback `font-family` for the editor [#9147](https://github.com/eclipse-theia/theia/pull/9147) +- [output] fixed `registerToolbarItems` to allow async registration [#9044](https://github.com/eclipse-theia/theia/pull/9044) +- [plugin] added support for `CustomEditor` APIs [#8910](https://github.com/eclipse-theia/theia/pull/8910) +- [plugin] added support for `TaskScope.Workspace` [#9032](https://github.com/eclipse-theia/theia/pull/9032) +- [plugin] added support for `onStartupFinished` activation event [#9212](https://github.com/eclipse-theia/theia/pull/9212) +- [plugin] added support for `workbench.files.openFileFolder` command [#9213](https://github.com/eclipse-theia/theia/pull/9213) +- [plugin] added support for the `workspace.workspaceFile` API [#9132](https://github.com/eclipse-theia/theia/pull/9132) +- [plugin] fixed `when` clause for views [#9156](https://github.com/eclipse-theia/theia/pull/9156) +- [plugin] fixed custom debug request handling to pass the `body` instead of `response` object [#9131](https://github.com/eclipse-theia/theia/pull/9131) +- [plugin] fixed dialog implementation to open appropriate dialogs on browser or electron [#9179](https://github.com/eclipse-theia/theia/pull/9179) +- [plugin] fixed issue where `onDidExpandViewEmitter` was not properly fired [#9229](https://github.com/eclipse-theia/theia/pull/9229) +- [plugin] update error handling when setting storage without a workspace [#9137](https://github.com/eclipse-theia/theia/pull/9137) +- [plugin] updated `SCM` API to latest version [#9045](https://github.com/eclipse-theia/theia/pull/9045) +- [plugin] updated `vscode.window.createTerminal` to accept URI current working directories [#9140](https://github.com/eclipse-theia/theia/pull/9140) +- [preferences] added `updateValue` API for the `PreferenceService` [#9178](https://github.com/eclipse-theia/theia/pull/9178) +- [preferences] added functionality to restore the preference state including search term, preference scope, and editor location [#9166](https://github.com/eclipse-theia/theia/pull/9166) +- [property-view] added initial version of a selection-based property-view [#8655](https://github.com/eclipse-theia/theia/pull/8655) + - A default implementation is available for file selections (via file navigator and default editors). +- [repo] enabled eslint checks for `theia.d.ts` [#9200](https://github.com/eclipse-theia/theia/pull/9200) +- [repo] updated readme 'new issue' link to point to issue templates [#9180](https://github.com/eclipse-theia/theia/pull/9180) +- [search-in-workspace] added ability to perform search when glob fields (include and exclude) are updated [#9183](https://github.com/eclipse-theia/theia/pull/9183) +- [search-in-workspace] added logic to remove search results for deleted files [#9218](https://github.com/eclipse-theia/theia/pull/9218) +- [search-in-workspace] fixed the comparison of editors when working with dirty files [#9192](https://github.com/eclipse-theia/theia/pull/9192) +- [search-in-workspace] removed usage of the deprecated `keyCode` API [#9183](https://github.com/eclipse-theia/theia/pull/9183) +- [tasks] added support for workspace-scoped task configurations. [#8917](https://github.com/eclipse-theia/theia/pull/8917) +- [terminal] fixed `xterm` addon versions which broke searching [#9167](https://github.com/eclipse-theia/theia/pull/9167) +- [variable-resolver] added support for `pathSeparator` variable substitution [#9054](https://github.com/eclipse-theia/theia/pull/9054) +- [vsx-registry] added `Install from VSIX...` command to install a local extension [#9184](https://github.com/eclipse-theia/theia/pull/9184) +- [vsx-registry] added toolbar menu support for the extensions-view [#9184](https://github.com/eclipse-theia/theia/pull/9184) +- [workspace] add support for configurations outside the `settings` object and add `WorkspaceSchemaUpdater` to allow configurations sections to be contributed by extensions [#8917](https://github.com/eclipse-theia/theia/pull/8917) + +[Breaking Changes:](#breaking_changes_1.12.0) + +- [core] `PreferenceService` and `PreferenceProvider` `getConfigUri` and `getContainingConfigUri` methods accept `sectionName` argument to retrieve URI's for non-settings configurations [#8917](https://github.com/eclipse-theia/theia/pull/8917) +- [filesystem] `FileDialog` and `LocationListRenderer` now require `FileService` to be passed into constructor for text-based file dialog navigation in browser [#8748](https://github.com/eclipse-theia/theia/pull/8748) +- [mini-browser] Removed `@theia/mini-browser/lib/electron-main/` and its bindings in the `electron-main` context [#9209](https://github.com/eclipse-theia/theia/pull/9209) +- [tasks] `TaskConfigurationModel.scope` field now protected. `TaskConfigurationManager` setup changed to accommodate workspace-scoped tasks [#8917](https://github.com/eclipse-theia/theia/pull/8917) +- [workspace] `WorkspaceData` interface modified and workspace file schema updated to allow for `tasks` outside of `settings` object. `WorkspaceData.buildWorkspaceData` `settings` argument now accepts an object with any of the keys of the workspace schema [#8917](https://github.com/eclipse-theia/theia/pull/8917) + +## v1.11.0 - 2/25/2021 + +[1.11.0 Milestone](https://github.com/eclipse-theia/theia/milestone/16) + +- [api-samples] added example to echo the currently supported vscode API version [#8191](https://github.com/eclipse-theia/theia/pull/8191) +- [bulk-edit] added support for previewing refactorings [#8589](https://github.com/eclipse-theia/theia/pull/8589) +- [core] fixed context-menu position when the electron application is scaled (zoom in/zoom out) [#9082](https://github.com/eclipse-theia/theia/pull/9082) +- [core] fixed keyboard shortcuts when working with devTools in the electron application [#8943](https://github.com/eclipse-theia/theia/pull/8943) +- [core] fixed tabbar-toolbar mouse event handler [#9125](https://github.com/eclipse-theia/theia/pull/9125) +- [core] fixed theming issue for secondary buttons when using light themes [#9008](https://github.com/eclipse-theia/theia/pull/9008) +- [core] updated `ProgressMessageOptions.cancelable` documentation to reflect updated default [#9033](https://github.com/eclipse-theia/theia/pull/9033) +- [core] updated the tree search-box to align with vscode [#9005](https://github.com/eclipse-theia/theia/pull/9005) +- [core] updated tree-view parts header styling [#9128](https://github.com/eclipse-theia/theia/pull/9128) +- [documentation] added documentation on how to debug plugin sources in 'developing.md' [#9018](https://github.com/eclipse-theia/theia/pull/9018) +- [documentation] fixed typo in 'developing.md' [#9092](https://github.com/eclipse-theia/theia/pull/9092) +- [editor] added `onFocusChanged` event in order to update the active editor when switching editors [#9013](https://github.com/eclipse-theia/theia/pull/9013) +- [file-search] added support for performing file searches with whitespaces [#8989](https://github.com/eclipse-theia/theia/pull/8989) +- [git] added handling to remove extraneous entries in the `scm` for nested git repositories [#7629](https://github.com/eclipse-theia/theia/pull/7629) +- [keymaps] fixed keybinding disablement and remapping [#9088](https://github.com/eclipse-theia/theia/pull/9088) +- [keymaps] fixed serialization for the `keymaps.json` file [#9088](https://github.com/eclipse-theia/theia/pull/9088) +- [markers] fixed issue when enabling/disabling problem marker tabbar decorations [#9059](https://github.com/eclipse-theia/theia/pull/9059) +- [monaco] fixed theming issue when using third-party themes [#8964](https://github.com/eclipse-theia/theia/pull/8964) +- [monaco] fixed theming issues when registering themes with null or undefined properties [#9097](https://github.com/eclipse-theia/theia/pull/9097) +- [navigator] fixed issue when dragging-and-dropping files into the main area [#8927](https://github.com/eclipse-theia/theia/pull/8927) +- [navigator] fixed issue when performing a drag-and-drop without the proper selection [#9093](https://github.com/eclipse-theia/theia/pull/9093) +- [output] generalized the `output` APIs for extensibility [#9060](https://github.com/eclipse-theia/theia/pull/9060) +- [plugin] added API stub for terminal links [#9048](https://github.com/eclipse-theia/theia/pull/9048) +- [plugin] added missing `group` property to the `TaskDTO` interface [#8971](https://github.com/eclipse-theia/theia/pull/8971) +- [plugin] added support for submenu contributions [#8996](https://github.com/eclipse-theia/theia/pull/8996) +- [plugin] extracted plugin URI generation into an injectable class [#9027](https://github.com/eclipse-theia/theia/pull/9027) +- [plugin] fixed issue where `problemMatchers` were not properly set when configuring tasks [#8971](https://github.com/eclipse-theia/theia/pull/89771) +- [plugin] fixed welcome-view empty condition [#9047](https://github.com/eclipse-theia/theia/pull/9047) +- [preferences] added a `clear-all` button in the preferences-view input for clearing search results [#9113](https://github.com/eclipse-theia/theia/pull/9133) +- [preferences] added a result count badge in the preferences-view input when performing a search [#9113](https://github.com/eclipse-theia/theia/pull/9133) +- [preferences] fixed issue when attempting to validate numeric values from the preferences-view [#9089](https://github.com/eclipse-theia/theia/pull/9089) +- [preferences] fixed the `PreferenceChangeEvent` typing [#9057](https://github.com/eclipse-theia/theia/pull/9057) +- [preferences] improved overall performance of the preferences-view, including filtering and switching scopes [#8263](https://github.com/eclipse-theia/theia/pull/8263) +- [repo] updated list of builtin extensions when using the example applications [#9017](https://github.com/eclipse-theia/theia/pull/9017) +- [repo] uplifted CI/CD to use Python3 exclusively [#9085](https://github.com/eclipse-theia/theia/pull/9085) +- [search-in-workspace] fixed styling of the replace item border [#9090](https://github.com/eclipse-theia/theia/pull/9090) +- [task] updated logic to activate corresponding terminal when using the `show running tasks` action [#9016](https://github.com/eclipse-theia/theia/pull/9016) +- [vsx-registry] added API compatibility handling when installing extensions through the 'extensions-view' [#8191](https://github.com/eclipse-theia/theia/pull/8191) + +[Breaking Changes:](#breaking_changes_1.11.0) + +- [core] updated `SearchBox.input` field type from `HTMLInputElement` to `HTMLSpanElement` [#9005](https://github.com/eclipse-theia/theia/pull/9005) + + + +- [[user-storage]](#1.11.0_user-storage_scheme_updated) `UserStorageUri` scheme was changed from 'user_storage' to 'user-storage' as '\_' is not a valid char in scheme (according to [RFC 3986](https://tools.ietf.org/html/rfc3986#page-17)) [#9049](https://github.com/eclipse-theia/theia/pull/9049) + +## v1.10.0 - 1/28/2021 + +- [api-samples] added example on how to contribute toggleable toolbar items [#8968](https://github.com/eclipse-theia/theia/pull/8968) +- [api-tests] fixed the `Saveable#closeOnFileDelete` integration test [#8942](https://github.com/eclipse-theia/theia/pull/8942) +- [core] added support for vscode settings schemas [#8761](https://github.com/eclipse-theia/theia/pull/8761) +- [core] added unit tests for `uri.isEqualOrParent` [#8876](https://github.com/eclipse-theia/theia/pull/8876) +- [core] fixed display issue with horizontal scrollbars in tab areas [#8898](https://github.com/eclipse-theia/theia/pull/8898) +- [core] fixed error message when a command fails to execute [#8978](https://github.com/eclipse-theia/theia/pull/8978) +- [core] fixed issue to allow late client registration [#8586](https://github.com/eclipse-theia/theia/pull/8686) +- [core] fixed issue with `TreeWidget#applyFontStyles` [#8937](https://github.com/eclipse-theia/theia/pull/8937) +- [core] fixed minor typo `mounpoint` to `mountpoint` [#8928](https://github.com/eclipse-theia/theia/pull/8928) +- [core] removed the `save without formatting` menu entry under `file` [#8877](https://github.com/eclipse-theia/theia/pull/8877) +- [core] updated rendering of toggleable toolbar items to highlight them when toggled [#8968](https://github.com/eclipse-theia/theia/pull/8968) +- [dependencies] updated to use fixed versions when publishing, `"x.y.z"` instead of `"^x.y.z"` in dependencies [#8880](https://github.com/eclipse-theia/theia/pull/8880) +- [documentation] updated `NOTICE.md` [#8957](https://github.com/eclipse-theia/theia/pull/8957) +- [filesystem] added support for the `files.trimTrailingWhitespace` preference [#8742](https://github.com/eclipse-theia/theia/pull/8742) +- [filesystem] fixed the type guard for `FileStat.is` [#8986](https://github.com/eclipse-theia/theia/pull/8986) +- [navigator] update the navigator widget factory for extensibility [#8962](https://github.com/eclipse-theia/theia/pull/8962) +- [navigator] updated the menu order for `select for compare` and `compare with selected` [#8926](https://github.com/eclipse-theia/theia/pull/8926) +- [plugin] added `createDeployQuickOpenItem` method to create `DeployQuickOpenItem` in order to make extension deploy command extensible [#8919](https://github.com/eclipse-theia/theia/pull/8919) +- [plugin] added support for `viewsWelcome` in `TreeViews` [#8678](https://github.com/eclipse-theia/theia/pull/8678) +- [plugin] added support for the `CommentThread` Plugin API [#8870](https://github.com/eclipse-theia/theia/pull/8870) +- [plugin] added support for the `workbench.action.navigateBack` command [#8958](https://github.com/eclipse-theia/theia/pull/8958) +- [plugin] added support for the `workbench.action.navigateForward` command [#8958](https://github.com/eclipse-theia/theia/pull/8958) +- [plugin] added support for the `workbench.action.navigateToLastEditLocation` command [#8958](https://github.com/eclipse-theia/theia/pull/8958) +- [plugin] fixed tree-view reveal to not invalidate item command [#8922](https://github.com/eclipse-theia/theia/pull/8922) +- [plugin] updated the logging of embedded languages [#8938](https://github.com/eclipse-theia/theia/pull/8938) +- [preview] upgraded `highlight.js` from `^9.12.2` to `10.4.1` to resolve security vulnerability [#8881](https://github.com/eclipse-theia/theia/pull/8881) +- [scm] updated code required to highlight nodes on search in the `ScmTreeWidget` [#8929](https://github.com/eclipse-theia/theia/pull/8929) +- [task] fixed issue where tasks were not successfully executed without `cwd` explicitly set [#8949](https://github.com/eclipse-theia/theia/pull/8949) +- [terminal] reduced the severity of certain terminal logs [#8908](https://github.com/eclipse-theia/theia/pull/8908) + +[Breaking Changes:](#breaking_changes_1.10.0) + +- [scm] added the `caption` field to the `ScmTreeWidget.Props` interface. Removed `name` from `ScmResourceComponent.Props`, `groupLabel` from `ScmResourceGroupComponent.Props`, and `path` from `ScmResourceFolderElement.Props` interfaces. [#8929](https://github.com/eclipse-theia/theia/pull/8929) diff --git a/doc/changelogs/CHANGELOG-2022.md b/doc/changelogs/CHANGELOG-2022.md new file mode 100644 index 0000000..9e70a8e --- /dev/null +++ b/doc/changelogs/CHANGELOG-2022.md @@ -0,0 +1,699 @@ +# Changelog 2022 + +## v1.33.0 - 12/20/2022 + +- [application-package] added support for declaring extensions as peer dependencies [#11808](https://github.com/eclipse-theia/theia/pull/11808) +- [core] added handling for filesystem permissions [#11965](https://github.com/eclipse-theia/theia/pull/11965) +- [core] fixed handling of submenu children for toolbars [#11910](https://github.com/eclipse-theia/theia/pull/11910) +- [core] fixed top border theming for tabs [#11957](https://github.com/eclipse-theia/theia/pull/11957) +- [debug] added ability to remove watch expressions individually [#11956](https://github.com/eclipse-theia/theia/pull/11956) +- [debug] added handling to wait for debugger capabilities initialization before breakpoints update [#11607](https://github.com/eclipse-theia/theia/pull/11607) +- [debug] added localization for the disassembly view title [#11939](https://github.com/eclipse-theia/theia/pull/11939) +- [debug] fixed `watch` expression errors [#11953](https://github.com/eclipse-theia/theia/pull/11953) +- [editor] added `toggle sticky scroll` command and menu item [#11926](https://github.com/eclipse-theia/theia/pull/11926) +- [monaco] added handling to properly respect scrollbar preferences for editors [#11883](https://github.com/eclipse-theia/theia/pull/11883) +- [output] fixed unique key error for the output channel selector [#11922](https://github.com/eclipse-theia/theia/pull/11922) +- [plugin] added `enableForms` field to `WebviewOptions` [#11983](https://github.com/eclipse-theia/theia/pull/11983) - Contributed on behalf of STMicroelectronics +- [plugin] added stubbing of `notebook` related VS Code APIs [#11993](https://github.com/eclipse-theia/theia/pull/11993)- Contributed on behalf of STMicroelectronics +- [plugin] added support for the `DebugSession.parentSession` VS Code API [#11925](https://github.com/eclipse-theia/theia/pull/11925) +- [plugin] added support for the `InlineCompletion` related VS Code APIs [#11901](https://github.com/eclipse-theia/theia/pull/11901) +- [plugin] added support for the `TaskGroup.id` VS Code API [#11944](https://github.com/eclipse-theia/theia/pull/11944) +- [plugin] added support for the `TaskGroup.isDefault` VS Code API [#11944](https://github.com/eclipse-theia/theia/pull/11944) +- [plugin] added support for the `hcLight` VS Code API [#11589](https://github.com/eclipse-theia/theia/pull/11589) +- [preferences] fixed issue regarding step validation in numeric inputs [#11927](https://github.com/eclipse-theia/theia/pull/11927) +- [scripts] integrated start-up performance scripts into nightly master build [#10463](https://github.com/eclipse-theia/theia/pull/10463) - Contributed on behalf of STMicroelectronics + +[Breaking Changes:](#breaking_changes_1.33.0) + +- [core] updated the returns of many methods of `MenuModelRegistry` changed from `CompositeMenuNode` to `MutableCompoundMenuNode`. To mutate a menu, use the `updateOptions` method or add a check for `instanceof CompositeMenuNode`, which will be true in most cases [#11910](https://github.com/eclipse-theia/theia/pull/11910) +- [plugin-ext] refactored the plugin RPC API - now also reuses the msgpackR based RPC protocol that is better suited for handling binary data and enables message tunneling [#11228](https://github.com/eclipse-theia/theia/pull/11261). All plugin protocol types now use `UInt8Array` as type for message parameters instead of `string` - Contributed on behalf of STMicroelectronics. + +## v1.32.0 - 11/24/2022 + +- [application-manager] fixed various webpack warnings during the build [#11830](https://github.com/eclipse-theia/theia/pull/11830) +- [application-package] fixed "Failed to resolve module" warnings during the build [#11830](https://github.com/eclipse-theia/theia/pull/11830) +- [core] added support for a generic hover service [#11869](https://github.com/eclipse-theia/theia/pull/11869) +- [core] added unit tests for `objects.ts` [#11762](https://github.com/eclipse-theia/theia/pull/11762) +- [core] fixed an issue when cycling tabs [#11794](https://github.com/eclipse-theia/theia/pull/11794) +- [core] fixed an issue with context-menus for tree-views [#11742](https://github.com/eclipse-theia/theia/pull/11742) +- [core] fixed issue on electron when reloading or opening new windows [#11810](https://github.com/eclipse-theia/theia/pull/11810) +- [core] fixed issue regarding theme-icons in tree-views [#11914](https://github.com/eclipse-theia/theia/pull/11914) +- [core] fixed various `zh-cn` localizations [#11842](https://github.com/eclipse-theia/theia/pull/11842) +- [core] upgraded `nls` metadata to VS Code `v1.55.2` [#11824](https://github.com/eclipse-theia/theia/pull/11824) +- [debug] fixed the styling for the expansion toggle in the debug-view [#11895](https://github.com/eclipse-theia/theia/pull/11895) +- [filesystem] added support for copy when performing drag-and-drop [#11872](https://github.com/eclipse-theia/theia/pull/11872) +- [filesystem] fixed a potential race condition when copying files and directories [#11857](https://github.com/eclipse-theia/theia/pull/11857) +- [git] upgraded `dugite-extra` from `v0.1.16` to `v0.1.17` [#11782](https://github.com/eclipse-theia/theia/pull/11782) +- [monaco] uplifted `monaco` to VS Code `v1.73.3` [#11787](https://github.com/eclipse-theia/theia/pull/11787) +- [navigator] added support for the `explorer.decorations.colors` preference [#11802](https://github.com/eclipse-theia/theia/pull/11802) +- [plugin] added `Task#runOptions` field and `RunOptions` interface [#11759](https://github.com/eclipse-theia/theia/pull/11759) - Contributed on behalf of STMicroelectronics +- [plugin] added full support for the `TerminalOptions.shellArgs` VS Code API [#11767](https://github.com/eclipse-theia/theia/pull/11767) +- [plugin] added full support for the `withScmProgress` VS Code API [#11798](https://github.com/eclipse-theia/theia/pull/11798) +- [plugin] added support for the `DebugSessionOptions#lifecycleManagedByParent` VS Code API [#11751](https://github.com/eclipse-theia/theia/pull/11751) +- [plugin] aligned typings for `HoverProvider.provideHover` with VS Code [#11862](https://github.com/eclipse-theia/theia/pull/11862) - Contributed on behalf of STMicroelectronics +- [plugin] fixed initialization of the localization service [#11853](https://github.com/eclipse-theia/theia/pull/11853) +- [plugin] fixed issues when using the `separator` in `quick-open` menus [#11834](https://github.com/eclipse-theia/theia/pull/11834) +- [plugin] updated the default VS Code API version from `v1.53.2` to `v1.55.2` [#11823](https://github.com/eclipse-theia/theia/pull/11823) +- [preferences] added localizations for preference validations [#11906](https://github.com/eclipse-theia/theia/pull/11906) +- [repo] fixed various circular dependency warnings [#11432](https://github.com/eclipse-theia/theia/pull/11432) +- [repo] upgraded `minimatch` from `v3.0.4` to `v5.1.0` [#11820](https://github.com/eclipse-theia/theia/pull/11820) +- [repo] upgraded the `lerna` from `v5.5.4` to `v6.0.1` [#11820](https://github.com/eclipse-theia/theia/pull/11820) +- [repo] upgraded the `mocha` dependency and configurations from `^7.0.0` to `^10.1.0` [#11820](https://github.com/eclipse-theia/theia/pull/11820) +- [tasks] added support for `reevaluateOnRerun` run option [#11759](https://github.com/eclipse-theia/theia/pull/11759) - Contributed on behalf of STMicroelectronics + +[Breaking Changes:](#breaking_changes_1.32.0) + +- [application-manager] removed `circular-dependency-plugin` [#11864](https://github.com/eclipse-theia/theia/pull/11864) +- [cli] updated the `download:plugins` script to download and resolve plugins sequentially by default [#11860](https://github.com/eclipse-theia/theia/pull/11860) +- [preferences] moved `PreferenceHeaderRendererContribution` to `preference-node-renderer-creator.ts` [#11432](https://github.com/eclipse-theia/theia/pull/11432) +- [tasks] if the variables of a task should be reevaluated on a rerun (this was the behavior until now) the `reevaluateOnRerun` run option in the task description needs to be set to `true` from now on [#11759](https://github.com/eclipse-theia/theia/pull/11759) - Contributed on behalf of STMicroelectronics +- [workspace] removed `workspace.supportMultiRootWorkspace` preference [#11538](https://github.com/eclipse-theia/theia/pull/11538) +- [workspace] removed method `isMultiRootWorkspaceEnabled` from `WorkspaceService` [#11538](https://github.com/eclipse-theia/theia/pull/11538) + +## v1.31.0 - 10/27/2022 + +- [debug] added confirmation message for debug exit [#11546](https://github.com/eclipse-theia/theia/pull/11546) +- [git] fixed the implementation of the `unstage all` command [#11805](https://github.com/eclipse-theia/theia/pull/11805) +- [messages] fixed transparent notifications issue [#11714](https://github.com/eclipse-theia/theia/pull/11714) +- [monaco] fixed issue with `editor-*` preferences not being applied properly [#11711](https://github.com/eclipse-theia/theia/pull/11711) +- [output] fixed issue with channel selector [#11727](https://github.com/eclipse-theia/theia/pull/11727) +- [plugin] added handling to check if commands registered via `registerTextEditorCommand` are declared in the `package.json` [#11764](https://github.com/eclipse-theia/theia/pull/11764) +- [plugin] added stubs for the `Tests` VS Code API [#11717](https://github.com/eclipse-theia/theia/pull/11717) +- [plugin] added support for the `InlayHints` VS Code API [#11736](https://github.com/eclipse-theia/theia/pull/11736) +- [plugin] added support for the `InlineValues` VS Code API [#11729](https://github.com/eclipse-theia/theia/pull/11729) - Contributed on behalf of STMicroelectronics +- [plugin] added support for the `RelativePattern.baseUri` VS Code API [#11670](https://github.com/eclipse-theia/theia/pull/11670) +- [plugin] added support for the `Terminal.state` VS Code API [#11733](https://github.com/eclipse-theia/theia/pull/11733) +- [plugin] added support for the `TerminalLinkProviders` VS Code API [#11552](https://github.com/eclipse-theia/theia/pull/11552) - Contributed on behalf of STMicroelectronics +- [plugin] added support for the `TerminalOptions.hideFromUser` VS Code API [#11630](https://github.com/eclipse-theia/theia/pull/11630) +- [plugin] added support for the `TreeDataProvider.resolveTreeItem` VS Code API [#11708](https://github.com/eclipse-theia/theia/pull/11708) - Contributed on behalf of STMicroelectronics +- [plugin] added support for the `TypeHierarchy` VS Code API [#11694](https://github.com/eclipse-theia/theia/pull/11694) +- [plugin] fixed issues when registering VS Code menus to corresponding internal menus [#11741](https://github.com/eclipse-theia/theia/pull/11741) +- [plugin] improved extensibility of `HostedPluginSupport` [#11755](https://github.com/eclipse-theia/theia/pull/11755) +- [plugin] improved support for VS Code web extensions [#11752](https://github.com/eclipse-theia/theia/pull/11752) +- [plugin] introduced `theia-extra.d.ts` for plugin APIs specific to Theia [#11684](https://github.com/eclipse-theia/theia/pull/11684) +- [process] fixed issue where an incorrect terminal is attached when switching workspaces [#11440](https://github.com/eclipse-theia/theia/pull/11440) +- [repo] added automated license check reviews through `dash-licenses` [#11766](https://github.com/eclipse-theia/theia/pull/11766) +- [repo] performed `yarn upgrade` [#11773](https://github.com/eclipse-theia/theia/pull/11773) +- [repo] updated CI runners from `ubuntu-18.04` to `ubuntu-latest` [#11731](https://github.com/eclipse-theia/theia/pull/11731) +- [repo] upgraded `lerna` to `v5.5.4` [#11738](https://github.com/eclipse-theia/theia/pull/11738) +- [terminal] added secondary window support to extract terminals [#11707](https://github.com/eclipse-theia/theia/pull/11707) + +[Breaking Changes:](#breaking_changes_1.31.0) + +- [core] the generated webpack configuration (`gen-webpack.config.js`) now exports an array of two webpack configs instead of a single one: the first contains the config for +generating the main code bundle (as before), the second serves to generate a *.css file for inclusion into `secondaryWindow.html` [#11707](https://github.com/eclipse-theia/theia/pull/11707) +- [plugin-ext] `when` clauses removed from `codeToTheiaMappings` [#11741](https://github.com/eclipse-theia/theia/pull/#11741) +- [terminal] the `AbstractCmdClickTerminalContribution` API has been removed in favor of the `TerminalLinkProvider` interface [#11552](https://github.com/eclipse-theia/theia/pull/11552) - Contributed on behalf of STMicroelectronics +- [typehierarchy] - Adding Support of vscode TypeHierarchy API with the following breaking changes: [#11694](https://github.com/eclipse-theia/theia/pull/11694) + - [plugin-ext/main] The file `callhierarchy-type-converters.ts` was renamed to `hierarchy-types-converters.ts` + - The method `toDefinition` was renamed to `toItemHierarchyDefinition` and the overloaded signatures were removed. + - The method `fromDefinition` was replaced for `fromItemHierarchyDefinition` to convert both `TypeHierarchyItem` and `CallHierarchyItem` to a common `HierarchyItem`. + - [plugin-ext/plugin] - `type-converters.ts #fromCallHierarchyItem` was replaced by `fromHierarchyItem` to convert from `CallHierarchyItem` or `TypeHierarchyItem` to `HierarchyItem`. + +## v1.30.0 - 9/29/2022 + +- [core] added functionality ot listen to keyboard layout changes [#11689](https://github.com/eclipse-theia/theia/pull/11689) +- [core] added support for moving webview-based views into a secondary window for browser applications [#11048](https://github.com/eclipse-theia/theia/pull/11048) - Contributed on behalf of ST Microelectronics and Ericsson and by ARM and EclipseSource + - Added the new `@theia/secondary-window` extension which contributes the UI to enable the new feature. +- [core] fixed RPC decoding errors on large objects [#11636](https://github.com/eclipse-theia/theia/pull/11636) +- [core] fixed `about` dialog rendering when closed and re-opened [#11687](https://github.com/eclipse-theia/theia/pull/11687) +- [core] fixed programmatic movement of views [#11576](https://github.com/eclipse-theia/theia/pull/11576) +- [core] improved application title functionality [#10916](https://github.com/eclipse-theia/theia/pull/10916) +- [core] improved rendering of tab-bars to have unique `id` [#11622](https://github.com/eclipse-theia/theia/pull/11622) +- [core] restored cancellation token behavior in RPC calls [#11693](https://github.com/eclipse-theia/theia/pull/11693) +- [core] updated `about` dialog to include additional framework information [#11687](https://github.com/eclipse-theia/theia/pull/11687) +- [documentation] created dedicated `code guidelines` and `code organization` docs [#11529](https://github.com/eclipse-theia/theia/pull/11529) +- [documentation] updated minimally supported node version to `>=14.18.0` [#11621](https://github.com/eclipse-theia/theia/pull/11621) +- [editor] added handling to organize `edt` quick-pick entries by area and groups [#11611](https://github.com/eclipse-theia/theia/pull/11611) +- [getting-started] updated view to include a link to the API compatibility report [#11691](https://github.com/eclipse-theia/theia/pull/11691) +- [git] fixed `Discard All` for new files [#11677](https://github.com/eclipse-theia/theia/pull/11677) +- [git] fixed `unstage` bug where all files were reverted [#11635](https://github.com/eclipse-theia/theia/pull/11635) +- [git] re-added support for decoration preferences [#11674](https://github.com/eclipse-theia/theia/pull/11674) +- [markers] updated marker decorations in the navigator [#11671](https://github.com/eclipse-theia/theia/pull/11671) +- [navigator] fixed `closed all` toolbar enablement and visibility [#11634](https://github.com/eclipse-theia/theia/pull/11634) +- [navigator] fixed `save all tabs` toolbar enablement and visibility [#11634](https://github.com/eclipse-theia/theia/pull/11634) +- [output] improved extensibility of `OutputEditorFactory` and `OutputEditorModelFactory` [#11615](https://github.com/eclipse-theia/theia/pull/11615) +- [plugin] added `buttons` support in the `QuickPickItem` VS Code API [#11650](https://github.com/eclipse-theia/theia/pull/11650) +- [plugin] added support for `MarkdownString` tooltips in `TreeItem` [#11661](https://github.com/eclipse-theia/theia/pull/11661) +- [plugin] added support for cancellation tokens on file events [#11658](https://github.com/eclipse-theia/theia/pull/11658) +- [plugin] added support for the `FoldingRangeProvider#onDidChangeFoldingRanges` VS Code API [#11696](https://github.com/eclipse-theia/theia/pull/11696) +- [plugin] added support for the `Pseudoterminal#onDidChangeName` VS Code API [#11657](https://github.com/eclipse-theia/theia/pull/11657) +- [plugin] added support for the `Terminal#creationOptions` VS Code API [#11623](https://github.com/eclipse-theia/theia/pull/11623) +- [plugin] added support for the `TerminalOptions.strictEnv` VS Code API [#11641](https://github.com/eclipse-theia/theia/pull/11641) +- [plugin] added support for the deprecated `show` overload [#11649](https://github.com/eclipse-theia/theia/pull/11649) +- [plugin] fixed `autoSave` behavior for custom-editors [#11599](https://github.com/eclipse-theia/theia/pull/11599) +- [plugin] fixed handling when closing dirty custom-editors [#11593](https://github.com/eclipse-theia/theia/pull/11593) +- [plugin] fixed the `EventEmitter.fire` signature according to the VS Code API [#11655](https://github.com/eclipse-theia/theia/pull/11655) +- [plugin] updated `theia.d.ts` docs, typings and syntax errors [#11493](https://github.com/eclipse-theia/theia/pull/11493) +- [preferences] improved `color` and `icon` theme preference selection [#11678](https://github.com/eclipse-theia/theia/pull/11678) +- [process] fixed `env` when building commands [#11609](https://github.com/eclipse-theia/theia/pull/11609) +- [repo] improved overall repository size [#11653](https://github.com/eclipse-theia/theia/pull/11653) +- [vscode] added support for `CodeActionTriggerKind` [#11695](https://github.com/eclipse-theia/theia/pull/11695) +- [vsx-registry] updated `nls` localizations [#11637](https://github.com/eclipse-theia/theia/pull/11637) +- [workspace] added functionality to pass down `options` to `open` and `reload` window methods [#11571](https://github.com/eclipse-theia/theia/pull/11571) + +[Breaking Changes:](#breaking_changes_1.30.0) + +- [core] added constructor injection to `ApplicationShell`: `SecondaryWindowHandler` [#11048](https://github.com/eclipse-theia/theia/pull/11048) - Contributed on behalf of ST Microelectronics and Ericsson and by ARM and EclipseSource +- [core] changed type of `FrontendApplicationConfig#defaultTheme` from `string` to `DefaultTheme` [#11570](https://github.com/eclipse-theia/theia/pull/11570) + - From now on, the default theme can be dispatched based on the OS theme. Use `DefaultTheme#defaultForOSTheme` to derive the `string` theme ID. +- [plugin-ext] removed `ctrlcmd+shift+l` keybinding for `pluginsView:toggle` [#11608](https://github.com/eclipse-theia/theia/pull/11608) + +## v1.29.0 - 8/25/2022 + +- [application-manager] added the `applicationName` in the frontend generator [#11575](https://github.com/eclipse-theia/theia/pull/11575) +- [cli] enhanced the cli to include tooling for checking mismatches of Theia dependencies [#11483](https://github.com/eclipse-theia/theia/pull/11483) +- [core] added handling to prevent the application on OSX from not displaying menus [#11584](https://github.com/eclipse-theia/theia/pull/11584) +- [core] added handling to respect the `included` preference schema property [#11588](https://github.com/eclipse-theia/theia/pull/11588) +- [core] added support for `workbench.action.focusNthEditorGroup` [#11496](https://github.com/eclipse-theia/theia/pull/11496) +- [core] added support for the `toggle breadcrumbs` command [#11548](https://github.com/eclipse-theia/theia/pull/11548) +- [core] fixed rendering for empty submenus [#11577](https://github.com/eclipse-theia/theia/pull/11577) +- [core] updated handling to properly hide toolbars on inactive tabbars [#11480](https://github.com/eclipse-theia/theia/pull/11480) +- [core] updated to `msgpackr` for encoding of rpc messages [#11447](https://github.com/eclipse-theia/theia/pull/11447) +- [debug] added support for compound launches [#11444](https://github.com/eclipse-theia/theia/pull/11444) +- [debug] fixed an issue where the debug hover would not appear [#11597](https://github.com/eclipse-theia/theia/pull/11597) +- [editor] added support for `next group` and `previous group` commands [#11545](https://github.com/eclipse-theia/theia/pull/11545) +- [ffmpeg] updated `@electron/get` to `v2.0.0` [#11573](https://github.com/eclipse-theia/theia/pull/11573) +- [git] fixed an issue with blame annotations [#11540](https://github.com/eclipse-theia/theia/pull/11540) +- [git] fixed issue when performing `discard changes` on a new file [#11532](https://github.com/eclipse-theia/theia/pull/11532) +- [memory-inspector] added the `@theia/memory-inspector` extension [#11394](https://github.com/eclipse-theia/theia/pull/11394) +- [monaco] updated handling for invalid theming values [#11596](https://github.com/eclipse-theia/theia/pull/11596) +- [plugin] added support for VS Code theme icons [#11527](https://github.com/eclipse-theia/theia/pull/11527) +- [plugin] added support for `EvaluatableExpressions` [#11484](https://github.com/eclipse-theia/theia/pull/11484) - Contributed on behalf of STMicroelectronics +- [plugin] added support for `keys` in the `Memento` VS Code API [#11487](https://github.com/eclipse-theia/theia/pull/11487) +- [plugin] added support for the `InputBoxValidationMessage` VS Code API [#11492](https://github.com/eclipse-theia/theia/pull/11472) +- [plugin] fixed an issue when the text document provider returns an empty string [#11474](https://github.com/eclipse-theia/theia/pull/11474) +- [plugin] improved preference access for plugins [#11393](https://github.com/eclipse-theia/theia/pull/11393) +- [plugin] updated authentication VS Code API [#11564](https://github.com/eclipse-theia/theia/pull/11564) +- [plugin] updated handling when restoring the current language [#11472](https://github.com/eclipse-theia/theia/pull/11472) +- [plugin] updated styling for spinning icons [#11542](https://github.com/eclipse-theia/theia/pull/11542) +- [repo] added `no-unreachable` eslint rule [#11476](https://github.com/eclipse-theia/theia/pull/11476) +- [repo] replaced usages of `any` [#11490](https://github.com/eclipse-theia/theia/pull/11490) +- [scm] added handling to select nodes according to the active editor [#11560](https://github.com/eclipse-theia/theia/pull/11560) +- [terminal] added `toggle terminal` command [#11193](https://github.com/eclipse-theia/theia/pull/11193) +- [terminal] improved terminal link matching [#11398](https://github.com/eclipse-theia/theia/pull/11398) +- [terminal] updated the `terminal clear` command to not require terminal focus [#11565](https://github.com/eclipse-theia/theia/pull/11565) +- [vsx-registry] fixed an issue preventing extensions from being installed on new setups [#11486](https://github.com/eclipse-theia/theia/pull/11486) +- [vsx-registry] improved styling of the `Extensions` view [#11494](https://github.com/eclipse-theia/theia/pull/11494) +- [vsx-registry] removed localization for `Open VSX Registry` [#11523](https://github.com/eclipse-theia/theia/pull/11523) +- [vsx-registry] updated extension editor rendering [#11605](https://github.com/eclipse-theia/theia/pull/11605) + +[Breaking Changes:](#breaking_changes_1.29.0) + +- [core] replaced `Emitter` fields by `Event` fields in both `DescriptionWidget` and `BadgeWidget` [#11601](https://github.com/eclipse-theia/theia/pull/11601) +- [core] replaced `react-virtualized` with `react-virtuoso` for tree rendering. Removed the `TreeWidget#forceUpdate`, `TreeWidget#handleScroll` and `TreeWidget.View#renderTreeRow` methods in the process [#11553](https://github.com/eclipse-theia/theia/pull/11553) +- [core] `updateThemePreference` and `updateThemeFromPreference` removed from `CommonFrontendContribution`. Corresponding functionality as been moved to the respective theme service. `load` removed from `IconThemeService` [#11473](https://github.com/eclipse-theia/theia/issues/11473) +- [core] removed `WidgetManager.widgetPromises`; use `WidgetManager.widgets` instead [#11555](https://github.com/eclipse-theia/theia/pull/11555) +- [core] updated `react` and `react-dom` dependencies to version 18, which introduce new root API for rendering (replaces ReactDOM.render). Since React no longer supports render callbacks, the `onRender` field from `ReactDialog` and `ReactWidget` was removed. [#11455](https://github.com/eclipse-theia/theia/pull/11455) - Contributed on behalf of STMicroelectronics +- [workspace] removed `DefaultWorkspaceServer#untitledWorkspaceStaleThreshhold`; use `DefaultWorkspaceServer#untitledWorkspaceStaleThreshold` instead [#11603](https://github.com/eclipse-theia/theia/pull/11603) + +## v1.28.0 - 7/28/2022 + +- [cli] improved error handling when interacting with the API [#11454](https://github.com/eclipse-theia/theia/issues/11454) +- [core] added better support when unloading language packs [#11338](https://github.com/eclipse-theia/theia/pull/11338) +- [core] added proper support for null-value RPC encoding [#11396](https://github.com/eclipse-theia/theia/pull/11396) +- [core] updated `WidgetManager` to compare keys using deep equal [#11450](https://github.com/eclipse-theia/theia/issues/11450) +- [core] updated handling to pass `StopReason` to `OnWillStopAction` [#11428](https://github.com/eclipse-theia/theia/issues/11428) +- [core] updated the `caption` rendering for `ViewContainer` [#11422](https://github.com/eclipse-theia/theia/pull/11422) +- [debug] added support for `InstructionBreakpoints` [#111866](https://github.com/eclipse-theia/theia/pull/11186) +- [debug] added support for the `Disassembly` view [#11186](https://github.com/eclipse-theia/theia/pull/11186) +- [debug] added the ability to dismiss exception widgets [#11441](https://github.com/eclipse-theia/theia/issues/11441) +- [debug] fixed an issue causing an infinite loop with child debug sessions [#11388](https://github.com/eclipse-theia/theia/pull/11388) +- [file-search] updated `vscode-ripgrep` to `@vscode-ripgrep@1.14.2` [#11389](https://github.com/eclipse-theia/theia/pull/11389) +- [filesystem] fixed implementation of `FileChangeEvent#contains` [#11409](https://github.com/eclipse-theia/theia/pull/11409) +- [git] upgraded `dugite-extra` to `v0.1.16` [#11445](https://github.com/eclipse-theia/theia/issues/11445) +- [keymaps] added handling for multiple keybindings for a given command [#11363](https://github.com/eclipse-theia/theia/pull/11363) +- [markers] updated rendering of markers [#11408](https://github.com/eclipse-theia/theia/pull/11408) +- [monaco] added localization support for commands contributed by monaco [#11434](https://github.com/eclipse-theia/theia/pull/11434) +- [monaco] fixed `activeItem` handling in the `QuickPick` menu [#11438](https://github.com/eclipse-theia/theia/pull/11438) +- [monaco] improved `tokenization` performance [#11416](https://github.com/eclipse-theia/theia/pull/11416) +- [monaco] upgraded monaco to VS Code `v1.67.2` [#11331](https://github.com/eclipse-theia/theia/pull/11331) +- [navigator] updated `New File` and `New Folder` to only appear for folders [#11453](https://github.com/eclipse-theia/theia/issues/11453) +- [navigator] updated explorer toolbar items [#11429](https://github.com/eclipse-theia/theia/pull/11429) +- [plugin] added support for `activeParameter` in the `SignatureInformation` VS Code API [#11426](https://github.com/eclipse-theia/theia/pull/11426) +- [plugin] added support for `title` in the `QuickPickOptions` VS Code API [#11418](https://github.com/eclipse-theia/theia/pull/11418) +- [plugin] added support for `vscode.env` VS Code API namespace [#11446](https://github.com/eclipse-theia/theia/issues/11446) +- [plugin] added support for all selected URIs in command execution [#11433](https://github.com/eclipse-theia/theia/pull/11433) +- [plugin] added support for the `DebugProtocolBreakpoint` and `DebugProtocolSource` VS Code API [#10011](https://github.com/eclipse-theia/theia/issues/10011) - Contributed on behalf of STMicroelectronics +- [plugin] added support for the `TerminalOptions#message` VS Code API [#11385](https://github.com/eclipse-theia/theia/pull/11835) +- [plugin] added support for the `workbench.action.saveWorkspaceAs` command [#11395](https://github.com/eclipse-theia/theia/pull/11395) +- [plugin] added support for the property `SourceControlInputBox#visible` [#11412](https://github.com/eclipse-theia/theia/pull/11412) - Contributed on behalf of STMicroelectronics +- [plugin] updated `LocationLink` definition [#11465](https://github.com/eclipse-theia/theia/issues/11456) +- [preferences] added handling to properly dispose the model after saving [#11410](https://github.com/eclipse-theia/theia/pull/11410) +- [process] improved performance of `lsof` on `macOS` [#11411](https://github.com/eclipse-theia/theia/pull/11411) +- [search-in-workspace] updated `Find in Folder` to only apply for folders [#11456](https://github.com/eclipse-theia/theia/issues/11456) +- [search-in-workspace] updated `vscode-ripgrep` to `@vscode-ripgrep@1.14.2` [#11389](https://github.com/eclipse-theia/theia/pull/11389) +- [terminal] added output buffering support [#11449](https://github.com/eclipse-theia/theia/issues/11449) +- [variable-resolver] added handling for user cancellation of variables [#11406](https://github.com/eclipse-theia/theia/pull/11406) +- [vsx-registry] updated the extensions view to display a message when failing to fetch extensions [#11457](https://github.com/eclipse-theia/theia/issues/11457) + +[Breaking Changes:](#breaking_changes_1.28.0) + +- [core] `handleDefault`, `handleElectronDefault` method no longer called in `BrowserMainMenuFactory.registerMenu()`, `DynamicMenuWidget.buildSubMenus()` or `ElectronMainMenuFactory.fillSubmenus()`. Override the respective calling function rather than `handleDefault`. The argument to each of the three methods listed above is now `MenuNode` and not `CompositeMenuNode`, and the methods are truly recursive and called on entire menu tree. `ActionMenuNode.action` removed; access relevant field on `ActionMenuNode.command`, `.when` etc. [#11290](https://github.com/eclipse-theia/theia/pull/11290) +- [core] renamed `CommonCommands.NEW_FILE` to `CommonCommands.NEW_UNTITLED_FILE` [#11429](https://github.com/eclipse-theia/theia/pull/11429) +- [plugin] `CodeEditorWidgetUtil` moved to `packages/plugin-ext/src/main/browser/menus/vscode-theia-menu-mappings.ts`. `MenusContributionPointHandler` extensively refactored. See PR description for details. [#11290](https://github.com/eclipse-theia/theia/pull/11290) +- [plugin] `LocalFilePluginDeployerResolver` moved to `plugin-ext` `local-vsix-file-plugin-deployer-resolver.ts`. [#11466](https://github.com/eclipse-theia/theia/issues/11466) +- [plugin] removed `Plugin: Deploy Plugin by Id` command [#11417](https://github.com/eclipse-theia/theia/pull/11417) +- [vsx-registry] removed `downloadPath` field from `VSXExtensionResolver`. Plugins are now placed directly in user plugin directory. [#11466](https://github.com/eclipse-theia/theia/issues/11466) + +## v1.27.0 - 6/30/2022 + +- [core] added better styling for active sidepanel borders [#11330](https://github.com/eclipse-theia/theia/pull/11330) +- [core] added handling to preserve recently used commands for different languages [#11336](https://github.com/eclipse-theia/theia/pull/11336) +- [core] added missing localizations for file save dialogs [#11367](https://github.com/eclipse-theia/theia/pull/11367) +- [core] added missing tooltips when closing and pinning tabs [#11272](https://github.com/eclipse-theia/theia/pull/11272) +- [core] added support for fine-grained dynamic styling in the code [#11280](https://github.com/eclipse-theia/theia/pull/11280) +- [core] fixed `url` and `fs` path comparison for stop requests [#11229](https://github.com/eclipse-theia/theia/pull/11229) +- [core] fixed an issue where breadcrumbs are hidden when editors are maximized [#11250](https://github.com/eclipse-theia/theia/pull/11250) +- [core] fixed context menus for `CompressedTreeWidget` nodes [#11230](https://github.com/eclipse-theia/theia/pull/11230) +- [core] improved `TreeWidget` focus handling and keyboard navigation [#11200](https://github.com/eclipse-theia/theia/pull/11200) +- [core] improved `uri` creation for untitled resources [#11347](https://github.com/eclipse-theia/theia/pull/11347) +- [core] refactored theme initialization to occur within application lifecycle rather than at import time [#11213](https://github.com/eclipse-theia/theia/pull/11213) +- [core] updated `Configure Display Language` command to align with VS Code [#11289](https://github.com/eclipse-theia/theia/pull/11289) +- [core] updated `cursor` for active menu items [#11223](https://github.com/eclipse-theia/theia/pull/11223) +- [core] updated cursor for the custom select component [#11305](https://github.com/eclipse-theia/theia/pull/11305) +- [core] updated handling for editor and editor previews so they are more flexible [#11168](https://github.com/eclipse-theia/theia/pull/11168) +- [core] updated internal localization data [#11379](https://github.com/eclipse-theia/theia/pull/11379) +- [debug] added support for dynamic debug configurations [#10212](https://github.com/eclipse-theia/theia/pull/10212) +- [debug] fixed `runtime-import-check` errors for `DebugPluginConfiguration` [#11224](https://github.com/eclipse-theia/theia/pull/11224) +- [file-search] updated file search to produce better results [#11232](https://github.com/eclipse-theia/theia/pull/11232) +- [filesystem] added handling to omit `all files` filter in Electron on Linux when no other filters exist [#11325](https://github.com/eclipse-theia/theia/pull/11325) +- [filesystem] updated `nsfw` to simplify event path resolution [#11322](https://github.com/eclipse-theia/theia/pull/11322) +- [filesystem] upgraded `multer` dependency to `1.4.4-lts.1` [#11215](https://github.com/eclipse-theia/theia/pull/11215) +- [getting-started] improved icon alignment [#11370](https://github.com/eclipse-theia/theia/pull/11370) +- [git] added support for the `git.untrackedChanges` preference [#11256](https://github.com/eclipse-theia/theia/pull/11256) +- [keymaps] fixed search when keybindings are updated [#11366](https://github.com/eclipse-theia/theia/pull/11366) +- [monaco] added preference validations to `monaco` [#11257](https://github.com/eclipse-theia/theia/pull/11257) +- [monaco] fixed symbol icons [#11358](https://github.com/eclipse-theia/theia/pull/11358) +- [navigator] updated `open editors` UI [#10940](https://github.com/eclipse-theia/theia/pull/10940) +- [output] added handling to prevent `output-widget` from handling any drag/drop events [#11275](https://github.com/eclipse-theia/theia/pull/11275) +- [playwright] updated `@playwright/test` dependency [#11313](https://github.com/eclipse-theia/theia/pull/11313) +- [plugin] added `Thenable` type to API and replaced `PromiseLike` with `Thenable` [#11352](https://github.com/eclipse-theia/theia/pull/11352) - Contributed on behalf of STMicroelectronics +- [plugin] added handling to fully localize plugin data [#11334](https://github.com/eclipse-theia/theia/pull/11334) +- [plugin] added handling to prevent duplicate `view welcome` [#11312](https://github.com/eclipse-theia/theia/pull/11312) +- [plugin] added support for `TreeItemLabel` in `TreeItem` [#11288](https://github.com/eclipse-theia/theia/pull/11288) - Contributed on behalf of STMicroelectronics +- [plugin] added support for debuggers running in the frontend [#10748](https://github.com/eclipse-theia/theia/pull/10748) +- [plugin] added support for property `color` of `ThemeIcon` [#11243](https://github.com/eclipse-theia/theia/pull/11243) - Contributed on behalf of STMicroelectronics +- [plugin] added support for safe plugin uninstallation [#11084](https://github.com/eclipse-theia/theia/pull/11084) +- [plugin] added support for the `OnEnterRule.previousLineText` VS Code API [#11225](https://github.com/eclipse-theia/theia/pull/11225) +- [plugin] added support for the `TextEditor#show()` and `TextEditor#hide()` VS Code API [#11168](https://github.com/eclipse-theia/theia/pull/11168) - Contributed on behalf of STMicroelectronics +- [plugin] added support for the `languages.configuration.onEnterRules` VS Code API [#11225](https://github.com/eclipse-theia/theia/pull/11225) +- [plugin] added support for the experimental device access functionality from VS Code [#11323](https://github.com/eclipse-theia/theia/pull/11323) +- [plugin] added support for the optional property `TaskPresentationOptions#clear` [#11298](https://github.com/eclipse-theia/theia/pull/11298) - Contributed on behalf of STMicroelectronics +- [plugin] fixed `runtime-import-check` errors [#11224](https://github.com/eclipse-theia/theia/pull/11224) +- [plugin] moved `WebviewViewResolveContext` from `window` to `root` namespace [#11216](https://github.com/eclipse-theia/theia/pull/11216) - Contributed on behalf of STMicroelectronics +- [preferences] added handling to hide deprecated preferences from the UI [#11246](https://github.com/eclipse-theia/theia/pull/11246) +- [preferences] update preference sections so they better reflect individual preferences [#11306](https://github.com/eclipse-theia/theia/pull/11306) +- [repo] added missing localizations across the codebase [#11368](https://github.com/eclipse-theia/theia/pull/11368) +- [repo] added missing localizations for `no-Info` messages [#11354](https://github.com/eclipse-theia/theia/pull/11354) +- [repo] fixed the custom `runtime-import-check` eslint plugin [#11212](https://github.com/eclipse-theia/theia/pull/11212) +- [request] added support for `gzip` encoding [#11337](https://github.com/eclipse-theia/theia/pull/11337) +- [scm] fixed erroneous double border styling [#11382](https://github.com/eclipse-theia/theia/pull/11382) +- [search-in-workspace] improved rendering of result captions [#11345](https://github.com/eclipse-theia/theia/pull/11345) +- [toolbar] improved rendering of toolbars [#11339](https://github.com/eclipse-theia/theia/pull/11339) +- [vsx-registry] added ability to display plugin count for each section in the `extensions` view [#11248](https://github.com/eclipse-theia/theia/pull/11248) +- [vsx-registry] added support for the `Install Another Version...` command [#11303](https://github.com/eclipse-theia/theia/pull/11303) +- [vsx-registry] updated extension readme styling [#11299](https://github.com/eclipse-theia/theia/pull/11299) + +[Breaking Changes:](#breaking_changes_1.27.0) + +- [core] dropped support for Node 12.x, recommend Node 16.x [#11210](https://github.com/eclipse-theia/theia/pull/11210) + - Updated CI/CD matrix to run on Node 14.x, 16.x. +- [core] updated `TreeImpl.refresh` to accept a cancellation token as a second parameter. Extensions that added their own second parameter may be marked as no longer class conforming [#11340](https://github.com/eclipse-theia/theia/pull/11340) +- [core] updated the double-click handler to no longer maximizes a tab by default - controllable through `workbench.tab.maximize` preference [#11279](https://github.com/eclipse-theia/theia/pull/11279) +- [core] refactored the core messaging API - replaced `vscode-ws-jsonrpc` with a custom RPC protocol that is better suited for handling binary data and enables message tunneling [#11228](https://github.com/eclipse-theia/theia/pull/11228) - Contributed on behalf of STMicroelectronics. + - This impacts all main concepts of the messaging API. The API no longer exposes a `Connection` object and uses a generic `Channel` implementation instead. + - Replaces usage of `vscode-json-rpc`'s `Connection` with the new generic `Channel`. Affects `AbstractConnectionProvider`, `MessagingService`, `IPCConnectionProvider`, `ElectronMessagingService` + - `MessagingService`: No longer offers the `listen` and `forward` method. Use `wsChannel` instead. + - `RemoteFileSystemServer`: Use `UInt8Array` instead of plain number arrays for all arguments and return type that store binary data + - `DebugAdapter`: Replaced the debug-service internal `Channel` implementation with the newly introduced generic `Channel`. +- [core] removed `ThemeService.get()`; inject the `ThemeService` instead. Removed `ColorApplicationContribution.initBackground()`; by default the `editor.background` color variable will be initialized through the normal theme initialization process. It is now expected that the `ThemeService` will call `this.deferredInitializer.resolve()` when the `ThemeService` finishes its initialization. Failure to do so in any overrides may cause failures to apply default themes [#11213](https://github.com/eclipse-theia/theia/pull/11213) +- [debug] A single `DebugSessionWidget` is now used for all debug sessions. Code related to opening debug sessions in different areas has been removed, including `DebugViewLocation`, `DebugSessionWidgetFactory`, `DebugSessionContextCommands.OPEN_LEFT`, `...OPEN_RIGHT`, `...OPEN_BOTTOM`, the preference `debug.debugViewLocation`, `DebugViewOptions`. The bindings of the component widgets have also been changed to allow them to be created using the `WidgetManager` rather than via `inversify` injection. [#11277](https://github.com/eclipse-theia/theia/pull/11277) +- [debug] adding dynamic debug configurations support included the following breaking changes: [#10212](https://github.com/eclipse-theia/theia/pull/10212) + - Changed signature of `DebugConfigurationManager.find` to receive a target DebugConfiguration instead of a configuration's name. + NOTE: The original signature is still available but no longer used inside the framework and therefore marked as `deprecated` + - Multiple methods related to the selection of Debug configuration options were relocated from `debug-configuration-widget.tsx` to the new file `debug-configuration-select.tsx`. + - Removed optional interface property `DebugConfiguration.dynamic`. + - Added the following method to the interface `DebugService`: `fetchDynamicDebugConfiguration` as well as the property `onDidChangedDebugConfigurationProviders`. + - Removed method `DebugPrefixConfiguration#runDynamicConfiguration` + - [core] The interface `SelectComponentProps` was updated to rename a property from `value` to `defaultValue` +- [debug] debug files not unique to the backend have been moved from `node` to `common` [#10748](https://github.com/eclipse-theia/theia/pull/10748) +- [monaco] removed static methods `init()`, `register()`, `restore()`, `updateBodyUiTheme()` from `MonacoThemingService`; use instance methods `initialize()`, `registerParsedTheme()`, `restore()`, `updateBodyUiTheme()` instead. Removed `MonacoThemeRegistry.SINGLETON`, inject `MonacoThemeRegistry` instead. [#11213](https://github.com/eclipse-theia/theia/pull/11213) +- [plugin-ext] renamed `debug` file to `debug-ext` [#10748](https://github.com/eclipse-theia/theia/pull/10748) +- [plugin-ext] updated method `registerDebuggersContributions` to include an additional parameter in the signature `pluginType` to specify `frontend` or `backend` [#10748](https://github.com/eclipse-theia/theia/pull/10748) +- [plugin] removed `TreeItem2` from the proposed plugin API, `TreeItem` can be used instead [#11288](https://github.com/eclipse-theia/theia/pull/11288) - Contributed on behalf of STMicroelectronics +- [plugin] moved and renamed interface from: `@theia/debug/lib/browser/debug-contribution/DebugPluginConfiguration` to: `plugin-dev/src/common/PluginDebugConfiguration` [#11224](https://github.com/eclipse-theia/theia/pull/11224) +- [repo] removed low hanging-fruit deprecations: + - [callhierarchy] removed the deprecated `current-editor-access.ts` file [#11185](https://github.com/eclipse-theia/theia/pull/11185) + - [core] `ColorRegistry` no longer exports `Color`, `ColorDefaults`, `ColorDefinition` and `ColorCssVariable`. Import from `core/lib/common/color` instead [#11185](https://github.com/eclipse-theia/theia/pull/11185) + - [core] removed deprecated signature for `ContextMenuRenderer` method `render` [#11185](https://github.com/eclipse-theia/theia/pull/11185) + - [core] removed deprecated `FOLDER_ICON` and `FILE_ICON` [#11185](https://github.com/eclipse-theia/theia/pull/11185) + - [core] removed deprecated `JsonType` re-export from `preference-schema` [#11185](https://github.com/eclipse-theia/theia/pull/11185) + - [core] removed deprecated `onVisibilityChanged` event from `view-container` [#11185](https://github.com/eclipse-theia/theia/pull/11185) + - [core] removed deprecated `theme` re-export, should be imported from `common/theme` instead [#11185](https://github.com/eclipse-theia/theia/pull/11185) + - [core] removed deprecated methods and re-export in `preference-contribution` [#11185](https://github.com/eclipse-theia/theia/pull/11185) + - removed `overridePreferenceName`. + - removed `testOverrideValue`. + - removed `overriddenPreferenceName`. + - removed `OVERRIDE_PROPERTY_PATTERN` re-export. + - [file-search] removed deprecated `defaultIgnorePatterns` [#11185](https://github.com/eclipse-theia/theia/pull/11185) + - [mini-browser] removed deprecated `MiniBrowserEndpoint` and `MiniBrowserEndpoint.HANDLE_PATH` [#11185](https://github.com/eclipse-theia/theia/pull/11185) + - [output] removed `setVisibility` from `OutputChannelManager` [#11185](https://github.com/eclipse-theia/theia/pull/11185) + - [output] removed deprecated const `OUTPUT_WIDGET_KIND` [#11185](https://github.com/eclipse-theia/theia/pull/11185) + - [plugin-ext] deleted `glob.ts` and `paths.ts` [#11185](https://github.com/eclipse-theia/theia/pull/11185) + - [plugin-ext] deleted `untitled-resource.ts` [#11185](https://github.com/eclipse-theia/theia/pull/11185) + - [preferences] removed deprecated `ContextMenuCallbacks` [#11185](https://github.com/eclipse-theia/theia/pull/11185) + - [process] removed the deprecated getters `input`, `output` and `errorOutput` [#11185](https://github.com/eclipse-theia/theia/pull/11185) + - [vsx-registry] removed deprecated `VSXExtensionsCommands` re-export [#11185](https://github.com/eclipse-theia/theia/pull/11185) + - [workspace] removed deprecated `getDefaultWorkspacePath` [#11185](https://github.com/eclipse-theia/theia/pull/11185) +- [search-in-workspace] updated `replaceResult` and `confirmReplaceAll` to now require a parameter `replacementText` [#11374](https://github.com/eclipse-theia/theia/pull/11374) + +## v1.26.0 - 5/26/2022 + +- [application-package] introduce application config prop `validatePreferencesSchema` to control whether to validate preferences on start [#11189](https://github.com/eclipse-theia/theia/pull/11189) +- [cli] added ability to perform the download of plugins sequentially [#11112](https://github.com/eclipse-theia/theia/pull/11112) +- [cli] updated the `download:plugins` script to respect proxy settings [#11043](https://github.com/eclipse-theia/theia/pull/11043) +- [console] fixed issue where the maximum debug console history was not respected [#10598](https://github.com/eclipse-theia/theia/pull/10598) +- [core] added `TheiaDockPanel` factory binding for extensibility [#11154](https://github.com/eclipse-theia/theia/pull/11154) +- [core] added support for traversing editor history through mouse buttons [#11163](https://github.com/eclipse-theia/theia/pull/11163) +- [core] added support to respect the `visible` option for `menuBarVisibility` when in fullscreen [#11119](https://github.com/eclipse-theia/theia/pull/11119) +- [core] added timestamps to console logs [#11150](https://github.com/eclipse-theia/theia/pull/11150) +- [core] fixed filesystem path display for Windows [#11180](https://github.com/eclipse-theia/theia/pull/11180) +- [core] fixed statusbar `onclick` handling [#11117](https://github.com/eclipse-theia/theia/pull/11117) +- [core] fixed the display of keybindings for macOS in the browser [#11092](https://github.com/eclipse-theia/theia/pull/11092) +- [core] updated Chinese localization translations [#11182](https://github.com/eclipse-theia/theia/pull/11182) +- [core] updated `UntitledResourceResolver` binding so it is available outside the plugin system [#11195](https://github.com/eclipse-theia/theia/pull/11195) +- [core] updated handling of `ApplicationError` to not re-register the same codes [#11160](https://github.com/eclipse-theia/theia/pull/11160) +- [core] updated styling of buttons when focused [#11192](https://github.com/eclipse-theia/theia/pull/11192) +- [core] updated tree styling to respect decorations during selection [#11118](https://github.com/eclipse-theia/theia/pull/11118) +- [debug] added handling to resolve command variables contributed by debuggers [#11170](https://github.com/eclipse-theia/theia/pull/11170) +- [documentation] updated instructions for building on Windows [#11165](https://github.com/eclipse-theia/theia/pull/11165) +- [filesystem] un-deprecated permission flags [#9269](https://github.com/eclipse-theia/theia/pull/9269) +- [keymaps] added handling to properly update the keybinding widget on keybindings change [#11102](https://github.com/eclipse-theia/theia/pull/11102) +- [monaco] added handling to ensure monaco keybindings are updated on keybindings change [#11101](https://github.com/eclipse-theia/theia/pull/11101) +- [monaco] fixed `onHide` callback in `MonacoContextMenuService` [#11152](https://github.com/eclipse-theia/theia/pull/11152) +- [monaco] fixed an issue where `when` and custom context keys were ignored by monaco [#11095](https://github.com/eclipse-theia/theia/pull/11095) +- [playwright] improved getting started documentation [#11094](https://github.com/eclipse-theia/theia/pull/11094) +- [plugin] added support for the `DebugSession#workspaceFolder` VS Code API [#11090](https://github.com/eclipse-theia/theia/pull/11090) - Contributed on behalf of STMicroelectronics +- [plugin] added support for the `ExtensionMode` VS Code API [#10201](https://github.com/eclipse-theia/theia/pull/10201) - Contributed on behalf of STMicroelectronics +- [plugin] added support for the `LinkedEditingRanges` VS Code API [#11137](https://github.com/eclipse-theia/theia/pull/11137) +- [plugin] added support for the `Terminal#exitStatus` VS Code API [#11175](https://github.com/eclipse-theia/theia/pull/11175) +- [plugin] fixed document path for callhierarchy [#11178](https://github.com/eclipse-theia/theia/pull/11178) +- [repo] updated imports to avoid circular errors [#11142](https://github.com/eclipse-theia/theia/pull/11142) +- [request] introduced `@theia/request` package to send proxy-aware http requests to other services [#11043](https://github.com/eclipse-theia/theia/pull/11043) +- [task] fixed problem matchers when `kind` is a file [#11190](https://github.com/eclipse-theia/theia/pull/11190) +- [workspace] added support to open multi-root workspaces from the cli [#11034](https://github.com/eclipse-theia/theia/pull/11034) + +[Breaking Changes:](#breaking_changes_1.26.0) + +- [callhierarchy] `paths.ts` and `glob.ts` moved to `core/src/common`; `language-selector.ts` moved to `editor/src/common`. Any imports will need to be updated [#11083](https://github.com/eclipse-theia/theia/pull/11083) +- [electron] removed redundant config option `disallowReloadKeybinding` from `dev-packages/application-package/src/application-props.ts` file and corresponding test [#11099](https://github.com/eclipse-theia/theia/pull/11099) +- [filesystem] remove deprecated APIs [#11176](https://github.com/eclipse-theia/theia/pull/1176): + - Deleted `@theia/filesystem/lib/browser/filesystem-watcher`: + - `FileChangeType`, `FileChange`, `FileChangeEvent`, `FileMoveEvent`, `FileEvent`, `FileOperationEmitter`, `FileSystemWatcher` + - Deleted `@theia/filesystem/lib/node/node-file-upload`: + - `NodeFileUpload` + - Deleted `@theia/filesystem/lib/node/nsfw-watcher/nsfw-filesystem-watcher`: + - `WatcherOptions`, `NsfwFileSystemWatcherServer` + - Removed from `@theia/filesystem/lib/common/filesystem`: + - `FileSystem`, `FileMoveOptions`, `FileDeleteOptions`, `FileStat`, `FileSystemError` +- [filesystem] updated `FileStatNodeData.fileStat` to use the non-deprecated `FileStat` from `@theia/core/lib/common/files` [#11176](https://github.com/eclipse-theia/theia/pull/1176) + +## v1.25.0 - 4/28/2022 + +[1.25.0 Milestone](https://github.com/eclipse-theia/theia/milestone/35) + +- [callhierarchy] added handling to cache instances of `callhierarchy` providers [#10857](https://github.com/eclipse-theia/theia/pull/10857) +- [core] added `property-view` API documentation [#11022](https://github.com/eclipse-theia/theia/pull/11022) +- [core] added `selection-service` API documentation [#11022](https://github.com/eclipse-theia/theia/pull/11022) +- [core] added additional statusbar theming colors [#11026](https://github.com/eclipse-theia/theia/pull/11026) +- [core] added better support for conversion between windows and posix paths [#10591](https://github.com/eclipse-theia/theia/pull/10591) +- [core] added handling to guarantee `showQuickPick` resolves on hide [#11068](https://github.com/eclipse-theia/theia/pull/11068) +- [core] added support for a custom select component [#10991](https://github.com/eclipse-theia/theia/pull/10991) +- [core] added support for decorations in file-based tree-views [#10846](https://github.com/eclipse-theia/theia/pull/10846) +- [core] fixed an issue with `Disposable.NULL` [#11053](https://github.com/eclipse-theia/theia/pull/11053) +- [core] fixed issue when attempting to perform `save as` [#11032](https://github.com/eclipse-theia/theia/pull/11032) +- [core] fixed issue with the electron token on Windows [#11082](https://github.com/eclipse-theia/theia/pull/11082) +- [core] fixed localization issue resulting in incorrect casing after translating [#11042](https://github.com/eclipse-theia/theia/pull/11042) +- [core] fixed styling issues related to quick-input styling [#11029](https://github.com/eclipse-theia/theia/pull/11029) +- [core] improved display and styling of tabbars [#10908](https://github.com/eclipse-theia/theia/pull/10908) +- [core] moved code for untitled resources into `core` from `plugin-ext` and allow users to open untitled editors with `New File` command [#10868](https://github.com/eclipse-theia/theia/pull/10868) +- [core] removed window focus listener on `unload` [#11075](https://github.com/eclipse-theia/theia/pull/11075) +- [git] upgraded `moment` to resolve vulnerability [#11009](https://github.com/eclipse-theia/theia/pull/11009) +- [monaco] fixed issue related to `selection` in monaco editors [#11049](https://github.com/eclipse-theia/theia/pull/11049) +- [monaco] improved quick-pick attachment [#11054](https://github.com/eclipse-theia/theia/pull/11054) +- [monaco] restored `detail` to `EditorMouseEvent` to fix `CommentThread` issue [#11065](https://github.com/eclipse-theia/theia/pull/11065) +- [playwright] added handling to improve extensibility for custom theia applications [#11071](https://github.com/eclipse-theia/theia/pull/11071) +- [playwright] fixed an issue with publishing the `lib` folder [#11014](https://github.com/eclipse-theia/theia/pull/11014) +- [plugin] added `CancellationToken` logic for `withProgress` API [#11027](https://github.com/eclipse-theia/theia/pull/11027) +- [plugin] added `canReply` support to `CommentThread` [#11062](https://github.com/eclipse-theia/theia/pull/11062) - Contributed on behalf of STMicroelectronics +- [plugin] added missing properties `id`, `name` and `backgroundColor` to `StatusBarItem` [#11026](https://github.com/eclipse-theia/theia/pull/11026) - Contributed on behalf of STMicroelectronics +- [plugin] added support for `AccessibilityInformation` [#10961](https://github.com/eclipse-theia/theia/pull/10961) - Contributed on behalf of STMicroelectronics +- [plugin] added support for `Accessibility` VS Code API [#10961](https://github.com/eclipse-theia/theia/pull/10961) +- [plugin] added support for `ShellQuotedStrings` in Tasks API [#10997](https://github.com/eclipse-theia/theia/pull/10997) +- [plugin] added support for `SnippetString.appendChoice` [#10969](https://github.com/eclipse-theia/theia/pull/10969) - Contributed on behalf of STMicroelectronics +- [plugin] added support for `keepScrollPosition` in `QuickPick` [#11002](https://github.com/eclipse-theia/theia/pull/11002) +- [plugin] added support for the generic type in `CodeActionProvider` [#10988](https://github.com/eclipse-theia/theia/pull/10988) +- [plugin] aligned signatures of `showQuickPick` with the VS Code API [#10974](https://github.com/eclipse-theia/theia/pull/10974) +- [plugin] fixed an issue with `onDidTerminateDebugSession` [#10954](https://github.com/eclipse-theia/theia/pull/10954) +- [plugin] fixed localization issue affecting preferences rendering [#11039](https://github.com/eclipse-theia/theia/pull/11039) +- [plugin] fixed multi-step quick-open menus [#11055](https://github.com/eclipse-theia/theia/pull/11055) +- [preferences] fixed issue with `files.eol` preference rendering [#11079](https://github.com/eclipse-theia/theia/pull/11079) +- [preferences] improved preference validation warnings [#11025](https://github.com/eclipse-theia/theia/pull/11025) +- [preferences] updated handling to make node renderers more robust against `null` values [#11074](https://github.com/eclipse-theia/theia/pull/11074) +- [workspace] fixed issue resulting in duplicate entries for recent workspaces [#11016](https://github.com/eclipse-theia/theia/pull/11016) + +[Breaking Changes:](#breaking_changes_1.25.0) + +- [callhierarchy] types `Definition`, `Caller` and `Callee` removed and replaced with `CallHierarchyItem`, `CallHierarchyIncomingCall`, `CallHierarchyOutgoingCall` [#10857](https://github.com/eclipse-theia/theia/pull/10857) +- [core] changed return type of `(Async)LocalizationProvider#getAvailableLanguages` from `string[]` to `LanguageInfo[]` [#11018](https://github.com/eclipse-theia/theia/pull/11018) +- [core] changed return type of `QuickInputService.showQuickPick` and its implementation in `MonacoQuickInputService` to `Promise`. `undefined` will be returned if the user closes the quick pick without making a selection [#11068](https://github.com/eclipse-theia/theia/pull/11068) +- [core] changed return type of `Saveable.createSnapshot` from `object` to `{ value: string } | { read(): string | null }` [#11032](https://github.com/eclipse-theia/theia/pull/11032) +- [debug] the following methods may now return `undefined | null` [#10999](https://github.com/eclipse-theia/theia/pull/10999): + - DebugSessionManager + - resolveConfiguration + - resolveDebugConfiguration + - resolveDebugConfigurationWithSubstitutedVariables + - DebugService + - resolveDebugConfiguration + - resolveDebugConfigurationWithSubstitutedVariables + - theia.d.ts ProviderResult + it's now aligned to vscode and can return `null` + - plugin-api-rpc.ts DebugConfigurationProvider + - resolveDebugConfiguration + - resolveDebugConfigurationWithSubstitutedVariables + - DebugExt + - $resolveDebugConfigurationByHandle + - $resolveDebugConfigurationWithSubstitutedVariablesByHandle + - DebugExtImpl + - $resolveDebugConfigurationByHandle + - $resolveDebugConfigurationWithSubstitutedVariablesByHandle + - PluginDebugConfigurationProvider + - resolveDebugConfiguration + - resolveDebugConfigurationWithSubstitutedVariables + - PluginDebugService + - resolveDebugConfiguration + - resolveDebugConfigurationWithSubstitutedVariables +- [markers, scm] deprecated `ProblemDecorator` and `SCMNavigatorDecorator` classes. They are no longer bound in the `inversify` container by default [#10846](https://github.com/eclipse-theia/theia/pull/10846) + +## v1.24.0 - 3/31/2022 + +[1.24.0 Milestone](https://github.com/eclipse-theia/theia/milestone/32) + +- [application-manager] fixed `expose-loader` [#10845](https://github.com/eclipse-theia/theia/pull/10845) +- [application-package] added support to configure the `defaultLocale` [#10956](https://github.com/eclipse-theia/theia/pull/10956) +- [core] added handling to ensure the active element is preserved when opening a context menu [#10852](https://github.com/eclipse-theia/theia/pull/10852) +- [core] added handling to ensure the default icon theme is applied properly [#10938](https://github.com/eclipse-theia/theia/pull/10938) +- [core] added support for pinned tabs [#10817](https://github.com/eclipse-theia/theia/pull/10817) +- [core] fixed cmd+`click` check on macOS [#10883](https://github.com/eclipse-theia/theia/pull/10883) +- [core] fixed `socket.io` endpoint path [#10858](https://github.com/eclipse-theia/theia/pull/10858) +- [core] fixed an issue with editor preferences not being applied [#10965](https://github.com/eclipse-theia/theia/pull/10965) +- [core] fixed compression if parent is also visible [#10872](https://github.com/eclipse-theia/theia/pull/10872) +- [core] fixed handling at app shutdown [#10861](https://github.com/eclipse-theia/theia/pull/10861) +- [core] fixed missing electron custom menu [#10847](https://github.com/eclipse-theia/theia/pull/10847) +- [core] fixed tail decoration rendering for the `TreeWidget` [#10898](https://github.com/eclipse-theia/theia/pull/10898) +- [core] improved tabbar styling [#10822](https://github.com/eclipse-theia/theia/pull/10822) +- [core] updated sash visibility handling [#10941](https://github.com/eclipse-theia/theia/pull/10941) +- [core] updated type check for `TreeContainerProps` [#10881](https://github.com/eclipse-theia/theia/pull/10881) +- [core] updated validation warning for `undefined` preference values [#10887](https://github.com/eclipse-theia/theia/pull/10887) +- [core] updated view container styling [#10854](https://github.com/eclipse-theia/theia/pull/10854) +- [debug] fixed issue where the current debug configuration was not updated [#10917](https://github.com/eclipse-theia/theia/pull/10917) +- [debug] updated `requestretry` from `v3.1.0` to `v7.0.0` [#10831](https://github.com/eclipse-theia/theia/pull/10831) +- [debug] updated debug icons and theming [#10948](https://github.com/eclipse-theia/theia/pull/10948) +- [filesystem] fixed copy/paste within the same folder [#10767](https://github.com/eclipse-theia/theia/pull/10767) +- [filesystem] fixed startup issue when restoring a large/binary file [#10900](https://github.com/eclipse-theia/theia/pull/10900) +- [keymaps] improved rendering of keybindings [#10801](https://github.com/eclipse-theia/theia/pull/10801) +- [markers] updated theming for problem markers [#10950](https://github.com/eclipse-theia/theia/pull/10950) +- [messages] added support for indeterminate progress notifications [#10945](https://github.com/eclipse-theia/theia/pull/10945) +- [monaco] fixed quick-input list styling [#10923](https://github.com/eclipse-theia/theia/pull/10923) +- [monaco] updated the translation on monaco using default keys [#10946](https://github.com/eclipse-theia/theia/pull/10946) +- [monaco] updated where the quick-input menu is attached [#10909](https://github.com/eclipse-theia/theia/pull/10909) +- [monaco] upgraded `monaco` dependency from `0.23` to ca. `0.33` (state as of VSCode 1.65.2) [#10736](https://github.com/eclipse-theia/theia/pull/10736) +- [navigator] fixed `initiallyCollapsed` option for the `'Open Editors'` [#10930](https://github.com/eclipse-theia/theia/pull/10930) +- [navigator] updated visibility of the `add folder` command [#10840](https://github.com/eclipse-theia/theia/pull/10840) +- [playwright] fixed playwright tests for Windows and macOS [#10826](https://github.com/eclipse-theia/theia/pull/10826) - Contributed on behalf of STMicroelectronics +- [playwright] updated tests to use `THEIA_CONFIG_DIR` [#10925](https://github.com/eclipse-theia/theia/pull/10925) +- [plugin] added `SourceFixAll` declaration [#10921](https://github.com/eclipse-theia/theia/pull/10921) +- [plugin] added `allow` attributes in webviews [#10848](https://github.com/eclipse-theia/theia/pull/10848) +- [plugin] added support for `CompletionItemLabel` VS Code API [#10929](https://github.com/eclipse-theia/theia/pull/10929) +- [plugin] added support for `DocumentSymbolProviderMetadata` [#10811](https://github.com/eclipse-theia/theia/pull/10811) - Contributed on behalf of STMicroelectronics +- [plugin] added support for `Uri.from` [#10903](https://github.com/eclipse-theia/theia/pull/10903) +- [plugin] added support for `replace` in `OutputChannel` [#10915](https://github.com/eclipse-theia/theia/pull/10915) +- [plugin] added support for `title` option for `InputBoxOptions` VS Code API [#10920](https://github.com/eclipse-theia/theia/pull/10920) +- [plugin] added support for frontend extensions in `asWebviewUri` [#10849](https://github.com/eclipse-theia/theia/pull/10849) +- [plugin] added support to render icons in tree-views on hover [#10899](https://github.com/eclipse-theia/theia/pull/10899) +- [plugin] aligned `Task.detail` with VS Code API expectations [#10905](https://github.com/eclipse-theia/theia/pull/10905) +- [plugin] aligned `breakpoint` namespace with VS Code API expectations [#10919](https://github.com/eclipse-theia/theia/pull/10919) +- [plugin] aligned `getSession` with VS Code API expectations [#10837](https://github.com/eclipse-theia/theia/pull/10837) +- [plugin] aligned `updateWorkspaceFolders` with VS Code API expectations [#10918](https://github.com/eclipse-theia/theia/pull/10918) +- [plugin] fixed error when uninstalling extensions [#10829](https://github.com/eclipse-theia/theia/pull/10829) +- [plugin] fixed plugin submenu registration [#10897](https://github.com/eclipse-theia/theia/pull/10897) +- [preferences] added support for customizable node rendering [#10766](https://github.com/eclipse-theia/theia/pull/10766) +- [preferences] fixed rendering issue of preference types [#10870](https://github.com/eclipse-theia/theia/pull/10870) +- [preferences] improved extensibility of `PreferenceContext` [#10911](https://github.com/eclipse-theia/theia/pull/10911) +- [preferences] improved preference transaction handling [#10884](https://github.com/eclipse-theia/theia/pull/10884) +- [preferences] refactored the open-handler [#10810](https://github.com/eclipse-theia/theia/pull/10810) +- [repo] performed `yarn upgrade` [#10939](https://github.com/eclipse-theia/theia/pull/10939) +- [repo] updated windows build instructions [#10862](https://github.com/eclipse-theia/theia/pull/10862) +- [search-in-workspace] added possibility to open results in editor previews [#10839](https://github.com/eclipse-theia/theia/pull/10839) +- [vsx-registry] added handling to prevent searching with no query present [#10833](https://github.com/eclipse-theia/theia/pull/10833) +- [vsx-registry] increased query delay when searching [#10813](https://github.com/eclipse-theia/theia/pull/10813) +- [vsx-registry] updated `requestretry` from `v3.1.0` to `v7.0.0` [#10831](https://github.com/eclipse-theia/theia/pull/10831) +- [workspace] fixed `'save as'` for `untitled` schemes [#10608](https://github.com/eclipse-theia/theia/pull/10608) +- [workspace] fixed the styling of the `path` in the dialog [#10814](https://github.com/eclipse-theia/theia/pull/10814) + +[Breaking Changes:](#breaking_changes_1.24.0) + +- [core] removed method `attachGlobalShortcuts` from `ElectronMainApplication`. Attaching shortcuts in that way interfered with internal shortcuts. Use internal keybindings instead of global shortcuts [#10869](https://github.com/eclipse-theia/theia/pull/10869) +- [debug] the getter `model` was renamed to `getModel` and accepts an optional `URI` parameter [#10875](https://github.com/eclipse-theia/theia/pull/10875) +- [debug] The interface method `DebugService#provideDynamicDebugConfigurations` changes the return type to `Record` [#10910](https://github.com/eclipse-theia/theia/pull/10910) + This impacts the corresponding return type for `DebugConfigurationManager#provideDynamicDebugConfigurations`. + The following functions under `plugin-api-rpc.ts#DebugExt` and in the `PluginDebugAdapterContribution` are deprecated + - $provideDebugConfigurations + - $resolveDebugConfigurations + - $resolveDebugConfigurationWithSubstitutedVariablesByHandle + The `PluginDebugAdapterContributionRegistrator` interface has been removed +- [filesystem] The `generateUniqueResourceURI` method from the `FileSystemUtils` class has an updated signature. Additionally, the method now returns a generated Uri that uses spaces as separators. The naming scheme was also changed to match VSCode. [10767](https://github.com/eclipse-theia/theia/pull/10767) +- [markers] `ProblemDecorator` reimplemented to reduce redundancy and align more closely with VSCode. `collectMarkers` now returns `Map`, `getOverlayIconColor` renamed to `getColor`, `getOverlayIcon` removed, `appendContainerMarkers` returns `void` [#10820](https://github.com/eclipse-theia/theia/pull/10820) +- [monaco] the following breaking changes were made in the Monaco uplift. [#10736](https://github.com/eclipse-theia/theia/pull/10736) + - `QuickPickItem` is now only for selectable items. Use `QuickPickItemOrSeparator` when either an item or a separator is intended. + - `editor.autoSave` preference renamed `files.autoSave` and accepts `off`, `afterDelay`, `onFocusChange`, `onWindowChange`. Use `!== 'off'` to check for any active state, as `on` is no longer a valid value. + - `editor.autoSaveDelay` renamed `files.autoSaveDelay`. + - `commandService`, `instantiationService` removed from `MonacoEditor`. Use `StandaloneServices.get(IInstantationService / ICommandService)` instead. + - `DecorationMiniMapOptions.position`, `DecorationOverviewRulerOptions.position` no longer optional. + - Overrides used by `MonacoEditorFactory` accept the type `EditorServiceOverrides` rather than `{[key: string]: any}`. +- [workspace] removed unused injections in `WorkspaceService`: `ApplicationShell`, `StorageService`, `LabelProvider`, `SelectionService`, `CommandRegistry`, `WorkspaceCommandContribution`. [#10868](https://github.com/eclipse-theia/theia/pull/10868) + +## v1.23.0 - 2/24/2022 + +[1.23.0 Milestone](https://github.com/eclipse-theia/theia/milestone/31) + +- [application-manager] added `path-browserify` to polyfill path in the browser [#10745](https://github.com/eclipse-theia/theia/pull/10745) +- [application-manager] replaced `changes-stream` with `nano` [#10764](https://github.com/eclipse-theia/theia/pull/10764) +- [application-manager] upgraded `electron-rebuild` to `v3.2.7` [#10726](https://github.com/eclipse-theia/theia/pull/10726) +- [cli] added localization cli command [#10187](https://github.com/eclipse-theia/theia/pull/10187) +- [core] added better `setPreference` handling for language overrides [#10665](https://github.com/eclipse-theia/theia/pull/10665) +- [core] added handling to hide the resize sash if a container or panel is collapsed [#10561](https://github.com/eclipse-theia/theia/pull/10561) +- [core] added handling to prevent multiple save dialogs for the same resource [#10614](https://github.com/eclipse-theia/theia/pull/10614) +- [core] added support for compressed tree nodes [#10713](https://github.com/eclipse-theia/theia/pull/10713) +- [core] fixed issue to return focus to last recently active tab [#10685](https://github.com/eclipse-theia/theia/pull/10685) +- [core] updated default loading animation [#10761](https://github.com/eclipse-theia/theia/pull/10761) +- [core] updated preferences and notifications styling [#10719](https://github.com/eclipse-theia/theia/pull/10719) +- [debug] added functionality to properly handle completion and evaluations in the debug console [#10469](https://github.com/eclipse-theia/theia/pull/10469) +- [debug] fixed `debuggingForeground` theming [#10760](https://github.com/eclipse-theia/theia/pull/10760) +- [documentation] added plugin API documentation [#10695](https://github.com/eclipse-theia/theia/pull/10695) +- [electron] added support for modal dialogs [#10769](https://github.com/eclipse-theia/theia/pull/10769) +- [electron] fixed issue ctrl+r keybinding in terminals [#10704](https://github.com/eclipse-theia/theia/pull/10704) +- [file-search] improved sorting for file search results [#10694](https://github.com/eclipse-theia/theia/pull/10694) +- [git] upgraded `dugite-extra` to `v0.1.15` which supports newer Node versions [#10722](https://github.com/eclipse-theia/theia/pull/10722) +- [localization] added machine translations for 12 languages [#10782](https://github.com/eclipse-theia/theia/pull/10782) +- [monaco] updated internal themes [#10525](https://github.com/eclipse-theia/theia/pull/10525) +- [playwright] added playwright framework [#10494](https://github.com/eclipse-theia/theia/pull/10494) +- [plugin] added missing property `untitledDocumentData` for `CustomDocumentOpenContext` [#10784](https://github.com/eclipse-theia/theia/pull/10784) +- [plugin] added more detail to logging of backend and frontend start-up, especially in plugin management [#10407](https://github.com/eclipse-theia/theia/pull/10407) - Contributed on behalf of STMicroelectronics +- [plugin] added support for VS Code web extensions [#10721](https://github.com/eclipse-theia/theia/pull/10721) +- [plugin] added support for `Authentication` API at `vscode@1.63.1` [#10709](https://github.com/eclipse-theia/theia/pull/10709) +- [plugin] added support for `disabled`, `isPreferred` and `documentation` fields for code actions [#10777](https://github.com/eclipse-theia/theia/pull/10777) +- [plugin] added support for `vscode.CodeActionProvider.resolveCodeAction` [#10730](https://github.com/eclipse-theia/theia/pull/10730) - Contributed on behalf of STMicroelectronics +- [plugin] added support for `vscode.window.createStatusBarItem` [#10754](https://github.com/eclipse-theia/theia/pull/10754) - Contributed on behalf of STMicroelectronics +- [plugin] added support to correctly expose uri for frontend modules [#10747](https://github.com/eclipse-theia/theia/pull/10747) +- [plugin] aligned `vscode.window.createTerminal` API with VS Code [#10683](https://github.com/eclipse-theia/theia/pull/10683) +- [plugin] fixed the start of pseudoterminals [#10780](https://github.com/eclipse-theia/theia/pull/10780) +- [plugin] implemented `WebviewView` API [#10705](https://github.com/eclipse-theia/theia/pull/10705) +- [plugin] implemented preliminary `Workspace Trust` API [#10473](https://github.com/eclipse-theia/theia/pull/10473) +- [preferences] added validation logic for preferences used by the editor [#10607](https://github.com/eclipse-theia/theia/pull/10607) +- [repo] added browser compound launch configuration [#10720](https://github.com/eclipse-theia/theia/pull/10720) +- [repo] removed unused dependencies [#10717](https://github.com/eclipse-theia/theia/pull/10717) +- [repo] upgraded `typescript` to `v4.5.5` [#10355](https://github.com/eclipse-theia/theia/pull/10355) +- [toolbar] added a new `@theia/toolbar` extension to contribute a global toolbar to the framework [#10731](https://github.com/eclipse-theia/theia/pull/10731) +- [workspace] added handling to ensure correct `recentworkspace.json` format and entries [#10711](https://github.com/eclipse-theia/theia/pull/10711) + +[Breaking Changes:](#breaking_changes_1.23.0) + +- [core] moved methods `attachReadyToShow`, `restoreMaximizedState`, `attachCloseListeners`, `handleStopRequest`, `checkSafeToStop`, `handleReload`, `reload` from `ElectronMainApplication` into new class `TheiaElectronWindow` [#10600](https://github.com/eclipse-theia/theia/pull/10600) +- [core] removed all of our own custom HTTP Polling implementation [#10514](https://github.com/eclipse-theia/theia/pull/10514) +- [core] removed method `attachGlobalShortcuts` from `ElectronMainApplication`. Attaching shortcuts in that way interfered with internal shortcuts. Use internal keybindings instead of global shortcuts. [#10704](https://github.com/eclipse-theia/theia/pull/10704) +- [core] removed the `Event.maxListeners` field; The feature still exists but please use `Event.getMaxListeners(event)` and `Event.setMaxListeners(event, maxListeners)` instead. +- [core] replaced raw WebSocket transport with Socket.io protocol, changed internal APIs accordingly [#10514](https://github.com/eclipse-theia/theia/pull/10514) +- [electron] the `open` and `save` dialogs are now modal by default [#10769](https://github.com/eclipse-theia/theia/pull/10769) +- [plugin] deprecated `PseudoTerminalOptions`. `ExternalTerminalOptions` should be used from now on instead [#10683](https://github.com/eclipse-theia/theia/pull/10683) - Contributed on behalf of STMicroelectronics +- [plugin] function `logMeasurement` of `PluginDeployerImpl` class and browser class `HostedPluginSupport` is replaced by `measure` using the new `Stopwatch` API [#10407](https://github.com/eclipse-theia/theia/pull/10407) +- [plugin] the constructor of `BackendApplication` class no longer invokes the `initialize` method. Instead, the `@postConstruct configure` method now starts by calling `initialize` [#10407](https://github.com/eclipse-theia/theia/pull/10407) +- In order to cleanup the code base, the constructor signature of the following classes got changed in an API-breaking way [#10737](https://github.com/eclipse-theia/theia/pull/10737): + - `ProblemWidget` + - `FileNavigatorWidget` + - `TerminalServer` + - `TimelineTreeWidget` + - `TypeHierarchyTreeWidget` + +## v1.22.0 - 1/27/2022 + +[1.22.0 Milestone](https://github.com/eclipse-theia/theia/milestone/30) + +- [cli] replaced `colors` with `chalk` [#10612](https://github.com/eclipse-theia/theia/pull/10612) +- [cli] updated `node-fetch` from `2.6.6` to `2.6.7` [#10670](https://github.com/eclipse-theia/theia/pull/10670) +- [console] fixed an issue which caused the debug console to clear at the end of a debug session [#10671](https://github.com/eclipse-theia/theia/pull/10671) +- [core] added `appearance` sub-menu to view main-menu [#10220](https://github.com/eclipse-theia/theia/pull/10220) +- [core] added functionality to properly handle localhost uris on electron [#10590](https://github.com/eclipse-theia/theia/pull/10590) +- [core] added schema support for `keymaps.json` [#10613](https://github.com/eclipse-theia/theia/pull/10613) +- [core] added support for multiple selections when triggering `open folder` [#10357](https://github.com/eclipse-theia/theia/pull/10357) +- [core] fixed an issue when `window.menuBarVisibility` is set to `compact` [#10626](https://github.com/eclipse-theia/theia/pull/10626) +- [core] fixed memory leak in `ApplicationShell#activateWidget` [#10570](https://github.com/eclipse-theia/theia/pull/10570) +- [core] updated `markdown-it` dependency from `8.4.0` to `12.3.2` [#10634](https://github.com/eclipse-theia/theia/pull/10634) +- [editor] added `editor layout` sub-menu to view main-menu [#10220](https://github.com/eclipse-theia/theia/pull/10220) +- [electron] fixed path comparison for exit confirmation [#10597](https://github.com/eclipse-theia/theia/pull/10597) +- [electron] improved electron keybinding labels [#10673](https://github.com/eclipse-theia/theia/pull/10673) +- [electron] upgraded electron to `15.3.5` [#9936](https://github.com/eclipse-theia/theia/pull/9936) +- [localization] added missing translations to filesystem and plugin menu items [#10564](https://github.com/eclipse-theia/theia/pull/10564) +- [localization] added missing translations to navigator menu items [#10565](https://github.com/eclipse-theia/theia/pull/10656) +- [messages] fixed rendering of notification progress as html [#10588](https://github.com/eclipse-theia/theia/pull/10588) +- [monaco] fixed codicon styling in quick-inputs [#10544](https://github.com/eclipse-theia/theia/pull/10544) +- [plugin] added fix to skip extension resolution if already installed [#10624](https://github.com/eclipse-theia/theia/pull/10624) +- [plugin] added support for `PluginContext.extension` [#10650](https://github.com/eclipse-theia/theia/pull/10650) +- [plugin] added support for `PluginContext.logUri` [#10650](https://github.com/eclipse-theia/theia/pull/10650) +- [plugin] added support for the `vscode.debug.stopDebugging` API [#10638](https://github.com/eclipse-theia/theia/pull/10638) +- [plugin] aligned `vscode.debug.startDebugging` API to the latest version [#10656](https://github.com/eclipse-theia/theia/pull/10656) +- [plugin] fixed `joinPath` on Windows [#10434](https://github.com/eclipse-theia/theia/pull/10434) +- [plugin] fixed `showOpenDialog` fallback to use workspace root [#10573](https://github.com/eclipse-theia/theia/pull/10573) +- [plugin] resolved an issue with widget options when opening custom editors [#10580](https://github.com/eclipse-theia/theia/pull/10580) +- [preferences] added functionality to prevent unopened files from producing problem markers [#10562](https://github.com/eclipse-theia/theia/pull/10562) + - `AbstractResourcePreferenceProvider` providers no longer maintain a reference to a `MonacoTextModel`. + - This removes preference files from the Problems view unless the file is opened by the user. +- [search-in-workspace] removed unnecessary `padding-left` statement [#10623](https://github.com/eclipse-theia/theia/pull/10623) +- [task] fixed an issue that caused errors on startup if no workspace was opened [#10576](https://github.com/eclipse-theia/theia/pull/10576) +- [terminal] added support for terminal `onKey` event [#10617](https://github.com/eclipse-theia/theia/pull/10617) +- [workspace] added support for files outside the workspace when executing the command `copy relative path` [#10674](https://github.com/eclipse-theia/theia/pull/10674) +- [workspace] added support for the `workbenchState` context key [#10550](https://github.com/eclipse-theia/theia/pull/10550) +- [workspace] added the possibility of performing a permanent deletion if trash deletion fails [#10161](https://github.com/eclipse-theia/theia/pull/10151) + +[Breaking Changes:](#breaking_changes_1.22.0) + +- [core] `ContextKeyService` is now an interface. Extenders should extend `ContextKeyServiceDummyImpl` [#10546](https://github.com/eclipse-theia/theia/pull/10546) +- [core] removed `MarkdownRenderer` class [#10589](https://github.com/eclipse-theia/theia/pull/10589) +- [core] removed deprecated API: `unfocusSearchFieldContainer`, `doUnfocusSearchFieldContainer()` [#10625](https://github.com/eclipse-theia/theia/pull/10625) +- [electron] upgraded electron [#9936](https://github.com/eclipse-theia/theia/pull/9936) - for additional details please see the [migration guide](https://github.com/eclipse-theia/theia/blob/master/doc/Migration.md#electron-update) +- [navigator] added `Open Containing Folder` command [#10523](https://github.com/eclipse-theia/theia/pull/10523) +- [plugin-ext] `PluginDeployerImpl` now uses the `UnresolvedPluginEntry: { id: string, type: PluginType }` interface as parameter types for resolving plugins. Affected methods: `deploy`, `deployMultipleEntries` and `resolvePlugins` [#10624](https://github.com/eclipse-theia/theia/pull/10624) +- [plugin-ext] `ViewContextKeyService#with` method removed. Use `ContextKeyService#with` instead. `PluginViewWidget` and `PluginTreeWidget` inject the `ContextKeyService` rather than `ViewContextKeyService`. [#10546](https://github.com/eclipse-theia/theia/pull/10546) +- [plugin] removed deprecated fields `id` and `label` from `theia.Command` [#10512](https://github.com/eclipse-theia/theia/pull/10512) +- [preferences] `AbstractResourcePreferenceProvider#model, textModelService, workspace, messageService, acquireLocks, releaseLocks, readPreferences, singleChangeLock, transactionLock` removed. `AbstractResourcePreferenceProvider#handleDirtyEditor` moved to `PreferenceTransaction`. `AbstractResourcePreferenceProvider#getEditOperations` moved to `MonacoJSONCEditor`. [#10562](https://github.com/eclipse-theia/theia/pull/10562) diff --git a/doc/changelogs/CHANGELOG-2023.md b/doc/changelogs/CHANGELOG-2023.md new file mode 100644 index 0000000..0aa6e25 --- /dev/null +++ b/doc/changelogs/CHANGELOG-2023.md @@ -0,0 +1,492 @@ +# Changelog 2023 + +## v1.45.0 - 12/21/2023 + +- [application-manager] updated logic to allow rebinding messaging services in preload [#13199](https://github.com/eclipse-theia/theia/pull/13199) +- [application-package] bumped the default supported API from `1.83.1` to `1.84.2` [#13198](https://github.com/eclipse-theia/theia/pull/13198) +- [core] added cli parameter `--electronUserData` to control `userDataPath` [#13155](https://github.com/eclipse-theia/theia/pull/13155) +- [core] added logic to control the size and position of secondary windows [#13201](https://github.com/eclipse-theia/theia/pull/13201) +- [core] added logic to save untitled files to the last active folder [#13184](https://github.com/eclipse-theia/theia/pull/13184) +- [core] fixed regression preventing closing the application when a dirty editor is present [#13173](https://github.com/eclipse-theia/theia/pull/13173) +- [core] fixed styling for compressed navigator indents [#13162](https://github.com/eclipse-theia/theia/pull/13162) +- [core] introduced timeout logic for keeping connection contexts alive [#13082](https://github.com/eclipse-theia/theia/pull/13082) +- [core] updated `nls.metadata.json` for `1.84.2` [#13200](https://github.com/eclipse-theia/theia/pull/13200) +- [debug] fixed issue where debug configuration providers would replace other providers [#13196](https://github.com/eclipse-theia/theia/pull/13196) +- [documentation] improved documentation regarding the addition of the plugin API in the plugin host [#13153](https://github.com/eclipse-theia/theia/pull/13153) +- [notebook] fixed notebook kernel selection [#13171](https://github.com/eclipse-theia/theia/pull/13171) +- [notebook] implemented general API improvements [#13012](https://github.com/eclipse-theia/theia/pull/13012) +- [notebook] optimized output logic [#13137](https://github.com/eclipse-theia/theia/pull/13137) +- [plugin] added documentation about adding custom activation events [#13190](https://github.com/eclipse-theia/theia/pull/13190) +- [plugin] added logic to deploy plugins asynchronously [#13134](https://github.com/eclipse-theia/theia/pull/13134) +- [plugin] added logic to not reject unknown schemas in `WindowStateExt.asExternalUri` [#13057](https://github.com/eclipse-theia/theia/pull/13057) +- [plugin] added support for the `TestMessage.contextValue` VS Code API [#13176](https://github.com/eclipse-theia/theia/pull/13176) - contributed on behalf of STMicroelectronics +- [plugin] added support for the `webview/context` menu contribution point [#13166](https://github.com/eclipse-theia/theia/pull/13166) +- [plugin] fixed incorrect `unsupported activation error` in stdout [#13095](https://github.com/eclipse-theia/theia/pull/13095) +- [plugin] fixed issue where the `onView` activation event was incorrectly generated [#13091](https://github.com/eclipse-theia/theia/pull/13091) +- [plugin] fixed plugin icon styling [#13101](https://github.com/eclipse-theia/theia/pull/13101) +- [terminal] updated logic to use `ApplicationShell` when expanding/collapsing the bottom panel [#13131](https://github.com/eclipse-theia/theia/pull/13131) +- [workspace] added logic to create an empty workspace if no workspace is active on `updateWorkspaceFolders` event [#13181](https://github.com/eclipse-theia/theia/pull/13181) - contributed on behalf of STMicroelectronics + +[Breaking Changes:](#breaking_changes_1.45.0) + +- [plugin] updated VS Code extension locations: deployment dir switched to `$CONFDIR/deployedPlugin`, `.vsix` files from `$CONFDIR/extensions` are deployed automatically [#13178](https://github.com/eclipse-theia/theia/pull/13178) - Contributed on behalf of STMicroelectronics + +## v1.44.0 - 11/30/2023 + +- [application-manager] added option to copy `trash` dependency to the bundle [#13112](https://github.com/eclipse-theia/theia/pull/13112) +- [application-package] bumped the default supported API from `1.82.0` to `1.83.1` [#13118](https://github.com/eclipse-theia/theia/pull/13118) +- [ci] added smokes tests for production builds [#12965](https://github.com/eclipse-theia/theia/pull/12965) +- [ci] updated CI to pin Python at `3.11` to resolve `node-gyp` errors [#13040](https://github.com/eclipse-theia/theia/pull/13040) +- [core] added handling to prevent class name based contribution filtering [#13103](https://github.com/eclipse-theia/theia/pull/13103) +- [core] added support for portable mode for electron apps [#12690](https://github.com/eclipse-theia/theia/pull/12690) +- [core] fixed logic when handling listener events [#13079](https://github.com/eclipse-theia/theia/pull/13079) +- [core] improved default translations using preferred keys [#13078](https://github.com/eclipse-theia/theia/pull/13078) +- [core] updated `nls.metadata.json` for `1.83.1` [#13119](https://github.com/eclipse-theia/theia/pull/13119) +- [core] updated proxy path handling for `socket.io` [#13054](https://github.com/eclipse-theia/theia/pull/13054) +- [debug] fixed issue where the UI was not updated upon editing breakpoint conditions [#12980](https://github.com/eclipse-theia/theia/pull/12980) +- [debug] fixed localizations of debug schema attributes [#13017](https://github.com/eclipse-theia/theia/pull/13017) +- [debug] updated description field for thread stopped status [#13050](https://github.com/eclipse-theia/theia/pull/13050) +- [documentation] added coding guidelines regarding `@stubbed` and `@monaco-uplift` tags [#13029](https://github.com/eclipse-theia/theia/pull/13029) +- [documentation] updated broken link to `private-ext-scripts/README.md` [#13122](https://github.com/eclipse-theia/theia/pull/13122) +- [filesystem] updated electron dialogs so they are modal by default [#13043](https://github.com/eclipse-theia/theia/pull/13043) +- [notebook] fixed race condition for view registrations [#13115](https://github.com/eclipse-theia/theia/pull/13115) +- [playwright] added basic support for electron [#12207](https://github.com/eclipse-theia/theia/pull/12207) +- [plugin] added a command to list installed plugins [#12818](https://github.com/eclipse-theia/theia/pull/12818) +- [plugin] added handling to forward webview log messages to the browser console [#13084](https://github.com/eclipse-theia/theia/pull/13084) +- [plugin] added support for VS Code default language icons [#13014](https://github.com/eclipse-theia/theia/pull/13014) +- [plugin] added support for `autoClosingPairs` in the `LanguageConfiguration` VS Code API [#13088](https://github.com/eclipse-theia/theia/pull/13088) - contributed on behalf of STMicroelectronics +- [plugin] added support for the `CodeActionKind#Notebook` VS Code API [#13093](https://github.com/eclipse-theia/theia/pull/13093) - contributed on behalf of STMicroelectronics +- [plugin] added support for the `TextEditorOptions.indentSize` VS Code API [#13105](https://github.com/eclipse-theia/theia/pull/13105) - contributed on behalf of STMicroelectronics +- [plugin] added support for the `env.onDidChangeShell` VS Code API [#13097](https://github.com/eclipse-theia/theia/pull/13097) - contributed on behalf of STMicroelectronics +- [private-ext-scripts] updated information regarding scripts [#13127](https://github.com/eclipse-theia/theia/pull/13127) +- [repo] removed usages of `baseUrl` in `tsconfig` [#12981](https://github.com/eclipse-theia/theia/pull/12981) +- [search-in-workspace] added support for search history hint in input fields [#12967](https://github.com/eclipse-theia/theia/pull/12967) +- [search-in-workspace] fixed search-in-workspace line styling [#13071](https://github.com/eclipse-theia/theia/pull/13071) +- [task] added handling to prevent the task widget title from being changed by task process [#13003](https://github.com/eclipse-theia/theia/pull/13003) +- [task] added support for `isDefault: false` in task group definitions [#13075](https://github.com/eclipse-theia/theia/pull/13075) - contributed on behalf of STMicroelectronics +- [toolbar] fixed rendering error for undefined toolbar groups [#13124](https://github.com/eclipse-theia/theia/pull/13124) + +## v1.43.0 - 10/26/2023 + +- [application-manager] fixed backend webpack output and watching [#12902](https://github.com/eclipse-theia/theia/pull/12902) +- [application-manager] updated `clean` command to delete `gen-webpack.node.config.js` [#12975](https://github.com/eclipse-theia/theia/pull/12975) +- [application-package] bumped the default supported API version from `1.81.0` to `1.82.0` [#13025](https://github.com/eclipse-theia/theia/pull/13025) +- [cli] upgraded`chai` dependency from `^4.2.0` to `^4.3.10` [#12958](https://github.com/eclipse-theia/theia/pull/12958) +- [core] added `manage` related menus to the bottom sidebar [#12803](https://github.com/eclipse-theia/theia/pull/12803) +- [core] added lazy loading support for localizations [#12932](https://github.com/eclipse-theia/theia/pull/12932) +- [core] added localizations for clipboard commands [#13031](https://github.com/eclipse-theia/theia/pull/13031) +- [core] fixed file saving dialog for dirty editors [#12864](https://github.com/eclipse-theia/theia/pull/12864) +- [core] fixed preload application package import [#12964](https://github.com/eclipse-theia/theia/pull/12964) +- [core] improved responsiveness when selecting a localization language [#12992](https://github.com/eclipse-theia/theia/pull/12992) +- [core] removed unnecessary `try-catch` from `RpcProtocol` [#12961](https://github.com/eclipse-theia/theia/pull/12961) +- [core] updated `nls.metadata.json` for `1.82.0` [#13028](https://github.com/eclipse-theia/theia/pull/13028) +- [core] updated handling to ensure `ApplicationShellOptions` are properly applied on init [#12983](https://github.com/eclipse-theia/theia/pull/12983) +- [debug] added missing localizations for debug paused labels [#12973](https://github.com/eclipse-theia/theia/pull/12973) +- [debug] fixed an issue which caused jumping of the hover widget [#12971](https://github.com/eclipse-theia/theia/pull/12971) +- [file-search] implemented `search.quickOpen.includeHistory` preference [#12913](https://github.com/eclipse-theia/theia/pull/12913) +- [keymaps] added context-menu items for the keyboard shortcuts view [#12791](https://github.com/eclipse-theia/theia/pull/12791) +- [monaco] upgraded `vscode-textmate` dependency from `7.0.3` to `9.0.0` [#12963](https://github.com/eclipse-theia/theia/pull/12963) +- [notebook] updated handling to correctly updated when output items are updated [#13023](https://github.com/eclipse-theia/theia/pull/13023) +- [plugin] added support for string arguments for `vscode.open` [#12997](https://github.com/eclipse-theia/theia/pull/12997) +- [plugin] added support for the `EnvironmentVariableMutatorOptions` VS Code API [#12984](https://github.com/eclipse-theia/theia/pull/12984) +- [plugin] added support for the icons contribution point [#12912](https://github.com/eclipse-theia/theia/pull/12912) +- [plugin] fixed output renderer scripts path [#12979](https://github.com/eclipse-theia/theia/pull/12979) +- [plugin] fixed symlink handling when initializing plugins [#12841](https://github.com/eclipse-theia/theia/pull/12841) +- [plugin] improved resolution of webview views [#12998](https://github.com/eclipse-theia/theia/pull/12998) +- [plugin] updated handling to allow null items in tree data providers [#13018](https://github.com/eclipse-theia/theia/pull/13018) +- [remote] added remote ssh support [#12618](https://github.com/eclipse-theia/theia/pull/12618) +- [test] added support for the `test` API [#12935](https://github.com/eclipse-theia/theia/pull/12935) +- [vscode] added support for `provideDocumentRangesFormattingEdits` in the `DocumentRangeFormattingEditProvider` VS Code API [#13020](https://github.com/eclipse-theia/theia/pull/13020) - contributed on behalf of STMicroelectronics +- [vscode] evolved proposed API for `documentPaste` (stubbed) [#13010](https://github.com/eclipse-theia/theia/pull/13010) - contributed on behalf of STMicroelectronics +- [vscode] evolved proposed API for `dropDocument` [#13009](https://github.com/eclipse-theia/theia/pull/13009) - contributed on behalf of STMicroelectronics +- [vscode] evolved proposed API for `terminalQuickFixProvider` [#13006](https://github.com/eclipse-theia/theia/pull/13006) - contributed on behalf of STMicroelectronics +- [vscode] implemented scope API on env var collections [#12999](https://github.com/eclipse-theia/theia/pull/12999) - contributed on behalf of STMicroelectronics + +[Breaking Changes:](#breaking_changes_1.43.0) + +- [core] moved `FrontendApplicationContribution` from `@theia/core/lib/browser/frontend-application` to `@theia/core/lib/browser/frontend-application-contribution` [#12993](https://github.com/eclipse-theia/theia/pull/12993) +- [core] removed `SETTINGS_OPEN` menupath constant - replaced by `MANAGE_GENERAL` [#12803](https://github.com/eclipse-theia/theia/pull/12803) +- [core] removed `SETTINGS__THEME` menupath constant - replaced by `MANAGE_SETTINGS` [#12803](https://github.com/eclipse-theia/theia/pull/12803) + +## v1.42.0 - 09/28/2023 + +- [core] added `inversify` support in the frontend preload script [#12590](https://github.com/eclipse-theia/theia/pull/12590) +- [core] added missing localizations for keybinding error messages [#12889](https://github.com/eclipse-theia/theia/pull/12889) +- [core] fixed logger level propagation when log config changes at runtime [#12566](https://github.com/eclipse-theia/theia/pull/12566) - Contributed on behalf of STMicroelectronics +- [core] improved the frontend startup time [#12936](https://github.com/eclipse-theia/theia/pull/12936) - Contributed on behalf of STMicroelectronics +- [core] updated `nls.metadata.json` for `1.81.0` [#12951](https://github.com/eclipse-theia/theia/pull/12951) +- [core] upgraded `ws` from `7.1.2` to `8.14.1` [#12909](https://github.com/eclipse-theia/theia/pull/12909) +- [debug] fixed erroneous inline breakpoints [#12832](https://github.com/eclipse-theia/theia/pull/12832) +- [dev-packages] bumped the default supported API version from `1.80.0` to `1.81.0` [#12949](https://github.com/eclipse-theia/theia/pull/12949) +- [dev-packages] restored src-gen frontend production behavior [12950](https://github.com/eclipse-theia/theia/pull/12950) - Contributed on behalf of STMicroelectronics +- [dialogs] added functionality to allow multiple selection in open dialogs [#12923](https://github.com/eclipse-theia/theia/pull/12923) - Contributed on behalf of STMicroelectronics +- [documentation] added follow-up section to the pull-request template [#12901](https://github.com/eclipse-theia/theia/pull/12901) +- [editor] added functionality to create untitled files when double-clicking the tabbar [#12867](https://github.com/eclipse-theia/theia/pull/12867) +- [electron] improved responsiveness of the initial electron window [#12897](https://github.com/eclipse-theia/theia/pull/12897) - Contributed on behalf of STMicroelectronics. +- [plugin] added stubbing for the `TestController#invalidateTestResults` VS Code API [#12944](https://github.com/eclipse-theia/theia/pull/12944) - Contributed by STMicroelectronics +- [plugin] added support for `iconPath` in the `QuickPickItem` VS Code API [#12945](https://github.com/eclipse-theia/theia/pull/12945) - Contributed by STMicroelectronics +- [repo] updated deprecated instances of `context` in favor of `when` clauses [#12830](https://github.com/eclipse-theia/theia/pull/12830) +- [search-in-workspace] added support for multiline searches [#12868](https://github.com/eclipse-theia/theia/pull/12868) +- [vsx-registry] added a hint in `ENOTFOUND` errors when failing to fetch extensions [#12858](https://github.com/eclipse-theia/theia/pull/12858) - Contributed by STMicroelectronics + +## v1.41.0 - 08/31/2023 + +- [application-package] added handling to quit the electron app when the backend fails to start [#12778](https://github.com/eclipse-theia/theia/pull/12778) - Contributed on behalf of STMicroelectronics +- [core] added `--dnsDefaultResultOrder ` CLI argument where `value` is one of `ipv4first`, `verbatim` or `nodeDefault`. It controls how domain names are resolved [#12711](https://github.com/eclipse-theia/theia/pull/12711) +- [core] added functionality to capture stopwatch results [#12812](https://github.com/eclipse-theia/theia/pull/12812) +- [core] added support for `file/newFile` menu path [#12819](https://github.com/eclipse-theia/theia/pull/12819) +- [core] added support for icon-less tabbar items [#12804](https://github.com/eclipse-theia/theia/pull/12804) +- [core] added support for independent items in the `editor/title/run` menu [#12799](https://github.com/eclipse-theia/theia/pull/12799) +- [core] fixed submenu contributions to `editor/title` and `view/title` [#12706](https://github.com/eclipse-theia/theia/pull/12706) +- [core] improved middle-click behavior for tree nodes [#12783](https://github.com/eclipse-theia/theia/pull/12783) +- [core] improved rendering of the close icon when hovering tabs [#12806](https://github.com/eclipse-theia/theia/pull/12806) +- [core] updated `nls.metadata.json` for `1.80.0` [#12875](https://github.com/eclipse-theia/theia/pull/12875) +- [debug] fixed issue where edit watch expressions were not updated without a session [#12627](https://github.com/eclipse-theia/theia/pull/12627) +- [dev-packages] bumped the default supported API version from `1.79.0` to `1.89.0` [#12866](https://github.com/eclipse-theia/theia/pull/12866) +- [editor] fixed context-menu behavior for the editor gutter [#12794](https://github.com/eclipse-theia/theia/pull/12794) +- [filesystem] added missing localization for the copied download link to clipboard notification [#12873](https://github.com/eclipse-theia/theia/pull/12873) +- [getting-started] added checkbox to the welcome page to toggle visibility on startup [#12750](https://github.com/eclipse-theia/theia/pull/12750) +- [getting-started] added support for the `workbench.startupEditor` preference [#12813](https://github.com/eclipse-theia/theia/pull/12813) +- [getting-started] fixed `open folder` link on the welcome page [#12857](https://github.com/eclipse-theia/theia/pull/12857) +- [getting-started] improved rendering of the welcome page for smaller viewports [#12825](https://github.com/eclipse-theia/theia/pull/12825) +- [git] fixed unhandled promise rejection during git operations [#12433](https://github.com/eclipse-theia/theia/pull/12433) +- [markers] improved problems widget rendering, and problem matching [#12802](https://github.com/eclipse-theia/theia/pull/12802) +- [monaco] improved extensibility of `MonacoEditorCommandHandlers` [#12785](https://github.com/eclipse-theia/theia/pull/12785) +- [native-webpack-plugin] added `trash` dependency helpers bundling to the backend [#12797](https://github.com/eclipse-theia/theia/pull/12797) +- [navigator] added missing localizations when no roots are present in a multi-root workspace [#12795](https://github.com/eclipse-theia/theia/pull/12795) +- [notebook] added initial support for `notebook` editors [#12442](https://github.com/eclipse-theia/theia/pull/12442) +- [playwright] upgraded to the latest version and added new page objects [#12843](https://github.com/eclipse-theia/theia/pull/12843) +- [plugin] added support for the `EnvironmentVariableCollection#description` VS Code API [#12838](https://github.com/eclipse-theia/theia/pull/12838) +- [plugin] fixed `configurationDefault` support from VS Code plugins [#12758](https://github.com/eclipse-theia/theia/pull/12758) +- [plugin] fixed `view/title` menu behavior for builtin views [#12763](https://github.com/eclipse-theia/theia/pull/12763) +- [plugin] fixed an issue where the `WebviewPanelSerializer` would not serialize successfully [#12584](https://github.com/eclipse-theia/theia/pull/12584) +- [plugin] fixed plugin menu icon background when hovering [#12827](https://github.com/eclipse-theia/theia/pull/12827) +- [plugin] fixed the default `folderExpanded` icon for themes [#12776](https://github.com/eclipse-theia/theia/pull/12776) +- [plugin] fixed web plugin express endpoint [#12787](https://github.com/eclipse-theia/theia/pull/12787) +- [preferences] improved memory consumption by re-using the markdown renderer instance [#12790](https://github.com/eclipse-theia/theia/pull/12790) +- [process] fixed `.exe` compatibility for shell commands similarly to VS Code [#12761](https://github.com/eclipse-theia/theia/pull/12761) +- [repo] bumped builtin plugins to `1.79.0` [#12807](https://github.com/eclipse-theia/theia/pull/12807) +- [scm-extra] fixed an issue with scm history after performing a commit [#12837](https://github.com/eclipse-theia/theia/pull/12837) +- [task] added handling to ensure contributed problem matchers are successfully discovered [#12805](https://github.com/eclipse-theia/theia/pull/12805) +- [task] fixed error thrown for custom task execution [#12770](https://github.com/eclipse-theia/theia/pull/12770) +- [vscode] added support for tree checkbox api [#12836](https://github.com/eclipse-theia/theia/pull/12836) - Contributed on behalf of STMicroelectronics +- [workspace] fixed saving of untitled text editors when closing a workspace or closing the application [#12577](https://github.com/eclipse-theia/theia/pull/12577) + +[Breaking Changes:](#breaking_changes_1.41.0) + +- [deps] bumped supported Node.js version from 16.x to >=18, you may need to update your environments [#12711](https://github.com/eclipse-theia/theia/pull/12711) +- [preferences] removed the `welcome.alwaysShowWelcomePage` preference in favor of `workbench.startupEditor` [#12813](https://github.com/eclipse-theia/theia/pull/12813) +- [terminal] deprecated `terminal.integrated.rendererType` preference [#12691](https://github.com/eclipse-theia/theia/pull/12691) +- [terminal] removed protected method `TerminalWidgetImpl.getTerminalRendererType` [#12691](https://github.com/eclipse-theia/theia/pull/12691) + +## v1.40.0 - 07/27/2023 + +- [application-package] bumped the default supported VS Code API from `1.78.0` to `1.79.0` [#12764](https://github.com/eclipse-theia/theia/pull/12764) - Contributed on behalf of STMicroelectronics +- [application-package] fixed ignored resource in backend bundling [#12681](https://github.com/eclipse-theia/theia/pull/12681) +- [cli] added `check:theia-extensions` to facilitate checking the uniqueness of `@theia` extension versions [#12596](https://github.com/eclipse-theia/theia/pull/12596) - Contributed on behalf of STMicroelectronics +- [core] added functionality to display command shortcuts in toolbar item tooltips [#12660](https://github.com/eclipse-theia/theia/pull/12660) - Contributed on behalf of STMicroelectronics +- [core] added support to render a visual preview of a tab while hovering [#12648](https://github.com/eclipse-theia/theia/pull/12648) - Contributed on behalf of STMicroelectronics +- [core] fixed regression when rendering icons in menus [#12739](https://github.com/eclipse-theia/theia/pull/12739) +- [core] fixed tabbar icon flickering when resizing views [#12629](https://github.com/eclipse-theia/theia/pull/12629) +- [core] updated localization data with respect to VS Code `1.79.0` [#12765](https://github.com/eclipse-theia/theia/pull/12765) +- [debug] fixed issue where the `DebugBreakpointWidget` did not have the proper value [#12567](https://github.com/eclipse-theia/theia/pull/12567) +- [debug] improved multi-root experience for launch configurations [#12674](https://github.com/eclipse-theia/theia/pull/12674) +- [dialog] added support for the `maxWidth` attribute [#12642](https://github.com/eclipse-theia/theia/pull/12642) +- [documentation] added policy on VS Code usage [#11537](https://github.com/eclipse-theia/theia/pull/11537) +- [filesystem] fixed readonly permissions with disk filesystem provider [#12354](https://github.com/eclipse-theia/theia/pull/12354) +- [keymaps] improved display of action buttons in the keyboard shortcuts view [#12675](https://github.com/eclipse-theia/theia/pull/12675) +- [playwright] fixed issue with `TheiaDialog` page object [#12753](https://github.com/eclipse-theia/theia/pull/12753) +- [plugin] added stubbing for the `ShareProvider` VS Code API [#12747](https://github.com/eclipse-theia/theia/pull/12474) +- [plugin] fixed `MarkdownString` support for `documentation` [#12685](https://github.com/eclipse-theia/theia/pull/12685) +- [plugin] improved handling when writing stores [#12717](https://github.com/eclipse-theia/theia/pull/12717) +- [preferences] improved preference file button rendering [#12586](https://github.com/eclipse-theia/theia/pull/12586) +- [repo] fixed launch configurations for ovsx [#12731](https://github.com/eclipse-theia/theia/pull/12731) +- [scm] improved tree selection styling [#12470](https://github.com/eclipse-theia/theia/pull/12670) +- [search-in-workspace] improved styling of search options [#12697](https://github.com/eclipse-theia/theia/pull/12697) +- [search-in-workspace] improved tree selection styling [#12470](https://github.com/eclipse-theia/theia/pull/12470) +- [vscode] added support for `AuthenticationForceNewSessionOptions` and `detail` message [#12752](https://github.com/eclipse-theia/theia/pull/12752) - Contributed on behalf of STMicroelectronics +- [vscode] added support for the `TaskPresentationOptions` close property [#12749](https://github.com/eclipse-theia/theia/pull/12749) - Contributed on behalf of STMicroelectronics +- [workspace] added support for workspace file extension customization [#12420](https://github.com/eclipse-theia/theia/pull/12420) +- [workspace] implemented `CanonicalUriProvider` VS Code API [#12743](https://github.com/eclipse-theia/theia/pull/12743) - Contributed on behalf of STMicroelectronics + +[Breaking Changes:](#breaking_changes_1.40.0) + +- [preferences] changed the `window.tabbar.enhancedPreview` preference from boolean to enum: [#12648](https://github.com/eclipse-theia/theia/pull/12648) - Contributed on behalf of STMicroelectronics + - `classic`: Display a simple preview of the tab with basic information. + - `enhanced`: Display an enhanced preview of the tab with additional information. (The behavior introduced in [#12350](https://github.com/eclipse-theia/theia/pull/12350)) + - `visual`: Display a visual preview of the tab. (The preview support was added with this PR) +- [repo] updated GitHub workflow to stop publishing `next` versions [#12699](https://github.com/eclipse-theia/theia/pull/12699) +- [workspace] split `CommonWorkspaceUtils` into `WorkspaceFileService` and `UntitledWorkspaceService` [#12420](https://github.com/eclipse-theia/theia/pull/12420) +- [plugin] Removed synchronous `fs` calls from the backend application and plugins. The plugin scanner, directory and file handlers, and the plugin deploy entry has async API now. Internal `protected` APIs have been affected. [#12798](https://github.com/eclipse-theia/theia/pull/12798) + +## v1.39.0 - 06/29/2023 + +- [application-manager] added support for backend bundling [#12412](https://github.com/eclipse-theia/theia/pull/12412) +- [application-package] bumped the default supported VS Code API from `1.77.0` to `1.78.0` [#12655](https://github.com/eclipse-theia/theia/pull/12655) +- [core] fixed visibility of the toolbar when resizing [#12617](https://github.com/eclipse-theia/theia/pull/12617) +- [core] improved responsiveness of input fields [#12604](https://github.com/eclipse-theia/theia/pull/12604) +- [core] improved rpc protocol [#12581](https://github.com/eclipse-theia/theia/pull/12581) +- [core] updated `ConfirmSaveDialog` button order for consistency [#12559](https://github.com/eclipse-theia/theia/pull/12559) +- [core] updated handling on tab overflow for sidepanels [#12593](https://github.com/eclipse-theia/theia/pull/12593) +- [core] updated localization metadata for `1.78.0` [#12661](https://github.com/eclipse-theia/theia/pull/12661) +- [core] updated styling for input validation in dialogs [#12585](https://github.com/eclipse-theia/theia/pull/12585) +- [debug] added missing localizations for the debug session status [#12569](https://github.com/eclipse-theia/theia/pull/12569) +- [debug] added support for conditional exception breakpoints [#12445](https://github.com/eclipse-theia/theia/pull/12445) +- [electron] added secondary window support [#12481](https://github.com/eclipse-theia/theia/pull/12481) +- [file-search] added missing localizations for the quick-file open [#12571](https://github.com/eclipse-theia/theia/pull/12571) +- [file-search] updated `ripgrep` arguments for file searches [#12608](https://github.com/eclipse-theia/theia/pull/12608) +- [keymaps] fixed broken typedoc link for supported keys [#12573](https://github.com/eclipse-theia/theia/pull/12573) +- [monaco] improved styling of the quick-input menu [#12239](https://github.com/eclipse-theia/theia/pull/12239) +- [navigator] improved open editors styling and decorations [#12598](https://github.com/eclipse-theia/theia/pull/12598) +- [plugin] added `ThemeIcon` support for `SourceControlResourceThemableDecorations.iconPath` VS Code API [#12187](https://github.com/eclipse-theia/theia/pull/12187) +- [plugin] added stubbing for the `onWillSaveNotebookDocument` VS Code API [#12614](https://github.com/eclipse-theia/theia/pull/12614) +- [plugin] added support to track the visible viewlet [#12597](https://github.com/eclipse-theia/theia/pull/12597) +- [repo] updated border-radius styling for various elements [#12252](https://github.com/eclipse-theia/theia/pull/12252) +- [repo] updated license headers to respect `SPDX` standards [#12584](https://github.com/eclipse-theia/theia/pull/12584) +- [repo] upgraded builtin extension-pack to `v1.77.0` [#12576](https://github.com/eclipse-theia/theia/pull/12576) +- [terminal] fixed `split-terminal` toolbar item visibility [#12626](https://github.com/eclipse-theia/theia/pull/12626) +- [terminal] fixed command executions on Windows [#12620](https://github.com/eclipse-theia/theia/pull/12620) +- [terminal] fixed terminal flicker when resizing [#12587](https://github.com/eclipse-theia/theia/pull/12587) +- [vscode] added missing editor/lineNumber/context menu mapping [#12638](https://github.com/eclipse-theia/theia/pull/12638) - Contributed on behalf of STMicroelectronics +- [vscode] added support for the `editor/title/run` toolbar menu [#12637](https://github.com/eclipse-theia/theia/pull/12637) - Contributed on behalf of STMicroelectronics +- [vsx-registry] added multiple registries support [#12040](https://github.com/eclipse-theia/theia/pull/12040) + +[Breaking Changes:](#breaking_changes_1.39.0) + +- [cli] build process has been adapted to facilitate backend bundling [#12412](https://github.com/eclipse-theia/theia/pull/12412) + - `webpack` compiles frontend files now into the `lib/frontend` directory (previously `lib`) + - the `electron-main.js` has been moved from `src-gen/frontend` to `src-gen/backend` + - `theia rebuild` needs to run **before** `theia build` for the respective target when using a bundled backend +- [repo] with the upgrade to Inversify 6.0, a few initialization methods were adjusted. See also [this migration guide entry](https://github.com/eclipse-theia/theia/blob/master/doc/Migration.md#inversify-60). Additionally, other changes include: [#12425](https://github.com/eclipse-theia/theia/pull/12425) + - the type expected by the `PreferenceProxySchema` symbol has been changed from `PromiseLike` to `() => PromiseLike` + - the symbol `OnigasmPromise` has been changed to `OnigasmProvider` and injects a function of type `() => Promise` + - the symbol `PreferenceTransactionPrelude` has been changed to `PreferenceTransactionPreludeProvider` and injects a function of type `() => Promise` +- [rpc] Renamed suffixes of classes and types that were still referencing the old rpc protocol. From `JsonRpc*` to `Rpc*`. + - old classes and types are still available but haven been deprecated and will be removed future releases [#12588](https://github.com/eclipse-theia/theia/pull/12588) + - e.g. `JsonRpcProxyFactory` is deprecated, use `RpcProxyFactory` instead. + +## v1.38.0 - 05/25/2023 + +- [application-manager] fixed regression preventing browser-only builds from succeeding [#12491](https://github.com/eclipse-theia/theia/pull/12491) +- [application-package] bumped the default supported VS Code API from `1.74.2` to `1.77.0` [#12516](https://github.com/eclipse-theia/theia/pull/12516) +- [core] added `open tabs` dropdown for `workbench.tab.shrinkToFit.enabled` preference [#12411](https://github.com/eclipse-theia/theia/pull/12411) +- [core] added confirmation prompt when executing `Clear Command History` [#12510](https://github.com/eclipse-theia/theia/pull/12510) +- [core] added handling to prevent concurrent access to the disk [#12236](https://github.com/eclipse-theia/theia/pull/12236) +- [core] added handling to properly dismiss quick-open menus without explicit focus [#12446](https://github.com/eclipse-theia/theia/pull/12446) +- [core] added missing theming for `hc-dark` for active borders [#12448](https://github.com/eclipse-theia/theia/pull/12448) +- [core] added support for `enablement` property for command contributions [#12483](https://github.com/eclipse-theia/theia/pull/12483) +- [core] updated JSON schema URL [#12376](https://github.com/eclipse-theia/theia/pull/12376) +- [core] updated `nls.metadata.json` for `1.77.0` [#12555](https://github.com/eclipse-theia/theia/pull/12555) +- [debug] added handling to associate root folder to dynamic debug configurations [#12482](https://github.com/eclipse-theia/theia/pull/12482) +- [debug] fixed behavior for exited threads [#12113](https://github.com/eclipse-theia/theia/pull/12113) +- [debug] fixed focus out for the debug configuration quick-open menu [#12046](https://github.com/eclipse-theia/theia/pull/12046) +- [debug] fixed incorrect debug configuration on startup [#12480](https://github.com/eclipse-theia/theia/pull/12480) +- [documentation] added resolution note for `msgpackr` [#12527](https://github.com/eclipse-theia/theia/pull/12527) +- [editor] added confirmation prompt when executing `Clear Editor History` [#12506](https://github.com/eclipse-theia/theia/pull/12506) +- [markers] improved the performance when rending markers [#12408](https://github.com/eclipse-theia/theia/pull/12408) +- [messages] added handling to properly close the toaster container when empty [#12457](https://github.com/eclipse-theia/theia/pull/12457) +- [monaco] fixed styling for the suggest list highlighting [#12317](https://github.com/eclipse-theia/theia/pull/12317) +- [plugin] added stubbing for the `ProfileContentHandler` VS Code API [#12535](https://github.com/eclipse-theia/theia/pull/12535) +- [plugin] added stubbing for the `TerminalQuickFixProvider` VS Code API [#12532](https://github.com/eclipse-theia/theia/pull/12532) +- [plugin] added stubbing for the `onWillCreateEditSessionIdentity` [#12533](https://github.com/eclipse-theia/theia/pull/12533) +- [plugin] added stubbing for the proposed `DocumentPaste` VS Code API [#12512](https://github.com/eclipse-theia/theia/pull/12512) +- [plugin] added stubbing for the proposed `EditSessionIdentityProvider` VS Code API [#12508](https://github.com/eclipse-theia/theia/pull/12508) +- [plugin] added stubbing for the proposed `ExternalUriOpener` VS Code API [#12539](https://github.com/eclipse-theia/theia/pull/12539) +- [plugin] added support for `collapse all` in tree-view toolbars [#12514](https://github.com/eclipse-theia/theia/pull/12514) +- [plugin] added support for the `TelemetryLogger` VS Code API [#12453](https://github.com/eclipse-theia/theia/pull/12453) +- [plugin] fixed `TreeView#reveal` behavior [#12489](https://github.com/eclipse-theia/theia/pull/12489) +- [plugin] fixed tab indices logic when moving or closing tabs [#12400](https://github.com/eclipse-theia/theia/pull/12400) +- [repo] upgraded `engine.io` to fix a known vulnerability [#12556](https://github.com/eclipse-theia/theia/pull/12556) +- [repo] upgraded `socket.io-parser` to fix a known vulnerability [#12556](https://github.com/eclipse-theia/theia/pull/12556) +- [scripts] improved `dash-licenses` to handle internal errors [#12545](https://github.com/eclipse-theia/theia/pull/12545) +- [search-in-workspace] added multiselect support in the view [#12331](https://github.com/eclipse-theia/theia/pull/12331) +- [task] improved user-experience when configuring and running tasks [#12507](https://github.com/eclipse-theia/theia/pull/12507) +- [workspace] added exception handling for `WorkspaceDeleteHandler` [#12544](https://github.com/eclipse-theia/theia/pull/12544) +- [workspace] improved behavior of `open workspace` and `open folder` [#12537](https://github.com/eclipse-theia/theia/pull/12537) + +[Breaking Changes:](#breaking_changes_1.38.0) + +- [core] moved `ToolbarAwareTabBar.Styles` to `ScrollableTabBar.Styles` [#12411](https://github.com/eclipse-theia/theia/pull/12411/) +- [debug] changed the return type of `DebugConfigurationManager.provideDynamicDebugConfigurations()` to `Promise>` [#12482](https://github.com/eclipse-theia/theia/pull/12482) +- [workspace] removed `WorkspaceFrontendContribution.createOpenWorkspaceOpenFileDialogProps(...)` and `WorkspaceFrontendContribution.preferences` [#12537](https://github.com/eclipse-theia/theia/pull/12537) + +## v1.37.0 - 04/27/2023 + +- [application-package] bumped the default supported VS Code API from `1.72.2` to `1.74.2` [#12468](https://github.com/eclipse-theia/theia/pull/12468) +- [cli] added support for `${targetPlatform}` when declaring URLs for plugins [#12410](https://github.com/eclipse-theia/theia/pull/12410) +- [core] added support for a dynamic tab resizing strategy (controlled by `workbench.tab.shrinkToFit.enabled`) [#12360](https://github.com/eclipse-theia/theia/pull/12360) +- [core] added support for enhanced `tabbar` previews on hover [#12350](https://github.com/eclipse-theia/theia/pull/12350) +- [core] added support for localizations using VS Code's `l10n` [#12192](https://github.com/eclipse-theia/theia/pull/12192) +- [core] added support for pushing a large number of items in tree iterators [#12172](https://github.com/eclipse-theia/theia/pull/12172) +- [core] added theming support for `highlightModifiedTabs` [#12367](https://github.com/eclipse-theia/theia/pull/12367) +- [core] fixed an issue where the `theia-file-icons` theme was not always applied [#12419](https://github.com/eclipse-theia/theia/pull/12419) +- [core] fixed right-click behavior in trees due to padding [#12436](https://github.com/eclipse-theia/theia/pull/12436) +- [core] replaced `request` with `@theia/request` [#12413](https://github.com/eclipse-theia/theia/pull/12413) +- [debug] fixed an issue where `getTrackableWidgets` did not return the right result [#12241](https://github.com/eclipse-theia/theia/pull/12241) +- [electron] upgraded `electron` to `23.2.4` [#12464](https://github.com/eclipse-theia/theia/pull/12464) +- [keymaps] improved search when searching for keybindings [#12312](https://github.com/eclipse-theia/theia/pull/12312) +- [monaco] added missing localizations [#12378](https://github.com/eclipse-theia/theia/pull/12378) +- [monaco] added support for the `inQuickOpen` when-clause context [#12427](https://github.com/eclipse-theia/theia/pull/12427) +- [monaco] fixed `parseSnippets` handling [#12463](https://github.com/eclipse-theia/theia/pull/12463) +- [monaco] fixed `Save As...` limit [#12418](https://github.com/eclipse-theia/theia/pull/12418) +- [playwright] added a page object for terminals [#12381](https://github.com/eclipse-theia/theia/pull/12381) +- [playwright] upgraded `playwright` to latest version [#12384](https://github.com/eclipse-theia/theia/pull/12384) +- [plugin] added error feedback when invoking the `vscode.open` command [#12284](https://github.com/eclipse-theia/theia/pull/12284) +- [plugin] added handling to ensure unique tree-view IDs [#12338](https://github.com/eclipse-theia/theia/pull/12338) +- [plugin] added handling to use `TaskScope.Workspace` as a default when no `scope` is provided [#12431](https://github.com/eclipse-theia/theia/pull/12431) +- [plugin] added stubbing for the `TestRunProfile#supportsContinuousRun` VS Code API [#12456](https://github.com/eclipse-theia/theia/pull/12456) +- [plugin] added support for the `CommentThread#state` VS Code API [#12454](https://github.com/eclipse-theia/theia/pull/12454) +- [plugin] added support for the `onTaskType` when-clause context [#12431](https://github.com/eclipse-theia/theia/pull/12431) +- [plugin] fixed check for presence of files in drag-and-drop [#12409](https://github.com/eclipse-theia/theia/pull/12409) +- [plugin] fixed memory leak in tree-views [#12353](https://github.com/eclipse-theia/theia/pull/12353) +- [plugin] implemented the VS Code `LogOutputChannel` API [#12017](https://github.com/eclipse-theia/theia/pull/12429) - Contributed on behalf of STMicroelectronics +- [preferences] improved localizations for preferences [#12378](https://github.com/eclipse-theia/theia/pull/12378) +- [search-in-workspace] added missing placeholder for glob input fields [#12389](https://github.com/eclipse-theia/theia/pull/12389) +- [search-in-workspace] fixed `patternExcludesInputBoxFocus` when-clause handler [#12385](https://github.com/eclipse-theia/theia/pull/12385) + +[Breaking Changes:](#breaking_changes_1.37.0) + +- [core] injected `CorePreferences` into `DockPanelRenderer` constructor [12360](https://github.com/eclipse-theia/theia/pull/12360) +- [core] introduced `ScrollableTabBar.updateTabs()` to fully render tabs [12360](https://github.com/eclipse-theia/theia/pull/12360) +- [plugin] changed visibility from `private` to `protected` for member `proxy` and function `validate()` in `output-channel-item.ts` [#12017](https://github.com/eclipse-theia/theia/pull/12429) +- [plugin] removed enum `LogLevel` and namespace `env` from `plugin/src/theia-proposed.d.ts` [#12017](https://github.com/eclipse-theia/theia/pull/12429) + +## v1.36.0 0 - 03/30/2023 + +- [application-manager] upgraded `webpack` to `5.76.0` [#12316](https://github.com/eclipse-theia/theia/pull/12316) +- [cli] updated `puppeteer` version [#12222](https://github.com/eclipse-theia/theia/pull/12222) +- [core] added fallback to `applicationName` for the application window [#12265](https://github.com/eclipse-theia/theia/pull/12265) +- [core] added support for `placeholder` in `SingleTextInputDialog` [#12244](https://github.com/eclipse-theia/theia/pull/12244) +- [core] fixed `waitForHidden` method implementation to properly check visibility [#12300](https://github.com/eclipse-theia/theia/pull/12300) +- [core] fixed handling when rendering preferences according to the schema [#12347](https://github.com/eclipse-theia/theia/pull/12347) +- [core] fixed issue with the rendering of toolbar items with when clauses [#12329](https://github.com/eclipse-theia/theia/pull/12329) +- [core] fixed tabbar rendering when items are present [#12307](https://github.com/eclipse-theia/theia/pull/12307) +- [core] fixed the `merge` of debug configurations [#12174](https://github.com/eclipse-theia/theia/pull/12174) +- [core] refined typings for `isObject` [#12259](https://github.com/eclipse-theia/theia/pull/12259) +- [core] updated styling of dialogs [#12254](https://github.com/eclipse-theia/theia/pull/12254) +- [debug] added suppression support for the `DebugSessionOptions` VS Code API [#12220](https://github.com/eclipse-theia/theia/pull/12220) +- [debug] improved breakpoint decoration rendering [#12249](https://github.com/eclipse-theia/theia/pull/12249) +- [file-search] updated handling when a file is not found [#12255](https://github.com/eclipse-theia/theia/pull/12255) +- [monaco] fixed incorrect range in `MonacoOutlineContribution` [#12306](https://github.com/eclipse-theia/theia/pull/12306) +- [monaco] fixed issue preventing the first element in a quick-input from being selected initially [#12208](https://github.com/eclipse-theia/theia/pull/12208) +- [outline-view] added "expand-all" toolbar item [#12188](https://github.com/eclipse-theia/theia/pull/12188) +- [plugin] added handling to ensure uniqueness of tree node ids [#12120](https://github.com/eclipse-theia/theia/pull/12120) +- [plugin] added proper handling for `OnEnterRule` [#12228](https://github.com/eclipse-theia/theia/pull/12228) +- [plugin] added stubbing of the proposed `extensions.allAcrossExtensionHosts` VS Code API [#12277](https://github.com/eclipse-theia/theia/pull/12277) +- [plugin] added support for the `TerminalExitReason` VS Code API [#12293](https://github.com/eclipse-theia/theia/pull/12293) +- [plugin] added support for the `ViewBadge` VS Code API [#12330](https://github.com/eclipse-theia/theia/pull/12330) +- [plugin] bumped the default supported API to `1.72.2` [#12359](https://github.com/eclipse-theia/theia/pull/12359) +- [plugin] fixed issue which caused the loss of file watching events [#12264](https://github.com/eclipse-theia/theia/pull/12264) +- [plugin] fixed issue with `PseudoTerminal` events [#12146](https://github.com/eclipse-theia/theia/pull/12146) +- [plugin] fixed plugin proxy support [#12266](https://github.com/eclipse-theia/theia/pull/12266) +- [plugin] fixed recursion when setting webview title [#12221](https://github.com/eclipse-theia/theia/pull/12221) +- [plugin] reduced plugging logging level to debug [#12224](https://github.com/eclipse-theia/theia/pull/12224) +- [scm] fixed inline toolbar command execution [#12295](https://github.com/eclipse-theia/theia/pull/12295) +- [terminal] added support for context-menus in terminals [#12326](https://github.com/eclipse-theia/theia/pull/12326) +- [terminal] fixed issue causing new terminals to not spawn without a workspace present [#12322](https://github.com/eclipse-theia/theia/pull/12322) +- [terminal] fixed terminal creation when spawning multiple terminals quickly [#12225](https://github.com/eclipse-theia/theia/pull/12225) +- [toolbar] fixed `dragOver` behavior in toolbars [#12257](https://github.com/eclipse-theia/theia/pull/12257) +- [workspace] simplified `add folder` and `remove folder` command implementations [#12242](https://github.com/eclipse-theia/theia/pull/12242) +- [workspace] updated the `rename` command to return the `stat` when successful [#12278](https://github.com/eclipse-theia/theia/pull/12278) + +[Breaking Changes:](#breaking_changes_1.36.0) + +- [core] changed default icon theme from `none` to `theia-file-icons` [#11028](https://github.com/eclipse-theia/theia/pull/12346) +- [plugin] renamed `TreeViewExtImpl#toTreeItem()` to `TreeViewExtImpl#toTreeElement()` +- [scm] fixed `scm` inline toolbar commands, the changes introduces the following breakage: [#12295](https://github.com/eclipse-theia/theia/pull/12295) + - Interface `ScmInlineAction` removes `commands: CommandRegistry` + - Interface `ScmInlineActions` removes `commands: CommandRegistry` + - Interface `ScmTreeWidget.Props` removes `commands: CommandRegistry` +- [terminal] removed `openTerminalFromProfile` method from `TerminalFrontendContribution` [#12322](https://github.com/eclipse-theia/theia/pull/12322) +- [electron] enabled context isolation and disabled node integration in Electron renderer () + +## v1.35.0 - 02/23/2023 + +- [application-package] updated default supported VS Code API to `1.70.1` [#12200](https://github.com/eclipse-theia/theia/pull/12200) +- [core] added handling on shutdown when dirty editors are present [#12166](https://github.com/eclipse-theia/theia/pull/12166) +- [core] fixed `ToolbarItem.when` handling [#12067](https://github.com/eclipse-theia/theia/pull/12067) +- [core] fixed styling of view titles with toolbar items [#12077](https://github.com/eclipse-theia/theia/pull/12077) +- [core] implemented `workbench.editor.revealIfOpen` preference [#12145](https://github.com/eclipse-theia/theia/pull/12145) +- [core] improved styling for tree and select component outlines [#12156](https://github.com/eclipse-theia/theia/pull/12156) +- [core] updated localizations to VS Code `1.70.2` [#12205](https://github.com/eclipse-theia/theia/pull/12205) +- [debug] added localizations for the debug level selector [#12033](https://github.com/eclipse-theia/theia/pull/12033) +- [debug] fixed handling of for breakpoint events when metadata is updated [#12183](https://github.com/eclipse-theia/theia/pull/12183) +- [debug] fixed instruction breakpoints in `DebugSession` [#12190](https://github.com/eclipse-theia/theia/pull/12190) +- [debug] removed unnecessary "download debug adapters" script [#12150](https://github.com/eclipse-theia/theia/pull/12150) +- [editor] added handling for closing duplicate editors on the same tabbar [#12147](https://github.com/eclipse-theia/theia/pull/12147) +- [filesystem] added option to toggle hidden files/folders in the file dialog [#12179](https://github.com/eclipse-theia/theia/pull/12179) +- [filesystem] fixed memory leak in `NsfwWatcher` [#12144](https://github.com/eclipse-theia/theia/pull/12144) +- [filesystem] upgrades trash from `6.1.1` to `7.2.0` [#12133](https://github.com/eclipse-theia/theia/pull/12133) +- [navigator] updated restoration handling for open-editors [#12210](https://github.com/eclipse-theia/theia/pull/12210) +- [playwright] upgraded `@playwright/test` dependency to `1.30.0` [#12141](https://github.com/eclipse-theia/theia/pull/12141) +- [plugin] added ability to generate activation events automatically [#12167](https://github.com/eclipse-theia/theia/pull/12167) +- [plugin] added handling for plugins to access language overrides with bracket syntax [#12136](https://github.com/eclipse-theia/theia/pull/12136) +- [plugin] added support for `DocumentDropEditProvider` [#12125](https://github.com/eclipse-theia/theia/pull/12125) +- [plugin] added support for the `activeWebviewPanelId` context when-clause [#12182](https://github.com/eclipse-theia/theia/pull/12182) +- [plugin] exposed terminal commands to plugins [#12134](https://github.com/eclipse-theia/theia/pull/12134) +- [plugin] fixed focus issue for modal notifications [#12206](https://github.com/eclipse-theia/theia/pull/12206) +- [plugin] implemented the VS Code `Tab` API [#12109](https://github.com/eclipse-theia/theia/pull/12109) +- [plugin] implemented the `WorkspaceEditMetadata` VS Code API [#12193](https://github.com/eclipse-theia/theia/pull/12193) +- [plugin] updated restoration handling when a `Webview` does not implement `WebviewPanelSerializer` [#12138](https://github.com/eclipse-theia/theia/pull/12138) +- [repo] fixed API integration test suite [#12117](https://github.com/eclipse-theia/theia/pull/12117) +- [scripts] fixed comparison when compiling package references [#12122](https://github.com/eclipse-theia/theia/pull/12122) +- [terminal] added support for multi-root workspaces in terminal profiles [#12199](https://github.com/eclipse-theia/theia/pull/12199) +- [terminal] fixed issue when no default terminal profile is set on startup [#12191](https://github.com/eclipse-theia/theia/pull/12191) +- [workspace] added handling to ensure uniqueness of roots [#12159](https://github.com/eclipse-theia/theia/pull/12159) +- [workspace] updated styling for input dialogs [#12158](https://github.com/eclipse-theia/theia/pull/12158) + +[Breaking Changes:](#breaking_changes_1.35.0) + +- [repo] drop support for `Node 14` [#12169](https://github.com/eclipse-theia/theia/pull/12169) + +## v1.34.0 - 01/26/2023 + +- [application-package] bumped the default supported API version from `1.55.2` to `1.66.2` [#12104](https://github.com/eclipse-theia/theia/pull/12104) +- [cli] added ability to use client side rate limiting when download plugins [#11962](https://github.com/eclipse-theia/theia/pull/11962) +- [core] improved display of dialogs with a lot of content [#12052](https://github.com/eclipse-theia/theia/pull/12052) +- [core] improved extensibility of the "uncaught error" handler in the `BackendApplication` [#12068](https://github.com/eclipse-theia/theia/pull/12068) +- [core] improved styling of the `select-dropdown` component when content overflows [#12038](https://github.com/eclipse-theia/theia/pull/12038) +- [core] refactored to use `fsPath` for the `COPY_PATH` command [#12002](https://github.com/eclipse-theia/theia/pull/12002) +- [core] updated `nsfw` from `2.1.2` to `2.2.4` [#11975](https://github.com/eclipse-theia/theia/pull/11975) +- [core] updated `vscode-languageserver-protocol` from `3.15.3` to `3.17.2` [#12012](https://github.com/eclipse-theia/theia/pull/12012) +- [debug] fixed numerous issues related to debugging [#11984](https://github.com/eclipse-theia/theia/pull/11984) +- [debug] fixed styling of the hover widget when content overflows [#12058](https://github.com/eclipse-theia/theia/pull/12058) +- [debug] fixed styling of variables in the view [#12089](https://github.com/eclipse-theia/theia/pull/12089) +- [filesystem] added missing localization for the "preparing download" message [#12041](https://github.com/eclipse-theia/theia/pull/12041) +- [filesystem] added missing localization for the deleted tab suffix [#12032](https://github.com/eclipse-theia/theia/pull/12032) +- [filesystem] updated styling for children of root nodes to include additional depth padding [#11967](https://github.com/eclipse-theia/theia/pull/11967) +- [filesystem] updated visibility of the `UPLOAD` command [#11756](https://github.com/eclipse-theia/theia/pull/11756) +- [getting-started] fixed an issue where the getting-started widget did not accept focus [#11807](https://github.com/eclipse-theia/theia/pull/11807) +- [memory-view] updating handling when variable requests fail [#11928](https://github.com/eclipse-theia/theia/pull/11928) +- [monaco] improved the responsiveness of quick-input menus [#12095](https://github.com/eclipse-theia/theia/pull/12095) +- [navigator] added the `OPEN_CONTAINING_FOLDER` command to the tab context-menu [#12076](https://github.com/eclipse-theia/theia/pull/12076) +- [plugin] added full support for the `Diagnostic.code` API [#11765](https://github.com/eclipse-theia/theia/pull/11765) +- [plugin] added handling for top-level preference access [#12056](https://github.com/eclipse-theia/theia/pull/12056) +- [plugin] added partial support for `iconPath` and `color` in the `TerminalOptions` and `ExtensionTerminalOptions` VS Code API [#12060](https://github.com/eclipse-theia/theia/pull/12060) +- [plugin] added stubbing of `tab`-related VS Code APIs [#12031](https://github.com/eclipse-theia/theia/pull/12031) +- [plugin] added support `valueSelection` for the `InputBox` VS Code API [#12050](https://github.com/eclipse-theia/theia/pull/12050) +- [plugin] added support for `RefactorMove` in the `CodeActionKind` VS Code API [#12039](https://github.com/eclipse-theia/theia/pull/12039) +- [plugin] added support for `enabled` in the `SourceControlInputBox` VS Code API [#12069](https://github.com/eclipse-theia/theia/pull/12069) +- [plugin] added support for `isTransient` in the `TerminalOptions` and `ExternalTerminalOptions` VS Code APIs [#12055](https://github.com/eclipse-theia/theia/pull/12055) - Contributed on behalf of STMicroelectronics +- [plugin] added support for `location` in the `TerminalOptions` VS Code API [#12006](https://github.com/eclipse-theia/theia/pull/12006) +- [plugin] added support for `timestamp` in the `Comment` VS Code API [#12007](https://github.com/eclipse-theia/theia/pull/12007) +- [plugin] added support for multi-selection in tree-views [#12088](https://github.com/eclipse-theia/theia/pull/12088) +- [plugin] added support for the `DataTransfer` VS Code API [#12065](https://github.com/eclipse-theia/theia/pull/12065) +- [plugin] added support for the `SnippetTextEdit` VS Code API [#12047](https://github.com/eclipse-theia/theia/pull/12047) +- [plugin] added support for the `TerminalProfile` VS Code API [#12066](https://github.com/eclipse-theia/theia/pull/12066) +- [plugin] added support for the `TreeDragAndDropController` VS Code API [#12065](https://github.com/eclipse-theia/theia/pull/12065) +- [plugin] fixed `WebView` CORS handling for `vscode-resource` [#12070](https://github.com/eclipse-theia/theia/pull/12070) +- [plugin] fixed `WebView` VS Code API inconsistencies [#12091](https://github.com/eclipse-theia/theia/pull/12091) - Contributed on behalf of STMicroelectronics +- [plugin] fixed regression when starting pseudoterminals [#12098](https://github.com/eclipse-theia/theia/pull/12098) +- [repo] added missing localizations in dialogs [#12062](https://github.com/eclipse-theia/theia/pull/12062) +- [repo] added simplified type checking for objects [#11831](https://github.com/eclipse-theia/theia/pull/11831) +- [repo] updated default localizations to `1.68.1` [#12092](https://github.com/eclipse-theia/theia/pull/12092) +- [scm] added support for `strikethrough` decorations contributed by the `SourceControlResourceDecorations` VS Code API [#11999](https://github.com/eclipse-theia/theia/pull/11999) +- [terminal] added support for the preference `terminal.integrated.enablePersistentSessions` to allow disabling restoring terminals on reload [#12055](https://github.com/eclipse-theia/theia/pull/12055) - Contributed on behalf of STMicroelectronics +- [terminal] removed unnecessary use `RPCProtocol` [#11972](https://github.com/eclipse-theia/theia/pull/11972) +- [variable-resolver] fixed evaluations of `pickString` variables [#12100](https://github.com/eclipse-theia/theia/pull/12100) - Contributed on behalf of STMicroelectronics +- [workspace] refactored to use `fsPath` for the `COPY_RELATIVE_PATH` command [#12002](https://github.com/eclipse-theia/theia/pull/12002) + +[Breaking Changes:](#breaking_changes_1.34.0) + +- [plugin-ext] renamed `TreeViewWidgetIdentifier` to `TreeViewWidgetOptions` as there were more fields added to it [12065](https://github.com/eclipse-theia/theia/pull/12065) diff --git a/doc/changelogs/CHANGELOG-2024.md b/doc/changelogs/CHANGELOG-2024.md new file mode 100644 index 0000000..a186a22 --- /dev/null +++ b/doc/changelogs/CHANGELOG-2024.md @@ -0,0 +1,524 @@ +# Changelog 2024 + +## 1.57.0 - 12/16/2024 + +- [ai] added initial support for MCP [#14598](https://github.com/eclipse-theia/theia/pull/14598) +- [ai] added support for Anthropic as an LLM provider [#14614](https://github.com/eclipse-theia/theia/pull/14614) +- [ai] fixed logic to enable chat input on chat widget activate [#14608](https://github.com/eclipse-theia/theia/pull/14608) - Contributed on behalf of STMicroelectronics +- [ai] fixed logic to hide "Generating..." while waiting on input [#14559](https://github.com/eclipse-theia/theia/pull/14559) - Contributed on behalf of STMicroelectronics +- [ai] integrated SCANOSS [#14628](https://github.com/eclipse-theia/theia/pull/14628) +- [ai] updated logic to invoke OpenerService for markdown links in chat UI [#14602](https://github.com/eclipse-theia/theia/pull/14602) - Contributed on behalf of STMicroelectronics +- [application-package] bumped API version to 1.96.0 [#14634](https://github.com/eclipse-theia/theia/pull/14634) - Contributed on behalf of STMicroelectronics +- [core] added logic to cancel pending hover on mouse exit [#14533](https://github.com/eclipse-theia/theia/pull/14533) +- [core] fixed enablement of "Collapse Side Panel" tab bar context menu item [#14616](https://github.com/eclipse-theia/theia/pull/14616) +- [core] fixed window maximization when using splash screen [#14219](https://github.com/eclipse-theia/theia/pull/14219) +- [core] pinned perfect-scrollbar to 1.5.5 [#14592](https://github.com/eclipse-theia/theia/pull/14592) - Contributed on behalf of STMicroelectronics +- [dev-container] added logic to make DevContainer workspaces openable through recent workspaces [#14567](https://github.com/eclipse-theia/theia/pull/14567) +- [dev-container] added support for THEIA_DEFAULT_PLUGINS env variable [#14530](https://github.com/eclipse-theia/theia/pull/14530) +- [dev-container] improved searchForDevontainerJsonFiles to not block server [#14563](https://github.com/eclipse-theia/theia/pull/14563) +- [dev-container] updated logic to ensure that dev container uses the right workspace [#14557](https://github.com/eclipse-theia/theia/pull/14557) +- [dev-container] updated logic to include settings and configuration from the local user dir [#14548](https://github.com/eclipse-theia/theia/pull/14548) +- [dev-container] updated logic to pull amd64 container images on darwin/arm64 [#14552](https://github.com/eclipse-theia/theia/pull/14552) +- [editor] fixed editor preference localizations [#14018](https://github.com/eclipse-theia/theia/pull/14018) +- [notebook] added basics to allow for hidden cells [#14573](https://github.com/eclipse-theia/theia/pull/14573) +- [notebook] added fixes for invisible cells [#14617](https://github.com/eclipse-theia/theia/pull/14617) +- [notebook] fixed cell height when updating output [#14621](https://github.com/eclipse-theia/theia/pull/14621) +- [notebook] fixed rendering of output of cells added with already existing output [#14618](https://github.com/eclipse-theia/theia/pull/14618) +- [plugin] introduced IconPath type [#14590](https://github.com/eclipse-theia/theia/pull/14590) - Contributed on behalf of STMicroelectronics +- [plugin] stubbed TestRunProfile#loadDetailedCoverageForTest [#14599](https://github.com/eclipse-theia/theia/pull/14599) - Contributed on behalf of STMicroelectronics +- [plugin] updated builtins to 1.95.3 [#14606](https://github.com/eclipse-theia/theia/pull/14606) + +[Breaking Changes:](#breaking_changes_1.57.0) + +- [remote] use local settings and configuration while connected to remote (rebinds UserStorageProvider) [#14548] + +## 1.56.0 - 11/28/2024 + +- [ai] added support for users to specify custom request settings, model, and optionally provider-specific [#14535](https://github.com/eclipse-theia/theia/pull/14535) +- [ai] allowed specifying max lines used for AI code completion context [#14539](https://github.com/eclipse-theia/theia/pull/14539) +- [ai] added hovers for agents and variables [#14498](https://github.com/eclipse-theia/theia/pull/14498) +- [ai] allowed comments in prompt templates [#14470](https://github.com/eclipse-theia/theia/pull/14470) +- [ai] added local models to non-streaming accept list [#14420](https://github.com/eclipse-theia/theia/pull/14420) +- [ai] allowed canceling llama-file requests [#14515](https://github.com/eclipse-theia/theia/pull/14515) +- [ai] showed arguments in tool call response renderer [#14424](https://github.com/eclipse-theia/theia/pull/14424) +- [ai] supported prompt variants [#14487](https://github.com/eclipse-theia/theia/pull/14487) +- [ai] turned automatic inline completion off by default [#14513](https://github.com/eclipse-theia/theia/pull/14513) +- [ai] fixed request settings and stop words in HF provider [#14504](https://github.com/eclipse-theia/theia/pull/14504) +- [ai] added preference to ignore files in workspace functions [#14449](https://github.com/eclipse-theia/theia/pull/14449) +- [ai] fixed prompt template contribution category and template [#14497](https://github.com/eclipse-theia/theia/pull/14497) +- [ai] chore: avoided conflicting keybinding for opening chat window [#14495](https://github.com/eclipse-theia/theia/pull/14495) +- [ai] supported agents asking for input and continuing [#14486](https://github.com/eclipse-theia/theia/pull/14486) - Contributed on behalf of STMicroelectronics +- [ai] showed progress while calculating AI code completion [#14537](https://github.com/eclipse-theia/theia/pull/14537) +- [ai] fixed AI history view crashing on first use [#14443](https://github.com/eclipse-theia/theia/pull/14443) +- [ai] fixed: added React keys in chat views [#14444](https://github.com/eclipse-theia/theia/pull/14444) +- [ai] sorted models in LLM selection dialogue in AI Configuration View [#14442](https://github.com/eclipse-theia/theia/pull/14442) +- [ai] added support for Hugging Face [#14412](https://github.com/eclipse-theia/theia/pull/14412) +- [ai] added manual AI code completion [#14393](https://github.com/eclipse-theia/theia/pull/14393) +- [ai] improved workspace agent functions and prompt [#14426](https://github.com/eclipse-theia/theia/pull/14426) +- [ai] improved agent history recording [#14378](https://github.com/eclipse-theia/theia/pull/14378) +- [ai] allowed reopening AI history widget [#14422](https://github.com/eclipse-theia/theia/pull/14422) +- [ai] avoided prompt template directory error [#14421](https://github.com/eclipse-theia/theia/pull/14421) +- [ai] adjusted chat input height dynamically [#14432](https://github.com/eclipse-theia/theia/pull/14432) +- [ai] fixed: allowed all three brackets for variables [#14465](https://github.com/eclipse-theia/theia/pull/14465) +- [ai] allowed adding variants via prompt template files [#14509](https://github.com/eclipse-theia/theia/pull/14509) +- [application-package] bumped API version to 1.95.3 [#14541](https://github.com/eclipse-theia/theia/pull/14541) - Contributed on behalf of STMicroelectronics +- [browser-only] removed browserfs dependency (replaced by OPFS) [#14263](https://github.com/eclipse-theia/theia/pull/14263) +- [core] updated Inversify to latest [#14435](https://github.com/eclipse-theia/theia/pull/14435) +- [core] updated parcel watcher to 2.5.0 [#14545](https://github.com/eclipse-theia/theia/pull/14545) +- [core] fixed calculation of SelectComponent dropdown bottom [#14381](https://github.com/eclipse-theia/theia/pull/14381) +- [core] fixed electron win background color [#14491](https://github.com/eclipse-theia/theia/pull/14491) - Contributed on behalf of STMicroelectronics +- [core] fixed: kept closable state through pin/unpin [#14377](https://github.com/eclipse-theia/theia/pull/14377) - Contributed on behalf of STMicroelectronics +- [core] fixed alignment of viewWelcome to VS Code [#14391](https://github.com/eclipse-theia/theia/pull/14391) +- [core] fixed uppermost context menu item sometimes not clickable in Electron [#14401](https://github.com/eclipse-theia/theia/pull/14401) +- [debug] disabled editing of read-only variables [#14440](https://github.com/eclipse-theia/theia/pull/14440) +- [dev-container] fixed container stopping on disconnect and application close [#14542](https://github.com/eclipse-theia/theia/pull/14542) +- [electron] pinned Electron version to 30.1.2 [#14407](https://github.com/eclipse-theia/theia/pull/14407) - Contributed on behalf of STMicroelectronics +- [filesystem] added support for files.insertFinalNewline during formatOnSave [#13751](https://github.com/eclipse-theia/theia/pull/13751) - Contributed on behalf of STMicroelectronics +- [plugin] added min height to cell outputs [#14488](https://github.com/eclipse-theia/theia/pull/14488) +- [plugin] fixed selection and improved active text editor behavior [#14480](https://github.com/eclipse-theia/theia/pull/14480) +- [plugin] supported MappedEditProviders proposed API evolution [#14453](https://github.com/eclipse-theia/theia/pull/14453) - Contributed on behalf of STMicroelectronics +- [plugin] added support for ThemeColor property id [#14437](https://github.com/eclipse-theia/theia/pull/14437) - Contributed on behalf of STMicroelectronics +- [plugin] added support for property ThemeColor ID [#14437](https://github.com/eclipse-theia/theia/pull/14437) - Contributed on behalf of STMicroelectronics +- [plugin-ext] fixed overlapping outputs when creating a cell at the top [#14417](https://github.com/eclipse-theia/theia/pull/14417) +- [plugin-ext] fixed active notebook editor staying active as long as the editor is active [#14419](https://github.com/eclipse-theia/theia/pull/14419) +- [metrics] fixed MeasurementNotificationService binding [#14439](https://github.com/eclipse-theia/theia/pull/14439) + +[Breaking Changes:](#breaking_changes_1.56.0) + +- [core] fixed disposing of dialogs on close - [#14456](https://github.com/eclipse-theia/theia/pull/14456) - Contributed on behalf of STMicroelectronics + +## 1.55.0 - 10/31/2024 + +- [ai] added logic to allow to order and clear AI History view [#14233](https://github.com/eclipse-theia/theia/pull/14233) +- [ai] added preference to exclude files from code completion [#14315](https://github.com/eclipse-theia/theia/pull/14315) +- [ai] added support for custom agents [#14301](https://github.com/eclipse-theia/theia/pull/14301) +- [ai] added support for custom keys for custom Open AI models [#14299](https://github.com/eclipse-theia/theia/pull/14299) +- [ai] added support for llamafile as ai model provider [#14281](https://github.com/eclipse-theia/theia/pull/14281) +- [ai] added support for o1-preview [#14356](https://github.com/eclipse-theia/theia/pull/14356) +- [ai] added support to make response parsing extensible [#14196](https://github.com/eclipse-theia/theia/pull/14196) - Contributed on behalf of STMicroelectronics +- [ai] added support to query history by session [#14368](https://github.com/eclipse-theia/theia/pull/14368) - Contributed on behalf of STMicroelectronics +- [ai] fixed markdown request renderer [#14211](https://github.com/eclipse-theia/theia/pull/14211) +- [ai] improved custom OpenAI and llama-file preference description [#14376](https://github.com/eclipse-theia/theia/pull/14376) +- [ai] improved styling of the chat widget [#14278](https://github.com/eclipse-theia/theia/pull/14278) - Contributed on behalf of STMicroelectronics +- [ai] updated list of OpenAI models supporting structured output [#14247](https://github.com/eclipse-theia/theia/pull/14247) +- [ai] updated logic so that orchestrator logs its own requests [#14255](https://github.com/eclipse-theia/theia/pull/14255) +- [ai] updated logic to allow customizing the LLM request settings [#14284](https://github.com/eclipse-theia/theia/pull/14284) - Contributed on behalf of STMicroelectronics +- [ai] updated logic to avoid line wrap in code response parts [#14363](https://github.com/eclipse-theia/theia/pull/14363) +- [ai] updated terminal agent to record its requests [#14246](https://github.com/eclipse-theia/theia/pull/14246) +- [application-package] added an application prop to set the configuration area [#14319](https://github.com/eclipse-theia/theia/pull/14319) - Contributed on behalf of STMicroelectronics +- [application-package] bumped API version to 1.94.2 [#14371](https://github.com/eclipse-theia/theia/pull/14371) - Contributed on behalf of STMicroelectronics +- [cli] upgraded puppeteer to 23.1.0 [#14261](https://github.com/eclipse-theia/theia/pull/14261) - Contributed on behalf of STMicroelectronics +- [core] fixed circular imports when importing ReactDialog [#14352](https://github.com/eclipse-theia/theia/pull/14352) +- [core] fixed css calc expression to have space around operator [#14241](https://github.com/eclipse-theia/theia/pull/14241) - Contributed on behalf of STMicroelectronics +- [core] fixed duplicate text editor entry [#14238](https://github.com/eclipse-theia/theia/pull/14238) +- [core] improved widget specific status bar handling [#14239](https://github.com/eclipse-theia/theia/pull/14239) +- [core] replaced nsfw with @parcel/watcher [#14194](https://github.com/eclipse-theia/theia/pull/14194) +- [core] updated logic to set menu bar less often at startup [#14295](https://github.com/eclipse-theia/theia/pull/14295) - Contributed on behalf of STMicroelectronics +- [core] updated logic to start menu handler ids at one, not zero [#14282](https://github.com/eclipse-theia/theia/pull/14282) - Contributed on behalf of STMicroelectronics +- [core] upgraded express to 4.21.0 [#14283](https://github.com/eclipse-theia/theia/pull/14283) - Contributed on behalf of STMicroelectronics +- [filesystem] added logic to New File dialog to accept Enter for default [#14146](https://github.com/eclipse-theia/theia/pull/14146) +- [filesystem] updated logic to show error message when uploading fails [#14349](https://github.com/eclipse-theia/theia/pull/14349) +- [filesystem] updated rimraf to 5 [#14273](https://github.com/eclipse-theia/theia/pull/14273) +- [notebook] added Cell Tag Support for Notebooks [#14271](https://github.com/eclipse-theia/theia/pull/14271) +- [notebook] added notebook split cell command [#14212](https://github.com/eclipse-theia/theia/pull/14212) +- [notebook] fixed notebook editor focusing [#14229](https://github.com/eclipse-theia/theia/pull/14229) +- [notebook] fixed notebook editor staying current even when selecting sidebar or bottom panel [#14262](https://github.com/eclipse-theia/theia/pull/14262) +- [notebook] optimized notebook webview output [#14234](https://github.com/eclipse-theia/theia/pull/14234) +- [notebook] updated logic to blur cell on shift+enter, only update cell height when changed [#14277](https://github.com/eclipse-theia/theia/pull/14277) +- [notebook] updated logic to ensure notebook document event registration [#14242](https://github.com/eclipse-theia/theia/pull/14242) +- [notebook] updated logic to not disable cell edit mode when escaping code completion in notebooks [#14328](https://github.com/eclipse-theia/theia/pull/14328) +- [playwright] added Playwright API for Notebooks [#14098](https://github.com/eclipse-theia/theia/pull/14098) +- [plugin] added support for proposed signature for workspace.createFileSystemWatcher [#14303](https://github.com/eclipse-theia/theia/pull/14303) - Contributed on behalf of STMicroelectronics +- [plugin] fixed the onDidChangeActiveNotebookEditorEmitter to fire correctly [#14321](https://github.com/eclipse-theia/theia/pull/14321) +- [plugin] supported MappedEditProviders proposed API evolution [#14276](https://github.com/eclipse-theia/theia/pull/14276) - Contributed on behalf of STMicroelectronics +- [plugin] updated logic to accept a string argument in env.openExternal API [#14350](https://github.com/eclipse-theia/theia/pull/14350) - Contributed on behalf of STMicroelectronics +- [plugin] updated logic to properly dispose tab/title-based resources on tab close [#14359](https://github.com/eclipse-theia/theia/pull/14359) +- [plugin] wrapped api objects returned to clients in a proxy [#14213](https://github.com/eclipse-theia/theia/pull/14213) - Contributed on behalf of STMicroelectronics +- [preferences] improved preference renderer linking [#14311](https://github.com/eclipse-theia/theia/pull/14311) +- [workspace] optimized showing recent workspaces [#14260](https://github.com/eclipse-theia/theia/pull/14260) + +## 1.54.0 - 09/26/2024 + +- [ai] add Theia AI LLM Support [Experimental] [#14048](https://github.com/eclipse-theia/theia/pull/14048) +- [ai] adapted default LLM for Theia AI to gpt-4o [#14165](https://github.com/eclipse-theia/theia/pull/14165) +- [ai] add enable state of agent to preferences [#14206](https://github.com/eclipse-theia/theia/pull/14206) +- [ai] chore: polished AI code completion [#14192](https://github.com/eclipse-theia/theia/pull/14192) +- [ai] consistently named agents and added tags [#14182](https://github.com/eclipse-theia/theia/pull/14182) +- [ai] feat: added toolbar actions for chat nodes [#14181](https://github.com/eclipse-theia/theia/pull/14181) - Contributed on behalf of STMicroelectronics +- [ai] feat: show variables and functions on AI agent configuration [#14177](https://github.com/eclipse-theia/theia/pull/14177) +- [ai] feat: supported models served via OpenAI API [#14172](https://github.com/eclipse-theia/theia/pull/14172) +- [ai] fixed ai-settings retrieval [#14221](https://github.com/eclipse-theia/theia/pull/14221) +- [ai] fixed enablement of AI support [#14166](https://github.com/eclipse-theia/theia/pull/14166) +- [ai] improved prompt of workspace agent [#14159](https://github.com/eclipse-theia/theia/pull/14159) +- [ai] refined AI settings [#14202](https://github.com/eclipse-theia/theia/pull/14202) +- [ai] refined experimental message for AI features [#14187](https://github.com/eclipse-theia/theia/pull/14187) +- [ai] removed type duplication for kind property [#14207](https://github.com/eclipse-theia/theia/pull/14207) +- [ai] consistent prompt ids [#14162](https://github.com/eclipse-theia/theia/pull/14162) +- [ai] fix: disabled an agent also disabled its UIContribution [#14184](https://github.com/eclipse-theia/theia/pull/14184) +- [application-package] bumped API version to 1.93.1 [#14224](https://github.com/eclipse-theia/theia/pull/14224) - Contributed on behalf of STMicroelectronics +- [core] fixed selection of contributed menu action argument adapters [#14132](https://github.com/eclipse-theia/theia/pull/14132) - Contributed on behalf of STMicroelectronics +- [core] supported proxy env variable for schema catalog download [#14130](https://github.com/eclipse-theia/theia/pull/14130) +- [core] supported workbench.editorAssociations preference [#14139](https://github.com/eclipse-theia/theia/pull/14139) +- [editor] aligned active text and notebook editor more towards vscode [#14190](https://github.com/eclipse-theia/theia/pull/14190) +- [filesystem] fixed FileResource sometimes sending contents change event during writing [#14043](https://github.com/eclipse-theia/theia/pull/14043) - Contributed on behalf of Toro Cloud +- [notebook] focused notebook cell container correctly [#14175](https://github.com/eclipse-theia/theia/pull/14175) +- [notebook] fixed notebook context selection [#14179](https://github.com/eclipse-theia/theia/pull/14179) +- [notebook] made the cell editor border grey when not focused [#14195](https://github.com/eclipse-theia/theia/pull/14195) +- [plugin] removed stub tag from TerminalOptions#color [#14171](https://github.com/eclipse-theia/theia/pull/14171) +- [plugin] moved stubbed API TerminalShellIntegration into main API [#14168](https://github.com/eclipse-theia/theia/pull/14168) - Contributed on behalf of STMicroelectronics +- [plugin] supported evolution on proposed API extensionAny [#14199](https://github.com/eclipse-theia/theia/pull/14199) - Contributed on behalf of STMicroelectronics +- [plugin] updated TreeView reveal options to be readonly [#14198](https://github.com/eclipse-theia/theia/pull/14198) - Contributed on behalf of STMicroelectronics +- [plugin-ext] properly supported executeDocumentSymbolProvider command [#14173](https://github.com/eclipse-theia/theia/pull/14173) +- [plugin-ext] fixed leak in tabs-main.ts [#14186](https://github.com/eclipse-theia/theia/pull/14186) +- [preferences] expanded plugin preferences on scroll correctly [#14170](https://github.com/eclipse-theia/theia/pull/14170) +- [test] supported TestMessage stack traces [#14154](https://github.com/eclipse-theia/theia/pull/14154) - Contributed on behalf of STMicroelectronics +- [workspace] handled only the user workspace security settings [#14147](https://github.com/eclipse-theia/theia/pull/14147) + +[Breaking Changes:](#breaking_changes_1.54.0) + +- [ai] added toolbar actions on chat nodes [#14181](https://github.com/eclipse-theia/theia/pull/14181) - Contributed on behalf of STMicroelectronics +- [core] updated AuthenticationService to handle multiple accounts per provider [#14149](https://github.com/eclipse-theia/theia/pull/14149) - Contributed on behalf of STMicroelectronics + +## 1.53.0 - 08/29/2024 + +- [application-package] bumpped API version to 1.92.2 [#14076](https://github.com/eclipse-theia/theia/pull/14076) - Contributed on behalf of STMicroelectronics +- [collaboration] added support for collaboration feature [#13309](https://github.com/eclipse-theia/theia/pull/13309) +- [core] added `testing/profiles/context` menu contribution [#14028](https://github.com/eclipse-theia/theia/pull/14028) - Contributed on behalf of STMicroelectronics +- [core] added support for reverting a composite saveable [#14079](https://github.com/eclipse-theia/theia/pull/14079) +- [core] aligned available locales to VS Code [#14039](https://github.com/eclipse-theia/theia/pull/14039) +- [core] dropped support for Node 16.x [#14027](https://github.com/eclipse-theia/theia/pull/14027) - Contributed on behalf of STMicroelectronics +- [core] refactored undo-redo action for editors [#13963](https://github.com/eclipse-theia/theia/pull/13963) +- [core] updated logic to correctly revert saveable on widget close [#14062](https://github.com/eclipse-theia/theia/pull/14062) +- [core] updated logic to download json schema catalog at build-time [#14065](https://github.com/eclipse-theia/theia/pull/14065) - Contributed on behalf of STMicroelectronics +- [electron] updated electron to version 30.1.2 [#14041](https://github.com/eclipse-theia/theia/pull/14041) - Contributed on behalf of STMicroelectronics +- [monaco] updated logic to rely on `IConfigurationService` change event to update model options [#13994](https://github.com/eclipse-theia/theia/pull/13994) - Contributed on behalf of STMicroelectronics +- [notebook] added aliases for `list.focusUp` and `list.focusDown` for notebooks [#14042](https://github.com/eclipse-theia/theia/pull/14042) +- [notebook] added logic to support Alt+Enter in notebooks - run the current cell and insert a new below [#14022](https://github.com/eclipse-theia/theia/pull/14022) +- [notebook] added notebook selected cell status bar item and center selected cell command [#14046](https://github.com/eclipse-theia/theia/pull/14046) +- [notebook] added support to find widget in notebooks [#13982](https://github.com/eclipse-theia/theia/pull/13982) +- [notebook] enhanced notebook cell divider [#14081](https://github.com/eclipse-theia/theia/pull/14081) +- [notebook] fixed notebook output scrolling and text rendering [#14016](https://github.com/eclipse-theia/theia/pull/14016) +- [notebook] fixed vscode api notebook selection property [#14087](https://github.com/eclipse-theia/theia/pull/14087) +- [notebook] updated logic to make sure notebook model created when calling `openNotebookDocument` [#14029](https://github.com/eclipse-theia/theia/pull/14029) +- [notebook] updated logic to use correct cell type for selected language [#13983](https://github.com/eclipse-theia/theia/pull/13983) +- [playwright] fixed flaky playwright Theia Main Menu test [#13951](https://github.com/eclipse-theia/theia/pull/13951) - Contributed on behalf of STMicroelectronics +- [plugin] added `executeFoldingRangeProvider`, `executeCodeActionProvider`, and `executeWorkspaceSymbolProvider` command implementations [#14093](https://github.com/eclipse-theia/theia/pull/14093) +- [plugin] added support for `--headless-hosted-plugin-inspect` cmd argument [#13918](https://github.com/eclipse-theia/theia/pull/13918) +- [plugin] fixed issue when creating new untitled notebook doesn't work [#14031](https://github.com/eclipse-theia/theia/pull/14031) +- [plugin] implemented previously stubbed API `window.registerUriHandler()` [#13306](https://github.com/eclipse-theia/theia/pull/13306) - Contributed on behalf of STMicroelectronics +- [plugin] stubbed Terminal Shell Integration VS Code API [#14058](https://github.com/eclipse-theia/theia/pull/14058) +- [plugin] updated logic to allow opening changes for files associated with custom editors [#13916](https://github.com/eclipse-theia/theia/pull/13916) +- [plugin] upated code to not use `ChannelMultiplexer` in `RPCProtocol` [#13980](https://github.com/eclipse-theia/theia/pull/13980) - Contributed on behalf of STMicroelectronics +- [preferences] fixed preference tree for plugins [#14036](https://github.com/eclipse-theia/theia/pull/14036) +- [vsx-registry] fixed `429` errors on OVSX requests [#14030](https://github.com/eclipse-theia/theia/pull/14030) + +[Breaking Changes:](#breaking_changes_1.53.0) + +- [dependencies] Updated electron to version 30.1.2 - [#14041](https://github.com/eclipse-theia/theia/pull/14041) - Contributed on behalf of STMicroelectronics +- [dependencies] increased minimum node version to 18. [#14027](https://github.com/eclipse-theia/theia/pull/14027) - Contributed on behalf of STMicroelectronics + +## 1.52.0 - 07/25/2024 + +- [application-package] bumped the default supported API from `1.90.2` to `1.91.1` [#13955](https://github.com/eclipse-theia/theia/pull/13955) - Contributed on behalf of STMicroelectronics +- [cli] added logging to download:plugins script [#13905](https://github.com/eclipse-theia/theia/pull/13905) - Contributed on behalf of STMicroelectronics +- [core] bug fix: "core.saveAll" command only saved dirty widgets [#13942](https://github.com/eclipse-theia/theia/pull/13942) +- [core] downgrade jsdom to 22.1.0 [#13944](https://github.com/eclipse-theia/theia/pull/13944) +- [core] fixed reload for remote feature and added option to the electron window to change URL on reload [#13891](https://github.com/eclipse-theia/theia/pull/13891) +- [core] improved implementation around widget management [#13818](https://github.com/eclipse-theia/theia/pull/13818) +- [core] introduced `FRONTEND_CONNECTION_TIMEOUT` environment variable to override application connection settings [#13936](https://github.com/eclipse-theia/theia/pull/13936) - Contributed on behalf of STMicroelectronics +- [core] made sure UI loaded when minimized [#13887](https://github.com/eclipse-theia/theia/pull/13887) - Contributed on behalf of STMicroelectronics +- [core] prevented the rendering of the tab bar tooltip if no caption was provided [#13945](https://github.com/eclipse-theia/theia/pull/13945) +- [core] tab selected should be adjacent when closing the last one [#13912](https://github.com/eclipse-theia/theia/pull/13912) - Contributed on behalf of STMicroelectronics +- [core] upgraded ws to 8.18.0 [#13903](https://github.com/eclipse-theia/theia/pull/13903) +- [debug] added DebugSessionOptions.testRun [#13939](https://github.com/eclipse-theia/theia/pull/13939) - Contributed on behalf of STMicroelectronics +- [debug] implemented activeStackItem and related change event in debug namespace [#13900](https://github.com/eclipse-theia/theia/pull/13900) - Contributed on behalf of STMicroelectronics +- [filesystem] fixed FileResource not adding event listener to the disposable collection [#13880](https://github.com/eclipse-theia/theia/pull/13880) +- [notebook] changed cell type when selecting markdown as a code cell's language [#13933](https://github.com/eclipse-theia/theia/pull/13933) +- [notebook] made Notebook preferences registration substitutable [#13926](https://github.com/eclipse-theia/theia/pull/13926) +- [ovsx-client] fixed plugin version comparison [#13907](https://github.com/eclipse-theia/theia/pull/13907) +- [plugin-ext] codicon color and URI support to TerminalOptions [#13413](https://github.com/eclipse-theia/theia/pull/13413) +- [plugin-ext] used relative paths for ctx.importScripts() [#13854](https://github.com/eclipse-theia/theia/pull/13854) +- [preferences] refactored preference tree layouting [#13819](https://github.com/eclipse-theia/theia/pull/13819) +- [terminal] added support for 256 truecolor [#13853](https://github.com/eclipse-theia/theia/pull/13853) +- [workflows] updated Mac OS version to 14 in CI [#13908](https://github.com/eclipse-theia/theia/pull/13908) + +## 1.51.0 - 06/27/2024 + +- [application-manager] updated logic to load correct messaging module in browser-only mode [#13827](https://github.com/eclipse-theia/theia/pull/13827) +- [application-package] bumped the default supported API from `1.89.1` to `1.90.2` [#13849](https://github.com/eclipse-theia/theia/pull/13849) - Contributed on behalf of STMicroelectronics +- [core] added support for dynamic menu contributions [#13720](https://github.com/eclipse-theia/theia/pull/13720) +- [core] fixed account menu order, icon and badge [#13771](https://github.com/eclipse-theia/theia/pull/13771) +- [core] fixed overflow behavior of sidebars [#13483](https://github.com/eclipse-theia/theia/pull/13483) - Contributed on behalf of STMicroelectronics +- [core] improved shown keybindings in context menu [#13830](https://github.com/eclipse-theia/theia/pull/13830) +- [core] introduced optional serialize method in Saveable [#13833](https://github.com/eclipse-theia/theia/pull/13833) +- [core] updated doc comments on service-connection-provider.ts [#13805](https://github.com/eclipse-theia/theia/pull/13805) - Contributed on behalf of STMicroelectronics +- [core] updated logic of links to block local navigation and open new windows externally in electron [#13782](https://github.com/eclipse-theia/theia/pull/13782) - Contributed on behalf of STMicroelectronics +- [core] updated logic to propagate "Save As" operation to plugin host [#13689](https://github.com/eclipse-theia/theia/pull/13689) +- [core] updated logic to use 'openWithSystemApp' to open uri when 'env.openExternal' requested [#13676](https://github.com/eclipse-theia/theia/pull/13676) +- [electron] switched single instance on per default. [#13831](https://github.com/eclipse-theia/theia/pull/13831) - Contributed on behalf of STMicroelectronics +- [filesystem] improved Upload Command [#13775](https://github.com/eclipse-theia/theia/pull/13775) +- [markers] fixed data race in problem view tree [#13841](https://github.com/eclipse-theia/theia/pull/13841) +- [messages] updated logic to always resolve existing before showing new notification [#13668](https://github.com/eclipse-theia/theia/pull/13668) +- [monaco] fixed editors theme change and widget not attached error [#13757](https://github.com/eclipse-theia/theia/pull/13757) +- [notebook] added an indicator for loading notebooks [#13843](https://github.com/eclipse-theia/theia/pull/13843) +- [notebook] added notebook output options and tag preference search [#13773](https://github.com/eclipse-theia/theia/pull/13773) +- [notebook] disabled cell editor search widget [#13836](https://github.com/eclipse-theia/theia/pull/13836) +- [notebook] improved ability to overwrite notebook services [#13776](https://github.com/eclipse-theia/theia/pull/13776) +- [notebook] improved notebook cell drag images [#13791](https://github.com/eclipse-theia/theia/pull/13791) +- [notebook] improved support for creating new notebooks [#13696](https://github.com/eclipse-theia/theia/pull/13696) +- [notebook] updated logic to set notebook editor as active when opening in foreground [#13828](https://github.com/eclipse-theia/theia/pull/13828) +- [notebook] updated logic to stop moving to next cell when suggestion widget is visible [#13774](https://github.com/eclipse-theia/theia/pull/13774) +- [playwright] fixed type definition of TheiaAppFactory [#13799](https://github.com/eclipse-theia/theia/pull/13799) - Contributed on behalf of STMicroelectronics +- [plugin] added stub for `registerMappedEditProvider` [#13681](https://github.com/eclipse-theia/theia/pull/13681) - Contributed on behalf of STMicroelectronics +- [plugin] added support for PluginExt#extensionKind [#13763](https://github.com/eclipse-theia/theia/pull/13763) +- [plugin] added support for TestRunRequest preserveFocus API [#13839](https://github.com/eclipse-theia/theia/pull/13839) - Contributed on behalf of STMicroelectronics +- [plugin] fixed RPC proxy handler notifications and requests order [#13810](https://github.com/eclipse-theia/theia/pull/13810) +- [plugin] fixed programmatic save for custom text editors [#13684](https://github.com/eclipse-theia/theia/pull/13684) +- [plugin] fixed tab group API event order [#13812](https://github.com/eclipse-theia/theia/pull/13812) +- [plugin] stubbed Chat and Language Model API [#13778](https://github.com/eclipse-theia/theia/pull/13778) +- [plugin] stubbed activeStackItem and related change event in debug namespace [#13847](https://github.com/eclipse-theia/theia/pull/13847) - Contributed on behalf of STMicroelectronics +- [plugin] updated logic to avoid pollution of all toolbars by actions contributed by tree views in extensions [#13768](https://github.com/eclipse-theia/theia/pull/13768) - Contributed on behalf of STMicroelectronics +- [plugin] updated logic to return empty appRoot in web plugin host [#13762](https://github.com/eclipse-theia/theia/pull/13762) +- [scm] updated jsdiff and simplify diff computation [#13787](https://github.com/eclipse-theia/theia/pull/13787) - Contributed on behalf of STMicroelectronics +- [vsx-registry] updated logic to use targetPlatform when installing plugin from open-vsx [#13825](https://github.com/eclipse-theia/theia/pull/13825) + +[Breaking Changes:](#breaking_changes_1.51.0) + +- [electron] switched single instance on per default. [#13831](https://github.com/eclipse-theia/theia/pull/13831) - Contributed on behalf of STMicroelectronics +- [filesystem] adjusted the "Save As" mechanism to assume that `Saveable.getSnapshot()` returns a full snapshot of the editor model [#13689](https://github.com/eclipse-theia/theia/pull/13689). + +## 1.50.0 - 06/03/2024 + +- [application-package] bumped the default supported API from `1.88.1` to `1.89.1` [#13738](https://github.com/eclipse-theia/theia/pull/13738) - contributed on behalf of STMicroelectronics +- [cli] upgrade the Theia build to use Typescript 5.4.5 [#13628](https://github.com/eclipse-theia/theia/pull/13628) - Contributed on behalf of STMicroelectronics +- [core] added logic to delegate showing help to the back end process. [#13729](https://github.com/eclipse-theia/theia/pull/13729) - Contributed on behalf of STMicroelectronics +- [core] added logic to don't reveal the focused element when updating the tree rows [#13703](https://github.com/eclipse-theia/theia/pull/13703) - Contributed on behalf of STMicroelectronics +- [core] added logic to ensure globalSelection is correctly set when opening context menu on a tree widget [#13710](https://github.com/eclipse-theia/theia/pull/13710) +- [core] added to logic to ensure usage of user-defined `THEIA_CONFIG_DIR` [#13708](https://github.com/eclipse-theia/theia/pull/13708) - Contributed on behalf of STMicroelectronics +- [core] fixed hex editor by updating `msgpckr` to 1.10.2 [#13722](https://github.com/eclipse-theia/theia/pull/13722) +- [core] improved `WebSocketConnectionProvider` deprecation message [#13713](https://github.com/eclipse-theia/theia/pull/13713) - Contributed on behalf of STMicroelectronics +- [core] refactored auto save mechanism via a central service [#13683](https://github.com/eclipse-theia/theia/pull/13683) +- [core] updated logic to make browserWindow of splashScreen transparent [#13699](https://github.com/eclipse-theia/theia/pull/13699) +- [dev-container] added support for four previously unsupported dev container properties [#13714](https://github.com/eclipse-theia/theia/pull/13714) +- [dev-container] improved logic to show dev-container label in status bar [#13744](https://github.com/eclipse-theia/theia/pull/13744) +- [electron] updated electron to ^28.2.8 [#13580](https://github.com/eclipse-theia/theia/pull/13580) +- [navigator] added logic to handle `isFileSystemResource` context key [#13664](https://github.com/eclipse-theia/theia/pull/13664) +- [navigator] added logic to not show the new "Open With..." command on folders [#13678](https://github.com/eclipse-theia/theia/pull/13678) +- [notebook] added additional css to notebook output webviews [#13666](https://github.com/eclipse-theia/theia/pull/13666) +- [notebook] added basics for notebook cell drag image renderers [#13698](https://github.com/eclipse-theia/theia/pull/13698) +- [notebook] added logic to select next notebook cell on first or last line of editor [#13656](https://github.com/eclipse-theia/theia/pull/13656) +- [notebook] added logic to select the last cell when deleting selected last cell [#13715](https://github.com/eclipse-theia/theia/pull/13715) +- [notebook] added logic to stop execution when deleting cell [#13701](https://github.com/eclipse-theia/theia/pull/13701) +- [notebook] added responsive design for the main notebook toolbar [#13663](https://github.com/eclipse-theia/theia/pull/13663) +- [notebook] aligned commands with vscode notebook commands [#13645](https://github.com/eclipse-theia/theia/pull/13645) +- [notebook] aligned notebook scroll into view behaviour with vscode [#13742](https://github.com/eclipse-theia/theia/pull/13742) +- [notebook] fixed focus loss of the notebook editor widget when bluring a cell editor [#13741](https://github.com/eclipse-theia/theia/pull/13741) +- [notebook] fixed notebook cell divider size [#13745](https://github.com/eclipse-theia/theia/pull/13745) +- [notebook] fixed storing of the notebook-outlineview state data [#13648](https://github.com/eclipse-theia/theia/pull/13648) +- [notebook] improved notebook cell model lifecycle [#13675](https://github.com/eclipse-theia/theia/pull/13675) +- [notebook] improved support for creating new notebooks [#13696](https://github.com/eclipse-theia/theia/pull/13696) +- [plugin] added stub for `registerMappedEditProvider` [#13681](https://github.com/eclipse-theia/theia/pull/13681) - Contributed on behalf of STMicroelectronics +- [plugin] added support `WindowState` active API [#13718](https://github.com/eclipse-theia/theia/pull/13718) - contributed on behalf of STMicroelectronics +- [plugin] fixed github authentication built-in for electron case [#13611](https://github.com/eclipse-theia/theia/pull/13611) - Contributed on behalof of STMicroelectronics +- [plugin] fixed incorrect URI conversions in custom-editors-main [#13653](https://github.com/eclipse-theia/theia/pull/13653) +- [plugin] fixed quick pick separators from plugins [#13740](https://github.com/eclipse-theia/theia/pull/13740) +- [plugin] improved vscode tab API [#13730](https://github.com/eclipse-theia/theia/pull/13730) +- [plugin] updated `DropMetada` and `documentPaste` proposed API for 1.89 compatibility [#13733](https://github.com/eclipse-theia/theia/pull/13733) - contributed on behalf of STMicroelectronics +- [plugin] updated nls metadata for VSCode API 1.89.0 [#13743](https://github.com/eclipse-theia/theia/pull/13743) +- [remote] added logic to support plugin copying for remote feature [#13369](https://github.com/eclipse-theia/theia/pull/13369) +- [terminal] fixed performance issues in terminal [#13735](https://github.com/eclipse-theia/theia/pull/13735) - Contributed on behalf of STMicroelectronics +- [terminal] updated logic to allow transitive binding for TerminalFrontendContribution [#13667](https://github.com/eclipse-theia/theia/pull/13667) + +[Breaking Changes:](#breaking_changes_1.50.0) + +- [core] Classes implementing the `Saveable` interface no longer need to implement the `autoSave` field. However, a new `onContentChanged` event has been added instead. +- [navigator] The `Open With...` command now uses a dedicated `OpenWithHandler` to populate the quick pick. + Adopters contributing an open handler need to explicitly add the handler to the `OpenWithHandler` ([#13573](https://github.com/eclipse-theia/theia/pull/13573)). + +## v1.49.0 - 04/29/2024 + +- [application-manager] added logic to generate Extension Info in server application to avoid empty About Dialog [#13590](https://github.com/eclipse-theia/theia/pull/13590) - contributed on behalf of STMicroelectronics +- [application-manager] fixed spawn calls for node LTS versions [#13614](https://github.com/eclipse-theia/theia/pull/13614) +- [application-package] bumped the default supported API from `1.87.2` to `1.88.1` [#13646](https://github.com/eclipse-theia/theia/pull/13646) - contributed on behalf of STMicroelectronics +- [cli] added "patches" folder to package.json "files" field [#13554](https://github.com/eclipse-theia/theia/pull/13554) - contributed on behalf of STMicroelectronics +- [core] added a new built-in handler to open files with system application [#13601](https://github.com/eclipse-theia/theia/pull/13601) +- [core] added logic to always consider the "passthrough" commmand enabled for keybindings [#13564](https://github.com/eclipse-theia/theia/pull/13564) - contributed on behalf of STMicroelectronics +- [core] added Splash Screen Support for Electron [#13505](https://github.com/eclipse-theia/theia/pull/13505) - contributed on behalf of Pragmatiqu IT GmbH +- [core] fixed window revealing when navigating with multiple windows [#13561](https://github.com/eclipse-theia/theia/pull/13561) - contributed on behalf of STMicroelectronics +- [core] improved "Open With..." command UX [#13573](https://github.com/eclipse-theia/theia/pull/13573) +- [filesystem] added logic to open editor on file upload [#13578](https://github.com/eclipse-theia/theia/pull/13578) +- [monaco] added logic to prevent duplicate Clipboard actions in editor context menu [#13626](https://github.com/eclipse-theia/theia/pull/13626) +- [monaco] fixed monaco localization [#13557](https://github.com/eclipse-theia/theia/pull/13557) +- [notebook] added additional keybings to the notebook editor [#13594](https://github.com/eclipse-theia/theia/pull/13594) +- [notebook] added logic to force notebook scrollbar update after content change [#13575](https://github.com/eclipse-theia/theia/pull/13575) +- [notebook] added logic to read execution summary [#13567](https://github.com/eclipse-theia/theia/pull/13567) +- [notebook] added logic to select notebook cell language [#13615](https://github.com/eclipse-theia/theia/pull/13615) +- [notebook] added logic to show short title for notebook toolbar commands [#13586](https://github.com/eclipse-theia/theia/pull/13586) +- [notebook] added logic to use notebook URI as context for toolbar commands [#13585](https://github.com/eclipse-theia/theia/pull/13585) +- [notebook] added shift+enter keybinding for markdown cells [#13563](https://github.com/eclipse-theia/theia/pull/13563) +- [notebook] added support for Outline-View and Breadcrumbs [#13562](https://github.com/eclipse-theia/theia/pull/13562) +- [notebook] added support for truncated notebook output commands [#13555](https://github.com/eclipse-theia/theia/pull/13555) +- [notebook] disabled clear all outputs in notebook main toolbar [#13569](https://github.com/eclipse-theia/theia/pull/13569) +- [notebook] fixed clear cell outputs command [#13640](https://github.com/eclipse-theia/theia/pull/13640) +- [notebook] fixed kernel autobind for on startup opened notebooks [#13598](https://github.com/eclipse-theia/theia/pull/13598) +- [notebook] fixed logic to set context for multiple notebooks [#13566](https://github.com/eclipse-theia/theia/pull/13566) +- [notebook] fixed notebook cell EOL splitting [#13574](https://github.com/eclipse-theia/theia/pull/13574) +- [notebook] fixed notebook model/cell disposal [#13606](https://github.com/eclipse-theia/theia/pull/13606) +- [notebook] fixed notebook widget icon on reload [#13612](https://github.com/eclipse-theia/theia/pull/13612) +- [notebook] improved notebook cell context key handling [#13572](https://github.com/eclipse-theia/theia/pull/13572) +- [notebook] improved notebook markdown cell rendering [#13577](https://github.com/eclipse-theia/theia/pull/13577) +- [plugin] added logic to hide empty plugin view containers from user [#13581](https://github.com/eclipse-theia/theia/pull/13581) +- [plugin] added logic to ignore vsix files in local-plugins dir [#13435](https://github.com/eclipse-theia/theia/pull/13435) - contributed on behalf of STMicroelectronics +- [plugin] fixed `onLanguage` activation event [#13630](https://github.com/eclipse-theia/theia/pull/13630) +- [plugin] fixed issue with webview communication for Safari [#13587](https://github.com/eclipse-theia/theia/pull/13587) +- [plugin] updated `DropMetada` and `documentPaste` proposed API for 1.88 compatibility [#13632](https://github.com/eclipse-theia/theia/pull/13632) +- [plugin] updated back-end plugin deployment logic [#13643](https://github.com/eclipse-theia/theia/pull/13643) - contributed on behalf of STMicroelectronics +- [process] fixed spawn calls for node LTS versions [#13614](https://github.com/eclipse-theia/theia/pull/13614) +- [remote] fixed remote support in packaged apps [#13584](https://github.com/eclipse-theia/theia/pull/13584) +- [scm] added support for dirty diff peek view [#13104](https://github.com/eclipse-theia/theia/pull/13104) +- [terminal] fixed spawn calls for node LTS versions [#13614](https://github.com/eclipse-theia/theia/pull/13614) +- [test] stubbed VS Code `Test Coverage` API [#13631](https://github.com/eclipse-theia/theia/pull/13631) - contributed on behalf of STMicroelectronics +- [vsx-registry] fixed logic to bind Extension search bar within view container [#13623](https://github.com/eclipse-theia/theia/pull/13623) + +[Breaking Changes:](#breaking_changes_1.49.0) + +- [scm] revised some of the dirty diff related types [#13104](https://github.com/eclipse-theia/theia/pull/13104) + - replaced `DirtyDiff.added/removed/modified` with `changes`, which provides more detailed information about the changes + - changed the semantics of `LineRange` to represent a range that spans up to but not including the `end` line (previously, it included the `end` line) + - changed the signature of `DirtyDiffDecorator.toDeltaDecoration(LineRange | number, EditorDecorationOptions)` to `toDeltaDecoration(Change)` + +## v1.48.0 - 03/28/2024 + +- [application-package] bumped the default supported API from `1.86.2` to `1.87.2` [#13514](https://github.com/eclipse-theia/theia/pull/13514) - contributed on behalf of STMicroelectronics +- [core] added "New File" default implementation [#13344](https://github.com/eclipse-theia/theia/pull/13344) +- [core] added logic to check for disposed before sending update message in toolbars [#13454](https://github.com/eclipse-theia/theia/pull/13454) - contributed on behalf of STMicroelectronics +- [core] fixed default translation of Close Editor command [#13412](https://github.com/eclipse-theia/theia/pull/13412) +- [core] fixed logic to allow reopening secondary windows [#13509](https://github.com/eclipse-theia/theia/pull/13509) - contributed on behalf of STMicroelectronics +- [core] fixed rending of quickpick buttons [#13342](https://github.com/eclipse-theia/theia/pull/13342) - contributed on behalf of STMicroelectronics +- [core] updated logic to remove unneeded URI conversion [#13415](https://github.com/eclipse-theia/theia/pull/13415) +- [dev-container] added first version of dev-container support [#13372](https://github.com/eclipse-theia/theia/pull/13372) +- [editor] added secondary window support for text editors [#13493](https://github.com/eclipse-theia/theia/pull/13493) - contributed on behalf of STMicroelectronics +- [git] fixed detecting changes after git init [#13487](https://github.com/eclipse-theia/theia/pull/13487) +- [metrics] allowed accessing the metrics endpoint for performance analysis in electron [#13380](https://github.com/eclipse-theia/theia/pull/13380) - contributed on behalf of STMicroelectronics +- [monaco] fixed monaco quickpick [#13451](https://github.com/eclipse-theia/theia/pull/13451) - contributed on behalf of STMicroelectronics +- [monaco] fixed rending of quickpick buttons [#13342](https://github.com/eclipse-theia/theia/pull/13342) - contributed on behalf of STMicroelectronics +- [notebook] added execute cells above/below commands [#13528](https://github.com/eclipse-theia/theia/pull/13528) +- [notebook] added execution order display to code cells [#13502](https://github.com/eclipse-theia/theia/pull/13502) +- [notebook] added keybindings to notebook editor [#13497](https://github.com/eclipse-theia/theia/pull/13497) +- [notebook] added support for custom widget types for notebook outputs [#13517](https://github.com/eclipse-theia/theia/pull/13517) +- [notebook] fixed cell execution height styling [#13515](https://github.com/eclipse-theia/theia/pull/13515) +- [notebook] fixed context keys for notebook editor context [#13448](https://github.com/eclipse-theia/theia/pull/13448) +- [notebook] fixed keybindings triggers when cell editor is focused [#13500](https://github.com/eclipse-theia/theia/pull/13500) +- [notebook] fixed notebook document metadata edit [#13528](https://github.com/eclipse-theia/theia/pull/13528) +- [notebook] fixed renaming and moving of open notebooks [#13467](https://github.com/eclipse-theia/theia/pull/13467) +- [notebook] fixed undo redo keybindings for notebook editor [#13518](https://github.com/eclipse-theia/theia/pull/13518) +- [notebook] improved focusing of the notebook cell editors [#13516](https://github.com/eclipse-theia/theia/pull/13516) +- [notebook] improved performance when opening notebooks [#13488](https://github.com/eclipse-theia/theia/pull/13488) +- [notebook] updated logic to only initialize notebook cell editor when in viewport [#13476](https://github.com/eclipse-theia/theia/pull/13476) +- [plugin] added `Interval` `TextEditorLineNumbersStyle` [#13458](https://github.com/eclipse-theia/theia/pull/13458) - contributed on behalf of STMicroelectronics +- [plugin] added terminal observer API [#13402](https://github.com/eclipse-theia/theia/pull/13402) +- [plugin] changed logic to ensure that showOpenDialog returns correct file URI [#13208](https://github.com/eclipse-theia/theia/pull/13208) - contributed on behalf of STMicroelectronics +- [plugin] fixed quickpick [#13451](https://github.com/eclipse-theia/theia/pull/13451) - contributed on behalf of STMicroelectronics +- [plugin] made `acquireVsCodeApi` function available on global objects [#13411](https://github.com/eclipse-theia/theia/pull/13411) +- [plugin] updated logic to avoid disposal of `QuickInputExt` on hide [#13485](https://github.com/eclipse-theia/theia/pull/13485) - contributed on behalf of STMicroelectronics +- [remote] added logic to support remote port forwarding [#13439](https://github.com/eclipse-theia/theia/pull/13439) +- [terminal] added logic to resolve links to workspace files in terminal [#13498](https://github.com/eclipse-theia/theia/pull/13498) - contributed on behalf of STMicroelectronics +- [terminal] added terminal observer API [#13402](https://github.com/eclipse-theia/theia/pull/13402) + +[Breaking Changes:](#breaking_changes_1.48.0) + +- [core] Add secondary windows support for text editors. [#13493](https://github.com/eclipse-theia/theia/pull/13493 ). The changes in require more extensive patches for our dependencies than before. For this purpose, we are using the `patch-package` library. However, this change requires adopters to add the line `"postinstall": "theia-patch"` to the `package.json` at the root of their monorepo (where the `node_modules` folder is located). - contributed on behalf of STMicroelectronics + +## v1.47.0 - 02/29/2024 + +- [application-package] bumped the default supported API from `1.85.1` to `1.86.2` [#13429](https://github.com/eclipse-theia/theia/pull/13429) - contributed on behalf of STMicroelectronics +- [core] added logic to show decorations in the editor tabs [#13371](https://github.com/eclipse-theia/theia/pull/13371) +- [core] added ts-docs for several key utility classes [#13324](https://github.com/eclipse-theia/theia/pull/13324) +- [core] fixed core localizations for electron [#13331](https://github.com/eclipse-theia/theia/pull/13331) +- [core] fixed memory leak in `DockPanelRenderer` and `ToolbarAwareTabBar` [#13327](https://github.com/eclipse-theia/theia/pull/13327) +- [core] fixed update of CompositeMenuNode properties [#13425](https://github.com/eclipse-theia/theia/pull/13425) +- [core] improved title rendering on menu bar change [#13317](https://github.com/eclipse-theia/theia/pull/13317) +- [core] updated code to use common uuid generator everywhere [#13255](https://github.com/eclipse-theia/theia/pull/13255) +- [core] updated logic to use `tslib` in order to reduce bundle size [#13350](https://github.com/eclipse-theia/theia/pull/13350) +- [core] upgraded msgpackr to 1.10.1 [#13365](https://github.com/eclipse-theia/theia/pull/13365) - contributed on behalf of STMicroelectronics +- [debug] fixed issue with unexpected breakpoint in python [#12543](https://github.com/eclipse-theia/theia/pull/12543) +- [documentation] extended custom plugin API documentation [#13358](https://github.com/eclipse-theia/theia/pull/13358) +- [editor] improved readonly editor behaviour [#13403](https://github.com/eclipse-theia/theia/pull/13403) +- [filesystem] fixed issue with non recursive folder deletion [#13361](https://github.com/eclipse-theia/theia/pull/13361) +- [filesystem] implemented readonly markdown message for file system providers [#13414](https://github.com/eclipse-theia/theia/pull/13414) - contributed on behalf of STMicroelectronics +- [monaco] upgraded Monaco to 1.83.1 [#13217](https://github.com/eclipse-theia/theia/pull/13217) +- [notebook] added support for proposed notebook kernel messaging and preload contribution point [#13401](https://github.com/eclipse-theia/theia/pull/13401) +- [notebook] fixed notebook renderer messaging [#13401](https://github.com/eclipse-theia/theia/pull/13401) +- [notebook] fixed race condition in notebook kernel association [#13364](https://github.com/eclipse-theia/theia/pull/13364) +- [notebook] improved logic to update notebook execution timer [#13366](https://github.com/eclipse-theia/theia/pull/13366) +- [notebook] improved notebook scrolling behaviour [#13338](https://github.com/eclipse-theia/theia/pull/13338) +- [notebook] improved styling for notebook toolbar items [#13334](https://github.com/eclipse-theia/theia/pull/13334) +- [notebook] fixed scroll behaviour of Notebooks [#13430](https://github.com/eclipse-theia/theia/pull/13430) +- [plugin] added command to install plugins from the command line [#13406](https://github.com/eclipse-theia/theia/issues/13406) - contributed on behalf of STMicroelectronics +- [plugin] added logic to support `workspace.save(URI)` and `workspace.saveAs(URI)` [#13393](https://github.com/eclipse-theia/theia/pull/13393) - contributed on behalf of STMicroelectronics +- [plugin] added support for `extension/context`, `terminal/context`, and `terminal/title/context` menu contribution points [#13226](https://github.com/eclipse-theia/theia/pull/13226) +- [plugin] fixed custom editors asset loading [#13382](https://github.com/eclipse-theia/theia/pull/13382) +- [plugin] fixed logic to use correct path for hosted plugin deployer handler [#13427](https://github.com/eclipse-theia/theia/pull/13427) - contributed on behalf of STMicroelectronics +- [plugin] fixed regressions from headless plugins introduction [#13337](https://github.com/eclipse-theia/theia/pull/13337) - contributed on behalf of STMicroelectronics +- [plugin] support TestRunProfile onDidChangeDefault introduced in VS Code 1.86.0 [#13388](https://github.com/eclipse-theia/theia/pull/13388) - contributed on behalf of STMicroelectronics +- [plugin] updated `WorkspaceEdit` metadata typing [#13395](https://github.com/eclipse-theia/theia/pull/13395) - contributed on behalf of STMicroelectronics +- [search-in-workspace] added logic to focus on next and previous search results [#12703](https://github.com/eclipse-theia/theia/pull/12703) +- [task] fixed logic to configure tasks [#13367](https://github.com/eclipse-theia/theia/pull/13367) - contributed on behalf of STMicroelectronics +- [terminal] updated to latest xterm version [#12691](https://github.com/eclipse-theia/theia/pull/12691) +- [vsx-registry] added `--install-plugin` cli command [#13421](https://github.com/eclipse-theia/theia/pull/13421) - contributed on behalf of STMicroelectronics +- [vsx-registry] added possibility to install vsix files from the explorer view [#13291](https://github.com/eclipse-theia/theia/pull/13291) + +[Breaking Changes:](#breaking_changes_1.47.0) + +- [monaco] Upgrade Monaco dependency to 1.83.1 [#13217](https://github.com/eclipse-theia/theia/pull/13217)- contributed on behalf of STMicroelectronics\ + There are a couple of breaking changes that come with this monaco update + - Moved `ThemaIcon` and `ThemeColor` to the common folder + - Minor typing adjustments in QuickPickService: in parti + - FileUploadService: moved id field from data transfer item to the corresponding file info + - The way we instantiate monaco services has changed completely: if you touch monaco services in your code, please read the description in the + file comment in `monaco-init.ts`. + +## v1.46.0 - 01/25/2024 + +- [plugin] Add prefix to contributed view container ids [#13362](https://github.com/eclipse-theia/theia/pull/13362) - contributed on behalf of STMicroelectronics +- [application-manager] updated message for missing Electron main entries [#13242](https://github.com/eclipse-theia/theia/pull/13242) +- [application-package] bumped the default supported API from `1.84.2` to `1.85.1` [#13276](https://github.com/eclipse-theia/theia/pull/13276) - contributed on behalf of STMicroelectronics +- [browser-only] added support for 'browser-only' Theia [#12853](https://github.com/eclipse-theia/theia/pull/12853) +- [builtins] update built-ins to version 1.83.1 [#13298](https://github.com/eclipse-theia/theia/pull/13298) - contributed on behalf of STMicroelectronics +- [core] added keybindings to toggle the tree checkbox [#13271](https://github.com/eclipse-theia/theia/pull/13271) +- [core] added logic to dispose cancellation event listeners [#13254](https://github.com/eclipse-theia/theia/pull/13254) +- [core] added preference 'workbench.tree.indent' to control the indentation in the tree widget [#13179](https://github.com/eclipse-theia/theia/pull/13179) - contributed on behalf of STMicroelectronics +- [core] fixed copy/paste from a menu in electron [#13220](https://github.com/eclipse-theia/theia/pull/13220) - contributed on behalf of STMicroelectronics +- [core] fixed file explorer progress bar issue [#13268](https://github.com/eclipse-theia/theia/pull/13268) +- [core] fixed issue with cyclic menu contributions [#13264](https://github.com/eclipse-theia/theia/pull/13264) +- [core] fixed leak when reconnecting to back end without reload [#13250](https://github.com/eclipse-theia/theia/pull/13250) - contributed on behalf of STMicroelectronics +- [core] fixed SelectComponent to render dropdown correctly in dialog [#13261](https://github.com/eclipse-theia/theia/pull/13261) +- [core] removed error logs from RpcProxyFactory [#13191](https://github.com/eclipse-theia/theia/pull/13191) +- [documentation] improved documentation about 'ContributionProvider' use [#13278](https://github.com/eclipse-theia/theia/pull/13278) +- [docuemtnation] improved documentation on passing objects across RPC [#13238](https://github.com/eclipse-theia/theia/pull/13238) +- [documentation] updated plugin API docs for headless plugins and Inversify DI [#13299](https://github.com/eclipse-theia/theia/pull/13299) +- [filesystem] updated logic to only read unbuffered when we read the whole file [#13197](https://github.com/eclipse-theia/theia/pull/13197) +- [headless-plugin] added support for "headless plugins" in a new plugin host [#13138](https://github.com/eclipse-theia/theia/pull/13138) +- [monaco] updated logic to add document URI as context to getDefaultFormatter [#13280](https://github.com/eclipse-theia/theia/pull/13280) - contributed on behalf of STMicroelectronics +- [notebook] fixed dynamic notebook widgets resizing [#13289](https://github.com/eclipse-theia/theia/pull/13289) +- [notebook] fixed multiple problems with the notebook output rendering [#13239](https://github.com/eclipse-theia/theia/pull/13239) +- [notebook] improved notebook error logging [#13256](https://github.com/eclipse-theia/theia/pull/13256) +- [plugin] added logic to synchronize messages sent via different proxies [#13180](https://github.com/eclipse-theia/theia/pull/13180) +- [remote] added support for specifying the port of a remote SSH connection [#13296](https://github.com/eclipse-theia/theia/pull/13296) - contributed on behalf of STMicroelectronics +- [plugin] fixed inputbox onTriggerButton() event [#13207](https://github.com/eclipse-theia/theia/pull/13207) - contributed on behalf of STMicroelectronics +- [plugin] fixed localization for the removeSession method [#13257](https://github.com/eclipse-theia/theia/pull/13257) +- [plugin] fixed `vscode.env.appRoot` path [#13285](https://github.com/eclipse-theia/theia/pull/13285) +- [plugin] stubbed multiDocumentHighlightProvider proposed API [#13248](https://github.com/eclipse-theia/theia/pull/13248) - contributed on behalf of STMicroelectronics +- [plugin] updated logic to handle activeCustomEditorId [#13267](https://github.com/eclipse-theia/theia/pull/13267) +- [plugin] updated logic to pass context to webview context menu action [#13228](https://github.com/eclipse-theia/theia/pull/13228) +- [plugin] updated logic to use more stable hostname for webviews [#13092](https://github.com/eclipse-theia/theia/pull/13225) [#13258](https://github.com/eclipse-theia/theia/pull/13265) +- [terminal] fixed wording in error message [#13245](https://github.com/eclipse-theia/theia/pull/13245) - contributed on behalf of STMicroelectronics +- [terminal] renamed terminal.sendText() parameter from addNewLine to shouldExecute [#13236](https://github.com/eclipse-theia/theia/pull/13236) - contributed on behalf of STMicroelectronics +- [terminal] updated logic to resize terminal [#13281](https://github.com/eclipse-theia/theia/pull/13281) +- [terminal] updated terminalQuickFixProvider proposed API according to vscode 1.85 version [#13240](https://github.com/eclipse-theia/theia/pull/13240) - contributed on behalf of STMicroelectronics +- [vsx-registry] implemented verified extension filtering [#12995](https://github.com/eclipse-theia/theia/pull/12995) + +[Breaking Changes:](#breaking_changes_1.46.0) + +- [core] moved `FileUri` from `node` package to `common` [#12853](https://github.com/eclipse-theia/theia/pull/12853) +- [plugin] introduced new common interfaces/classes for reuse by different plugin hosts [#13138](https://github.com/eclipse-theia/theia/pull/13138) diff --git a/doc/code-organization.md b/doc/code-organization.md new file mode 100644 index 0000000..34d76f0 --- /dev/null +++ b/doc/code-organization.md @@ -0,0 +1,17 @@ +# Code Organization + +The code is fully implemented in [TypeScript](https://github.com/microsoft/typescript). Within the top level folders, which organize code by functional package, we separate between the following platforms: + +- `common/*`: Source code that only requires basic JavaScript APIs and runs in all target environments. +- `browser/*`: Source code that requires the `browser` APIs like access to the DOM. + - May use code from: `common`. +- `browser-only/*`: Source code that requires the `browser` APIs like access to the DOM and does not rely on a Node backend. + - May use code from: `common`. +- `node/*`: Source code that requires [`nodejs`](https://nodejs.org) APIs. + - May use code from: `common`. +- `electron-node/*`: Electron specific source code that requires [`nodejs`](https://nodejs.org) APIs. + - May use code from: `common`, `node`. +- `electron-browser/*`: Source code that requires the [Electron renderer process](https://github.com/atom/electron/tree/master/docs#modules-for-the-renderer-process-web-page) APIs. + - May use code from: `common`, `browser`. +- `electron-main/*`: Source code that requires the [Electron main process](https://github.com/atom/electron/tree/master/docs#modules-for-the-main-process) APIs. + - May use code from: `electron-node`, `common`, `node`. diff --git a/doc/coding-guidelines.md b/doc/coding-guidelines.md new file mode 100644 index 0000000..ceafc4a --- /dev/null +++ b/doc/coding-guidelines.md @@ -0,0 +1,590 @@ +# Coding Guidelines + +## Indentation + +Use 4 spaces per indentation level. + +## Imports + +Use `organize imports` to sort imports, and make sure the imports work properly (e.g. imports from `/src/` rather than `/lib/` for *.ts files may break builds). + +## Names + + + +* [1.](#pascalcase-type) Use PascalCase for `type` names. + +* [2.](#pascalcase-enum) Use PascalCase for `enum` values. + +* [3.](#camelcase-fn) Use camelCase for `function` and `method` names. + +* [4.](#camelcase-var) Use camelCase for `property` names and `local variables`. + +* [5.](#whole-words-names) Use whole words in names when possible. + + +```ts +// bad +const termWdgId = 1; + +// good +const terminalWidgetId = 1; +``` + +* [6.](#lower-case-names) Use lower-case, dash-separated file names (e.g. `document-provider.ts`). + +* [7.](#file-name) Name files after the main type it exports. + +> Why? It should be easy to find a type by a file name. + + +* [7.1](#one-large-class-per-file) Avoid one file with many large classes; put each class in its own file. + +> Why? It should be easy to find a class by a file name. + + +* [8.](#unique-names) Give unique names to types and files. Use specific names to achieve it. + +> Why? In order to avoid duplicate records in file and type search. + +```ts +// bad +export interface TitleButton {} + +// good +export interface QuickInputTitleButton {} +``` + + + +* [9.](#no_underscore_private) Do not use "_" as a prefix for private properties. Exceptions: + + * [9.1](#underscore_accessors) Exposing a property through get/set and using underscore for the internal field. + + * [9.2](#underscore_json) Attaching internal data to user-visible JSON objects. + +* [10.](#event_names) Names of events follow the `on[Will|Did]VerbNoun?` pattern. The name signals if the event is going to happen (onWill) or already happened (onDid), what happened (verb), and the context (noun) unless obvious from the context. + +* [11.](#unique-context-keys) Give unique names to keybinding contexts and keys to avoid collisions at runtime. Use specific names to achieve it. + +```ts +// bad +export namespace TerminalSearchKeybindingContext { + export const disableSearch = 'hideSearch'; +} + +// good +export namespace TerminalSearchKeybindingContext { + export const disableSearch = 'terminalHideSearch'; +} + +// bad +const terminalFocusKey = this.contextKeyService.createKey('focus', false); + +// good +const terminalFocusKey = this.contextKeyService.createKey('terminalFocus', false); +``` + +## Types + + + +* [1.](#no-expose-types) Do not export `types` or `functions` unless you need to share it across multiple components, [see as well](#di-function-export). + +* [2.](#no-global-types) Do not introduce new `types` or `values` to the global namespace. + +* [3.](#explicit-return-type) Always declare a return type in order to avoid accidental breaking changes because of changes to a method body. + +## Interfaces/Symbols + + + +* [1.](#interfaces-no-i-prefix) Do not use `I` prefix for interfaces. Use `Impl` suffix for implementation of interfaces with the same name. See [624](https://github.com/theia-ide/theia/issues/624) for the discussion on this. + +* [2.](#classes-over-interfaces) Use classes instead of interfaces + symbols when possible to avoid boilerplate. + +```ts +// bad +export const TaskDefinitionRegistry = Symbol('TaskDefinitionRegistry'); +export interface TaskDefinitionRegistry { + register(definition: TaskDefinition): void; +} +export class TaskDefinitionRegistryImpl implements TaskDefinitionRegistry { + register(definition: TaskDefinition): void { + } +} +bind(TaskDefinitionRegistryImpl).toSelf().inSingletonScope(); +bind(TaskDefinitionRegistry).toService(TaskDefinitionRegistryImpl); + +// good +export class TaskDefinitionRegistry { + register(definition: TaskDefinition): void { + } +} +bind(TaskDefinitionRegistry).toSelf().inSingletonScope(); +``` + +**Exceptions** + + +* [2.1](#remote-interfaces) Remote services should be declared as an interface + a symbol in order to be used in the frontend and backend. + +## Comments + +* Use JSDoc style comments for `functions`, `interfaces`, `enums`, and `classes` + +## Strings + +* Use 'single quotes' for all strings that aren't [template literals](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals) + +## null and undefined + +Use `undefined`; do not use `null`. + +## Internationalization/Localization + + + +* [1.](#nls-localize) Always localize user-facing text with the `nls.localize(key, defaultValue, ...args)` function. + +> What is user-facing text? Any strings that are hard-coded (not calculated) that could be in any way visible to the user, be it labels for commands and menus, messages/notifications/dialogs, quick-input placeholders or preferences. + + + +* [1.1.](#nls-localize-args) Parameters for messages should be passed as the `args` of the `localize` function. They are inserted at the location of the placeholders - in the form of `{\d+}` - in the localized text. E.g. `{0}` will be replaced with the first `arg`, `{1}` with the second, etc. + +```ts +// bad +nls.localize('hello', `Hello there ${name}.`); + +// good +nls.localize('hello', 'Hello there {0}.', name); +``` + + + +* [1.2.](#nls-localize-by-default) The `nls.localizeByDefault` function automatically finds the translation key for VS Code's language packs just by using the default value as its argument and translates it into the currently used locale. If the `nls.localizeByDefault` function is not able to find a key for the supplied default value, a warning will be shown in the browser console. If there is no appropriate translation in VSCode, just use the `nls.localize` function with a new key using the syntax `theia//`. + +```ts +// bad +nls.localize('vscode/dialogService/close', 'Close'); + +// good +nls.localizeByDefault('Close'); +``` + + + +* [2.](#nls-utilities) Use utility functions where possible: + + * `Command.toLocalizedCommand` should be used when the label requires a custom localization key (using `nls.localize` internally). + * `Command.toDefaultLocalizedCommand` should be used when the label and category already exist in VS Code's language packs (using `nls.localizeByDefault` internally). + +```ts +// bad +command: Command = { label: nls.localize('theia/my-package/myCommand', 'My Custom Label'), originalLabel: 'My Custom Label' }; + +// good - use toLocalizedCommand with a custom localization key +command = Command.toLocalizedCommand( + { id: 'my-command-id', label: 'My Custom Label' }, + 'theia/my-package/myCommand' +); + +// good - use toDefaultLocalizedCommand when the label exists in VS Code's language packs +command = Command.toDefaultLocalizedCommand( + { id: 'my-command-id', label: 'Close Editor' } +); +``` + + + +* [3.](#nls-rich-content-markdown) For localizing rich content (HTML), use Markdown instead of HTML strings. + +> Why? Markdown ensures valid, well-formed HTML and aligns with VS Code's approach for rich content (e.g., in detailed preference descriptions). Theia already supports rendering Markdown to HTML. + +```tsx +// bad - localizing HTML fragments individually +
+

{nls.localize('key1', 'Title')}

+

{nls.localize('key2', 'First paragraph.')}

+

{nls.localize('key3', 'Second paragraph.')}

+
+ +// bad - using dangerouslySetInnerHTML with HTML strings +
Title +

First paragraph.

+

Second paragraph.

+ `)) +}} /> + +// good - using MarkdownRenderer +import { MarkdownRenderer } from '@theia/core/lib/browser/markdown-rendering/markdown-renderer'; +import { MarkdownString } from '@theia/core/lib/common/markdown-rendering/markdown-string'; + +@injectable() +export class MyService { + @inject(MarkdownRenderer) + protected readonly markdownRenderer: MarkdownRenderer; + + renderWelcome(): HTMLElement { + const markdownContent = nls.localize('theia/mypackage/welcomeMessage', ` +# Welcome to My Feature + +This feature provides the following capabilities: +- **Feature A**: Description of feature A +- **Feature B**: Description of feature B + +Learn more in the [documentation](https://theia-ide.org/docs/). +`); + const rendered = this.markdownRenderer.render(new MarkdownString(markdownContent)); + return rendered.element; + } +} +``` + +> [!NOTE] +> When Markdown is not suitable and HTML must be used, ensure content is sanitized with `DOMPurify.sanitize()` before rendering with `dangerouslySetInnerHTML`. + +## Style + +* Use arrow functions `=>` over anonymous function expressions. +* Only surround arrow function parameters when necessary. For example, `(x) => x + x` is wrong, but the following are correct: + +```javascript +x => x + x +(x,y) => x + y +(x: T, y: T) => x === y +``` + +* Always surround loop and conditional bodies with curly braces. +* Open curly braces always go on the same line as whatever necessitates them. +* Parenthesized constructs should have no surrounding whitespace. A single space follows commas, colons, and semicolons in those constructs. For example: + +```javascript +for (var i = 0, n = str.length; i < 10; i++) { } +if (x < 10) { } +function f(x: number, y: string): void { } +``` + +* Use a single declaration per variable statement
(i.e. use `var x = 1; var y = 2;` over `var x = 1, y = 2;`). +* `else` goes on the line of the closing curly brace. + +## Dependency Injection + + + +* [1.](#property-injection) Use property injection over construction injection. Adding new dependencies via the construction injection is a breaking change. + +* [2.](#post-construct) Use a method decorated with `postConstruct` rather than the constructor to initialize an object, for example to register event listeners. + +```ts +@injectable() +export class MyComponent { + + @inject(ApplicationShell) + protected readonly shell: ApplicationShell; + + @postConstruct() + protected init(): void { + this.shell.activeChanged.connect(() => this.doSomething()); + } + +} +``` + + + +* [3.](#singleton-scope) Make sure to add `inSingletonScope` for singleton instances, otherwise a new instance will be created on each injection request. + +```ts +// bad +bind(CommandContribution).to(LoggerFrontendContribution); + +// good +bind(CommandContribution).to(LoggerFrontendContribution).inSingletonScope(); +``` + + + +* [4.](#di-function-export) Don't export functions, convert them into class methods. Functions cannot be overridden to change their behavior or work around a bug. + +```ts +// bad +export function createWebSocket(url: string): WebSocket { + ... +} + +// good +@injectable() +export class WebSocketProvider { + protected createWebSocket(url: string): WebSocket { + ... + } +} + +@injectable() +export class MyWebSocketProvider extends WebSocketProvider { + protected createWebSocket(url: string): WebSocket { + // create a web socket with custom options + } +} +``` + +**Exceptions** + + +* [4.1](#di-convenient-function-export) Convenient functions which are based on the stable API can be exported in the corresponding namespace. + +In this case clients: + +* can customize behaviour via exchanging the API implementation +* have a choice to use convenient functions or an API directly + +```ts +export namespace MonacoEditor { + // convenient function to get a Monaco editor based on the editor manager API + export function getCurrent(manager: EditorManager): MonacoEditor | undefined { + return get(manager.currentEditor); + } + ... +} +``` + + + +* [4.2](#di-json-function-export) The special case of [4.1](#di-convenient-function-export) is functions on a JSON type. + +JSON types are not supposed to be *implementable*, but only *instantiable*. They cannot have functions to avoid serialization issues. + +```ts +export interface CompositeTreeNode extends TreeNode { + children: ReadonlyArray; + + // bad - JSON types should not have functions + getFirstChild(): TreeNode | undefined; +} + +// good - JSON types can have corresponding namespaces with functions +export namespace CompositeTreeNode { + export function getFirstChild(parent: CompositeTreeNode): TreeNode | undefined { + return parent.children[0]; + } + ... +} + +// bad - JSON types should not be implemented +export class MyCompositeTreeNode implements CompositeTreeNode { + ... +} + +// good - JSON types can be extended +export interface MyCompositeTreeNode extends CompositeTreeNode { + ... +} +``` + + + +* [4.3](#di-auxiliary-function-export) Auxiliary functions which are called from the customizable context can be exported in the corresponding namespace. + +```ts +@injectable() +export class DirtyDiffModel { + // This method can be overridden. Subclasses have access to `DirtyDiffModel.documentContentLines`. + protected handleDocumentChanged(document: TextEditorDocument): void { + this.currentContent = DirtyDiffModel.documentContentLines(document); + this.update(); + } +} +export namespace DirtyDiffModel { + // the auxiliary function + export function documentContentLines(document: TextEditorDocument): ContentLines { + ... + } +} +``` + + + +* [5.](#no-multi-inject) Don't use InversifyJS's `@multiInject`, use Theia's utility `ContributionProvider` to inject multiple instances. + +> Why? +> +> * `ContributionProvider` is a documented way to introduce contribution points. See `Contribution-Points`: +> * If nothing is bound to an identifier, multi-inject resolves to `undefined`, not an empty array. `ContributionProvider` provides an empty array. +> * Multi-inject does not guarantee the same instances are injected if an extender does not use `inSingletonScope`. `ContributionProvider` caches instances to ensure uniqueness. +> * `ContributionProvider` supports filtering. See `ContributionFilterRegistry`. + +## CSS + + + +* [1.](#css-use-lower-case-with-dashes) Use the `lower-case-with-dashes` format. + +* [2.](#css-prefix-global-classes) Prefix classes with `theia` when used as global classes. + +* [3.](#no-styles-in-code) Do not define styles in code. Introduce proper CSS classes. + +> Why? It is not possible to play with such styles in the dev tools without recompiling the code. CSS classes can be edited in the dev tools. + +## Theming + + + +* [1.](#theming-no-css-color-variables) Do not introduce CSS color variables. Implement `ColorContribution` and use `ColorRegistry.register` to register new colors. + +* [2.](#theming-no-css-color-values) Do not introduce hard-coded color values in CSS. Instead, refer to [VS Code colors](https://code.visualstudio.com/api/references/theme-color) in CSS by prefixing them with `--theia` and replacing all dots with dashes. For example `widget.shadow` color can be referred to in CSS with `var(--theia-widget-shadow)`. + +* [3.](#theming-derive-colors-from-vscode) Always derive new colors from existing [VS Code colors](https://code.visualstudio.com/api/references/theme-color). New colors can be derived from an existing color by plain reference, e.g. `dark: 'widget.shadow'`, or transformation, e.g. `dark: Color.lighten('widget.shadow', 0.4)`. + +> Why? Otherwise, there is no guarantee that new colors will fit well into new VSCode color themes. + + +* [4.](#theming-theia-colors) Apply different color values only in concrete Theia themes, see [Light (Theia)](https://github.com/eclipse-theia/theia/blob/master/packages/monaco/data/monaco-themes/vscode/light_theia.json), [Dark (Theia)](https://github.com/eclipse-theia/theia/blob/master/packages/monaco/data/monaco-themes/vscode/dark_theia.json) and [High Contrast (Theia)](https://github.com/eclipse-theia/theia/blob/master/packages/monaco/data/monaco-themes/vscode/hc_theia.json) themes. + +* [5.](#theming-variable-naming) Names of variable follow the `object.property` pattern. + +```ts +// bad +'button.secondary.foreground' +'button.secondary.disabled.foreground' + +// good +'secondaryButton.foreground' +'secondaryButton.disabledForeground' +``` + +## React + + + +* [1.](#no-bind-fn-in-event-handlers) Do not bind functions in event handlers. + * Extract a React component if you want to pass state to an event handler function. + +> Why? Because doing so creates a new instance of the event handler function on each render and breaks React element caching leading to re-rendering and bad performance. + +```ts +// bad +class MyWidget extends ReactWidget { + render(): React.ReactNode { + return
; + } + + protected onClickDiv(): void { + // do stuff + } +} + +// bad +class MyWidget extends ReactWidget { + render(): React.ReactNode { + return
this.onClickDiv()} />; + } + + protected onClickDiv(): void { + // do stuff + } +} + +// very bad +class MyWidget extends ReactWidget { + render(): React.ReactNode { + return
; + } + + protected onClickDiv(): void { + // do stuff, no `this` access + } +} + +// good +class MyWidget extends ReactWidget { + render(): React.ReactNode { + return
+ } + + protected onClickDiv = () => { + // do stuff, can access `this` + } +} +``` + +## URI/Path + + + +* [1.](#uri-over-path) Pass URIs between frontend and backend, never paths. URIs should be sent as strings in JSON-RPC services, e.g. `RemoteFileSystemServer` accepts strings, not URIs. + +> Why? Frontend and backend can have different operating systems leading to incompatibilities between paths. URIs are normalized in order to be OS-agnostic. + + +* [2.](#frontend-fs-path) Use `FileService.fsPath` to get a path on the frontend from a URI. + +* [3.](#backend-fs-path) Use `FileUri.fsPath` to get a path on the backend from a URI. Never use it on the frontend. + +* [4.](#explicit-uri-scheme) Always define an explicit scheme for a URI. + +> Why? A URI without scheme will fall back to `file` scheme for now; in the future it will lead to a runtime error. + + +* [5.](#frontend-path) Use `Path` Theia API to manipulate paths on the frontend. Don't use Node.js APIs like `path` module. Also see [the code organization guideline](code-organization.md). + +* [6.](#backend-fs) On the backend, use Node.js APIS to manipulate the file system, like `fs` and `fs-extra` modules. + +> Why? `FileService` is to expose file system capabilities to the frontend only. It's aligned with expectations and requirements on the frontend. Using it on the backend is not possible. + + +* [7.](#use-long-name) Use `LabelProvider.getLongName(uri)` to get a system-wide human-readable representation of a full path. Don't use `uri.toString()` or `uri.path.toString()`. + +* [8.](#use-short-name) Use `LabelProvider.getName(uri)` to get a system-wide human-readable representation of a simple file name. + +* [9.](#use-icon) Use `LabelProvider.getIcon(uri)` to get a system-wide file icon. + +* [10.](#uri-no-string-manipulation) Don't use `string` to manipulate URIs and paths. Use `URI` and `Path` capabilities instead, like `join`, `resolve` and `relative`. + +> Why? Because object representation can handle corner cases properly, like trailing separators. + +```ts +// bad +uriString + '/' + pathString + +// good +new URI(uriString).join(pathString) + +// bad +pathString.substring(absolutePathString.length + 1) + +// good +new Path(absolutePathString).relative(pathString) +``` + +## Logging + + + +* [1.](#logging-use-console-log) Use `console` instead of `ILogger` for the root (top-level) logging. + +```ts +// bad +@inject(ILogger) +protected readonly logger: ILogger; + +this.logger.info(``); + +// good +console.info(``) +``` + +> Why? All calls to console are intercepted on the frontend and backend and then forwarded to an `ILogger` instance already. The log level can be configured from the CLI: `theia start --log-level=debug`. + +## "To Do" Tags + +There are situations where we can't properly implement some functionality at the time we merge a PR. In those cases, it is sometimes good practice to leave an indication that something needs to be fixed later in the code. This can be done by putting a "tag" string in a comment. This allows us to find the places we need to fix again later. Currently, we use two "standard" tags in Theia: + +* `@stubbed` + This tag is used in VS Code API implementations. Sometimes we need an implementation of an API in order for VS Code extensions to start up correctly, but we can't provide a proper implementation of the underlying feature at this time. This might be because a certain feature has no corresponding UI in Theia or because we do not have the resources to provide a proper implementation. +Using the `@stubbed` tag in a JSDoc comment will mark the element as "stubbed" on the [API status page](https://eclipse-theia.github.io/vscode-theia-comparator/status.html) +* `@monaco-uplift` + Use this tag when some functionality can be added or needs to be fixed when we move to a newer version of the monaco editor. If you know which minimum version of Monaco we need, you can add that as a reminder. diff --git a/doc/images/headless-plugin-diagram.drawio b/doc/images/headless-plugin-diagram.drawio new file mode 100644 index 0000000..70518fc --- /dev/null +++ b/doc/images/headless-plugin-diagram.drawio @@ -0,0 +1,163 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/images/headless-plugin-diagram.svg b/doc/images/headless-plugin-diagram.svg new file mode 100644 index 0000000..139b275 --- /dev/null +++ b/doc/images/headless-plugin-diagram.svg @@ -0,0 +1 @@ +
RPC
RPC
Main Proxy
Main Proxy
Ext API
Ext API
Registry
Registry
Plugin API
Plugin API
Backend
Backend
Headless Plugin Host
Headless Plugin Host
register(handle, DTO)
register(handle, DTO)
provideItems(handle, args)
provideItems(handle, args)
Main API
Main API
Main Impl
Main Impl
Ext Proxy
Ext Proxy
Contribution (application-defined)
Contribution (ap...
Headless Plugin
Headless P...
Ext Impl
register
register
provideItems
provideIte...
Node
Node
Text is not SVG - cannot display
\ No newline at end of file diff --git a/doc/images/plugin-api-diagram.drawio.xml b/doc/images/plugin-api-diagram.drawio.xml new file mode 100644 index 0000000..666f59d --- /dev/null +++ b/doc/images/plugin-api-diagram.drawio.xml @@ -0,0 +1,209 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/images/plugin-api-diagram.svg b/doc/images/plugin-api-diagram.svg new file mode 100644 index 0000000..a919537 --- /dev/null +++ b/doc/images/plugin-api-diagram.svg @@ -0,0 +1 @@ +
RPC Relay
(per frontend connection)
RPC Relay...
Backend
Backend
register(handle, DTO)
register(handle, DTO)
RPC
RPC
Frontend
Frontend
Main API
Main API
Main Impl
Main Impl
Ext Proxy
Ext Proxy
Browser
Browser
Main Proxy
Main Proxy
Ext API
Ext API
Registry
Registry
Plugin API
Plugin API
Plugin Host
Plugin Host
Contribution
(e.g. a code action provider)
Contribution...
Plugin / Extension
Plugin / E...
Ext Impl
register
register
provideItems
provideIte...
RPC
RPC
provideItems(handle, args)
provideItems(handle, args)
Text is not SVG - cannot display
\ No newline at end of file diff --git a/doc/images/theia-screenshot.png b/doc/images/theia-screenshot.png new file mode 100644 index 0000000..1f2d7cf Binary files /dev/null and b/doc/images/theia-screenshot.png differ diff --git a/doc/pull-requests.md b/doc/pull-requests.md new file mode 100644 index 0000000..2d3de6e --- /dev/null +++ b/doc/pull-requests.md @@ -0,0 +1,164 @@ +# Pull Requests + +This document clarifies rules and expectations of contributing and reviewing pull requests. +It is structured as a list of rules which can be referenced on a PR to moderate and drive discussions. +If a rule causes distress during discussions itself, it has to be reviewed on [the dev meeting](https://github.com/eclipse-theia/theia/wiki/Dev-Meetings) and updated. + +- [**Opening a Pull Request**](#opening-a-pull-request) +- [**Requesting a Review**](#requesting-a-review) +- [**Review Checklist**](#review-checklist) +- [**Reviewing**](#reviewing) +- [**Landing**](#landing) +- [**Reverting**](#reverting) +- [**Closing**](#closing) + +## Opening a Pull Request + + + +- [1.](#pr-template) Each PR description has to follow the [PR template](https://github.com/eclipse-theia/theia/blob/master/.github/PULL_REQUEST_TEMPLATE.md) + + + +- [2.](#design-review) A PR can be opened early for the design review before going into the detailed implementation. + - A request on the design review should be an explicit comment. + - Such PR should be marked as a draft or with the WIP prefix. + + + +- [3.](#fixups) Changes done _after_ the PR has been opened should be kept in separate commits until the review process is finished. This allows reviewers to re-review only the updated parts of the PR and to determine what needs to be tested again. The "fixup" commits must be squashed before merging in order to keep a clean history. + +## Requesting a Review + + + +- [1.](#review-reqs) A review can be requested when: + - [The PR template](#pr-template) is filled in. + - Changes are thoroughly tested by an author. + - Changes thoroughly reviewed following the [review checklist](#review-checklist) by an author. + +- [2.](#review-request-gh) A review can be requested explicitly [using GitHub](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/requesting-a-pull-request-review). + +- [3.](#review-request-comment) A review can be also requested as a comment from any GitHub users. + - For example to invite the person who originally filed an issue for testing. + +## Review Checklist + + + +- [1.](#checklist-build-and-test) The new code is built and tested according to the `How to test` section of a PR description. + +- [2.](#checklist-project-org) The new code is aligned with the [project organization](code-organization.md) and [coding conventions](coding-guidelines.md). + +- [3.](#checklist-breaking-changes) Breaking changes are justified and recorded in the [changelog](https://github.com/eclipse-theia/theia/blob/master/CHANGELOG.md). + +- [4.](#checklist-dependencies) New dependencies are justified and [verified](https://github.com/eclipse-theia/theia/wiki/Registering-CQs#wip---new-ecd-theia-intellectual-property-clearance-approach-experimental). + - For newly added dependencies, we run the [license check workflow](../.github/workflows/license-check.yml), but not in review mode. + - If the license check reveals that a review is needed for the new dependency (i.e., `ERROR: Found results that aren't part of the baseline! X some-dependency, some-license`), we need to run the license check in review mode (`npm run license:check:review`). + - Since we have no PAT secret defined for the repo at the moment, the license check in review mode needs to be done locally, either by the contributor (if they are a Theia committer) or by the reviewer. + +- [5.](#checklist-copied-code) Copied code is justified and [approved via a CQ](https://github.com/eclipse-theia/theia/wiki/Registering-CQs#case-3rd-party-project-code-copiedforked-from-another-project-into-eclipse-theia-maintained-by-us). + - Look closely at the GitHub actions running for your PR: the 3pp/dash license check should be green. + - If red: it most likely mean you need to create a CQ. + +- [6.](#checklist-copyright) Each new file has proper copyright with the current year and the name of contributing entity (individual or company). + +- [7.](#checklist-sign-off) Commits are signed-off: . + +- [8.](#checklist-meaningful-commits) Each commit has meaningful title and a body that explains what it does. One can take inspiration from the `What it does` section from the PR. + +- [9.](#checklist-commit-history) Commit history is rebased on master and contains only meaningful commits and changes (less are usually better). + - For example, use `git pull -r` or `git fetch && git rebase` to pick up changes from the master. + +- [10.](#checklist-i18n) User-facing text is internationalized using the `nls` service. + - For details, please see the [Internationalization/Localization section](./coding-guidelines.md#internationalizationlocalization) in the Coding Guidelines. + +## Reviewing + + + +- [1.](#reviewing-template) Reviewers should check that a PR has a [proper description](#pr-template). + +- [2.](#reviewing-fn) Reviewers should build and verify changes according to the `How to test` section of a PR description. + +- [3.](#reviewing-checklist) Reviewers should ensure that all checks from [the review checklist](#review-checklist) are successful. + +- [4.](#reviewing-share) A reviewer does not need to ensure everything but can verify a part of it and provide feedback as a comment. + +- [5.](#review-consultation) For any change that substantially alters the behavior of the application or one of its components, reviews should be requested from representatives of several contributing organizations to ensure consistency with the goals of the project and compatibility with significant adopters' downstream products. + +### Requesting Changes + + + +- [1.](#changes-review-reqs) Changes should be requested if an author does not follow the [review requirements](#review-reqs). + +- [2.](#changes-no-nit) Changes cannot be requested because of the personal preferences of a reviewer. + - Such change requests should be dismissed. + +- [3.](#changes-no-out-of-scope) Changes cannot be requested if they address issues out of the scope of a PR. + - Such change requests should be dismissed and an issue should be filed to address them separately. + +- [4.](#changes-style-agreement) Styles and coding preferences should not be discussed on the PR, but raised in [the dev meeting](https://github.com/eclipse-theia/theia/wiki/Dev-Meetings), + agreed by the team, applied to [the coding guidelines](coding-guidelines.md) and after that followed by all contributors. + +### Approving + + + +- [1.](#justifying-approve) Each approval should have supporting comments following these guidelines. + +- [2.](#dismissing-approve) An approval without a comment should be dismissed. + +- [3.](#approval-finality) Approval of a PR implies that the reviewer is prepared to merge the PR. A reviewer should only approve a pull request that they are prepared to merge it. If a PR is under review by multiple reviewers, reviewers who are not satisfied with the state of the PR should block its merge, for example by marking their review 'request changes'. + +### Collaborating + + + +- [1.](#collaboration-on-pr) If a change request is important, but cannot be elaborated by a reviewer, +then a reviewer should be encouraged to open an alternative PR or collaborate on a current PR. + +- [2.](#completing-pr) If a PR is important, but an author cannot or does not want to address outstanding issues, +then maintainers can complete the PR with additional commits +provided that the original author accepted the [ECA](https://github.com/eclipse-theia/theia/blob/master/CONTRIBUTING.md#eclipse-contributor-agreement) and their commits are preserved - the original author's work should not be squashed away. + +- [3.](#suggesting-help-on-pr) Reviewers should offer their help via a comment to avoid intervening in an author's work. + +- [4.](#landing-stale-pr) Such comment is not required if an author is not responsive. + +## Landing + + + +- [1.](#landing-pr) A PR can be landed when: + - CI build has succeeded. + - The author has accepted the [Eclipse Contributor Agreement](https://github.com/eclipse-theia/theia/blob/master/CONTRIBUTING.md#eclipse-contributor-agreement). + - All checks from [the review checklist](#review-checklist) are approved by at least one reviewer. + - There are no unresolved review comments. + +- [2.](#merging-pr) Pull requests satisfying the criteria above should be merged in a timely fashion to avoid a buildup of approved PR's at release time. Responsibility for merging a PR falls to + - The author, if the author is a committer. + - A committer from the author's organization, if one is available. + - The approving reviewer, otherwise. + +## Reverting + + + +- [1.](#reverting-pr) If a PR causes regressions after landing +then an author and maintainers have 2 days to resolve them after that a PR has to be reverted. + +## Closing + + + +- [1.](#closing-pr) A reviewer cannot close a PR without a reason. + +- [2.](#closing-pr-reasons) A PR may be closed, for example, because of the following reasons: + - It introduces functionality which should be implemented as external Theia or VS Code extensions. + - It introduces structural or API changes between core extensions. + Such changes have to be done by an experienced maintainer to avoid regressions and long reviews. + - It should be a 3rd party component, e.g. Theia is not a logging framework or a proxy server. + - It changes development infrastructure, e.g. testing frameworks, packaging and so on. +Such changes have to be done by active maintainers after agreement in [the dev meeting](https://github.com/eclipse-theia/theia/wiki/Dev-Meetings). diff --git a/doc/runtime-policy.md b/doc/runtime-policy.md new file mode 100644 index 0000000..cb27cfe --- /dev/null +++ b/doc/runtime-policy.md @@ -0,0 +1,50 @@ +# Node.js + +## Version Support Policy + +We aim to support Node.js current _Active LTS_ version. + +See to see the status of Node.js versions. + +We recommend setting up your environment to run Theia using the Node.js _Active LTS_, but any supported version should work as well. File an issue otherwise: . + +Note that the Node.js version you should use depends on your own project's dependencies: packages other than Theia might have their own requirements, so we try to support a reasonable range for adopters to be able to satisfy such constraints. + +## Update Process + +- Follow Node.js LTS cadence and initiate the update when a new Node.js version becomes _Active LTS_. +- Use `@types/node` for the oldest supported Node version (backward compatibility). +- Update the CI matrix to include the new Node.js versions to support. +- Update the documentation referencing recommended Node versions. +- Update the CHANGELOG. + +# Electron + +## Version Support Policy + +We aim to use Electron's latest _Stable Release_. + +See to see the latest Electron stable releases. + +Note that clearing new Electron releases IP-wise is a lot of work and may cause us to lag behind a bit. + +Adopters will benefit from Electron versions upgrades simply by upgrading their version of Theia. + +## Update Process + +- Follow Electron stable release cadence and initiate the update when a new Electron _Stable Release_ is published. +- Check the new Electron version for potential IP problems. +- Update the framework dependencies to target the new Electron version. +- Update the codebase to replace/use the new Electron APIs. +- Update the CHANGELOG. + +# VS Code Extension Support + +If you plan on supporting VS Code Extensions then it is recommended to make sure that both Node and/or Electron match +with VS Code's Node runtime, which depends on the Electron version that they end up using. + +You should look for this information in the [VS Code repository](https://github.com/microsoft/vscode). + +VS Code Extensions being meant to run in VS Code, developers may use any API available in the runtime in which their +extension runs. So if they expect to run in Node 16, then they may use Node 16 APIs. Running your Theia application +on Node 14 then means that some plugin features might not work because of missing APIs from the Node runtime. diff --git a/doc/vscode-usage.md b/doc/vscode-usage.md new file mode 100644 index 0000000..adc8b64 --- /dev/null +++ b/doc/vscode-usage.md @@ -0,0 +1,21 @@ +## Using code from VS Code + +Since its inception, Theia has used the "Monaco" editor component from VS Code. With the recent move to using ECMAScript modules, consuming code from the VS Code project has become much easier and safer. But while reusing code saves us work, there is also a downside to it. Monaco has a relatively stable external API because Microsoft also releases it as a stand-alone editor component. But other parts of the code base may change more frequently and in unexpected ways. We always use the same version of all modules making up VS Code. So when we update VS Code, often to provide a new feature in Monaco to our adopters, we will have to deal with all the API changes at that same time. As an example: Theia used the quick-input component from VS Code directly to implement it's own quick-input component. Because the component was not encapsulated in any way, the updating Monaco to a new version became difficult and time-consuming. + +So while we don't prohibit the use of code from VS Code (other than the Monaco editor API), we have the following goals: + +* Updating Monaco should not impact adopters + +* Adoption of a new Monaco version should generally be a straightforward, quick process (< 1 week of work) + +In order to achieve those goals, follow these simple rules: + +* Never export a type, function or variable from an internal VS Code API from a theia package + +* Don't use code from VS Code that you could not easily copy into the Theia codebase if the need arises. + +The first rule shields our adopters from having to change their code in response to updating Monaco. If they cannot see an object or type, they cannot rely on its existence or API. Note that this includes functions, supertype relationships or parameter and return types. If you need to export functionality, export an interface in Theia and import that interface using imported code from VS Code. This way, we can build adapters to shield against API changes. The rule also prevents spreading dependencies on VS Code in our code without our being aware of them. While it's not technically possible to enforce non-export of stuff in our current build system, we should make sure we're not exporting tainted code through `index.ts` or similar mechanisms. At the very least, we should not require package users to rely on VS Code stuff. + +The second rule ensures that we do not rely on VS Code stuff that is deeply coupled with other parts of VS Code that we don't want to import. It gives us the escape hatch of just copying the old version of the code and filing a CQ with the Eclipse foundation if updating to the version of stuff from VS Code is not what we want (because it doesn't fit our needs or takes to long). + +Tip: you can find locations where VS code is used by searching for import statements from `@theia/monaco-editor-core/esm/vs`. diff --git a/examples/api-provider-sample/.eslintrc.js b/examples/api-provider-sample/.eslintrc.js new file mode 100644 index 0000000..1308994 --- /dev/null +++ b/examples/api-provider-sample/.eslintrc.js @@ -0,0 +1,10 @@ +/** @type {import('eslint').Linter.Config} */ +module.exports = { + extends: [ + '../../configs/build.eslintrc.json' + ], + parserOptions: { + tsconfigRootDir: __dirname, + project: 'tsconfig.json' + } +}; diff --git a/examples/api-provider-sample/README.md b/examples/api-provider-sample/README.md new file mode 100644 index 0000000..09f4c8b --- /dev/null +++ b/examples/api-provider-sample/README.md @@ -0,0 +1,50 @@ +
+ +
+ +theia-ext-logo + +

ECLIPSE THEIA - API PROVIDER SAMPLE

+ +
+ +
+ +## Description + +The `@theia/api-provider-sample` extension is a programming example showing how to define and provide a custom API object for _plugins_ to use. +The purpose of the extension is to: + +- provide developers with realistic coding examples of providing custom API objects +- provide easy-to-use and test examples for features when reviewing pull requests + +The extension is for reference and test purposes only and is not published on `npm` (`private: true`). + +### Greeting of the Day + +The sample defines a `gotd` API that plugins can import and use to obtain tailored messages with which to greet the world, for example in their activation function. + +The source code is laid out in the `src/` tree as follows: + +- `gotd.d.ts` — the TypeScript definition of the `gotd` API object that plugins import to interact with the "Greeting of the Day" service +- `plugin/` — the API initialization script and the implementation of the API objects (`GreetingExt` and similar interfaces). + All code in this directory runs exclusively in the separate plugin-host Node process, isolated from the main Theia process, together with either headless plugins or the backend of VS Code plugins. + The `GreetingExtImpl` and similar classes communicate with the actual API implementation (`GreetingMainImpl` etc.) classes in the main Theia process via RPC +- `node/` — the API classes implementing `GreetingMain` and similar interfaces and the Inversify bindings that register the API provider. + All code in this directory runs in the main Theia Node process +- `common/` — the RPC API Ext/Main interface definitions corresponding to the backend of the `gotd` plugin API + +## Additional Information + +- [Theia - GitHub](https://github.com/eclipse-theia/theia) +- [Theia - Website](https://theia-ide.org/) + +## License + +- [Eclipse Public License 2.0](http://www.eclipse.org/legal/epl-2.0/) +- [一 (Secondary) GNU General Public License, version 2 with the GNU Classpath Exception](https://projects.eclipse.org/license/secondary-gpl-2.0-cp) + +## Trademark + +"Theia" is a trademark of the Eclipse Foundation + diff --git a/examples/api-provider-sample/package.json b/examples/api-provider-sample/package.json new file mode 100644 index 0000000..4261ac9 --- /dev/null +++ b/examples/api-provider-sample/package.json @@ -0,0 +1,42 @@ +{ + "private": true, + "name": "@theia/api-provider-sample", + "version": "1.68.0", + "description": "Theia - Example code to demonstrate Theia API Provider Extensions", + "dependencies": { + "@theia/core": "1.68.0", + "@theia/plugin-ext": "1.68.0", + "@theia/plugin-ext-headless": "1.68.0" + }, + "theiaExtensions": [ + { + "backend": "lib/node/gotd-backend-module" + } + ], + "keywords": [ + "theia-extension" + ], + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "repository": { + "type": "git", + "url": "https://github.com/eclipse-theia/theia.git" + }, + "bugs": { + "url": "https://github.com/eclipse-theia/theia/issues" + }, + "homepage": "https://github.com/eclipse-theia/theia", + "files": [ + "lib", + "src" + ], + "types": "src/gotd.d.ts", + "scripts": { + "lint": "theiaext lint", + "build": "theiaext build", + "watch": "theiaext watch", + "clean": "theiaext clean" + }, + "devDependencies": { + "@theia/ext-scripts": "1.68.0" + } +} diff --git a/examples/api-provider-sample/src/common/plugin-api-rpc.ts b/examples/api-provider-sample/src/common/plugin-api-rpc.ts new file mode 100644 index 0000000..87f3492 --- /dev/null +++ b/examples/api-provider-sample/src/common/plugin-api-rpc.ts @@ -0,0 +1,70 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** +import { createProxyIdentifier } from '@theia/plugin-ext/lib/common/rpc-protocol'; +import type { greeting } from '../gotd'; +import { Event } from '@theia/core'; + +export enum GreetingKind { + DIRECT = 1, + QUIRKY = 2, + SNARKY = 3, +} + +export interface GreeterData { + readonly uuid: string; + greetingKinds: greeting.GreetingKind[]; +}; + +export const GreetingMain = Symbol('GreetingMain'); +export interface GreetingMain { + $getMessage(greeterId: string): Promise; + + $createGreeter(): Promise; + $destroyGreeter(greeterId: GreeterData['uuid']): Promise; + + $updateGreeter(data: GreeterData): void; +} + +export const GreetingExt = Symbol('GreetingExt'); +export interface GreetingExt { + + // + // External protocol + // + + registerGreeter(): Promise; + unregisterGreeter(uuid: string): Promise; + + getMessage(greeterId: string): Promise; + getGreetingKinds(greeterId: string): readonly greeting.GreetingKind[]; + setGreetingKindEnabled(greeterId: string, greetingKind: greeting.GreetingKind, enable: boolean): void; + onGreetingKindsChanged(greeterId: string): Event; + + // + // Internal protocol + // + + $greeterUpdated(data: GreeterData): void; + +} + +export const PLUGIN_RPC_CONTEXT = { + GREETING_MAIN: createProxyIdentifier('GreetingMain'), +}; + +export const MAIN_RPC_CONTEXT = { + GREETING_EXT: createProxyIdentifier('GreetingExt'), +}; diff --git a/examples/api-provider-sample/src/gotd.d.ts b/examples/api-provider-sample/src/gotd.d.ts new file mode 100644 index 0000000..52bbc7a --- /dev/null +++ b/examples/api-provider-sample/src/gotd.d.ts @@ -0,0 +1,49 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +// Strictly speaking, the 'greeting' namespace is an unnecessary level of organization +// but it serves to illustrate how API namespaces are implemented in the backend. +export namespace greeting { + export function createGreeter(): Promise; + + export enum GreetingKind { + DIRECT = 1, + QUIRKY = 2, + SNARKY = 3, + } + + export interface Greeter extends Disposable { + greetingKinds: readonly GreetingKind[]; + + getMessage(): Promise; + + setGreetingKind(kind: GreetingKind, enable = true): void; + + onGreetingKindsChanged: Event; + } +} + +export interface Event { + (listener: (e: T) => unknown, thisArg?: unknown): Disposable; +} + +export interface Disposable { + dispose(): void; +} + +namespace Disposable { + export function create(func: () => void): Disposable; +} diff --git a/examples/api-provider-sample/src/node/ext-plugin-gotd-api-provider.ts b/examples/api-provider-sample/src/node/ext-plugin-gotd-api-provider.ts new file mode 100644 index 0000000..e16c7d9 --- /dev/null +++ b/examples/api-provider-sample/src/node/ext-plugin-gotd-api-provider.ts @@ -0,0 +1,33 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** +import * as path from 'path'; +import { injectable } from '@theia/core/shared/inversify'; +import { ExtPluginApi, ExtPluginApiProvider } from '@theia/plugin-ext-headless'; + +@injectable() +export class ExtPluginGotdApiProvider implements ExtPluginApiProvider { + provideApi(): ExtPluginApi { + // We can support both backend plugins and headless plugins, so we have only one + // entry-point script. Moreover, the application build packages that script in + // the `../backend/` directory from its source `../plugin/` location, alongside + // the scripts for all other plugin API providers. + const universalInitPath = path.join(__dirname, '../backend/gotd-api-init'); + return { + backendInitPath: universalInitPath, + headlessInitPath: universalInitPath + }; + } +} diff --git a/examples/api-provider-sample/src/node/gotd-backend-module.ts b/examples/api-provider-sample/src/node/gotd-backend-module.ts new file mode 100644 index 0000000..08b54a7 --- /dev/null +++ b/examples/api-provider-sample/src/node/gotd-backend-module.ts @@ -0,0 +1,28 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** +import { ContainerModule } from '@theia/core/shared/inversify'; +import { ExtPluginApiProvider } from '@theia/plugin-ext'; +import { ExtPluginGotdApiProvider } from './ext-plugin-gotd-api-provider'; +import { MainPluginApiProvider } from '@theia/plugin-ext/lib/common/plugin-ext-api-contribution'; +import { GotdMainPluginApiProvider } from './gotd-main-plugin-provider'; +import { GreetingMain } from '../common/plugin-api-rpc'; +import { GreetingMainImpl } from './greeting-main-impl'; + +export default new ContainerModule(bind => { + bind(Symbol.for(ExtPluginApiProvider)).to(ExtPluginGotdApiProvider).inSingletonScope(); + bind(MainPluginApiProvider).to(GotdMainPluginApiProvider).inSingletonScope(); + bind(GreetingMain).to(GreetingMainImpl).inSingletonScope(); +}); diff --git a/examples/api-provider-sample/src/node/gotd-main-plugin-provider.ts b/examples/api-provider-sample/src/node/gotd-main-plugin-provider.ts new file mode 100644 index 0000000..1477811 --- /dev/null +++ b/examples/api-provider-sample/src/node/gotd-main-plugin-provider.ts @@ -0,0 +1,29 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** +import { MainPluginApiProvider } from '@theia/plugin-ext/lib/common/plugin-ext-api-contribution'; +import { RPCProtocol } from '@theia/plugin-ext/lib/common/rpc-protocol'; +import { inject, injectable } from '@theia/core/shared/inversify'; +import { GreetingMain, PLUGIN_RPC_CONTEXT } from '../common/plugin-api-rpc'; + +@injectable() +export class GotdMainPluginApiProvider implements MainPluginApiProvider { + @inject(GreetingMain) + protected readonly greetingMain: GreetingMain; + + initialize(rpc: RPCProtocol): void { + rpc.set(PLUGIN_RPC_CONTEXT.GREETING_MAIN, this.greetingMain); + } +} diff --git a/examples/api-provider-sample/src/node/greeting-main-impl.ts b/examples/api-provider-sample/src/node/greeting-main-impl.ts new file mode 100644 index 0000000..02bf2d2 --- /dev/null +++ b/examples/api-provider-sample/src/node/greeting-main-impl.ts @@ -0,0 +1,72 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { generateUuid } from '@theia/core/lib/common/uuid'; +import { RPCProtocol } from '@theia/plugin-ext/lib/common/rpc-protocol'; +import { inject, injectable } from '@theia/core/shared/inversify'; +import { GreetingKind, GreeterData, GreetingExt, GreetingMain, MAIN_RPC_CONTEXT } from '../common/plugin-api-rpc'; + +const GREETINGS = { + [GreetingKind.DIRECT]: ['Hello, world!', "I'm here!", 'Good day!'], + [GreetingKind.QUIRKY]: ['Howdy doody, world?', "What's crack-a-lackin'?", 'Wazzup werld?'], + [GreetingKind.SNARKY]: ["Oh, it's you, world.", 'You again, world?!', 'Whatever.'], +} as const; + +@injectable() +export class GreetingMainImpl implements GreetingMain { + protected proxy: GreetingExt; + + private greeterData: Record = {}; + + constructor(@inject(RPCProtocol) rpc: RPCProtocol) { + this.proxy = rpc.getProxy(MAIN_RPC_CONTEXT.GREETING_EXT); + } + + async $createGreeter(): Promise { + const result: GreeterData = { + uuid: generateUuid(), + greetingKinds: [GreetingKind.DIRECT] + }; + this.greeterData[result.uuid] = result; + return result; + } + + async $destroyGreeter(greeterId: string): Promise { + delete this.greeterData[greeterId]; + } + + $updateGreeter(data: GreeterData): void { + const myData = this.greeterData[data.uuid]; + if (myData) { + myData.greetingKinds = [...data.greetingKinds]; + this.proxy.$greeterUpdated({ ...myData }); + } + } + + async $getMessage(greeterId: string): Promise { + const data = this.greeterData[greeterId]; + if (data.greetingKinds.length === 0) { + throw new Error(`No greetings are available for greeter ${greeterId}`); + } + + // Get a random one of our supported greeting kinds. + const kind = data.greetingKinds[(Math.floor(Math.random() * data.greetingKinds.length))]; + // And a random greeting of that kind + const greetingIdx = Math.floor(Math.random() * GREETINGS[kind].length); + + return GREETINGS[kind][greetingIdx]; + } +} diff --git a/examples/api-provider-sample/src/plugin/gotd-api-init.ts b/examples/api-provider-sample/src/plugin/gotd-api-init.ts new file mode 100644 index 0000000..cae7b4c --- /dev/null +++ b/examples/api-provider-sample/src/plugin/gotd-api-init.ts @@ -0,0 +1,97 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { inject, injectable, postConstruct } from '@theia/core/shared/inversify'; +import { RPCProtocol } from '@theia/plugin-ext/lib/common/rpc-protocol'; +import { Plugin } from '@theia/plugin-ext/lib/common/plugin-api-rpc'; +import type * as gotd from '../gotd'; +import { GreetingKind, GreetingExt, MAIN_RPC_CONTEXT } from '../common/plugin-api-rpc'; +import { GreetingExtImpl } from './greeting-ext-impl'; +import { Disposable, DisposableCollection } from '@theia/core'; +import { PluginContainerModule } from '@theia/plugin-ext/lib/plugin/node/plugin-container-module'; + +// This script is responsible for creating and returning the extension's +// custom API object when a plugin's module imports it. Keep in mind that +// all of the code here runs in the plugin-host node process, whether that +// be the backend host dedicated to some frontend connection or the single +// host for headless plugins, which is where the plugin itself is running. + +type Gotd = typeof gotd; +const GotdApiFactory = Symbol('GotdApiFactory'); + +// Retrieved by Theia to configure the Inversify DI container when the plugin is initialized. +// This is called when the plugin-host process is forked. +export const containerModule = PluginContainerModule.create(({ bind, bindApiFactory }) => { + bind(GreetingExt).to(GreetingExtImpl).inSingletonScope(); + bindApiFactory('@theia/api-provider-sample', GotdApiFactory, GotdApiFactoryImpl); +}); + +// Creates the Greeting of the Day API object +@injectable() +class GotdApiFactoryImpl { + @inject(RPCProtocol) + protected readonly rpc: RPCProtocol; + + @inject(GreetingExt) + protected readonly greetingExt: GreetingExt; + + @postConstruct() + initialize(): void { + this.rpc.set(MAIN_RPC_CONTEXT.GREETING_EXT, this.greetingExt); + } + + createApi(plugin: Plugin): Gotd { + const self = this; + async function createGreeter(): Promise { + const toDispose = new DisposableCollection(); + + const uuid = await self.greetingExt.registerGreeter(); + toDispose.push(Disposable.create(() => self.greetingExt.unregisterGreeter(uuid))); + + const onGreetingKindsChanged = self.greetingExt.onGreetingKindsChanged(uuid); + + const result: gotd.greeting.Greeter = { + get greetingKinds(): readonly GreetingKind[] { + return self.greetingExt.getGreetingKinds(uuid); + }, + + setGreetingKind(greetingKind: GreetingKind, enable = true): void { + self.greetingExt.setGreetingKindEnabled(uuid, greetingKind, enable); + }, + + getMessage(): Promise { + return self.greetingExt.getMessage(uuid); + }, + + onGreetingKindsChanged, + + dispose: toDispose.dispose.bind(toDispose), + }; + + return result; + } + + const greeting: Gotd['greeting'] = { + createGreeter, + GreetingKind + }; + + return { + greeting, + Disposable, + }; + }; +} diff --git a/examples/api-provider-sample/src/plugin/greeting-ext-impl.ts b/examples/api-provider-sample/src/plugin/greeting-ext-impl.ts new file mode 100644 index 0000000..56b5dab --- /dev/null +++ b/examples/api-provider-sample/src/plugin/greeting-ext-impl.ts @@ -0,0 +1,86 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** +import { inject, injectable } from '@theia/core/shared/inversify'; +import { GreetingKind, GreeterData, GreetingExt, GreetingMain, PLUGIN_RPC_CONTEXT } from '../common/plugin-api-rpc'; +import { RPCProtocol } from '@theia/plugin-ext/lib/common/rpc-protocol'; +import { Event, Emitter } from '@theia/core'; + +type LocalGreeterData = GreeterData & { + onGreetingKindsChangedEmitter: Emitter +}; + +@injectable() +export class GreetingExtImpl implements GreetingExt { + private readonly proxy: GreetingMain; + + private greeterData: Record = {}; + + constructor(@inject(RPCProtocol) rpc: RPCProtocol) { + this.proxy = rpc.getProxy(PLUGIN_RPC_CONTEXT.GREETING_MAIN); + } + + async registerGreeter(): Promise { + const newGreeter = await this.proxy.$createGreeter(); + this.greeterData[newGreeter.uuid] = { + ...newGreeter, + onGreetingKindsChangedEmitter: new Emitter() + }; + return newGreeter.uuid; + } + + unregisterGreeter(uuid: string): Promise { + delete this.greeterData[uuid]; + return this.proxy.$destroyGreeter(uuid); + } + + getGreetingKinds(greeterId: string): readonly GreetingKind[] { + const data = this.greeterData[greeterId]; + return data ? [...data.greetingKinds] : []; + } + + setGreetingKindEnabled(greeterId: string, greetingKind: GreetingKind, enable: boolean): void { + const data = this.greeterData[greeterId]; + + if (data.greetingKinds.includes(greetingKind) === enable) { + return; // Nothing to change + } + + if (enable) { + data.greetingKinds.push(greetingKind); + } else { + const index = data.greetingKinds.indexOf(greetingKind); + data.greetingKinds.splice(index, 1); + } + + this.proxy.$updateGreeter({uuid: greeterId, greetingKinds: [...data.greetingKinds] }); + } + + onGreetingKindsChanged(greeterId: string): Event { + return this.greeterData[greeterId].onGreetingKindsChangedEmitter.event; + } + + getMessage(greeterId: string): Promise { + return this.proxy.$getMessage(greeterId); + } + + $greeterUpdated(data: GreeterData): void { + const myData = this.greeterData[data.uuid]; + if (myData) { + myData.greetingKinds = [...data.greetingKinds]; + myData.onGreetingKindsChangedEmitter.fire([...data.greetingKinds]); + } + } +} diff --git a/examples/api-provider-sample/tsconfig.json b/examples/api-provider-sample/tsconfig.json new file mode 100644 index 0000000..a13a4e6 --- /dev/null +++ b/examples/api-provider-sample/tsconfig.json @@ -0,0 +1,22 @@ +{ + "extends": "../../configs/base.tsconfig", + "compilerOptions": { + "composite": true, + "rootDir": "src", + "outDir": "lib" + }, + "include": [ + "src" + ], + "references": [ + { + "path": "../../packages/core" + }, + { + "path": "../../packages/plugin-ext" + }, + { + "path": "../../packages/plugin-ext-headless" + } + ] +} diff --git a/examples/api-samples.disabled/.eslintrc.js b/examples/api-samples.disabled/.eslintrc.js new file mode 100644 index 0000000..1308994 --- /dev/null +++ b/examples/api-samples.disabled/.eslintrc.js @@ -0,0 +1,10 @@ +/** @type {import('eslint').Linter.Config} */ +module.exports = { + extends: [ + '../../configs/build.eslintrc.json' + ], + parserOptions: { + tsconfigRootDir: __dirname, + project: 'tsconfig.json' + } +}; diff --git a/examples/api-samples.disabled/README.md b/examples/api-samples.disabled/README.md new file mode 100644 index 0000000..fed4841 --- /dev/null +++ b/examples/api-samples.disabled/README.md @@ -0,0 +1,42 @@ +
+ +
+ +theia-ext-logo + +

ECLIPSE THEIA - API SAMPLES

+ +
+ +
+ +## Description + +The `@theia/api-samples` extension contains programming examples on how to use internal APIs. +The purpose of the extension is to: + +- provide developers with real-world coding examples using internal APIs, dependency injection, etc. +- provide easy-to-use and test examples for features when reviewing pull-requests. + +The extension is for reference and test purposes only and is not published on `npm` (`private: true`). + +### Sample mock OpenVSX server + +These samples contain a mock implementation of an OpenVSX server. This is done +for testing purposes only. It is currently hosted at +`/mock-open-vsx/api/...`. + +## Additional Information + +- [Theia - GitHub](https://github.com/eclipse-theia/theia) +- [Theia - Website](https://theia-ide.org/) + +## License + +- [Eclipse Public License 2.0](http://www.eclipse.org/legal/epl-2.0/) +- [一 (Secondary) GNU General Public License, version 2 with the GNU Classpath Exception](https://projects.eclipse.org/license/secondary-gpl-2.0-cp) + +## Trademark + +"Theia" is a trademark of the Eclipse Foundation + diff --git a/examples/api-samples.disabled/compression-example/compressible_1/compressed_1/compressed_2/compression-terminus_1 b/examples/api-samples.disabled/compression-example/compressible_1/compressed_1/compressed_2/compression-terminus_1 new file mode 100644 index 0000000..e69de29 diff --git a/examples/api-samples.disabled/compression-example/not-compressible_1/nc_child_1 b/examples/api-samples.disabled/compression-example/not-compressible_1/nc_child_1 new file mode 100644 index 0000000..e69de29 diff --git a/examples/api-samples.disabled/compression-example/not-compressible_1/nc_child_2 b/examples/api-samples.disabled/compression-example/not-compressible_1/nc_child_2 new file mode 100644 index 0000000..e69de29 diff --git a/examples/api-samples.disabled/compression-example/not-compressible_2/leaf_1 b/examples/api-samples.disabled/compression-example/not-compressible_2/leaf_1 new file mode 100644 index 0000000..e69de29 diff --git a/examples/api-samples.disabled/compression-example/not-compressible_2/sub_compressible_1/sub_compressible_2/leaf_2 b/examples/api-samples.disabled/compression-example/not-compressible_2/sub_compressible_1/sub_compressible_2/leaf_2 new file mode 100644 index 0000000..e69de29 diff --git a/examples/api-samples.disabled/compression-example/terminus_1 b/examples/api-samples.disabled/compression-example/terminus_1 new file mode 100644 index 0000000..e69de29 diff --git a/examples/api-samples.disabled/package.json b/examples/api-samples.disabled/package.json new file mode 100644 index 0000000..2f6211b --- /dev/null +++ b/examples/api-samples.disabled/package.json @@ -0,0 +1,69 @@ +{ + "private": true, + "name": "@theia/api-samples", + "version": "1.68.0", + "description": "Theia - Example code to demonstrate Theia API", + "dependencies": { + "@modelcontextprotocol/sdk": "^1.25.1", + "@theia/ai-chat": "1.68.0", + "@theia/ai-chat-ui": "1.68.0", + "@theia/ai-code-completion": "1.68.0", + "@theia/ai-core": "1.68.0", + "@theia/ai-mcp": "1.68.0", + "@theia/ai-mcp-server": "1.68.0", + "@theia/core": "1.68.0", + "@theia/file-search": "1.68.0", + "@theia/filesystem": "1.68.0", + "@theia/monaco": "1.68.0", + "@theia/monaco-editor-core": "1.96.302", + "@theia/output": "1.68.0", + "@theia/ovsx-client": "1.68.0", + "@theia/search-in-workspace": "1.68.0", + "@theia/test": "1.68.0", + "@theia/toolbar": "1.68.0", + "@theia/vsx-registry": "1.68.0", + "@theia/workspace": "1.68.0", + "zod": "^4.2.1" + }, + "theiaExtensions": [ + { + "frontend": "lib/browser/api-samples-frontend-module", + "backend": "lib/node/api-samples-backend-module" + }, + { + "electronMain": "lib/electron-main/update/sample-updater-main-module", + "frontendElectron": "lib/electron-browser/updater/sample-updater-frontend-module" + }, + { + "frontendOnly": "lib/browser-only/api-samples-frontend-only-module" + }, + { + "frontendPreload": "lib/browser/api-samples-preload-module" + } + ], + "keywords": [ + "theia-extension" + ], + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "repository": { + "type": "git", + "url": "https://github.com/eclipse-theia/theia.git" + }, + "bugs": { + "url": "https://github.com/eclipse-theia/theia/issues" + }, + "homepage": "https://github.com/eclipse-theia/theia", + "files": [ + "lib", + "src" + ], + "scripts": { + "lint": "theiaext lint", + "build": "theiaext build", + "watch": "theiaext watch", + "clean": "theiaext clean" + }, + "devDependencies": { + "@theia/ext-scripts": "1.68.0" + } +} diff --git a/examples/api-samples.disabled/src/browser-only/api-samples-frontend-only-module.ts b/examples/api-samples.disabled/src/browser-only/api-samples-frontend-only-module.ts new file mode 100644 index 0000000..6de6d07 --- /dev/null +++ b/examples/api-samples.disabled/src/browser-only/api-samples-frontend-only-module.ts @@ -0,0 +1,27 @@ +// ***************************************************************************** +// Copyright (C) 2023 EclipseSource and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { ContainerModule, interfaces } from '@theia/core/shared/inversify'; +import { bindOPFSInitialization } from './filesystem/example-filesystem-initialization'; + +export default new ContainerModule(( + bind: interfaces.Bind, + _unbind: interfaces.Unbind, + _isBound: interfaces.IsBound, + rebind: interfaces.Rebind, +) => { + bindOPFSInitialization(bind, rebind); +}); diff --git a/examples/api-samples.disabled/src/browser-only/filesystem/example-filesystem-initialization.ts b/examples/api-samples.disabled/src/browser-only/filesystem/example-filesystem-initialization.ts new file mode 100644 index 0000000..b1e2ba2 --- /dev/null +++ b/examples/api-samples.disabled/src/browser-only/filesystem/example-filesystem-initialization.ts @@ -0,0 +1,61 @@ +// ***************************************************************************** +// Copyright (C) 2023 EclipseSource and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { URI } from '@theia/core'; +import { inject, injectable, interfaces } from '@theia/core/shared/inversify'; +import { EncodingService } from '@theia/core/lib/common/encoding-service'; +import { OPFSInitialization, DefaultOPFSInitialization } from '@theia/filesystem/lib/browser-only/opfs-filesystem-initialization'; +import { OPFSFileSystemProvider } from '@theia/filesystem/lib/browser-only/opfs-filesystem-provider'; + +@injectable() +export class ExampleOPFSInitialization extends DefaultOPFSInitialization { + + @inject(EncodingService) + protected encodingService: EncodingService; + + override getRootDirectory(): string { + return '/theia/'; + } + + override async initializeFS(provider: OPFSFileSystemProvider): Promise { + // Check whether the directory exists (relative to the root directory) + if (await provider.exists(new URI('/workspace'))) { + await provider.readdir(new URI('/workspace')); + } else { + await provider.mkdir(new URI('/workspace')); + await provider.writeFile(new URI('/workspace/my-file.txt'), this.encodingService.encode('foo').buffer, { create: true, overwrite: false }); + } + + if (await provider.exists(new URI('/workspace2'))) { + await provider.readdir(new URI('/workspace2')); + } else { + await provider.mkdir(new URI('/workspace2')); + await provider.writeFile(new URI('/workspace2/my-file.json'), this.encodingService.encode('{ foo: true }').buffer, { create: true, overwrite: false }); + } + + // You can also create an index of the files and directories in the file system + // await provider.clear(); + // await provider.createIndex([ + // [new URI('/workspace/my-file.txt'), this.encodingService.encode('bar').buffer], + // [new URI('/workspace2/my-file.json'), this.encodingService.encode('{ foo: true }').buffer] + // ]); + } +} + +export const bindOPFSInitialization = (bind: interfaces.Bind, rebind: interfaces.Rebind): void => { + bind(ExampleOPFSInitialization).toSelf(); + rebind(OPFSInitialization).toService(ExampleOPFSInitialization); +}; diff --git a/examples/api-samples.disabled/src/browser/ai-code-completion/sample-code-completion-variable-contribution.ts b/examples/api-samples.disabled/src/browser/ai-code-completion/sample-code-completion-variable-contribution.ts new file mode 100644 index 0000000..b67d068 --- /dev/null +++ b/examples/api-samples.disabled/src/browser/ai-code-completion/sample-code-completion-variable-contribution.ts @@ -0,0 +1,57 @@ +// ***************************************************************************** +// Copyright (C) 2025 Lonti.com Pty Ltd. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { CodeCompletionVariableContext } from '@theia/ai-code-completion/lib/browser/code-completion-variable-context'; +import { AIVariable, AIVariableContext, AIVariableContribution, AIVariableResolutionRequest, AIVariableResolver, ResolvedAIVariable } from '@theia/ai-core'; +import { FrontendVariableContribution, FrontendVariableService } from '@theia/ai-core/lib/browser'; +import { MaybePromise } from '@theia/core'; +import { injectable, interfaces } from '@theia/core/shared/inversify'; + +const SAMPLE_VARIABLE: AIVariable = { + id: 'sampleCodeCompletionVariable', + name: 'sampleCodeCompletionVariable', + description: 'A sample variable for code completion.', +}; + +/** + * This variable is used to demonstrate how to create a custom variable for code completion. + * It is registered as a variable that can be resolved in the context of code completion. + */ +@injectable() +export class SampleCodeCompletionVariableContribution implements FrontendVariableContribution, AIVariableResolver { + + registerVariables(service: FrontendVariableService): void { + service.registerResolver(SAMPLE_VARIABLE, this); + } + + canResolve(request: AIVariableResolutionRequest, context: AIVariableContext): MaybePromise { + return CodeCompletionVariableContext.is(context) && request.variable.id === SAMPLE_VARIABLE.id ? 1 : 0; + } + + async resolve(request: AIVariableResolutionRequest, context: AIVariableContext): Promise { + if (request.variable.id === SAMPLE_VARIABLE.id && CodeCompletionVariableContext.is(context) && context.model.uri.path.endsWith('.sample.js')) { + return Promise.resolve({ + variable: SAMPLE_VARIABLE, + value: 'This is a special sample file, every line must end with a "// sample" comment.' + }); + } + } + +} + +export const bindSampleCodeCompletionVariableContribution = (bind: interfaces.Bind) => { + bind(AIVariableContribution).to(SampleCodeCompletionVariableContribution).inSingletonScope(); +}; diff --git a/examples/api-samples.disabled/src/browser/api-samples-frontend-module.ts b/examples/api-samples.disabled/src/browser/api-samples-frontend-module.ts new file mode 100644 index 0000000..2d26a5f --- /dev/null +++ b/examples/api-samples.disabled/src/browser/api-samples-frontend-module.ts @@ -0,0 +1,78 @@ +// ***************************************************************************** +// Copyright (C) 2019 Arm and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { ContainerModule, interfaces } from '@theia/core/shared/inversify'; +import { bindDynamicLabelProvider } from './label/sample-dynamic-label-provider-command-contribution'; +import { bindSampleFilteredCommandContribution } from './contribution-filter/sample-filtered-command-contribution'; +import { bindSampleUnclosableView } from './view/sample-unclosable-view-contribution'; +import { bindSampleOutputChannelWithSeverity } from './output/sample-output-channel-with-severity'; +import { bindSampleMenu } from './menu/sample-menu-contribution'; +import { bindSampleFileWatching } from './file-watching/sample-file-watching-contribution'; +import { bindVSXCommand } from './vsx/sample-vsx-command-contribution'; +import { bindSampleToolbarContribution } from './toolbar/sample-toolbar-contribution'; + +import '../../src/browser/style/branding.css'; +import { bindMonacoPreferenceExtractor } from './monaco-editor-preferences/monaco-editor-preference-extractor'; +import { rebindOVSXClientFactory } from '../common/vsx/sample-ovsx-client-factory'; +import { bindSampleAppInfo } from './vsx/sample-frontend-app-info'; +import { bindTestSample } from './test/sample-test-contribution'; +import { bindSampleFileSystemCapabilitiesCommands } from './file-system/sample-file-system-capabilities'; +import { bindChatNodeToolbarActionContribution } from './chat/chat-node-toolbar-action-contribution'; +import { bindAskAndContinueChatAgentContribution } from './chat/ask-and-continue-chat-agent-contribution'; +import { bindChangeSetChatAgentContribution } from './chat/change-set-chat-agent-contribution'; +import { bindModeChatAgentContribution } from './chat/mode-chat-agent-contribution'; +import { bindOriginalStateTestAgentContribution } from './chat/original-state-test-agent-contribution'; +import { bindCustomResponseContentRendererContribution } from './chat/custom-response-content-agent-contribution'; +import { bindSampleChatCommandContribution } from './chat/sample-chat-command-contribution'; +import { bindSampleCodeCompletionVariableContribution } from './ai-code-completion/sample-code-completion-variable-contribution'; +import { bindSamplePreferenceContribution } from './preferences/sample-preferences-contribution'; +import { MCPFrontendContribution } from '@theia/ai-mcp-server/lib/browser/mcp-frontend-contribution'; +import { SampleFrontendMCPContribution } from './mcp/sample-frontend-mcp-contribution'; +import { FrontendApplicationContribution } from '@theia/core/lib/browser'; +import { ResolveMcpFrontendContribution } from './mcp/resolve-frontend-mcp-contribution'; + +export default new ContainerModule(( + bind: interfaces.Bind, + unbind: interfaces.Unbind, + isBound: interfaces.IsBound, + rebind: interfaces.Rebind, +) => { + bindAskAndContinueChatAgentContribution(bind); + bindChangeSetChatAgentContribution(bind); + bindModeChatAgentContribution(bind); + bindOriginalStateTestAgentContribution(bind); + bindCustomResponseContentRendererContribution(bind); + bindChatNodeToolbarActionContribution(bind); + bindSampleChatCommandContribution(bind); + bindDynamicLabelProvider(bind); + bindSampleUnclosableView(bind); + bindSampleOutputChannelWithSeverity(bind); + bindSampleMenu(bind); + bindSampleFileWatching(bind); + bindVSXCommand(bind); + bindSampleFilteredCommandContribution(bind); + bindSampleToolbarContribution(bind, rebind); + bindMonacoPreferenceExtractor(bind); + bindSampleAppInfo(bind); + bindTestSample(bind); + bindSampleFileSystemCapabilitiesCommands(bind); + rebindOVSXClientFactory(rebind); + bindSampleCodeCompletionVariableContribution(bind); + bindSamplePreferenceContribution(bind); + bind(MCPFrontendContribution).to(SampleFrontendMCPContribution).inSingletonScope(); + bind(ResolveMcpFrontendContribution).toSelf().inSingletonScope(); + bind(FrontendApplicationContribution).toService(ResolveMcpFrontendContribution); +}); diff --git a/examples/api-samples.disabled/src/browser/api-samples-preload-module.ts b/examples/api-samples.disabled/src/browser/api-samples-preload-module.ts new file mode 100644 index 0000000..545a759 --- /dev/null +++ b/examples/api-samples.disabled/src/browser/api-samples-preload-module.ts @@ -0,0 +1,23 @@ +// ***************************************************************************** +// Copyright (C) 2025 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { ContainerModule } from '@theia/core/shared/inversify'; +import { TextReplacementContribution } from '@theia/core/lib/browser/preload/text-replacement-contribution'; +import { TextSampleReplacementContribution } from './preload/text-replacement-sample'; + +export default new ContainerModule(bind => { + bind(TextReplacementContribution).to(TextSampleReplacementContribution).inSingletonScope(); +}); diff --git a/examples/api-samples.disabled/src/browser/chat/ask-and-continue-chat-agent-contribution.ts b/examples/api-samples.disabled/src/browser/chat/ask-and-continue-chat-agent-contribution.ts new file mode 100644 index 0000000..f32dcdd --- /dev/null +++ b/examples/api-samples.disabled/src/browser/chat/ask-and-continue-chat-agent-contribution.ts @@ -0,0 +1,182 @@ +// ***************************************************************************** +// Copyright (C) 2024 STMicroelectronics and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { + AbstractStreamParsingChatAgent, + ChatAgent, + ChatModel, + MutableChatRequestModel, + lastProgressMessage, + QuestionResponseContentImpl, + unansweredQuestions, + ProgressChatResponseContentImpl +} from '@theia/ai-chat'; +import { Agent, LanguageModelMessage, BasePromptFragment } from '@theia/ai-core'; +import { injectable, interfaces, postConstruct } from '@theia/core/shared/inversify'; + +export function bindAskAndContinueChatAgentContribution(bind: interfaces.Bind): void { + bind(AskAndContinueChatAgent).toSelf().inSingletonScope(); + bind(Agent).toService(AskAndContinueChatAgent); + bind(ChatAgent).toService(AskAndContinueChatAgent); +} + +const systemPrompt: BasePromptFragment = { + id: 'askAndContinue-system', + template: ` +You are an agent demonstrating how to generate questions and continue the conversation based on the user's answers. + +First answer the user's question or continue their story. +Then come up with an interesting question and 2-3 answers which will be presented to the user as multiple choice. + +Use the following format exactly to define the questions and answers. +Especially add the and tags around the JSON. + + +{ + "question": "YOUR QUESTION HERE", + "options": [ + { + "text": "OPTION 1" + }, + { + "text": "OPTION 2" + } + ] +} + + +Examples: + + +{ + "question": "What is the capital of France?", + "options": [ + { + "text": "Paris" + }, + { + "text": "Lyon" + } + ] +} + + + +{ + "question": "What does the fox say?", + "options": [ + { + "text": "Ring-ding-ding-ding-dingeringeding!" + }, + { + "text": "Wa-pa-pa-pa-pa-pa-pow!" + } + ] +} + + +The user will answer the question and you can continue the conversation. +Once they answered, the question will be replaced with a simple "Question/Answer" pair, for example + +Question: What does the fox say? +Answer: Ring-ding-ding-ding-dingeringeding! + +If the user did not answer the question, it will be marked with "No answer", for example + +Question: What is the capital of France? +No answer + +Do not generate such pairs yourself, instead treat them as a signal for a past question. +Do not ask further questions once the text contains 5 or more "Question/Answer" pairs. +` +}; + +/** + * This is a very simple example agent that asks questions and continues the conversation based on the user's answers. + */ +@injectable() +export class AskAndContinueChatAgent extends AbstractStreamParsingChatAgent { + id = 'AskAndContinueSample'; + name = 'AskAndContinueSample'; + override description = 'This chat will ask questions related to the input and continues after that.'; + protected defaultLanguageModelPurpose = 'chat'; + override languageModelRequirements = [ + { + purpose: 'chat', + identifier: 'default/universal', + } + ]; + override prompts = [{ id: systemPrompt.id, defaultVariant: systemPrompt }]; + protected override systemPromptId: string | undefined = systemPrompt.id; + + @postConstruct() + addContentMatchers(): void { + this.contentMatchers.push({ + start: /^.*$/m, + end: /^<\/question>$/m, + contentFactory: (content: string, request: MutableChatRequestModel) => { + const question = content.replace(/^\n|<\/question>$/g, ''); + const parsedQuestion = JSON.parse(question); + + return new QuestionResponseContentImpl(parsedQuestion.question, parsedQuestion.options, request, selectedOption => { + this.handleAnswer(selectedOption, request); + }); + }, + incompleteContentFactory: (content: string, request: MutableChatRequestModel) => + // Display a progress indicator while the question is being parsed + new ProgressChatResponseContentImpl('Preparing question...') + }); + } + + protected override async onResponseComplete(request: MutableChatRequestModel): Promise { + const unansweredQs = unansweredQuestions(request); + if (unansweredQs.length < 1) { + return super.onResponseComplete(request); + } + request.response.addProgressMessage({ content: 'Waiting for input...', show: 'whileIncomplete' }); + request.response.waitForInput(); + } + + protected handleAnswer(selectedOption: { text: string; value?: string; }, request: MutableChatRequestModel): void { + const progressMessage = lastProgressMessage(request); + if (progressMessage) { + request.response.updateProgressMessage({ ...progressMessage, show: 'untilFirstContent', status: 'completed' }); + } + request.response.stopWaitingForInput(); + // We're reusing the original request here as a shortcut. In combination with the override of 'getMessages' we continue generating. + // In a real-world scenario, you would likely manually interact with an LLM here to generate and append the next response. + this.invoke(request); + } + + /** + * As the question/answer are handled within the same response, we add an additional user message at the end to indicate to + * the LLM to continue generating. + */ + protected override async getMessages(model: ChatModel): Promise { + const messages = await super.getMessages(model, true); + const requests = model.getRequests(); + if (!requests[requests.length - 1].response.isComplete && requests[requests.length - 1].response.response?.content.length > 0) { + return [...messages, + { + type: 'text', + actor: 'user', + text: 'Continue generating based on the user\'s answer or finish the conversation if 5 or more questions were already answered.' + }]; + } + return messages; + } +} + diff --git a/examples/api-samples.disabled/src/browser/chat/change-set-chat-agent-contribution.ts b/examples/api-samples.disabled/src/browser/chat/change-set-chat-agent-contribution.ts new file mode 100644 index 0000000..3344b8e --- /dev/null +++ b/examples/api-samples.disabled/src/browser/chat/change-set-chat-agent-contribution.ts @@ -0,0 +1,156 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { + AbstractStreamParsingChatAgent, + ChatAgent, + MutableChatRequestModel, + MarkdownChatResponseContentImpl, + SystemMessageDescription, + ChangeSetElement +} from '@theia/ai-chat'; +import { ChangeSetFileElementFactory } from '@theia/ai-chat/lib/browser/change-set-file-element'; +import { Agent, LanguageModelRequirement } from '@theia/ai-core'; +import { URI } from '@theia/core'; +import { inject, injectable, interfaces } from '@theia/core/shared/inversify'; +import { FileService } from '@theia/filesystem/lib/browser/file-service'; +import { WorkspaceService } from '@theia/workspace/lib/browser'; + +export function bindChangeSetChatAgentContribution(bind: interfaces.Bind): void { + bind(ChangeSetChatAgent).toSelf().inSingletonScope(); + bind(Agent).toService(ChangeSetChatAgent); + bind(ChatAgent).toService(ChangeSetChatAgent); +} + +/** + * This is a test agent demonstrating how to create change sets in AI chats. + */ +@injectable() +export class ChangeSetChatAgent extends AbstractStreamParsingChatAgent { + readonly id = 'ChangeSetSample'; + readonly name = 'ChangeSetSample'; + readonly defaultLanguageModelPurpose = 'chat'; + override readonly description = 'This chat will create and modify a change set.'; + override languageModelRequirements: LanguageModelRequirement[] = []; + + @inject(WorkspaceService) + protected readonly workspaceService: WorkspaceService; + + @inject(FileService) + protected readonly fileService: FileService; + + @inject(ChangeSetFileElementFactory) + protected readonly fileChangeFactory: ChangeSetFileElementFactory; + + override async invoke(request: MutableChatRequestModel): Promise { + const roots = this.workspaceService.tryGetRoots(); + if (roots.length === 0) { + request.response.response.addContent(new MarkdownChatResponseContentImpl( + 'No workspace is open. For using this chat agent, please open a workspace with at least two files in the root.' + )); + request.response.complete(); + return; + } + + const root = roots[0]; + const files = root.children?.filter(child => child.isFile); + if (!files || files.length < 3) { + request.response.response.addContent(new MarkdownChatResponseContentImpl( + 'The workspace does not contain any files. For using this chat agent, please add at least two files in the root.' + )); + request.response.complete(); + return; + } + + const fileToAdd = root.resource.resolve('hello/new-file.txt'); + const fileToChange = files[Math.floor(Math.random() * files.length)]; + const fileToDelete = files.filter(file => file.name !== fileToChange.name)[Math.floor(Math.random() * files.length)]; + + const changes: ChangeSetElement[] = []; + const chatSessionId = request.session.id; + const requestId = request.id; + + changes.push( + this.fileChangeFactory({ + uri: fileToAdd, + type: 'add', + state: 'pending', + targetState: 'Hello World!', + requestId, + chatSessionId + }) + ); + + if (fileToChange && fileToChange.resource) { + changes.push( + this.fileChangeFactory({ + uri: fileToChange.resource, + type: 'modify', + state: 'pending', + targetState: await this.computeTargetState(fileToChange.resource), + requestId, + chatSessionId + }) + ); + } + if (fileToDelete && fileToDelete.resource) { + changes.push( + this.fileChangeFactory({ + uri: fileToDelete.resource, + type: 'delete', + state: 'pending', + requestId, + chatSessionId + }) + ); + } + request.session.changeSet.setTitle('My Test Change Set'); + request.session.changeSet.setElements(...changes); + + request.response.response.addContent(new MarkdownChatResponseContentImpl( + 'I have created a change set for you. You can now review and apply it.' + )); + request.response.complete(); + } + async computeTargetState(resource: URI): Promise { + const content = await this.fileService.read(resource); + if (content.value.length < 20) { + return 'HelloWorldModify'; + } + let readLocation = Math.random() * 0.1 * content.value.length; + let oldLocation = 0; + let output = ''; + while (readLocation < content.value.length) { + output += content.value.substring(oldLocation, readLocation); + oldLocation = readLocation; + const type = Math.random(); + if (type < 0.33) { + // insert + output += `this is an insert at ${readLocation}`; + } else { + // delete + oldLocation += 20; + } + + readLocation += Math.random() * 0.1 * content.value.length; + } + return output; + } + + protected override async getSystemMessageDescription(): Promise { + return undefined; + } +} diff --git a/examples/api-samples.disabled/src/browser/chat/chat-node-toolbar-action-contribution.ts b/examples/api-samples.disabled/src/browser/chat/chat-node-toolbar-action-contribution.ts new file mode 100644 index 0000000..f34a8a6 --- /dev/null +++ b/examples/api-samples.disabled/src/browser/chat/chat-node-toolbar-action-contribution.ts @@ -0,0 +1,41 @@ +// ***************************************************************************** +// Copyright (C) 2024 STMicroelectronics and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { + ChatNodeToolbarActionContribution +} from '@theia/ai-chat-ui/lib/browser/chat-node-toolbar-action-contribution'; +import { + isResponseNode, + RequestNode, + ResponseNode +} from '@theia/ai-chat-ui/lib/browser/chat-tree-view'; +import { interfaces } from '@theia/core/shared/inversify'; + +export function bindChatNodeToolbarActionContribution(bind: interfaces.Bind): void { + bind(ChatNodeToolbarActionContribution).toDynamicValue(context => ({ + getToolbarActions: (args: RequestNode | ResponseNode) => { + if (isResponseNode(args)) { + return [{ + commandId: 'sample-command', + icon: 'codicon codicon-feedback', + tooltip: 'API Samples: Example command' + }]; + } else { + return []; + } + } + })); +} diff --git a/examples/api-samples.disabled/src/browser/chat/custom-response-content-agent-contribution.ts b/examples/api-samples.disabled/src/browser/chat/custom-response-content-agent-contribution.ts new file mode 100644 index 0000000..ff8e563 --- /dev/null +++ b/examples/api-samples.disabled/src/browser/chat/custom-response-content-agent-contribution.ts @@ -0,0 +1,281 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { + AbstractStreamParsingChatAgent, + ChatAgent, + ChatResponseContent, + MutableChatRequestModel, + SerializableChatResponseContentData, +} from '@theia/ai-chat'; +import { + ChatContentDeserializerContribution, + ChatContentDeserializerRegistry +} from '@theia/ai-chat/lib/common/chat-content-deserializer'; +import { ChatResponsePartRenderer } from '@theia/ai-chat-ui/lib/browser/chat-response-part-renderer'; +import { ResponseNode } from '@theia/ai-chat-ui/lib/browser/chat-tree-view'; +import { Agent } from '@theia/ai-core'; +import { injectable, interfaces } from '@theia/core/shared/inversify'; +import * as React from '@theia/core/shared/react'; +import { ReactNode } from '@theia/core/shared/react'; + +export function bindCustomResponseContentRendererContribution(bind: interfaces.Bind): void { + bind(CustomResponseContentRendererAgent).toSelf().inSingletonScope(); + bind(Agent).toService(CustomResponseContentRendererAgent); + bind(ChatAgent).toService(CustomResponseContentRendererAgent); + + bind(ChatContentDeserializerContribution).to(CustomContentDeserializerContribution).inSingletonScope(); + + bind(ChatResponsePartRenderer).to(CustomSerializableContentRenderer).inSingletonScope(); + bind(ChatResponsePartRenderer).to(CustomNonSerializableContentRenderer).inSingletonScope(); +} + +// ============================================================================= +// SERIALIZABLE CUSTOM CONTENT +// ============================================================================= + +/** + * Data interface for serializable custom content. + * This is shared between the implementation and the deserializer. + */ +export interface CustomSerializableContentData { + title: string; + items: string[]; + timestamp: number; +} + +/** + * Serializable custom content type. + * This can be persisted and restored from storage. + */ +export interface CustomSerializableContent extends ChatResponseContent { + kind: 'customSerializable'; + title: string; + items: string[]; + timestamp: number; +} + +export class CustomSerializableContentImpl implements CustomSerializableContent { + readonly kind = 'customSerializable'; + + constructor( + public title: string, + public items: string[], + public timestamp: number + ) { } + + asString(): string { + return `${this.title}: ${this.items.join(', ')}`; + } + + toSerializable(): SerializableChatResponseContentData { + return { + kind: 'customSerializable', + fallbackMessage: `Custom content: ${this.title} (${this.items.length} items)`, + data: { + title: this.title, + items: this.items, + timestamp: this.timestamp + } + }; + } +} + +/** + * Deserializer for custom serializable content. + */ +@injectable() +export class CustomContentDeserializerContribution implements ChatContentDeserializerContribution { + registerDeserializers(registry: ChatContentDeserializerRegistry): void { + registry.register({ + kind: 'customSerializable', + deserialize: (data: CustomSerializableContentData) => + new CustomSerializableContentImpl( + data.title, + data.items, + data.timestamp + ) + }); + } +} + +/** + * Renderer for custom serializable content. + */ +@injectable() +export class CustomSerializableContentRenderer implements ChatResponsePartRenderer { + canHandle(response: ChatResponseContent): number { + return response.kind === 'customSerializable' ? 10 : -1; + } + + render(content: CustomSerializableContent, node: ResponseNode): ReactNode { + const date = new Date(content.timestamp).toLocaleString(); + return React.createElement('div', { + className: 'theia-ChatResponseContent', + style: { + padding: '10px', + margin: '5px 0', + border: '2px solid var(--theia-editorWidget-border)', + borderRadius: '4px', + backgroundColor: 'var(--theia-editor-background)' + } + }, + React.createElement('div', { + style: { + fontWeight: 'bold', + marginBottom: '8px', + color: 'var(--theia-descriptionForeground)' + } + }, `📦 ${content.title}`), + React.createElement('ul', { + style: { + margin: '0', + paddingLeft: '20px' + } + }, ...content.items.map((item, idx) => + React.createElement('li', { key: idx }, item) + )), + React.createElement('div', { + style: { + marginTop: '8px', + fontSize: '0.85em', + color: 'var(--theia-descriptionForeground)', + fontStyle: 'italic' + } + }, `Created: ${date} • ✅ Serializable (will be persisted)`) + ); + } +} + +// ============================================================================= +// NON-SERIALIZABLE CUSTOM CONTENT +// ============================================================================= + +/** + * Non-serializable custom content type. + */ +export interface CustomNonSerializableContent extends ChatResponseContent { + kind: 'customNonSerializable'; + message: string; + onClick: () => void; // Functions cannot be serialized! +} + +export class CustomNonSerializableContentImpl implements CustomNonSerializableContent { + readonly kind = 'customNonSerializable'; + + constructor( + public message: string, + public onClick: () => void + ) { } + + asString(): string { + return `Interactive: ${this.message}`; + } +} + +/** + * Renderer for custom non-serializable content. + * This will only be used for active (non-restored) content. + */ +@injectable() +export class CustomNonSerializableContentRenderer implements ChatResponsePartRenderer { + canHandle(response: ChatResponseContent): number { + return response.kind === 'customNonSerializable' ? 10 : -1; + } + + render(content: CustomNonSerializableContent, node: ResponseNode): ReactNode { + return React.createElement('div', { + className: 'theia-ChatResponseContent', + style: { + padding: '10px', + margin: '5px 0', + border: '2px solid var(--theia-notificationsWarningIcon-foreground)', + borderRadius: '4px', + backgroundColor: 'var(--theia-editor-background)' + } + }, + React.createElement('div', { + style: { + fontWeight: 'bold', + marginBottom: '8px', + color: 'var(--theia-descriptionForeground)' + } + }, '⚡ Interactive Content'), + React.createElement('div', { + style: { marginBottom: '10px' } + }, content.message), + React.createElement('button', { + className: 'theia-button', + onClick: content.onClick, + style: { marginRight: '8px' } + }, 'Click Me!'), + React.createElement('div', { + style: { + marginTop: '8px', + fontSize: '0.85em', + color: 'var(--theia-notificationsWarningIcon-foreground)', + fontStyle: 'italic' + } + }, '⚠️ No deserializer registered (will use fallback for serialization and deserialization)') + ); + } +} + +// ============================================================================= +// DEMO AGENT +// ============================================================================= + +@injectable() +export class CustomResponseContentRendererAgent extends AbstractStreamParsingChatAgent implements ChatAgent { + id = 'CustomContentSample'; + name = this.id; + override description = 'Demonstrates custom serializable and non-serializable chat response content'; + languageModelRequirements = []; + protected defaultLanguageModelPurpose = 'chat'; + + public override async invoke(request: MutableChatRequestModel): Promise { + const response = request.response.response; + + // Add serializable custom content + response.addContent( + new CustomSerializableContentImpl( + 'Serializable Custom Content', + [ + 'This content has a custom data interface', + 'It has a deserializer registered', + 'It will be properly restored when loading a saved session', + 'The renderer shows this custom UI with all data intact' + ], + Date.now() + ) + ); + + // Add interactive button as a demonstration of non-serializable content + let clickCount = 0; + response.addContent( + new CustomNonSerializableContentImpl( + 'This is the LLM message received', + () => { + clickCount++; + alert(`Button clicked ${clickCount} time(s)`); + } + ) + ); + + // Trigger completion immediately - no streaming needed + request.response.complete(); + } +} diff --git a/examples/api-samples.disabled/src/browser/chat/mode-chat-agent-contribution.ts b/examples/api-samples.disabled/src/browser/chat/mode-chat-agent-contribution.ts new file mode 100644 index 0000000..8a1ddf3 --- /dev/null +++ b/examples/api-samples.disabled/src/browser/chat/mode-chat-agent-contribution.ts @@ -0,0 +1,72 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { + AbstractStreamParsingChatAgent, + ChatAgent, + MutableChatRequestModel, + MarkdownChatResponseContentImpl, + SystemMessageDescription +} from '@theia/ai-chat'; +import { Agent, LanguageModelRequirement } from '@theia/ai-core'; +import { injectable, interfaces } from '@theia/core/shared/inversify'; + +export function bindModeChatAgentContribution(bind: interfaces.Bind): void { + bind(ModeChatAgent).toSelf().inSingletonScope(); + bind(Agent).toService(ModeChatAgent); + bind(ChatAgent).toService(ModeChatAgent); +} + +/** + * This is a test agent demonstrating how to use chat modes. + * It responds differently based on the selected mode. + */ +@injectable() +export class ModeChatAgent extends AbstractStreamParsingChatAgent { + readonly id = 'ModeTestSample'; + readonly name = 'ModeTestSample'; + readonly defaultLanguageModelPurpose = 'chat'; + override readonly description = 'A test agent that demonstrates different response modes (concise vs detailed).'; + override languageModelRequirements: LanguageModelRequirement[] = []; + + // Define the modes this agent supports + modes = [ + { id: 'concise', name: 'Concise' }, + { id: 'detailed', name: 'Detailed' } + ]; + + override async invoke(request: MutableChatRequestModel): Promise { + const modeId = request.request.modeId || 'concise'; + const question = request.request.text; + + let response: string; + if (modeId === 'concise') { + response = `**Concise Mode**: You asked: "${question}"\n\nThis is a brief response.`; + } else { + response = `**Detailed Mode**: You asked: "${question}"\n\n` + + 'This is a more detailed response that provides additional context and explanation. ' + + 'In detailed mode, the agent provides more comprehensive information, examples, and background. ' + + 'This mode is useful when you need in-depth understanding of a topic.'; + } + + request.response.response.addContent(new MarkdownChatResponseContentImpl(response)); + request.response.complete(); + } + + protected override async getSystemMessageDescription(): Promise { + return undefined; + } +} diff --git a/examples/api-samples.disabled/src/browser/chat/original-state-test-agent-contribution.ts b/examples/api-samples.disabled/src/browser/chat/original-state-test-agent-contribution.ts new file mode 100644 index 0000000..8ae46a8 --- /dev/null +++ b/examples/api-samples.disabled/src/browser/chat/original-state-test-agent-contribution.ts @@ -0,0 +1,159 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { + AbstractStreamParsingChatAgent, + ChatAgent, + MutableChatRequestModel, + MarkdownChatResponseContentImpl, + SystemMessageDescription +} from '@theia/ai-chat'; +import { ChangeSetFileElementFactory } from '@theia/ai-chat/lib/browser/change-set-file-element'; +import { Agent, LanguageModelRequirement } from '@theia/ai-core'; +import { inject, injectable, interfaces } from '@theia/core/shared/inversify'; +import { wait } from '@theia/core/lib/common/promise-util'; +import { FileService } from '@theia/filesystem/lib/browser/file-service'; +import { WorkspaceService } from '@theia/workspace/lib/browser'; + +export function bindOriginalStateTestAgentContribution(bind: interfaces.Bind): void { + bind(OriginalStateTestAgent).toSelf().inSingletonScope(); + bind(Agent).toService(OriginalStateTestAgent); + bind(ChatAgent).toService(OriginalStateTestAgent); +} + +/** + * This is a test agent demonstrating how to test originalState functionality in change sets. + * It creates change set elements with original content provided and tests sequential updates. + */ +@injectable() +export class OriginalStateTestAgent extends AbstractStreamParsingChatAgent { + readonly id = 'OriginalStateTestSample'; + readonly name = 'OriginalStateTestSample'; + readonly defaultLanguageModelPurpose = 'chat'; + override readonly description = 'This chat will test originalState functionality with sequential changes.'; + override languageModelRequirements: LanguageModelRequirement[] = []; + + @inject(WorkspaceService) + protected readonly workspaceService: WorkspaceService; + + @inject(FileService) + protected readonly fileService: FileService; + + @inject(ChangeSetFileElementFactory) + protected readonly fileChangeFactory: ChangeSetFileElementFactory; + + override async invoke(request: MutableChatRequestModel): Promise { + const roots = this.workspaceService.tryGetRoots(); + if (roots.length === 0) { + request.response.response.addContent(new MarkdownChatResponseContentImpl( + 'No workspace is open. For using this test agent, please open a workspace with at least one file.' + )); + request.response.complete(); + return; + } + + const root = roots[0]; + const files = root.children?.filter(child => child.isFile); + if (!files || files.length === 0) { + request.response.response.addContent(new MarkdownChatResponseContentImpl( + 'The workspace does not contain any files. For using this test agent, please add at least one file in the root.' + )); + request.response.complete(); + return; + } + + const chatSessionId = request.session.id; + const requestId = request.id; + + request.response.response.addContent(new MarkdownChatResponseContentImpl( + 'Testing originalState functionality...\n\n' + + 'Three sequential changes to an existing file with 1000ms delays between each.' + )); + + await wait(1000); + request.session.changeSet.setTitle('Original State Test Changes'); + + // Select an existing file for sequential modifications + const existingFile = files[Math.floor(Math.random() * files.length)]; + const existingFileUri = existingFile.resource; + + // Read the current content to use as originalState + const currentContent = await this.fileService.read(existingFileUri); + const originalState = currentContent.value.toString(); + + // First modification with originalState provided + request.response.response.addContent(new MarkdownChatResponseContentImpl('\n\nCreate modification 1')); + const modifiedContent1 = await this.computeModifiedState(originalState, 1); + await this.fileService.write(existingFileUri, modifiedContent1); + const firstModification = this.fileChangeFactory({ + uri: existingFileUri, + type: 'modify', + state: 'applied', + originalState, + targetState: modifiedContent1, + requestId, + chatSessionId + }); + + request.session.changeSet.addElements(firstModification); + await wait(1000); + + // Second modification with originalState from previous change + request.response.response.addContent(new MarkdownChatResponseContentImpl('\n\nCreate modification 2')); + const modifiedContent2 = await this.computeModifiedState(modifiedContent1, 2); + await this.fileService.write(existingFileUri, modifiedContent2); + const secondModification = this.fileChangeFactory({ + uri: existingFileUri, + type: 'modify', + state: 'applied', + originalState, + targetState: modifiedContent2, + requestId, + chatSessionId + }); + + request.session.changeSet.addElements(secondModification); + await wait(1000); + + // Third modification with originalState from previous change + request.response.response.addContent(new MarkdownChatResponseContentImpl('\n\nCreate modification 3')); + const modifiedContent3 = await this.computeModifiedState(modifiedContent2, 3); + await this.fileService.write(existingFileUri, modifiedContent3); + const thirdModification = this.fileChangeFactory({ + uri: existingFileUri, + type: 'modify', + state: 'applied', + originalState, + targetState: modifiedContent3, + requestId, + chatSessionId + }); + + request.session.changeSet.addElements(thirdModification); + + request.response.response.addContent(new MarkdownChatResponseContentImpl('\n\nTest completed!')); + request.response.complete(); + } + + async computeModifiedState(content: string, changeNumber: number): Promise { + const changeComment = `// Modified by Original State Test Agent - Change ${changeNumber}\n`; + return changeComment + content + `\n// This line was added by change ${changeNumber} at ${new Date().toISOString()}`; + } + + protected override async getSystemMessageDescription(): Promise { + return undefined; + } +} diff --git a/examples/api-samples.disabled/src/browser/chat/sample-chat-command-contribution.ts b/examples/api-samples.disabled/src/browser/chat/sample-chat-command-contribution.ts new file mode 100644 index 0000000..8920cf2 --- /dev/null +++ b/examples/api-samples.disabled/src/browser/chat/sample-chat-command-contribution.ts @@ -0,0 +1,136 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { PromptService } from '@theia/ai-core/lib/common/prompt-service'; +import { FrontendApplicationContribution } from '@theia/core/lib/browser'; +import { inject, injectable, interfaces } from '@theia/core/shared/inversify'; + +export function bindSampleChatCommandContribution(bind: interfaces.Bind): void { + bind(SampleChatCommandContribution).toSelf().inSingletonScope(); + bind(FrontendApplicationContribution).toService(SampleChatCommandContribution); +} + +/** + * This contribution demonstrates how to register slash commands as prompt fragments for chat agents. + * Commands can use argument substitution ($ARGUMENTS, $1, $2, etc.) and be filtered by agent. + * + * The commands registered here will be available in the chat input autocomplete when typing '/'. + * For example, the '/explain' command is only available when using the 'Universal' agent. + */ +@injectable() +export class SampleChatCommandContribution implements FrontendApplicationContribution { + + @inject(PromptService) + protected readonly promptService: PromptService; + + onStart(): void { + this.registerCommands(); + } + + protected registerCommands(): void { + // Example 1: Simple command available for all agents + this.promptService.addBuiltInPromptFragment({ + id: 'sample-hello', + template: 'Say hello to $ARGUMENTS in a friendly way.', + isCommand: true, + commandName: 'hello', + commandDescription: 'Say hello to someone', + commandArgumentHint: '' + }); + + // Example 2: Command with $ARGUMENTS and specific agent + this.promptService.addBuiltInPromptFragment({ + id: 'sample-explain', + template: `Provide a clear and detailed explanation of the following topic: $ARGUMENTS + +Consider: +- Core concepts and definitions +- Practical examples +- Common use cases +- Best practices`, + isCommand: true, + commandName: 'explain', + commandDescription: 'Explain a concept in detail', + commandArgumentHint: '', + commandAgents: ['Universal'] + }); + + // Example 3: Command with numbered arguments ($1, $2) + this.promptService.addBuiltInPromptFragment({ + id: 'sample-compare', + template: `Compare and contrast the following two items: + +Item 1: $1 +Item 2: $2 + +Please analyze: +- Key similarities +- Important differences +- When to use each +- Specific advantages and disadvantages`, + isCommand: true, + commandName: 'compare', + commandDescription: 'Compare two concepts or items', + commandArgumentHint: ' ', + commandAgents: ['Universal'] + }); + + // Example 4: Command combining $ARGUMENTS with variables + this.promptService.addBuiltInPromptFragment({ + id: 'sample-analyze', + template: `Analyze the selected code with focus on: $ARGUMENTS + +Selected code: +#selection + +Consider the overall file context: +#file`, + isCommand: true, + commandName: 'analyze', + commandDescription: 'Analyze code with specific focus', + commandArgumentHint: '', + commandAgents: ['Universal'] + }); + + // Example 5: Command with optional arguments (shown by [] in hint) + this.promptService.addBuiltInPromptFragment({ + id: 'sample-summarize', + template: `Create a concise summary of the following content$1. + +Content: $ARGUMENTS`, + isCommand: true, + commandName: 'summarize', + commandDescription: 'Summarize content', + commandArgumentHint: ' [style]' + }); + + // Example 6: Multi-agent command (available for multiple specific agents) + this.promptService.addBuiltInPromptFragment({ + id: 'sample-debug', + template: `Help debug the following issue: $ARGUMENTS + +Focus on: +- Identifying the root cause +- Providing specific solutions +- Suggesting preventive measures`, + isCommand: true, + commandName: 'debug', + commandDescription: 'Get help debugging an issue', + commandArgumentHint: '', + commandAgents: ['Universal', 'AskAndContinue'] + }); + } +} diff --git a/examples/api-samples.disabled/src/browser/contribution-filter/sample-filtered-command-contribution.ts b/examples/api-samples.disabled/src/browser/contribution-filter/sample-filtered-command-contribution.ts new file mode 100644 index 0000000..82709e9 --- /dev/null +++ b/examples/api-samples.disabled/src/browser/contribution-filter/sample-filtered-command-contribution.ts @@ -0,0 +1,71 @@ +// ***************************************************************************** +// Copyright (C) 2021 STMicroelectronics and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { Command, CommandContribution, CommandRegistry, ContributionFilterRegistry, FilterContribution, bindContribution } from '@theia/core/lib/common'; +import { injectable, interfaces } from '@theia/core/shared/inversify'; + +export namespace SampleFilteredCommand { + + const API_SAMPLES_CATEGORY = 'API Samples'; + + export const FILTERED: Command = { + id: 'example_command.filtered', + category: API_SAMPLES_CATEGORY, + label: 'This command should be filtered out' + }; + + export const FILTERED2: Command = { + id: 'example_command.filtered2', + category: API_SAMPLES_CATEGORY, + label: 'This command should be filtered out (2)' + }; +} + +/** + * This sample command is used to test the runtime filtering of already bound contributions. + */ +@injectable() +export class SampleFilteredCommandContribution implements CommandContribution { + + registerCommands(commands: CommandRegistry): void { + commands.registerCommand(SampleFilteredCommand.FILTERED, { execute: () => { } }); + } +} + +@injectable() +export class SampleFilterAndCommandContribution implements FilterContribution, CommandContribution { + + registerCommands(commands: CommandRegistry): void { + commands.registerCommand(SampleFilteredCommand.FILTERED2, { execute: () => { } }); + } + + registerContributionFilters(registry: ContributionFilterRegistry): void { + registry.addFilters([CommandContribution], [ + // filter ourselves out + contrib => contrib.constructor !== this.constructor + ]); + registry.addFilters('*', [ + // filter a contribution based on its class type + contrib => !(contrib instanceof SampleFilteredCommandContribution) + ]); + } +} + +export function bindSampleFilteredCommandContribution(bind: interfaces.Bind): void { + bind(CommandContribution).to(SampleFilteredCommandContribution).inSingletonScope(); + bind(SampleFilterAndCommandContribution).toSelf().inSingletonScope(); + bindContribution(bind, SampleFilterAndCommandContribution, [CommandContribution, FilterContribution]); +} diff --git a/examples/api-samples.disabled/src/browser/file-system/sample-file-system-capabilities.ts b/examples/api-samples.disabled/src/browser/file-system/sample-file-system-capabilities.ts new file mode 100644 index 0000000..f4db9da --- /dev/null +++ b/examples/api-samples.disabled/src/browser/file-system/sample-file-system-capabilities.ts @@ -0,0 +1,71 @@ +/******************************************************************************** + * Copyright (C) 2024 TypeFox and others. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the Eclipse + * Public License v. 2.0 are satisfied: GNU General Public License, version 2 + * with the GNU Classpath Exception which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 + ********************************************************************************/ + +import { CommandContribution, CommandRegistry } from '@theia/core'; +import { inject, injectable, interfaces } from '@theia/core/shared/inversify'; +import { RemoteFileSystemProvider } from '@theia/filesystem/lib/common/remote-file-system-provider'; +import { FileSystemProviderCapabilities } from '@theia/filesystem/lib/common/files'; +import { MarkdownStringImpl } from '@theia/core/lib/common/markdown-rendering'; + +@injectable() +export class SampleFileSystemCapabilities implements CommandContribution { + + @inject(RemoteFileSystemProvider) + protected readonly remoteFileSystemProvider: RemoteFileSystemProvider; + + registerCommands(commands: CommandRegistry): void { + commands.registerCommand({ + id: 'toggleFileSystemReadonly', + label: 'Toggle File System Readonly', + category: 'API Samples' + }, { + execute: () => { + const readonly = (this.remoteFileSystemProvider.capabilities & FileSystemProviderCapabilities.Readonly) !== 0; + if (readonly) { + this.remoteFileSystemProvider['setCapabilities'](this.remoteFileSystemProvider.capabilities & ~FileSystemProviderCapabilities.Readonly); + } else { + this.remoteFileSystemProvider['setCapabilities'](this.remoteFileSystemProvider.capabilities | FileSystemProviderCapabilities.Readonly); + } + } + }); + + commands.registerCommand({ + id: 'addFileSystemReadonlyMessage', + label: 'Add File System ReadonlyMessage', + category: 'API Samples' + }, { + execute: () => { + const readonlyMessage = new MarkdownStringImpl(`Added new **Markdown** string '+${Date.now()}`); + this.remoteFileSystemProvider['setReadOnlyMessage'](readonlyMessage); + } + }); + + commands.registerCommand({ + id: 'removeFileSystemReadonlyMessage', + label: 'Remove File System ReadonlyMessage', + category: 'API Samples' + }, { + execute: () => { + this.remoteFileSystemProvider['setReadOnlyMessage'](undefined); + } + }); + } + +} + +export function bindSampleFileSystemCapabilitiesCommands(bind: interfaces.Bind): void { + bind(CommandContribution).to(SampleFileSystemCapabilities).inSingletonScope(); +} diff --git a/examples/api-samples.disabled/src/browser/file-watching/sample-file-watching-contribution.ts b/examples/api-samples.disabled/src/browser/file-watching/sample-file-watching-contribution.ts new file mode 100644 index 0000000..aa041b8 --- /dev/null +++ b/examples/api-samples.disabled/src/browser/file-watching/sample-file-watching-contribution.ts @@ -0,0 +1,87 @@ +// ***************************************************************************** +// Copyright (C) 2020 Ericsson and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { postConstruct, injectable, inject, interfaces, named } from '@theia/core/shared/inversify'; +import { + FrontendApplicationContribution, LabelProvider, +} from '@theia/core/lib/browser'; +import { ILogger } from '@theia/core/lib/common/logger'; +import { FileService } from '@theia/filesystem/lib/browser/file-service'; +import { WorkspaceService } from '@theia/workspace/lib/browser'; +import { createPreferenceProxy, PreferenceService, PreferenceProxy, PreferenceContribution } from '@theia/core'; +import { FileWatchingPreferencesSchema } from '../../common/preference-schema'; + +export function bindSampleFileWatching(bind: interfaces.Bind): void { + bind(FrontendApplicationContribution).to(SampleFileWatchingContribution).inSingletonScope(); + bind(PreferenceContribution).toConstantValue({ schema: FileWatchingPreferencesSchema }); + bind(FileWatchingPreferences).toDynamicValue( + ctx => createPreferenceProxy(ctx.container.get(PreferenceService), FileWatchingPreferencesSchema) + ); +} + +const FileWatchingPreferences = Symbol('FileWatchingPreferences'); +type FileWatchingPreferences = PreferenceProxy; + +interface FileWatchingPreferencesSchema { + 'sample.file-watching.verbose': boolean +} + +@injectable() +class SampleFileWatchingContribution implements FrontendApplicationContribution { + + protected verbose: boolean; + + @inject(FileService) + protected readonly fileService: FileService; + + @inject(LabelProvider) + protected readonly labelProvider: LabelProvider; + + @inject(WorkspaceService) + protected readonly workspaceService: WorkspaceService; + + @inject(FileWatchingPreferences) + protected readonly fileWatchingPreferences: FileWatchingPreferences; + + @inject(ILogger) @named('api-samples') + protected readonly logger: ILogger; + + @postConstruct() + protected init(): void { + this.verbose = this.fileWatchingPreferences['sample.file-watching.verbose']; + this.fileWatchingPreferences.onPreferenceChanged(e => { + if (e.preferenceName === 'sample.file-watching.verbose') { + this.verbose = this.fileWatchingPreferences['sample.file-watching.verbose']; + } + }); + } + + onStart(): void { + this.fileService.onDidFilesChange(event => { + // Only log if the verbose preference is set. + if (this.verbose) { + // Get the workspace roots for the current frontend: + const roots = this.workspaceService.tryGetRoots(); + // Create some name to help find out which frontend logged the message: + const workspace = roots.length > 0 + ? roots.map(root => this.labelProvider.getLongName(root.resource)).join('+') + : ''; + this.logger.info(`Sample File Watching: ${event.changes.length} file(s) changed! ${workspace}`); + } + }); + } + +} diff --git a/examples/api-samples.disabled/src/browser/icons/theia.png b/examples/api-samples.disabled/src/browser/icons/theia.png new file mode 100644 index 0000000..a895160 Binary files /dev/null and b/examples/api-samples.disabled/src/browser/icons/theia.png differ diff --git a/examples/api-samples.disabled/src/browser/label/sample-dynamic-label-provider-command-contribution.ts b/examples/api-samples.disabled/src/browser/label/sample-dynamic-label-provider-command-contribution.ts new file mode 100644 index 0000000..fe20d29 --- /dev/null +++ b/examples/api-samples.disabled/src/browser/label/sample-dynamic-label-provider-command-contribution.ts @@ -0,0 +1,61 @@ +// ***************************************************************************** +// Copyright (C) 2019 Arm and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { injectable, inject, interfaces } from '@theia/core/shared/inversify'; +import { Command, CommandContribution, CommandRegistry, CommandHandler } from '@theia/core'; +import { FrontendApplicationContribution, LabelProviderContribution } from '@theia/core/lib/browser'; +import { SampleDynamicLabelProviderContribution } from './sample-dynamic-label-provider-contribution'; + +export namespace ExampleLabelProviderCommands { + const API_SAMPLES_CATEGORY = 'API Samples'; + export const TOGGLE_SAMPLE: Command = { + id: 'example_label_provider.toggle', + category: API_SAMPLES_CATEGORY, + label: 'Toggle Dynamically-Changing Labels' + }; +} + +@injectable() +export class SampleDynamicLabelProviderCommandContribution implements FrontendApplicationContribution, CommandContribution { + + @inject(SampleDynamicLabelProviderContribution) + protected readonly labelProviderContribution: SampleDynamicLabelProviderContribution; + + initialize(): void { } + + registerCommands(commands: CommandRegistry): void { + commands.registerCommand(ExampleLabelProviderCommands.TOGGLE_SAMPLE, new ExampleLabelProviderCommandHandler(this.labelProviderContribution)); + } + +} + +export class ExampleLabelProviderCommandHandler implements CommandHandler { + + constructor(private readonly labelProviderContribution: SampleDynamicLabelProviderContribution) { + } + + // eslint-disable-next-line @typescript-eslint/no-explicit-any + execute(...args: any[]): any { + this.labelProviderContribution.toggle(); + } + +} + +export const bindDynamicLabelProvider = (bind: interfaces.Bind) => { + bind(SampleDynamicLabelProviderContribution).toSelf().inSingletonScope(); + bind(LabelProviderContribution).toService(SampleDynamicLabelProviderContribution); + bind(CommandContribution).to(SampleDynamicLabelProviderCommandContribution).inSingletonScope(); +}; diff --git a/examples/api-samples.disabled/src/browser/label/sample-dynamic-label-provider-contribution.ts b/examples/api-samples.disabled/src/browser/label/sample-dynamic-label-provider-contribution.ts new file mode 100644 index 0000000..9fa4aff --- /dev/null +++ b/examples/api-samples.disabled/src/browser/label/sample-dynamic-label-provider-contribution.ts @@ -0,0 +1,91 @@ +// ***************************************************************************** +// Copyright (C) 2019 Arm and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { injectable } from '@theia/core/shared/inversify'; +import { DefaultUriLabelProviderContribution, DidChangeLabelEvent } from '@theia/core/lib/browser/label-provider'; +import URI from '@theia/core/lib/common/uri'; +import { Emitter, Event } from '@theia/core'; + +@injectable() +export class SampleDynamicLabelProviderContribution extends DefaultUriLabelProviderContribution { + + protected isActive: boolean = false; + + constructor() { + super(); + const outer = this; + + setInterval(() => { + if (this.isActive) { + outer.x++; + outer.fireLabelsDidChange(); + } + }, 1000); + } + + override canHandle(element: object): number { + if (this.isActive && element.toString().includes('test')) { + return 30; + } + return 0; + } + + toggle(): void { + this.isActive = !this.isActive; + this.fireLabelsDidChange(); + } + + private fireLabelsDidChange(): void { + this.onDidChangeEmitter.fire({ + affects: (element: URI) => element.toString().includes('test') + }); + } + + protected override getUri(element: URI): URI { + return new URI(element.toString()); + } + + override getIcon(element: URI): string { + const uri = this.getUri(element); + const icon = super.getFileIcon(uri); + if (!icon) { + return this.defaultFileIcon; + } + return icon; + } + + protected override readonly onDidChangeEmitter = new Emitter(); + private x: number = 0; + + override getName(element: URI): string | undefined { + const uri = this.getUri(element); + if (this.isActive && uri.toString().includes('test')) { + return super.getName(uri) + '-' + this.x.toString(10); + } else { + return super.getName(uri); + } + } + + override getLongName(element: URI): string | undefined { + const uri = this.getUri(element); + return super.getLongName(uri); + } + + override get onDidChange(): Event { + return this.onDidChangeEmitter.event; + } + +} diff --git a/examples/api-samples.disabled/src/browser/mcp/resolve-frontend-mcp-contribution.ts b/examples/api-samples.disabled/src/browser/mcp/resolve-frontend-mcp-contribution.ts new file mode 100644 index 0000000..47e0c17 --- /dev/null +++ b/examples/api-samples.disabled/src/browser/mcp/resolve-frontend-mcp-contribution.ts @@ -0,0 +1,63 @@ +// ***************************************************************************** +// Copyright (C) 2025 Dirk Fauth and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { MCPFrontendService, RemoteMCPServerDescription } from '@theia/ai-mcp'; +import { inject, injectable, named } from '@theia/core/shared/inversify'; +import { FrontendApplicationContribution, QuickInputService } from '@theia/core/lib/browser'; +import { ILogger } from '@theia/core/lib/common/logger'; + +@injectable() +export class ResolveMcpFrontendContribution + implements FrontendApplicationContribution { + + @inject(MCPFrontendService) + protected readonly mcpFrontendService: MCPFrontendService; + + @inject(QuickInputService) + protected readonly quickInputService: QuickInputService; + + @inject(ILogger) @named('api-samples') + protected readonly logger: ILogger; + + async onStart(): Promise { + const githubServer: RemoteMCPServerDescription = { + name: 'github', + serverUrl: 'https://api.githubcopilot.com/mcp/', + resolve: async serverDescription => { + this.logger.debug('Resolving GitHub MCP server description'); + + // Prompt user for authentication token + const authToken = await this.quickInputService.input({ + prompt: 'Enter authentication token for GitHubMCP server', + password: true, + value: 'serverAuthToken' in serverDescription ? serverDescription.serverAuthToken || '' : '' + }); + + if (authToken) { + // Return updated server description with new token + return { + ...serverDescription, + serverAuthToken: authToken + } as RemoteMCPServerDescription; + } + + // If no token provided, return original description + return serverDescription; + } + }; + this.mcpFrontendService.addOrUpdateServer(githubServer); + } +} diff --git a/examples/api-samples.disabled/src/browser/mcp/sample-frontend-mcp-contribution.ts b/examples/api-samples.disabled/src/browser/mcp/sample-frontend-mcp-contribution.ts new file mode 100644 index 0000000..9a48832 --- /dev/null +++ b/examples/api-samples.disabled/src/browser/mcp/sample-frontend-mcp-contribution.ts @@ -0,0 +1,218 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { inject, injectable, named } from '@theia/core/shared/inversify'; +import { WorkspaceService } from '@theia/workspace/lib/browser/workspace-service'; +import { Tool, Resource, Prompt, PromptMessage } from '@modelcontextprotocol/sdk/types'; +import { z } from 'zod'; +import { MCPFrontendContribution, ToolProvider } from '@theia/ai-mcp-server/lib/browser/mcp-frontend-contribution'; +import { ILogger } from '@theia/core/lib/common/logger'; + +/** + * Sample frontend MCP contribution that demonstrates accessing frontend-only services + */ +@injectable() +export class SampleFrontendMCPContribution implements MCPFrontendContribution { + @inject(WorkspaceService) + protected readonly workspaceService: WorkspaceService; + + @inject(ILogger) @named('api-samples') + protected readonly logger: ILogger; + + async getTools(): Promise { + return [ + { + name: 'sample-workspace-info', + description: 'Get information about the current workspace', + inputSchema: { + type: 'object', + properties: {}, + required: [] + } + }, + { + name: 'sample-workspace-files', + description: 'List files in the workspace', + inputSchema: { + type: 'object', + properties: { + pattern: { + type: 'string', + description: 'Optional pattern to filter files' + } + }, + required: [] + } + } + ]; + } + + async getTool(name: string): Promise { + switch (name) { + case 'sample-workspace-info': + return { + handler: async args => { + try { + this.logger.debug('Getting workspace info with args:', args); + const roots = await this.workspaceService.roots; + return { + workspace: { + roots: roots.map(r => r.resource.toString()), + name: roots[0]?.name || 'Unknown' + } + }; + } catch (error) { + this.logger.error('Error getting workspace info:', error); + throw error; + } + }, + inputSchema: z.object({}) + }; + + case 'sample-workspace-files': + return { + handler: async args => { + try { + this.logger.debug('Listing workspace files with args:', args); + const typedArgs = args as { pattern?: string }; + + // Here we could use the FileService to collect all file information from the workspace + // const roots = await this.workspaceService.roots; + // const files: string[] = []; + // for (const root of roots) { + // const rootUri = new URI(root.resource.toString()); + // const stat = await this.fileService.resolve(rootUri); + // if (stat.children) { + // for (const child of stat.children) { + // files.push(child.resource.toString()); + // } + // } + // } + + // Return dummy content for demonstration purposes + const dummyFiles = [ + 'foo1.txt', + 'foo2.txt', + 'bar1.js', + 'bar2.js', + 'baz1.md', + 'baz2.md', + 'config.json', + 'package.json', + 'README.md' + ]; + + return { + files: typedArgs.pattern ? dummyFiles.filter(f => f.includes(typedArgs.pattern!)) : dummyFiles + }; + } catch (error) { + this.logger.error('Error listing workspace files:', error); + throw error; + } + }, + inputSchema: z.object({ + pattern: z.string().optional() + }) + }; + + default: + return undefined; + } + } + + async getResources(): Promise { + return [ + { + uri: 'sample-workspace://info', + name: 'Sample Workspace Information', + description: 'General information about the current workspace', + mimeType: 'application/json' + } + ]; + } + + async readResource(uri: string): Promise { + if (uri === 'sample-workspace://info') { + try { + const roots = await this.workspaceService.roots; + return { + workspace: { + roots: roots.map(r => ({ + uri: r.resource.toString(), + name: r.name, + scheme: r.resource.scheme + })), + rootCount: roots.length + } + }; + } catch (error) { + this.logger.error('Error reading workspace resource:', error); + throw error; + } + } + throw new Error(`Unknown resource: ${uri}`); + } + + async getPrompts(): Promise { + return [ + { + name: 'sample-workspace-context', + description: 'Generate context information about the workspace', + arguments: [ + { + name: 'includeFiles', + description: 'Whether to include file listings', + required: false + } + ] + } + ]; + } + + async getPrompt(name: string, args: unknown): Promise { + if (name === 'sample-workspace-context') { + try { + const parsedArgs = args as { includeFiles?: boolean }; + const roots = await this.workspaceService.roots; + + let content = 'Current workspace information:\n\n'; + content += `Number of workspace roots: ${roots.length}\n`; + + for (const root of roots) { + content += `- Root: ${root.name} (${root.resource.toString()})\n`; + } + + if (parsedArgs.includeFiles) { + content += '\nFile structure would be included here in a real implementation.'; + } + + return [ + { + role: 'user', + content: { + type: 'text', + text: content + } + } + ]; + } catch (error) { + this.logger.error('Error generating workspace context prompt:', error); + throw error; + } + } + throw new Error(`Unknown prompt: ${name}`); + } +} diff --git a/examples/api-samples.disabled/src/browser/menu/sample-menu-contribution.ts b/examples/api-samples.disabled/src/browser/menu/sample-menu-contribution.ts new file mode 100644 index 0000000..f46769e --- /dev/null +++ b/examples/api-samples.disabled/src/browser/menu/sample-menu-contribution.ts @@ -0,0 +1,335 @@ +// ***************************************************************************** +// Copyright (C) 2020 TORO Limited and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { ConfirmDialog, Dialog, QuickInputService } from '@theia/core/lib/browser'; +import { ReactDialog } from '@theia/core/lib/browser/dialogs/react-dialog'; +import { SelectComponent } from '@theia/core/lib/browser/widgets/select-component'; +import { + Command, CommandContribution, CommandMenu, CommandRegistry, ContextExpressionMatcher, MAIN_MENU_BAR, + MenuContribution, MenuModelRegistry, MenuPath, MessageService +} from '@theia/core/lib/common'; +import { ILogger } from '@theia/core/lib/common/logger'; +import { inject, injectable, interfaces, named } from '@theia/core/shared/inversify'; +import * as React from '@theia/core/shared/react'; +import { ReactNode } from '@theia/core/shared/react'; + +const API_SAMPLES_CATEGORY = 'API Samples'; + +const SampleCommand: Command = { + id: 'sample-command', + label: 'Command', + category: API_SAMPLES_CATEGORY +}; +const SampleCommand2: Command = { + id: 'sample-command2', + label: 'Command 2', + category: API_SAMPLES_CATEGORY +}; +const SampleCommandConfirmDialog: Command = { + id: 'sample-command-confirm-dialog', + label: 'Confirm Dialog', + category: API_SAMPLES_CATEGORY +}; +const SampleComplexCommandConfirmDialog: Command = { + id: 'sample-command-complex-confirm-dialog', + label: 'Complex Confirm Dialog', + category: API_SAMPLES_CATEGORY +}; +const SampleCommandWithProgressMessage: Command = { + id: 'sample-command-with-progress', + label: 'Command With Progress Message', + category: API_SAMPLES_CATEGORY +}; +const SampleCommandWithIndeterminateProgressMessage: Command = { + id: 'sample-command-with-indeterminate-progress', + label: 'Command With Indeterminate Progress Message', + category: API_SAMPLES_CATEGORY +}; +const SampleQuickInputCommand: Command = { + id: 'sample-quick-input-command', + label: 'Test Positive Integer', + category: API_SAMPLES_CATEGORY +}; +const SampleSelectDialog: Command = { + id: 'sample-command-select-dialog', + label: 'Select Component Dialog', + category: API_SAMPLES_CATEGORY +}; +const SamplePersistentNotification: Command = { + id: 'sample-persistent-notification', + label: 'Persistent Notification (No Timeout)', + category: API_SAMPLES_CATEGORY +}; +const SampleVanishingNotification: Command = { + id: 'sample-vanishing-notification', + label: 'Vanishing Notification (500ms Timeout)', + category: API_SAMPLES_CATEGORY +}; + +@injectable() +export class SampleCommandContribution implements CommandContribution { + + @inject(QuickInputService) + protected readonly quickInputService: QuickInputService; + + @inject(MessageService) + protected readonly messageService: MessageService; + + @inject(ILogger) @named('api-samples') + protected readonly logger: ILogger; + + registerCommands(commands: CommandRegistry): void { + commands.registerCommand({ id: 'create-quick-pick-sample', label: 'Internal QuickPick', category: API_SAMPLES_CATEGORY }, { + execute: () => { + const pick = this.quickInputService.createQuickPick(); + pick.items = [{ label: '1' }, { label: '2' }, { label: '3' }]; + pick.onDidAccept(() => { + this.logger.debug(`accepted: ${pick.selectedItems[0]?.label}`); + pick.hide(); + }); + pick.show(); + } + }); + commands.registerCommand(SampleCommand, { + execute: () => { + alert('This is a sample command!'); + } + }); + commands.registerCommand(SampleCommand2, { + execute: () => { + alert('This is sample command2!'); + } + }); + commands.registerCommand(SampleCommandConfirmDialog, { + execute: async () => { + const choice = await new ConfirmDialog({ + title: 'Sample Confirm Dialog', + msg: 'This is a sample with lots of text:' + Array(100) + .fill(undefined) + .map((element, index) => `\n\nExtra line #${index}`) + .join('') + }).open(); + this.messageService.info(`Sample confirm dialog returned with: \`${JSON.stringify(choice)}\``); + } + }); + commands.registerCommand(SampleComplexCommandConfirmDialog, { + execute: async () => { + const mainDiv = document.createElement('div'); + for (const color of ['#FF00007F', '#00FF007F', '#0000FF7F']) { + const innerDiv = document.createElement('div'); + innerDiv.textContent = 'This is a sample with lots of text:' + Array(50) + .fill(undefined) + .map((_, index) => `\n\nExtra line #${index}`) + .join(''); + innerDiv.style.backgroundColor = color; + innerDiv.style.padding = '5px'; + mainDiv.appendChild(innerDiv); + } + const choice = await new ConfirmDialog({ + title: 'Sample Confirm Dialog', + msg: mainDiv + }).open(); + this.messageService.info(`Sample confirm dialog returned with: \`${JSON.stringify(choice)}\``); + } + }); + commands.registerCommand(SampleSelectDialog, { + execute: async () => { + await new class extends ReactDialog { + constructor() { + super({ title: 'Sample Select Component Dialog' }); + this.appendAcceptButton(Dialog.OK); + } + protected override render(): ReactNode { + return React.createElement(SelectComponent, { + options: Array.from(Array(10).keys()).map(i => ({ label: 'Option ' + ++i })), + defaultValue: 0 + }); + } + override get value(): boolean { + return true; + } + }().open(); + } + }); + commands.registerCommand(SampleQuickInputCommand, { + execute: async () => { + const result = await this.quickInputService.input({ + placeHolder: 'Please provide a positive integer', + validateInput: async (input: string) => { + const numericValue = Number(input); + if (isNaN(numericValue)) { + return 'Invalid: NaN'; + } else if (numericValue % 2 === 1) { + return 'Invalid: Odd Number'; + } else if (numericValue < 0) { + return 'Invalid: Negative Number'; + } else if (!Number.isInteger(numericValue)) { + return 'Invalid: Only Integers Allowed'; + } + } + }); + if (result) { + this.messageService.info(`Positive Integer: ${result}`); + } + } + }); + commands.registerCommand(SampleCommandWithProgressMessage, { + execute: () => { + this.messageService + .showProgress({ + text: 'Starting to report progress', + }) + .then(progress => { + window.setTimeout(() => { + progress.report({ + message: 'First step completed', + work: { done: 25, total: 100 } + }); + }, 2000); + window.setTimeout(() => { + progress.report({ + message: 'Next step completed', + work: { done: 60, total: 100 } + }); + }, 4000); + window.setTimeout(() => { + progress.report({ + message: 'Complete', + work: { done: 100, total: 100 } + }); + }, 6000); + window.setTimeout(() => progress.cancel(), 7000); + }); + } + }); + commands.registerCommand(SampleCommandWithIndeterminateProgressMessage, { + execute: () => { + this.messageService + .showProgress({ + text: 'Starting to report indeterminate progress', + }) + .then(progress => { + window.setTimeout(() => { + progress.report({ + message: 'First step completed', + }); + }, 2000); + window.setTimeout(() => { + progress.report({ + message: 'Next step completed', + }); + }, 4000); + window.setTimeout(() => { + progress.report({ + message: 'Complete', + }); + }, 6000); + window.setTimeout(() => progress.cancel(), 7000); + }); + } + }); + commands.registerCommand(SamplePersistentNotification, { + execute: () => { + this.messageService.info( + 'This notification will stay visible until you dismiss it manually.', + { timeout: 0 } + ); + } + }); + commands.registerCommand(SampleVanishingNotification, { + execute: () => { + this.messageService.info( + 'This notification will stay visible for 500ms.', + { timeout: 500 } + ); + } + }); + } + +} + +@injectable() +export class SampleMenuContribution implements MenuContribution { + registerMenus(menus: MenuModelRegistry): void { + setTimeout(() => { + const subMenuPath = [...MAIN_MENU_BAR, 'sample-menu']; + menus.registerSubmenu(subMenuPath, 'Sample Menu', { sortString: '2' }); // that should put the menu right next to the File menu + + menus.registerMenuAction(subMenuPath, { + commandId: SampleCommand.id, + order: '0' + }); + menus.registerMenuAction(subMenuPath, { + commandId: SampleCommand2.id, + order: '2' + }); + const subSubMenuPath = [...subMenuPath, 'sample-sub-menu']; + menus.registerSubmenu(subSubMenuPath, 'Sample sub menu', { sortString: '2' }); + menus.registerMenuAction(subSubMenuPath, { + commandId: SampleCommand.id, + order: '1' + }); + menus.registerMenuAction(subSubMenuPath, { + commandId: SampleCommand2.id, + order: '3' + }); + const placeholder = new PlaceholderMenuNode([...subSubMenuPath, 'placeholder'].join('-'), 'Placeholder', '0'); + menus.registerCommandMenu(subSubMenuPath, placeholder); + + /** + * Register an action menu with an invalid command (un-registered and without a label) in order + * to determine that menus and the layout does not break on startup. + */ + menus.registerMenuAction(subMenuPath, { commandId: 'invalid-command' }); + }, 10000); + } +} + +/** + * Special menu node that is not backed by any commands and is always disabled. + */ +export class PlaceholderMenuNode implements CommandMenu { + + constructor(readonly id: string, public readonly label: string, readonly order?: string, readonly icon?: string) { } + + isEnabled(effectiveMenuPath: MenuPath, ...args: unknown[]): boolean { + return false; + } + + isToggled(effectiveMenuPath: MenuPath): boolean { + return false; + } + run(effectiveMenuPath: MenuPath, ...args: unknown[]): Promise { + throw new Error('Should never happen'); + } + getAccelerator(context: HTMLElement | undefined): string[] { + return []; + } + + get sortString(): string { + return this.order || this.label; + } + + isVisible(effectiveMenuPath: MenuPath, contextMatcher: ContextExpressionMatcher, context: T | undefined, ...args: unknown[]): boolean { + return true; + } + +} + +export const bindSampleMenu = (bind: interfaces.Bind) => { + bind(CommandContribution).to(SampleCommandContribution).inSingletonScope(); + bind(MenuContribution).to(SampleMenuContribution).inSingletonScope(); +}; diff --git a/examples/api-samples.disabled/src/browser/monaco-editor-preferences/monaco-editor-preference-extractor.ts b/examples/api-samples.disabled/src/browser/monaco-editor-preferences/monaco-editor-preference-extractor.ts new file mode 100644 index 0000000..f0ec6b6 --- /dev/null +++ b/examples/api-samples.disabled/src/browser/monaco-editor-preferences/monaco-editor-preference-extractor.ts @@ -0,0 +1,277 @@ +/******************************************************************************** + * Copyright (C) 2022 Ericsson and others. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the Eclipse + * Public License v. 2.0 are satisfied: GNU General Public License, version 2 + * with the GNU Classpath Exception which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 + ********************************************************************************/ + +/** + * The command contributed in this file allows us to generate a copy of the schema expected for editor preferences by Monaco, + * as well as an interface corresponding to those properties for use with our EditorPreferences PreferenceProxy. + * It examines the schemata registered with the Monaco `ConfigurationRegistry` and writes any configurations associated with the editor + * to a file in the `editor` package. It also generates an interface based on the types specified in the schema. + * The only manual work required during a Monaco uplift is to run the command and then update any fields of the interface where the + * schema type is `array` or `object`, since it is tricky to extract the type details for such fields automatically. + */ +import { ConfigurationScope, Extensions, IConfigurationRegistry } from '@theia/monaco-editor-core/esm/vs/platform/configuration/common/configurationRegistry'; +import { Registry } from '@theia/monaco-editor-core/esm/vs/platform/registry/common/platform'; +import { CommandContribution, CommandRegistry, MaybeArray, MessageService, nls, PreferenceScope } from '@theia/core'; +import { inject, injectable, interfaces } from '@theia/core/shared/inversify'; +import { FileService } from '@theia/filesystem/lib/browser/file-service'; +import { WorkspaceService } from '@theia/workspace/lib/browser'; +import { PreferenceValidationService } from '@theia/core/lib/browser'; +import { JSONValue } from '@theia/core/shared/@lumino/coreutils'; +import { JsonType } from '@theia/core/lib/common/json-schema'; +import { editorOptionsRegistry } from '@theia/monaco-editor-core/esm/vs/editor/common/config/editorOptions'; +import { MonacoEditorProvider } from '@theia/monaco/lib/browser/monaco-editor-provider'; +import { PreferenceDataProperty } from '@theia/core/lib/common/preferences/preference-schema'; + +function generateContent(properties: string, interfaceEntries: string[]): string { + return `/******************************************************************************** + * Copyright (C) 2022 Ericsson and others. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the Eclipse + * Public License v. 2.0 are satisfied: GNU General Public License, version 2 + * with the GNU Classpath Exception which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 + ********************************************************************************/ + +import { isOSX, isWindows, nls } from '@theia/core'; +import { PreferenceSchema } from '@theia/core/lib/browser'; + +/* eslint-disable @typescript-eslint/quotes,max-len,no-null/no-null */ + +/** + * Please do not modify this file by hand. It should be generated automatically + * during a Monaco uplift using the command registered by monaco-editor-preference-extractor.ts + * The only manual work required is fixing preferences with type 'array' or 'object'. + */ + +export const editorGeneratedPreferenceProperties: PreferenceSchema['properties'] = ${properties}; + +export interface GeneratedEditorPreferences { + ${interfaceEntries.join('\n ')} +} +`; +} +const dequoteMarker = '@#@'; + +// From src/vs/editor/common/config/editorOptions.ts +const DEFAULT_WINDOWS_FONT_FAMILY = "Consolas, \\'Courier New\\', monospace"; +const DEFAULT_MAC_FONT_FAMILY = "Menlo, Monaco, \\'Courier New\\', monospace"; +const DEFAULT_LINUX_FONT_FAMILY = "\\'Droid Sans Mono\\', \\'monospace\\', monospace"; + +const fontFamilyText = `${dequoteMarker}isOSX ? '${DEFAULT_MAC_FONT_FAMILY}' : isWindows ? '${DEFAULT_WINDOWS_FONT_FAMILY}' : '${DEFAULT_LINUX_FONT_FAMILY}'${dequoteMarker}`; +const fontSizeText = `${dequoteMarker}isOSX ? 12 : 14${dequoteMarker}`; + +/** + * This class is intended for use when uplifting Monaco. + */ +@injectable() +export class MonacoEditorPreferenceSchemaExtractor implements CommandContribution { + @inject(WorkspaceService) protected readonly workspaceService: WorkspaceService; + @inject(MessageService) protected readonly messageService: MessageService; + @inject(FileService) protected readonly fileService: FileService; + @inject(PreferenceValidationService) protected readonly preferenceValidationService: PreferenceValidationService; + @inject(MonacoEditorProvider) protected readonly monacoEditorProvider: MonacoEditorProvider; + + registerCommands(commands: CommandRegistry): void { + commands.registerCommand({ id: 'check-for-unvalidated-editor-preferences', label: 'Check for unvalidated editor preferences in Monaco', category: 'API Samples' }, { + execute: () => { + const firstRootUri = this.workspaceService.tryGetRoots()[0]?.resource; + if (firstRootUri) { + const validatedEditorPreferences = new Set(editorOptionsRegistry.map(validator => validator.name)); + const allEditorPreferenceKeys = Object.keys(this.monacoEditorProvider['createOptions']( + this.monacoEditorProvider['preferencePrefixes'], firstRootUri.toString(), 'typescript' + )); + const unvalidatedKeys = allEditorPreferenceKeys.filter(key => !validatedEditorPreferences.has(key)); + console.log('Unvalidated keys are:', unvalidatedKeys); + } + } + }); + commands.registerCommand({ id: 'extract-editor-preference-schema', label: 'Extract editor preference schema from Monaco', category: 'API Samples' }, { + execute: async () => { + const roots = this.workspaceService.tryGetRoots(); + if (roots.length !== 1 || !(roots[0].resource.path.toString() ?? '').includes('theia')) { + this.messageService.warn('This command should only be executed in the Theia workspace.'); + } + const theiaRoot = roots[0]; + const fileToWrite = theiaRoot.resource.resolve('packages/editor/src/common/editor-generated-preference-schema.ts'); + const properties = {}; + Registry.as(Extensions.Configuration).getConfigurations().forEach(config => { + if (config.id === 'editor' && config.properties) { + Object.assign(properties, config.properties); + } + }); + this.guaranteePlatformOptions(properties); + const interfaceEntries = []; + // eslint-disable-next-line @typescript-eslint/no-explicit-any + for (const [name, description] of Object.entries(properties) as Array<[string, any]>) { + const { scope, overridable } = this.getScope(description.scope); + description.scope = scope; + description.overridable = overridable; + delete description.defaultDefaultValue; + delete description.restricted; + if (name === 'editor.fontSize') { + description.default = fontSizeText; + } else if (name === 'editor.fontFamily') { + description.default = fontFamilyText; + } + interfaceEntries.push(`'${name}': ${this.formatSchemaForInterface(description)};`); + } + const stringified = JSON.stringify(properties, this.codeSnippetReplacer(), 4); + const propertyList = this.dequoteCodeSnippets(stringified); + const content = generateContent(propertyList, interfaceEntries); + await this.fileService.write(fileToWrite, content); + } + }); + } + + // eslint-disable-next-line @typescript-eslint/no-explicit-any + protected codeSnippetReplacer(): (key: string, value: any) => any { + // JSON.stringify doesn't give back the whole context when serializing so we use state... + let lastPreferenceName: string; + return (key, value) => { + if (key.startsWith('editor.') || key.startsWith('diffEditor.')) { + lastPreferenceName = key; + } + if ((key === 'description' || key === 'markdownDescription') && typeof value === 'string') { + if (value.length === 0) { + return value; + } + const defaultKey = nls.getDefaultKey(value); + if (defaultKey) { + return `${dequoteMarker}nls.localizeByDefault(${dequoteMarker}"${value}${dequoteMarker}")${dequoteMarker}`; + } else { + const localizationKey = `${dequoteMarker}"theia/editor/${lastPreferenceName}${dequoteMarker}"`; + return `${dequoteMarker}nls.localize(${localizationKey}, ${dequoteMarker}"${value}${dequoteMarker}")${dequoteMarker}`; + } + } + if ((key === 'enumDescriptions' || key === 'markdownEnumDescriptions') && Array.isArray(value)) { + return value.map((description, i) => { + if (description.length === 0) { + return description; + } + const defaultKey = nls.getDefaultKey(description); + if (defaultKey) { + return `${dequoteMarker}nls.localizeByDefault(${dequoteMarker}"${description}${dequoteMarker}")${dequoteMarker}`; + } else { + const localizationKey = `${dequoteMarker}"theia/editor/${lastPreferenceName}${i}${dequoteMarker}"`; + return `${dequoteMarker}nls.localize(${localizationKey}, ${dequoteMarker}"${description}${dequoteMarker}")${dequoteMarker}`; + } + }); + } + return value; + }; + }; + + protected getScope(monacoScope: unknown): { scope: PreferenceScope, overridable: boolean } { + switch (monacoScope) { + case ConfigurationScope.MACHINE_OVERRIDABLE: + case ConfigurationScope.WINDOW: + case ConfigurationScope.RESOURCE: + return { scope: PreferenceScope.Folder, overridable: false }; + case ConfigurationScope.LANGUAGE_OVERRIDABLE: + return { scope: PreferenceScope.Folder, overridable: true }; + case ConfigurationScope.APPLICATION: + case ConfigurationScope.MACHINE: + return { scope: PreferenceScope.User, overridable: false }; + } + return { scope: PreferenceScope.Default, overridable: false }; + } + + protected formatSchemaForInterface(schema: PreferenceDataProperty): string { + const defaultValue = schema.default !== undefined ? schema.default : schema.default; + // There are a few preferences for which VSCode uses defaults that do not match the schema. We have to handle those manually. + if (defaultValue !== undefined && this.preferenceValidationService.validateBySchema('any-preference', defaultValue, schema) !== defaultValue) { + return 'HelpBadDefaultValue'; + } + const jsonType = schema.const !== undefined ? schema.const : (schema.enum ?? schema.type); + if (jsonType === undefined) { + const subschemata = schema.anyOf ?? schema.oneOf; + if (subschemata) { + const permittedTypes = [].concat.apply(subschemata.map(subschema => this.formatSchemaForInterface(subschema).split(' | '))); + return Array.from(new Set(permittedTypes)).join(' | '); + } + } + return this.formatTypeForInterface(jsonType); + + } + + protected formatTypeForInterface(jsonType?: MaybeArray | undefined): string { + if (Array.isArray(jsonType)) { + return jsonType.map(subtype => this.formatTypeForInterface(subtype)).join(' | '); + } + switch (jsonType) { + case 'boolean': + case 'number': + case 'string': + case 'true': + case 'false': + return jsonType; + case true: + case false: + case null: // eslint-disable-line no-null/no-null + return `${jsonType}`; + case 'integer': + return 'number'; + case 'array': + case 'object': + case undefined: + // These have to be fixed manually, so we output a type that will cause a TS error. + return 'Help'; + } + // Most of the rest are string literals. + return `'${jsonType}'`; + } + + protected dequoteCodeSnippets(stringification: string): string { + return stringification + .replace(new RegExp(`${dequoteMarker}"|"${dequoteMarker}|${dequoteMarker}\\\\`, 'g'), '') + .replace(new RegExp(`\\\\"${dequoteMarker}`, 'g'), '"') + .replace(/\\\\'/g, "\\'"); + } + + /** + * Ensures that options that are only relevant on certain platforms are caught. + * Check for use of `platform` in src/vs/editor/common/config/editorOptions.ts + */ + protected guaranteePlatformOptions(properties: object): void { + Object.assign(properties, { + 'editor.find.globalFindClipboard': { + type: 'boolean', + default: false, + description: 'Controls whether the Find Widget should read or modify the shared find clipboard on macOS.', + included: `${dequoteMarker}isOSX${dequoteMarker}`, + }, + 'editor.selectionClipboard': { + type: 'boolean', + default: true, + description: 'Controls whether the Linux primary clipboard should be supported.', + included: `${dequoteMarker}!isOSX && !isWindows${dequoteMarker}` + } + }); + } +} + +// Utility to assist with Monaco uplifts to generate preference schema. Not for regular use in the application. +export function bindMonacoPreferenceExtractor(bind: interfaces.Bind): void { + // bind(MonacoEditorPreferenceSchemaExtractor).toSelf().inSingletonScope(); + // bind(CommandContribution).toService(MonacoEditorPreferenceSchemaExtractor); +} diff --git a/examples/api-samples.disabled/src/browser/output/sample-output-channel-with-severity.ts b/examples/api-samples.disabled/src/browser/output/sample-output-channel-with-severity.ts new file mode 100644 index 0000000..3d6e20c --- /dev/null +++ b/examples/api-samples.disabled/src/browser/output/sample-output-channel-with-severity.ts @@ -0,0 +1,41 @@ +// ***************************************************************************** +// Copyright (C) 2020 SAP SE or an SAP affiliate company and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** +import { FrontendApplicationContribution } from '@theia/core/lib/browser'; +import { inject, injectable, interfaces } from '@theia/core/shared/inversify'; +import { OutputChannelManager, OutputChannelSeverity } from '@theia/output/lib/browser/output-channel'; + +@injectable() +export class SampleOutputChannelWithSeverity + implements FrontendApplicationContribution { + @inject(OutputChannelManager) + protected readonly outputChannelManager: OutputChannelManager; + public onStart(): void { + const channel = this.outputChannelManager.getChannel('API Sample: my test channel'); + channel.appendLine('hello info1'); // showed without color + channel.appendLine('hello info2', OutputChannelSeverity.Info); + channel.appendLine('hello error', OutputChannelSeverity.Error); + channel.appendLine('hello warning', OutputChannelSeverity.Warning); + channel.append('inlineInfo1 '); + channel.append('inlineWarning ', OutputChannelSeverity.Warning); + channel.append('inlineError ', OutputChannelSeverity.Error); + channel.append('inlineInfo2', OutputChannelSeverity.Info); + } +} +export const bindSampleOutputChannelWithSeverity = (bind: interfaces.Bind) => { + bind(FrontendApplicationContribution) + .to(SampleOutputChannelWithSeverity) + .inSingletonScope(); +}; diff --git a/examples/api-samples.disabled/src/browser/preferences/sample-preferences-contribution.ts b/examples/api-samples.disabled/src/browser/preferences/sample-preferences-contribution.ts new file mode 100644 index 0000000..0d0378d --- /dev/null +++ b/examples/api-samples.disabled/src/browser/preferences/sample-preferences-contribution.ts @@ -0,0 +1,104 @@ +// ***************************************************************************** +// Copyright (C) 2025 STMicroelectronics and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 + +import { CommandContribution, CommandRegistry, MessageService, QuickInputService } from '@theia/core'; +import { inject, injectable, interfaces } from '@theia/core/shared/inversify'; +import { SampleBackendPreferencesService, sampleBackendPreferencesServicePath } from '../../common/preference-protocol'; +import { ServiceConnectionProvider } from '@theia/core/lib/browser'; + +@injectable() +export class SamplePreferenceContribution implements CommandContribution { + + @inject(QuickInputService) + protected readonly quickInputService: QuickInputService; + + @inject(MessageService) + protected readonly messageService: MessageService; + + @inject(SampleBackendPreferencesService) + protected readonly preferencesService: SampleBackendPreferencesService; + + registerCommands(commands: CommandRegistry): void { + commands.registerCommand({ id: 'samplePreferences.get', label: 'Get Backend Preference', category: 'API Samples' }, + { + execute: async () => { + const key = await this.quickInputService.input({ + title: 'Get Backend Preference', + prompt: 'Enter preference key' + }); + if (key) { + const override = await this.quickInputService.input({ + title: 'Get Backend Preference', + prompt: 'Enter override identifier' + }); + + const value = await this.preferencesService.getPreference(key, override); + this.messageService.info(`The value is \n${JSON.stringify(value)}`); + } + } + } + ); + + commands.registerCommand({ id: 'samplePreferences.inspect', label: 'Inspect Backend Preference', category: 'API Samples' }, + { + execute: async () => { + const key = await this.quickInputService.input({ + title: 'Inspect Backend Preference', + prompt: 'Enter preference key' + }); + if (key) { + const override = await this.quickInputService.input({ + title: 'Inspect Backend Preference', + prompt: 'Enter override identifier' + }); + + const value = await this.preferencesService.inspectPreference(key, override); + this.messageService.info(`The value is \n${JSON.stringify(value)}`); + } + } + } + ); + + commands.registerCommand({ id: 'samplePreferences.set', label: 'Set Backend Preference', category: 'API Samples' }, + { + execute: async () => { + const key = await this.quickInputService.input({ + title: 'Set Backend Preference', + prompt: 'Enter preference key' + }); + if (key) { + const override = await this.quickInputService.input({ + title: 'Set Backend Preference', + prompt: 'Enter override identifier' + }); + const valueString = await this.quickInputService.input({ + title: 'Set Backend Preference', + prompt: 'Enter JSON value' + }); + if (valueString) { + await this.preferencesService.setPreference(key, override, JSON.parse(valueString)); + } + } + } + } + ); + } + +} + +export function bindSamplePreferenceContribution(bind: interfaces.Bind): void { + bind(CommandContribution).to(SamplePreferenceContribution).inSingletonScope(); + bind(SampleBackendPreferencesService).toDynamicValue(ctx => ServiceConnectionProvider.createProxy(ctx.container, sampleBackendPreferencesServicePath)).inSingletonScope(); +} diff --git a/examples/api-samples.disabled/src/browser/preload/text-replacement-sample.ts b/examples/api-samples.disabled/src/browser/preload/text-replacement-sample.ts new file mode 100644 index 0000000..d0f28e1 --- /dev/null +++ b/examples/api-samples.disabled/src/browser/preload/text-replacement-sample.ts @@ -0,0 +1,37 @@ +// ***************************************************************************** +// Copyright (C) 2025 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { TextReplacementContribution } from '@theia/core/lib/browser/preload/text-replacement-contribution'; + +export class TextSampleReplacementContribution implements TextReplacementContribution { + + getReplacement(locale: string): Record { + switch (locale) { + case 'en': { + return { + 'About': 'About Theia', + }; + } + case 'de': { + return { + 'About': 'Über Theia', + }; + } + } + return {}; + } + +} diff --git a/examples/api-samples.disabled/src/browser/style/branding.css b/examples/api-samples.disabled/src/browser/style/branding.css new file mode 100644 index 0000000..5c5e29b --- /dev/null +++ b/examples/api-samples.disabled/src/browser/style/branding.css @@ -0,0 +1,34 @@ +/******************************************************************************** + * Copyright (C) 2020 Ericsson and others. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the Eclipse + * Public License v. 2.0 are satisfied: GNU General Public License, version 2 + * with the GNU Classpath Exception which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 + ********************************************************************************/ + +.theia-icon { + background-image: url("../icons/theia.png"); + background-position: center; + background-repeat: no-repeat; + background-size: contain; +} + +#theia-main-content-panel { + background-image: url("../icons/theia.png"); + background-position: center center; + background-repeat: no-repeat; + background-size: 15%; +} + +.unclosable-window-icon { + -webkit-mask: url("window-icon.svg"); + mask: url("window-icon.svg"); +} diff --git a/examples/api-samples.disabled/src/browser/style/window-icon.svg b/examples/api-samples.disabled/src/browser/style/window-icon.svg new file mode 100644 index 0000000..b7cd62a --- /dev/null +++ b/examples/api-samples.disabled/src/browser/style/window-icon.svg @@ -0,0 +1,4 @@ + + + + diff --git a/examples/api-samples.disabled/src/browser/test/sample-test-contribution.ts b/examples/api-samples.disabled/src/browser/test/sample-test-contribution.ts new file mode 100644 index 0000000..2f9aa3a --- /dev/null +++ b/examples/api-samples.disabled/src/browser/test/sample-test-contribution.ts @@ -0,0 +1,158 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +// ***************************************************************************** +// Copyright (C) 2022 STMicroelectronics and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { TestContribution, TestItem, TestRunProfileKind, TestService } from '@theia/test/lib/browser/test-service'; +import { CommandContribution, CommandRegistry, Path, URI } from '@theia/core'; +import { ILogger } from '@theia/core/lib/common/logger'; +import { inject, injectable, interfaces, named, postConstruct } from '@theia/core/shared/inversify'; +import { WorkspaceService } from '@theia/workspace/lib/browser'; +import { FileService } from '@theia/filesystem/lib/browser/file-service'; +import { FileSearchService } from '@theia/file-search/lib/common/file-search-service'; +import { FileStatWithMetadata } from '@theia/filesystem/lib/common/files'; +import { TestControllerImpl, TestItemImpl, TestRunImpl } from './test-controller'; + +function stringifyTransformer(key: string, value: any): any { + if (value instanceof URI) { + return value.toString(); + } + if (value instanceof TestItemImpl) { + return { + id: value.id, + label: value.label, + range: value.range, + sortKey: value.sortKey, + tags: value.tags, + uri: value.uri, + busy: value.busy, + canResolveChildren: value.canResolveChildren, + children: value.tests, + description: value.description, + error: value.error + }; + } + return value; +} + +@injectable() +export class SampleTestContribution implements TestContribution, CommandContribution { + @inject(WorkspaceService) + private workspaceService: WorkspaceService; + + @inject(FileSearchService) + private searchService: FileSearchService; + + @inject(FileService) + private fileService: FileService; + + @inject(ILogger) @named('api-samples') + private logger: ILogger; + + private testController = new TestControllerImpl('SampleTestController', 'Sample Test Controller'); + private usedUris = new Set(); + private nextTestId = 0; + private nextRunId = 0; + + @postConstruct() + protected init(): void { + this.testController.onItemsChanged(e => { + this.logger.debug(JSON.stringify(e, stringifyTransformer, 4)); + }); + } + + registerCommands(commands: CommandRegistry): void { + commands.registerCommand({ id: 'testController.addSomeTests', label: 'Add Some Tests', category: 'API Samples' }, { + execute: async (...args: any): Promise => { + + const root = (await this.workspaceService.roots)[0]; + const files = (await this.searchService.find('.json', { + rootUris: [root.resource.toString()], + limit: 1000 + })).filter(uri => !this.usedUris.has(uri)); + for (let i = 0; i < Math.min(10, files.length); i++) { + const fileUri = new URI(files[i]); + const relativePath = root.resource.path.relative(fileUri.path); + let collection = this.testController.items; + + let dirUri = root.resource; + + relativePath?.toString().split(Path.separator).forEach(name => { + dirUri = dirUri.withPath(dirUri.path.join(name)); + let item = collection.get(name); + if (!item) { + item = new TestItemImpl(dirUri, name); + item.label = name; + collection.add(item); + } + collection = item._children; + }); + const meta: FileStatWithMetadata = await this.fileService.resolve(fileUri, { resolveMetadata: true }); + const testItem = new TestItemImpl(fileUri, `test-id-${this.nextTestId}`); + testItem.label = `Test number ${this.nextTestId++}`; + testItem.range = { + start: { line: 0, character: 0 }, + end: { line: 0, character: Math.min(10, meta.size) } + }; + collection.add(testItem); + } + } + }); + + commands.registerCommand({ id: 'testController.dumpController', label: 'Dump Controller Contents', category: 'API Samples' }, { + execute: (...args: any): any => { + this.logger.debug(JSON.stringify(this.testController, stringifyTransformer, 4)); + } + }); + } + + registerTestControllers(service: TestService): void { + this.testController.addProfile({ + kind: TestRunProfileKind.Run, + label: 'Sample run profile #1', + isDefault: false, + canConfigure: true, + tag: '', + run: (name: string, included: readonly TestItem[], excluded: readonly TestItem[]) => { + this.testController.addRun(new TestRunImpl(this.testController, `sample-run-id-${this.nextRunId}`, `sample-profile-1-${this.nextRunId++}`)); + }, + configure: (): void => { + this.logger.debug('configuring the sample profile 1'); + } + }); + + this.testController.addProfile({ + kind: TestRunProfileKind.Run, + label: 'Sample run profile #2', + isDefault: false, + canConfigure: true, + tag: '', + run: (name: string, included: readonly TestItem[], excluded: readonly TestItem[]) => { + this.testController.addRun(new TestRunImpl(this.testController, `sample-run-id-${this.nextRunId}`, `sample-profile-2-${this.nextRunId++}`)); + }, + configure: (): void => { + this.logger.debug('configuring the sample profile 2'); + } + }); + + service.registerTestController(this.testController); + } +} + +export function bindTestSample(bind: interfaces.Bind): void { + bind(SampleTestContribution).toSelf().inSingletonScope(); + bind(CommandContribution).toService(SampleTestContribution); + bind(TestContribution).toService(SampleTestContribution); +}; diff --git a/examples/api-samples.disabled/src/browser/test/test-controller.ts b/examples/api-samples.disabled/src/browser/test/test-controller.ts new file mode 100644 index 0000000..1b87fb6 --- /dev/null +++ b/examples/api-samples.disabled/src/browser/test/test-controller.ts @@ -0,0 +1,387 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +// ***************************************************************************** +// Copyright (C) 2022 STMicroelectronics and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { CancellationToken, Emitter, Event, URI } from '@theia/core'; +import { Range, Location, CancellationTokenSource } from '@theia/core/shared/vscode-languageserver-protocol'; + +import { MarkdownString } from '@theia/core/lib/common/markdown-rendering'; +import { SimpleObservableCollection, TreeCollection, observableProperty } from '@theia/test/lib/common/collections'; +import { + TestController, TestExecutionState, TestFailure, TestItem, + TestOutputItem, TestRun, TestRunProfile, TestState, TestStateChangedEvent +} from '@theia/test/lib/browser/test-service'; +import { AccumulatingTreeDeltaEmitter, CollectionDelta, TreeDelta, TreeDeltaBuilder } from '@theia/test/lib/common/tree-delta'; +import { timeout } from '@theia/core/lib/common/promise-util'; + +export class TestItemCollection extends TreeCollection { + override add(item: TestItemImpl): TestItemImpl | undefined { + item.realParent = this.owner; + return super.add(item); + } +} + +export class TestItemImpl implements TestItem { + constructor(readonly uri: URI, readonly id: string) { + this._children = new TestItemCollection(this, (v: TestItemImpl) => v.path, (v: TestItemImpl) => v.deltaBuilder); + } + + // eslint-disable-next-line @typescript-eslint/no-explicit-any + protected notifyPropertyChange(property: keyof TestItemImpl, value: any): void { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + const val: any = {}; + val[property] = value; + if (this.path) { + this.deltaBuilder?.reportChanged(this.path, val); + } + } + + _deltaBuilder: TreeDeltaBuilder | undefined; + get deltaBuilder(): TreeDeltaBuilder | undefined { + if (this._deltaBuilder) { + return this._deltaBuilder; + } else if (this.realParent) { + this._deltaBuilder = this.realParent.deltaBuilder; + return this._deltaBuilder; + } else { + return undefined; + } + } + + _path: string[] | undefined; + + get path(): string[] { + if (this._path) { + return this._path; + } else if (this.realParent instanceof TestItemImpl) { + this._path = [...this.realParent.path, this.id]; + return this._path; + } else { + return [this.id]; + } + }; + + private _parent?: TestItemImpl | TestControllerImpl; + get realParent(): TestItemImpl | TestControllerImpl | undefined { + return this._parent; + } + + set realParent(v: TestItemImpl | TestControllerImpl | undefined) { + this.iterate(item => { + item._path = undefined; + return true; + }); + this._parent = v; + } + + get parent(): TestItem | undefined { + const realParent = this.realParent; + if (realParent instanceof TestItemImpl) { + return realParent; + } + return undefined; + } + + get controller(): TestControllerImpl | undefined { + if (this.realParent instanceof TestItemImpl) { + return this.realParent.controller; + } + return this.realParent; + } + + protected iterate(toDo: (v: TestItemImpl) => boolean): boolean { + if (toDo(this)) { + for (let i = 0; i < this._children.values.length; i++) { + if (!this._children.values[i].iterate(toDo)) { + return false; + } + } + return true; + } else { + return false; + } + } + + @observableProperty('notifyPropertyChange') + label: string = ''; + + @observableProperty('notifyPropertyChange') + range?: Range; + + @observableProperty('notifyPropertyChange') + sortKey?: string | undefined; + + @observableProperty('notifyPropertyChange') + tags: string[] = []; + + @observableProperty('notifyPropertyChange') + busy: boolean = false; + + @observableProperty('notifyPropertyChange') + canResolveChildren: boolean = false; + + @observableProperty('notifyPropertyChange') + description?: string | undefined; + + @observableProperty('notifyPropertyChange') + error?: string | MarkdownString | undefined; + + _children: TestItemCollection; + get tests(): readonly TestItemImpl[] { + return this._children.values; + } + + resolveChildren(): void { + // do nothing + } +} + +export class TestRunImpl implements TestRun { + private testStates: Map = new Map(); + private outputIndices: Map = new Map(); + private outputs: TestOutputItem[] = []; + private onDidChangePropertyEmitter = new Emitter<{ name?: string; isRunning?: boolean; }>(); + onDidChangeProperty: Event<{ name?: string; isRunning?: boolean; }> = this.onDidChangePropertyEmitter.event; + private cts: CancellationTokenSource; + + constructor(readonly controller: TestControllerImpl, readonly id: string, name: string) { + this.name = name; + this.isRunning = false; + this.start(); + } + + private start(): void { + this.cts = new CancellationTokenSource(); + Promise.allSettled(this.collectTestsForRun().map(item => this.simulateTestRun(item, this.cts.token))).then(() => this.ended()); + } + + collectTestsForRun(): TestItemImpl[] { + const result: TestItemImpl[] = []; + this.collectTests(this.controller.tests, result); + return result; + } + + collectTests(tests: readonly TestItemImpl[], result: TestItemImpl[]): void { + tests.forEach(test => this.collectTest(test, result)); + } + + collectTest(test: TestItemImpl, result: TestItemImpl[]): void { + if (test.tests.length > 0) { + this.collectTests(test.tests, result); + } else if (Math.random() < 0.8) { + result.push(test); + } + } + + simulateTestRun(item: TestItemImpl, token: CancellationToken): Promise { + let outputCounter = 0; + let messageCounter = 0; + return timeout(Math.random() * 3000, token) + .then(() => this.setTestState(item, { state: TestExecutionState.Queued })) + .then(() => timeout(Math.random() * 3000, token)) + .then(() => this.setTestState(item, { state: TestExecutionState.Running })) + .then(() => timeout(Math.random() * 3000, token)) + .then(() => { + this.appendOutput(`Output from Test ${item.label} nr ${outputCounter++}`); + }) + .then(() => timeout(Math.random() * 3000, token)) + .then(() => { + this.appendOutput(`Output from Test ${item.label} nr ${outputCounter++}`); + }) + .then(() => timeout(Math.random() * 3000, token)) + .then(() => { + this.appendOutput(`Output from Test ${item.label} nr ${outputCounter++}`); + }) + .then(() => timeout(Math.random() * 3000, token)) + .then(() => { + this.appendOutput(`Output from Test ${item.label} nr ${outputCounter++}`); + }).then(() => { + const random = Math.random(); + if (random > 0.9) { + this.setTestState(item, { state: TestExecutionState.Skipped }); + } else if (random > 0.8) { + const failure: TestFailure = { + state: TestExecutionState.Errored, + messages: [ + { + message: { + value: `**Error** from Test ${item.label} nr ${messageCounter++}` + }, + location: { + uri: item.uri.toString(), + range: item.range! + }, + } + ], + duration: 33 + }; + this.setTestState(item, failure); + } else if (random > 0.7) { + const failure: TestFailure = { + state: TestExecutionState.Failed, + messages: [ + { + message: { + value: `**Failure** from Test ${item.label} nr ${messageCounter++}` + }, + location: { + uri: item.uri.toString(), + range: item.range! + }, + } + ], + duration: 33 + }; + this.setTestState(item, failure); + } else { + this.setTestState(item, { state: TestExecutionState.Passed }); + } + }); + } + + @observableProperty('notifyPropertyChange') + isRunning: boolean; + + @observableProperty('notifyPropertyChange') + name: string; + + protected notifyPropertyChange(property: 'name' | 'isRunning', value: unknown): void { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + const val: any = {}; + val[property] = value; + this.onDidChangePropertyEmitter.fire(val); + } + + cancel(): void { + this.cts.cancel(); + } + + getTestState(item: TestItem): TestState | undefined { + return this.testStates.get(item); + } + + private onDidChangeTestStateEmitter: Emitter = new Emitter(); + onDidChangeTestState: Event = this.onDidChangeTestStateEmitter.event; + + getOutput(item?: TestItem | undefined): readonly TestOutputItem[] { + if (!item) { + return this.outputs; + } else { + const indices = this.outputIndices.get(item); + if (!indices) { + return []; + } else { + return indices.map(index => this.outputs[index]); + } + } + } + private onDidChangeTestOutputEmitter: Emitter<[TestItem | undefined, TestOutputItem][]> = new Emitter(); + onDidChangeTestOutput: Event<[TestItem | undefined, TestOutputItem][]> = this.onDidChangeTestOutputEmitter.event; + + setTestState(test: TestItemImpl, newState: TestState): void { + const oldState = this.testStates.get(test); + this.testStates.set(test, newState); + this.onDidChangeTestStateEmitter.fire([{ + oldState: oldState, newState: newState, test: test + }]); + } + + appendOutput(text: string, location?: Location, item?: TestItem): void { + const output = { + output: text, + location: location + }; + this.outputs.push(output); + if (item) { + let indices = this.outputIndices.get(item); + if (!indices) { + indices = []; + this.outputIndices.set(item, indices); + } + indices.push(this.outputs.length - 1); + } + this.onDidChangeTestOutputEmitter.fire([[item, output]]); + } + + get items(): readonly TestItem[] { + return [...this.testStates.keys()]; + } + + ended(): void { + const stateEvents: TestStateChangedEvent[] = []; + this.testStates.forEach((state, item) => { + if (state.state <= TestExecutionState.Running) { + stateEvents.push({ + oldState: state, + newState: undefined, + test: item + }); + this.testStates.delete(item); + } + }); + if (stateEvents.length > 0) { + this.onDidChangeTestStateEmitter.fire(stateEvents); + } + this.isRunning = false; + } +} + +export class TestControllerImpl implements TestController { + private _profiles = new SimpleObservableCollection(); + private _runs = new SimpleObservableCollection(); + readonly deltaBuilder = new AccumulatingTreeDeltaEmitter(300); + items = new TestItemCollection(this, item => item.path, () => this.deltaBuilder); + + constructor(readonly id: string, readonly label: string) { + } + + refreshTests(token: CancellationToken): Promise { + // not implemented + return Promise.resolve(); + } + + get testRunProfiles(): readonly TestRunProfile[] { + return this._profiles.values; + } + + addProfile(profile: TestRunProfile): void { + this._profiles.add(profile); + } + + onProfilesChanged: Event> = this._profiles.onChanged; + + get testRuns(): readonly TestRun[] { + return this._runs.values; + } + + addRun(run: TestRun): void { + this._runs.add(run); + } + + onRunsChanged: Event> = this._runs.onChanged; + get tests(): readonly TestItemImpl[] { + return this.items.values; + } + onItemsChanged: Event[]> = this.deltaBuilder.onDidFlush; + + resolveChildren(item: TestItem): void { + // nothing to do + } + + clearRuns(): void { + this._runs.clear(); + } +} diff --git a/examples/api-samples.disabled/src/browser/test/test-item.spec.ts b/examples/api-samples.disabled/src/browser/test/test-item.spec.ts new file mode 100644 index 0000000..d6c9c72 --- /dev/null +++ b/examples/api-samples.disabled/src/browser/test/test-item.spec.ts @@ -0,0 +1,42 @@ +// ***************************************************************************** +// Copyright (C) 2022 STMicroelectronics and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import * as chai from 'chai'; +import { TestItemImpl } from './test-controller'; +import { URI } from '@theia/core'; +import { DeltaKind, TreeDeltaBuilderImpl } from '@theia/test/lib/common/tree-delta'; + +const expect = chai.expect; + +describe('TestItem tests', () => { + it('should notify property changes', () => { + const deltaBuilder = new TreeDeltaBuilderImpl(); + const item = new TestItemImpl(new URI('https://foo/bar'), 'b'); + item._deltaBuilder = deltaBuilder; + item._path = ['a', 'b']; + item.label = 'theLabel'; + const range = { start: { line: 17, character: 5 }, end: { line: 17, character: 37 } }; + item.range = range; + expect(deltaBuilder.currentDelta).deep.equal([{ + path: ['a', 'b'], + type: DeltaKind.CHANGED, + value: { + label: 'theLabel', + range: range + }, + }]); + }); +}); diff --git a/examples/api-samples.disabled/src/browser/toolbar/sample-toolbar-contribution.css b/examples/api-samples.disabled/src/browser/toolbar/sample-toolbar-contribution.css new file mode 100644 index 0000000..e660165 --- /dev/null +++ b/examples/api-samples.disabled/src/browser/toolbar/sample-toolbar-contribution.css @@ -0,0 +1,46 @@ +/******************************************************************************** + * Copyright (C) 2022 Ericsson and others. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the Eclipse + * Public License v. 2.0 are satisfied: GNU General Public License, version 2 + * with the GNU Classpath Exception which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 + ********************************************************************************/ + +#theia-sample-toolbar-contribution { + position: relative; +} + +#theia-sample-toolbar-contribution .icon-wrapper { + cursor: pointer; + margin-left: 0; +} + +#theia-sample-toolbar-contribution:focus, +#theia-sample-toolbar-contribution .icon-wrapper:focus, +#theia-sample-toolbar-contribution .codicon-search:focus { + outline: none; +} + +#theia-sample-toolbar-contribution + .icon-wrapper.action-label.item.enabled:hover { + background-color: var(--theia-toolbar-hoverBackground); +} + +#theia-sample-toolbar-contribution #easy-search-item-icon.codicon-search { + position: relative; +} + +#theia-sample-toolbar-contribution .icon-wrapper .codicon-triangle-down { + position: absolute; + font-size: 10px; + bottom: -7px; + right: -2px; +} diff --git a/examples/api-samples.disabled/src/browser/toolbar/sample-toolbar-contribution.tsx b/examples/api-samples.disabled/src/browser/toolbar/sample-toolbar-contribution.tsx new file mode 100644 index 0000000..4492931 --- /dev/null +++ b/examples/api-samples.disabled/src/browser/toolbar/sample-toolbar-contribution.tsx @@ -0,0 +1,151 @@ +// ***************************************************************************** +// Copyright (C) 2022 Ericsson and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { CommandContribution, CommandRegistry, CommandService, MenuContribution, MenuModelRegistry } from '@theia/core'; +import { LabelProvider, quickCommand, QuickInputService, QuickPickItem } from '@theia/core/lib/browser'; +import { inject, injectable, interfaces } from '@theia/core/shared/inversify'; +import * as React from '@theia/core/shared/react'; +import { quickFileOpen } from '@theia/file-search/lib/browser/quick-file-open'; +import { SearchInWorkspaceCommands } from '@theia/search-in-workspace/lib/browser/search-in-workspace-frontend-contribution'; +import { WorkspaceService } from '@theia/workspace/lib/browser'; +import { AbstractToolbarContribution } from '@theia/toolbar/lib/browser/abstract-toolbar-contribution'; +import { ToolbarMenus, ReactInteraction } from '@theia/toolbar/lib/browser/toolbar-constants'; +import { ToolbarContribution } from '@theia/toolbar/lib/browser/toolbar-interfaces'; +import { ToolbarDefaultsFactory } from '@theia/toolbar/lib/browser/toolbar-defaults'; +import { SampleToolbarDefaultsOverride } from './sample-toolbar-defaults-override'; +import '../../../src/browser/toolbar/sample-toolbar-contribution.css'; + +export const bindSampleToolbarContribution = (bind: interfaces.Bind, rebind: interfaces.Rebind) => { + bind(SampleToolbarContribution).toSelf().inSingletonScope(); + bind(ToolbarContribution).to(SampleToolbarContribution); + bind(CommandContribution).to(SampleToolbarContribution); + bind(MenuContribution).to(SampleToolbarContribution); + bind(SearchInWorkspaceQuickInputService).toSelf().inSingletonScope(); + rebind(ToolbarDefaultsFactory).toConstantValue(SampleToolbarDefaultsOverride); +}; + +export const FIND_IN_WORKSPACE_ROOT = { + id: 'easy.search.find.in.workspace.root', + category: 'API Samples', + label: 'Search Workspace Root for Text', +}; + +@injectable() +export class SearchInWorkspaceQuickInputService { + @inject(QuickInputService) protected readonly quickInputService: QuickInputService; + @inject(WorkspaceService) protected readonly workspaceService: WorkspaceService; + @inject(LabelProvider) protected readonly labelProvider: LabelProvider; + @inject(CommandService) protected readonly commandService: CommandService; + protected quickPickItems: QuickPickItem[] = []; + + open(): void { + this.quickPickItems = this.createWorkspaceList(); + this.quickInputService.showQuickPick(this.quickPickItems, { + placeholder: 'Workspace root to search', + }); + } + + protected createWorkspaceList(): QuickPickItem[] { + const roots = this.workspaceService.tryGetRoots(); + return roots.map(root => { + const uri = root.resource; + return { + label: this.labelProvider.getName(uri), + execute: (): Promise => this.commandService.executeCommand(SearchInWorkspaceCommands.FIND_IN_FOLDER.id, [uri]), + }; + }); + } +} + +@injectable() +export class SampleToolbarContribution extends AbstractToolbarContribution + implements CommandContribution, + MenuContribution { + @inject(SearchInWorkspaceQuickInputService) protected readonly searchPickService: SearchInWorkspaceQuickInputService; + @inject(WorkspaceService) protected readonly workspaceService: WorkspaceService; + + static ID = 'theia-sample-toolbar-contribution'; + id = SampleToolbarContribution.ID; + + protected handleOnClick = (e: ReactInteraction): void => this.doHandleOnClick(e); + protected doHandleOnClick(e: ReactInteraction): void { + e.stopPropagation(); + const toolbar = document.querySelector('#main-toolbar'); + if (toolbar) { + const { bottom } = toolbar.getBoundingClientRect(); + const { left } = e.currentTarget.getBoundingClientRect(); + this.contextMenuRenderer.render({ + includeAnchorArg: false, + menuPath: ToolbarMenus.SEARCH_WIDGET_DROPDOWN_MENU, + anchor: { x: left, y: bottom }, + context: e.currentTarget + }); + } + } + + render(): React.ReactNode { + return ( +
+
+
); + } + + registerCommands(registry: CommandRegistry): void { + registry.registerCommand(FIND_IN_WORKSPACE_ROOT, { + execute: async () => { + const wsRoots = await this.workspaceService.roots; + if (!wsRoots.length) { + await this.commandService.executeCommand(SearchInWorkspaceCommands.FIND_IN_FOLDER.id); + } else if (wsRoots.length === 1) { + const { resource } = wsRoots[0]; + await this.commandService.executeCommand(SearchInWorkspaceCommands.FIND_IN_FOLDER.id, [resource]); + } else { + this.searchPickService.open(); + } + }, + }); + } + + registerMenus(registry: MenuModelRegistry): void { + registry.registerMenuAction(ToolbarMenus.SEARCH_WIDGET_DROPDOWN_MENU, { + commandId: quickCommand.id, + label: 'Find a Command', + order: 'a', + }); + registry.registerMenuAction(ToolbarMenus.SEARCH_WIDGET_DROPDOWN_MENU, { + commandId: quickFileOpen.id, + order: 'b', + label: 'Search for a file' + }); + registry.registerMenuAction(ToolbarMenus.SEARCH_WIDGET_DROPDOWN_MENU, { + commandId: SearchInWorkspaceCommands.OPEN_SIW_WIDGET.id, + label: 'Search Entire Workspace for Text', + order: 'c', + }); + registry.registerMenuAction(ToolbarMenus.SEARCH_WIDGET_DROPDOWN_MENU, { + commandId: FIND_IN_WORKSPACE_ROOT.id, + order: 'd', + }); + } +} + diff --git a/examples/api-samples.disabled/src/browser/toolbar/sample-toolbar-defaults-override.ts b/examples/api-samples.disabled/src/browser/toolbar/sample-toolbar-defaults-override.ts new file mode 100644 index 0000000..fc7237a --- /dev/null +++ b/examples/api-samples.disabled/src/browser/toolbar/sample-toolbar-defaults-override.ts @@ -0,0 +1,59 @@ +// ***************************************************************************** +// Copyright (C) 2022 Ericsson and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { DeflatedToolbarTree, ToolbarAlignment } from '@theia/toolbar/lib/browser/toolbar-interfaces'; + +export const SampleToolbarDefaultsOverride: () => DeflatedToolbarTree = () => ({ + items: { + [ToolbarAlignment.LEFT]: [ + [ + { + id: 'textEditor.commands.go.back', + command: 'textEditor.commands.go.back', + icon: 'codicon codicon-arrow-left', + }, + { + id: 'textEditor.commands.go.forward', + command: 'textEditor.commands.go.forward', + icon: 'codicon codicon-arrow-right', + }, + ], + [ + { + id: 'workbench.action.splitEditorRight', + command: 'workbench.action.splitEditor', + icon: 'codicon codicon-split-horizontal', + }, + ], + ], + [ToolbarAlignment.CENTER]: [[ + { + id: 'theia-sample-toolbar-contribution', + group: 'contributed' + } + ]], + [ToolbarAlignment.RIGHT]: [ + [ + { + id: 'workbench.action.showCommands', + command: 'workbench.action.showCommands', + icon: 'codicon codicon-terminal', + tooltip: 'Command Palette', + }, + ] + ] + }, +}); diff --git a/examples/api-samples.disabled/src/browser/view/sample-unclosable-view-contribution.ts b/examples/api-samples.disabled/src/browser/view/sample-unclosable-view-contribution.ts new file mode 100644 index 0000000..888a931 --- /dev/null +++ b/examples/api-samples.disabled/src/browser/view/sample-unclosable-view-contribution.ts @@ -0,0 +1,120 @@ +// ***************************************************************************** +// Copyright (C) 2020 TORO Limited and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { inject, injectable, interfaces } from '@theia/core/shared/inversify'; +import { AbstractViewContribution, bindViewContribution } from '@theia/core/lib/browser/shell/view-contribution'; +import { TabBarToolbarContribution, TabBarToolbarRegistry } from '@theia/core/lib/browser/shell/tab-bar-toolbar'; +import { Command, CommandRegistry, MessageService } from '@theia/core/lib/common'; +import { ApplicationShell, codicon, DockLayout, ShellLayoutTransformer, Widget, WidgetFactory } from '@theia/core/lib/browser'; +import { SampleViewUnclosableView } from './sample-unclosable-view'; + +export const SampleToolBarCommand: Command = { + id: 'sample.toggle.toolbarCommand', + iconClass: codicon('add'), + category: 'API Samples' +}; + +@injectable() +export class SampleUnclosableViewContribution extends AbstractViewContribution implements TabBarToolbarContribution, ShellLayoutTransformer { + + static readonly SAMPLE_UNCLOSABLE_VIEW_TOGGLE_COMMAND_ID = 'sampleUnclosableView:toggle'; + + protected toolbarItemState = false; + + @inject(MessageService) protected readonly messageService: MessageService; + + constructor() { + super({ + widgetId: SampleViewUnclosableView.ID, + widgetName: 'Sample Unclosable View', + toggleCommandId: SampleUnclosableViewContribution.SAMPLE_UNCLOSABLE_VIEW_TOGGLE_COMMAND_ID, + defaultWidgetOptions: { + area: 'main' + } + }); + } + + override registerCommands(registry: CommandRegistry): void { + super.registerCommands(registry); + registry.registerCommand(SampleToolBarCommand, { + execute: () => { + this.toolbarItemState = !this.toolbarItemState; + this.messageService.info(`Sample Toolbar Command is toggled = ${this.toolbarItemState}`); + }, + isEnabled: widget => this.withWidget(widget, () => true), + isVisible: widget => this.withWidget(widget, () => true), + isToggled: () => this.toolbarItemState + }); + } + + async registerToolbarItems(toolbarRegistry: TabBarToolbarRegistry): Promise { + toolbarRegistry.registerItem({ + id: SampleToolBarCommand.id, + command: SampleToolBarCommand.id, + tooltip: 'API Samples: Click to Toggle Toolbar Item', + priority: 0 + }); + } + + protected withWidget(widget: Widget | undefined = this.tryGetWidget(), cb: (sampleView: SampleViewUnclosableView) => T): T | false { + if (widget instanceof SampleViewUnclosableView && widget.id === SampleViewUnclosableView.ID) { + return cb(widget); + } + return false; + } + + // Makes sure the 'Sample Unclosable View' view is never restored after app restarts. + transformLayoutOnRestore(layoutData: ApplicationShell.LayoutData): void { + this.pruneConfig(layoutData.mainPanel?.main); + } + + protected pruneConfig(area: DockLayout.AreaConfig | null | undefined): void { + if (area?.type === 'tab-area') { + this.pruneTabConfig(area); + } else if (area?.type === 'split-area') { + this.pruneSplitConfig(area); + } + } + + protected pruneTabConfig(area: DockLayout.AreaConfig): void { + if (area.type === 'tab-area') { + const newwidgets = area.widgets.filter(widget => { + if (widget.id.startsWith(SampleViewUnclosableView.ID)) { + return false; + } + return true; + }); + area.widgets = newwidgets; + } + } + + protected pruneSplitConfig(area: DockLayout.AreaConfig): void { + if (area.type === 'split-area') { + area.children.forEach(c => this.pruneConfig(c)); + } + } +} + +export const bindSampleUnclosableView = (bind: interfaces.Bind) => { + bindViewContribution(bind, SampleUnclosableViewContribution); + bind(TabBarToolbarContribution).to(SampleUnclosableViewContribution).inSingletonScope(); + bind(SampleViewUnclosableView).toSelf(); + bind(WidgetFactory).toDynamicValue(ctx => ({ + id: SampleViewUnclosableView.ID, + createWidget: () => ctx.container.get(SampleViewUnclosableView) + })); + bind(ShellLayoutTransformer).toService(SampleUnclosableViewContribution); +}; diff --git a/examples/api-samples.disabled/src/browser/view/sample-unclosable-view.tsx b/examples/api-samples.disabled/src/browser/view/sample-unclosable-view.tsx new file mode 100644 index 0000000..f89990a --- /dev/null +++ b/examples/api-samples.disabled/src/browser/view/sample-unclosable-view.tsx @@ -0,0 +1,46 @@ +// ***************************************************************************** +// Copyright (C) 2020 TORO Limited and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { ReactWidget } from '@theia/core/lib/browser'; +import { injectable, postConstruct } from '@theia/core/shared/inversify'; +import * as React from '@theia/core/shared/react'; + +/** + * This sample view is used to demo the behavior of "Widget.title.closable". + */ +@injectable() +export class SampleViewUnclosableView extends ReactWidget { + static readonly ID = 'sampleUnclosableView'; + + @postConstruct() + init(): void { + this.id = SampleViewUnclosableView.ID; + this.title.caption = 'Sample Unclosable View'; + this.title.label = 'Sample Unclosable View'; + this.title.iconClass = 'unclosable-window-icon'; + this.title.closable = false; + this.update(); + } + + protected render(): React.ReactNode { + return ( +
+ Closable + this.title.closable = e.target.checked} /> +
+ ); + } +} diff --git a/examples/api-samples.disabled/src/browser/vsx/sample-frontend-app-info.ts b/examples/api-samples.disabled/src/browser/vsx/sample-frontend-app-info.ts new file mode 100644 index 0000000..a48e539 --- /dev/null +++ b/examples/api-samples.disabled/src/browser/vsx/sample-frontend-app-info.ts @@ -0,0 +1,31 @@ +// ***************************************************************************** +// Copyright (C) 2023 Ericsson and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { Endpoint } from '@theia/core/lib/browser'; +import { injectable, interfaces } from '@theia/core/shared/inversify'; +import { SampleAppInfo } from '../../common/vsx/sample-app-info'; + +@injectable() +export class SampleFrontendAppInfo implements SampleAppInfo { + + async getSelfOrigin(): Promise { + return new Endpoint().origin; + } +} + +export function bindSampleAppInfo(bind: interfaces.Bind): void { + bind(SampleAppInfo).to(SampleFrontendAppInfo).inSingletonScope(); +} diff --git a/examples/api-samples.disabled/src/browser/vsx/sample-vsx-command-contribution.ts b/examples/api-samples.disabled/src/browser/vsx/sample-vsx-command-contribution.ts new file mode 100644 index 0000000..e6e5efd --- /dev/null +++ b/examples/api-samples.disabled/src/browser/vsx/sample-vsx-command-contribution.ts @@ -0,0 +1,49 @@ +// ***************************************************************************** +// Copyright (C) 2020 Ericsson and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { inject, injectable, interfaces } from '@theia/core/shared/inversify'; +import { VSXEnvironment } from '@theia/vsx-registry/lib/common/vsx-environment'; +import { Command, CommandContribution, CommandRegistry, MessageService } from '@theia/core/lib/common'; + +@injectable() +export class VSXCommandContribution implements CommandContribution { + + @inject(MessageService) + protected readonly messageService: MessageService; + + @inject(VSXEnvironment) + protected readonly environment: VSXEnvironment; + + protected readonly command: Command = { + id: 'vsx.echo-api-version', + label: 'Show VS Code API Version', + category: 'API Samples' + }; + + registerCommands(commands: CommandRegistry): void { + commands.registerCommand(this.command, { + execute: async () => { + const version = await this.environment.getVscodeApiVersion(); + this.messageService.info(`Supported VS Code API Version: ${version}`); + } + }); + } + +} + +export const bindVSXCommand = (bind: interfaces.Bind) => { + bind(CommandContribution).to(VSXCommandContribution).inSingletonScope(); +}; diff --git a/examples/api-samples.disabled/src/common/preference-protocol.ts b/examples/api-samples.disabled/src/common/preference-protocol.ts new file mode 100644 index 0000000..1fb856d --- /dev/null +++ b/examples/api-samples.disabled/src/common/preference-protocol.ts @@ -0,0 +1,27 @@ +// ***************************************************************************** +// Copyright (C) 2025 STMicroelectronics and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { PreferenceInspection } from '@theia/core'; +import { JSONValue } from '@theia/core/shared/@lumino/coreutils'; + +export const sampleBackendPreferencesServicePath = '/services/sampleBackendPreferences'; +export const SampleBackendPreferencesService = Symbol('SampleBackendPreferencesService'); + +export interface SampleBackendPreferencesService { + getPreference(key: string, overrideIdentifier?: string): Promise; + inspectPreference(key: string, overrideIdentifier?: string): Promise; + setPreference(key: string, overrideIdentifier: string | undefined, value: JSONValue): Promise +} diff --git a/examples/api-samples.disabled/src/common/preference-schema.ts b/examples/api-samples.disabled/src/common/preference-schema.ts new file mode 100644 index 0000000..c3aeedc --- /dev/null +++ b/examples/api-samples.disabled/src/common/preference-schema.ts @@ -0,0 +1,27 @@ +// ***************************************************************************** +// Copyright (C) 2025 STMicroelectronics and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { PreferenceSchema } from '@theia/core'; + +export const FileWatchingPreferencesSchema: PreferenceSchema = { + properties: { + 'sample.file-watching.verbose': { + type: 'boolean', + default: false, + description: 'Enable verbose file watching logs.' + } + } +}; diff --git a/examples/api-samples.disabled/src/common/updater/sample-updater.ts b/examples/api-samples.disabled/src/common/updater/sample-updater.ts new file mode 100644 index 0000000..0c2b185 --- /dev/null +++ b/examples/api-samples.disabled/src/common/updater/sample-updater.ts @@ -0,0 +1,37 @@ +// ***************************************************************************** +// Copyright (C) 2020 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** +import { RpcServer } from '@theia/core/lib/common/messaging/proxy-factory'; + +export enum UpdateStatus { + InProgress = 'in-progress', + Available = 'available', + NotAvailable = 'not-available' +} + +export const SampleUpdaterPath = '/services/sample-updater'; +export const SampleUpdater = Symbol('SampleUpdater'); +export interface SampleUpdater extends RpcServer { + checkForUpdates(): Promise<{ status: UpdateStatus }>; + onRestartToUpdateRequested(): void; + disconnectClient(client: SampleUpdaterClient): void; + + setUpdateAvailable(available: boolean): Promise; // Mock +} + +export const SampleUpdaterClient = Symbol('SampleUpdaterClient'); +export interface SampleUpdaterClient { + notifyReadyToInstall(): void; +} diff --git a/examples/api-samples.disabled/src/common/vsx/sample-app-info.ts b/examples/api-samples.disabled/src/common/vsx/sample-app-info.ts new file mode 100644 index 0000000..b1ca599 --- /dev/null +++ b/examples/api-samples.disabled/src/common/vsx/sample-app-info.ts @@ -0,0 +1,22 @@ +// ***************************************************************************** +// Copyright (C) 2023 Ericsson and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { interfaces } from '@theia/core/shared/inversify'; + +export const SampleAppInfo = Symbol('SampleAppInfo') as symbol & interfaces.Abstract; +export interface SampleAppInfo { + getSelfOrigin(): Promise; +} diff --git a/examples/api-samples.disabled/src/common/vsx/sample-ovsx-client-factory.ts b/examples/api-samples.disabled/src/common/vsx/sample-ovsx-client-factory.ts new file mode 100644 index 0000000..d5241be --- /dev/null +++ b/examples/api-samples.disabled/src/common/vsx/sample-ovsx-client-factory.ts @@ -0,0 +1,30 @@ +// ***************************************************************************** +// Copyright (C) 2023 Ericsson and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { interfaces } from '@theia/core/shared/inversify'; +import { OVSXUrlResolver } from '@theia/vsx-registry/lib/common'; +import { SampleAppInfo } from './sample-app-info'; + +export function rebindOVSXClientFactory(rebind: interfaces.Rebind): void { + // rebind the OVSX client factory so that we can replace patterns like "${self}" in the configs: + rebind(OVSXUrlResolver) + .toDynamicValue(ctx => { + const appInfo = ctx.container.get(SampleAppInfo); + const selfOrigin = appInfo.getSelfOrigin(); + return async (url: string) => url.replace('${self}', await selfOrigin); + }) + .inSingletonScope(); +} diff --git a/examples/api-samples.disabled/src/electron-browser/updater/sample-updater-frontend-contribution.ts b/examples/api-samples.disabled/src/electron-browser/updater/sample-updater-frontend-contribution.ts new file mode 100644 index 0000000..2790449 --- /dev/null +++ b/examples/api-samples.disabled/src/electron-browser/updater/sample-updater-frontend-contribution.ts @@ -0,0 +1,176 @@ +// ***************************************************************************** +// Copyright (C) 2020 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { inject, injectable, postConstruct } from '@theia/core/shared/inversify'; +import { CommonMenus } from '@theia/core/lib/browser'; +import { + Emitter, + Command, + MenuPath, + MessageService, + MenuModelRegistry, + MenuContribution, + CommandRegistry, + CommandContribution +} from '@theia/core/lib/common'; +import { ElectronMainMenuFactory } from '@theia/core/lib/electron-browser/menu/electron-main-menu-factory'; +import { FrontendApplicationConfigProvider } from '@theia/core/lib/browser/frontend-application-config-provider'; +import { SampleUpdater, UpdateStatus, SampleUpdaterClient } from '../../common/updater/sample-updater'; + +export namespace SampleUpdaterCommands { + + const category = 'API Samples'; + + export const CHECK_FOR_UPDATES: Command = { + id: 'electron-sample:check-for-updates', + label: 'Check for Updates...', + category + }; + + export const RESTART_TO_UPDATE: Command = { + id: 'electron-sample:restart-to-update', + label: 'Restart to Update', + category + }; + + // Mock + export const MOCK_UPDATE_AVAILABLE: Command = { + id: 'electron-sample:mock-update-available', + label: 'Mock Update - Available', + category + }; + + export const MOCK_UPDATE_NOT_AVAILABLE: Command = { + id: 'electron-sample:mock-update-not-available', + label: 'Mock Update - Not Available', + category + }; + +} + +export namespace SampleUpdaterMenu { + export const MENU_PATH: MenuPath = [...CommonMenus.FILE_SETTINGS_SUBMENU, '3_settings_submenu_update']; +} + +@injectable() +export class SampleUpdaterClientImpl implements SampleUpdaterClient { + + protected readonly onReadyToInstallEmitter = new Emitter(); + readonly onReadyToInstall = this.onReadyToInstallEmitter.event; + + notifyReadyToInstall(): void { + this.onReadyToInstallEmitter.fire(); + } + +} + +// Dynamic menus aren't yet supported by electron: https://github.com/eclipse-theia/theia/issues/446 +@injectable() +export class ElectronMenuUpdater { + + @inject(ElectronMainMenuFactory) + protected readonly factory: ElectronMainMenuFactory; + + public update(): void { + this.setMenu(); + } + + private setMenu(): void { + window.electronTheiaCore.setMenu(this.factory.createElectronMenuBar()); + } + +} + +@injectable() +export class SampleUpdaterFrontendContribution implements CommandContribution, MenuContribution { + + @inject(MessageService) + protected readonly messageService: MessageService; + + @inject(ElectronMenuUpdater) + protected readonly menuUpdater: ElectronMenuUpdater; + + @inject(SampleUpdater) + protected readonly updater: SampleUpdater; + + @inject(SampleUpdaterClientImpl) + protected readonly updaterClient: SampleUpdaterClientImpl; + + protected readyToUpdate = false; + + @postConstruct() + protected init(): void { + this.updaterClient.onReadyToInstall(async () => { + this.readyToUpdate = true; + this.menuUpdater.update(); + this.handleUpdatesAvailable(); + }); + } + + registerCommands(registry: CommandRegistry): void { + registry.registerCommand(SampleUpdaterCommands.CHECK_FOR_UPDATES, { + execute: async () => { + const { status } = await this.updater.checkForUpdates(); + switch (status) { + case UpdateStatus.Available: { + this.handleUpdatesAvailable(); + break; + } + case UpdateStatus.NotAvailable: { + const { applicationName } = FrontendApplicationConfigProvider.get(); + this.messageService.info(`[Sample Updater - Not Available]: You're all good. You've got the latest version of ${applicationName}.`, { timeout: 3000 }); + break; + } + case UpdateStatus.InProgress: { + this.messageService.warn('[Sample Updater - Downloading]: Work in progress...', { timeout: 3000 }); + break; + } + default: throw new Error(`Unexpected status: ${status}`); + } + }, + isEnabled: () => !this.readyToUpdate, + isVisible: () => !this.readyToUpdate + }); + registry.registerCommand(SampleUpdaterCommands.RESTART_TO_UPDATE, { + execute: () => this.updater.onRestartToUpdateRequested(), + isEnabled: () => this.readyToUpdate, + isVisible: () => this.readyToUpdate + }); + registry.registerCommand(SampleUpdaterCommands.MOCK_UPDATE_AVAILABLE, { + execute: () => this.updater.setUpdateAvailable(true) + }); + registry.registerCommand(SampleUpdaterCommands.MOCK_UPDATE_NOT_AVAILABLE, { + execute: () => this.updater.setUpdateAvailable(false) + }); + } + + registerMenus(registry: MenuModelRegistry): void { + registry.registerMenuAction(SampleUpdaterMenu.MENU_PATH, { + commandId: SampleUpdaterCommands.CHECK_FOR_UPDATES.id + }); + registry.registerMenuAction(SampleUpdaterMenu.MENU_PATH, { + commandId: SampleUpdaterCommands.RESTART_TO_UPDATE.id + }); + } + + protected async handleUpdatesAvailable(): Promise { + const answer = await this.messageService.info('[Sample Updater - Available]: Found updates, do you want update now?', 'No', 'Yes'); + if (answer === 'Yes') { + this.updater.onRestartToUpdateRequested(); + } + } + +} diff --git a/examples/api-samples.disabled/src/electron-browser/updater/sample-updater-frontend-module.ts b/examples/api-samples.disabled/src/electron-browser/updater/sample-updater-frontend-module.ts new file mode 100644 index 0000000..844bfd3 --- /dev/null +++ b/examples/api-samples.disabled/src/electron-browser/updater/sample-updater-frontend-module.ts @@ -0,0 +1,34 @@ +// ***************************************************************************** +// Copyright (C) 2020 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { ContainerModule } from '@theia/core/shared/inversify'; +import { ElectronIpcConnectionProvider } from '@theia/core/lib/electron-browser/messaging/electron-ipc-connection-source'; +import { CommandContribution, MenuContribution } from '@theia/core/lib/common'; +import { SampleUpdater, SampleUpdaterPath, SampleUpdaterClient } from '../../common/updater/sample-updater'; +import { SampleUpdaterFrontendContribution, ElectronMenuUpdater, SampleUpdaterClientImpl } from './sample-updater-frontend-contribution'; + +export default new ContainerModule(bind => { + bind(ElectronMenuUpdater).toSelf().inSingletonScope(); + bind(SampleUpdaterClientImpl).toSelf().inSingletonScope(); + bind(SampleUpdaterClient).toService(SampleUpdaterClientImpl); + bind(SampleUpdater).toDynamicValue(context => { + const client = context.container.get(SampleUpdaterClientImpl); + return ElectronIpcConnectionProvider.createProxy(context.container, SampleUpdaterPath, client); + }).inSingletonScope(); + bind(SampleUpdaterFrontendContribution).toSelf().inSingletonScope(); + bind(MenuContribution).toService(SampleUpdaterFrontendContribution); + bind(CommandContribution).toService(SampleUpdaterFrontendContribution); +}); diff --git a/examples/api-samples.disabled/src/electron-main/update/sample-updater-impl.ts b/examples/api-samples.disabled/src/electron-main/update/sample-updater-impl.ts new file mode 100644 index 0000000..3c86aa7 --- /dev/null +++ b/examples/api-samples.disabled/src/electron-main/update/sample-updater-impl.ts @@ -0,0 +1,91 @@ +// ***************************************************************************** +// Copyright (C) 2020 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { injectable } from '@theia/core/shared/inversify'; +import { ElectronMainApplication, ElectronMainApplicationContribution } from '@theia/core/lib/electron-main/electron-main-application'; +import { SampleUpdater, SampleUpdaterClient, UpdateStatus } from '../../common/updater/sample-updater'; + +@injectable() +export class SampleUpdaterImpl implements SampleUpdater, ElectronMainApplicationContribution { + + protected clients: Array = []; + protected inProgressTimer: NodeJS.Timeout | undefined; + protected available = false; + + async checkForUpdates(): Promise<{ status: UpdateStatus }> { + if (this.inProgressTimer) { + return { status: UpdateStatus.InProgress }; + } + return { status: this.available ? UpdateStatus.Available : UpdateStatus.NotAvailable }; + } + + onRestartToUpdateRequested(): void { + console.info("[api-samples] 'Update to Restart' was requested by the frontend."); + // Here comes your install and restart implementation. For example: `autoUpdater.quitAndInstall();` + } + + async setUpdateAvailable(available: boolean): Promise { + if (this.inProgressTimer) { + clearTimeout(this.inProgressTimer); + } + if (!available) { + this.inProgressTimer = undefined; + this.available = false; + } else { + this.inProgressTimer = setTimeout(() => { + this.inProgressTimer = undefined; + this.available = true; + for (const client of this.clients) { + client.notifyReadyToInstall(); + } + }, 5000); + } + } + + onStart(application: ElectronMainApplication): void { + // Called when the contribution is starting. You can use both async and sync code from here. + } + + onStop(application: ElectronMainApplication): void { + // Invoked when the contribution is stopping. You can clean up things here. You are not allowed call async code from here. + } + + setClient(client: SampleUpdaterClient | undefined): void { + if (client) { + this.clients.push(client); + console.info('[api-samples] Registered a new sample updater client.'); + } else { + console.warn("[api-samples] Couldn't register undefined client."); + } + } + + disconnectClient(client: SampleUpdaterClient): void { + const index = this.clients.indexOf(client); + if (index !== -1) { + this.clients.splice(index, 1); + console.info('[api-samples] Disposed a sample updater client.'); + } else { + console.warn("[api-samples] Couldn't dispose client; it was not registered."); + } + } + + dispose(): void { + console.info('[api-samples] >>> Disposing sample updater service...'); + this.clients.forEach(this.disconnectClient.bind(this)); + console.info('[api-samples] >>> Disposed sample updater service.'); + } + +} diff --git a/examples/api-samples.disabled/src/electron-main/update/sample-updater-main-module.ts b/examples/api-samples.disabled/src/electron-main/update/sample-updater-main-module.ts new file mode 100644 index 0000000..d9fdc2a --- /dev/null +++ b/examples/api-samples.disabled/src/electron-main/update/sample-updater-main-module.ts @@ -0,0 +1,36 @@ +// ***************************************************************************** +// Copyright (C) 2020 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { ContainerModule } from '@theia/core/shared/inversify'; +import { RpcConnectionHandler } from '@theia/core/lib/common/messaging/proxy-factory'; +import { ElectronMainApplicationContribution } from '@theia/core/lib/electron-main/electron-main-application'; +import { ElectronConnectionHandler } from '@theia/core/lib/electron-main/messaging/electron-connection-handler'; +import { SampleUpdaterPath, SampleUpdater, SampleUpdaterClient } from '../../common/updater/sample-updater'; +import { SampleUpdaterImpl } from './sample-updater-impl'; + +export default new ContainerModule(bind => { + bind(SampleUpdaterImpl).toSelf().inSingletonScope(); + bind(SampleUpdater).toService(SampleUpdaterImpl); + bind(ElectronMainApplicationContribution).toService(SampleUpdater); + bind(ElectronConnectionHandler).toDynamicValue(context => + new RpcConnectionHandler(SampleUpdaterPath, client => { + const server = context.container.get(SampleUpdater); + server.setClient(client); + client.onDidCloseConnection(() => server.disconnectClient(client)); + return server; + }) + ).inSingletonScope(); +}); diff --git a/examples/api-samples.disabled/src/node/api-samples-backend-module.ts b/examples/api-samples.disabled/src/node/api-samples-backend-module.ts new file mode 100644 index 0000000..019d845 --- /dev/null +++ b/examples/api-samples.disabled/src/node/api-samples-backend-module.ts @@ -0,0 +1,48 @@ +// ***************************************************************************** +// Copyright (C) 2021 Ericsson and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { ContainerModule } from '@theia/core/shared/inversify'; +import { BackendApplicationContribution, BackendApplicationServer } from '@theia/core/lib/node'; +import { SampleBackendApplicationServer } from './sample-backend-application-server'; +import { SampleMockOpenVsxServer } from './sample-mock-open-vsx-server'; +import { SampleAppInfo } from '../common/vsx/sample-app-info'; +import { SampleBackendAppInfo } from './sample-backend-app-info'; +import { rebindOVSXClientFactory } from '../common/vsx/sample-ovsx-client-factory'; +import { ConnectionHandler, PreferenceContribution, RpcConnectionHandler } from '@theia/core'; +import { FileWatchingPreferencesSchema } from '../common/preference-schema'; +import { MCPBackendContribution } from '@theia/ai-mcp-server/lib/node/mcp-theia-server'; +import { MCPTestContribution } from './sample-mcp-test-contribution'; +import { SampleBackendPreferencesService, sampleBackendPreferencesServicePath } from '../common/preference-protocol'; +import { SampleBackendPreferencesBackendServiceImpl } from './sample-backend-preferences-service'; + +export default new ContainerModule((bind, unbind, isBound, rebind) => { + bind(SampleBackendPreferencesBackendServiceImpl).toSelf().inSingletonScope(); + bind(MCPBackendContribution).to(MCPTestContribution).inSingletonScope(); + bind(SampleBackendPreferencesService).toService(SampleBackendPreferencesBackendServiceImpl); + bind(ConnectionHandler).toDynamicValue(ctx => + new RpcConnectionHandler(sampleBackendPreferencesServicePath, () => ctx.container.get(SampleBackendPreferencesService)) + ).inSingletonScope(); + bind(PreferenceContribution).toConstantValue({ schema: FileWatchingPreferencesSchema }); + rebindOVSXClientFactory(rebind); + bind(SampleBackendAppInfo).toSelf().inSingletonScope(); + bind(SampleAppInfo).toService(SampleBackendAppInfo); + bind(BackendApplicationContribution).toService(SampleBackendAppInfo); + // bind a mock/sample OpenVSX registry: + bind(BackendApplicationContribution).to(SampleMockOpenVsxServer).inSingletonScope(); + if (process.env.SAMPLE_BACKEND_APPLICATION_SERVER) { + bind(BackendApplicationServer).to(SampleBackendApplicationServer).inSingletonScope(); + } +}); diff --git a/examples/api-samples.disabled/src/node/sample-backend-app-info.ts b/examples/api-samples.disabled/src/node/sample-backend-app-info.ts new file mode 100644 index 0000000..dbc7b3c --- /dev/null +++ b/examples/api-samples.disabled/src/node/sample-backend-app-info.ts @@ -0,0 +1,53 @@ +// ***************************************************************************** +// Copyright (C) 2023 Ericsson and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { environment } from '@theia/core/lib/common'; +import { Deferred } from '@theia/core/lib/common/promise-util'; +import { BackendApplicationCliContribution, BackendApplicationContribution } from '@theia/core/lib/node'; +import { inject, injectable } from '@theia/core/shared/inversify'; +import * as net from 'net'; +import { SampleAppInfo } from '../common/vsx/sample-app-info'; + +@injectable() +export class SampleBackendAppInfo implements SampleAppInfo, BackendApplicationContribution { + + protected addressDeferred = new Deferred(); + + @inject(BackendApplicationCliContribution) + protected backendCli: BackendApplicationCliContribution; + + onStart(server: net.Server): void { + const address = server.address(); + // eslint-disable-next-line no-null/no-null + if (typeof address === 'object' && address !== null) { + this.addressDeferred.resolve(address); + } else { + this.addressDeferred.resolve({ + address: '127.0.0.1', + port: 3000, + family: '4' + }); + } + } + + async getSelfOrigin(): Promise { + const { ssl } = this.backendCli; + const protocol = ssl ? 'https' : 'http'; + const { address, port } = await this.addressDeferred.promise; + const hostname = environment.electron.is() ? 'localhost' : address; + return `${protocol}://${hostname}:${port}`; + } +} diff --git a/examples/api-samples.disabled/src/node/sample-backend-application-server.ts b/examples/api-samples.disabled/src/node/sample-backend-application-server.ts new file mode 100644 index 0000000..e5f26e5 --- /dev/null +++ b/examples/api-samples.disabled/src/node/sample-backend-application-server.ts @@ -0,0 +1,29 @@ +// ***************************************************************************** +// Copyright (C) 2021 Ericsson and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { injectable } from '@theia/core/shared/inversify'; +import { BackendApplicationServer } from '@theia/core/lib/node'; +import express = require('@theia/core/shared/express'); + +@injectable() +export class SampleBackendApplicationServer implements BackendApplicationServer { + + configure(app: express.Application): void { + app.get('*', (req, res) => { + res.status(200).send('SampleBackendApplicationServer OK'); + }); + } +} diff --git a/examples/api-samples.disabled/src/node/sample-backend-preferences-service.ts b/examples/api-samples.disabled/src/node/sample-backend-preferences-service.ts new file mode 100644 index 0000000..3396f3d --- /dev/null +++ b/examples/api-samples.disabled/src/node/sample-backend-preferences-service.ts @@ -0,0 +1,56 @@ +// ***************************************************************************** +// Copyright (C) 2025 STMicroelectronics and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 + +import { JSONValue } from '@theia/core/shared/@lumino/coreutils'; +import { SampleBackendPreferencesService } from '../common/preference-protocol'; +import { inject, injectable } from '@theia/core/shared/inversify'; +import { PreferenceInspection, PreferenceLanguageOverrideService, PreferenceScope, PreferenceService } from '@theia/core'; + +@injectable() +export class SampleBackendPreferencesBackendServiceImpl implements SampleBackendPreferencesService { + @inject(PreferenceService) + protected readonly preferenceService: PreferenceService; + + @inject(PreferenceLanguageOverrideService) + protected readonly languageOverrideService: PreferenceLanguageOverrideService; + + async getPreference(key: string, overrideIdentifier: string): Promise { + let preferenceName = key; + if (overrideIdentifier) { + preferenceName = this.languageOverrideService.overridePreferenceName({ preferenceName, overrideIdentifier }); + + } + return this.preferenceService.get(preferenceName); + } + + async inspectPreference(key: string, overrideIdentifier?: string): Promise { + let preferenceName = key; + if (overrideIdentifier) { + preferenceName = this.languageOverrideService.overridePreferenceName({ preferenceName, overrideIdentifier }); + + } + return this.preferenceService.inspect(preferenceName); + } + + async setPreference(key: string, overrideIdentifier: string | undefined, value: JSONValue): Promise { + let preferenceName = key; + if (overrideIdentifier) { + preferenceName = this.languageOverrideService.overridePreferenceName({ preferenceName, overrideIdentifier }); + + } + this.preferenceService.set(preferenceName, value, PreferenceScope.User); + } + +} diff --git a/examples/api-samples.disabled/src/node/sample-mcp-test-contribution.ts b/examples/api-samples.disabled/src/node/sample-mcp-test-contribution.ts new file mode 100644 index 0000000..cd99f17 --- /dev/null +++ b/examples/api-samples.disabled/src/node/sample-mcp-test-contribution.ts @@ -0,0 +1,47 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { inject, injectable } from '@theia/core/shared/inversify'; +import { ILogger } from '@theia/core/lib/common/logger'; +import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'; +import { MCPBackendContribution } from '@theia/ai-mcp-server/lib/node/mcp-theia-server'; +import { z } from 'zod'; + +@injectable() +export class MCPTestContribution implements MCPBackendContribution { + + @inject(ILogger) + protected readonly logger: ILogger; + + async configure(server: McpServer): Promise { + this.logger.info('MCPTestContribution.configure() called - MCP system is working!'); + + server.registerTool('test-tool', { + description: 'Theia MCP server test-tool', + inputSchema: z.object({}) + }, async () => { + this.logger.info('test-tool called'); + return { + content: [{ + type: 'text', + text: 'Test tool executed successfully!' + }] + }; + }); + + this.logger.info('MCPTestContribution: test-tool registered successfully'); + } +} diff --git a/examples/api-samples.disabled/src/node/sample-mock-open-vsx-server.ts b/examples/api-samples.disabled/src/node/sample-mock-open-vsx-server.ts new file mode 100644 index 0000000..3d6e4ee --- /dev/null +++ b/examples/api-samples.disabled/src/node/sample-mock-open-vsx-server.ts @@ -0,0 +1,189 @@ +// ***************************************************************************** +// Copyright (C) 2023 Ericsson and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { BackendApplicationContribution } from '@theia/core/lib/node'; +import * as express from '@theia/core/shared/express'; +import * as fs from 'fs'; +import { inject, injectable, named } from '@theia/core/shared/inversify'; +import { ILogger } from '@theia/core/lib/common/logger'; +import { OVSXMockClient, VSXExtensionRaw } from '@theia/ovsx-client'; +import * as path from 'path'; +import { SampleAppInfo } from '../common/vsx/sample-app-info'; +import * as http from 'http'; +import * as https from 'https'; +import { Deferred } from '@theia/core/lib/common/promise-util'; + +type VersionedId = `${string}.${string}@${string}`; + +/** + * This class implements a very crude OpenVSX mock server for testing. + * + * See {@link configure}'s implementation for supported REST APIs. + */ +@injectable() +export class SampleMockOpenVsxServer implements BackendApplicationContribution { + + @inject(SampleAppInfo) + protected appInfo: SampleAppInfo; + + @inject(ILogger) @named('api-samples') + protected readonly logger: ILogger; + + protected mockClient: OVSXMockClient; + protected staticFileHandlers: Map>; + + private readyDeferred = new Deferred(); + private ready = this.readyDeferred.promise; + + get mockServerPath(): string { + return '/mock-open-vsx'; + } + + get pluginsDbPath(): string { + return '../../sample-plugins'; + } + + async onStart?(server: http.Server | https.Server): Promise { + const selfOrigin = await this.appInfo.getSelfOrigin(); + const baseUrl = `${selfOrigin}${this.mockServerPath}`; + const pluginsDb = await this.findMockPlugins(this.pluginsDbPath, baseUrl); + this.staticFileHandlers = new Map(Array.from(pluginsDb.entries(), ([key, value]) => [key, express.static(value.path)])); + this.mockClient = new OVSXMockClient(Array.from(pluginsDb.values(), value => value.data)); + this.readyDeferred.resolve(); + } + + async configure(app: express.Application): Promise { + app.use( + this.mockServerPath + '/api', + express.Router() + .get('/v2/-/query', async (req, res) => { + await this.ready; + res.json(await this.mockClient.query(this.sanitizeQuery(req.query))); + }) + .get('/-/search', async (req, res) => { + await this.ready; + res.json(await this.mockClient.search(this.sanitizeQuery(req.query))); + }) + .get('/:namespace', async (req, res) => { + await this.ready; + const extensions = this.mockClient.extensions + .filter(ext => req.params.namespace === ext.namespace) + .map(ext => `${ext.namespaceUrl}/${ext.name}`); + if (extensions.length === 0) { + res.status(404).json({ error: `Namespace not found: ${req.params.namespace}` }); + } else { + res.json({ + name: req.params.namespace, + extensions + }); + } + }) + .get('/:namespace/:name', async (req, res) => { + await this.ready; + res.json(this.mockClient.extensions.find(ext => req.params.namespace === ext.namespace && req.params.name === ext.name)); + }) + .get('/:namespace/:name/reviews', async (req, res) => { + res.json([]); + }) + // implicitly GET/HEAD because of the express.static handlers + .use('/:namespace/:name/:version/file', async (req, res, next) => { + await this.ready; + const versionedId = this.getVersionedId(req.params.namespace, req.params.name, req.params.version); + const staticFileHandler = this.staticFileHandlers.get(versionedId); + if (!staticFileHandler) { + return next(); + } + staticFileHandler(req, res, next); + }) + ); + } + + protected getVersionedId(namespace: string, name: string, version: string): VersionedId { + return `${namespace}.${name}@${version}`; + } + + protected sanitizeQuery(query?: Record): Record { + return typeof query === 'object' + ? Object.fromEntries(Object.entries(query).filter(([key, value]) => typeof value === 'string') as [string, string][]) + : {}; + } + + /** + * This method expects the following folder hierarchy: `pluginsDbPath/namespace/pluginName/pluginFiles...` + * @param pluginsDbPath where to look for plugins on the disk. + * @param baseUrl used when generating the URLs for {@link VSXExtensionRaw} properties. + */ + protected async findMockPlugins(pluginsDbPath: string, baseUrl: string): Promise> { + const url = new OVSXMockClient.UrlBuilder(baseUrl); + const result = new Map(); + if (!await this.isDirectory(pluginsDbPath)) { + this.logger.error(`ERROR: ${pluginsDbPath} is not a directory!`); + return result; + } + const namespaces = await fs.promises.readdir(pluginsDbPath); + await Promise.all(namespaces.map(async namespace => { + const namespacePath = path.join(pluginsDbPath, namespace); + if (!await this.isDirectory(namespacePath)) { + return; + } + const names = await fs.promises.readdir(namespacePath); + await Promise.all(names.map(async pluginName => { + const pluginPath = path.join(namespacePath, pluginName); + if (!await this.isDirectory(pluginPath)) { + return; + } + const packageJsonPath = path.join(pluginPath, 'package.json'); + const { name, version } = JSON.parse(await fs.promises.readFile(packageJsonPath, 'utf8')); + const versionedId = this.getVersionedId(namespace, name, version); + result.set(versionedId, { + path: pluginPath, + data: { + allVersions: {}, + downloadCount: 0, + files: { + // the default generated name from vsce is NAME-VERSION.vsix + download: url.extensionFileUrl(namespace, name, version, `/${name}-${version}.vsix`), + icon: url.extensionFileUrl(namespace, name, version, '/icon128.png'), + readme: url.extensionFileUrl(namespace, name, version, '/README.md') + }, + name, + namespace, + namespaceAccess: 'public', + namespaceUrl: url.namespaceUrl(namespace), + publishedBy: { + loginName: 'mock-open-vsx' + }, + reviewCount: 0, + reviewsUrl: url.extensionReviewsUrl(namespace, name), + timestamp: new Date().toISOString(), + version, + namespaceDisplayName: name, + preRelease: false + } + }); + })); + })); + return result; + } + + protected async isDirectory(fsPath: string): Promise { + return (await fs.promises.stat(fsPath)).isDirectory(); + } +} diff --git a/examples/api-samples.disabled/tsconfig.json b/examples/api-samples.disabled/tsconfig.json new file mode 100644 index 0000000..8ae0c7e --- /dev/null +++ b/examples/api-samples.disabled/tsconfig.json @@ -0,0 +1,58 @@ +{ + "extends": "../../configs/base.tsconfig", + "compilerOptions": { + "composite": true, + "rootDir": "src", + "outDir": "lib" + }, + "include": [ + "src" + ], + "references": [ + { + "path": "../../dev-packages/ovsx-client" + }, + { + "path": "../../packages/ai-chat" + }, + { + "path": "../../packages/ai-chat-ui" + }, + { + "path": "../../packages/ai-code-completion" + }, + { + "path": "../../packages/ai-core" + }, + { + "path": "../../packages/core" + }, + { + "path": "../../packages/file-search" + }, + { + "path": "../../packages/filesystem" + }, + { + "path": "../../packages/monaco" + }, + { + "path": "../../packages/output" + }, + { + "path": "../../packages/search-in-workspace" + }, + { + "path": "../../packages/test" + }, + { + "path": "../../packages/toolbar" + }, + { + "path": "../../packages/vsx-registry" + }, + { + "path": "../../packages/workspace" + } + ] +} diff --git a/examples/api-tests/package.json b/examples/api-tests/package.json new file mode 100644 index 0000000..4c38a18 --- /dev/null +++ b/examples/api-tests/package.json @@ -0,0 +1,24 @@ +{ + "name": "@theia/api-tests", + "version": "1.68.0", + "description": "Theia API tests", + "dependencies": { + "@theia/core": "1.68.0" + }, + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "repository": { + "type": "git", + "url": "https://github.com/eclipse-theia/theia.git" + }, + "bugs": { + "url": "https://github.com/eclipse-theia/theia/issues" + }, + "homepage": "https://github.com/eclipse-theia/theia", + "files": [ + "src" + ], + "publishConfig": { + "access": "public" + }, + "gitHead": "21358137e41342742707f660b8e222f940a27652" +} diff --git a/examples/api-tests/src/api-tests.d.ts b/examples/api-tests/src/api-tests.d.ts new file mode 100644 index 0000000..b0dd1ee --- /dev/null +++ b/examples/api-tests/src/api-tests.d.ts @@ -0,0 +1,21 @@ +// ***************************************************************************** +// Copyright (C) 2020 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +interface Window { + theia: { + container: import('inversify').Container + } +} diff --git a/examples/api-tests/src/browser-utils.spec.js b/examples/api-tests/src/browser-utils.spec.js new file mode 100644 index 0000000..452a85e --- /dev/null +++ b/examples/api-tests/src/browser-utils.spec.js @@ -0,0 +1,54 @@ +// ***************************************************************************** +// Copyright (C) 2020 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +// @ts-check +describe('animationFrame', function () { + this.timeout(5_000); + const { assert } = chai; + const { animationFrame } = require('@theia/core/lib/browser/browser'); + + class FrameCounter { + constructor() { + this.count = 0; + this.stop = false; + this.run(); + } + run() { + requestAnimationFrame(this.nextFrame.bind(this)); + } + nextFrame() { + this.count++; + if (!this.stop) { + this.run(); + } + } + } + + it('should resolve after one frame', async () => { + const counter = new FrameCounter(); + await animationFrame(); + counter.stop = true; + assert.equal(counter.count, 1); + }); + + it('should resolve after the given number of frames', async () => { + const counter = new FrameCounter(); + await animationFrame(10); + counter.stop = true; + assert.equal(counter.count, 10); + }); + +}); diff --git a/examples/api-tests/src/contribution-filter.spec.js b/examples/api-tests/src/contribution-filter.spec.js new file mode 100644 index 0000000..389ce33 --- /dev/null +++ b/examples/api-tests/src/contribution-filter.spec.js @@ -0,0 +1,36 @@ +// ***************************************************************************** +// Copyright (C) 2021 STMicroelectronics and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +// @ts-check +describe('Contribution filter', function () { + this.timeout(5000); + const { assert } = chai; + + const { CommandRegistry, CommandContribution } = require('@theia/core/lib/common/command'); + const { SampleFilteredCommandContribution, SampleFilteredCommand } = require('@theia/api-samples/lib/browser/contribution-filter/sample-filtered-command-contribution'); + + const container = window.theia.container; + const commands = container.get(CommandRegistry); + + it('filtered command in container but not in registry', async function () { + const allCommands = container.getAll(CommandContribution); + assert.isDefined(allCommands.find(contribution => contribution instanceof SampleFilteredCommandContribution), + 'SampleFilteredCommandContribution is not bound in container'); + const filteredCommand = commands.getCommand(SampleFilteredCommand.FILTERED.id); + assert.isUndefined(filteredCommand, 'SampleFilteredCommandContribution should be filtered out but is present in "CommandRegistry"'); + }); + +}); diff --git a/examples/api-tests/src/credentials-service.spec.js b/examples/api-tests/src/credentials-service.spec.js new file mode 100644 index 0000000..0bd7ceb --- /dev/null +++ b/examples/api-tests/src/credentials-service.spec.js @@ -0,0 +1,76 @@ +// ***************************************************************************** +// Copyright (C) 2024 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +// @ts-check +describe('CredentialsService', function () { + this.timeout(5000); + const { assert } = chai; + + const { CredentialsService } = require('@theia/core/lib/browser/credentials-service'); + + /** @type {import('inversify').Container} */ + const container = window['theia'].container; + /** @type {import('@theia/core/lib/browser/credentials-service').CredentialsService} */ + const credentials = container.get(CredentialsService); + + const serviceName = 'theia-test'; + const accountName = 'test-account'; + const password = 'test-password'; + + this.beforeEach(async () => { + await credentials.deletePassword(serviceName, accountName); + }); + + it('can set and retrieve stored credentials', async function () { + await credentials.setPassword(serviceName, accountName, password); + const storedPassword = await credentials.getPassword(serviceName, accountName); + assert.strictEqual(storedPassword, password); + }); + + it('can retrieve all account keys for a service', async function () { + // Initially, there should be no keys for the service + let keys = await credentials.keys(serviceName); + assert.strictEqual(keys.length, 0); + + // Add a single credential + await credentials.setPassword(serviceName, accountName, password); + keys = await credentials.keys(serviceName); + assert.strictEqual(keys.length, 1); + assert.include(keys, accountName); + + // Add more credentials with different account names + const accountName2 = 'test-account-2'; + const accountName3 = 'test-account-3'; + await credentials.setPassword(serviceName, accountName2, 'password2'); + await credentials.setPassword(serviceName, accountName3, 'password3'); + + keys = await credentials.keys(serviceName); + assert.strictEqual(keys.length, 3); + assert.include(keys, accountName); + assert.include(keys, accountName2); + assert.include(keys, accountName3); + + // Clean up all accounts + await credentials.deletePassword(serviceName, accountName); + await credentials.deletePassword(serviceName, accountName2); + await credentials.deletePassword(serviceName, accountName3); + + // Verify keys are removed after deletion + keys = await credentials.keys(serviceName); + assert.strictEqual(keys.length, 0); + }); + +}); diff --git a/examples/api-tests/src/explorer-open-close.spec.js b/examples/api-tests/src/explorer-open-close.spec.js new file mode 100644 index 0000000..b7195e7 --- /dev/null +++ b/examples/api-tests/src/explorer-open-close.spec.js @@ -0,0 +1,137 @@ +// ***************************************************************************** +// Copyright (C) 2023 Ericsson and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +// @ts-check +describe('Explorer and Editor - open and close', function () { + this.timeout(90_000); + const { assert } = chai; + + const { DisposableCollection } = require('@theia/core/lib/common/disposable'); + const { EditorManager } = require('@theia/editor/lib/browser/editor-manager'); + const { WorkspaceService } = require('@theia/workspace/lib/browser/workspace-service'); + const { FileNavigatorContribution } = require('@theia/navigator/lib/browser/navigator-contribution'); + const { ApplicationShell } = require('@theia/core/lib/browser/shell/application-shell'); + const { HostedPluginSupport } = require('@theia/plugin-ext/lib/hosted/browser/hosted-plugin'); + const { ProgressStatusBarItem } = require('@theia/core/lib/browser/progress-status-bar-item'); + const { EXPLORER_VIEW_CONTAINER_ID } = require('@theia/navigator/lib/browser/navigator-widget-factory'); + const { MonacoEditor } = require('@theia/monaco/lib/browser/monaco-editor'); + const container = window.theia.container; + const editorManager = container.get(EditorManager); + const workspaceService = container.get(WorkspaceService); + const navigatorContribution = container.get(FileNavigatorContribution); + const shell = container.get(ApplicationShell); + const rootUri = workspaceService.tryGetRoots()[0].resource; + const pluginService = container.get(HostedPluginSupport); + const progressStatusBarItem = container.get(ProgressStatusBarItem); + + + const fileUri = rootUri.resolve('webpack.config.js'); + const toTearDown = new DisposableCollection(); + + function pause(ms = 500) { + console.debug(`pause test for: ${ms} ms`); + return new Promise(resolve => setTimeout(resolve, ms)); + } + + before(async () => { + await pluginService.didStart; + await editorManager.closeAll({ save: false }); + }); + + afterEach(async () => { + await editorManager.closeAll({ save: false }); + await navigatorContribution.closeView(); + }); + + after(async () => { + toTearDown.dispose(); + }); + + for (var i = 0; i < 5; i++) { + let ordering = 0; + it('Open/Close explorer and editor - ordering: ' + ordering++ + ', iteration #' + i, async function () { + await openExplorer(); + await openEditor(); + await closeEditor(); + await closeExplorer(); + }); + + it('Open/Close explorer and editor - ordering: ' + ordering++ + ', iteration #' + i, async function () { + await openExplorer(); + await openEditor(); + await closeExplorer(); + await closeEditor(); + }); + + it('Open/Close editor, explorer - ordering: ' + ordering++ + ', iteration - #' + i, async function () { + await openEditor(); + await openExplorer(); + await closeEditor(); + await closeExplorer(); + }); + + it('Open/Close editor, explorer - ordering: ' + ordering++ + ', iteration - #' + i, async function () { + await openEditor(); + await openExplorer(); + await closeExplorer(); + await closeEditor(); + }); + + it('Open/Close explorer #' + i, async function () { + await openExplorer(); + await closeExplorer(); + }); + } + + it('open/close explorer in quick succession', async function () { + for (let i = 0; i < 20; i++) { + await openExplorer(); + await closeExplorer(); + } + }); + + it('open/close editor in quick succession', async function () { + await openExplorer(); + for (let i = 0; i < 20; i++) { + await openEditor(); + await closeEditor(); + } + }); + + async function openExplorer() { + await navigatorContribution.openView({ activate: true }); + const widget = await shell.revealWidget(EXPLORER_VIEW_CONTAINER_ID); + assert.isDefined(widget, 'Explorer widget should exist'); + } + async function closeExplorer() { + await navigatorContribution.closeView(); + assert.isUndefined(await shell.revealWidget(EXPLORER_VIEW_CONTAINER_ID), 'Explorer widget should not exist'); + } + + async function openEditor() { + await editorManager.open(fileUri, { mode: 'activate' }); + const activeEditor = /** @type {MonacoEditor} */ MonacoEditor.get(editorManager.activeEditor); + assert.isDefined(activeEditor); + assert.equal(activeEditor.uri.resolveToAbsolute().toString(), fileUri.resolveToAbsolute().toString()); + } + + async function closeEditor() { + await editorManager.closeAll({ save: false }); + const activeEditor = /** @type {MonacoEditor} */ MonacoEditor.get(editorManager.activeEditor); + assert.isUndefined(activeEditor); + } + +}); diff --git a/examples/api-tests/src/file-search.spec.js b/examples/api-tests/src/file-search.spec.js new file mode 100644 index 0000000..b67e029 --- /dev/null +++ b/examples/api-tests/src/file-search.spec.js @@ -0,0 +1,133 @@ +// ***************************************************************************** +// Copyright (C) 2021 Ericsson and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +// @ts-check +describe('file-search', function () { + + const { assert } = chai; + + const Uri = require('@theia/core/lib/common/uri'); + const { QuickFileOpenService } = require('@theia/file-search/lib/browser/quick-file-open'); + const { QuickFileSelectService } = require('@theia/file-search/lib/browser/quick-file-select-service'); + const { CancellationTokenSource } = require('@theia/core/lib/common/cancellation'); + + /** @type {import('inversify').Container} */ + const container = window['theia'].container; + const quickFileOpenService = container.get(QuickFileOpenService); + const quickFileSelectService = container.get(QuickFileSelectService); + + describe('quick-file-open', () => { + + describe('#compareItems', () => { + + const sortByCompareItems = (a, b) => quickFileSelectService['compareItems'](a, b, quickFileOpenService['filterAndRange'].filter); + + it('should compare two quick-open-items by `label`', () => { + + /** @type import ('@theia/file-search/lib/browser/quick-file-open').FileQuickPickItem*/ + const a = { label: 'a', uri: new Uri.default('b') }; + /** @type import ('@theia/file-search/lib/browser/quick-file-open').FileQuickPickItem*/ + const b = { label: 'b', uri: new Uri.default('a') }; + + assert.deepEqual([a, b].sort(sortByCompareItems), [a, b], 'a should be before b'); + assert.deepEqual([b, a].sort(sortByCompareItems), [a, b], 'a should be before b'); + assert.equal(quickFileSelectService['compareItems'](a, a, quickFileOpenService['filterAndRange'].filter), 0, 'items should be equal'); + }); + + it('should compare two quick-open-items by `uri`', () => { + + /** @type import ('@theia/file-search/lib/browser/quick-file-open').FileQuickPickItem*/ + const a = { label: 'a', uri: new Uri.default('a') }; + /** @type import ('@theia/file-search/lib/browser/quick-file-open').FileQuickPickItem*/ + const b = { label: 'a', uri: new Uri.default('b') }; + assert.deepEqual([a, b].sort(sortByCompareItems), [a, b], 'a should be before b'); + assert.deepEqual([b, a].sort(sortByCompareItems), [a, b], 'a should be before b'); + assert.equal(sortByCompareItems(a, a), 0, 'items should be equal'); + }); + + it('should not place very good matches above exact matches', () => { + const exactMatch = 'almost_absurdly_long_file_name_with_many_parts.file'; + const veryGoodMatch = 'almost_absurdly_long_file_name_with_many_parts_plus_one.file'; + quickFileOpenService['filterAndRange'] = { filter: exactMatch }; + /** @type import ('@theia/file-search/lib/browser/quick-file-open').FileQuickPickItem*/ + const a = { label: exactMatch, uri: new Uri.default(exactMatch) }; + /** @type import ('@theia/file-search/lib/browser/quick-file-open').FileQuickPickItem*/ + const b = { label: veryGoodMatch, uri: new Uri.default(veryGoodMatch) }; + assert.deepEqual([a, b].sort(sortByCompareItems), [a, b], 'a should be before b'); + assert.deepEqual([b, a].sort(sortByCompareItems), [a, b], 'a should be before b'); + assert.equal(sortByCompareItems(a, a), 0, 'items should be equal'); + quickFileOpenService['filterAndRange'] = quickFileOpenService['filterAndRangeDefault']; + }); + + }); + + describe('#filterAndRange', () => { + + it('should return the default when not searching', () => { + const filterAndRange = quickFileOpenService['filterAndRange']; + assert.equal(filterAndRange, quickFileOpenService['filterAndRangeDefault']); + }); + + it('should update when searching', () => { + quickFileOpenService['getPicks']('a:2:1', new CancellationTokenSource().token); // perform a mock search. + const filterAndRange = quickFileOpenService['filterAndRange']; + assert.equal(filterAndRange.filter, 'a'); + assert.deepEqual(filterAndRange.range, { start: { line: 1, character: 0 }, end: { line: 1, character: 0 } }); + }); + + }); + + describe('#splitFilterAndRange', () => { + + const expression1 = 'a:2:1'; + const expression2 = 'a:2,1'; + const expression3 = 'a:2#2'; + const expression4 = 'a#2:2'; + const expression5 = 'a#2,1'; + const expression6 = 'a#2#2'; + const expression7 = 'a:2'; + const expression8 = 'a#2'; + + it('should split the filter correctly for different combinations', () => { + assert.equal((quickFileOpenService['splitFilterAndRange'](expression1).filter), 'a'); + assert.equal((quickFileOpenService['splitFilterAndRange'](expression2).filter), 'a'); + assert.equal((quickFileOpenService['splitFilterAndRange'](expression3).filter), 'a'); + assert.equal((quickFileOpenService['splitFilterAndRange'](expression4).filter), 'a'); + assert.equal((quickFileOpenService['splitFilterAndRange'](expression5).filter), 'a'); + assert.equal((quickFileOpenService['splitFilterAndRange'](expression6).filter), 'a'); + assert.equal((quickFileOpenService['splitFilterAndRange'](expression7).filter), 'a'); + assert.equal((quickFileOpenService['splitFilterAndRange'](expression8).filter), 'a'); + }); + + it('should split the range correctly for different combinations', () => { + const rangeTest1 = { start: { line: 1, character: 0 }, end: { line: 1, character: 0 } }; + const rangeTest2 = { start: { line: 1, character: 1 }, end: { line: 1, character: 1 } }; + + assert.deepEqual(quickFileOpenService['splitFilterAndRange'](expression1).range, rangeTest1); + assert.deepEqual(quickFileOpenService['splitFilterAndRange'](expression2).range, rangeTest1); + assert.deepEqual(quickFileOpenService['splitFilterAndRange'](expression3).range, rangeTest2); + assert.deepEqual(quickFileOpenService['splitFilterAndRange'](expression4).range, rangeTest2); + assert.deepEqual(quickFileOpenService['splitFilterAndRange'](expression5).range, rangeTest1); + assert.deepEqual(quickFileOpenService['splitFilterAndRange'](expression6).range, rangeTest2); + assert.deepEqual(quickFileOpenService['splitFilterAndRange'](expression7).range, rangeTest1); + assert.deepEqual(quickFileOpenService['splitFilterAndRange'](expression8).range, rangeTest1); + }); + + }); + + }); + +}); diff --git a/examples/api-tests/src/find-replace.spec.js b/examples/api-tests/src/find-replace.spec.js new file mode 100644 index 0000000..af37bfb --- /dev/null +++ b/examples/api-tests/src/find-replace.spec.js @@ -0,0 +1,151 @@ +// ***************************************************************************** +// Copyright (C) 2020 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +// @ts-check +describe('Find and Replace', function () { + this.timeout(20_000); + const { assert } = chai; + + const { animationFrame } = require('@theia/core/lib/browser/browser'); + const { DisposableCollection } = require('@theia/core/lib/common/disposable'); + const { CommonCommands } = require('@theia/core/lib/browser/common-frontend-contribution'); + const { EditorManager } = require('@theia/editor/lib/browser/editor-manager'); + const { WorkspaceService } = require('@theia/workspace/lib/browser/workspace-service'); + const { CommandRegistry } = require('@theia/core/lib/common/command'); + const { KeybindingRegistry } = require('@theia/core/lib/browser/keybinding'); + const { ContextKeyService } = require('@theia/core/lib/browser/context-key-service'); + const { FileNavigatorContribution } = require('@theia/navigator/lib/browser/navigator-contribution'); + const { ApplicationShell } = require('@theia/core/lib/browser/shell/application-shell'); + const { HostedPluginSupport } = require('@theia/plugin-ext/lib/hosted/browser/hosted-plugin'); + const { ProgressStatusBarItem } = require('@theia/core/lib/browser/progress-status-bar-item'); + const { EXPLORER_VIEW_CONTAINER_ID } = require('@theia/navigator/lib/browser/navigator-widget-factory'); + const { MonacoEditor } = require('@theia/monaco/lib/browser/monaco-editor'); + const container = window.theia.container; + const editorManager = container.get(EditorManager); + const workspaceService = container.get(WorkspaceService); + const commands = container.get(CommandRegistry); + const keybindings = container.get(KeybindingRegistry); + const contextKeyService = container.get(ContextKeyService); + const navigatorContribution = container.get(FileNavigatorContribution); + const shell = container.get(ApplicationShell); + const rootUri = workspaceService.tryGetRoots()[0].resource; + const pluginService = container.get(HostedPluginSupport); + const progressStatusBarItem = container.get(ProgressStatusBarItem); + const fileUri = rootUri.resolve('../api-tests/test-ts-workspace/demo-file.ts'); + + const toTearDown = new DisposableCollection(); + + function pause(ms = 500) { + console.debug(`pause test for: ${ms} ms`); + return new Promise(resolve => setTimeout(resolve, ms)); + } + + /** + * @template T + * @param {() => Promise | T} condition + * @returns {Promise} + */ + function waitForAnimation(condition) { + return new Promise(async (resolve, dispose) => { + toTearDown.push({ dispose }); + do { + await animationFrame(); + } while (!condition()); + resolve(); + }); + } + + before(async () => { + await pluginService.didStart; + await shell.leftPanelHandler.collapse(); + await editorManager.closeAll({ save: false }); + }); + + beforeEach(async function () { + await navigatorContribution.closeView(); + }); + + afterEach(async () => { + await editorManager.closeAll({ save: false }); + }); + + after(async () => { + await shell.leftPanelHandler.collapse(); + toTearDown.dispose(); + }); + + /** + * @param {import('@theia/core/lib/common/command').Command} command + */ + async function assertEditorFindReplace(command) { + assert.isFalse(contextKeyService.match('findWidgetVisible')); + assert.isFalse(contextKeyService.match('findInputFocussed')); + assert.isFalse(contextKeyService.match('replaceInputFocussed')); + + keybindings.dispatchCommand(command.id); + await waitForAnimation(() => contextKeyService.match('findInputFocussed')); + + assert.isTrue(contextKeyService.match('findWidgetVisible')); + assert.isTrue(contextKeyService.match('findInputFocussed')); + assert.isFalse(contextKeyService.match('replaceInputFocussed')); + + keybindings.dispatchKeyDown('Tab'); + await waitForAnimation(() => !contextKeyService.match('findInputFocussed')); + assert.isTrue(contextKeyService.match('findWidgetVisible')); + assert.isFalse(contextKeyService.match('findInputFocussed')); + assert.equal(contextKeyService.match('replaceInputFocussed'), command === CommonCommands.REPLACE); + } + + for (const command of [CommonCommands.FIND, CommonCommands.REPLACE]) { + it(command.label + ' in the active editor', async function () { + await openExplorer(); + + await openEditor(); + + await assertEditorFindReplace(command); + }); + + it(command.label + ' in the active explorer without the current editor', async function () { + await openExplorer(); + + // should not throw + await commands.executeCommand(command.id); + }); + + it(command.label + ' in the active explorer with the current editor', async function () { + await openEditor(); + + await openExplorer(); + + await assertEditorFindReplace(command); + }); + + } + + async function openExplorer() { + await navigatorContribution.openView({ activate: true }); + const widget = await shell.revealWidget(EXPLORER_VIEW_CONTAINER_ID); + assert.isDefined(widget, 'Explorer widget should exist'); + } + + async function openEditor() { + await editorManager.open(fileUri, { mode: 'activate' }); + const activeEditor = /** @type {MonacoEditor} */ MonacoEditor.get(editorManager.activeEditor); + assert.isDefined(activeEditor); + // @ts-ignore + assert.equal(activeEditor.uri.resolveToAbsolute().toString(), fileUri.resolveToAbsolute().toString()); + } +}); diff --git a/examples/api-tests/src/keybindings.spec.js b/examples/api-tests/src/keybindings.spec.js new file mode 100644 index 0000000..2035dd0 --- /dev/null +++ b/examples/api-tests/src/keybindings.spec.js @@ -0,0 +1,116 @@ +// ***************************************************************************** +// Copyright (C) 2020 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +// @ts-check +describe('Keybindings', function () { + + const { assert } = chai; + + const { Disposable, DisposableCollection } = require('@theia/core/lib/common/disposable'); + const { isOSX } = require('@theia/core/lib/common/os'); + const { CommonCommands } = require('@theia/core/lib/browser/common-commands'); + const { TerminalService } = require('@theia/terminal/lib/browser/base/terminal-service'); + const { TerminalCommands } = require('@theia/terminal/lib/browser/terminal-frontend-contribution'); + const { ApplicationShell } = require('@theia/core/lib/browser/shell/application-shell'); + const { KeybindingRegistry } = require('@theia/core/lib/browser/keybinding'); + const { CommandRegistry } = require('@theia/core/lib/common/command'); + const { Deferred } = require('@theia/core/lib/common/promise-util'); + const { Key } = require('@theia/core/lib/browser/keys'); + const { EditorManager } = require('@theia/editor/lib/browser/editor-manager'); + const { WorkspaceService } = require('@theia/workspace/lib/browser/workspace-service'); + + /** @type {import('inversify').Container} */ + const container = window['theia'].container; + /** @type {import('@theia/terminal/lib/browser/base/terminal-service').TerminalService} */ + const terminalService = container.get(TerminalService); + const applicationShell = container.get(ApplicationShell); + const keybindings = container.get(KeybindingRegistry); + const commands = container.get(CommandRegistry); + const editorManager = container.get(EditorManager); + const workspaceService = container.get(WorkspaceService); + + const toTearDown = new DisposableCollection(); + afterEach(() => toTearDown.dispose()); + + it('partial keybinding should not override full in the same scope', async () => { + const terminal = /** @type {import('@theia/terminal/lib/browser/terminal-widget-impl').TerminalWidgetImpl} */ + (await terminalService.newTerminal({})); + toTearDown.push(Disposable.create(() => terminal.dispose())); + terminalService.open(terminal, { mode: 'activate' }); + await applicationShell.waitForActivation(terminal.id); + const waitForCommand = new Deferred(); + toTearDown.push(commands.onWillExecuteCommand(e => waitForCommand.resolve(e.commandId))); + keybindings.dispatchKeyDown({ + code: Key.KEY_K.code, + metaKey: isOSX, + ctrlKey: !isOSX + }, terminal.node); + const executedCommand = await waitForCommand.promise; + assert.equal(executedCommand, TerminalCommands.TERMINAL_CLEAR.id); + }); + + it('disabled keybinding should not override enabled', async () => { + const id = '__test:keybindings.left'; + toTearDown.push(commands.registerCommand({ id }, { + execute: () => { } + })); + toTearDown.push(keybindings.registerKeybinding({ + command: id, + keybinding: 'left', + when: 'false' + })); + + const editor = await editorManager.open(workspaceService.tryGetRoots()[0].resource.resolve('webpack.config.js'), { + mode: 'activate', + selection: { + start: { + line: 0, + character: 1 + } + } + }); + toTearDown.push(editor); + const waitForCommand = new Deferred(); + toTearDown.push(commands.onWillExecuteCommand(e => waitForCommand.resolve(e.commandId))); + keybindings.dispatchKeyDown({ + code: Key.ARROW_LEFT.code + }, editor.node); + const executedCommand = await waitForCommand.promise; + assert.notEqual(executedCommand, id); + }); + + it('later registered keybinding should have higher priority', async () => { + const id = '__test:keybindings.copy'; + toTearDown.push(commands.registerCommand({ id }, { + execute: () => { } + })); + const keybinding = keybindings.getKeybindingsForCommand(CommonCommands.COPY.id)[0]; + toTearDown.push(keybindings.registerKeybinding({ + command: id, + keybinding: keybinding.keybinding + })); + const waitForCommand = new Deferred(); + toTearDown.push(commands.onWillExecuteCommand(e => waitForCommand.resolve(e.commandId))); + keybindings.dispatchKeyDown({ + code: Key.KEY_C.code, + metaKey: isOSX, + ctrlKey: !isOSX + }); + const executedCommand = await waitForCommand.promise; + assert.equal(executedCommand, id); + }); + +}); diff --git a/examples/api-tests/src/launch-preferences.spec.js b/examples/api-tests/src/launch-preferences.spec.js new file mode 100644 index 0000000..668e921 --- /dev/null +++ b/examples/api-tests/src/launch-preferences.spec.js @@ -0,0 +1,731 @@ +// ***************************************************************************** +// Copyright (C) 2019 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +// @ts-check +/* @typescript-eslint/no-explicit-any */ + +/** + * @typedef {'.vscode' | '.theia' | ['.theia', '.vscode']} ConfigMode + */ + +/** + * Expectations should be tested and aligned against VS Code. + * See https://github.com/akosyakov/vscode-launch/blob/master/src/test/extension.test.ts + */ +describe('Launch Preferences', function () { + this.timeout(30_000); + + const { assert } = chai; + + const { PreferenceProvider } = require('@theia/core/lib/common'); + const { PreferenceService } = require('@theia/core/lib/common/preferences/preference-service'); + const { PreferenceScope } = require('@theia/core/lib/common/preferences/preference-scope'); + const { WorkspaceService } = require('@theia/workspace/lib/browser/workspace-service'); + const { FileService } = require('@theia/filesystem/lib/browser/file-service'); + const { FileResourceResolver } = require('@theia/filesystem/lib/browser/file-resource'); + const { AbstractResourcePreferenceProvider } = require('@theia/preferences/lib/common/abstract-resource-preference-provider'); + const { waitForEvent } = require('@theia/core/lib/common/promise-util'); + + const container = window.theia.container; + /** @type {import('@theia/core/lib/browser/preferences/preference-service').PreferenceService} */ + const preferences = container.get(PreferenceService); + /** @type {import('@theia/preferences/lib/browser/user-configs-preference-provider').UserConfigsPreferenceProvider} */ + const userPreferences = container.getNamed(PreferenceProvider, PreferenceScope.User); + /** @type {import('@theia/preferences/lib/browser/workspace-preference-provider').WorkspacePreferenceProvider} */ + const workspacePreferences = container.getNamed(PreferenceProvider, PreferenceScope.Workspace); + /** @type {import('@theia/preferences/lib/browser/folders-preferences-provider').FoldersPreferencesProvider} */ + const folderPreferences = container.getNamed(PreferenceProvider, PreferenceScope.Folder); + const workspaceService = container.get(WorkspaceService); + const fileService = container.get(FileService); + const fileResourceResolver = container.get(FileResourceResolver); + + const defaultLaunch = { + 'configurations': [], + 'compounds': [] + }; + + const validConfiguration = { + 'name': 'Launch Program', + 'program': '${file}', + 'request': 'launch', + 'type': 'node', + }; + + const validConfiguration2 = { + 'name': 'Launch Program 2', + 'program': '${file}', + 'request': 'launch', + 'type': 'node', + }; + + const bogusConfiguration = {}; + + const validCompound = { + 'name': 'Compound', + 'configurations': [ + 'Launch Program', + 'Launch Program 2' + ] + }; + + const bogusCompound = {}; + + const bogusCompound2 = { + 'name': 'Compound 2', + 'configurations': [ + 'Foo', + 'Launch Program 2' + ] + }; + + const validLaunch = { + configurations: [validConfiguration, validConfiguration2], + compounds: [validCompound] + }; + + testSuite({ + name: 'No Preferences', + expectation: defaultLaunch + }); + + testLaunchAndSettingsSuite({ + name: 'Empty With Version', + launch: { + 'version': '0.2.0' + }, + expectation: { + 'version': '0.2.0', + 'configurations': [], + 'compounds': [] + } + }); + + testLaunchAndSettingsSuite({ + name: 'Empty With Version And Configurations', + launch: { + 'version': '0.2.0', + 'configurations': [], + }, + expectation: { + 'version': '0.2.0', + 'configurations': [], + 'compounds': [] + } + }); + + testLaunchAndSettingsSuite({ + name: 'Empty With Version And Compounds', + launch: { + 'version': '0.2.0', + 'compounds': [] + }, + expectation: { + 'version': '0.2.0', + 'configurations': [], + 'compounds': [] + } + }); + + testLaunchAndSettingsSuite({ + name: 'Valid Conf', + launch: { + 'version': '0.2.0', + 'configurations': [validConfiguration] + }, + expectation: { + 'version': '0.2.0', + 'configurations': [validConfiguration], + 'compounds': [] + } + }); + + testLaunchAndSettingsSuite({ + name: 'Bogus Conf', + launch: { + 'version': '0.2.0', + 'configurations': [validConfiguration, bogusConfiguration] + }, + expectation: { + 'version': '0.2.0', + 'configurations': [validConfiguration, bogusConfiguration], + 'compounds': [] + } + }); + + testLaunchAndSettingsSuite({ + name: 'Completely Bogus Conf', + launch: { + 'version': '0.2.0', + 'configurations': { 'valid': validConfiguration, 'bogus': bogusConfiguration } + }, + expectation: { + 'version': '0.2.0', + 'configurations': { 'valid': validConfiguration, 'bogus': bogusConfiguration }, + 'compounds': [] + } + }); + + const arrayBogusLaunch = [ + 'version', '0.2.0', + 'configurations', { 'valid': validConfiguration, 'bogus': bogusConfiguration } + ]; + testSuite({ + name: 'Array Bogus Launch Configuration', + launch: arrayBogusLaunch, + expectation: { + '0': 'version', + '1': '0.2.0', + '2': 'configurations', + '3': { 'valid': validConfiguration, 'bogus': bogusConfiguration }, + 'compounds': [], + 'configurations': [] + }, + inspectExpectation: { + preferenceName: 'launch', + defaultValue: defaultLaunch, + workspaceValue: { + '0': 'version', + '1': '0.2.0', + '2': 'configurations', + '3': { 'valid': validConfiguration, 'bogus': bogusConfiguration } + } + } + }); + testSuite({ + name: 'Array Bogus Settings Configuration', + settings: { + launch: arrayBogusLaunch + }, + expectation: { + '0': 'version', + '1': '0.2.0', + '2': 'configurations', + '3': { 'valid': validConfiguration, 'bogus': bogusConfiguration }, + 'compounds': [], + 'configurations': [] + }, + inspectExpectation: { + preferenceName: 'launch', + defaultValue: defaultLaunch, + workspaceValue: arrayBogusLaunch + } + }); + + testSuite({ + name: 'Null Bogus Launch Configuration', + // eslint-disable-next-line no-null/no-null + launch: null, + expectation: { + 'compounds': [], + 'configurations': [] + } + }); + testSuite({ + name: 'Null Bogus Settings Configuration', + settings: { + // eslint-disable-next-line no-null/no-null + 'launch': null + }, + expectation: {} + }); + + testLaunchAndSettingsSuite({ + name: 'Valid Compound', + launch: { + 'version': '0.2.0', + 'configurations': [validConfiguration, validConfiguration2], + 'compounds': [validCompound] + }, + expectation: { + 'version': '0.2.0', + 'configurations': [validConfiguration, validConfiguration2], + 'compounds': [validCompound] + } + }); + + testLaunchAndSettingsSuite({ + name: 'Valid And Bogus', + launch: { + 'version': '0.2.0', + 'configurations': [validConfiguration, validConfiguration2, bogusConfiguration], + 'compounds': [validCompound, bogusCompound, bogusCompound2] + }, + expectation: { + 'version': '0.2.0', + 'configurations': [validConfiguration, validConfiguration2, bogusConfiguration], + 'compounds': [validCompound, bogusCompound, bogusCompound2] + } + }); + + testSuite({ + name: 'Mixed', + launch: { + 'version': '0.2.0', + 'configurations': [validConfiguration, bogusConfiguration], + 'compounds': [bogusCompound, bogusCompound2] + }, + settings: { + launch: { + 'version': '0.2.0', + 'configurations': [validConfiguration2], + 'compounds': [validCompound] + } + }, + expectation: { + 'version': '0.2.0', + 'configurations': [validConfiguration2, validConfiguration, bogusConfiguration], + 'compounds': [validCompound, bogusCompound, bogusCompound2] + } + }); + + testSuite({ + name: 'Mixed Launch Without Configurations', + launch: { + 'version': '0.2.0', + 'compounds': [bogusCompound, bogusCompound2] + }, + settings: { + launch: { + 'version': '0.2.0', + 'configurations': [validConfiguration2], + 'compounds': [validCompound] + } + }, + expectation: { + 'version': '0.2.0', + 'configurations': [validConfiguration2], + 'compounds': [validCompound, bogusCompound, bogusCompound2] + }, + inspectExpectation: { + preferenceName: 'launch', + defaultValue: defaultLaunch, + workspaceValue: { + 'version': '0.2.0', + 'configurations': [validConfiguration2], + 'compounds': [validCompound, bogusCompound, bogusCompound2] + } + } + }); + + /** + * @typedef {Object} LaunchAndSettingsSuiteOptions + * @property {string} name + * @property {any} expectation + * @property {any} [launch] + * @property {boolean} [only] + * @property {ConfigMode} [configMode] + */ + /** + * @type {(options: LaunchAndSettingsSuiteOptions) => void} + */ + function testLaunchAndSettingsSuite({ + name, expectation, launch, only, configMode + }) { + testSuite({ + name: name + ' Launch Configuration', + launch, + expectation, + only, + configMode + }); + testSuite({ + name: name + ' Settings Configuration', + settings: { + 'launch': launch + }, + expectation, + only, + configMode + }); + } + + /** + * @typedef {Partial>} PreferenceInspection + */ + + /** + * @typedef {Object} SuiteOptions + * @property {string} name + * @property {any} expectation + * @property {PreferenceInspection} [inspectExpectation] + * @property {any} [launch] + * @property {any} [settings] + * @property {boolean} [only] + * @property {ConfigMode} [configMode] + */ + /** + * @type {(options: SuiteOptions) => void} + */ + function testSuite(options) { + describe(options.name, () => { + + if (options.configMode) { + testConfigSuite(options); + } else { + + testConfigSuite({ + ...options, + configMode: '.theia' + }); + + if (options.settings || options.launch) { + testConfigSuite({ + ...options, + configMode: '.vscode' + }); + + testConfigSuite({ + ...options, + configMode: ['.theia', '.vscode'] + }); + } + } + + }); + + } + + const rootUri = workspaceService.tryGetRoots()[0].resource; + + /** + * @param uri the URI of the file to modify + * @returns {AbstractResourcePreferenceProvider | undefined} The preference provider matching the provided URI. + */ + function findProvider(uri) { + /** + * @param {PreferenceProvider} provider + * @returns {boolean} whether the provider matches the desired URI. + */ + const isMatch = (provider) => { + const configUri = provider.getConfigUri(); + return configUri && uri.isEqual(configUri); + }; + for (const provider of userPreferences['providers'].values()) { + if (isMatch(provider) && provider instanceof AbstractResourcePreferenceProvider) { + return provider; + } + } + for (const provider of folderPreferences['providers'].values()) { + if (isMatch(provider) && provider instanceof AbstractResourcePreferenceProvider) { + return provider; + } + } + /** @type {PreferenceProvider} */ + const workspaceDelegate = workspacePreferences['delegate']; + if (workspaceDelegate !== folderPreferences) { + if (isMatch(workspaceDelegate) && workspaceDelegate instanceof AbstractResourcePreferenceProvider) { + return workspaceDelegate; + } + } + } + + async function deleteWorkspacePreferences() { + const promises = []; + for (const configPath of ['.theia', '.vscode']) { + for (const name of ['settings', 'launch']) { + promises.push((async () => { + const uri = rootUri.resolve(configPath + '/' + name + '.json'); + const provider = findProvider(uri); + try { + if (provider) { + if (provider.valid) { + try { + await waitForEvent(provider.onDidChangeValidity, 1000); + } catch (e) { + console.log('timed out waiting for validity change'); // sometimes, we seen to miss events: https://github.com/eclipse-theia/theia/issues/16088 + } + } + await provider['readPreferencesFromFile'](); + await provider['fireDidPreferencesChanged'](); + } else { + console.log('Unable to find provider for', uri.path.toString()); + } + } catch (e) { + console.error(e); + } + })()); + } + } + + await fileService.delete(rootUri.resolve('.theia'), { fromUserGesture: false, recursive: true }).catch(() => { }); + await fileService.delete(rootUri.resolve('.vscode'), { fromUserGesture: false, recursive: true }).catch(() => { }); + await Promise.all(promises); + } + + + function mergeLaunchConfigurations(config1, config2) { + if (config1 === undefined && config2 === undefined) { + return undefined; + } + if (config2 === undefined) { + return config1; + } + + let result; + // skip invalid configs + if (typeof config1 === 'object' && !Array.isArray(config1)) { + result = { ...config1 }; + } + if (typeof config2 === 'object' && !Array.isArray(config2)) { + result = { ...(result ?? {}), ...config2 } + } + // merge configurations and compounds arrays + const mergedConfigurations = mergeArrays(config1?.configurations, config2?.configurations); + if (mergedConfigurations) { + result.configurations = mergedConfigurations + } + const mergedCompounds = mergeArrays(config1?.compounds, config2?.compounds); + if (mergedCompounds) { + result.compounds = mergedCompounds; + } + return result; + } + + function mergeArrays(array1, array2) { + if (array1 === undefined && array2 === undefined) { + return undefined; + } + if (!Array.isArray(array1) && !Array.isArray(array2)) { + return undefined; + } + let result = []; + if (Array.isArray(array1)) { + result = [...array1]; + } + if (Array.isArray(array2)) { + result = [...result, ...array2]; + } + return result; + } + + + const originalShouldOverwrite = fileResourceResolver['shouldOverwrite']; + + before(async () => { + // fail tests if out of async happens + fileResourceResolver['shouldOverwrite'] = async () => (assert.fail('should be in sync'), false); + await deleteWorkspacePreferences(); + }); + + after(() => { + fileResourceResolver['shouldOverwrite'] = originalShouldOverwrite; + }); + + /** + * @typedef {Object} ConfigSuiteOptions + * @property {any} expectation + * @property {any} [inspectExpectation] + * @property {any} [launch] + * @property {any} [settings] + * @property {boolean} [only] + * @property {ConfigMode} [configMode] + */ + /** + * @type {(options: ConfigSuiteOptions) => void} + */ + function testConfigSuite({ + configMode, expectation, inspectExpectation, settings, launch, only + }) { + + describe(JSON.stringify(configMode, undefined, 2), () => { + const configPaths = Array.isArray(configMode) ? configMode : [configMode]; + + /** @typedef {import('@theia/monaco-editor-core/esm/vs/base/common/lifecycle').IReference} ConfigModelReference */ + /** @type {ConfigModelReference[]} */ + beforeEach(async () => { + /** @type {Promise[]} */ + const promises = []; + /** + * @param {string} name + * @param {Record} value + */ + const ensureConfigModel = (name, value) => { + for (const configPath of configPaths) { + promises.push((async () => { + try { + const uri = rootUri.resolve(configPath + '/' + name + '.json'); + const provider = findProvider(uri); + if (provider) { + await provider['doSetPreference']('', [], value); + } else { + console.log('Unable to find provider for', uri.path.toString()); + } + } catch (e) { + console.error(e); + } + })()); + } + }; + if (settings) { + ensureConfigModel('settings', settings); + } + if (launch) { + ensureConfigModel('launch', launch); + } + await Promise.all(promises); + }); + + after(async () => await deleteWorkspacePreferences()); + + const testItOnly = !!only ? it.only : it; + const testIt = testItOnly; + + const settingsLaunch = settings ? settings['launch'] : undefined; + + testIt('get from default', () => { + const config = preferences.get('launch'); + assert.deepStrictEqual(JSON.parse(JSON.stringify(config)), expectation); + }); + + testIt('get from undefined', () => { + /** @type {any} */ + const config = preferences.get('launch', undefined, undefined); + assert.deepStrictEqual(JSON.parse(JSON.stringify(config)), expectation); + }); + + testIt('get from rootUri', () => { + /** @type {any} */ + const config = preferences.get('launch', undefined, rootUri.toString()); + assert.deepStrictEqual(JSON.parse(JSON.stringify(config)), expectation); + }); + + testIt('inspect in undefined', () => { + const inspect = preferences.inspect('launch'); + /** @type {PreferenceInspection} */ + let expected = inspectExpectation; + if (!expected) { + expected = { + preferenceName: 'launch', + defaultValue: defaultLaunch + }; + const workspaceValue = mergeLaunchConfigurations(settingsLaunch, launch); + if (workspaceValue !== undefined && JSON.stringify(workspaceValue) !== '{}') { + Object.assign(expected, { workspaceValue }); + } + } + const expectedValue = expected.workspaceFolderValue || expected.workspaceValue || expected.globalValue || expected.defaultValue; + assert.deepStrictEqual(JSON.parse(JSON.stringify(inspect)), { ...expected, value: expectedValue }); + }); + + testIt('inspect in rootUri', () => { + const inspect = preferences.inspect('launch', rootUri.toString()); + /** @type {PreferenceInspection} */ + const expected = { + preferenceName: 'launch', + defaultValue: defaultLaunch + }; + if (inspectExpectation) { + Object.assign(expected, { + workspaceValue: inspectExpectation.workspaceValue, + workspaceFolderValue: inspectExpectation.workspaceValue + }); + } else { + const value = mergeLaunchConfigurations(settingsLaunch, launch); + if (value !== undefined && JSON.stringify(value) !== '{}') { + Object.assign(expected, { + workspaceValue: value, + workspaceFolderValue: value + }); + } + } + const expectedValue = expected.workspaceFolderValue || expected.workspaceValue || expected.globalValue || expected.defaultValue; + assert.deepStrictEqual(JSON.parse(JSON.stringify(inspect)), { ...expected, value: expectedValue }); + }); + + testIt('update launch', async () => { + await preferences.set('launch', validLaunch); + + const inspect = preferences.inspect('launch'); + const actual = inspect && inspect.workspaceValue; + const expected = mergeLaunchConfigurations(settingsLaunch, validLaunch); + assert.deepStrictEqual(actual, expected); + }); + + testIt('update launch Workspace', async () => { + await preferences.set('launch', validLaunch, PreferenceScope.Workspace); + + const inspect = preferences.inspect('launch'); + const actual = inspect && inspect.workspaceValue; + const expected = mergeLaunchConfigurations(settingsLaunch, validLaunch); + assert.deepStrictEqual(actual, expected); + }); + + testIt('update launch WorkspaceFolder', async () => { + try { + await preferences.set('launch', validLaunch, PreferenceScope.Folder); + assert.fail('should not be possible to update Workspace Folder Without resource'); + } catch (e) { + assert.deepStrictEqual(e.message, 'Unable to write to Folder Settings because no resource is provided.'); + } + }); + + testIt('update launch WorkspaceFolder with resource', async () => { + await preferences.set('launch', validLaunch, PreferenceScope.Folder, rootUri.toString()); + + const inspect = preferences.inspect('launch'); + const actual = inspect && inspect.workspaceValue; + const expected = mergeLaunchConfigurations(settingsLaunch, validLaunch); + assert.deepStrictEqual(actual, expected); + }); + + if ((launch && !Array.isArray(launch)) || (settingsLaunch && !Array.isArray(settingsLaunch))) { + testIt('update launch.configurations', async () => { + await preferences.set('launch.configurations', [validConfiguration, validConfiguration2]); + + const inspect = preferences.inspect('launch'); + const actual = inspect && inspect.workspaceValue && inspect.workspaceValue.configurations; + let expect = [validConfiguration, validConfiguration2]; + if (Array.isArray(settingsLaunch?.configurations)) { + expect = [...(settingsLaunch.configurations), ...expect] + } + assert.deepStrictEqual(actual, expect); + }); + } + + testIt('delete launch', async () => { + await preferences.set('launch', undefined); + const actual = preferences.inspect('launch'); + + let expected = undefined; + if (configPaths[1]) { + expected = launch; + if (Array.isArray(expected)) { + expected = { ...expected }; + } + } + expected = mergeLaunchConfigurations(settingsLaunch, expected); + assert.deepStrictEqual(actual && actual.workspaceValue, expected); + }); + + if ((launch && !Array.isArray(launch)) || (settingsLaunch && !Array.isArray(settingsLaunch))) { + testIt('delete launch.configurations', async () => { + await preferences.set('launch.configurations', undefined); + + const actual = preferences.inspect('launch'); + const actualWorkspaceValue = actual && actual.workspaceValue; + + let expected = { ...launch }; + if (launch) { + delete expected['configurations']; + } + expected = mergeLaunchConfigurations(settingsLaunch, expected); + assert.deepStrictEqual(actualWorkspaceValue, expected); + }); + } + }); + + } +}); diff --git a/examples/api-tests/src/menus.spec.js b/examples/api-tests/src/menus.spec.js new file mode 100644 index 0000000..905e604 --- /dev/null +++ b/examples/api-tests/src/menus.spec.js @@ -0,0 +1,179 @@ +// ***************************************************************************** +// Copyright (C) 2020 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +// @ts-check +describe('Menus', function () { + this.timeout(7500); + + const { assert } = chai; + + const { BrowserMenuBarContribution } = require('@theia/core/lib/browser/menu/browser-menu-plugin'); + const { MenuModelRegistry } = require('@theia/core/lib/common/menu'); + const { CommandRegistry } = require('@theia/core/lib/common/command'); + const { DisposableCollection } = require('@theia/core/lib/common/disposable'); + const { ContextMenuRenderer } = require('@theia/core/lib/browser/context-menu-renderer'); + const { BrowserContextMenuAccess } = require('@theia/core/lib/browser/menu/browser-context-menu-renderer'); + const { ApplicationShell } = require('@theia/core/lib/browser/shell/application-shell'); + const { ViewContainer } = require('@theia/core/lib/browser/view-container'); + const { waitForRevealed, waitForHidden } = require('@theia/core/lib/browser/widgets/widget'); + const { CallHierarchyContribution } = require('@theia/callhierarchy/lib/browser/callhierarchy-contribution'); + const { EXPLORER_VIEW_CONTAINER_ID } = require('@theia/navigator/lib/browser/navigator-widget-factory'); + const { FileNavigatorContribution } = require('@theia/navigator/lib/browser/navigator-contribution'); + const { ScmContribution } = require('@theia/scm/lib/browser/scm-contribution'); + const { ScmHistoryContribution } = require('@theia/scm-extra/lib/browser/history/scm-history-contribution'); + const { OutlineViewContribution } = require('@theia/outline-view/lib/browser/outline-view-contribution'); + const { OutputContribution } = require('@theia/output/lib/browser/output-contribution'); + const { PluginFrontendViewContribution } = require('@theia/plugin-ext/lib/main/browser/plugin-frontend-view-contribution'); + const { ProblemContribution } = require('@theia/markers/lib/browser/problem/problem-contribution'); + const { PropertyViewContribution } = require('@theia/property-view/lib/browser/property-view-contribution'); + const { SearchInWorkspaceFrontendContribution } = require('@theia/search-in-workspace/lib/browser/search-in-workspace-frontend-contribution'); + const { HostedPluginSupport } = require('@theia/plugin-ext/lib/hosted/browser/hosted-plugin'); + + const container = window.theia.container; + const shell = container.get(ApplicationShell); + /** @type {BrowserMenuBarContribution} */ + const menuBarContribution = container.get(BrowserMenuBarContribution); + const pluginService = container.get(HostedPluginSupport); + const menus = container.get(MenuModelRegistry); + const commands = container.get(CommandRegistry); + const contextMenuService = container.get(ContextMenuRenderer); + + before(async function () { + await pluginService.didStart; + await pluginService.activateByViewContainer('explorer'); + // Updating the menu interferes with our ability to programmatically test it + // We simply disable the menu updating + menus.isReady = false; + }); + + const toTearDown = new DisposableCollection(); + afterEach(() => toTearDown.dispose()); + + for (const contribution of [ + container.get(CallHierarchyContribution), + container.get(FileNavigatorContribution), + container.get(ScmContribution), + container.get(ScmHistoryContribution), + container.get(OutlineViewContribution), + container.get(OutputContribution), + container.get(PluginFrontendViewContribution), + container.get(ProblemContribution), + container.get(PropertyViewContribution), + container.get(SearchInWorkspaceFrontendContribution) + ]) { + it(`should toggle '${contribution.viewLabel}' view`, async () => { + await contribution.closeView(); + await menuBarContribution.menuBar.triggerMenuItem('View', contribution.viewLabel); + await shell.waitForActivation(contribution.viewId); + }); + } + + it('reveal more context menu in the explorer view container toolbar', async function () { + const viewContainer = await shell.revealWidget(EXPLORER_VIEW_CONTAINER_ID); + if (!(viewContainer instanceof ViewContainer)) { + assert.isTrue(viewContainer instanceof ViewContainer); + return; + } + + const contribution = container.get(FileNavigatorContribution); + const waitForParts = []; + for (const part of viewContainer.getParts()) { + if (part.wrapped.id !== contribution.viewId) { + part.hide(); + waitForParts.push(waitForHidden(part.wrapped)); + } else { + part.show(); + waitForParts.push(waitForRevealed(part.wrapped)); + } + } + await Promise.all(waitForParts); + + const contextMenuAccess = shell.leftPanelHandler.toolBar.showMoreContextMenu({ x: 0, y: 0 }); + toTearDown.push(contextMenuAccess); + if (!(contextMenuAccess instanceof BrowserContextMenuAccess)) { + assert.isTrue(contextMenuAccess instanceof BrowserContextMenuAccess); + return; + } + const contextMenu = contextMenuAccess.menu; + + await waitForRevealed(contextMenu); + assert.notEqual(contextMenu.items.length, 0); + }); + + it('rendering a new context menu should close the current', async function () { + const commandId = '__test_command_' + new Date(); + const contextMenuPath = ['__test_first_context_menu_' + new Date()]; + const contextMenuPath2 = ['__test_second_context_menu_' + new Date()]; + toTearDown.push(commands.registerCommand({ + id: commandId, + label: commandId + }, { + execute: () => { } + })); + toTearDown.push(menus.registerMenuAction(contextMenuPath, { commandId })); + toTearDown.push(menus.registerMenuAction(contextMenuPath2, { commandId })); + + const access = contextMenuService.render({ + anchor: { x: 0, y: 0 }, + menuPath: contextMenuPath + }); + toTearDown.push(access); + if (!(access instanceof BrowserContextMenuAccess)) { + assert.isTrue(access instanceof BrowserContextMenuAccess); + return; + } + + assert.deepEqual(contextMenuService.current, access); + assert.isFalse(access.disposed); + + await waitForRevealed(access.menu); + assert.notEqual(access.menu.items.length, 0); + assert.deepEqual(contextMenuService.current, access); + assert.isFalse(access.disposed); + + const access2 = contextMenuService.render({ + anchor: { x: 0, y: 0 }, + menuPath: contextMenuPath2 + }); + toTearDown.push(access2); + if (!(access2 instanceof BrowserContextMenuAccess)) { + assert.isTrue(access2 instanceof BrowserContextMenuAccess); + return; + } + + assert.deepEqual(contextMenuService.current, access2); + assert.isFalse(access2.disposed); + assert.isTrue(access.disposed); + + await waitForRevealed(access2.menu); + assert.deepEqual(contextMenuService.current, access2); + assert.isFalse(access2.disposed); + assert.isTrue(access.disposed); + + access2.dispose(); + assert.deepEqual(contextMenuService.current, undefined); + assert.isTrue(access2.disposed); + + await waitForHidden(access2.menu); + assert.deepEqual(contextMenuService.current, undefined); + assert.isTrue(access2.disposed); + }); + + it('should not fail to register a menu with an invalid command', () => { + assert.doesNotThrow(() => menus.registerMenuAction(['test-menu-path'], { commandId: 'invalid-command', label: 'invalid command' }), 'should not throw.'); + }); + +}); diff --git a/examples/api-tests/src/monaco-api.spec.js b/examples/api-tests/src/monaco-api.spec.js new file mode 100644 index 0000000..b15a092 --- /dev/null +++ b/examples/api-tests/src/monaco-api.spec.js @@ -0,0 +1,198 @@ +// ***************************************************************************** +// Copyright (C) 2020 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +const { timeout } = require('@theia/core/lib/common/promise-util'); +const { IOpenerService } = require('@theia/monaco-editor-core/esm/vs/platform/opener/common/opener'); + +// @ts-check +describe('Monaco API', async function () { + this.timeout(5000); + + const { assert } = chai; + + const { EditorManager } = require('@theia/editor/lib/browser/editor-manager'); + const { WorkspaceService } = require('@theia/workspace/lib/browser/workspace-service'); + const { MonacoEditor } = require('@theia/monaco/lib/browser/monaco-editor'); + const { MonacoResolvedKeybinding } = require('@theia/monaco/lib/browser/monaco-resolved-keybinding'); + const { MonacoTextmateService } = require('@theia/monaco/lib/browser/textmate/monaco-textmate-service'); + const { CommandRegistry } = require('@theia/core/lib/common/command'); + const { KeyCodeChord, ResolvedChord } = require('@theia/monaco-editor-core/esm/vs/base/common/keybindings'); + const { IKeybindingService } = require('@theia/monaco-editor-core/esm/vs/platform/keybinding/common/keybinding'); + const { StandaloneServices } = require('@theia/monaco-editor-core/esm/vs/editor/standalone/browser/standaloneServices'); + const { TokenizationRegistry } = require('@theia/monaco-editor-core/esm/vs/editor/common/languages'); + const { MonacoContextKeyService } = require('@theia/monaco/lib/browser/monaco-context-key-service'); + const { URI } = require('@theia/monaco-editor-core/esm/vs/base/common/uri'); + + const container = window.theia.container; + const editorManager = container.get(EditorManager); + const workspaceService = container.get(WorkspaceService); + const textmateService = container.get(MonacoTextmateService); + /** @type {import('@theia/core/src/common/command').CommandRegistry} */ + const commands = container.get(CommandRegistry); + /** @type {import('@theia/monaco/src/browser/monaco-context-key-service').MonacoContextKeyService} */ + const contextKeys = container.get(MonacoContextKeyService); + + /** @type {MonacoEditor} */ + let monacoEditor; + + before(async () => { + const root = workspaceService.tryGetRoots()[0]; + const editor = await editorManager.open(root.resource.resolve('package.json'), { + mode: 'reveal' + }); + monacoEditor = /** @type {MonacoEditor} */ (MonacoEditor.get(editor)); + }); + + after(async () => { + await editorManager.closeAll({ save: false }); + }); + + it('KeybindingService.resolveKeybinding', () => { + const chord = new KeyCodeChord(true, true, true, true, 41 /* KeyCode.KeyK */); + const chordKeybinding = chord.toKeybinding(); + assert.equal(chordKeybinding.chords.length, 1); + assert.equal(chordKeybinding.chords[0], chord); + + const resolvedKeybindings = StandaloneServices.get(IKeybindingService).resolveKeybinding(chordKeybinding); + assert.equal(resolvedKeybindings.length, 1); + + const resolvedKeybinding = resolvedKeybindings[0]; + if (resolvedKeybinding instanceof MonacoResolvedKeybinding) { + const label = resolvedKeybinding.getLabel(); + const ariaLabel = resolvedKeybinding.getAriaLabel(); + const electronAccelerator = resolvedKeybinding.getElectronAccelerator(); + const userSettingsLabel = resolvedKeybinding.getUserSettingsLabel(); + const WYSIWYG = resolvedKeybinding.isWYSIWYG(); + const parts = resolvedKeybinding.getChords(); + const dispatchParts = resolvedKeybinding.getDispatchChords().map(str => str === null ? '' : str); + + const platform = window.navigator.platform; + let expected; + if (platform.includes('Mac')) { + // Mac os + expected = { + label: '⌃⇧⌥⌘K', + ariaLabel: '⌃⇧⌥⌘K', + electronAccelerator: 'Ctrl+Shift+Alt+Cmd+K', + userSettingsLabel: 'ctrl+shift+alt+cmd+K', + WYSIWYG: true, + parts: [new ResolvedChord( + true, + true, + true, + true, + 'K', + 'K', + )], + dispatchParts: [ + 'ctrl+shift+alt+meta+K' + ] + }; + } else { + expected = { + label: 'Ctrl+Shift+Alt+K', + ariaLabel: 'Ctrl+Shift+Alt+K', + electronAccelerator: 'Ctrl+Shift+Alt+K', + userSettingsLabel: 'ctrl+shift+alt+K', + WYSIWYG: true, + parts: [new ResolvedChord( + true, + true, + true, + false, + 'K', + 'K' + )], + dispatchParts: [ + 'ctrl+shift+alt+K' + ] + }; + } + + assert.deepStrictEqual({ + label, ariaLabel, electronAccelerator, userSettingsLabel, WYSIWYG, parts, dispatchParts + }, expected); + } else { + assert.fail(`resolvedKeybinding must be of ${MonacoResolvedKeybinding.name} type`); + } + }); + + it('TokenizationRegistry.getColorMap', async () => { + if (textmateService['monacoThemeRegistry'].getThemeData().base !== 'vs') { + const didChangeColorMap = new Promise(resolve => { + const toDispose = TokenizationRegistry.onDidChange(() => { + toDispose.dispose(); + resolve(undefined); + }); + }); + textmateService['themeService'].setCurrentTheme('light'); + await didChangeColorMap; + } + + const textMateColorMap = textmateService['grammarRegistry'].getColorMap(); + assert.notEqual(textMateColorMap.indexOf('#795E26'), -1, 'Expected custom toke colors for the light theme to be enabled.'); + + const monacoColorMap = (TokenizationRegistry.getColorMap() || []). + splice(0, textMateColorMap.length).map(c => c.toString().toUpperCase()); + assert.deepStrictEqual(monacoColorMap, textMateColorMap, 'Expected textmate colors to have the same index in the monaco color map.'); + }); + + it('OpenerService.open', async () => { + /** @type {import('@theia/monaco-editor-core/esm/vs/editor/browser/services/openerService').OpenerService} */ + const openerService = StandaloneServices.get(IOpenerService); + + let opened = false; + const id = '__test:OpenerService.open'; + const unregisterCommand = commands.registerCommand({ id }, { + execute: arg => (console.log(arg), opened = arg === 'foo') + }); + try { + await openerService.open(URI.parse('command:' + id + '?"foo"')); + assert.isTrue(opened); + } finally { + unregisterCommand.dispose(); + } + }); + + it('Supports setting contexts using the command registry', async () => { + const setContext = '_setContext'; + const key = 'monaco-api-test-context'; + const firstValue = 'first setting'; + const secondValue = 'second setting'; + assert.isFalse(contextKeys.match(`${key} == '${firstValue}'`)); + await commands.executeCommand(setContext, key, firstValue); + assert.isTrue(contextKeys.match(`${key} == '${firstValue}'`)); + await commands.executeCommand(setContext, key, secondValue); + assert.isTrue(contextKeys.match(`${key} == '${secondValue}'`)); + }); + + it('Supports context key: inQuickOpen', async () => { + const inQuickOpenContextKey = 'inQuickOpen'; + const quickOpenCommands = ['file-search.openFile', 'workbench.action.showCommands']; + const CommandThatChangesFocus = 'workbench.files.action.focusFilesExplorer'; + + for (const cmd of quickOpenCommands) { + assert.isFalse(contextKeys.match(inQuickOpenContextKey)); + await commands.executeCommand(cmd); + assert.isTrue(contextKeys.match(inQuickOpenContextKey)); + + await commands.executeCommand(CommandThatChangesFocus); + await timeout(0); + assert.isFalse(contextKeys.match(inQuickOpenContextKey)); + } + }); + +}); diff --git a/examples/api-tests/src/navigator.spec.js b/examples/api-tests/src/navigator.spec.js new file mode 100644 index 0000000..b7a7cce --- /dev/null +++ b/examples/api-tests/src/navigator.spec.js @@ -0,0 +1,92 @@ +// ***************************************************************************** +// Copyright (C) 2020 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +// @ts-check +describe('Navigator', function () { + this.timeout(5000); + + const { assert } = chai; + + const { FileService } = require('@theia/filesystem/lib/browser/file-service'); + const { DirNode, FileNode } = require('@theia/filesystem/lib/browser/file-tree/file-tree'); + const { WorkspaceService } = require('@theia/workspace/lib/browser/workspace-service'); + const { FileNavigatorContribution } = require('@theia/navigator/lib/browser/navigator-contribution'); + + /** @type {import('inversify').Container} */ + const container = window['theia'].container; + const fileService = container.get(FileService); + const workspaceService = container.get(WorkspaceService); + const navigatorContribution = container.get(FileNavigatorContribution); + + const rootUri = workspaceService.tryGetRoots()[0].resource; + const fileUri = rootUri.resolve('.test/nested/source/text.txt'); + const targetUri = rootUri.resolve('.test/target'); + + beforeEach(async () => { + await fileService.create(fileUri, 'foo', { fromUserGesture: false, overwrite: true }); + await fileService.createFolder(targetUri); + }); + + afterEach(async () => { + await fileService.delete(targetUri.parent, { fromUserGesture: false, useTrash: false, recursive: true }); + }); + + /** @type {Array<['copy' | 'move', boolean]>} */ + const operations = [ + ['copy', false], + ['move', false] + ]; + /** @type {Array<['file' | 'dir', boolean]>} */ + const fileTypes = [ + ['file', false], + ['dir', false], + ]; + for (const [operation, onlyOperation] of operations) { + for (const [fileType, onlyFileType] of fileTypes) { + const ExpectedNodeType = fileType === 'file' ? FileNode : DirNode; + (onlyOperation || onlyFileType ? it.only : it)(operation + ' ' + fileType, async function () { + const navigator = await navigatorContribution.openView({ reveal: true }); + await navigator.model.refresh(); + + const sourceUri = fileType === 'file' ? fileUri : fileUri.parent; + const sourceNode = await navigator.model.revealFile(sourceUri); + if (!ExpectedNodeType.is(sourceNode)) { + return assert.isTrue(ExpectedNodeType.is(sourceNode)); + } + + const targetNode = await navigator.model.revealFile(targetUri); + if (!DirNode.is(targetNode)) { + return assert.isTrue(DirNode.is(targetNode)); + } + + let actualUri; + if (operation === 'copy') { + actualUri = await navigator.model.copy(sourceUri, targetNode); + } else { + actualUri = await navigator.model.move(sourceNode, targetNode); + } + if (!actualUri) { + return assert.isDefined(actualUri); + } + + await navigator.model.refresh(targetNode); + const actualNode = await navigator.model.revealFile(actualUri); + assert.isTrue(ExpectedNodeType.is(actualNode)); + }); + } + } + +}); diff --git a/examples/api-tests/src/preferences.spec.js b/examples/api-tests/src/preferences.spec.js new file mode 100644 index 0000000..1f9eca4 --- /dev/null +++ b/examples/api-tests/src/preferences.spec.js @@ -0,0 +1,209 @@ +// ***************************************************************************** +// Copyright (C) 2022 Ericsson and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +// @ts-check + +describe('Preferences', function () { + this.timeout(5_000); + const { assert } = chai; + const { PreferenceProvider } = require('@theia/core/lib/common/preferences/preference-provider'); + const { PreferenceService, PreferenceScope } = require('@theia/core/lib/common/preferences'); + const { FileService } = require('@theia/filesystem/lib/browser/file-service'); + const { PreferenceLanguageOverrideService } = require('@theia/core/lib/common/preferences/preference-language-override-service'); + const { MonacoTextModelService } = require('@theia/monaco/lib/browser/monaco-text-model-service'); + const { PreferenceSchemaService } = require('@theia/core/lib/common/preferences') + const { container } = window.theia; + /** @type {import ('@theia/core/lib/common/preferences/preference-service').PreferenceService} */ + const preferenceService = container.get(PreferenceService); + /** @type {import ('@theia/core/lib/common/preferences/preference-language-override-service').PreferenceLanguageOverrideService} */ + const overrideService = container.get(PreferenceLanguageOverrideService); + const fileService = container.get(FileService); + /** @type {import ('@theia/core/lib/common/uri').default} */ + const uri = preferenceService.getConfigUri(PreferenceScope.Workspace); + /** @type {import('@theia/preferences/lib/browser/folders-preferences-provider').FoldersPreferencesProvider} */ + const folderPreferences = container.getNamed(PreferenceProvider, PreferenceScope.Folder); + /** @type PreferenceSchemaService */ + const schemaService = container.get(PreferenceSchemaService); + const modelService = container.get(MonacoTextModelService); + + + const overrideIdentifier = 'bargle-noddle-zaus'; // Probably not in our preference files... + schemaService.registerOverrideIdentifier(overrideIdentifier); + const tabSize = 'editor.tabSize'; + const fontSize = 'editor.fontSize'; + const override = overrideService.markLanguageOverride(overrideIdentifier); + const overriddenTabSize = overrideService.overridePreferenceName({ overrideIdentifier, preferenceName: tabSize }); + const overriddenFontSize = overrideService.overridePreferenceName({ overrideIdentifier, preferenceName: fontSize }); + /** + * @returns {Promise>} + */ + async function getPreferences() { + try { + const content = (await fileService.read(uri)).value; + return JSON.parse(content); + } catch (e) { + return {}; + } + } + + /** + * @param {string} key + * @param {unknown} value + */ + async function setPreference(key, value) { + return preferenceService.set(key, value, PreferenceScope.Workspace); + } + + async function deleteAllValues() { + return setValueTo(undefined); + } + + /** + * @param {any} value - A JSON value to write to the workspace preference file. + */ + async function setValueTo(value) { + const reference = await modelService.createModelReference(uri); + if (reference.object.dirty) { + await reference.object.revert(); + } + /** @type {import ('@theia/preferences/lib/browser/folder-preference-provider').FolderPreferenceProvider} */ + const provider = Array.from(folderPreferences['providers'].values()).find(candidate => candidate.getConfigUri().isEqual(uri)); + assert.isDefined(provider); + await provider['doSetPreference']('', [], value); + reference.dispose(); + } + + let fileExistsBeforehand = false; + let contentBeforehand = ''; + + before(async function () { + assert.isDefined(uri, 'The workspace config URI should be defined!'); + fileExistsBeforehand = await fileService.exists(uri); + contentBeforehand = await fileService.read(uri).then(({ value }) => value).catch(() => ''); + schemaService.registerOverrideIdentifier(overrideIdentifier); + await deleteAllValues(); + }); + + after(async function () { + if (!fileExistsBeforehand) { + await fileService.delete(uri, { fromUserGesture: false }).catch(() => { }); + } else { + let content = ''; + try { content = JSON.parse(contentBeforehand); } catch { } + // Use the preference service because its promise is guaranteed to resolve after the file change is complete. + await setValueTo(content); + } + }); + + beforeEach(async function () { + const prefs = await getPreferences(); + for (const key of [tabSize, fontSize, override, overriddenTabSize, overriddenFontSize]) { + shouldBeUndefined(prefs[key], key); + } + }); + + afterEach(async function () { + await deleteAllValues(); + }); + + /** + * @param {unknown} value + * @param {string} key + */ + function shouldBeUndefined(value, key) { + assert.isUndefined(value, `There should be no ${key} object or value in the preferences.`); + } + + /** + * @returns {Promise<{newTabSize: number, newFontSize: number, startingTabSize: number, startingFontSize: number}>} + */ + async function setUpOverride() { + const startingTabSize = preferenceService.get(tabSize); + const startingFontSize = preferenceService.get(fontSize); + assert.equal(preferenceService.get(overriddenTabSize), startingTabSize, 'The overridden value should equal the default.'); + assert.equal(preferenceService.get(overriddenFontSize), startingFontSize, 'The overridden value should equal the default.'); + const newTabSize = startingTabSize + 2; + const newFontSize = startingFontSize + 2; + await Promise.all([ + setPreference(overriddenTabSize, newTabSize), + setPreference(overriddenFontSize, newFontSize), + ]); + assert.equal(preferenceService.get(overriddenTabSize), newTabSize, 'After setting, the new value should be active for the override.'); + assert.equal(preferenceService.get(overriddenFontSize), newFontSize, 'After setting, the new value should be active for the override.'); + return { newTabSize, newFontSize, startingTabSize, startingFontSize }; + } + + it('Sets language overrides as objects', async function () { + const { newTabSize, newFontSize } = await setUpOverride(); + const prefs = await getPreferences(); + assert.isObject(prefs[override], 'The override should be a key in the preference object.'); + assert.equal(prefs[override][tabSize], newTabSize, 'editor.tabSize should be a key in the override object and have the correct value.'); + assert.equal(prefs[override][fontSize], newFontSize, 'editor.fontSize should be a key in the override object and should have the correct value.'); + shouldBeUndefined(prefs[overriddenTabSize], overriddenTabSize); + shouldBeUndefined(prefs[overriddenFontSize], overriddenFontSize); + }); + + it('Allows deletion of individual keys in the override object.', async function () { + const { startingTabSize } = await setUpOverride(); + await setPreference(overriddenTabSize, undefined); + assert.equal(preferenceService.get(overriddenTabSize), startingTabSize); + const prefs = await getPreferences(); + shouldBeUndefined(prefs[override][tabSize], tabSize); + shouldBeUndefined(prefs[overriddenFontSize], overriddenFontSize); + shouldBeUndefined(prefs[overriddenTabSize], overriddenTabSize); + }); + + it('Allows deletion of the whole override object', async function () { + const { startingFontSize, startingTabSize } = await setUpOverride(); + await setPreference(override, undefined); + assert.equal(preferenceService.get(overriddenTabSize), startingTabSize, 'The overridden value should revert to the default.'); + assert.equal(preferenceService.get(overriddenFontSize), startingFontSize, 'The overridden value should revert to the default.'); + const prefs = await getPreferences(); + shouldBeUndefined(prefs[override], override); + }); + + it('Handles many synchronous settings of preferences gracefully', async function () { + let settings = 0; + const promises = []; + const searchPref = 'search.searchOnTypeDebouncePeriod' + const channelPref = 'output.maxChannelHistory' + const hoverPref = 'workbench.hover.delay'; + let searchDebounce; + let channelHistory; + let hoverDelay; + /** @type import ('@theia/core/src/browser/preferences/preference-service').PreferenceChanges | undefined */ + let event; + const toDispose = preferenceService.onPreferencesChanged(e => event = e); + while (settings++ < 50) { + searchDebounce = 100 + Math.floor(Math.random() * 500); + channelHistory = 200 + Math.floor(Math.random() * 800); + hoverDelay = 250 + Math.floor(Math.random() * 2_500); + promises.push( + preferenceService.set(searchPref, searchDebounce), + preferenceService.set(channelPref, channelHistory), + preferenceService.set(hoverPref, hoverDelay) + ); + } + const results = await Promise.allSettled(promises); + const expectedValues = { [searchPref]: searchDebounce, [channelPref]: channelHistory, [hoverPref]: hoverDelay }; + const actualValues = { [searchPref]: preferenceService.get(searchPref), [channelPref]: preferenceService.get(channelPref), [hoverPref]: preferenceService.get(hoverPref), } + const eventKeys = event && Object.keys(event).sort(); + toDispose.dispose(); + assert(results.every(setting => setting.status === 'fulfilled'), 'All promises should have resolved rather than rejected.'); + assert.deepEqual([channelPref, searchPref, hoverPref], eventKeys, 'The event should contain the changed preference names.'); + assert.deepEqual(expectedValues, actualValues, 'The service state should reflect the most recent setting'); + }); +}); diff --git a/examples/api-tests/src/saveable.spec.js b/examples/api-tests/src/saveable.spec.js new file mode 100644 index 0000000..8a8cd5b --- /dev/null +++ b/examples/api-tests/src/saveable.spec.js @@ -0,0 +1,512 @@ +// ***************************************************************************** +// Copyright (C) 2020 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +// @ts-check +describe('Saveable', function () { + this.timeout(30000); + + const { assert } = chai; + + const { EditorManager } = require('@theia/editor/lib/browser/editor-manager'); + const { EditorWidget } = require('@theia/editor/lib/browser/editor-widget'); + const { PreferenceService } = require('@theia/core/lib/common/preferences/preference-service'); + const { Saveable, SaveableWidget } = require('@theia/core/lib/browser/saveable'); + const { WorkspaceService } = require('@theia/workspace/lib/browser/workspace-service'); + const { FileService } = require('@theia/filesystem/lib/browser/file-service'); + const { FileResource } = require('@theia/filesystem/lib/browser/file-resource'); + const { ETAG_DISABLED } = require('@theia/filesystem/lib/common/files'); + const { MonacoEditor } = require('@theia/monaco/lib/browser/monaco-editor'); + const { Deferred, timeout } = require('@theia/core/lib/common/promise-util'); + const { Disposable, DisposableCollection } = require('@theia/core/lib/common/disposable'); + const { Range } = require('@theia/monaco-editor-core/esm/vs/editor/common/core/range'); + + const container = window.theia.container; + /** @type {EditorManager} */ + const editorManager = container.get(EditorManager); + const workspaceService = container.get(WorkspaceService); + const fileService = container.get(FileService); + /** @type {import('@theia/core/lib/common/preferences/preference-service').PreferenceService} */ + const preferences = container.get(PreferenceService); + + /** @type {EditorWidget & SaveableWidget} */ + let widget; + /** @type {MonacoEditor} */ + let editor; + + const rootUri = workspaceService.tryGetRoots()[0].resource; + const fileUri = rootUri.resolve('.test/foo.txt'); + + const closeOnFileDelete = 'workbench.editor.closeOnFileDelete'; + + /** + * @param {FileResource['shouldOverwrite']} shouldOverwrite + * @returns {Disposable} + */ + function setShouldOverwrite(shouldOverwrite) { + const resource = editor.document['resource']; + assert.isTrue(resource instanceof FileResource); + const fileResource = /** @type {FileResource} */ (resource); + const originalShouldOverwrite = fileResource['shouldOverwrite']; + fileResource['shouldOverwrite'] = shouldOverwrite; + return Disposable.create(() => fileResource['shouldOverwrite'] = originalShouldOverwrite); + } + + const toTearDown = new DisposableCollection(); + + /** @type {string | undefined} */ + const autoSave = preferences.get('files.autoSave', undefined, rootUri.toString()); + + beforeEach(async () => { + await preferences.set('files.autoSave', 'off', undefined, rootUri.toString()); + await preferences.set(closeOnFileDelete, true); + await editorManager.closeAll({ save: false }); + const watcher = fileService.watch(fileUri); // create/delete events are sometimes coalesced on Mac + const gotCreate = new Deferred(); + const listener = fileService.onDidFilesChange(e => { + if (e.contains(fileUri, { type: 1 })) { // FileChangeType.ADDED + gotCreate.resolve(); + } + }); + await fileService.create(fileUri, 'foo', { fromUserGesture: false, overwrite: true }); + await Promise.race([await timeout(2000), gotCreate.promise]); + watcher.dispose(); + listener.dispose(); + + widget = /** @type {EditorWidget & SaveableWidget} */ (await editorManager.open(fileUri, { mode: 'reveal' })); + editor = /** @type {MonacoEditor} */ (MonacoEditor.get(widget)); + }); + + afterEach(async () => { + toTearDown.dispose(); + // @ts-ignore + editor = undefined; + // @ts-ignore + widget = undefined; + await editorManager.closeAll({ save: false }); + await fileService.delete(fileUri.parent, { fromUserGesture: false, useTrash: false, recursive: true }); + await preferences.set('files.autoSave', autoSave, undefined, rootUri.toString()); + }); + + it('normal save', async function () { + for (const edit of ['bar', 'baz']) { + assert.isFalse(Saveable.isDirty(widget), `should NOT be dirty before '${edit}' edit`); + editor.getControl().setValue(edit); + assert.isTrue(Saveable.isDirty(widget), `should be dirty before '${edit}' save`); + await Saveable.save(widget); + assert.isFalse(Saveable.isDirty(widget), `should NOT be dirty after '${edit}' save`); + assert.equal(editor.getControl().getValue().trimRight(), edit, `model should be updated with '${edit}'`); + const state = await fileService.read(fileUri); + assert.equal(state.value.trimRight(), edit, `fs should be updated with '${edit}'`); + } + }); + + it('reject save with incremental update', async function () { + let longContent = 'foobarbaz'; + for (let i = 0; i < 5; i++) { + longContent += longContent + longContent; + } + editor.getControl().setValue(longContent); + await Saveable.save(widget); + + // @ts-ignore + editor.getControl().getModel().applyEdits([{ + range: Range.fromPositions({ lineNumber: 1, column: 1 }, { lineNumber: 1, column: 4 }), + forceMoveMarkers: false, + text: '' + }]); + assert.isTrue(Saveable.isDirty(widget), 'should be dirty before save'); + + const resource = editor.document['resource']; + const version = resource.version; + // @ts-ignore + await resource.saveContents('baz'); + assert.notEqual(version, resource.version, 'latest version should be different after write'); + + let outOfSync = false; + let outOfSyncCount = 0; + toTearDown.push(setShouldOverwrite(async () => { + outOfSync = true; + outOfSyncCount++; + return false; + })); + + let incrementalUpdate = false; + const saveContentChanges = resource.saveContentChanges; + resource.saveContentChanges = async (changes, options) => { + incrementalUpdate = true; + // @ts-ignore + return saveContentChanges.bind(resource)(changes, options); + }; + try { + await Saveable.save(widget); + } finally { + resource.saveContentChanges = saveContentChanges; + } + + assert.isTrue(incrementalUpdate, 'should tried to update incrementaly'); + assert.isTrue(outOfSync, 'file should be out of sync'); + assert.equal(outOfSyncCount, 1, 'user should be prompted only once with out of sync dialog'); + assert.isTrue(Saveable.isDirty(widget), 'should be dirty after rejected save'); + assert.equal(editor.getControl().getValue().trimRight(), longContent.substring(3), 'model should be updated'); + const state = await fileService.read(fileUri); + assert.equal(state.value, 'baz', 'fs should NOT be updated'); + }); + + it('accept rejected save', async function () { + let outOfSync = false; + toTearDown.push(setShouldOverwrite(async () => { + outOfSync = true; + return false; + })); + editor.getControl().setValue('bar'); + assert.isTrue(Saveable.isDirty(widget), 'should be dirty before save'); + + const resource = editor.document['resource']; + const version = resource.version; + // @ts-ignore + await resource.saveContents('bazz'); + assert.notEqual(version, resource.version, 'latest version should be different after write'); + + await Saveable.save(widget); + assert.isTrue(outOfSync, 'file should be out of sync'); + assert.isTrue(Saveable.isDirty(widget), 'should be dirty after rejected save'); + assert.equal(editor.getControl().getValue().trimRight(), 'bar', 'model should be updated'); + let state = await fileService.read(fileUri); + assert.equal(state.value, 'bazz', 'fs should NOT be updated'); + + outOfSync = false; + toTearDown.push(setShouldOverwrite(async () => { + outOfSync = true; + return true; + })); + assert.isTrue(Saveable.isDirty(widget), 'should be dirty before save'); + await Saveable.save(widget); + assert.isTrue(outOfSync, 'file should be out of sync'); + assert.isFalse(Saveable.isDirty(widget), 'should NOT be dirty after save'); + assert.equal(editor.getControl().getValue().trimRight(), 'bar', 'model should be updated'); + state = await fileService.read(fileUri); + assert.equal(state.value.trimRight(), 'bar', 'fs should be updated'); + }); + + it('accept new save', async () => { + let outOfSync = false; + toTearDown.push(setShouldOverwrite(async () => { + outOfSync = true; + return true; + })); + editor.getControl().setValue('bar'); + assert.isTrue(Saveable.isDirty(widget), 'should be dirty before save'); + await fileService.write(fileUri, 'foo2', { etag: ETAG_DISABLED }); + await Saveable.save(widget); + assert.isTrue(outOfSync, 'file should be out of sync'); + assert.isFalse(Saveable.isDirty(widget), 'should NOT be dirty after save'); + assert.equal(editor.getControl().getValue().trimRight(), 'bar', 'model should be updated'); + const state = await fileService.read(fileUri); + assert.equal(state.value.trimRight(), 'bar', 'fs should be updated'); + }); + + it('cancel save on close', async () => { + editor.getControl().setValue('bar'); + assert.isTrue(Saveable.isDirty(widget), 'should be dirty before close'); + + await widget.closeWithSaving({ + shouldSave: () => undefined + }); + assert.isTrue(Saveable.isDirty(widget), 'should be still dirty after canceled close'); + assert.isFalse(widget.isDisposed, 'should NOT be disposed after canceled close'); + const state = await fileService.read(fileUri); + assert.equal(state.value, 'foo', 'fs should NOT be updated after canceled close'); + }); + + it('reject save on close', async () => { + editor.getControl().setValue('bar'); + assert.isTrue(Saveable.isDirty(widget), 'should be dirty before rejected close'); + await widget.closeWithSaving({ + shouldSave: () => false + }); + assert.isTrue(widget.isDisposed, 'should be disposed after rejected close'); + const state = await fileService.read(fileUri); + assert.equal(state.value, 'foo', 'fs should NOT be updated after rejected close'); + }); + + it('accept save on close and reject it', async () => { + let outOfSync = false; + toTearDown.push(setShouldOverwrite(async () => { + outOfSync = true; + return false; + })); + editor.getControl().setValue('bar'); + assert.isTrue(Saveable.isDirty(widget), 'should be dirty before rejecting save on close'); + await fileService.write(fileUri, 'foo2', { etag: ETAG_DISABLED }); + await widget.closeWithSaving({ + shouldSave: () => true + }); + assert.isTrue(outOfSync, 'file should be out of sync'); + assert.isFalse(widget.isDisposed, 'model should not be disposed after close when we reject the save'); + const state = await fileService.read(fileUri); + assert.equal(state.value, 'foo2', 'fs should NOT be updated'); + }); + + it('accept save on close and accept new save', async () => { + let outOfSync = false; + toTearDown.push(setShouldOverwrite(async () => { + outOfSync = true; + return true; + })); + editor.getControl().setValue('bar'); + assert.isTrue(Saveable.isDirty(widget), 'should be dirty before accepting save on close'); + await fileService.write(fileUri, 'foo2', { etag: ETAG_DISABLED }); + await widget.closeWithSaving({ + shouldSave: () => true + }); + assert.isTrue(outOfSync, 'file should be out of sync'); + assert.isTrue(widget.isDisposed, 'model should be disposed after close'); + const state = await fileService.read(fileUri); + assert.equal(state.value.trimRight(), 'bar', 'fs should be updated'); + }); + + it('no save prompt when multiple editors open for same file', async () => { + const secondWidget = await editorManager.openToSide(fileUri); + editor.getControl().setValue('two widgets'); + assert.isTrue(Saveable.isDirty(widget), 'the first widget should be dirty'); + assert.isTrue(Saveable.isDirty(secondWidget), 'the second widget should also be dirty'); + await Promise.resolve(secondWidget.close()); + assert.isTrue(secondWidget.isDisposed, 'the widget should have closed without requesting user action'); + assert.isTrue(Saveable.isDirty(widget), 'the original widget should still be dirty.'); + assert.equal(editor.getControl().getValue(), 'two widgets', 'should still have the same value'); + }); + + it('normal close', async () => { + editor.getControl().setValue('bar'); + assert.isTrue(Saveable.isDirty(widget), 'should be dirty before before close'); + await widget.closeWithSaving({ + shouldSave: () => true + }); + assert.isTrue(widget.isDisposed, 'model should be disposed after close'); + const state = await fileService.read(fileUri); + assert.equal(state.value.trimRight(), 'bar', 'fs should be updated'); + }); + + it('delete and add again file for dirty', async () => { + editor.getControl().setValue('bar'); + assert.isTrue(Saveable.isDirty(widget), 'should be dirty before delete'); + assert.isTrue(editor.document.valid, 'should be valid before delete'); + let waitForDidChangeTitle = new Deferred(); + const listener = () => waitForDidChangeTitle.resolve(); + widget.title.changed.connect(listener); + try { + await fileService.delete(fileUri); + await waitForDidChangeTitle.promise; + assert.isTrue(widget.title.label.endsWith('(Deleted)'), 'should be marked as deleted'); + assert.isTrue(Saveable.isDirty(widget), 'should be dirty after delete'); + assert.isFalse(widget.isDisposed, 'model should NOT be disposed after delete'); + } finally { + widget.title.changed.disconnect(listener); + } + + waitForDidChangeTitle = new Deferred(); + widget.title.changed.connect(listener); + try { + await fileService.create(fileUri, 'foo'); + await waitForDidChangeTitle.promise; + assert.isFalse(widget.title.label.endsWith('(deleted)'), 'should NOT be marked as deleted'); + assert.isTrue(Saveable.isDirty(widget), 'should be dirty after added again'); + assert.isFalse(widget.isDisposed, 'model should NOT be disposed after added again'); + } finally { + widget.title.changed.disconnect(listener); + } + }); + + it('save deleted file for dirty', async function () { + editor.getControl().setValue('bar'); + assert.isTrue(Saveable.isDirty(widget), 'should be dirty before save deleted'); + + assert.isTrue(editor.document.valid, 'should be valid before delete'); + const waitForInvalid = new Deferred(); + const listener = editor.document.onDidChangeValid(() => waitForInvalid.resolve()); + try { + await fileService.delete(fileUri); + await waitForInvalid.promise; + assert.isFalse(editor.document.valid, 'should be invalid after delete'); + } finally { + listener.dispose(); + } + + assert.isTrue(Saveable.isDirty(widget), 'should be dirty before save'); + await Saveable.save(widget); + assert.isFalse(Saveable.isDirty(widget), 'should NOT be dirty after save'); + assert.isTrue(editor.document.valid, 'should be valid after save'); + const state = await fileService.read(fileUri); + assert.equal(state.value.trimRight(), 'bar', 'fs should be updated'); + }); + + it('move file for saved', async function () { + assert.isFalse(Saveable.isDirty(widget), 'should NOT be dirty before move'); + + const targetUri = fileUri.parent.resolve('bar.txt'); + await fileService.move(fileUri, targetUri, { overwrite: true }); + assert.isTrue(widget.isDisposed, 'old model should be disposed after move'); + + const renamed = /** @type {EditorWidget} */ (await editorManager.getByUri(targetUri)); + assert.equal(String(renamed.getResourceUri()), targetUri.toString(), 'new model should be created after move'); + assert.equal(renamed.editor.document.getText(), 'foo', 'new model should be created after move'); + assert.isFalse(Saveable.isDirty(renamed), 'new model should NOT be dirty after move'); + }); + + it('move file for dirty', async function () { + editor.getControl().setValue('bar'); + assert.isTrue(Saveable.isDirty(widget), 'should be dirty before move'); + + const targetUri = fileUri.parent.resolve('bar.txt'); + + await fileService.move(fileUri, targetUri, { overwrite: true }); + assert.isTrue(widget.isDisposed, 'old model should be disposed after move'); + + const renamed = /** @type {EditorWidget} */ (await editorManager.getByUri(targetUri)); + assert.equal(String(renamed.getResourceUri()), targetUri.toString(), 'new model should be created after move'); + assert.equal(renamed.editor.document.getText(), 'bar', 'new model should be created after move'); + assert.isTrue(Saveable.isDirty(renamed), 'new model should be dirty after move'); + + await Saveable.save(renamed); + assert.isFalse(Saveable.isDirty(renamed), 'new model should NOT be dirty after save'); + }); + + it('fail to open invalid file', async function () { + const invalidFile = fileUri.parent.resolve('invalid_file.txt'); + try { + await editorManager.open(invalidFile, { mode: 'reveal' }); + assert.fail('should not be possible to open an editor for invalid file'); + } catch (e) { + assert.equal(e.code, 'MODEL_IS_INVALID'); + } + }); + + it('decode without save', async function () { + assert.strictEqual('utf8', editor.document.getEncoding()); + assert.strictEqual('foo', editor.document.getText()); + await editor.setEncoding('utf16le', 1 /* EncodingMode.Decode */); + assert.strictEqual('utf16le', editor.document.getEncoding()); + assert.notEqual('foo', editor.document.getText().trimRight()); + assert.isFalse(Saveable.isDirty(widget), 'should not be dirty after decode'); + + await widget.closeWithSaving({ + shouldSave: () => undefined + }); + assert.isTrue(widget.isDisposed, 'widget should be disposed after close'); + + widget = /** @type {EditorWidget & SaveableWidget} */ + (await editorManager.open(fileUri, { mode: 'reveal' })); + editor = /** @type {MonacoEditor} */ (MonacoEditor.get(widget)); + + assert.strictEqual('utf8', editor.document.getEncoding()); + assert.strictEqual('foo', editor.document.getText().trimRight()); + }); + + it('decode with save', async function () { + assert.strictEqual('utf8', editor.document.getEncoding()); + assert.strictEqual('foo', editor.document.getText()); + await editor.setEncoding('utf16le', 1 /* EncodingMode.Decode */); + assert.strictEqual('utf16le', editor.document.getEncoding()); + assert.notEqual('foo', editor.document.getText().trimRight()); + assert.isFalse(Saveable.isDirty(widget), 'should not be dirty after decode'); + + await Saveable.save(widget); + + await widget.closeWithSaving({ + shouldSave: () => undefined + }); + assert.isTrue(widget.isDisposed, 'widget should be disposed after close'); + + widget = /** @type {EditorWidget & SaveableWidget} */ + (await editorManager.open(fileUri, { mode: 'reveal' })); + editor = /** @type {MonacoEditor} */ (MonacoEditor.get(widget)); + + assert.strictEqual('utf16le', editor.document.getEncoding()); + assert.notEqual('foo', editor.document.getText().trimRight()); + }); + + it('encode', async function () { + assert.strictEqual('utf8', editor.document.getEncoding()); + assert.strictEqual('foo', editor.document.getText()); + await editor.setEncoding('utf16le', 0 /* EncodingMode.Encode */); + assert.strictEqual('utf16le', editor.document.getEncoding()); + assert.strictEqual('foo', editor.document.getText().trimRight()); + assert.isFalse(Saveable.isDirty(widget), 'should not be dirty after encode'); + + await widget.closeWithSaving({ + shouldSave: () => undefined + }); + assert.isTrue(widget.isDisposed, 'widget should be disposed after close'); + + widget = /** @type {EditorWidget & SaveableWidget} */ + (await editorManager.open(fileUri, { mode: 'reveal' })); + editor = /** @type {MonacoEditor} */ (MonacoEditor.get(widget)); + + assert.strictEqual('utf16le', editor.document.getEncoding()); + assert.strictEqual('foo', editor.document.getText().trimRight()); + }); + + it('delete file for saved', async () => { + assert.isFalse(Saveable.isDirty(widget), 'should NOT be dirty before delete'); + const waitForDisposed = new Deferred(); + const listener = editor.onDispose(() => waitForDisposed.resolve()); + try { + await fileService.delete(fileUri); + await waitForDisposed.promise; + assert.isTrue(widget.isDisposed, 'model should be disposed after delete'); + } finally { + listener.dispose(); + } + }); + + it(`'${closeOnFileDelete}' should keep the editor opened when set to 'false'`, async () => { + + await preferences.set(closeOnFileDelete, false); + assert.isFalse(preferences.get(closeOnFileDelete)); + assert.isFalse(Saveable.isDirty(widget)); + + const waitForDidChangeTitle = new Deferred(); + const listener = () => waitForDidChangeTitle.resolve(); + widget.title.changed.connect(listener); + try { + await fileService.delete(fileUri); + await waitForDidChangeTitle.promise; + assert.isTrue(widget.title.label.endsWith('(Deleted)')); + assert.isFalse(widget.isDisposed); + } finally { + widget.title.changed.disconnect(listener); + } + }); + + it(`'${closeOnFileDelete}' should close the editor when set to 'true'`, async () => { + + await preferences.set(closeOnFileDelete, true); + assert.isTrue(preferences.get(closeOnFileDelete)); + assert.isFalse(Saveable.isDirty(widget)); + + const waitForDisposed = new Deferred(); + // Must pass in 5 seconds, so check state after 4.5. + const listener = editor.onDispose(() => waitForDisposed.resolve()); + const fourSeconds = new Promise(resolve => setTimeout(resolve, 4500)); + try { + const deleteThenDispose = fileService.delete(fileUri).then(() => waitForDisposed.promise); + await Promise.race([deleteThenDispose, fourSeconds]); + assert.isTrue(widget.isDisposed); + } finally { + listener.dispose(); + } + }); +}); diff --git a/examples/api-tests/src/scm.spec.js b/examples/api-tests/src/scm.spec.js new file mode 100644 index 0000000..8635d96 --- /dev/null +++ b/examples/api-tests/src/scm.spec.js @@ -0,0 +1,222 @@ +// ***************************************************************************** +// Copyright (C) 2020 Ericsson and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +const { timeout } = require('@theia/core/lib/common/promise-util'); + +// @ts-check +describe('SCM', function () { + + const { assert } = chai; + + const { HostedPluginSupport } = require('@theia/plugin-ext/lib/hosted/browser/hosted-plugin'); + const Uri = require('@theia/core/lib/common/uri'); + const { ApplicationShell } = require('@theia/core/lib/browser/shell/application-shell'); + const { ContextKeyService } = require('@theia/core/lib/browser/context-key-service'); + const { ScmContribution } = require('@theia/scm/lib/browser/scm-contribution'); + const { ScmService } = require('@theia/scm/lib/browser/scm-service'); + const { ScmWidget } = require('@theia/scm/lib/browser/scm-widget'); + const { CommandRegistry } = require('@theia/core/lib/common'); + const { PreferenceService } = require('@theia/core/lib/browser'); + + + /** @type {import('inversify').Container} */ + const container = window['theia'].container; + const contextKeyService = container.get(ContextKeyService); + const scmContribution = container.get(ScmContribution); + const shell = container.get(ApplicationShell); + const service = container.get(ScmService); + const commandRegistry = container.get(CommandRegistry); + const pluginService = container.get(HostedPluginSupport); + const preferences = container.get(PreferenceService); + + /** @type {ScmWidget} */ + let scmWidget; + + /** @type {ScmService} */ + let scmService; + + const gitPluginId = 'vscode.git'; + + /** + * @param {() => unknown} condition + * @param {number | undefined} [timeout] + * @param {string | undefined} [message] + * @returns {Promise} + */ + async function waitForAnimation(condition, maxWait, message) { + if (maxWait === undefined) { + maxWait = 100000; + } + const endTime = Date.now() + maxWait; + do { + await (timeout(100)); + if (condition()) { + return true; + } + if (Date.now() > endTime) { + throw new Error(message ?? 'Wait for animation timed out.'); + } + } while (true); + } + + + before(async () => { + preferences.set('git.autoRepositoryDetection', true); + preferences.set('git.openRepositoryInParentFolders', 'always'); + }); + + beforeEach(async () => { + if (!pluginService.getPlugin(gitPluginId)) { + throw new Error(gitPluginId + ' should be started'); + } + await pluginService.activatePlugin(gitPluginId); + await shell.leftPanelHandler.collapse(); + scmWidget = await scmContribution.openView({ activate: true, reveal: true }); + scmService = service; + await waitForAnimation(() => scmService.selectedRepository, 10000, 'selected repository is not defined'); + }); + + afterEach(() => { + // @ts-ignore + scmWidget = undefined; + // @ts-ignore + scmService = undefined; + }); + + describe('scm-view', () => { + it('the view should open and activate successfully', () => { + assert.notEqual(scmWidget, undefined); + assert.strictEqual(scmWidget, shell.activeWidget); + }); + + describe('\'ScmTreeWidget\'', () => { + + it('the view should display the resource tree when a repository is present', () => { + assert.isTrue(scmWidget.resourceWidget.isVisible); + }); + + it('the view should not display the resource tree when no repository is present', () => { + + // Store the current selected repository so it can be restored. + const cachedSelectedRepository = scmService.selectedRepository; + + scmService.selectedRepository = undefined; + assert.isFalse(scmWidget.resourceWidget.isVisible); + + // Restore the selected repository. + scmService.selectedRepository = cachedSelectedRepository; + }); + + }); + + describe('\'ScmNoRepositoryWidget\'', () => { + + it('should not be visible when a repository is present', () => { + assert.isFalse(scmWidget.noRepositoryWidget.isVisible); + }); + + it('should be visible when no repository is present', () => { + + // Store the current selected repository so it can be restored. + const cachedSelectedRepository = scmService.selectedRepository; + + scmService.selectedRepository = undefined; + assert.isTrue(scmWidget.noRepositoryWidget.isVisible); + + // Restore the selected repository. + scmService.selectedRepository = cachedSelectedRepository; + }); + + }); + }); + + describe('scm-service', () => { + + it('should successfully return the list of repositories', () => { + const repositories = scmService.repositories; + assert.isTrue(repositories.length > 0); + }); + + it('should include the selected repository in the list of repositories', () => { + const repositories = scmService.repositories; + const selectedRepository = scmService.selectedRepository; + assert.isTrue(repositories.length === 1); + assert.strictEqual(repositories[0], selectedRepository); + }); + + it('should successfully return the selected repository', () => { + assert.notEqual(scmService.selectedRepository, undefined); + }); + + it('should successfully find the repository', () => { + const selectedRepository = scmService.selectedRepository; + if (selectedRepository) { + const rootUri = selectedRepository.provider.rootUri; + const foundRepository = scmService.findRepository(new Uri.default(rootUri)); + assert.notEqual(foundRepository, undefined); + } + else { + assert.fail('Selected repository is undefined'); + } + }); + + it('should not find a repository for an unknown uri', () => { + const mockUri = new Uri.default('foobar/foo/bar'); + const repo = scmService.findRepository(mockUri); + assert.strictEqual(repo, undefined); + }); + + it('should successfully return the list of statusbar commands', () => { + assert.isTrue(scmService.statusBarCommands.length > 0); + }); + + }); + + describe('scm-provider', () => { + + it('should successfully return the last commit', async () => { + const selectedRepository = scmService.selectedRepository; + if (selectedRepository) { + const amendSupport = selectedRepository.provider.amendSupport; + if (amendSupport) { + const commit = await amendSupport.getLastCommit(); + assert.notEqual(commit, undefined); + } + } + else { + assert.fail('Selected repository is undefined'); + } + }); + + }); + + describe('scm-contribution', () => { + + describe('scmFocus context-key', () => { + + it('should return \'true\' when the view is focused', () => { + assert.isTrue(contextKeyService.match('scmFocus')); + }); + + it('should return \'false\' when the view is not focused', async () => { + await scmContribution.closeView(); + assert.isFalse(contextKeyService.match('scmFocus')); + }); + + }); + }); + +}); diff --git a/examples/api-tests/src/shell.spec.js b/examples/api-tests/src/shell.spec.js new file mode 100644 index 0000000..3d07779 --- /dev/null +++ b/examples/api-tests/src/shell.spec.js @@ -0,0 +1,41 @@ +// ***************************************************************************** +// Copyright (C) 2017 Ericsson and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +// @ts-check +describe('Shell', function () { + + const { assert } = chai; + + const { ApplicationShell } = require('@theia/core/lib/browser/shell/application-shell'); + const { StatusBarImpl } = require('@theia/core/lib/browser/status-bar'); + + const container = window.theia.container; + const shell = container.get(ApplicationShell); + const statusBar = container.get(StatusBarImpl); + + it('should be shown', () => { + assert.isTrue(shell.isAttached && shell.isVisible); + }); + + it('should show the main content panel', () => { + assert.isTrue(shell.mainPanel.isAttached && shell.mainPanel.isVisible); + }); + + it('should show the status bar', () => { + assert.isTrue(statusBar.isAttached && statusBar.isVisible); + }); + +}); diff --git a/examples/api-tests/src/task-configurations.spec.js b/examples/api-tests/src/task-configurations.spec.js new file mode 100644 index 0000000..d8b49f5 --- /dev/null +++ b/examples/api-tests/src/task-configurations.spec.js @@ -0,0 +1,112 @@ +// ***************************************************************************** +// Copyright (C) 2021 Ericsson and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +// @ts-check + +describe('The Task Configuration Manager', function () { + this.timeout(5000); + + const { assert } = chai; + + const { WorkspaceService } = require('@theia/workspace/lib/browser/workspace-service'); + const { TaskScope, TaskConfigurationScope } = require('@theia/task/lib/common/task-protocol'); + const { TaskConfigurationManager } = require('@theia/task/lib/browser/task-configuration-manager'); + const container = window.theia.container; + const workspaceService = container.get(WorkspaceService); + const taskConfigurationManager = container.get(TaskConfigurationManager); + + const baseWorkspaceURI = workspaceService.tryGetRoots()[0].resource; + const baseWorkspaceRoot = baseWorkspaceURI.toString(); + + const basicTaskConfig = { + label: 'task', + type: 'shell', + command: 'top', + }; + + /** @type {Set} */ + const scopesToClear = new Set(); + + describe('in a single-root workspace', () => { + beforeEach(() => clearTasks()); + after(() => clearTasks()); + + setAndRetrieveTasks(() => TaskScope.Global, 'user'); + setAndRetrieveTasks(() => TaskScope.Workspace, 'workspace'); + setAndRetrieveTasks(() => baseWorkspaceRoot, 'folder'); + }); + + async function clearTasks() { + await Promise.all(Array.from(scopesToClear, async scope => { + if (!!scope || scope === 0) { + await taskConfigurationManager.setTaskConfigurations(scope, []); + } + })); + scopesToClear.clear(); + } + + /** + * @param {() => TaskConfigurationScope} scopeGenerator a function to allow lazy evaluation of the second workspace root. + * @param {string} scopeLabel + * @param {boolean} only + */ + function setAndRetrieveTasks(scopeGenerator, scopeLabel, only = false) { + const testFunction = only ? it.only : it; + testFunction(`successfully handles ${scopeLabel} scope`, async () => { + const scope = scopeGenerator(); + scopesToClear.add(scope); + const initialTasks = taskConfigurationManager.getTasks(scope); + assert.deepEqual(initialTasks, []); + await taskConfigurationManager.setTaskConfigurations(scope, [basicTaskConfig]); + const newTasks = taskConfigurationManager.getTasks(scope); + assert.deepEqual(newTasks, [basicTaskConfig]); + }); + } + + /* UNCOMMENT TO RUN MULTI-ROOT TESTS */ + // const { FileService } = require('@theia/filesystem/lib/browser/file-service'); + // const { EnvVariablesServer } = require('@theia/core/lib/common/env-variables'); + // const URI = require('@theia/core/lib/common/uri').default; + + // const fileService = container.get(FileService); + // /** @type {EnvVariablesServer} */ + // const envVariables = container.get(EnvVariablesServer); + + // describe('in a multi-root workspace', () => { + // let secondWorkspaceRoot = ''; + // before(async () => { + // const configLocation = await envVariables.getConfigDirUri(); + // const secondWorkspaceRootURI = new URI(configLocation).parent.resolve(`test-root-${Date.now()}`); + // secondWorkspaceRoot = secondWorkspaceRootURI.toString(); + // await fileService.createFolder(secondWorkspaceRootURI); + // /** @type {Promise} */ + // const waitForEvent = new Promise(resolve => { + // const listener = taskConfigurationManager.onDidChangeTaskConfig(() => { + // listener.dispose(); + // resolve(); + // }); + // }); + // workspaceService.addRoot(secondWorkspaceRootURI); + // return waitForEvent; + // }); + // beforeEach(() => clearTasks()); + // after(() => clearTasks()); + // setAndRetrieveTasks(() => TaskScope.Global, 'user'); + // setAndRetrieveTasks(() => TaskScope.Workspace, 'workspace'); + // setAndRetrieveTasks(() => baseWorkspaceRoot, 'folder (1)'); + // setAndRetrieveTasks(() => secondWorkspaceRoot, 'folder (2)'); + // }); +}); diff --git a/examples/api-tests/src/typescript.spec.js b/examples/api-tests/src/typescript.spec.js new file mode 100644 index 0000000..3238944 --- /dev/null +++ b/examples/api-tests/src/typescript.spec.js @@ -0,0 +1,873 @@ +// ***************************************************************************** +// Copyright (C) 2020 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +// @ts-check +describe('TypeScript', function () { + this.timeout(360_000); + + const { assert } = chai; + const { timeout } = require('@theia/core/lib/common/promise-util'); + const { MenuModelRegistry } = require('@theia/core/lib/common/menu/menu-model-registry'); + + const Uri = require('@theia/core/lib/common/uri'); + const { DisposableCollection } = require('@theia/core/lib/common/disposable'); + const { BrowserMainMenuFactory } = require('@theia/core/lib/browser/menu/browser-menu-plugin'); + const { EditorManager } = require('@theia/editor/lib/browser/editor-manager'); + const { EditorWidget } = require('@theia/editor/lib/browser/editor-widget'); + const { EDITOR_CONTEXT_MENU } = require('@theia/editor/lib/browser/editor-menu'); + const { WorkspaceService } = require('@theia/workspace/lib/browser/workspace-service'); + const { MonacoEditor } = require('@theia/monaco/lib/browser/monaco-editor'); + const { HostedPluginSupport } = require('@theia/plugin-ext/lib/hosted/browser/hosted-plugin'); + const { ContextKeyService } = require('@theia/core/lib/browser/context-key-service'); + const { CommandRegistry } = require('@theia/core/lib/common/command'); + const { KeybindingRegistry } = require('@theia/core/lib/browser/keybinding'); + const { OpenerService, open } = require('@theia/core/lib/browser/opener-service'); + const { PreferenceService } = require('@theia/core/lib/common/preferences/preference-service'); + const { PreferenceScope } = require('@theia/core/lib/common/preferences/preference-scope'); + const { ProgressStatusBarItem } = require('@theia/core/lib/browser/progress-status-bar-item'); + const { PluginViewRegistry } = require('@theia/plugin-ext/lib/main/browser/view/plugin-view-registry'); + const { Range } = require('@theia/monaco-editor-core/esm/vs/editor/common/core/range'); + const { Selection } = require('@theia/monaco-editor-core/esm/vs/editor/common/core/selection'); + + const container = window.theia.container; + const editorManager = container.get(EditorManager); + const workspaceService = container.get(WorkspaceService); + const menuFactory = container.get(BrowserMainMenuFactory); + const menuRegistry = container.get(MenuModelRegistry); + const pluginService = container.get(HostedPluginSupport); + const contextKeyService = container.get(ContextKeyService); + const commands = container.get(CommandRegistry); + const openerService = container.get(OpenerService); + /** @type {KeybindingRegistry} */ + const keybindings = container.get(KeybindingRegistry); + /** @type {import('@theia/core/lib/common/preferences/preference-service').PreferenceService} */ + const preferences = container.get(PreferenceService); + const progressStatusBarItem = container.get(ProgressStatusBarItem); + /** @type {PluginViewRegistry} */ + const pluginViewRegistry = container.get(PluginViewRegistry); + + const typescriptPluginId = 'vscode.typescript-language-features'; + const referencesPluginId = 'vscode.references-view'; + /** @type Uri.URI */ + const rootUri = workspaceService.tryGetRoots()[0].resource; + const demoFileUri = rootUri.resolveToAbsolute('../api-tests/test-ts-workspace/demo-file.ts'); + const definitionFileUri = rootUri.resolveToAbsolute('../api-tests/test-ts-workspace/demo-definitions-file.ts'); + let originalAutoSaveValue = preferences.get('files.autoSave'); + + before(async function () { + await pluginService.didStart; + await Promise.all([typescriptPluginId, referencesPluginId].map(async pluginId => { + if (!pluginService.getPlugin(pluginId)) { + throw new Error(pluginId + ' should be started'); + } + await pluginService.activatePlugin(pluginId); + })); + await preferences.set('files.autoSave', 'off'); + await preferences.set('files.refactoring.autoSave', 'off'); + }); + + beforeEach(async function () { + await editorManager.closeAll({ save: false }); + await new Promise(resolve => setTimeout(resolve, 500)); + }); + + const toTearDown = new DisposableCollection(); + afterEach(async () => { + toTearDown.dispose(); + await editorManager.closeAll({ save: false }); + await new Promise(resolve => setTimeout(resolve, 500)); + }); + + after(async () => { + await preferences.set('files.autoSave', originalAutoSaveValue); + }) + + async function waitLanguageServerReady() { + // quite a bit of jitter in the "Initializing LS" status bar entry, + // so we want to read a few times in a row that it's done (undefined) + const MAX_N = 5 + let n = MAX_N; + while (n > 0) { + await timeout(1000); + if (progressStatusBarItem.currentProgress) { + n = MAX_N; + } else { + n--; + } + if (n < 5) { + console.debug('n = ' + n); + } + } + } + + /** + * @param {Uri.default} uri + * @param {boolean} preview + */ + async function openEditor(uri, preview = false) { + const widget = await open(openerService, uri, { mode: 'activate', preview }); + const editorWidget = widget instanceof EditorWidget ? widget : undefined; + const editor = MonacoEditor.get(editorWidget); + assert.isDefined(editor); + // wait till tsserver is running, see: + // https://github.com/microsoft/vscode/blob/93cbbc5cae50e9f5f5046343c751b6d010468200/extensions/typescript-language-features/src/extension.ts#L98-L103 + await waitForAnimation(() => contextKeyService.match('typescript.isManagedFile'), 1000000, 'waiting for "typescript.isManagedFile"'); + + waitLanguageServerReady(); + return /** @type {MonacoEditor} */ (editor); + } + + + /** + * @param {() => unknown} condition + * @param {number | undefined} [maxWait] + * @param {string | function | undefined} [message] + * @returns {Promise} + */ + async function waitForAnimation(condition, maxWait, message) { + if (maxWait === undefined) { + maxWait = 100000; + } + const endTime = Date.now() + maxWait; + do { + await (timeout(100)); + if (condition()) { + return; + } + if (Date.now() > endTime) { + throw new Error((typeof message === 'function' ? message() : message) ?? 'Wait for animation timed out.'); + } + } while (true); + } + + /** + * We ignore attributes on purpose since they are not stable. + * But structure is important for us to see whether the plain text is rendered or markdown. + * + * @param {Element} element + * @returns {string} + */ + function nodeAsString(element, indentation = '') { + if (!element) { + return ''; + } + const header = element.tagName; + let body = ''; + const childIndentation = indentation + ' '; + for (let i = 0; i < element.childNodes.length; i++) { + const childNode = element.childNodes.item(i); + if (childNode.nodeType === childNode.TEXT_NODE) { + body += childIndentation + `"${childNode.textContent}"` + '\n'; + } else if (childNode instanceof HTMLElement) { + body += childIndentation + nodeAsString(childNode, childIndentation) + '\n'; + } + } + const result = header + (body ? ' {\n' + body + indentation + '}' : ''); + if (indentation) { + return result; + } + return `\n${result}\n`; + } + + /** + * @param {MonacoEditor} editor + */ + async function assertPeekOpened(editor) { + /** @type any */ + const referencesController = editor.getControl().getContribution('editor.contrib.referencesController'); + await waitForAnimation(() => referencesController._widget && referencesController._widget._tree.getFocus().length); + + assert.isFalse(contextKeyService.match('editorTextFocus')); + assert.isTrue(contextKeyService.match('referenceSearchVisible')); + assert.isTrue(contextKeyService.match('listFocus')); + } + + /** + * @param {MonacoEditor} editor + */ + async function openPeek(editor) { + assert.isTrue(contextKeyService.match('editorTextFocus')); + assert.isFalse(contextKeyService.match('referenceSearchVisible')); + assert.isFalse(contextKeyService.match('listFocus')); + + await commands.executeCommand('editor.action.peekDefinition'); + await assertPeekOpened(editor); + } + + async function openReference() { + keybindings.dispatchKeyDown('Enter'); + await waitForAnimation(() => contextKeyService.match('listFocus')); + assert.isFalse(contextKeyService.match('editorTextFocus')); + assert.isTrue(contextKeyService.match('referenceSearchVisible')); + assert.isTrue(contextKeyService.match('listFocus')); + } + + /** + * @param {MonacoEditor} editor + */ + async function closePeek(editor) { + await assertPeekOpened(editor); + + console.log('closePeek() - Attempt to close by sending "Escape"'); + await dismissWithEscape('listFocus'); + + assert.isTrue(contextKeyService.match('editorTextFocus')); + assert.isFalse(contextKeyService.match('referenceSearchVisible')); + assert.isFalse(contextKeyService.match('listFocus')); + } + + it('document formatting should be visible and enabled', async function () { + await openEditor(demoFileUri); + const menu = menuFactory.createContextMenu(EDITOR_CONTEXT_MENU, menuRegistry.getMenu(EDITOR_CONTEXT_MENU), contextKeyService); + const item = menu.items.find(i => i.command === 'editor.action.formatDocument'); + if (item) { + assert.isTrue(item.isVisible, 'item is visible'); + assert.isTrue(item.isEnabled, 'item is enabled'); + } else { + assert.isDefined(item, 'item is defined'); + } + }); + + describe('editor.action.revealDefinition', function () { + for (const preview of [false, true]) { + const from = 'an editor' + (preview ? ' preview' : ''); + it('within ' + from, async function () { + const editor = await openEditor(demoFileUri, preview); + // const demoInstance = new Demo|Class('demo'); + editor.getControl().setPosition({ lineNumber: 28, column: 5 }); + assert.equal(editor.getControl().getModel().getWordAtPosition(editor.getControl().getPosition()).word, 'demoVariable'); + + await commands.executeCommand('editor.action.revealDefinition'); + + const activeEditor = /** @type {MonacoEditor} */ MonacoEditor.get(editorManager.activeEditor); + assert.equal(editorManager.activeEditor.isPreview, preview); + assert.equal(activeEditor.uri.toString(), demoFileUri.toString()); + // constructor(someString: string) { + const { lineNumber, column } = activeEditor.getControl().getPosition(); + assert.deepEqual({ lineNumber, column }, { lineNumber: 26, column: 7 }); + assert.equal(activeEditor.getControl().getModel().getWordAtPosition({ lineNumber, column }).word, 'demoVariable'); + }); + + // Note: this test generate annoying but apparently harmless error traces, during cleanup: + // [Error: Error: Cannot update an unmounted root. + // at ReactDOMRoot.__webpack_modules__.../../node_modules/react-dom/cjs/react-dom.development.js.ReactDOMHydrationRoot.render.ReactDOMRoot.render (http://127.0.0.1:3000/bundle.js:92757:11) + // at BreadcrumbsRenderer.render (http://127.0.0.1:3000/bundle.js:137316:23) + // at BreadcrumbsRenderer.update (http://127.0.0.1:3000/bundle.js:108722:14) + // at BreadcrumbsRenderer.refresh (http://127.0.0.1:3000/bundle.js:108719:14) + // at async ToolbarAwareTabBar.updateBreadcrumbs (http://127.0.0.1:3000/bundle.js:128229:9)] + it(`from ${from} to another editor`, async function () { + await editorManager.open(definitionFileUri, { mode: 'open' }); + + const editor = await openEditor(demoFileUri, preview); + // const bar: Defined|Interface = { coolField: [] }; + editor.getControl().setPosition({ lineNumber: 32, column: 19 }); + assert.equal(editor.getControl().getModel().getWordAtPosition(editor.getControl().getPosition()).word, 'DefinedInterface'); + + await commands.executeCommand('editor.action.revealDefinition'); + + const activeEditor = /** @type {MonacoEditor} */ MonacoEditor.get(editorManager.activeEditor); + assert.isFalse(editorManager.activeEditor.isPreview); + assert.equal(activeEditor.uri.toString(), definitionFileUri.toString()); + + // export interface |DefinedInterface { + const { lineNumber, column } = activeEditor.getControl().getPosition(); + assert.deepEqual({ lineNumber, column }, { lineNumber: 2, column: 18 }); + assert.equal(activeEditor.getControl().getModel().getWordAtPosition({ lineNumber, column }).word, 'DefinedInterface'); + }); + + it(`from ${from} to an editor preview`, async function () { + const editor = await openEditor(demoFileUri); + // const bar: Defined|Interface = { coolField: [] }; + editor.getControl().setPosition({ lineNumber: 32, column: 19 }); + assert.equal(editor.getControl().getModel().getWordAtPosition(editor.getControl().getPosition()).word, 'DefinedInterface'); + + await commands.executeCommand('editor.action.revealDefinition'); + + const activeEditor = /** @type {MonacoEditor} */ MonacoEditor.get(editorManager.activeEditor); + assert.isTrue(editorManager.activeEditor.isPreview); + assert.equal(activeEditor.uri.toString(), definitionFileUri.toString()); + // export interface |DefinedInterface { + const { lineNumber, column } = activeEditor.getControl().getPosition(); + assert.deepEqual({ lineNumber, column }, { lineNumber: 2, column: 18 }); + assert.equal(activeEditor.getControl().getModel().getWordAtPosition({ lineNumber, column }).word, 'DefinedInterface'); + }); + } + }); + + describe('editor.action.peekDefinition', function () { + + for (const preview of [false, true]) { + const from = 'an editor' + (preview ? ' preview' : ''); + it('within ' + from, async function () { + const editor = await openEditor(demoFileUri, preview); + editor.getControl().revealLine(24); + // const demoInstance = new Demo|Class('demo'); + editor.getControl().setPosition({ lineNumber: 24, column: 30 }); + assert.equal(editor.getControl().getModel().getWordAtPosition(editor.getControl().getPosition()).word, 'DemoClass'); + + await openPeek(editor); + await openReference(); + + const activeEditor = /** @type {MonacoEditor} */ MonacoEditor.get(editorManager.activeEditor); + assert.equal(editorManager.activeEditor.isPreview, preview); + assert.equal(activeEditor.uri.toString(), demoFileUri.toString()); + // constructor(someString: string) { + const { lineNumber, column } = activeEditor.getControl().getPosition(); + assert.deepEqual({ lineNumber, column }, { lineNumber: 11, column: 5 }); + assert.equal(activeEditor.getControl().getModel().getWordAtPosition({ lineNumber, column }).word, 'constructor'); + + await closePeek(activeEditor); + }); + + // Note: this test generate annoying but apparently harmless error traces, during cleanup: + // [Error: Error: Cannot update an unmounted root. + // at ReactDOMRoot.__webpack_modules__.../../node_modules/react-dom/cjs/react-dom.development.js.ReactDOMHydrationRoot.render.ReactDOMRoot.render (http://127.0.0.1:3000/bundle.js:92757:11) + // at BreadcrumbsRenderer.render (http://127.0.0.1:3000/bundle.js:137316:23) + // at BreadcrumbsRenderer.update (http://127.0.0.1:3000/bundle.js:108722:14) + // at BreadcrumbsRenderer.refresh (http://127.0.0.1:3000/bundle.js:108719:14) + // at async ToolbarAwareTabBar.updateBreadcrumbs (http://127.0.0.1:3000/bundle.js:128229:9)] + it(`from ${from} to another editor`, async function () { + await editorManager.open(definitionFileUri, { mode: 'open' }); + + const editor = await openEditor(demoFileUri, preview); + editor.getControl().revealLine(32); + // const bar: Defined|Interface = { coolField: [] }; + editor.getControl().setPosition({ lineNumber: 32, column: 19 }); + assert.equal(editor.getControl().getModel().getWordAtPosition(editor.getControl().getPosition()).word, 'DefinedInterface'); + + await openPeek(editor); + await openReference(); + + const activeEditor = /** @type {MonacoEditor} */ MonacoEditor.get(editorManager.activeEditor); + assert.isFalse(editorManager.activeEditor.isPreview); + assert.equal(activeEditor.uri.toString(), definitionFileUri.toString()); + // export interface |DefinedInterface { + const { lineNumber, column } = activeEditor.getControl().getPosition(); + assert.deepEqual({ lineNumber, column }, { lineNumber: 2, column: 18 }); + assert.equal(activeEditor.getControl().getModel().getWordAtPosition({ lineNumber, column }).word, 'DefinedInterface'); + + await closePeek(activeEditor); + }); + + it(`from ${from} to an editor preview`, async function () { + const editor = await openEditor(demoFileUri); + editor.getControl().revealLine(32); + // const bar: Defined|Interface = { coolField: [] }; + editor.getControl().setPosition({ lineNumber: 32, column: 19 }); + assert.equal(editor.getControl().getModel().getWordAtPosition(editor.getControl().getPosition()).word, 'DefinedInterface'); + + await openPeek(editor); + await openReference(); + + const activeEditor = /** @type {MonacoEditor} */ MonacoEditor.get(editorManager.activeEditor); + assert.isTrue(editorManager.activeEditor.isPreview); + assert.equal(activeEditor.uri.toString(), definitionFileUri.toString()); + // export interface |DefinedInterface { + const { lineNumber, column } = activeEditor.getControl().getPosition(); + assert.deepEqual({ lineNumber, column }, { lineNumber: 2, column: 18 }); + assert.equal(activeEditor.getControl().getModel().getWordAtPosition({ lineNumber, column }).word, 'DefinedInterface'); + + await closePeek(activeEditor); + }); + } + }); + + it('editor.action.triggerSuggest', async function () { + const editor = await openEditor(demoFileUri); + editor.getControl().setPosition({ lineNumber: 26, column: 46 }); + editor.getControl().setSelection(new Selection(26, 46, 26, 35)); + assert.equal(editor.getControl().getModel().getWordAtPosition(editor.getControl().getPosition()).word, 'stringField'); + + assert.isTrue(contextKeyService.match('editorTextFocus')); + assert.isFalse(contextKeyService.match('suggestWidgetVisible')); + + await commands.executeCommand('editor.action.triggerSuggest'); + await waitForAnimation(() => contextKeyService.match('suggestWidgetVisible')); + + assert.isTrue(contextKeyService.match('editorTextFocus')); + assert.isTrue(contextKeyService.match('suggestWidgetVisible')); + + + const suggestController = editor.getControl().getContribution('editor.contrib.suggestController'); + + waitForAnimation(() => { + const content = suggestController ? nodeAsString(suggestController['_widget']?.['_value']?.['element']?.['domNode']) : ''; + return !content.includes('loading'); + }); + + // May need a couple extra "Enter" being sent for the suggest to be accepted + keybindings.dispatchKeyDown('Enter'); + await waitForAnimation(() => { + const suggestWidgetDismissed = !contextKeyService.match('suggestWidgetVisible'); + if (!suggestWidgetDismissed) { + console.log('Re-try accepting suggest using "Enter" key'); + keybindings.dispatchKeyDown('Enter'); + return false; + } + return true; + }, 20000, 'Suggest widget has not been dismissed despite attempts to accept suggestion'); + + assert.isTrue(contextKeyService.match('editorTextFocus')); + assert.isFalse(contextKeyService.match('suggestWidgetVisible')); + + const activeEditor = /** @type {MonacoEditor} */ MonacoEditor.get(editorManager.activeEditor); + assert.equal(activeEditor.uri.toString(), demoFileUri.toString()); + // demoInstance.stringField; + const { lineNumber, column } = activeEditor.getControl().getPosition(); + assert.deepEqual({ lineNumber, column }, { lineNumber: 26, column: 46 }); + assert.equal(activeEditor.getControl().getModel().getWordAtPosition({ lineNumber, column }).word, 'doSomething'); + }); + + it('editor.action.triggerSuggest navigate', async function () { + const editor = await openEditor(demoFileUri); + // demoInstance.[|stringField]; + editor.getControl().setPosition({ lineNumber: 26, column: 46 }); + editor.getControl().setSelection(new Selection(26, 46, 26, 35)); + assert.equal(editor.getControl().getModel().getWordAtPosition(editor.getControl().getPosition()).word, 'stringField'); + + /** @type {import('@theia/monaco-editor-core/src/vs/editor/contrib/suggest/browser/suggestController').SuggestController} */ + const suggest = editor.getControl().getContribution('editor.contrib.suggestController'); + const getFocusedLabel = () => { + const focusedItem = suggest.widget.value.getFocusedItem(); + return focusedItem && focusedItem.item.completion.label; + }; + + assert.isUndefined(getFocusedLabel()); + assert.isFalse(contextKeyService.match('suggestWidgetVisible')); + + await commands.executeCommand('editor.action.triggerSuggest'); + await waitForAnimation(() => contextKeyService.match('suggestWidgetVisible') && getFocusedLabel() === 'doSomething', 5000); + + assert.equal(getFocusedLabel(), 'doSomething'); + assert.isTrue(contextKeyService.match('suggestWidgetVisible')); + + keybindings.dispatchKeyDown('ArrowDown'); + await waitForAnimation(() => contextKeyService.match('suggestWidgetVisible') && getFocusedLabel() === 'numberField', 2000); + + assert.equal(getFocusedLabel(), 'numberField'); + assert.isTrue(contextKeyService.match('suggestWidgetVisible')); + + keybindings.dispatchKeyDown('ArrowUp'); + await waitForAnimation(() => contextKeyService.match('suggestWidgetVisible') && getFocusedLabel() === 'doSomething', 2000); + + assert.equal(getFocusedLabel(), 'doSomething'); + assert.isTrue(contextKeyService.match('suggestWidgetVisible')); + + keybindings.dispatchKeyDown('Escape'); + + // once in a while, a second "Escape" is needed to dismiss widget + await waitForAnimation(() => { + const suggestWidgetDismissed = !contextKeyService.match('suggestWidgetVisible') && getFocusedLabel() === undefined; + if (!suggestWidgetDismissed) { + console.log('Re-try to dismiss suggest using "Escape" key'); + keybindings.dispatchKeyDown('Escape'); + return false; + } + return true; + }, 5000, 'Suggest widget not dismissed'); + + assert.isUndefined(getFocusedLabel()); + assert.isFalse(contextKeyService.match('suggestWidgetVisible')); + }); + + it('editor.action.rename', async function () { + const editor = await openEditor(demoFileUri); + // const |demoVariable = demoInstance.stringField; + editor.getControl().setPosition({ lineNumber: 26, column: 7 }); + assert.equal(editor.getControl().getModel().getWordAtPosition(editor.getControl().getPosition()).word, 'demoVariable'); + + assert.isTrue(contextKeyService.match('editorTextFocus')); + assert.isFalse(contextKeyService.match('renameInputVisible')); + + commands.executeCommand('editor.action.rename'); + await waitForAnimation(() => contextKeyService.match('renameInputVisible') + && document.activeElement instanceof HTMLInputElement + && document.activeElement.selectionEnd === 'demoVariable'.length); + assert.isFalse(contextKeyService.match('editorTextFocus')); + assert.isTrue(contextKeyService.match('renameInputVisible')); + + const input = document.activeElement; + if (!(input instanceof HTMLInputElement)) { + assert.fail('expected focused input, but: ' + input); + return; + } + + input.value = 'foo'; + keybindings.dispatchKeyDown('Enter', input); + + // all rename edits should be grouped in one edit operation and applied in the same tick + await new Promise(resolve => editor.getControl().onDidChangeModelContent(resolve)); + + assert.isTrue(contextKeyService.match('editorTextFocus')); + assert.isFalse(contextKeyService.match('renameInputVisible')); + + const activeEditor = /** @type {MonacoEditor} */ MonacoEditor.get(editorManager.activeEditor); + assert.equal(activeEditor.uri.toString(), demoFileUri.toString()); + // const |foo = new Container(); + const { lineNumber, column } = activeEditor.getControl().getPosition(); + assert.deepEqual({ lineNumber, column }, { lineNumber: 26, column: 7 }); + assert.equal(activeEditor.getControl().getModel().getWordAtPosition({ lineNumber: 28, column: 1 }).word, 'foo'); + }); + + async function dismissWithEscape(contextKey) { + keybindings.dispatchKeyDown('Escape'); + // once in a while, a second "Escape" is needed to dismiss widget + return waitForAnimation(() => { + const suggestWidgetDismissed = !contextKeyService.match(contextKey); + if (!suggestWidgetDismissed) { + console.log(`Re-try to dismiss ${contextKey} using "Escape" key`); + keybindings.dispatchKeyDown('Escape'); + return false; + } + return true; + }, 5000, `${contextKey} widget not dismissed`); + } + + it('editor.action.triggerParameterHints', async function () { + this.timeout(30000); + console.log('start trigger parameter hint'); + const editor = await openEditor(demoFileUri); + // const demoInstance = new DemoClass('|demo'); + editor.getControl().setPosition({ lineNumber: 24, column: 37 }); + assert.equal(editor.getControl().getModel().getWordAtPosition(editor.getControl().getPosition()).word, "demo"); + + assert.isTrue(contextKeyService.match('editorTextFocus')); + assert.isFalse(contextKeyService.match('parameterHintsVisible')); + + await commands.executeCommand('editor.action.triggerParameterHints'); + console.log('trigger command'); + await waitForAnimation(() => contextKeyService.match('parameterHintsVisible')); + console.log('context key matched'); + + assert.isTrue(contextKeyService.match('editorTextFocus')); + assert.isTrue(contextKeyService.match('parameterHintsVisible')); + + await dismissWithEscape('parameterHintsVisible'); + + assert.isTrue(contextKeyService.match('editorTextFocus')); + assert.isFalse(contextKeyService.match('parameterHintsVisible')); + }); + + it('editor.action.showHover', async function () { + + const editor = await openEditor(demoFileUri); + // class |DemoClass); + editor.getControl().setPosition({ lineNumber: 8, column: 7 }); + assert.equal(editor.getControl().getModel().getWordAtPosition(editor.getControl().getPosition()).word, 'DemoClass'); + + /** @type {import('@theia/monaco-editor-core/src/vs/editor/contrib/hover/browser/contentHoverController').ContentHoverController} */ + const hover = editor.getControl().getContribution('editor.contrib.contentHover'); + + assert.isTrue(contextKeyService.match('editorTextFocus')); + assert.isFalse(contextKeyService.match('editorHoverVisible')); + await commands.executeCommand('editor.action.showHover'); + let doLog = true; + await waitForAnimation(() => contextKeyService.match('editorHoverVisible')); + assert.isTrue(contextKeyService.match('editorHoverVisible')); + assert.isTrue(contextKeyService.match('editorTextFocus')); + + waitForAnimation(() => { + const content = nodeAsString(hover['_contentWidget']?.['widget']?.['_hover']?.['contentsDomNode']); + return !content.includes('loading'); + }); + + const content = nodeAsString(hover['_contentWidget']?.['widget']?.['_hover']?.['contentsDomNode']); + + assert.isTrue(content.includes('class', 'did not include')); + assert.isTrue(content.includes('DemoClass', 'did not include')); + await dismissWithEscape('editorHoverVisible'); + assert.isTrue(contextKeyService.match('editorTextFocus')); + assert.isFalse(Boolean(hover['_contentWidget']?.['_widget']?.['_visibleData'])); + }); + + it('highlight semantic (write) occurrences', async function () { + const editor = await openEditor(demoFileUri); + // const |container = new Container(); + const lineNumber = 24; + const column = 7; + const endColumn = column + 'demoInstance'.length; + + const hasWriteDecoration = () => { + for (const decoration of editor.getControl().getModel().getLineDecorations(lineNumber)) { + if (decoration.range.startColumn === column && decoration.range.endColumn === endColumn && decoration.options.className === 'wordHighlightStrong') { + return true; + } + } + return false; + }; + assert.isFalse(hasWriteDecoration()); + + editor.getControl().setPosition({ lineNumber, column }); + assert.equal(editor.getControl().getModel().getWordAtPosition(editor.getControl().getPosition()).word, 'demoInstance'); + // highlight occurrences is not trigged on the explicit position change, so move a cursor as a user + keybindings.dispatchKeyDown('ArrowRight'); + await waitForAnimation(() => hasWriteDecoration()); + + assert.isTrue(hasWriteDecoration()); + }); + + it('editor.action.goToImplementation', async function () { + const editor = await openEditor(demoFileUri); + // const demoInstance = new Demo|Class('demo'); + editor.getControl().setPosition({ lineNumber: 24, column: 30 }); + assert.equal(editor.getControl().getModel().getWordAtPosition(editor.getControl().getPosition()).word, 'DemoClass'); + + await commands.executeCommand('editor.action.goToImplementation'); + + const activeEditor = /** @type {MonacoEditor} */ MonacoEditor.get(editorManager.activeEditor); + assert.equal(activeEditor.uri.toString(), demoFileUri.toString()); + // class |DemoClass implements DemoInterface { + const { lineNumber, column } = activeEditor.getControl().getPosition(); + assert.deepEqual({ lineNumber, column }, { lineNumber: 8, column: 7 }); + assert.equal(activeEditor.getControl().getModel().getWordAtPosition({ lineNumber, column }).word, 'DemoClass'); + }); + + it('editor.action.goToTypeDefinition', async function () { + const editor = await openEditor(demoFileUri); + // const demoVariable = demo|Instance.stringField; + editor.getControl().setPosition({ lineNumber: 26, column: 26 }); + assert.equal(editor.getControl().getModel().getWordAtPosition(editor.getControl().getPosition()).word, 'demoInstance'); + + await commands.executeCommand('editor.action.goToTypeDefinition'); + + const activeEditor = /** @type {MonacoEditor} */ MonacoEditor.get(editorManager.activeEditor); + assert.equal(activeEditor.uri.toString(), demoFileUri.toString()); + // class |DemoClass implements DemoInterface { + const { lineNumber, column } = activeEditor.getControl().getPosition(); + assert.deepEqual({ lineNumber, column }, { lineNumber: 8, column: 7 }); + assert.equal(activeEditor.getControl().getModel().getWordAtPosition({ lineNumber, column }).word, 'DemoClass'); + }); + + it('run reference code lens', async function () { + const preferenceName = 'typescript.referencesCodeLens.enabled'; + const globalValue = preferences.inspect(preferenceName).globalValue; + toTearDown.push({ dispose: () => preferences.set(preferenceName, globalValue, PreferenceScope.User) }); + await preferences.set(preferenceName, false, PreferenceScope.User); + + const editor = await openEditor(demoFileUri); + + /** @type {import('@theia/monaco-editor-core/src/vs/editor/contrib/codelens/browser/codelensController').CodeLensContribution} */ + const codeLens = editor.getControl().getContribution('css.editor.codeLens'); + const codeLensNode = () => codeLens['_lenses'][0]?.['_contentWidget']?.['_domNode']; + const codeLensNodeVisible = () => { + const n = codeLensNode(); + return !!n && n.style.visibility !== 'hidden'; + }; + + assert.isFalse(codeLensNodeVisible()); + + // |interface DemoInterface { + const position = { lineNumber: 2, column: 1 }; + await preferences.set(preferenceName, true, PreferenceScope.User); + + editor.getControl().revealPosition(position); + await waitForAnimation(() => codeLensNodeVisible()); + + assert.isTrue(codeLensNodeVisible()); + const node = codeLensNode(); + assert.isDefined(node); + assert.equal(nodeAsString(node), ` +SPAN { + A { + "1 reference" + } +} +`); + const link = node.getElementsByTagName('a').item(0); + assert.isDefined(link); + link.dispatchEvent(new MouseEvent('mousedown', { bubbles: true })); + await assertPeekOpened(editor); + await closePeek(editor); + }); + + it('editor.action.quickFix', async function () { + const column = 45; + const lineNumber = 26; + const editor = await openEditor(demoFileUri); + const currentChar = () => editor.getControl().getModel().getLineContent(lineNumber).charAt(column - 1); + + editor.getControl().getModel().applyEdits([{ + range: { + startLineNumber: lineNumber, + endLineNumber: lineNumber, + startColumn: 45, + endColumn: 46 + }, + forceMoveMarkers: false, + text: '' + }]); + editor.getControl().setPosition({ lineNumber, column }); + editor.getControl().revealPosition({ lineNumber, column }); + assert.equal(currentChar(), ';', 'Failed at assert 1'); + + /** @type {import('@theia/monaco-editor-core/src/vs/editor/contrib/codeAction/browser/codeActionController').CodeActionController} */ + const codeActionController = editor.getControl().getContribution('editor.contrib.codeActionController'); + const lightBulbNode = () => { + const lightBulb = codeActionController['_lightBulbWidget'].rawValue; + return lightBulb && lightBulb['_domNode']; + }; + const lightBulbVisible = () => { + const node = lightBulbNode(); + return !!node && node.style.visibility !== 'hidden'; + }; + + await timeout(1000); // quick fix is always available: need to wait for the error fix to become available. + + await commands.executeCommand('editor.action.quickFix'); + const codeActionSelector = '.action-widget'; + assert.isFalse(!!document.querySelector(codeActionSelector), 'Failed at assert 3 - codeActionWidget should not be visible'); + + console.log('Waiting for Quick Fix widget to be visible'); + await waitForAnimation(() => { + const quickFixWidgetVisible = !!document.querySelector(codeActionSelector); + if (!quickFixWidgetVisible) { + // console.log('...'); + return false; + } + return true; + }, 10000, 'Timed-out waiting for the QuickFix widget to appear'); + await timeout(); + + assert.isTrue(lightBulbVisible(), 'Failed at assert 4'); + keybindings.dispatchKeyDown('Enter'); + console.log('Waiting for confirmation that QuickFix has taken effect'); + + await waitForAnimation(() => currentChar() === 'd', 10000, 'Failed to detect expected selected char: "d"'); + assert.equal(currentChar(), 'd', 'Failed at assert 5'); + }); + + it('editor.action.formatDocument', async function () { + const lineNumber = 5; + const editor = await openEditor(demoFileUri); + const originalLength = editor.getControl().getModel().getLineLength(lineNumber); + + // doSomething(): number; --> doSomething() : number; + editor.getControl().getModel().applyEdits([{ + range: Range.fromPositions({ lineNumber, column: 18 }, { lineNumber, column: 18 }), + forceMoveMarkers: false, + text: ' ' + }]); + + assert.equal(editor.getControl().getModel().getLineLength(lineNumber), originalLength + 1); + + await commands.executeCommand('editor.action.formatDocument'); + + assert.equal(editor.getControl().getModel().getLineLength(lineNumber), originalLength); + }); + + it('editor.action.formatSelection', async function () { + // doSomething(): number { + const lineNumber = 15; + const editor = await openEditor(demoFileUri); + const originalLength /* 28 */ = editor.getControl().getModel().getLineLength(lineNumber); + + // doSomething( ) : number { + editor.getControl().getModel().applyEdits([{ + range: Range.fromPositions({ lineNumber, column: 17 }, { lineNumber, column: 18 }), + forceMoveMarkers: false, + text: ' ) ' + }]); + + assert.equal(editor.getControl().getModel().getLineLength(lineNumber), originalLength + 4); + + // [const { Container }] = require('inversify'); + editor.getControl().setSelection({ startLineNumber: lineNumber, startColumn: 1, endLineNumber: lineNumber, endColumn: 32 }); + + await commands.executeCommand('editor.action.formatSelection'); + + // [const { Container }] = require('inversify'); + assert.equal(editor.getControl().getModel().getLineLength(lineNumber), originalLength); + }); + + it('Can execute code actions', async function () { + const editor = await openEditor(demoFileUri); + /** @type {import('@theia/monaco-editor-core/src/vs/editor/contrib/codeAction/browser/codeActionController').CodeActionController} */ + const codeActionController = editor.getControl().getContribution('editor.contrib.codeActionController'); + const isActionAvailable = () => { + const lightbulbVisibility = codeActionController['_lightBulbWidget'].rawValue?.['_domNode'].style.visibility; + return lightbulbVisibility !== undefined && lightbulbVisibility !== 'hidden'; + } + assert.strictEqual(editor.getControl().getModel().getLineContent(30), 'import { DefinedInterface } from "./demo-definitions-file";'); + editor.getControl().revealLine(30); + editor.getControl().setSelection(new Selection(30, 1, 30, 60)); + await waitForAnimation(() => isActionAvailable(), 5000, 'No code action available. (1)'); + assert.isTrue(isActionAvailable()); + + await timeout(1000) + + await commands.executeCommand('editor.action.quickFix'); + await waitForAnimation(() => { + const elements = document.querySelector('.action-widget'); + return !!elements; + }, 5000, 'No context menu appeared. (1)'); + + await timeout(); + + keybindings.dispatchKeyDown('Enter'); + + assert.isNotNull(editor.getControl()); + assert.isNotNull(editor.getControl().getModel()); + console.log(`content: ${editor.getControl().getModel().getLineContent(30)}`); + await waitForAnimation(() => editor.getControl().getModel().getLineContent(30) === 'import * as demoDefinitionsFile from "./demo-definitions-file";', 5000, 'The namespace import did not take effect :' + editor.getControl().getModel().getLineContent(30)); + + // momentarily toggle selection, waiting for code action to become unavailable. + // Without doing this, the call to the quickfix command would sometimes fail because of an + // unexpected "no code action available" pop-up, which would trip the rest of the testcase + editor.getControl().setSelection(new Selection(30, 1, 30, 1)); + console.log('waiting for code action to no longer be available'); + await waitForAnimation(() => { + if (!isActionAvailable()) { + return true; + } + editor.getControl().setSelection(new Selection(30, 1, 30, 1)); + console.log('...'); + return !isActionAvailable(); + }, 5000, 'Code action still available with no proper selection.'); + // re-establish selection + editor.getControl().setSelection(new Selection(30, 1, 30, 64)); + console.log('waiting for code action to become available again'); + await waitForAnimation(() => { + console.log('...'); + return isActionAvailable() + }, 5000, 'No code action available. (2)'); + + // Change import back: https://github.com/eclipse-theia/theia/issues/11059 + await commands.executeCommand('editor.action.quickFix'); + await waitForAnimation(() => Boolean(document.querySelector('.context-view-pointerBlock')), 5000, 'No context menu appeared. (2)'); + await timeout(); + + keybindings.dispatchKeyDown('Enter'); + + assert.isNotNull(editor.getControl()); + assert.isNotNull(editor.getControl().getModel()); + await waitForAnimation(() => editor.getControl().getModel().getLineContent(30) === 'import { DefinedInterface } from "./demo-definitions-file";', 10000, () => 'The named import did not take effect.' + editor.getControl().getModel().getLineContent(30)); + }); + + for (const referenceViewCommand of ['references-view.find', 'references-view.findImplementations']) { + it(referenceViewCommand, async function () { + let steps = 0; + const editor = await openEditor(demoFileUri); + editor.getControl().setPosition({ lineNumber: 24, column: 11 }); + assert.equal(editor.getControl().getModel().getWordAtPosition(editor.getControl().getPosition()).word, 'demoInstance'); + await commands.executeCommand(referenceViewCommand); + const view = await pluginViewRegistry.openView('references-view.tree', { reveal: true }); + const expectedMessage = referenceViewCommand === 'references-view.find' ? '2 results in 1 file' : '1 result in 1 file'; + const getResultText = () => view.node.getElementsByClassName('theia-TreeViewInfo').item(0)?.textContent; + await waitForAnimation(() => getResultText() === expectedMessage, 5000); + assert.equal(getResultText(), expectedMessage); + }); + } +}); diff --git a/examples/api-tests/src/undo-redo-selectAll.spec.js b/examples/api-tests/src/undo-redo-selectAll.spec.js new file mode 100644 index 0000000..dd91718 --- /dev/null +++ b/examples/api-tests/src/undo-redo-selectAll.spec.js @@ -0,0 +1,204 @@ +// ***************************************************************************** +// Copyright (C) 2020 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + + +// @ts-check +describe('Undo, Redo and Select All', function () { + this.timeout(5000); + + const { assert } = chai; + + const { timeout } = require('@theia/core/lib/common/promise-util'); + const { DisposableCollection } = require('@theia/core/lib/common/disposable'); + const { CommonCommands } = require('@theia/core/lib/browser/common-frontend-contribution'); + const { EditorManager } = require('@theia/editor/lib/browser/editor-manager'); + const { WorkspaceService } = require('@theia/workspace/lib/browser/workspace-service'); + const { CommandRegistry } = require('@theia/core/lib/common/command'); + const { KeybindingRegistry } = require('@theia/core/lib/browser/keybinding'); + const { FileNavigatorContribution } = require('@theia/navigator/lib/browser/navigator-contribution'); + const { ApplicationShell } = require('@theia/core/lib/browser/shell/application-shell'); + const { MonacoEditor } = require('@theia/monaco/lib/browser/monaco-editor'); + const { ScmContribution } = require('@theia/scm/lib/browser/scm-contribution'); + const { Range } = require('@theia/monaco-editor-core/esm/vs/editor/common/core/range'); + const { PreferenceService, PreferenceScope } = require('@theia/core/lib/browser'); + + const container = window.theia.container; + const editorManager = container.get(EditorManager); + const workspaceService = container.get(WorkspaceService); + const commands = container.get(CommandRegistry); + const keybindings = container.get(KeybindingRegistry); + const navigatorContribution = container.get(FileNavigatorContribution); + const shell = container.get(ApplicationShell); + const scmContribution = container.get(ScmContribution); + /** @type {PreferenceService} */ + const preferenceService = container.get(PreferenceService) + + const rootUri = workspaceService.tryGetRoots()[0].resource; + const fileUri = rootUri.resolve('webpack.config.js'); + + const toTearDown = new DisposableCollection(); + + /** + * @param {() => unknown} condition + * @param {number | undefined} [maxWait] + * @param {string | undefined} [message] + * @returns {Promise} + */ + async function waitForAnimation(condition, maxWait, message) { + if (maxWait === undefined) { + maxWait = 100000; + } + const endTime = Date.now() + maxWait; + do { + await (timeout(100)); + if (condition()) { + return true; + } + if (Date.now() > endTime) { + throw new reject(new Error(message ?? 'Wait for animation timed out.')); + } + } while (true); + } + + const originalValue = preferenceService.get('files.autoSave', undefined, rootUri.toString()); + before(async () => { + await preferenceService.set('files.autoSave', 'off', undefined, rootUri.toString()); + await preferenceService.set('git.autoRepositoryDetection', true); + await preferenceService.set('git.openRepositoryInParentFolders', 'always'); + shell.leftPanelHandler.collapse(); + }); + + beforeEach(async function () { + await scmContribution.closeView(); + await navigatorContribution.closeView(); + await editorManager.closeAll({ save: false }); + }); + + afterEach(async () => { + toTearDown.dispose(); + await scmContribution.closeView(); + await navigatorContribution.closeView(); + await editorManager.closeAll({ save: false }); + }); + + after(async () => { + await preferenceService.set('files.autoSave', originalValue, undefined, rootUri.toString()); + shell.leftPanelHandler.collapse(); + }); + + /** + * @param {import('@theia/editor/lib/browser/editor-widget').EditorWidget} widget + */ + async function assertInEditor(widget) { + const originalContent = widget.editor.document.getText(); + const editor = /** @type {MonacoEditor} */ (MonacoEditor.get(widget)); + editor.getControl().pushUndoStop(); + editor.getControl().executeEdits('test', [{ + range: new Range(1, 1, 1, 1), + text: 'A' + }]); + editor.getControl().pushUndoStop(); + + const modifiedContent = widget.editor.document.getText(); + assert.notEqual(modifiedContent, originalContent); + + keybindings.dispatchCommand(CommonCommands.UNDO.id); + await waitForAnimation(() => widget.editor.document.getText() === originalContent); + assert.equal(widget.editor.document.getText(), originalContent); + + keybindings.dispatchCommand(CommonCommands.REDO.id); + await waitForAnimation(() => widget.editor.document.getText() === modifiedContent); + assert.equal(widget.editor.document.getText(), modifiedContent); + + const originalSelection = widget.editor.selection; + keybindings.dispatchCommand(CommonCommands.SELECT_ALL.id); + await waitForAnimation(() => widget.editor.selection.end.line !== originalSelection.end.line); + assert.notDeepEqual(widget.editor.selection, originalSelection); + } + + it('in the active editor', async function () { + await navigatorContribution.openView({ activate: true }); + + const widget = await editorManager.open(fileUri, { mode: 'activate' }); + await assertInEditor(widget); + }); + + it('in the active explorer without the current editor', async function () { + await navigatorContribution.openView({ activate: true }); + + // should not throw + await commands.executeCommand(CommonCommands.UNDO.id); + await commands.executeCommand(CommonCommands.REDO.id); + await commands.executeCommand(CommonCommands.SELECT_ALL.id); + }); + + it('in the active explorer with the current editor', async function () { + const widget = await editorManager.open(fileUri, { mode: 'activate' }); + + await navigatorContribution.openView({ activate: true }); + + await assertInEditor(widget); + }); + + async function assertInScm() { + const scmInput = document.activeElement; + if (!(scmInput instanceof HTMLTextAreaElement)) { + assert.isTrue(scmInput instanceof HTMLTextAreaElement); + return; + } + + const originalValue = scmInput.value; + document.execCommand('insertText', false, 'A'); + await waitForAnimation(() => scmInput.value !== originalValue); + const modifiedValue = scmInput.value; + assert.notEqual(originalValue, modifiedValue); + + keybindings.dispatchCommand(CommonCommands.UNDO.id); + await waitForAnimation(() => scmInput.value === originalValue); + assert.equal(scmInput.value, originalValue, 'value equal'); + + keybindings.dispatchCommand(CommonCommands.REDO.id); + await waitForAnimation(() => scmInput.value === modifiedValue); + assert.equal(scmInput.value, modifiedValue, 'value not equal'); + + const selection = document.getSelection(); + if (!selection) { + assert.isDefined(selection, 'selection defined'); + return; + } + + selection.empty(); + assert.equal(selection.rangeCount, 0, 'rangeCount equal'); + + keybindings.dispatchCommand(CommonCommands.SELECT_ALL.id); + await waitForAnimation(() => !!selection.rangeCount); + assert.notEqual(selection.rangeCount, 0, 'rangeCount not equal'); + assert.isTrue(selection.containsNode(scmInput), 'selection contains'); + } + + it('in the active scm in workspace without the current editor', async function () { + await scmContribution.openView({ activate: true }); + await assertInScm(); + }); + + it('in the active scm in workspace with the current editor', async function () { + await editorManager.open(fileUri, { mode: 'activate' }); + + await scmContribution.openView({ activate: true }); + await assertInScm(); + }); + +}); diff --git a/examples/api-tests/src/views.spec.js b/examples/api-tests/src/views.spec.js new file mode 100644 index 0000000..e803cfd --- /dev/null +++ b/examples/api-tests/src/views.spec.js @@ -0,0 +1,80 @@ +// ***************************************************************************** +// Copyright (C) 2020 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + + +// @ts-check +describe('Views', function () { + this.timeout(7500); + + const { assert } = chai; + + const { timeout } = require('@theia/core/lib/common/promise-util'); + const { ApplicationShell } = require('@theia/core/lib/browser/shell/application-shell'); + const { FileNavigatorContribution } = require('@theia/navigator/lib/browser/navigator-contribution'); + const { ScmContribution } = require('@theia/scm/lib/browser/scm-contribution'); + const { OutlineViewContribution } = require('@theia/outline-view/lib/browser/outline-view-contribution'); + const { ProblemContribution } = require('@theia/markers/lib/browser/problem/problem-contribution'); + const { PropertyViewContribution } = require('@theia/property-view/lib/browser/property-view-contribution'); + const { HostedPluginSupport } = require('@theia/plugin-ext/lib/hosted/browser/hosted-plugin'); + + /** @type {import('inversify').Container} */ + const container = window['theia'].container; + const shell = container.get(ApplicationShell); + const navigatorContribution = container.get(FileNavigatorContribution); + const scmContribution = container.get(ScmContribution); + const outlineContribution = container.get(OutlineViewContribution); + const problemContribution = container.get(ProblemContribution); + const propertyViewContribution = container.get(PropertyViewContribution); + const pluginService = container.get(HostedPluginSupport); + + before(() => Promise.all([ + shell.leftPanelHandler.collapse(), + (async function () { + await pluginService.didStart; + await pluginService.activateByViewContainer('explorer'); + })() + ])); + + for (const contribution of [navigatorContribution, scmContribution, outlineContribution, problemContribution, propertyViewContribution]) { + it(`should toggle ${contribution.viewLabel}`, async function () { + let view = await contribution.closeView(); + if (view) { + assert.notEqual(shell.getAreaFor(view), contribution.defaultViewOptions.area); + assert.isFalse(view.isVisible); + assert.isTrue(view !== shell.activeWidget, `${contribution.viewLabel} !== shell.activeWidget`); + } + + view = await contribution.toggleView(); + // we can't use "equals" here because Mocha chokes on the diff for certain widgets + assert.isTrue(view !== undefined, `${contribution.viewLabel} !== undefined`); + assert.equal(shell.getAreaFor(view), contribution.defaultViewOptions.area); + assert.isDefined(shell.getTabBarFor(view)); + // @ts-ignore + assert.equal(shell.getAreaFor(shell.getTabBarFor(view)), contribution.defaultViewOptions.area); + assert.isTrue(view.isVisible); + assert.isTrue(view === shell.activeWidget, `${contribution.viewLabel} === shell.activeWidget`); + + view = await contribution.toggleView(); + await timeout(0); // seems that the "await" is not enought to guarantee that the panel is hidden + assert.notEqual(view, undefined); + assert.equal(shell.getAreaFor(view), contribution.defaultViewOptions.area); + assert.isDefined(shell.getTabBarFor(view)); + assert.isFalse(view.isVisible); + assert.isTrue(view !== shell.activeWidget, `${contribution.viewLabel} !== shell.activeWidget`); + }); + } + +}); diff --git a/examples/api-tests/test-ts-workspace/demo-definitions-file.ts b/examples/api-tests/test-ts-workspace/demo-definitions-file.ts new file mode 100644 index 0000000..f920089 --- /dev/null +++ b/examples/api-tests/test-ts-workspace/demo-definitions-file.ts @@ -0,0 +1,4 @@ + +export interface DefinedInterface { + coolField: number[]; +} diff --git a/examples/api-tests/test-ts-workspace/demo-file.ts b/examples/api-tests/test-ts-workspace/demo-file.ts new file mode 100644 index 0000000..dbb6c3e --- /dev/null +++ b/examples/api-tests/test-ts-workspace/demo-file.ts @@ -0,0 +1,32 @@ + +interface DemoInterface { + stringField: string; + numberField: number; + doSomething(): number; +} + +class DemoClass implements DemoInterface { + stringField: string; + numberField: number; + constructor(someString: string) { + this.stringField = someString; + this.numberField = this.stringField.length; + } + doSomething(): number { + let output = 0; + for (let i = 0; i < this.stringField.length; i++) { + output += this.stringField.charCodeAt(i); + } + return output; + } +} + +const demoInstance = new DemoClass('demo'); + +const demoVariable = demoInstance.stringField; + +demoVariable.concat('-string'); + +import { DefinedInterface } from "./demo-definitions-file"; + +const bar: DefinedInterface = { coolField: [] }; diff --git a/examples/api-tests/test-ts-workspace/tsconfig.json b/examples/api-tests/test-ts-workspace/tsconfig.json new file mode 100644 index 0000000..30aed93 --- /dev/null +++ b/examples/api-tests/test-ts-workspace/tsconfig.json @@ -0,0 +1,30 @@ +{ + "$schema": "https://json.schemastore.org/tsconfig", + "compilerOptions": { + "skipLibCheck": true, + "declaration": true, + "declarationMap": true, + "noImplicitAny": true, + "noImplicitOverride": true, + "noEmitOnError": false, + "noImplicitThis": true, + "noUnusedLocals": true, + "strictNullChecks": true, + "experimentalDecorators": true, + "emitDecoratorMetadata": true, + "importHelpers": true, + "downlevelIteration": true, + "resolveJsonModule": true, + "useDefineForClassFields": false, + "module": "CommonJS", + "moduleResolution": "Node", + "target": "ES2023", + "jsx": "react", + "lib": [ + "ES2023", + "DOM", + "DOM.AsyncIterable" + ], + "sourceMap": true + } +} diff --git a/examples/browser-only/package.json b/examples/browser-only/package.json new file mode 100644 index 0000000..bc41f4c --- /dev/null +++ b/examples/browser-only/package.json @@ -0,0 +1,89 @@ +{ + "private": true, + "name": "@theia/example-browser-only", + "version": "1.68.0", + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "theia": { + "target": "browser-only", + "frontend": { + "config": { + "applicationName": "Theia Browser-Only Example", + "preferences": { + "files.enableTrash": false + } + } + } + }, + "dependencies": { + "@theia/ai-chat": "1.68.0", + "@theia/ai-chat-ui": "1.68.0", + "@theia/ai-code-completion": "1.68.0", + "@theia/ai-core": "1.68.0", + "@theia/ai-core-ui": "1.68.0", + "@theia/ai-history": "1.68.0", + "@theia/ai-ollama": "1.68.0", + "@theia/ai-openai": "1.68.0", + "@theia/ai-scanoss": "1.68.0", + "@theia/api-samples": "1.68.0", + "@theia/bulk-edit": "1.68.0", + "@theia/callhierarchy": "1.68.0", + "@theia/collaboration": "1.68.0", + "@theia/console": "1.68.0", + "@theia/core": "1.68.0", + "@theia/debug": "1.68.0", + "@theia/editor": "1.68.0", + "@theia/editor-preview": "1.68.0", + "@theia/file-search": "1.68.0", + "@theia/filesystem": "1.68.0", + "@theia/getting-started": "1.68.0", + "@theia/git": "1.68.0", + "@theia/keymaps": "1.68.0", + "@theia/markers": "1.68.0", + "@theia/memory-inspector": "1.68.0", + "@theia/messages": "1.68.0", + "@theia/metrics": "1.68.0", + "@theia/mini-browser": "1.68.0", + "@theia/monaco": "1.68.0", + "@theia/navigator": "1.68.0", + "@theia/outline-view": "1.68.0", + "@theia/output": "1.68.0", + "@theia/plugin-dev": "1.68.0", + "@theia/plugin-ext": "1.68.0", + "@theia/plugin-ext-vscode": "1.68.0", + "@theia/plugin-metrics": "1.68.0", + "@theia/preferences": "1.68.0", + "@theia/preview": "1.68.0", + "@theia/process": "1.68.0", + "@theia/property-view": "1.68.0", + "@theia/scanoss": "1.68.0", + "@theia/scm": "1.68.0", + "@theia/scm-extra": "1.68.0", + "@theia/search-in-workspace": "1.68.0", + "@theia/secondary-window": "1.68.0", + "@theia/task": "1.68.0", + "@theia/terminal": "1.68.0", + "@theia/timeline": "1.68.0", + "@theia/toolbar": "1.68.0", + "@theia/typehierarchy": "1.68.0", + "@theia/userstorage": "1.68.0", + "@theia/variable-resolver": "1.68.0", + "@theia/vsx-registry": "1.68.0", + "@theia/workspace": "1.68.0" + }, + "scripts": { + "prepare:no-native": "lerna run prepare --scope=\"@theia/re-exports\" && lerna run generate-theia-re-exports --scope=\"@theia/core\"", + "clean": "theiaext clean", + "build": "theiaext build && npm run -s bundle", + "bundle": "theia build --mode development", + "compile": "theiaext compile", + "start": "theia start", + "start:debug": "npm run -s start -- --log-level=debug", + "start:watch": "concurrently --kill-others -n tsc,bundle,run -c red,yellow,green \"tsc -b -w --preserveWatchOutput\" \"npm run -s watch:bundle\" \"npm run -s start\"", + "watch": "concurrently --kill-others -n tsc,bundle -c red,yellow \"tsc -b -w --preserveWatchOutput\" \"npm run -s watch:bundle\"", + "watch:bundle": "theia build --watch --mode development", + "watch:compile": "tsc -b -w" + }, + "devDependencies": { + "@theia/cli": "1.68.0" + } +} diff --git a/examples/browser-only/tsconfig.json b/examples/browser-only/tsconfig.json new file mode 100644 index 0000000..a2bebce --- /dev/null +++ b/examples/browser-only/tsconfig.json @@ -0,0 +1,174 @@ +{ + "extends": "../../configs/base.tsconfig", + "include": [], + "compilerOptions": { + "composite": true + }, + "references": [ + { + "path": "../../dev-packages/cli" + }, + { + "path": "../../packages/ai-chat" + }, + { + "path": "../../packages/ai-chat-ui" + }, + { + "path": "../../packages/ai-code-completion" + }, + { + "path": "../../packages/ai-core" + }, + { + "path": "../../packages/ai-core-ui" + }, + { + "path": "../../packages/ai-history" + }, + { + "path": "../../packages/ai-ollama" + }, + { + "path": "../../packages/ai-openai" + }, + { + "path": "../../packages/ai-scanoss" + }, + { + "path": "../../packages/bulk-edit" + }, + { + "path": "../../packages/callhierarchy" + }, + { + "path": "../../packages/collaboration" + }, + { + "path": "../../packages/console" + }, + { + "path": "../../packages/core" + }, + { + "path": "../../packages/debug" + }, + { + "path": "../../packages/editor" + }, + { + "path": "../../packages/editor-preview" + }, + { + "path": "../../packages/file-search" + }, + { + "path": "../../packages/filesystem" + }, + { + "path": "../../packages/getting-started" + }, + { + "path": "../../packages/git" + }, + { + "path": "../../packages/keymaps" + }, + { + "path": "../../packages/markers" + }, + { + "path": "../../packages/memory-inspector" + }, + { + "path": "../../packages/messages" + }, + { + "path": "../../packages/metrics" + }, + { + "path": "../../packages/mini-browser" + }, + { + "path": "../../packages/monaco" + }, + { + "path": "../../packages/navigator" + }, + { + "path": "../../packages/outline-view" + }, + { + "path": "../../packages/output" + }, + { + "path": "../../packages/plugin-dev" + }, + { + "path": "../../packages/plugin-ext" + }, + { + "path": "../../packages/plugin-ext-vscode" + }, + { + "path": "../../packages/plugin-metrics" + }, + { + "path": "../../packages/preferences" + }, + { + "path": "../../packages/preview" + }, + { + "path": "../../packages/process" + }, + { + "path": "../../packages/property-view" + }, + { + "path": "../../packages/scanoss" + }, + { + "path": "../../packages/scm" + }, + { + "path": "../../packages/scm-extra" + }, + { + "path": "../../packages/search-in-workspace" + }, + { + "path": "../../packages/secondary-window" + }, + { + "path": "../../packages/task" + }, + { + "path": "../../packages/terminal" + }, + { + "path": "../../packages/timeline" + }, + { + "path": "../../packages/toolbar" + }, + { + "path": "../../packages/typehierarchy" + }, + { + "path": "../../packages/userstorage" + }, + { + "path": "../../packages/variable-resolver" + }, + { + "path": "../../packages/vsx-registry" + }, + { + "path": "../../packages/workspace" + }, + { + "path": "../api-samples.disabled" + } + ] +} diff --git a/examples/browser-only/webpack.config.js b/examples/browser-only/webpack.config.js new file mode 100644 index 0000000..40e4ee9 --- /dev/null +++ b/examples/browser-only/webpack.config.js @@ -0,0 +1,18 @@ +/** + * This file can be edited to customize webpack configuration. + * To reset delete this file and rerun theia build again. + */ +// @ts-check +const configs = require('./gen-webpack.config.js'); + + +/** + * Expose bundled modules on window.theia.moduleName namespace, e.g. + * window['theia']['@theia/core/lib/common/uri']. + * Such syntax can be used by external code, for instance, for testing. +configs[0].module.rules.push({ + test: /\.js$/, + loader: require.resolve('@theia/application-manager/lib/expose-loader') +}); */ + +module.exports = configs; diff --git a/examples/browser/.theia/settings.json b/examples/browser/.theia/settings.json new file mode 100644 index 0000000..005b2dd --- /dev/null +++ b/examples/browser/.theia/settings.json @@ -0,0 +1,7 @@ +{ + "files.autoSave": "afterDelay", + "workbench.editor.closeOnFileDelete": true, + "git.autoRepositoryDetection": true, + "git.openRepositoryInParentFolders": "always" +} + diff --git a/examples/browser/.theia/tasks.json b/examples/browser/.theia/tasks.json new file mode 100644 index 0000000..b37b3b4 --- /dev/null +++ b/examples/browser/.theia/tasks.json @@ -0,0 +1,3 @@ +{ + "tasks": [] +} diff --git a/examples/browser/package.json b/examples/browser/package.json new file mode 100644 index 0000000..b42eca9 --- /dev/null +++ b/examples/browser/package.json @@ -0,0 +1,120 @@ +{ + "private": true, + "name": "@theia/example-browser", + "version": "1.68.0", + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "theia": { + "frontend": { + "config": { + "applicationName": "Vibn IDE", + "preferences": { + "files.enableTrash": false, + "security.workspace.trust.enabled": false + }, + "reloadOnReconnect": true + } + }, + "backend": { + "config": { + "frontendConnectionTimeout": 30000 + } + } + }, + "theiaPluginsDir": "../../plugins", + "dependencies": { + "@theia/ai-anthropic": "1.68.0", + "@theia/ai-chat": "1.68.0", + "@theia/ai-chat-ui": "1.68.0", + "@theia/ai-claude-code": "1.68.0", + "@theia/ai-code-completion": "1.68.0", + "@theia/ai-codex": "1.68.0", + "@theia/ai-copilot": "1.68.0", + "@theia/ai-core": "1.68.0", + "@theia/ai-core-ui": "1.68.0", + "@theia/ai-editor": "1.68.0", + "@theia/ai-google": "1.68.0", + "@theia/ai-history": "1.68.0", + "@theia/ai-ide": "1.68.0", + "@theia/ai-huggingface": "1.68.0", + "@theia/ai-llamafile": "1.68.0", + "@theia/ai-ollama": "1.68.0", + "@theia/ai-openai": "1.68.0", + "@theia/ai-scanoss": "1.68.0", + "@theia/ai-terminal": "1.68.0", + "@theia/api-provider-sample": "1.68.0", + "@theia/bulk-edit": "1.68.0", + "@theia/callhierarchy": "1.68.0", + "@theia/collaboration": "1.68.0", + "@theia/console": "1.68.0", + "@theia/core": "1.68.0", + "@theia/debug": "1.68.0", + "@theia/design-panel": "1.68.0", + "@theia/dev-container": "1.68.0", + "@theia/editor": "1.68.0", + "@theia/editor-preview": "1.68.0", + "@theia/file-search": "1.68.0", + "@theia/filesystem": "1.68.0", + "@theia/getting-started": "1.68.0", + "@theia/keymaps": "1.68.0", + "@theia/markers": "1.68.0", + "@theia/memory-inspector": "1.68.0", + "@theia/messages": "1.68.0", + "@theia/metrics": "1.68.0", + "@theia/mini-browser": "1.68.0", + "@theia/monaco": "1.68.0", + "@theia/navigator": "1.68.0", + "@theia/notebook": "1.68.0", + "@theia/outline-view": "1.68.0", + "@theia/output": "1.68.0", + "@theia/plugin-dev": "1.68.0", + "@theia/plugin-ext": "1.68.0", + "@theia/plugin-ext-headless": "1.68.0", + "@theia/plugin-ext-vscode": "1.68.0", + "@theia/plugin-metrics": "1.68.0", + "@theia/preferences": "1.68.0", + "@theia/preview": "1.68.0", + "@theia/process": "1.68.0", + "@theia/property-view": "1.68.0", + "@theia/remote": "1.68.0", + "@theia/scanoss": "1.68.0", + "@theia/scm": "1.68.0", + "@theia/scm-extra": "1.68.0", + "@theia/search-in-workspace": "1.68.0", + "@theia/secondary-window": "1.68.0", + "@theia/task": "1.68.0", + "@theia/terminal": "1.68.0", + "@theia/terminal-manager": "1.68.0", + "@theia/test": "1.68.0", + "@theia/timeline": "1.68.0", + "@theia/toolbar": "1.68.0", + "@theia/typehierarchy": "1.68.0", + "@theia/userstorage": "1.68.0", + "@theia/variable-resolver": "1.68.0", + "@theia/vsx-registry": "1.68.0", + "@theia/workspace": "1.68.0" + }, + "scripts": { + "clean": "theiaext clean", + "build": "theiaext build && npm run -s bundle", + "build:production": "theiaext build && npm run -s bundle:production", + "bundle": "npm run rebuild && theia build --mode development", + "bundle:production": "npm run rebuild && theia build --mode production", + "compile": "tsc -b", + "coverage": "npm run -s test -- --test-coverage && npm run -s coverage:report", + "coverage:clean": "rimraf .nyc_output && rimraf coverage", + "coverage:report": "nyc report --reporter=html", + "rebuild": "theia rebuild:browser --cacheRoot ../..", + "start": "theia start --plugins=local-dir:../../plugins --ovsx-router-config=../ovsx-router-config.json", + "start:debug": "npm run -s start -- --log-level=debug", + "start:watch": "concurrently --kill-others -n tsc,bundle,run -c red,yellow,green \"tsc -b -w --preserveWatchOutput\" \"npm run -s watch:bundle\" \"npm run -s start\"", + "test": "theia test . --plugins=local-dir:../../plugins --test-spec=../api-tests/**/*.spec.js", + "test:debug": "npm run -s test -- --test-inspect", + "watch": "concurrently --kill-others -n tsc,bundle -c red,yellow \"tsc -b -w --preserveWatchOutput\" \"npm run -s watch:bundle\"", + "watch:bundle": "theia build --watch --mode development", + "watch:compile": "tsc -b -w" + }, + "devDependencies": { + "@theia/cli": "1.68.0", + "@theia/native-webpack-plugin": "1.68.0" + } +} diff --git a/examples/browser/tsconfig.json b/examples/browser/tsconfig.json new file mode 100644 index 0000000..4dba4d8 --- /dev/null +++ b/examples/browser/tsconfig.json @@ -0,0 +1,225 @@ +{ + "extends": "../../configs/base.tsconfig", + "include": [], + "compilerOptions": { + "composite": true + }, + "references": [ + { + "path": "../../dev-packages/cli" + }, + { + "path": "../../dev-packages/native-webpack-plugin" + }, + { + "path": "../../packages/ai-anthropic" + }, + { + "path": "../../packages/ai-chat" + }, + { + "path": "../../packages/ai-chat-ui" + }, + { + "path": "../../packages/ai-claude-code" + }, + { + "path": "../../packages/ai-code-completion" + }, + { + "path": "../../packages/ai-codex" + }, + { + "path": "../../packages/ai-copilot" + }, + { + "path": "../../packages/ai-core" + }, + { + "path": "../../packages/ai-core-ui" + }, + { + "path": "../../packages/ai-editor" + }, + { + "path": "../../packages/ai-google" + }, + { + "path": "../../packages/ai-history" + }, + { + "path": "../../packages/ai-hugging-face" + }, + { + "path": "../../packages/ai-ide" + }, + { + "path": "../../packages/ai-llamafile" + }, + { + "path": "../../packages/ai-ollama" + }, + { + "path": "../../packages/ai-openai" + }, + { + "path": "../../packages/ai-scanoss" + }, + { + "path": "../../packages/ai-terminal" + }, + { + "path": "../../packages/bulk-edit" + }, + { + "path": "../../packages/callhierarchy" + }, + { + "path": "../../packages/collaboration" + }, + { + "path": "../../packages/console" + }, + { + "path": "../../packages/core" + }, + { + "path": "../../packages/debug" + }, + { + "path": "../../packages/design-panel" + }, + { + "path": "../../packages/dev-container" + }, + { + "path": "../../packages/editor" + }, + { + "path": "../../packages/editor-preview" + }, + { + "path": "../../packages/file-search" + }, + { + "path": "../../packages/filesystem" + }, + { + "path": "../../packages/getting-started" + }, + { + "path": "../../packages/keymaps" + }, + { + "path": "../../packages/markers" + }, + { + "path": "../../packages/memory-inspector" + }, + { + "path": "../../packages/messages" + }, + { + "path": "../../packages/metrics" + }, + { + "path": "../../packages/mini-browser" + }, + { + "path": "../../packages/monaco" + }, + { + "path": "../../packages/navigator" + }, + { + "path": "../../packages/notebook" + }, + { + "path": "../../packages/outline-view" + }, + { + "path": "../../packages/output" + }, + { + "path": "../../packages/plugin-dev" + }, + { + "path": "../../packages/plugin-ext" + }, + { + "path": "../../packages/plugin-ext-headless" + }, + { + "path": "../../packages/plugin-ext-vscode" + }, + { + "path": "../../packages/plugin-metrics" + }, + { + "path": "../../packages/preferences" + }, + { + "path": "../../packages/preview" + }, + { + "path": "../../packages/process" + }, + { + "path": "../../packages/property-view" + }, + { + "path": "../../packages/remote" + }, + { + "path": "../../packages/scanoss" + }, + { + "path": "../../packages/scm" + }, + { + "path": "../../packages/scm-extra" + }, + { + "path": "../../packages/search-in-workspace" + }, + { + "path": "../../packages/secondary-window" + }, + { + "path": "../../packages/task" + }, + { + "path": "../../packages/terminal" + }, + { + "path": "../../packages/terminal-manager" + }, + { + "path": "../../packages/test" + }, + { + "path": "../../packages/timeline" + }, + { + "path": "../../packages/toolbar" + }, + { + "path": "../../packages/typehierarchy" + }, + { + "path": "../../packages/userstorage" + }, + { + "path": "../../packages/variable-resolver" + }, + { + "path": "../../packages/vsx-registry" + }, + { + "path": "../../packages/workspace" + }, + { + "path": "../api-provider-sample" + } + ] +} diff --git a/examples/browser/vibn.css b/examples/browser/vibn.css new file mode 100644 index 0000000..85e5f98 --- /dev/null +++ b/examples/browser/vibn.css @@ -0,0 +1,44 @@ +/* ============================================================ + vibn.css — custom UI overrides for Vibn IDE + Loaded via in index.html. Edit here; hard-refresh + (Cmd+Shift+R) to see changes without a webpack rebuild. + ============================================================ */ + +/* Hide the right sidebar icon strip (tab bar + sidebar menu) + but keep the chat panel itself visible */ +#theia-right-content-panel > .theia-app-sidebar-container { + display: none !important; + width: 0 !important; + min-width: 0 !important; +} + +/* Default right panel open width */ +#theia-right-content-panel { + width: 300px !important; + min-width: 300px !important; +} + +/* Hide the chat welcome screen content */ +.theia-WelcomeMessage-Logo, +.theia-WelcomeMessage-Content, +.theia-WelcomeMessage-RecommendedNote, +.theia-WelcomeMessage-AgentButtons, +.theia-WelcomeMessage-AlternativeOptions, +.theia-WelcomeMessage-OrDivider, +.theia-WelcomeMessage-AgentSelection, +.theia-alert-message-container { + display: none !important; +} + +/* Hide the "Keep chats short and focused" suggestion banner */ +.chat-agent-suggestion { + display: none !important; +} + +/* Hide specific chat toolbar buttons */ +#chat-view\.ai-chat-summary-current-session, +#extract-widget, +#chat\:widget\:lock, +#chat\:widget\:session-settings { + display: none !important; +} diff --git a/examples/browser/webpack.config.js b/examples/browser/webpack.config.js new file mode 100644 index 0000000..d9b2cf5 --- /dev/null +++ b/examples/browser/webpack.config.js @@ -0,0 +1,67 @@ +/** + * This file can be edited to customize webpack configuration. + * To reset delete this file and rerun theia build again. + */ +// @ts-check +const path = require('path'); +const CopyWebpackPlugin = require('copy-webpack-plugin'); +const configs = require('./gen-webpack.config.js'); +const nodeConfig = require('./gen-webpack.node.config.js'); +const webpack = require('webpack'); + +/** + * Expose bundled modules on window.theia.moduleName namespace, e.g. + * window['theia']['@theia/core/lib/common/uri']. + * Such syntax can be used by external code, for instance, for testing. + */ +configs[0].module.rules.push({ + test: /\.js$/, + loader: require.resolve('@theia/application-manager/lib/expose-loader') +}); + +/** + * Inject environment variables into the browser bundle + * These are needed by ai-ide preferences to read default values + */ +configs[0].plugins.push( + new webpack.DefinePlugin({ + 'process.env.GITEA_API_URL': JSON.stringify(process.env.GITEA_API_URL || ''), + 'process.env.GITEA_API_TOKEN': JSON.stringify(process.env.GITEA_API_TOKEN || ''), + 'process.env.GITEA_USERNAME': JSON.stringify(process.env.GITEA_USERNAME || ''), + 'process.env.COOLIFY_API_URL': JSON.stringify(process.env.COOLIFY_API_URL || ''), + 'process.env.COOLIFY_API_TOKEN': JSON.stringify(process.env.COOLIFY_API_TOKEN || ''), + 'process.env.GOOGLE_API_KEY': JSON.stringify(process.env.GOOGLE_API_KEY || ''), + }) +); + +// Copy vibn.css and the customised index.html into lib/frontend/ on every build +configs[0].plugins.push( + new CopyWebpackPlugin({ + patterns: [ + { + from: path.resolve(__dirname, 'vibn.css'), + to: path.resolve(__dirname, 'lib', 'frontend', 'vibn.css'), + }, + { + from: path.resolve(__dirname, 'src-gen/frontend/index.html'), + to: path.resolve(__dirname, 'lib', 'frontend', 'index.html'), + }, + ] + }) +); + +// Disable source maps and compression to keep memory under 2GB for local builds +// Source maps alone can double webpack's peak memory usage +if (process.env.THEIA_LOCAL_BUILD) { + configs[0].devtool = false; + configs[0].cache = false; + // Remove CompressionPlugin — it holds all output in memory to gzip it + configs[0].plugins = configs[0].plugins.filter( + p => p.constructor.name !== 'CompressionPlugin' + ); +} + +module.exports = [ + ...configs, + nodeConfig.config +]; diff --git a/examples/electron/.eslintrc.js b/examples/electron/.eslintrc.js new file mode 100644 index 0000000..1308994 --- /dev/null +++ b/examples/electron/.eslintrc.js @@ -0,0 +1,10 @@ +/** @type {import('eslint').Linter.Config} */ +module.exports = { + extends: [ + '../../configs/build.eslintrc.json' + ], + parserOptions: { + tsconfigRootDir: __dirname, + project: 'tsconfig.json' + } +}; diff --git a/examples/electron/electron-builder.yml b/examples/electron/electron-builder.yml new file mode 100644 index 0000000..d016600 --- /dev/null +++ b/examples/electron/electron-builder.yml @@ -0,0 +1,49 @@ +appId: com.yourcompany.product-os +productName: Product OS + +publish: + provider: github + owner: YOUR_GITHUB_USERNAME + repo: product-os + +directories: + output: dist + buildResources: resources + +mac: + category: public.app-category.developer-tools + icon: resources/icon.icns + target: + - dmg + - zip + darkModeSupport: true + hardenedRuntime: true + gatekeeperAssess: false + entitlements: resources/entitlements.mac.plist + entitlementsInherit: resources/entitlements.mac.plist + +dmg: + contents: + - x: 410 + y: 150 + type: link + path: /Applications + - x: 130 + y: 150 + type: file + +files: + - "!**/*.map" + - from: . + to: . + filter: + - package.json + - lib/**/* + - node_modules/**/* + - src-gen/**/* + +extraResources: + - from: resources + to: resources + filter: + - "**/*" diff --git a/examples/electron/package.json b/examples/electron/package.json new file mode 100644 index 0000000..515fd57 --- /dev/null +++ b/examples/electron/package.json @@ -0,0 +1,123 @@ +{ + "private": true, + "name": "@theia/example-electron", + "productName": "Theia Electron Example", + "version": "1.68.0", + "main": "lib/backend/electron-main.js", + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "theia": { + "target": "electron", + "frontend": { + "config": { + "applicationName": "Theia Electron Example", + "reloadOnReconnect": true, + "electron": { + "splashScreenOptions": { + "content": "resources/theia-logo.svg", + "height": 90 + } + } + } + }, + "backend": { + "config": { + "frontendConnectionTimeout": -1 + } + } + }, + "dependencies": { + "@theia/ai-anthropic": "1.68.0", + "@theia/ai-chat": "1.68.0", + "@theia/ai-chat-ui": "1.68.0", + "@theia/ai-claude-code": "1.68.0", + "@theia/ai-code-completion": "1.68.0", + "@theia/ai-codex": "1.68.0", + "@theia/ai-copilot": "1.68.0", + "@theia/ai-core": "1.68.0", + "@theia/ai-core-ui": "1.68.0", + "@theia/ai-editor": "1.68.0", + "@theia/ai-google": "1.68.0", + "@theia/ai-history": "1.68.0", + "@theia/ai-huggingface": "1.68.0", + "@theia/ai-llamafile": "1.68.0", + "@theia/ai-ollama": "1.68.0", + "@theia/ai-openai": "1.68.0", + "@theia/ai-scanoss": "1.68.0", + "@theia/ai-terminal": "1.68.0", + "@theia/api-provider-sample": "1.68.0", + "@theia/bulk-edit": "1.68.0", + "@theia/callhierarchy": "1.68.0", + "@theia/collaboration": "1.68.0", + "@theia/console": "1.68.0", + "@theia/core": "1.68.0", + "@theia/debug": "1.68.0", + "@theia/dev-container": "1.68.0", + "@theia/editor": "1.68.0", + "@theia/editor-preview": "1.68.0", + "@theia/electron": "1.68.0", + "@theia/external-terminal": "1.68.0", + "@theia/file-search": "1.68.0", + "@theia/filesystem": "1.68.0", + "@theia/getting-started": "1.68.0", + "@theia/keymaps": "1.68.0", + "@theia/markers": "1.68.0", + "@theia/memory-inspector": "1.68.0", + "@theia/messages": "1.68.0", + "@theia/metrics": "1.68.0", + "@theia/mini-browser": "1.68.0", + "@theia/monaco": "1.68.0", + "@theia/navigator": "1.68.0", + "@theia/outline-view": "1.68.0", + "@theia/output": "1.68.0", + "@theia/plugin-dev": "1.68.0", + "@theia/plugin-ext": "1.68.0", + "@theia/plugin-ext-headless": "1.68.0", + "@theia/plugin-ext-vscode": "1.68.0", + "@theia/preferences": "1.68.0", + "@theia/preview": "1.68.0", + "@theia/process": "1.68.0", + "@theia/property-view": "1.68.0", + "@theia/remote": "1.68.0", + "@theia/remote-wsl": "1.68.0", + "@theia/scanoss": "1.68.0", + "@theia/scm": "1.68.0", + "@theia/scm-extra": "1.68.0", + "@theia/search-in-workspace": "1.68.0", + "@theia/secondary-window": "1.68.0", + "@theia/task": "1.68.0", + "@theia/terminal": "1.68.0", + "@theia/terminal-manager": "1.68.0", + "@theia/timeline": "1.68.0", + "@theia/toolbar": "1.68.0", + "@theia/typehierarchy": "1.68.0", + "@theia/userstorage": "1.68.0", + "@theia/variable-resolver": "1.68.0", + "@theia/vsx-registry": "1.68.0", + "@theia/workspace": "1.68.0" + }, + "scripts": { + "build": "theiaext build && npm run -s bundle", + "bundle": "npm run rebuild && theia build --mode development", + "bundle:production": "npm run rebuild && theia build --mode production", + "clean": "theiaext clean", + "compile": "tsc -b", + "lint": "theiaext lint", + "rebuild": "theia rebuild:electron --cacheRoot ../..", + "start": "theia start --plugins=local-dir:../../plugins --ovsx-router-config=../ovsx-router-config.json", + "start:debug": "npm run -s start -- --log-level=debug --remote-debugging-port=9222", + "start:watch": "concurrently --kill-others -n tsc,bundle,run -c red,yellow,green \"tsc -b -w --preserveWatchOutput\" \"npm run -s watch:bundle\" \"npm run -s start\"", + "test": "electron-mocha --timeout 60000 \"./lib/test/**/*.espec.js\"", + "watch": "concurrently --kill-others -n tsc,bundle -c red,blue \"tsc -b -w --preserveWatchOutput\" \"npm run -s watch:bundle\"", + "watch:bundle": "theia build --watch --mode development", + "watch:compile": "tsc -b -w", + "package": "npm run bundle:production && electron-builder", + "package:mac": "npm run bundle:production && electron-builder --mac", + "publish": "npm run bundle:production && electron-builder --mac --publish always", + "release": "npm run bundle:production && electron-builder --mac --publish always" + }, + "devDependencies": { + "@theia/cli": "1.68.0", + "electron": "38.4.0", + "electron-builder": "^25.1.8" + } +} diff --git a/examples/electron/resources/entitlements.mac.plist b/examples/electron/resources/entitlements.mac.plist new file mode 100644 index 0000000..adf9697 --- /dev/null +++ b/examples/electron/resources/entitlements.mac.plist @@ -0,0 +1,16 @@ + + + + + com.apple.security.cs.allow-jit + + com.apple.security.cs.allow-unsigned-executable-memory + + com.apple.security.cs.allow-dyld-environment-variables + + com.apple.security.device.camera + + com.apple.security.device.microphone + + + diff --git a/examples/electron/resources/theia-logo.svg b/examples/electron/resources/theia-logo.svg new file mode 100644 index 0000000..8d6b150 --- /dev/null +++ b/examples/electron/resources/theia-logo.svg @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + diff --git a/examples/electron/test/basic-example.espec.ts b/examples/electron/test/basic-example.espec.ts new file mode 100644 index 0000000..3e84886 --- /dev/null +++ b/examples/electron/test/basic-example.espec.ts @@ -0,0 +1,42 @@ +// ***************************************************************************** +// Copyright (C) 2017 Ericsson and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import * as chai from 'chai'; +import * as path from 'path'; +import { app, BrowserWindow } from 'electron'; + +const expect = chai.expect; + +describe.skip('basic-example-spec', () => { + + const mainWindow: Electron.BrowserWindow = new BrowserWindow({ show: false }); + mainWindow.on('ready-to-show', () => mainWindow.show()); + + describe('01 #start example app', () => { + it('should start the electron example app', async () => { + if (!app.isReady()) { + await new Promise(resolve => app.on('ready', resolve)); + } + + require('../src-gen/backend/main'); // start the express server + + mainWindow.webContents.openDevTools(); + mainWindow.loadURL(`file://${path.join(__dirname, 'index.html')}`); + + expect(mainWindow.isVisible()).to.be.true; + }); + }); +}); diff --git a/examples/electron/tsconfig.json b/examples/electron/tsconfig.json new file mode 100644 index 0000000..e80fec1 --- /dev/null +++ b/examples/electron/tsconfig.json @@ -0,0 +1,216 @@ +{ + "extends": "../../configs/base.tsconfig", + "compilerOptions": { + "composite": true, + "outDir": "lib/test" + }, + "include": [ + "test" + ], + "references": [ + { + "path": "../../dev-packages/cli" + }, + { + "path": "../../packages/ai-anthropic" + }, + { + "path": "../../packages/ai-chat" + }, + { + "path": "../../packages/ai-chat-ui" + }, + { + "path": "../../packages/ai-claude-code" + }, + { + "path": "../../packages/ai-code-completion" + }, + { + "path": "../../packages/ai-codex" + }, + { + "path": "../../packages/ai-copilot" + }, + { + "path": "../../packages/ai-core" + }, + { + "path": "../../packages/ai-core-ui" + }, + { + "path": "../../packages/ai-editor" + }, + { + "path": "../../packages/ai-google" + }, + { + "path": "../../packages/ai-history" + }, + { + "path": "../../packages/ai-hugging-face" + }, + { + "path": "../../packages/ai-llamafile" + }, + { + "path": "../../packages/ai-ollama" + }, + { + "path": "../../packages/ai-openai" + }, + { + "path": "../../packages/ai-scanoss" + }, + { + "path": "../../packages/ai-terminal" + }, + { + "path": "../../packages/bulk-edit" + }, + { + "path": "../../packages/callhierarchy" + }, + { + "path": "../../packages/collaboration" + }, + { + "path": "../../packages/console" + }, + { + "path": "../../packages/core" + }, + { + "path": "../../packages/debug" + }, + { + "path": "../../packages/dev-container" + }, + { + "path": "../../packages/editor" + }, + { + "path": "../../packages/editor-preview" + }, + { + "path": "../../packages/external-terminal" + }, + { + "path": "../../packages/file-search" + }, + { + "path": "../../packages/filesystem" + }, + { + "path": "../../packages/getting-started" + }, + { + "path": "../../packages/keymaps" + }, + { + "path": "../../packages/markers" + }, + { + "path": "../../packages/memory-inspector" + }, + { + "path": "../../packages/messages" + }, + { + "path": "../../packages/metrics" + }, + { + "path": "../../packages/mini-browser" + }, + { + "path": "../../packages/monaco" + }, + { + "path": "../../packages/navigator" + }, + { + "path": "../../packages/outline-view" + }, + { + "path": "../../packages/output" + }, + { + "path": "../../packages/plugin-dev" + }, + { + "path": "../../packages/plugin-ext" + }, + { + "path": "../../packages/plugin-ext-headless" + }, + { + "path": "../../packages/plugin-ext-vscode" + }, + { + "path": "../../packages/preferences" + }, + { + "path": "../../packages/preview" + }, + { + "path": "../../packages/process" + }, + { + "path": "../../packages/property-view" + }, + { + "path": "../../packages/remote" + }, + { + "path": "../../packages/remote-wsl" + }, + { + "path": "../../packages/scanoss" + }, + { + "path": "../../packages/scm" + }, + { + "path": "../../packages/scm-extra" + }, + { + "path": "../../packages/search-in-workspace" + }, + { + "path": "../../packages/secondary-window" + }, + { + "path": "../../packages/task" + }, + { + "path": "../../packages/terminal" + }, + { + "path": "../../packages/terminal-manager" + }, + { + "path": "../../packages/timeline" + }, + { + "path": "../../packages/toolbar" + }, + { + "path": "../../packages/typehierarchy" + }, + { + "path": "../../packages/userstorage" + }, + { + "path": "../../packages/variable-resolver" + }, + { + "path": "../../packages/vsx-registry" + }, + { + "path": "../../packages/workspace" + }, + { + "path": "../api-provider-sample" + } + ] +} diff --git a/examples/electron/webpack.config.js b/examples/electron/webpack.config.js new file mode 100644 index 0000000..fb14cca --- /dev/null +++ b/examples/electron/webpack.config.js @@ -0,0 +1,23 @@ +/** + * This file can be edited to customize webpack configuration. + * To reset delete this file and rerun theia build again. + */ +// @ts-check +const configs = require('./gen-webpack.config.js'); +const nodeConfig = require('./gen-webpack.node.config.js'); + +/** + * Expose bundled modules on window.theia.moduleName namespace, e.g. + * window['theia']['@theia/core/lib/common/uri']. + * Such syntax can be used by external code, for instance, for testing. + */ +configs[0].module.rules.push({ + test: /\.js$/, + loader: require.resolve('@theia/application-manager/lib/expose-loader') +}); + + +module.exports = [ + ...configs, + nodeConfig.config +]; diff --git a/examples/ovsx-router-config.json b/examples/ovsx-router-config.json new file mode 100644 index 0000000..da597b1 --- /dev/null +++ b/examples/ovsx-router-config.json @@ -0,0 +1,16 @@ +{ + "registries": { + "public": "https://open-vsx.org/", + "mock": "${self}/mock-open-vsx/" + }, + "use": [ + "mock", + "public" + ], + "rules": [ + { + "ifRequestContains": "\\bsample-namespace\\b", + "use": "mock" + } + ] +} diff --git a/examples/playwright/.eslintrc.js b/examples/playwright/.eslintrc.js new file mode 100644 index 0000000..e15c132 --- /dev/null +++ b/examples/playwright/.eslintrc.js @@ -0,0 +1,24 @@ +/** @type {import('eslint').Linter.Config} */ +module.exports = { + extends: [ + '../../configs/build.eslintrc.json' + ], + ignorePatterns: ['playwright.config.ts'], + parserOptions: { + tsconfigRootDir: __dirname, + project: 'tsconfig.json', + // suppress warning from @typescript-eslint/typescript-estree plugin + warnOnUnsupportedTypeScriptVersion: false + }, + overrides: [ + { + files: ['*.ts'], + rules: { + // override existing rules for playwright test package + "no-null/no-null": "off", + "no-undef": "off", // disabled due to 'browser', '$', '$$' + "no-unused-expressions": "off" + } + } + ] +}; diff --git a/examples/playwright/.gitignore b/examples/playwright/.gitignore new file mode 100644 index 0000000..4fc8f9c --- /dev/null +++ b/examples/playwright/.gitignore @@ -0,0 +1,4 @@ +allure-results +test-results +playwright-report +.tmp.cfg diff --git a/examples/playwright/README.md b/examples/playwright/README.md new file mode 100644 index 0000000..ee83579 --- /dev/null +++ b/examples/playwright/README.md @@ -0,0 +1,54 @@ +
+ +
+ +theia-ext-logo + +

ECLIPSE THEIA - PLAYWRIGHT

+ +
+ +
+ +## Description + +Theia 🎭 Playwright is a [page object](https://martinfowler.com/bliki/PageObject.html) framework based on [Playwright](https://github.com/microsoft/playwright) for developing system tests of [Theia](https://github.com/eclipse-theia/theia)-based applications. See it in action below. + +
+ +![Theia System Testing in Action](./docs/images/teaser.gif) + +
+ +The Theia 🎭 Playwright page objects introduce abstraction over Theia's user interfaces, encapsulating the details of the user interface interactions, wait conditions, etc., to help keeping your tests more concise, maintainable, and stable. +Ready for an [example](./docs/GETTING_STARTED.md)? + +The actual interaction with the Theia application is implemented with 🎭 Playwright in Typescript. Thus, we can take advantage of [Playwright's benefits](https://playwright.dev/) and run or debug tests headless or headful across all modern browsers. +Check out [Playwright's documentation](https://playwright.dev/docs/intro) for more information. + +This page object framework not only covers Theia's generic capabilities, such as handling views, the quick command palette, file explorer etc. +It is [extensible](./docs/EXTENSIBILITY.md) so you can add dedicated page objects for custom Theia components, such as custom views, editors, menus, etc. + +## Documentation + +- [Getting Started](./docs/GETTING_STARTED.md) +- [Extensibility](./docs/EXTENSIBILITY.md) +- [Theia 🎭 Playwright Template](https://github.com/eclipse-theia/theia-playwright-template) +- [Building and Developing Theia 🎭 Playwright](./docs/DEVELOPING.md) + +## Additional Information + +- [Theia - GitHub](https://github.com/eclipse-theia/theia) +- [Theia - Website](https://theia-ide.org/) +- [Playwright - GitHub](https://github.com/microsoft/playwright) +- [Playwright - Website](https://playwright.dev) + +## License + +- [Eclipse Public License 2.0](http://www.eclipse.org/legal/epl-2.0/) +- [一 (Secondary) GNU General Public License, version 2 with the GNU Classpath Exception](https://projects.eclipse.org/license/secondary-gpl-2.0-cp) + +## Trademark + +"Theia" is a trademark of the Eclipse Foundation + diff --git a/examples/playwright/configs/playwright.ci.config.ts b/examples/playwright/configs/playwright.ci.config.ts new file mode 100644 index 0000000..2ba404c --- /dev/null +++ b/examples/playwright/configs/playwright.ci.config.ts @@ -0,0 +1,33 @@ +// ***************************************************************************** +// Copyright (C) 2022 EclipseSource and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { PlaywrightTestConfig } from '@playwright/test'; +import baseConfig from './playwright.config'; + +const ciConfig: PlaywrightTestConfig = { + ...baseConfig, + workers: 1, + retries: 2, + reporter: [ + ['list'], + ['github'], + ['html', { open: 'never' }], + ], + timeout: 30 * 1000, // Overwrite baseConfig timeout + preserveOutput: 'always' +}; + +export default ciConfig; diff --git a/examples/playwright/configs/playwright.config.ts b/examples/playwright/configs/playwright.config.ts new file mode 100644 index 0000000..782315c --- /dev/null +++ b/examples/playwright/configs/playwright.config.ts @@ -0,0 +1,45 @@ +// ***************************************************************************** +// Copyright (C) 2021 logi.cals GmbH, EclipseSource and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { PlaywrightTestConfig } from '@playwright/test'; + +const config: PlaywrightTestConfig = { + testDir: '../lib/tests', + testMatch: ['**/*.js'], + workers: 1, + fullyParallel: false, + // Timeout for each test in milliseconds. + timeout: 60 * 1000, + use: { + baseURL: 'http://localhost:3000', + browserName: 'chromium', + permissions: ['clipboard-read'], + screenshot: 'only-on-failure' + }, + preserveOutput: 'failures-only', + reporter: [ + ['list'], + ['allure-playwright'] + ], + // Reuse Theia backend on port 3000 or start instance before executing the tests + webServer: { + command: 'npm run theia:start', + port: 3000, + reuseExistingServer: true + } +}; + +export default config; diff --git a/examples/playwright/configs/playwright.debug.config.ts b/examples/playwright/configs/playwright.debug.config.ts new file mode 100644 index 0000000..41ac563 --- /dev/null +++ b/examples/playwright/configs/playwright.debug.config.ts @@ -0,0 +1,27 @@ +// ***************************************************************************** +// Copyright (C) 2021 logi.cals GmbH, EclipseSource and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { PlaywrightTestConfig } from '@playwright/test'; + +import baseConfig from './playwright.config'; + +const debugConfig: PlaywrightTestConfig = { + ...baseConfig, + workers: 1, + timeout: 15000000 +}; + +export default debugConfig; diff --git a/examples/playwright/configs/playwright.headful.config.ts b/examples/playwright/configs/playwright.headful.config.ts new file mode 100644 index 0000000..8c87926 --- /dev/null +++ b/examples/playwright/configs/playwright.headful.config.ts @@ -0,0 +1,30 @@ +// ***************************************************************************** +// Copyright (C) 2021 logi.cals GmbH, EclipseSource and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { PlaywrightTestConfig } from '@playwright/test'; + +import baseConfig from './playwright.config'; + +const headfulConfig: PlaywrightTestConfig = { + ...baseConfig, + workers: 1, + use: { + ...baseConfig.use, + headless: false + } +}; + +export default headfulConfig; diff --git a/examples/playwright/configs/ui-tests.eslintrc.json b/examples/playwright/configs/ui-tests.eslintrc.json new file mode 100644 index 0000000..735abed --- /dev/null +++ b/examples/playwright/configs/ui-tests.eslintrc.json @@ -0,0 +1,7 @@ +{ + // override existing rules for ui-tests package + "rules": { + "no-undef": "off", // disabled due to 'browser', '$', '$$' + "no-unused-expressions": "off" + } +} diff --git a/examples/playwright/configs/ui-tests.playwright.eslintrc.json b/examples/playwright/configs/ui-tests.playwright.eslintrc.json new file mode 100644 index 0000000..15f1246 --- /dev/null +++ b/examples/playwright/configs/ui-tests.playwright.eslintrc.json @@ -0,0 +1,6 @@ +{ + // override existing rules for ui-tests playwright package + "rules": { + "no-null/no-null": "off" + } +} diff --git a/examples/playwright/docs/DEVELOPING.md b/examples/playwright/docs/DEVELOPING.md new file mode 100644 index 0000000..6d09e19 --- /dev/null +++ b/examples/playwright/docs/DEVELOPING.md @@ -0,0 +1,57 @@ +# Building and developing Theia 🎭 Playwright + +## Building + +Run `npm install && npm run build` in the root directory of the repository to build the Theia application. + +In order to build Playwright library, the tests and install all dependencies (ex: chromium) run the build script: + +```bash +cd examples/playwright +npm run build +``` + +## Executing the tests + +### Prerequisites + +Before running your tests, the Theia application under test needs to be running. + +The Playwright configuration however is aware of that and starts the backend (`npm run theia:start`) on port 3000 if not already running. +This is valid for executing tests with the VS Code Playwright extension or from your command line. + +You may also use the `Launch Browser Backend` launch configuration in VS Code. + +### Running the tests in VS Code via the Playwright extension + +For quick and easy execution of tests in VS Code, we recommend using the [VS Code Playwright extension (`ms-playwright.playwright`)](https://marketplace.visualstudio.com/items?itemName=ms-playwright.playwright). + +Once you have installed the VS Code Playwright test extension, open the *Test* view and click the `Run Tests` button on the top toolbar or the `Run Test` button for a particular test. +It uses the default configuration with chromium as test profile by default. + +To run the tests headful, simply enable the checkbox `Show browser` in the Playwright section of the *Test* view. + +### Running the tests headless via CLI + +To start the tests run `npm run ui-tests` in the folder `playwright`. +This will start the tests in a headless state. + +To only run a single test file, the path of a test file can be set with `npm run ui-tests ` or `npm run ui-tests -g ""`. +See the [Playwright Test command line documentation](https://playwright.dev/docs/intro#command-line). + +### Running the tests headful via CLI + +If you want to observe the execution of the tests in a browser, use `npm run ui-tests-headful` for all tests or `npm run ui-tests-headful ` to only run a specific test. + +### Watch the tests + +Run `npm run watch` in the root of this package to rebuild the test code after each change. +This ensures, that the executed tests are up-to-date also when running them with the [Playwright VS Code Extension](https://marketplace.visualstudio.com/items?itemName=ms-playwright.playwright). + +### Debugging the tests + +Please refer to the section [Debugging the tests via the VS Code Playwright extension](./GETTING_STARTED.md#debugging-the-tests-via-the-vs-code-playwright-extension). + +### UI Mode - Watch and Trace Mode + +Please refer to the section [UI Mode - Watch and Trace Mode](./GETTING_STARTED.md#ui-mode---watch-and-trace-mode). diff --git a/examples/playwright/docs/EXTENSIBILITY.md b/examples/playwright/docs/EXTENSIBILITY.md new file mode 100644 index 0000000..3f45f34 --- /dev/null +++ b/examples/playwright/docs/EXTENSIBILITY.md @@ -0,0 +1,103 @@ +# Extensibility + +Theia is an extensible tool platform for building custom tools with custom user interface elements, such as views, editors, commands, etc. +Correspondingly, Theia 🎭 Playwright supports adding dedicated page objects for your custom user interface elements. +Depending on the nature of your custom components, you can extend the generic base objects, such as for views or editors, or add your own from scratch. + +## Custom commands or menu items + +Commands and menu items are handled by their label, so no further customization of the page object framework is required. +Simply interact with them via the menu or quick commands. + +```typescript +const app = await TheiaAppLoader.load({ playwright, browser }); +const menuBar = app.menuBar; + +const yourMenu = await menuBar.openMenu('Your Menu'); +const yourItem = await mainMenu.menuItemByName('Your Item'); + +expect(await yourItem?.hasSubmenu()).toBe(true); +``` + +## Custom Theia applications + +The main entry point of the page object model is `TheiaApp`. +To add further capabilities to it, for instance a custom toolbar, extend the `TheiaApp` class and add an accessor for a custom toolbar page object. + +```typescript +export class MyTheiaApp extends TheiaApp { + readonly toolbar = new MyToolbar(this); +} + +export class MyToolbar extends TheiaPageObject { + selector = 'div#myToolbar'; + async clickItem1(): Promise { + await this.page.click(`${this.selector} .item1`); + } +} + +const ws = new TheiaWorkspace([path.resolve(__dirname, '../../src/tests/resources/sample-files1']); +const app = await TheiaAppLoader.load({ playwright, browser }, ws, MyTheiaApp); +await app.toolbar.clickItem1(); +``` + +## Custom views and status indicators + +Many custom Theia applications add dedicated views, editors, or status indicators. +To support these custom user interface elements in the testing framework, you can add dedicated page objects for them. +Typically, these dedicated page objects for your custom user interface elements are subclasses of the generic classes, `TheiaView`, `TheiaEditor`, etc. +Consequently, they inherit the generic behavior of views or editors, such as activating or closing them, querying the title, check whether editors are dirty, etc. + +Let's take a custom view as an example. This custom view has a button that we want to be able to click. + +```typescript +export class MyView extends TheiaView { + constructor(public app: TheiaApp) { + super( + { + tabSelector: '#shell-tab-my-view', // the id of the tab + viewSelector: '#my-view-container', // the id of the view container + viewName: 'My View', // the user visible view name + }, + app + ); + } + + async clickMyButton(): Promise { + await this.activate(); + const viewElement = await this.viewElement(); + const button = await viewElement?.waitForSelector('#idOfMyButton'); + await button?.click(); + } +} +``` + +So first, we create a new class that inherits all generic view capabilities from `TheiaView`. +We have to specify the selectors for the tab and for the view container element that we specify in the view implementation. +Optionally we can specify a view name, which corresponds to the label in Theia's view menu. +This information is enough to open, close, find and interact with the view. + +Additionally, we can add further custom methods for the specific actions and queries we want to use for our custom view. +As an example, `MyView` above introduces a method that allows to click a button. + +To use this custom page object in a test, we pass our custom page object as a parameter when opening the view with `app.openView`. + +```typescript +const app = await TheiaAppLoader.load({ playwright, browser }); +const myView = await app.openView(MyView); +await myView.clickMyButton(); +``` + +A similar approach is used for custom editors. The only difference is that we extend `TheiaEditor` instead and pass our custom page object as an argument to `app.openEditor`. +As a reference for custom views and editors, please refer to the existing page objects, such as `TheiaPreferenceView`, `TheiaTextEditor`, etc. + +Custom status indicators are supported with the same mechanism. They are accessed via `TheiaApp.statusBar`. + +```typescript +const app = await TheiaAppLoader.load({ playwright, browser }); +const problemIndicator = await app.statusBar.statusIndicator( + TheiaProblemIndicator +); +const numberOfProblems = await problemIndicator.numberOfProblems(); +expect(numberOfProblems).to.be(2); +``` diff --git a/examples/playwright/docs/GETTING_STARTED.md b/examples/playwright/docs/GETTING_STARTED.md new file mode 100644 index 0000000..8e8ad42 --- /dev/null +++ b/examples/playwright/docs/GETTING_STARTED.md @@ -0,0 +1,184 @@ +# Getting Started + +The fastest way to getting started is to clone the [theia-playwright-template](https://github.com/eclipse-theia/theia-playwright-template) and build the theia-playwright-template. + +```bash +git clone git@github.com:eclipse-theia/theia-playwright-template.git +cd theia-playwright-template +yarn +``` + +The most important files in the theia-playwright-template are: + +* Example test in `tests/theia-app.test.ts` +* Example page object in `test/page-objects/theia-app.ts` +* The base Playwright configuration file at `playwright.config.ts` +* `package.json` with all required dependencies and scripts for running and debugging the tests + +Now, let's run the tests: + +1. Run your Theia application under test (not part of the theia-playwright-template) +2. Run `yarn ui-tests` in the theia-playwright-template to run its tests in headless mode + +Please note that Theia 🎭 Playwright is built to be extended with custom page objects, such as the one in `test/page-objects/theia-app.ts` in the theia-playwright-template. +We recommend adding further page objects for all custom views, editors, widgets, etc. +Please refer to the [extension guide](EXTENSIBILITY.md) for more information. + +Moreover, this repository contains several tests based on Theia 🎭 Playwright in `examples/playwright/src/tests` that may serve as additional examples for writing tests. + +## Adding further tests + +Let's write another system test for the Theia text editor as an example: + +1. Initialize a prepared workspace containing a file `sampleFolder/sample.txt` and open the workspace with the Theia application under test +2. Open the Theia text editor +3. Replace the contents of line 1 with `change` and check the line contents and the dirty state, which now should indicate that the editor is dirty. +4. Perform an undo twice and verify that the line contents should be what it was before the change. The dirty state should be clean again. +5. Run redo twice and check that line 1 shows the text `change` again. Also, the dirty state should be changed again. +6. Save the editor with the saved contents and check whether the editor state is clean after save. Close the editor. +7. Reopen the same file and check whether the contents of line 1 shows still the changed contents. + +The test code could look as follows. We use the page objects `TheiaWorkspace` and `TheiaApp` to initialize the application with a prepared workspace. +Using the `TheiaApp` instance, we open an editor of type `TheiaTextEditor`, which allows us to exercise actions, such as replacing line contents, undo, redo, etc. +At any time, we can also get information from the text editor, such as obtaining dirty state and verify whether this information is what we expect. + +```typescript +test('should undo and redo text changes and correctly update the dirty state', async ({ playwright, browser }) => { + // 1. set up workspace contents and open Theia app + const ws = new TheiaWorkspace([path.resolve(__dirname, 'resources/sample-files1']); + app = await TheiaAppLoader.load( { playwright, browser }, ws); + + // 2. open Theia text editor + const sampleTextEditor = await app.openEditor( + 'sample.txt', + TheiaTextEditor + ); + + // 3. make a change and verify contents and dirty + await sampleTextEditor.replaceLineWithLineNumber('change', 1); + expect(await sampleTextEditor.textContentOfLineByLineNumber(1)).toBe( + 'change' + ); + expect(await sampleTextEditor.isDirty()).toBe(true); + + // 4. undo and verify contents and dirty state + await sampleTextEditor.undo(2); + expect(await sampleTextEditor.textContentOfLineByLineNumber(1)).toBe( + 'this is just a sample file' + ); + expect(await sampleTextEditor.isDirty()).toBe(false); + + // 5. undo and verify contents and dirty state + await sampleTextEditor.redo(2); + expect(await sampleTextEditor.textContentOfLineByLineNumber(1)).toBe( + 'change' + ); + expect(await sampleTextEditor.isDirty()).toBe(true); + + // 6. save verify dirty state + await sampleTextEditor.save(); + expect(await sampleTextEditor.isDirty()).toBe(false); + await sampleTextEditor.close(); + + // 7. reopen editor and verify dirty state + const reopenedEditor = await app.openEditor('sample.txt', TheiaTextEditor); + expect(await reopenedEditor.textContentOfLineByLineNumber(1)).toBe( + 'change' + ); + + await reopenedEditor.close(); +}); +``` + +Below you can see this example test in action by stepping through the code with the VS Code debug tools. + +
+ +![Theia](./images/debug-example.gif) + +
+ +## Best practices + +The playwright tests/functions are all asynchronous so the `await` keyword should be used to wait for the result of a given function. +This way there is no need to use timeouts or other functions to wait for a specific result. +As long as await is used on any call, the tests should be in the intended state. + +There are two ways to query the page for elements using a selector. + +1. One is the `page.$(selector)` method, which returns null or the element, if it is available. +2. The other method `page.waitForSelector(selector)`, like indicated by the name, waits until the selector becomes available. This ensures that the element could be loaded and therefore negates the + need for null checks afterwards. + +Avoid directly interacting with the document object model, such as HTML elements, or the Playwright `page` from tests directly. +The interaction with the application should be encapsulated in the page objects. +Otherwise, your tests will get bloated and more fragile to changes of the application. +For more information, refer to the [page object pattern](https://martinfowler.com/bliki/PageObject.html). + +Avoid returning or exposing Playwright types from page objects. +This keeps your tests independent of the underlying browser automation framework. + +## Executing tests + +## Building + +Run `yarn` in the root directory of the repository to build the Theia application. + +In order to build Playwright library, the tests and install all dependencies (ex: chromium) run the build script: + +```bash +cd examples/playwright +yarn build +``` + +### Starting the Theia Application under test + +Before running your tests, the Theia application under test needs to be running. +This repository already provides an example Theia application, however, you might want to test your custom Theia-based application instead. + +The Playwright configuration however is aware of that and starts the backend (`yarn theia:start`) on port 3000 if not already running. +This is valid for executing tests with the VS Code Playwright extension or from your command line. + +### Running the tests in VS Code via the Playwright extension + +For quick and easy execution of tests in VS Code, we recommend using the [VS Code Playwright extension (`ms-playwright.playwright`)](https://marketplace.visualstudio.com/items?itemName=ms-playwright.playwright). + +Once you have installed the VS Code Playwright test extension, open the *Test* view and click the `Run Tests` button on the top toolbar or the `Run Test` button for a particular test. +It uses the default configuration with chromium as test profile by default. + +To run the tests headful, simply enable the checkbox `Show browser` in the Playwright section of the *Test* view. + +### Running the tests headless via CLI + +To start the tests run `yarn ui-tests` in the folder `playwright`. +This will start the tests in a headless state. + +To only run a single test file, the path of a test file can be set with `yarn ui-tests ` or `yarn ui-tests -g ""`. +See the [Playwright Test command line documentation](https://playwright.dev/docs/intro#command-line). + +### Running the tests headful via CLI + +If you want to observe the execution of the tests in a browser, use `yarn ui-tests-headful` for all tests or `yarn ui-tests-headful ` to only run a specific test. + +### Debugging the tests via the VS Code Playwright extension + +To debug Playwright tests, open the *Test* view in VS Code and click the `Debug Tests` button on the top toolbar or the `Debug Test` for a particular test. +It uses the default configuration with chromium as test profile by default. + +For more information on debugging, please refer to the [Playwright documentation](https://playwright.dev/docs/debug). + +### UI Mode - Watch and Trace Mode + +For an advanced test development experience, Playwright provides the so-called *UI Mode*. To enable this, simply add the flag `--ui` to the CLI command. + +```bash +yarn ui-tests --ui +``` + +For more information on the UI mode, please refer to the [Playwright announcement of the UI mode](https://playwright.dev/docs/release-notes#introducing-ui-mode-preview). + +## Advanced Topics + +There are many more features, configuration and command line options from Playwright that can be used. +These range from grouping and annotating tests, further reporters, to visual comparisons, etc. +For more information refer to the [Playwright documentation](https://playwright.dev/docs/intro). diff --git a/examples/playwright/docs/images/debug-example.gif b/examples/playwright/docs/images/debug-example.gif new file mode 100644 index 0000000..13b6d5c Binary files /dev/null and b/examples/playwright/docs/images/debug-example.gif differ diff --git a/examples/playwright/docs/images/teaser.gif b/examples/playwright/docs/images/teaser.gif new file mode 100644 index 0000000..5c7a555 Binary files /dev/null and b/examples/playwright/docs/images/teaser.gif differ diff --git a/examples/playwright/package.json b/examples/playwright/package.json new file mode 100644 index 0000000..ac4af8c --- /dev/null +++ b/examples/playwright/package.json @@ -0,0 +1,53 @@ +{ + "name": "@theia/playwright", + "version": "1.68.0", + "description": "System tests for Theia", + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "repository": { + "type": "git", + "url": "https://github.com/eclipse-theia/theia.git" + }, + "bugs": { + "url": "https://github.com/eclipse-theia/theia/issues" + }, + "homepage": "https://github.com/eclipse-theia/theia", + "scripts": { + "clean": "theiaext clean", + "compile": "theiaext compile", + "build": "theiaext build && npm run playwright:install", + "watch": "theiaext watch", + "theia:start": "cd ../browser && rimraf .tmp.cfg && cross-env THEIA_CONFIG_DIR=$PWD/.tmp.cfg npm run start", + "lint": "eslint -c ./.eslintrc.js --ext .ts ./src", + "lint:fix": "eslint -c ./.eslintrc.js --ext .ts ./src --fix", + "playwright:install": "playwright install chromium", + "ui-tests": "npm run build && playwright test --config=./configs/playwright.config.ts", + "ui-tests-electron": "npm run build && cross-env USE_ELECTRON=true playwright test --config=./configs/playwright.config.ts", + "ui-tests-ci": "npm run build && playwright test --config=./configs/playwright.ci.config.ts", + "ui-tests-headful": "npm run build && playwright test --config=./configs/playwright.headful.config.ts", + "ui-tests-report-generate": "allure generate ./allure-results --clean -o allure-results/allure-report", + "ui-tests-report": "npm run ui-tests-report-generate && allure open allure-results/allure-report" + }, + "files": [ + "lib", + "src" + ], + "dependencies": { + "@playwright/test": "^1.47.0", + "fs-extra": "^9.0.8", + "tslib": "^2.6.2" + }, + "devDependencies": { + "@theia/cli": "1.68.0", + "@types/fs-extra": "^9.0.8", + "allure-commandline": "^2.23.1", + "allure-playwright": "^2.5.0", + "cross-env": "^7.0.3", + "rimraf": "^5.0.0", + "typescript": "~5.9.3" + }, + "publishConfig": { + "access": "public" + }, + "main": "lib/index", + "gitHead": "21358137e41342742707f660b8e222f940a27652" +} diff --git a/examples/playwright/src/index.ts b/examples/playwright/src/index.ts new file mode 100644 index 0000000..eae7d13 --- /dev/null +++ b/examples/playwright/src/index.ts @@ -0,0 +1,52 @@ +// ***************************************************************************** +// Copyright (C) 2022 EclipseSource and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +export * from './theia-about-dialog'; +export * from './theia-app'; +export * from './theia-app-loader'; +export * from './theia-context-menu'; +export * from './theia-dialog'; +export * from './theia-editor'; +export * from './theia-explorer-view'; +export * from './theia-main-menu'; +export * from './theia-menu-item'; +export * from './theia-menu'; +export * from './theia-monaco-editor'; +export * from './theia-notification-indicator'; +export * from './theia-notification-overlay'; +export * from './theia-notebook-cell'; +export * from './theia-notebook-editor'; +export * from './theia-notebook-toolbar'; +export * from './theia-output-channel'; +export * from './theia-output-view'; +export * from './theia-page-object'; +export * from './theia-preference-view'; +export * from './theia-problem-indicator'; +export * from './theia-problem-view'; +export * from './theia-quick-command-palette'; +export * from './theia-rename-dialog'; +export * from './theia-status-bar'; +export * from './theia-status-indicator'; +export * from './theia-terminal'; +export * from './theia-text-editor'; +export * from './theia-toggle-bottom-indicator'; +export * from './theia-toolbar'; +export * from './theia-toolbar-item'; +export * from './theia-tree-node'; +export * from './theia-view'; +export * from './theia-welcome-view'; +export * from './theia-workspace'; +export * from './util'; diff --git a/examples/playwright/src/tests/resources/notebook-files/.theia/settings.json b/examples/playwright/src/tests/resources/notebook-files/.theia/settings.json new file mode 100644 index 0000000..8bb69fd --- /dev/null +++ b/examples/playwright/src/tests/resources/notebook-files/.theia/settings.json @@ -0,0 +1,3 @@ +{ + "files.autoSave": "off" +} diff --git a/examples/playwright/src/tests/resources/notebook-files/sample.ipynb b/examples/playwright/src/tests/resources/notebook-files/sample.ipynb new file mode 100644 index 0000000..709d82c --- /dev/null +++ b/examples/playwright/src/tests/resources/notebook-files/sample.ipynb @@ -0,0 +1,18 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "language_info": { + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/examples/playwright/src/tests/resources/sample-files1/sample.txt b/examples/playwright/src/tests/resources/sample-files1/sample.txt new file mode 100644 index 0000000..09cbd5a --- /dev/null +++ b/examples/playwright/src/tests/resources/sample-files1/sample.txt @@ -0,0 +1,4 @@ +this is just a sample file +content line 2 +content line 3 +content line 4 diff --git a/examples/playwright/src/tests/resources/sample-files1/sampleFolder/sampleFolder1/sampleFolder1-1/sampleFile1-1-1.txt b/examples/playwright/src/tests/resources/sample-files1/sampleFolder/sampleFolder1/sampleFolder1-1/sampleFile1-1-1.txt new file mode 100644 index 0000000..b72d61c --- /dev/null +++ b/examples/playwright/src/tests/resources/sample-files1/sampleFolder/sampleFolder1/sampleFolder1-1/sampleFile1-1-1.txt @@ -0,0 +1 @@ +this is just a sample file diff --git a/examples/playwright/src/tests/resources/sample-files1/sampleFolder/sampleFolder1/sampleFolder1-1/sampleFile1-1-2.txt b/examples/playwright/src/tests/resources/sample-files1/sampleFolder/sampleFolder1/sampleFolder1-1/sampleFile1-1-2.txt new file mode 100644 index 0000000..b72d61c --- /dev/null +++ b/examples/playwright/src/tests/resources/sample-files1/sampleFolder/sampleFolder1/sampleFolder1-1/sampleFile1-1-2.txt @@ -0,0 +1 @@ +this is just a sample file diff --git a/examples/playwright/src/tests/resources/sample-files1/sampleFolder/sampleFolder1/sampleFolder1-2/sampleFile1-2-1.txt b/examples/playwright/src/tests/resources/sample-files1/sampleFolder/sampleFolder1/sampleFolder1-2/sampleFile1-2-1.txt new file mode 100644 index 0000000..b72d61c --- /dev/null +++ b/examples/playwright/src/tests/resources/sample-files1/sampleFolder/sampleFolder1/sampleFolder1-2/sampleFile1-2-1.txt @@ -0,0 +1 @@ +this is just a sample file diff --git a/examples/playwright/src/tests/resources/sample-files1/sampleFolder/sampleFolder1/sampleFolder1-2/sampleFile1-2-2.txt b/examples/playwright/src/tests/resources/sample-files1/sampleFolder/sampleFolder1/sampleFolder1-2/sampleFile1-2-2.txt new file mode 100644 index 0000000..b72d61c --- /dev/null +++ b/examples/playwright/src/tests/resources/sample-files1/sampleFolder/sampleFolder1/sampleFolder1-2/sampleFile1-2-2.txt @@ -0,0 +1 @@ +this is just a sample file diff --git a/examples/playwright/src/tests/resources/sample-files1/sampleFolder/sampleFolder2/sampleFolder2-1/sampleFile2-1-1.txt b/examples/playwright/src/tests/resources/sample-files1/sampleFolder/sampleFolder2/sampleFolder2-1/sampleFile2-1-1.txt new file mode 100644 index 0000000..b72d61c --- /dev/null +++ b/examples/playwright/src/tests/resources/sample-files1/sampleFolder/sampleFolder2/sampleFolder2-1/sampleFile2-1-1.txt @@ -0,0 +1 @@ +this is just a sample file diff --git a/examples/playwright/src/tests/resources/sample-files1/sampleFolder/sampleFolder2/sampleFolder2-1/sampleFile2-1-2.txt b/examples/playwright/src/tests/resources/sample-files1/sampleFolder/sampleFolder2/sampleFolder2-1/sampleFile2-1-2.txt new file mode 100644 index 0000000..b72d61c --- /dev/null +++ b/examples/playwright/src/tests/resources/sample-files1/sampleFolder/sampleFolder2/sampleFolder2-1/sampleFile2-1-2.txt @@ -0,0 +1 @@ +this is just a sample file diff --git a/examples/playwright/src/tests/resources/sample-files1/sampleFolder/sampleFolder2/sampleFolder2-2/sampleFile2-2-1.txt b/examples/playwright/src/tests/resources/sample-files1/sampleFolder/sampleFolder2/sampleFolder2-2/sampleFile2-2-1.txt new file mode 100644 index 0000000..b72d61c --- /dev/null +++ b/examples/playwright/src/tests/resources/sample-files1/sampleFolder/sampleFolder2/sampleFolder2-2/sampleFile2-2-1.txt @@ -0,0 +1 @@ +this is just a sample file diff --git a/examples/playwright/src/tests/resources/sample-files1/sampleFolder/sampleFolder2/sampleFolder2-2/sampleFile2-2-2.txt b/examples/playwright/src/tests/resources/sample-files1/sampleFolder/sampleFolder2/sampleFolder2-2/sampleFile2-2-2.txt new file mode 100644 index 0000000..b72d61c --- /dev/null +++ b/examples/playwright/src/tests/resources/sample-files1/sampleFolder/sampleFolder2/sampleFolder2-2/sampleFile2-2-2.txt @@ -0,0 +1 @@ +this is just a sample file diff --git a/examples/playwright/src/tests/resources/sample-files1/sampleFolderCompact/nestedFolder1/nestedFolder2/sampleFile1-1.txt b/examples/playwright/src/tests/resources/sample-files1/sampleFolderCompact/nestedFolder1/nestedFolder2/sampleFile1-1.txt new file mode 100644 index 0000000..e69de29 diff --git a/examples/playwright/src/tests/resources/sample-files2/another-sample.txt b/examples/playwright/src/tests/resources/sample-files2/another-sample.txt new file mode 100644 index 0000000..7749264 --- /dev/null +++ b/examples/playwright/src/tests/resources/sample-files2/another-sample.txt @@ -0,0 +1 @@ +this is just another sample file diff --git a/examples/playwright/src/tests/theia-app.test.ts b/examples/playwright/src/tests/theia-app.test.ts new file mode 100644 index 0000000..5b94498 --- /dev/null +++ b/examples/playwright/src/tests/theia-app.test.ts @@ -0,0 +1,33 @@ +// ***************************************************************************** +// Copyright (C) 2021 logi.cals GmbH, EclipseSource and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { expect, test } from '@playwright/test'; +import { TheiaAppLoader } from '../theia-app-loader'; +import { TheiaApp } from '../theia-app'; + +test.describe('Theia Application', () => { + let app: TheiaApp; + + test.afterAll(async () => { + await app.page.close(); + }); + + test('should load and should show main content panel', async ({ playwright, browser }) => { + app = await TheiaAppLoader.load({ playwright, browser }); + expect(await app.isMainContentPanelVisible()).toBe(true); + }); + +}); diff --git a/examples/playwright/src/tests/theia-application-shell.test.ts b/examples/playwright/src/tests/theia-application-shell.test.ts new file mode 100644 index 0000000..d1b387f --- /dev/null +++ b/examples/playwright/src/tests/theia-application-shell.test.ts @@ -0,0 +1,68 @@ +// ***************************************************************************** +// Copyright (C) 2023 Toro Cloud Pty Ltd and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 + +import { test } from '@playwright/test'; +import * as path from 'path'; +import { TheiaApp } from '../theia-app'; +import { TheiaAppLoader } from '../theia-app-loader'; +import { TheiaExplorerView } from '../theia-explorer-view'; +import { TheiaTextEditor } from '../theia-text-editor'; +import { TheiaWelcomeView } from '../theia-welcome-view'; +import { TheiaWorkspace } from '../theia-workspace'; + +test.describe('Theia Application Shell', () => { + test.describe.configure({ + timeout: 120000 + }); + + let app: TheiaApp; + + test.beforeAll(async ({ playwright, browser }) => { + const ws = new TheiaWorkspace([path.resolve(__dirname, '../../src/tests/resources/sample-files1')]); + app = await TheiaAppLoader.load({ playwright, browser }, ws); + + // The welcome view must be closed because the memory leak only occurs when there are + // no tabs left open. + const welcomeView = new TheiaWelcomeView(app); + + if (await welcomeView.isTabVisible()) { + await welcomeView.close(); + } + }); + + test.afterAll(async () => { + await app.page.close(); + }); + + /** + * The aim of this test is to detect memory leaks when opening and closing editors many times. + * Remove the skip and run the test, check the logs for any memory leak warnings. + * It should take less than 2min to run, if it takes longer than that, just increase the timeout. + */ + test.skip('should open and close a text editor many times', async () => { + for (let i = 0; i < 200; i++) { + const explorer = await app.openView(TheiaExplorerView); + + const fileStatNode = await explorer.getFileStatNodeByLabel('sample.txt'); + const contextMenu = await fileStatNode.openContextMenu(); + await contextMenu.clickMenuItem('Open'); + + const textEditor = new TheiaTextEditor('sample.txt', app); + await textEditor.waitForVisible(); + + await textEditor.close(); + } + }); +}); diff --git a/examples/playwright/src/tests/theia-explorer-view.test.ts b/examples/playwright/src/tests/theia-explorer-view.test.ts new file mode 100644 index 0000000..f43d16d --- /dev/null +++ b/examples/playwright/src/tests/theia-explorer-view.test.ts @@ -0,0 +1,213 @@ +// ***************************************************************************** +// Copyright (C) 2021 logi.cals GmbH, EclipseSource and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { expect, test } from '@playwright/test'; +import * as path from 'path'; +import { TheiaAppLoader } from '../theia-app-loader'; +import { TheiaApp } from '../theia-app'; +import { PreferenceIds, TheiaPreferenceView } from '../theia-preference-view'; +import { DOT_FILES_FILTER, TheiaExplorerView } from '../theia-explorer-view'; +import { TheiaWorkspace } from '../theia-workspace'; + +test.describe('Theia Explorer View', () => { + + let app: TheiaApp; + let explorer: TheiaExplorerView; + + test.beforeAll(async ({ playwright, browser }) => { + const ws = new TheiaWorkspace([path.resolve(__dirname, '../../src/tests/resources/sample-files1')]); + app = await TheiaAppLoader.load({ playwright, browser }, ws); + + if (app.isElectron) { + // set trash preference to off + const preferenceView = await app.openPreferences(TheiaPreferenceView); + await preferenceView.setBooleanPreferenceById(PreferenceIds.Files.EnableTrash, false); + await preferenceView.close(); + } + + explorer = await app.openView(TheiaExplorerView); + await explorer.waitForVisibleFileNodes(); + }); + + test.afterAll(async () => { + await app.page.close(); + }); + + test('should be visible and active after being opened', async () => { + expect(await explorer.isTabVisible()).toBe(true); + expect(await explorer.isDisplayed()).toBe(true); + expect(await explorer.isActive()).toBe(true); + }); + + test("should be opened at the left and have the title 'Explorer'", async () => { + expect(await explorer.isInSidePanel()).toBe(true); + expect(await explorer.side()).toBe('left'); + expect(await explorer.title()).toBe('Explorer'); + }); + + test('should be possible to close and reopen it', async () => { + await explorer.close(); + expect(await explorer.isTabVisible()).toBe(false); + + explorer = await app.openView(TheiaExplorerView); + expect(await explorer.isTabVisible()).toBe(true); + expect(await explorer.isDisplayed()).toBe(true); + expect(await explorer.isActive()).toBe(true); + }); + + test('should show one folder named "sampleFolder", one named "sampleFolderCompact" and one file named "sample.txt"', async () => { + await explorer.selectTreeNode('sampleFolder'); + expect(await explorer.isTreeNodeSelected('sampleFolder')).toBe(true); + const fileStatElements = await explorer.visibleFileStatNodes(DOT_FILES_FILTER); + expect(fileStatElements.length).toBe(3); + + let file; let folder; let compactFolder; + if (await fileStatElements[0].isFolder()) { + folder = fileStatElements[0]; + compactFolder = fileStatElements[1]; + file = fileStatElements[2]; + } else { + folder = fileStatElements[2]; + compactFolder = fileStatElements[1]; + file = fileStatElements[0]; + } + + expect(await folder.label()).toBe('sampleFolder'); + expect(await folder.isFile()).toBe(false); + expect(await folder.isFolder()).toBe(true); + expect(await compactFolder.label()).toBe('sampleFolderCompact'); + expect(await compactFolder.isFile()).toBe(false); + expect(await compactFolder.isFolder()).toBe(true); + expect(await file.label()).toBe('sample.txt'); + expect(await file.isFolder()).toBe(false); + expect(await file.isFile()).toBe(true); + }); + + test('should provide file stat node by single path fragment "sample.txt"', async () => { + const file = await explorer.getFileStatNodeByLabel('sample.txt'); + expect(await file.label()).toBe('sample.txt'); + expect(await file.isFolder()).toBe(false); + expect(await file.isFile()).toBe(true); + }); + + test('should provide file stat nodes that can define whether they are collapsed or not and that can be expanded and collapsed', async () => { + const file = await explorer.getFileStatNodeByLabel('sample.txt'); + expect(await file.isCollapsed()).toBe(false); + + const folder = await explorer.getFileStatNodeByLabel('sampleFolder'); + expect(await folder.isCollapsed()).toBe(true); + + await folder.expand(); + expect(await folder.isCollapsed()).toBe(false); + + await folder.collapse(); + expect(await folder.isCollapsed()).toBe(true); + }); + + test('should provide file stat node by path "sampleFolder/sampleFolder1/sampleFolder1-1/sampleFile1-1-1.txt"', async () => { + const file = await explorer.fileStatNode('sampleFolder/sampleFolder1/sampleFolder1-1/sampleFile1-1-1.txt'); + if (!file) { throw Error('File stat node could not be retrieved by path'); } + expect(await file.label()).toBe('sampleFile1-1-1.txt'); + }); + + test('should be able to check if compact folder "sampleFolderCompact/nestedFolder1/nestedFolder2" exists', async () => { + const fileStatElements = await explorer.visibleFileStatNodes(); + // default setting `explorer.compactFolders=true` renders folders in a compact form - single child folders will be compressed in a combined tree element + expect(await explorer.existsDirectoryNode('sampleFolderCompact/nestedFolder1/nestedFolder2', true /* compact */)).toBe(true); + // the `existsDirectoryNode` function will expand the folder, hence we wait for the file nodes to increase as we expect a txt child file node + await explorer.waitForFileNodesToIncrease(fileStatElements.length); + }); + + test('should provide file stat node by path of compact folder "sampleFolderCompact/nestedFolder1/nestedFolder2/sampleFile1-1.txt"', async () => { + const file = await explorer.fileStatNode('sampleFolderCompact/nestedFolder1/nestedFolder2/sampleFile1-1.txt', true /* compact */); + if (!file) { throw Error('File stat node could not be retrieved by path'); } + expect(await file.label()).toBe('sampleFile1-1.txt'); + }); + + test('should open context menu on "sample.txt"', async () => { + const file = await explorer.getFileStatNodeByLabel('sample.txt'); + const menu = await file.openContextMenu(); + expect(await menu.isOpen()).toBe(true); + + const menuItems = await menu.visibleMenuItems(); + expect(menuItems).toContain('Open'); + expect(menuItems).toContain('Delete'); + if (!app.isElectron) { + expect(menuItems).toContain('Download'); + } + + await menu.close(); + expect(await menu.isOpen()).toBe(false); + }); + + test('should rename "sample.txt"', async () => { + await explorer.renameNode('sample.txt', 'sample-new.txt'); + expect(await explorer.existsFileNode('sample-new.txt')).toBe(true); + await explorer.renameNode('sample-new.txt', 'sample.txt'); + expect(await explorer.existsFileNode('sample.txt')).toBe(true); + }); + + test('should open context menu on nested folder segment "nestedFolder1"', async () => { + expect(await explorer.existsDirectoryNode('sampleFolderCompact/nestedFolder1/nestedFolder2', true /* compact */)).toBe(true); + const folder = await explorer.getFileStatNodeByLabel('sampleFolderCompact/nestedFolder1/nestedFolder2', true /* compact */); + const menu = await folder.openContextMenuOnSegment('nestedFolder1'); + expect(await menu.isOpen()).toBe(true); + + const menuItems = await menu.visibleMenuItems(); + expect(menuItems).toContain('New File...'); + expect(menuItems).toContain('New Folder...'); + expect(menuItems).toContain('Open in Integrated Terminal'); + expect(menuItems).toContain('Find in Folder...'); + + await menu.close(); + expect(await menu.isOpen()).toBe(false); + }); + + test('should rename compact folder "sampleFolderCompact" to "sampleDirectoryCompact', async () => { + expect(await explorer.existsDirectoryNode('sampleFolderCompact/nestedFolder1/nestedFolder2', true /* compact */)).toBe(true); + await explorer.renameNode( + 'sampleFolderCompact/nestedFolder1/nestedFolder2', 'sampleDirectoryCompact', + true /* confirm */, 'sampleFolderCompact' /* nodeSegmentLabel */); + expect(await explorer.existsDirectoryNode('sampleDirectoryCompact/nestedFolder1/nestedFolder2', true /* compact */)).toBe(true); + }); + + // TODO These tests only seems to fail on Ubuntu - it's not clear why + test.skip('should delete nested folder "sampleDirectoryCompact/nestedFolder1/nestedFolder2"', async () => { + const fileStatElements = await explorer.visibleFileStatNodes(); + expect(await explorer.existsDirectoryNode('sampleDirectoryCompact/nestedFolder1/nestedFolder2', true /* compact */)).toBe(true); + await explorer.deleteNode('sampleDirectoryCompact/nestedFolder1/nestedFolder2', true /* confirm */, 'nestedFolder2' /* nodeSegmentLabel */); + await explorer.waitForFileNodesToDecrease(fileStatElements.length); + const updatedFileStatElements = await explorer.visibleFileStatNodes(); + expect(updatedFileStatElements.length).toBe(fileStatElements.length - 1); + }); + + test.skip('should delete compact folder "sampleDirectoryCompact/nestedFolder1"', async () => { + const fileStatElements = await explorer.visibleFileStatNodes(); + expect(await explorer.existsDirectoryNode('sampleDirectoryCompact/nestedFolder1', true /* compact */)).toBe(true); + await explorer.deleteNode('sampleDirectoryCompact/nestedFolder1', true /* confirm */, 'sampleDirectoryCompact' /* nodeSegmentLabel */); + await explorer.waitForFileNodesToDecrease(fileStatElements.length); + const updatedFileStatElements = await explorer.visibleFileStatNodes(); + expect(updatedFileStatElements.length).toBe(fileStatElements.length - 1); + }); + + test('open "sample.txt" via the context menu', async () => { + expect(await explorer.existsFileNode('sample.txt')).toBe(true); + await explorer.clickContextMenuItem('sample.txt', ['Open']); + const span = await app.page.waitForSelector('span:has-text("content line 2")'); + expect(await span.isVisible()).toBe(true); + }); + +}); diff --git a/examples/playwright/src/tests/theia-getting-started.test.ts b/examples/playwright/src/tests/theia-getting-started.test.ts new file mode 100644 index 0000000..e938e71 --- /dev/null +++ b/examples/playwright/src/tests/theia-getting-started.test.ts @@ -0,0 +1,50 @@ +// ***************************************************************************** +// Copyright (C) 2024 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { expect, test } from '@playwright/test'; +import { TheiaApp } from '../theia-app'; +import { TheiaAppLoader } from '../theia-app-loader'; +import { TheiaExplorerView } from '../theia-explorer-view'; + +/** + * Test the Theia welcome page from the getting-started package. + */ +test.describe('Theia Welcome Page', () => { + let app: TheiaApp; + + test.beforeAll(async ({ playwright, browser }) => { + app = await TheiaAppLoader.load({ playwright, browser }); + await app.isMainContentPanelVisible(); + }); + + test.afterAll(async () => { + await app.page.close(); + }); + + test('New File... entry should create a new file.', async () => { + await app.page.getByRole('button', { name: 'New File...' }).click(); + const quickPicker = app.page.getByPlaceholder('Select File Type or Enter'); + await quickPicker.fill('testfile.txt'); + await quickPicker.press('Enter'); + await app.page.getByRole('button', { name: 'Create File' }).click(); + + // check file in workspace exists + const explorer = await app.openView(TheiaExplorerView); + await explorer.refresh(); + await explorer.waitForVisibleFileNodes(); + expect(await explorer.existsFileNode('testfile.txt')).toBe(true); + }); +}); diff --git a/examples/playwright/src/tests/theia-main-menu.test.ts b/examples/playwright/src/tests/theia-main-menu.test.ts new file mode 100644 index 0000000..6a250d2 --- /dev/null +++ b/examples/playwright/src/tests/theia-main-menu.test.ts @@ -0,0 +1,132 @@ +// ***************************************************************************** +// Copyright (C) 2021 logi.cals GmbH, EclipseSource and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { expect, test } from '@playwright/test'; +import { TheiaApp } from '../theia-app'; +import { TheiaAppLoader } from '../theia-app-loader'; +import { TheiaAboutDialog } from '../theia-about-dialog'; +import { TheiaMenuBar } from '../theia-main-menu'; +import { OSUtil } from '../util'; +import { TheiaExplorerView } from '../theia-explorer-view'; + +test.describe('Theia Main Menu', () => { + + let app: TheiaApp; + let menuBar: TheiaMenuBar; + + test.beforeAll(async ({ playwright, browser }) => { + app = await TheiaAppLoader.load({ playwright, browser }); + menuBar = app.menuBar; + }); + + test.afterAll(async () => { + await app.page.close(); + }); + + test('should show the main menu bar', async () => { + const menuBarItems = await menuBar.visibleMenuBarItems(); + expect(menuBarItems).toContain('File'); + expect(menuBarItems).toContain('Edit'); + expect(menuBarItems).toContain('Help'); + }); + + test("should open main menu 'File'", async () => { + const mainMenu = await menuBar.openMenu('File'); + expect(await mainMenu.isOpen()).toBe(true); + }); + + test("should show the menu items 'New Text File' and 'New Folder'", async () => { + const mainMenu = await menuBar.openMenu('File'); + const menuItems = await mainMenu.visibleMenuItems(); + expect(menuItems).toContain('New Text File'); + expect(menuItems).toContain('New Folder...'); + }); + + test("should return menu item by name 'New Text File'", async () => { + const mainMenu = await menuBar.openMenu('File'); + const menuItem = await mainMenu.menuItemByName('New Text File'); + expect(menuItem).toBeDefined(); + + const label = await menuItem?.label(); + expect(label).toBe('New Text File'); + + const shortCut = await menuItem?.shortCut(); + expect(shortCut).toBe(OSUtil.isMacOS ? '⌥ N' : app.isElectron ? 'Ctrl+N' : 'Alt+N'); + + const hasSubmenu = await menuItem?.hasSubmenu(); + expect(hasSubmenu).toBe(false); + }); + + test('should detect whether menu item has submenu', async () => { + const mainMenu = await menuBar.openMenu('File'); + const newFileItem = await mainMenu.menuItemByName('New Text File'); + const settingsItem = await mainMenu.menuItemByName('Preferences'); + + expect(await newFileItem?.hasSubmenu()).toBe(false); + expect(await settingsItem?.hasSubmenu()).toBe(true); + }); + + test('should be able to show menu item in submenu by path', async () => { + const mainMenu = await menuBar.openMenu('File'); + const openPreferencesItem = await mainMenu.menuItemByNamePath('Preferences', 'Settings'); + + const label = await openPreferencesItem?.label(); + expect(label).toBe('Settings'); + }); + + test('should close main menu', async () => { + const mainMenu = await menuBar.openMenu('File'); + await mainMenu.close(); + expect(await mainMenu.isOpen()).toBe(false); + }); + + test('open about dialog using menu', async () => { + await (await menuBar.openMenu('Help')).clickMenuItem('About'); + const aboutDialog = new TheiaAboutDialog(app); + expect(await aboutDialog.isVisible()).toBe(true); + await aboutDialog.page.locator('#theia-dialog-shell').getByRole('button', { name: 'OK' }).click(); + expect(await aboutDialog.isVisible()).toBe(false); + }); + + test('open file via file menu and cancel', async () => { + const openFileEntry = app.isElectron ? 'Open File...' : 'Open...'; + await (await menuBar.openMenu('File')).clickMenuItem(openFileEntry); + const fileDialog = await app.page.waitForSelector('div[class="dialogBlock"]'); + expect(await fileDialog.isVisible()).toBe(true); + await app.page.locator('#theia-dialog-shell').getByRole('button', { name: 'Cancel' }).click(); + expect(await fileDialog.isVisible()).toBe(false); + }); + + test('Create file via New File menu and accept', async () => { + await (await menuBar.openMenu('File')).clickMenuItem('New File...'); + const quickPick = app.page.getByPlaceholder('Select File Type or Enter'); + // type file name and press enter + await quickPick.fill('test.txt'); + await quickPick.press('Enter'); + + // check file dialog is opened and accept with ENTER + const fileDialog = await app.page.waitForSelector('div[class="dialogBlock"]'); + expect(await fileDialog.isVisible()).toBe(true); + await app.page.locator('#theia-dialog-shell').press('Enter'); + expect(await fileDialog.isVisible()).toBe(false); + + // check file in workspace exists + const explorer = await app.openView(TheiaExplorerView); + await explorer.refresh(); + await explorer.waitForVisibleFileNodes(); + expect(await explorer.existsFileNode('test.txt')).toBe(true); + }); +}); diff --git a/examples/playwright/src/tests/theia-notebook-editor.test.ts b/examples/playwright/src/tests/theia-notebook-editor.test.ts new file mode 100644 index 0000000..1046a77 --- /dev/null +++ b/examples/playwright/src/tests/theia-notebook-editor.test.ts @@ -0,0 +1,365 @@ +// ***************************************************************************** +// Copyright (C) 2024 TypeFox GmbH and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { Locator, PlaywrightWorkerArgs, expect, test } from '@playwright/test'; +import * as path from 'path'; +import { TheiaApp } from '../theia-app'; +import { TheiaAppLoader, TheiaPlaywrightTestConfig } from '../theia-app-loader'; +import { TheiaNotebookCell } from '../theia-notebook-cell'; +import { TheiaNotebookEditor } from '../theia-notebook-editor'; +import { TheiaWorkspace } from '../theia-workspace'; + +// See .github/workflows/playwright.yml for preferred python version +const preferredKernel = process.env.CI ? 'Python 3.13' : 'Python 3'; + +async function ensureKernelSelected(editor: TheiaNotebookEditor): Promise { + const selectedKernel = await editor.selectedKernel(); + if (selectedKernel?.match(new RegExp(`^${preferredKernel}`)) === null) { + await editor.selectKernel(preferredKernel); + } +} + +async function closeEditorWithoutSave(editor: TheiaNotebookEditor): Promise { + if (await editor.isDirty()) { + await editor.closeWithoutSave(); + } else { + await editor.close(); + } +} + +test.describe('Python Kernel Installed', () => { + let app: TheiaApp; + let editor: TheiaNotebookEditor; + + test.beforeAll(async ({ playwright, browser }) => { + app = await loadApp({ playwright, browser }); + }); + + test.beforeEach(async () => { + editor = await app.openEditor('sample.ipynb', TheiaNotebookEditor); + }); + + test.afterAll(async () => { + if (app.page) { + await app.page.close(); + } + }); + + test.afterEach(async () => { + await closeEditorWithoutSave(editor); + }); + + test('kernels are installed', async () => { + const kernels = await editor.availableKernels(); + const msg = `Available kernels:\n ${kernels.join('\n')}`; + console.log(msg); // Print available kernels, useful when running in CI. + expect(kernels.length, msg).toBeGreaterThan(0); + + const py3kernel = kernels.filter(kernel => kernel.match(new RegExp(`^${preferredKernel}`))); + expect(py3kernel.length, msg).toBeGreaterThan(0); + }); + + test('should select a kernel', async () => { + await editor.selectKernel(preferredKernel); + const selectedKernel = await editor.selectedKernel(); + expect(selectedKernel).toMatch(new RegExp(`^${preferredKernel}`)); + }); +}); + +test.describe('Theia Notebook Editor interaction', () => { + + let app: TheiaApp; + let editor: TheiaNotebookEditor; + + test.beforeAll(async ({ playwright, browser }) => { + app = await loadApp({ playwright, browser }); + }); + + test.beforeEach(async () => { + editor = await app.openEditor('sample.ipynb', TheiaNotebookEditor); + await ensureKernelSelected(editor); + }); + + test.afterAll(async () => { + if (app.page) { + await app.page.close(); + } + }); + + test.afterEach(async () => { + await closeEditorWithoutSave(editor); + }); + + test('should add a new code cell', async () => { + await editor.addCodeCell(); + const cells = await editor.cells(); + expect(cells.length).toBe(2); + expect(await cells[1].mode()).toBe('python'); + }); + + test('should add a new markdown cell', async () => { + await editor.addMarkdownCell(); + await (await editor.cells())[1].addEditorText('print("markdown")'); + + const cells = await editor.cells(); + expect(cells.length).toBe(2); + expect(await cells[1].mode()).toBe('markdown'); + expect(await cells[1].editorText()).toBe('print("markdown")'); + }); + + test('should execute all cells', async () => { + const cell = await firstCell(editor); + await cell.addEditorText('print("Hallo Notebook!")'); + + await editor.addCodeCell(); + const secondCell = (await editor.cells())[1]; + await secondCell.addEditorText('print("Bye Notebook!")'); + + await editor.executeAllCells(); + + expect(await cell.outputText()).toBe('Hallo Notebook!'); + expect(await secondCell.outputText()).toBe('Bye Notebook!'); + }); + + test('should split cell', async () => { + const cell = await firstCell(editor); + /* + Add cell text: + print("Line-1") + print("Line-2") + */ + await cell.addEditorText('print("Line-1")\nprint("Line-2")'); + + /* + Set cursor: + print("Line-1") + <|>print("Line-2") + */ + const line = await cell.editor.monacoEditor.line(1); + expect(line, { message: 'Line number 1 should exists' }).toBeDefined(); + await line!.click(); + await line!.press('ArrowRight'); + + // split cell + await cell.splitCell(); + + // expect two cells with text "print("Line-1")" and "print("Line-2")" + expect(await editor.cells()).toHaveLength(2); + expect(await (await editor.cells())[0].editorText()).toBe('print("Line-1")'); + expect(await (await editor.cells())[1].editorText()).toBe('print("Line-2")'); + }); +}); + +test.describe('Theia Notebook Cell interaction', () => { + + let app: TheiaApp; + let editor: TheiaNotebookEditor; + + test.beforeAll(async ({ playwright, browser }) => { + app = await loadApp({ playwright, browser }); + }); + + test.afterAll(async () => { + if (app.page) { + await app.page.close(); + } + }); + + test.beforeEach(async () => { + editor = await app.openEditor('sample.ipynb', TheiaNotebookEditor); + await ensureKernelSelected(editor); + }); + + test.afterEach(async () => { + await closeEditorWithoutSave(editor); + }); + + test('should write text in a code cell', async () => { + const cell = await firstCell(editor); + // assume the first cell is a code cell + expect(await cell.isCodeCell()).toBe(true); + + await cell.addEditorText('print("Hallo")'); + const cellText = await cell.editorText(); + expect(cellText).toBe('print("Hallo")'); + }); + + test('should write multi-line text in a code cell', async () => { + const cell = await firstCell(editor); + await cell.addEditorText('print("Hallo")\nprint("Notebook")'); + + const cellText = await cell.editorText(); + expect(cellText).toBe('print("Hallo")\nprint("Notebook")'); + }); + + test('Execute code cell and read output', async () => { + const cell = await firstCell(editor); + await cell.addEditorText('print("Hallo Notebook!")'); + await cell.execute(); + + const cellOutput = await cell.outputText(); + expect(cellOutput).toBe('Hallo Notebook!'); + }); + + test('Check execution count matches', async () => { + const cell = await firstCell(editor); + await cell.addEditorText('print("Hallo Notebook!")'); + await cell.execute(); + await cell.execute(); + await cell.execute(); + + expect(await cell.executionCount()).toBe('3'); + }); + + test('Check arrow up and down works', async () => { + const cell = await firstCell(editor); + await editor.addCodeCell(); + const secondCell = (await editor.cells())[1]; + // second cell is selected after creation + expect(await secondCell.isSelected()).toBe(true); + // select cell above + await editor.page.keyboard.type('second cell'); + await secondCell.editor.page.keyboard.press('ArrowUp'); + expect(await cell.isSelected()).toBe(true); + + // select cell below + await cell.app.page.keyboard.press('ArrowDown'); + expect(await secondCell.isSelected()).toBe(true); + }); + + test('Check k(up)/j(down) selection works', async () => { + const cell = await firstCell(editor); + await editor.addCodeCell(); + const secondCell = (await editor.cells())[1]; + // second cell is selected after creation + expect(await secondCell.isSelected()).toBe(true); + // deselect editor focus and focus the whole cell + await secondCell.selectCell(); + + // select cell above + await secondCell.editor.page.keyboard.press('k'); + expect(await cell.isSelected()).toBe(true); + + // select cell below + await cell.app.page.keyboard.press('j'); + expect(await secondCell.isSelected()).toBe(true); + }); + + test('Check x/c/v works', async () => { + const cell = await firstCell(editor); + await cell.addEditorText('print("First cell")'); + + // add and fill second cell + await editor.addCodeCell(); + // TODO workaround for create command bug. + // The first time created cell doesn't contain a monaco-editor child div. + await ((await editor.cells())[1]).deleteCell(); + await editor.addCodeCell(); + + const secondCell = (await editor.cells())[1]; + await secondCell.locator.waitFor({ state: 'visible' }); + await secondCell.addEditorText('print("Second cell")'); + await secondCell.selectCell(); // deselect editor focus + + // cut second cell + await secondCell.page.keyboard.press('x'); + await editor.waitForCellCountChanged(2); + expect((await editor.cells()).length).toBe(1); + + // paste second cell + await cell.selectCell(); + await cell.page.keyboard.press('v'); + await editor.waitForCellCountChanged(1); + expect((await editor.cells()).length).toBe(2); + const pastedCell = (await editor.cells())[1]; + expect(await pastedCell.isSelected()).toBe(true); + + // copy first cell + await cell.selectCell(); // deselect editor focus + await cell.page.keyboard.press('c'); + // paste copied cell + await cell.page.keyboard.press('v'); + await editor.waitForCellCountChanged(2); + expect((await editor.cells()).length).toBe(3); + expect(await (await editor.cells())[0].editorText()).toBe('print("First cell")'); + expect(await (await editor.cells())[1].editorText()).toBe('print("First cell")'); + expect(await (await editor.cells())[2].editorText()).toBe('print("Second cell")'); + expect(await editor.isDirty()).toBe(true); // ensure editor is dirty after copy/paste + }); + + test('Check LineNumber switch `l` works', async () => { + const cell = await firstCell(editor); + await cell.addEditorText('print("First cell")'); + await cell.selectCell(); + await cell.page.keyboard.press('l'); + // NOTE: div.line-numbers is not visible + await cell.editor.locator.locator('.overflow-guard > div.line-numbers').waitFor({ state: 'attached' }); + }); + + test('Check Collapse output switch `o` works', async () => { + const cell = await firstCell(editor); + await cell.addEditorText('print("Check output collapse")'); + await cell.selectCell(); + await cell.execute(); // produce output + expect(await cell.outputText()).toBe('Check output collapse'); + + await cell.page.keyboard.press('o'); + await (await cell.outputContainer()).waitFor({ state: 'hidden' }); + await cell.page.keyboard.press('o'); + await (await cell.outputContainer()).waitFor({ state: 'visible' }); + + expect(await cell.outputText()).toBe('Check output collapse'); + }); + + test('Check arrow-up/arrow-down/escape with code completion', async () => { + await editor.addMarkdownCell(); + const mdCell = (await editor.cells())[1]; + await mdCell.addEditorText('h'); + + await editor.page.keyboard.press('Control+Space'); // call CC (suggestWidgetVisible=true) + await ensureCodeCompletionVisible(mdCell.editor.locator); + await editor.page.keyboard.press('Escape'); // close CC + // check the same cell still selected and not lose the edit mode + expect(await mdCell.editor.monacoEditor.isFocused()).toBe(true); + + await editor.page.keyboard.press('Control+Space'); // call CC (suggestWidgetVisible=true) + await ensureCodeCompletionVisible(mdCell.editor.locator); + await editor.page.keyboard.press('ArrowUp'); // select next entry in CC list + await editor.page.keyboard.press('Enter'); // apply completion + // check the same cell still selected and not the second one due to 'ArrowDown' being pressed + expect(await mdCell.isSelected()).toBe(true); + + }); +}); + +async function ensureCodeCompletionVisible(parent: Locator): Promise { + await parent.locator('div.monaco-editor div.suggest-widget').waitFor({ timeout: 5000 }); +} + +async function firstCell(editor: TheiaNotebookEditor): Promise { + return (await editor.cells())[0]; +} + +async function loadApp(args: TheiaPlaywrightTestConfig & PlaywrightWorkerArgs): Promise { + const ws = new TheiaWorkspace([path.resolve(__dirname, '../../src/tests/resources/notebook-files')]); + const app = await TheiaAppLoader.load(args, ws); + // auto-save are disabled using settings.json file + // see examples/playwright/src/tests/resources/notebook-files/.theia/settings.json + + // NOTE: Workspace trust is disabled in examples/browser/package.json using default preferences. + // If workspace trust check is on, python extension will not be able to explore Python installations. + return app; +} diff --git a/examples/playwright/src/tests/theia-output-view.test.ts b/examples/playwright/src/tests/theia-output-view.test.ts new file mode 100644 index 0000000..ff74122 --- /dev/null +++ b/examples/playwright/src/tests/theia-output-view.test.ts @@ -0,0 +1,85 @@ +// ***************************************************************************** +// Copyright (C) 2023 EclipseSource and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { expect, test } from '@playwright/test'; +import { TheiaOutputViewChannel } from '../theia-output-channel'; +import { TheiaApp } from '../theia-app'; +import { TheiaAppLoader } from '../theia-app-loader'; +import { TheiaOutputView } from '../theia-output-view'; + +let app: TheiaApp; let outputView: TheiaOutputView; let testChannel: TheiaOutputViewChannel; +test.describe('Theia Output View', () => { + + test.beforeAll(async ({ playwright, browser }) => { + app = await TheiaAppLoader.load({ playwright, browser }); + }); + + test.afterAll(async () => { + await app.page.close(); + }); + + test('should open the output view and check if is visible and active', async () => { + outputView = await app.openView(TheiaOutputView); + expect(await outputView.isTabVisible()).toBe(true); + expect(await outputView.isDisplayed()).toBe(true); + expect(await outputView.isActive()).toBe(true); + }); + test('should be opened at the bottom and have the title "Output"', async () => { + expect(await outputView.isInSidePanel()).toBe(false); + expect(await outputView.side()).toBe('bottom'); + expect(await outputView.title()).toBe('Output'); + }); + test('should be closable', async () => { + expect(await outputView.isClosable()).toBe(true); + await outputView.close(); + expect(await outputView.isTabVisible()).toBe(false); + expect(await outputView.isDisplayed()).toBe(false); + expect(await outputView.isActive()).toBe(false); + }); + test('should select a test output channel', async () => { + outputView = await app.openView(TheiaOutputView); + expect(await outputView.isTabVisible()).toBe(true); + expect(await outputView.isDisplayed()).toBe(true); + expect(await outputView.isActive()).toBe(true); + + const testChannelName = 'API Sample: my test channel'; + expect(await outputView.selectOutputChannel(testChannelName)).toBe(true); + }); + test('should check if the output view of the test output channel', async () => { + const testChannelName = 'API Sample: my test channel'; + expect(await outputView.isOutputChannelSelected(testChannelName)); + const channel = await outputView.getOutputChannel(testChannelName); + expect(channel).toBeDefined; + testChannel = channel!; + expect(await testChannel!.isDisplayed()).toBe(true); + }); + test('should check if the output view test channel shows the test output', async () => { + expect(await testChannel.numberOfLines()).toBe(5); + expect(await testChannel.textContentOfLineByLineNumber(1)).toMatch('hello info1'); + expect(await testChannel.maxSeverityOfLineByLineNumber(1)).toMatch('info'); + expect(await testChannel.textContentOfLineByLineNumber(2)).toMatch('hello info2'); + expect(await testChannel.maxSeverityOfLineByLineNumber(2)).toMatch('info'); + expect(await testChannel.textContentOfLineByLineNumber(3)).toMatch('hello error'); + expect(await testChannel.maxSeverityOfLineByLineNumber(3)).toMatch('error'); + expect(await testChannel.textContentOfLineByLineNumber(4)).toMatch('hello warning'); + expect(await testChannel.maxSeverityOfLineByLineNumber(4)).toMatch('warning'); + expect(await testChannel.textContentOfLineByLineNumber(5)).toMatch( + 'inlineInfo1 inlineWarning inlineError inlineInfo2' + ); + expect(await testChannel.maxSeverityOfLineByLineNumber(5)).toMatch('error'); + }); + +}); diff --git a/examples/playwright/src/tests/theia-preference-view.test.ts b/examples/playwright/src/tests/theia-preference-view.test.ts new file mode 100644 index 0000000..bdaf342 --- /dev/null +++ b/examples/playwright/src/tests/theia-preference-view.test.ts @@ -0,0 +1,122 @@ +// ***************************************************************************** +// Copyright (C) 2021 logi.cals GmbH, EclipseSource and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { expect, test } from '@playwright/test'; +import { TheiaApp } from '../theia-app'; +import { TheiaAppLoader } from '../theia-app-loader'; +import { DefaultPreferences, PreferenceIds, TheiaPreferenceView } from '../theia-preference-view'; + +test.describe('Preference View', () => { + + let app: TheiaApp; + + test.beforeAll(async ({ playwright, browser }) => { + app = await TheiaAppLoader.load({ playwright, browser }); + }); + + test.afterAll(async () => { + await app.page.close(); + }); + + test('should be visible and active after being opened', async () => { + const preferenceView = await app.openPreferences(TheiaPreferenceView); + expect(await preferenceView.isTabVisible()).toBe(true); + expect(await preferenceView.isDisplayed()).toBe(true); + expect(await preferenceView.isActive()).toBe(true); + }); + + test('should be able to read, set, and reset String preferences', async () => { + const preferences = await app.openPreferences(TheiaPreferenceView); + const preferenceId = PreferenceIds.DiffEditor.MaxComputationTime; + + await preferences.resetPreferenceById(preferenceId); + expect(await preferences.getStringPreferenceById(preferenceId)).toBe(DefaultPreferences.DiffEditor.MaxComputationTime); + + await preferences.setStringPreferenceById(preferenceId, '8000'); + await preferences.waitForModified(preferenceId); + expect(await preferences.getStringPreferenceById(preferenceId)).toBe('8000'); + + await preferences.resetPreferenceById(preferenceId); + expect(await preferences.getStringPreferenceById(preferenceId)).toBe(DefaultPreferences.DiffEditor.MaxComputationTime); + }); + + test('should be able to read, set, and reset Boolean preferences', async () => { + const preferences = await app.openPreferences(TheiaPreferenceView); + const preferenceId = PreferenceIds.Explorer.AutoReveal; + + await preferences.resetPreferenceById(preferenceId); + expect(await preferences.getBooleanPreferenceById(preferenceId)).toBe(DefaultPreferences.Explorer.AutoReveal.Enabled); + + await preferences.setBooleanPreferenceById(preferenceId, false); + await preferences.waitForModified(preferenceId); + expect(await preferences.getBooleanPreferenceById(preferenceId)).toBe(false); + + await preferences.resetPreferenceById(preferenceId); + expect(await preferences.getBooleanPreferenceById(preferenceId)).toBe(DefaultPreferences.Explorer.AutoReveal.Enabled); + }); + + test('should be able to read, set, and reset Options preferences', async () => { + const preferences = await app.openPreferences(TheiaPreferenceView); + const preferenceId = PreferenceIds.Editor.RenderWhitespace; + + await preferences.resetPreferenceById(preferenceId); + expect(await preferences.getOptionsPreferenceById(preferenceId)).toBe(DefaultPreferences.Editor.RenderWhitespace.Selection); + + await preferences.setOptionsPreferenceById(preferenceId, DefaultPreferences.Editor.RenderWhitespace.Boundary); + await preferences.waitForModified(preferenceId); + expect(await preferences.getOptionsPreferenceById(preferenceId)).toBe(DefaultPreferences.Editor.RenderWhitespace.Boundary); + + await preferences.resetPreferenceById(preferenceId); + expect(await preferences.getOptionsPreferenceById(preferenceId)).toBe(DefaultPreferences.Editor.RenderWhitespace.Selection); + }); + + test('should throw an error if we try to read, set, or reset a non-existing preference', async () => { + const preferences = await app.openPreferences(TheiaPreferenceView); + + preferences.customTimeout = 500; + try { + await expect(preferences.getBooleanPreferenceById('not.a.real.preference')).rejects.toThrowError(); + await expect(preferences.setBooleanPreferenceById('not.a.real.preference', true)).rejects.toThrowError(); + await expect(preferences.resetPreferenceById('not.a.real.preference')).rejects.toThrowError(); + + await expect(preferences.getStringPreferenceById('not.a.real.preference')).rejects.toThrowError(); + await expect(preferences.setStringPreferenceById('not.a.real.preference', 'a')).rejects.toThrowError(); + await expect(preferences.resetPreferenceById('not.a.real.preference')).rejects.toThrowError(); + + await expect(preferences.getOptionsPreferenceById('not.a.real.preference')).rejects.toThrowError(); + await expect(preferences.setOptionsPreferenceById('not.a.real.preference', 'a')).rejects.toThrowError(); + await expect(preferences.resetPreferenceById('not.a.real.preference')).rejects.toThrowError(); + } finally { + preferences.customTimeout = undefined; + } + }); + + test('should throw an error if we try to read, or set a preference with the wrong type', async () => { + const preferences = await app.openPreferences(TheiaPreferenceView); + const stringPreference = PreferenceIds.DiffEditor.MaxComputationTime; + const booleanPreference = PreferenceIds.Explorer.AutoReveal; + + preferences.customTimeout = 500; + try { + await expect(preferences.getBooleanPreferenceById(stringPreference)).rejects.toThrowError(); + await expect(preferences.setBooleanPreferenceById(stringPreference, true)).rejects.toThrowError(); + await expect(preferences.setStringPreferenceById(booleanPreference, 'true')).rejects.toThrowError(); + await expect(preferences.setOptionsPreferenceById(booleanPreference, 'true')).rejects.toThrowError(); + } finally { + preferences.customTimeout = undefined; + } + }); +}); diff --git a/examples/playwright/src/tests/theia-problems-view.test.ts b/examples/playwright/src/tests/theia-problems-view.test.ts new file mode 100644 index 0000000..611080d --- /dev/null +++ b/examples/playwright/src/tests/theia-problems-view.test.ts @@ -0,0 +1,64 @@ +// ***************************************************************************** +// Copyright (C) 2021 logi.cals GmbH, EclipseSource and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { expect, test } from '@playwright/test'; +import { TheiaApp } from '../theia-app'; +import { TheiaAppLoader } from '../theia-app-loader'; +import { TheiaProblemsView } from '../theia-problem-view'; + +test.describe('Theia Problems View', () => { + + let app: TheiaApp; + + test.beforeAll(async ({ playwright, browser }) => { + app = await TheiaAppLoader.load({ playwright, browser }); + }); + + test.afterAll(async () => { + await app.page.close(); + }); + + test('should be visible and active after being opened', async () => { + const problemsView = await app.openView(TheiaProblemsView); + expect(await problemsView.isTabVisible()).toBe(true); + expect(await problemsView.isDisplayed()).toBe(true); + expect(await problemsView.isActive()).toBe(true); + }); + + test("should be opened at the bottom and have the title 'Problems'", async () => { + const problemsView = await app.openView(TheiaProblemsView); + expect(await problemsView.isInSidePanel()).toBe(false); + expect(await problemsView.side()).toBe('bottom'); + expect(await problemsView.title()).toBe('Problems'); + }); + + test('should be closable', async () => { + const problemsView = await app.openView(TheiaProblemsView); + expect(await problemsView.isClosable()).toBe(true); + + await problemsView.close(); + expect(await problemsView.isTabVisible()).toBe(false); + expect(await problemsView.isDisplayed()).toBe(false); + expect(await problemsView.isActive()).toBe(false); + }); + + test("should not throw an error if 'close' is called twice", async () => { + const problemsView = await app.openView(TheiaProblemsView); + await problemsView.close(); + await problemsView.close(); + }); + +}); diff --git a/examples/playwright/src/tests/theia-quick-command.test.ts b/examples/playwright/src/tests/theia-quick-command.test.ts new file mode 100644 index 0000000..966b6f5 --- /dev/null +++ b/examples/playwright/src/tests/theia-quick-command.test.ts @@ -0,0 +1,86 @@ +// ***************************************************************************** +// Copyright (C) 2021 logi.cals GmbH, EclipseSource and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { expect, test } from '@playwright/test'; +import { TheiaAppLoader } from '../theia-app-loader'; +import { TheiaAboutDialog } from '../theia-about-dialog'; +import { TheiaApp } from '../theia-app'; +import { TheiaExplorerView } from '../theia-explorer-view'; +import { TheiaNotificationIndicator } from '../theia-notification-indicator'; +import { TheiaNotificationOverlay } from '../theia-notification-overlay'; +import { TheiaQuickCommandPalette } from '../theia-quick-command-palette'; + +test.describe('Theia Quick Command', () => { + + let app: TheiaApp; + let quickCommand: TheiaQuickCommandPalette; + + test.beforeAll(async ({ playwright, browser }) => { + app = await TheiaAppLoader.load({ playwright, browser }); + quickCommand = app.quickCommandPalette; + }); + + test.afterAll(async () => { + await app.page.close(); + }); + + test('should show quick command palette', async () => { + await quickCommand.open(); + expect(await quickCommand.isOpen()).toBe(true); + await quickCommand.hide(); + expect(await quickCommand.isOpen()).toBe(false); + await quickCommand.open(); + expect(await quickCommand.isOpen()).toBe(true); + }); + + test('should trigger \'About\' command after typing', async () => { + await quickCommand.type('About'); + await quickCommand.trigger('About Theia'); + expect(await quickCommand.isOpen()).toBe(false); + const aboutDialog = new TheiaAboutDialog(app); + expect(await aboutDialog.isVisible()).toBe(true); + await aboutDialog.close(); + expect(await aboutDialog.isVisible()).toBe(false); + + await quickCommand.type('Select All'); + await quickCommand.trigger('Select All'); + expect(await quickCommand.isOpen()).toBe(false); + }); + + test('should trigger \'Toggle Explorer View\' command after typing', async () => { + await quickCommand.type('Toggle Exp'); + await quickCommand.trigger('View: Toggle Explorer'); + expect(await quickCommand.isOpen()).toBe(false); + const explorerView = new TheiaExplorerView(app); + expect(await explorerView.isDisplayed()).toBe(true); + }); + + test('should trigger \'Quick Input: Test Positive Integer\' command by confirming via Enter', async () => { + await quickCommand.type('Test Positive', true); + expect(await quickCommand.isOpen()).toBe(true); + await quickCommand.type('6', true); + const notificationIndicator = new TheiaNotificationIndicator(app); + const notification = new TheiaNotificationOverlay(app, notificationIndicator); + expect(await notification.isEntryVisible('Positive Integer: 6')).toBe(true); + }); + + test('retrieve and check visible items', async () => { + await quickCommand.type('close all tabs', false); + const listItems = await Promise.all((await quickCommand.visibleItems()).map(async item => item.textContent())); + expect(listItems).toContain('View: Close All Tabs in Main Area'); + }); + +}); diff --git a/examples/playwright/src/tests/theia-sample-app.test.ts b/examples/playwright/src/tests/theia-sample-app.test.ts new file mode 100644 index 0000000..48dd024 --- /dev/null +++ b/examples/playwright/src/tests/theia-sample-app.test.ts @@ -0,0 +1,66 @@ +// ***************************************************************************** +// Copyright (C) 2022 EclipseSource and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { expect, test } from '@playwright/test'; +import { TheiaApp } from '../theia-app'; +import { TheiaAppLoader } from '../theia-app-loader'; +import { TheiaToolbar } from '../theia-toolbar'; +import { TheiaWorkspace } from '../theia-workspace'; + +class TheiaSampleApp extends TheiaApp { + protected toolbar = new TheiaToolbar(this); + + override async waitForInitialized(): Promise { + await this.toolbar.show(); + } + + async toggleToolbar(): Promise { + await this.toolbar.toggle(); + } + + async isToolbarVisible(): Promise { + return this.toolbar.isShown(); + } +} + +test.describe('Theia Sample Application', () => { + + let app: TheiaSampleApp; + + test.beforeAll(async ({ playwright, browser }) => { + app = await TheiaAppLoader.load({ playwright, browser }, new TheiaWorkspace(), TheiaSampleApp); + }); + + test.afterAll(async () => { + await app.page.close(); + }); + + test('should start with visible toolbar', async () => { + expect(await app.isToolbarVisible()).toBe(true); + }); + + test('should toggle toolbar', async () => { + await app.toggleToolbar(); + expect(await app.isToolbarVisible()).toBe(false); + + await app.toggleToolbar(); + expect(await app.isToolbarVisible()).toBe(true); + + await app.toggleToolbar(); + expect(await app.isToolbarVisible()).toBe(false); + }); + +}); diff --git a/examples/playwright/src/tests/theia-status-bar.test.ts b/examples/playwright/src/tests/theia-status-bar.test.ts new file mode 100644 index 0000000..871e7c4 --- /dev/null +++ b/examples/playwright/src/tests/theia-status-bar.test.ts @@ -0,0 +1,52 @@ +// ***************************************************************************** +// Copyright (C) 2021 logi.cals GmbH, EclipseSource and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { expect, test } from '@playwright/test'; +import { TheiaApp } from '../theia-app'; +import { TheiaAppLoader } from '../theia-app-loader'; +import { TheiaNotificationIndicator } from '../theia-notification-indicator'; +import { TheiaProblemIndicator } from '../theia-problem-indicator'; +import { TheiaStatusBar } from '../theia-status-bar'; +import { TheiaToggleBottomIndicator } from '../theia-toggle-bottom-indicator'; + +test.describe('Theia Status Bar', () => { + + let app: TheiaApp; + let statusBar: TheiaStatusBar; + + test.beforeAll(async ({ playwright, browser }) => { + app = await TheiaAppLoader.load({ playwright, browser }); + statusBar = app.statusBar; + }); + + test.afterAll(async () => { + await app.page.close(); + }); + + test('should show status bar', async () => { + expect(await statusBar.isVisible()).toBe(true); + }); + + test('should contain status bar elements', async () => { + const problemIndicator = await statusBar.statusIndicator(TheiaProblemIndicator); + const notificationIndicator = await statusBar.statusIndicator(TheiaNotificationIndicator); + const toggleBottomIndicator = await statusBar.statusIndicator(TheiaToggleBottomIndicator); + expect(await problemIndicator.isVisible()).toBe(true); + expect(await notificationIndicator.isVisible()).toBe(true); + expect(await toggleBottomIndicator.isVisible()).toBe(true); + }); + +}); diff --git a/examples/playwright/src/tests/theia-terminal-view.test.ts b/examples/playwright/src/tests/theia-terminal-view.test.ts new file mode 100644 index 0000000..ad163a0 --- /dev/null +++ b/examples/playwright/src/tests/theia-terminal-view.test.ts @@ -0,0 +1,91 @@ +// ***************************************************************************** +// Copyright (C) 2023 EclipseSource and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { expect, test } from '@playwright/test'; +import * as path from 'path'; +import { TheiaApp } from '../theia-app'; +import { TheiaAppLoader } from '../theia-app-loader'; +import { TheiaWorkspace } from '../theia-workspace'; +import { TheiaTerminal } from '../theia-terminal'; + +let app: TheiaApp; + +test.describe('Theia Terminal View', () => { + + test.beforeAll(async ({ playwright, browser }) => { + const ws = new TheiaWorkspace([path.resolve(__dirname, '../../src/tests/resources/sample-files1')]); + app = await TheiaAppLoader.load({ playwright, browser }, ws); + }); + + test.afterAll(async () => { + await app.page.close(); + }); + + test('should be possible to open a new terminal', async () => { + const terminal = await app.openTerminal(TheiaTerminal); + expect(await terminal.isTabVisible()).toBe(true); + expect(await terminal.isDisplayed()).toBe(true); + expect(await terminal.isActive()).toBe(true); + }); + + test('should be possible to open two terminals, switch among them, and close them', async () => { + const terminal1 = await app.openTerminal(TheiaTerminal); + const terminal2 = await app.openTerminal(TheiaTerminal); + const allTerminals = [terminal1, terminal2]; + + // all terminal tabs should be visible + for (const terminal of allTerminals) { + expect(await terminal.isTabVisible()).toBe(true); + } + + // activate one terminal after the other and check that only this terminal is active + for (const terminal of allTerminals) { + await terminal.activate(); + expect(await terminal1.isActive()).toBe(terminal1 === terminal); + expect(await terminal2.isActive()).toBe(terminal2 === terminal); + } + + // close all terminals + for (const terminal of allTerminals) { + await terminal.activate(); + await terminal.close(); + } + + // check that all terminals are closed + for (const terminal of allTerminals) { + expect(await terminal.isTabVisible()).toBe(false); + } + }); + + test('should allow to write and read terminal contents', async () => { + const terminal = await app.openTerminal(TheiaTerminal); + await terminal.write('hello'); + const contents = await terminal.contents(); + expect(contents).toContain('hello'); + }); + + test('should allow to submit a command and read output', async () => { + const terminal = await app.openTerminal(TheiaTerminal); + if (process.platform === 'win32') { + await terminal.submit('dir'); + } else { + await terminal.submit('ls'); + } + const contents = await terminal.contents(); + expect(contents).toContain('sample.txt'); + }); + +}); diff --git a/examples/playwright/src/tests/theia-text-editor.test.ts b/examples/playwright/src/tests/theia-text-editor.test.ts new file mode 100644 index 0000000..00eb09e --- /dev/null +++ b/examples/playwright/src/tests/theia-text-editor.test.ts @@ -0,0 +1,190 @@ +// ***************************************************************************** +// Copyright (C) 2021 logi.cals GmbH, EclipseSource and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { expect, test } from '@playwright/test'; +import * as path from 'path'; +import { TheiaApp } from '../theia-app'; +import { TheiaAppLoader } from '../theia-app-loader'; +import { DefaultPreferences, PreferenceIds, TheiaPreferenceView } from '../theia-preference-view'; +import { TheiaTextEditor } from '../theia-text-editor'; +import { TheiaWorkspace } from '../theia-workspace'; + +test.describe('Theia Text Editor', () => { + + let app: TheiaApp; + + test.beforeAll(async ({ playwright, browser }) => { + const ws = new TheiaWorkspace([path.resolve(__dirname, '../../src/tests/resources/sample-files1')]); + app = await TheiaAppLoader.load({ playwright, browser }, ws); + + // set auto-save preference to off + const preferenceView = await app.openPreferences(TheiaPreferenceView); + await preferenceView.setOptionsPreferenceById(PreferenceIds.Editor.AutoSave, DefaultPreferences.Editor.AutoSave.Off); + await preferenceView.close(); + }); + + test.afterAll(async () => { + await app.page.close(); + }); + + test('should be visible and active after opening "sample.txt"', async () => { + const sampleTextEditor = await app.openEditor('sample.txt', TheiaTextEditor); + expect(await sampleTextEditor.isTabVisible()).toBe(true); + expect(await sampleTextEditor.isDisplayed()).toBe(true); + expect(await sampleTextEditor.isActive()).toBe(true); + }); + + test('should be possible to open "sample.txt" when already opened and then close it', async () => { + const sampleTextEditor = await app.openEditor('sample.txt', TheiaTextEditor); + expect(await sampleTextEditor.isTabVisible()).toBe(true); + + await sampleTextEditor.close(); + expect(await sampleTextEditor.isTabVisible()).toBe(false); + }); + + test('should be possible to open four text editors, switch among them, and close them', async () => { + const textEditor1_1_1 = await app.openEditor('sampleFolder/sampleFolder1/sampleFolder1-1/sampleFile1-1-1.txt', TheiaTextEditor); + const textEditor1_1_2 = await app.openEditor('sampleFolder/sampleFolder1/sampleFolder1-1/sampleFile1-1-2.txt', TheiaTextEditor); + const textEditor1_2_1 = await app.openEditor('sampleFolder/sampleFolder1/sampleFolder1-2/sampleFile1-2-1.txt', TheiaTextEditor); + const textEditor1_2_2 = await app.openEditor('sampleFolder/sampleFolder1/sampleFolder1-2/sampleFile1-2-2.txt', TheiaTextEditor); + const allEditors = [textEditor1_1_1, textEditor1_1_2, textEditor1_2_1, textEditor1_2_2]; + + // all editor tabs should be visible + for (const editor of allEditors) { + expect(await editor.isTabVisible()).toBe(true); + } + + // activate one editor after the other and check that only this editor is active + for (const editor of allEditors) { + await editor.activate(); + expect(await textEditor1_1_1.isActive()).toBe(textEditor1_1_1 === editor); + expect(await textEditor1_1_2.isActive()).toBe(textEditor1_1_2 === editor); + expect(await textEditor1_2_1.isActive()).toBe(textEditor1_2_1 === editor); + expect(await textEditor1_2_2.isActive()).toBe(textEditor1_2_2 === editor); + } + + // close all editors + for (const editor of allEditors) { + await editor.activate(); + await editor.close(); + } + + // check that all editors are closed + for (const editor of allEditors) { + expect(await editor.isTabVisible()).toBe(false); + } + }); + + test('should return the contents of lines by line number', async () => { + const sampleTextEditor = await app.openEditor('sample.txt', TheiaTextEditor); + expect(await sampleTextEditor.textContentOfLineByLineNumber(2)).toBe('content line 2'); + expect(await sampleTextEditor.textContentOfLineByLineNumber(3)).toBe('content line 3'); + expect(await sampleTextEditor.textContentOfLineByLineNumber(4)).toBe('content line 4'); + await sampleTextEditor.close(); + }); + + test('should return the contents of lines containing text', async () => { + const sampleTextEditor = await app.openEditor('sample.txt', TheiaTextEditor); + expect(await sampleTextEditor.textContentOfLineContainingText('line 2')).toBe('content line 2'); + expect(await sampleTextEditor.textContentOfLineContainingText('line 3')).toBe('content line 3'); + expect(await sampleTextEditor.textContentOfLineContainingText('line 4')).toBe('content line 4'); + await sampleTextEditor.close(); + }); + + test('should be dirty after changing the file contents and clean after save', async () => { + const sampleTextEditor = await app.openEditor('sample.txt', TheiaTextEditor); + await sampleTextEditor.replaceLineWithLineNumber('this is just a sample file', 1); + expect(await sampleTextEditor.isDirty()).toBe(true); + + await sampleTextEditor.save(); + expect(await sampleTextEditor.isDirty()).toBe(false); + await sampleTextEditor.close(); + }); + + test('should replace the line with line number 2 with new text "new -- content line 2 -- new"', async () => { + const sampleTextEditor = await app.openEditor('sample.txt', TheiaTextEditor); + await sampleTextEditor.replaceLineWithLineNumber('new -- content line 2 -- new', 2); + expect(await sampleTextEditor.textContentOfLineByLineNumber(2)).toBe('new -- content line 2 -- new'); + expect(await sampleTextEditor.isDirty()).toBe(true); + + await sampleTextEditor.save(); + expect(await sampleTextEditor.isDirty()).toBe(false); + await sampleTextEditor.close(); + }); + + test('should replace the line with containing text "content line 2" with "even newer -- content line 2 -- even newer"', async () => { + const sampleTextEditor = await app.openEditor('sample.txt', TheiaTextEditor); + await sampleTextEditor.replaceLineContainingText('even newer -- content line 2 -- even newer', 'content line 2'); + expect(await sampleTextEditor.textContentOfLineByLineNumber(2)).toBe('even newer -- content line 2 -- even newer'); + await sampleTextEditor.saveAndClose(); + }); + + test('should delete the line with containing text "content line 2"', async () => { + const sampleTextEditor = await app.openEditor('sample.txt', TheiaTextEditor); + await sampleTextEditor.deleteLineContainingText('content line 2'); + expect(await sampleTextEditor.textContentOfLineByLineNumber(2)).toBe('content line 3'); + await sampleTextEditor.saveAndClose(); + }); + + test('should delete the line with line number 2', async () => { + const sampleTextEditor = await app.openEditor('sample.txt', TheiaTextEditor); + const lineBelowSecond = await sampleTextEditor.textContentOfLineByLineNumber(3); + await sampleTextEditor.deleteLineByLineNumber(2); + expect(await sampleTextEditor.textContentOfLineByLineNumber(2)).toBe(lineBelowSecond); + await sampleTextEditor.saveAndClose(); + }); + + test('should have more lines after adding text in new line after line containing text "sample file"', async () => { + const sampleTextEditor = await app.openEditor('sample.txt', TheiaTextEditor); + const numberOfLinesBefore = await sampleTextEditor.numberOfLines(); + + await sampleTextEditor.addTextToNewLineAfterLineContainingText('sample file', 'new content for line 2'); + const numberOfLinesAfter = await sampleTextEditor.numberOfLines(); + expect(numberOfLinesBefore).not.toBeUndefined(); + expect(numberOfLinesAfter).not.toBeUndefined(); + expect(numberOfLinesAfter).toBeGreaterThan(numberOfLinesBefore!); + + await sampleTextEditor.saveAndClose(); + }); + + test('should undo and redo text changes with correctly updated dirty states', async () => { + const sampleTextEditor = await app.openEditor('sample.txt', TheiaTextEditor); + await sampleTextEditor.replaceLineWithLineNumber('change', 1); + expect(await sampleTextEditor.textContentOfLineByLineNumber(1)).toBe('change'); + expect(await sampleTextEditor.isDirty()).toBe(true); + + await sampleTextEditor.undo(2); + expect(await sampleTextEditor.textContentOfLineByLineNumber(1)).toBe('this is just a sample file'); + expect(await sampleTextEditor.isDirty()).toBe(false); + + await sampleTextEditor.redo(2); + expect(await sampleTextEditor.textContentOfLineByLineNumber(1)).toBe('change'); + expect(await sampleTextEditor.isDirty()).toBe(true); + + await sampleTextEditor.saveAndClose(); + }); + + test('should close without saving', async () => { + const sampleTextEditor = await app.openEditor('sample.txt', TheiaTextEditor); + await sampleTextEditor.replaceLineWithLineNumber('change again', 1); + expect(await sampleTextEditor.isDirty()).toBe(true); + + expect(await sampleTextEditor.isTabVisible()).toBe(true); + await sampleTextEditor.closeWithoutSave(); + expect(await sampleTextEditor.isTabVisible()).toBe(false); + }); + +}); diff --git a/examples/playwright/src/tests/theia-toolbar.test.ts b/examples/playwright/src/tests/theia-toolbar.test.ts new file mode 100644 index 0000000..d7ea27a --- /dev/null +++ b/examples/playwright/src/tests/theia-toolbar.test.ts @@ -0,0 +1,69 @@ +// ***************************************************************************** +// Copyright (C) 2023 EclipseSource and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { expect, test } from '@playwright/test'; +import { TheiaApp } from '../theia-app'; +import { TheiaAppLoader } from '../theia-app-loader'; +import { TheiaToolbar } from '../theia-toolbar'; + +let app: TheiaApp; +let toolbar: TheiaToolbar; + +test.describe('Theia Toolbar', () => { + + test.beforeAll(async ({ playwright, browser }) => { + app = await TheiaAppLoader.load({ playwright, browser }); + toolbar = new TheiaToolbar(app); + }); + + test.afterAll(async () => { + await app.page.close(); + }); + + test('should toggle the toolbar and check visibility', async () => { + // depending on the user settings we have different starting conditions for the toolbar + const isShownInitially = await toolbar.isShown(); + expect(await toolbar.isShown()).toBe(isShownInitially); + await toolbar.toggle(); + expect(await toolbar.isShown()).toBe(!isShownInitially); + await toolbar.hide(); + expect(await toolbar.isShown()).toBe(false); + await toolbar.show(); + expect(await toolbar.isShown()).toBe(true); + }); + + test('should show the default toolbar tools of the sample Theia application', async () => { + expect(await toolbar.toolbarItems()).toHaveLength(5); + expect(await toolbar.toolbarItemIds()).toStrictEqual([ + 'textEditor.commands.go.back', + 'textEditor.commands.go.forward', + 'workbench.action.splitEditorRight', + 'theia-sample-toolbar-contribution', + 'workbench.action.showCommands' + ]); + }); + + test('should trigger the "Command Palette" toolbar tool as expect the command palette to open', async () => { + const commandPaletteTool = await toolbar.toolBarItem('workbench.action.showCommands'); + expect(commandPaletteTool).toBeDefined; + expect(await commandPaletteTool!.isEnabled()).toBe(true); + + await commandPaletteTool!.trigger(); + expect(await app.quickCommandPalette.isOpen()).toBe(true); + await app.quickCommandPalette.hide(); + expect(await app.quickCommandPalette.isOpen()).toBe(false); + }); +}); diff --git a/examples/playwright/src/tests/theia-workspace.test.ts b/examples/playwright/src/tests/theia-workspace.test.ts new file mode 100644 index 0000000..f3b82b9 --- /dev/null +++ b/examples/playwright/src/tests/theia-workspace.test.ts @@ -0,0 +1,83 @@ +// ***************************************************************************** +// Copyright (C) 2021 logi.cals GmbH, EclipseSource and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { expect, test } from '@playwright/test'; +import * as path from 'path'; +import { TheiaAppLoader } from '../theia-app-loader'; +import { DOT_FILES_FILTER, TheiaExplorerView } from '../theia-explorer-view'; +import { TheiaWorkspace } from '../theia-workspace'; + +test.describe('Theia Workspace', () => { + let isElectron: boolean; + test.beforeAll(async ({ playwright, browser }) => { + isElectron = process.env.USE_ELECTRON === 'true'; + }); + + test('should be initialized empty by default', async ({ playwright, browser }) => { + if (!isElectron) { + const app = await TheiaAppLoader.load({ playwright, browser }); + const explorer = await app.openView(TheiaExplorerView); + const fileStatElements = await explorer.visibleFileStatNodes(DOT_FILES_FILTER); + expect(fileStatElements.length).toBe(0); + await app.page.close(); + } + }); + + test('should be initialized with the contents of a file location', async ({ playwright, browser }) => { + const ws = new TheiaWorkspace([path.resolve(__dirname, '../../src/tests/resources/sample-files1')]); + const app = await TheiaAppLoader.load({ playwright, browser }, ws); + const explorer = await app.openView(TheiaExplorerView); + // resources/sample-files1 contains two folders and one file + expect(await explorer.existsDirectoryNode('sampleFolder')).toBe(true); + expect(await explorer.existsDirectoryNode('sampleFolderCompact')).toBe(true); + expect(await explorer.existsFileNode('sample.txt')).toBe(true); + await app.page.close(); + }); + + test('should be initialized with the contents of multiple file locations', async ({ playwright, browser }) => { + const ws = new TheiaWorkspace([ + path.resolve(__dirname, '../../src/tests/resources/sample-files1'), + path.resolve(__dirname, '../../src/tests/resources/sample-files2')]); + const app = await TheiaAppLoader.load({ playwright, browser }, ws); + const explorer = await app.openView(TheiaExplorerView); + // resources/sample-files1 contains two folders and one file + expect(await explorer.existsDirectoryNode('sampleFolder')).toBe(true); + expect(await explorer.existsDirectoryNode('sampleFolderCompact')).toBe(true); + expect(await explorer.existsFileNode('sample.txt')).toBe(true); + // resources/sample-files2 contains one file + expect(await explorer.existsFileNode('another-sample.txt')).toBe(true); + await app.page.close(); + }); + + test('open sample.txt via file menu', async ({ playwright, browser }) => { + const ws = new TheiaWorkspace([path.resolve(__dirname, '../../src/tests/resources/sample-files1')]); + const app = await TheiaAppLoader.load({ playwright, browser }, ws); + const menuEntry = app.isElectron ? 'Open File...' : 'Open...'; + + await (await app.menuBar.openMenu('File')).clickMenuItem(menuEntry); + const fileDialog = await app.page.waitForSelector('div[class="dialogBlock"]'); + expect(await fileDialog.isVisible()).toBe(true); + + const fileEntry = app.page.getByText('sample.txt'); + await fileEntry.click(); + await app.page.locator('#theia-dialog-shell').getByRole('button', { name: 'Open' }).click(); + + const span = await app.page.waitForSelector('span:has-text("content line 2")'); + expect(await span.isVisible()).toBe(true); + await app.page.close(); + }); + +}); diff --git a/examples/playwright/src/theia-about-dialog.ts b/examples/playwright/src/theia-about-dialog.ts new file mode 100644 index 0000000..99c9159 --- /dev/null +++ b/examples/playwright/src/theia-about-dialog.ts @@ -0,0 +1,26 @@ +// ***************************************************************************** +// Copyright (C) 2021 logi.cals GmbH, EclipseSource and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { TheiaDialog } from './theia-dialog'; + +export class TheiaAboutDialog extends TheiaDialog { + + override async isVisible(): Promise { + const dialog = await this.page.$(`${this.blockSelector} .theia-aboutDialog`); + return !!dialog && dialog.isVisible(); + } + +} diff --git a/examples/playwright/src/theia-app-loader.ts b/examples/playwright/src/theia-app-loader.ts new file mode 100644 index 0000000..9a5294f --- /dev/null +++ b/examples/playwright/src/theia-app-loader.ts @@ -0,0 +1,163 @@ +// ***************************************************************************** +// Copyright (C) 2022 STMicroelectronics and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { Page, PlaywrightWorkerArgs, _electron as electron } from '@playwright/test'; +import { TheiaApp } from './theia-app'; +import { TheiaWorkspace } from './theia-workspace'; + +export interface TheiaAppFactory { + new(page: Page, initialWorkspace: TheiaWorkspace, isElectron?: boolean): T; +} + +// TODO this is just a sketch, we need a proper way to configure tests and pass this configuration to the `TheiaAppLoader`: +export interface TheiaPlaywrightTestConfig { + useElectron?: { + /** Path to the Theia Electron app package (absolute or relative to this package). */ + electronAppPath?: string, + /** Path to the folder containing the plugins to load (absolute or relative to this package). */ + pluginsPath?: string, + // eslint-disable-next-line max-len + /** Electron launch options as [specified by Playwright](https://github.com/microsoft/playwright/blob/396487fc4c19bf27554eac9beea9db135e96cfb4/packages/playwright-core/types/types.d.ts#L14182). */ + launchOptions?: object, + } +} + +function theiaAppFactory(factory?: TheiaAppFactory): TheiaAppFactory { + return (factory ?? TheiaApp) as TheiaAppFactory; +} + +function initializeWorkspace(initialWorkspace?: TheiaWorkspace): TheiaWorkspace { + const workspace = initialWorkspace ? initialWorkspace : new TheiaWorkspace(); + workspace.initialize(); + return workspace; +} + +namespace TheiaBrowserAppLoader { + + export async function load( + page: Page, + initialWorkspace?: TheiaWorkspace, + factory?: TheiaAppFactory + ): Promise { + const workspace = initializeWorkspace(initialWorkspace); + return createAndLoad(page, workspace, factory); + } + + async function createAndLoad( + page: Page, + workspace: TheiaWorkspace, + factory?: TheiaAppFactory + ): Promise { + const appFactory = theiaAppFactory(factory); + const app = new appFactory(page, workspace, false); + await loadOrReload(app, '/#' + app.workspace.pathAsPathComponent); + await app.waitForShellAndInitialized(); + return app; + } + + async function loadOrReload(app: TheiaApp, url: string): Promise { + if (app.page.url() === url) { + await app.page.reload(); + } else { + const wasLoadedAlready = await app.isShellVisible(); + await app.page.goto(url); + if (wasLoadedAlready) { + // Theia doesn't refresh on URL change only + // So we need to reload if the app was already loaded before + await app.page.reload(); + } + } + } +} + +namespace TheiaElectronAppLoader { + + export async function load( + args: TheiaPlaywrightTestConfig & PlaywrightWorkerArgs, + initialWorkspace?: TheiaWorkspace, + factory?: TheiaAppFactory, + ): Promise { + const workspace = initializeWorkspace(initialWorkspace); + const electronConfig = args.useElectron ?? { + electronAppPath: '../electron', + pluginsPath: '../../plugins' + }; + if (electronConfig === undefined || electronConfig.launchOptions === undefined && electronConfig.electronAppPath === undefined) { + throw Error('The Theia Playwright configuration must either specify `useElectron.electronAppPath` or `useElectron.launchOptions`'); + } + const appPath = electronConfig.electronAppPath!; + const pluginsPath = electronConfig.pluginsPath; + const launchOptions = electronConfig.launchOptions ?? { + additionalArgs: ['--no-sandbox', '--no-cluster'], + electronAppPath: appPath, + pluginsPath: pluginsPath + }; + const playwrightOptions = toPlaywrightOptions(launchOptions, workspace); + console.log(`Launching Electron with options: ${JSON.stringify(playwrightOptions)}`); + const electronApp = await electron.launch(playwrightOptions); + const page = await electronApp.firstWindow(); + + const appFactory = theiaAppFactory(factory); + const app = new appFactory(page, workspace, true); + await app.waitForShellAndInitialized(); + return app; + } + + export function toPlaywrightOptions( + electronLaunchOptions: { additionalArgs: string[], electronAppPath: string, pluginsPath?: string } | object, + workspace?: TheiaWorkspace + ): { + args: string[] + } | object { + if ('additionalArgs' in electronLaunchOptions && 'electronAppPath' in electronLaunchOptions) { + const args = [ + electronLaunchOptions.electronAppPath, + ...electronLaunchOptions.additionalArgs, + `--app-project-path=${electronLaunchOptions.electronAppPath}` + ]; + if (electronLaunchOptions.pluginsPath) { + args.push(`--plugins=local-dir:${electronLaunchOptions.pluginsPath}`); + } + if (workspace) { + args.push(workspace.path); + } + + return { + args: args + }; + } + return electronLaunchOptions; + } +} + +export namespace TheiaAppLoader { + + export async function load( + args: TheiaPlaywrightTestConfig & PlaywrightWorkerArgs, + initialWorkspace?: TheiaWorkspace, + factory?: TheiaAppFactory, + ): Promise { + if (process.env.USE_ELECTRON === 'true') { + // disable native elements and early window to avoid issues with the electron app + process.env.THEIA_ELECTRON_DISABLE_NATIVE_ELEMENTS = '1'; + process.env.THEIA_ELECTRON_NO_EARLY_WINDOW = '1'; + process.env.THEIA_NO_SPLASH = 'true'; + return TheiaElectronAppLoader.load(args, initialWorkspace, factory); + } + const page = await args.browser.newPage(); + return TheiaBrowserAppLoader.load(page, initialWorkspace, factory); + } +} diff --git a/examples/playwright/src/theia-app.ts b/examples/playwright/src/theia-app.ts new file mode 100644 index 0000000..9708321 --- /dev/null +++ b/examples/playwright/src/theia-app.ts @@ -0,0 +1,189 @@ +// ***************************************************************************** +// Copyright (C) 2021-2023 logi.cals GmbH, EclipseSource and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { Page } from '@playwright/test'; +import { TheiaEditor } from './theia-editor'; +import { DOT_FILES_FILTER, TheiaExplorerView } from './theia-explorer-view'; +import { TheiaMenuBar } from './theia-main-menu'; +import { TheiaPreferenceScope, TheiaPreferenceView } from './theia-preference-view'; +import { TheiaQuickCommandPalette } from './theia-quick-command-palette'; +import { TheiaStatusBar } from './theia-status-bar'; +import { TheiaTerminal } from './theia-terminal'; +import { TheiaView } from './theia-view'; +import { TheiaWorkspace } from './theia-workspace'; + +export interface TheiaAppData { + loadingSelector: string; + shellSelector: string; +}; + +export const DefaultTheiaAppData: TheiaAppData = { + loadingSelector: '.theia-preload', + shellSelector: '.theia-ApplicationShell' +}; + +export class TheiaApp { + + statusBar: TheiaStatusBar; + quickCommandPalette: TheiaQuickCommandPalette; + menuBar: TheiaMenuBar; + + protected appData = DefaultTheiaAppData; + + public constructor( + public page: Page, + public workspace: TheiaWorkspace, + public isElectron: boolean, + ) { + this.statusBar = this.createStatusBar(); + this.quickCommandPalette = this.createQuickCommandPalette(); + this.menuBar = this.createMenuBar(); + } + + protected createStatusBar(): TheiaStatusBar { + return new TheiaStatusBar(this); + } + + protected createQuickCommandPalette(): TheiaQuickCommandPalette { + return new TheiaQuickCommandPalette(this); + } + + protected createMenuBar(): TheiaMenuBar { + return new TheiaMenuBar(this); + } + + async isShellVisible(): Promise { + return this.page.isVisible(this.appData.shellSelector); + } + + async waitForShellAndInitialized(): Promise { + await this.page.waitForSelector(this.appData.loadingSelector, { state: 'detached' }); + await this.page.waitForSelector(this.appData.shellSelector); + await this.waitForInitialized(); + } + + async isMainContentPanelVisible(): Promise { + const contentPanel = await this.page.$('#theia-main-content-panel'); + return !!contentPanel && contentPanel.isVisible(); + } + + async openPreferences(viewFactory: { new(app: TheiaApp): TheiaPreferenceView }, preferenceScope = TheiaPreferenceScope.Workspace): Promise { + const view = new viewFactory(this); + if (await view.isTabVisible()) { + await view.activate(); + return view; + } + await view.open(preferenceScope); + return view; + } + + async openView(viewFactory: { new(app: TheiaApp): T }): Promise { + const view = new viewFactory(this); + if (await view.isTabVisible()) { + await view.activate(); + return view; + } + await view.open(); + return view; + } + + async openEditor(filePath: string, + editorFactory: { new(fp: string, app: TheiaApp): T }, + editorName?: string, expectFileNodes = true): Promise { + const explorer = await this.openView(TheiaExplorerView); + if (!explorer) { + throw Error('TheiaExplorerView could not be opened.'); + } + if (expectFileNodes) { + await explorer.waitForVisibleFileNodes(); + const fileStatElements = await explorer.visibleFileStatNodes(DOT_FILES_FILTER); + if (fileStatElements.length < 1) { + throw Error('TheiaExplorerView is empty.'); + } + } + const fileNode = await explorer.fileStatNode(filePath); + if (!fileNode || ! await fileNode?.isFile()) { + throw Error(`Specified path '${filePath}' could not be found or isn't a file.`); + } + + const editor = new editorFactory(filePath, this); + const contextMenu = await fileNode.openContextMenu(); + const editorToUse = editorName ? editorName : editor.name ? editor.name : undefined; + if (editorToUse) { + const menuItem = await contextMenu.menuItemByNamePath('Open With', editorToUse); + if (!menuItem) { + throw Error(`Editor named '${editorName}' could not be found in "Open With" menu.`); + } + await menuItem.click(); + } else { + await contextMenu.clickMenuItem('Open'); + } + + await editor.waitForVisible(); + return editor; + } + + async activateExistingEditor(filePath: string, editorFactory: { new(fp: string, app: TheiaApp): T }): Promise { + const editor = new editorFactory(filePath, this); + if (!await editor.isTabVisible()) { + throw new Error(`Could not find opened editor for file ${filePath}`); + } + await editor.activate(); + await editor.waitForVisible(); + return editor; + } + + async openTerminal(terminalFactory: { new(id: string, app: TheiaApp): T }): Promise { + const mainMenu = await this.menuBar.openMenu('Terminal'); + const menuItem = await mainMenu.menuItemByName('New Terminal'); + if (!menuItem) { + throw Error('Menu item \'New Terminal\' could not be found.'); + } + + const newTabIds = await this.runAndWaitForNewTabs(() => menuItem.click()); + if (newTabIds.length > 1) { + console.warn('More than one new tab detected after opening the terminal'); + } + + return new terminalFactory(newTabIds[0], this); + } + + protected async runAndWaitForNewTabs(command: () => Promise): Promise { + const tabIdsBefore = await this.visibleTabIds(); + await command(); + return (await this.waitForNewTabs(tabIdsBefore)).filter(item => !tabIdsBefore.includes(item)); + } + + protected async waitForNewTabs(tabIds: string[]): Promise { + let tabIdsCurrent: string[]; + while ((tabIdsCurrent = (await this.visibleTabIds())).length <= tabIds.length) { + console.debug('Awaiting a new tab to appear'); + } + return tabIdsCurrent; + } + + protected async visibleTabIds(): Promise { + const tabs = await this.page.$$('.lm-TabBar-tab'); + const tabIds = (await Promise.all(tabs.map(tab => tab.getAttribute('id')))).filter(id => !!id); + return tabIds as string[]; + } + + /** Specific Theia apps may add additional conditions to wait for. */ + async waitForInitialized(): Promise { + // empty by default + } + +} diff --git a/examples/playwright/src/theia-context-menu.ts b/examples/playwright/src/theia-context-menu.ts new file mode 100644 index 0000000..20208ed --- /dev/null +++ b/examples/playwright/src/theia-context-menu.ts @@ -0,0 +1,42 @@ +// ***************************************************************************** +// Copyright (C) 2021 logi.cals GmbH, EclipseSource and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { ElementHandle } from '@playwright/test'; + +import { TheiaApp } from './theia-app'; +import { TheiaMenu } from './theia-menu'; + +export class TheiaContextMenu extends TheiaMenu { + + public static async openAt(app: TheiaApp, x: number, y: number): Promise { + await app.page.mouse.move(x, y); + await app.page.mouse.click(x, y, { button: 'right' }); + return TheiaContextMenu.returnWhenVisible(app); + } + + public static async open(app: TheiaApp, element: () => Promise>): Promise { + const elementHandle = await element(); + await elementHandle.click({ button: 'right' }); + return TheiaContextMenu.returnWhenVisible(app); + } + + private static async returnWhenVisible(app: TheiaApp): Promise { + const menu = new TheiaContextMenu(app); + await menu.waitForVisible(); + return menu; + } + +} diff --git a/examples/playwright/src/theia-dialog.ts b/examples/playwright/src/theia-dialog.ts new file mode 100644 index 0000000..1ec7557 --- /dev/null +++ b/examples/playwright/src/theia-dialog.ts @@ -0,0 +1,114 @@ +// ***************************************************************************** +// Copyright (C) 2021 logi.cals GmbH, EclipseSource and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { ElementHandle } from '@playwright/test'; +import { TheiaPageObject } from './theia-page-object'; + +export class TheiaDialog extends TheiaPageObject { + + protected overlaySelector = '#theia-dialog-shell'; + protected blockSelector = this.overlaySelector + ' .dialogBlock'; + protected titleBarSelector = this.blockSelector + ' .dialogTitle'; + protected titleSelector = this.titleBarSelector + ' > div'; + protected contentSelector = this.blockSelector + ' .dialogContent > div'; + protected controlSelector = this.blockSelector + ' .dialogControl'; + protected errorSelector = this.blockSelector + ' .dialogContent'; + + async waitForVisible(): Promise { + await this.page.waitForSelector(`${this.blockSelector}`, { state: 'visible' }); + } + + async waitForClosed(): Promise { + await this.page.waitForSelector(`${this.blockSelector}`, { state: 'detached' }); + } + + async isVisible(): Promise { + const pouDialogElement = await this.page.$(this.blockSelector); + return pouDialogElement ? pouDialogElement.isVisible() : false; + } + + async title(): Promise { + const titleElement = await this.page.waitForSelector(`${this.titleSelector}`); + return titleElement.textContent(); + } + + async waitUntilTitleIsDisplayed(title: string): Promise { + await this.page.waitForFunction(predicate => { + const element = document.querySelector(predicate.titleSelector); + return !!element && element.textContent === predicate.expectedTitle; + }, { titleSelector: this.titleSelector, expectedTitle: title }); + } + + protected async contentElement(): Promise> { + return this.page.waitForSelector(this.contentSelector); + } + + protected async buttonElement(label: string): Promise> { + return this.page.waitForSelector(`${this.controlSelector} button:has-text("${label}")`); + } + + protected async buttonElementByClass(buttonClass: string): Promise> { + return this.page.waitForSelector(`${this.controlSelector} button${buttonClass}`); + } + + protected async validationElement(): Promise> { + return this.page.waitForSelector(`${this.errorSelector} div.error`, { state: 'attached' }); + } + + async getValidationText(): Promise { + const element = await this.validationElement(); + return element.textContent(); + } + + async validationResult(): Promise { + const validationText = await this.getValidationText(); + return validationText !== '' ? false : true; + } + + async close(): Promise { + const closeButton = await this.page.waitForSelector(`${this.titleBarSelector} i.closeButton`); + await closeButton.click(); + await this.waitForClosed(); + } + + async clickButton(buttonLabel: string): Promise { + const buttonElement = await this.buttonElement(buttonLabel); + await buttonElement.click(); + } + + async isButtonDisabled(buttonLabel: string): Promise { + const buttonElement = await this.buttonElement(buttonLabel); + return buttonElement.isDisabled(); + } + + async clickMainButton(): Promise { + const buttonElement = await this.buttonElementByClass('.theia-button.main'); + await buttonElement.click(); + } + + async clickSecondaryButton(): Promise { + const buttonElement = await this.buttonElementByClass('.theia-button.secondary'); + await buttonElement.click(); + } + + async waitUntilMainButtonIsEnabled(): Promise { + await this.page.waitForFunction(predicate => { + const button = document.querySelector(predicate.buttonSelector); + return !!button && !button.disabled; + }, { buttonSelector: `${this.controlSelector} > button.theia-button.main` }); + } + +} diff --git a/examples/playwright/src/theia-editor.ts b/examples/playwright/src/theia-editor.ts new file mode 100644 index 0000000..005328b --- /dev/null +++ b/examples/playwright/src/theia-editor.ts @@ -0,0 +1,73 @@ +// ***************************************************************************** +// Copyright (C) 2021 logi.cals GmbH, EclipseSource and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { TheiaDialog } from './theia-dialog'; +import { TheiaView } from './theia-view'; +import { containsClass } from './util'; + +export abstract class TheiaEditor extends TheiaView { + + async isDirty(): Promise { + return await this.isTabVisible() && containsClass(this.tabElement(), 'theia-mod-dirty'); + } + + async save(): Promise { + await this.activate(); + if (!await this.isDirty()) { + return; + } + const fileMenu = await this.app.menuBar.openMenu('File'); + const saveItem = await fileMenu.menuItemByName('Save'); + await saveItem?.click(); + await this.page.waitForSelector(this.tabSelector + '.theia-mod-dirty', { state: 'detached' }); + } + + async closeWithoutSave(): Promise { + if (!await this.isDirty()) { + return super.close(true); + } + await super.close(false); + const saveDialog = new TheiaDialog(this.app); + await saveDialog.clickButton('Don\'t save'); + await super.waitUntilClosed(); + } + + async saveAndClose(): Promise { + await this.save(); + await this.close(); + } + + async undo(times = 1): Promise { + await this.activate(); + for (let i = 0; i < times; i++) { + const editMenu = await this.app.menuBar.openMenu('Edit'); + const undoItem = await editMenu.menuItemByName('Undo'); + await undoItem?.click(); + await this.app.page.waitForTimeout(200); + } + } + + async redo(times = 1): Promise { + await this.activate(); + for (let i = 0; i < times; i++) { + const editMenu = await this.app.menuBar.openMenu('Edit'); + const undoItem = await editMenu.menuItemByName('Redo'); + await undoItem?.click(); + await this.app.page.waitForTimeout(200); + } + } + +} diff --git a/examples/playwright/src/theia-explorer-view.ts b/examples/playwright/src/theia-explorer-view.ts new file mode 100644 index 0000000..180a433 --- /dev/null +++ b/examples/playwright/src/theia-explorer-view.ts @@ -0,0 +1,311 @@ +// ***************************************************************************** +// Copyright (C) 2021 logi.cals GmbH, EclipseSource and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { ElementHandle } from '@playwright/test'; +import { TheiaApp } from './theia-app'; +import { TheiaDialog } from './theia-dialog'; +import { TheiaMenuItem } from './theia-menu-item'; +import { TheiaRenameDialog } from './theia-rename-dialog'; +import { TheiaTreeNode } from './theia-tree-node'; +import { TheiaView } from './theia-view'; +import { elementContainsClass, normalizeId, OSUtil } from './util'; + +const TheiaExplorerViewData = { + tabSelector: '#shell-tab-explorer-view-container', + viewSelector: '#explorer-view-container--files', + viewName: 'Explorer' +}; + +export class TheiaExplorerFileStatNode extends TheiaTreeNode { + + constructor(protected override elementHandle: ElementHandle, protected explorerView: TheiaExplorerView) { + super(elementHandle, explorerView.app); + } + + async absolutePath(): Promise { + return this.elementHandle.getAttribute('title'); + } + + async isFile(): Promise { + return ! await this.isFolder(); + } + + async isFolder(): Promise { + return elementContainsClass(this.elementHandle, 'theia-DirNode'); + } + + async getMenuItemByNamePath(names: string[], nodeSegmentLabel?: string): Promise { + const contextMenu = nodeSegmentLabel ? await this.openContextMenuOnSegment(nodeSegmentLabel) : await this.openContextMenu(); + const menuItem = await contextMenu.menuItemByNamePath(...names); + if (!menuItem) { throw Error('MenuItem could not be retrieved by path'); } + return menuItem; + } + +} + +export type TheiaExplorerFileStatNodePredicate = (node: TheiaExplorerFileStatNode) => Promise; +export const DOT_FILES_FILTER: TheiaExplorerFileStatNodePredicate = async node => { + const label = await node.label(); + return label ? !label.startsWith('.') : true; +}; + +export class TheiaExplorerView extends TheiaView { + + constructor(app: TheiaApp) { + super(TheiaExplorerViewData, app); + } + + override async activate(): Promise { + await super.activate(); + const viewElement = await this.viewElement(); + await viewElement?.waitForSelector('.theia-TreeContainer'); + } + + async refresh(): Promise { + await this.clickButton('navigator.refresh'); + } + + async collapseAll(): Promise { + await this.clickButton('navigator.collapse.all'); + } + + protected async clickButton(id: string): Promise { + await this.activate(); + const viewElement = await this.viewElement(); + await viewElement?.hover(); + const button = await viewElement?.waitForSelector(`#${normalizeId(id)}`); + await button?.click(); + } + + async visibleFileStatNodes(filterPredicate: TheiaExplorerFileStatNodePredicate = (_ => Promise.resolve(true))): Promise { + const viewElement = await this.viewElement(); + const handles = await viewElement?.$$('.theia-FileStatNode'); + if (handles) { + const nodes = handles.map(handle => new TheiaExplorerFileStatNode(handle, this)); + const filteredNodes = []; + for (const node of nodes) { + if ((await filterPredicate(node)) === true) { + filteredNodes.push(node); + } + } + return filteredNodes; + } + return []; + } + + async getFileStatNodeByLabel(label: string, compact = false): Promise { + const file = await this.fileStatNode(label, compact); + if (!file) { throw Error('File stat node could not be retrieved by path fragments'); } + return file; + } + + async fileStatNode(filePath: string, compact = false): Promise { + return compact ? this.compactFileStatNode(filePath) : this.fileStatNodeBySegments(...filePath.split('/')); + } + + protected async fileStatNodeBySegments(...pathFragments: string[]): Promise { + await super.activate(); + const viewElement = await this.viewElement(); + + let currentTreeNode = undefined; + let fragmentsSoFar = ''; + for (let index = 0; index < pathFragments.length; index++) { + const fragment = pathFragments[index]; + fragmentsSoFar += index !== 0 ? '/' : ''; + fragmentsSoFar += fragment; + + const selector = this.treeNodeSelector(fragmentsSoFar); + const nextTreeNode = await viewElement?.waitForSelector(selector, { state: 'visible' }); + if (!nextTreeNode) { + throw new Error(`Tree node '${selector}' not found in explorer`); + } + currentTreeNode = new TheiaExplorerFileStatNode(nextTreeNode, this); + if (index < pathFragments.length - 1 && await currentTreeNode.isCollapsed()) { + await currentTreeNode.expand(); + } + } + + return currentTreeNode; + } + + protected async compactFileStatNode(path: string): Promise { + // default setting `explorer.compactFolders=true` renders folders in a compact form - single child folders will be compressed in a combined tree element + await super.activate(); + const viewElement = await this.viewElement(); + + // check if first segment folder needs to be expanded first (if folder has never been expanded, it will not show the compact folder structure) + await this.waitForVisibleFileNodes(); + const firstSegment = path.split('/')[0]; + const selector = this.treeNodeSelector(firstSegment); + const folderElement = await viewElement?.$(selector); + if (folderElement && await folderElement.isVisible()) { + const folderNode = await viewElement?.waitForSelector(selector, { state: 'visible' }); + if (!folderNode) { + throw new Error(`Tree node '${selector}' not found in explorer`); + } + const folderFileStatNode = new TheiaExplorerFileStatNode(folderNode, this); + if (await folderFileStatNode.isCollapsed()) { + await folderFileStatNode.expand(); + } + } + // now get tree node via the full path + const fullPathSelector = this.treeNodeSelector(path); + const treeNode = await viewElement?.waitForSelector(fullPathSelector, { state: 'visible' }); + if (!treeNode) { + throw new Error(`Tree node '${fullPathSelector}' not found in explorer`); + } + return new TheiaExplorerFileStatNode(treeNode, this); + } + + async selectTreeNode(filePath: string): Promise { + await this.activate(); + const treeNode = await this.page.waitForSelector(this.treeNodeSelector(filePath)); + if (await this.isTreeNodeSelected(filePath)) { + await treeNode.focus(); + } else { + await treeNode.click({ modifiers: [OSUtil.isMacOS ? 'Meta' : 'Control'] }); + // make sure the click has been acted-upon before returning + while (!await this.isTreeNodeSelected(filePath)) { + console.debug('Waiting for clicked tree node to be selected: ' + filePath); + } + } + await this.page.waitForSelector(this.treeNodeSelector(filePath) + '.theia-mod-selected'); + } + + async isTreeNodeSelected(filePath: string): Promise { + const treeNode = await this.page.waitForSelector(this.treeNodeSelector(filePath)); + return elementContainsClass(treeNode, 'theia-mod-selected'); + } + + protected treeNodeSelector(filePath: string): string { + return `.theia-FileStatNode:has(#${normalizeId(this.treeNodeId(filePath))})`; + } + + protected treeNodeId(filePath: string): string { + const workspacePath = this.app.workspace.pathAsPathComponent; + const nodeId = `${workspacePath}:${workspacePath}/${filePath}`; + if (OSUtil.isWindows) { + return nodeId.replace('\\', '/'); + } + return nodeId; + } + + async clickContextMenuItem(file: string, path: string[], nodeSegmentLabel?: string): Promise { + await this.activate(); + const fileStatNode = await this.fileStatNode(file, !!nodeSegmentLabel); + if (!fileStatNode) { throw Error('File stat node could not be retrieved by path fragments'); } + const menuItem = await fileStatNode.getMenuItemByNamePath(path, nodeSegmentLabel); + await menuItem.click(); + } + + protected async existsNode(path: string, isDirectory: boolean, compact = false): Promise { + const fileStatNode = await this.fileStatNode(path, compact); + if (!fileStatNode) { + return false; + } + if (isDirectory) { + if (!await fileStatNode.isFolder()) { + throw Error(`FileStatNode for '${path}' is not a directory!`); + } + } else { + if (!await fileStatNode.isFile()) { + throw Error(`FileStatNode for '${path}' is not a file!`); + } + } + return true; + } + + async existsFileNode(path: string): Promise { + return this.existsNode(path, false); + } + + async existsDirectoryNode(path: string, compact = false): Promise { + return this.existsNode(path, true, compact); + } + + async waitForTreeNodeVisible(path: string): Promise { + // wait for tree node to be visible, e.g. after triggering create + const viewElement = await this.viewElement(); + await viewElement?.waitForSelector(this.treeNodeSelector(path), { state: 'visible' }); + } + + async getNumberOfVisibleNodes(): Promise { + await this.activate(); + await this.refresh(); + const fileStatElements = await this.visibleFileStatNodes(DOT_FILES_FILTER); + return fileStatElements.length; + } + + async deleteNode(path: string, confirm = true, nodeSegmentLabel?: string): Promise { + await this.activate(); + await this.clickContextMenuItem(path, ['Delete'], nodeSegmentLabel); + + const confirmDialog = new TheiaDialog(this.app); + await confirmDialog.waitForVisible(); + confirm ? await confirmDialog.clickMainButton() : await confirmDialog.clickSecondaryButton(); + await confirmDialog.waitForClosed(); + } + + async renameNode(path: string, newName: string, confirm = true, nodeSegmentLabel?: string): Promise { + await this.activate(); + await this.clickContextMenuItem(path, ['Rename'], nodeSegmentLabel); + + const renameDialog = new TheiaRenameDialog(this.app); + await renameDialog.waitForVisible(); + await renameDialog.enterNewName(newName); + await renameDialog.waitUntilMainButtonIsEnabled(); + confirm ? await renameDialog.confirm() : await renameDialog.close(); + await renameDialog.waitForClosed(); + await this.refresh(); + } + + override async waitForVisible(): Promise { + await super.waitForVisible(); + await this.page.waitForSelector(this.tabSelector, { state: 'visible' }); + } + + /** + * Waits until some non-dot file nodes are visible + */ + async waitForVisibleFileNodes(): Promise { + while ((await this.visibleFileStatNodes(DOT_FILES_FILTER)).length === 0) { + console.debug('Awaiting for tree nodes to appear'); + } + } + + async waitForFileNodesToIncrease(numberBefore: number): Promise { + const fileStatNodesSelector = `${this.viewSelector} .theia-FileStatNode`; + await this.page.waitForFunction( + (predicate: { selector: string; numberBefore: number; }) => { + const elements = document.querySelectorAll(predicate.selector); + return !!elements && elements.length > predicate.numberBefore; + }, + { selector: fileStatNodesSelector, numberBefore } + ); + } + + async waitForFileNodesToDecrease(numberBefore: number): Promise { + const fileStatNodesSelector = `${this.viewSelector} .theia-FileStatNode`; + await this.page.waitForFunction( + (predicate: { selector: string; numberBefore: number; }) => { + const elements = document.querySelectorAll(predicate.selector); + return !!elements && elements.length < predicate.numberBefore; + }, + { selector: fileStatNodesSelector, numberBefore } + ); + } + +} diff --git a/examples/playwright/src/theia-main-menu.ts b/examples/playwright/src/theia-main-menu.ts new file mode 100644 index 0000000..317b79e --- /dev/null +++ b/examples/playwright/src/theia-main-menu.ts @@ -0,0 +1,75 @@ +// ***************************************************************************** +// Copyright (C) 2021 logi.cals GmbH, EclipseSource and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { ElementHandle } from '@playwright/test'; + +import { TheiaMenu } from './theia-menu'; +import { TheiaPageObject } from './theia-page-object'; +import { normalizeId, toTextContentArray } from './util'; + +export class TheiaMainMenu extends TheiaMenu { + override selector = '.lm-Menu.lm-MenuBar-menu'; +} + +export class TheiaMenuBar extends TheiaPageObject { + selector = normalizeId('#theia:menubar'); + + protected async menubarElementHandle(): Promise | null> { + return this.page.$(this.selector); + } + + async isVisible(): Promise { + const menuBar = await this.menubarElementHandle(); + return !!menuBar && menuBar.isVisible(); + } + + async waitForVisible(): Promise { + await this.page.waitForSelector(this.selector, { state: 'visible' }); + } + + async openMenu(menuName: string): Promise { + await this.waitForVisible(); + + const menuBarItem = await this.menuBarItem(menuName); + if (!menuBarItem) { + throw new Error(`Menu '${menuName}' not found!`); + } + + const mainMenu = new TheiaMainMenu(this.app); + if (await mainMenu.isOpen()) { + await menuBarItem.hover(); + } else { + await menuBarItem.click(); + } + await mainMenu.waitForVisible(); + return mainMenu; + } + + async visibleMenuBarItems(): Promise { + await this.waitForVisible(); + const items = await this.page.$$(this.menuBarItemSelector()); + return toTextContentArray(items); + } + + protected menuBarItem(label = ''): Promise | null> { + return this.page.waitForSelector(this.menuBarItemSelector(label)); + } + + protected menuBarItemSelector(label = ''): string { + return `${this.selector} .lm-MenuBar-itemLabel >> text=${label}`; + } + +} diff --git a/examples/playwright/src/theia-menu-item.ts b/examples/playwright/src/theia-menu-item.ts new file mode 100644 index 0000000..67e99dc --- /dev/null +++ b/examples/playwright/src/theia-menu-item.ts @@ -0,0 +1,75 @@ +// ***************************************************************************** +// Copyright (C) 2021 logi.cals GmbH, EclipseSource and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { ElementHandle } from '@playwright/test'; + +import { elementContainsClass, textContent } from './util'; + +export class TheiaMenuItem { + + constructor(protected element: ElementHandle) { } + + protected labelElementHandle(): Promise> { + return this.element.waitForSelector('.lm-Menu-itemLabel'); + } + + protected shortCutElementHandle(): Promise> { + return this.element.waitForSelector('.lm-Menu-itemShortcut'); + } + + protected isHidden(): Promise { + return elementContainsClass(this.element, 'lm-mod-collapsed'); + } + + async label(): Promise { + if (await this.isHidden()) { + return undefined; + } + return textContent(this.labelElementHandle()); + } + + async shortCut(): Promise { + if (await this.isHidden()) { + return undefined; + } + return textContent(this.shortCutElementHandle()); + } + + async hasSubmenu(): Promise { + if (await this.isHidden()) { + return false; + } + return (await this.element.getAttribute('data-type')) === 'submenu'; + } + + async isEnabled(): Promise { + const classAttribute = (await this.element.getAttribute('class')); + if (classAttribute === undefined || classAttribute === null) { + return false; + } + return !classAttribute.includes('lm-mod-disabled') && !classAttribute.includes('lm-mod-collapsed'); + } + + async click(): Promise { + return this.element.waitForSelector('.lm-Menu-itemLabel') + .then(labelElement => labelElement.click({ position: { x: 10, y: 10 } })); + } + + async hover(): Promise { + return this.element.hover(); + } + +} diff --git a/examples/playwright/src/theia-menu.ts b/examples/playwright/src/theia-menu.ts new file mode 100644 index 0000000..a0f6d21 --- /dev/null +++ b/examples/playwright/src/theia-menu.ts @@ -0,0 +1,116 @@ +// ***************************************************************************** +// Copyright (C) 2021 logi.cals GmbH, EclipseSource and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { ElementHandle } from '@playwright/test'; + +import { TheiaMenuItem } from './theia-menu-item'; +import { TheiaPageObject } from './theia-page-object'; +import { isDefined } from './util'; + +export class TheiaMenu extends TheiaPageObject { + + selector = '.lm-Menu'; + + protected async menuElementHandle(): Promise | null> { + return this.page.$(this.selector); + } + + async waitForVisible(): Promise { + await this.page.waitForSelector(this.selector, { state: 'visible' }); + } + + async isOpen(): Promise { + const menu = await this.menuElementHandle(); + return !!menu && menu.isVisible(); + } + + async close(): Promise { + if (!await this.isOpen()) { + return; + } + await this.page.mouse.click(0, 0); + await this.page.waitForSelector(this.selector, { state: 'detached' }); + } + + async menuItems(): Promise { + if (!await this.isOpen()) { + throw new Error('Menu must be open before accessing menu items'); + } + const menuHandle = await this.menuElementHandle(); + if (!menuHandle) { + return []; + } + const items = await menuHandle.$$('.lm-Menu-content .lm-Menu-item'); + return items.map(element => new TheiaMenuItem(element)); + } + + async clickMenuItem(name: string): Promise { + if (!await this.isOpen()) { + throw new Error('Menu must be open before clicking menu items'); + } + return (await this.page.waitForSelector(this.menuItemSelector(name))).click(); + } + + async menuItemByName(name: string): Promise { + if (!await this.isOpen()) { + throw new Error('Menu must be open before accessing menu items by name'); + } + const menuItems = await this.menuItems(); + for (const item of menuItems) { + const label = await item.label(); + if (label === name) { + return item; + } + } + return undefined; + } + + async menuItemByNamePath(...names: string[]): Promise { + if (!await this.isOpen()) { + throw new Error('Menu must be open before accessing menu items by path'); + } + + let item; + for (let index = 0; index < names.length; index++) { + item = await this.page.waitForSelector(this.menuItemSelector(names[index]), { state: 'visible' }); + // For all items except the last one, hover to open submenu + if (index < names.length - 1) { + await item.scrollIntoViewIfNeeded(); + await item.hover(); + } + } + + const menuItemHandle = await item?.$('xpath=..'); + if (menuItemHandle) { + return new TheiaMenuItem(menuItemHandle); + } + return undefined; + } + + protected menuItemSelector(label = ''): string { + return `.lm-Menu-content .lm-Menu-itemLabel >> text=${label}`; + } + + async visibleMenuItems(): Promise { + if (!await this.isOpen()) { + return []; + } + const menuItems = await this.menuItems(); + const labels = await Promise.all(menuItems.map(item => item.label())); + return labels.filter(isDefined); + } + +} diff --git a/examples/playwright/src/theia-monaco-editor.ts b/examples/playwright/src/theia-monaco-editor.ts new file mode 100644 index 0000000..5222472 --- /dev/null +++ b/examples/playwright/src/theia-monaco-editor.ts @@ -0,0 +1,183 @@ +// ***************************************************************************** +// Copyright (C) 2023 EclipseSource and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { ElementHandle, Locator } from '@playwright/test'; +import { TheiaPageObject } from './theia-page-object'; +import { TheiaApp } from './theia-app'; + +/** + * Monaco editor page object. + * + * Note: The constructor overload using `selector: string` is deprecated. Use the `locator: Locator` overload instead. + * + */ +export class TheiaMonacoEditor extends TheiaPageObject { + + public readonly locator: Locator; + + protected readonly LINES_SELECTOR = '.view-lines > .view-line'; + + /** + * Monaco editor page object. + * + * @param locator The locator of the editor. + * @param app The Theia app instance. + */ + constructor(locator: Locator, app: TheiaApp); + + /** + * @deprecated Use the `constructor(locator: Locator, app: TheiaApp)` overload instead. + */ + constructor(selector: string, app: TheiaApp); + + constructor(locatorOrString: Locator | string, app: TheiaApp) { + super(app); + if (typeof locatorOrString === 'string') { + this.locator = app.page.locator(locatorOrString); + } else { + this.locator = locatorOrString; + } + } + + async waitForVisible(): Promise { + await this.locator.waitFor({ state: 'visible' }); + // wait until lines are created + await this.locator.evaluate(editor => + editor.querySelectorAll(this.LINES_SELECTOR).length > 0 + ); + } + + /** + * @deprecated Use `locator` instead. To get the element handle use `await locator.elementHandle()`. + * @returns The view element of the editor. + */ + protected async viewElement(): Promise | null> { + return this.locator.elementHandle(); + } + + async numberOfLines(): Promise { + await this.waitForVisible(); + const lineElements = await this.locator.locator(this.LINES_SELECTOR).all(); + return lineElements.length; + } + + async textContentOfLineByLineNumber(lineNumber: number): Promise { + await this.waitForVisible(); + const lineElement = await this.line(lineNumber); + const content = await lineElement?.textContent(); + return content ? this.replaceEditorSymbolsWithSpace(content) : undefined; + } + + /** + * @deprecated Use `line(lineNumber: number)` instead. + * @param lineNumber The line number to retrieve. + * @returns The line element of the editor. + */ + async lineByLineNumber(lineNumber: number): Promise | undefined> { + const lineLocator = await this.line(lineNumber); + return (await lineLocator.elementHandle()) ?? undefined; + } + + async line(lineNumber: number): Promise { + await this.waitForVisible(); + const lines = await this.locator.locator(this.LINES_SELECTOR).all(); + if (!lines || lines.length === 0) { + throw new Error('Couldn\'t retrieve lines of monaco editor'); + } + + const linesWithXCoordinates = []; + for (const line of lines) { + await line.waitFor({ state: 'visible' }); + const box = await line.boundingBox(); + linesWithXCoordinates.push({ x: box ? box.x : Number.MAX_VALUE, line }); + } + linesWithXCoordinates.sort((a, b) => a.x.toString().localeCompare(b.x.toString())); + const lineInfo = linesWithXCoordinates[lineNumber - 1]; + if (!lineInfo) { + throw new Error(`Could not find line number ${lineNumber}`); + } + return lineInfo.line; + } + + async textContentOfLineContainingText(text: string): Promise { + await this.waitForVisible(); + const lineElement = await this.lineWithText(text); + const content = await lineElement?.textContent(); + return content ? this.replaceEditorSymbolsWithSpace(content) : undefined; + } + + /** + * @deprecated Use `lineWithText(text: string)` instead. + * @param text The text to search for in the editor. + * @returns The line element containing the text. + */ + async lineContainingText(text: string): Promise | undefined> { + const lineWithText = await this.lineWithText(text); + return await lineWithText?.elementHandle() ?? undefined; + } + + async lineWithText(text: string): Promise { + const lineWithText = this.locator.locator(`${this.LINES_SELECTOR}:has-text("${text}")`); + await lineWithText.waitFor({ state: 'visible' }); + return lineWithText; + } + + /** + * @returns The text content of the editor. + */ + async editorText(): Promise { + const lines: string[] = []; + const linesCount = await this.numberOfLines(); + if (linesCount === undefined) { + return undefined; + } + for (let line = 1; line <= linesCount; line++) { + const lineText = await this.textContentOfLineByLineNumber(line); + if (lineText === undefined) { + break; + } + lines.push(lineText); + } + return lines.join('\n'); + } + + /** + * Adds text to the editor. + * @param text The text to add to the editor. + * @param lineNumber The line number where to add the text. Default is 1. + */ + async addEditorText(text: string, lineNumber: number = 1): Promise { + const line = await this.line(lineNumber); + await line?.click(); + await this.page.keyboard.type(text); + } + + /** + * @returns `true` if the editor is focused, `false` otherwise. + */ + async isFocused(): Promise { + await this.locator.waitFor({ state: 'visible' }); + const editorClass = await this.locator.getAttribute('class'); + return editorClass?.includes('focused') ?? false; + } + + protected replaceEditorSymbolsWithSpace(content: string): string | Promise { + // [ ]   => \u00a0 -- NO-BREAK SPACE + // [·] · => \u00b7 -- MIDDLE DOT + // [] ‌ => \u200c -- ZERO WIDTH NON-JOINER + return content.replace(/[\u00a0\u00b7]/g, ' ').replace(/[\u200c]/g, ''); + } +} diff --git a/examples/playwright/src/theia-notebook-cell.ts b/examples/playwright/src/theia-notebook-cell.ts new file mode 100644 index 0000000..bad3da7 --- /dev/null +++ b/examples/playwright/src/theia-notebook-cell.ts @@ -0,0 +1,254 @@ +// ***************************************************************************** +// Copyright (C) 2024 TypeFox GmbH and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** +import { expect, FrameLocator, Locator } from '@playwright/test'; +import { TheiaApp } from './theia-app'; +import { TheiaMonacoEditor } from './theia-monaco-editor'; +import { TheiaPageObject } from './theia-page-object'; + +export type CellStatus = 'success' | 'error' | 'waiting'; + +/** + * Page object for a Theia notebook cell. + */ +export class TheiaNotebookCell extends TheiaPageObject { + + protected cellEditor: TheiaNotebookCellEditor; + + constructor(readonly locator: Locator, protected readonly notebookEditorLocator: Locator, app: TheiaApp) { + super(app); + const editorLocator = locator.locator('div.theia-notebook-cell-editor'); + this.cellEditor = new TheiaNotebookCellEditor(editorLocator, app); + } + + /** + * @returns The cell editor page object. + */ + get editor(): TheiaNotebookCellEditor { + return this.cellEditor; + } + + /** + * @returns Locator for the sidebar (left) of the cell. + */ + sidebar(): Locator { + return this.locator.locator('div.theia-notebook-cell-sidebar'); + } + + /** + * @returns Locator for the toolbar (top) of the cell. + */ + toolbar(): Locator { + return this.locator.locator('div.theia-notebook-cell-toolbar'); + } + /** + * @returns Locator for the statusbar (bottom) of the cell. + */ + statusbar(): Locator { + return this.locator.locator('div.notebook-cell-status'); + } + + /** + * @returns Locator for the status icon inside the statusbar of the cell. + */ + statusIcon(): Locator { + return this.statusbar().locator('span.notebook-cell-status-item'); + } + + /** + * @returns `true` id the cell is a code cell, `false` otherwise. + */ + async isCodeCell(): Promise { + const classAttribute = await this.mode(); + return classAttribute !== 'markdown'; + } + + /** + * @returns The mode of the cell, e.g. 'python', 'markdown', etc. + */ + async mode(): Promise { + await this.locator.waitFor({ state: 'visible' }); + const editorElement = await this.editor.locator.elementHandle(); + if (editorElement === null) { + throw new Error('Could not find editor element for the notebook cell.'); + } + const classAttribute = await editorElement.getAttribute('data-mode-id'); + if (classAttribute === null) { + throw new Error('Could not find mode attribute for the notebook cell.'); + } + return classAttribute; + } + + /** + * @returns The text content of the cell editor. + */ + async editorText(): Promise { + return this.editor.monacoEditor.editorText(); + } + + /** + * Adds text to the editor of the cell. + * @param text The text to add to the editor. + * @param lineNumber The line number where to add the text. Default is 1. + */ + async addEditorText(text: string, lineNumber: number = 1): Promise { + await this.editor.monacoEditor.addEditorText(text, lineNumber); + } + + /** + * @param wait If `true` waits for the cell to finish execution, otherwise returns immediately. + */ + async execute(wait = true): Promise { + const execButton = this.sidebar().locator('[id="notebook.cell.execute-cell"]'); + await execButton.waitFor({ state: 'visible' }); + await execButton.click(); + if (wait) { + // wait for the cell to finish execution + await this.waitForCellToFinish(); + } + } + + /** + * Splits the cell into two cells by dividing the cell text on current cursor position. + */ + async splitCell(): Promise { + const execButton = this.toolbar().locator('[id="notebook.cell.split"]'); + await execButton.waitFor({ state: 'visible' }); + await execButton.click(); + } + + /** + * Deletes the cell. + */ + async deleteCell(): Promise { + const button = this.toolbar().locator('[id="notebook.cell.delete"]'); + await button.waitFor({ state: 'visible' }); + await button.click(); + } + + /** + * Waits for the cell to reach success or error status. + */ + async waitForCellToFinish(): Promise { + await expect(this.statusIcon()).toHaveClass(/(.*codicon-check.*|.*codicon-error.*)/); + } + + /** + * @returns The status of the cell. Possible values are 'success', 'error', 'waiting'. + */ + async status(): Promise { + const statusLocator = this.statusIcon(); + const status = this.toCellStatus(await (await statusLocator.elementHandle())?.getAttribute('class') ?? ''); + return status; + } + + protected toCellStatus(classes: string): CellStatus { + return classes.includes('codicon-check') ? 'success' + : classes.includes('codicon-error') ? 'error' + : 'waiting'; + } + + /** + * @param acceptEmpty If `true`, accepts empty execution count. Otherwise waits for the execution count to be set. + * @returns The execution count of the cell. + */ + async executionCount(acceptEmpty: boolean = false): Promise { + const countNode = this.sidebar().locator('span.theia-notebook-code-cell-execution-order'); + await countNode.waitFor({ state: 'visible' }); + await this.waitForCellToFinish(); + // Wait for the execution count to be set. + await countNode.page().waitForFunction( + arg => { + const text = arg.ele?.textContent; + return text && (arg.acceptEmpty || text !== '[ ]'); + }, + { ele: await countNode.elementHandle(), acceptEmpty }, + ); + const counterText = await countNode.textContent(); + return counterText?.substring(1, counterText.length - 1); // remove square brackets + } + + /** + * @returns `true` if the cell is selected (blue vertical line), `false` otherwise. + */ + async isSelected(): Promise { + const markerClass = await this.locator.locator('div.theia-notebook-cell-marker').getAttribute('class'); + return markerClass?.includes('theia-notebook-cell-marker-selected') ?? false; + } + + /** + * @returns The output text of the cell. + */ + async outputText(): Promise { + const outputContainer = await this.outputContainer(); + await outputContainer.waitFor({ state: 'visible' }); + // By default just collect all spans text. + const spansLocator: Locator = outputContainer.locator('span:not(:has(*))'); // ignore nested spans + const spanTexts = await spansLocator.evaluateAll(spans => spans.map(span => span.textContent?.trim()) + .filter(text => text !== undefined && text.length > 0)); + return spanTexts.join(''); + } + + /** + * Selects the cell itself not it's editor. Important for shortcut usage like copy-, cut-, paste-cell. + */ + async selectCell(): Promise { + await this.sidebar().click(); + } + + async outputContainer(): Promise { + const outFrame = await this.outputFrame(); + // each cell has it's own output div with a unique id = cellHandle + const cellOutput = outFrame.locator(`div#cellHandle${await this.cellHandle()}`); + return cellOutput.locator('div.output-container'); + } + + protected async cellHandle(): Promise { + const handle = await this.locator.getAttribute('data-cell-handle'); + if (handle === null) { + throw new Error('Could not find cell handle attribute `data-cell-handle` for the notebook cell.'); + } + return handle; + } + + protected async outputFrame(): Promise { + const containerDiv = this.notebookEditorLocator.locator('div.theia-notebook-cell-output-webview'); + const webViewFrame = containerDiv.frameLocator('iframe.webview'); + await webViewFrame.locator('iframe').waitFor({ state: 'attached' }); + return webViewFrame.frameLocator('iframe'); + } + +} + +/** + * Wrapper around the monaco editor inside a notebook cell. + */ +export class TheiaNotebookCellEditor extends TheiaPageObject { + + public readonly monacoEditor: TheiaMonacoEditor; + + constructor(readonly locator: Locator, app: TheiaApp) { + super(app); + this.monacoEditor = new TheiaMonacoEditor(locator.locator('.monaco-editor'), app); + } + + async waitForVisible(): Promise { + await this.locator.waitFor({ state: 'visible' }); + } + + async isVisible(): Promise { + return this.locator.isVisible(); + } +} diff --git a/examples/playwright/src/theia-notebook-editor.ts b/examples/playwright/src/theia-notebook-editor.ts new file mode 100644 index 0000000..40a8ba5 --- /dev/null +++ b/examples/playwright/src/theia-notebook-editor.ts @@ -0,0 +1,171 @@ +// ***************************************************************************** +// Copyright (C) 2024 TypeFox GmbH and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { Locator } from '@playwright/test'; +import { TheiaApp } from './theia-app'; +import { TheiaEditor } from './theia-editor'; +import { TheiaNotebookCell } from './theia-notebook-cell'; +import { TheiaNotebookToolbar } from './theia-notebook-toolbar'; +import { TheiaQuickCommandPalette } from './theia-quick-command-palette'; +import { TheiaToolbarItem } from './theia-toolbar-item'; +import { normalizeId } from './util'; + +export namespace NotebookCommands { + export const SELECT_KERNEL_COMMAND = 'notebook.selectKernel'; + export const ADD_NEW_CELL_COMMAND = 'notebook.add-new-code-cell'; + export const ADD_NEW_MARKDOWN_CELL_COMMAND = 'notebook.add-new-markdown-cell'; + export const EXECUTE_NOTEBOOK_COMMAND = 'notebook.execute'; + export const CLEAR_ALL_OUTPUTS_COMMAND = 'notebook.clear-all-outputs'; + export const EXPORT_COMMAND = 'jupyter.notebookeditor.export'; +} + +export class TheiaNotebookEditor extends TheiaEditor { + + constructor(filePath: string, app: TheiaApp) { + // shell-tab-notebook::file:// + // notebook:file:// + super({ + tabSelector: normalizeId(`#shell-tab-notebook:${app.workspace.pathAsUrl(filePath)}`), + viewSelector: normalizeId(`#notebook:${app.workspace.pathAsUrl(filePath)}`) + }, app); + } + + protected viewLocator(): Locator { + return this.page.locator(this.data.viewSelector); + } + + tabLocator(): Locator { + return this.page.locator(this.data.tabSelector); + } + + override async waitForVisible(): Promise { + await super.waitForVisible(); + // wait for toolbar being rendered as it takes some time to load the kernel data. + await this.notebookToolbar().waitForVisible(); + } + + /** + * @returns The main toolbar of the notebook editor. + */ + notebookToolbar(): TheiaNotebookToolbar { + return new TheiaNotebookToolbar(this.viewLocator(), this.app); + } + + /** + * @returns The name of the selected kernel. + */ + async selectedKernel(): Promise { + const kernelItem = await this.toolbarItem(NotebookCommands.SELECT_KERNEL_COMMAND); + if (!kernelItem) { + throw new Error('Select kernel toolbar item not found.'); + } + return this.notebookToolbar().locator.locator('#kernel-text').innerText(); + } + + /** + * Allows to select a kernel using toolbar item. + * @param kernelName The name of the kernel to select. + */ + async selectKernel(kernelName: string): Promise { + await this.triggerToolbarItem(NotebookCommands.SELECT_KERNEL_COMMAND); + const qInput = new TheiaQuickCommandPalette(this.app); + const widget = await this.page.waitForSelector(qInput.selector, { timeout: 5000 }); + if (widget && !await qInput.isOpen()) { + throw new Error('Failed to trigger kernel selection'); + } + await qInput.type(kernelName, true); + await qInput.hide(); + } + + async availableKernels(): Promise { + await this.triggerToolbarItem(NotebookCommands.SELECT_KERNEL_COMMAND); + const qInput = new TheiaQuickCommandPalette(this.app); + const widget = await this.page.waitForSelector(qInput.selector, { timeout: 5000 }); + if (widget && !await qInput.isOpen()) { + throw new Error('Failed to trigger kernel selection'); + } + await qInput.type('Python', false); + try { + const listItems = await Promise.all((await qInput.visibleItems()).map(async item => item.textContent())); + await this.page.keyboard.press('Enter'); + await qInput.hide(); + return listItems.filter(item => item !== null) as string[]; + } finally { + await qInput.hide(); + } + } + + /** + * Adds a new code cell to the notebook. + */ + async addCodeCell(): Promise { + const currentCellsCount = (await this.cells()).length; + // FIXME Command sometimes produces bogus Editor cell without the monaco editor. + await this.triggerToolbarItem(NotebookCommands.ADD_NEW_CELL_COMMAND); + await this.waitForCellCountChanged(currentCellsCount); + } + + /** + * Adds a new markdown cell to the notebook. + */ + async addMarkdownCell(): Promise { + const currentCellsCount = (await this.cells()).length; + await this.triggerToolbarItem(NotebookCommands.ADD_NEW_MARKDOWN_CELL_COMMAND); + await this.waitForCellCountChanged(currentCellsCount); + } + + async waitForCellCountChanged(prevCount: number): Promise { + await this.viewLocator().locator('li.theia-notebook-cell').evaluateAll( + (elements, currentCount) => elements.length !== currentCount, prevCount + ); + } + + async executeAllCells(): Promise { + await this.triggerToolbarItem(NotebookCommands.EXECUTE_NOTEBOOK_COMMAND); + } + + async clearAllOutputs(): Promise { + await this.triggerToolbarItem(NotebookCommands.CLEAR_ALL_OUTPUTS_COMMAND); + } + + async exportAs(): Promise { + await this.triggerToolbarItem(NotebookCommands.EXPORT_COMMAND); + } + + async cells(): Promise { + const cellsLocator = this.viewLocator().locator('li.theia-notebook-cell'); + const cells: Array = []; + for (const cellLocator of await cellsLocator.all()) { + await cellLocator.waitFor({ state: 'visible' }); + cells.push(new TheiaNotebookCell(cellLocator, this.viewLocator(), this.app)); + } + return cells; + } + + protected async triggerToolbarItem(id: string): Promise { + const item = await this.toolbarItem(id); + if (!item) { + throw new Error(`Toolbar item with id ${id} not found`); + } + await item.trigger(); + } + + protected async toolbarItem(id: string): Promise { + const toolBar = this.notebookToolbar(); + await toolBar.waitForVisible(); + return toolBar.toolBarItem(id); + } +} diff --git a/examples/playwright/src/theia-notebook-toolbar.ts b/examples/playwright/src/theia-notebook-toolbar.ts new file mode 100644 index 0000000..3349e22 --- /dev/null +++ b/examples/playwright/src/theia-notebook-toolbar.ts @@ -0,0 +1,53 @@ +// ***************************************************************************** +// Copyright (C) 2024 TypeFox GmbH and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { ElementHandle, Locator } from '@playwright/test'; +import { TheiaApp } from './theia-app'; +import { TheiaToolbar } from './theia-toolbar'; + +export class TheiaNotebookToolbar extends TheiaToolbar { + public readonly locator: Locator; + + constructor(parentLocator: Locator, app: TheiaApp) { + super(app); + this.selector = 'div#notebook-main-toolbar'; + this.locator = parentLocator.locator(this.selector); + } + + protected override toolBarItemSelector(toolbarItemId = ''): string { + return `div.theia-notebook-main-toolbar-item${toolbarItemId ? `[id="${toolbarItemId}"]` : ''}`; + } + + protected override async toolbarElementHandle(): Promise | null> { + // Use locator instead of page to find the toolbar element. + return this.locator.elementHandle(); + } + + override async waitForVisible(): Promise { + // Use locator instead of page to find the toolbar element. + await this.locator.waitFor({ state: 'visible' }); + } + + override async waitUntilHidden(): Promise { + // Use locator instead of page to find the toolbar element. + await this.locator.waitFor({ state: 'hidden' }); + } + + override async waitUntilShown(): Promise { + // Use locator instead of page to find the toolbar element. + await this.locator.waitFor({ state: 'visible' }); + } +} diff --git a/examples/playwright/src/theia-notification-indicator.ts b/examples/playwright/src/theia-notification-indicator.ts new file mode 100644 index 0000000..37fb646 --- /dev/null +++ b/examples/playwright/src/theia-notification-indicator.ts @@ -0,0 +1,44 @@ +// ***************************************************************************** +// Copyright (C) 2021 logi.cals GmbH, EclipseSource and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { TheiaStatusIndicator } from './theia-status-indicator'; + +const NOTIFICATION_DOT_ICON = 'codicon-bell-dot'; + +export class TheiaNotificationIndicator extends TheiaStatusIndicator { + id = 'theia-notification-center'; + + async hasNotifications(): Promise { + const container = await this.getElementHandle(); + const bellWithDot = await container.$(`.${NOTIFICATION_DOT_ICON}`); + return Boolean(bellWithDot?.isVisible()); + } + + override async waitForVisible(expectNotifications = false): Promise { + await super.waitForVisible(); + if (expectNotifications && !(await this.hasNotifications())) { + throw new Error('No notifications when notifications expected.'); + } + } + + async toggleOverlay(): Promise { + const element = await this.getElementHandle(); + if (element) { + await element.click(); + } + } + +} diff --git a/examples/playwright/src/theia-notification-overlay.ts b/examples/playwright/src/theia-notification-overlay.ts new file mode 100644 index 0000000..24b66e6 --- /dev/null +++ b/examples/playwright/src/theia-notification-overlay.ts @@ -0,0 +1,94 @@ +// ***************************************************************************** +// Copyright (C) 2021 logi.cals GmbH, EclipseSource and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { TheiaApp } from './theia-app'; +import { TheiaNotificationIndicator } from './theia-notification-indicator'; +import { TheiaPageObject } from './theia-page-object'; + +export class TheiaNotificationOverlay extends TheiaPageObject { + + protected readonly HEADER_NOTIFICATIONS = 'NOTIFICATIONS'; + protected readonly HEADER_NO_NOTIFICATIONS = 'NO NEW NOTIFICATIONS'; + + constructor(app: TheiaApp, protected notificationIndicator: TheiaNotificationIndicator) { + super(app); + } + + protected get selector(): string { + return '.theia-notifications-overlay'; + } + + protected get containerSelector(): string { + return `${this.selector} .theia-notifications-container.theia-notification-center`; + } + + protected get titleSelector(): string { + return `${this.containerSelector} .theia-notification-center-header-title`; + } + + async isVisible(): Promise { + const element = await this.page.$(`${this.containerSelector}.open`); + return element ? element.isVisible() : false; + } + + async waitForVisible(): Promise { + await this.page.waitForSelector(`${this.containerSelector}.open`); + } + + async activate(): Promise { + if (!await this.isVisible()) { + await this.notificationIndicator.toggleOverlay(); + } + await this.waitForVisible(); + } + + async toggle(): Promise { + await this.app.quickCommandPalette.type('Toggle Notifications'); + await this.app.quickCommandPalette.trigger('Notifications: Toggle Notifications'); + } + + protected entrySelector(entryText: string): string { + return `${this.containerSelector} .theia-notification-message span:has-text("${entryText}")`; + } + + async waitForEntry(entryText: string): Promise { + await this.activate(); + await this.page.waitForSelector(this.entrySelector(entryText)); + } + + async waitForEntryDetached(entryText: string): Promise { + await this.activate(); + await this.page.waitForSelector(this.entrySelector(entryText), { state: 'detached' }); + } + + async isEntryVisible(entryText: string): Promise { + await this.activate(); + const element = await this.page.$(this.entrySelector(entryText)); + return !!element && element.isVisible(); + } + + protected get clearAllButtonSelector(): string { + return this.selector + ' .theia-notification-center-header ul > li.codicon.codicon-clear-all'; + } + + async clearAllNotifications(): Promise { + await this.activate(); + const element = await this.page.waitForSelector(this.clearAllButtonSelector); + await element.click(); + await this.notificationIndicator.waitForVisible(false /* expectNotifications */); + } + +} diff --git a/examples/playwright/src/theia-output-channel.ts b/examples/playwright/src/theia-output-channel.ts new file mode 100644 index 0000000..2547b52 --- /dev/null +++ b/examples/playwright/src/theia-output-channel.ts @@ -0,0 +1,88 @@ +// ***************************************************************************** +// Copyright (C) 2023 EclipseSource and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { ElementHandle } from '@playwright/test'; +import { TheiaOutputView } from './theia-output-view'; +import { TheiaPageObject } from './theia-page-object'; +import { isElementVisible } from './util'; +import { TheiaMonacoEditor } from './theia-monaco-editor'; + +export interface TheiaOutputViewChannelData { + viewSelector: string; + dataUri: string; + channelName: string; +} + +export class TheiaOutputViewChannel extends TheiaPageObject { + + protected monacoEditor: TheiaMonacoEditor; + + constructor(protected readonly data: TheiaOutputViewChannelData, protected readonly outputView: TheiaOutputView) { + super(outputView.app); + this.monacoEditor = new TheiaMonacoEditor(this.page.locator(this.viewSelector), outputView.app); + } + + protected get viewSelector(): string { + return this.data.viewSelector; + } + + protected get dataUri(): string | undefined { + return this.data.dataUri; + } + + protected get channelName(): string | undefined { + return this.data.channelName; + } + + async waitForVisible(): Promise { + await this.page.waitForSelector(this.viewSelector, { state: 'visible' }); + } + + async isDisplayed(): Promise { + return isElementVisible(this.viewElement()); + } + + protected viewElement(): Promise | null> { + return this.page.$(this.viewSelector); + } + + async numberOfLines(): Promise { + await this.waitForVisible(); + return this.monacoEditor.numberOfLines(); + } + + async maxSeverityOfLineByLineNumber(lineNumber: number): Promise<'error' | 'warning' | 'info'> { + await this.waitForVisible(); + const lineElement = await (await this.monacoEditor.line(lineNumber)).elementHandle(); + const contents = await lineElement?.$$('span > span.mtk1'); + if (!contents || contents.length < 1) { + throw new Error(`Could not find contents of line number ${lineNumber}!`); + } + const severityClassNames = await Promise.all(contents.map( + async content => (await content.getAttribute('class'))?.split(' ')[1])); + + if (severityClassNames.includes('theia-output-error')) { + return 'error'; + } else if (severityClassNames.includes('theia-output-warning')) { + return 'warning'; + } + return 'info'; + } + + async textContentOfLineByLineNumber(lineNumber: number): Promise { + return this.monacoEditor.textContentOfLineByLineNumber(lineNumber); + } +} diff --git a/examples/playwright/src/theia-output-view.ts b/examples/playwright/src/theia-output-view.ts new file mode 100644 index 0000000..8419921 --- /dev/null +++ b/examples/playwright/src/theia-output-view.ts @@ -0,0 +1,87 @@ +// ***************************************************************************** +// Copyright (C) 2023 EclipseSource and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { TheiaApp } from './theia-app'; +import { TheiaOutputViewChannel } from './theia-output-channel'; +import { TheiaView } from './theia-view'; +import { normalizeId } from './util'; + +const TheiaOutputViewData = { + tabSelector: '#shell-tab-outputView', + viewSelector: '#outputView', + viewName: 'Output' +}; + +export class TheiaOutputView extends TheiaView { + constructor(app: TheiaApp) { + super(TheiaOutputViewData, app); + } + + async isOutputChannelSelected(outputChannelName: string): Promise { + await this.activate(); + const contentPanel = await this.page.$('#theia-bottom-content-panel'); + if (contentPanel && (await contentPanel.isVisible())) { + const channelList = await contentPanel.$('#outputChannelList'); + const selectedChannel = await channelList?.$('div.theia-select-component-label'); + if (selectedChannel && (await selectedChannel.textContent()) === outputChannelName) { + return true; + } + } + return false; + } + + async getOutputChannel(outputChannelName: string): Promise { + await this.activate(); + const channel = new TheiaOutputViewChannel( + { + viewSelector: 'div.lm-Widget.theia-editor.lm-DockPanel-widget > div.monaco-editor', + dataUri: normalizeId(`output:/${encodeURIComponent(outputChannelName)}`), + channelName: outputChannelName + }, + this + ); + await channel.waitForVisible(); + if (await channel.isDisplayed()) { + return channel; + } + return undefined; + } + + async selectOutputChannel(outputChannelName: string): Promise { + await this.activate(); + const contentPanel = await this.page.$('#theia-bottom-content-panel'); + if (contentPanel && (await contentPanel.isVisible())) { + const channelSelectComponent = await contentPanel.$('#outputChannelList'); + if (!channelSelectComponent) { + throw Error('Output Channel List not visible.'); + } + // open output channel list component + await channelSelectComponent.click(); + const channelContainer = await this.page.waitForSelector('#select-component-container > div.theia-select-component-dropdown'); + if (!channelContainer) { + throw Error('Output Channel List could not be opened.'); + } + const channels = await channelContainer.$$('div.theia-select-component-option-value'); + for (const channel of channels) { + if (await channel.textContent() === outputChannelName) { + await channel.click(); + } + } + return this.isOutputChannelSelected(outputChannelName); + } + return false; + } +} diff --git a/examples/playwright/src/theia-page-object.ts b/examples/playwright/src/theia-page-object.ts new file mode 100644 index 0000000..0b67b0d --- /dev/null +++ b/examples/playwright/src/theia-page-object.ts @@ -0,0 +1,29 @@ +// ***************************************************************************** +// Copyright (C) 2021 logi.cals GmbH, EclipseSource and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { Page } from '@playwright/test'; + +import { TheiaApp } from './theia-app'; + +export abstract class TheiaPageObject { + + constructor(public app: TheiaApp) { } + + get page(): Page { + return this.app.page; + } + +} diff --git a/examples/playwright/src/theia-preference-view.ts b/examples/playwright/src/theia-preference-view.ts new file mode 100644 index 0000000..8eb64e8 --- /dev/null +++ b/examples/playwright/src/theia-preference-view.ts @@ -0,0 +1,252 @@ +// ***************************************************************************** +// Copyright (C) 2021 logi.cals GmbH, EclipseSource and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { ElementHandle } from '@playwright/test'; +import { TheiaApp } from './theia-app'; +import { TheiaView } from './theia-view'; + +const TheiaSettingsViewData = { + tabSelector: '#shell-tab-settings_widget', + viewSelector: '#settings_widget' +}; + +export const PreferenceIds = { + Editor: { + AutoSave: 'files.autoSave', + RenderWhitespace: 'editor.renderWhitespace' + }, + Explorer: { + AutoReveal: 'explorer.autoReveal' + }, + DiffEditor: { + MaxComputationTime: 'diffEditor.maxComputationTime' + }, + Files: { + EnableTrash: 'files.enableTrash' + } +}; + +export const DefaultPreferences = { + Editor: { + AutoSave: { + Off: 'off', + AfterDelay: 'afterDelay', + OnFocusChange: 'onFocusChange', + OnWindowChange: 'onWindowChange' + }, + RenderWhitespace: { + None: 'none', + Boundary: 'boundary', + Selection: 'selection', + Trailing: 'trailing', + All: 'all' + } + }, + Explorer: { + AutoReveal: { + Enabled: true + } + }, + DiffEditor: { + MaxComputationTime: '5000' + }, + Files: { + EnableTrash: { + Enabled: true + } + } +}; + +export enum TheiaPreferenceScope { + User = 'User', + Workspace = 'Workspace' +} + +export class TheiaPreferenceView extends TheiaView { + public customTimeout?: number; + protected modificationIndicator = '.theia-mod-item-modified'; + protected optionSelectLabel = '.theia-select-component-label'; + protected optionSelectDropdown = '.theia-select-component-dropdown'; + protected optionSelectDropdownValue = '.theia-select-component-option-value'; + + constructor(app: TheiaApp) { + super(TheiaSettingsViewData, app); + } + + /** + * @param preferenceScope The preference scope (Workspace or User) to open the view for. Default is Workspace. + * @param useMenu If true, the view will be opened via the main menu. If false, + * the view will be opened via the quick command palette. Default is using the main menu. + * @returns The TheiaPreferenceView page object instance. + */ + override async open(preferenceScope = TheiaPreferenceScope.Workspace, useMenu: boolean = true): Promise { + if (useMenu) { + const mainMenu = await this.app.menuBar.openMenu('File'); + await (await mainMenu.menuItemByNamePath('Preferences', 'Settings'))?.click(); + } else { + await this.app.quickCommandPalette.type('Preferences:'); + await this.app.quickCommandPalette.trigger('Preferences: Open Settings (UI)'); + } + await this.waitForVisible(); + await this.openPreferenceScope(preferenceScope); + return this; + } + + protected getScopeSelector(scope: TheiaPreferenceScope): string { + return `li.preferences-scope-tab div.lm-TabBar-tabLabel:has-text("${scope}")`; + } + + async openPreferenceScope(scope: TheiaPreferenceScope): Promise { + await this.activate(); + const scopeTab = await this.page.waitForSelector(this.getScopeSelector(scope)); + await scopeTab.click(); + } + + async getBooleanPreferenceByPath(sectionTitle: string, name: string): Promise { + const preferenceId = await this.findPreferenceId(sectionTitle, name); + return this.getBooleanPreferenceById(preferenceId); + } + + async getBooleanPreferenceById(preferenceId: string): Promise { + const element = await this.findPreferenceEditorById(preferenceId); + return element.isChecked(); + } + + async setBooleanPreferenceByPath(sectionTitle: string, name: string, value: boolean): Promise { + const preferenceId = await this.findPreferenceId(sectionTitle, name); + return this.setBooleanPreferenceById(preferenceId, value); + } + + async setBooleanPreferenceById(preferenceId: string, value: boolean): Promise { + const element = await this.findPreferenceEditorById(preferenceId); + return value ? element.check() : element.uncheck(); + } + + async getStringPreferenceByPath(sectionTitle: string, name: string): Promise { + const preferenceId = await this.findPreferenceId(sectionTitle, name); + return this.getStringPreferenceById(preferenceId); + } + + async getStringPreferenceById(preferenceId: string): Promise { + const element = await this.findPreferenceEditorById(preferenceId); + return element.evaluate(e => (e as HTMLInputElement).value); + } + + async setStringPreferenceByPath(sectionTitle: string, name: string, value: string): Promise { + const preferenceId = await this.findPreferenceId(sectionTitle, name); + return this.setStringPreferenceById(preferenceId, value); + } + + async setStringPreferenceById(preferenceId: string, value: string): Promise { + const element = await this.findPreferenceEditorById(preferenceId); + return element.fill(value); + } + + async getOptionsPreferenceByPath(sectionTitle: string, name: string): Promise { + const preferenceId = await this.findPreferenceId(sectionTitle, name); + return this.getOptionsPreferenceById(preferenceId); + } + + async getOptionsPreferenceById(preferenceId: string): Promise { + const element = await this.findPreferenceEditorById(preferenceId, this.optionSelectLabel); + return element.evaluate(e => e.textContent ?? ''); + } + + async setOptionsPreferenceByPath(sectionTitle: string, name: string, value: string): Promise { + const preferenceId = await this.findPreferenceId(sectionTitle, name); + return this.setOptionsPreferenceById(preferenceId, value); + } + + async setOptionsPreferenceById(preferenceId: string, value: string): Promise { + const element = await this.findPreferenceEditorById(preferenceId, this.optionSelectLabel); + await element.click(); + const option = await this.page.waitForSelector(`${this.optionSelectDropdown} ${this.optionSelectDropdownValue}:has-text("${value}")`); + await option.click(); + } + + async resetPreferenceByPath(sectionTitle: string, name: string): Promise { + const preferenceId = await this.findPreferenceId(sectionTitle, name); + return this.resetPreferenceById(preferenceId); + } + + async resetPreferenceById(preferenceId: string): Promise { + // this is just to fail if the preference doesn't exist at all + await this.findPreferenceEditorById(preferenceId, ''); + const resetPreferenceButton = await this.findPreferenceResetButton(preferenceId); + await resetPreferenceButton.click(); + await this.waitForUnmodified(preferenceId); + } + + private async findPreferenceId(sectionTitle: string, name: string): Promise { + const viewElement = await this.viewElement(); + const sectionElement = await viewElement?.$(`xpath=//li[contains(@class, 'settings-section-title') and text() = '${sectionTitle}']/..`); + + const firstPreferenceAfterSection = await sectionElement?.$(`xpath=following-sibling::li[div/text() = '${name}'][1]`); + const preferenceId = await firstPreferenceAfterSection?.getAttribute('data-pref-id'); + if (!preferenceId) { + throw new Error(`Could not find preference id for "${sectionTitle}" > (...) > "${name}"`); + } + return preferenceId; + } + + private async findPreferenceEditorById(preferenceId: string, elementType: string = 'input'): Promise> { + const viewElement = await this.viewElement(); + const element = await viewElement?.waitForSelector(this.getPreferenceEditorSelector(preferenceId, elementType), { timeout: this.customTimeout }); + if (!element) { + throw new Error(`Could not find element with preference id "${preferenceId}"`); + } + return element; + } + + private getPreferenceSelector(preferenceId: string): string { + return `li[data-pref-id="${preferenceId}"]`; + } + + private getPreferenceEditorSelector(preferenceId: string, elementType: string): string { + return `${this.getPreferenceSelector(preferenceId)} ${elementType}`; + } + + private async findPreferenceResetButton(preferenceId: string): Promise> { + await this.activate(); + const viewElement = await this.viewElement(); + const settingsContextMenuBtn = await viewElement?.waitForSelector(`${this.getPreferenceSelector(preferenceId)} .settings-context-menu-btn`); + if (!settingsContextMenuBtn) { + throw new Error(`Could not find context menu button for element with preference id "${preferenceId}"`); + } + await settingsContextMenuBtn.click(); + const resetPreferenceButton = await this.page.waitForSelector('li[data-command="preferences:reset"]'); + if (!resetPreferenceButton) { + throw new Error(`Could not find menu entry to reset preference with id "${preferenceId}"`); + } + return resetPreferenceButton; + } + + async waitForModified(preferenceId: string): Promise { + await this.activate(); + const viewElement = await this.viewElement(); + await viewElement?.waitForSelector(`${this.getPreferenceGutterSelector(preferenceId)}${this.modificationIndicator}`, { timeout: this.customTimeout }); + } + + async waitForUnmodified(preferenceId: string): Promise { + await this.activate(); + const viewElement = await this.viewElement(); + await viewElement?.waitForSelector(`${this.getPreferenceGutterSelector(preferenceId)}${this.modificationIndicator}`, { state: 'detached', timeout: this.customTimeout }); + } + + private getPreferenceGutterSelector(preferenceId: string): string { + return `${this.getPreferenceSelector(preferenceId)} .pref-context-gutter`; + } +} diff --git a/examples/playwright/src/theia-problem-indicator.ts b/examples/playwright/src/theia-problem-indicator.ts new file mode 100644 index 0000000..8e67d65 --- /dev/null +++ b/examples/playwright/src/theia-problem-indicator.ts @@ -0,0 +1,37 @@ +// ***************************************************************************** +// Copyright (C) 2021 logi.cals GmbH, EclipseSource and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { ElementHandle } from '@playwright/test'; +import { TheiaStatusIndicator } from './theia-status-indicator'; + +export class TheiaProblemIndicator extends TheiaStatusIndicator { + id = 'problem-marker-status'; + + async numberOfProblems(): Promise { + const spans = await this.getSpans(); + return spans ? +await spans[1].innerText() : -1; + } + + async numberOfWarnings(): Promise { + const spans = await this.getSpans(); + return spans ? +await spans[3].innerText() : -1; + } + + protected async getSpans(): Promise { + const handle = await this.getElementHandle(); + return handle?.$$('span'); + } +} diff --git a/examples/playwright/src/theia-problem-view.ts b/examples/playwright/src/theia-problem-view.ts new file mode 100644 index 0000000..b0766c5 --- /dev/null +++ b/examples/playwright/src/theia-problem-view.ts @@ -0,0 +1,30 @@ +// ***************************************************************************** +// Copyright (C) 2021 logi.cals GmbH, EclipseSource and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { TheiaApp } from './theia-app'; +import { TheiaView } from './theia-view'; + +const TheiaProblemsViewData = { + tabSelector: '#shell-tab-problems', + viewSelector: '#problems', + viewName: 'Problems' +}; + +export class TheiaProblemsView extends TheiaView { + constructor(app: TheiaApp) { + super(TheiaProblemsViewData, app); + } +} diff --git a/examples/playwright/src/theia-quick-command-palette.ts b/examples/playwright/src/theia-quick-command-palette.ts new file mode 100644 index 0000000..bf9ce8c --- /dev/null +++ b/examples/playwright/src/theia-quick-command-palette.ts @@ -0,0 +1,91 @@ +// ***************************************************************************** +// Copyright (C) 2021 logi.cals GmbH, EclipseSource and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { ElementHandle } from '@playwright/test'; +import { TheiaPageObject } from './theia-page-object'; +import { OSUtil, USER_KEY_TYPING_DELAY } from './util'; + +export class TheiaQuickCommandPalette extends TheiaPageObject { + + selector = '.quick-input-widget'; + + async open(): Promise { + await this.page.keyboard.press(OSUtil.isMacOS ? 'Meta+Shift+p' : 'Control+Shift+p'); + await this.page.waitForSelector(this.selector); + } + + async hide(): Promise { + await this.page.keyboard.press('Escape'); + await this.page.waitForSelector(this.selector, { state: 'hidden' }); + } + + async isOpen(): Promise { + try { + await this.page.waitForSelector(this.selector, { timeout: 5000 }); + } catch (err) { + return false; + } + return true; + } + + async trigger(...commandName: string[]): Promise { + for (const command of commandName) { + await this.triggerSingleCommand(command); + } + } + + protected async triggerSingleCommand(commandName: string): Promise { + if (!await this.isOpen()) { + this.open(); + } + let selected = await this.selectedCommand(); + while (!(await selected?.innerText() === commandName)) { + await this.page.keyboard.press('ArrowDown'); + selected = await this.selectedCommand(); + } + await this.page.keyboard.press('Enter'); + } + + async type(value: string, confirm = false): Promise { + if (!await this.isOpen()) { + this.open(); + } + const input = this.page.locator(`${this.selector} .monaco-inputbox .input`); + await input.focus(); + await input.pressSequentially(value, { delay: USER_KEY_TYPING_DELAY }); + if (confirm) { + await this.page.keyboard.press('Enter'); + } + } + + protected async selectedCommand(): Promise | null> { + const command = await this.page.waitForSelector(this.selector); + if (!command) { + throw new Error('No selected command found!'); + } + return command.$('.monaco-list-row.focused .monaco-highlighted-label'); + } + + async visibleItems(): Promise[]> { + // FIXME rewrite with locators + const command = await this.page.waitForSelector(this.selector); + if (!command) { + throw new Error('No selected command found!'); + } + return command.$$('.monaco-highlighted-label'); + } + +} diff --git a/examples/playwright/src/theia-rename-dialog.ts b/examples/playwright/src/theia-rename-dialog.ts new file mode 100644 index 0000000..66281c0 --- /dev/null +++ b/examples/playwright/src/theia-rename-dialog.ts @@ -0,0 +1,35 @@ +// ***************************************************************************** +// Copyright (C) 2021 logi.cals GmbH, EclipseSource and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { TheiaDialog } from './theia-dialog'; +import { USER_KEY_TYPING_DELAY } from './util'; + +export class TheiaRenameDialog extends TheiaDialog { + + async enterNewName(newName: string): Promise { + const inputField = this.page.locator(`${this.blockSelector} .theia-input`); + await inputField.selectText(); + await inputField.pressSequentially(newName, { delay: USER_KEY_TYPING_DELAY }); + } + + async confirm(): Promise { + if (!await this.validationResult()) { + throw new Error(`Unexpected validation error in TheiaRenameDialog: '${await this.getValidationText()}`); + } + await this.clickMainButton(); + } + +} diff --git a/examples/playwright/src/theia-status-bar.ts b/examples/playwright/src/theia-status-bar.ts new file mode 100644 index 0000000..0abff5f --- /dev/null +++ b/examples/playwright/src/theia-status-bar.ts @@ -0,0 +1,44 @@ +// ***************************************************************************** +// Copyright (C) 2021 logi.cals GmbH, EclipseSource and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { ElementHandle } from '@playwright/test'; + +import { TheiaApp } from './theia-app'; +import { TheiaPageObject } from './theia-page-object'; +import { TheiaStatusIndicator } from './theia-status-indicator'; + +export class TheiaStatusBar extends TheiaPageObject { + + selector = 'div#theia-statusBar'; + + protected async statusBarElementHandle(): Promise | null> { + return this.page.$(this.selector); + } + + async statusIndicator(statusIndicatorFactory: { new(app: TheiaApp): T }): Promise { + return new statusIndicatorFactory(this.app); + } + + async waitForVisible(): Promise { + await this.page.waitForSelector(this.selector, { state: 'visible' }); + } + + async isVisible(): Promise { + const statusBar = await this.statusBarElementHandle(); + return !!statusBar && statusBar.isVisible(); + } + +} diff --git a/examples/playwright/src/theia-status-indicator.ts b/examples/playwright/src/theia-status-indicator.ts new file mode 100644 index 0000000..7788d11 --- /dev/null +++ b/examples/playwright/src/theia-status-indicator.ts @@ -0,0 +1,50 @@ +// ***************************************************************************** +// Copyright (C) 2021 logi.cals GmbH, EclipseSource and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { ElementHandle } from '@playwright/test'; +import { TheiaPageObject } from './theia-page-object'; + +export abstract class TheiaStatusIndicator extends TheiaPageObject { + protected abstract id: string; + + protected statusBarElementSelector = '#theia-statusBar div.element'; + + protected getSelectorForId(id: string): string { + return `${this.statusBarElementSelector}#status-bar-${id}`; + } + + async waitForVisible(waitForDetached = false): Promise { + await this.page.waitForSelector(this.getSelectorForId(this.id), waitForDetached ? { state: 'detached' } : {}); + } + + async getElementHandle(): Promise> { + const element = await this.page.$(this.getSelectorForId(this.id)); + if (element) { + return element; + } + throw new Error('Could not find status bar element with ID ' + this.id); + } + + async isVisible(): Promise { + try { + const element = await this.getElementHandle(); + return element.isVisible(); + } catch (err) { + return false; + } + } + +} diff --git a/examples/playwright/src/theia-terminal.ts b/examples/playwright/src/theia-terminal.ts new file mode 100644 index 0000000..72fd695 --- /dev/null +++ b/examples/playwright/src/theia-terminal.ts @@ -0,0 +1,69 @@ +// ***************************************************************************** +// Copyright (C) 2023 EclipseSource and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { ElementHandle } from '@playwright/test'; +import { TheiaApp } from './theia-app'; +import { TheiaContextMenu } from './theia-context-menu'; +import { TheiaMenu } from './theia-menu'; +import { TheiaView } from './theia-view'; + +export class TheiaTerminal extends TheiaView { + + constructor(tabId: string, app: TheiaApp) { + super({ + tabSelector: `#shell-tab-terminal-${getTerminalId(tabId)}`, + viewSelector: `#terminal-${getTerminalId(tabId)}` + }, app); + } + + async submit(text: string): Promise { + await this.write(text); + const input = await this.waitForInputArea(); + await input.press('Enter'); + } + + async write(text: string): Promise { + await this.activate(); + const input = await this.waitForInputArea(); + await input.fill(text); + } + + async contents(): Promise { + await this.activate(); + await (await this.openContextMenu()).clickMenuItem('Select All'); + await (await this.openContextMenu()).clickMenuItem('Copy'); + return this.page.evaluate('navigator.clipboard.readText()'); + } + + protected async openContextMenu(): Promise { + await this.activate(); + return TheiaContextMenu.open(this.app, () => this.waitForVisibleView()); + } + + protected async waitForInputArea(): Promise> { + const view = await this.waitForVisibleView(); + return view.waitForSelector('.xterm-helper-textarea'); + } + + protected async waitForVisibleView(): Promise> { + return this.page.waitForSelector(this.viewSelector, { state: 'visible' }); + } + +} + +function getTerminalId(tabId: string): string { + return tabId.substring(tabId.lastIndexOf('-') + 1); +} diff --git a/examples/playwright/src/theia-text-editor.ts b/examples/playwright/src/theia-text-editor.ts new file mode 100644 index 0000000..8b98653 --- /dev/null +++ b/examples/playwright/src/theia-text-editor.ts @@ -0,0 +1,140 @@ +// ***************************************************************************** +// Copyright (C) 2021 logi.cals GmbH, EclipseSource and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { ElementHandle, Locator } from '@playwright/test'; + +import { TheiaApp } from './theia-app'; +import { TheiaEditor } from './theia-editor'; +import { normalizeId } from './util'; +import { TheiaMonacoEditor } from './theia-monaco-editor'; + +export class TheiaTextEditor extends TheiaEditor { + + protected monacoEditor: TheiaMonacoEditor; + + constructor(filePath: string, app: TheiaApp) { + // shell-tab-code-editor-opener:file:///c%3A/Users/user/AppData/Local/Temp/cloud-ws-JBUhb6/sample.txt:1 + // code-editor-opener:file:///c%3A/Users/user/AppData/Local/Temp/cloud-ws-JBUhb6/sample.txt:1 + super({ + tabSelector: normalizeId(`#shell-tab-code-editor-opener:${app.workspace.pathAsUrl(filePath)}:1`), + viewSelector: normalizeId(`#code-editor-opener:${app.workspace.pathAsUrl(filePath)}:1`) + '.theia-editor' + }, app); + this.monacoEditor = new TheiaMonacoEditor(this.page.locator(this.data.viewSelector), app); + } + + async numberOfLines(): Promise { + await this.activate(); + return this.monacoEditor.numberOfLines(); + } + + async textContentOfLineByLineNumber(lineNumber: number): Promise { + return this.monacoEditor.textContentOfLineByLineNumber(lineNumber); + } + + async replaceLineWithLineNumber(text: string, lineNumber: number): Promise { + await this.selectLineWithLineNumber(lineNumber); + await this.typeTextAndHitEnter(text); + } + + protected async typeTextAndHitEnter(text: string): Promise { + await this.page.keyboard.type(text); + await this.page.keyboard.press('Enter'); + } + + async selectLineWithLineNumber(lineNumber: number): Promise | undefined> { + await this.activate(); + const lineElement = await this.monacoEditor.line(lineNumber); + await this.selectLine(lineElement); + return await lineElement.elementHandle() ?? undefined; + } + + async placeCursorInLineWithLineNumber(lineNumber: number): Promise | undefined> { + await this.activate(); + const lineElement = await this.monacoEditor.line(lineNumber); + await this.placeCursorInLine(lineElement); + return await lineElement.elementHandle() ?? undefined; + } + + async deleteLineByLineNumber(lineNumber: number): Promise { + await this.selectLineWithLineNumber(lineNumber); + await this.page.keyboard.press('Backspace'); + } + + async textContentOfLineContainingText(text: string): Promise { + await this.activate(); + return this.monacoEditor.textContentOfLineContainingText(text); + } + + async replaceLineContainingText(newText: string, oldText: string): Promise { + await this.selectLineContainingText(oldText); + await this.typeTextAndHitEnter(newText); + } + + async selectLineContainingText(text: string): Promise | undefined> { + await this.activate(); + const lineElement = await this.monacoEditor.lineWithText(text); + await this.selectLine(lineElement); + return await lineElement?.elementHandle() ?? undefined; + } + + async placeCursorInLineContainingText(text: string): Promise | undefined> { + await this.activate(); + const lineElement = await this.monacoEditor.lineWithText(text); + await this.placeCursorInLine(lineElement); + return await lineElement?.elementHandle() ?? undefined; + } + + async deleteLineContainingText(text: string): Promise { + await this.selectLineContainingText(text); + await this.page.keyboard.press('Backspace'); + } + + async addTextToNewLineAfterLineContainingText(textContainedByExistingLine: string, newText: string): Promise { + const existingLine = await this.monacoEditor.lineWithText(textContainedByExistingLine); + await this.placeCursorInLine(existingLine); + await this.page.keyboard.press('End'); + await this.page.keyboard.press('Enter'); + await this.page.keyboard.type(newText); + } + + async addTextToNewLineAfterLineByLineNumber(lineNumber: number, newText: string): Promise { + const existingLine = await this.monacoEditor.line(lineNumber); + await this.placeCursorInLine(existingLine); + await this.page.keyboard.press('End'); + await this.page.keyboard.press('Enter'); + await this.page.keyboard.type(newText); + } + + protected async selectLine(lineLocator: Locator | undefined): Promise { + await lineLocator?.click({ clickCount: 3 }); + } + + protected async placeCursorInLine(lineLocator: Locator | undefined): Promise { + await lineLocator?.click(); + } + + protected async selectedSuggestion(): Promise> { + return this.page.waitForSelector(this.viewSelector + ' .monaco-list-row.show-file-icons.focused'); + } + + async getSelectedSuggestionText(): Promise { + const suggestion = await this.selectedSuggestion(); + const text = await suggestion.textContent(); + if (text === null) { throw new Error('Text content could not be found'); } + return text; + } + +} diff --git a/examples/playwright/src/theia-toggle-bottom-indicator.ts b/examples/playwright/src/theia-toggle-bottom-indicator.ts new file mode 100644 index 0000000..19fd2ec --- /dev/null +++ b/examples/playwright/src/theia-toggle-bottom-indicator.ts @@ -0,0 +1,21 @@ +// ***************************************************************************** +// Copyright (C) 2021 logi.cals GmbH, EclipseSource and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { TheiaStatusIndicator } from './theia-status-indicator'; + +export class TheiaToggleBottomIndicator extends TheiaStatusIndicator { + id = 'bottom-panel-toggle'; +} diff --git a/examples/playwright/src/theia-toolbar-item.ts b/examples/playwright/src/theia-toolbar-item.ts new file mode 100644 index 0000000..181dffc --- /dev/null +++ b/examples/playwright/src/theia-toolbar-item.ts @@ -0,0 +1,42 @@ +// ***************************************************************************** +// Copyright (C) 2023 EclipseSource and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { ElementHandle } from '@playwright/test'; +import { TheiaApp } from './theia-app'; +import { TheiaPageObject } from './theia-page-object'; + +export class TheiaToolbarItem extends TheiaPageObject { + constructor(app: TheiaApp, protected element: ElementHandle) { + super(app); + } + + async commandId(): Promise { + return this.element.getAttribute('id'); + } + + async isEnabled(): Promise { + const child = await this.element.$(':first-child'); + const classAttribute = child && await child.getAttribute('class'); + if (classAttribute === undefined || classAttribute === null) { + return false; + } + return classAttribute.includes('enabled'); + } + + async trigger(): Promise { + await this.element.click(); + } +} diff --git a/examples/playwright/src/theia-toolbar.ts b/examples/playwright/src/theia-toolbar.ts new file mode 100644 index 0000000..69e138e --- /dev/null +++ b/examples/playwright/src/theia-toolbar.ts @@ -0,0 +1,99 @@ +// ***************************************************************************** +// Copyright (C) 2023 EclipseSource and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { ElementHandle } from '@playwright/test'; +import { TheiaPageObject } from './theia-page-object'; +import { TheiaToolbarItem } from './theia-toolbar-item'; + +export class TheiaToolbar extends TheiaPageObject { + selector = 'div#main-toolbar.lm-TabBar-toolbar'; + + protected async toolbarElementHandle(): Promise | null> { + return this.page.$(this.selector); + } + + async waitForVisible(): Promise { + await this.page.waitForSelector(this.selector, { state: 'visible' }); + } + + async isShown(): Promise { + const statusBar = await this.toolbarElementHandle(); + return !!statusBar && statusBar.isVisible(); + } + + async show(): Promise { + if (!await this.isShown()) { + await this.toggle(); + } + } + + async hide(): Promise { + if (await this.isShown()) { + await this.toggle(); + } + } + + async toggle(): Promise { + const isShown = await this.isShown(); + const viewMenu = await this.app.menuBar.openMenu('View'); + await viewMenu.clickMenuItem('Toggle Toolbar'); + isShown ? await this.waitUntilHidden() : await this.waitUntilShown(); + } + + async waitUntilHidden(): Promise { + await this.page.waitForSelector(this.selector, { state: 'hidden' }); + } + + async waitUntilShown(): Promise { + await this.page.waitForSelector(this.selector, { state: 'visible' }); + } + + async toolbarItems(): Promise { + const toolbarHandle = await this.toolbarElementHandle(); + if (!toolbarHandle) { + return []; + } + const items = await toolbarHandle.$$(this.toolBarItemSelector()); + return items.map(element => new TheiaToolbarItem(this.app, element)); + } + + async toolbarItemIds(): Promise { + const items = await this.toolbarItems(); + return this.toCommandIdArray(items); + } + + async toolBarItem(commandId: string): Promise { + const toolbarHandle = await this.toolbarElementHandle(); + if (!toolbarHandle) { + return undefined; + } + const item = await toolbarHandle.$(this.toolBarItemSelector(commandId)); + if (item) { + return new TheiaToolbarItem(this.app, item); + } + return undefined; + } + + protected toolBarItemSelector(toolbarItemId = ''): string { + return `div.toolbar-item${toolbarItemId ? `[id="${toolbarItemId}"]` : ''}`; + } + + protected async toCommandIdArray(items: TheiaToolbarItem[]): Promise { + const contents = items.map(item => item.commandId()); + const resolvedContents = await Promise.all(contents); + return resolvedContents.filter(id => id !== undefined) as string[]; + } +} diff --git a/examples/playwright/src/theia-tree-node.ts b/examples/playwright/src/theia-tree-node.ts new file mode 100644 index 0000000..27967ea --- /dev/null +++ b/examples/playwright/src/theia-tree-node.ts @@ -0,0 +1,81 @@ +// ***************************************************************************** +// Copyright (C) 2021 logi.cals GmbH, EclipseSource and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { ElementHandle } from '@playwright/test'; + +import { TheiaApp } from './theia-app'; +import { TheiaContextMenu } from './theia-context-menu'; +import { TheiaMenu } from './theia-menu'; + +export class TheiaTreeNode { + + labelElementCssClass = '.theia-TreeNodeSegmentGrow'; + nodeSegmentLabelCssClass = '.theia-tree-compressed-label-part'; + expansionToggleCssClass = '.theia-ExpansionToggle'; + collapsedCssClass = '.theia-mod-collapsed'; + + constructor(protected elementHandle: ElementHandle, protected app: TheiaApp) { } + + async label(): Promise { + const labelNode = await this.elementHandle.$(this.labelElementCssClass); + if (!labelNode) { + throw new Error('Cannot read label of ' + this.elementHandle); + } + return labelNode.textContent(); + } + + async isCollapsed(): Promise { + return !! await this.elementHandle.$(this.collapsedCssClass); + } + + async isExpandable(): Promise { + return !! await this.elementHandle.$(this.expansionToggleCssClass); + } + + async expand(): Promise { + if (!await this.isCollapsed()) { + return; + } + const expansionToggle = await this.elementHandle.waitForSelector(this.expansionToggleCssClass); + await expansionToggle.click(); + await this.elementHandle.waitForSelector(`${this.expansionToggleCssClass}:not(${this.collapsedCssClass})`); + } + + async collapse(): Promise { + if (await this.isCollapsed()) { + return; + } + const expansionToggle = await this.elementHandle.waitForSelector(this.expansionToggleCssClass); + await expansionToggle.click(); + await this.elementHandle.waitForSelector(`${this.expansionToggleCssClass}${this.collapsedCssClass}`); + } + + async openContextMenu(): Promise { + return TheiaContextMenu.open(this.app, () => this.elementHandle.waitForSelector(this.labelElementCssClass)); + } + + async openContextMenuOnSegment(nodeSegmentLabel: string): Promise { + const treeNodeLabel = await this.elementHandle.waitForSelector(this.labelElementCssClass); + const treeNodeLabelSegments = await treeNodeLabel.$$(`span${this.nodeSegmentLabelCssClass}`); + for (const segmentLabel of treeNodeLabelSegments) { + if (await segmentLabel.textContent() === nodeSegmentLabel) { + return TheiaContextMenu.open(this.app, () => Promise.resolve(segmentLabel)); + } + } + throw new Error('Could not find tree node segment label "' + nodeSegmentLabel + '"'); + } + +} diff --git a/examples/playwright/src/theia-view.ts b/examples/playwright/src/theia-view.ts new file mode 100644 index 0000000..d32faef --- /dev/null +++ b/examples/playwright/src/theia-view.ts @@ -0,0 +1,177 @@ +// ***************************************************************************** +// Copyright (C) 2021 logi.cals GmbH, EclipseSource and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { ElementHandle } from '@playwright/test'; + +import { TheiaApp } from './theia-app'; +import { TheiaContextMenu } from './theia-context-menu'; +import { TheiaMenu } from './theia-menu'; +import { TheiaPageObject } from './theia-page-object'; +import { containsClass, isElementVisible, textContent } from './util'; + +export interface TheiaViewData { + tabSelector: string; + viewSelector: string; + viewName?: string; +} + +export class TheiaView extends TheiaPageObject { + + constructor(protected readonly data: TheiaViewData, app: TheiaApp) { + super(app); + } + + get tabSelector(): string { + return this.data.tabSelector; + } + + get viewSelector(): string { + return this.data.viewSelector; + } + + get name(): string | undefined { + return this.data.viewName; + } + + async open(): Promise { + if (!this.data.viewName) { + throw new Error('View name must be specified to open via command palette'); + } + await this.app.quickCommandPalette.type('View: Open View'); + await this.app.quickCommandPalette.trigger('View: Open View...', this.data.viewName); + await this.waitForVisible(); + return this; + } + + async focus(): Promise { + await this.activate(); + const view = await this.viewElement(); + await view?.click(); + } + + async activate(): Promise { + await this.page.waitForSelector(this.tabSelector, { state: 'visible' }); + if (!await this.isActive()) { + const tab = await this.tabElement(); + await tab?.click(); + } + return this.waitForVisible(); + } + + async waitForVisible(): Promise { + await this.page.waitForSelector(this.viewSelector, { state: 'visible' }); + } + + async isTabVisible(): Promise { + return isElementVisible(this.tabElement()); + } + + async isDisplayed(): Promise { + return isElementVisible(this.viewElement()); + } + + async isActive(): Promise { + return await this.isTabVisible() && containsClass(this.tabElement(), 'lm-mod-current'); + } + + async isClosable(): Promise { + return await this.isTabVisible() && containsClass(this.tabElement(), 'lm-mod-closable'); + } + + async close(waitForClosed = true): Promise { + if (!(await this.isTabVisible())) { + return; + } + if (!(await this.isClosable())) { + throw Error(`View ${this.tabSelector} is not closable`); + } + const tab = await this.tabElement(); + const side = await this.side(); + if (side === 'main' || side === 'bottom') { + const closeIcon = await tab?.waitForSelector('div.lm-TabBar-tabCloseIcon'); + await closeIcon?.click(); + } else { + const menu = await this.openContextMenuOnTab(); + const closeItem = await menu.menuItemByName('Close'); + await closeItem?.click(); + } + if (waitForClosed) { + await this.waitUntilClosed(); + } + } + + protected async waitUntilClosed(): Promise { + await this.page.waitForSelector(this.tabSelector, { state: 'detached' }); + } + + async title(): Promise { + if ((await this.isInSidePanel()) && !(await this.isActive())) { + // we can only determine the label of a side-panel view, if it is active + await this.activate(); + } + switch (await this.side()) { + case 'left': + return textContent(this.page.waitForSelector('div.theia-left-side-panel > div.theia-sidepanel-title')); + case 'right': + return textContent(this.page.waitForSelector('div.theia-right-side-panel > div.theia-sidepanel-title')); + } + const tab = await this.tabElement(); + if (tab) { + return textContent(tab.waitForSelector('div.theia-tab-icon-label > div.lm-TabBar-tabLabel')); + } + return undefined; + } + + async isInSidePanel(): Promise { + return (await this.side() === 'left') || (await this.side() === 'right'); + } + + async side(): Promise<'left' | 'right' | 'bottom' | 'main'> { + if (!await this.isTabVisible()) { + throw Error(`Unable to determine side of invisible view tab '${this.tabSelector}'`); + } + const tab = await this.tabElement(); + const appAreaElement = tab?.$('xpath=../../../..'); + if (await containsClass(appAreaElement, 'theia-app-left')) { + return 'left'; + } + if (await containsClass(appAreaElement, 'theia-app-right')) { + return 'right'; + } + + if (await containsClass(appAreaElement, 'theia-app-bottom')) { + return 'bottom'; + } + if (await containsClass(appAreaElement, 'theia-app-main')) { + return 'main'; + } + throw Error(`Unable to determine side of view tab '${this.tabSelector}'`); + } + + async openContextMenuOnTab(): Promise { + await this.activate(); + return TheiaContextMenu.open(this.app, () => this.page.waitForSelector(this.tabSelector)); + } + + protected viewElement(): Promise | null> { + return this.page.$(this.viewSelector); + } + + protected tabElement(): Promise | null> { + return this.page.$(this.tabSelector); + } + +} diff --git a/examples/playwright/src/theia-welcome-view.ts b/examples/playwright/src/theia-welcome-view.ts new file mode 100644 index 0000000..ce68a7f --- /dev/null +++ b/examples/playwright/src/theia-welcome-view.ts @@ -0,0 +1,31 @@ +// ***************************************************************************** +// Copyright (C) 2023 Toro Cloud Pty Ltd and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 + +import { TheiaApp } from './theia-app'; +import { TheiaView } from './theia-view'; +import { normalizeId } from './util'; + +const TheiaWelcomeViewData = { + tabSelector: normalizeId('#shell-tab-getting.started.widget'), + viewSelector: normalizeId('#getting.started.widget'), + viewName: 'Welcome' +}; + +export class TheiaWelcomeView extends TheiaView { + + constructor(app: TheiaApp) { + super(TheiaWelcomeViewData, app); + } +} diff --git a/examples/playwright/src/theia-workspace.ts b/examples/playwright/src/theia-workspace.ts new file mode 100644 index 0000000..db95a8b --- /dev/null +++ b/examples/playwright/src/theia-workspace.ts @@ -0,0 +1,90 @@ +// ***************************************************************************** +// Copyright (C) 2021 logi.cals GmbH, EclipseSource and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import * as fs from 'fs-extra'; +import { join, resolve } from 'path'; +import { OSUtil } from './util'; + +export class TheiaWorkspace { + + protected workspacePath: string; + + /** + * Creates a Theia workspace location with the specified path to files that shall be copied to this workspace. + * The `pathOfFilesToInitialize` must be relative to cwd of the node process. + * + * @param {string[]} pathOfFilesToInitialize Path to files or folders that shall be copied to the workspace + */ + constructor(protected pathOfFilesToInitialize?: string[]) { + this.workspacePath = fs.mkdtempSync(join(OSUtil.tmpDir, 'cloud-ws-')); + } + + /** Performs the file system operations preparing the workspace location synchronously. */ + initialize(): void { + if (this.pathOfFilesToInitialize) { + for (const initPath of this.pathOfFilesToInitialize) { + const absoluteInitPath = resolve(process.cwd(), initPath); + if (!fs.pathExistsSync(absoluteInitPath)) { + throw Error('Workspace does not exist at ' + absoluteInitPath); + } + fs.copySync(absoluteInitPath, this.workspacePath); + } + } + } + + /** Returns the absolute path to the workspace location. */ + get path(): string { + let workspacePath = this.workspacePath; + if (OSUtil.isWindows) { + // Drive letters in windows paths have to be lower case + workspacePath = workspacePath.replace(/.:/, matchedChar => matchedChar.toLowerCase()); + } + return workspacePath; + } + + /** + * Returns the absolute path to the workspace location + * as it would be returned by URI.path. + */ + get pathAsPathComponent(): string { + let path = this.path; + if (!path.startsWith(OSUtil.fileSeparator)) { + path = OSUtil.fileSeparator + path; + } + return path.replace(/\\/g, '/'); + } + + /** + * Returns a file URL for the given subpath relative to the workspace location. + */ + pathAsUrl(subpath: string): string { + let path = resolve(this.path, subpath); + if (!path.startsWith(OSUtil.fileSeparator)) { + path = OSUtil.fileSeparator + path; + } + path = path.replace(/\\/g, '/').replace(/:/g, '%3A'); + return 'file://' + path; + } + + clear(): void { + fs.emptyDirSync(this.workspacePath); + } + + remove(): void { + fs.removeSync(this.workspacePath); + } + +} diff --git a/examples/playwright/src/util.ts b/examples/playwright/src/util.ts new file mode 100644 index 0000000..2464ea3 --- /dev/null +++ b/examples/playwright/src/util.ts @@ -0,0 +1,83 @@ +// ***************************************************************************** +// Copyright (C) 2021 logi.cals GmbH, EclipseSource and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { ElementHandle } from '@playwright/test'; +import { tmpdir, platform } from 'os'; +import { sep } from 'path'; + +export const USER_KEY_TYPING_DELAY = 80; + +export function normalizeId(nodeId: string): string { + // Special characters (i.e. in our case '.',':','/','%', and '\\') in CSS IDs have to be escaped + return nodeId.replace(/[.:,%/\\]/g, matchedChar => '\\' + matchedChar); +} + +export async function toTextContentArray(items: ElementHandle[]): Promise { + const contents = items.map(item => item.textContent()); + const resolvedContents = await Promise.all(contents); + return resolvedContents.filter(text => text !== undefined) as string[]; +} + +export function isDefined(content: string | undefined): content is string { + return content !== undefined; +} + +export function isNotNull(content: string | null): content is string { + return content !== null; +} + +export async function textContent(elementPromise: Promise | null>): Promise { + const element = await elementPromise; + if (!element) { + return undefined; + } + const content = await element.textContent(); + return content ? content : undefined; +} + +export async function containsClass(elementPromise: Promise | null> | undefined, cssClass: string): Promise { + return elementContainsClass(await elementPromise, cssClass); +} + +export async function elementContainsClass(element: ElementHandle | null | undefined, cssClass: string): Promise { + if (element) { + const classValue = await element.getAttribute('class'); + if (classValue) { + return classValue?.split(' ').includes(cssClass); + } + } + return false; +} + +export async function isElementVisible(elementPromise: Promise | null>): Promise { + const element = await elementPromise; + return element ? element.isVisible() : false; +} + +export async function elementId(element: ElementHandle): Promise { + const id = await element.getAttribute('id'); + if (id === null) { throw new Error('Could not get ID of ' + element); } + return id; +} + +export namespace OSUtil { + export const isWindows = platform() === 'win32'; + export const isMacOS = platform() === 'darwin'; + // The platform-specific file separator '\' or '/'. + export const fileSeparator = sep; + // The platform-specific location of the temporary directory. + export const tmpDir = tmpdir(); +} diff --git a/examples/playwright/tsconfig.json b/examples/playwright/tsconfig.json new file mode 100644 index 0000000..5bb1620 --- /dev/null +++ b/examples/playwright/tsconfig.json @@ -0,0 +1,16 @@ +{ + "extends": "../../configs/base.tsconfig", + "compilerOptions": { + "composite": true, + "rootDir": "src", + "outDir": "lib" + }, + "include": [ + "src" + ], + "references": [ + { + "path": "../../dev-packages/cli" + } + ] +} diff --git a/lerna.json b/lerna.json new file mode 100644 index 0000000..763b578 --- /dev/null +++ b/lerna.json @@ -0,0 +1,17 @@ +{ + "$schema": "https://json.schemastore.org/lerna.json", + "npmClient": "npm", + "version": "1.68.0", + "command": { + "run": { + "stream": true + }, + "publish": { + "forcePublish": true, + "graphType": "all", + "registry": "https://registry.npmjs.org/", + "push": false, + "gitTagVersion": false + } + } +} \ No newline at end of file diff --git a/logo/EF_GRY-OR_svg.svg b/logo/EF_GRY-OR_svg.svg new file mode 100644 index 0000000..cff1b19 --- /dev/null +++ b/logo/EF_GRY-OR_svg.svg @@ -0,0 +1 @@ +EF_all_colours_ai \ No newline at end of file diff --git a/logo/favicon.png b/logo/favicon.png new file mode 100644 index 0000000..41769e2 Binary files /dev/null and b/logo/favicon.png differ diff --git a/logo/theia-logo-gray.svg b/logo/theia-logo-gray.svg new file mode 100644 index 0000000..1915cda --- /dev/null +++ b/logo/theia-logo-gray.svg @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + diff --git a/logo/theia-logo-no-text-black.svg b/logo/theia-logo-no-text-black.svg new file mode 100644 index 0000000..9d189b7 --- /dev/null +++ b/logo/theia-logo-no-text-black.svg @@ -0,0 +1,8 @@ + + + + + + V + diff --git a/logo/theia-logo-no-text-white.svg b/logo/theia-logo-no-text-white.svg new file mode 100644 index 0000000..8024647 --- /dev/null +++ b/logo/theia-logo-no-text-white.svg @@ -0,0 +1,8 @@ + + + + + + V + diff --git a/logo/theia-logo-white.svg b/logo/theia-logo-white.svg new file mode 100644 index 0000000..f828bde --- /dev/null +++ b/logo/theia-logo-white.svg @@ -0,0 +1,7 @@ + + + + + VIBN + diff --git a/logo/theia-logo.svg b/logo/theia-logo.svg new file mode 100644 index 0000000..56fab94 --- /dev/null +++ b/logo/theia-logo.svg @@ -0,0 +1,9 @@ + + + + + + + VIBN + diff --git a/logo/theia.svg b/logo/theia.svg new file mode 100644 index 0000000..4f2fcf7 --- /dev/null +++ b/logo/theia.svg @@ -0,0 +1,8 @@ + + + + + + V + diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..6bc87c9 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,34049 @@ +{ + "name": "@theia/monorepo", + "version": "0.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "@theia/monorepo", + "version": "0.0.0", + "hasInstallScript": true, + "workspaces": [ + "dev-packages/*", + "packages/*", + "!packages/*.disabled", + "examples/*", + "sample-plugins/*/*" + ], + "devDependencies": { + "@eclipse-dash/nodejs-wrapper": "^0.0.1", + "@types/chai": "4.3.0", + "@types/chai-spies": "1.0.3", + "@types/chai-string": "^1.4.0", + "@types/jsdom": "^21.1.7", + "@types/node": "20", + "@types/sinon": "^10.0.6", + "@types/temp": "^0.9.1", + "@typescript-eslint/eslint-plugin": "^7.18.0", + "@typescript-eslint/eslint-plugin-tslint": "^7.0.2", + "@typescript-eslint/parser": "^7.18.0", + "@vscode/vsce": "^2.15.0", + "archiver": "^5.3.1", + "chai": "4.3.10", + "chai-spies": "1.0.0", + "chai-string": "^1.4.0", + "chalk": "4.0.0", + "concurrently": "^3.5.0", + "debug": "^4.3.2", + "electron-mocha": "^12.3.0", + "eslint": "8", + "eslint-plugin-deprecation": "^3.0.0", + "eslint-plugin-import": "^2.27.5", + "eslint-plugin-no-null": "latest", + "eslint-plugin-no-unsanitized": "latest", + "eslint-plugin-react": "^7.31.10", + "glob": "^7.1.7", + "if-env": "^1.0.4", + "ignore-styles": "^5.0.1", + "jsdom": "^22.1.0", + "lerna": "^9.0.0", + "minimatch": "^10.0.3", + "mkdirp": "^0.5.0", + "nan": "2.23.0", + "node-abi": "^4.12.0", + "node-gyp": "^11.4.0", + "nyc": "^17.1.0", + "puppeteer": "23.1.0", + "puppeteer-core": "23.1.0", + "puppeteer-to-istanbul": "1.4.0", + "rimraf": "^5.0.0", + "sinon": "^12.0.0", + "temp": "^0.9.1", + "tslint": "^5.12.0", + "typedoc": "0.28.13", + "typescript": "~5.9.3", + "yargs": "^15.3.1" + }, + "engines": { + "node": ">=20" + } + }, + "dev-packages/application-manager": { + "name": "@theia/application-manager", + "version": "1.68.0", + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "dependencies": { + "@babel/core": "^7.10.0", + "@babel/plugin-transform-classes": "^7.10.0", + "@babel/plugin-transform-runtime": "^7.10.0", + "@babel/preset-env": "^7.10.0", + "@electron/rebuild": "^3.7.2", + "@theia/application-package": "1.68.0", + "@theia/ffmpeg": "1.68.0", + "@theia/native-webpack-plugin": "1.68.0", + "@types/fs-extra": "^4.0.2", + "@types/semver": "^7.5.0", + "babel-loader": "^8.2.2", + "buffer": "^6.0.3", + "compression-webpack-plugin": "^9.0.0", + "copy-webpack-plugin": "^8.1.1", + "css-loader": "^6.2.0", + "fs-extra": "^4.0.2", + "http-server": "^14.1.1", + "ignore-loader": "^0.1.2", + "less": "^3.0.3", + "mini-css-extract-plugin": "^2.6.1", + "node-loader": "^2.0.0", + "path-browserify": "^1.0.1", + "semver": "^7.5.4", + "source-map": "^0.6.1", + "source-map-loader": "^2.0.1", + "source-map-support": "^0.5.19", + "style-loader": "^2.0.0", + "tslib": "^2.6.2", + "umd-compat-loader": "^2.1.2", + "webpack": "^5.76.0", + "webpack-cli": "4.7.0", + "worker-loader": "^3.0.8", + "yargs": "^15.3.1" + }, + "devDependencies": { + "@theia/ext-scripts": "1.68.0" + }, + "peerDependencies": { + "@theia/electron": "*" + }, + "peerDependenciesMeta": { + "@theia/electron": { + "optional": true + } + } + }, + "dev-packages/application-manager/node_modules/buffer": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", + "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT", + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.2.1" + } + }, + "dev-packages/application-package": { + "name": "@theia/application-package", + "version": "1.68.0", + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "dependencies": { + "@theia/request": "1.68.0", + "@types/fs-extra": "^4.0.2", + "@types/semver": "^7.5.0", + "@types/write-json-file": "^2.2.1", + "deepmerge": "^4.2.2", + "fs-extra": "^4.0.2", + "is-electron": "^2.1.0", + "nano": "^10.1.3", + "resolve-package-path": "^4.0.3", + "semver": "^7.5.4", + "tslib": "^2.6.2", + "write-json-file": "^2.2.0" + }, + "devDependencies": { + "@theia/ext-scripts": "1.68.0" + } + }, + "dev-packages/application-package/node_modules/make-dir": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-1.3.0.tgz", + "integrity": "sha512-2w31R7SJtieJJnQtGc7RVL2StM2vGYVfqUOvUDxH6bC6aJTxPxTF0GnIgCyu7tjockiUWAYQRbxa7vKn34s5sQ==", + "license": "MIT", + "dependencies": { + "pify": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "dev-packages/application-package/node_modules/pify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", + "integrity": "sha512-C3FsVNH1udSEX48gGX1xfvwTWfsYWj5U+8/uK15BGzIGrKoUpghX8hWZwa/OFnakBiiVNmBvemTJR5mcy7iPcg==", + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "dev-packages/application-package/node_modules/write-file-atomic": { + "version": "2.4.3", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-2.4.3.tgz", + "integrity": "sha512-GaETH5wwsX+GcnzhPgKcKjJ6M2Cq3/iZp1WyY/X1CSqrW+jVNM9Y7D8EC2sM4ZG/V8wZlSniJnCKWPmBYAucRQ==", + "license": "ISC", + "dependencies": { + "graceful-fs": "^4.1.11", + "imurmurhash": "^0.1.4", + "signal-exit": "^3.0.2" + } + }, + "dev-packages/application-package/node_modules/write-json-file": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/write-json-file/-/write-json-file-2.3.0.tgz", + "integrity": "sha512-84+F0igFp2dPD6UpAQjOUX3CdKUOqUzn6oE9sDBNzUXINR5VceJ1rauZltqQB/bcYsx3EpKys4C7/PivKUAiWQ==", + "license": "MIT", + "dependencies": { + "detect-indent": "^5.0.0", + "graceful-fs": "^4.1.2", + "make-dir": "^1.0.0", + "pify": "^3.0.0", + "sort-keys": "^2.0.0", + "write-file-atomic": "^2.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "dev-packages/cli": { + "name": "@theia/cli", + "version": "1.68.0", + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "dependencies": { + "@theia/application-manager": "1.68.0", + "@theia/application-package": "1.68.0", + "@theia/ffmpeg": "1.68.0", + "@theia/localization-manager": "1.68.0", + "@theia/ovsx-client": "1.68.0", + "@theia/request": "1.68.0", + "@types/chai": "^4.2.7", + "@types/mocha": "^10.0.0", + "@types/node-fetch": "^2.5.7", + "chai": "^4.3.10", + "chalk": "4.0.0", + "decompress": "^4.2.1", + "escape-string-regexp": "4.0.0", + "glob": "^8.0.3", + "http-server": "^14.1.1", + "limiter": "^2.1.0", + "log-update": "^4.0.0", + "mocha": "^10.1.0", + "patch-package": "^8.0.0", + "puppeteer": "23.1.0", + "puppeteer-core": "23.1.0", + "puppeteer-to-istanbul": "1.4.0", + "temp": "^0.9.1", + "tslib": "^2.6.2", + "yargs": "^15.3.1" + }, + "bin": { + "theia": "bin/theia.js", + "theia-patch": "bin/theia-patch.js" + }, + "devDependencies": { + "@types/chai": "^4.2.7", + "@types/mocha": "^10.0.0", + "@types/node-fetch": "^2.5.7", + "@types/proxy-from-env": "^1.0.1" + } + }, + "dev-packages/cli/node_modules/brace-expansion": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz", + "integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==", + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "dev-packages/cli/node_modules/glob": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-8.1.0.tgz", + "integrity": "sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==", + "license": "ISC", + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^5.0.1", + "once": "^1.3.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "dev-packages/cli/node_modules/minimatch": { + "version": "5.1.6", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", + "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==", + "license": "ISC", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=10" + } + }, + "dev-packages/ffmpeg": { + "name": "@theia/ffmpeg", + "version": "1.68.0", + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "dependencies": { + "@electron/get": "^2.0.0", + "tslib": "^2.6.2", + "unzipper": "^0.9.11" + }, + "devDependencies": { + "@types/unzipper": "^0.9.2" + } + }, + "dev-packages/localization-manager": { + "name": "@theia/localization-manager", + "version": "1.68.0", + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "dependencies": { + "@types/bent": "^7.0.1", + "@types/fs-extra": "^4.0.2", + "bent": "^7.1.0", + "chalk": "4.0.0", + "deepmerge": "^4.2.2", + "fs-extra": "^4.0.2", + "glob": "^7.2.0", + "limiter": "^2.1.0", + "tslib": "^2.6.2", + "typescript": "~5.9.3" + }, + "devDependencies": { + "@theia/ext-scripts": "1.68.0" + } + }, + "dev-packages/native-webpack-plugin": { + "name": "@theia/native-webpack-plugin", + "version": "1.68.0", + "license": "EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0", + "dependencies": { + "detect-libc": "^2.0.2", + "tslib": "^2.6.2", + "webpack": "^5.76.0" + } + }, + "dev-packages/ovsx-client": { + "name": "@theia/ovsx-client", + "version": "1.68.0", + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "dependencies": { + "@theia/request": "1.68.0", + "limiter": "^2.1.0", + "semver": "^7.5.4", + "tslib": "^2.6.2" + } + }, + "dev-packages/private-eslint-plugin": { + "name": "@theia/eslint-plugin", + "version": "1.68.0", + "dependencies": { + "@theia/ext-scripts": "1.68.0", + "@theia/re-exports": "1.68.0", + "js-levenshtein": "^1.1.6" + } + }, + "dev-packages/private-ext-scripts": { + "name": "@theia/ext-scripts", + "version": "1.68.0", + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "bin": { + "run": "bin/theia-run.js", + "theiaext": "bin/theia-ext.js", + "ts-clean-dangling": "bin/theia-ts-clean.js" + } + }, + "dev-packages/private-re-exports": { + "name": "@theia/re-exports", + "version": "1.68.0", + "dependencies": { + "mustache": "^4.2.0", + "semver": "^7.5.4", + "tslib": "^2.6.2", + "yargs": "^15.3.1" + }, + "bin": { + "theia-re-exports": "bin/theia-re-exports.js" + }, + "devDependencies": { + "@types/chai": "^4.3.0", + "@types/mocha": "^10.0.0", + "@types/mustache": "^4.1.2", + "typescript": "~5.9.3" + }, + "engines": { + "node": ">= 12" + } + }, + "dev-packages/private-test-setup": { + "name": "@theia/test-setup", + "version": "1.68.0" + }, + "dev-packages/request": { + "name": "@theia/request", + "version": "1.68.0", + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "dependencies": { + "http-proxy-agent": "^5.0.0", + "https-proxy-agent": "^5.0.0", + "tslib": "^2.6.2" + } + }, + "examples/api-provider-sample": { + "name": "@theia/api-provider-sample", + "version": "1.68.0", + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "dependencies": { + "@theia/core": "1.68.0", + "@theia/plugin-ext": "1.68.0", + "@theia/plugin-ext-headless": "1.68.0" + }, + "devDependencies": { + "@theia/ext-scripts": "1.68.0" + } + }, + "examples/api-samples": { + "name": "@theia/api-samples", + "version": "1.68.0", + "extraneous": true, + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "dependencies": { + "@modelcontextprotocol/sdk": "^1.25.1", + "@theia/ai-chat": "1.68.0", + "@theia/ai-chat-ui": "1.68.0", + "@theia/ai-code-completion": "1.68.0", + "@theia/ai-core": "1.68.0", + "@theia/ai-mcp": "1.68.0", + "@theia/ai-mcp-server": "1.68.0", + "@theia/core": "1.68.0", + "@theia/file-search": "1.68.0", + "@theia/filesystem": "1.68.0", + "@theia/monaco": "1.68.0", + "@theia/monaco-editor-core": "1.96.302", + "@theia/output": "1.68.0", + "@theia/ovsx-client": "1.68.0", + "@theia/search-in-workspace": "1.68.0", + "@theia/test": "1.68.0", + "@theia/toolbar": "1.68.0", + "@theia/vsx-registry": "1.68.0", + "@theia/workspace": "1.68.0", + "zod": "^4.2.1" + }, + "devDependencies": { + "@theia/ext-scripts": "1.68.0" + } + }, + "examples/api-samples.disabled": { + "name": "@theia/api-samples", + "version": "1.68.0", + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "dependencies": { + "@modelcontextprotocol/sdk": "^1.25.1", + "@theia/ai-chat": "1.68.0", + "@theia/ai-chat-ui": "1.68.0", + "@theia/ai-code-completion": "1.68.0", + "@theia/ai-core": "1.68.0", + "@theia/ai-mcp": "1.68.0", + "@theia/ai-mcp-server": "1.68.0", + "@theia/core": "1.68.0", + "@theia/file-search": "1.68.0", + "@theia/filesystem": "1.68.0", + "@theia/monaco": "1.68.0", + "@theia/monaco-editor-core": "1.96.302", + "@theia/output": "1.68.0", + "@theia/ovsx-client": "1.68.0", + "@theia/search-in-workspace": "1.68.0", + "@theia/test": "1.68.0", + "@theia/toolbar": "1.68.0", + "@theia/vsx-registry": "1.68.0", + "@theia/workspace": "1.68.0", + "zod": "^4.2.1" + }, + "devDependencies": { + "@theia/ext-scripts": "1.68.0" + } + }, + "examples/api-samples.disabled/node_modules/zod": { + "version": "4.3.6", + "resolved": "https://registry.npmjs.org/zod/-/zod-4.3.6.tgz", + "integrity": "sha512-rftlrkhHZOcjDwkGlnUtZZkvaPHCsDATp4pGpuOOMDaTdDDXF91wuVDJoWoPsKX/3YPQ5fHuF3STjcYyKr+Qhg==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/colinhacks" + } + }, + "examples/api-tests": { + "name": "@theia/api-tests", + "version": "1.68.0", + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "dependencies": { + "@theia/core": "1.68.0" + } + }, + "examples/browser": { + "name": "@theia/example-browser", + "version": "1.68.0", + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "dependencies": { + "@theia/ai-anthropic": "1.68.0", + "@theia/ai-chat": "1.68.0", + "@theia/ai-chat-ui": "1.68.0", + "@theia/ai-claude-code": "1.68.0", + "@theia/ai-code-completion": "1.68.0", + "@theia/ai-codex": "1.68.0", + "@theia/ai-copilot": "1.68.0", + "@theia/ai-core": "1.68.0", + "@theia/ai-core-ui": "1.68.0", + "@theia/ai-editor": "1.68.0", + "@theia/ai-google": "1.68.0", + "@theia/ai-history": "1.68.0", + "@theia/ai-huggingface": "1.68.0", + "@theia/ai-ide": "1.68.0", + "@theia/ai-llamafile": "1.68.0", + "@theia/ai-ollama": "1.68.0", + "@theia/ai-openai": "1.68.0", + "@theia/ai-scanoss": "1.68.0", + "@theia/ai-terminal": "1.68.0", + "@theia/api-provider-sample": "1.68.0", + "@theia/bulk-edit": "1.68.0", + "@theia/callhierarchy": "1.68.0", + "@theia/collaboration": "1.68.0", + "@theia/console": "1.68.0", + "@theia/core": "1.68.0", + "@theia/debug": "1.68.0", + "@theia/design-panel": "1.68.0", + "@theia/dev-container": "1.68.0", + "@theia/editor": "1.68.0", + "@theia/editor-preview": "1.68.0", + "@theia/file-search": "1.68.0", + "@theia/filesystem": "1.68.0", + "@theia/getting-started": "1.68.0", + "@theia/keymaps": "1.68.0", + "@theia/markers": "1.68.0", + "@theia/memory-inspector": "1.68.0", + "@theia/messages": "1.68.0", + "@theia/metrics": "1.68.0", + "@theia/mini-browser": "1.68.0", + "@theia/monaco": "1.68.0", + "@theia/navigator": "1.68.0", + "@theia/notebook": "1.68.0", + "@theia/outline-view": "1.68.0", + "@theia/output": "1.68.0", + "@theia/plugin-dev": "1.68.0", + "@theia/plugin-ext": "1.68.0", + "@theia/plugin-ext-headless": "1.68.0", + "@theia/plugin-ext-vscode": "1.68.0", + "@theia/plugin-metrics": "1.68.0", + "@theia/preferences": "1.68.0", + "@theia/preview": "1.68.0", + "@theia/process": "1.68.0", + "@theia/property-view": "1.68.0", + "@theia/remote": "1.68.0", + "@theia/scanoss": "1.68.0", + "@theia/scm": "1.68.0", + "@theia/scm-extra": "1.68.0", + "@theia/search-in-workspace": "1.68.0", + "@theia/secondary-window": "1.68.0", + "@theia/task": "1.68.0", + "@theia/terminal": "1.68.0", + "@theia/terminal-manager": "1.68.0", + "@theia/test": "1.68.0", + "@theia/timeline": "1.68.0", + "@theia/toolbar": "1.68.0", + "@theia/typehierarchy": "1.68.0", + "@theia/userstorage": "1.68.0", + "@theia/variable-resolver": "1.68.0", + "@theia/vsx-registry": "1.68.0", + "@theia/workspace": "1.68.0" + }, + "devDependencies": { + "@theia/cli": "1.68.0", + "@theia/native-webpack-plugin": "1.68.0" + } + }, + "examples/browser-only": { + "name": "@theia/example-browser-only", + "version": "1.68.0", + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "dependencies": { + "@theia/ai-chat": "1.68.0", + "@theia/ai-chat-ui": "1.68.0", + "@theia/ai-code-completion": "1.68.0", + "@theia/ai-core": "1.68.0", + "@theia/ai-core-ui": "1.68.0", + "@theia/ai-history": "1.68.0", + "@theia/ai-ollama": "1.68.0", + "@theia/ai-openai": "1.68.0", + "@theia/ai-scanoss": "1.68.0", + "@theia/api-samples": "1.68.0", + "@theia/bulk-edit": "1.68.0", + "@theia/callhierarchy": "1.68.0", + "@theia/collaboration": "1.68.0", + "@theia/console": "1.68.0", + "@theia/core": "1.68.0", + "@theia/debug": "1.68.0", + "@theia/editor": "1.68.0", + "@theia/editor-preview": "1.68.0", + "@theia/file-search": "1.68.0", + "@theia/filesystem": "1.68.0", + "@theia/getting-started": "1.68.0", + "@theia/git": "1.68.0", + "@theia/keymaps": "1.68.0", + "@theia/markers": "1.68.0", + "@theia/memory-inspector": "1.68.0", + "@theia/messages": "1.68.0", + "@theia/metrics": "1.68.0", + "@theia/mini-browser": "1.68.0", + "@theia/monaco": "1.68.0", + "@theia/navigator": "1.68.0", + "@theia/outline-view": "1.68.0", + "@theia/output": "1.68.0", + "@theia/plugin-dev": "1.68.0", + "@theia/plugin-ext": "1.68.0", + "@theia/plugin-ext-vscode": "1.68.0", + "@theia/plugin-metrics": "1.68.0", + "@theia/preferences": "1.68.0", + "@theia/preview": "1.68.0", + "@theia/process": "1.68.0", + "@theia/property-view": "1.68.0", + "@theia/scanoss": "1.68.0", + "@theia/scm": "1.68.0", + "@theia/scm-extra": "1.68.0", + "@theia/search-in-workspace": "1.68.0", + "@theia/secondary-window": "1.68.0", + "@theia/task": "1.68.0", + "@theia/terminal": "1.68.0", + "@theia/timeline": "1.68.0", + "@theia/toolbar": "1.68.0", + "@theia/typehierarchy": "1.68.0", + "@theia/userstorage": "1.68.0", + "@theia/variable-resolver": "1.68.0", + "@theia/vsx-registry": "1.68.0", + "@theia/workspace": "1.68.0" + }, + "devDependencies": { + "@theia/cli": "1.68.0" + } + }, + "examples/electron": { + "name": "@theia/example-electron", + "version": "1.68.0", + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "dependencies": { + "@theia/ai-anthropic": "1.68.0", + "@theia/ai-chat": "1.68.0", + "@theia/ai-chat-ui": "1.68.0", + "@theia/ai-claude-code": "1.68.0", + "@theia/ai-code-completion": "1.68.0", + "@theia/ai-codex": "1.68.0", + "@theia/ai-copilot": "1.68.0", + "@theia/ai-core": "1.68.0", + "@theia/ai-core-ui": "1.68.0", + "@theia/ai-editor": "1.68.0", + "@theia/ai-google": "1.68.0", + "@theia/ai-history": "1.68.0", + "@theia/ai-huggingface": "1.68.0", + "@theia/ai-llamafile": "1.68.0", + "@theia/ai-ollama": "1.68.0", + "@theia/ai-openai": "1.68.0", + "@theia/ai-scanoss": "1.68.0", + "@theia/ai-terminal": "1.68.0", + "@theia/api-provider-sample": "1.68.0", + "@theia/bulk-edit": "1.68.0", + "@theia/callhierarchy": "1.68.0", + "@theia/collaboration": "1.68.0", + "@theia/console": "1.68.0", + "@theia/core": "1.68.0", + "@theia/debug": "1.68.0", + "@theia/dev-container": "1.68.0", + "@theia/editor": "1.68.0", + "@theia/editor-preview": "1.68.0", + "@theia/electron": "1.68.0", + "@theia/external-terminal": "1.68.0", + "@theia/file-search": "1.68.0", + "@theia/filesystem": "1.68.0", + "@theia/getting-started": "1.68.0", + "@theia/keymaps": "1.68.0", + "@theia/markers": "1.68.0", + "@theia/memory-inspector": "1.68.0", + "@theia/messages": "1.68.0", + "@theia/metrics": "1.68.0", + "@theia/mini-browser": "1.68.0", + "@theia/monaco": "1.68.0", + "@theia/navigator": "1.68.0", + "@theia/outline-view": "1.68.0", + "@theia/output": "1.68.0", + "@theia/plugin-dev": "1.68.0", + "@theia/plugin-ext": "1.68.0", + "@theia/plugin-ext-headless": "1.68.0", + "@theia/plugin-ext-vscode": "1.68.0", + "@theia/preferences": "1.68.0", + "@theia/preview": "1.68.0", + "@theia/process": "1.68.0", + "@theia/property-view": "1.68.0", + "@theia/remote": "1.68.0", + "@theia/remote-wsl": "1.68.0", + "@theia/scanoss": "1.68.0", + "@theia/scm": "1.68.0", + "@theia/scm-extra": "1.68.0", + "@theia/search-in-workspace": "1.68.0", + "@theia/secondary-window": "1.68.0", + "@theia/task": "1.68.0", + "@theia/terminal": "1.68.0", + "@theia/terminal-manager": "1.68.0", + "@theia/timeline": "1.68.0", + "@theia/toolbar": "1.68.0", + "@theia/typehierarchy": "1.68.0", + "@theia/userstorage": "1.68.0", + "@theia/variable-resolver": "1.68.0", + "@theia/vsx-registry": "1.68.0", + "@theia/workspace": "1.68.0" + }, + "devDependencies": { + "@theia/cli": "1.68.0", + "electron": "38.4.0", + "electron-builder": "^25.1.8" + } + }, + "examples/playwright": { + "name": "@theia/playwright", + "version": "1.68.0", + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "dependencies": { + "@playwright/test": "^1.47.0", + "fs-extra": "^9.0.8", + "tslib": "^2.6.2" + }, + "devDependencies": { + "@theia/cli": "1.68.0", + "@types/fs-extra": "^9.0.8", + "allure-commandline": "^2.23.1", + "allure-playwright": "^2.5.0", + "cross-env": "^7.0.3", + "rimraf": "^5.0.0", + "typescript": "~5.9.3" + } + }, + "examples/playwright/node_modules/@types/fs-extra": { + "version": "9.0.13", + "resolved": "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-9.0.13.tgz", + "integrity": "sha512-nEnwB++1u5lVDM2UI4c1+5R+FYaKfaAzS4OococimjVm3nQw3TuzH5UNsocrcTBbhnerblyHj4A49qXbIiZdpA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "*" + } + }, + "examples/playwright/node_modules/fs-extra": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.1.0.tgz", + "integrity": "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==", + "license": "MIT", + "dependencies": { + "at-least-node": "^1.0.0", + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "examples/playwright/node_modules/jsonfile": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.2.0.tgz", + "integrity": "sha512-FGuPw30AdOIUTRMC2OMRtQV+jkVj2cfPqSeWXv1NEAJ1qZ5zb1X6z1mFhbfOB/iy3ssJCD+3KuZ8r8C3uVFlAg==", + "license": "MIT", + "dependencies": { + "universalify": "^2.0.0" + }, + "optionalDependencies": { + "graceful-fs": "^4.1.6" + } + }, + "examples/playwright/node_modules/universalify": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz", + "integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==", + "license": "MIT", + "engines": { + "node": ">= 10.0.0" + } + }, + "node_modules/@anthropic-ai/sdk": { + "version": "0.65.0", + "resolved": "https://registry.npmjs.org/@anthropic-ai/sdk/-/sdk-0.65.0.tgz", + "integrity": "sha512-zIdPOcrCVEI8t3Di40nH4z9EoeyGZfXbYSvWdDLsB/KkaSYMnEgC7gmcgWu83g2NTn1ZTpbMvpdttWDGGIk6zw==", + "license": "MIT", + "dependencies": { + "json-schema-to-ts": "^3.1.1" + }, + "bin": { + "anthropic-ai-sdk": "bin/cli" + }, + "peerDependencies": { + "zod": "^3.25.0 || ^4.0.0" + }, + "peerDependenciesMeta": { + "zod": { + "optional": true + } + } + }, + "node_modules/@azure/abort-controller": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/@azure/abort-controller/-/abort-controller-2.1.2.tgz", + "integrity": "sha512-nBrLsEWm4J2u5LpAPjxADTlq3trDgVZZXHNKabeXZtpq3d3AbN/KGO82R87rdDz5/lYB024rtEf10/q0urNgsA==", + "dev": true, + "license": "MIT", + "dependencies": { + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@azure/core-auth": { + "version": "1.10.1", + "resolved": "https://registry.npmjs.org/@azure/core-auth/-/core-auth-1.10.1.tgz", + "integrity": "sha512-ykRMW8PjVAn+RS6ww5cmK9U2CyH9p4Q88YJwvUslfuMmN98w/2rdGRLPqJYObapBCdzBVeDgYWdJnFPFb7qzpg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@azure/abort-controller": "^2.1.2", + "@azure/core-util": "^1.13.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=20.0.0" + } + }, + "node_modules/@azure/core-client": { + "version": "1.10.1", + "resolved": "https://registry.npmjs.org/@azure/core-client/-/core-client-1.10.1.tgz", + "integrity": "sha512-Nh5PhEOeY6PrnxNPsEHRr9eimxLwgLlpmguQaHKBinFYA/RU9+kOYVOQqOrTsCL+KSxrLLl1gD8Dk5BFW/7l/w==", + "dev": true, + "license": "MIT", + "dependencies": { + "@azure/abort-controller": "^2.1.2", + "@azure/core-auth": "^1.10.0", + "@azure/core-rest-pipeline": "^1.22.0", + "@azure/core-tracing": "^1.3.0", + "@azure/core-util": "^1.13.0", + "@azure/logger": "^1.3.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=20.0.0" + } + }, + "node_modules/@azure/core-rest-pipeline": { + "version": "1.22.2", + "resolved": "https://registry.npmjs.org/@azure/core-rest-pipeline/-/core-rest-pipeline-1.22.2.tgz", + "integrity": "sha512-MzHym+wOi8CLUlKCQu12de0nwcq9k9Kuv43j4Wa++CsCpJwps2eeBQwD2Bu8snkxTtDKDx4GwjuR9E8yC8LNrg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@azure/abort-controller": "^2.1.2", + "@azure/core-auth": "^1.10.0", + "@azure/core-tracing": "^1.3.0", + "@azure/core-util": "^1.13.0", + "@azure/logger": "^1.3.0", + "@typespec/ts-http-runtime": "^0.3.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=20.0.0" + } + }, + "node_modules/@azure/core-tracing": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/@azure/core-tracing/-/core-tracing-1.3.1.tgz", + "integrity": "sha512-9MWKevR7Hz8kNzzPLfX4EAtGM2b8mr50HPDBvio96bURP/9C+HjdH3sBlLSNNrvRAr5/k/svoH457gB5IKpmwQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=20.0.0" + } + }, + "node_modules/@azure/core-util": { + "version": "1.13.1", + "resolved": "https://registry.npmjs.org/@azure/core-util/-/core-util-1.13.1.tgz", + "integrity": "sha512-XPArKLzsvl0Hf0CaGyKHUyVgF7oDnhKoP85Xv6M4StF/1AhfORhZudHtOyf2s+FcbuQ9dPRAjB8J2KvRRMUK2A==", + "dev": true, + "license": "MIT", + "dependencies": { + "@azure/abort-controller": "^2.1.2", + "@typespec/ts-http-runtime": "^0.3.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=20.0.0" + } + }, + "node_modules/@azure/identity": { + "version": "4.13.0", + "resolved": "https://registry.npmjs.org/@azure/identity/-/identity-4.13.0.tgz", + "integrity": "sha512-uWC0fssc+hs1TGGVkkghiaFkkS7NkTxfnCH+Hdg+yTehTpMcehpok4PgUKKdyCH+9ldu6FhiHRv84Ntqj1vVcw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@azure/abort-controller": "^2.0.0", + "@azure/core-auth": "^1.9.0", + "@azure/core-client": "^1.9.2", + "@azure/core-rest-pipeline": "^1.17.0", + "@azure/core-tracing": "^1.0.0", + "@azure/core-util": "^1.11.0", + "@azure/logger": "^1.0.0", + "@azure/msal-browser": "^4.2.0", + "@azure/msal-node": "^3.5.0", + "open": "^10.1.0", + "tslib": "^2.2.0" + }, + "engines": { + "node": ">=20.0.0" + } + }, + "node_modules/@azure/logger": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@azure/logger/-/logger-1.3.0.tgz", + "integrity": "sha512-fCqPIfOcLE+CGqGPd66c8bZpwAji98tZ4JI9i/mlTNTlsIWslCfpg48s/ypyLxZTump5sypjrKn2/kY7q8oAbA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typespec/ts-http-runtime": "^0.3.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=20.0.0" + } + }, + "node_modules/@azure/msal-browser": { + "version": "4.28.1", + "resolved": "https://registry.npmjs.org/@azure/msal-browser/-/msal-browser-4.28.1.tgz", + "integrity": "sha512-al2u2fTchbClq3L4C1NlqLm+vwKfhYCPtZN2LR/9xJVaQ4Mnrwf5vANvuyPSJHcGvw50UBmhuVmYUAhTEetTpA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@azure/msal-common": "15.14.1" + }, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/@azure/msal-common": { + "version": "15.14.1", + "resolved": "https://registry.npmjs.org/@azure/msal-common/-/msal-common-15.14.1.tgz", + "integrity": "sha512-IkzF7Pywt6QKTS0kwdCv/XV8x8JXknZDvSjj/IccooxnP373T5jaadO3FnOrbWo3S0UqkfIDyZNTaQ/oAgRdXw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/@azure/msal-node": { + "version": "3.8.6", + "resolved": "https://registry.npmjs.org/@azure/msal-node/-/msal-node-3.8.6.tgz", + "integrity": "sha512-XTmhdItcBckcVVTy65Xp+42xG4LX5GK+9AqAsXPXk4IqUNv+LyQo5TMwNjuFYBfAB2GTG9iSQGk+QLc03vhf3w==", + "dev": true, + "license": "MIT", + "dependencies": { + "@azure/msal-common": "15.14.1", + "jsonwebtoken": "^9.0.0", + "uuid": "^8.3.0" + }, + "engines": { + "node": ">=16" + } + }, + "node_modules/@babel/code-frame": { + "version": "7.29.0", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.29.0.tgz", + "integrity": "sha512-9NhCeYjq9+3uxgdtp20LSiJXJvN0FeCtNGpJxuMFZ1Kv3cWUNb6DOhJwUvcVCzKGR66cw4njwM6hrJLqgOwbcw==", + "license": "MIT", + "dependencies": { + "@babel/helper-validator-identifier": "^7.28.5", + "js-tokens": "^4.0.0", + "picocolors": "^1.1.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/compat-data": { + "version": "7.29.0", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.29.0.tgz", + "integrity": "sha512-T1NCJqT/j9+cn8fvkt7jtwbLBfLC/1y1c7NtCeXFRgzGTsafi68MRv8yzkYSapBnFA6L3U2VSc02ciDzoAJhJg==", + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/core": { + "version": "7.29.0", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.29.0.tgz", + "integrity": "sha512-CGOfOJqWjg2qW/Mb6zNsDm+u5vFQ8DxXfbM09z69p5Z6+mE1ikP2jUXw+j42Pf1XTYED2Rni5f95npYeuwMDQA==", + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.29.0", + "@babel/generator": "^7.29.0", + "@babel/helper-compilation-targets": "^7.28.6", + "@babel/helper-module-transforms": "^7.28.6", + "@babel/helpers": "^7.28.6", + "@babel/parser": "^7.29.0", + "@babel/template": "^7.28.6", + "@babel/traverse": "^7.29.0", + "@babel/types": "^7.29.0", + "@jridgewell/remapping": "^2.3.5", + "convert-source-map": "^2.0.0", + "debug": "^4.1.0", + "gensync": "^1.0.0-beta.2", + "json5": "^2.2.3", + "semver": "^6.3.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/babel" + } + }, + "node_modules/@babel/core/node_modules/convert-source-map": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", + "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==", + "license": "MIT" + }, + "node_modules/@babel/core/node_modules/semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/@babel/generator": { + "version": "7.29.1", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.29.1.tgz", + "integrity": "sha512-qsaF+9Qcm2Qv8SRIMMscAvG4O3lJ0F1GuMo5HR/Bp02LopNgnZBC/EkbevHFeGs4ls/oPz9v+Bsmzbkbe+0dUw==", + "license": "MIT", + "dependencies": { + "@babel/parser": "^7.29.0", + "@babel/types": "^7.29.0", + "@jridgewell/gen-mapping": "^0.3.12", + "@jridgewell/trace-mapping": "^0.3.28", + "jsesc": "^3.0.2" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-annotate-as-pure": { + "version": "7.27.3", + "resolved": "https://registry.npmjs.org/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.27.3.tgz", + "integrity": "sha512-fXSwMQqitTGeHLBC08Eq5yXz2m37E4pJX1qAU1+2cNedz/ifv/bVXft90VeSav5nFO61EcNgwr0aJxbyPaWBPg==", + "license": "MIT", + "dependencies": { + "@babel/types": "^7.27.3" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-compilation-targets": { + "version": "7.28.6", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.28.6.tgz", + "integrity": "sha512-JYtls3hqi15fcx5GaSNL7SCTJ2MNmjrkHXg4FSpOA/grxK8KwyZ5bubHsCq8FXCkua6xhuaaBit+3b7+VZRfcA==", + "license": "MIT", + "dependencies": { + "@babel/compat-data": "^7.28.6", + "@babel/helper-validator-option": "^7.27.1", + "browserslist": "^4.24.0", + "lru-cache": "^5.1.1", + "semver": "^6.3.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-compilation-targets/node_modules/lru-cache": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", + "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", + "license": "ISC", + "dependencies": { + "yallist": "^3.0.2" + } + }, + "node_modules/@babel/helper-compilation-targets/node_modules/semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/@babel/helper-compilation-targets/node_modules/yallist": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", + "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", + "license": "ISC" + }, + "node_modules/@babel/helper-create-class-features-plugin": { + "version": "7.28.6", + "resolved": "https://registry.npmjs.org/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.28.6.tgz", + "integrity": "sha512-dTOdvsjnG3xNT9Y0AUg1wAl38y+4Rl4sf9caSQZOXdNqVn+H+HbbJ4IyyHaIqNR6SW9oJpA/RuRjsjCw2IdIow==", + "license": "MIT", + "dependencies": { + "@babel/helper-annotate-as-pure": "^7.27.3", + "@babel/helper-member-expression-to-functions": "^7.28.5", + "@babel/helper-optimise-call-expression": "^7.27.1", + "@babel/helper-replace-supers": "^7.28.6", + "@babel/helper-skip-transparent-expression-wrappers": "^7.27.1", + "@babel/traverse": "^7.28.6", + "semver": "^6.3.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/helper-create-class-features-plugin/node_modules/semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/@babel/helper-create-regexp-features-plugin": { + "version": "7.28.5", + "resolved": "https://registry.npmjs.org/@babel/helper-create-regexp-features-plugin/-/helper-create-regexp-features-plugin-7.28.5.tgz", + "integrity": "sha512-N1EhvLtHzOvj7QQOUCCS3NrPJP8c5W6ZXCHDn7Yialuy1iu4r5EmIYkXlKNqT99Ciw+W0mDqWoR6HWMZlFP3hw==", + "license": "MIT", + "dependencies": { + "@babel/helper-annotate-as-pure": "^7.27.3", + "regexpu-core": "^6.3.1", + "semver": "^6.3.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/helper-create-regexp-features-plugin/node_modules/semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/@babel/helper-define-polyfill-provider": { + "version": "0.6.6", + "resolved": "https://registry.npmjs.org/@babel/helper-define-polyfill-provider/-/helper-define-polyfill-provider-0.6.6.tgz", + "integrity": "sha512-mOAsxeeKkUKayvZR3HeTYD/fICpCPLJrU5ZjelT/PA6WHtNDBOE436YiaEUvHN454bRM3CebhDsIpieCc4texA==", + "license": "MIT", + "dependencies": { + "@babel/helper-compilation-targets": "^7.28.6", + "@babel/helper-plugin-utils": "^7.28.6", + "debug": "^4.4.3", + "lodash.debounce": "^4.0.8", + "resolve": "^1.22.11" + }, + "peerDependencies": { + "@babel/core": "^7.4.0 || ^8.0.0-0 <8.0.0" + } + }, + "node_modules/@babel/helper-globals": { + "version": "7.28.0", + "resolved": "https://registry.npmjs.org/@babel/helper-globals/-/helper-globals-7.28.0.tgz", + "integrity": "sha512-+W6cISkXFa1jXsDEdYA8HeevQT/FULhxzR99pxphltZcVaugps53THCeiWA8SguxxpSp3gKPiuYfSWopkLQ4hw==", + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-member-expression-to-functions": { + "version": "7.28.5", + "resolved": "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.28.5.tgz", + "integrity": "sha512-cwM7SBRZcPCLgl8a7cY0soT1SptSzAlMH39vwiRpOQkJlh53r5hdHwLSCZpQdVLT39sZt+CRpNwYG4Y2v77atg==", + "license": "MIT", + "dependencies": { + "@babel/traverse": "^7.28.5", + "@babel/types": "^7.28.5" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-module-imports": { + "version": "7.28.6", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.28.6.tgz", + "integrity": "sha512-l5XkZK7r7wa9LucGw9LwZyyCUscb4x37JWTPz7swwFE/0FMQAGpiWUZn8u9DzkSBWEcK25jmvubfpw2dnAMdbw==", + "license": "MIT", + "dependencies": { + "@babel/traverse": "^7.28.6", + "@babel/types": "^7.28.6" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-module-transforms": { + "version": "7.28.6", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.28.6.tgz", + "integrity": "sha512-67oXFAYr2cDLDVGLXTEABjdBJZ6drElUSI7WKp70NrpyISso3plG9SAGEF6y7zbha/wOzUByWWTJvEDVNIUGcA==", + "license": "MIT", + "dependencies": { + "@babel/helper-module-imports": "^7.28.6", + "@babel/helper-validator-identifier": "^7.28.5", + "@babel/traverse": "^7.28.6" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/helper-optimise-call-expression": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.27.1.tgz", + "integrity": "sha512-URMGH08NzYFhubNSGJrpUEphGKQwMQYBySzat5cAByY1/YgIRkULnIy3tAMeszlL/so2HbeilYloUmSpd7GdVw==", + "license": "MIT", + "dependencies": { + "@babel/types": "^7.27.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-plugin-utils": { + "version": "7.28.6", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.28.6.tgz", + "integrity": "sha512-S9gzZ/bz83GRysI7gAD4wPT/AI3uCnY+9xn+Mx/KPs2JwHJIz1W8PZkg2cqyt3RNOBM8ejcXhV6y8Og7ly/Dug==", + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-remap-async-to-generator": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/helper-remap-async-to-generator/-/helper-remap-async-to-generator-7.27.1.tgz", + "integrity": "sha512-7fiA521aVw8lSPeI4ZOD3vRFkoqkJcS+z4hFo82bFSH/2tNd6eJ5qCVMS5OzDmZh/kaHQeBaeyxK6wljcPtveA==", + "license": "MIT", + "dependencies": { + "@babel/helper-annotate-as-pure": "^7.27.1", + "@babel/helper-wrap-function": "^7.27.1", + "@babel/traverse": "^7.27.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/helper-replace-supers": { + "version": "7.28.6", + "resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.28.6.tgz", + "integrity": "sha512-mq8e+laIk94/yFec3DxSjCRD2Z0TAjhVbEJY3UQrlwVo15Lmt7C2wAUbK4bjnTs4APkwsYLTahXRraQXhb1WCg==", + "license": "MIT", + "dependencies": { + "@babel/helper-member-expression-to-functions": "^7.28.5", + "@babel/helper-optimise-call-expression": "^7.27.1", + "@babel/traverse": "^7.28.6" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/helper-skip-transparent-expression-wrappers": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/helper-skip-transparent-expression-wrappers/-/helper-skip-transparent-expression-wrappers-7.27.1.tgz", + "integrity": "sha512-Tub4ZKEXqbPjXgWLl2+3JpQAYBJ8+ikpQ2Ocj/q/r0LwE3UhENh7EUabyHjz2kCEsrRY83ew2DQdHluuiDQFzg==", + "license": "MIT", + "dependencies": { + "@babel/traverse": "^7.27.1", + "@babel/types": "^7.27.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-string-parser": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.27.1.tgz", + "integrity": "sha512-qMlSxKbpRlAridDExk92nSobyDdpPijUq2DW6oDnUqd0iOGxmQjyqhMIihI9+zv4LPyZdRje2cavWPbCbWm3eA==", + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-identifier": { + "version": "7.28.5", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.28.5.tgz", + "integrity": "sha512-qSs4ifwzKJSV39ucNjsvc6WVHs6b7S03sOh2OcHF9UHfVPqWWALUsNUVzhSBiItjRZoLHx7nIarVjqKVusUZ1Q==", + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-option": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.27.1.tgz", + "integrity": "sha512-YvjJow9FxbhFFKDSuFnVCe2WxXk1zWc22fFePVNEaWJEu8IrZVlda6N0uHwzZrUM1il7NC9Mlp4MaJYbYd9JSg==", + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-wrap-function": { + "version": "7.28.6", + "resolved": "https://registry.npmjs.org/@babel/helper-wrap-function/-/helper-wrap-function-7.28.6.tgz", + "integrity": "sha512-z+PwLziMNBeSQJonizz2AGnndLsP2DeGHIxDAn+wdHOGuo4Fo1x1HBPPXeE9TAOPHNNWQKCSlA2VZyYyyibDnQ==", + "license": "MIT", + "dependencies": { + "@babel/template": "^7.28.6", + "@babel/traverse": "^7.28.6", + "@babel/types": "^7.28.6" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helpers": { + "version": "7.28.6", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.28.6.tgz", + "integrity": "sha512-xOBvwq86HHdB7WUDTfKfT/Vuxh7gElQ+Sfti2Cy6yIWNW05P8iUslOVcZ4/sKbE+/jQaukQAdz/gf3724kYdqw==", + "license": "MIT", + "dependencies": { + "@babel/template": "^7.28.6", + "@babel/types": "^7.28.6" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/parser": { + "version": "7.29.0", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.29.0.tgz", + "integrity": "sha512-IyDgFV5GeDUVX4YdF/3CPULtVGSXXMLh1xVIgdCgxApktqnQV0r7/8Nqthg+8YLGaAtdyIlo2qIdZrbCv4+7ww==", + "license": "MIT", + "dependencies": { + "@babel/types": "^7.29.0" + }, + "bin": { + "parser": "bin/babel-parser.js" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@babel/plugin-bugfix-firefox-class-in-computed-class-key": { + "version": "7.28.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-bugfix-firefox-class-in-computed-class-key/-/plugin-bugfix-firefox-class-in-computed-class-key-7.28.5.tgz", + "integrity": "sha512-87GDMS3tsmMSi/3bWOte1UblL+YUTFMV8SZPZ2eSEL17s74Cw/l63rR6NmGVKMYW2GYi85nE+/d6Hw5N0bEk2Q==", + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.27.1", + "@babel/traverse": "^7.28.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/plugin-bugfix-safari-class-field-initializer-scope": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-bugfix-safari-class-field-initializer-scope/-/plugin-bugfix-safari-class-field-initializer-scope-7.27.1.tgz", + "integrity": "sha512-qNeq3bCKnGgLkEXUuFry6dPlGfCdQNZbn7yUAPCInwAJHMU7THJfrBSozkcWq5sNM6RcF3S8XyQL2A52KNR9IA==", + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.27.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression/-/plugin-bugfix-safari-id-destructuring-collision-in-function-expression-7.27.1.tgz", + "integrity": "sha512-g4L7OYun04N1WyqMNjldFwlfPCLVkgB54A/YCXICZYBsvJJE3kByKv9c9+R/nAfmIfjl2rKYLNyMHboYbZaWaA==", + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.27.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining/-/plugin-bugfix-v8-spread-parameters-in-optional-chaining-7.27.1.tgz", + "integrity": "sha512-oO02gcONcD5O1iTLi/6frMJBIwWEHceWGSGqrpCmEL8nogiS6J9PBlE48CaK20/Jx1LuRml9aDftLgdjXT8+Cw==", + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.27.1", + "@babel/helper-skip-transparent-expression-wrappers": "^7.27.1", + "@babel/plugin-transform-optional-chaining": "^7.27.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.13.0" + } + }, + "node_modules/@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly": { + "version": "7.28.6", + "resolved": "https://registry.npmjs.org/@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly/-/plugin-bugfix-v8-static-class-fields-redefine-readonly-7.28.6.tgz", + "integrity": "sha512-a0aBScVTlNaiUe35UtfxAN7A/tehvvG4/ByO6+46VPKTRSlfnAFsgKy0FUh+qAkQrDTmhDkT+IBOKlOoMUxQ0g==", + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.28.6", + "@babel/traverse": "^7.28.6" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/plugin-proposal-private-property-in-object": { + "version": "7.21.0-placeholder-for-preset-env.2", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-private-property-in-object/-/plugin-proposal-private-property-in-object-7.21.0-placeholder-for-preset-env.2.tgz", + "integrity": "sha512-SOSkfJDddaM7mak6cPEpswyTRnuRltl429hMraQEglW+OkovnCzsiszTmsrlY//qLFjCpQDFRvjdm2wA5pPm9w==", + "license": "MIT", + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-import-assertions": { + "version": "7.28.6", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-import-assertions/-/plugin-syntax-import-assertions-7.28.6.tgz", + "integrity": "sha512-pSJUpFHdx9z5nqTSirOCMtYVP2wFgoWhP0p3g8ONK/4IHhLIBd0B9NYqAvIUAhq+OkhO4VM1tENCt0cjlsNShw==", + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.28.6" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-import-attributes": { + "version": "7.28.6", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-import-attributes/-/plugin-syntax-import-attributes-7.28.6.tgz", + "integrity": "sha512-jiLC0ma9XkQT3TKJ9uYvlakm66Pamywo+qwL+oL8HJOvc6TWdZXVfhqJr8CCzbSGUAbDOzlGHJC1U+vRfLQDvw==", + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.28.6" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-unicode-sets-regex": { + "version": "7.18.6", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-unicode-sets-regex/-/plugin-syntax-unicode-sets-regex-7.18.6.tgz", + "integrity": "sha512-727YkEAPwSIQTv5im8QHz3upqp92JTWhidIC81Tdx4VJYIte/VndKf1qKrfnnhPLiPghStWfvC/iFaMCQu7Nqg==", + "license": "MIT", + "dependencies": { + "@babel/helper-create-regexp-features-plugin": "^7.18.6", + "@babel/helper-plugin-utils": "^7.18.6" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/plugin-transform-arrow-functions": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.27.1.tgz", + "integrity": "sha512-8Z4TGic6xW70FKThA5HYEKKyBpOOsucTOD1DjU3fZxDg+K3zBJcXMFnt/4yQiZnf5+MiOMSXQ9PaEK/Ilh1DeA==", + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.27.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-async-generator-functions": { + "version": "7.29.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-async-generator-functions/-/plugin-transform-async-generator-functions-7.29.0.tgz", + "integrity": "sha512-va0VdWro4zlBr2JsXC+ofCPB2iG12wPtVGTWFx2WLDOM3nYQZZIGP82qku2eW/JR83sD+k2k+CsNtyEbUqhU6w==", + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.28.6", + "@babel/helper-remap-async-to-generator": "^7.27.1", + "@babel/traverse": "^7.29.0" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-async-to-generator": { + "version": "7.28.6", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-async-to-generator/-/plugin-transform-async-to-generator-7.28.6.tgz", + "integrity": "sha512-ilTRcmbuXjsMmcZ3HASTe4caH5Tpo93PkTxF9oG2VZsSWsahydmcEHhix9Ik122RcTnZnUzPbmux4wh1swfv7g==", + "license": "MIT", + "dependencies": { + "@babel/helper-module-imports": "^7.28.6", + "@babel/helper-plugin-utils": "^7.28.6", + "@babel/helper-remap-async-to-generator": "^7.27.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-block-scoped-functions": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-block-scoped-functions/-/plugin-transform-block-scoped-functions-7.27.1.tgz", + "integrity": "sha512-cnqkuOtZLapWYZUYM5rVIdv1nXYuFVIltZ6ZJ7nIj585QsjKM5dhL2Fu/lICXZ1OyIAFc7Qy+bvDAtTXqGrlhg==", + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.27.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-block-scoping": { + "version": "7.28.6", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.28.6.tgz", + "integrity": "sha512-tt/7wOtBmwHPNMPu7ax4pdPz6shjFrmHDghvNC+FG9Qvj7D6mJcoRQIF5dy4njmxR941l6rgtvfSB2zX3VlUIw==", + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.28.6" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-class-properties": { + "version": "7.28.6", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-class-properties/-/plugin-transform-class-properties-7.28.6.tgz", + "integrity": "sha512-dY2wS3I2G7D697VHndN91TJr8/AAfXQNt5ynCTI/MpxMsSzHp+52uNivYT5wCPax3whc47DR8Ba7cmlQMg24bw==", + "license": "MIT", + "dependencies": { + "@babel/helper-create-class-features-plugin": "^7.28.6", + "@babel/helper-plugin-utils": "^7.28.6" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-class-static-block": { + "version": "7.28.6", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-class-static-block/-/plugin-transform-class-static-block-7.28.6.tgz", + "integrity": "sha512-rfQ++ghVwTWTqQ7w8qyDxL1XGihjBss4CmTgGRCTAC9RIbhVpyp4fOeZtta0Lbf+dTNIVJer6ych2ibHwkZqsQ==", + "license": "MIT", + "dependencies": { + "@babel/helper-create-class-features-plugin": "^7.28.6", + "@babel/helper-plugin-utils": "^7.28.6" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.12.0" + } + }, + "node_modules/@babel/plugin-transform-classes": { + "version": "7.28.6", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-classes/-/plugin-transform-classes-7.28.6.tgz", + "integrity": "sha512-EF5KONAqC5zAqT783iMGuM2ZtmEBy+mJMOKl2BCvPZ2lVrwvXnB6o+OBWCS+CoeCCpVRF2sA2RBKUxvT8tQT5Q==", + "license": "MIT", + "dependencies": { + "@babel/helper-annotate-as-pure": "^7.27.3", + "@babel/helper-compilation-targets": "^7.28.6", + "@babel/helper-globals": "^7.28.0", + "@babel/helper-plugin-utils": "^7.28.6", + "@babel/helper-replace-supers": "^7.28.6", + "@babel/traverse": "^7.28.6" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-computed-properties": { + "version": "7.28.6", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-computed-properties/-/plugin-transform-computed-properties-7.28.6.tgz", + "integrity": "sha512-bcc3k0ijhHbc2lEfpFHgx7eYw9KNXqOerKWfzbxEHUGKnS3sz9C4CNL9OiFN1297bDNfUiSO7DaLzbvHQQQ1BQ==", + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.28.6", + "@babel/template": "^7.28.6" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-destructuring": { + "version": "7.28.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.28.5.tgz", + "integrity": "sha512-Kl9Bc6D0zTUcFUvkNuQh4eGXPKKNDOJQXVyyM4ZAQPMveniJdxi8XMJwLo+xSoW3MIq81bD33lcUe9kZpl0MCw==", + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.27.1", + "@babel/traverse": "^7.28.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-dotall-regex": { + "version": "7.28.6", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-dotall-regex/-/plugin-transform-dotall-regex-7.28.6.tgz", + "integrity": "sha512-SljjowuNKB7q5Oayv4FoPzeB74g3QgLt8IVJw9ADvWy3QnUb/01aw8I4AVv8wYnPvQz2GDDZ/g3GhcNyDBI4Bg==", + "license": "MIT", + "dependencies": { + "@babel/helper-create-regexp-features-plugin": "^7.28.5", + "@babel/helper-plugin-utils": "^7.28.6" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-duplicate-keys": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-duplicate-keys/-/plugin-transform-duplicate-keys-7.27.1.tgz", + "integrity": "sha512-MTyJk98sHvSs+cvZ4nOauwTTG1JeonDjSGvGGUNHreGQns+Mpt6WX/dVzWBHgg+dYZhkC4X+zTDfkTU+Vy9y7Q==", + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.27.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-duplicate-named-capturing-groups-regex": { + "version": "7.29.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-duplicate-named-capturing-groups-regex/-/plugin-transform-duplicate-named-capturing-groups-regex-7.29.0.tgz", + "integrity": "sha512-zBPcW2lFGxdiD8PUnPwJjag2J9otbcLQzvbiOzDxpYXyCuYX9agOwMPGn1prVH0a4qzhCKu24rlH4c1f7yA8rw==", + "license": "MIT", + "dependencies": { + "@babel/helper-create-regexp-features-plugin": "^7.28.5", + "@babel/helper-plugin-utils": "^7.28.6" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/plugin-transform-dynamic-import": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-dynamic-import/-/plugin-transform-dynamic-import-7.27.1.tgz", + "integrity": "sha512-MHzkWQcEmjzzVW9j2q8LGjwGWpG2mjwaaB0BNQwst3FIjqsg8Ct/mIZlvSPJvfi9y2AC8mi/ktxbFVL9pZ1I4A==", + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.27.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-explicit-resource-management": { + "version": "7.28.6", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-explicit-resource-management/-/plugin-transform-explicit-resource-management-7.28.6.tgz", + "integrity": "sha512-Iao5Konzx2b6g7EPqTy40UZbcdXE126tTxVFr/nAIj+WItNxjKSYTEw3RC+A2/ZetmdJsgueL1KhaMCQHkLPIg==", + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.28.6", + "@babel/plugin-transform-destructuring": "^7.28.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-exponentiation-operator": { + "version": "7.28.6", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-exponentiation-operator/-/plugin-transform-exponentiation-operator-7.28.6.tgz", + "integrity": "sha512-WitabqiGjV/vJ0aPOLSFfNY1u9U3R7W36B03r5I2KoNix+a3sOhJ3pKFB3R5It9/UiK78NiO0KE9P21cMhlPkw==", + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.28.6" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-export-namespace-from": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-export-namespace-from/-/plugin-transform-export-namespace-from-7.27.1.tgz", + "integrity": "sha512-tQvHWSZ3/jH2xuq/vZDy0jNn+ZdXJeM8gHvX4lnJmsc3+50yPlWdZXIc5ay+umX+2/tJIqHqiEqcJvxlmIvRvQ==", + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.27.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-for-of": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.27.1.tgz", + "integrity": "sha512-BfbWFFEJFQzLCQ5N8VocnCtA8J1CLkNTe2Ms2wocj75dd6VpiqS5Z5quTYcUoo4Yq+DN0rtikODccuv7RU81sw==", + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.27.1", + "@babel/helper-skip-transparent-expression-wrappers": "^7.27.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-function-name": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-function-name/-/plugin-transform-function-name-7.27.1.tgz", + "integrity": "sha512-1bQeydJF9Nr1eBCMMbC+hdwmRlsv5XYOMu03YSWFwNs0HsAmtSxxF1fyuYPqemVldVyFmlCU7w8UE14LupUSZQ==", + "license": "MIT", + "dependencies": { + "@babel/helper-compilation-targets": "^7.27.1", + "@babel/helper-plugin-utils": "^7.27.1", + "@babel/traverse": "^7.27.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-json-strings": { + "version": "7.28.6", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-json-strings/-/plugin-transform-json-strings-7.28.6.tgz", + "integrity": "sha512-Nr+hEN+0geQkzhbdgQVPoqr47lZbm+5fCUmO70722xJZd0Mvb59+33QLImGj6F+DkK3xgDi1YVysP8whD6FQAw==", + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.28.6" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-literals": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-literals/-/plugin-transform-literals-7.27.1.tgz", + "integrity": "sha512-0HCFSepIpLTkLcsi86GG3mTUzxV5jpmbv97hTETW3yzrAij8aqlD36toB1D0daVFJM8NK6GvKO0gslVQmm+zZA==", + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.27.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-logical-assignment-operators": { + "version": "7.28.6", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-logical-assignment-operators/-/plugin-transform-logical-assignment-operators-7.28.6.tgz", + "integrity": "sha512-+anKKair6gpi8VsM/95kmomGNMD0eLz1NQ8+Pfw5sAwWH9fGYXT50E55ZpV0pHUHWf6IUTWPM+f/7AAff+wr9A==", + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.28.6" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-member-expression-literals": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-member-expression-literals/-/plugin-transform-member-expression-literals-7.27.1.tgz", + "integrity": "sha512-hqoBX4dcZ1I33jCSWcXrP+1Ku7kdqXf1oeah7ooKOIiAdKQ+uqftgCFNOSzA5AMS2XIHEYeGFg4cKRCdpxzVOQ==", + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.27.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-modules-amd": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.27.1.tgz", + "integrity": "sha512-iCsytMg/N9/oFq6n+gFTvUYDZQOMK5kEdeYxmxt91fcJGycfxVP9CnrxoliM0oumFERba2i8ZtwRUCMhvP1LnA==", + "license": "MIT", + "dependencies": { + "@babel/helper-module-transforms": "^7.27.1", + "@babel/helper-plugin-utils": "^7.27.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-modules-commonjs": { + "version": "7.28.6", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.28.6.tgz", + "integrity": "sha512-jppVbf8IV9iWWwWTQIxJMAJCWBuuKx71475wHwYytrRGQ2CWiDvYlADQno3tcYpS/T2UUWFQp3nVtYfK/YBQrA==", + "license": "MIT", + "dependencies": { + "@babel/helper-module-transforms": "^7.28.6", + "@babel/helper-plugin-utils": "^7.28.6" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-modules-systemjs": { + "version": "7.29.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.29.0.tgz", + "integrity": "sha512-PrujnVFbOdUpw4UHiVwKvKRLMMic8+eC0CuNlxjsyZUiBjhFdPsewdXCkveh2KqBA9/waD0W1b4hXSOBQJezpQ==", + "license": "MIT", + "dependencies": { + "@babel/helper-module-transforms": "^7.28.6", + "@babel/helper-plugin-utils": "^7.28.6", + "@babel/helper-validator-identifier": "^7.28.5", + "@babel/traverse": "^7.29.0" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-modules-umd": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-umd/-/plugin-transform-modules-umd-7.27.1.tgz", + "integrity": "sha512-iQBE/xC5BV1OxJbp6WG7jq9IWiD+xxlZhLrdwpPkTX3ydmXdvoCpyfJN7acaIBZaOqTfr76pgzqBJflNbeRK+w==", + "license": "MIT", + "dependencies": { + "@babel/helper-module-transforms": "^7.27.1", + "@babel/helper-plugin-utils": "^7.27.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-named-capturing-groups-regex": { + "version": "7.29.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-named-capturing-groups-regex/-/plugin-transform-named-capturing-groups-regex-7.29.0.tgz", + "integrity": "sha512-1CZQA5KNAD6ZYQLPw7oi5ewtDNxH/2vuCh+6SmvgDfhumForvs8a1o9n0UrEoBD8HU4djO2yWngTQlXl1NDVEQ==", + "license": "MIT", + "dependencies": { + "@babel/helper-create-regexp-features-plugin": "^7.28.5", + "@babel/helper-plugin-utils": "^7.28.6" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/plugin-transform-new-target": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-new-target/-/plugin-transform-new-target-7.27.1.tgz", + "integrity": "sha512-f6PiYeqXQ05lYq3TIfIDu/MtliKUbNwkGApPUvyo6+tc7uaR4cPjPe7DFPr15Uyycg2lZU6btZ575CuQoYh7MQ==", + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.27.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-nullish-coalescing-operator": { + "version": "7.28.6", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-nullish-coalescing-operator/-/plugin-transform-nullish-coalescing-operator-7.28.6.tgz", + "integrity": "sha512-3wKbRgmzYbw24mDJXT7N+ADXw8BC/imU9yo9c9X9NKaLF1fW+e5H1U5QjMUBe4Qo4Ox/o++IyUkl1sVCLgevKg==", + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.28.6" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-numeric-separator": { + "version": "7.28.6", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-numeric-separator/-/plugin-transform-numeric-separator-7.28.6.tgz", + "integrity": "sha512-SJR8hPynj8outz+SlStQSwvziMN4+Bq99it4tMIf5/Caq+3iOc0JtKyse8puvyXkk3eFRIA5ID/XfunGgO5i6w==", + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.28.6" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-object-rest-spread": { + "version": "7.28.6", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-object-rest-spread/-/plugin-transform-object-rest-spread-7.28.6.tgz", + "integrity": "sha512-5rh+JR4JBC4pGkXLAcYdLHZjXudVxWMXbB6u6+E9lRL5TrGVbHt1TjxGbZ8CkmYw9zjkB7jutzOROArsqtncEA==", + "license": "MIT", + "dependencies": { + "@babel/helper-compilation-targets": "^7.28.6", + "@babel/helper-plugin-utils": "^7.28.6", + "@babel/plugin-transform-destructuring": "^7.28.5", + "@babel/plugin-transform-parameters": "^7.27.7", + "@babel/traverse": "^7.28.6" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-object-super": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-object-super/-/plugin-transform-object-super-7.27.1.tgz", + "integrity": "sha512-SFy8S9plRPbIcxlJ8A6mT/CxFdJx/c04JEctz4jf8YZaVS2px34j7NXRrlGlHkN/M2gnpL37ZpGRGVFLd3l8Ng==", + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.27.1", + "@babel/helper-replace-supers": "^7.27.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-optional-catch-binding": { + "version": "7.28.6", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-optional-catch-binding/-/plugin-transform-optional-catch-binding-7.28.6.tgz", + "integrity": "sha512-R8ja/Pyrv0OGAvAXQhSTmWyPJPml+0TMqXlO5w+AsMEiwb2fg3WkOvob7UxFSL3OIttFSGSRFKQsOhJ/X6HQdQ==", + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.28.6" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-optional-chaining": { + "version": "7.28.6", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-optional-chaining/-/plugin-transform-optional-chaining-7.28.6.tgz", + "integrity": "sha512-A4zobikRGJTsX9uqVFdafzGkqD30t26ck2LmOzAuLL8b2x6k3TIqRiT2xVvA9fNmFeTX484VpsdgmKNA0bS23w==", + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.28.6", + "@babel/helper-skip-transparent-expression-wrappers": "^7.27.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-parameters": { + "version": "7.27.7", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.27.7.tgz", + "integrity": "sha512-qBkYTYCb76RRxUM6CcZA5KRu8K4SM8ajzVeUgVdMVO9NN9uI/GaVmBg/WKJJGnNokV9SY8FxNOVWGXzqzUidBg==", + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.27.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-private-methods": { + "version": "7.28.6", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-private-methods/-/plugin-transform-private-methods-7.28.6.tgz", + "integrity": "sha512-piiuapX9CRv7+0st8lmuUlRSmX6mBcVeNQ1b4AYzJxfCMuBfB0vBXDiGSmm03pKJw1v6cZ8KSeM+oUnM6yAExg==", + "license": "MIT", + "dependencies": { + "@babel/helper-create-class-features-plugin": "^7.28.6", + "@babel/helper-plugin-utils": "^7.28.6" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-private-property-in-object": { + "version": "7.28.6", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-private-property-in-object/-/plugin-transform-private-property-in-object-7.28.6.tgz", + "integrity": "sha512-b97jvNSOb5+ehyQmBpmhOCiUC5oVK4PMnpRvO7+ymFBoqYjeDHIU9jnrNUuwHOiL9RpGDoKBpSViarV+BU+eVA==", + "license": "MIT", + "dependencies": { + "@babel/helper-annotate-as-pure": "^7.27.3", + "@babel/helper-create-class-features-plugin": "^7.28.6", + "@babel/helper-plugin-utils": "^7.28.6" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-property-literals": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-property-literals/-/plugin-transform-property-literals-7.27.1.tgz", + "integrity": "sha512-oThy3BCuCha8kDZ8ZkgOg2exvPYUlprMukKQXI1r1pJ47NCvxfkEy8vK+r/hT9nF0Aa4H1WUPZZjHTFtAhGfmQ==", + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.27.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-regenerator": { + "version": "7.29.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.29.0.tgz", + "integrity": "sha512-FijqlqMA7DmRdg/aINBSs04y8XNTYw/lr1gJ2WsmBnnaNw1iS43EPkJW+zK7z65auG3AWRFXWj+NcTQwYptUog==", + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.28.6" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-regexp-modifiers": { + "version": "7.28.6", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-regexp-modifiers/-/plugin-transform-regexp-modifiers-7.28.6.tgz", + "integrity": "sha512-QGWAepm9qxpaIs7UM9FvUSnCGlb8Ua1RhyM4/veAxLwt3gMat/LSGrZixyuj4I6+Kn9iwvqCyPTtbdxanYoWYg==", + "license": "MIT", + "dependencies": { + "@babel/helper-create-regexp-features-plugin": "^7.28.5", + "@babel/helper-plugin-utils": "^7.28.6" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/plugin-transform-reserved-words": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-reserved-words/-/plugin-transform-reserved-words-7.27.1.tgz", + "integrity": "sha512-V2ABPHIJX4kC7HegLkYoDpfg9PVmuWy/i6vUM5eGK22bx4YVFD3M5F0QQnWQoDs6AGsUWTVOopBiMFQgHaSkVw==", + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.27.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-runtime": { + "version": "7.29.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-runtime/-/plugin-transform-runtime-7.29.0.tgz", + "integrity": "sha512-jlaRT5dJtMaMCV6fAuLbsQMSwz/QkvaHOHOSXRitGGwSpR1blCY4KUKoyP2tYO8vJcqYe8cEj96cqSztv3uF9w==", + "license": "MIT", + "dependencies": { + "@babel/helper-module-imports": "^7.28.6", + "@babel/helper-plugin-utils": "^7.28.6", + "babel-plugin-polyfill-corejs2": "^0.4.14", + "babel-plugin-polyfill-corejs3": "^0.13.0", + "babel-plugin-polyfill-regenerator": "^0.6.5", + "semver": "^6.3.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-runtime/node_modules/semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/@babel/plugin-transform-shorthand-properties": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-shorthand-properties/-/plugin-transform-shorthand-properties-7.27.1.tgz", + "integrity": "sha512-N/wH1vcn4oYawbJ13Y/FxcQrWk63jhfNa7jef0ih7PHSIHX2LB7GWE1rkPrOnka9kwMxb6hMl19p7lidA+EHmQ==", + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.27.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-spread": { + "version": "7.28.6", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-spread/-/plugin-transform-spread-7.28.6.tgz", + "integrity": "sha512-9U4QObUC0FtJl05AsUcodau/RWDytrU6uKgkxu09mLR9HLDAtUMoPuuskm5huQsoktmsYpI+bGmq+iapDcriKA==", + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.28.6", + "@babel/helper-skip-transparent-expression-wrappers": "^7.27.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-sticky-regex": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-sticky-regex/-/plugin-transform-sticky-regex-7.27.1.tgz", + "integrity": "sha512-lhInBO5bi/Kowe2/aLdBAawijx+q1pQzicSgnkB6dUPc1+RC8QmJHKf2OjvU+NZWitguJHEaEmbV6VWEouT58g==", + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.27.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-template-literals": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-template-literals/-/plugin-transform-template-literals-7.27.1.tgz", + "integrity": "sha512-fBJKiV7F2DxZUkg5EtHKXQdbsbURW3DZKQUWphDum0uRP6eHGGa/He9mc0mypL680pb+e/lDIthRohlv8NCHkg==", + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.27.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-typeof-symbol": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-typeof-symbol/-/plugin-transform-typeof-symbol-7.27.1.tgz", + "integrity": "sha512-RiSILC+nRJM7FY5srIyc4/fGIwUhyDuuBSdWn4y6yT6gm652DpCHZjIipgn6B7MQ1ITOUnAKWixEUjQRIBIcLw==", + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.27.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-unicode-escapes": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-unicode-escapes/-/plugin-transform-unicode-escapes-7.27.1.tgz", + "integrity": "sha512-Ysg4v6AmF26k9vpfFuTZg8HRfVWzsh1kVfowA23y9j/Gu6dOuahdUVhkLqpObp3JIv27MLSii6noRnuKN8H0Mg==", + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.27.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-unicode-property-regex": { + "version": "7.28.6", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-unicode-property-regex/-/plugin-transform-unicode-property-regex-7.28.6.tgz", + "integrity": "sha512-4Wlbdl/sIZjzi/8St0evF0gEZrgOswVO6aOzqxh1kDZOl9WmLrHq2HtGhnOJZmHZYKP8WZ1MDLCt5DAWwRo57A==", + "license": "MIT", + "dependencies": { + "@babel/helper-create-regexp-features-plugin": "^7.28.5", + "@babel/helper-plugin-utils": "^7.28.6" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-unicode-regex": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-unicode-regex/-/plugin-transform-unicode-regex-7.27.1.tgz", + "integrity": "sha512-xvINq24TRojDuyt6JGtHmkVkrfVV3FPT16uytxImLeBZqW3/H52yN+kM1MGuyPkIQxrzKwPHs5U/MP3qKyzkGw==", + "license": "MIT", + "dependencies": { + "@babel/helper-create-regexp-features-plugin": "^7.27.1", + "@babel/helper-plugin-utils": "^7.27.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-unicode-sets-regex": { + "version": "7.28.6", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-unicode-sets-regex/-/plugin-transform-unicode-sets-regex-7.28.6.tgz", + "integrity": "sha512-/wHc/paTUmsDYN7SZkpWxogTOBNnlx7nBQYfy6JJlCT7G3mVhltk3e++N7zV0XfgGsrqBxd4rJQt9H16I21Y1Q==", + "license": "MIT", + "dependencies": { + "@babel/helper-create-regexp-features-plugin": "^7.28.5", + "@babel/helper-plugin-utils": "^7.28.6" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/preset-env": { + "version": "7.29.0", + "resolved": "https://registry.npmjs.org/@babel/preset-env/-/preset-env-7.29.0.tgz", + "integrity": "sha512-fNEdfc0yi16lt6IZo2Qxk3knHVdfMYX33czNb4v8yWhemoBhibCpQK/uYHtSKIiO+p/zd3+8fYVXhQdOVV608w==", + "license": "MIT", + "dependencies": { + "@babel/compat-data": "^7.29.0", + "@babel/helper-compilation-targets": "^7.28.6", + "@babel/helper-plugin-utils": "^7.28.6", + "@babel/helper-validator-option": "^7.27.1", + "@babel/plugin-bugfix-firefox-class-in-computed-class-key": "^7.28.5", + "@babel/plugin-bugfix-safari-class-field-initializer-scope": "^7.27.1", + "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression": "^7.27.1", + "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": "^7.27.1", + "@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly": "^7.28.6", + "@babel/plugin-proposal-private-property-in-object": "7.21.0-placeholder-for-preset-env.2", + "@babel/plugin-syntax-import-assertions": "^7.28.6", + "@babel/plugin-syntax-import-attributes": "^7.28.6", + "@babel/plugin-syntax-unicode-sets-regex": "^7.18.6", + "@babel/plugin-transform-arrow-functions": "^7.27.1", + "@babel/plugin-transform-async-generator-functions": "^7.29.0", + "@babel/plugin-transform-async-to-generator": "^7.28.6", + "@babel/plugin-transform-block-scoped-functions": "^7.27.1", + "@babel/plugin-transform-block-scoping": "^7.28.6", + "@babel/plugin-transform-class-properties": "^7.28.6", + "@babel/plugin-transform-class-static-block": "^7.28.6", + "@babel/plugin-transform-classes": "^7.28.6", + "@babel/plugin-transform-computed-properties": "^7.28.6", + "@babel/plugin-transform-destructuring": "^7.28.5", + "@babel/plugin-transform-dotall-regex": "^7.28.6", + "@babel/plugin-transform-duplicate-keys": "^7.27.1", + "@babel/plugin-transform-duplicate-named-capturing-groups-regex": "^7.29.0", + "@babel/plugin-transform-dynamic-import": "^7.27.1", + "@babel/plugin-transform-explicit-resource-management": "^7.28.6", + "@babel/plugin-transform-exponentiation-operator": "^7.28.6", + "@babel/plugin-transform-export-namespace-from": "^7.27.1", + "@babel/plugin-transform-for-of": "^7.27.1", + "@babel/plugin-transform-function-name": "^7.27.1", + "@babel/plugin-transform-json-strings": "^7.28.6", + "@babel/plugin-transform-literals": "^7.27.1", + "@babel/plugin-transform-logical-assignment-operators": "^7.28.6", + "@babel/plugin-transform-member-expression-literals": "^7.27.1", + "@babel/plugin-transform-modules-amd": "^7.27.1", + "@babel/plugin-transform-modules-commonjs": "^7.28.6", + "@babel/plugin-transform-modules-systemjs": "^7.29.0", + "@babel/plugin-transform-modules-umd": "^7.27.1", + "@babel/plugin-transform-named-capturing-groups-regex": "^7.29.0", + "@babel/plugin-transform-new-target": "^7.27.1", + "@babel/plugin-transform-nullish-coalescing-operator": "^7.28.6", + "@babel/plugin-transform-numeric-separator": "^7.28.6", + "@babel/plugin-transform-object-rest-spread": "^7.28.6", + "@babel/plugin-transform-object-super": "^7.27.1", + "@babel/plugin-transform-optional-catch-binding": "^7.28.6", + "@babel/plugin-transform-optional-chaining": "^7.28.6", + "@babel/plugin-transform-parameters": "^7.27.7", + "@babel/plugin-transform-private-methods": "^7.28.6", + "@babel/plugin-transform-private-property-in-object": "^7.28.6", + "@babel/plugin-transform-property-literals": "^7.27.1", + "@babel/plugin-transform-regenerator": "^7.29.0", + "@babel/plugin-transform-regexp-modifiers": "^7.28.6", + "@babel/plugin-transform-reserved-words": "^7.27.1", + "@babel/plugin-transform-shorthand-properties": "^7.27.1", + "@babel/plugin-transform-spread": "^7.28.6", + "@babel/plugin-transform-sticky-regex": "^7.27.1", + "@babel/plugin-transform-template-literals": "^7.27.1", + "@babel/plugin-transform-typeof-symbol": "^7.27.1", + "@babel/plugin-transform-unicode-escapes": "^7.27.1", + "@babel/plugin-transform-unicode-property-regex": "^7.28.6", + "@babel/plugin-transform-unicode-regex": "^7.27.1", + "@babel/plugin-transform-unicode-sets-regex": "^7.28.6", + "@babel/preset-modules": "0.1.6-no-external-plugins", + "babel-plugin-polyfill-corejs2": "^0.4.15", + "babel-plugin-polyfill-corejs3": "^0.14.0", + "babel-plugin-polyfill-regenerator": "^0.6.6", + "core-js-compat": "^3.48.0", + "semver": "^6.3.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/preset-env/node_modules/babel-plugin-polyfill-corejs3": { + "version": "0.14.0", + "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-corejs3/-/babel-plugin-polyfill-corejs3-0.14.0.tgz", + "integrity": "sha512-AvDcMxJ34W4Wgy4KBIIePQTAOP1Ie2WFwkQp3dB7FQ/f0lI5+nM96zUnYEOE1P9sEg0es5VCP0HxiWu5fUHZAQ==", + "license": "MIT", + "dependencies": { + "@babel/helper-define-polyfill-provider": "^0.6.6", + "core-js-compat": "^3.48.0" + }, + "peerDependencies": { + "@babel/core": "^7.4.0 || ^8.0.0-0 <8.0.0" + } + }, + "node_modules/@babel/preset-env/node_modules/semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/@babel/preset-modules": { + "version": "0.1.6-no-external-plugins", + "resolved": "https://registry.npmjs.org/@babel/preset-modules/-/preset-modules-0.1.6-no-external-plugins.tgz", + "integrity": "sha512-HrcgcIESLm9aIR842yhJ5RWan/gebQUJ6E/E5+rf0y9o6oj7w0Br+sWuL6kEQ/o/AdfvR1Je9jG18/gnpwjEyA==", + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.0.0", + "@babel/types": "^7.4.4", + "esutils": "^2.0.2" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0 || ^8.0.0-0 <8.0.0" + } + }, + "node_modules/@babel/runtime": { + "version": "7.28.6", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.28.6.tgz", + "integrity": "sha512-05WQkdpL9COIMz4LjTxGpPNCdlpyimKppYNoJ5Di5EUObifl8t4tuLuUBBZEpoLYOmfvIWrsp9fCl0HoPRVTdA==", + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/template": { + "version": "7.28.6", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.28.6.tgz", + "integrity": "sha512-YA6Ma2KsCdGb+WC6UpBVFJGXL58MDA6oyONbjyF/+5sBgxY/dwkhLogbMT2GXXyU84/IhRw/2D1Os1B/giz+BQ==", + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.28.6", + "@babel/parser": "^7.28.6", + "@babel/types": "^7.28.6" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/traverse": { + "version": "7.29.0", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.29.0.tgz", + "integrity": "sha512-4HPiQr0X7+waHfyXPZpWPfWL/J7dcN1mx9gL6WdQVMbPnF3+ZhSMs8tCxN7oHddJE9fhNE7+lxdnlyemKfJRuA==", + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.29.0", + "@babel/generator": "^7.29.0", + "@babel/helper-globals": "^7.28.0", + "@babel/parser": "^7.29.0", + "@babel/template": "^7.28.6", + "@babel/types": "^7.29.0", + "debug": "^4.3.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/types": { + "version": "7.29.0", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.29.0.tgz", + "integrity": "sha512-LwdZHpScM4Qz8Xw2iKSzS+cfglZzJGvofQICy7W7v4caru4EaAmyUuO6BGrbyQ2mYV11W0U8j5mBhd14dd3B0A==", + "license": "MIT", + "dependencies": { + "@babel/helper-string-parser": "^7.27.1", + "@babel/helper-validator-identifier": "^7.28.5" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@balena/dockerignore": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@balena/dockerignore/-/dockerignore-1.0.2.tgz", + "integrity": "sha512-wMue2Sy4GAVTk6Ic4tJVcnfdau+gx2EnG7S+uAEe+TWJFqE4YoWN4/H8MSLj4eYJKxGg26lZwboEniNiNwZQ6Q==", + "license": "Apache-2.0" + }, + "node_modules/@develar/schema-utils": { + "version": "2.6.5", + "resolved": "https://registry.npmjs.org/@develar/schema-utils/-/schema-utils-2.6.5.tgz", + "integrity": "sha512-0cp4PsWQ/9avqTVMCtZ+GirikIA36ikvjtHweU4/j8yLtgObI0+JUPhYFScgwlteveGB1rt3Cm8UhN04XayDig==", + "dev": true, + "license": "MIT", + "dependencies": { + "ajv": "^6.12.0", + "ajv-keywords": "^3.4.1" + }, + "engines": { + "node": ">= 8.9.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + } + }, + "node_modules/@discoveryjs/json-ext": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/@discoveryjs/json-ext/-/json-ext-0.5.7.tgz", + "integrity": "sha512-dBVuXR082gk3jsFp7Rd/JI4kytwGHecnCoTtXFb7DB6CNHp4rg5k1bhg0nWdLGLnOV71lmDzGQaLMy8iPLY0pw==", + "license": "MIT", + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/@eclipse-dash/nodejs-wrapper": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/@eclipse-dash/nodejs-wrapper/-/nodejs-wrapper-0.0.1.tgz", + "integrity": "sha512-Rkk8O8hEVi/+LC/co7ly1zGLVwCNJG3yPbalsz1FHAqk6WZyEaWNf29EX6jz4vTfR5wpv2xAfF2yokKuStiOdA==", + "dev": true, + "license": "EPL-2.0", + "bin": { + "dash-licenses-wrapper": "src/dash-licenses-wrapper.js" + } + }, + "node_modules/@electron/asar": { + "version": "3.4.1", + "resolved": "https://registry.npmjs.org/@electron/asar/-/asar-3.4.1.tgz", + "integrity": "sha512-i4/rNPRS84t0vSRa2HorerGRXWyF4vThfHesw0dmcWHp+cspK743UanA0suA5Q5y8kzY2y6YKrvbIUn69BCAiA==", + "dev": true, + "license": "MIT", + "dependencies": { + "commander": "^5.0.0", + "glob": "^7.1.6", + "minimatch": "^3.0.4" + }, + "bin": { + "asar": "bin/asar.js" + }, + "engines": { + "node": ">=10.12.0" + } + }, + "node_modules/@electron/asar/node_modules/commander": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-5.1.0.tgz", + "integrity": "sha512-P0CysNDQ7rtVw4QIQtm+MRxV66vKFSvlsQvGYXZWR3qFU0jlMKHZZZgw8e+8DSah4UDKMqnknRDQz+xuQXQ/Zg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 6" + } + }, + "node_modules/@electron/asar/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/@electron/get": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/@electron/get/-/get-2.0.3.tgz", + "integrity": "sha512-Qkzpg2s9GnVV2I2BjRksUi43U5e6+zaQMcjoJy0C+C5oxaKl+fmckGDQFtRpZpZV0NQekuZZ+tGz7EA9TVnQtQ==", + "license": "MIT", + "dependencies": { + "debug": "^4.1.1", + "env-paths": "^2.2.0", + "fs-extra": "^8.1.0", + "got": "^11.8.5", + "progress": "^2.0.3", + "semver": "^6.2.0", + "sumchecker": "^3.0.1" + }, + "engines": { + "node": ">=12" + }, + "optionalDependencies": { + "global-agent": "^3.0.0" + } + }, + "node_modules/@electron/get/node_modules/fs-extra": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz", + "integrity": "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==", + "license": "MIT", + "dependencies": { + "graceful-fs": "^4.2.0", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + }, + "engines": { + "node": ">=6 <7 || >=8" + } + }, + "node_modules/@electron/get/node_modules/semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/@electron/node-gyp": { + "version": "10.2.0-electron.1", + "resolved": "git+ssh://git@github.com/electron/node-gyp.git#06b29aafb7708acef8b3669835c8a7857ebc92d2", + "integrity": "sha512-CrYo6TntjpoMO1SHjl5Pa/JoUsECNqNdB7Kx49WLQpWzPw53eEITJ2Hs9fh/ryUYDn4pxZz11StaBYBrLFJdqg==", + "license": "MIT", + "dependencies": { + "env-paths": "^2.2.0", + "exponential-backoff": "^3.1.1", + "glob": "^8.1.0", + "graceful-fs": "^4.2.6", + "make-fetch-happen": "^10.2.1", + "nopt": "^6.0.0", + "proc-log": "^2.0.1", + "semver": "^7.3.5", + "tar": "^6.2.1", + "which": "^2.0.2" + }, + "bin": { + "node-gyp": "bin/node-gyp.js" + }, + "engines": { + "node": ">=12.13.0" + } + }, + "node_modules/@electron/node-gyp/node_modules/@npmcli/fs": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/@npmcli/fs/-/fs-2.1.2.tgz", + "integrity": "sha512-yOJKRvohFOaLqipNtwYB9WugyZKhC/DZC4VYPmpaCzDBrA8YpK3qHZ8/HGscMnE4GqbkLNuVcCnxkeQEdGt6LQ==", + "license": "ISC", + "dependencies": { + "@gar/promisify": "^1.1.3", + "semver": "^7.3.5" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + } + }, + "node_modules/@electron/node-gyp/node_modules/abbrev": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", + "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", + "license": "ISC" + }, + "node_modules/@electron/node-gyp/node_modules/brace-expansion": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz", + "integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==", + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/@electron/node-gyp/node_modules/cacache": { + "version": "16.1.3", + "resolved": "https://registry.npmjs.org/cacache/-/cacache-16.1.3.tgz", + "integrity": "sha512-/+Emcj9DAXxX4cwlLmRI9c166RuL3w30zp4R7Joiv2cQTtTtA+jeuCAjH3ZlGnYS3tKENSrKhAzVVP9GVyzeYQ==", + "license": "ISC", + "dependencies": { + "@npmcli/fs": "^2.1.0", + "@npmcli/move-file": "^2.0.0", + "chownr": "^2.0.0", + "fs-minipass": "^2.1.0", + "glob": "^8.0.1", + "infer-owner": "^1.0.4", + "lru-cache": "^7.7.1", + "minipass": "^3.1.6", + "minipass-collect": "^1.0.2", + "minipass-flush": "^1.0.5", + "minipass-pipeline": "^1.2.4", + "mkdirp": "^1.0.4", + "p-map": "^4.0.0", + "promise-inflight": "^1.0.1", + "rimraf": "^3.0.2", + "ssri": "^9.0.0", + "tar": "^6.1.11", + "unique-filename": "^2.0.0" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + } + }, + "node_modules/@electron/node-gyp/node_modules/chownr": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/chownr/-/chownr-2.0.0.tgz", + "integrity": "sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==", + "license": "ISC", + "engines": { + "node": ">=10" + } + }, + "node_modules/@electron/node-gyp/node_modules/fs-minipass": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-2.1.0.tgz", + "integrity": "sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg==", + "license": "ISC", + "dependencies": { + "minipass": "^3.0.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@electron/node-gyp/node_modules/glob": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-8.1.0.tgz", + "integrity": "sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==", + "deprecated": "Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me", + "license": "ISC", + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^5.0.1", + "once": "^1.3.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/@electron/node-gyp/node_modules/http-proxy-agent": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-5.0.0.tgz", + "integrity": "sha512-n2hY8YdoRE1i7r6M0w9DIw5GgZN0G25P8zLCRQ8rjXtTU3vsNFBI/vWK/UIeE6g5MUUz6avwAPXmL6Fy9D/90w==", + "license": "MIT", + "dependencies": { + "@tootallnate/once": "2", + "agent-base": "6", + "debug": "4" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/@electron/node-gyp/node_modules/https-proxy-agent": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz", + "integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==", + "license": "MIT", + "dependencies": { + "agent-base": "6", + "debug": "4" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/@electron/node-gyp/node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "license": "ISC" + }, + "node_modules/@electron/node-gyp/node_modules/lru-cache": { + "version": "7.18.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.18.3.tgz", + "integrity": "sha512-jumlc0BIUrS3qJGgIkWZsyfAM7NCWiBcCDhnd+3NNM5KbBmLTgHVfWBcg6W+rLUsIpzpERPsvwUP7CckAQSOoA==", + "license": "ISC", + "engines": { + "node": ">=12" + } + }, + "node_modules/@electron/node-gyp/node_modules/make-fetch-happen": { + "version": "10.2.1", + "resolved": "https://registry.npmjs.org/make-fetch-happen/-/make-fetch-happen-10.2.1.tgz", + "integrity": "sha512-NgOPbRiaQM10DYXvN3/hhGVI2M5MtITFryzBGxHM5p4wnFxsVCbxkrBrDsk+EZ5OB4jEOT7AjDxtdF+KVEFT7w==", + "license": "ISC", + "dependencies": { + "agentkeepalive": "^4.2.1", + "cacache": "^16.1.0", + "http-cache-semantics": "^4.1.0", + "http-proxy-agent": "^5.0.0", + "https-proxy-agent": "^5.0.0", + "is-lambda": "^1.0.1", + "lru-cache": "^7.7.1", + "minipass": "^3.1.6", + "minipass-collect": "^1.0.2", + "minipass-fetch": "^2.0.3", + "minipass-flush": "^1.0.5", + "minipass-pipeline": "^1.2.4", + "negotiator": "^0.6.3", + "promise-retry": "^2.0.1", + "socks-proxy-agent": "^7.0.0", + "ssri": "^9.0.0" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + } + }, + "node_modules/@electron/node-gyp/node_modules/minimatch": { + "version": "5.1.6", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", + "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==", + "license": "ISC", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@electron/node-gyp/node_modules/minipass": { + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", + "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", + "license": "ISC", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@electron/node-gyp/node_modules/minipass-collect": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/minipass-collect/-/minipass-collect-1.0.2.tgz", + "integrity": "sha512-6T6lH0H8OG9kITm/Jm6tdooIbogG9e0tLgpY6mphXSm/A9u8Nq1ryBG+Qspiub9LjWlBPsPS3tWQ/Botq4FdxA==", + "license": "ISC", + "dependencies": { + "minipass": "^3.0.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@electron/node-gyp/node_modules/minipass-fetch": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/minipass-fetch/-/minipass-fetch-2.1.2.tgz", + "integrity": "sha512-LT49Zi2/WMROHYoqGgdlQIZh8mLPZmOrN2NdJjMXxYe4nkN6FUyuPuOAOedNJDrx0IRGg9+4guZewtp8hE6TxA==", + "license": "MIT", + "dependencies": { + "minipass": "^3.1.6", + "minipass-sized": "^1.0.3", + "minizlib": "^2.1.2" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + }, + "optionalDependencies": { + "encoding": "^0.1.13" + } + }, + "node_modules/@electron/node-gyp/node_modules/minizlib": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-2.1.2.tgz", + "integrity": "sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg==", + "license": "MIT", + "dependencies": { + "minipass": "^3.0.0", + "yallist": "^4.0.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@electron/node-gyp/node_modules/mkdirp": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", + "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", + "license": "MIT", + "bin": { + "mkdirp": "bin/cmd.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@electron/node-gyp/node_modules/nopt": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/nopt/-/nopt-6.0.0.tgz", + "integrity": "sha512-ZwLpbTgdhuZUnZzjd7nb1ZV+4DoiC6/sfiVKok72ym/4Tlf+DFdlHYmT2JPmcNNWV6Pi3SDf1kT+A4r9RTuT9g==", + "license": "ISC", + "dependencies": { + "abbrev": "^1.0.0" + }, + "bin": { + "nopt": "bin/nopt.js" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + } + }, + "node_modules/@electron/node-gyp/node_modules/proc-log": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/proc-log/-/proc-log-2.0.1.tgz", + "integrity": "sha512-Kcmo2FhfDTXdcbfDH76N7uBYHINxc/8GW7UAVuVP9I+Va3uHSerrnKV6dLooga/gh7GlgzuCCr/eoldnL1muGw==", + "license": "ISC", + "engines": { + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + } + }, + "node_modules/@electron/node-gyp/node_modules/rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "deprecated": "Rimraf versions prior to v4 are no longer supported", + "license": "ISC", + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/@electron/node-gyp/node_modules/rimraf/node_modules/brace-expansion": { + "version": "1.1.12", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz", + "integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==", + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/@electron/node-gyp/node_modules/rimraf/node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "deprecated": "Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me", + "license": "ISC", + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/@electron/node-gyp/node_modules/rimraf/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/@electron/node-gyp/node_modules/socks-proxy-agent": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/socks-proxy-agent/-/socks-proxy-agent-7.0.0.tgz", + "integrity": "sha512-Fgl0YPZ902wEsAyiQ+idGd1A7rSFx/ayC1CQVMw5P+EQx2V0SgpGtf6OKFhVjPflPUl9YMmEOnmfjCdMUsygww==", + "license": "MIT", + "dependencies": { + "agent-base": "^6.0.2", + "debug": "^4.3.3", + "socks": "^2.6.2" + }, + "engines": { + "node": ">= 10" + } + }, + "node_modules/@electron/node-gyp/node_modules/ssri": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/ssri/-/ssri-9.0.1.tgz", + "integrity": "sha512-o57Wcn66jMQvfHG1FlYbWeZWW/dHZhJXjpIcTfXldXEk5nz5lStPo3mK0OJQfGR3RbZUlbISexbljkJzuEj/8Q==", + "license": "ISC", + "dependencies": { + "minipass": "^3.1.1" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + } + }, + "node_modules/@electron/node-gyp/node_modules/tar": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/tar/-/tar-6.2.1.tgz", + "integrity": "sha512-DZ4yORTwrbTj/7MZYq2w+/ZFdI6OZ/f9SFHR+71gIVUZhOQPHzVCLpvRnPgyaMpfWxxk/4ONva3GQSyNIKRv6A==", + "deprecated": "Old versions of tar are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me", + "license": "ISC", + "dependencies": { + "chownr": "^2.0.0", + "fs-minipass": "^2.0.0", + "minipass": "^5.0.0", + "minizlib": "^2.1.1", + "mkdirp": "^1.0.3", + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@electron/node-gyp/node_modules/tar/node_modules/minipass": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-5.0.0.tgz", + "integrity": "sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==", + "license": "ISC", + "engines": { + "node": ">=8" + } + }, + "node_modules/@electron/node-gyp/node_modules/unique-filename": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/unique-filename/-/unique-filename-2.0.1.tgz", + "integrity": "sha512-ODWHtkkdx3IAR+veKxFV+VBkUMcN+FaqzUUd7IZzt+0zhDZFPFxhlqwPF3YQvMHx1TD0tdgYl+kuPnJ8E6ql7A==", + "license": "ISC", + "dependencies": { + "unique-slug": "^3.0.0" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + } + }, + "node_modules/@electron/node-gyp/node_modules/unique-slug": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/unique-slug/-/unique-slug-3.0.0.tgz", + "integrity": "sha512-8EyMynh679x/0gqE9fT9oilG+qEt+ibFyqjuVTsZn1+CMxH+XLlpvr2UZx4nVcCwTpx81nICr2JQFkM+HPLq4w==", + "license": "ISC", + "dependencies": { + "imurmurhash": "^0.1.4" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + } + }, + "node_modules/@electron/node-gyp/node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "license": "ISC", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@electron/notarize": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/@electron/notarize/-/notarize-2.5.0.tgz", + "integrity": "sha512-jNT8nwH1f9X5GEITXaQ8IF/KdskvIkOFfB2CvwumsveVidzpSc+mvhhTMdAGSYF3O+Nq49lJ7y+ssODRXu06+A==", + "dev": true, + "license": "MIT", + "dependencies": { + "debug": "^4.1.1", + "fs-extra": "^9.0.1", + "promise-retry": "^2.0.1" + }, + "engines": { + "node": ">= 10.0.0" + } + }, + "node_modules/@electron/notarize/node_modules/fs-extra": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.1.0.tgz", + "integrity": "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "at-least-node": "^1.0.0", + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@electron/notarize/node_modules/jsonfile": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.2.0.tgz", + "integrity": "sha512-FGuPw30AdOIUTRMC2OMRtQV+jkVj2cfPqSeWXv1NEAJ1qZ5zb1X6z1mFhbfOB/iy3ssJCD+3KuZ8r8C3uVFlAg==", + "dev": true, + "license": "MIT", + "dependencies": { + "universalify": "^2.0.0" + }, + "optionalDependencies": { + "graceful-fs": "^4.1.6" + } + }, + "node_modules/@electron/notarize/node_modules/universalify": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz", + "integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 10.0.0" + } + }, + "node_modules/@electron/osx-sign": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/@electron/osx-sign/-/osx-sign-1.3.1.tgz", + "integrity": "sha512-BAfviURMHpmb1Yb50YbCxnOY0wfwaLXH5KJ4+80zS0gUkzDX3ec23naTlEqKsN+PwYn+a1cCzM7BJ4Wcd3sGzw==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "compare-version": "^0.1.2", + "debug": "^4.3.4", + "fs-extra": "^10.0.0", + "isbinaryfile": "^4.0.8", + "minimist": "^1.2.6", + "plist": "^3.0.5" + }, + "bin": { + "electron-osx-flat": "bin/electron-osx-flat.js", + "electron-osx-sign": "bin/electron-osx-sign.js" + }, + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/@electron/osx-sign/node_modules/fs-extra": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.1.0.tgz", + "integrity": "sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@electron/osx-sign/node_modules/isbinaryfile": { + "version": "4.0.10", + "resolved": "https://registry.npmjs.org/isbinaryfile/-/isbinaryfile-4.0.10.tgz", + "integrity": "sha512-iHrqe5shvBUcFbmZq9zOQHBoeOhZJu6RQGrDpBgenUm/Am+F3JM2MgQj+rK3Z601fzrL5gLZWtAPH2OBaSVcyw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 8.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/gjtorikian/" + } + }, + "node_modules/@electron/osx-sign/node_modules/jsonfile": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.2.0.tgz", + "integrity": "sha512-FGuPw30AdOIUTRMC2OMRtQV+jkVj2cfPqSeWXv1NEAJ1qZ5zb1X6z1mFhbfOB/iy3ssJCD+3KuZ8r8C3uVFlAg==", + "dev": true, + "license": "MIT", + "dependencies": { + "universalify": "^2.0.0" + }, + "optionalDependencies": { + "graceful-fs": "^4.1.6" + } + }, + "node_modules/@electron/osx-sign/node_modules/universalify": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz", + "integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 10.0.0" + } + }, + "node_modules/@electron/rebuild": { + "version": "3.7.2", + "resolved": "https://registry.npmjs.org/@electron/rebuild/-/rebuild-3.7.2.tgz", + "integrity": "sha512-19/KbIR/DAxbsCkiaGMXIdPnMCJLkcf8AvGnduJtWBs/CBwiAjY1apCqOLVxrXg+rtXFCngbXhBanWjxLUt1Mg==", + "license": "MIT", + "dependencies": { + "@electron/node-gyp": "git+https://github.com/electron/node-gyp.git#06b29aafb7708acef8b3669835c8a7857ebc92d2", + "@malept/cross-spawn-promise": "^2.0.0", + "chalk": "^4.0.0", + "debug": "^4.1.1", + "detect-libc": "^2.0.1", + "fs-extra": "^10.0.0", + "got": "^11.7.0", + "node-abi": "^3.45.0", + "node-api-version": "^0.2.0", + "ora": "^5.1.0", + "read-binary-file-arch": "^1.0.6", + "semver": "^7.3.5", + "tar": "^6.0.5", + "yargs": "^17.0.1" + }, + "bin": { + "electron-rebuild": "lib/cli.js" + }, + "engines": { + "node": ">=12.13.0" + } + }, + "node_modules/@electron/rebuild/node_modules/chownr": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/chownr/-/chownr-2.0.0.tgz", + "integrity": "sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==", + "license": "ISC", + "engines": { + "node": ">=10" + } + }, + "node_modules/@electron/rebuild/node_modules/fs-extra": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.1.0.tgz", + "integrity": "sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==", + "license": "MIT", + "dependencies": { + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@electron/rebuild/node_modules/fs-minipass": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-2.1.0.tgz", + "integrity": "sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg==", + "license": "ISC", + "dependencies": { + "minipass": "^3.0.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@electron/rebuild/node_modules/fs-minipass/node_modules/minipass": { + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", + "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", + "license": "ISC", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@electron/rebuild/node_modules/jsonfile": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.2.0.tgz", + "integrity": "sha512-FGuPw30AdOIUTRMC2OMRtQV+jkVj2cfPqSeWXv1NEAJ1qZ5zb1X6z1mFhbfOB/iy3ssJCD+3KuZ8r8C3uVFlAg==", + "license": "MIT", + "dependencies": { + "universalify": "^2.0.0" + }, + "optionalDependencies": { + "graceful-fs": "^4.1.6" + } + }, + "node_modules/@electron/rebuild/node_modules/minipass": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-5.0.0.tgz", + "integrity": "sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==", + "license": "ISC", + "engines": { + "node": ">=8" + } + }, + "node_modules/@electron/rebuild/node_modules/minizlib": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-2.1.2.tgz", + "integrity": "sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg==", + "license": "MIT", + "dependencies": { + "minipass": "^3.0.0", + "yallist": "^4.0.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@electron/rebuild/node_modules/minizlib/node_modules/minipass": { + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", + "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", + "license": "ISC", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@electron/rebuild/node_modules/mkdirp": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", + "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", + "license": "MIT", + "bin": { + "mkdirp": "bin/cmd.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@electron/rebuild/node_modules/node-abi": { + "version": "3.87.0", + "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.87.0.tgz", + "integrity": "sha512-+CGM1L1CgmtheLcBuleyYOn7NWPVu0s0EJH2C4puxgEZb9h8QpR9G2dBfZJOAUhi7VQxuBPMd0hiISWcTyiYyQ==", + "license": "MIT", + "dependencies": { + "semver": "^7.3.5" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@electron/rebuild/node_modules/tar": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/tar/-/tar-6.2.1.tgz", + "integrity": "sha512-DZ4yORTwrbTj/7MZYq2w+/ZFdI6OZ/f9SFHR+71gIVUZhOQPHzVCLpvRnPgyaMpfWxxk/4ONva3GQSyNIKRv6A==", + "deprecated": "Old versions of tar are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me", + "license": "ISC", + "dependencies": { + "chownr": "^2.0.0", + "fs-minipass": "^2.0.0", + "minipass": "^5.0.0", + "minizlib": "^2.1.1", + "mkdirp": "^1.0.3", + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@electron/rebuild/node_modules/universalify": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz", + "integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==", + "license": "MIT", + "engines": { + "node": ">= 10.0.0" + } + }, + "node_modules/@electron/rebuild/node_modules/y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "license": "ISC", + "engines": { + "node": ">=10" + } + }, + "node_modules/@electron/rebuild/node_modules/yargs": { + "version": "17.7.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", + "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", + "license": "MIT", + "dependencies": { + "cliui": "^8.0.1", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.3", + "y18n": "^5.0.5", + "yargs-parser": "^21.1.1" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@electron/universal": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@electron/universal/-/universal-2.0.1.tgz", + "integrity": "sha512-fKpv9kg4SPmt+hY7SVBnIYULE9QJl8L3sCfcBsnqbJwwBwAeTLokJ9TRt9y7bK0JAzIW2y78TVVjvnQEms/yyA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@electron/asar": "^3.2.7", + "@malept/cross-spawn-promise": "^2.0.0", + "debug": "^4.3.1", + "dir-compare": "^4.2.0", + "fs-extra": "^11.1.1", + "minimatch": "^9.0.3", + "plist": "^3.1.0" + }, + "engines": { + "node": ">=16.4" + } + }, + "node_modules/@electron/universal/node_modules/brace-expansion": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz", + "integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/@electron/universal/node_modules/fs-extra": { + "version": "11.3.3", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.3.3.tgz", + "integrity": "sha512-VWSRii4t0AFm6ixFFmLLx1t7wS1gh+ckoa84aOeapGum0h+EZd1EhEumSB+ZdDLnEPuucsVB9oB7cxJHap6Afg==", + "dev": true, + "license": "MIT", + "dependencies": { + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + }, + "engines": { + "node": ">=14.14" + } + }, + "node_modules/@electron/universal/node_modules/jsonfile": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.2.0.tgz", + "integrity": "sha512-FGuPw30AdOIUTRMC2OMRtQV+jkVj2cfPqSeWXv1NEAJ1qZ5zb1X6z1mFhbfOB/iy3ssJCD+3KuZ8r8C3uVFlAg==", + "dev": true, + "license": "MIT", + "dependencies": { + "universalify": "^2.0.0" + }, + "optionalDependencies": { + "graceful-fs": "^4.1.6" + } + }, + "node_modules/@electron/universal/node_modules/minimatch": { + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", + "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/@electron/universal/node_modules/universalify": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz", + "integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 10.0.0" + } + }, + "node_modules/@emnapi/core": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/@emnapi/core/-/core-1.8.1.tgz", + "integrity": "sha512-AvT9QFpxK0Zd8J0jopedNm+w/2fIzvtPKPjqyw9jwvBaReTTqPBk9Hixaz7KbjimP+QNz605/XnjFcDAL2pqBg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@emnapi/wasi-threads": "1.1.0", + "tslib": "^2.4.0" + } + }, + "node_modules/@emnapi/runtime": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.8.1.tgz", + "integrity": "sha512-mehfKSMWjjNol8659Z8KxEMrdSJDDot5SXMq00dM8BN4o+CLNXQ0xH2V7EchNHV4RmbZLmmPdEaXZc5H2FXmDg==", + "dev": true, + "license": "MIT", + "dependencies": { + "tslib": "^2.4.0" + } + }, + "node_modules/@emnapi/wasi-threads": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@emnapi/wasi-threads/-/wasi-threads-1.1.0.tgz", + "integrity": "sha512-WI0DdZ8xFSbgMjR1sFsKABJ/C5OnRrjT06JXbZKexJGrDuPTzZdDYfFlsgcCXCyf+suG5QU2e/y1Wo2V/OapLQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "tslib": "^2.4.0" + } + }, + "node_modules/@eslint-community/eslint-utils": { + "version": "4.9.1", + "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.9.1.tgz", + "integrity": "sha512-phrYmNiYppR7znFEdqgfWHXR6NCkZEK7hwWDHZUjit/2/U0r6XvkDl0SYnoM51Hq7FhCGdLDT6zxCCOY1hexsQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "eslint-visitor-keys": "^3.4.3" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + }, + "peerDependencies": { + "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" + } + }, + "node_modules/@eslint-community/regexpp": { + "version": "4.12.2", + "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.12.2.tgz", + "integrity": "sha512-EriSTlt5OC9/7SXkRSCAhfSxxoSUgBm33OH+IkwbdpgoqsSsUg7y3uh+IICI/Qg4BBWr3U2i39RpmycbxMq4ew==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^12.0.0 || ^14.0.0 || >=16.0.0" + } + }, + "node_modules/@eslint/eslintrc": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.4.tgz", + "integrity": "sha512-269Z39MS6wVJtsoUl10L60WdkhJVdPG24Q4eZTH3nnF6lpvSShEK3wQjDX9JRWAUPvPh7COouPpU9IrqaZFvtQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ajv": "^6.12.4", + "debug": "^4.3.2", + "espree": "^9.6.0", + "globals": "^13.19.0", + "ignore": "^5.2.0", + "import-fresh": "^3.2.1", + "js-yaml": "^4.1.0", + "minimatch": "^3.1.2", + "strip-json-comments": "^3.1.1" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/@eslint/eslintrc/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/@eslint/js": { + "version": "8.57.1", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.57.1.tgz", + "integrity": "sha512-d9zaMRSTIKDLhctzH12MtXvJKSSUhaHcjV+2Z+GK+EEY7XKpP5yR4x+N3TAcHTcu963nIr+TMcCb4DBCYX1z6Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + } + }, + "node_modules/@gar/promisify": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/@gar/promisify/-/promisify-1.1.3.tgz", + "integrity": "sha512-k2Ty1JcVojjJFwrg/ThKi2ujJ7XNLYaFGNB/bWT9wGR+oSMJHMa5w+CUq6p/pVrKeNNgA7pCqEcjSnHVoqJQFw==", + "license": "MIT" + }, + "node_modules/@gerrit0/mini-shiki": { + "version": "3.22.0", + "resolved": "https://registry.npmjs.org/@gerrit0/mini-shiki/-/mini-shiki-3.22.0.tgz", + "integrity": "sha512-jMpciqEVUBKE1QwU64S4saNMzpsSza6diNCk4MWAeCxO2+LFi2FIFmL2S0VDLzEJCxuvCbU783xi8Hp/gkM5CQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@shikijs/engine-oniguruma": "^3.22.0", + "@shikijs/langs": "^3.22.0", + "@shikijs/themes": "^3.22.0", + "@shikijs/types": "^3.22.0", + "@shikijs/vscode-textmate": "^10.0.2" + } + }, + "node_modules/@google/genai": { + "version": "1.40.0", + "resolved": "https://registry.npmjs.org/@google/genai/-/genai-1.40.0.tgz", + "integrity": "sha512-fhIww8smT0QYRX78qWOiz/nIQhHMF5wXOrlXvj33HBrz3vKDBb+wibLcEmTA+L9dmPD4KmfNr7UF3LDQVTXNjA==", + "license": "Apache-2.0", + "dependencies": { + "google-auth-library": "^10.3.0", + "protobufjs": "^7.5.4", + "ws": "^8.18.0" + }, + "engines": { + "node": ">=20.0.0" + }, + "peerDependencies": { + "@modelcontextprotocol/sdk": "^1.25.2" + }, + "peerDependenciesMeta": { + "@modelcontextprotocol/sdk": { + "optional": true + } + } + }, + "node_modules/@grpc/grpc-js": { + "version": "1.14.3", + "resolved": "https://registry.npmjs.org/@grpc/grpc-js/-/grpc-js-1.14.3.tgz", + "integrity": "sha512-Iq8QQQ/7X3Sac15oB6p0FmUg/klxQvXLeileoqrTRGJYLV+/9tubbr9ipz0GKHjmXVsgFPo/+W+2cA8eNcR+XA==", + "license": "Apache-2.0", + "dependencies": { + "@grpc/proto-loader": "^0.8.0", + "@js-sdsl/ordered-map": "^4.4.2" + }, + "engines": { + "node": ">=12.10.0" + } + }, + "node_modules/@grpc/grpc-js/node_modules/@grpc/proto-loader": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/@grpc/proto-loader/-/proto-loader-0.8.0.tgz", + "integrity": "sha512-rc1hOQtjIWGxcxpb9aHAfLpIctjEnsDehj0DAiVfBlmT84uvR0uUtN2hEi/ecvWVjXUGf5qPF4qEgiLOx1YIMQ==", + "license": "Apache-2.0", + "dependencies": { + "lodash.camelcase": "^4.3.0", + "long": "^5.0.0", + "protobufjs": "^7.5.3", + "yargs": "^17.7.2" + }, + "bin": { + "proto-loader-gen-types": "build/bin/proto-loader-gen-types.js" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/@grpc/grpc-js/node_modules/y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "license": "ISC", + "engines": { + "node": ">=10" + } + }, + "node_modules/@grpc/grpc-js/node_modules/yargs": { + "version": "17.7.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", + "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", + "license": "MIT", + "dependencies": { + "cliui": "^8.0.1", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.3", + "y18n": "^5.0.5", + "yargs-parser": "^21.1.1" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@grpc/proto-loader": { + "version": "0.7.15", + "resolved": "https://registry.npmjs.org/@grpc/proto-loader/-/proto-loader-0.7.15.tgz", + "integrity": "sha512-tMXdRCfYVixjuFK+Hk0Q1s38gV9zDiDJfWL3h1rv4Qc39oILCu1TRTDt7+fGUI8K4G1Fj125Hx/ru3azECWTyQ==", + "license": "Apache-2.0", + "dependencies": { + "lodash.camelcase": "^4.3.0", + "long": "^5.0.0", + "protobufjs": "^7.2.5", + "yargs": "^17.7.2" + }, + "bin": { + "proto-loader-gen-types": "build/bin/proto-loader-gen-types.js" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/@grpc/proto-loader/node_modules/y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "license": "ISC", + "engines": { + "node": ">=10" + } + }, + "node_modules/@grpc/proto-loader/node_modules/yargs": { + "version": "17.7.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", + "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", + "license": "MIT", + "dependencies": { + "cliui": "^8.0.1", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.3", + "y18n": "^5.0.5", + "yargs-parser": "^21.1.1" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@hono/node-server": { + "version": "1.19.9", + "resolved": "https://registry.npmjs.org/@hono/node-server/-/node-server-1.19.9.tgz", + "integrity": "sha512-vHL6w3ecZsky+8P5MD+eFfaGTyCeOHUIFYMGpQGbrBTSmNNoxv0if69rEZ5giu36weC5saFuznL411gRX7bJDw==", + "license": "MIT", + "engines": { + "node": ">=18.14.1" + }, + "peerDependencies": { + "hono": "^4" + } + }, + "node_modules/@huggingface/inference": { + "version": "4.13.12", + "resolved": "https://registry.npmjs.org/@huggingface/inference/-/inference-4.13.12.tgz", + "integrity": "sha512-fmv4VnQ0u1lUDPEp8iuUe+5awXIoBFGnemBBmuAKEdYmwPhLFkBHSIDPML8OPkf9rUQ4gM7ANqE5w3AqoA2hQw==", + "license": "MIT", + "dependencies": { + "@huggingface/jinja": "^0.5.5", + "@huggingface/tasks": "^0.19.83" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@huggingface/jinja": { + "version": "0.5.5", + "resolved": "https://registry.npmjs.org/@huggingface/jinja/-/jinja-0.5.5.tgz", + "integrity": "sha512-xRlzazC+QZwr6z4ixEqYHo9fgwhTZ3xNSdljlKfUFGZSdlvt166DljRELFUfFytlYOYvo3vTisA/AFOuOAzFQQ==", + "license": "MIT", + "engines": { + "node": ">=18" + } + }, + "node_modules/@huggingface/tasks": { + "version": "0.19.83", + "resolved": "https://registry.npmjs.org/@huggingface/tasks/-/tasks-0.19.83.tgz", + "integrity": "sha512-nBt3S6x+MWUTmfey1drQZRMuEopEbz2aEMUsoddfpCuzIYAMCsJDX7xeNuJnzvbVGis3gXXCRcLHVhFtHaaiyA==", + "license": "MIT" + }, + "node_modules/@humanwhocodes/config-array": { + "version": "0.13.0", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.13.0.tgz", + "integrity": "sha512-DZLEEqFWQFiyK6h5YIeynKx7JlvCYWL0cImfSRXZ9l4Sg2efkFGTuFf6vzXjK1cq6IYkU+Eg/JizXw+TD2vRNw==", + "deprecated": "Use @eslint/config-array instead", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@humanwhocodes/object-schema": "^2.0.3", + "debug": "^4.3.1", + "minimatch": "^3.0.5" + }, + "engines": { + "node": ">=10.10.0" + } + }, + "node_modules/@humanwhocodes/config-array/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/@humanwhocodes/module-importer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", + "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=12.22" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } + }, + "node_modules/@humanwhocodes/object-schema": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.3.tgz", + "integrity": "sha512-93zYdMES/c1D69yZiKDBj0V24vqNzB/koF26KPaagAfd3P/4gUlh3Dys5ogAK+Exi9QyzlD8x/08Zt7wIKcDcA==", + "deprecated": "Use @eslint/object-schema instead", + "dev": true, + "license": "BSD-3-Clause" + }, + "node_modules/@hutson/parse-repository-url": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@hutson/parse-repository-url/-/parse-repository-url-3.0.2.tgz", + "integrity": "sha512-H9XAx3hc0BQHY6l+IFSWHDySypcXsvsuLhgYLUGywmJ5pswRVQJUHpOsobnLYp2ZUaUlKiKDrgWWhosOwAEM8Q==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@inquirer/ansi": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@inquirer/ansi/-/ansi-1.0.2.tgz", + "integrity": "sha512-S8qNSZiYzFd0wAcyG5AXCvUHC5Sr7xpZ9wZ2py9XR88jUz8wooStVx5M6dRzczbBWjic9NP7+rY0Xi7qqK/aMQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + } + }, + "node_modules/@inquirer/checkbox": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/@inquirer/checkbox/-/checkbox-4.3.2.tgz", + "integrity": "sha512-VXukHf0RR1doGe6Sm4F0Em7SWYLTHSsbGfJdS9Ja2bX5/D5uwVOEjr07cncLROdBvmnvCATYEWlHqYmXv2IlQA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@inquirer/ansi": "^1.0.2", + "@inquirer/core": "^10.3.2", + "@inquirer/figures": "^1.0.15", + "@inquirer/type": "^3.0.10", + "yoctocolors-cjs": "^2.1.3" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "@types/node": ">=18" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + } + } + }, + "node_modules/@inquirer/confirm": { + "version": "5.1.21", + "resolved": "https://registry.npmjs.org/@inquirer/confirm/-/confirm-5.1.21.tgz", + "integrity": "sha512-KR8edRkIsUayMXV+o3Gv+q4jlhENF9nMYUZs9PA2HzrXeHI8M5uDag70U7RJn9yyiMZSbtF5/UexBtAVtZGSbQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@inquirer/core": "^10.3.2", + "@inquirer/type": "^3.0.10" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "@types/node": ">=18" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + } + } + }, + "node_modules/@inquirer/core": { + "version": "10.3.2", + "resolved": "https://registry.npmjs.org/@inquirer/core/-/core-10.3.2.tgz", + "integrity": "sha512-43RTuEbfP8MbKzedNqBrlhhNKVwoK//vUFNW3Q3vZ88BLcrs4kYpGg+B2mm5p2K/HfygoCxuKwJJiv8PbGmE0A==", + "dev": true, + "license": "MIT", + "dependencies": { + "@inquirer/ansi": "^1.0.2", + "@inquirer/figures": "^1.0.15", + "@inquirer/type": "^3.0.10", + "cli-width": "^4.1.0", + "mute-stream": "^2.0.0", + "signal-exit": "^4.1.0", + "wrap-ansi": "^6.2.0", + "yoctocolors-cjs": "^2.1.3" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "@types/node": ">=18" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + } + } + }, + "node_modules/@inquirer/core/node_modules/signal-exit": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", + "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/@inquirer/editor": { + "version": "4.2.23", + "resolved": "https://registry.npmjs.org/@inquirer/editor/-/editor-4.2.23.tgz", + "integrity": "sha512-aLSROkEwirotxZ1pBaP8tugXRFCxW94gwrQLxXfrZsKkfjOYC1aRvAZuhpJOb5cu4IBTJdsCigUlf2iCOu4ZDQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@inquirer/core": "^10.3.2", + "@inquirer/external-editor": "^1.0.3", + "@inquirer/type": "^3.0.10" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "@types/node": ">=18" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + } + } + }, + "node_modules/@inquirer/expand": { + "version": "4.0.23", + "resolved": "https://registry.npmjs.org/@inquirer/expand/-/expand-4.0.23.tgz", + "integrity": "sha512-nRzdOyFYnpeYTTR2qFwEVmIWypzdAx/sIkCMeTNTcflFOovfqUk+HcFhQQVBftAh9gmGrpFj6QcGEqrDMDOiew==", + "dev": true, + "license": "MIT", + "dependencies": { + "@inquirer/core": "^10.3.2", + "@inquirer/type": "^3.0.10", + "yoctocolors-cjs": "^2.1.3" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "@types/node": ">=18" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + } + } + }, + "node_modules/@inquirer/external-editor": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@inquirer/external-editor/-/external-editor-1.0.3.tgz", + "integrity": "sha512-RWbSrDiYmO4LbejWY7ttpxczuwQyZLBUyygsA9Nsv95hpzUWwnNTVQmAq3xuh7vNwCp07UTmE5i11XAEExx4RA==", + "dev": true, + "license": "MIT", + "dependencies": { + "chardet": "^2.1.1", + "iconv-lite": "^0.7.0" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "@types/node": ">=18" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + } + } + }, + "node_modules/@inquirer/external-editor/node_modules/iconv-lite": { + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.7.2.tgz", + "integrity": "sha512-im9DjEDQ55s9fL4EYzOAv0yMqmMBSZp6G0VvFyTMPKWxiSBHUj9NW/qqLmXUwXrrM7AvqSlTCfvqRb0cM8yYqw==", + "dev": true, + "license": "MIT", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3.0.0" + }, + "engines": { + "node": ">=0.10.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/@inquirer/figures": { + "version": "1.0.15", + "resolved": "https://registry.npmjs.org/@inquirer/figures/-/figures-1.0.15.tgz", + "integrity": "sha512-t2IEY+unGHOzAaVM5Xx6DEWKeXlDDcNPeDyUpsRc6CUhBfU3VQOEl+Vssh7VNp1dR8MdUJBWhuObjXCsVpjN5g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + } + }, + "node_modules/@inquirer/input": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/@inquirer/input/-/input-4.3.1.tgz", + "integrity": "sha512-kN0pAM4yPrLjJ1XJBjDxyfDduXOuQHrBB8aLDMueuwUGn+vNpF7Gq7TvyVxx8u4SHlFFj4trmj+a2cbpG4Jn1g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@inquirer/core": "^10.3.2", + "@inquirer/type": "^3.0.10" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "@types/node": ">=18" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + } + } + }, + "node_modules/@inquirer/number": { + "version": "3.0.23", + "resolved": "https://registry.npmjs.org/@inquirer/number/-/number-3.0.23.tgz", + "integrity": "sha512-5Smv0OK7K0KUzUfYUXDXQc9jrf8OHo4ktlEayFlelCjwMXz0299Y8OrI+lj7i4gCBY15UObk76q0QtxjzFcFcg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@inquirer/core": "^10.3.2", + "@inquirer/type": "^3.0.10" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "@types/node": ">=18" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + } + } + }, + "node_modules/@inquirer/password": { + "version": "4.0.23", + "resolved": "https://registry.npmjs.org/@inquirer/password/-/password-4.0.23.tgz", + "integrity": "sha512-zREJHjhT5vJBMZX/IUbyI9zVtVfOLiTO66MrF/3GFZYZ7T4YILW5MSkEYHceSii/KtRk+4i3RE7E1CUXA2jHcA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@inquirer/ansi": "^1.0.2", + "@inquirer/core": "^10.3.2", + "@inquirer/type": "^3.0.10" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "@types/node": ">=18" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + } + } + }, + "node_modules/@inquirer/prompts": { + "version": "7.10.1", + "resolved": "https://registry.npmjs.org/@inquirer/prompts/-/prompts-7.10.1.tgz", + "integrity": "sha512-Dx/y9bCQcXLI5ooQ5KyvA4FTgeo2jYj/7plWfV5Ak5wDPKQZgudKez2ixyfz7tKXzcJciTxqLeK7R9HItwiByg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@inquirer/checkbox": "^4.3.2", + "@inquirer/confirm": "^5.1.21", + "@inquirer/editor": "^4.2.23", + "@inquirer/expand": "^4.0.23", + "@inquirer/input": "^4.3.1", + "@inquirer/number": "^3.0.23", + "@inquirer/password": "^4.0.23", + "@inquirer/rawlist": "^4.1.11", + "@inquirer/search": "^3.2.2", + "@inquirer/select": "^4.4.2" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "@types/node": ">=18" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + } + } + }, + "node_modules/@inquirer/rawlist": { + "version": "4.1.11", + "resolved": "https://registry.npmjs.org/@inquirer/rawlist/-/rawlist-4.1.11.tgz", + "integrity": "sha512-+LLQB8XGr3I5LZN/GuAHo+GpDJegQwuPARLChlMICNdwW7OwV2izlCSCxN6cqpL0sMXmbKbFcItJgdQq5EBXTw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@inquirer/core": "^10.3.2", + "@inquirer/type": "^3.0.10", + "yoctocolors-cjs": "^2.1.3" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "@types/node": ">=18" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + } + } + }, + "node_modules/@inquirer/search": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/@inquirer/search/-/search-3.2.2.tgz", + "integrity": "sha512-p2bvRfENXCZdWF/U2BXvnSI9h+tuA8iNqtUKb9UWbmLYCRQxd8WkvwWvYn+3NgYaNwdUkHytJMGG4MMLucI1kA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@inquirer/core": "^10.3.2", + "@inquirer/figures": "^1.0.15", + "@inquirer/type": "^3.0.10", + "yoctocolors-cjs": "^2.1.3" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "@types/node": ">=18" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + } + } + }, + "node_modules/@inquirer/select": { + "version": "4.4.2", + "resolved": "https://registry.npmjs.org/@inquirer/select/-/select-4.4.2.tgz", + "integrity": "sha512-l4xMuJo55MAe+N7Qr4rX90vypFwCajSakx59qe/tMaC1aEHWLyw68wF4o0A4SLAY4E0nd+Vt+EyskeDIqu1M6w==", + "dev": true, + "license": "MIT", + "dependencies": { + "@inquirer/ansi": "^1.0.2", + "@inquirer/core": "^10.3.2", + "@inquirer/figures": "^1.0.15", + "@inquirer/type": "^3.0.10", + "yoctocolors-cjs": "^2.1.3" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "@types/node": ">=18" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + } + } + }, + "node_modules/@inquirer/type": { + "version": "3.0.10", + "resolved": "https://registry.npmjs.org/@inquirer/type/-/type-3.0.10.tgz", + "integrity": "sha512-BvziSRxfz5Ov8ch0z/n3oijRSEcEsHnhggm4xFZe93DHcUCTlutlq9Ox4SVENAfcRD22UQq7T/atg9Wr3k09eA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "@types/node": ">=18" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + } + } + }, + "node_modules/@inversifyjs/common": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@inversifyjs/common/-/common-1.4.0.tgz", + "integrity": "sha512-qfRJ/3iOlCL/VfJq8+4o5X4oA14cZSBbpAmHsYj8EsIit1xDndoOl0xKOyglKtQD4u4gdNVxMHx4RWARk/I4QA==", + "license": "MIT" + }, + "node_modules/@inversifyjs/core": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/@inversifyjs/core/-/core-1.3.5.tgz", + "integrity": "sha512-B4MFXabhNTAmrfgB+yeD6wd/GIvmvWC6IQ8Rh/j2C3Ix69kmqwz9pr8Jt3E+Nho9aEHOQCZaGmrALgtqRd+oEQ==", + "license": "MIT", + "dependencies": { + "@inversifyjs/common": "1.4.0", + "@inversifyjs/reflect-metadata-utils": "0.2.4" + } + }, + "node_modules/@inversifyjs/reflect-metadata-utils": { + "version": "0.2.4", + "resolved": "https://registry.npmjs.org/@inversifyjs/reflect-metadata-utils/-/reflect-metadata-utils-0.2.4.tgz", + "integrity": "sha512-u95rV3lKfG+NT2Uy/5vNzoDujos8vN8O18SSA5UyhxsGYd4GLQn/eUsGXfOsfa7m34eKrDelTKRUX1m/BcNX5w==", + "license": "MIT", + "peerDependencies": { + "reflect-metadata": "0.2.2" + } + }, + "node_modules/@isaacs/balanced-match": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/@isaacs/balanced-match/-/balanced-match-4.0.1.tgz", + "integrity": "sha512-yzMTt9lEb8Gv7zRioUilSglI0c0smZ9k5D65677DLWLtWJaXIS3CqcGyUFByYKlnUj6TkjLVs54fBl6+TiGQDQ==", + "license": "MIT", + "engines": { + "node": "20 || >=22" + } + }, + "node_modules/@isaacs/brace-expansion": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/@isaacs/brace-expansion/-/brace-expansion-5.0.1.tgz", + "integrity": "sha512-WMz71T1JS624nWj2n2fnYAuPovhv7EUhk69R6i9dsVyzxt5eM3bjwvgk9L+APE1TRscGysAVMANkB0jh0LQZrQ==", + "license": "MIT", + "dependencies": { + "@isaacs/balanced-match": "^4.0.1" + }, + "engines": { + "node": "20 || >=22" + } + }, + "node_modules/@isaacs/cliui": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-9.0.0.tgz", + "integrity": "sha512-AokJm4tuBHillT+FpMtxQ60n8ObyXBatq7jD2/JA9dxbDDokKQm8KMht5ibGzLVU9IJDIKK4TPKgMHEYMn3lMg==", + "dev": true, + "license": "BlueOak-1.0.0", + "engines": { + "node": ">=18" + } + }, + "node_modules/@isaacs/fs-minipass": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/@isaacs/fs-minipass/-/fs-minipass-4.0.1.tgz", + "integrity": "sha512-wgm9Ehl2jpeqP3zw/7mo3kRHFp5MEDhqAdwy1fTGkHAwnkGOVsgpvQhL8B5n1qlb01jV3n/bI0ZfZp5lWA1k4w==", + "dev": true, + "license": "ISC", + "dependencies": { + "minipass": "^7.0.4" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@isaacs/string-locale-compare": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@isaacs/string-locale-compare/-/string-locale-compare-1.1.0.tgz", + "integrity": "sha512-SQ7Kzhh9+D+ZW9MA0zkYv3VXhIDNx+LzM6EJ+/65I3QY+enU6Itte7E5XX7EWrqLW2FN4n06GWzBnPoC3th2aQ==", + "dev": true, + "license": "ISC" + }, + "node_modules/@istanbuljs/load-nyc-config": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz", + "integrity": "sha512-VjeHSlIzpv/NyD3N0YuHfXOPDIixcA1q2ZV98wsMqcYlPmv2n3Yb2lYP9XMElnaFVXg5A7YLTeLu6V84uQDjmQ==", + "dev": true, + "license": "ISC", + "dependencies": { + "camelcase": "^5.3.1", + "find-up": "^4.1.0", + "get-package-type": "^0.1.0", + "js-yaml": "^3.13.1", + "resolve-from": "^5.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@istanbuljs/load-nyc-config/node_modules/argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "dev": true, + "license": "MIT", + "dependencies": { + "sprintf-js": "~1.0.2" + } + }, + "node_modules/@istanbuljs/load-nyc-config/node_modules/find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dev": true, + "license": "MIT", + "dependencies": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml": { + "version": "3.14.2", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.2.tgz", + "integrity": "sha512-PMSmkqxr106Xa156c2M265Z+FTrPl+oxd/rgOQy2tijQeK5TxQ43psO1ZCwhVOSdnn+RzkzlRz/eY4BgJBYVpg==", + "dev": true, + "license": "MIT", + "dependencies": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/@istanbuljs/load-nyc-config/node_modules/locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-locate": "^4.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@istanbuljs/load-nyc-config/node_modules/p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-try": "^2.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@istanbuljs/load-nyc-config/node_modules/p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-limit": "^2.2.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@istanbuljs/load-nyc-config/node_modules/resolve-from": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", + "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/@istanbuljs/schema": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/@istanbuljs/schema/-/schema-0.1.3.tgz", + "integrity": "sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/@jest/diff-sequences": { + "version": "30.0.1", + "resolved": "https://registry.npmjs.org/@jest/diff-sequences/-/diff-sequences-30.0.1.tgz", + "integrity": "sha512-n5H8QLDJ47QqbCNn5SuFjCRDrOLEZ0h8vAHCK5RL9Ls7Xa8AQLa/YxAc9UjFqoEDM48muwtBGjtMY5cr0PLDCw==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" + } + }, + "node_modules/@jest/get-type": { + "version": "30.1.0", + "resolved": "https://registry.npmjs.org/@jest/get-type/-/get-type-30.1.0.tgz", + "integrity": "sha512-eMbZE2hUnx1WV0pmURZY9XoXPkUYjpc55mb0CrhtdWLtzMQPFvu/rZkTLZFTsdaVQa+Tr4eWAteqcUzoawq/uA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" + } + }, + "node_modules/@jest/schemas": { + "version": "30.0.5", + "resolved": "https://registry.npmjs.org/@jest/schemas/-/schemas-30.0.5.tgz", + "integrity": "sha512-DmdYgtezMkh3cpU8/1uyXakv3tJRcmcXxBOcO0tbaozPwpmh4YMsnWrQm9ZmZMfa5ocbxzbFk6O4bDPEc/iAnA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@sinclair/typebox": "^0.34.0" + }, + "engines": { + "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" + } + }, + "node_modules/@jridgewell/gen-mapping": { + "version": "0.3.13", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz", + "integrity": "sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==", + "license": "MIT", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.5.0", + "@jridgewell/trace-mapping": "^0.3.24" + } + }, + "node_modules/@jridgewell/remapping": { + "version": "2.3.5", + "resolved": "https://registry.npmjs.org/@jridgewell/remapping/-/remapping-2.3.5.tgz", + "integrity": "sha512-LI9u/+laYG4Ds1TDKSJW2YPrIlcVYOwi2fUC6xB43lueCjgxV4lffOCZCtYFiH6TNOX+tQKXx97T4IKHbhyHEQ==", + "license": "MIT", + "dependencies": { + "@jridgewell/gen-mapping": "^0.3.5", + "@jridgewell/trace-mapping": "^0.3.24" + } + }, + "node_modules/@jridgewell/resolve-uri": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", + "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", + "license": "MIT", + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/source-map": { + "version": "0.3.11", + "resolved": "https://registry.npmjs.org/@jridgewell/source-map/-/source-map-0.3.11.tgz", + "integrity": "sha512-ZMp1V8ZFcPG5dIWnQLr3NSI1MiCU7UETdS/A0G8V/XWHvJv3ZsFqutJn1Y5RPmAPX6F3BiE397OqveU/9NCuIA==", + "license": "MIT", + "dependencies": { + "@jridgewell/gen-mapping": "^0.3.5", + "@jridgewell/trace-mapping": "^0.3.25" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.5.5", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.5.tgz", + "integrity": "sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og==", + "license": "MIT" + }, + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.31", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.31.tgz", + "integrity": "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==", + "license": "MIT", + "dependencies": { + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" + } + }, + "node_modules/@js-sdsl/ordered-map": { + "version": "4.4.2", + "resolved": "https://registry.npmjs.org/@js-sdsl/ordered-map/-/ordered-map-4.4.2.tgz", + "integrity": "sha512-iUKgm52T8HOE/makSxjqoWhe95ZJA1/G1sYsGev2JDKUSS14KAgg1LHb+Ba+IPow0xflbnSkOsZcO08C7w1gYw==", + "license": "MIT", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/js-sdsl" + } + }, + "node_modules/@kwsites/file-exists": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@kwsites/file-exists/-/file-exists-1.1.1.tgz", + "integrity": "sha512-m9/5YGR18lIwxSFDwfE3oA7bWuq9kdau6ugN4H2rJeyhFQZcG9AgSHkQtSD15a8WvTgfz9aikZMrKPHvbpqFiw==", + "license": "MIT", + "dependencies": { + "debug": "^4.1.1" + } + }, + "node_modules/@kwsites/promise-deferred": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@kwsites/promise-deferred/-/promise-deferred-1.1.1.tgz", + "integrity": "sha512-GaHYm+c0O9MjZRu0ongGBRbinu8gVAMd2UZjji6jVmqKtZluZnptXGWhz1E8j8D2HJ3f/yMxKAUC0b+57wncIw==", + "license": "MIT" + }, + "node_modules/@lerna/create": { + "version": "9.0.4", + "resolved": "https://registry.npmjs.org/@lerna/create/-/create-9.0.4.tgz", + "integrity": "sha512-WxedGD98G8/a6HztCXNWquaM0x17oSvfvuqDsLxNNX1qXGyrzmMUmd1mQikF/47uy80X6qyWdaRtaAHlwkvEUA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@npmcli/arborist": "9.1.6", + "@npmcli/package-json": "7.0.2", + "@npmcli/run-script": "10.0.3", + "@nx/devkit": ">=21.5.2 < 23.0.0", + "@octokit/plugin-enterprise-rest": "6.0.1", + "@octokit/rest": "20.1.2", + "aproba": "2.0.0", + "byte-size": "8.1.1", + "chalk": "4.1.0", + "cmd-shim": "6.0.3", + "color-support": "1.1.3", + "columnify": "1.6.0", + "console-control-strings": "^1.1.0", + "conventional-changelog-core": "5.0.1", + "conventional-recommended-bump": "7.0.1", + "cosmiconfig": "9.0.0", + "dedent": "1.5.3", + "execa": "5.0.0", + "fs-extra": "^11.2.0", + "get-stream": "6.0.0", + "git-url-parse": "14.0.0", + "glob-parent": "6.0.2", + "has-unicode": "2.0.1", + "ini": "^1.3.8", + "init-package-json": "8.2.2", + "inquirer": "12.9.6", + "is-ci": "3.0.1", + "is-stream": "2.0.0", + "js-yaml": "4.1.1", + "libnpmpublish": "11.1.2", + "load-json-file": "6.2.0", + "make-dir": "4.0.0", + "make-fetch-happen": "15.0.2", + "minimatch": "3.0.5", + "multimatch": "5.0.0", + "npm-package-arg": "13.0.1", + "npm-packlist": "10.0.3", + "npm-registry-fetch": "19.1.0", + "nx": ">=21.5.3 < 23.0.0", + "p-map": "4.0.0", + "p-map-series": "2.1.0", + "p-queue": "6.6.2", + "p-reduce": "^2.1.0", + "pacote": "21.0.1", + "pify": "5.0.0", + "read-cmd-shim": "4.0.0", + "resolve-from": "5.0.0", + "rimraf": "^6.1.2", + "semver": "7.7.2", + "set-blocking": "^2.0.0", + "signal-exit": "3.0.7", + "slash": "^3.0.0", + "ssri": "12.0.0", + "string-width": "^4.2.3", + "tar": "7.5.7", + "temp-dir": "1.0.0", + "through": "2.3.8", + "tinyglobby": "0.2.12", + "upath": "2.0.1", + "uuid": "^11.1.0", + "validate-npm-package-license": "3.0.4", + "validate-npm-package-name": "6.0.2", + "wide-align": "1.1.5", + "write-file-atomic": "5.0.1", + "write-pkg": "4.0.0", + "yargs": "17.7.2", + "yargs-parser": "21.1.1" + }, + "engines": { + "node": "^20.19.0 || ^22.12.0 || >=24.0.0" + } + }, + "node_modules/@lerna/create/node_modules/chalk": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.0.tgz", + "integrity": "sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/@lerna/create/node_modules/fs-extra": { + "version": "11.3.3", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.3.3.tgz", + "integrity": "sha512-VWSRii4t0AFm6ixFFmLLx1t7wS1gh+ckoa84aOeapGum0h+EZd1EhEumSB+ZdDLnEPuucsVB9oB7cxJHap6Afg==", + "dev": true, + "license": "MIT", + "dependencies": { + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + }, + "engines": { + "node": ">=14.14" + } + }, + "node_modules/@lerna/create/node_modules/glob": { + "version": "13.0.2", + "resolved": "https://registry.npmjs.org/glob/-/glob-13.0.2.tgz", + "integrity": "sha512-035InabNu/c1lW0tzPhAgapKctblppqsKKG9ZaNzbr+gXwWMjXoiyGSyB9sArzrjG7jY+zntRq5ZSUYemrnWVQ==", + "dev": true, + "license": "BlueOak-1.0.0", + "dependencies": { + "minimatch": "^10.1.2", + "minipass": "^7.1.2", + "path-scurry": "^2.0.0" + }, + "engines": { + "node": "20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/@lerna/create/node_modules/glob/node_modules/minimatch": { + "version": "10.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.1.2.tgz", + "integrity": "sha512-fu656aJ0n2kcXwsnwnv9g24tkU5uSmOlTjd6WyyaKm2Z+h1qmY6bAjrcaIxF/BslFqbZ8UBtbJi7KgQOZD2PTw==", + "dev": true, + "license": "BlueOak-1.0.0", + "dependencies": { + "@isaacs/brace-expansion": "^5.0.1" + }, + "engines": { + "node": "20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/@lerna/create/node_modules/jsonfile": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.2.0.tgz", + "integrity": "sha512-FGuPw30AdOIUTRMC2OMRtQV+jkVj2cfPqSeWXv1NEAJ1qZ5zb1X6z1mFhbfOB/iy3ssJCD+3KuZ8r8C3uVFlAg==", + "dev": true, + "license": "MIT", + "dependencies": { + "universalify": "^2.0.0" + }, + "optionalDependencies": { + "graceful-fs": "^4.1.6" + } + }, + "node_modules/@lerna/create/node_modules/minimatch": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.5.tgz", + "integrity": "sha512-tUpxzX0VAzJHjLu0xUfFv1gwVp9ba3IOuRAVH2EGuRW8a5emA2FlACLqiT/lDVtS1W+TGNwqz3sWaNyLgDJWuw==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/@lerna/create/node_modules/resolve-from": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", + "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/@lerna/create/node_modules/rimraf": { + "version": "6.1.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-6.1.2.tgz", + "integrity": "sha512-cFCkPslJv7BAXJsYlK1dZsbP8/ZNLkCAQ0bi1hf5EKX2QHegmDFEFA6QhuYJlk7UDdc+02JjO80YSOrWPpw06g==", + "dev": true, + "license": "BlueOak-1.0.0", + "dependencies": { + "glob": "^13.0.0", + "package-json-from-dist": "^1.0.1" + }, + "bin": { + "rimraf": "dist/esm/bin.mjs" + }, + "engines": { + "node": "20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/@lerna/create/node_modules/semver": { + "version": "7.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.2.tgz", + "integrity": "sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@lerna/create/node_modules/universalify": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz", + "integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 10.0.0" + } + }, + "node_modules/@lerna/create/node_modules/uuid": { + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-11.1.0.tgz", + "integrity": "sha512-0/A9rDy9P7cJ+8w1c9WD9V//9Wj15Ce2MPz8Ri6032usz+NfePxx5AcN3bN+r6ZL6jEo066/yNYB3tn4pQEx+A==", + "dev": true, + "funding": [ + "https://github.com/sponsors/broofa", + "https://github.com/sponsors/ctavan" + ], + "license": "MIT", + "bin": { + "uuid": "dist/esm/bin/uuid" + } + }, + "node_modules/@lerna/create/node_modules/y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=10" + } + }, + "node_modules/@lerna/create/node_modules/yargs": { + "version": "17.7.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", + "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", + "dev": true, + "license": "MIT", + "dependencies": { + "cliui": "^8.0.1", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.3", + "y18n": "^5.0.5", + "yargs-parser": "^21.1.1" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@lumino/algorithm": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@lumino/algorithm/-/algorithm-2.0.4.tgz", + "integrity": "sha512-gddBhESPqu25KWLeAK9Kz8tS9Ph7P45i0CNG7Ia4XMhK9PHLtTsBdJTC9jP+MqhbzC8zDT/4ekvYRV9ojRPj7Q==", + "license": "BSD-3-Clause" + }, + "node_modules/@lumino/collections": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@lumino/collections/-/collections-2.0.4.tgz", + "integrity": "sha512-D/Py9L5HET6+XUYGxFqDEEth4B65X2c7B/GQVRR8q5Fl7EArVL6e98ZXw8BMkuPcTNa0zlENpCKXzlcoJZxXgQ==", + "license": "BSD-3-Clause", + "dependencies": { + "@lumino/algorithm": "^2.0.4" + } + }, + "node_modules/@lumino/commands": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/@lumino/commands/-/commands-2.3.3.tgz", + "integrity": "sha512-7Ci0QdFzt4NKFMhULr19sJPpOLHJw/oYlq6Pb0/Kq1s05+cIoLimr5wiyjkbAlNoGO/8A8SEBGHy3uctZz6G3A==", + "license": "BSD-3-Clause", + "dependencies": { + "@lumino/algorithm": "^2.0.4", + "@lumino/coreutils": "^2.2.2", + "@lumino/disposable": "^2.1.5", + "@lumino/domutils": "^2.0.4", + "@lumino/keyboard": "^2.0.4", + "@lumino/signaling": "^2.1.5", + "@lumino/virtualdom": "^2.0.4" + } + }, + "node_modules/@lumino/coreutils": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/@lumino/coreutils/-/coreutils-2.2.2.tgz", + "integrity": "sha512-zaKJaK7rawPATn2BGHkbMrR6oK3s9PxNe9KreLwWF2dB4ZBHDiEmNLRyHRorfJ7XqVOEXAsAAj0jFn+qJPC/4Q==", + "license": "BSD-3-Clause", + "dependencies": { + "@lumino/algorithm": "^2.0.4" + } + }, + "node_modules/@lumino/disposable": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@lumino/disposable/-/disposable-2.1.5.tgz", + "integrity": "sha512-hO9AkJK0oEGzxopuxI8LaZqwzSNwXJTGCdr5K4gh6al+zxpN7rOCh6Aq3zDxkIHJU4zybxv8r02ardx9XJsG3A==", + "license": "BSD-3-Clause", + "dependencies": { + "@lumino/signaling": "^2.1.5" + } + }, + "node_modules/@lumino/domutils": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@lumino/domutils/-/domutils-2.0.4.tgz", + "integrity": "sha512-naYGUQn3e0CLtz/tjKOZP8SOBg0SW7EguhkxLpNUXlVUvx7rVsfr0VI22FVL+jgI0FbxXpEkxpSMxtK73jxJAg==", + "license": "BSD-3-Clause" + }, + "node_modules/@lumino/dragdrop": { + "version": "2.1.8", + "resolved": "https://registry.npmjs.org/@lumino/dragdrop/-/dragdrop-2.1.8.tgz", + "integrity": "sha512-5sBYkTka598+XsgjY2tWOC+WYCh9NEgx8RhLvQ3x+V182YhcpEXw38RWGQZyNpQ4m4vtQWKv42A26q+ae6sMwg==", + "license": "BSD-3-Clause", + "dependencies": { + "@lumino/coreutils": "^2.2.2", + "@lumino/disposable": "^2.1.5" + } + }, + "node_modules/@lumino/keyboard": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@lumino/keyboard/-/keyboard-2.0.4.tgz", + "integrity": "sha512-kIVkdSz8F5wtZr8hZp0CMX+E0eMCOnFH6XCT7j2UBQ80ERJHFy0eX+IbNo3dtRQ7+CcDhBV4hQquFNFa+/04QQ==", + "license": "BSD-3-Clause" + }, + "node_modules/@lumino/messaging": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@lumino/messaging/-/messaging-2.0.4.tgz", + "integrity": "sha512-NbZnchAPOciSe9Qn/g6EzG0LRaw7bygFIXbCD440ZhzvugdBeAerwYhrA795jkXPNrrl3olp5AlO0cBB/XZNtg==", + "license": "BSD-3-Clause", + "dependencies": { + "@lumino/algorithm": "^2.0.4", + "@lumino/collections": "^2.0.4" + } + }, + "node_modules/@lumino/properties": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@lumino/properties/-/properties-2.0.4.tgz", + "integrity": "sha512-XsL2qLZk+1FbfuTrkyjciI8PMDw3YcaBkqVQ+iv7OOJf9bUlrmTpCMY0Hu5d3hV2W3TWlRsdbvRRLEBJSKv0iA==", + "license": "BSD-3-Clause" + }, + "node_modules/@lumino/signaling": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@lumino/signaling/-/signaling-2.1.5.tgz", + "integrity": "sha512-Wkx6WR45ynmKBlW0GBEoh4xk9+QluKr1JHuMftqcStBHSQBCnN54UKRRDbySXHGRhhx6p4neu7sGomgQSlQK8w==", + "license": "BSD-3-Clause", + "dependencies": { + "@lumino/algorithm": "^2.0.4", + "@lumino/coreutils": "^2.2.2" + } + }, + "node_modules/@lumino/virtualdom": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@lumino/virtualdom/-/virtualdom-2.0.4.tgz", + "integrity": "sha512-7MFthA9KUsqZTGm/D98FZt1QupjIGyd3XyB4SIugn6DQAqhjBiyykCZydnRq3qmuMHybQel33dNIbHpzyNyQwA==", + "license": "BSD-3-Clause", + "dependencies": { + "@lumino/algorithm": "^2.0.4" + } + }, + "node_modules/@lumino/widgets": { + "version": "2.7.2", + "resolved": "https://registry.npmjs.org/@lumino/widgets/-/widgets-2.7.2.tgz", + "integrity": "sha512-svp4Si10PcTr6Hfd1hZgkue1rKPYpnuCheGWkou/RlMZih94mVbQoDO1xppo/haYQg4GX2IgCFpUKsNb19oBAg==", + "license": "BSD-3-Clause", + "dependencies": { + "@lumino/algorithm": "^2.0.4", + "@lumino/commands": "^2.3.3", + "@lumino/coreutils": "^2.2.2", + "@lumino/disposable": "^2.1.5", + "@lumino/domutils": "^2.0.4", + "@lumino/dragdrop": "^2.1.7", + "@lumino/keyboard": "^2.0.4", + "@lumino/messaging": "^2.0.4", + "@lumino/properties": "^2.0.4", + "@lumino/signaling": "^2.1.5", + "@lumino/virtualdom": "^2.0.4" + } + }, + "node_modules/@malept/cross-spawn-promise": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@malept/cross-spawn-promise/-/cross-spawn-promise-2.0.0.tgz", + "integrity": "sha512-1DpKU0Z5ThltBwjNySMC14g0CkbyhCaz9FkhxqNsZI6uAPJXFS8cMXlBKo26FJ8ZuW6S9GCMcR9IO5k2X5/9Fg==", + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/malept" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/subscription/pkg/npm-.malept-cross-spawn-promise?utm_medium=referral&utm_source=npm_fund" + } + ], + "license": "Apache-2.0", + "dependencies": { + "cross-spawn": "^7.0.1" + }, + "engines": { + "node": ">= 12.13.0" + } + }, + "node_modules/@malept/flatpak-bundler": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/@malept/flatpak-bundler/-/flatpak-bundler-0.4.0.tgz", + "integrity": "sha512-9QOtNffcOF/c1seMCDnjckb3R9WHcG34tky+FHpNKKCW0wc/scYLwMtO+ptyGUfMW0/b/n4qRiALlaFHc9Oj7Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "debug": "^4.1.1", + "fs-extra": "^9.0.0", + "lodash": "^4.17.15", + "tmp-promise": "^3.0.2" + }, + "engines": { + "node": ">= 10.0.0" + } + }, + "node_modules/@malept/flatpak-bundler/node_modules/fs-extra": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.1.0.tgz", + "integrity": "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "at-least-node": "^1.0.0", + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@malept/flatpak-bundler/node_modules/jsonfile": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.2.0.tgz", + "integrity": "sha512-FGuPw30AdOIUTRMC2OMRtQV+jkVj2cfPqSeWXv1NEAJ1qZ5zb1X6z1mFhbfOB/iy3ssJCD+3KuZ8r8C3uVFlAg==", + "dev": true, + "license": "MIT", + "dependencies": { + "universalify": "^2.0.0" + }, + "optionalDependencies": { + "graceful-fs": "^4.1.6" + } + }, + "node_modules/@malept/flatpak-bundler/node_modules/universalify": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz", + "integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 10.0.0" + } + }, + "node_modules/@modelcontextprotocol/sdk": { + "version": "1.26.0", + "resolved": "https://registry.npmjs.org/@modelcontextprotocol/sdk/-/sdk-1.26.0.tgz", + "integrity": "sha512-Y5RmPncpiDtTXDbLKswIJzTqu2hyBKxTNsgKqKclDbhIgg1wgtf1fRuvxgTnRfcnxtvvgbIEcqUOzZrJ6iSReg==", + "license": "MIT", + "dependencies": { + "@hono/node-server": "^1.19.9", + "ajv": "^8.17.1", + "ajv-formats": "^3.0.1", + "content-type": "^1.0.5", + "cors": "^2.8.5", + "cross-spawn": "^7.0.5", + "eventsource": "^3.0.2", + "eventsource-parser": "^3.0.0", + "express": "^5.2.1", + "express-rate-limit": "^8.2.1", + "hono": "^4.11.4", + "jose": "^6.1.3", + "json-schema-typed": "^8.0.2", + "pkce-challenge": "^5.0.0", + "raw-body": "^3.0.0", + "zod": "^3.25 || ^4.0", + "zod-to-json-schema": "^3.25.1" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "@cfworker/json-schema": "^4.1.1", + "zod": "^3.25 || ^4.0" + }, + "peerDependenciesMeta": { + "@cfworker/json-schema": { + "optional": true + }, + "zod": { + "optional": false + } + } + }, + "node_modules/@modelcontextprotocol/sdk/node_modules/accepts": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-2.0.0.tgz", + "integrity": "sha512-5cvg6CtKwfgdmVqY1WIiXKc3Q1bkRqGLi+2W/6ao+6Y7gu/RCwRuAhGEzh5B4KlszSuTLgZYuqFqo5bImjNKng==", + "license": "MIT", + "dependencies": { + "mime-types": "^3.0.0", + "negotiator": "^1.0.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/@modelcontextprotocol/sdk/node_modules/ajv": { + "version": "8.17.1", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.17.1.tgz", + "integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==", + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^3.1.3", + "fast-uri": "^3.0.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/@modelcontextprotocol/sdk/node_modules/body-parser": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-2.2.2.tgz", + "integrity": "sha512-oP5VkATKlNwcgvxi0vM0p/D3n2C3EReYVX+DNYs5TjZFn/oQt2j+4sVJtSMr18pdRr8wjTcBl6LoV+FUwzPmNA==", + "license": "MIT", + "dependencies": { + "bytes": "^3.1.2", + "content-type": "^1.0.5", + "debug": "^4.4.3", + "http-errors": "^2.0.0", + "iconv-lite": "^0.7.0", + "on-finished": "^2.4.1", + "qs": "^6.14.1", + "raw-body": "^3.0.1", + "type-is": "^2.0.1" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/@modelcontextprotocol/sdk/node_modules/content-disposition": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-1.0.1.tgz", + "integrity": "sha512-oIXISMynqSqm241k6kcQ5UwttDILMK4BiurCfGEREw6+X9jkkpEe5T9FZaApyLGGOnFuyMWZpdolTXMtvEJ08Q==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/@modelcontextprotocol/sdk/node_modules/cookie": { + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.2.tgz", + "integrity": "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/@modelcontextprotocol/sdk/node_modules/cookie-signature": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.2.2.tgz", + "integrity": "sha512-D76uU73ulSXrD1UXF4KE2TMxVVwhsnCgfAyTg9k8P6KGZjlXKrOLe4dJQKI3Bxi5wjesZoFXJWElNWBjPZMbhg==", + "license": "MIT", + "engines": { + "node": ">=6.6.0" + } + }, + "node_modules/@modelcontextprotocol/sdk/node_modules/express": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/express/-/express-5.2.1.tgz", + "integrity": "sha512-hIS4idWWai69NezIdRt2xFVofaF4j+6INOpJlVOLDO8zXGpUVEVzIYk12UUi2JzjEzWL3IOAxcTubgz9Po0yXw==", + "license": "MIT", + "dependencies": { + "accepts": "^2.0.0", + "body-parser": "^2.2.1", + "content-disposition": "^1.0.0", + "content-type": "^1.0.5", + "cookie": "^0.7.1", + "cookie-signature": "^1.2.1", + "debug": "^4.4.0", + "depd": "^2.0.0", + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "etag": "^1.8.1", + "finalhandler": "^2.1.0", + "fresh": "^2.0.0", + "http-errors": "^2.0.0", + "merge-descriptors": "^2.0.0", + "mime-types": "^3.0.0", + "on-finished": "^2.4.1", + "once": "^1.4.0", + "parseurl": "^1.3.3", + "proxy-addr": "^2.0.7", + "qs": "^6.14.0", + "range-parser": "^1.2.1", + "router": "^2.2.0", + "send": "^1.1.0", + "serve-static": "^2.2.0", + "statuses": "^2.0.1", + "type-is": "^2.0.1", + "vary": "^1.1.2" + }, + "engines": { + "node": ">= 18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/@modelcontextprotocol/sdk/node_modules/finalhandler": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-2.1.1.tgz", + "integrity": "sha512-S8KoZgRZN+a5rNwqTxlZZePjT/4cnm0ROV70LedRHZ0p8u9fRID0hJUZQpkKLzro8LfmC8sx23bY6tVNxv8pQA==", + "license": "MIT", + "dependencies": { + "debug": "^4.4.0", + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "on-finished": "^2.4.1", + "parseurl": "^1.3.3", + "statuses": "^2.0.1" + }, + "engines": { + "node": ">= 18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/@modelcontextprotocol/sdk/node_modules/fresh": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/fresh/-/fresh-2.0.0.tgz", + "integrity": "sha512-Rx/WycZ60HOaqLKAi6cHRKKI7zxWbJ31MhntmtwMoaTeF7XFH9hhBp8vITaMidfljRQ6eYWCKkaTK+ykVJHP2A==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/@modelcontextprotocol/sdk/node_modules/iconv-lite": { + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.7.2.tgz", + "integrity": "sha512-im9DjEDQ55s9fL4EYzOAv0yMqmMBSZp6G0VvFyTMPKWxiSBHUj9NW/qqLmXUwXrrM7AvqSlTCfvqRb0cM8yYqw==", + "license": "MIT", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3.0.0" + }, + "engines": { + "node": ">=0.10.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/@modelcontextprotocol/sdk/node_modules/json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "license": "MIT" + }, + "node_modules/@modelcontextprotocol/sdk/node_modules/media-typer": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-1.1.0.tgz", + "integrity": "sha512-aisnrDP4GNe06UcKFnV5bfMNPBUw4jsLGaWwWfnH3v02GnBuXX2MCVn5RbrWo0j3pczUilYblq7fQ7Nw2t5XKw==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/@modelcontextprotocol/sdk/node_modules/merge-descriptors": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-2.0.0.tgz", + "integrity": "sha512-Snk314V5ayFLhp3fkUREub6WtjBfPdCPY1Ln8/8munuLuiYhsABgBVWsozAG+MWMbVEvcdcpbi9R7ww22l9Q3g==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@modelcontextprotocol/sdk/node_modules/mime-db": { + "version": "1.54.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.54.0.tgz", + "integrity": "sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/@modelcontextprotocol/sdk/node_modules/mime-types": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-3.0.2.tgz", + "integrity": "sha512-Lbgzdk0h4juoQ9fCKXW4by0UJqj+nOOrI9MJ1sSj4nI8aI2eo1qmvQEie4VD1glsS250n15LsWsYtCugiStS5A==", + "license": "MIT", + "dependencies": { + "mime-db": "^1.54.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/@modelcontextprotocol/sdk/node_modules/negotiator": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-1.0.0.tgz", + "integrity": "sha512-8Ofs/AUQh8MaEcrlq5xOX0CQ9ypTF5dl78mjlMNfOK08fzpgTHQRQPBxcPlEtIw0yRpws+Zo/3r+5WRby7u3Gg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/@modelcontextprotocol/sdk/node_modules/raw-body": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-3.0.2.tgz", + "integrity": "sha512-K5zQjDllxWkf7Z5xJdV0/B0WTNqx6vxG70zJE4N0kBs4LovmEYWJzQGxC9bS9RAKu3bgM40lrd5zoLJ12MQ5BA==", + "license": "MIT", + "dependencies": { + "bytes": "~3.1.2", + "http-errors": "~2.0.1", + "iconv-lite": "~0.7.0", + "unpipe": "~1.0.0" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/@modelcontextprotocol/sdk/node_modules/send": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/send/-/send-1.2.1.tgz", + "integrity": "sha512-1gnZf7DFcoIcajTjTwjwuDjzuz4PPcY2StKPlsGAQ1+YH20IRVrBaXSWmdjowTJ6u8Rc01PoYOGHXfP1mYcZNQ==", + "license": "MIT", + "dependencies": { + "debug": "^4.4.3", + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "etag": "^1.8.1", + "fresh": "^2.0.0", + "http-errors": "^2.0.1", + "mime-types": "^3.0.2", + "ms": "^2.1.3", + "on-finished": "^2.4.1", + "range-parser": "^1.2.1", + "statuses": "^2.0.2" + }, + "engines": { + "node": ">= 18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/@modelcontextprotocol/sdk/node_modules/serve-static": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-2.2.1.tgz", + "integrity": "sha512-xRXBn0pPqQTVQiC8wyQrKs2MOlX24zQ0POGaj0kultvoOCstBQM5yvOhAVSUwOMjQtTvsPWoNCHfPGwaaQJhTw==", + "license": "MIT", + "dependencies": { + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "parseurl": "^1.3.3", + "send": "^1.2.0" + }, + "engines": { + "node": ">= 18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/@modelcontextprotocol/sdk/node_modules/type-is": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-2.0.1.tgz", + "integrity": "sha512-OZs6gsjF4vMp32qrCbiVSkrFmXtG/AZhY3t0iAMrMBiAZyV9oALtXO8hsrHbMXF9x6L3grlFuwW2oAz7cav+Gw==", + "license": "MIT", + "dependencies": { + "content-type": "^1.0.5", + "media-typer": "^1.1.0", + "mime-types": "^3.0.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/@modelcontextprotocol/sdk/node_modules/zod": { + "version": "4.3.6", + "resolved": "https://registry.npmjs.org/zod/-/zod-4.3.6.tgz", + "integrity": "sha512-rftlrkhHZOcjDwkGlnUtZZkvaPHCsDATp4pGpuOOMDaTdDDXF91wuVDJoWoPsKX/3YPQ5fHuF3STjcYyKr+Qhg==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/colinhacks" + } + }, + "node_modules/@msgpackr-extract/msgpackr-extract-darwin-arm64": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@msgpackr-extract/msgpackr-extract-darwin-arm64/-/msgpackr-extract-darwin-arm64-3.0.3.tgz", + "integrity": "sha512-QZHtlVgbAdy2zAqNA9Gu1UpIuI8Xvsd1v8ic6B2pZmeFnFcMWiPLfWXh7TVw4eGEZ/C9TH281KwhVoeQUKbyjw==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@msgpackr-extract/msgpackr-extract-darwin-x64": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@msgpackr-extract/msgpackr-extract-darwin-x64/-/msgpackr-extract-darwin-x64-3.0.3.tgz", + "integrity": "sha512-mdzd3AVzYKuUmiWOQ8GNhl64/IoFGol569zNRdkLReh6LRLHOXxU4U8eq0JwaD8iFHdVGqSy4IjFL4reoWCDFw==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@msgpackr-extract/msgpackr-extract-linux-arm": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@msgpackr-extract/msgpackr-extract-linux-arm/-/msgpackr-extract-linux-arm-3.0.3.tgz", + "integrity": "sha512-fg0uy/dG/nZEXfYilKoRe7yALaNmHoYeIoJuJ7KJ+YyU2bvY8vPv27f7UKhGRpY6euFYqEVhxCFZgAUNQBM3nw==", + "cpu": [ + "arm" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@msgpackr-extract/msgpackr-extract-linux-arm64": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@msgpackr-extract/msgpackr-extract-linux-arm64/-/msgpackr-extract-linux-arm64-3.0.3.tgz", + "integrity": "sha512-YxQL+ax0XqBJDZiKimS2XQaf+2wDGVa1enVRGzEvLLVFeqa5kx2bWbtcSXgsxjQB7nRqqIGFIcLteF/sHeVtQg==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@msgpackr-extract/msgpackr-extract-linux-x64": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@msgpackr-extract/msgpackr-extract-linux-x64/-/msgpackr-extract-linux-x64-3.0.3.tgz", + "integrity": "sha512-cvwNfbP07pKUfq1uH+S6KJ7dT9K8WOE4ZiAcsrSes+UY55E/0jLYc+vq+DO7jlmqRb5zAggExKm0H7O/CBaesg==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@msgpackr-extract/msgpackr-extract-win32-x64": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@msgpackr-extract/msgpackr-extract-win32-x64/-/msgpackr-extract-win32-x64-3.0.3.tgz", + "integrity": "sha512-x0fWaQtYp4E6sktbsdAqnehxDgEc/VwM7uLsRCYWaiGu0ykYdZPiS8zCWdnjHwyiumousxfBm4SO31eXqwEZhQ==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@napi-rs/wasm-runtime": { + "version": "0.2.4", + "resolved": "https://registry.npmjs.org/@napi-rs/wasm-runtime/-/wasm-runtime-0.2.4.tgz", + "integrity": "sha512-9zESzOO5aDByvhIAsOy9TbpZ0Ur2AJbUI7UT73kcUTS2mxAMHOBaa1st/jAymNoCtvrit99kkzT1FZuXVcgfIQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@emnapi/core": "^1.1.0", + "@emnapi/runtime": "^1.1.0", + "@tybys/wasm-util": "^0.9.0" + } + }, + "node_modules/@nodelib/fs.scandir": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", + "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "license": "MIT", + "dependencies": { + "@nodelib/fs.stat": "2.0.5", + "run-parallel": "^1.1.9" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.stat": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", + "license": "MIT", + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.walk": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", + "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "license": "MIT", + "dependencies": { + "@nodelib/fs.scandir": "2.1.5", + "fastq": "^1.6.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@npmcli/agent": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@npmcli/agent/-/agent-4.0.0.tgz", + "integrity": "sha512-kAQTcEN9E8ERLVg5AsGwLNoFb+oEG6engbqAU2P43gD4JEIkNGMHdVQ096FsOAAYpZPB0RSt0zgInKIAS1l5QA==", + "dev": true, + "license": "ISC", + "dependencies": { + "agent-base": "^7.1.0", + "http-proxy-agent": "^7.0.0", + "https-proxy-agent": "^7.0.1", + "lru-cache": "^11.2.1", + "socks-proxy-agent": "^8.0.3" + }, + "engines": { + "node": "^20.17.0 || >=22.9.0" + } + }, + "node_modules/@npmcli/agent/node_modules/agent-base": { + "version": "7.1.4", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.4.tgz", + "integrity": "sha512-MnA+YT8fwfJPgBx3m60MNqakm30XOkyIoH1y6huTQvC0PwZG7ki8NacLBcrPbNoo8vEZy7Jpuk7+jMO+CUovTQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 14" + } + }, + "node_modules/@npmcli/agent/node_modules/http-proxy-agent": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-5.0.0.tgz", + "integrity": "sha512-n2hY8YdoRE1i7r6M0w9DIw5GgZN0G25P8zLCRQ8rjXtTU3vsNFBI/vWK/UIeE6g5MUUz6avwAPXmL6Fy9D/90w==", + "dev": true, + "license": "MIT", + "dependencies": { + "@tootallnate/once": "2", + "agent-base": "6", + "debug": "4" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/@npmcli/agent/node_modules/http-proxy-agent/node_modules/agent-base": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", + "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "debug": "4" + }, + "engines": { + "node": ">= 6.0.0" + } + }, + "node_modules/@npmcli/agent/node_modules/https-proxy-agent": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz", + "integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==", + "dev": true, + "license": "MIT", + "dependencies": { + "agent-base": "6", + "debug": "4" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/@npmcli/agent/node_modules/https-proxy-agent/node_modules/agent-base": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", + "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "debug": "4" + }, + "engines": { + "node": ">= 6.0.0" + } + }, + "node_modules/@npmcli/agent/node_modules/lru-cache": { + "version": "11.2.6", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.2.6.tgz", + "integrity": "sha512-ESL2CrkS/2wTPfuend7Zhkzo2u0daGJ/A2VucJOgQ/C48S/zB8MMeMHSGKYpXhIjbPxfuezITkaBH1wqv00DDQ==", + "dev": true, + "license": "BlueOak-1.0.0", + "engines": { + "node": "20 || >=22" + } + }, + "node_modules/@npmcli/arborist": { + "version": "9.1.6", + "resolved": "https://registry.npmjs.org/@npmcli/arborist/-/arborist-9.1.6.tgz", + "integrity": "sha512-c5Pr3EG8UP5ollkJy2x+UdEQC5sEHe3H9whYn6hb2HJimAKS4zmoJkx5acCiR/g4P38RnCSMlsYQyyHnKYeLvQ==", + "dev": true, + "license": "ISC", + "dependencies": { + "@isaacs/string-locale-compare": "^1.1.0", + "@npmcli/fs": "^4.0.0", + "@npmcli/installed-package-contents": "^3.0.0", + "@npmcli/map-workspaces": "^5.0.0", + "@npmcli/metavuln-calculator": "^9.0.2", + "@npmcli/name-from-folder": "^3.0.0", + "@npmcli/node-gyp": "^4.0.0", + "@npmcli/package-json": "^7.0.0", + "@npmcli/query": "^4.0.0", + "@npmcli/redact": "^3.0.0", + "@npmcli/run-script": "^10.0.0", + "bin-links": "^5.0.0", + "cacache": "^20.0.1", + "common-ancestor-path": "^1.0.1", + "hosted-git-info": "^9.0.0", + "json-stringify-nice": "^1.1.4", + "lru-cache": "^11.2.1", + "minimatch": "^10.0.3", + "nopt": "^8.0.0", + "npm-install-checks": "^7.1.0", + "npm-package-arg": "^13.0.0", + "npm-pick-manifest": "^11.0.1", + "npm-registry-fetch": "^19.0.0", + "pacote": "^21.0.2", + "parse-conflict-json": "^4.0.0", + "proc-log": "^5.0.0", + "proggy": "^3.0.0", + "promise-all-reject-late": "^1.0.0", + "promise-call-limit": "^3.0.1", + "semver": "^7.3.7", + "ssri": "^12.0.0", + "treeverse": "^3.0.0", + "walk-up-path": "^4.0.0" + }, + "bin": { + "arborist": "bin/index.js" + }, + "engines": { + "node": "^20.17.0 || >=22.9.0" + } + }, + "node_modules/@npmcli/arborist/node_modules/hosted-git-info": { + "version": "9.0.2", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-9.0.2.tgz", + "integrity": "sha512-M422h7o/BR3rmCQ8UHi7cyyMqKltdP9Uo+J2fXK+RSAY+wTcKOIRyhTuKv4qn+DJf3g+PL890AzId5KZpX+CBg==", + "dev": true, + "license": "ISC", + "dependencies": { + "lru-cache": "^11.1.0" + }, + "engines": { + "node": "^20.17.0 || >=22.9.0" + } + }, + "node_modules/@npmcli/arborist/node_modules/lru-cache": { + "version": "11.2.6", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.2.6.tgz", + "integrity": "sha512-ESL2CrkS/2wTPfuend7Zhkzo2u0daGJ/A2VucJOgQ/C48S/zB8MMeMHSGKYpXhIjbPxfuezITkaBH1wqv00DDQ==", + "dev": true, + "license": "BlueOak-1.0.0", + "engines": { + "node": "20 || >=22" + } + }, + "node_modules/@npmcli/arborist/node_modules/npm-bundled": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/npm-bundled/-/npm-bundled-5.0.0.tgz", + "integrity": "sha512-JLSpbzh6UUXIEoqPsYBvVNVmyrjVZ1fzEFbqxKkTJQkWBO3xFzFT+KDnSKQWwOQNbuWRwt5LSD6HOTLGIWzfrw==", + "dev": true, + "license": "ISC", + "dependencies": { + "npm-normalize-package-bin": "^5.0.0" + }, + "engines": { + "node": "^20.17.0 || >=22.9.0" + } + }, + "node_modules/@npmcli/arborist/node_modules/npm-normalize-package-bin": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/npm-normalize-package-bin/-/npm-normalize-package-bin-5.0.0.tgz", + "integrity": "sha512-CJi3OS4JLsNMmr2u07OJlhcrPxCeOeP/4xq67aWNai6TNWWbTrlNDgl8NcFKVlcBKp18GPj+EzbNIgrBfZhsag==", + "dev": true, + "license": "ISC", + "engines": { + "node": "^20.17.0 || >=22.9.0" + } + }, + "node_modules/@npmcli/arborist/node_modules/pacote": { + "version": "21.3.1", + "resolved": "https://registry.npmjs.org/pacote/-/pacote-21.3.1.tgz", + "integrity": "sha512-O0EDXi85LF4AzdjG74GUwEArhdvawi/YOHcsW6IijKNj7wm8IvEWNF5GnfuxNpQ/ZpO3L37+v8hqdVh8GgWYhg==", + "dev": true, + "license": "ISC", + "dependencies": { + "@npmcli/git": "^7.0.0", + "@npmcli/installed-package-contents": "^4.0.0", + "@npmcli/package-json": "^7.0.0", + "@npmcli/promise-spawn": "^9.0.0", + "@npmcli/run-script": "^10.0.0", + "cacache": "^20.0.0", + "fs-minipass": "^3.0.0", + "minipass": "^7.0.2", + "npm-package-arg": "^13.0.0", + "npm-packlist": "^10.0.1", + "npm-pick-manifest": "^11.0.1", + "npm-registry-fetch": "^19.0.0", + "proc-log": "^6.0.0", + "promise-retry": "^2.0.1", + "sigstore": "^4.0.0", + "ssri": "^13.0.0", + "tar": "^7.4.3" + }, + "bin": { + "pacote": "bin/index.js" + }, + "engines": { + "node": "^20.17.0 || >=22.9.0" + } + }, + "node_modules/@npmcli/arborist/node_modules/pacote/node_modules/@npmcli/installed-package-contents": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@npmcli/installed-package-contents/-/installed-package-contents-4.0.0.tgz", + "integrity": "sha512-yNyAdkBxB72gtZ4GrwXCM0ZUedo9nIbOMKfGjt6Cu6DXf0p8y1PViZAKDC8q8kv/fufx0WTjRBdSlyrvnP7hmA==", + "dev": true, + "license": "ISC", + "dependencies": { + "npm-bundled": "^5.0.0", + "npm-normalize-package-bin": "^5.0.0" + }, + "bin": { + "installed-package-contents": "bin/index.js" + }, + "engines": { + "node": "^20.17.0 || >=22.9.0" + } + }, + "node_modules/@npmcli/arborist/node_modules/pacote/node_modules/proc-log": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/proc-log/-/proc-log-6.1.0.tgz", + "integrity": "sha512-iG+GYldRf2BQ0UDUAd6JQ/RwzaQy6mXmsk/IzlYyal4A4SNFw54MeH4/tLkF4I5WoWG9SQwuqWzS99jaFQHBuQ==", + "dev": true, + "license": "ISC", + "engines": { + "node": "^20.17.0 || >=22.9.0" + } + }, + "node_modules/@npmcli/arborist/node_modules/pacote/node_modules/ssri": { + "version": "13.0.1", + "resolved": "https://registry.npmjs.org/ssri/-/ssri-13.0.1.tgz", + "integrity": "sha512-QUiRf1+u9wPTL/76GTYlKttDEBWV1ga9ZXW8BG6kfdeyyM8LGPix9gROyg9V2+P0xNyF3X2Go526xKFdMZrHSQ==", + "dev": true, + "license": "ISC", + "dependencies": { + "minipass": "^7.0.3" + }, + "engines": { + "node": "^20.17.0 || >=22.9.0" + } + }, + "node_modules/@npmcli/fs": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@npmcli/fs/-/fs-4.0.0.tgz", + "integrity": "sha512-/xGlezI6xfGO9NwuJlnwz/K14qD1kCSAGtacBHnGzeAIuJGazcp45KP5NuyARXoKb7cwulAGWVsbeSxdG/cb0Q==", + "dev": true, + "license": "ISC", + "dependencies": { + "semver": "^7.3.5" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/@npmcli/git": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/@npmcli/git/-/git-7.0.1.tgz", + "integrity": "sha512-+XTFxK2jJF/EJJ5SoAzXk3qwIDfvFc5/g+bD274LZ7uY7LE8sTfG6Z8rOanPl2ZEvZWqNvmEdtXC25cE54VcoA==", + "dev": true, + "license": "ISC", + "dependencies": { + "@npmcli/promise-spawn": "^9.0.0", + "ini": "^6.0.0", + "lru-cache": "^11.2.1", + "npm-pick-manifest": "^11.0.1", + "proc-log": "^6.0.0", + "promise-retry": "^2.0.1", + "semver": "^7.3.5", + "which": "^6.0.0" + }, + "engines": { + "node": "^20.17.0 || >=22.9.0" + } + }, + "node_modules/@npmcli/git/node_modules/ini": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/ini/-/ini-6.0.0.tgz", + "integrity": "sha512-IBTdIkzZNOpqm7q3dRqJvMaldXjDHWkEDfrwGEQTs5eaQMWV+djAhR+wahyNNMAa+qpbDUhBMVt4ZKNwpPm7xQ==", + "dev": true, + "license": "ISC", + "engines": { + "node": "^20.17.0 || >=22.9.0" + } + }, + "node_modules/@npmcli/git/node_modules/isexe": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-4.0.0.tgz", + "integrity": "sha512-FFUtZMpoZ8RqHS3XeXEmHWLA4thH+ZxCv2lOiPIn1Xc7CxrqhWzNSDzD+/chS/zbYezmiwWLdQC09JdQKmthOw==", + "dev": true, + "license": "BlueOak-1.0.0", + "engines": { + "node": ">=20" + } + }, + "node_modules/@npmcli/git/node_modules/lru-cache": { + "version": "11.2.6", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.2.6.tgz", + "integrity": "sha512-ESL2CrkS/2wTPfuend7Zhkzo2u0daGJ/A2VucJOgQ/C48S/zB8MMeMHSGKYpXhIjbPxfuezITkaBH1wqv00DDQ==", + "dev": true, + "license": "BlueOak-1.0.0", + "engines": { + "node": "20 || >=22" + } + }, + "node_modules/@npmcli/git/node_modules/proc-log": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/proc-log/-/proc-log-6.1.0.tgz", + "integrity": "sha512-iG+GYldRf2BQ0UDUAd6JQ/RwzaQy6mXmsk/IzlYyal4A4SNFw54MeH4/tLkF4I5WoWG9SQwuqWzS99jaFQHBuQ==", + "dev": true, + "license": "ISC", + "engines": { + "node": "^20.17.0 || >=22.9.0" + } + }, + "node_modules/@npmcli/git/node_modules/which": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/which/-/which-6.0.1.tgz", + "integrity": "sha512-oGLe46MIrCRqX7ytPUf66EAYvdeMIZYn3WaocqqKZAxrBpkqHfL/qvTyJ/bTk5+AqHCjXmrv3CEWgy368zhRUg==", + "dev": true, + "license": "ISC", + "dependencies": { + "isexe": "^4.0.0" + }, + "bin": { + "node-which": "bin/which.js" + }, + "engines": { + "node": "^20.17.0 || >=22.9.0" + } + }, + "node_modules/@npmcli/installed-package-contents": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@npmcli/installed-package-contents/-/installed-package-contents-3.0.0.tgz", + "integrity": "sha512-fkxoPuFGvxyrH+OQzyTkX2LUEamrF4jZSmxjAtPPHHGO0dqsQ8tTKjnIS8SAnPHdk2I03BDtSMR5K/4loKg79Q==", + "dev": true, + "license": "ISC", + "dependencies": { + "npm-bundled": "^4.0.0", + "npm-normalize-package-bin": "^4.0.0" + }, + "bin": { + "installed-package-contents": "bin/index.js" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/@npmcli/map-workspaces": { + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/@npmcli/map-workspaces/-/map-workspaces-5.0.3.tgz", + "integrity": "sha512-o2grssXo1e774E5OtEwwrgoszYRh0lqkJH+Pb9r78UcqdGJRDRfhpM8DvZPjzNLLNYeD/rNbjOKM3Ss5UABROw==", + "dev": true, + "license": "ISC", + "dependencies": { + "@npmcli/name-from-folder": "^4.0.0", + "@npmcli/package-json": "^7.0.0", + "glob": "^13.0.0", + "minimatch": "^10.0.3" + }, + "engines": { + "node": "^20.17.0 || >=22.9.0" + } + }, + "node_modules/@npmcli/map-workspaces/node_modules/@npmcli/name-from-folder": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@npmcli/name-from-folder/-/name-from-folder-4.0.0.tgz", + "integrity": "sha512-qfrhVlOSqmKM8i6rkNdZzABj8MKEITGFAY+4teqBziksCQAOLutiAxM1wY2BKEd8KjUSpWmWCYxvXr0y4VTlPg==", + "dev": true, + "license": "ISC", + "engines": { + "node": "^20.17.0 || >=22.9.0" + } + }, + "node_modules/@npmcli/map-workspaces/node_modules/glob": { + "version": "13.0.2", + "resolved": "https://registry.npmjs.org/glob/-/glob-13.0.2.tgz", + "integrity": "sha512-035InabNu/c1lW0tzPhAgapKctblppqsKKG9ZaNzbr+gXwWMjXoiyGSyB9sArzrjG7jY+zntRq5ZSUYemrnWVQ==", + "dev": true, + "license": "BlueOak-1.0.0", + "dependencies": { + "minimatch": "^10.1.2", + "minipass": "^7.1.2", + "path-scurry": "^2.0.0" + }, + "engines": { + "node": "20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/@npmcli/metavuln-calculator": { + "version": "9.0.3", + "resolved": "https://registry.npmjs.org/@npmcli/metavuln-calculator/-/metavuln-calculator-9.0.3.tgz", + "integrity": "sha512-94GLSYhLXF2t2LAC7pDwLaM4uCARzxShyAQKsirmlNcpidH89VA4/+K1LbJmRMgz5gy65E/QBBWQdUvGLe2Frg==", + "dev": true, + "license": "ISC", + "dependencies": { + "cacache": "^20.0.0", + "json-parse-even-better-errors": "^5.0.0", + "pacote": "^21.0.0", + "proc-log": "^6.0.0", + "semver": "^7.3.5" + }, + "engines": { + "node": "^20.17.0 || >=22.9.0" + } + }, + "node_modules/@npmcli/metavuln-calculator/node_modules/proc-log": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/proc-log/-/proc-log-6.1.0.tgz", + "integrity": "sha512-iG+GYldRf2BQ0UDUAd6JQ/RwzaQy6mXmsk/IzlYyal4A4SNFw54MeH4/tLkF4I5WoWG9SQwuqWzS99jaFQHBuQ==", + "dev": true, + "license": "ISC", + "engines": { + "node": "^20.17.0 || >=22.9.0" + } + }, + "node_modules/@npmcli/move-file": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@npmcli/move-file/-/move-file-2.0.1.tgz", + "integrity": "sha512-mJd2Z5TjYWq/ttPLLGqArdtnC74J6bOzg4rMDnN+p1xTacZ2yPRCk2y0oSWQtygLR9YVQXgOcONrwtnk3JupxQ==", + "deprecated": "This functionality has been moved to @npmcli/fs", + "license": "MIT", + "dependencies": { + "mkdirp": "^1.0.4", + "rimraf": "^3.0.2" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + } + }, + "node_modules/@npmcli/move-file/node_modules/mkdirp": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", + "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", + "license": "MIT", + "bin": { + "mkdirp": "bin/cmd.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@npmcli/move-file/node_modules/rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "deprecated": "Rimraf versions prior to v4 are no longer supported", + "license": "ISC", + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/@npmcli/name-from-folder": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@npmcli/name-from-folder/-/name-from-folder-3.0.0.tgz", + "integrity": "sha512-61cDL8LUc9y80fXn+lir+iVt8IS0xHqEKwPu/5jCjxQTVoSCmkXvw4vbMrzAMtmghz3/AkiBjhHkDKUH+kf7kA==", + "dev": true, + "license": "ISC", + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/@npmcli/node-gyp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@npmcli/node-gyp/-/node-gyp-4.0.0.tgz", + "integrity": "sha512-+t5DZ6mO/QFh78PByMq1fGSAub/agLJZDRfJRMeOSNCt8s9YVlTjmGpIPwPhvXTGUIJk+WszlT0rQa1W33yzNA==", + "dev": true, + "license": "ISC", + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/@npmcli/package-json": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@npmcli/package-json/-/package-json-7.0.2.tgz", + "integrity": "sha512-0ylN3U5htO1SJTmy2YI78PZZjLkKUGg7EKgukb2CRi0kzyoDr0cfjHAzi7kozVhj2V3SxN1oyKqZ2NSo40z00g==", + "dev": true, + "license": "ISC", + "dependencies": { + "@npmcli/git": "^7.0.0", + "glob": "^11.0.3", + "hosted-git-info": "^9.0.0", + "json-parse-even-better-errors": "^5.0.0", + "proc-log": "^6.0.0", + "semver": "^7.5.3", + "validate-npm-package-license": "^3.0.4" + }, + "engines": { + "node": "^20.17.0 || >=22.9.0" + } + }, + "node_modules/@npmcli/package-json/node_modules/glob": { + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-11.1.0.tgz", + "integrity": "sha512-vuNwKSaKiqm7g0THUBu2x7ckSs3XJLXE+2ssL7/MfTGPLLcrJQ/4Uq1CjPTtO5cCIiRxqvN6Twy1qOwhL0Xjcw==", + "deprecated": "Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me", + "dev": true, + "license": "BlueOak-1.0.0", + "dependencies": { + "foreground-child": "^3.3.1", + "jackspeak": "^4.1.1", + "minimatch": "^10.1.1", + "minipass": "^7.1.2", + "package-json-from-dist": "^1.0.0", + "path-scurry": "^2.0.0" + }, + "bin": { + "glob": "dist/esm/bin.mjs" + }, + "engines": { + "node": "20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/@npmcli/package-json/node_modules/hosted-git-info": { + "version": "9.0.2", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-9.0.2.tgz", + "integrity": "sha512-M422h7o/BR3rmCQ8UHi7cyyMqKltdP9Uo+J2fXK+RSAY+wTcKOIRyhTuKv4qn+DJf3g+PL890AzId5KZpX+CBg==", + "dev": true, + "license": "ISC", + "dependencies": { + "lru-cache": "^11.1.0" + }, + "engines": { + "node": "^20.17.0 || >=22.9.0" + } + }, + "node_modules/@npmcli/package-json/node_modules/lru-cache": { + "version": "11.2.6", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.2.6.tgz", + "integrity": "sha512-ESL2CrkS/2wTPfuend7Zhkzo2u0daGJ/A2VucJOgQ/C48S/zB8MMeMHSGKYpXhIjbPxfuezITkaBH1wqv00DDQ==", + "dev": true, + "license": "BlueOak-1.0.0", + "engines": { + "node": "20 || >=22" + } + }, + "node_modules/@npmcli/package-json/node_modules/proc-log": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/proc-log/-/proc-log-6.1.0.tgz", + "integrity": "sha512-iG+GYldRf2BQ0UDUAd6JQ/RwzaQy6mXmsk/IzlYyal4A4SNFw54MeH4/tLkF4I5WoWG9SQwuqWzS99jaFQHBuQ==", + "dev": true, + "license": "ISC", + "engines": { + "node": "^20.17.0 || >=22.9.0" + } + }, + "node_modules/@npmcli/promise-spawn": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/@npmcli/promise-spawn/-/promise-spawn-9.0.1.tgz", + "integrity": "sha512-OLUaoqBuyxeTqUvjA3FZFiXUfYC1alp3Sa99gW3EUDz3tZ3CbXDdcZ7qWKBzicrJleIgucoWamWH1saAmH/l2Q==", + "dev": true, + "license": "ISC", + "dependencies": { + "which": "^6.0.0" + }, + "engines": { + "node": "^20.17.0 || >=22.9.0" + } + }, + "node_modules/@npmcli/promise-spawn/node_modules/isexe": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-4.0.0.tgz", + "integrity": "sha512-FFUtZMpoZ8RqHS3XeXEmHWLA4thH+ZxCv2lOiPIn1Xc7CxrqhWzNSDzD+/chS/zbYezmiwWLdQC09JdQKmthOw==", + "dev": true, + "license": "BlueOak-1.0.0", + "engines": { + "node": ">=20" + } + }, + "node_modules/@npmcli/promise-spawn/node_modules/which": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/which/-/which-6.0.1.tgz", + "integrity": "sha512-oGLe46MIrCRqX7ytPUf66EAYvdeMIZYn3WaocqqKZAxrBpkqHfL/qvTyJ/bTk5+AqHCjXmrv3CEWgy368zhRUg==", + "dev": true, + "license": "ISC", + "dependencies": { + "isexe": "^4.0.0" + }, + "bin": { + "node-which": "bin/which.js" + }, + "engines": { + "node": "^20.17.0 || >=22.9.0" + } + }, + "node_modules/@npmcli/query": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/@npmcli/query/-/query-4.0.1.tgz", + "integrity": "sha512-4OIPFb4weUUwkDXJf4Hh1inAn8neBGq3xsH4ZsAaN6FK3ldrFkH7jSpCc7N9xesi0Sp+EBXJ9eGMDrEww2Ztqw==", + "dev": true, + "license": "ISC", + "dependencies": { + "postcss-selector-parser": "^7.0.0" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/@npmcli/redact": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/@npmcli/redact/-/redact-3.2.2.tgz", + "integrity": "sha512-7VmYAmk4csGv08QzrDKScdzn11jHPFGyqJW39FyPgPuAp3zIaUmuCo1yxw9aGs+NEJuTGQ9Gwqpt93vtJubucg==", + "dev": true, + "license": "ISC", + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/@npmcli/run-script": { + "version": "10.0.3", + "resolved": "https://registry.npmjs.org/@npmcli/run-script/-/run-script-10.0.3.tgz", + "integrity": "sha512-ER2N6itRkzWbbtVmZ9WKaWxVlKlOeBFF1/7xx+KA5J1xKa4JjUwBdb6tDpk0v1qA+d+VDwHI9qmLcXSWcmi+Rw==", + "dev": true, + "license": "ISC", + "dependencies": { + "@npmcli/node-gyp": "^5.0.0", + "@npmcli/package-json": "^7.0.0", + "@npmcli/promise-spawn": "^9.0.0", + "node-gyp": "^12.1.0", + "proc-log": "^6.0.0", + "which": "^6.0.0" + }, + "engines": { + "node": "^20.17.0 || >=22.9.0" + } + }, + "node_modules/@npmcli/run-script/node_modules/@npmcli/node-gyp": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@npmcli/node-gyp/-/node-gyp-5.0.0.tgz", + "integrity": "sha512-uuG5HZFXLfyFKqg8QypsmgLQW7smiRjVc45bqD/ofZZcR/uxEjgQU8qDPv0s9TEeMUiAAU/GC5bR6++UdTirIQ==", + "dev": true, + "license": "ISC", + "engines": { + "node": "^20.17.0 || >=22.9.0" + } + }, + "node_modules/@npmcli/run-script/node_modules/abbrev": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-4.0.0.tgz", + "integrity": "sha512-a1wflyaL0tHtJSmLSOVybYhy22vRih4eduhhrkcjgrWGnRfrZtovJ2FRjxuTtkkj47O/baf0R86QU5OuYpz8fA==", + "dev": true, + "license": "ISC", + "engines": { + "node": "^20.17.0 || >=22.9.0" + } + }, + "node_modules/@npmcli/run-script/node_modules/isexe": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-4.0.0.tgz", + "integrity": "sha512-FFUtZMpoZ8RqHS3XeXEmHWLA4thH+ZxCv2lOiPIn1Xc7CxrqhWzNSDzD+/chS/zbYezmiwWLdQC09JdQKmthOw==", + "dev": true, + "license": "BlueOak-1.0.0", + "engines": { + "node": ">=20" + } + }, + "node_modules/@npmcli/run-script/node_modules/node-gyp": { + "version": "12.2.0", + "resolved": "https://registry.npmjs.org/node-gyp/-/node-gyp-12.2.0.tgz", + "integrity": "sha512-q23WdzrQv48KozXlr0U1v9dwO/k59NHeSzn6loGcasyf0UnSrtzs8kRxM+mfwJSf0DkX0s43hcqgnSO4/VNthQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "env-paths": "^2.2.0", + "exponential-backoff": "^3.1.1", + "graceful-fs": "^4.2.6", + "make-fetch-happen": "^15.0.0", + "nopt": "^9.0.0", + "proc-log": "^6.0.0", + "semver": "^7.3.5", + "tar": "^7.5.4", + "tinyglobby": "^0.2.12", + "which": "^6.0.0" + }, + "bin": { + "node-gyp": "bin/node-gyp.js" + }, + "engines": { + "node": "^20.17.0 || >=22.9.0" + } + }, + "node_modules/@npmcli/run-script/node_modules/nopt": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/nopt/-/nopt-9.0.0.tgz", + "integrity": "sha512-Zhq3a+yFKrYwSBluL4H9XP3m3y5uvQkB/09CwDruCiRmR/UJYnn9W4R48ry0uGC70aeTPKLynBtscP9efFFcPw==", + "dev": true, + "license": "ISC", + "dependencies": { + "abbrev": "^4.0.0" + }, + "bin": { + "nopt": "bin/nopt.js" + }, + "engines": { + "node": "^20.17.0 || >=22.9.0" + } + }, + "node_modules/@npmcli/run-script/node_modules/proc-log": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/proc-log/-/proc-log-6.1.0.tgz", + "integrity": "sha512-iG+GYldRf2BQ0UDUAd6JQ/RwzaQy6mXmsk/IzlYyal4A4SNFw54MeH4/tLkF4I5WoWG9SQwuqWzS99jaFQHBuQ==", + "dev": true, + "license": "ISC", + "engines": { + "node": "^20.17.0 || >=22.9.0" + } + }, + "node_modules/@npmcli/run-script/node_modules/which": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/which/-/which-6.0.1.tgz", + "integrity": "sha512-oGLe46MIrCRqX7ytPUf66EAYvdeMIZYn3WaocqqKZAxrBpkqHfL/qvTyJ/bTk5+AqHCjXmrv3CEWgy368zhRUg==", + "dev": true, + "license": "ISC", + "dependencies": { + "isexe": "^4.0.0" + }, + "bin": { + "node-which": "bin/which.js" + }, + "engines": { + "node": "^20.17.0 || >=22.9.0" + } + }, + "node_modules/@nx/devkit": { + "version": "22.5.0", + "resolved": "https://registry.npmjs.org/@nx/devkit/-/devkit-22.5.0.tgz", + "integrity": "sha512-CLHu+zoZW8szUc0aoSrDc8P8UkWsCCoSJoa3mHsw1rYxyvFv8ufKBMmIN/jUKNx+q/XJmGivymcNI1z3vpql0w==", + "dev": true, + "license": "MIT", + "dependencies": { + "@zkochan/js-yaml": "0.0.7", + "ejs": "^3.1.7", + "enquirer": "~2.3.6", + "minimatch": "10.1.1", + "semver": "^7.6.3", + "tslib": "^2.3.0", + "yargs-parser": "21.1.1" + }, + "peerDependencies": { + "nx": ">= 21 <= 23 || ^22.0.0-0" + } + }, + "node_modules/@nx/devkit/node_modules/minimatch": { + "version": "10.1.1", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.1.1.tgz", + "integrity": "sha512-enIvLvRAFZYXJzkCYG5RKmPfrFArdLv+R+lbQ53BmIMLIry74bjKzX6iHAm8WYamJkhSSEabrWN5D97XnKObjQ==", + "dev": true, + "license": "BlueOak-1.0.0", + "dependencies": { + "@isaacs/brace-expansion": "^5.0.0" + }, + "engines": { + "node": "20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/@nx/nx-darwin-arm64": { + "version": "22.5.0", + "resolved": "https://registry.npmjs.org/@nx/nx-darwin-arm64/-/nx-darwin-arm64-22.5.0.tgz", + "integrity": "sha512-MHnzv6tzucvLsh4oS9FTepj+ct/o8/DPXrQow+9Jid7GSgY59xrDX/8CleJOrwL5lqKEyGW7vv8TR+4wGtEWTA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@nx/nx-darwin-x64": { + "version": "22.5.0", + "resolved": "https://registry.npmjs.org/@nx/nx-darwin-x64/-/nx-darwin-x64-22.5.0.tgz", + "integrity": "sha512-/0w43hbR5Kia0XeCDZHDt/18FHhpwQs+Y+8TO8/ZsF1RgCI0knJDCyJieYk1yEZAq6E8dStAJnuzxK9uvETs4A==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@nx/nx-freebsd-x64": { + "version": "22.5.0", + "resolved": "https://registry.npmjs.org/@nx/nx-freebsd-x64/-/nx-freebsd-x64-22.5.0.tgz", + "integrity": "sha512-d4Pd1VFpD272R7kJTWm/Pj49BIz44GZ+QIVSfxlx3GWxyaPd25X9GBanUngL6qpactS+aLTwcoBmnSbZ4PEcEQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/@nx/nx-linux-arm-gnueabihf": { + "version": "22.5.0", + "resolved": "https://registry.npmjs.org/@nx/nx-linux-arm-gnueabihf/-/nx-linux-arm-gnueabihf-22.5.0.tgz", + "integrity": "sha512-cCyG23PikIlqE7I6s9j0aHJSqIxnpdOjFOXyRd224XmFyAB8tOyKl7vDD/WugcpAceos28i+Rgz4na189zm48A==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@nx/nx-linux-arm64-gnu": { + "version": "22.5.0", + "resolved": "https://registry.npmjs.org/@nx/nx-linux-arm64-gnu/-/nx-linux-arm64-gnu-22.5.0.tgz", + "integrity": "sha512-vkQw8737fpta6oVEEqskzwq+d0GeZkGhtyl+U3pAcuUcYTdqbsZaofSQACFnGfngsqpYmlJCWJGU5Te00qcPQw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@nx/nx-linux-arm64-musl": { + "version": "22.5.0", + "resolved": "https://registry.npmjs.org/@nx/nx-linux-arm64-musl/-/nx-linux-arm64-musl-22.5.0.tgz", + "integrity": "sha512-BkEsFBsnKrDK11N914rr5YKyIJwYoSVItJ7VzsQZIqAX0C7PdJeQ7KzqOGwoezbabdLmzFOBNg6s/o1ujoEYxw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@nx/nx-linux-x64-gnu": { + "version": "22.5.0", + "resolved": "https://registry.npmjs.org/@nx/nx-linux-x64-gnu/-/nx-linux-x64-gnu-22.5.0.tgz", + "integrity": "sha512-Dsqoz4hWmqehMMm8oJY6Q0ckEUeeHz4+T/C8nHyDaaj/REKCSmqYf/+QV6f2Z5Up/CsQ/hoAsWYEhCHZ0tcSFg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@nx/nx-linux-x64-musl": { + "version": "22.5.0", + "resolved": "https://registry.npmjs.org/@nx/nx-linux-x64-musl/-/nx-linux-x64-musl-22.5.0.tgz", + "integrity": "sha512-Lcj/61BpsT85Qhm3hNTwQFrqGtsjLC+y4Kk21dh22d1/E5pOdVAwPXBuWrSPNo4lX+ESNoKmwxWjfgW3uoB05g==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@nx/nx-win32-arm64-msvc": { + "version": "22.5.0", + "resolved": "https://registry.npmjs.org/@nx/nx-win32-arm64-msvc/-/nx-win32-arm64-msvc-22.5.0.tgz", + "integrity": "sha512-0DlnBDLvqNtseCyBBoBst0gwux+N91RBc4E41JDDcLcWpfntcwCQM39D6lA5qdma/0L7U0PUM7MYV9Q6igJMkQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@nx/nx-win32-x64-msvc": { + "version": "22.5.0", + "resolved": "https://registry.npmjs.org/@nx/nx-win32-x64-msvc/-/nx-win32-x64-msvc-22.5.0.tgz", + "integrity": "sha512-kMMsU4PxKQ76NvmPFKT0/RlzRTiuUfuNWVJUmsWF1onVcBkXgQNKkmLcSJk3wGwML5/tHChjtlI7Hpo705Uv/g==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@octokit/auth-token": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-4.0.0.tgz", + "integrity": "sha512-tY/msAuJo6ARbK6SPIxZrPBms3xPbfwBrulZe0Wtr/DIY9lje2HeV1uoebShn6mx7SjCHif6EjMvoREj+gZ+SA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 18" + } + }, + "node_modules/@octokit/core": { + "version": "5.2.2", + "resolved": "https://registry.npmjs.org/@octokit/core/-/core-5.2.2.tgz", + "integrity": "sha512-/g2d4sW9nUDJOMz3mabVQvOGhVa4e/BN/Um7yca9Bb2XTzPPnfTWHWQg+IsEYO7M3Vx+EXvaM/I2pJWIMun1bg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/auth-token": "^4.0.0", + "@octokit/graphql": "^7.1.0", + "@octokit/request": "^8.4.1", + "@octokit/request-error": "^5.1.1", + "@octokit/types": "^13.0.0", + "before-after-hook": "^2.2.0", + "universal-user-agent": "^6.0.0" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/@octokit/endpoint": { + "version": "9.0.6", + "resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-9.0.6.tgz", + "integrity": "sha512-H1fNTMA57HbkFESSt3Y9+FBICv+0jFceJFPWDePYlR/iMGrwM5ph+Dd4XRQs+8X+PUFURLQgX9ChPfhJ/1uNQw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/types": "^13.1.0", + "universal-user-agent": "^6.0.0" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/@octokit/graphql": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-7.1.1.tgz", + "integrity": "sha512-3mkDltSfcDUoa176nlGoA32RGjeWjl3K7F/BwHwRMJUW/IteSa4bnSV8p2ThNkcIcZU2umkZWxwETSSCJf2Q7g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/request": "^8.4.1", + "@octokit/types": "^13.0.0", + "universal-user-agent": "^6.0.0" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/@octokit/openapi-types": { + "version": "24.2.0", + "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-24.2.0.tgz", + "integrity": "sha512-9sIH3nSUttelJSXUrmGzl7QUBFul0/mB8HRYl3fOlgHbIWG+WnYDXU3v/2zMtAvuzZ/ed00Ei6on975FhBfzrg==", + "dev": true, + "license": "MIT" + }, + "node_modules/@octokit/plugin-enterprise-rest": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/@octokit/plugin-enterprise-rest/-/plugin-enterprise-rest-6.0.1.tgz", + "integrity": "sha512-93uGjlhUD+iNg1iWhUENAtJata6w5nE+V4urXOAlIXdco6xNZtUSfYY8dzp3Udy74aqO/B5UZL80x/YMa5PKRw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@octokit/plugin-paginate-rest": { + "version": "11.4.4-cjs.2", + "resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-11.4.4-cjs.2.tgz", + "integrity": "sha512-2dK6z8fhs8lla5PaOTgqfCGBxgAv/le+EhPs27KklPhm1bKObpu6lXzwfUEQ16ajXzqNrKMujsFyo9K2eaoISw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/types": "^13.7.0" + }, + "engines": { + "node": ">= 18" + }, + "peerDependencies": { + "@octokit/core": "5" + } + }, + "node_modules/@octokit/plugin-request-log": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/@octokit/plugin-request-log/-/plugin-request-log-4.0.1.tgz", + "integrity": "sha512-GihNqNpGHorUrO7Qa9JbAl0dbLnqJVrV8OXe2Zm5/Y4wFkZQDfTreBzVmiRfJVfE4mClXdihHnbpyyO9FSX4HA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 18" + }, + "peerDependencies": { + "@octokit/core": "5" + } + }, + "node_modules/@octokit/plugin-rest-endpoint-methods": { + "version": "13.3.2-cjs.1", + "resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-13.3.2-cjs.1.tgz", + "integrity": "sha512-VUjIjOOvF2oELQmiFpWA1aOPdawpyaCUqcEBc/UOUnj3Xp6DJGrJ1+bjUIIDzdHjnFNO6q57ODMfdEZnoBkCwQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/types": "^13.8.0" + }, + "engines": { + "node": ">= 18" + }, + "peerDependencies": { + "@octokit/core": "^5" + } + }, + "node_modules/@octokit/request": { + "version": "8.4.1", + "resolved": "https://registry.npmjs.org/@octokit/request/-/request-8.4.1.tgz", + "integrity": "sha512-qnB2+SY3hkCmBxZsR/MPCybNmbJe4KAlfWErXq+rBKkQJlbjdJeS85VI9r8UqeLYLvnAenU8Q1okM/0MBsAGXw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/endpoint": "^9.0.6", + "@octokit/request-error": "^5.1.1", + "@octokit/types": "^13.1.0", + "universal-user-agent": "^6.0.0" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/@octokit/request-error": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-5.1.1.tgz", + "integrity": "sha512-v9iyEQJH6ZntoENr9/yXxjuezh4My67CBSu9r6Ve/05Iu5gNgnisNWOsoJHTP6k0Rr0+HQIpnH+kyammu90q/g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/types": "^13.1.0", + "deprecation": "^2.0.0", + "once": "^1.4.0" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/@octokit/rest": { + "version": "20.1.2", + "resolved": "https://registry.npmjs.org/@octokit/rest/-/rest-20.1.2.tgz", + "integrity": "sha512-GmYiltypkHHtihFwPRxlaorG5R9VAHuk/vbszVoRTGXnAsY60wYLkh/E2XiFmdZmqrisw+9FaazS1i5SbdWYgA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/core": "^5.0.2", + "@octokit/plugin-paginate-rest": "11.4.4-cjs.2", + "@octokit/plugin-request-log": "^4.0.0", + "@octokit/plugin-rest-endpoint-methods": "13.3.2-cjs.1" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/@octokit/types": { + "version": "13.10.0", + "resolved": "https://registry.npmjs.org/@octokit/types/-/types-13.10.0.tgz", + "integrity": "sha512-ifLaO34EbbPj0Xgro4G5lP5asESjwHracYJvVaPIyXMuiuXLlhic3S47cBdTb+jfODkTE5YtGCLt3Ay3+J97sA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/openapi-types": "^24.2.0" + } + }, + "node_modules/@openai/codex-sdk": { + "version": "0.49.0", + "resolved": "https://registry.npmjs.org/@openai/codex-sdk/-/codex-sdk-0.49.0.tgz", + "integrity": "sha512-yQYA4nRkhxk6on6AdazY+szSdQhsrQ2STTQTeTvu7FGAKZbrh82N/irzvT1quog36/VgICbGa5ZvbUzf4sW0DA==", + "license": "Apache-2.0", + "engines": { + "node": ">=18" + } + }, + "node_modules/@parcel/watcher": { + "version": "2.5.6", + "resolved": "https://registry.npmjs.org/@parcel/watcher/-/watcher-2.5.6.tgz", + "integrity": "sha512-tmmZ3lQxAe/k/+rNnXQRawJ4NjxO2hqiOLTHvWchtGZULp4RyFeh6aU4XdOYBFe2KE1oShQTv4AblOs2iOrNnQ==", + "hasInstallScript": true, + "license": "MIT", + "dependencies": { + "detect-libc": "^2.0.3", + "is-glob": "^4.0.3", + "node-addon-api": "^7.0.0", + "picomatch": "^4.0.3" + }, + "engines": { + "node": ">= 10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + }, + "optionalDependencies": { + "@parcel/watcher-android-arm64": "2.5.6", + "@parcel/watcher-darwin-arm64": "2.5.6", + "@parcel/watcher-darwin-x64": "2.5.6", + "@parcel/watcher-freebsd-x64": "2.5.6", + "@parcel/watcher-linux-arm-glibc": "2.5.6", + "@parcel/watcher-linux-arm-musl": "2.5.6", + "@parcel/watcher-linux-arm64-glibc": "2.5.6", + "@parcel/watcher-linux-arm64-musl": "2.5.6", + "@parcel/watcher-linux-x64-glibc": "2.5.6", + "@parcel/watcher-linux-x64-musl": "2.5.6", + "@parcel/watcher-win32-arm64": "2.5.6", + "@parcel/watcher-win32-ia32": "2.5.6", + "@parcel/watcher-win32-x64": "2.5.6" + } + }, + "node_modules/@parcel/watcher-android-arm64": { + "version": "2.5.6", + "resolved": "https://registry.npmjs.org/@parcel/watcher-android-arm64/-/watcher-android-arm64-2.5.6.tgz", + "integrity": "sha512-YQxSS34tPF/6ZG7r/Ih9xy+kP/WwediEUsqmtf0cuCV5TPPKw/PQHRhueUo6JdeFJaqV3pyjm0GdYjZotbRt/A==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">= 10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/@parcel/watcher-darwin-arm64": { + "version": "2.5.6", + "resolved": "https://registry.npmjs.org/@parcel/watcher-darwin-arm64/-/watcher-darwin-arm64-2.5.6.tgz", + "integrity": "sha512-Z2ZdrnwyXvvvdtRHLmM4knydIdU9adO3D4n/0cVipF3rRiwP+3/sfzpAwA/qKFL6i1ModaabkU7IbpeMBgiVEA==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/@parcel/watcher-darwin-x64": { + "version": "2.5.6", + "resolved": "https://registry.npmjs.org/@parcel/watcher-darwin-x64/-/watcher-darwin-x64-2.5.6.tgz", + "integrity": "sha512-HgvOf3W9dhithcwOWX9uDZyn1lW9R+7tPZ4sug+NGrGIo4Rk1hAXLEbcH1TQSqxts0NYXXlOWqVpvS1SFS4fRg==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/@parcel/watcher-freebsd-x64": { + "version": "2.5.6", + "resolved": "https://registry.npmjs.org/@parcel/watcher-freebsd-x64/-/watcher-freebsd-x64-2.5.6.tgz", + "integrity": "sha512-vJVi8yd/qzJxEKHkeemh7w3YAn6RJCtYlE4HPMoVnCpIXEzSrxErBW5SJBgKLbXU3WdIpkjBTeUNtyBVn8TRng==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">= 10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/@parcel/watcher-linux-arm-glibc": { + "version": "2.5.6", + "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-arm-glibc/-/watcher-linux-arm-glibc-2.5.6.tgz", + "integrity": "sha512-9JiYfB6h6BgV50CCfasfLf/uvOcJskMSwcdH1PHH9rvS1IrNy8zad6IUVPVUfmXr+u+Km9IxcfMLzgdOudz9EQ==", + "cpu": [ + "arm" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/@parcel/watcher-linux-arm-musl": { + "version": "2.5.6", + "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-arm-musl/-/watcher-linux-arm-musl-2.5.6.tgz", + "integrity": "sha512-Ve3gUCG57nuUUSyjBq/MAM0CzArtuIOxsBdQ+ftz6ho8n7s1i9E1Nmk/xmP323r2YL0SONs1EuwqBp2u1k5fxg==", + "cpu": [ + "arm" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/@parcel/watcher-linux-arm64-glibc": { + "version": "2.5.6", + "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-arm64-glibc/-/watcher-linux-arm64-glibc-2.5.6.tgz", + "integrity": "sha512-f2g/DT3NhGPdBmMWYoxixqYr3v/UXcmLOYy16Bx0TM20Tchduwr4EaCbmxh1321TABqPGDpS8D/ggOTaljijOA==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/@parcel/watcher-linux-arm64-musl": { + "version": "2.5.6", + "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-arm64-musl/-/watcher-linux-arm64-musl-2.5.6.tgz", + "integrity": "sha512-qb6naMDGlbCwdhLj6hgoVKJl2odL34z2sqkC7Z6kzir8b5W65WYDpLB6R06KabvZdgoHI/zxke4b3zR0wAbDTA==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/@parcel/watcher-linux-x64-glibc": { + "version": "2.5.6", + "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-x64-glibc/-/watcher-linux-x64-glibc-2.5.6.tgz", + "integrity": "sha512-kbT5wvNQlx7NaGjzPFu8nVIW1rWqV780O7ZtkjuWaPUgpv2NMFpjYERVi0UYj1msZNyCzGlaCWEtzc+exjMGbQ==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/@parcel/watcher-linux-x64-musl": { + "version": "2.5.6", + "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-x64-musl/-/watcher-linux-x64-musl-2.5.6.tgz", + "integrity": "sha512-1JRFeC+h7RdXwldHzTsmdtYR/Ku8SylLgTU/reMuqdVD7CtLwf0VR1FqeprZ0eHQkO0vqsbvFLXUmYm/uNKJBg==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/@parcel/watcher-win32-arm64": { + "version": "2.5.6", + "resolved": "https://registry.npmjs.org/@parcel/watcher-win32-arm64/-/watcher-win32-arm64-2.5.6.tgz", + "integrity": "sha512-3ukyebjc6eGlw9yRt678DxVF7rjXatWiHvTXqphZLvo7aC5NdEgFufVwjFfY51ijYEWpXbqF5jtrK275z52D4Q==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/@parcel/watcher-win32-ia32": { + "version": "2.5.6", + "resolved": "https://registry.npmjs.org/@parcel/watcher-win32-ia32/-/watcher-win32-ia32-2.5.6.tgz", + "integrity": "sha512-k35yLp1ZMwwee3Ez/pxBi5cf4AoBKYXj00CZ80jUz5h8prpiaQsiRPKQMxoLstNuqe2vR4RNPEAEcjEFzhEz/g==", + "cpu": [ + "ia32" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/@parcel/watcher-win32-x64": { + "version": "2.5.6", + "resolved": "https://registry.npmjs.org/@parcel/watcher-win32-x64/-/watcher-win32-x64-2.5.6.tgz", + "integrity": "sha512-hbQlYcCq5dlAX9Qx+kFb0FHue6vbjlf0FrNzSKdYK2APUf7tGfGxQCk2ihEREmbR6ZMc0MVAD5RIX/41gpUzTw==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/@pkgjs/parseargs": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz", + "integrity": "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==", + "license": "MIT", + "optional": true, + "engines": { + "node": ">=14" + } + }, + "node_modules/@playwright/test": { + "version": "1.58.2", + "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.58.2.tgz", + "integrity": "sha512-akea+6bHYBBfA9uQqSYmlJXn61cTa+jbO87xVLCWbTqbWadRVmhxlXATaOjOgcBaWU4ePo0wB41KMFv3o35IXA==", + "license": "Apache-2.0", + "dependencies": { + "playwright": "1.58.2" + }, + "bin": { + "playwright": "cli.js" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@protobufjs/aspromise": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz", + "integrity": "sha512-j+gKExEuLmKwvz3OgROXtrJ2UG2x8Ch2YZUxahh+s1F2HZ+wAceUNLkvy6zKCPVRkU++ZWQrdxsUeQXmcg4uoQ==", + "license": "BSD-3-Clause" + }, + "node_modules/@protobufjs/base64": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@protobufjs/base64/-/base64-1.1.2.tgz", + "integrity": "sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg==", + "license": "BSD-3-Clause" + }, + "node_modules/@protobufjs/codegen": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@protobufjs/codegen/-/codegen-2.0.4.tgz", + "integrity": "sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg==", + "license": "BSD-3-Clause" + }, + "node_modules/@protobufjs/eventemitter": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/eventemitter/-/eventemitter-1.1.0.tgz", + "integrity": "sha512-j9ednRT81vYJ9OfVuXG6ERSTdEL1xVsNgqpkxMsbIabzSo3goCjDIveeGv5d03om39ML71RdmrGNjG5SReBP/Q==", + "license": "BSD-3-Clause" + }, + "node_modules/@protobufjs/fetch": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/fetch/-/fetch-1.1.0.tgz", + "integrity": "sha512-lljVXpqXebpsijW71PZaCYeIcE5on1w5DlQy5WH6GLbFryLUrBD4932W/E2BSpfRJWseIL4v/KPgBFxDOIdKpQ==", + "license": "BSD-3-Clause", + "dependencies": { + "@protobufjs/aspromise": "^1.1.1", + "@protobufjs/inquire": "^1.1.0" + } + }, + "node_modules/@protobufjs/float": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@protobufjs/float/-/float-1.0.2.tgz", + "integrity": "sha512-Ddb+kVXlXst9d+R9PfTIxh1EdNkgoRe5tOX6t01f1lYWOvJnSPDBlG241QLzcyPdoNTsblLUdujGSE4RzrTZGQ==", + "license": "BSD-3-Clause" + }, + "node_modules/@protobufjs/inquire": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/inquire/-/inquire-1.1.0.tgz", + "integrity": "sha512-kdSefcPdruJiFMVSbn801t4vFK7KB/5gd2fYvrxhuJYg8ILrmn9SKSX2tZdV6V+ksulWqS7aXjBcRXl3wHoD9Q==", + "license": "BSD-3-Clause" + }, + "node_modules/@protobufjs/path": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@protobufjs/path/-/path-1.1.2.tgz", + "integrity": "sha512-6JOcJ5Tm08dOHAbdR3GrvP+yUUfkjG5ePsHYczMFLq3ZmMkAD98cDgcT2iA1lJ9NVwFd4tH/iSSoe44YWkltEA==", + "license": "BSD-3-Clause" + }, + "node_modules/@protobufjs/pool": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/pool/-/pool-1.1.0.tgz", + "integrity": "sha512-0kELaGSIDBKvcgS4zkjz1PeddatrjYcmMWOlAuAPwAeccUrPHdUqo/J6LiymHHEiJT5NrF1UVwxY14f+fy4WQw==", + "license": "BSD-3-Clause" + }, + "node_modules/@protobufjs/utf8": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/utf8/-/utf8-1.1.0.tgz", + "integrity": "sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw==", + "license": "BSD-3-Clause" + }, + "node_modules/@puppeteer/browsers": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/@puppeteer/browsers/-/browsers-2.3.1.tgz", + "integrity": "sha512-uK7o3hHkK+naEobMSJ+2ySYyXtQkBxIH8Gn4MK9ciePjNV+Pf+PgY/W7iPzn2MTjl3stcYB5AlcTmPYw7AXDwA==", + "license": "Apache-2.0", + "dependencies": { + "debug": "^4.3.6", + "extract-zip": "^2.0.1", + "progress": "^2.0.3", + "proxy-agent": "^6.4.0", + "semver": "^7.6.3", + "tar-fs": "^3.0.6", + "unbzip2-stream": "^1.4.3", + "yargs": "^17.7.2" + }, + "bin": { + "browsers": "lib/cjs/main-cli.js" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@puppeteer/browsers/node_modules/y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "license": "ISC", + "engines": { + "node": ">=10" + } + }, + "node_modules/@puppeteer/browsers/node_modules/yargs": { + "version": "17.7.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", + "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", + "license": "MIT", + "dependencies": { + "cliui": "^8.0.1", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.3", + "y18n": "^5.0.5", + "yargs-parser": "^21.1.1" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@rtsao/scc": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@rtsao/scc/-/scc-1.1.0.tgz", + "integrity": "sha512-zt6OdqaDoOnJ1ZYsCYGt9YmWzDXl4vQdKTyJev62gFhRGKdx7mcT54V9KIjg+d2wi9EXsPvAPKe7i7WjfVWB8g==", + "dev": true, + "license": "MIT" + }, + "node_modules/@shikijs/engine-oniguruma": { + "version": "3.22.0", + "resolved": "https://registry.npmjs.org/@shikijs/engine-oniguruma/-/engine-oniguruma-3.22.0.tgz", + "integrity": "sha512-DyXsOG0vGtNtl7ygvabHd7Mt5EY8gCNqR9Y7Lpbbd/PbJvgWrqaKzH1JW6H6qFkuUa8aCxoiYVv8/YfFljiQxA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@shikijs/types": "3.22.0", + "@shikijs/vscode-textmate": "^10.0.2" + } + }, + "node_modules/@shikijs/langs": { + "version": "3.22.0", + "resolved": "https://registry.npmjs.org/@shikijs/langs/-/langs-3.22.0.tgz", + "integrity": "sha512-x/42TfhWmp6H00T6uwVrdTJGKgNdFbrEdhaDwSR5fd5zhQ1Q46bHq9EO61SCEWJR0HY7z2HNDMaBZp8JRmKiIA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@shikijs/types": "3.22.0" + } + }, + "node_modules/@shikijs/themes": { + "version": "3.22.0", + "resolved": "https://registry.npmjs.org/@shikijs/themes/-/themes-3.22.0.tgz", + "integrity": "sha512-o+tlOKqsr6FE4+mYJG08tfCFDS+3CG20HbldXeVoyP+cYSUxDhrFf3GPjE60U55iOkkjbpY2uC3It/eeja35/g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@shikijs/types": "3.22.0" + } + }, + "node_modules/@shikijs/types": { + "version": "3.22.0", + "resolved": "https://registry.npmjs.org/@shikijs/types/-/types-3.22.0.tgz", + "integrity": "sha512-491iAekgKDBFE67z70Ok5a8KBMsQ2IJwOWw3us/7ffQkIBCyOQfm/aNwVMBUriP02QshIfgHCBSIYAl3u2eWjg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@shikijs/vscode-textmate": "^10.0.2", + "@types/hast": "^3.0.4" + } + }, + "node_modules/@shikijs/vscode-textmate": { + "version": "10.0.2", + "resolved": "https://registry.npmjs.org/@shikijs/vscode-textmate/-/vscode-textmate-10.0.2.tgz", + "integrity": "sha512-83yeghZ2xxin3Nj8z1NMd/NCuca+gsYXswywDy5bHvwlWL8tpTQmzGeUuHd9FC3E/SBEMvzJRwWEOz5gGes9Qg==", + "dev": true, + "license": "MIT" + }, + "node_modules/@sigstore/bundle": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@sigstore/bundle/-/bundle-4.0.0.tgz", + "integrity": "sha512-NwCl5Y0V6Di0NexvkTqdoVfmjTaQwoLM236r89KEojGmq/jMls8S+zb7yOwAPdXvbwfKDlP+lmXgAL4vKSQT+A==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@sigstore/protobuf-specs": "^0.5.0" + }, + "engines": { + "node": "^20.17.0 || >=22.9.0" + } + }, + "node_modules/@sigstore/core": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@sigstore/core/-/core-3.1.0.tgz", + "integrity": "sha512-o5cw1QYhNQ9IroioJxpzexmPjfCe7gzafd2RY3qnMpxr4ZEja+Jad/U8sgFpaue6bOaF+z7RVkyKVV44FN+N8A==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^20.17.0 || >=22.9.0" + } + }, + "node_modules/@sigstore/protobuf-specs": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/@sigstore/protobuf-specs/-/protobuf-specs-0.5.0.tgz", + "integrity": "sha512-MM8XIwUjN2bwvCg1QvrMtbBmpcSHrkhFSCu1D11NyPvDQ25HEc4oG5/OcQfd/Tlf/OxmKWERDj0zGE23jQaMwA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/@sigstore/sign": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/@sigstore/sign/-/sign-4.1.0.tgz", + "integrity": "sha512-Vx1RmLxLGnSUqx/o5/VsCjkuN5L7y+vxEEwawvc7u+6WtX2W4GNa7b9HEjmcRWohw/d6BpATXmvOwc78m+Swdg==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@sigstore/bundle": "^4.0.0", + "@sigstore/core": "^3.1.0", + "@sigstore/protobuf-specs": "^0.5.0", + "make-fetch-happen": "^15.0.3", + "proc-log": "^6.1.0", + "promise-retry": "^2.0.1" + }, + "engines": { + "node": "^20.17.0 || >=22.9.0" + } + }, + "node_modules/@sigstore/sign/node_modules/make-fetch-happen": { + "version": "15.0.3", + "resolved": "https://registry.npmjs.org/make-fetch-happen/-/make-fetch-happen-15.0.3.tgz", + "integrity": "sha512-iyyEpDty1mwW3dGlYXAJqC/azFn5PPvgKVwXayOGBSmKLxhKZ9fg4qIan2ePpp1vJIwfFiO34LAPZgq9SZW9Aw==", + "dev": true, + "license": "ISC", + "dependencies": { + "@npmcli/agent": "^4.0.0", + "cacache": "^20.0.1", + "http-cache-semantics": "^4.1.1", + "minipass": "^7.0.2", + "minipass-fetch": "^5.0.0", + "minipass-flush": "^1.0.5", + "minipass-pipeline": "^1.2.4", + "negotiator": "^1.0.0", + "proc-log": "^6.0.0", + "promise-retry": "^2.0.1", + "ssri": "^13.0.0" + }, + "engines": { + "node": "^20.17.0 || >=22.9.0" + } + }, + "node_modules/@sigstore/sign/node_modules/minipass-fetch": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/minipass-fetch/-/minipass-fetch-5.0.1.tgz", + "integrity": "sha512-yHK8pb0iCGat0lDrs/D6RZmCdaBT64tULXjdxjSMAqoDi18Q3qKEUTHypHQZQd9+FYpIS+lkvpq6C/R6SbUeRw==", + "dev": true, + "license": "MIT", + "dependencies": { + "minipass": "^7.0.3", + "minipass-sized": "^2.0.0", + "minizlib": "^3.0.1" + }, + "engines": { + "node": "^20.17.0 || >=22.9.0" + }, + "optionalDependencies": { + "encoding": "^0.1.13" + } + }, + "node_modules/@sigstore/sign/node_modules/minipass-sized": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/minipass-sized/-/minipass-sized-2.0.0.tgz", + "integrity": "sha512-zSsHhto5BcUVM2m1LurnXY6M//cGhVaegT71OfOXoprxT6o780GZd792ea6FfrQkuU4usHZIUczAQMRUE2plzA==", + "dev": true, + "license": "ISC", + "dependencies": { + "minipass": "^7.1.2" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@sigstore/sign/node_modules/negotiator": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-1.0.0.tgz", + "integrity": "sha512-8Ofs/AUQh8MaEcrlq5xOX0CQ9ypTF5dl78mjlMNfOK08fzpgTHQRQPBxcPlEtIw0yRpws+Zo/3r+5WRby7u3Gg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/@sigstore/sign/node_modules/proc-log": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/proc-log/-/proc-log-6.1.0.tgz", + "integrity": "sha512-iG+GYldRf2BQ0UDUAd6JQ/RwzaQy6mXmsk/IzlYyal4A4SNFw54MeH4/tLkF4I5WoWG9SQwuqWzS99jaFQHBuQ==", + "dev": true, + "license": "ISC", + "engines": { + "node": "^20.17.0 || >=22.9.0" + } + }, + "node_modules/@sigstore/sign/node_modules/ssri": { + "version": "13.0.1", + "resolved": "https://registry.npmjs.org/ssri/-/ssri-13.0.1.tgz", + "integrity": "sha512-QUiRf1+u9wPTL/76GTYlKttDEBWV1ga9ZXW8BG6kfdeyyM8LGPix9gROyg9V2+P0xNyF3X2Go526xKFdMZrHSQ==", + "dev": true, + "license": "ISC", + "dependencies": { + "minipass": "^7.0.3" + }, + "engines": { + "node": "^20.17.0 || >=22.9.0" + } + }, + "node_modules/@sigstore/tuf": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/@sigstore/tuf/-/tuf-4.0.1.tgz", + "integrity": "sha512-OPZBg8y5Vc9yZjmWCHrlWPMBqW5yd8+wFNl+thMdtcWz3vjVSoJQutF8YkrzI0SLGnkuFof4HSsWUhXrf219Lw==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@sigstore/protobuf-specs": "^0.5.0", + "tuf-js": "^4.1.0" + }, + "engines": { + "node": "^20.17.0 || >=22.9.0" + } + }, + "node_modules/@sigstore/verify": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@sigstore/verify/-/verify-3.1.0.tgz", + "integrity": "sha512-mNe0Iigql08YupSOGv197YdHpPPr+EzDZmfCgMc7RPNaZTw5aLN01nBl6CHJOh3BGtnMIj83EeN4butBchc8Ag==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@sigstore/bundle": "^4.0.0", + "@sigstore/core": "^3.1.0", + "@sigstore/protobuf-specs": "^0.5.0" + }, + "engines": { + "node": "^20.17.0 || >=22.9.0" + } + }, + "node_modules/@sinclair/typebox": { + "version": "0.34.48", + "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.34.48.tgz", + "integrity": "sha512-kKJTNuK3AQOrgjjotVxMrCn1sUJwM76wMszfq1kdU4uYVJjvEWuFQ6HgvLt4Xz3fSmZlTOxJ/Ie13KnIcWQXFA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@sindresorhus/df": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/@sindresorhus/df/-/df-3.1.1.tgz", + "integrity": "sha512-SME/vtXaJcnQ/HpeV6P82Egy+jThn11IKfwW8+/XVoRD0rmPHVTeKMtww1oWdVnMykzVPjmrDN9S8NBndPEHCQ==", + "license": "MIT", + "dependencies": { + "execa": "^2.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@sindresorhus/df/node_modules/execa": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-2.1.0.tgz", + "integrity": "sha512-Y/URAVapfbYy2Xp/gb6A0E7iR8xeqOCXsuuaoMn7A5PzrXUK84E1gyiEfq0wQd/GHA6GsoHWwhNq8anb0mleIw==", + "license": "MIT", + "dependencies": { + "cross-spawn": "^7.0.0", + "get-stream": "^5.0.0", + "is-stream": "^2.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^3.0.0", + "onetime": "^5.1.0", + "p-finally": "^2.0.0", + "signal-exit": "^3.0.2", + "strip-final-newline": "^2.0.0" + }, + "engines": { + "node": "^8.12.0 || >=9.7.0" + } + }, + "node_modules/@sindresorhus/df/node_modules/get-stream": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", + "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", + "license": "MIT", + "dependencies": { + "pump": "^3.0.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@sindresorhus/df/node_modules/npm-run-path": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-3.1.0.tgz", + "integrity": "sha512-Dbl4A/VfiVGLgQv29URL9xshU8XDY1GeLy+fsaZ1AA8JDSfjvr5P5+pzRbWqRSBxk6/DW7MIh8lTM/PaGnP2kg==", + "license": "MIT", + "dependencies": { + "path-key": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@sindresorhus/df/node_modules/p-finally": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-2.0.1.tgz", + "integrity": "sha512-vpm09aKwq6H9phqRQzecoDpD8TmVyGw70qmWlyq5onxY7tqyTTFVvxMykxQSQKILBSFlbXpypIw2T1Ml7+DDtw==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/@sindresorhus/is": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-4.6.0.tgz", + "integrity": "sha512-t09vSN3MdfsyCHoFcTRCH/iUtG7OJ0CsjzB8cjAmKc/va/kIgeDI/TxsigdncE/4be734m0cvIYwNaV4i2XqAw==", + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sindresorhus/is?sponsor=1" + } + }, + "node_modules/@sinonjs/commons": { + "version": "1.8.6", + "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-1.8.6.tgz", + "integrity": "sha512-Ky+XkAkqPZSm3NLBeUng77EBQl3cmeJhITaGHdYH8kjVB+aun3S4XBRti2zt17mtt0mIUDiNxYeoJm6drVvBJQ==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "type-detect": "4.0.8" + } + }, + "node_modules/@sinonjs/commons/node_modules/type-detect": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", + "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/@sinonjs/fake-timers": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-8.1.0.tgz", + "integrity": "sha512-OAPJUAtgeINhh/TAlUID4QTs53Njm7xzddaVlEs/SXwgtiD1tW22zAB/W1wdqfrpmikgaWQ9Fw6Ws+hsiRm5Vg==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "@sinonjs/commons": "^1.7.0" + } + }, + "node_modules/@sinonjs/samsam": { + "version": "6.1.3", + "resolved": "https://registry.npmjs.org/@sinonjs/samsam/-/samsam-6.1.3.tgz", + "integrity": "sha512-nhOb2dWPeb1sd3IQXL/dVPnKHDOAFfvichtBf4xV00/rU1QbPCQqKMbvIheIjqwVjh7qIgf2AHTHi391yMOMpQ==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "@sinonjs/commons": "^1.6.0", + "lodash.get": "^4.4.2", + "type-detect": "^4.0.8" + } + }, + "node_modules/@sinonjs/text-encoding": { + "version": "0.7.3", + "resolved": "https://registry.npmjs.org/@sinonjs/text-encoding/-/text-encoding-0.7.3.tgz", + "integrity": "sha512-DE427ROAphMQzU4ENbliGYrBSYPXF+TtLg9S8vzeA+OF4ZKzoDdzfL8sxuMUGS/lgRhM6j1URSk9ghf7Xo1tyA==", + "dev": true, + "license": "(Unlicense OR Apache-2.0)" + }, + "node_modules/@socket.io/component-emitter": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@socket.io/component-emitter/-/component-emitter-3.1.2.tgz", + "integrity": "sha512-9BCxFwvbGg/RsZK9tjXd8s4UcwR0MWeFQ1XEKIQVVvAGJyINdrqKMcTRyLoK8Rse1GjzLV9cwjWV1olXRWEXVA==", + "license": "MIT" + }, + "node_modules/@stroncium/procfs": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@stroncium/procfs/-/procfs-1.2.1.tgz", + "integrity": "sha512-X1Iui3FUNZP18EUvysTHxt+Avu2nlVzyf90YM8OYgP6SGzTzzX/0JgObfO1AQQDzuZtNNz29bVh8h5R97JrjxA==", + "license": "CC0-1.0", + "engines": { + "node": ">=8" + } + }, + "node_modules/@szmarczak/http-timer": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-4.0.6.tgz", + "integrity": "sha512-4BAffykYOgO+5nzBWYwE3W90sBgLJoUPRWWcL8wlyiM8IB8ipJz3UMJ9KXQd1RKQXpKp8Tutn80HZtWsu2u76w==", + "license": "MIT", + "dependencies": { + "defer-to-connect": "^2.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@theia/ai-anthropic": { + "resolved": "packages/ai-anthropic", + "link": true + }, + "node_modules/@theia/ai-chat": { + "resolved": "packages/ai-chat", + "link": true + }, + "node_modules/@theia/ai-chat-ui": { + "resolved": "packages/ai-chat-ui", + "link": true + }, + "node_modules/@theia/ai-claude-code": { + "resolved": "packages/ai-claude-code", + "link": true + }, + "node_modules/@theia/ai-code-completion": { + "resolved": "packages/ai-code-completion", + "link": true + }, + "node_modules/@theia/ai-codex": { + "resolved": "packages/ai-codex", + "link": true + }, + "node_modules/@theia/ai-copilot": { + "resolved": "packages/ai-copilot", + "link": true + }, + "node_modules/@theia/ai-core": { + "resolved": "packages/ai-core", + "link": true + }, + "node_modules/@theia/ai-core-ui": { + "resolved": "packages/ai-core-ui", + "link": true + }, + "node_modules/@theia/ai-editor": { + "resolved": "packages/ai-editor", + "link": true + }, + "node_modules/@theia/ai-google": { + "resolved": "packages/ai-google", + "link": true + }, + "node_modules/@theia/ai-history": { + "resolved": "packages/ai-history", + "link": true + }, + "node_modules/@theia/ai-huggingface": { + "resolved": "packages/ai-hugging-face", + "link": true + }, + "node_modules/@theia/ai-ide": { + "resolved": "packages/ai-ide", + "link": true + }, + "node_modules/@theia/ai-llamafile": { + "resolved": "packages/ai-llamafile", + "link": true + }, + "node_modules/@theia/ai-mcp": { + "resolved": "packages/ai-mcp.disabled", + "link": true + }, + "node_modules/@theia/ai-mcp-server": { + "resolved": "packages/ai-mcp-server.disabled", + "link": true + }, + "node_modules/@theia/ai-ollama": { + "resolved": "packages/ai-ollama", + "link": true + }, + "node_modules/@theia/ai-openai": { + "resolved": "packages/ai-openai", + "link": true + }, + "node_modules/@theia/ai-scanoss": { + "resolved": "packages/ai-scanoss", + "link": true + }, + "node_modules/@theia/ai-terminal": { + "resolved": "packages/ai-terminal", + "link": true + }, + "node_modules/@theia/api-provider-sample": { + "resolved": "examples/api-provider-sample", + "link": true + }, + "node_modules/@theia/api-samples": { + "resolved": "examples/api-samples.disabled", + "link": true + }, + "node_modules/@theia/api-tests": { + "resolved": "examples/api-tests", + "link": true + }, + "node_modules/@theia/application-manager": { + "resolved": "dev-packages/application-manager", + "link": true + }, + "node_modules/@theia/application-package": { + "resolved": "dev-packages/application-package", + "link": true + }, + "node_modules/@theia/bulk-edit": { + "resolved": "packages/bulk-edit", + "link": true + }, + "node_modules/@theia/callhierarchy": { + "resolved": "packages/callhierarchy", + "link": true + }, + "node_modules/@theia/cli": { + "resolved": "dev-packages/cli", + "link": true + }, + "node_modules/@theia/collaboration": { + "resolved": "packages/collaboration", + "link": true + }, + "node_modules/@theia/console": { + "resolved": "packages/console", + "link": true + }, + "node_modules/@theia/core": { + "resolved": "packages/core", + "link": true + }, + "node_modules/@theia/debug": { + "resolved": "packages/debug", + "link": true + }, + "node_modules/@theia/design-panel": { + "resolved": "packages/design-panel", + "link": true + }, + "node_modules/@theia/dev-container": { + "resolved": "packages/dev-container", + "link": true + }, + "node_modules/@theia/editor": { + "resolved": "packages/editor", + "link": true + }, + "node_modules/@theia/editor-preview": { + "resolved": "packages/editor-preview", + "link": true + }, + "node_modules/@theia/electron": { + "resolved": "packages/electron", + "link": true + }, + "node_modules/@theia/eslint-plugin": { + "resolved": "dev-packages/private-eslint-plugin", + "link": true + }, + "node_modules/@theia/example-browser": { + "resolved": "examples/browser", + "link": true + }, + "node_modules/@theia/example-browser-only": { + "resolved": "examples/browser-only", + "link": true + }, + "node_modules/@theia/example-electron": { + "resolved": "examples/electron", + "link": true + }, + "node_modules/@theia/ext-scripts": { + "resolved": "dev-packages/private-ext-scripts", + "link": true + }, + "node_modules/@theia/external-terminal": { + "resolved": "packages/external-terminal", + "link": true + }, + "node_modules/@theia/ffmpeg": { + "resolved": "dev-packages/ffmpeg", + "link": true + }, + "node_modules/@theia/file-search": { + "resolved": "packages/file-search", + "link": true + }, + "node_modules/@theia/filesystem": { + "resolved": "packages/filesystem", + "link": true + }, + "node_modules/@theia/getting-started": { + "resolved": "packages/getting-started", + "link": true + }, + "node_modules/@theia/git": { + "resolved": "packages/git", + "link": true + }, + "node_modules/@theia/keymaps": { + "resolved": "packages/keymaps", + "link": true + }, + "node_modules/@theia/localization-manager": { + "resolved": "dev-packages/localization-manager", + "link": true + }, + "node_modules/@theia/markers": { + "resolved": "packages/markers", + "link": true + }, + "node_modules/@theia/memory-inspector": { + "resolved": "packages/memory-inspector", + "link": true + }, + "node_modules/@theia/messages": { + "resolved": "packages/messages", + "link": true + }, + "node_modules/@theia/metrics": { + "resolved": "packages/metrics", + "link": true + }, + "node_modules/@theia/mini-browser": { + "resolved": "packages/mini-browser", + "link": true + }, + "node_modules/@theia/monaco": { + "resolved": "packages/monaco", + "link": true + }, + "node_modules/@theia/monaco-editor-core": { + "version": "1.96.302", + "resolved": "https://registry.npmjs.org/@theia/monaco-editor-core/-/monaco-editor-core-1.96.302.tgz", + "integrity": "sha512-1np9/dI/cVmAE2KFi/13fK29jQOM9syyK6KaElaQ5nR8DVHsG49WK50Yd4yjwaqH2y4NHDeiZR8GoOJi8L9z4A==", + "license": "MIT" + }, + "node_modules/@theia/native-webpack-plugin": { + "resolved": "dev-packages/native-webpack-plugin", + "link": true + }, + "node_modules/@theia/navigator": { + "resolved": "packages/navigator", + "link": true + }, + "node_modules/@theia/notebook": { + "resolved": "packages/notebook", + "link": true + }, + "node_modules/@theia/outline-view": { + "resolved": "packages/outline-view", + "link": true + }, + "node_modules/@theia/output": { + "resolved": "packages/output", + "link": true + }, + "node_modules/@theia/ovsx-client": { + "resolved": "dev-packages/ovsx-client", + "link": true + }, + "node_modules/@theia/playwright": { + "resolved": "examples/playwright", + "link": true + }, + "node_modules/@theia/plugin": { + "resolved": "packages/plugin", + "link": true + }, + "node_modules/@theia/plugin-dev": { + "resolved": "packages/plugin-dev", + "link": true + }, + "node_modules/@theia/plugin-ext": { + "resolved": "packages/plugin-ext", + "link": true + }, + "node_modules/@theia/plugin-ext-headless": { + "resolved": "packages/plugin-ext-headless", + "link": true + }, + "node_modules/@theia/plugin-ext-vscode": { + "resolved": "packages/plugin-ext-vscode", + "link": true + }, + "node_modules/@theia/plugin-metrics": { + "resolved": "packages/plugin-metrics", + "link": true + }, + "node_modules/@theia/preferences": { + "resolved": "packages/preferences", + "link": true + }, + "node_modules/@theia/preview": { + "resolved": "packages/preview", + "link": true + }, + "node_modules/@theia/process": { + "resolved": "packages/process", + "link": true + }, + "node_modules/@theia/property-view": { + "resolved": "packages/property-view", + "link": true + }, + "node_modules/@theia/re-exports": { + "resolved": "dev-packages/private-re-exports", + "link": true + }, + "node_modules/@theia/remote": { + "resolved": "packages/remote", + "link": true + }, + "node_modules/@theia/remote-wsl": { + "resolved": "packages/remote-wsl", + "link": true + }, + "node_modules/@theia/request": { + "resolved": "dev-packages/request", + "link": true + }, + "node_modules/@theia/scanoss": { + "resolved": "packages/scanoss", + "link": true + }, + "node_modules/@theia/scm": { + "resolved": "packages/scm", + "link": true + }, + "node_modules/@theia/scm-extra": { + "resolved": "packages/scm-extra", + "link": true + }, + "node_modules/@theia/search-in-workspace": { + "resolved": "packages/search-in-workspace", + "link": true + }, + "node_modules/@theia/secondary-window": { + "resolved": "packages/secondary-window", + "link": true + }, + "node_modules/@theia/task": { + "resolved": "packages/task", + "link": true + }, + "node_modules/@theia/terminal": { + "resolved": "packages/terminal", + "link": true + }, + "node_modules/@theia/terminal-manager": { + "resolved": "packages/terminal-manager", + "link": true + }, + "node_modules/@theia/test": { + "resolved": "packages/test", + "link": true + }, + "node_modules/@theia/test-setup": { + "resolved": "dev-packages/private-test-setup", + "link": true + }, + "node_modules/@theia/timeline": { + "resolved": "packages/timeline", + "link": true + }, + "node_modules/@theia/toolbar": { + "resolved": "packages/toolbar", + "link": true + }, + "node_modules/@theia/typehierarchy": { + "resolved": "packages/typehierarchy", + "link": true + }, + "node_modules/@theia/userstorage": { + "resolved": "packages/userstorage", + "link": true + }, + "node_modules/@theia/variable-resolver": { + "resolved": "packages/variable-resolver", + "link": true + }, + "node_modules/@theia/vsx-registry": { + "resolved": "packages/vsx-registry", + "link": true + }, + "node_modules/@theia/workspace": { + "resolved": "packages/workspace", + "link": true + }, + "node_modules/@tootallnate/once": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-2.0.0.tgz", + "integrity": "sha512-XCuKFP5PS55gnMVu3dty8KPatLqUoy/ZYzDzAGCQ8JNFCkLXzmI7vNHCR+XpbZaMWQK/vQubr7PkYq8g470J/A==", + "license": "MIT", + "engines": { + "node": ">= 10" + } + }, + "node_modules/@tootallnate/quickjs-emscripten": { + "version": "0.23.0", + "resolved": "https://registry.npmjs.org/@tootallnate/quickjs-emscripten/-/quickjs-emscripten-0.23.0.tgz", + "integrity": "sha512-C5Mc6rdnsaJDjO3UpGW/CQTHtCKaYlScZTly4JIu97Jxo/odCiH0ITnDXSJPTOrEKk/ycSZ0AOgTmkDtkOsvIA==", + "license": "MIT" + }, + "node_modules/@tufjs/canonical-json": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@tufjs/canonical-json/-/canonical-json-2.0.0.tgz", + "integrity": "sha512-yVtV8zsdo8qFHe+/3kw81dSLyF7D576A5cCFCi4X7B39tWT7SekaEFUnvnWJHz+9qO7qJTah1JbrDjWKqFtdWA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^16.14.0 || >=18.0.0" + } + }, + "node_modules/@tufjs/models": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/@tufjs/models/-/models-4.1.0.tgz", + "integrity": "sha512-Y8cK9aggNRsqJVaKUlEYs4s7CvQ1b1ta2DVPyAimb0I2qhzjNk+A+mxvll/klL0RlfuIUei8BF7YWiua4kQqww==", + "dev": true, + "license": "MIT", + "dependencies": { + "@tufjs/canonical-json": "2.0.0", + "minimatch": "^10.1.1" + }, + "engines": { + "node": "^20.17.0 || >=22.9.0" + } + }, + "node_modules/@tybys/wasm-util": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/@tybys/wasm-util/-/wasm-util-0.9.0.tgz", + "integrity": "sha512-6+7nlbMVX/PVDCwaIQ8nTOPveOcFLSt8GcXdx8hD0bt39uWxYT88uXzqTd4fTvqta7oeUJqudepapKNt2DYJFw==", + "dev": true, + "license": "MIT", + "dependencies": { + "tslib": "^2.4.0" + } + }, + "node_modules/@types/archiver": { + "version": "5.3.4", + "resolved": "https://registry.npmjs.org/@types/archiver/-/archiver-5.3.4.tgz", + "integrity": "sha512-Lj7fLBIMwYFgViVVZHEdExZC3lVYsl+QL0VmdNdIzGZH544jHveYWij6qdnBgJQDnR7pMKliN9z2cPZFEbhyPw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/readdir-glob": "*" + } + }, + "node_modules/@types/bent": { + "version": "7.3.8", + "resolved": "https://registry.npmjs.org/@types/bent/-/bent-7.3.8.tgz", + "integrity": "sha512-yZ09JA1KsA5Fl6Oh/ahK00+H5bV0qCy2bYnyfiFY42wnaMK4n7IDC6HaFe3WW45Zhnak7iqJBKlWD0nVxzrGWg==", + "license": "MIT", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/body-parser": { + "version": "1.19.6", + "resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.19.6.tgz", + "integrity": "sha512-HLFeCYgz89uk22N5Qg3dvGvsv46B8GLvKKo1zKG4NybA8U2DiEO3w9lqGg29t/tfLRJpJ6iQxnVw4OnB7MoM9g==", + "license": "MIT", + "dependencies": { + "@types/connect": "*", + "@types/node": "*" + } + }, + "node_modules/@types/cacheable-request": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/@types/cacheable-request/-/cacheable-request-6.0.3.tgz", + "integrity": "sha512-IQ3EbTzGxIigb1I3qPZc1rWJnH0BmSKv5QYTalEwweFvyBDLSAe24zP0le/hyi7ecGfZVlIVAg4BZqb8WBwKqw==", + "license": "MIT", + "dependencies": { + "@types/http-cache-semantics": "*", + "@types/keyv": "^3.1.4", + "@types/node": "*", + "@types/responselike": "^1.0.0" + } + }, + "node_modules/@types/chai": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.3.0.tgz", + "integrity": "sha512-/ceqdqeRraGolFTcfoXNiqjyQhZzbINDngeoAq9GoHa8PPK1yNzTaxWjA6BFWp5Ua9JpXEMSS4s5i9tS0hOJtw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/chai-spies": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@types/chai-spies/-/chai-spies-1.0.3.tgz", + "integrity": "sha512-RBZjhVuK7vrg4rWMt04UF5zHYwfHnpk5mIWu3nQvU3AKGDixXzSjZ6v0zke6pBcaJqMv3IBZ5ibLWPMRDL0sLw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/chai": "*" + } + }, + "node_modules/@types/chai-string": { + "version": "1.4.5", + "resolved": "https://registry.npmjs.org/@types/chai-string/-/chai-string-1.4.5.tgz", + "integrity": "sha512-IecXRMSnpUvRnTztdpSdjcmcW7EdNme65bfDCQMi7XrSEPGmyDYYTEfc5fcactWDA6ioSm8o7NUqg9QxjBCCEw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/chai": "*" + } + }, + "node_modules/@types/connect": { + "version": "3.4.38", + "resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.38.tgz", + "integrity": "sha512-K6uROf1LD88uDQqJCktA4yzL1YYAK6NgfsI0v/mTgyPKWsX1CnJ0XPSDhViejru1GcRkLWb8RlzFYJRqGUbaug==", + "license": "MIT", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/cors": { + "version": "2.8.19", + "resolved": "https://registry.npmjs.org/@types/cors/-/cors-2.8.19.tgz", + "integrity": "sha512-mFNylyeyqN93lfe/9CSxOGREz8cpzAhH+E93xJ4xWQf62V8sQ/24reV2nyzUWM6H6Xji+GGHpkbLe7pVoUEskg==", + "license": "MIT", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/debug": { + "version": "4.1.12", + "resolved": "https://registry.npmjs.org/@types/debug/-/debug-4.1.12.tgz", + "integrity": "sha512-vIChWdVG3LG1SMxEvI/AK+FWJthlrqlTu7fbrlywTkkaONwk/UAGaULXRlf8vkzFBLVm0zkMdCquhL5aOjhXPQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/ms": "*" + } + }, + "node_modules/@types/decompress": { + "version": "4.2.7", + "resolved": "https://registry.npmjs.org/@types/decompress/-/decompress-4.2.7.tgz", + "integrity": "sha512-9z+8yjKr5Wn73Pt17/ldnmQToaFHZxK0N1GHysuk/JIPT8RIdQeoInM01wWPgypRcvb6VH1drjuFpQ4zmY437g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/diff": { + "version": "5.2.3", + "resolved": "https://registry.npmjs.org/@types/diff/-/diff-5.2.3.tgz", + "integrity": "sha512-K0Oqlrq3kQMaO2RhfrNQX5trmt+XLyom88zS0u84nnIcLvFnRUMRRHmrGny5GSM+kNO9IZLARsdQHDzkhAgmrQ==", + "license": "MIT" + }, + "node_modules/@types/docker-modem": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/@types/docker-modem/-/docker-modem-3.0.6.tgz", + "integrity": "sha512-yKpAGEuKRSS8wwx0joknWxsmLha78wNMe9R2S3UNsVOkZded8UqOrV8KoeDXoXsjndxwyF3eIhyClGbO1SEhEg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "*", + "@types/ssh2": "*" + } + }, + "node_modules/@types/dockerode": { + "version": "3.3.47", + "resolved": "https://registry.npmjs.org/@types/dockerode/-/dockerode-3.3.47.tgz", + "integrity": "sha512-ShM1mz7rCjdssXt7Xz0u1/R2BJC7piWa3SJpUBiVjCf2A3XNn4cP6pUVaD8bLanpPVVn4IKzJuw3dOvkJ8IbYw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/docker-modem": "*", + "@types/node": "*", + "@types/ssh2": "*" + } + }, + "node_modules/@types/escape-html": { + "version": "0.0.20", + "resolved": "https://registry.npmjs.org/@types/escape-html/-/escape-html-0.0.20.tgz", + "integrity": "sha512-6dhZJLbA7aOwkYB2GDGdIqJ20wmHnkDzaxV9PJXe7O02I2dSFTERzRB6JrX6cWKaS+VqhhY7cQUMCbO5kloFUw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/eslint": { + "version": "9.6.1", + "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-9.6.1.tgz", + "integrity": "sha512-FXx2pKgId/WyYo2jXw63kk7/+TY7u7AziEJxJAnSFzHlqTAS3Ync6SvgYAN/k4/PQpnnVuzoMuVnByKK2qp0ag==", + "license": "MIT", + "dependencies": { + "@types/estree": "*", + "@types/json-schema": "*" + } + }, + "node_modules/@types/eslint-scope": { + "version": "3.7.7", + "resolved": "https://registry.npmjs.org/@types/eslint-scope/-/eslint-scope-3.7.7.tgz", + "integrity": "sha512-MzMFlSLBqNF2gcHWO0G1vP/YQyfvrxZ0bF+u7mzUdZ1/xK4A4sru+nraZz5i3iEIk1l1uyicaDVTB4QbbEkAYg==", + "license": "MIT", + "dependencies": { + "@types/eslint": "*", + "@types/estree": "*" + } + }, + "node_modules/@types/estree": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.8.tgz", + "integrity": "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==", + "license": "MIT" + }, + "node_modules/@types/express": { + "version": "4.17.25", + "resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.25.tgz", + "integrity": "sha512-dVd04UKsfpINUnK0yBoYHDF3xu7xVH4BuDotC/xGuycx4CgbP48X/KF/586bcObxT0HENHXEU8Nqtu6NR+eKhw==", + "license": "MIT", + "dependencies": { + "@types/body-parser": "*", + "@types/express-serve-static-core": "^4.17.33", + "@types/qs": "*", + "@types/serve-static": "^1" + } + }, + "node_modules/@types/express-http-proxy": { + "version": "1.6.7", + "resolved": "https://registry.npmjs.org/@types/express-http-proxy/-/express-http-proxy-1.6.7.tgz", + "integrity": "sha512-CEp9pbnwVI1RzN9PXc+KESMxwUW5r1O7tkWb5h7Wg/YAIf+KulD/zKev8fbbn+Ljt0Yvs8MXwV2W6Id+cKxe2Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/express": "*" + } + }, + "node_modules/@types/express-serve-static-core": { + "version": "4.19.8", + "resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.19.8.tgz", + "integrity": "sha512-02S5fmqeoKzVZCHPZid4b8JH2eM5HzQLZWN2FohQEy/0eXTq8VXZfSN6Pcr3F6N9R/vNrj7cpgbhjie6m/1tCA==", + "license": "MIT", + "dependencies": { + "@types/node": "*", + "@types/qs": "*", + "@types/range-parser": "*", + "@types/send": "*" + } + }, + "node_modules/@types/fs-extra": { + "version": "4.0.15", + "resolved": "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-4.0.15.tgz", + "integrity": "sha512-zU/EU2kZ1tv+p4pswQLntA7dFQq84wXrSCfmLjZvMbLjf4N46cPOWHg+WKfc27YnEOQ0chVFlBui55HRsvzHPA==", + "license": "MIT", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/glob": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/@types/glob/-/glob-8.1.0.tgz", + "integrity": "sha512-IO+MJPVhoqz+28h1qLAcBEH2+xHMK6MTyHJc7MTnnYb6wsoLR29POVGJ7LycmVXIqyy/4/2ShP5sUwTXuOwb/w==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/minimatch": "^5.1.2", + "@types/node": "*" + } + }, + "node_modules/@types/glob/node_modules/@types/minimatch": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-5.1.2.tgz", + "integrity": "sha512-K0VQKziLUWkVKiRVrx4a40iPaxTUefQmjtkQofBkYRcoaaL/8rhwDWww9qWbrgicNOgnpIsMxyNIUM4+n6dUIA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/hast": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/@types/hast/-/hast-3.0.4.tgz", + "integrity": "sha512-WPs+bbQw5aCj+x6laNGWLH3wviHtoCv/P3+otBhbOhJgG8qtpdAMlTCxLtsTWA7LH1Oh/bFCHsBn0TPS5m30EQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/unist": "*" + } + }, + "node_modules/@types/highlight.js": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/@types/highlight.js/-/highlight.js-10.1.0.tgz", + "integrity": "sha512-77hF2dGBsOgnvZll1vymYiNUtqJ8cJfXPD6GG/2M0aLRc29PkvB7Au6sIDjIEFcSICBhCh2+Pyq6WSRS7LUm6A==", + "deprecated": "This is a stub types definition. highlight.js provides its own type definitions, so you do not need this installed.", + "license": "MIT", + "dependencies": { + "highlight.js": "*" + } + }, + "node_modules/@types/http-cache-semantics": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/@types/http-cache-semantics/-/http-cache-semantics-4.2.0.tgz", + "integrity": "sha512-L3LgimLHXtGkWikKnsPg0/VFx9OGZaC+eN1u4r+OB1XRqH3meBIAVC2zr1WdMH+RHmnRkqliQAOHNJ/E0j/e0Q==", + "license": "MIT" + }, + "node_modules/@types/http-errors": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@types/http-errors/-/http-errors-2.0.5.tgz", + "integrity": "sha512-r8Tayk8HJnX0FztbZN7oVqGccWgw98T/0neJphO91KkmOzug1KkofZURD4UaD5uH8AqcFLfdPErnBod0u71/qg==", + "license": "MIT" + }, + "node_modules/@types/js-yaml": { + "version": "4.0.9", + "resolved": "https://registry.npmjs.org/@types/js-yaml/-/js-yaml-4.0.9.tgz", + "integrity": "sha512-k4MGaQl5TGo/iipqb2UDG2UwjXziSWkh0uysQelTlJpX1qGlpUZYm8PnO4DxG1qBomtJUdYJ6qR6xdIah10JLg==", + "license": "MIT" + }, + "node_modules/@types/jsdom": { + "version": "21.1.7", + "resolved": "https://registry.npmjs.org/@types/jsdom/-/jsdom-21.1.7.tgz", + "integrity": "sha512-yOriVnggzrnQ3a9OKOCxaVuSug3w3/SbOj5i7VwXWZEyUNl3bLF9V3MfxGbZKuwqJOQyRfqXyROBB1CoZLFWzA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "*", + "@types/tough-cookie": "*", + "parse5": "^7.0.0" + } + }, + "node_modules/@types/json-schema": { + "version": "7.0.15", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", + "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==", + "license": "MIT" + }, + "node_modules/@types/json5": { + "version": "0.0.29", + "resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz", + "integrity": "sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/keyv": { + "version": "3.1.4", + "resolved": "https://registry.npmjs.org/@types/keyv/-/keyv-3.1.4.tgz", + "integrity": "sha512-BQ5aZNSCpj7D6K2ksrRCTmKRLEpnPvWDiLPfoGyhZ++8YtiK9d/3DBKPJgry359X/P1PfruyYwvnvwFjuEiEIg==", + "license": "MIT", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/linkify-it": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@types/linkify-it/-/linkify-it-5.0.0.tgz", + "integrity": "sha512-sVDA58zAw4eWAffKOaQH5/5j3XeayukzDk+ewSsnv3p4yJEZHCCzMDiZM8e0OUrRvmpGZ85jf4yDHkHsgBNr9Q==", + "license": "MIT" + }, + "node_modules/@types/lodash": { + "version": "4.17.23", + "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.17.23.tgz", + "integrity": "sha512-RDvF6wTulMPjrNdCoYRC8gNR880JNGT8uB+REUpC2Ns4pRqQJhGz90wh7rgdXDPpCczF3VGktDuFGVnz8zP7HA==", + "license": "MIT" + }, + "node_modules/@types/lodash.clonedeep": { + "version": "4.5.9", + "resolved": "https://registry.npmjs.org/@types/lodash.clonedeep/-/lodash.clonedeep-4.5.9.tgz", + "integrity": "sha512-19429mWC+FyaAhOLzsS8kZUsI+/GmBAQ0HFiCPsKGU+7pBXOQWhyrY6xNNDwUSX8SMZMJvuFVMF9O5dQOlQK9Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/lodash": "*" + } + }, + "node_modules/@types/lodash.debounce": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/@types/lodash.debounce/-/lodash.debounce-4.0.3.tgz", + "integrity": "sha512-/2RpcexzkSH16nENwuL/Gd3Y2xvdkNwX32KPESB/D8K2c6HBs7GdSnoj6ngyFWNT1UhXNrIpJd0lgSC3Rmt/3g==", + "license": "MIT", + "dependencies": { + "@types/lodash": "*" + } + }, + "node_modules/@types/lodash.throttle": { + "version": "4.1.9", + "resolved": "https://registry.npmjs.org/@types/lodash.throttle/-/lodash.throttle-4.1.9.tgz", + "integrity": "sha512-PCPVfpfueguWZQB7pJQK890F2scYKoDUL3iM522AptHWn7d5NQmeS/LTEHIcLr5PaTzl3dK2Z0xSUHHTHwaL5g==", + "license": "MIT", + "dependencies": { + "@types/lodash": "*" + } + }, + "node_modules/@types/long": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@types/long/-/long-4.0.2.tgz", + "integrity": "sha512-MqTGEo5bj5t157U6fA/BiDynNkn0YknVdh48CMPkTSpFTVmvao5UQmm7uEF6xBEo7qIMAlY/JSleYaE6VOdpaA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/luxon": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/@types/luxon/-/luxon-2.4.0.tgz", + "integrity": "sha512-oCavjEjRXuR6URJEtQm0eBdfsBiEcGBZbq21of8iGkeKxU1+1xgKuFPClaBZl2KB8ZZBSWlgk61tH6Mf+nvZVw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/markdown-it": { + "version": "14.1.2", + "resolved": "https://registry.npmjs.org/@types/markdown-it/-/markdown-it-14.1.2.tgz", + "integrity": "sha512-promo4eFwuiW+TfGxhi+0x3czqTYJkG8qB17ZUJiVF10Xm7NLVRSLUsfRTU/6h1e24VvRnXCx+hG7li58lkzog==", + "license": "MIT", + "dependencies": { + "@types/linkify-it": "^5", + "@types/mdurl": "^2" + } + }, + "node_modules/@types/markdown-it-emoji": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@types/markdown-it-emoji/-/markdown-it-emoji-3.0.1.tgz", + "integrity": "sha512-cz1j8R35XivBqq9mwnsrP2fsz2yicLhB8+PDtuVkKOExwEdsVBNI+ROL3sbhtR5occRZ66vT0QnwFZCqdjf3pA==", + "license": "MIT", + "dependencies": { + "@types/markdown-it": "^14" + } + }, + "node_modules/@types/mdurl": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@types/mdurl/-/mdurl-2.0.0.tgz", + "integrity": "sha512-RGdgjQUZba5p6QEFAVx2OGb8rQDL/cPRG7GiedRzMcJ1tYnUANBncjbSB1NRGwbvjcPeikRABz2nshyPk1bhWg==", + "license": "MIT" + }, + "node_modules/@types/mime": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/@types/mime/-/mime-1.3.5.tgz", + "integrity": "sha512-/pyBZWSLD2n0dcHE3hq8s8ZvcETHtEuF+3E7XVt0Ig2nvsVQXdghHVcEkIWjy9A0wKfTn97a/PSDYohKIlnP/w==", + "license": "MIT" + }, + "node_modules/@types/mime-types": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/@types/mime-types/-/mime-types-2.1.4.tgz", + "integrity": "sha512-lfU4b34HOri+kAY5UheuFMWPDOI+OPceBSHZKp69gEyTL/mmJ4cnU6Y/rlme3UL3GyOn6Y42hyIEw0/q8sWx5w==", + "license": "MIT" + }, + "node_modules/@types/minimatch": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.5.tgz", + "integrity": "sha512-Klz949h02Gz2uZCMGwDUSDS1YBlTdDDgbWHi+81l29tQALUtvz4rAYi5uoVhE5Lagoq6DeqAUlbrHvW/mXDgdQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/minimist": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/@types/minimist/-/minimist-1.2.5.tgz", + "integrity": "sha512-hov8bUuiLiyFPGyFPE1lwWhmzYbirOXQNNo40+y3zow8aFVTeyn3VWL0VFFfdNddA8S4Vf0Tc062rzyNr7Paag==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/mocha": { + "version": "10.0.10", + "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-10.0.10.tgz", + "integrity": "sha512-xPyYSz1cMPnJQhl0CLMH68j3gprKZaTjG3s5Vi+fDgx+uhG9NOXwbVt52eFS8ECyXhyKcjDLCBEqBExKuiZb7Q==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/ms": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@types/ms/-/ms-2.1.0.tgz", + "integrity": "sha512-GsCCIZDE/p3i96vtEqx+7dBUGXrc7zeSK3wwPHIaRThS+9OhWIXRqzs4d6k1SVU8g91DrNRWxWUGhp5KXQb2VA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/multer": { + "version": "1.4.13", + "resolved": "https://registry.npmjs.org/@types/multer/-/multer-1.4.13.tgz", + "integrity": "sha512-bhhdtPw7JqCiEfC9Jimx5LqX9BDIPJEh2q/fQ4bqbBPtyEZYr3cvF22NwG0DmPZNYA0CAf2CnqDB4KIGGpJcaw==", + "license": "MIT", + "dependencies": { + "@types/express": "*" + } + }, + "node_modules/@types/mustache": { + "version": "4.2.6", + "resolved": "https://registry.npmjs.org/@types/mustache/-/mustache-4.2.6.tgz", + "integrity": "sha512-t+8/QWTAhOFlrF1IVZqKnMRJi84EgkIK5Kh0p2JV4OLywUvCwJPFxbJAl7XAow7DVIHsF+xW9f1MVzg0L6Szjw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/node": { + "version": "20.19.33", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.19.33.tgz", + "integrity": "sha512-Rs1bVAIdBs5gbTIKza/tgpMuG1k3U/UMJLWecIMxNdJFDMzcM5LOiLVRYh3PilWEYDIeUDv7bpiHPLPsbydGcw==", + "license": "MIT", + "dependencies": { + "undici-types": "~6.21.0" + } + }, + "node_modules/@types/node-fetch": { + "version": "2.6.13", + "resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.6.13.tgz", + "integrity": "sha512-QGpRVpzSaUs30JBSGPjOg4Uveu384erbHBoT1zeONvyCfwQxIkUshLAOqN/k9EjGviPRmWTTe6aH2qySWKTVSw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "*", + "form-data": "^4.0.4" + } + }, + "node_modules/@types/normalize-package-data": { + "version": "2.4.4", + "resolved": "https://registry.npmjs.org/@types/normalize-package-data/-/normalize-package-data-2.4.4.tgz", + "integrity": "sha512-37i+OaWTh9qeK4LSHPsyRC7NahnGotNuZvjLSgcPzblpHB3rrCJxAOgI5gCdKm7coonsaX1Of0ILiTcnZjbfxA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/plist": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/@types/plist/-/plist-3.0.5.tgz", + "integrity": "sha512-E6OCaRmAe4WDmWNsL/9RMqdkkzDCY1etutkflWk4c+AcjDU07Pcz1fQwTX0TQz+Pxqn9i4L1TU3UFpjnrcDgxA==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "@types/node": "*", + "xmlbuilder": ">=11.0.1" + } + }, + "node_modules/@types/prop-types": { + "version": "15.7.15", + "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.15.tgz", + "integrity": "sha512-F6bEyamV9jKGAFBEmlQnesRPGOQqS2+Uwi0Em15xenOxHaf2hv6L8YCVn3rPdPJOiJfPiCnLIRyvwVaqMY3MIw==", + "license": "MIT" + }, + "node_modules/@types/proxy-from-env": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@types/proxy-from-env/-/proxy-from-env-1.0.4.tgz", + "integrity": "sha512-TPR9/bCZAr3V1eHN4G3LD3OLicdJjqX1QRXWuNcCYgE66f/K8jO2ZRtHxI2D9MbnuUP6+qiKSS8eUHp6TFHGCw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/qs": { + "version": "6.14.0", + "resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.14.0.tgz", + "integrity": "sha512-eOunJqu0K1923aExK6y8p6fsihYEn/BYuQ4g0CxAAgFc4b/ZLN4CrsRZ55srTdqoiLzU2B2evC+apEIxprEzkQ==", + "license": "MIT" + }, + "node_modules/@types/range-parser": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/@types/range-parser/-/range-parser-1.2.7.tgz", + "integrity": "sha512-hKormJbkJqzQGhziax5PItDUTMAM9uE2XXQmM37dyd4hVM+5aVl7oVxMVUiVQn2oCQFN/LKCZdvSM0pFRqbSmQ==", + "license": "MIT" + }, + "node_modules/@types/react": { + "version": "18.3.28", + "resolved": "https://registry.npmjs.org/@types/react/-/react-18.3.28.tgz", + "integrity": "sha512-z9VXpC7MWrhfWipitjNdgCauoMLRdIILQsAEV+ZesIzBq/oUlxk0m3ApZuMFCXdnS4U7KrI+l3WRUEGQ8K1QKw==", + "license": "MIT", + "dependencies": { + "@types/prop-types": "*", + "csstype": "^3.2.2" + } + }, + "node_modules/@types/react-dom": { + "version": "18.3.7", + "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-18.3.7.tgz", + "integrity": "sha512-MEe3UeoENYVFXzoXEWsvcpg6ZvlrFNlOQ7EOsvhI3CfAXwzPfO8Qwuxd40nepsYKqyyVQnTdEfv68q91yLcKrQ==", + "license": "MIT", + "peerDependencies": { + "@types/react": "^18.0.0" + } + }, + "node_modules/@types/readdir-glob": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/@types/readdir-glob/-/readdir-glob-1.1.5.tgz", + "integrity": "sha512-raiuEPUYqXu+nvtY2Pe8s8FEmZ3x5yAH4VkLdihcPdalvsHltomrRC9BzuStrJ9yk06470hS0Crw0f1pXqD+Hg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/responselike": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@types/responselike/-/responselike-1.0.3.tgz", + "integrity": "sha512-H/+L+UkTV33uf49PH5pCAUBVPNj2nDBXTN+qS1dOwyyg24l3CcicicCA7ca+HMvJBZcFgl5r8e+RR6elsb4Lyw==", + "license": "MIT", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/route-parser": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/@types/route-parser/-/route-parser-0.1.7.tgz", + "integrity": "sha512-haO+3HVio/4w+yuMJTjqfSo0ivOV8WnXaOReVD6QN729UGBEyizWNGc2Jd0OLsJDucIod4aJSsPLBeLj2uzMCQ==", + "license": "MIT" + }, + "node_modules/@types/safer-buffer": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/@types/safer-buffer/-/safer-buffer-2.1.3.tgz", + "integrity": "sha512-5o3RcpBa7mUFnnnoMa9UIGOf9naD4DCKKMYzqkm9OSY7NNTd26k7adNC+fphcVRI9BUJglBs2yJQiRZYqBF/8w==", + "license": "MIT", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/semver": { + "version": "7.7.1", + "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.7.1.tgz", + "integrity": "sha512-FmgJfu+MOcQ370SD0ev7EI8TlCAfKYU+B4m5T3yXc1CiRN94g/SZPtsCkk506aUDtlMnFZvasDwHHUcZUEaYuA==", + "license": "MIT" + }, + "node_modules/@types/send": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@types/send/-/send-1.2.1.tgz", + "integrity": "sha512-arsCikDvlU99zl1g69TcAB3mzZPpxgw0UQnaHeC1Nwb015xp8bknZv5rIfri9xTOcMuaVgvabfIRA7PSZVuZIQ==", + "license": "MIT", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/serve-static": { + "version": "1.15.10", + "resolved": "https://registry.npmjs.org/@types/serve-static/-/serve-static-1.15.10.tgz", + "integrity": "sha512-tRs1dB+g8Itk72rlSI2ZrW6vZg0YrLI81iQSTkMmOqnqCaNr/8Ek4VwWcN5vZgCYWbg/JJSGBlUaYGAOP73qBw==", + "license": "MIT", + "dependencies": { + "@types/http-errors": "*", + "@types/node": "*", + "@types/send": "<1" + } + }, + "node_modules/@types/serve-static/node_modules/@types/send": { + "version": "0.17.6", + "resolved": "https://registry.npmjs.org/@types/send/-/send-0.17.6.tgz", + "integrity": "sha512-Uqt8rPBE8SY0RK8JB1EzVOIZ32uqy8HwdxCnoCOsYrvnswqmFZ/k+9Ikidlk/ImhsdvBsloHbAlewb2IEBV/Og==", + "license": "MIT", + "dependencies": { + "@types/mime": "^1", + "@types/node": "*" + } + }, + "node_modules/@types/sinon": { + "version": "10.0.20", + "resolved": "https://registry.npmjs.org/@types/sinon/-/sinon-10.0.20.tgz", + "integrity": "sha512-2APKKruFNCAZgx3daAyACGzWuJ028VVCUDk6o2rw/Z4PXT0ogwdV4KUegW0MwVs0Zu59auPXbbuBJHF12Sx1Eg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/sinonjs__fake-timers": "*" + } + }, + "node_modules/@types/sinonjs__fake-timers": { + "version": "15.0.1", + "resolved": "https://registry.npmjs.org/@types/sinonjs__fake-timers/-/sinonjs__fake-timers-15.0.1.tgz", + "integrity": "sha512-Ko2tjWJq8oozHzHV+reuvS5KYIRAokHnGbDwGh/J64LntgpbuylF74ipEL24HCyRjf9FOlBiBHWBR1RlVKsI1w==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/ssh2": { + "version": "1.15.5", + "resolved": "https://registry.npmjs.org/@types/ssh2/-/ssh2-1.15.5.tgz", + "integrity": "sha512-N1ASjp/nXH3ovBHddRJpli4ozpk6UdDYIX4RJWFa9L1YKnzdhTlVmiGHm4DZnj/jLbqZpes4aeR30EFGQtvhQQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "^18.11.18" + } + }, + "node_modules/@types/ssh2-sftp-client": { + "version": "9.0.6", + "resolved": "https://registry.npmjs.org/@types/ssh2-sftp-client/-/ssh2-sftp-client-9.0.6.tgz", + "integrity": "sha512-4+KvXO/V77y9VjI2op2T8+RCGI/GXQAwR0q5Qkj/EJ5YSeyKszqZP6F8i3H3txYoBqjc7sgorqyvBP3+w1EHyg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/ssh2": "^1.0.0" + } + }, + "node_modules/@types/ssh2/node_modules/@types/node": { + "version": "18.19.130", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.19.130.tgz", + "integrity": "sha512-GRaXQx6jGfL8sKfaIDD6OupbIHBr9jv7Jnaml9tB7l4v068PAOXqfcujMMo5PhbIs6ggR1XODELqahT2R8v0fg==", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": "~5.26.4" + } + }, + "node_modules/@types/ssh2/node_modules/undici-types": { + "version": "5.26.5", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", + "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/tar-fs": { + "version": "1.16.3", + "resolved": "https://registry.npmjs.org/@types/tar-fs/-/tar-fs-1.16.3.tgz", + "integrity": "sha512-Y+fdeg11tb9J3UNIatNtrTPM1i8U+WLv2mMhZ3W13mtU19stCgrXJ4iXLkTpoF8jqHi3T/qTS8+fQ3IPzXxpuA==", + "license": "MIT", + "dependencies": { + "@types/node": "*", + "@types/tar-stream": "*" + } + }, + "node_modules/@types/tar-stream": { + "version": "3.1.4", + "resolved": "https://registry.npmjs.org/@types/tar-stream/-/tar-stream-3.1.4.tgz", + "integrity": "sha512-921gW0+g29mCJX0fRvqeHzBlE/XclDaAG0Ousy1LCghsOhvaKacDeRGEVzQP9IPfKn8Vysy7FEXAIxycpc/CMg==", + "license": "MIT", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/temp": { + "version": "0.9.4", + "resolved": "https://registry.npmjs.org/@types/temp/-/temp-0.9.4.tgz", + "integrity": "sha512-+VfWIwrlept2VBTj7Y2wQnI/Xfscy1u8Pyj/puYwss6V1IblXn1x7S0S9eFh6KyBolgLCm+rUFzhFAbdkR691g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/tough-cookie": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/@types/tough-cookie/-/tough-cookie-4.0.5.tgz", + "integrity": "sha512-/Ad8+nIOV7Rl++6f1BdKxFSMgmoqEoYbHRpPcx3JEfv8VRsQe9Z4mCXeJBzxs7mbHY/XOZZuXlRNfhpVPbs6ZA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/trusted-types": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/@types/trusted-types/-/trusted-types-2.0.7.tgz", + "integrity": "sha512-ScaPdn1dQczgbl0QFTeTOmVHFULt394XJgOQNoyVhZ6r2vLnMLJfBPd53SB52T/3G36VI1/g2MZaX0cwDuXsfw==", + "license": "MIT", + "optional": true + }, + "node_modules/@types/unist": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@types/unist/-/unist-3.0.3.tgz", + "integrity": "sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/unzipper": { + "version": "0.9.2", + "resolved": "https://registry.npmjs.org/@types/unzipper/-/unzipper-0.9.2.tgz", + "integrity": "sha512-9K8sLpn1dxIzbXMDgUerkyO1z0deg5RqN/F6df8waAM94aPnS7x7V0l12kkUYoUlM8r4xWgvlcXLdWQvt6KdUA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/uuid": { + "version": "9.0.8", + "resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-9.0.8.tgz", + "integrity": "sha512-jg+97EGIcY9AGHJJRaaPVgetKDsrTgbRjQ5Msgjh/DQKEFl0DtyRr/VCOyD1T2R1MNeWPK/u7JoGhlDZnKBAfA==", + "license": "MIT" + }, + "node_modules/@types/verror": { + "version": "1.10.11", + "resolved": "https://registry.npmjs.org/@types/verror/-/verror-1.10.11.tgz", + "integrity": "sha512-RlDm9K7+o5stv0Co8i8ZRGxDbrTxhJtgjqjFyVh/tXQyl/rYtTKlnTvZ88oSTeYREWurwx20Js4kTuKCsFkUtg==", + "dev": true, + "license": "MIT", + "optional": true + }, + "node_modules/@types/vscode": { + "version": "1.109.0", + "resolved": "https://registry.npmjs.org/@types/vscode/-/vscode-1.109.0.tgz", + "integrity": "sha512-0Pf95rnwEIwDbmXGC08r0B4TQhAbsHQ5UyTIgVgoieDe4cOnf92usuR5dEczb6bTKEp7ziZH4TV1TRGPPCExtw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/vscode-notebook-renderer": { + "version": "1.72.4", + "resolved": "https://registry.npmjs.org/@types/vscode-notebook-renderer/-/vscode-notebook-renderer-1.72.4.tgz", + "integrity": "sha512-bdKO41c6Dc24pH/O/eM/jqfCwGH4zc76o/g/6Gt1y/eg/bvvqP2/VpbV+Sa5Te2sZekFRcbYnSSFTKo3wcVGUg==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/which": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/@types/which/-/which-1.3.2.tgz", + "integrity": "sha512-8oDqyLC7eD4HM307boe2QWKyuzdzWBj56xI/imSl2cpL+U3tCMaTAkMJ4ee5JBZ/FsOJlvRGeIShiZDAl1qERA==", + "license": "MIT" + }, + "node_modules/@types/write-json-file": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/@types/write-json-file/-/write-json-file-2.2.1.tgz", + "integrity": "sha512-JdO/UpPm9RrtQBNVcZdt3M7j3mHO/kXaea9LBGx3UgWJd1f9BkIWP7jObLBG6ZtRyqp7KzLFEsaPhWcidVittA==", + "license": "MIT" + }, + "node_modules/@types/ws": { + "version": "8.18.1", + "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.18.1.tgz", + "integrity": "sha512-ThVF6DCVhA8kUGy+aazFQ4kXQ7E1Ty7A3ypFOe0IcJV8O/M511G99AW24irKrW56Wt44yG9+ij8FaqoBGkuBXg==", + "license": "MIT", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/yargs": { + "version": "15.0.20", + "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-15.0.20.tgz", + "integrity": "sha512-KIkX+/GgfFitlASYCGoSF+T4XRXhOubJLhkLVtSfsRTe9jWMmuM2g28zQ41BtPTG7TRBb2xHW+LCNVE9QR/vsg==", + "license": "MIT", + "dependencies": { + "@types/yargs-parser": "*" + } + }, + "node_modules/@types/yargs-parser": { + "version": "21.0.3", + "resolved": "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-21.0.3.tgz", + "integrity": "sha512-I4q9QU9MQv4oEOz4tAHJtNz1cwuLxn2F3xcc2iV5WdqLPpUnj30aUuxt1mAxYTG+oe8CZMV/+6rU4S4gRDzqtQ==", + "license": "MIT" + }, + "node_modules/@types/yauzl": { + "version": "2.10.3", + "resolved": "https://registry.npmjs.org/@types/yauzl/-/yauzl-2.10.3.tgz", + "integrity": "sha512-oJoftv0LSuaDZE3Le4DbKX+KS9G36NzOeSap90UIK0yMA/NhKJhqlSGtNDORNRaIbQfzjXDrQa0ytJ6mNRGz/Q==", + "license": "MIT", + "optional": true, + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@typescript-eslint/eslint-plugin": { + "version": "7.18.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-7.18.0.tgz", + "integrity": "sha512-94EQTWZ40mzBc42ATNIBimBEDltSJ9RQHCC8vc/PDbxi4k8dVwUAv4o98dk50M1zB+JGFxp43FP7f8+FP8R6Sw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@eslint-community/regexpp": "^4.10.0", + "@typescript-eslint/scope-manager": "7.18.0", + "@typescript-eslint/type-utils": "7.18.0", + "@typescript-eslint/utils": "7.18.0", + "@typescript-eslint/visitor-keys": "7.18.0", + "graphemer": "^1.4.0", + "ignore": "^5.3.1", + "natural-compare": "^1.4.0", + "ts-api-utils": "^1.3.0" + }, + "engines": { + "node": "^18.18.0 || >=20.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "@typescript-eslint/parser": "^7.0.0", + "eslint": "^8.56.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/eslint-plugin-tslint": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin-tslint/-/eslint-plugin-tslint-7.0.2.tgz", + "integrity": "sha512-Os20XlgmnXPlfqcvO5I6asARarEXZ/BQ2WEHaphfN+d8CUq8H3lGM2ep3SGcwaF1PXpAxfNBDN8U4EYhliFfSQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/utils": "7.0.2" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.56.0", + "tslint": "^5.0.0 || ^6.0.0", + "typescript": "*" + } + }, + "node_modules/@typescript-eslint/eslint-plugin-tslint/node_modules/@typescript-eslint/scope-manager": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-7.0.2.tgz", + "integrity": "sha512-l6sa2jF3h+qgN2qUMjVR3uCNGjWw4ahGfzIYsCtFrQJCjhbrDPdiihYT8FnnqFwsWX+20hK592yX9I2rxKTP4g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/types": "7.0.2", + "@typescript-eslint/visitor-keys": "7.0.2" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/eslint-plugin-tslint/node_modules/@typescript-eslint/types": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-7.0.2.tgz", + "integrity": "sha512-ZzcCQHj4JaXFjdOql6adYV4B/oFOFjPOC9XYwCaZFRvqN8Llfvv4gSxrkQkd2u4Ci62i2c6W6gkDwQJDaRc4nA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/eslint-plugin-tslint/node_modules/@typescript-eslint/typescript-estree": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-7.0.2.tgz", + "integrity": "sha512-3AMc8khTcELFWcKcPc0xiLviEvvfzATpdPj/DXuOGIdQIIFybf4DMT1vKRbuAEOFMwhWt7NFLXRkbjsvKZQyvw==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "@typescript-eslint/types": "7.0.2", + "@typescript-eslint/visitor-keys": "7.0.2", + "debug": "^4.3.4", + "globby": "^11.1.0", + "is-glob": "^4.0.3", + "minimatch": "9.0.3", + "semver": "^7.5.4", + "ts-api-utils": "^1.0.1" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/eslint-plugin-tslint/node_modules/@typescript-eslint/utils": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-7.0.2.tgz", + "integrity": "sha512-PZPIONBIB/X684bhT1XlrkjNZJIEevwkKDsdwfiu1WeqBxYEEdIgVDgm8/bbKHVu+6YOpeRqcfImTdImx/4Bsw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@eslint-community/eslint-utils": "^4.4.0", + "@types/json-schema": "^7.0.12", + "@types/semver": "^7.5.0", + "@typescript-eslint/scope-manager": "7.0.2", + "@typescript-eslint/types": "7.0.2", + "@typescript-eslint/typescript-estree": "7.0.2", + "semver": "^7.5.4" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.56.0" + } + }, + "node_modules/@typescript-eslint/eslint-plugin-tslint/node_modules/@typescript-eslint/visitor-keys": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-7.0.2.tgz", + "integrity": "sha512-8Y+YiBmqPighbm5xA2k4wKTxRzx9EkBu7Rlw+WHqMvRJ3RPz/BMBO9b2ru0LUNmXg120PHUXD5+SWFy2R8DqlQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/types": "7.0.2", + "eslint-visitor-keys": "^3.4.1" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/eslint-plugin-tslint/node_modules/brace-expansion": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz", + "integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/@typescript-eslint/eslint-plugin-tslint/node_modules/minimatch": { + "version": "9.0.3", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz", + "integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/@typescript-eslint/parser": { + "version": "7.18.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-7.18.0.tgz", + "integrity": "sha512-4Z+L8I2OqhZV8qA132M4wNL30ypZGYOQVBfMgxDH/K5UX0PNqTu1c6za9ST5r9+tavvHiTWmBnKzpCJ/GlVFtg==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "@typescript-eslint/scope-manager": "7.18.0", + "@typescript-eslint/types": "7.18.0", + "@typescript-eslint/typescript-estree": "7.18.0", + "@typescript-eslint/visitor-keys": "7.18.0", + "debug": "^4.3.4" + }, + "engines": { + "node": "^18.18.0 || >=20.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.56.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/scope-manager": { + "version": "7.18.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-7.18.0.tgz", + "integrity": "sha512-jjhdIE/FPF2B7Z1uzc6i3oWKbGcHb87Qw7AWj6jmEqNOfDFbJWtjt/XfwCpvNkpGWlcJaog5vTR+VV8+w9JflA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/types": "7.18.0", + "@typescript-eslint/visitor-keys": "7.18.0" + }, + "engines": { + "node": "^18.18.0 || >=20.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/type-utils": { + "version": "7.18.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-7.18.0.tgz", + "integrity": "sha512-XL0FJXuCLaDuX2sYqZUUSOJ2sG5/i1AAze+axqmLnSkNEVMVYLF+cbwlB2w8D1tinFuSikHmFta+P+HOofrLeA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/typescript-estree": "7.18.0", + "@typescript-eslint/utils": "7.18.0", + "debug": "^4.3.4", + "ts-api-utils": "^1.3.0" + }, + "engines": { + "node": "^18.18.0 || >=20.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.56.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/types": { + "version": "7.18.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-7.18.0.tgz", + "integrity": "sha512-iZqi+Ds1y4EDYUtlOOC+aUmxnE9xS/yCigkjA7XpTKV6nCBd3Hp/PRGGmdwnfkV2ThMyYldP1wRpm/id99spTQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^18.18.0 || >=20.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/typescript-estree": { + "version": "7.18.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-7.18.0.tgz", + "integrity": "sha512-aP1v/BSPnnyhMHts8cf1qQ6Q1IFwwRvAQGRvBFkWlo3/lH29OXA3Pts+c10nxRxIBrDnoMqzhgdwVe5f2D6OzA==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "@typescript-eslint/types": "7.18.0", + "@typescript-eslint/visitor-keys": "7.18.0", + "debug": "^4.3.4", + "globby": "^11.1.0", + "is-glob": "^4.0.3", + "minimatch": "^9.0.4", + "semver": "^7.6.0", + "ts-api-utils": "^1.3.0" + }, + "engines": { + "node": "^18.18.0 || >=20.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/typescript-estree/node_modules/brace-expansion": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz", + "integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/@typescript-eslint/typescript-estree/node_modules/minimatch": { + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", + "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/@typescript-eslint/utils": { + "version": "7.18.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-7.18.0.tgz", + "integrity": "sha512-kK0/rNa2j74XuHVcoCZxdFBMF+aq/vH83CXAOHieC+2Gis4mF8jJXT5eAfyD3K0sAxtPuwxaIOIOvhwzVDt/kw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@eslint-community/eslint-utils": "^4.4.0", + "@typescript-eslint/scope-manager": "7.18.0", + "@typescript-eslint/types": "7.18.0", + "@typescript-eslint/typescript-estree": "7.18.0" + }, + "engines": { + "node": "^18.18.0 || >=20.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.56.0" + } + }, + "node_modules/@typescript-eslint/visitor-keys": { + "version": "7.18.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-7.18.0.tgz", + "integrity": "sha512-cDF0/Gf81QpY3xYyJKDV14Zwdmid5+uuENhjH2EqFaF0ni+yAyq/LzMaIJdhNJXZI7uLzwIlA+V7oWoyn6Curg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/types": "7.18.0", + "eslint-visitor-keys": "^3.4.3" + }, + "engines": { + "node": "^18.18.0 || >=20.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typespec/ts-http-runtime": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/@typespec/ts-http-runtime/-/ts-http-runtime-0.3.3.tgz", + "integrity": "sha512-91fp6CAAJSRtH5ja95T1FHSKa8aPW9/Zw6cta81jlZTUw/+Vq8jM/AfF/14h2b71wwR84JUTW/3Y8QPhDAawFA==", + "dev": true, + "license": "MIT", + "dependencies": { + "http-proxy-agent": "^7.0.0", + "https-proxy-agent": "^7.0.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=20.0.0" + } + }, + "node_modules/@typespec/ts-http-runtime/node_modules/http-proxy-agent": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-5.0.0.tgz", + "integrity": "sha512-n2hY8YdoRE1i7r6M0w9DIw5GgZN0G25P8zLCRQ8rjXtTU3vsNFBI/vWK/UIeE6g5MUUz6avwAPXmL6Fy9D/90w==", + "dev": true, + "license": "MIT", + "dependencies": { + "@tootallnate/once": "2", + "agent-base": "6", + "debug": "4" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/@typespec/ts-http-runtime/node_modules/https-proxy-agent": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz", + "integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==", + "dev": true, + "license": "MIT", + "dependencies": { + "agent-base": "6", + "debug": "4" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/@ungap/structured-clone": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.3.0.tgz", + "integrity": "sha512-WmoN8qaIAo7WTYWbAZuG8PYEhn5fkz7dZrqTBZ7dtt//lL2Gwms1IcnQ5yHqjDfX8Ft5j4YzDM23f87zBfDe9g==", + "dev": true, + "license": "ISC" + }, + "node_modules/@virtuoso.dev/react-urx": { + "version": "0.2.13", + "resolved": "https://registry.npmjs.org/@virtuoso.dev/react-urx/-/react-urx-0.2.13.tgz", + "integrity": "sha512-MY0ugBDjFb5Xt8v2HY7MKcRGqw/3gTpMlLXId2EwQvYJoC8sP7nnXjAxcBtTB50KTZhO0SbzsFimaZ7pSdApwA==", + "license": "MIT", + "dependencies": { + "@virtuoso.dev/urx": "^0.2.13" + }, + "engines": { + "node": ">=10" + }, + "peerDependencies": { + "react": ">=16" + } + }, + "node_modules/@virtuoso.dev/urx": { + "version": "0.2.13", + "resolved": "https://registry.npmjs.org/@virtuoso.dev/urx/-/urx-0.2.13.tgz", + "integrity": "sha512-iirJNv92A1ZWxoOHHDYW/1KPoi83939o83iUBQHIim0i3tMeSKEh+bxhJdTHQ86Mr4uXx9xGUTq69cp52ZP8Xw==", + "license": "MIT" + }, + "node_modules/@vscode/codicons": { + "version": "0.0.44", + "resolved": "https://registry.npmjs.org/@vscode/codicons/-/codicons-0.0.44.tgz", + "integrity": "sha512-F7qPRumUK3EHjNdopfICLGRf3iNPoZQt+McTHAn4AlOWPB3W2kL4H0S7uqEqbyZ6rCxaeDjpAn3MCUnwTu/VJQ==", + "license": "CC-BY-4.0" + }, + "node_modules/@vscode/debugprotocol": { + "version": "1.68.0", + "resolved": "https://registry.npmjs.org/@vscode/debugprotocol/-/debugprotocol-1.68.0.tgz", + "integrity": "sha512-2J27dysaXmvnfuhFGhfeuxfHRXunqNPxtBoR3koiTOA9rdxWNDTa1zIFLCFMSHJ9MPTPKFcBeblsyaCJCIlQxg==", + "license": "MIT" + }, + "node_modules/@vscode/proxy-agent": { + "version": "0.13.2", + "resolved": "https://registry.npmjs.org/@vscode/proxy-agent/-/proxy-agent-0.13.2.tgz", + "integrity": "sha512-BSUd0NTj44WvG4O9A6N+4R1XhxtPqCYltWeHyNkquX9T//a1US+cd8fxzcZCPd3z7dygdYIPkZAKM+CrefWWOA==", + "license": "MIT", + "dependencies": { + "@tootallnate/once": "^1.1.2", + "agent-base": "^6.0.2", + "debug": "^4.3.1", + "http-proxy-agent": "^4.0.1", + "https-proxy-agent": "^5.0.0", + "socks-proxy-agent": "^5.0.0" + }, + "optionalDependencies": { + "@vscode/windows-ca-certs": "^0.3.1" + } + }, + "node_modules/@vscode/proxy-agent/node_modules/@tootallnate/once": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-1.1.2.tgz", + "integrity": "sha512-RbzJvlNzmRq5c3O09UipeuXno4tA1FE6ikOjxZK0tuxVv3412l64l5t1W5pj4+rJq9vpkm/kwiR07aZXnsKPxw==", + "license": "MIT", + "engines": { + "node": ">= 6" + } + }, + "node_modules/@vscode/proxy-agent/node_modules/http-proxy-agent": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-4.0.1.tgz", + "integrity": "sha512-k0zdNgqWTGA6aeIRVpvfVob4fL52dTfaehylg0Y4UvSySvOq/Y+BOyPrgpUrA7HylqvU8vIZGsRuXmspskV0Tg==", + "license": "MIT", + "dependencies": { + "@tootallnate/once": "1", + "agent-base": "6", + "debug": "4" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/@vscode/proxy-agent/node_modules/https-proxy-agent": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz", + "integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==", + "license": "MIT", + "dependencies": { + "agent-base": "6", + "debug": "4" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/@vscode/proxy-agent/node_modules/socks-proxy-agent": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/socks-proxy-agent/-/socks-proxy-agent-5.0.1.tgz", + "integrity": "sha512-vZdmnjb9a2Tz6WEQVIurybSwElwPxMZaIc7PzqbJTrezcKNznv6giT7J7tZDZ1BojVaa1jvO/UiUdhDVB0ACoQ==", + "license": "MIT", + "dependencies": { + "agent-base": "^6.0.2", + "debug": "4", + "socks": "^2.3.3" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/@vscode/ripgrep": { + "version": "1.17.0", + "resolved": "https://registry.npmjs.org/@vscode/ripgrep/-/ripgrep-1.17.0.tgz", + "integrity": "sha512-mBRKm+ASPkUcw4o9aAgfbusIu6H4Sdhw09bjeP1YOBFTJEZAnrnk6WZwzv8NEjgC82f7ILvhmb1WIElSugea6g==", + "hasInstallScript": true, + "license": "MIT", + "dependencies": { + "https-proxy-agent": "^7.0.2", + "proxy-from-env": "^1.1.0", + "yauzl": "^2.9.2" + } + }, + "node_modules/@vscode/vsce": { + "version": "2.32.0", + "resolved": "https://registry.npmjs.org/@vscode/vsce/-/vsce-2.32.0.tgz", + "integrity": "sha512-3EFJfsgrSftIqt3EtdRcAygy/OJ3hstyI1cDmIgkU9CFZW5C+3djr6mfosndCUqcVYuyjmxOK1xmFp/Bq7+NIg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@azure/identity": "^4.1.0", + "@vscode/vsce-sign": "^2.0.0", + "azure-devops-node-api": "^12.5.0", + "chalk": "^2.4.2", + "cheerio": "^1.0.0-rc.9", + "cockatiel": "^3.1.2", + "commander": "^6.2.1", + "form-data": "^4.0.0", + "glob": "^7.0.6", + "hosted-git-info": "^4.0.2", + "jsonc-parser": "^3.2.0", + "leven": "^3.1.0", + "markdown-it": "^12.3.2", + "mime": "^1.3.4", + "minimatch": "^3.0.3", + "parse-semver": "^1.1.1", + "read": "^1.0.7", + "semver": "^7.5.2", + "tmp": "^0.2.1", + "typed-rest-client": "^1.8.4", + "url-join": "^4.0.1", + "xml2js": "^0.5.0", + "yauzl": "^2.3.1", + "yazl": "^2.2.2" + }, + "bin": { + "vsce": "vsce" + }, + "engines": { + "node": ">= 16" + }, + "optionalDependencies": { + "keytar": "^7.7.0" + } + }, + "node_modules/@vscode/vsce-sign": { + "version": "2.0.9", + "resolved": "https://registry.npmjs.org/@vscode/vsce-sign/-/vsce-sign-2.0.9.tgz", + "integrity": "sha512-8IvaRvtFyzUnGGl3f5+1Cnor3LqaUWvhaUjAYO8Y39OUYlOf3cRd+dowuQYLpZcP3uwSG+mURwjEBOSq4SOJ0g==", + "dev": true, + "hasInstallScript": true, + "license": "SEE LICENSE IN LICENSE.txt", + "optionalDependencies": { + "@vscode/vsce-sign-alpine-arm64": "2.0.6", + "@vscode/vsce-sign-alpine-x64": "2.0.6", + "@vscode/vsce-sign-darwin-arm64": "2.0.6", + "@vscode/vsce-sign-darwin-x64": "2.0.6", + "@vscode/vsce-sign-linux-arm": "2.0.6", + "@vscode/vsce-sign-linux-arm64": "2.0.6", + "@vscode/vsce-sign-linux-x64": "2.0.6", + "@vscode/vsce-sign-win32-arm64": "2.0.6", + "@vscode/vsce-sign-win32-x64": "2.0.6" + } + }, + "node_modules/@vscode/vsce-sign-alpine-arm64": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/@vscode/vsce-sign-alpine-arm64/-/vsce-sign-alpine-arm64-2.0.6.tgz", + "integrity": "sha512-wKkJBsvKF+f0GfsUuGT0tSW0kZL87QggEiqNqK6/8hvqsXvpx8OsTEc3mnE1kejkh5r+qUyQ7PtF8jZYN0mo8Q==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "SEE LICENSE IN LICENSE.txt", + "optional": true, + "os": [ + "alpine" + ] + }, + "node_modules/@vscode/vsce-sign-alpine-x64": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/@vscode/vsce-sign-alpine-x64/-/vsce-sign-alpine-x64-2.0.6.tgz", + "integrity": "sha512-YoAGlmdK39vKi9jA18i4ufBbd95OqGJxRvF3n6ZbCyziwy3O+JgOpIUPxv5tjeO6gQfx29qBivQ8ZZTUF2Ba0w==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "SEE LICENSE IN LICENSE.txt", + "optional": true, + "os": [ + "alpine" + ] + }, + "node_modules/@vscode/vsce-sign-darwin-arm64": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/@vscode/vsce-sign-darwin-arm64/-/vsce-sign-darwin-arm64-2.0.6.tgz", + "integrity": "sha512-5HMHaJRIQuozm/XQIiJiA0W9uhdblwwl2ZNDSSAeXGO9YhB9MH5C4KIHOmvyjUnKy4UCuiP43VKpIxW1VWP4tQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "SEE LICENSE IN LICENSE.txt", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@vscode/vsce-sign-darwin-x64": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/@vscode/vsce-sign-darwin-x64/-/vsce-sign-darwin-x64-2.0.6.tgz", + "integrity": "sha512-25GsUbTAiNfHSuRItoQafXOIpxlYj+IXb4/qarrXu7kmbH94jlm5sdWSCKrrREs8+GsXF1b+l3OB7VJy5jsykw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "SEE LICENSE IN LICENSE.txt", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@vscode/vsce-sign-linux-arm": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/@vscode/vsce-sign-linux-arm/-/vsce-sign-linux-arm-2.0.6.tgz", + "integrity": "sha512-UndEc2Xlq4HsuMPnwu7420uqceXjs4yb5W8E2/UkaHBB9OWCwMd3/bRe/1eLe3D8kPpxzcaeTyXiK3RdzS/1CA==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "SEE LICENSE IN LICENSE.txt", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@vscode/vsce-sign-linux-arm64": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/@vscode/vsce-sign-linux-arm64/-/vsce-sign-linux-arm64-2.0.6.tgz", + "integrity": "sha512-cfb1qK7lygtMa4NUl2582nP7aliLYuDEVpAbXJMkDq1qE+olIw/es+C8j1LJwvcRq1I2yWGtSn3EkDp9Dq5FdA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "SEE LICENSE IN LICENSE.txt", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@vscode/vsce-sign-linux-x64": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/@vscode/vsce-sign-linux-x64/-/vsce-sign-linux-x64-2.0.6.tgz", + "integrity": "sha512-/olerl1A4sOqdP+hjvJ1sbQjKN07Y3DVnxO4gnbn/ahtQvFrdhUi0G1VsZXDNjfqmXw57DmPi5ASnj/8PGZhAA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "SEE LICENSE IN LICENSE.txt", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@vscode/vsce-sign-win32-arm64": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/@vscode/vsce-sign-win32-arm64/-/vsce-sign-win32-arm64-2.0.6.tgz", + "integrity": "sha512-ivM/MiGIY0PJNZBoGtlRBM/xDpwbdlCWomUWuLmIxbi1Cxe/1nooYrEQoaHD8ojVRgzdQEUzMsRbyF5cJJgYOg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "SEE LICENSE IN LICENSE.txt", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@vscode/vsce-sign-win32-x64": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/@vscode/vsce-sign-win32-x64/-/vsce-sign-win32-x64-2.0.6.tgz", + "integrity": "sha512-mgth9Kvze+u8CruYMmhHw6Zgy3GRX2S+Ed5oSokDEK5vPEwGGKnmuXua9tmFhomeAnhgJnL4DCna3TiNuGrBTQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "SEE LICENSE IN LICENSE.txt", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@vscode/vsce/node_modules/ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "license": "MIT", + "dependencies": { + "color-convert": "^1.9.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@vscode/vsce/node_modules/chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@vscode/vsce/node_modules/color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "license": "MIT", + "dependencies": { + "color-name": "1.1.3" + } + }, + "node_modules/@vscode/vsce/node_modules/color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@vscode/vsce/node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/@vscode/vsce/node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/@vscode/vsce/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/@vscode/vsce/node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@vscode/windows-ca-certs": { + "version": "0.3.4", + "resolved": "https://registry.npmjs.org/@vscode/windows-ca-certs/-/windows-ca-certs-0.3.4.tgz", + "integrity": "sha512-DcDLjBpu8srh6wUiZqEMyhXHzNDO81ecZOttL3+1u3Iht4CS6Qtxy5WkTPX/aDgbheASO/MK8yg6uLq58RzEWg==", + "hasInstallScript": true, + "license": "BSD", + "optional": true, + "os": [ + "win32" + ], + "dependencies": { + "node-addon-api": "^8.2.0" + } + }, + "node_modules/@vscode/windows-ca-certs/node_modules/node-addon-api": { + "version": "8.5.0", + "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-8.5.0.tgz", + "integrity": "sha512-/bRZty2mXUIFY/xU5HLvveNHlswNJej+RnxBjOMkidWfwZzgTbPG1E3K5TOxRLOR+5hX7bSofy8yf1hZevMS8A==", + "license": "MIT", + "optional": true, + "engines": { + "node": "^18 || ^20 || >= 21" + } + }, + "node_modules/@webassemblyjs/ast": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.14.1.tgz", + "integrity": "sha512-nuBEDgQfm1ccRp/8bCQrx1frohyufl4JlbMMZ4P1wpeOfDhF6FQkxZJ1b/e+PLwr6X1Nhw6OLme5usuBWYBvuQ==", + "license": "MIT", + "dependencies": { + "@webassemblyjs/helper-numbers": "1.13.2", + "@webassemblyjs/helper-wasm-bytecode": "1.13.2" + } + }, + "node_modules/@webassemblyjs/floating-point-hex-parser": { + "version": "1.13.2", + "resolved": "https://registry.npmjs.org/@webassemblyjs/floating-point-hex-parser/-/floating-point-hex-parser-1.13.2.tgz", + "integrity": "sha512-6oXyTOzbKxGH4steLbLNOu71Oj+C8Lg34n6CqRvqfS2O71BxY6ByfMDRhBytzknj9yGUPVJ1qIKhRlAwO1AovA==", + "license": "MIT" + }, + "node_modules/@webassemblyjs/helper-api-error": { + "version": "1.13.2", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-api-error/-/helper-api-error-1.13.2.tgz", + "integrity": "sha512-U56GMYxy4ZQCbDZd6JuvvNV/WFildOjsaWD3Tzzvmw/mas3cXzRJPMjP83JqEsgSbyrmaGjBfDtV7KDXV9UzFQ==", + "license": "MIT" + }, + "node_modules/@webassemblyjs/helper-buffer": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-buffer/-/helper-buffer-1.14.1.tgz", + "integrity": "sha512-jyH7wtcHiKssDtFPRB+iQdxlDf96m0E39yb0k5uJVhFGleZFoNw1c4aeIcVUPPbXUVJ94wwnMOAqUHyzoEPVMA==", + "license": "MIT" + }, + "node_modules/@webassemblyjs/helper-numbers": { + "version": "1.13.2", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-numbers/-/helper-numbers-1.13.2.tgz", + "integrity": "sha512-FE8aCmS5Q6eQYcV3gI35O4J789wlQA+7JrqTTpJqn5emA4U2hvwJmvFRC0HODS+3Ye6WioDklgd6scJ3+PLnEA==", + "license": "MIT", + "dependencies": { + "@webassemblyjs/floating-point-hex-parser": "1.13.2", + "@webassemblyjs/helper-api-error": "1.13.2", + "@xtuc/long": "4.2.2" + } + }, + "node_modules/@webassemblyjs/helper-wasm-bytecode": { + "version": "1.13.2", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-bytecode/-/helper-wasm-bytecode-1.13.2.tgz", + "integrity": "sha512-3QbLKy93F0EAIXLh0ogEVR6rOubA9AoZ+WRYhNbFyuB70j3dRdwH9g+qXhLAO0kiYGlg3TxDV+I4rQTr/YNXkA==", + "license": "MIT" + }, + "node_modules/@webassemblyjs/helper-wasm-section": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-section/-/helper-wasm-section-1.14.1.tgz", + "integrity": "sha512-ds5mXEqTJ6oxRoqjhWDU83OgzAYjwsCV8Lo/N+oRsNDmx/ZDpqalmrtgOMkHwxsG0iI//3BwWAErYRHtgn0dZw==", + "license": "MIT", + "dependencies": { + "@webassemblyjs/ast": "1.14.1", + "@webassemblyjs/helper-buffer": "1.14.1", + "@webassemblyjs/helper-wasm-bytecode": "1.13.2", + "@webassemblyjs/wasm-gen": "1.14.1" + } + }, + "node_modules/@webassemblyjs/ieee754": { + "version": "1.13.2", + "resolved": "https://registry.npmjs.org/@webassemblyjs/ieee754/-/ieee754-1.13.2.tgz", + "integrity": "sha512-4LtOzh58S/5lX4ITKxnAK2USuNEvpdVV9AlgGQb8rJDHaLeHciwG4zlGr0j/SNWlr7x3vO1lDEsuePvtcDNCkw==", + "license": "MIT", + "dependencies": { + "@xtuc/ieee754": "^1.2.0" + } + }, + "node_modules/@webassemblyjs/leb128": { + "version": "1.13.2", + "resolved": "https://registry.npmjs.org/@webassemblyjs/leb128/-/leb128-1.13.2.tgz", + "integrity": "sha512-Lde1oNoIdzVzdkNEAWZ1dZ5orIbff80YPdHx20mrHwHrVNNTjNr8E3xz9BdpcGqRQbAEa+fkrCb+fRFTl/6sQw==", + "license": "Apache-2.0", + "dependencies": { + "@xtuc/long": "4.2.2" + } + }, + "node_modules/@webassemblyjs/utf8": { + "version": "1.13.2", + "resolved": "https://registry.npmjs.org/@webassemblyjs/utf8/-/utf8-1.13.2.tgz", + "integrity": "sha512-3NQWGjKTASY1xV5m7Hr0iPeXD9+RDobLll3T9d2AO+g3my8xy5peVyjSag4I50mR1bBSN/Ct12lo+R9tJk0NZQ==", + "license": "MIT" + }, + "node_modules/@webassemblyjs/wasm-edit": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-edit/-/wasm-edit-1.14.1.tgz", + "integrity": "sha512-RNJUIQH/J8iA/1NzlE4N7KtyZNHi3w7at7hDjvRNm5rcUXa00z1vRz3glZoULfJ5mpvYhLybmVcwcjGrC1pRrQ==", + "license": "MIT", + "dependencies": { + "@webassemblyjs/ast": "1.14.1", + "@webassemblyjs/helper-buffer": "1.14.1", + "@webassemblyjs/helper-wasm-bytecode": "1.13.2", + "@webassemblyjs/helper-wasm-section": "1.14.1", + "@webassemblyjs/wasm-gen": "1.14.1", + "@webassemblyjs/wasm-opt": "1.14.1", + "@webassemblyjs/wasm-parser": "1.14.1", + "@webassemblyjs/wast-printer": "1.14.1" + } + }, + "node_modules/@webassemblyjs/wasm-gen": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-gen/-/wasm-gen-1.14.1.tgz", + "integrity": "sha512-AmomSIjP8ZbfGQhumkNvgC33AY7qtMCXnN6bL2u2Js4gVCg8fp735aEiMSBbDR7UQIj90n4wKAFUSEd0QN2Ukg==", + "license": "MIT", + "dependencies": { + "@webassemblyjs/ast": "1.14.1", + "@webassemblyjs/helper-wasm-bytecode": "1.13.2", + "@webassemblyjs/ieee754": "1.13.2", + "@webassemblyjs/leb128": "1.13.2", + "@webassemblyjs/utf8": "1.13.2" + } + }, + "node_modules/@webassemblyjs/wasm-opt": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-opt/-/wasm-opt-1.14.1.tgz", + "integrity": "sha512-PTcKLUNvBqnY2U6E5bdOQcSM+oVP/PmrDY9NzowJjislEjwP/C4an2303MCVS2Mg9d3AJpIGdUFIQQWbPds0Sw==", + "license": "MIT", + "dependencies": { + "@webassemblyjs/ast": "1.14.1", + "@webassemblyjs/helper-buffer": "1.14.1", + "@webassemblyjs/wasm-gen": "1.14.1", + "@webassemblyjs/wasm-parser": "1.14.1" + } + }, + "node_modules/@webassemblyjs/wasm-parser": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-parser/-/wasm-parser-1.14.1.tgz", + "integrity": "sha512-JLBl+KZ0R5qB7mCnud/yyX08jWFw5MsoalJ1pQ4EdFlgj9VdXKGuENGsiCIjegI1W7p91rUlcB/LB5yRJKNTcQ==", + "license": "MIT", + "dependencies": { + "@webassemblyjs/ast": "1.14.1", + "@webassemblyjs/helper-api-error": "1.13.2", + "@webassemblyjs/helper-wasm-bytecode": "1.13.2", + "@webassemblyjs/ieee754": "1.13.2", + "@webassemblyjs/leb128": "1.13.2", + "@webassemblyjs/utf8": "1.13.2" + } + }, + "node_modules/@webassemblyjs/wast-printer": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wast-printer/-/wast-printer-1.14.1.tgz", + "integrity": "sha512-kPSSXE6De1XOR820C90RIo2ogvZG+c3KiHzqUoO/F34Y2shGzesfqv7o57xrxovZJH/MetF5UjroJ/R/3isoiw==", + "license": "MIT", + "dependencies": { + "@webassemblyjs/ast": "1.14.1", + "@xtuc/long": "4.2.2" + } + }, + "node_modules/@webpack-cli/configtest": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@webpack-cli/configtest/-/configtest-1.2.0.tgz", + "integrity": "sha512-4FB8Tj6xyVkyqjj1OaTqCjXYULB9FMkqQ8yGrZjRDrYh0nOE+7Lhs45WioWQQMV+ceFlE368Ukhe6xdvJM9Egg==", + "license": "MIT", + "peerDependencies": { + "webpack": "4.x.x || 5.x.x", + "webpack-cli": "4.x.x" + } + }, + "node_modules/@webpack-cli/info": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@webpack-cli/info/-/info-1.5.0.tgz", + "integrity": "sha512-e8tSXZpw2hPl2uMJY6fsMswaok5FdlGNRTktvFk2sD8RjH0hE2+XistawJx1vmKteh4NmGmNUrp+Tb2w+udPcQ==", + "license": "MIT", + "dependencies": { + "envinfo": "^7.7.3" + }, + "peerDependencies": { + "webpack-cli": "4.x.x" + } + }, + "node_modules/@webpack-cli/serve": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/@webpack-cli/serve/-/serve-1.7.0.tgz", + "integrity": "sha512-oxnCNGj88fL+xzV+dacXs44HcDwf1ovs3AuEzvP7mqXw7fQntqIhQ1BRmynh4qEKQSSSRSWVyXRjmTbZIX9V2Q==", + "license": "MIT", + "peerDependencies": { + "webpack-cli": "4.x.x" + }, + "peerDependenciesMeta": { + "webpack-dev-server": { + "optional": true + } + } + }, + "node_modules/@xmldom/xmldom": { + "version": "0.8.11", + "resolved": "https://registry.npmjs.org/@xmldom/xmldom/-/xmldom-0.8.11.tgz", + "integrity": "sha512-cQzWCtO6C8TQiYl1ruKNn2U6Ao4o4WBBcbL61yJl84x+j5sOWWFU9X7DpND8XZG3daDppSsigMdfAIl2upQBRw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/@xtuc/ieee754": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@xtuc/ieee754/-/ieee754-1.2.0.tgz", + "integrity": "sha512-DX8nKgqcGwsc0eJSqYt5lwP4DH5FlHnmuWWBRy7X0NcaGR0ZtuyeESgMwTYVEtxmsNGY+qit4QYT/MIYTOTPeA==", + "license": "BSD-3-Clause" + }, + "node_modules/@xtuc/long": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/@xtuc/long/-/long-4.2.2.tgz", + "integrity": "sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ==", + "license": "Apache-2.0" + }, + "node_modules/@yarnpkg/lockfile": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@yarnpkg/lockfile/-/lockfile-1.1.0.tgz", + "integrity": "sha512-GpSwvyXOcOOlV70vbnzjj4fW5xW/FdUF6nQEt1ENy7m4ZCczi1+/buVUPAqmGfqznsORNFzUMjctTIp8a9tuCQ==", + "license": "BSD-2-Clause" + }, + "node_modules/@yarnpkg/parsers": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@yarnpkg/parsers/-/parsers-3.0.2.tgz", + "integrity": "sha512-/HcYgtUSiJiot/XWGLOlGxPYUG65+/31V8oqk17vZLW1xlCoR4PampyePljOxY2n8/3jz9+tIFzICsyGujJZoA==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "js-yaml": "^3.10.0", + "tslib": "^2.4.0" + }, + "engines": { + "node": ">=18.12.0" + } + }, + "node_modules/@yarnpkg/parsers/node_modules/argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "dev": true, + "license": "MIT", + "dependencies": { + "sprintf-js": "~1.0.2" + } + }, + "node_modules/@yarnpkg/parsers/node_modules/js-yaml": { + "version": "3.14.2", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.2.tgz", + "integrity": "sha512-PMSmkqxr106Xa156c2M265Z+FTrPl+oxd/rgOQy2tijQeK5TxQ43psO1ZCwhVOSdnn+RzkzlRz/eY4BgJBYVpg==", + "dev": true, + "license": "MIT", + "dependencies": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/@zkochan/js-yaml": { + "version": "0.0.7", + "resolved": "https://registry.npmjs.org/@zkochan/js-yaml/-/js-yaml-0.0.7.tgz", + "integrity": "sha512-nrUSn7hzt7J6JWgWGz78ZYI8wj+gdIJdk0Ynjpp8l+trkn58Uqsf6RYrYkEK+3X18EX+TNdtJI0WxAtc+L84SQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/7zip-bin": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/7zip-bin/-/7zip-bin-5.2.0.tgz", + "integrity": "sha512-ukTPVhqG4jNzMro2qA9HSCSSVJN3aN7tlb+hfqYCt3ER0yWroeA2VR38MNrOHLQ/cVj+DaIMad0kFCtWWowh/A==", + "dev": true, + "license": "MIT" + }, + "node_modules/abab": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/abab/-/abab-2.0.6.tgz", + "integrity": "sha512-j2afSsaIENvHZN2B8GOpF566vZ5WVk5opAiMTvWgaQT8DkbOqsTfvNAvHoRGU2zzP8cPoqys+xHTRDWW8L+/BA==", + "deprecated": "Use your platform's native atob() and btoa() methods instead", + "license": "BSD-3-Clause" + }, + "node_modules/abbrev": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-3.0.1.tgz", + "integrity": "sha512-AO2ac6pjRB3SJmGJo+v5/aK6Omggp6fsLrs6wN9bd35ulu4cCwaAU9+7ZhXjeqHVkaHThLuzH0nZr0YpCDhygg==", + "dev": true, + "license": "ISC", + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/abort-controller": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz", + "integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==", + "license": "MIT", + "dependencies": { + "event-target-shim": "^5.0.0" + }, + "engines": { + "node": ">=6.5" + } + }, + "node_modules/accepts": { + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz", + "integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==", + "license": "MIT", + "dependencies": { + "mime-types": "~2.1.34", + "negotiator": "0.6.3" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/acorn": { + "version": "8.15.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.15.0.tgz", + "integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==", + "license": "MIT", + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-import-phases": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/acorn-import-phases/-/acorn-import-phases-1.0.4.tgz", + "integrity": "sha512-wKmbr/DDiIXzEOiWrTTUcDm24kQ2vGfZQvM2fwg2vXqR5uW6aapr7ObPtj1th32b9u90/Pf4AItvdTh42fBmVQ==", + "license": "MIT", + "engines": { + "node": ">=10.13.0" + }, + "peerDependencies": { + "acorn": "^8.14.0" + } + }, + "node_modules/acorn-jsx": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", + "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" + } + }, + "node_modules/add-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/add-stream/-/add-stream-1.0.0.tgz", + "integrity": "sha512-qQLMr+8o0WC4FZGQTcJiKBVC59JylcPSrTtk6usvmIDFUOCKegapy1VHQwRbFMOFyb/inzUVqHs+eMYKDM1YeQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/adm-zip": { + "version": "0.5.16", + "resolved": "https://registry.npmjs.org/adm-zip/-/adm-zip-0.5.16.tgz", + "integrity": "sha512-TGw5yVi4saajsSEgz25grObGHEUaDrniwvA2qwSC060KfqGPdglhvPMA2lPIoxs3PQIItj2iag35fONcQqgUaQ==", + "license": "MIT", + "engines": { + "node": ">=12.0" + } + }, + "node_modules/advanced-mark.js": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/advanced-mark.js/-/advanced-mark.js-2.7.0.tgz", + "integrity": "sha512-QWYv6RUS7vIcWr6kYC8yGaEWEg+3BfttaxaRhOvx2++Gm9ETA3zcKXwFdMeE9PTG5MmQ/L0boev2zUV3fxjizg==", + "license": "MIT" + }, + "node_modules/agent-base": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", + "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", + "license": "MIT", + "dependencies": { + "debug": "4" + }, + "engines": { + "node": ">= 6.0.0" + } + }, + "node_modules/agentkeepalive": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/agentkeepalive/-/agentkeepalive-4.6.0.tgz", + "integrity": "sha512-kja8j7PjmncONqaTsB8fQ+wE2mSU2DJ9D4XKoJ5PFWIdRMa6SLSN1ff4mOr4jCbfRSsxR4keIiySJU0N9T5hIQ==", + "license": "MIT", + "dependencies": { + "humanize-ms": "^1.2.1" + }, + "engines": { + "node": ">= 8.0.0" + } + }, + "node_modules/aggregate-error": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.1.0.tgz", + "integrity": "sha512-4I7Td01quW/RpocfNayFdFVk1qSuoh0E7JrbRJ16nH01HhKFQ88INq9Sd+nd72zqRySlr9BmDA8xlEJ6vJMrYA==", + "license": "MIT", + "dependencies": { + "clean-stack": "^2.0.0", + "indent-string": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/ajv-formats": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/ajv-formats/-/ajv-formats-3.0.1.tgz", + "integrity": "sha512-8iUql50EUR+uUcdRQ3HDqa6EVyo3docL8g5WJ3FNcWmu62IbkGUue/pEyLBW8VGKKucTPgqeks4fIU1DA4yowQ==", + "license": "MIT", + "dependencies": { + "ajv": "^8.0.0" + }, + "peerDependencies": { + "ajv": "^8.0.0" + }, + "peerDependenciesMeta": { + "ajv": { + "optional": true + } + } + }, + "node_modules/ajv-formats/node_modules/ajv": { + "version": "8.17.1", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.17.1.tgz", + "integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==", + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^3.1.3", + "fast-uri": "^3.0.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/ajv-formats/node_modules/json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "license": "MIT" + }, + "node_modules/ajv-keywords": { + "version": "3.5.2", + "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.5.2.tgz", + "integrity": "sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ==", + "license": "MIT", + "peerDependencies": { + "ajv": "^6.9.1" + } + }, + "node_modules/allure-commandline": { + "version": "2.36.0", + "resolved": "https://registry.npmjs.org/allure-commandline/-/allure-commandline-2.36.0.tgz", + "integrity": "sha512-ls/4fk2Psv2Tu2PbWFrQPmUnm3gmmO9MBan4MuPWwqdkJPEmln2KRwtvtWYr9Av+e5AnFK1fGXWVyxqJIPiPwA==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "allure": "bin/allure" + } + }, + "node_modules/allure-js-commons": { + "version": "2.15.1", + "resolved": "https://registry.npmjs.org/allure-js-commons/-/allure-js-commons-2.15.1.tgz", + "integrity": "sha512-5V/VINplbu0APnfSZOkYpKOzucO36Q2EtTD1kqjWjl7n6tj7Hh+IHCZsH3Vpk/LXRDfj9RuXugBBvwYKV5YMJw==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "md5": "^2.3.0", + "properties": "^1.2.1", + "strip-ansi": "^5.2.0" + } + }, + "node_modules/allure-js-commons/node_modules/ansi-regex": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.1.tgz", + "integrity": "sha512-ILlv4k/3f6vfQ4OoP2AGvirOktlQ98ZEL1k9FaQjxa3L1abBgbuTDAdPOpvbGncC0BTVQrl+OM8xZGK6tWXt7g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/allure-js-commons/node_modules/strip-ansi": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^4.1.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/allure-playwright": { + "version": "2.15.1", + "resolved": "https://registry.npmjs.org/allure-playwright/-/allure-playwright-2.15.1.tgz", + "integrity": "sha512-P1Uu1j/ptDHdYp3V5ZAeBZyt33+L+OQu0otUIEl/zkOcv0KRycHqlHwC0GEJmpgnLKvVP7s+K37LcLoSUUj3Cg==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "allure-js-commons": "2.15.1" + } + }, + "node_modules/anser": { + "version": "2.3.5", + "resolved": "https://registry.npmjs.org/anser/-/anser-2.3.5.tgz", + "integrity": "sha512-vcZjxvvVoxTeR5XBNJB38oTu/7eDCZlwdz32N1eNgpyPF7j/Z7Idf+CUwQOkKKpJ7RJyjxgLHCM7vdIK0iCNMQ==", + "license": "MIT" + }, + "node_modules/ansi-colors": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.3.tgz", + "integrity": "sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/ansi-escapes": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz", + "integrity": "sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==", + "license": "MIT", + "dependencies": { + "type-fest": "^0.21.3" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ansi-escapes/node_modules/type-fest": { + "version": "0.21.3", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz", + "integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==", + "license": "(MIT OR CC0-1.0)", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "license": "MIT", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/anymatch": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", + "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", + "license": "ISC", + "dependencies": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/anymatch/node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "license": "MIT", + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/app-builder-bin": { + "version": "5.0.0-alpha.10", + "resolved": "https://registry.npmjs.org/app-builder-bin/-/app-builder-bin-5.0.0-alpha.10.tgz", + "integrity": "sha512-Ev4jj3D7Bo+O0GPD2NMvJl+PGiBAfS7pUGawntBNpCbxtpncfUixqFj9z9Jme7V7s3LBGqsWZZP54fxBX3JKJw==", + "dev": true, + "license": "MIT" + }, + "node_modules/app-builder-lib": { + "version": "25.1.8", + "resolved": "https://registry.npmjs.org/app-builder-lib/-/app-builder-lib-25.1.8.tgz", + "integrity": "sha512-pCqe7dfsQFBABC1jeKZXQWhGcCPF3rPCXDdfqVKjIeWBcXzyC1iOWZdfFhGl+S9MyE/k//DFmC6FzuGAUudNDg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@develar/schema-utils": "~2.6.5", + "@electron/notarize": "2.5.0", + "@electron/osx-sign": "1.3.1", + "@electron/rebuild": "3.6.1", + "@electron/universal": "2.0.1", + "@malept/flatpak-bundler": "^0.4.0", + "@types/fs-extra": "9.0.13", + "async-exit-hook": "^2.0.1", + "bluebird-lst": "^1.0.9", + "builder-util": "25.1.7", + "builder-util-runtime": "9.2.10", + "chromium-pickle-js": "^0.2.0", + "config-file-ts": "0.2.8-rc1", + "debug": "^4.3.4", + "dotenv": "^16.4.5", + "dotenv-expand": "^11.0.6", + "ejs": "^3.1.8", + "electron-publish": "25.1.7", + "form-data": "^4.0.0", + "fs-extra": "^10.1.0", + "hosted-git-info": "^4.1.0", + "is-ci": "^3.0.0", + "isbinaryfile": "^5.0.0", + "js-yaml": "^4.1.0", + "json5": "^2.2.3", + "lazy-val": "^1.0.5", + "minimatch": "^10.0.0", + "resedit": "^1.7.0", + "sanitize-filename": "^1.6.3", + "semver": "^7.3.8", + "tar": "^6.1.12", + "temp-file": "^3.4.0" + }, + "engines": { + "node": ">=14.0.0" + }, + "peerDependencies": { + "dmg-builder": "25.1.8", + "electron-builder-squirrel-windows": "25.1.8" + } + }, + "node_modules/app-builder-lib/node_modules/@electron/rebuild": { + "version": "3.6.1", + "resolved": "https://registry.npmjs.org/@electron/rebuild/-/rebuild-3.6.1.tgz", + "integrity": "sha512-f6596ZHpEq/YskUd8emYvOUne89ij8mQgjYFA5ru25QwbrRO+t1SImofdDv7kKOuWCmVOuU5tvfkbgGxIl3E/w==", + "dev": true, + "license": "MIT", + "dependencies": { + "@malept/cross-spawn-promise": "^2.0.0", + "chalk": "^4.0.0", + "debug": "^4.1.1", + "detect-libc": "^2.0.1", + "fs-extra": "^10.0.0", + "got": "^11.7.0", + "node-abi": "^3.45.0", + "node-api-version": "^0.2.0", + "node-gyp": "^9.0.0", + "ora": "^5.1.0", + "read-binary-file-arch": "^1.0.6", + "semver": "^7.3.5", + "tar": "^6.0.5", + "yargs": "^17.0.1" + }, + "bin": { + "electron-rebuild": "lib/cli.js" + }, + "engines": { + "node": ">=12.13.0" + } + }, + "node_modules/app-builder-lib/node_modules/@npmcli/fs": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/@npmcli/fs/-/fs-2.1.2.tgz", + "integrity": "sha512-yOJKRvohFOaLqipNtwYB9WugyZKhC/DZC4VYPmpaCzDBrA8YpK3qHZ8/HGscMnE4GqbkLNuVcCnxkeQEdGt6LQ==", + "dev": true, + "license": "ISC", + "dependencies": { + "@gar/promisify": "^1.1.3", + "semver": "^7.3.5" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + } + }, + "node_modules/app-builder-lib/node_modules/@types/fs-extra": { + "version": "9.0.13", + "resolved": "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-9.0.13.tgz", + "integrity": "sha512-nEnwB++1u5lVDM2UI4c1+5R+FYaKfaAzS4OococimjVm3nQw3TuzH5UNsocrcTBbhnerblyHj4A49qXbIiZdpA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/app-builder-lib/node_modules/abbrev": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", + "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", + "dev": true, + "license": "ISC" + }, + "node_modules/app-builder-lib/node_modules/brace-expansion": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz", + "integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/app-builder-lib/node_modules/cacache": { + "version": "16.1.3", + "resolved": "https://registry.npmjs.org/cacache/-/cacache-16.1.3.tgz", + "integrity": "sha512-/+Emcj9DAXxX4cwlLmRI9c166RuL3w30zp4R7Joiv2cQTtTtA+jeuCAjH3ZlGnYS3tKENSrKhAzVVP9GVyzeYQ==", + "dev": true, + "license": "ISC", + "dependencies": { + "@npmcli/fs": "^2.1.0", + "@npmcli/move-file": "^2.0.0", + "chownr": "^2.0.0", + "fs-minipass": "^2.1.0", + "glob": "^8.0.1", + "infer-owner": "^1.0.4", + "lru-cache": "^7.7.1", + "minipass": "^3.1.6", + "minipass-collect": "^1.0.2", + "minipass-flush": "^1.0.5", + "minipass-pipeline": "^1.2.4", + "mkdirp": "^1.0.4", + "p-map": "^4.0.0", + "promise-inflight": "^1.0.1", + "rimraf": "^3.0.2", + "ssri": "^9.0.0", + "tar": "^6.1.11", + "unique-filename": "^2.0.0" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + } + }, + "node_modules/app-builder-lib/node_modules/cacache/node_modules/glob": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-8.1.0.tgz", + "integrity": "sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==", + "deprecated": "Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me", + "dev": true, + "license": "ISC", + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^5.0.1", + "once": "^1.3.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/app-builder-lib/node_modules/cacache/node_modules/minimatch": { + "version": "5.1.6", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", + "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/app-builder-lib/node_modules/chownr": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/chownr/-/chownr-2.0.0.tgz", + "integrity": "sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=10" + } + }, + "node_modules/app-builder-lib/node_modules/fs-extra": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.1.0.tgz", + "integrity": "sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/app-builder-lib/node_modules/fs-minipass": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-2.1.0.tgz", + "integrity": "sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg==", + "dev": true, + "license": "ISC", + "dependencies": { + "minipass": "^3.0.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/app-builder-lib/node_modules/http-proxy-agent": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-5.0.0.tgz", + "integrity": "sha512-n2hY8YdoRE1i7r6M0w9DIw5GgZN0G25P8zLCRQ8rjXtTU3vsNFBI/vWK/UIeE6g5MUUz6avwAPXmL6Fy9D/90w==", + "dev": true, + "license": "MIT", + "dependencies": { + "@tootallnate/once": "2", + "agent-base": "6", + "debug": "4" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/app-builder-lib/node_modules/https-proxy-agent": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz", + "integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==", + "dev": true, + "license": "MIT", + "dependencies": { + "agent-base": "6", + "debug": "4" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/app-builder-lib/node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "dev": true, + "license": "ISC" + }, + "node_modules/app-builder-lib/node_modules/jsonfile": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.2.0.tgz", + "integrity": "sha512-FGuPw30AdOIUTRMC2OMRtQV+jkVj2cfPqSeWXv1NEAJ1qZ5zb1X6z1mFhbfOB/iy3ssJCD+3KuZ8r8C3uVFlAg==", + "dev": true, + "license": "MIT", + "dependencies": { + "universalify": "^2.0.0" + }, + "optionalDependencies": { + "graceful-fs": "^4.1.6" + } + }, + "node_modules/app-builder-lib/node_modules/lru-cache": { + "version": "7.18.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.18.3.tgz", + "integrity": "sha512-jumlc0BIUrS3qJGgIkWZsyfAM7NCWiBcCDhnd+3NNM5KbBmLTgHVfWBcg6W+rLUsIpzpERPsvwUP7CckAQSOoA==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=12" + } + }, + "node_modules/app-builder-lib/node_modules/make-fetch-happen": { + "version": "10.2.1", + "resolved": "https://registry.npmjs.org/make-fetch-happen/-/make-fetch-happen-10.2.1.tgz", + "integrity": "sha512-NgOPbRiaQM10DYXvN3/hhGVI2M5MtITFryzBGxHM5p4wnFxsVCbxkrBrDsk+EZ5OB4jEOT7AjDxtdF+KVEFT7w==", + "dev": true, + "license": "ISC", + "dependencies": { + "agentkeepalive": "^4.2.1", + "cacache": "^16.1.0", + "http-cache-semantics": "^4.1.0", + "http-proxy-agent": "^5.0.0", + "https-proxy-agent": "^5.0.0", + "is-lambda": "^1.0.1", + "lru-cache": "^7.7.1", + "minipass": "^3.1.6", + "minipass-collect": "^1.0.2", + "minipass-fetch": "^2.0.3", + "minipass-flush": "^1.0.5", + "minipass-pipeline": "^1.2.4", + "negotiator": "^0.6.3", + "promise-retry": "^2.0.1", + "socks-proxy-agent": "^7.0.0", + "ssri": "^9.0.0" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + } + }, + "node_modules/app-builder-lib/node_modules/minipass": { + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", + "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", + "dev": true, + "license": "ISC", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/app-builder-lib/node_modules/minipass-collect": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/minipass-collect/-/minipass-collect-1.0.2.tgz", + "integrity": "sha512-6T6lH0H8OG9kITm/Jm6tdooIbogG9e0tLgpY6mphXSm/A9u8Nq1ryBG+Qspiub9LjWlBPsPS3tWQ/Botq4FdxA==", + "dev": true, + "license": "ISC", + "dependencies": { + "minipass": "^3.0.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/app-builder-lib/node_modules/minipass-fetch": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/minipass-fetch/-/minipass-fetch-2.1.2.tgz", + "integrity": "sha512-LT49Zi2/WMROHYoqGgdlQIZh8mLPZmOrN2NdJjMXxYe4nkN6FUyuPuOAOedNJDrx0IRGg9+4guZewtp8hE6TxA==", + "dev": true, + "license": "MIT", + "dependencies": { + "minipass": "^3.1.6", + "minipass-sized": "^1.0.3", + "minizlib": "^2.1.2" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + }, + "optionalDependencies": { + "encoding": "^0.1.13" + } + }, + "node_modules/app-builder-lib/node_modules/minizlib": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-2.1.2.tgz", + "integrity": "sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg==", + "dev": true, + "license": "MIT", + "dependencies": { + "minipass": "^3.0.0", + "yallist": "^4.0.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/app-builder-lib/node_modules/mkdirp": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", + "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", + "dev": true, + "license": "MIT", + "bin": { + "mkdirp": "bin/cmd.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/app-builder-lib/node_modules/node-abi": { + "version": "3.87.0", + "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.87.0.tgz", + "integrity": "sha512-+CGM1L1CgmtheLcBuleyYOn7NWPVu0s0EJH2C4puxgEZb9h8QpR9G2dBfZJOAUhi7VQxuBPMd0hiISWcTyiYyQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "semver": "^7.3.5" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/app-builder-lib/node_modules/node-gyp": { + "version": "9.4.1", + "resolved": "https://registry.npmjs.org/node-gyp/-/node-gyp-9.4.1.tgz", + "integrity": "sha512-OQkWKbjQKbGkMf/xqI1jjy3oCTgMKJac58G2+bjZb3fza6gW2YrCSdMQYaoTb70crvE//Gngr4f0AgVHmqHvBQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "env-paths": "^2.2.0", + "exponential-backoff": "^3.1.1", + "glob": "^7.1.4", + "graceful-fs": "^4.2.6", + "make-fetch-happen": "^10.0.3", + "nopt": "^6.0.0", + "npmlog": "^6.0.0", + "rimraf": "^3.0.2", + "semver": "^7.3.5", + "tar": "^6.1.2", + "which": "^2.0.2" + }, + "bin": { + "node-gyp": "bin/node-gyp.js" + }, + "engines": { + "node": "^12.13 || ^14.13 || >=16" + } + }, + "node_modules/app-builder-lib/node_modules/nopt": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/nopt/-/nopt-6.0.0.tgz", + "integrity": "sha512-ZwLpbTgdhuZUnZzjd7nb1ZV+4DoiC6/sfiVKok72ym/4Tlf+DFdlHYmT2JPmcNNWV6Pi3SDf1kT+A4r9RTuT9g==", + "dev": true, + "license": "ISC", + "dependencies": { + "abbrev": "^1.0.0" + }, + "bin": { + "nopt": "bin/nopt.js" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + } + }, + "node_modules/app-builder-lib/node_modules/rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "deprecated": "Rimraf versions prior to v4 are no longer supported", + "dev": true, + "license": "ISC", + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/app-builder-lib/node_modules/socks-proxy-agent": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/socks-proxy-agent/-/socks-proxy-agent-7.0.0.tgz", + "integrity": "sha512-Fgl0YPZ902wEsAyiQ+idGd1A7rSFx/ayC1CQVMw5P+EQx2V0SgpGtf6OKFhVjPflPUl9YMmEOnmfjCdMUsygww==", + "dev": true, + "license": "MIT", + "dependencies": { + "agent-base": "^6.0.2", + "debug": "^4.3.3", + "socks": "^2.6.2" + }, + "engines": { + "node": ">= 10" + } + }, + "node_modules/app-builder-lib/node_modules/ssri": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/ssri/-/ssri-9.0.1.tgz", + "integrity": "sha512-o57Wcn66jMQvfHG1FlYbWeZWW/dHZhJXjpIcTfXldXEk5nz5lStPo3mK0OJQfGR3RbZUlbISexbljkJzuEj/8Q==", + "dev": true, + "license": "ISC", + "dependencies": { + "minipass": "^3.1.1" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + } + }, + "node_modules/app-builder-lib/node_modules/tar": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/tar/-/tar-6.2.1.tgz", + "integrity": "sha512-DZ4yORTwrbTj/7MZYq2w+/ZFdI6OZ/f9SFHR+71gIVUZhOQPHzVCLpvRnPgyaMpfWxxk/4ONva3GQSyNIKRv6A==", + "deprecated": "Old versions of tar are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me", + "dev": true, + "license": "ISC", + "dependencies": { + "chownr": "^2.0.0", + "fs-minipass": "^2.0.0", + "minipass": "^5.0.0", + "minizlib": "^2.1.1", + "mkdirp": "^1.0.3", + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/app-builder-lib/node_modules/tar/node_modules/minipass": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-5.0.0.tgz", + "integrity": "sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=8" + } + }, + "node_modules/app-builder-lib/node_modules/unique-filename": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/unique-filename/-/unique-filename-2.0.1.tgz", + "integrity": "sha512-ODWHtkkdx3IAR+veKxFV+VBkUMcN+FaqzUUd7IZzt+0zhDZFPFxhlqwPF3YQvMHx1TD0tdgYl+kuPnJ8E6ql7A==", + "dev": true, + "license": "ISC", + "dependencies": { + "unique-slug": "^3.0.0" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + } + }, + "node_modules/app-builder-lib/node_modules/unique-slug": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/unique-slug/-/unique-slug-3.0.0.tgz", + "integrity": "sha512-8EyMynh679x/0gqE9fT9oilG+qEt+ibFyqjuVTsZn1+CMxH+XLlpvr2UZx4nVcCwTpx81nICr2JQFkM+HPLq4w==", + "dev": true, + "license": "ISC", + "dependencies": { + "imurmurhash": "^0.1.4" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + } + }, + "node_modules/app-builder-lib/node_modules/universalify": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz", + "integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 10.0.0" + } + }, + "node_modules/app-builder-lib/node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "license": "ISC", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/app-builder-lib/node_modules/y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=10" + } + }, + "node_modules/app-builder-lib/node_modules/yargs": { + "version": "17.7.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", + "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", + "dev": true, + "license": "MIT", + "dependencies": { + "cliui": "^8.0.1", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.3", + "y18n": "^5.0.5", + "yargs-parser": "^21.1.1" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/append-field": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/append-field/-/append-field-1.0.0.tgz", + "integrity": "sha512-klpgFSWLW1ZEs8svjfb7g4qWY0YS5imI82dTg+QahUvJ8YqAY0P10Uk8tTyh9ZGuYEZEMaeJYCF5BFuX552hsw==", + "license": "MIT" + }, + "node_modules/append-transform": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/append-transform/-/append-transform-2.0.0.tgz", + "integrity": "sha512-7yeyCEurROLQJFv5Xj4lEGTy0borxepjFv1g22oAdqFu//SrAlDl1O1Nxx15SH1RoliUml6p8dwJW9jvZughhg==", + "dev": true, + "license": "MIT", + "dependencies": { + "default-require-extensions": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/aproba": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/aproba/-/aproba-2.0.0.tgz", + "integrity": "sha512-lYe4Gx7QT+MKGbDsA+Z+he/Wtef0BiwDOlK/XkBrdfsh9J/jPPXbX0tE9x9cl27Tmu5gg3QUbUrQYa/y+KOHPQ==", + "dev": true, + "license": "ISC" + }, + "node_modules/archiver": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/archiver/-/archiver-5.3.2.tgz", + "integrity": "sha512-+25nxyyznAXF7Nef3y0EbBeqmGZgeN/BxHX29Rs39djAfaFalmQ89SE6CWyDCHzGL0yt/ycBtNOmGTW0FyGWNw==", + "license": "MIT", + "dependencies": { + "archiver-utils": "^2.1.0", + "async": "^3.2.4", + "buffer-crc32": "^0.2.1", + "readable-stream": "^3.6.0", + "readdir-glob": "^1.1.2", + "tar-stream": "^2.2.0", + "zip-stream": "^4.1.0" + }, + "engines": { + "node": ">= 10" + } + }, + "node_modules/archiver-utils": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/archiver-utils/-/archiver-utils-2.1.0.tgz", + "integrity": "sha512-bEL/yUb/fNNiNTuUz979Z0Yg5L+LzLxGJz8x79lYmR54fmTIb6ob/hNQgkQnIUDWIFjZVQwl9Xs356I6BAMHfw==", + "license": "MIT", + "dependencies": { + "glob": "^7.1.4", + "graceful-fs": "^4.2.0", + "lazystream": "^1.0.0", + "lodash.defaults": "^4.2.0", + "lodash.difference": "^4.5.0", + "lodash.flatten": "^4.4.0", + "lodash.isplainobject": "^4.0.6", + "lodash.union": "^4.6.0", + "normalize-path": "^3.0.0", + "readable-stream": "^2.0.0" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/archiver-utils/node_modules/isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==", + "license": "MIT" + }, + "node_modules/archiver-utils/node_modules/readable-stream": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", + "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", + "license": "MIT", + "dependencies": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "node_modules/archiver-utils/node_modules/safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "license": "MIT" + }, + "node_modules/archiver-utils/node_modules/string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.1.0" + } + }, + "node_modules/archy": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/archy/-/archy-1.0.0.tgz", + "integrity": "sha512-Xg+9RwCg/0p32teKdGMPTPnVXKD0w3DfHnFTficozsAgsvq2XenPJq/MYpzzQ/v8zrOyJn6Ds39VA4JIDwFfqw==", + "dev": true, + "license": "MIT" + }, + "node_modules/are-we-there-yet": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-3.0.1.tgz", + "integrity": "sha512-QZW4EDmGwlYur0Yyf/b2uGucHQMa8aFUP7eu9ddR73vvhFyt4V0Vl3QHPcTNJ8l6qYOBdxgXdnBXQrHilfRQBg==", + "deprecated": "This package is no longer supported.", + "dev": true, + "license": "ISC", + "dependencies": { + "delegates": "^1.0.0", + "readable-stream": "^3.6.0" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + } + }, + "node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "license": "Python-2.0" + }, + "node_modules/array-buffer-byte-length": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/array-buffer-byte-length/-/array-buffer-byte-length-1.0.2.tgz", + "integrity": "sha512-LHE+8BuR7RYGDKvnrmcuSq3tDcKv9OFEXQt/HpbZhY7V6h0zlUXutnAD82GiFx9rdieCMjkvtcsPqBwgUl1Iiw==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.3", + "is-array-buffer": "^3.0.5" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/array-differ": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/array-differ/-/array-differ-3.0.0.tgz", + "integrity": "sha512-THtfYS6KtME/yIAhKjZ2ul7XI96lQGHRputJQHO80LAWQnuGP4iCIN8vdMRboGbIEYBwU33q8Tch1os2+X0kMg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/array-flatten": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", + "integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==", + "license": "MIT" + }, + "node_modules/array-ify": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/array-ify/-/array-ify-1.0.0.tgz", + "integrity": "sha512-c5AMf34bKdvPhQ7tBGhqkgKNUzMr4WUs+WDtC2ZUGOUncbxKMTvqxYctiseW3+L4bA8ec+GcZ6/A/FW4m8ukng==", + "dev": true, + "license": "MIT" + }, + "node_modules/array-includes": { + "version": "3.1.9", + "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.1.9.tgz", + "integrity": "sha512-FmeCCAenzH0KH381SPT5FZmiA/TmpndpcaShhfgEN9eCVjnFBqq3l1xrI42y8+PPLI6hypzou4GXw00WHmPBLQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.4", + "define-properties": "^1.2.1", + "es-abstract": "^1.24.0", + "es-object-atoms": "^1.1.1", + "get-intrinsic": "^1.3.0", + "is-string": "^1.1.1", + "math-intrinsics": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/array-union": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", + "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/array-uniq": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/array-uniq/-/array-uniq-1.0.3.tgz", + "integrity": "sha512-MNha4BWQ6JbwhFhj03YK552f7cb3AzoE8SzeljgChvL1dl3IcvggXVz1DilzySZkCja+CXuZbdW7yATchWn8/Q==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/array.prototype.findlast": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/array.prototype.findlast/-/array.prototype.findlast-1.2.5.tgz", + "integrity": "sha512-CVvd6FHg1Z3POpBLxO6E6zr+rSKEQ9L6rZHAaY7lLfhKsWYUBBOuMs0e9o24oopj6H+geRCX0YJ+TJLBK2eHyQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.2", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.0.0", + "es-shim-unscopables": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/array.prototype.findlastindex": { + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/array.prototype.findlastindex/-/array.prototype.findlastindex-1.2.6.tgz", + "integrity": "sha512-F/TKATkzseUExPlfvmwQKGITM3DGTK+vkAsCZoDc5daVygbJBnjEUCbgkAvVFsgfXfX4YIqZ/27G3k3tdXrTxQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.4", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.9", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.1.1", + "es-shim-unscopables": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/array.prototype.flat": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.3.3.tgz", + "integrity": "sha512-rwG/ja1neyLqCuGZ5YYrznA62D4mZXg0i1cIskIUKSiqF3Cje9/wXAls9B9s1Wa2fomMsIv8czB8jZcPmxCXFg==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.8", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.5", + "es-shim-unscopables": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/array.prototype.flatmap": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/array.prototype.flatmap/-/array.prototype.flatmap-1.3.3.tgz", + "integrity": "sha512-Y7Wt51eKJSyi80hFrJCePGGNo5ktJCslFuboqJsbf57CCPcm5zztluPlc4/aD8sWsKvlwatezpV4U1efk8kpjg==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.8", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.5", + "es-shim-unscopables": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/array.prototype.tosorted": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/array.prototype.tosorted/-/array.prototype.tosorted-1.1.4.tgz", + "integrity": "sha512-p6Fx8B7b7ZhL/gmUsAy0D15WhvDccw3mnGNbZpi3pmeJdxtWsj2jEaI4Y6oo3XiHfzuSgPwKc04MYt6KgvC/wA==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.3", + "es-errors": "^1.3.0", + "es-shim-unscopables": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/arraybuffer.prototype.slice": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/arraybuffer.prototype.slice/-/arraybuffer.prototype.slice-1.0.4.tgz", + "integrity": "sha512-BNoCY6SXXPQ7gF2opIP4GBE+Xw7U+pHMYKuzjgCN3GwiaIR09UUeKfheyIry77QtrCBlC0KK0q5/TER/tYh3PQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "array-buffer-byte-length": "^1.0.1", + "call-bind": "^1.0.8", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.5", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.6", + "is-array-buffer": "^3.0.4" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/arrify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz", + "integrity": "sha512-3CYzex9M9FGQjCGMGyi6/31c8GJbgb0qGyrx5HWxPd0aCwh4cB2YjMb2Xf9UuoogrMrlO9cTqnB5rI5GHZTcUA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/asn1": { + "version": "0.2.6", + "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.6.tgz", + "integrity": "sha512-ix/FxPn0MDjeyJ7i/yoHGFt/EX6LyNbxSEhPPXODPL+KB0VPk86UYfL0lMdy+KCnv+fmvIzySwaK5COwqVbWTQ==", + "license": "MIT", + "dependencies": { + "safer-buffer": "~2.1.0" + } + }, + "node_modules/assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha512-NfJ4UzBCcQGLDlQq7nHxH+tv3kyZ0hHQqF5BO6J7tNJeP5do1llPr8dZ8zHonfhAu0PHAdMkSo+8o0wxg9lZWw==", + "dev": true, + "license": "MIT", + "optional": true, + "engines": { + "node": ">=0.8" + } + }, + "node_modules/assertion-error": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", + "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==", + "license": "MIT", + "engines": { + "node": "*" + } + }, + "node_modules/ast-types": { + "version": "0.13.4", + "resolved": "https://registry.npmjs.org/ast-types/-/ast-types-0.13.4.tgz", + "integrity": "sha512-x1FCFnFifvYDDzTaLII71vG5uvDwgtmDTEVWAxrgeiR8VjMONcCXJx7E+USjDtHlwFmt9MysbqgF9b9Vjr6w+w==", + "license": "MIT", + "dependencies": { + "tslib": "^2.0.1" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/astral-regex": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-2.0.0.tgz", + "integrity": "sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/async": { + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/async/-/async-3.2.6.tgz", + "integrity": "sha512-htCUDlxyyCLMgaM3xXg0C0LW2xqfuQ6p05pCEIsXuyQ+a1koYKTuBMzRNwmybfLgvJDMd0r1LTn4+E0Ti6C2AA==", + "license": "MIT" + }, + "node_modules/async-exit-hook": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/async-exit-hook/-/async-exit-hook-2.0.1.tgz", + "integrity": "sha512-NW2cX8m1Q7KPA7a5M2ULQeZ2wR5qI5PAbw5L0UOMxdioVk9PMZ0h1TmyZEkPYrCvYjDlFICusOu1dlEKAAeXBw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/async-function": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/async-function/-/async-function-1.0.0.tgz", + "integrity": "sha512-hsU18Ae8CDTR6Kgu9DYf0EbCr/a5iGL0rytQDobUcdpYOKokk8LEjVphnXkDkgpi0wYVsqrXuP0bZxJaTqdgoA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/async-mutex": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/async-mutex/-/async-mutex-0.4.1.tgz", + "integrity": "sha512-WfoBo4E/TbCX1G95XTjbWTE3X2XLG0m1Xbv2cwOtuPdyH9CZvnaA5nCt1ucjaKEgW2A5IF71hxrRhr83Je5xjA==", + "license": "MIT", + "dependencies": { + "tslib": "^2.4.0" + } + }, + "node_modules/asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==", + "license": "MIT" + }, + "node_modules/at-least-node": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/at-least-node/-/at-least-node-1.0.0.tgz", + "integrity": "sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==", + "license": "ISC", + "engines": { + "node": ">= 4.0.0" + } + }, + "node_modules/atomically": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/atomically/-/atomically-1.7.0.tgz", + "integrity": "sha512-Xcz9l0z7y9yQ9rdDaxlmaI4uJHf/T8g9hOEzJcsEqX2SjCj4J20uK7+ldkDHMbpJDK76wF7xEIgxc/vSlsfw5w==", + "license": "MIT", + "engines": { + "node": ">=10.12.0" + } + }, + "node_modules/available-typed-arrays": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.7.tgz", + "integrity": "sha512-wvUjBtSGN7+7SjNpq/9M2Tg350UZD3q62IFZLbRAR1bSMlCo1ZaeW+BJ+D090e4hIIZLBcTDWe4Mh4jvUDajzQ==", + "license": "MIT", + "dependencies": { + "possible-typed-array-names": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/axios": { + "version": "1.13.5", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.13.5.tgz", + "integrity": "sha512-cz4ur7Vb0xS4/KUN0tPWe44eqxrIu31me+fbang3ijiNscE129POzipJJA6zniq2C/Z6sJCjMimjS8Lc/GAs8Q==", + "license": "MIT", + "dependencies": { + "follow-redirects": "^1.15.11", + "form-data": "^4.0.5", + "proxy-from-env": "^1.1.0" + } + }, + "node_modules/azure-devops-node-api": { + "version": "12.5.0", + "resolved": "https://registry.npmjs.org/azure-devops-node-api/-/azure-devops-node-api-12.5.0.tgz", + "integrity": "sha512-R5eFskGvOm3U/GzeAuxRkUsAl0hrAwGgWn6zAd2KrZmrEhWZVqLew4OOupbQlXUuojUzpGtq62SmdhJ06N88og==", + "dev": true, + "license": "MIT", + "dependencies": { + "tunnel": "0.0.6", + "typed-rest-client": "^1.8.4" + } + }, + "node_modules/b4a": { + "version": "1.7.3", + "resolved": "https://registry.npmjs.org/b4a/-/b4a-1.7.3.tgz", + "integrity": "sha512-5Q2mfq2WfGuFp3uS//0s6baOJLMoVduPYVeNmDYxu5OUA1/cBfvr2RIS7vi62LdNj/urk1hfmj867I3qt6uZ7Q==", + "license": "Apache-2.0", + "peerDependencies": { + "react-native-b4a": "*" + }, + "peerDependenciesMeta": { + "react-native-b4a": { + "optional": true + } + } + }, + "node_modules/babel-loader": { + "version": "8.4.1", + "resolved": "https://registry.npmjs.org/babel-loader/-/babel-loader-8.4.1.tgz", + "integrity": "sha512-nXzRChX+Z1GoE6yWavBQg6jDslyFF3SDjl2paADuoQtQW10JqShJt62R6eJQ5m/pjJFDT8xgKIWSP85OY8eXeA==", + "license": "MIT", + "dependencies": { + "find-cache-dir": "^3.3.1", + "loader-utils": "^2.0.4", + "make-dir": "^3.1.0", + "schema-utils": "^2.6.5" + }, + "engines": { + "node": ">= 8.9" + }, + "peerDependencies": { + "@babel/core": "^7.0.0", + "webpack": ">=2" + } + }, + "node_modules/babel-loader/node_modules/make-dir": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", + "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", + "license": "MIT", + "dependencies": { + "semver": "^6.0.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/babel-loader/node_modules/semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/babel-plugin-polyfill-corejs2": { + "version": "0.4.15", + "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-corejs2/-/babel-plugin-polyfill-corejs2-0.4.15.tgz", + "integrity": "sha512-hR3GwrRwHUfYwGfrisXPIDP3JcYfBrW7wKE7+Au6wDYl7fm/ka1NEII6kORzxNU556JjfidZeBsO10kYvtV1aw==", + "license": "MIT", + "dependencies": { + "@babel/compat-data": "^7.28.6", + "@babel/helper-define-polyfill-provider": "^0.6.6", + "semver": "^6.3.1" + }, + "peerDependencies": { + "@babel/core": "^7.4.0 || ^8.0.0-0 <8.0.0" + } + }, + "node_modules/babel-plugin-polyfill-corejs2/node_modules/semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/babel-plugin-polyfill-corejs3": { + "version": "0.13.0", + "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-corejs3/-/babel-plugin-polyfill-corejs3-0.13.0.tgz", + "integrity": "sha512-U+GNwMdSFgzVmfhNm8GJUX88AadB3uo9KpJqS3FaqNIPKgySuvMb+bHPsOmmuWyIcuqZj/pzt1RUIUZns4y2+A==", + "license": "MIT", + "dependencies": { + "@babel/helper-define-polyfill-provider": "^0.6.5", + "core-js-compat": "^3.43.0" + }, + "peerDependencies": { + "@babel/core": "^7.4.0 || ^8.0.0-0 <8.0.0" + } + }, + "node_modules/babel-plugin-polyfill-regenerator": { + "version": "0.6.6", + "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-regenerator/-/babel-plugin-polyfill-regenerator-0.6.6.tgz", + "integrity": "sha512-hYm+XLYRMvupxiQzrvXUj7YyvFFVfv5gI0R71AJzudg1g2AI2vyCPPIFEBjk162/wFzti3inBHo7isWFuEVS/A==", + "license": "MIT", + "dependencies": { + "@babel/helper-define-polyfill-provider": "^0.6.6" + }, + "peerDependencies": { + "@babel/core": "^7.4.0 || ^8.0.0-0 <8.0.0" + } + }, + "node_modules/babel-polyfill": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-polyfill/-/babel-polyfill-6.26.0.tgz", + "integrity": "sha512-F2rZGQnAdaHWQ8YAoeRbukc7HS9QgdgeyJ0rQDd485v9opwuPvjpPFcOOT/WmkKTdgy9ESgSPXDcTNpzrGr6iQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "babel-runtime": "^6.26.0", + "core-js": "^2.5.0", + "regenerator-runtime": "^0.10.5" + } + }, + "node_modules/babel-runtime": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz", + "integrity": "sha512-ITKNuq2wKlW1fJg9sSW52eepoYgZBggvOAHC0u/CYu/qxQ9EVzThCgR69BnSXLHjy2f7SY5zaQ4yt7H9ZVxY2g==", + "dev": true, + "license": "MIT", + "dependencies": { + "core-js": "^2.4.0", + "regenerator-runtime": "^0.11.0" + } + }, + "node_modules/babel-runtime/node_modules/regenerator-runtime": { + "version": "0.11.1", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz", + "integrity": "sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg==", + "dev": true, + "license": "MIT" + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "license": "MIT" + }, + "node_modules/bare-events": { + "version": "2.8.2", + "resolved": "https://registry.npmjs.org/bare-events/-/bare-events-2.8.2.tgz", + "integrity": "sha512-riJjyv1/mHLIPX4RwiK+oW9/4c3TEUeORHKefKAKnZ5kyslbN+HXowtbaVEqt4IMUB7OXlfixcs6gsFeo/jhiQ==", + "license": "Apache-2.0", + "peerDependencies": { + "bare-abort-controller": "*" + }, + "peerDependenciesMeta": { + "bare-abort-controller": { + "optional": true + } + } + }, + "node_modules/bare-fs": { + "version": "4.5.3", + "resolved": "https://registry.npmjs.org/bare-fs/-/bare-fs-4.5.3.tgz", + "integrity": "sha512-9+kwVx8QYvt3hPWnmb19tPnh38c6Nihz8Lx3t0g9+4GoIf3/fTgYwM4Z6NxgI+B9elLQA7mLE9PpqcWtOMRDiQ==", + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "bare-events": "^2.5.4", + "bare-path": "^3.0.0", + "bare-stream": "^2.6.4", + "bare-url": "^2.2.2", + "fast-fifo": "^1.3.2" + }, + "engines": { + "bare": ">=1.16.0" + }, + "peerDependencies": { + "bare-buffer": "*" + }, + "peerDependenciesMeta": { + "bare-buffer": { + "optional": true + } + } + }, + "node_modules/bare-os": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/bare-os/-/bare-os-3.6.2.tgz", + "integrity": "sha512-T+V1+1srU2qYNBmJCXZkUY5vQ0B4FSlL3QDROnKQYOqeiQR8UbjNHlPa+TIbM4cuidiN9GaTaOZgSEgsvPbh5A==", + "license": "Apache-2.0", + "optional": true, + "engines": { + "bare": ">=1.14.0" + } + }, + "node_modules/bare-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/bare-path/-/bare-path-3.0.0.tgz", + "integrity": "sha512-tyfW2cQcB5NN8Saijrhqn0Zh7AnFNsnczRcuWODH0eYAXBsJ5gVxAUuNr7tsHSC6IZ77cA0SitzT+s47kot8Mw==", + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "bare-os": "^3.0.1" + } + }, + "node_modules/bare-stream": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/bare-stream/-/bare-stream-2.7.0.tgz", + "integrity": "sha512-oyXQNicV1y8nc2aKffH+BUHFRXmx6VrPzlnaEvMhram0nPBrKcEdcyBg5r08D0i8VxngHFAiVyn1QKXpSG0B8A==", + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "streamx": "^2.21.0" + }, + "peerDependencies": { + "bare-buffer": "*", + "bare-events": "*" + }, + "peerDependenciesMeta": { + "bare-buffer": { + "optional": true + }, + "bare-events": { + "optional": true + } + } + }, + "node_modules/bare-url": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/bare-url/-/bare-url-2.3.2.tgz", + "integrity": "sha512-ZMq4gd9ngV5aTMa5p9+UfY0b3skwhHELaDkhEHetMdX0LRkW9kzaym4oo/Eh+Ghm0CCDuMTsRIGM/ytUc1ZYmw==", + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "bare-path": "^3.0.0" + } + }, + "node_modules/base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/base64id": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/base64id/-/base64id-2.0.0.tgz", + "integrity": "sha512-lGe34o6EHj9y3Kts9R4ZYs/Gr+6N7MCaMlIFA3F1R2O5/m7K06AxfSeO5530PEERE6/WyEg3lsuyw4GHlPZHog==", + "license": "MIT", + "engines": { + "node": "^4.5.0 || >= 5.9" + } + }, + "node_modules/baseline-browser-mapping": { + "version": "2.9.19", + "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.9.19.tgz", + "integrity": "sha512-ipDqC8FrAl/76p2SSWKSI+H9tFwm7vYqXQrItCuiVPt26Km0jS+NzSsBWAaBusvSbQcfJG+JitdMm+wZAgTYqg==", + "license": "Apache-2.0", + "bin": { + "baseline-browser-mapping": "dist/cli.js" + } + }, + "node_modules/basic-auth": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/basic-auth/-/basic-auth-2.0.1.tgz", + "integrity": "sha512-NF+epuEdnUYVlGuhaxbbq+dvJttwLnGY+YixlXlME5KpQ5W3CnXA5cVTneY3SPbPDRkcjMbifrwmFYcClgOZeg==", + "license": "MIT", + "dependencies": { + "safe-buffer": "5.1.2" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/basic-auth/node_modules/safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "license": "MIT" + }, + "node_modules/basic-ftp": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/basic-ftp/-/basic-ftp-5.1.0.tgz", + "integrity": "sha512-RkaJzeJKDbaDWTIPiJwubyljaEPwpVWkm9Rt5h9Nd6h7tEXTJ3VB4qxdZBioV7JO5yLUaOKwz7vDOzlncUsegw==", + "license": "MIT", + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/bcrypt-pbkdf": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", + "integrity": "sha512-qeFIXtP4MSoi6NLqO12WfqARWWuCKi2Rn/9hJLEmtB5yTNr9DqFWkJRCf2qShWzPeAMRnOgCrq0sg/KLv5ES9w==", + "license": "BSD-3-Clause", + "dependencies": { + "tweetnacl": "^0.14.3" + } + }, + "node_modules/before-after-hook": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-2.2.3.tgz", + "integrity": "sha512-NzUnlZexiaH/46WDhANlyR2bXRopNg4F/zuSA3OpZnllCUgRaOF2znDioDWrmbNVsuZk6l9pMquQB38cfBZwkQ==", + "dev": true, + "license": "Apache-2.0" + }, + "node_modules/bent": { + "version": "7.3.12", + "resolved": "https://registry.npmjs.org/bent/-/bent-7.3.12.tgz", + "integrity": "sha512-T3yrKnVGB63zRuoco/7Ybl7BwwGZR0lceoVG5XmQyMIH9s19SV5m+a8qam4if0zQuAmOQTyPTPmsQBdAorGK3w==", + "license": "Apache-2.0", + "dependencies": { + "bytesish": "^0.4.1", + "caseless": "~0.12.0", + "is-stream": "^2.0.0" + } + }, + "node_modules/big-integer": { + "version": "1.6.52", + "resolved": "https://registry.npmjs.org/big-integer/-/big-integer-1.6.52.tgz", + "integrity": "sha512-QxD8cf2eVqJOOz63z6JIN9BzvVs/dlySa5HGSBH5xtR8dPteIRQnBxxKqkNTiT6jbDTF6jAfrd4oMcND9RGbQg==", + "license": "Unlicense", + "engines": { + "node": ">=0.6" + } + }, + "node_modules/big.js": { + "version": "5.2.2", + "resolved": "https://registry.npmjs.org/big.js/-/big.js-5.2.2.tgz", + "integrity": "sha512-vyL2OymJxmarO8gxMr0mhChsO9QGwhynfuu4+MHTAW6czfq9humCB7rKpUjDd9YUiDPU4mzpyupFSvOClAwbmQ==", + "license": "MIT", + "engines": { + "node": "*" + } + }, + "node_modules/bignumber.js": { + "version": "9.3.1", + "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.3.1.tgz", + "integrity": "sha512-Ko0uX15oIUS7wJ3Rb30Fs6SkVbLmPBAKdlm7q9+ak9bbIeFf0MwuBsQV6z7+X768/cHsfg+WlysDWJcmthjsjQ==", + "license": "MIT", + "engines": { + "node": "*" + } + }, + "node_modules/bin-links": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/bin-links/-/bin-links-5.0.0.tgz", + "integrity": "sha512-sdleLVfCjBtgO5cNjA2HVRvWBJAHs4zwenaCPMNJAJU0yNxpzj80IpjOIimkpkr+mhlA+how5poQtt53PygbHA==", + "dev": true, + "license": "ISC", + "dependencies": { + "cmd-shim": "^7.0.0", + "npm-normalize-package-bin": "^4.0.0", + "proc-log": "^5.0.0", + "read-cmd-shim": "^5.0.0", + "write-file-atomic": "^6.0.0" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/bin-links/node_modules/cmd-shim": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/cmd-shim/-/cmd-shim-7.0.0.tgz", + "integrity": "sha512-rtpaCbr164TPPh+zFdkWpCyZuKkjpAzODfaZCf/SVJZzJN+4bHQb/LP3Jzq5/+84um3XXY8r548XiWKSborwVw==", + "dev": true, + "license": "ISC", + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/bin-links/node_modules/read-cmd-shim": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/read-cmd-shim/-/read-cmd-shim-5.0.0.tgz", + "integrity": "sha512-SEbJV7tohp3DAAILbEMPXavBjAnMN0tVnh4+9G8ihV4Pq3HYF9h8QNez9zkJ1ILkv9G2BjdzwctznGZXgu/HGw==", + "dev": true, + "license": "ISC", + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/bin-links/node_modules/signal-exit": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", + "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/bin-links/node_modules/write-file-atomic": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-6.0.0.tgz", + "integrity": "sha512-GmqrO8WJ1NuzJ2DrziEI2o57jKAVIQNf8a18W3nCYU3H7PNWqCCVTeH6/NQE93CIllIgQS98rrmVkYgTX9fFJQ==", + "dev": true, + "license": "ISC", + "dependencies": { + "imurmurhash": "^0.1.4", + "signal-exit": "^4.0.1" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/binary": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/binary/-/binary-0.3.0.tgz", + "integrity": "sha512-D4H1y5KYwpJgK8wk1Cue5LLPgmwHKYSChkbspQg5JtVuR5ulGckxfR62H3AE9UDkdMC8yyXlqYihuz3Aqg2XZg==", + "license": "MIT", + "dependencies": { + "buffers": "~0.1.1", + "chainsaw": "~0.1.0" + }, + "engines": { + "node": "*" + } + }, + "node_modules/binary-extensions": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz", + "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==", + "license": "MIT", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/bindings": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", + "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", + "license": "MIT", + "dependencies": { + "file-uri-to-path": "1.0.0" + } + }, + "node_modules/bintrees": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/bintrees/-/bintrees-1.0.2.tgz", + "integrity": "sha512-VOMgTMwjAaUG580SXn3LacVgjurrbMme7ZZNYGSSV7mmtY6QQRh0Eg3pwIcntQ77DErK1L0NxkbetjcoXzVwKw==", + "license": "MIT" + }, + "node_modules/bl": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz", + "integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==", + "license": "MIT", + "dependencies": { + "buffer": "^5.5.0", + "inherits": "^2.0.4", + "readable-stream": "^3.4.0" + } + }, + "node_modules/bluebird": { + "version": "3.7.2", + "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz", + "integrity": "sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==", + "dev": true, + "license": "MIT" + }, + "node_modules/bluebird-lst": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/bluebird-lst/-/bluebird-lst-1.0.9.tgz", + "integrity": "sha512-7B1Rtx82hjnSD4PGLAjVWeYH3tHAcVUmChh85a3lltKQm6FresXh9ErQo6oAv6CqxttczC3/kEg8SY5NluPuUw==", + "dev": true, + "license": "MIT", + "dependencies": { + "bluebird": "^3.5.5" + } + }, + "node_modules/body-parser": { + "version": "1.20.4", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.4.tgz", + "integrity": "sha512-ZTgYYLMOXY9qKU/57FAo8F+HA2dGX7bqGc71txDRC1rS4frdFI5R7NhluHxH6M0YItAP0sHB4uqAOcYKxO6uGA==", + "license": "MIT", + "dependencies": { + "bytes": "~3.1.2", + "content-type": "~1.0.5", + "debug": "2.6.9", + "depd": "2.0.0", + "destroy": "~1.2.0", + "http-errors": "~2.0.1", + "iconv-lite": "~0.4.24", + "on-finished": "~2.4.1", + "qs": "~6.14.0", + "raw-body": "~2.5.3", + "type-is": "~1.6.18", + "unpipe": "~1.0.0" + }, + "engines": { + "node": ">= 0.8", + "npm": "1.2.8000 || >= 1.4.16" + } + }, + "node_modules/body-parser/node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "license": "MIT", + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/body-parser/node_modules/iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "license": "MIT", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/body-parser/node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", + "license": "MIT" + }, + "node_modules/boolbase": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz", + "integrity": "sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww==", + "dev": true, + "license": "ISC" + }, + "node_modules/boolean": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/boolean/-/boolean-3.2.0.tgz", + "integrity": "sha512-d0II/GO9uf9lfUHH2BQsjxzRJZBdsjgsBiW4BvhWk/3qoKwQFjIDVN19PfX8F2D/r9PCMTtLWjYVCFrpeYUzsw==", + "deprecated": "Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.", + "license": "MIT", + "optional": true + }, + "node_modules/brace-expansion": { + "version": "1.1.12", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz", + "integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==", + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/braces": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", + "license": "MIT", + "dependencies": { + "fill-range": "^7.1.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/browser-stdout": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", + "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", + "license": "ISC" + }, + "node_modules/browserify-zlib": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/browserify-zlib/-/browserify-zlib-0.1.4.tgz", + "integrity": "sha512-19OEpq7vWgsH6WkvkBJQDFvJS1uPcbFOQ4v9CU839dO+ZZXUZO6XpE6hNCqvlIIj+4fZvRiJ6DsAQ382GwiyTQ==", + "license": "MIT", + "dependencies": { + "pako": "~0.2.0" + } + }, + "node_modules/browserslist": { + "version": "4.28.1", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.28.1.tgz", + "integrity": "sha512-ZC5Bd0LgJXgwGqUknZY/vkUQ04r8NXnJZ3yYi4vDmSiZmC/pdSN0NbNRPxZpbtO4uAfDUAFffO8IZoM3Gj8IkA==", + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/browserslist" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "baseline-browser-mapping": "^2.9.0", + "caniuse-lite": "^1.0.30001759", + "electron-to-chromium": "^1.5.263", + "node-releases": "^2.0.27", + "update-browserslist-db": "^1.2.0" + }, + "bin": { + "browserslist": "cli.js" + }, + "engines": { + "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" + } + }, + "node_modules/buffer": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", + "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT", + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.1.13" + } + }, + "node_modules/buffer-alloc": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/buffer-alloc/-/buffer-alloc-1.2.0.tgz", + "integrity": "sha512-CFsHQgjtW1UChdXgbyJGtnm+O/uLQeZdtbDo8mfUgYXCHSM1wgrVxXm6bSyrUuErEb+4sYVGCzASBRot7zyrow==", + "license": "MIT", + "dependencies": { + "buffer-alloc-unsafe": "^1.1.0", + "buffer-fill": "^1.0.0" + } + }, + "node_modules/buffer-alloc-unsafe": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/buffer-alloc-unsafe/-/buffer-alloc-unsafe-1.1.0.tgz", + "integrity": "sha512-TEM2iMIEQdJ2yjPJoSIsldnleVaAk1oW3DBVUykyOLsEsFmEc9kn+SFFPz+gl54KQNxlDnAwCXosOS9Okx2xAg==", + "license": "MIT" + }, + "node_modules/buffer-crc32": { + "version": "0.2.13", + "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz", + "integrity": "sha512-VO9Ht/+p3SN7SKWqcrgEzjGbRSJYTx+Q1pTQC0wrWqHx0vpJraQ6GtHx8tvcg1rlK1byhU5gccxgOgj7B0TDkQ==", + "license": "MIT", + "engines": { + "node": "*" + } + }, + "node_modules/buffer-equal-constant-time": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz", + "integrity": "sha512-zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA==", + "license": "BSD-3-Clause" + }, + "node_modules/buffer-fill": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/buffer-fill/-/buffer-fill-1.0.0.tgz", + "integrity": "sha512-T7zexNBwiiaCOGDg9xNX9PBmjrubblRkENuptryuI64URkXDFum9il/JGL8Lm8wYfAXpredVXXZz7eMHilimiQ==", + "license": "MIT" + }, + "node_modules/buffer-from": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", + "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", + "license": "MIT" + }, + "node_modules/buffer-indexof-polyfill": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/buffer-indexof-polyfill/-/buffer-indexof-polyfill-1.0.2.tgz", + "integrity": "sha512-I7wzHwA3t1/lwXQh+A5PbNvJxgfo5r3xulgpYDB5zckTu/Z9oUK9biouBKQUjEqzaz3HnAT6TYoovmE+GqSf7A==", + "license": "MIT", + "engines": { + "node": ">=0.10" + } + }, + "node_modules/buffers": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/buffers/-/buffers-0.1.1.tgz", + "integrity": "sha512-9q/rDEGSb/Qsvv2qvzIzdluL5k7AaJOTrw23z9reQthrbF7is4CtlT0DXyO1oei2DCp4uojjzQ7igaSHp1kAEQ==", + "engines": { + "node": ">=0.2.0" + } + }, + "node_modules/buildcheck": { + "version": "0.0.7", + "resolved": "https://registry.npmjs.org/buildcheck/-/buildcheck-0.0.7.tgz", + "integrity": "sha512-lHblz4ahamxpTmnsk+MNTRWsjYKv965MwOrSJyeD588rR3Jcu7swE+0wN5F+PbL5cjgu/9ObkhfzEPuofEMwLA==", + "optional": true, + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/builder-util": { + "version": "25.1.7", + "resolved": "https://registry.npmjs.org/builder-util/-/builder-util-25.1.7.tgz", + "integrity": "sha512-7jPjzBwEGRbwNcep0gGNpLXG9P94VA3CPAZQCzxkFXiV2GMQKlziMbY//rXPI7WKfhsvGgFXjTcXdBEwgXw9ww==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/debug": "^4.1.6", + "7zip-bin": "~5.2.0", + "app-builder-bin": "5.0.0-alpha.10", + "bluebird-lst": "^1.0.9", + "builder-util-runtime": "9.2.10", + "chalk": "^4.1.2", + "cross-spawn": "^7.0.3", + "debug": "^4.3.4", + "fs-extra": "^10.1.0", + "http-proxy-agent": "^7.0.0", + "https-proxy-agent": "^7.0.0", + "is-ci": "^3.0.0", + "js-yaml": "^4.1.0", + "source-map-support": "^0.5.19", + "stat-mode": "^1.0.0", + "temp-file": "^3.4.0" + } + }, + "node_modules/builder-util-runtime": { + "version": "9.2.10", + "resolved": "https://registry.npmjs.org/builder-util-runtime/-/builder-util-runtime-9.2.10.tgz", + "integrity": "sha512-6p/gfG1RJSQeIbz8TK5aPNkoztgY1q5TgmGFMAXcY8itsGW6Y2ld1ALsZ5UJn8rog7hKF3zHx5iQbNQ8uLcRlw==", + "dev": true, + "license": "MIT", + "dependencies": { + "debug": "^4.3.4", + "sax": "^1.2.4" + }, + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/builder-util/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/builder-util/node_modules/fs-extra": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.1.0.tgz", + "integrity": "sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/builder-util/node_modules/jsonfile": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.2.0.tgz", + "integrity": "sha512-FGuPw30AdOIUTRMC2OMRtQV+jkVj2cfPqSeWXv1NEAJ1qZ5zb1X6z1mFhbfOB/iy3ssJCD+3KuZ8r8C3uVFlAg==", + "dev": true, + "license": "MIT", + "dependencies": { + "universalify": "^2.0.0" + }, + "optionalDependencies": { + "graceful-fs": "^4.1.6" + } + }, + "node_modules/builder-util/node_modules/universalify": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz", + "integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 10.0.0" + } + }, + "node_modules/builtin-modules": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz", + "integrity": "sha512-wxXCdllwGhI2kCC0MnvTGYTMvnVZTvqgypkiTI8Pa5tcz2i6VqsqwYGgqwXji+4RgCzms6EajE4IxiUH6HH8nQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/bundle-name": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/bundle-name/-/bundle-name-4.1.0.tgz", + "integrity": "sha512-tjwM5exMg6BGRI+kNmTntNsvdZS1X8BFYS6tnJ2hdH0kVxM6/eVZ2xy+FqStSWvYmtfFMDLIxurorHwDKfDz5Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "run-applescript": "^7.0.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/busboy": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/busboy/-/busboy-1.6.0.tgz", + "integrity": "sha512-8SFQbg/0hQ9xy3UNTB0YEnsNBbWfhf7RtnzpL7TkBiTBRfrQ9Fxcnz7VJsleJpyp6rVLvXiuORqjlHi5q+PYuA==", + "dependencies": { + "streamsearch": "^1.1.0" + }, + "engines": { + "node": ">=10.16.0" + } + }, + "node_modules/byline": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/byline/-/byline-5.0.0.tgz", + "integrity": "sha512-s6webAy+R4SR8XVuJWt2V2rGvhnrhxN+9S15GNuTK3wKPOXFF6RNc+8ug2XhH+2s4f+uudG4kUVYmYOQWL2g0Q==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/byte-size": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/byte-size/-/byte-size-8.1.1.tgz", + "integrity": "sha512-tUkzZWK0M/qdoLEqikxBWe4kumyuwjl3HO6zHTr4yEI23EojPtLYXdG1+AQY7MN0cGyNDvEaJ8wiYQm6P2bPxg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12.17" + } + }, + "node_modules/bytes": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", + "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/bytesish": { + "version": "0.4.4", + "resolved": "https://registry.npmjs.org/bytesish/-/bytesish-0.4.4.tgz", + "integrity": "sha512-i4uu6M4zuMUiyfZN4RU2+i9+peJh//pXhd9x1oSe1LBkZ3LEbCoygu8W0bXTukU1Jme2txKuotpCZRaC3FLxcQ==", + "license": "(Apache-2.0 AND MIT)" + }, + "node_modules/cacache": { + "version": "20.0.3", + "resolved": "https://registry.npmjs.org/cacache/-/cacache-20.0.3.tgz", + "integrity": "sha512-3pUp4e8hv07k1QlijZu6Kn7c9+ZpWWk4j3F8N3xPuCExULobqJydKYOTj1FTq58srkJsXvO7LbGAH4C0ZU3WGw==", + "dev": true, + "license": "ISC", + "dependencies": { + "@npmcli/fs": "^5.0.0", + "fs-minipass": "^3.0.0", + "glob": "^13.0.0", + "lru-cache": "^11.1.0", + "minipass": "^7.0.3", + "minipass-collect": "^2.0.1", + "minipass-flush": "^1.0.5", + "minipass-pipeline": "^1.2.4", + "p-map": "^7.0.2", + "ssri": "^13.0.0", + "unique-filename": "^5.0.0" + }, + "engines": { + "node": "^20.17.0 || >=22.9.0" + } + }, + "node_modules/cacache/node_modules/@npmcli/fs": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@npmcli/fs/-/fs-5.0.0.tgz", + "integrity": "sha512-7OsC1gNORBEawOa5+j2pXN9vsicaIOH5cPXxoR6fJOmH6/EXpJB2CajXOu1fPRFun2m1lktEFX11+P89hqO/og==", + "dev": true, + "license": "ISC", + "dependencies": { + "semver": "^7.3.5" + }, + "engines": { + "node": "^20.17.0 || >=22.9.0" + } + }, + "node_modules/cacache/node_modules/glob": { + "version": "13.0.2", + "resolved": "https://registry.npmjs.org/glob/-/glob-13.0.2.tgz", + "integrity": "sha512-035InabNu/c1lW0tzPhAgapKctblppqsKKG9ZaNzbr+gXwWMjXoiyGSyB9sArzrjG7jY+zntRq5ZSUYemrnWVQ==", + "dev": true, + "license": "BlueOak-1.0.0", + "dependencies": { + "minimatch": "^10.1.2", + "minipass": "^7.1.2", + "path-scurry": "^2.0.0" + }, + "engines": { + "node": "20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/cacache/node_modules/lru-cache": { + "version": "11.2.6", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.2.6.tgz", + "integrity": "sha512-ESL2CrkS/2wTPfuend7Zhkzo2u0daGJ/A2VucJOgQ/C48S/zB8MMeMHSGKYpXhIjbPxfuezITkaBH1wqv00DDQ==", + "dev": true, + "license": "BlueOak-1.0.0", + "engines": { + "node": "20 || >=22" + } + }, + "node_modules/cacache/node_modules/p-map": { + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/p-map/-/p-map-7.0.4.tgz", + "integrity": "sha512-tkAQEw8ysMzmkhgw8k+1U/iPhWNhykKnSk4Rd5zLoPJCuJaGRPo6YposrZgaxHKzDHdDWWZvE/Sk7hsL2X/CpQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/cacache/node_modules/ssri": { + "version": "13.0.1", + "resolved": "https://registry.npmjs.org/ssri/-/ssri-13.0.1.tgz", + "integrity": "sha512-QUiRf1+u9wPTL/76GTYlKttDEBWV1ga9ZXW8BG6kfdeyyM8LGPix9gROyg9V2+P0xNyF3X2Go526xKFdMZrHSQ==", + "dev": true, + "license": "ISC", + "dependencies": { + "minipass": "^7.0.3" + }, + "engines": { + "node": "^20.17.0 || >=22.9.0" + } + }, + "node_modules/cacheable-lookup": { + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/cacheable-lookup/-/cacheable-lookup-5.0.4.tgz", + "integrity": "sha512-2/kNscPhpcxrOigMZzbiWF7dz8ilhb/nIHU3EyZiXWXpeq/au8qJ8VhdftMkty3n7Gj6HIGalQG8oiBNB3AJgA==", + "license": "MIT", + "engines": { + "node": ">=10.6.0" + } + }, + "node_modules/cacheable-request": { + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-7.0.4.tgz", + "integrity": "sha512-v+p6ongsrp0yTGbJXjgxPow2+DL93DASP4kXCDKb8/bwRtt9OEF3whggkkDkGNzgcWy2XaF4a8nZglC7uElscg==", + "license": "MIT", + "dependencies": { + "clone-response": "^1.0.2", + "get-stream": "^5.1.0", + "http-cache-semantics": "^4.0.0", + "keyv": "^4.0.0", + "lowercase-keys": "^2.0.0", + "normalize-url": "^6.0.1", + "responselike": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/cacheable-request/node_modules/get-stream": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", + "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", + "license": "MIT", + "dependencies": { + "pump": "^3.0.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/caching-transform": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/caching-transform/-/caching-transform-4.0.0.tgz", + "integrity": "sha512-kpqOvwXnjjN44D89K5ccQC+RUrsy7jB/XLlRrx0D7/2HNcTPqzsb6XgYoErwko6QsV184CA2YgS1fxDiiDZMWA==", + "dev": true, + "license": "MIT", + "dependencies": { + "hasha": "^5.0.0", + "make-dir": "^3.0.0", + "package-hash": "^4.0.0", + "write-file-atomic": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/caching-transform/node_modules/make-dir": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", + "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", + "dev": true, + "license": "MIT", + "dependencies": { + "semver": "^6.0.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/caching-transform/node_modules/semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/caching-transform/node_modules/write-file-atomic": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-3.0.3.tgz", + "integrity": "sha512-AvHcyZ5JnSfq3ioSyjrBkH9yW4m7Ayk8/9My/DD9onKeu/94fwrMocemO2QAJFAlnnDN+ZDS+ZjAR5ua1/PV/Q==", + "dev": true, + "license": "ISC", + "dependencies": { + "imurmurhash": "^0.1.4", + "is-typedarray": "^1.0.0", + "signal-exit": "^3.0.2", + "typedarray-to-buffer": "^3.1.5" + } + }, + "node_modules/call-bind": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.8.tgz", + "integrity": "sha512-oKlSFMcMwpUg2ednkhQ454wfWiU/ul3CkJe/PEHcTKuiX6RpbehUiFMXu13HalGZxfUwCQzZG747YXBn1im9ww==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.0", + "es-define-property": "^1.0.0", + "get-intrinsic": "^1.2.4", + "set-function-length": "^1.2.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/call-bind-apply-helpers": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz", + "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/call-bound": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz", + "integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "get-intrinsic": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/camelcase": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", + "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/camelcase-keys": { + "version": "6.2.2", + "resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-6.2.2.tgz", + "integrity": "sha512-YrwaA0vEKazPBkn0ipTiMpSajYDSe+KjQfrjhcBMxJt/znbvlHd8Pw/Vamaz5EB4Wfhs3SUR3Z9mwRu/P3s3Yg==", + "dev": true, + "license": "MIT", + "dependencies": { + "camelcase": "^5.3.1", + "map-obj": "^4.0.0", + "quick-lru": "^4.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/caniuse-lite": { + "version": "1.0.30001769", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001769.tgz", + "integrity": "sha512-BCfFL1sHijQlBGWBMuJyhZUhzo7wer5sVj9hqekB/7xn0Ypy+pER/edCYQm4exbXj4WiySGp40P8UuTh6w1srg==", + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/caniuse-lite" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "CC-BY-4.0" + }, + "node_modules/caseless": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", + "integrity": "sha512-4tYFyifaFfGacoiObjJegolkwSU4xQNGbVgUiNYVUxbQ2x2lUsFvY4hVgVzGiIe6WLOPqycWXA40l+PWsxthUw==", + "license": "Apache-2.0" + }, + "node_modules/chai": { + "version": "4.3.10", + "resolved": "https://registry.npmjs.org/chai/-/chai-4.3.10.tgz", + "integrity": "sha512-0UXG04VuVbruMUYbJ6JctvH0YnC/4q3/AkT18q4NaITo91CUm0liMS9VqzT9vZhVQ/1eqPanMWjBM+Juhfb/9g==", + "license": "MIT", + "dependencies": { + "assertion-error": "^1.1.0", + "check-error": "^1.0.3", + "deep-eql": "^4.1.3", + "get-func-name": "^2.0.2", + "loupe": "^2.3.6", + "pathval": "^1.1.1", + "type-detect": "^4.0.8" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/chai-spies": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/chai-spies/-/chai-spies-1.0.0.tgz", + "integrity": "sha512-elF2ZUczBsFoP07qCfMO/zeggs8pqCf3fZGyK5+2X4AndS8jycZYID91ztD9oQ7d/0tnS963dPkd0frQEThDsg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 4.0.0" + }, + "peerDependencies": { + "chai": "*" + } + }, + "node_modules/chai-string": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/chai-string/-/chai-string-1.6.0.tgz", + "integrity": "sha512-sXV7whDmpax+8H++YaZelgin7aur1LGf9ZhjZa3ojETFJ0uPVuS4XEXuIagpZ/c8uVOtsSh4MwOjy5CBLjJSXA==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "chai": "^4.1.2" + } + }, + "node_modules/chainsaw": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/chainsaw/-/chainsaw-0.1.0.tgz", + "integrity": "sha512-75kWfWt6MEKNC8xYXIdRpDehRYY/tNSgwKaJq+dbbDcxORuVrrQ+SEHoWsniVn9XPYfP4gmdWIeDk/4YNp1rNQ==", + "license": "MIT/X11", + "dependencies": { + "traverse": ">=0.3.0 <0.4" + }, + "engines": { + "node": "*" + } + }, + "node_modules/chalk": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.0.0.tgz", + "integrity": "sha512-N9oWFcegS0sFr9oh1oz2d7Npos6vNoWW9HvtCg5N1KRFpUhaAhvTv5Y58g880fZaEYSNm3qDz8SU1UrGvp+n7A==", + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/chardet": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/chardet/-/chardet-2.1.1.tgz", + "integrity": "sha512-PsezH1rqdV9VvyNhxxOW32/d75r01NY7TQCmOqomRo15ZSOKbpTFVsfjghxo6JloQUCGnH4k1LGu0R4yCLlWQQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/charenc": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/charenc/-/charenc-0.0.2.tgz", + "integrity": "sha512-yrLQ/yVUFXkzg7EDQsPieE/53+0RlaWTs+wBrvW36cyilJ2SaDWfl4Yj7MtLTXleV9uEKefbAGUPv2/iWSooRA==", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": "*" + } + }, + "node_modules/check-error": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.3.tgz", + "integrity": "sha512-iKEoDYaRmd1mxM90a2OEfWhjsjPpYPuQ+lMYsoxB126+t8fw7ySEO48nmDg5COTjxDI65/Y2OWpeEHk3ZOe8zg==", + "license": "MIT", + "dependencies": { + "get-func-name": "^2.0.2" + }, + "engines": { + "node": "*" + } + }, + "node_modules/cheerio": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/cheerio/-/cheerio-1.2.0.tgz", + "integrity": "sha512-WDrybc/gKFpTYQutKIK6UvfcuxijIZfMfXaYm8NMsPQxSYvf+13fXUJ4rztGGbJcBQ/GF55gvrZ0Bc0bj/mqvg==", + "dev": true, + "license": "MIT", + "dependencies": { + "cheerio-select": "^2.1.0", + "dom-serializer": "^2.0.0", + "domhandler": "^5.0.3", + "domutils": "^3.2.2", + "encoding-sniffer": "^0.2.1", + "htmlparser2": "^10.1.0", + "parse5": "^7.3.0", + "parse5-htmlparser2-tree-adapter": "^7.1.0", + "parse5-parser-stream": "^7.1.2", + "undici": "^7.19.0", + "whatwg-mimetype": "^4.0.0" + }, + "engines": { + "node": ">=20.18.1" + }, + "funding": { + "url": "https://github.com/cheeriojs/cheerio?sponsor=1" + } + }, + "node_modules/cheerio-select": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/cheerio-select/-/cheerio-select-2.1.0.tgz", + "integrity": "sha512-9v9kG0LvzrlcungtnJtpGNxY+fzECQKhK4EGJX2vByejiMX84MFNQw4UxPJl3bFbTMw+Dfs37XaIkCwTZfLh4g==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "boolbase": "^1.0.0", + "css-select": "^5.1.0", + "css-what": "^6.1.0", + "domelementtype": "^2.3.0", + "domhandler": "^5.0.3", + "domutils": "^3.0.1" + }, + "funding": { + "url": "https://github.com/sponsors/fb55" + } + }, + "node_modules/chokidar": { + "version": "3.5.3", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", + "integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==", + "funding": [ + { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + ], + "license": "MIT", + "dependencies": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + }, + "engines": { + "node": ">= 8.10.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, + "node_modules/chokidar/node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/chownr": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/chownr/-/chownr-3.0.0.tgz", + "integrity": "sha512-+IxzY9BZOQd/XuYPRmrvEVjF/nqj5kgT4kEq7VofrDoM1MxoRjEWkrCC3EtLi59TVawxTAn+orJwFQcrqEN1+g==", + "dev": true, + "license": "BlueOak-1.0.0", + "engines": { + "node": ">=18" + } + }, + "node_modules/chrome-trace-event": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/chrome-trace-event/-/chrome-trace-event-1.0.4.tgz", + "integrity": "sha512-rNjApaLzuwaOTjCiT8lSDdGN1APCiqkChLMJxJPWLunPAt5fy8xgU9/jNOchV84wfIxrA0lRQB7oCT8jrn/wrQ==", + "license": "MIT", + "engines": { + "node": ">=6.0" + } + }, + "node_modules/chromium-bidi": { + "version": "0.6.4", + "resolved": "https://registry.npmjs.org/chromium-bidi/-/chromium-bidi-0.6.4.tgz", + "integrity": "sha512-8zoq6ogmhQQkAKZVKO2ObFTl4uOkqoX1PlKQX3hZQ5E9cbUotcAb7h4pTNVAGGv8Z36PF3CtdOriEp/Rz82JqQ==", + "license": "Apache-2.0", + "dependencies": { + "mitt": "3.0.1", + "urlpattern-polyfill": "10.0.0", + "zod": "3.23.8" + }, + "peerDependencies": { + "devtools-protocol": "*" + } + }, + "node_modules/chromium-pickle-js": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/chromium-pickle-js/-/chromium-pickle-js-0.2.0.tgz", + "integrity": "sha512-1R5Fho+jBq0DDydt+/vHWj5KJNJCKdARKOCwZUen84I5BreWoLqRLANH1U87eJy1tiASPtMnGqJJq0ZsLoRPOw==", + "dev": true, + "license": "MIT" + }, + "node_modules/ci-info": { + "version": "3.9.0", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.9.0.tgz", + "integrity": "sha512-NIxF55hv4nSqQswkAeiOi1r83xy8JldOFDTWiug55KBu9Jnblncd2U6ViHmYgHf01TPZS77NJBhBMKdWj9HQMQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/sibiraj-s" + } + ], + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/clean-stack": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-2.2.0.tgz", + "integrity": "sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/cli-cursor": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-3.1.0.tgz", + "integrity": "sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==", + "license": "MIT", + "dependencies": { + "restore-cursor": "^3.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/cli-progress": { + "version": "3.12.0", + "resolved": "https://registry.npmjs.org/cli-progress/-/cli-progress-3.12.0.tgz", + "integrity": "sha512-tRkV3HJ1ASwm19THiiLIXLO7Im7wlTuKnvkYaTkyoAPefqjNg7W7DHKUlGRxy9vxDvbyCYQkQozvptuMkGCg8A==", + "license": "MIT", + "dependencies": { + "string-width": "^4.2.3" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/cli-spinners": { + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/cli-spinners/-/cli-spinners-2.6.1.tgz", + "integrity": "sha512-x/5fWmGMnbKQAaNwN+UZlV79qBLM9JFnJuJ03gIi5whrob0xV0ofNVHy9DhwGdsMJQc2OKv0oGmLzvaqvAVv+g==", + "license": "MIT", + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/cli-truncate": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/cli-truncate/-/cli-truncate-2.1.0.tgz", + "integrity": "sha512-n8fOixwDD6b/ObinzTrp1ZKFzbgvKZvuz/TvejnLn1aQfC6r52XEx85FmuC+3HI+JM7coBRXUvNqEU2PHVrHpg==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "slice-ansi": "^3.0.0", + "string-width": "^4.2.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/cli-width": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-4.1.0.tgz", + "integrity": "sha512-ouuZd4/dm2Sw5Gmqy6bGyNNNe1qt9RpmxveLSO7KcgsTnU7RXfsw+/bukWGo1abgBiMAic068rclZsO4IWmmxQ==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">= 12" + } + }, + "node_modules/cliui": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", + "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", + "license": "ISC", + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.1", + "wrap-ansi": "^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/cliui/node_modules/wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/clone": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/clone/-/clone-2.1.2.tgz", + "integrity": "sha512-3Pe/CF1Nn94hyhIYpjtiLhdCoEoz0DqQ+988E9gmeEdQZlojxnOb74wctFyuwWQHzqyf9X7C7MG8juUpqBJT8w==", + "license": "MIT", + "engines": { + "node": ">=0.8" + } + }, + "node_modules/clone-deep": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/clone-deep/-/clone-deep-4.0.1.tgz", + "integrity": "sha512-neHB9xuzh/wk0dIHweyAXv2aPGZIVk3pLMe+/RNzINf17fe0OG96QroktYAUm7SM1PBnzTabaLboqqxDyMU+SQ==", + "license": "MIT", + "dependencies": { + "is-plain-object": "^2.0.4", + "kind-of": "^6.0.2", + "shallow-clone": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/clone-response": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/clone-response/-/clone-response-1.0.3.tgz", + "integrity": "sha512-ROoL94jJH2dUVML2Y/5PEDNaSHgeOdSDicUyS7izcF63G6sTc/FTjLub4b8Il9S8S0beOfYt0TaA5qvFK+w0wA==", + "license": "MIT", + "dependencies": { + "mimic-response": "^1.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/clone-response/node_modules/mimic-response": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz", + "integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==", + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/cmd-shim": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/cmd-shim/-/cmd-shim-6.0.3.tgz", + "integrity": "sha512-FMabTRlc5t5zjdenF6mS0MBeFZm0XqHqeOkcskKFb/LYCcRQ5fVgLOHVc4Lq9CqABd9zhjwPjMBCJvMCziSVtA==", + "dev": true, + "license": "ISC", + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/cockatiel": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/cockatiel/-/cockatiel-3.2.1.tgz", + "integrity": "sha512-gfrHV6ZPkquExvMh9IOkKsBzNDk6sDuZ6DdBGUBkvFnTCqCxzpuq48RySgP0AnaqQkw2zynOFj9yly6T1Q2G5Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=16" + } + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "license": "MIT", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "license": "MIT" + }, + "node_modules/color-support": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-support/-/color-support-1.1.3.tgz", + "integrity": "sha512-qiBjkpbMLO/HL68y+lh4q0/O1MZFj2RX6X/KmMa3+gJD3z+WwI1ZzDHysvqHGS3mP6mznPckpXmw1nI9cJjyRg==", + "dev": true, + "license": "ISC", + "bin": { + "color-support": "bin.js" + } + }, + "node_modules/colorette": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/colorette/-/colorette-1.4.0.tgz", + "integrity": "sha512-Y2oEozpomLn7Q3HFP7dpww7AtMJplbM9lGZP6RDfHqmbeRjiwRg4n6VM6j4KLmRke85uWEI7JqF17f3pqdRA0g==", + "license": "MIT" + }, + "node_modules/columnify": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/columnify/-/columnify-1.6.0.tgz", + "integrity": "sha512-lomjuFZKfM6MSAnV9aCZC9sc0qGbmZdfygNv+nCpqVkSKdCxCklLtd16O0EILGkImHw9ZpHkAnHaB+8Zxq5W6Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "strip-ansi": "^6.0.1", + "wcwidth": "^1.0.0" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "license": "MIT", + "dependencies": { + "delayed-stream": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/comlink": { + "version": "4.4.2", + "resolved": "https://registry.npmjs.org/comlink/-/comlink-4.4.2.tgz", + "integrity": "sha512-OxGdvBmJuNKSCMO4NTl1L47VRp6xn2wG4F/2hYzB6tiCb709otOxtEYCSvK80PtjODfXXZu8ds+Nw5kVCjqd2g==", + "license": "Apache-2.0" + }, + "node_modules/commander": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-6.2.1.tgz", + "integrity": "sha512-U7VdrJFnJgo4xjrHpTzu0yrHPGImdsmD95ZlgYSEajAn2JKzDhDTPG9kBTefmObL2w/ngeZnilk+OV9CG3d7UA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 6" + } + }, + "node_modules/common-ancestor-path": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/common-ancestor-path/-/common-ancestor-path-1.0.1.tgz", + "integrity": "sha512-L3sHRo1pXXEqX8VU28kfgUY+YGsk09hPqZiZmLacNib6XNTCM8ubYeT7ryXQw8asB1sKgcU5lkB7ONug08aB8w==", + "dev": true, + "license": "ISC" + }, + "node_modules/commondir": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", + "integrity": "sha512-W9pAhw0ja1Edb5GVdIF1mjZw/ASI0AlShXM83UUGe2DVr5TdAPEA1OA8m/g8zWp9x6On7gqufY+FatDbC3MDQg==", + "license": "MIT" + }, + "node_modules/compare-func": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/compare-func/-/compare-func-2.0.0.tgz", + "integrity": "sha512-zHig5N+tPWARooBnb0Zx1MFcdfpyJrfTJ3Y5L+IFvUm8rM74hHz66z0gw0x4tijh5CorKkKUCnW82R2vmpeCRA==", + "dev": true, + "license": "MIT", + "dependencies": { + "array-ify": "^1.0.0", + "dot-prop": "^5.1.0" + } + }, + "node_modules/compare-version": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/compare-version/-/compare-version-0.1.2.tgz", + "integrity": "sha512-pJDh5/4wrEnXX/VWRZvruAGHkzKdr46z11OlTPN+VrATlWWhSKewNCJ1futCO5C7eJB3nPMFZA1LeYtcFboZ2A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/compress-commons": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/compress-commons/-/compress-commons-4.1.2.tgz", + "integrity": "sha512-D3uMHtGc/fcO1Gt1/L7i1e33VOvD4A9hfQLP+6ewd+BvG/gQ84Yh4oftEhAdjSMgBgwGL+jsppT7JYNpo6MHHg==", + "license": "MIT", + "dependencies": { + "buffer-crc32": "^0.2.13", + "crc32-stream": "^4.0.2", + "normalize-path": "^3.0.0", + "readable-stream": "^3.6.0" + }, + "engines": { + "node": ">= 10" + } + }, + "node_modules/compression-webpack-plugin": { + "version": "9.2.0", + "resolved": "https://registry.npmjs.org/compression-webpack-plugin/-/compression-webpack-plugin-9.2.0.tgz", + "integrity": "sha512-R/Oi+2+UHotGfu72fJiRoVpuRifZT0tTC6UqFD/DUo+mv8dbOow9rVOuTvDv5nPPm3GZhHL/fKkwxwIHnJ8Nyw==", + "license": "MIT", + "dependencies": { + "schema-utils": "^4.0.0", + "serialize-javascript": "^6.0.0" + }, + "engines": { + "node": ">= 12.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + }, + "peerDependencies": { + "webpack": "^5.1.0" + } + }, + "node_modules/compression-webpack-plugin/node_modules/ajv": { + "version": "8.17.1", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.17.1.tgz", + "integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==", + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^3.1.3", + "fast-uri": "^3.0.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/compression-webpack-plugin/node_modules/ajv-formats": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ajv-formats/-/ajv-formats-2.1.1.tgz", + "integrity": "sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA==", + "license": "MIT", + "dependencies": { + "ajv": "^8.0.0" + }, + "peerDependencies": { + "ajv": "^8.0.0" + }, + "peerDependenciesMeta": { + "ajv": { + "optional": true + } + } + }, + "node_modules/compression-webpack-plugin/node_modules/ajv-keywords": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-5.1.0.tgz", + "integrity": "sha512-YCS/JNFAUyr5vAuhk1DWm1CBxRHW9LbJ2ozWeemrIqpbsqKjHVxYPyi5GC0rjZIT5JxJ3virVTS8wk4i/Z+krw==", + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^3.1.3" + }, + "peerDependencies": { + "ajv": "^8.8.2" + } + }, + "node_modules/compression-webpack-plugin/node_modules/json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "license": "MIT" + }, + "node_modules/compression-webpack-plugin/node_modules/schema-utils": { + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-4.3.3.tgz", + "integrity": "sha512-eflK8wEtyOE6+hsaRVPxvUKYCpRgzLqDTb8krvAsRIwOGlHoSgYLgBXoubGgLd2fT41/OUYdb48v4k4WWHQurA==", + "license": "MIT", + "dependencies": { + "@types/json-schema": "^7.0.9", + "ajv": "^8.9.0", + "ajv-formats": "^2.1.1", + "ajv-keywords": "^5.1.0" + }, + "engines": { + "node": ">= 10.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + } + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "license": "MIT" + }, + "node_modules/concat-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-2.0.0.tgz", + "integrity": "sha512-MWufYdFw53ccGjCA+Ol7XJYpAlW6/prSMzuPOTRnJGcGzuhLn4Scrz7qf6o8bROZ514ltazcIFJZevcfbo0x7A==", + "engines": [ + "node >= 6.0" + ], + "license": "MIT", + "dependencies": { + "buffer-from": "^1.0.0", + "inherits": "^2.0.3", + "readable-stream": "^3.0.2", + "typedarray": "^0.0.6" + } + }, + "node_modules/concurrently": { + "version": "3.6.1", + "resolved": "https://registry.npmjs.org/concurrently/-/concurrently-3.6.1.tgz", + "integrity": "sha512-/+ugz+gwFSEfTGUxn0KHkY+19XPRTXR8+7oUK/HxgiN1n7FjeJmkrbSiXAJfyQ0zORgJYPaenmymwon51YXH9Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "chalk": "^2.4.1", + "commander": "2.6.0", + "date-fns": "^1.23.0", + "lodash": "^4.5.1", + "read-pkg": "^3.0.0", + "rx": "2.3.24", + "spawn-command": "^0.0.2-1", + "supports-color": "^3.2.3", + "tree-kill": "^1.1.0" + }, + "bin": { + "concurrent": "src/main.js", + "concurrently": "src/main.js" + }, + "engines": { + "node": ">=4.0.0" + } + }, + "node_modules/concurrently/node_modules/ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "license": "MIT", + "dependencies": { + "color-convert": "^1.9.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/concurrently/node_modules/chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/concurrently/node_modules/chalk/node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/concurrently/node_modules/chalk/node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/concurrently/node_modules/color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "license": "MIT", + "dependencies": { + "color-name": "1.1.3" + } + }, + "node_modules/concurrently/node_modules/color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", + "dev": true, + "license": "MIT" + }, + "node_modules/concurrently/node_modules/commander": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.6.0.tgz", + "integrity": "sha512-PhbTMT+ilDXZKqH8xbvuUY2ZEQNef0Q7DKxgoEKb4ccytsdvVVJmYqR0sGbi96nxU6oGrwEIQnclpK2NBZuQlg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.6.x" + } + }, + "node_modules/concurrently/node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/concurrently/node_modules/has-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-1.0.0.tgz", + "integrity": "sha512-DyYHfIYwAJmjAjSSPKANxI8bFY9YtFrgkAfinBojQ8YJTOuOuav64tMUJv584SES4xl74PmuaevIyaLESHdTAA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/concurrently/node_modules/supports-color": { + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-3.2.3.tgz", + "integrity": "sha512-Jds2VIYDrlp5ui7t8abHN2bjAu4LV/q4N2KivFPpGH0lrka0BMq/33AmECUXlKPcHigkNaqfXRENFju+rlcy+A==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^1.0.0" + }, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/conf": { + "version": "10.2.0", + "resolved": "https://registry.npmjs.org/conf/-/conf-10.2.0.tgz", + "integrity": "sha512-8fLl9F04EJqjSqH+QjITQfJF8BrOVaYr1jewVgSRAEWePfxT0sku4w2hrGQ60BC/TNLGQ2pgxNlTbWQmMPFvXg==", + "license": "MIT", + "dependencies": { + "ajv": "^8.6.3", + "ajv-formats": "^2.1.1", + "atomically": "^1.7.0", + "debounce-fn": "^4.0.0", + "dot-prop": "^6.0.1", + "env-paths": "^2.2.1", + "json-schema-typed": "^7.0.3", + "onetime": "^5.1.2", + "pkg-up": "^3.1.0", + "semver": "^7.3.5" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/conf/node_modules/ajv": { + "version": "8.17.1", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.17.1.tgz", + "integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==", + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^3.1.3", + "fast-uri": "^3.0.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/conf/node_modules/ajv-formats": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ajv-formats/-/ajv-formats-2.1.1.tgz", + "integrity": "sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA==", + "license": "MIT", + "dependencies": { + "ajv": "^8.0.0" + }, + "peerDependencies": { + "ajv": "^8.0.0" + }, + "peerDependenciesMeta": { + "ajv": { + "optional": true + } + } + }, + "node_modules/conf/node_modules/dot-prop": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-6.0.1.tgz", + "integrity": "sha512-tE7ztYzXHIeyvc7N+hR3oi7FIbf/NIjVP9hmAt3yMXzrQ072/fpjGLx2GxNxGxUl5V73MEqYzioOMoVhGMJ5cA==", + "license": "MIT", + "dependencies": { + "is-obj": "^2.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/conf/node_modules/json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "license": "MIT" + }, + "node_modules/conf/node_modules/json-schema-typed": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/json-schema-typed/-/json-schema-typed-7.0.3.tgz", + "integrity": "sha512-7DE8mpG+/fVw+dTpjbxnx47TaMnDfOI1jwft9g1VybltZCduyRQPJPvc+zzKY9WPHxhPWczyFuYa6I8Mw4iU5A==", + "license": "BSD-2-Clause" + }, + "node_modules/config-file-ts": { + "version": "0.2.8-rc1", + "resolved": "https://registry.npmjs.org/config-file-ts/-/config-file-ts-0.2.8-rc1.tgz", + "integrity": "sha512-GtNECbVI82bT4RiDIzBSVuTKoSHufnU7Ce7/42bkWZJZFLjmDF2WBpVsvRkhKCfKBnTBb3qZrBwPpFBU/Myvhg==", + "dev": true, + "license": "MIT", + "dependencies": { + "glob": "^10.3.12", + "typescript": "^5.4.3" + } + }, + "node_modules/config-file-ts/node_modules/@isaacs/cliui": { + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", + "integrity": "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==", + "dev": true, + "license": "ISC", + "dependencies": { + "string-width": "^5.1.2", + "string-width-cjs": "npm:string-width@^4.2.0", + "strip-ansi": "^7.0.1", + "strip-ansi-cjs": "npm:strip-ansi@^6.0.1", + "wrap-ansi": "^8.1.0", + "wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/config-file-ts/node_modules/ansi-regex": { + "version": "6.2.2", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.2.2.tgz", + "integrity": "sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" + } + }, + "node_modules/config-file-ts/node_modules/ansi-styles": { + "version": "6.2.3", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.3.tgz", + "integrity": "sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/config-file-ts/node_modules/brace-expansion": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz", + "integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/config-file-ts/node_modules/emoji-regex": { + "version": "9.2.2", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", + "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", + "dev": true, + "license": "MIT" + }, + "node_modules/config-file-ts/node_modules/glob": { + "version": "10.5.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-10.5.0.tgz", + "integrity": "sha512-DfXN8DfhJ7NH3Oe7cFmu3NCu1wKbkReJ8TorzSAFbSKrlNaQSKfIzqYqVY8zlbs2NLBbWpRiU52GX2PbaBVNkg==", + "deprecated": "Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me", + "dev": true, + "license": "ISC", + "dependencies": { + "foreground-child": "^3.1.0", + "jackspeak": "^3.1.2", + "minimatch": "^9.0.4", + "minipass": "^7.1.2", + "package-json-from-dist": "^1.0.0", + "path-scurry": "^1.11.1" + }, + "bin": { + "glob": "dist/esm/bin.mjs" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/config-file-ts/node_modules/jackspeak": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-3.4.3.tgz", + "integrity": "sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw==", + "dev": true, + "license": "BlueOak-1.0.0", + "dependencies": { + "@isaacs/cliui": "^8.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + }, + "optionalDependencies": { + "@pkgjs/parseargs": "^0.11.0" + } + }, + "node_modules/config-file-ts/node_modules/lru-cache": { + "version": "10.4.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.4.3.tgz", + "integrity": "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==", + "dev": true, + "license": "ISC" + }, + "node_modules/config-file-ts/node_modules/minimatch": { + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", + "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/config-file-ts/node_modules/path-scurry": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.11.1.tgz", + "integrity": "sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==", + "dev": true, + "license": "BlueOak-1.0.0", + "dependencies": { + "lru-cache": "^10.2.0", + "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0" + }, + "engines": { + "node": ">=16 || 14 >=14.18" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/config-file-ts/node_modules/string-width": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", + "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", + "dev": true, + "license": "MIT", + "dependencies": { + "eastasianwidth": "^0.2.0", + "emoji-regex": "^9.2.2", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/config-file-ts/node_modules/strip-ansi": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.2.tgz", + "integrity": "sha512-gmBGslpoQJtgnMAvOVqGZpEz9dyoKTCzy2nfz/n8aIFhN/jCE/rCmcxabB6jOOHV+0WNnylOxaxBQPSvcWklhA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^6.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" + } + }, + "node_modules/config-file-ts/node_modules/wrap-ansi": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", + "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^6.1.0", + "string-width": "^5.0.1", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/console-control-strings": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", + "integrity": "sha512-ty/fTekppD2fIwRvnZAVdeOiGd1c7YXEixbgJTNzqcxJWKQnjJ/V1bNEEE6hygpM3WjwHFUVK6HTjWSzV4a8sQ==", + "dev": true, + "license": "ISC" + }, + "node_modules/content-disposition": { + "version": "0.5.4", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz", + "integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==", + "license": "MIT", + "dependencies": { + "safe-buffer": "5.2.1" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/content-type": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz", + "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/conventional-changelog-angular": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/conventional-changelog-angular/-/conventional-changelog-angular-7.0.0.tgz", + "integrity": "sha512-ROjNchA9LgfNMTTFSIWPzebCwOGFdgkEq45EnvvrmSLvCtAw0HSmrCs7/ty+wAeYUZyNay0YMUNYFTRL72PkBQ==", + "dev": true, + "license": "ISC", + "dependencies": { + "compare-func": "^2.0.0" + }, + "engines": { + "node": ">=16" + } + }, + "node_modules/conventional-changelog-core": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/conventional-changelog-core/-/conventional-changelog-core-5.0.1.tgz", + "integrity": "sha512-Rvi5pH+LvgsqGwZPZ3Cq/tz4ty7mjijhr3qR4m9IBXNbxGGYgTVVO+duXzz9aArmHxFtwZ+LRkrNIMDQzgoY4A==", + "dev": true, + "license": "MIT", + "dependencies": { + "add-stream": "^1.0.0", + "conventional-changelog-writer": "^6.0.0", + "conventional-commits-parser": "^4.0.0", + "dateformat": "^3.0.3", + "get-pkg-repo": "^4.2.1", + "git-raw-commits": "^3.0.0", + "git-remote-origin-url": "^2.0.0", + "git-semver-tags": "^5.0.0", + "normalize-package-data": "^3.0.3", + "read-pkg": "^3.0.0", + "read-pkg-up": "^3.0.0" + }, + "engines": { + "node": ">=14" + } + }, + "node_modules/conventional-changelog-preset-loader": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/conventional-changelog-preset-loader/-/conventional-changelog-preset-loader-3.0.0.tgz", + "integrity": "sha512-qy9XbdSLmVnwnvzEisjxdDiLA4OmV3o8db+Zdg4WiFw14fP3B6XNz98X0swPPpkTd/pc1K7+adKgEDM1JCUMiA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=14" + } + }, + "node_modules/conventional-changelog-writer": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/conventional-changelog-writer/-/conventional-changelog-writer-6.0.1.tgz", + "integrity": "sha512-359t9aHorPw+U+nHzUXHS5ZnPBOizRxfQsWT5ZDHBfvfxQOAik+yfuhKXG66CN5LEWPpMNnIMHUTCKeYNprvHQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "conventional-commits-filter": "^3.0.0", + "dateformat": "^3.0.3", + "handlebars": "^4.7.7", + "json-stringify-safe": "^5.0.1", + "meow": "^8.1.2", + "semver": "^7.0.0", + "split": "^1.0.1" + }, + "bin": { + "conventional-changelog-writer": "cli.js" + }, + "engines": { + "node": ">=14" + } + }, + "node_modules/conventional-commits-filter": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/conventional-commits-filter/-/conventional-commits-filter-3.0.0.tgz", + "integrity": "sha512-1ymej8b5LouPx9Ox0Dw/qAO2dVdfpRFq28e5Y0jJEU8ZrLdy0vOSkkIInwmxErFGhg6SALro60ZrwYFVTUDo4Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "lodash.ismatch": "^4.4.0", + "modify-values": "^1.0.1" + }, + "engines": { + "node": ">=14" + } + }, + "node_modules/conventional-commits-parser": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/conventional-commits-parser/-/conventional-commits-parser-4.0.0.tgz", + "integrity": "sha512-WRv5j1FsVM5FISJkoYMR6tPk07fkKT0UodruX4je86V4owk451yjXAKzKAPOs9l7y59E2viHUS9eQ+dfUA9NSg==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-text-path": "^1.0.1", + "JSONStream": "^1.3.5", + "meow": "^8.1.2", + "split2": "^3.2.2" + }, + "bin": { + "conventional-commits-parser": "cli.js" + }, + "engines": { + "node": ">=14" + } + }, + "node_modules/conventional-recommended-bump": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/conventional-recommended-bump/-/conventional-recommended-bump-7.0.1.tgz", + "integrity": "sha512-Ft79FF4SlOFvX4PkwFDRnaNiIVX7YbmqGU0RwccUaiGvgp3S0a8ipR2/Qxk31vclDNM+GSdJOVs2KrsUCjblVA==", + "dev": true, + "license": "MIT", + "dependencies": { + "concat-stream": "^2.0.0", + "conventional-changelog-preset-loader": "^3.0.0", + "conventional-commits-filter": "^3.0.0", + "conventional-commits-parser": "^4.0.0", + "git-raw-commits": "^3.0.0", + "git-semver-tags": "^5.0.0", + "meow": "^8.1.2" + }, + "bin": { + "conventional-recommended-bump": "cli.js" + }, + "engines": { + "node": ">=14" + } + }, + "node_modules/convert-source-map": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.9.0.tgz", + "integrity": "sha512-ASFBup0Mz1uyiIjANan1jzLQami9z1PoYSZCiiYW2FczPbenXc45FZdBZLzOT+r6+iciuEModtmCti+hjaAk0A==", + "dev": true, + "license": "MIT" + }, + "node_modules/cookie": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-1.1.1.tgz", + "integrity": "sha512-ei8Aos7ja0weRpFzJnEA9UHJ/7XQmqglbRwnf2ATjcB9Wq874VKH9kfjjirM6UhU2/E5fFYadylyhFldcqSidQ==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/cookie-signature": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.7.tgz", + "integrity": "sha512-NXdYc3dLr47pBkpUCHtKSwIOQXLVn8dZEuywboCOJY/osA0wFSLlSawr3KN8qXJEyX66FcONTH8EIlVuK0yyFA==", + "license": "MIT" + }, + "node_modules/copy-anything": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/copy-anything/-/copy-anything-2.0.6.tgz", + "integrity": "sha512-1j20GZTsvKNkc4BY3NpMOM8tt///wY3FpIzozTOFO2ffuZcV61nojHXVKIy3WM+7ADCy5FVhdZYHYDdgTU0yJw==", + "license": "MIT", + "dependencies": { + "is-what": "^3.14.1" + }, + "funding": { + "url": "https://github.com/sponsors/mesqueeb" + } + }, + "node_modules/copy-webpack-plugin": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/copy-webpack-plugin/-/copy-webpack-plugin-8.1.1.tgz", + "integrity": "sha512-rYM2uzRxrLRpcyPqGceRBDpxxUV8vcDqIKxAUKfcnFpcrPxT5+XvhTxv7XLjo5AvEJFPdAE3zCogG2JVahqgSQ==", + "license": "MIT", + "dependencies": { + "fast-glob": "^3.2.5", + "glob-parent": "^5.1.1", + "globby": "^11.0.3", + "normalize-path": "^3.0.0", + "p-limit": "^3.1.0", + "schema-utils": "^3.0.0", + "serialize-javascript": "^5.0.1" + }, + "engines": { + "node": ">= 10.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + }, + "peerDependencies": { + "webpack": "^5.1.0" + } + }, + "node_modules/copy-webpack-plugin/node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/copy-webpack-plugin/node_modules/schema-utils": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.3.0.tgz", + "integrity": "sha512-pN/yOAvcC+5rQ5nERGuwrjLlYvLTbCibnZ1I7B1LaiAz9BRBlE9GMgE/eqV30P7aJQUf7Ddimy/RsbYO/GrVGg==", + "license": "MIT", + "dependencies": { + "@types/json-schema": "^7.0.8", + "ajv": "^6.12.5", + "ajv-keywords": "^3.5.2" + }, + "engines": { + "node": ">= 10.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + } + }, + "node_modules/copy-webpack-plugin/node_modules/serialize-javascript": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-5.0.1.tgz", + "integrity": "sha512-SaaNal9imEO737H2c05Og0/8LUXG7EnsZyMa8MzkmuHoELfT6txuj0cMqRj6zfPKnmQ1yasR4PCJc8x+M4JSPA==", + "license": "BSD-3-Clause", + "dependencies": { + "randombytes": "^2.1.0" + } + }, + "node_modules/core-js": { + "version": "2.6.12", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.6.12.tgz", + "integrity": "sha512-Kb2wC0fvsWfQrgk8HU5lW6U/Lcs8+9aaYcy4ZFc6DDlo4nZ7n70dEgE5rtR0oG6ufKDUnrwfWL1mXR5ljDatrQ==", + "deprecated": "core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.", + "dev": true, + "hasInstallScript": true, + "license": "MIT" + }, + "node_modules/core-js-compat": { + "version": "3.48.0", + "resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.48.0.tgz", + "integrity": "sha512-OM4cAF3D6VtH/WkLtWvyNC56EZVXsZdU3iqaMG2B4WvYrlqU831pc4UtG5yp0sE9z8Y02wVN7PjW5Zf9Gt0f1Q==", + "license": "MIT", + "dependencies": { + "browserslist": "^4.28.1" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/core-js" + } + }, + "node_modules/core-util-is": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", + "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==", + "license": "MIT" + }, + "node_modules/cors": { + "version": "2.8.6", + "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.6.tgz", + "integrity": "sha512-tJtZBBHA6vjIAaF6EnIaq6laBBP9aq/Y3ouVJjEfoHbRBcHBAHYcMh/w8LDrk2PvIMMq8gmopa5D4V8RmbrxGw==", + "license": "MIT", + "dependencies": { + "object-assign": "^4", + "vary": "^1" + }, + "engines": { + "node": ">= 0.10" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/corser": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/corser/-/corser-2.0.1.tgz", + "integrity": "sha512-utCYNzRSQIZNPIcGZdQc92UVJYAhtGAteCFg0yRaFm8f0P+CPtyGyHXJcGXnffjCybUCEx3FQ2G7U3/o9eIkVQ==", + "license": "MIT", + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/cosmiconfig": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-9.0.0.tgz", + "integrity": "sha512-itvL5h8RETACmOTFc4UfIyB2RfEHi71Ax6E/PivVxq9NseKbOWpeyHEOIbmAw1rs8Ak0VursQNww7lf7YtUwzg==", + "license": "MIT", + "dependencies": { + "env-paths": "^2.2.1", + "import-fresh": "^3.3.0", + "js-yaml": "^4.1.0", + "parse-json": "^5.2.0" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/d-fischer" + }, + "peerDependencies": { + "typescript": ">=4.9.5" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/cpu-features": { + "version": "0.0.10", + "resolved": "https://registry.npmjs.org/cpu-features/-/cpu-features-0.0.10.tgz", + "integrity": "sha512-9IkYqtX3YHPCzoVg1Py+o9057a3i0fp7S530UWokCSaFVTc7CwXPRiOjRjBQQ18ZCNafx78YfnG+HALxtVmOGA==", + "hasInstallScript": true, + "optional": true, + "dependencies": { + "buildcheck": "~0.0.6", + "nan": "^2.19.0" + }, + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/crc": { + "version": "3.8.0", + "resolved": "https://registry.npmjs.org/crc/-/crc-3.8.0.tgz", + "integrity": "sha512-iX3mfgcTMIq3ZKLIsVFAbv7+Mc10kxabAGQb8HvjA1o3T1PIYprbakQ65d3I+2HGHt6nSKkM9PYjgoJO2KcFBQ==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "buffer": "^5.1.0" + } + }, + "node_modules/crc-32": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/crc-32/-/crc-32-1.2.2.tgz", + "integrity": "sha512-ROmzCKrTnOwybPcJApAA6WBWij23HVfGVNKqqrZpuyZOHqK2CwHSvpGuyt/UNNvaIjEd8X5IFGp4Mh+Ie1IHJQ==", + "license": "Apache-2.0", + "bin": { + "crc32": "bin/crc32.njs" + }, + "engines": { + "node": ">=0.8" + } + }, + "node_modules/crc32-stream": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/crc32-stream/-/crc32-stream-4.0.3.tgz", + "integrity": "sha512-NT7w2JVU7DFroFdYkeq8cywxrgjPHWkdX1wjpRQXPX5Asews3tA+Ght6lddQO5Mkumffp3X7GEqku3epj2toIw==", + "license": "MIT", + "dependencies": { + "crc-32": "^1.2.0", + "readable-stream": "^3.4.0" + }, + "engines": { + "node": ">= 10" + } + }, + "node_modules/cross-env": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-env/-/cross-env-7.0.3.tgz", + "integrity": "sha512-+/HKd6EgcQCJGh2PSjZuUitQBQynKor4wrFbRg4DtAgS1aWO+gU52xpH7M9ScGgXSYmAVS9bIJ8EzuaGw0oNAw==", + "dev": true, + "license": "MIT", + "dependencies": { + "cross-spawn": "^7.0.1" + }, + "bin": { + "cross-env": "src/bin/cross-env.js", + "cross-env-shell": "src/bin/cross-env-shell.js" + }, + "engines": { + "node": ">=10.14", + "npm": ">=6", + "yarn": ">=1" + } + }, + "node_modules/cross-spawn": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", + "license": "MIT", + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/cross-spawn/node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "license": "ISC" + }, + "node_modules/cross-spawn/node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "license": "ISC", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/crypt": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/crypt/-/crypt-0.0.2.tgz", + "integrity": "sha512-mCxBlsHFYh9C+HVpiEacem8FEBnMXgU9gy4zmNC+SXAZNB/1idgp/aulFJ4FgCi7GPEVbfyng092GqL2k2rmow==", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": "*" + } + }, + "node_modules/css-loader": { + "version": "6.11.0", + "resolved": "https://registry.npmjs.org/css-loader/-/css-loader-6.11.0.tgz", + "integrity": "sha512-CTJ+AEQJjq5NzLga5pE39qdiSV56F8ywCIsqNIRF0r7BDgWsN25aazToqAFg7ZrtA/U016xudB3ffgweORxX7g==", + "license": "MIT", + "dependencies": { + "icss-utils": "^5.1.0", + "postcss": "^8.4.33", + "postcss-modules-extract-imports": "^3.1.0", + "postcss-modules-local-by-default": "^4.0.5", + "postcss-modules-scope": "^3.2.0", + "postcss-modules-values": "^4.0.0", + "postcss-value-parser": "^4.2.0", + "semver": "^7.5.4" + }, + "engines": { + "node": ">= 12.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + }, + "peerDependencies": { + "@rspack/core": "0.x || 1.x", + "webpack": "^5.0.0" + }, + "peerDependenciesMeta": { + "@rspack/core": { + "optional": true + }, + "webpack": { + "optional": true + } + } + }, + "node_modules/css-select": { + "version": "5.2.2", + "resolved": "https://registry.npmjs.org/css-select/-/css-select-5.2.2.tgz", + "integrity": "sha512-TizTzUddG/xYLA3NXodFM0fSbNizXjOKhqiQQwvhlspadZokn1KDy0NZFS0wuEubIYAV5/c1/lAr0TaaFXEXzw==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "boolbase": "^1.0.0", + "css-what": "^6.1.0", + "domhandler": "^5.0.2", + "domutils": "^3.0.1", + "nth-check": "^2.0.1" + }, + "funding": { + "url": "https://github.com/sponsors/fb55" + } + }, + "node_modules/css-what": { + "version": "6.2.2", + "resolved": "https://registry.npmjs.org/css-what/-/css-what-6.2.2.tgz", + "integrity": "sha512-u/O3vwbptzhMs3L1fQE82ZSLHQQfto5gyZzwteVIEyeaY5Fc7R4dapF/BvRoSYFeqfBk4m0V1Vafq5Pjv25wvA==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">= 6" + }, + "funding": { + "url": "https://github.com/sponsors/fb55" + } + }, + "node_modules/cssesc": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/cssesc/-/cssesc-3.0.0.tgz", + "integrity": "sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==", + "license": "MIT", + "bin": { + "cssesc": "bin/cssesc" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/cssstyle": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-3.0.0.tgz", + "integrity": "sha512-N4u2ABATi3Qplzf0hWbVCdjenim8F3ojEXpBDF5hBpjzW182MjNGLqfmQ0SkSPeQ+V86ZXgeH8aXj6kayd4jgg==", + "dev": true, + "license": "MIT", + "dependencies": { + "rrweb-cssom": "^0.6.0" + }, + "engines": { + "node": ">=14" + } + }, + "node_modules/csstype": { + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.2.3.tgz", + "integrity": "sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==", + "license": "MIT" + }, + "node_modules/dargs": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/dargs/-/dargs-7.0.0.tgz", + "integrity": "sha512-2iy1EkLdlBzQGvbweYRFxmFath8+K7+AKB0TlhHWkNuH+TmovaMH/Wp7V7R4u7f4SnX3OgLsU9t1NI9ioDnUpg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/data-uri-to-buffer": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-6.0.2.tgz", + "integrity": "sha512-7hvf7/GW8e86rW0ptuwS3OcBGDjIi6SZva7hCyWC0yYry2cOPmLIjXAUHI6DK2HsnwJd9ifmt57i8eV2n4YNpw==", + "license": "MIT", + "engines": { + "node": ">= 14" + } + }, + "node_modules/data-urls": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/data-urls/-/data-urls-4.0.0.tgz", + "integrity": "sha512-/mMTei/JXPqvFqQtfyTowxmJVwr2PVAeCcDxyFf6LhoOu/09TX2OX3kb2wzi4DMXcfj4OItwDOnhl5oziPnT6g==", + "dev": true, + "license": "MIT", + "dependencies": { + "abab": "^2.0.6", + "whatwg-mimetype": "^3.0.0", + "whatwg-url": "^12.0.0" + }, + "engines": { + "node": ">=14" + } + }, + "node_modules/data-urls/node_modules/whatwg-mimetype": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-3.0.0.tgz", + "integrity": "sha512-nt+N2dzIutVRxARx1nghPKGv1xHikU7HKdfafKkLNLindmPU/ch3U31NOCGGA/dmPcmb1VlofO0vnKAcsm0o/Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + } + }, + "node_modules/data-view-buffer": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/data-view-buffer/-/data-view-buffer-1.0.2.tgz", + "integrity": "sha512-EmKO5V3OLXh1rtK2wgXRansaK1/mtVdTUEiEI0W8RkvgT05kfxaH29PliLnpLP73yYO6142Q72QNa8Wx/A5CqQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.3", + "es-errors": "^1.3.0", + "is-data-view": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/data-view-byte-length": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/data-view-byte-length/-/data-view-byte-length-1.0.2.tgz", + "integrity": "sha512-tuhGbE6CfTM9+5ANGf+oQb72Ky/0+s3xKUpHvShfiz2RxMFgFPjsXuRLBVMtvMs15awe45SRb83D6wH4ew6wlQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.3", + "es-errors": "^1.3.0", + "is-data-view": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/inspect-js" + } + }, + "node_modules/data-view-byte-offset": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/data-view-byte-offset/-/data-view-byte-offset-1.0.1.tgz", + "integrity": "sha512-BS8PfmtDGnrgYdOonGZQdLZslWIeCGFP9tpan0hi1Co2Zr2NKADsvGYA8XxuG/4UWgJ6Cjtv+YJnB6MM69QGlQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "is-data-view": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/date-fns": { + "version": "1.30.1", + "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-1.30.1.tgz", + "integrity": "sha512-hBSVCvSmWC+QypYObzwGOd9wqdDpOt+0wl0KbU+R+uuZBS1jN8VsD1ss3irQDknRj5NvxiTF6oj/nDRnN/UQNw==", + "dev": true, + "license": "MIT" + }, + "node_modules/dateformat": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/dateformat/-/dateformat-3.0.3.tgz", + "integrity": "sha512-jyCETtSl3VMZMWeRo7iY1FL19ges1t55hMo5yaam4Jrsm5EPL89UQkoQRyiI+Yf4k8r2ZpdngkV8hr1lIdjb3Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": "*" + } + }, + "node_modules/debounce-fn": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/debounce-fn/-/debounce-fn-4.0.0.tgz", + "integrity": "sha512-8pYCQiL9Xdcg0UPSD3d+0KMlOjp+KGU5EPwYddgzQ7DATsg4fuUDjQtsYLmWjnk2obnNHgV3vE2Y4jejSOJVBQ==", + "license": "MIT", + "dependencies": { + "mimic-fn": "^3.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/debounce-fn/node_modules/mimic-fn": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-3.1.0.tgz", + "integrity": "sha512-Ysbi9uYW9hFyfrThdDEQuykN4Ey6BuwPD2kpI5ES/nFTDn/98yxYNLZJcgUAKPT/mcrLLKaGzJR9YVxJrIdASQ==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/decamelize": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", + "integrity": "sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/decamelize-keys": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/decamelize-keys/-/decamelize-keys-1.1.1.tgz", + "integrity": "sha512-WiPxgEirIV0/eIOMcnFBA3/IJZAZqKnwAwWyvvdi4lsr1WCN22nhdf/3db3DoZcUjTV2SqfzIwNyp6y2xs3nmg==", + "dev": true, + "license": "MIT", + "dependencies": { + "decamelize": "^1.1.0", + "map-obj": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/decamelize-keys/node_modules/map-obj": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-1.0.1.tgz", + "integrity": "sha512-7N/q3lyZ+LVCp7PzuxrJr4KMbBE2hW7BT7YNia330OFxIf4d3r5zVpicP2650l7CPN6RM9zOJRl3NGpqSiw3Eg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/decimal.js": { + "version": "10.6.0", + "resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.6.0.tgz", + "integrity": "sha512-YpgQiITW3JXGntzdUmyUR1V812Hn8T1YVXhCu+wO3OpS4eU9l4YdD3qjyiKdV6mvV29zapkMeD390UVEf2lkUg==", + "dev": true, + "license": "MIT" + }, + "node_modules/decompress": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/decompress/-/decompress-4.2.1.tgz", + "integrity": "sha512-e48kc2IjU+2Zw8cTb6VZcJQ3lgVbS4uuB1TfCHbiZIP/haNXm+SVyhu+87jts5/3ROpd82GSVCoNs/z8l4ZOaQ==", + "license": "MIT", + "dependencies": { + "decompress-tar": "^4.0.0", + "decompress-tarbz2": "^4.0.0", + "decompress-targz": "^4.0.0", + "decompress-unzip": "^4.0.1", + "graceful-fs": "^4.1.10", + "make-dir": "^1.0.0", + "pify": "^2.3.0", + "strip-dirs": "^2.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/decompress-response": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-6.0.0.tgz", + "integrity": "sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==", + "license": "MIT", + "dependencies": { + "mimic-response": "^3.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/decompress-tar": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/decompress-tar/-/decompress-tar-4.1.1.tgz", + "integrity": "sha512-JdJMaCrGpB5fESVyxwpCx4Jdj2AagLmv3y58Qy4GE6HMVjWz1FeVQk1Ct4Kye7PftcdOo/7U7UKzYBJgqnGeUQ==", + "license": "MIT", + "dependencies": { + "file-type": "^5.2.0", + "is-stream": "^1.1.0", + "tar-stream": "^1.5.2" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/decompress-tar/node_modules/bl": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/bl/-/bl-1.2.3.tgz", + "integrity": "sha512-pvcNpa0UU69UT341rO6AYy4FVAIkUHuZXRIWbq+zHnsVcRzDDjIAhGuuYoi0d//cwIwtt4pkpKycWEfjdV+vww==", + "license": "MIT", + "dependencies": { + "readable-stream": "^2.3.5", + "safe-buffer": "^5.1.1" + } + }, + "node_modules/decompress-tar/node_modules/is-stream": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", + "integrity": "sha512-uQPm8kcs47jx38atAcWTVxyltQYoPT68y9aWYdV6yWXSyW8mzSat0TL6CiWdZeCdF3KrAvpVtnHbTv4RN+rqdQ==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/decompress-tar/node_modules/isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==", + "license": "MIT" + }, + "node_modules/decompress-tar/node_modules/readable-stream": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", + "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", + "license": "MIT", + "dependencies": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "node_modules/decompress-tar/node_modules/safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "license": "MIT" + }, + "node_modules/decompress-tar/node_modules/string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.1.0" + } + }, + "node_modules/decompress-tar/node_modules/tar-stream": { + "version": "1.6.2", + "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-1.6.2.tgz", + "integrity": "sha512-rzS0heiNf8Xn7/mpdSVVSMAWAoy9bfb1WOTYC78Z0UQKeKa/CWS8FOq0lKGNa8DWKAn9gxjCvMLYc5PGXYlK2A==", + "license": "MIT", + "dependencies": { + "bl": "^1.0.0", + "buffer-alloc": "^1.2.0", + "end-of-stream": "^1.0.0", + "fs-constants": "^1.0.0", + "readable-stream": "^2.3.0", + "to-buffer": "^1.1.1", + "xtend": "^4.0.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/decompress-tarbz2": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/decompress-tarbz2/-/decompress-tarbz2-4.1.1.tgz", + "integrity": "sha512-s88xLzf1r81ICXLAVQVzaN6ZmX4A6U4z2nMbOwobxkLoIIfjVMBg7TeguTUXkKeXni795B6y5rnvDw7rxhAq9A==", + "license": "MIT", + "dependencies": { + "decompress-tar": "^4.1.0", + "file-type": "^6.1.0", + "is-stream": "^1.1.0", + "seek-bzip": "^1.0.5", + "unbzip2-stream": "^1.0.9" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/decompress-tarbz2/node_modules/file-type": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/file-type/-/file-type-6.2.0.tgz", + "integrity": "sha512-YPcTBDV+2Tm0VqjybVd32MHdlEGAtuxS3VAYsumFokDSMG+ROT5wawGlnHDoz7bfMcMDt9hxuXvXwoKUx2fkOg==", + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/decompress-tarbz2/node_modules/is-stream": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", + "integrity": "sha512-uQPm8kcs47jx38atAcWTVxyltQYoPT68y9aWYdV6yWXSyW8mzSat0TL6CiWdZeCdF3KrAvpVtnHbTv4RN+rqdQ==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/decompress-targz": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/decompress-targz/-/decompress-targz-4.1.1.tgz", + "integrity": "sha512-4z81Znfr6chWnRDNfFNqLwPvm4db3WuZkqV+UgXQzSngG3CEKdBkw5jrv3axjjL96glyiiKjsxJG3X6WBZwX3w==", + "license": "MIT", + "dependencies": { + "decompress-tar": "^4.1.1", + "file-type": "^5.2.0", + "is-stream": "^1.1.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/decompress-targz/node_modules/is-stream": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", + "integrity": "sha512-uQPm8kcs47jx38atAcWTVxyltQYoPT68y9aWYdV6yWXSyW8mzSat0TL6CiWdZeCdF3KrAvpVtnHbTv4RN+rqdQ==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/decompress-unzip": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/decompress-unzip/-/decompress-unzip-4.0.1.tgz", + "integrity": "sha512-1fqeluvxgnn86MOh66u8FjbtJpAFv5wgCT9Iw8rcBqQcCo5tO8eiJw7NNTrvt9n4CRBVq7CstiS922oPgyGLrw==", + "license": "MIT", + "dependencies": { + "file-type": "^3.8.0", + "get-stream": "^2.2.0", + "pify": "^2.3.0", + "yauzl": "^2.4.2" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/decompress-unzip/node_modules/file-type": { + "version": "3.9.0", + "resolved": "https://registry.npmjs.org/file-type/-/file-type-3.9.0.tgz", + "integrity": "sha512-RLoqTXE8/vPmMuTI88DAzhMYC99I8BWv7zYP4A1puo5HIjEJ5EX48ighy4ZyKMG9EDXxBgW6e++cn7d1xuFghA==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/decompress-unzip/node_modules/get-stream": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-2.3.1.tgz", + "integrity": "sha512-AUGhbbemXxrZJRD5cDvKtQxLuYaIbNtDTK8YqupCI393Q2KSTreEsLUN3ZxAWFGiKTzL6nKuzfcIvieflUX9qA==", + "license": "MIT", + "dependencies": { + "object-assign": "^4.0.1", + "pinkie-promise": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/decompress-unzip/node_modules/pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/decompress/node_modules/make-dir": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-1.3.0.tgz", + "integrity": "sha512-2w31R7SJtieJJnQtGc7RVL2StM2vGYVfqUOvUDxH6bC6aJTxPxTF0GnIgCyu7tjockiUWAYQRbxa7vKn34s5sQ==", + "license": "MIT", + "dependencies": { + "pify": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/decompress/node_modules/make-dir/node_modules/pify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", + "integrity": "sha512-C3FsVNH1udSEX48gGX1xfvwTWfsYWj5U+8/uK15BGzIGrKoUpghX8hWZwa/OFnakBiiVNmBvemTJR5mcy7iPcg==", + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/decompress/node_modules/pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/dedent": { + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/dedent/-/dedent-1.5.3.tgz", + "integrity": "sha512-NHQtfOOW68WD8lgypbLA5oT+Bt0xXJhiYvoR6SmmNXZfpzOGXwdKWmcwG8N7PwVVWV3eF/68nmD9BaJSsTBhyQ==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "babel-plugin-macros": "^3.1.0" + }, + "peerDependenciesMeta": { + "babel-plugin-macros": { + "optional": true + } + } + }, + "node_modules/deep-eql": { + "version": "4.1.4", + "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-4.1.4.tgz", + "integrity": "sha512-SUwdGfqdKOwxCPeVYjwSyRpJ7Z+fhpwIAtmCUdZIWZ/YP5R9WAsyuSgpLVDi9bjWoN2LXHNss/dk3urXtdQxGg==", + "license": "MIT", + "dependencies": { + "type-detect": "^4.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/deep-extend": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", + "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==", + "license": "MIT", + "engines": { + "node": ">=4.0.0" + } + }, + "node_modules/deep-is": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/deepmerge": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.3.1.tgz", + "integrity": "sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/default-browser": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/default-browser/-/default-browser-5.5.0.tgz", + "integrity": "sha512-H9LMLr5zwIbSxrmvikGuI/5KGhZ8E2zH3stkMgM5LpOWDutGM2JZaj460Udnf1a+946zc7YBgrqEWwbk7zHvGw==", + "dev": true, + "license": "MIT", + "dependencies": { + "bundle-name": "^4.1.0", + "default-browser-id": "^5.0.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/default-browser-id": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/default-browser-id/-/default-browser-id-5.0.1.tgz", + "integrity": "sha512-x1VCxdX4t+8wVfd1so/9w+vQ4vx7lKd2Qp5tDRutErwmR85OgmfX7RlLRMWafRMY7hbEiXIbudNrjOAPa/hL8Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/default-require-extensions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/default-require-extensions/-/default-require-extensions-3.0.1.tgz", + "integrity": "sha512-eXTJmRbm2TIt9MgWTsOH1wEuhew6XGZcMeGKCtLedIg/NCsg1iBePXkceTdK4Fii7pzmN9tGsZhKzZ4h7O/fxw==", + "dev": true, + "license": "MIT", + "dependencies": { + "strip-bom": "^4.0.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/default-shell": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/default-shell/-/default-shell-2.2.0.tgz", + "integrity": "sha512-sPpMZcVhRQ0nEMDtuMJ+RtCxt7iHPAMBU+I4tAlo5dU1sjRpNax0crj6nR3qKpvVnckaQ9U38enXcwW9nZJeCw==", + "license": "MIT", + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/defaults": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/defaults/-/defaults-1.0.4.tgz", + "integrity": "sha512-eFuaLoy/Rxalv2kr+lqMlUnrDWV+3j4pljOIJgLIhI058IQfWJ7vXhyEIHu+HtC738klGALYxOKDO0bQP3tg8A==", + "license": "MIT", + "dependencies": { + "clone": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/defaults/node_modules/clone": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/clone/-/clone-1.0.4.tgz", + "integrity": "sha512-JQHZ2QMW6l3aH/j6xCqQThY/9OH4D/9ls34cgkUBiEeocRTU04tHfKPBsUK1PqZCUQM7GiA0IIXJSuXHI64Kbg==", + "license": "MIT", + "engines": { + "node": ">=0.8" + } + }, + "node_modules/defer-to-connect": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-2.0.1.tgz", + "integrity": "sha512-4tvttepXG1VaYGrRibk5EwJd1t4udunSOVMdLSAL6mId1ix438oPwPZMALY41FCijukO1L0twNcGsdzS7dHgDg==", + "license": "MIT", + "engines": { + "node": ">=10" + } + }, + "node_modules/define-data-property": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz", + "integrity": "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==", + "license": "MIT", + "dependencies": { + "es-define-property": "^1.0.0", + "es-errors": "^1.3.0", + "gopd": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/define-lazy-prop": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/define-lazy-prop/-/define-lazy-prop-3.0.0.tgz", + "integrity": "sha512-N+MeXYoqr3pOgn8xfyRPREN7gHakLYjhsHhWGT3fWAiL4IkAt0iDw14QiiEm2bE30c5XX5q0FtAA3CK5f9/BUg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/define-properties": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.2.1.tgz", + "integrity": "sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg==", + "devOptional": true, + "license": "MIT", + "dependencies": { + "define-data-property": "^1.0.1", + "has-property-descriptors": "^1.0.0", + "object-keys": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/degenerator": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/degenerator/-/degenerator-5.0.1.tgz", + "integrity": "sha512-TllpMR/t0M5sqCXfj85i4XaAzxmS5tVA16dqvdkMwGmzI+dXLXnw3J+3Vdv7VKw+ThlTMboK6i9rnZ6Nntj5CQ==", + "license": "MIT", + "dependencies": { + "ast-types": "^0.13.4", + "escodegen": "^2.1.0", + "esprima": "^4.0.1" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", + "license": "MIT", + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/delegates": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz", + "integrity": "sha512-bd2L678uiWATM6m5Z1VzNCErI3jiGzt6HGY8OVICs40JQq/HALfbyNJmp0UDakEY4pMMaN0Ly5om/B1VI/+xfQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/depd": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", + "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/deprecation": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/deprecation/-/deprecation-2.3.1.tgz", + "integrity": "sha512-xmHIy4F3scKVwMsQ4WnVaS8bHOx0DmVwRywosKhaILI0ywMDWPtBSku2HNxRvF7jtwDRsoEwYQSfbxj8b7RlJQ==", + "dev": true, + "license": "ISC" + }, + "node_modules/destroy": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz", + "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==", + "license": "MIT", + "engines": { + "node": ">= 0.8", + "npm": "1.2.8000 || >= 1.4.16" + } + }, + "node_modules/detect-indent": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/detect-indent/-/detect-indent-5.0.0.tgz", + "integrity": "sha512-rlpvsxUtM0PQvy9iZe640/IWwWYyBsTApREbA1pHOpmOUIl9MkP/U4z7vTtg4Oaojvqhxt7sdufnT0EzGaR31g==", + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/detect-libc": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.1.2.tgz", + "integrity": "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==", + "license": "Apache-2.0", + "engines": { + "node": ">=8" + } + }, + "node_modules/detect-node": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/detect-node/-/detect-node-2.1.0.tgz", + "integrity": "sha512-T0NIuQpnTvFDATNuHN5roPwSBG83rFsuO+MXXH9/3N1eFbn4wcPjttvjMLEPWJ0RGUYgQE7cGgS3tNxbqCGM7g==", + "license": "MIT", + "optional": true + }, + "node_modules/devtools-protocol": { + "version": "0.0.1312386", + "resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.1312386.tgz", + "integrity": "sha512-DPnhUXvmvKT2dFA/j7B+riVLUt9Q6RKJlcppojL5CoRywJJKLDYnRlw0gTFKfgDPHP5E04UoB71SxoJlVZy8FA==", + "license": "BSD-3-Clause" + }, + "node_modules/diff": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-5.0.0.tgz", + "integrity": "sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w==", + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.3.1" + } + }, + "node_modules/dir-compare": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/dir-compare/-/dir-compare-4.2.0.tgz", + "integrity": "sha512-2xMCmOoMrdQIPHdsTawECdNPwlVFB9zGcz3kuhmBO6U3oU+UQjsue0i8ayLKpgBcm+hcXPMVSGUN9d+pvJ6+VQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "minimatch": "^3.0.5", + "p-limit": "^3.1.0 " + } + }, + "node_modules/dir-compare/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/dir-glob": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", + "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", + "license": "MIT", + "dependencies": { + "path-type": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/dmg-builder": { + "version": "25.1.8", + "resolved": "https://registry.npmjs.org/dmg-builder/-/dmg-builder-25.1.8.tgz", + "integrity": "sha512-NoXo6Liy2heSklTI5OIZbCgXC1RzrDQsZkeEwXhdOro3FT1VBOvbubvscdPnjVuQ4AMwwv61oaH96AbiYg9EnQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "app-builder-lib": "25.1.8", + "builder-util": "25.1.7", + "builder-util-runtime": "9.2.10", + "fs-extra": "^10.1.0", + "iconv-lite": "^0.6.2", + "js-yaml": "^4.1.0" + }, + "optionalDependencies": { + "dmg-license": "^1.0.11" + } + }, + "node_modules/dmg-builder/node_modules/fs-extra": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.1.0.tgz", + "integrity": "sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/dmg-builder/node_modules/jsonfile": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.2.0.tgz", + "integrity": "sha512-FGuPw30AdOIUTRMC2OMRtQV+jkVj2cfPqSeWXv1NEAJ1qZ5zb1X6z1mFhbfOB/iy3ssJCD+3KuZ8r8C3uVFlAg==", + "dev": true, + "license": "MIT", + "dependencies": { + "universalify": "^2.0.0" + }, + "optionalDependencies": { + "graceful-fs": "^4.1.6" + } + }, + "node_modules/dmg-builder/node_modules/universalify": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz", + "integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 10.0.0" + } + }, + "node_modules/dmg-license": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/dmg-license/-/dmg-license-1.0.11.tgz", + "integrity": "sha512-ZdzmqwKmECOWJpqefloC5OJy1+WZBBse5+MR88z9g9Zn4VY+WYUkAyojmhzJckH5YbbZGcYIuGAkY5/Ys5OM2Q==", + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "dependencies": { + "@types/plist": "^3.0.1", + "@types/verror": "^1.10.3", + "ajv": "^6.10.0", + "crc": "^3.8.0", + "iconv-corefoundation": "^1.1.7", + "plist": "^3.0.4", + "smart-buffer": "^4.0.2", + "verror": "^1.10.0" + }, + "bin": { + "dmg-license": "bin/dmg-license.js" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/docker-modem": { + "version": "5.0.6", + "resolved": "https://registry.npmjs.org/docker-modem/-/docker-modem-5.0.6.tgz", + "integrity": "sha512-ens7BiayssQz/uAxGzH8zGXCtiV24rRWXdjNha5V4zSOcxmAZsfGVm/PPFbwQdqEkDnhG+SyR9E3zSHUbOKXBQ==", + "license": "Apache-2.0", + "dependencies": { + "debug": "^4.1.1", + "readable-stream": "^3.5.0", + "split-ca": "^1.0.1", + "ssh2": "^1.15.0" + }, + "engines": { + "node": ">= 8.0" + } + }, + "node_modules/dockerode": { + "version": "4.0.9", + "resolved": "https://registry.npmjs.org/dockerode/-/dockerode-4.0.9.tgz", + "integrity": "sha512-iND4mcOWhPaCNh54WmK/KoSb35AFqPAUWFMffTQcp52uQt36b5uNwEJTSXntJZBbeGad72Crbi/hvDIv6us/6Q==", + "license": "Apache-2.0", + "dependencies": { + "@balena/dockerignore": "^1.0.2", + "@grpc/grpc-js": "^1.11.1", + "@grpc/proto-loader": "^0.7.13", + "docker-modem": "^5.0.6", + "protobufjs": "^7.3.2", + "tar-fs": "^2.1.4", + "uuid": "^10.0.0" + }, + "engines": { + "node": ">= 8.0" + } + }, + "node_modules/dockerode/node_modules/chownr": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz", + "integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==", + "license": "ISC" + }, + "node_modules/dockerode/node_modules/tar-fs": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-2.1.4.tgz", + "integrity": "sha512-mDAjwmZdh7LTT6pNleZ05Yt65HC3E+NiQzl672vQG38jIrehtJk/J3mNwIg+vShQPcLF/LV7CMnDW6vjj6sfYQ==", + "license": "MIT", + "dependencies": { + "chownr": "^1.1.1", + "mkdirp-classic": "^0.5.2", + "pump": "^3.0.0", + "tar-stream": "^2.1.4" + } + }, + "node_modules/dockerode/node_modules/uuid": { + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-10.0.0.tgz", + "integrity": "sha512-8XkAphELsDnEGrDxUOHB3RGvXz6TeuYSGEZBOjtTtPm2lwhGBjLgOzLHB63IUWfBpNucQjND6d3AOudO+H3RWQ==", + "funding": [ + "https://github.com/sponsors/broofa", + "https://github.com/sponsors/ctavan" + ], + "license": "MIT", + "bin": { + "uuid": "dist/bin/uuid" + } + }, + "node_modules/doctrine": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", + "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "esutils": "^2.0.2" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/dom-serializer": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-2.0.0.tgz", + "integrity": "sha512-wIkAryiqt/nV5EQKqQpo3SToSOV9J0DnbJqwK7Wv/Trc92zIAYZ4FlMu+JPFW1DfGFt81ZTCGgDEabffXeLyJg==", + "dev": true, + "license": "MIT", + "dependencies": { + "domelementtype": "^2.3.0", + "domhandler": "^5.0.2", + "entities": "^4.2.0" + }, + "funding": { + "url": "https://github.com/cheeriojs/dom-serializer?sponsor=1" + } + }, + "node_modules/domelementtype": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-2.3.0.tgz", + "integrity": "sha512-OLETBj6w0OsagBwdXnPdN0cnMfF9opN69co+7ZrbfPGrdpPVNBUj02spi6B1N7wChLQiPn4CSH/zJvXw56gmHw==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/fb55" + } + ], + "license": "BSD-2-Clause" + }, + "node_modules/domexception": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/domexception/-/domexception-4.0.0.tgz", + "integrity": "sha512-A2is4PLG+eeSfoTMA95/s4pvAoSo2mKtiM5jlHkAVewmiO8ISFTFKZjH7UAM1Atli/OT/7JHOrJRJiMKUZKYBw==", + "deprecated": "Use your platform's native DOMException instead", + "dev": true, + "license": "MIT", + "dependencies": { + "webidl-conversions": "^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/domhandler": { + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-5.0.3.tgz", + "integrity": "sha512-cgwlv/1iFQiFnU96XXgROh8xTeetsnJiDsTc7TYCLFd9+/WNkIqPTxiM/8pSd8VIrhXGTf1Ny1q1hquVqDJB5w==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "domelementtype": "^2.3.0" + }, + "engines": { + "node": ">= 4" + }, + "funding": { + "url": "https://github.com/fb55/domhandler?sponsor=1" + } + }, + "node_modules/dompurify": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/dompurify/-/dompurify-3.3.1.tgz", + "integrity": "sha512-qkdCKzLNtrgPFP1Vo+98FRzJnBRGe4ffyCea9IwHB1fyxPOeNTHpLKYGd4Uk9xvNoH0ZoOjwZxNptyMwqrId1Q==", + "license": "(MPL-2.0 OR Apache-2.0)", + "optionalDependencies": { + "@types/trusted-types": "^2.0.7" + } + }, + "node_modules/domutils": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/domutils/-/domutils-3.2.2.tgz", + "integrity": "sha512-6kZKyUajlDuqlHKVX1w7gyslj9MPIXzIFiz/rGu35uC1wMi+kMhQwGhl4lt9unC9Vb9INnY9Z3/ZA3+FhASLaw==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "dom-serializer": "^2.0.0", + "domelementtype": "^2.3.0", + "domhandler": "^5.0.3" + }, + "funding": { + "url": "https://github.com/fb55/domutils?sponsor=1" + } + }, + "node_modules/dot-prop": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-5.3.0.tgz", + "integrity": "sha512-QM8q3zDe58hqUqjraQOmzZ1LIH9SWQJTlEKCH4kJ2oQvLZk7RbQXvtDM2XEq3fwkV9CCvvH4LA0AV+ogFsBM2Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-obj": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/dotenv": { + "version": "16.4.7", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.4.7.tgz", + "integrity": "sha512-47qPchRCykZC03FhkYAhrvwU4xDBFIj1QPqaarj6mdM/hgUzfPHcpkHJOn3mJAufFeeAxAzeGsr5X0M4k6fLZQ==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://dotenvx.com" + } + }, + "node_modules/dotenv-expand": { + "version": "11.0.7", + "resolved": "https://registry.npmjs.org/dotenv-expand/-/dotenv-expand-11.0.7.tgz", + "integrity": "sha512-zIHwmZPRshsCdpMDyVsqGmgyP0yT8GAgXUnkdAoJisxvf33k7yO6OuoKmcTGuXPWSsm8Oh88nZicRLA9Y0rUeA==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "dotenv": "^16.4.5" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://dotenvx.com" + } + }, + "node_modules/drivelist": { + "version": "12.0.2", + "resolved": "https://registry.npmjs.org/drivelist/-/drivelist-12.0.2.tgz", + "integrity": "sha512-Nps4pc1ukIqDj7v00wGgBkS7P3VVEZZKcaTPVcE1Yl+dLojXuEv76BuSg6HgmhjeOFIIMz8q7Y+2tux6gYqCvg==", + "hasInstallScript": true, + "license": "Apache-2.0", + "dependencies": { + "bindings": "^1.5.0", + "debug": "^4.3.4", + "node-addon-api": "^8.0.0", + "prebuild-install": "^7.1.1" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/drivelist/node_modules/node-addon-api": { + "version": "8.5.0", + "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-8.5.0.tgz", + "integrity": "sha512-/bRZty2mXUIFY/xU5HLvveNHlswNJej+RnxBjOMkidWfwZzgTbPG1E3K5TOxRLOR+5hX7bSofy8yf1hZevMS8A==", + "license": "MIT", + "engines": { + "node": "^18 || ^20 || >= 21" + } + }, + "node_modules/dugite-extra": { + "version": "0.1.17", + "resolved": "https://registry.npmjs.org/dugite-extra/-/dugite-extra-0.1.17.tgz", + "integrity": "sha512-x20q26VIwxr53t8XIPk1ahHR5Sz7duQRzeHkDkBuRIJtZKLXlVjchiAWid4snv1s+g6O58ZzoAMeJJs19/0O8A==", + "license": "MIT", + "dependencies": { + "byline": "^5.0.0", + "dugite-no-gpl": "^2.0.0", + "find-git-exec": "^0.0.4", + "upath": "^2.0.1" + }, + "engines": { + "node": ">=14" + } + }, + "node_modules/dugite-no-gpl": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/dugite-no-gpl/-/dugite-no-gpl-2.0.0.tgz", + "integrity": "sha512-Kv3ACbXfapHriu3tvSHUWl4q81UjY6MAp8IGy/qdDFfWF/w4mBuI3mZeg1z/r13/Q2pUiAahzoIwc7PLpLA54g==", + "license": "MIT", + "dependencies": { + "progress": "^2.0.3", + "tar": "^6.1.11" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/dugite-no-gpl/node_modules/chownr": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/chownr/-/chownr-2.0.0.tgz", + "integrity": "sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==", + "license": "ISC", + "engines": { + "node": ">=10" + } + }, + "node_modules/dugite-no-gpl/node_modules/fs-minipass": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-2.1.0.tgz", + "integrity": "sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg==", + "license": "ISC", + "dependencies": { + "minipass": "^3.0.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/dugite-no-gpl/node_modules/fs-minipass/node_modules/minipass": { + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", + "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", + "license": "ISC", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/dugite-no-gpl/node_modules/minipass": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-5.0.0.tgz", + "integrity": "sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==", + "license": "ISC", + "engines": { + "node": ">=8" + } + }, + "node_modules/dugite-no-gpl/node_modules/minizlib": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-2.1.2.tgz", + "integrity": "sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg==", + "license": "MIT", + "dependencies": { + "minipass": "^3.0.0", + "yallist": "^4.0.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/dugite-no-gpl/node_modules/minizlib/node_modules/minipass": { + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", + "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", + "license": "ISC", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/dugite-no-gpl/node_modules/mkdirp": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", + "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", + "license": "MIT", + "bin": { + "mkdirp": "bin/cmd.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/dugite-no-gpl/node_modules/tar": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/tar/-/tar-6.2.1.tgz", + "integrity": "sha512-DZ4yORTwrbTj/7MZYq2w+/ZFdI6OZ/f9SFHR+71gIVUZhOQPHzVCLpvRnPgyaMpfWxxk/4ONva3GQSyNIKRv6A==", + "deprecated": "Old versions of tar are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me", + "license": "ISC", + "dependencies": { + "chownr": "^2.0.0", + "fs-minipass": "^2.0.0", + "minipass": "^5.0.0", + "minizlib": "^2.1.1", + "mkdirp": "^1.0.3", + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/dunder-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", + "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.1", + "es-errors": "^1.3.0", + "gopd": "^1.2.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/duplexer": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.2.tgz", + "integrity": "sha512-jtD6YG370ZCIi/9GTaJKQxWTZD045+4R4hTk/x1UyoqadyJ9x9CgSi1RlVDQF8U2sxLLSnFkCaMihqljHIWgMg==", + "dev": true, + "license": "MIT" + }, + "node_modules/duplexer2": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/duplexer2/-/duplexer2-0.1.4.tgz", + "integrity": "sha512-asLFVfWWtJ90ZyOUHMqk7/S2w2guQKxUI2itj3d92ADHhxUSbCMGi1f1cBcJ7xM1To+pE/Khbwo1yuNbMEPKeA==", + "license": "BSD-3-Clause", + "dependencies": { + "readable-stream": "^2.0.2" + } + }, + "node_modules/duplexer2/node_modules/isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==", + "license": "MIT" + }, + "node_modules/duplexer2/node_modules/readable-stream": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", + "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", + "license": "MIT", + "dependencies": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "node_modules/duplexer2/node_modules/safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "license": "MIT" + }, + "node_modules/duplexer2/node_modules/string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.1.0" + } + }, + "node_modules/duplexify": { + "version": "3.7.1", + "resolved": "https://registry.npmjs.org/duplexify/-/duplexify-3.7.1.tgz", + "integrity": "sha512-07z8uv2wMyS51kKhD1KsdXJg5WQ6t93RneqRxUHnskXVtlYYkLqM0gqStQZ3pj073g687jPCHrqNfCzawLYh5g==", + "license": "MIT", + "dependencies": { + "end-of-stream": "^1.0.0", + "inherits": "^2.0.1", + "readable-stream": "^2.0.0", + "stream-shift": "^1.0.0" + } + }, + "node_modules/duplexify/node_modules/isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==", + "license": "MIT" + }, + "node_modules/duplexify/node_modules/readable-stream": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", + "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", + "license": "MIT", + "dependencies": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "node_modules/duplexify/node_modules/safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "license": "MIT" + }, + "node_modules/duplexify/node_modules/string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.1.0" + } + }, + "node_modules/eastasianwidth": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", + "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==", + "license": "MIT" + }, + "node_modules/ecdsa-sig-formatter": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz", + "integrity": "sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ==", + "license": "Apache-2.0", + "dependencies": { + "safe-buffer": "^5.0.1" + } + }, + "node_modules/ee-first": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", + "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==", + "license": "MIT" + }, + "node_modules/ejs": { + "version": "3.1.10", + "resolved": "https://registry.npmjs.org/ejs/-/ejs-3.1.10.tgz", + "integrity": "sha512-UeJmFfOrAQS8OJWPZ4qtgHyWExa088/MtK5UEyoJGFH67cDEXkZSviOiKRCZ4Xij0zxI3JECgYs3oKx+AizQBA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "jake": "^10.8.5" + }, + "bin": { + "ejs": "bin/cli.js" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/electron": { + "version": "38.4.0", + "resolved": "https://registry.npmjs.org/electron/-/electron-38.4.0.tgz", + "integrity": "sha512-9CsXKbGf2qpofVe2pQYSgom2E//zLDJO2rGLLbxgy9tkdTOs7000Gte+d/PUtzLjI/DS95jDK0ojYAeqjLvpYg==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "dependencies": { + "@electron/get": "^2.0.0", + "@types/node": "^22.7.7", + "extract-zip": "^2.0.1" + }, + "bin": { + "electron": "cli.js" + }, + "engines": { + "node": ">= 12.20.55" + } + }, + "node_modules/electron-builder": { + "version": "25.1.8", + "resolved": "https://registry.npmjs.org/electron-builder/-/electron-builder-25.1.8.tgz", + "integrity": "sha512-poRgAtUHHOnlzZnc9PK4nzG53xh74wj2Jy7jkTrqZ0MWPoHGh1M2+C//hGeYdA+4K8w4yiVCNYoLXF7ySj2Wig==", + "dev": true, + "license": "MIT", + "dependencies": { + "app-builder-lib": "25.1.8", + "builder-util": "25.1.7", + "builder-util-runtime": "9.2.10", + "chalk": "^4.1.2", + "dmg-builder": "25.1.8", + "fs-extra": "^10.1.0", + "is-ci": "^3.0.0", + "lazy-val": "^1.0.5", + "simple-update-notifier": "2.0.0", + "yargs": "^17.6.2" + }, + "bin": { + "electron-builder": "cli.js", + "install-app-deps": "install-app-deps.js" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/electron-builder/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/electron-builder/node_modules/fs-extra": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.1.0.tgz", + "integrity": "sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/electron-builder/node_modules/jsonfile": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.2.0.tgz", + "integrity": "sha512-FGuPw30AdOIUTRMC2OMRtQV+jkVj2cfPqSeWXv1NEAJ1qZ5zb1X6z1mFhbfOB/iy3ssJCD+3KuZ8r8C3uVFlAg==", + "dev": true, + "license": "MIT", + "dependencies": { + "universalify": "^2.0.0" + }, + "optionalDependencies": { + "graceful-fs": "^4.1.6" + } + }, + "node_modules/electron-builder/node_modules/universalify": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz", + "integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 10.0.0" + } + }, + "node_modules/electron-builder/node_modules/y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=10" + } + }, + "node_modules/electron-builder/node_modules/yargs": { + "version": "17.7.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", + "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", + "dev": true, + "license": "MIT", + "dependencies": { + "cliui": "^8.0.1", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.3", + "y18n": "^5.0.5", + "yargs-parser": "^21.1.1" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/electron-mocha": { + "version": "12.3.1", + "resolved": "https://registry.npmjs.org/electron-mocha/-/electron-mocha-12.3.1.tgz", + "integrity": "sha512-OhPx4akKBbBXXsaI06cBUQHeCmuB4cyYylTQsPhHfOWjwCieb30fXck/9cV3Wtt/MAS0OI09/OPJjPU2edLNyA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-colors": "^4.1.1", + "electron-window": "^0.8.0", + "mocha": "=10.4.0", + "which": "^4.0.0", + "yargs": "^17.7.2" + }, + "bin": { + "electron-mocha": "bin/electron-mocha" + }, + "engines": { + "node": ">= 16.0.0" + } + }, + "node_modules/electron-mocha/node_modules/y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=10" + } + }, + "node_modules/electron-mocha/node_modules/yargs": { + "version": "17.7.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", + "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", + "dev": true, + "license": "MIT", + "dependencies": { + "cliui": "^8.0.1", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.3", + "y18n": "^5.0.5", + "yargs-parser": "^21.1.1" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/electron-publish": { + "version": "25.1.7", + "resolved": "https://registry.npmjs.org/electron-publish/-/electron-publish-25.1.7.tgz", + "integrity": "sha512-+jbTkR9m39eDBMP4gfbqglDd6UvBC7RLh5Y0MhFSsc6UkGHj9Vj9TWobxevHYMMqmoujL11ZLjfPpMX+Pt6YEg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/fs-extra": "^9.0.11", + "builder-util": "25.1.7", + "builder-util-runtime": "9.2.10", + "chalk": "^4.1.2", + "fs-extra": "^10.1.0", + "lazy-val": "^1.0.5", + "mime": "^2.5.2" + } + }, + "node_modules/electron-publish/node_modules/@types/fs-extra": { + "version": "9.0.13", + "resolved": "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-9.0.13.tgz", + "integrity": "sha512-nEnwB++1u5lVDM2UI4c1+5R+FYaKfaAzS4OococimjVm3nQw3TuzH5UNsocrcTBbhnerblyHj4A49qXbIiZdpA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/electron-publish/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/electron-publish/node_modules/fs-extra": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.1.0.tgz", + "integrity": "sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/electron-publish/node_modules/jsonfile": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.2.0.tgz", + "integrity": "sha512-FGuPw30AdOIUTRMC2OMRtQV+jkVj2cfPqSeWXv1NEAJ1qZ5zb1X6z1mFhbfOB/iy3ssJCD+3KuZ8r8C3uVFlAg==", + "dev": true, + "license": "MIT", + "dependencies": { + "universalify": "^2.0.0" + }, + "optionalDependencies": { + "graceful-fs": "^4.1.6" + } + }, + "node_modules/electron-publish/node_modules/mime": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/mime/-/mime-2.6.0.tgz", + "integrity": "sha512-USPkMeET31rOMiarsBNIHZKLGgvKc/LrjofAnBlOttf5ajRvqiRA8QsenbcooctK6d6Ts6aqZXBA+XbkKthiQg==", + "dev": true, + "license": "MIT", + "bin": { + "mime": "cli.js" + }, + "engines": { + "node": ">=4.0.0" + } + }, + "node_modules/electron-publish/node_modules/universalify": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz", + "integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 10.0.0" + } + }, + "node_modules/electron-store": { + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/electron-store/-/electron-store-8.2.0.tgz", + "integrity": "sha512-ukLL5Bevdil6oieAOXz3CMy+OgaItMiVBg701MNlG6W5RaC0AHN7rvlqTCmeb6O7jP0Qa1KKYTE0xV0xbhF4Hw==", + "license": "MIT", + "dependencies": { + "conf": "^10.2.0", + "type-fest": "^2.17.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/electron-store/node_modules/type-fest": { + "version": "2.19.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-2.19.0.tgz", + "integrity": "sha512-RAH822pAdBgcNMAfWnCBU3CFZcfZ/i1eZjwFU/dsLKumyuuP3niueg2UAukXYF0E2AAoc82ZSSf9J0WQBinzHA==", + "license": "(MIT OR CC0-1.0)", + "engines": { + "node": ">=12.20" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/electron-to-chromium": { + "version": "1.5.286", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.286.tgz", + "integrity": "sha512-9tfDXhJ4RKFNerfjdCcZfufu49vg620741MNs26a9+bhLThdB+plgMeou98CAaHu/WATj2iHOOHTp1hWtABj2A==", + "license": "ISC" + }, + "node_modules/electron-window": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/electron-window/-/electron-window-0.8.1.tgz", + "integrity": "sha512-W1i9LfnZJozk3MXE8VgsL2E5wOUHSgyCvcg1H2vQQjj+gqhO9lVudgY3z3SF7LJAmi+0vy3CJkbMqsynWB49EA==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-electron-renderer": "^2.0.0" + } + }, + "node_modules/electron/node_modules/@types/node": { + "version": "22.19.11", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.19.11.tgz", + "integrity": "sha512-BH7YwL6rA93ReqeQS1c4bsPpcfOmJasG+Fkr6Y59q83f9M1WcBRHR2vM+P9eOisYRcN3ujQoiZY8uk5W+1WL8w==", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": "~6.21.0" + } + }, + "node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "license": "MIT" + }, + "node_modules/emojis-list": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/emojis-list/-/emojis-list-3.0.0.tgz", + "integrity": "sha512-/kyM18EfinwXZbno9FyUGeFh87KC8HRQBQGildHZbEuRyWFOmv1U10o9BBp8XVZDVNNuQKyIGIu5ZYAAXJ0V2Q==", + "license": "MIT", + "engines": { + "node": ">= 4" + } + }, + "node_modules/encodeurl": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz", + "integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/encoding": { + "version": "0.1.13", + "resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.13.tgz", + "integrity": "sha512-ETBauow1T35Y/WZMkio9jiM0Z5xjHHmJ4XmjZOq1l/dXz3lr2sRn87nJy20RupqSh1F2m3HHPSp8ShIPQJrJ3A==", + "license": "MIT", + "optional": true, + "dependencies": { + "iconv-lite": "^0.6.2" + } + }, + "node_modules/encoding-sniffer": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/encoding-sniffer/-/encoding-sniffer-0.2.1.tgz", + "integrity": "sha512-5gvq20T6vfpekVtqrYQsSCFZ1wEg5+wW0/QaZMWkFr6BqD3NfKs0rLCx4rrVlSWJeZb5NBJgVLswK/w2MWU+Gw==", + "dev": true, + "license": "MIT", + "dependencies": { + "iconv-lite": "^0.6.3", + "whatwg-encoding": "^3.1.1" + }, + "funding": { + "url": "https://github.com/fb55/encoding-sniffer?sponsor=1" + } + }, + "node_modules/end-of-stream": { + "version": "1.4.5", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.5.tgz", + "integrity": "sha512-ooEGc6HP26xXq/N+GCGOT0JKCLDGrq2bQUZrQ7gyrJiZANJ/8YDTxTpQBXGMn+WbIQXNVpyWymm7KYVICQnyOg==", + "license": "MIT", + "dependencies": { + "once": "^1.4.0" + } + }, + "node_modules/engine.io": { + "version": "6.6.5", + "resolved": "https://registry.npmjs.org/engine.io/-/engine.io-6.6.5.tgz", + "integrity": "sha512-2RZdgEbXmp5+dVbRm0P7HQUImZpICccJy7rN7Tv+SFa55pH+lxnuw6/K1ZxxBfHoYpSkHLAO92oa8O4SwFXA2A==", + "license": "MIT", + "dependencies": { + "@types/cors": "^2.8.12", + "@types/node": ">=10.0.0", + "accepts": "~1.3.4", + "base64id": "2.0.0", + "cookie": "~0.7.2", + "cors": "~2.8.5", + "debug": "~4.4.1", + "engine.io-parser": "~5.2.1", + "ws": "~8.18.3" + }, + "engines": { + "node": ">=10.2.0" + } + }, + "node_modules/engine.io-client": { + "version": "6.6.4", + "resolved": "https://registry.npmjs.org/engine.io-client/-/engine.io-client-6.6.4.tgz", + "integrity": "sha512-+kjUJnZGwzewFDw951CDWcwj35vMNf2fcj7xQWOctq1F2i1jkDdVvdFG9kM/BEChymCH36KgjnW0NsL58JYRxw==", + "license": "MIT", + "dependencies": { + "@socket.io/component-emitter": "~3.1.0", + "debug": "~4.4.1", + "engine.io-parser": "~5.2.1", + "ws": "~8.18.3", + "xmlhttprequest-ssl": "~2.1.1" + } + }, + "node_modules/engine.io-client/node_modules/ws": { + "version": "8.18.3", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.18.3.tgz", + "integrity": "sha512-PEIGCY5tSlUt50cqyMXfCzX+oOPqN0vuGqWzbcJ2xvnkzkq46oOpz7dQaTDBdfICb4N14+GARUDw2XV2N4tvzg==", + "license": "MIT", + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": ">=5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, + "node_modules/engine.io-parser": { + "version": "5.2.3", + "resolved": "https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-5.2.3.tgz", + "integrity": "sha512-HqD3yTBfnBxIrbnM1DoD6Pcq8NECnh8d4As1Qgh0z5Gg3jRRIqijury0CL3ghu/edArpUYiYqQiDUQBIs4np3Q==", + "license": "MIT", + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/engine.io/node_modules/cookie": { + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.2.tgz", + "integrity": "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/engine.io/node_modules/ws": { + "version": "8.18.3", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.18.3.tgz", + "integrity": "sha512-PEIGCY5tSlUt50cqyMXfCzX+oOPqN0vuGqWzbcJ2xvnkzkq46oOpz7dQaTDBdfICb4N14+GARUDw2XV2N4tvzg==", + "license": "MIT", + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": ">=5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, + "node_modules/enhanced-resolve": { + "version": "5.19.0", + "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.19.0.tgz", + "integrity": "sha512-phv3E1Xl4tQOShqSte26C7Fl84EwUdZsyOuSSk9qtAGyyQs2s3jJzComh+Abf4g187lUUAvH+H26omrqia2aGg==", + "license": "MIT", + "dependencies": { + "graceful-fs": "^4.2.4", + "tapable": "^2.3.0" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/enquirer": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/enquirer/-/enquirer-2.3.6.tgz", + "integrity": "sha512-yjNnPr315/FjS4zIsUxYguYUPP2e1NK4d7E7ZOLiyYCcbFBiTMyID+2wvm2w6+pZ/odMA7cRkjhsPbltwBOrLg==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-colors": "^4.1.1" + }, + "engines": { + "node": ">=8.6" + } + }, + "node_modules/entities": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz", + "integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==", + "license": "BSD-2-Clause", + "engines": { + "node": ">=0.12" + }, + "funding": { + "url": "https://github.com/fb55/entities?sponsor=1" + } + }, + "node_modules/env-paths": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/env-paths/-/env-paths-2.2.1.tgz", + "integrity": "sha512-+h1lkLKhZMTYjog1VEpJNG7NZJWcuc2DDk/qsqSTRRCOXiLjeQ1d1/udrUGhqMxUgAlwKNZ0cf2uqan5GLuS2A==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/envinfo": { + "version": "7.13.0", + "resolved": "https://registry.npmjs.org/envinfo/-/envinfo-7.13.0.tgz", + "integrity": "sha512-cvcaMr7KqXVh4nyzGTVqTum+gAiL265x5jUWQIDLq//zOGbW+gSW/C+OWLleY/rs9Qole6AZLMXPbtIFQbqu+Q==", + "license": "MIT", + "bin": { + "envinfo": "dist/cli.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/err-code": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/err-code/-/err-code-2.0.3.tgz", + "integrity": "sha512-2bmlRpNKBxT/CRmPOlyISQpNj+qSeYvcym/uT0Jx2bMOlKLtSy1ZmLuVxSEKKyor/N5yhvp/ZiG1oE3DEYMSFA==", + "license": "MIT" + }, + "node_modules/errno": { + "version": "0.1.8", + "resolved": "https://registry.npmjs.org/errno/-/errno-0.1.8.tgz", + "integrity": "sha512-dJ6oBr5SQ1VSd9qkk7ByRgb/1SH4JZjCHSW/mr63/QcXO9zLVxvJ6Oy13nio03rxpSnVDDjFor75SjVeZWPW/A==", + "license": "MIT", + "optional": true, + "dependencies": { + "prr": "~1.0.1" + }, + "bin": { + "errno": "cli.js" + } + }, + "node_modules/error-ex": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.4.tgz", + "integrity": "sha512-sqQamAnR14VgCr1A618A3sGrygcpK+HEbenA/HiEAkkUwcZIIB/tgWqHFxWgOyDh4nB4JCRimh79dR5Ywc9MDQ==", + "license": "MIT", + "dependencies": { + "is-arrayish": "^0.2.1" + } + }, + "node_modules/es-abstract": { + "version": "1.24.1", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.24.1.tgz", + "integrity": "sha512-zHXBLhP+QehSSbsS9Pt23Gg964240DPd6QCf8WpkqEXxQ7fhdZzYsocOr5u7apWonsS5EjZDmTF+/slGMyasvw==", + "dev": true, + "license": "MIT", + "dependencies": { + "array-buffer-byte-length": "^1.0.2", + "arraybuffer.prototype.slice": "^1.0.4", + "available-typed-arrays": "^1.0.7", + "call-bind": "^1.0.8", + "call-bound": "^1.0.4", + "data-view-buffer": "^1.0.2", + "data-view-byte-length": "^1.0.2", + "data-view-byte-offset": "^1.0.1", + "es-define-property": "^1.0.1", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.1.1", + "es-set-tostringtag": "^2.1.0", + "es-to-primitive": "^1.3.0", + "function.prototype.name": "^1.1.8", + "get-intrinsic": "^1.3.0", + "get-proto": "^1.0.1", + "get-symbol-description": "^1.1.0", + "globalthis": "^1.0.4", + "gopd": "^1.2.0", + "has-property-descriptors": "^1.0.2", + "has-proto": "^1.2.0", + "has-symbols": "^1.1.0", + "hasown": "^2.0.2", + "internal-slot": "^1.1.0", + "is-array-buffer": "^3.0.5", + "is-callable": "^1.2.7", + "is-data-view": "^1.0.2", + "is-negative-zero": "^2.0.3", + "is-regex": "^1.2.1", + "is-set": "^2.0.3", + "is-shared-array-buffer": "^1.0.4", + "is-string": "^1.1.1", + "is-typed-array": "^1.1.15", + "is-weakref": "^1.1.1", + "math-intrinsics": "^1.1.0", + "object-inspect": "^1.13.4", + "object-keys": "^1.1.1", + "object.assign": "^4.1.7", + "own-keys": "^1.0.1", + "regexp.prototype.flags": "^1.5.4", + "safe-array-concat": "^1.1.3", + "safe-push-apply": "^1.0.0", + "safe-regex-test": "^1.1.0", + "set-proto": "^1.0.0", + "stop-iteration-iterator": "^1.1.0", + "string.prototype.trim": "^1.2.10", + "string.prototype.trimend": "^1.0.9", + "string.prototype.trimstart": "^1.0.8", + "typed-array-buffer": "^1.0.3", + "typed-array-byte-length": "^1.0.3", + "typed-array-byte-offset": "^1.0.4", + "typed-array-length": "^1.0.7", + "unbox-primitive": "^1.1.0", + "which-typed-array": "^1.1.19" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/es-define-property": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz", + "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-errors": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", + "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-iterator-helpers": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/es-iterator-helpers/-/es-iterator-helpers-1.2.2.tgz", + "integrity": "sha512-BrUQ0cPTB/IwXj23HtwHjS9n7O4h9FX94b4xc5zlTHxeLgTAdzYUDyy6KdExAl9lbN5rtfe44xpjpmj9grxs5w==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.4", + "define-properties": "^1.2.1", + "es-abstract": "^1.24.1", + "es-errors": "^1.3.0", + "es-set-tostringtag": "^2.1.0", + "function-bind": "^1.1.2", + "get-intrinsic": "^1.3.0", + "globalthis": "^1.0.4", + "gopd": "^1.2.0", + "has-property-descriptors": "^1.0.2", + "has-proto": "^1.2.0", + "has-symbols": "^1.1.0", + "internal-slot": "^1.1.0", + "iterator.prototype": "^1.1.5", + "safe-array-concat": "^1.1.3" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-module-lexer": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-2.0.0.tgz", + "integrity": "sha512-5POEcUuZybH7IdmGsD8wlf0AI55wMecM9rVBTI/qEAy2c1kTOm3DjFYjrBdI2K3BaJjJYfYFeRtM0t9ssnRuxw==", + "license": "MIT" + }, + "node_modules/es-object-atoms": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz", + "integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-set-tostringtag": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.1.0.tgz", + "integrity": "sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.6", + "has-tostringtag": "^1.0.2", + "hasown": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-shim-unscopables": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/es-shim-unscopables/-/es-shim-unscopables-1.1.0.tgz", + "integrity": "sha512-d9T8ucsEhh8Bi1woXCf+TIKDIROLG5WCkxg8geBCbvk22kzwC5G2OnXVMO6FUsvQlgUUXQ2itephWDLqDzbeCw==", + "dev": true, + "license": "MIT", + "dependencies": { + "hasown": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-to-primitive": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.3.0.tgz", + "integrity": "sha512-w+5mJ3GuFL+NjVtJlvydShqE1eN3h3PbI7/5LAsYJP/2qtuMXjfL2LpHSRqo4b4eSF5K/DH1JXKUAHSB2UW50g==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-callable": "^1.2.7", + "is-date-object": "^1.0.5", + "is-symbol": "^1.0.4" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/es6-error": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/es6-error/-/es6-error-4.1.1.tgz", + "integrity": "sha512-Um/+FxMr9CISWh0bi5Zv0iOD+4cFh5qLeks1qhAopKVAJw3drgKbKySikp7wGhDL0HPeaja0P5ULZrxLkniUVg==", + "devOptional": true, + "license": "MIT" + }, + "node_modules/es6-promise": { + "version": "4.2.8", + "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz", + "integrity": "sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==", + "license": "MIT" + }, + "node_modules/escalade": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", + "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/escape-html": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==", + "license": "MIT" + }, + "node_modules/escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/escodegen": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-2.1.0.tgz", + "integrity": "sha512-2NlIDTwUWJN0mRPQOdtQBzbUHvdGY2P1VXSyU83Q3xKxM7WHX2Ql8dKq782Q9TgQUNOLEzEYu9bzLNj1q88I5w==", + "license": "BSD-2-Clause", + "dependencies": { + "esprima": "^4.0.1", + "estraverse": "^5.2.0", + "esutils": "^2.0.2" + }, + "bin": { + "escodegen": "bin/escodegen.js", + "esgenerate": "bin/esgenerate.js" + }, + "engines": { + "node": ">=6.0" + }, + "optionalDependencies": { + "source-map": "~0.6.1" + } + }, + "node_modules/eslint": { + "version": "8.57.1", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.57.1.tgz", + "integrity": "sha512-ypowyDxpVSYpkXr9WPv2PAZCtNip1Mv5KTW0SCurXv/9iOpcrH9PaqUElksqEB6pChqHGDRCFTyrZlGhnLNGiA==", + "deprecated": "This version is no longer supported. Please see https://eslint.org/version-support for other options.", + "dev": true, + "license": "MIT", + "dependencies": { + "@eslint-community/eslint-utils": "^4.2.0", + "@eslint-community/regexpp": "^4.6.1", + "@eslint/eslintrc": "^2.1.4", + "@eslint/js": "8.57.1", + "@humanwhocodes/config-array": "^0.13.0", + "@humanwhocodes/module-importer": "^1.0.1", + "@nodelib/fs.walk": "^1.2.8", + "@ungap/structured-clone": "^1.2.0", + "ajv": "^6.12.4", + "chalk": "^4.0.0", + "cross-spawn": "^7.0.2", + "debug": "^4.3.2", + "doctrine": "^3.0.0", + "escape-string-regexp": "^4.0.0", + "eslint-scope": "^7.2.2", + "eslint-visitor-keys": "^3.4.3", + "espree": "^9.6.1", + "esquery": "^1.4.2", + "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", + "file-entry-cache": "^6.0.1", + "find-up": "^5.0.0", + "glob-parent": "^6.0.2", + "globals": "^13.19.0", + "graphemer": "^1.4.0", + "ignore": "^5.2.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "is-path-inside": "^3.0.3", + "js-yaml": "^4.1.0", + "json-stable-stringify-without-jsonify": "^1.0.1", + "levn": "^0.4.1", + "lodash.merge": "^4.6.2", + "minimatch": "^3.1.2", + "natural-compare": "^1.4.0", + "optionator": "^0.9.3", + "strip-ansi": "^6.0.1", + "text-table": "^0.2.0" + }, + "bin": { + "eslint": "bin/eslint.js" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint-import-resolver-node": { + "version": "0.3.9", + "resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.9.tgz", + "integrity": "sha512-WFj2isz22JahUv+B788TlO3N6zL3nNJGU8CcZbPZvVEkBPaJdCV4vy5wyghty5ROFbCRnm132v8BScu5/1BQ8g==", + "dev": true, + "license": "MIT", + "dependencies": { + "debug": "^3.2.7", + "is-core-module": "^2.13.0", + "resolve": "^1.22.4" + } + }, + "node_modules/eslint-import-resolver-node/node_modules/debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "^2.1.1" + } + }, + "node_modules/eslint-module-utils": { + "version": "2.12.1", + "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.12.1.tgz", + "integrity": "sha512-L8jSWTze7K2mTg0vos/RuLRS5soomksDPoJLXIslC7c8Wmut3bx7CPpJijDcBZtxQ5lrbUdM+s0OlNbz0DCDNw==", + "dev": true, + "license": "MIT", + "dependencies": { + "debug": "^3.2.7" + }, + "engines": { + "node": ">=4" + }, + "peerDependenciesMeta": { + "eslint": { + "optional": true + } + } + }, + "node_modules/eslint-module-utils/node_modules/debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "^2.1.1" + } + }, + "node_modules/eslint-plugin-deprecation": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-deprecation/-/eslint-plugin-deprecation-3.0.0.tgz", + "integrity": "sha512-JuVLdNg/uf0Adjg2tpTyYoYaMbwQNn/c78P1HcccokvhtRphgnRjZDKmhlxbxYptppex03zO76f97DD/yQHv7A==", + "dev": true, + "license": "LGPL-3.0-or-later", + "dependencies": { + "@typescript-eslint/utils": "^7.0.0", + "ts-api-utils": "^1.3.0", + "tslib": "^2.3.1" + }, + "peerDependencies": { + "eslint": "^8.0.0", + "typescript": "^4.2.4 || ^5.0.0" + } + }, + "node_modules/eslint-plugin-import": { + "version": "2.32.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.32.0.tgz", + "integrity": "sha512-whOE1HFo/qJDyX4SnXzP4N6zOWn79WhnCUY/iDR0mPfQZO8wcYE4JClzI2oZrhBnnMUCBCHZhO6VQyoBU95mZA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@rtsao/scc": "^1.1.0", + "array-includes": "^3.1.9", + "array.prototype.findlastindex": "^1.2.6", + "array.prototype.flat": "^1.3.3", + "array.prototype.flatmap": "^1.3.3", + "debug": "^3.2.7", + "doctrine": "^2.1.0", + "eslint-import-resolver-node": "^0.3.9", + "eslint-module-utils": "^2.12.1", + "hasown": "^2.0.2", + "is-core-module": "^2.16.1", + "is-glob": "^4.0.3", + "minimatch": "^3.1.2", + "object.fromentries": "^2.0.8", + "object.groupby": "^1.0.3", + "object.values": "^1.2.1", + "semver": "^6.3.1", + "string.prototype.trimend": "^1.0.9", + "tsconfig-paths": "^3.15.0" + }, + "engines": { + "node": ">=4" + }, + "peerDependencies": { + "eslint": "^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8 || ^9" + } + }, + "node_modules/eslint-plugin-import/node_modules/debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "^2.1.1" + } + }, + "node_modules/eslint-plugin-import/node_modules/doctrine": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz", + "integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "esutils": "^2.0.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/eslint-plugin-import/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/eslint-plugin-import/node_modules/semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/eslint-plugin-no-null": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/eslint-plugin-no-null/-/eslint-plugin-no-null-1.0.2.tgz", + "integrity": "sha512-uRDiz88zCO/2rzGfgG15DBjNsgwWtWiSo4Ezy7zzajUgpnFIqd1TjepKeRmJZHEfBGu58o2a8S0D7vglvvhkVA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=5.0.0" + }, + "peerDependencies": { + "eslint": ">=3.0.0" + } + }, + "node_modules/eslint-plugin-no-unsanitized": { + "version": "4.1.4", + "resolved": "https://registry.npmjs.org/eslint-plugin-no-unsanitized/-/eslint-plugin-no-unsanitized-4.1.4.tgz", + "integrity": "sha512-cjAoZoq3J+5KJuycYYOWrc0/OpZ7pl2Z3ypfFq4GtaAgheg+L7YGxUo2YS3avIvo/dYU5/zR2hXu3v81M9NxhQ==", + "dev": true, + "license": "MPL-2.0", + "peerDependencies": { + "eslint": "^8 || ^9" + } + }, + "node_modules/eslint-plugin-react": { + "version": "7.37.5", + "resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.37.5.tgz", + "integrity": "sha512-Qteup0SqU15kdocexFNAJMvCJEfa2xUKNV4CC1xsVMrIIqEy3SQ/rqyxCWNzfrd3/ldy6HMlD2e0JDVpDg2qIA==", + "dev": true, + "license": "MIT", + "dependencies": { + "array-includes": "^3.1.8", + "array.prototype.findlast": "^1.2.5", + "array.prototype.flatmap": "^1.3.3", + "array.prototype.tosorted": "^1.1.4", + "doctrine": "^2.1.0", + "es-iterator-helpers": "^1.2.1", + "estraverse": "^5.3.0", + "hasown": "^2.0.2", + "jsx-ast-utils": "^2.4.1 || ^3.0.0", + "minimatch": "^3.1.2", + "object.entries": "^1.1.9", + "object.fromentries": "^2.0.8", + "object.values": "^1.2.1", + "prop-types": "^15.8.1", + "resolve": "^2.0.0-next.5", + "semver": "^6.3.1", + "string.prototype.matchall": "^4.0.12", + "string.prototype.repeat": "^1.0.0" + }, + "engines": { + "node": ">=4" + }, + "peerDependencies": { + "eslint": "^3 || ^4 || ^5 || ^6 || ^7 || ^8 || ^9.7" + } + }, + "node_modules/eslint-plugin-react/node_modules/doctrine": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz", + "integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "esutils": "^2.0.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/eslint-plugin-react/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/eslint-plugin-react/node_modules/resolve": { + "version": "2.0.0-next.5", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-2.0.0-next.5.tgz", + "integrity": "sha512-U7WjGVG9sH8tvjW5SmGbQuui75FiyjAX72HX15DwBBwF9dNiQZRQAg9nnPhYy+TUnE0+VcrttuvNI8oSxZcocA==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-core-module": "^2.13.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + }, + "bin": { + "resolve": "bin/resolve" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/eslint-plugin-react/node_modules/semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/eslint-scope": { + "version": "7.2.2", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.2.tgz", + "integrity": "sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint-visitor-keys": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", + "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/espree": { + "version": "9.6.1", + "resolved": "https://registry.npmjs.org/espree/-/espree-9.6.1.tgz", + "integrity": "sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "acorn": "^8.9.0", + "acorn-jsx": "^5.3.2", + "eslint-visitor-keys": "^3.4.1" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/esprima": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "license": "BSD-2-Clause", + "bin": { + "esparse": "bin/esparse.js", + "esvalidate": "bin/esvalidate.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/esquery": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.7.0.tgz", + "integrity": "sha512-Ap6G0WQwcU/LHsvLwON1fAQX9Zp0A2Y6Y/cJBl9r/JbW90Zyg4/zbG6zzKa2OTALELarYHmKu0GhpM5EO+7T0g==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "estraverse": "^5.1.0" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/esrecurse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "license": "BSD-2-Clause", + "dependencies": { + "estraverse": "^5.2.0" + }, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "license": "BSD-2-Clause", + "engines": { + "node": ">=4.0" + } + }, + "node_modules/esutils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", + "license": "BSD-2-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/etag": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", + "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/event-stream": { + "version": "3.3.4", + "resolved": "https://registry.npmjs.org/event-stream/-/event-stream-3.3.4.tgz", + "integrity": "sha512-QHpkERcGsR0T7Qm3HNJSyXKEEj8AHNxkY3PK8TS2KJvQ7NiSHe3DDpwVKKtoYprL/AreyzFBeIkBIWChAqn60g==", + "dev": true, + "license": "MIT", + "dependencies": { + "duplexer": "~0.1.1", + "from": "~0", + "map-stream": "~0.1.0", + "pause-stream": "0.0.11", + "split": "0.3", + "stream-combiner": "~0.0.4", + "through": "~2.3.1" + } + }, + "node_modules/event-stream/node_modules/split": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/split/-/split-0.3.3.tgz", + "integrity": "sha512-wD2AeVmxXRBoX44wAycgjVpMhvbwdI2aZjCkvfNcH1YqHQvJVa1duWc73OyVGJUc05fhFaTZeQ/PYsrmyH0JVA==", + "dev": true, + "license": "MIT", + "dependencies": { + "through": "2" + }, + "engines": { + "node": "*" + } + }, + "node_modules/event-target-shim": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz", + "integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/eventemitter3": { + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz", + "integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==", + "license": "MIT" + }, + "node_modules/events": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/events/-/events-3.3.0.tgz", + "integrity": "sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==", + "license": "MIT", + "engines": { + "node": ">=0.8.x" + } + }, + "node_modules/events-universal": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/events-universal/-/events-universal-1.0.1.tgz", + "integrity": "sha512-LUd5euvbMLpwOF8m6ivPCbhQeSiYVNb8Vs0fQ8QjXo0JTkEHpz8pxdQf0gStltaPpw0Cca8b39KxvK9cfKRiAw==", + "license": "Apache-2.0", + "dependencies": { + "bare-events": "^2.7.0" + } + }, + "node_modules/eventsource": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/eventsource/-/eventsource-3.0.7.tgz", + "integrity": "sha512-CRT1WTyuQoD771GW56XEZFQ/ZoSfWid1alKGDYMmkt2yl8UXrVR4pspqWNEcqKvVIzg6PAltWjxcSSPrboA4iA==", + "license": "MIT", + "dependencies": { + "eventsource-parser": "^3.0.1" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/eventsource-parser": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/eventsource-parser/-/eventsource-parser-3.0.6.tgz", + "integrity": "sha512-Vo1ab+QXPzZ4tCa8SwIHJFaSzy4R6SHf7BY79rFBDf0idraZWAkYrDjDj8uWaSm3S2TK+hJ7/t1CEmZ7jXw+pg==", + "license": "MIT", + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/execa": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-5.0.0.tgz", + "integrity": "sha512-ov6w/2LCiuyO4RLYGdpFGjkcs0wMTgGE8PrkTHikeUy5iJekXyPIKUjifk5CsE0pt7sMCrMZ3YNqoCj6idQOnQ==", + "license": "MIT", + "dependencies": { + "cross-spawn": "^7.0.3", + "get-stream": "^6.0.0", + "human-signals": "^2.1.0", + "is-stream": "^2.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^4.0.1", + "onetime": "^5.1.2", + "signal-exit": "^3.0.3", + "strip-final-newline": "^2.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sindresorhus/execa?sponsor=1" + } + }, + "node_modules/expand-template": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/expand-template/-/expand-template-2.0.3.tgz", + "integrity": "sha512-XYfuKMvj4O35f/pOXLObndIRvyQ+/+6AhODh+OKWj9S9498pHHn/IMszH+gt0fBCRWMNfk1ZSp5x3AifmnI2vg==", + "license": "(MIT OR WTFPL)", + "engines": { + "node": ">=6" + } + }, + "node_modules/exponential-backoff": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/exponential-backoff/-/exponential-backoff-3.1.3.tgz", + "integrity": "sha512-ZgEeZXj30q+I0EN+CbSSpIyPaJ5HVQD18Z1m+u1FXbAeT94mr1zw50q4q6jiiC447Nl/YTcIYSAftiGqetwXCA==", + "license": "Apache-2.0" + }, + "node_modules/express": { + "version": "4.22.1", + "resolved": "https://registry.npmjs.org/express/-/express-4.22.1.tgz", + "integrity": "sha512-F2X8g9P1X7uCPZMA3MVf9wcTqlyNp7IhH5qPCI0izhaOIYXaW9L535tGA3qmjRzpH+bZczqq7hVKxTR4NWnu+g==", + "license": "MIT", + "dependencies": { + "accepts": "~1.3.8", + "array-flatten": "1.1.1", + "body-parser": "~1.20.3", + "content-disposition": "~0.5.4", + "content-type": "~1.0.4", + "cookie": "~0.7.1", + "cookie-signature": "~1.0.6", + "debug": "2.6.9", + "depd": "2.0.0", + "encodeurl": "~2.0.0", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "finalhandler": "~1.3.1", + "fresh": "~0.5.2", + "http-errors": "~2.0.0", + "merge-descriptors": "1.0.3", + "methods": "~1.1.2", + "on-finished": "~2.4.1", + "parseurl": "~1.3.3", + "path-to-regexp": "~0.1.12", + "proxy-addr": "~2.0.7", + "qs": "~6.14.0", + "range-parser": "~1.2.1", + "safe-buffer": "5.2.1", + "send": "~0.19.0", + "serve-static": "~1.16.2", + "setprototypeof": "1.2.0", + "statuses": "~2.0.1", + "type-is": "~1.6.18", + "utils-merge": "1.0.1", + "vary": "~1.1.2" + }, + "engines": { + "node": ">= 0.10.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/express-http-proxy": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/express-http-proxy/-/express-http-proxy-2.1.2.tgz", + "integrity": "sha512-FXcAcs7Nf/hF73Mzh0WDWPwaOlsEUL/fCHW3L4wU6DH79dypsaxmbnAildCLniFs7HQuuvoiR6bjNVUvGuTb5g==", + "license": "MIT", + "dependencies": { + "debug": "^3.0.1", + "es6-promise": "^4.1.1", + "raw-body": "^2.3.0" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/express-http-proxy/node_modules/debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "license": "MIT", + "dependencies": { + "ms": "^2.1.1" + } + }, + "node_modules/express-rate-limit": { + "version": "8.2.1", + "resolved": "https://registry.npmjs.org/express-rate-limit/-/express-rate-limit-8.2.1.tgz", + "integrity": "sha512-PCZEIEIxqwhzw4KF0n7QF4QqruVTcF73O5kFKUnGOyjbCCgizBBiFaYpd/fnBLUMPw/BWw9OsiN7GgrNYr7j6g==", + "license": "MIT", + "dependencies": { + "ip-address": "10.0.1" + }, + "engines": { + "node": ">= 16" + }, + "funding": { + "url": "https://github.com/sponsors/express-rate-limit" + }, + "peerDependencies": { + "express": ">= 4.11" + } + }, + "node_modules/express-rate-limit/node_modules/ip-address": { + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/ip-address/-/ip-address-10.0.1.tgz", + "integrity": "sha512-NWv9YLW4PoW2B7xtzaS3NCot75m6nK7Icdv0o3lfMceJVRfSoQwqD4wEH5rLwoKJwUiZ/rfpiVBhnaF0FK4HoA==", + "license": "MIT", + "engines": { + "node": ">= 12" + } + }, + "node_modules/express/node_modules/cookie": { + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.2.tgz", + "integrity": "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/express/node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "license": "MIT", + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/express/node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", + "license": "MIT" + }, + "node_modules/extend": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", + "license": "MIT" + }, + "node_modules/extract-zip": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-2.0.1.tgz", + "integrity": "sha512-GDhU9ntwuKyGXdZBUgTIe+vXnWj0fppUEtMDL0+idd5Sta8TGpHssn/eusA9mrPr9qNDym6SxAYZjNvCn/9RBg==", + "license": "BSD-2-Clause", + "dependencies": { + "debug": "^4.1.1", + "get-stream": "^5.1.0", + "yauzl": "^2.10.0" + }, + "bin": { + "extract-zip": "cli.js" + }, + "engines": { + "node": ">= 10.17.0" + }, + "optionalDependencies": { + "@types/yauzl": "^2.9.1" + } + }, + "node_modules/extract-zip/node_modules/get-stream": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", + "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", + "license": "MIT", + "dependencies": { + "pump": "^3.0.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/extsprintf": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.4.1.tgz", + "integrity": "sha512-Wrk35e8ydCKDj/ArClo1VrPVmN8zph5V4AtHwIuHhvMXsKf73UT3BOD+azBIW+3wOJ4FhEH7zyaJCFvChjYvMA==", + "dev": true, + "engines": [ + "node >=0.6.0" + ], + "license": "MIT", + "optional": true + }, + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "license": "MIT" + }, + "node_modules/fast-fifo": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/fast-fifo/-/fast-fifo-1.3.2.tgz", + "integrity": "sha512-/d9sfos4yxzpwkDkuN7k2SqFKtYNmCTzgfEpz82x34IM9/zc8KGxQoXg1liNC/izpRM/MBdt44Nmx41ZWqk+FQ==", + "license": "MIT" + }, + "node_modules/fast-glob": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.3.tgz", + "integrity": "sha512-7MptL8U0cqcFdzIzwOTHoilX9x5BrNqye7Z/LuC7kCMRio1EMSyqRK3BEAUD7sXRq4iT4AzTVuZdhgQ2TCvYLg==", + "license": "MIT", + "dependencies": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.2", + "merge2": "^1.3.0", + "micromatch": "^4.0.8" + }, + "engines": { + "node": ">=8.6.0" + } + }, + "node_modules/fast-glob/node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "license": "MIT" + }, + "node_modules/fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", + "dev": true, + "license": "MIT" + }, + "node_modules/fast-plist": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/fast-plist/-/fast-plist-0.1.3.tgz", + "integrity": "sha512-d9cEfo/WcOezgPLAC/8t8wGb6YOD6JTCPMw2QcG2nAdFmyY+9rTUizCTaGjIZAloWENTEUMAPpkUAIJJJ0i96A==", + "license": "MIT" + }, + "node_modules/fast-uri": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.1.0.tgz", + "integrity": "sha512-iPeeDKJSWf4IEOasVVrknXpaBV0IApz/gp7S2bb7Z4Lljbl2MGJRqInZiUrQwV16cpzw/D3S5j5Julj/gT52AA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/fastify" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fastify" + } + ], + "license": "BSD-3-Clause" + }, + "node_modules/fastest-levenshtein": { + "version": "1.0.16", + "resolved": "https://registry.npmjs.org/fastest-levenshtein/-/fastest-levenshtein-1.0.16.tgz", + "integrity": "sha512-eRnCtTTtGZFpQCwhJiUOuxPQWRXVKYDn0b2PeHfXL6/Zi53SLAzAHfVhVWK2AryC/WH05kGfxhFIPvTF0SXQzg==", + "license": "MIT", + "engines": { + "node": ">= 4.9.1" + } + }, + "node_modules/fastq": { + "version": "1.20.1", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.20.1.tgz", + "integrity": "sha512-GGToxJ/w1x32s/D2EKND7kTil4n8OVk/9mycTc4VDza13lOvpUZTGX3mFSCtV9ksdGBVzvsyAVLM6mHFThxXxw==", + "license": "ISC", + "dependencies": { + "reusify": "^1.0.4" + } + }, + "node_modules/fd-slicer": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz", + "integrity": "sha512-cE1qsB/VwyQozZ+q1dGxR8LBYNZeofhEdUNGSMbQD3Gw2lAzX9Zb3uIU6Ebc/Fmyjo9AWWfnn0AUCHqtevs/8g==", + "license": "MIT", + "dependencies": { + "pend": "~1.2.0" + } + }, + "node_modules/fdir": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", + "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12.0.0" + }, + "peerDependencies": { + "picomatch": "^3 || ^4" + }, + "peerDependenciesMeta": { + "picomatch": { + "optional": true + } + } + }, + "node_modules/fetch-blob": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/fetch-blob/-/fetch-blob-3.2.0.tgz", + "integrity": "sha512-7yAQpD2UMJzLi1Dqv7qFYnPbaPx7ZfFK6PiIxQ4PfkGPyNyl2Ugx+a/umUonmKqjhM4DnfbMvdX6otXq83soQQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/jimmywarting" + }, + { + "type": "paypal", + "url": "https://paypal.me/jimmywarting" + } + ], + "license": "MIT", + "dependencies": { + "node-domexception": "^1.0.0", + "web-streams-polyfill": "^3.0.3" + }, + "engines": { + "node": "^12.20 || >= 14.13" + } + }, + "node_modules/fflate": { + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/fflate/-/fflate-0.8.2.tgz", + "integrity": "sha512-cPJU47OaAoCbg0pBvzsgpTPhmhqI5eJjh/JIu8tPj5q+T7iLvW/JAYUqmE7KOB4R1ZyEhzBaIQpQpardBF5z8A==", + "license": "MIT" + }, + "node_modules/figures": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/figures/-/figures-3.2.0.tgz", + "integrity": "sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg==", + "dev": true, + "license": "MIT", + "dependencies": { + "escape-string-regexp": "^1.0.5" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/figures/node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/file-entry-cache": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", + "integrity": "sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==", + "dev": true, + "license": "MIT", + "dependencies": { + "flat-cache": "^3.0.4" + }, + "engines": { + "node": "^10.12.0 || >=12.0.0" + } + }, + "node_modules/file-icons-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/file-icons-js/-/file-icons-js-1.0.3.tgz", + "integrity": "sha512-n4zoKEpMaAxBTUB7wtgrFBa4dM3b7mBLLA1VI/Q5Cdk/k2UA8S8oaxvnECp3QOzg0Dn+KKRzfIHF7qSdRkA65Q==", + "license": "MIT" + }, + "node_modules/file-type": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/file-type/-/file-type-5.2.0.tgz", + "integrity": "sha512-Iq1nJ6D2+yIO4c8HHg4fyVb8mAJieo1Oloy1mLLaB2PvezNedhBVm+QU7g0qM42aiMbRXTxKKwGD17rjKNJYVQ==", + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/file-uri-to-path": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", + "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==", + "license": "MIT" + }, + "node_modules/filelist": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/filelist/-/filelist-1.0.4.tgz", + "integrity": "sha512-w1cEuf3S+DrLCQL7ET6kz+gmlJdbq9J7yXCSjK/OZCPA+qEN1WyF4ZAf0YYJa4/shHJra2t/d/r8SV4Ji+x+8Q==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "minimatch": "^5.0.1" + } + }, + "node_modules/filelist/node_modules/brace-expansion": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz", + "integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/filelist/node_modules/minimatch": { + "version": "5.1.6", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", + "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/filename-reserved-regex": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/filename-reserved-regex/-/filename-reserved-regex-2.0.0.tgz", + "integrity": "sha512-lc1bnsSr4L4Bdif8Xb/qrtokGbq5zlsms/CYH8PP+WtCkGNF65DPiQY8vG3SakEdRn8Dlnm+gW/qWKKjS5sZzQ==", + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/filenamify": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/filenamify/-/filenamify-4.3.0.tgz", + "integrity": "sha512-hcFKyUG57yWGAzu1CMt/dPzYZuv+jAJUT85bL8mrXvNe6hWj6yEHEc4EdcgiA6Z3oi1/9wXJdZPXF2dZNgwgOg==", + "license": "MIT", + "dependencies": { + "filename-reserved-regex": "^2.0.0", + "strip-outer": "^1.0.1", + "trim-repeated": "^1.0.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/fill-range": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", + "license": "MIT", + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/finalhandler": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.3.2.tgz", + "integrity": "sha512-aA4RyPcd3badbdABGDuTXCMTtOneUCAYH/gxoYRTZlIJdF0YPWuGqiAsIrhNnnqdXGswYk6dGujem4w80UJFhg==", + "license": "MIT", + "dependencies": { + "debug": "2.6.9", + "encodeurl": "~2.0.0", + "escape-html": "~1.0.3", + "on-finished": "~2.4.1", + "parseurl": "~1.3.3", + "statuses": "~2.0.2", + "unpipe": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/finalhandler/node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "license": "MIT", + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/finalhandler/node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", + "license": "MIT" + }, + "node_modules/find-cache-dir": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-3.3.2.tgz", + "integrity": "sha512-wXZV5emFEjrridIgED11OoUKLxiYjAcqot/NJdAkOhlJ+vGzwhOAfcG5OX1jP+S0PcjEn8bdMJv+g2jwQ3Onig==", + "license": "MIT", + "dependencies": { + "commondir": "^1.0.1", + "make-dir": "^3.0.2", + "pkg-dir": "^4.1.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/avajs/find-cache-dir?sponsor=1" + } + }, + "node_modules/find-cache-dir/node_modules/make-dir": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", + "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", + "license": "MIT", + "dependencies": { + "semver": "^6.0.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/find-cache-dir/node_modules/semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/find-git-exec": { + "version": "0.0.4", + "resolved": "https://registry.npmjs.org/find-git-exec/-/find-git-exec-0.0.4.tgz", + "integrity": "sha512-klzQwno+dpdeahtHhvZZ5Yn6K+zme1Aj+YJ4ZD+DywSLrQoyCywTrsubUZa1hHRehmfwBThoeKjS7fsaxhpfNA==", + "license": "MIT", + "dependencies": { + "@types/node": "^10.14.22", + "@types/which": "^1.3.2", + "which": "^2.0.1" + }, + "engines": { + "node": ">=10.11.0" + } + }, + "node_modules/find-git-exec/node_modules/@types/node": { + "version": "10.17.60", + "resolved": "https://registry.npmjs.org/@types/node/-/node-10.17.60.tgz", + "integrity": "sha512-F0KIgDJfy2nA3zMLmWGKxcH2ZVEtCZXHHdOQs2gSaQ27+lNeEfGxzkIw90aXswATX7AZ33tahPbzy6KAfUreVw==", + "license": "MIT" + }, + "node_modules/find-git-exec/node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "license": "ISC" + }, + "node_modules/find-git-exec/node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "license": "ISC", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/find-git-repositories": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/find-git-repositories/-/find-git-repositories-0.1.3.tgz", + "integrity": "sha512-6q8ZIQ7loe0eWbz1O79J0gQ2wVpQ1ajsjV64HC2iJ7gOOqlEuDlG/T0xYr5gDYBFSHlS8dah1KGbndiWWdJ0PA==", + "hasInstallScript": true, + "license": "MIT", + "dependencies": { + "nan": "^2.14.0" + } + }, + "node_modules/find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "license": "MIT", + "dependencies": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/find-yarn-workspace-root": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/find-yarn-workspace-root/-/find-yarn-workspace-root-2.0.0.tgz", + "integrity": "sha512-1IMnbjt4KzsQfnhnzNd8wUEgXZ44IzZaZmnLYx7D5FZlaHt2gW20Cri8Q+E/t5tIj4+epTBub+2Zxu/vNILzqQ==", + "license": "Apache-2.0", + "dependencies": { + "micromatch": "^4.0.2" + } + }, + "node_modules/fix-path": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/fix-path/-/fix-path-4.0.0.tgz", + "integrity": "sha512-g31GX207Tt+psI53ZSaB1egprYbEN0ZYl90aKcO22A2LmCNnFsSq3b5YpoKp3E/QEiWByTXGJOkFQG4S07Bc1A==", + "license": "MIT", + "dependencies": { + "shell-path": "^3.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/flat": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz", + "integrity": "sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==", + "license": "BSD-3-Clause", + "bin": { + "flat": "cli.js" + } + }, + "node_modules/flat-cache": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.2.0.tgz", + "integrity": "sha512-CYcENa+FtcUKLmhhqyctpclsq7QF38pKjZHsGNiSQF5r4FtoKDWabFDl3hzaEQMvT1LHEysw5twgLvpYYb4vbw==", + "dev": true, + "license": "MIT", + "dependencies": { + "flatted": "^3.2.9", + "keyv": "^4.5.3", + "rimraf": "^3.0.2" + }, + "engines": { + "node": "^10.12.0 || >=12.0.0" + } + }, + "node_modules/flat-cache/node_modules/rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "deprecated": "Rimraf versions prior to v4 are no longer supported", + "dev": true, + "license": "ISC", + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/flatted": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.3.3.tgz", + "integrity": "sha512-GX+ysw4PBCz0PzosHDepZGANEuFCMLrnRTiEy9McGjmkCQYwRq4A/X786G/fjM/+OjsWSU1ZrY5qyARZmO/uwg==", + "dev": true, + "license": "ISC" + }, + "node_modules/follow-redirects": { + "version": "1.15.11", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.11.tgz", + "integrity": "sha512-deG2P0JfjrTxl50XGCDyfI97ZGVCxIpfKYmfyrQ54n5FO/0gfIES8C/Psl6kWVDolizcaaxZJnTS0QSMxvnsBQ==", + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/RubenVerborgh" + } + ], + "license": "MIT", + "engines": { + "node": ">=4.0" + }, + "peerDependenciesMeta": { + "debug": { + "optional": true + } + } + }, + "node_modules/font-awesome": { + "version": "4.7.0", + "resolved": "https://registry.npmjs.org/font-awesome/-/font-awesome-4.7.0.tgz", + "integrity": "sha512-U6kGnykA/6bFmg1M/oT9EkFeIYv7JlX3bozwQJWiiLz6L0w3F5vBVPxHlwyX/vtNq1ckcpRKOB9f2Qal/VtFpg==", + "license": "(OFL-1.1 AND MIT)", + "engines": { + "node": ">=0.10.3" + } + }, + "node_modules/for-each": { + "version": "0.3.5", + "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.5.tgz", + "integrity": "sha512-dKx12eRCVIzqCxFGplyFKJMPvLEWgmNtUrpTiJIR5u97zEhRG8ySrtboPHZXx7daLxQVrl643cTzbab2tkQjxg==", + "license": "MIT", + "dependencies": { + "is-callable": "^1.2.7" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/foreground-child": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.3.1.tgz", + "integrity": "sha512-gIXjKqtFuWEgzFRJA9WCQeSJLZDjgJUOMCMzxtvFq/37KojM1BFGufqsCy0r4qSQmYLsZYMeyRqzIWOMup03sw==", + "license": "ISC", + "dependencies": { + "cross-spawn": "^7.0.6", + "signal-exit": "^4.0.1" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/foreground-child/node_modules/signal-exit": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", + "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", + "license": "ISC", + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/form-data": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.5.tgz", + "integrity": "sha512-8RipRLol37bNs2bhoV67fiTEvdTrbMUYcFTiy3+wuuOnUog2QBHCZWXDRijWQfAkhBj2Uf5UnVaiWwA5vdd82w==", + "license": "MIT", + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "es-set-tostringtag": "^2.1.0", + "hasown": "^2.0.2", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/formdata-polyfill": { + "version": "4.0.10", + "resolved": "https://registry.npmjs.org/formdata-polyfill/-/formdata-polyfill-4.0.10.tgz", + "integrity": "sha512-buewHzMvYL29jdeQTVILecSaZKnt/RJWjoZCF5OW60Z67/GmSLBkOFM7qh1PI3zFNtJbaZL5eQu1vLfazOwj4g==", + "license": "MIT", + "dependencies": { + "fetch-blob": "^3.1.2" + }, + "engines": { + "node": ">=12.20.0" + } + }, + "node_modules/forwarded": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", + "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/fresh": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", + "integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/from": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/from/-/from-0.1.7.tgz", + "integrity": "sha512-twe20eF1OxVxp/ML/kq2p1uc6KvFK/+vs8WjEbeKmV2He22MKm7YF2ANIt+EOqhJ5L3K/SuuPhk0hWQDjOM23g==", + "dev": true, + "license": "MIT" + }, + "node_modules/fromentries": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/fromentries/-/fromentries-1.3.2.tgz", + "integrity": "sha512-cHEpEQHUg0f8XdtZCc2ZAhrHzKzT0MrFUTcvx+hfxYu7rGMDc5SKoXFh+n4YigxsHXRzc6OrCshdR1bWH6HHyg==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/front-matter": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/front-matter/-/front-matter-4.0.2.tgz", + "integrity": "sha512-I8ZuJ/qG92NWX8i5x1Y8qyj3vizhXS31OxjKDu3LKP+7/qBgfIKValiZIEwoVoJKUHlhWtYrktkxV1XsX+pPlg==", + "dev": true, + "license": "MIT", + "dependencies": { + "js-yaml": "^3.13.1" + } + }, + "node_modules/front-matter/node_modules/argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "dev": true, + "license": "MIT", + "dependencies": { + "sprintf-js": "~1.0.2" + } + }, + "node_modules/front-matter/node_modules/js-yaml": { + "version": "3.14.2", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.2.tgz", + "integrity": "sha512-PMSmkqxr106Xa156c2M265Z+FTrPl+oxd/rgOQy2tijQeK5TxQ43psO1ZCwhVOSdnn+RzkzlRz/eY4BgJBYVpg==", + "dev": true, + "license": "MIT", + "dependencies": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/fs-constants": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz", + "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==", + "license": "MIT" + }, + "node_modules/fs-extra": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-4.0.3.tgz", + "integrity": "sha512-q6rbdDd1o2mAnQreO7YADIxf/Whx4AHBiRf6d+/cVT8h44ss+lHgxf1FemcqDnQt9X3ct4McHr+JMGlYSsK7Cg==", + "license": "MIT", + "dependencies": { + "graceful-fs": "^4.1.2", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + } + }, + "node_modules/fs-minipass": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-3.0.3.tgz", + "integrity": "sha512-XUBA9XClHbnJWSfBzjkm6RvPsyg3sryZt06BEQoXcF7EK/xpGaQYJgQKDJSUH5SGZ76Y7pFx1QBnXz09rU5Fbw==", + "dev": true, + "license": "ISC", + "dependencies": { + "minipass": "^7.0.3" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", + "license": "ISC" + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/fstream": { + "version": "1.0.12", + "resolved": "https://registry.npmjs.org/fstream/-/fstream-1.0.12.tgz", + "integrity": "sha512-WvJ193OHa0GHPEL+AycEJgxvBEwyfRkN1vhjca23OaPVMCaLCXTd5qAu82AjTcgP1UJmytkOKb63Ypde7raDIg==", + "deprecated": "This package is no longer supported.", + "license": "ISC", + "dependencies": { + "graceful-fs": "^4.1.2", + "inherits": "~2.0.0", + "mkdirp": ">=0.5 0", + "rimraf": "2" + }, + "engines": { + "node": ">=0.6" + } + }, + "node_modules/fstream/node_modules/rimraf": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", + "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", + "deprecated": "Rimraf versions prior to v4 are no longer supported", + "license": "ISC", + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + } + }, + "node_modules/function-bind": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/function.prototype.name": { + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/function.prototype.name/-/function.prototype.name-1.1.8.tgz", + "integrity": "sha512-e5iwyodOHhbMr/yNrc7fDYG4qlbIvI5gajyzPnb5TCwyhjApznQh1BMFou9b30SevY43gCJKXycoCBjMbsuW0Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.3", + "define-properties": "^1.2.1", + "functions-have-names": "^1.2.3", + "hasown": "^2.0.2", + "is-callable": "^1.2.7" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/functions-have-names": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/functions-have-names/-/functions-have-names-1.2.3.tgz", + "integrity": "sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/fuzzy": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/fuzzy/-/fuzzy-0.1.3.tgz", + "integrity": "sha512-/gZffu4ykarLrCiP3Ygsa86UAo1E5vEVlvTrpkKywXSbP9Xhln3oSp9QSV57gEq3JFFpGJ4GZ+5zdEp3FcUh4w==", + "engines": { + "node": ">= 0.6.0" + } + }, + "node_modules/gauge": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/gauge/-/gauge-4.0.4.tgz", + "integrity": "sha512-f9m+BEN5jkg6a0fZjleidjN51VE1X+mPFQ2DJ0uv1V39oCLCbsGe6yjbBnp7eK7z/+GAon99a3nHuqbuuthyPg==", + "deprecated": "This package is no longer supported.", + "dev": true, + "license": "ISC", + "dependencies": { + "aproba": "^1.0.3 || ^2.0.0", + "color-support": "^1.1.3", + "console-control-strings": "^1.1.0", + "has-unicode": "^2.0.1", + "signal-exit": "^3.0.7", + "string-width": "^4.2.3", + "strip-ansi": "^6.0.1", + "wide-align": "^1.1.5" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + } + }, + "node_modules/gaxios": { + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/gaxios/-/gaxios-7.1.3.tgz", + "integrity": "sha512-YGGyuEdVIjqxkxVH1pUTMY/XtmmsApXrCVv5EU25iX6inEPbV+VakJfLealkBtJN69AQmh1eGOdCl9Sm1UP6XQ==", + "license": "Apache-2.0", + "dependencies": { + "extend": "^3.0.2", + "https-proxy-agent": "^7.0.1", + "node-fetch": "^3.3.2", + "rimraf": "^5.0.1" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/gcp-metadata": { + "version": "8.1.2", + "resolved": "https://registry.npmjs.org/gcp-metadata/-/gcp-metadata-8.1.2.tgz", + "integrity": "sha512-zV/5HKTfCeKWnxG0Dmrw51hEWFGfcF2xiXqcA3+J90WDuP0SvoiSO5ORvcBsifmx/FoIjgQN3oNOGaQ5PhLFkg==", + "license": "Apache-2.0", + "dependencies": { + "gaxios": "^7.0.0", + "google-logging-utils": "^1.0.0", + "json-bigint": "^1.0.0" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/generator-function": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/generator-function/-/generator-function-2.0.1.tgz", + "integrity": "sha512-SFdFmIJi+ybC0vjlHN0ZGVGHc3lgE0DxPAT0djjVg+kjOnSqclqmj0KQ7ykTOLP6YxoqOvuAODGdcHJn+43q3g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/gensync": { + "version": "1.0.0-beta.2", + "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", + "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==", + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "license": "ISC", + "engines": { + "node": "6.* || 8.* || >= 10.*" + } + }, + "node_modules/get-func-name": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.2.tgz", + "integrity": "sha512-8vXOvuE167CtIc3OyItco7N/dpRtBbYOsPsXCz7X/PMnlGjYjSGuZJgM1Y7mmew7BKf9BqvLX2tnOVy1BBUsxQ==", + "license": "MIT", + "engines": { + "node": "*" + } + }, + "node_modules/get-intrinsic": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz", + "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "es-define-property": "^1.0.1", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.1.1", + "function-bind": "^1.1.2", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "has-symbols": "^1.1.0", + "hasown": "^2.0.2", + "math-intrinsics": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-package-type": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/get-package-type/-/get-package-type-0.1.0.tgz", + "integrity": "sha512-pjzuKtY64GYfWizNAJ0fr9VqttZkNiK2iS430LtIHzjBEr6bX8Am2zm4sW4Ro5wjWW5cAlRL1qAMTcXbjNAO2Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/get-pkg-repo": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/get-pkg-repo/-/get-pkg-repo-4.2.1.tgz", + "integrity": "sha512-2+QbHjFRfGB74v/pYWjd5OhU3TDIC2Gv/YKUTk/tCvAz0pkn/Mz6P3uByuBimLOcPvN2jYdScl3xGFSrx0jEcA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@hutson/parse-repository-url": "^3.0.0", + "hosted-git-info": "^4.0.0", + "through2": "^2.0.0", + "yargs": "^16.2.0" + }, + "bin": { + "get-pkg-repo": "src/cli.js" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/get-pkg-repo/node_modules/cliui": { + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", + "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", + "dev": true, + "license": "ISC", + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^7.0.0" + } + }, + "node_modules/get-pkg-repo/node_modules/wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/get-pkg-repo/node_modules/y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=10" + } + }, + "node_modules/get-pkg-repo/node_modules/yargs": { + "version": "16.2.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", + "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", + "dev": true, + "license": "MIT", + "dependencies": { + "cliui": "^7.0.2", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.0", + "y18n": "^5.0.5", + "yargs-parser": "^20.2.2" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/get-pkg-repo/node_modules/yargs-parser": { + "version": "20.2.9", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.9.tgz", + "integrity": "sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=10" + } + }, + "node_modules/get-port": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/get-port/-/get-port-5.1.1.tgz", + "integrity": "sha512-g/Q1aTSDOxFpchXC4i8ZWvxA1lnPqx/JHqcpIw0/LX9T8x/GBbi6YnlN5nhaKIFkT8oFsscUKgDJYxfwfS6QsQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/get-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz", + "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==", + "license": "MIT", + "dependencies": { + "dunder-proto": "^1.0.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/get-stream": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.0.tgz", + "integrity": "sha512-A1B3Bh1UmL0bidM/YX2NsCOTnGJePL9rO/M+Mw3m9f2gUpfokS0hi5Eah0WSUEWZdZhIZtMjkIYS7mDfOqNHbg==", + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/get-symbol-description": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/get-symbol-description/-/get-symbol-description-1.1.0.tgz", + "integrity": "sha512-w9UMqWwJxHNOvoNzSJ2oPF5wvYcvP7jUvYzhp67yEhTi17ZDBBC1z9pTdGuzjD+EFIqLSYRweZjqfiPzQ06Ebg==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.3", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.6" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-uri": { + "version": "6.0.5", + "resolved": "https://registry.npmjs.org/get-uri/-/get-uri-6.0.5.tgz", + "integrity": "sha512-b1O07XYq8eRuVzBNgJLstU6FYc1tS6wnMtF1I1D9lE8LxZSOGZ7LhxN54yPP6mGw5f2CkXY2BQUL9Fx41qvcIg==", + "license": "MIT", + "dependencies": { + "basic-ftp": "^5.0.2", + "data-uri-to-buffer": "^6.0.2", + "debug": "^4.3.4" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/git-raw-commits": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/git-raw-commits/-/git-raw-commits-3.0.0.tgz", + "integrity": "sha512-b5OHmZ3vAgGrDn/X0kS+9qCfNKWe4K/jFnhwzVWWg0/k5eLa3060tZShrRg8Dja5kPc+YjS0Gc6y7cRr44Lpjw==", + "dev": true, + "license": "MIT", + "dependencies": { + "dargs": "^7.0.0", + "meow": "^8.1.2", + "split2": "^3.2.2" + }, + "bin": { + "git-raw-commits": "cli.js" + }, + "engines": { + "node": ">=14" + } + }, + "node_modules/git-remote-origin-url": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/git-remote-origin-url/-/git-remote-origin-url-2.0.0.tgz", + "integrity": "sha512-eU+GGrZgccNJcsDH5LkXR3PB9M958hxc7sbA8DFJjrv9j4L2P/eZfKhM+QD6wyzpiv+b1BpK0XrYCxkovtjSLw==", + "dev": true, + "license": "MIT", + "dependencies": { + "gitconfiglocal": "^1.0.0", + "pify": "^2.3.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/git-remote-origin-url/node_modules/pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/git-semver-tags": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/git-semver-tags/-/git-semver-tags-5.0.1.tgz", + "integrity": "sha512-hIvOeZwRbQ+7YEUmCkHqo8FOLQZCEn18yevLHADlFPZY02KJGsu5FZt9YW/lybfK2uhWFI7Qg/07LekJiTv7iA==", + "dev": true, + "license": "MIT", + "dependencies": { + "meow": "^8.1.2", + "semver": "^7.0.0" + }, + "bin": { + "git-semver-tags": "cli.js" + }, + "engines": { + "node": ">=14" + } + }, + "node_modules/git-up": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/git-up/-/git-up-7.0.0.tgz", + "integrity": "sha512-ONdIrbBCFusq1Oy0sC71F5azx8bVkvtZtMJAsv+a6lz5YAmbNnLD6HAB4gptHZVLPR8S2/kVN6Gab7lryq5+lQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-ssh": "^1.4.0", + "parse-url": "^8.1.0" + } + }, + "node_modules/git-url-parse": { + "version": "14.0.0", + "resolved": "https://registry.npmjs.org/git-url-parse/-/git-url-parse-14.0.0.tgz", + "integrity": "sha512-NnLweV+2A4nCvn4U/m2AoYu0pPKlsmhK9cknG7IMwsjFY1S2jxM+mAhsDxyxfCIGfGaD+dozsyX4b6vkYc83yQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "git-up": "^7.0.0" + } + }, + "node_modules/gitconfiglocal": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/gitconfiglocal/-/gitconfiglocal-1.0.0.tgz", + "integrity": "sha512-spLUXeTAVHxDtKsJc8FkFVgFtMdEN9qPGpL23VfSHx4fP4+Ds097IXLvymbnDH8FnmxX5Nr9bPw3A+AQ6mWEaQ==", + "dev": true, + "license": "BSD", + "dependencies": { + "ini": "^1.3.2" + } + }, + "node_modules/github-from-package": { + "version": "0.0.0", + "resolved": "https://registry.npmjs.org/github-from-package/-/github-from-package-0.0.0.tgz", + "integrity": "sha512-SyHy3T1v2NUXn29OsWdxmK6RwHD+vkj3v8en8AOBZ1wBQ/hCAQ5bAQTD02kW4W9tUp/3Qh6J8r9EvntiyCmOOw==", + "license": "MIT" + }, + "node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "deprecated": "Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me", + "license": "ISC", + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/glob-parent": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "dev": true, + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.3" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/glob-to-regexp": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz", + "integrity": "sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==", + "license": "BSD-2-Clause" + }, + "node_modules/glob/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/global-agent": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/global-agent/-/global-agent-3.0.0.tgz", + "integrity": "sha512-PT6XReJ+D07JvGoxQMkT6qji/jVNfX/h364XHZOWeRzy64sSFr+xJ5OX7LI3b4MPQzdL4H8Y8M0xzPpsVMwA8Q==", + "license": "BSD-3-Clause", + "optional": true, + "dependencies": { + "boolean": "^3.0.1", + "es6-error": "^4.1.1", + "matcher": "^3.0.0", + "roarr": "^2.15.3", + "semver": "^7.3.2", + "serialize-error": "^7.0.1" + }, + "engines": { + "node": ">=10.0" + } + }, + "node_modules/globals": { + "version": "13.24.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.24.0.tgz", + "integrity": "sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "type-fest": "^0.20.2" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/globalthis": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/globalthis/-/globalthis-1.0.4.tgz", + "integrity": "sha512-DpLKbNU4WylpxJykQujfCcwYWiV/Jhm50Goo0wrVILAv5jOr9d+H+UR3PhSCD2rCCEIg0uc+G+muBTwD54JhDQ==", + "devOptional": true, + "license": "MIT", + "dependencies": { + "define-properties": "^1.2.1", + "gopd": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/globby": { + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz", + "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==", + "license": "MIT", + "dependencies": { + "array-union": "^2.1.0", + "dir-glob": "^3.0.1", + "fast-glob": "^3.2.9", + "ignore": "^5.2.0", + "merge2": "^1.4.1", + "slash": "^3.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/google-auth-library": { + "version": "10.5.0", + "resolved": "https://registry.npmjs.org/google-auth-library/-/google-auth-library-10.5.0.tgz", + "integrity": "sha512-7ABviyMOlX5hIVD60YOfHw4/CxOfBhyduaYB+wbFWCWoni4N7SLcV46hrVRktuBbZjFC9ONyqamZITN7q3n32w==", + "license": "Apache-2.0", + "dependencies": { + "base64-js": "^1.3.0", + "ecdsa-sig-formatter": "^1.0.11", + "gaxios": "^7.0.0", + "gcp-metadata": "^8.0.0", + "google-logging-utils": "^1.0.0", + "gtoken": "^8.0.0", + "jws": "^4.0.0" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/google-logging-utils": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/google-logging-utils/-/google-logging-utils-1.1.3.tgz", + "integrity": "sha512-eAmLkjDjAFCVXg7A1unxHsLf961m6y17QFqXqAXGj/gVkKFrEICfStRfwUlGNfeCEjNRa32JEWOUTlYXPyyKvA==", + "license": "Apache-2.0", + "engines": { + "node": ">=14" + } + }, + "node_modules/google-protobuf": { + "version": "3.21.4", + "resolved": "https://registry.npmjs.org/google-protobuf/-/google-protobuf-3.21.4.tgz", + "integrity": "sha512-MnG7N936zcKTco4Jd2PX2U96Kf9PxygAPKBug+74LHzmHXmceN16MmRcdgZv+DGef/S9YvQAfRsNCn4cjf9yyQ==", + "license": "(BSD-3-Clause AND Apache-2.0)" + }, + "node_modules/gopd": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz", + "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/got": { + "version": "11.8.6", + "resolved": "https://registry.npmjs.org/got/-/got-11.8.6.tgz", + "integrity": "sha512-6tfZ91bOr7bOXnK7PRDCGBLa1H4U080YHNaAQ2KsMGlLEzRbk44nsZF2E1IeRc3vtJHPVbKCYgdFbaGO2ljd8g==", + "license": "MIT", + "dependencies": { + "@sindresorhus/is": "^4.0.0", + "@szmarczak/http-timer": "^4.0.5", + "@types/cacheable-request": "^6.0.1", + "@types/responselike": "^1.0.0", + "cacheable-lookup": "^5.0.3", + "cacheable-request": "^7.0.2", + "decompress-response": "^6.0.0", + "http2-wrapper": "^1.0.0-beta.5.2", + "lowercase-keys": "^2.0.0", + "p-cancelable": "^2.0.0", + "responselike": "^2.0.0" + }, + "engines": { + "node": ">=10.19.0" + }, + "funding": { + "url": "https://github.com/sindresorhus/got?sponsor=1" + } + }, + "node_modules/graceful-fs": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", + "license": "ISC" + }, + "node_modules/graphemer": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/graphemer/-/graphemer-1.4.0.tgz", + "integrity": "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==", + "dev": true, + "license": "MIT" + }, + "node_modules/gtoken": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/gtoken/-/gtoken-8.0.0.tgz", + "integrity": "sha512-+CqsMbHPiSTdtSO14O51eMNlrp9N79gmeqmXeouJOhfucAedHw9noVe/n5uJk3tbKE6a+6ZCQg3RPhVhHByAIw==", + "license": "MIT", + "dependencies": { + "gaxios": "^7.0.0", + "jws": "^4.0.0" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/gunzip-maybe": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/gunzip-maybe/-/gunzip-maybe-1.4.2.tgz", + "integrity": "sha512-4haO1M4mLO91PW57BMsDFf75UmwoRX0GkdD+Faw+Lr+r/OZrOCS0pIBwOL1xCKQqnQzbNFGgK2V2CpBUPeFNTw==", + "license": "MIT", + "dependencies": { + "browserify-zlib": "^0.1.4", + "is-deflate": "^1.0.0", + "is-gzip": "^1.0.0", + "peek-stream": "^1.1.0", + "pumpify": "^1.3.3", + "through2": "^2.0.3" + }, + "bin": { + "gunzip-maybe": "bin.js" + } + }, + "node_modules/handlebars": { + "version": "4.7.8", + "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.8.tgz", + "integrity": "sha512-vafaFqs8MZkRrSX7sFVUdo3ap/eNiLnb4IakshzvP56X5Nr1iGKAIqdX6tMlm6HcNRIkr6AxO5jFEoJzzpT8aQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "minimist": "^1.2.5", + "neo-async": "^2.6.2", + "source-map": "^0.6.1", + "wordwrap": "^1.0.0" + }, + "bin": { + "handlebars": "bin/handlebars" + }, + "engines": { + "node": ">=0.4.7" + }, + "optionalDependencies": { + "uglify-js": "^3.1.4" + } + }, + "node_modules/hard-rejection": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/hard-rejection/-/hard-rejection-2.1.0.tgz", + "integrity": "sha512-VIZB+ibDhx7ObhAe7OVtoEbuP4h/MuOTHJ+J8h/eBXotJYl0fBgR72xDFCKgIh22OJZIOVNxBMWuhAr10r8HdA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/has-bigints": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.1.0.tgz", + "integrity": "sha512-R3pbpkcIqv2Pm3dUwgjclDRVmWpTJW2DcMzcIhEXEx1oh/CEMObMm3KLmRJOdvhM7o4uQBnwr8pzRK2sJWIqfg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/has-property-descriptors": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz", + "integrity": "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==", + "license": "MIT", + "dependencies": { + "es-define-property": "^1.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-proto": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.2.0.tgz", + "integrity": "sha512-KIL7eQPfHQRC8+XluaIw7BHUwwqL19bQn4hzNgdr+1wXoU0KKj6rufu47lhY7KbJR2C6T6+PfyN0Ea7wkSS+qQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "dunder-proto": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-symbols": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz", + "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-tostringtag": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.2.tgz", + "integrity": "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==", + "license": "MIT", + "dependencies": { + "has-symbols": "^1.0.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-unicode": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", + "integrity": "sha512-8Rf9Y83NBReMnx0gFzA8JImQACstCYWUplepDa9xprwwtmgEZUF0h/i5xSA625zB/I37EtrswSST6OXxwaaIJQ==", + "dev": true, + "license": "ISC" + }, + "node_modules/hasha": { + "version": "5.2.2", + "resolved": "https://registry.npmjs.org/hasha/-/hasha-5.2.2.tgz", + "integrity": "sha512-Hrp5vIK/xr5SkeN2onO32H0MgNZ0f17HRNH39WfL0SYUNOTZ5Lz1TJ8Pajo/87dYGEFlLMm7mIc/k/s6Bvz9HQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-stream": "^2.0.0", + "type-fest": "^0.8.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/hasha/node_modules/type-fest": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz", + "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==", + "dev": true, + "license": "(MIT OR CC0-1.0)", + "engines": { + "node": ">=8" + } + }, + "node_modules/hasown": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", + "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", + "license": "MIT", + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/he": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", + "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", + "license": "MIT", + "bin": { + "he": "bin/he" + } + }, + "node_modules/highlight.js": { + "version": "10.4.1", + "resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-10.4.1.tgz", + "integrity": "sha512-yR5lWvNz7c85OhVAEAeFhVCc/GV4C30Fjzc/rCP0aCWzc1UUOPUk55dK/qdwTZHBvMZo+eZ2jpk62ndX/xMFlg==", + "license": "BSD-3-Clause", + "engines": { + "node": "*" + } + }, + "node_modules/hono": { + "version": "4.11.9", + "resolved": "https://registry.npmjs.org/hono/-/hono-4.11.9.tgz", + "integrity": "sha512-Eaw2YTGM6WOxA6CXbckaEvslr2Ne4NFsKrvc0v97JD5awbmeBLO5w9Ho9L9kmKonrwF9RJlW6BxT1PVv/agBHQ==", + "license": "MIT", + "engines": { + "node": ">=16.9.0" + } + }, + "node_modules/hosted-git-info": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-4.1.0.tgz", + "integrity": "sha512-kyCuEOWjJqZuDbRHzL8V93NzQhwIB71oFWSyzVo+KPZI+pnQPPxucdkrOZvkLRnrf5URsQM+IJ09Dw29cRALIA==", + "dev": true, + "license": "ISC", + "dependencies": { + "lru-cache": "^6.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/html-encoding-sniffer": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-3.0.0.tgz", + "integrity": "sha512-oWv4T4yJ52iKrufjnyZPkrN0CH3QnrUqdB6In1g5Fe1mia8GmF36gnfNySxoZtxD5+NmYw1EElVXiBk93UeskA==", + "license": "MIT", + "dependencies": { + "whatwg-encoding": "^2.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/html-encoding-sniffer/node_modules/whatwg-encoding": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-2.0.0.tgz", + "integrity": "sha512-p41ogyeMUrw3jWclHWTQg1k05DSVXPLcVxRTYsXUk+ZooOCZLcoYgPZ/HL/D/N+uQPOtcp1me1WhBEaX02mhWg==", + "deprecated": "Use @exodus/bytes instead for a more spec-conformant and faster implementation", + "license": "MIT", + "dependencies": { + "iconv-lite": "0.6.3" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/html-escaper": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz", + "integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==", + "dev": true, + "license": "MIT" + }, + "node_modules/htmlparser2": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-10.1.0.tgz", + "integrity": "sha512-VTZkM9GWRAtEpveh7MSF6SjjrpNVNNVJfFup7xTY3UpFtm67foy9HDVXneLtFVt4pMz5kZtgNcvCniNFb1hlEQ==", + "dev": true, + "funding": [ + "https://github.com/fb55/htmlparser2?sponsor=1", + { + "type": "github", + "url": "https://github.com/sponsors/fb55" + } + ], + "license": "MIT", + "dependencies": { + "domelementtype": "^2.3.0", + "domhandler": "^5.0.3", + "domutils": "^3.2.2", + "entities": "^7.0.1" + } + }, + "node_modules/htmlparser2/node_modules/entities": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/entities/-/entities-7.0.1.tgz", + "integrity": "sha512-TWrgLOFUQTH994YUyl1yT4uyavY5nNB5muff+RtWaqNVCAK408b5ZnnbNAUEWLTCpum9w6arT70i1XdQ4UeOPA==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=0.12" + }, + "funding": { + "url": "https://github.com/fb55/entities?sponsor=1" + } + }, + "node_modules/http-cache-semantics": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.2.0.tgz", + "integrity": "sha512-dTxcvPXqPvXBQpq5dUr6mEMJX4oIEFv6bwom3FDwKRDsuIjjJGANqhBuoAn9c1RQJIdAKav33ED65E2ys+87QQ==", + "license": "BSD-2-Clause" + }, + "node_modules/http-errors": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.1.tgz", + "integrity": "sha512-4FbRdAX+bSdmo4AUFuS0WNiPz8NgFt+r8ThgNWmlrjQjt1Q7ZR9+zTlce2859x4KSXrwIsaeTqDoKQmtP8pLmQ==", + "license": "MIT", + "dependencies": { + "depd": "~2.0.0", + "inherits": "~2.0.4", + "setprototypeof": "~1.2.0", + "statuses": "~2.0.2", + "toidentifier": "~1.0.1" + }, + "engines": { + "node": ">= 0.8" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/http-proxy": { + "version": "1.18.1", + "resolved": "https://registry.npmjs.org/http-proxy/-/http-proxy-1.18.1.tgz", + "integrity": "sha512-7mz/721AbnJwIVbnaSv1Cz3Am0ZLT/UBwkC92VlxhXv/k/BBQfM2fXElQNC27BVGr0uwUpplYPQM9LnaBMR5NQ==", + "license": "MIT", + "dependencies": { + "eventemitter3": "^4.0.0", + "follow-redirects": "^1.0.0", + "requires-port": "^1.0.0" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/http-proxy-agent": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-7.0.2.tgz", + "integrity": "sha512-T1gkAiYYDWYx3V5Bmyu7HcfcvL7mUrTWiM6yOfa3PIphViJ/gFPbvidQ+veqSOHci/PxBcDabeUNCzpOODJZig==", + "dev": true, + "license": "MIT", + "dependencies": { + "agent-base": "^7.1.0", + "debug": "^4.3.4" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/http-proxy-agent/node_modules/agent-base": { + "version": "7.1.4", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.4.tgz", + "integrity": "sha512-MnA+YT8fwfJPgBx3m60MNqakm30XOkyIoH1y6huTQvC0PwZG7ki8NacLBcrPbNoo8vEZy7Jpuk7+jMO+CUovTQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 14" + } + }, + "node_modules/http-server": { + "version": "14.1.1", + "resolved": "https://registry.npmjs.org/http-server/-/http-server-14.1.1.tgz", + "integrity": "sha512-+cbxadF40UXd9T01zUHgA+rlo2Bg1Srer4+B4NwIHdaGxAGGv59nYRnGGDJ9LBk7alpS0US+J+bLLdQOOkJq4A==", + "license": "MIT", + "dependencies": { + "basic-auth": "^2.0.1", + "chalk": "^4.1.2", + "corser": "^2.0.1", + "he": "^1.2.0", + "html-encoding-sniffer": "^3.0.0", + "http-proxy": "^1.18.1", + "mime": "^1.6.0", + "minimist": "^1.2.6", + "opener": "^1.5.1", + "portfinder": "^1.0.28", + "secure-compare": "3.0.1", + "union": "~0.5.0", + "url-join": "^4.0.1" + }, + "bin": { + "http-server": "bin/http-server" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/http-server/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/http-status-codes": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/http-status-codes/-/http-status-codes-1.4.0.tgz", + "integrity": "sha512-JrT3ua+WgH8zBD3HEJYbeEgnuQaAnUeRRko/YojPAJjGmIfGD3KPU/asLdsLwKjfxOmQe5nXMQ0pt/7MyapVbQ==", + "license": "MIT" + }, + "node_modules/http2-wrapper": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/http2-wrapper/-/http2-wrapper-1.0.3.tgz", + "integrity": "sha512-V+23sDMr12Wnz7iTcDeJr3O6AIxlnvT/bmaAAAP/Xda35C90p9599p0F1eHR/N1KILWSoWVAiOMFjBBXaXSMxg==", + "license": "MIT", + "dependencies": { + "quick-lru": "^5.1.1", + "resolve-alpn": "^1.0.0" + }, + "engines": { + "node": ">=10.19.0" + } + }, + "node_modules/http2-wrapper/node_modules/quick-lru": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-5.1.1.tgz", + "integrity": "sha512-WuyALRjWPDGtt/wzJiadO5AXY+8hZ80hVpe6MyivgraREW751X3SbhRvG3eLKOYN+8VEvqLcf3wdnt44Z4S4SA==", + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/https-proxy-agent": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.6.tgz", + "integrity": "sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw==", + "license": "MIT", + "dependencies": { + "agent-base": "^7.1.2", + "debug": "4" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/https-proxy-agent/node_modules/agent-base": { + "version": "7.1.4", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.4.tgz", + "integrity": "sha512-MnA+YT8fwfJPgBx3m60MNqakm30XOkyIoH1y6huTQvC0PwZG7ki8NacLBcrPbNoo8vEZy7Jpuk7+jMO+CUovTQ==", + "license": "MIT", + "engines": { + "node": ">= 14" + } + }, + "node_modules/human-signals": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz", + "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==", + "license": "Apache-2.0", + "engines": { + "node": ">=10.17.0" + } + }, + "node_modules/humanize-ms": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/humanize-ms/-/humanize-ms-1.2.1.tgz", + "integrity": "sha512-Fl70vYtsAFb/C06PTS9dZBo7ihau+Tu/DNCk/OyHhea07S+aeMWpFFkUaXRa8fI+ScZbEI8dfSxwY7gxZ9SAVQ==", + "license": "MIT", + "dependencies": { + "ms": "^2.0.0" + } + }, + "node_modules/iconv-corefoundation": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/iconv-corefoundation/-/iconv-corefoundation-1.1.7.tgz", + "integrity": "sha512-T10qvkw0zz4wnm560lOEg0PovVqUXuOFhhHAkixw8/sycy7TJt7v/RrkEKEQnAw2viPSJu6iAkErxnzR0g8PpQ==", + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "dependencies": { + "cli-truncate": "^2.1.0", + "node-addon-api": "^1.6.3" + }, + "engines": { + "node": "^8.11.2 || >=10" + } + }, + "node_modules/iconv-corefoundation/node_modules/node-addon-api": { + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-1.7.2.tgz", + "integrity": "sha512-ibPK3iA+vaY1eEjESkQkM0BbCqFOaZMiXRTtdB0u7b4djtY6JnsjvPdUHVMg6xQt3B8fpTTWHI9A+ADjM9frzg==", + "dev": true, + "license": "MIT", + "optional": true + }, + "node_modules/iconv-lite": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", + "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==", + "license": "MIT", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/icss-utils": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/icss-utils/-/icss-utils-5.1.0.tgz", + "integrity": "sha512-soFhflCVWLfRNOPU3iv5Z9VUdT44xFRbzjLsEzSr5AQmgqPMTHdU3PMT1Cf1ssx8fLNJDA1juftYl+PUcv3MqA==", + "license": "ISC", + "engines": { + "node": "^10 || ^12 || >= 14" + }, + "peerDependencies": { + "postcss": "^8.1.0" + } + }, + "node_modules/idb": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/idb/-/idb-4.0.5.tgz", + "integrity": "sha512-P+Fk9HT2h1DhXoE1YNK183SY+CRh2GHNh28de94sGwhe0bUA75JJeVJWt3SenE5p0BXK7maflIq29dl6UZHrFw==", + "license": "ISC" + }, + "node_modules/ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "BSD-3-Clause" + }, + "node_modules/if-env": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/if-env/-/if-env-1.0.4.tgz", + "integrity": "sha512-4tDLfStvvI8Yh0+tBseP2KufM33QQdLxbm4OlUgVCH6sr3t+kRcPMMzt/zOwB0nzAyW/ZqrXtMdkaUsPIZMLYQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "npm-run-all": "1.4.0" + }, + "bin": { + "if-env": "bin/if-env.js" + } + }, + "node_modules/ignore": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz", + "integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==", + "license": "MIT", + "engines": { + "node": ">= 4" + } + }, + "node_modules/ignore-loader": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/ignore-loader/-/ignore-loader-0.1.2.tgz", + "integrity": "sha512-yOJQEKrNwoYqrWLS4DcnzM7SEQhRKis5mB+LdKKh4cPmGYlLPR0ozRzHV5jmEk2IxptqJNQA5Cc0gw8Fj12bXA==" + }, + "node_modules/ignore-styles": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ignore-styles/-/ignore-styles-5.0.1.tgz", + "integrity": "sha512-gQQmIznCETPLEzfg1UH4Cs2oRq+HBPl8quroEUNXT8oybEG7/0lqI3dGgDSRry6B9HcCXw3PVkFFS0FF3CMddg==", + "dev": true, + "license": "MIT" + }, + "node_modules/ignore-walk": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/ignore-walk/-/ignore-walk-8.0.0.tgz", + "integrity": "sha512-FCeMZT4NiRQGh+YkeKMtWrOmBgWjHjMJ26WQWrRQyoyzqevdaGSakUaJW5xQYmjLlUVk2qUnCjYVBax9EKKg8A==", + "dev": true, + "license": "ISC", + "dependencies": { + "minimatch": "^10.0.3" + }, + "engines": { + "node": "^20.17.0 || >=22.9.0" + } + }, + "node_modules/image-size": { + "version": "0.5.5", + "resolved": "https://registry.npmjs.org/image-size/-/image-size-0.5.5.tgz", + "integrity": "sha512-6TDAlDPZxUFCv+fuOkIoXT/V/f3Qbq8e37p+YOiYrUv3v9cc3/6x78VdfPgFVaB9dZYeLUfKgHRebpkm/oP2VQ==", + "license": "MIT", + "optional": true, + "bin": { + "image-size": "bin/image-size.js" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/import-fresh": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.1.tgz", + "integrity": "sha512-TR3KfrTZTYLPB6jUjfx6MF9WcWrHL9su5TObK4ZkYgBdWKPOFoSoQIdEuTuR82pmtxH2spWG9h6etwfr1pLBqQ==", + "license": "MIT", + "dependencies": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/import-local": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/import-local/-/import-local-3.1.0.tgz", + "integrity": "sha512-ASB07uLtnDs1o6EHjKpX34BKYDSqnFerfTOJL2HvMqF70LnxpjkzDB8J44oT9pu4AMPkQwf8jl6szgvNd2tRIg==", + "license": "MIT", + "dependencies": { + "pkg-dir": "^4.2.0", + "resolve-cwd": "^3.0.0" + }, + "bin": { + "import-local-fixture": "fixtures/cli.js" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", + "license": "MIT", + "engines": { + "node": ">=0.8.19" + } + }, + "node_modules/indent-string": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz", + "integrity": "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/infer-owner": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/infer-owner/-/infer-owner-1.0.4.tgz", + "integrity": "sha512-IClj+Xz94+d7irH5qRyfJonOdfTzuDaifE6ZPWfx0N0+/ATZCbuTPq2prFl526urkQd90WyUKIh1DfBQ2hMz9A==", + "license": "ISC" + }, + "node_modules/inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "deprecated": "This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.", + "license": "ISC", + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "license": "ISC" + }, + "node_modules/ini": { + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", + "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==", + "license": "ISC" + }, + "node_modules/init-package-json": { + "version": "8.2.2", + "resolved": "https://registry.npmjs.org/init-package-json/-/init-package-json-8.2.2.tgz", + "integrity": "sha512-pXVMn67Jdw2hPKLCuJZj62NC9B2OIDd1R3JwZXTHXuEnfN3Uq5kJbKOSld6YEU+KOGfMD82EzxFTYz5o0SSJoA==", + "dev": true, + "license": "ISC", + "dependencies": { + "@npmcli/package-json": "^7.0.0", + "npm-package-arg": "^13.0.0", + "promzard": "^2.0.0", + "read": "^4.0.0", + "semver": "^7.7.2", + "validate-npm-package-license": "^3.0.4", + "validate-npm-package-name": "^6.0.2" + }, + "engines": { + "node": "^20.17.0 || >=22.9.0" + } + }, + "node_modules/init-package-json/node_modules/read": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/read/-/read-4.1.0.tgz", + "integrity": "sha512-uRfX6K+f+R8OOrYScaM3ixPY4erg69f8DN6pgTvMcA9iRc8iDhwrA4m3Yu8YYKsXJgVvum+m8PkRboZwwuLzYA==", + "dev": true, + "license": "ISC", + "dependencies": { + "mute-stream": "^2.0.0" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/inquirer": { + "version": "12.9.6", + "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-12.9.6.tgz", + "integrity": "sha512-603xXOgyfxhuis4nfnWaZrMaotNT0Km9XwwBNWUKbIDqeCY89jGr2F9YPEMiNhU6XjIP4VoWISMBFfcc5NgrTw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@inquirer/ansi": "^1.0.0", + "@inquirer/core": "^10.2.2", + "@inquirer/prompts": "^7.8.6", + "@inquirer/type": "^3.0.8", + "mute-stream": "^2.0.0", + "run-async": "^4.0.5", + "rxjs": "^7.8.2" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "@types/node": ">=18" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + } + } + }, + "node_modules/internal-slot": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.1.0.tgz", + "integrity": "sha512-4gd7VpWNQNB4UKKCFFVcp1AVv+FMOgs9NKzjHKusc8jTMhd5eL1NqQqOpE0KzMds804/yHlglp3uxgluOqAPLw==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "hasown": "^2.0.2", + "side-channel": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/interpret": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/interpret/-/interpret-2.2.0.tgz", + "integrity": "sha512-Ju0Bz/cEia55xDwUWEa8+olFpCiQoypjnQySseKtmjNrnps3P+xfpUmGr90T7yjlVJmOtybRvPXhKMbHr+fWnw==", + "license": "MIT", + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/inversify": { + "version": "6.2.2", + "resolved": "https://registry.npmjs.org/inversify/-/inversify-6.2.2.tgz", + "integrity": "sha512-KB836KHbZ9WrUnB8ax5MtadOwnqQYa+ZJO3KWbPFgcr4RIEnHM621VaqFZzOZd9+U7ln6upt9n0wJei7x2BNqw==", + "license": "MIT", + "dependencies": { + "@inversifyjs/common": "1.4.0", + "@inversifyjs/core": "1.3.5" + }, + "peerDependencies": { + "reflect-metadata": "~0.2.2" + } + }, + "node_modules/ip-address": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/ip-address/-/ip-address-10.1.0.tgz", + "integrity": "sha512-XXADHxXmvT9+CRxhXg56LJovE+bmWnEWB78LB83VZTprKTmaC5QfruXocxzTZ2Kl0DNwKuBdlIhjL8LeY8Sf8Q==", + "license": "MIT", + "engines": { + "node": ">= 12" + } + }, + "node_modules/ipaddr.js": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", + "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==", + "license": "MIT", + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/is-array-buffer": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/is-array-buffer/-/is-array-buffer-3.0.5.tgz", + "integrity": "sha512-DDfANUiiG2wC1qawP66qlTugJeL5HyzMpfr8lLK+jMQirGzNod0B12cFB/9q838Ru27sBwfw78/rdoU7RERz6A==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.3", + "get-intrinsic": "^1.2.6" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==", + "license": "MIT" + }, + "node_modules/is-async-function": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-async-function/-/is-async-function-2.1.1.tgz", + "integrity": "sha512-9dgM/cZBnNvjzaMYHVoxxfPj2QXt22Ev7SuuPrs+xav0ukGB0S6d4ydZdEiM48kLx5kDV+QBPrpVnFyefL8kkQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "async-function": "^1.0.0", + "call-bound": "^1.0.3", + "get-proto": "^1.0.1", + "has-tostringtag": "^1.0.2", + "safe-regex-test": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-bigint": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-bigint/-/is-bigint-1.1.0.tgz", + "integrity": "sha512-n4ZT37wG78iz03xPRKJrHTdZbe3IicyucEtdRsV5yglwc3GyUfbAfpSeD0FJ41NbUNSt5wbhqfp1fS+BgnvDFQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-bigints": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "license": "MIT", + "dependencies": { + "binary-extensions": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-boolean-object": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.2.2.tgz", + "integrity": "sha512-wa56o2/ElJMYqjCjGkXri7it5FbebW5usLw/nPmCMs5DeZ7eziSYZhSmPRn0txqeW4LnAmQQU7FgqLpsEFKM4A==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.3", + "has-tostringtag": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-buffer": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", + "dev": true, + "license": "MIT" + }, + "node_modules/is-callable": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz", + "integrity": "sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-ci": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/is-ci/-/is-ci-3.0.1.tgz", + "integrity": "sha512-ZYvCgrefwqoQ6yTyYUbQu64HsITZ3NfKX1lzaEYdkTDcfKzzCI/wthRRYKkdjHKFVgNiXKAKm65Zo1pk2as/QQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ci-info": "^3.2.0" + }, + "bin": { + "is-ci": "bin.js" + } + }, + "node_modules/is-core-module": { + "version": "2.16.1", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.16.1.tgz", + "integrity": "sha512-UfoeMA6fIJ8wTYFEUjelnaGI67v6+N7qXJEvQuIGa99l4xsCruSYOVSQ0uPANn4dAzm8lkYPaKLrrijLq7x23w==", + "license": "MIT", + "dependencies": { + "hasown": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-data-view": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-data-view/-/is-data-view-1.0.2.tgz", + "integrity": "sha512-RKtWF8pGmS87i2D6gqQu/l7EYRlVdfzemCJN/P3UOs//x1QE7mfhvzHIApBTRf7axvT6DMGwSwBXYCT0nfB9xw==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "get-intrinsic": "^1.2.6", + "is-typed-array": "^1.1.13" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-date-object": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.1.0.tgz", + "integrity": "sha512-PwwhEakHVKTdRNVOw+/Gyh0+MzlCl4R6qKvkhuvLtPMggI1WAHt9sOwZxQLSGpUaDnrdyDsomoRgNnCfKNSXXg==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "has-tostringtag": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-deflate": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-deflate/-/is-deflate-1.0.0.tgz", + "integrity": "sha512-YDoFpuZWu1VRXlsnlYMzKyVRITXj7Ej/V9gXQ2/pAe7X1J7M/RNOqaIYi6qUn+B7nGyB9pDXrv02dsB58d2ZAQ==", + "license": "MIT" + }, + "node_modules/is-docker": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-3.0.0.tgz", + "integrity": "sha512-eljcgEDlEns/7AXFosB5K/2nCM4P7FQPkGc/DWLy5rmFEWvZayGrik1d9/QIY5nJ4f9YsVvBkA6kJpHn9rISdQ==", + "dev": true, + "license": "MIT", + "bin": { + "is-docker": "cli.js" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-electron": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/is-electron/-/is-electron-2.2.2.tgz", + "integrity": "sha512-FO/Rhvz5tuw4MCWkpMzHFKWD2LsfHzIb7i6MdPYZ/KW7AlxawyLkqdy+jPZP1WubqEADE3O4FUENlJHDfQASRg==", + "license": "MIT" + }, + "node_modules/is-electron-renderer": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-electron-renderer/-/is-electron-renderer-2.0.1.tgz", + "integrity": "sha512-pRlQnpaCFhDVPtkXkP+g9Ybv/CjbiQDjnKFQTEjpBfDKeV6dRDBczuFRDpM6DVfk2EjpMS8t5kwE5jPnqYl3zA==", + "dev": true, + "license": "MIT" + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-finalizationregistry": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/is-finalizationregistry/-/is-finalizationregistry-1.1.1.tgz", + "integrity": "sha512-1pC6N8qWJbWoPtEjgcL2xyhQOP491EQjeUo3qTKcmV8YSDDJrOepfG8pcC7h/QgnQHYSv0mJ3Z/ZWxmatVrysg==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/is-generator-function": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/is-generator-function/-/is-generator-function-1.1.2.tgz", + "integrity": "sha512-upqt1SkGkODW9tsGNG5mtXTXtECizwtS2kA161M+gJPc1xdb/Ax629af6YrTwcOeQHbewrPNlE5Dx7kzvXTizA==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.4", + "generator-function": "^2.0.0", + "get-proto": "^1.0.1", + "has-tostringtag": "^1.0.2", + "safe-regex-test": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "license": "MIT", + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-gzip": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-gzip/-/is-gzip-1.0.0.tgz", + "integrity": "sha512-rcfALRIb1YewtnksfRIHGcIY93QnK8BIQ/2c9yDYcG/Y6+vRoJuTWBmmSEbyLLYtXm7q35pHOHbZFQBaLrhlWQ==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-inside-container": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-inside-container/-/is-inside-container-1.0.0.tgz", + "integrity": "sha512-KIYLCCJghfHZxqjYBE7rEy0OBuTd5xCHS7tHVgvCLkx7StIoaxwNW3hCALgEUjFfeRk+MG/Qxmp/vtETEF3tRA==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-docker": "^3.0.0" + }, + "bin": { + "is-inside-container": "cli.js" + }, + "engines": { + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-interactive": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-interactive/-/is-interactive-1.0.0.tgz", + "integrity": "sha512-2HvIEKRoqS62guEC+qBjpvRubdX910WCMuJTZ+I9yvqKU2/12eSL549HMwtabb4oupdj2sMP50k+XJfB/8JE6w==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/is-lambda": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-lambda/-/is-lambda-1.0.1.tgz", + "integrity": "sha512-z7CMFGNrENq5iFB9Bqo64Xk6Y9sg+epq1myIcdHaGnbMTYOxvzsEtdYqQUylB7LxfkvgrrjP32T6Ywciio9UIQ==", + "license": "MIT" + }, + "node_modules/is-map": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/is-map/-/is-map-2.0.3.tgz", + "integrity": "sha512-1Qed0/Hr2m+YqxnM09CjA2d/i6YZNfF6R2oRAOj36eUdS6qIV/huPJNSEpKbupewFs+ZsJlxsjjPbc0/afW6Lw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-natural-number": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/is-natural-number/-/is-natural-number-4.0.1.tgz", + "integrity": "sha512-Y4LTamMe0DDQIIAlaer9eKebAlDSV6huy+TWhJVPlzZh2o4tRP5SQWFlLn5N0To4mDD22/qdOq+veo1cSISLgQ==", + "license": "MIT" + }, + "node_modules/is-negative-zero": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.3.tgz", + "integrity": "sha512-5KoIu2Ngpyek75jXodFvnafB6DJgr3u8uuK0LEZJjrU19DrMD3EVERaR8sjz8CCGgpZvxPl9SuE1GMVPFHx1mw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "license": "MIT", + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/is-number-object": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.1.1.tgz", + "integrity": "sha512-lZhclumE1G6VYD8VHe35wFaIif+CTy5SJIi5+3y4psDgWu4wPDoBhF8NxUOinEc7pHgiTsT6MaBb92rKhhD+Xw==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.3", + "has-tostringtag": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-obj": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-2.0.0.tgz", + "integrity": "sha512-drqDG3cbczxxEJRoOXcOjtdp1J/lyp1mNn0xaznRs8+muBhgQcrnbspox5X5fOw0HnMnbfDzvnEMEtqDEJEo8w==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/is-path-inside": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", + "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/is-plain-obj": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-1.1.0.tgz", + "integrity": "sha512-yvkRyxmFKEOQ4pNXCmJG5AEQNlXJS5LaONXo5/cLdTZdWvsZ1ioJEonLGAosKlMWE8lwUy/bJzMjcw8az73+Fg==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-plain-object": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", + "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", + "license": "MIT", + "dependencies": { + "isobject": "^3.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-potential-custom-element-name": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.1.tgz", + "integrity": "sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/is-promise": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-4.0.0.tgz", + "integrity": "sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ==", + "license": "MIT" + }, + "node_modules/is-regex": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.2.1.tgz", + "integrity": "sha512-MjYsKHO5O7mCsmRGxWcLWheFqN9DJ/2TmngvjKXihe6efViPqc274+Fx/4fYj/r03+ESvBdTXK0V6tA3rgez1g==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "gopd": "^1.2.0", + "has-tostringtag": "^1.0.2", + "hasown": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-set": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/is-set/-/is-set-2.0.3.tgz", + "integrity": "sha512-iPAjerrse27/ygGLxw+EBR9agv9Y6uLeYVJMu+QNCoouJ1/1ri0mGrcWpfCqFZuzzx3WjtwxG098X+n4OuRkPg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-shared-array-buffer": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.4.tgz", + "integrity": "sha512-ISWac8drv4ZGfwKl5slpHG9OwPNty4jOWPRIhBpxOoD+hqITiwuipOQ2bNthAzwA3B4fIjO4Nln74N0S9byq8A==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-ssh": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/is-ssh/-/is-ssh-1.4.1.tgz", + "integrity": "sha512-JNeu1wQsHjyHgn9NcWTaXq6zWSR6hqE0++zhfZlkFBbScNkyvxCdeV8sRkSBaeLKxmbpR21brail63ACNxJ0Tg==", + "dev": true, + "license": "MIT", + "dependencies": { + "protocols": "^2.0.1" + } + }, + "node_modules/is-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.0.tgz", + "integrity": "sha512-XCoy+WlUr7d1+Z8GgSuXmpuUFC9fOhRXglJMx+dwLKTkL44Cjd4W1Z5P+BQZpr+cR93aGP4S/s7Ftw6Nd/kiEw==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/is-string": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.1.1.tgz", + "integrity": "sha512-BtEeSsoaQjlSPBemMQIrY1MY0uM6vnS1g5fmufYOtnxLGUZM2178PKbhsk7Ffv58IX+ZtcvoGwccYsh0PglkAA==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.3", + "has-tostringtag": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-symbol": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.1.1.tgz", + "integrity": "sha512-9gGx6GTtCQM73BgmHQXfDmLtfjjTUDSyoxTCbp5WtoixAhfgsDirWIcVQ/IHpvI5Vgd5i/J5F7B9cN/WlVbC/w==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "has-symbols": "^1.1.0", + "safe-regex-test": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-text-path": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-text-path/-/is-text-path-1.0.1.tgz", + "integrity": "sha512-xFuJpne9oFz5qDaodwmmG08e3CawH/2ZV8Qqza1Ko7Sk8POWbkRdwIoAWVhqvq0XeUzANEhKo2n0IXUGBm7A/w==", + "dev": true, + "license": "MIT", + "dependencies": { + "text-extensions": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-typed-array": { + "version": "1.1.15", + "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.15.tgz", + "integrity": "sha512-p3EcsicXjit7SaskXHs1hA91QxgTw46Fv6EFKKGS5DRFLD8yKnohjF3hxoju94b/OcMZoQukzpPpBE9uLVKzgQ==", + "license": "MIT", + "dependencies": { + "which-typed-array": "^1.1.16" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-typedarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", + "integrity": "sha512-cyA56iCMHAh5CdzjJIa4aohJyeO1YbwLi3Jc35MmRU6poroFjIGZzUzupGiRPOjgHg9TLu43xbpwXk523fMxKA==", + "dev": true, + "license": "MIT" + }, + "node_modules/is-unicode-supported": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz", + "integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==", + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-weakmap": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/is-weakmap/-/is-weakmap-2.0.2.tgz", + "integrity": "sha512-K5pXYOm9wqY1RgjpL3YTkF39tni1XajUIkawTLUo9EZEVUFga5gSQJF8nNS7ZwJQ02y+1YCNYcMh+HIf1ZqE+w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-weakref": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/is-weakref/-/is-weakref-1.1.1.tgz", + "integrity": "sha512-6i9mGWSlqzNMEqpCp93KwRS1uUOodk2OJ6b+sq7ZPDSy2WuI5NFIxp/254TytR8ftefexkWn5xNiHUNpPOfSew==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-weakset": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/is-weakset/-/is-weakset-2.0.4.tgz", + "integrity": "sha512-mfcwb6IzQyOKTs84CQMrOwW4gQcaTOAWJ0zzJCl2WSPDrWk/OzDaImWFH3djXhb24g4eudZfLRozAvPGw4d9hQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.3", + "get-intrinsic": "^1.2.6" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-what": { + "version": "3.14.1", + "resolved": "https://registry.npmjs.org/is-what/-/is-what-3.14.1.tgz", + "integrity": "sha512-sNxgpk9793nzSs7bA6JQJGeIuRBQhAaNGG77kzYQgMkrID+lS6SlK07K5LaptscDlSaIgH+GPFzf+d75FVxozA==", + "license": "MIT" + }, + "node_modules/is-windows": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz", + "integrity": "sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-wsl": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-3.1.0.tgz", + "integrity": "sha512-UcVfVfaK4Sc4m7X3dUSoHoozQGBEFeDC+zVo06t98xe8CzHSZZBekNXH+tu0NalHolcJ/QAGqS46Hef7QXBIMw==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-inside-container": "^1.0.0" + }, + "engines": { + "node": ">=16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/isarray": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", + "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==", + "license": "MIT" + }, + "node_modules/isbinaryfile": { + "version": "5.0.7", + "resolved": "https://registry.npmjs.org/isbinaryfile/-/isbinaryfile-5.0.7.tgz", + "integrity": "sha512-gnWD14Jh3FzS3CPhF0AxNOJ8CxqeblPTADzI38r0wt8ZyQl5edpy75myt08EG2oKvpyiqSqsx+Wkz9vtkbTqYQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 18.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/gjtorikian/" + } + }, + "node_modules/isexe": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-3.1.5.tgz", + "integrity": "sha512-6B3tLtFqtQS4ekarvLVMZ+X+VlvQekbe4taUkf/rhVO3d/h0M2rfARm/pXLcPEsjjMsFgrFgSrhQIxcSVrBz8w==", + "dev": true, + "license": "BlueOak-1.0.0", + "engines": { + "node": ">=18" + } + }, + "node_modules/isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha512-WhB9zCku7EGTj/HQQRz5aUQEUeoQZH2bWcltRErOpymJ4boYE6wL9Tbr23krRPSZ+C5zqNSrSw+Cc7sZZ4b7vg==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/isomorphic.js": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/isomorphic.js/-/isomorphic.js-0.2.5.tgz", + "integrity": "sha512-PIeMbHqMt4DnUP3MA/Flc0HElYjMXArsw1qwJZcm9sqR8mq3l8NYizFMty0pWwE/tzIGH3EKK5+jes5mAr85yw==", + "license": "MIT", + "funding": { + "type": "GitHub Sponsors ❤", + "url": "https://github.com/sponsors/dmonad" + } + }, + "node_modules/istanbul-lib-coverage": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.2.tgz", + "integrity": "sha512-O8dpsF+r0WV/8MNRKfnmrtCWhuKjxrq2w+jpzBL5UZKTi2LeVWnWOmWRxFlesJONmc+wLAGvKQZEOanko0LFTg==", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=8" + } + }, + "node_modules/istanbul-lib-hook": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/istanbul-lib-hook/-/istanbul-lib-hook-3.0.0.tgz", + "integrity": "sha512-Pt/uge1Q9s+5VAZ+pCo16TYMWPBIl+oaNIjgLQxcX0itS6ueeaA+pEfThZpH8WxhFgCiEb8sAJY6MdUKgiIWaQ==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "append-transform": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/istanbul-lib-instrument": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-6.0.3.tgz", + "integrity": "sha512-Vtgk7L/R2JHyyGW07spoFlB8/lpjiOLTjMdms6AFMraYt3BaJauod/NGrfnVG/y4Ix1JEuMRPDPEj2ua+zz1/Q==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "@babel/core": "^7.23.9", + "@babel/parser": "^7.23.9", + "@istanbuljs/schema": "^0.1.3", + "istanbul-lib-coverage": "^3.2.0", + "semver": "^7.5.4" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/istanbul-lib-processinfo": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/istanbul-lib-processinfo/-/istanbul-lib-processinfo-2.0.3.tgz", + "integrity": "sha512-NkwHbo3E00oybX6NGJi6ar0B29vxyvNwoC7eJ4G4Yq28UfY758Hgn/heV8VRFhevPED4LXfFz0DQ8z/0kw9zMg==", + "dev": true, + "license": "ISC", + "dependencies": { + "archy": "^1.0.0", + "cross-spawn": "^7.0.3", + "istanbul-lib-coverage": "^3.2.0", + "p-map": "^3.0.0", + "rimraf": "^3.0.0", + "uuid": "^8.3.2" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/istanbul-lib-processinfo/node_modules/p-map": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/p-map/-/p-map-3.0.0.tgz", + "integrity": "sha512-d3qXVTF/s+W+CdJ5A29wywV2n8CQQYahlgz2bFiA+4eVNJbHJodPZ+/gXwPGh0bOqA+j8S+6+ckmvLGPk1QpxQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "aggregate-error": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/istanbul-lib-processinfo/node_modules/rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "deprecated": "Rimraf versions prior to v4 are no longer supported", + "dev": true, + "license": "ISC", + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/istanbul-lib-report": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-3.0.1.tgz", + "integrity": "sha512-GCfE1mtsHGOELCU8e/Z7YWzpmybrx/+dSTfLrvY8qRmaY6zXTKWn6WQIjaAFw069icm6GVMNkgu0NzI4iPZUNw==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "istanbul-lib-coverage": "^3.0.0", + "make-dir": "^4.0.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/istanbul-lib-source-maps": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-4.0.1.tgz", + "integrity": "sha512-n3s8EwkdFIJCG3BPKBYvskgXGoy88ARzvegkitk60NxRdwltLOTaH7CUiMRXvwYorl0Q712iEjcWB+fK/MrWVw==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "debug": "^4.1.1", + "istanbul-lib-coverage": "^3.0.0", + "source-map": "^0.6.1" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/istanbul-reports": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.2.0.tgz", + "integrity": "sha512-HGYWWS/ehqTV3xN10i23tkPkpH46MLCIMFNCaaKNavAXTF1RkqxawEPtnjnGZ6XKSInBKkiOA5BKS+aZiY3AvA==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "html-escaper": "^2.0.0", + "istanbul-lib-report": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/iterator.prototype": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/iterator.prototype/-/iterator.prototype-1.1.5.tgz", + "integrity": "sha512-H0dkQoCa3b2VEeKQBOxFph+JAbcrQdE7KC0UkqwpLmv2EC4P41QXP+rqo9wYodACiG5/WM5s9oDApTU8utwj9g==", + "dev": true, + "license": "MIT", + "dependencies": { + "define-data-property": "^1.1.4", + "es-object-atoms": "^1.0.0", + "get-intrinsic": "^1.2.6", + "get-proto": "^1.0.0", + "has-symbols": "^1.1.0", + "set-function-name": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/jackspeak": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-4.2.3.tgz", + "integrity": "sha512-ykkVRwrYvFm1nb2AJfKKYPr0emF6IiXDYUaFx4Zn9ZuIH7MrzEZ3sD5RlqGXNRpHtvUHJyOnCEFxOlNDtGo7wg==", + "dev": true, + "license": "BlueOak-1.0.0", + "dependencies": { + "@isaacs/cliui": "^9.0.0" + }, + "engines": { + "node": "20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/jake": { + "version": "10.9.4", + "resolved": "https://registry.npmjs.org/jake/-/jake-10.9.4.tgz", + "integrity": "sha512-wpHYzhxiVQL+IV05BLE2Xn34zW1S223hvjtqk0+gsPrwd/8JNLXJgZZM/iPFsYc1xyphF+6M6EvdE5E9MBGkDA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "async": "^3.2.6", + "filelist": "^1.0.4", + "picocolors": "^1.1.1" + }, + "bin": { + "jake": "bin/cli.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/jest-diff": { + "version": "30.2.0", + "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-30.2.0.tgz", + "integrity": "sha512-dQHFo3Pt4/NLlG5z4PxZ/3yZTZ1C7s9hveiOj+GCN+uT109NC2QgsoVZsVOAvbJ3RgKkvyLGXZV9+piDpWbm6A==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/diff-sequences": "30.0.1", + "@jest/get-type": "30.1.0", + "chalk": "^4.1.2", + "pretty-format": "30.2.0" + }, + "engines": { + "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" + } + }, + "node_modules/jest-diff/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/jest-worker": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-27.5.1.tgz", + "integrity": "sha512-7vuh85V5cdDofPyxn58nrPjBktZo0u9x1g8WtjQol+jZDaE+fhN+cIvTj11GndBnMnyfrUOG1sZQxCdjKh+DKg==", + "license": "MIT", + "dependencies": { + "@types/node": "*", + "merge-stream": "^2.0.0", + "supports-color": "^8.0.0" + }, + "engines": { + "node": ">= 10.13.0" + } + }, + "node_modules/jest-worker/node_modules/supports-color": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", + "license": "MIT", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/supports-color?sponsor=1" + } + }, + "node_modules/jose": { + "version": "6.1.3", + "resolved": "https://registry.npmjs.org/jose/-/jose-6.1.3.tgz", + "integrity": "sha512-0TpaTfihd4QMNwrz/ob2Bp7X04yuxJkjRGi4aKmOqwhov54i6u79oCv7T+C7lo70MKH6BesI3vscD1yb/yzKXQ==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/panva" + } + }, + "node_modules/js-levenshtein": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/js-levenshtein/-/js-levenshtein-1.1.6.tgz", + "integrity": "sha512-X2BB11YZtrRqY4EnQcLX5Rh373zbK4alC1FW7D7MBhL2gtcC17cTnr6DmfHZeS0s2rTHjUTMMHfG7gO8SSdw+g==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "license": "MIT" + }, + "node_modules/js-yaml": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.1.tgz", + "integrity": "sha512-qQKT4zQxXl8lLwBtHMWwaTcGfFOZviOJet3Oy/xmGk2gZH677CJM9EvtfdSkgWcATZhj/55JZ0rmy3myCT5lsA==", + "license": "MIT", + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/jschardet": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/jschardet/-/jschardet-2.3.0.tgz", + "integrity": "sha512-6I6xT7XN/7sBB7q8ObzKbmv5vN+blzLcboDE1BNEsEfmRXJValMxO6OIRT69ylPBRemS3rw6US+CMCar0OBc9g==", + "license": "LGPL-2.1+", + "engines": { + "node": ">=0.1.90" + } + }, + "node_modules/jsdom": { + "version": "22.1.0", + "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-22.1.0.tgz", + "integrity": "sha512-/9AVW7xNbsBv6GfWho4TTNjEo9fe6Zhf9O7s0Fhhr3u+awPwAJMKwAMXnkk5vBxflqLW9hTHX/0cs+P3gW+cQw==", + "dev": true, + "license": "MIT", + "dependencies": { + "abab": "^2.0.6", + "cssstyle": "^3.0.0", + "data-urls": "^4.0.0", + "decimal.js": "^10.4.3", + "domexception": "^4.0.0", + "form-data": "^4.0.0", + "html-encoding-sniffer": "^3.0.0", + "http-proxy-agent": "^5.0.0", + "https-proxy-agent": "^5.0.1", + "is-potential-custom-element-name": "^1.0.1", + "nwsapi": "^2.2.4", + "parse5": "^7.1.2", + "rrweb-cssom": "^0.6.0", + "saxes": "^6.0.0", + "symbol-tree": "^3.2.4", + "tough-cookie": "^4.1.2", + "w3c-xmlserializer": "^4.0.0", + "webidl-conversions": "^7.0.0", + "whatwg-encoding": "^2.0.0", + "whatwg-mimetype": "^3.0.0", + "whatwg-url": "^12.0.1", + "ws": "^8.13.0", + "xml-name-validator": "^4.0.0" + }, + "engines": { + "node": ">=16" + }, + "peerDependencies": { + "canvas": "^2.5.0" + }, + "peerDependenciesMeta": { + "canvas": { + "optional": true + } + } + }, + "node_modules/jsdom/node_modules/http-proxy-agent": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-5.0.0.tgz", + "integrity": "sha512-n2hY8YdoRE1i7r6M0w9DIw5GgZN0G25P8zLCRQ8rjXtTU3vsNFBI/vWK/UIeE6g5MUUz6avwAPXmL6Fy9D/90w==", + "dev": true, + "license": "MIT", + "dependencies": { + "@tootallnate/once": "2", + "agent-base": "6", + "debug": "4" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/jsdom/node_modules/https-proxy-agent": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz", + "integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==", + "dev": true, + "license": "MIT", + "dependencies": { + "agent-base": "6", + "debug": "4" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/jsdom/node_modules/whatwg-encoding": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-2.0.0.tgz", + "integrity": "sha512-p41ogyeMUrw3jWclHWTQg1k05DSVXPLcVxRTYsXUk+ZooOCZLcoYgPZ/HL/D/N+uQPOtcp1me1WhBEaX02mhWg==", + "deprecated": "Use @exodus/bytes instead for a more spec-conformant and faster implementation", + "dev": true, + "license": "MIT", + "dependencies": { + "iconv-lite": "0.6.3" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/jsdom/node_modules/whatwg-mimetype": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-3.0.0.tgz", + "integrity": "sha512-nt+N2dzIutVRxARx1nghPKGv1xHikU7HKdfafKkLNLindmPU/ch3U31NOCGGA/dmPcmb1VlofO0vnKAcsm0o/Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + } + }, + "node_modules/jsesc": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-3.1.0.tgz", + "integrity": "sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA==", + "license": "MIT", + "bin": { + "jsesc": "bin/jsesc" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/json-bigint": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-bigint/-/json-bigint-1.0.0.tgz", + "integrity": "sha512-SiPv/8VpZuWbvLSMtTDU8hEfrZWg/mH/nV/b4o0CYbSxu1UIQPLdwKOCIyLQX+VIPO5vrLX3i8qtqFyhdPSUSQ==", + "license": "MIT", + "dependencies": { + "bignumber.js": "^9.0.0" + } + }, + "node_modules/json-buffer": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", + "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==", + "license": "MIT" + }, + "node_modules/json-parse-better-errors": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz", + "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==", + "dev": true, + "license": "MIT" + }, + "node_modules/json-parse-even-better-errors": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-5.0.0.tgz", + "integrity": "sha512-ZF1nxZ28VhQouRWhUcVlUIN3qwSgPuswK05s/HIaoetAoE/9tngVmCHjSxmSQPav1nd+lPtTL0YZ/2AFdR/iYQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^20.17.0 || >=22.9.0" + } + }, + "node_modules/json-schema-to-ts": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/json-schema-to-ts/-/json-schema-to-ts-3.1.1.tgz", + "integrity": "sha512-+DWg8jCJG2TEnpy7kOm/7/AxaYoaRbjVB4LFZLySZlWn8exGs3A4OLJR966cVvU26N7X9TWxl+Jsw7dzAqKT6g==", + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.18.3", + "ts-algebra": "^2.0.0" + }, + "engines": { + "node": ">=16" + } + }, + "node_modules/json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "license": "MIT" + }, + "node_modules/json-schema-typed": { + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/json-schema-typed/-/json-schema-typed-8.0.2.tgz", + "integrity": "sha512-fQhoXdcvc3V28x7C7BMs4P5+kNlgUURe2jmUT1T//oBRMDrqy1QPelJimwZGo7Hg9VPV3EQV5Bnq4hbFy2vetA==", + "license": "BSD-2-Clause" + }, + "node_modules/json-stable-stringify": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-1.3.0.tgz", + "integrity": "sha512-qtYiSSFlwot9XHtF9bD9c7rwKjr+RecWT//ZnPvSmEjpV5mmPOCN4j8UjY5hbjNkOwZ/jQv3J6R1/pL7RwgMsg==", + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.4", + "isarray": "^2.0.5", + "jsonify": "^0.0.1", + "object-keys": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", + "dev": true, + "license": "MIT" + }, + "node_modules/json-stringify-nice": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/json-stringify-nice/-/json-stringify-nice-1.1.4.tgz", + "integrity": "sha512-5Z5RFW63yxReJ7vANgW6eZFGWaQvnPE3WNmZoOJrSkGju2etKA2L5rrOa1sm877TVTFt57A80BH1bArcmlLfPw==", + "dev": true, + "license": "ISC", + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/json-stringify-safe": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", + "integrity": "sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==", + "devOptional": true, + "license": "ISC" + }, + "node_modules/json5": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", + "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", + "license": "MIT", + "bin": { + "json5": "lib/cli.js" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/jsonc-parser": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.3.1.tgz", + "integrity": "sha512-HUgH65KyejrUFPvHFPbqOY0rsFip3Bo5wb4ngvdi1EpCYWUQDC5V+Y7mZws+DLkr4M//zQJoanu1SP+87Dv1oQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/jsonfile": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", + "integrity": "sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==", + "license": "MIT", + "optionalDependencies": { + "graceful-fs": "^4.1.6" + } + }, + "node_modules/jsonify": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.1.tgz", + "integrity": "sha512-2/Ki0GcmuqSrgFyelQq9M05y7PS0mEwuIzrf3f1fPqkVDVRvZrPZtVSMHxdgo8Aq0sxAOb/cr2aqqA3LeWHVPg==", + "license": "Public Domain", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/jsonparse": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/jsonparse/-/jsonparse-1.3.1.tgz", + "integrity": "sha512-POQXvpdL69+CluYsillJ7SUhKvytYjW9vG/GKpnf+xP8UWgYEM/RaMzHHofbALDiKbbP1W8UEYmgGl39WkPZsg==", + "dev": true, + "engines": [ + "node >= 0.2.0" + ], + "license": "MIT" + }, + "node_modules/JSONStream": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/JSONStream/-/JSONStream-1.3.5.tgz", + "integrity": "sha512-E+iruNOY8VV9s4JEbe1aNEm6MiszPRr/UfcHMz0TQh1BXSxHK+ASV1R6W4HpjBhSeS+54PIsAMCBmwD06LLsqQ==", + "dev": true, + "license": "(MIT OR Apache-2.0)", + "dependencies": { + "jsonparse": "^1.2.0", + "through": ">=2.2.7 <3" + }, + "bin": { + "JSONStream": "bin.js" + }, + "engines": { + "node": "*" + } + }, + "node_modules/jsonwebtoken": { + "version": "9.0.3", + "resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-9.0.3.tgz", + "integrity": "sha512-MT/xP0CrubFRNLNKvxJ2BYfy53Zkm++5bX9dtuPbqAeQpTVe0MQTFhao8+Cp//EmJp244xt6Drw/GVEGCUj40g==", + "dev": true, + "license": "MIT", + "dependencies": { + "jws": "^4.0.1", + "lodash.includes": "^4.3.0", + "lodash.isboolean": "^3.0.3", + "lodash.isinteger": "^4.0.4", + "lodash.isnumber": "^3.0.3", + "lodash.isplainobject": "^4.0.6", + "lodash.isstring": "^4.0.1", + "lodash.once": "^4.0.0", + "ms": "^2.1.1", + "semver": "^7.5.4" + }, + "engines": { + "node": ">=12", + "npm": ">=6" + } + }, + "node_modules/jsx-ast-utils": { + "version": "3.3.5", + "resolved": "https://registry.npmjs.org/jsx-ast-utils/-/jsx-ast-utils-3.3.5.tgz", + "integrity": "sha512-ZZow9HBI5O6EPgSJLUb8n2NKgmVWTwCvHGwFuJlMjvLFqlGG6pjirPhtdsseaLZjSibD8eegzmYpUZwoIlj2cQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "array-includes": "^3.1.6", + "array.prototype.flat": "^1.3.1", + "object.assign": "^4.1.4", + "object.values": "^1.1.6" + }, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/just-diff": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/just-diff/-/just-diff-6.0.2.tgz", + "integrity": "sha512-S59eriX5u3/QhMNq3v/gm8Kd0w8OS6Tz2FS1NG4blv+z0MuQcBRJyFWjdovM0Rad4/P4aUPFtnkNjMjyMlMSYA==", + "dev": true, + "license": "MIT" + }, + "node_modules/just-diff-apply": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/just-diff-apply/-/just-diff-apply-5.5.0.tgz", + "integrity": "sha512-OYTthRfSh55WOItVqwpefPtNt2VdKsq5AnAK6apdtR6yCH8pr0CmSr710J0Mf+WdQy7K/OzMy7K2MgAfdQURDw==", + "dev": true, + "license": "MIT" + }, + "node_modules/just-extend": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/just-extend/-/just-extend-6.2.0.tgz", + "integrity": "sha512-cYofQu2Xpom82S6qD778jBDpwvvy39s1l/hrYij2u9AMdQcGRpaBu6kY4mVhuno5kJVi1DAz4aiphA2WI1/OAw==", + "dev": true, + "license": "MIT" + }, + "node_modules/just-performance": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/just-performance/-/just-performance-4.3.0.tgz", + "integrity": "sha512-L7RjvtJsL0QO8xFs5wEoDDzzJwoiowRw6Rn/GnvldlchS2JQr9wFYPiwZcDfrbbujEKqKN0tvENdbjXdYhDp5Q==", + "license": "MIT" + }, + "node_modules/jwa": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/jwa/-/jwa-2.0.1.tgz", + "integrity": "sha512-hRF04fqJIP8Abbkq5NKGN0Bbr3JxlQ+qhZufXVr0DvujKy93ZCbXZMHDL4EOtodSbCWxOqR8MS1tXA5hwqCXDg==", + "license": "MIT", + "dependencies": { + "buffer-equal-constant-time": "^1.0.1", + "ecdsa-sig-formatter": "1.0.11", + "safe-buffer": "^5.0.1" + } + }, + "node_modules/jws": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/jws/-/jws-4.0.1.tgz", + "integrity": "sha512-EKI/M/yqPncGUUh44xz0PxSidXFr/+r0pA70+gIYhjv+et7yxM+s29Y+VGDkovRofQem0fs7Uvf4+YmAdyRduA==", + "license": "MIT", + "dependencies": { + "jwa": "^2.0.1", + "safe-buffer": "^5.0.1" + } + }, + "node_modules/keytar": { + "version": "7.9.0", + "resolved": "https://registry.npmjs.org/keytar/-/keytar-7.9.0.tgz", + "integrity": "sha512-VPD8mtVtm5JNtA2AErl6Chp06JBfy7diFQ7TQQhdpWOl6MrCRB+eRbvAZUsbGQS9kiMq0coJsy0W0vHpDCkWsQ==", + "hasInstallScript": true, + "license": "MIT", + "dependencies": { + "node-addon-api": "^4.3.0", + "prebuild-install": "^7.0.1" + } + }, + "node_modules/keytar/node_modules/node-addon-api": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-4.3.0.tgz", + "integrity": "sha512-73sE9+3UaLYYFmDsFZnqCInzPyh3MqIwZO9cw58yIqAZhONrrabrYyYe3TuIqtIiOuTXVhsGau8hcrhhwSsDIQ==", + "license": "MIT" + }, + "node_modules/keyv": { + "version": "4.5.4", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz", + "integrity": "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==", + "license": "MIT", + "dependencies": { + "json-buffer": "3.0.1" + } + }, + "node_modules/kind-of": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", + "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/klaw-sync": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/klaw-sync/-/klaw-sync-6.0.0.tgz", + "integrity": "sha512-nIeuVSzdCCs6TDPTqI8w1Yre34sSq7AkZ4B3sfOBbI2CgVSB4Du4aLQijFU2+lhAFCwt9+42Hel6lQNIv6AntQ==", + "license": "MIT", + "dependencies": { + "graceful-fs": "^4.1.11" + } + }, + "node_modules/lazy-val": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/lazy-val/-/lazy-val-1.0.5.tgz", + "integrity": "sha512-0/BnGCCfyUMkBpeDgWihanIAF9JmZhHBgUhEqzvf+adhNGLoP6TaiI5oF8oyb3I45P+PcnrqihSf01M0l0G5+Q==", + "dev": true, + "license": "MIT" + }, + "node_modules/lazystream": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/lazystream/-/lazystream-1.0.1.tgz", + "integrity": "sha512-b94GiNHQNy6JNTrt5w6zNyffMrNkXZb3KTkCZJb2V1xaEGCk093vkZ2jk3tpaeP33/OiXC+WvK9AxUebnf5nbw==", + "license": "MIT", + "dependencies": { + "readable-stream": "^2.0.5" + }, + "engines": { + "node": ">= 0.6.3" + } + }, + "node_modules/lazystream/node_modules/isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==", + "license": "MIT" + }, + "node_modules/lazystream/node_modules/readable-stream": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", + "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", + "license": "MIT", + "dependencies": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "node_modules/lazystream/node_modules/safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "license": "MIT" + }, + "node_modules/lazystream/node_modules/string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.1.0" + } + }, + "node_modules/lerna": { + "version": "9.0.4", + "resolved": "https://registry.npmjs.org/lerna/-/lerna-9.0.4.tgz", + "integrity": "sha512-wKy9TOkkdCWPWET0R5o7mh7J0KuNNjxE0g+qTruNAt5ffWwy54wfWiJtWyDSMOrcGDt6gtisDBTKniOqK/sJvw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@lerna/create": "9.0.4", + "@npmcli/arborist": "9.1.6", + "@npmcli/package-json": "7.0.2", + "@npmcli/run-script": "10.0.3", + "@nx/devkit": ">=21.5.2 < 23.0.0", + "@octokit/plugin-enterprise-rest": "6.0.1", + "@octokit/rest": "20.1.2", + "aproba": "2.0.0", + "byte-size": "8.1.1", + "chalk": "4.1.0", + "cmd-shim": "6.0.3", + "color-support": "1.1.3", + "columnify": "1.6.0", + "console-control-strings": "^1.1.0", + "conventional-changelog-angular": "7.0.0", + "conventional-changelog-core": "5.0.1", + "conventional-recommended-bump": "7.0.1", + "cosmiconfig": "9.0.0", + "dedent": "1.5.3", + "envinfo": "7.13.0", + "execa": "5.0.0", + "fs-extra": "^11.2.0", + "get-port": "5.1.1", + "get-stream": "6.0.0", + "git-url-parse": "14.0.0", + "glob-parent": "6.0.2", + "has-unicode": "2.0.1", + "import-local": "3.1.0", + "ini": "^1.3.8", + "init-package-json": "8.2.2", + "inquirer": "12.9.6", + "is-ci": "3.0.1", + "is-stream": "2.0.0", + "jest-diff": ">=30.0.0 < 31", + "js-yaml": "4.1.1", + "libnpmaccess": "10.0.3", + "libnpmpublish": "11.1.2", + "load-json-file": "6.2.0", + "make-dir": "4.0.0", + "make-fetch-happen": "15.0.2", + "minimatch": "3.0.5", + "multimatch": "5.0.0", + "npm-package-arg": "13.0.1", + "npm-packlist": "10.0.3", + "npm-registry-fetch": "19.1.0", + "nx": ">=21.5.3 < 23.0.0", + "p-map": "4.0.0", + "p-map-series": "2.1.0", + "p-pipe": "3.1.0", + "p-queue": "6.6.2", + "p-reduce": "2.1.0", + "p-waterfall": "2.1.1", + "pacote": "21.0.1", + "pify": "5.0.0", + "read-cmd-shim": "4.0.0", + "resolve-from": "5.0.0", + "rimraf": "^6.1.2", + "semver": "7.7.2", + "set-blocking": "^2.0.0", + "signal-exit": "3.0.7", + "slash": "3.0.0", + "ssri": "12.0.0", + "string-width": "^4.2.3", + "tar": "7.5.7", + "temp-dir": "1.0.0", + "through": "2.3.8", + "tinyglobby": "0.2.12", + "typescript": ">=3 < 6", + "upath": "2.0.1", + "uuid": "^11.1.0", + "validate-npm-package-license": "3.0.4", + "validate-npm-package-name": "6.0.2", + "wide-align": "1.1.5", + "write-file-atomic": "5.0.1", + "write-pkg": "4.0.0", + "yargs": "17.7.2", + "yargs-parser": "21.1.1" + }, + "bin": { + "lerna": "dist/cli.js" + }, + "engines": { + "node": "^20.19.0 || ^22.12.0 || >=24.0.0" + } + }, + "node_modules/lerna/node_modules/chalk": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.0.tgz", + "integrity": "sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/lerna/node_modules/fs-extra": { + "version": "11.3.3", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.3.3.tgz", + "integrity": "sha512-VWSRii4t0AFm6ixFFmLLx1t7wS1gh+ckoa84aOeapGum0h+EZd1EhEumSB+ZdDLnEPuucsVB9oB7cxJHap6Afg==", + "dev": true, + "license": "MIT", + "dependencies": { + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + }, + "engines": { + "node": ">=14.14" + } + }, + "node_modules/lerna/node_modules/glob": { + "version": "13.0.2", + "resolved": "https://registry.npmjs.org/glob/-/glob-13.0.2.tgz", + "integrity": "sha512-035InabNu/c1lW0tzPhAgapKctblppqsKKG9ZaNzbr+gXwWMjXoiyGSyB9sArzrjG7jY+zntRq5ZSUYemrnWVQ==", + "dev": true, + "license": "BlueOak-1.0.0", + "dependencies": { + "minimatch": "^10.1.2", + "minipass": "^7.1.2", + "path-scurry": "^2.0.0" + }, + "engines": { + "node": "20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/lerna/node_modules/glob/node_modules/minimatch": { + "version": "10.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.1.2.tgz", + "integrity": "sha512-fu656aJ0n2kcXwsnwnv9g24tkU5uSmOlTjd6WyyaKm2Z+h1qmY6bAjrcaIxF/BslFqbZ8UBtbJi7KgQOZD2PTw==", + "dev": true, + "license": "BlueOak-1.0.0", + "dependencies": { + "@isaacs/brace-expansion": "^5.0.1" + }, + "engines": { + "node": "20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/lerna/node_modules/jsonfile": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.2.0.tgz", + "integrity": "sha512-FGuPw30AdOIUTRMC2OMRtQV+jkVj2cfPqSeWXv1NEAJ1qZ5zb1X6z1mFhbfOB/iy3ssJCD+3KuZ8r8C3uVFlAg==", + "dev": true, + "license": "MIT", + "dependencies": { + "universalify": "^2.0.0" + }, + "optionalDependencies": { + "graceful-fs": "^4.1.6" + } + }, + "node_modules/lerna/node_modules/minimatch": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.5.tgz", + "integrity": "sha512-tUpxzX0VAzJHjLu0xUfFv1gwVp9ba3IOuRAVH2EGuRW8a5emA2FlACLqiT/lDVtS1W+TGNwqz3sWaNyLgDJWuw==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/lerna/node_modules/resolve-from": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", + "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/lerna/node_modules/rimraf": { + "version": "6.1.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-6.1.2.tgz", + "integrity": "sha512-cFCkPslJv7BAXJsYlK1dZsbP8/ZNLkCAQ0bi1hf5EKX2QHegmDFEFA6QhuYJlk7UDdc+02JjO80YSOrWPpw06g==", + "dev": true, + "license": "BlueOak-1.0.0", + "dependencies": { + "glob": "^13.0.0", + "package-json-from-dist": "^1.0.1" + }, + "bin": { + "rimraf": "dist/esm/bin.mjs" + }, + "engines": { + "node": "20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/lerna/node_modules/semver": { + "version": "7.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.2.tgz", + "integrity": "sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/lerna/node_modules/universalify": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz", + "integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 10.0.0" + } + }, + "node_modules/lerna/node_modules/uuid": { + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-11.1.0.tgz", + "integrity": "sha512-0/A9rDy9P7cJ+8w1c9WD9V//9Wj15Ce2MPz8Ri6032usz+NfePxx5AcN3bN+r6ZL6jEo066/yNYB3tn4pQEx+A==", + "dev": true, + "funding": [ + "https://github.com/sponsors/broofa", + "https://github.com/sponsors/ctavan" + ], + "license": "MIT", + "bin": { + "uuid": "dist/esm/bin/uuid" + } + }, + "node_modules/lerna/node_modules/y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=10" + } + }, + "node_modules/lerna/node_modules/yargs": { + "version": "17.7.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", + "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", + "dev": true, + "license": "MIT", + "dependencies": { + "cliui": "^8.0.1", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.3", + "y18n": "^5.0.5", + "yargs-parser": "^21.1.1" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/less": { + "version": "3.13.1", + "resolved": "https://registry.npmjs.org/less/-/less-3.13.1.tgz", + "integrity": "sha512-SwA1aQXGUvp+P5XdZslUOhhLnClSLIjWvJhmd+Vgib5BFIr9lMNlQwmwUNOjXThF/A0x+MCYYPeWEfeWiLRnTw==", + "license": "Apache-2.0", + "dependencies": { + "copy-anything": "^2.0.1", + "tslib": "^1.10.0" + }, + "bin": { + "lessc": "bin/lessc" + }, + "engines": { + "node": ">=6" + }, + "optionalDependencies": { + "errno": "^0.1.1", + "graceful-fs": "^4.1.2", + "image-size": "~0.5.0", + "make-dir": "^2.1.0", + "mime": "^1.4.1", + "native-request": "^1.0.5", + "source-map": "~0.6.0" + } + }, + "node_modules/less/node_modules/make-dir": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-2.1.0.tgz", + "integrity": "sha512-LS9X+dc8KLxXCb8dni79fLIIUA5VyZoyjSMCwTluaXA0o27cCK0bhXkpgw+sTXVpPy/lSO57ilRixqk0vDmtRA==", + "license": "MIT", + "optional": true, + "dependencies": { + "pify": "^4.0.1", + "semver": "^5.6.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/less/node_modules/pify": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", + "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==", + "license": "MIT", + "optional": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/less/node_modules/semver": { + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", + "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", + "license": "ISC", + "optional": true, + "bin": { + "semver": "bin/semver" + } + }, + "node_modules/less/node_modules/tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", + "license": "0BSD" + }, + "node_modules/leven": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/leven/-/leven-3.1.0.tgz", + "integrity": "sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/levn": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", + "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/lib0": { + "version": "0.2.117", + "resolved": "https://registry.npmjs.org/lib0/-/lib0-0.2.117.tgz", + "integrity": "sha512-DeXj9X5xDCjgKLU/7RR+/HQEVzuuEUiwldwOGsHK/sfAfELGWEyTcf0x+uOvCvK3O2zPmZePXWL85vtia6GyZw==", + "license": "MIT", + "dependencies": { + "isomorphic.js": "^0.2.4" + }, + "bin": { + "0ecdsa-generate-keypair": "bin/0ecdsa-generate-keypair.js", + "0gentesthtml": "bin/gentesthtml.js", + "0serve": "bin/0serve.js" + }, + "engines": { + "node": ">=16" + }, + "funding": { + "type": "GitHub Sponsors ❤", + "url": "https://github.com/sponsors/dmonad" + } + }, + "node_modules/libnpmaccess": { + "version": "10.0.3", + "resolved": "https://registry.npmjs.org/libnpmaccess/-/libnpmaccess-10.0.3.tgz", + "integrity": "sha512-JPHTfWJxIK+NVPdNMNGnkz4XGX56iijPbe0qFWbdt68HL+kIvSzh+euBL8npLZvl2fpaxo+1eZSdoG15f5YdIQ==", + "dev": true, + "license": "ISC", + "dependencies": { + "npm-package-arg": "^13.0.0", + "npm-registry-fetch": "^19.0.0" + }, + "engines": { + "node": "^20.17.0 || >=22.9.0" + } + }, + "node_modules/libnpmpublish": { + "version": "11.1.2", + "resolved": "https://registry.npmjs.org/libnpmpublish/-/libnpmpublish-11.1.2.tgz", + "integrity": "sha512-tNcU3cLH7toloAzhOOrBDhjzgbxpyuYvkf+BPPnnJCdc5EIcdJ8JcT+SglvCQKKyZ6m9dVXtCVlJcA6csxKdEA==", + "dev": true, + "license": "ISC", + "dependencies": { + "@npmcli/package-json": "^7.0.0", + "ci-info": "^4.0.0", + "npm-package-arg": "^13.0.0", + "npm-registry-fetch": "^19.0.0", + "proc-log": "^5.0.0", + "semver": "^7.3.7", + "sigstore": "^4.0.0", + "ssri": "^12.0.0" + }, + "engines": { + "node": "^20.17.0 || >=22.9.0" + } + }, + "node_modules/libnpmpublish/node_modules/ci-info": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-4.4.0.tgz", + "integrity": "sha512-77PSwercCZU2Fc4sX94eF8k8Pxte6JAwL4/ICZLFjJLqegs7kCuAsqqj/70NQF6TvDpgFjkubQB2FW2ZZddvQg==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/sibiraj-s" + } + ], + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/limiter": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/limiter/-/limiter-2.1.0.tgz", + "integrity": "sha512-361TYz6iay6n+9KvUUImqdLuFigK+K79qrUtBsXhJTLdH4rIt/r1y8r1iozwh8KbZNpujbFTSh74mJ7bwbAMOw==", + "license": "MIT", + "dependencies": { + "just-performance": "4.3.0" + } + }, + "node_modules/lines-and-columns": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-2.0.3.tgz", + "integrity": "sha512-cNOjgCnLB+FnvWWtyRTzmB3POJ+cXxTA81LoW7u8JdmhfXzriropYwpjShnz1QLLWsQwY7nIxoDmcPTwphDK9w==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + } + }, + "node_modules/linkify-it": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-3.0.3.tgz", + "integrity": "sha512-ynTsyrFSdE5oZ/O9GEf00kPngmOfVwazR5GKDq6EYfhlpFug3J2zybX56a2PRRpc9P+FuSoGNAwjlbDs9jJBPQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "uc.micro": "^1.0.1" + } + }, + "node_modules/listenercount": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/listenercount/-/listenercount-1.0.1.tgz", + "integrity": "sha512-3mk/Zag0+IJxeDrxSgaDPy4zZ3w05PRZeJNnlWhzFz5OkX49J4krc+A8X2d2M69vGMBEX0uyl8M+W+8gH+kBqQ==", + "license": "ISC" + }, + "node_modules/load-json-file": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-6.2.0.tgz", + "integrity": "sha512-gUD/epcRms75Cw8RT1pUdHugZYM5ce64ucs2GEISABwkRsOQr0q2wm/MV2TKThycIe5e0ytRweW2RZxclogCdQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "graceful-fs": "^4.1.15", + "parse-json": "^5.0.0", + "strip-bom": "^4.0.0", + "type-fest": "^0.6.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/load-json-file/node_modules/type-fest": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.6.0.tgz", + "integrity": "sha512-q+MB8nYR1KDLrgr4G5yemftpMC7/QLqVndBmEEdqzmNj5dcFOO4Oo8qlwZE3ULT3+Zim1F8Kq4cBnikNhlCMlg==", + "dev": true, + "license": "(MIT OR CC0-1.0)", + "engines": { + "node": ">=8" + } + }, + "node_modules/loader-runner": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/loader-runner/-/loader-runner-4.3.1.tgz", + "integrity": "sha512-IWqP2SCPhyVFTBtRcgMHdzlf9ul25NwaFx4wCEH/KjAXuuHY4yNjvPXsBokp8jCB936PyWRaPKUNh8NvylLp2Q==", + "license": "MIT", + "engines": { + "node": ">=6.11.5" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + } + }, + "node_modules/loader-utils": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.4.tgz", + "integrity": "sha512-xXqpXoINfFhgua9xiqD8fPFHgkoq1mmmpE92WlDbm9rNRd/EbRb+Gqf908T2DMfuHjjJlksiK2RbHVOdD/MqSw==", + "license": "MIT", + "dependencies": { + "big.js": "^5.2.2", + "emojis-list": "^3.0.0", + "json5": "^2.1.2" + }, + "engines": { + "node": ">=8.9.0" + } + }, + "node_modules/locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "license": "MIT", + "dependencies": { + "p-locate": "^5.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/lodash": { + "version": "4.17.23", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.23.tgz", + "integrity": "sha512-LgVTMpQtIopCi79SJeDiP0TfWi5CNEc/L/aRdTh3yIvmZXTnheWpKjSZhnvMl8iXbC1tFg9gdHHDMLoV7CnG+w==", + "dev": true, + "license": "MIT" + }, + "node_modules/lodash.camelcase": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz", + "integrity": "sha512-TwuEnCnxbc3rAvhf/LbG7tJUDzhqXyFnv3dtzLOPgCG/hODL7WFnsbwktkD7yUV0RrreP/l1PALq/YSg6VvjlA==", + "license": "MIT" + }, + "node_modules/lodash.clonedeep": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz", + "integrity": "sha512-H5ZhCF25riFd9uB5UCkVKo61m3S/xZk1x4wA6yp/L3RFP6Z/eHH1ymQcGLo7J3GMPfm0V/7m1tryHuGVxpqEBQ==", + "license": "MIT" + }, + "node_modules/lodash.debounce": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/lodash.debounce/-/lodash.debounce-4.0.8.tgz", + "integrity": "sha512-FT1yDzDYEoYWhnSGnpE/4Kj1fLZkDFyqRb7fNt6FdYOSxlUWAtp42Eh6Wb0rGIv/m9Bgo7x4GhQbm5Ys4SG5ow==", + "license": "MIT" + }, + "node_modules/lodash.defaults": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/lodash.defaults/-/lodash.defaults-4.2.0.tgz", + "integrity": "sha512-qjxPLHd3r5DnsdGacqOMU6pb/avJzdh9tFX2ymgoZE27BmjXrNy/y4LoaiTeAb+O3gL8AfpJGtqfX/ae2leYYQ==", + "license": "MIT" + }, + "node_modules/lodash.difference": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/lodash.difference/-/lodash.difference-4.5.0.tgz", + "integrity": "sha512-dS2j+W26TQ7taQBGN8Lbbq04ssV3emRw4NY58WErlTO29pIqS0HmoT5aJ9+TUQ1N3G+JOZSji4eugsWwGp9yPA==", + "license": "MIT" + }, + "node_modules/lodash.flatten": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/lodash.flatten/-/lodash.flatten-4.4.0.tgz", + "integrity": "sha512-C5N2Z3DgnnKr0LOpv/hKCgKdb7ZZwafIrsesve6lmzvZIRZRGaZ/l6Q8+2W7NaT+ZwO3fFlSCzCzrDCFdJfZ4g==", + "license": "MIT" + }, + "node_modules/lodash.flattendeep": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/lodash.flattendeep/-/lodash.flattendeep-4.4.0.tgz", + "integrity": "sha512-uHaJFihxmJcEX3kT4I23ABqKKalJ/zDrDg0lsFtc1h+3uw49SIJ5beyhx5ExVRti3AvKoOJngIj7xz3oylPdWQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/lodash.get": { + "version": "4.4.2", + "resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz", + "integrity": "sha512-z+Uw/vLuy6gQe8cfaFWD7p0wVv8fJl3mbzXh33RS+0oW2wvUqiRXiQ69gLWSLpgB5/6sU+r6BlQR0MBILadqTQ==", + "deprecated": "This package is deprecated. Use the optional chaining (?.) operator instead.", + "dev": true, + "license": "MIT" + }, + "node_modules/lodash.includes": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/lodash.includes/-/lodash.includes-4.3.0.tgz", + "integrity": "sha512-W3Bx6mdkRTGtlJISOvVD/lbqjTlPPUDTMnlXZFnVwi9NKJ6tiAk6LVdlhZMm17VZisqhKcgzpO5Wz91PCt5b0w==", + "dev": true, + "license": "MIT" + }, + "node_modules/lodash.isboolean": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/lodash.isboolean/-/lodash.isboolean-3.0.3.tgz", + "integrity": "sha512-Bz5mupy2SVbPHURB98VAcw+aHh4vRV5IPNhILUCsOzRmsTmSQ17jIuqopAentWoehktxGd9e/hbIXq980/1QJg==", + "dev": true, + "license": "MIT" + }, + "node_modules/lodash.isinteger": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/lodash.isinteger/-/lodash.isinteger-4.0.4.tgz", + "integrity": "sha512-DBwtEWN2caHQ9/imiNeEA5ys1JoRtRfY3d7V9wkqtbycnAmTvRRmbHKDV4a0EYc678/dia0jrte4tjYwVBaZUA==", + "dev": true, + "license": "MIT" + }, + "node_modules/lodash.ismatch": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/lodash.ismatch/-/lodash.ismatch-4.4.0.tgz", + "integrity": "sha512-fPMfXjGQEV9Xsq/8MTSgUf255gawYRbjwMyDbcvDhXgV7enSZA0hynz6vMPnpAb5iONEzBHBPsT+0zes5Z301g==", + "dev": true, + "license": "MIT" + }, + "node_modules/lodash.isnumber": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/lodash.isnumber/-/lodash.isnumber-3.0.3.tgz", + "integrity": "sha512-QYqzpfwO3/CWf3XP+Z+tkQsfaLL/EnUlXWVkIk5FUPc4sBdTehEqZONuyRt2P67PXAk+NXmTBcc97zw9t1FQrw==", + "dev": true, + "license": "MIT" + }, + "node_modules/lodash.isplainobject": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz", + "integrity": "sha512-oSXzaWypCMHkPC3NvBEaPHf0KsA5mvPrOPgQWDsbg8n7orZ290M0BmC/jgRZ4vcJ6DTAhjrsSYgdsW/F+MFOBA==", + "license": "MIT" + }, + "node_modules/lodash.isstring": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/lodash.isstring/-/lodash.isstring-4.0.1.tgz", + "integrity": "sha512-0wJxfxH1wgO3GrbuP+dTTk7op+6L41QCXbGINEmD+ny/G/eCqGzxyCsh7159S+mgDDcoarnBw6PC1PS5+wUGgw==", + "dev": true, + "license": "MIT" + }, + "node_modules/lodash.merge": { + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", + "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/lodash.once": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/lodash.once/-/lodash.once-4.1.1.tgz", + "integrity": "sha512-Sb487aTOCr9drQVL8pIxOzVhafOjZN9UU54hiN8PU3uAiSV7lx1yYNpbNmex2PK6dSJoNTSJUUswT651yww3Mg==", + "dev": true, + "license": "MIT" + }, + "node_modules/lodash.throttle": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/lodash.throttle/-/lodash.throttle-4.1.1.tgz", + "integrity": "sha512-wIkUCfVKpVsWo3JSZlc+8MB5it+2AN5W8J7YVMST30UrvcQNZ1Okbj+rbVniijTWE6FGYy4XJq/rHkas8qJMLQ==", + "license": "MIT" + }, + "node_modules/lodash.union": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/lodash.union/-/lodash.union-4.6.0.tgz", + "integrity": "sha512-c4pB2CdGrGdjMKYLA+XiRDO7Y0PRQbm/Gzg8qMj+QH+pFVAoTp5sBpO0odL3FjoPCGjK96p6qsP+yQoiLoOBcw==", + "license": "MIT" + }, + "node_modules/log-symbols": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz", + "integrity": "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==", + "license": "MIT", + "dependencies": { + "chalk": "^4.1.0", + "is-unicode-supported": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/log-symbols/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/log-update": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/log-update/-/log-update-4.0.0.tgz", + "integrity": "sha512-9fkkDevMefjg0mmzWFBW8YkFP91OrizzkW3diF7CpG+S2EYdy4+TVfGwz1zeF8x7hCx1ovSPTOE9Ngib74qqUg==", + "license": "MIT", + "dependencies": { + "ansi-escapes": "^4.3.0", + "cli-cursor": "^3.1.0", + "slice-ansi": "^4.0.0", + "wrap-ansi": "^6.2.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/log-update/node_modules/slice-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-4.0.0.tgz", + "integrity": "sha512-qMCMfhY040cVHT43K9BFygqYbUPFZKHOg7K73mtTWJRb8pyP3fzf4Ixd5SzdEJQ6MRUg/WBnOLxghZtKKurENQ==", + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.0.0", + "astral-regex": "^2.0.0", + "is-fullwidth-code-point": "^3.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/slice-ansi?sponsor=1" + } + }, + "node_modules/long": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/long/-/long-5.3.2.tgz", + "integrity": "sha512-mNAgZ1GmyNhD7AuqnTG3/VQ26o760+ZYBPKjPvugO8+nLbYfX6TVpJPseBvopbdY+qpZ/lKUnmEc1LeZYS3QAA==", + "license": "Apache-2.0" + }, + "node_modules/loose-envify": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", + "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", + "license": "MIT", + "dependencies": { + "js-tokens": "^3.0.0 || ^4.0.0" + }, + "bin": { + "loose-envify": "cli.js" + } + }, + "node_modules/loupe": { + "version": "2.3.7", + "resolved": "https://registry.npmjs.org/loupe/-/loupe-2.3.7.tgz", + "integrity": "sha512-zSMINGVYkdpYSOBmLi0D1Uo7JU9nVdQKrHxC8eYlV+9YKK9WePqAlL7lSlorG/U2Fw1w0hTBmaa/jrQ3UbPHtA==", + "license": "MIT", + "dependencies": { + "get-func-name": "^2.0.1" + } + }, + "node_modules/lowercase-keys": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-2.0.0.tgz", + "integrity": "sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "license": "ISC", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/lunr": { + "version": "2.3.9", + "resolved": "https://registry.npmjs.org/lunr/-/lunr-2.3.9.tgz", + "integrity": "sha512-zTU3DaZaF3Rt9rhN3uBMGQD3dD2/vFQqnvZCDv4dl5iOzq2IZQqTxu90r4E5J+nP70J3ilqVCrbho2eWaeW8Ow==", + "dev": true, + "license": "MIT" + }, + "node_modules/luxon": { + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/luxon/-/luxon-2.5.2.tgz", + "integrity": "sha512-Yg7/RDp4nedqmLgyH0LwgGRvMEKVzKbUdkBYyCosbHgJ+kaOUx0qzSiSatVc3DFygnirTPYnMM2P5dg2uH1WvA==", + "license": "MIT", + "engines": { + "node": ">=12" + } + }, + "node_modules/macaddress": { + "version": "0.5.4", + "resolved": "https://registry.npmjs.org/macaddress/-/macaddress-0.5.4.tgz", + "integrity": "sha512-i8xVWoUjj2woYU8kbpQby86Kq7uF7xl2brtKREXUBWpfgqx1fKXEeYzDiVMVxA/IufC1d3xxwJRHtFCX+9IspA==", + "license": "MIT" + }, + "node_modules/make-dir": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-4.0.0.tgz", + "integrity": "sha512-hXdUTZYIVOt1Ex//jAQi+wTZZpUpwBj/0QsOzqegb3rGMMeJiSEu5xLHnYfBrRV4RH2+OCSOO95Is/7x1WJ4bw==", + "dev": true, + "license": "MIT", + "dependencies": { + "semver": "^7.5.3" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/make-fetch-happen": { + "version": "15.0.2", + "resolved": "https://registry.npmjs.org/make-fetch-happen/-/make-fetch-happen-15.0.2.tgz", + "integrity": "sha512-sI1NY4lWlXBAfjmCtVWIIpBypbBdhHtcjnwnv+gtCnsaOffyFil3aidszGC8hgzJe+fT1qix05sWxmD/Bmf/oQ==", + "dev": true, + "license": "ISC", + "dependencies": { + "@npmcli/agent": "^4.0.0", + "cacache": "^20.0.1", + "http-cache-semantics": "^4.1.1", + "minipass": "^7.0.2", + "minipass-fetch": "^4.0.0", + "minipass-flush": "^1.0.5", + "minipass-pipeline": "^1.2.4", + "negotiator": "^1.0.0", + "proc-log": "^5.0.0", + "promise-retry": "^2.0.1", + "ssri": "^12.0.0" + }, + "engines": { + "node": "^20.17.0 || >=22.9.0" + } + }, + "node_modules/make-fetch-happen/node_modules/negotiator": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-1.0.0.tgz", + "integrity": "sha512-8Ofs/AUQh8MaEcrlq5xOX0CQ9ypTF5dl78mjlMNfOK08fzpgTHQRQPBxcPlEtIw0yRpws+Zo/3r+5WRby7u3Gg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/map-obj": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-4.3.0.tgz", + "integrity": "sha512-hdN1wVrZbb29eBGiGjJbeP8JbKjq1urkHJ/LIP/NY48MZ1QVXUsQBV1G1zvYFHn1XE06cwjBsOI2K3Ulnj1YXQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/map-stream": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/map-stream/-/map-stream-0.1.0.tgz", + "integrity": "sha512-CkYQrPYZfWnu/DAmVCpTSX/xHpKZ80eKh2lAkyA6AJTef6bW+6JpbQZN5rofum7da+SyN1bi5ctTm+lTfcCW3g==", + "dev": true + }, + "node_modules/markdown-it": { + "version": "12.3.2", + "resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-12.3.2.tgz", + "integrity": "sha512-TchMembfxfNVpHkbtriWltGWc+m3xszaRD0CZup7GFFhzIgQqxIfn3eGj1yZpfuflzPvfkt611B2Q/Bsk1YnGg==", + "dev": true, + "license": "MIT", + "dependencies": { + "argparse": "^2.0.1", + "entities": "~2.1.0", + "linkify-it": "^3.0.1", + "mdurl": "^1.0.1", + "uc.micro": "^1.0.5" + }, + "bin": { + "markdown-it": "bin/markdown-it.js" + } + }, + "node_modules/markdown-it-anchor": { + "version": "9.2.0", + "resolved": "https://registry.npmjs.org/markdown-it-anchor/-/markdown-it-anchor-9.2.0.tgz", + "integrity": "sha512-sa2ErMQ6kKOA4l31gLGYliFQrMKkqSO0ZJgGhDHKijPf0pNFM9vghjAh3gn26pS4JDRs7Iwa9S36gxm3vgZTzg==", + "license": "Unlicense", + "peerDependencies": { + "@types/markdown-it": "*", + "markdown-it": "*" + } + }, + "node_modules/markdown-it-emoji": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/markdown-it-emoji/-/markdown-it-emoji-3.0.0.tgz", + "integrity": "sha512-+rUD93bXHubA4arpEZO3q80so0qgoFJEKRkRbjKX8RTdca89v2kfyF+xR3i2sQTwql9tpPZPOQN5B+PunspXRg==", + "license": "MIT" + }, + "node_modules/markdown-it/node_modules/entities": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-2.1.0.tgz", + "integrity": "sha512-hCx1oky9PFrJ611mf0ifBLBRW8lUUVRlFolb5gWRfIELabBlbp9xZvrqZLZAs+NxFnbfQoeGd8wDkygjg7U85w==", + "dev": true, + "license": "BSD-2-Clause", + "funding": { + "url": "https://github.com/fb55/entities?sponsor=1" + } + }, + "node_modules/matcher": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/matcher/-/matcher-3.0.0.tgz", + "integrity": "sha512-OkeDaAZ/bQCxeFAozM55PKcKU0yJMPGifLwV4Qgjitu+5MoAfSQN4lsLJeXZ1b8w0x+/Emda6MZgXS1jvsapng==", + "license": "MIT", + "optional": true, + "dependencies": { + "escape-string-regexp": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/math-intrinsics": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz", + "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/md5": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/md5/-/md5-2.3.0.tgz", + "integrity": "sha512-T1GITYmFaKuO91vxyoQMFETst+O71VUPEU3ze5GNzDm0OWdP8v1ziTaAEPUr/3kLsY3Sftgz242A1SetQiDL7g==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "charenc": "0.0.2", + "crypt": "0.0.2", + "is-buffer": "~1.1.6" + } + }, + "node_modules/mdurl": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/mdurl/-/mdurl-1.0.1.tgz", + "integrity": "sha512-/sKlQJCBYVY9Ers9hqzKou4H6V5UWc/M59TH2dvkt+84itfnq7uFOMLpOiOS4ujvHP4etln18fmIxA5R5fll0g==", + "dev": true, + "license": "MIT" + }, + "node_modules/media-typer": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", + "integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/meow": { + "version": "8.1.2", + "resolved": "https://registry.npmjs.org/meow/-/meow-8.1.2.tgz", + "integrity": "sha512-r85E3NdZ+mpYk1C6RjPFEMSE+s1iZMuHtsHAqY0DT3jZczl0diWUZ8g6oU7h0M9cD2EL+PzaYghhCLzR0ZNn5Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/minimist": "^1.2.0", + "camelcase-keys": "^6.2.2", + "decamelize-keys": "^1.1.0", + "hard-rejection": "^2.1.0", + "minimist-options": "4.1.0", + "normalize-package-data": "^3.0.0", + "read-pkg-up": "^7.0.1", + "redent": "^3.0.0", + "trim-newlines": "^3.0.0", + "type-fest": "^0.18.0", + "yargs-parser": "^20.2.3" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/meow/node_modules/find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dev": true, + "license": "MIT", + "dependencies": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/meow/node_modules/hosted-git-info": { + "version": "2.8.9", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.9.tgz", + "integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==", + "dev": true, + "license": "ISC" + }, + "node_modules/meow/node_modules/locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-locate": "^4.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/meow/node_modules/p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-try": "^2.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/meow/node_modules/p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-limit": "^2.2.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/meow/node_modules/read-pkg": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-5.2.0.tgz", + "integrity": "sha512-Ug69mNOpfvKDAc2Q8DRpMjjzdtrnv9HcSMX+4VsZxD1aZ6ZzrIE7rlzXBtWTyhULSMKg076AW6WR5iZpD0JiOg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/normalize-package-data": "^2.4.0", + "normalize-package-data": "^2.5.0", + "parse-json": "^5.0.0", + "type-fest": "^0.6.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/meow/node_modules/read-pkg-up": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-7.0.1.tgz", + "integrity": "sha512-zK0TB7Xd6JpCLmlLmufqykGE+/TlOePD6qKClNW7hHDKFh/J7/7gCWGR7joEQEW1bKq3a3yUZSObOoWLFQ4ohg==", + "dev": true, + "license": "MIT", + "dependencies": { + "find-up": "^4.1.0", + "read-pkg": "^5.2.0", + "type-fest": "^0.8.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/meow/node_modules/read-pkg-up/node_modules/type-fest": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz", + "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==", + "dev": true, + "license": "(MIT OR CC0-1.0)", + "engines": { + "node": ">=8" + } + }, + "node_modules/meow/node_modules/read-pkg/node_modules/normalize-package-data": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", + "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "hosted-git-info": "^2.1.4", + "resolve": "^1.10.0", + "semver": "2 || 3 || 4 || 5", + "validate-npm-package-license": "^3.0.1" + } + }, + "node_modules/meow/node_modules/read-pkg/node_modules/type-fest": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.6.0.tgz", + "integrity": "sha512-q+MB8nYR1KDLrgr4G5yemftpMC7/QLqVndBmEEdqzmNj5dcFOO4Oo8qlwZE3ULT3+Zim1F8Kq4cBnikNhlCMlg==", + "dev": true, + "license": "(MIT OR CC0-1.0)", + "engines": { + "node": ">=8" + } + }, + "node_modules/meow/node_modules/semver": { + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", + "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver" + } + }, + "node_modules/meow/node_modules/type-fest": { + "version": "0.18.1", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.18.1.tgz", + "integrity": "sha512-OIAYXk8+ISY+qTOwkHtKqzAuxchoMiD9Udx+FSGQDuiRR+PJKJHc2NJAXlbhkGwTt/4/nKZxELY1w3ReWOL8mw==", + "dev": true, + "license": "(MIT OR CC0-1.0)", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/meow/node_modules/yargs-parser": { + "version": "20.2.9", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.9.tgz", + "integrity": "sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=10" + } + }, + "node_modules/merge-descriptors": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.3.tgz", + "integrity": "sha512-gaNvAS7TZ897/rVaZ0nMtAyxNyi/pdbjbAwUpFQpN70GqnVfOiXpeUUMKRBmzXaSQ8DdTX4/0ms62r2K+hE6mQ==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/merge-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", + "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", + "license": "MIT" + }, + "node_modules/merge2": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", + "license": "MIT", + "engines": { + "node": ">= 8" + } + }, + "node_modules/methods": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", + "integrity": "sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/micromatch": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", + "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==", + "license": "MIT", + "dependencies": { + "braces": "^3.0.3", + "picomatch": "^2.3.1" + }, + "engines": { + "node": ">=8.6" + } + }, + "node_modules/micromatch/node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "license": "MIT", + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/mime": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", + "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", + "license": "MIT", + "bin": { + "mime": "cli.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "license": "MIT", + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mimic-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/mimic-response": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-3.1.0.tgz", + "integrity": "sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==", + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/min-indent": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/min-indent/-/min-indent-1.0.1.tgz", + "integrity": "sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/mini-css-extract-plugin": { + "version": "2.10.0", + "resolved": "https://registry.npmjs.org/mini-css-extract-plugin/-/mini-css-extract-plugin-2.10.0.tgz", + "integrity": "sha512-540P2c5dYnJlyJxTaSloliZexv8rji6rY8FhQN+WF/82iHQfA23j/xtJx97L+mXOML27EqksSek/g4eK7jaL3g==", + "license": "MIT", + "dependencies": { + "schema-utils": "^4.0.0", + "tapable": "^2.2.1" + }, + "engines": { + "node": ">= 12.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + }, + "peerDependencies": { + "webpack": "^5.0.0" + } + }, + "node_modules/mini-css-extract-plugin/node_modules/ajv": { + "version": "8.17.1", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.17.1.tgz", + "integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==", + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^3.1.3", + "fast-uri": "^3.0.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/mini-css-extract-plugin/node_modules/ajv-formats": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ajv-formats/-/ajv-formats-2.1.1.tgz", + "integrity": "sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA==", + "license": "MIT", + "dependencies": { + "ajv": "^8.0.0" + }, + "peerDependencies": { + "ajv": "^8.0.0" + }, + "peerDependenciesMeta": { + "ajv": { + "optional": true + } + } + }, + "node_modules/mini-css-extract-plugin/node_modules/ajv-keywords": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-5.1.0.tgz", + "integrity": "sha512-YCS/JNFAUyr5vAuhk1DWm1CBxRHW9LbJ2ozWeemrIqpbsqKjHVxYPyi5GC0rjZIT5JxJ3virVTS8wk4i/Z+krw==", + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^3.1.3" + }, + "peerDependencies": { + "ajv": "^8.8.2" + } + }, + "node_modules/mini-css-extract-plugin/node_modules/json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "license": "MIT" + }, + "node_modules/mini-css-extract-plugin/node_modules/schema-utils": { + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-4.3.3.tgz", + "integrity": "sha512-eflK8wEtyOE6+hsaRVPxvUKYCpRgzLqDTb8krvAsRIwOGlHoSgYLgBXoubGgLd2fT41/OUYdb48v4k4WWHQurA==", + "license": "MIT", + "dependencies": { + "@types/json-schema": "^7.0.9", + "ajv": "^8.9.0", + "ajv-formats": "^2.1.1", + "ajv-keywords": "^5.1.0" + }, + "engines": { + "node": ">= 10.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + } + }, + "node_modules/minimatch": { + "version": "10.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.1.2.tgz", + "integrity": "sha512-fu656aJ0n2kcXwsnwnv9g24tkU5uSmOlTjd6WyyaKm2Z+h1qmY6bAjrcaIxF/BslFqbZ8UBtbJi7KgQOZD2PTw==", + "license": "BlueOak-1.0.0", + "dependencies": { + "@isaacs/brace-expansion": "^5.0.1" + }, + "engines": { + "node": "20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/minimist": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", + "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/minimist-options": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/minimist-options/-/minimist-options-4.1.0.tgz", + "integrity": "sha512-Q4r8ghd80yhO/0j1O3B2BjweX3fiHg9cdOwjJd2J76Q135c+NDxGCqdYKQ1SKBuFfgWbAUzBfvYjPUEeNgqN1A==", + "dev": true, + "license": "MIT", + "dependencies": { + "arrify": "^1.0.1", + "is-plain-obj": "^1.1.0", + "kind-of": "^6.0.3" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/minipass": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz", + "integrity": "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==", + "license": "ISC", + "engines": { + "node": ">=16 || 14 >=14.17" + } + }, + "node_modules/minipass-collect": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/minipass-collect/-/minipass-collect-2.0.1.tgz", + "integrity": "sha512-D7V8PO9oaz7PWGLbCACuI1qEOsq7UKfLotx/C0Aet43fCUB/wfQ7DYeq2oR/svFJGYDHPr38SHATeaj/ZoKHKw==", + "dev": true, + "license": "ISC", + "dependencies": { + "minipass": "^7.0.3" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + } + }, + "node_modules/minipass-fetch": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/minipass-fetch/-/minipass-fetch-4.0.1.tgz", + "integrity": "sha512-j7U11C5HXigVuutxebFadoYBbd7VSdZWggSe64NVdvWNBqGAiXPL2QVCehjmw7lY1oF9gOllYbORh+hiNgfPgQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "minipass": "^7.0.3", + "minipass-sized": "^1.0.3", + "minizlib": "^3.0.1" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + }, + "optionalDependencies": { + "encoding": "^0.1.13" + } + }, + "node_modules/minipass-flush": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/minipass-flush/-/minipass-flush-1.0.5.tgz", + "integrity": "sha512-JmQSYYpPUqX5Jyn1mXaRwOda1uQ8HP5KAT/oDSLCzt1BYRhQU0/hDtsB1ufZfEEzMZ9aAVmsBw8+FWsIXlClWw==", + "license": "ISC", + "dependencies": { + "minipass": "^3.0.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/minipass-flush/node_modules/minipass": { + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", + "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", + "license": "ISC", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/minipass-pipeline": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/minipass-pipeline/-/minipass-pipeline-1.2.4.tgz", + "integrity": "sha512-xuIq7cIOt09RPRJ19gdi4b+RiNvDFYe5JH+ggNvBqGqpQXcru3PcRmOZuHBKWK1Txf9+cQ+HMVN4d6z46LZP7A==", + "license": "ISC", + "dependencies": { + "minipass": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/minipass-pipeline/node_modules/minipass": { + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", + "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", + "license": "ISC", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/minipass-sized": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/minipass-sized/-/minipass-sized-1.0.3.tgz", + "integrity": "sha512-MbkQQ2CTiBMlA2Dm/5cY+9SWFEN8pzzOXi6rlM5Xxq0Yqbda5ZQy9sU75a673FE9ZK0Zsbr6Y5iP6u9nktfg2g==", + "license": "ISC", + "dependencies": { + "minipass": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/minipass-sized/node_modules/minipass": { + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", + "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", + "license": "ISC", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/minizlib": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-3.1.0.tgz", + "integrity": "sha512-KZxYo1BUkWD2TVFLr0MQoM8vUUigWD3LlD83a/75BqC+4qE0Hb1Vo5v1FgcfaNXvfXzr+5EhQ6ing/CaBijTlw==", + "dev": true, + "license": "MIT", + "dependencies": { + "minipass": "^7.1.2" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/mitt": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/mitt/-/mitt-3.0.1.tgz", + "integrity": "sha512-vKivATfr97l2/QBCYAkXYDbrIWPM2IIKEl7YPhjCvKlG3kE2gm+uBo6nEXK3M5/Ffh/FLpKExzOQ3JJoJGFKBw==", + "license": "MIT" + }, + "node_modules/mkdirp": { + "version": "0.5.6", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz", + "integrity": "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==", + "license": "MIT", + "dependencies": { + "minimist": "^1.2.6" + }, + "bin": { + "mkdirp": "bin/cmd.js" + } + }, + "node_modules/mkdirp-classic": { + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz", + "integrity": "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==", + "license": "MIT" + }, + "node_modules/mocha": { + "version": "10.4.0", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-10.4.0.tgz", + "integrity": "sha512-eqhGB8JKapEYcC4ytX/xrzKforgEc3j1pGlAXVy3eRwrtAy5/nIfT1SvgGzfN0XZZxeLq0aQWkOUAmqIJiv+bA==", + "license": "MIT", + "dependencies": { + "ansi-colors": "4.1.1", + "browser-stdout": "1.3.1", + "chokidar": "3.5.3", + "debug": "4.3.4", + "diff": "5.0.0", + "escape-string-regexp": "4.0.0", + "find-up": "5.0.0", + "glob": "8.1.0", + "he": "1.2.0", + "js-yaml": "4.1.0", + "log-symbols": "4.1.0", + "minimatch": "5.0.1", + "ms": "2.1.3", + "serialize-javascript": "6.0.0", + "strip-json-comments": "3.1.1", + "supports-color": "8.1.1", + "workerpool": "6.2.1", + "yargs": "16.2.0", + "yargs-parser": "20.2.4", + "yargs-unparser": "2.0.0" + }, + "bin": { + "_mocha": "bin/_mocha", + "mocha": "bin/mocha.js" + }, + "engines": { + "node": ">= 14.0.0" + } + }, + "node_modules/mocha/node_modules/ansi-colors": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", + "integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/mocha/node_modules/brace-expansion": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz", + "integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==", + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/mocha/node_modules/cliui": { + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", + "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", + "license": "ISC", + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^7.0.0" + } + }, + "node_modules/mocha/node_modules/debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "license": "MIT", + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/mocha/node_modules/debug/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "license": "MIT" + }, + "node_modules/mocha/node_modules/glob": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-8.1.0.tgz", + "integrity": "sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==", + "deprecated": "Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me", + "license": "ISC", + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^5.0.1", + "once": "^1.3.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/mocha/node_modules/js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "license": "MIT", + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/mocha/node_modules/minimatch": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.0.1.tgz", + "integrity": "sha512-nLDxIFRyhDblz3qMuq+SoRZED4+miJ/G+tdDrjkkkRnjAsBexeGpgjLEQ0blJy7rHhR2b93rhQY4SvyWu9v03g==", + "license": "ISC", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/mocha/node_modules/supports-color": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", + "license": "MIT", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/supports-color?sponsor=1" + } + }, + "node_modules/mocha/node_modules/wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/mocha/node_modules/y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "license": "ISC", + "engines": { + "node": ">=10" + } + }, + "node_modules/mocha/node_modules/yargs": { + "version": "16.2.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", + "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", + "license": "MIT", + "dependencies": { + "cliui": "^7.0.2", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.0", + "y18n": "^5.0.5", + "yargs-parser": "^20.2.2" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/mocha/node_modules/yargs-parser": { + "version": "20.2.4", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.4.tgz", + "integrity": "sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA==", + "license": "ISC", + "engines": { + "node": ">=10" + } + }, + "node_modules/modify-values": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/modify-values/-/modify-values-1.0.1.tgz", + "integrity": "sha512-xV2bxeN6F7oYjZWTe/YPAy6MN2M+sL4u/Rlm2AHCIVGfo2p1yGmBHQ6vHehl4bRTZBdHu3TSkWdYgkwpYzAGSw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/mount-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/mount-point/-/mount-point-3.0.0.tgz", + "integrity": "sha512-jAhfD7ZCG+dbESZjcY1SdFVFqSJkh/yGbdsifHcPkvuLRO5ugK0Ssmd9jdATu29BTd4JiN+vkpMzVvsUgP3SZA==", + "license": "MIT", + "dependencies": { + "@sindresorhus/df": "^1.0.1", + "pify": "^2.3.0", + "pinkie-promise": "^2.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/mount-point/node_modules/@sindresorhus/df": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@sindresorhus/df/-/df-1.0.1.tgz", + "integrity": "sha512-1Hyp7NQnD/u4DSxR2DGW78TF9k7R0wZ8ev0BpMAIzA6yTQSHqNb5wTuvtcPYf4FWbVse2rW7RgDsyL8ua2vXHw==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/mount-point/node_modules/pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/move-file": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/move-file/-/move-file-2.1.0.tgz", + "integrity": "sha512-i9qLW6gqboJ5Ht8bauZi7KlTnQ3QFpBCvMvFfEcHADKgHGeJ9BZMO7SFCTwHPV9Qa0du9DYY1Yx3oqlGt30nXA==", + "license": "MIT", + "dependencies": { + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=10.17" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "license": "MIT" + }, + "node_modules/msgpackr": { + "version": "1.11.8", + "resolved": "https://registry.npmjs.org/msgpackr/-/msgpackr-1.11.8.tgz", + "integrity": "sha512-bC4UGzHhVvgDNS7kn9tV8fAucIYUBuGojcaLiz7v+P63Lmtm0Xeji8B/8tYKddALXxJLpwIeBmUN3u64C4YkRA==", + "license": "MIT", + "optionalDependencies": { + "msgpackr-extract": "^3.0.2" + } + }, + "node_modules/msgpackr-extract": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/msgpackr-extract/-/msgpackr-extract-3.0.3.tgz", + "integrity": "sha512-P0efT1C9jIdVRefqjzOQ9Xml57zpOXnIuS+csaB4MdZbTdmGDLo8XhzBG1N7aO11gKDDkJvBLULeFTo46wwreA==", + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "dependencies": { + "node-gyp-build-optional-packages": "5.2.2" + }, + "bin": { + "download-msgpackr-prebuilds": "bin/download-prebuilds.js" + }, + "optionalDependencies": { + "@msgpackr-extract/msgpackr-extract-darwin-arm64": "3.0.3", + "@msgpackr-extract/msgpackr-extract-darwin-x64": "3.0.3", + "@msgpackr-extract/msgpackr-extract-linux-arm": "3.0.3", + "@msgpackr-extract/msgpackr-extract-linux-arm64": "3.0.3", + "@msgpackr-extract/msgpackr-extract-linux-x64": "3.0.3", + "@msgpackr-extract/msgpackr-extract-win32-x64": "3.0.3" + } + }, + "node_modules/multer": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/multer/-/multer-2.0.2.tgz", + "integrity": "sha512-u7f2xaZ/UG8oLXHvtF/oWTRvT44p9ecwBBqTwgJVq0+4BW1g8OW01TyMEGWBHbyMOYVHXslaut7qEQ1meATXgw==", + "license": "MIT", + "dependencies": { + "append-field": "^1.0.0", + "busboy": "^1.6.0", + "concat-stream": "^2.0.0", + "mkdirp": "^0.5.6", + "object-assign": "^4.1.1", + "type-is": "^1.6.18", + "xtend": "^4.0.2" + }, + "engines": { + "node": ">= 10.16.0" + } + }, + "node_modules/multimatch": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/multimatch/-/multimatch-5.0.0.tgz", + "integrity": "sha512-ypMKuglUrZUD99Tk2bUQ+xNQj43lPEfAeX2o9cTteAmShXy2VHDJpuwu1o0xqoKCt9jLVAvwyFKdLTPXKAfJyA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/minimatch": "^3.0.3", + "array-differ": "^3.0.0", + "array-union": "^2.1.0", + "arrify": "^2.0.1", + "minimatch": "^3.0.4" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/multimatch/node_modules/arrify": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/arrify/-/arrify-2.0.1.tgz", + "integrity": "sha512-3duEwti880xqi4eAMN8AyR4a0ByT90zoYdLlevfrvU43vb0YZwZVfxOgxWrLXXXpyugL0hNZc9G6BiB5B3nUug==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/multimatch/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/mustache": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/mustache/-/mustache-4.2.0.tgz", + "integrity": "sha512-71ippSywq5Yb7/tVYyGbkBggbU8H3u5Rz56fH60jGFgr8uHwxs+aSKeqmluIVzM0m0kB7xQjKS6qPfd0b2ZoqQ==", + "license": "MIT", + "bin": { + "mustache": "bin/mustache" + } + }, + "node_modules/mute-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-2.0.0.tgz", + "integrity": "sha512-WWdIxpyjEn+FhQJQQv9aQAYlHoNVdzIzUySNV1gHUPDSdZJ3yZn7pAAbQcV7B56Mvu881q9FZV+0Vx2xC44VWA==", + "dev": true, + "license": "ISC", + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/nan": { + "version": "2.23.0", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.23.0.tgz", + "integrity": "sha512-1UxuyYGdoQHcGg87Lkqm3FzefucTa0NAiOcuRsDmysep3c1LVCRK2krrUDafMWtjSG04htvAmvg96+SDknOmgQ==", + "license": "MIT" + }, + "node_modules/nano": { + "version": "10.1.4", + "resolved": "https://registry.npmjs.org/nano/-/nano-10.1.4.tgz", + "integrity": "sha512-bJOFIPLExIbF6mljnfExXX9Cub4W0puhDjVMp+qV40xl/DBvgKao7St4+6/GB6EoHZap7eFnrnx4mnp5KYgwJA==", + "license": "Apache-2.0", + "dependencies": { + "axios": "^1.7.4", + "node-abort-controller": "^3.1.1", + "qs": "^6.13.0" + }, + "engines": { + "node": ">=14" + } + }, + "node_modules/nanoid": { + "version": "3.3.11", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.11.tgz", + "integrity": "sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "bin": { + "nanoid": "bin/nanoid.cjs" + }, + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + } + }, + "node_modules/napi-build-utils": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/napi-build-utils/-/napi-build-utils-2.0.0.tgz", + "integrity": "sha512-GEbrYkbfF7MoNaoh2iGG84Mnf/WZfB0GdGEsM8wz7Expx/LlWf5U8t9nvJKXSp3qr5IsEbK04cBGhol/KwOsWA==", + "license": "MIT" + }, + "node_modules/native-keymap": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/native-keymap/-/native-keymap-2.5.0.tgz", + "integrity": "sha512-EfdMpTcX40mlHBJSWidFV4WLpwwaebK3D3JFuO/42voOAnG2WHgDdg6JerbqcxXvRhvIg934GV+9PjB3jzfu9A==", + "hasInstallScript": true, + "license": "MIT" + }, + "node_modules/native-request": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/native-request/-/native-request-1.1.2.tgz", + "integrity": "sha512-/etjwrK0J4Ebbcnt35VMWnfiUX/B04uwGJxyJInagxDqf2z5drSt/lsOvEMWGYunz1kaLZAFrV4NDAbOoDKvAQ==", + "license": "MIT", + "optional": true + }, + "node_modules/natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", + "dev": true, + "license": "MIT" + }, + "node_modules/negotiator": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", + "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/neo-async": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", + "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==", + "license": "MIT" + }, + "node_modules/netmask": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/netmask/-/netmask-2.0.2.tgz", + "integrity": "sha512-dBpDMdxv9Irdq66304OLfEmQ9tbNRFnFTuZiLo+bD+r332bBmMJ8GBLXklIXXgxd3+v9+KUnZaUR5PJMa75Gsg==", + "license": "MIT", + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/nise": { + "version": "5.1.9", + "resolved": "https://registry.npmjs.org/nise/-/nise-5.1.9.tgz", + "integrity": "sha512-qOnoujW4SV6e40dYxJOb3uvuoPHtmLzIk4TFo+j0jPJoC+5Z9xja5qH5JZobEPsa8+YYphMrOSwnrshEhG2qww==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "@sinonjs/commons": "^3.0.0", + "@sinonjs/fake-timers": "^11.2.2", + "@sinonjs/text-encoding": "^0.7.2", + "just-extend": "^6.2.0", + "path-to-regexp": "^6.2.1" + } + }, + "node_modules/nise/node_modules/@sinonjs/commons": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-3.0.1.tgz", + "integrity": "sha512-K3mCHKQ9sVh8o1C9cxkwxaOmXoAMlDxC1mYyHrjqOWEcBjYr76t96zL2zlj5dUGZ3HSw240X1qgH3Mjf1yJWpQ==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "type-detect": "4.0.8" + } + }, + "node_modules/nise/node_modules/@sinonjs/fake-timers": { + "version": "11.3.1", + "resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-11.3.1.tgz", + "integrity": "sha512-EVJO7nW5M/F5Tur0Rf2z/QoMo+1Ia963RiMtapiQrEWvY0iBUvADo8Beegwjpnle5BHkyHuoxSTW3jF43H1XRA==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "@sinonjs/commons": "^3.0.1" + } + }, + "node_modules/nise/node_modules/path-to-regexp": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-6.3.0.tgz", + "integrity": "sha512-Yhpw4T9C6hPpgPeA28us07OJeqZ5EzQTkbfwuhsUg0c237RomFoETJgmp2sa3F/41gfLE6G5cqcYwznmeEeOlQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/nise/node_modules/type-detect": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", + "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/node-abi": { + "version": "4.26.0", + "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-4.26.0.tgz", + "integrity": "sha512-8QwIZqikRvDIkXS2S93LjzhsSPJuIbfaMETWH+Bx8oOT9Sa9UsUtBFQlc3gBNd1+QINjaTloitXr1W3dQLi9Iw==", + "dev": true, + "license": "MIT", + "dependencies": { + "semver": "^7.6.3" + }, + "engines": { + "node": ">=22.12.0" + } + }, + "node_modules/node-abort-controller": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/node-abort-controller/-/node-abort-controller-3.1.1.tgz", + "integrity": "sha512-AGK2yQKIjRuqnc6VkX2Xj5d+QW8xZ87pa1UK6yA6ouUyuxfHuMP6umE5QK7UmTeOAymo+Zx1Fxiuw9rVx8taHQ==", + "license": "MIT" + }, + "node_modules/node-addon-api": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-7.1.1.tgz", + "integrity": "sha512-5m3bsyrjFWE1xf7nz7YXdN4udnVtXK6/Yfgn5qnahL6bCkf2yKt4k3nuTKAtT4r3IG8JNR2ncsIMdZuAzJjHQQ==", + "license": "MIT" + }, + "node_modules/node-api-version": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/node-api-version/-/node-api-version-0.2.1.tgz", + "integrity": "sha512-2xP/IGGMmmSQpI1+O/k72jF/ykvZ89JeuKX3TLJAYPDVLUalrshrLHkeVcCCZqG/eEa635cr8IBYzgnDvM2O8Q==", + "license": "MIT", + "dependencies": { + "semver": "^7.3.5" + } + }, + "node_modules/node-domexception": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/node-domexception/-/node-domexception-1.0.0.tgz", + "integrity": "sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==", + "deprecated": "Use your platform's native DOMException instead", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/jimmywarting" + }, + { + "type": "github", + "url": "https://paypal.me/jimmywarting" + } + ], + "license": "MIT", + "engines": { + "node": ">=10.5.0" + } + }, + "node_modules/node-fetch": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-3.3.2.tgz", + "integrity": "sha512-dRB78srN/l6gqWulah9SrxeYnxeddIG30+GOqK/9OlLVyLg3HPnr6SqOWTWOXKRwC2eGYCkZ59NNuSgvSrpgOA==", + "license": "MIT", + "dependencies": { + "data-uri-to-buffer": "^4.0.0", + "fetch-blob": "^3.1.4", + "formdata-polyfill": "^4.0.10" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/node-fetch" + } + }, + "node_modules/node-fetch/node_modules/data-uri-to-buffer": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-4.0.1.tgz", + "integrity": "sha512-0R9ikRb668HB7QDxT1vkpuUBtqc53YyAwMwGeUFKRojY/NWKvdZ+9UYtRfGmhqNbRkTSVpMbmyhXipFFv2cb/A==", + "license": "MIT", + "engines": { + "node": ">= 12" + } + }, + "node_modules/node-gyp": { + "version": "11.5.0", + "resolved": "https://registry.npmjs.org/node-gyp/-/node-gyp-11.5.0.tgz", + "integrity": "sha512-ra7Kvlhxn5V9Slyus0ygMa2h+UqExPqUIkfk7Pc8QTLT956JLSy51uWFwHtIYy0vI8cB4BDhc/S03+880My/LQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "env-paths": "^2.2.0", + "exponential-backoff": "^3.1.1", + "graceful-fs": "^4.2.6", + "make-fetch-happen": "^14.0.3", + "nopt": "^8.0.0", + "proc-log": "^5.0.0", + "semver": "^7.3.5", + "tar": "^7.4.3", + "tinyglobby": "^0.2.12", + "which": "^5.0.0" + }, + "bin": { + "node-gyp": "bin/node-gyp.js" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/node-gyp-build-optional-packages": { + "version": "5.2.2", + "resolved": "https://registry.npmjs.org/node-gyp-build-optional-packages/-/node-gyp-build-optional-packages-5.2.2.tgz", + "integrity": "sha512-s+w+rBWnpTMwSFbaE0UXsRlg7hU4FjekKU4eyAih5T8nJuNZT1nNsskXpxmeqSK9UzkBl6UgRlnKc8hz8IEqOw==", + "license": "MIT", + "optional": true, + "dependencies": { + "detect-libc": "^2.0.1" + }, + "bin": { + "node-gyp-build-optional-packages": "bin.js", + "node-gyp-build-optional-packages-optional": "optional.js", + "node-gyp-build-optional-packages-test": "build-test.js" + } + }, + "node_modules/node-gyp/node_modules/@isaacs/cliui": { + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", + "integrity": "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==", + "dev": true, + "license": "ISC", + "dependencies": { + "string-width": "^5.1.2", + "string-width-cjs": "npm:string-width@^4.2.0", + "strip-ansi": "^7.0.1", + "strip-ansi-cjs": "npm:strip-ansi@^6.0.1", + "wrap-ansi": "^8.1.0", + "wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/node-gyp/node_modules/@npmcli/agent": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@npmcli/agent/-/agent-3.0.0.tgz", + "integrity": "sha512-S79NdEgDQd/NGCay6TCoVzXSj74skRZIKJcpJjC5lOq34SZzyI6MqtiiWoiVWoVrTcGjNeC4ipbh1VIHlpfF5Q==", + "dev": true, + "license": "ISC", + "dependencies": { + "agent-base": "^7.1.0", + "http-proxy-agent": "^7.0.0", + "https-proxy-agent": "^7.0.1", + "lru-cache": "^10.0.1", + "socks-proxy-agent": "^8.0.3" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/node-gyp/node_modules/agent-base": { + "version": "7.1.4", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.4.tgz", + "integrity": "sha512-MnA+YT8fwfJPgBx3m60MNqakm30XOkyIoH1y6huTQvC0PwZG7ki8NacLBcrPbNoo8vEZy7Jpuk7+jMO+CUovTQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 14" + } + }, + "node_modules/node-gyp/node_modules/ansi-regex": { + "version": "6.2.2", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.2.2.tgz", + "integrity": "sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" + } + }, + "node_modules/node-gyp/node_modules/ansi-styles": { + "version": "6.2.3", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.3.tgz", + "integrity": "sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/node-gyp/node_modules/brace-expansion": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz", + "integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/node-gyp/node_modules/cacache": { + "version": "19.0.1", + "resolved": "https://registry.npmjs.org/cacache/-/cacache-19.0.1.tgz", + "integrity": "sha512-hdsUxulXCi5STId78vRVYEtDAjq99ICAUktLTeTYsLoTE6Z8dS0c8pWNCxwdrk9YfJeobDZc2Y186hD/5ZQgFQ==", + "dev": true, + "license": "ISC", + "dependencies": { + "@npmcli/fs": "^4.0.0", + "fs-minipass": "^3.0.0", + "glob": "^10.2.2", + "lru-cache": "^10.0.1", + "minipass": "^7.0.3", + "minipass-collect": "^2.0.1", + "minipass-flush": "^1.0.5", + "minipass-pipeline": "^1.2.4", + "p-map": "^7.0.2", + "ssri": "^12.0.0", + "tar": "^7.4.3", + "unique-filename": "^4.0.0" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/node-gyp/node_modules/emoji-regex": { + "version": "9.2.2", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", + "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", + "dev": true, + "license": "MIT" + }, + "node_modules/node-gyp/node_modules/glob": { + "version": "10.5.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-10.5.0.tgz", + "integrity": "sha512-DfXN8DfhJ7NH3Oe7cFmu3NCu1wKbkReJ8TorzSAFbSKrlNaQSKfIzqYqVY8zlbs2NLBbWpRiU52GX2PbaBVNkg==", + "deprecated": "Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me", + "dev": true, + "license": "ISC", + "dependencies": { + "foreground-child": "^3.1.0", + "jackspeak": "^3.1.2", + "minimatch": "^9.0.4", + "minipass": "^7.1.2", + "package-json-from-dist": "^1.0.0", + "path-scurry": "^1.11.1" + }, + "bin": { + "glob": "dist/esm/bin.mjs" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/node-gyp/node_modules/http-proxy-agent": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-5.0.0.tgz", + "integrity": "sha512-n2hY8YdoRE1i7r6M0w9DIw5GgZN0G25P8zLCRQ8rjXtTU3vsNFBI/vWK/UIeE6g5MUUz6avwAPXmL6Fy9D/90w==", + "dev": true, + "license": "MIT", + "dependencies": { + "@tootallnate/once": "2", + "agent-base": "6", + "debug": "4" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/node-gyp/node_modules/http-proxy-agent/node_modules/agent-base": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", + "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "debug": "4" + }, + "engines": { + "node": ">= 6.0.0" + } + }, + "node_modules/node-gyp/node_modules/https-proxy-agent": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz", + "integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==", + "dev": true, + "license": "MIT", + "dependencies": { + "agent-base": "6", + "debug": "4" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/node-gyp/node_modules/https-proxy-agent/node_modules/agent-base": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", + "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "debug": "4" + }, + "engines": { + "node": ">= 6.0.0" + } + }, + "node_modules/node-gyp/node_modules/jackspeak": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-3.4.3.tgz", + "integrity": "sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw==", + "dev": true, + "license": "BlueOak-1.0.0", + "dependencies": { + "@isaacs/cliui": "^8.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + }, + "optionalDependencies": { + "@pkgjs/parseargs": "^0.11.0" + } + }, + "node_modules/node-gyp/node_modules/lru-cache": { + "version": "10.4.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.4.3.tgz", + "integrity": "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==", + "dev": true, + "license": "ISC" + }, + "node_modules/node-gyp/node_modules/make-fetch-happen": { + "version": "14.0.3", + "resolved": "https://registry.npmjs.org/make-fetch-happen/-/make-fetch-happen-14.0.3.tgz", + "integrity": "sha512-QMjGbFTP0blj97EeidG5hk/QhKQ3T4ICckQGLgz38QF7Vgbk6e6FTARN8KhKxyBbWn8R0HU+bnw8aSoFPD4qtQ==", + "dev": true, + "license": "ISC", + "dependencies": { + "@npmcli/agent": "^3.0.0", + "cacache": "^19.0.1", + "http-cache-semantics": "^4.1.1", + "minipass": "^7.0.2", + "minipass-fetch": "^4.0.0", + "minipass-flush": "^1.0.5", + "minipass-pipeline": "^1.2.4", + "negotiator": "^1.0.0", + "proc-log": "^5.0.0", + "promise-retry": "^2.0.1", + "ssri": "^12.0.0" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/node-gyp/node_modules/minimatch": { + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", + "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/node-gyp/node_modules/negotiator": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-1.0.0.tgz", + "integrity": "sha512-8Ofs/AUQh8MaEcrlq5xOX0CQ9ypTF5dl78mjlMNfOK08fzpgTHQRQPBxcPlEtIw0yRpws+Zo/3r+5WRby7u3Gg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/node-gyp/node_modules/p-map": { + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/p-map/-/p-map-7.0.4.tgz", + "integrity": "sha512-tkAQEw8ysMzmkhgw8k+1U/iPhWNhykKnSk4Rd5zLoPJCuJaGRPo6YposrZgaxHKzDHdDWWZvE/Sk7hsL2X/CpQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/node-gyp/node_modules/path-scurry": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.11.1.tgz", + "integrity": "sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==", + "dev": true, + "license": "BlueOak-1.0.0", + "dependencies": { + "lru-cache": "^10.2.0", + "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0" + }, + "engines": { + "node": ">=16 || 14 >=14.18" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/node-gyp/node_modules/string-width": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", + "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", + "dev": true, + "license": "MIT", + "dependencies": { + "eastasianwidth": "^0.2.0", + "emoji-regex": "^9.2.2", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/node-gyp/node_modules/strip-ansi": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.2.tgz", + "integrity": "sha512-gmBGslpoQJtgnMAvOVqGZpEz9dyoKTCzy2nfz/n8aIFhN/jCE/rCmcxabB6jOOHV+0WNnylOxaxBQPSvcWklhA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^6.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" + } + }, + "node_modules/node-gyp/node_modules/unique-filename": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/unique-filename/-/unique-filename-4.0.0.tgz", + "integrity": "sha512-XSnEewXmQ+veP7xX2dS5Q4yZAvO40cBN2MWkJ7D/6sW4Dg6wYBNwM1Vrnz1FhH5AdeLIlUXRI9e28z1YZi71NQ==", + "dev": true, + "license": "ISC", + "dependencies": { + "unique-slug": "^5.0.0" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/node-gyp/node_modules/unique-slug": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/unique-slug/-/unique-slug-5.0.0.tgz", + "integrity": "sha512-9OdaqO5kwqR+1kVgHAhsp5vPNU0hnxRa26rBFNfNgM7M6pNtgzeBn3s/xbyCQL3dcjzOatcef6UUHpB/6MaETg==", + "dev": true, + "license": "ISC", + "dependencies": { + "imurmurhash": "^0.1.4" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/node-gyp/node_modules/which": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/which/-/which-5.0.0.tgz", + "integrity": "sha512-JEdGzHwwkrbWoGOlIHqQ5gtprKGOenpDHpxE9zVR1bWbOtYRyPPHMe9FaP6x61CmNaTThSkb0DAJte5jD+DmzQ==", + "dev": true, + "license": "ISC", + "dependencies": { + "isexe": "^3.1.1" + }, + "bin": { + "node-which": "bin/which.js" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/node-gyp/node_modules/wrap-ansi": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", + "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^6.1.0", + "string-width": "^5.0.1", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/node-loader": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/node-loader/-/node-loader-2.1.0.tgz", + "integrity": "sha512-OwjPkyh8+7jW8DMd/iq71uU1Sspufr/C2+c3t0p08J3CrM9ApZ4U53xuisNrDXOHyGi5OYHgtfmmh+aK9zJA6g==", + "license": "MIT", + "dependencies": { + "loader-utils": "^2.0.3" + }, + "engines": { + "node": ">= 10.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + }, + "peerDependencies": { + "webpack": "^5.0.0" + } + }, + "node_modules/node-machine-id": { + "version": "1.1.12", + "resolved": "https://registry.npmjs.org/node-machine-id/-/node-machine-id-1.1.12.tgz", + "integrity": "sha512-QNABxbrPa3qEIfrE6GOJ7BYIuignnJw7iQ2YPbc3Nla1HzRJjXzZOiikfF8m7eAMfichLt3M4VgLOetqgDmgGQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/node-preload": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/node-preload/-/node-preload-0.2.1.tgz", + "integrity": "sha512-RM5oyBy45cLEoHqCeh+MNuFAxO0vTFBLskvQbOKnEE7YTTSN4tbN8QWDIPQ6L+WvKsB/qLEGpYe2ZZ9d4W9OIQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "process-on-spawn": "^1.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/node-pty": { + "version": "1.1.0-beta27", + "resolved": "https://registry.npmjs.org/node-pty/-/node-pty-1.1.0-beta27.tgz", + "integrity": "sha512-r0nRVgunspo/cBmf/eR+ultBrclxqldaL6FhiTLEmC4VcyKJxhluRK5d8EtbHYPLt8DqPKMnCakJDxreQynpnw==", + "hasInstallScript": true, + "license": "MIT", + "dependencies": { + "node-addon-api": "^7.1.0" + } + }, + "node_modules/node-releases": { + "version": "2.0.27", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.27.tgz", + "integrity": "sha512-nmh3lCkYZ3grZvqcCH+fjmQ7X+H0OeZgP40OierEaAptX4XofMh5kwNbWh7lBduUzCcV/8kZ+NDLCwm2iorIlA==", + "license": "MIT" + }, + "node_modules/node-ssh": { + "version": "12.0.5", + "resolved": "https://registry.npmjs.org/node-ssh/-/node-ssh-12.0.5.tgz", + "integrity": "sha512-uN2GTGdBRUUKkZmcNBr9OM+xKL6zq74emnkSyb1TshBdVWegj3boue6QallQeqZzo7YGVheP5gAovUL+8hZSig==", + "license": "MIT", + "dependencies": { + "is-stream": "^2.0.0", + "make-dir": "^3.1.0", + "sb-promise-queue": "^2.1.0", + "sb-scandir": "^3.1.0", + "shell-escape": "^0.2.0", + "ssh2": "^1.5.0" + }, + "engines": { + "node": ">= 10" + } + }, + "node_modules/node-ssh/node_modules/make-dir": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", + "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", + "license": "MIT", + "dependencies": { + "semver": "^6.0.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/node-ssh/node_modules/semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/nodejs-file-downloader": { + "version": "4.13.0", + "resolved": "https://registry.npmjs.org/nodejs-file-downloader/-/nodejs-file-downloader-4.13.0.tgz", + "integrity": "sha512-nI2fKnmJWWFZF6SgMPe1iBodKhfpztLKJTtCtNYGhm/9QXmWa/Pk9Sv00qHgzEvNLe1x7hjGDRor7gcm/ChaIQ==", + "dev": true, + "license": "ISC", + "dependencies": { + "follow-redirects": "^1.15.6", + "https-proxy-agent": "^5.0.0", + "mime-types": "^2.1.27", + "sanitize-filename": "^1.6.3" + } + }, + "node_modules/nodejs-file-downloader/node_modules/https-proxy-agent": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz", + "integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==", + "dev": true, + "license": "MIT", + "dependencies": { + "agent-base": "6", + "debug": "4" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/nopt": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/nopt/-/nopt-8.1.0.tgz", + "integrity": "sha512-ieGu42u/Qsa4TFktmaKEwM6MQH0pOWnaB3htzh0JRtx84+Mebc0cbZYN5bC+6WTZ4+77xrL9Pn5m7CV6VIkV7A==", + "dev": true, + "license": "ISC", + "dependencies": { + "abbrev": "^3.0.0" + }, + "bin": { + "nopt": "bin/nopt.js" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/normalize-package-data": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-3.0.3.tgz", + "integrity": "sha512-p2W1sgqij3zMMyRC067Dg16bfzVH+w7hyegmpIvZ4JNjqtGOVAIvLmjBx3yP7YTe9vKJgkoNOPjwQGogDoMXFA==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "hosted-git-info": "^4.0.1", + "is-core-module": "^2.5.0", + "semver": "^7.3.4", + "validate-npm-package-license": "^3.0.1" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/normalize-url": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-6.1.0.tgz", + "integrity": "sha512-DlL+XwOy3NxAQ8xuC0okPgK46iuVNAK01YN7RueYBqqFeGsBjV9XmCAzAdgt+667bCl5kPh9EqKKDwnaPG1I7A==", + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/npm-bundled": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/npm-bundled/-/npm-bundled-4.0.0.tgz", + "integrity": "sha512-IxaQZDMsqfQ2Lz37VvyyEtKLe8FsRZuysmedy/N06TU1RyVppYKXrO4xIhR0F+7ubIBox6Q7nir6fQI3ej39iA==", + "dev": true, + "license": "ISC", + "dependencies": { + "npm-normalize-package-bin": "^4.0.0" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/npm-install-checks": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/npm-install-checks/-/npm-install-checks-7.1.2.tgz", + "integrity": "sha512-z9HJBCYw9Zr8BqXcllKIs5nI+QggAImbBdHphOzVYrz2CB4iQ6FzWyKmlqDZua+51nAu7FcemlbTc9VgQN5XDQ==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "semver": "^7.1.1" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/npm-normalize-package-bin": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/npm-normalize-package-bin/-/npm-normalize-package-bin-4.0.0.tgz", + "integrity": "sha512-TZKxPvItzai9kN9H/TkmCtx/ZN/hvr3vUycjlfmH0ootY9yFBzNOpiXAdIn1Iteqsvk4lQn6B5PTrt+n6h8k/w==", + "dev": true, + "license": "ISC", + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/npm-package-arg": { + "version": "13.0.1", + "resolved": "https://registry.npmjs.org/npm-package-arg/-/npm-package-arg-13.0.1.tgz", + "integrity": "sha512-6zqls5xFvJbgFjB1B2U6yITtyGBjDBORB7suI4zA4T/sZ1OmkMFlaQSNB/4K0LtXNA1t4OprAFxPisadK5O2ag==", + "dev": true, + "license": "ISC", + "dependencies": { + "hosted-git-info": "^9.0.0", + "proc-log": "^5.0.0", + "semver": "^7.3.5", + "validate-npm-package-name": "^6.0.0" + }, + "engines": { + "node": "^20.17.0 || >=22.9.0" + } + }, + "node_modules/npm-package-arg/node_modules/hosted-git-info": { + "version": "9.0.2", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-9.0.2.tgz", + "integrity": "sha512-M422h7o/BR3rmCQ8UHi7cyyMqKltdP9Uo+J2fXK+RSAY+wTcKOIRyhTuKv4qn+DJf3g+PL890AzId5KZpX+CBg==", + "dev": true, + "license": "ISC", + "dependencies": { + "lru-cache": "^11.1.0" + }, + "engines": { + "node": "^20.17.0 || >=22.9.0" + } + }, + "node_modules/npm-package-arg/node_modules/lru-cache": { + "version": "11.2.6", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.2.6.tgz", + "integrity": "sha512-ESL2CrkS/2wTPfuend7Zhkzo2u0daGJ/A2VucJOgQ/C48S/zB8MMeMHSGKYpXhIjbPxfuezITkaBH1wqv00DDQ==", + "dev": true, + "license": "BlueOak-1.0.0", + "engines": { + "node": "20 || >=22" + } + }, + "node_modules/npm-packlist": { + "version": "10.0.3", + "resolved": "https://registry.npmjs.org/npm-packlist/-/npm-packlist-10.0.3.tgz", + "integrity": "sha512-zPukTwJMOu5X5uvm0fztwS5Zxyvmk38H/LfidkOMt3gbZVCyro2cD/ETzwzVPcWZA3JOyPznfUN/nkyFiyUbxg==", + "dev": true, + "license": "ISC", + "dependencies": { + "ignore-walk": "^8.0.0", + "proc-log": "^6.0.0" + }, + "engines": { + "node": "^20.17.0 || >=22.9.0" + } + }, + "node_modules/npm-packlist/node_modules/proc-log": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/proc-log/-/proc-log-6.1.0.tgz", + "integrity": "sha512-iG+GYldRf2BQ0UDUAd6JQ/RwzaQy6mXmsk/IzlYyal4A4SNFw54MeH4/tLkF4I5WoWG9SQwuqWzS99jaFQHBuQ==", + "dev": true, + "license": "ISC", + "engines": { + "node": "^20.17.0 || >=22.9.0" + } + }, + "node_modules/npm-pick-manifest": { + "version": "11.0.3", + "resolved": "https://registry.npmjs.org/npm-pick-manifest/-/npm-pick-manifest-11.0.3.tgz", + "integrity": "sha512-buzyCfeoGY/PxKqmBqn1IUJrZnUi1VVJTdSSRPGI60tJdUhUoSQFhs0zycJokDdOznQentgrpf8LayEHyyYlqQ==", + "dev": true, + "license": "ISC", + "dependencies": { + "npm-install-checks": "^8.0.0", + "npm-normalize-package-bin": "^5.0.0", + "npm-package-arg": "^13.0.0", + "semver": "^7.3.5" + }, + "engines": { + "node": "^20.17.0 || >=22.9.0" + } + }, + "node_modules/npm-pick-manifest/node_modules/npm-install-checks": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/npm-install-checks/-/npm-install-checks-8.0.0.tgz", + "integrity": "sha512-ScAUdMpyzkbpxoNekQ3tNRdFI8SJ86wgKZSQZdUxT+bj0wVFpsEMWnkXP0twVe1gJyNF5apBWDJhhIbgrIViRA==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "semver": "^7.1.1" + }, + "engines": { + "node": "^20.17.0 || >=22.9.0" + } + }, + "node_modules/npm-pick-manifest/node_modules/npm-normalize-package-bin": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/npm-normalize-package-bin/-/npm-normalize-package-bin-5.0.0.tgz", + "integrity": "sha512-CJi3OS4JLsNMmr2u07OJlhcrPxCeOeP/4xq67aWNai6TNWWbTrlNDgl8NcFKVlcBKp18GPj+EzbNIgrBfZhsag==", + "dev": true, + "license": "ISC", + "engines": { + "node": "^20.17.0 || >=22.9.0" + } + }, + "node_modules/npm-registry-fetch": { + "version": "19.1.0", + "resolved": "https://registry.npmjs.org/npm-registry-fetch/-/npm-registry-fetch-19.1.0.tgz", + "integrity": "sha512-xyZLfs7TxPu/WKjHUs0jZOPinzBAI32kEUel6za0vH+JUTnFZ5zbHI1ZoGZRDm6oMjADtrli6FxtMlk/5ABPNw==", + "dev": true, + "license": "ISC", + "dependencies": { + "@npmcli/redact": "^3.0.0", + "jsonparse": "^1.3.1", + "make-fetch-happen": "^15.0.0", + "minipass": "^7.0.2", + "minipass-fetch": "^4.0.0", + "minizlib": "^3.0.1", + "npm-package-arg": "^13.0.0", + "proc-log": "^5.0.0" + }, + "engines": { + "node": "^20.17.0 || >=22.9.0" + } + }, + "node_modules/npm-run-all": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/npm-run-all/-/npm-run-all-1.4.0.tgz", + "integrity": "sha512-Le4iFE4VsbjPG4IMtuMN7gHu3UXIVnywPqBS2s3vHQe0JMGewfyWE8WYyqM509PjUybi4wbSqgW69mr3XGFr0w==", + "dev": true, + "license": "MIT", + "dependencies": { + "babel-polyfill": "^6.2.0", + "minimatch": "^3.0.0", + "ps-tree": "^1.0.1", + "shell-quote": "^1.4.3", + "which": "^1.2.0" + }, + "bin": { + "npm-run-all": "bin/npm-run-all.js" + } + }, + "node_modules/npm-run-all/node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "dev": true, + "license": "ISC" + }, + "node_modules/npm-run-all/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/npm-run-all/node_modules/which": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", + "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "dev": true, + "license": "ISC", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "which": "bin/which" + } + }, + "node_modules/npm-run-path": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", + "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==", + "license": "MIT", + "dependencies": { + "path-key": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/npmlog": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-6.0.2.tgz", + "integrity": "sha512-/vBvz5Jfr9dT/aFWd0FIRf+T/Q2WBsLENygUaFUqstqsycmZAP/t5BvFJTK0viFmSUxiUKTUplWy5vt+rvKIxg==", + "deprecated": "This package is no longer supported.", + "dev": true, + "license": "ISC", + "dependencies": { + "are-we-there-yet": "^3.0.0", + "console-control-strings": "^1.1.0", + "gauge": "^4.0.3", + "set-blocking": "^2.0.0" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + } + }, + "node_modules/nth-check": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-2.1.1.tgz", + "integrity": "sha512-lqjrjmaOoAnWfMmBPL+XNnynZh2+swxiX3WUE0s4yEHI6m+AwrK2UZOimIRl3X/4QctVqS8AiZjFqyOGrMXb/w==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "boolbase": "^1.0.0" + }, + "funding": { + "url": "https://github.com/fb55/nth-check?sponsor=1" + } + }, + "node_modules/nwsapi": { + "version": "2.2.23", + "resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.2.23.tgz", + "integrity": "sha512-7wfH4sLbt4M0gCDzGE6vzQBo0bfTKjU7Sfpqy/7gs1qBfYz2vEJH6vXcBKpO3+6Yu1telwd0t9HpyOoLEQQbIQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/nx": { + "version": "22.5.0", + "resolved": "https://registry.npmjs.org/nx/-/nx-22.5.0.tgz", + "integrity": "sha512-GOHhDHXvuscD28Hpj1bP38oVrCgZ/+5UWjA8R/VkpbtkfMHgRZ0uHlfKLYXQAZIsjmTq7Tr+e4QchJt0e76n0w==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "dependencies": { + "@napi-rs/wasm-runtime": "0.2.4", + "@yarnpkg/lockfile": "^1.1.0", + "@yarnpkg/parsers": "3.0.2", + "@zkochan/js-yaml": "0.0.7", + "axios": "^1.12.0", + "cli-cursor": "3.1.0", + "cli-spinners": "2.6.1", + "cliui": "^8.0.1", + "dotenv": "~16.4.5", + "dotenv-expand": "~11.0.6", + "ejs": "^3.1.7", + "enquirer": "~2.3.6", + "figures": "3.2.0", + "flat": "^5.0.2", + "front-matter": "^4.0.2", + "ignore": "^7.0.5", + "jest-diff": "^30.0.2", + "jsonc-parser": "3.2.0", + "lines-and-columns": "2.0.3", + "minimatch": "10.1.1", + "node-machine-id": "1.1.12", + "npm-run-path": "^4.0.1", + "open": "^8.4.0", + "ora": "5.3.0", + "picocolors": "^1.1.0", + "resolve.exports": "2.0.3", + "semver": "^7.6.3", + "string-width": "^4.2.3", + "tar-stream": "~2.2.0", + "tmp": "~0.2.1", + "tree-kill": "^1.2.2", + "tsconfig-paths": "^4.1.2", + "tslib": "^2.3.0", + "yaml": "^2.6.0", + "yargs": "^17.6.2", + "yargs-parser": "21.1.1" + }, + "bin": { + "nx": "bin/nx.js", + "nx-cloud": "bin/nx-cloud.js" + }, + "optionalDependencies": { + "@nx/nx-darwin-arm64": "22.5.0", + "@nx/nx-darwin-x64": "22.5.0", + "@nx/nx-freebsd-x64": "22.5.0", + "@nx/nx-linux-arm-gnueabihf": "22.5.0", + "@nx/nx-linux-arm64-gnu": "22.5.0", + "@nx/nx-linux-arm64-musl": "22.5.0", + "@nx/nx-linux-x64-gnu": "22.5.0", + "@nx/nx-linux-x64-musl": "22.5.0", + "@nx/nx-win32-arm64-msvc": "22.5.0", + "@nx/nx-win32-x64-msvc": "22.5.0" + }, + "peerDependencies": { + "@swc-node/register": "1.11.1", + "@swc/core": "1.15.8" + }, + "peerDependenciesMeta": { + "@swc-node/register": { + "optional": true + }, + "@swc/core": { + "optional": true + } + } + }, + "node_modules/nx/node_modules/define-lazy-prop": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/define-lazy-prop/-/define-lazy-prop-2.0.0.tgz", + "integrity": "sha512-Ds09qNh8yw3khSjiJjiUInaGX9xlqZDY7JVryGxdxV7NPeuqQfplOpQ66yJFZut3jLa5zOwkXw1g9EI2uKh4Og==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/nx/node_modules/ignore": { + "version": "7.0.5", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-7.0.5.tgz", + "integrity": "sha512-Hs59xBNfUIunMFgWAbGX5cq6893IbWg4KnrjbYwX3tx0ztorVgTDA6B2sxf8ejHJ4wz8BqGUMYlnzNBer5NvGg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 4" + } + }, + "node_modules/nx/node_modules/is-docker": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-2.2.1.tgz", + "integrity": "sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==", + "dev": true, + "license": "MIT", + "bin": { + "is-docker": "cli.js" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/nx/node_modules/is-wsl": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz", + "integrity": "sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-docker": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/nx/node_modules/jsonc-parser": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.2.0.tgz", + "integrity": "sha512-gfFQZrcTc8CnKXp6Y4/CBT3fTc0OVuDofpre4aEeEpSBPV5X5v4+Vmx+8snU7RLPrNHPKSgLxGo9YuQzz20o+w==", + "dev": true, + "license": "MIT" + }, + "node_modules/nx/node_modules/minimatch": { + "version": "10.1.1", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.1.1.tgz", + "integrity": "sha512-enIvLvRAFZYXJzkCYG5RKmPfrFArdLv+R+lbQ53BmIMLIry74bjKzX6iHAm8WYamJkhSSEabrWN5D97XnKObjQ==", + "dev": true, + "license": "BlueOak-1.0.0", + "dependencies": { + "@isaacs/brace-expansion": "^5.0.0" + }, + "engines": { + "node": "20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/nx/node_modules/open": { + "version": "8.4.2", + "resolved": "https://registry.npmjs.org/open/-/open-8.4.2.tgz", + "integrity": "sha512-7x81NCL719oNbsq/3mh+hVrAWmFuEYUqrq/Iw3kUzH8ReypT9QQ0BLoJS7/G9k6N81XjW4qHWtjWwe/9eLy1EQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "define-lazy-prop": "^2.0.0", + "is-docker": "^2.1.1", + "is-wsl": "^2.2.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/nx/node_modules/strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/nx/node_modules/tsconfig-paths": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-4.2.0.tgz", + "integrity": "sha512-NoZ4roiN7LnbKn9QqE1amc9DJfzvZXxF4xDavcOWt1BPkdx+m+0gJuPM+S0vCe7zTJMYUP0R8pO2XMr+Y8oLIg==", + "dev": true, + "license": "MIT", + "dependencies": { + "json5": "^2.2.2", + "minimist": "^1.2.6", + "strip-bom": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/nx/node_modules/y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=10" + } + }, + "node_modules/nx/node_modules/yargs": { + "version": "17.7.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", + "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", + "dev": true, + "license": "MIT", + "dependencies": { + "cliui": "^8.0.1", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.3", + "y18n": "^5.0.5", + "yargs-parser": "^21.1.1" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/nyc": { + "version": "17.1.0", + "resolved": "https://registry.npmjs.org/nyc/-/nyc-17.1.0.tgz", + "integrity": "sha512-U42vQ4czpKa0QdI1hu950XuNhYqgoM+ZF1HT+VuUHL9hPfDPVvNQyltmMqdE9bUHMVa+8yNbc3QKTj8zQhlVxQ==", + "dev": true, + "license": "ISC", + "dependencies": { + "@istanbuljs/load-nyc-config": "^1.0.0", + "@istanbuljs/schema": "^0.1.2", + "caching-transform": "^4.0.0", + "convert-source-map": "^1.7.0", + "decamelize": "^1.2.0", + "find-cache-dir": "^3.2.0", + "find-up": "^4.1.0", + "foreground-child": "^3.3.0", + "get-package-type": "^0.1.0", + "glob": "^7.1.6", + "istanbul-lib-coverage": "^3.0.0", + "istanbul-lib-hook": "^3.0.0", + "istanbul-lib-instrument": "^6.0.2", + "istanbul-lib-processinfo": "^2.0.2", + "istanbul-lib-report": "^3.0.0", + "istanbul-lib-source-maps": "^4.0.0", + "istanbul-reports": "^3.0.2", + "make-dir": "^3.0.0", + "node-preload": "^0.2.1", + "p-map": "^3.0.0", + "process-on-spawn": "^1.0.0", + "resolve-from": "^5.0.0", + "rimraf": "^3.0.0", + "signal-exit": "^3.0.2", + "spawn-wrap": "^2.0.0", + "test-exclude": "^6.0.0", + "yargs": "^15.0.2" + }, + "bin": { + "nyc": "bin/nyc.js" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/nyc/node_modules/find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dev": true, + "license": "MIT", + "dependencies": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/nyc/node_modules/locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-locate": "^4.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/nyc/node_modules/make-dir": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", + "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", + "dev": true, + "license": "MIT", + "dependencies": { + "semver": "^6.0.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/nyc/node_modules/p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-try": "^2.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/nyc/node_modules/p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-limit": "^2.2.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/nyc/node_modules/p-map": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/p-map/-/p-map-3.0.0.tgz", + "integrity": "sha512-d3qXVTF/s+W+CdJ5A29wywV2n8CQQYahlgz2bFiA+4eVNJbHJodPZ+/gXwPGh0bOqA+j8S+6+ckmvLGPk1QpxQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "aggregate-error": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/nyc/node_modules/resolve-from": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", + "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/nyc/node_modules/rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "deprecated": "Rimraf versions prior to v4 are no longer supported", + "dev": true, + "license": "ISC", + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/nyc/node_modules/semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/object-inspect": { + "version": "1.13.4", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz", + "integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/object-keys": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", + "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/object.assign": { + "version": "4.1.7", + "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.7.tgz", + "integrity": "sha512-nK28WOo+QIjBkDduTINE4JkF/UJJKyf2EJxvJKfblDpyg0Q+pkOHNTL0Qwy6NP6FhE/EnzV73BxxqcJaXY9anw==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.3", + "define-properties": "^1.2.1", + "es-object-atoms": "^1.0.0", + "has-symbols": "^1.1.0", + "object-keys": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/object.entries": { + "version": "1.1.9", + "resolved": "https://registry.npmjs.org/object.entries/-/object.entries-1.1.9.tgz", + "integrity": "sha512-8u/hfXFRBD1O0hPUjioLhoWFHRmt6tKA4/vZPyckBr18l1KE9uHrFaFaUi8MDRTpi4uak2goyPTSNJLXX2k2Hw==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.4", + "define-properties": "^1.2.1", + "es-object-atoms": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/object.fromentries": { + "version": "2.0.8", + "resolved": "https://registry.npmjs.org/object.fromentries/-/object.fromentries-2.0.8.tgz", + "integrity": "sha512-k6E21FzySsSK5a21KRADBd/NGneRegFO5pLHfdQLpRDETUNJueLXs3WCzyQ3tFRDYgbq3KHGXfTbi2bs8WQ6rQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.2", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/object.groupby": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/object.groupby/-/object.groupby-1.0.3.tgz", + "integrity": "sha512-+Lhy3TQTuzXI5hevh8sBGqbmurHbbIjAi0Z4S63nthVLmLxfbj4T54a4CfZrXIrt9iP4mVAPYMo/v99taj3wjQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/object.values": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.2.1.tgz", + "integrity": "sha512-gXah6aZrcUxjWg2zR2MwouP2eHlCBzdV4pygudehaKXSGW4v2AsRQUK+lwwXhii6KFZcunEnmSUoYp5CXibxtA==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.3", + "define-properties": "^1.2.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/octicons": { + "version": "7.4.0", + "resolved": "https://registry.npmjs.org/octicons/-/octicons-7.4.0.tgz", + "integrity": "sha512-j53BDX+FpJ4DQwENARbk9hHkwG/Oaq5NPUMNzYdGxRA/R5M6BbPVQEakUVMNKLzvzPue/gEEUTtSj6utFse5QQ==", + "license": "MIT", + "dependencies": { + "object-assign": "^4.1.1" + } + }, + "node_modules/ollama": { + "version": "0.5.18", + "resolved": "https://registry.npmjs.org/ollama/-/ollama-0.5.18.tgz", + "integrity": "sha512-lTFqTf9bo7Cd3hpF6CviBe/DEhewjoZYd9N/uCe7O20qYTvGqrNOFOBDj3lbZgFWHUgDv5EeyusYxsZSLS8nvg==", + "license": "MIT", + "dependencies": { + "whatwg-fetch": "^3.6.20" + } + }, + "node_modules/on-finished": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", + "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==", + "license": "MIT", + "dependencies": { + "ee-first": "1.1.1" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "license": "ISC", + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/onetime": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", + "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", + "license": "MIT", + "dependencies": { + "mimic-fn": "^2.1.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/open": { + "version": "10.2.0", + "resolved": "https://registry.npmjs.org/open/-/open-10.2.0.tgz", + "integrity": "sha512-YgBpdJHPyQ2UE5x+hlSXcnejzAvD0b22U2OuAP+8OnlJT+PjWPxtgmGqKKc+RgTM63U9gN0YzrYc71R2WT/hTA==", + "dev": true, + "license": "MIT", + "dependencies": { + "default-browser": "^5.2.1", + "define-lazy-prop": "^3.0.0", + "is-inside-container": "^1.0.0", + "wsl-utils": "^0.1.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/open-collaboration-protocol": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/open-collaboration-protocol/-/open-collaboration-protocol-0.3.0.tgz", + "integrity": "sha512-zvas595nQCGgrV4EDooFG0eGCd4sFyc+wuGqovTdyHD6DsZCYdol3SeHQgy3PZxxvPf18i1QXkPSzRc8RUmgiw==", + "license": "MIT", + "dependencies": { + "base64-js": "~1.5.1", + "fflate": "~0.8.2", + "msgpackr": "~1.11.2", + "semver": "~7.7.1", + "socket.io-client": "~4.8.1" + }, + "engines": { + "node": ">=20.10.0", + "npm": ">=10.2.3" + } + }, + "node_modules/open-collaboration-yjs": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/open-collaboration-yjs/-/open-collaboration-yjs-0.3.0.tgz", + "integrity": "sha512-XQk8ywZO5JiQo1QlRWcqR3C9RvEUuWi5FSDooIVqe/jZy9RMwQZs5ywz0a5cP8XQ7sTDhh6WjPwtG67laUP6uw==", + "license": "MIT", + "dependencies": { + "lib0": "^0.2.103", + "open-collaboration-protocol": "~0.3.0", + "vscode-languageserver-textdocument": "~1.0.12", + "y-protocols": "~1.0.6" + }, + "engines": { + "node": ">=20.10.0", + "npm": ">=10.2.3" + }, + "peerDependencies": { + "yjs": "^13.0.0" + } + }, + "node_modules/openai": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/openai/-/openai-6.21.0.tgz", + "integrity": "sha512-26dQFi76dB8IiN/WKGQOV+yKKTTlRCxQjoi2WLt0kMcH8pvxVyvfdBDkld5GTl7W1qvBpwVOtFcsqktj3fBRpA==", + "license": "Apache-2.0", + "bin": { + "openai": "bin/cli" + }, + "peerDependencies": { + "ws": "^8.18.0", + "zod": "^3.25 || ^4.0" + }, + "peerDependenciesMeta": { + "ws": { + "optional": true + }, + "zod": { + "optional": true + } + } + }, + "node_modules/opener": { + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/opener/-/opener-1.5.2.tgz", + "integrity": "sha512-ur5UIdyw5Y7yEj9wLzhqXiy6GZ3Mwx0yGI+5sMn2r0N0v3cKJvUmFH5yPP+WXh9e0xfyzyJX95D8l088DNFj7A==", + "license": "(WTFPL OR MIT)", + "bin": { + "opener": "bin/opener-bin.js" + } + }, + "node_modules/opfs-worker": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/opfs-worker/-/opfs-worker-1.3.1.tgz", + "integrity": "sha512-bQwEhkXm8ODfhoVflyKgd3exbUXfnA9kZ5wxb/o9M83y725SXawjrTaAwzJ3DKcYkEosiOkTeOphBwd/8br34w==", + "license": "MIT", + "dependencies": { + "comlink": "^4.4.2", + "minimatch": "^10.0.3" + }, + "engines": { + "node": ">=20.0.0" + }, + "peerDependencies": { + "typescript": ">=5.0.0" + } + }, + "node_modules/optionator": { + "version": "0.9.4", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz", + "integrity": "sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==", + "dev": true, + "license": "MIT", + "dependencies": { + "deep-is": "^0.1.3", + "fast-levenshtein": "^2.0.6", + "levn": "^0.4.1", + "prelude-ls": "^1.2.1", + "type-check": "^0.4.0", + "word-wrap": "^1.2.5" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/ora": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/ora/-/ora-5.3.0.tgz", + "integrity": "sha512-zAKMgGXUim0Jyd6CXK9lraBnD3H5yPGBPPOkC23a2BG6hsm4Zu6OQSjQuEtV0BHDf4aKHcUFvJiGRrFuW3MG8g==", + "license": "MIT", + "dependencies": { + "bl": "^4.0.3", + "chalk": "^4.1.0", + "cli-cursor": "^3.1.0", + "cli-spinners": "^2.5.0", + "is-interactive": "^1.0.0", + "log-symbols": "^4.0.0", + "strip-ansi": "^6.0.0", + "wcwidth": "^1.0.1" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ora/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/os-homedir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", + "integrity": "sha512-B5JU3cabzk8c67mRRd3ECmROafjYMXbuzlwtqdM8IbS8ktlTix8aFGb2bAGKrSRIlnfKwovGUUr72JUPyOb6kQ==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/own-keys": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/own-keys/-/own-keys-1.0.1.tgz", + "integrity": "sha512-qFOyK5PjiWZd+QQIh+1jhdb9LpxTF0qs7Pm8o5QHYZ0M3vKqSqzsZaEB6oWlxZ+q2sJBMI/Ktgd2N5ZwQoRHfg==", + "dev": true, + "license": "MIT", + "dependencies": { + "get-intrinsic": "^1.2.6", + "object-keys": "^1.1.1", + "safe-push-apply": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/p-cancelable": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-2.1.1.tgz", + "integrity": "sha512-BZOr3nRQHOntUjTrH8+Lh54smKHoHyur8We1V8DSMVrl5A2malOOwuJRnKRDjSnkoeBh4at6BwEnb5I7Jl31wg==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/p-debounce": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/p-debounce/-/p-debounce-2.1.0.tgz", + "integrity": "sha512-M9bMt62TTnozdZhqFgs+V7XD2MnuKCaz+7fZdlu2/T7xruI3uIE5CicQ0vx1hV7HIUYF0jF+4/R1AgfOkl74Qw==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/p-finally": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", + "integrity": "sha512-LICb2p9CB7FS+0eR1oqWnHhp0FljGLZCWBE9aix0Uye9W8LTQPwMTYVGWQWIw9RdQiDg4+epXQODwIYJtSJaow==", + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "license": "MIT", + "dependencies": { + "yocto-queue": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "license": "MIT", + "dependencies": { + "p-limit": "^3.0.2" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-map": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/p-map/-/p-map-4.0.0.tgz", + "integrity": "sha512-/bjOqmgETBYB5BoEeGVea8dmvHb2m9GLy1E9W43yeyfP6QQCZGFNa+XRceJEuDB6zqr+gKpIAmlLebMpykw/MQ==", + "license": "MIT", + "dependencies": { + "aggregate-error": "^3.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-map-series": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/p-map-series/-/p-map-series-2.1.0.tgz", + "integrity": "sha512-RpYIIK1zXSNEOdwxcfe7FdvGcs7+y5n8rifMhMNWvaxRNMPINJHF5GDeuVxWqnfrcHPSCnp7Oo5yNXHId9Av2Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/p-pipe": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-pipe/-/p-pipe-3.1.0.tgz", + "integrity": "sha512-08pj8ATpzMR0Y80x50yJHn37NF6vjrqHutASaX5LiH5npS9XPvrUmscd9MF5R4fuYRHOxQR1FfMIlF7AzwoPqw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-queue": { + "version": "6.6.2", + "resolved": "https://registry.npmjs.org/p-queue/-/p-queue-6.6.2.tgz", + "integrity": "sha512-RwFpb72c/BhQLEXIZ5K2e+AhgNVmIejGlTgiB9MzZ0e93GRvqZ7uSi0dvRF7/XIXDeNkra2fNHBxTyPDGySpjQ==", + "license": "MIT", + "dependencies": { + "eventemitter3": "^4.0.4", + "p-timeout": "^3.2.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-reduce": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/p-reduce/-/p-reduce-2.1.0.tgz", + "integrity": "sha512-2USApvnsutq8uoxZBGbbWM0JIYLiEMJ9RlaN7fAzVNb9OZN0SHjjTTfIcb667XynS5Y1VhwDJVDa72TnPzAYWw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/p-timeout": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/p-timeout/-/p-timeout-3.2.0.tgz", + "integrity": "sha512-rhIwUycgwwKcP9yTOOFK/AKsAopjjCakVqLHePO3CC6Mir1Z99xT+R63jZxAT5lFZLa2inS5h+ZS2GvR99/FBg==", + "license": "MIT", + "dependencies": { + "p-finally": "^1.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/p-waterfall": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/p-waterfall/-/p-waterfall-2.1.1.tgz", + "integrity": "sha512-RRTnDb2TBG/epPRI2yYXsimO0v3BXC8Yd3ogr1545IaqKK17VGhbWVeGGN+XfCm/08OK8635nH31c8bATkHuSw==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-reduce": "^2.0.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/pac-proxy-agent": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/pac-proxy-agent/-/pac-proxy-agent-7.2.0.tgz", + "integrity": "sha512-TEB8ESquiLMc0lV8vcd5Ql/JAKAoyzHFXaStwjkzpOpC5Yv+pIzLfHvjTSdf3vpa2bMiUQrg9i6276yn8666aA==", + "license": "MIT", + "dependencies": { + "@tootallnate/quickjs-emscripten": "^0.23.0", + "agent-base": "^7.1.2", + "debug": "^4.3.4", + "get-uri": "^6.0.1", + "http-proxy-agent": "^7.0.0", + "https-proxy-agent": "^7.0.6", + "pac-resolver": "^7.0.1", + "socks-proxy-agent": "^8.0.5" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/pac-proxy-agent/node_modules/agent-base": { + "version": "7.1.4", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.4.tgz", + "integrity": "sha512-MnA+YT8fwfJPgBx3m60MNqakm30XOkyIoH1y6huTQvC0PwZG7ki8NacLBcrPbNoo8vEZy7Jpuk7+jMO+CUovTQ==", + "license": "MIT", + "engines": { + "node": ">= 14" + } + }, + "node_modules/pac-proxy-agent/node_modules/http-proxy-agent": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-5.0.0.tgz", + "integrity": "sha512-n2hY8YdoRE1i7r6M0w9DIw5GgZN0G25P8zLCRQ8rjXtTU3vsNFBI/vWK/UIeE6g5MUUz6avwAPXmL6Fy9D/90w==", + "license": "MIT", + "dependencies": { + "@tootallnate/once": "2", + "agent-base": "6", + "debug": "4" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/pac-proxy-agent/node_modules/http-proxy-agent/node_modules/agent-base": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", + "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", + "license": "MIT", + "dependencies": { + "debug": "4" + }, + "engines": { + "node": ">= 6.0.0" + } + }, + "node_modules/pac-proxy-agent/node_modules/https-proxy-agent": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz", + "integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==", + "license": "MIT", + "dependencies": { + "agent-base": "6", + "debug": "4" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/pac-proxy-agent/node_modules/https-proxy-agent/node_modules/agent-base": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", + "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", + "license": "MIT", + "dependencies": { + "debug": "4" + }, + "engines": { + "node": ">= 6.0.0" + } + }, + "node_modules/pac-resolver": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/pac-resolver/-/pac-resolver-7.0.1.tgz", + "integrity": "sha512-5NPgf87AT2STgwa2ntRMr45jTKrYBGkVU36yT0ig/n/GMAa3oPqhZfIQ2kMEimReg0+t9kZViDVZ83qfVUlckg==", + "license": "MIT", + "dependencies": { + "degenerator": "^5.0.0", + "netmask": "^2.0.2" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/package-hash": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/package-hash/-/package-hash-4.0.0.tgz", + "integrity": "sha512-whdkPIooSu/bASggZ96BWVvZTRMOFxnyUG5PnTSGKoJE2gd5mbVNmR2Nj20QFzxYYgAXpoqC+AiXzl+UMRh7zQ==", + "dev": true, + "license": "ISC", + "dependencies": { + "graceful-fs": "^4.1.15", + "hasha": "^5.0.0", + "lodash.flattendeep": "^4.4.0", + "release-zalgo": "^1.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/package-json-from-dist": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.1.tgz", + "integrity": "sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw==", + "license": "BlueOak-1.0.0" + }, + "node_modules/packageurl-js": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/packageurl-js/-/packageurl-js-1.2.1.tgz", + "integrity": "sha512-cZ6/MzuXaoFd16/k0WnwtI298UCaDHe/XlSh85SeOKbGZ1hq0xvNbx3ILyCMyk7uFQxl6scF3Aucj6/EO9NwcA==", + "license": "MIT" + }, + "node_modules/pacote": { + "version": "21.0.1", + "resolved": "https://registry.npmjs.org/pacote/-/pacote-21.0.1.tgz", + "integrity": "sha512-LHGIUQUrcDIJUej53KJz1BPvUuHrItrR2yrnN0Kl9657cJ0ZT6QJHk9wWPBnQZhYT5KLyZWrk9jaYc2aKDu4yw==", + "dev": true, + "license": "ISC", + "dependencies": { + "@npmcli/git": "^6.0.0", + "@npmcli/installed-package-contents": "^3.0.0", + "@npmcli/package-json": "^7.0.0", + "@npmcli/promise-spawn": "^8.0.0", + "@npmcli/run-script": "^10.0.0", + "cacache": "^20.0.0", + "fs-minipass": "^3.0.0", + "minipass": "^7.0.2", + "npm-package-arg": "^13.0.0", + "npm-packlist": "^10.0.1", + "npm-pick-manifest": "^10.0.0", + "npm-registry-fetch": "^19.0.0", + "proc-log": "^5.0.0", + "promise-retry": "^2.0.1", + "sigstore": "^4.0.0", + "ssri": "^12.0.0", + "tar": "^7.4.3" + }, + "bin": { + "pacote": "bin/index.js" + }, + "engines": { + "node": "^20.17.0 || >=22.9.0" + } + }, + "node_modules/pacote/node_modules/@npmcli/git": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/@npmcli/git/-/git-6.0.3.tgz", + "integrity": "sha512-GUYESQlxZRAdhs3UhbB6pVRNUELQOHXwK9ruDkwmCv2aZ5y0SApQzUJCg02p3A7Ue2J5hxvlk1YI53c00NmRyQ==", + "dev": true, + "license": "ISC", + "dependencies": { + "@npmcli/promise-spawn": "^8.0.0", + "ini": "^5.0.0", + "lru-cache": "^10.0.1", + "npm-pick-manifest": "^10.0.0", + "proc-log": "^5.0.0", + "promise-retry": "^2.0.1", + "semver": "^7.3.5", + "which": "^5.0.0" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/pacote/node_modules/@npmcli/promise-spawn": { + "version": "8.0.3", + "resolved": "https://registry.npmjs.org/@npmcli/promise-spawn/-/promise-spawn-8.0.3.tgz", + "integrity": "sha512-Yb00SWaL4F8w+K8YGhQ55+xE4RUNdMHV43WZGsiTM92gS+lC0mGsn7I4hLug7pbao035S6bj3Y3w0cUNGLfmkg==", + "dev": true, + "license": "ISC", + "dependencies": { + "which": "^5.0.0" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/pacote/node_modules/hosted-git-info": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-8.1.0.tgz", + "integrity": "sha512-Rw/B2DNQaPBICNXEm8balFz9a6WpZrkCGpcWFpy7nCj+NyhSdqXipmfvtmWt9xGfp0wZnBxB+iVpLmQMYt47Tw==", + "dev": true, + "license": "ISC", + "dependencies": { + "lru-cache": "^10.0.1" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/pacote/node_modules/ini": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/ini/-/ini-5.0.0.tgz", + "integrity": "sha512-+N0ngpO3e7cRUWOJAS7qw0IZIVc6XPrW4MlFBdD066F2L4k1L6ker3hLqSq7iXxU5tgS4WGkIUElWn5vogAEnw==", + "dev": true, + "license": "ISC", + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/pacote/node_modules/lru-cache": { + "version": "10.4.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.4.3.tgz", + "integrity": "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==", + "dev": true, + "license": "ISC" + }, + "node_modules/pacote/node_modules/npm-pick-manifest": { + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/npm-pick-manifest/-/npm-pick-manifest-10.0.0.tgz", + "integrity": "sha512-r4fFa4FqYY8xaM7fHecQ9Z2nE9hgNfJR+EmoKv0+chvzWkBcORX3r0FpTByP+CbOVJDladMXnPQGVN8PBLGuTQ==", + "dev": true, + "license": "ISC", + "dependencies": { + "npm-install-checks": "^7.1.0", + "npm-normalize-package-bin": "^4.0.0", + "npm-package-arg": "^12.0.0", + "semver": "^7.3.5" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/pacote/node_modules/npm-pick-manifest/node_modules/npm-package-arg": { + "version": "12.0.2", + "resolved": "https://registry.npmjs.org/npm-package-arg/-/npm-package-arg-12.0.2.tgz", + "integrity": "sha512-f1NpFjNI9O4VbKMOlA5QoBq/vSQPORHcTZ2feJpFkTHJ9eQkdlmZEKSjcAhxTGInC7RlEyScT9ui67NaOsjFWA==", + "dev": true, + "license": "ISC", + "dependencies": { + "hosted-git-info": "^8.0.0", + "proc-log": "^5.0.0", + "semver": "^7.3.5", + "validate-npm-package-name": "^6.0.0" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/pacote/node_modules/which": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/which/-/which-5.0.0.tgz", + "integrity": "sha512-JEdGzHwwkrbWoGOlIHqQ5gtprKGOenpDHpxE9zVR1bWbOtYRyPPHMe9FaP6x61CmNaTThSkb0DAJte5jD+DmzQ==", + "dev": true, + "license": "ISC", + "dependencies": { + "isexe": "^3.1.1" + }, + "bin": { + "node-which": "bin/which.js" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/pako": { + "version": "0.2.9", + "resolved": "https://registry.npmjs.org/pako/-/pako-0.2.9.tgz", + "integrity": "sha512-NUcwaKxUxWrZLpDG+z/xZaCgQITkA/Dv4V/T6bw7VON6l1Xz/VnrBqrYjZQ12TamKHzITTfOEIYUj48y2KXImA==", + "license": "MIT" + }, + "node_modules/parent-module": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "license": "MIT", + "dependencies": { + "callsites": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/parse-conflict-json": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/parse-conflict-json/-/parse-conflict-json-4.0.0.tgz", + "integrity": "sha512-37CN2VtcuvKgHUs8+0b1uJeEsbGn61GRHz469C94P5xiOoqpDYJYwjg4RY9Vmz39WyZAVkR5++nbJwLMIgOCnQ==", + "dev": true, + "license": "ISC", + "dependencies": { + "json-parse-even-better-errors": "^4.0.0", + "just-diff": "^6.0.0", + "just-diff-apply": "^5.2.0" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/parse-conflict-json/node_modules/json-parse-even-better-errors": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-4.0.0.tgz", + "integrity": "sha512-lR4MXjGNgkJc7tkQ97kb2nuEMnNCyU//XYVH0MKTGcXEiSudQ5MKGKen3C5QubYy0vmq+JGitUg92uuywGEwIA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/parse-json": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz", + "integrity": "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==", + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.0.0", + "error-ex": "^1.3.1", + "json-parse-even-better-errors": "^2.3.0", + "lines-and-columns": "^1.1.6" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/parse-json/node_modules/json-parse-even-better-errors": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", + "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", + "license": "MIT" + }, + "node_modules/parse-json/node_modules/lines-and-columns": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", + "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", + "license": "MIT" + }, + "node_modules/parse-path": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/parse-path/-/parse-path-7.1.0.tgz", + "integrity": "sha512-EuCycjZtfPcjWk7KTksnJ5xPMvWGA/6i4zrLYhRG0hGvC3GPU/jGUj3Cy+ZR0v30duV3e23R95T1lE2+lsndSw==", + "dev": true, + "license": "MIT", + "dependencies": { + "protocols": "^2.0.0" + } + }, + "node_modules/parse-semver": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/parse-semver/-/parse-semver-1.1.1.tgz", + "integrity": "sha512-Eg1OuNntBMH0ojvEKSrvDSnwLmvVuUOSdylH/pSCPNMIspLlweJyIWXCE+k/5hm3cj/EBUYwmWkjhBALNP4LXQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "semver": "^5.1.0" + } + }, + "node_modules/parse-semver/node_modules/semver": { + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", + "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver" + } + }, + "node_modules/parse-url": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/parse-url/-/parse-url-8.1.0.tgz", + "integrity": "sha512-xDvOoLU5XRrcOZvnI6b8zA6n9O9ejNk/GExuz1yBuWUGn9KA97GI6HTs6u02wKara1CeVmZhH+0TZFdWScR89w==", + "dev": true, + "license": "MIT", + "dependencies": { + "parse-path": "^7.0.0" + } + }, + "node_modules/parse5": { + "version": "7.3.0", + "resolved": "https://registry.npmjs.org/parse5/-/parse5-7.3.0.tgz", + "integrity": "sha512-IInvU7fabl34qmi9gY8XOVxhYyMyuH2xUNpb2q8/Y+7552KlejkRvqvD19nMoUW/uQGGbqNpA6Tufu5FL5BZgw==", + "dev": true, + "license": "MIT", + "dependencies": { + "entities": "^6.0.0" + }, + "funding": { + "url": "https://github.com/inikulin/parse5?sponsor=1" + } + }, + "node_modules/parse5-htmlparser2-tree-adapter": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/parse5-htmlparser2-tree-adapter/-/parse5-htmlparser2-tree-adapter-7.1.0.tgz", + "integrity": "sha512-ruw5xyKs6lrpo9x9rCZqZZnIUntICjQAd0Wsmp396Ul9lN/h+ifgVV1x1gZHi8euej6wTfpqX8j+BFQxF0NS/g==", + "dev": true, + "license": "MIT", + "dependencies": { + "domhandler": "^5.0.3", + "parse5": "^7.0.0" + }, + "funding": { + "url": "https://github.com/inikulin/parse5?sponsor=1" + } + }, + "node_modules/parse5-parser-stream": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/parse5-parser-stream/-/parse5-parser-stream-7.1.2.tgz", + "integrity": "sha512-JyeQc9iwFLn5TbvvqACIF/VXG6abODeB3Fwmv/TGdLk2LfbWkaySGY72at4+Ty7EkPZj854u4CrICqNk2qIbow==", + "dev": true, + "license": "MIT", + "dependencies": { + "parse5": "^7.0.0" + }, + "funding": { + "url": "https://github.com/inikulin/parse5?sponsor=1" + } + }, + "node_modules/parse5/node_modules/entities": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/entities/-/entities-6.0.1.tgz", + "integrity": "sha512-aN97NXWF6AWBTahfVOIrB/NShkzi5H7F9r1s9mD3cDj4Ko5f2qhhVoYMibXF7GlLveb/D2ioWay8lxI97Ven3g==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=0.12" + }, + "funding": { + "url": "https://github.com/fb55/entities?sponsor=1" + } + }, + "node_modules/parseurl": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", + "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/patch-package": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/patch-package/-/patch-package-8.0.1.tgz", + "integrity": "sha512-VsKRIA8f5uqHQ7NGhwIna6Bx6D9s/1iXlA1hthBVBEbkq+t4kXD0HHt+rJhf/Z+Ci0F/HCB2hvn0qLdLG+Qxlw==", + "license": "MIT", + "dependencies": { + "@yarnpkg/lockfile": "^1.1.0", + "chalk": "^4.1.2", + "ci-info": "^3.7.0", + "cross-spawn": "^7.0.3", + "find-yarn-workspace-root": "^2.0.0", + "fs-extra": "^10.0.0", + "json-stable-stringify": "^1.0.2", + "klaw-sync": "^6.0.0", + "minimist": "^1.2.6", + "open": "^7.4.2", + "semver": "^7.5.3", + "slash": "^2.0.0", + "tmp": "^0.2.4", + "yaml": "^2.2.2" + }, + "bin": { + "patch-package": "index.js" + }, + "engines": { + "node": ">=14", + "npm": ">5" + } + }, + "node_modules/patch-package/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/patch-package/node_modules/fs-extra": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.1.0.tgz", + "integrity": "sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==", + "license": "MIT", + "dependencies": { + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/patch-package/node_modules/is-docker": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-2.2.1.tgz", + "integrity": "sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==", + "license": "MIT", + "bin": { + "is-docker": "cli.js" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/patch-package/node_modules/is-wsl": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz", + "integrity": "sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==", + "license": "MIT", + "dependencies": { + "is-docker": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/patch-package/node_modules/jsonfile": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.2.0.tgz", + "integrity": "sha512-FGuPw30AdOIUTRMC2OMRtQV+jkVj2cfPqSeWXv1NEAJ1qZ5zb1X6z1mFhbfOB/iy3ssJCD+3KuZ8r8C3uVFlAg==", + "license": "MIT", + "dependencies": { + "universalify": "^2.0.0" + }, + "optionalDependencies": { + "graceful-fs": "^4.1.6" + } + }, + "node_modules/patch-package/node_modules/open": { + "version": "7.4.2", + "resolved": "https://registry.npmjs.org/open/-/open-7.4.2.tgz", + "integrity": "sha512-MVHddDVweXZF3awtlAS+6pgKLlm/JgxZ90+/NBurBoQctVOOB/zDdVjcyPzQ+0laDGbsWgrRkflI65sQeOgT9Q==", + "license": "MIT", + "dependencies": { + "is-docker": "^2.0.0", + "is-wsl": "^2.1.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/patch-package/node_modules/slash": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-2.0.0.tgz", + "integrity": "sha512-ZYKh3Wh2z1PpEXWr0MpSBZ0V6mZHAQfYevttO11c51CaWjGTaadiKZ+wVt1PbMlDV5qhMFslpZCemhwOK7C89A==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/patch-package/node_modules/universalify": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz", + "integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==", + "license": "MIT", + "engines": { + "node": ">= 10.0.0" + } + }, + "node_modules/path-browserify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-browserify/-/path-browserify-1.0.1.tgz", + "integrity": "sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g==", + "license": "MIT" + }, + "node_modules/path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "license": "MIT" + }, + "node_modules/path-root": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/path-root/-/path-root-0.1.1.tgz", + "integrity": "sha512-QLcPegTHF11axjfojBIoDygmS2E3Lf+8+jI6wOVmNVenrKSo3mFdSGiIgdSHenczw3wPtlVMQaFVwGmM7BJdtg==", + "license": "MIT", + "dependencies": { + "path-root-regex": "^0.1.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/path-root-regex": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/path-root-regex/-/path-root-regex-0.1.2.tgz", + "integrity": "sha512-4GlJ6rZDhQZFE0DPVKh0e9jmZ5egZfxTkp7bcRDuPlJXbAwhxcl2dINPUAsjLdejqaLsCeg8axcLjIbvBjN4pQ==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/path-scurry": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-2.0.1.tgz", + "integrity": "sha512-oWyT4gICAu+kaA7QWk/jvCHWarMKNs6pXOGWKDTr7cw4IGcUbW+PeTfbaQiLGheFRpjo6O9J0PmyMfQPjH71oA==", + "dev": true, + "license": "BlueOak-1.0.0", + "dependencies": { + "lru-cache": "^11.0.0", + "minipass": "^7.1.2" + }, + "engines": { + "node": "20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/path-scurry/node_modules/lru-cache": { + "version": "11.2.6", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.2.6.tgz", + "integrity": "sha512-ESL2CrkS/2wTPfuend7Zhkzo2u0daGJ/A2VucJOgQ/C48S/zB8MMeMHSGKYpXhIjbPxfuezITkaBH1wqv00DDQ==", + "dev": true, + "license": "BlueOak-1.0.0", + "engines": { + "node": "20 || >=22" + } + }, + "node_modules/path-to-regexp": { + "version": "0.1.12", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.12.tgz", + "integrity": "sha512-RA1GjUVMnvYFxuqovrEqZoxxW5NUZqbwKtYz/Tt7nXerk0LbLblQmrsgdeOxV5SFHf0UDggjS/bSeOZwt1pmEQ==", + "license": "MIT" + }, + "node_modules/path-type": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", + "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/pathval": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.1.tgz", + "integrity": "sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==", + "license": "MIT", + "engines": { + "node": "*" + } + }, + "node_modules/pause-stream": { + "version": "0.0.11", + "resolved": "https://registry.npmjs.org/pause-stream/-/pause-stream-0.0.11.tgz", + "integrity": "sha512-e3FBlXLmN/D1S+zHzanP4E/4Z60oFAa3O051qt1pxa7DEJWKAyil6upYVXCWadEnuoqa4Pkc9oUx9zsxYeRv8A==", + "dev": true, + "license": [ + "MIT", + "Apache2" + ], + "dependencies": { + "through": "~2.3" + } + }, + "node_modules/pdfobject": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/pdfobject/-/pdfobject-2.3.1.tgz", + "integrity": "sha512-vluuGiSDmMGpOvWFGiUY4trNB8aGKLDVxIXuuGHjX0kK3bMxCANUVtLivctE7uejLBScWCnbVarKatFVvdwXaQ==", + "license": "MIT" + }, + "node_modules/pe-library": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/pe-library/-/pe-library-0.4.1.tgz", + "integrity": "sha512-eRWB5LBz7PpDu4PUlwT0PhnQfTQJlDDdPa35urV4Osrm0t0AqQFGn+UIkU3klZvwJ8KPO3VbBFsXquA6p6kqZw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12", + "npm": ">=6" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/jet2jet" + } + }, + "node_modules/peek-stream": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/peek-stream/-/peek-stream-1.1.3.tgz", + "integrity": "sha512-FhJ+YbOSBb9/rIl2ZeE/QHEsWn7PqNYt8ARAY3kIgNGOk13g9FGyIY6JIl/xB/3TFRVoTv5as0l11weORrTekA==", + "license": "MIT", + "dependencies": { + "buffer-from": "^1.0.0", + "duplexify": "^3.5.0", + "through2": "^2.0.3" + } + }, + "node_modules/pend": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz", + "integrity": "sha512-F3asv42UuXchdzt+xXqfW1OGlVBe+mxa2mqI0pg5yAHZPvFmY3Y6drSf/GQ1A86WgWEN9Kzh/WrgKa6iGcHXLg==", + "license": "MIT" + }, + "node_modules/perfect-scrollbar": { + "version": "1.5.5", + "resolved": "https://registry.npmjs.org/perfect-scrollbar/-/perfect-scrollbar-1.5.5.tgz", + "integrity": "sha512-dzalfutyP3e/FOpdlhVryN4AJ5XDVauVWxybSkLZmakFE2sS3y3pc4JnSprw8tGmHvkaG5Edr5T7LBTZ+WWU2g==", + "license": "MIT" + }, + "node_modules/picocolors": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", + "license": "ISC" + }, + "node_modules/picomatch": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.3.tgz", + "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/pify": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-5.0.0.tgz", + "integrity": "sha512-eW/gHNMlxdSP6dmG6uJip6FXN0EQBwm2clYYd8Wul42Cwu/DK8HEftzsapcNdYe2MfLiIwZqsDk2RDEsTE79hA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/pinkie": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", + "integrity": "sha512-MnUuEycAemtSaeFSjXKW/aroV7akBbY+Sv+RkyqFjgAe73F+MR0TBWKBRDkmfWq/HiFmdavfZ1G7h4SPZXaCSg==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/pinkie-promise": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz", + "integrity": "sha512-0Gni6D4UcLTbv9c57DfxDGdr41XfgUjqWZu492f0cIGr16zDU06BWP/RAEvOuo7CQ0CNjHaLlM59YJJFm3NWlw==", + "license": "MIT", + "dependencies": { + "pinkie": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/pkce-challenge": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/pkce-challenge/-/pkce-challenge-5.0.1.tgz", + "integrity": "sha512-wQ0b/W4Fr01qtpHlqSqspcj3EhBvimsdh0KlHhH8HRZnMsEa0ea2fTULOXOS9ccQr3om+GcGRk4e+isrZWV8qQ==", + "license": "MIT", + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/pkg-dir": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", + "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", + "license": "MIT", + "dependencies": { + "find-up": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/pkg-dir/node_modules/find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "license": "MIT", + "dependencies": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/pkg-dir/node_modules/locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "license": "MIT", + "dependencies": { + "p-locate": "^4.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/pkg-dir/node_modules/p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "license": "MIT", + "dependencies": { + "p-try": "^2.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/pkg-dir/node_modules/p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "license": "MIT", + "dependencies": { + "p-limit": "^2.2.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/pkg-up": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/pkg-up/-/pkg-up-3.1.0.tgz", + "integrity": "sha512-nDywThFk1i4BQK4twPQ6TA4RT8bDY96yeuCVBWL3ePARCiEKDRSrNGbFIgUJpLp+XeIR65v8ra7WuJOFUBtkMA==", + "license": "MIT", + "dependencies": { + "find-up": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/pkg-up/node_modules/find-up": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", + "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", + "license": "MIT", + "dependencies": { + "locate-path": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/pkg-up/node_modules/locate-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", + "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", + "license": "MIT", + "dependencies": { + "p-locate": "^3.0.0", + "path-exists": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/pkg-up/node_modules/p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "license": "MIT", + "dependencies": { + "p-try": "^2.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/pkg-up/node_modules/p-locate": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", + "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", + "license": "MIT", + "dependencies": { + "p-limit": "^2.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/pkg-up/node_modules/path-exists": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha512-bpC7GYwiDYQ4wYLe+FA8lhRjhQCMcQGuSgGGqDkg/QerRWw9CmGRT0iSOVRSZJ29NMLZgIzqaljJ63oaL4NIJQ==", + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/playwright": { + "version": "1.58.2", + "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.58.2.tgz", + "integrity": "sha512-vA30H8Nvkq/cPBnNw4Q8TWz1EJyqgpuinBcHET0YVJVFldr8JDNiU9LaWAE1KqSkRYazuaBhTpB5ZzShOezQ6A==", + "license": "Apache-2.0", + "dependencies": { + "playwright-core": "1.58.2" + }, + "bin": { + "playwright": "cli.js" + }, + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "fsevents": "2.3.2" + } + }, + "node_modules/playwright-core": { + "version": "1.58.2", + "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.58.2.tgz", + "integrity": "sha512-yZkEtftgwS8CsfYo7nm0KE8jsvm6i/PTgVtB8DL726wNf6H2IMsDuxCpJj59KDaxCtSnrWan2AeDqM7JBaultg==", + "license": "Apache-2.0", + "bin": { + "playwright-core": "cli.js" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/playwright/node_modules/fsevents": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/plist": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/plist/-/plist-3.1.0.tgz", + "integrity": "sha512-uysumyrvkUX0rX/dEVqt8gC3sTBzd4zoWfLeS29nb53imdaXVvLINYXTI2GNqzaMuvacNx4uJQ8+b3zXR0pkgQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@xmldom/xmldom": "^0.8.8", + "base64-js": "^1.5.1", + "xmlbuilder": "^15.1.1" + }, + "engines": { + "node": ">=10.4.0" + } + }, + "node_modules/plist/node_modules/xmlbuilder": { + "version": "15.1.1", + "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-15.1.1.tgz", + "integrity": "sha512-yMqGBqtXyeN1e3TGYvgNgDVZ3j84W4cwkOXQswghol6APgZWaff9lnbvN7MHYJOiXsvGPXtjTYJEiC9J2wv9Eg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8.0" + } + }, + "node_modules/plugin-a": { + "resolved": "sample-plugins/sample-namespace/plugin-a", + "link": true + }, + "node_modules/plugin-b": { + "resolved": "sample-plugins/sample-namespace/plugin-b", + "link": true + }, + "node_modules/plugin-gotd": { + "resolved": "sample-plugins/sample-namespace/plugin-gotd", + "link": true + }, + "node_modules/portfinder": { + "version": "1.0.38", + "resolved": "https://registry.npmjs.org/portfinder/-/portfinder-1.0.38.tgz", + "integrity": "sha512-rEwq/ZHlJIKw++XtLAO8PPuOQA/zaPJOZJ37BVuN97nLpMJeuDVLVGRwbFoBgLudgdTMP2hdRJP++H+8QOA3vg==", + "license": "MIT", + "dependencies": { + "async": "^3.2.6", + "debug": "^4.3.6" + }, + "engines": { + "node": ">= 10.12" + } + }, + "node_modules/possible-typed-array-names": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/possible-typed-array-names/-/possible-typed-array-names-1.1.0.tgz", + "integrity": "sha512-/+5VFTchJDoVj3bhoqi6UeymcD00DAwb1nJwamzPvHEszJ4FpF6SNNbUbOS8yI56qHzdV8eK0qEfOSiodkTdxg==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/postcss": { + "version": "8.5.6", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.6.tgz", + "integrity": "sha512-3Ybi1tAuwAP9s0r1UQ2J4n5Y0G05bJkpUIO0/bI9MhwmD70S5aTWbXGBwxHrelT+XM1k6dM0pk+SwNkpTRN7Pg==", + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "nanoid": "^3.3.11", + "picocolors": "^1.1.1", + "source-map-js": "^1.2.1" + }, + "engines": { + "node": "^10 || ^12 || >=14" + } + }, + "node_modules/postcss-modules-extract-imports": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/postcss-modules-extract-imports/-/postcss-modules-extract-imports-3.1.0.tgz", + "integrity": "sha512-k3kNe0aNFQDAZGbin48pL2VNidTF0w4/eASDsxlyspobzU3wZQLOGj7L9gfRe0Jo9/4uud09DsjFNH7winGv8Q==", + "license": "ISC", + "engines": { + "node": "^10 || ^12 || >= 14" + }, + "peerDependencies": { + "postcss": "^8.1.0" + } + }, + "node_modules/postcss-modules-local-by-default": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/postcss-modules-local-by-default/-/postcss-modules-local-by-default-4.2.0.tgz", + "integrity": "sha512-5kcJm/zk+GJDSfw+V/42fJ5fhjL5YbFDl8nVdXkJPLLW+Vf9mTD5Xe0wqIaDnLuL2U6cDNpTr+UQ+v2HWIBhzw==", + "license": "MIT", + "dependencies": { + "icss-utils": "^5.0.0", + "postcss-selector-parser": "^7.0.0", + "postcss-value-parser": "^4.1.0" + }, + "engines": { + "node": "^10 || ^12 || >= 14" + }, + "peerDependencies": { + "postcss": "^8.1.0" + } + }, + "node_modules/postcss-modules-scope": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/postcss-modules-scope/-/postcss-modules-scope-3.2.1.tgz", + "integrity": "sha512-m9jZstCVaqGjTAuny8MdgE88scJnCiQSlSrOWcTQgM2t32UBe+MUmFSO5t7VMSfAf/FJKImAxBav8ooCHJXCJA==", + "license": "ISC", + "dependencies": { + "postcss-selector-parser": "^7.0.0" + }, + "engines": { + "node": "^10 || ^12 || >= 14" + }, + "peerDependencies": { + "postcss": "^8.1.0" + } + }, + "node_modules/postcss-modules-values": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/postcss-modules-values/-/postcss-modules-values-4.0.0.tgz", + "integrity": "sha512-RDxHkAiEGI78gS2ofyvCsu7iycRv7oqw5xMWn9iMoR0N/7mf9D50ecQqUo5BZ9Zh2vH4bCUR/ktCqbB9m8vJjQ==", + "license": "ISC", + "dependencies": { + "icss-utils": "^5.0.0" + }, + "engines": { + "node": "^10 || ^12 || >= 14" + }, + "peerDependencies": { + "postcss": "^8.1.0" + } + }, + "node_modules/postcss-selector-parser": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-7.1.1.tgz", + "integrity": "sha512-orRsuYpJVw8LdAwqqLykBj9ecS5/cRHlI5+nvTo8LcCKmzDmqVORXtOIYEEQuL9D4BxtA1lm5isAqzQZCoQ6Eg==", + "license": "MIT", + "dependencies": { + "cssesc": "^3.0.0", + "util-deprecate": "^1.0.2" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/postcss-value-parser": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-4.2.0.tgz", + "integrity": "sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ==", + "license": "MIT" + }, + "node_modules/prebuild-install": { + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/prebuild-install/-/prebuild-install-7.1.3.tgz", + "integrity": "sha512-8Mf2cbV7x1cXPUILADGI3wuhfqWvtiLA1iclTDbFRZkgRQS0NqsPZphna9V+HyTEadheuPmjaJMsbzKQFOzLug==", + "license": "MIT", + "dependencies": { + "detect-libc": "^2.0.0", + "expand-template": "^2.0.3", + "github-from-package": "0.0.0", + "minimist": "^1.2.3", + "mkdirp-classic": "^0.5.3", + "napi-build-utils": "^2.0.0", + "node-abi": "^3.3.0", + "pump": "^3.0.0", + "rc": "^1.2.7", + "simple-get": "^4.0.0", + "tar-fs": "^2.0.0", + "tunnel-agent": "^0.6.0" + }, + "bin": { + "prebuild-install": "bin.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/prebuild-install/node_modules/chownr": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz", + "integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==", + "license": "ISC" + }, + "node_modules/prebuild-install/node_modules/node-abi": { + "version": "3.87.0", + "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.87.0.tgz", + "integrity": "sha512-+CGM1L1CgmtheLcBuleyYOn7NWPVu0s0EJH2C4puxgEZb9h8QpR9G2dBfZJOAUhi7VQxuBPMd0hiISWcTyiYyQ==", + "license": "MIT", + "dependencies": { + "semver": "^7.3.5" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/prebuild-install/node_modules/tar-fs": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-2.1.4.tgz", + "integrity": "sha512-mDAjwmZdh7LTT6pNleZ05Yt65HC3E+NiQzl672vQG38jIrehtJk/J3mNwIg+vShQPcLF/LV7CMnDW6vjj6sfYQ==", + "license": "MIT", + "dependencies": { + "chownr": "^1.1.1", + "mkdirp-classic": "^0.5.2", + "pump": "^3.0.0", + "tar-stream": "^2.1.4" + } + }, + "node_modules/prelude-ls": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", + "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/pretty-format": { + "version": "30.2.0", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-30.2.0.tgz", + "integrity": "sha512-9uBdv/B4EefsuAL+pWqueZyZS2Ba+LxfFeQ9DN14HU4bN8bhaxKdkpjpB6fs9+pSjIBu+FXQHImEg8j/Lw0+vA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/schemas": "30.0.5", + "ansi-styles": "^5.2.0", + "react-is": "^18.3.1" + }, + "engines": { + "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" + } + }, + "node_modules/pretty-format/node_modules/ansi-styles": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", + "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/private": { + "version": "0.1.8", + "resolved": "https://registry.npmjs.org/private/-/private-0.1.8.tgz", + "integrity": "sha512-VvivMrbvd2nKkiG38qjULzlc+4Vx4wm/whI9pQD35YrARNnhxeiRktSOhSukRLFNlzg6Br/cJPet5J/u19r/mg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/proc-log": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/proc-log/-/proc-log-5.0.0.tgz", + "integrity": "sha512-Azwzvl90HaF0aCz1JrDdXQykFakSSNPaPoiZ9fm5qJIMHioDZEi7OAdRwSm6rSoPtY3Qutnm3L7ogmg3dc+wbQ==", + "dev": true, + "license": "ISC", + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/process-nextick-args": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", + "license": "MIT" + }, + "node_modules/process-on-spawn": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/process-on-spawn/-/process-on-spawn-1.1.0.tgz", + "integrity": "sha512-JOnOPQ/8TZgjs1JIH/m9ni7FfimjNa/PRx7y/Wb5qdItsnhO0jE4AT7fC0HjC28DUQWDr50dwSYZLdRMlqDq3Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "fromentries": "^1.2.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/proggy": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/proggy/-/proggy-3.0.0.tgz", + "integrity": "sha512-QE8RApCM3IaRRxVzxrjbgNMpQEX6Wu0p0KBeoSiSEw5/bsGwZHsshF4LCxH2jp/r6BU+bqA3LrMDEYNfJnpD8Q==", + "dev": true, + "license": "ISC", + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/progress": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", + "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", + "license": "MIT", + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/prom-client": { + "version": "10.2.3", + "resolved": "https://registry.npmjs.org/prom-client/-/prom-client-10.2.3.tgz", + "integrity": "sha512-Xboq5+TdUwuQtSSDRZRNnb5NprINlgQN999VqUjZxnLKydUNLeIPx6Eiahg6oJua3XBg2TGnh5Cth1s4I6+r7g==", + "license": "Apache-2.0", + "dependencies": { + "tdigest": "^0.1.1" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/promise-all-reject-late": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/promise-all-reject-late/-/promise-all-reject-late-1.0.1.tgz", + "integrity": "sha512-vuf0Lf0lOxyQREH7GDIOUMLS7kz+gs8i6B+Yi8dC68a2sychGrHTJYghMBD6k7eUcH0H5P73EckCA48xijWqXw==", + "dev": true, + "license": "ISC", + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/promise-call-limit": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/promise-call-limit/-/promise-call-limit-3.0.2.tgz", + "integrity": "sha512-mRPQO2T1QQVw11E7+UdCJu7S61eJVWknzml9sC1heAdj1jxl0fWMBypIt9ZOcLFf8FkG995ZD7RnVk7HH72fZw==", + "dev": true, + "license": "ISC", + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/promise-inflight": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/promise-inflight/-/promise-inflight-1.0.1.tgz", + "integrity": "sha512-6zWPyEOFaQBJYcGMHBKTKJ3u6TBsnMFOIZSa6ce1e/ZrrsOlnHRHbabMjLiBYKp+n44X9eUI6VUPaukCXHuG4g==", + "license": "ISC" + }, + "node_modules/promise-retry": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/promise-retry/-/promise-retry-2.0.1.tgz", + "integrity": "sha512-y+WKFlBR8BGXnsNlIHFGPZmyDf3DFMoLhaflAnyZgV6rG6xu+JwesTo2Q9R6XwYmtmwAFCkAk3e35jEdoeh/3g==", + "license": "MIT", + "dependencies": { + "err-code": "^2.0.2", + "retry": "^0.12.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/promzard": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/promzard/-/promzard-2.0.0.tgz", + "integrity": "sha512-Ncd0vyS2eXGOjchIRg6PVCYKetJYrW1BSbbIo+bKdig61TB6nH2RQNF2uP+qMpsI73L/jURLWojcw8JNIKZ3gg==", + "dev": true, + "license": "ISC", + "dependencies": { + "read": "^4.0.0" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/promzard/node_modules/read": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/read/-/read-4.1.0.tgz", + "integrity": "sha512-uRfX6K+f+R8OOrYScaM3ixPY4erg69f8DN6pgTvMcA9iRc8iDhwrA4m3Yu8YYKsXJgVvum+m8PkRboZwwuLzYA==", + "dev": true, + "license": "ISC", + "dependencies": { + "mute-stream": "^2.0.0" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/prop-types": { + "version": "15.8.1", + "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz", + "integrity": "sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==", + "license": "MIT", + "dependencies": { + "loose-envify": "^1.4.0", + "object-assign": "^4.1.1", + "react-is": "^16.13.1" + } + }, + "node_modules/prop-types/node_modules/react-is": { + "version": "16.13.1", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", + "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==", + "license": "MIT" + }, + "node_modules/properties": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/properties/-/properties-1.2.1.tgz", + "integrity": "sha512-qYNxyMj1JeW54i/EWEFsM1cVwxJbtgPp8+0Wg9XjNaK6VE/c4oRi6PNu5p7w1mNXEIQIjV5Wwn8v8Gz82/QzdQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10" + } + }, + "node_modules/protobufjs": { + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-7.5.4.tgz", + "integrity": "sha512-CvexbZtbov6jW2eXAvLukXjXUW1TzFaivC46BpWc/3BpcCysb5Vffu+B3XHMm8lVEuy2Mm4XGex8hBSg1yapPg==", + "hasInstallScript": true, + "license": "BSD-3-Clause", + "dependencies": { + "@protobufjs/aspromise": "^1.1.2", + "@protobufjs/base64": "^1.1.2", + "@protobufjs/codegen": "^2.0.4", + "@protobufjs/eventemitter": "^1.1.0", + "@protobufjs/fetch": "^1.1.0", + "@protobufjs/float": "^1.0.2", + "@protobufjs/inquire": "^1.1.0", + "@protobufjs/path": "^1.1.2", + "@protobufjs/pool": "^1.1.0", + "@protobufjs/utf8": "^1.1.0", + "@types/node": ">=13.7.0", + "long": "^5.0.0" + }, + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/protocols": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/protocols/-/protocols-2.0.2.tgz", + "integrity": "sha512-hHVTzba3wboROl0/aWRRG9dMytgH6ow//STBZh43l/wQgmMhYhOFi0EHWAPtoCz9IAUymsyP0TSBHkhgMEGNnQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/proxy-addr": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", + "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==", + "license": "MIT", + "dependencies": { + "forwarded": "0.2.0", + "ipaddr.js": "1.9.1" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/proxy-agent": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/proxy-agent/-/proxy-agent-6.5.0.tgz", + "integrity": "sha512-TmatMXdr2KlRiA2CyDu8GqR8EjahTG3aY3nXjdzFyoZbmB8hrBsTyMezhULIXKnC0jpfjlmiZ3+EaCzoInSu/A==", + "license": "MIT", + "dependencies": { + "agent-base": "^7.1.2", + "debug": "^4.3.4", + "http-proxy-agent": "^7.0.1", + "https-proxy-agent": "^7.0.6", + "lru-cache": "^7.14.1", + "pac-proxy-agent": "^7.1.0", + "proxy-from-env": "^1.1.0", + "socks-proxy-agent": "^8.0.5" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/proxy-agent/node_modules/agent-base": { + "version": "7.1.4", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.4.tgz", + "integrity": "sha512-MnA+YT8fwfJPgBx3m60MNqakm30XOkyIoH1y6huTQvC0PwZG7ki8NacLBcrPbNoo8vEZy7Jpuk7+jMO+CUovTQ==", + "license": "MIT", + "engines": { + "node": ">= 14" + } + }, + "node_modules/proxy-agent/node_modules/http-proxy-agent": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-5.0.0.tgz", + "integrity": "sha512-n2hY8YdoRE1i7r6M0w9DIw5GgZN0G25P8zLCRQ8rjXtTU3vsNFBI/vWK/UIeE6g5MUUz6avwAPXmL6Fy9D/90w==", + "license": "MIT", + "dependencies": { + "@tootallnate/once": "2", + "agent-base": "6", + "debug": "4" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/proxy-agent/node_modules/http-proxy-agent/node_modules/agent-base": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", + "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", + "license": "MIT", + "dependencies": { + "debug": "4" + }, + "engines": { + "node": ">= 6.0.0" + } + }, + "node_modules/proxy-agent/node_modules/https-proxy-agent": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz", + "integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==", + "license": "MIT", + "dependencies": { + "agent-base": "6", + "debug": "4" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/proxy-agent/node_modules/https-proxy-agent/node_modules/agent-base": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", + "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", + "license": "MIT", + "dependencies": { + "debug": "4" + }, + "engines": { + "node": ">= 6.0.0" + } + }, + "node_modules/proxy-agent/node_modules/lru-cache": { + "version": "7.18.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.18.3.tgz", + "integrity": "sha512-jumlc0BIUrS3qJGgIkWZsyfAM7NCWiBcCDhnd+3NNM5KbBmLTgHVfWBcg6W+rLUsIpzpERPsvwUP7CckAQSOoA==", + "license": "ISC", + "engines": { + "node": ">=12" + } + }, + "node_modules/proxy-from-env": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==", + "license": "MIT" + }, + "node_modules/prr": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/prr/-/prr-1.0.1.tgz", + "integrity": "sha512-yPw4Sng1gWghHQWj0B3ZggWUm4qVbPwPFcRG8KyxiU7J2OHFSoEHKS+EZ3fv5l1t9CyCiop6l/ZYeWbrgoQejw==", + "license": "MIT", + "optional": true + }, + "node_modules/ps-tree": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/ps-tree/-/ps-tree-1.2.0.tgz", + "integrity": "sha512-0VnamPPYHl4uaU/nSFeZZpR21QAWRz+sRv4iW9+v/GS/J5U5iZB5BNN6J0RMoOvdx2gWM2+ZFMIm58q24e4UYA==", + "dev": true, + "license": "MIT", + "dependencies": { + "event-stream": "=3.3.4" + }, + "bin": { + "ps-tree": "bin/ps-tree.js" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/psl": { + "version": "1.15.0", + "resolved": "https://registry.npmjs.org/psl/-/psl-1.15.0.tgz", + "integrity": "sha512-JZd3gMVBAVQkSs6HdNZo9Sdo0LNcQeMNP3CozBJb3JYC/QUYZTnKxP+f8oWRX4rHP5EurWxqAHTSwUCjlNKa1w==", + "dev": true, + "license": "MIT", + "dependencies": { + "punycode": "^2.3.1" + }, + "funding": { + "url": "https://github.com/sponsors/lupomontero" + } + }, + "node_modules/pump": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.3.tgz", + "integrity": "sha512-todwxLMY7/heScKmntwQG8CXVkWUOdYxIvY2s0VWAAMh/nd8SoYiRaKjlr7+iCs984f2P8zvrfWcDDYVb73NfA==", + "license": "MIT", + "dependencies": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, + "node_modules/pumpify": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/pumpify/-/pumpify-1.5.1.tgz", + "integrity": "sha512-oClZI37HvuUJJxSKKrC17bZ9Cu0ZYhEAGPsPUy9KlMUmv9dKX2o77RUmq7f3XjIxbwyGwYzbzQ1L2Ks8sIradQ==", + "license": "MIT", + "dependencies": { + "duplexify": "^3.6.0", + "inherits": "^2.0.3", + "pump": "^2.0.0" + } + }, + "node_modules/pumpify/node_modules/pump": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/pump/-/pump-2.0.1.tgz", + "integrity": "sha512-ruPMNRkN3MHP1cWJc9OWr+T/xDP0jhXYCLfJcBuX54hhfIBnaQmAUMfDcG4DM5UMWByBbJY69QSphm3jtDKIkA==", + "license": "MIT", + "dependencies": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, + "node_modules/punycode": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", + "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/punycode.js": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/punycode.js/-/punycode.js-2.3.1.tgz", + "integrity": "sha512-uxFIHU0YlHYhDQtV4R9J6a52SLx28BCjT+4ieh7IGbgwVJWO+km431c4yRlREUAsAmt/uMjQUyQHNEPf0M39CA==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/puppeteer": { + "version": "23.1.0", + "resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-23.1.0.tgz", + "integrity": "sha512-m+CyicDlGN1AVUeOsCa6/+KQydJzxfsPowL7fQy+VGNeaWafB0m8G5aGfXdfZztKMxzCsdz7KNNzbJPeG9wwFw==", + "deprecated": "< 24.15.0 is no longer supported", + "hasInstallScript": true, + "license": "Apache-2.0", + "dependencies": { + "@puppeteer/browsers": "2.3.1", + "chromium-bidi": "0.6.4", + "cosmiconfig": "^9.0.0", + "devtools-protocol": "0.0.1312386", + "puppeteer-core": "23.1.0", + "typed-query-selector": "^2.12.0" + }, + "bin": { + "puppeteer": "lib/cjs/puppeteer/node/cli.js" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/puppeteer-core": { + "version": "23.1.0", + "resolved": "https://registry.npmjs.org/puppeteer-core/-/puppeteer-core-23.1.0.tgz", + "integrity": "sha512-SvAsu+xnLN2FMXE/59bp3s3WXp8ewqUGzVV4AQtml/2xmsciZnU/bXcCW+eETHPWQ6Agg2vTI7QzWXPpEARK2g==", + "license": "Apache-2.0", + "dependencies": { + "@puppeteer/browsers": "2.3.1", + "chromium-bidi": "0.6.4", + "debug": "^4.3.6", + "devtools-protocol": "0.0.1312386", + "typed-query-selector": "^2.12.0", + "ws": "^8.18.0" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/puppeteer-to-istanbul": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/puppeteer-to-istanbul/-/puppeteer-to-istanbul-1.4.0.tgz", + "integrity": "sha512-dzW8u/PMqMZppvoXCFod8IkCTI2JL0yP2YUBbaALnX+iJJ6gqjk77fIoK9MqnMqRZAcoa81GLFfZExakWg/Q4Q==", + "license": "ISC", + "dependencies": { + "clone": "^2.1.2", + "mkdirp": "^1.0.4", + "v8-to-istanbul": "^1.2.1", + "yargs": "^15.3.1" + } + }, + "node_modules/puppeteer-to-istanbul/node_modules/mkdirp": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", + "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", + "license": "MIT", + "bin": { + "mkdirp": "bin/cmd.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/qs": { + "version": "6.14.1", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.14.1.tgz", + "integrity": "sha512-4EK3+xJl8Ts67nLYNwqw/dsFVnCf+qR7RgXSK9jEEm9unao3njwMDdmsdvoKBKHzxd7tCYz5e5M+SnMjdtXGQQ==", + "license": "BSD-3-Clause", + "dependencies": { + "side-channel": "^1.1.0" + }, + "engines": { + "node": ">=0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/querystringify": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz", + "integrity": "sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/quick-lru": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-4.0.1.tgz", + "integrity": "sha512-ARhCpm70fzdcvNQfPoy49IaanKkTlRWF2JMzqhcJbhSFRZv7nPTvZJdcY7301IPmvW+/p0RgIWnQDLJxifsQ7g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/randombytes": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", + "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", + "license": "MIT", + "dependencies": { + "safe-buffer": "^5.1.0" + } + }, + "node_modules/range-parser": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", + "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/raw-body": { + "version": "2.5.3", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.3.tgz", + "integrity": "sha512-s4VSOf6yN0rvbRZGxs8Om5CWj6seneMwK3oDb4lWDH0UPhWcxwOWw5+qk24bxq87szX1ydrwylIOp2uG1ojUpA==", + "license": "MIT", + "dependencies": { + "bytes": "~3.1.2", + "http-errors": "~2.0.1", + "iconv-lite": "~0.4.24", + "unpipe": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/raw-body/node_modules/iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "license": "MIT", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/rc": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz", + "integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==", + "license": "(BSD-2-Clause OR MIT OR Apache-2.0)", + "dependencies": { + "deep-extend": "^0.6.0", + "ini": "~1.3.0", + "minimist": "^1.2.0", + "strip-json-comments": "~2.0.1" + }, + "bin": { + "rc": "cli.js" + } + }, + "node_modules/rc/node_modules/strip-json-comments": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", + "integrity": "sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/react": { + "version": "18.3.1", + "resolved": "https://registry.npmjs.org/react/-/react-18.3.1.tgz", + "integrity": "sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ==", + "license": "MIT", + "dependencies": { + "loose-envify": "^1.1.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/react-dom": { + "version": "18.3.1", + "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.3.1.tgz", + "integrity": "sha512-5m4nQKp+rZRb09LNH59GM4BxTh9251/ylbKIbpe7TpGxfJ+9kv6BLkLBXIjjspbgbnIBNqlI23tRnTWT0snUIw==", + "license": "MIT", + "dependencies": { + "loose-envify": "^1.1.0", + "scheduler": "^0.23.2" + }, + "peerDependencies": { + "react": "^18.3.1" + } + }, + "node_modules/react-is": { + "version": "18.3.1", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.3.1.tgz", + "integrity": "sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg==", + "dev": true, + "license": "MIT" + }, + "node_modules/react-perfect-scrollbar": { + "version": "1.5.8", + "resolved": "https://registry.npmjs.org/react-perfect-scrollbar/-/react-perfect-scrollbar-1.5.8.tgz", + "integrity": "sha512-bQ46m70gp/HJtiBOF3gRzBISSZn8FFGNxznTdmTG8AAwpxG1bJCyn7shrgjEvGSQ5FJEafVEiosY+ccER11OSA==", + "license": "MIT", + "dependencies": { + "perfect-scrollbar": "^1.5.0", + "prop-types": "^15.6.1" + }, + "peerDependencies": { + "react": ">=16.3.3", + "react-dom": ">=16.3.3" + } + }, + "node_modules/react-textarea-autosize": { + "version": "8.5.9", + "resolved": "https://registry.npmjs.org/react-textarea-autosize/-/react-textarea-autosize-8.5.9.tgz", + "integrity": "sha512-U1DGlIQN5AwgjTyOEnI1oCcMuEr1pv1qOtklB2l4nyMGbHzWrI0eFsYK0zos2YWqAolJyG0IWJaqWmWj5ETh0A==", + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.20.13", + "use-composed-ref": "^1.3.0", + "use-latest": "^1.2.1" + }, + "engines": { + "node": ">=10" + }, + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0" + } + }, + "node_modules/react-tooltip": { + "version": "4.5.1", + "resolved": "https://registry.npmjs.org/react-tooltip/-/react-tooltip-4.5.1.tgz", + "integrity": "sha512-Zo+CSFUGXar1uV+bgXFFDe7VeS2iByeIp5rTgTcc2HqtuOS5D76QapejNNfx320MCY91TlhTQat36KGFTqgcvw==", + "license": "MIT", + "dependencies": { + "prop-types": "^15.8.1", + "uuid": "^7.0.3" + }, + "engines": { + "npm": ">=6.13" + }, + "peerDependencies": { + "react": ">=16.0.0", + "react-dom": ">=16.0.0" + } + }, + "node_modules/react-tooltip/node_modules/uuid": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-7.0.3.tgz", + "integrity": "sha512-DPSke0pXhTZgoF/d+WSt2QaKMCFSfx7QegxEWT+JOuHF5aWrKEn0G+ztjuJg/gG8/ItK+rbPCD/yNv8yyih6Cg==", + "license": "MIT", + "bin": { + "uuid": "dist/bin/uuid" + } + }, + "node_modules/react-virtuoso": { + "version": "2.19.1", + "resolved": "https://registry.npmjs.org/react-virtuoso/-/react-virtuoso-2.19.1.tgz", + "integrity": "sha512-zF6MAwujNGy2nJWCx/Df92ay/RnV2Kj4glUZfdyadI4suAn0kAZHB1BeI7yPFVp2iSccLzFlszhakWyr+fJ4Dw==", + "license": "MIT", + "dependencies": { + "@virtuoso.dev/react-urx": "^0.2.12", + "@virtuoso.dev/urx": "^0.2.12" + }, + "engines": { + "node": ">=10" + }, + "peerDependencies": { + "react": ">=16 || >=17 || >= 18", + "react-dom": ">=16 || >=17 || >= 18" + } + }, + "node_modules/read": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/read/-/read-1.0.7.tgz", + "integrity": "sha512-rSOKNYUmaxy0om1BNjMN4ezNT6VKK+2xF4GBhc81mkH7L60i6dp8qPYrkndNLT3QPphoII3maL9PVC9XmhHwVQ==", + "dev": true, + "license": "ISC", + "dependencies": { + "mute-stream": "~0.0.4" + }, + "engines": { + "node": ">=0.8" + } + }, + "node_modules/read-binary-file-arch": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/read-binary-file-arch/-/read-binary-file-arch-1.0.6.tgz", + "integrity": "sha512-BNg9EN3DD3GsDXX7Aa8O4p92sryjkmzYYgmgTAc6CA4uGLEDzFfxOxugu21akOxpcXHiEgsYkC6nPsQvLLLmEg==", + "license": "MIT", + "dependencies": { + "debug": "^4.3.4" + }, + "bin": { + "read-binary-file-arch": "cli.js" + } + }, + "node_modules/read-cmd-shim": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/read-cmd-shim/-/read-cmd-shim-4.0.0.tgz", + "integrity": "sha512-yILWifhaSEEytfXI76kB9xEEiG1AiozaCJZ83A87ytjRiN+jVibXjedjCRNjoZviinhG+4UkalO3mWTd8u5O0Q==", + "dev": true, + "license": "ISC", + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/read-pkg": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-3.0.0.tgz", + "integrity": "sha512-BLq/cCO9two+lBgiTYNqD6GdtK8s4NpaWrl6/rCO9w0TUS8oJl7cmToOZfRYllKTISY6nt1U7jQ53brmKqY6BA==", + "dev": true, + "license": "MIT", + "dependencies": { + "load-json-file": "^4.0.0", + "normalize-package-data": "^2.3.2", + "path-type": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/read-pkg-up": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-3.0.0.tgz", + "integrity": "sha512-YFzFrVvpC6frF1sz8psoHDBGF7fLPc+llq/8NB43oagqWkx8ar5zYtsTORtOjw9W2RHLpWP+zTWwBvf1bCmcSw==", + "dev": true, + "license": "MIT", + "dependencies": { + "find-up": "^2.0.0", + "read-pkg": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/read-pkg-up/node_modules/find-up": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", + "integrity": "sha512-NWzkk0jSJtTt08+FBFMvXoeZnOJD+jTtsRmBYbAIzJdX6l7dLgR7CTubCM5/eDdPUBvLCeVasP1brfVR/9/EZQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "locate-path": "^2.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/read-pkg-up/node_modules/locate-path": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", + "integrity": "sha512-NCI2kiDkyR7VeEKm27Kda/iQHyKJe1Bu0FlTbYp3CqJu+9IFe9bLyAjMxf5ZDDbEg+iMPzB5zYyUTSm8wVTKmA==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-locate": "^2.0.0", + "path-exists": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/read-pkg-up/node_modules/p-limit": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", + "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-try": "^1.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/read-pkg-up/node_modules/p-locate": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", + "integrity": "sha512-nQja7m7gSKuewoVRen45CtVfODR3crN3goVQ0DDZ9N3yHxgpkuBhZqsaiotSQRrADUrne346peY7kT3TSACykg==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-limit": "^1.1.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/read-pkg-up/node_modules/p-try": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz", + "integrity": "sha512-U1etNYuMJoIz3ZXSrrySFjsXQTWOx2/jdi86L+2pRvph/qMKL6sbcCYdH23fqsbm8TH2Gn0OybpT4eSFlCVHww==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/read-pkg-up/node_modules/path-exists": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha512-bpC7GYwiDYQ4wYLe+FA8lhRjhQCMcQGuSgGGqDkg/QerRWw9CmGRT0iSOVRSZJ29NMLZgIzqaljJ63oaL4NIJQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/read-pkg/node_modules/hosted-git-info": { + "version": "2.8.9", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.9.tgz", + "integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==", + "dev": true, + "license": "ISC" + }, + "node_modules/read-pkg/node_modules/load-json-file": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-4.0.0.tgz", + "integrity": "sha512-Kx8hMakjX03tiGTLAIdJ+lL0htKnXjEZN6hk/tozf/WOuYGdZBJrZ+rCJRbVCugsjB3jMLn9746NsQIf5VjBMw==", + "dev": true, + "license": "MIT", + "dependencies": { + "graceful-fs": "^4.1.2", + "parse-json": "^4.0.0", + "pify": "^3.0.0", + "strip-bom": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/read-pkg/node_modules/normalize-package-data": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", + "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "hosted-git-info": "^2.1.4", + "resolve": "^1.10.0", + "semver": "2 || 3 || 4 || 5", + "validate-npm-package-license": "^3.0.1" + } + }, + "node_modules/read-pkg/node_modules/parse-json": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz", + "integrity": "sha512-aOIos8bujGN93/8Ox/jPLh7RwVnPEysynVFE+fQZyg6jKELEHwzgKdLRFHUgXJL6kylijVSBC4BvN9OmsB48Rw==", + "dev": true, + "license": "MIT", + "dependencies": { + "error-ex": "^1.3.1", + "json-parse-better-errors": "^1.0.1" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/read-pkg/node_modules/path-type": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-3.0.0.tgz", + "integrity": "sha512-T2ZUsdZFHgA3u4e5PfPbjd7HDDpxPnQb5jN0SrDsjNSuVXHJqtwTnWqG0B1jZrgmJ/7lj1EmVIByWt1gxGkWvg==", + "dev": true, + "license": "MIT", + "dependencies": { + "pify": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/read-pkg/node_modules/pify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", + "integrity": "sha512-C3FsVNH1udSEX48gGX1xfvwTWfsYWj5U+8/uK15BGzIGrKoUpghX8hWZwa/OFnakBiiVNmBvemTJR5mcy7iPcg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/read-pkg/node_modules/semver": { + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", + "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver" + } + }, + "node_modules/read-pkg/node_modules/strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/read/node_modules/mute-stream": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.8.tgz", + "integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==", + "dev": true, + "license": "ISC" + }, + "node_modules/readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "license": "MIT", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/readdir-glob": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/readdir-glob/-/readdir-glob-1.1.3.tgz", + "integrity": "sha512-v05I2k7xN8zXvPD9N+z/uhXPaj0sUFCe2rcWZIpBsqxfP7xXFQ0tipAd/wjj1YxWyWtUS5IDJpOG82JKt2EAVA==", + "license": "Apache-2.0", + "dependencies": { + "minimatch": "^5.1.0" + } + }, + "node_modules/readdir-glob/node_modules/brace-expansion": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz", + "integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==", + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/readdir-glob/node_modules/minimatch": { + "version": "5.1.6", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", + "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==", + "license": "ISC", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "license": "MIT", + "dependencies": { + "picomatch": "^2.2.1" + }, + "engines": { + "node": ">=8.10.0" + } + }, + "node_modules/readdirp/node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "license": "MIT", + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/recast": { + "version": "0.11.23", + "resolved": "https://registry.npmjs.org/recast/-/recast-0.11.23.tgz", + "integrity": "sha512-+nixG+3NugceyR8O1bLU45qs84JgI3+8EauyRZafLgC9XbdAOIVgwV1Pe2da0YzGo62KzWoZwUpVEQf6qNAXWA==", + "license": "MIT", + "dependencies": { + "ast-types": "0.9.6", + "esprima": "~3.1.0", + "private": "~0.1.5", + "source-map": "~0.5.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/recast/node_modules/ast-types": { + "version": "0.9.6", + "resolved": "https://registry.npmjs.org/ast-types/-/ast-types-0.9.6.tgz", + "integrity": "sha512-qEdtR2UH78yyHX/AUNfXmJTlM48XoFZKBdwi1nzkI1mJL21cmbu0cvjxjpkXJ5NENMq42H+hNs8VLJcqXLerBQ==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/recast/node_modules/esprima": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-3.1.3.tgz", + "integrity": "sha512-AWwVMNxwhN8+NIPQzAQZCm7RkLC4RbM3B1OobMuyp3i+w73X57KCKaVIxaRZb+DYCojq7rspo+fmuQfAboyhFg==", + "license": "BSD-2-Clause", + "bin": { + "esparse": "bin/esparse.js", + "esvalidate": "bin/esvalidate.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/recast/node_modules/source-map": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha512-LbrmJOMUSdEVxIKvdcJzQC+nQhe8FUZQTXQy6+I75skNgn3OoQ0DZA8YnFa7gp8tqtL3KPf1kmo0R5DoApeSGQ==", + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/rechoir": { + "version": "0.7.1", + "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.7.1.tgz", + "integrity": "sha512-/njmZ8s1wVeR6pjTZ+0nCnv8SpZNRMT2D1RLOJQESlYFDBvwpTA4KWJpZ+sBJ4+vhjILRcK7JIFdGCdxEAAitg==", + "license": "MIT", + "dependencies": { + "resolve": "^1.9.0" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/redent": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/redent/-/redent-3.0.0.tgz", + "integrity": "sha512-6tDA8g98We0zd0GvVeMT9arEOnTw9qM03L9cJXaCjrip1OO764RDBLBfrB4cwzNGDj5OA5ioymC9GkizgWJDUg==", + "dev": true, + "license": "MIT", + "dependencies": { + "indent-string": "^4.0.0", + "strip-indent": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/reflect-metadata": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/reflect-metadata/-/reflect-metadata-0.2.2.tgz", + "integrity": "sha512-urBwgfrvVP/eAyXx4hluJivBKzuEbSQs9rKWCrCkbSxNv8mxPcUZKeuoF3Uy4mJl3Lwprp6yy5/39VWigZ4K6Q==", + "license": "Apache-2.0" + }, + "node_modules/reflect.getprototypeof": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/reflect.getprototypeof/-/reflect.getprototypeof-1.0.10.tgz", + "integrity": "sha512-00o4I+DVrefhv+nX0ulyi3biSHCPDe+yLv5o/p6d/UVlirijB8E16FtfwSAi4g3tcqrQ4lRAqQSoFEZJehYEcw==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.8", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.9", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.0.0", + "get-intrinsic": "^1.2.7", + "get-proto": "^1.0.1", + "which-builtin-type": "^1.2.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/regenerate": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/regenerate/-/regenerate-1.4.2.tgz", + "integrity": "sha512-zrceR/XhGYU/d/opr2EKO7aRHUeiBI8qjtfHqADTwZd6Szfy16la6kqD0MIUs5z5hx6AaKa+PixpPrR289+I0A==", + "license": "MIT" + }, + "node_modules/regenerate-unicode-properties": { + "version": "10.2.2", + "resolved": "https://registry.npmjs.org/regenerate-unicode-properties/-/regenerate-unicode-properties-10.2.2.tgz", + "integrity": "sha512-m03P+zhBeQd1RGnYxrGyDAPpWX/epKirLrp8e3qevZdVkKtnCrjjWczIbYc8+xd6vcTStVlqfycTx1KR4LOr0g==", + "license": "MIT", + "dependencies": { + "regenerate": "^1.4.2" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/regenerator-runtime": { + "version": "0.10.5", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.10.5.tgz", + "integrity": "sha512-02YopEIhAgiBHWeoTiA8aitHDt8z6w+rQqNuIftlM+ZtvSl/brTouaU7DW6GO/cHtvxJvS4Hwv2ibKdxIRi24w==", + "dev": true, + "license": "MIT" + }, + "node_modules/regexp.prototype.flags": { + "version": "1.5.4", + "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.5.4.tgz", + "integrity": "sha512-dYqgNSZbDwkaJ2ceRd9ojCGjBq+mOm9LmtXnAnEGyHhN/5R7iDW2TRw3h+o/jCFxus3P2LfWIIiwowAjANm7IA==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.8", + "define-properties": "^1.2.1", + "es-errors": "^1.3.0", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "set-function-name": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/regexpu-core": { + "version": "6.4.0", + "resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-6.4.0.tgz", + "integrity": "sha512-0ghuzq67LI9bLXpOX/ISfve/Mq33a4aFRzoQYhnnok1JOFpmE/A2TBGkNVenOGEeSBCjIiWcc6MVOG5HEQv0sA==", + "license": "MIT", + "dependencies": { + "regenerate": "^1.4.2", + "regenerate-unicode-properties": "^10.2.2", + "regjsgen": "^0.8.0", + "regjsparser": "^0.13.0", + "unicode-match-property-ecmascript": "^2.0.0", + "unicode-match-property-value-ecmascript": "^2.2.1" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/regjsgen": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/regjsgen/-/regjsgen-0.8.0.tgz", + "integrity": "sha512-RvwtGe3d7LvWiDQXeQw8p5asZUmfU1G/l6WbUXeHta7Y2PEIvBTwH6E2EfmYUK8pxcxEdEmaomqyp0vZZ7C+3Q==", + "license": "MIT" + }, + "node_modules/regjsparser": { + "version": "0.13.0", + "resolved": "https://registry.npmjs.org/regjsparser/-/regjsparser-0.13.0.tgz", + "integrity": "sha512-NZQZdC5wOE/H3UT28fVGL+ikOZcEzfMGk/c3iN9UGxzWHMa1op7274oyiUVrAG4B2EuFhus8SvkaYnhvW92p9Q==", + "license": "BSD-2-Clause", + "dependencies": { + "jsesc": "~3.1.0" + }, + "bin": { + "regjsparser": "bin/parser" + } + }, + "node_modules/release-zalgo": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/release-zalgo/-/release-zalgo-1.0.0.tgz", + "integrity": "sha512-gUAyHVHPPC5wdqX/LG4LWtRYtgjxyX78oanFNTMMyFEfOqdC54s3eE82imuWKbOeqYht2CrNf64Qb8vgmmtZGA==", + "dev": true, + "license": "ISC", + "dependencies": { + "es6-error": "^4.0.1" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/require-from-string": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", + "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/require-main-filename": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", + "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==", + "license": "ISC" + }, + "node_modules/requires-port": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", + "integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==", + "license": "MIT" + }, + "node_modules/resedit": { + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/resedit/-/resedit-1.7.2.tgz", + "integrity": "sha512-vHjcY2MlAITJhC0eRD/Vv8Vlgmu9Sd3LX9zZvtGzU5ZImdTN3+d6e/4mnTyV8vEbyf1sgNIrWxhWlrys52OkEA==", + "dev": true, + "license": "MIT", + "dependencies": { + "pe-library": "^0.4.1" + }, + "engines": { + "node": ">=12", + "npm": ">=6" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/jet2jet" + } + }, + "node_modules/resolve": { + "version": "1.22.11", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.11.tgz", + "integrity": "sha512-RfqAvLnMl313r7c9oclB1HhUEAezcpLjz95wFH4LVuhk9JF/r22qmVP9AMmOU4vMX7Q8pN8jwNg/CSpdFnMjTQ==", + "license": "MIT", + "dependencies": { + "is-core-module": "^2.16.1", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + }, + "bin": { + "resolve": "bin/resolve" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/resolve-alpn": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/resolve-alpn/-/resolve-alpn-1.2.1.tgz", + "integrity": "sha512-0a1F4l73/ZFZOakJnQ3FvkJ2+gSTQWz/r2KE5OdDY0TxPm5h4GkqkWWfM47T7HsbnOtcJVEF4epCVy6u7Q3K+g==", + "license": "MIT" + }, + "node_modules/resolve-cwd": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-3.0.0.tgz", + "integrity": "sha512-OrZaX2Mb+rJCpH/6CpSqt9xFVpN++x01XnN2ie9g6P5/3xelLAkXWVADpdz1IHD/KFfEXyE6V0U01OQ3UO2rEg==", + "license": "MIT", + "dependencies": { + "resolve-from": "^5.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/resolve-cwd/node_modules/resolve-from": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", + "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/resolve-package-path": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/resolve-package-path/-/resolve-package-path-4.0.3.tgz", + "integrity": "sha512-SRpNAPW4kewOaNUt8VPqhJ0UMxawMwzJD8V7m1cJfdSTK9ieZwS6K7Dabsm4bmLFM96Z5Y/UznrpG5kt1im8yA==", + "license": "MIT", + "dependencies": { + "path-root": "^0.1.1" + }, + "engines": { + "node": ">= 12" + } + }, + "node_modules/resolve.exports": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/resolve.exports/-/resolve.exports-2.0.3.tgz", + "integrity": "sha512-OcXjMsGdhL4XnbShKpAcSqPMzQoYkYyhbEaeSko47MjRP9NfEQMhZkXL1DoFlt9LWQn4YttrdnV6X2OiyzBi+A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + } + }, + "node_modules/responselike": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/responselike/-/responselike-2.0.1.tgz", + "integrity": "sha512-4gl03wn3hj1HP3yzgdI7d3lCkF95F21Pz4BPGvKHinyQzALR5CapwC8yIi0Rh58DEMQ/SguC03wFj2k0M/mHhw==", + "license": "MIT", + "dependencies": { + "lowercase-keys": "^2.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/restore-cursor": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-3.1.0.tgz", + "integrity": "sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA==", + "license": "MIT", + "dependencies": { + "onetime": "^5.1.0", + "signal-exit": "^3.0.2" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/retry": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/retry/-/retry-0.12.0.tgz", + "integrity": "sha512-9LkiTwjUh6rT555DtE9rTX+BKByPfrMzEAtnlEtdEwr3Nkffwiihqe2bWADg+OQRjt9gl6ICdmB/ZFDCGAtSow==", + "license": "MIT", + "engines": { + "node": ">= 4" + } + }, + "node_modules/reusify": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.1.0.tgz", + "integrity": "sha512-g6QUff04oZpHs0eG5p83rFLhHeV00ug/Yf9nZM6fLeUrPguBTkTQOdpAWWspMh55TZfVQDPaN3NQJfbVRAxdIw==", + "license": "MIT", + "engines": { + "iojs": ">=1.0.0", + "node": ">=0.10.0" + } + }, + "node_modules/rimraf": { + "version": "5.0.10", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-5.0.10.tgz", + "integrity": "sha512-l0OE8wL34P4nJH/H2ffoaniAokM2qSmrtXHmlpvYr5AVVX8msAyW0l8NVJFDxlSK4u3Uh/f41cQheDVdnYijwQ==", + "license": "ISC", + "dependencies": { + "glob": "^10.3.7" + }, + "bin": { + "rimraf": "dist/esm/bin.mjs" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/rimraf/node_modules/@isaacs/cliui": { + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", + "integrity": "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==", + "license": "ISC", + "dependencies": { + "string-width": "^5.1.2", + "string-width-cjs": "npm:string-width@^4.2.0", + "strip-ansi": "^7.0.1", + "strip-ansi-cjs": "npm:strip-ansi@^6.0.1", + "wrap-ansi": "^8.1.0", + "wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/rimraf/node_modules/ansi-regex": { + "version": "6.2.2", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.2.2.tgz", + "integrity": "sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg==", + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" + } + }, + "node_modules/rimraf/node_modules/ansi-styles": { + "version": "6.2.3", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.3.tgz", + "integrity": "sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg==", + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/rimraf/node_modules/brace-expansion": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz", + "integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==", + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/rimraf/node_modules/emoji-regex": { + "version": "9.2.2", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", + "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", + "license": "MIT" + }, + "node_modules/rimraf/node_modules/glob": { + "version": "10.5.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-10.5.0.tgz", + "integrity": "sha512-DfXN8DfhJ7NH3Oe7cFmu3NCu1wKbkReJ8TorzSAFbSKrlNaQSKfIzqYqVY8zlbs2NLBbWpRiU52GX2PbaBVNkg==", + "deprecated": "Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me", + "license": "ISC", + "dependencies": { + "foreground-child": "^3.1.0", + "jackspeak": "^3.1.2", + "minimatch": "^9.0.4", + "minipass": "^7.1.2", + "package-json-from-dist": "^1.0.0", + "path-scurry": "^1.11.1" + }, + "bin": { + "glob": "dist/esm/bin.mjs" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/rimraf/node_modules/jackspeak": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-3.4.3.tgz", + "integrity": "sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw==", + "license": "BlueOak-1.0.0", + "dependencies": { + "@isaacs/cliui": "^8.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + }, + "optionalDependencies": { + "@pkgjs/parseargs": "^0.11.0" + } + }, + "node_modules/rimraf/node_modules/lru-cache": { + "version": "10.4.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.4.3.tgz", + "integrity": "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==", + "license": "ISC" + }, + "node_modules/rimraf/node_modules/minimatch": { + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", + "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", + "license": "ISC", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/rimraf/node_modules/path-scurry": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.11.1.tgz", + "integrity": "sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==", + "license": "BlueOak-1.0.0", + "dependencies": { + "lru-cache": "^10.2.0", + "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0" + }, + "engines": { + "node": ">=16 || 14 >=14.18" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/rimraf/node_modules/string-width": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", + "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", + "license": "MIT", + "dependencies": { + "eastasianwidth": "^0.2.0", + "emoji-regex": "^9.2.2", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/rimraf/node_modules/strip-ansi": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.2.tgz", + "integrity": "sha512-gmBGslpoQJtgnMAvOVqGZpEz9dyoKTCzy2nfz/n8aIFhN/jCE/rCmcxabB6jOOHV+0WNnylOxaxBQPSvcWklhA==", + "license": "MIT", + "dependencies": { + "ansi-regex": "^6.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" + } + }, + "node_modules/rimraf/node_modules/wrap-ansi": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", + "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==", + "license": "MIT", + "dependencies": { + "ansi-styles": "^6.1.0", + "string-width": "^5.0.1", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/roarr": { + "version": "2.15.4", + "resolved": "https://registry.npmjs.org/roarr/-/roarr-2.15.4.tgz", + "integrity": "sha512-CHhPh+UNHD2GTXNYhPWLnU8ONHdI+5DI+4EYIAOaiD63rHeYlZvyh8P+in5999TTSFgUYuKUAjzRI4mdh/p+2A==", + "license": "BSD-3-Clause", + "optional": true, + "dependencies": { + "boolean": "^3.0.1", + "detect-node": "^2.0.4", + "globalthis": "^1.0.1", + "json-stringify-safe": "^5.0.1", + "semver-compare": "^1.0.0", + "sprintf-js": "^1.1.2" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/roarr/node_modules/sprintf-js": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.1.3.tgz", + "integrity": "sha512-Oo+0REFV59/rz3gfJNKQiBlwfHaSESl1pcGyABQsnnIfWOFt6JNj5gCog2U6MLZ//IGYD+nA8nI+mTShREReaA==", + "license": "BSD-3-Clause", + "optional": true + }, + "node_modules/route-parser": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/route-parser/-/route-parser-0.0.5.tgz", + "integrity": "sha512-nsii+MXoNb7NyF05LP9kaktx6AoBVT/7zUgDnzIb5IoYAvYkbZOAuoLJjVdsyEVxWv0swCxWkKDK4cMva+WDBA==", + "license": "MIT", + "engines": { + "node": ">= 0.9" + } + }, + "node_modules/router": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/router/-/router-2.2.0.tgz", + "integrity": "sha512-nLTrUKm2UyiL7rlhapu/Zl45FwNgkZGaCpZbIHajDYgwlJCOzLSk+cIPAnsEqV955GjILJnKbdQC1nVPz+gAYQ==", + "license": "MIT", + "dependencies": { + "debug": "^4.4.0", + "depd": "^2.0.0", + "is-promise": "^4.0.0", + "parseurl": "^1.3.3", + "path-to-regexp": "^8.0.0" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/router/node_modules/path-to-regexp": { + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-8.3.0.tgz", + "integrity": "sha512-7jdwVIRtsP8MYpdXSwOS0YdD0Du+qOoF/AEPIt88PcCFrZCzx41oxku1jD88hZBwbNUIEfpqvuhjFaMAqMTWnA==", + "license": "MIT", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/rrweb-cssom": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/rrweb-cssom/-/rrweb-cssom-0.6.0.tgz", + "integrity": "sha512-APM0Gt1KoXBz0iIkkdB/kfvGOwC4UuJFeG/c+yV7wSc7q96cG/kJ0HiYCnzivD9SB53cLV1MlHFNfOuPaadYSw==", + "dev": true, + "license": "MIT" + }, + "node_modules/run-applescript": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/run-applescript/-/run-applescript-7.1.0.tgz", + "integrity": "sha512-DPe5pVFaAsinSaV6QjQ6gdiedWDcRCbUuiQfQa2wmWV7+xC9bGulGI8+TdRmoFkAPaBXk8CrAbnlY2ISniJ47Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/run-async": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/run-async/-/run-async-4.0.6.tgz", + "integrity": "sha512-IoDlSLTs3Yq593mb3ZoKWKXMNu3UpObxhgA/Xuid5p4bbfi2jdY1Hj0m1K+0/tEuQTxIGMhQDqGjKb7RuxGpAQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/run-parallel": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT", + "dependencies": { + "queue-microtask": "^1.2.2" + } + }, + "node_modules/rx": { + "version": "2.3.24", + "resolved": "https://registry.npmjs.org/rx/-/rx-2.3.24.tgz", + "integrity": "sha512-Ue4ZB7Dzbn2I9sIj8ws536nOP2S53uypyCkCz9q0vlYD5Kn6/pu4dE+wt2ZfFzd9m73hiYKnnCb1OyKqc+MRkg==", + "dev": true + }, + "node_modules/rxjs": { + "version": "7.8.2", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.8.2.tgz", + "integrity": "sha512-dhKf903U/PQZY6boNNtAGdWbG85WAbjT/1xYoZIC7FAY0yWapOBQVsVrDl58W86//e1VpMNBtRV4MaXfdMySFA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "tslib": "^2.1.0" + } + }, + "node_modules/safe-array-concat": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/safe-array-concat/-/safe-array-concat-1.1.3.tgz", + "integrity": "sha512-AURm5f0jYEOydBj7VQlVvDrjeFgthDdEF5H1dP+6mNpoXOMo1quQqJ4wvJDyRZ9+pO3kGWoOdmV08cSv2aJV6Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.2", + "get-intrinsic": "^1.2.6", + "has-symbols": "^1.1.0", + "isarray": "^2.0.5" + }, + "engines": { + "node": ">=0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/safe-push-apply": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/safe-push-apply/-/safe-push-apply-1.0.0.tgz", + "integrity": "sha512-iKE9w/Z7xCzUMIZqdBsp6pEQvwuEebH4vdpjcDWnyzaI6yl6O9FHvVpmGelvEHNsoY6wGblkxR6Zty/h00WiSA==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "isarray": "^2.0.5" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/safe-regex-test": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/safe-regex-test/-/safe-regex-test-1.1.0.tgz", + "integrity": "sha512-x/+Cz4YrimQxQccJf5mKEbIa1NzeCRNI5Ecl/ekmlYaampdNLPalVyIcCZNNH3MvmqBugV5TMYZXv0ljslUlaw==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "is-regex": "^1.2.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "license": "MIT" + }, + "node_modules/sanitize-filename": { + "version": "1.6.3", + "resolved": "https://registry.npmjs.org/sanitize-filename/-/sanitize-filename-1.6.3.tgz", + "integrity": "sha512-y/52Mcy7aw3gRm7IrcGDFx/bCk4AhRh2eI9luHOQM86nZsqwiRkkq2GekHXBBD+SmPidc8i2PqtYZl+pWJ8Oeg==", + "dev": true, + "license": "WTFPL OR ISC", + "dependencies": { + "truncate-utf8-bytes": "^1.0.0" + } + }, + "node_modules/sax": { + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/sax/-/sax-1.4.4.tgz", + "integrity": "sha512-1n3r/tGXO6b6VXMdFT54SHzT9ytu9yr7TaELowdYpMqY/Ao7EnlQGmAQ1+RatX7Tkkdm6hONI2owqNx2aZj5Sw==", + "license": "BlueOak-1.0.0", + "engines": { + "node": ">=11.0.0" + } + }, + "node_modules/saxes": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/saxes/-/saxes-6.0.0.tgz", + "integrity": "sha512-xAg7SOnEhrm5zI3puOOKyy1OMcMlIJZYNJY7xLBwSze0UjhPLnWfj2GF2EpT0jmzaJKIWKHLsaSSajf35bcYnA==", + "dev": true, + "license": "ISC", + "dependencies": { + "xmlchars": "^2.2.0" + }, + "engines": { + "node": ">=v12.22.7" + } + }, + "node_modules/sb-promise-queue": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/sb-promise-queue/-/sb-promise-queue-2.1.1.tgz", + "integrity": "sha512-qXfdcJQMxMljxmPprn4Q4hl3pJmoljSCzUvvEBa9Kscewnv56n0KqrO6yWSrGLOL9E021wcGdPa39CHGKA6G0w==", + "license": "MIT", + "engines": { + "node": ">= 8" + } + }, + "node_modules/sb-scandir": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/sb-scandir/-/sb-scandir-3.1.1.tgz", + "integrity": "sha512-Q5xiQMtoragW9z8YsVYTAZcew+cRzdVBefPbb9theaIKw6cBo34WonP9qOCTKgyAmn/Ch5gmtAxT/krUgMILpA==", + "license": "MIT", + "dependencies": { + "sb-promise-queue": "^2.1.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/scanoss": { + "version": "0.15.7", + "resolved": "https://registry.npmjs.org/scanoss/-/scanoss-0.15.7.tgz", + "integrity": "sha512-aYofIHN1V3Odq6L1VwegkBGlgISk0VmHQjTHcDQ8s9GYkqNSd7hrULs1FMGpaplkvpP466Fus58878ly2M6Ihw==", + "license": "MIT", + "dependencies": { + "@grpc/grpc-js": "^1.5.5", + "abort-controller": "^3.0.0", + "adm-zip": "^0.5.9", + "cli-progress": "^3.9.1", + "commander": "^11.1.0", + "eventemitter3": "^4.0.7", + "form-data": "^4.0.0", + "google-protobuf": "^3.19.4", + "gunzip-maybe": "^1.4.2", + "isbinaryfile": "^4.0.8", + "node-fetch": "^2.6.1", + "p-queue": "6.6.2", + "packageurl-js": "^1.2.1", + "proxy-agent": "^6.4.0", + "sort-paths": "^1.1.1", + "syswide-cas": "^5.3.0", + "tar": "^6.1.11", + "tar-stream": "^2.2.0", + "uuid": "^9.0.0", + "xml-js": "^1.6.11" + }, + "bin": { + "scanoss-js": "build/main/cli/bin/cli-bin.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/scanoss/node_modules/chownr": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/chownr/-/chownr-2.0.0.tgz", + "integrity": "sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==", + "license": "ISC", + "engines": { + "node": ">=10" + } + }, + "node_modules/scanoss/node_modules/commander": { + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-11.1.0.tgz", + "integrity": "sha512-yPVavfyCcRhmorC7rWlkHn15b4wDVgVmBA7kV4QVBsF7kv/9TKJAbAXVTxvTnwP8HHKjRCJDClKbciiYS7p0DQ==", + "license": "MIT", + "engines": { + "node": ">=16" + } + }, + "node_modules/scanoss/node_modules/fs-minipass": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-2.1.0.tgz", + "integrity": "sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg==", + "license": "ISC", + "dependencies": { + "minipass": "^3.0.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/scanoss/node_modules/fs-minipass/node_modules/minipass": { + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", + "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", + "license": "ISC", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/scanoss/node_modules/isbinaryfile": { + "version": "4.0.10", + "resolved": "https://registry.npmjs.org/isbinaryfile/-/isbinaryfile-4.0.10.tgz", + "integrity": "sha512-iHrqe5shvBUcFbmZq9zOQHBoeOhZJu6RQGrDpBgenUm/Am+F3JM2MgQj+rK3Z601fzrL5gLZWtAPH2OBaSVcyw==", + "license": "MIT", + "engines": { + "node": ">= 8.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/gjtorikian/" + } + }, + "node_modules/scanoss/node_modules/minipass": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-5.0.0.tgz", + "integrity": "sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==", + "license": "ISC", + "engines": { + "node": ">=8" + } + }, + "node_modules/scanoss/node_modules/minizlib": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-2.1.2.tgz", + "integrity": "sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg==", + "license": "MIT", + "dependencies": { + "minipass": "^3.0.0", + "yallist": "^4.0.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/scanoss/node_modules/minizlib/node_modules/minipass": { + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", + "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", + "license": "ISC", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/scanoss/node_modules/mkdirp": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", + "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", + "license": "MIT", + "bin": { + "mkdirp": "bin/cmd.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/scanoss/node_modules/node-fetch": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", + "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", + "license": "MIT", + "dependencies": { + "whatwg-url": "^5.0.0" + }, + "engines": { + "node": "4.x || >=6.0.0" + }, + "peerDependencies": { + "encoding": "^0.1.0" + }, + "peerDependenciesMeta": { + "encoding": { + "optional": true + } + } + }, + "node_modules/scanoss/node_modules/tar": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/tar/-/tar-6.2.1.tgz", + "integrity": "sha512-DZ4yORTwrbTj/7MZYq2w+/ZFdI6OZ/f9SFHR+71gIVUZhOQPHzVCLpvRnPgyaMpfWxxk/4ONva3GQSyNIKRv6A==", + "deprecated": "Old versions of tar are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me", + "license": "ISC", + "dependencies": { + "chownr": "^2.0.0", + "fs-minipass": "^2.0.0", + "minipass": "^5.0.0", + "minizlib": "^2.1.1", + "mkdirp": "^1.0.3", + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/scanoss/node_modules/tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==", + "license": "MIT" + }, + "node_modules/scanoss/node_modules/uuid": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz", + "integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==", + "funding": [ + "https://github.com/sponsors/broofa", + "https://github.com/sponsors/ctavan" + ], + "license": "MIT", + "bin": { + "uuid": "dist/bin/uuid" + } + }, + "node_modules/scanoss/node_modules/webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==", + "license": "BSD-2-Clause" + }, + "node_modules/scanoss/node_modules/whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", + "license": "MIT", + "dependencies": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + }, + "node_modules/scheduler": { + "version": "0.23.2", + "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.23.2.tgz", + "integrity": "sha512-UOShsPwz7NrMUqhR6t0hWjFduvOzbtv7toDH1/hIrfRNIDBnnBWd0CwJTGvTpngVlmwGCdP9/Zl/tVrDqcuYzQ==", + "license": "MIT", + "dependencies": { + "loose-envify": "^1.1.0" + } + }, + "node_modules/schema-utils": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-2.7.1.tgz", + "integrity": "sha512-SHiNtMOUGWBQJwzISiVYKu82GiV4QYGePp3odlY1tuKO7gPtphAT5R/py0fA6xtbgLL/RvtJZnU9b8s0F1q0Xg==", + "license": "MIT", + "dependencies": { + "@types/json-schema": "^7.0.5", + "ajv": "^6.12.4", + "ajv-keywords": "^3.5.2" + }, + "engines": { + "node": ">= 8.9.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + } + }, + "node_modules/secure-compare": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/secure-compare/-/secure-compare-3.0.1.tgz", + "integrity": "sha512-AckIIV90rPDcBcglUwXPF3kg0P0qmPsPXAj6BBEENQE1p5yA1xfmDJzfi1Tappj37Pv2mVbKpL3Z1T+Nn7k1Qw==", + "license": "MIT" + }, + "node_modules/seek-bzip": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/seek-bzip/-/seek-bzip-1.0.6.tgz", + "integrity": "sha512-e1QtP3YL5tWww8uKaOCQ18UxIT2laNBXHjV/S2WYCiK4udiv8lkG89KRIoCjUagnAmCBurjF4zEVX2ByBbnCjQ==", + "license": "MIT", + "dependencies": { + "commander": "^2.8.1" + }, + "bin": { + "seek-bunzip": "bin/seek-bunzip", + "seek-table": "bin/seek-bzip-table" + } + }, + "node_modules/seek-bzip/node_modules/commander": { + "version": "2.20.3", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", + "license": "MIT" + }, + "node_modules/semver": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.4.tgz", + "integrity": "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA==", + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/semver-compare": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/semver-compare/-/semver-compare-1.0.0.tgz", + "integrity": "sha512-YM3/ITh2MJ5MtzaM429anh+x2jiLVjqILF4m4oyQB18W7Ggea7BfqdH/wGMK7dDiMghv/6WG7znWMwUDzJiXow==", + "license": "MIT", + "optional": true + }, + "node_modules/send": { + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/send/-/send-0.19.2.tgz", + "integrity": "sha512-VMbMxbDeehAxpOtWJXlcUS5E8iXh6QmN+BkRX1GARS3wRaXEEgzCcB10gTQazO42tpNIya8xIyNx8fll1OFPrg==", + "license": "MIT", + "dependencies": { + "debug": "2.6.9", + "depd": "2.0.0", + "destroy": "1.2.0", + "encodeurl": "~2.0.0", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "fresh": "~0.5.2", + "http-errors": "~2.0.1", + "mime": "1.6.0", + "ms": "2.1.3", + "on-finished": "~2.4.1", + "range-parser": "~1.2.1", + "statuses": "~2.0.2" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/send/node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "license": "MIT", + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/send/node_modules/debug/node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", + "license": "MIT" + }, + "node_modules/serialize-error": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/serialize-error/-/serialize-error-7.0.1.tgz", + "integrity": "sha512-8I8TjW5KMOKsZQTvoxjuSIa7foAwPWGOts+6o7sgjz41/qMD9VQHEDxi6PBvK2l0MXUmqZyNpUK+T2tQaaElvw==", + "license": "MIT", + "optional": true, + "dependencies": { + "type-fest": "^0.13.1" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/serialize-error/node_modules/type-fest": { + "version": "0.13.1", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.13.1.tgz", + "integrity": "sha512-34R7HTnG0XIJcBSn5XhDd7nNFPRcXYRZrBB2O2jdKqYODldSzBAqzsWoZYYvduky73toYS/ESqxPvkDf/F0XMg==", + "license": "(MIT OR CC0-1.0)", + "optional": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/serialize-javascript": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.0.tgz", + "integrity": "sha512-Qr3TosvguFt8ePWqsvRfrKyQXIiW+nGbYpy8XK24NQHE83caxWt+mIymTT19DGFbNWNLfEwsrkSmN64lVWB9ag==", + "license": "BSD-3-Clause", + "dependencies": { + "randombytes": "^2.1.0" + } + }, + "node_modules/serve-static": { + "version": "1.16.3", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.16.3.tgz", + "integrity": "sha512-x0RTqQel6g5SY7Lg6ZreMmsOzncHFU7nhnRWkKgWuMTu5NN0DR5oruckMqRvacAN9d5w6ARnRBXl9xhDCgfMeA==", + "license": "MIT", + "dependencies": { + "encodeurl": "~2.0.0", + "escape-html": "~1.0.3", + "parseurl": "~1.3.3", + "send": "~0.19.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/set-blocking": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", + "integrity": "sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==", + "license": "ISC" + }, + "node_modules/set-function-length": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz", + "integrity": "sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==", + "license": "MIT", + "dependencies": { + "define-data-property": "^1.1.4", + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.4", + "gopd": "^1.0.1", + "has-property-descriptors": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/set-function-name": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/set-function-name/-/set-function-name-2.0.2.tgz", + "integrity": "sha512-7PGFlmtwsEADb0WYyvCMa1t+yke6daIG4Wirafur5kcf+MhUnPms1UeR0CKQdTZD81yESwMHbtn+TR+dMviakQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "define-data-property": "^1.1.4", + "es-errors": "^1.3.0", + "functions-have-names": "^1.2.3", + "has-property-descriptors": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/set-proto": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/set-proto/-/set-proto-1.0.0.tgz", + "integrity": "sha512-RJRdvCo6IAnPdsvP/7m6bsQqNnn1FCBX5ZNtFL98MmFF/4xAIJTIg1YbHW5DC2W5SKZanrC6i4HsJqlajw/dZw==", + "dev": true, + "license": "MIT", + "dependencies": { + "dunder-proto": "^1.0.1", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/setimmediate": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz", + "integrity": "sha512-MATJdZp8sLqDl/68LfQmbP8zKPLQNV6BIZoIgrscFDQ+RsvK/BxeDQOgyxKKoh0y/8h3BqVFnCqQ/gd+reiIXA==", + "license": "MIT" + }, + "node_modules/setprototypeof": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", + "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==", + "license": "ISC" + }, + "node_modules/shallow-clone": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/shallow-clone/-/shallow-clone-3.0.1.tgz", + "integrity": "sha512-/6KqX+GVUdqPuPPd2LxDDxzX6CAbjJehAAOKlNpqqUpAqPM6HeL8f+o3a+JsyGjn2lv0WY8UsTgUJjU9Ok55NA==", + "license": "MIT", + "dependencies": { + "kind-of": "^6.0.2" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "license": "MIT", + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/shell-env": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/shell-env/-/shell-env-4.0.3.tgz", + "integrity": "sha512-Ioe5h+hCDZ7pKL5+JGzbtPvZ5ESMHePZ8nLxohlDL+twmlcmutttMhRkrQOed8DeLT8mkYBgbwZfohe8pqaA3g==", + "license": "MIT", + "dependencies": { + "default-shell": "^2.0.0", + "execa": "^5.1.1", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/shell-env/node_modules/ansi-regex": { + "version": "6.2.2", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.2.2.tgz", + "integrity": "sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg==", + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" + } + }, + "node_modules/shell-env/node_modules/execa": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz", + "integrity": "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==", + "license": "MIT", + "dependencies": { + "cross-spawn": "^7.0.3", + "get-stream": "^6.0.0", + "human-signals": "^2.1.0", + "is-stream": "^2.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^4.0.1", + "onetime": "^5.1.2", + "signal-exit": "^3.0.3", + "strip-final-newline": "^2.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sindresorhus/execa?sponsor=1" + } + }, + "node_modules/shell-env/node_modules/strip-ansi": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.2.tgz", + "integrity": "sha512-gmBGslpoQJtgnMAvOVqGZpEz9dyoKTCzy2nfz/n8aIFhN/jCE/rCmcxabB6jOOHV+0WNnylOxaxBQPSvcWklhA==", + "license": "MIT", + "dependencies": { + "ansi-regex": "^6.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" + } + }, + "node_modules/shell-escape": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/shell-escape/-/shell-escape-0.2.0.tgz", + "integrity": "sha512-uRRBT2MfEOyxuECseCZd28jC1AJ8hmqqneWQ4VWUTgCAFvb3wKU1jLqj6egC4Exrr88ogg3dp+zroH4wJuaXzw==", + "license": "MIT" + }, + "node_modules/shell-path": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/shell-path/-/shell-path-3.1.0.tgz", + "integrity": "sha512-s/9q9PEtcRmDTz69+cJ3yYBAe9yGrL7e46gm2bU4pQ9N48ecPK9QrGFnLwYgb4smOHskx4PL7wCNMktW2AoD+g==", + "license": "MIT", + "dependencies": { + "shell-env": "^4.0.1" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/shell-quote": { + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/shell-quote/-/shell-quote-1.8.3.tgz", + "integrity": "sha512-ObmnIF4hXNg1BqhnHmgbDETF8dLPCggZWBjkQfhZpbszZnYur5DUljTcCHii5LC3J5E0yeO/1LIMyH+UvHQgyw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.0.tgz", + "integrity": "sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.3", + "side-channel-list": "^1.0.0", + "side-channel-map": "^1.0.1", + "side-channel-weakmap": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-list": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.0.tgz", + "integrity": "sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-map": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/side-channel-map/-/side-channel-map-1.0.1.tgz", + "integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==", + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-weakmap": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz", + "integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==", + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3", + "side-channel-map": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/signal-exit": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", + "license": "ISC" + }, + "node_modules/sigstore": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/sigstore/-/sigstore-4.1.0.tgz", + "integrity": "sha512-/fUgUhYghuLzVT/gaJoeVehLCgZiUxPCPMcyVNY0lIf/cTCz58K/WTI7PefDarXxp9nUKpEwg1yyz3eSBMTtgA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@sigstore/bundle": "^4.0.0", + "@sigstore/core": "^3.1.0", + "@sigstore/protobuf-specs": "^0.5.0", + "@sigstore/sign": "^4.1.0", + "@sigstore/tuf": "^4.0.1", + "@sigstore/verify": "^3.1.0" + }, + "engines": { + "node": "^20.17.0 || >=22.9.0" + } + }, + "node_modules/simple-concat": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.1.tgz", + "integrity": "sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/simple-get": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/simple-get/-/simple-get-4.0.1.tgz", + "integrity": "sha512-brv7p5WgH0jmQJr1ZDDfKDOSeWWg+OVypG99A/5vYGPqJ6pxiaHLy8nxtFjBA7oMa01ebA9gfh1uMCFqOuXxvA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT", + "dependencies": { + "decompress-response": "^6.0.0", + "once": "^1.3.1", + "simple-concat": "^1.0.0" + } + }, + "node_modules/simple-git": { + "version": "3.30.0", + "resolved": "https://registry.npmjs.org/simple-git/-/simple-git-3.30.0.tgz", + "integrity": "sha512-q6lxyDsCmEal/MEGhP1aVyQ3oxnagGlBDOVSIB4XUVLl1iZh0Pah6ebC9V4xBap/RfgP2WlI8EKs0WS0rMEJHg==", + "license": "MIT", + "dependencies": { + "@kwsites/file-exists": "^1.1.1", + "@kwsites/promise-deferred": "^1.1.1", + "debug": "^4.4.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/steveukx/git-js?sponsor=1" + } + }, + "node_modules/simple-update-notifier": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/simple-update-notifier/-/simple-update-notifier-2.0.0.tgz", + "integrity": "sha512-a2B9Y0KlNXl9u/vsW6sTIu9vGEpfKu2wRV6l1H3XEas/0gUIzGzBoP/IouTcUQbm9JWZLH3COxyn03TYlFax6w==", + "dev": true, + "license": "MIT", + "dependencies": { + "semver": "^7.5.3" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/sinon": { + "version": "12.0.1", + "resolved": "https://registry.npmjs.org/sinon/-/sinon-12.0.1.tgz", + "integrity": "sha512-iGu29Xhym33ydkAT+aNQFBINakjq69kKO6ByPvTsm3yyIACfyQttRTP03aBP/I8GfhFmLzrnKwNNkr0ORb1udg==", + "deprecated": "16.1.1", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "@sinonjs/commons": "^1.8.3", + "@sinonjs/fake-timers": "^8.1.0", + "@sinonjs/samsam": "^6.0.2", + "diff": "^5.0.0", + "nise": "^5.1.0", + "supports-color": "^7.2.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/sinon" + } + }, + "node_modules/slash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", + "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/slice-ansi": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-3.0.0.tgz", + "integrity": "sha512-pSyv7bSTC7ig9Dcgbw9AuRNUb5k5V6oDudjZoMBSr13qpLBG7tB+zgCkARjq7xIUgdz5P1Qe8u+rSGdouOOIyQ==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "ansi-styles": "^4.0.0", + "astral-regex": "^2.0.0", + "is-fullwidth-code-point": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/smart-buffer": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz", + "integrity": "sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==", + "license": "MIT", + "engines": { + "node": ">= 6.0.0", + "npm": ">= 3.0.0" + } + }, + "node_modules/socket.io": { + "version": "4.8.3", + "resolved": "https://registry.npmjs.org/socket.io/-/socket.io-4.8.3.tgz", + "integrity": "sha512-2Dd78bqzzjE6KPkD5fHZmDAKRNe3J15q+YHDrIsy9WEkqttc7GY+kT9OBLSMaPbQaEd0x1BjcmtMtXkfpc+T5A==", + "license": "MIT", + "dependencies": { + "accepts": "~1.3.4", + "base64id": "~2.0.0", + "cors": "~2.8.5", + "debug": "~4.4.1", + "engine.io": "~6.6.0", + "socket.io-adapter": "~2.5.2", + "socket.io-parser": "~4.2.4" + }, + "engines": { + "node": ">=10.2.0" + } + }, + "node_modules/socket.io-adapter": { + "version": "2.5.6", + "resolved": "https://registry.npmjs.org/socket.io-adapter/-/socket.io-adapter-2.5.6.tgz", + "integrity": "sha512-DkkO/dz7MGln0dHn5bmN3pPy+JmywNICWrJqVWiVOyvXjWQFIv9c2h24JrQLLFJ2aQVQf/Cvl1vblnd4r2apLQ==", + "license": "MIT", + "dependencies": { + "debug": "~4.4.1", + "ws": "~8.18.3" + } + }, + "node_modules/socket.io-adapter/node_modules/ws": { + "version": "8.18.3", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.18.3.tgz", + "integrity": "sha512-PEIGCY5tSlUt50cqyMXfCzX+oOPqN0vuGqWzbcJ2xvnkzkq46oOpz7dQaTDBdfICb4N14+GARUDw2XV2N4tvzg==", + "license": "MIT", + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": ">=5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, + "node_modules/socket.io-client": { + "version": "4.8.3", + "resolved": "https://registry.npmjs.org/socket.io-client/-/socket.io-client-4.8.3.tgz", + "integrity": "sha512-uP0bpjWrjQmUt5DTHq9RuoCBdFJF10cdX9X+a368j/Ft0wmaVgxlrjvK3kjvgCODOMMOz9lcaRzxmso0bTWZ/g==", + "license": "MIT", + "dependencies": { + "@socket.io/component-emitter": "~3.1.0", + "debug": "~4.4.1", + "engine.io-client": "~6.6.1", + "socket.io-parser": "~4.2.4" + }, + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/socket.io-parser": { + "version": "4.2.5", + "resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-4.2.5.tgz", + "integrity": "sha512-bPMmpy/5WWKHea5Y/jYAP6k74A+hvmRCQaJuJB6I/ML5JZq/KfNieUVo/3Mh7SAqn7TyFdIo6wqYHInG1MU1bQ==", + "license": "MIT", + "dependencies": { + "@socket.io/component-emitter": "~3.1.0", + "debug": "~4.4.1" + }, + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/socks": { + "version": "2.8.7", + "resolved": "https://registry.npmjs.org/socks/-/socks-2.8.7.tgz", + "integrity": "sha512-HLpt+uLy/pxB+bum/9DzAgiKS8CX1EvbWxI4zlmgGCExImLdiad2iCwXT5Z4c9c3Eq8rP2318mPW2c+QbtjK8A==", + "license": "MIT", + "dependencies": { + "ip-address": "^10.0.1", + "smart-buffer": "^4.2.0" + }, + "engines": { + "node": ">= 10.0.0", + "npm": ">= 3.0.0" + } + }, + "node_modules/socks-proxy-agent": { + "version": "8.0.5", + "resolved": "https://registry.npmjs.org/socks-proxy-agent/-/socks-proxy-agent-8.0.5.tgz", + "integrity": "sha512-HehCEsotFqbPW9sJ8WVYB6UbmIMv7kUUORIF2Nncq4VQvBfNBLibW9YZR5dlYCSUhwcD628pRllm7n+E+YTzJw==", + "license": "MIT", + "dependencies": { + "agent-base": "^7.1.2", + "debug": "^4.3.4", + "socks": "^2.8.3" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/socks-proxy-agent/node_modules/agent-base": { + "version": "7.1.4", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.4.tgz", + "integrity": "sha512-MnA+YT8fwfJPgBx3m60MNqakm30XOkyIoH1y6huTQvC0PwZG7ki8NacLBcrPbNoo8vEZy7Jpuk7+jMO+CUovTQ==", + "license": "MIT", + "engines": { + "node": ">= 14" + } + }, + "node_modules/sort-keys": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/sort-keys/-/sort-keys-2.0.0.tgz", + "integrity": "sha512-/dPCrG1s3ePpWm6yBbxZq5Be1dXGLyLn9Z791chDC3NFrpkVbWGzkBwPN1knaciexFXgRJ7hzdnwZ4stHSDmjg==", + "license": "MIT", + "dependencies": { + "is-plain-obj": "^1.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/sort-paths": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/sort-paths/-/sort-paths-1.1.1.tgz", + "integrity": "sha512-khy0t3pqjZPcQK5hId33EnxlzkFhB5JsxBWKj2IixGwP9SdoRl36eKJC25GgbF1vrXAzLnJsh/0+QScksUZTDg==", + "license": "MIT", + "dependencies": { + "split-retain": "^1.0.1" + } + }, + "node_modules/source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/source-map-js": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", + "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/source-map-loader": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/source-map-loader/-/source-map-loader-2.0.2.tgz", + "integrity": "sha512-yIYkFOsKn+OdOirRJUPQpnZiMkF74raDVQjj5ni3SzbOiA57SabeX80R5zyMQAKpvKySA3Z4a85vFX3bvpC6KQ==", + "license": "MIT", + "dependencies": { + "abab": "^2.0.5", + "iconv-lite": "^0.6.2", + "source-map-js": "^0.6.2" + }, + "engines": { + "node": ">= 10.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + }, + "peerDependencies": { + "webpack": "^5.0.0" + } + }, + "node_modules/source-map-loader/node_modules/source-map-js": { + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-0.6.2.tgz", + "integrity": "sha512-/3GptzWzu0+0MBQFrDKzw/DvvMTUORvgY6k6jd/VS6iCR4RDTKWH6v6WPwQoUO8667uQEf9Oe38DxAYWY5F/Ug==", + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/source-map-support": { + "version": "0.5.21", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz", + "integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==", + "license": "MIT", + "dependencies": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + } + }, + "node_modules/spawn-command": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/spawn-command/-/spawn-command-0.0.2.tgz", + "integrity": "sha512-zC8zGoGkmc8J9ndvml8Xksr1Amk9qBujgbF0JAIWO7kXr43w0h/0GJNM/Vustixu+YE8N/MTrQ7N31FvHUACxQ==", + "dev": true + }, + "node_modules/spawn-wrap": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/spawn-wrap/-/spawn-wrap-2.0.0.tgz", + "integrity": "sha512-EeajNjfN9zMnULLwhZZQU3GWBoFNkbngTUPfaawT4RkMiviTxcX0qfhVbGey39mfctfDHkWtuecgQ8NJcyQWHg==", + "dev": true, + "license": "ISC", + "dependencies": { + "foreground-child": "^2.0.0", + "is-windows": "^1.0.2", + "make-dir": "^3.0.0", + "rimraf": "^3.0.0", + "signal-exit": "^3.0.2", + "which": "^2.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/spawn-wrap/node_modules/foreground-child": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-2.0.0.tgz", + "integrity": "sha512-dCIq9FpEcyQyXKCkyzmlPTFNgrCzPudOe+mhvJU5zAtlBnGVy2yKxtfsxK2tQBThwq225jcvBjpw1Gr40uzZCA==", + "dev": true, + "license": "ISC", + "dependencies": { + "cross-spawn": "^7.0.0", + "signal-exit": "^3.0.2" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/spawn-wrap/node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "dev": true, + "license": "ISC" + }, + "node_modules/spawn-wrap/node_modules/make-dir": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", + "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", + "dev": true, + "license": "MIT", + "dependencies": { + "semver": "^6.0.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/spawn-wrap/node_modules/rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "deprecated": "Rimraf versions prior to v4 are no longer supported", + "dev": true, + "license": "ISC", + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/spawn-wrap/node_modules/semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/spawn-wrap/node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "license": "ISC", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/spdx-correct": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.2.0.tgz", + "integrity": "sha512-kN9dJbvnySHULIluDHy32WHRUu3Og7B9sbY7tsFLctQkIqnMh3hErYgdMjTYuqmcXX+lK5T1lnUt3G7zNswmZA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "spdx-expression-parse": "^3.0.0", + "spdx-license-ids": "^3.0.0" + } + }, + "node_modules/spdx-exceptions": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.5.0.tgz", + "integrity": "sha512-PiU42r+xO4UbUS1buo3LPJkjlO7430Xn5SVAhdpzzsPHsjbYVflnnFdATgabnLude+Cqu25p6N+g2lw/PFsa4w==", + "dev": true, + "license": "CC-BY-3.0" + }, + "node_modules/spdx-expression-parse": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz", + "integrity": "sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "spdx-exceptions": "^2.1.0", + "spdx-license-ids": "^3.0.0" + } + }, + "node_modules/spdx-license-ids": { + "version": "3.0.22", + "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.22.tgz", + "integrity": "sha512-4PRT4nh1EImPbt2jASOKHX7PB7I+e4IWNLvkKFDxNhJlfjbYlleYQh285Z/3mPTHSAK/AvdMmw5BNNuYH8ShgQ==", + "dev": true, + "license": "CC0-1.0" + }, + "node_modules/split": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/split/-/split-1.0.1.tgz", + "integrity": "sha512-mTyOoPbrivtXnwnIxZRFYRrPNtEFKlpB2fvjSnCQUiAA6qAZzqwna5envK4uk6OIeP17CsdF3rSBGYVBsU0Tkg==", + "dev": true, + "license": "MIT", + "dependencies": { + "through": "2" + }, + "engines": { + "node": "*" + } + }, + "node_modules/split-ca": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/split-ca/-/split-ca-1.0.1.tgz", + "integrity": "sha512-Q5thBSxp5t8WPTTJQS59LrGqOZqOsrhDGDVm8azCqIBjSBd7nd9o2PM+mDulQQkh8h//4U6hFZnc/mul8t5pWQ==", + "license": "ISC" + }, + "node_modules/split-retain": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/split-retain/-/split-retain-1.0.1.tgz", + "integrity": "sha512-TAsNK+sKP2+A6FLGiSWXPj0gYUF6Ls+YKG6pm+vy/0vzmSxAPrQNpZaS8/TqeObs4YxHHgLQGxeW0azfrK9Ebg==", + "license": "MIT" + }, + "node_modules/split2": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/split2/-/split2-3.2.2.tgz", + "integrity": "sha512-9NThjpgZnifTkJpzTZ7Eue85S49QwpNhZTq6GRJwObb6jnLFNGB7Qm73V5HewTROPyxD0C29xqmaI68bQtV+hg==", + "dev": true, + "license": "ISC", + "dependencies": { + "readable-stream": "^3.0.0" + } + }, + "node_modules/sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==", + "dev": true, + "license": "BSD-3-Clause" + }, + "node_modules/ssh-config": { + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/ssh-config/-/ssh-config-5.0.4.tgz", + "integrity": "sha512-nCCJTY30Alhm8CWhhN8Yr1YAx2WOrDBLMMh7JYGrzCj3qssTPV+v10hYimd+8wJJeV10VrN8lFumawAEfEwjNA==", + "license": "MIT" + }, + "node_modules/ssh2": { + "version": "1.17.0", + "resolved": "https://registry.npmjs.org/ssh2/-/ssh2-1.17.0.tgz", + "integrity": "sha512-wPldCk3asibAjQ/kziWQQt1Wh3PgDFpC0XpwclzKcdT1vql6KeYxf5LIt4nlFkUeR8WuphYMKqUA56X4rjbfgQ==", + "hasInstallScript": true, + "dependencies": { + "asn1": "^0.2.6", + "bcrypt-pbkdf": "^1.0.2" + }, + "engines": { + "node": ">=10.16.0" + }, + "optionalDependencies": { + "cpu-features": "~0.0.10", + "nan": "^2.23.0" + } + }, + "node_modules/ssh2-sftp-client": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/ssh2-sftp-client/-/ssh2-sftp-client-9.1.0.tgz", + "integrity": "sha512-Hzdr9OE6GxZjcmyM9tgBSIFVyrHAp9c6U2Y4yBkmYOHoQvZ7pIm27dmltvcmRfxcWiIcg8HBvG5iAikDf+ZuzQ==", + "license": "Apache-2.0", + "dependencies": { + "concat-stream": "^2.0.0", + "promise-retry": "^2.0.1", + "ssh2": "^1.12.0" + }, + "engines": { + "node": ">=10.24.1" + } + }, + "node_modules/ssri": { + "version": "12.0.0", + "resolved": "https://registry.npmjs.org/ssri/-/ssri-12.0.0.tgz", + "integrity": "sha512-S7iGNosepx9RadX82oimUkvr0Ct7IjJbEbs4mJcTxst8um95J3sDYU1RBEOvdu6oL1Wek2ODI5i4MAw+dZ6cAQ==", + "dev": true, + "license": "ISC", + "dependencies": { + "minipass": "^7.0.3" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/stat-mode": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/stat-mode/-/stat-mode-1.0.0.tgz", + "integrity": "sha512-jH9EhtKIjuXZ2cWxmXS8ZP80XyC3iasQxMDV8jzhNJpfDb7VbQLVW4Wvsxz9QZvzV+G4YoSfBUVKDOyxLzi/sg==", + "license": "MIT", + "engines": { + "node": ">= 6" + } + }, + "node_modules/statuses": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.2.tgz", + "integrity": "sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/stop-iteration-iterator": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/stop-iteration-iterator/-/stop-iteration-iterator-1.1.0.tgz", + "integrity": "sha512-eLoXW/DHyl62zxY4SCaIgnRhuMr6ri4juEYARS8E6sCEqzKpOiE521Ucofdx+KnDZl5xmvGYaaKCk5FEOxJCoQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "internal-slot": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/stream-combiner": { + "version": "0.0.4", + "resolved": "https://registry.npmjs.org/stream-combiner/-/stream-combiner-0.0.4.tgz", + "integrity": "sha512-rT00SPnTVyRsaSz5zgSPma/aHSOic5U1prhYdRy5HS2kTZviFpmDgzilbtsJsxiroqACmayynDN/9VzIbX5DOw==", + "dev": true, + "license": "MIT", + "dependencies": { + "duplexer": "~0.1.1" + } + }, + "node_modules/stream-shift": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/stream-shift/-/stream-shift-1.0.3.tgz", + "integrity": "sha512-76ORR0DO1o1hlKwTbi/DM3EXWGf3ZJYO8cXX5RJwnul2DEg2oyoZyjLNoQM8WsvZiFKCRfC1O0J7iCvie3RZmQ==", + "license": "MIT" + }, + "node_modules/streamsearch": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/streamsearch/-/streamsearch-1.1.0.tgz", + "integrity": "sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg==", + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/streamx": { + "version": "2.23.0", + "resolved": "https://registry.npmjs.org/streamx/-/streamx-2.23.0.tgz", + "integrity": "sha512-kn+e44esVfn2Fa/O0CPFcex27fjIL6MkVae0Mm6q+E6f0hWv578YCERbv+4m02cjxvDsPKLnmxral/rR6lBMAg==", + "license": "MIT", + "dependencies": { + "events-universal": "^1.0.0", + "fast-fifo": "^1.3.2", + "text-decoder": "^1.1.0" + } + }, + "node_modules/string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.2.0" + } + }, + "node_modules/string-argv": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/string-argv/-/string-argv-0.1.2.tgz", + "integrity": "sha512-mBqPGEOMNJKXRo7z0keX0wlAhbBAjilUdPW13nN0PecVryZxdHIeM7TqbsSUA7VYuS00HGC6mojP7DlQzfa9ZA==", + "license": "MIT", + "engines": { + "node": ">=0.6.19" + } + }, + "node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "license": "MIT", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/string-width-cjs": { + "name": "string-width", + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "license": "MIT", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/string.prototype.matchall": { + "version": "4.0.12", + "resolved": "https://registry.npmjs.org/string.prototype.matchall/-/string.prototype.matchall-4.0.12.tgz", + "integrity": "sha512-6CC9uyBL+/48dYizRf7H7VAYCMCNTBeM78x/VTUe9bFEaxBepPJDa1Ow99LqI/1yF7kuy7Q3cQsYMrcjGUcskA==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.3", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.6", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.0.0", + "get-intrinsic": "^1.2.6", + "gopd": "^1.2.0", + "has-symbols": "^1.1.0", + "internal-slot": "^1.1.0", + "regexp.prototype.flags": "^1.5.3", + "set-function-name": "^2.0.2", + "side-channel": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/string.prototype.repeat": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/string.prototype.repeat/-/string.prototype.repeat-1.0.0.tgz", + "integrity": "sha512-0u/TldDbKD8bFCQ/4f5+mNRrXwZ8hg2w7ZR8wa16e8z9XpePWl3eGEcUD0OXpEH/VJH/2G3gjUtR3ZOiBe2S/w==", + "dev": true, + "license": "MIT", + "dependencies": { + "define-properties": "^1.1.3", + "es-abstract": "^1.17.5" + } + }, + "node_modules/string.prototype.trim": { + "version": "1.2.10", + "resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.2.10.tgz", + "integrity": "sha512-Rs66F0P/1kedk5lyYyH9uBzuiI/kNRmwJAR9quK6VOtIpZ2G+hMZd+HQbbv25MgCA6gEffoMZYxlTod4WcdrKA==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.2", + "define-data-property": "^1.1.4", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.5", + "es-object-atoms": "^1.0.0", + "has-property-descriptors": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/string.prototype.trimend": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.9.tgz", + "integrity": "sha512-G7Ok5C6E/j4SGfyLCloXTrngQIQU3PWtXGst3yM7Bea9FRURf1S42ZHlZZtsNque2FN2PoUhfZXYLNWwEr4dLQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.2", + "define-properties": "^1.2.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/string.prototype.trimstart": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.8.tgz", + "integrity": "sha512-UXSH262CSZY1tfu3G3Secr6uGLCFVPMhIqHjlgCUtCCcgihYc/xKs9djMTMUOb2j1mVSeU8EU6NWc/iQKU6Gfg==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-ansi-cjs": { + "name": "strip-ansi", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-bom": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-4.0.0.tgz", + "integrity": "sha512-3xurFv5tEgii33Zi8Jtp55wEIILR9eh34FAW00PZf+JnSsTmV/ioewSgQl97JHvgjoRGwPShsWm+IdrxB35d0w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-dirs": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/strip-dirs/-/strip-dirs-2.1.0.tgz", + "integrity": "sha512-JOCxOeKLm2CAS73y/U4ZeZPTkE+gNVCzKt7Eox84Iej1LT/2pTWYpZKJuxwQpvX1LiZb1xokNR7RLfuBAa7T3g==", + "license": "MIT", + "dependencies": { + "is-natural-number": "^4.0.1" + } + }, + "node_modules/strip-final-newline": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz", + "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/strip-indent": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-3.0.0.tgz", + "integrity": "sha512-laJTa3Jb+VQpaC6DseHhF7dXVqHTfJPCRDaEbid/drOhgitgYku/letMUqOXFoWV0zIIUbjpdH2t+tYj4bQMRQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "min-indent": "^1.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "license": "MIT", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/strip-outer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/strip-outer/-/strip-outer-1.0.1.tgz", + "integrity": "sha512-k55yxKHwaXnpYGsOzg4Vl8+tDrWylxDEpknGjhTiZB8dFRU5rTo9CAzeycivxV3s+zlTKwrs6WxMxR95n26kwg==", + "license": "MIT", + "dependencies": { + "escape-string-regexp": "^1.0.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/strip-outer/node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "license": "MIT", + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/style-loader": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/style-loader/-/style-loader-2.0.0.tgz", + "integrity": "sha512-Z0gYUJmzZ6ZdRUqpg1r8GsaFKypE+3xAzuFeMuoHgjc9KZv3wMyCRjQIWEbhoFSq7+7yoHXySDJyyWQaPajeiQ==", + "license": "MIT", + "dependencies": { + "loader-utils": "^2.0.0", + "schema-utils": "^3.0.0" + }, + "engines": { + "node": ">= 10.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + }, + "peerDependencies": { + "webpack": "^4.0.0 || ^5.0.0" + } + }, + "node_modules/style-loader/node_modules/schema-utils": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.3.0.tgz", + "integrity": "sha512-pN/yOAvcC+5rQ5nERGuwrjLlYvLTbCibnZ1I7B1LaiAz9BRBlE9GMgE/eqV30P7aJQUf7Ddimy/RsbYO/GrVGg==", + "license": "MIT", + "dependencies": { + "@types/json-schema": "^7.0.8", + "ajv": "^6.12.5", + "ajv-keywords": "^3.5.2" + }, + "engines": { + "node": ">= 10.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + } + }, + "node_modules/sumchecker": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/sumchecker/-/sumchecker-3.0.1.tgz", + "integrity": "sha512-MvjXzkz/BOfyVDkG0oFOtBxHX2u3gKbMHIF/dXblZsgD3BWOFLmHovIpZY7BykJdAjcqRCBi1WYBNdEC9yI7vg==", + "license": "Apache-2.0", + "dependencies": { + "debug": "^4.1.0" + }, + "engines": { + "node": ">= 8.0" + } + }, + "node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "license": "MIT", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/symbol-tree": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.4.tgz", + "integrity": "sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==", + "dev": true, + "license": "MIT" + }, + "node_modules/syswide-cas": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/syswide-cas/-/syswide-cas-5.3.0.tgz", + "integrity": "sha512-+RLgS6VInsX8rBpL+gy5qpa7phngecbK7NABelBZpqYpBTwOIK1y7CqHlXK5Vy/rA4erD9q/FyKzMjx2uX3zYg==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/tapable": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/tapable/-/tapable-2.3.0.tgz", + "integrity": "sha512-g9ljZiwki/LfxmQADO3dEY1CbpmXT5Hm2fJ+QaGKwSXUylMybePR7/67YW7jOrrvjEgL1Fmz5kzyAjWVWLlucg==", + "license": "MIT", + "engines": { + "node": ">=6" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + } + }, + "node_modules/tar": { + "version": "7.5.7", + "resolved": "https://registry.npmjs.org/tar/-/tar-7.5.7.tgz", + "integrity": "sha512-fov56fJiRuThVFXD6o6/Q354S7pnWMJIVlDBYijsTNx6jKSE4pvrDTs6lUnmGvNyfJwFQQwWy3owKz1ucIhveQ==", + "dev": true, + "license": "BlueOak-1.0.0", + "dependencies": { + "@isaacs/fs-minipass": "^4.0.0", + "chownr": "^3.0.0", + "minipass": "^7.1.2", + "minizlib": "^3.1.0", + "yallist": "^5.0.0" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/tar-fs": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-3.1.1.tgz", + "integrity": "sha512-LZA0oaPOc2fVo82Txf3gw+AkEd38szODlptMYejQUhndHMLQ9M059uXR+AfS7DNo0NpINvSqDsvyaCrBVkptWg==", + "license": "MIT", + "dependencies": { + "pump": "^3.0.0", + "tar-stream": "^3.1.5" + }, + "optionalDependencies": { + "bare-fs": "^4.0.1", + "bare-path": "^3.0.0" + } + }, + "node_modules/tar-fs/node_modules/tar-stream": { + "version": "3.1.7", + "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-3.1.7.tgz", + "integrity": "sha512-qJj60CXt7IU1Ffyc3NJMjh6EkuCFej46zUqJ4J7pqYlThyd9bO0XBTmcOIhSzZJVWfsLks0+nle/j538YAW9RQ==", + "license": "MIT", + "dependencies": { + "b4a": "^1.6.4", + "fast-fifo": "^1.2.0", + "streamx": "^2.15.0" + } + }, + "node_modules/tar-stream": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.2.0.tgz", + "integrity": "sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ==", + "license": "MIT", + "dependencies": { + "bl": "^4.0.3", + "end-of-stream": "^1.4.1", + "fs-constants": "^1.0.0", + "inherits": "^2.0.3", + "readable-stream": "^3.1.1" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/tar/node_modules/yallist": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-5.0.0.tgz", + "integrity": "sha512-YgvUTfwqyc7UXVMrB+SImsVYSmTS8X/tSrtdNZMImM+n7+QTriRXyXim0mBrTXNeqzVF0KWGgHPeiyViFFrNDw==", + "dev": true, + "license": "BlueOak-1.0.0", + "engines": { + "node": ">=18" + } + }, + "node_modules/tdigest": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/tdigest/-/tdigest-0.1.2.tgz", + "integrity": "sha512-+G0LLgjjo9BZX2MfdvPfH+MKLCrxlXSYec5DaPYP1fe6Iyhf0/fSmJ0bFiZ1F8BT6cGXl2LpltQptzjXKWEkKA==", + "license": "MIT", + "dependencies": { + "bintrees": "1.0.2" + } + }, + "node_modules/temp": { + "version": "0.9.4", + "resolved": "https://registry.npmjs.org/temp/-/temp-0.9.4.tgz", + "integrity": "sha512-yYrrsWnrXMcdsnu/7YMYAofM1ktpL5By7vZhf15CrXijWWrEYZks5AXBudalfSWJLlnen/QUJUB5aoB0kqZUGA==", + "license": "MIT", + "dependencies": { + "mkdirp": "^0.5.1", + "rimraf": "~2.6.2" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/temp-dir": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/temp-dir/-/temp-dir-1.0.0.tgz", + "integrity": "sha512-xZFXEGbG7SNC3itwBzI3RYjq/cEhBkx2hJuKGIUOcEULmkQExXiHat2z/qkISYsuR+IKumhEfKKbV5qXmhICFQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/temp-file": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/temp-file/-/temp-file-3.4.0.tgz", + "integrity": "sha512-C5tjlC/HCtVUOi3KWVokd4vHVViOmGjtLwIh4MuzPo/nMYTV/p1urt3RnMz2IWXDdKEGJH3k5+KPxtqRsUYGtg==", + "dev": true, + "license": "MIT", + "dependencies": { + "async-exit-hook": "^2.0.1", + "fs-extra": "^10.0.0" + } + }, + "node_modules/temp-file/node_modules/fs-extra": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.1.0.tgz", + "integrity": "sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/temp-file/node_modules/jsonfile": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.2.0.tgz", + "integrity": "sha512-FGuPw30AdOIUTRMC2OMRtQV+jkVj2cfPqSeWXv1NEAJ1qZ5zb1X6z1mFhbfOB/iy3ssJCD+3KuZ8r8C3uVFlAg==", + "dev": true, + "license": "MIT", + "dependencies": { + "universalify": "^2.0.0" + }, + "optionalDependencies": { + "graceful-fs": "^4.1.6" + } + }, + "node_modules/temp-file/node_modules/universalify": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz", + "integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 10.0.0" + } + }, + "node_modules/temp/node_modules/rimraf": { + "version": "2.6.3", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz", + "integrity": "sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==", + "deprecated": "Rimraf versions prior to v4 are no longer supported", + "license": "ISC", + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + } + }, + "node_modules/terser": { + "version": "5.46.0", + "resolved": "https://registry.npmjs.org/terser/-/terser-5.46.0.tgz", + "integrity": "sha512-jTwoImyr/QbOWFFso3YoU3ik0jBBDJ6JTOQiy/J2YxVJdZCc+5u7skhNwiOR3FQIygFqVUPHl7qbbxtjW2K3Qg==", + "license": "BSD-2-Clause", + "dependencies": { + "@jridgewell/source-map": "^0.3.3", + "acorn": "^8.15.0", + "commander": "^2.20.0", + "source-map-support": "~0.5.20" + }, + "bin": { + "terser": "bin/terser" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/terser-webpack-plugin": { + "version": "5.3.16", + "resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-5.3.16.tgz", + "integrity": "sha512-h9oBFCWrq78NyWWVcSwZarJkZ01c2AyGrzs1crmHZO3QUg9D61Wu4NPjBy69n7JqylFF5y+CsUZYmYEIZ3mR+Q==", + "license": "MIT", + "dependencies": { + "@jridgewell/trace-mapping": "^0.3.25", + "jest-worker": "^27.4.5", + "schema-utils": "^4.3.0", + "serialize-javascript": "^6.0.2", + "terser": "^5.31.1" + }, + "engines": { + "node": ">= 10.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + }, + "peerDependencies": { + "webpack": "^5.1.0" + }, + "peerDependenciesMeta": { + "@swc/core": { + "optional": true + }, + "esbuild": { + "optional": true + }, + "uglify-js": { + "optional": true + } + } + }, + "node_modules/terser-webpack-plugin/node_modules/ajv": { + "version": "8.17.1", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.17.1.tgz", + "integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==", + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^3.1.3", + "fast-uri": "^3.0.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/terser-webpack-plugin/node_modules/ajv-formats": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ajv-formats/-/ajv-formats-2.1.1.tgz", + "integrity": "sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA==", + "license": "MIT", + "dependencies": { + "ajv": "^8.0.0" + }, + "peerDependencies": { + "ajv": "^8.0.0" + }, + "peerDependenciesMeta": { + "ajv": { + "optional": true + } + } + }, + "node_modules/terser-webpack-plugin/node_modules/ajv-keywords": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-5.1.0.tgz", + "integrity": "sha512-YCS/JNFAUyr5vAuhk1DWm1CBxRHW9LbJ2ozWeemrIqpbsqKjHVxYPyi5GC0rjZIT5JxJ3virVTS8wk4i/Z+krw==", + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^3.1.3" + }, + "peerDependencies": { + "ajv": "^8.8.2" + } + }, + "node_modules/terser-webpack-plugin/node_modules/json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "license": "MIT" + }, + "node_modules/terser-webpack-plugin/node_modules/schema-utils": { + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-4.3.3.tgz", + "integrity": "sha512-eflK8wEtyOE6+hsaRVPxvUKYCpRgzLqDTb8krvAsRIwOGlHoSgYLgBXoubGgLd2fT41/OUYdb48v4k4WWHQurA==", + "license": "MIT", + "dependencies": { + "@types/json-schema": "^7.0.9", + "ajv": "^8.9.0", + "ajv-formats": "^2.1.1", + "ajv-keywords": "^5.1.0" + }, + "engines": { + "node": ">= 10.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + } + }, + "node_modules/terser-webpack-plugin/node_modules/serialize-javascript": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.2.tgz", + "integrity": "sha512-Saa1xPByTTq2gdeFZYLLo+RFE35NHZkAbqZeWNd3BpzppeVisAqpDjcp8dyf6uIvEqJRd46jemmyA4iFIeVk8g==", + "license": "BSD-3-Clause", + "dependencies": { + "randombytes": "^2.1.0" + } + }, + "node_modules/terser/node_modules/commander": { + "version": "2.20.3", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", + "license": "MIT" + }, + "node_modules/test-exclude": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-6.0.0.tgz", + "integrity": "sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w==", + "dev": true, + "license": "ISC", + "dependencies": { + "@istanbuljs/schema": "^0.1.2", + "glob": "^7.1.4", + "minimatch": "^3.0.4" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/test-exclude/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/text-decoder": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/text-decoder/-/text-decoder-1.2.3.tgz", + "integrity": "sha512-3/o9z3X0X0fTupwsYvR03pJ/DjWuqqrfwBgTQzdWDiQSm9KitAyz/9WqsT2JQW7KV2m+bC2ol/zqpW37NHxLaA==", + "license": "Apache-2.0", + "dependencies": { + "b4a": "^1.6.4" + } + }, + "node_modules/text-extensions": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/text-extensions/-/text-extensions-1.9.0.tgz", + "integrity": "sha512-wiBrwC1EhBelW12Zy26JeOUkQ5mRu+5o8rpsJk5+2t+Y5vE7e842qtZDQ2g1NpX/29HdyFeJ4nSIhI47ENSxlQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10" + } + }, + "node_modules/text-table": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", + "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==", + "dev": true, + "license": "MIT" + }, + "node_modules/through": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", + "integrity": "sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==", + "license": "MIT" + }, + "node_modules/through2": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz", + "integrity": "sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ==", + "license": "MIT", + "dependencies": { + "readable-stream": "~2.3.6", + "xtend": "~4.0.1" + } + }, + "node_modules/through2/node_modules/isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==", + "license": "MIT" + }, + "node_modules/through2/node_modules/readable-stream": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", + "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", + "license": "MIT", + "dependencies": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "node_modules/through2/node_modules/safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "license": "MIT" + }, + "node_modules/through2/node_modules/string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.1.0" + } + }, + "node_modules/tinyglobby": { + "version": "0.2.12", + "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.12.tgz", + "integrity": "sha512-qkf4trmKSIiMTs/E63cxH+ojC2unam7rJ0WrauAzpT3ECNTxGRMlaXxVbfxMUC/w0LaYk6jQ4y/nGR9uBO3tww==", + "dev": true, + "license": "MIT", + "dependencies": { + "fdir": "^6.4.3", + "picomatch": "^4.0.2" + }, + "engines": { + "node": ">=12.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/SuperchupuDev" + } + }, + "node_modules/tmp": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.5.tgz", + "integrity": "sha512-voyz6MApa1rQGUxT3E+BK7/ROe8itEx7vD8/HEvt4xwXucvQ5G5oeEiHkmHZJuBO21RpOf+YYm9MOivj709jow==", + "license": "MIT", + "engines": { + "node": ">=14.14" + } + }, + "node_modules/tmp-promise": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/tmp-promise/-/tmp-promise-3.0.3.tgz", + "integrity": "sha512-RwM7MoPojPxsOBYnyd2hy0bxtIlVrihNs9pj5SUvY8Zz1sQcQG2tG1hSr8PDxfgEB8RNKDhqbIlroIarSNDNsQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "tmp": "^0.2.0" + } + }, + "node_modules/to-buffer": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/to-buffer/-/to-buffer-1.2.2.tgz", + "integrity": "sha512-db0E3UJjcFhpDhAF4tLo03oli3pwl3dbnzXOUIlRKrp+ldk/VUxzpWYZENsw2SZiuBjHAk7DfB0VU7NKdpb6sw==", + "license": "MIT", + "dependencies": { + "isarray": "^2.0.5", + "safe-buffer": "^5.2.1", + "typed-array-buffer": "^1.0.3" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "license": "MIT", + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/toidentifier": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", + "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", + "license": "MIT", + "engines": { + "node": ">=0.6" + } + }, + "node_modules/tough-cookie": { + "version": "4.1.4", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.1.4.tgz", + "integrity": "sha512-Loo5UUvLD9ScZ6jh8beX1T6sO1w2/MpCRpEP7V280GKMVUQ0Jzar2U3UJPsrdbziLEMMhu3Ujnq//rhiFuIeag==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "psl": "^1.1.33", + "punycode": "^2.1.1", + "universalify": "^0.2.0", + "url-parse": "^1.5.3" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/tough-cookie/node_modules/universalify": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.2.0.tgz", + "integrity": "sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 4.0.0" + } + }, + "node_modules/tr46": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-4.1.1.tgz", + "integrity": "sha512-2lv/66T7e5yNyhAAC4NaKe5nVavzuGJQVVtRYLyQ2OI8tsJ61PMLlelehb0wi2Hx6+hT/OJUWZcw8MjlSRnxvw==", + "dev": true, + "license": "MIT", + "dependencies": { + "punycode": "^2.3.0" + }, + "engines": { + "node": ">=14" + } + }, + "node_modules/trash": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/trash/-/trash-7.2.0.tgz", + "integrity": "sha512-3bR8Z5aWO8b9qybS6skBoaavH/hX9Onb1RrdIIhJxv9VpH3aBtpbKuAX4rIh/0xpDZ7K4ga36wONk/okbhjTlA==", + "license": "MIT", + "dependencies": { + "@stroncium/procfs": "^1.2.1", + "globby": "^7.1.1", + "is-path-inside": "^3.0.2", + "make-dir": "^3.1.0", + "move-file": "^2.0.0", + "p-map": "^4.0.0", + "uuid": "^8.3.2", + "xdg-trashdir": "^3.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/trash/node_modules/array-union": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-1.0.2.tgz", + "integrity": "sha512-Dxr6QJj/RdU/hCaBjOfxW+q6lyuVE6JFWIrAUpuOOhoJJoQ99cUn3igRaHVB5P9WrgFVN0FfArM3x0cueOU8ng==", + "license": "MIT", + "dependencies": { + "array-uniq": "^1.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/trash/node_modules/dir-glob": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-2.2.2.tgz", + "integrity": "sha512-f9LBi5QWzIW3I6e//uxZoLBlUt9kcp66qo0sSCxL6YZKc75R1c4MFCoe/LaZiBGmgujvQdxc5Bn3QhfyvK5Hsw==", + "license": "MIT", + "dependencies": { + "path-type": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/trash/node_modules/globby": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/globby/-/globby-7.1.1.tgz", + "integrity": "sha512-yANWAN2DUcBtuus5Cpd+SKROzXHs2iVXFZt/Ykrfz6SAXqacLX25NZpltE+39ceMexYF4TtEadjuSTw8+3wX4g==", + "license": "MIT", + "dependencies": { + "array-union": "^1.0.1", + "dir-glob": "^2.0.0", + "glob": "^7.1.2", + "ignore": "^3.3.5", + "pify": "^3.0.0", + "slash": "^1.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/trash/node_modules/ignore": { + "version": "3.3.10", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-3.3.10.tgz", + "integrity": "sha512-Pgs951kaMm5GXP7MOvxERINe3gsaVjUWFm+UZPSq9xYriQAksyhg0csnS0KXSNRD5NmNdapXEpjxG49+AKh/ug==", + "license": "MIT" + }, + "node_modules/trash/node_modules/make-dir": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", + "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", + "license": "MIT", + "dependencies": { + "semver": "^6.0.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/trash/node_modules/path-type": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-3.0.0.tgz", + "integrity": "sha512-T2ZUsdZFHgA3u4e5PfPbjd7HDDpxPnQb5jN0SrDsjNSuVXHJqtwTnWqG0B1jZrgmJ/7lj1EmVIByWt1gxGkWvg==", + "license": "MIT", + "dependencies": { + "pify": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/trash/node_modules/pify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", + "integrity": "sha512-C3FsVNH1udSEX48gGX1xfvwTWfsYWj5U+8/uK15BGzIGrKoUpghX8hWZwa/OFnakBiiVNmBvemTJR5mcy7iPcg==", + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/trash/node_modules/semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/trash/node_modules/slash": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-1.0.0.tgz", + "integrity": "sha512-3TYDR7xWt4dIqV2JauJr+EJeW356RXijHeUlO+8djJ+uBXPn8/2dpzBc8yQhh583sVvc9CvFAeQVgijsH+PNNg==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/traverse": { + "version": "0.3.9", + "resolved": "https://registry.npmjs.org/traverse/-/traverse-0.3.9.tgz", + "integrity": "sha512-iawgk0hLP3SxGKDfnDJf8wTz4p2qImnyihM5Hh/sGvQ3K37dPi/w8sRhdNIxYA1TwFwc5mDhIJq+O0RsvXBKdQ==", + "license": "MIT/X11", + "engines": { + "node": "*" + } + }, + "node_modules/tree-kill": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/tree-kill/-/tree-kill-1.2.2.tgz", + "integrity": "sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==", + "dev": true, + "license": "MIT", + "bin": { + "tree-kill": "cli.js" + } + }, + "node_modules/treeverse": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/treeverse/-/treeverse-3.0.0.tgz", + "integrity": "sha512-gcANaAnd2QDZFmHFEOF4k7uc1J/6a6z3DJMd/QwEyxLoKGiptJRwid582r7QIsFlFMIZ3SnxfS52S4hm2DHkuQ==", + "dev": true, + "license": "ISC", + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/trim-newlines": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-3.0.1.tgz", + "integrity": "sha512-c1PTsA3tYrIsLGkJkzHF+w9F2EyxfXGo4UyJc4pFL++FMjnq0HJS69T3M7d//gKrFKwy429bouPescbjecU+Zw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/trim-repeated": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/trim-repeated/-/trim-repeated-1.0.0.tgz", + "integrity": "sha512-pkonvlKk8/ZuR0D5tLW8ljt5I8kmxp2XKymhepUeOdCEfKpZaktSArkLHZt76OB1ZvO9bssUsDty4SWhLvZpLg==", + "license": "MIT", + "dependencies": { + "escape-string-regexp": "^1.0.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/trim-repeated/node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "license": "MIT", + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/truncate-utf8-bytes": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/truncate-utf8-bytes/-/truncate-utf8-bytes-1.0.2.tgz", + "integrity": "sha512-95Pu1QXQvruGEhv62XCMO3Mm90GscOCClvrIUwCM0PYOXK3kaF3l3sIHxx71ThJfcbM2O5Au6SO3AWCSEfW4mQ==", + "dev": true, + "license": "WTFPL", + "dependencies": { + "utf8-byte-length": "^1.0.1" + } + }, + "node_modules/ts-algebra": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ts-algebra/-/ts-algebra-2.0.0.tgz", + "integrity": "sha512-FPAhNPFMrkwz76P7cdjdmiShwMynZYN6SgOujD1urY4oNm80Ou9oMdmbR45LotcKOXoy7wSmHkRFE6Mxbrhefw==", + "license": "MIT" + }, + "node_modules/ts-api-utils": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-1.4.3.tgz", + "integrity": "sha512-i3eMG77UTMD0hZhgRS562pv83RC6ukSAC2GMNWc+9dieh/+jDM5u5YG+NHX6VNDRHQcHwmsTHctP9LhbC3WxVw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=16" + }, + "peerDependencies": { + "typescript": ">=4.2.0" + } + }, + "node_modules/ts-md5": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/ts-md5/-/ts-md5-1.3.1.tgz", + "integrity": "sha512-DiwiXfwvcTeZ5wCE0z+2A9EseZsztaiZtGrtSaY5JOD7ekPnR/GoIVD5gXZAlK9Na9Kvpo9Waz5rW64WKAWApg==", + "license": "MIT", + "engines": { + "node": ">=12" + } + }, + "node_modules/tsconfig-paths": { + "version": "3.15.0", + "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.15.0.tgz", + "integrity": "sha512-2Ac2RgzDe/cn48GvOe3M+o82pEFewD3UPbyoUHHdKasHwJKjds4fLXWf/Ux5kATBKN20oaFGu+jbElp1pos0mg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/json5": "^0.0.29", + "json5": "^1.0.2", + "minimist": "^1.2.6", + "strip-bom": "^3.0.0" + } + }, + "node_modules/tsconfig-paths/node_modules/json5": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.2.tgz", + "integrity": "sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA==", + "dev": true, + "license": "MIT", + "dependencies": { + "minimist": "^1.2.0" + }, + "bin": { + "json5": "lib/cli.js" + } + }, + "node_modules/tsconfig-paths/node_modules/strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/tslib": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", + "license": "0BSD" + }, + "node_modules/tslint": { + "version": "5.20.1", + "resolved": "https://registry.npmjs.org/tslint/-/tslint-5.20.1.tgz", + "integrity": "sha512-EcMxhzCFt8k+/UP5r8waCf/lzmeSyVlqxqMEDQE7rWYiQky8KpIBz1JAoYXfROHrPZ1XXd43q8yQnULOLiBRQg==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@babel/code-frame": "^7.0.0", + "builtin-modules": "^1.1.1", + "chalk": "^2.3.0", + "commander": "^2.12.1", + "diff": "^4.0.1", + "glob": "^7.1.1", + "js-yaml": "^3.13.1", + "minimatch": "^3.0.4", + "mkdirp": "^0.5.1", + "resolve": "^1.3.2", + "semver": "^5.3.0", + "tslib": "^1.8.0", + "tsutils": "^2.29.0" + }, + "bin": { + "tslint": "bin/tslint" + }, + "engines": { + "node": ">=4.8.0" + }, + "peerDependencies": { + "typescript": ">=2.3.0-dev || >=2.4.0-dev || >=2.5.0-dev || >=2.6.0-dev || >=2.7.0-dev || >=2.8.0-dev || >=2.9.0-dev || >=3.0.0-dev || >= 3.1.0-dev || >= 3.2.0-dev" + } + }, + "node_modules/tslint/node_modules/ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "license": "MIT", + "dependencies": { + "color-convert": "^1.9.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/tslint/node_modules/argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "dev": true, + "license": "MIT", + "dependencies": { + "sprintf-js": "~1.0.2" + } + }, + "node_modules/tslint/node_modules/chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/tslint/node_modules/color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "license": "MIT", + "dependencies": { + "color-name": "1.1.3" + } + }, + "node_modules/tslint/node_modules/color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", + "dev": true, + "license": "MIT" + }, + "node_modules/tslint/node_modules/commander": { + "version": "2.20.3", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/tslint/node_modules/diff": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.4.tgz", + "integrity": "sha512-X07nttJQkwkfKfvTPG/KSnE2OMdcUCao6+eXF3wmnIQRn2aPAHH3VxDbDOdegkd6JbPsXqShpvEOHfAT+nCNwQ==", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.3.1" + } + }, + "node_modules/tslint/node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/tslint/node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/tslint/node_modules/js-yaml": { + "version": "3.14.2", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.2.tgz", + "integrity": "sha512-PMSmkqxr106Xa156c2M265Z+FTrPl+oxd/rgOQy2tijQeK5TxQ43psO1ZCwhVOSdnn+RzkzlRz/eY4BgJBYVpg==", + "dev": true, + "license": "MIT", + "dependencies": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/tslint/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/tslint/node_modules/semver": { + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", + "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver" + } + }, + "node_modules/tslint/node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/tslint/node_modules/tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", + "dev": true, + "license": "0BSD" + }, + "node_modules/tsutils": { + "version": "2.29.0", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.29.0.tgz", + "integrity": "sha512-g5JVHCIJwzfISaXpXE1qvNalca5Jwob6FjI4AoPlqMusJ6ftFE7IkkFoMhVLRgK+4Kx3gkzb8UZK5t5yTTvEmA==", + "dev": true, + "license": "MIT", + "dependencies": { + "tslib": "^1.8.1" + }, + "peerDependencies": { + "typescript": ">=2.1.0 || >=2.1.0-dev || >=2.2.0-dev || >=2.3.0-dev || >=2.4.0-dev || >=2.5.0-dev || >=2.6.0-dev || >=2.7.0-dev || >=2.8.0-dev || >=2.9.0-dev || >= 3.0.0-dev || >= 3.1.0-dev" + } + }, + "node_modules/tsutils/node_modules/tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", + "dev": true, + "license": "0BSD" + }, + "node_modules/tuf-js": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/tuf-js/-/tuf-js-4.1.0.tgz", + "integrity": "sha512-50QV99kCKH5P/Vs4E2Gzp7BopNV+KzTXqWeaxrfu5IQJBOULRsTIS9seSsOVT8ZnGXzCyx55nYWAi4qJzpZKEQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@tufjs/models": "4.1.0", + "debug": "^4.4.3", + "make-fetch-happen": "^15.0.1" + }, + "engines": { + "node": "^20.17.0 || >=22.9.0" + } + }, + "node_modules/tunnel": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.6.tgz", + "integrity": "sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.6.11 <=0.7.0 || >=0.7.3" + } + }, + "node_modules/tunnel-agent": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", + "integrity": "sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w==", + "license": "Apache-2.0", + "dependencies": { + "safe-buffer": "^5.0.1" + }, + "engines": { + "node": "*" + } + }, + "node_modules/tweetnacl": { + "version": "0.14.5", + "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", + "integrity": "sha512-KXXFFdAbFXY4geFIwoyNK+f5Z1b7swfXABfL7HXCmoIWMKU3dmS26672A4EeQtDzLKy7SXmfBu51JolvEKwtGA==", + "license": "Unlicense" + }, + "node_modules/type-check": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", + "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", + "dev": true, + "license": "MIT", + "dependencies": { + "prelude-ls": "^1.2.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/type-detect": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.1.0.tgz", + "integrity": "sha512-Acylog8/luQ8L7il+geoSxhEkazvkslg7PSNKOX59mbB9cOveP5aq9h74Y7YU8yDpJwetzQQrfIwtf4Wp4LKcw==", + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/type-fest": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", + "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", + "dev": true, + "license": "(MIT OR CC0-1.0)", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/type-is": { + "version": "1.6.18", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", + "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", + "license": "MIT", + "dependencies": { + "media-typer": "0.3.0", + "mime-types": "~2.1.24" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/typed-array-buffer": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/typed-array-buffer/-/typed-array-buffer-1.0.3.tgz", + "integrity": "sha512-nAYYwfY3qnzX30IkA6AQZjVbtK6duGontcQm1WSG1MD94YLqK0515GNApXkoxKOWMusVssAHWLh9SeaoefYFGw==", + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.3", + "es-errors": "^1.3.0", + "is-typed-array": "^1.1.14" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/typed-array-byte-length": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/typed-array-byte-length/-/typed-array-byte-length-1.0.3.tgz", + "integrity": "sha512-BaXgOuIxz8n8pIq3e7Atg/7s+DpiYrxn4vdot3w9KbnBhcRQq6o3xemQdIfynqSeXeDrF32x+WvfzmOjPiY9lg==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.8", + "for-each": "^0.3.3", + "gopd": "^1.2.0", + "has-proto": "^1.2.0", + "is-typed-array": "^1.1.14" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/typed-array-byte-offset": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/typed-array-byte-offset/-/typed-array-byte-offset-1.0.4.tgz", + "integrity": "sha512-bTlAFB/FBYMcuX81gbL4OcpH5PmlFHqlCCpAl8AlEzMz5k53oNDvN8p1PNOWLEmI2x4orp3raOFB51tv9X+MFQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "available-typed-arrays": "^1.0.7", + "call-bind": "^1.0.8", + "for-each": "^0.3.3", + "gopd": "^1.2.0", + "has-proto": "^1.2.0", + "is-typed-array": "^1.1.15", + "reflect.getprototypeof": "^1.0.9" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/typed-array-length": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/typed-array-length/-/typed-array-length-1.0.7.tgz", + "integrity": "sha512-3KS2b+kL7fsuk/eJZ7EQdnEmQoaho/r6KUef7hxvltNA5DR8NAUM+8wJMbJyZ4G9/7i3v5zPBIMN5aybAh2/Jg==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.7", + "for-each": "^0.3.3", + "gopd": "^1.0.1", + "is-typed-array": "^1.1.13", + "possible-typed-array-names": "^1.0.0", + "reflect.getprototypeof": "^1.0.6" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/typed-query-selector": { + "version": "2.12.0", + "resolved": "https://registry.npmjs.org/typed-query-selector/-/typed-query-selector-2.12.0.tgz", + "integrity": "sha512-SbklCd1F0EiZOyPiW192rrHZzZ5sBijB6xM+cpmrwDqObvdtunOHHIk9fCGsoK5JVIYXoyEp4iEdE3upFH3PAg==", + "license": "MIT" + }, + "node_modules/typed-rest-client": { + "version": "1.8.11", + "resolved": "https://registry.npmjs.org/typed-rest-client/-/typed-rest-client-1.8.11.tgz", + "integrity": "sha512-5UvfMpd1oelmUPRbbaVnq+rHP7ng2cE4qoQkQeAqxRL6PklkxsM0g32/HL0yfvruK6ojQ5x8EE+HF4YV6DtuCA==", + "dev": true, + "license": "MIT", + "dependencies": { + "qs": "^6.9.1", + "tunnel": "0.0.6", + "underscore": "^1.12.1" + } + }, + "node_modules/typedarray": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", + "integrity": "sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA==", + "license": "MIT" + }, + "node_modules/typedarray-to-buffer": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz", + "integrity": "sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-typedarray": "^1.0.0" + } + }, + "node_modules/typedoc": { + "version": "0.28.13", + "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.28.13.tgz", + "integrity": "sha512-dNWY8msnYB2a+7Audha+aTF1Pu3euiE7ySp53w8kEsXoYw7dMouV5A1UsTUY345aB152RHnmRMDiovuBi7BD+w==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@gerrit0/mini-shiki": "^3.12.0", + "lunr": "^2.3.9", + "markdown-it": "^14.1.0", + "minimatch": "^9.0.5", + "yaml": "^2.8.1" + }, + "bin": { + "typedoc": "bin/typedoc" + }, + "engines": { + "node": ">= 18", + "pnpm": ">= 10" + }, + "peerDependencies": { + "typescript": "5.0.x || 5.1.x || 5.2.x || 5.3.x || 5.4.x || 5.5.x || 5.6.x || 5.7.x || 5.8.x || 5.9.x" + } + }, + "node_modules/typedoc/node_modules/brace-expansion": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz", + "integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/typedoc/node_modules/linkify-it": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-5.0.0.tgz", + "integrity": "sha512-5aHCbzQRADcdP+ATqnDuhhJ/MRIqDkZX5pyjFHRRysS8vZ5AbqGEoFIb6pYHPZ+L/OC2Lc+xT8uHVVR5CAK/wQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "uc.micro": "^2.0.0" + } + }, + "node_modules/typedoc/node_modules/markdown-it": { + "version": "14.1.0", + "resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-14.1.0.tgz", + "integrity": "sha512-a54IwgWPaeBCAAsv13YgmALOF1elABB08FxO9i+r4VFk5Vl4pKokRPeX8u5TCgSsPi6ec1otfLjdOpVcgbpshg==", + "dev": true, + "license": "MIT", + "dependencies": { + "argparse": "^2.0.1", + "entities": "^4.4.0", + "linkify-it": "^5.0.0", + "mdurl": "^2.0.0", + "punycode.js": "^2.3.1", + "uc.micro": "^2.1.0" + }, + "bin": { + "markdown-it": "bin/markdown-it.mjs" + } + }, + "node_modules/typedoc/node_modules/mdurl": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/mdurl/-/mdurl-2.0.0.tgz", + "integrity": "sha512-Lf+9+2r+Tdp5wXDXC4PcIBjTDtq4UKjCPMQhKIuzpJNW0b96kVqSwW0bT7FhRSfmAiFYgP+SCRvdrDozfh0U5w==", + "dev": true, + "license": "MIT" + }, + "node_modules/typedoc/node_modules/minimatch": { + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", + "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/typedoc/node_modules/uc.micro": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-2.1.0.tgz", + "integrity": "sha512-ARDJmphmdvUk6Glw7y9DQ2bFkKBHwQHLi2lsaH6PPmz/Ka9sFOBsBluozhDltWmnv9u/cF6Rt87znRTPV+yp/A==", + "dev": true, + "license": "MIT" + }, + "node_modules/typescript": { + "version": "5.9.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz", + "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/uc.micro": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-1.0.6.tgz", + "integrity": "sha512-8Y75pvTYkLJW2hWQHXxoqRgV7qb9B+9vFEtidML+7koHUFapnVJAZ6cKs+Qjz5Aw3aZWHMC6u0wJE3At+nSGwA==", + "dev": true, + "license": "MIT" + }, + "node_modules/uglify-js": { + "version": "3.19.3", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.19.3.tgz", + "integrity": "sha512-v3Xu+yuwBXisp6QYTcH4UbH+xYJXqnq2m/LtQVWKWzYc1iehYnLixoQDN9FH6/j9/oybfd6W9Ghwkl8+UMKTKQ==", + "dev": true, + "license": "BSD-2-Clause", + "optional": true, + "bin": { + "uglifyjs": "bin/uglifyjs" + }, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/umd-compat-loader": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/umd-compat-loader/-/umd-compat-loader-2.1.2.tgz", + "integrity": "sha512-RkTlsfrCxUISWqiTtYFFJank7b2Hhl4V2pc29nl0xOEGvvuVkpy1xnufhXfTituxgpW0HSrDk0JHlvPYZxEXKQ==", + "license": "Apache-2.0", + "dependencies": { + "ast-types": "^0.9.2", + "loader-utils": "^1.0.3", + "recast": "^0.11.17" + } + }, + "node_modules/umd-compat-loader/node_modules/ast-types": { + "version": "0.9.14", + "resolved": "https://registry.npmjs.org/ast-types/-/ast-types-0.9.14.tgz", + "integrity": "sha512-Ebvx7/0lLboCdyEmAw/4GqwBeKIijPveXNiVGhCGCNxc7z26T5he7DC6ARxu8ByKuzUZZcLog+VP8GMyZrBzJw==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/umd-compat-loader/node_modules/json5": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.2.tgz", + "integrity": "sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA==", + "license": "MIT", + "dependencies": { + "minimist": "^1.2.0" + }, + "bin": { + "json5": "lib/cli.js" + } + }, + "node_modules/umd-compat-loader/node_modules/loader-utils": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-1.4.2.tgz", + "integrity": "sha512-I5d00Pd/jwMD2QCduo657+YM/6L3KZu++pmX9VFncxaxvHcru9jx1lBaFft+r4Mt2jK0Yhp41XlRAihzPxHNCg==", + "license": "MIT", + "dependencies": { + "big.js": "^5.2.2", + "emojis-list": "^3.0.0", + "json5": "^1.0.1" + }, + "engines": { + "node": ">=4.0.0" + } + }, + "node_modules/unbox-primitive": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.1.0.tgz", + "integrity": "sha512-nWJ91DjeOkej/TA8pXQ3myruKpKEYgqvpw9lz4OPHj/NWFNluYrjbz9j01CJ8yKQd2g4jFoOkINCTW2I5LEEyw==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.3", + "has-bigints": "^1.0.2", + "has-symbols": "^1.1.0", + "which-boxed-primitive": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/unbzip2-stream": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/unbzip2-stream/-/unbzip2-stream-1.4.3.tgz", + "integrity": "sha512-mlExGW4w71ebDJviH16lQLtZS32VKqsSfk80GCfUlwT/4/hNRFsoscrF/c++9xinkMzECL1uL9DDwXqFWkruPg==", + "license": "MIT", + "dependencies": { + "buffer": "^5.2.1", + "through": "^2.3.8" + } + }, + "node_modules/underscore": { + "version": "1.13.7", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.13.7.tgz", + "integrity": "sha512-GMXzWtsc57XAtguZgaQViUOzs0KTkk8ojr3/xAxXLITqf/3EMwxC0inyETfDFjH/Krbhuep0HNbbjI9i/q3F3g==", + "dev": true, + "license": "MIT" + }, + "node_modules/undici": { + "version": "7.21.0", + "resolved": "https://registry.npmjs.org/undici/-/undici-7.21.0.tgz", + "integrity": "sha512-Hn2tCQpoDt1wv23a68Ctc8Cr/BHpUSfaPYrkajTXOS9IKpxVRx/X5m1K2YkbK2ipgZgxXSgsUinl3x+2YdSSfg==", + "license": "MIT", + "engines": { + "node": ">=20.18.1" + } + }, + "node_modules/undici-types": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz", + "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==", + "license": "MIT" + }, + "node_modules/unicode-canonical-property-names-ecmascript": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-2.0.1.tgz", + "integrity": "sha512-dA8WbNeb2a6oQzAQ55YlT5vQAWGV9WXOsi3SskE3bcCdM0P4SDd+24zS/OCacdRq5BkdsRj9q3Pg6YyQoxIGqg==", + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/unicode-match-property-ecmascript": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/unicode-match-property-ecmascript/-/unicode-match-property-ecmascript-2.0.0.tgz", + "integrity": "sha512-5kaZCrbp5mmbz5ulBkDkbY0SsPOjKqVS35VpL9ulMPfSl0J0Xsm+9Evphv9CoIZFwre7aJoa94AY6seMKGVN5Q==", + "license": "MIT", + "dependencies": { + "unicode-canonical-property-names-ecmascript": "^2.0.0", + "unicode-property-aliases-ecmascript": "^2.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/unicode-match-property-value-ecmascript": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/unicode-match-property-value-ecmascript/-/unicode-match-property-value-ecmascript-2.2.1.tgz", + "integrity": "sha512-JQ84qTuMg4nVkx8ga4A16a1epI9H6uTXAknqxkGF/aFfRLw1xC/Bp24HNLaZhHSkWd3+84t8iXnp1J0kYcZHhg==", + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/unicode-property-aliases-ecmascript": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/unicode-property-aliases-ecmascript/-/unicode-property-aliases-ecmascript-2.2.0.tgz", + "integrity": "sha512-hpbDzxUY9BFwX+UeBnxv3Sh1q7HFxj48DTmXchNgRa46lO8uj3/1iEn3MiNUYTg1g9ctIqXCCERn8gYZhHC5lQ==", + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/union": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/union/-/union-0.5.0.tgz", + "integrity": "sha512-N6uOhuW6zO95P3Mel2I2zMsbsanvvtgn6jVqJv4vbVcz/JN0OkL9suomjQGmWtxJQXOCqUJvquc1sMeNz/IwlA==", + "dependencies": { + "qs": "^6.4.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/unique-filename": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/unique-filename/-/unique-filename-5.0.0.tgz", + "integrity": "sha512-2RaJTAvAb4owyjllTfXzFClJ7WsGxlykkPvCr9pA//LD9goVq+m4PPAeBgNodGZ7nSrntT/auWpJ6Y5IFXcfjg==", + "dev": true, + "license": "ISC", + "dependencies": { + "unique-slug": "^6.0.0" + }, + "engines": { + "node": "^20.17.0 || >=22.9.0" + } + }, + "node_modules/unique-slug": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/unique-slug/-/unique-slug-6.0.0.tgz", + "integrity": "sha512-4Lup7Ezn8W3d52/xBhZBVdx323ckxa7DEvd9kPQHppTkLoJXw6ltrBCyj5pnrxj0qKDxYMJ56CoxNuFCscdTiw==", + "dev": true, + "license": "ISC", + "dependencies": { + "imurmurhash": "^0.1.4" + }, + "engines": { + "node": "^20.17.0 || >=22.9.0" + } + }, + "node_modules/universal-user-agent": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-6.0.1.tgz", + "integrity": "sha512-yCzhz6FN2wU1NiiQRogkTQszlQSlpWaw8SvVegAc+bDxbzHgh1vX8uIe8OYyMH6DwH+sdTJsgMl36+mSMdRJIQ==", + "dev": true, + "license": "ISC" + }, + "node_modules/universalify": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", + "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", + "license": "MIT", + "engines": { + "node": ">= 4.0.0" + } + }, + "node_modules/unpipe": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/unzipper": { + "version": "0.9.15", + "resolved": "https://registry.npmjs.org/unzipper/-/unzipper-0.9.15.tgz", + "integrity": "sha512-2aaUvO4RAeHDvOCuEtth7jrHFaCKTSXPqUkXwADaLBzGbgZGzUDccoEdJ5lW+3RmfpOZYNx0Rw6F6PUzM6caIA==", + "license": "MIT", + "dependencies": { + "big-integer": "^1.6.17", + "binary": "~0.3.0", + "bluebird": "~3.4.1", + "buffer-indexof-polyfill": "~1.0.0", + "duplexer2": "~0.1.4", + "fstream": "^1.0.12", + "listenercount": "~1.0.1", + "readable-stream": "~2.3.6", + "setimmediate": "~1.0.4" + } + }, + "node_modules/unzipper/node_modules/bluebird": { + "version": "3.4.7", + "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.4.7.tgz", + "integrity": "sha512-iD3898SR7sWVRHbiQv+sHUtHnMvC1o3nW5rAcqnq3uOn07DSAppZYUkIGslDz6gXC7HfunPe7YVBgoEJASPcHA==", + "license": "MIT" + }, + "node_modules/unzipper/node_modules/isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==", + "license": "MIT" + }, + "node_modules/unzipper/node_modules/readable-stream": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", + "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", + "license": "MIT", + "dependencies": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "node_modules/unzipper/node_modules/safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "license": "MIT" + }, + "node_modules/unzipper/node_modules/string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.1.0" + } + }, + "node_modules/upath": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/upath/-/upath-2.0.1.tgz", + "integrity": "sha512-1uEe95xksV1O0CYKXo8vQvN1JEbtJp7lb7C5U9HMsIp6IVwntkH/oNUzyVNQSd4S1sYk2FpSSW44FqMc8qee5w==", + "license": "MIT", + "engines": { + "node": ">=4", + "yarn": "*" + } + }, + "node_modules/update-browserslist-db": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.2.3.tgz", + "integrity": "sha512-Js0m9cx+qOgDxo0eMiFGEueWztz+d4+M3rGlmKPT+T4IS/jP4ylw3Nwpu6cpTTP8R1MAC1kF4VbdLt3ARf209w==", + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/browserslist" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "escalade": "^3.2.0", + "picocolors": "^1.1.1" + }, + "bin": { + "update-browserslist-db": "cli.js" + }, + "peerDependencies": { + "browserslist": ">= 4.21.0" + } + }, + "node_modules/uri-js": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "license": "BSD-2-Clause", + "dependencies": { + "punycode": "^2.1.0" + } + }, + "node_modules/url-join": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/url-join/-/url-join-4.0.1.tgz", + "integrity": "sha512-jk1+QP6ZJqyOiuEI9AEWQfju/nB2Pw466kbA0LEZljHwKeMgd9WrAEgEGxjPDD2+TNbbb37rTyhEfrCXfuKXnA==", + "license": "MIT" + }, + "node_modules/url-parse": { + "version": "1.5.10", + "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.10.tgz", + "integrity": "sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "querystringify": "^2.1.1", + "requires-port": "^1.0.0" + } + }, + "node_modules/urlpattern-polyfill": { + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/urlpattern-polyfill/-/urlpattern-polyfill-10.0.0.tgz", + "integrity": "sha512-H/A06tKD7sS1O1X2SshBVeA5FLycRpjqiBeqGKmBwBDBy28EnRjORxTNe269KSSr5un5qyWi1iL61wLxpd+ZOg==", + "license": "MIT" + }, + "node_modules/use-composed-ref": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/use-composed-ref/-/use-composed-ref-1.4.0.tgz", + "integrity": "sha512-djviaxuOOh7wkj0paeO1Q/4wMZ8Zrnag5H6yBvzN7AKKe8beOaED9SF5/ByLqsku8NP4zQqsvM2u3ew/tJK8/w==", + "license": "MIT", + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/use-isomorphic-layout-effect": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/use-isomorphic-layout-effect/-/use-isomorphic-layout-effect-1.2.1.tgz", + "integrity": "sha512-tpZZ+EX0gaghDAiFR37hj5MgY6ZN55kLiPkJsKxBMZ6GZdOSPJXiOzPM984oPYZ5AnehYx5WQp1+ME8I/P/pRA==", + "license": "MIT", + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/use-latest": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/use-latest/-/use-latest-1.3.0.tgz", + "integrity": "sha512-mhg3xdm9NaM8q+gLT8KryJPnRFOz1/5XPBhmDEVZK1webPzDjrPk7f/mbpeLqTgB9msytYWANxgALOCJKnLvcQ==", + "license": "MIT", + "dependencies": { + "use-isomorphic-layout-effect": "^1.1.1" + }, + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/user-home": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/user-home/-/user-home-2.0.0.tgz", + "integrity": "sha512-KMWqdlOcjCYdtIJpicDSFBQ8nFwS2i9sslAd6f4+CBGcU4gist2REnr2fxj2YocvJFxSF3ZOHLYLVZnUxv4BZQ==", + "license": "MIT", + "dependencies": { + "os-homedir": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/utf8-byte-length": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/utf8-byte-length/-/utf8-byte-length-1.0.5.tgz", + "integrity": "sha512-Xn0w3MtiQ6zoz2vFyUVruaCL53O/DwUvkEeOvj+uulMm0BkUGYWmBYVyElqZaSLhY6ZD0ulfU3aBra2aVT4xfA==", + "dev": true, + "license": "(WTFPL OR MIT)" + }, + "node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", + "license": "MIT" + }, + "node_modules/utils-merge": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", + "integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==", + "license": "MIT", + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/uuid": { + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", + "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", + "license": "MIT", + "bin": { + "uuid": "dist/bin/uuid" + } + }, + "node_modules/v8-compile-cache": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.4.0.tgz", + "integrity": "sha512-ocyWc3bAHBB/guyqJQVI5o4BZkPhznPYUG2ea80Gond/BgNWpap8TOmLSeeQG7bnh2KMISxskdADG59j7zruhw==", + "license": "MIT" + }, + "node_modules/v8-to-istanbul": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-1.2.1.tgz", + "integrity": "sha512-NglPycIwSQeSJj7VJ6L8vTsPKC9MG5Lcx4n3SvYqNHzklbMI4dGcLJnkLPEPJ3uB8UyTdWviMhM0Ptq+xD5UFQ==", + "license": "ISC", + "engines": { + "node": ">=10.10.0" + } + }, + "node_modules/valid-filename": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/valid-filename/-/valid-filename-2.0.1.tgz", + "integrity": "sha512-7eF/iUZ5SPd3FighoKgatSjXDJ25Vopo/6yvEKGyX4FIeZVHcLjHmyvbQ1WdFD9RQZ9PoBA7nrSxxAz/oC64SQ==", + "license": "MIT", + "dependencies": { + "filename-reserved-regex": "^2.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/validate-npm-package-license": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", + "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "spdx-correct": "^3.0.0", + "spdx-expression-parse": "^3.0.0" + } + }, + "node_modules/validate-npm-package-name": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/validate-npm-package-name/-/validate-npm-package-name-6.0.2.tgz", + "integrity": "sha512-IUoow1YUtvoBBC06dXs8bR8B9vuA3aJfmQNKMoaPG/OFsPmoQvw8xh+6Ye25Gx9DQhoEom3Pcu9MKHerm/NpUQ==", + "dev": true, + "license": "ISC", + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/vary": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", + "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/verror": { + "version": "1.10.1", + "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.1.tgz", + "integrity": "sha512-veufcmxri4e3XSrT0xwfUR7kguIkaxBeosDg00yDWhk49wdwkSUrvvsm7nc75e1PUyvIeZj6nS8VQRYz2/S4Xg==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "assert-plus": "^1.0.0", + "core-util-is": "1.0.2", + "extsprintf": "^1.2.0" + }, + "engines": { + "node": ">=0.6.0" + } + }, + "node_modules/verror/node_modules/core-util-is": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha512-3lqz5YjWTYnW6dlDa5TLaTCcShfar1e40rmcJVwCBJC6mWlFuj0eCHIElmG1g5kyuJ/GD+8Wn4FFCcz4gJPfaQ==", + "dev": true, + "license": "MIT", + "optional": true + }, + "node_modules/vhost": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/vhost/-/vhost-3.0.2.tgz", + "integrity": "sha512-S3pJdWrpFWrKMboRU4dLYgMrTgoPALsmYwOvyebK2M6X95b9kQrjZy5rwl3uzzpfpENe/XrNYu/2U+e7/bmT5g==", + "license": "MIT", + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/vscode-jsonrpc": { + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-8.2.0.tgz", + "integrity": "sha512-C+r0eKJUIfiDIfwJhria30+TYWPtuHJXHtI7J0YlOmKAo7ogxP20T0zxB7HZQIFhIyvoBPwWskjxrvAtfjyZfA==", + "license": "MIT", + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/vscode-languageserver-protocol": { + "version": "3.17.5", + "resolved": "https://registry.npmjs.org/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.17.5.tgz", + "integrity": "sha512-mb1bvRJN8SVznADSGWM9u/b07H7Ecg0I3OgXDuLdn307rl/J3A9YD6/eYOssqhecL27hK1IPZAsaqh00i/Jljg==", + "license": "MIT", + "dependencies": { + "vscode-jsonrpc": "8.2.0", + "vscode-languageserver-types": "3.17.5" + } + }, + "node_modules/vscode-languageserver-textdocument": { + "version": "1.0.12", + "resolved": "https://registry.npmjs.org/vscode-languageserver-textdocument/-/vscode-languageserver-textdocument-1.0.12.tgz", + "integrity": "sha512-cxWNPesCnQCcMPeenjKKsOCKQZ/L6Tv19DTRIGuLWe32lyzWhihGVJ/rcckZXJxfdKCFvRLS3fpBIsV/ZGX4zA==", + "license": "MIT" + }, + "node_modules/vscode-languageserver-types": { + "version": "3.17.5", + "resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.17.5.tgz", + "integrity": "sha512-Ld1VelNuX9pdF39h2Hgaeb5hEZM2Z3jUrrMgWQAu82jMtZp7p3vJT3BzToKtZI7NgQssZje5o0zryOrhQvzQAg==", + "license": "MIT" + }, + "node_modules/vscode-oniguruma": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/vscode-oniguruma/-/vscode-oniguruma-2.0.1.tgz", + "integrity": "sha512-poJU8iHIWnC3vgphJnrLZyI3YdqRlR27xzqDmpPXYzA93R4Gk8z7T6oqDzDoHjoikA2aS82crdXFkjELCdJsjQ==", + "license": "MIT" + }, + "node_modules/vscode-textmate": { + "version": "9.3.2", + "resolved": "https://registry.npmjs.org/vscode-textmate/-/vscode-textmate-9.3.2.tgz", + "integrity": "sha512-n2uGbUcrjhUEBH16uGA0TvUfhWwliFZ1e3+pTjrkim1Mt7ydB41lV08aUvsi70OlzDWp6X7Bx3w/x3fAXIsN0Q==", + "license": "MIT" + }, + "node_modules/vscode-uri": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/vscode-uri/-/vscode-uri-2.1.2.tgz", + "integrity": "sha512-8TEXQxlldWAuIODdukIb+TR5s+9Ds40eSJrw+1iDDA9IFORPjMELarNQE3myz5XIkWWpdprmJjm1/SxMlWOC8A==", + "license": "MIT" + }, + "node_modules/w3c-xmlserializer": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/w3c-xmlserializer/-/w3c-xmlserializer-4.0.0.tgz", + "integrity": "sha512-d+BFHzbiCx6zGfz0HyQ6Rg69w9k19nviJspaj4yNscGjrHu94sVP+aRm75yEbCh+r2/yR+7q6hux9LVtbuTGBw==", + "dev": true, + "license": "MIT", + "dependencies": { + "xml-name-validator": "^4.0.0" + }, + "engines": { + "node": ">=14" + } + }, + "node_modules/walk-up-path": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/walk-up-path/-/walk-up-path-4.0.0.tgz", + "integrity": "sha512-3hu+tD8YzSLGuFYtPRb48vdhKMi0KQV5sn+uWr8+7dMEq/2G/dtLrdDinkLjqq5TIbIBjYJ4Ax/n3YiaW7QM8A==", + "dev": true, + "license": "ISC", + "engines": { + "node": "20 || >=22" + } + }, + "node_modules/watchpack": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.5.1.tgz", + "integrity": "sha512-Zn5uXdcFNIA1+1Ei5McRd+iRzfhENPCe7LeABkJtNulSxjma+l7ltNx55BWZkRlwRnpOgHqxnjyaDgJnNXnqzg==", + "license": "MIT", + "dependencies": { + "glob-to-regexp": "^0.4.1", + "graceful-fs": "^4.1.2" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/wcwidth": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/wcwidth/-/wcwidth-1.0.1.tgz", + "integrity": "sha512-XHPEwS0q6TaxcvG85+8EYkbiCux2XtWG2mkc47Ng2A77BQu9+DqIOJldST4HgPkuea7dvKSj5VgX3P1d4rW8Tg==", + "license": "MIT", + "dependencies": { + "defaults": "^1.0.3" + } + }, + "node_modules/web-streams-polyfill": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.3.3.tgz", + "integrity": "sha512-d2JWLCivmZYTSIoge9MsgFCZrt571BikcWGYkjC1khllbTeDlGqZ2D8vD8E/lJa8WGWbb7Plm8/XJYV7IJHZZw==", + "license": "MIT", + "engines": { + "node": ">= 8" + } + }, + "node_modules/webidl-conversions": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-7.0.0.tgz", + "integrity": "sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=12" + } + }, + "node_modules/webpack": { + "version": "5.105.1", + "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.105.1.tgz", + "integrity": "sha512-Gdj3X74CLJJ8zy4URmK42W7wTZUJrqL+z8nyGEr4dTN0kb3nVs+ZvjbTOqRYPD7qX4tUmwyHL9Q9K6T1seW6Yw==", + "license": "MIT", + "dependencies": { + "@types/eslint-scope": "^3.7.7", + "@types/estree": "^1.0.8", + "@types/json-schema": "^7.0.15", + "@webassemblyjs/ast": "^1.14.1", + "@webassemblyjs/wasm-edit": "^1.14.1", + "@webassemblyjs/wasm-parser": "^1.14.1", + "acorn": "^8.15.0", + "acorn-import-phases": "^1.0.3", + "browserslist": "^4.28.1", + "chrome-trace-event": "^1.0.2", + "enhanced-resolve": "^5.19.0", + "es-module-lexer": "^2.0.0", + "eslint-scope": "5.1.1", + "events": "^3.2.0", + "glob-to-regexp": "^0.4.1", + "graceful-fs": "^4.2.11", + "json-parse-even-better-errors": "^2.3.1", + "loader-runner": "^4.3.1", + "mime-types": "^2.1.27", + "neo-async": "^2.6.2", + "schema-utils": "^4.3.3", + "tapable": "^2.3.0", + "terser-webpack-plugin": "^5.3.16", + "watchpack": "^2.5.1", + "webpack-sources": "^3.3.3" + }, + "bin": { + "webpack": "bin/webpack.js" + }, + "engines": { + "node": ">=10.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + }, + "peerDependenciesMeta": { + "webpack-cli": { + "optional": true + } + } + }, + "node_modules/webpack-cli": { + "version": "4.7.0", + "resolved": "https://registry.npmjs.org/webpack-cli/-/webpack-cli-4.7.0.tgz", + "integrity": "sha512-7bKr9182/sGfjFm+xdZSwgQuFjgEcy0iCTIBxRUeteJ2Kr8/Wz0qNJX+jw60LU36jApt4nmMkep6+W5AKhok6g==", + "license": "MIT", + "dependencies": { + "@discoveryjs/json-ext": "^0.5.0", + "@webpack-cli/configtest": "^1.0.3", + "@webpack-cli/info": "^1.2.4", + "@webpack-cli/serve": "^1.4.0", + "colorette": "^1.2.1", + "commander": "^7.0.0", + "execa": "^5.0.0", + "fastest-levenshtein": "^1.0.12", + "import-local": "^3.0.2", + "interpret": "^2.2.0", + "rechoir": "^0.7.0", + "v8-compile-cache": "^2.2.0", + "webpack-merge": "^5.7.3" + }, + "bin": { + "webpack-cli": "bin/cli.js" + }, + "engines": { + "node": ">=10.13.0" + }, + "peerDependencies": { + "webpack": "4.x.x || 5.x.x" + }, + "peerDependenciesMeta": { + "@webpack-cli/generators": { + "optional": true + }, + "@webpack-cli/migrate": { + "optional": true + }, + "webpack-bundle-analyzer": { + "optional": true + }, + "webpack-dev-server": { + "optional": true + } + } + }, + "node_modules/webpack-cli/node_modules/commander": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-7.2.0.tgz", + "integrity": "sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==", + "license": "MIT", + "engines": { + "node": ">= 10" + } + }, + "node_modules/webpack-merge": { + "version": "5.10.0", + "resolved": "https://registry.npmjs.org/webpack-merge/-/webpack-merge-5.10.0.tgz", + "integrity": "sha512-+4zXKdx7UnO+1jaN4l2lHVD+mFvnlZQP/6ljaJVb4SZiwIKeUnrT5l0gkT8z+n4hKpC+jpOv6O9R+gLtag7pSA==", + "license": "MIT", + "dependencies": { + "clone-deep": "^4.0.1", + "flat": "^5.0.2", + "wildcard": "^2.0.0" + }, + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/webpack-sources": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-3.3.3.tgz", + "integrity": "sha512-yd1RBzSGanHkitROoPFd6qsrxt+oFhg/129YzheDGqeustzX0vTZJZsSsQjVQC4yzBQ56K55XU8gaNCtIzOnTg==", + "license": "MIT", + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/webpack/node_modules/ajv": { + "version": "8.17.1", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.17.1.tgz", + "integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==", + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^3.1.3", + "fast-uri": "^3.0.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/webpack/node_modules/ajv-formats": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ajv-formats/-/ajv-formats-2.1.1.tgz", + "integrity": "sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA==", + "license": "MIT", + "dependencies": { + "ajv": "^8.0.0" + }, + "peerDependencies": { + "ajv": "^8.0.0" + }, + "peerDependenciesMeta": { + "ajv": { + "optional": true + } + } + }, + "node_modules/webpack/node_modules/ajv-keywords": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-5.1.0.tgz", + "integrity": "sha512-YCS/JNFAUyr5vAuhk1DWm1CBxRHW9LbJ2ozWeemrIqpbsqKjHVxYPyi5GC0rjZIT5JxJ3virVTS8wk4i/Z+krw==", + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^3.1.3" + }, + "peerDependencies": { + "ajv": "^8.8.2" + } + }, + "node_modules/webpack/node_modules/eslint-scope": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", + "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==", + "license": "BSD-2-Clause", + "dependencies": { + "esrecurse": "^4.3.0", + "estraverse": "^4.1.1" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/webpack/node_modules/estraverse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", + "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", + "license": "BSD-2-Clause", + "engines": { + "node": ">=4.0" + } + }, + "node_modules/webpack/node_modules/json-parse-even-better-errors": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", + "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", + "license": "MIT" + }, + "node_modules/webpack/node_modules/json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "license": "MIT" + }, + "node_modules/webpack/node_modules/schema-utils": { + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-4.3.3.tgz", + "integrity": "sha512-eflK8wEtyOE6+hsaRVPxvUKYCpRgzLqDTb8krvAsRIwOGlHoSgYLgBXoubGgLd2fT41/OUYdb48v4k4WWHQurA==", + "license": "MIT", + "dependencies": { + "@types/json-schema": "^7.0.9", + "ajv": "^8.9.0", + "ajv-formats": "^2.1.1", + "ajv-keywords": "^5.1.0" + }, + "engines": { + "node": ">= 10.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + } + }, + "node_modules/whatwg-encoding": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-3.1.1.tgz", + "integrity": "sha512-6qN4hJdMwfYBtE3YBTTHhoeuUrDBPZmbQaxWAqSALV/MeEnR5z1xd8UKud2RAkFoPkmB+hli1TZSnyi84xz1vQ==", + "deprecated": "Use @exodus/bytes instead for a more spec-conformant and faster implementation", + "dev": true, + "license": "MIT", + "dependencies": { + "iconv-lite": "0.6.3" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/whatwg-fetch": { + "version": "3.6.20", + "resolved": "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-3.6.20.tgz", + "integrity": "sha512-EqhiFU6daOA8kpjOWTL0olhVOF3i7OrFzSYiGsEMB8GcXS+RrzauAERX65xMeNWVqxA6HXH2m69Z9LaKKdisfg==", + "license": "MIT" + }, + "node_modules/whatwg-mimetype": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-4.0.0.tgz", + "integrity": "sha512-QaKxh0eNIi2mE9p2vEdzfagOKHCcj1pJ56EEHGQOVxp8r9/iszLUUV7v89x9O1p/T+NlTM5W7jW6+cz4Fq1YVg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + } + }, + "node_modules/whatwg-url": { + "version": "12.0.1", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-12.0.1.tgz", + "integrity": "sha512-Ed/LrqB8EPlGxjS+TrsXcpUond1mhccS3pchLhzSgPCnTimUCKj3IZE75pAs5m6heB2U2TMerKFUXheyHY+VDQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "tr46": "^4.1.1", + "webidl-conversions": "^7.0.0" + }, + "engines": { + "node": ">=14" + } + }, + "node_modules/which": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/which/-/which-4.0.0.tgz", + "integrity": "sha512-GlaYyEb07DPxYCKhKzplCWBJtvxZcZMrL+4UkrTSJHHPyZU4mYYTv3qaOe77H7EODLSSopAUFAc6W8U4yqvscg==", + "dev": true, + "license": "ISC", + "dependencies": { + "isexe": "^3.1.1" + }, + "bin": { + "node-which": "bin/which.js" + }, + "engines": { + "node": "^16.13.0 || >=18.0.0" + } + }, + "node_modules/which-boxed-primitive": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/which-boxed-primitive/-/which-boxed-primitive-1.1.1.tgz", + "integrity": "sha512-TbX3mj8n0odCBFVlY8AxkqcHASw3L60jIuF8jFP78az3C2YhmGvqbHBpAjTRH2/xqYunrJ9g1jSyjCjpoWzIAA==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-bigint": "^1.1.0", + "is-boolean-object": "^1.2.1", + "is-number-object": "^1.1.1", + "is-string": "^1.1.1", + "is-symbol": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/which-builtin-type": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/which-builtin-type/-/which-builtin-type-1.2.1.tgz", + "integrity": "sha512-6iBczoX+kDQ7a3+YJBnh3T+KZRxM/iYNPXicqk66/Qfm1b93iu+yOImkg0zHbj5LNOcNv1TEADiZ0xa34B4q6Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "function.prototype.name": "^1.1.6", + "has-tostringtag": "^1.0.2", + "is-async-function": "^2.0.0", + "is-date-object": "^1.1.0", + "is-finalizationregistry": "^1.1.0", + "is-generator-function": "^1.0.10", + "is-regex": "^1.2.1", + "is-weakref": "^1.0.2", + "isarray": "^2.0.5", + "which-boxed-primitive": "^1.1.0", + "which-collection": "^1.0.2", + "which-typed-array": "^1.1.16" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/which-collection": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/which-collection/-/which-collection-1.0.2.tgz", + "integrity": "sha512-K4jVyjnBdgvc86Y6BkaLZEN933SwYOuBFkdmBu9ZfkcAbdVbpITnDmjvZ/aQjRXQrv5EPkTnD1s39GiiqbngCw==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-map": "^2.0.3", + "is-set": "^2.0.3", + "is-weakmap": "^2.0.2", + "is-weakset": "^2.0.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/which-module": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.1.tgz", + "integrity": "sha512-iBdZ57RDvnOR9AGBhML2vFZf7h8vmBjhoaZqODJBFWHVtKkDmKuHai3cx5PgVMrX5YDNp27AofYbAwctSS+vhQ==", + "license": "ISC" + }, + "node_modules/which-typed-array": { + "version": "1.1.20", + "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.20.tgz", + "integrity": "sha512-LYfpUkmqwl0h9A2HL09Mms427Q1RZWuOHsukfVcKRq9q95iQxdw0ix1JQrqbcDR9PH1QDwf5Qo8OZb5lksZ8Xg==", + "license": "MIT", + "dependencies": { + "available-typed-arrays": "^1.0.7", + "call-bind": "^1.0.8", + "call-bound": "^1.0.4", + "for-each": "^0.3.5", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "has-tostringtag": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/wide-align": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.5.tgz", + "integrity": "sha512-eDMORYaPNZ4sQIuuYPDHdQvf4gyCF9rEEV/yPxGfwPkRodwEgiMUUXTx/dex+Me0wxx53S+NgUHaP7y3MGlDmg==", + "dev": true, + "license": "ISC", + "dependencies": { + "string-width": "^1.0.2 || 2 || 3 || 4" + } + }, + "node_modules/wildcard": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/wildcard/-/wildcard-2.0.1.tgz", + "integrity": "sha512-CC1bOL87PIWSBhDcTrdeLo6eGT7mCFtrg0uIJtqJUFyK+eJnzl8A1niH56uu7KMa5XFrtiV+AQuHO3n7DsHnLQ==", + "license": "MIT" + }, + "node_modules/word-wrap": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz", + "integrity": "sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/wordwrap": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", + "integrity": "sha512-gvVzJFlPycKc5dZN4yPkP8w7Dc37BtP1yczEneOb4uq34pXZcvrtRTmWV8W+Ume+XCxKgbjM+nevkyFPMybd4Q==", + "dev": true, + "license": "MIT" + }, + "node_modules/worker-loader": { + "version": "3.0.8", + "resolved": "https://registry.npmjs.org/worker-loader/-/worker-loader-3.0.8.tgz", + "integrity": "sha512-XQyQkIFeRVC7f7uRhFdNMe/iJOdO6zxAaR3EWbDp45v3mDhrTi+++oswKNxShUNjPC/1xUp5DB29YKLhFo129g==", + "license": "MIT", + "dependencies": { + "loader-utils": "^2.0.0", + "schema-utils": "^3.0.0" + }, + "engines": { + "node": ">= 10.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + }, + "peerDependencies": { + "webpack": "^4.0.0 || ^5.0.0" + } + }, + "node_modules/worker-loader/node_modules/schema-utils": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.3.0.tgz", + "integrity": "sha512-pN/yOAvcC+5rQ5nERGuwrjLlYvLTbCibnZ1I7B1LaiAz9BRBlE9GMgE/eqV30P7aJQUf7Ddimy/RsbYO/GrVGg==", + "license": "MIT", + "dependencies": { + "@types/json-schema": "^7.0.8", + "ajv": "^6.12.5", + "ajv-keywords": "^3.5.2" + }, + "engines": { + "node": ">= 10.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + } + }, + "node_modules/workerpool": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.2.1.tgz", + "integrity": "sha512-ILEIE97kDZvF9Wb9f6h5aXK4swSlKGUcOEGiIYb2OOu/IrDU9iwj0fD//SsA6E5ibwJxpEvhullJY4Sl4GcpAw==", + "license": "Apache-2.0" + }, + "node_modules/wrap-ansi": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", + "integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==", + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/wrap-ansi-cjs": { + "name": "wrap-ansi", + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "license": "ISC" + }, + "node_modules/write-file-atomic": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-5.0.1.tgz", + "integrity": "sha512-+QU2zd6OTD8XWIJCbffaiQeH9U73qIqafo1x6V1snCWYGJf6cVE0cDR4D8xRzcEnfI21IFrUPzPGtcPf8AC+Rw==", + "dev": true, + "license": "ISC", + "dependencies": { + "imurmurhash": "^0.1.4", + "signal-exit": "^4.0.1" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/write-file-atomic/node_modules/signal-exit": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", + "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/write-json-file": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/write-json-file/-/write-json-file-3.2.0.tgz", + "integrity": "sha512-3xZqT7Byc2uORAatYiP3DHUUAVEkNOswEWNs9H5KXiicRTvzYzYqKjYc4G7p+8pltvAw641lVByKVtMpf+4sYQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "detect-indent": "^5.0.0", + "graceful-fs": "^4.1.15", + "make-dir": "^2.1.0", + "pify": "^4.0.1", + "sort-keys": "^2.0.0", + "write-file-atomic": "^2.4.2" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/write-json-file/node_modules/make-dir": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-2.1.0.tgz", + "integrity": "sha512-LS9X+dc8KLxXCb8dni79fLIIUA5VyZoyjSMCwTluaXA0o27cCK0bhXkpgw+sTXVpPy/lSO57ilRixqk0vDmtRA==", + "dev": true, + "license": "MIT", + "dependencies": { + "pify": "^4.0.1", + "semver": "^5.6.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/write-json-file/node_modules/pify": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", + "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/write-json-file/node_modules/semver": { + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", + "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver" + } + }, + "node_modules/write-json-file/node_modules/write-file-atomic": { + "version": "2.4.3", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-2.4.3.tgz", + "integrity": "sha512-GaETH5wwsX+GcnzhPgKcKjJ6M2Cq3/iZp1WyY/X1CSqrW+jVNM9Y7D8EC2sM4ZG/V8wZlSniJnCKWPmBYAucRQ==", + "dev": true, + "license": "ISC", + "dependencies": { + "graceful-fs": "^4.1.11", + "imurmurhash": "^0.1.4", + "signal-exit": "^3.0.2" + } + }, + "node_modules/write-pkg": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/write-pkg/-/write-pkg-4.0.0.tgz", + "integrity": "sha512-v2UQ+50TNf2rNHJ8NyWttfm/EJUBWMJcx6ZTYZr6Qp52uuegWw/lBkCtCbnYZEmPRNL61m+u67dAmGxo+HTULA==", + "dev": true, + "license": "MIT", + "dependencies": { + "sort-keys": "^2.0.0", + "type-fest": "^0.4.1", + "write-json-file": "^3.2.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/write-pkg/node_modules/type-fest": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.4.1.tgz", + "integrity": "sha512-IwzA/LSfD2vC1/YDYMv/zHP4rDF1usCwllsDpbolT3D4fUepIO7f9K70jjmUewU/LmGUKJcwcVtDCpnKk4BPMw==", + "dev": true, + "license": "(MIT OR CC0-1.0)", + "engines": { + "node": ">=6" + } + }, + "node_modules/ws": { + "version": "8.19.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.19.0.tgz", + "integrity": "sha512-blAT2mjOEIi0ZzruJfIhb3nps74PRWTCz1IjglWEEpQl5XS/UNama6u2/rjFkDDouqr4L67ry+1aGIALViWjDg==", + "license": "MIT", + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": ">=5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, + "node_modules/wsl-utils": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/wsl-utils/-/wsl-utils-0.1.0.tgz", + "integrity": "sha512-h3Fbisa2nKGPxCpm89Hk33lBLsnaGBvctQopaBSOW/uIs6FTe1ATyAnKFJrzVs9vpGdsTe73WF3V4lIsk4Gacw==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-wsl": "^3.1.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/xdg-basedir": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/xdg-basedir/-/xdg-basedir-4.0.0.tgz", + "integrity": "sha512-PSNhEJDejZYV7h50BohL09Er9VaIefr2LMAf3OEmpCkjOi34eYyQYAXUTjEQtZJTKcF0E2UKTh+osDLsgNim9Q==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/xdg-trashdir": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/xdg-trashdir/-/xdg-trashdir-3.1.0.tgz", + "integrity": "sha512-N1XQngeqMBoj9wM4ZFadVV2MymImeiFfYD+fJrNlcVcOHsJFFQe7n3b+aBoTPwARuq2HQxukfzVpQmAk1gN4sQ==", + "license": "MIT", + "dependencies": { + "@sindresorhus/df": "^3.1.1", + "mount-point": "^3.0.0", + "user-home": "^2.0.0", + "xdg-basedir": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/xml-js": { + "version": "1.6.11", + "resolved": "https://registry.npmjs.org/xml-js/-/xml-js-1.6.11.tgz", + "integrity": "sha512-7rVi2KMfwfWFl+GpPg6m80IVMWXLRjO+PxTq7V2CDhoGak0wzYzFgUY2m4XJ47OGdXd8eLE8EmwfAmdjw7lC1g==", + "license": "MIT", + "dependencies": { + "sax": "^1.2.4" + }, + "bin": { + "xml-js": "bin/cli.js" + } + }, + "node_modules/xml-name-validator": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-4.0.0.tgz", + "integrity": "sha512-ICP2e+jsHvAj2E2lIHxa5tjXRlKDJo4IdvPvCXbXQGdzSfmSpNVyIKMvoZHjDY9DP0zV17iI85o90vRFXNccRw==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=12" + } + }, + "node_modules/xml2js": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.5.0.tgz", + "integrity": "sha512-drPFnkQJik/O+uPKpqSgr22mpuFHqKdbS835iAQrUC73L2F5WkboIRd63ai/2Yg6I1jzifPFKH2NTK+cfglkIA==", + "dev": true, + "license": "MIT", + "dependencies": { + "sax": ">=0.6.0", + "xmlbuilder": "~11.0.0" + }, + "engines": { + "node": ">=4.0.0" + } + }, + "node_modules/xmlbuilder": { + "version": "11.0.1", + "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-11.0.1.tgz", + "integrity": "sha512-fDlsI/kFEx7gLvbecc0/ohLG50fugQp8ryHzMTuW9vSa1GJ0XYWKnhsUx7oie3G98+r56aTQIUB4kht42R3JvA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4.0" + } + }, + "node_modules/xmlchars": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/xmlchars/-/xmlchars-2.2.0.tgz", + "integrity": "sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw==", + "dev": true, + "license": "MIT" + }, + "node_modules/xmlhttprequest-ssl": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/xmlhttprequest-ssl/-/xmlhttprequest-ssl-2.1.2.tgz", + "integrity": "sha512-TEU+nJVUUnA4CYJFLvK5X9AOeH4KvDvhIfm0vV1GaQRtchnG0hgK5p8hw/xjv8cunWYCsiPCSDzObPyhEwq3KQ==", + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/xtend": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", + "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==", + "license": "MIT", + "engines": { + "node": ">=0.4" + } + }, + "node_modules/xterm": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/xterm/-/xterm-5.3.0.tgz", + "integrity": "sha512-8QqjlekLUFTrU6x7xck1MsPzPA571K5zNqWm0M0oroYEWVOptZ0+ubQSkQ3uxIEhcIHRujJy6emDWX4A7qyFzg==", + "deprecated": "This package is now deprecated. Move to @xterm/xterm instead.", + "license": "MIT" + }, + "node_modules/xterm-addon-fit": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/xterm-addon-fit/-/xterm-addon-fit-0.8.0.tgz", + "integrity": "sha512-yj3Np7XlvxxhYF/EJ7p3KHaMt6OdwQ+HDu573Vx1lRXsVxOcnVJs51RgjZOouIZOczTsskaS+CpXspK81/DLqw==", + "deprecated": "This package is now deprecated. Move to @xterm/addon-fit instead.", + "license": "MIT", + "peerDependencies": { + "xterm": "^5.0.0" + } + }, + "node_modules/xterm-addon-search": { + "version": "0.13.0", + "resolved": "https://registry.npmjs.org/xterm-addon-search/-/xterm-addon-search-0.13.0.tgz", + "integrity": "sha512-sDUwG4CnqxUjSEFh676DlS3gsh3XYCzAvBPSvJ5OPgF3MRL3iHLPfsb06doRicLC2xXNpeG2cWk8x1qpESWJMA==", + "deprecated": "This package is now deprecated. Move to @xterm/addon-search instead.", + "license": "MIT", + "peerDependencies": { + "xterm": "^5.0.0" + } + }, + "node_modules/xterm-addon-webgl": { + "version": "0.16.0", + "resolved": "https://registry.npmjs.org/xterm-addon-webgl/-/xterm-addon-webgl-0.16.0.tgz", + "integrity": "sha512-E8cq1AiqNOv0M/FghPT+zPAEnvIQRDbAbkb04rRYSxUym69elPWVJ4sv22FCLBqM/3LcrmBLl/pELnBebVFKgA==", + "deprecated": "This package is now deprecated. Move to @xterm/addon-webgl instead.", + "license": "MIT", + "peerDependencies": { + "xterm": "^5.0.0" + } + }, + "node_modules/y-protocols": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/y-protocols/-/y-protocols-1.0.7.tgz", + "integrity": "sha512-YSVsLoXxO67J6eE/nV4AtFtT3QEotZf5sK5BHxFBXso7VDUT3Tx07IfA6hsu5Q5OmBdMkQVmFZ9QOA7fikWvnw==", + "license": "MIT", + "dependencies": { + "lib0": "^0.2.85" + }, + "engines": { + "node": ">=16.0.0", + "npm": ">=8.0.0" + }, + "funding": { + "type": "GitHub Sponsors ❤", + "url": "https://github.com/sponsors/dmonad" + }, + "peerDependencies": { + "yjs": "^13.0.0" + } + }, + "node_modules/y18n": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.3.tgz", + "integrity": "sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ==", + "license": "ISC" + }, + "node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "license": "ISC" + }, + "node_modules/yaml": { + "version": "2.8.2", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.8.2.tgz", + "integrity": "sha512-mplynKqc1C2hTVYxd0PU2xQAc22TI1vShAYGksCCfxbn/dFwnHTNi1bvYsBTkhdUNtGIf5xNOg938rrSSYvS9A==", + "license": "ISC", + "bin": { + "yaml": "bin.mjs" + }, + "engines": { + "node": ">= 14.6" + }, + "funding": { + "url": "https://github.com/sponsors/eemeli" + } + }, + "node_modules/yargs": { + "version": "15.4.1", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-15.4.1.tgz", + "integrity": "sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A==", + "license": "MIT", + "dependencies": { + "cliui": "^6.0.0", + "decamelize": "^1.2.0", + "find-up": "^4.1.0", + "get-caller-file": "^2.0.1", + "require-directory": "^2.1.1", + "require-main-filename": "^2.0.0", + "set-blocking": "^2.0.0", + "string-width": "^4.2.0", + "which-module": "^2.0.0", + "y18n": "^4.0.0", + "yargs-parser": "^18.1.2" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/yargs-parser": { + "version": "21.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", + "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", + "license": "ISC", + "engines": { + "node": ">=12" + } + }, + "node_modules/yargs-unparser": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-2.0.0.tgz", + "integrity": "sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA==", + "license": "MIT", + "dependencies": { + "camelcase": "^6.0.0", + "decamelize": "^4.0.0", + "flat": "^5.0.2", + "is-plain-obj": "^2.1.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/yargs-unparser/node_modules/camelcase": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", + "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/yargs-unparser/node_modules/decamelize": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-4.0.0.tgz", + "integrity": "sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==", + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/yargs-unparser/node_modules/is-plain-obj": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.1.0.tgz", + "integrity": "sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/yargs/node_modules/cliui": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-6.0.0.tgz", + "integrity": "sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ==", + "license": "ISC", + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^6.2.0" + } + }, + "node_modules/yargs/node_modules/find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "license": "MIT", + "dependencies": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/yargs/node_modules/locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "license": "MIT", + "dependencies": { + "p-locate": "^4.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/yargs/node_modules/p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "license": "MIT", + "dependencies": { + "p-try": "^2.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/yargs/node_modules/p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "license": "MIT", + "dependencies": { + "p-limit": "^2.2.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/yargs/node_modules/yargs-parser": { + "version": "18.1.3", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-18.1.3.tgz", + "integrity": "sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ==", + "license": "ISC", + "dependencies": { + "camelcase": "^5.0.0", + "decamelize": "^1.2.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/yauzl": { + "version": "2.10.0", + "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.10.0.tgz", + "integrity": "sha512-p4a9I6X6nu6IhoGmBqAcbJy1mlC4j27vEPZX9F4L4/vZT3Lyq1VkFHw/V/PUcB9Buo+DG3iHkT0x3Qya58zc3g==", + "license": "MIT", + "dependencies": { + "buffer-crc32": "~0.2.3", + "fd-slicer": "~1.1.0" + } + }, + "node_modules/yazl": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/yazl/-/yazl-2.5.1.tgz", + "integrity": "sha512-phENi2PLiHnHb6QBVot+dJnaAZ0xosj7p3fWl+znIjBDlnMI2PsZCJZ306BPTFOaHf5qdDEI8x5qFrSOBN5vrw==", + "dev": true, + "license": "MIT", + "dependencies": { + "buffer-crc32": "~0.2.3" + } + }, + "node_modules/yjs": { + "version": "13.6.29", + "resolved": "https://registry.npmjs.org/yjs/-/yjs-13.6.29.tgz", + "integrity": "sha512-kHqDPdltoXH+X4w1lVmMtddE3Oeqq48nM40FD5ojTd8xYhQpzIDcfE2keMSU5bAgRPJBe225WTUdyUgj1DtbiQ==", + "license": "MIT", + "dependencies": { + "lib0": "^0.2.99" + }, + "engines": { + "node": ">=16.0.0", + "npm": ">=8.0.0" + }, + "funding": { + "type": "GitHub Sponsors ❤", + "url": "https://github.com/sponsors/dmonad" + } + }, + "node_modules/yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/yoctocolors-cjs": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/yoctocolors-cjs/-/yoctocolors-cjs-2.1.3.tgz", + "integrity": "sha512-U/PBtDf35ff0D8X8D0jfdzHYEPFxAI7jJlxZXwCSez5M3190m+QobIfh+sWDWSHMCWWJN2AWamkegn6vr6YBTw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/zip-stream": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/zip-stream/-/zip-stream-4.1.1.tgz", + "integrity": "sha512-9qv4rlDiopXg4E69k+vMHjNN63YFMe9sZMrdlvKnCjlCRWeCBswPPMPUfx+ipsAWq1LXHe70RcbaHdJJpS6hyQ==", + "license": "MIT", + "dependencies": { + "archiver-utils": "^3.0.4", + "compress-commons": "^4.1.2", + "readable-stream": "^3.6.0" + }, + "engines": { + "node": ">= 10" + } + }, + "node_modules/zip-stream/node_modules/archiver-utils": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/archiver-utils/-/archiver-utils-3.0.4.tgz", + "integrity": "sha512-KVgf4XQVrTjhyWmx6cte4RxonPLR9onExufI1jhvw/MQ4BB6IsZD5gT8Lq+u/+pRkWna/6JoHpiQioaqFP5Rzw==", + "license": "MIT", + "dependencies": { + "glob": "^7.2.3", + "graceful-fs": "^4.2.0", + "lazystream": "^1.0.0", + "lodash.defaults": "^4.2.0", + "lodash.difference": "^4.5.0", + "lodash.flatten": "^4.4.0", + "lodash.isplainobject": "^4.0.6", + "lodash.union": "^4.6.0", + "normalize-path": "^3.0.0", + "readable-stream": "^3.6.0" + }, + "engines": { + "node": ">= 10" + } + }, + "node_modules/zod": { + "version": "3.23.8", + "resolved": "https://registry.npmjs.org/zod/-/zod-3.23.8.tgz", + "integrity": "sha512-XBx9AXhXktjUqnepgTiE5flcKIYWi/rme0Eaj+5Y0lftuGBq+jyRu/md4WnuxqgP1ubdpNCsYEYPxrzVHD8d6g==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/colinhacks" + } + }, + "node_modules/zod-to-json-schema": { + "version": "3.25.1", + "resolved": "https://registry.npmjs.org/zod-to-json-schema/-/zod-to-json-schema-3.25.1.tgz", + "integrity": "sha512-pM/SU9d3YAggzi6MtR4h7ruuQlqKtad8e9S0fmxcMi+ueAK5Korys/aWcV9LIIHTVbj01NdzxcnXSN+O74ZIVA==", + "license": "ISC", + "peerDependencies": { + "zod": "^3.25 || ^4" + } + }, + "packages/ai-anthropic": { + "name": "@theia/ai-anthropic", + "version": "1.68.0", + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "dependencies": { + "@anthropic-ai/sdk": "^0.65.0", + "@theia/ai-core": "1.68.0", + "@theia/core": "1.68.0", + "undici": "^7.16.0" + }, + "devDependencies": { + "@theia/ext-scripts": "1.68.0" + } + }, + "packages/ai-chat": { + "name": "@theia/ai-chat", + "version": "1.68.0", + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "dependencies": { + "@theia/ai-core": "1.68.0", + "@theia/core": "1.68.0", + "@theia/editor": "1.68.0", + "@theia/file-search": "1.68.0", + "@theia/filesystem": "1.68.0", + "@theia/monaco": "1.68.0", + "@theia/monaco-editor-core": "1.96.302", + "@theia/workspace": "1.68.0", + "js-yaml": "^4.1.0", + "tslib": "^2.6.2" + }, + "devDependencies": { + "@theia/ext-scripts": "1.68.0" + } + }, + "packages/ai-chat-ui": { + "name": "@theia/ai-chat-ui", + "version": "1.68.0", + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "dependencies": { + "@theia/ai-chat": "1.68.0", + "@theia/ai-core": "1.68.0", + "@theia/core": "1.68.0", + "@theia/editor": "1.68.0", + "@theia/editor-preview": "1.68.0", + "@theia/filesystem": "1.68.0", + "@theia/monaco": "1.68.0", + "@theia/monaco-editor-core": "1.96.302", + "@theia/preferences": "1.68.0", + "@theia/workspace": "1.68.0", + "date-fns": "^4.1.0", + "tslib": "^2.6.2", + "uuid": "^9.0.1" + }, + "devDependencies": { + "@theia/ext-scripts": "1.68.0" + } + }, + "packages/ai-chat-ui/node_modules/date-fns": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-4.1.0.tgz", + "integrity": "sha512-Ukq0owbQXxa/U3EGtsdVBkR1w7KOQ5gIBqdH2hkvknzZPYvBxb/aa6E8L7tmjFtkwZBu3UXBbjIgPo/Ez4xaNg==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/kossnocorp" + } + }, + "packages/ai-chat-ui/node_modules/uuid": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz", + "integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==", + "funding": [ + "https://github.com/sponsors/broofa", + "https://github.com/sponsors/ctavan" + ], + "license": "MIT", + "bin": { + "uuid": "dist/bin/uuid" + } + }, + "packages/ai-claude-code": { + "name": "@theia/ai-claude-code", + "version": "1.68.0", + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "dependencies": { + "@theia/ai-chat": "1.68.0", + "@theia/ai-chat-ui": "1.68.0", + "@theia/ai-core": "1.68.0", + "@theia/core": "1.68.0", + "@theia/editor": "1.68.0", + "@theia/filesystem": "1.68.0", + "@theia/monaco-editor-core": "^1.96.302", + "@theia/output": "1.68.0", + "@theia/workspace": "1.68.0", + "tslib": "^2.6.2" + }, + "devDependencies": { + "@theia/ext-scripts": "1.68.0" + } + }, + "packages/ai-code-completion": { + "name": "@theia/ai-code-completion", + "version": "1.68.0", + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "dependencies": { + "@theia/ai-core": "1.68.0", + "@theia/core": "1.68.0", + "@theia/filesystem": "1.68.0", + "@theia/monaco-editor-core": "1.96.302", + "@theia/output": "1.68.0", + "@theia/workspace": "1.68.0", + "tslib": "^2.6.2" + }, + "devDependencies": { + "@theia/ext-scripts": "1.68.0" + } + }, + "packages/ai-codex": { + "name": "@theia/ai-codex", + "version": "1.68.0", + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "dependencies": { + "@openai/codex-sdk": "^0.49.0", + "@theia/ai-chat": "1.68.0", + "@theia/ai-chat-ui": "1.68.0", + "@theia/ai-core": "1.68.0", + "@theia/ai-openai": "1.68.0", + "@theia/core": "1.68.0", + "@theia/editor": "1.68.0", + "@theia/filesystem": "1.68.0", + "@theia/monaco-editor-core": "^1.96.302", + "@theia/output": "1.68.0", + "@theia/workspace": "1.68.0", + "tslib": "^2.6.2" + }, + "devDependencies": { + "@theia/ext-scripts": "1.68.0" + } + }, + "packages/ai-copilot": { + "name": "@theia/ai-copilot", + "version": "1.68.0", + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "dependencies": { + "@theia/ai-core": "1.68.0", + "@theia/ai-openai": "1.68.0", + "@theia/core": "1.68.0", + "openai": "^6.3.0", + "tslib": "^2.6.2" + }, + "devDependencies": { + "@theia/ext-scripts": "1.68.0" + } + }, + "packages/ai-core": { + "name": "@theia/ai-core", + "version": "1.68.0", + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "dependencies": { + "@theia/core": "1.68.0", + "@theia/editor": "1.68.0", + "@theia/filesystem": "1.68.0", + "@theia/monaco": "1.68.0", + "@theia/monaco-editor-core": "1.96.302", + "@theia/output": "1.68.0", + "@theia/variable-resolver": "1.68.0", + "@theia/workspace": "1.68.0", + "@types/js-yaml": "^4.0.9", + "fast-deep-equal": "^3.1.3", + "js-yaml": "^4.1.0", + "tslib": "^2.6.2" + }, + "devDependencies": { + "@theia/ext-scripts": "1.68.0" + } + }, + "packages/ai-core-ui": { + "name": "@theia/ai-core-ui", + "version": "1.68.0", + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "dependencies": { + "@theia/ai-core": "1.68.0", + "@theia/core": "1.68.0", + "tslib": "^2.6.2" + }, + "devDependencies": { + "@theia/ext-scripts": "1.68.0" + } + }, + "packages/ai-editor": { + "name": "@theia/ai-editor", + "version": "1.68.0", + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "dependencies": { + "@theia/ai-chat": "1.68.0", + "@theia/ai-chat-ui": "1.68.0", + "@theia/ai-core": "1.68.0", + "@theia/core": "1.68.0", + "@theia/editor": "1.68.0", + "@theia/filesystem": "1.68.0", + "@theia/monaco": "1.68.0", + "@theia/monaco-editor-core": "1.96.302", + "@theia/workspace": "1.68.0" + }, + "devDependencies": { + "@theia/ext-scripts": "1.68.0" + } + }, + "packages/ai-google": { + "name": "@theia/ai-google", + "version": "1.68.0", + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "dependencies": { + "@google/genai": "^1.30.0", + "@theia/ai-core": "1.68.0", + "@theia/core": "1.68.0" + }, + "devDependencies": { + "@theia/ext-scripts": "1.68.0" + } + }, + "packages/ai-history": { + "name": "@theia/ai-history", + "version": "1.68.0", + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "dependencies": { + "@theia/ai-chat-ui": "1.68.0", + "@theia/ai-core": "1.68.0", + "@theia/core": "1.68.0", + "@theia/filesystem": "1.68.0", + "@theia/output": "1.68.0", + "@theia/workspace": "1.68.0", + "tslib": "^2.6.2" + }, + "devDependencies": { + "@theia/ext-scripts": "1.68.0" + } + }, + "packages/ai-hugging-face": { + "name": "@theia/ai-huggingface", + "version": "1.68.0", + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "dependencies": { + "@huggingface/inference": "^4.13.10", + "@theia/ai-core": "1.68.0", + "@theia/core": "1.68.0" + }, + "devDependencies": { + "@theia/ext-scripts": "1.68.0" + } + }, + "packages/ai-ide": { + "name": "@theia/ai-ide", + "version": "1.68.0", + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "dependencies": { + "@theia/ai-chat": "1.68.0", + "@theia/ai-chat-ui": "1.68.0", + "@theia/ai-core": "1.68.0", + "@theia/core": "1.68.0", + "@theia/debug": "1.68.0", + "@theia/editor": "1.68.0", + "@theia/filesystem": "1.68.0", + "@theia/markers": "1.68.0", + "@theia/monaco": "1.68.0", + "@theia/navigator": "1.68.0", + "@theia/preferences": "1.68.0", + "@theia/scm": "1.68.0", + "@theia/search-in-workspace": "1.68.0", + "@theia/task": "1.68.0", + "@theia/terminal": "1.68.0", + "@theia/workspace": "1.68.0", + "date-fns": "^4.1.0", + "ignore": "^6.0.0", + "js-yaml": "^4.1.0", + "minimatch": "^10.0.3", + "puppeteer-core": "^24.10.0", + "simple-git": "^3.25.0" + }, + "devDependencies": { + "@theia/cli": "1.68.0", + "@theia/test": "1.68.0" + } + }, + "packages/ai-ide/node_modules/@puppeteer/browsers": { + "version": "2.12.0", + "resolved": "https://registry.npmjs.org/@puppeteer/browsers/-/browsers-2.12.0.tgz", + "integrity": "sha512-Xuq42yxcQJ54ti8ZHNzF5snFvtpgXzNToJ1bXUGQRaiO8t+B6UM8sTUJfvV+AJnqtkJU/7hdy6nbKyA12aHtRw==", + "license": "Apache-2.0", + "dependencies": { + "debug": "^4.4.3", + "extract-zip": "^2.0.1", + "progress": "^2.0.3", + "proxy-agent": "^6.5.0", + "semver": "^7.7.3", + "tar-fs": "^3.1.1", + "yargs": "^17.7.2" + }, + "bin": { + "browsers": "lib/cjs/main-cli.js" + }, + "engines": { + "node": ">=18" + } + }, + "packages/ai-ide/node_modules/chromium-bidi": { + "version": "13.1.1", + "resolved": "https://registry.npmjs.org/chromium-bidi/-/chromium-bidi-13.1.1.tgz", + "integrity": "sha512-zB9MpoPd7VJwjowQqiW3FKOvQwffFMjQ8Iejp5ZW+sJaKLRhZX1sTxzl3Zt22TDB4zP0OOqs8lRoY7eAW5geyQ==", + "license": "Apache-2.0", + "dependencies": { + "mitt": "^3.0.1", + "zod": "^3.24.1" + }, + "peerDependencies": { + "devtools-protocol": "*" + } + }, + "packages/ai-ide/node_modules/date-fns": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-4.1.0.tgz", + "integrity": "sha512-Ukq0owbQXxa/U3EGtsdVBkR1w7KOQ5gIBqdH2hkvknzZPYvBxb/aa6E8L7tmjFtkwZBu3UXBbjIgPo/Ez4xaNg==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/kossnocorp" + } + }, + "packages/ai-ide/node_modules/devtools-protocol": { + "version": "0.0.1566079", + "resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.1566079.tgz", + "integrity": "sha512-MJfAEA1UfVhSs7fbSQOG4czavUp1ajfg6prlAN0+cmfa2zNjaIbvq8VneP7do1WAQQIvgNJWSMeP6UyI90gIlQ==", + "license": "BSD-3-Clause" + }, + "packages/ai-ide/node_modules/ignore": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-6.0.2.tgz", + "integrity": "sha512-InwqeHHN2XpumIkMvpl/DCJVrAHgCsG5+cn1XlnLWGwtZBm8QJfSusItfrwx81CTp5agNZqpKU2J/ccC5nGT4A==", + "license": "MIT", + "engines": { + "node": ">= 4" + } + }, + "packages/ai-ide/node_modules/puppeteer-core": { + "version": "24.37.2", + "resolved": "https://registry.npmjs.org/puppeteer-core/-/puppeteer-core-24.37.2.tgz", + "integrity": "sha512-nN8qwE3TGF2vA/+xemPxbesntTuqD9vCGOiZL2uh8HES3pPzLX20MyQjB42dH2rhQ3W3TljZ4ZaKZ0yX/abQuw==", + "license": "Apache-2.0", + "dependencies": { + "@puppeteer/browsers": "2.12.0", + "chromium-bidi": "13.1.1", + "debug": "^4.4.3", + "devtools-protocol": "0.0.1566079", + "typed-query-selector": "^2.12.0", + "webdriver-bidi-protocol": "0.4.0", + "ws": "^8.19.0" + }, + "engines": { + "node": ">=18" + } + }, + "packages/ai-ide/node_modules/y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "license": "ISC", + "engines": { + "node": ">=10" + } + }, + "packages/ai-ide/node_modules/yargs": { + "version": "17.7.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", + "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", + "license": "MIT", + "dependencies": { + "cliui": "^8.0.1", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.3", + "y18n": "^5.0.5", + "yargs-parser": "^21.1.1" + }, + "engines": { + "node": ">=12" + } + }, + "packages/ai-ide/node_modules/zod": { + "version": "3.25.76", + "resolved": "https://registry.npmjs.org/zod/-/zod-3.25.76.tgz", + "integrity": "sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/colinhacks" + } + }, + "packages/ai-llamafile": { + "name": "@theia/ai-llamafile", + "version": "1.68.0", + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "dependencies": { + "@theia/ai-core": "1.68.0", + "@theia/core": "1.68.0", + "@theia/output": "1.68.0", + "tslib": "^2.6.2" + }, + "devDependencies": { + "@theia/ext-scripts": "1.68.0" + } + }, + "packages/ai-mcp-server.disabled": { + "name": "@theia/ai-mcp-server", + "version": "1.68.0", + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "dependencies": { + "@modelcontextprotocol/sdk": "^1.25.1", + "@theia/core": "1.68.0", + "@theia/workspace": "1.68.0", + "zod": "^4.2.1" + }, + "devDependencies": { + "@theia/ext-scripts": "1.68.0" + } + }, + "packages/ai-mcp-server.disabled/node_modules/zod": { + "version": "4.3.6", + "resolved": "https://registry.npmjs.org/zod/-/zod-4.3.6.tgz", + "integrity": "sha512-rftlrkhHZOcjDwkGlnUtZZkvaPHCsDATp4pGpuOOMDaTdDDXF91wuVDJoWoPsKX/3YPQ5fHuF3STjcYyKr+Qhg==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/colinhacks" + } + }, + "packages/ai-mcp-ui.disabled": { + "name": "@theia/ai-mcp-ui", + "version": "1.68.0", + "extraneous": true, + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "dependencies": { + "@theia/ai-core": "1.68.0", + "@theia/ai-mcp": "1.68.0", + "@theia/core": "1.68.0" + }, + "devDependencies": { + "@theia/ext-scripts": "1.68.0" + } + }, + "packages/ai-mcp.disabled": { + "name": "@theia/ai-mcp", + "version": "1.68.0", + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "dependencies": { + "@modelcontextprotocol/sdk": "^1.25.1", + "@theia/ai-core": "1.68.0", + "@theia/core": "1.68.0", + "@theia/workspace": "1.68.0" + }, + "devDependencies": { + "@theia/ext-scripts": "1.68.0" + } + }, + "packages/ai-ollama": { + "name": "@theia/ai-ollama", + "version": "1.68.0", + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "dependencies": { + "@theia/ai-core": "1.68.0", + "@theia/core": "1.68.0", + "@theia/filesystem": "1.68.0", + "@theia/workspace": "1.68.0", + "ollama": "^0.5.16", + "tslib": "^2.6.2" + }, + "devDependencies": { + "@theia/ext-scripts": "1.68.0" + } + }, + "packages/ai-openai": { + "name": "@theia/ai-openai", + "version": "1.68.0", + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "dependencies": { + "@theia/ai-core": "1.68.0", + "@theia/core": "1.68.0", + "@theia/filesystem": "1.68.0", + "@theia/workspace": "1.68.0", + "openai": "^6.3.0", + "tslib": "^2.6.2", + "undici": "^7.16.0" + }, + "devDependencies": { + "@theia/ext-scripts": "1.68.0" + } + }, + "packages/ai-scanoss": { + "name": "@theia/ai-scanoss", + "version": "1.68.0", + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "dependencies": { + "@theia/ai-chat": "1.68.0", + "@theia/ai-chat-ui": "1.68.0", + "@theia/ai-core": "1.68.0", + "@theia/core": "1.68.0", + "@theia/monaco": "1.68.0", + "@theia/monaco-editor-core": "1.96.302", + "@theia/scanoss": "1.68.0" + }, + "devDependencies": { + "@theia/ext-scripts": "1.68.0" + } + }, + "packages/ai-terminal": { + "name": "@theia/ai-terminal", + "version": "1.68.0", + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "dependencies": { + "@theia/ai-chat": "1.68.0", + "@theia/ai-chat-ui": "1.68.0", + "@theia/ai-core": "1.68.0", + "@theia/core": "1.68.0", + "@theia/terminal": "1.68.0", + "@theia/workspace": "1.68.0", + "zod": "^4.2.1" + }, + "devDependencies": { + "@theia/ext-scripts": "1.68.0" + } + }, + "packages/ai-terminal/node_modules/zod": { + "version": "4.3.6", + "resolved": "https://registry.npmjs.org/zod/-/zod-4.3.6.tgz", + "integrity": "sha512-rftlrkhHZOcjDwkGlnUtZZkvaPHCsDATp4pGpuOOMDaTdDDXF91wuVDJoWoPsKX/3YPQ5fHuF3STjcYyKr+Qhg==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/colinhacks" + } + }, + "packages/ai-vercel-ai": { + "name": "@theia/ai-vercel-ai", + "version": "1.68.0", + "extraneous": true, + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "dependencies": { + "@ai-sdk/anthropic": "^1.2.10", + "@ai-sdk/openai": "^1.3.21", + "@ai-sdk/provider": "^1.1.3", + "@theia/ai-core": "1.68.0", + "@theia/core": "1.68.0", + "@theia/filesystem": "1.68.0", + "@theia/workspace": "1.68.0", + "ai": "^4.3.13", + "tslib": "^2.6.2" + }, + "devDependencies": { + "@theia/ext-scripts": "1.68.0" + } + }, + "packages/bulk-edit": { + "name": "@theia/bulk-edit", + "version": "1.68.0", + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "dependencies": { + "@theia/core": "1.68.0", + "@theia/editor": "1.68.0", + "@theia/filesystem": "1.68.0", + "@theia/monaco": "1.68.0", + "@theia/monaco-editor-core": "1.96.302", + "@theia/workspace": "1.68.0", + "tslib": "^2.6.2" + }, + "devDependencies": { + "@theia/ext-scripts": "1.68.0" + } + }, + "packages/callhierarchy": { + "name": "@theia/callhierarchy", + "version": "1.68.0", + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "dependencies": { + "@theia/core": "1.68.0", + "@theia/editor": "1.68.0", + "ts-md5": "^1.2.2", + "tslib": "^2.6.2" + }, + "devDependencies": { + "@theia/ext-scripts": "1.68.0" + } + }, + "packages/collaboration": { + "name": "@theia/collaboration", + "version": "1.68.0", + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "dependencies": { + "@theia/core": "1.68.0", + "@theia/editor": "1.68.0", + "@theia/filesystem": "1.68.0", + "@theia/monaco": "1.68.0", + "@theia/monaco-editor-core": "1.96.302", + "@theia/workspace": "1.68.0", + "lib0": "^0.2.52", + "open-collaboration-protocol": "0.3.0", + "open-collaboration-yjs": "0.3.0", + "socket.io-client": "^4.5.3", + "y-protocols": "^1.0.6", + "yjs": "^13.6.7" + }, + "devDependencies": { + "@theia/ext-scripts": "1.68.0" + } + }, + "packages/console": { + "name": "@theia/console", + "version": "1.68.0", + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "dependencies": { + "@theia/core": "1.68.0", + "@theia/editor": "1.68.0", + "@theia/monaco": "1.68.0", + "@theia/monaco-editor-core": "1.96.302", + "anser": "^2.0.1", + "tslib": "^2.6.2" + }, + "devDependencies": { + "@theia/ext-scripts": "1.68.0" + } + }, + "packages/core": { + "name": "@theia/core", + "version": "1.68.0", + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "dependencies": { + "@babel/runtime": "^7.10.0", + "@lumino/algorithm": "^2.0.4", + "@lumino/commands": "^2.3.3", + "@lumino/coreutils": "^2.2.2", + "@lumino/domutils": "^2.0.4", + "@lumino/dragdrop": "^2.1.7", + "@lumino/messaging": "^2.0.4", + "@lumino/properties": "^2.0.4", + "@lumino/signaling": "^2.1.5", + "@lumino/virtualdom": "^2.0.4", + "@lumino/widgets": "2.7.2", + "@parcel/watcher": "^2.5.0", + "@theia/application-package": "1.68.0", + "@theia/request": "1.68.0", + "@types/body-parser": "^1.16.4", + "@types/express": "^4.17.21", + "@types/fs-extra": "^4.0.2", + "@types/lodash.debounce": "4.0.3", + "@types/lodash.throttle": "^4.1.3", + "@types/markdown-it": "^14.1.0", + "@types/markdown-it-emoji": "^3.0.1", + "@types/react": "^18.0.15", + "@types/react-dom": "^18.0.6", + "@types/route-parser": "^0.1.1", + "@types/safer-buffer": "^2.1.0", + "@types/uuid": "^9.0.8", + "@types/ws": "^8.5.5", + "@types/yargs": "^15", + "@vscode/codicons": "*", + "ajv": "^6.5.3", + "async-mutex": "^0.4.0", + "body-parser": "^1.17.2", + "cookie": "^1.0.2", + "dompurify": "^3.2.4", + "drivelist": "^12.0.2", + "express": "^4.21.0", + "fast-json-stable-stringify": "^2.1.0", + "file-icons-js": "~1.0.3", + "font-awesome": "^4.7.0", + "fs-extra": "^4.0.2", + "fuzzy": "^0.1.3", + "http-proxy-agent": "^5.0.0", + "https-proxy-agent": "^5.0.0", + "iconv-lite": "^0.6.0", + "inversify": "^6.1.3", + "jschardet": "^2.1.1", + "keytar": "7.9.0", + "lodash.debounce": "^4.0.8", + "lodash.throttle": "^4.1.1", + "markdown-it": "^14.1.0", + "markdown-it-anchor": "^9.2.0", + "markdown-it-emoji": "^3.0.0", + "msgpackr": "^1.10.2", + "p-debounce": "^2.1.0", + "perfect-scrollbar": "1.5.5", + "react": "^18.2.0", + "react-dom": "^18.2.0", + "react-tooltip": "^4.2.21", + "react-virtuoso": "^2.17.0", + "reflect-metadata": "^0.2.2", + "route-parser": "^0.0.5", + "safer-buffer": "^2.1.2", + "socket.io": "^4.5.3", + "socket.io-client": "^4.5.3", + "tslib": "^2.6.2", + "uuid": "^9.0.1", + "vscode-languageserver-protocol": "^3.17.2", + "vscode-uri": "^2.1.1", + "ws": "^8.17.1", + "yargs": "^15.3.1" + }, + "devDependencies": { + "@theia/ext-scripts": "1.68.0", + "@theia/re-exports": "1.68.0", + "minimist": "^1.2.0", + "nodejs-file-downloader": "4.13.0" + }, + "peerDependencies": { + "@theia/electron": "*" + }, + "peerDependenciesMeta": { + "@theia/electron": { + "optional": true + } + } + }, + "packages/core/node_modules/linkify-it": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-5.0.0.tgz", + "integrity": "sha512-5aHCbzQRADcdP+ATqnDuhhJ/MRIqDkZX5pyjFHRRysS8vZ5AbqGEoFIb6pYHPZ+L/OC2Lc+xT8uHVVR5CAK/wQ==", + "license": "MIT", + "dependencies": { + "uc.micro": "^2.0.0" + } + }, + "packages/core/node_modules/markdown-it": { + "version": "14.1.0", + "resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-14.1.0.tgz", + "integrity": "sha512-a54IwgWPaeBCAAsv13YgmALOF1elABB08FxO9i+r4VFk5Vl4pKokRPeX8u5TCgSsPi6ec1otfLjdOpVcgbpshg==", + "license": "MIT", + "dependencies": { + "argparse": "^2.0.1", + "entities": "^4.4.0", + "linkify-it": "^5.0.0", + "mdurl": "^2.0.0", + "punycode.js": "^2.3.1", + "uc.micro": "^2.1.0" + }, + "bin": { + "markdown-it": "bin/markdown-it.mjs" + } + }, + "packages/core/node_modules/mdurl": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/mdurl/-/mdurl-2.0.0.tgz", + "integrity": "sha512-Lf+9+2r+Tdp5wXDXC4PcIBjTDtq4UKjCPMQhKIuzpJNW0b96kVqSwW0bT7FhRSfmAiFYgP+SCRvdrDozfh0U5w==", + "license": "MIT" + }, + "packages/core/node_modules/uc.micro": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-2.1.0.tgz", + "integrity": "sha512-ARDJmphmdvUk6Glw7y9DQ2bFkKBHwQHLi2lsaH6PPmz/Ka9sFOBsBluozhDltWmnv9u/cF6Rt87znRTPV+yp/A==", + "license": "MIT" + }, + "packages/core/node_modules/uuid": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz", + "integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==", + "funding": [ + "https://github.com/sponsors/broofa", + "https://github.com/sponsors/ctavan" + ], + "license": "MIT", + "bin": { + "uuid": "dist/bin/uuid" + } + }, + "packages/debug": { + "name": "@theia/debug", + "version": "1.68.0", + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "dependencies": { + "@theia/console": "1.68.0", + "@theia/core": "1.68.0", + "@theia/editor": "1.68.0", + "@theia/filesystem": "1.68.0", + "@theia/markers": "1.68.0", + "@theia/monaco": "1.68.0", + "@theia/monaco-editor-core": "1.96.302", + "@theia/output": "1.68.0", + "@theia/process": "1.68.0", + "@theia/task": "1.68.0", + "@theia/terminal": "1.68.0", + "@theia/test": "1.68.0", + "@theia/variable-resolver": "1.68.0", + "@theia/workspace": "1.68.0", + "@vscode/debugprotocol": "^1.51.0", + "fast-deep-equal": "^3.1.3", + "jsonc-parser": "^2.2.0", + "p-debounce": "^2.1.0", + "tslib": "^2.6.2" + }, + "devDependencies": { + "@theia/ext-scripts": "1.68.0" + } + }, + "packages/debug/node_modules/jsonc-parser": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-2.3.1.tgz", + "integrity": "sha512-H8jvkz1O50L3dMZCsLqiuB2tA7muqbSg1AtGEkN0leAqGjsUzDJir3Zwr02BhqdcITPg3ei3mZ+HjMocAknhhg==", + "license": "MIT" + }, + "packages/design-panel": { + "name": "@theia/design-panel", + "version": "1.68.0", + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "dependencies": { + "@theia/core": "1.68.0", + "@theia/filesystem": "1.68.0", + "@theia/workspace": "1.68.0", + "tslib": "^2.6.2" + }, + "devDependencies": { + "@theia/ext-scripts": "1.68.0" + } + }, + "packages/dev-container": { + "name": "@theia/dev-container", + "version": "1.68.0", + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "dependencies": { + "@theia/core": "1.68.0", + "@theia/output": "1.68.0", + "@theia/remote": "1.68.0", + "@theia/workspace": "1.68.0", + "dockerode": "^4.0.2", + "jsonc-parser": "^2.2.0", + "uuid": "^8.0.0" + }, + "devDependencies": { + "@theia/ext-scripts": "1.68.0", + "@types/dockerode": "^3.3.23" + } + }, + "packages/dev-container/node_modules/jsonc-parser": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-2.3.1.tgz", + "integrity": "sha512-H8jvkz1O50L3dMZCsLqiuB2tA7muqbSg1AtGEkN0leAqGjsUzDJir3Zwr02BhqdcITPg3ei3mZ+HjMocAknhhg==", + "license": "MIT" + }, + "packages/editor": { + "name": "@theia/editor", + "version": "1.68.0", + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "dependencies": { + "@theia/core": "1.68.0", + "@theia/variable-resolver": "1.68.0", + "tslib": "^2.6.2" + }, + "devDependencies": { + "@theia/ext-scripts": "1.68.0" + } + }, + "packages/editor-preview": { + "name": "@theia/editor-preview", + "version": "1.68.0", + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "dependencies": { + "@theia/core": "1.68.0", + "@theia/editor": "1.68.0", + "@theia/navigator": "1.68.0", + "tslib": "^2.6.2" + }, + "devDependencies": { + "@theia/ext-scripts": "1.68.0" + } + }, + "packages/electron": { + "name": "@theia/electron", + "version": "1.68.0", + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "dependencies": { + "electron-store": "^8.0.0", + "fix-path": "^4.0.0", + "native-keymap": "^2.2.1" + }, + "devDependencies": { + "@theia/ext-scripts": "1.68.0", + "@theia/re-exports": "1.68.0" + }, + "peerDependencies": { + "electron": "38.4.0" + } + }, + "packages/external-terminal": { + "name": "@theia/external-terminal", + "version": "1.68.0", + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "dependencies": { + "@theia/core": "1.68.0", + "@theia/editor": "1.68.0", + "@theia/workspace": "1.68.0", + "tslib": "^2.6.2" + }, + "devDependencies": { + "@theia/ext-scripts": "1.68.0" + } + }, + "packages/file-search": { + "name": "@theia/file-search", + "version": "1.68.0", + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "dependencies": { + "@theia/core": "1.68.0", + "@theia/editor": "1.68.0", + "@theia/filesystem": "1.68.0", + "@theia/process": "1.68.0", + "@theia/workspace": "1.68.0", + "@vscode/ripgrep": "^1.14.2", + "tslib": "^2.6.2" + }, + "devDependencies": { + "@theia/ext-scripts": "1.68.0" + } + }, + "packages/filesystem": { + "name": "@theia/filesystem", + "version": "1.68.0", + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "dependencies": { + "@theia/core": "1.68.0", + "@types/body-parser": "^1.17.0", + "@types/multer": "^1.4.7", + "@types/tar-fs": "^1.16.1", + "@types/tar-stream": "^3.1.4", + "async-mutex": "^0.3.1", + "body-parser": "^1.18.3", + "http-status-codes": "^1.3.0", + "ignore": "^6.0.0", + "minimatch": "^10.0.3", + "multer": "^2.0.1", + "opfs-worker": "1.3.1", + "rimraf": "^5.0.0", + "stat-mode": "^1.0.0", + "tar-fs": "^3.0.9", + "tar-stream": "^3.1.7", + "trash": "^7.2.0", + "tslib": "^2.6.2", + "vscode-languageserver-textdocument": "^1.0.1" + }, + "devDependencies": { + "@theia/ext-scripts": "1.68.0" + } + }, + "packages/filesystem/node_modules/async-mutex": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/async-mutex/-/async-mutex-0.3.2.tgz", + "integrity": "sha512-HuTK7E7MT7jZEh1P9GtRW9+aTWiDWWi9InbZ5hjxrnRa39KS4BW04+xLBhYNS2aXhHUIKZSw3gj4Pn1pj+qGAA==", + "license": "MIT", + "dependencies": { + "tslib": "^2.3.1" + } + }, + "packages/filesystem/node_modules/ignore": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-6.0.2.tgz", + "integrity": "sha512-InwqeHHN2XpumIkMvpl/DCJVrAHgCsG5+cn1XlnLWGwtZBm8QJfSusItfrwx81CTp5agNZqpKU2J/ccC5nGT4A==", + "license": "MIT", + "engines": { + "node": ">= 4" + } + }, + "packages/filesystem/node_modules/tar-stream": { + "version": "3.1.7", + "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-3.1.7.tgz", + "integrity": "sha512-qJj60CXt7IU1Ffyc3NJMjh6EkuCFej46zUqJ4J7pqYlThyd9bO0XBTmcOIhSzZJVWfsLks0+nle/j538YAW9RQ==", + "license": "MIT", + "dependencies": { + "b4a": "^1.6.4", + "fast-fifo": "^1.2.0", + "streamx": "^2.15.0" + } + }, + "packages/getting-started": { + "name": "@theia/getting-started", + "version": "1.68.0", + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "dependencies": { + "@theia/core": "1.68.0", + "@theia/editor": "1.68.0", + "@theia/filesystem": "1.68.0", + "@theia/keymaps": "1.68.0", + "@theia/preview": "1.68.0", + "@theia/workspace": "1.68.0", + "tslib": "^2.6.2" + }, + "devDependencies": { + "@theia/ext-scripts": "1.68.0" + } + }, + "packages/git": { + "name": "@theia/git", + "version": "1.68.0", + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "dependencies": { + "@theia/core": "1.68.0", + "@theia/editor": "1.68.0", + "@theia/filesystem": "1.68.0", + "@theia/monaco-editor-core": "1.96.302", + "@theia/navigator": "1.68.0", + "@theia/scm": "1.68.0", + "@theia/scm-extra": "1.68.0", + "@theia/workspace": "1.68.0", + "@types/diff": "^5.2.1", + "diff": "^5.2.0", + "dugite-extra": "0.1.17", + "find-git-exec": "^0.0.4", + "find-git-repositories": "^0.1.1", + "luxon": "^2.4.0", + "node-ssh": "^12.0.1", + "octicons": "^7.1.0", + "p-queue": "^8.0.1", + "ts-md5": "^1.2.2", + "tslib": "^2.6.2" + }, + "devDependencies": { + "@theia/ext-scripts": "1.68.0", + "@types/luxon": "^2.3.2", + "upath": "^1.0.2" + } + }, + "packages/git/node_modules/diff": { + "version": "5.2.2", + "resolved": "https://registry.npmjs.org/diff/-/diff-5.2.2.tgz", + "integrity": "sha512-vtcDfH3TOjP8UekytvnHH1o1P4FcUdt4eQ1Y+Abap1tk/OB2MWQvcwS2ClCd1zuIhc3JKOx6p3kod8Vfys3E+A==", + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.3.1" + } + }, + "packages/git/node_modules/eventemitter3": { + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.4.tgz", + "integrity": "sha512-mlsTRyGaPBjPedk6Bvw+aqbsXDtoAyAzm5MO7JgU+yVRyMQ5O8bD4Kcci7BS85f93veegeCPkL8R4GLClnjLFw==", + "license": "MIT" + }, + "packages/git/node_modules/p-queue": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/p-queue/-/p-queue-8.1.1.tgz", + "integrity": "sha512-aNZ+VfjobsWryoiPnEApGGmf5WmNsCo9xu8dfaYamG5qaLP7ClhLN6NgsFe6SwJ2UbLEBK5dv9x8Mn5+RVhMWQ==", + "license": "MIT", + "dependencies": { + "eventemitter3": "^5.0.1", + "p-timeout": "^6.1.2" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "packages/git/node_modules/p-timeout": { + "version": "6.1.4", + "resolved": "https://registry.npmjs.org/p-timeout/-/p-timeout-6.1.4.tgz", + "integrity": "sha512-MyIV3ZA/PmyBN/ud8vV9XzwTrNtR4jFrObymZYnZqMmW0zA8Z17vnT0rBgFE/TlohB+YCHqXMgZzb3Csp49vqg==", + "license": "MIT", + "engines": { + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "packages/git/node_modules/upath": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/upath/-/upath-1.2.0.tgz", + "integrity": "sha512-aZwGpamFO61g3OlfT7OQCHqhGnW43ieH9WZeP7QxN/G/jS4jfqUkZxoryvJgVPEcrl5NL/ggHsSmLMHuH64Lhg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4", + "yarn": "*" + } + }, + "packages/keymaps": { + "name": "@theia/keymaps", + "version": "1.68.0", + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "dependencies": { + "@theia/core": "1.68.0", + "@theia/monaco": "1.68.0", + "@theia/monaco-editor-core": "1.96.302", + "@theia/preferences": "1.68.0", + "@theia/userstorage": "1.68.0", + "jsonc-parser": "^2.2.0", + "tslib": "^2.6.2" + }, + "devDependencies": { + "@theia/ext-scripts": "1.68.0" + } + }, + "packages/keymaps/node_modules/jsonc-parser": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-2.3.1.tgz", + "integrity": "sha512-H8jvkz1O50L3dMZCsLqiuB2tA7muqbSg1AtGEkN0leAqGjsUzDJir3Zwr02BhqdcITPg3ei3mZ+HjMocAknhhg==", + "license": "MIT" + }, + "packages/markers": { + "name": "@theia/markers", + "version": "1.68.0", + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "dependencies": { + "@theia/core": "1.68.0", + "@theia/filesystem": "1.68.0", + "@theia/workspace": "1.68.0", + "tslib": "^2.6.2" + }, + "devDependencies": { + "@theia/ext-scripts": "1.68.0" + } + }, + "packages/memory-inspector": { + "name": "@theia/memory-inspector", + "version": "1.68.0", + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "dependencies": { + "@theia/core": "1.68.0", + "@theia/debug": "1.68.0", + "@vscode/debugprotocol": "^1.51.0", + "long": "^4.0.0", + "tslib": "^2.6.2" + }, + "devDependencies": { + "@types/long": "^4.0.0" + } + }, + "packages/memory-inspector/node_modules/long": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/long/-/long-4.0.0.tgz", + "integrity": "sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA==", + "license": "Apache-2.0" + }, + "packages/messages": { + "name": "@theia/messages", + "version": "1.68.0", + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "dependencies": { + "@theia/core": "1.68.0", + "react-perfect-scrollbar": "^1.5.3", + "ts-md5": "^1.2.2", + "tslib": "^2.6.2" + }, + "devDependencies": { + "@theia/ext-scripts": "1.68.0" + } + }, + "packages/metrics": { + "name": "@theia/metrics", + "version": "1.68.0", + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "dependencies": { + "@theia/core": "1.68.0", + "prom-client": "^10.2.0", + "tslib": "^2.6.2" + }, + "devDependencies": { + "@theia/ext-scripts": "1.68.0" + } + }, + "packages/mini-browser": { + "name": "@theia/mini-browser", + "version": "1.68.0", + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "dependencies": { + "@theia/core": "1.68.0", + "@theia/filesystem": "1.68.0", + "@types/mime-types": "^2.1.0", + "mime-types": "^2.1.18", + "pdfobject": "^2.0.201604172", + "tslib": "^2.6.2", + "vhost": "^3.0.2" + }, + "devDependencies": { + "@theia/ext-scripts": "1.68.0" + } + }, + "packages/monaco": { + "name": "@theia/monaco", + "version": "1.68.0", + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "dependencies": { + "@theia/core": "1.68.0", + "@theia/editor": "1.68.0", + "@theia/filesystem": "1.68.0", + "@theia/markers": "1.68.0", + "@theia/monaco-editor-core": "1.96.302", + "@theia/outline-view": "1.68.0", + "@theia/workspace": "1.68.0", + "fast-plist": "^0.1.2", + "idb": "^4.0.5", + "jsonc-parser": "^2.2.0", + "tslib": "^2.6.2", + "vscode-oniguruma": "2.0.1", + "vscode-textmate": "^9.2.0" + }, + "devDependencies": { + "@theia/ext-scripts": "1.68.0" + } + }, + "packages/monaco/node_modules/jsonc-parser": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-2.3.1.tgz", + "integrity": "sha512-H8jvkz1O50L3dMZCsLqiuB2tA7muqbSg1AtGEkN0leAqGjsUzDJir3Zwr02BhqdcITPg3ei3mZ+HjMocAknhhg==", + "license": "MIT" + }, + "packages/navigator": { + "name": "@theia/navigator", + "version": "1.68.0", + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "dependencies": { + "@theia/core": "1.68.0", + "@theia/filesystem": "1.68.0", + "@theia/workspace": "1.68.0", + "minimatch": "^10.0.3", + "tslib": "^2.6.2" + }, + "devDependencies": { + "@theia/ext-scripts": "1.68.0" + } + }, + "packages/notebook": { + "name": "@theia/notebook", + "version": "1.68.0", + "license": "EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0", + "dependencies": { + "@theia/core": "1.68.0", + "@theia/editor": "1.68.0", + "@theia/filesystem": "1.68.0", + "@theia/monaco": "1.68.0", + "@theia/monaco-editor-core": "1.96.302", + "@theia/outline-view": "1.68.0", + "advanced-mark.js": "^2.6.0", + "react-perfect-scrollbar": "^1.5.8", + "tslib": "^2.6.2" + }, + "devDependencies": { + "@theia/ext-scripts": "1.68.0", + "@types/markdown-it": "^12.2.3", + "@types/vscode-notebook-renderer": "^1.72.0" + } + }, + "packages/notebook/node_modules/@types/markdown-it": { + "version": "12.2.3", + "resolved": "https://registry.npmjs.org/@types/markdown-it/-/markdown-it-12.2.3.tgz", + "integrity": "sha512-GKMHFfv3458yYy+v/N8gjufHO6MSZKCOXpZc5GXIWWy8uldwfmPn98vp81gZ5f9SVw8YYBctgfJ22a2d7AOMeQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/linkify-it": "*", + "@types/mdurl": "*" + } + }, + "packages/outline-view": { + "name": "@theia/outline-view", + "version": "1.68.0", + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "dependencies": { + "@theia/core": "1.68.0", + "tslib": "^2.6.2" + }, + "devDependencies": { + "@theia/ext-scripts": "1.68.0" + } + }, + "packages/output": { + "name": "@theia/output", + "version": "1.68.0", + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "dependencies": { + "@theia/core": "1.68.0", + "@theia/editor": "1.68.0", + "@theia/monaco": "1.68.0", + "@theia/monaco-editor-core": "1.96.302", + "p-queue": "^8.0.1", + "tslib": "^2.6.2" + }, + "devDependencies": { + "@theia/ext-scripts": "1.68.0" + } + }, + "packages/output/node_modules/eventemitter3": { + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.4.tgz", + "integrity": "sha512-mlsTRyGaPBjPedk6Bvw+aqbsXDtoAyAzm5MO7JgU+yVRyMQ5O8bD4Kcci7BS85f93veegeCPkL8R4GLClnjLFw==", + "license": "MIT" + }, + "packages/output/node_modules/p-queue": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/p-queue/-/p-queue-8.1.1.tgz", + "integrity": "sha512-aNZ+VfjobsWryoiPnEApGGmf5WmNsCo9xu8dfaYamG5qaLP7ClhLN6NgsFe6SwJ2UbLEBK5dv9x8Mn5+RVhMWQ==", + "license": "MIT", + "dependencies": { + "eventemitter3": "^5.0.1", + "p-timeout": "^6.1.2" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "packages/output/node_modules/p-timeout": { + "version": "6.1.4", + "resolved": "https://registry.npmjs.org/p-timeout/-/p-timeout-6.1.4.tgz", + "integrity": "sha512-MyIV3ZA/PmyBN/ud8vV9XzwTrNtR4jFrObymZYnZqMmW0zA8Z17vnT0rBgFE/TlohB+YCHqXMgZzb3Csp49vqg==", + "license": "MIT", + "engines": { + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "packages/plugin": { + "name": "@theia/plugin", + "version": "1.68.0", + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "devDependencies": { + "@theia/ext-scripts": "1.68.0" + } + }, + "packages/plugin-dev": { + "name": "@theia/plugin-dev", + "version": "1.68.0", + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "dependencies": { + "@theia/core": "1.68.0", + "@theia/debug": "1.68.0", + "@theia/filesystem": "1.68.0", + "@theia/output": "1.68.0", + "@theia/plugin-ext": "1.68.0", + "@theia/workspace": "1.68.0", + "tslib": "^2.6.2" + }, + "devDependencies": { + "@theia/ext-scripts": "1.68.0" + } + }, + "packages/plugin-ext": { + "name": "@theia/plugin-ext", + "version": "1.68.0", + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "dependencies": { + "@theia/bulk-edit": "1.68.0", + "@theia/callhierarchy": "1.68.0", + "@theia/console": "1.68.0", + "@theia/core": "1.68.0", + "@theia/debug": "1.68.0", + "@theia/editor": "1.68.0", + "@theia/editor-preview": "1.68.0", + "@theia/file-search": "1.68.0", + "@theia/filesystem": "1.68.0", + "@theia/markers": "1.68.0", + "@theia/messages": "1.68.0", + "@theia/monaco": "1.68.0", + "@theia/monaco-editor-core": "1.96.302", + "@theia/navigator": "1.68.0", + "@theia/notebook": "1.68.0", + "@theia/output": "1.68.0", + "@theia/plugin": "1.68.0", + "@theia/preferences": "1.68.0", + "@theia/scm": "1.68.0", + "@theia/search-in-workspace": "1.68.0", + "@theia/task": "1.68.0", + "@theia/terminal": "1.68.0", + "@theia/test": "1.68.0", + "@theia/timeline": "1.68.0", + "@theia/typehierarchy": "1.68.0", + "@theia/variable-resolver": "1.68.0", + "@theia/workspace": "1.68.0", + "@types/mime": "^2.0.1", + "@vscode/debugprotocol": "^1.51.0", + "@vscode/proxy-agent": "^0.13.2", + "async-mutex": "^0.4.0", + "decompress": "^4.2.1", + "escape-html": "^1.0.3", + "filenamify": "^4.1.0", + "is-electron": "^2.2.0", + "jsonc-parser": "^2.2.0", + "lodash.clonedeep": "^4.5.0", + "macaddress": "^0.5.3", + "mime": "^2.4.4", + "node-pty": "1.1.0-beta27", + "semver": "^7.5.4", + "tslib": "^2.6.2", + "vhost": "^3.0.2", + "vscode-textmate": "^9.2.0" + }, + "devDependencies": { + "@theia/ext-scripts": "1.68.0", + "@types/decompress": "^4.2.2", + "@types/escape-html": "^0.0.20", + "@types/lodash.clonedeep": "^4.5.3" + } + }, + "packages/plugin-ext-headless": { + "name": "@theia/plugin-ext-headless", + "version": "1.68.0", + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "dependencies": { + "@theia/core": "1.68.0", + "@theia/plugin-ext": "1.68.0", + "@theia/terminal": "1.68.0", + "tslib": "^2.6.2" + }, + "devDependencies": { + "@theia/ext-scripts": "1.68.0", + "@types/decompress": "^4.2.2", + "@types/escape-html": "^0.0.20", + "@types/lodash.clonedeep": "^4.5.3" + } + }, + "packages/plugin-ext-vscode": { + "name": "@theia/plugin-ext-vscode", + "version": "1.68.0", + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "dependencies": { + "@theia/callhierarchy": "1.68.0", + "@theia/core": "1.68.0", + "@theia/editor": "1.68.0", + "@theia/filesystem": "1.68.0", + "@theia/monaco": "1.68.0", + "@theia/monaco-editor-core": "1.96.302", + "@theia/navigator": "1.68.0", + "@theia/outline-view": "1.68.0", + "@theia/plugin": "1.68.0", + "@theia/plugin-ext": "1.68.0", + "@theia/scm": "1.68.0", + "@theia/terminal": "1.68.0", + "@theia/typehierarchy": "1.68.0", + "@theia/userstorage": "1.68.0", + "@theia/workspace": "1.68.0", + "decompress": "^4.2.1", + "filenamify": "^4.1.0", + "tslib": "^2.6.2" + }, + "devDependencies": { + "@theia/ext-scripts": "1.68.0" + } + }, + "packages/plugin-ext/node_modules/@types/mime": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/@types/mime/-/mime-2.0.3.tgz", + "integrity": "sha512-Jus9s4CDbqwocc5pOAnh8ShfrnMcPHuJYzVcSUU7lrh8Ni5HuIqX3oilL86p3dlTrk0LzHRCgA/GQ7uNCw6l2Q==", + "license": "MIT" + }, + "packages/plugin-ext/node_modules/jsonc-parser": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-2.3.1.tgz", + "integrity": "sha512-H8jvkz1O50L3dMZCsLqiuB2tA7muqbSg1AtGEkN0leAqGjsUzDJir3Zwr02BhqdcITPg3ei3mZ+HjMocAknhhg==", + "license": "MIT" + }, + "packages/plugin-ext/node_modules/mime": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/mime/-/mime-2.6.0.tgz", + "integrity": "sha512-USPkMeET31rOMiarsBNIHZKLGgvKc/LrjofAnBlOttf5ajRvqiRA8QsenbcooctK6d6Ts6aqZXBA+XbkKthiQg==", + "license": "MIT", + "bin": { + "mime": "cli.js" + }, + "engines": { + "node": ">=4.0.0" + } + }, + "packages/plugin-metrics": { + "name": "@theia/plugin-metrics", + "version": "1.68.0", + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "dependencies": { + "@theia/core": "1.68.0", + "@theia/metrics": "1.68.0", + "@theia/monaco-editor-core": "1.96.302", + "@theia/plugin": "1.68.0", + "@theia/plugin-ext": "1.68.0", + "tslib": "^2.6.2" + }, + "devDependencies": { + "@theia/ext-scripts": "1.68.0" + } + }, + "packages/preferences": { + "name": "@theia/preferences", + "version": "1.68.0", + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "dependencies": { + "@theia/core": "1.68.0", + "@theia/editor": "1.68.0", + "@theia/filesystem": "1.68.0", + "@theia/monaco": "1.68.0", + "@theia/monaco-editor-core": "1.96.302", + "@theia/userstorage": "1.68.0", + "@theia/workspace": "1.68.0", + "async-mutex": "^0.3.1", + "fast-deep-equal": "^3.1.3", + "jsonc-parser": "^2.2.0", + "p-debounce": "^2.1.0", + "tslib": "^2.6.2" + }, + "devDependencies": { + "@theia/ext-scripts": "1.68.0" + } + }, + "packages/preferences/node_modules/async-mutex": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/async-mutex/-/async-mutex-0.3.2.tgz", + "integrity": "sha512-HuTK7E7MT7jZEh1P9GtRW9+aTWiDWWi9InbZ5hjxrnRa39KS4BW04+xLBhYNS2aXhHUIKZSw3gj4Pn1pj+qGAA==", + "license": "MIT", + "dependencies": { + "tslib": "^2.3.1" + } + }, + "packages/preferences/node_modules/jsonc-parser": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-2.3.1.tgz", + "integrity": "sha512-H8jvkz1O50L3dMZCsLqiuB2tA7muqbSg1AtGEkN0leAqGjsUzDJir3Zwr02BhqdcITPg3ei3mZ+HjMocAknhhg==", + "license": "MIT" + }, + "packages/preview": { + "name": "@theia/preview", + "version": "1.68.0", + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "dependencies": { + "@theia/core": "1.68.0", + "@theia/editor": "1.68.0", + "@theia/mini-browser": "1.68.0", + "@theia/monaco": "1.68.0", + "@types/highlight.js": "^10.1.0", + "highlight.js": "10.4.1", + "tslib": "^2.6.2" + }, + "devDependencies": { + "@theia/ext-scripts": "1.68.0" + } + }, + "packages/process": { + "name": "@theia/process", + "version": "1.68.0", + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "dependencies": { + "@theia/core": "1.68.0", + "node-pty": "1.1.0-beta27", + "string-argv": "^0.1.1", + "tslib": "^2.6.2" + }, + "devDependencies": { + "@theia/ext-scripts": "1.68.0" + } + }, + "packages/property-view": { + "name": "@theia/property-view", + "version": "1.68.0", + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "dependencies": { + "@theia/core": "1.68.0", + "@theia/filesystem": "1.68.0", + "tslib": "^2.6.2" + }, + "devDependencies": { + "@theia/ext-scripts": "1.68.0" + } + }, + "packages/remote": { + "name": "@theia/remote", + "version": "1.68.0", + "license": "EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0", + "dependencies": { + "@theia/core": "1.68.0", + "@theia/filesystem": "1.68.0", + "@theia/userstorage": "1.68.0", + "@theia/variable-resolver": "1.68.0", + "archiver": "^5.3.1", + "decompress": "^4.2.1", + "decompress-tar": "^4.0.0", + "decompress-targz": "^4.0.0", + "decompress-unzip": "^4.0.1", + "express-http-proxy": "^2.1.1", + "glob": "^8.1.0", + "socket.io": "^4.5.3", + "socket.io-client": "^4.5.3", + "ssh-config": "^5.0.3", + "ssh2": "^1.15.0", + "ssh2-sftp-client": "^9.1.0", + "tslib": "^2.6.2" + }, + "devDependencies": { + "@theia/ext-scripts": "1.68.0", + "@types/archiver": "^5.3.2", + "@types/decompress": "^4.2.4", + "@types/express-http-proxy": "^1.6.6", + "@types/glob": "^8.1.0", + "@types/ssh2": "^1.11.11", + "@types/ssh2-sftp-client": "^9.0.0" + } + }, + "packages/remote-wsl": { + "name": "@theia/remote-wsl", + "version": "1.68.0", + "license": "EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0", + "dependencies": { + "@theia/core": "1.68.0", + "@theia/remote": "1.68.0", + "@theia/workspace": "1.68.0", + "tslib": "^2.6.2" + } + }, + "packages/remote/node_modules/brace-expansion": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz", + "integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==", + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "packages/remote/node_modules/glob": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-8.1.0.tgz", + "integrity": "sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==", + "license": "ISC", + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^5.0.1", + "once": "^1.3.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "packages/remote/node_modules/minimatch": { + "version": "5.1.6", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", + "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==", + "license": "ISC", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=10" + } + }, + "packages/scanoss": { + "name": "@theia/scanoss", + "version": "1.68.0", + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "dependencies": { + "@theia/core": "1.68.0", + "scanoss": "^0.15.2" + }, + "devDependencies": { + "@theia/ext-scripts": "1.68.0" + } + }, + "packages/scm": { + "name": "@theia/scm", + "version": "1.68.0", + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "dependencies": { + "@theia/core": "1.68.0", + "@theia/editor": "1.68.0", + "@theia/filesystem": "1.68.0", + "@theia/monaco": "1.68.0", + "@theia/monaco-editor-core": "1.96.302", + "@types/diff": "^5.2.1", + "diff": "^5.2.0", + "p-debounce": "^2.1.0", + "react-textarea-autosize": "^8.5.5", + "ts-md5": "^1.2.2", + "tslib": "^2.6.2" + }, + "devDependencies": { + "@theia/ext-scripts": "1.68.0" + } + }, + "packages/scm-extra": { + "name": "@theia/scm-extra", + "version": "1.68.0", + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "dependencies": { + "@theia/core": "1.68.0", + "@theia/editor": "1.68.0", + "@theia/filesystem": "1.68.0", + "@theia/navigator": "1.68.0", + "@theia/scm": "1.68.0", + "tslib": "^2.6.2" + }, + "devDependencies": { + "@theia/ext-scripts": "1.68.0" + } + }, + "packages/scm/node_modules/diff": { + "version": "5.2.2", + "resolved": "https://registry.npmjs.org/diff/-/diff-5.2.2.tgz", + "integrity": "sha512-vtcDfH3TOjP8UekytvnHH1o1P4FcUdt4eQ1Y+Abap1tk/OB2MWQvcwS2ClCd1zuIhc3JKOx6p3kod8Vfys3E+A==", + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.3.1" + } + }, + "packages/search-in-workspace": { + "name": "@theia/search-in-workspace", + "version": "1.68.0", + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "dependencies": { + "@theia/core": "1.68.0", + "@theia/editor": "1.68.0", + "@theia/filesystem": "1.68.0", + "@theia/navigator": "1.68.0", + "@theia/process": "1.68.0", + "@theia/workspace": "1.68.0", + "@vscode/ripgrep": "^1.14.2", + "minimatch": "^10.0.3", + "react-textarea-autosize": "^8.5.5", + "tslib": "^2.6.2" + }, + "devDependencies": { + "@theia/ext-scripts": "1.68.0" + } + }, + "packages/secondary-window": { + "name": "@theia/secondary-window", + "version": "1.68.0", + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "dependencies": { + "@theia/core": "1.68.0", + "tslib": "^2.6.2" + }, + "devDependencies": { + "@theia/ext-scripts": "1.68.0" + } + }, + "packages/task": { + "name": "@theia/task", + "version": "1.68.0", + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "dependencies": { + "@theia/core": "1.68.0", + "@theia/editor": "1.68.0", + "@theia/filesystem": "1.68.0", + "@theia/markers": "1.68.0", + "@theia/monaco": "1.68.0", + "@theia/monaco-editor-core": "1.96.302", + "@theia/process": "1.68.0", + "@theia/terminal": "1.68.0", + "@theia/userstorage": "1.68.0", + "@theia/variable-resolver": "1.68.0", + "@theia/workspace": "1.68.0", + "async-mutex": "^0.3.1", + "jsonc-parser": "^2.2.0", + "p-debounce": "^2.1.0", + "tslib": "^2.6.2" + }, + "devDependencies": { + "@theia/ext-scripts": "1.68.0" + } + }, + "packages/task/node_modules/async-mutex": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/async-mutex/-/async-mutex-0.3.2.tgz", + "integrity": "sha512-HuTK7E7MT7jZEh1P9GtRW9+aTWiDWWi9InbZ5hjxrnRa39KS4BW04+xLBhYNS2aXhHUIKZSw3gj4Pn1pj+qGAA==", + "license": "MIT", + "dependencies": { + "tslib": "^2.3.1" + } + }, + "packages/task/node_modules/jsonc-parser": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-2.3.1.tgz", + "integrity": "sha512-H8jvkz1O50L3dMZCsLqiuB2tA7muqbSg1AtGEkN0leAqGjsUzDJir3Zwr02BhqdcITPg3ei3mZ+HjMocAknhhg==", + "license": "MIT" + }, + "packages/terminal": { + "name": "@theia/terminal", + "version": "1.68.0", + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "dependencies": { + "@theia/core": "1.68.0", + "@theia/editor": "1.68.0", + "@theia/file-search": "1.68.0", + "@theia/filesystem": "1.68.0", + "@theia/process": "1.68.0", + "@theia/variable-resolver": "1.68.0", + "@theia/workspace": "1.68.0", + "tslib": "^2.6.2", + "xterm": "^5.3.0", + "xterm-addon-fit": "^0.8.0", + "xterm-addon-search": "^0.13.0", + "xterm-addon-webgl": "^0.16.0" + }, + "devDependencies": { + "@theia/ext-scripts": "1.68.0" + } + }, + "packages/terminal-manager": { + "name": "@theia/terminal-manager", + "version": "1.68.0", + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "dependencies": { + "@theia/core": "1.68.0", + "@theia/preferences": "1.68.0", + "@theia/terminal": "1.68.0" + } + }, + "packages/test": { + "name": "@theia/test", + "version": "1.68.0", + "license": "EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0", + "dependencies": { + "@theia/core": "1.68.0", + "@theia/editor": "1.68.0", + "@theia/filesystem": "1.68.0", + "@theia/navigator": "1.68.0", + "@theia/terminal": "1.68.0", + "xterm": "^5.3.0", + "xterm-addon-fit": "^0.8.0" + }, + "devDependencies": { + "@theia/ext-scripts": "1.68.0" + } + }, + "packages/timeline": { + "name": "@theia/timeline", + "version": "1.68.0", + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "dependencies": { + "@theia/core": "1.68.0", + "@theia/navigator": "1.68.0", + "tslib": "^2.6.2" + }, + "devDependencies": { + "@theia/ext-scripts": "1.68.0" + } + }, + "packages/toolbar": { + "name": "@theia/toolbar", + "version": "1.68.0", + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "dependencies": { + "@theia/core": "1.68.0", + "@theia/editor": "1.68.0", + "@theia/file-search": "1.68.0", + "@theia/filesystem": "1.68.0", + "@theia/monaco": "1.68.0", + "@theia/monaco-editor-core": "1.96.302", + "@theia/search-in-workspace": "1.68.0", + "@theia/userstorage": "1.68.0", + "@theia/workspace": "1.68.0", + "ajv": "^6.5.3", + "jsonc-parser": "^2.2.0", + "perfect-scrollbar": "1.5.5", + "tslib": "^2.6.2" + } + }, + "packages/toolbar/node_modules/jsonc-parser": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-2.3.1.tgz", + "integrity": "sha512-H8jvkz1O50L3dMZCsLqiuB2tA7muqbSg1AtGEkN0leAqGjsUzDJir3Zwr02BhqdcITPg3ei3mZ+HjMocAknhhg==", + "license": "MIT" + }, + "packages/typehierarchy": { + "name": "@theia/typehierarchy", + "version": "1.68.0", + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "dependencies": { + "@theia/core": "1.68.0", + "@theia/editor": "1.68.0", + "tslib": "^2.6.2" + }, + "devDependencies": { + "@theia/ext-scripts": "1.68.0" + } + }, + "packages/userstorage": { + "name": "@theia/userstorage", + "version": "1.68.0", + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "dependencies": { + "@theia/core": "1.68.0", + "@theia/filesystem": "1.68.0", + "tslib": "^2.6.2" + }, + "devDependencies": { + "@theia/ext-scripts": "1.68.0" + } + }, + "packages/variable-resolver": { + "name": "@theia/variable-resolver", + "version": "1.68.0", + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "dependencies": { + "@theia/core": "1.68.0", + "tslib": "^2.6.2" + }, + "devDependencies": { + "@theia/ext-scripts": "1.68.0" + } + }, + "packages/vsx-registry": { + "name": "@theia/vsx-registry", + "version": "1.68.0", + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "dependencies": { + "@theia/core": "1.68.0", + "@theia/filesystem": "1.68.0", + "@theia/navigator": "1.68.0", + "@theia/ovsx-client": "1.68.0", + "@theia/plugin-ext": "1.68.0", + "@theia/plugin-ext-vscode": "1.68.0", + "@theia/preferences": "1.68.0", + "@theia/workspace": "1.68.0", + "limiter": "^2.1.0", + "luxon": "^2.4.0", + "p-debounce": "^2.1.0", + "semver": "^7.5.4", + "tslib": "^2.6.2" + }, + "devDependencies": { + "@theia/ext-scripts": "1.68.0", + "@types/luxon": "^2.3.2" + } + }, + "packages/workspace": { + "name": "@theia/workspace", + "version": "1.68.0", + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "dependencies": { + "@theia/core": "1.68.0", + "@theia/filesystem": "1.68.0", + "@theia/variable-resolver": "1.68.0", + "jsonc-parser": "^2.2.0", + "tslib": "^2.6.2", + "valid-filename": "^2.0.1" + }, + "devDependencies": { + "@theia/ext-scripts": "1.68.0" + } + }, + "packages/workspace/node_modules/jsonc-parser": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-2.3.1.tgz", + "integrity": "sha512-H8jvkz1O50L3dMZCsLqiuB2tA7muqbSg1AtGEkN0leAqGjsUzDJir3Zwr02BhqdcITPg3ei3mZ+HjMocAknhhg==", + "license": "MIT" + }, + "sample-plugins/sample-namespace/plugin-a": { + "version": "1.68.0", + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "devDependencies": { + "@types/vscode": "^1.50.0" + }, + "engines": { + "vscode": "^1.51.0" + } + }, + "sample-plugins/sample-namespace/plugin-b": { + "version": "1.68.0", + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "devDependencies": { + "@types/vscode": "^1.50.0" + }, + "engines": { + "vscode": "^1.51.0" + } + }, + "sample-plugins/sample-namespace/plugin-gotd": { + "version": "1.68.0", + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "devDependencies": { + "@theia/api-provider-sample": "1.68.0" + }, + "engines": { + "vscode": "^1.84.0" + } + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..419a7b9 --- /dev/null +++ b/package.json @@ -0,0 +1,133 @@ +{ + "private": true, + "name": "@theia/monorepo", + "version": "0.0.0", + "engines": { + "node": ">=20" + }, + "overrides": { + "perfect-scrollbar": "1.5.5", + "@types/express": "^4.17.21", + "http-proxy-agent": "^5.0.0", + "https-proxy-agent": "^5.0.0" + }, + "devDependencies": { + "@eclipse-dash/nodejs-wrapper": "^0.0.1", + "@types/chai": "4.3.0", + "@types/chai-spies": "1.0.3", + "@types/chai-string": "^1.4.0", + "@types/jsdom": "^21.1.7", + "@types/node": "20", + "@types/sinon": "^10.0.6", + "@types/temp": "^0.9.1", + "@typescript-eslint/eslint-plugin": "^7.18.0", + "@typescript-eslint/eslint-plugin-tslint": "^7.0.2", + "@typescript-eslint/parser": "^7.18.0", + "@vscode/vsce": "^2.15.0", + "archiver": "^5.3.1", + "chai": "4.3.10", + "chai-spies": "1.0.0", + "chai-string": "^1.4.0", + "chalk": "4.0.0", + "concurrently": "^3.5.0", + "debug": "^4.3.2", + "electron-mocha": "^12.3.0", + "eslint": "8", + "eslint-plugin-deprecation": "^3.0.0", + "eslint-plugin-import": "^2.27.5", + "eslint-plugin-no-null": "latest", + "eslint-plugin-no-unsanitized": "latest", + "eslint-plugin-react": "^7.31.10", + "glob": "^7.1.7", + "if-env": "^1.0.4", + "ignore-styles": "^5.0.1", + "jsdom": "^22.1.0", + "lerna": "^9.0.0", + "minimatch": "^10.0.3", + "mkdirp": "^0.5.0", + "nan": "2.23.0", + "node-abi": "^4.12.0", + "node-gyp": "^11.4.0", + "nyc": "^17.1.0", + "puppeteer": "23.1.0", + "puppeteer-core": "23.1.0", + "puppeteer-to-istanbul": "1.4.0", + "rimraf": "^5.0.0", + "sinon": "^12.0.0", + "temp": "^0.9.1", + "tslint": "^5.12.0", + "typedoc": "0.28.13", + "typescript": "~5.9.3", + "yargs": "^15.3.1" + }, + "scripts": { + "all": "npm -s install && npm run -s lint && npm run -s build", + "build": "npm run compile && npm run build:applications", + "build:applications": "npm run build:browser && npm run build:browser-only && npm run build:electron", + "build:browser": "cd examples/browser && npm run build", + "build:browser-only": "cd examples/browser-only && npm run build", + "build:electron": "cd examples/electron && npm run build", + "build:tools": "lerna run compile --scope \"@theia/{re-exports,eslint-plugin}\"", + "clean": "npm run -s rebuild:clean && npm run -s lint:clean && lerna run clean", + "compile": "lerna run compile", + "compute-references": "node scripts/compile-references.js", + "docs": "rimraf gh-pages/ && npm run docs:packages && npm run docs:merge", + "docs:packages": "node scripts/generate-typedoc-per-package.js", + "docs:merge": "node scripts/merge-package-typedocs.js", + "download:plugins": "theia download:plugins", + "license:check": "npx dash-licenses-wrapper --configFile=./configs/license-check-config.json", + "license:check:review": "npx dash-licenses-wrapper --configFile=./configs/license-check-config.json --review", + "lint": "lerna run lint", + "lint:clean": "rimraf .eslintcache", + "lint:fix": "lerna run lint -- --fix", + "preinstall": "node-gyp install", + "postinstall": "theia-patch && npm run -s compute-references && lerna run afterInstall", + "publish:latest": "lerna publish --exact --yes", + "publish:patch": "lerna publish --exact --yes --dist-tag patch", + "publish:next": "lerna publish --canary preminor --exact --yes --preid next --dist-tag next && npm run -s publish:check next", + "publish:check": "node scripts/check-publish.js", + "rebuild:clean": "rimraf .browser_modules", + "rebuild:browser": "cd examples/browser && npm run rebuild", + "rebuild:electron": "cd examples/electron && npm run rebuild", + "start:browser": "cd examples/browser && npm run start", + "start:browser-only": "cd examples/browser-only && npm run start", + "start:electron": "cd examples/electron && npm run start", + "test": "npm run -s test:theia && npm run -s electron test && npm run -s browser test", + "test:browser": "cd examples/browser && npm run test", + "test:electron": "cd examples/electron && npm run test", + "test:theia": "lerna run --scope \"@theia/!(example-)*\" test --stream --concurrency=1", + "test:playwright": "cd examples/playwright && npm run -s ui-tests", + "version": "lerna run version", + "watch:browser": "cd examples/browser && npm run -s watch", + "watch:browser-only": "cd examples/browser-only && npm run -s watch", + "watch:electron": "cd examples/electron && npm run -s watch", + "watch": "concurrently --kill-others \"npm run -s watch:browser\" \"npm run -s watch:electron\"", + "performance:startup": "npm run -s performance:startup:browser && npm run -s performance:startup:electron", + "performance:startup:browser": "concurrently --success first -k -r \"cd scripts/performance && node browser-performance.js --name 'Browser Frontend Startup' --folder browser --runs 10\" \"npm run -s --cwd examples/browser start\"", + "performance:startup:electron": "npm run -s electron rebuild && cd scripts/performance && node electron-performance.js --name 'Electron Frontend Startup' --folder electron --runs 10", + "zip:native:dependencies": "node ./scripts/zip-native-dependencies.js" + }, + "workspaces": [ + "dev-packages/*", + "packages/*", + "!packages/*.disabled", + "examples/*", + "sample-plugins/*/*" + ], + "theiaPluginsDir": "plugins", + "theiaPlugins": { + "vscode-builtin-extensions": "https://github.com/eclipse-theia/vscode-builtin-extensions/releases/download/1.104.0/vscode-builtin-extensions-1.104.0.tar.gz", + "EditorConfig.EditorConfig": "https://open-vsx.org/api/EditorConfig/EditorConfig/0.17.4/file/EditorConfig.EditorConfig-0.17.4.vsix", + "dbaeumer.vscode-eslint": "https://open-vsx.org/api/dbaeumer/vscode-eslint/3.0.16/file/dbaeumer.vscode-eslint-3.0.16.vsix", + "ms-toolsai.jupyter": "https://open-vsx.org/api/ms-toolsai/jupyter/2025.8.0/file/ms-toolsai.jupyter-2025.8.0.vsix", + "ms-python.python": "https://open-vsx.org/api/ms-python/python/2025.4.0/file/ms-python.python-2025.4.0.vsix" + }, + "theiaPluginsExcludeIds": [ + "ms-vscode.js-debug-companion", + "vscode.extension-editing", + "vscode.github", + "vscode.github-authentication", + "ms-python.vscode-pylance" + ], + "packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e" +} diff --git a/packages/ai-anthropic/.eslintrc.js b/packages/ai-anthropic/.eslintrc.js new file mode 100644 index 0000000..1308994 --- /dev/null +++ b/packages/ai-anthropic/.eslintrc.js @@ -0,0 +1,10 @@ +/** @type {import('eslint').Linter.Config} */ +module.exports = { + extends: [ + '../../configs/build.eslintrc.json' + ], + parserOptions: { + tsconfigRootDir: __dirname, + project: 'tsconfig.json' + } +}; diff --git a/packages/ai-anthropic/README.md b/packages/ai-anthropic/README.md new file mode 100644 index 0000000..7311df4 --- /dev/null +++ b/packages/ai-anthropic/README.md @@ -0,0 +1,33 @@ +
+ +
+ +theia-ext-logo + +

ECLIPSE THEIA - ANTHROPIC EXTENSION

+ +
+ +
+ +## Description + +The `@theia/anthropic` integrates Anthropic's models with Theia AI. +The Anthropic API key and the models to use can be configured via preferences. +Alternatively the API key can also be handed in via the `ANTHROPIC_API_KEY` environment variable. + +## Additional Information + +- [API documentation for `@theia/ai-anthropic`](https://eclipse-theia.github.io/theia/docs/next/modules/_theia_ai-anthropic.html) +- [Theia - GitHub](https://github.com/eclipse-theia/theia) +- [Theia - Website](https://theia-ide.org/) + +## License + +- [Eclipse Public License 2.0](http://www.eclipse.org/legal/epl-2.0/) +- [一 (Secondary) GNU General Public License, version 2 with the GNU Classpath Exception](https://projects.eclipse.org/license/secondary-gpl-2.0-cp) + +## Trademark + +"Theia" is a trademark of the Eclipse Foundation + diff --git a/packages/ai-anthropic/package.json b/packages/ai-anthropic/package.json new file mode 100644 index 0000000..50f59da --- /dev/null +++ b/packages/ai-anthropic/package.json @@ -0,0 +1,51 @@ +{ + "name": "@theia/ai-anthropic", + "version": "1.68.0", + "description": "Theia - Anthropic Integration", + "dependencies": { + "@anthropic-ai/sdk": "^0.65.0", + "@theia/ai-core": "1.68.0", + "@theia/core": "1.68.0", + "undici": "^7.16.0" + }, + "publishConfig": { + "access": "public" + }, + "theiaExtensions": [ + { + "frontend": "lib/browser/anthropic-frontend-module", + "backend": "lib/node/anthropic-backend-module" + } + ], + "keywords": [ + "theia-extension" + ], + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "repository": { + "type": "git", + "url": "https://github.com/eclipse-theia/theia.git" + }, + "bugs": { + "url": "https://github.com/eclipse-theia/theia/issues" + }, + "homepage": "https://github.com/eclipse-theia/theia", + "files": [ + "lib", + "src" + ], + "scripts": { + "build": "theiaext build", + "clean": "theiaext clean", + "compile": "theiaext compile", + "lint": "theiaext lint", + "test": "theiaext test", + "watch": "theiaext watch" + }, + "devDependencies": { + "@theia/ext-scripts": "1.68.0" + }, + "nyc": { + "extends": "../../configs/nyc.json" + }, + "gitHead": "21358137e41342742707f660b8e222f940a27652" +} diff --git a/packages/ai-anthropic/src/browser/anthropic-frontend-application-contribution.ts b/packages/ai-anthropic/src/browser/anthropic-frontend-application-contribution.ts new file mode 100644 index 0000000..b8d612d --- /dev/null +++ b/packages/ai-anthropic/src/browser/anthropic-frontend-application-contribution.ts @@ -0,0 +1,125 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { FrontendApplicationContribution } from '@theia/core/lib/browser'; +import { inject, injectable } from '@theia/core/shared/inversify'; +import { AnthropicLanguageModelsManager, AnthropicModelDescription } from '../common'; +import { API_KEY_PREF, MODELS_PREF } from '../common/anthropic-preferences'; +import { AICorePreferences, PREFERENCE_NAME_MAX_RETRIES } from '@theia/ai-core/lib/common/ai-core-preferences'; +import { PreferenceService } from '@theia/core'; + +const ANTHROPIC_PROVIDER_ID = 'anthropic'; + +// Model-specific maxTokens values +const DEFAULT_MODEL_MAX_TOKENS: Record = { + 'claude-3-opus-latest': 4096, + 'claude-3-5-haiku-latest': 8192, + 'claude-3-5-sonnet-latest': 8192, + 'claude-3-7-sonnet-latest': 64000, + 'claude-opus-4-20250514': 32000, + 'claude-sonnet-4-20250514': 64000, + 'claude-sonnet-4-5': 64000, + 'claude-sonnet-4-0': 64000, + 'claude-opus-4-5': 64000, + 'claude-opus-4-1': 32000 +}; + +@injectable() +export class AnthropicFrontendApplicationContribution implements FrontendApplicationContribution { + + @inject(PreferenceService) + protected preferenceService: PreferenceService; + + @inject(AnthropicLanguageModelsManager) + protected manager: AnthropicLanguageModelsManager; + + @inject(AICorePreferences) + protected aiCorePreferences: AICorePreferences; + + protected prevModels: string[] = []; + + onStart(): void { + this.preferenceService.ready.then(() => { + const apiKey = this.preferenceService.get(API_KEY_PREF, undefined); + this.manager.setApiKey(apiKey); + + const proxyUri = this.preferenceService.get('http.proxy', undefined); + this.manager.setProxyUrl(proxyUri); + + const models = this.preferenceService.get(MODELS_PREF, []); + this.manager.createOrUpdateLanguageModels(...models.map(modelId => this.createAnthropicModelDescription(modelId))); + this.prevModels = [...models]; + + this.preferenceService.onPreferenceChanged(event => { + if (event.preferenceName === API_KEY_PREF) { + this.manager.setApiKey(this.preferenceService.get(API_KEY_PREF, undefined)); + this.updateAllModels(); + } else if (event.preferenceName === MODELS_PREF) { + this.handleModelChanges(this.preferenceService.get(MODELS_PREF, [])); + } else if (event.preferenceName === 'http.proxy') { + this.manager.setProxyUrl(this.preferenceService.get('http.proxy', undefined)); + } + }); + + this.aiCorePreferences.onPreferenceChanged(event => { + if (event.preferenceName === PREFERENCE_NAME_MAX_RETRIES) { + this.updateAllModels(); + } + }); + }); + } + + protected handleModelChanges(newModels: string[]): void { + const oldModels = new Set(this.prevModels); + const updatedModels = new Set(newModels); + + const modelsToRemove = [...oldModels].filter(model => !updatedModels.has(model)); + const modelsToAdd = [...updatedModels].filter(model => !oldModels.has(model)); + + this.manager.removeLanguageModels(...modelsToRemove.map(model => `${ANTHROPIC_PROVIDER_ID}/${model}`)); + this.manager.createOrUpdateLanguageModels(...modelsToAdd.map(modelId => this.createAnthropicModelDescription(modelId))); + this.prevModels = newModels; + } + + protected updateAllModels(): void { + const models = this.preferenceService.get(MODELS_PREF, []); + this.manager.createOrUpdateLanguageModels(...models.map(modelId => this.createAnthropicModelDescription(modelId))); + } + + protected createAnthropicModelDescription(modelId: string): AnthropicModelDescription { + const id = `${ANTHROPIC_PROVIDER_ID}/${modelId}`; + const maxTokens = DEFAULT_MODEL_MAX_TOKENS[modelId]; + const maxRetries = this.aiCorePreferences.get(PREFERENCE_NAME_MAX_RETRIES) ?? 3; + + const description: AnthropicModelDescription = { + id: id, + model: modelId, + apiKey: true, + enableStreaming: true, + useCaching: true, + maxRetries: maxRetries + }; + + if (maxTokens !== undefined) { + description.maxTokens = maxTokens; + } else { + description.maxTokens = 64000; + } + + return description; + } + +} diff --git a/packages/ai-anthropic/src/browser/anthropic-frontend-module.ts b/packages/ai-anthropic/src/browser/anthropic-frontend-module.ts new file mode 100644 index 0000000..7a12086 --- /dev/null +++ b/packages/ai-anthropic/src/browser/anthropic-frontend-module.ts @@ -0,0 +1,32 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { ContainerModule } from '@theia/core/shared/inversify'; +import { AnthropicPreferencesSchema } from '../common/anthropic-preferences'; +import { FrontendApplicationContribution, RemoteConnectionProvider, ServiceConnectionProvider } from '@theia/core/lib/browser'; +import { AnthropicFrontendApplicationContribution } from './anthropic-frontend-application-contribution'; +import { ANTHROPIC_LANGUAGE_MODELS_MANAGER_PATH, AnthropicLanguageModelsManager } from '../common'; +import { PreferenceContribution } from '@theia/core'; + +export default new ContainerModule(bind => { + bind(PreferenceContribution).toConstantValue({ schema: AnthropicPreferencesSchema }); + bind(AnthropicFrontendApplicationContribution).toSelf().inSingletonScope(); + bind(FrontendApplicationContribution).toService(AnthropicFrontendApplicationContribution); + bind(AnthropicLanguageModelsManager).toDynamicValue(ctx => { + const provider = ctx.container.get(RemoteConnectionProvider); + return provider.createProxy(ANTHROPIC_LANGUAGE_MODELS_MANAGER_PATH); + }).inSingletonScope(); +}); diff --git a/packages/ai-anthropic/src/common/anthropic-language-models-manager.ts b/packages/ai-anthropic/src/common/anthropic-language-models-manager.ts new file mode 100644 index 0000000..980a5b5 --- /dev/null +++ b/packages/ai-anthropic/src/common/anthropic-language-models-manager.ts @@ -0,0 +1,55 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** +export const ANTHROPIC_LANGUAGE_MODELS_MANAGER_PATH = '/services/anthropic/language-model-manager'; +export const AnthropicLanguageModelsManager = Symbol('AnthropicLanguageModelsManager'); +export interface AnthropicModelDescription { + /** + * The identifier of the model which will be shown in the UI. + */ + id: string; + /** + * The model ID as used by the Anthropic API. + */ + model: string; + /** + * The key for the model. If 'true' is provided the global Anthropic API key will be used. + */ + apiKey: string | true | undefined; + /** + * Indicate whether the streaming API shall be used. + */ + enableStreaming: boolean; + /** + * Indicate whether the model supports prompt caching. + */ + useCaching: boolean; + /** + * Maximum number of tokens to generate. Default is 4096. + */ + maxTokens?: number; + /** + * Maximum number of retry attempts when a request fails. Default is 3. + */ + maxRetries: number; + +} +export interface AnthropicLanguageModelsManager { + apiKey: string | undefined; + setApiKey(key: string | undefined): void; + setProxyUrl(proxyUrl: string | undefined): void; + createOrUpdateLanguageModels(...models: AnthropicModelDescription[]): Promise; + removeLanguageModels(...modelIds: string[]): void +} diff --git a/packages/ai-anthropic/src/common/anthropic-preferences.ts b/packages/ai-anthropic/src/common/anthropic-preferences.ts new file mode 100644 index 0000000..5609630 --- /dev/null +++ b/packages/ai-anthropic/src/common/anthropic-preferences.ts @@ -0,0 +1,42 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { AI_CORE_PREFERENCES_TITLE } from '@theia/ai-core/lib/common/ai-core-preferences'; +import { nls, PreferenceSchema } from '@theia/core'; + +export const API_KEY_PREF = 'ai-features.anthropic.AnthropicApiKey'; +export const MODELS_PREF = 'ai-features.anthropic.AnthropicModels'; + +export const AnthropicPreferencesSchema: PreferenceSchema = { + properties: { + [API_KEY_PREF]: { + type: 'string', + markdownDescription: nls.localize('theia/ai/anthropic/apiKey/description', + 'Enter an API Key of your official Anthropic Account. **Please note:** By using this preference the Anthropic API key will be stored in clear text\ + on the machine running Theia. Use the environment variable `ANTHROPIC_API_KEY` to set the key securely.'), + title: AI_CORE_PREFERENCES_TITLE, + }, + [MODELS_PREF]: { + type: 'array', + description: nls.localize('theia/ai/anthropic/models/description', 'Official Anthropic models to use'), + title: AI_CORE_PREFERENCES_TITLE, + default: ['claude-sonnet-4-5', 'claude-sonnet-4-0', 'claude-3-7-sonnet-latest', 'claude-opus-4-5', 'claude-opus-4-1'], + items: { + type: 'string' + } + }, + } +}; diff --git a/packages/ai-anthropic/src/common/index.ts b/packages/ai-anthropic/src/common/index.ts new file mode 100644 index 0000000..e3a0ab9 --- /dev/null +++ b/packages/ai-anthropic/src/common/index.ts @@ -0,0 +1,16 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** +export * from './anthropic-language-models-manager'; diff --git a/packages/ai-anthropic/src/node/anthropic-backend-module.ts b/packages/ai-anthropic/src/node/anthropic-backend-module.ts new file mode 100644 index 0000000..5d8bd79 --- /dev/null +++ b/packages/ai-anthropic/src/node/anthropic-backend-module.ts @@ -0,0 +1,36 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { ContainerModule } from '@theia/core/shared/inversify'; +import { ANTHROPIC_LANGUAGE_MODELS_MANAGER_PATH, AnthropicLanguageModelsManager } from '../common/anthropic-language-models-manager'; +import { ConnectionHandler, PreferenceContribution, RpcConnectionHandler } from '@theia/core'; +import { AnthropicLanguageModelsManagerImpl } from './anthropic-language-models-manager-impl'; +import { ConnectionContainerModule } from '@theia/core/lib/node/messaging/connection-container-module'; +import { AnthropicPreferencesSchema } from '../common/anthropic-preferences'; + +// We use a connection module to handle AI services separately for each frontend. +const anthropicConnectionModule = ConnectionContainerModule.create(({ bind, bindBackendService, bindFrontendService }) => { + bind(AnthropicLanguageModelsManagerImpl).toSelf().inSingletonScope(); + bind(AnthropicLanguageModelsManager).toService(AnthropicLanguageModelsManagerImpl); + bind(ConnectionHandler).toDynamicValue(ctx => + new RpcConnectionHandler(ANTHROPIC_LANGUAGE_MODELS_MANAGER_PATH, () => ctx.container.get(AnthropicLanguageModelsManager)) + ).inSingletonScope(); +}); + +export default new ContainerModule(bind => { + bind(PreferenceContribution).toConstantValue({ schema: AnthropicPreferencesSchema }); + bind(ConnectionContainerModule).toConstantValue(anthropicConnectionModule); +}); diff --git a/packages/ai-anthropic/src/node/anthropic-language-model.spec.ts b/packages/ai-anthropic/src/node/anthropic-language-model.spec.ts new file mode 100644 index 0000000..9579888 --- /dev/null +++ b/packages/ai-anthropic/src/node/anthropic-language-model.spec.ts @@ -0,0 +1,167 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { expect } from 'chai'; +import { AnthropicModel, DEFAULT_MAX_TOKENS, addCacheControlToLastMessage } from './anthropic-language-model'; + +describe('AnthropicModel', () => { + + describe('constructor', () => { + it('should set default maxRetries to 3 when not provided', () => { + const model = new AnthropicModel( + 'test-id', + 'claude-3-opus-20240229', + { + status: 'ready' + }, + true, + true, + () => 'test-api-key', + DEFAULT_MAX_TOKENS + ); + + expect(model.maxRetries).to.equal(3); + }); + + it('should set custom maxRetries when provided', () => { + const customMaxRetries = 5; + const model = new AnthropicModel( + 'test-id', + 'claude-3-opus-20240229', + { + status: 'ready' + }, + true, + true, + () => 'test-api-key', + DEFAULT_MAX_TOKENS, + customMaxRetries + ); + + expect(model.maxRetries).to.equal(customMaxRetries); + }); + + it('should preserve all other constructor parameters', () => { + const model = new AnthropicModel( + 'test-id', + 'claude-3-opus-20240229', + { + status: 'ready' + }, + true, + true, + () => 'test-api-key', + DEFAULT_MAX_TOKENS, + 5 + ); + + expect(model.id).to.equal('test-id'); + expect(model.model).to.equal('claude-3-opus-20240229'); + expect(model.enableStreaming).to.be.true; + expect(model.maxTokens).to.equal(DEFAULT_MAX_TOKENS); + expect(model.maxRetries).to.equal(5); + }); + }); + + describe('addCacheControlToLastMessage', () => { + it('should preserve all content blocks when adding cache control to parallel tool calls', () => { + const messages = [ + { + role: 'user' as const, + content: [ + { type: 'tool_result' as const, tool_use_id: 'tool1', content: 'result1' }, + { type: 'tool_result' as const, tool_use_id: 'tool2', content: 'result2' }, + { type: 'tool_result' as const, tool_use_id: 'tool3', content: 'result3' } + ] + } + ]; + + const result = addCacheControlToLastMessage(messages); + + expect(result).to.have.lengthOf(1); + expect(result[0].content).to.be.an('array').with.lengthOf(3); + expect(result[0].content[0]).to.deep.equal({ type: 'tool_result', tool_use_id: 'tool1', content: 'result1' }); + expect(result[0].content[1]).to.deep.equal({ type: 'tool_result', tool_use_id: 'tool2', content: 'result2' }); + expect(result[0].content[2]).to.deep.equal({ + type: 'tool_result', + tool_use_id: 'tool3', + content: 'result3', + cache_control: { type: 'ephemeral' } + }); + }); + + it('should add cache control to last non-thinking block in mixed content', () => { + const messages = [ + { + role: 'assistant' as const, + content: [ + { type: 'text' as const, text: 'Some text' }, + { type: 'tool_use' as const, id: 'tool1', name: 'getTool', input: {} }, + { type: 'thinking' as const, thinking: 'thinking content', signature: 'signature' } + ] + } + ]; + + const result = addCacheControlToLastMessage(messages); + + expect(result).to.have.lengthOf(1); + expect(result[0].content).to.be.an('array').with.lengthOf(3); + expect(result[0].content[0]).to.deep.equal({ type: 'text', text: 'Some text' }); + expect(result[0].content[1]).to.deep.equal({ + type: 'tool_use', + id: 'tool1', + name: 'getTool', + input: {}, + cache_control: { type: 'ephemeral' } + }); + expect(result[0].content[2]).to.deep.equal({ type: 'thinking', thinking: 'thinking content', signature: 'signature' }); + }); + + it('should handle string content by converting to content block', () => { + const messages = [ + { + role: 'user' as const, + content: 'Simple text message' + } + ]; + + const result = addCacheControlToLastMessage(messages); + + expect(result).to.have.lengthOf(1); + expect(result[0].content).to.be.an('array').with.lengthOf(1); + expect(result[0].content[0]).to.deep.equal({ + type: 'text', + text: 'Simple text message', + cache_control: { type: 'ephemeral' } + }); + }); + + it('should not modify original messages', () => { + const originalMessages = [ + { + role: 'user' as const, + content: [ + { type: 'tool_result' as const, tool_use_id: 'tool1', content: 'result1' } + ] + } + ]; + + addCacheControlToLastMessage(originalMessages); + + expect(originalMessages[0].content[0]).to.not.have.property('cache_control'); + }); + }); +}); diff --git a/packages/ai-anthropic/src/node/anthropic-language-model.ts b/packages/ai-anthropic/src/node/anthropic-language-model.ts new file mode 100644 index 0000000..93845fb --- /dev/null +++ b/packages/ai-anthropic/src/node/anthropic-language-model.ts @@ -0,0 +1,454 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { + createToolCallError, + ImageContent, + ImageMimeType, + LanguageModel, + LanguageModelMessage, + LanguageModelRequest, + LanguageModelResponse, + LanguageModelStatus, + LanguageModelStreamResponse, + LanguageModelStreamResponsePart, + LanguageModelTextResponse, + TokenUsageParams, + TokenUsageService, + ToolCallResult, + ToolInvocationContext, + UserRequest +} from '@theia/ai-core'; +import { CancellationToken, isArray } from '@theia/core'; +import { Anthropic } from '@anthropic-ai/sdk'; +import type { Base64ImageSource, ImageBlockParam, Message, MessageParam, TextBlockParam, ToolResultBlockParam } from '@anthropic-ai/sdk/resources'; +import * as undici from 'undici'; + +export const DEFAULT_MAX_TOKENS = 4096; + +interface ToolCallback { + readonly name: string; + readonly id: string; + readonly index: number; + args: string; +} + +const createMessageContent = (message: LanguageModelMessage): MessageParam['content'] => { + if (LanguageModelMessage.isTextMessage(message)) { + return [{ type: 'text', text: message.text }]; + } else if (LanguageModelMessage.isThinkingMessage(message)) { + return [{ signature: message.signature, thinking: message.thinking, type: 'thinking' }]; + } else if (LanguageModelMessage.isToolUseMessage(message)) { + return [{ id: message.id, input: message.input, name: message.name, type: 'tool_use' }]; + } else if (LanguageModelMessage.isToolResultMessage(message)) { + return [{ type: 'tool_result', tool_use_id: message.tool_use_id, content: formatToolCallResult(message.content) }]; + } else if (LanguageModelMessage.isImageMessage(message)) { + if (ImageContent.isBase64(message.image)) { + return [{ type: 'image', source: { type: 'base64', media_type: mimeTypeToMediaType(message.image.mimeType), data: message.image.base64data } }]; + } else { + return [{ type: 'image', source: { type: 'url', url: message.image.url } }]; + } + } + throw new Error(`Unknown message type:'${JSON.stringify(message)}'`); +}; + +function mimeTypeToMediaType(mimeType: ImageMimeType): Base64ImageSource['media_type'] { + switch (mimeType) { + case 'image/gif': + return 'image/gif'; + case 'image/jpeg': + return 'image/jpeg'; + case 'image/png': + return 'image/png'; + case 'image/webp': + return 'image/webp'; + default: + return 'image/jpeg'; + } +} + +type NonThinkingParam = Exclude; +function isNonThinkingParam( + content: Anthropic.Messages.ContentBlockParam +): content is NonThinkingParam { + return content.type !== 'thinking' && content.type !== 'redacted_thinking'; +} + +/** + * Transforms Theia language model messages to Anthropic API format + * @param messages Array of LanguageModelRequestMessage to transform + * @returns Object containing transformed messages and optional system message + */ +function transformToAnthropicParams( + messages: readonly LanguageModelMessage[], + addCacheControl: boolean = true +): { messages: MessageParam[]; systemMessage?: Anthropic.Messages.TextBlockParam[] } { + // Extract the system message (if any), as it is a separate parameter in the Anthropic API. + const systemMessageObj = messages.find(message => message.actor === 'system'); + const systemMessageText = systemMessageObj && LanguageModelMessage.isTextMessage(systemMessageObj) && systemMessageObj.text || undefined; + const systemMessage: Anthropic.Messages.TextBlockParam[] | undefined = + systemMessageText ? [{ type: 'text', text: systemMessageText, cache_control: addCacheControl ? { type: 'ephemeral' } : undefined }] : undefined; + + const convertedMessages = messages + .filter(message => message.actor !== 'system') + .map(message => ({ + role: toAnthropicRole(message), + content: createMessageContent(message) + })); + + return { + messages: convertedMessages, + systemMessage, + }; +} + +/** + * If possible adds a cache control to the last message in the conversation. + * This is used to enable incremental caching of the conversation. + * @param messages The messages to process + * @returns A new messages array with the last message adapted to include cache control. If no cache control can be added, the original messages are returned. + * In any case, the original messages are not modified + */ +export function addCacheControlToLastMessage(messages: Anthropic.Messages.MessageParam[]): Anthropic.Messages.MessageParam[] { + const clonedMessages = [...messages]; + const latestMessage = clonedMessages.pop(); + if (latestMessage) { + if (typeof latestMessage.content === 'string') { + // Wrap the string content into a content block with cache control + const cachedContent: NonThinkingParam = { + type: 'text', + text: latestMessage.content, + cache_control: { type: 'ephemeral' } + }; + return [...clonedMessages, { ...latestMessage, content: [cachedContent] }]; + } else if (Array.isArray(latestMessage.content)) { + // Update the last non-thinking content block to include cache control + const updatedContent = [...latestMessage.content]; + for (let i = updatedContent.length - 1; i >= 0; i--) { + if (isNonThinkingParam(updatedContent[i])) { + updatedContent[i] = { + ...updatedContent[i], + cache_control: { type: 'ephemeral' } + } as NonThinkingParam; + return [...clonedMessages, { ...latestMessage, content: updatedContent }]; + } + } + } + } + return messages; +} + +export const AnthropicModelIdentifier = Symbol('AnthropicModelIdentifier'); + +/** + * Converts Theia message actor to Anthropic role + * @param message The message to convert + * @returns Anthropic role ('user' or 'assistant') + */ +function toAnthropicRole(message: LanguageModelMessage): 'user' | 'assistant' { + switch (message.actor) { + case 'ai': + return 'assistant'; + default: + return 'user'; + } +} + +function formatToolCallResult(result: ToolCallResult): ToolResultBlockParam['content'] { + if (typeof result === 'object' && result && 'content' in result && Array.isArray(result.content)) { + return result.content.map(content => { + if (content.type === 'text') { + return { type: 'text', text: content.text }; + } else if (content.type === 'image') { + return { type: 'image', source: { type: 'base64', data: content.base64data, media_type: mimeTypeToMediaType(content.mimeType) } }; + } else { + return { type: 'text', text: content.data }; + } + }); + } + + if (isArray(result)) { + return result.map(r => ({ type: 'text', text: r as string })); + } + + if (typeof result === 'object') { + return JSON.stringify(result); + } + + return result; +} + +/** + * Implements the Anthropic language model integration for Theia + */ +export class AnthropicModel implements LanguageModel { + + constructor( + public readonly id: string, + public model: string, + public status: LanguageModelStatus, + public enableStreaming: boolean, + public useCaching: boolean, + public apiKey: () => string | undefined, + public maxTokens: number = DEFAULT_MAX_TOKENS, + public maxRetries: number = 3, + protected readonly tokenUsageService?: TokenUsageService, + protected proxy?: string + ) { } + + protected getSettings(request: LanguageModelRequest): Readonly> { + return request.settings ?? {}; + } + + async request(request: UserRequest, cancellationToken?: CancellationToken): Promise { + if (!request.messages?.length) { + throw new Error('Request must contain at least one message'); + } + + const anthropic = this.initializeAnthropic(); + + try { + if (this.enableStreaming) { + return this.handleStreamingRequest(anthropic, request, cancellationToken); + } + return this.handleNonStreamingRequest(anthropic, request); + } catch (error) { + const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred'; + throw new Error(`Anthropic API request failed: ${errorMessage}`); + } + } + + protected async handleStreamingRequest( + anthropic: Anthropic, + request: UserRequest, + cancellationToken?: CancellationToken, + toolMessages?: readonly Anthropic.Messages.MessageParam[] + ): Promise { + const settings = this.getSettings(request); + const { messages, systemMessage } = transformToAnthropicParams(request.messages, this.useCaching); + + let anthropicMessages = [...messages, ...(toolMessages ?? [])]; + + if (this.useCaching && anthropicMessages.length) { + anthropicMessages = addCacheControlToLastMessage(anthropicMessages); + } + + const tools = this.createTools(request); + const params: Anthropic.MessageCreateParams = { + max_tokens: this.maxTokens, + messages: anthropicMessages, + tools, + tool_choice: tools ? { type: 'auto' } : undefined, + model: this.model, + ...(systemMessage && { system: systemMessage }), + ...settings + }; + const stream = anthropic.messages.stream(params, { maxRetries: this.maxRetries }); + + cancellationToken?.onCancellationRequested(() => { + stream.abort(); + }); + const that = this; + + const asyncIterator = { + async *[Symbol.asyncIterator](): AsyncIterator { + + const toolCalls: ToolCallback[] = []; + let toolCall: ToolCallback | undefined; + const currentMessages: Message[] = []; + let currentMessage: Message | undefined = undefined; + + for await (const event of stream) { + if (event.type === 'content_block_start') { + const contentBlock = event.content_block; + + if (contentBlock.type === 'thinking') { + yield { thought: contentBlock.thinking, signature: contentBlock.signature ?? '' }; + } + if (contentBlock.type === 'text') { + yield { content: contentBlock.text }; + } + if (contentBlock.type === 'tool_use') { + toolCall = { name: contentBlock.name!, args: '', id: contentBlock.id!, index: event.index }; + yield { tool_calls: [{ finished: false, id: toolCall.id, function: { name: toolCall.name, arguments: toolCall.args } }] }; + } + } else if (event.type === 'content_block_delta') { + const delta = event.delta; + if (delta.type === 'thinking_delta') { + yield { thought: delta.thinking, signature: '' }; + } + if (delta.type === 'signature_delta') { + yield { thought: '', signature: delta.signature }; + } + if (delta.type === 'text_delta') { + yield { content: delta.text }; + } + if (toolCall && delta.type === 'input_json_delta') { + toolCall.args += delta.partial_json; + yield { tool_calls: [{ function: { arguments: delta.partial_json } }] }; + } + } else if (event.type === 'content_block_stop') { + if (toolCall && toolCall.index === event.index) { + toolCalls.push(toolCall); + toolCall = undefined; + } + } else if (event.type === 'message_delta') { + if (event.delta.stop_reason === 'max_tokens') { + if (toolCall) { + yield { tool_calls: [{ finished: true, id: toolCall.id }] }; + } + throw new Error(`The response was stopped because it exceeded the max token limit of ${event.usage.output_tokens}.`); + } + } else if (event.type === 'message_start') { + currentMessages.push(event.message); + currentMessage = event.message; + } else if (event.type === 'message_stop') { + if (currentMessage) { + yield { input_tokens: currentMessage.usage.input_tokens, output_tokens: currentMessage.usage.output_tokens }; + // Record token usage if token usage service is available + if (that.tokenUsageService && currentMessage.usage) { + const tokenUsageParams: TokenUsageParams = { + inputTokens: currentMessage.usage.input_tokens, + outputTokens: currentMessage.usage.output_tokens, + cachedInputTokens: currentMessage.usage.cache_creation_input_tokens || undefined, + readCachedInputTokens: currentMessage.usage.cache_read_input_tokens || undefined, + requestId: request.requestId + }; + await that.tokenUsageService.recordTokenUsage(that.id, tokenUsageParams); + } + } + + } + } + if (toolCalls.length > 0) { + const toolResult = await Promise.all(toolCalls.map(async tc => { + const tool = request.tools?.find(t => t.name === tc.name); + const argsObject = tc.args.length === 0 ? '{}' : tc.args; + const handlerResult = tool + ? await tool.handler(argsObject, ToolInvocationContext.create(tc.id)) + : createToolCallError(`Tool '${tc.name}' not found in the available tools for this request.`, 'tool-not-available'); + + return { name: tc.name, result: handlerResult, id: tc.id, arguments: argsObject }; + + })); + + const calls = toolResult.map(tr => ({ finished: true, id: tr.id, result: tr.result, function: { name: tr.name, arguments: tr.arguments } })); + yield { tool_calls: calls }; + + const toolResponseMessage: Anthropic.Messages.MessageParam = { + role: 'user', + content: toolResult.map(call => ({ + type: 'tool_result', + tool_use_id: call.id!, + content: formatToolCallResult(call.result) + })) + }; + const result = await that.handleStreamingRequest( + anthropic, + request, + cancellationToken, + [ + ...(toolMessages ?? []), + ...currentMessages.map(m => ({ role: m.role, content: m.content })), + toolResponseMessage + ]); + for await (const nestedEvent of result.stream) { + yield nestedEvent; + } + } + }, + }; + + stream.on('error', (error: Error) => { + console.error('Error in Anthropic streaming:', error); + }); + + return { stream: asyncIterator }; + } + + protected createTools(request: LanguageModelRequest): Anthropic.Messages.Tool[] | undefined { + if (request.tools?.length === 0) { + return undefined; + } + const tools = request.tools?.map(tool => ({ + name: tool.name, + description: tool.description, + input_schema: tool.parameters + } as Anthropic.Messages.Tool)); + if (this.useCaching) { + if (tools?.length) { + tools[tools.length - 1].cache_control = { type: 'ephemeral' }; + } + } + return tools; + } + + protected async handleNonStreamingRequest( + anthropic: Anthropic, + request: UserRequest + ): Promise { + const settings = this.getSettings(request); + const { messages, systemMessage } = transformToAnthropicParams(request.messages); + + const params: Anthropic.MessageCreateParams = { + max_tokens: this.maxTokens, + messages, + model: this.model, + ...(systemMessage && { system: systemMessage }), + ...settings, + }; + + try { + const response = await anthropic.messages.create(params); + const textContent = response.content[0]; + + // Record token usage if token usage service is available + if (this.tokenUsageService && response.usage) { + const tokenUsageParams: TokenUsageParams = { + inputTokens: response.usage.input_tokens, + outputTokens: response.usage.output_tokens, + requestId: request.requestId + }; + await this.tokenUsageService.recordTokenUsage(this.id, tokenUsageParams); + } + + if (textContent?.type === 'text') { + return { text: textContent.text }; + } + + return { text: '' }; + } catch (error) { + throw new Error(`Failed to get response from Anthropic API: ${error instanceof Error ? error.message : 'Unknown error'}`); + } + } + + protected initializeAnthropic(): Anthropic { + const apiKey = this.apiKey(); + if (!apiKey) { + throw new Error('Please provide ANTHROPIC_API_KEY in preferences or via environment variable'); + } + + let fo; + if (this.proxy) { + const proxyAgent = new undici.ProxyAgent(this.proxy); + fo = { + dispatcher: proxyAgent, + }; + } + + return new Anthropic({ apiKey, fetchOptions: fo }); + } +} diff --git a/packages/ai-anthropic/src/node/anthropic-language-models-manager-impl.ts b/packages/ai-anthropic/src/node/anthropic-language-models-manager-impl.ts new file mode 100644 index 0000000..2b7e1a2 --- /dev/null +++ b/packages/ai-anthropic/src/node/anthropic-language-models-manager-impl.ts @@ -0,0 +1,125 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { LanguageModelRegistry, LanguageModelStatus, TokenUsageService } from '@theia/ai-core'; +import { inject, injectable } from '@theia/core/shared/inversify'; +import { AnthropicModel, DEFAULT_MAX_TOKENS } from './anthropic-language-model'; +import { AnthropicLanguageModelsManager, AnthropicModelDescription } from '../common'; + +@injectable() +export class AnthropicLanguageModelsManagerImpl implements AnthropicLanguageModelsManager { + + protected _apiKey: string | undefined; + protected _proxyUrl: string | undefined; + + @inject(LanguageModelRegistry) + protected readonly languageModelRegistry: LanguageModelRegistry; + + @inject(TokenUsageService) + protected readonly tokenUsageService: TokenUsageService; + + get apiKey(): string | undefined { + return this._apiKey ?? process.env.ANTHROPIC_API_KEY; + } + + async createOrUpdateLanguageModels(...modelDescriptions: AnthropicModelDescription[]): Promise { + for (const modelDescription of modelDescriptions) { + const model = await this.languageModelRegistry.getLanguageModel(modelDescription.id); + const apiKeyProvider = () => { + if (modelDescription.apiKey === true) { + return this.apiKey; + } + if (modelDescription.apiKey) { + return modelDescription.apiKey; + } + return undefined; + }; + const proxyUrlProvider = () => { + // first check if the proxy url is provided via Theia settings + if (this._proxyUrl) { + return this._proxyUrl; + } + + // if not fall back to the environment variables + return process.env['https_proxy']; + }; + + // Determine status based on API key presence + const effectiveApiKey = apiKeyProvider(); + const status = this.getStatusForApiKey(effectiveApiKey); + + if (model) { + if (!(model instanceof AnthropicModel)) { + console.warn(`Anthropic: model ${modelDescription.id} is not an Anthropic model`); + continue; + } + await this.languageModelRegistry.patchLanguageModel(modelDescription.id, { + model: modelDescription.model, + enableStreaming: modelDescription.enableStreaming, + apiKey: apiKeyProvider, + status, + maxTokens: modelDescription.maxTokens !== undefined ? modelDescription.maxTokens : DEFAULT_MAX_TOKENS, + maxRetries: modelDescription.maxRetries + }); + } else { + this.languageModelRegistry.addLanguageModels([ + new AnthropicModel( + modelDescription.id, + modelDescription.model, + status, + modelDescription.enableStreaming, + modelDescription.useCaching, + apiKeyProvider, + modelDescription.maxTokens, + modelDescription.maxRetries, + this.tokenUsageService, + proxyUrlProvider() + ) + ]); + } + } + } + + removeLanguageModels(...modelIds: string[]): void { + this.languageModelRegistry.removeLanguageModels(modelIds); + } + + setApiKey(apiKey: string | undefined): void { + if (apiKey) { + this._apiKey = apiKey; + } else { + this._apiKey = undefined; + } + } + + setProxyUrl(proxyUrl: string | undefined): void { + if (proxyUrl) { + this._proxyUrl = proxyUrl; + } else { + this._proxyUrl = undefined; + } + } + + /** + * Returns the status for a language model based on the presence of an API key. + */ + protected getStatusForApiKey(effectiveApiKey: string | undefined): LanguageModelStatus { + return effectiveApiKey + ? { status: 'ready' } + : { status: 'unavailable', message: 'No Anthropic API key set' }; + } +} + diff --git a/packages/ai-anthropic/src/package.spec.ts b/packages/ai-anthropic/src/package.spec.ts new file mode 100644 index 0000000..4a86ea7 --- /dev/null +++ b/packages/ai-anthropic/src/package.spec.ts @@ -0,0 +1,28 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +/* note: this bogus test file is required so that + we are able to run mocha unit tests on this + package, without having any actual unit tests in it. + This way a coverage report will be generated, + showing 0% coverage, instead of no report. + This file can be removed once we have real unit + tests in place. */ + +describe('ai-anthropic package', () => { + + it('support code coverage statistics', () => true); +}); diff --git a/packages/ai-anthropic/tsconfig.json b/packages/ai-anthropic/tsconfig.json new file mode 100644 index 0000000..420367f --- /dev/null +++ b/packages/ai-anthropic/tsconfig.json @@ -0,0 +1,19 @@ +{ + "extends": "../../configs/base.tsconfig", + "compilerOptions": { + "composite": true, + "rootDir": "src", + "outDir": "lib" + }, + "include": [ + "src" + ], + "references": [ + { + "path": "../ai-core" + }, + { + "path": "../core" + } + ] +} diff --git a/packages/ai-chat-ui/.eslintrc.js b/packages/ai-chat-ui/.eslintrc.js new file mode 100644 index 0000000..1308994 --- /dev/null +++ b/packages/ai-chat-ui/.eslintrc.js @@ -0,0 +1,10 @@ +/** @type {import('eslint').Linter.Config} */ +module.exports = { + extends: [ + '../../configs/build.eslintrc.json' + ], + parserOptions: { + tsconfigRootDir: __dirname, + project: 'tsconfig.json' + } +}; diff --git a/packages/ai-chat-ui/README.md b/packages/ai-chat-ui/README.md new file mode 100644 index 0000000..396a7fe --- /dev/null +++ b/packages/ai-chat-ui/README.md @@ -0,0 +1,67 @@ +
+ +
+ +theia-ext-logo + +

ECLIPSE THEIA - AI CHAT UI EXTENSION

+ +
+ +
+ +## Description + +The `@theia/ai-chat-ui` extension contributes the `AI Chat` view.\ +The `AI Chat view` can be used to easily communicate with a language model. + +It is based on `@theia/ai-chat`. + +## Custom Tool Renderers + +To create a specialized renderer for a specific tool, implement the `ChatResponsePartRenderer` interface with a higher priority than the default `ToolCallPartRenderer` (priority `10`): + +```typescript +@injectable() +export class MyToolRenderer implements ChatResponsePartRenderer { + canHandle(response: ChatResponseContent): number { + if (ToolCallChatResponseContent.is(response) && response.name === 'my_tool_id') { + return 15; + } + return -1; + } + + render(response: ToolCallChatResponseContent, parentNode: ResponseNode): ReactNode { + // Custom rendering logic + } +} +``` + +For custom confirmation UIs, use the `ToolConfirmationActions` component to reuse the standard Allow/Deny buttons with dropdown options: + +```typescript +import { ToolConfirmationActions } from '@theia/ai-chat-ui/lib/browser/chat-response-renderer/tool-confirmation'; + + response.confirm()} + onDeny={(mode) => response.deny()} +/> +``` + +## Additional Information + +- [API documentation for `@theia/ai-chat-ui`](https://eclipse-theia.github.io/theia/docs/next/modules/_theia_ai-chat-ui.html) +- [Theia - GitHub](https://github.com/eclipse-theia/theia) +- [Theia - Website](https://theia-ide.org/) + +## License + +- [Eclipse Public License 2.0](http://www.eclipse.org/legal/epl-2.0/) +- [一 (Secondary) GNU General Public License, version 2 with the GNU Classpath Exception](https://projects.eclipse.org/license/secondary-gpl-2.0-cp) + +## Trademark + +"Theia" is a trademark of the Eclipse Foundation + diff --git a/packages/ai-chat-ui/package.json b/packages/ai-chat-ui/package.json new file mode 100644 index 0000000..e46c7d2 --- /dev/null +++ b/packages/ai-chat-ui/package.json @@ -0,0 +1,60 @@ +{ + "name": "@theia/ai-chat-ui", + "version": "1.68.0", + "description": "Theia - AI Chat UI Extension", + "dependencies": { + "@theia/ai-chat": "1.68.0", + "@theia/ai-core": "1.68.0", + "@theia/core": "1.68.0", + "@theia/editor": "1.68.0", + "@theia/editor-preview": "1.68.0", + "@theia/filesystem": "1.68.0", + "@theia/monaco": "1.68.0", + "@theia/monaco-editor-core": "1.96.302", + "@theia/preferences": "1.68.0", + "@theia/workspace": "1.68.0", + "tslib": "^2.6.2", + "uuid": "^9.0.1", + "date-fns": "^4.1.0" + }, + "publishConfig": { + "access": "public" + }, + "theiaExtensions": [ + { + "frontend": "lib/browser/ai-chat-ui-frontend-module", + "secondaryWindow": "lib/browser/ai-chat-ui-frontend-module" + } + ], + "keywords": [ + "theia-extension" + ], + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "repository": { + "type": "git", + "url": "https://github.com/eclipse-theia/theia.git" + }, + "bugs": { + "url": "https://github.com/eclipse-theia/theia/issues" + }, + "homepage": "https://github.com/eclipse-theia/theia", + "files": [ + "lib", + "src" + ], + "scripts": { + "build": "theiaext build", + "clean": "theiaext clean", + "compile": "theiaext compile", + "lint": "theiaext lint", + "test": "theiaext test", + "watch": "theiaext watch" + }, + "devDependencies": { + "@theia/ext-scripts": "1.68.0" + }, + "nyc": { + "extends": "../../configs/nyc.json" + }, + "gitHead": "21358137e41342742707f660b8e222f940a27652" +} diff --git a/packages/ai-chat-ui/src/browser/ai-chat-ui-contribution.ts b/packages/ai-chat-ui/src/browser/ai-chat-ui-contribution.ts new file mode 100644 index 0000000..0afd953 --- /dev/null +++ b/packages/ai-chat-ui/src/browser/ai-chat-ui-contribution.ts @@ -0,0 +1,605 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { inject, injectable, named, postConstruct } from '@theia/core/shared/inversify'; +import { CommandRegistry, Emitter, isOSX, MessageService, nls, PreferenceService, QuickInputButton, QuickInputService, QuickPickItem } from '@theia/core'; +import { ILogger } from '@theia/core/lib/common/logger'; +import { FrontendApplicationContribution, Widget } from '@theia/core/lib/browser'; +import { + AI_CHAT_NEW_CHAT_WINDOW_COMMAND, + AI_CHAT_SHOW_CHATS_COMMAND, + ChatCommands +} from './chat-view-commands'; +import { ChatAgent, ChatAgentLocation, ChatService, isActiveSessionChangedEvent } from '@theia/ai-chat'; +import { ChatAgentService } from '@theia/ai-chat/lib/common/chat-agent-service'; +import { EditorManager } from '@theia/editor/lib/browser/editor-manager'; +import { AbstractViewContribution } from '@theia/core/lib/browser/shell/view-contribution'; +import { TabBarToolbarContribution, TabBarToolbarRegistry } from '@theia/core/lib/browser/shell/tab-bar-toolbar'; +import { ChatViewWidget } from './chat-view-widget'; +import { Deferred } from '@theia/core/lib/common/promise-util'; +import { SecondaryWindowHandler } from '@theia/core/lib/browser/secondary-window-handler'; +import { formatDistance } from 'date-fns'; +import * as locales from 'date-fns/locale'; +import { AI_SHOW_SETTINGS_COMMAND, AIActivationService, ENABLE_AI_CONTEXT_KEY } from '@theia/ai-core/lib/browser'; +import { ChatNodeToolbarCommands } from './chat-node-toolbar-action-contribution'; +import { isEditableRequestNode, isResponseNode, type EditableRequestNode, type ResponseNode } from './chat-tree-view'; +import { TASK_CONTEXT_VARIABLE } from '@theia/ai-chat/lib/browser/task-context-variable'; +import { TaskContextService } from '@theia/ai-chat/lib/browser/task-context-service'; +import { SESSION_STORAGE_PREF } from '@theia/ai-chat/lib/common/ai-chat-preferences'; + +export const AI_CHAT_TOGGLE_COMMAND_ID = 'aiChat:toggle'; + +@injectable() +export class AIChatContribution extends AbstractViewContribution implements TabBarToolbarContribution, FrontendApplicationContribution { + + @inject(ChatService) + protected readonly chatService: ChatService; + @inject(QuickInputService) + protected readonly quickInputService: QuickInputService; + @inject(TaskContextService) + protected readonly taskContextService: TaskContextService; + @inject(MessageService) + protected readonly messageService: MessageService; + @inject(ChatAgentService) + protected readonly chatAgentService: ChatAgentService; + @inject(EditorManager) + protected readonly editorManager: EditorManager; + @inject(AIActivationService) + protected readonly activationService: AIActivationService; + @inject(ILogger) @named('AIChatContribution') + protected readonly logger: ILogger; + @inject(PreferenceService) + protected readonly preferenceService: PreferenceService; + + /** + * Store whether there are persisted sessions to make this information available in + * command enablement checks which are synchronous. + */ + protected hasPersistedSessions = false; + + protected static readonly RENAME_CHAT_BUTTON: QuickInputButton = { + iconClass: 'codicon-edit', + tooltip: nls.localize('theia/ai/chat-ui/renameChat', 'Rename Chat'), + }; + protected static readonly REMOVE_CHAT_BUTTON: QuickInputButton = { + iconClass: 'codicon-remove-close', + tooltip: nls.localize('theia/ai/chat-ui/removeChat', 'Remove Chat'), + }; + + @inject(SecondaryWindowHandler) + protected readonly secondaryWindowHandler: SecondaryWindowHandler; + + constructor() { + super({ + widgetId: ChatViewWidget.ID, + widgetName: ChatViewWidget.LABEL, + defaultWidgetOptions: { + area: 'right', + rank: 100 + }, + toggleCommandId: AI_CHAT_TOGGLE_COMMAND_ID, + toggleKeybinding: isOSX ? 'ctrl+cmd+i' : 'ctrl+alt+i' + }); + } + + @postConstruct() + initialize(): void { + this.chatService.onSessionEvent(event => { + if (!isActiveSessionChangedEvent(event)) { + return; + } + if (event.focus) { + this.openView({ activate: true }); + } + }); + + // Re-check persisted sessions when storage preferences change + this.preferenceService.onPreferenceChanged(event => { + if (event.preferenceName === SESSION_STORAGE_PREF) { + this.checkPersistedSessions(); + } + }); + + this.checkPersistedSessions(); + } + + async onStart(): Promise { + // Auto-open AI Chat panel on startup + await this.openView({ activate: false, reveal: true }); + } + + protected async checkPersistedSessions(): Promise { + try { + this.hasPersistedSessions = await this.chatService.hasPersistedSessions(); + } catch (e) { + this.logger.error('Failed to check persisted AI sessions', e); + this.hasPersistedSessions = false; + } + } + + override registerCommands(registry: CommandRegistry): void { + super.registerCommands(registry); + registry.registerCommand(ChatCommands.SCROLL_LOCK_WIDGET, { + isEnabled: widget => this.withWidget(widget, chatWidget => !chatWidget.isLocked), + isVisible: widget => this.withWidget(widget, chatWidget => !chatWidget.isLocked), + execute: widget => this.withWidget(widget, chatWidget => { + chatWidget.lock(); + return true; + }) + }); + registry.registerCommand(ChatCommands.SCROLL_UNLOCK_WIDGET, { + isEnabled: widget => this.withWidget(widget, chatWidget => chatWidget.isLocked), + isVisible: widget => this.withWidget(widget, chatWidget => chatWidget.isLocked), + execute: widget => this.withWidget(widget, chatWidget => { + chatWidget.unlock(); + return true; + }) + }); + registry.registerCommand(AI_CHAT_NEW_CHAT_WINDOW_COMMAND, { + execute: () => this.openView().then(() => this.chatService.createSession(ChatAgentLocation.Panel, { focus: true })), + isVisible: widget => this.activationService.isActive, + isEnabled: widget => this.activationService.isActive, + }); + registry.registerCommand(ChatCommands.AI_CHAT_NEW_WITH_TASK_CONTEXT, { + execute: async () => { + const activeSession = this.chatService.getActiveSession(); + const id = await this.summarizeActiveSession(); + if (!id || !activeSession) { return; } + const newSession = this.chatService.createSession(ChatAgentLocation.Panel, { focus: true }, activeSession.pinnedAgent); + const summaryVariable = { variable: TASK_CONTEXT_VARIABLE, arg: id }; + newSession.model.context.addVariables(summaryVariable); + }, + isVisible: () => false + }); + registry.registerCommand(ChatCommands.AI_CHAT_SUMMARIZE_CURRENT_SESSION, { + execute: async () => this.summarizeActiveSession(), + isVisible: widget => { + if (!this.activationService.isActive) { return false; } + if (widget && !this.withWidget(widget)) { return false; } + const activeSession = this.chatService.getActiveSession(); + return activeSession?.model.location === ChatAgentLocation.Panel + && !this.taskContextService.hasSummary(activeSession); + }, + isEnabled: widget => { + if (!this.activationService.isActive) { return false; } + if (widget && !this.withWidget(widget)) { return false; } + const activeSession = this.chatService.getActiveSession(); + return activeSession?.model.location === ChatAgentLocation.Panel + && !activeSession.model.isEmpty() + && !this.taskContextService.hasSummary(activeSession); + } + }); + registry.registerCommand(ChatCommands.AI_CHAT_OPEN_SUMMARY_FOR_CURRENT_SESSION, { + execute: async () => { + const id = await this.summarizeActiveSession(); + if (!id) { return; } + await this.taskContextService.open(id); + }, + isVisible: widget => { + if (!this.activationService.isActive) { return false; } + if (widget && !this.withWidget(widget)) { return false; } + const activeSession = this.chatService.getActiveSession(); + return !!activeSession && this.taskContextService.hasSummary(activeSession); + }, + isEnabled: widget => { + if (!this.activationService.isActive) { return false; } + return this.withWidget(widget, () => true); + } + }); + registry.registerCommand(ChatCommands.AI_CHAT_INITIATE_SESSION_WITH_TASK_CONTEXT, { + execute: async () => { + const selectedContextId = await this.selectTaskContextWithMarking(); + if (!selectedContextId) { return; } + const selectedAgent = await this.selectAgent('Coder'); + if (!selectedAgent) { return; } + const newSession = this.chatService.createSession(ChatAgentLocation.Panel, { focus: true }, selectedAgent); + newSession.model.context.addVariables({ variable: TASK_CONTEXT_VARIABLE, arg: selectedContextId }); + }, + isVisible: () => this.activationService.isActive, + isEnabled: () => this.activationService.isActive + }); + registry.registerCommand(AI_CHAT_SHOW_CHATS_COMMAND, { + execute: async () => { + await this.openView(); + return this.selectChat(); + }, + isEnabled: () => { + if (!this.activationService.isActive) { + return false; + } + // Enable if there are active sessions with titles OR persisted sessions + return this.chatService.getSessions().some(session => !!session.title) || this.hasPersistedSessions; + }, + isVisible: () => this.activationService.isActive + }); + registry.registerCommand(ChatNodeToolbarCommands.EDIT, { + isEnabled: node => isEditableRequestNode(node) && !node.request.isEditing, + isVisible: node => isEditableRequestNode(node) && !node.request.isEditing, + execute: (node: EditableRequestNode) => { + node.request.enableEdit(); + } + }); + registry.registerCommand(ChatNodeToolbarCommands.CANCEL, { + isEnabled: node => isEditableRequestNode(node) && node.request.isEditing, + isVisible: node => isEditableRequestNode(node) && node.request.isEditing, + execute: (node: EditableRequestNode) => { + node.request.cancelEdit(); + } + }); + registry.registerCommand(ChatNodeToolbarCommands.RETRY, { + isEnabled: node => isResponseNode(node) && (node.response.isError || node.response.isCanceled), + isVisible: node => isResponseNode(node) && (node.response.isError || node.response.isCanceled), + execute: async (node: ResponseNode) => { + try { + // Get the session for this response node + const session = this.chatService.getActiveSession(); + if (!session) { + this.messageService.error(nls.localize('theia/ai/chat-ui/sessionNotFoundForRetry', 'Session not found for retry')); + return; + } + + // Find the request associated with this response + const request = session.model.getRequests().find(req => req.response.id === node.response.id); + if (!request) { + this.messageService.error(nls.localize('theia/ai/chat-ui/requestNotFoundForRetry', 'Request not found for retry')); + return; + } + + // Send the same request again using the chat service + await this.chatService.sendRequest(node.sessionId, request.request); + } catch (error) { + console.error('Failed to retry chat message:', error); + this.messageService.error(nls.localize('theia/ai/chat-ui/failedToRetry', 'Failed to retry message')); + } + } + }); + } + + registerToolbarItems(registry: TabBarToolbarRegistry): void { + registry.registerItem({ + id: AI_CHAT_NEW_CHAT_WINDOW_COMMAND.id, + command: AI_CHAT_NEW_CHAT_WINDOW_COMMAND.id, + tooltip: AI_CHAT_NEW_CHAT_WINDOW_COMMAND.label, + isVisible: widget => this.activationService.isActive && this.withWidget(widget), + when: ENABLE_AI_CONTEXT_KEY + }); + registry.registerItem({ + id: AI_CHAT_SHOW_CHATS_COMMAND.id, + command: AI_CHAT_SHOW_CHATS_COMMAND.id, + tooltip: AI_CHAT_SHOW_CHATS_COMMAND.label, + isVisible: widget => this.activationService.isActive && this.withWidget(widget), + when: ENABLE_AI_CONTEXT_KEY + }); + registry.registerItem({ + id: 'chat-view.' + AI_SHOW_SETTINGS_COMMAND.id, + command: AI_SHOW_SETTINGS_COMMAND.id, + group: 'ai-settings', + priority: 3, + tooltip: nls.localize('theia/ai-chat-ui/open-settings-tooltip', 'Open AI settings...'), + isVisible: widget => this.activationService.isActive && this.withWidget(widget), + when: ENABLE_AI_CONTEXT_KEY + }); + const sessionSummarizibilityChangedEmitter = new Emitter(); + this.taskContextService.onDidChange(() => sessionSummarizibilityChangedEmitter.fire()); + this.chatService.onSessionEvent(event => event.type === 'activeChange' && sessionSummarizibilityChangedEmitter.fire()); + this.activationService.onDidChangeActiveStatus(() => sessionSummarizibilityChangedEmitter.fire()); + registry.registerItem({ + id: 'chat-view.' + ChatCommands.AI_CHAT_SUMMARIZE_CURRENT_SESSION.id, + command: ChatCommands.AI_CHAT_SUMMARIZE_CURRENT_SESSION.id, + onDidChange: sessionSummarizibilityChangedEmitter.event, + when: ENABLE_AI_CONTEXT_KEY + }); + registry.registerItem({ + id: 'chat-view.' + ChatCommands.AI_CHAT_OPEN_SUMMARY_FOR_CURRENT_SESSION.id, + command: ChatCommands.AI_CHAT_OPEN_SUMMARY_FOR_CURRENT_SESSION.id, + onDidChange: sessionSummarizibilityChangedEmitter.event, + when: ENABLE_AI_CONTEXT_KEY + }); + } + + protected async selectChat(sessionId?: string): Promise { + let activeSessionId = sessionId; + + if (!activeSessionId) { + const item = await this.askForChatSession(); + if (item === undefined) { + return; + } + activeSessionId = item.id; + } + + this.chatService.setActiveSession(activeSessionId!, { focus: true }); + } + + protected async askForChatSession(): Promise { + const getItems = async (): Promise => { + const activeSessions = this.chatService.getSessions() + .filter(session => session.title) + .map(session => ({ + session, + isActive: true, + lastDate: session.lastInteraction ? session.lastInteraction.getTime() : 0 + })); + + // Try to load persisted sessions, but don't fail if it doesn't work + let persistedSessions: Array<{ metadata: { sessionId: string; title: string; saveDate: number }; isActive: false; lastDate: number }> = []; + try { + const persistedIndex = await this.chatService.getPersistedSessions(); + const activeIds = new Set(activeSessions.map(s => s.session.id)); + persistedSessions = Object.values(persistedIndex) + .filter(metadata => !activeIds.has(metadata.sessionId)) + .map(metadata => ({ + metadata, + isActive: false, + lastDate: metadata.saveDate + })); + } catch (error) { + this.logger.error('Failed to load persisted sessions, showing only active sessions', error); + // Continue with just active sessions + } + + // Combine and sort by last interaction/message date + const allSessions = [ + ...activeSessions.map(s => ({ + isActive: true, + id: s.session.id, + title: s.session.title!, + lastDate: s.lastDate, + firstRequestText: s.session.model.getRequests().at(0)?.request.text + })), + ...persistedSessions.map(s => ({ + isActive: false, + id: s.metadata.sessionId, + title: s.metadata.title, + lastDate: s.lastDate, + firstRequestText: undefined + })) + ].sort((a, b) => b.lastDate - a.lastDate); + + return allSessions.map(session => { + // Add icon for persisted sessions to visually distinguish them + const icon = session.isActive ? '' : '$(archive) '; + const label = `${icon}${session.title}`; + + return ({ + label, + description: formatDistance(new Date(session.lastDate), new Date(), { addSuffix: false, locale: getDateFnsLocale() }), + detail: session.firstRequestText || (session.isActive ? undefined : nls.localize('theia/ai/chat-ui/persistedSession', 'Persisted session (click to restore)')), + id: session.id, + buttons: [AIChatContribution.RENAME_CHAT_BUTTON, AIChatContribution.REMOVE_CHAT_BUTTON] + }); + }); + }; + + const defer = new Deferred(); + const quickPick = this.quickInputService.createQuickPick(); + quickPick.placeholder = nls.localize('theia/ai/chat-ui/selectChat', 'Select chat'); + quickPick.canSelectMany = false; + quickPick.busy = true; + quickPick.show(); + + // Load items asynchronously + getItems().then(items => { + quickPick.items = items; + quickPick.busy = false; + }).catch(error => { + this.logger.error('Failed to load chat sessions', error); + quickPick.busy = false; + quickPick.placeholder = nls.localize('theia/ai/chat-ui/failedToLoadChats', 'Failed to load chat sessions'); + }); + + quickPick.onDidTriggerItemButton(async context => { + if (context.button === AIChatContribution.RENAME_CHAT_BUTTON) { + quickPick.hide(); + this.quickInputService.input({ + placeHolder: nls.localize('theia/ai/chat-ui/enterChatName', 'Enter chat name') + }).then(name => { + if (name && name.length > 0) { + const session = this.chatService.getSession(context.item.id!); + if (session) { + session.title = name; + } + } + }); + } else if (context.button === AIChatContribution.REMOVE_CHAT_BUTTON) { + const activeSession = this.chatService.getActiveSession(); + + // Wait for deletion to complete before refreshing the list + this.chatService.deleteSession(context.item.id!).then(() => getItems()).then(items => { + quickPick.items = items; + if (items.length === 0) { + quickPick.hide(); + } + // Update persisted sessions flag after deletion + this.checkPersistedSessions(); + + if (activeSession && activeSession.id === context.item.id) { + this.chatService.createSession(ChatAgentLocation.Panel, { + // Auto-focus only when the quick pick is no longer visible + focus: items.length === 0 + }); + } + }).catch(error => { + this.logger.error('Failed to delete chat session', error); + this.messageService.error(nls.localize('theia/ai/chat-ui/failedToDeleteSession', 'Failed to delete chat session')); + }); + } + }); + + quickPick.onDidAccept(async () => { + const selectedItem = quickPick.selectedItems[0]; + if (selectedItem) { + // Restore session if not already loaded + const session = this.chatService.getSession(selectedItem.id!); + if (!session) { + try { + await this.chatService.getOrRestoreSession(selectedItem.id!); + // Update persisted sessions flag after restoration + this.checkPersistedSessions(); + } catch (error) { + this.logger.error('Failed to restore chat session', error); + this.messageService.error(nls.localize('theia/ai/chat-ui/failedToRestoreSession', 'Failed to restore chat session')); + defer.resolve(undefined); + quickPick.hide(); + return; + } + } + } + defer.resolve(selectedItem); + quickPick.hide(); + }); + + quickPick.onDidHide(() => defer.resolve(undefined)); + + return defer.promise; + } + + protected withWidget( + widget: Widget | undefined = this.tryGetWidget(), + predicate: (output: ChatViewWidget) => boolean = () => true + ): boolean | false { + return widget instanceof ChatViewWidget ? predicate(widget) : false; + } + + protected extractChatView(chatView: ChatViewWidget): void { + this.secondaryWindowHandler.moveWidgetToSecondaryWindow(chatView); + } + + canExtractChatView(chatView: ChatViewWidget): boolean { + return !chatView.secondaryWindow; + } + + protected async summarizeActiveSession(): Promise { + const activeSession = this.chatService.getActiveSession(); + if (!activeSession) { return; } + return this.taskContextService.summarize(activeSession).catch(err => { + console.warn('Error while summarizing session:', err); + this.messageService.error(nls.localize('theia/ai/chat-ui/unableToSummarizeCurrentSession', + 'Unable to summarize current session. Please confirm that the summary agent is not disabled.')); + return undefined; + }); + } + + /** + * Prompts the user to select a chat agent + * @returns The selected agent or undefined if cancelled + */ + /** + * Prompts the user to select a chat agent with an optional default (pre-selected) agent. + * @param defaultAgentId The id of the agent to pre-select, if present + * @returns The selected agent or undefined if cancelled + */ + protected async selectAgent(defaultAgentId?: string): Promise { + const agents = this.chatAgentService.getAgents(); + if (agents.length === 0) { + this.messageService.warn(nls.localize('theia/ai/chat-ui/noChatAgentsAvailable', 'No chat agents available.')); + return undefined; + } + + const items: QuickPickItem[] = agents.map(agent => ({ + label: agent.name || agent.id, + description: agent.description, + id: agent.id + })); + + let preselected: QuickPickItem | undefined = undefined; + if (defaultAgentId) { + preselected = items.find(item => item.id === defaultAgentId); + } + + const selected = await this.quickInputService.showQuickPick(items, { + placeholder: nls.localize('theia/ai/chat-ui/selectAgentQuickPickPlaceholder', 'Select an agent for the new session'), + activeItem: preselected + }); + + if (!selected) { + return undefined; + } + + return this.chatAgentService.getAgent(selected.id!); + } + + /** + * Prompts the user to select a task context with special marking for currently opened files + * @returns The selected task context ID or undefined if cancelled + */ + protected async selectTaskContextWithMarking(): Promise { + const contexts = this.taskContextService.getAll(); + const openedFilesInfo = this.getOpenedTaskContextFiles(); + + // Create items with opened files marked and prioritized + const items: QuickPickItem[] = contexts.map(summary => { + const isOpened = openedFilesInfo.openedIds.includes(summary.id); + const isActive = openedFilesInfo.activeId === summary.id; + return { + label: isOpened ? `📄 ${summary.label} (${nls.localize('theia/ai/chat-ui/selectTaskContextQuickPickItem/currentlyOpen', 'currently open')})` : summary.label, + description: summary.id, + id: summary.id, + // We'll sort active file first, then opened files, then others + sortText: isActive ? `0-${summary.label}` : isOpened ? `1-${summary.label}` : `2-${summary.label}` + }; + }).sort((a, b) => a.sortText!.localeCompare(b.sortText!)); + + const selected = await this.quickInputService.showQuickPick(items, { + placeholder: nls.localize('theia/ai/chat-ui/selectTaskContextQuickPickPlaceholder', 'Select a task context to attach') + }); + + return selected?.id; + } + + /** + * Returns information about task context files that are currently opened + * @returns Object with arrays of opened context IDs and the active context ID + */ + protected getOpenedTaskContextFiles(): { openedIds: string[], activeId?: string } { + // Get all contexts with their URIs + const allContexts = this.taskContextService.getAll(); + const contextMap = new Map(); // Map of URI -> ID + // Create a map of URI string -> context ID for lookup + for (const context of allContexts) { + if (context.uri) { + contextMap.set(context.uri.toString(), context.id); + } + } + + // Get all open editor URIs + const openEditorUris = this.editorManager.all.map(widget => widget.editor.uri.toString()); + + // Get the currently active/focused editor URI if any + const activeEditorUri = this.editorManager.currentEditor?.editor.uri.toString(); + let activeContextId: string | undefined; + + if (activeEditorUri) { + activeContextId = contextMap.get(activeEditorUri); + } + + // Filter to only task context files that are currently opened + const openedContextIds: string[] = []; + for (const uri of openEditorUris) { + const contextId = contextMap.get(uri); + if (contextId) { + openedContextIds.push(contextId); + } + } + + return { openedIds: openedContextIds, activeId: activeContextId }; + } +} + +function getDateFnsLocale(): locales.Locale { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + return nls.locale ? (locales as any)[nls.locale] ?? locales.enUS : locales.enUS; +} diff --git a/packages/ai-chat-ui/src/browser/ai-chat-ui-frontend-module.ts b/packages/ai-chat-ui/src/browser/ai-chat-ui-frontend-module.ts new file mode 100644 index 0000000..a8b05b1 --- /dev/null +++ b/packages/ai-chat-ui/src/browser/ai-chat-ui-frontend-module.ts @@ -0,0 +1,199 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import '../../src/browser/style/index.css'; +import { bindContributionProvider, CommandContribution, MenuContribution } from '@theia/core'; +import { bindViewContribution, FrontendApplicationContribution, WidgetFactory, KeybindingContribution } from '@theia/core/lib/browser'; +import { TabBarToolbarContribution } from '@theia/core/lib/browser/shell/tab-bar-toolbar'; +import { ContainerModule, interfaces } from '@theia/core/shared/inversify'; +import { EditorSelectionResolver } from '@theia/editor/lib/browser/editor-manager'; +import { AIChatContribution } from './ai-chat-ui-contribution'; +import { AIChatInputConfiguration, AIChatInputWidget } from './chat-input-widget'; +import { ChatNodeToolbarActionContribution, DefaultChatNodeToolbarActionContribution } from './chat-node-toolbar-action-contribution'; +import { ChatResponsePartRenderer } from './chat-response-part-renderer'; +import { + CodePartRenderer, + CodePartRendererAction, + CommandPartRenderer, + CopyToClipboardButtonAction, + ErrorPartRenderer, + HorizontalLayoutPartRenderer, + InsertCodeAtCursorButtonAction, + MarkdownPartRenderer, + ToolCallPartRenderer, + NotAvailableToolCallRenderer, + ThinkingPartRenderer, + ProgressPartRenderer, + DelegationResponseRenderer, + TextPartRenderer, +} from './chat-response-renderer'; +import { UnknownPartRenderer } from './chat-response-renderer/unknown-part-renderer'; +import { + GitHubSelectionResolver, + TextFragmentSelectionResolver, + TypeDocSymbolSelectionResolver, +} from './chat-response-renderer/ai-selection-resolver'; +import { QuestionPartRenderer } from './chat-response-renderer/question-part-renderer'; +import { createChatViewTreeWidget } from './chat-tree-view'; +import { ChatViewTreeWidget } from './chat-tree-view/chat-view-tree-widget'; +import { ChatViewMenuContribution } from './chat-view-contribution'; +import { ChatViewLanguageContribution } from './chat-view-language-contribution'; +import { ChatViewWidget } from './chat-view-widget'; +import { ChatViewWidgetToolbarContribution } from './chat-view-widget-toolbar-contribution'; +import { ContextVariablePicker } from './context-variable-picker'; +import { ChangeSetActionRenderer, ChangeSetActionService } from './change-set-actions/change-set-action-service'; +import { ChangeSetAcceptAction } from './change-set-actions/change-set-accept-action'; +import { AIChatTreeInputArgs, AIChatTreeInputConfiguration, AIChatTreeInputFactory, AIChatTreeInputWidget } from './chat-tree-view/chat-view-tree-input-widget'; +import { SubChatWidget, SubChatWidgetFactory } from './chat-tree-view/sub-chat-widget'; +import { ChatInputHistoryService } from './chat-input-history'; +import { ChatInputHistoryContribution } from './chat-input-history-contribution'; +import { ChatInputModeContribution } from './chat-input-mode-contribution'; +import { ChatFocusContribution } from './chat-focus-contribution'; + +export default new ContainerModule((bind, _unbind, _isBound, rebind) => { + bindViewContribution(bind, AIChatContribution); + bind(TabBarToolbarContribution).toService(AIChatContribution); + bind(FrontendApplicationContribution).toService(AIChatContribution); + + bind(ChatInputHistoryService).toSelf().inSingletonScope(); + bind(ChatInputHistoryContribution).toSelf().inSingletonScope(); + bind(CommandContribution).toService(ChatInputHistoryContribution); + bind(KeybindingContribution).toService(ChatInputHistoryContribution); + + bind(ChatInputModeContribution).toSelf().inSingletonScope(); + bind(CommandContribution).toService(ChatInputModeContribution); + bind(KeybindingContribution).toService(ChatInputModeContribution); + + bind(ChatFocusContribution).toSelf().inSingletonScope(); + bind(CommandContribution).toService(ChatFocusContribution); + bind(KeybindingContribution).toService(ChatFocusContribution); + + bindContributionProvider(bind, ChatResponsePartRenderer); + + bindChatViewWidget(bind); + + bind(AIChatInputWidget).toSelf(); + bind(AIChatInputConfiguration).toConstantValue({ + showContext: true, + showPinnedAgent: true, + showChangeSet: true, + enablePromptHistory: true + } satisfies AIChatInputConfiguration); + bind(WidgetFactory).toDynamicValue(({ container }) => ({ + id: AIChatInputWidget.ID, + createWidget: () => container.get(AIChatInputWidget) + })).inSingletonScope(); + + bind(ChatViewTreeWidget).toDynamicValue(ctx => + createChatViewTreeWidget(ctx.container) + ); + bind(WidgetFactory).toDynamicValue(({ container }) => ({ + id: ChatViewTreeWidget.ID, + createWidget: () => container.get(ChatViewTreeWidget) + })).inSingletonScope(); + + bind(AIChatTreeInputFactory).toFactory(ctx => (args: AIChatTreeInputArgs) => { + const container = ctx.container.createChild(); + container.bind(AIChatTreeInputArgs).toConstantValue(args); + container.bind(AIChatTreeInputConfiguration).toConstantValue({ + showContext: true, + showPinnedAgent: true, + showChangeSet: false, + showSuggestions: false, + enablePromptHistory: false + } satisfies AIChatInputConfiguration); + container.bind(AIChatTreeInputWidget).toSelf().inSingletonScope(); + const widget = container.get(AIChatTreeInputWidget); + const noOp = () => { }; + widget.node.classList.add('chat-input-widget'); + widget.chatModel = args.node.request.session; + widget.initialValue = args.initialValue; + widget.setEnabled(true); + widget.onQuery = args.onQuery; + // We need to set those values here, otherwise the widget will throw an error + widget.onUnpin = args.onUnpin ?? noOp; + widget.onCancel = args.onCancel ?? noOp; + widget.onDeleteChangeSet = args.onDeleteChangeSet ?? noOp; + widget.onDeleteChangeSetElement = args.onDeleteChangeSetElement ?? noOp; + return widget; + }); + + bind(ContextVariablePicker).toSelf().inSingletonScope(); + + bind(ChatResponsePartRenderer).to(HorizontalLayoutPartRenderer).inSingletonScope(); + bind(ChatResponsePartRenderer).to(ErrorPartRenderer).inSingletonScope(); + bind(ChatResponsePartRenderer).to(MarkdownPartRenderer).inSingletonScope(); + bind(ChatResponsePartRenderer).to(CodePartRenderer).inSingletonScope(); + bind(ChatResponsePartRenderer).to(CommandPartRenderer).inSingletonScope(); + bind(ChatResponsePartRenderer).to(ToolCallPartRenderer).inSingletonScope(); + bind(ChatResponsePartRenderer).to(NotAvailableToolCallRenderer).inSingletonScope(); + bind(ChatResponsePartRenderer).to(ErrorPartRenderer).inSingletonScope(); + bind(ChatResponsePartRenderer).to(ThinkingPartRenderer).inSingletonScope(); + bind(ChatResponsePartRenderer).to(QuestionPartRenderer).inSingletonScope(); + bind(ChatResponsePartRenderer).to(ProgressPartRenderer).inSingletonScope(); + bind(ChatResponsePartRenderer).to(TextPartRenderer).inSingletonScope(); + bind(ChatResponsePartRenderer).to(DelegationResponseRenderer).inSingletonScope(); + bind(ChatResponsePartRenderer).to(UnknownPartRenderer).inSingletonScope(); + [CommandContribution, MenuContribution].forEach(serviceIdentifier => + bind(serviceIdentifier).to(ChatViewMenuContribution).inSingletonScope() + ); + + bindContributionProvider(bind, CodePartRendererAction); + bindContributionProvider(bind, ChangeSetActionRenderer); + bind(CopyToClipboardButtonAction).toSelf().inSingletonScope(); + bind(CodePartRendererAction).toService(CopyToClipboardButtonAction); + bind(InsertCodeAtCursorButtonAction).toSelf().inSingletonScope(); + bind(CodePartRendererAction).toService(InsertCodeAtCursorButtonAction); + + bind(EditorSelectionResolver).to(GitHubSelectionResolver).inSingletonScope(); + bind(EditorSelectionResolver).to(TypeDocSymbolSelectionResolver).inSingletonScope(); + bind(EditorSelectionResolver).to(TextFragmentSelectionResolver).inSingletonScope(); + + bind(ChatViewWidgetToolbarContribution).toSelf().inSingletonScope(); + bind(TabBarToolbarContribution).toService(ChatViewWidgetToolbarContribution); + + bind(FrontendApplicationContribution).to(ChatViewLanguageContribution).inSingletonScope(); + bind(ChangeSetActionService).toSelf().inSingletonScope(); + bind(ChangeSetAcceptAction).toSelf().inSingletonScope(); + bind(ChangeSetActionRenderer).toService(ChangeSetAcceptAction); + + bindContributionProvider(bind, ChatNodeToolbarActionContribution); + bind(DefaultChatNodeToolbarActionContribution).toSelf().inSingletonScope(); + bind(ChatNodeToolbarActionContribution).toService(DefaultChatNodeToolbarActionContribution); + + bind(SubChatWidgetFactory).toFactory(ctx => () => { + const container = ctx.container.createChild(); + container.bind(SubChatWidget).toSelf().inSingletonScope(); + const widget = container.get(SubChatWidget); + return widget; + }); + +}); + +function bindChatViewWidget(bind: interfaces.Bind): void { + let chatViewWidget: ChatViewWidget | undefined; + bind(ChatViewWidget).toSelf(); + + bind(WidgetFactory).toDynamicValue(context => ({ + id: ChatViewWidget.ID, + createWidget: () => { + if (chatViewWidget?.isDisposed !== false) { + chatViewWidget = context.container.get(ChatViewWidget); + } + return chatViewWidget; + } + })).inSingletonScope(); +} diff --git a/packages/ai-chat-ui/src/browser/change-set-actions/change-set-accept-action.tsx b/packages/ai-chat-ui/src/browser/change-set-actions/change-set-accept-action.tsx new file mode 100644 index 0000000..fb058da --- /dev/null +++ b/packages/ai-chat-ui/src/browser/change-set-actions/change-set-accept-action.tsx @@ -0,0 +1,52 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import * as React from '@theia/core/shared/react'; +import { injectable } from '@theia/core/shared/inversify'; +import { ChangeSetActionRenderer } from './change-set-action-service'; +import { ChangeSet, ChangeSetElement } from '@theia/ai-chat'; +import { nls } from '@theia/core'; + +@injectable() +export class ChangeSetAcceptAction implements ChangeSetActionRenderer { + readonly id = 'change-set-accept-action'; + canRender(changeSet: ChangeSet): boolean { + return changeSet.getElements().length > 0; + } + + render(changeSet: ChangeSet): React.ReactNode { + return ; + } +} + +function acceptAllPendingElements(changeSet: ChangeSet): void { + acceptablePendingElements(changeSet).forEach(e => e.apply!()); +} + +function hasPendingElementsToAccept(changeSet: ChangeSet): boolean | undefined { + return acceptablePendingElements(changeSet).length > 0; +} + +function acceptablePendingElements(changeSet: ChangeSet): ChangeSetElement[] { + return changeSet.getElements().filter(e => e.apply && (e.state === undefined || e.state === 'pending')); +} diff --git a/packages/ai-chat-ui/src/browser/change-set-actions/change-set-action-service.ts b/packages/ai-chat-ui/src/browser/change-set-actions/change-set-action-service.ts new file mode 100644 index 0000000..56a338a --- /dev/null +++ b/packages/ai-chat-ui/src/browser/change-set-actions/change-set-action-service.ts @@ -0,0 +1,65 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { ContributionProvider, Event, Emitter } from '@theia/core'; +import { ChangeSet } from '@theia/ai-chat'; +import { inject, injectable, named, postConstruct } from '@theia/core/shared/inversify'; + +export const ChangeSetActionRenderer = Symbol('ChangeSetActionRenderer'); +/** + * The CodePartRenderer offers to contribute arbitrary React nodes to the rendered code part. + * Technically anything can be rendered, however it is intended to be used for actions, like + * "Copy to Clipboard" or "Insert at Cursor". + */ +export interface ChangeSetActionRenderer { + readonly id: string; + onDidChange?: Event; + render(changeSet: ChangeSet): React.ReactNode; + /** + * Determines if the action should be rendered for the given response. + */ + canRender?(changeSet: ChangeSet): boolean; + /** + * Actions are ordered by descending priority. (Highest on left). + */ + readonly priority?: number; +} + +@injectable() +export class ChangeSetActionService { + protected readonly onDidChangeEmitter = new Emitter(); + get onDidChange(): Event { + return this.onDidChangeEmitter.event; + } + + @inject(ContributionProvider) @named(ChangeSetActionRenderer) + protected readonly contributions: ContributionProvider; + + @postConstruct() + protected init(): void { + const actions = this.contributions.getContributions(); + actions.sort((a, b) => (b.priority ?? 0) - (a.priority ?? 0)); + actions.forEach(contribution => contribution.onDidChange?.(this.onDidChangeEmitter.fire, this.onDidChangeEmitter)); + } + + getActions(): readonly ChangeSetActionRenderer[] { + return this.contributions.getContributions(); + } + + getActionsForChangeset(changeSet: ChangeSet): ChangeSetActionRenderer[] { + return this.getActions().filter(candidate => !candidate.canRender || candidate.canRender(changeSet)); + } +} diff --git a/packages/ai-chat-ui/src/browser/chat-focus-contribution.ts b/packages/ai-chat-ui/src/browser/chat-focus-contribution.ts new file mode 100644 index 0000000..a16f3aa --- /dev/null +++ b/packages/ai-chat-ui/src/browser/chat-focus-contribution.ts @@ -0,0 +1,102 @@ +// ***************************************************************************** +// Copyright (C) 2026 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { Command, CommandContribution, CommandRegistry } from '@theia/core'; +import { ApplicationShell, KeybindingContribution, KeybindingRegistry } from '@theia/core/lib/browser'; +import { inject, injectable } from '@theia/core/shared/inversify'; +import { ChatViewWidget } from './chat-view-widget'; +import { ChatCommands } from './chat-view-commands'; + +export const CHAT_FOCUS_INPUT_COMMAND = Command.toLocalizedCommand({ + id: 'ai-chat.focus-input', + category: ChatCommands.CHAT_CATEGORY, + label: 'Focus Chat Input' +}, 'theia/ai/chat-ui/focusInput', ChatCommands.CHAT_CATEGORY_KEY); + +export const CHAT_FOCUS_RESPONSE_COMMAND = Command.toLocalizedCommand({ + id: 'ai-chat.focus-response', + category: ChatCommands.CHAT_CATEGORY, + label: 'Focus Chat Response' +}, 'theia/ai/chat-ui/focusResponse', ChatCommands.CHAT_CATEGORY_KEY); + +@injectable() +export class ChatFocusContribution implements CommandContribution, KeybindingContribution { + + @inject(ApplicationShell) + protected readonly shell: ApplicationShell; + + registerCommands(commands: CommandRegistry): void { + commands.registerCommand(CHAT_FOCUS_INPUT_COMMAND, { + execute: () => this.focusInput(), + isEnabled: () => this.findActiveChatViewWidget() !== undefined + }); + commands.registerCommand(CHAT_FOCUS_RESPONSE_COMMAND, { + execute: () => this.focusResponse(), + isEnabled: () => this.findActiveChatViewWidget() !== undefined + }); + } + + registerKeybindings(keybindings: KeybindingRegistry): void { + keybindings.registerKeybinding({ + command: CHAT_FOCUS_RESPONSE_COMMAND.id, + keybinding: 'ctrlcmd+up', + when: 'chatInputFocus && !suggestWidgetVisible' + }); + keybindings.registerKeybinding({ + command: CHAT_FOCUS_INPUT_COMMAND.id, + keybinding: 'ctrlcmd+down', + when: 'chatResponseFocus' + }); + } + + protected focusInput(): void { + const chatViewWidget = this.findActiveChatViewWidget(); + if (chatViewWidget) { + chatViewWidget.inputWidget.activate(); + } + } + + protected focusResponse(): void { + const chatViewWidget = this.findActiveChatViewWidget(); + if (chatViewWidget) { + chatViewWidget.treeWidget.node.focus(); + } + } + + protected findActiveChatViewWidget(): ChatViewWidget | undefined { + const activeWidget = this.shell.activeWidget; + if (activeWidget instanceof ChatViewWidget) { + return activeWidget; + } + // Also check if any part of the chat view has focus + const activeElement = document.activeElement; + if (activeElement instanceof HTMLElement) { + const widget = this.shell.findWidgetForElement(activeElement); + if (widget instanceof ChatViewWidget) { + return widget; + } + // Check parent widgets (e.g., when input widget has focus) + let parent = widget?.parent; + while (parent) { + if (parent instanceof ChatViewWidget) { + return parent; + } + parent = parent.parent; + } + } + return undefined; + } +} diff --git a/packages/ai-chat-ui/src/browser/chat-input-agent-suggestions.tsx b/packages/ai-chat-ui/src/browser/chat-input-agent-suggestions.tsx new file mode 100644 index 0000000..f30bd28 --- /dev/null +++ b/packages/ai-chat-ui/src/browser/chat-input-agent-suggestions.tsx @@ -0,0 +1,85 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import * as React from '@theia/core/shared/react'; +import { DeclaredEventsEventListenerObject, useMarkdownRendering } from './chat-response-renderer/markdown-part-renderer'; +import { OpenerService } from '@theia/core/lib/browser'; +import { ChatSuggestion, ChatSuggestionCallback } from '@theia/ai-chat'; +import { MarkdownString } from '@theia/core/lib/common/markdown-rendering'; + +interface ChatInputAgentSuggestionsProps { + suggestions: readonly ChatSuggestion[]; + opener: OpenerService; +} + +function getText(suggestion: ChatSuggestion): string { + if (typeof suggestion === 'string') { return suggestion; } + if ('value' in suggestion) { return suggestion.value; } + if (typeof suggestion.content === 'string') { return suggestion.content; } + return suggestion.content.value; +} + +function getContent(suggestion: ChatSuggestion): string | MarkdownString { + if (typeof suggestion === 'string') { return suggestion; } + if ('value' in suggestion) { return suggestion; } + return suggestion.content; +} + +export const ChatInputAgentSuggestions: React.FC = ({ suggestions, opener }) => ( + !!suggestions?.length &&
+ {suggestions.map(suggestion => )} +
+); + +interface ChatInputAgestSuggestionProps { + suggestion: ChatSuggestion; + opener: OpenerService; + handler?: DeclaredEventsEventListenerObject; +} + +const ChatInputAgentSuggestion: React.FC = ({ suggestion, opener, handler }) => { + const ref = useMarkdownRendering(getContent(suggestion), opener, true, handler); + return
; +}; + +class ChatSuggestionClickHandler implements DeclaredEventsEventListenerObject { + constructor(protected readonly suggestion: ChatSuggestionCallback) { } + handleEvent(event: Event): boolean { + const { target, currentTarget } = event; + if (event.type !== 'click' || !(target instanceof Element)) { return false; } + const link = target.closest('a[href^="_callback"]'); + if (link) { + this.suggestion.callback(); + return true; + } + if (!(currentTarget instanceof Element)) { + this.suggestion.callback(); + return true; + } + const containedLink = currentTarget.querySelector('a[href^="_callback"]'); + // Whole body should count. + if (!containedLink) { + this.suggestion.callback(); + return true; + } + return false; + } +} diff --git a/packages/ai-chat-ui/src/browser/chat-input-history-contribution.ts b/packages/ai-chat-ui/src/browser/chat-input-history-contribution.ts new file mode 100644 index 0000000..07b7b19 --- /dev/null +++ b/packages/ai-chat-ui/src/browser/chat-input-history-contribution.ts @@ -0,0 +1,167 @@ +// ***************************************************************************** +// Copyright (C) 2025 STMicroelectronics and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { Command, CommandContribution, CommandRegistry } from '@theia/core'; +import { ApplicationShell, KeybindingContribution, KeybindingRegistry } from '@theia/core/lib/browser'; +import { inject, injectable } from '@theia/core/shared/inversify'; +import { AIChatInputWidget } from './chat-input-widget'; +import { ChatInputHistoryService } from './chat-input-history'; +import { ChatCommands } from './chat-view-commands'; + +const CHAT_INPUT_PREVIOUS_PROMPT_COMMAND = Command.toLocalizedCommand({ + id: 'chat-input:previous-prompt', + label: 'Previous Prompt' +}, 'theia/ai/chat-ui/chatInput/previousPrompt'); + +const CHAT_INPUT_NEXT_PROMPT_COMMAND = Command.toLocalizedCommand({ + id: 'chat-input:next-prompt', + label: 'Next Prompt' +}, 'theia/ai/chat-ui/chatInput/nextPrompt'); + +const CHAT_INPUT_CLEAR_HISTORY_COMMAND = Command.toLocalizedCommand({ + id: 'chat-input:clear-history', + category: ChatCommands.CHAT_CATEGORY, + label: 'Clear Input Prompt History' +}, 'theia/ai/chat-ui/chatInput/clearHistory', ChatCommands.CHAT_CATEGORY_KEY); + +@injectable() +export class ChatInputHistoryContribution implements CommandContribution, KeybindingContribution { + + @inject(ApplicationShell) + protected readonly shell: ApplicationShell; + + @inject(ChatInputHistoryService) + protected readonly historyService: ChatInputHistoryService; + + registerCommands(commands: CommandRegistry): void { + commands.registerCommand(CHAT_INPUT_PREVIOUS_PROMPT_COMMAND, { + execute: () => this.executeNavigatePrevious(), + isEnabled: () => this.isNavigationEnabled() + }); + + commands.registerCommand(CHAT_INPUT_NEXT_PROMPT_COMMAND, { + execute: () => this.executeNavigateNext(), + isEnabled: () => this.isNavigationEnabled() + }); + + commands.registerCommand(CHAT_INPUT_CLEAR_HISTORY_COMMAND, { + execute: () => this.historyService.clearHistory(), + isEnabled: () => this.historyService.getPrompts().length > 0 + }); + } + + registerKeybindings(keybindings: KeybindingRegistry): void { + keybindings.registerKeybinding({ + command: CHAT_INPUT_PREVIOUS_PROMPT_COMMAND.id, + keybinding: 'up', + when: 'chatInputFocus && chatInputFirstLine && !suggestWidgetVisible' + }); + + keybindings.registerKeybinding({ + command: CHAT_INPUT_NEXT_PROMPT_COMMAND.id, + keybinding: 'down', + when: 'chatInputFocus && chatInputLastLine && !suggestWidgetVisible' + }); + } + + protected executeNavigatePrevious(): void { + const chatInputWidget = this.findFocusedChatInput(); + if (!chatInputWidget || !chatInputWidget.editor) { + return; + } + + const position = chatInputWidget.editor.getControl().getPosition(); + const isCursorAtBeginning = position && (position.lineNumber > 1 || position.column > 1); + if (isCursorAtBeginning) { + this.positionCursorAtBeginning(chatInputWidget); + return; + } + + const currentInput = chatInputWidget.editor.getControl().getValue(); + const previousPrompt = chatInputWidget.getPreviousPrompt(currentInput); + if (previousPrompt !== undefined) { + chatInputWidget.editor.getControl().setValue(previousPrompt); + this.positionCursorAtBeginning(chatInputWidget); + } + } + + protected executeNavigateNext(): void { + const chatInputWidget = this.findFocusedChatInput(); + if (!chatInputWidget || !chatInputWidget.editor) { + return; + } + + const position = chatInputWidget.editor.getControl().getPosition(); + const model = chatInputWidget.editor.getControl().getModel(); + const isCursorAtEnd = position && model && ( + position.lineNumber < model.getLineCount() || position.column < model.getLineMaxColumn(position.lineNumber) + ); + if (isCursorAtEnd) { + this.positionCursorAtEnd(chatInputWidget); + return; + } + + const nextPrompt = chatInputWidget.getNextPrompt(); + if (nextPrompt !== undefined) { + chatInputWidget.editor.getControl().setValue(nextPrompt); + this.positionCursorAtEnd(chatInputWidget); + } + } + + protected positionCursorAtBeginning(widget: AIChatInputWidget): void { + const editor = widget.editor?.getControl(); + if (editor) { + editor.setPosition({ lineNumber: 1, column: 1 }); + editor.focus(); + } + } + + protected positionCursorAtEnd(widget: AIChatInputWidget): void { + const editor = widget.editor?.getControl(); + const model = editor?.getModel(); + + if (editor && model) { + const lastLine = model.getLineCount(); + const lastColumn = model.getLineContent(lastLine).length + 1; + editor.setPosition({ lineNumber: lastLine, column: lastColumn }); + editor.focus(); + } + } + + protected findFocusedChatInput(): AIChatInputWidget | undefined { + const activeElement = document.activeElement; + if (!(activeElement instanceof HTMLElement)) { + return; + } + const activeWidget = this.shell.findWidgetForElement(activeElement); + if (!(activeWidget instanceof AIChatInputWidget)) { + return; + } + if (!activeWidget.inputConfiguration?.enablePromptHistory) { + return; + } + if (!activeWidget.editor?.getControl().hasWidgetFocus()) { + return; + } + return activeWidget; + } + + protected isNavigationEnabled(): boolean { + const chatInputWidget = this.findFocusedChatInput(); + return chatInputWidget !== undefined && + chatInputWidget.inputConfiguration?.enablePromptHistory !== false; + } +} diff --git a/packages/ai-chat-ui/src/browser/chat-input-history.ts b/packages/ai-chat-ui/src/browser/chat-input-history.ts new file mode 100644 index 0000000..0f0a5c9 --- /dev/null +++ b/packages/ai-chat-ui/src/browser/chat-input-history.ts @@ -0,0 +1,138 @@ +// ***************************************************************************** +// Copyright (C) 2025 STMicroelectronics and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { inject, injectable } from '@theia/core/shared/inversify'; +import { StorageService } from '@theia/core/lib/browser'; + +/** + * Manages navigation state for a single chat input widget. + * Each widget has its own independent navigation state while sharing the same history. + */ +export class ChatInputNavigationState { + private currentIndex: number; + private preservedInput?: string; + private isNavigating = false; + + constructor(private readonly historyService: ChatInputHistoryService) { + this.currentIndex = historyService.getPrompts().length; + } + + getPreviousPrompt(currentInput: string): string | undefined { + const history = this.historyService.getPrompts(); + + if (history.length === 0) { + return undefined; + } + + if (!this.isNavigating) { + this.preservedInput = currentInput; + this.isNavigating = true; + this.currentIndex = history.length; + } + + if (this.currentIndex <= 0) { + // Already at the oldest prompt + return undefined; + } + + this.currentIndex--; + return history[this.currentIndex]; + } + + getNextPrompt(): string | undefined { + const history = this.historyService.getPrompts(); + + if (!this.isNavigating || this.currentIndex >= history.length) { + return undefined; + } + + this.currentIndex++; + + if (this.currentIndex >= history.length) { + // Reached end of history - return to preserved input + this.isNavigating = false; + const preserved = this.preservedInput; + this.preservedInput = undefined; + this.currentIndex = history.length; + return preserved || ''; + } + + return history[this.currentIndex]; + } + + stopNavigation(): void { + this.isNavigating = false; + this.preservedInput = undefined; + this.currentIndex = this.historyService.getPrompts().length; + } + +} + +const CHAT_PROMPT_HISTORY_STORAGE_KEY = 'ai-chat-prompt-history'; +const MAX_HISTORY_SIZE = 100; + +/** + * Manages shared prompt history across all chat input widgets. + * Each prompt is stored only once and shared between all chat inputs. + */ +@injectable() +export class ChatInputHistoryService { + + @inject(StorageService) + protected readonly storageService: StorageService; + + protected history: string[] = []; + + async init(): Promise { + const data = await this.storageService.getData<{ prompts: string[] }>(CHAT_PROMPT_HISTORY_STORAGE_KEY, { prompts: [] }); + this.history = data.prompts || []; + } + + /** + * Get read-only access to the current prompt history. + */ + getPrompts(): readonly string[] { + return this.history; + } + + clearHistory(): void { + this.history = []; + this.persistHistory(); + } + + addToHistory(prompt: string): void { + const trimmed = prompt.trim(); + if (!trimmed) { + return; + } + + // Remove existing instance and add to end (most recent) + this.history = this.history + .filter(item => item !== trimmed) + .concat(trimmed) + .slice(-MAX_HISTORY_SIZE); + + this.persistHistory(); + } + + protected async persistHistory(): Promise { + try { + await this.storageService.setData(CHAT_PROMPT_HISTORY_STORAGE_KEY, { prompts: this.history }); + } catch (error) { + console.warn('Failed to persist chat prompt history:', error); + } + } +} diff --git a/packages/ai-chat-ui/src/browser/chat-input-mode-contribution.ts b/packages/ai-chat-ui/src/browser/chat-input-mode-contribution.ts new file mode 100644 index 0000000..e17fa82 --- /dev/null +++ b/packages/ai-chat-ui/src/browser/chat-input-mode-contribution.ts @@ -0,0 +1,75 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { Command, CommandContribution, CommandRegistry } from '@theia/core'; +import { ApplicationShell, KeybindingContribution, KeybindingRegistry } from '@theia/core/lib/browser'; +import { inject, injectable } from '@theia/core/shared/inversify'; +import { AIChatInputWidget } from './chat-input-widget'; + +const CHAT_INPUT_CYCLE_MODE_COMMAND = Command.toLocalizedCommand({ + id: 'chat-input:cycle-mode', + label: 'Cycle Chat Mode' +}, 'theia/ai/chat-ui/chatInput/cycleMode'); + +@injectable() +export class ChatInputModeContribution implements CommandContribution, KeybindingContribution { + + @inject(ApplicationShell) + protected readonly shell: ApplicationShell; + + registerCommands(commands: CommandRegistry): void { + commands.registerCommand(CHAT_INPUT_CYCLE_MODE_COMMAND, { + execute: () => this.executeCycleMode(), + isEnabled: () => this.isCycleModeEnabled() + }); + } + + registerKeybindings(keybindings: KeybindingRegistry): void { + keybindings.registerKeybinding({ + command: CHAT_INPUT_CYCLE_MODE_COMMAND.id, + keybinding: 'shift+tab', + when: 'chatInputFocus && chatInputHasModes && !suggestWidgetVisible' + }); + } + + protected executeCycleMode(): void { + const chatInputWidget = this.findFocusedChatInput(); + if (!chatInputWidget) { + return; + } + chatInputWidget.cycleMode(); + } + + protected isCycleModeEnabled(): boolean { + const chatInputWidget = this.findFocusedChatInput(); + return chatInputWidget !== undefined; + } + + protected findFocusedChatInput(): AIChatInputWidget | undefined { + const activeElement = document.activeElement; + if (!(activeElement instanceof HTMLElement)) { + return; + } + const activeWidget = this.shell.findWidgetForElement(activeElement); + if (!(activeWidget instanceof AIChatInputWidget)) { + return; + } + if (!activeWidget.editor?.getControl().hasWidgetFocus()) { + return; + } + return activeWidget; + } +} diff --git a/packages/ai-chat-ui/src/browser/chat-input-widget.tsx b/packages/ai-chat-ui/src/browser/chat-input-widget.tsx new file mode 100644 index 0000000..70a223b --- /dev/null +++ b/packages/ai-chat-ui/src/browser/chat-input-widget.tsx @@ -0,0 +1,1531 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** +import { + ChangeSet, ChangeSetElement, ChatAgent, ChatChangeEvent, ChatHierarchyBranch, + ChatModel, ChatRequestModel, ChatService, ChatSuggestion, EditableChatRequestModel, + ChatRequestParser, ChatMode +} from '@theia/ai-chat'; +import { ChangeSetDecoratorService } from '@theia/ai-chat/lib/browser/change-set-decorator-service'; +import { ImageContextVariable } from '@theia/ai-chat/lib/common/image-context-variable'; +import { AIVariableResolutionRequest } from '@theia/ai-core'; +import { AgentCompletionNotificationService, FrontendVariableService, AIActivationService } from '@theia/ai-core/lib/browser'; +import { DisposableCollection, Emitter, InMemoryResources, URI, nls, Disposable } from '@theia/core'; +import { ContextMenuRenderer, LabelProvider, Message, OpenerService, ReactWidget } from '@theia/core/lib/browser'; +import { ContextKey, ContextKeyService } from '@theia/core/lib/browser/context-key-service'; +import { Deferred } from '@theia/core/lib/common/promise-util'; +import { inject, injectable, optional, postConstruct } from '@theia/core/shared/inversify'; +import * as React from '@theia/core/shared/react'; +import { IMouseEvent, Range } from '@theia/monaco-editor-core'; +import { MonacoEditorProvider } from '@theia/monaco/lib/browser/monaco-editor-provider'; +import { SimpleMonacoEditor } from '@theia/monaco/lib/browser/simple-monaco-editor'; +import { ChangeSetActionRenderer, ChangeSetActionService } from './change-set-actions/change-set-action-service'; +import { ChatInputAgentSuggestions } from './chat-input-agent-suggestions'; +import { CHAT_VIEW_LANGUAGE_EXTENSION } from './chat-view-language-contribution'; +import { ContextVariablePicker } from './context-variable-picker'; +import { TASK_CONTEXT_VARIABLE } from '@theia/ai-chat/lib/browser/task-context-variable'; +import { IModelDeltaDecoration } from '@theia/monaco-editor-core/esm/vs/editor/common/model'; +import { EditorOption } from '@theia/monaco-editor-core/esm/vs/editor/common/config/editorOptions'; +import { ChatInputHistoryService, ChatInputNavigationState } from './chat-input-history'; +import { ContextFileValidationService, FileValidationResult, FileValidationState } from '@theia/ai-chat/lib/browser/context-file-validation-service'; + +type Query = (query: string, mode?: string) => Promise; +type Unpin = () => void; +type Cancel = (requestModel: ChatRequestModel) => void; +type DeleteChangeSet = (requestModel: ChatRequestModel) => void; +type DeleteChangeSetElement = (requestModel: ChatRequestModel, index: number) => void; +type OpenContextElement = (request: AIVariableResolutionRequest) => unknown; + +export const AIChatInputConfiguration = Symbol('AIChatInputConfiguration'); +export interface AIChatInputConfiguration { + showContext?: boolean; + showPinnedAgent?: boolean; + showChangeSet?: boolean; + showSuggestions?: boolean; + enablePromptHistory?: boolean; +} + +@injectable() +export class AIChatInputWidget extends ReactWidget { + public static ID = 'chat-input-widget'; + static readonly CONTEXT_MENU = ['chat-input-context-menu']; + + @inject(MonacoEditorProvider) + protected readonly editorProvider: MonacoEditorProvider; + + @inject(InMemoryResources) + protected readonly resources: InMemoryResources; + + @inject(ContextMenuRenderer) + protected readonly contextMenuRenderer: ContextMenuRenderer; + + @inject(AIChatInputConfiguration) @optional() + protected readonly configuration: AIChatInputConfiguration | undefined; + + @inject(FrontendVariableService) + protected readonly variableService: FrontendVariableService; + + @inject(LabelProvider) + protected readonly labelProvider: LabelProvider; + + @inject(ContextVariablePicker) + protected readonly contextVariablePicker: ContextVariablePicker; + + @inject(ChangeSetActionService) + protected readonly changeSetActionService: ChangeSetActionService; + + @inject(AgentCompletionNotificationService) + protected readonly agentNotificationService: AgentCompletionNotificationService; + + @inject(ChangeSetDecoratorService) + protected readonly changeSetDecoratorService: ChangeSetDecoratorService; + + @inject(OpenerService) + protected readonly openerService: OpenerService; + + @inject(ChatService) + protected readonly chatService: ChatService; + + @inject(AIActivationService) + protected readonly aiActivationService: AIActivationService; + + @inject(ChatInputHistoryService) + protected readonly historyService: ChatInputHistoryService; + + @inject(ChatRequestParser) + protected readonly chatRequestParser: ChatRequestParser; + + @inject(ContextFileValidationService) @optional() + protected readonly validationService: ContextFileValidationService | undefined; + + protected fileValidationState = new Map(); + + @inject(ContextKeyService) + protected readonly contextKeyService: ContextKeyService; + + protected navigationState: ChatInputNavigationState; + + protected editorRef: SimpleMonacoEditor | undefined = undefined; + protected readonly editorReady = new Deferred(); + + get editor(): SimpleMonacoEditor | undefined { + return this.editorRef; + } + + get inputConfiguration(): AIChatInputConfiguration | undefined { + return this.configuration; + } + + getPreviousPrompt(currentInput: string): string | undefined { + if (!this.navigationState) { + return undefined; + } + return this.navigationState.getPreviousPrompt(currentInput); + } + + getNextPrompt(): string | undefined { + if (!this.navigationState) { + return undefined; + } + return this.navigationState.getNextPrompt(); + } + + cycleMode(): void { + if (!this.receivingAgent || !this.receivingAgent.modes || this.receivingAgent.modes.length <= 1) { + return; + } + const currentIndex = this.receivingAgent.modes.findIndex(mode => mode.id === this.receivingAgent!.currentModeId); + const nextIndex = currentIndex === -1 ? 1 : (currentIndex + 1) % this.receivingAgent.modes.length; + this.receivingAgent = { + ...this.receivingAgent, + currentModeId: this.receivingAgent.modes[nextIndex].id + }; + this.update(); + } + + protected handleModeChange = (mode: string): void => { + if (this.receivingAgent) { + this.receivingAgent = { ...this.receivingAgent, currentModeId: mode }; + this.update(); + } + }; + + protected chatInputFocusKey: ContextKey; + protected chatInputFirstLineKey: ContextKey; + protected chatInputLastLineKey: ContextKey; + protected chatInputReceivingAgentKey: ContextKey; + protected chatInputHasModesKey: ContextKey; + + protected isEnabled = false; + protected heightInLines = 12; + + protected updateReceivingAgentTimeout: number | undefined; + protected receivingAgent: { + agentId: string; + modes: ChatMode[]; + currentModeId?: string; + } | undefined; + + protected _branch?: ChatHierarchyBranch; + set branch(branch: ChatHierarchyBranch | undefined) { + if (this._branch !== branch) { + this._branch = branch; + this.update(); + } + } + + protected _onQuery: Query; + set onQuery(query: Query) { + this._onQuery = (prompt: string, mode?: string) => { + if (this.configuration?.enablePromptHistory !== false && prompt.trim()) { + this.historyService.addToHistory(prompt); + this.navigationState.stopNavigation(); + } + return query(prompt, mode); + }; + } + protected _onUnpin: Unpin; + set onUnpin(unpin: Unpin) { + this._onUnpin = unpin; + } + protected _onCancel: Cancel; + set onCancel(cancel: Cancel) { + this._onCancel = cancel; + } + protected _onDeleteChangeSet: DeleteChangeSet; + set onDeleteChangeSet(deleteChangeSet: DeleteChangeSet) { + this._onDeleteChangeSet = deleteChangeSet; + } + protected _onDeleteChangeSetElement: DeleteChangeSetElement; + set onDeleteChangeSetElement(deleteChangeSetElement: DeleteChangeSetElement) { + this._onDeleteChangeSetElement = deleteChangeSetElement; + } + + protected _initialValue?: string; + set initialValue(value: string | undefined) { + this._initialValue = value; + } + + protected onDisposeForChatModel = new DisposableCollection(); + protected _chatModel: ChatModel; + set chatModel(chatModel: ChatModel) { + this.onDisposeForChatModel.dispose(); + this.onDisposeForChatModel = new DisposableCollection(); + this.onDisposeForChatModel.push(chatModel.onDidChange(event => { + if (event.kind === 'addVariable') { + // Validate files added via any path (including LLM tool calls) + // Get the current variables and validate any new file variables + const variables = chatModel.context.getVariables(); + variables.forEach(variable => { + if (variable.variable.name === 'file' && variable.arg) { + const pathKey = variable.arg; // Use the original path as the key + // Revalidate the file each time someone (User or LLM) adds it to the context, + // as the state may change over time. + if (this.validationService) { + this.validationService.validateFile(pathKey).then(result => { + this.fileValidationState.set(pathKey, result); + this.update(); + }); + } + } + }); + this.update(); + } else if (event.kind === 'addRequest') { + // Only clear image context variables, preserve other context (e.g., attached files) + // Never clear on parse failure. + const variables = chatModel.context.getVariables(); + const imageIndices = variables + .map((v, i) => { + const origin = ImageContextVariable.getOriginSafe(v); + return origin === 'temporary' ? i : -1; + }) + .filter(i => i !== -1); + if (imageIndices.length > 0) { + chatModel.context.deleteVariables(...imageIndices); + } + this.update(); + } else if (event.kind === 'removeVariable' || event.kind === 'changeHierarchyBranch') { + this.update(); + } + })); + this._chatModel = chatModel; + this.scheduleUpdateReceivingAgent(); + this.update(); + } + protected _pinnedAgent: ChatAgent | undefined; + set pinnedAgent(pinnedAgent: ChatAgent | undefined) { + this._pinnedAgent = pinnedAgent; + this.scheduleUpdateReceivingAgent(); + this.update(); + } + + protected onDidResizeEmitter = new Emitter(); + readonly onDidResize = this.onDidResizeEmitter.event; + + @postConstruct() + protected init(): void { + this.id = AIChatInputWidget.ID; + this.title.closable = false; + this.toDispose.push(this.resources.add(this.getResourceUri(), '')); + this.toDispose.push(this.aiActivationService.onDidChangeActiveStatus(() => { + this.setEnabled(this.aiActivationService.isActive); + })); + this.toDispose.push(this.onDidResizeEmitter); + this.toDispose.push(Disposable.create(() => { + if (this.updateReceivingAgentTimeout !== undefined) { + clearTimeout(this.updateReceivingAgentTimeout); + this.updateReceivingAgentTimeout = undefined; + } + })); + this.setEnabled(this.aiActivationService.isActive); + this.historyService.init().then(() => { + this.navigationState = new ChatInputNavigationState(this.historyService); + }); + this.initializeContextKeys(); + this.update(); + } + + protected initializeContextKeys(): void { + this.chatInputFocusKey = this.contextKeyService.createKey('chatInputFocus', false); + this.chatInputFirstLineKey = this.contextKeyService.createKey('chatInputFirstLine', false); + this.chatInputLastLineKey = this.contextKeyService.createKey('chatInputLastLine', false); + this.chatInputReceivingAgentKey = this.contextKeyService.createKey('chatInputReceivingAgent', ''); + this.chatInputHasModesKey = this.contextKeyService.createKey('chatInputHasModes', false); + } + + updateCursorPositionKeys(): void { + if (!this.editorRef) { + this.chatInputFirstLineKey.set(false); + this.chatInputLastLineKey.set(false); + return; + } + + const editor = this.editorRef.getControl(); + const position = editor.getPosition(); + const model = editor.getModel(); + + if (!position || !model) { + this.chatInputFirstLineKey.set(false); + this.chatInputLastLineKey.set(false); + return; + } + + const line = position.lineNumber; + const col = position.column; + + const topAtPos = editor.getTopForPosition(line, col); + const topAtLineStart = editor.getTopForLineNumber(line); + const topAtLineEnd = editor.getTopForPosition(line, model.getLineMaxColumn(line)); + const lineHeight = editor.getOption(EditorOption.lineHeight); + const toleranceValue = 0.5; + + const isFirstVisualOfThisLine = Math.abs(topAtPos - topAtLineStart) < toleranceValue; + const isLastVisualOfThisLine = Math.abs(topAtPos - topAtLineEnd) < toleranceValue || (topAtPos > topAtLineEnd - lineHeight + toleranceValue); + const isFirstVisualOverall = line === 1 && isFirstVisualOfThisLine; + + const isLastVisualOverall = line === model.getLineCount() && isLastVisualOfThisLine; + + this.chatInputFirstLineKey.set(isFirstVisualOverall); + this.chatInputLastLineKey.set(isLastVisualOverall); + } + + protected scheduleUpdateReceivingAgent(): void { + if (this.updateReceivingAgentTimeout !== undefined) { + clearTimeout(this.updateReceivingAgentTimeout); + } + this.updateReceivingAgentTimeout = window.setTimeout(() => { + this.updateReceivingAgent(); + this.updateReceivingAgentTimeout = undefined; + }, 200); + } + + protected async updateReceivingAgent(): Promise { + if (!this.editorRef || !this._chatModel) { + if (this.receivingAgent !== undefined) { + this.chatInputReceivingAgentKey.set(''); + this.chatInputHasModesKey.set(false); + this.receivingAgent = undefined; + this.update(); + } + return; + } + + try { + const inputText = this.editorRef.getControl().getValue(); + const request = { text: inputText }; + const resolvedContext = { variables: [] }; + const parsedRequest = await this.chatRequestParser.parseChatRequest(request, this._chatModel.location, resolvedContext); + const session = this.chatService.getSessions().find(s => s.model.id === this._chatModel.id); + if (session) { + const agent = this.chatService.getAgent(parsedRequest, session); + const agentId = agent?.id ?? ''; + const previousAgentId = this.receivingAgent?.agentId; + + this.chatInputReceivingAgentKey.set(agentId); + + // Only update and re-render when the agent changes + if (agent && agentId !== previousAgentId) { + const modes = agent.modes ?? []; + const defaultMode = modes.find(m => m.isDefault); + const initialModeId = defaultMode?.id; + this.receivingAgent = { + agentId: agentId, + modes, + currentModeId: initialModeId + }; + this.chatInputHasModesKey.set(modes.length > 1); + this.update(); + } else if (!agent && this.receivingAgent !== undefined) { + this.receivingAgent = undefined; + this.chatInputHasModesKey.set(false); + this.update(); + } + } else if (this.receivingAgent !== undefined) { + this.chatInputReceivingAgentKey.set(''); + this.chatInputHasModesKey.set(false); + this.receivingAgent = undefined; + this.update(); + } + } catch (error) { + console.warn('Failed to determine receiving agent:', error); + if (this.receivingAgent !== undefined) { + this.chatInputReceivingAgentKey.set(''); + this.chatInputHasModesKey.set(false); + this.receivingAgent = undefined; + this.update(); + } + } + } + + protected setupEditorEventListeners(): void { + if (!this.editorRef) { + return; + } + + const editor = this.editorRef.getControl(); + + this.toDispose.push(editor.onDidFocusEditorWidget(() => { + this.chatInputFocusKey.set(true); + this.updateCursorPositionKeys(); + })); + + this.toDispose.push(editor.onDidBlurEditorWidget(() => { + this.chatInputFocusKey.set(false); + this.chatInputFirstLineKey.set(false); + this.chatInputLastLineKey.set(false); + })); + + this.toDispose.push(editor.onDidChangeCursorPosition(() => { + if (editor.hasWidgetFocus()) { + this.updateCursorPositionKeys(); + } + })); + + this.toDispose.push(editor.onDidChangeModelContent(() => { + if (editor.hasWidgetFocus()) { + this.updateCursorPositionKeys(); + } + this.scheduleUpdateReceivingAgent(); + })); + + if (editor.hasWidgetFocus()) { + this.chatInputFocusKey.set(true); + this.updateCursorPositionKeys(); + } + } + + protected override onActivateRequest(msg: Message): void { + super.onActivateRequest(msg); + this.editorReady.promise.then(() => { + if (this.editorRef) { + this.editorRef.focus(); + } + }); + } + + protected async handleAgentCompletion(request: ChatRequestModel): Promise { + try { + const agentId = request.agentId; + + if (agentId) { + await this.agentNotificationService.showCompletionNotification(agentId); + } + } catch (error) { + console.error('Failed to handle agent completion notification:', error); + } + } + + protected getResourceUri(): URI { + return new URI(`ai-chat:/input.${CHAT_VIEW_LANGUAGE_EXTENSION}`); + } + + protected render(): React.ReactNode { + const branch = this._branch; + const chatModel = this._chatModel; + + // State of the input widget's action buttons depends on the state of the currently active or last processed + // request, if there is one. If the chat model has branched, then the current request is the last on the + // branch. Otherwise, it's the last request in the chat model. + const currentRequest: ChatRequestModel | undefined = branch?.items?.at(-1)?.element ?? chatModel.getRequests().at(-1); + const isEditing = !!(currentRequest && (EditableChatRequestModel.isEditing(currentRequest))); + const isPending = () => !!(currentRequest && !isEditing && ChatRequestModel.isInProgress(currentRequest)); + const pending = isPending(); + + return ( + { + this.editorRef = editor; + this.setupEditorEventListeners(); + this.editorReady.resolve(); + this.scheduleUpdateReceivingAgent(); + }} + showContext={this.configuration?.showContext} + showPinnedAgent={this.configuration?.showPinnedAgent} + showChangeSet={this.configuration?.showChangeSet} + showSuggestions={this.configuration?.showSuggestions} + hasPromptHistory={this.configuration?.enablePromptHistory} + labelProvider={this.labelProvider} + actionService={this.changeSetActionService} + decoratorService={this.changeSetDecoratorService} + initialValue={this._initialValue} + openerService={this.openerService} + suggestions={this._chatModel.suggestions} + currentRequest={currentRequest} + isEditing={isEditing} + pending={pending} + heightInLines={this.heightInLines} + onResponseChanged={() => { + if (isPending() !== pending) { + this.update(); + } + }} + onResize={() => this.onDidResizeEmitter.fire()} + modeSelectorProps={{ + receivingAgentModes: this.receivingAgent?.modes, + currentMode: this.receivingAgent?.currentModeId, + onModeChange: this.handleModeChange, + }} + /> + ); + } + + protected onDragOver(event: React.DragEvent): void { + event.preventDefault(); + event.stopPropagation(); + this.node.classList.add('drag-over'); + if (event.dataTransfer?.types.includes('text/plain')) { + event.dataTransfer!.dropEffect = 'copy'; + } else { + event.dataTransfer!.dropEffect = 'link'; + } + } + + protected onDrop(event: React.DragEvent): void { + event.preventDefault(); + event.stopPropagation(); + this.node.classList.remove('drag-over'); + const dataTransferText = event.dataTransfer?.getData('text/plain'); + const position = this.editorRef?.getControl().getTargetAtClientPoint(event.clientX, event.clientY)?.position; + this.variableService.getDropResult(event.nativeEvent, { type: 'ai-chat-input-widget' }).then(result => { + result.variables.forEach(variable => this.addContext(variable)); + const text = result.text ?? dataTransferText; + if (position && text) { + this.editorRef?.getControl().executeEdits('drag-and-drop', [{ + range: { + startLineNumber: position.lineNumber, + startColumn: position.column, + endLineNumber: position.lineNumber, + endColumn: position.column + }, + text + }]); + } + }); + } + + protected onPaste(event: ClipboardEvent): void { + this.variableService.getPasteResult(event, { type: 'ai-chat-input-widget' }).then(result => { + result.variables.forEach(variable => this.addContext(variable)); + if (result.text) { + const position = this.editorRef?.getControl().getPosition(); + if (position && result.text) { + this.editorRef?.getControl().executeEdits('paste', [{ + range: { + startLineNumber: position.lineNumber, + startColumn: position.column, + endLineNumber: position.lineNumber, + endColumn: position.column + }, + text: result.text + }]); + } + } + }); + } + + protected onEscape(): void { + const currentRequest = this._branch?.items?.at(-1)?.element ?? this._chatModel.getRequests().at(-1); + if (currentRequest && !EditableChatRequestModel.isEditing(currentRequest) && ChatRequestModel.isInProgress(currentRequest)) { + this._onCancel(currentRequest); + } + } + + protected async openContextElement(request: AIVariableResolutionRequest): Promise { + // Re-validate file before opening + if (request.variable.name === 'file' && request.arg) { + if (this.validationService) { + const result = await this.validationService.validateFile(request.arg); + this.fileValidationState.set(request.arg, result); + this.update(); + } + } + const session = this.chatService.getSessions().find(candidate => candidate.model.id === this._chatModel.id); + const context = { session }; + await this.variableService.open(request, context); + } + + public setEnabled(enabled: boolean): void { + this.isEnabled = enabled; + this.update(); + } + + protected addContextElement(): void { + this.contextVariablePicker.pickContextVariable().then(contextElement => { + if (contextElement) { + this.addContext(contextElement); + } + }); + } + + protected deleteContextElement(index: number): void { + this._chatModel.context.deleteVariables(index); + } + + protected handleContextMenu(event: IMouseEvent): void { + this.contextMenuRenderer.render({ + menuPath: AIChatInputWidget.CONTEXT_MENU, + anchor: { x: event.posx, y: event.posy }, + context: event.target, + args: [this.editorRef] + }); + event.preventDefault(); + } + + addContext(variable: AIVariableResolutionRequest): void { + // Validation happens in the chatModel.onDidChange listener + this._chatModel.context.addVariables(variable); + } + + protected getContext(): readonly AIVariableResolutionRequest[] { + return this._chatModel.context.getVariables(); + } +} + +interface ChatInputProperties { + branch?: ChatHierarchyBranch; + onCancel: (requestModel: ChatRequestModel) => void; + onQuery: (query: string, mode?: string) => void; + onUnpin: () => void; + onDragOver: (event: React.DragEvent) => void; + onDrop: (event: React.DragEvent) => void; + onPaste: (event: ClipboardEvent) => void; + onDeleteChangeSet: (sessionId: string) => void; + onDeleteChangeSetElement: (sessionId: string, uri: URI) => void; + onAddContextElement: () => void; + onDeleteContextElement: (index: number) => void; + onEscape: () => void; + onOpenContextElement: OpenContextElement; + onAgentCompletion: (request: ChatRequestModel) => void; + context?: readonly AIVariableResolutionRequest[]; + fileValidationState: Map; + isEnabled?: boolean; + chatModel: ChatModel; + pinnedAgent?: ChatAgent; + editorProvider: MonacoEditorProvider; + uri: URI; + contextMenuCallback: (event: IMouseEvent) => void; + setEditorRef: (editor: SimpleMonacoEditor | undefined) => void; + showContext?: boolean; + showPinnedAgent?: boolean; + showChangeSet?: boolean; + showSuggestions?: boolean; + hasPromptHistory?: boolean; + labelProvider: LabelProvider; + actionService: ChangeSetActionService; + decoratorService: ChangeSetDecoratorService; + initialValue?: string; + openerService: OpenerService; + suggestions: readonly ChatSuggestion[]; + currentRequest?: ChatRequestModel; + isEditing: boolean; + pending: boolean; + heightInLines?: number; + onResponseChanged: () => void; + onResize: () => void; + modeSelectorProps: { + receivingAgentModes?: ChatMode[]; + currentMode?: string; + onModeChange: (mode: string) => void; + } +} + +// Utility to check if we have task context in the chat model +const hasTaskContext = (chatModel: ChatModel): boolean => chatModel.context.getVariables().some(variable => + variable.variable?.id === TASK_CONTEXT_VARIABLE.id +); + +const ChatInput: React.FunctionComponent = (props: ChatInputProperties) => { + const onDeleteChangeSet = () => props.onDeleteChangeSet(props.chatModel.id); + const onDeleteChangeSetElement = (uri: URI) => props.onDeleteChangeSetElement(props.chatModel.id, uri); + + const [isInputEmpty, setIsInputEmpty] = React.useState(true); + const [isInputFocused, setIsInputFocused] = React.useState(false); + const [placeholderText, setPlaceholderText] = React.useState(''); + const [changeSetUI, setChangeSetUI] = React.useState( + () => buildChangeSetUI( + props.chatModel.changeSet, + props.labelProvider, + props.decoratorService, + props.actionService.getActionsForChangeset(props.chatModel.changeSet), + onDeleteChangeSet, + onDeleteChangeSetElement + )); + + // eslint-disable-next-line no-null/no-null + const editorContainerRef = React.useRef(null); + // eslint-disable-next-line no-null/no-null + const placeholderRef = React.useRef(null); + const editorRef = React.useRef(undefined); + // eslint-disable-next-line no-null/no-null + const containerRef = React.useRef(null); + + // On the first request of the chat, if the chat has a task context and a pinned + // agent, show a "Perform this task." placeholder which is the message to send by default + const isFirstRequest = props.chatModel.getRequests().length === 0; + const shouldUseTaskPlaceholder = isFirstRequest && props.pinnedAgent && hasTaskContext(props.chatModel); + const taskPlaceholder = nls.localize('theia/ai/chat-ui/performThisTask', 'Perform this task.'); + + // Update placeholder text when focus state or other dependencies change + React.useEffect(() => { + const newPlaceholderText = !props.isEnabled + ? nls.localize('theia/ai/chat-ui/aiDisabled', 'AI features are disabled') + : shouldUseTaskPlaceholder + ? taskPlaceholder + // eslint-disable-next-line max-len + : nls.localize('theia/ai/chat-ui/askQuestion', 'Ask a question') + (props.hasPromptHistory && isInputFocused ? nls.localizeByDefault(' ({0} for history)', '⇅') : ''); + setPlaceholderText(newPlaceholderText); + }, [props.isEnabled, shouldUseTaskPlaceholder, taskPlaceholder, props.hasPromptHistory, isInputFocused]); + + // Handle paste events on the container + const handlePaste = React.useCallback((event: ClipboardEvent) => { + props.onPaste(event); + }, [props.onPaste]); + + // Set up paste handler on the container div + React.useEffect(() => { + const container = containerRef.current; + if (container) { + container.addEventListener('paste', handlePaste, true); + return () => { + container.removeEventListener('paste', handlePaste, true); + }; + } + return undefined; + }, [handlePaste]); + + React.useEffect(() => { + const uri = props.uri; + const createInputElement = async () => { + const paddingTop = 6; + const lineHeight = 20; + const maxHeightPx = (props.heightInLines ?? 12) * lineHeight; + + const editor = await props.editorProvider.createSimpleInline(uri, editorContainerRef.current!, { + language: CHAT_VIEW_LANGUAGE_EXTENSION, + // Disable code lens, inlay hints and hover support to avoid console errors from other contributions + codeLens: false, + inlayHints: { enabled: 'off' }, + hover: { enabled: false }, + autoSizing: false, // we handle the sizing ourselves + scrollBeyondLastLine: false, + scrollBeyondLastColumn: 0, + minHeight: 1, + fontFamily: 'var(--theia-ui-font-family)', + fontSize: 13, + cursorWidth: 1, + maxHeight: -1, + scrollbar: { horizontal: 'hidden', alwaysConsumeMouseWheel: false, handleMouseWheel: true }, + automaticLayout: true, + lineNumbers: 'off', + lineHeight, + padding: { top: paddingTop }, + suggest: { + showIcons: true, + showSnippets: false, + showWords: false, + showStatusBar: false, + insertMode: 'replace', + }, + bracketPairColorization: { enabled: false }, + wrappingStrategy: 'advanced', + stickyScroll: { enabled: false }, + ariaLabel: nls.localize('theia/ai/chat-ui/chatInputAriaLabel', 'Type your message here'), + }); + + if (editorContainerRef.current) { + editorContainerRef.current.style.overflowY = 'auto'; // ensure vertical scrollbar + editorContainerRef.current.style.height = (lineHeight + (2 * paddingTop)) + 'px'; + + editorContainerRef.current.addEventListener('wheel', e => { + // Prevent parent from scrolling + e.stopPropagation(); + }, { passive: false }); + } + + const updateEditorHeight = () => { + if (editorContainerRef.current) { + const contentHeight = editor.getControl().getContentHeight() + paddingTop; + editorContainerRef.current.style.height = `${Math.min(contentHeight, maxHeightPx)}px`; + } + }; + + editor.getControl().onDidChangeModelContent(() => { + const value = editor.getControl().getValue(); + setIsInputEmpty(!value || value.length === 0); + updateEditorHeight(); + handleOnChange(); + }); + const resizeObserver = new ResizeObserver(() => { + updateEditorHeight(); + props.onResize(); + }); + if (editorContainerRef.current) { + resizeObserver.observe(editorContainerRef.current); + } + editor.getControl().onDidDispose(() => { + resizeObserver.disconnect(); + }); + + editor.getControl().onContextMenu(e => + props.contextMenuCallback(e.event) + ); + + const updateLineCounts = () => { + // We need the line numbers to allow scrolling by using the keyboard + const model = editor.getControl().getModel()!; + const lineCount = model.getLineCount(); + const decorations: IModelDeltaDecoration[] = []; + + for (let lineNumber = 1; lineNumber <= lineCount; lineNumber++) { + decorations.push({ + range: new Range(lineNumber, 1, lineNumber, 1), + options: { + description: `line-number-${lineNumber}`, + isWholeLine: false, + className: `line-number-${lineNumber}`, + } + }); + } + + const lineNumbers = model.getAllDecorations().filter(predicate => predicate.options.description?.startsWith('line-number-')); + editor.getControl().removeDecorations(lineNumbers.map(d => d.id)); + editor.getControl().createDecorationsCollection(decorations); + }; + + editor.getControl().getModel()?.onDidChangeContent(() => { + updateLineCounts(); + }); + + editor.getControl().onDidChangeCursorPosition(e => { + const lineNumber = e.position.lineNumber; + const line = editor.getControl().getDomNode()?.querySelector(`.line-number-${lineNumber}`); + line?.scrollIntoView({ behavior: 'instant', block: 'nearest' }); + }); + + editorRef.current = editor; + props.setEditorRef(editor); + + if (props.initialValue) { + setValue(props.initialValue); + } + + updateLineCounts(); + }; + createInputElement(); + + return () => { + props.setEditorRef(undefined); + if (editorRef.current) { + editorRef.current.dispose(); + } + }; + }, []); + + React.useEffect(() => { + setChangeSetUI(buildChangeSetUI( + props.chatModel.changeSet, + props.labelProvider, + props.decoratorService, + props.actionService.getActionsForChangeset(props.chatModel.changeSet), + onDeleteChangeSet, + onDeleteChangeSetElement + )); + const listener = props.chatModel.onDidChange(event => { + if (ChatChangeEvent.isChangeSetEvent(event)) { + setChangeSetUI(buildChangeSetUI( + props.chatModel.changeSet, + props.labelProvider, + props.decoratorService, + props.actionService.getActionsForChangeset(props.chatModel.changeSet), + onDeleteChangeSet, + onDeleteChangeSetElement + )); + } + if (event.kind === 'addRequest') { + // Listen for when this request's response becomes complete + const responseListener = event.request.response.onDidChange(() => { + if (event.request.response.isComplete) { + props.onAgentCompletion(event.request); + responseListener.dispose(); // Clean up the listener once notification is sent + } + }); + } + }); + return () => { + listener.dispose(); + }; + }, [props.chatModel, props.labelProvider, props.decoratorService, props.actionService]); + + React.useEffect(() => { + const disposable = props.actionService.onDidChange(() => { + const newActions = props.actionService.getActionsForChangeset(props.chatModel.changeSet); + setChangeSetUI(current => !current ? current : { ...current, actions: newActions }); + }); + return () => disposable.dispose(); + }, [props.actionService, props.chatModel.changeSet]); + + React.useEffect(() => { + const disposable = props.decoratorService.onDidChangeDecorations(() => { + setChangeSetUI(buildChangeSetUI( + props.chatModel.changeSet, + props.labelProvider, + props.decoratorService, + props.actionService.getActionsForChangeset(props.chatModel.changeSet), + onDeleteChangeSet, + onDeleteChangeSetElement + )); + }); + return () => disposable.dispose(); + }); + + const setValue = React.useCallback((value: string) => { + if (editorRef.current && !editorRef.current.document.isDisposed()) { + editorRef.current.document.textEditorModel.setValue(value); + } + }, [editorRef]); + + // Without user input, if we can default to "Perform this task.", do so + const submit = React.useCallback(function submit(value: string): void { + let effectiveValue = value; + if ((!value || value.trim().length === 0) && shouldUseTaskPlaceholder) { + effectiveValue = taskPlaceholder; + } + if (!effectiveValue || effectiveValue.trim().length === 0) { + return; + } + props.onQuery(effectiveValue, props.modeSelectorProps.currentMode); + setValue(''); + if (editorRef.current && !editorRef.current.document.textEditorModel.isDisposed()) { + editorRef.current.document.textEditorModel.setValue(''); + editorRef.current.focus(); + } + }, [props.context, props.onQuery, props.modeSelectorProps.currentMode, setValue, shouldUseTaskPlaceholder, taskPlaceholder]); + + const onKeyDown = React.useCallback((event: React.KeyboardEvent) => { + if (!props.isEnabled) { + return; + } + if (event.key === 'Enter' && !event.shiftKey) { + event.preventDefault(); + // On Enter, read input and submit (handles task context) + const currentValue = editorRef.current?.document.textEditorModel.getValue() || ''; + submit(currentValue); + } else if (event.key === 'Escape') { + event.preventDefault(); + props.onEscape(); + } + }, [props.isEnabled, submit]); + + const handleInputFocus = () => { + setIsInputFocused(true); + hidePlaceholderIfEditorFilled(); + }; + + const handleOnChange = () => { + showPlaceholderIfEditorEmpty(); + hidePlaceholderIfEditorFilled(); + }; + + const handleInputBlur = () => { + setIsInputFocused(false); + showPlaceholderIfEditorEmpty(); + }; + + const showPlaceholderIfEditorEmpty = () => { + if (!editorRef.current?.getControl().getValue()) { + placeholderRef.current?.classList.remove('hidden'); + } + }; + + const hidePlaceholderIfEditorFilled = () => { + const value = editorRef.current?.getControl().getValue(); + if (value && value.length > 0) { + placeholderRef.current?.classList.add('hidden'); + } + }; + + const handlePin = () => { + if (editorRef.current) { + editorRef.current.getControl().getModel()?.applyEdits([{ + range: { + startLineNumber: 1, + startColumn: 1, + endLineNumber: 1, + endColumn: 1 + }, + text: '@', + }]); + editorRef.current.getControl().setPosition({ lineNumber: 1, column: 2 }); + editorRef.current.getControl().getAction('editor.action.triggerSuggest')?.run(); + } + }; + + const leftOptions = [ + ...(props.showContext + ? [{ + title: nls.localize('theia/ai/chat-ui/attachToContext', 'Attach elements to context'), + handler: () => props.onAddContextElement(), + className: 'codicon-add', + disabled: !props.isEnabled + }] + : []), + ...(props.showPinnedAgent + ? [{ + title: props.pinnedAgent ? nls.localize('theia/ai/chat-ui/unpinAgent', 'Unpin Agent') : nls.localize('theia/ai/chat-ui/agent', 'Agent'), + handler: props.pinnedAgent ? props.onUnpin : handlePin, + className: 'at-icon', + disabled: !props.isEnabled, + text: { + align: 'right', + content: props.pinnedAgent && props.pinnedAgent.name + }, + }] + : []), + ] as Option[]; + + let rightOptions: Option[] = []; + const { currentRequest: latestRequest, isEditing, pending, onResponseChanged } = props; + React.useEffect(() => { + if (!latestRequest) { + return; + } + const disposable = latestRequest.response.onDidChange(onResponseChanged); + return () => disposable.dispose(); + }, [latestRequest, onResponseChanged]); + if (isEditing) { + rightOptions = [{ + title: nls.localize('theia/ai/chat-ui/send', 'Send (Enter)'), + handler: () => { + if (props.isEnabled) { + submit(editorRef.current?.document.textEditorModel.getValue() || ''); + } + }, + className: 'codicon-send', + disabled: (isInputEmpty && !shouldUseTaskPlaceholder) || !props.isEnabled + }]; + } else if (pending) { + rightOptions = [{ + title: nls.localize('theia/ai/chat-ui/cancel', 'Cancel (Esc)'), + handler: () => { + if (latestRequest) { + props.onCancel(latestRequest); + } + }, + className: 'codicon-stop-circle' + }]; + } else { + rightOptions = [{ + title: nls.localize('theia/ai/chat-ui/send', 'Send (Enter)'), + handler: () => { + if (props.isEnabled) { + submit(editorRef.current?.document.textEditorModel.getValue() || ''); + } + }, + className: 'codicon-send', + disabled: (isInputEmpty && !shouldUseTaskPlaceholder) || !props.isEnabled + }]; + } + + const contextUI = buildContextUI(props.context, props.labelProvider, props.onDeleteContextElement, props.onOpenContextElement, props.fileValidationState); + + // Show mode selector if agent has multiple modes + const showModeSelector = (props.modeSelectorProps.receivingAgentModes?.length ?? 0) > 1; + + return ( +
+ {props.showSuggestions !== false && } + {props.showChangeSet && changeSetUI?.elements && + + } +
+
+
{placeholderText}
+
+ {props.context && props.context.length > 0 && + + } + +
+
+ ); +}; + +interface ChatInputOptionsProps { + leftOptions: Option[]; + rightOptions: Option[]; + isEnabled?: boolean; + modeSelectorProps: { + show: boolean; + modes?: ChatMode[]; + currentMode?: string; + onModeChange: (mode: string) => void; + }; +} + +const ChatInputOptions: React.FunctionComponent = ({ + leftOptions, + rightOptions, + isEnabled, + modeSelectorProps +}) => ( + // Right options are rendered first in DOM for tab order (send button first when enabled) + // CSS order property positions them visually (left on left, right on right) +
+
+ {rightOptions.map((option, index) => ( + { + if (e.key === 'Enter' || e.key === ' ') { + e.preventDefault(); + option.handler(); + } + }} + > + {option.text?.content} + + + ))} +
+
+ {leftOptions.map((option, index) => ( + { + if (e.key === 'Enter' || e.key === ' ') { + e.preventDefault(); + option.handler(); + } + }} + > + {option.text?.content} + + + ))} + {modeSelectorProps.show && modeSelectorProps.modes && ( + + )} +
+
+); + +interface ChatModeSelectorProps { + modes: ChatMode[]; + currentMode?: string; + onModeChange: (mode: string) => void; + disabled?: boolean; +} + +const ChatModeSelector: React.FunctionComponent = React.memo(({ modes, currentMode, onModeChange, disabled }) => ( + +)); + +const noPropagation = (handler: () => void) => (e: React.MouseEvent) => { + handler(); + e.stopPropagation(); +}; + +const buildChangeSetUI = ( + changeSet: ChangeSet, + labelProvider: LabelProvider, + decoratorService: ChangeSetDecoratorService, + actions: ChangeSetActionRenderer[], + onDeleteChangeSet: () => void, + onDeleteChangeSetElement: (uri: URI) => void +): ChangeSetUI | undefined => { + const elements = changeSet.getElements(); + return elements.length ? ({ + title: changeSet.title, + changeSet, + deleteChangeSet: onDeleteChangeSet, + elements: changeSet.getElements().map(element => toUiElement(element, onDeleteChangeSetElement, labelProvider, decoratorService)), + actions + }) : undefined; +}; + +interface ChangeSetUIElement { + name: string; + uri: string; + iconClass: string; + nameClass: string; + additionalInfo: string; + additionalInfoSuffixIcon?: string[]; + open?: () => void; + openChange?: () => void; + apply?: () => void; + revert?: () => void; + delete: () => void; +} + +interface ChangeSetUI { + changeSet: ChangeSet; + title: string; + deleteChangeSet: () => void; + elements: ChangeSetUIElement[]; + actions: ChangeSetActionRenderer[]; +} + +/** Memo because the parent element rerenders on every key press in the chat widget. */ +const ChangeSetBox: React.FunctionComponent<{ changeSet: ChangeSetUI }> = React.memo(({ changeSet: { changeSet, title, deleteChangeSet, elements, actions } }) => { + const [isCollapsed, setIsCollapsed] = React.useState(false); + + const toggleCollapse = React.useCallback(() => { + setIsCollapsed(prev => !prev); + }, []); + + const handleToggleKeyDown = React.useCallback( + (e: React.KeyboardEvent) => { + if (e.key === 'Enter' || e.key === ' ') { + e.preventDefault(); + toggleCollapse(); + } + }, + [toggleCollapse] + ); + + return ( +
+
+
+ +

{title}

+
+
+ {actions.map(action => ( +
+ {action.render(changeSet)} +
+ ))} + deleteChangeSet()} + /> +
+
+
+
    + {elements.map(element => ChangeSetElement(element))} +
+
+
+ ); +}); + +function toUiElement(element: ChangeSetElement, + onDeleteChangeSetElement: (uri: URI) => void, + labelProvider: LabelProvider, + decoratorService: ChangeSetDecoratorService +): ChangeSetUIElement { + return ({ + open: element.open?.bind(element), + uri: element.uri.toString(), + iconClass: element.icon ?? labelProvider.getIcon(element.uri) ?? labelProvider.fileIcon, + nameClass: `${element.type} ${element.state}`, + name: element.name ?? labelProvider.getName(element.uri), + additionalInfo: element.additionalInfo ?? labelProvider.getDetails(element.uri), + additionalInfoSuffixIcon: decoratorService.getAdditionalInfoSuffixIcon(element), + openChange: element?.openChange?.bind(element), + apply: element.state !== 'applied' ? element?.apply?.bind(element) : undefined, + revert: element.state === 'applied' || element.state === 'stale' ? element?.revert?.bind(element) : undefined, + delete: () => onDeleteChangeSetElement(element.uri) + } satisfies ChangeSetUIElement); +} + +const ChangeSetElement: React.FC = element => ( +
  • element.openChange?.()}> +
    +
    +
    + + {element.name} + +
    + {element.additionalInfo && {element.additionalInfo}} + {element.additionalInfoSuffixIcon + &&
    } +
    +
    +
    + {element.open && ( + element.open!())} + />)} + {element.revert && ( + element.revert!())} + />)} + {element.apply && ( + element.apply!())} + />)} + element.delete())} /> +
    +
  • +); + +interface Option { + title: string; + handler: () => void; + className: string; + disabled?: boolean; + text?: { + align?: 'left' | 'right'; + content: string; + }; +} + +function buildContextUI( + context: readonly AIVariableResolutionRequest[] | undefined, + labelProvider: LabelProvider, + onDeleteContextElement: (index: number) => void, + onOpen: OpenContextElement, + fileValidationState: Map +): ChatContextUI { + if (!context) { + return { context: [] }; + } + return { + context: context.map((element, index) => { + // Check if this is an invalid file + let className: string | undefined; + let validationMessage: string | undefined; + if (element.variable.name === 'file' && element.arg) { + // Use the path directly as the key (same as storage) + const validationResult = fileValidationState.get(element.arg); + if (validationResult) { + if (validationResult.state === FileValidationState.INVALID_SECONDARY) { + className = 'warning-file'; + validationMessage = validationResult.message; + } else if (validationResult.state === FileValidationState.INVALID_NOT_FOUND) { + className = 'invalid-file'; + validationMessage = validationResult.message; + } + } + } + return { + variable: element, + name: labelProvider.getName(element), + iconClass: labelProvider.getIcon(element), + nameClass: element.variable.name, + className, + validationMessage, + additionalInfo: labelProvider.getDetails(element), + details: labelProvider.getLongName(element), + delete: () => onDeleteContextElement(index), + open: () => onOpen(element) + }; + }) + }; +} + +interface ChatContextUI { + context: { + variable: AIVariableResolutionRequest, + name: string; + iconClass: string; + nameClass: string; + className?: string; + validationMessage?: string; + additionalInfo?: string; + details?: string; + delete: () => void; + open?: () => void; + }[]; +} + +const ChatContext: React.FunctionComponent = ({ context }) => ( +
    +
      + {context.map((element, index) => { + if (ImageContextVariable.isImageContextRequest(element.variable)) { + let variable: ImageContextVariable | undefined; + try { + variable = ImageContextVariable.parseRequest(element.variable); + } catch { + variable = undefined; + } + + const title = variable?.name ?? variable?.wsRelativePath ?? element.details ?? element.name; + const label = variable?.name ?? variable?.wsRelativePath?.split('/').pop() ?? element.name; + + return
    • element.open?.()}> +
      +
      +
      + + {label} + + + {element.additionalInfo} + +
      + { e.stopPropagation(); element.delete(); }} /> +
      + {variable &&
      +
      + {variable.name +
      +
      } +
    • ; + } + const isWarning = element.className === 'warning-file'; + const isInvalid = element.className === 'invalid-file'; + const tooltipTitle = element.validationMessage ?? element.details; + return
    • element.open?.()}> +
      + {isWarning && } + {isInvalid && } +
      +
      + + {element.name} + + + {element.additionalInfo} + +
      + { e.stopPropagation(); element.delete(); }} /> +
      +
    • ; + })} +
    +
    +); diff --git a/packages/ai-chat-ui/src/browser/chat-node-toolbar-action-contribution.ts b/packages/ai-chat-ui/src/browser/chat-node-toolbar-action-contribution.ts new file mode 100644 index 0000000..dc37c47 --- /dev/null +++ b/packages/ai-chat-ui/src/browser/chat-node-toolbar-action-contribution.ts @@ -0,0 +1,116 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** +import { Command, nls } from '@theia/core'; +import { codicon } from '@theia/core/lib/browser'; +import { isRequestNode, RequestNode, ResponseNode } from './chat-tree-view'; +import { EditableChatRequestModel } from '@theia/ai-chat'; + +export interface ChatNodeToolbarAction { + /** + * The command to execute when the item is selected. The handler will receive the `RequestNode` or `ResponseNode` as first argument. + */ + commandId: string; + /** + * Icon class name(s) for the item (e.g. 'codicon codicon-feedback'). + */ + icon: string; + /** + * Priority among the items. Can be negative. The smaller the number the left-most the item will be placed in the toolbar. It is `0` by default. + */ + priority?: number; + /** + * Optional tooltip for the item. + */ + tooltip?: string; +} + +/** + * Clients implement this interface if they want to contribute to the toolbar of chat nodes. + * + * ### Example + * ```ts + * bind(ChatNodeToolbarActionContribution).toDynamicValue(context => ({ + * getToolbarActions: (args: RequestNode | ResponseNode) => { + * if (isResponseNode(args)) { + * return [{ + * commandId: 'core.about', + * icon: 'codicon codicon-feedback', + * tooltip: 'Show about dialog on response nodes' + * }]; + * } else { + * return []; + * } + * } + * })); + * ``` + */ +export const ChatNodeToolbarActionContribution = Symbol('ChatNodeToolbarActionContribution'); +export interface ChatNodeToolbarActionContribution { + /** + * Returns the toolbar actions for the given node. + */ + getToolbarActions(node: RequestNode | ResponseNode): ChatNodeToolbarAction[]; +} + +export namespace ChatNodeToolbarCommands { + const CHAT_NODE_TOOLBAR_CATEGORY = 'ChatNodeToolbar'; + const CHAT_NODE_TOOLBAR_CATEGORY_KEY = nls.getDefaultKey(CHAT_NODE_TOOLBAR_CATEGORY); + + export const EDIT = Command.toLocalizedCommand({ + id: 'chat:node:toolbar:edit-request', + category: CHAT_NODE_TOOLBAR_CATEGORY, + }, '', CHAT_NODE_TOOLBAR_CATEGORY_KEY); + + export const CANCEL = Command.toLocalizedCommand({ + id: 'chat:node:toolbar:cancel-request', + category: CHAT_NODE_TOOLBAR_CATEGORY, + }, '', CHAT_NODE_TOOLBAR_CATEGORY_KEY); + + export const RETRY = Command.toLocalizedCommand({ + id: 'chat:node:toolbar:retry-message', + category: CHAT_NODE_TOOLBAR_CATEGORY, + }, 'Retry', CHAT_NODE_TOOLBAR_CATEGORY_KEY); +} + +export class DefaultChatNodeToolbarActionContribution implements ChatNodeToolbarActionContribution { + getToolbarActions(node: RequestNode | ResponseNode): ChatNodeToolbarAction[] { + if (isRequestNode(node)) { + if (EditableChatRequestModel.isEditing(node.request)) { + return [{ + commandId: ChatNodeToolbarCommands.CANCEL.id, + icon: codicon('close'), + tooltip: nls.localizeByDefault('Cancel'), + }]; + } + return [{ + commandId: ChatNodeToolbarCommands.EDIT.id, + icon: codicon('edit'), + tooltip: nls.localizeByDefault('Edit'), + }]; + } else { + const shouldShowRetry = node.response.isError || node.response.isCanceled; + if (shouldShowRetry) { + return [{ + commandId: ChatNodeToolbarCommands.RETRY.id, + icon: codicon('refresh'), + tooltip: nls.localizeByDefault('Retry'), + priority: -1 // Higher priority to show it first + }]; + } + return []; + } + } +} diff --git a/packages/ai-chat-ui/src/browser/chat-progress-message.tsx b/packages/ai-chat-ui/src/browser/chat-progress-message.tsx new file mode 100644 index 0000000..145fd7e --- /dev/null +++ b/packages/ai-chat-ui/src/browser/chat-progress-message.tsx @@ -0,0 +1,40 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { ChatProgressMessage } from '@theia/ai-chat'; +import * as React from '@theia/core/shared/react'; + +export type ProgressMessageProps = Omit; + +export const ProgressMessage = (c: ProgressMessageProps) => ( +
    + {c.content} +
    +); + +export const Indicator = (progressMessage: ProgressMessageProps) => ( + + {progressMessage.status === 'inProgress' && + + } + {progressMessage.status === 'completed' && + + } + {progressMessage.status === 'failed' && + + } + +); diff --git a/packages/ai-chat-ui/src/browser/chat-response-part-renderer.ts b/packages/ai-chat-ui/src/browser/chat-response-part-renderer.ts new file mode 100644 index 0000000..1774380 --- /dev/null +++ b/packages/ai-chat-ui/src/browser/chat-response-part-renderer.ts @@ -0,0 +1,25 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { ChatResponseContent } from '@theia/ai-chat/lib/common'; +import { ReactNode } from '@theia/core/shared/react'; +import { ResponseNode } from './chat-tree-view/chat-view-tree-widget'; + +export const ChatResponsePartRenderer = Symbol('ChatResponsePartRenderer'); +export interface ChatResponsePartRenderer { + canHandle(response: ChatResponseContent): number; + render(response: T, parentNode: ResponseNode): ReactNode; +} diff --git a/packages/ai-chat-ui/src/browser/chat-response-renderer/ai-selection-resolver.ts b/packages/ai-chat-ui/src/browser/chat-response-renderer/ai-selection-resolver.ts new file mode 100644 index 0000000..be22b6b --- /dev/null +++ b/packages/ai-chat-ui/src/browser/chat-response-renderer/ai-selection-resolver.ts @@ -0,0 +1,144 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { CancellationToken, RecursivePartial, URI } from '@theia/core'; +import { inject, injectable } from '@theia/core/shared/inversify'; +import { EditorOpenerOptions, EditorWidget, Range } from '@theia/editor/lib/browser'; + +import { EditorSelectionResolver } from '@theia/editor/lib/browser/editor-manager'; +import { DocumentSymbol } from '@theia/monaco-editor-core/esm/vs/editor/common/languages'; +import { TextModel } from '@theia/monaco-editor-core/esm/vs/editor/common/model/textModel'; +import { ILanguageFeaturesService } from '@theia/monaco-editor-core/esm/vs/editor/common/services/languageFeatures'; +import { StandaloneServices } from '@theia/monaco-editor-core/esm/vs/editor/standalone/browser/standaloneServices'; +import { MonacoEditor } from '@theia/monaco/lib/browser/monaco-editor'; +import { MonacoToProtocolConverter } from '@theia/monaco/lib/browser/monaco-to-protocol-converter'; + +/** Regex to match GitHub-style position and range declaration with line (L) and column (C) */ +export const LOCATION_REGEX = /#L(\d+)?(?:C(\d+))?(?:-L(\d+)?(?:C(\d+))?)?$/; + +@injectable() +export class GitHubSelectionResolver implements EditorSelectionResolver { + priority = 100; + + async resolveSelection(widget: EditorWidget, options: EditorOpenerOptions, uri?: URI): Promise | undefined> { + if (!uri) { + return; + } + // We allow the GitHub syntax of selecting a range in markdown 'L1', 'L1-L2' 'L1-C1_L2-C2' (starting at line 1 and column 1) + const match = uri?.toString().match(LOCATION_REGEX); + if (!match) { + return; + } + // we need to adapt the position information from one-based (in GitHub) to zero-based (in Theia) + const startLine = match[1] ? parseInt(match[1], 10) - 1 : undefined; + // if no start column is given, we assume the start of the line + const startColumn = match[2] ? parseInt(match[2], 10) - 1 : 0; + const endLine = match[3] ? parseInt(match[3], 10) - 1 : undefined; + // if no end column is given, we assume the end of the line + const endColumn = match[4] ? parseInt(match[4], 10) - 1 : endLine ? widget.editor.document.getLineMaxColumn(endLine) : undefined; + + return { + start: { line: startLine, character: startColumn }, + end: { line: endLine, character: endColumn } + }; + } +} + +@injectable() +export class TypeDocSymbolSelectionResolver implements EditorSelectionResolver { + priority = 50; + + @inject(MonacoToProtocolConverter) protected readonly m2p: MonacoToProtocolConverter; + + async resolveSelection(widget: EditorWidget, options: EditorOpenerOptions, uri?: URI): Promise | undefined> { + if (!uri) { + return; + } + const editor = MonacoEditor.get(widget); + const monacoEditor = editor?.getControl(); + if (!monacoEditor) { + return; + } + const symbolPath = this.findSymbolPath(uri); + if (!symbolPath) { + return; + } + const textModel = monacoEditor.getModel() as unknown as TextModel; + if (!textModel) { + return; + } + + // try to find the symbol through the document symbol provider + // support referencing nested symbols by separating a dot path similar to TypeDoc + for (const provider of StandaloneServices.get(ILanguageFeaturesService).documentSymbolProvider.ordered(textModel)) { + const symbols = await provider.provideDocumentSymbols(textModel, CancellationToken.None); + const match = this.findSymbolByPath(symbols ?? [], symbolPath); + if (match) { + return this.m2p.asRange(match.selectionRange); + } + } + } + + protected findSymbolPath(uri: URI): string[] | undefined { + return uri.fragment.split('.'); + } + + protected findSymbolByPath(symbols: DocumentSymbol[], symbolPath: string[]): DocumentSymbol | undefined { + if (!symbols || symbolPath.length === 0) { + return undefined; + } + let matchedSymbol: DocumentSymbol | undefined = undefined; + let currentSymbols = symbols; + for (const part of symbolPath) { + matchedSymbol = currentSymbols.find(symbol => symbol.name === part); + if (!matchedSymbol) { + return undefined; + } + currentSymbols = matchedSymbol.children || []; + } + return matchedSymbol; + } +} + +@injectable() +export class TextFragmentSelectionResolver implements EditorSelectionResolver { + async resolveSelection(widget: EditorWidget, options: EditorOpenerOptions, uri?: URI): Promise | undefined> { + if (!uri) { + return; + } + const fragment = this.findFragment(uri); + if (!fragment) { + return; + } + const matches = widget.editor.document.findMatches?.({ isRegex: false, matchCase: false, matchWholeWord: false, searchString: fragment }) ?? []; + if (matches.length > 0) { + return { + start: { + line: matches[0].range.start.line - 1, + character: matches[0].range.start.character - 1 + }, + end: { + line: matches[0].range.end.line - 1, + character: matches[0].range.end.character - 1 + } + }; + } + } + + protected findFragment(uri: URI): string | undefined { + return uri.fragment; + } +} diff --git a/packages/ai-chat-ui/src/browser/chat-response-renderer/code-part-renderer.tsx b/packages/ai-chat-ui/src/browser/chat-response-renderer/code-part-renderer.tsx new file mode 100644 index 0000000..b3a9542 --- /dev/null +++ b/packages/ai-chat-ui/src/browser/chat-response-renderer/code-part-renderer.tsx @@ -0,0 +1,272 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** +import { + ChatResponseContent, + CodeChatResponseContent, +} from '@theia/ai-chat/lib/common'; +import { ContributionProvider, UntitledResourceResolver, URI } from '@theia/core'; +import { ContextMenuRenderer, TreeNode } from '@theia/core/lib/browser'; +import { ClipboardService } from '@theia/core/lib/browser/clipboard-service'; +import { inject, injectable, named } from '@theia/core/shared/inversify'; +import * as React from '@theia/core/shared/react'; +import { ReactNode } from '@theia/core/shared/react'; +import { nls } from '@theia/core/lib/common/nls'; +import { Position } from '@theia/core/shared/vscode-languageserver-protocol'; +import { EditorManager, EditorWidget } from '@theia/editor/lib/browser'; +import { SimpleMonacoEditor } from '@theia/monaco/lib/browser/simple-monaco-editor'; +import { MonacoEditorProvider } from '@theia/monaco/lib/browser/monaco-editor-provider'; +import { MonacoLanguages } from '@theia/monaco/lib/browser/monaco-languages'; +import { ChatResponsePartRenderer } from '../chat-response-part-renderer'; +import { ChatViewTreeWidget, ResponseNode } from '../chat-tree-view/chat-view-tree-widget'; +import { IMouseEvent } from '@theia/monaco-editor-core'; + +export const CodePartRendererAction = Symbol('CodePartRendererAction'); +/** + * The CodePartRenderer offers to contribute arbitrary React nodes to the rendered code part. + * Technically anything can be rendered, however it is intended to be used for actions, like + * "Copy to Clipboard" or "Insert at Cursor". + */ +export interface CodePartRendererAction { + render(response: CodeChatResponseContent, parentNode: ResponseNode): ReactNode; + /** + * Determines if the action should be rendered for the given response. + */ + canRender?(response: CodeChatResponseContent, parentNode: ResponseNode): boolean; + /** + * The priority determines the order in which the actions are rendered. + * The default priorities are 10 and 20. + */ + priority: number; +} + +@injectable() +export class CodePartRenderer + implements ChatResponsePartRenderer { + + @inject(EditorManager) + protected readonly editorManager: EditorManager; + @inject(UntitledResourceResolver) + protected readonly untitledResourceResolver: UntitledResourceResolver; + @inject(MonacoEditorProvider) + protected readonly editorProvider: MonacoEditorProvider; + @inject(MonacoLanguages) + protected readonly languageService: MonacoLanguages; + @inject(ContextMenuRenderer) + protected readonly contextMenuRenderer: ContextMenuRenderer; + @inject(ContributionProvider) @named(CodePartRendererAction) + protected readonly codePartRendererActions: ContributionProvider; + + canHandle(response: ChatResponseContent): number { + if (CodeChatResponseContent.is(response)) { + return 10; + } + return -1; + } + + render(response: CodeChatResponseContent, parentNode: ResponseNode): ReactNode { + const language = response.language ? this.languageService.getExtension(response.language) : undefined; + return ( +
    +
    +
    {this.renderTitle(response)}
    +
    + {this.codePartRendererActions.getContributions() + .filter(action => action.canRender ? action.canRender(response, parentNode) : true) + .sort((a, b) => a.priority - b.priority) + .map(action => action.render(response, parentNode))} +
    +
    +
    +
    + this.handleContextMenuEvent(parentNode, e, response.code)}> +
    +
    + ); + } + + protected renderTitle(response: CodeChatResponseContent): ReactNode { + const uri = response.location?.uri; + const position = response.location?.position; + if (uri && position) { + return {this.getTitle(response.location?.uri, response.language)}; + } + return this.getTitle(response.location?.uri, response.language); + } + + private getTitle(uri: URI | undefined, language: string | undefined): string { + // If there is a URI, use the file name as the title. Otherwise, use the language as the title. + // If there is no language, use a generic fallback title. + return uri?.path?.toString().split('/').pop() ?? language ?? nls.localize('theia/ai/chat-ui/code-part-renderer/generatedCode', 'Generated Code'); + } + + /** + * Opens a file and moves the cursor to the specified position. + * + * @param uri - The URI of the file to open. + * @param position - The position to move the cursor to, specified as {line, character}. + */ + async openFileAtPosition(uri: URI, position: Position): Promise { + const editorWidget = await this.editorManager.open(uri) as EditorWidget; + if (editorWidget) { + const editor = editorWidget.editor; + editor.revealPosition(position); + editor.focus(); + editor.cursor = position; + } + } + + protected handleContextMenuEvent(node: TreeNode | undefined, event: IMouseEvent, code: string): void { + this.contextMenuRenderer.render({ + menuPath: ChatViewTreeWidget.CONTEXT_MENU, + anchor: { x: event.posx, y: event.posy }, + args: [node, { code }], + context: event.target + }); + event.preventDefault(); + } +} + +@injectable() +export class CopyToClipboardButtonAction implements CodePartRendererAction { + @inject(ClipboardService) + protected readonly clipboardService: ClipboardService; + priority = 10; + render(response: CodeChatResponseContent): ReactNode { + return ; + } +} + +const CopyToClipboardButton = (props: { code: string, clipboardService: ClipboardService }) => { + const { code, clipboardService } = props; + const [copied, setCopied] = React.useState(false); + const timeoutRef = React.useRef | undefined>(undefined); + + React.useEffect(() => () => { + if (timeoutRef.current !== undefined) { + clearTimeout(timeoutRef.current); + } + }, []); + + const copyCodeToClipboard = React.useCallback(() => { + clipboardService.writeText(code); + setCopied(true); + if (timeoutRef.current !== undefined) { + clearTimeout(timeoutRef.current); + } + timeoutRef.current = setTimeout(() => { + setCopied(false); + timeoutRef.current = undefined; + }, 2000); + }, [code, clipboardService]); + + const iconClass = copied ? 'codicon-check' : 'codicon-copy'; + const title = copied ? nls.localize('theia/ai/chat-ui/code-part-renderer/copied', 'Copied') : nls.localizeByDefault('Copy'); + return
    ; +}; + +@injectable() +export class InsertCodeAtCursorButtonAction implements CodePartRendererAction { + @inject(EditorManager) + protected readonly editorManager: EditorManager; + priority = 20; + render(response: CodeChatResponseContent): ReactNode { + return ; + } +} + +const InsertCodeAtCursorButton = (props: { code: string, editorManager: EditorManager }) => { + const { code, editorManager } = props; + const insertCode = React.useCallback(() => { + const editor = editorManager.currentEditor; + if (editor) { + const currentEditor = editor.editor; + const selection = currentEditor.selection; + + // Insert the text at the current cursor position + // If there is a selection, replace the selection with the text + currentEditor.executeEdits([{ + range: { + start: selection.start, + end: selection.end + }, + newText: code + }]); + } + }, [code, editorManager]); + return
    ; +}; + +/** + * Renders the given code within a Monaco Editor + */ +export const CodeWrapper = (props: { + content: string, + language?: string, + untitledResourceResolver: UntitledResourceResolver, + editorProvider: MonacoEditorProvider, + contextMenuCallback: (e: IMouseEvent) => void +}) => { + // eslint-disable-next-line no-null/no-null + const ref = React.useRef(null); + const editorRef = React.useRef(undefined); + + const createInputElement = async () => { + const resource = await props.untitledResourceResolver.createUntitledResource(undefined, props.language); + const editor = await props.editorProvider.createSimpleInline(resource.uri, ref.current!, { + readOnly: true, + autoSizing: true, + scrollBeyondLastLine: false, + scrollBeyondLastColumn: 0, + renderFinalNewline: 'off', + maxHeight: -1, + scrollbar: { + vertical: 'hidden', + alwaysConsumeMouseWheel: false + }, + wordWrap: 'off', + codeLens: false, + inlayHints: { enabled: 'off' }, + hover: { enabled: false } + }); + editor.document.textEditorModel.setValue(props.content); + editor.getControl().onContextMenu(e => props.contextMenuCallback(e.event)); + editorRef.current = editor; + }; + + React.useEffect(() => { + createInputElement(); + return () => { + if (editorRef.current) { + editorRef.current.dispose(); + } + }; + }, []); + + React.useEffect(() => { + if (editorRef.current) { + editorRef.current.document.textEditorModel.setValue(props.content); + } + }, [props.content]); + + editorRef.current?.resizeToFit(); + + return
    ; +}; diff --git a/packages/ai-chat-ui/src/browser/chat-response-renderer/command-part-renderer.tsx b/packages/ai-chat-ui/src/browser/chat-response-renderer/command-part-renderer.tsx new file mode 100644 index 0000000..9aeabb9 --- /dev/null +++ b/packages/ai-chat-ui/src/browser/chat-response-renderer/command-part-renderer.tsx @@ -0,0 +1,61 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { ChatResponsePartRenderer } from '../chat-response-part-renderer'; +import { inject, injectable } from '@theia/core/shared/inversify'; +import { ChatResponseContent, CommandChatResponseContent } from '@theia/ai-chat/lib/common'; +import { ReactNode } from '@theia/core/shared/react'; +import * as React from '@theia/core/shared/react'; +import { CommandRegistry, CommandService, nls } from '@theia/core'; + +@injectable() +export class CommandPartRenderer implements ChatResponsePartRenderer { + @inject(CommandService) private commandService: CommandService; + @inject(CommandRegistry) private commandRegistry: CommandRegistry; + canHandle(response: ChatResponseContent): number { + if (CommandChatResponseContent.is(response)) { + return 10; + } + return -1; + } + render(response: CommandChatResponseContent): ReactNode { + const label = + response.customCallback?.label ?? + response.command?.label ?? + response.command?.id + .split('-') + .map(s => s[0].toUpperCase() + s.substring(1)) + .join(' ') ?? nls.localizeByDefault('Execute Command'); + if (!response.customCallback && response.command) { + const isCommandEnabled = this.commandRegistry.isEnabled(response.command.id); + if (!isCommandEnabled) { + return
    {nls.localize('theia/ai/chat-ui/command-part-renderer/commandNotExecutable', + 'The command has the id "{0}" but it is not executable from the Chat window.', response.command.id)}
    ; + + } + } + return ; + } + private onCommand(arg: CommandChatResponseContent): void { + if (arg.customCallback) { + arg.customCallback.callback().catch(e => { console.error(e); }); + } else if (arg.command) { + this.commandService.executeCommand(arg.command.id, ...(arg.arguments ?? [])).catch(e => { console.error(e); }); + } else { + console.warn('No command or custom callback provided in command chat response content'); + } + } +} diff --git a/packages/ai-chat-ui/src/browser/chat-response-renderer/delegation-response-renderer.tsx b/packages/ai-chat-ui/src/browser/chat-response-renderer/delegation-response-renderer.tsx new file mode 100644 index 0000000..2b38a04 --- /dev/null +++ b/packages/ai-chat-ui/src/browser/chat-response-renderer/delegation-response-renderer.tsx @@ -0,0 +1,179 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** +import { inject, injectable } from '@theia/core/shared/inversify'; +import { ChatRequestInvocation, ChatResponseContent, ChatResponseModel } from '@theia/ai-chat'; +import { ChatResponsePartRenderer } from '../chat-response-part-renderer'; +import * as React from '@theia/core/shared/react'; +import { DelegationResponseContent, isDelegationResponseContent } from '@theia/ai-chat/lib/browser/delegation-response-content'; +import { ResponseNode } from '../chat-tree-view'; +import { CompositeTreeNode } from '@theia/core/lib/browser'; +import { SubChatWidgetFactory } from '../chat-tree-view/sub-chat-widget'; +import { DisposableCollection, nls } from '@theia/core'; + +@injectable() +export class DelegationResponseRenderer implements ChatResponsePartRenderer { + + @inject(SubChatWidgetFactory) + subChatWidgetFactory: SubChatWidgetFactory; + + canHandle(response: ChatResponseContent): number { + if (isDelegationResponseContent(response)) { + return 10; + } + return -1; + } + render(response: DelegationResponseContent, parentNode: ResponseNode): React.ReactNode { + return this.renderExpandableNode(response, parentNode); + } + + private renderExpandableNode(response: DelegationResponseContent, parentNode: ResponseNode): React.ReactNode { + return ; + } +} + +interface DelegatedChatProps { + response: ChatRequestInvocation; + agentId: string; + prompt: string; + parentNode: ResponseNode; + subChatWidgetFactory: SubChatWidgetFactory; +} + +interface DelegatedChatState { + node?: ResponseNode; +} + +class DelegatedChat extends React.Component { + private widget: ReturnType; + private readonly toDispose = new DisposableCollection(); + + constructor(props: DelegatedChatProps) { + super(props); + this.state = { + node: undefined + }; + this.widget = props.subChatWidgetFactory(); + } + + override componentDidMount(): void { + // Start rendering as soon as the response is created (streaming mode) + this.props.response.responseCreated.then(chatModel => { + const node = mapResponseToNode(chatModel, this.props.parentNode); + this.setState({ node }); + + // Listen for changes to update the rendering as the response streams in + const changeListener = () => { + // Force re-render when the response content changes + this.forceUpdate(); + }; + this.toDispose.push(chatModel.onDidChange(changeListener)); + }).catch(error => { + console.error('Failed to create delegated chat response:', error); + // Still try to handle completion in case of partial success + }); + + // Keep the completion handling for final cleanup if needed + this.props.response.responseCompleted.then(() => { + // Final update when response is complete + this.forceUpdate(); + }).catch(error => { + console.error('Error in delegated chat response completion:', error); + // Force update anyway to show any partial content or error state + this.forceUpdate(); + }); + } + + override componentWillUnmount(): void { + this.toDispose.dispose(); + } + + override render(): React.ReactNode { + const { agentId, prompt } = this.props; + const hasNode = !!this.state.node; + const isComplete = this.state.node?.response.isComplete ?? false; + const isCanceled = this.state.node?.response.isCanceled ?? false; + const isError = this.state.node?.response.isError ?? false; + + let statusIcon = ''; + let statusText = ''; + if (hasNode) { + if (isCanceled) { + statusIcon = 'codicon-close'; + statusText = nls.localize('theia/ai/chat-ui/delegation-response-renderer/status/canceled', 'canceled'); + } else if (isComplete) { + statusIcon = 'codicon-check'; + statusText = nls.localizeByDefault('completed'); + } else if (isError) { + statusIcon = 'codicon-error'; + statusText = nls.localize('theia/ai/chat-ui/delegation-response-renderer/status/error', 'error'); + } else { + statusIcon = 'codicon-loading'; + statusText = nls.localize('theia/ai/chat-ui/delegation-response-renderer/status/generating', 'generating...'); + } + } else { + statusIcon = 'codicon-loading'; + statusText = nls.localize('theia/ai/chat-ui/delegation-response-renderer/status/starting', 'starting...'); + } + + return ( +
    +
    + +
    + + {agentId} + + + + {statusText} + +
    +
    +
    +
    + {nls.localize('theia/ai/chat-ui/delegation-response-renderer/prompt/label', 'Delegated prompt:')} +
    {prompt}
    +
    +
    + {nls.localize('theia/ai/chat-ui/delegation-response-renderer/response/label', 'Response:')} +
    + {hasNode && this.state.node ? this.widget.renderChatResponse(this.state.node) : +
    + {nls.localize('theia/ai/chat-ui/delegation-response-renderer/starting', 'Starting delegation...')} +
    + } +
    +
    +
    +
    +
    + ); + } +} + +function mapResponseToNode(response: ChatResponseModel, parentNode: ResponseNode): ResponseNode { + return { + id: response.id, + parent: parentNode as unknown as CompositeTreeNode, + response, + sessionId: parentNode.sessionId + }; +} diff --git a/packages/ai-chat-ui/src/browser/chat-response-renderer/error-part-renderer.tsx b/packages/ai-chat-ui/src/browser/chat-response-renderer/error-part-renderer.tsx new file mode 100644 index 0000000..4a8fc59 --- /dev/null +++ b/packages/ai-chat-ui/src/browser/chat-response-renderer/error-part-renderer.tsx @@ -0,0 +1,35 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { ChatResponsePartRenderer } from '../chat-response-part-renderer'; +import { injectable } from '@theia/core/shared/inversify'; +import { ChatResponseContent, ErrorChatResponseContent } from '@theia/ai-chat/lib/common'; +import { ReactNode } from '@theia/core/shared/react'; +import * as React from '@theia/core/shared/react'; + +@injectable() +export class ErrorPartRenderer implements ChatResponsePartRenderer { + canHandle(response: ChatResponseContent): number { + if (ErrorChatResponseContent.is(response)) { + return 10; + } + return -1; + } + render(response: ErrorChatResponseContent): ReactNode { + return
    {response.error.message}
    ; + } + +} diff --git a/packages/ai-chat-ui/src/browser/chat-response-renderer/horizontal-layout-part-renderer.tsx b/packages/ai-chat-ui/src/browser/chat-response-renderer/horizontal-layout-part-renderer.tsx new file mode 100644 index 0000000..79ef8d1 --- /dev/null +++ b/packages/ai-chat-ui/src/browser/chat-response-renderer/horizontal-layout-part-renderer.tsx @@ -0,0 +1,59 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { ChatResponsePartRenderer } from '../chat-response-part-renderer'; +import { inject, injectable, named } from '@theia/core/shared/inversify'; +import { + ChatResponseContent, + HorizontalLayoutChatResponseContent, +} from '@theia/ai-chat/lib/common'; +import { ReactNode } from '@theia/core/shared/react'; +import * as React from '@theia/core/shared/react'; +import { ContributionProvider } from '@theia/core'; +import { ResponseNode } from '../chat-tree-view/chat-view-tree-widget'; + +@injectable() +export class HorizontalLayoutPartRenderer + implements ChatResponsePartRenderer { + @inject(ContributionProvider) + @named(ChatResponsePartRenderer) + protected readonly chatResponsePartRenderers: ContributionProvider< + ChatResponsePartRenderer + >; + + canHandle(response: ChatResponseContent): number { + if (HorizontalLayoutChatResponseContent.is(response)) { + return 10; + } + return -1; + } + render(response: HorizontalLayoutChatResponseContent, parentNode: ResponseNode): ReactNode { + const contributions = this.chatResponsePartRenderers.getContributions(); + return ( +
    + {response.content.map(content => { + const renderer = contributions + .map(c => ({ + prio: c.canHandle(content), + renderer: c, + })) + .sort((a, b) => b.prio - a.prio)[0].renderer; + return renderer.render(content, parentNode); + })} +
    + ); + } +} diff --git a/packages/ai-chat-ui/src/browser/chat-response-renderer/index.ts b/packages/ai-chat-ui/src/browser/chat-response-renderer/index.ts new file mode 100644 index 0000000..f64540e --- /dev/null +++ b/packages/ai-chat-ui/src/browser/chat-response-renderer/index.ts @@ -0,0 +1,28 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** +export * from './ai-selection-resolver'; +export * from './code-part-renderer'; +export * from './command-part-renderer'; +export * from './error-part-renderer'; +export * from './horizontal-layout-part-renderer'; +export * from './markdown-part-renderer'; +export * from './text-part-renderer'; +export * from './toolcall-part-renderer'; +export * from './not-available-toolcall-renderer'; +export * from './thinking-part-renderer'; +export * from './progress-part-renderer'; +export * from './tool-confirmation'; +export * from './delegation-response-renderer'; diff --git a/packages/ai-chat-ui/src/browser/chat-response-renderer/markdown-part-renderer.tsx b/packages/ai-chat-ui/src/browser/chat-response-renderer/markdown-part-renderer.tsx new file mode 100644 index 0000000..37f74ab --- /dev/null +++ b/packages/ai-chat-ui/src/browser/chat-response-renderer/markdown-part-renderer.tsx @@ -0,0 +1,137 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { ChatResponsePartRenderer } from '../chat-response-part-renderer'; +import { inject, injectable } from '@theia/core/shared/inversify'; +import { + ChatResponseContent, + InformationalChatResponseContent, + MarkdownChatResponseContent, +} from '@theia/ai-chat/lib/common'; +import { ReactNode, useEffect, useRef } from '@theia/core/shared/react'; +import * as React from '@theia/core/shared/react'; +import * as markdownit from '@theia/core/shared/markdown-it'; +import * as markdownitemoji from '@theia/core/shared/markdown-it-emoji'; +import * as DOMPurify from '@theia/core/shared/dompurify'; +import { MarkdownString } from '@theia/core/lib/common/markdown-rendering'; +import { OpenerService, open } from '@theia/core/lib/browser'; +import { URI } from '@theia/core'; + +@injectable() +export class MarkdownPartRenderer implements ChatResponsePartRenderer { + @inject(OpenerService) protected readonly openerService: OpenerService; + protected readonly markdownIt = markdownit().use(markdownitemoji.full); + canHandle(response: ChatResponseContent): number { + if (MarkdownChatResponseContent.is(response)) { + return 10; + } + if (InformationalChatResponseContent.is(response)) { + return 10; + } + return -1; + } + render(response: MarkdownChatResponseContent | InformationalChatResponseContent): ReactNode { + // TODO let the user configure whether they want to see informational content + if (InformationalChatResponseContent.is(response)) { + // null is valid in React + // eslint-disable-next-line no-null/no-null + return null; + } + + return ; + } +} + +const MarkdownRender = ({ response, openerService }: { response: MarkdownChatResponseContent | InformationalChatResponseContent; openerService: OpenerService }) => { + const ref = useMarkdownRendering(response.content, openerService); + + return
    ; +}; + +export interface DeclaredEventsEventListenerObject extends EventListenerObject { + handledEvents?: (keyof HTMLElementEventMap)[]; +} + +/** + * This hook uses markdown-it directly to render markdown. + * The reason to use markdown-it directly is that the MarkdownRenderer is + * overridden by theia with a monaco version. This monaco version strips all html + * tags from the markdown with empty content. This leads to unexpected behavior when + * rendering markdown with html tags. + * + * Moreover, we want to intercept link clicks to use the Theia OpenerService instead of the default browser behavior. + * + * @param markdown the string to render as markdown + * @param skipSurroundingParagraph whether to remove a surrounding paragraph element (default: false) + * @param openerService the service to handle link opening + * @param eventHandler `handleEvent` will be called by default for `click` events and additionally + * for all events enumerated in {@link DeclaredEventsEventListenerObject.handledEvents}. If `handleEvent` returns `true`, + * no additional handlers will be run for the event. + * @returns the ref to use in an element to render the markdown + */ +export const useMarkdownRendering = ( + markdown: string | MarkdownString, + openerService: OpenerService, + skipSurroundingParagraph: boolean = false, + eventHandler?: DeclaredEventsEventListenerObject +) => { + // null is valid in React + // eslint-disable-next-line no-null/no-null + const ref = useRef(null); + const markdownString = typeof markdown === 'string' ? markdown : markdown.value; + useEffect(() => { + const markdownIt = markdownit().use(markdownitemoji.full); + const host = document.createElement('div'); + + // markdownIt always puts the content in a paragraph element, so we remove it if we don't want that + const html = skipSurroundingParagraph ? markdownIt.render(markdownString).replace(/^

    |<\/p>|

    <\/p>$/g, '') : markdownIt.render(markdownString); + + host.innerHTML = DOMPurify.sanitize(html, { + // DOMPurify usually strips non http(s) links from hrefs + // but we want to allow them (see handleClick via OpenerService below) + ALLOW_UNKNOWN_PROTOCOLS: true + }); + while (ref?.current?.firstChild) { + ref.current.removeChild(ref.current.firstChild); + } + ref?.current?.appendChild(host); + + // intercept link clicks to use the Theia OpenerService instead of the default browser behavior + const handleClick = (event: MouseEvent) => { + if ((eventHandler?.handleEvent(event) as unknown) === true) { return; } + let target = event.target as HTMLElement; + while (target && target.tagName !== 'A') { + target = target.parentElement as HTMLElement; + } + if (target && target.tagName === 'A') { + const href = target.getAttribute('href'); + if (href) { + open(openerService, new URI(href)); + event.preventDefault(); + } + } + }; + + ref?.current?.addEventListener('click', handleClick); + eventHandler?.handledEvents?.forEach(eventType => eventType !== 'click' && ref?.current?.addEventListener(eventType, eventHandler)); + return () => { + ref.current?.removeEventListener('click', handleClick); + eventHandler?.handledEvents?.forEach(eventType => eventType !== 'click' && ref?.current?.removeEventListener(eventType, eventHandler)); + }; + }, [markdownString, skipSurroundingParagraph, openerService]); + + return ref; +}; diff --git a/packages/ai-chat-ui/src/browser/chat-response-renderer/not-available-toolcall-renderer.tsx b/packages/ai-chat-ui/src/browser/chat-response-renderer/not-available-toolcall-renderer.tsx new file mode 100644 index 0000000..07e9cf5 --- /dev/null +++ b/packages/ai-chat-ui/src/browser/chat-response-renderer/not-available-toolcall-renderer.tsx @@ -0,0 +1,57 @@ +// ***************************************************************************** +// Copyright (C) 2026 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { ChatResponsePartRenderer } from '../chat-response-part-renderer'; +import { injectable } from '@theia/core/shared/inversify'; +import { ChatResponseContent, ToolCallChatResponseContent } from '@theia/ai-chat/lib/common'; +import { ReactNode } from '@theia/core/shared/react'; +import { codicon } from '@theia/core/lib/browser'; +import * as React from '@theia/core/shared/react'; +import { ResponseNode } from '../chat-tree-view'; + +/** + * High-priority renderer for tool calls that were not available. + * + * This handles cases where the LLM attempted to call a tool that was not + * made available to it in the request. This takes priority over all other + * tool renderers (including specialized ones like ShellExecutionToolRenderer) + * since unavailable tools should never be processed by tool-specific renderers. + */ +@injectable() +export class NotAvailableToolCallRenderer implements ChatResponsePartRenderer { + + canHandle(response: ChatResponseContent): number { + if (ToolCallChatResponseContent.is(response) && response.finished) { + if (ToolCallChatResponseContent.isNotAvailableResult(response.result)) { + return 100; + } + } + return -1; + } + + render(response: ToolCallChatResponseContent, _parentNode: ResponseNode): ReactNode { + const errorMessage = ToolCallChatResponseContent.getErrorMessage(response.result); + return ( +

    + + + {' '} + {response.name}: {errorMessage} + +
    + ); + } +} diff --git a/packages/ai-chat-ui/src/browser/chat-response-renderer/progress-part-renderer.tsx b/packages/ai-chat-ui/src/browser/chat-response-renderer/progress-part-renderer.tsx new file mode 100644 index 0000000..2ca4500 --- /dev/null +++ b/packages/ai-chat-ui/src/browser/chat-response-renderer/progress-part-renderer.tsx @@ -0,0 +1,40 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { ChatResponsePartRenderer } from '../chat-response-part-renderer'; +import { injectable } from '@theia/core/shared/inversify'; +import { ChatResponseContent, ProgressChatResponseContent } from '@theia/ai-chat/lib/common'; +import { ReactNode } from '@theia/core/shared/react'; +import * as React from '@theia/core/shared/react'; +import { ProgressMessage } from '../chat-progress-message'; + +@injectable() +export class ProgressPartRenderer implements ChatResponsePartRenderer { + + canHandle(response: ChatResponseContent): number { + if (ProgressChatResponseContent.is(response)) { + return 10; + } + return -1; + } + + render(response: ProgressChatResponseContent): ReactNode { + return ( + + ); + } + +} diff --git a/packages/ai-chat-ui/src/browser/chat-response-renderer/question-part-renderer.tsx b/packages/ai-chat-ui/src/browser/chat-response-renderer/question-part-renderer.tsx new file mode 100644 index 0000000..5e3a812 --- /dev/null +++ b/packages/ai-chat-ui/src/browser/chat-response-renderer/question-part-renderer.tsx @@ -0,0 +1,63 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** +import { ChatResponseContent, QuestionResponseContent } from '@theia/ai-chat'; +import { injectable } from '@theia/core/shared/inversify'; +import * as React from '@theia/core/shared/react'; +import { ReactNode } from '@theia/core/shared/react'; +import { ChatResponsePartRenderer } from '../chat-response-part-renderer'; +import { ResponseNode } from '../chat-tree-view'; + +@injectable() +export class QuestionPartRenderer + implements ChatResponsePartRenderer { + + canHandle(response: ChatResponseContent): number { + if (QuestionResponseContent.is(response)) { + return 10; + } + return -1; + } + + render(question: QuestionResponseContent, node: ResponseNode): ReactNode { + const isDisabled = question.isReadOnly || question.selectedOption !== undefined || !node.response.isWaitingForInput; + + return ( +
    +
    {question.question}
    +
    + { + question.options.map((option, index) => ( + + )) + } +
    +
    + ); + } + +} diff --git a/packages/ai-chat-ui/src/browser/chat-response-renderer/text-part-renderer.spec.ts b/packages/ai-chat-ui/src/browser/chat-response-renderer/text-part-renderer.spec.ts new file mode 100644 index 0000000..e67b0fe --- /dev/null +++ b/packages/ai-chat-ui/src/browser/chat-response-renderer/text-part-renderer.spec.ts @@ -0,0 +1,50 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { TextPartRenderer } from './text-part-renderer'; +import { expect } from 'chai'; +import { ChatResponseContent } from '@theia/ai-chat'; + +describe('TextPartRenderer', () => { + + it('accepts all parts', () => { + const renderer = new TextPartRenderer(); + expect(renderer.canHandle({ kind: 'text' })).to.be.greaterThan(0); + expect(renderer.canHandle({ kind: 'code' })).to.be.greaterThan(0); + expect(renderer.canHandle({ kind: 'command' })).to.be.greaterThan(0); + expect(renderer.canHandle({ kind: 'error' })).to.be.greaterThan(0); + expect(renderer.canHandle({ kind: 'horizontal' })).to.be.greaterThan(0); + expect(renderer.canHandle({ kind: 'informational' })).to.be.greaterThan(0); + expect(renderer.canHandle({ kind: 'markdownContent' })).to.be.greaterThan(0); + expect(renderer.canHandle({ kind: 'toolCall' })).to.be.greaterThan(0); + expect(renderer.canHandle(undefined as unknown as ChatResponseContent)).to.be.greaterThan(0); + }); + + it('renders text correctly', () => { + const renderer = new TextPartRenderer(); + const part = { kind: 'text', asString: () => 'Hello, World!' }; + const node = renderer.render(part); + expect(JSON.stringify(node)).to.contain('Hello, World!'); + }); + + it('handles undefined content gracefully', () => { + const renderer = new TextPartRenderer(); + const part = undefined as unknown as ChatResponseContent; + const node = renderer.render(part); + expect(node).to.exist; + }); + +}); diff --git a/packages/ai-chat-ui/src/browser/chat-response-renderer/text-part-renderer.tsx b/packages/ai-chat-ui/src/browser/chat-response-renderer/text-part-renderer.tsx new file mode 100644 index 0000000..6b87a1c --- /dev/null +++ b/packages/ai-chat-ui/src/browser/chat-response-renderer/text-part-renderer.tsx @@ -0,0 +1,38 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { ChatResponsePartRenderer } from '../chat-response-part-renderer'; +import { injectable } from '@theia/core/shared/inversify'; +import { ChatResponseContent } from '@theia/ai-chat/lib/common'; +import { ReactNode } from '@theia/core/shared/react'; +import { nls } from '@theia/core/lib/common/nls'; +import * as React from '@theia/core/shared/react'; + +@injectable() +export class TextPartRenderer implements ChatResponsePartRenderer { + canHandle(_reponse: ChatResponseContent): number { + // this is the fallback renderer + return 1; + } + render(response: ChatResponseContent): ReactNode { + if (response && ChatResponseContent.hasAsString(response)) { + return {response.asString()}; + } + return + {nls.localize('theia/ai/chat-ui/text-part-renderer/cantDisplay', + "Can't display response, please check your ChatResponsePartRenderers!")} {JSON.stringify(response)}; + } +} diff --git a/packages/ai-chat-ui/src/browser/chat-response-renderer/thinking-part-renderer.tsx b/packages/ai-chat-ui/src/browser/chat-response-renderer/thinking-part-renderer.tsx new file mode 100644 index 0000000..8a8e86d --- /dev/null +++ b/packages/ai-chat-ui/src/browser/chat-response-renderer/thinking-part-renderer.tsx @@ -0,0 +1,44 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { ChatResponsePartRenderer } from '../chat-response-part-renderer'; +import { injectable } from '@theia/core/shared/inversify'; +import { ChatResponseContent, ThinkingChatResponseContent } from '@theia/ai-chat/lib/common'; +import { ReactNode } from '@theia/core/shared/react'; +import { nls } from '@theia/core/lib/common/nls'; +import * as React from '@theia/core/shared/react'; + +@injectable() +export class ThinkingPartRenderer implements ChatResponsePartRenderer { + + canHandle(response: ChatResponseContent): number { + if (ThinkingChatResponseContent.is(response)) { + return 10; + } + return -1; + } + + render(response: ThinkingChatResponseContent): ReactNode { + return ( +
    +
    + {nls.localize('theia/ai/chat-ui/thinking-part-renderer/thinking', 'Thinking')} +
    {response.content}
    +
    +
    + ); + } +} diff --git a/packages/ai-chat-ui/src/browser/chat-response-renderer/tool-confirmation.spec.ts b/packages/ai-chat-ui/src/browser/chat-response-renderer/tool-confirmation.spec.ts new file mode 100644 index 0000000..f25352d --- /dev/null +++ b/packages/ai-chat-ui/src/browser/chat-response-renderer/tool-confirmation.spec.ts @@ -0,0 +1,108 @@ +// ***************************************************************************** +// Copyright (C) 2026 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { expect } from 'chai'; +import { ContextMenuRenderer } from '@theia/core/lib/browser'; +import { ConfirmationScope, ToolConfirmationCallbacks, ToolConfirmationActionsProps, ToolConfirmationProps } from './tool-confirmation'; + +const mockContextMenuRenderer = {} as ContextMenuRenderer; + +describe('Tool Confirmation Types', () => { + describe('ConfirmationScope', () => { + it('should accept valid scopes', () => { + const scopes: ConfirmationScope[] = ['once', 'session', 'forever']; + expect(scopes).to.have.length(3); + }); + }); + + describe('ToolConfirmationCallbacks', () => { + it('should define required callback properties', () => { + const callbacks: ToolConfirmationCallbacks = { + onAllow: (_scope: ConfirmationScope) => { }, + onDeny: (_scope: ConfirmationScope, _reason?: string) => { } + }; + expect(callbacks.onAllow).to.be.a('function'); + expect(callbacks.onDeny).to.be.a('function'); + }); + + it('should allow optional toolRequest', () => { + const callbacks: ToolConfirmationCallbacks = { + toolRequest: { id: 'test', name: 'test', handler: async () => '', parameters: { type: 'object', properties: {} } }, + onAllow: () => { }, + onDeny: () => { } + }; + expect(callbacks.toolRequest).to.exist; + }); + }); + + describe('ToolConfirmationActionsProps', () => { + it('should extend ToolConfirmationCallbacks with toolName', () => { + const props: ToolConfirmationActionsProps = { + toolName: 'testTool', + onAllow: () => { }, + onDeny: () => { }, + contextMenuRenderer: mockContextMenuRenderer + }; + expect(props.toolName).to.equal('testTool'); + }); + + it('should support confirmAlwaysAllow string in toolRequest', () => { + const props: ToolConfirmationActionsProps = { + toolName: 'dangerousTool', + toolRequest: { + id: 'test', + name: 'test', + handler: async () => '', + parameters: { type: 'object', properties: {} }, + confirmAlwaysAllow: 'This tool can modify system files.' + }, + onAllow: () => { }, + onDeny: () => { }, + contextMenuRenderer: mockContextMenuRenderer + }; + expect(props.toolRequest?.confirmAlwaysAllow).to.equal('This tool can modify system files.'); + }); + + it('should support confirmAlwaysAllow boolean in toolRequest', () => { + const props: ToolConfirmationActionsProps = { + toolName: 'dangerousTool', + toolRequest: { + id: 'test', + name: 'test', + handler: async () => '', + parameters: { type: 'object', properties: {} }, + confirmAlwaysAllow: true + }, + onAllow: () => { }, + onDeny: () => { }, + contextMenuRenderer: mockContextMenuRenderer + }; + expect(props.toolRequest?.confirmAlwaysAllow).to.be.true; + }); + }); + + describe('ToolConfirmationProps', () => { + it('should pick toolRequest from ToolConfirmationCallbacks', () => { + const props: ToolConfirmationProps = { + response: { kind: 'toolCall', id: 'test', name: 'test' } as ToolConfirmationProps['response'], + onAllow: () => { }, + onDeny: () => { }, + contextMenuRenderer: mockContextMenuRenderer + }; + expect(props.toolRequest).to.be.undefined; + }); + }); +}); diff --git a/packages/ai-chat-ui/src/browser/chat-response-renderer/tool-confirmation.tsx b/packages/ai-chat-ui/src/browser/chat-response-renderer/tool-confirmation.tsx new file mode 100644 index 0000000..6697bca --- /dev/null +++ b/packages/ai-chat-ui/src/browser/chat-response-renderer/tool-confirmation.tsx @@ -0,0 +1,459 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import * as React from '@theia/core/shared/react'; +import { nls } from '@theia/core/lib/common/nls'; +import { codicon, ContextMenuRenderer } from '@theia/core/lib/browser'; +import { ToolCallChatResponseContent } from '@theia/ai-chat/lib/common'; +import { ToolRequest } from '@theia/ai-core'; +import { CommandMenu, ContextExpressionMatcher, MenuPath } from '@theia/core/lib/common/menu'; +import { GroupImpl } from '@theia/core/lib/browser/menu/composite-menu-node'; +import { ToolConfirmationMode as ToolConfirmationPreferenceMode } from '@theia/ai-chat/lib/common/chat-tool-preferences'; +import { ToolConfirmationManager } from '@theia/ai-chat/lib/browser/chat-tool-preference-bindings'; + +export type ToolConfirmationState = 'waiting' | 'allowed' | 'denied' | 'rejected'; + +export type ConfirmationScope = 'once' | 'session' | 'forever'; + +export interface ToolConfirmationCallbacks { + toolRequest?: ToolRequest; + onAllow: (scope: ConfirmationScope) => void; + onDeny: (scope: ConfirmationScope, reason?: string) => void; +} + +export interface ToolConfirmationActionsProps extends ToolConfirmationCallbacks { + toolName: string; + contextMenuRenderer: ContextMenuRenderer; +} + +class InlineActionMenuNode implements CommandMenu { + constructor( + readonly id: string, + readonly label: string, + private readonly action: () => void, + readonly sortString: string, + readonly icon?: string + ) { } + + isVisible(_effectiveMenuPath: MenuPath, _contextMatcher: ContextExpressionMatcher, _context: T | undefined): boolean { + return true; + } + + isEnabled(): boolean { + return true; + } + + isToggled(): boolean { + return false; + } + + async run(): Promise { + this.action(); + } +} + +export const ToolConfirmationActions: React.FC = ({ + toolName, + toolRequest, + onAllow, + onDeny, + contextMenuRenderer +}) => { + const [allowScope, setAllowScope] = React.useState('once'); + const [denyScope, setDenyScope] = React.useState('once'); + const [showAlwaysAllowConfirmation, setShowAlwaysAllowConfirmation] = React.useState(false); + const [showDenyReasonInput, setShowDenyReasonInput] = React.useState(false); + const [denyReason, setDenyReason] = React.useState(''); + // eslint-disable-next-line no-null/no-null + const denyReasonInputRef = React.useRef(null); + + const handleAllow = React.useCallback(() => { + if ((allowScope === 'forever' || allowScope === 'session') && toolRequest?.confirmAlwaysAllow) { + setShowAlwaysAllowConfirmation(true); + return; + } + onAllow(allowScope); + }, [onAllow, allowScope, toolRequest]); + + const handleConfirmAlwaysAllow = React.useCallback(() => { + setShowAlwaysAllowConfirmation(false); + onAllow(allowScope); + }, [onAllow, allowScope]); + + const handleCancelAlwaysAllow = React.useCallback(() => { + setShowAlwaysAllowConfirmation(false); + }, []); + + const handleDeny = React.useCallback(() => { + onDeny(denyScope); + }, [onDeny, denyScope]); + + const handleDenyWithReason = React.useCallback(() => { + setShowDenyReasonInput(true); + }, []); + + const handleSubmitDenyReason = React.useCallback(() => { + onDeny('once', denyReason.trim() || undefined); + setShowDenyReasonInput(false); + setDenyReason(''); + }, [onDeny, denyReason]); + + const handleCancelDenyReason = React.useCallback(() => { + setShowDenyReasonInput(false); + setDenyReason(''); + }, []); + + const handleDenyReasonKeyDown = React.useCallback((e: React.KeyboardEvent) => { + if (e.key === 'Enter') { + e.preventDefault(); + handleSubmitDenyReason(); + } else if (e.key === 'Escape') { + e.preventDefault(); + handleCancelDenyReason(); + } + }, [handleSubmitDenyReason, handleCancelDenyReason]); + + React.useEffect(() => { + if (showDenyReasonInput && denyReasonInputRef.current) { + denyReasonInputRef.current.focus(); + } + }, [showDenyReasonInput]); + + const SCOPES: ConfirmationScope[] = ['once', 'session', 'forever']; + + const scopeLabel = (type: 'allow' | 'deny', scope: ConfirmationScope): string => { + if (type === 'allow') { + switch (scope) { + case 'once': return nls.localizeByDefault('Allow'); + case 'session': return nls.localize('theia/ai/chat-ui/toolconfirmation/allow-session', 'Allow for this Chat'); + case 'forever': return nls.localizeByDefault('Always Allow'); + } + } else { + switch (scope) { + case 'once': return nls.localizeByDefault('Deny'); + case 'session': return nls.localize('theia/ai/chat-ui/toolconfirmation/deny-session', 'Deny for this Chat'); + case 'forever': return nls.localize('theia/ai/chat-ui/toolconfirmation/deny-forever', 'Always Deny'); + } + } + }; + + const getAlwaysAllowWarning = (): string => { + if (typeof toolRequest?.confirmAlwaysAllow === 'string') { + return toolRequest.confirmAlwaysAllow; + } + return nls.localize( + 'theia/ai/chat-ui/toolconfirmation/alwaysAllowGenericWarning', + 'This tool requires confirmation before auto-approval can be enabled. ' + + 'Once enabled, all future invocations will execute without confirmation. ' + + 'Only enable this if you trust this tool and understand the potential risks.' + ); + }; + + const showDropdownMenu = React.useCallback(( + event: React.MouseEvent, + type: 'allow' | 'deny', + selectedScope: ConfirmationScope, + setScope: (scope: ConfirmationScope) => void + ) => { + const otherScopes = SCOPES.filter(s => s !== selectedScope); + const menu = new GroupImpl('tool-confirmation-dropdown'); + + const scopesGroup = new GroupImpl('scopes', '1'); + otherScopes.forEach((scope, index) => { + scopesGroup.addNode(new InlineActionMenuNode( + `tool-confirmation-${type}-${scope}`, + scopeLabel(type, scope), + () => setScope(scope), + String(index) + )); + }); + menu.addNode(scopesGroup); + + if (type === 'deny') { + const reasonGroup = new GroupImpl('reason', '2'); + reasonGroup.addNode(new InlineActionMenuNode( + 'tool-confirmation-deny-with-reason', + nls.localize('theia/ai/chat-ui/toolconfirmation/deny-with-reason', 'Deny with reason...'), + handleDenyWithReason, + '0' + )); + menu.addNode(reasonGroup); + } + + const splitButtonContainer = event.currentTarget.parentElement; + const containerRect = splitButtonContainer?.getBoundingClientRect() ?? event.currentTarget.getBoundingClientRect(); + contextMenuRenderer.render({ + menuPath: ['tool-confirmation-context-menu'], + menu, + anchor: { x: containerRect.left, y: containerRect.bottom }, + context: event.currentTarget, + skipSingleRootNode: true + }); + }, [contextMenuRenderer, handleDenyWithReason, scopeLabel]); + + const renderSplitButton = (type: 'allow' | 'deny'): React.ReactNode => { + const selectedScope = type === 'allow' ? allowScope : denyScope; + const setScope = type === 'allow' ? setAllowScope : setDenyScope; + const handleMain = type === 'allow' ? handleAllow : handleDeny; + + return ( +
    + + +
    + ); + }; + + if (showAlwaysAllowConfirmation) { + return ( +
    +
    + + {nls.localize('theia/ai/chat-ui/toolconfirmation/alwaysAllowTitle', 'Enable Auto-Approval for "{0}"?', toolName)} +
    +
    + {getAlwaysAllowWarning()} +
    +
    + + +
    +
    + ); + } + + if (showDenyReasonInput) { + return ( +
    + setDenyReason(e.target.value)} + onKeyDown={handleDenyReasonKeyDown} + /> +
    + + +
    +
    + ); + } + + return ( +
    + {renderSplitButton('deny')} + {renderSplitButton('allow')} +
    + ); +}; + +export interface ToolConfirmationProps extends Pick { + response: ToolCallChatResponseContent; + onAllow: (scope?: ConfirmationScope) => void; + onDeny: (scope?: ConfirmationScope, reason?: string) => void; + contextMenuRenderer: ContextMenuRenderer; +} + +export const ToolConfirmation: React.FC = ({ response, toolRequest, onAllow, onDeny, contextMenuRenderer }) => { + const [state, setState] = React.useState('waiting'); + + const handleAllow = React.useCallback((scope: ConfirmationScope) => { + setState('allowed'); + onAllow(scope); + }, [onAllow]); + + const handleDeny = React.useCallback((scope: ConfirmationScope, reason?: string) => { + setState('denied'); + onDeny(scope, reason); + }, [onDeny]); + + if (state === 'allowed') { + return ( +
    + {nls.localize('theia/ai/chat-ui/toolconfirmation/allowed', 'Tool execution allowed')} +
    + ); + } + + if (state === 'denied') { + return ( +
    + {nls.localize('theia/ai/chat-ui/toolconfirmation/denied', 'Tool execution denied')} +
    + ); + } + + return ( +
    +
    + {nls.localize('theia/ai/chat-ui/toolconfirmation/header', 'Confirm Tool Execution')} +
    +
    +
    + {nls.localizeByDefault('Tool')}: + {response.name} +
    +
    + +
    + ); +}; + +export interface WithToolCallConfirmationProps { + response: ToolCallChatResponseContent; + confirmationMode: ToolConfirmationPreferenceMode; + toolConfirmationManager: ToolConfirmationManager; + toolRequest?: ToolRequest; + chatId: string; + requestCanceled: boolean; + contextMenuRenderer: ContextMenuRenderer; +} + +export function withToolCallConfirmation

    ( + WrappedComponent: React.ComponentType

    +): React.FC

    { + const WithConfirmation: React.FC

    = props => { + const { + response, + confirmationMode, + toolConfirmationManager, + toolRequest, + chatId, + requestCanceled, + contextMenuRenderer, + ...componentProps + } = props; + + const [confirmationState, setConfirmationState] = React.useState('waiting'); + + React.useEffect(() => { + if (confirmationMode === ToolConfirmationPreferenceMode.ALWAYS_ALLOW) { + response.confirm(); + setConfirmationState('allowed'); + return; + } else if (confirmationMode === ToolConfirmationPreferenceMode.DISABLED) { + response.deny(); + setConfirmationState('denied'); + return; + } + response.confirmed + .then(confirmed => { + setConfirmationState(confirmed === true ? 'allowed' : 'denied'); + }) + .catch(() => { + setConfirmationState('rejected'); + }); + }, [response, confirmationMode]); + + const handleAllow = React.useCallback((scope: ConfirmationScope = 'once') => { + if (scope === 'forever' && response.name) { + toolConfirmationManager.setConfirmationMode(response.name, ToolConfirmationPreferenceMode.ALWAYS_ALLOW, toolRequest); + } else if (scope === 'session' && response.name) { + toolConfirmationManager.setSessionConfirmationMode(response.name, ToolConfirmationPreferenceMode.ALWAYS_ALLOW, chatId); + } + response.confirm(); + }, [response, toolConfirmationManager, chatId, toolRequest]); + + const handleDeny = React.useCallback((scope: ConfirmationScope = 'once', reason?: string) => { + if (scope === 'forever' && response.name) { + toolConfirmationManager.setConfirmationMode(response.name, ToolConfirmationPreferenceMode.DISABLED); + } else if (scope === 'session' && response.name) { + toolConfirmationManager.setSessionConfirmationMode(response.name, ToolConfirmationPreferenceMode.DISABLED, chatId); + } + response.deny(reason); + }, [response, toolConfirmationManager, chatId]); + + if (confirmationState === 'rejected' || (requestCanceled && !response.finished)) { + return ( +

    + {nls.localize('theia/ai/chat-ui/toolconfirmation/canceled', 'Tool execution canceled')} +
    + ); + } + + if (confirmationState === 'denied') { + return ( +
    + {nls.localize('theia/ai/chat-ui/toolconfirmation/executionDenied', 'Tool execution denied')} +
    + ); + } + + if (confirmationState === 'waiting' && !requestCanceled && !response.finished) { + return ( + + ); + } + + return ; + }; + + WithConfirmation.displayName = `withToolCallConfirmation(${WrappedComponent.displayName || WrappedComponent.name || 'Component'})`; + return WithConfirmation; +} diff --git a/packages/ai-chat-ui/src/browser/chat-response-renderer/toolcall-part-renderer.tsx b/packages/ai-chat-ui/src/browser/chat-response-renderer/toolcall-part-renderer.tsx new file mode 100644 index 0000000..2777dab --- /dev/null +++ b/packages/ai-chat-ui/src/browser/chat-response-renderer/toolcall-part-renderer.tsx @@ -0,0 +1,286 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { ChatResponsePartRenderer } from '../chat-response-part-renderer'; +import { inject, injectable } from '@theia/core/shared/inversify'; +import { ChatResponseContent, ToolCallChatResponseContent } from '@theia/ai-chat/lib/common'; +import { ReactNode } from '@theia/core/shared/react'; +import { nls } from '@theia/core/lib/common/nls'; +import { codicon, ContextMenuRenderer, OpenerService } from '@theia/core/lib/browser'; +import * as React from '@theia/core/shared/react'; +import { ToolConfirmation, ToolConfirmationState } from './tool-confirmation'; +import { ToolConfirmationMode } from '@theia/ai-chat/lib/common/chat-tool-preferences'; +import { ResponseNode } from '../chat-tree-view'; +import { useMarkdownRendering } from './markdown-part-renderer'; +import { ToolCallResult, ToolInvocationRegistry, ToolRequest } from '@theia/ai-core'; +import { ToolConfirmationManager } from '@theia/ai-chat/lib/browser/chat-tool-preference-bindings'; + +@injectable() +export class ToolCallPartRenderer implements ChatResponsePartRenderer { + + @inject(ToolConfirmationManager) + protected toolConfirmationManager: ToolConfirmationManager; + + @inject(OpenerService) + protected openerService: OpenerService; + + @inject(ToolInvocationRegistry) + protected toolInvocationRegistry: ToolInvocationRegistry; + + @inject(ContextMenuRenderer) + protected contextMenuRenderer: ContextMenuRenderer; + + canHandle(response: ChatResponseContent): number { + if (ToolCallChatResponseContent.is(response)) { + return 10; + } + return -1; + } + + render(response: ToolCallChatResponseContent, parentNode: ResponseNode): ReactNode { + const chatId = parentNode.sessionId; + const toolRequest = response.name ? this.toolInvocationRegistry.getFunction(response.name) : undefined; + const confirmationMode = response.name ? this.getToolConfirmationSettings(response.name, chatId, toolRequest) : ToolConfirmationMode.DISABLED; + return ; + } + + protected renderResult(response: ToolCallChatResponseContent): ReactNode { + const result = this.tryParse(response.result); + if (!result) { + return undefined; + } + if (typeof result === 'string') { + return
    {JSON.stringify(result, undefined, 2)}
    ; + } + if ('content' in result) { + return
    + {result.content.map((content, idx) => { + switch (content.type) { + case 'image': { + return
    + +
    ; + } + case 'text': { + return
    + +
    ; + } + case 'audio': + case 'error': + default: { + return
    {JSON.stringify(response, undefined, 2)}
    ; + } + } + })} +
    ; + } + return
    {JSON.stringify(result, undefined, 2)}
    ; + } + + private tryParse(result: ToolCallResult): ToolCallResult { + if (!result) { + return undefined; + } + try { + return typeof result === 'string' ? JSON.parse(result) : result; + } catch (error) { + return result; + } + } + + protected getToolConfirmationSettings(responseId: string, chatId: string, toolRequest?: ToolRequest): ToolConfirmationMode { + return this.toolConfirmationManager.getConfirmationMode(responseId, chatId, toolRequest); + } + + protected renderCollapsibleArguments(args: string | undefined): ReactNode { + if (!args || !args.trim() || args.trim() === '{}') { + return undefined; + } + + return ( +
    + ... + {this.prettyPrintArgs(args)} +
    + ); + } + + private prettyPrintArgs(args: string): string { + try { + return JSON.stringify(JSON.parse(args), undefined, 2); + } catch (e) { + // fall through + return args; + } + } +} + +const Spinner = () => ( + +); + +interface ToolCallContentProps { + response: ToolCallChatResponseContent; + confirmationMode: ToolConfirmationMode; + toolConfirmationManager: ToolConfirmationManager; + toolRequest?: ToolRequest; + chatId: string; + renderCollapsibleArguments: (args: string | undefined) => ReactNode; + responseRenderer: (response: ToolCallChatResponseContent) => ReactNode | undefined; + requestCanceled: boolean; + contextMenuRenderer: ContextMenuRenderer; +} + +/** + * A function component to handle tool call rendering and confirmation + */ +const ToolCallContent: React.FC = ({ + response, + confirmationMode, + toolConfirmationManager, + toolRequest, + chatId, + responseRenderer, + renderCollapsibleArguments, + requestCanceled, + contextMenuRenderer +}) => { + const [confirmationState, setConfirmationState] = React.useState('waiting'); + const [rejectionReason, setRejectionReason] = React.useState(undefined); + + const formatReason = (reason: unknown): string => { + if (!reason) { + return ''; + } + if (reason instanceof Error) { + return reason.message; + } + if (typeof reason === 'string') { + return reason; + } + try { + return JSON.stringify(reason); + } catch (e) { + return String(reason); + } + }; + + React.useEffect(() => { + if (confirmationMode === ToolConfirmationMode.ALWAYS_ALLOW) { + response.confirm(); + setConfirmationState('allowed'); + return; + } else if (confirmationMode === ToolConfirmationMode.DISABLED) { + response.deny(); + setConfirmationState('denied'); + return; + } + response.confirmed + .then(confirmed => { + if (confirmed === true) { + setConfirmationState('allowed'); + } else { + setConfirmationState('denied'); + } + }) + .catch(reason => { + setRejectionReason(reason); + setConfirmationState('rejected'); + }); + }, [response, confirmationMode]); + + const handleAllow = React.useCallback((mode: 'once' | 'session' | 'forever' = 'once') => { + if (mode === 'forever' && response.name) { + toolConfirmationManager.setConfirmationMode(response.name, ToolConfirmationMode.ALWAYS_ALLOW, toolRequest); + } else if (mode === 'session' && response.name) { + toolConfirmationManager.setSessionConfirmationMode(response.name, ToolConfirmationMode.ALWAYS_ALLOW, chatId); + } + response.confirm(); + }, [response, toolConfirmationManager, chatId, toolRequest]); + + const handleDeny = React.useCallback((mode: 'once' | 'session' | 'forever' = 'once', reason?: string) => { + if (mode === 'forever' && response.name) { + toolConfirmationManager.setConfirmationMode(response.name, ToolConfirmationMode.DISABLED); + } else if (mode === 'session' && response.name) { + toolConfirmationManager.setSessionConfirmationMode(response.name, ToolConfirmationMode.DISABLED, chatId); + } + response.deny(reason); + }, [response, toolConfirmationManager, chatId]); + + const reasonText = formatReason(rejectionReason); + + return ( +
    + {confirmationState === 'rejected' ? ( + + {nls.localize('theia/ai/chat-ui/toolcall-part-renderer/rejected', 'Execution canceled')}: {response.name} + {reasonText ? — {reasonText} : undefined} + + ) : requestCanceled && !response.finished ? ( + + {nls.localize('theia/ai/chat-ui/toolcall-part-renderer/rejected', 'Execution canceled')}: {response.name} + + ) : confirmationState === 'denied' ? ( + + {nls.localize('theia/ai/chat-ui/toolcall-part-renderer/denied', 'Execution denied')}: {response.name} + + ) : response.finished ? ( +
    + + {nls.localize('theia/ai/chat-ui/toolcall-part-renderer/finished', 'Ran')} {response.name} + ({renderCollapsibleArguments(response.arguments)}) + +
    + {responseRenderer(response)} +
    +
    + ) : ( + confirmationState === 'allowed' && !requestCanceled && ( + + {nls.localizeByDefault('Running')} {response.name} + + ) + )} + + {confirmationState === 'waiting' && !requestCanceled && !response.finished && ( + + + + )} +
    + ); +}; + +const MarkdownRender = ({ text, openerService }: { text: string; openerService: OpenerService }) => { + const ref = useMarkdownRendering(text, openerService); + return
    ; +}; diff --git a/packages/ai-chat-ui/src/browser/chat-response-renderer/unknown-part-renderer.tsx b/packages/ai-chat-ui/src/browser/chat-response-renderer/unknown-part-renderer.tsx new file mode 100644 index 0000000..600692c --- /dev/null +++ b/packages/ai-chat-ui/src/browser/chat-response-renderer/unknown-part-renderer.tsx @@ -0,0 +1,52 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { injectable } from '@theia/core/shared/inversify'; +import { ChatResponsePartRenderer } from '../chat-response-part-renderer'; +import { ChatResponseContent, UnknownChatResponseContent } from '@theia/ai-chat/lib/common'; +import { ReactNode } from '@theia/core/shared/react'; +import { nls } from '@theia/core/lib/common/nls'; +import * as React from '@theia/core/shared/react'; +import { codicon } from '@theia/core/lib/browser'; + +@injectable() +export class UnknownPartRenderer implements ChatResponsePartRenderer { + canHandle(response: ChatResponseContent): number { + return response.kind === 'unknown' ? 10 : -1; + } + + render(response: UnknownChatResponseContent): ReactNode { + const fallbackMessage = response.fallbackMessage || response.asString?.() || ''; + + return ( +
    +
    + + + {nls.localize( + 'theia/ai/chat-ui/unknown-part-renderer/contentNotRestoreable', + "This content (type '{0}') could not be fully restored. It may be from an extension that is no longer available.", + response.originalKind + )} + +
    +
    + {fallbackMessage} +
    +
    + ); + } +} diff --git a/packages/ai-chat-ui/src/browser/chat-tree-view/chat-view-tree-container.ts b/packages/ai-chat-ui/src/browser/chat-tree-view/chat-view-tree-container.ts new file mode 100644 index 0000000..a0e0f12 --- /dev/null +++ b/packages/ai-chat-ui/src/browser/chat-tree-view/chat-view-tree-container.ts @@ -0,0 +1,38 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { createTreeContainer, TreeProps } from '@theia/core/lib/browser'; +import { interfaces } from '@theia/core/shared/inversify'; +import { ChatViewTreeWidget } from './chat-view-tree-widget'; + +const CHAT_VIEW_TREE_PROPS = { + multiSelect: false, + search: false, + viewProps: { + // Let Virtuoso handle auto-scroll natively: follow new output only when + // the user is already at the bottom, and render items from the top + // (prevents short conversations from anchoring to the bottom of the panel). + followOutput: true, + }, +} as TreeProps; + +export function createChatViewTreeWidget(parent: interfaces.Container): ChatViewTreeWidget { + const child = createTreeContainer(parent, { + props: CHAT_VIEW_TREE_PROPS, + widget: ChatViewTreeWidget, + }); + return child.get(ChatViewTreeWidget); +} diff --git a/packages/ai-chat-ui/src/browser/chat-tree-view/chat-view-tree-input-widget.tsx b/packages/ai-chat-ui/src/browser/chat-tree-view/chat-view-tree-input-widget.tsx new file mode 100644 index 0000000..506e5e9 --- /dev/null +++ b/packages/ai-chat-ui/src/browser/chat-tree-view/chat-view-tree-input-widget.tsx @@ -0,0 +1,104 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { inject, injectable, optional, postConstruct } from '@theia/core/shared/inversify'; +import { AIChatInputWidget, type AIChatInputConfiguration } from '../chat-input-widget'; +import type { EditableRequestNode } from './chat-view-tree-widget'; +import { URI } from '@theia/core'; +import { CHAT_VIEW_LANGUAGE_EXTENSION } from '../chat-view-language-contribution'; +import type { ChatRequestModel, EditableChatRequestModel, ChatHierarchyBranch } from '@theia/ai-chat'; +import type { AIVariableResolutionRequest } from '@theia/ai-core'; +import { Key } from '@theia/core/lib/browser'; + +export const AIChatTreeInputConfiguration = Symbol('AIChatTreeInputConfiguration'); +export interface AIChatTreeInputConfiguration extends AIChatInputConfiguration { } + +export const AIChatTreeInputArgs = Symbol('AIChatTreeInputArgs'); +export interface AIChatTreeInputArgs { + node: EditableRequestNode; + /** + * The branch of the chat tree for this request node (used by the input widget for state tracking). + */ + branch?: ChatHierarchyBranch; + initialValue?: string; + onQuery: (query: string) => Promise; + onUnpin?: () => void; + onCancel?: (requestModel: ChatRequestModel) => void; + onDeleteChangeSet?: (requestModel: ChatRequestModel) => void; + onDeleteChangeSetElement?: (requestModel: ChatRequestModel, index: number) => void; +} +export const AIChatTreeInputFactory = Symbol('AIChatTreeInputFactory'); +export type AIChatTreeInputFactory = (args: AIChatTreeInputArgs) => AIChatTreeInputWidget; + +@injectable() +export class AIChatTreeInputWidget extends AIChatInputWidget { + public static override ID = 'chat-tree-input-widget'; + + @inject(AIChatTreeInputArgs) + protected readonly args: AIChatTreeInputArgs; + + @inject(AIChatTreeInputConfiguration) @optional() + protected override readonly configuration: AIChatTreeInputConfiguration | undefined; + + get requestNode(): EditableRequestNode { + return this.args.node; + } + + get request(): EditableChatRequestModel { + return this.requestNode.request; + } + + @postConstruct() + protected override init(): void { + super.init(); + this.updateBranch(); + + const request = this.requestNode.request; + this.toDispose.push(request.session.onDidChange(() => { + this.updateBranch(); + })); + + this.addKeyListener(this.node, Key.ESCAPE, () => { + this.request.cancelEdit(); + }); + + this.editorReady.promise.then(() => { + if (this.editorRef) { + this.editorRef.focus(); + } + }); + } + + protected updateBranch(): void { + this.branch = this.args.branch ?? this.requestNode.branch; + } + + protected override getResourceUri(): URI { + return new URI(`ai-chat:/${this.requestNode.id}-input.${CHAT_VIEW_LANGUAGE_EXTENSION}`); + } + + override addContext(variable: AIVariableResolutionRequest): void { + this.request.editContextManager.addVariables(variable); + } + + protected override getContext(): readonly AIVariableResolutionRequest[] { + return this.request.editContextManager.getVariables(); + } + + protected override deleteContextElement(index: number): void { + this.request.editContextManager.deleteVariables(index); + } +} diff --git a/packages/ai-chat-ui/src/browser/chat-tree-view/chat-view-tree-widget.tsx b/packages/ai-chat-ui/src/browser/chat-tree-view/chat-view-tree-widget.tsx new file mode 100644 index 0000000..781180a --- /dev/null +++ b/packages/ai-chat-ui/src/browser/chat-tree-view/chat-view-tree-widget.tsx @@ -0,0 +1,932 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** +import { + ChatAgent, + ChatAgentService, + ChatModel, + ChatRequestModel, + ChatResponseContent, + ChatResponseModel, + ChatService, + EditableChatRequestModel, + ParsedChatRequestAgentPart, + ParsedChatRequestFunctionPart, + ParsedChatRequestVariablePart, + type ChatRequest, + type ChatHierarchyBranch, +} from '@theia/ai-chat'; +import { ImageContextVariable } from '@theia/ai-chat/lib/common/image-context-variable'; +import { AIVariableService } from '@theia/ai-core'; +import { AIActivationService } from '@theia/ai-core/lib/browser'; +import { CommandRegistry, ContributionProvider, Disposable, DisposableCollection, Emitter, Event } from '@theia/core'; +import { + codicon, + CompositeTreeNode, + ContextMenuRenderer, + HoverService, + Key, + KeyCode, + NodeProps, + OpenerService, + TreeModel, + TreeNode, + TreeProps, + TreeWidget, + Widget, + type ReactWidget +} from '@theia/core/lib/browser'; +import { ContextKey, ContextKeyService } from '@theia/core/lib/browser/context-key-service'; +import { nls } from '@theia/core/lib/common/nls'; +import { + inject, + injectable, + named, + optional, + postConstruct +} from '@theia/core/shared/inversify'; +import * as React from '@theia/core/shared/react'; +import { ChatNodeToolbarActionContribution } from '../chat-node-toolbar-action-contribution'; +import { ChatResponsePartRenderer } from '../chat-response-part-renderer'; +import { useMarkdownRendering } from '../chat-response-renderer/markdown-part-renderer'; +import { ProgressMessage } from '../chat-progress-message'; +import { AIChatTreeInputFactory, type AIChatTreeInputWidget } from './chat-view-tree-input-widget'; +import { PromptVariantBadge } from './prompt-variant-badge'; + +// TODO Instead of directly operating on the ChatRequestModel we could use an intermediate view model +export interface RequestNode extends TreeNode { + request: ChatRequestModel, + branch: ChatHierarchyBranch, + sessionId: string +} +export const isRequestNode = (node: TreeNode): node is RequestNode => 'request' in node; + +export interface EditableRequestNode extends RequestNode { + request: EditableChatRequestModel +} +export const isEditableRequestNode = (node: TreeNode): node is EditableRequestNode => isRequestNode(node) && EditableChatRequestModel.is(node.request); + +// TODO Instead of directly operating on the ChatResponseModel we could use an intermediate view model +export interface ResponseNode extends TreeNode { + response: ChatResponseModel, + sessionId: string +} +export const isResponseNode = (node: TreeNode): node is ResponseNode => 'response' in node; + +export function isEnterKey(e: React.KeyboardEvent): boolean { + return Key.ENTER.keyCode === KeyCode.createKeyCode(e.nativeEvent).key?.keyCode; +} + +export const ChatWelcomeMessageProvider = Symbol('ChatWelcomeMessageProvider'); +export interface ChatWelcomeMessageProvider { + renderWelcomeMessage?(): React.ReactNode; + renderDisabledMessage?(): React.ReactNode; + readonly hasReadyModels?: boolean; + readonly modelRequirementBypassed?: boolean; + readonly defaultAgent?: string; + readonly onStateChanged?: Event; +} + +@injectable() +export class ChatViewTreeWidget extends TreeWidget { + + static readonly ID = 'chat-tree-widget'; + static readonly CONTEXT_MENU = ['chat-tree-context-menu']; + + @inject(ContributionProvider) @named(ChatResponsePartRenderer) + protected readonly chatResponsePartRenderers: ContributionProvider>; + + @inject(ContributionProvider) @named(ChatNodeToolbarActionContribution) + protected readonly chatNodeToolbarActionContributions: ContributionProvider; + + @inject(ChatAgentService) + protected chatAgentService: ChatAgentService; + + @inject(AIVariableService) + protected readonly variableService: AIVariableService; + + @inject(CommandRegistry) + protected commandRegistry: CommandRegistry; + + @inject(OpenerService) + protected readonly openerService: OpenerService; + + @inject(HoverService) + protected hoverService: HoverService; + + @inject(ChatWelcomeMessageProvider) @optional() + protected welcomeMessageProvider?: ChatWelcomeMessageProvider; + + @inject(AIChatTreeInputFactory) + protected inputWidgetFactory: AIChatTreeInputFactory; + + @inject(AIActivationService) + protected readonly activationService: AIActivationService; + + @inject(ChatService) + protected readonly chatService: ChatService; + + @inject(ContextKeyService) + protected readonly contextKeyService: ContextKeyService; + + protected chatResponseFocusKey: ContextKey; + + protected readonly onDidSubmitEditEmitter = new Emitter(); + onDidSubmitEdit = this.onDidSubmitEditEmitter.event; + + protected readonly chatInputs: Map = new Map(); + + protected _shouldScrollToEnd = true; + + protected isEnabled = false; + + protected chatModelId: string; + + /** Tracks if we are at the bottom for showing the scroll-to-bottom button. */ + protected atBottom = true; + /** + * Track the visibility of the scroll button with debounce logic. Used to prevent flickering when streaming tokens. + */ + protected _showScrollButton = false; + /** + * Timer for debouncing the scroll button activation (prevents flicker on auto-scroll). + * If user scrolls up, this delays showing the button in case auto-scroll-to-bottom kicks in. + */ + protected _scrollButtonDebounceTimer?: number; + /** + * Debounce period in ms before showing scroll-to-bottom button after scrolling up. + * Avoids flickering of the button during LLM token streaming. + */ + protected static readonly SCROLL_BUTTON_GRACE_PERIOD = 100; + + onScrollLockChange?: (temporaryLocked: boolean) => void; + + protected lastScrollTop = 0; + + set shouldScrollToEnd(shouldScrollToEnd: boolean) { + this._shouldScrollToEnd = shouldScrollToEnd; + this.shouldScrollToRow = this._shouldScrollToEnd; + } + + get shouldScrollToEnd(): boolean { + return this._shouldScrollToEnd; + } + + constructor( + @inject(TreeProps) props: TreeProps, + @inject(TreeModel) model: TreeModel, + @inject(ContextMenuRenderer) contextMenuRenderer: ContextMenuRenderer + ) { + super(props, model, contextMenuRenderer); + + this.id = ChatViewTreeWidget.ID; + this.title.closable = false; + + model.root = { + id: 'ChatTree', + name: 'ChatRootNode', + parent: undefined, + visible: false, + children: [], + } as CompositeTreeNode; + } + + @postConstruct() + protected override init(): void { + super.init(); + + this.id = ChatViewTreeWidget.ID + '-treeContainer'; + this.addClass('treeContainer'); + + this.chatResponseFocusKey = this.contextKeyService.createKey('chatResponseFocus', false); + this.node.setAttribute('tabindex', '0'); + this.node.setAttribute('aria-label', nls.localize('theia/ai/chat-ui/chatResponses', 'Chat responses')); + this.addEventListener(this.node, 'focusin', () => this.chatResponseFocusKey.set(true)); + this.addEventListener(this.node, 'focusout', () => this.chatResponseFocusKey.set(false)); + + this.toDispose.pushAll([ + this.toDisposeOnChatModelChange, + this.activationService.onDidChangeActiveStatus(change => { + this.chatInputs.forEach(widget => { + widget.setEnabled(change); + }); + this.update(); + }), + this.onScroll(scrollEvent => { + this.handleScrollEvent(scrollEvent); + }) + ]); + + if (this.welcomeMessageProvider?.onStateChanged) { + this.toDispose.push( + this.welcomeMessageProvider.onStateChanged(() => { + this.update(); + }) + ); + } + + // Initialize lastScrollTop with current scroll position + this.lastScrollTop = this.getCurrentScrollTop(undefined); + } + + public setEnabled(enabled: boolean): void { + this.isEnabled = enabled; + this.update(); + } + + protected handleScrollEvent(scrollEvent: unknown): void { + const currentScrollTop = this.getCurrentScrollTop(scrollEvent); + const isScrollingUp = currentScrollTop < this.lastScrollTop; + const isScrollingDown = currentScrollTop > this.lastScrollTop; + const isAtBottom = this.isScrolledToBottom(); + const isAtAbsoluteBottom = this.isAtAbsoluteBottom(); + + // Asymmetric threshold logic to prevent jitter: + if (this.shouldScrollToEnd && isScrollingUp) { + if (!isAtAbsoluteBottom) { + this.setTemporaryScrollLock(true); + } + } else if (!this.shouldScrollToEnd && isAtBottom && isScrollingDown) { + this.setTemporaryScrollLock(false); + } + + this.updateScrollToBottomButtonState(isAtBottom); + + this.lastScrollTop = currentScrollTop; + } + + /** Updates the scroll-to-bottom button state and handles debounce. */ + protected updateScrollToBottomButtonState(isAtBottom: boolean): void { + const atBottomNow = isAtBottom; // Use isScrolledToBottom for threshold + if (atBottomNow !== this.atBottom) { + this.atBottom = atBottomNow; + if (this.atBottom) { + // We're at the bottom, hide the button immediately and clear any debounce timer. + this._showScrollButton = false; + if (this._scrollButtonDebounceTimer !== undefined) { + clearTimeout(this._scrollButtonDebounceTimer); + this._scrollButtonDebounceTimer = undefined; + } + this.update(); + } else { + // User scrolled up; delay showing the scroll-to-bottom button. + if (this._scrollButtonDebounceTimer !== undefined) { + clearTimeout(this._scrollButtonDebounceTimer); + } + this._scrollButtonDebounceTimer = window.setTimeout(() => { + // Re-check: only show if we're still not at bottom + if (!this.atBottom) { + this._showScrollButton = true; + this.update(); + } + this._scrollButtonDebounceTimer = undefined; + }, ChatViewTreeWidget.SCROLL_BUTTON_GRACE_PERIOD); + } + } + } + + protected setTemporaryScrollLock(enabled: boolean): void { + // Immediately apply scroll lock changes without delay + this.onScrollLockChange?.(enabled); + // Update cached scrollToRow so that outdated values do not cause unwanted scrolling on update() + this.updateScrollToRow(); + } + + protected getCurrentScrollTop(scrollEvent: unknown): number { + // For virtualized trees, use the virtualized view's scroll state (most reliable) + if (this.props.virtualized !== false && this.view) { + const scrollState = this.getVirtualizedScrollState(); + if (scrollState !== undefined) { + return scrollState.scrollTop; + } + } + + // Try to extract scroll position from the scroll event + if (scrollEvent && typeof scrollEvent === 'object' && 'scrollTop' in scrollEvent) { + const scrollEventWithScrollTop = scrollEvent as { scrollTop: unknown }; + const scrollTop = scrollEventWithScrollTop.scrollTop; + if (typeof scrollTop === 'number' && !isNaN(scrollTop)) { + return scrollTop; + } + } + + // Last resort: use DOM scroll position + if (this.node && typeof this.node.scrollTop === 'number') { + return this.node.scrollTop; + } + + return 0; + } + + /** + * Returns true if the scroll position is at the absolute (1px tolerance) bottom of the scroll container. + * Handles both virtualized and non-virtualized scroll containers. + * Allows for a tiny floating point epsilon (1px). + */ + protected isAtAbsoluteBottom(): boolean { + let scrollTop: number = 0; + let scrollHeight: number = 0; + let clientHeight: number = 0; + const EPSILON = 1; // px + if (this.props.virtualized !== false && this.view) { + const state = this.getVirtualizedScrollState(); + if (state) { + scrollTop = state.scrollTop; + scrollHeight = state.scrollHeight ?? 0; + clientHeight = state.clientHeight ?? 0; + } + } else if (this.node) { + scrollTop = this.node.scrollTop; + scrollHeight = this.node.scrollHeight; + clientHeight = this.node.clientHeight; + } + const diff = Math.abs(scrollTop + clientHeight - scrollHeight); + return diff <= EPSILON; + } + + protected override renderTree(model: TreeModel): React.ReactNode { + if (!this.isEnabled) { + return this.renderDisabledMessage(); + } + + const tree = CompositeTreeNode.is(model.root) && model.root.children?.length > 0 + ? super.renderTree(model) + : this.renderWelcomeMessage(); + + return + {tree} + {this.renderScrollToBottomButton()} + ; + } + + /** Shows the scroll to bottom button if not at the bottom (debounced). */ + protected renderScrollToBottomButton(): React.ReactNode { + if (!this._showScrollButton) { + return undefined; + } + // Down-arrow, Theia codicon, fixed overlay on widget + return +
    +
    + +
    + + {response.verification_uri} +
    + +

    + {nls.localize('theia/ai/copilot/auth/hint', + 'After entering the code and authorizing, click "I have authorized" below.')} +

    + +
    +

    + {nls.localize('theia/ai/copilot/auth/privacy', + 'Theia is an open-source project. We only request access to your GitHub username ' + + 'to connect to GitHub Copilot services — no other data is accessed or stored.')} +

    +

    + {nls.localize('theia/ai/copilot/auth/tos', + 'By signing in, you agree to the ')} + + {nls.localize('theia/ai/copilot/auth/tosLink', 'GitHub Terms of Service')} + . +

    +
    +
    + ); + } + + protected handleOpenTos = (e: React.MouseEvent): void => { + e.preventDefault(); + this.windowService.openNewWindow('https://docs.github.com/en/site-policy/github-terms/github-terms-of-service', { external: true }); + }; + + protected renderPolling(): React.ReactNode { + return ( +
    +
    + +
    +

    {nls.localize('theia/ai/copilot/auth/verifying', 'Verifying authorization...')}

    +
    + ); + } + + protected renderSuccess(): React.ReactNode { + return ( +
    + +

    {nls.localize('theia/ai/copilot/auth/success', 'Successfully signed in to GitHub Copilot!')}

    +

    + {nls.localize('theia/ai/copilot/auth/successHint', + 'If your GitHub account has access to Copilot, you can now configure Copilot language models in the ')} + + {nls.localize('theia/ai/copilot/auth/aiConfiguration', 'AI Configuration')} + . +

    +
    + ); + } + + protected handleOpenAIConfig = (e: React.MouseEvent): void => { + e.preventDefault(); + this.commandService.executeCommand(OPEN_AI_CONFIG_VIEW_COMMAND); + }; + + protected handleRetry = (): void => { + this.initiateFlow(); + }; + + protected renderError(): React.ReactNode { + return ( +
    + +

    {this.errorMessage}

    + +
    + ); + } +} diff --git a/packages/ai-copilot/src/browser/copilot-command-contribution.ts b/packages/ai-copilot/src/browser/copilot-command-contribution.ts new file mode 100644 index 0000000..405c14b --- /dev/null +++ b/packages/ai-copilot/src/browser/copilot-command-contribution.ts @@ -0,0 +1,93 @@ +// ***************************************************************************** +// Copyright (C) 2026 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { inject, injectable, postConstruct } from '@theia/core/shared/inversify'; +import { Command, CommandContribution, CommandRegistry, Disposable, DisposableCollection, PreferenceService } from '@theia/core'; +import { CopilotAuthService, CopilotAuthState } from '../common/copilot-auth-service'; +import { CopilotAuthDialog, CopilotAuthDialogProps } from './copilot-auth-dialog'; +import { COPILOT_ENTERPRISE_URL_PREF } from '../common/copilot-preferences'; + +export namespace CopilotCommands { + export const SIGN_IN: Command = Command.toLocalizedCommand( + { id: 'copilot.signIn', label: 'Sign in to GitHub Copilot', category: 'Copilot' }, + 'theia/ai/copilot/commands/signIn', + 'theia/ai/copilot/category' + ); + + export const SIGN_OUT: Command = Command.toLocalizedCommand( + { id: 'copilot.signOut', label: 'Sign out of GitHub Copilot', category: 'Copilot' }, + 'theia/ai/copilot/commands/signOut', + 'theia/ai/copilot/category' + ); +} + +/** + * Command contribution for GitHub Copilot authentication commands. + */ +@injectable() +export class CopilotCommandContribution implements CommandContribution, Disposable { + + @inject(CopilotAuthService) + protected readonly authService: CopilotAuthService; + + @inject(PreferenceService) + protected readonly preferenceService: PreferenceService; + + @inject(CopilotAuthDialogProps) + protected readonly dialogProps: CopilotAuthDialogProps; + + @inject(CopilotAuthDialog) + protected readonly authDialog: CopilotAuthDialog; + + protected authState: CopilotAuthState = { isAuthenticated: false }; + protected readonly toDispose = new DisposableCollection(); + + @postConstruct() + protected init(): void { + this.authService.getAuthState().then(state => { + this.authState = state; + }); + + this.toDispose.push(this.authService.onAuthStateChanged(state => { + this.authState = state; + })); + } + + dispose(): void { + this.toDispose.dispose(); + } + + registerCommands(registry: CommandRegistry): void { + registry.registerCommand(CopilotCommands.SIGN_IN, { + execute: async () => { + const enterpriseUrl = this.preferenceService.get(COPILOT_ENTERPRISE_URL_PREF); + this.dialogProps.enterpriseUrl = enterpriseUrl || undefined; + const result = await this.authDialog.open(); + if (result) { + this.authState = await this.authService.getAuthState(); + } + }, + isEnabled: () => !this.authState.isAuthenticated + }); + + registry.registerCommand(CopilotCommands.SIGN_OUT, { + execute: async () => { + await this.authService.signOut(); + }, + isEnabled: () => this.authState.isAuthenticated + }); + } +} diff --git a/packages/ai-copilot/src/browser/copilot-frontend-application-contribution.ts b/packages/ai-copilot/src/browser/copilot-frontend-application-contribution.ts new file mode 100644 index 0000000..212f62a --- /dev/null +++ b/packages/ai-copilot/src/browser/copilot-frontend-application-contribution.ts @@ -0,0 +1,89 @@ +// ***************************************************************************** +// Copyright (C) 2026 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { inject, injectable } from '@theia/core/shared/inversify'; +import { PreferenceService } from '@theia/core'; +import { FrontendApplicationContribution } from '@theia/core/lib/browser'; +import { CopilotLanguageModelsManager, CopilotModelDescription, COPILOT_PROVIDER_ID } from '../common'; +import { COPILOT_MODELS_PREF, COPILOT_ENTERPRISE_URL_PREF } from '../common/copilot-preferences'; +import { AICorePreferences, PREFERENCE_NAME_MAX_RETRIES } from '@theia/ai-core/lib/common/ai-core-preferences'; + +@injectable() +export class CopilotFrontendApplicationContribution implements FrontendApplicationContribution { + + @inject(PreferenceService) + protected readonly preferenceService: PreferenceService; + + @inject(CopilotLanguageModelsManager) + protected readonly manager: CopilotLanguageModelsManager; + + @inject(AICorePreferences) + protected readonly aiCorePreferences: AICorePreferences; + + protected prevModels: string[] = []; + + onStart(): void { + this.preferenceService.ready.then(() => { + const models = this.preferenceService.get(COPILOT_MODELS_PREF, []); + this.manager.createOrUpdateLanguageModels(...models.map((modelId: string) => this.createCopilotModelDescription(modelId))); + this.prevModels = [...models]; + + this.preferenceService.onPreferenceChanged(event => { + if (event.preferenceName === COPILOT_MODELS_PREF) { + this.handleModelChanges(this.preferenceService.get(COPILOT_MODELS_PREF, [])); + } else if (event.preferenceName === COPILOT_ENTERPRISE_URL_PREF) { + this.manager.refreshModelsStatus(); + } + }); + + this.aiCorePreferences.onPreferenceChanged(event => { + if (event.preferenceName === PREFERENCE_NAME_MAX_RETRIES) { + this.updateAllModels(); + } + }); + }); + } + + protected handleModelChanges(newModels: string[]): void { + const oldModels = new Set(this.prevModels); + const updatedModels = new Set(newModels); + + const modelsToRemove = [...oldModels].filter(model => !updatedModels.has(model)); + const modelsToAdd = [...updatedModels].filter(model => !oldModels.has(model)); + + this.manager.removeLanguageModels(...modelsToRemove.map(model => `${COPILOT_PROVIDER_ID}/${model}`)); + this.manager.createOrUpdateLanguageModels(...modelsToAdd.map((modelId: string) => this.createCopilotModelDescription(modelId))); + this.prevModels = newModels; + } + + protected updateAllModels(): void { + const models = this.preferenceService.get(COPILOT_MODELS_PREF, []); + this.manager.createOrUpdateLanguageModels(...models.map((modelId: string) => this.createCopilotModelDescription(modelId))); + } + + protected createCopilotModelDescription(modelId: string): CopilotModelDescription { + const id = `${COPILOT_PROVIDER_ID}/${modelId}`; + const maxRetries = this.aiCorePreferences.get(PREFERENCE_NAME_MAX_RETRIES) ?? 3; + + return { + id, + model: modelId, + enableStreaming: true, + supportsStructuredOutput: true, + maxRetries + }; + } +} diff --git a/packages/ai-copilot/src/browser/copilot-frontend-module.ts b/packages/ai-copilot/src/browser/copilot-frontend-module.ts new file mode 100644 index 0000000..3fd7551 --- /dev/null +++ b/packages/ai-copilot/src/browser/copilot-frontend-module.ts @@ -0,0 +1,86 @@ +// ***************************************************************************** +// Copyright (C) 2026 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import '../../src/browser/style/index.css'; + +import { ContainerModule } from '@theia/core/shared/inversify'; +import { CommandContribution, Emitter, Event, nls, PreferenceContribution } from '@theia/core'; +import { + FrontendApplicationContribution, + RemoteConnectionProvider, + ServiceConnectionProvider +} from '@theia/core/lib/browser'; +import { + CopilotLanguageModelsManager, + COPILOT_LANGUAGE_MODELS_MANAGER_PATH, + CopilotAuthService, + COPILOT_AUTH_SERVICE_PATH, + CopilotAuthServiceClient, + CopilotAuthState +} from '../common'; +import { CopilotPreferencesSchema } from '../common/copilot-preferences'; +import { CopilotFrontendApplicationContribution } from './copilot-frontend-application-contribution'; +import { CopilotCommandContribution } from './copilot-command-contribution'; +import { CopilotStatusBarContribution } from './copilot-status-bar-contribution'; +import { CopilotAuthDialog, CopilotAuthDialogProps } from './copilot-auth-dialog'; + +class CopilotAuthServiceClientImpl implements CopilotAuthServiceClient { + protected readonly onAuthStateChangedEmitter = new Emitter(); + readonly onAuthStateChangedEvent: Event = this.onAuthStateChangedEmitter.event; + onAuthStateChanged(state: CopilotAuthState): void { + this.onAuthStateChangedEmitter.fire(state); + } +} + +export default new ContainerModule(bind => { + bind(PreferenceContribution).toConstantValue({ schema: CopilotPreferencesSchema }); + + bind(CopilotCommandContribution).toSelf().inSingletonScope(); + bind(CommandContribution).toService(CopilotCommandContribution); + + bind(CopilotStatusBarContribution).toSelf().inSingletonScope(); + bind(FrontendApplicationContribution).toService(CopilotStatusBarContribution); + + bind(CopilotAuthDialogProps).toConstantValue({ + title: nls.localize('theia/ai/copilot/commands/signIn', 'Sign in to GitHub Copilot') + }); + bind(CopilotAuthDialog).toSelf().inSingletonScope(); + + bind(CopilotFrontendApplicationContribution).toSelf().inSingletonScope(); + bind(FrontendApplicationContribution).toService(CopilotFrontendApplicationContribution); + + bind(CopilotAuthServiceClientImpl).toConstantValue(new CopilotAuthServiceClientImpl()); + bind(CopilotAuthServiceClient).toService(CopilotAuthServiceClientImpl); + + bind(CopilotLanguageModelsManager).toDynamicValue(ctx => { + const provider = ctx.container.get(RemoteConnectionProvider); + return provider.createProxy(COPILOT_LANGUAGE_MODELS_MANAGER_PATH); + }).inSingletonScope(); + + bind(CopilotAuthService).toDynamicValue(ctx => { + const provider = ctx.container.get(RemoteConnectionProvider); + const clientImpl = ctx.container.get(CopilotAuthServiceClientImpl); + const proxy = provider.createProxy(COPILOT_AUTH_SERVICE_PATH, clientImpl); + return new Proxy(proxy, { + get(target: CopilotAuthService, prop: string | symbol, receiver: unknown): unknown { + if (prop === 'onAuthStateChanged') { + return clientImpl.onAuthStateChangedEvent; + } + return Reflect.get(target, prop, receiver); + } + }) as CopilotAuthService; + }).inSingletonScope(); +}); diff --git a/packages/ai-copilot/src/browser/copilot-status-bar-contribution.ts b/packages/ai-copilot/src/browser/copilot-status-bar-contribution.ts new file mode 100644 index 0000000..6ce58fc --- /dev/null +++ b/packages/ai-copilot/src/browser/copilot-status-bar-contribution.ts @@ -0,0 +1,88 @@ +// ***************************************************************************** +// Copyright (C) 2026 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { inject, injectable, postConstruct } from '@theia/core/shared/inversify'; +import { FrontendApplicationContribution } from '@theia/core/lib/browser'; +import { StatusBar, StatusBarAlignment } from '@theia/core/lib/browser/status-bar/status-bar-types'; +import { Disposable, DisposableCollection, nls } from '@theia/core'; +import { CopilotAuthService, CopilotAuthState } from '../common/copilot-auth-service'; +import { CopilotCommands } from './copilot-command-contribution'; + +const COPILOT_STATUS_BAR_ID = 'copilot-auth-status'; + +/** + * Frontend contribution that displays GitHub Copilot authentication status in the status bar. + */ +@injectable() +export class CopilotStatusBarContribution implements FrontendApplicationContribution, Disposable { + + @inject(StatusBar) + protected readonly statusBar: StatusBar; + + @inject(CopilotAuthService) + protected readonly authService: CopilotAuthService; + + protected authState: CopilotAuthState = { isAuthenticated: false }; + protected readonly toDispose = new DisposableCollection(); + + @postConstruct() + protected init(): void { + this.toDispose.push(this.authService.onAuthStateChanged(state => { + this.authState = state; + this.updateStatusBar(); + })); + } + + dispose(): void { + this.toDispose.dispose(); + } + + onStart(): void { + this.authService.getAuthState().then(state => { + this.authState = state; + this.updateStatusBar(); + }); + } + + protected updateStatusBar(): void { + const isAuthenticated = this.authState.isAuthenticated; + + let text: string; + let tooltip: string; + let command: string; + + if (isAuthenticated) { + const accountLabel = this.authState.accountLabel ?? 'GitHub'; + text = `$(github) ${accountLabel}`; + tooltip = nls.localize('theia/ai/copilot/statusBar/signedIn', + 'Signed in to GitHub Copilot as {0}. Click to sign out.', accountLabel); + command = CopilotCommands.SIGN_OUT.id; + } else { + text = '$(github) Copilot'; + tooltip = nls.localize('theia/ai/copilot/statusBar/signedOut', + 'Not signed in to GitHub Copilot. Click to sign in.'); + command = CopilotCommands.SIGN_IN.id; + } + + this.statusBar.setElement(COPILOT_STATUS_BAR_ID, { + text, + tooltip, + alignment: StatusBarAlignment.RIGHT, + priority: 100, + command + }); + } +} diff --git a/packages/ai-copilot/src/browser/index.ts b/packages/ai-copilot/src/browser/index.ts new file mode 100644 index 0000000..9092475 --- /dev/null +++ b/packages/ai-copilot/src/browser/index.ts @@ -0,0 +1,20 @@ +// ***************************************************************************** +// Copyright (C) 2026 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +export * from './copilot-auth-dialog'; +export * from './copilot-command-contribution'; +export * from './copilot-status-bar-contribution'; +export * from './copilot-frontend-application-contribution'; diff --git a/packages/ai-copilot/src/browser/style/index.css b/packages/ai-copilot/src/browser/style/index.css new file mode 100644 index 0000000..01c098c --- /dev/null +++ b/packages/ai-copilot/src/browser/style/index.css @@ -0,0 +1,167 @@ +/* ***************************************************************************** + * Copyright (C) 2026 EclipseSource GmbH. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the Eclipse + * Public License v. 2.0 are satisfied: GNU General Public License, version 2 + * with the GNU Classpath Exception which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 + **************************************************************************** */ + +.theia-copilot-auth-dialog-content { + padding: 16px; + min-width: 400px; +} + +.theia-copilot-auth-state { + display: flex; + flex-direction: column; + align-items: center; + gap: 12px; + padding: 24px; +} + +.theia-copilot-auth-state .theia-spin { + font-size: 32px; +} + +.theia-copilot-auth-success .codicon-check { + font-size: 48px; + color: var(--theia-successBackground); +} + +.theia-copilot-auth-error .codicon-error { + font-size: 48px; + color: var(--theia-errorForeground); +} + +.theia-copilot-auth-waiting { + display: flex; + flex-direction: column; + gap: 16px; +} + +.theia-copilot-auth-instructions { + margin: 0; + line-height: 1.5; +} + +.theia-copilot-auth-code-section { + display: flex; + justify-content: center; +} + +.theia-copilot-auth-code-display { + display: flex; + align-items: center; + gap: 12px; + padding: 12px 16px; + background: var(--theia-editor-background); + border-radius: 4px; + border: 1px solid var(--theia-panel-border); +} + +.theia-copilot-auth-code { + font-family: var(--theia-code-font-family); + font-size: 24px; + font-weight: bold; + letter-spacing: 2px; + color: var(--theia-textLink-foreground); +} + +.theia-copilot-copy-button { + display: flex; + align-items: center; + gap: 4px; + padding: 4px 8px; +} + +.theia-copilot-auth-url-section { + display: flex; + align-items: center; + gap: 12px; + justify-content: center; +} + +.theia-copilot-open-url-button { + display: flex; + align-items: center; + gap: 6px; +} + +.theia-copilot-auth-url { + font-family: var(--theia-code-font-family); + font-size: 12px; + color: var(--theia-descriptionForeground); +} + +.theia-copilot-auth-hint { + margin: 0; + font-size: 12px; + color: var(--theia-descriptionForeground); + text-align: center; +} + +.theia-copilot-auth-privacy { + margin-top: 8px; + padding-top: 12px; + border-top: 1px solid var(--theia-panel-border); +} + +.theia-copilot-auth-privacy-text, +.theia-copilot-auth-tos-text { + margin: 0 0 8px 0; + font-size: 11px; + color: var(--theia-descriptionForeground); + line-height: 1.4; +} + +.theia-copilot-auth-tos-text:last-child { + margin-bottom: 0; +} + +.theia-copilot-auth-privacy a { + color: var(--theia-textLink-foreground); + text-decoration: none; +} + +.theia-copilot-auth-privacy a:hover { + text-decoration: underline; +} + +.theia-copilot-auth-success-hint { + margin: 8px 0 0 0; + font-size: 12px; + color: var(--theia-descriptionForeground); + text-align: center; +} + +.theia-copilot-auth-success-hint a { + color: var(--theia-textLink-foreground); + text-decoration: none; + cursor: pointer; +} + +.theia-copilot-auth-success-hint a:hover { + text-decoration: underline; +} + +/* Spinning animation for loading indicator */ +.theia-spin .codicon { + animation: spin 1s linear infinite; +} + +@keyframes spin { + from { + transform: rotate(0deg); + } + to { + transform: rotate(360deg); + } +} diff --git a/packages/ai-copilot/src/common/copilot-auth-service.ts b/packages/ai-copilot/src/common/copilot-auth-service.ts new file mode 100644 index 0000000..b4797d3 --- /dev/null +++ b/packages/ai-copilot/src/common/copilot-auth-service.ts @@ -0,0 +1,103 @@ +// ***************************************************************************** +// Copyright (C) 2026 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { Event } from '@theia/core'; + +export const COPILOT_AUTH_SERVICE_PATH = '/services/copilot/auth'; +export const CopilotAuthService = Symbol('CopilotAuthService'); +export const CopilotAuthServiceClient = Symbol('CopilotAuthServiceClient'); + +/** + * Response from GitHub's device code endpoint. + */ +export interface DeviceCodeResponse { + /** URL where user should enter the code (e.g., https://github.com/login/device) */ + verification_uri: string; + /** Code to display to the user (e.g., XXXX-XXXX) */ + user_code: string; + /** Device code used for polling */ + device_code: string; + /** Polling interval in seconds */ + interval: number; + /** Expiration time in seconds */ + expires_in: number; +} + +/** + * Current authentication state. + */ +export interface CopilotAuthState { + /** Whether the user is authenticated */ + isAuthenticated: boolean; + /** GitHub username if authenticated */ + accountLabel?: string; + /** GitHub Enterprise URL if using enterprise */ + enterpriseUrl?: string; +} + +/** + * Client interface for receiving auth state change notifications. + */ +export interface CopilotAuthServiceClient { + onAuthStateChanged(state: CopilotAuthState): void; +} + +/** + * Service for handling GitHub Copilot OAuth Device Flow authentication. + */ +export interface CopilotAuthService { + /** + * Initiates the OAuth Device Flow. + * Returns device code information for the UI to display. + * @param enterpriseUrl Optional GitHub Enterprise domain + */ + initiateDeviceFlow(enterpriseUrl?: string): Promise; + + /** + * Polls for the access token after user authorizes. + * @param deviceCode The device code from initiateDeviceFlow + * @param interval Polling interval in seconds + * @param enterpriseUrl Optional GitHub Enterprise domain + * @returns true if authentication succeeded, false if expired/denied + */ + pollForToken(deviceCode: string, interval: number, enterpriseUrl?: string): Promise; + + /** + * Get the current authentication state. + */ + getAuthState(): Promise; + + /** + * Get the access token for API calls. + * @returns The access token or undefined if not authenticated + */ + getAccessToken(): Promise; + + /** + * Sign out and clear stored credentials. + */ + signOut(): Promise; + + /** + * Set the client to receive auth state change notifications. + */ + setClient(client: CopilotAuthServiceClient | undefined): void; + + /** + * Event fired when authentication state changes. + */ + readonly onAuthStateChanged: Event; +} diff --git a/packages/ai-copilot/src/common/copilot-language-models-manager.ts b/packages/ai-copilot/src/common/copilot-language-models-manager.ts new file mode 100644 index 0000000..dbd2646 --- /dev/null +++ b/packages/ai-copilot/src/common/copilot-language-models-manager.ts @@ -0,0 +1,59 @@ +// ***************************************************************************** +// Copyright (C) 2026 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +export const COPILOT_LANGUAGE_MODELS_MANAGER_PATH = '/services/copilot/language-model-manager'; +export const CopilotLanguageModelsManager = Symbol('CopilotLanguageModelsManager'); + +export const COPILOT_PROVIDER_ID = 'copilot'; + +export interface CopilotModelDescription { + /** + * The identifier of the model which will be shown in the UI. + * Format: copilot/{modelName} + */ + id: string; + /** + * The model ID as used by the Copilot API (e.g., 'gpt-4o', 'claude-3.5-sonnet'). + */ + model: string; + /** + * Indicate whether the streaming API shall be used. + */ + enableStreaming: boolean; + /** + * Flag to configure whether the model supports structured output. + */ + supportsStructuredOutput: boolean; + /** + * Maximum number of retry attempts when a request fails. + */ + maxRetries: number; +} + +export interface CopilotLanguageModelsManager { + /** + * Create or update language models in the registry. + */ + createOrUpdateLanguageModels(...models: CopilotModelDescription[]): Promise; + /** + * Remove language models from the registry. + */ + removeLanguageModels(...modelIds: string[]): void; + /** + * Refresh the status of all Copilot models (e.g., after authentication state changes). + */ + refreshModelsStatus(): Promise; +} diff --git a/packages/ai-copilot/src/common/copilot-preferences.ts b/packages/ai-copilot/src/common/copilot-preferences.ts new file mode 100644 index 0000000..cc3d92a --- /dev/null +++ b/packages/ai-copilot/src/common/copilot-preferences.ts @@ -0,0 +1,53 @@ +// ***************************************************************************** +// Copyright (C) 2026 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { AI_CORE_PREFERENCES_TITLE } from '@theia/ai-core/lib/common/ai-core-preferences'; +import { nls, PreferenceSchema } from '@theia/core'; + +export const COPILOT_MODELS_PREF = 'ai-features.copilot.models'; +export const COPILOT_ENTERPRISE_URL_PREF = 'ai-features.copilot.enterpriseUrl'; + +export const CopilotPreferencesSchema: PreferenceSchema = { + properties: { + [COPILOT_MODELS_PREF]: { + type: 'array', + description: nls.localize('theia/ai/copilot/models/description', + 'GitHub Copilot models to use. Available models depend on your Copilot subscription.'), + title: AI_CORE_PREFERENCES_TITLE, + // https://models.dev/?search=copilot + default: [ + 'claude-haiku-4.5', + 'claude-sonnet-4.5', + 'claude-opus-4.5', + 'gemini-2.5-pro', + 'gpt-4.1', + 'gpt-4o', + 'gpt-5-mini', + 'gpt-5.2', + ], + items: { + type: 'string' + } + }, + [COPILOT_ENTERPRISE_URL_PREF]: { + type: 'string', + markdownDescription: nls.localize('theia/ai/copilot/enterpriseUrl/mdDescription', + 'GitHub Enterprise domain for Copilot API (e.g., `github.mycompany.com`). Leave empty for GitHub.com.'), + title: AI_CORE_PREFERENCES_TITLE, + default: '' + } + } +}; diff --git a/packages/ai-copilot/src/common/index.ts b/packages/ai-copilot/src/common/index.ts new file mode 100644 index 0000000..76e3c86 --- /dev/null +++ b/packages/ai-copilot/src/common/index.ts @@ -0,0 +1,19 @@ +// ***************************************************************************** +// Copyright (C) 2026 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +export * from './copilot-language-models-manager'; +export * from './copilot-auth-service'; +export * from './copilot-preferences'; diff --git a/packages/ai-copilot/src/node/copilot-auth-service-impl.ts b/packages/ai-copilot/src/node/copilot-auth-service-impl.ts new file mode 100644 index 0000000..0be58e4 --- /dev/null +++ b/packages/ai-copilot/src/node/copilot-auth-service-impl.ts @@ -0,0 +1,274 @@ +// ***************************************************************************** +// Copyright (C) 2026 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { inject, injectable } from '@theia/core/shared/inversify'; +import { Emitter, Event } from '@theia/core'; +import { KeyStoreService } from '@theia/core/lib/common/key-store'; +import { + CopilotAuthService, + CopilotAuthServiceClient, + CopilotAuthState, + DeviceCodeResponse +} from '../common/copilot-auth-service'; + +const COPILOT_CLIENT_ID = 'Iv23ctNZvWb5IGBKdyPY'; +const COPILOT_SCOPE = 'read:user'; +const COPILOT_GRANT_TYPE = 'urn:ietf:params:oauth:grant-type:device_code'; +const KEYSTORE_SERVICE = 'theia-copilot-auth'; +const KEYSTORE_ACCOUNT = 'github-copilot'; +const USER_AGENT = 'Theia-Copilot/1.0.0'; + +/** + * Maximum number of polling attempts for token retrieval. + * With a default 5-second interval, this allows approximately 5 minutes of polling. + */ +const MAX_POLLING_ATTEMPTS = 60; + +interface StoredCredentials { + accessToken: string; + accountLabel?: string; + enterpriseUrl?: string; +} + +/** + * Backend implementation of the GitHub Copilot OAuth Device Flow authentication service. + * Handles device code generation, token polling, and credential storage. + */ +@injectable() +export class CopilotAuthServiceImpl implements CopilotAuthService { + + @inject(KeyStoreService) + protected readonly keyStoreService: KeyStoreService; + + protected client: CopilotAuthServiceClient | undefined; + protected cachedState: CopilotAuthState | undefined; + + protected readonly onAuthStateChangedEmitter = new Emitter(); + readonly onAuthStateChanged: Event = this.onAuthStateChangedEmitter.event; + + setClient(client: CopilotAuthServiceClient | undefined): void { + this.client = client; + } + + protected getOAuthEndpoints(enterpriseUrl?: string): { deviceCodeUrl: string; accessTokenUrl: string } { + if (enterpriseUrl) { + const domain = enterpriseUrl + .replace(/^https?:\/\//, '') + .replace(/\/$/, ''); + return { + deviceCodeUrl: `https://${domain}/login/device/code`, + accessTokenUrl: `https://${domain}/login/oauth/access_token` + }; + } + return { + deviceCodeUrl: 'https://github.com/login/device/code', + accessTokenUrl: 'https://github.com/login/oauth/access_token' + }; + } + + async initiateDeviceFlow(enterpriseUrl?: string): Promise { + const endpoints = this.getOAuthEndpoints(enterpriseUrl); + + const response = await fetch(endpoints.deviceCodeUrl, { + method: 'POST', + headers: { + 'Accept': 'application/json', + 'Content-Type': 'application/json', + 'User-Agent': USER_AGENT + }, + body: JSON.stringify({ + client_id: COPILOT_CLIENT_ID, + scope: COPILOT_SCOPE + }) + }); + + if (!response.ok) { + const errorText = await response.text(); + throw new Error(`Failed to initiate device authorization: ${response.status} - ${errorText}`); + } + + const data = await response.json() as DeviceCodeResponse; + return data; + } + + async pollForToken(deviceCode: string, interval: number, enterpriseUrl?: string): Promise { + const endpoints = this.getOAuthEndpoints(enterpriseUrl); + let attempts = 0; + + while (attempts < MAX_POLLING_ATTEMPTS) { + await this.delay(interval * 1000); + attempts++; + + const response = await fetch(endpoints.accessTokenUrl, { + method: 'POST', + headers: { + 'Accept': 'application/json', + 'Content-Type': 'application/json', + 'User-Agent': USER_AGENT + }, + body: JSON.stringify({ + client_id: COPILOT_CLIENT_ID, + device_code: deviceCode, + grant_type: COPILOT_GRANT_TYPE + }) + }); + + if (!response.ok) { + console.error(`Token request failed: ${response.status}`); + continue; + } + + const data = await response.json() as { + access_token?: string; + error?: string; + error_description?: string; + }; + + if (data.access_token) { + // Get user info for account label + const accountLabel = await this.fetchAccountLabel(data.access_token, enterpriseUrl); + + // Store credentials + const credentials: StoredCredentials = { + accessToken: data.access_token, + accountLabel, + enterpriseUrl + }; + + await this.keyStoreService.setPassword( + KEYSTORE_SERVICE, + KEYSTORE_ACCOUNT, + JSON.stringify(credentials) + ); + + // Update cached state and notify + const newState: CopilotAuthState = { + isAuthenticated: true, + accountLabel, + enterpriseUrl + }; + this.updateAuthState(newState); + + return true; + } + + if (data.error === 'authorization_pending') { + // User hasn't authorized yet, continue polling + continue; + } + + if (data.error === 'slow_down') { + // Increase polling interval + interval += 5; + continue; + } + + if (data.error === 'expired_token' || data.error === 'access_denied') { + console.error(`Authorization failed: ${data.error} - ${data.error_description}`); + return false; + } + + if (data.error) { + console.error(`Unexpected error: ${data.error} - ${data.error_description}`); + return false; + } + } + + return false; + } + + protected async fetchAccountLabel(accessToken: string, enterpriseUrl?: string): Promise { + try { + const apiBaseUrl = enterpriseUrl + ? `https://${enterpriseUrl.replace(/^https?:\/\//, '').replace(/\/$/, '')}/api/v3` + : 'https://api.github.com'; + + const response = await fetch(`${apiBaseUrl}/user`, { + headers: { + 'Authorization': `Bearer ${accessToken}`, + 'User-Agent': USER_AGENT, + 'Accept': 'application/vnd.github.v3+json' + } + }); + + if (response.ok) { + const userData = await response.json() as { login?: string }; + return userData.login; + } + } catch (error) { + console.warn('Failed to fetch GitHub user info:', error); + } + return undefined; + } + + async getAuthState(): Promise { + if (this.cachedState) { + return this.cachedState; + } + + try { + const stored = await this.keyStoreService.getPassword(KEYSTORE_SERVICE, KEYSTORE_ACCOUNT); + if (stored) { + const credentials: StoredCredentials = JSON.parse(stored); + this.cachedState = { + isAuthenticated: true, + accountLabel: credentials.accountLabel, + enterpriseUrl: credentials.enterpriseUrl + }; + return this.cachedState; + } + } catch (error) { + console.warn('Failed to retrieve Copilot credentials:', error); + } + + this.cachedState = { isAuthenticated: false }; + return this.cachedState; + } + + async getAccessToken(): Promise { + try { + const stored = await this.keyStoreService.getPassword(KEYSTORE_SERVICE, KEYSTORE_ACCOUNT); + if (stored) { + const credentials: StoredCredentials = JSON.parse(stored); + return credentials.accessToken; + } + } catch (error) { + console.warn('Failed to retrieve Copilot access token:', error); + } + return undefined; + } + + async signOut(): Promise { + try { + await this.keyStoreService.deletePassword(KEYSTORE_SERVICE, KEYSTORE_ACCOUNT); + } catch (error) { + console.warn('Failed to delete Copilot credentials:', error); + } + + const newState: CopilotAuthState = { isAuthenticated: false }; + this.updateAuthState(newState); + } + + protected updateAuthState(state: CopilotAuthState): void { + this.cachedState = state; + this.onAuthStateChangedEmitter.fire(state); + this.client?.onAuthStateChanged(state); + } + + protected delay(ms: number): Promise { + return new Promise(resolve => setTimeout(resolve, ms)); + } +} diff --git a/packages/ai-copilot/src/node/copilot-backend-module.ts b/packages/ai-copilot/src/node/copilot-backend-module.ts new file mode 100644 index 0000000..a9a9dc7 --- /dev/null +++ b/packages/ai-copilot/src/node/copilot-backend-module.ts @@ -0,0 +1,58 @@ +// ***************************************************************************** +// Copyright (C) 2026 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { ContainerModule } from '@theia/core/shared/inversify'; +import { ConnectionHandler, RpcConnectionHandler } from '@theia/core'; +import { ConnectionContainerModule } from '@theia/core/lib/node/messaging/connection-container-module'; +import { + CopilotLanguageModelsManager, + COPILOT_LANGUAGE_MODELS_MANAGER_PATH, + CopilotAuthService, + COPILOT_AUTH_SERVICE_PATH, + CopilotAuthServiceClient +} from '../common'; +import { CopilotLanguageModelsManagerImpl } from './copilot-language-models-manager-impl'; +import { CopilotAuthServiceImpl } from './copilot-auth-service-impl'; + +const copilotConnectionModule = ConnectionContainerModule.create(({ bind }) => { + bind(CopilotAuthServiceImpl).toSelf().inSingletonScope(); + bind(CopilotAuthService).toService(CopilotAuthServiceImpl); + + bind(CopilotLanguageModelsManagerImpl).toSelf().inSingletonScope(); + bind(CopilotLanguageModelsManager).toService(CopilotLanguageModelsManagerImpl); + + bind(ConnectionHandler).toDynamicValue(ctx => + new RpcConnectionHandler( + COPILOT_AUTH_SERVICE_PATH, + client => { + const authService = ctx.container.get(CopilotAuthService); + authService.setClient(client); + return authService; + } + ) + ).inSingletonScope(); + + bind(ConnectionHandler).toDynamicValue(ctx => + new RpcConnectionHandler( + COPILOT_LANGUAGE_MODELS_MANAGER_PATH, + () => ctx.container.get(CopilotLanguageModelsManager) + ) + ).inSingletonScope(); +}); + +export default new ContainerModule(bind => { + bind(ConnectionContainerModule).toConstantValue(copilotConnectionModule); +}); diff --git a/packages/ai-copilot/src/node/copilot-language-model.ts b/packages/ai-copilot/src/node/copilot-language-model.ts new file mode 100644 index 0000000..4eb1760 --- /dev/null +++ b/packages/ai-copilot/src/node/copilot-language-model.ts @@ -0,0 +1,262 @@ +// ***************************************************************************** +// Copyright (C) 2026 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { + ImageContent, + LanguageModel, + LanguageModelMessage, + LanguageModelParsedResponse, + LanguageModelRequest, + LanguageModelResponse, + LanguageModelStatus, + LanguageModelTextResponse, + TokenUsageService, + UserRequest +} from '@theia/ai-core'; +import { CancellationToken } from '@theia/core'; +import OpenAI from 'openai'; +import { RunnableToolFunctionWithoutParse } from 'openai/lib/RunnableFunction'; +import { ChatCompletionMessageParam } from 'openai/resources'; +import { StreamingAsyncIterator } from '@theia/ai-openai/lib/node/openai-streaming-iterator'; +import { COPILOT_PROVIDER_ID } from '../common'; +import type { RunnerOptions } from 'openai/lib/AbstractChatCompletionRunner'; +import type { ChatCompletionStream } from 'openai/lib/ChatCompletionStream'; + +const COPILOT_API_BASE_URL = 'https://api.githubcopilot.com'; +const USER_AGENT = 'Theia-Copilot/1.0.0'; + +/** + * Language model implementation for GitHub Copilot. + * Uses the OpenAI SDK to communicate with the Copilot API. + */ +export class CopilotLanguageModel implements LanguageModel { + + protected runnerOptions: RunnerOptions = { + maxChatCompletions: 100 + }; + + constructor( + public readonly id: string, + public model: string, + public status: LanguageModelStatus, + public enableStreaming: boolean, + public supportsStructuredOutput: boolean, + public maxRetries: number, + protected readonly accessTokenProvider: () => Promise, + protected readonly enterpriseUrlProvider: () => string | undefined, + protected readonly tokenUsageService?: TokenUsageService + ) { } + + protected getSettings(request: LanguageModelRequest): Record { + return request.settings ?? {}; + } + + async request(request: UserRequest, cancellationToken?: CancellationToken): Promise { + const openai = await this.initializeCopilotClient(); + + if (request.response_format?.type === 'json_schema' && this.supportsStructuredOutput) { + return this.handleStructuredOutputRequest(openai, request); + } + + const settings = this.getSettings(request); + + if (!this.enableStreaming || (typeof settings.stream === 'boolean' && !settings.stream)) { + return this.handleNonStreamingRequest(openai, request); + } + + if (cancellationToken?.isCancellationRequested) { + return { text: '' }; + } + + if (this.id.startsWith(`${COPILOT_PROVIDER_ID}/`)) { + settings['stream_options'] = { include_usage: true }; + } + + let runner: ChatCompletionStream; + const tools = this.createTools(request); + + if (tools) { + runner = openai.chat.completions.runTools({ + model: this.model, + messages: this.processMessages(request.messages), + stream: true, + tools: tools, + tool_choice: 'auto', + ...settings + }, { + ...this.runnerOptions, + maxRetries: this.maxRetries + }); + } else { + runner = openai.chat.completions.stream({ + model: this.model, + messages: this.processMessages(request.messages), + stream: true, + ...settings + }); + } + + // eslint-disable-next-line @typescript-eslint/no-explicit-any + return { stream: new StreamingAsyncIterator(runner as any, request.requestId, cancellationToken, this.tokenUsageService, this.id) }; + } + + protected async handleNonStreamingRequest(openai: OpenAI, request: UserRequest): Promise { + const settings = this.getSettings(request); + const response = await openai.chat.completions.create({ + model: this.model, + messages: this.processMessages(request.messages), + ...settings + }); + + const message = response.choices[0].message; + + if (this.tokenUsageService && response.usage) { + await this.tokenUsageService.recordTokenUsage( + this.id, + { + inputTokens: response.usage.prompt_tokens, + outputTokens: response.usage.completion_tokens, + requestId: request.requestId + } + ); + } + + return { + text: message.content ?? '' + }; + } + + protected async handleStructuredOutputRequest(openai: OpenAI, request: UserRequest): Promise { + const settings = this.getSettings(request); + const result = await openai.chat.completions.parse({ + model: this.model, + messages: this.processMessages(request.messages), + response_format: request.response_format, + ...settings + }); + + const message = result.choices[0].message; + if (message.refusal || message.parsed === undefined) { + console.error('Error in Copilot chat completion:', JSON.stringify(message)); + } + + if (this.tokenUsageService && result.usage) { + await this.tokenUsageService.recordTokenUsage( + this.id, + { + inputTokens: result.usage.prompt_tokens, + outputTokens: result.usage.completion_tokens, + requestId: request.requestId + } + ); + } + + return { + content: message.content ?? '', + parsed: message.parsed + }; + } + + protected createTools(request: LanguageModelRequest): RunnableToolFunctionWithoutParse[] | undefined { + return request.tools?.map(tool => ({ + type: 'function', + function: { + name: tool.name, + description: tool.description, + parameters: tool.parameters, + function: (args_string: string) => tool.handler(args_string) + } + } as RunnableToolFunctionWithoutParse)); + } + + protected async initializeCopilotClient(): Promise { + const accessToken = await this.accessTokenProvider(); + if (!accessToken) { + throw new Error('Not authenticated with GitHub Copilot. Please sign in first.'); + } + + const enterpriseUrl = this.enterpriseUrlProvider(); + const baseURL = enterpriseUrl + ? `https://copilot-api.${enterpriseUrl.replace(/^https?:\/\//, '').replace(/\/$/, '')}` + : COPILOT_API_BASE_URL; + + return new OpenAI({ + apiKey: accessToken, + baseURL, + defaultHeaders: { + 'User-Agent': USER_AGENT, + 'Openai-Intent': 'conversation-edits', + 'X-Initiator': 'user' + } + }); + } + + protected processMessages(messages: LanguageModelMessage[]): ChatCompletionMessageParam[] { + return messages.filter(m => m.type !== 'thinking').map(m => this.toOpenAIMessage(m)); + } + + protected toOpenAIMessage(message: LanguageModelMessage): ChatCompletionMessageParam { + if (LanguageModelMessage.isTextMessage(message)) { + return { + role: this.toOpenAiRole(message), + content: message.text + }; + } + if (LanguageModelMessage.isToolUseMessage(message)) { + return { + role: 'assistant', + tool_calls: [{ + id: message.id, + function: { + name: message.name, + arguments: JSON.stringify(message.input) + }, + type: 'function' + }] + }; + } + if (LanguageModelMessage.isToolResultMessage(message)) { + return { + role: 'tool', + tool_call_id: message.tool_use_id, + content: typeof message.content === 'string' ? message.content : JSON.stringify(message.content) + }; + } + if (LanguageModelMessage.isImageMessage(message) && message.actor === 'user') { + return { + role: 'user', + content: [{ + type: 'image_url', + image_url: { + url: ImageContent.isBase64(message.image) + ? `data:${message.image.mimeType};base64,${message.image.base64data}` + : message.image.url + } + }] + }; + } + throw new Error(`Unknown message type: '${JSON.stringify(message)}'`); + } + + protected toOpenAiRole(message: LanguageModelMessage): 'developer' | 'user' | 'assistant' | 'system' { + if (message.actor === 'system') { + return 'developer'; + } else if (message.actor === 'ai') { + return 'assistant'; + } + return 'user'; + } +} diff --git a/packages/ai-copilot/src/node/copilot-language-models-manager-impl.ts b/packages/ai-copilot/src/node/copilot-language-models-manager-impl.ts new file mode 100644 index 0000000..2397b79 --- /dev/null +++ b/packages/ai-copilot/src/node/copilot-language-models-manager-impl.ts @@ -0,0 +1,118 @@ +// ***************************************************************************** +// Copyright (C) 2026 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { LanguageModelRegistry, LanguageModelStatus, TokenUsageService } from '@theia/ai-core'; +import { Disposable, DisposableCollection } from '@theia/core'; +import { inject, injectable, postConstruct } from '@theia/core/shared/inversify'; +import { CopilotLanguageModelsManager, CopilotModelDescription, COPILOT_PROVIDER_ID } from '../common'; +import { CopilotLanguageModel } from './copilot-language-model'; +import { CopilotAuthServiceImpl } from './copilot-auth-service-impl'; + +/** + * Backend implementation of the Copilot language models manager. + * Manages registration and lifecycle of Copilot language models in the AI language model registry. + */ +@injectable() +export class CopilotLanguageModelsManagerImpl implements CopilotLanguageModelsManager, Disposable { + + @inject(LanguageModelRegistry) + protected readonly languageModelRegistry: LanguageModelRegistry; + + @inject(TokenUsageService) + protected readonly tokenUsageService: TokenUsageService; + + @inject(CopilotAuthServiceImpl) + protected readonly authService: CopilotAuthServiceImpl; + + protected enterpriseUrl: string | undefined; + protected readonly toDispose = new DisposableCollection(); + + @postConstruct() + protected init(): void { + this.toDispose.push(this.authService.onAuthStateChanged(() => { + this.refreshModelsStatus(); + })); + } + + dispose(): void { + this.toDispose.dispose(); + } + + setEnterpriseUrl(url: string | undefined): void { + this.enterpriseUrl = url; + } + + protected async calculateStatus(): Promise { + const authState = await this.authService.getAuthState(); + if (authState.isAuthenticated) { + return { status: 'ready' }; + } + return { status: 'unavailable', message: 'Not signed in to GitHub Copilot' }; + } + + async createOrUpdateLanguageModels(...modelDescriptions: CopilotModelDescription[]): Promise { + const status = await this.calculateStatus(); + + for (const modelDescription of modelDescriptions) { + const model = await this.languageModelRegistry.getLanguageModel(modelDescription.id); + + if (model) { + if (!(model instanceof CopilotLanguageModel)) { + console.warn(`Copilot: model ${modelDescription.id} is not a Copilot model`); + continue; + } + await this.languageModelRegistry.patchLanguageModel(modelDescription.id, { + model: modelDescription.model, + enableStreaming: modelDescription.enableStreaming, + supportsStructuredOutput: modelDescription.supportsStructuredOutput, + status, + maxRetries: modelDescription.maxRetries + }); + } else { + this.languageModelRegistry.addLanguageModels([ + new CopilotLanguageModel( + modelDescription.id, + modelDescription.model, + status, + modelDescription.enableStreaming, + modelDescription.supportsStructuredOutput, + modelDescription.maxRetries, + () => this.authService.getAccessToken(), + () => this.enterpriseUrl, + this.tokenUsageService + ) + ]); + } + } + } + + removeLanguageModels(...modelIds: string[]): void { + this.languageModelRegistry.removeLanguageModels(modelIds); + } + + async refreshModelsStatus(): Promise { + const status = await this.calculateStatus(); + const allModels = await this.languageModelRegistry.getLanguageModels(); + + for (const model of allModels) { + if (model instanceof CopilotLanguageModel && model.id.startsWith(`${COPILOT_PROVIDER_ID}/`)) { + await this.languageModelRegistry.patchLanguageModel(model.id, { + status + }); + } + } + } +} diff --git a/packages/ai-copilot/src/node/index.ts b/packages/ai-copilot/src/node/index.ts new file mode 100644 index 0000000..6970247 --- /dev/null +++ b/packages/ai-copilot/src/node/index.ts @@ -0,0 +1,19 @@ +// ***************************************************************************** +// Copyright (C) 2026 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +export * from './copilot-auth-service-impl'; +export * from './copilot-language-model'; +export * from './copilot-language-models-manager-impl'; diff --git a/packages/ai-copilot/src/package.spec.ts b/packages/ai-copilot/src/package.spec.ts new file mode 100644 index 0000000..dd88293 --- /dev/null +++ b/packages/ai-copilot/src/package.spec.ts @@ -0,0 +1,27 @@ +// ***************************************************************************** +// Copyright (C) 2026 EclipseSource GmbH and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +/* note: this bogus test file is required so that + we are able to run mocha unit tests on this + package, without having any actual unit tests in it. + This way a coverage report will be generated, + showing 0% coverage, instead of no report. + This file can be removed once we have real unit + tests in place. */ + +describe('ai-copilot package', () => { + it('support code coverage statistics', () => true); +}); diff --git a/packages/ai-copilot/tsconfig.json b/packages/ai-copilot/tsconfig.json new file mode 100644 index 0000000..143b254 --- /dev/null +++ b/packages/ai-copilot/tsconfig.json @@ -0,0 +1,22 @@ +{ + "extends": "../../configs/base.tsconfig", + "compilerOptions": { + "composite": true, + "rootDir": "src", + "outDir": "lib" + }, + "include": [ + "src" + ], + "references": [ + { + "path": "../ai-core" + }, + { + "path": "../ai-openai" + }, + { + "path": "../core" + } + ] +} diff --git a/packages/ai-core-ui/.eslintrc.js b/packages/ai-core-ui/.eslintrc.js new file mode 100644 index 0000000..1308994 --- /dev/null +++ b/packages/ai-core-ui/.eslintrc.js @@ -0,0 +1,10 @@ +/** @type {import('eslint').Linter.Config} */ +module.exports = { + extends: [ + '../../configs/build.eslintrc.json' + ], + parserOptions: { + tsconfigRootDir: __dirname, + project: 'tsconfig.json' + } +}; diff --git a/packages/ai-core-ui/README.md b/packages/ai-core-ui/README.md new file mode 100644 index 0000000..bf75a07 --- /dev/null +++ b/packages/ai-core-ui/README.md @@ -0,0 +1,35 @@ +
    + +
    + +theia-ext-logo + +

    ECLIPSE THEIA - AI CORE UI EXTENSION

    + +
    + +
    + +## Description + +The `@theia/ai-core-ui` extension provides the UI for the core AI integration in Theia. + +Provided UI: + +- Preferences Contribution + +## Additional Information + +- [API documentation for `@theia/ai-core-ui`](https://eclipse-theia.github.io/theia/docs/next/modules/_theia_ai-core-ui.html) +- [Theia - GitHub](https://github.com/eclipse-theia/theia) +- [Theia - Website](https://theia-ide.org/) + +## License + +- [Eclipse Public License 2.0](http://www.eclipse.org/legal/epl-2.0/) +- [一 (Secondary) GNU General Public License, version 2 with the GNU Classpath Exception](https://projects.eclipse.org/license/secondary-gpl-2.0-cp) + +## Trademark + +"Theia" is a trademark of the Eclipse Foundation + diff --git a/packages/ai-core-ui/package.json b/packages/ai-core-ui/package.json new file mode 100644 index 0000000..69ecdb6 --- /dev/null +++ b/packages/ai-core-ui/package.json @@ -0,0 +1,50 @@ +{ + "name": "@theia/ai-core-ui", + "version": "1.68.0", + "description": "Theia - AI Core UI", + "dependencies": { + "@theia/core": "1.68.0", + "@theia/ai-core": "1.68.0", + "tslib": "^2.6.2" + }, + "main": "lib/common", + "publishConfig": { + "access": "public" + }, + "theiaExtensions": [ + { + "frontend": "lib/browser/ai-core-ui-frontend-module" + } + ], + "keywords": [ + "theia-extension" + ], + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "repository": { + "type": "git", + "url": "https://github.com/eclipse-theia/theia.git" + }, + "bugs": { + "url": "https://github.com/eclipse-theia/theia/issues" + }, + "homepage": "https://github.com/eclipse-theia/theia", + "files": [ + "data", + "lib", + "src" + ], + "scripts": { + "build": "theiaext build", + "clean": "theiaext clean", + "compile": "theiaext compile", + "lint": "theiaext lint", + "test": "theiaext test", + "watch": "theiaext watch" + }, + "devDependencies": { + "@theia/ext-scripts": "1.68.0" + }, + "nyc": { + "extends": "../../configs/nyc.json" + } +} diff --git a/packages/ai-core-ui/src/browser/ai-core-ui-frontend-module.ts b/packages/ai-core-ui/src/browser/ai-core-ui-frontend-module.ts new file mode 100644 index 0000000..d166469 --- /dev/null +++ b/packages/ai-core-ui/src/browser/ai-core-ui-frontend-module.ts @@ -0,0 +1,25 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { ContainerModule } from '@theia/core/shared/inversify'; +import { PreferenceContribution } from '@theia/core'; +import { AgentSettingsPreferenceSchema } from '@theia/ai-core/lib/common/agent-preferences'; +import { aiCorePreferenceSchema } from '@theia/ai-core/lib/common/ai-core-preferences'; + +export default new ContainerModule(bind => { + bind(PreferenceContribution).toConstantValue({ schema: AgentSettingsPreferenceSchema }); + bind(PreferenceContribution).toConstantValue({ schema: aiCorePreferenceSchema }); +}); diff --git a/packages/ai-core-ui/src/package.spec.ts b/packages/ai-core-ui/src/package.spec.ts new file mode 100644 index 0000000..3c6f0f3 --- /dev/null +++ b/packages/ai-core-ui/src/package.spec.ts @@ -0,0 +1,28 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +/* note: this bogus test file is required so that + we are able to run mocha unit tests on this + package, without having any actual unit tests in it. + This way a coverage report will be generated, + showing 0% coverage, instead of no report. + This file can be removed once we have real unit + tests in place. */ + +describe('ai-core-ui package', () => { + + it('support code coverage statistics', () => true); +}); diff --git a/packages/ai-core-ui/tsconfig.json b/packages/ai-core-ui/tsconfig.json new file mode 100644 index 0000000..420367f --- /dev/null +++ b/packages/ai-core-ui/tsconfig.json @@ -0,0 +1,19 @@ +{ + "extends": "../../configs/base.tsconfig", + "compilerOptions": { + "composite": true, + "rootDir": "src", + "outDir": "lib" + }, + "include": [ + "src" + ], + "references": [ + { + "path": "../ai-core" + }, + { + "path": "../core" + } + ] +} diff --git a/packages/ai-core/.eslintrc.js b/packages/ai-core/.eslintrc.js new file mode 100644 index 0000000..1308994 --- /dev/null +++ b/packages/ai-core/.eslintrc.js @@ -0,0 +1,10 @@ +/** @type {import('eslint').Linter.Config} */ +module.exports = { + extends: [ + '../../configs/build.eslintrc.json' + ], + parserOptions: { + tsconfigRootDir: __dirname, + project: 'tsconfig.json' + } +}; diff --git a/packages/ai-core/README.md b/packages/ai-core/README.md new file mode 100644 index 0000000..2737e85 --- /dev/null +++ b/packages/ai-core/README.md @@ -0,0 +1,64 @@ +
    + +
    + +theia-ext-logo + +

    ECLIPSE THEIA - AI CORE EXTENSION

    + +
    + +
    + +## Description + +The `@theia/ai-core` extension serves as the basis of all AI integration in Theia. +It manages the integration of language models and provides core concepts like agents, prompts, AI variables, and skills. + +### Skills + +Skills provide reusable instructions and domain knowledge for AI agents. A skill is a directory containing a `SKILL.md` file with YAML frontmatter (name, description) and markdown content. + +#### Skill Directories + +Skills are discovered from multiple locations, processed in priority order (first wins on duplicates): + +1. **Workspace:** `.prompts/skills/` in the workspace root (project-specific skills) +2. **User-configured:** Directories listed in `ai-features.skills.skillDirectories` preference +3. **Global:** `~/.theia/skills/` (user defaults) + +#### Skill Structure + +Each skill must be in its own directory with the directory name matching the skill name: + +```text +skills/ +├── my-skill/ +│ └── SKILL.md +└── another-skill/ + └── SKILL.md +``` + +#### Usage + +- Add `{{skills}}` to an agent's prompt to inject available skills as XML (name and description) +- Agents can read full skill content using the `getSkillFileContent` tool with the skill name + +Enablement of the Theia AI feature is managed via the AI preferences, contributed by `@theia/ai-core-ui`. +Either include `@theia/ai-core-ui` or bind the included preferences schemas in your Theia based application. + +## Additional Information + +- [API documentation for `@theia/ai-core`](https://eclipse-theia.github.io/theia/docs/next/modules/_theia_ai-core.html) +- [Theia - GitHub](https://github.com/eclipse-theia/theia) +- [Theia - Website](https://theia-ide.org/) + +## License + +- [Eclipse Public License 2.0](http://www.eclipse.org/legal/epl-2.0/) +- [一 (Secondary) GNU General Public License, version 2 with the GNU Classpath Exception](https://projects.eclipse.org/license/secondary-gpl-2.0-cp) + +## Trademark + +"Theia" is a trademark of the Eclipse Foundation + diff --git a/packages/ai-core/data/prompttemplate.tmLanguage.json b/packages/ai-core/data/prompttemplate.tmLanguage.json new file mode 100644 index 0000000..76d2264 --- /dev/null +++ b/packages/ai-core/data/prompttemplate.tmLanguage.json @@ -0,0 +1,110 @@ +{ + "scopeName": "source.prompttemplate", + "patterns": [ + { + "name": "invalid.illegal.mismatched.prompttemplate", + "match": "\\{\\{\\{[^{}]*\\}\\}(?!\\})", + "captures": { + "0": { + "name": "invalid.illegal.bracket.mismatch" + } + } + }, + { + "name": "invalid.illegal.mismatched.prompttemplate", + "match": "\\{\\{[^{}]*\\}\\}\\}(?!\\})", + "captures": { + "0": { + "name": "invalid.illegal.bracket.mismatch" + } + } + }, + { + "name": "comment.block.prompttemplate", + "begin": "\\A{{!--", + "beginCaptures": { + "0": { + "name": "punctuation.definition.comment.begin" + } + }, + "end": "--}}", + "endCaptures": { + "0": { + "name": "punctuation.definition.comment.end" + } + }, + "patterns": [] + }, + { + "name": "variable.other.prompttemplate.double", + "begin": "\\{\\{", + "beginCaptures": { + "0": { + "name": "punctuation.definition.variable.begin" + } + }, + "end": "\\}\\}(?!\\})", + "endCaptures": { + "0": { + "name": "punctuation.definition.variable.end" + } + }, + "patterns": [ + { + "name": "keyword.control", + "match": "[a-zA-Z_][a-zA-Z0-9_]*" + } + ] + }, + { + "name": "variable.other.prompttemplate.triple", + "begin": "\\{\\{\\{", + "beginCaptures": { + "0": { + "name": "punctuation.definition.variable.begin" + } + }, + "end": "\\}\\}\\}(?!\\})", + "endCaptures": { + "0": { + "name": "punctuation.definition.variable.end" + } + }, + "patterns": [ + { + "name": "keyword.control", + "match": "[a-zA-Z_][a-zA-Z0-9_]*" + } + ] + }, + { + "name": "support.function.prompttemplate", + "begin": "~{", + "beginCaptures": { + "0": { + "name": "punctuation.definition.brace.begin" + } + }, + "end": "}", + "endCaptures": { + "0": { + "name": "punctuation.definition.brace.end" + } + }, + "patterns": [ + { + "name": "keyword.control", + "match": "[a-zA-Z_][a-zA-Z0-9_\\-]*" + } + ] + }, + { + "include": "text.html.markdown" + } + ], + "repository": {}, + "name": "PromptTemplate", + "fileTypes": [ + ".prompttemplate" + ] +} diff --git a/packages/ai-core/package.json b/packages/ai-core/package.json new file mode 100644 index 0000000..7c18bbb --- /dev/null +++ b/packages/ai-core/package.json @@ -0,0 +1,61 @@ +{ + "name": "@theia/ai-core", + "version": "1.68.0", + "description": "Theia - AI Core", + "dependencies": { + "@theia/core": "1.68.0", + "@theia/editor": "1.68.0", + "@theia/filesystem": "1.68.0", + "@theia/monaco": "1.68.0", + "@theia/monaco-editor-core": "1.96.302", + "@theia/output": "1.68.0", + "@theia/variable-resolver": "1.68.0", + "@theia/workspace": "1.68.0", + "@types/js-yaml": "^4.0.9", + "fast-deep-equal": "^3.1.3", + "js-yaml": "^4.1.0", + "tslib": "^2.6.2" + }, + "main": "lib/common", + "publishConfig": { + "access": "public" + }, + "theiaExtensions": [ + { + "frontend": "lib/browser/ai-core-frontend-module", + "backend": "lib/node/ai-core-backend-module" + } + ], + "keywords": [ + "theia-extension" + ], + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "repository": { + "type": "git", + "url": "https://github.com/eclipse-theia/theia.git" + }, + "bugs": { + "url": "https://github.com/eclipse-theia/theia/issues" + }, + "homepage": "https://github.com/eclipse-theia/theia", + "files": [ + "data", + "lib", + "src" + ], + "scripts": { + "build": "theiaext build", + "clean": "theiaext clean", + "compile": "theiaext compile", + "lint": "theiaext lint", + "test": "theiaext test", + "watch": "theiaext watch" + }, + "devDependencies": { + "@theia/ext-scripts": "1.68.0" + }, + "nyc": { + "extends": "../../configs/nyc.json" + }, + "gitHead": "21358137e41342742707f660b8e222f940a27652" +} diff --git a/packages/ai-core/src/browser/agent-completion-notification-service.ts b/packages/ai-core/src/browser/agent-completion-notification-service.ts new file mode 100644 index 0000000..833d7c3 --- /dev/null +++ b/packages/ai-core/src/browser/agent-completion-notification-service.ts @@ -0,0 +1,242 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { injectable, inject } from '@theia/core/shared/inversify'; +import { MessageService } from '@theia/core/lib/common/message-service'; +import { ApplicationShell } from '@theia/core/lib/browser/shell/application-shell'; +import { nls } from '@theia/core/lib/common/nls'; +import { + PREFERENCE_NAME_DEFAULT_NOTIFICATION_TYPE, +} from '../common/ai-core-preferences'; +import { AgentService } from '../common/agent-service'; +import { AISettingsService } from '../common/settings-service'; +import { OSNotificationService } from './os-notification-service'; +import { WindowBlinkService } from './window-blink-service'; +import { + NotificationType, + NOTIFICATION_TYPE_OFF, + NOTIFICATION_TYPE_OS_NOTIFICATION, + NOTIFICATION_TYPE_MESSAGE, + NOTIFICATION_TYPE_BLINK, +} from '../common/notification-types'; +import { PreferenceService } from '@theia/core'; + +@injectable() +export class AgentCompletionNotificationService { + @inject(PreferenceService) + protected readonly preferenceService: PreferenceService; + + @inject(AgentService) + protected readonly agentService: AgentService; + + @inject(AISettingsService) + protected readonly settingsService: AISettingsService; + + @inject(OSNotificationService) + protected readonly osNotificationService: OSNotificationService; + + @inject(MessageService) + protected readonly messageService: MessageService; + + @inject(WindowBlinkService) + protected readonly windowBlinkService: WindowBlinkService; + + @inject(ApplicationShell) + protected readonly shell: ApplicationShell; + + /** + * Show a completion notification for the specified agent if enabled in preferences. + * + * @param agentId The unique identifier of the agent + * @param taskDescription Optional description of the completed task + */ + async showCompletionNotification( + agentId: string, + taskDescription?: string, + ): Promise { + const notificationType = + await this.getNotificationTypeForAgent(agentId); + + if (notificationType === NOTIFICATION_TYPE_OFF || this.isChatWidgetFocused()) { + return; + } + + try { + const agentName = this.resolveAgentName(agentId); + await this.executeNotificationType( + agentName, + taskDescription, + notificationType, + ); + } catch (error) { + console.error( + 'Failed to show agent completion notification:', + error, + ); + } + } + + /** + * Resolve the display name for an agent by its ID. + * + * @param agentId The unique identifier of the agent + * @returns The agent's display name or the agent ID if not found + */ + protected resolveAgentName(agentId: string): string { + try { + const agents = this.agentService.getAllAgents(); + const agent = agents.find(a => a.id === agentId); + return agent?.name || agentId; + } catch (error) { + console.warn( + `Failed to resolve agent name for ID '${agentId}':`, + error, + ); + return agentId; + } + } + + /** + * Get the preferred notification type for a specific agent. + * If no agent-specific preference is set, returns the global default notification type. + */ + protected async getNotificationTypeForAgent( + agentId: string, + ): Promise { + const agentSettings = + await this.settingsService.getAgentSettings(agentId); + const agentNotificationType = agentSettings?.completionNotification as NotificationType; + + // If agent has no specific setting, use the global default + if (!agentNotificationType) { + return this.preferenceService.get( + PREFERENCE_NAME_DEFAULT_NOTIFICATION_TYPE, + NOTIFICATION_TYPE_OFF, + ); + } + + return agentNotificationType; + } + + /** + * Execute the specified notification type. + */ + private async executeNotificationType( + agentName: string, + taskDescription: string | undefined, + type: NotificationType, + ): Promise { + switch (type) { + case NOTIFICATION_TYPE_OS_NOTIFICATION: + await this.showOSNotification(agentName, taskDescription); + break; + case NOTIFICATION_TYPE_MESSAGE: + await this.showMessageServiceNotification( + agentName, + taskDescription, + ); + break; + case NOTIFICATION_TYPE_BLINK: + await this.showBlinkNotification(agentName); + break; + default: + throw new Error(`Unknown notification type: ${type}`); + } + } + + /** + * Show OS notification directly. + */ + protected async showOSNotification( + agentName: string, + taskDescription?: string, + ): Promise { + const result = + await this.osNotificationService.showAgentCompletionNotification( + agentName, + taskDescription, + ); + if (!result.success) { + throw new Error(`OS notification failed: ${result.error}`); + } + } + + /** + * Show MessageService notification. + */ + protected async showMessageServiceNotification( + agentName: string, + taskDescription?: string, + ): Promise { + const message = taskDescription + ? nls.localize( + 'theia/ai-core/agentCompletionWithTask', + 'Agent "{0}" has completed the task: {1}', + agentName, + taskDescription, + ) + : nls.localize( + 'theia/ai-core/agentCompletionMessage', + 'Agent "{0}" has completed its task.', + agentName, + ); + this.messageService.info(message); + } + + /** + * Show window blink notification. + */ + protected async showBlinkNotification(agentName: string): Promise { + const result = await this.windowBlinkService.blinkWindow(agentName); + if (!result.success) { + throw new Error( + `Window blink notification failed: ${result.error}`, + ); + } + } + + /** + * Check if OS notifications are supported and enabled. + */ + isOSNotificationSupported(): boolean { + return this.osNotificationService.isNotificationSupported(); + } + + /** + * Get the current OS notification permission status. + */ + getOSNotificationPermission(): NotificationPermission { + return this.osNotificationService.getPermissionStatus(); + } + + /** + * Request OS notification permission from the user. + */ + async requestOSNotificationPermission(): Promise { + return this.osNotificationService.requestPermission(); + } + + /** + * Check if any chat widget currently has focus. + */ + protected isChatWidgetFocused(): boolean { + const activeWidget = this.shell.activeWidget; + if (!activeWidget) { + return false; + } + return activeWidget.id === 'chat-view-widget'; + } +} diff --git a/packages/ai-core/src/browser/ai-activation-service.ts b/packages/ai-core/src/browser/ai-activation-service.ts new file mode 100644 index 0000000..9bddb8c --- /dev/null +++ b/packages/ai-core/src/browser/ai-activation-service.ts @@ -0,0 +1,59 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** +import { inject, injectable } from '@theia/core/shared/inversify'; +import { FrontendApplicationContribution } from '@theia/core/lib/browser'; + +export const AIActivationService = Symbol('AIActivationService'); +/** + * AIActivationService is used to manage the activation state of AI features in Theia. + */ +export interface AIActivationService { + isActive: boolean; + onDidChangeActiveStatus: Event; +} +import { Emitter, Event } from '@theia/core'; +import { ContextKeyService } from '@theia/core/lib/browser/context-key-service'; + +/** + * Context key for the AI features. It is set to `true` if the feature is enabled. + */ +export const ENABLE_AI_CONTEXT_KEY = 'ai-features.AiEnable.enableAI'; + +/** + * Default implementation of AIActivationService marks the feature active by default. + * + * Adopters may override this implementation to provide custom activation logic. + * + * Note that '@theia/ai-ide' also overrides this service to provide activation based on preferences, + * disabling the feature by default. + */ +@injectable() +export class AIActivationServiceImpl implements AIActivationService, FrontendApplicationContribution { + + @inject(ContextKeyService) + protected readonly contextKeyService: ContextKeyService; + + isActive: boolean = true; + + protected onDidChangeAIEnabled = new Emitter(); + get onDidChangeActiveStatus(): Event { + return this.onDidChangeAIEnabled.event; + } + + initialize(): void { + this.contextKeyService.createKey(ENABLE_AI_CONTEXT_KEY, true); + } +} diff --git a/packages/ai-core/src/browser/ai-command-handler-factory.ts b/packages/ai-core/src/browser/ai-command-handler-factory.ts new file mode 100644 index 0000000..f5f8285 --- /dev/null +++ b/packages/ai-core/src/browser/ai-command-handler-factory.ts @@ -0,0 +1,20 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { CommandHandler } from '@theia/core'; + +export type AICommandHandlerFactory = (handler: CommandHandler) => CommandHandler; +export const AICommandHandlerFactory = Symbol('AICommandHandlerFactory'); diff --git a/packages/ai-core/src/browser/ai-core-command-contribution.ts b/packages/ai-core/src/browser/ai-core-command-contribution.ts new file mode 100644 index 0000000..9a8f8a9 --- /dev/null +++ b/packages/ai-core/src/browser/ai-core-command-contribution.ts @@ -0,0 +1,37 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { Command, CommandContribution, CommandRegistry } from '@theia/core'; +import { CommonCommands, codicon } from '@theia/core/lib/browser'; +import { AICommandHandlerFactory } from './ai-command-handler-factory'; +import { injectable, inject } from '@theia/core/shared/inversify'; + +export const AI_SHOW_SETTINGS_COMMAND: Command = Command.toLocalizedCommand({ + id: 'ai-chat-ui.show-settings', + label: 'Show AI Settings', + iconClass: codicon('settings-gear'), +}); + +@injectable() +export class AiCoreCommandContribution implements CommandContribution { + @inject(AICommandHandlerFactory) protected readonly handlerFactory: AICommandHandlerFactory; + + registerCommands(commands: CommandRegistry): void { + commands.registerCommand(AI_SHOW_SETTINGS_COMMAND, this.handlerFactory({ + execute: () => commands.executeCommand(CommonCommands.OPEN_PREFERENCES.id, 'ai-features'), + })); + } +} diff --git a/packages/ai-core/src/browser/ai-core-frontend-application-contribution.ts b/packages/ai-core/src/browser/ai-core-frontend-application-contribution.ts new file mode 100644 index 0000000..b19e7b1 --- /dev/null +++ b/packages/ai-core/src/browser/ai-core-frontend-application-contribution.ts @@ -0,0 +1,39 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { FrontendApplicationContribution } from '@theia/core/lib/browser'; +import { inject, injectable, named } from '@theia/core/shared/inversify'; +import { Agent } from '../common'; +import { AgentService } from '../common/agent-service'; +import { ContributionProvider } from '@theia/core/lib/common/contribution-provider'; + +@injectable() +export class AICoreFrontendApplicationContribution implements FrontendApplicationContribution { + @inject(AgentService) + private readonly agentService: AgentService; + + @inject(ContributionProvider) @named(Agent) + protected readonly agentsProvider: ContributionProvider; + + onStart(): void { + this.agentsProvider.getContributions().forEach(agent => { + this.agentService.registerAgent(agent); + }); + } + + onStop(): void { + } +} diff --git a/packages/ai-core/src/browser/ai-core-frontend-module.ts b/packages/ai-core/src/browser/ai-core-frontend-module.ts new file mode 100644 index 0000000..c21490a --- /dev/null +++ b/packages/ai-core/src/browser/ai-core-frontend-module.ts @@ -0,0 +1,198 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { bindContributionProvider, CommandContribution, CommandHandler, ResourceResolver } from '@theia/core'; +import { + RemoteConnectionProvider, + ServiceConnectionProvider, +} from '@theia/core/lib/browser/messaging/service-connection-provider'; +import { ContainerModule } from '@theia/core/shared/inversify'; +import { DefaultLanguageModelAliasRegistry } from './frontend-language-model-alias-registry'; +import { LanguageModelAliasRegistry } from '../common/language-model-alias'; +import { + AIVariableContribution, + AIVariableService, + ToolInvocationRegistry, + ToolInvocationRegistryImpl, + LanguageModelDelegateClient, + languageModelDelegatePath, + LanguageModelFrontendDelegate, + LanguageModelProvider, + LanguageModelRegistry, + LanguageModelRegistryClient, + languageModelRegistryDelegatePath, + LanguageModelRegistryFrontendDelegate, + PromptFragmentCustomizationService, + PromptService, + PromptServiceImpl, + ToolProvider, + TokenUsageService, + TOKEN_USAGE_SERVICE_PATH, + TokenUsageServiceClient, + AIVariableResourceResolver, + ConfigurableInMemoryResources, + Agent, + FrontendLanguageModelRegistry +} from '../common'; +import { + FrontendLanguageModelRegistryImpl, + LanguageModelDelegateClientImpl, +} from './frontend-language-model-registry'; +import { FrontendApplicationContribution, LabelProviderContribution } from '@theia/core/lib/browser'; +import { TabBarToolbarContribution } from '@theia/core/lib/browser/shell/tab-bar-toolbar'; +import { LanguageGrammarDefinitionContribution } from '@theia/monaco/lib/browser/textmate'; +import { AICoreFrontendApplicationContribution } from './ai-core-frontend-application-contribution'; +import { bindAICorePreferences } from '../common/ai-core-preferences'; +import { AISettingsServiceImpl } from './ai-settings-service'; +import { DefaultPromptFragmentCustomizationService } from './frontend-prompt-customization-service'; +import { DefaultFrontendVariableService, FrontendVariableService } from './frontend-variable-service'; +import { PromptTemplateContribution } from './prompttemplate-contribution'; +import { FileVariableContribution } from './file-variable-contribution'; +import { TheiaVariableContribution } from './theia-variable-contribution'; +import { TodayVariableContribution } from '../common/today-variable-contribution'; +import { AgentsVariableContribution } from '../common/agents-variable-contribution'; +import { OpenEditorsVariableContribution } from './open-editors-variable-contribution'; +import { SkillsVariableContribution } from './skills-variable-contribution'; +import { AIActivationService, AIActivationServiceImpl } from './ai-activation-service'; +import { AgentService, AgentServiceImpl } from '../common/agent-service'; +import { AICommandHandlerFactory } from './ai-command-handler-factory'; +import { AISettingsService } from '../common/settings-service'; +import { DefaultSkillService, SkillService } from './skill-service'; +import { SkillPromptCoordinator } from './skill-prompt-coordinator'; +import { AiCoreCommandContribution } from './ai-core-command-contribution'; +import { PromptVariableContribution } from '../common/prompt-variable-contribution'; +import { LanguageModelService } from '../common/language-model-service'; +import { FrontendLanguageModelServiceImpl } from './frontend-language-model-service'; +import { TokenUsageFrontendService } from './token-usage-frontend-service'; +import { TokenUsageFrontendServiceImpl, TokenUsageServiceClientImpl } from './token-usage-frontend-service-impl'; +import { AIVariableUriLabelProvider } from './ai-variable-uri-label-provider'; +import { AgentCompletionNotificationService } from './agent-completion-notification-service'; +import { OSNotificationService } from './os-notification-service'; +import { WindowBlinkService } from './window-blink-service'; + +export default new ContainerModule(bind => { + bindContributionProvider(bind, Agent); + bindContributionProvider(bind, LanguageModelProvider); + + bind(FrontendLanguageModelRegistryImpl).toSelf().inSingletonScope(); + bind(FrontendLanguageModelRegistry).toService(FrontendLanguageModelRegistryImpl); + bind(LanguageModelRegistry).toService(FrontendLanguageModelRegistryImpl); + + bind(LanguageModelDelegateClientImpl).toSelf().inSingletonScope(); + bind(LanguageModelDelegateClient).toService(LanguageModelDelegateClientImpl); + bind(LanguageModelRegistryClient).toService(LanguageModelDelegateClient); + + bind(LanguageModelRegistryFrontendDelegate).toDynamicValue( + ctx => { + const connection = ctx.container.get(RemoteConnectionProvider); + const client = ctx.container.get(LanguageModelRegistryClient); + return connection.createProxy(languageModelRegistryDelegatePath, client); + } + ); + + bind(LanguageModelFrontendDelegate) + .toDynamicValue(ctx => { + const connection = ctx.container.get(RemoteConnectionProvider); + const client = ctx.container.get(LanguageModelDelegateClient); + return connection.createProxy(languageModelDelegatePath, client); + }) + .inSingletonScope(); + + bindAICorePreferences(bind); + + bind(DefaultPromptFragmentCustomizationService).toSelf().inSingletonScope(); + bind(PromptFragmentCustomizationService).toService(DefaultPromptFragmentCustomizationService); + bind(PromptServiceImpl).toSelf().inSingletonScope(); + bind(PromptService).toService(PromptServiceImpl); + + bind(PromptTemplateContribution).toSelf().inSingletonScope(); + bind(LanguageGrammarDefinitionContribution).toService(PromptTemplateContribution); + bind(CommandContribution).toService(PromptTemplateContribution); + bind(TabBarToolbarContribution).toService(PromptTemplateContribution); + + bind(AISettingsServiceImpl).toSelf().inSingletonScope(); + bind(AISettingsService).toService(AISettingsServiceImpl); + + bind(DefaultSkillService).toSelf().inSingletonScope(); + bind(SkillService).toService(DefaultSkillService); + + bind(SkillPromptCoordinator).toSelf().inSingletonScope(); + bind(FrontendApplicationContribution).toService(SkillPromptCoordinator); + bindContributionProvider(bind, AIVariableContribution); + bind(DefaultFrontendVariableService).toSelf().inSingletonScope(); + bind(FrontendVariableService).toService(DefaultFrontendVariableService); + bind(AIVariableService).toService(FrontendVariableService); + bind(FrontendApplicationContribution).toService(FrontendVariableService); + + bind(TheiaVariableContribution).toSelf().inSingletonScope(); + bind(AIVariableContribution).toService(TheiaVariableContribution); + + bind(AIVariableContribution).to(PromptVariableContribution).inSingletonScope(); + bind(AIVariableContribution).to(TodayVariableContribution).inSingletonScope(); + bind(AIVariableContribution).to(FileVariableContribution).inSingletonScope(); + bind(AIVariableContribution).to(AgentsVariableContribution).inSingletonScope(); + bind(AIVariableContribution).to(OpenEditorsVariableContribution).inSingletonScope(); + bind(AIVariableContribution).to(SkillsVariableContribution).inSingletonScope(); + + bind(FrontendApplicationContribution).to(AICoreFrontendApplicationContribution).inSingletonScope(); + + bind(ToolInvocationRegistry).to(ToolInvocationRegistryImpl).inSingletonScope(); + bindContributionProvider(bind, ToolProvider); + + bind(AIActivationServiceImpl).toSelf().inSingletonScope(); + bind(AIActivationService).toService(AIActivationServiceImpl); + bind(FrontendApplicationContribution).toService(AIActivationService); + + bind(AgentServiceImpl).toSelf().inSingletonScope(); + bind(AgentService).toService(AgentServiceImpl); + + bind(AICommandHandlerFactory).toFactory(context => (handler: CommandHandler) => { + const activationService = context.container.get(AIActivationService); + return { + execute: (...args: unknown[]) => handler.execute(...args), + isEnabled: (...args: unknown[]) => activationService.isActive && (handler.isEnabled?.(...args) ?? true), + isVisible: (...args: unknown[]) => activationService.isActive && (handler.isVisible?.(...args) ?? true), + isToggled: handler.isToggled + }; + }); + + bind(AiCoreCommandContribution).toSelf().inSingletonScope(); + bind(CommandContribution).toService(AiCoreCommandContribution); + bind(FrontendLanguageModelServiceImpl).toSelf().inSingletonScope(); + bind(LanguageModelService).toService(FrontendLanguageModelServiceImpl); + + bind(TokenUsageFrontendService).to(TokenUsageFrontendServiceImpl).inSingletonScope(); + bind(TokenUsageServiceClient).to(TokenUsageServiceClientImpl).inSingletonScope(); + + bind(DefaultLanguageModelAliasRegistry).toSelf().inSingletonScope(); + bind(LanguageModelAliasRegistry).toService(DefaultLanguageModelAliasRegistry); + + bind(TokenUsageService).toDynamicValue(ctx => { + const connection = ctx.container.get(RemoteConnectionProvider); + const client = ctx.container.get(TokenUsageServiceClient); + return connection.createProxy(TOKEN_USAGE_SERVICE_PATH, client); + }).inSingletonScope(); + bind(AIVariableResourceResolver).toSelf().inSingletonScope(); + bind(ResourceResolver).toService(AIVariableResourceResolver); + bind(AIVariableUriLabelProvider).toSelf().inSingletonScope(); + bind(LabelProviderContribution).toService(AIVariableUriLabelProvider); + + bind(AgentCompletionNotificationService).toSelf().inSingletonScope(); + bind(OSNotificationService).toSelf().inSingletonScope(); + bind(WindowBlinkService).toSelf().inSingletonScope(); + bind(ConfigurableInMemoryResources).toSelf().inSingletonScope(); + bind(ResourceResolver).toService(ConfigurableInMemoryResources); +}); diff --git a/packages/ai-core/src/browser/ai-settings-service.ts b/packages/ai-core/src/browser/ai-settings-service.ts new file mode 100644 index 0000000..93feebb --- /dev/null +++ b/packages/ai-core/src/browser/ai-settings-service.ts @@ -0,0 +1,66 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** +import { DisposableCollection, Emitter, Event, ILogger, RecursiveReadonly } from '@theia/core'; +import { inject, injectable, postConstruct } from '@theia/core/shared/inversify'; +import { PreferenceService } from '@theia/core/lib/common'; +import { AISettings, AISettingsService, AgentSettings } from '../common'; + +@injectable() +export class AISettingsServiceImpl implements AISettingsService { + + @inject(ILogger) + protected readonly logger: ILogger; + + @inject(PreferenceService) protected preferenceService: PreferenceService; + static readonly PREFERENCE_NAME = 'ai-features.agentSettings'; + + protected toDispose = new DisposableCollection(); + + protected readonly onDidChangeEmitter = new Emitter(); + onDidChange: Event = this.onDidChangeEmitter.event; + + @postConstruct() + protected init(): void { + this.toDispose.push( + this.preferenceService.onPreferenceChanged(event => { + if (event.preferenceName === AISettingsServiceImpl.PREFERENCE_NAME) { + this.onDidChangeEmitter.fire(); + } + }) + ); + } + + async updateAgentSettings(agent: string, agentSettings: Partial): Promise { + const settings = await this.getSettings(); + const toSet = { ...settings, [agent]: { ...settings[agent], ...agentSettings } }; + try { + await this.preferenceService.updateValue(AISettingsServiceImpl.PREFERENCE_NAME, toSet); + } catch (e) { + this.onDidChangeEmitter.fire(); + this.logger.warn('Updating the preferences was unsuccessful: ' + e); + } + } + + async getAgentSettings(agent: string): Promise | undefined> { + const settings = await this.getSettings(); + return settings[agent]; + } + + async getSettings(): Promise> { + await this.preferenceService.ready; + return this.preferenceService.get(AISettingsServiceImpl.PREFERENCE_NAME, {}); + } +} diff --git a/packages/ai-core/src/browser/ai-variable-uri-label-provider.ts b/packages/ai-core/src/browser/ai-variable-uri-label-provider.ts new file mode 100644 index 0000000..d9c3b41 --- /dev/null +++ b/packages/ai-core/src/browser/ai-variable-uri-label-provider.ts @@ -0,0 +1,66 @@ +// ***************************************************************************** +// Copyright (C) 2025 Eclipse GmbH and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { inject, injectable } from '@theia/core/shared/inversify'; +import { URI } from '@theia/core'; +import { LabelProvider, LabelProviderContribution } from '@theia/core/lib/browser'; +import { AI_VARIABLE_RESOURCE_SCHEME, AIVariableResourceResolver } from '../common/ai-variable-resource'; +import { AIVariableResolutionRequest, AIVariableService } from '../common/variable-service'; + +@injectable() +export class AIVariableUriLabelProvider implements LabelProviderContribution { + + @inject(LabelProvider) protected readonly labelProvider: LabelProvider; + @inject(AIVariableResourceResolver) protected variableResourceResolver: AIVariableResourceResolver; + @inject(AIVariableService) protected readonly variableService: AIVariableService; + + protected isMine(element: object): element is URI { + return element instanceof URI && element.scheme === AI_VARIABLE_RESOURCE_SCHEME; + } + + canHandle(element: object): number { + return this.isMine(element) ? 150 : -1; + } + + getIcon(element: object): string | undefined { + if (!this.isMine(element)) { return undefined; } + return this.labelProvider.getIcon(this.getResolutionRequest(element)!); + } + + getName(element: object): string | undefined { + if (!this.isMine(element)) { return undefined; } + return this.labelProvider.getName(this.getResolutionRequest(element)!); + } + + getLongName(element: object): string | undefined { + if (!this.isMine(element)) { return undefined; } + return this.labelProvider.getLongName(this.getResolutionRequest(element)!); + } + + getDetails(element: object): string | undefined { + if (!this.isMine(element)) { return undefined; } + return this.labelProvider.getDetails(this.getResolutionRequest(element)!); + } + + protected getResolutionRequest(element: object): AIVariableResolutionRequest | undefined { + if (!this.isMine(element)) { return undefined; } + const metadata = this.variableResourceResolver.fromUri(element); + if (!metadata) { return undefined; } + const { variableName, arg } = metadata; + const variable = this.variableService.getVariable(variableName); + return variable && { variable, arg }; + } +} diff --git a/packages/ai-core/src/browser/ai-view-contribution.ts b/packages/ai-core/src/browser/ai-view-contribution.ts new file mode 100644 index 0000000..c33c229 --- /dev/null +++ b/packages/ai-core/src/browser/ai-view-contribution.ts @@ -0,0 +1,77 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** +import { CommandRegistry, MenuModelRegistry, PreferenceService } from '@theia/core'; +import { AbstractViewContribution, CommonMenus, KeybindingRegistry, Widget } from '@theia/core/lib/browser'; +import { inject, injectable, postConstruct } from '@theia/core/shared/inversify'; +import { AIActivationService, ENABLE_AI_CONTEXT_KEY } from './ai-activation-service'; +import { AICommandHandlerFactory } from './ai-command-handler-factory'; + +@injectable() +export class AIViewContribution extends AbstractViewContribution { + + @inject(PreferenceService) + protected readonly preferenceService: PreferenceService; + + @inject(AIActivationService) + protected readonly activationService: AIActivationService; + + @inject(AICommandHandlerFactory) + protected readonly commandHandlerFactory: AICommandHandlerFactory; + + @postConstruct() + protected init(): void { + this.activationService.onDidChangeActiveStatus(active => { + if (!active) { + this.closeView(); + } + }); + } + + override registerCommands(commands: CommandRegistry): void { + if (this.toggleCommand) { + + commands.registerCommand(this.toggleCommand, this.commandHandlerFactory({ + execute: () => this.toggleView(), + })); + } + this.quickView?.registerItem({ + label: this.viewLabel, + when: ENABLE_AI_CONTEXT_KEY, + open: () => this.openView({ activate: true }) + }); + + } + + override registerMenus(menus: MenuModelRegistry): void { + if (this.toggleCommand) { + menus.registerMenuAction(CommonMenus.VIEW_VIEWS, { + commandId: this.toggleCommand.id, + when: ENABLE_AI_CONTEXT_KEY, + label: this.viewLabel + }); + } + } + override registerKeybindings(keybindings: KeybindingRegistry): void { + if (this.toggleCommand && this.options.toggleKeybinding) { + keybindings.registerKeybinding({ + command: this.toggleCommand.id, + when: ENABLE_AI_CONTEXT_KEY, + keybinding: this.options.toggleKeybinding + }); + } + } +} + diff --git a/packages/ai-core/src/browser/file-variable-contribution.ts b/packages/ai-core/src/browser/file-variable-contribution.ts new file mode 100644 index 0000000..7bb77f5 --- /dev/null +++ b/packages/ai-core/src/browser/file-variable-contribution.ts @@ -0,0 +1,122 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { nls, Path, URI } from '@theia/core'; +import { OpenerService, codiconArray, open } from '@theia/core/lib/browser'; +import { inject, injectable } from '@theia/core/shared/inversify'; +import { FileService } from '@theia/filesystem/lib/browser/file-service'; +import { WorkspaceService } from '@theia/workspace/lib/browser/workspace-service'; +import { + AIVariable, + AIVariableContext, + AIVariableContribution, + AIVariableOpener, + AIVariableResolutionRequest, + AIVariableResolver, + ResolvedAIContextVariable, +} from '../common/variable-service'; +import { FrontendVariableService } from './frontend-variable-service'; + +export namespace FileVariableArgs { + export const uri = 'uri'; +} + +export const FILE_VARIABLE: AIVariable = { + id: 'file-provider', + description: nls.localize('theia/ai/core/fileVariable/description', 'Resolves the contents of a file'), + name: 'file', + label: nls.localizeByDefault('File'), + iconClasses: codiconArray('file'), + isContextVariable: true, + args: [{ name: FileVariableArgs.uri, description: nls.localize('theia/ai/core/fileVariable/uri/description', 'The URI of the requested file.') }] +}; + +@injectable() +export class FileVariableContribution implements AIVariableContribution, AIVariableResolver, AIVariableOpener { + @inject(FileService) + protected readonly fileService: FileService; + + @inject(WorkspaceService) + protected readonly wsService: WorkspaceService; + + @inject(OpenerService) + protected readonly openerService: OpenerService; + + registerVariables(service: FrontendVariableService): void { + service.registerResolver(FILE_VARIABLE, this); + service.registerOpener(FILE_VARIABLE, this); + } + + async canResolve(request: AIVariableResolutionRequest, _: AIVariableContext): Promise { + return request.variable.name === FILE_VARIABLE.name ? 1 : 0; + } + + async resolve(request: AIVariableResolutionRequest, _: AIVariableContext): Promise { + const uri = await this.toUri(request); + + if (!uri) { return undefined; } + + try { + const content = await this.fileService.readFile(uri); + return { + variable: request.variable, + value: await this.wsService.getWorkspaceRelativePath(uri), + contextValue: content.value.toString(), + }; + } catch (error) { + return undefined; + } + } + + protected async toUri(request: AIVariableResolutionRequest): Promise { + if (request.variable.name !== FILE_VARIABLE.name || request.arg === undefined) { + return undefined; + } + + const path = request.arg; + return this.makeAbsolute(path); + } + + canOpen(request: AIVariableResolutionRequest, context: AIVariableContext): Promise { + return this.canResolve(request, context); + } + + async open(request: AIVariableResolutionRequest, context: AIVariableContext): Promise { + const uri = await this.toUri(request); + if (!uri) { + throw new Error('Unable to resolve URI for request.'); + } + await open(this.openerService, uri); + } + + protected async makeAbsolute(pathStr: string): Promise { + const path = new Path(Path.normalizePathSeparator(pathStr)); + if (!path.isAbsolute) { + const workspaceRoots = this.wsService.tryGetRoots(); + const wsUris = workspaceRoots.map(root => root.resource.resolve(path)); + for (const uri of wsUris) { + if (await this.fileService.exists(uri)) { + return uri; + } + } + } + const argUri = new URI(pathStr); + if (await this.fileService.exists(argUri)) { + return argUri; + } + return undefined; + } +} diff --git a/packages/ai-core/src/browser/frontend-language-model-alias-registry.ts b/packages/ai-core/src/browser/frontend-language-model-alias-registry.ts new file mode 100644 index 0000000..7804c07 --- /dev/null +++ b/packages/ai-core/src/browser/frontend-language-model-alias-registry.ts @@ -0,0 +1,165 @@ +// ***************************************************************************** +// Copyright (C) 2024-2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { injectable, inject, postConstruct } from '@theia/core/shared/inversify'; +import { Emitter, Event, nls } from '@theia/core'; +import { LanguageModelAlias, LanguageModelAliasRegistry } from '../common/language-model-alias'; +import { PreferenceScope, PreferenceService } from '@theia/core/lib/common'; +import { LANGUAGE_MODEL_ALIASES_PREFERENCE } from '../common/ai-core-preferences'; +import { Deferred } from '@theia/core/lib/common/promise-util'; + +@injectable() +export class DefaultLanguageModelAliasRegistry implements LanguageModelAliasRegistry { + + protected aliases: LanguageModelAlias[] = [ + { + id: 'default/code', + defaultModelIds: [ + 'anthropic/claude-opus-4-5', + 'openai/gpt-5.2', + 'google/gemini-3-pro-preview' + ], + description: nls.localize('theia/ai/core/defaultModelAliases/code/description', 'Optimized for code understanding and generation tasks.') + }, + { + id: 'default/universal', + defaultModelIds: [ + 'openai/gpt-5.2', + 'anthropic/claude-opus-4-5', + 'google/gemini-3-pro-preview' + ], + description: nls.localize('theia/ai/core/defaultModelAliases/universal/description', 'Well-balanced for both code and general language use.') + }, + { + id: 'default/code-completion', + defaultModelIds: [ + 'openai/gpt-4.1', + 'anthropic/claude-opus-4-5', + 'google/gemini-3-pro-preview' + ], + description: nls.localize('theia/ai/core/defaultModelAliases/code-completion/description', 'Best suited for code autocompletion scenarios.') + }, + { + id: 'default/summarize', + defaultModelIds: [ + 'openai/gpt-5.2', + 'anthropic/claude-opus-4-5', + 'google/gemini-3-pro-preview' + ], + description: nls.localize('theia/ai/core/defaultModelAliases/summarize/description', 'Models prioritized for summarization and condensation of content.') + } + ]; + protected readonly onDidChangeEmitter = new Emitter(); + readonly onDidChange: Event = this.onDidChangeEmitter.event; + + @inject(PreferenceService) + protected readonly preferenceService: PreferenceService; + + protected readonly _ready = new Deferred(); + get ready(): Promise { + return this._ready.promise; + } + + @postConstruct() + protected init(): void { + this.preferenceService.ready.then(() => { + this.loadFromPreference(); + this.preferenceService.onPreferenceChanged(ev => { + if (ev.preferenceName === LANGUAGE_MODEL_ALIASES_PREFERENCE) { + this.loadFromPreference(); + } + }); + this._ready.resolve(); + }, err => { + this._ready.reject(err); + }); + } + + addAlias(alias: LanguageModelAlias): void { + const idx = this.aliases.findIndex(a => a.id === alias.id); + if (idx !== -1) { + this.aliases[idx] = alias; + } else { + this.aliases.push(alias); + } + this.saveToPreference(); + this.onDidChangeEmitter.fire(); + } + + removeAlias(id: string): void { + const idx = this.aliases.findIndex(a => a.id === id); + if (idx !== -1) { + this.aliases.splice(idx, 1); + this.saveToPreference(); + this.onDidChangeEmitter.fire(); + } + } + + getAliases(): LanguageModelAlias[] { + return [...this.aliases]; + } + + resolveAlias(id: string): string[] | undefined { + const alias = this.aliases.find(a => a.id === id); + if (!alias) { + return undefined; + } + if (alias.selectedModelId) { + return [alias.selectedModelId]; + } + return alias.defaultModelIds; + } + + /** + * Set the selected model for the given alias id. + * Updates the alias' selectedModelId to the given modelId, persists, and fires onDidChange. + */ + selectModelForAlias(aliasId: string, modelId: string): void { + const alias = this.aliases.find(a => a.id === aliasId); + if (alias) { + alias.selectedModelId = modelId; + this.saveToPreference(); + this.onDidChangeEmitter.fire(); + } + } + + /** + * Load aliases from the persisted setting + */ + protected loadFromPreference(): void { + const stored = this.preferenceService.get<{ [name: string]: { selectedModel: string } }>(LANGUAGE_MODEL_ALIASES_PREFERENCE) || {}; + this.aliases.forEach(alias => { + if (stored[alias.id] && stored[alias.id].selectedModel) { + alias.selectedModelId = stored[alias.id].selectedModel; + } else { + delete alias.selectedModelId; + } + }); + } + + /** + * Persist the current aliases and their selected models to the setting + */ + protected saveToPreference(): void { + const map: { [name: string]: { selectedModel: string } } = {}; + for (const alias of this.aliases) { + if (alias.selectedModelId) { + map[alias.id] = { selectedModel: alias.selectedModelId }; + } + } + this.preferenceService.set(LANGUAGE_MODEL_ALIASES_PREFERENCE, map, PreferenceScope.User); + } +} diff --git a/packages/ai-core/src/browser/frontend-language-model-registry.spec.ts b/packages/ai-core/src/browser/frontend-language-model-registry.spec.ts new file mode 100644 index 0000000..229a555 --- /dev/null +++ b/packages/ai-core/src/browser/frontend-language-model-registry.spec.ts @@ -0,0 +1,307 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { enableJSDOM } from '@theia/core/lib/browser/test/jsdom'; +let disableJSDOM = enableJSDOM(); +import { FrontendApplicationConfigProvider } from '@theia/core/lib/browser/frontend-application-config-provider'; +FrontendApplicationConfigProvider.set({}); + +import { expect } from 'chai'; +import { + createToolCallError, + hasToolCallError, + hasToolNotAvailableError, + isToolCallContent, + LanguageModelRequest, + ToolCallContent, + ToolCallErrorResult, + ToolRequest +} from '../common'; + +disableJSDOM(); + +function getFirstErrorMessage(result: ToolCallContent): string | undefined { + const errorItem = result.content.find((item): item is ToolCallErrorResult => item.type === 'error'); + return errorItem?.data; +} + +// This class provides a minimal implementation focused solely on testing the toolCall method. +// We cannot extend FrontendLanguageModelRegistryImpl directly due to issues in the test environment: +// - FrontendLanguageModelRegistryImpl imports dependencies that transitively depend on 'p-queue' +// - p-queue is an ESM-only module that cannot be loaded in the current test environment +class TestableLanguageModelRegistry { + private requests = new Map(); + + async toolCall(id: string, toolId: string, arg_string: string): Promise { + if (!this.requests.has(id)) { + return createToolCallError(`No request found for ID '${id}'. The request may have been cancelled or completed.`); + } + const request = this.requests.get(id)!; + const tool = request.tools?.find(t => t.id === toolId); + if (tool) { + try { + return await tool.handler(arg_string); + } catch (error) { + const errorMessage = error instanceof Error ? error.message : String(error); + return createToolCallError(`Error executing tool '${toolId}': ${errorMessage}`); + } + } + return createToolCallError(`Tool '${toolId}' not found in the available tools for this request.`, 'tool-not-available'); + } + + // Test helper method + setRequest(id: string, request: LanguageModelRequest): void { + this.requests.set(id, request); + } +} + +describe('FrontendLanguageModelRegistryImpl toolCall functionality', () => { + let registry: TestableLanguageModelRegistry; + + before(() => { + disableJSDOM = enableJSDOM(); + }); + + after(() => { + disableJSDOM(); + }); + + beforeEach(() => { + registry = new TestableLanguageModelRegistry(); + }); + + describe('toolCall', () => { + it('should return error when request ID does not exist', async () => { + const result = await registry.toolCall('nonexistent-id', 'test-tool', '{}'); + + expect(result).to.be.an('object'); + expect(isToolCallContent(result)).to.be.true; + expect(hasToolCallError(result as ToolCallContent)).to.be.true; + if (isToolCallContent(result)) { + const errorMessage = getFirstErrorMessage(result); + expect(errorMessage).to.include('No request found for ID \'nonexistent-id\''); + expect(errorMessage).to.include('The request may have been cancelled or completed'); + } + }); + + it('should return error when tool is not found', async () => { + // Set up a request without the requested tool + const requestId = 'test-request-id'; + const mockRequest: LanguageModelRequest = { + messages: [], + tools: [ + { + id: 'different-tool', + name: 'Different Tool', + description: 'A different tool', + parameters: { + type: 'object', + properties: {} + }, + handler: () => Promise.resolve('success') + } + ] + }; + + registry.setRequest(requestId, mockRequest); + + const result = await registry.toolCall(requestId, 'nonexistent-tool', '{}'); + + expect(result).to.be.an('object'); + expect(isToolCallContent(result)).to.be.true; + expect(hasToolNotAvailableError(result as ToolCallContent)).to.be.true; + if (isToolCallContent(result)) { + const errorMessage = getFirstErrorMessage(result); + expect(errorMessage).to.include('Tool \'nonexistent-tool\' not found in the available tools for this request'); + } + }); + + it('should call tool handler successfully when tool exists', async () => { + const requestId = 'test-request-id'; + const toolId = 'test-tool'; + const expectedResult = 'tool execution result'; + + const mockTool: ToolRequest = { + id: toolId, + name: 'Test Tool', + description: 'A test tool', + parameters: { + type: 'object', + properties: {} + }, + handler: (args: string) => Promise.resolve(expectedResult) + }; + + const mockRequest: LanguageModelRequest = { + messages: [], + tools: [mockTool] + }; + + registry.setRequest(requestId, mockRequest); + + const result = await registry.toolCall(requestId, toolId, '{}'); + + expect(result).to.equal(expectedResult); + }); + + it('should handle synchronous tool handler errors gracefully', async () => { + const requestId = 'test-request-id'; + const toolId = 'error-tool'; + const errorMessage = 'Tool execution failed'; + + const mockTool: ToolRequest = { + id: toolId, + name: 'Error Tool', + description: 'A tool that throws an error', + parameters: { + type: 'object', + properties: {} + }, + handler: () => { + throw new Error(errorMessage); + } + }; + + const mockRequest: LanguageModelRequest = { + messages: [], + tools: [mockTool] + }; + + registry.setRequest(requestId, mockRequest); + + const result = await registry.toolCall(requestId, toolId, '{}'); + + expect(result).to.be.an('object'); + expect(isToolCallContent(result)).to.be.true; + expect(hasToolCallError(result as ToolCallContent)).to.be.true; + if (isToolCallContent(result)) { + const resultErrorMessage = getFirstErrorMessage(result); + expect(resultErrorMessage).to.include(`Error executing tool '${toolId}': ${errorMessage}`); + } + }); + + it('should handle non-Error exceptions gracefully', async () => { + const requestId = 'test-request-id'; + const toolId = 'string-error-tool'; + const errorMessage = 'String error'; + + const mockTool: ToolRequest = { + id: toolId, + name: 'String Error Tool', + description: 'A tool that throws a string', + parameters: { + type: 'object', + properties: {} + }, + handler: () => { + // eslint-disable-next-line no-throw-literal + throw errorMessage; + } + }; + + const mockRequest: LanguageModelRequest = { + messages: [], + tools: [mockTool] + }; + + registry.setRequest(requestId, mockRequest); + + const result = await registry.toolCall(requestId, toolId, '{}'); + + expect(result).to.be.an('object'); + expect(isToolCallContent(result)).to.be.true; + expect(hasToolCallError(result as ToolCallContent)).to.be.true; + if (isToolCallContent(result)) { + const resultErrorMessage = getFirstErrorMessage(result); + expect(resultErrorMessage).to.include(`Error executing tool '${toolId}': ${errorMessage}`); + } + }); + + it('should handle asynchronous tool handler errors gracefully', async () => { + const requestId = 'test-request-id'; + const toolId = 'async-error-tool'; + const errorMessage = 'Async tool execution failed'; + + const mockTool: ToolRequest = { + id: toolId, + name: 'Async Error Tool', + description: 'A tool that returns a rejected promise', + parameters: { + type: 'object', + properties: {} + }, + handler: () => Promise.reject(new Error(errorMessage)) + }; + + const mockRequest: LanguageModelRequest = { + messages: [], + tools: [mockTool] + }; + + registry.setRequest(requestId, mockRequest); + + const result = await registry.toolCall(requestId, toolId, '{}'); + + expect(result).to.be.an('object'); + expect(isToolCallContent(result)).to.be.true; + expect(hasToolCallError(result as ToolCallContent)).to.be.true; + if (isToolCallContent(result)) { + const resultErrorMessage = getFirstErrorMessage(result); + expect(resultErrorMessage).to.include(`Error executing tool '${toolId}': ${errorMessage}`); + } + }); + + it('should handle tool handler with no tools array', async () => { + const requestId = 'test-request-id'; + const mockRequest: LanguageModelRequest = { + messages: [] + // No tools property + }; + + registry.setRequest(requestId, mockRequest); + + const result = await registry.toolCall(requestId, 'any-tool', '{}'); + + expect(result).to.be.an('object'); + expect(isToolCallContent(result)).to.be.true; + expect(hasToolNotAvailableError(result as ToolCallContent)).to.be.true; + if (isToolCallContent(result)) { + const resultErrorMessage = getFirstErrorMessage(result); + expect(resultErrorMessage).to.include('Tool \'any-tool\' not found in the available tools for this request'); + } + }); + + it('should handle tool handler with empty tools array', async () => { + const requestId = 'test-request-id'; + const mockRequest: LanguageModelRequest = { + messages: [], + tools: [] + }; + + registry.setRequest(requestId, mockRequest); + + const result = await registry.toolCall(requestId, 'any-tool', '{}'); + + expect(result).to.be.an('object'); + expect(isToolCallContent(result)).to.be.true; + expect(hasToolNotAvailableError(result as ToolCallContent)).to.be.true; + if (isToolCallContent(result)) { + const resultErrorMessage = getFirstErrorMessage(result); + expect(resultErrorMessage).to.include('Tool \'any-tool\' not found in the available tools for this request'); + } + }); + }); +}); diff --git a/packages/ai-core/src/browser/frontend-language-model-registry.ts b/packages/ai-core/src/browser/frontend-language-model-registry.ts new file mode 100644 index 0000000..8eabea2 --- /dev/null +++ b/packages/ai-core/src/browser/frontend-language-model-registry.ts @@ -0,0 +1,474 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** +import { CancellationToken } from '@theia/core'; +import { + inject, + injectable, + postConstruct, +} from '@theia/core/shared/inversify'; +import { + OutputChannel, + OutputChannelManager, + OutputChannelSeverity, +} from '@theia/output/lib/browser/output-channel'; +import { + AISettingsService, + createToolCallError, + DefaultLanguageModelRegistryImpl, + FrontendLanguageModelRegistry, + isLanguageModelParsedResponse, + isLanguageModelStreamResponse, + isLanguageModelStreamResponseDelegate, + isLanguageModelTextResponse, + isTextResponsePart, + LanguageModel, + LanguageModelAliasRegistry, + LanguageModelDelegateClient, + LanguageModelFrontendDelegate, + LanguageModelMetaData, + LanguageModelRegistryClient, + LanguageModelRegistryFrontendDelegate, + LanguageModelRequest, + LanguageModelResponse, + LanguageModelSelector, + LanguageModelStreamResponsePart, + ToolCallResult, + ToolInvocationContext +} from '../common'; + +@injectable() +export class LanguageModelDelegateClientImpl + implements LanguageModelDelegateClient, LanguageModelRegistryClient { + onLanguageModelUpdated(id: string): void { + this.receiver.onLanguageModelUpdated(id); + } + protected receiver: FrontendLanguageModelRegistryImpl; + + setReceiver(receiver: FrontendLanguageModelRegistryImpl): void { + this.receiver = receiver; + } + + send(id: string, token: LanguageModelStreamResponsePart | undefined): void { + this.receiver.send(id, token); + } + + toolCall(requestId: string, toolId: string, args_string: string, toolCallId?: string): Promise { + return this.receiver.toolCall(requestId, toolId, args_string, toolCallId); + } + + error(id: string, error: Error): void { + this.receiver.error(id, error); + } + + languageModelAdded(metadata: LanguageModelMetaData): void { + this.receiver.languageModelAdded(metadata); + } + + languageModelRemoved(id: string): void { + this.receiver.languageModelRemoved(id); + } +} + +interface StreamState { + id: string; + tokens: (LanguageModelStreamResponsePart | undefined)[]; + resolve?: (_: unknown) => void; + reject?: (_: unknown) => void; +} + +@injectable() +export class FrontendLanguageModelRegistryImpl + extends DefaultLanguageModelRegistryImpl + implements FrontendLanguageModelRegistry { + + @inject(LanguageModelAliasRegistry) + protected aliasRegistry: LanguageModelAliasRegistry; + + // called by backend + languageModelAdded(metadata: LanguageModelMetaData): void { + this.addLanguageModels([metadata]); + } + // called by backend + languageModelRemoved(id: string): void { + this.removeLanguageModels([id]); + } + + // called by backend when a model is updated + onLanguageModelUpdated(id: string): void { + this.updateLanguageModelFromBackend(id); + } + + /** + * Fetch the updated model metadata from the backend and update the registry. + */ + protected async updateLanguageModelFromBackend(id: string): Promise { + try { + const backendModels = await this.registryDelegate.getLanguageModelDescriptions(); + const updated = backendModels.find((m: { id: string }) => m.id === id); + if (updated) { + // Remove the old model and add the updated one + this.removeLanguageModels([id]); + this.addLanguageModels([updated]); + } + } catch (err) { + this.logger.error('Failed to update language model from backend', err); + } + } + @inject(LanguageModelRegistryFrontendDelegate) + protected registryDelegate: LanguageModelRegistryFrontendDelegate; + + @inject(LanguageModelFrontendDelegate) + protected providerDelegate: LanguageModelFrontendDelegate; + + @inject(LanguageModelDelegateClientImpl) + protected client: LanguageModelDelegateClientImpl; + + @inject(OutputChannelManager) + protected outputChannelManager: OutputChannelManager; + + @inject(AISettingsService) + protected settingsService: AISettingsService; + + private static requestCounter: number = 0; + + override addLanguageModels(models: LanguageModelMetaData[] | LanguageModel[]): void { + let modelAdded = false; + for (const model of models) { + if (this.languageModels.find(m => m.id === model.id)) { + console.warn(`Tried to add an existing model ${model.id}`); + continue; + } + if (LanguageModel.is(model)) { + this.languageModels.push( + new Proxy( + model, + languageModelOutputHandler( + () => this.outputChannelManager.getChannel( + model.id + ) + ) + ) + ); + modelAdded = true; + } else { + this.languageModels.push( + new Proxy( + this.createFrontendLanguageModel( + model + ), + languageModelOutputHandler( + () => this.outputChannelManager.getChannel( + model.id + ) + ) + ) + ); + modelAdded = true; + } + } + if (modelAdded) { + this.changeEmitter.fire({ models: this.languageModels }); + } + } + + @postConstruct() + protected override init(): void { + this.client.setReceiver(this); + + const contributions = + this.languageModelContributions.getContributions(); + const promises = contributions.map(provider => provider()); + const backendDescriptions = + this.registryDelegate.getLanguageModelDescriptions(); + + Promise.allSettled([backendDescriptions, ...promises]).then( + results => { + const backendDescriptionsResult = results[0]; + if (backendDescriptionsResult.status === 'fulfilled') { + this.addLanguageModels(backendDescriptionsResult.value); + } else { + this.logger.error( + 'Failed to add language models contributed from the backend', + backendDescriptionsResult.reason + ); + } + for (let i = 1; i < results.length; i++) { + // assert that index > 0 contains only language models + const languageModelResult = results[i] as + | PromiseRejectedResult + | PromiseFulfilledResult; + if (languageModelResult.status === 'fulfilled') { + this.addLanguageModels(languageModelResult.value); + } else { + this.logger.error( + 'Failed to add some language models:', + languageModelResult.reason + ); + } + } + this.markInitialized(); + } + ); + } + + createFrontendLanguageModel( + description: LanguageModelMetaData + ): LanguageModel { + return { + ...description, + request: async (request: LanguageModelRequest, cancellationToken?: CancellationToken) => { + const requestId = `${FrontendLanguageModelRegistryImpl.requestCounter++}`; + this.requests.set(requestId, request); + cancellationToken?.onCancellationRequested(() => { + this.providerDelegate.cancel(requestId); + }); + const response = await this.providerDelegate.request( + description.id, + request, + requestId, + cancellationToken + ); + if (isLanguageModelTextResponse(response) || isLanguageModelParsedResponse(response)) { + return response; + } + if (isLanguageModelStreamResponseDelegate(response)) { + if (!this.streams.has(response.streamId)) { + const newStreamState = { + id: response.streamId, + tokens: [], + }; + this.streams.set(response.streamId, newStreamState); + } + const streamState = this.streams.get(response.streamId)!; + return { + stream: this.getIterable(streamState), + }; + } + this.logger.error( + `Received unknown response in frontend for request to language model ${description.id}. Trying to continue without touching the response.`, + response + ); + return response; + }, + }; + } + + protected streams = new Map(); + protected requests = new Map(); + + async *getIterable( + state: StreamState + ): AsyncIterable { + let current = -1; + while (true) { + if (current < state.tokens.length - 1) { + current++; + const token = state.tokens[current]; + if (token === undefined) { + // message is finished + break; + } + if (token !== undefined) { + yield token; + } + } else { + await new Promise((resolve, reject) => { + state.resolve = resolve; + state.reject = reject; + }); + } + } + this.streams.delete(state.id); + } + + // called by backend via the "delegate client" with new tokens + send(id: string, token: LanguageModelStreamResponsePart | undefined): void { + if (!this.streams.has(id)) { + const newStreamState = { + id, + tokens: [], + }; + this.streams.set(id, newStreamState); + } + const streamState = this.streams.get(id)!; + streamState.tokens.push(token); + if (streamState.resolve) { + streamState.resolve(token); + } + } + + // called by backend once tool is invoked + async toolCall(id: string, toolId: string, arg_string: string, toolCallId?: string): Promise { + if (!this.requests.has(id)) { + return createToolCallError(`No request found for ID '${id}'. The request may have been cancelled or completed.`); + } + const request = this.requests.get(id)!; + const tool = request.tools?.find(t => t.id === toolId); + if (tool) { + try { + return await tool.handler(arg_string, ToolInvocationContext.create(toolCallId)); + } catch (error) { + const errorMessage = error instanceof Error ? error.message : String(error); + return createToolCallError(`Error executing tool '${toolId}': ${errorMessage}`); + } + } + return createToolCallError(`Tool '${toolId}' not found in the available tools for this request.`, 'tool-not-available'); + } + + // called by backend via the "delegate client" with the error to use for rejection + error(id: string, error: Error): void { + if (!this.streams.has(id)) { + const newStreamState = { + id, + tokens: [], + }; + this.streams.set(id, newStreamState); + } + const streamState = this.streams.get(id)!; + streamState.reject?.(error); + } + + override async selectLanguageModels(request: LanguageModelSelector): Promise { + await this.initialized; + const userSettings = (await this.settingsService.getAgentSettings(request.agent))?.languageModelRequirements?.find(req => req.purpose === request.purpose); + const identifier = userSettings?.identifier ?? request.identifier; + if (identifier) { + const model = await this.getReadyLanguageModel(identifier); + if (model) { + return [model]; + } + } + // Previously we returned the default model here, but this is not really transparent for the user so we do not select any model here. + return undefined; + } + + async getReadyLanguageModel(idOrAlias: string): Promise { + await this.aliasRegistry.ready; + const modelIds = this.aliasRegistry.resolveAlias(idOrAlias); + if (modelIds) { + for (const modelId of modelIds) { + const model = await this.getLanguageModel(modelId); + if (model?.status.status === 'ready') { + return model; + } + } + return undefined; + } + const languageModel = await this.getLanguageModel(idOrAlias); + return languageModel?.status.status === 'ready' ? languageModel : undefined; + } +} + +const formatJsonWithIndentation = (obj: unknown): string[] => { + // eslint-disable-next-line no-null/no-null + const jsonString = JSON.stringify(obj, null, 2); + const lines = jsonString.split('\n'); + const formattedLines: string[] = []; + + lines.forEach(line => { + const subLines = line.split('\\n'); + const index = indexOfValue(subLines[0]) + 1; + formattedLines.push(subLines[0]); + const prefix = index > 0 ? ' '.repeat(index) : ''; + if (index !== -1) { + for (let i = 1; i < subLines.length; i++) { + formattedLines.push(prefix + subLines[i]); + } + } + }); + + return formattedLines; +}; + +const indexOfValue = (jsonLine: string): number => { + const pattern = /"([^"]+)"\s*:\s*/g; + const match = pattern.exec(jsonLine); + return match ? match.index + match[0].length : -1; +}; + +const languageModelOutputHandler = ( + outputChannelGetter: () => OutputChannel +): ProxyHandler => ({ + get( + target: LanguageModel, + prop: K, + ): LanguageModel[K] | LanguageModel['request'] { + const original = target[prop]; + if (prop === 'request' && typeof original === 'function') { + return async function ( + ...args: Parameters + ): Promise { + const outputChannel = outputChannelGetter(); + outputChannel.appendLine( + 'Sending request:' + ); + const formattedRequest = formatJsonWithIndentation(args[0]); + outputChannel.append(formattedRequest.join('\n')); + if (args[1]) { + args[1] = new Proxy(args[1], { + get( + cTarget: CancellationToken, + cProp: CK + ): CancellationToken[CK] | CancellationToken['onCancellationRequested'] { + if (cProp === 'onCancellationRequested') { + return (...cargs: Parameters) => cTarget.onCancellationRequested(() => { + outputChannel.appendLine('\nCancel requested', OutputChannelSeverity.Warning); + cargs[0](); + }, cargs[1], cargs[2]); + } + return cTarget[cProp]; + } + }); + } + try { + const result = await original.apply(target, args); + if (isLanguageModelStreamResponse(result)) { + outputChannel.appendLine('Received a response stream'); + const stream = result.stream; + const loggedStream = { + async *[Symbol.asyncIterator](): AsyncIterator { + for await (const part of stream) { + outputChannel.append((isTextResponsePart(part) && part.content) || ''); + yield part; + } + outputChannel.append('\n'); + outputChannel.appendLine('End of stream'); + }, + }; + return { + ...result, + stream: loggedStream, + }; + } else { + outputChannel.appendLine('Received a response'); + outputChannel.appendLine(JSON.stringify(result)); + return result; + } + } catch (err) { + outputChannel.appendLine('An error occurred'); + if (err instanceof Error) { + outputChannel.appendLine( + err.message, + OutputChannelSeverity.Error + ); + } + throw err; + } + }; + } + return original; + }, +}); diff --git a/packages/ai-core/src/browser/frontend-language-model-service.ts b/packages/ai-core/src/browser/frontend-language-model-service.ts new file mode 100644 index 0000000..087ed8a --- /dev/null +++ b/packages/ai-core/src/browser/frontend-language-model-service.ts @@ -0,0 +1,67 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { PreferenceService } from '@theia/core/lib/common'; +import { inject, injectable } from '@theia/core/shared/inversify'; +import { Prioritizeable } from '@theia/core/lib/common/prioritizeable'; +import { LanguageModel, LanguageModelResponse, UserRequest } from '../common'; +import { LanguageModelServiceImpl } from '../common/language-model-service'; +import { PREFERENCE_NAME_REQUEST_SETTINGS, RequestSetting, getRequestSettingSpecificity } from '../common/ai-core-preferences'; + +@injectable() +export class FrontendLanguageModelServiceImpl extends LanguageModelServiceImpl { + + @inject(PreferenceService) + protected preferenceService: PreferenceService; + + override async sendRequest( + languageModel: LanguageModel, + languageModelRequest: UserRequest + ): Promise { + const requestSettings = this.preferenceService.get(PREFERENCE_NAME_REQUEST_SETTINGS, []); + + const ids = languageModel.id.split('/'); + const matchingSetting = mergeRequestSettings(requestSettings, ids[1], ids[0], languageModelRequest.agentId); + if (matchingSetting?.requestSettings) { + // Merge the settings, with user request taking precedence + languageModelRequest.settings = { + ...matchingSetting.requestSettings, + ...languageModelRequest.settings + }; + } + if (matchingSetting?.clientSettings) { + // Merge the clientSettings, with user request taking precedence + languageModelRequest.clientSettings = { + ...matchingSetting.clientSettings, + ...languageModelRequest.clientSettings + }; + } + + return super.sendRequest(languageModel, languageModelRequest); + } +} + +export const mergeRequestSettings = (requestSettings: RequestSetting[], modelId: string, providerId: string, agentId?: string): RequestSetting => { + const prioritizedSettings = Prioritizeable.prioritizeAllSync(requestSettings, + setting => getRequestSettingSpecificity(setting, { + modelId, + providerId, + agentId + })); + // merge all settings from lowest to highest, identical priorities will be overwritten by the following + const matchingSetting = prioritizedSettings.reduceRight((acc, cur) => ({ ...acc, ...cur.value }), {} as RequestSetting); + return matchingSetting; +}; diff --git a/packages/ai-core/src/browser/frontend-prompt-customization-service.spec.ts b/packages/ai-core/src/browser/frontend-prompt-customization-service.spec.ts new file mode 100644 index 0000000..4597188 --- /dev/null +++ b/packages/ai-core/src/browser/frontend-prompt-customization-service.spec.ts @@ -0,0 +1,145 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { expect } from 'chai'; +import { parseTemplateWithMetadata, ParsedTemplate } from './prompttemplate-parser'; + +describe('Prompt Template Parser', () => { + + describe('YAML Front Matter Parsing', () => { + it('extracts YAML front matter correctly', () => { + const fileContent = `--- +isCommand: true +commandName: hello +commandDescription: Say hello +commandArgumentHint: +commandAgents: + - Universal + - Agent2 +--- +Template content here`; + + const result: ParsedTemplate = parseTemplateWithMetadata(fileContent); + + expect(result.template).to.equal('Template content here'); + expect(result.metadata).to.not.be.undefined; + expect(result.metadata?.isCommand).to.be.true; + expect(result.metadata?.commandName).to.equal('hello'); + expect(result.metadata?.commandDescription).to.equal('Say hello'); + expect(result.metadata?.commandArgumentHint).to.equal(''); + expect(result.metadata?.commandAgents).to.deep.equal(['Universal', 'Agent2']); + }); + + it('returns template without front matter when none exists', () => { + const fileContent = 'Just a regular template'; + + const result: ParsedTemplate = parseTemplateWithMetadata(fileContent); + + expect(result.template).to.equal('Just a regular template'); + expect(result.metadata).to.be.undefined; + }); + + it('handles missing front matter gracefully', () => { + const fileContent = `--- +This is not valid YAML front matter +Template content`; + + const result: ParsedTemplate = parseTemplateWithMetadata(fileContent); + + // Should return content as-is when front matter is invalid + expect(result.template).to.equal(fileContent); + }); + + it('handles invalid YAML gracefully', () => { + const fileContent = `--- +isCommand: true +commandName: [unclosed array +--- +Template content`; + + const result: ParsedTemplate = parseTemplateWithMetadata(fileContent); + + // Should return template without metadata on parse error + expect(result.template).to.equal(fileContent); + expect(result.metadata).to.be.undefined; + }); + + it('validates command metadata types', () => { + const fileContent = `--- +isCommand: "true" +commandName: 123 +commandDescription: valid +commandArgumentHint: +commandAgents: "not-an-array" +--- +Template`; + + const result: ParsedTemplate = parseTemplateWithMetadata(fileContent); + + expect(result.template).to.equal('Template'); + expect(result.metadata?.isCommand).to.be.undefined; // Wrong type + expect(result.metadata?.commandName).to.be.undefined; // Wrong type + expect(result.metadata?.commandDescription).to.equal('valid'); + expect(result.metadata?.commandArgumentHint).to.equal(''); + expect(result.metadata?.commandAgents).to.be.undefined; // Wrong type + }); + + it('filters commandAgents to strings only', () => { + const fileContent = `--- +commandAgents: + - ValidAgent + - 123 + - AnotherValid + - true + - LastValid +--- +Template`; + + const result: ParsedTemplate = parseTemplateWithMetadata(fileContent); + + expect(result.metadata?.commandAgents).to.deep.equal(['ValidAgent', 'AnotherValid', 'LastValid']); + }); + + it('handles partial metadata fields', () => { + const fileContent = `--- +isCommand: true +commandName: test +--- +Template content`; + + const result: ParsedTemplate = parseTemplateWithMetadata(fileContent); + + expect(result.template).to.equal('Template content'); + expect(result.metadata?.isCommand).to.be.true; + expect(result.metadata?.commandName).to.equal('test'); + expect(result.metadata?.commandDescription).to.be.undefined; + expect(result.metadata?.commandArgumentHint).to.be.undefined; + expect(result.metadata?.commandAgents).to.be.undefined; + }); + + it('preserves template content with special characters', () => { + const fileContent = `--- +isCommand: true +--- +Template with $ARGUMENTS and {{variable}} and ~{function}`; + + const result: ParsedTemplate = parseTemplateWithMetadata(fileContent); + + expect(result.template).to.equal('Template with $ARGUMENTS and {{variable}} and ~{function}'); + expect(result.metadata?.isCommand).to.be.true; + }); + }); +}); diff --git a/packages/ai-core/src/browser/frontend-prompt-customization-service.ts b/packages/ai-core/src/browser/frontend-prompt-customization-service.ts new file mode 100644 index 0000000..8b838c0 --- /dev/null +++ b/packages/ai-core/src/browser/frontend-prompt-customization-service.ts @@ -0,0 +1,1129 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { DisposableCollection, URI, Event, Emitter, nls } from '@theia/core'; +import { OpenerService } from '@theia/core/lib/browser'; +import { inject, injectable, postConstruct } from '@theia/core/shared/inversify'; +import { PromptFragmentCustomizationService, CustomAgentDescription, CustomizedPromptFragment, CommandPromptFragmentMetadata } from '../common'; +import { BinaryBuffer } from '@theia/core/lib/common/buffer'; +import { FileService } from '@theia/filesystem/lib/browser/file-service'; +import { FileChangesEvent } from '@theia/filesystem/lib/common/files'; +import { AICorePreferences, PREFERENCE_NAME_PROMPT_TEMPLATES } from '../common/ai-core-preferences'; +import { EnvVariablesServer } from '@theia/core/lib/common/env-variables'; +import { dump, load } from 'js-yaml'; +import { PROMPT_TEMPLATE_EXTENSION } from './prompttemplate-contribution'; +import { parseTemplateWithMetadata, ParsedTemplate } from './prompttemplate-parser'; + +/** + * Default template entry for creating custom agents + */ +const newCustomAgentEntry = { + id: 'my_agent', + name: 'My Agent', + description: nls.localize('theia/ai/core/customAgentTemplate/description', 'This is an example agent. Please adapt the properties to fit your needs.'), + prompt: `{{!-- Note: The context section below will resolve all context elements (e.g. files) to their full content +in the system prompt. Context elements can be added by the user in the default chat view (e.g. via DnD or the "+" button). +If you want a more fine-grained, on demand resolvement of context elements, you can also resolve files to their paths only +and equip the agent with functions so that the LLM can retrieve files on demand. See the Coder Agent prompt for an example.--}} + +# Role +You are an example agent. Be nice and helpful to the user. + +## Current Context +Some files and other pieces of data may have been added by the user to the context of the chat. If any have, the details can be found below. +{{contextDetails}}`, + defaultLLM: 'openai/gpt-4o' +}; + +export enum CustomizationSource { + CUSTOMIZED = 1, + FOLDER = 2, + FILE = 3, +} + +export function getCustomizationSourceString(origin: CustomizationSource): string { + switch (origin) { + case CustomizationSource.FILE: + return 'Workspace Template Files'; + case CustomizationSource.FOLDER: + return 'Workspace Template Directories'; + default: + return 'Prompt Templates Folder'; + } +} + +/** + * Interface defining properties that can be updated in the customization service + */ +export interface PromptFragmentCustomizationProperties { + /** Array of directory paths to load templates from */ + directoryPaths?: string[]; + + /** Array of file paths to treat as templates */ + filePaths?: string[]; + + /** Array of file extensions to consider as template files */ + extensions?: string[]; +} + +/** + * Internal representation of a fragment entry in the customization service + * Extends TemplateMetadata to include command-related properties + */ +interface PromptFragmentCustomization extends CommandPromptFragmentMetadata { + /** The template content */ + template: string; + + /** Source URI where this template is stored */ + sourceUri: string; + + /** Source type of the customization */ + origin: CustomizationSource; + + /** Priority level (higher values override lower ones) */ + priority: number; + + /** Fragment ID */ + id: string; + + /** Unique customization ID */ + customizationId: string; +} + +/** + * Information about a template file being watched for changes + */ +interface WatchedFileInfo { + /** The URI of the watched file */ + uri: URI; + + /** The fragment ID associated with this file */ + fragmentId: string; + + /** The customization ID for this file */ + customizationId: string; +} + +@injectable() +export class DefaultPromptFragmentCustomizationService implements PromptFragmentCustomizationService { + @inject(EnvVariablesServer) + protected readonly envVariablesServer: EnvVariablesServer; + + @inject(AICorePreferences) + protected readonly preferences: AICorePreferences; + + @inject(FileService) + protected readonly fileService: FileService; + + @inject(OpenerService) + protected readonly openerService: OpenerService; + + /** Stores URI strings of template files from directories currently being monitored for changes. */ + protected trackedTemplateURIs = new Set(); + + /** Contains the currently active customization, mapped by prompt fragment ID. */ + protected activeCustomizations = new Map(); + + /** Tracks all loaded customizations, including overridden ones, mapped by source URI. */ + protected allCustomizations = new Map(); + + /** Stores additional directory paths for loading template files. */ + protected additionalTemplateDirs = new Set(); + + /** Contains file extensions that identify prompt template files. */ + protected templateExtensions = new Set([PROMPT_TEMPLATE_EXTENSION]); + + /** Stores specific file paths, provided by the settings, that should be treated as templates. */ + protected workspaceTemplateFiles = new Set(); + + /** Maps URI strings to WatchedFileInfo objects for individually watched template files. */ + protected watchedFiles = new Map(); + + /** Collection of disposable resources for cleanup when the service updates or is disposed. */ + protected toDispose = new DisposableCollection(); + + protected readonly onDidChangePromptFragmentCustomizationEmitter = new Emitter(); + readonly onDidChangePromptFragmentCustomization: Event = this.onDidChangePromptFragmentCustomizationEmitter.event; + + protected readonly onDidChangeCustomAgentsEmitter = new Emitter(); + readonly onDidChangeCustomAgents: Event = this.onDidChangeCustomAgentsEmitter.event; + + @postConstruct() + protected init(): void { + this.preferences.onPreferenceChanged(event => { + if (event.preferenceName === PREFERENCE_NAME_PROMPT_TEMPLATES) { + this.update(); + } + }); + this.update(); + } + + /** + * Updates the service by reloading all template files and watching for changes + */ + protected async update(): Promise { + this.toDispose.dispose(); + // we need to assign local variables, so that updates running in parallel don't interfere with each other + const activeCustomizationsCopy = new Map(); + const trackedTemplateURIsCopy = new Set(); + const allCustomizationsCopy = new Map(); + const watchedFilesCopy = new Map(); + + // Process in order of priority (lowest to highest) + // First process the main templates directory (lowest priority) + const templatesURI = await this.getTemplatesDirectoryURI(); + await this.processTemplateDirectory( + activeCustomizationsCopy, trackedTemplateURIsCopy, allCustomizationsCopy, templatesURI, 1, CustomizationSource.CUSTOMIZED); // Priority 1 for customized fragments + + // Process additional template directories (medium priority) + for (const dirPath of this.additionalTemplateDirs) { + const dirURI = URI.fromFilePath(dirPath); + await this.processTemplateDirectory( + activeCustomizationsCopy, trackedTemplateURIsCopy, allCustomizationsCopy, dirURI, 2, CustomizationSource.FOLDER); // Priority 2 for folder fragments + } + + // Process specific template files (highest priority) + await this.processTemplateFiles(activeCustomizationsCopy, trackedTemplateURIsCopy, allCustomizationsCopy, watchedFilesCopy); + + this.activeCustomizations = activeCustomizationsCopy; + this.trackedTemplateURIs = trackedTemplateURIsCopy; + this.allCustomizations = allCustomizationsCopy; + this.watchedFiles = watchedFilesCopy; + + this.onDidChangeCustomAgentsEmitter.fire(); + } + + /** + * Adds a template to the customizations map, handling conflicts based on priority + * @param activeCustomizationsCopy The map to add the customization to + * @param id The fragment ID + * @param template The template content + * @param sourceUri The URI of the source file (used to distinguish updates from conflicts) + * @param allCustomizationsCopy The map to track all loaded customizations + * @param priority The customization priority + * @param origin The source type of the customization + * @param metadata Optional command metadata + */ + protected addTemplate( + activeCustomizationsCopy: Map, + id: string, + template: string, + sourceUri: string, + allCustomizationsCopy: Map, + priority: number, + origin: CustomizationSource, + metadata?: CommandPromptFragmentMetadata + ): void { + // Generate a unique customization ID based on source URI and priority + const customizationId = this.generateCustomizationId(id, sourceUri); + + // Create customization object with metadata + const customization: PromptFragmentCustomization = { + id, + template, + sourceUri, + priority, + customizationId, + origin, + ...(metadata && { + isCommand: metadata.isCommand, + commandName: metadata.commandName, + commandDescription: metadata.commandDescription, + commandArgumentHint: metadata.commandArgumentHint, + commandAgents: metadata.commandAgents, + }) + }; + + // Always add to allCustomizationsCopy to keep track of all customizations including overridden ones + if (sourceUri) { + allCustomizationsCopy.set(sourceUri, customization); + } + + const existingEntry = activeCustomizationsCopy.get(id); + + if (existingEntry) { + // If this is an update to the same file (same source URI) + if (sourceUri && existingEntry.sourceUri === sourceUri) { + // Update the content while keeping the same priority and source + activeCustomizationsCopy.set(id, customization); + return; + } + + // If the new customization has higher priority, replace the existing one + if (priority > existingEntry.priority) { + activeCustomizationsCopy.set(id, customization); + return; + } else if (priority === existingEntry.priority) { + // There is a conflict with the same priority, we ignore the new customization + const conflictSourceUri = existingEntry.sourceUri ? ` (Existing source: ${existingEntry.sourceUri}, New source: ${sourceUri})` : ''; + console.warn(`Fragment conflict detected for ID '${id}' with equal priority.${conflictSourceUri}`); + } + return; + } + + // No conflict at all, add the customization + activeCustomizationsCopy.set(id, customization); + } + + /** + * Generates a unique customization ID based on the fragment ID, source URI, and priority + * @param id The fragment ID + * @param sourceUri The source URI of the template + * @returns A unique customization ID + */ + protected generateCustomizationId(id: string, sourceUri: string): string { + // Create a customization ID that contains information about the source and priority + // This ensures uniqueness across different customization sources + const sourceHash = this.hashString(sourceUri); + return `${id}_${sourceHash}`; + } + + /** + * Simple hash function to generate a short identifier from a string + * @param str The string to hash + * @returns A string hash + */ + protected hashString(str: string): string { + let hash = 0; + for (let i = 0; i < str.length; i++) { + const char = str.charCodeAt(i); + hash = ((hash << 5) - hash) + char; + hash = hash & hash; // Convert to 32bit integer + } + return Math.abs(hash).toString(36).substring(0, 8); + } + + /** + * Parses a template file that may contain YAML front matter + * @param fileContent The raw file content + * @returns Parsed metadata and template content + */ + protected parseTemplateWithMetadata(fileContent: string): ParsedTemplate { + return parseTemplateWithMetadata(fileContent); + } + + /** + * Removes a customization from customizations maps based on the source URI. + * Also checks for any lower-priority customizations with the same ID that might need to be loaded. + * @param sourceUri The URI of the source file being removed + * @param allCustomizationsCopy The map of all loaded customizations + * @param activeCustomizationsCopy The map of active customizations + * @param trackedTemplateURIsCopy Optional set of tracked URIs to update + * @returns The fragment ID that was removed, or undefined if no customization was found + */ + protected removeCustomizationFromMaps( + sourceUri: string, + allCustomizationsCopy: Map, + activeCustomizationsCopy: Map, + trackedTemplateURIsCopy: Set + ): string | undefined { + // Get the customization entry from allCustomizationsCopy + const removedCustomization = allCustomizationsCopy.get(sourceUri); + if (!removedCustomization) { + return undefined; + } + const fragmentId = removedCustomization.id; + allCustomizationsCopy.delete(sourceUri); + trackedTemplateURIsCopy.delete(sourceUri); + + // If the customization is in the active customizations map, we check if there is another customization previously conflicting with it + const activeCustomization = activeCustomizationsCopy.get(fragmentId); + if (activeCustomization && activeCustomization.sourceUri === sourceUri) { + activeCustomizationsCopy.delete(fragmentId); + // Find any lower-priority customizations with the same ID that were previously ignored + const lowerPriorityCustomizations = Array.from(allCustomizationsCopy.values()) + .filter(t => t.id === fragmentId) + .sort((a, b) => b.priority - a.priority); // Sort by priority (highest first) + + // If there are any lower-priority customizations, add the highest priority one + if (lowerPriorityCustomizations.length > 0) { + const highestRemainingCustomization = lowerPriorityCustomizations[0]; + activeCustomizationsCopy.set(fragmentId, highestRemainingCustomization); + } + + } + + return fragmentId; + } + + /** + * Process the template files specified by path, watching for changes + * and loading their content into the customizations map + * @param activeCustomizationsCopy Map to store active customizations + * @param trackedTemplateURIsCopy Set to track URIs being monitored + * @param allCustomizationsCopy Map to store all loaded customizations + * @param watchedFilesCopy Map to store file watch information + */ + protected async processTemplateFiles( + activeCustomizationsCopy: Map, + trackedTemplateURIsCopy: Set, + allCustomizationsCopy: Map, + watchedFilesCopy: Map + ): Promise { + const priority = 3; // Highest priority for specific files + + const parsedPromptFragments = new Set(); + + for (const filePath of this.workspaceTemplateFiles) { + const fileURI = URI.fromFilePath(filePath); + const fragmentId = this.getFragmentIdFromFilePath(filePath); + const uriString = fileURI.toString(); + const customizationId = this.generateCustomizationId(fragmentId, uriString); + + watchedFilesCopy.set(uriString, { uri: fileURI, fragmentId, customizationId }); + this.toDispose.push(this.fileService.watch(fileURI, { recursive: false, excludes: [] })); + + if (await this.fileService.exists(fileURI)) { + trackedTemplateURIsCopy.add(uriString); + const fileContent = await this.fileService.read(fileURI); + const parsed = this.parseTemplateWithMetadata(fileContent.value); + this.addTemplate(activeCustomizationsCopy, fragmentId, parsed.template, uriString, allCustomizationsCopy, priority, CustomizationSource.FILE, parsed.metadata); + parsedPromptFragments.add(fragmentId); + } + } + + this.onDidChangePromptFragmentCustomizationEmitter.fire(Array.from(parsedPromptFragments)); + + this.toDispose.push(this.fileService.onDidFilesChange(async (event: FileChangesEvent) => { + // Only watch for changes that are in the watchedFiles map + if (!event.changes.some(change => this.watchedFiles.get(change.resource.toString()))) { + return; + } + // Track changes for batched notification + const changedFragmentIds = new Set(); + + // Handle deleted files + for (const deletedFile of event.getDeleted()) { + const fileUriString = deletedFile.resource.toString(); + const fileInfo = this.watchedFiles.get(fileUriString); + + if (fileInfo) { + const removedFragmentId = this.removeCustomizationFromMaps(fileUriString, allCustomizationsCopy, activeCustomizationsCopy, trackedTemplateURIsCopy); + if (removedFragmentId) { + changedFragmentIds.add(removedFragmentId); + } + } + } + + // Handle updated files + for (const updatedFile of event.getUpdated()) { + const fileUriString = updatedFile.resource.toString(); + const fileInfo = this.watchedFiles.get(fileUriString); + + if (fileInfo) { + const fileContent = await this.fileService.read(fileInfo.uri); + const parsed = this.parseTemplateWithMetadata(fileContent.value); + this.addTemplate( + this.activeCustomizations, + fileInfo.fragmentId, + parsed.template, + fileUriString, + this.allCustomizations, + priority, + CustomizationSource.FILE, + parsed.metadata + ); + changedFragmentIds.add(fileInfo.fragmentId); + } + } + + // Handle newly created files + for (const addedFile of event.getAdded()) { + const fileUriString = addedFile.resource.toString(); + const fileInfo = this.watchedFiles.get(fileUriString); + + if (fileInfo) { + const fileContent = await this.fileService.read(fileInfo.uri); + const parsed = this.parseTemplateWithMetadata(fileContent.value); + this.addTemplate( + this.activeCustomizations, + fileInfo.fragmentId, + parsed.template, + fileUriString, + this.allCustomizations, + priority, + CustomizationSource.FILE, + parsed.metadata + ); + this.trackedTemplateURIs.add(fileUriString); + changedFragmentIds.add(fileInfo.fragmentId); + } + } + + const changedFragmentIdsArray = Array.from(changedFragmentIds); + if (changedFragmentIdsArray.length > 0) { + this.onDidChangePromptFragmentCustomizationEmitter.fire(changedFragmentIdsArray); + }; + })); + } + + /** + * Extract a fragment ID from a file path + * @param filePath The path to the template file + * @returns A fragment ID derived from the file name + */ + protected getFragmentIdFromFilePath(filePath: string): string { + const uri = URI.fromFilePath(filePath); + return this.removePromptTemplateSuffix(uri.path.name); + } + + /** + * Processes a directory for template files, adding them to the customizations map + * and setting up file watching + * @param activeCustomizationsCopy Map to store active customizations + * @param trackedTemplateURIsCopy Set to track URIs being monitored + * @param allCustomizationsCopy Map to store all loaded customizations + * @param dirURI URI of the directory to process + * @param priority Priority level for customizations in this directory + * @param customizationSource Source type of the customization + */ + protected async processTemplateDirectory( + activeCustomizationsCopy: Map, + trackedTemplateURIsCopy: Set, + allCustomizationsCopy: Map, + dirURI: URI, + priority: number, + customizationSource: CustomizationSource + ): Promise { + const dirExists = await this.fileService.exists(dirURI); + + // Process existing files if directory exists + if (dirExists) { + await this.processExistingTemplateDirectory( + activeCustomizationsCopy, + trackedTemplateURIsCopy, + allCustomizationsCopy, + dirURI, + priority, + customizationSource + ); + } + + // Set up file watching for the directory (works for both existing and non-existing directories) + this.setupDirectoryWatcher(dirURI, priority, customizationSource); + } + + /** + * Processes an existing directory for template files + * @param activeCustomizationsCopy Map to store active customizations + * @param trackedTemplateURIsCopy Set to track URIs being monitored + * @param allCustomizationsCopy Map to store all loaded customizations + * @param dirURI URI of the directory to process + * @param priority Priority level for customizations in this directory + * @param customizationSource Source type of the customization + */ + protected async processExistingTemplateDirectory( + activeCustomizationsCopy: Map, + trackedTemplateURIsCopy: Set, + allCustomizationsCopy: Map, + dirURI: URI, + priority: number, + customizationSource: CustomizationSource + ): Promise { + const stat = await this.fileService.resolve(dirURI); + if (stat.children === undefined) { + return; + } + + const parsedPromptFragments = new Set(); + for (const file of stat.children) { + if (!file.isFile) { + continue; + } + const fileURI = file.resource; + if (this.isPromptTemplateExtension(fileURI.path.ext)) { + trackedTemplateURIsCopy.add(fileURI.toString()); + const fileContent = await this.fileService.read(fileURI); + const parsed = this.parseTemplateWithMetadata(fileContent.value); + const fragmentId = this.removePromptTemplateSuffix(file.name); + this.addTemplate(activeCustomizationsCopy, fragmentId, parsed.template, fileURI.toString(), allCustomizationsCopy, priority, customizationSource, parsed.metadata); + parsedPromptFragments.add(fragmentId); + } + } + this.onDidChangePromptFragmentCustomizationEmitter.fire(Array.from(parsedPromptFragments)); + this.onDidChangeCustomAgentsEmitter.fire(); + } + + /** + * Sets up file watching for a template directory (works for both existing and non-existing directories) + * @param dirURI URI of the directory to watch + * @param priority Priority level for customizations in this directory + * @param customizationSource Source type of the customization + */ + protected setupDirectoryWatcher( + dirURI: URI, + priority: number, + customizationSource: CustomizationSource + ): void { + this.toDispose.push(this.fileService.watch(dirURI, { recursive: true, excludes: [] })); + this.toDispose.push(this.fileService.onDidFilesChange(async (event: FileChangesEvent) => { + // Filter for changes within the watched directory + if (!event.changes.some(change => change.resource.toString().startsWith(dirURI.toString()))) { + return; + } + + // Handle directory creation or deletion (when watching a previously non-existent directory) + if (event.getAdded().some(addedFile => addedFile.resource.toString() === dirURI.toString()) || + event.getDeleted().some(deletedFile => deletedFile.resource.toString() === dirURI.toString())) { + // Directory was created or deleted, restart the update process to handle the change + await this.update(); + return; + } + + if (event.changes.some(change => change.resource.toString().endsWith('customAgents.yml'))) { + this.onDidChangeCustomAgentsEmitter.fire(); + } + + // Track changes for batched notification + const changedFragmentIds = new Set(); + + // Handle deleted templates + for (const deletedFile of event.getDeleted()) { + const uriString = deletedFile.resource.toString(); + if (this.trackedTemplateURIs.has(uriString)) { + const removedFragmentId = this.removeCustomizationFromMaps( + uriString, + this.allCustomizations, + this.activeCustomizations, + this.trackedTemplateURIs + ); + if (removedFragmentId) { + changedFragmentIds.add(removedFragmentId); + } + } + } + + // Handle updated templates + for (const updatedFile of event.getUpdated()) { + const uriString = updatedFile.resource.toString(); + if (this.trackedTemplateURIs.has(uriString)) { + const fileContent = await this.fileService.read(updatedFile.resource); + const parsed = this.parseTemplateWithMetadata(fileContent.value); + const fragmentId = this.removePromptTemplateSuffix(updatedFile.resource.path.name); + this.addTemplate( + this.activeCustomizations, + fragmentId, + parsed.template, + uriString, + this.allCustomizations, + priority, + customizationSource, + parsed.metadata + ); + changedFragmentIds.add(fragmentId); + } + } + + // Handle new templates + for (const addedFile of event.getAdded()) { + if (addedFile.resource.parent.toString() === dirURI.toString() && + this.isPromptTemplateExtension(addedFile.resource.path.ext)) { + const uriString = addedFile.resource.toString(); + this.trackedTemplateURIs.add(uriString); + const fileContent = await this.fileService.read(addedFile.resource); + const parsed = this.parseTemplateWithMetadata(fileContent.value); + const fragmentId = this.removePromptTemplateSuffix(addedFile.resource.path.name); + this.addTemplate( + this.activeCustomizations, + fragmentId, + parsed.template, + uriString, + this.allCustomizations, + priority, + customizationSource, + parsed.metadata + ); + changedFragmentIds.add(fragmentId); + } + } + + const changedFragmentIdsArray = Array.from(changedFragmentIds); + if (changedFragmentIdsArray.length > 0) { + this.onDidChangePromptFragmentCustomizationEmitter.fire(changedFragmentIdsArray); + } + })); + } + + /** + * Checks if the given file extension is registered as a prompt template extension + * @param extension The file extension including the leading dot (e.g., '.prompttemplate') + * @returns True if the extension is registered as a prompt template extension + */ + protected isPromptTemplateExtension(extension: string): boolean { + return this.templateExtensions.has(extension); + } + + /** + * Gets the list of additional template directories that are being watched. + * @returns Array of directory paths + */ + getAdditionalTemplateDirectories(): string[] { + return Array.from(this.additionalTemplateDirs); + } + + /** + * Gets the list of file extensions that are considered prompt templates. + * @returns Array of file extensions including the leading dot (e.g., '.prompttemplate') + */ + getTemplateFileExtensions(): string[] { + return Array.from(this.templateExtensions); + } + + /** + * Gets the list of specific template files that are being watched. + * @returns Array of file paths + */ + getTemplateFiles(): string[] { + return Array.from(this.workspaceTemplateFiles); + } + + /** + * Updates multiple configuration properties at once, triggering only a single update process. + * @param properties An object containing the properties to update + * @returns Promise that resolves when the update is complete + */ + async updateConfiguration(properties: PromptFragmentCustomizationProperties): Promise { + if (properties.directoryPaths !== undefined) { + this.additionalTemplateDirs.clear(); + for (const path of properties.directoryPaths) { + this.additionalTemplateDirs.add(path); + } + } + + if (properties.extensions !== undefined) { + this.templateExtensions.clear(); + for (const ext of properties.extensions) { + this.templateExtensions.add(ext); + } + // Always include the default PROMPT_TEMPLATE_EXTENSION + this.templateExtensions.add(PROMPT_TEMPLATE_EXTENSION); + } + + if (properties.filePaths !== undefined) { + this.workspaceTemplateFiles.clear(); + for (const path of properties.filePaths) { + this.workspaceTemplateFiles.add(path); + } + } + + // Only run the update process once, no matter how many properties were changed + await this.update(); + } + + /** + * Gets the URI of the templates directory + * @returns URI of the templates directory + */ + protected async getTemplatesDirectoryURI(): Promise { + const templatesFolder = this.preferences[PREFERENCE_NAME_PROMPT_TEMPLATES]; + if (templatesFolder && templatesFolder.trim().length > 0) { + return URI.fromFilePath(templatesFolder); + } + const theiaConfigDir = await this.envVariablesServer.getConfigDirUri(); + return new URI(theiaConfigDir).resolve('prompt-templates'); + } + + /** + * Gets the URI for a specific template file + * @param fragmentId The fragment ID + * @returns URI for the template file + */ + protected async getTemplateURI(fragmentId: string): Promise { + return (await this.getTemplatesDirectoryURI()).resolve(`${fragmentId}${PROMPT_TEMPLATE_EXTENSION}`); + } + + /** + * Removes the prompt template extension from a filename + * @param filename The filename with extension + * @returns The filename without the extension + */ + protected removePromptTemplateSuffix(filename: string): string { + for (const ext of this.templateExtensions) { + if (filename.endsWith(ext)) { + return filename.slice(0, -ext.length); + } + } + return filename; + } + + // PromptFragmentCustomizationService interface implementation + + isPromptFragmentCustomized(id: string): boolean { + return this.activeCustomizations.has(id); + } + + getActivePromptFragmentCustomization(id: string): CustomizedPromptFragment | undefined { + const entry = this.activeCustomizations.get(id); + if (!entry) { + return undefined; + } + + return { + id: entry.id, + template: entry.template, + customizationId: entry.customizationId, + priority: entry.priority, + // Pass through command metadata + isCommand: entry.isCommand, + commandName: entry.commandName, + commandDescription: entry.commandDescription, + commandArgumentHint: entry.commandArgumentHint, + commandAgents: entry.commandAgents, + }; + } + + getAllCustomizations(id: string): CustomizedPromptFragment[] { + const fragments: CustomizedPromptFragment[] = []; + + // Collect all customizations with matching ID + this.allCustomizations.forEach(value => { + if (value.id === id) { + fragments.push({ + id: value.id, + template: value.template, + customizationId: value.customizationId, + priority: value.priority, + // Pass through command metadata + isCommand: value.isCommand, + commandName: value.commandName, + commandDescription: value.commandDescription, + commandArgumentHint: value.commandArgumentHint, + commandAgents: value.commandAgents, + }); + } + }); + + // Sort by priority (highest first) + return fragments.sort((a, b) => b.priority - a.priority); + } + + getCustomizedPromptFragmentIds(): string[] { + return Array.from(this.activeCustomizations.keys()); + } + + async createPromptFragmentCustomization(id: string, defaultContent?: string): Promise { + await this.editTemplate(id, defaultContent); + } + + async createBuiltInPromptFragmentCustomization(id: string, defaultContent?: string): Promise { + await this.createPromptFragmentCustomization(id, defaultContent); + } + + async editPromptFragmentCustomization(id: string, customizationId: string): Promise { + // Find the customization with the given customization ID + const customization = Array.from(this.allCustomizations.values()).find(t => + t.id === id && t.customizationId === customizationId + ); + + if (customization) { + const uri = new URI(customization.sourceUri); + const openHandler = await this.openerService.getOpener(uri); + openHandler.open(uri); + } else { + // Fall back to editing by fragment ID if customization ID not found + await this.editTemplate(id); + } + } + + /** + * Edits a template by opening it in the editor, creating it if it doesn't exist + * @param id The fragment ID + * @param defaultContent Optional default content for new templates + */ + protected async editTemplate(id: string, defaultContent?: string): Promise { + const editorUri = await this.getTemplateURI(id); + if (!(await this.fileService.exists(editorUri))) { + await this.fileService.createFile(editorUri, BinaryBuffer.fromString(defaultContent ?? '')); + } + const openHandler = await this.openerService.getOpener(editorUri); + openHandler.open(editorUri); + } + + async removePromptFragmentCustomization(id: string, customizationId: string): Promise { + // Find the customization with the given customization ID + const customization = Array.from(this.allCustomizations.values()).find(t => + t.id === id && t.customizationId === customizationId + ); + + if (customization) { + const sourceUri = customization.sourceUri; + + // Delete the file if it exists + const uri = new URI(sourceUri); + if (await this.fileService.exists(uri)) { + await this.fileService.delete(uri); + } + } + } + + async removeAllPromptFragmentCustomizations(id: string): Promise { + // Get all customizations for this fragment ID + const customizations = this.getAllCustomizations(id); + + if (customizations.length === 0) { + return; // Nothing to reset + } + + // Find and delete all customization files + for (const customization of customizations) { + const fragment = Array.from(this.allCustomizations.values()).find(t => + t.id === id && t.customizationId === customization.customizationId + ); + + if (fragment) { + const sourceUri = fragment.sourceUri; + // Delete the file if it exists + const uri = new URI(sourceUri); + if (await this.fileService.exists(uri)) { + await this.fileService.delete(uri); + } + } + } + } + + async resetToCustomization(id: string, customizationId: string): Promise { + const customization = Array.from(this.allCustomizations.values()).find(t => + t.id === id && t.customizationId === customizationId + ); + + if (customization) { + // Get all customizations for this fragment ID + const customizations = this.getAllCustomizations(id); + + if (customizations.length === 0) { + return; // Nothing to reset + } + + // Find the target customization + const targetCustomization = customizations.find(c => c.customizationId === customizationId); + if (!targetCustomization) { + return; // Target customization not found + } + + // Find and delete all higher-priority customization files + for (const cust of customizations) { + if (cust.priority > targetCustomization.priority) { + const fragmentToDelete = Array.from(this.allCustomizations.values()).find(t => + t.id === cust.id && t.customizationId === cust.customizationId + ); + if (fragmentToDelete) { + const sourceUri = fragmentToDelete.sourceUri; + + // Delete the file if it exists + const uri = new URI(sourceUri); + if (await this.fileService.exists(uri)) { + await this.fileService.delete(uri); + } + } + } + } + } + } + + async getPromptFragmentCustomizationDescription(id: string, customizationId: string): Promise { + // Find the customization with the given customization ID + const customization = Array.from(this.allCustomizations.values()).find(t => + t.id === id && t.customizationId === customizationId + ); + + if (customization) { + return customization.sourceUri; + } + + return undefined; + } + + async getPromptFragmentCustomizationType(id: string, customizationId: string): Promise { + // Find the customization with the given customization ID + const customization = Array.from(this.allCustomizations.values()).find(t => + t.id === id && t.customizationId === customizationId + ); + + if (customization) { + return getCustomizationSourceString(customization.origin); + } + + return undefined; + } + + async editBuiltIn(id: string, defaultContent = ''): Promise { + // Find an existing built-in customization (those with priority 1) + const builtInCustomization = Array.from(this.allCustomizations.values()).find(t => + t.id === id && t.priority === 1 + ); + + if (builtInCustomization) { + // Edit the existing built-in customization + const uri = new URI(builtInCustomization.sourceUri); + const openHandler = await this.openerService.getOpener(uri); + openHandler.open(uri); + } else { + // Create a new built-in customization + // Get the template URI in the main templates directory (priority 1) + const templateUri = await this.getTemplateURI(id); + + // If template doesn't exist, create it with default content + if (!(await this.fileService.exists(templateUri))) { + await this.fileService.createFile(templateUri, BinaryBuffer.fromString(defaultContent)); + } + + // Open the template in the editor + const openHandler = await this.openerService.getOpener(templateUri); + openHandler.open(templateUri); + } + } + + async resetBuiltInCustomization(id: string): Promise { + // Find a built-in customization (those with priority 1) + const builtInCustomization = Array.from(this.allCustomizations.values()).find(t => + t.id === id && t.priority === 1 + ); + + if (!builtInCustomization) { + return; // No built-in customization found + } + + const sourceUri = builtInCustomization.sourceUri; + + // Delete the file if it exists + const uri = new URI(sourceUri); + if (await this.fileService.exists(uri)) { + await this.fileService.delete(uri); + } + } + + async editBuiltInPromptFragmentCustomization(id: string, defaultContent?: string): Promise { + return this.editBuiltIn(id, defaultContent); + } + + /** + * Gets the fragment ID from a URI + * @param uri URI to check + * @returns Fragment ID or undefined if not found + */ + protected getFragmentIDFromURI(uri: URI): string | undefined { + const id = this.removePromptTemplateSuffix(uri.path.name); + if (this.activeCustomizations.has(id)) { + return id; + } + return undefined; + } + + /** + * Implementation of the generic getPromptFragmentIDFromResource method in the interface + * Accepts any resource identifier but only processes URIs + * @param resourceId Resource to check + * @returns Fragment ID or undefined if not found + */ + getPromptFragmentIDFromResource(resourceId: unknown): string | undefined { + // Check if the resource is a URI + if (resourceId instanceof URI) { + return this.getFragmentIDFromURI(resourceId); + } + return undefined; + } + + async getCustomAgents(): Promise { + const agentsById = new Map(); + // First, process additional (workspace) template directories to give them precedence + for (const dirPath of this.additionalTemplateDirs) { + const dirURI = URI.fromFilePath(dirPath); + await this.loadCustomAgentsFromDirectory(dirURI, agentsById); + } + // Then process global templates directory (only adding agents that don't conflict) + const globalTemplatesDir = await this.getTemplatesDirectoryURI(); + await this.loadCustomAgentsFromDirectory(globalTemplatesDir, agentsById); + // Return the merged list of agents + return Array.from(agentsById.values()); + } + + /** + * Load custom agents from a specific directory + * @param directoryURI The URI of the directory to load from + * @param agentsById Map to store the loaded agents by ID + */ + protected async loadCustomAgentsFromDirectory( + directoryURI: URI, + agentsById: Map + ): Promise { + const customAgentYamlUri = directoryURI.resolve('customAgents.yml'); + const yamlExists = await this.fileService.exists(customAgentYamlUri); + if (!yamlExists) { + return; + } + + try { + const fileContent = await this.fileService.read(customAgentYamlUri, { encoding: 'utf-8' }); + const doc = load(fileContent.value); + + if (!Array.isArray(doc) || !doc.every(entry => CustomAgentDescription.is(entry))) { + console.debug(`Invalid customAgents.yml file content in ${directoryURI.toString()}`); + return; + } + + const readAgents = doc as CustomAgentDescription[]; + + // Add agents to the map if they don't already exist + for (const agent of readAgents) { + if (!agentsById.has(agent.id)) { + agentsById.set(agent.id, agent); + } + } + } catch (e) { + console.debug(`Error loading customAgents.yml from ${directoryURI.toString()}: ${e.message}`, e); + } + } + + /** + * Returns all locations of existing customAgents.yml files and potential locations where + * new customAgents.yml files could be created. + * + * @returns An array of objects containing the URI and whether the file exists + */ + async getCustomAgentsLocations(): Promise<{ uri: URI, exists: boolean }[]> { + const locations: { uri: URI, exists: boolean }[] = []; + // Check global templates directory + const globalTemplatesDir = await this.getTemplatesDirectoryURI(); + const globalAgentsUri = globalTemplatesDir.resolve('customAgents.yml'); + const globalExists = await this.fileService.exists(globalAgentsUri); + locations.push({ uri: globalAgentsUri, exists: globalExists }); + // Check additional (workspace) template directories + for (const dirPath of this.additionalTemplateDirs) { + const dirURI = URI.fromFilePath(dirPath); + const agentsUri = dirURI.resolve('customAgents.yml'); + const exists = await this.fileService.exists(agentsUri); + locations.push({ uri: agentsUri, exists: exists }); + } + return locations; + } + + /** + * Opens an existing customAgents.yml file at the given URI, or creates a new one if it doesn't exist. + * + * @param uri The URI of the customAgents.yml file to open or create + */ + async openCustomAgentYaml(uri: URI): Promise { + const content = dump([newCustomAgentEntry]); + if (! await this.fileService.exists(uri)) { + await this.fileService.createFile(uri, BinaryBuffer.fromString(content)); + } else { + const fileContent = (await this.fileService.readFile(uri)).value; + await this.fileService.writeFile(uri, BinaryBuffer.concat([fileContent, BinaryBuffer.fromString(content)])); + } + const openHandler = await this.openerService.getOpener(uri); + openHandler.open(uri); + } +} diff --git a/packages/ai-core/src/browser/frontend-variable-service.ts b/packages/ai-core/src/browser/frontend-variable-service.ts new file mode 100644 index 0000000..120d4ad --- /dev/null +++ b/packages/ai-core/src/browser/frontend-variable-service.ts @@ -0,0 +1,217 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { Disposable, MessageService, nls, Prioritizeable } from '@theia/core'; +import { FrontendApplicationContribution, OpenerService, open } from '@theia/core/lib/browser'; +import { inject, injectable } from '@theia/core/shared/inversify'; +import { + AIVariable, + AIVariableArg, + AIVariableContext, + AIVariableOpener, + AIVariableResolutionRequest, + AIVariableResourceResolver, + AIVariableService, + DefaultAIVariableService, + PromptText +} from '../common'; +import * as monaco from '@theia/monaco-editor-core'; + +export type AIVariableDropHandler = (event: DragEvent, context: AIVariableContext) => Promise; + +export interface AIVariableDropResult { + variables: AIVariableResolutionRequest[], + text?: string +}; + +export type AIVariablePasteHandler = (event: ClipboardEvent, context: AIVariableContext) => Promise; + +export interface AIVariablePasteResult { + variables: AIVariableResolutionRequest[], + text?: string +}; + +export interface AIVariableCompletionContext { + /** Portion of user input to be used for filtering completion candidates. */ + userInput: string; + /** The range of suggestion completions. */ + range: monaco.Range + /** A prefix to be applied to each completion item's text */ + prefix: string +} + +export namespace AIVariableCompletionContext { + export function get( + variableName: string, + model: monaco.editor.ITextModel, + position: monaco.Position, + matchString?: string + ): AIVariableCompletionContext | undefined { + const lineContent = model.getLineContent(position.lineNumber); + const indexOfVariableTrigger = lineContent.lastIndexOf(matchString ?? PromptText.VARIABLE_CHAR, position.column - 1); + + // check if there is a variable trigger and no space typed between the variable trigger and the cursor + if (indexOfVariableTrigger === -1 || lineContent.substring(indexOfVariableTrigger).includes(' ')) { + return undefined; + } + + // determine whether we are providing completions before or after the variable argument separator + const indexOfVariableArgSeparator = lineContent.lastIndexOf(PromptText.VARIABLE_SEPARATOR_CHAR, position.column - 1); + const triggerCharIndex = Math.max(indexOfVariableTrigger, indexOfVariableArgSeparator); + + const userInput = lineContent.substring(triggerCharIndex + 1, position.column - 1); + const range = new monaco.Range(position.lineNumber, triggerCharIndex + 2, position.lineNumber, position.column); + const matchVariableChar = lineContent[triggerCharIndex] === (matchString ? matchString : PromptText.VARIABLE_CHAR); + const prefix = matchVariableChar ? variableName + PromptText.VARIABLE_SEPARATOR_CHAR : ''; + return { range, userInput, prefix }; + } +} + +export const FrontendVariableService = Symbol('FrontendVariableService'); +export interface FrontendVariableService extends AIVariableService { + registerDropHandler(handler: AIVariableDropHandler): Disposable; + unregisterDropHandler(handler: AIVariableDropHandler): void; + getDropResult(event: DragEvent, context: AIVariableContext): Promise; + + registerPasteHandler(handler: AIVariablePasteHandler): Disposable; + unregisterPasteHandler(handler: AIVariablePasteHandler): void; + getPasteResult(event: ClipboardEvent, context: AIVariableContext): Promise; + + registerOpener(variable: AIVariable, opener: AIVariableOpener): Disposable; + unregisterOpener(variable: AIVariable, opener: AIVariableOpener): void; + getOpener(name: string, arg: string | undefined, context: AIVariableContext): Promise; + open(variable: AIVariableArg, context?: AIVariableContext): Promise +} + +export interface FrontendVariableContribution { + registerVariables(service: FrontendVariableService): void; +} + +@injectable() +export class DefaultFrontendVariableService extends DefaultAIVariableService implements FrontendApplicationContribution, FrontendVariableService { + protected dropHandlers = new Set(); + protected pasteHandlers = new Set(); + + @inject(MessageService) protected readonly messageService: MessageService; + @inject(AIVariableResourceResolver) protected readonly aiResourceResolver: AIVariableResourceResolver; + @inject(OpenerService) protected readonly openerService: OpenerService; + + onStart(): void { + this.initContributions(); + } + + registerDropHandler(handler: AIVariableDropHandler): Disposable { + this.dropHandlers.add(handler); + return Disposable.create(() => this.unregisterDropHandler(handler)); + } + + unregisterDropHandler(handler: AIVariableDropHandler): void { + this.dropHandlers.delete(handler); + } + + async getDropResult(event: DragEvent, context: AIVariableContext): Promise { + let text: string | undefined = undefined; + const variables: AIVariableResolutionRequest[] = []; + for (const handler of this.dropHandlers) { + const result = await handler(event, context); + if (result) { + variables.push(...result.variables); + if (text === undefined) { + text = result.text; + } + } + } + return { variables, text }; + } + + registerPasteHandler(handler: AIVariablePasteHandler): Disposable { + this.pasteHandlers.add(handler); + return Disposable.create(() => this.unregisterPasteHandler(handler)); + } + + unregisterPasteHandler(handler: AIVariablePasteHandler): void { + this.pasteHandlers.delete(handler); + } + + async getPasteResult(event: ClipboardEvent, context: AIVariableContext): Promise { + let text: string | undefined = undefined; + const variables: AIVariableResolutionRequest[] = []; + for (const handler of this.pasteHandlers) { + const result = await handler(event, context); + if (result) { + variables.push(...result.variables); + if (text === undefined) { + text = result.text; + } + } + } + return { variables, text }; + } + + registerOpener(variable: AIVariable, opener: AIVariableOpener): Disposable { + const key = this.getKey(variable.name); + if (!this.variables.get(key)) { + this.variables.set(key, variable); + this.onDidChangeVariablesEmitter.fire(); + } + const openers = this.openers.get(key) ?? []; + openers.push(opener); + this.openers.set(key, openers); + return Disposable.create(() => this.unregisterOpener(variable, opener)); + } + + unregisterOpener(variable: AIVariable, opener: AIVariableOpener): void { + const key = this.getKey(variable.name); + const registeredOpeners = this.openers.get(key); + registeredOpeners?.splice(registeredOpeners.indexOf(opener), 1); + } + + async getOpener(name: string, arg: string | undefined, context: AIVariableContext = {}): Promise { + const variable = this.getVariable(name); + return variable && Prioritizeable.prioritizeAll( + this.openers.get(this.getKey(name)) ?? [], + opener => (async () => opener.canOpen({ variable, arg }, context))().catch(() => 0) + ) + .then(prioritized => prioritized.at(0)?.value); + } + + async open(request: AIVariableArg, context?: AIVariableContext | undefined): Promise { + const { variableName, arg } = this.parseRequest(request); + const variable = this.getVariable(variableName); + if (!variable) { + this.messageService.warn(nls.localize('theia/ai/core/noVariableFoundForOpenRequest', 'No variable found for open request.')); + return; + } + const opener = await this.getOpener(variableName, arg, context); + try { + return opener ? opener.open({ variable, arg }, context ?? {}) : this.openReadonly({ variable, arg }, context); + } catch (err) { + console.error('Unable to open variable:', err); + this.messageService.error(nls.localize('theia/ai/core/unableToDisplayVariableValue', 'Unable to display variable value.')); + } + } + + protected async openReadonly(request: AIVariableResolutionRequest, context: AIVariableContext = {}): Promise { + const resolved = await this.resolveVariable(request, context); + if (resolved === undefined) { + this.messageService.warn(nls.localize('theia/ai/core/unableToResolveVariable', 'Unable to resolve variable.')); + return; + } + const resource = this.aiResourceResolver.getOrCreate(request, context, resolved.value); + await open(this.openerService, resource.uri); + resource.dispose(); + } +} diff --git a/packages/ai-core/src/browser/index.ts b/packages/ai-core/src/browser/index.ts new file mode 100644 index 0000000..cdc4207 --- /dev/null +++ b/packages/ai-core/src/browser/index.ts @@ -0,0 +1,38 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +export * from './agent-completion-notification-service'; +export * from './os-notification-service'; +export * from './window-blink-service'; +export * from './ai-activation-service'; +export * from './ai-command-handler-factory'; +export * from './ai-core-frontend-application-contribution'; +export * from './ai-core-frontend-module'; +export * from '../common/ai-core-preferences'; +export * from './ai-settings-service'; +export * from './ai-view-contribution'; +export * from './frontend-language-model-registry'; +export * from './frontend-language-model-alias-registry'; +export * from './frontend-variable-service'; +export * from './prompttemplate-contribution'; +export * from './theia-variable-contribution'; +export * from './open-editors-variable-contribution'; +export * from './skills-variable-contribution'; +export * from './skill-service'; +export * from './skill-prompt-coordinator'; +export * from './frontend-variable-service'; +export * from './ai-core-command-contribution'; +export * from '../common/language-model-service'; diff --git a/packages/ai-core/src/browser/open-editors-variable-contribution.ts b/packages/ai-core/src/browser/open-editors-variable-contribution.ts new file mode 100644 index 0000000..41cd4d2 --- /dev/null +++ b/packages/ai-core/src/browser/open-editors-variable-contribution.ts @@ -0,0 +1,88 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { MaybePromise, nls } from '@theia/core'; +import { injectable, inject } from '@theia/core/shared/inversify'; +import { EditorManager } from '@theia/editor/lib/browser'; +import { WorkspaceService } from '@theia/workspace/lib/browser'; +import URI from '@theia/core/lib/common/uri'; +import { AIVariable, ResolvedAIVariable, AIVariableContribution, AIVariableResolver, AIVariableService, AIVariableResolutionRequest, AIVariableContext } from '../common'; + +export const OPEN_EDITORS_VARIABLE: AIVariable = { + id: 'openEditors', + description: nls.localize('theia/ai/core/openEditorsVariable/description', 'A comma-separated list of all currently open files, relative to the workspace root.'), + name: 'openEditors', +}; + +export const OPEN_EDITORS_SHORT_VARIABLE: AIVariable = { + id: 'openEditorsShort', + description: nls.localize('theia/ai/core/openEditorsShortVariable/description', 'Short reference to all currently open files (relative paths, comma-separated)'), + name: '_ff', +}; + +@injectable() +export class OpenEditorsVariableContribution implements AIVariableContribution, AIVariableResolver { + + @inject(EditorManager) + protected readonly editorManager: EditorManager; + + @inject(WorkspaceService) + protected readonly workspaceService: WorkspaceService; + + registerVariables(service: AIVariableService): void { + service.registerResolver(OPEN_EDITORS_VARIABLE, this); + service.registerResolver(OPEN_EDITORS_SHORT_VARIABLE, this); + } + + canResolve(request: AIVariableResolutionRequest, _context: AIVariableContext): MaybePromise { + return (request.variable.name === OPEN_EDITORS_VARIABLE.name || request.variable.name === OPEN_EDITORS_SHORT_VARIABLE.name) ? 50 : 0; + } + + async resolve(request: AIVariableResolutionRequest, _context: AIVariableContext): Promise { + if (request.variable.name !== OPEN_EDITORS_VARIABLE.name && request.variable.name !== OPEN_EDITORS_SHORT_VARIABLE.name) { + return undefined; + } + + const openFiles = this.getAllOpenFilesRelative(); + return { + variable: request.variable, + value: openFiles + }; + } + + protected getAllOpenFilesRelative(): string { + const openFiles: string[] = []; + + // Get all open editors from the editor manager + for (const editor of this.editorManager.all) { + const uri = editor.getResourceUri(); + if (uri) { + const relativePath = this.getWorkspaceRelativePath(uri); + if (relativePath) { + openFiles.push(`'${relativePath}'`); + } + } + } + + return openFiles.join(', '); + } + + protected getWorkspaceRelativePath(uri: URI): string | undefined { + const workspaceRootUri = this.workspaceService.getWorkspaceRootUri(uri); + const path = workspaceRootUri && workspaceRootUri.path.relative(uri.path); + return path && path.toString(); + } +} diff --git a/packages/ai-core/src/browser/os-notification-service.ts b/packages/ai-core/src/browser/os-notification-service.ts new file mode 100644 index 0000000..785ff41 --- /dev/null +++ b/packages/ai-core/src/browser/os-notification-service.ts @@ -0,0 +1,271 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { injectable } from '@theia/core/shared/inversify'; +import { nls } from '@theia/core/lib/common/nls'; +import { environment } from '@theia/core'; + +/** + * Configuration options for OS notifications + */ +export interface OSNotificationOptions { + /** The notification body text */ + body?: string; + /** Icon to display with the notification */ + icon?: string; + /** Whether the notification should be silent */ + silent?: boolean; + /** Tag to group notifications */ + tag?: string; + /** Whether the notification requires user interaction to dismiss */ + requireInteraction?: boolean; + /** Custom data to associate with the notification */ + data?: unknown; +} + +/** + * Result of an OS notification attempt + */ +export interface OSNotificationResult { + /** Whether the notification was successfully shown */ + success: boolean; + /** Error message if the notification failed */ + error?: string; + /** The created notification instance (if successful) */ + notification?: Notification; +} + +/** + * Service to handle OS-level notifications across different platforms + * Provides fallback mechanisms for environments where notifications are unavailable + */ +@injectable() +export class OSNotificationService { + + private isElectron: boolean; + + constructor() { + this.isElectron = environment.electron.is(); + } + + /** + * Show an OS-level notification with the given title and options + * + * @param title The notification title + * @param options Optional notification configuration + * @returns Promise resolving to the notification result + */ + async showNotification(title: string, options: OSNotificationOptions = {}): Promise { + try { + if (!this.isNotificationSupported()) { + return { + success: false, + error: 'Notifications are not supported in this environment' + }; + } + + const permission = await this.ensurePermission(); + if (permission !== 'granted') { + return { + success: false, + error: `Notification permission ${permission}` + }; + } + + const notification = await this.createNotification(title, options); + return { + success: true, + notification + }; + + } catch (error) { + console.error('Failed to show OS notification:', error); + return { + success: false, + error: error instanceof Error ? error.message : 'Unknown error occurred' + }; + } + } + + /** + * Check if notification permission is granted + * + * @returns The current notification permission state + */ + getPermissionStatus(): NotificationPermission { + if (!this.isNotificationSupported()) { + return 'denied'; + } + return Notification.permission; + } + + /** + * Request notification permission from the user + * + * @returns Promise resolving to the permission state + */ + async requestPermission(): Promise { + if (!this.isNotificationSupported()) { + return 'denied'; + } + + if (Notification.permission !== 'default') { + return Notification.permission; + } + + try { + const permission = await Notification.requestPermission(); + return permission; + } catch (error) { + console.error('Failed to request notification permission:', error); + return 'denied'; + } + } + + /** + * Check if OS notifications are supported in the current environment + * + * @returns true if notifications are supported, false otherwise + */ + isNotificationSupported(): boolean { + return typeof window !== 'undefined' && 'Notification' in window; + } + + /** + * Show a notification specifically for agent completion + * This is a convenience method with pre-configured options for agent notifications + * + * @param agentName The name of the agent that completed + * @param taskDescription Optional description of the completed task + * @returns Promise resolving to the notification result + */ + async showAgentCompletionNotification(agentName: string, taskDescription?: string): Promise { + const title = nls.localize('theia/ai-core/agentCompletionTitle', 'Agent "{0}" Task Completed', agentName); + const body = taskDescription + ? nls.localize('theia/ai-core/agentCompletionWithTask', + 'Agent "{0}" has completed the task: {1}', agentName, taskDescription) + : nls.localize('theia/ai-core/agentCompletionMessage', + 'Agent "{0}" has completed its task.', agentName); + + return this.showNotification(title, { + body, + icon: this.getAgentCompletionIcon(), + tag: `agent-completion-${agentName}`, + requireInteraction: false, + data: { + type: 'agent-completion', + agentName, + taskDescription, + timestamp: Date.now() + } + }); + } + + /** + * Ensure notification permission is granted + * + * @returns Promise resolving to the permission state + */ + private async ensurePermission(): Promise { + const currentPermission = this.getPermissionStatus(); + + if (currentPermission === 'granted') { + return currentPermission; + } + + if (currentPermission === 'denied') { + return currentPermission; + } + + return this.requestPermission(); + } + + /** + * Create a native notification with the given title and options + * + * @param title The notification title + * @param options The notification options + * @returns Promise resolving to the created notification + */ + private async createNotification(title: string, options: OSNotificationOptions): Promise { + return new Promise((resolve, reject): void => { + try { + const notificationOptions: NotificationOptions = { + body: options.body, + icon: options.icon, + silent: options.silent, + tag: options.tag, + requireInteraction: options.requireInteraction, + data: options.data + }; + + const notification = new Notification(title, notificationOptions); + + notification.onshow = () => { + console.debug('OS notification shown:', title); + }; + + notification.onerror = error => { + console.error('OS notification error:', error); + reject(new Error('Failed to show notification')); + }; + + notification.onclick = () => { + console.debug('OS notification clicked:', title); + this.focusApplicationWindow(); + notification.close(); + }; + + notification.onclose = () => { + console.debug('OS notification closed:', title); + }; + + resolve(notification); + + } catch (error) { + reject(error); + } + }); + } + + /** + * Attempt to focus the application window when notification is clicked + */ + private focusApplicationWindow(): void { + try { + if (typeof window !== 'undefined') { + window.focus(); + + if (this.isElectron && (window as unknown as { electronTheiaCore?: { focusWindow?: () => void } }).electronTheiaCore?.focusWindow) { + (window as unknown as { electronTheiaCore: { focusWindow: () => void } }).electronTheiaCore.focusWindow(); + } + } + } catch (error) { + console.debug('Could not focus application window:', error); + } + } + + /** + * Get the icon URL for agent completion notifications + * + * @returns The icon URL or undefined if not available + */ + private getAgentCompletionIcon(): string | undefined { + // This could return a path to an icon file + // For now, we'll return undefined to use the default system icon + return undefined; + } +} diff --git a/packages/ai-core/src/browser/prompttemplate-contribution.ts b/packages/ai-core/src/browser/prompttemplate-contribution.ts new file mode 100644 index 0000000..625bb21 --- /dev/null +++ b/packages/ai-core/src/browser/prompttemplate-contribution.ts @@ -0,0 +1,307 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { inject, injectable } from '@theia/core/shared/inversify'; +import { GrammarDefinition, GrammarDefinitionProvider, LanguageGrammarDefinitionContribution, TextmateRegistry } from '@theia/monaco/lib/browser/textmate'; +import * as monaco from '@theia/monaco-editor-core'; +import { Command, CommandContribution, CommandRegistry, nls } from '@theia/core'; +import { TabBarToolbarContribution, TabBarToolbarRegistry } from '@theia/core/lib/browser/shell/tab-bar-toolbar'; + +import { codicon, Widget } from '@theia/core/lib/browser'; +import { EditorWidget, ReplaceOperation } from '@theia/editor/lib/browser'; +import { PromptService, PromptText, ToolInvocationRegistry } from '../common'; +import { ProviderResult } from '@theia/monaco-editor-core/esm/vs/editor/common/languages'; +import { AIVariableService } from '../common/variable-service'; + +const PROMPT_TEMPLATE_LANGUAGE_ID = 'theia-ai-prompt-template'; +const PROMPT_TEMPLATE_TEXTMATE_SCOPE = 'source.prompttemplate'; + +export const PROMPT_TEMPLATE_EXTENSION = '.prompttemplate'; + +export const DISCARD_PROMPT_TEMPLATE_CUSTOMIZATIONS: Command = Command.toLocalizedCommand({ + id: 'theia-ai-prompt-template:discard', + label: 'Discard AI Prompt Template', + iconClass: codicon('discard'), + category: 'AI Prompt Templates' +}, 'theia/ai/core/discard/label', 'theia/ai/core/prompts/category'); + +@injectable() +export class PromptTemplateContribution implements LanguageGrammarDefinitionContribution, CommandContribution, TabBarToolbarContribution { + + @inject(PromptService) + private readonly promptService: PromptService; + + @inject(ToolInvocationRegistry) + protected readonly toolInvocationRegistry: ToolInvocationRegistry; + + @inject(AIVariableService) + protected readonly variableService: AIVariableService; + + readonly config: monaco.languages.LanguageConfiguration = + { + 'brackets': [ + ['${', '}'], + ['~{', '}'], + ['{{', '}}'], + ['{{{', '}}}'] + ], + 'autoClosingPairs': [ + { 'open': '${', 'close': '}' }, + { 'open': '~{', 'close': '}' }, + { 'open': '{{', 'close': '}}' }, + { 'open': '{{{', 'close': '}}}' } + ], + 'surroundingPairs': [ + { 'open': '${', 'close': '}' }, + { 'open': '~{', 'close': '}' }, + { 'open': '{{', 'close': '}}' }, + { 'open': '{{{', 'close': '}}}' } + ] + }; + + registerTextmateLanguage(registry: TextmateRegistry): void { + monaco.languages.register({ + id: PROMPT_TEMPLATE_LANGUAGE_ID, + 'aliases': [ + 'AI Prompt Template' + ], + 'extensions': [ + PROMPT_TEMPLATE_EXTENSION, + ], + 'filenames': [] + }); + + monaco.languages.setLanguageConfiguration(PROMPT_TEMPLATE_LANGUAGE_ID, this.config); + + monaco.languages.registerCompletionItemProvider(PROMPT_TEMPLATE_LANGUAGE_ID, { + // Monaco only supports single character trigger characters + triggerCharacters: ['{'], + provideCompletionItems: (model, position, _context, _token): ProviderResult => this.provideFunctionCompletions(model, position), + }); + + monaco.languages.registerCompletionItemProvider(PROMPT_TEMPLATE_LANGUAGE_ID, { + // Monaco only supports single character trigger characters + triggerCharacters: ['{'], + provideCompletionItems: (model, position, _context, _token): ProviderResult => this.provideVariableCompletions(model, position), + }); + monaco.languages.registerCompletionItemProvider(PROMPT_TEMPLATE_LANGUAGE_ID, { + // Monaco only supports single character trigger characters + triggerCharacters: ['{', ':'], + provideCompletionItems: (model, position, _context, _token): ProviderResult => this.provideVariableWithArgCompletions(model, position), + }); + + const textmateGrammar = require('../../data/prompttemplate.tmLanguage.json'); + const grammarDefinitionProvider: GrammarDefinitionProvider = { + getGrammarDefinition: function (): Promise { + return Promise.resolve({ + format: 'json', + content: textmateGrammar + }); + } + }; + registry.registerTextmateGrammarScope(PROMPT_TEMPLATE_TEXTMATE_SCOPE, grammarDefinitionProvider); + + registry.mapLanguageIdToTextmateGrammar(PROMPT_TEMPLATE_LANGUAGE_ID, PROMPT_TEMPLATE_TEXTMATE_SCOPE); + } + + provideFunctionCompletions(model: monaco.editor.ITextModel, position: monaco.Position): ProviderResult { + return this.getSuggestions( + model, + position, + '~{', + this.toolInvocationRegistry.getAllFunctions(), + monaco.languages.CompletionItemKind.Function, + tool => tool.id, + tool => tool.name, + tool => tool.description ?? '' + ); + } + + provideVariableCompletions(model: monaco.editor.ITextModel, position: monaco.Position): ProviderResult { + return this.getSuggestions( + model, + position, + '{{', + this.variableService.getVariables(), + monaco.languages.CompletionItemKind.Variable, + variable => variable.args?.some(arg => !arg.isOptional) ? variable.name + PromptText.VARIABLE_SEPARATOR_CHAR : variable.name, + variable => variable.name, + variable => variable.description ?? '' + ); + } + + async provideVariableWithArgCompletions(model: monaco.editor.ITextModel, position: monaco.Position): Promise { + // Get the text of the current line up to the cursor position + const textUntilPosition = model.getValueInRange({ + startLineNumber: position.lineNumber, + startColumn: 1, + endLineNumber: position.lineNumber, + endColumn: position.column, + }); + + // Regex that captures the variable name in contexts like {{, {{{, {{varname, {{{varname, {{varname:, or {{{varname: + const variableRegex = /(?:\{\{\{|\{\{)([\w-]+)?(?::)?/; + const match = textUntilPosition.match(variableRegex); + + if (!match) { + return { suggestions: [] }; + } + + const currentVariableName = match[1]; + const hasColonSeparator = textUntilPosition.includes(`${currentVariableName}:`); + + const variables = this.variableService.getVariables(); + const suggestions: monaco.languages.CompletionItem[] = []; + + for (const variable of variables) { + // If we have a variable:arg pattern, only process the matching variable + if (hasColonSeparator && variable.name !== currentVariableName) { + continue; + } + + const provider = await this.variableService.getArgumentCompletionProvider(variable.name); + if (provider) { + const items = await provider(model, position, '{'); + if (items) { + suggestions.push(...items.map(item => ({ + ...item + }))); + } + } + } + + return { suggestions }; + } + + getCompletionRange(model: monaco.editor.ITextModel, position: monaco.Position, triggerCharacters: string): monaco.Range | undefined { + // Check if the characters before the current position are the trigger characters + const lineContent = model.getLineContent(position.lineNumber); + const triggerLength = triggerCharacters.length; + const charactersBefore = lineContent.substring( + position.column - triggerLength - 1, + position.column - 1 + ); + + if (charactersBefore !== triggerCharacters) { + // Do not return agent suggestions if the user didn't just type the trigger characters + return undefined; + } + + // Calculate the range from the position of the trigger characters + const wordInfo = model.getWordUntilPosition(position); + return new monaco.Range( + position.lineNumber, + wordInfo.startColumn, + position.lineNumber, + position.column + ); + } + + private getSuggestions( + model: monaco.editor.ITextModel, + position: monaco.Position, + triggerChars: string, + items: T[], + kind: monaco.languages.CompletionItemKind, + getId: (item: T) => string, + getName: (item: T) => string, + getDescription: (item: T) => string + ): ProviderResult { + const completionRange = this.getCompletionRange(model, position, triggerChars); + if (completionRange === undefined) { + return { suggestions: [] }; + } + const suggestions = items.map(item => ({ + insertText: getId(item), + kind: kind, + label: getName(item), + range: completionRange, + detail: getDescription(item), + })); + return { suggestions }; + } + + registerCommands(commands: CommandRegistry): void { + commands.registerCommand(DISCARD_PROMPT_TEMPLATE_CUSTOMIZATIONS, { + isVisible: (widget: Widget | undefined) => this.isPromptTemplateWidget(widget), + isEnabled: (widget: Widget | undefined) => this.canDiscard(widget), + execute: (widget: EditorWidget) => this.discard(widget) + }); + } + + protected isPromptTemplateWidget(widget: Widget | undefined): boolean { + if (widget instanceof EditorWidget) { + return PROMPT_TEMPLATE_LANGUAGE_ID === widget.editor.document.languageId; + } + return false; + } + + protected canDiscard(widget: Widget | undefined): boolean { + if (!(widget instanceof EditorWidget)) { + return false; + } + const resourceUri = widget.editor.uri; + const id = this.promptService.getTemplateIDFromResource(resourceUri); + if (id === undefined) { + return false; + } + const rawPrompt = this.promptService.getRawPromptFragment(id); + const defaultPrompt = this.promptService.getBuiltInRawPrompt(id); + return rawPrompt?.template !== defaultPrompt?.template; + } + + protected async discard(widget: EditorWidget): Promise { + const resourceUri = widget.editor.uri; + const id = this.promptService.getTemplateIDFromResource(resourceUri); + if (id === undefined) { + return; + } + const defaultPrompt = this.promptService.getBuiltInRawPrompt(id); + if (defaultPrompt === undefined) { + return; + } + + const source: string = widget.editor.document.getText(); + const lastLine = widget.editor.document.getLineContent(widget.editor.document.lineCount); + + const replaceOperation: ReplaceOperation = { + range: { + start: { + line: 0, + character: 0 + }, + end: { + line: widget.editor.document.lineCount, + character: lastLine.length + } + }, + text: defaultPrompt.template + }; + + await widget.editor.replaceText({ + source, + replaceOperations: [replaceOperation] + }); + } + + registerToolbarItems(registry: TabBarToolbarRegistry): void { + registry.registerItem({ + id: DISCARD_PROMPT_TEMPLATE_CUSTOMIZATIONS.id, + command: DISCARD_PROMPT_TEMPLATE_CUSTOMIZATIONS.id, + tooltip: nls.localize('theia/ai/core/discardCustomPrompt/tooltip', 'Discard Customizations') + }); + } +} diff --git a/packages/ai-core/src/browser/prompttemplate-parser.ts b/packages/ai-core/src/browser/prompttemplate-parser.ts new file mode 100644 index 0000000..d7b5017 --- /dev/null +++ b/packages/ai-core/src/browser/prompttemplate-parser.ts @@ -0,0 +1,111 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { load } from 'js-yaml'; +import { CommandPromptFragmentMetadata } from '../common'; + +/** + * Result of parsing a template file that may contain YAML front matter + */ +export interface ParsedTemplate { + /** The template content (without front matter) */ + template: string; + + /** Parsed metadata from YAML front matter, if present */ + metadata?: CommandPromptFragmentMetadata; +} + +/** + * Type guard to check if an object is valid TemplateMetadata + */ +export function isTemplateMetadata(obj: unknown): obj is CommandPromptFragmentMetadata { + if (!obj || typeof obj !== 'object') { + return false; + } + const metadata = obj as Record; + return ( + (metadata.isCommand === undefined || typeof metadata.isCommand === 'boolean') && + (metadata.commandName === undefined || typeof metadata.commandName === 'string') && + (metadata.commandDescription === undefined || typeof metadata.commandDescription === 'string') && + (metadata.commandArgumentHint === undefined || typeof metadata.commandArgumentHint === 'string') && + (metadata.commandAgents === undefined || (Array.isArray(metadata.commandAgents) && + metadata.commandAgents.every(agent => typeof agent === 'string'))) + ); +} + +/** + * Parses a template file that may contain YAML front matter. + * + * Front matter format: + * ``` + * --- + * isCommand: true + * commandName: mycommand + * commandDescription: My command description + * commandArgumentHint: + * commandAgents: + * - Agent1 + * - Agent2 + * --- + * Template content here + * ``` + * + * @param fileContent The raw file content to parse + * @returns ParsedTemplate containing the template content and optional metadata + */ +export function parseTemplateWithMetadata(fileContent: string): ParsedTemplate { + const frontMatterRegex = /^---\s*\n([\s\S]*?)\n---\s*\n([\s\S]*)$/; + const match = fileContent.match(frontMatterRegex); + + if (!match) { + // No front matter, return content as-is + return { template: fileContent }; + } + + try { + const yamlContent = match[1]; + const template = match[2]; + const parsedYaml = load(yamlContent); + + // Validate the parsed YAML is an object + if (!parsedYaml || typeof parsedYaml !== 'object') { + return { template: fileContent }; + } + + const metadata = parsedYaml as Record; + + // Extract and validate command metadata + const templateMetadata: CommandPromptFragmentMetadata = { + isCommand: typeof metadata.isCommand === 'boolean' ? metadata.isCommand : undefined, + commandName: typeof metadata.commandName === 'string' ? metadata.commandName : undefined, + commandDescription: typeof metadata.commandDescription === 'string' ? metadata.commandDescription : undefined, + commandArgumentHint: typeof metadata.commandArgumentHint === 'string' ? metadata.commandArgumentHint : undefined, + commandAgents: Array.isArray(metadata.commandAgents) ? metadata.commandAgents.filter(a => typeof a === 'string') : undefined, + }; + + // Only include metadata if it's valid + if (isTemplateMetadata(templateMetadata)) { + return { template, metadata: templateMetadata }; + } + + // Metadata validation failed, return just the template + return { template }; + } catch (error) { + console.error('Failed to parse front matter:', error); + // Return entire content if YAML parsing fails + return { template: fileContent }; + } +} diff --git a/packages/ai-core/src/browser/skill-prompt-coordinator.ts b/packages/ai-core/src/browser/skill-prompt-coordinator.ts new file mode 100644 index 0000000..eb43cd2 --- /dev/null +++ b/packages/ai-core/src/browser/skill-prompt-coordinator.ts @@ -0,0 +1,69 @@ +// ***************************************************************************** +// Copyright (C) 2026 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { inject, injectable } from '@theia/core/shared/inversify'; +import { FrontendApplicationContribution } from '@theia/core/lib/browser'; +import { SkillService } from './skill-service'; +import { PromptService } from '../common/prompt-service'; + +@injectable() +export class SkillPromptCoordinator implements FrontendApplicationContribution { + + @inject(SkillService) + protected readonly skillService: SkillService; + + @inject(PromptService) + protected readonly promptService: PromptService; + + protected registeredSkillCommands = new Set(); + + onStart(): void { + // Register initial skills + this.updateSkillCommands(); + + // Listen for skill changes + this.skillService.onSkillsChanged(() => { + this.updateSkillCommands(); + }); + } + + protected updateSkillCommands(): void { + const currentSkills = this.skillService.getSkills(); + const currentSkillNames = new Set(currentSkills.map(s => s.name)); + + // Unregister removed skills + for (const name of this.registeredSkillCommands) { + if (!currentSkillNames.has(name)) { + this.promptService.removePromptFragment(`skill-command-${name}`); + this.registeredSkillCommands.delete(name); + } + } + + // Register new skills + for (const skill of currentSkills) { + if (!this.registeredSkillCommands.has(skill.name)) { + this.promptService.addBuiltInPromptFragment({ + id: `skill-command-${skill.name}`, + template: `{{skill:${skill.name}}}`, + isCommand: true, + commandName: skill.name, + commandDescription: skill.description + }); + this.registeredSkillCommands.add(skill.name); + } + } + } +} diff --git a/packages/ai-core/src/browser/skill-service.spec.ts b/packages/ai-core/src/browser/skill-service.spec.ts new file mode 100644 index 0000000..bedd2cb --- /dev/null +++ b/packages/ai-core/src/browser/skill-service.spec.ts @@ -0,0 +1,481 @@ +// ***************************************************************************** +// Copyright (C) 2026 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { enableJSDOM } from '@theia/core/lib/browser/test/jsdom'; +const disableJSDOM = enableJSDOM(); + +import { FrontendApplicationConfigProvider } from '@theia/core/lib/browser/frontend-application-config-provider'; +FrontendApplicationConfigProvider.set({}); + +import { expect } from 'chai'; +import * as sinon from 'sinon'; +import { parseSkillFile, combineSkillDirectories } from '../common/skill'; +import { Path } from '@theia/core/lib/common/path'; +import { Disposable, Emitter, ILogger, Logger, URI } from '@theia/core'; +import { FileChangesEvent } from '@theia/filesystem/lib/common/files'; +import { DefaultSkillService } from './skill-service'; + +disableJSDOM(); + +describe('SkillService', () => { + describe('tilde expansion', () => { + it('should expand ~ to home directory in configured paths', () => { + const homePath = '/home/testuser'; + const configuredDirectories = ['~/skills', '~/.theia/skills', '/absolute/path']; + + const expanded = configuredDirectories.map(dir => Path.untildify(dir, homePath)); + + expect(expanded).to.deep.equal([ + '/home/testuser/skills', + '/home/testuser/.theia/skills', + '/absolute/path' + ]); + }); + + it('should handle empty home path gracefully', () => { + const configuredDirectories = ['~/skills']; + const expanded = configuredDirectories.map(dir => Path.untildify(dir, '')); + + // With empty home, tilde is not expanded + expect(expanded).to.deep.equal(['~/skills']); + }); + }); + + describe('directory prioritization', () => { + it('workspace directory comes first when all directories provided', () => { + const result = combineSkillDirectories( + '/workspace/.prompts/skills', + ['/custom/skills1', '/custom/skills2'], + '/home/user/.theia/skills' + ); + + expect(result).to.deep.equal([ + '/workspace/.prompts/skills', + '/custom/skills1', + '/custom/skills2', + '/home/user/.theia/skills' + ]); + }); + + it('works without workspace directory', () => { + const result = combineSkillDirectories( + undefined, + ['/custom/skills'], + '/home/user/.theia/skills' + ); + + expect(result).to.deep.equal([ + '/custom/skills', + '/home/user/.theia/skills' + ]); + }); + + it('works with only default directory', () => { + const result = combineSkillDirectories( + undefined, + [], + '/home/user/.theia/skills' + ); + + expect(result).to.deep.equal(['/home/user/.theia/skills']); + }); + + it('deduplicates workspace directory if also in configured', () => { + const result = combineSkillDirectories( + '/workspace/.prompts/skills', + ['/workspace/.prompts/skills', '/custom/skills'], + '/home/user/.theia/skills' + ); + + expect(result).to.deep.equal([ + '/workspace/.prompts/skills', + '/custom/skills', + '/home/user/.theia/skills' + ]); + }); + + it('deduplicates default directory if also in configured', () => { + const result = combineSkillDirectories( + '/workspace/.prompts/skills', + ['/home/user/.theia/skills'], + '/home/user/.theia/skills' + ); + + expect(result).to.deep.equal([ + '/workspace/.prompts/skills', + '/home/user/.theia/skills' + ]); + }); + + it('handles empty configured directories', () => { + const result = combineSkillDirectories( + '/workspace/.prompts/skills', + [], + '/home/user/.theia/skills' + ); + + expect(result).to.deep.equal([ + '/workspace/.prompts/skills', + '/home/user/.theia/skills' + ]); + }); + + it('handles undefined default directory', () => { + const result = combineSkillDirectories( + '/workspace/.prompts/skills', + ['/custom/skills'], + undefined + ); + + expect(result).to.deep.equal([ + '/workspace/.prompts/skills', + '/custom/skills' + ]); + }); + }); + + describe('parseSkillFile', () => { + it('extracts YAML front matter correctly', () => { + const fileContent = `--- +name: my-skill +description: A test skill for testing purposes +license: MIT +compatibility: ">=1.0.0" +metadata: + author: test + version: "1.0.0" +--- +# My Skill + +This is the skill content.`; + + const result = parseSkillFile(fileContent); + + expect(result.content).to.equal(`# My Skill + +This is the skill content.`); + expect(result.metadata).to.not.be.undefined; + expect(result.metadata?.name).to.equal('my-skill'); + expect(result.metadata?.description).to.equal('A test skill for testing purposes'); + expect(result.metadata?.license).to.equal('MIT'); + expect(result.metadata?.compatibility).to.equal('>=1.0.0'); + expect(result.metadata?.metadata).to.deep.equal({ author: 'test', version: '1.0.0' }); + }); + + it('returns content without metadata when no front matter exists', () => { + const fileContent = '# Just a regular markdown file'; + + const result = parseSkillFile(fileContent); + + expect(result.content).to.equal('# Just a regular markdown file'); + expect(result.metadata).to.be.undefined; + }); + + it('handles missing front matter gracefully', () => { + const fileContent = `--- +This is not valid YAML front matter +Skill content`; + + const result = parseSkillFile(fileContent); + + expect(result.content).to.equal(fileContent); + expect(result.metadata).to.be.undefined; + }); + + it('handles invalid YAML gracefully', () => { + const fileContent = `--- +name: my-skill +description: [unclosed array +--- +Skill content`; + + const result = parseSkillFile(fileContent); + + expect(result.content).to.equal(fileContent); + expect(result.metadata).to.be.undefined; + }); + + it('handles minimal required fields', () => { + const fileContent = `--- +name: minimal-skill +description: A minimal skill +--- +Content`; + + const result = parseSkillFile(fileContent); + + expect(result.content).to.equal('Content'); + expect(result.metadata?.name).to.equal('minimal-skill'); + expect(result.metadata?.description).to.equal('A minimal skill'); + expect(result.metadata?.license).to.be.undefined; + expect(result.metadata?.compatibility).to.be.undefined; + expect(result.metadata?.metadata).to.be.undefined; + }); + + it('handles allowedTools field', () => { + const fileContent = `--- +name: tool-skill +description: A skill with allowed tools +allowedTools: + - tool1 + - tool2 +--- +Content`; + + const result = parseSkillFile(fileContent); + + expect(result.metadata?.allowedTools).to.deep.equal(['tool1', 'tool2']); + }); + + it('preserves markdown content with special characters', () => { + const fileContent = `--- +name: special-skill +description: Test +--- +# Skill with {{variable}} and \`code\` and **bold** + +\`\`\`javascript +const x = 1; +\`\`\``; + + const result = parseSkillFile(fileContent); + + expect(result.content).to.contain('{{variable}}'); + expect(result.content).to.contain('`code`'); + expect(result.content).to.contain('**bold**'); + expect(result.content).to.contain('const x = 1;'); + }); + + it('handles empty content after front matter', () => { + const fileContent = `--- +name: empty-content +description: Skill with no content +--- +`; + + const result = parseSkillFile(fileContent); + + expect(result.metadata?.name).to.equal('empty-content'); + expect(result.content).to.equal(''); + }); + }); + + describe('parent directory watching', () => { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + let fileServiceMock: any; + let loggerWarnSpy: sinon.SinonStub; + let loggerInfoSpy: sinon.SinonStub; + // eslint-disable-next-line @typescript-eslint/no-explicit-any + let envVariablesServerMock: any; + // eslint-disable-next-line @typescript-eslint/no-explicit-any + let workspaceServiceMock: any; + // eslint-disable-next-line @typescript-eslint/no-explicit-any + let preferencesMock: any; + let fileChangesEmitter: Emitter; + // eslint-disable-next-line @typescript-eslint/no-explicit-any + let preferenceChangedEmitter: Emitter; + + function createService(): DefaultSkillService { + const service = new DefaultSkillService(); + (service as unknown as { preferences: unknown }).preferences = preferencesMock; + (service as unknown as { fileService: unknown }).fileService = fileServiceMock; + const loggerMock: ILogger = sinon.createStubInstance(Logger); + loggerMock.warn = loggerWarnSpy; + loggerMock.info = loggerInfoSpy; + (service as unknown as { logger: unknown }).logger = loggerMock; + (service as unknown as { envVariablesServer: unknown }).envVariablesServer = envVariablesServerMock; + (service as unknown as { workspaceService: unknown }).workspaceService = workspaceServiceMock; + return service; + } + + beforeEach(() => { + fileChangesEmitter = new Emitter(); + preferenceChangedEmitter = new Emitter(); + + fileServiceMock = { + exists: sinon.stub(), + watch: sinon.stub().returns(Disposable.NULL), + resolve: sinon.stub(), + read: sinon.stub(), + onDidFilesChange: (listener: (e: FileChangesEvent) => void) => fileChangesEmitter.event(listener) + }; + + loggerWarnSpy = sinon.stub(); + loggerInfoSpy = sinon.stub(); + + envVariablesServerMock = { + getHomeDirUri: sinon.stub().resolves('file:///home/testuser'), + getConfigDirUri: sinon.stub().resolves('file:///home/testuser/.theia-ide') + }; + + workspaceServiceMock = { + ready: Promise.resolve(), + tryGetRoots: sinon.stub().returns([]), + onWorkspaceChanged: sinon.stub().returns(Disposable.NULL) + }; + + preferencesMock = { + 'ai-features.skills.skillDirectories': [], + onPreferenceChanged: preferenceChangedEmitter.event + }; + }); + + afterEach(() => { + sinon.restore(); + fileChangesEmitter.dispose(); + preferenceChangedEmitter.dispose(); + }); + + it('should watch parent directory when skills directory does not exist', async () => { + const service = createService(); + + // Default skills directory does not exist, but parent does + fileServiceMock.exists + .withArgs(sinon.match((uri: URI) => uri.path.toString() === '/home/testuser/.theia-ide/skills')) + .resolves(false); + fileServiceMock.exists + .withArgs(sinon.match((uri: URI) => uri.path.toString() === '/home/testuser/.theia-ide')) + .resolves(true); + + // Call init to trigger update + (service as unknown as { init: () => void }).init(); + await workspaceServiceMock.ready; + // Allow async operations to complete + await new Promise(resolve => setTimeout(resolve, 10)); + + // Verify parent directory is watched + expect(fileServiceMock.watch.calledWith( + sinon.match((uri: URI) => uri.path.toString() === '/home/testuser/.theia-ide'), + sinon.match({ recursive: false, excludes: [] }) + )).to.be.true; + + // Verify info log about watching parent + expect(loggerInfoSpy.calledWith( + sinon.match(/Watching parent directory.*for skills folder creation/) + )).to.be.true; + }); + + it('should log warning when parent directory does not exist', async () => { + const service = createService(); + + // Neither skills directory nor parent exists + fileServiceMock.exists.resolves(false); + + // Call init to trigger update + (service as unknown as { init: () => void }).init(); + await workspaceServiceMock.ready; + await new Promise(resolve => setTimeout(resolve, 10)); + + // Verify warning is logged about parent not existing + expect(loggerWarnSpy.calledWith( + sinon.match(/Cannot watch skills directory.*parent directory does not exist/) + )).to.be.true; + }); + + it('should log warning for non-existent configured directories', async () => { + const service = createService(); + + // Set up configured directory that doesn't exist + (preferencesMock as Record)['ai-features.skills.skillDirectories'] = ['/custom/nonexistent/skills']; + + // Default skills directory exists (to avoid additional warnings) + fileServiceMock.exists + .withArgs(sinon.match((uri: URI) => uri.path.toString() === '/home/testuser/.theia-ide/skills')) + .resolves(true); + fileServiceMock.resolve + .withArgs(sinon.match((uri: URI) => uri.path.toString() === '/home/testuser/.theia-ide/skills')) + .resolves({ children: [] }); + + // Configured directory does not exist + fileServiceMock.exists + .withArgs(sinon.match((uri: URI) => uri.path.toString() === '/custom/nonexistent/skills')) + .resolves(false); + + // Call init to trigger update + (service as unknown as { init: () => void }).init(); + await workspaceServiceMock.ready; + await new Promise(resolve => setTimeout(resolve, 10)); + + // Verify warning is logged for non-existent configured directory + expect(loggerWarnSpy.calledWith( + sinon.match(/Configured skill directory.*does not exist/) + )).to.be.true; + }); + + it('should load skills when directory is created after initialization', async () => { + const service = createService(); + + // Initially, skills directory does not exist but parent does + fileServiceMock.exists + .withArgs(sinon.match((uri: URI) => uri.path.toString() === '/home/testuser/.theia-ide/skills')) + .resolves(false); + fileServiceMock.exists + .withArgs(sinon.match((uri: URI) => uri.path.toString() === '/home/testuser/.theia-ide')) + .resolves(true); + + // Call init to trigger initial update + (service as unknown as { init: () => void }).init(); + await workspaceServiceMock.ready; + await new Promise(resolve => setTimeout(resolve, 10)); + + // Verify no skills initially + expect(service.getSkills()).to.have.length(0); + + // Now simulate skills directory being created with a skill + fileServiceMock.exists + .withArgs(sinon.match((uri: URI) => uri.path.toString() === '/home/testuser/.theia-ide/skills')) + .resolves(true); + fileServiceMock.resolve + .withArgs(sinon.match((uri: URI) => uri.path.toString() === '/home/testuser/.theia-ide/skills')) + .resolves({ + children: [{ + isDirectory: true, + name: 'test-skill', + resource: URI.fromFilePath('/home/testuser/.theia-ide/skills/test-skill') + }] + }); + fileServiceMock.exists + .withArgs(sinon.match((uri: URI) => uri.path.toString() === '/home/testuser/.theia-ide/skills/test-skill/SKILL.md')) + .resolves(true); + fileServiceMock.read + .withArgs(sinon.match((uri: URI) => uri.path.toString() === '/home/testuser/.theia-ide/skills/test-skill/SKILL.md')) + .resolves({ + value: `--- +name: test-skill +description: A test skill +--- +Test skill content` + }); + + // Simulate file change event for skills directory creation + fileChangesEmitter.fire({ + changes: [{ + type: 1, // FileChangeType.ADDED + resource: URI.fromFilePath('/home/testuser/.theia-ide/skills') + }], + rawChanges: [] + } as unknown as FileChangesEvent); + + // Wait for async operations to complete + await new Promise(resolve => setTimeout(resolve, 100)); + + // Verify skill was loaded + const skills = service.getSkills(); + expect(skills).to.have.length(1); + expect(skills[0].name).to.equal('test-skill'); + }); + }); +}); diff --git a/packages/ai-core/src/browser/skill-service.ts b/packages/ai-core/src/browser/skill-service.ts new file mode 100644 index 0000000..0e24dd2 --- /dev/null +++ b/packages/ai-core/src/browser/skill-service.ts @@ -0,0 +1,357 @@ +// ***************************************************************************** +// Copyright (C) 2026 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { inject, injectable, named, postConstruct } from '@theia/core/shared/inversify'; +import { DisposableCollection, Emitter, Event, ILogger, URI } from '@theia/core'; +import { Path } from '@theia/core/lib/common/path'; +import { EnvVariablesServer } from '@theia/core/lib/common/env-variables'; +import { FileService } from '@theia/filesystem/lib/browser/file-service'; +import { FileChangesEvent, FileChangeType } from '@theia/filesystem/lib/common/files'; +import { WorkspaceService } from '@theia/workspace/lib/browser'; +import { AICorePreferences, PREFERENCE_NAME_SKILL_DIRECTORIES } from '../common/ai-core-preferences'; +import { Skill, SkillDescription, SKILL_FILE_NAME, validateSkillDescription, parseSkillFile } from '../common/skill'; + +/** Debounce delay for coalescing rapid file system events */ +const UPDATE_DEBOUNCE_MS = 50; + +export const SkillService = Symbol('SkillService'); +export interface SkillService { + /** Get all discovered skills */ + getSkills(): Skill[]; + + /** Get a skill by name */ + getSkill(name: string): Skill | undefined; + + /** Event fired when skills change */ + readonly onSkillsChanged: Event; +} + +@injectable() +export class DefaultSkillService implements SkillService { + @inject(AICorePreferences) + protected readonly preferences: AICorePreferences; + + @inject(FileService) + protected readonly fileService: FileService; + + @inject(ILogger) + @named('SkillService') + protected readonly logger: ILogger; + + @inject(EnvVariablesServer) + protected readonly envVariablesServer: EnvVariablesServer; + + @inject(WorkspaceService) + protected readonly workspaceService: WorkspaceService; + + protected skills = new Map(); + protected toDispose = new DisposableCollection(); + protected watchedDirectories = new Set(); + protected parentWatchers = new Map(); + + protected readonly onSkillsChangedEmitter = new Emitter(); + readonly onSkillsChanged: Event = this.onSkillsChangedEmitter.event; + protected lastSkillDirectoriesValue: string | undefined; + + protected updateDebounceTimeout: ReturnType | undefined; + + @postConstruct() + protected init(): void { + this.fileService.onDidFilesChange(async (event: FileChangesEvent) => { + for (const change of event.changes) { + if (change.type === FileChangeType.ADDED) { + const changeUri = change.resource.toString(); + for (const [, skillsPath] of this.parentWatchers) { + const expectedSkillsUri = URI.fromFilePath(skillsPath).toString(); + if (changeUri === expectedSkillsUri) { + this.scheduleUpdate(); + return; + } + } + } + // Check for skills directory deletion - switch back to parent watching + if (change.type === FileChangeType.DELETED) { + const changeUri = change.resource.toString(); + if (this.watchedDirectories.has(changeUri)) { + this.scheduleUpdate(); + return; + } + } + } + + const isRelevantChange = event.changes.some(change => { + const changeUri = change.resource.toString(); + const isInWatchedDir = Array.from(this.watchedDirectories).some(dirUri => + changeUri.startsWith(dirUri) + ); + if (!isInWatchedDir) { + return false; + } + // Trigger on SKILL.md changes or directory additions/deletions + const isSkillFile = change.resource.path.base === SKILL_FILE_NAME; + const isDirectoryChange = change.type === FileChangeType.ADDED || change.type === FileChangeType.DELETED; + return isSkillFile || isDirectoryChange; + }); + if (isRelevantChange) { + this.scheduleUpdate(); + } + }); + + // Wait for workspace to be ready before initial update + this.workspaceService.ready.then(() => { + this.update().then(() => { + // Only after initial update, start listening for changes + this.lastSkillDirectoriesValue = JSON.stringify(this.preferences[PREFERENCE_NAME_SKILL_DIRECTORIES]); + + this.preferences.onPreferenceChanged(event => { + if (event.preferenceName === PREFERENCE_NAME_SKILL_DIRECTORIES) { + const currentValue = JSON.stringify(this.preferences[PREFERENCE_NAME_SKILL_DIRECTORIES]); + if (currentValue === this.lastSkillDirectoriesValue) { + return; + } + this.lastSkillDirectoriesValue = currentValue; + this.scheduleUpdate(); + } + }); + + this.workspaceService.onWorkspaceChanged(() => { + this.scheduleUpdate(); + }); + }); + }); + } + + getSkills(): Skill[] { + return Array.from(this.skills.values()); + } + + getSkill(name: string): Skill | undefined { + return this.skills.get(name); + } + + protected scheduleUpdate(): void { + if (this.updateDebounceTimeout) { + clearTimeout(this.updateDebounceTimeout); + } + this.updateDebounceTimeout = setTimeout(() => { + this.updateDebounceTimeout = undefined; + this.update(); + }, UPDATE_DEBOUNCE_MS); + } + + protected async update(): Promise { + if (this.updateDebounceTimeout) { + clearTimeout(this.updateDebounceTimeout); + this.updateDebounceTimeout = undefined; + } + this.toDispose.dispose(); + const newDisposables = new DisposableCollection(); + const newSkills = new Map(); + + const workspaceSkillsDir = this.getWorkspaceSkillsDirectoryPath(); + + const homeDirUri = await this.envVariablesServer.getHomeDirUri(); + const homePath = new URI(homeDirUri).path.fsPath(); + + const configuredDirectories = (this.preferences[PREFERENCE_NAME_SKILL_DIRECTORIES] ?? []) + .map(dir => Path.untildify(dir, homePath)); + const defaultSkillsDir = await this.getDefaultSkillsDirectoryPath(); + + const newWatchedDirectories = new Set(); + const newParentWatchers = new Map(); + + if (workspaceSkillsDir) { + await this.processSkillDirectoryWithParentWatching( + workspaceSkillsDir, + newSkills, + newDisposables, + newWatchedDirectories, + newParentWatchers + ); + } + + for (const configuredDir of configuredDirectories) { + const configuredDirUri = URI.fromFilePath(configuredDir).toString(); + if (!newWatchedDirectories.has(configuredDirUri)) { + await this.processConfiguredSkillDirectory(configuredDir, newSkills, newDisposables, newWatchedDirectories); + } + } + + const defaultSkillsDirUri = URI.fromFilePath(defaultSkillsDir).toString(); + if (!newWatchedDirectories.has(defaultSkillsDirUri)) { + await this.processSkillDirectoryWithParentWatching( + defaultSkillsDir, + newSkills, + newDisposables, + newWatchedDirectories, + newParentWatchers + ); + } + + if (newSkills.size > 0 && newSkills.size !== this.skills.size) { + this.logger.info(`Loaded ${newSkills.size} skills`); + } + + this.toDispose = newDisposables; + this.skills = newSkills; + this.watchedDirectories = newWatchedDirectories; + this.parentWatchers = newParentWatchers; + + this.onSkillsChangedEmitter.fire(); + } + + protected getWorkspaceSkillsDirectoryPath(): string | undefined { + const roots = this.workspaceService.tryGetRoots(); + if (roots.length === 0) { + return undefined; + } + // Use primary workspace root + return roots[0].resource.resolve('.prompts/skills').path.fsPath(); + } + + protected async getDefaultSkillsDirectoryPath(): Promise { + const configDirUri = await this.envVariablesServer.getConfigDirUri(); + const configDir = new URI(configDirUri); + return configDir.resolve('skills').path.fsPath(); + } + + protected async processSkillDirectoryWithParentWatching( + directoryPath: string, + skills: Map, + disposables: DisposableCollection, + watchedDirectories: Set, + parentWatchers: Map + ): Promise { + const dirURI = URI.fromFilePath(directoryPath); + + try { + const dirExists = await this.fileService.exists(dirURI); + + if (dirExists) { + await this.processExistingSkillDirectory(dirURI, skills, disposables, watchedDirectories); + } else { + const parentPath = dirURI.parent.path.fsPath(); + const parentURI = URI.fromFilePath(parentPath); + const parentExists = await this.fileService.exists(parentURI); + + if (parentExists) { + const parentUriString = parentURI.toString(); + disposables.push(this.fileService.watch(parentURI, { recursive: false, excludes: [] })); + parentWatchers.set(parentUriString, directoryPath); + this.logger.info(`Watching parent directory '${parentPath}' for skills folder creation`); + } else { + this.logger.warn(`Cannot watch skills directory '${directoryPath}': parent directory does not exist`); + } + } + } catch (error) { + this.logger.error(`Error processing directory '${directoryPath}': ${error}`); + } + } + + protected async processConfiguredSkillDirectory( + directoryPath: string, + skills: Map, + disposables: DisposableCollection, + watchedDirectories: Set + ): Promise { + const dirURI = URI.fromFilePath(directoryPath); + + try { + const dirExists = await this.fileService.exists(dirURI); + + if (!dirExists) { + this.logger.warn(`Configured skill directory '${directoryPath}' does not exist`); + return; + } + + await this.processExistingSkillDirectory(dirURI, skills, disposables, watchedDirectories); + } catch (error) { + this.logger.error(`Error processing configured directory '${directoryPath}': ${error}`); + } + } + + protected async processExistingSkillDirectory( + dirURI: URI, + skills: Map, + disposables: DisposableCollection, + watchedDirectories: Set + ): Promise { + const stat = await this.fileService.resolve(dirURI); + if (!stat.children) { + return; + } + + for (const child of stat.children) { + if (child.isDirectory) { + const directoryName = child.name; + await this.loadSkillFromDirectory(child.resource, directoryName, skills); + } + } + + this.setupDirectoryWatcher(dirURI, disposables, watchedDirectories); + } + + protected async loadSkillFromDirectory(directoryUri: URI, directoryName: string, skills: Map): Promise { + const skillFileUri = directoryUri.resolve(SKILL_FILE_NAME); + + const fileExists = await this.fileService.exists(skillFileUri); + if (!fileExists) { + return; + } + + try { + const fileContent = await this.fileService.read(skillFileUri); + const parsed = parseSkillFile(fileContent.value); + + if (!parsed.metadata) { + this.logger.warn(`Skill in '${directoryName}': SKILL.md file has no valid YAML frontmatter`); + return; + } + + if (!SkillDescription.is(parsed.metadata)) { + this.logger.warn(`Skill in '${directoryName}': Invalid skill description - missing required fields (name, description)`); + return; + } + + const validationErrors = validateSkillDescription(parsed.metadata, directoryName); + if (validationErrors.length > 0) { + this.logger.warn(`Skill in '${directoryName}': ${validationErrors.join('; ')}`); + return; + } + + const skillName = parsed.metadata.name; + + if (skills.has(skillName)) { + this.logger.warn(`Skill '${skillName}': Duplicate skill found in '${directoryName}', using first discovered instance`); + return; + } + + const skill: Skill = { + ...parsed.metadata, + location: skillFileUri.path.fsPath() + }; + + skills.set(skillName, skill); + } catch (error) { + this.logger.error(`Failed to load skill from '${directoryName}': ${error}`); + } + } + + protected setupDirectoryWatcher(dirURI: URI, disposables: DisposableCollection, watchedDirectories: Set): void { + disposables.push(this.fileService.watch(dirURI, { recursive: true, excludes: [] })); + watchedDirectories.add(dirURI.toString()); + } +} diff --git a/packages/ai-core/src/browser/skills-variable-contribution.spec.ts b/packages/ai-core/src/browser/skills-variable-contribution.spec.ts new file mode 100644 index 0000000..9bdc4f1 --- /dev/null +++ b/packages/ai-core/src/browser/skills-variable-contribution.spec.ts @@ -0,0 +1,309 @@ +// ***************************************************************************** +// Copyright (C) 2026 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { enableJSDOM } from '@theia/core/lib/browser/test/jsdom'; +import { ILogger } from '@theia/core'; +let disableJSDOM = enableJSDOM(); +import { FrontendApplicationConfigProvider } from '@theia/core/lib/browser/frontend-application-config-provider'; +FrontendApplicationConfigProvider.set({}); + +import 'reflect-metadata'; + +import { expect } from 'chai'; +import * as sinon from 'sinon'; +import { Container } from '@theia/core/shared/inversify'; +import { SkillsVariableContribution, SKILLS_VARIABLE, SKILL_VARIABLE, ResolvedSkillsVariable } from './skills-variable-contribution'; +import { FileService } from '@theia/filesystem/lib/browser/file-service'; +import { SkillService } from './skill-service'; +import { Skill } from '../common/skill'; + +disableJSDOM(); + +describe('SkillsVariableContribution', () => { + let contribution: SkillsVariableContribution; + let skillService: sinon.SinonStubbedInstance; + let mockFileService: { read: sinon.SinonStub, exists: sinon.SinonStub }; + let container: Container; + + before(() => { + disableJSDOM = enableJSDOM(); + }); + + after(() => { + disableJSDOM(); + }); + + beforeEach(() => { + container = new Container(); + + skillService = { + getSkills: sinon.stub(), + getSkill: sinon.stub(), + onSkillsChanged: sinon.stub() as unknown as typeof skillService.onSkillsChanged + }; + + container.bind(SkillService).toConstantValue(skillService as unknown as SkillService); + + mockFileService = { + read: sinon.stub(), + exists: sinon.stub(), + }; + container.bind(FileService).toConstantValue(mockFileService as unknown as FileService); + + const mockLogger = { + info: sinon.stub(), + warn: sinon.stub(), + error: sinon.stub(), + debug: sinon.stub(), + trace: sinon.stub(), + fatal: sinon.stub(), + log: sinon.stub(), + setLogLevel: sinon.stub(), + getLogLevel: sinon.stub(), + isEnabled: sinon.stub().returns(true), + ifEnabled: sinon.stub(), + child: sinon.stub() + }; + container.bind(ILogger).toConstantValue(mockLogger as unknown as ILogger); + + container.bind(SkillsVariableContribution).toSelf().inSingletonScope(); + + contribution = container.get(SkillsVariableContribution); + }); + + describe('SKILLS_VARIABLE', () => { + it('should have correct id and name', () => { + expect(SKILLS_VARIABLE.id).to.equal('skills'); + expect(SKILLS_VARIABLE.name).to.equal('skills'); + }); + + it('should have a description', () => { + expect(SKILLS_VARIABLE.description).to.be.a('string'); + expect(SKILLS_VARIABLE.description.length).to.be.greaterThan(0); + }); + }); + + describe('SKILL_VARIABLE', () => { + it('should have correct id and name', () => { + expect(SKILL_VARIABLE.id).to.equal('skill'); + expect(SKILL_VARIABLE.name).to.equal('skill'); + }); + + it('should have args defined', () => { + expect(SKILL_VARIABLE.args).to.not.be.undefined; + expect(SKILL_VARIABLE.args).to.have.lengthOf(1); + expect(SKILL_VARIABLE.args![0].name).to.equal('skillName'); + }); + }); + + describe('canResolve', () => { + it('should return 1 for skills variable', () => { + const result = contribution.canResolve( + { variable: SKILLS_VARIABLE }, + {} + ); + expect(result).to.equal(1); + }); + + it('should return 1 for skill variable', () => { + const result = contribution.canResolve( + { variable: SKILL_VARIABLE }, + {} + ); + expect(result).to.equal(1); + }); + + it('should return -1 for other variables', () => { + const result = contribution.canResolve( + { variable: { id: 'other', name: 'other', description: 'other' } }, + {} + ); + expect(result).to.equal(-1); + }); + }); + + describe('resolve', () => { + it('should return undefined for non-skills variable', async () => { + const result = await contribution.resolve( + { variable: { id: 'other', name: 'other', description: 'other' } }, + {} + ); + expect(result).to.be.undefined; + }); + + it('should return empty XML when no skills available', async () => { + skillService.getSkills.returns([]); + + const result = await contribution.resolve( + { variable: SKILLS_VARIABLE }, + {} + ) as ResolvedSkillsVariable; + + expect(result).to.not.be.undefined; + expect(result.variable).to.equal(SKILLS_VARIABLE); + expect(result.skills).to.deep.equal([]); + expect(result.value).to.equal('\n'); + }); + + it('should return XML with skills when available', async () => { + const skills: Skill[] = [ + { + name: 'pdf-processing', + description: 'Processes PDF documents and extracts text content', + location: '/path/to/skills/pdf-processing/SKILL.md' + }, + { + name: 'data-analysis', + description: 'Analyzes data sets and generates reports', + location: '/path/to/skills/data-analysis/SKILL.md' + } + ]; + skillService.getSkills.returns(skills); + + const result = await contribution.resolve( + { variable: SKILLS_VARIABLE }, + {} + ) as ResolvedSkillsVariable; + + expect(result).to.not.be.undefined; + expect(result.variable).to.equal(SKILLS_VARIABLE); + expect(result.skills).to.have.lengthOf(2); + expect(result.skills[0].name).to.equal('pdf-processing'); + expect(result.skills[0].location).to.equal('/path/to/skills/pdf-processing/SKILL.md'); + expect(result.skills[1].name).to.equal('data-analysis'); + expect(result.skills[1].location).to.equal('/path/to/skills/data-analysis/SKILL.md'); + + const expectedXml = + '\n' + + '\n' + + 'pdf-processing\n' + + 'Processes PDF documents and extracts text content\n' + + '/path/to/skills/pdf-processing/SKILL.md\n' + + '\n' + + '\n' + + 'data-analysis\n' + + 'Analyzes data sets and generates reports\n' + + '/path/to/skills/data-analysis/SKILL.md\n' + + '\n' + + ''; + expect(result.value).to.equal(expectedXml); + }); + + it('should escape XML special characters in descriptions', async () => { + const skills: Skill[] = [ + { + name: 'test-skill', + description: 'Handles & "quotes" with \'apostrophes\'', + location: '/path/to/skill/SKILL.md' + } + ]; + skillService.getSkills.returns(skills); + + const result = await contribution.resolve( + { variable: SKILLS_VARIABLE }, + {} + ) as ResolvedSkillsVariable; + + expect(result.value).to.include('<tags>'); + expect(result.value).to.include('&'); + expect(result.value).to.include('"quotes"'); + expect(result.value).to.include(''apostrophes''); + }); + + it('should escape XML special characters in name and location', async () => { + const skills: Skill[] = [ + { + name: 'skill', + description: 'Test skill', + location: '/path/with/&special/chars' + } + ]; + skillService.getSkills.returns(skills); + + const result = await contribution.resolve( + { variable: SKILLS_VARIABLE }, + {} + ) as ResolvedSkillsVariable; + + expect(result.value).to.include('skill<test>'); + expect(result.value).to.include('/path/with/&special/chars'); + }); + }); + + describe('resolve single skill', () => { + it('should return undefined when no arg provided', async () => { + const result = await contribution.resolve( + { variable: SKILL_VARIABLE }, + {} + ); + expect(result).to.be.undefined; + }); + + it('should return undefined when skill not found', async () => { + skillService.getSkill.returns(undefined); + + const result = await contribution.resolve( + { variable: SKILL_VARIABLE, arg: 'non-existent' }, + {} + ); + expect(result).to.be.undefined; + }); + + it('should return skill content when skill found', async () => { + const skill: Skill = { + name: 'my-skill', + description: 'A test skill', + location: '/path/to/skills/my-skill/SKILL.md' + }; + skillService.getSkill.withArgs('my-skill').returns(skill); + mockFileService.read.resolves({ + value: `--- +name: my-skill +description: A test skill +--- +# My Skill Content + +This is the skill content.` + }); + + const result = await contribution.resolve( + { variable: SKILL_VARIABLE, arg: 'my-skill' }, + {} + ); + + expect(result).to.not.be.undefined; + expect(result!.variable).to.equal(SKILL_VARIABLE); + expect(result!.value).to.equal('# My Skill Content\n\nThis is the skill content.'); + }); + + it('should return undefined when file read fails', async () => { + const skill: Skill = { + name: 'my-skill', + description: 'A test skill', + location: '/path/to/skills/my-skill/SKILL.md' + }; + skillService.getSkill.withArgs('my-skill').returns(skill); + mockFileService.read.rejects(new Error('File not found')); + + const result = await contribution.resolve( + { variable: SKILL_VARIABLE, arg: 'my-skill' }, + {} + ); + + expect(result).to.be.undefined; + }); + }); +}); diff --git a/packages/ai-core/src/browser/skills-variable-contribution.ts b/packages/ai-core/src/browser/skills-variable-contribution.ts new file mode 100644 index 0000000..f565e2f --- /dev/null +++ b/packages/ai-core/src/browser/skills-variable-contribution.ts @@ -0,0 +1,157 @@ +// ***************************************************************************** +// Copyright (C) 2026 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { inject, injectable } from '@theia/core/shared/inversify'; +import { ILogger, MaybePromise, nls, URI } from '@theia/core'; +import { + AIVariable, AIVariableContext, AIVariableContribution, AIVariableResolutionRequest, + AIVariableResolver, AIVariableService, ResolvedAIVariable +} from '../common/variable-service'; +import { FileService } from '@theia/filesystem/lib/browser/file-service'; +import { SkillService } from './skill-service'; +import { parseSkillFile } from '../common/skill'; + +export const SKILLS_VARIABLE: AIVariable = { + id: 'skills', + name: 'skills', + description: nls.localize('theia/ai/core/skillsVariable/description', + 'Returns the list of available skills that can be used by AI agents') +}; + +export const SKILL_VARIABLE: AIVariable = { + id: 'skill', + name: 'skill', + description: 'Returns the content of a specific skill by name', + args: [{ name: 'skillName', description: 'The name of the skill to load' }] +}; + +export interface SkillSummary { + name: string; + description: string; + location: string; +} + +export interface ResolvedSkillsVariable extends ResolvedAIVariable { + skills: SkillSummary[]; +} + +@injectable() +export class SkillsVariableContribution implements AIVariableContribution, AIVariableResolver { + + @inject(SkillService) + protected readonly skillService: SkillService; + + @inject(ILogger) + protected readonly logger: ILogger; + + @inject(FileService) + protected readonly fileService: FileService; + + registerVariables(service: AIVariableService): void { + service.registerResolver(SKILLS_VARIABLE, this); + service.registerResolver(SKILL_VARIABLE, this); + } + + canResolve(request: AIVariableResolutionRequest, _context: AIVariableContext): MaybePromise { + if (request.variable.name === SKILLS_VARIABLE.name || request.variable.name === SKILL_VARIABLE.name) { + return 1; + } + return -1; + } + + async resolve(request: AIVariableResolutionRequest, _context: AIVariableContext): Promise { + // Handle singular skill variable with argument + if (request.variable.name === SKILL_VARIABLE.name) { + return this.resolveSingleSkill(request); + } + + // Handle plural skills variable + if (request.variable.name === SKILLS_VARIABLE.name) { + const skills = this.skillService.getSkills(); + this.logger.debug(`SkillsVariableContribution: Resolving skills variable, found ${skills.length} skills`); + + const skillSummaries: SkillSummary[] = skills.map(skill => ({ + name: skill.name, + description: skill.description, + location: skill.location + })); + + const xmlValue = this.generateSkillsXML(skillSummaries); + this.logger.debug(`SkillsVariableContribution: Generated XML:\n${xmlValue}`); + + return { variable: SKILLS_VARIABLE, skills: skillSummaries, value: xmlValue }; + } + return undefined; + } + + protected async resolveSingleSkill(request: AIVariableResolutionRequest): Promise { + const skillName = request.arg; + if (!skillName) { + this.logger.warn('skill variable requires a skill name argument'); + return undefined; + } + + const skill = this.skillService.getSkill(skillName); + if (!skill) { + this.logger.warn(`Skill not found: ${skillName}`); + return undefined; + } + + try { + const skillFileUri = URI.fromFilePath(skill.location); + const fileContent = await this.fileService.read(skillFileUri); + const parsed = parseSkillFile(fileContent.value); + return { + variable: request.variable, + value: parsed.content + }; + } catch (error) { + this.logger.error(`Failed to load skill content for '${skillName}': ${error}`); + return undefined; + } + } + + /** + * Generates XML representation of skills. + * XML format follows the Agent Skills spec for structured skill representation. + */ + protected generateSkillsXML(skills: SkillSummary[]): string { + if (skills.length === 0) { + return '\n'; + } + + const skillElements = skills.map(skill => + '\n' + + `${this.escapeXml(skill.name)}\n` + + `${this.escapeXml(skill.description)}\n` + + `${this.escapeXml(skill.location)}\n` + + '' + ).join('\n'); + + return `\n${skillElements}\n`; + } + + protected escapeXml(text: string): string { + const QUOT = '"'; + const APOS = '''; + return text + .replace(/&/g, '&') + .replace(//g, '>') + .replace(/"/g, QUOT) + .replace(/'/g, APOS); + } +} diff --git a/packages/ai-core/src/browser/theia-variable-contribution.ts b/packages/ai-core/src/browser/theia-variable-contribution.ts new file mode 100644 index 0000000..f501650 --- /dev/null +++ b/packages/ai-core/src/browser/theia-variable-contribution.ts @@ -0,0 +1,153 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** +import { FrontendApplicationStateService } from '@theia/core/lib/browser/frontend-application-state'; +import { nls } from '@theia/core/lib/common/nls'; +import { inject, injectable } from '@theia/core/shared/inversify'; +import { VariableRegistry, VariableResolverService } from '@theia/variable-resolver/lib/browser'; +import { AIVariableContribution, AIVariableResolver, AIVariableService, AIVariableResolutionRequest, AIVariableContext, ResolvedAIVariable } from '../common'; + +/** + * Mapping configuration for a Theia variable to one or more AI variables + */ +interface VariableMapping { + name?: string; + description?: string; +} + +/** + * Integrates the Theia VariableRegistry with the Theia AI VariableService + */ +@injectable() +export class TheiaVariableContribution implements AIVariableContribution, AIVariableResolver { + + private static readonly THEIA_PREFIX = 'theia-'; + + @inject(VariableResolverService) + protected readonly variableResolverService: VariableResolverService; + + @inject(VariableRegistry) + protected readonly variableRegistry: VariableRegistry; + + @inject(FrontendApplicationStateService) + protected readonly stateService: FrontendApplicationStateService; + + // Map original variable name to one or more mappings with new name and description. + // Only variables present in this map are registered. + protected variableRenameMap: Map = new Map([ + ['file', [ + { + name: 'currentAbsoluteFilePath', + description: nls.localize('theia/ai/core/variable-contribution/currentAbsoluteFilePath', 'The absolute path of the \ + currently opened file. Please note that most agents will expect a relative file path (relative to the current workspace).') + } + ]], + ['selectedText', [ + { + description: nls.localize('theia/ai/core/variable-contribution/currentSelectedText', 'The plain text that is currently selected in the \ + opened file. This excludes the information where the content is coming from. Please note that most agents will work better with a relative file path \ + (relative to the current workspace).') + } + ]], + ['currentText', [ + { + name: 'currentFileContent', + description: nls.localize('theia/ai/core/variable-contribution/currentFileContent', 'The plain content of the \ + currently opened file. This excludes the information where the content is coming from. Please note that most agents will work better with a relative file path \ + (relative to the current workspace).') + } + ]], + ['relativeFile', [ + { + name: 'currentRelativeFilePath', + description: nls.localize('theia/ai/core/variable-contribution/currentRelativeFilePath', 'The relative path of the \ + currently opened file.') + }, + { + name: '_f', + description: nls.localize('theia/ai/core/variable-contribution/dotRelativePath', 'Short reference to the relative path of the \ + currently opened file (\'currentRelativeFilePath\').') + } + ]], + ['relativeFileDirname', [ + { + name: 'currentRelativeDirPath', + description: nls.localize('theia/ai/core/variable-contribution/currentRelativeDirPath', 'The relative path of the directory \ + containing the currently opened file.') + } + ]], + ['lineNumber', [{}]], + ['workspaceFolder', [{}]] + ]); + + registerVariables(service: AIVariableService): void { + this.stateService.reachedState('initialized_layout').then(() => { + // some variable contributions in Theia are done as part of the onStart, same as our AI variable contributions + // we therefore wait for all of them to be registered before we register we map them to our own + this.variableRegistry.getVariables().forEach(variable => { + if (!this.variableRenameMap.has(variable.name)) { + return; // Do not register variables not part of the map + } + + const mappings = this.variableRenameMap.get(variable.name)!; + + // Register each mapping for this variable + mappings.forEach((mapping, index) => { + const newName = (mapping.name && mapping.name.trim() !== '') ? mapping.name : variable.name; + const newDescription = (mapping.description && mapping.description.trim() !== '') ? mapping.description + : (variable.description && variable.description.trim() !== '' ? variable.description + : nls.localize('theia/ai/core/variable-contribution/builtInVariable', 'Theia Built-in Variable')); + + // For multiple mappings of the same variable, add a suffix to the ID to make it unique + const idSuffix = mappings.length > 1 ? `-${index}` : ''; + const id = `${TheiaVariableContribution.THEIA_PREFIX}${variable.name}${idSuffix}`; + + service.registerResolver({ + id, + name: newName, + description: newDescription + }, this); + }); + }); + }); + } + + protected toTheiaVariable(request: AIVariableResolutionRequest): string { + // Extract the base variable name by removing the THEIA_PREFIX and any potential index suffix + let variableId = request.variable.id; + if (variableId.startsWith(TheiaVariableContribution.THEIA_PREFIX)) { + variableId = variableId.slice(TheiaVariableContribution.THEIA_PREFIX.length); + // Remove any potential index suffix (e.g., -0, -1) + variableId = variableId.replace(/-\d+$/, ''); + } + + return `\${${variableId}${request.arg ? ':' + request.arg : ''}}`; + } + + async canResolve(request: AIVariableResolutionRequest, context: AIVariableContext): Promise { + if (!request.variable.id.startsWith(TheiaVariableContribution.THEIA_PREFIX)) { + return 0; + } + // some variables are not resolvable without providing a specific context + // this may be expensive but was not a problem for Theia's built-in variables + const resolved = await this.variableResolverService.resolve(this.toTheiaVariable(request), context); + return !resolved ? 0 : 1; + } + + async resolve(request: AIVariableResolutionRequest, context: AIVariableContext): Promise { + const resolved = await this.variableResolverService.resolve(this.toTheiaVariable(request), context); + return resolved ? { value: resolved, variable: request.variable } : undefined; + } +} diff --git a/packages/ai-core/src/browser/token-usage-frontend-service-impl.ts b/packages/ai-core/src/browser/token-usage-frontend-service-impl.ts new file mode 100644 index 0000000..bc4e5c1 --- /dev/null +++ b/packages/ai-core/src/browser/token-usage-frontend-service-impl.ts @@ -0,0 +1,142 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { injectable, inject, postConstruct } from '@theia/core/shared/inversify'; +import { Emitter } from '@theia/core'; +import { ModelTokenUsageData, TokenUsageFrontendService } from './token-usage-frontend-service'; +import { TokenUsage, TokenUsageService } from '../common/token-usage-service'; +import { TokenUsageServiceClient } from '../common/protocol'; + +@injectable() +export class TokenUsageServiceClientImpl implements TokenUsageServiceClient { + private readonly _onTokenUsageUpdated = new Emitter(); + readonly onTokenUsageUpdated = this._onTokenUsageUpdated.event; + + notifyTokenUsage(usage: TokenUsage): void { + this._onTokenUsageUpdated.fire(usage); + } + +} + +@injectable() +export class TokenUsageFrontendServiceImpl implements TokenUsageFrontendService { + + @inject(TokenUsageServiceClient) + protected readonly tokenUsageServiceClient: TokenUsageServiceClient; + + @inject(TokenUsageService) + protected readonly tokenUsageService: TokenUsageService; + + private readonly _onTokenUsageUpdated = new Emitter(); + readonly onTokenUsageUpdated = this._onTokenUsageUpdated.event; + + private cachedUsageData: ModelTokenUsageData[] = []; + + @postConstruct() + protected init(): void { + this.tokenUsageServiceClient.onTokenUsageUpdated(() => { + this.getTokenUsageData().then(data => { + this._onTokenUsageUpdated.fire(data); + }); + }); + } + + /** + * Gets the current token usage data for all models + */ + async getTokenUsageData(): Promise { + try { + const usages = await this.tokenUsageService.getTokenUsages(); + this.cachedUsageData = this.aggregateTokenUsages(usages); + return this.cachedUsageData; + } catch (error) { + console.error('Failed to get token usage data:', error); + return []; + } + } + + /** + * Aggregates token usages by model + */ + private aggregateTokenUsages(usages: TokenUsage[]): ModelTokenUsageData[] { + // Group by model + const modelMap = new Map(); + + // Process each usage record + for (const usage of usages) { + const existing = modelMap.get(usage.model); + + if (existing) { + existing.inputTokens += usage.inputTokens; + existing.outputTokens += usage.outputTokens; + + // Add cached tokens if they exist + if (usage.cachedInputTokens !== undefined) { + existing.cachedInputTokens += usage.cachedInputTokens; + } + + // Add read cached tokens if they exist + if (usage.readCachedInputTokens !== undefined) { + existing.readCachedInputTokens += usage.readCachedInputTokens; + } + + // Update last used if this usage is more recent + if (!existing.lastUsed || (usage.timestamp && usage.timestamp > existing.lastUsed)) { + existing.lastUsed = usage.timestamp; + } + } else { + modelMap.set(usage.model, { + inputTokens: usage.inputTokens, + outputTokens: usage.outputTokens, + cachedInputTokens: usage.cachedInputTokens || 0, + readCachedInputTokens: usage.readCachedInputTokens || 0, + lastUsed: usage.timestamp + }); + } + } + + // Convert map to array of model usage data + const result: ModelTokenUsageData[] = []; + + for (const [modelId, data] of modelMap.entries()) { + const modelData: ModelTokenUsageData = { + modelId, + inputTokens: data.inputTokens, + outputTokens: data.outputTokens, + lastUsed: data.lastUsed + }; + + // Only include cache-related fields if they have non-zero values + if (data.cachedInputTokens > 0) { + modelData.cachedInputTokens = data.cachedInputTokens; + } + + if (data.readCachedInputTokens > 0) { + modelData.readCachedInputTokens = data.readCachedInputTokens; + } + + result.push(modelData); + } + + return result; + } +} diff --git a/packages/ai-core/src/browser/token-usage-frontend-service.ts b/packages/ai-core/src/browser/token-usage-frontend-service.ts new file mode 100644 index 0000000..e04a981 --- /dev/null +++ b/packages/ai-core/src/browser/token-usage-frontend-service.ts @@ -0,0 +1,51 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { Event } from '@theia/core'; + +/** + * Data structure for token usage data specific to a model. + */ +export interface ModelTokenUsageData { + /** The model identifier */ + modelId: string; + /** Number of input tokens used */ + inputTokens: number; + /** Number of output tokens used */ + outputTokens: number; + /** Number of input tokens written to cache */ + cachedInputTokens?: number; + /** Number of input tokens read from cache */ + readCachedInputTokens?: number; + /** Date when the model was last used */ + lastUsed?: Date; +} + +/** + * Service for managing token usage data on the frontend. + */ +export const TokenUsageFrontendService = Symbol('TokenUsageFrontendService'); +export interface TokenUsageFrontendService { + /** + * Event emitted when token usage data is updated + */ + readonly onTokenUsageUpdated: Event; + + /** + * Gets the current token usage data for all models + */ + getTokenUsageData(): Promise; +} diff --git a/packages/ai-core/src/browser/window-blink-service.ts b/packages/ai-core/src/browser/window-blink-service.ts new file mode 100644 index 0000000..dff9230 --- /dev/null +++ b/packages/ai-core/src/browser/window-blink-service.ts @@ -0,0 +1,195 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { injectable } from '@theia/core/shared/inversify'; +import { environment, nls } from '@theia/core'; + +/** + * Result of a window blink attempt + */ +export interface WindowBlinkResult { + /** Whether the window blink was successful */ + success: boolean; + /** Error message if the blink failed */ + error?: string; +} + +/** + * Service for blinking/flashing the application window to get user attention. + */ +@injectable() +export class WindowBlinkService { + + private isElectron: boolean; + + constructor() { + this.isElectron = environment.electron.is(); + } + + /** + * Blink/flash the window to get user attention. + * The implementation varies depending on the platform and environment. + * + * @param agentName Optional name of the agent to include in the blink notification + */ + async blinkWindow(agentName?: string): Promise { + try { + if (this.isElectron) { + await this.blinkElectronWindow(agentName); + } else { + await this.blinkBrowserWindow(agentName); + } + return { success: true }; + } catch (error) { + console.warn('Failed to blink window:', error); + try { + if (document.hidden) { + this.focusWindow(); + } + return { success: true }; + } catch (fallbackError) { + return { + success: false, + error: error instanceof Error ? error.message : 'Failed to blink window' + }; + } + } + } + + private async blinkElectronWindow(agentName?: string): Promise { + await this.blinkDocumentTitle(agentName); + + if (document.hidden) { + try { + const theiaCoreAPI = (window as unknown as { electronTheiaCore?: { focusWindow?: () => void } }).electronTheiaCore; + if (theiaCoreAPI?.focusWindow) { + theiaCoreAPI.focusWindow(); + } else { + window.focus(); + } + } catch (error) { + console.debug('Could not focus hidden window:', error); + } + } + } + + private async blinkBrowserWindow(agentName?: string): Promise { + await this.blinkDocumentTitle(agentName); + this.blinkWithVisibilityAPI(); + if (document.hidden) { + this.focusWindow(); + } + } + + private async blinkDocumentTitle(agentName?: string): Promise { + const originalTitle = document.title; + const alertTitle = '🔔 ' + (agentName + ? nls.localize('theia/ai/core/blinkTitle/namedAgentCompleted', 'Theia - Agent "{0}" Completed', agentName) + : nls.localize('theia/ai/core/blinkTitle/agentCompleted', 'Theia - Agent Completed')); + + let blinkCount = 0; + const maxBlinks = 6; + + const blinkInterval = setInterval(() => { + if (blinkCount >= maxBlinks) { + clearInterval(blinkInterval); + document.title = originalTitle; + return; + } + + document.title = blinkCount % 2 === 0 ? alertTitle : originalTitle; + blinkCount++; + }, 500); + } + + private blinkWithVisibilityAPI(): void { + // This method provides visual attention-getting behavior without creating notifications + // as notifications are handled by the OSNotificationService to avoid duplicates + if (!this.isElectron && typeof document.hidden !== 'undefined') { + // Focus the window if it's hidden to get user attention + if (document.hidden) { + this.focusWindow(); + } + } + } + + private focusWindow(): void { + try { + window.focus(); + + // Try to scroll to top to create some visual movement + if (document.body.scrollTop > 0 || document.documentElement.scrollTop > 0) { + const currentScroll = document.documentElement.scrollTop || document.body.scrollTop; + window.scrollTo(0, 0); + setTimeout(() => { + window.scrollTo(0, currentScroll); + }, 100); + } + } catch (error) { + console.debug('Could not focus window:', error); + } + } + + /** + * Check if window blinking is supported in the current environment. + */ + isBlinkSupported(): boolean { + if (this.isElectron) { + const theiaCoreAPI = (window as unknown as { electronTheiaCore?: { focusWindow?: () => void } }).electronTheiaCore; + return !!(theiaCoreAPI?.focusWindow); + } + + // In browser, we can always provide some form of attention-getting behavior + return true; + } + + /** + * Get information about the blinking capabilities. + */ + getBlinkCapabilities(): { + supported: boolean; + method: 'electron' | 'browser' | 'none'; + features: string[]; + } { + const features: string[] = []; + let method: 'electron' | 'browser' | 'none' = 'none'; + + if (this.isElectron) { + method = 'electron'; + const theiaCoreAPI = (window as unknown as { electronTheiaCore?: { focusWindow?: () => void } }).electronTheiaCore; + + if (theiaCoreAPI?.focusWindow) { + features.push('electronTheiaCore.focusWindow'); + features.push('document.title blinking'); + features.push('window.focus'); + } + } else { + method = 'browser'; + features.push('document.title'); + features.push('window.focus'); + + if (typeof document.hidden !== 'undefined') { + features.push('Page Visibility API'); + } + } + + return { + supported: features.length > 0, + method, + features + }; + } +} diff --git a/packages/ai-core/src/common/agent-preferences.ts b/packages/ai-core/src/common/agent-preferences.ts new file mode 100644 index 0000000..e7f1098 --- /dev/null +++ b/packages/ai-core/src/common/agent-preferences.ts @@ -0,0 +1,88 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { nls, PreferenceSchema } from '@theia/core'; +import { + NOTIFICATION_TYPES +} from './notification-types'; + +export const AGENT_SETTINGS_PREF = 'ai-features.agentSettings'; + +export const AgentSettingsPreferenceSchema: PreferenceSchema = { + properties: { + [AGENT_SETTINGS_PREF]: { + type: 'object', + title: nls.localize('theia/ai/agents/title', 'Agent Settings'), + hidden: true, + markdownDescription: nls.localize('theia/ai/agents/mdDescription', 'Configure agent settings such as enabling or disabling specific agents, configuring prompts and \ + selecting LLMs.'), + additionalProperties: { + type: 'object', + properties: { + enable: { + type: 'boolean', + title: nls.localize('theia/ai/agents/enable/title', 'Enable Agent'), + markdownDescription: nls.localize('theia/ai/agents/enable/mdDescription', 'Specifies whether the agent should be enabled (true) or disabled (false).'), + default: true + }, + languageModelRequirements: { + type: 'array', + title: nls.localize('theia/ai/agents/languageModelRequirements/title', 'Language Model Requirements'), + markdownDescription: nls.localize('theia/ai/agents/languageModelRequirements/mdDescription', 'Specifies the used language models for this agent.'), + items: { + type: 'object', + properties: { + purpose: { + type: 'string', + title: nls.localize('theia/ai/agents/languageModelRequirements/purpose/title', 'Purpose'), + markdownDescription: nls.localize('theia/ai/agents/languageModelRequirements/purpose/mdDescription', + 'The purpose for which this language model is used.') + }, + identifier: { + type: 'string', + title: nls.localizeByDefault('Identifier'), + markdownDescription: nls.localize('theia/ai/agents/languageModelRequirements/identifier/mdDescription', + 'The identifier of the language model to be used.') + } + }, + required: ['purpose', 'identifier'] + } + }, + selectedVariants: { + type: 'object', + title: nls.localize('theia/ai/agents/selectedVariants/title', 'Selected Variants'), + markdownDescription: nls.localize('theia/ai/agents/selectedVariants/mdDescription', 'Specifies the currently selected prompt variants for this agent.'), + additionalProperties: { + type: 'string' + } + }, + completionNotification: { + type: 'string', + enum: [...NOTIFICATION_TYPES], + title: nls.localize('theia/ai/agents/completionNotification/title', 'Completion Notification'), + markdownDescription: nls.localize('theia/ai/agents/completionNotification/mdDescription', + 'Notification behavior when this agent completes a task. If not set, the global default notification setting will be used.\n\ + - `os-notification`: Show OS/system notifications\n\ + - `message`: Show notifications in the status bar/message area\n\ + - `blink`: Blink or highlight the UI\n\ + - `off`: Disable notifications for this agent') + } + }, + required: ['languageModelRequirements'] + } + } + } +}; diff --git a/packages/ai-core/src/common/agent-service.ts b/packages/ai-core/src/common/agent-service.ts new file mode 100644 index 0000000..3c2f326 --- /dev/null +++ b/packages/ai-core/src/common/agent-service.ts @@ -0,0 +1,149 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** +import { inject, injectable, optional, postConstruct } from '@theia/core/shared/inversify'; +import { Emitter, Event } from '@theia/core'; +import { Agent } from './agent'; +import { AISettingsService } from './settings-service'; +import { PromptService } from './prompt-service'; + +export const AgentService = Symbol('AgentService'); + +/** + * Service to access the list of known Agents. + */ +export interface AgentService { + /** + * Retrieves a list of all available agents, i.e. agents which are not disabled + */ + getAgents(): Agent[]; + /** + * Retrieves a list of all agents, including disabled ones. + */ + getAllAgents(): Agent[]; + /** + * Enable the agent with the specified id. + * @param agentId the agent id. + */ + enableAgent(agentId: string): Promise; + /** + * disable the agent with the specified id. + * @param agentId the agent id. + */ + disableAgent(agentId: string): Promise; + /** + * query whether this agent is currently enabled or disabled. + * @param agentId the agent id. + * @return true if the agent is enabled, false otherwise. + */ + isEnabled(agentId: string): boolean; + + /** + * Allows to register an agent programmatically. + * @param agent the agent to register + */ + registerAgent(agent: Agent): void; + + /** + * Allows to unregister an agent programmatically. + * @param agentId the agent id to unregister + */ + unregisterAgent(agentId: string): void; + + /** + * Emitted when the list of agents changes. + * This can be used to update the UI when agents are added or removed. + */ + onDidChangeAgents: Event; +} + +@injectable() +export class AgentServiceImpl implements AgentService { + + @inject(AISettingsService) @optional() + protected readonly aiSettingsService: AISettingsService | undefined; + + @inject(PromptService) + protected readonly promptService: PromptService; + + protected disabledAgents = new Set(); + + protected _agents: Agent[] = []; + + private readonly onDidChangeAgentsEmitter = new Emitter(); + readonly onDidChangeAgents = this.onDidChangeAgentsEmitter.event; + + @postConstruct() + protected init(): void { + this.aiSettingsService?.getSettings().then(settings => { + Object.entries(settings).forEach(([agentId, agentSettings]) => { + if (agentSettings.enable === false) { + this.disabledAgents.add(agentId); + } + }); + }); + } + + registerAgent(agent: Agent): void { + this._agents.push(agent); + agent.prompts.forEach( + prompt => { + this.promptService.addBuiltInPromptFragment(prompt.defaultVariant, prompt.id, true); + prompt.variants?.forEach(variant => { + this.promptService.addBuiltInPromptFragment(variant, prompt.id); + }); + } + ); + this.onDidChangeAgentsEmitter.fire(); + } + + unregisterAgent(agentId: string): void { + const agent = this._agents.find(a => a.id === agentId); + this._agents = this._agents.filter(a => a.id !== agentId); + this.onDidChangeAgentsEmitter.fire(); + agent?.prompts.forEach( + prompt => { + this.promptService.removePromptFragment(prompt.defaultVariant.id); + prompt.variants?.forEach(variant => { + this.promptService.removePromptFragment(variant.id); + }); + } + ); + } + + getAgents(): Agent[] { + return this._agents.filter(agent => this.isEnabled(agent.id)); + } + + getAllAgents(): Agent[] { + return this._agents; + } + + async enableAgent(agentId: string): Promise { + this.disabledAgents.delete(agentId); + await this.aiSettingsService?.updateAgentSettings(agentId, { enable: true }); + this.onDidChangeAgentsEmitter.fire(); + } + + async disableAgent(agentId: string): Promise { + this.disabledAgents.add(agentId); + await this.aiSettingsService?.updateAgentSettings(agentId, { enable: false }); + this.onDidChangeAgentsEmitter.fire(); + } + + isEnabled(agentId: string): boolean { + return !this.disabledAgents.has(agentId); + } +} diff --git a/packages/ai-core/src/common/agent.ts b/packages/ai-core/src/common/agent.ts new file mode 100644 index 0000000..0813fe3 --- /dev/null +++ b/packages/ai-core/src/common/agent.ts @@ -0,0 +1,98 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { LanguageModelRequirement } from './language-model'; +import { BasePromptFragment } from './prompt-service'; + +export interface AgentSpecificVariables { + name: string; + description: string; + usedInPrompt: boolean; +} + +export interface PromptVariantSet { + id: string; + defaultVariant: BasePromptFragment; + variants?: BasePromptFragment[]; +} + +export const Agent = Symbol('Agent'); +/** + * Agents represent the main functionality of the AI system. They are responsible for processing user input, collecting information from the environment, + * invoking and processing LLM responses, and providing the final response to the user while recording their actions in the AI history. + * + * Agents are meant to cover all use cases, from specialized scenarios to general purpose chat bots. + * + * Agents are encouraged to provide a detailed description of their functionality and their processed inputs. + * They can also declare their used prompt templates, which makes them configurable for the user. + */ +export interface Agent { + /** + * Used to identify an agent, e.g. when it is requesting language models, etc. + * + * @note This parameter might be removed in favor of `name`. Therefore, it is recommended to set `id` to the same value as `name` for now. + */ + readonly id: string; + + /** + * Human-readable name shown to users to identify the agent. Must be unique. + * Use short names without "Agent" or "Chat" (see `tags` for adding further properties). + */ + readonly name: string; + + /** A markdown description of its functionality and its privacy-relevant requirements, including function call handlers that access some data autonomously. */ + readonly description: string; + + /** + * The list of global variable identifiers that are always available to this agent during execution, + * regardless of whether they are referenced in prompts. + * + * This array is primarily used for documentation purposes in the AI Configuration View + * to show which variables are guaranteed to be available to the agent. Referenced variables are NOT automatically handed over by the framework, + * this must be explicitly done in the agent implementation. + */ + readonly variables: string[]; + + /** The prompts introduced and used by this agent. */ + readonly prompts: PromptVariantSet[]; + + /** Required language models. This includes the purpose and optional language model selector arguments. See #47. */ + readonly languageModelRequirements: LanguageModelRequirement[]; + + /** A list of tags to filter agents and to display capabilities in the UI */ + readonly tags?: string[]; + + /** + * The list of local variable identifiers that can be made available to this agent during execution, + * these variables are context specific and do not exist for other agents. + * + * This array is primarily used for documentation purposes in the AI Configuration View + * to show which variables can be made available to the agent. + * Referenced variables are NOT automatically handed over by the framework, + * this must be explicitly done in the agent implementation or in prompts. + */ + readonly agentSpecificVariables: AgentSpecificVariables[]; + + /** + * The list of global function identifiers that are always available to this agent during execution, + * regardless of whether they are referenced in prompts. + * + * This array is primarily used for documentation purposes in the AI Configuration View + * to show which functions are guaranteed to be available to the agent. Referenced functions are NOT automatically handed over by the framework, + * this must be explicitly done in the agent implementation. + */ + readonly functions: string[]; +} diff --git a/packages/ai-core/src/common/agents-variable-contribution.ts b/packages/ai-core/src/common/agents-variable-contribution.ts new file mode 100644 index 0000000..f8efa37 --- /dev/null +++ b/packages/ai-core/src/common/agents-variable-contribution.ts @@ -0,0 +1,64 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** +import { inject, injectable } from '@theia/core/shared/inversify'; +import { AIVariable, AIVariableContext, AIVariableContribution, AIVariableResolutionRequest, AIVariableResolver, AIVariableService, ResolvedAIVariable } from './variable-service'; +import { MaybePromise, nls } from '@theia/core'; +import { AgentService } from './agent-service'; + +export const AGENTS_VARIABLE: AIVariable = { + id: 'agents', + name: 'agents', + description: nls.localize('theia/ai/core/agentsVariable/description', 'Returns the list of agents available in the system') +}; + +export interface ResolvedAgentsVariable extends ResolvedAIVariable { + agents: AgentDescriptor[]; +} + +export interface AgentDescriptor { + id: string; + name: string; + description: string; +} + +@injectable() +export class AgentsVariableContribution implements AIVariableContribution, AIVariableResolver { + + @inject(AgentService) + protected readonly agentService: AgentService; + + registerVariables(service: AIVariableService): void { + service.registerResolver(AGENTS_VARIABLE, this); + } + + canResolve(request: AIVariableResolutionRequest, _context: AIVariableContext): MaybePromise { + if (request.variable.name === AGENTS_VARIABLE.name) { + return 1; + } + return -1; + } + + async resolve(request: AIVariableResolutionRequest, context: AIVariableContext): Promise { + if (request.variable.name === AGENTS_VARIABLE.name) { + const agents = this.agentService.getAgents().map(agent => ({ + id: agent.id, + name: agent.name, + description: agent.description + })); + return { variable: AGENTS_VARIABLE, agents, value: JSON.stringify(agents) }; + } + } +} diff --git a/packages/ai-core/src/common/ai-core-preferences.ts b/packages/ai-core/src/common/ai-core-preferences.ts new file mode 100644 index 0000000..f7be7f0 --- /dev/null +++ b/packages/ai-core/src/common/ai-core-preferences.ts @@ -0,0 +1,261 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { nls, PreferenceProxyFactory } from '@theia/core'; +import { PreferenceProxy } from '@theia/core/lib/common'; +import { interfaces } from '@theia/core/shared/inversify'; +import { + NOTIFICATION_TYPES, + NOTIFICATION_TYPE_OFF, + NotificationType +} from './notification-types'; +import { PreferenceSchema } from '@theia/core/lib/common/preferences/preference-schema'; + +export const AI_CORE_PREFERENCES_TITLE = '✨ ' + nls.localize('theia/ai/core/prefs/title', 'AI Features [Beta]'); +export const PREFERENCE_NAME_PROMPT_TEMPLATES = 'ai-features.promptTemplates.promptTemplatesFolder'; +export const PREFERENCE_NAME_REQUEST_SETTINGS = 'ai-features.modelSettings.requestSettings'; +export const PREFERENCE_NAME_MAX_RETRIES = 'ai-features.modelSettings.maxRetries'; +export const PREFERENCE_NAME_DEFAULT_NOTIFICATION_TYPE = 'ai-features.notifications.default'; +export const PREFERENCE_NAME_SKILL_DIRECTORIES = 'ai-features.skills.skillDirectories'; + +export const LANGUAGE_MODEL_ALIASES_PREFERENCE = 'ai-features.languageModelAliases'; + +export const aiCorePreferenceSchema: PreferenceSchema = { + properties: { + [PREFERENCE_NAME_PROMPT_TEMPLATES]: { + title: AI_CORE_PREFERENCES_TITLE, + description: nls.localize('theia/ai/core/promptTemplates/description', + 'Folder for storing customized prompt templates. If not customized the user config directory is used. Please consider to use a folder, which is\ + under version control to manage your variants of prompt templates.'), + type: 'string', + default: '', + typeDetails: { + isFilepath: true, + selectionProps: { + openLabel: nls.localize('theia/ai/core/promptTemplates/openLabel', 'Select Folder'), + canSelectFiles: false, + canSelectFolders: true, + canSelectMany: false + } + }, + }, + [PREFERENCE_NAME_REQUEST_SETTINGS]: { + title: nls.localize('theia/ai/core/requestSettings/title', 'Custom Request Settings'), + markdownDescription: nls.localize('theia/ai/core/requestSettings/mdDescription', 'Allows specifying custom request settings for multiple models.\n\ + Each setting consists of:\n\ + - `scope`: Defines when the setting applies:\n\ + - `modelId` (optional): The model ID to match\n\ + - `providerId` (optional): The provider ID to match (e.g., huggingface, openai, ollama, llamafile)\n\ + - `agentId` (optional): The agent ID to match\n\ + - `requestSettings`: Model-specific settings as key-value pairs\n\ + - `clientSettings`: Client-side message handling settings:\n\ + - `keepToolCalls` (boolean): Whether to keep tool calls in the context\n\ + - `keepThinking` (boolean): Whether to keep thinking messages\n\ + Settings are matched based on specificity (agent: 100, model: 10, provider: 1 points).\n\ + Refer to [our documentation](https://theia-ide.org/docs/user_ai/#custom-request-settings) for more information.'), + type: 'array', + items: { + type: 'object', + properties: { + scope: { + type: 'object', + properties: { + modelId: { + type: 'string', + description: nls.localize('theia/ai/core/requestSettings/scope/modelId/description', 'The (optional) model id') + }, + providerId: { + type: 'string', + description: nls.localize('theia/ai/core/requestSettings/scope/providerId/description', 'The (optional) provider id to apply the settings to.'), + }, + agentId: { + type: 'string', + description: nls.localize('theia/ai/core/requestSettings/scope/agentId/description', 'The (optional) agent id to apply the settings to.'), + }, + } + }, + requestSettings: { + type: 'object', + additionalProperties: true, + description: nls.localize('theia/ai/core/requestSettings/modelSpecificSettings/description', 'Settings for the specific model ID.'), + }, + clientSettings: { + type: 'object', + additionalProperties: false, + description: nls.localize('theia/ai/core/requestSettings/clientSettings/description', + 'Client settings for how to handle messages that are send back to the llm.'), + properties: { + keepToolCalls: { + type: 'boolean', + default: true, + description: nls.localize('theia/ai/core/requestSettings/clientSettings/keepToolCalls/description', + 'If set to false, all tool request and tool responses will be filtered \ + before sending the next user request in a multi-turn conversation.') + }, + keepThinking: { + type: 'boolean', + default: true, + description: nls.localize('theia/ai/core/requestSettings/clientSettings/keepThinking/description', + 'If set to false, all thinking output will be filtered before sending the next user request in a multi-turn conversation.') + } + } + }, + }, + additionalProperties: false + }, + default: [], + }, + [PREFERENCE_NAME_MAX_RETRIES]: { + title: nls.localize('theia/ai/core/maxRetries/title', 'Maximum Retries'), + markdownDescription: nls.localize('theia/ai/core/maxRetries/mdDescription', + 'The maximum number of retry attempts when a request to an AI provider fails. A value of 0 means no retries.'), + type: 'number', + minimum: 0, + default: 3 + }, + [PREFERENCE_NAME_DEFAULT_NOTIFICATION_TYPE]: { + title: nls.localize('theia/ai/core/defaultNotification/title', 'Default Notification Type'), + markdownDescription: nls.localize('theia/ai/core/defaultNotification/mdDescription', + 'The default notification method used when an AI agent completes a task. Individual agents can override this setting.\n\ + - `os-notification`: Show OS/system notifications\n\ + - `message`: Show notifications in the status bar/message area\n\ + - `blink`: Blink or highlight the UI\n\ + - `off`: Disable all notifications'), + type: 'string', + enum: [...NOTIFICATION_TYPES], + default: NOTIFICATION_TYPE_OFF + }, + [PREFERENCE_NAME_SKILL_DIRECTORIES]: { + description: nls.localize('theia/ai/core/skillDirectories/description', + 'Additional directories containing skill definitions (SKILL.md files). Skills provide reusable instructions that can be referenced by AI agents. ' + + 'The default skills directory in your product\'s configuration folder is always included.'), + type: 'array', + items: { + type: 'string' + }, + default: [] + }, + [LANGUAGE_MODEL_ALIASES_PREFERENCE]: { + title: nls.localize('theia/ai/core/preference/languageModelAliases/title', 'Language Model Aliases'), + markdownDescription: nls.localize('theia/ai/core/preference/languageModelAliases/description', 'Configure models for each language model alias in the \ +[AI Configuration View]({0}). Alternatiely you can set the settings manually in the settings.json: \n\ +```\n\ +"default/code": {\n\ + "selectedModel": "anthropic/claude-opus-4-20250514"\n\ +}\n\```', + 'command:aiConfiguration:open' + ), + type: 'object', + additionalProperties: { + type: 'object', + properties: { + selectedModel: { + type: 'string', + description: nls.localize('theia/ai/core/preference/languageModelAliases/selectedModel', 'The user-selected model for this alias.') + } + }, + required: ['selectedModel'], + additionalProperties: false + }, + default: {}, + } + } +}; + +export interface AICoreConfiguration { + [PREFERENCE_NAME_PROMPT_TEMPLATES]: string | undefined; + [PREFERENCE_NAME_REQUEST_SETTINGS]: Array | undefined; + [PREFERENCE_NAME_MAX_RETRIES]: number | undefined; + [PREFERENCE_NAME_DEFAULT_NOTIFICATION_TYPE]: NotificationType | undefined; + [PREFERENCE_NAME_SKILL_DIRECTORIES]: string[] | undefined; +} + +export interface RequestSetting { + scope?: Scope; + clientSettings?: { keepToolCalls: boolean; keepThinking: boolean }; + requestSettings?: { [key: string]: unknown }; +} + +export interface Scope { + modelId?: string; + providerId?: string; + agentId?: string; +} + +export const AICorePreferences = Symbol('AICorePreferences'); +export type AICorePreferences = PreferenceProxy; + +export function bindAICorePreferences(bind: interfaces.Bind): void { + bind(AICorePreferences).toDynamicValue(ctx => { + const factory = ctx.container.get(PreferenceProxyFactory); + return factory(aiCorePreferenceSchema); + }).inSingletonScope(); +} + +/** + * Calculates the specificity score of a RequestSetting for a given scope. + * The score is calculated based on matching criteria: + * - Agent match: 100 points + * - Model match: 10 points + * - Provider match: 1 point + * + * @param setting RequestSetting object to check against + * @param scope Optional scope object containing modelId, providerId, and agentId + * @returns Specificity score (-1 for non-match, or sum of matching criteria points) + */ +export const getRequestSettingSpecificity = (setting: RequestSetting, scope?: Scope): number => { + // If no scope is defined in the setting, return default specificity + if (!setting.scope) { + return 0; + } + + // If no matching criteria are defined in the scope, return default specificity + if (!setting.scope.modelId && !setting.scope.providerId && !setting.scope.agentId) { + return 0; + } + + // Check for explicit non-matches (return -1) + if (scope?.modelId && setting.scope.modelId && setting.scope.modelId !== scope.modelId) { + return -1; + } + + if (scope?.providerId && setting.scope.providerId && setting.scope.providerId !== scope.providerId) { + return -1; + } + + if (scope?.agentId && setting.scope.agentId && setting.scope.agentId !== scope.agentId) { + return -1; + } + + let specificity = 0; + + // Check provider match (1 point) + if (scope?.providerId && setting.scope.providerId === scope.providerId) { + specificity += 1; + } + + // Check model match (10 points) + if (scope?.modelId && setting.scope.modelId === scope.modelId) { + specificity += 10; + } + + // Check agent match (100 points) + if (scope?.agentId && setting.scope.agentId === scope.agentId) { + specificity += 100; + } + + return specificity; +}; diff --git a/packages/ai-core/src/common/ai-variable-resource.ts b/packages/ai-core/src/common/ai-variable-resource.ts new file mode 100644 index 0000000..c345d44 --- /dev/null +++ b/packages/ai-core/src/common/ai-variable-resource.ts @@ -0,0 +1,86 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import * as deepEqual from 'fast-deep-equal'; +import { inject, injectable, postConstruct } from '@theia/core/shared/inversify'; +import { Resource, URI, generateUuid } from '@theia/core'; +import { AIVariableContext, AIVariableResolutionRequest } from './variable-service'; +import stableJsonStringify = require('fast-json-stable-stringify'); +import { ConfigurableInMemoryResources, ConfigurableMutableReferenceResource } from './configurable-in-memory-resources'; + +export const AI_VARIABLE_RESOURCE_SCHEME = 'ai-variable'; +export const NO_CONTEXT_AUTHORITY = 'context-free'; + +@injectable() +export class AIVariableResourceResolver { + @inject(ConfigurableInMemoryResources) protected readonly inMemoryResources: ConfigurableInMemoryResources; + + @postConstruct() + protected init(): void { + this.inMemoryResources.onWillDispose(resource => this.cache.delete(resource.uri.toString())); + } + + protected readonly cache = new Map(); + + getOrCreate(request: AIVariableResolutionRequest, context: AIVariableContext, value: string): ConfigurableMutableReferenceResource { + const uri = this.toUri(request, context); + try { + const existing = this.inMemoryResources.resolve(uri); + existing.update({ contents: value }); + return existing; + } catch { /* No-op */ } + const fresh = this.inMemoryResources.add(uri, { contents: value, readOnly: true, initiallyDirty: false }); + const key = uri.toString(); + this.cache.set(key, [fresh, context]); + return fresh; + } + + protected toUri(request: AIVariableResolutionRequest, context: AIVariableContext): URI { + return URI.fromComponents({ + scheme: AI_VARIABLE_RESOURCE_SCHEME, + query: stableJsonStringify({ arg: request.arg, name: request.variable.name }), + path: '/', + authority: this.toAuthority(context), + fragment: '' + }); + } + + protected toAuthority(context: AIVariableContext): string { + try { + if (deepEqual(context, {})) { return NO_CONTEXT_AUTHORITY; } + for (const [resource, cachedContext] of this.cache.values()) { + if (deepEqual(context, cachedContext)) { + return resource.uri.authority; + } + } + } catch (err) { + // Mostly that deep equal could overflow the stack, but it should run into === or inequality before that. + console.warn('Problem evaluating context in AIVariableResourceResolver', err); + } + return generateUuid(); + } + + fromUri(uri: URI): { variableName: string, arg: string | undefined } | undefined { + if (uri.scheme !== AI_VARIABLE_RESOURCE_SCHEME) { return undefined; } + try { + const { name: variableName, arg } = JSON.parse(uri.query); + return variableName ? { + variableName, + arg, + } : undefined; + } catch { return undefined; } + } +} diff --git a/packages/ai-core/src/common/configurable-in-memory-resources.ts b/packages/ai-core/src/common/configurable-in-memory-resources.ts new file mode 100644 index 0000000..7e51356 --- /dev/null +++ b/packages/ai-core/src/common/configurable-in-memory-resources.ts @@ -0,0 +1,164 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclispeSource GmbH and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { injectable } from '@theia/core/shared/inversify'; +import { SyncReferenceCollection, Reference, ResourceResolver, Resource, Event, Emitter, URI } from '@theia/core'; +import { MarkdownString } from '@theia/core/lib/common/markdown-rendering'; + +@injectable() +/** For creating highly configurable in-memory resources */ +export class ConfigurableInMemoryResources implements ResourceResolver { + + protected readonly resources = new SyncReferenceCollection(uri => new ConfigurableMutableResource(new URI(uri))); + + get onWillDispose(): Event { + return this.resources.onWillDispose; + } + + add(uri: URI, options: ResourceInitializationOptions): ConfigurableMutableReferenceResource { + const resourceUri = uri.toString(); + if (this.resources.has(resourceUri)) { + throw new Error(`Cannot add already existing in-memory resource '${resourceUri}'`); + } + const resource = this.acquire(resourceUri); + resource.update(options); + return resource; + } + + update(uri: URI, options: ResourceInitializationOptions): Resource { + const resourceUri = uri.toString(); + const resource = this.resources.get(resourceUri); + if (!resource) { + throw new Error(`Cannot update non-existent in-memory resource '${resourceUri}'`); + } + resource.update(options); + return resource; + } + + resolve(uri: URI): ConfigurableMutableReferenceResource { + const uriString = uri.toString(); + if (!this.resources.has(uriString)) { + throw new Error(`In memory '${uriString}' resource does not exist.`); + } + return this.acquire(uriString); + } + + protected acquire(uri: string): ConfigurableMutableReferenceResource { + const reference = this.resources.acquire(uri); + return new ConfigurableMutableReferenceResource(reference); + } +} + +export type ResourceInitializationOptions = Pick + & { contents?: string | Promise, onSave?: Resource['saveContents'] }; + +export class ConfigurableMutableResource implements Resource { + protected readonly onDidChangeContentsEmitter = new Emitter(); + readonly onDidChangeContents = this.onDidChangeContentsEmitter.event; + protected fireDidChangeContents(): void { + this.onDidChangeContentsEmitter.fire(); + } + + protected readonly onDidChangeReadonlyEmitter = new Emitter(); + readonly onDidChangeReadOnly = this.onDidChangeReadonlyEmitter.event; + + constructor(readonly uri: URI, protected options?: ResourceInitializationOptions) { } + + get readOnly(): Resource['readOnly'] { + return this.options?.readOnly; + } + + get autosaveable(): boolean { + return this.options?.autosaveable !== false; + } + + get initiallyDirty(): boolean { + return !!this.options?.initiallyDirty; + } + + get contents(): string | Promise { + return this.options?.contents ?? ''; + } + + readContents(): Promise { + return Promise.resolve(this.options?.contents ?? ''); + } + + async saveContents(contents: string): Promise { + await this.options?.onSave?.(contents); + this.update({ contents }); + } + + update(options: ResourceInitializationOptions): void { + const didContentsChange = 'contents' in options && options.contents !== this.options?.contents; + const didReadOnlyChange = 'readOnly' in options && options.readOnly !== this.options?.readOnly; + this.options = { ...this.options, ...options }; + if (didContentsChange) { + this.onDidChangeContentsEmitter.fire(); + } + if (didReadOnlyChange) { + this.onDidChangeReadonlyEmitter.fire(this.readOnly ?? false); + } + } + + dispose(): void { + this.onDidChangeContentsEmitter.dispose(); + } +} + +export class ConfigurableMutableReferenceResource implements Resource { + constructor(protected reference: Reference) { } + + get uri(): URI { + return this.reference.object.uri; + } + + get onDidChangeContents(): Event { + return this.reference.object.onDidChangeContents; + } + + dispose(): void { + this.reference.dispose(); + } + + readContents(): Promise { + return this.reference.object.readContents(); + } + + saveContents(contents: string): Promise { + return this.reference.object.saveContents(contents); + } + + update(options: ResourceInitializationOptions): void { + this.reference.object.update(options); + } + + get readOnly(): Resource['readOnly'] { + return this.reference.object.readOnly; + } + + get initiallyDirty(): boolean { + return this.reference.object.initiallyDirty; + } + + get autosaveable(): boolean { + return this.reference.object.autosaveable; + } + + get contents(): string | Promise { + return this.reference.object.contents; + } +} diff --git a/packages/ai-core/src/common/index.ts b/packages/ai-core/src/common/index.ts new file mode 100644 index 0000000..5cbf7ca --- /dev/null +++ b/packages/ai-core/src/common/index.ts @@ -0,0 +1,37 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** +export * from './agent-service'; +export * from './agent'; +export * from './agents-variable-contribution'; +export * from './ai-core-preferences'; +export * from './tool-invocation-registry'; +export * from './language-model-delegate'; +export * from './language-model-util'; +export * from './language-model'; +export * from './language-model-alias'; +export * from './prompt-service'; +export * from './prompt-service-util'; +export * from './prompt-text'; +export * from './protocol'; +export * from './today-variable-contribution'; +export * from './variable-service'; +export * from './settings-service'; +export * from './language-model-service'; +export * from './token-usage-service'; +export * from './ai-variable-resource'; +export * from './configurable-in-memory-resources'; +export * from './notification-types'; +export * from './skill'; diff --git a/packages/ai-core/src/common/language-model-alias.ts b/packages/ai-core/src/common/language-model-alias.ts new file mode 100644 index 0000000..8508326 --- /dev/null +++ b/packages/ai-core/src/common/language-model-alias.ts @@ -0,0 +1,76 @@ +// ***************************************************************************** +// Copyright (C) 2024-2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { Event } from '@theia/core'; + +/** + * Represents an alias for a language model, allowing fallback and selection. + */ +export interface LanguageModelAlias { + /** + * The unique identifier for the alias. + */ + id: string; + /** + * The list of default model IDs to use if no selectedModelId is set. + * Ordered by priority. The first entry also serves as fallback. + */ + defaultModelIds: string[]; + /** + * A human-readable description of the alias. + */ + description?: string; + /** + * The currently selected model ID, if any. + */ + selectedModelId?: string; +} + +export const LanguageModelAliasRegistry = Symbol('LanguageModelAliasRegistry'); +/** + * Registry for managing language model aliases. + */ +export interface LanguageModelAliasRegistry { + /** + * Promise that resolves when the registry is ready for use (preferences loaded). + */ + ready: Promise; + + /** + * Event that is fired when the alias list changes. + */ + onDidChange: Event; + /** + * Add a new alias or update an existing one. + */ + addAlias(alias: LanguageModelAlias): void; + /** + * Remove an alias by its id. + */ + removeAlias(id: string): void; + /** + * Get all aliases. + */ + getAliases(): LanguageModelAlias[]; + /** + * Resolve an alias or model id to a prioritized list of model ids. + * If the id is not an alias, returns [id]. + * If the alias exists and has a selectedModelId, returns [selectedModelId]. + * If the alias exists and has no selectedModelId, returns defaultModelIds. + * If the alias does not exist, returns undefined. + */ + resolveAlias(id: string): string[] | undefined; +} diff --git a/packages/ai-core/src/common/language-model-delegate.ts b/packages/ai-core/src/common/language-model-delegate.ts new file mode 100644 index 0000000..15af57b --- /dev/null +++ b/packages/ai-core/src/common/language-model-delegate.ts @@ -0,0 +1,49 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { CancellationToken } from '@theia/core'; +import { + LanguageModelMetaData, LanguageModelParsedResponse, LanguageModelRequest, LanguageModelStreamResponsePart, + LanguageModelTextResponse, ToolCallResult +} from './language-model'; + +export const LanguageModelDelegateClient = Symbol('LanguageModelDelegateClient'); +export interface LanguageModelDelegateClient { + toolCall(requestId: string, toolId: string, args_string: string, toolCallId?: string): Promise; + send(id: string, token: LanguageModelStreamResponsePart | undefined): void; + error(id: string, error: Error): void; +} +export const LanguageModelRegistryFrontendDelegate = Symbol('LanguageModelRegistryFrontendDelegate'); +export interface LanguageModelRegistryFrontendDelegate { + getLanguageModelDescriptions(): Promise; +} + +export interface LanguageModelStreamResponseDelegate { + streamId: string; +} +export const isLanguageModelStreamResponseDelegate = (obj: unknown): obj is LanguageModelStreamResponseDelegate => + !!(obj && typeof obj === 'object' && 'streamId' in obj && typeof (obj as { streamId: unknown }).streamId === 'string'); + +export type LanguageModelResponseDelegate = LanguageModelTextResponse | LanguageModelParsedResponse | LanguageModelStreamResponseDelegate; + +export const LanguageModelFrontendDelegate = Symbol('LanguageModelFrontendDelegate'); +export interface LanguageModelFrontendDelegate { + cancel(requestId: string): void; + request(modelId: string, request: LanguageModelRequest, requestId: string, cancellationToken?: CancellationToken): Promise; +} + +export const languageModelRegistryDelegatePath = '/services/languageModelRegistryDelegatePath'; +export const languageModelDelegatePath = '/services/languageModelDelegatePath'; diff --git a/packages/ai-core/src/common/language-model-interaction-model.ts b/packages/ai-core/src/common/language-model-interaction-model.ts new file mode 100644 index 0000000..907f051 --- /dev/null +++ b/packages/ai-core/src/common/language-model-interaction-model.ts @@ -0,0 +1,98 @@ +// ***************************************************************************** +// Copyright (C) 2025 STMicroelectronics and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** +import { + LanguageModelRequest, + LanguageModelResponse, + LanguageModelStreamResponse, + LanguageModelStreamResponsePart, +} from './language-model'; + +/** + * A session tracking raw exchanges with language models, organized into exchange units. + */ +export interface LanguageModelSession { + /** + * Identifier of this Language Model Session. Corresponds to Chat session ids + */ + id: string; + /** + * All exchange units part of this session + */ + exchanges: LanguageModelExchange[]; +} + +/** + * An exchange unit representing a logical operation which may involve multiple model requests. + */ +export interface LanguageModelExchange { + /** + * Identifier of the exchange unit. + */ + id: string; + /** + * All requests that constitute this exchange + */ + requests: LanguageModelExchangeRequest[]; + /** + * Arbitrary metadata for the exchange + */ + metadata: { + agent?: string; + [key: string]: unknown; + } +} + +/** + * Alternative to the LanguageModelStreamResponse, suited for inspection + */ +export interface LanguageModelMonitoredStreamResponse { + parts: LanguageModelStreamResponsePart[]; +} + +/** + * Alternative to the LanguageModelResponse, suited for inspection + */ +export type LanguageModelExchangeRequestResponse = Exclude | LanguageModelMonitoredStreamResponse; + +/** + * Represents a request to a language model within an exchange unit, capturing the request and its response. + */ +export interface LanguageModelExchangeRequest { + /** + * Identifier of the request. Might share the id with the parent exchange if there's only one request. + */ + id: string; + /** + * The actual request sent to the language model + */ + request: LanguageModelRequest; + /** + * Arbitrary metadata for the request. Might contain an agent id and timestamp. + */ + metadata: { + agent?: string; + timestamp?: number; + [key: string]: unknown; + }; + /** + * The identifier of the language model the request was sent to + */ + languageModel: string; + /** + * The recorded response + */ + response: LanguageModelExchangeRequestResponse; +} diff --git a/packages/ai-core/src/common/language-model-service.ts b/packages/ai-core/src/common/language-model-service.ts new file mode 100644 index 0000000..fcf850a --- /dev/null +++ b/packages/ai-core/src/common/language-model-service.ts @@ -0,0 +1,174 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { inject } from '@theia/core/shared/inversify'; +import { isLanguageModelStreamResponse, LanguageModel, LanguageModelRegistry, LanguageModelResponse, LanguageModelStreamResponsePart, UserRequest } from './language-model'; +import { LanguageModelExchangeRequest, LanguageModelSession } from './language-model-interaction-model'; +import { Emitter } from '@theia/core'; + +export interface RequestAddedEvent { + type: 'requestAdded', + id: string; +} +export interface ResponseCompletedEvent { + type: 'responseCompleted', + requestId: string; +} +export interface SessionsClearedEvent { + type: 'sessionsCleared' +} +export type SessionEvent = RequestAddedEvent | ResponseCompletedEvent | SessionsClearedEvent; + +export const LanguageModelService = Symbol('LanguageModelService'); +export interface LanguageModelService { + onSessionChanged: Emitter['event']; + /** + * Collection of all recorded LanguageModelSessions. + */ + sessions: LanguageModelSession[]; + /** + * Submit a language model request, it will automatically be recorded within a LanguageModelSession. + */ + sendRequest( + languageModel: LanguageModel, + languageModelRequest: UserRequest + ): Promise; +} +export class LanguageModelServiceImpl implements LanguageModelService { + + @inject(LanguageModelRegistry) + protected languageModelRegistry: LanguageModelRegistry; + + private _sessions: LanguageModelSession[] = []; + + get sessions(): LanguageModelSession[] { + return this._sessions; + } + + set sessions(newSessions: LanguageModelSession[]) { + this._sessions = newSessions; + if (newSessions.length === 0) { + this.sessionChangedEmitter.fire({ type: 'sessionsCleared' }); + } + } + + protected sessionChangedEmitter = new Emitter(); + onSessionChanged = this.sessionChangedEmitter.event; + + async sendRequest( + languageModel: LanguageModel, + languageModelRequest: UserRequest + ): Promise { + // Filter messages based on client settings + languageModelRequest.messages = languageModelRequest.messages.filter(message => { + if (message.type === 'thinking' && languageModelRequest.clientSettings?.keepThinking === false) { + return false; + } + if ((message.type === 'tool_result' || message.type === 'tool_use') && + languageModelRequest.clientSettings?.keepToolCalls === false) { + return false; + } + // Keep all other messages + return true; + }); + + let response = await languageModel.request(languageModelRequest, languageModelRequest.cancellationToken); + let storedResponse: LanguageModelExchangeRequest['response']; + if (isLanguageModelStreamResponse(response)) { + const parts: LanguageModelStreamResponsePart[] = []; + response = { + ...response, + stream: createLoggingAsyncIterable(response.stream, + parts, + () => this.sessionChangedEmitter.fire({ type: 'responseCompleted', requestId: languageModelRequest.subRequestId ?? languageModelRequest.requestId })) + }; + storedResponse = { parts }; + } else { + storedResponse = response; + } + this.storeRequest(languageModel, languageModelRequest, storedResponse); + + return response; + } + + protected storeRequest(languageModel: LanguageModel, languageModelRequest: UserRequest, response: LanguageModelExchangeRequest['response']): void { + // Find or create the session for this request + let session = this._sessions.find(s => s.id === languageModelRequest.sessionId); + if (!session) { + session = { + id: languageModelRequest.sessionId, + exchanges: [] + }; + this._sessions.push(session); + } + + // Find or create the exchange for this request + let exchange = session.exchanges.find(r => r.id === languageModelRequest.requestId); + if (!exchange) { + exchange = { + id: languageModelRequest.requestId, + requests: [], + metadata: { agent: languageModelRequest.agentId } + }; + session.exchanges.push(exchange); + } + + // Create and add the LanguageModelExchangeRequest to the exchange + const exchangeRequest: LanguageModelExchangeRequest = { + id: languageModelRequest.subRequestId ?? languageModelRequest.requestId, + request: languageModelRequest, + languageModel: languageModel.id, + response: response, + metadata: {} + }; + + exchange.requests.push(exchangeRequest); + + exchangeRequest.metadata.agent = languageModelRequest.agentId; + exchangeRequest.metadata.timestamp = Date.now(); + if (languageModelRequest.promptVariantId) { + exchangeRequest.metadata.promptVariantId = languageModelRequest.promptVariantId; + } + if (languageModelRequest.isPromptVariantCustomized !== undefined) { + exchangeRequest.metadata.isPromptVariantCustomized = languageModelRequest.isPromptVariantCustomized; + } + + this.sessionChangedEmitter.fire({ type: 'requestAdded', id: languageModelRequest.subRequestId ?? languageModelRequest.requestId }); + } + +} + +/** + * Creates an AsyncIterable wrapper that stores each yielded item while preserving the + * original AsyncIterable behavior. + */ +async function* createLoggingAsyncIterable( + stream: AsyncIterable, + parts: LanguageModelStreamResponsePart[], + streamFinished: () => void +): AsyncIterable { + try { + for await (const part of stream) { + parts.push(part); + yield part; + } + } catch (error) { + parts.push({ content: `[NOT FROM LLM] An error occurred: ${error.message}` }); + throw error; + } finally { + streamFinished(); + } +} diff --git a/packages/ai-core/src/common/language-model-util.ts b/packages/ai-core/src/common/language-model-util.ts new file mode 100644 index 0000000..f9ea985 --- /dev/null +++ b/packages/ai-core/src/common/language-model-util.ts @@ -0,0 +1,82 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { + isLanguageModelParsedResponse, + isLanguageModelStreamResponse, + isLanguageModelTextResponse, + isTextResponsePart, + LanguageModelResponse, + ToolRequest +} from './language-model'; +import { LanguageModelMonitoredStreamResponse } from './language-model-interaction-model'; + +/** + * Retrieves the text content from a `LanguageModelResponse` object. + * + * **Important:** For stream responses, the stream can only be consumed once. Calling this function multiple times on the same stream response will return an empty string (`''`) + * on subsequent calls, as the stream will have already been consumed. + * + * @param {LanguageModelResponse} response - The response object, which may contain a text, stream, or parsed response. + * @returns {Promise} - A promise that resolves to the text content of the response. + * @throws {Error} - Throws an error if the response type is not supported or does not contain valid text content. + */ +export const getTextOfResponse = async (response: LanguageModelResponse | LanguageModelMonitoredStreamResponse): Promise => { + if (isLanguageModelTextResponse(response)) { + return response.text; + } else if (isLanguageModelStreamResponse(response)) { + let result = ''; + for await (const chunk of response.stream) { + result += (isTextResponsePart(chunk) && chunk.content) ? chunk.content : ''; + } + return result; + } else if (isLanguageModelParsedResponse(response)) { + return response.content; + } else if ('parts' in response) { + // Handle monitored stream response + let result = ''; + for (const chunk of response.parts) { + result += (isTextResponsePart(chunk) && chunk.content) ? chunk.content : ''; + } + return result; + } + throw new Error(`Invalid response type ${response}`); +}; + +export const getJsonOfResponse = async (response: LanguageModelResponse | LanguageModelMonitoredStreamResponse): Promise => { + const text = await getTextOfResponse(response); + return getJsonOfText(text); +}; + +export const getJsonOfText = (text: string): unknown => { + if (text.startsWith('```json')) { + const regex = /```json\s*([\s\S]*?)\s*```/g; + let match; + // eslint-disable-next-line no-null/no-null + while ((match = regex.exec(text)) !== null) { + try { + return JSON.parse(match[1]); + } catch (error) { + console.error('Failed to parse JSON:', error); + } + } + } else if (text.startsWith('{') || text.startsWith('[')) { + return JSON.parse(text); + } + throw new Error('Invalid response format'); +}; + +export const toolRequestToPromptText = (toolRequest: ToolRequest): string => `${toolRequest.id}`; diff --git a/packages/ai-core/src/common/language-model.spec.ts b/packages/ai-core/src/common/language-model.spec.ts new file mode 100644 index 0000000..044b839 --- /dev/null +++ b/packages/ai-core/src/common/language-model.spec.ts @@ -0,0 +1,86 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { isModelMatching, LanguageModel, LanguageModelSelector } from './language-model'; +import { expect } from 'chai'; + +describe('isModelMatching', () => { + it('returns false with one of two parameter mismatches', () => { + expect( + isModelMatching( + { + name: 'XXX', + family: 'YYY', + }, + { + name: 'gpt-4o', + family: 'YYY', + } + ) + ).eql(false); + }); + it('returns false with two parameter mismatches', () => { + expect( + isModelMatching( + { + name: 'XXX', + family: 'YYY', + }, + { + name: 'gpt-4o', + family: 'ZZZ', + } + ) + ).eql(false); + }); + it('returns true with one parameter match', () => { + expect( + isModelMatching( + { + name: 'gpt-4o', + }, + { + name: 'gpt-4o', + } + ) + ).eql(true); + }); + it('returns true with two parameter matches', () => { + expect( + isModelMatching( + { + name: 'gpt-4o', + family: 'YYY', + }, + { + name: 'gpt-4o', + family: 'YYY', + } + ) + ).eql(true); + }); + it('returns true if there are no parameters in selector', () => { + expect( + isModelMatching( + {}, + { + name: 'gpt-4o', + family: 'YYY', + } + ) + ).eql(true); + }); +}); diff --git a/packages/ai-core/src/common/language-model.ts b/packages/ai-core/src/common/language-model.ts new file mode 100644 index 0000000..21cd39a --- /dev/null +++ b/packages/ai-core/src/common/language-model.ts @@ -0,0 +1,570 @@ +// ***************************************************************************** +// Copyright (C) 2024-2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { ContributionProvider, ILogger, isFunction, isObject, Event, Emitter, CancellationToken } from '@theia/core'; +import { inject, injectable, named, postConstruct } from '@theia/core/shared/inversify'; + +export type MessageActor = 'user' | 'ai' | 'system'; + +export type LanguageModelMessage = TextMessage | ThinkingMessage | ToolUseMessage | ToolResultMessage | ImageMessage; +export namespace LanguageModelMessage { + + export function isTextMessage(obj: LanguageModelMessage): obj is TextMessage { + return obj.type === 'text'; + } + export function isThinkingMessage(obj: LanguageModelMessage): obj is ThinkingMessage { + return obj.type === 'thinking'; + } + export function isToolUseMessage(obj: LanguageModelMessage): obj is ToolUseMessage { + return obj.type === 'tool_use'; + } + export function isToolResultMessage(obj: LanguageModelMessage): obj is ToolResultMessage { + return obj.type === 'tool_result'; + } + export function isImageMessage(obj: LanguageModelMessage): obj is ImageMessage { + return obj.type === 'image'; + } +} +export interface TextMessage { + actor: MessageActor; + type: 'text'; + text: string; +} +export interface ThinkingMessage { + actor: 'ai' + type: 'thinking'; + thinking: string; + signature: string; +} + +export interface ToolResultMessage { + actor: 'user'; + tool_use_id: string; + name: string; + type: 'tool_result'; + content?: ToolCallResult; + is_error?: boolean; +} + +export interface ToolUseMessage { + actor: 'ai'; + type: 'tool_use'; + id: string; + input: unknown; + name: string; + data?: Record; +} +export type ImageMimeType = 'image/jpeg' | 'image/png' | 'image/gif' | 'image/webp' | 'image/bmp' | 'image/svg+xml' | string & {}; +export interface UrlImageContent { url: string }; +export interface Base64ImageContent { + base64data: string; + mimeType: ImageMimeType; +}; +export type ImageContent = UrlImageContent | Base64ImageContent; +export namespace ImageContent { + export const isUrl = (obj: ImageContent): obj is UrlImageContent => 'url' in obj; + export const isBase64 = (obj: ImageContent): obj is Base64ImageContent => 'base64data' in obj && 'mimeType' in obj; +} +export interface ImageMessage { + actor: 'ai' | 'user'; + type: 'image'; + image: ImageContent; +} + +export const isLanguageModelRequestMessage = (obj: unknown): obj is LanguageModelMessage => + !!(obj && typeof obj === 'object' && + 'type' in obj && + typeof (obj as { type: unknown }).type === 'string' && + (obj as { type: unknown }).type === 'text' && + 'query' in obj && + typeof (obj as { query: unknown }).query === 'string' + ); + +export interface ToolRequestParameterProperty { + type?: | 'string' | 'number' | 'integer' | 'boolean' | 'object' | 'array' | 'null'; + anyOf?: ToolRequestParameterProperty[]; + [key: string]: unknown; +} + +export type ToolRequestParametersProperties = Record; +export interface ToolRequestParameters { + type?: 'object'; + properties: ToolRequestParametersProperties; + required?: string[]; +} +/** + * Defines a tool that can be invoked by language models. + * @typeParam TContext - The context type passed to the handler. Defaults to ToolInvocationContext. + */ +export interface ToolRequest { + id: string; + name: string; + parameters: ToolRequestParameters + description?: string; + handler: (arg_string: string, ctx?: TContext) => Promise; + providerName?: string; + + /** + * If set, this tool requires extra confirmation before auto-approval can be enabled. + * + * When a tool has this flag: + * - It defaults to CONFIRM mode (not ALWAYS_ALLOW) even if global default is ALWAYS_ALLOW + * - When user selects "Always Allow", an extra confirmation modal is shown + * - The modal displays a warning about the tool's capabilities + * + * If a string is provided, it will be displayed as the custom warning message. + * If true, a generic warning message will be shown. + * + * Use for tools with broad system access (shell execution, file deletion, etc.) + */ + confirmAlwaysAllow?: boolean | string; +} + +/** + * Context passed to tool handlers during invocation by language models. + * Language models should pass this context when invoking tool handlers to enable + * proper tracking and correlation of tool calls. + */ +export interface ToolInvocationContext { + /** + * The unique identifier for this specific tool call invocation. + * This ID is assigned by the language model and used to correlate + * the tool call with its response. + */ + toolCallId?: string; + /** + * Optional cancellation token to support cancelling tool execution. + */ + cancellationToken?: CancellationToken; +} + +export namespace ToolInvocationContext { + export function is(obj: unknown): obj is ToolInvocationContext { + return !!obj && typeof obj === 'object'; + } + + /** + * Creates a new ToolInvocationContext with the given tool call ID and optional cancellation token. + */ + export function create(toolCallId?: string, cancellationToken?: CancellationToken): ToolInvocationContext { + return { toolCallId, cancellationToken }; + } + + /** + * Extracts the tool call ID from an unknown context object. + * Returns undefined if the context is not a valid ToolInvocationContext or has no toolCallId. + */ + export function getToolCallId(ctx: unknown): string | undefined { + if (is(ctx) && 'toolCallId' in ctx && typeof ctx.toolCallId === 'string') { + return ctx.toolCallId; + } + return undefined; + } + + /** + * Extracts the cancellation token from an unknown context object. + */ + export function getCancellationToken(ctx: unknown): CancellationToken | undefined { + if (is(ctx) && 'cancellationToken' in ctx) { + return ctx.cancellationToken as CancellationToken | undefined; + } + return undefined; + } +} + +export namespace ToolRequest { + function isToolRequestParameterProperty(obj: unknown): obj is ToolRequestParameterProperty { + if (!obj || typeof obj !== 'object') { + return false; + } + const record = obj as Record; + + // Check that at least one of "type" or "anyOf" exists + if (!('type' in record) && !('anyOf' in record)) { + return false; + } + + // If an "anyOf" field is present, it must be an array where each item is also a valid property. + if ('anyOf' in record) { + if (!Array.isArray(record.anyOf)) { + return false; + } + for (const item of record.anyOf) { + if (!isToolRequestParameterProperty(item)) { + return false; + } + } + } + if ('type' in record && typeof record.type !== 'string') { + return false; + } + + // No further checks required for additional properties. + return true; + } + export function isToolRequestParametersProperties(obj: unknown): obj is ToolRequestParametersProperties { + if (!obj || typeof obj !== 'object') { + return false; + } + return Object.entries(obj).every(([key, value]) => { + if (typeof key !== 'string') { + return false; + } + return isToolRequestParameterProperty(value); + }); + } + export function isToolRequestParameters(obj: unknown): obj is ToolRequestParameters { + return !!obj && typeof obj === 'object' && + (!('type' in obj) || obj.type === 'object') && + 'properties' in obj && isToolRequestParametersProperties(obj.properties) && + (!('required' in obj) || (Array.isArray(obj.required) && obj.required.every(prop => typeof prop === 'string'))); + } +} +export interface LanguageModelRequest { + messages: LanguageModelMessage[], + tools?: ToolRequest[]; + response_format?: { type: 'text' } | { type: 'json_object' } | ResponseFormatJsonSchema; + settings?: { [key: string]: unknown }; + clientSettings?: { keepToolCalls: boolean; keepThinking: boolean } +} +export interface ResponseFormatJsonSchema { + type: 'json_schema'; + json_schema: { + name: string, + description?: string, + schema?: Record, + strict?: boolean | null + }; +} + +/** + * The UserRequest extends the "pure" LanguageModelRequest for cancelling support as well as + * logging metadata. + * The additional metadata might also be used for other use cases, for example to query default + * request settings based on the agent id, merging with the request settings handed over. + */ +export interface UserRequest extends LanguageModelRequest { + /** + * Identifier of the Ai/ChatSession + */ + sessionId: string; + /** + * Identifier of the request or overall exchange. Corresponds to request id in Chat sessions + */ + requestId: string; + /** + * Id of a request in case a single exchange consists of multiple requests. In this case the requestId corresponds to the overall exchange. + */ + subRequestId?: string; + /** + * Optional agent identifier in case the request was sent by an agent + */ + agentId?: string; + /** + * Optional prompt variant ID used for this request + */ + promptVariantId?: string; + /** + * Indicates whether the prompt variant was customized + */ + isPromptVariantCustomized?: boolean; + /** + * Cancellation support + */ + cancellationToken?: CancellationToken; +} + +export interface LanguageModelTextResponse { + text: string; +} +export const isLanguageModelTextResponse = (obj: unknown): obj is LanguageModelTextResponse => + !!(obj && typeof obj === 'object' && 'text' in obj && typeof (obj as { text: unknown }).text === 'string'); + +export type LanguageModelStreamResponsePart = TextResponsePart | ToolCallResponsePart | ThinkingResponsePart | UsageResponsePart; + +export const isLanguageModelStreamResponsePart = (part: unknown): part is LanguageModelStreamResponsePart => + isUsageResponsePart(part) || isTextResponsePart(part) || isThinkingResponsePart(part) || isToolCallResponsePart(part); + +export interface UsageResponsePart { + input_tokens: number; + output_tokens: number; +} +export const isUsageResponsePart = (part: unknown): part is UsageResponsePart => + !!(part && typeof part === 'object' && + 'input_tokens' in part && typeof part.input_tokens === 'number' && + 'output_tokens' in part && typeof part.output_tokens === 'number'); +export interface TextResponsePart { + content: string; +} +export const isTextResponsePart = (part: unknown): part is TextResponsePart => + !!(part && typeof part === 'object' && 'content' in part && typeof part.content === 'string'); + +export interface ToolCallResponsePart { + tool_calls: ToolCall[]; +} +export const isToolCallResponsePart = (part: unknown): part is ToolCallResponsePart => + !!(part && typeof part === 'object' && 'tool_calls' in part && Array.isArray(part.tool_calls)); + +export interface ThinkingResponsePart { + thought: string; + signature: string; +} +export const isThinkingResponsePart = (part: unknown): part is ThinkingResponsePart => + !!(part && typeof part === 'object' && 'thought' in part && typeof part.thought === 'string'); + +export interface ToolCallTextResult { type: 'text', text: string; }; +export interface ToolCallImageResult extends Base64ImageContent { type: 'image' }; +export interface ToolCallAudioResult { type: 'audio', data: string; mimeType: string }; +export type ToolCallErrorKind = 'tool-not-available'; +export interface ToolCallErrorResult { type: 'error', data: string; errorKind?: ToolCallErrorKind; }; +export type ToolCallContentResult = ToolCallTextResult | ToolCallImageResult | ToolCallAudioResult | ToolCallErrorResult; +export interface ToolCallContent { + content: ToolCallContentResult[]; +} + +export const isToolCallContent = (result: unknown): result is ToolCallContent => + !!(result && typeof result === 'object' && 'content' in result && Array.isArray((result as ToolCallContent).content)); + +export const isToolCallErrorResult = (item: unknown): item is ToolCallErrorResult => + !!(item && typeof item === 'object' && 'type' in item && (item as ToolCallErrorResult).type === 'error' && 'data' in item); + +export const isToolNotAvailableError = (item: unknown): item is ToolCallErrorResult => + isToolCallErrorResult(item) && item.errorKind === 'tool-not-available'; + +export const hasToolCallError = (result: ToolCallResult): boolean => + isToolCallContent(result) && result.content.some(isToolCallErrorResult); + +export const hasToolNotAvailableError = (result: ToolCallResult): boolean => + isToolCallContent(result) && result.content.some(isToolNotAvailableError); + +export const createToolCallError = (message: string, errorKind?: ToolCallErrorKind): ToolCallContent => ({ + content: [errorKind ? { type: 'error', data: message, errorKind } : { type: 'error', data: message }] +}); + +export type ToolCallResult = undefined | object | string | ToolCallContent; +export interface ToolCall { + id?: string; + function?: { + arguments?: string; + name?: string; + }, + finished?: boolean; + result?: ToolCallResult; + data?: Record; + /** + * When true, the arguments field contains a delta to be appended + * to existing arguments rather than a complete replacement. + */ + argumentsDelta?: boolean; +} + +export interface LanguageModelStreamResponse { + stream: AsyncIterable; +} +export const isLanguageModelStreamResponse = (obj: unknown): obj is LanguageModelStreamResponse => + !!(obj && typeof obj === 'object' && 'stream' in obj); + +export interface LanguageModelParsedResponse { + parsed: unknown; + content: string; +} +export const isLanguageModelParsedResponse = (obj: unknown): obj is LanguageModelParsedResponse => + !!(obj && typeof obj === 'object' && 'parsed' in obj && 'content' in obj); + +export type LanguageModelResponse = LanguageModelTextResponse | LanguageModelStreamResponse | LanguageModelParsedResponse; + +/////////////////////////////////////////// +// Language Model Provider +/////////////////////////////////////////// + +export const LanguageModelProvider = Symbol('LanguageModelProvider'); +export type LanguageModelProvider = () => Promise; + +// See also VS Code `ILanguageModelChatMetadata` +export interface LanguageModelMetaData { + readonly id: string; + readonly name?: string; + readonly vendor?: string; + readonly version?: string; + readonly family?: string; + readonly maxInputTokens?: number; + readonly maxOutputTokens?: number; + readonly status: LanguageModelStatus; +} + +export namespace LanguageModelMetaData { + export function is(arg: unknown): arg is LanguageModelMetaData { + return isObject(arg) && 'id' in arg; + } +} + +export interface LanguageModelStatus { + status: 'ready' | 'unavailable'; + message?: string; +} + +export interface LanguageModel extends LanguageModelMetaData { + request(request: UserRequest, cancellationToken?: CancellationToken): Promise; +} + +export namespace LanguageModel { + export function is(arg: unknown): arg is LanguageModel { + return isObject(arg) && 'id' in arg && isFunction(arg.request); + } +} + +// See also VS Code `ILanguageModelChatSelector` +interface VsCodeLanguageModelSelector { + readonly identifier?: string; + readonly name?: string; + readonly vendor?: string; + readonly version?: string; + readonly family?: string; + readonly tokens?: number; +} + +export interface LanguageModelSelector extends VsCodeLanguageModelSelector { + readonly agent: string; + readonly purpose: string; +} + +export type LanguageModelRequirement = Omit; + +export const LanguageModelRegistry = Symbol('LanguageModelRegistry'); + +/** + * Base interface for language model registries (frontend and backend). + */ +export interface LanguageModelRegistry { + onChange: Event<{ models: LanguageModel[] }>; + addLanguageModels(models: LanguageModel[]): void; + getLanguageModels(): Promise; + getLanguageModel(id: string): Promise; + removeLanguageModels(id: string[]): void; + selectLanguageModel(request: LanguageModelSelector): Promise; + selectLanguageModels(request: LanguageModelSelector): Promise; + patchLanguageModel(id: string, patch: Partial): Promise; +} + +export const FrontendLanguageModelRegistry = Symbol('FrontendLanguageModelRegistry'); + +/** + * Frontend-specific language model registry interface (supports alias resolution). + */ +export interface FrontendLanguageModelRegistry extends LanguageModelRegistry { + /** + * If an id of a language model is provded, returns the LanguageModel if it is `ready`. + * If an alias is provided, finds the highest-priority ready model from that alias. + * If none are ready returns undefined. + */ + getReadyLanguageModel(idOrAlias: string): Promise; +} + +@injectable() +export class DefaultLanguageModelRegistryImpl implements LanguageModelRegistry { + @inject(ILogger) + protected logger: ILogger; + @inject(ContributionProvider) @named(LanguageModelProvider) + protected readonly languageModelContributions: ContributionProvider; + + protected languageModels: LanguageModel[] = []; + + protected markInitialized: () => void; + protected initialized: Promise = new Promise(resolve => { this.markInitialized = resolve; }); + + protected changeEmitter = new Emitter<{ models: LanguageModel[] }>(); + onChange = this.changeEmitter.event; + + @postConstruct() + protected init(): void { + const contributions = this.languageModelContributions.getContributions(); + const promises = contributions.map(provider => provider()); + Promise.allSettled(promises).then(results => { + for (const result of results) { + if (result.status === 'fulfilled') { + this.languageModels.push(...result.value); + } else { + this.logger.error('Failed to add some language models:', result.reason); + } + } + this.markInitialized(); + }); + } + + addLanguageModels(models: LanguageModel[]): void { + models.forEach(model => { + if (this.languageModels.find(lm => lm.id === model.id)) { + console.warn(`Tried to add already existing language model with id ${model.id}. The new model will be ignored.`); + return; + } + this.languageModels.push(model); + this.changeEmitter.fire({ models: this.languageModels }); + }); + } + + async getLanguageModels(): Promise { + await this.initialized; + return this.languageModels; + } + + async getLanguageModel(id: string): Promise { + await this.initialized; + return this.languageModels.find(model => model.id === id); + } + + removeLanguageModels(ids: string[]): void { + ids.forEach(id => { + const index = this.languageModels.findIndex(model => model.id === id); + if (index !== -1) { + this.languageModels.splice(index, 1); + this.changeEmitter.fire({ models: this.languageModels }); + } else { + console.warn(`Language model with id ${id} was requested to be removed, however it does not exist`); + } + }); + } + + async selectLanguageModels(request: LanguageModelSelector): Promise { + await this.initialized; + // TODO check for actor and purpose against settings + return this.languageModels.filter(model => model.status.status === 'ready' && isModelMatching(request, model)); + } + + async selectLanguageModel(request: LanguageModelSelector): Promise { + const models = await this.selectLanguageModels(request); + return models ? models[0] : undefined; + } + + async patchLanguageModel(id: string, patch: Partial): Promise { + await this.initialized; + const model = this.languageModels.find(m => m.id === id); + if (!model) { + this.logger.warn(`Language model with id ${id} not found for patch.`); + return; + } + Object.assign(model, patch); + this.changeEmitter.fire({ models: this.languageModels }); + } + +} + +export function isModelMatching(request: LanguageModelSelector, model: LanguageModel): boolean { + return (!request.identifier || model.id === request.identifier) && + (!request.name || model.name === request.name) && + (!request.vendor || model.vendor === request.vendor) && + (!request.version || model.version === request.version) && + (!request.family || model.family === request.family); +} diff --git a/packages/ai-core/src/common/notification-types.ts b/packages/ai-core/src/common/notification-types.ts new file mode 100644 index 0000000..374c101 --- /dev/null +++ b/packages/ai-core/src/common/notification-types.ts @@ -0,0 +1,31 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +export const NOTIFICATION_TYPE_OFF = 'off'; +export const NOTIFICATION_TYPE_OS_NOTIFICATION = 'os-notification'; +export const NOTIFICATION_TYPE_MESSAGE = 'message'; +export const NOTIFICATION_TYPE_BLINK = 'blink'; +export type NotificationType = + | typeof NOTIFICATION_TYPE_OFF + | typeof NOTIFICATION_TYPE_OS_NOTIFICATION + | typeof NOTIFICATION_TYPE_MESSAGE + | typeof NOTIFICATION_TYPE_BLINK; +export const NOTIFICATION_TYPES: NotificationType[] = [ + NOTIFICATION_TYPE_OFF, + NOTIFICATION_TYPE_OS_NOTIFICATION, + NOTIFICATION_TYPE_MESSAGE, + NOTIFICATION_TYPE_BLINK, +]; diff --git a/packages/ai-core/src/common/prompt-service-util.ts b/packages/ai-core/src/common/prompt-service-util.ts new file mode 100644 index 0000000..d7b1dc6 --- /dev/null +++ b/packages/ai-core/src/common/prompt-service-util.ts @@ -0,0 +1,31 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +/** Should match the one from VariableResolverService. The format is `{{variableName:arg}}`. We allow {{}} and {{{}}} but no mixtures */ +export const PROMPT_VARIABLE_TWO_BRACES_REGEX = /(? { + let promptService: PromptService; + + beforeEach(() => { + const container = new Container(); + container.bind(PromptService).to(PromptServiceImpl).inSingletonScope(); + const logger = sinon.createStubInstance(Logger); + + const variableService = new DefaultAIVariableService({ getContributions: () => [] }, logger); + const nameVariable = { id: 'test', name: 'name', description: 'Test name ' }; + variableService.registerResolver(nameVariable, { + canResolve: () => 100, + resolve: async () => ({ variable: nameVariable, value: 'Jane' }) + }); + container.bind(AIVariableService).toConstantValue(variableService); + container.bind(ILogger).toConstantValue(new MockLogger); + + promptService = container.get(PromptService); + promptService.addBuiltInPromptFragment({ id: '1', template: 'Hello, {{name}}!' }); + promptService.addBuiltInPromptFragment({ id: '2', template: 'Goodbye, {{name}}!' }); + promptService.addBuiltInPromptFragment({ id: '3', template: 'Ciao, {{invalid}}!' }); + promptService.addBuiltInPromptFragment({ id: '8', template: 'Hello, {{{name}}}' }); + }); + + it('should successfully initialize and retrieve built-in prompt fragments', () => { + const allPrompts = promptService.getActivePromptFragments(); + expect(allPrompts.find(prompt => prompt.id === '1')!.template).to.equal('Hello, {{name}}!'); + expect(allPrompts.find(prompt => prompt.id === '2')!.template).to.equal('Goodbye, {{name}}!'); + expect(allPrompts.find(prompt => prompt.id === '3')!.template).to.equal('Ciao, {{invalid}}!'); + expect(allPrompts.find(prompt => prompt.id === '8')!.template).to.equal('Hello, {{{name}}}'); + }); + + it('should retrieve raw prompt fragment by id', () => { + const rawPrompt = promptService.getRawPromptFragment('1'); + expect(rawPrompt?.template).to.equal('Hello, {{name}}!'); + }); + + it('should format prompt fragment with provided arguments', async () => { + const formattedPrompt = await promptService.getResolvedPromptFragment('1', { name: 'John' }); + expect(formattedPrompt?.text).to.equal('Hello, John!'); + }); + + it('should store a new prompt fragment', () => { + promptService.addBuiltInPromptFragment({ id: '3', template: 'Welcome, {{name}}!' }); + const newPrompt = promptService.getRawPromptFragment('3'); + expect(newPrompt?.template).to.equal('Welcome, {{name}}!'); + }); + + it('should replace variable placeholders with provided arguments', async () => { + const prompt = await promptService.getResolvedPromptFragment('1', { name: 'John' }); + expect(prompt?.text).to.equal('Hello, John!'); + }); + + it('should use variable service to resolve placeholders when argument values are not provided', async () => { + const prompt = await promptService.getResolvedPromptFragment('1'); + expect(prompt?.text).to.equal('Hello, Jane!'); + }); + + it('should return the prompt fragment even if there are no valid replacements', async () => { + const prompt = await promptService.getResolvedPromptFragment('3'); + expect(prompt?.text).to.equal('Ciao, {{invalid}}!'); + }); + + it('should return undefined if the prompt fragment id is not found', async () => { + const prompt = await promptService.getResolvedPromptFragment('4'); + expect(prompt).to.be.undefined; + }); + + it('should ignore whitespace in variables', async () => { + promptService.addBuiltInPromptFragment({ id: '4', template: 'Hello, {{name }}!' }); + promptService.addBuiltInPromptFragment({ id: '5', template: 'Hello, {{ name}}!' }); + promptService.addBuiltInPromptFragment({ id: '6', template: 'Hello, {{ name }}!' }); + promptService.addBuiltInPromptFragment({ id: '7', template: 'Hello, {{ name }}!' }); + for (let i = 4; i <= 7; i++) { + const prompt = await promptService.getResolvedPromptFragment(`${i}`, { name: 'John' }); + expect(prompt?.text).to.equal('Hello, John!'); + } + }); + + it('should retrieve raw prompt fragment by id (three bracket)', () => { + const rawPrompt = promptService.getRawPromptFragment('8'); + expect(rawPrompt?.template).to.equal('Hello, {{{name}}}'); + }); + + it('should correctly replace variables (three brackets)', async () => { + const formattedPrompt = await promptService.getResolvedPromptFragment('8'); + expect(formattedPrompt?.text).to.equal('Hello, Jane'); + }); + + it('should ignore whitespace in variables (three bracket)', async () => { + promptService.addBuiltInPromptFragment({ id: '9', template: 'Hello, {{{name }}}' }); + promptService.addBuiltInPromptFragment({ id: '10', template: 'Hello, {{{ name}}}' }); + promptService.addBuiltInPromptFragment({ id: '11', template: 'Hello, {{{ name }}}' }); + promptService.addBuiltInPromptFragment({ id: '12', template: 'Hello, {{{ name }}}' }); + for (let i = 9; i <= 12; i++) { + const prompt = await promptService.getResolvedPromptFragment(`${i}`, { name: 'John' }); + expect(prompt?.text).to.equal('Hello, John'); + } + }); + + it('should ignore invalid prompts with unmatched brackets', async () => { + promptService.addBuiltInPromptFragment({ id: '9', template: 'Hello, {{name' }); + promptService.addBuiltInPromptFragment({ id: '10', template: 'Hello, {{{name' }); + promptService.addBuiltInPromptFragment({ id: '11', template: 'Hello, name}}}}' }); + const prompt1 = await promptService.getResolvedPromptFragment('9', { name: 'John' }); + expect(prompt1?.text).to.equal('Hello, {{name'); // Not matching due to missing closing brackets + const prompt2 = await promptService.getResolvedPromptFragment('10', { name: 'John' }); + expect(prompt2?.text).to.equal('Hello, {{{name'); // Matches pattern due to valid three-start-two-end brackets + const prompt3 = await promptService.getResolvedPromptFragment('11', { name: 'John' }); + expect(prompt3?.text).to.equal('Hello, name}}}}'); // Extra closing bracket, does not match cleanly + }); + + it('should handle a mixture of two and three brackets correctly', async () => { + promptService.addBuiltInPromptFragment({ id: '12', template: 'Hi, {{name}}}' }); // (invalid) + promptService.addBuiltInPromptFragment({ id: '13', template: 'Hello, {{{name}}' }); // (invalid) + promptService.addBuiltInPromptFragment({ id: '14', template: 'Greetings, {{{name}}}}' }); // (invalid) + promptService.addBuiltInPromptFragment({ id: '15', template: 'Bye, {{{{name}}}' }); // (invalid) + promptService.addBuiltInPromptFragment({ id: '16', template: 'Ciao, {{{{name}}}}' }); // (invalid) + promptService.addBuiltInPromptFragment({ id: '17', template: 'Hi, {{name}}! {{{name}}}' }); // Mixed valid patterns + + const prompt12 = await promptService.getResolvedPromptFragment('12', { name: 'John' }); + expect(prompt12?.text).to.equal('Hi, {{name}}}'); + + const prompt13 = await promptService.getResolvedPromptFragment('13', { name: 'John' }); + expect(prompt13?.text).to.equal('Hello, {{{name}}'); + + const prompt14 = await promptService.getResolvedPromptFragment('14', { name: 'John' }); + expect(prompt14?.text).to.equal('Greetings, {{{name}}}}'); + + const prompt15 = await promptService.getResolvedPromptFragment('15', { name: 'John' }); + expect(prompt15?.text).to.equal('Bye, {{{{name}}}'); + + const prompt16 = await promptService.getResolvedPromptFragment('16', { name: 'John' }); + expect(prompt16?.text).to.equal('Ciao, {{{{name}}}}'); + + const prompt17 = await promptService.getResolvedPromptFragment('17', { name: 'John' }); + expect(prompt17?.text).to.equal('Hi, John! John'); + }); + + it('should strip single-line comments at the start of the template', () => { + promptService.addBuiltInPromptFragment({ id: 'comment-basic', template: '{{!-- Comment --}}Hello, {{name}}!' }); + const prompt = promptService.getPromptFragment('comment-basic'); + expect(prompt?.template).to.equal('Hello, {{name}}!'); + }); + + it('should remove line break after first-line comment', () => { + promptService.addBuiltInPromptFragment({ id: 'comment-line-break', template: '{{!-- Comment --}}\nHello, {{name}}!' }); + const prompt = promptService.getPromptFragment('comment-line-break'); + expect(prompt?.template).to.equal('Hello, {{name}}!'); + }); + + it('should strip multiline comments at the start of the template', () => { + promptService.addBuiltInPromptFragment({ id: 'comment-multiline', template: '{{!--\nMultiline comment\n--}}\nGoodbye, {{name}}!' }); + const prompt = promptService.getPromptFragment('comment-multiline'); + expect(prompt?.template).to.equal('Goodbye, {{name}}!'); + }); + + it('should not strip comments not in the first line', () => { + promptService.addBuiltInPromptFragment({ id: 'comment-second-line', template: 'Hello, {{name}}!\n{{!-- Comment --}}' }); + const prompt = promptService.getPromptFragment('comment-second-line'); + expect(prompt?.template).to.equal('Hello, {{name}}!\n{{!-- Comment --}}'); + }); + + it('should treat unclosed comments as regular text', () => { + promptService.addBuiltInPromptFragment({ id: 'comment-unclosed', template: '{{!-- Unclosed comment' }); + const prompt = promptService.getPromptFragment('comment-unclosed'); + expect(prompt?.template).to.equal('{{!-- Unclosed comment'); + }); + + it('should treat standalone closing delimiters as regular text', () => { + promptService.addBuiltInPromptFragment({ id: 'comment-standalone', template: '--}} Hello, {{name}}!' }); + const prompt = promptService.getPromptFragment('comment-standalone'); + expect(prompt?.template).to.equal('--}} Hello, {{name}}!'); + }); + + it('should handle nested comments and stop at the first closing tag', () => { + promptService.addBuiltInPromptFragment({ id: 'nested-comment', template: '{{!-- {{!-- Nested comment --}} --}}text' }); + const prompt = promptService.getPromptFragment('nested-comment'); + expect(prompt?.template).to.equal('--}}text'); + }); + + it('should handle templates with only comments', () => { + promptService.addBuiltInPromptFragment({ id: 'comment-only', template: '{{!-- Only comments --}}' }); + const prompt = promptService.getPromptFragment('comment-only'); + expect(prompt?.template).to.equal(''); + }); + + it('should handle mixed delimiters on the same line', () => { + promptService.addBuiltInPromptFragment({ id: 'comment-mixed', template: '{{!-- Unclosed comment --}}' }); + const prompt = promptService.getPromptFragment('comment-mixed'); + expect(prompt?.template).to.equal(''); + }); + + it('should resolve variables after stripping single-line comments', async () => { + promptService.addBuiltInPromptFragment({ id: 'comment-resolve', template: '{{!-- Comment --}}Hello, {{name}}!' }); + const prompt = await promptService.getResolvedPromptFragment('comment-resolve', { name: 'John' }); + expect(prompt?.text).to.equal('Hello, John!'); + }); + + it('should resolve variables in multiline templates with comments', async () => { + promptService.addBuiltInPromptFragment({ id: 'comment-multiline-vars', template: '{{!--\nMultiline comment\n--}}\nHello, {{name}}!' }); + const prompt = await promptService.getResolvedPromptFragment('comment-multiline-vars', { name: 'John' }); + expect(prompt?.text).to.equal('Hello, John!'); + }); + + it('should resolve variables with standalone closing delimiters', async () => { + promptService.addBuiltInPromptFragment({ id: 'comment-standalone-vars', template: '--}} Hello, {{name}}!' }); + const prompt = await promptService.getResolvedPromptFragment('comment-standalone-vars', { name: 'John' }); + expect(prompt?.text).to.equal('--}} Hello, John!'); + }); + + it('should treat unclosed comments as text and resolve variables', async () => { + promptService.addBuiltInPromptFragment({ id: 'comment-unclosed-vars', template: '{{!-- Unclosed comment\nHello, {{name}}!' }); + const prompt = await promptService.getResolvedPromptFragment('comment-unclosed-vars', { name: 'John' }); + expect(prompt?.text).to.equal('{{!-- Unclosed comment\nHello, John!'); + }); + + it('should handle templates with mixed comments and variables', async () => { + promptService.addBuiltInPromptFragment( + { id: 'comment-mixed-vars', template: '{{!-- Comment --}}Hi, {{name}}! {{!-- Another comment --}}' }); + const prompt = await promptService.getResolvedPromptFragment('comment-mixed-vars', { name: 'John' }); + expect(prompt?.text).to.equal('Hi, John! {{!-- Another comment --}}'); + }); + + it('should return all variant IDs of a given prompt', () => { + promptService.addBuiltInPromptFragment({ + id: 'variant1', + template: 'Variant 1', + }, 'systemPrompt' + ); + promptService.addBuiltInPromptFragment({ + id: 'variant2', + template: 'Variant 2', + }, 'systemPrompt' + ); + promptService.addBuiltInPromptFragment({ + id: 'variant3', + template: 'Variant 3', + }, 'systemPrompt' + ); + + const variantIds = promptService.getVariantIds('systemPrompt'); + expect(variantIds).to.deep.equal(['variant1', 'variant2', 'variant3']); + }); + + it('should return an empty array if no variants exist for a given prompt', () => { + promptService.addBuiltInPromptFragment({ id: 'main', template: 'Main template' }); + + const variantIds = promptService.getVariantIds('main'); + expect(variantIds).to.deep.equal([]); + }); + + it('should return an empty array if the main prompt ID does not exist', () => { + const variantIds = promptService.getVariantIds('nonExistent'); + expect(variantIds).to.deep.equal([]); + }); + + it('should not influence prompts without variants when other prompts have variants', () => { + promptService.addBuiltInPromptFragment({ id: 'variant1', template: 'Variant 1' }, 'systemPromptWithVariants', true); + promptService.addBuiltInPromptFragment({ id: 'promptFragmentWithoutVariants', template: 'template without variants' }); + + promptService.addBuiltInPromptFragment({ + id: 'variant2', + template: 'Variant 2', + }, 'systemPromptWithVariants' + ); + + const systemPromptWithVariants = promptService.getVariantIds('systemPromptWithVariants'); + const promptFragmentWithoutVariants = promptService.getVariantIds('promptFragmentWithoutVariants'); + + expect(systemPromptWithVariants).to.deep.equal(['variant1', 'variant2']); + expect(promptFragmentWithoutVariants).to.deep.equal([]); + }); + + it('should resolve function references within resolved variable replacements', async () => { + // Mock the tool invocation registry + const toolInvocationRegistry = { + getFunction: sinon.stub() + }; + + // Create a test tool request that will be returned by the registry + const testFunction: ToolRequest = { + id: 'testFunction', + name: 'Test Function', + description: 'A test function', + parameters: { + type: 'object', + properties: { + param1: { + type: 'string', + description: 'Test parameter' + } + } + }, + providerName: 'test-provider', + handler: sinon.stub() + }; + toolInvocationRegistry.getFunction.withArgs('testFunction').returns(testFunction); + + // Create a container with our mocked registry + const container = new Container(); + container.bind(PromptService).to(PromptServiceImpl).inSingletonScope(); + // eslint-disable-next-line @typescript-eslint/no-explicit-any + container.bind(ToolInvocationRegistry).toConstantValue(toolInvocationRegistry as any); + + // Set up a variable service that returns a fragment with a function reference + const variableService = new DefaultAIVariableService({ getContributions: () => [] }, sinon.createStubInstance(Logger)); + const fragmentVariable = { id: 'test', name: 'fragment', description: 'Test fragment with function' }; + variableService.registerResolver(fragmentVariable, { + canResolve: () => 100, + resolve: async () => ({ + variable: fragmentVariable, + value: 'This fragment contains a function reference: ~{testFunction}' + }) + }); + container.bind(AIVariableService).toConstantValue(variableService); + container.bind(ILogger).toConstantValue(new MockLogger); + + const testPromptService = container.get(PromptService); + testPromptService.addBuiltInPromptFragment({ id: 'testPrompt', template: 'Template with fragment: {{fragment}}' }); + + // Get the resolved prompt + const resolvedPrompt = await testPromptService.getResolvedPromptFragment('testPrompt'); + + // Verify that the function was resolved + expect(resolvedPrompt).to.not.be.undefined; + expect(resolvedPrompt?.text).to.include('This fragment contains a function reference:'); + expect(resolvedPrompt?.text).to.not.include('~{testFunction}'); + + // Verify that the function description was added to functionDescriptions + expect(resolvedPrompt?.functionDescriptions?.size).to.equal(1); + expect(resolvedPrompt?.functionDescriptions?.get('testFunction')).to.deep.equal(testFunction); + + // Verify that the tool invocation registry was called + expect(toolInvocationRegistry.getFunction.calledWith('testFunction')).to.be.true; + }); + + // ===== Command Tests ===== + + describe('Command Management', () => { + it('getCommands() returns only fragments with isCommand=true', () => { + promptService.addBuiltInPromptFragment({ + id: 'cmd1', + template: 'Command 1', + isCommand: true, + commandName: 'cmd1' + }); + promptService.addBuiltInPromptFragment({ + id: 'normal', + template: 'Normal prompt' + }); + promptService.addBuiltInPromptFragment({ + id: 'cmd2', + template: 'Command 2', + isCommand: true, + commandName: 'cmd2' + }); + + const commands = promptService.getCommands(); + expect(commands.length).to.equal(2); + expect(commands.map(c => c.id)).to.include('cmd1'); + expect(commands.map(c => c.id)).to.include('cmd2'); + expect(commands.map(c => c.id)).to.not.include('normal'); + }); + + it('getCommands(agentId) filters by commandAgents array', () => { + promptService.addBuiltInPromptFragment({ + id: 'cmd-universal', + template: 'Universal command', + isCommand: true, + commandName: 'universal', + commandAgents: ['Universal'] + }); + promptService.addBuiltInPromptFragment({ + id: 'cmd-specific', + template: 'Specific command', + isCommand: true, + commandName: 'specific', + commandAgents: ['SpecificAgent'] + }); + + const universalCommands = promptService.getCommands('Universal'); + expect(universalCommands.length).to.equal(1); + expect(universalCommands[0].id).to.equal('cmd-universal'); + + const specificCommands = promptService.getCommands('SpecificAgent'); + expect(specificCommands.length).to.equal(1); + expect(specificCommands[0].id).to.equal('cmd-specific'); + }); + + it('getCommands(agentId) includes commands without commandAgents', () => { + promptService.addBuiltInPromptFragment({ + id: 'cmd-all', + template: 'Available for all', + isCommand: true, + commandName: 'all' + // No commandAgents means available for all + }); + promptService.addBuiltInPromptFragment({ + id: 'cmd-specific', + template: 'Specific command', + isCommand: true, + commandName: 'specific', + commandAgents: ['Universal'] + }); + + const commands = promptService.getCommands('SomeOtherAgent'); + expect(commands.length).to.equal(1); + expect(commands[0].id).to.equal('cmd-all'); + }); + + it('getCommands() returns empty array when no commands registered', () => { + promptService.addBuiltInPromptFragment({ + id: 'normal1', + template: 'Normal prompt 1' + }); + promptService.addBuiltInPromptFragment({ + id: 'normal2', + template: 'Normal prompt 2' + }); + + const commands = promptService.getCommands(); + expect(commands.length).to.equal(0); + }); + + it('command metadata preserved through registration', () => { + promptService.addBuiltInPromptFragment({ + id: 'test-cmd', + template: 'Test command', + isCommand: true, + commandName: 'test', + commandDescription: 'A test command', + commandArgumentHint: '', + commandAgents: ['Agent1', 'Agent2'] + }); + + const commands = promptService.getCommands(); + expect(commands.length).to.equal(1); + const cmd = commands[0]; + expect(cmd.isCommand).to.be.true; + expect(cmd.commandName).to.equal('test'); + expect(cmd.commandDescription).to.equal('A test command'); + expect(cmd.commandArgumentHint).to.equal(''); + expect(cmd.commandAgents).to.deep.equal(['Agent1', 'Agent2']); + }); + + it('getFragmentByCommandName finds fragment by command name', () => { + promptService.addBuiltInPromptFragment({ + id: 'sample-debug', + template: 'Help debug: $ARGUMENTS', + isCommand: true, + commandName: 'debug', + commandDescription: 'Debug an issue', + commandArgumentHint: '' + }); + + // Should find by command name + const fragment = promptService.getPromptFragmentByCommandName('debug'); + expect(fragment).to.not.be.undefined; + expect(fragment?.id).to.equal('sample-debug'); + expect(fragment?.commandName).to.equal('debug'); + expect(fragment?.template).to.equal('Help debug: $ARGUMENTS'); + }); + + it('getFragmentByCommandName returns undefined for non-command fragments', () => { + promptService.addBuiltInPromptFragment({ + id: 'normal-fragment', + template: 'Not a command' + }); + + const fragment = promptService.getPromptFragmentByCommandName('normal-fragment'); + expect(fragment).to.be.undefined; + }); + + it('getFragmentByCommandName returns undefined for non-existent command', () => { + const fragment = promptService.getPromptFragmentByCommandName('non-existent'); + expect(fragment).to.be.undefined; + }); + }); +}); diff --git a/packages/ai-core/src/common/prompt-service.ts b/packages/ai-core/src/common/prompt-service.ts new file mode 100644 index 0000000..303f395 --- /dev/null +++ b/packages/ai-core/src/common/prompt-service.ts @@ -0,0 +1,1158 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { Event, Emitter, URI, ILogger, DisposableCollection } from '@theia/core'; +import { inject, injectable, optional, postConstruct } from '@theia/core/shared/inversify'; +import { AIVariableArg, AIVariableContext, AIVariableService, createAIResolveVariableCache, ResolvedAIVariable } from './variable-service'; +import { ToolInvocationRegistry } from './tool-invocation-registry'; +import { toolRequestToPromptText } from './language-model-util'; +import { ToolRequest } from './language-model'; +import { matchFunctionsRegEx, matchVariablesRegEx } from './prompt-service-util'; +import { AISettingsService } from './settings-service'; + +export interface CommandPromptFragmentMetadata { + /** Mark this template as available as a slash command */ + isCommand?: boolean; + + /** Display name for the command (defaults to fragment id if not specified) */ + commandName?: string; + + /** Description shown in command autocomplete */ + commandDescription?: string; + + /** Hint for command arguments shown in autocomplete detail (e.g., "", "[options]") */ + commandArgumentHint?: string; + + /** List of agent IDs this command is available for (undefined means available for all agents) */ + commandAgents?: string[]; +} + +/** + * Represents a basic prompt fragment with an ID and template content. + */ +export interface BasePromptFragment extends CommandPromptFragmentMetadata { + /** Unique identifier for this prompt fragment */ + id: string; + + /** The template content, which may contain variables and function references */ + template: string; +} + +/** + * Represents a customized prompt fragment with an assigned customization ID and priority. + */ +export interface CustomizedPromptFragment extends BasePromptFragment { + /** + * Unique identifier for this customization + */ + customizationId: string; + + /** + * The order/priority of this customization, higher values indicate higher priority + * when multiple customizations exist for the same fragment + */ + priority: number; +} + +/** + * Union type representing either a built-in or customized prompt fragment + */ +export type PromptFragment = BasePromptFragment | CustomizedPromptFragment; + +/** + * Type guard to check if a PromptFragment is a built-in fragment (not customized) + * @param fragment The fragment to check + * @returns True if the fragment is a basic BasePromptFragment (not customized) + */ +export function isBasePromptFragment(fragment: PromptFragment): fragment is BasePromptFragment { + return !('customizationId' in fragment && 'priority' in fragment); +} + +/** + * Type guard to check if a PromptFragment is a CustomizedPromptFragment + * @param fragment The fragment to check + * @returns True if the fragment is a CustomizedPromptFragment + */ +export function isCustomizedPromptFragment(fragment: PromptFragment): fragment is CustomizedPromptFragment { + return 'customizationId' in fragment && 'priority' in fragment; +} + +/** + * Contains the effective variant ID and customization state for a prompt fragment + */ +export interface PromptVariantInfo { + /** The effective variant ID for the prompt fragment */ + variantId: string; + /** Whether this variant has been customized by the user */ + isCustomized: boolean; +} + +/** + * Map of prompt fragment IDs to prompt fragments + */ +export interface PromptMap { [id: string]: PromptFragment } + +/** + * Represents a prompt fragment with all variables and function references resolved + */ +export interface ResolvedPromptFragment { + /** The fragment ID */ + id: string; + + /** The resolved prompt text with variables and function requests being replaced */ + text: string; + + /** All functions referenced in the prompt fragment */ + functionDescriptions?: Map; + + /** All variables resolved in the prompt fragment */ + variables?: ResolvedAIVariable[]; +} + +/** + * Describes a custom agent with its properties + */ +export interface CustomAgentDescription { + /** Unique identifier for this agent */ + id: string; + + /** Display name for the agent */ + name: string; + + /** Description of the agent's purpose and capabilities */ + description: string; + + /** The prompt text for this agent */ + prompt: string; + + /** The default large language model to use with this agent */ + defaultLLM: string; +} + +export namespace CustomAgentDescription { + /** + * Type guard to check if an object is a CustomAgentDescription + */ + export function is(entry: unknown): entry is CustomAgentDescription { + // eslint-disable-next-line no-null/no-null + return typeof entry === 'object' && entry !== null + && 'id' in entry && typeof entry.id === 'string' + && 'name' in entry && typeof entry.name === 'string' + && 'description' in entry && typeof entry.description === 'string' + && 'prompt' in entry && typeof entry.prompt === 'string' + && 'defaultLLM' in entry && typeof entry.defaultLLM === 'string'; + } + + /** + * Compares two CustomAgentDescription objects for equality + */ + export function equals(a: CustomAgentDescription, b: CustomAgentDescription): boolean { + return a.id === b.id && a.name === b.name && a.description === b.description && a.prompt === b.prompt && a.defaultLLM === b.defaultLLM; + } +} + +/** + * Service responsible for customizing prompt fragments + */ +export const PromptFragmentCustomizationService = Symbol('PromptFragmentCustomizationService'); +export interface PromptFragmentCustomizationService { + /** + * Event fired when a prompt fragment is changed + */ + readonly onDidChangePromptFragmentCustomization: Event; + + /** + * Event fired when custom agents are modified + */ + readonly onDidChangeCustomAgents: Event; + + /** + * Checks if a prompt fragment has customizations + * @param fragmentId The prompt fragment ID + * @returns Whether the fragment has any customizations + */ + isPromptFragmentCustomized(fragmentId: string): boolean; + + /** + * Gets the active customized prompt fragment for a given ID + * @param fragmentId The prompt fragment ID + * @returns The active customized fragment or undefined if none exists + */ + getActivePromptFragmentCustomization(fragmentId: string): CustomizedPromptFragment | undefined; + + /** + * Gets all customizations for a prompt fragment ordered by priority + * @param fragmentId The prompt fragment ID + * @returns Array of customized fragments ordered by priority (highest first) + */ + getAllCustomizations(fragmentId: string): CustomizedPromptFragment[]; + + /** + * Gets the IDs of all prompt fragments that have customizations + * @returns Array of prompt fragment IDs + */ + getCustomizedPromptFragmentIds(): string[]; + + /** + * Creates a new customization for a prompt fragment + * @param fragmentId The fragment ID to customize + * @param defaultContent Optional default content for the customization + */ + createPromptFragmentCustomization(fragmentId: string, defaultContent?: string): Promise; + + /** + * Creates a customization based on a built-in fragment + * @param fragmentId The ID of the built-in fragment to customize + * @param defaultContent Optional default content for the customization + */ + createBuiltInPromptFragmentCustomization(fragmentId: string, defaultContent?: string): Promise; + + /** + * Edits a specific customization of a prompt fragment + * @param fragmentId The prompt fragment ID + * @param customizationId The customization ID to edit + */ + editPromptFragmentCustomization(fragmentId: string, customizationId: string): Promise; + + /** + * Edits the built-in customization of a prompt fragment + * @param fragmentId The prompt fragment ID to edit + * @param defaultContent Optional default content for the customization + */ + editBuiltInPromptFragmentCustomization(fragmentId: string, defaultContent?: string): Promise; + + /** + * Removes a specific customization of a prompt fragment + * @param fragmentId The prompt fragment ID + * @param customizationId The customization ID to remove + */ + removePromptFragmentCustomization(fragmentId: string, customizationId: string): Promise; + + /** + * Resets a fragment to its built-in version by removing all customizations + * @param fragmentId The fragment ID to reset + */ + removeAllPromptFragmentCustomizations(fragmentId: string): Promise; + + /** + * Resets to a specific customization by removing higher-priority customizations + * @param fragmentId The fragment ID + * @param customizationId The customization ID to reset to + */ + resetToCustomization(fragmentId: string, customizationId: string): Promise; + + /** + * Gets information about the description of a customization + * @param fragmentId The fragment ID + * @param customizationId The customization ID + * @returns Description of the customization + */ + getPromptFragmentCustomizationDescription(fragmentId: string, customizationId: string): Promise; + + /** + * Gets information about the source/type of a customization + * @param fragmentId The fragment ID + * @param customizationId The customization ID + * @returns Type of the customization source + */ + getPromptFragmentCustomizationType(fragmentId: string, customizationId: string): Promise; + + /** + * Gets the fragment ID from a resource identifier + * @param resourceId Resource identifier (implementation specific) + * @returns Fragment ID or undefined if not found + */ + getPromptFragmentIDFromResource(resourceId: unknown): string | undefined; + + /** + * Gets all custom agent descriptions + * @returns Array of custom agent descriptions + */ + getCustomAgents(): Promise; + + /** + * Gets the locations of custom agent configuration files + * @returns Array of URIs and existence status + */ + getCustomAgentsLocations(): Promise<{ uri: URI, exists: boolean }[]>; + + /** + * Opens an existing customAgents.yml file at the given URI, or creates a new one if it doesn't exist. + * + * @param uri The URI of the customAgents.yml file to open or create + */ + openCustomAgentYaml(uri: URI): Promise; +} + +/** + * Service for managing and resolving prompt fragments + */ +export const PromptService = Symbol('PromptService'); +export interface PromptService { + /** + * Event fired when the prompts change + */ + readonly onPromptsChange: Event; + + /** + * Event fired when the selected variant for a prompt variant set changes + */ + readonly onSelectedVariantChange: Event<{ promptVariantSetId: string, variantId: string | undefined }>; + + /** + * Gets the raw prompt fragment with comments + * @param fragmentId The prompt fragment ID + * @returns The raw prompt fragment or undefined if not found + */ + getRawPromptFragment(fragmentId: string): PromptFragment | undefined; + + /** + * Gets the raw prompt fragment without comments + * @param fragmentId The prompt fragment ID + * @returns The raw prompt fragment or undefined if not found + */ + getPromptFragment(fragmentId: string): PromptFragment | undefined; + + /** + * Gets the built-in raw prompt fragment (before any customizations) + * @param fragmentId The prompt fragment ID + * @returns The built-in fragment or undefined if not found + */ + getBuiltInRawPrompt(fragmentId: string): PromptFragment | undefined; + + /** + * Gets a prompt fragment by command name (for slash commands) + * @param commandName The command name to search for + * @returns The fragment with the matching command name or undefined if not found + */ + getPromptFragmentByCommandName(commandName: string): PromptFragment | undefined; + + /** + * Resolves a prompt fragment by replacing variables and function references + * @param fragmentId The prompt fragment ID + * @param args Optional object with values for variable replacement + * @param context Optional context for variable resolution + * @returns The resolved prompt fragment or undefined if not found + */ + getResolvedPromptFragment(fragmentId: string, args?: { [key: string]: unknown }, context?: AIVariableContext): Promise; + + /** + * Resolves a prompt fragment by replacing variables but preserving function references + * @param fragmentId The prompt fragment ID + * @param args Optional object with values for variable replacement + * @param context Optional context for variable resolution + * @param resolveVariable Optional custom variable resolution function + * @returns The partially resolved prompt fragment or undefined if not found + */ + getResolvedPromptFragmentWithoutFunctions( + fragmentId: string, + args?: { [key: string]: unknown }, + context?: AIVariableContext, + resolveVariable?: (variable: AIVariableArg) => Promise + ): Promise | undefined>; + + /** + * Adds a prompt fragment to the service + * @param promptFragment The fragment to store + * @param promptVariantSetId Optional ID of the prompt variant set this is a variant of + */ + addBuiltInPromptFragment(promptFragment: BasePromptFragment, promptVariantSetId?: string, isDefault?: boolean): void; + + /** + * Removes a prompt fragment from the service + * @param fragmentId The fragment ID to remove + */ + removePromptFragment(fragmentId: string): void; + + /** + * Gets all known prompts, including variants and customizations + * @returns Map of fragment IDs to arrays of fragments + */ + getAllPromptFragments(): Map; + + /** + * Gets all active prompts (highest priority version of each fragment) + * @returns Array of active prompt fragments + */ + getActivePromptFragments(): PromptFragment[]; + + /** + * Returns all IDs of all prompt fragments of the given set + * @param promptVariantSetId The prompt variant set id + * @returns Array of variant IDs + */ + getVariantIds(promptVariantSetId: string): string[]; + + /** + * Gets the explicitly selected variant ID for a prompt fragment from settings. + * This returns only the variant that was explicitly selected in settings, not the default. + * @param promptVariantSetId The prompt variant set id + * @returns The selected variant ID from settings, or undefined if none is selected + */ + getSelectedVariantId(promptVariantSetId: string): string | undefined; + + /** + * Gets the effective variant ID that is guaranteed to be valid if one exists. + * This checks if the selected variant ID is valid, and falls back to the default variant if it isn't. + * @param promptVariantSetId The prompt variant set id + * @returns A valid variant ID if one exists, or undefined if no valid variant can be found + */ + getEffectiveVariantId(promptVariantSetId: string): string | undefined; + + /** + * Gets the effective variant ID and customization state for a prompt fragment. + * This is a convenience method that combines getEffectiveVariantId and customization check. + * @param fragmentId The prompt fragment ID or variant set ID + * @returns The variant info or undefined if no valid variant exists + */ + getPromptVariantInfo(fragmentId: string): PromptVariantInfo | undefined; + + /** + * Gets the default variant ID of the given set + * @param promptVariantSetId The prompt variant set id + * @returns The default variant ID or undefined if no default is set + */ + getDefaultVariantId(promptVariantSetId: string): string | undefined; + + /** + * Updates the selected variant for a prompt variant set + * @param agentId The ID of the agent to update + * @param promptVariantSetId The prompt variant set ID + * @param newVariant The new variant ID to set as selected + */ + updateSelectedVariantId(agentId: string, promptVariantSetId: string, newVariant: string): Promise; + + /** + * Gets all prompt variant sets and their variants + * @returns Map of prompt variant set IDs to arrays of variant IDs + */ + getPromptVariantSets(): Map; + + /** + * Gets all prompt fragments marked as commands, optionally filtered by agent + * @param agentId Optional agent ID to filter commands (undefined returns commands for all agents) + * @returns Array of command prompt fragments + */ + getCommands(agentId?: string): PromptFragment[]; + + /** + * The following methods delegate to the PromptFragmentCustomizationService + */ + createCustomization(fragmentId: string): Promise; + createBuiltInCustomization(fragmentId: string): Promise; + editBuiltInCustomization(fragmentId: string): Promise; + editCustomization(fragmentId: string, customizationId: string): Promise; + removeCustomization(fragmentId: string, customizationId: string): Promise; + resetAllToBuiltIn(): Promise; + resetToBuiltIn(fragmentId: string): Promise; + resetToCustomization(fragmentId: string, customizationId: string): Promise; + getCustomizationDescription(fragmentId: string, customizationId: string): Promise; + getCustomizationType(fragmentId: string, customizationId: string): Promise; + getTemplateIDFromResource(resourceId: unknown): string | undefined; +} + +@injectable() +export class PromptServiceImpl implements PromptService { + @inject(ILogger) + protected readonly logger: ILogger; + + @inject(AISettingsService) @optional() + protected readonly settingsService: AISettingsService | undefined; + + @inject(PromptFragmentCustomizationService) @optional() + protected readonly customizationService: PromptFragmentCustomizationService | undefined; + + // Map to store selected variant for each prompt variant set (key: promptVariantSetId, value: variantId) + protected _selectedVariantsMap = new Map(); + + @inject(AIVariableService) @optional() + protected readonly variableService: AIVariableService | undefined; + + @inject(ToolInvocationRegistry) @optional() + protected readonly toolInvocationRegistry: ToolInvocationRegistry | undefined; + + // Collection of built-in prompt fragments + protected _builtInFragments: BasePromptFragment[] = []; + + // Map to store prompt variants sets (key: promptVariantSetId, value: array of variantIds) + protected _promptVariantSetsMap = new Map(); + + // Map to store default variant for each prompt variant set (key: promptVariantSetId, value: variantId) + protected _defaultVariantsMap = new Map(); + + // Event emitter for prompt changes + protected _onPromptsChangeEmitter = new Emitter(); + readonly onPromptsChange = this._onPromptsChangeEmitter.event; + + // Event emitter for selected variant changes + protected _onSelectedVariantChangeEmitter = new Emitter<{ promptVariantSetId: string, variantId: string | undefined }>(); + readonly onSelectedVariantChange = this._onSelectedVariantChangeEmitter.event; + + protected promptChangeDebounceTimer?: NodeJS.Timeout; + + protected toDispose = new DisposableCollection(); + + protected fireOnPromptsChangeDebounced(): void { + if (this.promptChangeDebounceTimer) { + clearTimeout(this.promptChangeDebounceTimer); + } + this.promptChangeDebounceTimer = setTimeout(() => { + this._onPromptsChangeEmitter.fire(); + }, 300); + } + + @postConstruct() + protected init(): void { + if (this.customizationService) { + this.toDispose.pushAll([ + this.customizationService.onDidChangePromptFragmentCustomization(() => { + this.fireOnPromptsChangeDebounced(); + }), + this.customizationService.onDidChangeCustomAgents(() => { + this.fireOnPromptsChangeDebounced(); + }) + ]); + } + if (this.settingsService) { + this.recalculateSelectedVariantsMap(); + this.toDispose.push( + this.settingsService!.onDidChange(async () => { + await this.recalculateSelectedVariantsMap(); + }) + ); + } + } + + /** + * Recalculates the selected variants map for all variant sets and fires the onSelectedVariantChangeEmitter + * if the selectedVariants field has changed. + */ + protected async recalculateSelectedVariantsMap(): Promise { + if (!this.settingsService) { + return; + } + const agentSettingsMap = await this.settingsService.getSettings(); + const newSelectedVariants = new Map(); + for (const agentSettings of Object.values(agentSettingsMap)) { + if (agentSettings.selectedVariants) { + for (const [variantSetId, variantId] of Object.entries(agentSettings.selectedVariants)) { + if (!newSelectedVariants.has(variantSetId)) { + newSelectedVariants.set(variantSetId, variantId); + } + } + } + } + // Compare with the old map and fire events for changes and removed variant sets + for (const [variantSetId, newVariantId] of newSelectedVariants.entries()) { + const oldVariantId = this._selectedVariantsMap.get(variantSetId); + if (oldVariantId !== newVariantId) { + this._onSelectedVariantChangeEmitter.fire({ promptVariantSetId: variantSetId, variantId: newVariantId }); + } + } + for (const oldVariantSetId of this._selectedVariantsMap.keys()) { + if (!newSelectedVariants.has(oldVariantSetId)) { + this._onSelectedVariantChangeEmitter.fire({ promptVariantSetId: oldVariantSetId, variantId: undefined }); + } + } + this._selectedVariantsMap = newSelectedVariants; + // Also fire a full prompts change, because other fields (like effectiveVariantId) might have changed + this.fireOnPromptsChangeDebounced(); + } + + // ===== Fragment Retrieval Methods ===== + + /** + * Finds a built-in fragment by its ID + * @param fragmentId The ID of the fragment to find + * @returns The built-in fragment or undefined if not found + */ + protected findBuiltInFragmentById(fragmentId: string): BasePromptFragment | undefined { + return this._builtInFragments.find(fragment => fragment.id === fragmentId); + } + + protected findBuiltInFragmentByName(fragmentName: string): BasePromptFragment | undefined { + return this._builtInFragments.find(fragment => fragment.commandName === fragmentName); + } + + getRawPromptFragment(fragmentId: string): PromptFragment | undefined { + if (this.customizationService?.isPromptFragmentCustomized(fragmentId)) { + const customizedFragment = this.customizationService.getActivePromptFragmentCustomization(fragmentId); + if (customizedFragment !== undefined) { + return customizedFragment; + } + } + return this.getBuiltInRawPrompt(fragmentId); + } + + getBuiltInRawPrompt(fragmentId: string): PromptFragment | undefined { + return this.findBuiltInFragmentById(fragmentId) ?? this.findBuiltInFragmentByName(fragmentId); + } + + getPromptFragment(fragmentId: string): PromptFragment | undefined { + const rawFragment = this.getRawPromptFragment(fragmentId); + if (!rawFragment) { + return undefined; + } + return { + ...rawFragment, + template: this.stripComments(rawFragment.template) + }; + } + + getPromptFragmentByCommandName(commandName: string): PromptFragment | undefined { + // First check customized fragments + if (this.customizationService) { + const customizedIds = this.customizationService.getCustomizedPromptFragmentIds(); + for (const fragmentId of customizedIds) { + const fragment = this.customizationService.getActivePromptFragmentCustomization(fragmentId); + if (fragment?.isCommand && fragment.commandName === commandName) { + return fragment; + } + } + } + + // Then check built-in fragments + return this._builtInFragments.find(fragment => + fragment.isCommand && fragment.commandName === commandName + ); + } + + /** + * Strips comments from a template string + * @param templateText The template text to process + * @returns Template text with comments removed + */ + protected stripComments(templateText: string): string { + const commentRegex = /^\s*{{!--[\s\S]*?--}}\s*\n?/; + return commentRegex.test(templateText) ? templateText.replace(commentRegex, '').trimStart() : templateText; + } + + getSelectedVariantId(variantSetId: string): string | undefined { + return this._selectedVariantsMap.get(variantSetId); + } + + getEffectiveVariantId(variantSetId: string): string | undefined { + const selectedVariantId = this.getSelectedVariantId(variantSetId); + + // Check if the selected variant actually exists + if (selectedVariantId) { + const variantIds = this.getVariantIds(variantSetId); + if (!variantIds.includes(selectedVariantId)) { + this.logger.warn(`Selected variant '${selectedVariantId}' for prompt set '${variantSetId}' does not exist. Falling back to default variant.`); + } else { + return selectedVariantId; + } + } + + // Fall back to default variant + const defaultVariantId = this.getDefaultVariantId(variantSetId); + if (defaultVariantId) { + const variantIds = this.getVariantIds(variantSetId); + if (!variantIds.includes(defaultVariantId)) { + this.logger.error(`Default variant '${defaultVariantId}' for prompt set '${variantSetId}' does not exist.`); + return undefined; + } + return defaultVariantId; + } + + // No valid selected or default variant + if (this.getVariantIds(variantSetId).length > 0) { + this.logger.error(`No valid selected or default variant found for prompt set '${variantSetId}'.`); + } + return undefined; + } + + getPromptVariantInfo(fragmentId: string): PromptVariantInfo | undefined { + const variantId = this.getEffectiveVariantId(fragmentId) ?? fragmentId; + const rawFragment = this.getRawPromptFragment(variantId); + if (!rawFragment) { + return undefined; + } + const isCustomized = isCustomizedPromptFragment(rawFragment); + return { variantId, isCustomized }; + } + + protected resolvePotentialSystemPrompt(promptFragmentId: string): PromptFragment | undefined { + if (this._promptVariantSetsMap.has(promptFragmentId)) { + // This is a systemPrompt find the effective variant + const effectiveVariantId = this.getEffectiveVariantId(promptFragmentId); + if (effectiveVariantId === undefined) { + return undefined; + } + return this.getPromptFragment(effectiveVariantId); + } + return this.getPromptFragment(promptFragmentId); + } + + // ===== Fragment Resolution Methods ===== + + async getResolvedPromptFragment(systemOrFragmentId: string, args?: { [key: string]: unknown }, context?: AIVariableContext): Promise { + const promptFragment = this.resolvePotentialSystemPrompt(systemOrFragmentId); + if (promptFragment === undefined) { + return undefined; + } + + // First resolve variables and arguments + let resolvedTemplate = promptFragment.template; + const variableAndArgResolutions = await this.resolveVariablesAndArgs(promptFragment.template, args, context); + variableAndArgResolutions.replacements.forEach(replacement => + resolvedTemplate = resolvedTemplate.replace(replacement.placeholder, replacement.value)); + + // Then resolve function references with already resolved variables and arguments + // This allows to resolve function references contained in resolved variables (e.g. prompt fragments) + const functionMatches = matchFunctionsRegEx(resolvedTemplate); + const functionMap = new Map(); + const functionReplacements = functionMatches.map(match => { + const completeText = match[0]; + const functionId = match[1]; + const toolRequest = this.toolInvocationRegistry?.getFunction(functionId); + if (toolRequest) { + functionMap.set(toolRequest.id, toolRequest); + } + return { + placeholder: completeText, + value: toolRequest ? toolRequestToPromptText(toolRequest) : completeText + }; + }); + functionReplacements.forEach(replacement => + resolvedTemplate = resolvedTemplate.replace(replacement.placeholder, replacement.value)); + + return { + id: systemOrFragmentId, + text: resolvedTemplate, + functionDescriptions: functionMap.size > 0 ? functionMap : undefined, + variables: variableAndArgResolutions.resolvedVariables + }; + } + + async getResolvedPromptFragmentWithoutFunctions( + systemOrFragmentId: string, + args?: { [key: string]: unknown }, + context?: AIVariableContext, + resolveVariable?: (variable: AIVariableArg) => Promise + ): Promise | undefined> { + const promptFragment = this.resolvePotentialSystemPrompt(systemOrFragmentId); + if (promptFragment === undefined) { + return undefined; + } + + const resolutions = await this.resolveVariablesAndArgs(promptFragment.template, args, context, resolveVariable); + let resolvedTemplate = promptFragment.template; + resolutions.replacements.forEach(replacement => + resolvedTemplate = resolvedTemplate.replace(replacement.placeholder, replacement.value)); + + return { + id: systemOrFragmentId, + text: resolvedTemplate, + variables: resolutions.resolvedVariables + }; + } + + /** + * Calculates all variable and argument replacements for an unresolved template. + * + * @param templateText the unresolved template text + * @param args the object with placeholders, mapping the placeholder key to the value + * @param context the {@link AIVariableContext} to use during variable resolution + * @param resolveVariable the variable resolving method. Fall back to using the {@link AIVariableService} if not given. + * @returns Object containing replacements and resolved variables + */ + protected async resolveVariablesAndArgs( + templateText: string, + args?: { [key: string]: unknown }, + context?: AIVariableContext, + resolveVariable?: (variable: AIVariableArg) => Promise + ): Promise<{ + replacements: { placeholder: string; value: string }[], + resolvedVariables: ResolvedAIVariable[] + }> { + const variableMatches = matchVariablesRegEx(templateText); + const variableCache = createAIResolveVariableCache(); + const replacementsList: { placeholder: string; value: string }[] = []; + const resolvedVariablesSet: Set = new Set(); + + for (const match of variableMatches) { + const placeholderText = match[0]; + const variableAndArg = match[1]; + let variableName = variableAndArg; + let argument: string | undefined; + + const parts = variableAndArg.split(':', 2); + if (parts.length > 1) { + variableName = parts[0]; + argument = parts[1]; + } + + let replacementValue: string; + if (args && args[variableAndArg] !== undefined) { + replacementValue = String(args[variableAndArg]); + } else { + const variableToResolve = { variable: variableName, arg: argument }; + const resolvedVariable = resolveVariable + ? await resolveVariable(variableToResolve) + : await this.variableService?.resolveVariable(variableToResolve, context ?? {}, variableCache); + + // Track resolved variable and its dependencies in all resolved variables + if (resolvedVariable) { + resolvedVariablesSet.add(resolvedVariable); + resolvedVariable.allResolvedDependencies?.forEach(v => resolvedVariablesSet.add(v)); + } + replacementValue = String(resolvedVariable?.value ?? placeholderText); + } + replacementsList.push({ placeholder: placeholderText, value: replacementValue }); + } + + return { + replacements: replacementsList, + resolvedVariables: Array.from(resolvedVariablesSet) + }; + } + + // ===== Fragment Collection Management Methods ===== + + getAllPromptFragments(): Map { + const fragmentsMap = new Map(); + + if (this.customizationService) { + const customizationIds = this.customizationService.getCustomizedPromptFragmentIds(); + customizationIds.forEach(fragmentId => { + const customizations = this.customizationService!.getAllCustomizations(fragmentId); + if (customizations.length > 0) { + fragmentsMap.set(fragmentId, customizations); + } + }); + } + + // Add all built-in fragments + for (const fragment of this._builtInFragments) { + if (fragmentsMap.has(fragment.id)) { + fragmentsMap.get(fragment.id)!.push(fragment); + } else { + fragmentsMap.set(fragment.id, [fragment]); + } + } + + return fragmentsMap; + } + + getActivePromptFragments(): PromptFragment[] { + const activeFragments: PromptFragment[] = [...this._builtInFragments]; + + if (this.customizationService) { + // Fetch all customized fragment IDs once + const customizedIds = this.customizationService.getCustomizedPromptFragmentIds(); + + // For each customized ID, get the active customization + for (const fragmentId of customizedIds) { + const customFragment = this.customizationService?.getActivePromptFragmentCustomization(fragmentId); + if (customFragment) { + // Find and replace existing entry with the same ID instead of just adding + const existingIndex = activeFragments.findIndex(fragment => fragment.id === fragmentId); + if (existingIndex !== -1) { + // Replace existing fragment + activeFragments[existingIndex] = customFragment; + } else { + // Add new fragment if no existing one found + activeFragments.push(customFragment); + } + } + } + } + return activeFragments; + } + + removePromptFragment(fragmentId: string): void { + const index = this._builtInFragments.findIndex(fragment => fragment.id === fragmentId); + if (index !== -1) { + this._builtInFragments.splice(index, 1); + } + + // Remove any variant references + for (const [promptVariantSetId, variants] of this._promptVariantSetsMap.entries()) { + if (variants.includes(fragmentId)) { + this.removeFragmentVariant(promptVariantSetId, fragmentId); + } + } + + // Clean up default variants map if needed + if (this._defaultVariantsMap.has(fragmentId)) { + this._defaultVariantsMap.delete(fragmentId); + } + + // Look for this fragmentId as a variant in default variants and remove if found + for (const [promptVariantSetId, defaultVariantId] of this._defaultVariantsMap.entries()) { + if (defaultVariantId === fragmentId) { + this._defaultVariantsMap.delete(promptVariantSetId); + } + } + + this.fireOnPromptsChangeDebounced(); + } + + getVariantIds(variantSetId: string): string[] { + const builtInVariants = this._promptVariantSetsMap.get(variantSetId) || []; + + // Check for custom variants from customization service + if (this.customizationService) { + const allCustomizedIds = this.customizationService.getCustomizedPromptFragmentIds(); + // Find customizations that start with the variant set ID + // These are considered variants of this variant set + // Only include IDs that are not the variant set ID itself, start with the variant set ID, + // and are not customizations of existing variants in this set + const customVariants = allCustomizedIds.filter(id => + id !== variantSetId && + id.startsWith(variantSetId) && + !builtInVariants.includes(id) + ); + + if (customVariants.length > 0) { + // Combine built-in variants with custom variants, without modifying the internal state + return [...builtInVariants, ...customVariants]; + } + } + + return builtInVariants; + } + + getDefaultVariantId(promptVariantSetId: string): string | undefined { + return this._defaultVariantsMap.get(promptVariantSetId); + } + + getPromptVariantSets(): Map { + const result = new Map(this._promptVariantSetsMap); + + // Check for custom variants from customization service + if (this.customizationService) { + const allCustomizedIds = this.customizationService.getCustomizedPromptFragmentIds(); + + // Add custom variants to existing variant sets + for (const [variantSetId, variants] of result.entries()) { + // Filter out customized fragments that are just customizations of existing variants + // so we don't treat them as separate variants themselves + // Only include IDs that are not the variant set ID itself, start with the variant set ID, + // and are not customizations of existing variants in this set + const customVariants = allCustomizedIds.filter(id => + id !== variantSetId && + id.startsWith(variantSetId) && + !variants.includes(id) + ); + + if (customVariants.length > 0) { + // Create a new array without modifying the original + result.set(variantSetId, [...variants, ...customVariants]); + } + } + } + return result; + } + + addBuiltInPromptFragment(promptFragment: BasePromptFragment, promptVariantSetId?: string, isDefault: boolean = false): void { + this.checkCommandUniqueness(promptFragment); + + const existingIndex = this._builtInFragments.findIndex(fragment => fragment.id === promptFragment.id); + if (existingIndex !== -1) { + // Replace existing fragment with the same ID + this._builtInFragments[existingIndex] = promptFragment; + } else { + // Add new fragment + this._builtInFragments.push(promptFragment); + } + + // If this is a variant of a prompt variant set, record it in the variants map + if (promptVariantSetId) { + this.addFragmentVariant(promptVariantSetId, promptFragment.id, isDefault); + } + + this.fireOnPromptsChangeDebounced(); + } + + protected checkCommandUniqueness(promptFragment: BasePromptFragment): void { + if (promptFragment.isCommand && promptFragment.commandName) { + const commandName = promptFragment.commandName; + const duplicates = this._builtInFragments.filter( + f => f.isCommand && f.commandName === commandName && ( + // undefined commandAgents means applicable to all agents + f.commandAgents === undefined || + promptFragment.commandAgents === undefined || + // Check for overlapping command agents + f.commandAgents.some(agent => promptFragment.commandAgents!.includes(agent)) + ) + ); + if (duplicates.length > 0) { + this.logger.warn( + `Command name '${commandName}' is used by multiple fragments: ${promptFragment.id} and ${duplicates.map(d => d.id).join(', ')}` + ); + } + } + } + + // ===== Variant Management Methods ===== + + /** + * Adds a variant ID to the fragment variants map + * @param promptVariantSetId The prompt variant set id + * @param variantId The variant ID to add + * @param isDefault Whether this variant should be the default for the prompt variant set (defaults to false) + */ + protected addFragmentVariant(promptVariantSetId: string, variantId: string, isDefault: boolean = false): void { + if (!this._promptVariantSetsMap.has(promptVariantSetId)) { + this._promptVariantSetsMap.set(promptVariantSetId, []); + } + + const variants = this._promptVariantSetsMap.get(promptVariantSetId)!; + if (!variants.includes(variantId)) { + variants.push(variantId); + } + + if (isDefault) { + this._defaultVariantsMap.set(promptVariantSetId, variantId); + } + } + + /** + * Removes a variant ID from the fragment variants map + * @param promptVariantSetId The prompt variant set id + * @param variantId The variant ID to remove + */ + protected removeFragmentVariant(promptVariantSetId: string, variantId: string): void { + if (!this._promptVariantSetsMap.has(promptVariantSetId)) { + return; + } + + const variants = this._promptVariantSetsMap.get(promptVariantSetId)!; + const index = variants.indexOf(variantId); + + if (index !== -1) { + variants.splice(index, 1); + + // Remove the key if no variants left + if (variants.length === 0) { + this._promptVariantSetsMap.delete(promptVariantSetId); + } + } + } + + async updateSelectedVariantId(agentId: string, promptVariantSetId: string, newVariant: string): Promise { + if (!this.settingsService) { + return; + } + + const defaultVariantId = this.getDefaultVariantId(promptVariantSetId); + const agentSettings = await this.settingsService.getAgentSettings(agentId); + const selectedVariants = agentSettings?.selectedVariants || {}; + + const updatedVariants = { ...selectedVariants }; + if (newVariant === defaultVariantId) { + delete updatedVariants[promptVariantSetId]; + } else { + updatedVariants[promptVariantSetId] = newVariant; + } + + await this.settingsService.updateAgentSettings(agentId, { + selectedVariants: updatedVariants, + }); + + // Emit the selected variant change event + this._onSelectedVariantChangeEmitter.fire({ promptVariantSetId, variantId: newVariant }); + } + + // ===== Customization Service Delegation Methods ===== + + async createCustomization(fragmentId: string): Promise { + if (this.customizationService) { + await this.customizationService.createPromptFragmentCustomization(fragmentId); + } + } + + async createBuiltInCustomization(fragmentId: string): Promise { + if (this.customizationService) { + const builtInTemplate = this.findBuiltInFragmentById(fragmentId); + await this.customizationService.createBuiltInPromptFragmentCustomization(fragmentId, builtInTemplate?.template); + } + } + + async editCustomization(fragmentId: string, customizationId: string): Promise { + if (this.customizationService) { + await this.customizationService.editPromptFragmentCustomization(fragmentId, customizationId); + } + } + + async removeCustomization(fragmentId: string, customizationId: string): Promise { + if (this.customizationService) { + await this.customizationService.removePromptFragmentCustomization(fragmentId, customizationId); + } + } + + async resetAllToBuiltIn(): Promise { + if (this.customizationService) { + for (const fragment of this._builtInFragments) { + await this.customizationService.removeAllPromptFragmentCustomizations(fragment.id); + } + } + } + + async resetToBuiltIn(fragmentId: string): Promise { + const builtIn = this._builtInFragments.find(b => b.id === fragmentId); + // Only reset this if it has a built-in, otherwise a delete would be the correct operation + if (this.customizationService && builtIn) { + await this.customizationService.removeAllPromptFragmentCustomizations(fragmentId); + } + } + + async resetToCustomization(fragmentId: string, customizationId: string): Promise { + if (this.customizationService) { + await this.customizationService.resetToCustomization(fragmentId, customizationId); + } + } + + async getCustomizationDescription(fragmentId: string, customizationId: string): Promise { + if (!this.customizationService) { + return undefined; + } + return await this.customizationService.getPromptFragmentCustomizationDescription(fragmentId, customizationId); + } + + async getCustomizationType(fragmentId: string, customizationId: string): Promise { + if (!this.customizationService) { + return undefined; + } + return await this.customizationService.getPromptFragmentCustomizationType(fragmentId, customizationId); + } + + getTemplateIDFromResource(resourceId: unknown): string | undefined { + if (this.customizationService) { + return this.customizationService.getPromptFragmentIDFromResource(resourceId); + } + return undefined; + } + + async editBuiltInCustomization(fragmentId: string): Promise { + if (this.customizationService) { + const builtInTemplate = this.findBuiltInFragmentById(fragmentId); + await this.customizationService.editBuiltInPromptFragmentCustomization(fragmentId, builtInTemplate?.template); + } + } + + getCommands(agentId?: string): PromptFragment[] { + const allCommands = this.getActivePromptFragments().filter(fragment => fragment.isCommand === true); + + if (!agentId) { + return allCommands; + } + + return allCommands.filter(fragment => !fragment.commandAgents || fragment.commandAgents.includes(agentId)); + } +} diff --git a/packages/ai-core/src/common/prompt-text.ts b/packages/ai-core/src/common/prompt-text.ts new file mode 100644 index 0000000..26ebd44 --- /dev/null +++ b/packages/ai-core/src/common/prompt-text.ts @@ -0,0 +1,23 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +export namespace PromptText { + export const AGENT_CHAR = '@'; + export const VARIABLE_CHAR = '#'; + export const FUNCTION_CHAR = '~'; + export const VARIABLE_SEPARATOR_CHAR = ':'; + export const COMMAND_CHAR = '/'; +} diff --git a/packages/ai-core/src/common/prompt-variable-contribution.spec.ts b/packages/ai-core/src/common/prompt-variable-contribution.spec.ts new file mode 100644 index 0000000..194f8f1 --- /dev/null +++ b/packages/ai-core/src/common/prompt-variable-contribution.spec.ts @@ -0,0 +1,236 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { enableJSDOM } from '@theia/core/lib/browser/test/jsdom'; + +let disableJSDOM = enableJSDOM(); + +import 'reflect-metadata'; + +import { expect } from 'chai'; +import * as sinon from 'sinon'; +import { Container } from 'inversify'; +import { CommandService, ILogger, Logger } from '@theia/core'; +import { PromptVariableContribution, PROMPT_VARIABLE } from './prompt-variable-contribution'; +import { PromptService, PromptServiceImpl } from './prompt-service'; +import { DefaultAIVariableService, AIVariableService } from './variable-service'; +import { MockLogger } from '@theia/core/lib/common/test/mock-logger'; + +disableJSDOM(); + +describe('PromptVariableContribution', () => { + before(() => disableJSDOM = enableJSDOM()); + after(() => disableJSDOM()); + let contribution: PromptVariableContribution; + let promptService: PromptService; + let container: Container; + + beforeEach(() => { + container = new Container(); + + // Set up PromptService + container.bind(PromptService).to(PromptServiceImpl).inSingletonScope(); + const logger = sinon.createStubInstance(Logger); + const variableService = new DefaultAIVariableService({ getContributions: () => [] }, logger); + container.bind(AIVariableService).toConstantValue(variableService); + container.bind(ILogger).toConstantValue(new MockLogger); + + // Set up CommandService stub (needed for PromptVariableContribution but not used in these tests) + const commandService = sinon.createStubInstance(Logger); // Using Logger as a simple mock + container.bind(CommandService).toConstantValue(commandService as unknown as CommandService); + + // Bind PromptVariableContribution with proper DI + container.bind(PromptVariableContribution).toSelf().inSingletonScope(); + + // Get instances + promptService = container.get(PromptService); + contribution = container.get(PromptVariableContribution); + }); + + describe('Command Argument Substitution', () => { + it('substitutes $ARGUMENTS with full argument string', async () => { + promptService.addBuiltInPromptFragment({ + id: 'test-cmd', + template: 'Process: $ARGUMENTS', + isCommand: true, + commandName: 'test' + }); + + const result = await contribution.resolve( + { variable: PROMPT_VARIABLE, arg: 'test-cmd|arg1 arg2 arg3' }, + {} + ); + + expect(result?.value).to.equal('Process: arg1 arg2 arg3'); + }); + + it('substitutes $0 with command name', async () => { + promptService.addBuiltInPromptFragment({ + id: 'test-cmd', + template: 'Command $0 was called', + isCommand: true, + commandName: 'test' + }); + + const result = await contribution.resolve( + { variable: PROMPT_VARIABLE, arg: 'test-cmd|args' }, + {} + ); + + expect(result?.value).to.equal('Command test-cmd was called'); + }); + + it('substitutes $1, $2, ... with individual arguments', async () => { + promptService.addBuiltInPromptFragment({ + id: 'compare-cmd', + template: 'Compare $1 with $2', + isCommand: true, + commandName: 'compare' + }); + + const result = await contribution.resolve( + { variable: PROMPT_VARIABLE, arg: 'compare-cmd|item1 item2' }, + {} + ); + + expect(result?.value).to.equal('Compare item1 with item2'); + }); + + it('handles quoted arguments in $1, $2', async () => { + promptService.addBuiltInPromptFragment({ + id: 'test-cmd', + template: 'First: $1, Second: $2', + isCommand: true, + commandName: 'test' + }); + + const result = await contribution.resolve( + { variable: PROMPT_VARIABLE, arg: 'test-cmd|"arg with spaces" other' }, + {} + ); + + expect(result?.value).to.equal('First: arg with spaces, Second: other'); + }); + + it('handles escaped quotes in arguments', async () => { + promptService.addBuiltInPromptFragment({ + id: 'test-cmd', + template: 'Arg: $1', + isCommand: true, + commandName: 'test' + }); + + const result = await contribution.resolve( + { variable: PROMPT_VARIABLE, arg: 'test-cmd|"value with \\"quote\\""' }, + {} + ); + + expect(result?.value).to.equal('Arg: value with "quote"'); + }); + + it('handles 10+ arguments correctly', async () => { + promptService.addBuiltInPromptFragment({ + id: 'test-cmd', + template: 'Args: $1 $10 $11', + isCommand: true, + commandName: 'test' + }); + + const result = await contribution.resolve( + { variable: PROMPT_VARIABLE, arg: 'test-cmd|a b c d e f g h i j k' }, + {} + ); + + expect(result?.value).to.equal('Args: a j k'); + }); + + it('handles command without arguments', async () => { + promptService.addBuiltInPromptFragment({ + id: 'hello-cmd', + template: 'Hello, world!', + isCommand: true, + commandName: 'hello' + }); + + const result = await contribution.resolve( + { variable: PROMPT_VARIABLE, arg: 'hello-cmd' }, + {} + ); + + expect(result?.value).to.equal('Hello, world!'); + }); + + it('handles non-command prompts without substitution', async () => { + promptService.addBuiltInPromptFragment({ + id: 'normal-prompt', + template: 'This has $1 and $ARGUMENTS but is not a command' + }); + + const result = await contribution.resolve( + { variable: PROMPT_VARIABLE, arg: 'normal-prompt' }, + {} + ); + + // No substitution should occur for non-commands + expect(result?.value).to.equal('This has $1 and $ARGUMENTS but is not a command'); + }); + + it('handles missing argument placeholders gracefully', async () => { + promptService.addBuiltInPromptFragment({ + id: 'test-cmd', + template: 'Args: $1 $2 $3', + isCommand: true, + commandName: 'test' + }); + + const result = await contribution.resolve( + { variable: PROMPT_VARIABLE, arg: 'test-cmd|only-one' }, + {} + ); + + // Missing arguments should remain as placeholders + expect(result?.value).to.equal('Args: only-one $2 $3'); + }); + }); + + describe('Command Resolution', () => { + it('resolves command fragments correctly', async () => { + promptService.addBuiltInPromptFragment({ + id: 'test-cmd', + template: 'Do something with $ARGUMENTS', + isCommand: true, + commandName: 'test' + }); + + const result = await contribution.resolve( + { variable: PROMPT_VARIABLE, arg: 'test-cmd|input' }, + {} + ); + + expect(result?.value).to.equal('Do something with input'); + expect(result?.variable).to.deep.equal(PROMPT_VARIABLE); + }); + + it('returns empty string for non-existent prompts', async () => { + const result = await contribution.resolve( + { variable: PROMPT_VARIABLE, arg: 'non-existent|args' }, + {} + ); + + expect(result?.value).to.equal(''); + }); + }); +}); diff --git a/packages/ai-core/src/common/prompt-variable-contribution.ts b/packages/ai-core/src/common/prompt-variable-contribution.ts new file mode 100644 index 0000000..1abfbed --- /dev/null +++ b/packages/ai-core/src/common/prompt-variable-contribution.ts @@ -0,0 +1,246 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** +import { CommandService, ILogger, nls } from '@theia/core'; +import { injectable, inject } from '@theia/core/shared/inversify'; +import * as monaco from '@theia/monaco-editor-core'; +import { + AIVariable, + AIVariableContribution, + AIVariableService, + AIVariableResolutionRequest, + AIVariableContext, + ResolvedAIVariable, + AIVariableResolverWithVariableDependencies, + AIVariableArg +} from './variable-service'; +import { isCustomizedPromptFragment, PromptService } from './prompt-service'; +import { PromptText } from './prompt-text'; + +export const PROMPT_VARIABLE: AIVariable = { + id: 'prompt-provider', + description: nls.localize('theia/ai/core/promptVariable/description', 'Resolves prompt templates via the prompt service'), + name: 'prompt', + args: [ + { name: 'id', description: nls.localize('theia/ai/core/promptVariable/argDescription', 'The prompt template id to resolve') } + ] +}; + +@injectable() +export class PromptVariableContribution implements AIVariableContribution, AIVariableResolverWithVariableDependencies { + + @inject(CommandService) + protected readonly commandService: CommandService; + + @inject(PromptService) + protected readonly promptService: PromptService; + + @inject(ILogger) + protected logger: ILogger; + + registerVariables(service: AIVariableService): void { + service.registerResolver(PROMPT_VARIABLE, this); + service.registerArgumentPicker(PROMPT_VARIABLE, this.triggerArgumentPicker.bind(this)); + service.registerArgumentCompletionProvider(PROMPT_VARIABLE, this.provideArgumentCompletionItems.bind(this)); + } + + canResolve(request: AIVariableResolutionRequest, context: AIVariableContext): number { + if (request.variable.name === PROMPT_VARIABLE.name) { + return 1; + } + return -1; + } + + async resolve( + request: AIVariableResolutionRequest, + context: AIVariableContext, + resolveDependency?: (variable: AIVariableArg) => Promise + ): Promise { + if (request.variable.name === PROMPT_VARIABLE.name) { + const arg = request.arg?.trim(); + if (arg) { + // Check if this is a command-style reference (contains | separator) + const pipeIndex = arg.indexOf('|'); + const promptIdOrCommandName = pipeIndex >= 0 ? arg.substring(0, pipeIndex) : arg; + const commandArgs = pipeIndex >= 0 ? arg.substring(pipeIndex + 1) : ''; + + // Determine the actual fragment ID + // If this is a command invocation (has args), try to find by command name first + let fragment = commandArgs + ? this.promptService.getPromptFragmentByCommandName(promptIdOrCommandName) + : undefined; + + // Fall back to looking up by fragment ID if not found by command name + if (!fragment) { + fragment = this.promptService.getRawPromptFragment(promptIdOrCommandName); + } + + // If we still don't have a fragment, we can't resolve + if (!fragment) { + this.logger.debug(`Could not find prompt fragment or command '${promptIdOrCommandName}'`); + return { + variable: request.variable, + value: '', + allResolvedDependencies: [] + }; + } + + const fragmentId = fragment.id; + + // Resolve the prompt fragment normally (this handles {{variables}} and ~{functions}) + const resolvedPrompt = await this.promptService.getResolvedPromptFragmentWithoutFunctions( + fragmentId, + undefined, + context, + resolveDependency + ); + + if (resolvedPrompt) { + // If command args were provided, substitute them in the resolved text + // This happens AFTER variable/function resolution, so $ARGUMENTS can be part of the template + // alongside {{variables}} which get resolved first + const isCommand = fragment?.isCommand === true; + const finalText = isCommand && commandArgs + ? this.substituteCommandArguments(resolvedPrompt.text, promptIdOrCommandName, commandArgs) + : resolvedPrompt.text; + + return { + variable: request.variable, + value: finalText, + allResolvedDependencies: resolvedPrompt.variables + }; + } + } + } + this.logger.debug(`Could not resolve prompt variable '${request.variable.name}' with arg '${request.arg}'. Returning empty string.`); + return { + variable: request.variable, + value: '', + allResolvedDependencies: [] + }; + } + + private substituteCommandArguments(template: string, commandName: string, commandArgs: string): string { + // Parse arguments (respecting quotes) + const args = this.parseCommandArguments(commandArgs); + + // Substitute $ARGUMENTS with full arg string + let result = template.replace(/\$ARGUMENTS/g, commandArgs); + + // Substitute $0 with command name + result = result.replace(/\$0/g, commandName); + + // Substitute numbered arguments in reverse order to avoid collision + // (e.g., $10 before $1 to prevent $1 from matching the "1" in "$10") + for (let i = args.length; i > 0; i--) { + const regex = new RegExp(`\\$${i}\\b`, 'g'); + result = result.replace(regex, args[i - 1]); + } + + return result; + } + + private parseCommandArguments(commandArgs: string): string[] { + const args: string[] = []; + let current = ''; + let inQuotes = false; + let quoteChar = ''; + + for (let i = 0; i < commandArgs.length; i++) { + const char = commandArgs[i]; + + // Handle escape sequences within quotes + if (char === '\\' && i + 1 < commandArgs.length && inQuotes) { + const nextChar = commandArgs[i + 1]; + if (nextChar === '"' || nextChar === "'" || nextChar === '\\') { + current += nextChar; + i++; // Skip the next character + continue; + } + } + + if ((char === '"' || char === "'") && !inQuotes) { + inQuotes = true; + quoteChar = char; + } else if (char === quoteChar && inQuotes) { + inQuotes = false; + quoteChar = ''; + } else if (char === ' ' && !inQuotes) { + if (current.trim()) { + args.push(current.trim()); + current = ''; + } + } else { + current += char; + } + } + + if (current.trim()) { + args.push(current.trim()); + } + + return args; + } + + protected async triggerArgumentPicker(): Promise { + // Trigger the suggestion command to show argument completions + this.commandService.executeCommand('editor.action.triggerSuggest'); + // Return undefined because we don't actually pick the argument here. + // The argument is selected and inserted by the monaco editor's completion mechanism. + return undefined; + } + + protected async provideArgumentCompletionItems( + model: monaco.editor.ITextModel, + position: monaco.Position + ): Promise { + const lineContent = model.getLineContent(position.lineNumber); + + // Only provide completions once the variable argument separator is typed + const triggerCharIndex = lineContent.lastIndexOf(PromptText.VARIABLE_SEPARATOR_CHAR, position.column - 1); + if (triggerCharIndex === -1) { + return undefined; + } + + // Check if the text immediately before the trigger is the prompt variable, i.e #prompt + const requiredVariable = `${PromptText.VARIABLE_CHAR}${PROMPT_VARIABLE.name}`; + if (triggerCharIndex < requiredVariable.length || + lineContent.substring(triggerCharIndex - requiredVariable.length, triggerCharIndex) !== requiredVariable) { + return undefined; + } + + const range = new monaco.Range(position.lineNumber, triggerCharIndex + 2, position.lineNumber, position.column); + + const activePrompts = this.promptService.getActivePromptFragments(); + let builtinPromptCompletions: monaco.languages.CompletionItem[] | undefined = undefined; + + if (activePrompts.length > 0) { + builtinPromptCompletions = []; + activePrompts.forEach(prompt => (builtinPromptCompletions!.push( + { + label: prompt.id, + kind: isCustomizedPromptFragment(prompt) ? monaco.languages.CompletionItemKind.Enum : monaco.languages.CompletionItemKind.Variable, + insertText: prompt.id, + range, + detail: isCustomizedPromptFragment(prompt) ? + nls.localize('theia/ai/core/promptVariable/completions/detail/custom', 'Customized prompt fragment') : + nls.localize('theia/ai/core/promptVariable/completions/detail/builtin', 'Built-in prompt fragment'), + sortText: `${prompt.id}` + }))); + } + + return builtinPromptCompletions; + } +} diff --git a/packages/ai-core/src/common/protocol.ts b/packages/ai-core/src/common/protocol.ts new file mode 100644 index 0000000..a63ebd5 --- /dev/null +++ b/packages/ai-core/src/common/protocol.ts @@ -0,0 +1,45 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { Event } from '@theia/core'; +import { LanguageModelMetaData } from './language-model'; +import { TokenUsage } from './token-usage-service'; + +export const LanguageModelRegistryClient = Symbol('LanguageModelRegistryClient'); +export interface LanguageModelRegistryClient { + languageModelAdded(metadata: LanguageModelMetaData): void; + languageModelRemoved(id: string): void; + /** + * Notify the client that a language model was updated. + */ + onLanguageModelUpdated(id: string): void; +} + +export const TOKEN_USAGE_SERVICE_PATH = '/services/token-usage'; + +export const TokenUsageServiceClient = Symbol('TokenUsageServiceClient'); + +export interface TokenUsageServiceClient { + /** + * Notify the client about new token usage + */ + notifyTokenUsage(usage: TokenUsage): void; + + /** + * An event that is fired when token usage data is updated. + */ + readonly onTokenUsageUpdated: Event; +} diff --git a/packages/ai-core/src/common/settings-service.ts b/packages/ai-core/src/common/settings-service.ts new file mode 100644 index 0000000..f9161d5 --- /dev/null +++ b/packages/ai-core/src/common/settings-service.ts @@ -0,0 +1,44 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** +import { Event } from '@theia/core'; +import { LanguageModelRequirement } from './language-model'; +import { NotificationType } from './notification-types'; + +export const AISettingsService = Symbol('AISettingsService'); +/** + * Service to store and retrieve settings on a per-agent basis. + */ +export interface AISettingsService { + updateAgentSettings(agent: string, agentSettings: Partial): Promise; + getAgentSettings(agent: string): Promise; + getSettings(): Promise; + onDidChange: Event; +} +export type AISettings = Record; +export interface AgentSettings { + languageModelRequirements?: LanguageModelRequirement[]; + enable?: boolean; + /** + * A mapping of main template IDs to their selected variant IDs. + * If a main template is not present in this mapping, it means the main template is used. + */ + selectedVariants?: Record; + /** + * Configuration for completion notifications when the agent finishes a task. + * If undefined, defaults to 'off'. + */ + completionNotification?: NotificationType; +} diff --git a/packages/ai-core/src/common/skill.spec.ts b/packages/ai-core/src/common/skill.spec.ts new file mode 100644 index 0000000..0565b3f --- /dev/null +++ b/packages/ai-core/src/common/skill.spec.ts @@ -0,0 +1,222 @@ +// ***************************************************************************** +// Copyright (C) 2026 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { expect } from 'chai'; +import { + SKILL_FILE_NAME, + SkillDescription, + isValidSkillName, + validateSkillDescription +} from './skill'; + +describe('Skill Types', () => { + + describe('SKILL_FILE_NAME', () => { + it('should be SKILL.md', () => { + expect(SKILL_FILE_NAME).to.equal('SKILL.md'); + }); + }); + + describe('isValidSkillName', () => { + it('should accept simple lowercase names', () => { + expect(isValidSkillName('skill')).to.be.true; + }); + + it('should accept kebab-case names', () => { + expect(isValidSkillName('my-skill')).to.be.true; + }); + + it('should accept names with digits', () => { + expect(isValidSkillName('skill1')).to.be.true; + expect(isValidSkillName('my-skill-2')).to.be.true; + expect(isValidSkillName('1skill')).to.be.true; + }); + + it('should accept multi-part kebab-case names', () => { + expect(isValidSkillName('my-awesome-skill')).to.be.true; + }); + + it('should reject uppercase letters', () => { + expect(isValidSkillName('MySkill')).to.be.false; + expect(isValidSkillName('SKILL')).to.be.false; + }); + + it('should reject leading hyphens', () => { + expect(isValidSkillName('-skill')).to.be.false; + }); + + it('should reject trailing hyphens', () => { + expect(isValidSkillName('skill-')).to.be.false; + }); + + it('should reject consecutive hyphens', () => { + expect(isValidSkillName('my--skill')).to.be.false; + }); + + it('should reject spaces', () => { + expect(isValidSkillName('my skill')).to.be.false; + }); + + it('should reject underscores', () => { + expect(isValidSkillName('my_skill')).to.be.false; + }); + + it('should reject empty strings', () => { + expect(isValidSkillName('')).to.be.false; + }); + }); + + describe('SkillDescription.is', () => { + it('should return true for valid SkillDescription', () => { + const valid: SkillDescription = { + name: 'my-skill', + description: 'A test skill' + }; + expect(SkillDescription.is(valid)).to.be.true; + }); + + it('should return true for SkillDescription with optional fields', () => { + const valid: SkillDescription = { + name: 'my-skill', + description: 'A test skill', + license: 'MIT', + compatibility: '>=1.0.0', + metadata: { author: 'Test' }, + allowedTools: ['tool1', 'tool2'] + }; + expect(SkillDescription.is(valid)).to.be.true; + }); + + it('should return false for undefined', () => { + expect(SkillDescription.is(undefined)).to.be.false; + }); + + it('should return false for null', () => { + // eslint-disable-next-line no-null/no-null + expect(SkillDescription.is(null)).to.be.false; + }); + + it('should return false for non-objects', () => { + expect(SkillDescription.is('string')).to.be.false; + expect(SkillDescription.is(123)).to.be.false; + expect(SkillDescription.is(true)).to.be.false; + }); + + it('should return false when name is missing', () => { + expect(SkillDescription.is({ description: 'A skill' })).to.be.false; + }); + + it('should return false when description is missing', () => { + expect(SkillDescription.is({ name: 'my-skill' })).to.be.false; + }); + + it('should return false when name is not a string', () => { + expect(SkillDescription.is({ name: 123, description: 'A skill' })).to.be.false; + }); + + it('should return false when description is not a string', () => { + expect(SkillDescription.is({ name: 'my-skill', description: 123 })).to.be.false; + }); + }); + + describe('SkillDescription.equals', () => { + it('should return true for equal names', () => { + const a: SkillDescription = { name: 'skill', description: 'Description A' }; + const b: SkillDescription = { name: 'skill', description: 'Description B' }; + expect(SkillDescription.equals(a, b)).to.be.true; + }); + + it('should return false for different names', () => { + const a: SkillDescription = { name: 'skill-a', description: 'Same description' }; + const b: SkillDescription = { name: 'skill-b', description: 'Same description' }; + expect(SkillDescription.equals(a, b)).to.be.false; + }); + }); + + describe('validateSkillDescription', () => { + it('should return empty array for valid skill description', () => { + const description: SkillDescription = { + name: 'my-skill', + description: 'A valid skill description' + }; + const errors = validateSkillDescription(description, 'my-skill'); + expect(errors).to.be.empty; + }); + + it('should return error when name does not match directory name', () => { + const description: SkillDescription = { + name: 'my-skill', + description: 'A skill' + }; + const errors = validateSkillDescription(description, 'other-directory'); + expect(errors).to.include("Skill name 'my-skill' must match directory name 'other-directory'. Skipping skill."); + }); + + it('should return error for invalid name format', () => { + const description: SkillDescription = { + name: 'My-Skill', + description: 'A skill' + }; + const errors = validateSkillDescription(description, 'My-Skill'); + expect(errors.some(e => e.includes('must be lowercase kebab-case'))).to.be.true; + }); + + it('should return error when description exceeds maximum length', () => { + const description: SkillDescription = { + name: 'my-skill', + description: 'x'.repeat(1025) + }; + const errors = validateSkillDescription(description, 'my-skill'); + expect(errors.some(e => e.includes('exceeds maximum length'))).to.be.true; + }); + + it('should return error when name is not a string', () => { + const description = { + name: 123, + description: 'A skill' + } as unknown as SkillDescription; + const errors = validateSkillDescription(description, 'my-skill'); + expect(errors).to.include('Skill name must be a string'); + }); + + it('should return error when description is not a string', () => { + const description = { + name: 'my-skill', + description: 123 + } as unknown as SkillDescription; + const errors = validateSkillDescription(description, 'my-skill'); + expect(errors).to.include('Skill description must be a string'); + }); + + it('should return multiple errors when multiple validations fail', () => { + const description: SkillDescription = { + name: 'Invalid_Name', + description: 'x'.repeat(1025) + }; + const errors = validateSkillDescription(description, 'wrong-dir'); + expect(errors.length).to.be.greaterThan(1); + }); + + it('should accept description at exactly maximum length', () => { + const description: SkillDescription = { + name: 'my-skill', + description: 'x'.repeat(1024) + }; + const errors = validateSkillDescription(description, 'my-skill'); + expect(errors).to.be.empty; + }); + }); +}); diff --git a/packages/ai-core/src/common/skill.ts b/packages/ai-core/src/common/skill.ts new file mode 100644 index 0000000..822e342 --- /dev/null +++ b/packages/ai-core/src/common/skill.ts @@ -0,0 +1,190 @@ +// ***************************************************************************** +// Copyright (C) 2026 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { load } from 'js-yaml'; + +/** + * The standard filename for skill definition files. + */ +export const SKILL_FILE_NAME = 'SKILL.md'; + +/** + * Regular expression for valid skill names. + * Must be lowercase kebab-case with digits allowed. + * Examples: 'my-skill', 'skill1', 'my-skill-2' + */ +const SKILL_NAME_REGEX = /^[a-z0-9]+(-[a-z0-9]+)*$/; + +/** + * Maximum allowed length for skill descriptions. + */ +const MAX_DESCRIPTION_LENGTH = 1024; + +/** + * Represents the YAML frontmatter metadata from a SKILL.md file. + */ +export interface SkillDescription { + /** Unique identifier, must match directory name, lowercase kebab-case with digits allowed */ + name: string; + + /** Human-readable description of the skill, max 1024 characters */ + description: string; + + /** Optional SPDX license identifier */ + license?: string; + + /** Optional version constraint for compatibility */ + compatibility?: string; + + /** Optional key-value pairs for additional metadata */ + metadata?: Record; + + /** Optional experimental feature: list of allowed tool IDs */ + allowedTools?: string[]; +} + +export namespace SkillDescription { + /** + * Type guard to check if an unknown value is a valid SkillDescription. + * Validates that required fields exist and have correct types. + */ + export function is(entry: unknown): entry is SkillDescription { + if (typeof entry !== 'object' || entry === undefined) { + return false; + } + // eslint-disable-next-line no-null/no-null + if (entry === null) { + return false; + } + const obj = entry as Record; + return typeof obj.name === 'string' && typeof obj.description === 'string'; + } + + /** + * Compares two SkillDescription objects for equality based on name. + */ + export function equals(a: SkillDescription, b: SkillDescription): boolean { + return a.name === b.name; + } +} + +/** + * Full skill representation including location. + */ +export interface Skill extends SkillDescription { + /** Absolute file path to the SKILL.md file */ + location: string; +} + +/** + * Validates if a skill name follows the required format. + * Valid names are lowercase kebab-case with digits allowed. + * No leading/trailing/consecutive hyphens. + * + * @param name The skill name to validate + * @returns true if the name is valid, false otherwise + */ +export function isValidSkillName(name: string): boolean { + return SKILL_NAME_REGEX.test(name); +} + +/** + * Validates a SkillDescription against all constraints. + * + * @param description The skill description to validate + * @param directoryName The name of the directory containing the SKILL.md file + * @returns Array of validation error messages, empty if valid + */ +export function validateSkillDescription(description: SkillDescription, directoryName: string): string[] { + const errors: string[] = []; + + if (typeof description.name !== 'string') { + errors.push('Skill name must be a string'); + } else { + if (description.name !== directoryName) { + errors.push(`Skill name '${description.name}' must match directory name '${directoryName}'. Skipping skill.`); + } + if (!isValidSkillName(description.name)) { + errors.push(`Skill name '${description.name}' must be lowercase kebab-case (e.g., 'my-skill', 'skill1')`); + } + } + + if (typeof description.description !== 'string') { + errors.push('Skill description must be a string'); + } else if (description.description.length > MAX_DESCRIPTION_LENGTH) { + errors.push(`Skill description exceeds maximum length of ${MAX_DESCRIPTION_LENGTH} characters`); + } + + return errors; +} + +/** + * Parses a SKILL.md file content, extracting YAML frontmatter metadata and markdown content. + * @param content The raw file content + * @returns Object with parsed metadata (if valid) and the markdown content + */ +export function parseSkillFile(content: string): { metadata: SkillDescription | undefined, content: string } { + const frontMatterRegex = /^---\s*\n([\s\S]*?)\n---\s*\n([\s\S]*)$/; + const match = content.match(frontMatterRegex); + + if (!match) { + return { metadata: undefined, content }; + } + + try { + const yamlContent = match[1]; + const markdownContent = match[2].trim(); + const parsedYaml = load(yamlContent); + + if (!parsedYaml || typeof parsedYaml !== 'object') { + return { metadata: undefined, content }; + } + + // Validate that required fields are present (name and description) + if (!SkillDescription.is(parsedYaml)) { + return { metadata: undefined, content }; + } + + return { metadata: parsedYaml, content: markdownContent }; + } catch { + return { metadata: undefined, content }; + } +} + +/** + * Combines skill directories with proper priority ordering. + * Workspace directory has highest priority, followed by configured directories, then default. + * First directory wins on duplicates. + */ +export function combineSkillDirectories( + workspaceSkillsDir: string | undefined, + configuredDirectories: string[], + defaultSkillsDir: string | undefined +): string[] { + const allDirectories: string[] = []; + if (workspaceSkillsDir) { + allDirectories.push(workspaceSkillsDir); + } + for (const dir of configuredDirectories) { + if (!allDirectories.includes(dir)) { + allDirectories.push(dir); + } + } + if (defaultSkillsDir && !allDirectories.includes(defaultSkillsDir)) { + allDirectories.push(defaultSkillsDir); + } + return allDirectories; +} diff --git a/packages/ai-core/src/common/today-variable-contribution.ts b/packages/ai-core/src/common/today-variable-contribution.ts new file mode 100644 index 0000000..e2530c4 --- /dev/null +++ b/packages/ai-core/src/common/today-variable-contribution.ts @@ -0,0 +1,71 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** +import { MaybePromise, nls } from '@theia/core'; +import { injectable } from '@theia/core/shared/inversify'; +import { AIVariable, ResolvedAIVariable, AIVariableContribution, AIVariableResolver, AIVariableService, AIVariableResolutionRequest, AIVariableContext } from './variable-service'; + +export namespace TodayVariableArgs { + export const IN_UNIX_SECONDS = 'inUnixSeconds'; + export const IN_ISO_8601 = 'inIso8601'; +} + +export const TODAY_VARIABLE: AIVariable = { + id: 'today-provider', + description: nls.localize('theia/ai/core/todayVariable/description', 'Does something for today'), + name: 'today', + args: [ + { + name: 'Format', + description: nls.localize('theia/ai/core/todayVariable/format/description', 'The format of the date'), + enum: [TodayVariableArgs.IN_ISO_8601, TodayVariableArgs.IN_UNIX_SECONDS], + isOptional: true + } + ] +}; + +export interface ResolvedTodayVariable extends ResolvedAIVariable { + date: Date; +} + +@injectable() +export class TodayVariableContribution implements AIVariableContribution, AIVariableResolver { + registerVariables(service: AIVariableService): void { + service.registerResolver(TODAY_VARIABLE, this); + } + + canResolve(request: AIVariableResolutionRequest, context: AIVariableContext): MaybePromise { + return 1; + } + + async resolve(request: AIVariableResolutionRequest, context: AIVariableContext): Promise { + if (request.variable.name === TODAY_VARIABLE.name) { + return this.resolveTodayVariable(request); + } + return undefined; + } + + private resolveTodayVariable(request: AIVariableResolutionRequest): ResolvedTodayVariable { + const date = new Date(); + if (request.arg === TodayVariableArgs.IN_ISO_8601) { + return { variable: request.variable, value: date.toISOString(), date }; + } + if (request.arg === TodayVariableArgs.IN_UNIX_SECONDS) { + return { variable: request.variable, value: Math.round(date.getTime() / 1000).toString(), date }; + } + return { variable: request.variable, value: date.toDateString(), date }; + } +} + diff --git a/packages/ai-core/src/common/token-usage-service.ts b/packages/ai-core/src/common/token-usage-service.ts new file mode 100644 index 0000000..5c8b721 --- /dev/null +++ b/packages/ai-core/src/common/token-usage-service.ts @@ -0,0 +1,64 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { TokenUsageServiceClient } from './protocol'; + +export const TokenUsageService = Symbol('TokenUsageService'); + +export interface TokenUsage { + /** The input token count */ + inputTokens: number; + /** The output token count */ + outputTokens: number; + /** Input tokens written to cache */ + cachedInputTokens?: number; + /** Input tokens read from cache */ + readCachedInputTokens?: number; + /** The model identifier */ + model: string; + /** The timestamp of when the tokens were used */ + timestamp: Date; + /** Request identifier */ + requestId: string; +} + +export interface TokenUsageParams { + /** The input token count */ + inputTokens: number; + /** The output token count */ + outputTokens: number; + /** Input tokens placed in cache */ + cachedInputTokens?: number; + /** Input tokens read from cache */ + readCachedInputTokens?: number; + /** Request identifier */ + requestId: string; +} + +export interface TokenUsageService { + /** + * Records token usage for a model interaction. + * + * @param model The identifier of the model that was used + * @param params Object containing token usage information + * @returns A promise that resolves when the token usage has been recorded + */ + recordTokenUsage(model: string, params: TokenUsageParams): Promise; + + getTokenUsages(): Promise; + + setClient(tokenUsageClient: TokenUsageServiceClient): void; +} diff --git a/packages/ai-core/src/common/tool-invocation-registry.ts b/packages/ai-core/src/common/tool-invocation-registry.ts new file mode 100644 index 0000000..34dc6e4 --- /dev/null +++ b/packages/ai-core/src/common/tool-invocation-registry.ts @@ -0,0 +1,148 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { inject, injectable, named, postConstruct, interfaces } from '@theia/core/shared/inversify'; +import { ToolRequest } from './language-model'; +import { ContributionProvider, Emitter, Event } from '@theia/core'; + +export const ToolInvocationRegistry = Symbol('ToolInvocationRegistry'); + +/** + * Registry for all the function calls available to Agents. + */ +export interface ToolInvocationRegistry { + /** + * Registers a tool into the registry. + * + * @param tool - The `ToolRequest` object representing the tool to be registered. + */ + registerTool(tool: ToolRequest): void; + + /** + * Retrieves a specific `ToolRequest` from the registry. + * + * @param toolId - The unique identifier of the tool to retrieve. + * @returns The `ToolRequest` object corresponding to the provided tool ID, + * or `undefined` if the tool is not found in the registry. + */ + getFunction(toolId: string): ToolRequest | undefined; + + /** + * Retrieves multiple `ToolRequest`s from the registry. + * + * @param toolIds - A list of tool IDs to retrieve. + * @returns An array of `ToolRequest` objects for the specified tool IDs. + * If a tool ID is not found, it is skipped in the returned array. + */ + getFunctions(...toolIds: string[]): ToolRequest[]; + + /** + * Retrieves all `ToolRequest`s currently registered in the registry. + * + * @returns An array of all `ToolRequest` objects in the registry. + */ + getAllFunctions(): ToolRequest[]; + + /** + * Unregisters all tools provided by a specific tool provider. + * + * @param providerName - The name of the tool provider whose tools should be removed (as specificed in the `ToolRequest`). + */ + unregisterAllTools(providerName: string): void; + + /** + * Event that is fired whenever the registry changes (tool registered or unregistered). + */ + onDidChange: Event; +} + +export const ToolProvider = Symbol('ToolProvider'); +export interface ToolProvider { + getTool(): ToolRequest; +} + +/** Binds the identifier to self in singleton scope and then binds `ToolProvider` to that service. */ +export function bindToolProvider(identifier: interfaces.Newable, bind: interfaces.Bind): void { + bind(identifier).toSelf().inSingletonScope(); + bind(ToolProvider).toService(identifier); +} + +@injectable() +export class ToolInvocationRegistryImpl implements ToolInvocationRegistry { + + private tools: Map = new Map(); + + private readonly onDidChangeEmitter = new Emitter(); + readonly onDidChange: Event = this.onDidChangeEmitter.event; + + @inject(ContributionProvider) + @named(ToolProvider) + private providers: ContributionProvider; + + @postConstruct() + init(): void { + this.providers.getContributions().forEach(provider => { + this.registerTool(provider.getTool()); + }); + } + + unregisterAllTools(providerName: string): void { + const toolsToRemove: string[] = []; + for (const [id, tool] of this.tools.entries()) { + if (tool.providerName === providerName) { + toolsToRemove.push(id); + } + } + let changed = false; + toolsToRemove.forEach(id => { + if (this.tools.delete(id)) { + changed = true; + } + }); + if (changed) { + this.onDidChangeEmitter.fire(); + } + } + getAllFunctions(): ToolRequest[] { + return Array.from(this.tools.values()); + } + + registerTool(tool: ToolRequest): void { + if (this.tools.has(tool.id)) { + console.warn(`Function with id ${tool.id} is already registered.`); + } else { + this.tools.set(tool.id, tool); + this.onDidChangeEmitter.fire(); + } + } + + getFunction(toolId: string): ToolRequest | undefined { + return this.tools.get(toolId); + } + + getFunctions(...toolIds: string[]): ToolRequest[] { + const tools: ToolRequest[] = toolIds.map(toolId => { + const tool = this.tools.get(toolId); + if (tool) { + return tool; + } else { + throw new Error(`Function with id ${toolId} does not exist.`); + } + }); + return tools; + } +} + diff --git a/packages/ai-core/src/common/variable-service.spec.ts b/packages/ai-core/src/common/variable-service.spec.ts new file mode 100644 index 0000000..19fcaa4 --- /dev/null +++ b/packages/ai-core/src/common/variable-service.spec.ts @@ -0,0 +1,289 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import * as sinon from 'sinon'; +import { ContributionProvider, Logger } from '@theia/core'; +import { expect } from 'chai'; +import { + DefaultAIVariableService, + AIVariable, + AIVariableContribution, + AIVariableResolverWithVariableDependencies, + ResolvedAIVariable, + createAIResolveVariableCache, + AIVariableArg +} from './variable-service'; + +describe('DefaultAIVariableService', () => { + let variableService: DefaultAIVariableService; + let contributionProvider: sinon.SinonStubbedInstance>; + let logger: sinon.SinonStubbedInstance; + + const varA: AIVariable = { + id: 'provider.a', + name: 'a', + description: 'Variable A' + }; + + const varB: AIVariable = { + id: 'provider.b', + name: 'b', + description: 'Variable B' + }; + + const varC: AIVariable = { + id: 'provider.c', + name: 'c', + description: 'Variable C' + }; + + const varD: AIVariable = { + id: 'provider.d', + name: 'd', + description: 'Variable D' + }; + + // Create resolvers for our variables + const resolverA: AIVariableResolverWithVariableDependencies = { + canResolve: sinon.stub().returns(1), + resolve: async (_request, _context, resolveDependency?: (variable: AIVariableArg) => Promise) => { + if (resolveDependency) { + // Variable A depends on both B and C + const dependencyB = await resolveDependency({ variable: varB }); + const dependencyC = await resolveDependency({ variable: varC }); + + return { + variable: varA, + value: `A resolved with B: ${dependencyB?.value ?? 'undefined'} and C: ${dependencyC?.value ?? 'undefined'}`, + allResolvedDependencies: [ + ...(dependencyB ? [dependencyB] : []), + ...(dependencyC ? [dependencyC] : []) + ] + }; + } + return { variable: varA, value: 'A value' }; + } + }; + + const resolverB: AIVariableResolverWithVariableDependencies = { + canResolve: sinon.stub().returns(1), + resolve: async (_request, _context, resolveDependency?: (variable: AIVariableArg) => Promise) => { + if (resolveDependency) { + // Variable B depends on A, creating a cycle + const dependencyA = await resolveDependency({ variable: varA }); + + return { + variable: varB, + value: `B resolved with A: ${dependencyA?.value ?? 'undefined (cycle detected)'}`, + allResolvedDependencies: dependencyA ? [dependencyA] : [] + }; + } + return { variable: varB, value: 'B value' }; + } + }; + + const resolverC: AIVariableResolverWithVariableDependencies = { + canResolve: sinon.stub().returns(1), + resolve: async (_request, _context, resolveDependency?: (variable: AIVariableArg) => Promise) => { + if (resolveDependency) { + // Variable C depends on D with two different arguments + const dependencyD1 = await resolveDependency({ variable: varD, arg: 'arg1' }); + const dependencyD2 = await resolveDependency({ variable: varD, arg: 'arg2' }); + + return { + variable: varC, + value: `C resolved with D(arg1): ${dependencyD1?.value ?? 'undefined'} and D(arg2): ${dependencyD2?.value ?? 'undefined'}`, + allResolvedDependencies: [ + ...(dependencyD1 ? [dependencyD1] : []), + ...(dependencyD2 ? [dependencyD2] : []) + ] + }; + } + return { variable: varC, value: 'C value' }; + } + }; + + const resolverD: AIVariableResolverWithVariableDependencies = { + canResolve: sinon.stub().returns(1), + resolve: async request => { + const arg = request.arg; + return { + variable: varD, + value: arg ? `D value with ${arg}` : 'D value' + }; + } + }; + + beforeEach(() => { + // Create stub for the contribution provider + contributionProvider = { + getContributions: sinon.stub().returns([]) + } as sinon.SinonStubbedInstance>; + + // Create stub for logger + logger = sinon.createStubInstance(Logger); + + // Create the service under test + variableService = new DefaultAIVariableService( + contributionProvider, + logger + ); + + // Register the variables and resolvers + variableService.registerResolver(varA, resolverA); + variableService.registerResolver(varB, resolverB); + variableService.registerResolver(varC, resolverC); + variableService.registerResolver(varD, resolverD); + }); + + describe('resolveVariable', () => { + it('should handle recursive variable resolution and detect cycles', async () => { + // Try to resolve variable A, which has a cycle with B and also depends on C which depends on D + const result = await variableService.resolveVariable('a', {}); + + // Verify the result + expect(result).to.not.be.undefined; + expect(result!.variable).to.deep.equal(varA); + + // The value should contain B's value (with a cycle detection) and C's value + expect(result!.value).to.include('B resolved with A: undefined (cycle detected)'); + expect(result!.value).to.include('C resolved with D(arg1): D value with arg1 and D(arg2): D value with arg2'); + + // Verify that we logged a warning about the cycle + expect(logger.warn.calledOnce).to.be.true; + expect(logger.warn.firstCall.args[0]).to.include('Cycle detected for variable: a'); + + // Verify dependencies are tracked + expect(result!.allResolvedDependencies).to.have.lengthOf(2); + + // Find the B dependency and verify it doesn't have A in its dependencies (due to cycle detection) + const bDependency = result!.allResolvedDependencies!.find(d => d.variable.name === 'b'); + expect(bDependency).to.not.be.undefined; + expect(bDependency!.allResolvedDependencies).to.be.empty; + + // Find the C dependency and its D dependencies + const cDependency = result!.allResolvedDependencies!.find(d => d.variable.name === 'c'); + expect(cDependency).to.not.be.undefined; + expect(cDependency!.value).to.equal('C resolved with D(arg1): D value with arg1 and D(arg2): D value with arg2'); + expect(cDependency!.allResolvedDependencies).to.have.lengthOf(2); + + const dDependency1 = cDependency!.allResolvedDependencies![0]; + expect(dDependency1.variable.name).to.equal('d'); + expect(dDependency1.value).to.equal('D value with arg1'); + + const dDependency2 = cDependency!.allResolvedDependencies![1]; + expect(dDependency2.variable.name).to.equal('d'); + expect(dDependency2.value).to.equal('D value with arg2'); + }); + + it('should handle variables with a simple chain of dependencies', async () => { + // Variable C depends on D with two different arguments + const result = await variableService.resolveVariable('c', {}); + + expect(result).to.not.be.undefined; + expect(result!.variable).to.deep.equal(varC); + expect(result!.value).to.equal('C resolved with D(arg1): D value with arg1 and D(arg2): D value with arg2'); + + // Verify dependency chain + expect(result!.allResolvedDependencies).to.have.lengthOf(2); + + const dDependency1 = result!.allResolvedDependencies![0]; + expect(dDependency1.variable.name).to.equal('d'); + expect(dDependency1.value).to.equal('D value with arg1'); + + const dDependency2 = result!.allResolvedDependencies![1]; + expect(dDependency2.variable.name).to.equal('d'); + expect(dDependency2.value).to.equal('D value with arg2'); + }); + + it('should handle variables without dependencies', async () => { + // D has no dependencies + const result = await variableService.resolveVariable('d', {}); + + expect(result).to.not.be.undefined; + expect(result!.variable).to.deep.equal(varD); + expect(result!.value).to.equal('D value'); + expect(result!.allResolvedDependencies).to.be.undefined; + }); + + it('should handle variables with arguments', async () => { + // Test D with an argument + const result = await variableService.resolveVariable({ variable: 'd', arg: 'test-arg' }, {}, undefined); + + expect(result).to.not.be.undefined; + expect(result!.variable).to.deep.equal(varD); + expect(result!.value).to.equal('D value with test-arg'); + expect(result!.allResolvedDependencies).to.be.undefined; + }); + + it('should return undefined for non-existent variables', async () => { + const result = await variableService.resolveVariable('nonexistent', {}); + expect(result).to.be.undefined; + }); + + it('should properly populate cache when resolving variables with dependencies', async () => { + // Create a cache to pass into the resolver + const cache = createAIResolveVariableCache(); + + // Resolve variable A, which depends on B and C, and C depends on D with two arguments + const result = await variableService.resolveVariable('a', {}, cache); + + // Verify that the result is correct + expect(result).to.not.be.undefined; + expect(result!.variable).to.deep.equal(varA); + + // Verify that the cache has entries for all variables + expect(cache.size).to.equal(5); // A, B, C, D(arg1), and D(arg2) + + // Verify that all variables have entries in the cache + expect(cache.has('a:')).to.be.true; // 'a:' key format is variableName + separator + arg (empty in this case) + expect(cache.has('b:')).to.be.true; + expect(cache.has('c:')).to.be.true; + expect(cache.has('d:arg1')).to.be.true; + expect(cache.has('d:arg2')).to.be.true; + + // Verify that all promises in the cache are resolved + for (const entry of cache.values()) { + const resolvedVar = await entry.promise; + expect(resolvedVar).to.not.be.undefined; + expect(entry.inProgress).to.be.false; + } + + // Check specific variable results from cache + const aEntry = cache.get('a:'); + const aResult = await aEntry!.promise; + expect(aResult!.variable.name).to.equal('a'); + + const bEntry = cache.get('b:'); + const bResult = await bEntry!.promise; + expect(bResult!.variable.name).to.equal('b'); + + const cEntry = cache.get('c:'); + const cResult = await cEntry!.promise; + expect(cResult!.variable.name).to.equal('c'); + + const dEntry1 = cache.get('d:arg1'); + const dResult1 = await dEntry1!.promise; + expect(dResult1!.variable.name).to.equal('d'); + expect(dResult1!.value).to.equal('D value with arg1'); + + const dEntry2 = cache.get('d:arg2'); + const dResult2 = await dEntry2!.promise; + expect(dResult2!.variable.name).to.equal('d'); + expect(dResult2!.value).to.equal('D value with arg2'); + }); + }); +}); diff --git a/packages/ai-core/src/common/variable-service.ts b/packages/ai-core/src/common/variable-service.ts new file mode 100644 index 0000000..1348cef --- /dev/null +++ b/packages/ai-core/src/common/variable-service.ts @@ -0,0 +1,427 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +// Partially copied from https://github.com/microsoft/vscode/blob/a2cab7255c0df424027be05d58e1b7b941f4ea60/src/vs/workbench/contrib/chat/common/chatVariables.ts + +import { ContributionProvider, Disposable, Emitter, ILogger, MaybePromise, Prioritizeable, Event } from '@theia/core'; +import { inject, injectable, named } from '@theia/core/shared/inversify'; +import * as monaco from '@theia/monaco-editor-core'; +import { PromptText } from './prompt-text'; + +/** + * A variable is a short string that is used to reference a value that is resolved and replaced in the user prompt at request-time. + */ +export interface AIVariable { + /** provider id */ + id: string; + /** variable name, used for referencing variables in the chat */ + name: string; + /** variable description */ + description: string; + /** optional label, used for showing the variable in the UI. If not provided, the variable name is used */ + label?: string; + /** optional icon classes, used for showing the variable in the UI. */ + iconClasses?: string[]; + /** specifies whether this variable contributes to the context -- @see ResolvedAIContextVariable */ + isContextVariable?: boolean; + /** optional arguments for resolving the variable into a value */ + args?: AIVariableDescription[]; +} + +export namespace AIVariable { + export function is(arg: unknown): arg is AIVariable { + return !!arg && typeof arg === 'object' && + 'id' in arg && + 'name' in arg && + 'description' in arg; + } +} + +export interface AIContextVariable extends AIVariable { + label: string; + isContextVariable: true; +} + +export namespace AIContextVariable { + export function is(arg: unknown): arg is AIContextVariable { + return AIVariable.is(arg) && 'isContextVariable' in arg && arg.isContextVariable === true; + } +} + +export interface AIVariableDescription { + name: string; + description: string; + enum?: string[]; + isOptional?: boolean; +} + +export interface ResolvedAIVariable { + variable: AIVariable; + arg?: string; + /** value that is inserted into the prompt at the position of the variable usage */ + value: string; + /** Flat list of all variables that have been (recursively) resolved while resolving this variable. */ + allResolvedDependencies?: ResolvedAIVariable[]; +} + +export namespace ResolvedAIVariable { + export function is(arg: unknown): arg is ResolvedAIVariable { + return !!arg && typeof arg === 'object' && + 'variable' in arg && + 'value' in arg && + typeof (arg as { variable: unknown }).variable === 'object' && + typeof (arg as { value: unknown }).value === 'string'; + } +} + +/** + * A context variable is a variable that also contributes to the context of a chat request. + * + * In contrast to a plain variable, it can also be attached to a request and is resolved into a context value. + * The context value is put into the `ChatRequestModel.context`, available to the processing chat agent for further + * processing by the chat agent, or invoked tool functions. + */ +export interface ResolvedAIContextVariable extends ResolvedAIVariable { + contextValue: string; +} + +export namespace ResolvedAIContextVariable { + export function is(arg: unknown): arg is ResolvedAIContextVariable { + return ResolvedAIVariable.is(arg) && + 'contextValue' in arg && + typeof (arg as { contextValue: unknown }).contextValue === 'string'; + } +} + +export interface AIVariableResolutionRequest { + variable: AIVariable; + arg?: string; +} + +export namespace AIVariableResolutionRequest { + export function is(arg: unknown): arg is AIVariableResolutionRequest { + return !!arg && typeof arg === 'object' && + 'variable' in arg && + typeof (arg as { variable: { name: unknown } }).variable.name === 'string'; + } + + export function fromResolved(arg: ResolvedAIContextVariable): AIVariableResolutionRequest { + return { + variable: arg.variable, + arg: arg.arg + }; + } +} + +export interface AIVariableContext { +} + +export type AIVariableArg = string | { variable: string, arg?: string } | AIVariableResolutionRequest; + +export type AIVariableArgPicker = (context: AIVariableContext) => MaybePromise; +export type AIVariableArgCompletionProvider = + (model: monaco.editor.ITextModel, position: monaco.Position, matchString?: string) => MaybePromise; + +export interface AIVariableResolver { + canResolve(request: AIVariableResolutionRequest, context: AIVariableContext): MaybePromise, + resolve(request: AIVariableResolutionRequest, context: AIVariableContext): Promise; +} + +export interface AIVariableOpener { + canOpen(request: AIVariableResolutionRequest, context: AIVariableContext): MaybePromise; + open(request: AIVariableResolutionRequest, context: AIVariableContext): Promise; +} + +export interface AIVariableResolverWithVariableDependencies extends AIVariableResolver { + resolve(request: AIVariableResolutionRequest, context: AIVariableContext): Promise; + /** + * Resolve the given AI variable resolution request. When resolving dependencies with `resolveDependency`, + * add the resolved dependencies to the result's `allResolvedDependencies` list + * to enable consumers of the resolved variable to inspect dependencies. + */ + resolve( + request: AIVariableResolutionRequest, + context: AIVariableContext, + resolveDependency: (variable: AIVariableArg) => Promise + ): Promise; +} + +function isResolverWithDependencies(resolver: AIVariableResolver | undefined): resolver is AIVariableResolverWithVariableDependencies { + return resolver !== undefined && resolver.resolve.length >= 3; +} + +export const AIVariableService = Symbol('AIVariableService'); +export interface AIVariableService { + hasVariable(name: string): boolean; + getVariable(name: string): Readonly | undefined; + getVariables(): Readonly[]; + getContextVariables(): Readonly[]; + registerVariable(variable: AIVariable): Disposable; + unregisterVariable(name: string): void; + readonly onDidChangeVariables: Event; + + registerResolver(variable: AIVariable, resolver: AIVariableResolver): Disposable; + unregisterResolver(variable: AIVariable, resolver: AIVariableResolver): void; + getResolver(name: string, arg: string | undefined, context: AIVariableContext): Promise; + resolveVariable(variable: AIVariableArg, context: AIVariableContext, cache?: Map): Promise; + + registerArgumentPicker(variable: AIVariable, argPicker: AIVariableArgPicker): Disposable; + unregisterArgumentPicker(variable: AIVariable, argPicker: AIVariableArgPicker): void; + getArgumentPicker(name: string, context: AIVariableContext): Promise; + + registerArgumentCompletionProvider(variable: AIVariable, argPicker: AIVariableArgCompletionProvider): Disposable; + unregisterArgumentCompletionProvider(variable: AIVariable, argPicker: AIVariableArgCompletionProvider): void; + getArgumentCompletionProvider(name: string): Promise; +} + +/** Contributions on the frontend can optionally implement `FrontendVariableContribution`. */ +export const AIVariableContribution = Symbol('AIVariableContribution'); +export interface AIVariableContribution { + registerVariables(service: AIVariableService): void; +} + +export interface ResolveAIVariableCacheEntry { + promise: Promise; + inProgress: boolean; +} + +export type ResolveAIVariableCache = Map; +/** + * Creates a new, empty cache for AI variable resolution to hand into `AIVariableService.resolveVariable`. + */ +export function createAIResolveVariableCache(): Map { + return new Map(); +} + +/** Utility function to get all resolved AI variables from a {@link ResolveAIVariableCache} */ +export async function getAllResolvedAIVariables(cache: ResolveAIVariableCache): Promise { + const resolvedVariables: ResolvedAIVariable[] = []; + for (const cacheEntry of cache.values()) { + if (!cacheEntry.inProgress) { + const resolvedVariable = await cacheEntry.promise; + if (resolvedVariable) { + resolvedVariables.push(resolvedVariable); + } + } + } + return resolvedVariables; +} + +@injectable() +export class DefaultAIVariableService implements AIVariableService { + protected variables = new Map(); + protected resolvers = new Map(); + protected argPickers = new Map(); + protected openers = new Map(); + protected argCompletionProviders = new Map(); + + protected readonly onDidChangeVariablesEmitter = new Emitter(); + readonly onDidChangeVariables: Event = this.onDidChangeVariablesEmitter.event; + + constructor( + @inject(ContributionProvider) @named(AIVariableContribution) + protected readonly contributionProvider: ContributionProvider, + @inject(ILogger) protected readonly logger: ILogger + ) { } + + protected initContributions(): void { + this.contributionProvider.getContributions().forEach(contribution => contribution.registerVariables(this)); + } + + protected getKey(name: string): string { + return `${name.toLowerCase()}`; + } + + async getResolver(name: string, arg: string | undefined, context: AIVariableContext): Promise { + const resolvers = await this.prioritize(name, arg, context); + return resolvers[0]; + } + + protected getResolvers(name: string): AIVariableResolver[] { + return this.resolvers.get(this.getKey(name)) ?? []; + } + + protected async prioritize(name: string, arg: string | undefined, context: AIVariableContext): Promise { + const variable = this.getVariable(name); + if (!variable) { + return []; + } + const prioritized = await Prioritizeable.prioritizeAll(this.getResolvers(name), async resolver => { + try { + return await resolver.canResolve({ variable, arg }, context); + } catch { + return 0; + } + }); + return prioritized.map(p => p.value); + } + + hasVariable(name: string): boolean { + return !!this.getVariable(name); + } + + getVariable(name: string): Readonly | undefined { + return this.variables.get(this.getKey(name)); + } + + getVariables(): Readonly[] { + return [...this.variables.values()]; + } + + getContextVariables(): Readonly[] { + return this.getVariables().filter(AIContextVariable.is); + } + + registerVariable(variable: AIVariable): Disposable { + const key = this.getKey(variable.name); + if (!this.variables.get(key)) { + this.variables.set(key, variable); + this.onDidChangeVariablesEmitter.fire(); + return Disposable.create(() => this.unregisterVariable(variable.name)); + } + return Disposable.NULL; + } + + registerResolver(variable: AIVariable, resolver: AIVariableResolver): Disposable { + this.registerVariable(variable); + const key = this.getKey(variable.name); + const resolvers = this.resolvers.get(key) ?? []; + resolvers.push(resolver); + this.resolvers.set(key, resolvers); + return Disposable.create(() => this.unregisterResolver(variable, resolver)); + } + + unregisterResolver(variable: AIVariable, resolver: AIVariableResolver): void { + const key = this.getKey(variable.name); + const registeredResolvers = this.resolvers.get(key); + registeredResolvers?.splice(registeredResolvers.indexOf(resolver), 1); + if (registeredResolvers?.length === 0) { + this.unregisterVariable(variable.name); + } + } + + unregisterVariable(name: string): void { + this.variables.delete(this.getKey(name)); + this.resolvers.delete(this.getKey(name)); + this.onDidChangeVariablesEmitter.fire(); + } + + registerArgumentPicker(variable: AIVariable, argPicker: AIVariableArgPicker): Disposable { + this.registerVariable(variable); + const key = this.getKey(variable.name); + this.argPickers.set(key, argPicker); + return Disposable.create(() => this.unregisterArgumentPicker(variable, argPicker)); + } + + unregisterArgumentPicker(variable: AIVariable, argPicker: AIVariableArgPicker): void { + const key = this.getKey(variable.name); + const registeredArgPicker = this.argPickers.get(key); + if (registeredArgPicker === argPicker) { + this.argPickers.delete(key); + } + } + + async getArgumentPicker(name: string): Promise { + return this.argPickers.get(this.getKey(name)) ?? undefined; + } + + registerArgumentCompletionProvider(variable: AIVariable, completionProvider: AIVariableArgCompletionProvider): Disposable { + this.registerVariable(variable); + const key = this.getKey(variable.name); + this.argCompletionProviders.set(key, completionProvider); + return Disposable.create(() => this.unregisterArgumentCompletionProvider(variable, completionProvider)); + } + + unregisterArgumentCompletionProvider(variable: AIVariable, completionProvider: AIVariableArgCompletionProvider): void { + const key = this.getKey(variable.name); + const registeredCompletionProvider = this.argCompletionProviders.get(key); + if (registeredCompletionProvider === completionProvider) { + this.argCompletionProviders.delete(key); + } + } + + async getArgumentCompletionProvider(name: string): Promise { + return this.argCompletionProviders.get(this.getKey(name)) ?? undefined; + } + + protected parseRequest(request: AIVariableArg): { variableName: string, arg: string | undefined } { + const variableName = typeof request === 'string' + ? request + : typeof request.variable === 'string' + ? request.variable + : request.variable.name; + const arg = typeof request === 'string' ? undefined : request.arg; + return { variableName, arg }; + } + + async resolveVariable( + request: AIVariableArg, + context: AIVariableContext, + cache: ResolveAIVariableCache = createAIResolveVariableCache() + ): Promise { + // Calculate unique variable cache key from variable name and argument + const { variableName, arg } = this.parseRequest(request); + const cacheKey = `${variableName}${PromptText.VARIABLE_SEPARATOR_CHAR}${arg ?? ''}`; + + // If the current cache key exists and is still in progress, we reached a cycle. + // If we reach it but it has been resolved, it was part of another resolution branch and we can simply return it. + if (cache.has(cacheKey)) { + const existingEntry = cache.get(cacheKey)!; + if (existingEntry.inProgress) { + this.logger.warn(`Cycle detected for variable: ${variableName} with arg: ${arg}. Skipping resolution.`); + return undefined; + } + return existingEntry.promise; + } + + const entry: ResolveAIVariableCacheEntry = { promise: this.doResolve(variableName, arg, context, cache), inProgress: true }; + entry.promise.finally(() => entry.inProgress = false); + cache.set(cacheKey, entry); + + return entry.promise; + } + + /** + * Asynchronously resolves a variable, handling its dependencies while preventing cyclical resolution. + * Selects the appropriate resolver and resolution strategy based on whether nested dependency resolution is supported. + */ + protected async doResolve(variableName: string, arg: string | undefined, context: AIVariableContext, cache: ResolveAIVariableCache): Promise { + const variable = this.getVariable(variableName); + if (!variable) { + return undefined; + } + const resolver = await this.getResolver(variableName, arg, context); + let resolved: ResolvedAIVariable | undefined; + if (isResolverWithDependencies(resolver)) { + // Explicit cast needed because Typescript does not consider the method parameter length of the type guard at compile time + resolved = await (resolver as AIVariableResolverWithVariableDependencies).resolve( + { variable, arg }, + context, + async (depRequest: AIVariableResolutionRequest) => + this.resolveVariable(depRequest, context, cache) + ); + } else if (resolver) { + // Explicit cast needed because Typescript does not consider the method parameter length of the type guard at compile time + resolved = await (resolver as AIVariableResolver).resolve({ variable, arg }, context); + } else { + resolved = undefined; + } + return resolved ? { ...resolved, arg } : undefined; + } +} diff --git a/packages/ai-core/src/node/ai-core-backend-module.ts b/packages/ai-core/src/node/ai-core-backend-module.ts new file mode 100644 index 0000000..bd85f58 --- /dev/null +++ b/packages/ai-core/src/node/ai-core-backend-module.ts @@ -0,0 +1,116 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** +import { ContainerModule } from '@theia/core/shared/inversify'; +import { + LanguageModelFrontendDelegateImpl, + LanguageModelRegistryFrontendDelegateImpl, +} from './language-model-frontend-delegate'; +import { + ConnectionHandler, + PreferenceContribution, + RpcConnectionHandler, + bindContributionProvider, +} from '@theia/core'; +import { + ConnectionContainerModule +} from '@theia/core/lib/node/messaging/connection-container-module'; +import { + LanguageModelRegistry, + LanguageModelProvider, + PromptService, + PromptServiceImpl, + LanguageModelDelegateClient, + LanguageModelFrontendDelegate, + LanguageModelRegistryFrontendDelegate, + languageModelDelegatePath, + languageModelRegistryDelegatePath, + LanguageModelRegistryClient, + TokenUsageService, + TokenUsageServiceClient, + TOKEN_USAGE_SERVICE_PATH +} from '../common'; +import { BackendLanguageModelRegistryImpl } from './backend-language-model-registry'; +import { TokenUsageServiceImpl } from './token-usage-service-impl'; +import { AgentSettingsPreferenceSchema } from '../common/agent-preferences'; +import { bindAICorePreferences } from '../common/ai-core-preferences'; + +// We use a connection module to handle AI services separately for each frontend. +const aiCoreConnectionModule = ConnectionContainerModule.create(({ bind, bindBackendService, bindFrontendService }) => { + bindContributionProvider(bind, LanguageModelProvider); + bind(BackendLanguageModelRegistryImpl).toSelf().inSingletonScope(); + bind(LanguageModelRegistry).toService(BackendLanguageModelRegistryImpl); + + bind(TokenUsageService).to(TokenUsageServiceImpl).inSingletonScope(); + + bind(ConnectionHandler) + .toDynamicValue( + ({ container }) => + new RpcConnectionHandler( + TOKEN_USAGE_SERVICE_PATH, + client => { + const service = container.get(TokenUsageService); + service.setClient(client); + return service; + } + ) + ) + .inSingletonScope(); + + bind(LanguageModelRegistryFrontendDelegate).to(LanguageModelRegistryFrontendDelegateImpl).inSingletonScope(); + bind(ConnectionHandler) + .toDynamicValue( + ctx => + new RpcConnectionHandler( + languageModelRegistryDelegatePath, + client => { + const registryDelegate = ctx.container.get( + LanguageModelRegistryFrontendDelegate + ); + registryDelegate.setClient(client); + return registryDelegate; + } + ) + ) + .inSingletonScope(); + + bind(LanguageModelFrontendDelegateImpl).toSelf().inSingletonScope(); + bind(LanguageModelFrontendDelegate).toService(LanguageModelFrontendDelegateImpl); + bind(ConnectionHandler) + .toDynamicValue( + ({ container }) => + new RpcConnectionHandler( + languageModelDelegatePath, + client => { + const service = + container.get( + LanguageModelFrontendDelegateImpl + ); + service.setClient(client); + return service; + } + ) + ) + .inSingletonScope(); + + bind(PromptServiceImpl).toSelf().inSingletonScope(); + bind(PromptService).toService(PromptServiceImpl); +}); + +export default new ContainerModule(bind => { + bind(PreferenceContribution).toConstantValue({ schema: AgentSettingsPreferenceSchema }); + bindAICorePreferences(bind); + bind(ConnectionContainerModule).toConstantValue(aiCoreConnectionModule); +}); diff --git a/packages/ai-core/src/node/backend-language-model-registry.ts b/packages/ai-core/src/node/backend-language-model-registry.ts new file mode 100644 index 0000000..bfed66e --- /dev/null +++ b/packages/ai-core/src/node/backend-language-model-registry.ts @@ -0,0 +1,67 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { injectable } from '@theia/core/shared/inversify'; +import { DefaultLanguageModelRegistryImpl, LanguageModel, LanguageModelMetaData, LanguageModelRegistryClient } from '../common'; + +/** + * Notifies a client whenever a model is added or removed + */ +@injectable() +export class BackendLanguageModelRegistryImpl extends DefaultLanguageModelRegistryImpl { + + private client: LanguageModelRegistryClient | undefined; + + setClient(client: LanguageModelRegistryClient): void { + this.client = client; + } + + override addLanguageModels(models: LanguageModel[]): void { + const modelsLength = this.languageModels.length; + super.addLanguageModels(models); + // only notify for models which were really added + for (let i = modelsLength; i < this.languageModels.length; i++) { + this.client?.languageModelAdded(this.mapToMetaData(this.languageModels[i])); + } + } + + override removeLanguageModels(ids: string[]): void { + super.removeLanguageModels(ids); + for (const id of ids) { + this.client?.languageModelRemoved(id); + } + } + + override async patchLanguageModel(id: string, patch: Partial): Promise { + await super.patchLanguageModel(id, patch); + if (this.client) { + this.client.onLanguageModelUpdated(id); + } + } + + mapToMetaData(model: LanguageModel): LanguageModelMetaData { + return { + id: model.id, + name: model.name, + status: model.status, + vendor: model.vendor, + version: model.version, + family: model.family, + maxInputTokens: model.maxInputTokens, + maxOutputTokens: model.maxOutputTokens, + }; + } +} diff --git a/packages/ai-core/src/node/language-model-frontend-delegate.ts b/packages/ai-core/src/node/language-model-frontend-delegate.ts new file mode 100644 index 0000000..678fd8b --- /dev/null +++ b/packages/ai-core/src/node/language-model-frontend-delegate.ts @@ -0,0 +1,123 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { inject, injectable } from '@theia/core/shared/inversify'; +import { CancellationToken, CancellationTokenSource, ILogger, generateUuid } from '@theia/core'; +import { + LanguageModelMetaData, + LanguageModelRegistry, + isLanguageModelStreamResponse, + isLanguageModelTextResponse, + LanguageModelStreamResponsePart, + LanguageModelDelegateClient, + LanguageModelFrontendDelegate, + LanguageModelRegistryFrontendDelegate, + LanguageModelResponseDelegate, + LanguageModelRegistryClient, + isLanguageModelParsedResponse, + UserRequest, +} from '../common'; +import { BackendLanguageModelRegistryImpl } from './backend-language-model-registry'; + +@injectable() +export class LanguageModelRegistryFrontendDelegateImpl implements LanguageModelRegistryFrontendDelegate { + + @inject(LanguageModelRegistry) + private registry: BackendLanguageModelRegistryImpl; + + setClient(client: LanguageModelRegistryClient): void { + this.registry.setClient(client); + } + + async getLanguageModelDescriptions(): Promise { + return (await this.registry.getLanguageModels()).map(model => this.registry.mapToMetaData(model)); + } +} + +@injectable() +export class LanguageModelFrontendDelegateImpl implements LanguageModelFrontendDelegate { + + @inject(LanguageModelRegistry) + private registry: LanguageModelRegistry; + + @inject(ILogger) + private logger: ILogger; + + private frontendDelegateClient: LanguageModelDelegateClient; + private requestCancellationTokenMap: Map = new Map(); + + setClient(client: LanguageModelDelegateClient): void { + this.frontendDelegateClient = client; + } + + cancel(requestId: string): void { + this.requestCancellationTokenMap.get(requestId)?.cancel(); + } + + async request( + modelId: string, + request: UserRequest, + requestId: string, + cancellationToken?: CancellationToken + ): Promise { + const model = await this.registry.getLanguageModel(modelId); + if (!model) { + throw new Error( + `Request was sent to non-existent language model ${modelId}` + ); + } + request.tools?.forEach(tool => { + tool.handler = async (args_string, ctx) => this.frontendDelegateClient.toolCall(requestId, tool.id, args_string, ctx?.toolCallId); + }); + if (cancellationToken) { + const tokenSource = new CancellationTokenSource(); + cancellationToken = tokenSource.token; + this.requestCancellationTokenMap.set(requestId, tokenSource); + } + const response = await model.request(request, cancellationToken); + if (isLanguageModelTextResponse(response) || isLanguageModelParsedResponse(response)) { + return response; + } + if (isLanguageModelStreamResponse(response)) { + const delegate = { + streamId: generateUuid(), + }; + this.sendTokens(delegate.streamId, response.stream, cancellationToken); + return delegate; + } + this.logger.error( + `Received unexpected response from language model ${modelId}. Trying to continue without touching the response.`, + response + ); + return response; + } + + protected sendTokens(id: string, stream: AsyncIterable, cancellationToken?: CancellationToken): void { + (async () => { + try { + for await (const token of stream) { + this.frontendDelegateClient.send(id, token); + } + } catch (e) { + if (!cancellationToken?.isCancellationRequested) { + this.frontendDelegateClient.error(id, e); + } + } finally { + this.frontendDelegateClient.send(id, undefined); + } + })(); + } +} diff --git a/packages/ai-core/src/node/token-usage-service-impl.ts b/packages/ai-core/src/node/token-usage-service-impl.ts new file mode 100644 index 0000000..8dad2ac --- /dev/null +++ b/packages/ai-core/src/node/token-usage-service-impl.ts @@ -0,0 +1,83 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { injectable } from '@theia/core/shared/inversify'; +import { TokenUsage, TokenUsageParams, TokenUsageService } from '../common/token-usage-service'; +import { TokenUsageServiceClient } from '../common/protocol'; + +@injectable() +export class TokenUsageServiceImpl implements TokenUsageService { + private client: TokenUsageServiceClient | undefined; + + /** + * Sets the client to notify about token usage changes + */ + setClient(client: TokenUsageServiceClient | undefined): void { + this.client = client; + } + + private readonly tokenUsages: TokenUsage[] = []; + + /** + * Records token usage for a model interaction. + * + * @param model The model identifier + * @param params Token usage parameters + * @returns A promise that resolves when the token usage has been recorded + */ + async recordTokenUsage(model: string, params: TokenUsageParams): Promise { + const usage: TokenUsage = { + inputTokens: params.inputTokens, + cachedInputTokens: params.cachedInputTokens, + readCachedInputTokens: params.readCachedInputTokens, + outputTokens: params.outputTokens, + model, + timestamp: new Date(), + requestId: params.requestId + }; + + this.tokenUsages.push(usage); + this.client?.notifyTokenUsage(usage); + + let logMessage = `Input Tokens: ${params.inputTokens};`; + + if (params.cachedInputTokens) { + logMessage += ` Input Tokens written to cache: ${params.cachedInputTokens};`; + } + + if (params.readCachedInputTokens) { + logMessage += ` Input Tokens read from cache: ${params.readCachedInputTokens};`; + } + + logMessage += ` Output Tokens: ${params.outputTokens}; Model: ${model};`; + + if (params.requestId) { + logMessage += `; RequestId: ${params.requestId}`; + } + + console.debug(logMessage); + // For now we just store in memory + // In the future, this could be persisted to disk, a database, or sent to a service + return Promise.resolve(); + } + + /** + * Gets all token usage records stored in this service. + */ + async getTokenUsages(): Promise { + return [...this.tokenUsages]; + } +} diff --git a/packages/ai-core/src/node/tool-request-parameters.spec.ts b/packages/ai-core/src/node/tool-request-parameters.spec.ts new file mode 100644 index 0000000..86195e6 --- /dev/null +++ b/packages/ai-core/src/node/tool-request-parameters.spec.ts @@ -0,0 +1,121 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** +import { expect } from 'chai'; +import { ToolRequest } from '../common/language-model'; + +describe('isToolRequestParameters', () => { + it('should return true for valid ToolRequestParameters', () => { + const validParams = { + type: 'object', + properties: { + param1: { + type: 'string' + }, + param2: { + type: 'number' + } + }, + required: ['param1'] + }; + expect(ToolRequest.isToolRequestParameters(validParams)).to.be.true; + }); + + it('should return false for ToolRequestParameters without type or anyOf', () => { + const paramsWithoutType = { + properties: { + param1: { + description: 'string' + } + }, + required: ['param1'] + }; + expect(ToolRequest.isToolRequestParameters(paramsWithoutType)).to.be.false; + }); + + it('should return false for invalid ToolRequestParameters with wrong property type', () => { + const invalidParams = { + type: 'object', + properties: { + param1: { + type: 123 + } + } + }; + expect(ToolRequest.isToolRequestParameters(invalidParams)).to.be.false; + }); + + it('should return false if properties is not an object', () => { + const invalidParams = { + type: 'object', + properties: 'not-an-object', + }; + expect(ToolRequest.isToolRequestParameters(invalidParams)).to.be.false; + }); + + it('should return true if required is missing', () => { + const missingRequiredParams = { + type: 'object', + properties: { + param1: { + type: 'string' + } + } + }; + expect(ToolRequest.isToolRequestParameters(missingRequiredParams)).to.be.true; + }); + + it('should return false if required is not an array', () => { + const invalidRequiredParams = { + type: 'object', + properties: { + param1: { + type: 'string' + } + }, + required: 'param1' + }; + expect(ToolRequest.isToolRequestParameters(invalidRequiredParams)).to.be.false; + }); + + it('should return false if a required field is not a string', () => { + const invalidRequiredParams = { + type: 'object', + properties: { + param1: { + type: 'string' + } + }, + required: [123] + }; + expect(ToolRequest.isToolRequestParameters(invalidRequiredParams)).to.be.false; + }); + + it('should validate properties with anyOf correctly', () => { + const paramsWithAnyOf = { + type: 'object', + properties: { + param1: { + anyOf: [ + { type: 'string' }, + { type: 'number' } + ] + } + }, + required: ['param1'] + }; + expect(ToolRequest.isToolRequestParameters(paramsWithAnyOf)).to.be.true; + }); +}); diff --git a/packages/ai-core/tsconfig.json b/packages/ai-core/tsconfig.json new file mode 100644 index 0000000..4ee37e1 --- /dev/null +++ b/packages/ai-core/tsconfig.json @@ -0,0 +1,34 @@ +{ + "extends": "../../configs/base.tsconfig", + "compilerOptions": { + "composite": true, + "rootDir": "src", + "outDir": "lib" + }, + "include": [ + "src" + ], + "references": [ + { + "path": "../core" + }, + { + "path": "../editor" + }, + { + "path": "../filesystem" + }, + { + "path": "../monaco" + }, + { + "path": "../output" + }, + { + "path": "../variable-resolver" + }, + { + "path": "../workspace" + } + ] +} diff --git a/packages/ai-editor/.eslintrc.js b/packages/ai-editor/.eslintrc.js new file mode 100644 index 0000000..1308994 --- /dev/null +++ b/packages/ai-editor/.eslintrc.js @@ -0,0 +1,10 @@ +/** @type {import('eslint').Linter.Config} */ +module.exports = { + extends: [ + '../../configs/build.eslintrc.json' + ], + parserOptions: { + tsconfigRootDir: __dirname, + project: 'tsconfig.json' + } +}; diff --git a/packages/ai-editor/README.md b/packages/ai-editor/README.md new file mode 100644 index 0000000..743e638 --- /dev/null +++ b/packages/ai-editor/README.md @@ -0,0 +1,31 @@ +
    + +
    + +theia-ext-logo + +

    ECLIPSE THEIA - AI EDITOR EXTENSION

    + +
    + +
    + +## Description + +The `@theia/ai-editor` extension brings AI-powered code actions and editor context interaction to Theia. It allows users to interact with AI directly in the editor for code explanations, fixes, and suggestions using AI agents. + +## Additional Information + +- [API documentation for `@theia/ai-editor`](https://eclipse-theia.github.io/theia/docs/next/modules/_theia_ai-editor.html) +- [Theia - GitHub](https://github.com/eclipse-theia/theia) +- [Theia - Website](https://theia-ide.org/) + +## License + +- [Eclipse Public License 2.0](http://www.eclipse.org/legal/epl-2.0/) +- [一 (Secondary) GNU General Public License, version 2 with the GNU Classpath Exception](https://projects.eclipse.org/license/secondary-gpl-2.0-cp) + +## Trademark + +"Theia" is a trademark of the Eclipse Foundation + diff --git a/packages/ai-editor/package.json b/packages/ai-editor/package.json new file mode 100644 index 0000000..ee564db --- /dev/null +++ b/packages/ai-editor/package.json @@ -0,0 +1,57 @@ +{ + "name": "@theia/ai-editor", + "version": "1.68.0", + "description": "Theia - AI Editor", + "dependencies": { + "@theia/core": "1.68.0", + "@theia/editor": "1.68.0", + "@theia/filesystem": "1.68.0", + "@theia/monaco": "1.68.0", + "@theia/monaco-editor-core": "1.96.302", + "@theia/ai-core": "1.68.0", + "@theia/ai-chat": "1.68.0", + "@theia/ai-chat-ui": "1.68.0", + "@theia/workspace": "1.68.0" + }, + "main": "lib/common", + "publishConfig": { + "access": "public" + }, + "theiaExtensions": [ + { + "frontend": "lib/browser/ai-editor-frontend-module" + } + ], + "keywords": [ + "theia-extension" + ], + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "repository": { + "type": "git", + "url": "https://github.com/eclipse-theia/theia.git" + }, + "bugs": { + "url": "https://github.com/eclipse-theia/theia/issues" + }, + "homepage": "https://github.com/eclipse-theia/theia", + "files": [ + "data", + "lib", + "src", + "style" + ], + "scripts": { + "build": "theiaext build", + "clean": "theiaext clean", + "compile": "theiaext compile", + "lint": "theiaext lint", + "test": "theiaext test", + "watch": "theiaext watch" + }, + "devDependencies": { + "@theia/ext-scripts": "1.68.0" + }, + "nyc": { + "extends": "../../configs/nyc.json" + } +} diff --git a/packages/ai-editor/src/browser/ai-code-action-provider.ts b/packages/ai-editor/src/browser/ai-code-action-provider.ts new file mode 100644 index 0000000..5b12b0a --- /dev/null +++ b/packages/ai-editor/src/browser/ai-code-action-provider.ts @@ -0,0 +1,119 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { FrontendApplicationContribution } from '@theia/core/lib/browser'; +import { CommandService } from '@theia/core/lib/common/command'; +import { DisposableCollection } from '@theia/core/lib/common/disposable'; +import { inject, injectable } from '@theia/core/shared/inversify'; +import * as monaco from '@theia/monaco-editor-core'; +import { MonacoEditorService } from '@theia/monaco/lib/browser/monaco-editor-service'; +import { AIActivationService } from '@theia/ai-core/lib/browser/ai-activation-service'; +import { nls } from '@theia/core'; + +export const AI_EDITOR_SEND_TO_CHAT = { + id: 'ai-editor.sendToChat', +}; + +@injectable() +export class AICodeActionProvider implements FrontendApplicationContribution { + + @inject(CommandService) + protected readonly commandService: CommandService; + + @inject(MonacoEditorService) + protected readonly monacoEditorService: MonacoEditorService; + + @inject(AIActivationService) + protected readonly activationService: AIActivationService; + + protected readonly toDispose = new DisposableCollection(); + + onStart(): void { + this.registerCodeActionProvider(); + + // Listen to AI activation changes and re-register the provider + this.activationService.onDidChangeActiveStatus(() => { + this.toDispose.dispose(); + this.registerCodeActionProvider(); + }); + } + + dispose(): void { + this.toDispose.dispose(); + } + + protected registerCodeActionProvider(): void { + if (!this.activationService.isActive) { + // AI is disabled, don't register the provider + return; + } + + const disposable = monaco.languages.registerCodeActionProvider('*', { + provideCodeActions: (model, range, context, token) => { + // Double-check activation status in the provider + if (!this.activationService.isActive) { + return { actions: [], dispose: () => { } }; + } + + // Filter for error markers only + const errorMarkers = context.markers.filter(marker => + marker.severity === monaco.MarkerSeverity.Error); + + if (errorMarkers.length === 0) { + return { actions: [], dispose: () => { } }; + } + + const actions: monaco.languages.CodeAction[] = []; + + // Create code actions for each error marker: Fix with AI and Explain with AI + errorMarkers.forEach(marker => { + actions.push({ + title: nls.localizeByDefault('Fix with AI'), + diagnostics: [marker], + isAI: true, + kind: 'quickfix', + command: { + id: AI_EDITOR_SEND_TO_CHAT.id, + title: nls.localizeByDefault('Fix with AI'), + arguments: [{ + prompt: `@Coder ${nls.localize('theia/ai/editor/fixWithAI/prompt', 'Help to fix this error')}: "${marker.message}"` + }] + } + }); + actions.push({ + title: nls.localize('theia/ai/editor/explainWithAI/title', 'Explain with AI'), + diagnostics: [marker], + kind: 'quickfix', + isAI: true, + command: { + id: AI_EDITOR_SEND_TO_CHAT.id, + title: nls.localize('theia/ai/editor/explainWithAI/title', 'Explain with AI'), + arguments: [{ + prompt: `@Architect ${nls.localize('theia/ai/editor/explainWithAI/prompt', 'Explain this error')}: "${marker.message}"` + }] + } + }); + }); + return { + actions: actions, + dispose: () => { } + }; + } + }); + + this.toDispose.push(disposable); + } +} diff --git a/packages/ai-editor/src/browser/ai-editor-command-contribution.ts b/packages/ai-editor/src/browser/ai-editor-command-contribution.ts new file mode 100644 index 0000000..3449435 --- /dev/null +++ b/packages/ai-editor/src/browser/ai-editor-command-contribution.ts @@ -0,0 +1,161 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { ChatAgentLocation, ChatRequest, ChatService } from '@theia/ai-chat'; +import { AICommandHandlerFactory, ENABLE_AI_CONTEXT_KEY } from '@theia/ai-core/lib/browser'; +import { isObject, isString, MenuContribution, MenuModelRegistry } from '@theia/core'; +import { ApplicationShell, codicon, KeybindingContribution, KeybindingRegistry } from '@theia/core/lib/browser'; +import { Command, CommandContribution, CommandRegistry } from '@theia/core/lib/common'; +import { inject, injectable } from '@theia/core/shared/inversify'; +import { EditorContextMenu, EditorWidget } from '@theia/editor/lib/browser'; +import { MonacoCommandRegistry, MonacoEditorCommandHandler } from '@theia/monaco/lib/browser/monaco-command-registry'; +import { MonacoEditor } from '@theia/monaco/lib/browser/monaco-editor'; +import { AskAIInputMonacoZoneWidget } from './ask-ai-input-monaco-zone-widget'; +import { AskAIInputFactory } from './ask-ai-input-widget'; + +export namespace AI_EDITOR_COMMANDS { + export const AI_EDITOR_ASK_AI: Command = Command.toLocalizedCommand({ + id: 'ai-editor.contextAction', + label: 'Ask AI', + iconClass: codicon('sparkle') + }, 'theia/ai-editor/contextMenu'); + export const AI_EDITOR_SEND_TO_CHAT: Command = Command.toLocalizedCommand({ + id: 'ai-editor.sendToChat', + label: 'Send to AI Chat' + }, 'theia/ai-editor/sendToChat'); +}; + +@injectable() +export class AiEditorCommandContribution implements CommandContribution, MenuContribution, KeybindingContribution { + + @inject(MonacoCommandRegistry) + protected readonly monacoCommandRegistry: MonacoCommandRegistry; + + @inject(ChatService) + protected readonly chatService: ChatService; + + @inject(AICommandHandlerFactory) + protected readonly commandHandlerFactory: AICommandHandlerFactory; + + @inject(AskAIInputFactory) + protected readonly askAIInputFactory: AskAIInputFactory; + + @inject(ApplicationShell) + protected readonly shell: ApplicationShell; + + protected askAiInputWidget: AskAIInputMonacoZoneWidget | undefined; + + registerCommands(registry: CommandRegistry): void { + registry.registerCommand(AI_EDITOR_COMMANDS.AI_EDITOR_ASK_AI); + registry.registerCommand(AI_EDITOR_COMMANDS.AI_EDITOR_SEND_TO_CHAT); + + this.monacoCommandRegistry.registerHandler(AI_EDITOR_COMMANDS.AI_EDITOR_ASK_AI.id, this.wrapMonacoHandler(this.showInputWidgetHandler())); + this.monacoCommandRegistry.registerHandler(AI_EDITOR_COMMANDS.AI_EDITOR_SEND_TO_CHAT.id, this.wrapMonacoHandler(this.sendToChatHandler())); + } + + protected showInputWidgetHandler(): MonacoEditorCommandHandler { + return { + execute: (editor: MonacoEditor) => { + this.showInputWidget(editor); + }, + isEnabled: (editor: MonacoEditor) => + this.shell.currentWidget instanceof EditorWidget && (this.shell.currentWidget as EditorWidget).editor === editor + }; + } + + private showInputWidget(editor: MonacoEditor): void { + this.cleanupInputWidget(); + + // Create the input widget using the factory + this.askAiInputWidget = new AskAIInputMonacoZoneWidget(editor.getControl(), this.askAIInputFactory); + + this.askAiInputWidget.onSubmit(request => { + this.createNewChatSession(request); + this.cleanupInputWidget(); + }); + + const line = editor.getControl().getPosition()?.lineNumber ?? 1; + + this.askAiInputWidget.showAtLine(line); + + this.askAiInputWidget.onCancel(() => { + this.cleanupInputWidget(); + }); + } + + private cleanupInputWidget(): void { + if (this.askAiInputWidget) { + this.askAiInputWidget.dispose(); + this.askAiInputWidget = undefined; + } + } + + protected sendToChatHandler(): MonacoEditorCommandHandler { + return { + execute: (_editor: MonacoEditor, ...args: unknown[]) => { + if (containsPrompt(args)) { + const prompt = args + .filter(isPromptArg) + .map(arg => arg.prompt) + .join(); + this.createNewChatSession({ text: prompt } as ChatRequest); + } + }, + isEnabled: (_editor: MonacoEditor, ...args: unknown[]) => containsPrompt(args) + }; + } + + private createNewChatSession(request: ChatRequest): void { + const session = this.chatService.createSession(ChatAgentLocation.Panel, { focus: true }); + this.chatService.sendRequest(session.id, { + ...request, + text: `${request.text} #editorContext`, + }); + } + + protected wrapMonacoHandler(handler: MonacoEditorCommandHandler): MonacoEditorCommandHandler { + const wrappedHandler = this.commandHandlerFactory(handler); + return { + execute: wrappedHandler.execute, + isEnabled: wrappedHandler.isEnabled + }; + } + + registerMenus(menus: MenuModelRegistry): void { + menus.registerMenuAction(EditorContextMenu.NAVIGATION, { + commandId: AI_EDITOR_COMMANDS.AI_EDITOR_ASK_AI.id, + label: AI_EDITOR_COMMANDS.AI_EDITOR_ASK_AI.label, + icon: AI_EDITOR_COMMANDS.AI_EDITOR_ASK_AI.iconClass, + when: ENABLE_AI_CONTEXT_KEY + }); + } + + registerKeybindings(registry: KeybindingRegistry): void { + registry.registerKeybinding({ + command: AI_EDITOR_COMMANDS.AI_EDITOR_ASK_AI.id, + keybinding: 'ctrlcmd+i', + when: `${ENABLE_AI_CONTEXT_KEY} && editorFocus && !editorReadonly` + }); + } +} + +function containsPrompt(args: unknown[]): boolean { + return args.some(arg => isPromptArg(arg)); +} + +function isPromptArg(arg: unknown): arg is { prompt: string } { + return isObject(arg) && 'prompt' in arg && isString(arg.prompt); +} diff --git a/packages/ai-editor/src/browser/ai-editor-context-variable.ts b/packages/ai-editor/src/browser/ai-editor-context-variable.ts new file mode 100644 index 0000000..a376b11 --- /dev/null +++ b/packages/ai-editor/src/browser/ai-editor-context-variable.ts @@ -0,0 +1,191 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { AIVariable, AIVariableContext, AIVariableContribution, AIVariableResolutionRequest, AIVariableResolver, ResolvedAIContextVariable } from '@theia/ai-core'; +import { FrontendVariableService } from '@theia/ai-core/lib/browser'; +import { inject, injectable } from '@theia/core/shared/inversify'; +import { codiconArray } from '@theia/core/lib/browser'; +import { MonacoEditor } from '@theia/monaco/lib/browser/monaco-editor'; +import { MonacoEditorProvider } from '@theia/monaco/lib/browser/monaco-editor-provider'; +import { WorkspaceService } from '@theia/workspace/lib/browser/workspace-service'; +import * as monaco from '@theia/monaco-editor-core'; +import { nls } from '@theia/core'; + +export const EDITOR_CONTEXT_VARIABLE: AIVariable = { + id: 'editorContext', + description: nls.localize('theia/ai/editor/editorContextVariable/description', 'Resolves editor specific context information'), + name: 'editorContext', + label: nls.localize('theia/ai/editor/editorContextVariable/label', 'EditorContext'), + iconClasses: codiconArray('file'), + isContextVariable: true, + args: [] +}; + +@injectable() +export class EditorContextVariableContribution implements AIVariableContribution, AIVariableResolver { + + @inject(MonacoEditorProvider) + protected readonly monacoEditors: MonacoEditorProvider; + + @inject(WorkspaceService) + protected readonly workspaceService: WorkspaceService; + + registerVariables(service: FrontendVariableService): void { + service.registerResolver(EDITOR_CONTEXT_VARIABLE, this); + } + + async canResolve(request: AIVariableResolutionRequest, _: AIVariableContext): Promise { + return request.variable.name === EDITOR_CONTEXT_VARIABLE.name ? 1 : 0; + } + + async resolve(request: AIVariableResolutionRequest, _: AIVariableContext): Promise { + const editor = this.monacoEditors.current; + if (!editor) { + return undefined; + } + + const model = editor.getControl().getModel(); + const selection = editor.getControl().getSelection(); + + if (!model || !selection) { + return undefined; + } + + // Extract file information + const uri = editor.getResourceUri(); + const languageId = model.getLanguageId(); + + // Extract selection information + const selectedText = model.getValueInRange(selection); + const hasSelection = !selection.isEmpty(); + + // Text position information + const position = editor.getControl().getPosition(); + const lineNumber = position ? position.lineNumber : 0; + const column = position ? position.column : 0; + + // Get workspace-relative path + const workspaceRelativePath = uri ? await this.workspaceService.getWorkspaceRelativePath(uri) : ''; + + // Create base context information + const baseContext = { + file: { + uri: workspaceRelativePath, + languageId, + fileName: uri ? uri.path.base : '' + }, + selection: { + text: selectedText, + isEmpty: !hasSelection, + startLineNumber: selection.startLineNumber, + startColumn: selection.startColumn, + endLineNumber: selection.endLineNumber, + endColumn: selection.endColumn + }, + position: { + lineNumber, + column, + lineContent: position ? model.getLineContent(position.lineNumber) : '' + } + }; + + const diagnostics = await this.getDiagnosticContext(editor); + + const fullContext = { + ...baseContext, + diagnostics + }; + + const contextValue = JSON.stringify(fullContext, undefined, 2); + + return { + variable: request.variable, + value: contextValue, // Simplified visible value + contextValue // Full detailed context for AI processing + }; + } + protected getDiagnosticContext(editor: MonacoEditor): Record { + const model = editor.getControl().getModel(); + if (!model) { + return {}; + } + + const markers = monaco.editor.getModelMarkers({ resource: model.uri }); + + if (markers.length === 0) { + return { + errorCount: 0, + warningCount: 0, + infoCount: 0, + hintCount: 0, + totalIssues: 0 + }; + } + + const issues: Array<{ + line: number; + column: number; + severity: string; + message: string; + source?: string; + }> = []; + + const markerCounter = { + [monaco.MarkerSeverity.Error]: 0, + [monaco.MarkerSeverity.Warning]: 0, + [monaco.MarkerSeverity.Info]: 0, + [monaco.MarkerSeverity.Hint]: 0 + }; + + markers.forEach(marker => { + markerCounter[marker.severity]++; + + issues.push({ + line: marker.startLineNumber, + column: marker.startColumn, + severity: this.severityToString(marker.severity), + message: marker.message, + source: marker.source + }); + }); + + return { + diagnosticCounts: { + errorCount: markerCounter[monaco.MarkerSeverity.Error], + warningCount: markerCounter[monaco.MarkerSeverity.Warning], + infoCount: markerCounter[monaco.MarkerSeverity.Info], + hintCount: markerCounter[monaco.MarkerSeverity.Hint] + }, + totalIssues: markers.length, + issues + }; + } + + protected severityToString(severity: monaco.MarkerSeverity): string { + switch (severity) { + case monaco.MarkerSeverity.Error: + return 'error'; + case monaco.MarkerSeverity.Warning: + return 'warning'; + case monaco.MarkerSeverity.Info: + return 'info'; + case monaco.MarkerSeverity.Hint: + return 'hint'; + default: + return 'unknown'; + } + } +} diff --git a/packages/ai-editor/src/browser/ai-editor-frontend-module.ts b/packages/ai-editor/src/browser/ai-editor-frontend-module.ts new file mode 100644 index 0000000..f59f3fd --- /dev/null +++ b/packages/ai-editor/src/browser/ai-editor-frontend-module.ts @@ -0,0 +1,56 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { AIVariableContribution } from '@theia/ai-core'; +import { FrontendApplicationContribution, KeybindingContribution } from '@theia/core/lib/browser'; +import { CommandContribution, MenuContribution } from '@theia/core/lib/common'; +import { ContainerModule } from '@theia/core/shared/inversify'; +import '../../style/ask-ai-input.css'; +import { AICodeActionProvider } from './ai-code-action-provider'; +import { AiEditorCommandContribution } from './ai-editor-command-contribution'; +import { EditorContextVariableContribution } from './ai-editor-context-variable'; +import { + AskAIInputArgs, + AskAIInputConfiguration, + AskAIInputFactory, + AskAIInputWidget +} from './ask-ai-input-widget'; + +export default new ContainerModule(bind => { + bind(AiEditorCommandContribution).toSelf().inSingletonScope(); + + bind(CommandContribution).toService(AiEditorCommandContribution); + bind(MenuContribution).toService(AiEditorCommandContribution); + bind(KeybindingContribution).toService(AiEditorCommandContribution); + + bind(AIVariableContribution).to(EditorContextVariableContribution).inSingletonScope(); + + bind(AICodeActionProvider).toSelf().inSingletonScope(); + bind(FrontendApplicationContribution).toService(AICodeActionProvider); + + bind(AskAIInputFactory).toFactory(ctx => (args: AskAIInputArgs) => { + const container = ctx.container.createChild(); + container.bind(AskAIInputArgs).toConstantValue(args); + container.bind(AskAIInputConfiguration).toConstantValue({ + showContext: true, + showPinnedAgent: true, + showChangeSet: false, + showSuggestions: false + } satisfies AskAIInputConfiguration); + container.bind(AskAIInputWidget).toSelf().inSingletonScope(); + return container.get(AskAIInputWidget); + }); +}); diff --git a/packages/ai-editor/src/browser/ask-ai-input-monaco-zone-widget.ts b/packages/ai-editor/src/browser/ask-ai-input-monaco-zone-widget.ts new file mode 100644 index 0000000..8eacff0 --- /dev/null +++ b/packages/ai-editor/src/browser/ask-ai-input-monaco-zone-widget.ts @@ -0,0 +1,114 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { ChatRequest } from '@theia/ai-chat'; +import { Disposable } from '@theia/core/lib/common/disposable'; +import { Emitter, Event } from '@theia/core/lib/common/event'; +import * as monaco from '@theia/monaco-editor-core'; +import { MonacoEditorZoneWidget } from '@theia/monaco/lib/browser/monaco-editor-zone-widget'; +import { AskAIInputFactory, AskAIInputWidget } from './ask-ai-input-widget'; + +/** + * A widget that shows the Ask AI input UI in a Monaco editor zone. + */ +export class AskAIInputMonacoZoneWidget extends MonacoEditorZoneWidget implements Disposable { + protected readonly inputWidget: AskAIInputWidget; + + protected readonly onSubmitEmitter = new Emitter(); + protected readonly onCancelEmitter = new Emitter(); + + readonly onSubmit: Event = this.onSubmitEmitter.event; + readonly onCancel: Event = this.onCancelEmitter.event; + + constructor( + editorInstance: monaco.editor.ICodeEditor, + inputWidgetFactory: AskAIInputFactory + ) { + super(editorInstance, false /* showArrow */); + + this.containerNode.classList.add('ask-ai-input-monaco-zone-widget'); + + this.inputWidget = inputWidgetFactory({ + onSubmit: event => this.handleSubmit(event), + onCancel: () => this.handleCancel() + }); + + this.inputWidget.onDidResize(() => this.adjustZoneHeight()); + + this.toDispose.pushAll([ + this.onSubmitEmitter, + this.onCancelEmitter, + this.inputWidget, + ]); + } + + override show(options: MonacoEditorZoneWidget.Options): void { + super.show(options); + this.renderReactWidget(); + this.registerListeners(); + } + + showAtLine(lineNumber: number): void { + const options: MonacoEditorZoneWidget.Options = { + afterLineNumber: lineNumber, + heightInLines: 5, + frameWidth: 1, + showFrame: true, + }; + this.show(options); + } + + protected renderReactWidget(): void { + this.containerNode.append(this.inputWidget.node); + this.inputWidget.activate(); + this.inputWidget.update(); + } + + protected adjustZoneHeight(): void { + if (!this.viewZone) { + return; + } + + const editorLineHeight = this.editor.getOption(monaco.editor.EditorOption.lineHeight); + const zoneWidgetHeight = this.inputWidget.node.parentElement ? this.inputWidget.node.parentElement.scrollHeight : this.inputWidget.node.scrollHeight; + + const requiredLines = Math.max(5, Math.ceil(zoneWidgetHeight / editorLineHeight)); + + if (this.viewZone.heightInLines !== requiredLines) { + this.layout(requiredLines); + } + } + + protected handleSubmit(request: ChatRequest): void { + this.onSubmitEmitter.fire(request); + this.hide(); + } + + protected handleCancel(): void { + this.onCancelEmitter.fire(); + this.hide(); + } + + protected registerListeners(): void { + this.toHide.push(this.editor.onKeyDown(e => { + if (e.keyCode === monaco.KeyCode.Escape) { + this.handleCancel(); + e.preventDefault(); + e.stopPropagation(); + } + })); + } +} diff --git a/packages/ai-editor/src/browser/ask-ai-input-widget.ts b/packages/ai-editor/src/browser/ask-ai-input-widget.ts new file mode 100644 index 0000000..651f1ad --- /dev/null +++ b/packages/ai-editor/src/browser/ask-ai-input-widget.ts @@ -0,0 +1,93 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { ChatRequest, MutableChatModel } from '@theia/ai-chat'; +import { AIChatInputConfiguration, AIChatInputWidget } from '@theia/ai-chat-ui/lib/browser/chat-input-widget'; +import { CHAT_VIEW_LANGUAGE_EXTENSION } from '@theia/ai-chat-ui/lib/browser/chat-view-language-contribution'; +import { generateUuid, URI } from '@theia/core'; +import { inject, injectable, optional, postConstruct } from '@theia/core/shared/inversify'; + +export const AskAIInputConfiguration = Symbol('AskAIInputConfiguration'); +export interface AskAIInputConfiguration extends AIChatInputConfiguration { } + +export const AskAIInputArgs = Symbol('AskAIInputArgs'); +export interface AskAIInputArgs { + onSubmit: (request: ChatRequest) => void; + onCancel: () => void; +} + +export const AskAIInputFactory = Symbol('AskAIInputFactory'); +export type AskAIInputFactory = (args: AskAIInputArgs) => AskAIInputWidget; + +/** + * React input widget for Ask AI functionality, extending the AIChatInputWidget. + */ +@injectable() +export class AskAIInputWidget extends AIChatInputWidget { + public static override ID = 'ask-ai-input-widget'; + + @inject(AskAIInputArgs) @optional() + protected readonly args: AskAIInputArgs | undefined; + + @inject(AskAIInputConfiguration) @optional() + protected override readonly configuration: AskAIInputConfiguration | undefined; + + protected readonly resourceId = generateUuid(); + protected override heightInLines = 3; + + @postConstruct() + protected override init(): void { + super.init(); + + this.id = AskAIInputWidget.ID; + + const noOp = () => { }; + // We need to set those values here, otherwise the widget will throw an error + this.onUnpin = noOp; + this.onCancel = noOp; + this.onDeleteChangeSet = noOp; + this.onDeleteChangeSetElement = noOp; + + // Create a temporary chat model for the widget + this.chatModel = new MutableChatModel(); + + this.setEnabled(true); + this.onQuery = this.handleSubmit.bind(this); + this.onCancel = this.handleCancel.bind(this); + } + + protected override getResourceUri(): URI { + return new URI(`ask-ai:/input-${this.resourceId}.${CHAT_VIEW_LANGUAGE_EXTENSION}`); + } + + protected handleSubmit(query: string): Promise { + const userInput = query.trim(); + if (userInput) { + const request: ChatRequest = { text: userInput, variables: this._chatModel.context.getVariables() }; + + this.args?.onSubmit(request); + } + return Promise.resolve(); + } + + protected handleCancel(): void { + this.args?.onCancel(); + } + + protected override onEscape(): void { + this.handleCancel(); + } +} diff --git a/packages/ai-editor/src/browser/index.ts b/packages/ai-editor/src/browser/index.ts new file mode 100644 index 0000000..70d10d1 --- /dev/null +++ b/packages/ai-editor/src/browser/index.ts @@ -0,0 +1,18 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +export * from './ai-editor-command-contribution'; +export * from './ask-ai-input-widget'; diff --git a/packages/ai-editor/src/package.spec.ts b/packages/ai-editor/src/package.spec.ts new file mode 100644 index 0000000..4be2a87 --- /dev/null +++ b/packages/ai-editor/src/package.spec.ts @@ -0,0 +1,28 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +/* note: this bogus test file is required so that + we are able to run mocha unit tests on this + package, without having any actual unit tests in it. + This way a coverage report will be generated, + showing 0% coverage, instead of no report. + This file can be removed once we have real unit + tests in place. */ + +describe('ai-editor package', () => { + + it('support code coverage statistics', () => true); +}); diff --git a/packages/ai-editor/style/ask-ai-input.css b/packages/ai-editor/style/ask-ai-input.css new file mode 100644 index 0000000..8dc4914 --- /dev/null +++ b/packages/ai-editor/style/ask-ai-input.css @@ -0,0 +1,26 @@ +/* + * Copyright (C) 2025 EclipseSource GmbH. + * + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the Eclipse + * Public License v. 2.0 are satisfied: GNU General Public License, version 2 + * with the GNU Classpath Exception which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 + */ + +.ask-ai-input-monaco-zone-widget { + background-color: var(--theia-editorWidget-background); + height: auto !important; +} + +.ask-ai-input-monaco-zone-widget .theia-ChatInput { + margin-top: 10px; + margin-left: 55px; + width: 75%; +} diff --git a/packages/ai-editor/tsconfig.json b/packages/ai-editor/tsconfig.json new file mode 100644 index 0000000..4c1a357 --- /dev/null +++ b/packages/ai-editor/tsconfig.json @@ -0,0 +1,37 @@ +{ + "extends": "../../configs/base.tsconfig", + "compilerOptions": { + "composite": true, + "rootDir": "src", + "outDir": "lib" + }, + "include": [ + "src" + ], + "references": [ + { + "path": "../ai-chat" + }, + { + "path": "../ai-chat-ui" + }, + { + "path": "../ai-core" + }, + { + "path": "../core" + }, + { + "path": "../editor" + }, + { + "path": "../filesystem" + }, + { + "path": "../monaco" + }, + { + "path": "../workspace" + } + ] +} diff --git a/packages/ai-google/.eslintrc.js b/packages/ai-google/.eslintrc.js new file mode 100644 index 0000000..b206be4 --- /dev/null +++ b/packages/ai-google/.eslintrc.js @@ -0,0 +1,10 @@ +/** @type {import('eslint').Linter.Config} */ +module.exports = { + extends: [ + '../../configs/build.eslintrc.json' + ], + parserOptions: { + tsconfigRootDir: __dirname, + project: 'tsconfig.json' + } +}; \ No newline at end of file diff --git a/packages/ai-google/README.md b/packages/ai-google/README.md new file mode 100644 index 0000000..b2d0126 --- /dev/null +++ b/packages/ai-google/README.md @@ -0,0 +1,33 @@ +
    + +
    + +theia-ext-logo + +

    ECLIPSE THEIA - AI GOOGLE EXTENSION

    + +
    + +
    + +## Description + +The `@theia/ai-google` integrates Google's models with Theia AI. +The Google API key and the models to use can be configured via preferences. +Alternatively the API key can also be handed in via the `GOOGLE_API_KEY` environment variable. + +## Additional Information + +- [API documentation for `@theia/ai-google`](https://eclipse-theia.github.io/theia/docs/next/modules/_theia_ai-google.html) +- [Theia - GitHub](https://github.com/eclipse-theia/theia) +- [Theia - Website](https://theia-ide.org/) + +## License + +- [Eclipse Public License 2.0](http://www.eclipse.org/legal/epl-2.0/) +- [一 (Secondary) GNU General Public License, version 2 with the GNU Classpath Exception](https://projects.eclipse.org/license/secondary-gpl-2.0-cp) + +## Trademark + +"Theia" is a trademark of the Eclipse Foundation + diff --git a/packages/ai-google/package.json b/packages/ai-google/package.json new file mode 100644 index 0000000..74a8b41 --- /dev/null +++ b/packages/ai-google/package.json @@ -0,0 +1,52 @@ +{ + "name": "@theia/ai-google", + "version": "1.68.0", + "description": "Theia - Google AI Integration", + "dependencies": { + "@google/genai": "^1.30.0", + "@theia/ai-core": "1.68.0", + "@theia/core": "1.68.0" + }, + "publishConfig": { + "access": "public" + }, + "theiaExtensions": [ + { + "frontend": "lib/browser/google-frontend-module", + "backend": "lib/node/google-backend-module" + } + ], + "keywords": [ + "theia-extension", + "ai", + "google", + "gemini" + ], + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "repository": { + "type": "git", + "url": "https://github.com/eclipse-theia/theia.git" + }, + "bugs": { + "url": "https://github.com/eclipse-theia/theia/issues" + }, + "homepage": "https://github.com/eclipse-theia/theia", + "files": [ + "lib", + "src" + ], + "scripts": { + "build": "theiaext build", + "clean": "theiaext clean", + "compile": "theiaext compile", + "lint": "theiaext lint", + "test": "theiaext test", + "watch": "theiaext watch" + }, + "devDependencies": { + "@theia/ext-scripts": "1.68.0" + }, + "nyc": { + "extends": "../../configs/nyc.json" + } +} diff --git a/packages/ai-google/src/browser/google-frontend-application-contribution.ts b/packages/ai-google/src/browser/google-frontend-application-contribution.ts new file mode 100644 index 0000000..f9da12c --- /dev/null +++ b/packages/ai-google/src/browser/google-frontend-application-contribution.ts @@ -0,0 +1,100 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { FrontendApplicationContribution } from '@theia/core/lib/browser'; +import { inject, injectable } from '@theia/core/shared/inversify'; +import { GoogleLanguageModelsManager, GoogleModelDescription } from '../common'; +import { API_KEY_PREF, MODELS_PREF, MAX_RETRIES, RETRY_DELAY_OTHER_ERRORS, RETRY_DELAY_RATE_LIMIT } from '../common/google-preferences'; +import { PreferenceService } from '@theia/core'; + +const GOOGLE_PROVIDER_ID = 'google'; + +@injectable() +export class GoogleFrontendApplicationContribution implements FrontendApplicationContribution { + + @inject(PreferenceService) + protected preferenceService: PreferenceService; + + @inject(GoogleLanguageModelsManager) + protected manager: GoogleLanguageModelsManager; + + protected prevModels: string[] = []; + + onStart(): void { + this.preferenceService.ready.then(() => { + const apiKey = this.preferenceService.get(API_KEY_PREF, undefined); + this.manager.setApiKey(apiKey); + + this.manager.setMaxRetriesOnErrors(this.preferenceService.get(MAX_RETRIES, 3)); + this.manager.setRetryDelayOnRateLimitError(this.preferenceService.get(RETRY_DELAY_RATE_LIMIT, 60)); + this.manager.setRetryDelayOnOtherErrors(this.preferenceService.get(RETRY_DELAY_OTHER_ERRORS, -1)); + + const models = this.preferenceService.get(MODELS_PREF, []); + this.manager.createOrUpdateLanguageModels(...models.map(modelId => this.createGeminiModelDescription(modelId))); + this.prevModels = [...models]; + + this.preferenceService.onPreferenceChanged(event => { + if (event.preferenceName === API_KEY_PREF) { + const newApiKey = this.preferenceService.get(API_KEY_PREF, undefined); + this.manager.setApiKey(newApiKey); + this.handleKeyChange(newApiKey); + } else if (event.preferenceName === MAX_RETRIES) { + this.manager.setMaxRetriesOnErrors(this.preferenceService.get(MAX_RETRIES, 3)); + } else if (event.preferenceName === RETRY_DELAY_RATE_LIMIT) { + this.manager.setRetryDelayOnRateLimitError(this.preferenceService.get(RETRY_DELAY_RATE_LIMIT, 60)); + } else if (event.preferenceName === RETRY_DELAY_OTHER_ERRORS) { + this.manager.setRetryDelayOnOtherErrors(this.preferenceService.get(RETRY_DELAY_OTHER_ERRORS, -1)); + } else if (event.preferenceName === MODELS_PREF) { + this.handleModelChanges(this.preferenceService.get(MODELS_PREF, [])); + } + }); + }); + } + + /** + * Called when the API key changes. Updates all Google models on the manager to ensure the new key is used. + */ + protected handleKeyChange(newApiKey: string | undefined): void { + if (this.prevModels && this.prevModels.length > 0) { + this.manager.createOrUpdateLanguageModels(...this.prevModels.map(modelId => this.createGeminiModelDescription(modelId))); + } + } + + protected handleModelChanges(newModels: string[]): void { + const oldModels = new Set(this.prevModels); + const updatedModels = new Set(newModels); + + const modelsToRemove = [...oldModels].filter(model => !updatedModels.has(model)); + const modelsToAdd = [...updatedModels].filter(model => !oldModels.has(model)); + + this.manager.removeLanguageModels(...modelsToRemove.map(model => `${GOOGLE_PROVIDER_ID}/${model}`)); + this.manager.createOrUpdateLanguageModels(...modelsToAdd.map(modelId => this.createGeminiModelDescription(modelId))); + this.prevModels = newModels; + } + + protected createGeminiModelDescription(modelId: string): GoogleModelDescription { + const id = `${GOOGLE_PROVIDER_ID}/${modelId}`; + + const description: GoogleModelDescription = { + id: id, + model: modelId, + apiKey: true, + enableStreaming: true + }; + + return description; + } +} diff --git a/packages/ai-google/src/browser/google-frontend-module.ts b/packages/ai-google/src/browser/google-frontend-module.ts new file mode 100644 index 0000000..836e530 --- /dev/null +++ b/packages/ai-google/src/browser/google-frontend-module.ts @@ -0,0 +1,32 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { ContainerModule } from '@theia/core/shared/inversify'; +import { GooglePreferencesSchema } from '../common/google-preferences'; +import { FrontendApplicationContribution, RemoteConnectionProvider, ServiceConnectionProvider } from '@theia/core/lib/browser'; +import { GoogleFrontendApplicationContribution } from './google-frontend-application-contribution'; +import { GOOGLE_LANGUAGE_MODELS_MANAGER_PATH, GoogleLanguageModelsManager } from '../common'; +import { PreferenceContribution } from '@theia/core'; + +export default new ContainerModule(bind => { + bind(PreferenceContribution).toConstantValue({ schema: GooglePreferencesSchema }); + bind(GoogleFrontendApplicationContribution).toSelf().inSingletonScope(); + bind(FrontendApplicationContribution).toService(GoogleFrontendApplicationContribution); + bind(GoogleLanguageModelsManager).toDynamicValue(ctx => { + const provider = ctx.container.get(RemoteConnectionProvider); + return provider.createProxy(GOOGLE_LANGUAGE_MODELS_MANAGER_PATH); + }).inSingletonScope(); +}); diff --git a/packages/ai-google/src/common/google-language-models-manager.ts b/packages/ai-google/src/common/google-language-models-manager.ts new file mode 100644 index 0000000..adf3e6e --- /dev/null +++ b/packages/ai-google/src/common/google-language-models-manager.ts @@ -0,0 +1,50 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** +export const GOOGLE_LANGUAGE_MODELS_MANAGER_PATH = '/services/google/language-model-manager'; +export const GoogleLanguageModelsManager = Symbol('GoogleLanguageModelsManager'); +export interface GoogleModelDescription { + /** + * The identifier of the model which will be shown in the UI. + */ + id: string; + /** + * The model ID as used by the Google Gemini API. + */ + model: string; + /** + * The key for the model. If 'true' is provided the global Gemini API key will be used. + */ + apiKey: string | true | undefined; + /** + * Indicate whether the streaming API shall be used. + */ + enableStreaming: boolean; + /** + * Maximum number of tokens to generate. Default is 4096. + */ + maxTokens?: number; + +} + +export interface GoogleLanguageModelsManager { + apiKey: string | undefined; + setApiKey(key: string | undefined): void; + setMaxRetriesOnErrors(maxRetries: number): void; + setRetryDelayOnRateLimitError(retryDelay: number): void; + setRetryDelayOnOtherErrors(retryDelay: number): void; + createOrUpdateLanguageModels(...models: GoogleModelDescription[]): Promise; + removeLanguageModels(...modelIds: string[]): void +} diff --git a/packages/ai-google/src/common/google-preferences.ts b/packages/ai-google/src/common/google-preferences.ts new file mode 100644 index 0000000..d838f43 --- /dev/null +++ b/packages/ai-google/src/common/google-preferences.ts @@ -0,0 +1,71 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { AI_CORE_PREFERENCES_TITLE } from '@theia/ai-core/lib/common/ai-core-preferences'; +import { nls, PreferenceSchema } from '@theia/core'; + +export const API_KEY_PREF = 'ai-features.google.apiKey'; +export const MODELS_PREF = 'ai-features.google.models'; +export const MAX_RETRIES = 'ai-features.google.maxRetriesOnErrors'; +export const RETRY_DELAY_RATE_LIMIT = 'ai-features.google.retryDelayOnRateLimitError'; +export const RETRY_DELAY_OTHER_ERRORS = 'ai-features.google.retryDelayOnOtherErrors'; + +export const GooglePreferencesSchema: PreferenceSchema = { + properties: { + [API_KEY_PREF]: { + type: 'string', + markdownDescription: nls.localize('theia/ai/google/apiKey/description', + 'Enter an API Key of your official Google AI (Gemini) Account. **Please note:** By using this preference the GOOGLE AI API key will be stored in clear text\ + on the machine running Theia. Use the environment variable `GOOGLE_API_KEY` to set the key securely.'), + title: AI_CORE_PREFERENCES_TITLE, + }, + [MODELS_PREF]: { + type: 'array', + description: nls.localize('theia/ai/google/models/description', 'Official Google Gemini models to use'), + title: AI_CORE_PREFERENCES_TITLE, + default: ['gemini-3-pro-preview', 'gemini-3-flash-preview', 'gemini-2.5-pro', 'gemini-2.5-flash'], + items: { + type: 'string' + } + }, + [MAX_RETRIES]: { + type: 'integer', + description: nls.localize('theia/ai/google/maxRetriesOnErrors/description', + 'Maximum number of retries in case of errors. If smaller than 1, then the retry logic is disabled'), + title: AI_CORE_PREFERENCES_TITLE, + default: 3, + minimum: 0 + }, + [RETRY_DELAY_RATE_LIMIT]: { + type: 'number', + description: nls.localize('theia/ai/google/retryDelayOnRateLimitError/description', + 'Delay in seconds between retries in case of rate limit errors. See https://ai.google.dev/gemini-api/docs/rate-limits'), + title: AI_CORE_PREFERENCES_TITLE, + default: 60, + minimum: 0 + }, + [RETRY_DELAY_OTHER_ERRORS]: { + type: 'number', + description: nls.localize('theia/ai/google/retryDelayOnOtherErrors/description', + 'Delay in seconds between retries in case of other errors (sometimes the Google GenAI reports errors such as incomplete JSON syntax returned from the model \ + or 500 Internal Server Error). Setting this to -1 prevents retries in these cases. Otherwise a retry happens either immediately (if set to 0) or after \ + this delay in seconds (if set to a positive number).'), + title: AI_CORE_PREFERENCES_TITLE, + default: -1, + minimum: -1 + } + } +}; diff --git a/packages/ai-google/src/common/index.ts b/packages/ai-google/src/common/index.ts new file mode 100644 index 0000000..a907086 --- /dev/null +++ b/packages/ai-google/src/common/index.ts @@ -0,0 +1,16 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** +export * from './google-language-models-manager'; diff --git a/packages/ai-google/src/node/google-backend-module.ts b/packages/ai-google/src/node/google-backend-module.ts new file mode 100644 index 0000000..6548133 --- /dev/null +++ b/packages/ai-google/src/node/google-backend-module.ts @@ -0,0 +1,36 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { ContainerModule } from '@theia/core/shared/inversify'; +import { GOOGLE_LANGUAGE_MODELS_MANAGER_PATH, GoogleLanguageModelsManager } from '../common/google-language-models-manager'; +import { ConnectionHandler, PreferenceContribution, RpcConnectionHandler } from '@theia/core'; +import { GoogleLanguageModelsManagerImpl } from './google-language-models-manager-impl'; +import { ConnectionContainerModule } from '@theia/core/lib/node/messaging/connection-container-module'; +import { GooglePreferencesSchema } from '../common/google-preferences'; + +// We use a connection module to handle AI services separately for each frontend. +const geminiConnectionModule = ConnectionContainerModule.create(({ bind, bindBackendService, bindFrontendService }) => { + bind(GoogleLanguageModelsManagerImpl).toSelf().inSingletonScope(); + bind(GoogleLanguageModelsManager).toService(GoogleLanguageModelsManagerImpl); + bind(ConnectionHandler).toDynamicValue(ctx => + new RpcConnectionHandler(GOOGLE_LANGUAGE_MODELS_MANAGER_PATH, () => ctx.container.get(GoogleLanguageModelsManager)) + ).inSingletonScope(); +}); + +export default new ContainerModule(bind => { + bind(PreferenceContribution).toConstantValue({ schema: GooglePreferencesSchema }); + bind(ConnectionContainerModule).toConstantValue(geminiConnectionModule); +}); diff --git a/packages/ai-google/src/node/google-language-model.ts b/packages/ai-google/src/node/google-language-model.ts new file mode 100644 index 0000000..2e99481 --- /dev/null +++ b/packages/ai-google/src/node/google-language-model.ts @@ -0,0 +1,524 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** +import { + createToolCallError, + ImageContent, + LanguageModel, + LanguageModelMessage, + LanguageModelRequest, + LanguageModelResponse, + LanguageModelStatus, + LanguageModelStreamResponse, + LanguageModelStreamResponsePart, + LanguageModelTextResponse, + TokenUsageService, + ToolCallResult, + ToolInvocationContext, + UserRequest +} from '@theia/ai-core'; +import { CancellationToken } from '@theia/core'; +import { GoogleGenAI, FunctionCallingConfigMode, FunctionDeclaration, Content, Schema, Part, Modality, FunctionResponse, ToolConfig } from '@google/genai'; +import { wait } from '@theia/core/lib/common/promise-util'; +import { GoogleLanguageModelRetrySettings } from './google-language-models-manager-impl'; +import { UUID } from '@theia/core/shared/@lumino/coreutils'; + +interface ToolCallback { + readonly name: string; + readonly id: string; + args: string; +} +/** + * Converts a tool call result to the Gemini FunctionResponse format. + * Gemini requires response to be an object, not an array or primitive. + */ +function toFunctionResponse(content: ToolCallResult): FunctionResponse['response'] { + if (content === undefined) { + return {}; + } + if (Array.isArray(content)) { + return { result: content }; + } + if (typeof content === 'object') { + return content as FunctionResponse['response']; + } + return { result: content }; +} + +const convertMessageToPart = (message: LanguageModelMessage): Part[] | undefined => { + if (LanguageModelMessage.isTextMessage(message) && message.text.length > 0) { + return [{ text: message.text }]; + } else if (LanguageModelMessage.isToolUseMessage(message)) { + return [{ + functionCall: { + id: message.id, name: message.name, args: message.input as Record + }, + thoughtSignature: message.data?.thoughtSignature, + }]; + } else if (LanguageModelMessage.isToolResultMessage(message)) { + return [{ functionResponse: { name: message.name, response: toFunctionResponse(message.content) } }]; + } else if (LanguageModelMessage.isThinkingMessage(message)) { + return [{ thought: true, text: message.thinking }]; + } else if (LanguageModelMessage.isImageMessage(message) && ImageContent.isBase64(message.image)) { + return [{ inlineData: { data: message.image.base64data, mimeType: message.image.mimeType } }]; + } +}; +/** + * Transforms Theia language model messages to Gemini API format + * @param messages Array of LanguageModelRequestMessage to transform + * @returns Object containing transformed messages and optional system message + */ +function transformToGeminiMessages( + messages: readonly LanguageModelMessage[] +): { contents: Content[]; systemMessage?: string } { + // Extract the system message (if any), as it is a separate parameter in the Gemini API. + const systemMessageObj = messages.find(message => message.actor === 'system'); + const systemMessage = systemMessageObj && LanguageModelMessage.isTextMessage(systemMessageObj) && systemMessageObj.text || undefined; + + const contents: Content[] = []; + + for (const message of messages) { + if (message.actor === 'system') { + continue; // Skip system messages as they're handled separately + } + const resultParts = convertMessageToPart(message); + if (resultParts === undefined) { + continue; + } + + const role = toGoogleRole(message); + const lastContent = contents.pop(); + + if (!lastContent) { + contents.push({ role, parts: resultParts }); + } else if (lastContent.role !== role) { + contents.push(lastContent); + contents.push({ role, parts: resultParts }); + } else { + lastContent?.parts?.push(...resultParts); + contents.push(lastContent); + } + + } + + return { + contents: contents, + systemMessage, + }; +} + +export const GoogleModelIdentifier = Symbol('GoogleModelIdentifier'); + +/** + * Converts Theia message actor to Gemini role + * @param message The message to convert + * @returns Gemini role ('user' or 'model') + */ +function toGoogleRole(message: LanguageModelMessage): 'user' | 'model' { + switch (message.actor) { + case 'ai': + return 'model'; + default: + return 'user'; + } +} + +/** + * Implements the Gemini language model integration for Theia + */ +export class GoogleModel implements LanguageModel { + + constructor( + public readonly id: string, + public model: string, + public status: LanguageModelStatus, + public enableStreaming: boolean, + public apiKey: () => string | undefined, + public retrySettings: () => GoogleLanguageModelRetrySettings, + protected readonly tokenUsageService?: TokenUsageService + ) { } + + protected getSettings(request: LanguageModelRequest): Readonly> { + return request.settings ?? {}; + } + + async request(request: UserRequest, cancellationToken?: CancellationToken): Promise { + if (!request.messages?.length) { + throw new Error('Request must contain at least one message'); + } + + const genAI = this.initializeGemini(); + + try { + if (this.enableStreaming) { + return this.handleStreamingRequest(genAI, request, cancellationToken); + } + return this.handleNonStreamingRequest(genAI, request); + } catch (error) { + const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred'; + throw new Error(`Gemini API request failed: ${errorMessage}`); + } + } + protected async handleStreamingRequest( + genAI: GoogleGenAI, + request: UserRequest, + cancellationToken?: CancellationToken, + toolMessages?: Content[] + ): Promise { + const settings = this.getSettings(request); + const { contents: parts, systemMessage } = transformToGeminiMessages(request.messages); + const functionDeclarations = this.createFunctionDeclarations(request); + + const toolConfig: ToolConfig = {}; + + if (functionDeclarations.length > 0) { + toolConfig.functionCallingConfig = { + mode: FunctionCallingConfigMode.AUTO, + }; + } + + // Wrap the API call in the retry mechanism + const stream = await this.withRetry(async () => + genAI.models.generateContentStream({ + model: this.model, + config: { + systemInstruction: systemMessage, + toolConfig, + responseModalities: [Modality.TEXT], + ...(functionDeclarations.length > 0 && { + tools: [{ + functionDeclarations + }] + }), + thinkingConfig: { + // https://ai.google.dev/gemini-api/docs/thinking#summaries + includeThoughts: true, + }, + temperature: 1, + ...settings + }, + contents: [...parts, ...(toolMessages ?? [])] + })); + + const that = this; + + const asyncIterator = { + async *[Symbol.asyncIterator](): AsyncIterator { + const toolCallMap: { [key: string]: ToolCallback } = {}; + const collectedParts: Part[] = []; + try { + for await (const chunk of stream) { + if (cancellationToken?.isCancellationRequested) { + break; + } + const finishReason = chunk.candidates?.[0].finishReason; + if (finishReason) { + switch (finishReason) { + // 'STOP' is the only valid (non-error) finishReason + // "Natural stop point of the model or provided stop sequence." + case 'STOP': + break; + // MALFORMED_FUNCTION_CALL: The model produced a malformed function call. + // Log warning but continue - there might still be usable text content. + case 'MALFORMED_FUNCTION_CALL': + console.warn('Gemini returned MALFORMED_FUNCTION_CALL finish reason.', { + finishReason, + candidate: chunk.candidates?.[0], + content: chunk.candidates?.[0]?.content, + parts: chunk.candidates?.[0]?.content?.parts, + text: chunk.text, + usageMetadata: chunk.usageMetadata + }); + break; + // All other reasons are error-cases. Throw an Error. + // e.g. SAFETY, MAX_TOKENS, RECITATION, LANGUAGE, ... + // https://ai.google.dev/api/generate-content#FinishReason + default: + console.error('Gemini streaming ended with unexpected finish reason:', { + finishReason, + candidate: chunk.candidates?.[0], + content: chunk.candidates?.[0]?.content, + parts: chunk.candidates?.[0]?.content?.parts, + safetyRatings: chunk.candidates?.[0]?.safetyRatings, + text: chunk.text, + usageMetadata: chunk.usageMetadata + }); + throw new Error(`Unexpected finish reason: ${finishReason}`); + } + } + // Handle thinking, text content, and function calls from parts + if (chunk.candidates?.[0]?.content?.parts) { + for (const part of chunk.candidates[0].content.parts) { + collectedParts.push(part); + if (part.text) { + if (part.thought) { + yield { thought: part.text, signature: part.thoughtSignature ?? '' }; + } else { + yield { content: part.text }; + } + } else if (part.functionCall) { + const functionCall = part.functionCall; + // Gemini does not always provide a function call ID (unlike Anthropic/OpenAI). + // We need a stable ID to track calls in toolCallMap and correlate results. + const callId = functionCall.id ?? UUID.uuid4().replace(/-/g, ''); + let toolCall = toolCallMap[callId]; + if (toolCall === undefined) { + toolCall = { + name: functionCall.name ?? '', + args: functionCall.args ? JSON.stringify(functionCall.args) : '{}', + id: callId, + }; + toolCallMap[callId] = toolCall; + + yield { + tool_calls: [{ + finished: false, + id: toolCall.id, + function: { + name: toolCall.name, + arguments: toolCall.args + }, + data: part.thoughtSignature ? { thoughtSignature: part.thoughtSignature } : undefined + }] + }; + } else { + // Update to existing tool call + toolCall.args = functionCall.args ? JSON.stringify(functionCall.args) : '{}'; + yield { + tool_calls: [{ + function: { + arguments: toolCall.args + }, + data: part.thoughtSignature ? { thoughtSignature: part.thoughtSignature } : undefined + }] + }; + } + } + } + } else if (chunk.text) { + yield { content: chunk.text }; + } + + // Report token usage if available + if (chunk.usageMetadata && that.tokenUsageService && that.id) { + const promptTokens = chunk.usageMetadata.promptTokenCount; + const completionTokens = chunk.usageMetadata.candidatesTokenCount; + if (promptTokens && completionTokens) { + that.tokenUsageService.recordTokenUsage(that.id, { + inputTokens: promptTokens, + outputTokens: completionTokens, + requestId: request.requestId + }).catch(error => console.error('Error recording token usage:', error)); + } + } + } + + // Process tool calls if any exist + const toolCalls = Object.values(toolCallMap); + if (toolCalls.length > 0) { + // Collect tool results + const toolResult = await Promise.all(toolCalls.map(async tc => { + const tool = request.tools?.find(t => t.name === tc.name); + let result; + if (!tool) { + result = createToolCallError(`Tool '${tc.name}' not found in the available tools for this request.`, 'tool-not-available'); + } else { + try { + result = await tool.handler(tc.args, ToolInvocationContext.create(tc.id)); + } catch (e) { + console.error(`Error executing tool ${tc.name}:`, e); + result = createToolCallError(e.message || 'Tool execution failed'); + } + } + return { + name: tc.name, + result: result, + id: tc.id, + arguments: tc.args, + }; + })); + + // Generate tool call responses + const calls = toolResult.map(tr => ({ + finished: true, + id: tr.id, + result: tr.result, + function: { name: tr.name, arguments: tr.arguments }, + })); + yield { tool_calls: calls }; + + // Format tool responses for Gemini + // According to Gemini docs, functionResponse needs name and response + const toolResponses: Part[] = toolResult.map(call => ({ + functionResponse: { + name: call.name, + response: toFunctionResponse(call.result) + } + })); + const responseMessage: Content = { role: 'user', parts: toolResponses }; + + // Build the model's response content from collected parts + // Exclude thinking parts as they should not be included in the conversation history sent back to the model + const modelResponseParts = collectedParts.filter(p => !p.thought); + const modelContent: Content = { role: 'model', parts: modelResponseParts }; + + const messages = [...(toolMessages ?? []), modelContent, responseMessage]; + + // Continue the conversation with tool results + const continuedResponse = await that.handleStreamingRequest( + genAI, + request, + cancellationToken, + messages + ); + + // Stream the continued response + for await (const nestedEvent of continuedResponse.stream) { + yield nestedEvent; + } + } + } catch (e) { + console.error('Error in Gemini streaming:', e); + throw e; + } + }, + }; + + return { stream: asyncIterator }; + } + + private createFunctionDeclarations(request: LanguageModelRequest): FunctionDeclaration[] { + if (!request.tools || request.tools.length === 0) { + return []; + } + + return request.tools.map(tool => ({ + name: tool.name, + description: tool.description, + parameters: (tool.parameters && Object.keys(tool.parameters.properties).length !== 0) ? tool.parameters as Schema : undefined + })); + } + + protected async handleNonStreamingRequest( + genAI: GoogleGenAI, + request: UserRequest + ): Promise { + const settings = this.getSettings(request); + const { contents: parts, systemMessage } = transformToGeminiMessages(request.messages); + const functionDeclarations = this.createFunctionDeclarations(request); + + // Wrap the API call in the retry mechanism + const model = await this.withRetry(async () => genAI.models.generateContent({ + model: this.model, + config: { + systemInstruction: systemMessage, + toolConfig: { + functionCallingConfig: { + mode: FunctionCallingConfigMode.AUTO, + } + }, + ...(functionDeclarations.length > 0 && { + tools: [{ functionDeclarations }] + }), + ...settings + }, + contents: parts + })); + + try { + let responseText = ''; + // For non streaming requests we are always only interested in text parts + if (model.candidates?.[0]?.content?.parts) { + for (const part of model.candidates[0].content.parts) { + if (part.text) { + responseText += part.text; + } + } + } else { + responseText = model.text ?? ''; + } + + // Record token usage if available + if (model.usageMetadata && this.tokenUsageService) { + const promptTokens = model.usageMetadata.promptTokenCount; + const completionTokens = model.usageMetadata.candidatesTokenCount; + if (promptTokens && completionTokens) { + await this.tokenUsageService.recordTokenUsage(this.id, { + inputTokens: promptTokens, + outputTokens: completionTokens, + requestId: request.requestId + }); + } + } + return { text: responseText }; + } catch (error) { + throw new Error(`Failed to get response from Gemini API: ${error instanceof Error ? error.message : 'Unknown error'}`); + } + } + + protected initializeGemini(): GoogleGenAI { + const apiKey = this.apiKey(); + if (!apiKey) { + throw new Error('Please provide GOOGLE_API_KEY in preferences or via environment variable'); + } + + // TODO test vertexai + return new GoogleGenAI({ apiKey, vertexai: false }); + } + + /** + * Implements a retry mechanism for the handle(non)Streaming request functions. + * @param fn the wrapped function to which the retry logic should be applied. + * @param retrySettings the configuration settings for the retry mechanism. + * @returns the result of the wrapped function. + */ + private async withRetry(fn: () => Promise): Promise { + const { maxRetriesOnErrors, retryDelayOnRateLimitError, retryDelayOnOtherErrors } = this.retrySettings(); + + for (let i = 0; i <= maxRetriesOnErrors; i++) { + try { + return await fn(); + } catch (error) { + if (i === maxRetriesOnErrors) { + // no retries left - throw the original error + throw error; + } + + const message = (error as Error).message; + // Check for rate limit exhaustion (usually, there is a rate limit per minute, so we can retry after a delay...) + if (message && message.includes('429 Too Many Requests')) { + if (retryDelayOnRateLimitError < 0) { + // rate limit error should not retried because of the setting + throw error; + } + + const delayMs = retryDelayOnRateLimitError * 1000; + console.warn(`Received 429 (Too Many Requests). Retrying in ${retryDelayOnRateLimitError}s. Attempt ${i + 1} of ${maxRetriesOnErrors}.`); + await wait(delayMs); + } else if (retryDelayOnOtherErrors < 0) { + // Other errors should not retried because of the setting + throw error; + } else { + const delayMs = retryDelayOnOtherErrors * 1000; + console.warn(`Request failed: ${message}. Retrying in ${retryDelayOnOtherErrors}s. Attempt ${i + 1} of ${maxRetriesOnErrors}.`); + await wait(delayMs); + } + // -> reiterate the loop for the next attempt + } + } + // This should not be reached + throw new Error('Retry mechanism failed unexpectedly.'); + } +} diff --git a/packages/ai-google/src/node/google-language-models-manager-impl.ts b/packages/ai-google/src/node/google-language-models-manager-impl.ts new file mode 100644 index 0000000..4c89d43 --- /dev/null +++ b/packages/ai-google/src/node/google-language-models-manager-impl.ts @@ -0,0 +1,121 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { LanguageModelRegistry, LanguageModelStatus, TokenUsageService } from '@theia/ai-core'; +import { inject, injectable } from '@theia/core/shared/inversify'; +import { GoogleModel } from './google-language-model'; +import { GoogleLanguageModelsManager, GoogleModelDescription } from '../common'; + +export interface GoogleLanguageModelRetrySettings { + maxRetriesOnErrors: number; + retryDelayOnRateLimitError: number; + retryDelayOnOtherErrors: number; +} + +@injectable() +export class GoogleLanguageModelsManagerImpl implements GoogleLanguageModelsManager { + protected _apiKey: string | undefined; + protected retrySettings: GoogleLanguageModelRetrySettings = { + maxRetriesOnErrors: 3, + retryDelayOnRateLimitError: 60, + retryDelayOnOtherErrors: -1 + }; + + @inject(LanguageModelRegistry) + protected readonly languageModelRegistry: LanguageModelRegistry; + + @inject(TokenUsageService) + protected readonly tokenUsageService: TokenUsageService; + + get apiKey(): string | undefined { + return this._apiKey ?? process.env.GOOGLE_API_KEY ?? process.env.GEMINI_API_KEY; + } + + protected calculateStatus(effectiveApiKey: string | undefined): LanguageModelStatus { + return effectiveApiKey + ? { status: 'ready' } + : { status: 'unavailable', message: 'No Google API key set' }; + } + + async createOrUpdateLanguageModels(...modelDescriptions: GoogleModelDescription[]): Promise { + for (const modelDescription of modelDescriptions) { + const model = await this.languageModelRegistry.getLanguageModel(modelDescription.id); + const apiKeyProvider = () => { + if (modelDescription.apiKey === true) { + return this.apiKey; + } + if (modelDescription.apiKey) { + return modelDescription.apiKey; + } + return undefined; + }; + const retrySettingsProvider = () => this.retrySettings; + + // Determine the effective API key for status + const status = this.calculateStatus(apiKeyProvider()); + + if (model) { + if (!(model instanceof GoogleModel)) { + console.warn(`Gemini: model ${modelDescription.id} is not a Gemini model`); + continue; + } + await this.languageModelRegistry.patchLanguageModel(modelDescription.id, { + model: modelDescription.model, + enableStreaming: modelDescription.enableStreaming, + apiKey: apiKeyProvider, + retrySettings: retrySettingsProvider, + status + }); + } else { + this.languageModelRegistry.addLanguageModels([ + new GoogleModel( + modelDescription.id, + modelDescription.model, + status, + modelDescription.enableStreaming, + apiKeyProvider, + retrySettingsProvider, + this.tokenUsageService + ) + ]); + } + } + } + + removeLanguageModels(...modelIds: string[]): void { + this.languageModelRegistry.removeLanguageModels(modelIds); + } + + setApiKey(apiKey: string | undefined): void { + if (apiKey) { + this._apiKey = apiKey; + } else { + this._apiKey = undefined; + } + } + + setMaxRetriesOnErrors(maxRetries: number): void { + this.retrySettings.maxRetriesOnErrors = maxRetries; + } + + setRetryDelayOnRateLimitError(retryDelay: number): void { + this.retrySettings.retryDelayOnRateLimitError = retryDelay; + } + + setRetryDelayOnOtherErrors(retryDelay: number): void { + this.retrySettings.retryDelayOnOtherErrors = retryDelay; + } +} diff --git a/packages/ai-google/src/package.spec.ts b/packages/ai-google/src/package.spec.ts new file mode 100644 index 0000000..252dc4f --- /dev/null +++ b/packages/ai-google/src/package.spec.ts @@ -0,0 +1,28 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +/* note: this bogus test file is required so that + we are able to run mocha unit tests on this + package, without having any actual unit tests in it. + This way a coverage report will be generated, + showing 0% coverage, instead of no report. + This file can be removed once we have real unit + tests in place. */ + +describe('ai-google package', () => { + + it('support code coverage statistics', () => true); +}); diff --git a/packages/ai-google/tsconfig.json b/packages/ai-google/tsconfig.json new file mode 100644 index 0000000..420367f --- /dev/null +++ b/packages/ai-google/tsconfig.json @@ -0,0 +1,19 @@ +{ + "extends": "../../configs/base.tsconfig", + "compilerOptions": { + "composite": true, + "rootDir": "src", + "outDir": "lib" + }, + "include": [ + "src" + ], + "references": [ + { + "path": "../ai-core" + }, + { + "path": "../core" + } + ] +} diff --git a/packages/ai-history/.eslintrc.js b/packages/ai-history/.eslintrc.js new file mode 100644 index 0000000..1308994 --- /dev/null +++ b/packages/ai-history/.eslintrc.js @@ -0,0 +1,10 @@ +/** @type {import('eslint').Linter.Config} */ +module.exports = { + extends: [ + '../../configs/build.eslintrc.json' + ], + parserOptions: { + tsconfigRootDir: __dirname, + project: 'tsconfig.json' + } +}; diff --git a/packages/ai-history/README.md b/packages/ai-history/README.md new file mode 100644 index 0000000..ca2472f --- /dev/null +++ b/packages/ai-history/README.md @@ -0,0 +1,32 @@ +
    + +
    + +theia-ext-logo + +

    ECLIPSE THEIA - AI HISTORY EXTENSION

    + +
    + +
    + +## Description + +The `@theia/ai-history` extension offers a framework for agents to record their requests and responses. +It also offers a view to inspect the history. + +## Additional Information + +- [API documentation for `@theia/ai-history`](https://eclipse-theia.github.io/theia/docs/next/modules/_theia_ai-history.html) +- [Theia - GitHub](https://github.com/eclipse-theia/theia) +- [Theia - Website](https://theia-ide.org/) + +## License + +- [Eclipse Public License 2.0](http://www.eclipse.org/legal/epl-2.0/) +- [一 (Secondary) GNU General Public License, version 2 with the GNU Classpath Exception](https://projects.eclipse.org/license/secondary-gpl-2.0-cp) + +## Trademark + +"Theia" is a trademark of the Eclipse Foundation + diff --git a/packages/ai-history/package.json b/packages/ai-history/package.json new file mode 100644 index 0000000..6c767f3 --- /dev/null +++ b/packages/ai-history/package.json @@ -0,0 +1,54 @@ +{ + "name": "@theia/ai-history", + "version": "1.68.0", + "description": "Theia - AI communication history", + "dependencies": { + "@theia/ai-core": "1.68.0", + "@theia/ai-chat-ui": "1.68.0", + "@theia/core": "1.68.0", + "@theia/filesystem": "1.68.0", + "@theia/output": "1.68.0", + "@theia/workspace": "1.68.0", + "tslib": "^2.6.2" + }, + "main": "lib/common", + "publishConfig": { + "access": "public" + }, + "theiaExtensions": [ + { + "frontend": "lib/browser/ai-history-frontend-module" + } + ], + "keywords": [ + "theia-extension" + ], + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "repository": { + "type": "git", + "url": "https://github.com/eclipse-theia/theia.git" + }, + "bugs": { + "url": "https://github.com/eclipse-theia/theia/issues" + }, + "homepage": "https://github.com/eclipse-theia/theia", + "files": [ + "lib", + "src" + ], + "scripts": { + "build": "theiaext build", + "clean": "theiaext clean", + "compile": "theiaext compile", + "lint": "theiaext lint", + "test": "theiaext test", + "watch": "theiaext watch" + }, + "devDependencies": { + "@theia/ext-scripts": "1.68.0" + }, + "nyc": { + "extends": "../../configs/nyc.json" + }, + "gitHead": "21358137e41342742707f660b8e222f940a27652" +} diff --git a/packages/ai-history/src/browser/ai-history-contribution.ts b/packages/ai-history/src/browser/ai-history-contribution.ts new file mode 100644 index 0000000..1d2b5ee --- /dev/null +++ b/packages/ai-history/src/browser/ai-history-contribution.ts @@ -0,0 +1,240 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** +import { FrontendApplication, codicon } from '@theia/core/lib/browser'; +import { AIViewContribution } from '@theia/ai-core/lib/browser'; +import { inject, injectable } from '@theia/core/shared/inversify'; +import { AIHistoryView } from './ai-history-widget'; +import { Command, CommandRegistry, Emitter, nls } from '@theia/core'; +import { TabBarToolbarContribution, TabBarToolbarRegistry } from '@theia/core/lib/browser/shell/tab-bar-toolbar'; +import { LanguageModelService } from '@theia/ai-core'; +import { ChatViewWidget } from '@theia/ai-chat-ui/lib/browser/chat-view-widget'; + +export const AI_HISTORY_TOGGLE_COMMAND_ID = 'aiHistory:toggle'; +export const OPEN_AI_HISTORY_VIEW = Command.toLocalizedCommand({ + id: 'aiHistory:open', + label: 'Open AI History view', +}); + +export const AI_HISTORY_VIEW_SORT_CHRONOLOGICALLY = Command.toLocalizedCommand({ + id: 'aiHistory:sortChronologically', + label: 'AI History: Sort chronologically', + iconClass: codicon('arrow-down') +}); + +export const AI_HISTORY_VIEW_SORT_REVERSE_CHRONOLOGICALLY = Command.toLocalizedCommand({ + id: 'aiHistory:sortReverseChronologically', + label: 'AI History: Sort reverse chronologically', + iconClass: codicon('arrow-up') +}); + +export const AI_HISTORY_VIEW_TOGGLE_COMPACT = Command.toLocalizedCommand({ + id: 'aiHistory:toggleCompact', + label: 'AI History: Toggle compact view', + iconClass: codicon('list-flat') +}); + +export const AI_HISTORY_VIEW_TOGGLE_RAW = Command.toLocalizedCommand({ + id: 'aiHistory:toggleRaw', + label: 'AI History: Toggle raw view', + iconClass: codicon('list-tree') +}); + +export const AI_HISTORY_VIEW_TOGGLE_RENDER_NEWLINES = Command.toLocalizedCommand({ + id: 'aiHistory:toggleRenderNewlines', + label: 'AI History: Interpret newlines', + iconClass: codicon('newline') +}); + +export const AI_HISTORY_VIEW_TOGGLE_HIDE_NEWLINES = Command.toLocalizedCommand({ + id: 'aiHistory:toggleHideNewlines', + label: 'AI History: Stop interpreting newlines', + iconClass: codicon('no-newline') +}); + +export const AI_HISTORY_VIEW_CLEAR = Command.toLocalizedCommand({ + id: 'aiHistory:clear', + label: 'AI History: Clear History', + iconClass: codicon('clear-all') +}); + +@injectable() +export class AIHistoryViewContribution extends AIViewContribution implements TabBarToolbarContribution { + @inject(LanguageModelService) private languageModelService: LanguageModelService; + + protected readonly chronologicalChangedEmitter = new Emitter(); + protected readonly chronologicalStateChanged = this.chronologicalChangedEmitter.event; + + protected readonly compactViewChangedEmitter = new Emitter(); + protected readonly compactViewStateChanged = this.compactViewChangedEmitter.event; + + protected readonly renderNewlinesChangedEmitter = new Emitter(); + protected readonly renderNewlinesStateChanged = this.renderNewlinesChangedEmitter.event; + + constructor() { + super({ + widgetId: AIHistoryView.ID, + widgetName: AIHistoryView.LABEL, + defaultWidgetOptions: { + area: 'bottom', + rank: 100 + }, + toggleCommandId: AI_HISTORY_TOGGLE_COMMAND_ID, + }); + } + + async initializeLayout(_app: FrontendApplication): Promise { + await this.openView(); + } + + override registerCommands(registry: CommandRegistry): void { + super.registerCommands(registry); + registry.registerCommand(OPEN_AI_HISTORY_VIEW, { + execute: () => this.openView({ activate: true }), + }); + registry.registerCommand(AI_HISTORY_VIEW_SORT_CHRONOLOGICALLY, { + isEnabled: widget => this.withHistoryWidget(widget, historyView => !historyView.isChronological), + isVisible: widget => this.withHistoryWidget(widget, historyView => !historyView.isChronological), + execute: widget => this.withHistoryWidget(widget, historyView => { + historyView.sortHistory(true); + this.chronologicalChangedEmitter.fire(); + return true; + }) + }); + registry.registerCommand(AI_HISTORY_VIEW_SORT_REVERSE_CHRONOLOGICALLY, { + isEnabled: widget => this.withHistoryWidget(widget, historyView => historyView.isChronological), + isVisible: widget => this.withHistoryWidget(widget, historyView => historyView.isChronological), + execute: widget => this.withHistoryWidget(widget, historyView => { + historyView.sortHistory(false); + this.chronologicalChangedEmitter.fire(); + return true; + }) + }); + registry.registerCommand(AI_HISTORY_VIEW_TOGGLE_COMPACT, { + isEnabled: widget => this.withHistoryWidget(widget), + isVisible: widget => this.withHistoryWidget(widget, historyView => !historyView.isCompactView), + execute: widget => this.withHistoryWidget(widget, historyView => { + historyView.toggleCompactView(); + this.compactViewChangedEmitter.fire(); + return true; + }) + }); + registry.registerCommand(AI_HISTORY_VIEW_TOGGLE_RAW, { + isEnabled: widget => this.withHistoryWidget(widget), + isVisible: widget => this.withHistoryWidget(widget, historyView => historyView.isCompactView), + execute: widget => this.withHistoryWidget(widget, historyView => { + historyView.toggleCompactView(); + this.compactViewChangedEmitter.fire(); + return true; + }) + }); + registry.registerCommand(AI_HISTORY_VIEW_TOGGLE_RENDER_NEWLINES, { + isEnabled: widget => this.withHistoryWidget(widget), + isVisible: widget => this.withHistoryWidget(widget, historyView => !historyView.isRenderNewlines), + execute: widget => this.withHistoryWidget(widget, historyView => { + historyView.toggleRenderNewlines(); + this.renderNewlinesChangedEmitter.fire(); + return true; + }) + }); + registry.registerCommand(AI_HISTORY_VIEW_TOGGLE_HIDE_NEWLINES, { + isEnabled: widget => this.withHistoryWidget(widget), + isVisible: widget => this.withHistoryWidget(widget, historyView => historyView.isRenderNewlines), + execute: widget => this.withHistoryWidget(widget, historyView => { + historyView.toggleRenderNewlines(); + this.renderNewlinesChangedEmitter.fire(); + return true; + }) + }); + registry.registerCommand(AI_HISTORY_VIEW_CLEAR, { + isEnabled: widget => this.withHistoryWidget(widget), + isVisible: widget => this.withHistoryWidget(widget), + execute: widget => this.withHistoryWidget(widget, () => { + this.clearHistory(); + return true; + }) + }); + } + public clearHistory(): void { + this.languageModelService.sessions = []; + } + + protected withHistoryWidget( + widget: unknown = this.tryGetWidget(), + predicate: (output: AIHistoryView) => boolean = () => true + ): boolean | false { + return widget instanceof AIHistoryView ? predicate(widget) : false; + } + + registerToolbarItems(registry: TabBarToolbarRegistry): void { + registry.registerItem({ + id: AI_HISTORY_VIEW_SORT_CHRONOLOGICALLY.id, + command: AI_HISTORY_VIEW_SORT_CHRONOLOGICALLY.id, + tooltip: nls.localize('theia/ai/history/sortChronologically/tooltip', 'Sort chronologically'), + isVisible: widget => this.withHistoryWidget(widget), + onDidChange: this.chronologicalStateChanged + }); + registry.registerItem({ + id: AI_HISTORY_VIEW_SORT_REVERSE_CHRONOLOGICALLY.id, + command: AI_HISTORY_VIEW_SORT_REVERSE_CHRONOLOGICALLY.id, + tooltip: nls.localize('theia/ai/history/sortReverseChronologically/tooltip', 'Sort reverse chronologically'), + isVisible: widget => this.withHistoryWidget(widget), + onDidChange: this.chronologicalStateChanged + }); + registry.registerItem({ + id: AI_HISTORY_VIEW_TOGGLE_COMPACT.id, + command: AI_HISTORY_VIEW_TOGGLE_COMPACT.id, + tooltip: nls.localize('theia/ai/history/toggleCompact/tooltip', 'Show compact view'), + isVisible: widget => this.withHistoryWidget(widget, historyView => !historyView.isCompactView), + onDidChange: this.compactViewStateChanged + }); + registry.registerItem({ + id: AI_HISTORY_VIEW_TOGGLE_RAW.id, + command: AI_HISTORY_VIEW_TOGGLE_RAW.id, + tooltip: nls.localize('theia/ai/history/toggleRaw/tooltip', 'Show raw view'), + isVisible: widget => this.withHistoryWidget(widget, historyView => historyView.isCompactView), + onDidChange: this.compactViewStateChanged + }); + registry.registerItem({ + id: AI_HISTORY_VIEW_TOGGLE_RENDER_NEWLINES.id, + command: AI_HISTORY_VIEW_TOGGLE_RENDER_NEWLINES.id, + tooltip: nls.localize('theia/ai/history/toggleRenderNewlines/tooltip', 'Interpret newlines'), + isVisible: widget => this.withHistoryWidget(widget, historyView => !historyView.isRenderNewlines), + onDidChange: this.renderNewlinesStateChanged + }); + registry.registerItem({ + id: AI_HISTORY_VIEW_TOGGLE_HIDE_NEWLINES.id, + command: AI_HISTORY_VIEW_TOGGLE_HIDE_NEWLINES.id, + tooltip: nls.localize('theia/ai/history/toggleHideNewlines/tooltip', 'Stop interpreting newlines'), + isVisible: widget => this.withHistoryWidget(widget, historyView => historyView.isRenderNewlines), + onDidChange: this.renderNewlinesStateChanged + }); + registry.registerItem({ + id: AI_HISTORY_VIEW_CLEAR.id, + command: AI_HISTORY_VIEW_CLEAR.id, + tooltip: nls.localize('theia/ai/history/clear/tooltip', 'Clear History of all agents'), + isVisible: widget => this.withHistoryWidget(widget) + }); + // Register the AI History view command for the chat view + registry.registerItem({ + id: 'chat-view.' + OPEN_AI_HISTORY_VIEW.id, + command: OPEN_AI_HISTORY_VIEW.id, + tooltip: nls.localize('theia/ai/history/open-history-tooltip', 'Open AI history...'), + group: 'ai-settings', + priority: 1, + isVisible: widget => this.activationService.isActive && widget instanceof ChatViewWidget + }); + } +} diff --git a/packages/ai-history/src/browser/ai-history-exchange-card.tsx b/packages/ai-history/src/browser/ai-history-exchange-card.tsx new file mode 100644 index 0000000..a57badc --- /dev/null +++ b/packages/ai-history/src/browser/ai-history-exchange-card.tsx @@ -0,0 +1,253 @@ +// ***************************************************************************** +// Copyright (C) 2025 STMicroelectronics and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** +import { + LanguageModelExchangeRequest, + LanguageModelExchange, + LanguageModelMonitoredStreamResponse, + LanguageModelExchangeRequestResponse +} from '@theia/ai-core/lib/common/language-model-interaction-model'; +import { nls } from '@theia/core'; +import * as React from '@theia/core/shared/react'; + +const getTextFromResponse = (response: LanguageModelExchangeRequestResponse): string => { + // Handle monitored stream response + if ('parts' in response) { + let result = ''; + for (const chunk of response.parts) { + if ('content' in chunk && chunk.content) { + result += chunk.content; + } + } + return result; + } + + // Handle text response + if ('text' in response) { + return response.text; + } + + // Handle parsed response + if ('content' in response) { + return response.content; + } + + return JSON.stringify(response); +}; + +const renderTextWithNewlines = (text: string): React.ReactNode => text.split(/\\n|\n/).map((line, i) => ( + + {i > 0 &&
    } + {line} +
    +)); + +const formatJson = (data: unknown): string => { + try { + return JSON.stringify(data, undefined, 2); + } catch (error) { + console.error('Error formatting JSON:', error); + return 'Error formatting data'; + } +}; + +const formatTimestamp = (timestamp: number | undefined): string => + timestamp ? new Date(timestamp).toLocaleString(undefined, { + year: 'numeric', + month: 'short', + day: 'numeric', + hour: '2-digit', + minute: '2-digit', + second: '2-digit' + }) : 'N/A'; + +export interface ExchangeCardProps { + exchange: LanguageModelExchange; + selectedAgentId?: string; + compactView?: boolean; + renderNewlines?: boolean; +} + +export const ExchangeCard: React.FC = ({ exchange, selectedAgentId, compactView = true, renderNewlines = false }) => { + + const earliestTimestamp = exchange.requests.reduce((earliest, req) => { + const timestamp = req.metadata.timestamp as number || 0; + return timestamp && (!earliest || timestamp < earliest) ? timestamp : earliest; + }, 0); + + return ( +
    +
    + + {nls.localizeByDefault('ID')}: {exchange.id} + + {exchange.metadata.agent && ( + + {nls.localize('theia/ai/history/exchange-card/agentId', 'Agent')}: {exchange.metadata.agent} + + )} +
    +
    +
    + {exchange.requests.map((request, index) => ( + + ))} +
    +
    +
    + {earliestTimestamp > 0 && ( + + {nls.localize('theia/ai/history/exchange-card/timestamp', 'Started')}: {formatTimestamp(earliestTimestamp)} + + )} +
    +
    + ); +}; + +interface RequestCardProps { + request: LanguageModelExchangeRequest; + index: number; + totalRequests: number; + selectedAgentId?: string; + compactView?: boolean; + renderNewlines?: boolean; +} + +const RequestCard: React.FC = ({ request, index, totalRequests, selectedAgentId, compactView = true, renderNewlines = false }) => { + const isFromDifferentAgent = selectedAgentId && + request.metadata.agent && + request.metadata.agent !== selectedAgentId; + + const isStreamResponse = 'parts' in request.response; + + const getRequestContent = () => { + if (compactView) { + const content = formatJson(request.request.messages); + return ( +
    +
    +                        {renderNewlines ? renderTextWithNewlines(content) : content}
    +                    
    +
    + ); + } else { + const content = formatJson(request.request); + return ( +
    +                    {renderNewlines ? renderTextWithNewlines(content) : content}
    +                
    + ); + } + }; + + const getResponseContent = () => { + if (compactView) { + const content = getTextFromResponse(request.response); + return ( +
    +
    +                        {renderNewlines ? renderTextWithNewlines(content) : content}
    +                    
    +
    + ); + } else if (isStreamResponse) { + const streamResponse = request.response as LanguageModelMonitoredStreamResponse; + return streamResponse.parts.map((part, i) => ( +
    +
    +                        {renderNewlines ? renderTextWithNewlines(JSON.stringify(part, undefined, 2)) : JSON.stringify(part, undefined, 2)}
    +                    
    +
    + )); + } else { + const content = formatJson(request.response); + return ( +
    +                    {renderNewlines ? renderTextWithNewlines(content) : content}
    +                
    + ); + } + }; + + return ( +
    +
    + {totalRequests > 1 && ( +

    {nls.localize('theia/ai/history/request-card/title', 'Request')} {index + 1}

    + )} +
    + ID: {request.id} + {request.metadata.agent && ( + + {nls.localize('theia/ai/history/request-card/agent', 'Agent')}: {request.metadata.agent} + + )} + + {nls.localize('theia/ai/history/request-card/model', 'Model')}: {request.languageModel} + + {!!request.metadata.promptVariantId && ( + + {!!request.metadata.isPromptVariantCustomized && ( + + [{nls.localize('theia/ai/history/edited', 'edited')}]{' '} + + )} + {nls.localize('theia/ai/history/request-card/promptVariant', 'Prompt Variant')}: {request.metadata.promptVariantId as string} + + )} +
    +
    + +
    +
    + + {nls.localize('theia/ai/history/request-card/request', 'Request')} + +
    + {getRequestContent()} +
    +
    + +
    + + {nls.localize('theia/ai/history/request-card/response', 'Response')} + +
    + {getResponseContent()} +
    +
    +
    + +
    + {request.metadata.timestamp && ( + + {nls.localize('theia/ai/history/request-card/timestamp', 'Timestamp')}: {formatTimestamp(request.metadata.timestamp as number)} + + )} +
    +
    + ); +}; diff --git a/packages/ai-history/src/browser/ai-history-frontend-module.ts b/packages/ai-history/src/browser/ai-history-frontend-module.ts new file mode 100644 index 0000000..35227e7 --- /dev/null +++ b/packages/ai-history/src/browser/ai-history-frontend-module.ts @@ -0,0 +1,32 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** +import { ContainerModule } from '@theia/core/shared/inversify'; +import { bindViewContribution, WidgetFactory } from '@theia/core/lib/browser'; +import { AIHistoryViewContribution } from './ai-history-contribution'; +import { AIHistoryView } from './ai-history-widget'; +import '../../src/browser/style/ai-history.css'; +import { TabBarToolbarContribution } from '@theia/core/lib/browser/shell/tab-bar-toolbar'; + +export default new ContainerModule(bind => { + bindViewContribution(bind, AIHistoryViewContribution); + + bind(AIHistoryView).toSelf(); + bind(WidgetFactory).toDynamicValue(context => ({ + id: AIHistoryView.ID, + createWidget: () => context.container.get(AIHistoryView) + })).inSingletonScope(); + bind(TabBarToolbarContribution).toService(AIHistoryViewContribution); +}); diff --git a/packages/ai-history/src/browser/ai-history-widget.tsx b/packages/ai-history/src/browser/ai-history-widget.tsx new file mode 100644 index 0000000..760d238 --- /dev/null +++ b/packages/ai-history/src/browser/ai-history-widget.tsx @@ -0,0 +1,194 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** +import { Agent, AgentService, LanguageModelService, SessionEvent } from '@theia/ai-core'; +import { LanguageModelExchange } from '@theia/ai-core/lib/common/language-model-interaction-model'; +import { codicon, ReactWidget, StatefulWidget } from '@theia/core/lib/browser'; +import { inject, injectable, postConstruct } from '@theia/core/shared/inversify'; +import * as React from '@theia/core/shared/react'; +import { ExchangeCard } from './ai-history-exchange-card'; +import { SelectComponent, SelectOption } from '@theia/core/lib/browser/widgets/select-component'; +import { deepClone, nls } from '@theia/core'; + +namespace AIHistoryView { + export interface State { + chronological: boolean; + compactView: boolean; + renderNewlines: boolean; + selectedAgentId?: string; + } +} + +@injectable() +export class AIHistoryView extends ReactWidget implements StatefulWidget { + @inject(LanguageModelService) + protected languageModelService: LanguageModelService; + @inject(AgentService) + protected readonly agentService: AgentService; + + public static ID = 'ai-history-widget'; + static LABEL = nls.localize('theia/ai/history/view/label', 'AI Agent History [Beta]'); + + protected _state: AIHistoryView.State = { chronological: false, compactView: true, renderNewlines: true }; + + constructor() { + super(); + this.id = AIHistoryView.ID; + this.title.label = AIHistoryView.LABEL; + this.title.caption = AIHistoryView.LABEL; + this.title.closable = true; + this.title.iconClass = codicon('history'); + } + + protected get state(): AIHistoryView.State { + return this._state; + } + + protected set state(state: AIHistoryView.State) { + this._state = state; + this.update(); + } + + storeState(): object { + return this.state; + } + + restoreState(oldState: object & Partial): void { + const copy = deepClone(this.state); + if (oldState.chronological !== undefined) { + copy.chronological = oldState.chronological; + } + if (oldState.compactView !== undefined) { + copy.compactView = oldState.compactView; + } + if (oldState.renderNewlines !== undefined) { + copy.renderNewlines = oldState.renderNewlines; + } + this.state = copy; + } + + @postConstruct() + protected init(): void { + this.update(); + this.toDispose.push(this.languageModelService.onSessionChanged((event: SessionEvent) => this.historyContentUpdated(event))); + this.selectAgent(this.agentService.getAllAgents()[0]); + } + + protected selectAgent(agent: Agent | undefined): void { + this.state = { ...this.state, selectedAgentId: agent?.id }; + } + + protected historyContentUpdated(event: SessionEvent): void { + this.update(); + } + + render(): React.ReactNode { + const selectionChange = (value: SelectOption) => { + this.selectAgent(this.agentService.getAllAgents().find(agent => agent.id === value.value)); + }; + const agents = this.agentService.getAllAgents(); + if (agents.length === 0) { + return ( +
    +
    {nls.localize('theia/ai/history/view/noAgent', 'No agent available.')}
    +
    ); + } + return ( +
    + ({ + value: agent.id, + label: agent.name, + description: agent.description || '' + }))} + onChange={selectionChange} + defaultValue={this.state.selectedAgentId} /> +
    + {this.renderHistory()} +
    +
    + ); + } + + protected renderHistory(): React.ReactNode { + if (!this.state.selectedAgentId) { + return
    {nls.localize('theia/ai/history/view/noAgentSelected', 'No agent selected.')}
    ; + } + + const exchanges = this.getExchangesByAgent(this.state.selectedAgentId); + + if (exchanges.length === 0) { + const selectedAgent = this.agentService.getAllAgents().find(agent => agent.id === this.state.selectedAgentId); + return
    + {nls.localize('theia/ai/history/view/noHistoryForAgent', 'No history available for the selected agent \'{0}\'', selectedAgent?.name || this.state.selectedAgentId)} +
    ; + } + + // Sort exchanges by timestamp (using the first sub-request's timestamp) + const sortedExchanges = [...exchanges].sort((a, b) => { + const aTimestamp = a.requests[0]?.metadata.timestamp as number || 0; + const bTimestamp = b.requests[0]?.metadata.timestamp as number || 0; + return this.state.chronological ? aTimestamp - bTimestamp : bTimestamp - aTimestamp; + }); + + return sortedExchanges.map(exchange => ( + + )); + } + + /** + * Get all exchanges for a specific agent. + * Includes all exchanges in which the agent is involved, either as the main exchange or as a sub-request. + * @param agentId The agent ID to filter by + */ + protected getExchangesByAgent(agentId: string): LanguageModelExchange[] { + return this.languageModelService.sessions.flatMap(session => + session.exchanges.filter(exchange => + exchange.metadata.agent === agentId || + exchange.requests.some(request => request.metadata.agent === agentId) + ) + ); + } + + public sortHistory(chronological: boolean): void { + this.state = { ...deepClone(this.state), chronological: chronological }; + } + + public toggleCompactView(): void { + this.state = { ...deepClone(this.state), compactView: !this.state.compactView }; + } + + public toggleRenderNewlines(): void { + this.state = { ...deepClone(this.state), renderNewlines: !this.state.renderNewlines }; + } + + get isChronological(): boolean { + return this.state.chronological === true; + } + + get isCompactView(): boolean { + return this.state.compactView === true; + } + + get isRenderNewlines(): boolean { + return this.state.renderNewlines === true; + } +} diff --git a/packages/ai-history/src/browser/style/ai-history.css b/packages/ai-history/src/browser/style/ai-history.css new file mode 100644 index 0000000..fcdcf21 --- /dev/null +++ b/packages/ai-history/src/browser/style/ai-history.css @@ -0,0 +1,237 @@ +.agent-history-widget { + display: flex; + flex-direction: column; + align-items: center; +} + +.agent-history-widget .theia-select-component { + margin: 10px 0; + width: 80%; +} + +.agent-history { + width: calc(80% + 16px); + display: flex; + align-items: center; + flex-direction: column; +} + +.theia-card { + background-color: var(--theia-sideBar-background); + border: 1px solid var(--theia-sideBarSectionHeader-border); + box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); + padding: 15px; + margin: 10px 0; + width: 100%; + box-sizing: border-box; +} + +.theia-card-meta { + display: flex; + justify-content: space-between; + font-size: 0.9em; + padding: var(--theia-ui-padding) 0; +} + +.theia-card-content { + color: var(--theia-font-color); + margin-bottom: 10px; +} + +.theia-card-content h3 { + font-size: var(--theia-ui-font-size1); + font-weight: bold; +} + +.theia-card-content pre { + border-radius: 4px; + border: 1px solid var(--theia-sideBarSectionHeader-border); + background-color: var(--theia-terminal-background); + overflow: visible; + padding: 10px; + margin: 5px 0; +} + +.theia-card-request-id, +.theia-card-timestamp { + flex: 1; + text-align: left; +} + +.exchange-card { + border-radius: 6px; + transition: box-shadow 0.3s ease; +} + +.requests-container { + display: flex; + flex-direction: column; + gap: 15px; + width: 100%; + overflow: visible; +} + +/* Request Card Styles */ +.request-card { + background-color: var(--theia-editor-background); + border: 1px solid var(--theia-sideBarSectionHeader-border); + border-radius: 4px; + padding: 12px; + margin-bottom: 15px; + transition: box-shadow 0.3s ease; +} + +.request-header { + display: flex; + flex-direction: column; + margin-bottom: 10px; + padding-bottom: 8px; + border-bottom: 1px solid var(--theia-sideBarSectionHeader-border); +} + +.request-header h3 { + margin: 0 0 8px 0; +} + +.request-info { + display: flex; + flex-wrap: wrap; + gap: 12px; + align-items: center; +} + +.request-id, +.request-agent, +.request-model, +.request-prompt-variant { + font-size: 0.9em; + color: var(--theia-descriptionForeground); + white-space: nowrap; + padding: 2px 6px; + background-color: var(--theia-editor-inactiveSelectionBackground); + border-radius: 3px; +} + +.request-prompt-variant.customized { + color: var(--theia-editorWarning-foreground); + background-color: var(--theia-inputValidation-warningBackground); + border: 1px solid var(--theia-editorWarning-foreground); +} + +.request-content-container { + width: 100%; + overflow: visible; +} + +.request-content-container details { + margin-bottom: 10px; + border: 1px solid var(--theia-editorWidget-border); + border-radius: 4px; +} + +.request-content-container summary { + padding: 8px 12px; + background-color: var(--theia-editorWidget-background); + cursor: pointer; + font-weight: bold; + display: block; /* Make the entire summary clickable */ +} + +.request-content-container summary:hover { + background-color: var(--theia-list-hoverBackground); +} + +.request-content, +.response-content { + padding: 10px; + overflow: visible; +} + +.request-content-container details { + margin-bottom: 15px; +} + +.request-content-container summary { + padding: 10px 15px; + font-size: 1em; + transition: background-color 0.2s ease; +} + +.stream-part { + margin-bottom: 8px; + padding-bottom: 8px; + border-bottom: 1px dashed var(--theia-sideBarSectionHeader-border); +} + +.stream-part:last-child { + border-bottom: none; +} + +.compact-response { + padding: 8px; + background-color: var(--theia-editor-background); + border-radius: 4px; +} + +.formatted-json { + white-space: pre-wrap; + word-break: break-word; + font-family: var(--theia-ui-font-family-monospace); + font-size: var(--theia-code-font-size); + line-height: var(--theia-code-line-height); + color: var(--theia-editor-foreground); +} + +.formatted-json.render-newlines { + white-space: pre-wrap; +} + +.request-content-container summary::before { + content: '▶'; + display: inline-block; + margin-right: 8px; + transition: transform 0.2s; + font-size: 0.8em; +} + +.request-content-container details[open] summary::before { + transform: rotate(90deg); +} + +.theia-card-agent-id { + flex: 1; + text-align: right; + font-weight: bold; +} + +.request-card.different-agent-opacity { + opacity: 0.7; +} + +.request-agent.different-agent-name { + font-style: italic; + color: var(--theia-notificationsWarningIcon-foreground); +} + +/* Request meta information */ +.request-meta { + display: flex; + justify-content: space-between; + font-size: 0.85em; + color: var(--theia-descriptionForeground); + margin-top: 10px; + padding-top: 8px; + border-top: 1px solid var(--theia-sideBarSectionHeader-border); +} + +.no-content { + padding: 15px; + color: var(--theia-descriptionForeground); + text-align: center; + font-style: italic; +} + +.request-timestamp { + font-size: 0.85em; + color: var(--theia-descriptionForeground); +} diff --git a/packages/ai-history/src/common/index.ts b/packages/ai-history/src/common/index.ts new file mode 100644 index 0000000..d2078cf --- /dev/null +++ b/packages/ai-history/src/common/index.ts @@ -0,0 +1,16 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + diff --git a/packages/ai-history/src/package.spec.ts b/packages/ai-history/src/package.spec.ts new file mode 100644 index 0000000..a4353d4 --- /dev/null +++ b/packages/ai-history/src/package.spec.ts @@ -0,0 +1,28 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +/* note: this bogus test file is required so that + we are able to run mocha unit tests on this + package, without having any actual unit tests in it. + This way a coverage report will be generated, + showing 0% coverage, instead of no report. + This file can be removed once we have real unit + tests in place. */ + +describe('ai-history package', () => { + + it('support code coverage statistics', () => true); +}); diff --git a/packages/ai-history/tsconfig.json b/packages/ai-history/tsconfig.json new file mode 100644 index 0000000..c392db7 --- /dev/null +++ b/packages/ai-history/tsconfig.json @@ -0,0 +1,31 @@ +{ + "extends": "../../configs/base.tsconfig", + "compilerOptions": { + "composite": true, + "rootDir": "src", + "outDir": "lib" + }, + "include": [ + "src" + ], + "references": [ + { + "path": "../ai-chat-ui" + }, + { + "path": "../ai-core" + }, + { + "path": "../core" + }, + { + "path": "../filesystem" + }, + { + "path": "../output" + }, + { + "path": "../workspace" + } + ] +} diff --git a/packages/ai-hugging-face/.eslintrc.js b/packages/ai-hugging-face/.eslintrc.js new file mode 100644 index 0000000..1308994 --- /dev/null +++ b/packages/ai-hugging-face/.eslintrc.js @@ -0,0 +1,10 @@ +/** @type {import('eslint').Linter.Config} */ +module.exports = { + extends: [ + '../../configs/build.eslintrc.json' + ], + parserOptions: { + tsconfigRootDir: __dirname, + project: 'tsconfig.json' + } +}; diff --git a/packages/ai-hugging-face/README.md b/packages/ai-hugging-face/README.md new file mode 100644 index 0000000..9c3472d --- /dev/null +++ b/packages/ai-hugging-face/README.md @@ -0,0 +1,33 @@ +
    + +
    + +theia-ext-logo + +

    ECLIPSE THEIA - HUGGING FACE AI EXTENSION

    + +
    + +
    + +## Description + +The `@theia/ai-huggingface` integrates Hugging Face's models with Theia AI. +The Hugging Face API key and the models to use can be configured via preferences. +Alternatively, the Hugging Face API key can also be provided via the `HUGGINGFACE_API_KEY` environment variable. + +## Additional Information + +- [API documentation for `@theia/ai-huggingface`](https://eclipse-theia.github.io/theia/docs/next/modules/_theia_ai-huggingface.html) +- [Theia - GitHub](https://github.com/eclipse-theia/theia) +- [Theia - Website](https://theia-ide.org/) + +## License + +- [Eclipse Public License 2.0](http://www.eclipse.org/legal/epl-2.0/) +- [一 (Secondary) GNU General Public License, version 2 with the GNU Classpath Exception](https://projects.eclipse.org/license/secondary-gpl-2.0-cp) + +## Trademark + +"Theia" is a trademark of the Eclipse Foundation + diff --git a/packages/ai-hugging-face/package.json b/packages/ai-hugging-face/package.json new file mode 100644 index 0000000..90a12d9 --- /dev/null +++ b/packages/ai-hugging-face/package.json @@ -0,0 +1,50 @@ +{ + "name": "@theia/ai-huggingface", + "version": "1.68.0", + "description": "Theia - Hugging Face Integration", + "dependencies": { + "@huggingface/inference": "^4.13.10", + "@theia/ai-core": "1.68.0", + "@theia/core": "1.68.0" + }, + "publishConfig": { + "access": "public" + }, + "theiaExtensions": [ + { + "frontend": "lib/browser/huggingface-frontend-module", + "backend": "lib/node/huggingface-backend-module" + } + ], + "keywords": [ + "theia-extension" + ], + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "repository": { + "type": "git", + "url": "https://github.com/eclipse-theia/theia.git" + }, + "bugs": { + "url": "https://github.com/eclipse-theia/theia/issues" + }, + "homepage": "https://github.com/eclipse-theia/theia", + "files": [ + "lib", + "src" + ], + "scripts": { + "build": "theiaext build", + "clean": "theiaext clean", + "compile": "theiaext compile", + "lint": "theiaext lint", + "test": "theiaext test", + "watch": "theiaext watch" + }, + "devDependencies": { + "@theia/ext-scripts": "1.68.0" + }, + "nyc": { + "extends": "../../configs/nyc.json" + }, + "gitHead": "21358137e41342742707f660b8e222f940a27652" +} diff --git a/packages/ai-hugging-face/src/browser/huggingface-frontend-application-contribution.ts b/packages/ai-hugging-face/src/browser/huggingface-frontend-application-contribution.ts new file mode 100644 index 0000000..08cc441 --- /dev/null +++ b/packages/ai-hugging-face/src/browser/huggingface-frontend-application-contribution.ts @@ -0,0 +1,86 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { FrontendApplicationContribution } from '@theia/core/lib/browser'; +import { inject, injectable } from '@theia/core/shared/inversify'; +import { HuggingFaceLanguageModelsManager, HuggingFaceModelDescription } from '../common'; +import { API_KEY_PREF, MODELS_PREF } from '../common/huggingface-preferences'; +import { PreferenceService } from '@theia/core'; + +const HUGGINGFACE_PROVIDER_ID = 'huggingface'; +@injectable() +export class HuggingFaceFrontendApplicationContribution implements FrontendApplicationContribution { + + @inject(PreferenceService) + protected preferenceService: PreferenceService; + + @inject(HuggingFaceLanguageModelsManager) + protected manager: HuggingFaceLanguageModelsManager; + + protected prevModels: string[] = []; + + onStart(): void { + this.preferenceService.ready.then(() => { + const apiKey = this.preferenceService.get(API_KEY_PREF, undefined); + this.manager.setApiKey(apiKey); + + const models = this.preferenceService.get(MODELS_PREF, []); + this.manager.createOrUpdateLanguageModels(...models.map(modelId => this.createHuggingFaceModelDescription(modelId))); + this.prevModels = [...models]; + + this.preferenceService.onPreferenceChanged(event => { + if (event.preferenceName === API_KEY_PREF) { + const newApiKey = this.preferenceService.get(API_KEY_PREF, undefined); + this.manager.setApiKey(newApiKey); + this.handleKeyChange(newApiKey); + } else if (event.preferenceName === MODELS_PREF) { + this.handleModelChanges(this.preferenceService.get(MODELS_PREF, [])); + } + }); + }); + } + + protected handleModelChanges(newModels: string[]): void { + const oldModels = new Set(this.prevModels); + const updatedModels = new Set(newModels); + + const modelsToRemove = [...oldModels].filter(model => !updatedModels.has(model)); + const modelsToAdd = [...updatedModels].filter(model => !oldModels.has(model)); + + this.manager.removeLanguageModels(...modelsToRemove.map(model => `${HUGGINGFACE_PROVIDER_ID}/${model}`)); + this.manager.createOrUpdateLanguageModels(...modelsToAdd.map(modelId => this.createHuggingFaceModelDescription(modelId))); + this.prevModels = newModels; + } + + /** + * Called when the API key changes. Updates all HuggingFace models on the manager to ensure the new key is used. + */ + protected handleKeyChange(newApiKey: string | undefined): void { + if (this.prevModels && this.prevModels.length > 0) { + this.manager.createOrUpdateLanguageModels(...this.prevModels.map(modelId => this.createHuggingFaceModelDescription(modelId))); + } + } + + protected createHuggingFaceModelDescription( + modelId: string + ): HuggingFaceModelDescription { + const id = `${HUGGINGFACE_PROVIDER_ID}/${modelId}`; + return { + id: id, + model: modelId + }; + } +} diff --git a/packages/ai-hugging-face/src/browser/huggingface-frontend-module.ts b/packages/ai-hugging-face/src/browser/huggingface-frontend-module.ts new file mode 100644 index 0000000..aa13944 --- /dev/null +++ b/packages/ai-hugging-face/src/browser/huggingface-frontend-module.ts @@ -0,0 +1,32 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { ContainerModule } from '@theia/core/shared/inversify'; +import { HuggingFacePreferencesSchema } from '../common/huggingface-preferences'; +import { FrontendApplicationContribution, RemoteConnectionProvider, ServiceConnectionProvider } from '@theia/core/lib/browser'; +import { HuggingFaceFrontendApplicationContribution } from './huggingface-frontend-application-contribution'; +import { HUGGINGFACE_LANGUAGE_MODELS_MANAGER_PATH, HuggingFaceLanguageModelsManager } from '../common'; +import { PreferenceContribution } from '@theia/core'; + +export default new ContainerModule(bind => { + bind(PreferenceContribution).toConstantValue({ schema: HuggingFacePreferencesSchema }); + bind(HuggingFaceFrontendApplicationContribution).toSelf().inSingletonScope(); + bind(FrontendApplicationContribution).toService(HuggingFaceFrontendApplicationContribution); + bind(HuggingFaceLanguageModelsManager).toDynamicValue(ctx => { + const provider = ctx.container.get(RemoteConnectionProvider); + return provider.createProxy(HUGGINGFACE_LANGUAGE_MODELS_MANAGER_PATH); + }).inSingletonScope(); +}); diff --git a/packages/ai-hugging-face/src/common/huggingface-language-models-manager.ts b/packages/ai-hugging-face/src/common/huggingface-language-models-manager.ts new file mode 100644 index 0000000..a199373 --- /dev/null +++ b/packages/ai-hugging-face/src/common/huggingface-language-models-manager.ts @@ -0,0 +1,36 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +export const HUGGINGFACE_LANGUAGE_MODELS_MANAGER_PATH = '/services/huggingface/language-model-manager'; +export const HuggingFaceLanguageModelsManager = Symbol('HuggingFaceLanguageModelsManager'); + +export interface HuggingFaceModelDescription { + /** + * The identifier of the model which will be shown in the UI. + */ + id: string; + /** + * The model ID as used by the Hugging Face API. + */ + model: string; +} + +export interface HuggingFaceLanguageModelsManager { + apiKey: string | undefined; + setApiKey(key: string | undefined): void; + createOrUpdateLanguageModels(...models: HuggingFaceModelDescription[]): Promise; + removeLanguageModels(...modelIds: string[]): void; +} diff --git a/packages/ai-hugging-face/src/common/huggingface-preferences.ts b/packages/ai-hugging-face/src/common/huggingface-preferences.ts new file mode 100644 index 0000000..444efdb --- /dev/null +++ b/packages/ai-hugging-face/src/common/huggingface-preferences.ts @@ -0,0 +1,46 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { AI_CORE_PREFERENCES_TITLE } from '@theia/ai-core/lib/common/ai-core-preferences'; +import { nls, PreferenceSchema } from '@theia/core'; + +export const API_KEY_PREF = 'ai-features.huggingFace.apiKey'; +export const MODELS_PREF = 'ai-features.huggingFace.models'; + +export const HuggingFacePreferencesSchema: PreferenceSchema = { + properties: { + [API_KEY_PREF]: { + type: 'string', + markdownDescription: nls.localize('theia/ai/huggingFace/apiKey/mdDescription', + 'Enter an API Key for your Hugging Face Account. **Please note:** By using this preference the Hugging Face API key will be stored in clear text\ + on the machine running Theia. Use the environment variable `HUGGINGFACE_API_KEY` to set the key securely.'), + title: AI_CORE_PREFERENCES_TITLE, + tags: ['experimental'] + }, + [MODELS_PREF]: { + type: 'array', + markdownDescription: nls.localize('theia/ai/huggingFace/models/mdDescription', + 'Hugging Face models to use. **Please note:** Only models supporting the chat completion API are supported \ + (instruction-tuned models like `*-Instruct`) currently. Some models may require accepting license terms on the Hugging Face website.'), + title: AI_CORE_PREFERENCES_TITLE, + default: ['meta-llama/Llama-3.2-3B-Instruct', 'meta-llama/Llama-3.1-8B-Instruct'], + items: { + type: 'string' + }, + tags: ['experimental'] + } + } +}; diff --git a/packages/ai-hugging-face/src/common/index.ts b/packages/ai-hugging-face/src/common/index.ts new file mode 100644 index 0000000..9fe3e98 --- /dev/null +++ b/packages/ai-hugging-face/src/common/index.ts @@ -0,0 +1,16 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** +export * from './huggingface-language-models-manager'; diff --git a/packages/ai-hugging-face/src/node/huggingface-backend-module.ts b/packages/ai-hugging-face/src/node/huggingface-backend-module.ts new file mode 100644 index 0000000..e8f3196 --- /dev/null +++ b/packages/ai-hugging-face/src/node/huggingface-backend-module.ts @@ -0,0 +1,38 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { ContainerModule } from '@theia/core/shared/inversify'; +import { HUGGINGFACE_LANGUAGE_MODELS_MANAGER_PATH, HuggingFaceLanguageModelsManager } from '../common/huggingface-language-models-manager'; +import { ConnectionHandler, PreferenceContribution, RpcConnectionHandler } from '@theia/core'; +import { ConnectionContainerModule } from '@theia/core/lib/node/messaging/connection-container-module'; +import { HuggingFaceLanguageModelsManagerImpl } from './huggingface-language-models-manager-impl'; +import { HuggingFacePreferencesSchema } from '../common/huggingface-preferences'; + +export const HuggingFaceModelFactory = Symbol('HuggingFaceModelFactory'); + +// We use a connection module to handle AI services separately for each frontend. +const huggingfaceConnectionModule = ConnectionContainerModule.create(({ bind, bindBackendService, bindFrontendService }) => { + bind(HuggingFaceLanguageModelsManagerImpl).toSelf().inSingletonScope(); + bind(HuggingFaceLanguageModelsManager).toService(HuggingFaceLanguageModelsManagerImpl); + bind(ConnectionHandler).toDynamicValue(ctx => + new RpcConnectionHandler(HUGGINGFACE_LANGUAGE_MODELS_MANAGER_PATH, () => ctx.container.get(HuggingFaceLanguageModelsManager)) + ).inSingletonScope(); +}); + +export default new ContainerModule(bind => { + bind(PreferenceContribution).toConstantValue({ schema: HuggingFacePreferencesSchema }); + bind(ConnectionContainerModule).toConstantValue(huggingfaceConnectionModule); +}); diff --git a/packages/ai-hugging-face/src/node/huggingface-language-model.ts b/packages/ai-hugging-face/src/node/huggingface-language-model.ts new file mode 100644 index 0000000..66bee8d --- /dev/null +++ b/packages/ai-hugging-face/src/node/huggingface-language-model.ts @@ -0,0 +1,148 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { + LanguageModel, + LanguageModelRequest, + LanguageModelMessage, + LanguageModelResponse, + LanguageModelStreamResponsePart, + LanguageModelTextResponse, + MessageActor, + LanguageModelStatus +} from '@theia/ai-core'; +import { CancellationToken } from '@theia/core'; +import { InferenceClient } from '@huggingface/inference'; + +export const HuggingFaceModelIdentifier = Symbol('HuggingFaceModelIdentifier'); + +function toRole(actor: MessageActor): 'user' | 'assistant' | 'system' { + switch (actor) { + case 'user': + return 'user'; + case 'ai': + return 'assistant'; + case 'system': + return 'system'; + default: + return 'user'; + } +} + +function toChatMessages(messages: LanguageModelMessage[]): Array<{ role: 'user' | 'assistant' | 'system'; content: string }> { + return messages + .filter(LanguageModelMessage.isTextMessage) + .map(message => ({ + role: toRole(message.actor), + content: message.text + })); +} + +export class HuggingFaceModel implements LanguageModel { + + /** + * @param id the unique id for this language model. It will be used to identify the model in the UI. + * @param model the model id as it is used by the Hugging Face API + * @param apiKey function to retrieve the API key for Hugging Face + */ + constructor( + public readonly id: string, + public model: string, + public status: LanguageModelStatus, + public apiKey: () => string | undefined, + public readonly name?: string, + public readonly vendor?: string, + public readonly version?: string, + public readonly family?: string, + public readonly maxInputTokens?: number, + public readonly maxOutputTokens?: number + ) { } + + async request(request: LanguageModelRequest, cancellationToken?: CancellationToken): Promise { + const hfInference = this.initializeInferenceClient(); + if (this.isStreamingSupported(this.model)) { + return this.handleStreamingRequest(hfInference, request, cancellationToken); + } else { + return this.handleNonStreamingRequest(hfInference, request); + } + } + + protected getSettings(request: LanguageModelRequest): Record { + return request.settings ?? {}; + } + + protected async handleNonStreamingRequest(hfInference: InferenceClient, request: LanguageModelRequest): Promise { + const settings = this.getSettings(request); + + const response = await hfInference.chatCompletion({ + model: this.model, + messages: toChatMessages(request.messages), + ...settings + }); + + const text = response.choices[0]?.message?.content ?? ''; + + return { + text + }; + } + + protected async handleStreamingRequest( + hfInference: InferenceClient, + request: LanguageModelRequest, + cancellationToken?: CancellationToken + ): Promise { + + const settings = this.getSettings(request); + + const stream = hfInference.chatCompletionStream({ + model: this.model, + messages: toChatMessages(request.messages), + ...settings + }); + + const asyncIterator = { + async *[Symbol.asyncIterator](): AsyncIterator { + for await (const chunk of stream) { + const content = chunk.choices[0]?.delta?.content; + + if (content !== undefined) { + yield { content }; + } + + if (cancellationToken?.isCancellationRequested) { + break; + } + } + } + }; + + return { stream: asyncIterator }; + } + + protected isStreamingSupported(model: string): boolean { + // Assuming all models support streaming for now; can be refined if needed + return true; + } + + private initializeInferenceClient(): InferenceClient { + const token = this.apiKey(); + if (!token) { + throw new Error('Please provide a Hugging Face API token.'); + } + return new InferenceClient(token); + } +} diff --git a/packages/ai-hugging-face/src/node/huggingface-language-models-manager-impl.ts b/packages/ai-hugging-face/src/node/huggingface-language-models-manager-impl.ts new file mode 100644 index 0000000..842b59e --- /dev/null +++ b/packages/ai-hugging-face/src/node/huggingface-language-models-manager-impl.ts @@ -0,0 +1,76 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { LanguageModelRegistry, LanguageModelStatus } from '@theia/ai-core'; +import { inject, injectable } from '@theia/core/shared/inversify'; +import { HuggingFaceModel } from './huggingface-language-model'; +import { HuggingFaceLanguageModelsManager, HuggingFaceModelDescription } from '../common'; + +@injectable() +export class HuggingFaceLanguageModelsManagerImpl implements HuggingFaceLanguageModelsManager { + + protected _apiKey: string | undefined; + + @inject(LanguageModelRegistry) + protected readonly languageModelRegistry: LanguageModelRegistry; + + get apiKey(): string | undefined { + return this._apiKey ?? process.env.HUGGINGFACE_API_KEY; + } + + protected calculateStatus(apiKey: string | undefined): LanguageModelStatus { + return apiKey ? { status: 'ready' } : { status: 'unavailable', message: 'No Hugging Face API key set' }; + } + + async createOrUpdateLanguageModels(...modelDescriptions: HuggingFaceModelDescription[]): Promise { + for (const modelDescription of modelDescriptions) { + const model = await this.languageModelRegistry.getLanguageModel(modelDescription.id); + const apiKeyProvider = () => this.apiKey; + const status = this.calculateStatus(this.apiKey); + + if (model) { + if (!(model instanceof HuggingFaceModel)) { + console.warn(`Hugging Face: model ${modelDescription.id} is not a Hugging Face model`); + continue; + } + await this.languageModelRegistry.patchLanguageModel(modelDescription.id, { status }); + } else { + this.languageModelRegistry.addLanguageModels([ + new HuggingFaceModel( + modelDescription.id, + modelDescription.model, + status, + apiKeyProvider, + undefined, + undefined, + undefined, + undefined, + undefined, + undefined, + ) + ]); + } + } + } + + removeLanguageModels(...modelIds: string[]): void { + this.languageModelRegistry.removeLanguageModels(modelIds); + } + + setApiKey(apiKey: string | undefined): void { + this._apiKey = apiKey || undefined; + } +} diff --git a/packages/ai-hugging-face/src/package.spec.ts b/packages/ai-hugging-face/src/package.spec.ts new file mode 100644 index 0000000..8f56895 --- /dev/null +++ b/packages/ai-hugging-face/src/package.spec.ts @@ -0,0 +1,28 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +/* note: this bogus test file is required so that + we are able to run mocha unit tests on this + package, without having any actual unit tests in it. + This way a coverage report will be generated, + showing 0% coverage, instead of no report. + This file can be removed once we have real unit + tests in place. */ + +describe('ai-huggingface package', () => { + + it('support code coverage statistics', () => true); +}); diff --git a/packages/ai-hugging-face/tsconfig.json b/packages/ai-hugging-face/tsconfig.json new file mode 100644 index 0000000..420367f --- /dev/null +++ b/packages/ai-hugging-face/tsconfig.json @@ -0,0 +1,19 @@ +{ + "extends": "../../configs/base.tsconfig", + "compilerOptions": { + "composite": true, + "rootDir": "src", + "outDir": "lib" + }, + "include": [ + "src" + ], + "references": [ + { + "path": "../ai-core" + }, + { + "path": "../core" + } + ] +} diff --git a/packages/ai-ide/.eslintrc.js b/packages/ai-ide/.eslintrc.js new file mode 100644 index 0000000..1308994 --- /dev/null +++ b/packages/ai-ide/.eslintrc.js @@ -0,0 +1,10 @@ +/** @type {import('eslint').Linter.Config} */ +module.exports = { + extends: [ + '../../configs/build.eslintrc.json' + ], + parserOptions: { + tsconfigRootDir: __dirname, + project: 'tsconfig.json' + } +}; diff --git a/packages/ai-ide/README.md b/packages/ai-ide/README.md new file mode 100644 index 0000000..60b0b4f --- /dev/null +++ b/packages/ai-ide/README.md @@ -0,0 +1,49 @@ +
    + +
    + +theia-ext-logo + +

    ECLIPSE THEIA - AI IDE AGENTS EXTENSION

    + +
    + +
    + +## Description + +The `@theia/ai-ide` package consolidates various AI agents for use within IDEs like the Theia IDE. + +## Agents + +The package includes the following agents: + +- **Orchestrator Chat Agent**: Analyzes user requests and determines which specific chat agent is best suited to handle each request. It seamlessly delegates tasks to the appropriate agent, ensuring users receive the most relevant assistance. It used as the default agent if no other agent is specified. + +- **Universal Chat Agent**: Provides general programming support. It answers broad programming-related questions and serves as a fallback for generic inquiries, without specific access to the user context or workspace. This agent is used as the preferred fallback in case the default agent is not available. + +- **Coder Agent**: Assists software developers with code-related tasks in the Theia IDE. It utilizes AI to provide recommendations and improvements, leveraging a suite of functions to interact with the workspace. + +- **Command Chat Agent**: This agent helps users execute commands within the Theia IDE based on user requests. It identifies the correct command from Theia's command registry and facilitates its execution, providing users with a seamless command interaction experience. + +- **Architect Agent**: The agent is able to inspect the current files of the workspace, including their content, to answer questions. + +## Configuration View + +The package provides a configuration view that enables you to adjust settings related to the behavior of AI agents. This view is implemented in the files located at packages/ai-ide/src/browser/ai-configuration and offers customization of default parameters, feature toggles, and additional preferences for the AI IDE. + +## Additional Information + +- [API documentation for `@theia/ai-ide`](https://eclipse-theia.github.io/theia/docs/next/modules/_theia_ai-ide.html) +- [Theia - GitHub](https://github.com/eclipse-theia/theia) +- [Theia - Website](https://theia-ide.org/) + +## License + +- [Eclipse Public License 2.0](http://www.eclipse.org/legal/epl-2.0/) +- [GNU General Public License, version 2 with the GNU Classpath Exception](https://projects.eclipse.org/license/secondary-gpl-2.0-cp) + +## Trademark + +"Theia" is a trademark of the Eclipse Foundation + diff --git a/packages/ai-ide/package.json b/packages/ai-ide/package.json new file mode 100644 index 0000000..1132630 --- /dev/null +++ b/packages/ai-ide/package.json @@ -0,0 +1,71 @@ +{ + "name": "@theia/ai-ide", + "version": "1.68.0", + "description": "AI IDE Agents Extension", + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "repository": { + "type": "git", + "url": "https://github.com/eclipse-theia/theia.git" + }, + "bugs": { + "url": "https://github.com/eclipse-theia/theia/issues" + }, + "homepage": "https://github.com/eclipse-theia/theia", + "keywords": [ + "theia-extension" + ], + "dependencies": { + "@theia/ai-chat": "1.68.0", + "@theia/ai-chat-ui": "1.68.0", + "@theia/ai-core": "1.68.0", + "@theia/core": "1.68.0", + "@theia/debug": "1.68.0", + "@theia/editor": "1.68.0", + "@theia/filesystem": "1.68.0", + "@theia/markers": "1.68.0", + "@theia/monaco": "1.68.0", + "@theia/navigator": "1.68.0", + "@theia/preferences": "1.68.0", + "@theia/scm": "1.68.0", + "@theia/search-in-workspace": "1.68.0", + "@theia/task": "1.68.0", + "@theia/terminal": "1.68.0", + "@theia/workspace": "1.68.0", + "date-fns": "^4.1.0", + "ignore": "^6.0.0", + "js-yaml": "^4.1.0", + "minimatch": "^10.0.3", + "puppeteer-core": "^24.10.0", + "simple-git": "^3.25.0" + }, + "publishConfig": { + "access": "public" + }, + "devDependencies": { + "@theia/cli": "1.68.0", + "@theia/test": "1.68.0" + }, + "theiaExtensions": [ + { + "frontend": "lib/browser/frontend-module", + "secondaryWindow": "lib/browser/frontend-module", + "backend": "lib/node/backend-module" + } + ], + "files": [ + "lib", + "src" + ], + "scripts": { + "build": "theiaext build", + "clean": "theiaext clean", + "compile": "theiaext compile", + "lint": "theiaext lint", + "test": "theiaext test", + "watch": "theiaext watch" + }, + "nyc": { + "extends": "../../configs/nyc.json" + }, + "gitHead": "21358137e41342742707f660b8e222f940a27652" +} diff --git a/packages/ai-ide/src/browser/address-pr-review-command-contribution.ts b/packages/ai-ide/src/browser/address-pr-review-command-contribution.ts new file mode 100644 index 0000000..d2ee256 --- /dev/null +++ b/packages/ai-ide/src/browser/address-pr-review-command-contribution.ts @@ -0,0 +1,180 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { FrontendApplicationContribution } from '@theia/core/lib/browser'; +import { inject, injectable } from '@theia/core/shared/inversify'; +import { PromptService } from '@theia/ai-core/lib/common'; +import { nls } from '@theia/core'; +import { AGENT_DELEGATION_FUNCTION_ID } from '@theia/ai-chat/lib/browser/agent-delegation-tool'; +import { GitHubChatAgentId } from './github-chat-agent'; + +@injectable() +export class AddressGhReviewCommandContribution implements FrontendApplicationContribution { + + @inject(PromptService) + protected readonly promptService: PromptService; + + onStart(): void { + this.registerAddressGhReviewCommand(); + } + + protected registerAddressGhReviewCommand(): void { + const commandTemplate = this.buildCommandTemplate(); + + this.promptService.addBuiltInPromptFragment({ + id: 'address-gh-review', + template: commandTemplate, + isCommand: true, + commandName: 'address-gh-review', + commandDescription: nls.localize( + 'theia/ai-ide/addressGhReviewCommand/description', + 'Address review comments on a GitHub pull request' + ), + commandArgumentHint: nls.localize( + 'theia/ai-ide/addressGhReviewCommand/argumentHint', + '' + ), + commandAgents: ['Coder'] + }); + } + + protected buildCommandTemplate(): string { + return `You have been asked to address review comments on a GitHub pull request. + +## Pull Request Number +$ARGUMENTS + +## Task Overview +You need to retrieve all details about the specified pull request, especially the review comments, assess whether you can safely address all comments, and if so, +implement the requested changes. + +## Step 1: Retrieve Pull Request Information +Use the ~{${AGENT_DELEGATION_FUNCTION_ID}} tool to delegate to the GitHub agent and retrieve comprehensive information about the pull request. + +**Agent ID:** '${GitHubChatAgentId}' +**Prompt:** Ask the GitHub agent to retrieve ALL details about PR #$ARGUMENTS, specifically requesting: +- The PR title and description +- The current state of the PR (open, closed, merged) +- ALL review comments - this is critical, every single review comment must be retrieved +- General PR comments (conversation) +- The list of files changed in the PR +- Any referenced issues +- Review status (approved, changes requested, etc.) + +Example delegation prompt: +\`\`\` +Please retrieve comprehensive information about pull request #$ARGUMENTS. I need: +1. The PR title, description, and current state +2. ALL review comments on this PR - every single inline review comment is critical +3. ALL general conversation comments on the PR +4. The list of files changed in this PR +5. The current review status (approved, changes requested, pending) +6. Any linked or referenced issues + +This is for addressing the review comments, so completeness is absolutely crucial. Make sure to get every review comment. +\`\`\` + +## Step 2: Analyze and Categorize Review Comments +After receiving the PR information, analyze each review comment and categorize them: + +### Categories of Review Comments: +1. **Clear code changes**: Comments requesting specific, unambiguous code modifications (e.g., "rename this variable", "add null check here", "fix this typo") +2. **Style/formatting fixes**: Comments about code style, formatting, or conventions +3. **Bug fixes**: Comments pointing out bugs or issues that need to be fixed +4. **Clarification questions**: Reviewers asking questions that need answers, not code changes +5. **Design discussions**: Comments about architectural or design decisions that require human judgment +6. **Ambiguous requests**: Comments that are unclear or could be interpreted multiple ways + +### Criteria for Safely Addressable Comments: +- The requested change is clearly specified +- The change is localized and well-scoped +- No architectural or design decisions are required +- The change doesn't conflict with other review comments +- You have enough context to make the change correctly + +### Criteria for Comments Requiring Clarification: +- The comment is ambiguous or vague +- Multiple valid interpretations exist +- The comment requires design decisions +- Comments conflict with each other +- The reviewer is asking a question rather than requesting a change + +## Step 3: Respond Based on Analysis + +### If ANY comments cannot be safely addressed: +List all comments and their status, then ask for clarification on the problematic ones: + +Example response format: +\`\`\` +## PR Review Analysis + +### Comments I Can Address: +1. [File: path/to/file.ts, Line X] - "[Comment summary]" - Will [action] +2. [File: path/to/file.ts, Line Y] - "[Comment summary]" - Will [action] + +### Comments Requiring Clarification: +1. [File: path/to/file.ts, Line Z] - "[Comment summary]" + - **Issue**: [Why this needs clarification] + - **Question**: [Specific question to resolve ambiguity] + +2. [File: path/to/other.ts, Line W] - "[Comment summary]" + - **Issue**: [Why this needs clarification] + - **Question**: [Specific question to resolve ambiguity] + +### Conflicting Comments: +- [Describe any conflicts between review comments] + +Please provide clarification on the above items. Once clarified, I can proceed to address all review comments. + +Alternatively, if you'd like me to proceed with just the comments I can safely address, please confirm. +\`\`\` + +### If ALL comments can be safely addressed: +Proceed with implementing all the requested changes: + +1. **List all comments** and what you will do to address each one +2. **Implement the changes** file by file, addressing each review comment +3. **Explain each change** as you make it, referencing the original review comment +4. **Summarize** all changes made at the end + +Example response format: +\`\`\` +## PR Review Analysis + +All review comments can be safely addressed. Proceeding with implementation. + +### Review Comments to Address: +1. [File: path/to/file.ts, Line X] - "[Comment summary]" - Will [action] +2. [File: path/to/file.ts, Line Y] - "[Comment summary]" - Will [action] +... + +### Implementation +[Proceed to make changes, explaining each one] + +### Summary +[List all changes made and which review comments they address] +\`\`\` + +## Important Guidelines +- Always preserve the intent of the original code while addressing review comments +- If a review comment conflicts with the existing code style, follow the project's conventions +- Make minimal changes - only change what's necessary to address each comment +- If you discover issues beyond the review comments, mention them but don't fix them unless asked +- After implementation, provide a summary that maps each change to the review comment it addresses + +Remember: It's better to ask for clarification than to make assumptions that could introduce bugs or go against the reviewer's intent.`; + } +} diff --git a/packages/ai-ide/src/browser/ai-configuration/agent-configuration-widget.tsx b/packages/ai-ide/src/browser/ai-configuration/agent-configuration-widget.tsx new file mode 100644 index 0000000..d177e00 --- /dev/null +++ b/packages/ai-ide/src/browser/ai-configuration/agent-configuration-widget.tsx @@ -0,0 +1,555 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { + Agent, + AgentService, + AISettingsService, + AIVariableService, + FrontendLanguageModelRegistry, + LanguageModel, + LanguageModelRegistry, + matchVariablesRegEx, + PROMPT_FUNCTION_REGEX, + PromptFragmentCustomizationService, + PromptService, +} from '@theia/ai-core/lib/common'; +import { codicon, QuickInputService } from '@theia/core/lib/browser'; +import { URI } from '@theia/core/lib/common'; +import { inject, injectable, postConstruct } from '@theia/core/shared/inversify'; +import * as React from '@theia/core/shared/react'; +import { AIConfigurationSelectionService } from './ai-configuration-service'; +import { LanguageModelRenderer } from './language-model-renderer'; +import { LanguageModelAliasRegistry, LanguageModelAlias } from '@theia/ai-core/lib/common/language-model-alias'; +import { AIVariableConfigurationWidget } from './variable-configuration-widget'; +import { nls } from '@theia/core'; +import { PromptVariantRenderer } from './template-settings-renderer'; +import { AIListDetailConfigurationWidget } from './base/ai-list-detail-configuration-widget'; + +interface ParsedPrompt { + functions: string[]; + globalVariables: string[]; + agentSpecificVariables: string[]; +}; + +@injectable() +export class AIAgentConfigurationWidget extends AIListDetailConfigurationWidget { + + static readonly ID = 'ai-agent-configuration-container-widget'; + static readonly LABEL = nls.localize('theia/ai/core/agentConfiguration/label', 'Agents'); + + @inject(AgentService) + protected readonly agentService: AgentService; + + @inject(LanguageModelRegistry) + protected readonly languageModelRegistry: FrontendLanguageModelRegistry; + + @inject(PromptFragmentCustomizationService) + protected readonly promptFragmentCustomizationService: PromptFragmentCustomizationService; + + @inject(LanguageModelAliasRegistry) + protected readonly languageModelAliasRegistry: LanguageModelAliasRegistry; + + @inject(AISettingsService) + protected readonly aiSettingsService: AISettingsService; + + @inject(AIConfigurationSelectionService) + protected readonly aiConfigurationSelectionService: AIConfigurationSelectionService; + + @inject(AIVariableService) + protected readonly variableService: AIVariableService; + + @inject(PromptService) + protected promptService: PromptService; + + @inject(QuickInputService) + protected readonly quickInputService: QuickInputService; + + protected languageModels: LanguageModel[] | undefined; + protected languageModelAliases: LanguageModelAlias[] = []; + protected parsedPromptParts: ParsedPrompt | undefined; + protected isLoadingDetails = false; + + @postConstruct() + protected init(): void { + this.id = AIAgentConfigurationWidget.ID; + this.title.label = AIAgentConfigurationWidget.LABEL; + this.title.closable = false; + + Promise.all([ + this.loadItems(), + this.languageModelRegistry.getLanguageModels().then(models => { + this.languageModels = models ?? []; + }) + ]).then(() => this.update()); + + this.languageModelAliasRegistry.ready.then(() => { + this.languageModelAliases = this.languageModelAliasRegistry.getAliases(); + this.toDispose.push(this.languageModelAliasRegistry.onDidChange(() => { + this.languageModelAliases = this.languageModelAliasRegistry.getAliases(); + this.update(); + })); + }); + + this.toDispose.pushAll([ + this.languageModelRegistry.onChange(({ models }) => { + this.languageModelAliases = this.languageModelAliasRegistry.getAliases(); + this.languageModels = models; + this.update(); + }), + this.promptService.onPromptsChange(() => this.updateParsedPromptParts()), + this.promptFragmentCustomizationService.onDidChangePromptFragmentCustomization(() => { + this.updateParsedPromptParts(); + }), + this.aiSettingsService.onDidChange(() => { + this.updateParsedPromptParts(); + }), + this.aiConfigurationSelectionService.onDidAgentChange(() => { + this.selectedItem = this.aiConfigurationSelectionService.getActiveAgent(); + this.updateParsedPromptParts(); + }), + this.agentService.onDidChangeAgents(async () => { + await this.loadItems(); + this.update(); + }) + ]); + + this.updateParsedPromptParts(); + } + + protected async loadItems(): Promise { + this.items = this.agentService.getAllAgents(); + const activeAgent = this.aiConfigurationSelectionService.getActiveAgent(); + if (activeAgent) { + this.selectedItem = activeAgent; + } else if (this.items.length > 0 && !this.selectedItem) { + this.selectedItem = this.items[0]; + this.aiConfigurationSelectionService.setActiveAgent(this.items[0]); + } + } + + protected getItemId(agent: Agent): string { + return agent.id; + } + + protected getItemLabel(agent: Agent): string { + return agent.name; + } + + protected override getEmptySelectionMessage(): string { + return nls.localize('theia/ai/core/agentConfiguration/selectAgentMessage', 'Please select an Agent first!'); + } + + protected override handleItemSelect = (agent: Agent): void => { + this.selectedItem = agent; + this.aiConfigurationSelectionService.setActiveAgent(agent); + this.updateParsedPromptParts(); + }; + + protected override renderItemPrefix(agent: Agent): React.ReactNode { + const enabled = this.agentService.isEnabled(agent.id); + return ( + + + ); + } + + protected override renderItemSuffix(agent: Agent): React.ReactNode { + if (!agent.tags?.length) { + return undefined; + } + return {agent.tags.map(tag => {tag})}; + } + + protected override renderList(): React.ReactNode { + return ( +
    +
      + {this.items.map(agent => { + const agentId = this.getItemId(agent); + const isSelected = this.selectedItem && this.getItemId(this.selectedItem) === agentId; + return ( +
    • this.handleItemSelect(agent)} + > + {this.renderItemPrefix(agent)} + {this.getItemLabel(agent)} + {this.renderItemSuffix(agent)} +
    • + ); + })} +
    +
    + +
    +
    + ); + } + + protected async updateParsedPromptParts(): Promise { + this.isLoadingDetails = true; + const agent = this.aiConfigurationSelectionService.getActiveAgent(); + if (agent) { + this.parsedPromptParts = await this.parsePromptFragmentsForVariableAndFunction(agent); + } else { + this.parsedPromptParts = undefined; + } + this.isLoadingDetails = false; + this.update(); + } + + protected renderItemDetail(agent: Agent): React.ReactNode { + if (this.isLoadingDetails) { + return
    {nls.localizeByDefault('Loading...')}
    ; + } + + const enabled = this.agentService.isEnabled(agent.id); + + if (!this.parsedPromptParts) { + this.updateParsedPromptParts(); + return
    {nls.localizeByDefault('Loading...')}
    ; + } + + const globalVariables = Array.from(new Set([...this.parsedPromptParts.globalVariables, ...agent.variables])); + const functions = Array.from(new Set([...this.parsedPromptParts.functions, ...agent.functions])); + + const agentNameWithTags = <> + {agent.name} + {agent.tags?.length && {agent.tags.map(tag => {tag})}} + ; + + return
    +
    +
    +
    + {agentNameWithTags} +
    Id: {agent.id}
    +
    + +
    +
    + + {agent.description && ( +
    + {agent.description} +
    + )} + {agent.prompts.length > 0 && ( + <> +
    + {nls.localize('theia/ai/core/agentConfiguration/promptTemplates', 'Prompt Templates')} +
    + + + + + + + + + + {agent.prompts.map(prompt => ( + + ))} + +
    {nls.localize('theia/ai/core/agentConfiguration/templateName', 'Template')}{nls.localize('theia/ai/core/agentConfiguration/variant', 'Variant')}{nls.localize('theia/ai/core/agentConfiguration/actions', 'Actions')}
    + + )} + +
    + +
    + + {globalVariables.length > 0 && ( + <> +
    + {nls.localize('theia/ai/core/agentConfiguration/usedGlobalVariables', 'Used Global Variables')} +
    + + + )} + + {this.parsedPromptParts.agentSpecificVariables.length > 0 && ( + <> +
    + {nls.localize('theia/ai/core/agentConfiguration/usedAgentSpecificVariables', 'Used Agent-Specific Variables')} +
    +
      + +
    + + )} + + {functions.length > 0 && ( + <> +
    + {nls.localize('theia/ai/core/agentConfiguration/usedFunctions', 'Used Functions')} +
    +
      + +
    + + )} +
    ; + } + + protected async parsePromptFragmentsForVariableAndFunction(agent: Agent): Promise { + const result: ParsedPrompt = { functions: [], globalVariables: [], agentSpecificVariables: [] }; + const agentSettings = await this.aiSettingsService.getAgentSettings(agent.id); + const selectedVariants = agentSettings?.selectedVariants ?? {}; + + for (const mainTemplate of agent.prompts) { + const promptId = selectedVariants[mainTemplate.id] ?? mainTemplate.defaultVariant.id ?? mainTemplate.id; + const promptToAnalyze: string | undefined = this.promptService.getRawPromptFragment(promptId)?.template; + + if (!promptToAnalyze) { + continue; + } + + this.extractVariablesAndFunctions(promptToAnalyze, result, agent); + } + + return result; + } + + protected extractVariablesAndFunctions(promptContent: string, result: ParsedPrompt, agent: Agent): void { + const variableMatches = matchVariablesRegEx(promptContent); + variableMatches.forEach(match => { + const variableId = match[1]; + if (variableId.startsWith('!--')) { + return; + } + + const baseVariableId = variableId.split(':')[0]; + + if (this.variableService.hasVariable(baseVariableId) && + agent.agentSpecificVariables.find(v => v.name === baseVariableId) === undefined) { + result.globalVariables.push(variableId); + } else { + result.agentSpecificVariables.push(variableId); + } + }); + + const functionMatches = [...promptContent.matchAll(PROMPT_FUNCTION_REGEX)]; + functionMatches.forEach(match => { + const functionId = match[1]; + result.functions.push(functionId); + }); + } + + protected showVariableConfigurationTab(): void { + this.aiConfigurationSelectionService.selectConfigurationTab(AIVariableConfigurationWidget.ID); + } + + protected async addCustomAgent(): Promise { + const locations = await this.promptFragmentCustomizationService.getCustomAgentsLocations(); + + // If only one location is available, use the direct approach + if (locations.length === 1) { + this.promptFragmentCustomizationService.openCustomAgentYaml(locations[0].uri); + return; + } + + // Multiple locations - show quick picker + const quickPick = this.quickInputService.createQuickPick(); + quickPick.title = nls.localize('theia/ai/ide/agentConfiguration/customAgentLocationQuickPick/title', 'Select Location for Custom Agents File'); + quickPick.placeholder = nls.localize('theia/ai/ide/agentConfiguration/customAgentLocationQuickPick/placeholder', 'Choose where to create or open a custom agents file'); + + quickPick.items = locations.map(location => ({ + label: location.uri.path.toString(), + description: location.exists + ? nls.localize('theia/ai/ide/agentConfiguration/customAgentLocationQuickPick/openExistingFile', 'Open existing file') + : nls.localize('theia/ai/ide/agentConfiguration/customAgentLocationQuickPick/createNewFile', 'Create new file'), + location + })); + + quickPick.onDidAccept(async () => { + const selectedItem = quickPick.selectedItems[0] as unknown as { location: { uri: URI, exists: boolean } }; + if (selectedItem && selectedItem.location) { + quickPick.dispose(); + this.promptFragmentCustomizationService.openCustomAgentYaml(selectedItem.location.uri); + } + }); + + quickPick.show(); + } + + private toggleAgentEnabled = async () => { + const agent = this.aiConfigurationSelectionService.getActiveAgent(); + if (!agent) { + return false; + } + const enabled = this.agentService.isEnabled(agent.id); + if (enabled) { + await this.agentService.disableAgent(agent.id); + } else { + await this.agentService.enableAgent(agent.id); + } + this.update(); + }; +} + +interface AgentGlobalVariablesProps { + variables: string[]; + variableService: AIVariableService; +} +const AgentGlobalVariables = ({ variables: globalVariables, variableService }: AgentGlobalVariablesProps) => { + if (globalVariables.length === 0) { + return
    + {nls.localizeByDefault('None')} +
    ; + } + + const allVariables = variableService.getVariables(); + const variableData = globalVariables.map(varId => { + const variable = allVariables.find(v => v.id === varId); + return { + id: varId, + name: variable?.name || varId, + description: variable?.description || '' + }; + }); + + return ( + + + + + + + + + {variableData.map(variable => ( + + + + + ))} + +
    {nls.localizeByDefault('Variable')}{nls.localizeByDefault('Description')}
    {variable.name} + {variable.description || nls.localize('theia/ai/ide/agentConfiguration/noDescription', 'No description available')} +
    + ); +}; + +interface AgentFunctionsProps { + functions: string[]; +} +const AgentFunctions = ({ functions }: AgentFunctionsProps) => { + if (functions.length === 0) { + return <>{nls.localizeByDefault('None')}; + } + return <> + {functions.map(functionId =>
  • + {functionId} +
  • )} + ; +}; + +interface AgentSpecificVariablesProps { + promptVariables: string[]; + agent: Agent; +} +const AgentSpecificVariables = ({ promptVariables, agent }: AgentSpecificVariablesProps) => { + const agentDefinedVariablesName = agent.agentSpecificVariables.map(v => v.name); + const variables = Array.from(new Set([...promptVariables, ...agentDefinedVariablesName])); + if (variables.length === 0) { + return
    + {nls.localizeByDefault('None')} +
    ; + } + return
    + {variables.map(variableId => + + )} +
    ; +}; +interface AgentSpecificVariableProps { + variableId: string; + agent: Agent; + promptVariables: string[]; +} +const AgentSpecificVariable = ({ variableId, agent, promptVariables }: AgentSpecificVariableProps) => { + const agentDefinedVariable = agent.agentSpecificVariables.find(v => v.name === variableId); + const undeclared = agentDefinedVariable === undefined; + const notUsed = !promptVariables.includes(variableId) && agentDefinedVariable?.usedInPrompt === true; + return
    +
    + {nls.localizeByDefault('Name')}: + {variableId} +
    + {undeclared ? ( +
    + {nls.localizeByDefault('Status')}: + + {nls.localize('theia/ai/core/agentConfiguration/undeclared', 'Undeclared')} + +
    + ) : ( + <> +
    + {nls.localizeByDefault('Description')}: + {agentDefinedVariable.description} +
    + {notUsed && ( +
    + {nls.localizeByDefault('Status')}: + + {nls.localize('theia/ai/core/agentConfiguration/notUsedInPrompt', 'Not used in prompt')} + +
    + )} + + )} +
    ; +}; diff --git a/packages/ai-ide/src/browser/ai-configuration/ai-configuration-service.ts b/packages/ai-ide/src/browser/ai-configuration/ai-configuration-service.ts new file mode 100644 index 0000000..3461b77 --- /dev/null +++ b/packages/ai-ide/src/browser/ai-configuration/ai-configuration-service.ts @@ -0,0 +1,56 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { Agent } from '@theia/ai-core/lib/common'; +import { Emitter } from '@theia/core'; +import { injectable } from '@theia/core/shared/inversify'; + +@injectable() +export class AIConfigurationSelectionService { + protected activeAgent?: Agent; + protected selectedAliasId?: string; + + protected readonly onDidSelectConfigurationEmitter = new Emitter(); + onDidSelectConfiguration = this.onDidSelectConfigurationEmitter.event; + + protected readonly onDidAgentChangeEmitter = new Emitter(); + onDidAgentChange = this.onDidAgentChangeEmitter.event; + + protected readonly onDidAliasChangeEmitter = new Emitter(); + onDidAliasChange = this.onDidAliasChangeEmitter.event; + + public getActiveAgent(): Agent | undefined { + return this.activeAgent; + } + + public setActiveAgent(agent?: Agent): void { + this.activeAgent = agent; + this.onDidAgentChangeEmitter.fire(agent); + } + + public getSelectedAliasId(): string | undefined { + return this.selectedAliasId; + } + + public setSelectedAliasId(aliasId?: string): void { + this.selectedAliasId = aliasId; + this.onDidAliasChangeEmitter.fire(aliasId); + } + + public selectConfigurationTab(widgetId: string): void { + this.onDidSelectConfigurationEmitter.fire(widgetId); + } +} diff --git a/packages/ai-ide/src/browser/ai-configuration/ai-configuration-view-contribution.ts b/packages/ai-ide/src/browser/ai-configuration/ai-configuration-view-contribution.ts new file mode 100644 index 0000000..365ee67 --- /dev/null +++ b/packages/ai-ide/src/browser/ai-configuration/ai-configuration-view-contribution.ts @@ -0,0 +1,66 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** +import { Command, CommandRegistry, nls } from '@theia/core'; +import { TabBarToolbarContribution, TabBarToolbarRegistry } from '@theia/core/lib/browser/shell/tab-bar-toolbar'; +import { AIViewContribution } from '@theia/ai-core/lib/browser'; +import { ChatViewWidget } from '@theia/ai-chat-ui/lib/browser/chat-view-widget'; +import { FrontendApplication } from '@theia/core/lib/browser'; +import { injectable } from '@theia/core/shared/inversify'; +import { AIConfigurationContainerWidget } from './ai-configuration-widget'; + +export const AI_CONFIGURATION_TOGGLE_COMMAND_ID = 'aiConfiguration:toggle'; +export const OPEN_AI_CONFIG_VIEW = Command.toLocalizedCommand({ + id: 'aiConfiguration:open', + label: 'Open AI Configuration view', +}); + +@injectable() +export class AIAgentConfigurationViewContribution extends AIViewContribution implements TabBarToolbarContribution { + + constructor() { + super({ + widgetId: AIConfigurationContainerWidget.ID, + widgetName: AIConfigurationContainerWidget.LABEL, + defaultWidgetOptions: { + area: 'main', + rank: 100 + }, + toggleCommandId: AI_CONFIGURATION_TOGGLE_COMMAND_ID + }); + } + + async initializeLayout(_app: FrontendApplication): Promise { + await this.openView(); + } + + override registerCommands(commands: CommandRegistry): void { + super.registerCommands(commands); + commands.registerCommand(OPEN_AI_CONFIG_VIEW, { + execute: () => this.openView({ activate: true }), + }); + } + + registerToolbarItems(registry: TabBarToolbarRegistry): void { + registry.registerItem({ + id: 'chat-view.' + OPEN_AI_CONFIG_VIEW.id, + command: OPEN_AI_CONFIG_VIEW.id, + tooltip: nls.localize('theia/ai-ide/open-agent-settings-tooltip', 'Open Agent settings...'), + group: 'ai-settings', + priority: 2, + isVisible: widget => this.activationService.isActive && widget instanceof ChatViewWidget + }); + } +} diff --git a/packages/ai-ide/src/browser/ai-configuration/ai-configuration-widget.tsx b/packages/ai-ide/src/browser/ai-configuration/ai-configuration-widget.tsx new file mode 100644 index 0000000..6591108 --- /dev/null +++ b/packages/ai-ide/src/browser/ai-configuration/ai-configuration-widget.tsx @@ -0,0 +1,118 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { BaseWidget, BoxLayout, codicon, DockPanel, WidgetManager } from '@theia/core/lib/browser'; +import { TheiaDockPanel } from '@theia/core/lib/browser/shell/theia-dock-panel'; +import { inject, injectable, postConstruct } from '@theia/core/shared/inversify'; +import { AIAgentConfigurationWidget } from './agent-configuration-widget'; +import { AIVariableConfigurationWidget } from './variable-configuration-widget'; +import { AIToolsConfigurationWidget } from './tools-configuration-widget'; +import { AISkillsConfigurationWidget } from './skills-configuration-widget'; +import { AIConfigurationSelectionService } from './ai-configuration-service'; +import { nls } from '@theia/core'; +// import { AIMCPConfigurationWidget } from './mcp-configuration-widget'; // Requires @theia/ai-mcp +import { AITokenUsageConfigurationWidget } from './token-usage-configuration-widget'; +import { AIPromptFragmentsConfigurationWidget } from './prompt-fragments-configuration-widget'; +import { ModelAliasesConfigurationWidget } from './model-aliases-configuration-widget'; + +@injectable() +export class AIConfigurationContainerWidget extends BaseWidget { + + static readonly ID = 'ai-configuration'; + static readonly LABEL = nls.localize('theia/ai/core/aiConfiguration/label', 'AI Configuration [Beta]'); + protected dockpanel: DockPanel; + + @inject(TheiaDockPanel.Factory) + protected readonly dockPanelFactory: TheiaDockPanel.Factory; + @inject(WidgetManager) + protected readonly widgetManager: WidgetManager; + @inject(AIConfigurationSelectionService) + protected readonly aiConfigurationSelectionService: AIConfigurationSelectionService; + + protected agentsWidget: AIAgentConfigurationWidget; + protected variablesWidget: AIVariableConfigurationWidget; + // protected mcpWidget: AIMCPConfigurationWidget; // Requires @theia/ai-mcp + protected tokenUsageWidget: AITokenUsageConfigurationWidget; + protected promptFragmentsWidget: AIPromptFragmentsConfigurationWidget; + protected toolsWidget: AIToolsConfigurationWidget; + protected skillsWidget: AISkillsConfigurationWidget; + protected modelAliasesWidget: ModelAliasesConfigurationWidget; + + @postConstruct() + protected init(): void { + this.id = AIConfigurationContainerWidget.ID; + this.title.label = AIConfigurationContainerWidget.LABEL; + this.title.caption = AIConfigurationContainerWidget.LABEL; + this.title.closable = true; + this.addClass('theia-settings-container'); + this.title.iconClass = codicon('hubot'); + this.initUI(); + this.initListeners(); + } + + protected async initUI(): Promise { + const layout = (this.layout = new BoxLayout({ direction: 'top-to-bottom', spacing: 0 })); + this.dockpanel = this.dockPanelFactory({ + mode: 'multiple-document', + spacing: 0 + }); + BoxLayout.setStretch(this.dockpanel, 1); + layout.addWidget(this.dockpanel); + this.dockpanel.addClass('ai-configuration-widget'); + + this.agentsWidget = await this.widgetManager.getOrCreateWidget(AIAgentConfigurationWidget.ID); + this.variablesWidget = await this.widgetManager.getOrCreateWidget(AIVariableConfigurationWidget.ID); + // this.mcpWidget = await this.widgetManager.getOrCreateWidget(AIMCPConfigurationWidget.ID); // Requires @theia/ai-mcp + this.tokenUsageWidget = await this.widgetManager.getOrCreateWidget(AITokenUsageConfigurationWidget.ID); + this.promptFragmentsWidget = await this.widgetManager.getOrCreateWidget(AIPromptFragmentsConfigurationWidget.ID); + this.toolsWidget = await this.widgetManager.getOrCreateWidget(AIToolsConfigurationWidget.ID); + this.skillsWidget = await this.widgetManager.getOrCreateWidget(AISkillsConfigurationWidget.ID); + this.modelAliasesWidget = await this.widgetManager.getOrCreateWidget(ModelAliasesConfigurationWidget.ID); + + this.dockpanel.addWidget(this.agentsWidget); + this.dockpanel.addWidget(this.variablesWidget, { mode: 'tab-after', ref: this.agentsWidget }); + // this.dockpanel.addWidget(this.mcpWidget, { mode: 'tab-after', ref: this.variablesWidget }); // Requires @theia/ai-mcp + this.dockpanel.addWidget(this.tokenUsageWidget, { mode: 'tab-after', ref: this.variablesWidget }); + this.dockpanel.addWidget(this.promptFragmentsWidget, { mode: 'tab-after', ref: this.tokenUsageWidget }); + this.dockpanel.addWidget(this.toolsWidget, { mode: 'tab-after', ref: this.promptFragmentsWidget }); + this.dockpanel.addWidget(this.skillsWidget, { mode: 'tab-after', ref: this.toolsWidget }); + this.dockpanel.addWidget(this.modelAliasesWidget, { mode: 'tab-after', ref: this.skillsWidget }); + + this.update(); + } + + protected initListeners(): void { + this.aiConfigurationSelectionService.onDidSelectConfiguration(widgetId => { + if (widgetId === AIAgentConfigurationWidget.ID) { + this.dockpanel.activateWidget(this.agentsWidget); + } else if (widgetId === AIVariableConfigurationWidget.ID) { + this.dockpanel.activateWidget(this.variablesWidget); + // } else if (widgetId === AIMCPConfigurationWidget.ID) { // Requires @theia/ai-mcp + // this.dockpanel.activateWidget(this.mcpWidget); + } else if (widgetId === AITokenUsageConfigurationWidget.ID) { + this.dockpanel.activateWidget(this.tokenUsageWidget); + } else if (widgetId === AIPromptFragmentsConfigurationWidget.ID) { + this.dockpanel.activateWidget(this.promptFragmentsWidget); + } else if (widgetId === AIToolsConfigurationWidget.ID) { + this.dockpanel.activateWidget(this.toolsWidget); + } else if (widgetId === AISkillsConfigurationWidget.ID) { + this.dockpanel.activateWidget(this.skillsWidget); + } else if (widgetId === ModelAliasesConfigurationWidget.ID) { + this.dockpanel.activateWidget(this.modelAliasesWidget); + } + }); + } +} diff --git a/packages/ai-ide/src/browser/ai-configuration/base/ai-card-grid-configuration-widget.tsx b/packages/ai-ide/src/browser/ai-configuration/base/ai-card-grid-configuration-widget.tsx new file mode 100644 index 0000000..d4b7946 --- /dev/null +++ b/packages/ai-ide/src/browser/ai-configuration/base/ai-card-grid-configuration-widget.tsx @@ -0,0 +1,72 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** +import * as React from '@theia/core/shared/react'; +import { injectable } from '@theia/core/shared/inversify'; +import { AIConfigurationBaseWidget } from './ai-configuration-base-widget'; + +/** + * Base class for AI configuration widgets that display items in a responsive card grid. + * This pattern is used by the MCP configuration widget. + */ +@injectable() +export abstract class AICardGridConfigurationWidget extends AIConfigurationBaseWidget { + protected items: T[] = []; + + /** + * Get unique identifier for an item. + */ + protected abstract getItemId(item: T): string; + + /** + * Render a single card for an item. + */ + protected abstract renderCard(item: T): React.ReactNode; + + /** + * Load items to display in the grid. Called during initialization. + */ + protected abstract loadItems(): Promise; + + /** + * Optional: Render content before the card grid (e.g., header, controls). + */ + protected renderHeader(): React.ReactNode { + return undefined; + } + + /** + * Optional: Render content after the card grid. + */ + protected renderFooter(): React.ReactNode { + return undefined; + } + + protected renderContent(): React.ReactNode { + return ( +
    + {this.renderHeader()} +
    + {this.items.map(item => ( +
    + {this.renderCard(item)} +
    + ))} +
    + {this.renderFooter()} +
    + ); + } +} diff --git a/packages/ai-ide/src/browser/ai-configuration/base/ai-configuration-base-widget.tsx b/packages/ai-ide/src/browser/ai-configuration/base/ai-configuration-base-widget.tsx new file mode 100644 index 0000000..8838b44 --- /dev/null +++ b/packages/ai-ide/src/browser/ai-configuration/base/ai-configuration-base-widget.tsx @@ -0,0 +1,37 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** +import * as React from '@theia/core/shared/react'; +import { injectable } from '@theia/core/shared/inversify'; +import { ReactWidget } from '@theia/core/lib/browser/widgets/react-widget'; + +/** + * Base class for all AI configuration widgets providing common structure and lifecycle management. + */ +@injectable() +export abstract class AIConfigurationBaseWidget extends ReactWidget { + /** + * Subclasses must implement this method to provide their specific content rendering. + */ + protected abstract renderContent(): React.ReactNode; + + protected render(): React.ReactNode { + return ( +
    + {this.renderContent()} +
    + ); + } +} diff --git a/packages/ai-ide/src/browser/ai-configuration/base/ai-hierarchical-configuration-widget.tsx b/packages/ai-ide/src/browser/ai-configuration/base/ai-hierarchical-configuration-widget.tsx new file mode 100644 index 0000000..89fd6af --- /dev/null +++ b/packages/ai-ide/src/browser/ai-configuration/base/ai-hierarchical-configuration-widget.tsx @@ -0,0 +1,51 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** +import { injectable } from '@theia/core/shared/inversify'; +import { AIConfigurationBaseWidget } from './ai-configuration-base-widget'; + +/** + * Base class for AI configuration widgets that display hierarchical or expandable content. + * This pattern is used by the prompt fragments and tools configuration widgets. + * + * This base class provides minimal structure - subclasses implement their own + * hierarchical rendering logic using the shared ExpandableSection component. + */ +@injectable() +export abstract class AIHierarchicalConfigurationWidget extends AIConfigurationBaseWidget { + /** + * Track expansion state for sections. + */ + protected expandedSections: Set = new Set(); + + /** + * Toggle expansion state for a section. + */ + protected toggleSection = (sectionId: string): void => { + if (this.expandedSections.has(sectionId)) { + this.expandedSections.delete(sectionId); + } else { + this.expandedSections.add(sectionId); + } + this.update(); + }; + + /** + * Check if a section is expanded. + */ + protected isSectionExpanded(sectionId: string): boolean { + return this.expandedSections.has(sectionId); + } +} diff --git a/packages/ai-ide/src/browser/ai-configuration/base/ai-list-detail-configuration-widget.tsx b/packages/ai-ide/src/browser/ai-configuration/base/ai-list-detail-configuration-widget.tsx new file mode 100644 index 0000000..5fc5237 --- /dev/null +++ b/packages/ai-ide/src/browser/ai-configuration/base/ai-list-detail-configuration-widget.tsx @@ -0,0 +1,140 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** +import * as React from '@theia/core/shared/react'; +import { injectable } from '@theia/core/shared/inversify'; +import { nls } from '@theia/core/lib/common/nls'; +import { AIConfigurationBaseWidget } from './ai-configuration-base-widget'; + +/** + * Base class for AI configuration widgets that follow the list-detail pattern: + * - Left panel: Tree list of items + * - Right panel: Detail view of selected item + * + * This pattern is used by agents, variables, and model aliases widgets. + */ +@injectable() +export abstract class AIListDetailConfigurationWidget extends AIConfigurationBaseWidget { + protected selectedItem: T | undefined; + protected items: T[] = []; + + /** + * Get unique identifier for an item. Used for selection tracking. + */ + protected abstract getItemId(item: T): string; + + /** + * Get display label for an item in the list. + */ + protected abstract getItemLabel(item: T): string; + + /** + * Render the detail panel for the selected item. + */ + protected abstract renderItemDetail(item: T): React.ReactNode; + + /** + * Load items to display in the list. Called during initialization. + */ + protected abstract loadItems(): Promise; + + /** + * Get the message to display when no item is selected. + */ + protected getEmptySelectionMessage(): string { + return nls.localize('theia/ai/configuration/selectItem', 'Please select an item.'); + } + + /** + * Optional: Additional CSS classes for list items. + */ + protected getItemClassName(item: T): string { + return ''; + } + + /** + * Optional: Render additional content before the item label. + */ + protected renderItemPrefix(item: T): React.ReactNode { + return undefined; + } + + /** + * Optional: Render additional content after the item label. + */ + protected renderItemSuffix(item: T): React.ReactNode { + return undefined; + } + + protected handleItemSelect = (item: T): void => { + this.selectedItem = item; + this.update(); + }; + + /** + * Public method to programmatically select an item. + * Useful for navigation from other widgets. + */ + public selectItem(item: T): void { + this.handleItemSelect(item); + } + + protected renderContent(): React.ReactNode { + return ( +
    + {this.renderList()} + {this.renderDetail()} +
    + ); + } + + protected renderList(): React.ReactNode { + return ( +
    +
      + {this.items.map(item => { + const itemId = this.getItemId(item); + const isSelected = this.selectedItem && this.getItemId(this.selectedItem) === itemId; + return ( +
    • this.handleItemSelect(item)} + > + {this.renderItemPrefix(item)} + {this.getItemLabel(item)} + {this.renderItemSuffix(item)} +
    • + ); + })} +
    +
    + ); + } + + protected renderDetail(): React.ReactNode { + return ( +
    + {this.selectedItem ? ( + this.renderItemDetail(this.selectedItem) + ) : ( +
    + {this.getEmptySelectionMessage()} +
    + )} +
    + ); + } +} diff --git a/packages/ai-ide/src/browser/ai-configuration/base/ai-table-configuration-widget.tsx b/packages/ai-ide/src/browser/ai-configuration/base/ai-table-configuration-widget.tsx new file mode 100644 index 0000000..05c7e8a --- /dev/null +++ b/packages/ai-ide/src/browser/ai-configuration/base/ai-table-configuration-widget.tsx @@ -0,0 +1,107 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** +import * as React from '@theia/core/shared/react'; +import { injectable } from '@theia/core/shared/inversify'; +import { AIConfigurationBaseWidget } from './ai-configuration-base-widget'; + +/** + * Column definition for table configuration widgets. + */ +export interface TableColumn { + id: string; + label: string; + className?: string; + renderCell: (item: T) => React.ReactNode; +} + +/** + * Base class for AI configuration widgets that display data in a table format. + * This pattern is used by the token usage configuration widget. + */ +@injectable() +export abstract class AITableConfigurationWidget extends AIConfigurationBaseWidget { + protected items: T[] = []; + + /** + * Get unique identifier for a row item. + */ + protected abstract getItemId(item: T): string; + + /** + * Define the columns for the table. + */ + protected abstract getColumns(): TableColumn[]; + + /** + * Load items to display in the table. Called during initialization. + */ + protected abstract loadItems(): Promise; + + /** + * Optional: Render content before the table (e.g., header, filters, controls). + */ + protected renderHeader(): React.ReactNode { + return undefined; + } + + /** + * Optional: Render content after the table (e.g., summary, footer). + */ + protected renderFooter(): React.ReactNode { + return undefined; + } + + /** + * Optional: Additional CSS class for a specific row. + */ + protected getRowClassName(item: T): string { + return ''; + } + + protected renderContent(): React.ReactNode { + const columns = this.getColumns(); + return ( +
    + {this.renderHeader()} +
    + + + + {columns.map(column => ( + + ))} + + + + {this.items.map(item => ( + + {columns.map(column => ( + + ))} + + ))} + +
    + {column.label} +
    + {column.renderCell(item)} +
    +
    + {this.renderFooter()} +
    + ); + } +} diff --git a/packages/ai-ide/src/browser/ai-configuration/components/configuration-section.tsx b/packages/ai-ide/src/browser/ai-configuration/components/configuration-section.tsx new file mode 100644 index 0000000..7e31c42 --- /dev/null +++ b/packages/ai-ide/src/browser/ai-configuration/components/configuration-section.tsx @@ -0,0 +1,37 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** +import * as React from '@theia/core/shared/react'; + +export interface ConfigurationSectionProps { + title: string; + children: React.ReactNode; + className?: string; +} + +/** + * A reusable section component with a title and content area. + * Follows the Theia settings section styling. + */ +export const ConfigurationSection: React.FC = ({ title, children, className }) => ( +
    +
    + {title} +
    +
    + {children} +
    +
    +); diff --git a/packages/ai-ide/src/browser/ai-configuration/components/empty-state.tsx b/packages/ai-ide/src/browser/ai-configuration/components/empty-state.tsx new file mode 100644 index 0000000..b61b8fb --- /dev/null +++ b/packages/ai-ide/src/browser/ai-configuration/components/empty-state.tsx @@ -0,0 +1,30 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** +import * as React from '@theia/core/shared/react'; + +export interface EmptyStateProps { + message: string; + className?: string; +} + +/** + * A component to display an empty state message (e.g., "Please select an item"). + */ +export const EmptyState: React.FC = ({ message, className }) => ( +
    + {message} +
    +); diff --git a/packages/ai-ide/src/browser/ai-configuration/components/expandable-section.tsx b/packages/ai-ide/src/browser/ai-configuration/components/expandable-section.tsx new file mode 100644 index 0000000..5e2cd97 --- /dev/null +++ b/packages/ai-ide/src/browser/ai-configuration/components/expandable-section.tsx @@ -0,0 +1,51 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** +import * as React from '@theia/core/shared/react'; +import { codicon } from '@theia/core/lib/browser'; + +export interface ExpandableSectionProps { + title: React.ReactNode; + isExpanded: boolean; + onToggle: () => void; + children: React.ReactNode; + className?: string; +} + +/** + * A collapsible section with a chevron icon and expandable content. + */ +export const ExpandableSection: React.FC = ({ + title, + isExpanded, + onToggle, + children, + className +}) => ( +
    +
    + + + +
    {title}
    +
    + {isExpanded && ( +
    {children}
    + )} +
    +); diff --git a/packages/ai-ide/src/browser/ai-configuration/language-model-renderer.tsx b/packages/ai-ide/src/browser/ai-configuration/language-model-renderer.tsx new file mode 100644 index 0000000..5ccdc6f --- /dev/null +++ b/packages/ai-ide/src/browser/ai-configuration/language-model-renderer.tsx @@ -0,0 +1,160 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** +import * as React from '@theia/core/shared/react'; +import { Agent, AISettingsService, FrontendLanguageModelRegistry, LanguageModel, LanguageModelRequirement } from '@theia/ai-core/lib/common'; +import { LanguageModelAlias } from '@theia/ai-core/lib/common/language-model-alias'; +import { Mutable } from '@theia/core'; +import { nls } from '@theia/core/lib/common/nls'; + +export interface LanguageModelSettingsProps { + agent: Agent; + languageModels?: LanguageModel[]; + aiSettingsService: AISettingsService; + languageModelRegistry: FrontendLanguageModelRegistry; + languageModelAliases: LanguageModelAlias[]; +} + +export const LanguageModelRenderer: React.FC = ( + { agent, languageModels, aiSettingsService, languageModelRegistry, languageModelAliases: aliases }) => { + + const findLanguageModelRequirement = async (purpose: string): Promise => { + const requirementSetting = await aiSettingsService.getAgentSettings(agent.id); + return requirementSetting?.languageModelRequirements?.find(e => e.purpose === purpose); + }; + + const [lmRequirementMap, setLmRequirementMap] = React.useState>({}); + const [resolvedAliasModels, setResolvedAliasModels] = React.useState>({}); + + React.useEffect(() => { + const computeLmRequirementMap = async () => { + const map = await agent.languageModelRequirements.reduce(async (accPromise, curr) => { + const acc = await accPromise; + // take the agents requirements and override them with the user settings if present + const lmRequirement = await findLanguageModelRequirement(curr.purpose) ?? curr; + // if no llm is selected through the identifier, see what would be the default + if (!lmRequirement.identifier) { + const llm = await languageModelRegistry.selectLanguageModel({ agent: agent.id, ...lmRequirement }); + (lmRequirement as Mutable).identifier = llm?.id; + } + acc[curr.purpose] = lmRequirement; + return acc; + }, Promise.resolve({} as Record)); + setLmRequirementMap(map); + }; + computeLmRequirementMap(); + }, []); + + // Effect to resolve alias to model whenever requirements.identifier or aliases change + React.useEffect(() => { + const resolveAliases = async () => { + const newResolved: Record = {}; + await Promise.all(Object.values(lmRequirementMap).map(async requirements => { + const id = requirements.identifier; + if (id && aliases.some(a => a.id === id)) { + newResolved[id] = await languageModelRegistry.getReadyLanguageModel(id); + } + })); + setResolvedAliasModels(newResolved); + }; + resolveAliases(); + }, [lmRequirementMap, aliases]); + + const onSelectedModelChange = (purpose: string, event: React.ChangeEvent): void => { + const newLmRequirementMap = { ...lmRequirementMap, [purpose]: { purpose, identifier: event.target.value } }; + aiSettingsService.updateAgentSettings(agent.id, { languageModelRequirements: Object.values(newLmRequirementMap) }); + setLmRequirementMap(newLmRequirementMap); + }; + + return
    + {lmRequirementMap && Object.keys(lmRequirementMap).length > 0 ? ( +
    + {nls.localize('theia/ai/core/agentConfiguration/llmRequirements', 'LLM Requirements')} +
    + ) : undefined} + {Object.values(lmRequirementMap).map((requirement, index) => { + const isAlias = requirement.identifier && aliases.some(a => a.id === requirement.identifier); + const resolvedModel = isAlias ? resolvedAliasModels[requirement.identifier] : undefined; + return ( +
    +
    + {nls.localize('theia/ai/core/languageModelRenderer/purpose', 'Purpose')}: + {requirement.purpose} +
    +
    + + +
    + {/* If alias is selected, show what it currently evaluates to */} + {isAlias && ( +
    + {nls.localize('theia/ai/core/modelAliasesConfiguration/evaluatesTo', 'Evaluates to')}: + {resolvedModel ? ( + + {resolvedModel.name ?? resolvedModel.id} + {resolvedModel.status.status === 'ready' ? ( + + ) : ( + + )} + + ) : ( + + {nls.localize('theia/ai/core/modelAliasesConfiguration/noResolvedModel', 'No model ready for this alias.')} + + + )} +
    + )} +
    + ); + })} +
    ; +}; diff --git a/packages/ai-ide/src/browser/ai-configuration/mcp-configuration-widget.tsx b/packages/ai-ide/src/browser/ai-configuration/mcp-configuration-widget.tsx new file mode 100644 index 0000000..19d2617 --- /dev/null +++ b/packages/ai-ide/src/browser/ai-configuration/mcp-configuration-widget.tsx @@ -0,0 +1,435 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** +// @ts-nocheck - Disabled: requires @theia/ai-mcp + + +import { codicon, ReactWidget } from '@theia/core/lib/browser'; +import { inject, injectable, postConstruct } from '@theia/core/shared/inversify'; +import * as React from '@theia/core/shared/react'; +import { HoverService } from '@theia/core/lib/browser/hover-service'; +import { + isLocalMCPServerDescription, + isRemoteMCPServerDescription, + MCPFrontendNotificationService, + MCPFrontendService, + MCPServerDescription, + MCPServerStatus +} from '@theia/ai-mcp/lib/common/mcp-server-manager'; +import { MessageService, nls } from '@theia/core'; +import { PROMPT_VARIABLE } from '@theia/ai-core/lib/common/prompt-variable-contribution'; + +@injectable() +export class AIMCPConfigurationWidget extends ReactWidget { + + static readonly ID = 'ai-mcp-configuration-container-widget'; + static readonly LABEL = nls.localizeByDefault('MCP Servers'); + + protected servers: MCPServerDescription[] = []; + protected expandedTools: Record = {}; + + @inject(MCPFrontendService) + protected readonly mcpFrontendService: MCPFrontendService; + + @inject(MCPFrontendNotificationService) + protected readonly mcpFrontendNotificationService: MCPFrontendNotificationService; + + @inject(HoverService) + protected readonly hoverService: HoverService; + + @inject(MessageService) + protected readonly messageService: MessageService; + + @postConstruct() + protected init(): void { + this.id = AIMCPConfigurationWidget.ID; + this.title.label = AIMCPConfigurationWidget.LABEL; + this.title.closable = false; + this.toDispose.push(this.mcpFrontendNotificationService.onDidUpdateMCPServers(async () => { + this.loadServers(); + })); + this.loadServers(); + } + + protected async loadServers(): Promise { + const serverNames = await this.mcpFrontendService.getServerNames(); + const descriptions = await Promise.all(serverNames.map(name => this.mcpFrontendService.getServerDescription(name))); + this.servers = descriptions.filter((desc): desc is MCPServerDescription => desc !== undefined); + this.update(); + } + + protected getStatusColor(status?: MCPServerStatus): { bg: string, fg: string } { + if (!status) { + return { bg: 'var(--theia-descriptionForeground)', fg: 'white' }; + } + switch (status) { + case MCPServerStatus.Running: + case MCPServerStatus.Connected: + return { bg: 'var(--theia-successBackground)', fg: 'var(--theia-successForeground)' }; + case MCPServerStatus.Starting: + case MCPServerStatus.Connecting: + return { bg: 'var(--theia-warningBackground)', fg: 'var(--theia-warningForeground)' }; + case MCPServerStatus.Errored: + return { bg: 'var(--theia-errorBackground)', fg: 'var(--theia-errorForeground)' }; + case MCPServerStatus.NotRunning: + case MCPServerStatus.NotConnected: + default: + return { bg: 'var(--theia-inputValidation-infoBackground)', fg: 'var(--theia-inputValidation-infoForeground)' }; + } + } + + protected showErrorHover(spanRef: React.RefObject, error: string): void { + this.hoverService.requestHover({ content: error, target: spanRef.current!, position: 'left' }); + } + + protected hideErrorHover(): void { + this.hoverService.cancelHover(); + } + + protected async handleStartServer(serverName: string): Promise { + await this.mcpFrontendService.startServer(serverName); + } + + protected async handleStopServer(serverName: string): Promise { + await this.mcpFrontendService.stopServer(serverName); + } + + protected renderButton(text: React.ReactNode, + title: string, + onClick: React.MouseEventHandler, + className?: string, + style?: React.CSSProperties): React.ReactNode { + return ( + + ); + } + + protected renderStatusBadge(server: MCPServerDescription): React.ReactNode { + const colors = this.getStatusColor(server.status); + let displayStatus = server.status; + if (!displayStatus) { + displayStatus = isRemoteMCPServerDescription(server) ? MCPServerStatus.NotConnected : MCPServerStatus.NotRunning; + } + const spanRef = React.createRef(); + const error = server.error; + return ( +
    + + {displayStatus} + + {error && ( + this.showErrorHover(spanRef, error)} + onMouseLeave={() => this.hideErrorHover()} + ref={spanRef} + className="mcp-error-indicator" + > + ? + + )} +
    + ); + } + + protected renderServerHeader(server: MCPServerDescription): React.ReactNode { + const isStoppable = server.status === MCPServerStatus.Running + || server.status === MCPServerStatus.Connected; + const isStarting = server.status === MCPServerStatus.Starting + || server.status === MCPServerStatus.Connecting; + const isStartable = server.status === MCPServerStatus.NotRunning + || server.status === MCPServerStatus.NotConnected + || server.status === MCPServerStatus.Errored; + + const isRemote = isRemoteMCPServerDescription(server); + const startIcon = isRemote ? 'plug' : 'play'; + const startingIcon = 'loading'; + const stopIcon = isRemote ? 'debug-disconnect' : 'debug-stop'; + const startLabel = isRemote + ? nls.localize('theia/ai/mcpConfiguration/connectServer', 'Connect') + : nls.localizeByDefault('Start Server'); + const startingLabel = isRemote + ? nls.localize('theia/ai/mcpConfiguration/connectingServer', 'Connecting...') + : nls.localizeByDefault('Starting...'); + const stopLabel = isRemote + ? nls.localizeByDefault('Disconnect') + : nls.localizeByDefault('Stop Server'); + + return ( +
    +
    {server.name}
    +
    + {this.renderStatusBadge(server)} + {isStartable && ( +
    +
    + ); + } + + protected renderCommandSection(server: MCPServerDescription): React.ReactNode { + if (!isLocalMCPServerDescription(server)) { + return; + } + return ( +
    + {nls.localizeByDefault('Command')}: + {server.command} +
    + ); + } + + protected renderArgumentsSection(server: MCPServerDescription): React.ReactNode { + if (!isLocalMCPServerDescription(server) || !server.args || server.args.length === 0) { + return; + } + return ( +
    + {nls.localize('theia/ai/mcpConfiguration/arguments', 'Arguments')}: + {server.args.join(' ')} +
    + ); + } + + protected renderEnvironmentSection(server: MCPServerDescription): React.ReactNode { + if (!isLocalMCPServerDescription(server) || !server.env || Object.keys(server.env).length === 0) { + return; + } + return ( +
    + {nls.localize('theia/ai/mcpConfiguration/environmentVariables', 'Environment Variables')}: +
    + {Object.entries(server.env).map(([key, value]) => ( +
    + {key}={key.toLowerCase().includes('token') ? '******' : String(value)} +
    + ))} +
    +
    + ); + } + + protected renderServerUrlSection(server: MCPServerDescription): React.ReactNode { + if (!isRemoteMCPServerDescription(server)) { + return; + } + return ( +
    + {nls.localize('theia/ai/mcpConfiguration/serverUrl', 'Server URL')}: + {server.serverUrl} +
    + ); + } + + protected renderServerAuthTokenHeaderSection(server: MCPServerDescription): React.ReactNode { + if (!isRemoteMCPServerDescription(server) || !server.serverAuthTokenHeader) { + return; + } + return ( +
    + {nls.localize('theia/ai/mcpConfiguration/serverAuthTokenHeader', 'Auth Header Name')}: + {server.serverAuthTokenHeader} +
    + ); + } + + protected renderServerAuthTokenSection(server: MCPServerDescription): React.ReactNode { + if (!isRemoteMCPServerDescription(server) || !server.serverAuthToken) { + return; + } + return ( +
    + {nls.localize('theia/ai/mcpConfiguration/serverAuthToken', 'Auth Token')}: + ****** +
    + ); + } + + protected renderServerHeadersSection(server: MCPServerDescription): React.ReactNode { + if (!isRemoteMCPServerDescription(server) || !server.headers) { + return; + } + return ( +
    + {nls.localize('theia/ai/mcpConfiguration/headers', 'Headers')}: +
    + {Object.entries(server.headers).map(([key, value]) => ( +
    + {key}={(key.toLowerCase().includes('token') || key.toLowerCase().includes('authorization')) ? '******' : String(value)} +
    + ))} +
    +
    + ); + } + + protected renderAutostartSection(server: MCPServerDescription): React.ReactNode { + return ( +
    + {nls.localize('theia/ai/mcpConfiguration/autostart', 'Autostart')}: + + {server.autostart ? nls.localizeByDefault('Enabled') : nls.localizeByDefault('Disabled')} + +
    + ); + } + + protected renderToolsSection(server: MCPServerDescription): React.ReactNode { + if (!server.tools || server.tools.length === 0) { + return; + } + const isToolsExpanded = this.expandedTools[server.name] || false; + return ( +
    +
    this.toggleTools(server.name)}> +
    + + {isToolsExpanded ? '▼' : '►'} + +
    +
    + {nls.localize('theia/ai/mcpConfiguration/tools', 'Tools: ')} +
    +
    + {this.renderButton( + , + nls.localize('theia/ai/mcpConfiguration/copyAllList', 'Copy all (list of all tools)'), + e => { + e.stopPropagation(); + if (server.tools) { + const toolNames = server.tools.map(tool => `~{mcp_${server.name}_${tool.name}}`).join('\n'); + navigator.clipboard.writeText(toolNames); + this.messageService.info(nls.localize('theia/ai/mcpConfiguration/copiedAllList', 'Copied all tools to clipboard (list of all tools)')); + } + }, + 'mcp-copy-tool-button' + )} + {this.renderButton( + , + nls.localize('theia/ai/mcpConfiguration/copyForPromptTemplate', 'Copy all for prompt template (single prompt fragment with all tools)'), + e => { + e.stopPropagation(); + navigator.clipboard.writeText(`{{${PROMPT_VARIABLE.name}:${this.mcpFrontendService.getPromptTemplateId(server.name)}}}`); + this.messageService.info(nls.localize('theia/ai/mcpConfiguration/copiedForPromptTemplate', 'Copied all tools to clipboard for prompt template \ + (single prompt fragment with all tools)')); + }, + 'mcp-copy-tool-button' + )} + {this.renderButton( + , + nls.localize('theia/ai/mcpConfiguration/copyAllSingle', 'Copy all for chat (single prompt fragment with all tools)'), + e => { + e.stopPropagation(); + navigator.clipboard.writeText(`#${PROMPT_VARIABLE.name}:${this.mcpFrontendService.getPromptTemplateId(server.name)}`); + this.messageService.info(nls.localize('theia/ai/mcpConfiguration/copiedAllSingle', 'Copied all tools to clipboard (single prompt fragment with \ + all tools)')); + }, + 'mcp-copy-tool-button' + )} +
    +
    + {isToolsExpanded && ( +
    + {server.tools.map(tool => ( +
    +
    + {tool.name}: {tool.description} +
    +
    + {this.renderButton( + , + nls.localize('theia/ai/mcpConfiguration/copyForPrompt', 'Copy tool (for chat or prompt template)'), + e => { + e.stopPropagation(); + const copied = `~{mcp_${server.name}_${tool.name}}`; + navigator.clipboard.writeText(copied); + this.messageService.info(`Copied ${copied} to clipboard (for chat or prompt template)`); + }, + 'mcp-copy-tool-button' + )} +
    +
    + ))} +
    + )} +
    + ); + } + + protected toggleTools(serverName: string): void { + this.expandedTools[serverName] = !this.expandedTools[serverName]; + this.update(); + } + + protected renderServerCard(server: MCPServerDescription): React.ReactNode { + return ( +
    + {this.renderServerHeader(server)} +
    + {this.renderCommandSection(server)} + {this.renderArgumentsSection(server)} + {this.renderEnvironmentSection(server)} + {this.renderServerUrlSection(server)} + {this.renderServerAuthTokenHeaderSection(server)} + {this.renderServerAuthTokenSection(server)} + {this.renderServerHeadersSection(server)} + {this.renderAutostartSection(server)} +
    + {this.renderToolsSection(server)} +
    + ); + } + + protected render(): React.ReactNode { + if (this.servers.length === 0) { + return ( +
    + {nls.localize('theia/ai/mcpConfiguration/noServers', 'No MCP servers configured')} +
    + ); + } + + return ( +
    + {this.servers.map(server => this.renderServerCard(server))} +
    + ); + } +} diff --git a/packages/ai-ide/src/browser/ai-configuration/mcp-configuration-widget.tsx.bak b/packages/ai-ide/src/browser/ai-configuration/mcp-configuration-widget.tsx.bak new file mode 100644 index 0000000..614971a --- /dev/null +++ b/packages/ai-ide/src/browser/ai-configuration/mcp-configuration-widget.tsx.bak @@ -0,0 +1,433 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { codicon, ReactWidget } from '@theia/core/lib/browser'; +import { inject, injectable, postConstruct } from '@theia/core/shared/inversify'; +import * as React from '@theia/core/shared/react'; +import { HoverService } from '@theia/core/lib/browser/hover-service'; +import { + isLocalMCPServerDescription, + isRemoteMCPServerDescription, + MCPFrontendNotificationService, + MCPFrontendService, + MCPServerDescription, + MCPServerStatus +} from '@theia/ai-mcp/lib/common/mcp-server-manager'; +import { MessageService, nls } from '@theia/core'; +import { PROMPT_VARIABLE } from '@theia/ai-core/lib/common/prompt-variable-contribution'; + +@injectable() +export class AIMCPConfigurationWidget extends ReactWidget { + + static readonly ID = 'ai-mcp-configuration-container-widget'; + static readonly LABEL = nls.localizeByDefault('MCP Servers'); + + protected servers: MCPServerDescription[] = []; + protected expandedTools: Record = {}; + + @inject(MCPFrontendService) + protected readonly mcpFrontendService: MCPFrontendService; + + @inject(MCPFrontendNotificationService) + protected readonly mcpFrontendNotificationService: MCPFrontendNotificationService; + + @inject(HoverService) + protected readonly hoverService: HoverService; + + @inject(MessageService) + protected readonly messageService: MessageService; + + @postConstruct() + protected init(): void { + this.id = AIMCPConfigurationWidget.ID; + this.title.label = AIMCPConfigurationWidget.LABEL; + this.title.closable = false; + this.toDispose.push(this.mcpFrontendNotificationService.onDidUpdateMCPServers(async () => { + this.loadServers(); + })); + this.loadServers(); + } + + protected async loadServers(): Promise { + const serverNames = await this.mcpFrontendService.getServerNames(); + const descriptions = await Promise.all(serverNames.map(name => this.mcpFrontendService.getServerDescription(name))); + this.servers = descriptions.filter((desc): desc is MCPServerDescription => desc !== undefined); + this.update(); + } + + protected getStatusColor(status?: MCPServerStatus): { bg: string, fg: string } { + if (!status) { + return { bg: 'var(--theia-descriptionForeground)', fg: 'white' }; + } + switch (status) { + case MCPServerStatus.Running: + case MCPServerStatus.Connected: + return { bg: 'var(--theia-successBackground)', fg: 'var(--theia-successForeground)' }; + case MCPServerStatus.Starting: + case MCPServerStatus.Connecting: + return { bg: 'var(--theia-warningBackground)', fg: 'var(--theia-warningForeground)' }; + case MCPServerStatus.Errored: + return { bg: 'var(--theia-errorBackground)', fg: 'var(--theia-errorForeground)' }; + case MCPServerStatus.NotRunning: + case MCPServerStatus.NotConnected: + default: + return { bg: 'var(--theia-inputValidation-infoBackground)', fg: 'var(--theia-inputValidation-infoForeground)' }; + } + } + + protected showErrorHover(spanRef: React.RefObject, error: string): void { + this.hoverService.requestHover({ content: error, target: spanRef.current!, position: 'left' }); + } + + protected hideErrorHover(): void { + this.hoverService.cancelHover(); + } + + protected async handleStartServer(serverName: string): Promise { + await this.mcpFrontendService.startServer(serverName); + } + + protected async handleStopServer(serverName: string): Promise { + await this.mcpFrontendService.stopServer(serverName); + } + + protected renderButton(text: React.ReactNode, + title: string, + onClick: React.MouseEventHandler, + className?: string, + style?: React.CSSProperties): React.ReactNode { + return ( + + ); + } + + protected renderStatusBadge(server: MCPServerDescription): React.ReactNode { + const colors = this.getStatusColor(server.status); + let displayStatus = server.status; + if (!displayStatus) { + displayStatus = isRemoteMCPServerDescription(server) ? MCPServerStatus.NotConnected : MCPServerStatus.NotRunning; + } + const spanRef = React.createRef(); + const error = server.error; + return ( +
    + + {displayStatus} + + {error && ( + this.showErrorHover(spanRef, error)} + onMouseLeave={() => this.hideErrorHover()} + ref={spanRef} + className="mcp-error-indicator" + > + ? + + )} +
    + ); + } + + protected renderServerHeader(server: MCPServerDescription): React.ReactNode { + const isStoppable = server.status === MCPServerStatus.Running + || server.status === MCPServerStatus.Connected; + const isStarting = server.status === MCPServerStatus.Starting + || server.status === MCPServerStatus.Connecting; + const isStartable = server.status === MCPServerStatus.NotRunning + || server.status === MCPServerStatus.NotConnected + || server.status === MCPServerStatus.Errored; + + const isRemote = isRemoteMCPServerDescription(server); + const startIcon = isRemote ? 'plug' : 'play'; + const startingIcon = 'loading'; + const stopIcon = isRemote ? 'debug-disconnect' : 'debug-stop'; + const startLabel = isRemote + ? nls.localize('theia/ai/mcpConfiguration/connectServer', 'Connect') + : nls.localizeByDefault('Start Server'); + const startingLabel = isRemote + ? nls.localize('theia/ai/mcpConfiguration/connectingServer', 'Connecting...') + : nls.localizeByDefault('Starting...'); + const stopLabel = isRemote + ? nls.localizeByDefault('Disconnect') + : nls.localizeByDefault('Stop Server'); + + return ( +
    +
    {server.name}
    +
    + {this.renderStatusBadge(server)} + {isStartable && ( +
    +
    + ); + } + + protected renderCommandSection(server: MCPServerDescription): React.ReactNode { + if (!isLocalMCPServerDescription(server)) { + return; + } + return ( +
    + {nls.localizeByDefault('Command')}: + {server.command} +
    + ); + } + + protected renderArgumentsSection(server: MCPServerDescription): React.ReactNode { + if (!isLocalMCPServerDescription(server) || !server.args || server.args.length === 0) { + return; + } + return ( +
    + {nls.localize('theia/ai/mcpConfiguration/arguments', 'Arguments')}: + {server.args.join(' ')} +
    + ); + } + + protected renderEnvironmentSection(server: MCPServerDescription): React.ReactNode { + if (!isLocalMCPServerDescription(server) || !server.env || Object.keys(server.env).length === 0) { + return; + } + return ( +
    + {nls.localize('theia/ai/mcpConfiguration/environmentVariables', 'Environment Variables')}: +
    + {Object.entries(server.env).map(([key, value]) => ( +
    + {key}={key.toLowerCase().includes('token') ? '******' : String(value)} +
    + ))} +
    +
    + ); + } + + protected renderServerUrlSection(server: MCPServerDescription): React.ReactNode { + if (!isRemoteMCPServerDescription(server)) { + return; + } + return ( +
    + {nls.localize('theia/ai/mcpConfiguration/serverUrl', 'Server URL')}: + {server.serverUrl} +
    + ); + } + + protected renderServerAuthTokenHeaderSection(server: MCPServerDescription): React.ReactNode { + if (!isRemoteMCPServerDescription(server) || !server.serverAuthTokenHeader) { + return; + } + return ( +
    + {nls.localize('theia/ai/mcpConfiguration/serverAuthTokenHeader', 'Auth Header Name')}: + {server.serverAuthTokenHeader} +
    + ); + } + + protected renderServerAuthTokenSection(server: MCPServerDescription): React.ReactNode { + if (!isRemoteMCPServerDescription(server) || !server.serverAuthToken) { + return; + } + return ( +
    + {nls.localize('theia/ai/mcpConfiguration/serverAuthToken', 'Auth Token')}: + ****** +
    + ); + } + + protected renderServerHeadersSection(server: MCPServerDescription): React.ReactNode { + if (!isRemoteMCPServerDescription(server) || !server.headers) { + return; + } + return ( +
    + {nls.localize('theia/ai/mcpConfiguration/headers', 'Headers')}: +
    + {Object.entries(server.headers).map(([key, value]) => ( +
    + {key}={(key.toLowerCase().includes('token') || key.toLowerCase().includes('authorization')) ? '******' : String(value)} +
    + ))} +
    +
    + ); + } + + protected renderAutostartSection(server: MCPServerDescription): React.ReactNode { + return ( +
    + {nls.localize('theia/ai/mcpConfiguration/autostart', 'Autostart')}: + + {server.autostart ? nls.localizeByDefault('Enabled') : nls.localizeByDefault('Disabled')} + +
    + ); + } + + protected renderToolsSection(server: MCPServerDescription): React.ReactNode { + if (!server.tools || server.tools.length === 0) { + return; + } + const isToolsExpanded = this.expandedTools[server.name] || false; + return ( +
    +
    this.toggleTools(server.name)}> +
    + + {isToolsExpanded ? '▼' : '►'} + +
    +
    + {nls.localize('theia/ai/mcpConfiguration/tools', 'Tools: ')} +
    +
    + {this.renderButton( + , + nls.localize('theia/ai/mcpConfiguration/copyAllList', 'Copy all (list of all tools)'), + e => { + e.stopPropagation(); + if (server.tools) { + const toolNames = server.tools.map(tool => `~{mcp_${server.name}_${tool.name}}`).join('\n'); + navigator.clipboard.writeText(toolNames); + this.messageService.info(nls.localize('theia/ai/mcpConfiguration/copiedAllList', 'Copied all tools to clipboard (list of all tools)')); + } + }, + 'mcp-copy-tool-button' + )} + {this.renderButton( + , + nls.localize('theia/ai/mcpConfiguration/copyForPromptTemplate', 'Copy all for prompt template (single prompt fragment with all tools)'), + e => { + e.stopPropagation(); + navigator.clipboard.writeText(`{{${PROMPT_VARIABLE.name}:${this.mcpFrontendService.getPromptTemplateId(server.name)}}}`); + this.messageService.info(nls.localize('theia/ai/mcpConfiguration/copiedForPromptTemplate', 'Copied all tools to clipboard for prompt template \ + (single prompt fragment with all tools)')); + }, + 'mcp-copy-tool-button' + )} + {this.renderButton( + , + nls.localize('theia/ai/mcpConfiguration/copyAllSingle', 'Copy all for chat (single prompt fragment with all tools)'), + e => { + e.stopPropagation(); + navigator.clipboard.writeText(`#${PROMPT_VARIABLE.name}:${this.mcpFrontendService.getPromptTemplateId(server.name)}`); + this.messageService.info(nls.localize('theia/ai/mcpConfiguration/copiedAllSingle', 'Copied all tools to clipboard (single prompt fragment with \ + all tools)')); + }, + 'mcp-copy-tool-button' + )} +
    +
    + {isToolsExpanded && ( +
    + {server.tools.map(tool => ( +
    +
    + {tool.name}: {tool.description} +
    +
    + {this.renderButton( + , + nls.localize('theia/ai/mcpConfiguration/copyForPrompt', 'Copy tool (for chat or prompt template)'), + e => { + e.stopPropagation(); + const copied = `~{mcp_${server.name}_${tool.name}}`; + navigator.clipboard.writeText(copied); + this.messageService.info(`Copied ${copied} to clipboard (for chat or prompt template)`); + }, + 'mcp-copy-tool-button' + )} +
    +
    + ))} +
    + )} +
    + ); + } + + protected toggleTools(serverName: string): void { + this.expandedTools[serverName] = !this.expandedTools[serverName]; + this.update(); + } + + protected renderServerCard(server: MCPServerDescription): React.ReactNode { + return ( +
    + {this.renderServerHeader(server)} +
    + {this.renderCommandSection(server)} + {this.renderArgumentsSection(server)} + {this.renderEnvironmentSection(server)} + {this.renderServerUrlSection(server)} + {this.renderServerAuthTokenHeaderSection(server)} + {this.renderServerAuthTokenSection(server)} + {this.renderServerHeadersSection(server)} + {this.renderAutostartSection(server)} +
    + {this.renderToolsSection(server)} +
    + ); + } + + protected render(): React.ReactNode { + if (this.servers.length === 0) { + return ( +
    + {nls.localize('theia/ai/mcpConfiguration/noServers', 'No MCP servers configured')} +
    + ); + } + + return ( +
    + {this.servers.map(server => this.renderServerCard(server))} +
    + ); + } +} diff --git a/packages/ai-ide/src/browser/ai-configuration/model-aliases-configuration-widget.tsx b/packages/ai-ide/src/browser/ai-configuration/model-aliases-configuration-widget.tsx new file mode 100644 index 0000000..9a134e9 --- /dev/null +++ b/packages/ai-ide/src/browser/ai-configuration/model-aliases-configuration-widget.tsx @@ -0,0 +1,270 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** +import * as React from '@theia/core/shared/react'; +import { inject, injectable, postConstruct } from '@theia/core/shared/inversify'; +import { LanguageModelAliasRegistry, LanguageModelAlias } from '@theia/ai-core/lib/common/language-model-alias'; +import { FrontendLanguageModelRegistry, LanguageModel, LanguageModelRegistry, LanguageModelRequirement } from '@theia/ai-core/lib/common/language-model'; +import { nls } from '@theia/core/lib/common/nls'; +import { AgentService, AISettingsService } from '@theia/ai-core'; +import { AIListDetailConfigurationWidget } from './base/ai-list-detail-configuration-widget'; +import { ConfigurationSection } from './components/configuration-section'; + +@injectable() +export class ModelAliasesConfigurationWidget extends AIListDetailConfigurationWidget { + static readonly ID = 'ai-model-aliases-configuration-widget'; + static readonly LABEL = nls.localize('theia/ai/core/modelAliasesConfiguration/label', 'Model Aliases'); + + @inject(LanguageModelAliasRegistry) + protected readonly languageModelAliasRegistry: LanguageModelAliasRegistry; + @inject(LanguageModelRegistry) + protected readonly languageModelRegistry: FrontendLanguageModelRegistry; + @inject(AISettingsService) + protected readonly aiSettingsService: AISettingsService; + @inject(AgentService) + protected readonly agentService: AgentService; + + protected languageModels: LanguageModel[] = []; + protected matchingAgentIdsForAliasMap: Map = new Map(); + protected resolvedModelForAlias: Map = new Map(); + + @postConstruct() + protected init(): void { + this.id = ModelAliasesConfigurationWidget.ID; + this.title.label = ModelAliasesConfigurationWidget.LABEL; + this.title.closable = false; + + Promise.all([ + this.loadItems(), + this.loadLanguageModels() + ]).then(() => this.update()); + + this.languageModelAliasRegistry.ready.then(() => + this.toDispose.push(this.languageModelAliasRegistry.onDidChange(async () => { + await this.loadItems(); + this.update(); + })) + ); + + this.toDispose.pushAll([ + this.languageModelRegistry.onChange(async () => { + await this.loadItems(); + await this.loadLanguageModels(); + this.update(); + }), + this.aiSettingsService.onDidChange(async () => { + await this.loadMatchingAgentIdsForAllAliases(); + this.update(); + }) + ]); + } + + protected override async loadItems(): Promise { + await this.languageModelAliasRegistry.ready; + this.items = this.languageModelAliasRegistry.getAliases(); + + // Set initial selection + if (this.items.length > 0 && !this.selectedItem) { + this.selectedItem = this.items[0]; + } + + await this.loadMatchingAgentIdsForAllAliases(); + + // Resolve evaluated models for each alias + this.resolvedModelForAlias = new Map(); + for (const alias of this.items) { + const model = await this.languageModelRegistry.getReadyLanguageModel(alias.id); + this.resolvedModelForAlias.set(alias.id, model); + } + } + + protected async loadLanguageModels(): Promise { + this.languageModels = await this.languageModelRegistry.getLanguageModels(); + } + + protected async loadMatchingAgentIdsForAllAliases(): Promise { + const agents = this.agentService.getAllAgents(); + const aliasMap: Map = new Map(); + for (const alias of this.items) { + const matchingAgentIds: string[] = []; + for (const agent of agents) { + const requirementSetting = await this.aiSettingsService.getAgentSettings(agent.id); + if (requirementSetting?.languageModelRequirements) { + if (requirementSetting?.languageModelRequirements?.find(e => e.identifier === alias.id)) { + matchingAgentIds.push(agent.id); + } + } else { + if (agent.languageModelRequirements.some((req: LanguageModelRequirement) => req.identifier === alias.id)) { + matchingAgentIds.push(agent.id); + } + } + } + aliasMap.set(alias.id, matchingAgentIds); + } + this.matchingAgentIdsForAliasMap = aliasMap; + } + + protected override getItemId(item: LanguageModelAlias): string { + return item.id; + } + + protected override getItemLabel(item: LanguageModelAlias): string { + return item.id; + } + + protected override getEmptySelectionMessage(): string { + return nls.localize('theia/ai/core/modelAliasesConfiguration/selectAlias', 'Please select a Model Alias.'); + } + + protected handleAliasSelectedModelIdChange = (alias: LanguageModelAlias, event: React.ChangeEvent): void => { + const newModelId = event.target.value || undefined; + const updatedAlias: LanguageModelAlias = { + ...alias, + selectedModelId: newModelId + }; + this.languageModelAliasRegistry.ready.then(() => { + this.languageModelAliasRegistry.addAlias(updatedAlias); + }); + this.handleItemSelect(updatedAlias); + }; + + protected override renderItemDetail(alias: LanguageModelAlias): React.ReactNode { + const availableModelIds = this.languageModels.map(m => m.id); + const selectedModelId = alias.selectedModelId ?? ''; + const isInvalidModel = !!selectedModelId && !availableModelIds.includes(alias.selectedModelId ?? ''); + const agentIds = this.matchingAgentIdsForAliasMap.get(alias.id) || []; + const agents = this.agentService.getAllAgents().filter(agent => agentIds.includes(agent.id)); + const resolvedModel = this.resolvedModelForAlias.get(alias.id); + + return ( +
    +
    + {alias.id} +
    + + {alias.description && ( +
    {alias.description}
    + )} + + + + + + {alias.selectedModelId === undefined && ( + <> + +
      + {alias.defaultModelIds.map(modelId => { + const model = this.languageModels.find(m => m.id === modelId); + const isReady = model?.status.status === 'ready'; + return ( +
    1. + {isReady ? ( + + {modelId} + + ) : ( + + {modelId} + + )} +
    2. + ); + })} +
    +
    + + + {resolvedModel ? ( + + {resolvedModel.name ?? resolvedModel.id} + {resolvedModel.status.status === 'ready' ? ( + + ) : ( + + )} + + ) : ( + + {nls.localize('theia/ai/core/modelAliasesConfiguration/noResolvedModel', 'No model ready for this alias.')} + + )} + + + )} + + +
      + {agents.length > 0 ? ( + agents.map(agent => ( +
    • + {agent.name} + {agent.id !== agent.name && ({agent.id})} +
    • + )) + ) : ( + {nls.localize('theia/ai/core/modelAliasesConfiguration/noAgents', 'No agents use this alias.')} + )} +
    +
    +
    + ); + } +} diff --git a/packages/ai-ide/src/browser/ai-configuration/prompt-fragments-configuration-widget.tsx b/packages/ai-ide/src/browser/ai-configuration/prompt-fragments-configuration-widget.tsx new file mode 100644 index 0000000..4cff05f --- /dev/null +++ b/packages/ai-ide/src/browser/ai-configuration/prompt-fragments-configuration-widget.tsx @@ -0,0 +1,735 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { nls } from '@theia/core'; +import { ConfirmDialog, ReactWidget, codicon } from '@theia/core/lib/browser'; +import { inject, injectable, postConstruct } from '@theia/core/shared/inversify'; +import { + CustomizedPromptFragment, + PromptFragment, + isCustomizedPromptFragment, + isBasePromptFragment, + PromptService, + BasePromptFragment +} from '@theia/ai-core/lib/common/prompt-service'; +import * as React from '@theia/core/shared/react'; +import { AgentService } from '@theia/ai-core/lib/common/agent-service'; +import { Agent } from '@theia/ai-core/lib/common/agent'; +import { CustomizationSource } from '@theia/ai-core/lib/browser/frontend-prompt-customization-service'; + +/** + * Widget for configuring AI prompt fragments and prompt variant sets. + * Allows users to view, create, edit, and manage various types of prompt + * fragments including their customizations and variants. + */ +@injectable() +export class AIPromptFragmentsConfigurationWidget extends ReactWidget { + + static readonly ID = 'ai-prompt-fragments-configuration'; + static readonly LABEL = nls.localize('theia/ai/core/promptFragmentsConfiguration/label', 'Prompt Fragments'); + + /** + * Stores all available prompt fragments by ID + */ + protected promptFragmentMap: Map = new Map(); + + /** + * Stores prompt variant sets and their variant IDs + */ + protected promptVariantsMap: Map = new Map(); + + /** + * Currently active prompt fragments + */ + protected activePromptFragments: PromptFragment[] = []; + + /** + * Tracks expanded state of prompt fragment sections in the UI + */ + protected expandedPromptFragmentIds: Set = new Set(); + + /** + * Tracks expanded state of prompt content display + */ + protected expandedPromptFragmentTemplates: Set = new Set(); + + /** + * Tracks expanded state of prompt variant set sections + */ + protected expandedPromptVariantSetIds: Set = new Set(); + + /** + * All available agents that may use prompts + */ + protected availableAgents: Agent[] = []; + + /** + * Maps prompt variant set IDs to their resolved variant IDs + */ + protected effectiveVariantIds: Map = new Map(); + + /** + * Maps prompt variant set IDs to their default variant IDs + */ + protected defaultVariantIds: Map = new Map(); + + /** + * Maps prompt variant set IDs to their user selected variant IDs + */ + protected userSelectedVariantIds: Map = new Map(); + + @inject(PromptService) protected promptService: PromptService; + @inject(AgentService) protected agentService: AgentService; + + @postConstruct() + protected init(): void { + this.id = AIPromptFragmentsConfigurationWidget.ID; + this.title.label = AIPromptFragmentsConfigurationWidget.LABEL; + this.title.caption = AIPromptFragmentsConfigurationWidget.LABEL; + this.title.closable = true; + this.addClass('ai-configuration-tab-content'); + this.loadPromptFragments(); + this.loadAgents(); + + this.toDispose.pushAll([ + this.promptService.onPromptsChange(() => { + this.loadPromptFragments(); + }), + this.agentService.onDidChangeAgents(() => { + this.loadAgents(); + }) + ]); + } + + /** + * Loads all prompt fragments and prompt variant sets from the prompt service. + * Preserves UI expansion states and updates variant information. + */ + protected loadPromptFragments(): void { + this.promptFragmentMap = this.promptService.getAllPromptFragments(); + this.promptVariantsMap = this.promptService.getPromptVariantSets(); + this.activePromptFragments = this.promptService.getActivePromptFragments(); + + // Preserve expansion state when reloading + const existingExpandedFragmentIds = new Set(this.expandedPromptFragmentIds); + const existingExpandedPromptVariantIds = new Set(this.expandedPromptVariantSetIds); + const existingExpandedTemplates = new Set(this.expandedPromptFragmentTemplates); + + if (existingExpandedFragmentIds.size > 0) { + // Keep existing expansion state but remove entries for fragments that no longer exist + this.expandedPromptFragmentIds = new Set( + Array.from(existingExpandedFragmentIds).filter(id => this.promptFragmentMap.has(id)) + ); + } + + if (existingExpandedPromptVariantIds.size === 0) { + // Start with variant sets collapsed by default + this.expandedPromptVariantSetIds = new Set(); + } else { + // Keep existing expansion state but remove entries for prompt variant sets that no longer exist + this.expandedPromptVariantSetIds = new Set( + Array.from(existingExpandedPromptVariantIds).filter(id => this.promptVariantsMap.has(id)) + ); + } + + // For templates, preserve existing expanded states - don't expand by default + this.expandedPromptFragmentTemplates = new Set( + Array.from(existingExpandedTemplates).filter(id => { + const [fragmentId] = id.split('_'); + return this.promptFragmentMap.has(fragmentId); + }) + ); + + // Update variant information (selected/default/effective) for prompt variant sets + for (const promptVariantSetId of this.promptVariantsMap.keys()) { + const effectiveId = this.promptService.getEffectiveVariantId(promptVariantSetId); + const defaultId = this.promptService.getDefaultVariantId(promptVariantSetId); + const selectedId = this.promptService.getSelectedVariantId(promptVariantSetId) ?? defaultId; + this.userSelectedVariantIds.set(promptVariantSetId, selectedId); + this.effectiveVariantIds.set(promptVariantSetId, effectiveId); + this.defaultVariantIds.set(promptVariantSetId, defaultId); + } + + this.update(); + } + + /** + * Loads all available agents from the agent service + */ + protected loadAgents(): void { + this.availableAgents = this.agentService.getAllAgents(); + this.update(); + } + + /** + * Finds agents that use a specific prompt variant set + * @param promptVariantSetId ID of the prompt variant set to match + * @returns Array of agents that use the prompt variant set + */ + protected getAgentsUsingPromptVariantId(promptVariantSetId: string): Agent[] { + return this.availableAgents.filter((agent: Agent) => + agent.prompts.find(promptVariantSet => promptVariantSet.id === promptVariantSetId) + ); + } + + protected togglePromptVariantSetExpansion = (promptVariantSetId: string): void => { + if (this.expandedPromptVariantSetIds.has(promptVariantSetId)) { + this.expandedPromptVariantSetIds.delete(promptVariantSetId); + } else { + this.expandedPromptVariantSetIds.add(promptVariantSetId); + } + this.update(); + }; + + protected togglePromptFragmentExpansion = (promptFragmentId: string): void => { + if (this.expandedPromptFragmentIds.has(promptFragmentId)) { + this.expandedPromptFragmentIds.delete(promptFragmentId); + } else { + this.expandedPromptFragmentIds.add(promptFragmentId); + } + this.update(); + }; + + protected toggleTemplateExpansion = (fragmentKey: string, event: React.MouseEvent): void => { + event.stopPropagation(); + if (this.expandedPromptFragmentTemplates.has(fragmentKey)) { + this.expandedPromptFragmentTemplates.delete(fragmentKey); + } else { + this.expandedPromptFragmentTemplates.add(fragmentKey); + } + this.update(); + }; + + /** + * Call the edit action for the provided customized prompt fragment + * @param promptFragment Fragment to edit + * @param event Mouse event + */ + protected editPromptCustomization = (promptFragment: CustomizedPromptFragment, event: React.MouseEvent): void => { + event.stopPropagation(); + this.promptService.editCustomization(promptFragment.id, promptFragment.customizationId); + }; + + /** + * Determines if a prompt fragment is currently the active one for its ID + * @param promptFragment The prompt fragment to check + * @returns True if this prompt fragment is the active customization + */ + protected isActiveCustomization(promptFragment: PromptFragment): boolean { + const activePromptFragment = this.activePromptFragments.find(activePrompt => activePrompt.id === promptFragment.id); + if (!activePromptFragment) { + return false; + } + + if (isCustomizedPromptFragment(activePromptFragment) && isCustomizedPromptFragment(promptFragment)) { + return ( + activePromptFragment.id === promptFragment.id && + activePromptFragment.template === promptFragment.template && + activePromptFragment.customizationId === promptFragment.customizationId && + activePromptFragment.priority === promptFragment.priority + ); + } + + if (isBasePromptFragment(activePromptFragment) && isBasePromptFragment(promptFragment)) { + return ( + activePromptFragment.id === promptFragment.id && + activePromptFragment.template === promptFragment.template + ); + } + + return false; + } + + /** + * Resets a prompt fragment to use a specific customization (with confirmation dialog) + * @param customization customization to reset to + * @param event Mouse event + */ + protected resetToPromptFragment = async (customization: PromptFragment, event: React.MouseEvent): Promise => { + event.stopPropagation(); + + if (isCustomizedPromptFragment(customization)) { + // Get the customization type to show in the confirmation dialog + const type = await this.promptService.getCustomizationType(customization.id, customization.customizationId); + + const dialog = new ConfirmDialog({ + title: nls.localize('theia/ai/core/promptFragmentsConfiguration/resetToCustomizationDialogTitle', 'Reset to Customization'), + msg: nls.localize('theia/ai/core/promptFragmentsConfiguration/resetToCustomizationDialogMsg', + 'Are you sure you want to reset the prompt fragment "{0}" to use the {1} customization? This will remove all higher-priority customizations.', + customization.id, type), + ok: nls.localizeByDefault('Reset'), + cancel: nls.localizeByDefault('Cancel') + }); + + const shouldReset = await dialog.open(); + if (shouldReset) { + await this.promptService.resetToCustomization(customization.id, customization.customizationId); + } + } else { + const dialog = new ConfirmDialog({ + title: nls.localize('theia/ai/core/promptFragmentsConfiguration/resetToBuiltInDialogTitle', 'Reset to Built-in'), + msg: nls.localize('theia/ai/core/promptFragmentsConfiguration/resetToBuiltInDialogMsg', + 'Are you sure you want to reset the prompt fragment "{0}" to its built-in version? This will remove all customizations.', customization.id), + ok: nls.localizeByDefault('Reset'), + cancel: nls.localizeByDefault('Cancel') + }); + + const shouldReset = await dialog.open(); + if (shouldReset) { + await this.promptService.resetToBuiltIn(customization.id); + } + } + }; + + /** + * Creates a new customization for a built-in prompt fragment + * @param promptFragment Built-in prompt fragment to customize + * @param event Mouse event + */ + protected createPromptFragmentCustomization = (promptFragment: BasePromptFragment, event: React.MouseEvent): void => { + event.stopPropagation(); + this.promptService.createBuiltInCustomization(promptFragment.id); + }; + + /** + * Deletes a customization with confirmation dialog + * @param customization Customized prompt fragment to delete + * @param event Mouse event + */ + protected deletePromptFragmentCustomization = async (customization: CustomizedPromptFragment, event: React.MouseEvent): Promise => { + event.stopPropagation(); + + // First get the customization type and description to show in the confirmation dialog + const type = await this.promptService.getCustomizationType(customization.id, customization.customizationId) || ''; + const description = await this.promptService.getCustomizationDescription(customization.id, customization.customizationId) || ''; + + const dialog = new ConfirmDialog({ + title: nls.localize('theia/ai/core/promptFragmentsConfiguration/removeCustomizationDialogTitle', 'Remove Customization'), + msg: description ? + nls.localize('theia/ai/core/promptFragmentsConfiguration/removeCustomizationWithDescDialogMsg', + 'Are you sure you want to remove the {0} customization for prompt fragment "{1}" ({2})?', type, customization.id, description) : + nls.localize('theia/ai/core/promptFragmentsConfiguration/removeCustomizationDialogMsg', + 'Are you sure you want to remove the {0} customization for prompt fragment "{1}"?', type, customization.id), + ok: nls.localizeByDefault('Remove'), + cancel: nls.localizeByDefault('Cancel') + }); + + const shouldDelete = await dialog.open(); + if (shouldDelete) { + await this.promptService.removeCustomization(customization.id, customization.customizationId); + } + }; + + /** + * Removes all prompt customizations (resets to built-in versions) with confirmation + */ + protected removeAllCustomizations = async (): Promise => { + const dialog = new ConfirmDialog({ + title: nls.localize('theia/ai/core/promptFragmentsConfiguration/resetAllCustomizationsDialogTitle', 'Reset All Customizations'), + msg: nls.localize('theia/ai/core/promptFragmentsConfiguration/resetAllCustomizationsDialogMsg', + 'Are you sure you want to reset all prompt fragments to their built-in versions? This will remove all customizations.'), + ok: nls.localize('theia/ai/core/promptFragmentsConfiguration/resetAllButton', 'Reset All'), + cancel: nls.localizeByDefault('Cancel') + }); + + const shouldReset = await dialog.open(); + if (shouldReset) { + this.promptService.resetAllToBuiltIn(); + } + }; + + /** + * Main render method for the widget + * @returns Complete UI for the configuration widget + */ + protected render(): React.ReactNode { + const nonSystemPromptFragments = this.getNonPromptVariantSetFragments(); + + return ( +
    +
    +

    {nls.localize('theia/ai/core/promptFragmentsConfiguration/headerTitle', 'Prompt Fragments')}

    +
    + +
    +
    + +
    +

    {nls.localize('theia/ai/core/promptFragmentsConfiguration/promptVariantsHeader', 'Prompt Variant Sets')}

    + {Array.from(this.promptVariantsMap.entries()).map(([promptVariantSetId, variantIds]) => + this.renderPromptVariantSet(promptVariantSetId, variantIds) + )} +
    + + {nonSystemPromptFragments.size > 0 &&
    +

    {nls.localize('theia/ai/core/promptFragmentsConfiguration/otherPromptFragmentsHeader', 'Other Prompt Fragments')}

    + {Array.from(nonSystemPromptFragments.entries()).map(([promptFragmentId, fragments]) => + this.renderPromptFragment(promptFragmentId, fragments) + )} +
    } + + {this.promptFragmentMap.size === 0 && ( +
    +

    {nls.localize('theia/ai/core/promptFragmentsConfiguration/noFragmentsAvailable', 'No prompt fragments available.')}

    +
    + )} +
    + ); + } + + /** + * Renders a prompt variant set with its variants + * @param promptVariantSetId ID of the prompt variant set + * @param variantIds Array of variant IDs + * @returns React node for the prompt variant set group + */ + protected renderPromptVariantSet(promptVariantSetId: string, variantIds: string[]): React.ReactNode { + const isSectionExpanded = this.expandedPromptVariantSetIds.has(promptVariantSetId); + + // Get selected, effective, and default variant IDs from our class properties + const selectedVariantId = this.userSelectedVariantIds.get(promptVariantSetId); + const effectiveVariantId = this.effectiveVariantIds.get(promptVariantSetId); + const defaultVariantId = this.defaultVariantIds.get(promptVariantSetId); + + // Get variant fragments grouped by ID + const variantGroups = new Map(); + + // First, collect all actual fragments for each variant ID + for (const variantId of variantIds) { + if (this.promptFragmentMap.has(variantId)) { + variantGroups.set(variantId, this.promptFragmentMap.get(variantId)!); + } + } + + const relatedAgents = this.getAgentsUsingPromptVariantId(promptVariantSetId); + + // Determine warning/error state + let variantSetMessage: React.ReactNode | undefined = undefined; + if (effectiveVariantId === undefined) { + // Error: effectiveId is undefined, so nothing works + variantSetMessage = ( +
    + + {nls.localize('theia/ai/core/promptFragmentsConfiguration/variantSetError', + 'The selected variant does not exist and no default could be found. Please check your configuration.')} +
    + ); + } else { + const needsWarning = selectedVariantId ? effectiveVariantId !== selectedVariantId : effectiveVariantId !== defaultVariantId; + if (needsWarning) { + // Warning: selectedId is set but does not exist, so default is used + variantSetMessage = ( +
    + + {nls.localize('theia/ai/core/promptFragmentsConfiguration/variantSetWarning', + 'The selected variant does not exist. The default variant is being used instead.')} +
    + ); + } + } + + return ( +
    +
    this.togglePromptVariantSetExpansion(promptVariantSetId)} + > +
    + {isSectionExpanded ? '▼' : '▶'} +

    {promptVariantSetId}

    +
    + {relatedAgents.length > 0 && ( +
    + {relatedAgents.map(agent => ( + e.stopPropagation()}> + + {agent.name} + + ))} +
    + )} +
    + {isSectionExpanded && ( +
    + {variantSetMessage} +
    +

    {nls.localize('theia/ai/core/promptFragmentsConfiguration/variantsOfSystemPrompt', 'Variants of this prompt variant set:')}

    +
    + {Array.from(variantGroups.entries()).map(([variantId, fragments]) => { + const isVariantExpanded = this.expandedPromptFragmentIds.has(variantId); + + return ( +
    +
    this.togglePromptFragmentExpansion(variantId)} + > +
    + {isVariantExpanded ? '▼' : '▶'} +

    {variantId}

    + {defaultVariantId === variantId && ( + + {nls.localizeByDefault('Default')} + + )} + {selectedVariantId === variantId && ( + + {nls.localize('theia/ai/core/promptFragmentsConfiguration/selectedVariantLabel', 'Selected')} + + )} +
    +
    + {isVariantExpanded && ( +
    + {fragments.map(fragment => this.renderPromptFragmentCustomization(fragment))} +
    + )} +
    + ); + })} +
    + )} +
    + ); + } + + /** + * Gets fragments that aren't part of any prompt variant set + * @returns Map of fragment IDs to their customizations + */ + protected getNonPromptVariantSetFragments(): Map { + const nonSystemPromptFragments = new Map(); + const allVariantIds = new Set(); + + // Collect all variant IDs from prompt variant sets + this.promptVariantsMap.forEach((variants, _) => { + variants.forEach(variantId => allVariantIds.add(variantId)); + }); + + // Add prompt variant set main IDs + this.promptVariantsMap.forEach((_, promptVariantSetId) => { + allVariantIds.add(promptVariantSetId); + }); + + // Filter the fragment map to only include non-prompt variant set fragments + this.promptFragmentMap.forEach((fragments, promptFragmentId) => { + if (!allVariantIds.has(promptFragmentId)) { + nonSystemPromptFragments.set(promptFragmentId, fragments); + } + }); + + return nonSystemPromptFragments; + } + + /** + * Renders a prompt fragment with all of its customizations + * @param promptFragmentId ID of the prompt fragment + * @param customizations Array of the customizations + * @returns React node for the prompt fragment + */ + protected renderPromptFragment(promptFragmentId: string, customizations: PromptFragment[]): React.ReactNode { + const isSectionExpanded = this.expandedPromptFragmentIds.has(promptFragmentId); + + return ( +
    +
    this.togglePromptFragmentExpansion(promptFragmentId)} + > +
    + {isSectionExpanded ? '▼' : '▶'} + {promptFragmentId} +
    +
    + {isSectionExpanded && ( +
    + {customizations.map(fragment => this.renderPromptFragmentCustomization(fragment))} +
    + )} +
    + ); + } + + /** + * Renders a single prompt fragment customization with its controls and content + * @param promptFragment The prompt fragment to render + * @returns React node for the prompt fragment + */ + protected renderPromptFragmentCustomization(promptFragment: PromptFragment): React.ReactNode { + const isCustomized = isCustomizedPromptFragment(promptFragment); + const isActive = this.isActiveCustomization(promptFragment); + // Create a unique key for this fragment to track expansion state + const fragmentKey = `${promptFragment.id}_${isCustomized ? promptFragment.customizationId : 'built-in'}`; + const isTemplateExpanded = this.expandedPromptFragmentTemplates.has(fragmentKey); + const hasCustomizedBuiltIn = + this.promptFragmentMap.get(promptFragment.id)?.some(fragment => isCustomizedPromptFragment(fragment) && fragment.priority === CustomizationSource.CUSTOMIZED); + + return ( +
    +
    +
    + Loading...
    }> + + + {isActive && ( + + {nls.localizeByDefault('Active')} + + )} +
    +
    + {!isCustomized && !hasCustomizedBuiltIn && ( + + )} + {isCustomized && ( + + )} + {!isActive && ( + + )} + {isCustomized && ( + + )} +
    +
    + + {isCustomized && ( + Loading...
    }> + + + )} + +
    +
    this.toggleTemplateExpansion(fragmentKey, e)} + > + {isTemplateExpanded ? '▼' : '▶'} + {nls.localize('theia/ai/core/promptFragmentsConfiguration/promptTemplateText', 'Prompt Template Text')} +
    + + {isTemplateExpanded && ( +
    +
    {promptFragment.template}
    +
    + )} +
    +
    + ); + } +} + +/** + * Props for the CustomizationTypeBadge component + */ +interface CustomizationTypeBadgeProps { + promptFragment: PromptFragment; + promptService: PromptService; +} + +/** + * Displays a badge indicating the type of a prompt fragment customization (built-in, user, workspace) + */ +const CustomizationTypeBadge: React.FC = ({ promptFragment, promptService }) => { + const [typeLabel, setTypeLabel] = React.useState('unknown'); + + React.useEffect(() => { + const fetchCustomizationType = async () => { + if (isCustomizedPromptFragment(promptFragment)) { + const customizationType = await promptService.getCustomizationType(promptFragment.id, promptFragment.customizationId); + setTypeLabel(`${customizationType ? + customizationType + ' ' + nls.localize('theia/ai/core/promptFragmentsConfiguration/customization', 'customization') + : nls.localize('theia/ai/core/promptFragmentsConfiguration/customizationLabel', 'Customization')}`); + } else { + setTypeLabel(nls.localizeByDefault('Built-in')); + } + }; + + fetchCustomizationType(); + }, [promptFragment, promptService]); + + return {typeLabel}; +}; + +/** + * Props for the DescriptionBadge component + */ +interface CustomizationDescriptionBadgeProps { + promptFragment: CustomizedPromptFragment; + promptService: PromptService; +} + +/** + * Displays the description of a customized prompt fragment if available + */ +const DescriptionBadge: React.FC = ({ promptFragment, promptService }) => { + const [description, setDescription] = React.useState(''); + + React.useEffect(() => { + const fetchDescription = async () => { + const customizationDescription = await promptService.getCustomizationDescription( + promptFragment.id, + promptFragment.customizationId + ); + setDescription(customizationDescription || ''); + }; + + fetchDescription(); + }, [promptFragment.id, promptFragment.customizationId, promptService]); + + return {description}; +}; diff --git a/packages/ai-ide/src/browser/ai-configuration/skills-configuration-widget.spec.ts b/packages/ai-ide/src/browser/ai-configuration/skills-configuration-widget.spec.ts new file mode 100644 index 0000000..67d33da --- /dev/null +++ b/packages/ai-ide/src/browser/ai-configuration/skills-configuration-widget.spec.ts @@ -0,0 +1,153 @@ +// ***************************************************************************** +// Copyright (C) 2026 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { enableJSDOM } from '@theia/core/lib/browser/test/jsdom'; +let disableJSDOM = enableJSDOM(); + +import { FrontendApplicationConfigProvider } from '@theia/core/lib/browser/frontend-application-config-provider'; +FrontendApplicationConfigProvider.set({}); + +import { expect } from 'chai'; +import * as React from '@theia/core/shared/react'; +import * as ReactDOM from '@theia/core/shared/react-dom'; + +import { Emitter, URI } from '@theia/core'; + +import { OpenHandler, OpenerService } from '@theia/core/lib/browser'; +import { Skill } from '@theia/ai-core/lib/common/skill'; +import { SkillService } from '@theia/ai-core/lib/browser/skill-service'; + +import { AISkillsConfigurationWidget } from './skills-configuration-widget'; + +disableJSDOM(); + +describe('AISkillsConfigurationWidget', () => { + let host: HTMLElement; + + before(() => { + disableJSDOM = enableJSDOM(); + }); + + after(() => { + disableJSDOM(); + }); + + beforeEach(() => { + host = document.createElement('div'); + document.body.appendChild(host); + }); + + afterEach(() => { + ReactDOM.unmountComponentAtNode(host); + host.remove(); + }); + + function renderWidget(widget: AISkillsConfigurationWidget): void { + const element = (widget as unknown as { render: () => React.ReactNode }).render(); + ReactDOM.render(element as React.ReactElement, host); + } + + it('renders empty state when SkillService.getSkills() returns []', () => { + const widget = new AISkillsConfigurationWidget(); + + const onSkillsChangedEmitter = new Emitter(); + const skillService: Partial = { + getSkills: () => [], + onSkillsChanged: onSkillsChangedEmitter.event + }; + (widget as unknown as { skillService: SkillService }).skillService = skillService as SkillService; + + (widget as unknown as { openerService: OpenerService }).openerService = {} as OpenerService; + + (widget as unknown as { init: () => void }).init(); + renderWidget(widget); + + expect(host.querySelectorAll('tbody tr').length).to.equal(0); + }); + + it('renders multiple skills with correct name/description/location', () => { + const widget = new AISkillsConfigurationWidget(); + + const skills: Skill[] = [ + { name: 'Skill A', description: 'Desc A', location: '/path/a' } as Skill, + { name: 'Skill B', description: 'Desc B', location: '/path/b' } as Skill + ]; + + const onSkillsChangedEmitter = new Emitter(); + const skillService: Partial = { + getSkills: () => skills, + onSkillsChanged: onSkillsChangedEmitter.event + }; + (widget as unknown as { skillService: SkillService }).skillService = skillService as SkillService; + + (widget as unknown as { openerService: OpenerService }).openerService = {} as OpenerService; + + (widget as unknown as { init: () => void }).init(); + renderWidget(widget); + + const rows = Array.from(host.querySelectorAll('tbody tr')); + expect(rows.length).to.equal(2); + + expect(rows[0].querySelector('.skill-name-column')?.textContent).to.contain('Skill A'); + expect(rows[0].querySelector('.skill-description-column')?.textContent).to.contain('Desc A'); + expect(rows[0].querySelector('.skill-location-column')?.textContent).to.contain('/path/a'); + + expect(rows[1].querySelector('.skill-name-column')?.textContent).to.contain('Skill B'); + expect(rows[1].querySelector('.skill-description-column')?.textContent).to.contain('Desc B'); + expect(rows[1].querySelector('.skill-location-column')?.textContent).to.contain('/path/b'); + }); + + it('clicking "Open" calls opener with URI.fromFilePath(skill.location)', async () => { + const widget = new AISkillsConfigurationWidget(); + + const skills: Skill[] = [ + { name: 'Skill A', description: 'Desc A', location: '/path/a' } as Skill + ]; + + const onSkillsChangedEmitter = new Emitter(); + const skillService: Partial = { + getSkills: () => skills, + onSkillsChanged: onSkillsChangedEmitter.event + }; + (widget as unknown as { skillService: SkillService }).skillService = skillService as SkillService; + + let openedUri: URI | undefined; + const opener: OpenHandler = { + id: 'test-opener', + canHandle: async () => 1, + open: async (uri: URI) => { openedUri = uri; } + }; + const openerService: Partial = { + getOpener: async () => opener, + // The widget calls `open(openerService, uri)` which internally uses `getOpener`. + // Provide `getOpeners` as well in case other code paths expect it. + getOpeners: async () => [opener] + }; + (widget as unknown as { openerService: OpenerService }).openerService = openerService as OpenerService; + + (widget as unknown as { init: () => void }).init(); + renderWidget(widget); + + const button = host.querySelector('button[title="Open"]'); + expect(button).not.to.equal(undefined); + + (button as HTMLButtonElement).click(); + + await Promise.resolve(); + + expect(openedUri?.toString()).to.equal(URI.fromFilePath('/path/a').toString()); + }); +}); diff --git a/packages/ai-ide/src/browser/ai-configuration/skills-configuration-widget.tsx b/packages/ai-ide/src/browser/ai-configuration/skills-configuration-widget.tsx new file mode 100644 index 0000000..245240d --- /dev/null +++ b/packages/ai-ide/src/browser/ai-configuration/skills-configuration-widget.tsx @@ -0,0 +1,97 @@ +// ***************************************************************************** +// Copyright (C) 2026 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { nls, URI } from '@theia/core'; +import { OpenerService, open } from '@theia/core/lib/browser'; +import { inject, injectable, postConstruct } from '@theia/core/shared/inversify'; +import * as React from '@theia/core/shared/react'; +import { Skill } from '@theia/ai-core/lib/common/skill'; +import { SkillService } from '@theia/ai-core/lib/browser/skill-service'; +import { AITableConfigurationWidget, TableColumn } from './base/ai-table-configuration-widget'; + +@injectable() +export class AISkillsConfigurationWidget extends AITableConfigurationWidget { + static readonly ID = 'ai-skills-configuration-widget'; + static readonly LABEL = nls.localize('theia/ai/ide/skillsConfiguration/label', 'Skills'); + + @inject(SkillService) + protected readonly skillService: SkillService; + + @inject(OpenerService) + protected readonly openerService: OpenerService; + + @postConstruct() + protected init(): void { + this.id = AISkillsConfigurationWidget.ID; + this.title.label = AISkillsConfigurationWidget.LABEL; + this.title.closable = false; + this.addClass('ai-configuration-widget'); + + this.loadItems().then(() => this.update()); + this.toDispose.push(this.skillService.onSkillsChanged(() => { + this.loadItems().then(() => this.update()); + })); + } + + protected async loadItems(): Promise { + this.items = this.skillService.getSkills(); + } + + protected getItemId(item: Skill): string { + return item.name; + } + + protected getColumns(): TableColumn[] { + return [ + { + id: 'skill-name', + label: nls.localizeByDefault('Name'), + className: 'skill-name-column', + renderCell: (item: Skill) => {item.name} + }, + { + id: 'skill-description', + label: nls.localizeByDefault('Description'), + className: 'skill-description-column', + renderCell: (item: Skill) => {item.description} + }, + { + id: 'skill-location', + label: nls.localize('theia/ai/ide/skillsConfiguration/location/label', 'Location'), + className: 'skill-location-column', + renderCell: (item: Skill) => {item.location} + }, + { + id: 'skill-open', + label: '', + className: 'skill-open-column', + renderCell: (item: Skill) => ( + + ) + } + ]; + } + + protected openSkill(skill: Skill): void { + open(this.openerService, URI.fromFilePath(skill.location)); + } +} diff --git a/packages/ai-ide/src/browser/ai-configuration/template-settings-renderer.tsx b/packages/ai-ide/src/browser/ai-configuration/template-settings-renderer.tsx new file mode 100644 index 0000000..e47428a --- /dev/null +++ b/packages/ai-ide/src/browser/ai-configuration/template-settings-renderer.tsx @@ -0,0 +1,125 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** +import { isCustomizedPromptFragment, PromptService, PromptVariantSet } from '@theia/ai-core/lib/common'; +import * as React from '@theia/core/shared/react'; +import { nls } from '@theia/core/lib/common/nls'; + +export interface PromptVariantRendererProps { + agentId: string; + promptVariantSet: PromptVariantSet; + promptService: PromptService; +} + +export const PromptVariantRenderer: React.FC = ({ + agentId, + promptVariantSet, + promptService, +}) => { + const variantIds = promptService.getVariantIds(promptVariantSet.id); + const defaultVariantId = promptService.getDefaultVariantId(promptVariantSet.id); + const [selectedVariant, setSelectedVariant] = React.useState(defaultVariantId!); + + const isVariantCustomized = (variantId: string): boolean => { + const fragment = promptService.getRawPromptFragment(variantId); + return fragment ? isCustomizedPromptFragment(fragment) : false; + }; + + React.useEffect(() => { + const currentVariant = promptService.getSelectedVariantId(promptVariantSet.id); + setSelectedVariant(currentVariant ?? defaultVariantId!); + + const disposable = promptService.onSelectedVariantChange(notification => { + if (notification.promptVariantSetId === promptVariantSet.id) { + setSelectedVariant(notification.variantId ?? defaultVariantId!); + } + }); + return () => { + disposable.dispose(); + }; + }, [promptVariantSet.id, promptService, defaultVariantId]); + + const isInvalidVariant = !variantIds.includes(selectedVariant); + + const handleVariantChange = async (event: React.ChangeEvent) => { + const newVariant = event.target.value; + setSelectedVariant(newVariant); + promptService.updateSelectedVariantId(agentId, promptVariantSet.id, newVariant); + }; + + const openTemplate = () => { + promptService.editBuiltInCustomization(selectedVariant); + }; + + const resetTemplate = () => { + promptService.resetToBuiltIn(selectedVariant); + }; + + return ( + <> + + {promptVariantSet.id} + + {(variantIds.length > 1 || isInvalidVariant) && ( + + )} + {variantIds.length === 1 && !isInvalidVariant && ( + + {isVariantCustomized(selectedVariant) + ? `[${nls.localize('theia/ai/core/templateSettings/edited', 'edited')}] ${selectedVariant}` + : selectedVariant} + + )} + + + +
    + ); + } + + protected getEffectiveState(toolName: string): ToolConfirmationMode { + // If there's an explicit setting for this tool, use it + const explicitSetting = this.toolConfirmationModes[toolName]; + if (explicitSetting !== undefined) { + return explicitSetting; + } + // Otherwise, apply confirmAlwaysAllow logic to the default + const toolRequest = this.toolInvocationRegistry.getFunction(toolName); + if (toolRequest?.confirmAlwaysAllow && this.defaultState === ToolConfirmationMode.ALWAYS_ALLOW) { + return ToolConfirmationMode.CONFIRM; + } + return this.defaultState; + } + + protected getColumns(): TableColumn[] { + return [ + { + id: 'tool-name', + label: nls.localizeByDefault('Tool'), + className: 'tool-name-column', + renderCell: (item: ToolItem) => {item.name} + }, + { + id: 'confirmation-mode', + label: nls.localize('theia/ai/ide/toolsConfiguration/confirmationMode/label', 'Confirmation Mode'), + className: 'confirmation-mode-column', + renderCell: (item: ToolItem) => { + const effectiveState = this.getEffectiveState(item.name); + return ( + + ); + } + } + ]; + } + + protected override getRowClassName(item: ToolItem): string { + const effectiveState = this.getEffectiveState(item.name); + const isDefault = effectiveState === this.defaultState; + return isDefault ? 'default-mode' : 'custom-mode'; + } +} diff --git a/packages/ai-ide/src/browser/ai-configuration/variable-configuration-widget.tsx b/packages/ai-ide/src/browser/ai-configuration/variable-configuration-widget.tsx new file mode 100644 index 0000000..d8cbcf3 --- /dev/null +++ b/packages/ai-ide/src/browser/ai-configuration/variable-configuration-widget.tsx @@ -0,0 +1,159 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { Agent, AgentService, AIVariable, AIVariableService } from '@theia/ai-core/lib/common'; +import { codicon } from '@theia/core/lib/browser'; +import { inject, injectable, postConstruct } from '@theia/core/shared/inversify'; +import * as React from '@theia/core/shared/react'; +import { AIAgentConfigurationWidget } from './agent-configuration-widget'; +import { AIConfigurationSelectionService } from './ai-configuration-service'; +import { nls } from '@theia/core'; +import { AIListDetailConfigurationWidget } from './base/ai-list-detail-configuration-widget'; + +@injectable() +export class AIVariableConfigurationWidget extends AIListDetailConfigurationWidget { + + static readonly ID = 'ai-variable-configuration-container-widget'; + static readonly LABEL = nls.localizeByDefault('Variables'); + + @inject(AIVariableService) + protected readonly variableService: AIVariableService; + + @inject(AgentService) + protected readonly agentService: AgentService; + + @inject(AIConfigurationSelectionService) + protected readonly aiConfigurationSelectionService: AIConfigurationSelectionService; + + @postConstruct() + protected init(): void { + this.id = AIVariableConfigurationWidget.ID; + this.title.label = AIVariableConfigurationWidget.LABEL; + this.title.closable = false; + this.addClass('ai-configuration-widget'); + + this.loadItems().then(() => this.update()); + this.toDispose.push(this.variableService.onDidChangeVariables(async () => { + await this.loadItems(); + this.update(); + })); + } + + protected async loadItems(): Promise { + this.items = this.variableService.getVariables(); + if (this.items.length > 0 && !this.selectedItem) { + this.selectedItem = this.items[0]; + } + } + + protected getItemId(variable: AIVariable): string { + return variable.id; + } + + protected getItemLabel(variable: AIVariable): string { + return variable.name; + } + + protected override getEmptySelectionMessage(): string { + return nls.localize('theia/ai/ide/variableConfiguration/selectVariable', 'Please select a Variable.'); + } + + protected renderItemDetail(variable: AIVariable): React.ReactNode { + return ( +
    +
    + {variable.name} +
    Id: {variable.id}
    +
    + + {variable.description && ( +
    + {variable.description} +
    + )} + + {this.renderArgs(variable)} + {this.renderReferencedVariables(variable)} +
    + ); + } + + protected renderArgs(variable: AIVariable): React.ReactNode | undefined { + if (variable.args === undefined || variable.args.length === 0) { + return undefined; + } + + return ( + <> +
    + {nls.localize('theia/ai/ide/variableConfiguration/variableArgs', 'Arguments')} +
    +
    + {variable.args.map(arg => ( + + {arg.name}: + + {arg.description} + + + ))} +
    + + ); + } + + protected renderReferencedVariables(variable: AIVariable): React.ReactNode | undefined { + const agents = this.getAgentsForVariable(variable); + if (agents.length === 0) { + return undefined; + } + + return ( + <> +
    + {nls.localize('theia/ai/ide/variableConfiguration/usedByAgents', 'Used by Agents')} +
    +
      + {agents.map(agent => ( +
    • this.showAgentConfiguration(agent)}> + {agent.name} + +
    • + ))} +
    + + ); + } + + protected showAgentConfiguration(agent: Agent): void { + this.aiConfigurationSelectionService.setActiveAgent(agent); + this.aiConfigurationSelectionService.selectConfigurationTab(AIAgentConfigurationWidget.ID); + } + + protected getAgentsForVariable(variable: AIVariable): Agent[] { + return this.agentService.getAgents().filter(a => a.variables?.includes(variable.id)); + } +} diff --git a/packages/ai-ide/src/browser/ai-ide-activation-service.ts b/packages/ai-ide/src/browser/ai-ide-activation-service.ts new file mode 100644 index 0000000..788513a --- /dev/null +++ b/packages/ai-ide/src/browser/ai-ide-activation-service.ts @@ -0,0 +1,65 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** +import { inject, injectable } from '@theia/core/shared/inversify'; +import { FrontendApplicationContribution } from '@theia/core/lib/browser'; +import { Emitter, MaybePromise, Event, PreferenceService, } from '@theia/core'; +import { ContextKeyService, ContextKey } from '@theia/core/lib/browser/context-key-service'; +import { AIActivationService, ENABLE_AI_CONTEXT_KEY } from '@theia/ai-core/lib/browser/ai-activation-service'; +import { PREFERENCE_NAME_ENABLE_AI } from '../common/ai-ide-preferences'; + +/** + * Implements AI Activation Service based on preferences. + */ +@injectable() +export class AIIdeActivationServiceImpl implements AIActivationService, FrontendApplicationContribution { + @inject(ContextKeyService) + protected readonly contextKeyService: ContextKeyService; + + @inject(PreferenceService) + protected preferenceService: PreferenceService; + + protected isAiEnabledKey: ContextKey; + + protected onDidChangeAIEnabled = new Emitter(); + get onDidChangeActiveStatus(): Event { + return this.onDidChangeAIEnabled.event; + } + + get isActive(): boolean { + return this.isAiEnabledKey.get() ?? false; + } + + protected updateEnableValue(value: boolean): void { + if (value !== this.isAiEnabledKey.get()) { + this.isAiEnabledKey.set(value); + this.onDidChangeAIEnabled.fire(value); + } + } + + initialize(): MaybePromise { + this.isAiEnabledKey = this.contextKeyService.createKey(ENABLE_AI_CONTEXT_KEY, false); + // make sure we don't miss once preferences are ready + this.preferenceService.ready.then(() => { + const enableValue = this.preferenceService.get(PREFERENCE_NAME_ENABLE_AI, false); + this.updateEnableValue(enableValue); + }); + this.preferenceService.onPreferenceChanged(e => { + if (e.preferenceName === PREFERENCE_NAME_ENABLE_AI) { + this.updateEnableValue(this.preferenceService.get(PREFERENCE_NAME_ENABLE_AI, false)); + } + }); + } +} diff --git a/packages/ai-ide/src/browser/ai-terminal-functions.ts b/packages/ai-ide/src/browser/ai-terminal-functions.ts new file mode 100644 index 0000000..938f555 --- /dev/null +++ b/packages/ai-ide/src/browser/ai-terminal-functions.ts @@ -0,0 +1,104 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { ToolInvocationContext, ToolProvider, ToolRequest } from '@theia/ai-core'; +import { inject, injectable } from '@theia/core/shared/inversify'; +import { TerminalService } from '@theia/terminal/lib/browser/base/terminal-service'; +import { SUGGEST_TERMINAL_COMMAND_ID } from '../common/ai-terminal-functions'; +import { WorkspaceService } from '@theia/workspace/lib/browser'; +import { TerminalWidget } from '@theia/terminal/lib/browser/base/terminal-widget'; +import { waitForEvent } from '@theia/core/lib/common/promise-util'; +import { ApplicationShell } from '@theia/core/lib/browser'; + +@injectable() +export class SuggestTerminalCommand implements ToolProvider { + static ID = SUGGEST_TERMINAL_COMMAND_ID; + + @inject(TerminalService) + protected readonly terminalService: TerminalService; + + @inject(WorkspaceService) + protected readonly workspaceService: WorkspaceService; + + @inject(ApplicationShell) + protected readonly applicationShell: ApplicationShell; + + getTool(): ToolRequest { + return { + id: SuggestTerminalCommand.ID, + name: SuggestTerminalCommand.ID, + description: `Proposes executing a command in the terminal.\n + This tool will automatically write the command into the terminal buffer.\n + Execution of the command is up to the user.`, + parameters: { + type: 'object', + properties: { + command: { + type: 'string', + description: `The content of the command to write to the terminal buffer.\n + ALWAYS provide the COMPLETE intended content of the command, without any truncation or omissions.\n + You MUST include ALL parts of the command.` + } + }, + required: ['command'] + }, + handler: async (args: string, ctx?: ToolInvocationContext): Promise => { + if (ctx?.cancellationToken?.isCancellationRequested) { + return JSON.stringify({ error: 'Operation cancelled by user' }); + } + // Ensure that there is a workspace + let activeTerminal: TerminalWidget | undefined = this.terminalService.lastUsedTerminal; + if (!activeTerminal || activeTerminal.isDisposed) { + try { + activeTerminal = await this.terminalService.newTerminal({}); + this.terminalService.open(activeTerminal, { mode: 'activate' }); + await activeTerminal.start(); + // Wait until the terminal prompt is emitted + await waitForEvent(activeTerminal.onOutput, 3000); + } catch (error) { + return JSON.stringify({ error: `Error executing tool 'suggestTerminalCommand': ${error}` }); + } + } else { + this.terminalService.open(activeTerminal, { mode: 'activate' }); + } + let command: string; + try { + const { command: parsedCommand } = JSON.parse(args); + command = parsedCommand; + } catch (error) { + return JSON.stringify({ error: `Error parsing arguments for tool 'suggestTerminalCommand': ${error}` }); + } + if (!this.isValidCommand(command)) { + return JSON.stringify({ error: 'Error validating command generated by \'suggestTerminalCommand\'' }); + }; + // Clear the current input line by sending Ctrl+A (move to start) and Ctrl+K (delete to end) + activeTerminal.sendText('\x01\x0b'); + activeTerminal.sendText(command); + return `Proposed executing the terminal command ${command}. The user will review and potentially execute the command.`; + } + }; + } + + protected isValidCommand(command: string): boolean { + // Command should not be empty and should not contain control characters + const CONTROL_CHAR_REGEX = /[\u0000-\u001F\u007F]/; // ASCII control range + if (!command || CONTROL_CHAR_REGEX.test(command)) { + return false; + } + return true; + } +} + diff --git a/packages/ai-ide/src/browser/analyze-gh-ticket-command-contribution.ts b/packages/ai-ide/src/browser/analyze-gh-ticket-command-contribution.ts new file mode 100644 index 0000000..de81ebb --- /dev/null +++ b/packages/ai-ide/src/browser/analyze-gh-ticket-command-contribution.ts @@ -0,0 +1,176 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { FrontendApplicationContribution } from '@theia/core/lib/browser'; +import { inject, injectable } from '@theia/core/shared/inversify'; +import { PromptService } from '@theia/ai-core/lib/common'; +import { nls } from '@theia/core'; +import { AGENT_DELEGATION_FUNCTION_ID } from '@theia/ai-chat/lib/browser/agent-delegation-tool'; +import { GitHubChatAgentId } from './github-chat-agent'; + +@injectable() +export class AnalyzesGhTicketCommandContribution implements FrontendApplicationContribution { + + @inject(PromptService) + protected readonly promptService: PromptService; + + onStart(): void { + this.registerGitHubTicketCommand(); + } + + protected registerGitHubTicketCommand(): void { + const commandTemplate = this.buildCommandTemplate(); + + this.promptService.addBuiltInPromptFragment({ + id: 'analyze-gh-ticket', + template: commandTemplate, + isCommand: true, + commandName: 'analyze-gh-ticket', + commandDescription: nls.localize( + 'theia/ai-ide/ticketCommand/description', + 'Analyze a GitHub ticket and create an implementation plan' + ), + commandArgumentHint: nls.localize( + 'theia/ai-ide/ticketCommand/argumentHint', + '' + ), + commandAgents: ['Architect'] + }); + } + + protected buildCommandTemplate(): string { + return `You have been asked to analyze a GitHub ticket and create an implementation plan. + +## Ticket Number +$ARGUMENTS + +## Task Overview +You need to retrieve details about the specified GitHub ticket and analyze whether it can be implemented by an AI coding agent. + +## Step 1: Retrieve Ticket Information +Use the ~{${AGENT_DELEGATION_FUNCTION_ID}} tool to delegate to the GitHub agent and retrieve comprehensive information about the ticket. + +**Agent ID:** '${GitHubChatAgentId}' +**Prompt:** Ask the GitHub agent to retrieve ALL details about issue/ticket #$ARGUMENTS, specifically requesting: +- The complete issue title and description/body +- All comments on the issue (this is critical for understanding the full context) +- Labels and assignees +- Issue state (open/closed) +- Any referenced issues or pull requests mentioned in the description or comments +- If other issues are referenced, retrieve their details as well + +Example delegation prompt: +\`\`\` +Please retrieve comprehensive information about issue #$ARGUMENTS. I need: +1. The complete issue title, body/description, labels, state, and assignees +2. ALL comments on this issue - every single comment is important for understanding the context +3. Any issues or PRs that are referenced or linked in the description or comments +4. For any referenced issues, please also retrieve their titles and descriptions + +This is for analyzing whether the issue can be implemented, so completeness is crucial. +\`\`\` + +## Step 2: Analyze AI Solvability +After receiving the ticket information, analyze whether this ticket can be solved by an AI coding agent. Consider: + +### Criteria for AI-Solvable Tickets: +- **Clear requirements**: The ticket clearly describes what needs to be done +- **Defined scope**: The scope of changes is well-defined and bounded +- **Technical feasibility**: The task involves code changes that can be reasoned about +- **Sufficient context**: Enough information is provided to understand the problem and solution +- **Reproducible**: For bugs, there's enough information to understand and reproduce the issue + +### Criteria for Non-AI-Solvable Tickets: +- **Ambiguous requirements**: The ticket is vague or open to multiple interpretations +- **Missing context**: Critical information is missing (e.g., environment details, reproduction steps) +- **External dependencies**: Requires access to external systems, credentials, or human interaction +- **Design decisions needed**: Requires architectural decisions that need human judgment +- **Insufficient information**: Cannot determine what success looks like + +## Step 3: Respond Based on Analysis + +### If the ticket CANNOT be solved by AI: +Provide a clear explanation: +1. **Reason**: Explain specifically why this ticket cannot be solved by AI +2. **Missing Information**: List what information is missing or unclear +3. **Questions for Clarification**: Ask specific questions that, if answered, might make the ticket solvable + +Example response format: +\`\`\` +## Analysis Result: Cannot Be Solved by AI + +### Reason +[Explain why] + +### Missing Information +- [Item 1] +- [Item 2] + +### Questions for Clarification +1. [Question 1] +2. [Question 2] +\`\`\` + +### If the ticket CAN be solved by AI: +Create a detailed implementation plan: + +1. **Summary**: Brief summary of what the ticket requests +2. **Analysis**: Your understanding of the problem and the proposed solution approach +3. **Implementation Plan**: A step-by-step plan that a coding agent can follow, including: + - Files that likely need to be modified or created + - Specific changes to be made in each file + - Order of operations + - Testing considerations +4. **Potential Challenges**: Any challenges or edge cases to be aware of +5. **Success Criteria**: How to verify the implementation is correct + +Example response format: +\`\`\` +## Analysis Result: Can Be Solved by AI + +### Summary +[Brief summary of the ticket] + +### Analysis +[Your understanding of the problem and solution approach] + +### Implementation Plan + +#### Step 1: [First step] +- File: \`path/to/file\` +- Changes: [Description of changes] + +#### Step 2: [Second step] +- File: \`path/to/file\` +- Changes: [Description of changes] + +[Continue with additional steps...] + +### Potential Challenges +- [Challenge 1] +- [Challenge 2] + +### Success Criteria +- [Criterion 1] +- [Criterion 2] + +### Next Steps +To implement this plan, you can ask @Coder to execute it. +\`\`\` + +Remember: Be thorough in your analysis. It's better to ask for clarification than to create an incomplete or incorrect implementation plan.`; + } +} diff --git a/packages/ai-ide/src/browser/app-tester-chat-agent.ts b/packages/ai-ide/src/browser/app-tester-chat-agent.ts new file mode 100644 index 0000000..f602aac --- /dev/null +++ b/packages/ai-ide/src/browser/app-tester-chat-agent.ts @@ -0,0 +1,177 @@ +/* eslint-disable max-len */ + +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// @ts-nocheck - Disabled: requires @theia/ai-mcp + +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { AbstractStreamParsingChatAgent } from '@theia/ai-chat/lib/common/chat-agents'; +import { ErrorChatResponseContentImpl, MarkdownChatResponseContentImpl, MutableChatRequestModel, QuestionResponseContentImpl } from '@theia/ai-chat/lib/common/chat-model'; +import { LanguageModelRequirement } from '@theia/ai-core/lib/common'; +import { MCPFrontendService, MCPServerDescription } from '@theia/ai-mcp/lib/common/mcp-server-manager'; +import { nls } from '@theia/core'; +import { inject, injectable } from '@theia/core/shared/inversify'; +import { MCP_SERVERS_PREF } from '@theia/ai-mcp/lib/common/mcp-preferences'; +import { PreferenceScope, PreferenceService } from '@theia/core/lib/common'; +import { appTesterTemplate, appTesterNextTemplate, appTesterTemplateVariant, REQUIRED_MCP_SERVERS, REQUIRED_MCP_SERVERS_NEXT } from './app-tester-prompt-template'; + +export const AppTesterChatAgentId = 'AppTester'; +@injectable() +export class AppTesterChatAgent extends AbstractStreamParsingChatAgent { + + @inject(MCPFrontendService) + protected readonly mcpService: MCPFrontendService; + + @inject(PreferenceService) + protected readonly preferenceService: PreferenceService; + + id: string = AppTesterChatAgentId; + name = AppTesterChatAgentId; + languageModelRequirements: LanguageModelRequirement[] = [{ + purpose: 'chat', + identifier: 'default/code', + }]; + protected defaultLanguageModelPurpose: string = 'chat'; + override description = nls.localize('theia/ai/chat/app-tester/description', 'This agent tests your application user interface to verify user-specified test scenarios through browser automation. ' + + 'It can automate testing workflows and provide detailed feedback on application functionality.'); + + override iconClass: string = 'codicon codicon-beaker'; + protected override systemPromptId: string = 'app-tester-system'; + override prompts = [ + { id: 'app-tester-system', defaultVariant: appTesterTemplate, variants: [appTesterTemplateVariant, appTesterNextTemplate] } + ]; + + /** + * Override invoke to check if the specified MCP server is running, and if not, ask the user if it should be started. + */ + override async invoke(request: MutableChatRequestModel): Promise { + const isNextVariant = this.isNextVariant(); + try { + if (await this.requiresStartingServers()) { + request.response.response.addContent(new QuestionResponseContentImpl( + isNextVariant + ? nls.localize('theia/ai/ide/app-tester/startChromeDevToolsMcpServers/question', + 'The Chrome DevTools MCP server is not running. Would you like to start it now? This may install the Chrome DevTools MCP server.') + : nls.localize('theia/ai/ide/app-tester/startPlaywrightServers/question', + 'The Playwright MCP servers are not running. Would you like to start them now? This may install the Playwright MCP servers.'), + [ + { text: nls.localize('theia/ai/ide/app-tester/startMcpServers/yes', 'Yes, start the servers'), value: 'yes' }, + { text: nls.localize('theia/ai/ide/app-tester/startMcpServers/no', 'No, cancel'), value: 'no' } + ], + request, + async selectedOption => { + if (selectedOption.value === 'yes') { + const progress = request.response.addProgressMessage({ + content: isNextVariant + ? nls.localize('theia/ai/ide/app-tester/startChromeDevToolsMcpServers/progress', 'Starting Chrome DevTools MCP server.') + : nls.localize('theia/ai/ide/app-tester/startPlaywrightServers/progress', 'Starting Playwright MCP servers.'), + show: 'whileIncomplete' + }); + try { + await this.startServers(); + request.response.updateProgressMessage({ ...progress, show: 'whileIncomplete', status: 'completed' }); + await super.invoke(request); + } catch (error) { + request.response.response.addContent(new ErrorChatResponseContentImpl( + new Error(isNextVariant + ? nls.localize('theia/ai/ide/app-tester/startChromeDevToolsMcpServers/error', 'Failed to start Chrome DevTools MCP server: {0}', + error instanceof Error ? error.message : String(error)) + : nls.localize('theia/ai/ide/app-tester/startPlaywrightServers/error', 'Failed to start Playwright MCP servers: {0}', + error instanceof Error ? error.message : String(error))) + )); + request.response.complete(); + } + } else { + request.response.response.addContent(new MarkdownChatResponseContentImpl( + isNextVariant + ? nls.localize('theia/ai/ide/app-tester/startChromeDevToolsMcpServers/canceled', 'Please setup the Chrome DevTools MCP server.') + : nls.localize('theia/ai/ide/app-tester/startPlaywrightServers/canceled', 'Please setup the Playwright MCP servers.') + )); + request.response.complete(); + } + } + )); + request.response.waitForInput(); + return; + } + await super.invoke(request); + } catch (error) { + request.response.response.addContent(new ErrorChatResponseContentImpl( + isNextVariant ? + new Error(nls.localize('theia/ai/ide/app-tester/errorCheckingDevToolsServerStatus', 'Error checking DevTools MCP server status: {0}', + error instanceof Error ? error.message : String(error))) + : new Error(nls.localize('theia/ai/ide/app-tester/errorCheckingPlaywrightServerStatus', 'Error checking Playwright MCP server status: {0}', + error instanceof Error ? error.message : String(error))) + )); + request.response.complete(); + } + } + + protected isNextVariant(): boolean { + const effectiveVariantId = this.promptService.getEffectiveVariantId(this.systemPromptId!); + return effectiveVariantId === 'app-tester-system-next'; + } + + protected getRequiredServers(): MCPServerDescription[] { + if (this.isNextVariant()) { + return REQUIRED_MCP_SERVERS_NEXT; + } + return REQUIRED_MCP_SERVERS; + } + + protected async requiresStartingServers(): Promise { + const allStarted = await Promise.all(this.getRequiredServers().map(server => this.mcpService.isServerStarted(server.name))); + return allStarted.some(started => !started); + } + + protected async startServers(): Promise { + await this.ensureServersStarted(...this.getRequiredServers()); + } + + /** + * Starts the defined MCP server if it doesn't exist or isn't running. + * + * @returns A promise that resolves when the server is started + */ + async ensureServersStarted(...servers: MCPServerDescription[]): Promise { + try { + const serversToInstall: MCPServerDescription[] = []; + const serversToStart: MCPServerDescription[] = []; + + for (const server of servers) { + if (!(await this.mcpService.hasServer(server.name))) { + serversToInstall.push(server); + } + if (!(await this.mcpService.isServerStarted(server.name))) { + serversToStart.push(server); + } + } + + for (const server of serversToInstall) { + const currentServers = this.preferenceService.get>(MCP_SERVERS_PREF, {}); + await this.preferenceService.set(MCP_SERVERS_PREF, { ...currentServers, [server.name]: server }, PreferenceScope.User); + await this.mcpService.addOrUpdateServer(server); + } + + for (const server of serversToStart) { + await this.mcpService.startServer(server.name); + } + } catch (error) { + this.logger.error(`Error starting MCP servers ${servers.map(s => s.name)}: ${error}`); + throw error; + } + } +} diff --git a/packages/ai-ide/src/browser/app-tester-chat-agent.ts.bak b/packages/ai-ide/src/browser/app-tester-chat-agent.ts.bak new file mode 100644 index 0000000..825ebd7 --- /dev/null +++ b/packages/ai-ide/src/browser/app-tester-chat-agent.ts.bak @@ -0,0 +1,175 @@ +/* eslint-disable max-len */ + +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { AbstractStreamParsingChatAgent } from '@theia/ai-chat/lib/common/chat-agents'; +import { ErrorChatResponseContentImpl, MarkdownChatResponseContentImpl, MutableChatRequestModel, QuestionResponseContentImpl } from '@theia/ai-chat/lib/common/chat-model'; +import { LanguageModelRequirement } from '@theia/ai-core/lib/common'; +import { MCPFrontendService, MCPServerDescription } from '@theia/ai-mcp/lib/common/mcp-server-manager'; +import { nls } from '@theia/core'; +import { inject, injectable } from '@theia/core/shared/inversify'; +import { MCP_SERVERS_PREF } from '@theia/ai-mcp/lib/common/mcp-preferences'; +import { PreferenceScope, PreferenceService } from '@theia/core/lib/common'; +import { appTesterTemplate, appTesterNextTemplate, appTesterTemplateVariant, REQUIRED_MCP_SERVERS, REQUIRED_MCP_SERVERS_NEXT } from './app-tester-prompt-template'; + +export const AppTesterChatAgentId = 'AppTester'; +@injectable() +export class AppTesterChatAgent extends AbstractStreamParsingChatAgent { + + @inject(MCPFrontendService) + protected readonly mcpService: MCPFrontendService; + + @inject(PreferenceService) + protected readonly preferenceService: PreferenceService; + + id: string = AppTesterChatAgentId; + name = AppTesterChatAgentId; + languageModelRequirements: LanguageModelRequirement[] = [{ + purpose: 'chat', + identifier: 'default/code', + }]; + protected defaultLanguageModelPurpose: string = 'chat'; + override description = nls.localize('theia/ai/chat/app-tester/description', 'This agent tests your application user interface to verify user-specified test scenarios through browser automation. ' + + 'It can automate testing workflows and provide detailed feedback on application functionality.'); + + override iconClass: string = 'codicon codicon-beaker'; + protected override systemPromptId: string = 'app-tester-system'; + override prompts = [ + { id: 'app-tester-system', defaultVariant: appTesterTemplate, variants: [appTesterTemplateVariant, appTesterNextTemplate] } + ]; + + /** + * Override invoke to check if the specified MCP server is running, and if not, ask the user if it should be started. + */ + override async invoke(request: MutableChatRequestModel): Promise { + const isNextVariant = this.isNextVariant(); + try { + if (await this.requiresStartingServers()) { + request.response.response.addContent(new QuestionResponseContentImpl( + isNextVariant + ? nls.localize('theia/ai/ide/app-tester/startChromeDevToolsMcpServers/question', + 'The Chrome DevTools MCP server is not running. Would you like to start it now? This may install the Chrome DevTools MCP server.') + : nls.localize('theia/ai/ide/app-tester/startPlaywrightServers/question', + 'The Playwright MCP servers are not running. Would you like to start them now? This may install the Playwright MCP servers.'), + [ + { text: nls.localize('theia/ai/ide/app-tester/startMcpServers/yes', 'Yes, start the servers'), value: 'yes' }, + { text: nls.localize('theia/ai/ide/app-tester/startMcpServers/no', 'No, cancel'), value: 'no' } + ], + request, + async selectedOption => { + if (selectedOption.value === 'yes') { + const progress = request.response.addProgressMessage({ + content: isNextVariant + ? nls.localize('theia/ai/ide/app-tester/startChromeDevToolsMcpServers/progress', 'Starting Chrome DevTools MCP server.') + : nls.localize('theia/ai/ide/app-tester/startPlaywrightServers/progress', 'Starting Playwright MCP servers.'), + show: 'whileIncomplete' + }); + try { + await this.startServers(); + request.response.updateProgressMessage({ ...progress, show: 'whileIncomplete', status: 'completed' }); + await super.invoke(request); + } catch (error) { + request.response.response.addContent(new ErrorChatResponseContentImpl( + new Error(isNextVariant + ? nls.localize('theia/ai/ide/app-tester/startChromeDevToolsMcpServers/error', 'Failed to start Chrome DevTools MCP server: {0}', + error instanceof Error ? error.message : String(error)) + : nls.localize('theia/ai/ide/app-tester/startPlaywrightServers/error', 'Failed to start Playwright MCP servers: {0}', + error instanceof Error ? error.message : String(error))) + )); + request.response.complete(); + } + } else { + request.response.response.addContent(new MarkdownChatResponseContentImpl( + isNextVariant + ? nls.localize('theia/ai/ide/app-tester/startChromeDevToolsMcpServers/canceled', 'Please setup the Chrome DevTools MCP server.') + : nls.localize('theia/ai/ide/app-tester/startPlaywrightServers/canceled', 'Please setup the Playwright MCP servers.') + )); + request.response.complete(); + } + } + )); + request.response.waitForInput(); + return; + } + await super.invoke(request); + } catch (error) { + request.response.response.addContent(new ErrorChatResponseContentImpl( + isNextVariant ? + new Error(nls.localize('theia/ai/ide/app-tester/errorCheckingDevToolsServerStatus', 'Error checking DevTools MCP server status: {0}', + error instanceof Error ? error.message : String(error))) + : new Error(nls.localize('theia/ai/ide/app-tester/errorCheckingPlaywrightServerStatus', 'Error checking Playwright MCP server status: {0}', + error instanceof Error ? error.message : String(error))) + )); + request.response.complete(); + } + } + + protected isNextVariant(): boolean { + const effectiveVariantId = this.promptService.getEffectiveVariantId(this.systemPromptId!); + return effectiveVariantId === 'app-tester-system-next'; + } + + protected getRequiredServers(): MCPServerDescription[] { + if (this.isNextVariant()) { + return REQUIRED_MCP_SERVERS_NEXT; + } + return REQUIRED_MCP_SERVERS; + } + + protected async requiresStartingServers(): Promise { + const allStarted = await Promise.all(this.getRequiredServers().map(server => this.mcpService.isServerStarted(server.name))); + return allStarted.some(started => !started); + } + + protected async startServers(): Promise { + await this.ensureServersStarted(...this.getRequiredServers()); + } + + /** + * Starts the defined MCP server if it doesn't exist or isn't running. + * + * @returns A promise that resolves when the server is started + */ + async ensureServersStarted(...servers: MCPServerDescription[]): Promise { + try { + const serversToInstall: MCPServerDescription[] = []; + const serversToStart: MCPServerDescription[] = []; + + for (const server of servers) { + if (!(await this.mcpService.hasServer(server.name))) { + serversToInstall.push(server); + } + if (!(await this.mcpService.isServerStarted(server.name))) { + serversToStart.push(server); + } + } + + for (const server of serversToInstall) { + const currentServers = this.preferenceService.get>(MCP_SERVERS_PREF, {}); + await this.preferenceService.set(MCP_SERVERS_PREF, { ...currentServers, [server.name]: server }, PreferenceScope.User); + await this.mcpService.addOrUpdateServer(server); + } + + for (const server of serversToStart) { + await this.mcpService.startServer(server.name); + } + } catch (error) { + this.logger.error(`Error starting MCP servers ${servers.map(s => s.name)}: ${error}`); + throw error; + } + } +} diff --git a/packages/ai-ide/src/browser/app-tester-chat-functions.ts b/packages/ai-ide/src/browser/app-tester-chat-functions.ts new file mode 100644 index 0000000..1a7ae15 --- /dev/null +++ b/packages/ai-ide/src/browser/app-tester-chat-functions.ts @@ -0,0 +1,172 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** +// @ts-nocheck - Disabled: requires @theia/ai-mcp + +import { type ToolProvider, type ToolRequest } from '@theia/ai-core'; +import { isLocalMCPServerDescription, MCPServerManager } from '@theia/ai-mcp/lib/common'; +import { inject, injectable } from '@theia/core/shared/inversify'; +import { CLOSE_BROWSER_FUNCTION_ID, IS_BROWSER_RUNNING_FUNCTION_ID, LAUNCH_BROWSER_FUNCTION_ID, QUERY_DOM_FUNCTION_ID } from '../common/app-tester-chat-functions'; +import { BrowserAutomation } from '../common/browser-automation-protocol'; + +@injectable() +export abstract class BrowserAutomationToolProvider implements ToolProvider { + @inject(BrowserAutomation) + protected readonly browser: BrowserAutomation; + + abstract getTool(): ToolRequest; +} + +@injectable() +export class LaunchBrowserProvider extends BrowserAutomationToolProvider { + static ID = LAUNCH_BROWSER_FUNCTION_ID; + + @inject(MCPServerManager) + protected readonly mcpServerManager: MCPServerManager; + + getTool(): ToolRequest { + return { + id: LaunchBrowserProvider.ID, + name: LaunchBrowserProvider.ID, + description: 'Start the browser.', + parameters: { + type: 'object', + properties: {}, + required: [] + }, handler: async () => { + try { + + const mcp = await this.mcpServerManager.getServerDescription('playwright'); + if (!mcp) { + throw new Error('No MCP Playwright instance with name playwright found'); + } + if (!isLocalMCPServerDescription(mcp)) { + throw new Error('The MCP Playwright instance must run locally.'); + } + + const cdpEndpointIndex = mcp.args?.findIndex(p => p === '--cdp-endpoint'); + if (!cdpEndpointIndex) { + throw new Error('No --cdp-endpoint was provided.'); + } + const cdpEndpoint = mcp.args?.[cdpEndpointIndex + 1]; + if (!cdpEndpoint) { + throw new Error('No --cdp-endpoint argument was provided.'); + } + + let remoteDebuggingPort = 9222; + try { + const uri = new URL(cdpEndpoint); + if (uri.port) { + remoteDebuggingPort = parseInt(uri.port, 10); + } else { + // Default ports if not specified + remoteDebuggingPort = uri.protocol === 'https:' ? 443 : 80; + } + } catch (error) { + throw new Error(`Invalid --cdp-endpoint format, URL expected: ${cdpEndpoint}`); + } + + const result = await this.browser.launch(remoteDebuggingPort); + return result; + } catch (ex) { + return (`Failed to starting the browser: ${ex.message}`); + } + } + }; + } +} + +@injectable() +export class CloseBrowserProvider extends BrowserAutomationToolProvider { + static ID = CLOSE_BROWSER_FUNCTION_ID; + + getTool(): ToolRequest { + return { + id: CloseBrowserProvider.ID, + name: CloseBrowserProvider.ID, + description: 'Close the browser.', + parameters: { + type: 'object', + properties: {}, + required: [] + }, + handler: async () => { + try { + await this.browser.close(); + } catch (ex) { + return (`Failed to close browser: ${ex.message}`); + } + } + }; + } +} + +@injectable() +export class IsBrowserRunningProvider extends BrowserAutomationToolProvider { + static ID = IS_BROWSER_RUNNING_FUNCTION_ID; + + getTool(): ToolRequest { + return { + id: IsBrowserRunningProvider.ID, + name: IsBrowserRunningProvider.ID, + description: 'Check if the browser is running.', + parameters: { + type: 'object', + properties: {}, + required: [] + }, + handler: async () => { + try { + const isRunning = await this.browser.isRunning(); + return isRunning ? 'Browser is running.' : 'Browser is not running.'; + } catch (ex) { + return (`Failed to check if browser is running: ${ex.message}`); + } + } + }; + } +} + +@injectable() +export class QueryDomProvider extends BrowserAutomationToolProvider { + static ID = QUERY_DOM_FUNCTION_ID; + + getTool(): ToolRequest { + return { + id: QueryDomProvider.ID, + name: QueryDomProvider.ID, + description: 'Query the DOM of the active page.', + parameters: { + type: 'object', + properties: { + selector: { + type: 'string', + description: `The selector of the element to get the DOM of. The selector is a + CSS selector that identifies the element. If not provided, the entire DOM will be returned.` + } + }, + required: [] + }, + handler: async arg => { + try { + const { selector } = JSON.parse(arg); + return await this.browser.queryDom(selector); + } catch (ex) { + return (`Failed to get DOM: ${ex.message}`); + } + } + }; + } +} diff --git a/packages/ai-ide/src/browser/app-tester-chat-functions.ts.bak b/packages/ai-ide/src/browser/app-tester-chat-functions.ts.bak new file mode 100644 index 0000000..36343f3 --- /dev/null +++ b/packages/ai-ide/src/browser/app-tester-chat-functions.ts.bak @@ -0,0 +1,170 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** +import { type ToolProvider, type ToolRequest } from '@theia/ai-core'; +import { isLocalMCPServerDescription, MCPServerManager } from '@theia/ai-mcp/lib/common'; +import { inject, injectable } from '@theia/core/shared/inversify'; +import { CLOSE_BROWSER_FUNCTION_ID, IS_BROWSER_RUNNING_FUNCTION_ID, LAUNCH_BROWSER_FUNCTION_ID, QUERY_DOM_FUNCTION_ID } from '../common/app-tester-chat-functions'; +import { BrowserAutomation } from '../common/browser-automation-protocol'; + +@injectable() +export abstract class BrowserAutomationToolProvider implements ToolProvider { + @inject(BrowserAutomation) + protected readonly browser: BrowserAutomation; + + abstract getTool(): ToolRequest; +} + +@injectable() +export class LaunchBrowserProvider extends BrowserAutomationToolProvider { + static ID = LAUNCH_BROWSER_FUNCTION_ID; + + @inject(MCPServerManager) + protected readonly mcpServerManager: MCPServerManager; + + getTool(): ToolRequest { + return { + id: LaunchBrowserProvider.ID, + name: LaunchBrowserProvider.ID, + description: 'Start the browser.', + parameters: { + type: 'object', + properties: {}, + required: [] + }, handler: async () => { + try { + + const mcp = await this.mcpServerManager.getServerDescription('playwright'); + if (!mcp) { + throw new Error('No MCP Playwright instance with name playwright found'); + } + if (!isLocalMCPServerDescription(mcp)) { + throw new Error('The MCP Playwright instance must run locally.'); + } + + const cdpEndpointIndex = mcp.args?.findIndex(p => p === '--cdp-endpoint'); + if (!cdpEndpointIndex) { + throw new Error('No --cdp-endpoint was provided.'); + } + const cdpEndpoint = mcp.args?.[cdpEndpointIndex + 1]; + if (!cdpEndpoint) { + throw new Error('No --cdp-endpoint argument was provided.'); + } + + let remoteDebuggingPort = 9222; + try { + const uri = new URL(cdpEndpoint); + if (uri.port) { + remoteDebuggingPort = parseInt(uri.port, 10); + } else { + // Default ports if not specified + remoteDebuggingPort = uri.protocol === 'https:' ? 443 : 80; + } + } catch (error) { + throw new Error(`Invalid --cdp-endpoint format, URL expected: ${cdpEndpoint}`); + } + + const result = await this.browser.launch(remoteDebuggingPort); + return result; + } catch (ex) { + return (`Failed to starting the browser: ${ex.message}`); + } + } + }; + } +} + +@injectable() +export class CloseBrowserProvider extends BrowserAutomationToolProvider { + static ID = CLOSE_BROWSER_FUNCTION_ID; + + getTool(): ToolRequest { + return { + id: CloseBrowserProvider.ID, + name: CloseBrowserProvider.ID, + description: 'Close the browser.', + parameters: { + type: 'object', + properties: {}, + required: [] + }, + handler: async () => { + try { + await this.browser.close(); + } catch (ex) { + return (`Failed to close browser: ${ex.message}`); + } + } + }; + } +} + +@injectable() +export class IsBrowserRunningProvider extends BrowserAutomationToolProvider { + static ID = IS_BROWSER_RUNNING_FUNCTION_ID; + + getTool(): ToolRequest { + return { + id: IsBrowserRunningProvider.ID, + name: IsBrowserRunningProvider.ID, + description: 'Check if the browser is running.', + parameters: { + type: 'object', + properties: {}, + required: [] + }, + handler: async () => { + try { + const isRunning = await this.browser.isRunning(); + return isRunning ? 'Browser is running.' : 'Browser is not running.'; + } catch (ex) { + return (`Failed to check if browser is running: ${ex.message}`); + } + } + }; + } +} + +@injectable() +export class QueryDomProvider extends BrowserAutomationToolProvider { + static ID = QUERY_DOM_FUNCTION_ID; + + getTool(): ToolRequest { + return { + id: QueryDomProvider.ID, + name: QueryDomProvider.ID, + description: 'Query the DOM of the active page.', + parameters: { + type: 'object', + properties: { + selector: { + type: 'string', + description: `The selector of the element to get the DOM of. The selector is a + CSS selector that identifies the element. If not provided, the entire DOM will be returned.` + } + }, + required: [] + }, + handler: async arg => { + try { + const { selector } = JSON.parse(arg); + return await this.browser.queryDom(selector); + } catch (ex) { + return (`Failed to get DOM: ${ex.message}`); + } + } + }; + } +} diff --git a/packages/ai-ide/src/browser/app-tester-prompt-template.ts b/packages/ai-ide/src/browser/app-tester-prompt-template.ts new file mode 100644 index 0000000..ff4f9b5 --- /dev/null +++ b/packages/ai-ide/src/browser/app-tester-prompt-template.ts @@ -0,0 +1,179 @@ +/* eslint-disable @typescript-eslint/tslint/config */ +// @ts-nocheck - Disabled: requires @theia/ai-mcp +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH and others. +// +// This file is licensed under the MIT License. +// See LICENSE-MIT.txt in the project root for license information. +// https://opensource.org/license/mit. +// +// SPDX-License-Identifier: MIT +// ***************************************************************************** + +import { BasePromptFragment } from '@theia/ai-core/lib/common'; +import { CHAT_CONTEXT_DETAILS_VARIABLE_ID } from '@theia/ai-chat'; +import { QUERY_DOM_FUNCTION_ID, LAUNCH_BROWSER_FUNCTION_ID, CLOSE_BROWSER_FUNCTION_ID, IS_BROWSER_RUNNING_FUNCTION_ID } from '../common/app-tester-chat-functions'; +import { MCPServerDescription } from '@theia/ai-mcp/lib/common/mcp-server-manager'; +// @ts-nocheck - Disabled: requires @theia/ai-mcp + +import { + FILE_CONTENT_FUNCTION_ID, + LIST_LAUNCH_CONFIGURATIONS_FUNCTION_ID, + RUN_LAUNCH_CONFIGURATION_FUNCTION_ID, + STOP_LAUNCH_CONFIGURATION_FUNCTION_ID +} from '../common/workspace-functions'; + +export const REQUIRED_MCP_SERVERS: MCPServerDescription[] = [ + { + name: 'playwright', + command: 'npx', + args: ['-y', '@playwright/mcp@latest', + '--cdp-endpoint', + 'http://localhost:9222/'], + autostart: false, + env: {}, + }, + { + name: 'playwright-visual', + command: 'npx', + args: ['-y', '@playwright/mcp@latest', '--vision', + '--cdp-endpoint', + 'http://localhost:9222/'], + autostart: false, + env: {}, + } +]; + +export const REQUIRED_MCP_SERVERS_NEXT: MCPServerDescription[] = [ + { + name: 'chrome-devtools', + command: 'npx', + args: ['-y', 'chrome-devtools-mcp@latest', '--cdp-endpoint', 'http://127.0.0.1:9222', '--no-usage-statistics'], + autostart: false, + env: {}, + } +]; + +export const appTesterTemplate: BasePromptFragment = { + id: 'app-tester-system-default', + template: `{{!-- This prompt is licensed under the MIT License (https://opensource.org/license/mit). +Made improvements or adaptations to this prompt template? We'd love for you to share it with the community! Contribute back here: +https://github.com/eclipse-theia/theia/discussions/new?category=prompt-template-contribution --}} + +You are AppTester, an AI assistant integrated into Theia IDE specifically designed to help developers test running applications using Playwright. +Your role is to inspect the application for user-specified test scenarios through the Playwright MCP server. + +## Your Workflow +1. Help the user build and launch their application +2. Use Playwright browser automation to validate test scenarios +3. Report results and provide actionable feedback +4. Help fix issues when needed + +## Available Playwright Testing Tools +You have access to these powerful automation tools: +${REQUIRED_MCP_SERVERS.map(server => `{{prompt:mcp_${server.name}_tools}}`)} + +- **~{${LAUNCH_BROWSER_FUNCTION_ID}}**: Launch the browser. This is required before performing any browser interactions. Always launch a new browser when starting a test session. +- **~{${IS_BROWSER_RUNNING_FUNCTION_ID}}**: Check if the browser is running. If a tool fails by saying that the connection failed, you can verify the connection by using this tool. +- **~{${CLOSE_BROWSER_FUNCTION_ID}}**: Close the browser. +- **~{${QUERY_DOM_FUNCTION_ID}}**: Query the DOM for specific elements and their properties. Only use when explicitly requested by the user. +- **~{${LIST_LAUNCH_CONFIGURATIONS_FUNCTION_ID}}**: To get a list of all available launch configurations. If there are no launch configurations, ask the user to manually start\ +the App or configure one. +- **~{${RUN_LAUNCH_CONFIGURATION_FUNCTION_ID}}**: Use this to launch the App under test (in case it is not already running) +- **~{${STOP_LAUNCH_CONFIGURATION_FUNCTION_ID}}**: To stop Apps once the testing is done + +## Workflow Approach +1. **Understand Requirements**: Ask the user to clearly define what needs to be tested +2. **Launch Browser**: Start a fresh browser instance for testing +3. **Navigate and Test**: Execute the test scenario methodically +4. **Document Results**: Provide detailed results with screenshots when helpful +5. **Clean Up**: Always close the browser when testing is complete + +## Current Context +Some files and other pieces of data may have been added by the user to the context of the chat. If any have, the details can be found below. +{{${CHAT_CONTEXT_DETAILS_VARIABLE_ID}}} +` +}; + +export const appTesterNextTemplate: BasePromptFragment = { + id: 'app-tester-system-next', + template: `{{!-- This prompt is licensed under the MIT License (https://opensource.org/license/mit). +Made improvements or adaptations to this prompt template? We'd love for you to share it with the community! Contribute back here: +https://github.com/eclipse-theia/theia/discussions/new?category=prompt-template-contribution +--}} + +You are AppTester, an autonomous testing agent that executes complete test workflows silently and reports results at the end. + +## Tools +${REQUIRED_MCP_SERVERS_NEXT.map(server => `{{prompt:mcp_${server.name}_tools}}`).join('\n')} + +- **~{${FILE_CONTENT_FUNCTION_ID}}**: Read workspace files +- **~{${LIST_LAUNCH_CONFIGURATIONS_FUNCTION_ID}}**: List launch configurations +- **~{${RUN_LAUNCH_CONFIGURATION_FUNCTION_ID}}**: Start application +- **~{${STOP_LAUNCH_CONFIGURATION_FUNCTION_ID}}**: Stop application + +## Protocol: Execute ALL 5 Steps in ONE Response + +### Step 1: Discover URL +If URL not provided in request: +1. Use ~{${LIST_LAUNCH_CONFIGURATIONS_FUNCTION_ID}} to find configs and check names for URL patterns +2. If needed, use ~{${FILE_CONTENT_FUNCTION_ID}} to read package.json, README.md, or .vscode/launch.json (stop once found) +3. Common patterns: localhost:3000, localhost:8080, localhost:4200 + +If app not running, start it with ~{${RUN_LAUNCH_CONFIGURATION_FUNCTION_ID}}. + +**Launch Configuration Selection Rules:** +- Check the project context if the testing URL is specified. +- **FORBIDDEN: Never launch configs with "Frontend" or "Electron" in the name.** This is a browser testing tool. +- **PREFERRED: Launch configs with "Backend", "Server", or "Browser" (without "Frontend") in the name.** +- These should start the application server/backend without opening windows. +- Running Frontend or Electron configs = test failure. Every time. + +### Step 2: Navigate +The Chrome DevTools MCP server connects to an existing browser at http://127.0.0.1:9222. +Use Chrome DevTools MCP navigate_to with the discovered URL. Even if already open, reload it. +**CRITICAL:** Always wait for the networkidle event before proceeding to testing. + +### Step 3: Test +Execute test scenario. Use screenshots only when explicitly requested. + +### Step 4: Report +Provide test results, console errors, bugs, and recommendations. + +### Step 5: Cleanup +If you started an app with ~{${RUN_LAUNCH_CONFIGURATION_FUNCTION_ID}}, close it with ~{${STOP_LAUNCH_CONFIGURATION_FUNCTION_ID}}. + +## Output Rules +- Execute all tool calls silently with ZERO text output during Steps 1-5 +- Produce ONE comprehensive report AFTER all steps complete +- Response structure: [Tool calls] → [Single report] + +## Report Format +**Test Report: [Test Scenario Name]** + +**Results:** [Pass/Fail status with details] + +**Issues Found:** [Bugs, errors, problems discovered] + +**Console Output:** [Errors, warnings, relevant logs] + +## Mandatory Rules +1. Execute all 5 steps in ONE response +2. Discover URLs yourself - never ask the user +3. Zero text during execution; report only after completion +4. Never launch Frontend or Electron configs +5. Always wait for networkidle event after navigation before testing +6. Do not provide screenshots to the user unless explicitly requested + +## Context +{{${CHAT_CONTEXT_DETAILS_VARIABLE_ID}}} + +## Project Info +{{prompt:project-info}} +` +}; + +export const appTesterTemplateVariant: BasePromptFragment = { + id: 'app-tester-system-empty', + template: '', +}; diff --git a/packages/ai-ide/src/browser/app-tester-prompt-template.ts.bak b/packages/ai-ide/src/browser/app-tester-prompt-template.ts.bak new file mode 100644 index 0000000..f940f0c --- /dev/null +++ b/packages/ai-ide/src/browser/app-tester-prompt-template.ts.bak @@ -0,0 +1,176 @@ +/* eslint-disable @typescript-eslint/tslint/config */ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH and others. +// +// This file is licensed under the MIT License. +// See LICENSE-MIT.txt in the project root for license information. +// https://opensource.org/license/mit. +// +// SPDX-License-Identifier: MIT +// ***************************************************************************** + +import { BasePromptFragment } from '@theia/ai-core/lib/common'; +import { CHAT_CONTEXT_DETAILS_VARIABLE_ID } from '@theia/ai-chat'; +import { QUERY_DOM_FUNCTION_ID, LAUNCH_BROWSER_FUNCTION_ID, CLOSE_BROWSER_FUNCTION_ID, IS_BROWSER_RUNNING_FUNCTION_ID } from '../common/app-tester-chat-functions'; +import { MCPServerDescription } from '@theia/ai-mcp/lib/common/mcp-server-manager'; +import { + FILE_CONTENT_FUNCTION_ID, + LIST_LAUNCH_CONFIGURATIONS_FUNCTION_ID, + RUN_LAUNCH_CONFIGURATION_FUNCTION_ID, + STOP_LAUNCH_CONFIGURATION_FUNCTION_ID +} from '../common/workspace-functions'; + +export const REQUIRED_MCP_SERVERS: MCPServerDescription[] = [ + { + name: 'playwright', + command: 'npx', + args: ['-y', '@playwright/mcp@latest', + '--cdp-endpoint', + 'http://localhost:9222/'], + autostart: false, + env: {}, + }, + { + name: 'playwright-visual', + command: 'npx', + args: ['-y', '@playwright/mcp@latest', '--vision', + '--cdp-endpoint', + 'http://localhost:9222/'], + autostart: false, + env: {}, + } +]; + +export const REQUIRED_MCP_SERVERS_NEXT: MCPServerDescription[] = [ + { + name: 'chrome-devtools', + command: 'npx', + args: ['-y', 'chrome-devtools-mcp@latest', '--cdp-endpoint', 'http://127.0.0.1:9222', '--no-usage-statistics'], + autostart: false, + env: {}, + } +]; + +export const appTesterTemplate: BasePromptFragment = { + id: 'app-tester-system-default', + template: `{{!-- This prompt is licensed under the MIT License (https://opensource.org/license/mit). +Made improvements or adaptations to this prompt template? We'd love for you to share it with the community! Contribute back here: +https://github.com/eclipse-theia/theia/discussions/new?category=prompt-template-contribution --}} + +You are AppTester, an AI assistant integrated into Theia IDE specifically designed to help developers test running applications using Playwright. +Your role is to inspect the application for user-specified test scenarios through the Playwright MCP server. + +## Your Workflow +1. Help the user build and launch their application +2. Use Playwright browser automation to validate test scenarios +3. Report results and provide actionable feedback +4. Help fix issues when needed + +## Available Playwright Testing Tools +You have access to these powerful automation tools: +${REQUIRED_MCP_SERVERS.map(server => `{{prompt:mcp_${server.name}_tools}}`)} + +- **~{${LAUNCH_BROWSER_FUNCTION_ID}}**: Launch the browser. This is required before performing any browser interactions. Always launch a new browser when starting a test session. +- **~{${IS_BROWSER_RUNNING_FUNCTION_ID}}**: Check if the browser is running. If a tool fails by saying that the connection failed, you can verify the connection by using this tool. +- **~{${CLOSE_BROWSER_FUNCTION_ID}}**: Close the browser. +- **~{${QUERY_DOM_FUNCTION_ID}}**: Query the DOM for specific elements and their properties. Only use when explicitly requested by the user. +- **~{${LIST_LAUNCH_CONFIGURATIONS_FUNCTION_ID}}**: To get a list of all available launch configurations. If there are no launch configurations, ask the user to manually start\ +the App or configure one. +- **~{${RUN_LAUNCH_CONFIGURATION_FUNCTION_ID}}**: Use this to launch the App under test (in case it is not already running) +- **~{${STOP_LAUNCH_CONFIGURATION_FUNCTION_ID}}**: To stop Apps once the testing is done + +## Workflow Approach +1. **Understand Requirements**: Ask the user to clearly define what needs to be tested +2. **Launch Browser**: Start a fresh browser instance for testing +3. **Navigate and Test**: Execute the test scenario methodically +4. **Document Results**: Provide detailed results with screenshots when helpful +5. **Clean Up**: Always close the browser when testing is complete + +## Current Context +Some files and other pieces of data may have been added by the user to the context of the chat. If any have, the details can be found below. +{{${CHAT_CONTEXT_DETAILS_VARIABLE_ID}}} +` +}; + +export const appTesterNextTemplate: BasePromptFragment = { + id: 'app-tester-system-next', + template: `{{!-- This prompt is licensed under the MIT License (https://opensource.org/license/mit). +Made improvements or adaptations to this prompt template? We'd love for you to share it with the community! Contribute back here: +https://github.com/eclipse-theia/theia/discussions/new?category=prompt-template-contribution +--}} + +You are AppTester, an autonomous testing agent that executes complete test workflows silently and reports results at the end. + +## Tools +${REQUIRED_MCP_SERVERS_NEXT.map(server => `{{prompt:mcp_${server.name}_tools}}`).join('\n')} + +- **~{${FILE_CONTENT_FUNCTION_ID}}**: Read workspace files +- **~{${LIST_LAUNCH_CONFIGURATIONS_FUNCTION_ID}}**: List launch configurations +- **~{${RUN_LAUNCH_CONFIGURATION_FUNCTION_ID}}**: Start application +- **~{${STOP_LAUNCH_CONFIGURATION_FUNCTION_ID}}**: Stop application + +## Protocol: Execute ALL 5 Steps in ONE Response + +### Step 1: Discover URL +If URL not provided in request: +1. Use ~{${LIST_LAUNCH_CONFIGURATIONS_FUNCTION_ID}} to find configs and check names for URL patterns +2. If needed, use ~{${FILE_CONTENT_FUNCTION_ID}} to read package.json, README.md, or .vscode/launch.json (stop once found) +3. Common patterns: localhost:3000, localhost:8080, localhost:4200 + +If app not running, start it with ~{${RUN_LAUNCH_CONFIGURATION_FUNCTION_ID}}. + +**Launch Configuration Selection Rules:** +- Check the project context if the testing URL is specified. +- **FORBIDDEN: Never launch configs with "Frontend" or "Electron" in the name.** This is a browser testing tool. +- **PREFERRED: Launch configs with "Backend", "Server", or "Browser" (without "Frontend") in the name.** +- These should start the application server/backend without opening windows. +- Running Frontend or Electron configs = test failure. Every time. + +### Step 2: Navigate +The Chrome DevTools MCP server connects to an existing browser at http://127.0.0.1:9222. +Use Chrome DevTools MCP navigate_to with the discovered URL. Even if already open, reload it. +**CRITICAL:** Always wait for the networkidle event before proceeding to testing. + +### Step 3: Test +Execute test scenario. Use screenshots only when explicitly requested. + +### Step 4: Report +Provide test results, console errors, bugs, and recommendations. + +### Step 5: Cleanup +If you started an app with ~{${RUN_LAUNCH_CONFIGURATION_FUNCTION_ID}}, close it with ~{${STOP_LAUNCH_CONFIGURATION_FUNCTION_ID}}. + +## Output Rules +- Execute all tool calls silently with ZERO text output during Steps 1-5 +- Produce ONE comprehensive report AFTER all steps complete +- Response structure: [Tool calls] → [Single report] + +## Report Format +**Test Report: [Test Scenario Name]** + +**Results:** [Pass/Fail status with details] + +**Issues Found:** [Bugs, errors, problems discovered] + +**Console Output:** [Errors, warnings, relevant logs] + +## Mandatory Rules +1. Execute all 5 steps in ONE response +2. Discover URLs yourself - never ask the user +3. Zero text during execution; report only after completion +4. Never launch Frontend or Electron configs +5. Always wait for networkidle event after navigation before testing +6. Do not provide screenshots to the user unless explicitly requested + +## Context +{{${CHAT_CONTEXT_DETAILS_VARIABLE_ID}}} + +## Project Info +{{prompt:project-info}} +` +}; + +export const appTesterTemplateVariant: BasePromptFragment = { + id: 'app-tester-system-empty', + template: '', +}; diff --git a/packages/ai-ide/src/browser/architect-agent.ts b/packages/ai-ide/src/browser/architect-agent.ts new file mode 100644 index 0000000..6ed4f8d --- /dev/null +++ b/packages/ai-ide/src/browser/architect-agent.ts @@ -0,0 +1,98 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** +import { + ChatMode, ChatRequestModel, ChatService, ChatSession, + MutableChatModel, MutableChatRequestModel +} from '@theia/ai-chat/lib/common'; +import { TaskContextStorageService } from '@theia/ai-chat/lib/browser/task-context-service'; +import { LanguageModelRequirement } from '@theia/ai-core'; +import { inject, injectable } from '@theia/core/shared/inversify'; +import { architectSystemVariants, ARCHITECT_DEFAULT_PROMPT_ID, ARCHITECT_PLANNING_PROMPT_ID, ARCHITECT_SIMPLE_PROMPT_ID } from '../common/architect-prompt-template'; +import { nls } from '@theia/core'; +import { MarkdownStringImpl } from '@theia/core/lib/common/markdown-rendering'; +import { AI_SUMMARIZE_SESSION_AS_TASK_FOR_CODER, AI_UPDATE_TASK_CONTEXT_COMMAND, AI_EXECUTE_PLAN_WITH_CODER } from '../common/summarize-session-commands'; +import { AbstractModeAwareChatAgent } from './mode-aware-chat-agent'; + +@injectable() +export class ArchitectAgent extends AbstractModeAwareChatAgent { + @inject(ChatService) protected readonly chatService: ChatService; + @inject(TaskContextStorageService) protected readonly taskContextStorageService: TaskContextStorageService; + + name = 'Architect'; + id = 'Architect'; + languageModelRequirements: LanguageModelRequirement[] = [{ + purpose: 'chat', + identifier: 'default/code', + }]; + protected defaultLanguageModelPurpose: string = 'chat'; + + override description = nls.localize('theia/ai/workspace/workspaceAgent/description', + 'An AI assistant integrated into Theia IDE, designed to assist software developers. This agent can access the users workspace, it can get a list of all available files \ + and folders and retrieve their content. It cannot modify files. It can therefore answer questions about the current project, project files and source code in the \ + workspace, such as how to build the project, where to put source code, where to find specific code or configurations, etc.'); + + protected readonly modeDefinitions: Omit[] = [ + { + id: ARCHITECT_DEFAULT_PROMPT_ID, + name: nls.localize('theia/ai/ide/architectAgent/mode/default', 'Default Mode') + }, + { + id: ARCHITECT_SIMPLE_PROMPT_ID, + name: nls.localize('theia/ai/ide/architectAgent/mode/simple', 'Simple Mode') + }, + { + id: ARCHITECT_PLANNING_PROMPT_ID, + name: nls.localize('theia/ai/ide/architectAgent/mode/plan', 'Plan Mode') + }, + ]; + + override prompts = [architectSystemVariants]; + protected override systemPromptId: string | undefined = architectSystemVariants.id; + + override async invoke(request: MutableChatRequestModel): Promise { + await super.invoke(request); + this.suggest(request); + } + + async suggest(context: ChatSession | ChatRequestModel): Promise { + const model = ChatRequestModel.is(context) ? context.session : context.model; + const session = this.chatService.getSessions().find(candidate => candidate.model.id === model.id); + if (!(model instanceof MutableChatModel) || !session) { return; } + if (!model.isEmpty()) { + // Check if we're using the next prompt variant, if so, we show different actions + const lastRequest = model.getRequests().at(-1); + const isNextVariant = lastRequest?.response?.promptVariantId === ARCHITECT_PLANNING_PROMPT_ID; + + if (isNextVariant) { + const taskContexts = this.taskContextStorageService.getAll().filter(s => s.sessionId === session.id); + if (taskContexts.length > 0) { + const suggestions = taskContexts.map(tc => + new MarkdownStringImpl(`[${nls.localize('theia/ai/ide/architectAgent/suggestion/executePlanWithCoder', + 'Execute "{0}" with Coder', tc.label)}](command:${AI_EXECUTE_PLAN_WITH_CODER.id}?${encodeURIComponent(JSON.stringify(tc.id))}).`) + ); + model.setSuggestions(suggestions); + } + } else { + model.setSuggestions([ + new MarkdownStringImpl(`[${nls.localize('theia/ai/ide/architectAgent/suggestion/summarizeSessionAsTaskForCoder', + 'Summarize this session as a task for Coder')}](command:${AI_SUMMARIZE_SESSION_AS_TASK_FOR_CODER.id}).`), + new MarkdownStringImpl(`[${nls.localize('theia/ai/ide/architectAgent/suggestion/updateTaskContext', + 'Update current task context')}](command:${AI_UPDATE_TASK_CONTEXT_COMMAND.id}).`) + ]); + } + } + } +} diff --git a/packages/ai-ide/src/browser/coder-agent.ts b/packages/ai-ide/src/browser/coder-agent.ts new file mode 100644 index 0000000..8e9aa68 --- /dev/null +++ b/packages/ai-ide/src/browser/coder-agent.ts @@ -0,0 +1,113 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** +import { + ChatMode, ChatRequestModel, ChatService, ChatSession, + MutableChatModel, MutableChatRequestModel +} from '@theia/ai-chat/lib/common'; +import { inject, injectable } from '@theia/core/shared/inversify'; +import { + CODER_SYSTEM_PROMPT_ID, + CODER_EDIT_TEMPLATE_ID, + CODER_AGENT_MODE_TEMPLATE_ID, + CODER_AGENT_MODE_NEXT_TEMPLATE_ID, + CODE_OS_AGENT_MODE_TEMPLATE_ID, + getCoderAgentModePromptTemplate, + getCoderAgentModeNextPromptTemplate, + getCoderPromptTemplateEdit, + getCoderPromptTemplateEditNext, + getCoderPromptTemplateSimpleEdit, + getCodeOsAgentModePromptTemplate +} from '../common/coder-replace-prompt-template'; +import { LanguageModelRequirement, PromptVariantSet } from '@theia/ai-core'; +import { nls } from '@theia/core'; +import { MarkdownStringImpl } from '@theia/core/lib/common/markdown-rendering'; +import { AI_CHAT_NEW_CHAT_WINDOW_COMMAND, ChatCommands } from '@theia/ai-chat-ui/lib/browser/chat-view-commands'; +import { AbstractModeAwareChatAgent } from './mode-aware-chat-agent'; + +@injectable() +export class CoderAgent extends AbstractModeAwareChatAgent { + @inject(ChatService) protected readonly chatService: ChatService; + id: string = 'Coder'; + name = 'Coder'; + languageModelRequirements: LanguageModelRequirement[] = [{ + purpose: 'chat', + identifier: 'default/code', + }]; + protected defaultLanguageModelPurpose: string = 'chat'; + + override description = nls.localize('theia/ai/workspace/coderAgent/description', + 'An AI assistant integrated into Theia IDE, designed to assist software developers. This agent can access the users workspace, it can get a list of all available files \ + and folders and retrieve their content. Furthermore, it can suggest modifications of files to the user. It can therefore assist the user with coding tasks or other \ + tasks involving file changes.'); + + protected readonly modeDefinitions: Omit[] = [ + { + id: CODE_OS_AGENT_MODE_TEMPLATE_ID, + name: nls.localize('theia/ai/ide/coderAgent/mode/codeOs', 'Code OS') + }, + { + id: CODER_EDIT_TEMPLATE_ID, + name: nls.localize('theia/ai/ide/coderAgent/mode/edit', 'Edit Mode') + }, + { + id: CODER_AGENT_MODE_TEMPLATE_ID, + name: nls.localizeByDefault('Agent Mode') + }, + { + id: CODER_AGENT_MODE_NEXT_TEMPLATE_ID, + name: nls.localize('theia/ai/ide/coderAgent/mode/agentNext', 'Agent Mode (Next)') + }, + ]; + + override prompts: PromptVariantSet[] = [{ + id: CODER_SYSTEM_PROMPT_ID, + defaultVariant: getCoderPromptTemplateEdit(), + variants: [ + getCoderPromptTemplateSimpleEdit(), + getCoderAgentModePromptTemplate(), + getCoderAgentModeNextPromptTemplate(), + getCoderPromptTemplateEditNext(), + getCodeOsAgentModePromptTemplate() + ] + }]; + protected override systemPromptId: string | undefined = CODER_SYSTEM_PROMPT_ID; + override async invoke(request: MutableChatRequestModel): Promise { + await super.invoke(request); + this.suggest(request); + } + async suggest(context: ChatSession | ChatRequestModel): Promise { + const contextIsRequest = ChatRequestModel.is(context); + const model = contextIsRequest ? context.session : context.model; + const session = contextIsRequest ? this.chatService.getSessions().find(candidate => candidate.model.id === model.id) : context; + if (!(model instanceof MutableChatModel) || !session) { return; } + if (model.isEmpty()) { + model.setSuggestions([ + { + kind: 'callback', + callback: () => this.chatService.sendRequest(session.id, { + text: `@Coder ${nls.localize('theia/ai/ide/coderAgent/suggestion/fixProblems/prompt', 'please look at {1} and fix any problems.', '#_f')}` + }), + content: nls.localize('theia/ai/ide/coderAgent/suggestion/fixProblems/content', '[Fix problems]({0}) in the current file.', '_callback') + }, + ]); + } else { + model.setSuggestions([new MarkdownStringImpl(nls.localize('theia/ai/ide/coderAgent/suggestion/startNewChat', + 'Keep chats short and focused. [Start a new chat]({0}) for a new task or [start a new chat with a summary of this one]({1}).', + `command:${AI_CHAT_NEW_CHAT_WINDOW_COMMAND.id}`, `command:${ChatCommands.AI_CHAT_NEW_WITH_TASK_CONTEXT.id}`))]); + } + } + +} diff --git a/packages/ai-ide/src/browser/context-file-validation-service-impl.spec.ts b/packages/ai-ide/src/browser/context-file-validation-service-impl.spec.ts new file mode 100644 index 0000000..5c6c04a --- /dev/null +++ b/packages/ai-ide/src/browser/context-file-validation-service-impl.spec.ts @@ -0,0 +1,405 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { enableJSDOM } from '@theia/core/lib/browser/test/jsdom'; +let disableJSDOM = enableJSDOM(); +import { FrontendApplicationConfigProvider } from '@theia/core/lib/browser/frontend-application-config-provider'; +FrontendApplicationConfigProvider.set({}); + +import { expect } from 'chai'; +import { Container } from '@theia/core/shared/inversify'; +import { URI, PreferenceService } from '@theia/core'; +import { FileService } from '@theia/filesystem/lib/browser/file-service'; +import { WorkspaceService } from '@theia/workspace/lib/browser/workspace-service'; +import { FileStat } from '@theia/filesystem/lib/common/files'; +import { ContextFileValidationService, FileValidationState } from '@theia/ai-chat/lib/browser/context-file-validation-service'; +import { ContextFileValidationServiceImpl } from './context-file-validation-service-impl'; +import { WorkspaceFunctionScope } from './workspace-functions'; + +disableJSDOM(); + +describe('ContextFileValidationService', () => { + let container: Container; + let validationService: ContextFileValidationService; + let mockFileService: FileService; + let mockWorkspaceService: WorkspaceService; + let mockPreferenceService: PreferenceService; + + const workspaceRoot = new URI('file:///home/user/workspace'); + + // Store URIs as actual URI strings, exactly as URI.toString() would produce them + const existingFiles = new Map([ + // Files inside workspace + ['file:///home/user/workspace/src/index.tsx', true], + ['file:///home/user/workspace/package.json', true], + ['file:///home/user/workspace/README.md', true], + ['file:///home/user/workspace/src/components/Button.tsx', true], + ['file:///home/user/workspace/config.json', true], + ['file:///home/user/workspace/src/file%20with%20spaces.tsx', true], + // Files outside workspace (these exist but should be rejected) + ['file:///etc/passwd', true], + ['file:///etc/hosts', true], + ['file:///home/other-user/secret.txt', true], + ['file:///tmp/temporary-file.log', true] + ]); + + before(() => { + disableJSDOM = enableJSDOM(); + }); + + after(() => { + disableJSDOM(); + }); + + beforeEach(async () => { + container = new Container(); + + // Mock WorkspaceService + mockWorkspaceService = { + tryGetRoots: () => [{ + resource: workspaceRoot, + isDirectory: true + } as FileStat], + roots: Promise.resolve([{ + resource: workspaceRoot, + isDirectory: true + } as FileStat]) + } as unknown as WorkspaceService; + + // Mock FileService + mockFileService = { + exists: async (uri: URI) => { + const normalizedUri = uri.path.normalize(); + const normalizedUriString = uri.withPath(normalizedUri).toString(); + const uriString = uri.toString(); + + const exists = (existingFiles.has(uriString) && existingFiles.get(uriString) === true) || + (existingFiles.has(normalizedUriString) && existingFiles.get(normalizedUriString) === true); + return exists; + }, + resolve: async (uri: URI) => { + const uriString = uri.toString(); + if (existingFiles.has(uriString) && existingFiles.get(uriString) === true) { + return { + resource: uri, + isDirectory: false + } as FileStat; + } + throw new Error('File not found'); + } + } as unknown as FileService; + + // Mock PreferenceService + mockPreferenceService = { + get: () => false + } as unknown as PreferenceService; + + container.bind(FileService).toConstantValue(mockFileService); + container.bind(WorkspaceService).toConstantValue(mockWorkspaceService); + container.bind(PreferenceService).toConstantValue(mockPreferenceService); + container.bind(WorkspaceFunctionScope).toSelf(); + container.bind(ContextFileValidationServiceImpl).toSelf(); + container.bind(ContextFileValidationService).toService(ContextFileValidationServiceImpl); + + validationService = await container.getAsync(ContextFileValidationService); + }); + + describe('validateFile with relative paths', () => { + it('should validate existing file with relative path', async () => { + const result = await validationService.validateFile('src/index.tsx'); + expect(result.state).to.equal(FileValidationState.VALID); + }); + + it('should reject non-existing file with relative path', async () => { + const result = await validationService.validateFile('src/missing.tsx'); + expect(result.state).to.equal(FileValidationState.INVALID_NOT_FOUND); + }); + + it('should validate nested file with relative path', async () => { + const result = await validationService.validateFile('src/components/Button.tsx'); + expect(result.state).to.equal(FileValidationState.VALID); + }); + + it('should validate file in root with relative path', async () => { + const result = await validationService.validateFile('package.json'); + expect(result.state).to.equal(FileValidationState.VALID); + }); + }); + + describe('validateFile with absolute file paths', () => { + it('should validate existing file with absolute path within workspace', async () => { + const result = await validationService.validateFile('/home/user/workspace/src/index.tsx'); + expect(result.state).to.equal(FileValidationState.VALID); + }); + + it('should reject non-existing file with absolute path within workspace', async () => { + const result = await validationService.validateFile('/home/user/workspace/src/missing.tsx'); + expect(result.state).to.equal(FileValidationState.INVALID_NOT_FOUND); + }); + + it('should reject existing file with absolute path outside workspace (/etc/passwd)', async () => { + const result = await validationService.validateFile('/etc/passwd'); + expect(result.state).to.equal(FileValidationState.INVALID_NOT_FOUND); + }); + + it('should reject existing file with absolute path outside workspace (/etc/hosts)', async () => { + const result = await validationService.validateFile('/etc/hosts'); + expect(result.state).to.equal(FileValidationState.INVALID_NOT_FOUND); + }); + + it('should reject existing file with absolute path in other user directory', async () => { + const result = await validationService.validateFile('/home/other-user/secret.txt'); + expect(result.state).to.equal(FileValidationState.INVALID_NOT_FOUND); + }); + + it('should reject existing file with absolute path in /tmp', async () => { + const result = await validationService.validateFile('/tmp/temporary-file.log'); + expect(result.state).to.equal(FileValidationState.INVALID_NOT_FOUND); + }); + + it('should reject non-existing file with absolute path outside workspace', async () => { + const result = await validationService.validateFile('/var/log/nonexistent.log'); + expect(result.state).to.equal(FileValidationState.INVALID_NOT_FOUND); + }); + + it('should validate nested file with absolute path within workspace', async () => { + const result = await validationService.validateFile('/home/user/workspace/src/components/Button.tsx'); + expect(result.state).to.equal(FileValidationState.VALID); + }); + }); + + describe('validateFile with file:// URIs', () => { + it('should validate existing file with file:// URI within workspace', async () => { + const result = await validationService.validateFile('file:///home/user/workspace/src/index.tsx'); + expect(result.state).to.equal(FileValidationState.VALID); + }); + + it('should reject non-existing file with file:// URI within workspace', async () => { + const result = await validationService.validateFile('file:///home/user/workspace/src/missing.tsx'); + expect(result.state).to.equal(FileValidationState.INVALID_NOT_FOUND); + }); + + it('should reject existing file with file:// URI outside workspace (/etc/passwd)', async () => { + const result = await validationService.validateFile('file:///etc/passwd'); + expect(result.state).to.equal(FileValidationState.INVALID_NOT_FOUND); + }); + + it('should reject existing file with file:// URI outside workspace (/etc/hosts)', async () => { + const result = await validationService.validateFile('file:///etc/hosts'); + expect(result.state).to.equal(FileValidationState.INVALID_NOT_FOUND); + }); + + it('should reject existing file with file:// URI in other user directory', async () => { + const result = await validationService.validateFile('file:///home/other-user/secret.txt'); + expect(result.state).to.equal(FileValidationState.INVALID_NOT_FOUND); + }); + + it('should reject existing file with file:// URI in /tmp', async () => { + const result = await validationService.validateFile('file:///tmp/temporary-file.log'); + expect(result.state).to.equal(FileValidationState.INVALID_NOT_FOUND); + }); + + it('should reject non-existing file with file:// URI outside workspace', async () => { + const result = await validationService.validateFile('file:///var/log/nonexistent.log'); + expect(result.state).to.equal(FileValidationState.INVALID_NOT_FOUND); + }); + + it('should validate file at workspace root with file:// URI', async () => { + const result = await validationService.validateFile('file:///home/user/workspace/package.json'); + expect(result.state).to.equal(FileValidationState.VALID); + }); + }); + + describe('validateFile with URI objects', () => { + it('should validate existing file with URI object within workspace', async () => { + const uri = new URI('file:///home/user/workspace/src/index.tsx'); + const result = await validationService.validateFile(uri); + expect(result.state).to.equal(FileValidationState.VALID); + }); + + it('should reject non-existing file with URI object within workspace', async () => { + const uri = new URI('file:///home/user/workspace/src/missing.tsx'); + const result = await validationService.validateFile(uri); + expect(result.state).to.equal(FileValidationState.INVALID_NOT_FOUND); + }); + + it('should reject existing file with URI object outside workspace', async () => { + const uri = new URI('file:///etc/passwd'); + const result = await validationService.validateFile(uri); + expect(result.state).to.equal(FileValidationState.INVALID_NOT_FOUND); + }); + + it('should reject another existing file with URI object outside workspace', async () => { + const uri = new URI('file:///home/other-user/secret.txt'); + const result = await validationService.validateFile(uri); + expect(result.state).to.equal(FileValidationState.INVALID_NOT_FOUND); + }); + }); + + describe('validateFile with no workspace', () => { + beforeEach(async () => { + // Override mock to return no workspace roots + mockWorkspaceService.tryGetRoots = () => []; + }); + + it('should reject any file when no workspace is open', async () => { + const result = await validationService.validateFile('src/index.tsx'); + expect(result.state).to.equal(FileValidationState.INVALID_NOT_FOUND); + }); + + it('should reject absolute path when no workspace is open', async () => { + const result = await validationService.validateFile('/home/user/file.txt'); + expect(result.state).to.equal(FileValidationState.INVALID_NOT_FOUND); + }); + + it('should reject file:// URI when no workspace is open', async () => { + const result = await validationService.validateFile('file:///home/user/file.txt'); + expect(result.state).to.equal(FileValidationState.INVALID_NOT_FOUND); + }); + }); + + describe('validateFile with multiple workspace roots', () => { + const workspaceRoot2 = new URI('file:///home/user/other-project'); + + beforeEach(async () => { + // Override mock to return multiple workspace roots + mockWorkspaceService.tryGetRoots = () => [ + { + resource: workspaceRoot, + isDirectory: true + } as FileStat, + { + resource: workspaceRoot2, + isDirectory: true + } as FileStat + ]; + + // Add files in the second workspace + existingFiles.set('file:///home/user/other-project/index.js', true); + existingFiles.set('file:///home/user/other-project/lib/utils.js', true); + }); + + afterEach(() => { + // Clean up files added for this test + existingFiles.delete('file:///home/user/other-project/index.js'); + existingFiles.delete('file:///home/user/other-project/lib/utils.js'); + }); + + it('should validate file in first workspace root', async () => { + const result = await validationService.validateFile('src/index.tsx'); + expect(result.state).to.equal(FileValidationState.VALID); + }); + + it('should validate file in second workspace root with relative path', async () => { + const result = await validationService.validateFile('index.js'); + expect(result.state).to.equal(FileValidationState.INVALID_SECONDARY); + }); + + it('should validate file in second workspace root with absolute path', async () => { + const result = await validationService.validateFile('/home/user/other-project/index.js'); + expect(result.state).to.equal(FileValidationState.INVALID_SECONDARY); + }); + + it('should validate file in second workspace root with file:// URI', async () => { + const result = await validationService.validateFile('file:///home/user/other-project/lib/utils.js'); + expect(result.state).to.equal(FileValidationState.INVALID_SECONDARY); + }); + + it('should still reject files outside both workspace roots', async () => { + const result = await validationService.validateFile('/etc/passwd'); + expect(result.state).to.equal(FileValidationState.INVALID_NOT_FOUND); + }); + }); + + describe('validateFile error handling', () => { + it('should return false when FileService.exists throws error', async () => { + mockFileService.exists = async () => { + throw new Error('Permission denied'); + }; + + const result = await validationService.validateFile('src/index.tsx'); + expect(result.state).to.equal(FileValidationState.INVALID_NOT_FOUND); + }); + + it('should handle Windows-style paths', async () => { + // Add a Windows path to existing files + // Note: URI encoding will convert 'c:' to 'c%3A' + const windowsRoot = new URI('file:///c:/Users/user/project'); + const windowsFile = new URI('file:///c:/Users/user/project/file.txt'); + existingFiles.set(windowsFile.toString(), true); + + // Override workspace to use Windows path + mockWorkspaceService.tryGetRoots = () => [{ + resource: windowsRoot, + isDirectory: true + } as FileStat]; + + const result = await validationService.validateFile('file:///c:/Users/user/project/file.txt'); + expect(result.state).to.equal(FileValidationState.VALID); + + // Clean up + existingFiles.delete(windowsFile.toString()); + }); + + it('should reject Windows system files outside workspace', async () => { + // Add Windows system file + const windowsSystemFile = 'file:///c:/Windows/System32/config/sam'; + existingFiles.set(windowsSystemFile, true); + + // Keep workspace as Linux for this test + const result = await validationService.validateFile('file:///c:/Windows/System32/config/sam'); + expect(result.state).to.equal(FileValidationState.INVALID_NOT_FOUND); + + // Clean up + existingFiles.delete(windowsSystemFile); + }); + }); + + describe('edge cases', () => { + it('should handle paths with special characters', async () => { + const result = await validationService.validateFile('file:///home/user/workspace/src/file%20with%20spaces.tsx'); + expect(result.state).to.equal(FileValidationState.VALID); + }); + + it('should handle paths with normalized separators', async () => { + const result = await validationService.validateFile('src\\components\\Button.tsx'); + expect(result.state).to.equal(FileValidationState.VALID); + }); + + it('should reject empty path', async () => { + const result = await validationService.validateFile(''); + expect(result.state).to.equal(FileValidationState.INVALID_NOT_FOUND); + }); + + it('should reject parent directory references in relative paths', async () => { + // Parent directory references are not allowed for security and clarity + const result = await validationService.validateFile('src/../config.json'); + expect(result.state).to.equal(FileValidationState.INVALID_NOT_FOUND); + }); + + it('should reject path traversal attempts with parent directory references', async () => { + // Path traversal attempts should be rejected + const result = await validationService.validateFile('../../../../../../etc/passwd'); + expect(result.state).to.equal(FileValidationState.INVALID_NOT_FOUND); + }); + + it('should reject absolute paths with parent directory references', async () => { + // Even absolute paths with .. should be rejected for consistency + const result = await validationService.validateFile('/home/user/workspace/src/../config.json'); + expect(result.state).to.equal(FileValidationState.INVALID_NOT_FOUND); + }); + }); +}); diff --git a/packages/ai-ide/src/browser/context-file-validation-service-impl.ts b/packages/ai-ide/src/browser/context-file-validation-service-impl.ts new file mode 100644 index 0000000..a6c0340 --- /dev/null +++ b/packages/ai-ide/src/browser/context-file-validation-service-impl.ts @@ -0,0 +1,120 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { injectable, inject } from '@theia/core/shared/inversify'; +import { URI } from '@theia/core'; +import { FileService } from '@theia/filesystem/lib/browser/file-service'; +import { WorkspaceService } from '@theia/workspace/lib/browser/workspace-service'; +import { ContextFileValidationService, FileValidationResult, FileValidationState } from '@theia/ai-chat/lib/browser/context-file-validation-service'; +import { WorkspaceFunctionScope } from './workspace-functions'; + +@injectable() +export class ContextFileValidationServiceImpl implements ContextFileValidationService { + + @inject(FileService) + protected readonly fileService: FileService; + + @inject(WorkspaceFunctionScope) + protected readonly workspaceScope: WorkspaceFunctionScope; + + @inject(WorkspaceService) + protected readonly workspaceService: WorkspaceService; + + async validateFile(pathOrUri: string | URI): Promise { + try { + const resolvedUri = await this.workspaceScope.resolveToUri(pathOrUri); + + if (!resolvedUri) { + return { + state: FileValidationState.INVALID_NOT_FOUND, + message: 'File does not exist' + }; + } + + const exists = await this.fileService.exists(resolvedUri); + if (!exists) { + const secondaryRootUri = await this.findInSecondaryWorkspaceRoots(pathOrUri); + if (secondaryRootUri) { + return { + state: FileValidationState.INVALID_SECONDARY, + message: 'File is in a secondary workspace root. AI agents can only access files in the first workspace root.' + }; + } + return { + state: FileValidationState.INVALID_NOT_FOUND, + message: 'File does not exist' + }; + } + + if (this.workspaceScope.isInPrimaryWorkspace(resolvedUri)) { + return { + state: FileValidationState.VALID + }; + } + + if (this.workspaceScope.isInWorkspace(resolvedUri)) { + return { + state: FileValidationState.INVALID_SECONDARY, + message: 'File is in a secondary workspace root. AI agents can only access files in the first workspace root.' + }; + } + + return { + state: FileValidationState.INVALID_NOT_FOUND, + message: 'File does not exist in the workspace' + }; + } catch (error) { + return { + state: FileValidationState.INVALID_NOT_FOUND, + message: 'File does not exist' + }; + } + } + + protected async findInSecondaryWorkspaceRoots(pathOrUri: string | URI): Promise { + const roots = this.workspaceService.tryGetRoots(); + if (roots.length <= 1) { + return undefined; + } + + for (let i = 1; i < roots.length; i++) { + const root = roots[i]; + let candidateUri: URI; + + if (pathOrUri instanceof URI) { + candidateUri = pathOrUri; + } else if (pathOrUri.includes('://')) { + try { + candidateUri = new URI(pathOrUri); + } catch { + continue; + } + } else { + candidateUri = root.resource.resolve(pathOrUri); + } + + try { + if (await this.fileService.exists(candidateUri)) { + return candidateUri; + } + } catch { + continue; + } + } + + return undefined; + } +} diff --git a/packages/ai-ide/src/browser/context-functions.spec.ts b/packages/ai-ide/src/browser/context-functions.spec.ts new file mode 100644 index 0000000..2227a95 --- /dev/null +++ b/packages/ai-ide/src/browser/context-functions.spec.ts @@ -0,0 +1,260 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** +import { enableJSDOM } from '@theia/core/lib/browser/test/jsdom'; +let disableJSDOM = enableJSDOM(); +import { FrontendApplicationConfigProvider } from '@theia/core/lib/browser/frontend-application-config-provider'; +FrontendApplicationConfigProvider.set({}); +import { expect } from 'chai'; +import { ListChatContext, ResolveChatContext, AddFileToChatContext } from './context-functions'; +import { CancellationTokenSource } from '@theia/core'; +import { ChatContextManager, ChatToolContext, MutableChatModel, MutableChatRequestModel, MutableChatResponseModel } from '@theia/ai-chat'; +import { fail } from 'assert'; +import { AIVariableResolutionRequest, ResolvedAIContextVariable } from '@theia/ai-core'; +import { ContextFileValidationService, FileValidationState } from '@theia/ai-chat/lib/browser/context-file-validation-service'; +disableJSDOM(); + +describe('Context Functions Cancellation Tests', () => { + let cancellationTokenSource: CancellationTokenSource; + let mockCtx: ChatToolContext; + + before(() => { + disableJSDOM = enableJSDOM(); + }); + after(() => { + // Disable JSDOM after all tests + disableJSDOM(); + }); + + beforeEach(() => { + cancellationTokenSource = new CancellationTokenSource(); + const context: Partial = { + addVariables: () => { }, + getVariables: () => mockCtx.request.context?.variables as ResolvedAIContextVariable[] + }; + const mockRequest = { + context: { + variables: [{ + variable: { id: 'file1', name: 'File' }, + arg: '/path/to/file', + contextValue: 'file content' + } as ResolvedAIContextVariable] + }, + session: { + context + } as MutableChatModel + } as unknown as MutableChatRequestModel; + mockCtx = { + cancellationToken: cancellationTokenSource.token, + request: mockRequest, + response: {} as MutableChatResponseModel + }; + }); + + afterEach(() => { + cancellationTokenSource.dispose(); + }); + + it('ListChatContext should respect cancellation token', async () => { + const listChatContext = new ListChatContext(); + cancellationTokenSource.cancel(); + + const result = await listChatContext.getTool().handler('', mockCtx); + if (typeof result !== 'string') { + fail(`Wrong tool call result type: ${result}`); + } + const jsonResponse = JSON.parse(result); + expect(jsonResponse.error).to.equal('Operation cancelled by user'); + }); + + it('ResolveChatContext should respect cancellation token', async () => { + const resolveChatContext = new ResolveChatContext(); + cancellationTokenSource.cancel(); + + const result = await resolveChatContext.getTool().handler('{"contextElementId":"file1/path/to/file"}', mockCtx); + if (typeof result !== 'string') { + fail(`Wrong tool call result type: ${result}`); + } + const jsonResponse = JSON.parse(result); + expect(jsonResponse.error).to.equal('Operation cancelled by user'); + }); + + it('AddFileToChatContext should respect cancellation token', async () => { + const addFileToChatContext = new AddFileToChatContext(); + cancellationTokenSource.cancel(); + + const result = await addFileToChatContext.getTool().handler('{"filesToAdd":["/new/path/to/file"]}', mockCtx); + if (typeof result !== 'string') { + fail(`Wrong tool call result type: ${result}`); + } + const jsonResponse = JSON.parse(result); + expect(jsonResponse.error).to.equal('Operation cancelled by user'); + }); +}); + +describe('AddFileToChatContext Validation Tests', () => { + let mockCtx: ChatToolContext; + let addedFiles: AIVariableResolutionRequest[]; + + before(() => { + disableJSDOM = enableJSDOM(); + }); + after(() => { + disableJSDOM(); + }); + + beforeEach(() => { + addedFiles = []; + const context: Partial = { + addVariables: (...vars: AIVariableResolutionRequest[]) => { + addedFiles.push(...vars); + }, + getVariables: () => [] + }; + const mockRequest = { + context: { + variables: [] + }, + session: { + context + } as MutableChatModel + } as unknown as MutableChatRequestModel; + mockCtx = { + cancellationToken: new CancellationTokenSource().token, + request: mockRequest, + response: {} as MutableChatResponseModel + }; + }); + + it('should add valid files to context', async () => { + const mockValidationService: ContextFileValidationService = { + validateFile: async () => ({ state: FileValidationState.VALID }) + }; + + const addFileToChatContext = new AddFileToChatContext(); + (addFileToChatContext as unknown as { validationService: ContextFileValidationService }).validationService = mockValidationService; + + const result = await addFileToChatContext.getTool().handler( + '{"filesToAdd":["/valid/file1.ts","/valid/file2.ts"]}', + mockCtx + ); + + if (typeof result !== 'string') { + fail(`Wrong tool call result type: ${result}`); + } + + const jsonResponse = JSON.parse(result); + expect(jsonResponse.added).to.have.lengthOf(2); + expect(jsonResponse.added).to.include('/valid/file1.ts'); + expect(jsonResponse.added).to.include('/valid/file2.ts'); + expect(jsonResponse.rejected).to.have.lengthOf(0); + expect(jsonResponse.summary.totalRequested).to.equal(2); + expect(jsonResponse.summary.added).to.equal(2); + expect(jsonResponse.summary.rejected).to.equal(0); + expect(addedFiles).to.have.lengthOf(2); + }); + + it('should reject non-existent files', async () => { + const mockValidationService: ContextFileValidationService = { + validateFile: async file => { + if (file === '/nonexistent/file.ts') { + return { + state: FileValidationState.INVALID_NOT_FOUND, + message: 'File does not exist' + }; + } + return { state: FileValidationState.VALID }; + } + }; + + const addFileToChatContext = new AddFileToChatContext(); + (addFileToChatContext as unknown as { validationService: ContextFileValidationService }).validationService = mockValidationService; + + const result = await addFileToChatContext.getTool().handler( + '{"filesToAdd":["/valid/file.ts","/nonexistent/file.ts"]}', + mockCtx + ); + + if (typeof result !== 'string') { + fail(`Wrong tool call result type: ${result}`); + } + + const jsonResponse = JSON.parse(result); + expect(jsonResponse.added).to.have.lengthOf(1); + expect(jsonResponse.added).to.include('/valid/file.ts'); + expect(jsonResponse.rejected).to.have.lengthOf(1); + expect(jsonResponse.rejected[0].file).to.equal('/nonexistent/file.ts'); + expect(jsonResponse.rejected[0].reason).to.equal('File does not exist'); + expect(jsonResponse.rejected[0].state).to.equal(FileValidationState.INVALID_NOT_FOUND); + expect(jsonResponse.summary.totalRequested).to.equal(2); + expect(jsonResponse.summary.added).to.equal(1); + expect(jsonResponse.summary.rejected).to.equal(1); + expect(addedFiles).to.have.lengthOf(1); + }); + + it('should reject files in secondary workspace roots', async () => { + const mockValidationService: ContextFileValidationService = { + validateFile: async file => { + if (file === '/secondary/root/file.ts') { + return { + state: FileValidationState.INVALID_SECONDARY, + message: 'File is in a secondary workspace root. AI agents can only access files in the first workspace root.' + }; + } + return { state: FileValidationState.VALID }; + } + }; + + const addFileToChatContext = new AddFileToChatContext(); + (addFileToChatContext as unknown as { validationService: ContextFileValidationService }).validationService = mockValidationService; + + const result = await addFileToChatContext.getTool().handler( + '{"filesToAdd":["/secondary/root/file.ts"]}', + mockCtx + ); + + if (typeof result !== 'string') { + fail(`Wrong tool call result type: ${result}`); + } + + const jsonResponse = JSON.parse(result); + expect(jsonResponse.added).to.have.lengthOf(0); + expect(jsonResponse.rejected).to.have.lengthOf(1); + expect(jsonResponse.rejected[0].file).to.equal('/secondary/root/file.ts'); + expect(jsonResponse.rejected[0].state).to.equal(FileValidationState.INVALID_SECONDARY); + expect(addedFiles).to.have.lengthOf(0); + }); + + it('should add all files when validation service is not available', async () => { + const addFileToChatContext = new AddFileToChatContext(); + + const result = await addFileToChatContext.getTool().handler( + '{"filesToAdd":["/file1.ts","/file2.ts"]}', + mockCtx + ); + + if (typeof result !== 'string') { + fail(`Wrong tool call result type: ${result}`); + } + + const jsonResponse = JSON.parse(result); + expect(jsonResponse.added).to.have.lengthOf(2); + expect(jsonResponse.rejected).to.have.lengthOf(0); + expect(jsonResponse.summary.totalRequested).to.equal(2); + expect(jsonResponse.summary.added).to.equal(2); + expect(jsonResponse.summary.rejected).to.equal(0); + expect(addedFiles).to.have.lengthOf(2); + }); +}); diff --git a/packages/ai-ide/src/browser/context-functions.ts b/packages/ai-ide/src/browser/context-functions.ts new file mode 100644 index 0000000..2236fd7 --- /dev/null +++ b/packages/ai-ide/src/browser/context-functions.ts @@ -0,0 +1,165 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { assertChatContext } from '@theia/ai-chat'; +import { ToolInvocationContext, ToolProvider, ToolRequest } from '@theia/ai-core'; +import { inject, injectable, optional } from '@theia/core/shared/inversify'; +import { LIST_CHAT_CONTEXT_FUNCTION_ID, RESOLVE_CHAT_CONTEXT_FUNCTION_ID, UPDATE_CONTEXT_FILES_FUNCTION_ID } from '../common/context-functions'; +import { FILE_VARIABLE } from '@theia/ai-core/lib/browser/file-variable-contribution'; +import { ContextFileValidationService, FileValidationState } from '@theia/ai-chat/lib/browser/context-file-validation-service'; + +@injectable() +export class ListChatContext implements ToolProvider { + static ID = LIST_CHAT_CONTEXT_FUNCTION_ID; + + getTool(): ToolRequest { + return { + id: ListChatContext.ID, + name: ListChatContext.ID, + description: 'Returns the list of context elements (such as files) specified by the user manually as part of the chat request.', + handler: async (_: string, ctx?: ToolInvocationContext): Promise => { + assertChatContext(ctx); + if (ctx.cancellationToken?.isCancellationRequested) { + return JSON.stringify({ error: 'Operation cancelled by user' }); + } + const result = ctx.request.context.variables.map(contextElement => ({ + id: contextElement.variable.id + contextElement.arg, + type: contextElement.variable.name + })); + return JSON.stringify(result, undefined, 2); + }, + parameters: { + type: 'object', + properties: {} + }, + }; + } +} + +@injectable() +export class ResolveChatContext implements ToolProvider { + static ID = RESOLVE_CHAT_CONTEXT_FUNCTION_ID; + + getTool(): ToolRequest { + return { + id: ResolveChatContext.ID, + name: ResolveChatContext.ID, + description: 'Returns the content of a specific context element (such as files) specified by the user manually as part of the chat request.', + parameters: { + type: 'object', + properties: { + contextElementId: { + type: 'string', + description: 'The id of the context element to resolve.' + } + }, + required: ['contextElementId'] + }, + handler: async (args: string, ctx?: ToolInvocationContext): Promise => { + assertChatContext(ctx); + if (ctx.cancellationToken?.isCancellationRequested) { + return JSON.stringify({ error: 'Operation cancelled by user' }); + } + + const { contextElementId } = JSON.parse(args) as { contextElementId: string }; + const variable = ctx.request.context.variables.find(contextElement => contextElement.variable.id + contextElement.arg === contextElementId); + if (variable) { + const result = { + type: variable.variable.name, + ref: variable.value, + content: variable.contextValue + }; + return JSON.stringify(result, undefined, 2); + } + return JSON.stringify({ error: 'Context element not found' }, undefined, 2); + } + }; + } +} + +@injectable() +export class AddFileToChatContext implements ToolProvider { + static ID = UPDATE_CONTEXT_FILES_FUNCTION_ID; + + @inject(ContextFileValidationService) @optional() + protected readonly validationService: ContextFileValidationService | undefined; + + getTool(): ToolRequest { + return { + id: AddFileToChatContext.ID, + name: AddFileToChatContext.ID, + parameters: { + type: 'object', + properties: { + filesToAdd: { + type: 'array', + description: 'Array of relative file paths to bookmark (e.g., ["src/index.ts", "package.json"]). Paths are relative to the workspace root.', + items: { type: 'string' } + } + }, + required: ['filesToAdd'] + }, + description: 'Adds one or more files to the context of the current chat session for future reference. ' + + 'Use this to bookmark important files that you\'ll need to reference multiple times during the conversation - ' + + 'this is more efficient than re-reading files repeatedly. ' + + 'Only files that exist within the workspace boundaries will be added. ' + + 'Files outside the workspace or non-existent files will be rejected. ' + + 'Returns a detailed status for each file, including which were successfully added and which were rejected with reasons. ' + + 'Note: Adding a file to context does NOT read its contents - use getFileContent to read the actual content.', + handler: async (arg: string, ctx?: ToolInvocationContext): Promise => { + assertChatContext(ctx); + if (ctx.cancellationToken?.isCancellationRequested) { + return JSON.stringify({ error: 'Operation cancelled by user' }); + } + + const { filesToAdd } = JSON.parse(arg) as { filesToAdd: string[] }; + + const added: string[] = []; + const rejected: Array<{ file: string; reason: string; state: string }> = []; + + for (const file of filesToAdd) { + if (this.validationService) { + const validationResult = await this.validationService.validateFile(file); + + if (validationResult.state === FileValidationState.VALID) { + ctx.request.session.context.addVariables({ arg: file, variable: FILE_VARIABLE }); + added.push(file); + } else { + rejected.push({ + file, + reason: validationResult.message || 'File validation failed', + state: validationResult.state + }); + } + } else { + ctx.request.session.context.addVariables({ arg: file, variable: FILE_VARIABLE }); + added.push(file); + } + } + + return JSON.stringify({ + added, + rejected, + summary: { + totalRequested: filesToAdd.length, + added: added.length, + rejected: rejected.length + } + }); + } + }; + } +} diff --git a/packages/ai-ide/src/browser/coolify-deployment-provider.ts b/packages/ai-ide/src/browser/coolify-deployment-provider.ts new file mode 100644 index 0000000..fdf5b2e --- /dev/null +++ b/packages/ai-ide/src/browser/coolify-deployment-provider.ts @@ -0,0 +1,584 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { ToolInvocationContext, ToolProvider, ToolRequest } from '@theia/ai-core'; +import { CancellationToken } from '@theia/core'; +import { injectable, inject } from '@theia/core/shared/inversify'; +import { PreferenceService } from '@theia/core/lib/common/preferences/preference-service'; +import { + COOLIFY_LIST_PROJECTS_FUNCTION_ID, + COOLIFY_LIST_APPLICATIONS_FUNCTION_ID, + COOLIFY_CREATE_APPLICATION_FUNCTION_ID, + COOLIFY_DEPLOY_APPLICATION_FUNCTION_ID, + COOLIFY_GET_DEPLOYMENT_LOGS_FUNCTION_ID, + COOLIFY_GET_APPLICATION_STATUS_FUNCTION_ID +} from '../common/workspace-functions'; +import { COOLIFY_API_URL_PREF, COOLIFY_API_TOKEN_PREF } from '../common/workspace-preferences'; + +interface CoolifyProject { + uuid: string; + name: string; + description?: string; +} + +interface CoolifyApplication { + uuid: string; + name: string; + description?: string; + git_repository?: string; + git_branch?: string; + status?: string; +} + +@injectable() +export class CoolifyListProjectsProvider implements ToolProvider { + + @inject(PreferenceService) + protected readonly preferenceService: PreferenceService; + + getTool(): ToolRequest { + return { + id: COOLIFY_LIST_PROJECTS_FUNCTION_ID, + name: COOLIFY_LIST_PROJECTS_FUNCTION_ID, + description: 'Lists all projects in your Coolify instance. Projects are organizational containers for applications, databases, and services. ' + + 'Use this to discover existing projects or to get project UUIDs needed for other Coolify operations. ' + + 'Returns an array of projects with their UUIDs, names, and descriptions.', + parameters: { + type: 'object', + properties: {}, + required: [] + }, + handler: (argString, ctx?: ToolInvocationContext) => this.handleListProjects(ctx?.cancellationToken) + }; + } + + private async handleListProjects(cancellationToken?: CancellationToken): Promise { + const { apiUrl, apiToken } = await this.getCoolifyConfig(); + + try { + const response = await fetch(`${apiUrl}/api/v1/projects`, { + method: 'GET', + headers: { + 'Authorization': `Bearer ${apiToken}`, + 'Accept': 'application/json' + } + }); + + if (!response.ok) { + return `Error: Failed to fetch projects (${response.status} ${response.statusText})`; + } + + const projects: CoolifyProject[] = await response.json(); + + if (projects.length === 0) { + return 'No projects found. Create your first project in Coolify to get started.'; + } + + const projectList = projects.map(p => + `- ${p.name} (UUID: ${p.uuid})${p.description ? `\n Description: ${p.description}` : ''}` + ).join('\n'); + + return `Found ${projects.length} project(s):\n\n${projectList}`; + } catch (error) { + return `Error: ${error instanceof Error ? error.message : 'Unknown error occurred'}`; + } + } + + private async getCoolifyConfig(): Promise<{ apiUrl: string; apiToken: string }> { + const apiUrl = this.preferenceService.get(COOLIFY_API_URL_PREF, ''); + const apiToken = this.preferenceService.get(COOLIFY_API_TOKEN_PREF, ''); + + if (!apiUrl || !apiToken) { + throw new Error('Coolify API URL and Token must be configured in preferences'); + } + + return { apiUrl, apiToken }; + } +} + +@injectable() +export class CoolifyListApplicationsProvider implements ToolProvider { + + @inject(PreferenceService) + protected readonly preferenceService: PreferenceService; + + getTool(): ToolRequest { + return { + id: COOLIFY_LIST_APPLICATIONS_FUNCTION_ID, + name: COOLIFY_LIST_APPLICATIONS_FUNCTION_ID, + description: 'Lists all applications within a specific Coolify project. Applications are deployable services like web apps, APIs, or backend services. ' + + 'Requires a project UUID (get it from coolify_listProjects first). ' + + 'Returns application details including name, UUID, git repository, branch, and current status.', + parameters: { + type: 'object', + properties: { + projectUuid: { + type: 'string', + description: 'The UUID of the Coolify project to list applications from. Get this from coolify_listProjects.' + } + }, + required: ['projectUuid'] + }, + handler: (argString, ctx?: ToolInvocationContext) => this.handleListApplications(argString, ctx?.cancellationToken) + }; + } + + private async handleListApplications(argString: string, cancellationToken?: CancellationToken): Promise { + const args = JSON.parse(argString); + const { projectUuid } = args; + + const { apiUrl, apiToken } = await this.getCoolifyConfig(); + + try { + // List all applications and filter by project + const response = await fetch(`${apiUrl}/api/v1/applications`, { + method: 'GET', + headers: { + 'Authorization': `Bearer ${apiToken}`, + 'Accept': 'application/json' + } + }); + + if (!response.ok) { + return `Error: Failed to fetch applications (${response.status} ${response.statusText})`; + } + + const allApplications: CoolifyApplication[] = await response.json(); + // Filter by project UUID if needed (Coolify returns all apps) + const applications = projectUuid ? + allApplications.filter((app: any) => app.project_uuid === projectUuid) : + allApplications; + + if (applications.length === 0) { + return `No applications found in project ${projectUuid}. Create your first application in Coolify.`; + } + + const appList = applications.map(app => + `- ${app.name} (UUID: ${app.uuid})\n` + + ` Status: ${app.status || 'unknown'}\n` + + ` ${app.git_repository ? `Repository: ${app.git_repository}` : ''}\n` + + ` ${app.git_branch ? `Branch: ${app.git_branch}` : ''}` + ).join('\n'); + + return `Found ${applications.length} application(s):\n\n${appList}`; + } catch (error) { + return `Error: ${error instanceof Error ? error.message : 'Unknown error occurred'}`; + } + } + + private async getCoolifyConfig(): Promise<{ apiUrl: string; apiToken: string }> { + const apiUrl = this.preferenceService.get(COOLIFY_API_URL_PREF, ''); + const apiToken = this.preferenceService.get(COOLIFY_API_TOKEN_PREF, ''); + + if (!apiUrl || !apiToken) { + throw new Error('Coolify API URL and Token must be configured in preferences'); + } + + return { apiUrl, apiToken }; + } +} + +@injectable() +export class CoolifyCreateApplicationProvider implements ToolProvider { + + @inject(PreferenceService) + protected readonly preferenceService: PreferenceService; + + getTool(): ToolRequest { + return { + id: COOLIFY_CREATE_APPLICATION_FUNCTION_ID, + name: COOLIFY_CREATE_APPLICATION_FUNCTION_ID, + description: 'Creates a new application in Coolify from a Git repository. ' + + 'This sets up the application configuration but does NOT deploy it yet - use coolify_deployApplication after creation. ' + + 'Supports both public and private Git repositories (Gitea, GitHub, GitLab, etc.). ' + + 'Returns the application UUID which you can use for deployment and monitoring.', + parameters: { + type: 'object', + properties: { + projectUuid: { + type: 'string', + description: 'The UUID of the Coolify project to create the application in. Get this from coolify_listProjects.' + }, + name: { + type: 'string', + description: 'A human-readable name for the application (e.g., "my-web-app", "api-server").' + }, + gitRepository: { + type: 'string', + description: 'The Git repository URL. For Gitea: https://git.vibnai.com/username/repo-name.git' + }, + gitBranch: { + type: 'string', + description: 'The Git branch to deploy from. Default: "main"' + }, + buildPack: { + type: 'string', + description: 'Build pack to use. Options: "nixpacks" (auto-detects Node.js, Python, etc.), "dockerfile" (uses Dockerfile), "static" (static HTML/JS). Default: "nixpacks"' + }, + portsExposes: { + type: 'string', + description: 'The port(s) the application exposes (e.g., "3000", "8080", "3000,8080"). Required for web apps.' + }, + fqdn: { + type: 'string', + description: 'The fully qualified domain name for the application (e.g., "my-app.vibnai.com"). This will be the live URL for your app with automatic SSL.' + }, + environmentName: { + type: 'string', + description: 'The environment name within the project. Default: "production"' + }, + instantDeploy: { + type: 'boolean', + description: 'If true, automatically triggers deployment after creating the application. Default: false' + } + }, + required: ['projectUuid', 'name', 'gitRepository', 'portsExposes', 'fqdn'] + }, + handler: (argString, ctx?: ToolInvocationContext) => this.handleCreateApplication(argString, ctx?.cancellationToken) + }; + } + + private async handleCreateApplication(argString: string, cancellationToken?: CancellationToken): Promise { + const args = JSON.parse(argString); + const { + projectUuid, + name, + gitRepository, + gitBranch = 'main', + buildPack = 'nixpacks', + portsExposes, + fqdn, + environmentName = 'production', + instantDeploy = false + } = args; + + const { apiUrl, apiToken } = await this.getCoolifyConfig(); + + try { + // Get the localhost server UUID (where Coolify deploys apps) + const serversResponse = await fetch(`${apiUrl}/api/v1/servers`, { + headers: { + 'Authorization': `Bearer ${apiToken}`, + 'Accept': 'application/json' + } + }); + + if (!serversResponse.ok) { + return `Error: Failed to fetch servers (${serversResponse.status})`; + } + + const servers = await serversResponse.json(); + const localhostServer = servers.find((s: any) => s.is_coolify_host === true); + + if (!localhostServer) { + return 'Error: Could not find Coolify host server'; + } + + const payload: Record = { + project_uuid: projectUuid, + environment_name: environmentName, + server_uuid: localhostServer.uuid, + name, + git_repository: gitRepository, + git_branch: gitBranch, + build_pack: buildPack, + ports_exposes: portsExposes, + domains: `https://${fqdn}`, // Coolify expects full URL with protocol + instant_deploy: instantDeploy + }; + + const response = await fetch(`${apiUrl}/api/v1/applications/public`, { + method: 'POST', + headers: { + 'Authorization': `Bearer ${apiToken}`, + 'Content-Type': 'application/json', + 'Accept': 'application/json' + }, + body: JSON.stringify(payload) + }); + + if (!response.ok) { + const errorText = await response.text(); + return `Error: Failed to create application (${response.status} ${response.statusText})\n${errorText}`; + } + + const result = await response.json(); + + return `✅ Application created successfully!\n` + + `Name: ${name}\n` + + `UUID: ${result.uuid || result.application_uuid || 'N/A'}\n` + + `URL: https://${fqdn}\n` + + `Repository: ${gitRepository}\n` + + `Branch: ${gitBranch}\n` + + `${instantDeploy ? 'Deployment initiated automatically. Your app will be live at the URL above once deployment completes.' : 'Use coolify_deployApplication to deploy when ready.'}`; + } catch (error) { + return `Error: ${error instanceof Error ? error.message : 'Unknown error occurred'}`; + } + } + + private async getCoolifyConfig(): Promise<{ apiUrl: string; apiToken: string }> { + const apiUrl = this.preferenceService.get(COOLIFY_API_URL_PREF, ''); + const apiToken = this.preferenceService.get(COOLIFY_API_TOKEN_PREF, ''); + + if (!apiUrl || !apiToken) { + throw new Error('Coolify API URL and Token must be configured in preferences'); + } + + return { apiUrl, apiToken }; + } +} + +@injectable() +export class CoolifyDeployApplicationProvider implements ToolProvider { + + @inject(PreferenceService) + protected readonly preferenceService: PreferenceService; + + getTool(): ToolRequest { + return { + id: COOLIFY_DEPLOY_APPLICATION_FUNCTION_ID, + name: COOLIFY_DEPLOY_APPLICATION_FUNCTION_ID, + description: 'Triggers a deployment for a specific application in Coolify. This will pull the latest code from git, build, and deploy the application. ' + + 'Requires the application UUID (get from coolify_listApplications). ' + + 'Optionally specify a git commit SHA or tag to deploy a specific version. ' + + 'Returns the deployment UUID which can be used to check logs and status.', + parameters: { + type: 'object', + properties: { + applicationUuid: { + type: 'string', + description: 'The UUID of the application to deploy. Get this from coolify_listApplications.' + }, + gitCommitSha: { + type: 'string', + description: 'Optional: Specific git commit SHA or tag to deploy. If not provided, deploys the latest commit from the configured branch.' + }, + forceRebuild: { + type: 'boolean', + description: 'Optional: Force a complete rebuild even if the code hasn\'t changed. Default: false.' + } + }, + required: ['applicationUuid'] + }, + handler: (argString, ctx?: ToolInvocationContext) => this.handleDeploy(argString, ctx?.cancellationToken) + }; + } + + private async handleDeploy(argString: string, cancellationToken?: CancellationToken): Promise { + const args = JSON.parse(argString); + const { applicationUuid, gitCommitSha, forceRebuild } = args; + + const { apiUrl, apiToken } = await this.getCoolifyConfig(); + + try { + const body: Record = {}; + if (gitCommitSha) { + body.git_commit_sha = gitCommitSha; + } + if (forceRebuild) { + body.force_rebuild = true; + } + + const response = await fetch(`${apiUrl}/api/v1/applications/${applicationUuid}/deploy`, { + method: 'POST', + headers: { + 'Authorization': `Bearer ${apiToken}`, + 'Content-Type': 'application/json', + 'Accept': 'application/json' + }, + body: JSON.stringify(body) + }); + + if (!response.ok) { + const errorText = await response.text(); + return `Error: Deployment failed (${response.status} ${response.statusText})\n${errorText}`; + } + + const result = await response.json(); + + return `✅ Deployment initiated successfully!\n` + + `Deployment UUID: ${result.deployment_uuid || 'N/A'}\n` + + `Application: ${applicationUuid}\n` + + `${gitCommitSha ? `Commit: ${gitCommitSha}\n` : ''}` + + `Use coolify_getDeploymentLogs to monitor progress.`; + } catch (error) { + return `Error: ${error instanceof Error ? error.message : 'Unknown error occurred'}`; + } + } + + private async getCoolifyConfig(): Promise<{ apiUrl: string; apiToken: string }> { + const apiUrl = this.preferenceService.get(COOLIFY_API_URL_PREF, ''); + const apiToken = this.preferenceService.get(COOLIFY_API_TOKEN_PREF, ''); + + if (!apiUrl || !apiToken) { + throw new Error('Coolify API URL and Token must be configured in preferences'); + } + + return { apiUrl, apiToken }; + } +} + +@injectable() +export class CoolifyGetDeploymentLogsProvider implements ToolProvider { + + @inject(PreferenceService) + protected readonly preferenceService: PreferenceService; + + getTool(): ToolRequest { + return { + id: COOLIFY_GET_DEPLOYMENT_LOGS_FUNCTION_ID, + name: COOLIFY_GET_DEPLOYMENT_LOGS_FUNCTION_ID, + description: 'Retrieves real-time deployment logs for a specific application deployment in Coolify. ' + + 'Use this to monitor deployment progress, debug build failures, or verify successful deployments. ' + + 'Requires the application UUID. Returns the most recent deployment logs.', + parameters: { + type: 'object', + properties: { + applicationUuid: { + type: 'string', + description: 'The UUID of the application to get logs for.' + }, + limit: { + type: 'number', + description: 'Optional: Maximum number of log lines to return. Default: 100.' + } + }, + required: ['applicationUuid'] + }, + handler: (argString, ctx?: ToolInvocationContext) => this.handleGetLogs(argString, ctx?.cancellationToken) + }; + } + + private async handleGetLogs(argString: string, cancellationToken?: CancellationToken): Promise { + const args = JSON.parse(argString); + const { applicationUuid, limit = 100 } = args; + + const { apiUrl, apiToken } = await this.getCoolifyConfig(); + + try { + const response = await fetch(`${apiUrl}/api/v1/applications/${applicationUuid}/logs?limit=${limit}`, { + method: 'GET', + headers: { + 'Authorization': `Bearer ${apiToken}`, + 'Accept': 'application/json' + } + }); + + if (!response.ok) { + return `Error: Failed to fetch logs (${response.status} ${response.statusText})`; + } + + const logs = await response.text(); + + if (!logs || logs.trim().length === 0) { + return `No logs available yet for application ${applicationUuid}. The deployment may not have started.`; + } + + return `Deployment logs for ${applicationUuid}:\n\n${logs}`; + } catch (error) { + return `Error: ${error instanceof Error ? error.message : 'Unknown error occurred'}`; + } + } + + private async getCoolifyConfig(): Promise<{ apiUrl: string; apiToken: string }> { + const apiUrl = this.preferenceService.get(COOLIFY_API_URL_PREF, ''); + const apiToken = this.preferenceService.get(COOLIFY_API_TOKEN_PREF, ''); + + if (!apiUrl || !apiToken) { + throw new Error('Coolify API URL and Token must be configured in preferences'); + } + + return { apiUrl, apiToken }; + } +} + +@injectable() +export class CoolifyGetApplicationStatusProvider implements ToolProvider { + + @inject(PreferenceService) + protected readonly preferenceService: PreferenceService; + + getTool(): ToolRequest { + return { + id: COOLIFY_GET_APPLICATION_STATUS_FUNCTION_ID, + name: COOLIFY_GET_APPLICATION_STATUS_FUNCTION_ID, + description: 'Gets the current status of a Coolify application including running state, health checks, resource usage, and deployment history. ' + + 'Use this to verify if an application is running correctly or to troubleshoot issues. ' + + 'Returns detailed status information including container state, URL, and recent deployments.', + parameters: { + type: 'object', + properties: { + applicationUuid: { + type: 'string', + description: 'The UUID of the application to check status for.' + } + }, + required: ['applicationUuid'] + }, + handler: (argString, ctx?: ToolInvocationContext) => this.handleGetStatus(argString, ctx?.cancellationToken) + }; + } + + private async handleGetStatus(argString: string, cancellationToken?: CancellationToken): Promise { + const args = JSON.parse(argString); + const { applicationUuid } = args; + + const { apiUrl, apiToken } = await this.getCoolifyConfig(); + + try { + const response = await fetch(`${apiUrl}/api/v1/applications/${applicationUuid}`, { + method: 'GET', + headers: { + 'Authorization': `Bearer ${apiToken}`, + 'Accept': 'application/json' + } + }); + + if (!response.ok) { + return `Error: Failed to fetch application status (${response.status} ${response.statusText})`; + } + + const app: any = await response.json(); + + const statusInfo = [ + `Application: ${app.name}`, + `UUID: ${app.uuid}`, + `Status: ${app.status || 'unknown'}`, + `${app.fqdn ? `URL: ${app.fqdn}` : 'URL: Not configured'}`, + `${app.git_repository ? `Repository: ${app.git_repository}` : ''}`, + `${app.git_branch ? `Branch: ${app.git_branch}` : ''}`, + `${app.git_commit_sha ? `Latest Commit: ${app.git_commit_sha.substring(0, 7)}` : ''}`, + `Created: ${app.created_at || 'N/A'}`, + `Updated: ${app.updated_at || 'N/A'}` + ].filter(line => line && !line.endsWith(': ')).join('\n'); + + return statusInfo; + } catch (error) { + return `Error: ${error instanceof Error ? error.message : 'Unknown error occurred'}`; + } + } + + private async getCoolifyConfig(): Promise<{ apiUrl: string; apiToken: string }> { + const apiUrl = this.preferenceService.get(COOLIFY_API_URL_PREF, ''); + const apiToken = this.preferenceService.get(COOLIFY_API_TOKEN_PREF, ''); + + if (!apiUrl || !apiToken) { + throw new Error('Coolify API URL and Token must be configured in preferences'); + } + + return { apiUrl, apiToken }; + } +} diff --git a/packages/ai-ide/src/browser/create-skill-agent.ts b/packages/ai-ide/src/browser/create-skill-agent.ts new file mode 100644 index 0000000..f451d0d --- /dev/null +++ b/packages/ai-ide/src/browser/create-skill-agent.ts @@ -0,0 +1,59 @@ +// ***************************************************************************** +// Copyright (C) 2026 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** +import { ChatMode } from '@theia/ai-chat'; +import { LanguageModelRequirement } from '@theia/ai-core'; +import { injectable } from '@theia/core/shared/inversify'; +import { + createSkillSystemVariants, + CREATE_SKILL_SYSTEM_PROMPT_TEMPLATE_ID, + CREATE_SKILL_SYSTEM_DEFAULT_TEMPLATE_ID, + CREATE_SKILL_SYSTEM_AGENT_MODE_TEMPLATE_ID, +} from '../common/create-skill-prompt-template'; +import { AbstractModeAwareChatAgent } from './mode-aware-chat-agent'; +import { nls } from '@theia/core'; + +@injectable() +export class CreateSkillAgent extends AbstractModeAwareChatAgent { + + name = 'CreateSkill'; + id = 'CreateSkill'; + languageModelRequirements: LanguageModelRequirement[] = [{ + purpose: 'chat', + identifier: 'default/universal', + }]; + protected defaultLanguageModelPurpose: string = 'chat'; + + override description = nls.localize('theia/ai/workspace/createSkillAgent/description', + 'An AI assistant for creating new skills. Skills provide reusable instructions and domain knowledge for AI agents. ' + + 'This agent helps you create well-structured skills in the .prompts/skills directory with proper YAML frontmatter and markdown content.'); + + override tags: string[] = [...this.tags, 'Alpha']; + + protected readonly modeDefinitions: Omit[] = [ + { + id: CREATE_SKILL_SYSTEM_DEFAULT_TEMPLATE_ID, + name: nls.localize('theia/ai/ide/createSkillAgent/mode/edit', 'Default Mode') + }, + { + id: CREATE_SKILL_SYSTEM_AGENT_MODE_TEMPLATE_ID, + name: nls.localizeByDefault('Agent Mode') + } + ]; + + override prompts = [createSkillSystemVariants]; + protected override systemPromptId: string | undefined = CREATE_SKILL_SYSTEM_PROMPT_TEMPLATE_ID; + +} diff --git a/packages/ai-ide/src/browser/default-chat-agent-recommendation-service.ts b/packages/ai-ide/src/browser/default-chat-agent-recommendation-service.ts new file mode 100644 index 0000000..ebcc4e7 --- /dev/null +++ b/packages/ai-ide/src/browser/default-chat-agent-recommendation-service.ts @@ -0,0 +1,43 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { injectable } from '@theia/core/shared/inversify'; +import { ChatAgentRecommendationService, RecommendedAgent } from '@theia/ai-chat/lib/common'; +import { nls } from '@theia/core/lib/common/nls'; + +@injectable() +export class DefaultChatAgentRecommendationService implements ChatAgentRecommendationService { + + getRecommendedAgents(): RecommendedAgent[] { + return [ + { + id: 'Coder', + label: nls.localize('theia/ai/chat/agent/coder', 'Coder'), + description: nls.localize('theia/ai/chat/agent/coder/description', 'Code generation and modification') + }, + { + id: 'Architect', + label: nls.localize('theia/ai/chat/agent/architect', 'Architect'), + description: nls.localize('theia/ai/chat/agent/architect/description', 'High-level design and architecture') + }, + { + id: 'Universal', + label: nls.localize('theia/ai/chat/agent/universal', 'Universal'), + description: nls.localize('theia/ai/chat/agent/universal/description', 'General-purpose assistant') + } + ]; + } +} diff --git a/packages/ai-ide/src/browser/file-changeset-function.spec.ts b/packages/ai-ide/src/browser/file-changeset-function.spec.ts new file mode 100644 index 0000000..6fd58fb --- /dev/null +++ b/packages/ai-ide/src/browser/file-changeset-function.spec.ts @@ -0,0 +1,55 @@ +// ***************************************************************************** +// Copyright (C) 2025 Lonti.com Pty Ltd. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { FrontendApplicationConfigProvider } from '@theia/core/lib/browser/frontend-application-config-provider'; +import { enableJSDOM } from '@theia/core/lib/browser/test/jsdom'; +let disableJSDOM = enableJSDOM(); +FrontendApplicationConfigProvider.set({}); + +import { ChatToolContext, MutableChatRequestModel, MutableChatResponseModel } from '@theia/ai-chat'; +import { Container } from '@theia/core/shared/inversify'; +import { expect } from 'chai'; +import { DefaultFileChangeSetTitleProvider } from './file-changeset-functions'; + +disableJSDOM(); + +describe('DefaultFileChangeSetTitleProvider', () => { + let provider: DefaultFileChangeSetTitleProvider; + + before(() => { + const container = new Container(); + container.bind(DefaultFileChangeSetTitleProvider).toSelf(); + + provider = container.get(DefaultFileChangeSetTitleProvider); + disableJSDOM = enableJSDOM(); + }); + + after(() => { + disableJSDOM(); + }); + + it('should provide the title', () => { + const ctx: ChatToolContext = { + request: { + agentId: 'test-agent', + } as MutableChatRequestModel, + response: {} as MutableChatResponseModel + }; + + const title = provider.getChangeSetTitle(ctx); + expect(title).to.equal('Changes proposed'); + }); +}); diff --git a/packages/ai-ide/src/browser/file-changeset-functions.spec.ts b/packages/ai-ide/src/browser/file-changeset-functions.spec.ts new file mode 100644 index 0000000..c79e5eb --- /dev/null +++ b/packages/ai-ide/src/browser/file-changeset-functions.spec.ts @@ -0,0 +1,267 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { enableJSDOM } from '@theia/core/lib/browser/test/jsdom'; +let disableJSDOM = enableJSDOM(); +import { FrontendApplicationConfigProvider } from '@theia/core/lib/browser/frontend-application-config-provider'; +FrontendApplicationConfigProvider.set({}); + +import { expect } from 'chai'; +import { CancellationTokenSource } from '@theia/core'; +import { + SuggestFileContent, + WriteFileContent, + SuggestFileReplacements, + SuggestFileReplacements_Simple, + WriteFileReplacements, + WriteFileReplacements_Simple, + ClearFileChanges, + GetProposedFileState, + ReplaceContentInFileFunctionHelper, + FileChangeSetTitleProvider, + DefaultFileChangeSetTitleProvider, + ReplaceContentInFileFunctionHelperV2 +} from './file-changeset-functions'; +import { ChatToolContext, MutableChatRequestModel, MutableChatResponseModel, MutableChatModel } from '@theia/ai-chat'; +import { ChangeSet, ChangeSetElement } from '@theia/ai-chat/lib/common/change-set'; +import { Container } from '@theia/core/shared/inversify'; +import { WorkspaceFunctionScope } from './workspace-functions'; +import { FileService } from '@theia/filesystem/lib/browser/file-service'; +import { ChangeSetFileElementFactory, ChangeSetFileElement } from '@theia/ai-chat/lib/browser/change-set-file-element'; +import { URI } from '@theia/core/lib/common/uri'; + +disableJSDOM(); + +describe('File Changeset Functions Cancellation Tests', () => { + let cancellationTokenSource: CancellationTokenSource; + let mockCtx: ChatToolContext; + let container: Container; + before(() => { + disableJSDOM = enableJSDOM(); + }); + after(() => { + // Disable JSDOM after all tests + disableJSDOM(); + }); + beforeEach(() => { + cancellationTokenSource = new CancellationTokenSource(); + + // Create a mock change set that doesn't do anything + const mockChangeSet: Partial = { + addElements: (...elements: ChangeSetElement[]) => true, + setTitle: () => { }, + removeElements: () => true, + getElementByURI: () => undefined + }; + + // Setup mock context + const mockRequest = { + id: 'test-request-id', + session: { + id: 'test-session-id', + changeSet: mockChangeSet as ChangeSet + } as MutableChatModel + } as MutableChatRequestModel; + mockCtx = { + cancellationToken: cancellationTokenSource.token, + request: mockRequest, + response: {} as MutableChatResponseModel + }; + + // Create a new container for each test + container = new Container(); + + // Mock dependencies + const mockWorkspaceScope = { + resolveRelativePath: async () => new URI('file:///workspace/test.txt') + } as unknown as WorkspaceFunctionScope; + + const mockFileService = { + exists: async () => true, + read: async () => ({ value: { toString: () => 'test content' } }) + } as unknown as FileService; + + const mockFileChangeFactory: ChangeSetFileElementFactory = () => ({ + uri: new URI('file:///workspace/test.txt'), + type: 'modify', + state: 'pending', + targetState: 'new content', + apply: async () => { }, + } as ChangeSetFileElement); + + // Register mocks in the container + container.bind(WorkspaceFunctionScope).toConstantValue(mockWorkspaceScope); + container.bind(FileService).toConstantValue(mockFileService); + container.bind(ChangeSetFileElementFactory).toConstantValue(mockFileChangeFactory); + container.bind(FileChangeSetTitleProvider).to(DefaultFileChangeSetTitleProvider).inSingletonScope(); + container.bind(ReplaceContentInFileFunctionHelper).toSelf(); + container.bind(SuggestFileContent).toSelf(); + container.bind(WriteFileContent).toSelf(); + container.bind(SuggestFileReplacements_Simple).toSelf(); + container.bind(SuggestFileReplacements).toSelf(); + container.bind(WriteFileReplacements_Simple).toSelf(); + container.bind(WriteFileReplacements).toSelf(); + container.bind(ClearFileChanges).toSelf(); + container.bind(GetProposedFileState).toSelf(); + container.bind(ReplaceContentInFileFunctionHelperV2).toSelf(); + }); + + afterEach(() => { + cancellationTokenSource.dispose(); + }); + + it('SuggestFileContent should respect cancellation token', async () => { + const suggestFileContent = container.get(SuggestFileContent); + cancellationTokenSource.cancel(); + + const handler = suggestFileContent.getTool().handler; + const result = await handler(JSON.stringify({ path: 'test.txt', content: 'test content' }), mockCtx); + + const jsonResponse = typeof result === 'string' ? JSON.parse(result) : result; + expect(jsonResponse.error).to.equal('Operation cancelled by user'); + }); + + it('WriteFileContent should respect cancellation token', async () => { + const writeFileContent = container.get(WriteFileContent); + cancellationTokenSource.cancel(); + + const handler = writeFileContent.getTool().handler; + const result = await handler(JSON.stringify({ path: 'test.txt', content: 'test content' }), mockCtx); + + const jsonResponse = typeof result === 'string' ? JSON.parse(result) : result; + expect(jsonResponse.error).to.equal('Operation cancelled by user'); + }); + + it('SuggestFileReplacements_Simple should respect cancellation token', async () => { + const suggestFileReplacementsSimple = container.get(SuggestFileReplacements_Simple); + cancellationTokenSource.cancel(); + + const handler = suggestFileReplacementsSimple.getTool().handler; + const result = await handler( + JSON.stringify({ + path: 'test.txt', + replacements: [{ oldContent: 'old', newContent: 'new' }] + }), + mockCtx + ); + + const jsonResponse = typeof result === 'string' ? JSON.parse(result) : result; + expect(jsonResponse.error).to.equal('Operation cancelled by user'); + }); + + it('WriteFileReplacements_Simple should respect cancellation token', async () => { + const writeFileReplacementsSimple = container.get(WriteFileReplacements_Simple); + cancellationTokenSource.cancel(); + + const handler = writeFileReplacementsSimple.getTool().handler; + const result = await handler( + JSON.stringify({ + path: 'test.txt', + replacements: [{ oldContent: 'old', newContent: 'new' }] + }), + mockCtx + ); + + const jsonResponse = typeof result === 'string' ? JSON.parse(result) : result; + expect(jsonResponse.error).to.equal('Operation cancelled by user'); + }); + + it('WriteFileReplacements should respect cancellation token with V2 implementation', async () => { + const writeFileReplacements = container.get(WriteFileReplacements); + cancellationTokenSource.cancel(); + + const handler = writeFileReplacements.getTool().handler; + const result = await handler( + JSON.stringify({ + path: 'test.txt', + replacements: [{ oldContent: 'old', newContent: 'new', multiple: true }] + }), + mockCtx + ); + + const jsonResponse = typeof result === 'string' ? JSON.parse(result) : result; + expect(jsonResponse.error).to.equal('Operation cancelled by user'); + }); + + it('WriteFileReplacements should have correct ID', () => { + const writeFileReplacements = container.get(WriteFileReplacements); + expect(WriteFileReplacements.ID).to.equal('writeFileReplacements'); + expect(writeFileReplacements.getTool().id).to.equal('writeFileReplacements'); + }); + + it('ClearFileChanges should respect cancellation token', async () => { + const clearFileChanges = container.get(ClearFileChanges); + cancellationTokenSource.cancel(); + + const handler = clearFileChanges.getTool().handler; + const result = await handler(JSON.stringify({ path: 'test.txt' }), mockCtx); + + const jsonResponse = typeof result === 'string' ? JSON.parse(result) : result; + expect(jsonResponse.error).to.equal('Operation cancelled by user'); + }); + + it('GetProposedFileState should respect cancellation token', async () => { + const getProposedFileState = container.get(GetProposedFileState); + cancellationTokenSource.cancel(); + + const handler = getProposedFileState.getTool().handler; + const result = await handler(JSON.stringify({ path: 'test.txt' }), mockCtx); + + const jsonResponse = typeof result === 'string' ? JSON.parse(result) : result; + expect(jsonResponse.error).to.equal('Operation cancelled by user'); + }); + + it('ReplaceContentInFileFunctionHelper should handle cancellation in common processing', async () => { + const helper = container.get(ReplaceContentInFileFunctionHelper); + cancellationTokenSource.cancel(); + + // Test the underlying helper method through the public methods + + const result = await helper.createChangesetFromToolCall( + JSON.stringify({ + path: 'test.txt', + replacements: [{ oldContent: 'old', newContent: 'new' }] + }), + mockCtx + ); + const jsonResponse = typeof result === 'string' ? JSON.parse(result) : result; + expect(jsonResponse.error).to.equal('Operation cancelled by user'); + + }); + + it('SuggestFileReplacements should respect cancellation token with V2 implementation', async () => { + const suggestFileReplacements = container.get(SuggestFileReplacements); + cancellationTokenSource.cancel(); + + const handler = suggestFileReplacements.getTool().handler; + const result = await handler( + JSON.stringify({ + path: 'test.txt', + replacements: [{ oldContent: 'old', newContent: 'new', multiple: true }] + }), + mockCtx + ); + + const jsonResponse = typeof result === 'string' ? JSON.parse(result) : result; + expect(jsonResponse.error).to.equal('Operation cancelled by user'); + }); + + it('SuggestFileReplacements should have correct ID', () => { + const suggestFileReplacements = container.get(SuggestFileReplacements); + expect(SuggestFileReplacements.ID).to.equal('suggestFileReplacements'); + expect(suggestFileReplacements.getTool().id).to.equal('suggestFileReplacements'); + }); +}); diff --git a/packages/ai-ide/src/browser/file-changeset-functions.ts b/packages/ai-ide/src/browser/file-changeset-functions.ts new file mode 100644 index 0000000..f8b3fe0 --- /dev/null +++ b/packages/ai-ide/src/browser/file-changeset-functions.ts @@ -0,0 +1,697 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** +import { assertChatContext, ChatToolContext } from '@theia/ai-chat'; +import { ChangeSet } from '@theia/ai-chat/lib/common/change-set'; +import { ChangeSetElementArgs, ChangeSetFileElement, ChangeSetFileElementFactory } from '@theia/ai-chat/lib/browser/change-set-file-element'; +import { ToolInvocationContext, ToolProvider, ToolRequest, ToolRequestParameters, ToolRequestParametersProperties } from '@theia/ai-core'; +import { ContentReplacerV1Impl, Replacement, ContentReplacer } from '@theia/core/lib/common/content-replacer'; +import { ContentReplacerV2Impl } from '@theia/core/lib/common/content-replacer-v2-impl'; +import { URI } from '@theia/core/lib/common/uri'; +import { inject, injectable } from '@theia/core/shared/inversify'; +import { FileService } from '@theia/filesystem/lib/browser/file-service'; +import { WorkspaceFunctionScope } from './workspace-functions'; + +import { nls } from '@theia/core'; +import { + CLEAR_FILE_CHANGES_ID, + GET_PROPOSED_CHANGES_ID, + SUGGEST_FILE_CONTENT_ID, + SUGGEST_FILE_REPLACEMENTS_ID, + WRITE_FILE_CONTENT_ID, + WRITE_FILE_REPLACEMENTS_ID, + SUGGEST_FILE_REPLACEMENTS_SIMPLE_ID, + WRITE_FILE_REPLACEMENTS_SIMPLE_ID +} from '../common/file-changeset-function-ids'; + +export const FileChangeSetTitleProvider = Symbol('FileChangeSetTitleProvider'); + +export interface FileChangeSetTitleProvider { + getChangeSetTitle(ctx: ChatToolContext): string; +} + +@injectable() +export class SuggestFileContent implements ToolProvider { + static ID = SUGGEST_FILE_CONTENT_ID; + + @inject(WorkspaceFunctionScope) + protected readonly workspaceFunctionScope: WorkspaceFunctionScope; + + @inject(FileService) + fileService: FileService; + + @inject(ChangeSetFileElementFactory) + protected readonly fileChangeFactory: ChangeSetFileElementFactory; + + @inject(FileChangeSetTitleProvider) + protected readonly fileChangeSetTitleProvider: FileChangeSetTitleProvider; + + getTool(): ToolRequest { + return { + id: SuggestFileContent.ID, + name: SuggestFileContent.ID, + description: `Proposes writing complete content to a file for user review. If the file exists, it will be overwritten with the provided content. + If the file does not exist, it will be created. This tool will automatically create any directories needed to write the file. + If the new content is empty, the file will be deleted. To move a file, delete it and re-create it at the new location. + The proposed changes will be applied when the user accepts. If called again for the same file, previously proposed changes will be overridden. + Use this for creating new files or when you need to rewrite an entire file. + For targeted edits to existing files, prefer suggestFileReplacements instead - it's more efficient and shows clearer diffs.`, + parameters: { + type: 'object', + properties: { + path: { + type: 'string', + description: 'Relative path to the file within the workspace (e.g., "src/index.ts", "config/settings.json").' + }, + content: { + type: 'string', + description: `The COMPLETE content to write to the file. You MUST include ALL parts of the file, even if they haven't been modified. + Do not truncate or omit any sections. Use empty string "" to delete the file.` + } + }, + required: ['path', 'content'] + }, + handler: async (args: string, ctx?: ToolInvocationContext): Promise => { + assertChatContext(ctx); + if (ctx.cancellationToken?.isCancellationRequested) { + return JSON.stringify({ error: 'Operation cancelled by user' }); + } + const { path, content } = JSON.parse(args); + const chatSessionId = ctx.request.session.id; + const uri = await this.workspaceFunctionScope.resolveRelativePath(path); + let type: ChangeSetElementArgs['type'] = 'modify'; + if (content === '') { + type = 'delete'; + } + if (!(await this.fileService.exists(uri))) { + type = 'add'; + } + ctx.request.session.changeSet.addElements( + this.fileChangeFactory({ + uri: uri, + type, + state: 'pending', + targetState: content, + requestId: ctx.request.id, + chatSessionId + }) + ); + + ctx.request.session.changeSet.setTitle(this.fileChangeSetTitleProvider.getChangeSetTitle(ctx)); + return `Proposed writing to file ${path}. The user will review and potentially apply the changes`; + } + }; + } +} + +@injectable() +export class WriteFileContent implements ToolProvider { + static ID = WRITE_FILE_CONTENT_ID; + + @inject(WorkspaceFunctionScope) + protected readonly workspaceFunctionScope: WorkspaceFunctionScope; + + @inject(FileService) + fileService: FileService; + + @inject(ChangeSetFileElementFactory) + protected readonly fileChangeFactory: ChangeSetFileElementFactory; + + @inject(FileChangeSetTitleProvider) + protected readonly fileChangeSetTitleProvider: FileChangeSetTitleProvider; + + getTool(): ToolRequest { + return { + id: WriteFileContent.ID, + name: WriteFileContent.ID, + description: `Immediately writes complete content to a file WITHOUT user confirmation. If the file exists, it will be overwritten. + If the file does not exist, it will be created. This tool will automatically create any directories needed to write the file. + If the new content is empty, the file will be deleted. To move a file, delete it and re-create it at the new location. + Use this for creating new files or complete file rewrites in agent mode. + For targeted edits, prefer writeFileReplacements - it's more efficient and less error-prone. + CAUTION: Changes are applied immediately and cannot be undone through the chat interface.`, + parameters: { + type: 'object', + properties: { + path: { + type: 'string', + description: 'Relative path to the file within the workspace (e.g., "src/index.ts", "config/settings.json").' + }, + content: { + type: 'string', + description: `The COMPLETE content to write to the file. You MUST include ALL parts of the file, even if they haven't been modified. + Do not truncate or omit any sections. Use empty string "" to delete the file.` + } + }, + required: ['path', 'content'] + }, + handler: async (args: string, ctx?: ToolInvocationContext): Promise => { + assertChatContext(ctx); + if (ctx.cancellationToken?.isCancellationRequested) { + return JSON.stringify({ error: 'Operation cancelled by user' }); + } + const { path, content } = JSON.parse(args); + const chatSessionId = ctx.request.session.id; + const uri = await this.workspaceFunctionScope.resolveRelativePath(path); + let type = 'modify'; + if (content === '') { + type = 'delete'; + } + if (!(await this.fileService.exists(uri))) { + type = 'add'; + } + + const fileElement = this.fileChangeFactory({ + uri: uri, + type: type as 'modify' | 'add' | 'delete', + state: 'pending', + targetState: content, + requestId: ctx.request.id, + chatSessionId + }); + + ctx.request.session.changeSet.setTitle(this.fileChangeSetTitleProvider.getChangeSetTitle(ctx)); + ctx.request.session.changeSet.addElements(fileElement); + + try { + await fileElement.apply(); + return `Successfully wrote content to file ${path}.`; + } catch (error) { + return `Failed to write content to file ${path}: ${error.message}`; + } + } + }; + } +} + +@injectable() +export class ReplaceContentInFileFunctionHelper { + @inject(WorkspaceFunctionScope) + protected readonly workspaceFunctionScope: WorkspaceFunctionScope; + + @inject(FileService) + fileService: FileService; + + @inject(ChangeSetFileElementFactory) + protected readonly fileChangeFactory: ChangeSetFileElementFactory; + + @inject(FileChangeSetTitleProvider) + protected readonly fileChangeSetTitleProvider: FileChangeSetTitleProvider; + + private replacer: ContentReplacer; + + constructor() { + this.replacer = new ContentReplacerV1Impl(); + } + + protected setReplacer(replacer: ContentReplacer): void { + this.replacer = replacer; + } + + getToolMetadata(supportMultipleReplace: boolean = false, immediateApplication: boolean = false): { description: string, parameters: ToolRequestParameters } { + const replacementProperties: ToolRequestParametersProperties = { + oldContent: { + type: 'string', + description: 'The exact content to be replaced. Must match exactly, including whitespace, comments, etc.' + }, + newContent: { + type: 'string', + description: 'The new content to insert in place of matched old content.' + } + }; + + if (supportMultipleReplace) { + replacementProperties.multiple = { + type: 'boolean', + description: 'Set to true if multiple occurrences of the oldContent are expected to be replaced.' + }; + } + const replacementParameters = { + type: 'object', + properties: { + path: { + type: 'string', + description: 'Relative path to the file within the workspace (e.g., "src/index.ts"). Must read the file with getFileContent first.' + }, + replacements: { + type: 'array', + items: { + type: 'object', + properties: replacementProperties, + required: ['oldContent', 'newContent'] + }, + description: `An array of replacement objects, each containing oldContent and newContent strings. + Ensure these strings are valid JSON string values, escaping quotes only as required.` + }, + reset: { + type: 'boolean', + description: 'Set to true to clear any existing pending changes for this file and start fresh. Default is false, which merges with existing changes.' + } + }, + required: ['path', 'replacements'] + } as ToolRequestParameters; + + const replacementSentence = supportMultipleReplace + ? 'By default, a single occurrence of each old content in the tuples is expected to be replaced. If the optional \'multiple\' flag is set to true, all occurrences will\ + be replaced. In either case, if the number of occurrences in the file does not match the expectation the function will return an error. \ + In that case try a different approach.' + : 'A single occurrence of each old content in the tuples is expected to be replaced. If the number of occurrences in the file does not match the expectation,\ + the function will return an error. In that case try a different approach.'; + + const applicationText = immediateApplication + ? 'The changes will be applied immediately without user confirmation.' + : 'The proposed changes will be applied when the user accepts.'; + + const replacementDescription = `Propose to replace sections of content in an existing file by providing a list of tuples with old content to be matched and replaced. + ${replacementSentence}. For deletions, use an empty new content in the tuple. + Make sure you use the same line endings and whitespace as in the original file content. ${applicationText} + Multiple calls for the same file will merge replacements unless the reset parameter is set to true. Use the reset parameter to clear previous changes and start + fresh if needed. + + IMPORTANT: Each oldContent must match exactly (including whitespace and indentation). + If replacements fail with "Expected 1 occurrence but found 0": re-read the file, the content may have changed or whitespace differs. + If replacements fail with "found 2+": include more surrounding context in oldContent to make it unique. + Always use getFileContent to read the current file state before making replacements.`; + + return { + description: replacementDescription, + parameters: replacementParameters + }; + } + + async createChangesetFromToolCall(toolCallString: string, ctx: ChatToolContext): Promise { + try { + if (ctx.cancellationToken?.isCancellationRequested) { + return JSON.stringify({ error: 'Operation cancelled by user' }); + } + + const result = await this.processReplacementsCommon(toolCallString, ctx, this.fileChangeSetTitleProvider.getChangeSetTitle(ctx)); + + if (result.errors.length > 0) { + return `Errors encountered: ${result.errors.join('; ')}`; + } + + if (result.fileElement) { + const action = result.reset ? 'reset and applied' : 'applied'; + return `Proposed replacements ${action} to file ${result.path}. The user will review and potentially apply the changes.`; + } else { + return `No changes needed for file ${result.path}. Content already matches the requested state.`; + } + } catch (error) { + console.debug('Error processing replacements:', error.message); + return JSON.stringify({ error: error.message }); + } + } + + async writeChangesetFromToolCall(toolCallString: string, ctx: ChatToolContext): Promise { + try { + if (ctx.cancellationToken?.isCancellationRequested) { + return JSON.stringify({ error: 'Operation cancelled by user' }); + } + + const result = await this.processReplacementsCommon(toolCallString, ctx, this.fileChangeSetTitleProvider.getChangeSetTitle(ctx)); + + if (result.errors.length > 0) { + return `Errors encountered: ${result.errors.join('; ')}`; + } + + if (result.fileElement) { + await result.fileElement.apply(); + + const action = result.reset ? 'reset and' : ''; + return `Successfully ${action} applied replacements to file ${result.path}.`; + } else { + return `No changes needed for file ${result.path}. Content already matches the requested state.`; + } + } catch (error) { + console.debug('Error processing replacements:', error.message); + return JSON.stringify({ error: error.message }); + } + } + + private async processReplacementsCommon( + toolCallString: string, + ctx: ChatToolContext, + changeSetTitle: string + ): Promise<{ fileElement: ChangeSetFileElement | undefined, path: string, reset: boolean, errors: string[] }> { + if (ctx.cancellationToken?.isCancellationRequested) { + throw new Error('Operation cancelled by user'); + } + + const { path, replacements, reset } = JSON.parse(toolCallString) as { path: string, replacements: Replacement[], reset?: boolean }; + const fileUri = await this.workspaceFunctionScope.resolveRelativePath(path); + + let startingContent: string; + if (reset || !ctx.request.session.changeSet) { + startingContent = (await this.fileService.read(fileUri)).value.toString(); + } else { + const existingElement = this.findExistingChangeElement(ctx.request.session.changeSet, fileUri); + if (existingElement) { + startingContent = existingElement.targetState || (await this.fileService.read(fileUri)).value.toString(); + } else { + startingContent = (await this.fileService.read(fileUri)).value.toString(); + } + } + + if (ctx.cancellationToken?.isCancellationRequested) { + throw new Error('Operation cancelled by user'); + } + + const { updatedContent, errors } = this.replacer.applyReplacements(startingContent, replacements); + + if (errors.length > 0) { + return { fileElement: undefined, path, reset: reset || false, errors }; + } + + const originalContent = (await this.fileService.read(fileUri)).value.toString(); + if (updatedContent !== originalContent) { + ctx.request.session.changeSet.setTitle(changeSetTitle); + + const fileElement = this.fileChangeFactory({ + uri: fileUri, + type: 'modify', + state: 'pending', + targetState: updatedContent, + requestId: ctx.request.id, + chatSessionId: ctx.request.session.id + }); + + ctx.request.session.changeSet.addElements(fileElement); + + return { fileElement, path, reset: reset || false, errors: [] }; + } else { + return { fileElement: undefined, path, reset: reset || false, errors: [] }; + } + } + + private findExistingChangeElement(changeSet: ChangeSet, fileUri: URI): ChangeSetFileElement | undefined { + const element = changeSet.getElementByURI(fileUri); + if (element instanceof ChangeSetFileElement) { + return element; + } + } + + async clearFileChanges(path: string, ctx: ChatToolContext): Promise { + try { + if (ctx.cancellationToken?.isCancellationRequested) { + return JSON.stringify({ error: 'Operation cancelled by user' }); + } + + const fileUri = await this.workspaceFunctionScope.resolveRelativePath(path); + if (ctx.request.session.changeSet.removeElements(fileUri)) { + return `Cleared pending change(s) for file ${path}.`; + } else { + return `No pending changes found for file ${path}.`; + } + } catch (error) { + console.debug('Error clearing file changes:', error.message); + return JSON.stringify({ error: error.message }); + } + } + + async getProposedFileState(path: string, ctx: ChatToolContext): Promise { + try { + if (ctx.cancellationToken?.isCancellationRequested) { + return JSON.stringify({ error: 'Operation cancelled by user' }); + } + + const fileUri = await this.workspaceFunctionScope.resolveRelativePath(path); + + if (!ctx.request.session.changeSet) { + const originalContent = (await this.fileService.read(fileUri)).value.toString(); + return `File ${path} has no pending changes. Original content:\n\n${originalContent}`; + } + + const existingElement = this.findExistingChangeElement(ctx.request.session.changeSet, fileUri); + if (existingElement && existingElement.targetState) { + return `File ${path} has pending changes. Proposed content:\n\n${existingElement.targetState}`; + } else { + const originalContent = (await this.fileService.read(fileUri)).value.toString(); + return `File ${path} has no pending changes. Original content:\n\n${originalContent}`; + } + } catch (error) { + console.debug('Error getting proposed file state:', error.message); + return JSON.stringify({ error: error.message }); + } + } +} + +@injectable() +export class SimpleSuggestFileReplacements implements ToolProvider { + static ID = 'simpleSuggestFileReplacements'; + @inject(ReplaceContentInFileFunctionHelper) + protected readonly replaceContentInFileFunctionHelper: ReplaceContentInFileFunctionHelper; + + getTool(): ToolRequest { + const metadata = this.replaceContentInFileFunctionHelper.getToolMetadata(); + return { + id: SimpleSuggestFileReplacements.ID, + name: SimpleSuggestFileReplacements.ID, + description: metadata.description, + parameters: metadata.parameters, + handler: async (args: string, ctx?: ToolInvocationContext): Promise => { + assertChatContext(ctx); + if (ctx.cancellationToken?.isCancellationRequested) { + return JSON.stringify({ error: 'Operation cancelled by user' }); + } + return this.replaceContentInFileFunctionHelper.createChangesetFromToolCall(args, ctx); + } + }; + } +} + +@injectable() +export class SimpleWriteFileReplacements implements ToolProvider { + static ID = 'simpleWriteFileReplacements'; + @inject(ReplaceContentInFileFunctionHelper) + protected readonly replaceContentInFileFunctionHelper: ReplaceContentInFileFunctionHelper; + + getTool(): ToolRequest { + const metadata = this.replaceContentInFileFunctionHelper.getToolMetadata(false, true); + return { + id: SimpleWriteFileReplacements.ID, + name: SimpleWriteFileReplacements.ID, + description: metadata.description, + parameters: metadata.parameters, + handler: async (args: string, ctx?: ToolInvocationContext): Promise => { + assertChatContext(ctx); + if (ctx.cancellationToken?.isCancellationRequested) { + return JSON.stringify({ error: 'Operation cancelled by user' }); + } + return this.replaceContentInFileFunctionHelper.writeChangesetFromToolCall(args, ctx); + } + }; + } +} + +@injectable() +export class SuggestFileReplacements_Simple implements ToolProvider { + static ID = SUGGEST_FILE_REPLACEMENTS_SIMPLE_ID; + @inject(ReplaceContentInFileFunctionHelper) + protected readonly replaceContentInFileFunctionHelper: ReplaceContentInFileFunctionHelper; + + getTool(): ToolRequest { + const metadata = this.replaceContentInFileFunctionHelper.getToolMetadata(true); + return { + id: SuggestFileReplacements_Simple.ID, + name: SuggestFileReplacements_Simple.ID, + description: metadata.description, + parameters: metadata.parameters, + handler: async (args: string, ctx?: ToolInvocationContext): Promise => { + assertChatContext(ctx); + if (ctx.cancellationToken?.isCancellationRequested) { + return JSON.stringify({ error: 'Operation cancelled by user' }); + } + return this.replaceContentInFileFunctionHelper.createChangesetFromToolCall(args, ctx); + } + }; + } +} + +/** + * Legacy WriteFileReplacements implementation using V1 content replacer. + * @deprecated Use WriteFileReplacements instead which uses the improved V2 implementation. + */ +@injectable() +export class WriteFileReplacements_Simple implements ToolProvider { + static ID = WRITE_FILE_REPLACEMENTS_SIMPLE_ID; + @inject(ReplaceContentInFileFunctionHelper) + protected readonly replaceContentInFileFunctionHelper: ReplaceContentInFileFunctionHelper; + + getTool(): ToolRequest { + const metadata = this.replaceContentInFileFunctionHelper.getToolMetadata(true, true); + return { + id: WriteFileReplacements_Simple.ID, + name: WriteFileReplacements_Simple.ID, + description: metadata.description, + parameters: metadata.parameters, + handler: async (args: string, ctx?: ToolInvocationContext): Promise => { + assertChatContext(ctx); + if (ctx.cancellationToken?.isCancellationRequested) { + return JSON.stringify({ error: 'Operation cancelled by user' }); + } + return this.replaceContentInFileFunctionHelper.writeChangesetFromToolCall(args, ctx); + } + }; + } +} + +@injectable() +export class ClearFileChanges implements ToolProvider { + static ID = CLEAR_FILE_CHANGES_ID; + @inject(ReplaceContentInFileFunctionHelper) + protected readonly replaceContentInFileFunctionHelper: ReplaceContentInFileFunctionHelper; + + getTool(): ToolRequest { + return { + id: ClearFileChanges.ID, + name: ClearFileChanges.ID, + description: 'Clears all pending (not yet applied) changes for a specific file, allowing you to start fresh with new modifications. ' + + 'Use this when previous replacement attempts failed and you want to try a different approach. ' + + 'Does not affect already-applied changes or the actual file on disk.', + parameters: { + type: 'object', + properties: { + path: { + type: 'string', + description: 'Relative path to the file within the workspace (e.g., "src/index.ts").' + } + }, + required: ['path'] + }, + handler: async (args: string, ctx?: ToolInvocationContext): Promise => { + assertChatContext(ctx); + if (ctx.cancellationToken?.isCancellationRequested) { + return JSON.stringify({ error: 'Operation cancelled by user' }); + } + const { path } = JSON.parse(args); + return this.replaceContentInFileFunctionHelper.clearFileChanges(path, ctx); + } + }; + } +} + +@injectable() +export class GetProposedFileState implements ToolProvider { + static ID = GET_PROPOSED_CHANGES_ID; + @inject(ReplaceContentInFileFunctionHelper) + protected readonly replaceContentInFileFunctionHelper: ReplaceContentInFileFunctionHelper; + + getTool(): ToolRequest { + return { + id: GET_PROPOSED_CHANGES_ID, + name: GET_PROPOSED_CHANGES_ID, + description: 'Returns the current proposed state of a file, including all pending changes that have been proposed ' + + 'but not yet applied. Use this to see what the file will look like after your changes are applied. ' + + 'This is useful when making incremental changes to verify the accumulated state is correct. ' + + 'If no pending changes exist for the file, returns the original file content.', + parameters: { + type: 'object', + properties: { + path: { + type: 'string', + description: 'Relative path to the file within the workspace (e.g., "src/index.ts").' + } + }, + required: ['path'] + }, + handler: async (args: string, ctx?: ToolInvocationContext): Promise => { + assertChatContext(ctx); + if (ctx.cancellationToken?.isCancellationRequested) { + return JSON.stringify({ error: 'Operation cancelled by user' }); + } + const { path } = JSON.parse(args); + return this.replaceContentInFileFunctionHelper.getProposedFileState(path, ctx); + } + }; + } +} + +@injectable() +export class ReplaceContentInFileFunctionHelperV2 extends ReplaceContentInFileFunctionHelper { + constructor() { + super(); + this.setReplacer(new ContentReplacerV2Impl()); + } +} + +@injectable() +export class SuggestFileReplacements implements ToolProvider { + static ID = SUGGEST_FILE_REPLACEMENTS_ID; + + @inject(ReplaceContentInFileFunctionHelperV2) + protected readonly replaceContentInFileFunctionHelper: ReplaceContentInFileFunctionHelperV2; + + getTool(): ToolRequest { + const metadata = this.replaceContentInFileFunctionHelper.getToolMetadata(true); + return { + id: SuggestFileReplacements.ID, + name: SuggestFileReplacements.ID, + description: `Proposes to replace sections of content in an existing file by providing a list of replacements. + Each replacement consists of oldContent to be matched and newContent to insert in its place. + By default, a single occurrence of each oldContent is expected. If the 'multiple' flag is set to true, all occurrences will be replaced. + For deletions, use an empty newContent. + The proposed changes will be applied when the user accepts. + Multiple calls for the same file will merge replacements unless the reset parameter is set to true. + + IMPORTANT: Each oldContent must appear exactly once in the file (unless 'multiple' is true). + If you see "Expected 1 occurrence but found X" errors: + - If found 0: The content doesn't exist, has different whitespace/indentation, or the file changed. Re-read the file first. + - If found 2+: Add more surrounding lines to oldContent to make it unique. + Common mistakes: Missing/extra trailing newlines, wrong indentation, outdated content. + Always read the file with getFileContent before attempting replacements.`, + parameters: metadata.parameters, + handler: async (args: string, ctx?: ToolInvocationContext): Promise => { + assertChatContext(ctx); + if (ctx.cancellationToken?.isCancellationRequested) { + return JSON.stringify({ error: 'Operation cancelled by user' }); + } + return this.replaceContentInFileFunctionHelper.createChangesetFromToolCall(args, ctx); + } + }; + } +} + +@injectable() +export class WriteFileReplacements implements ToolProvider { + static ID = WRITE_FILE_REPLACEMENTS_ID; + + @inject(ReplaceContentInFileFunctionHelperV2) + protected readonly replaceContentInFileFunctionHelper: ReplaceContentInFileFunctionHelperV2; + + getTool(): ToolRequest { + const metadata = this.replaceContentInFileFunctionHelper.getToolMetadata(true, true); + return { + id: WriteFileReplacements.ID, + name: WriteFileReplacements.ID, + description: metadata.description, + parameters: metadata.parameters, + handler: async (args: string, ctx?: ToolInvocationContext): Promise => { + assertChatContext(ctx); + if (ctx.cancellationToken?.isCancellationRequested) { + return JSON.stringify({ error: 'Operation cancelled by user' }); + } + return this.replaceContentInFileFunctionHelper.writeChangesetFromToolCall(args, ctx); + } + }; + } +} + +@injectable() +export class DefaultFileChangeSetTitleProvider implements FileChangeSetTitleProvider { + getChangeSetTitle(_ctx: ChatToolContext): string { + return nls.localize('theia/ai-chat/fileChangeSetTitle', 'Changes proposed'); + } +} diff --git a/packages/ai-ide/src/browser/frontend-module.ts b/packages/ai-ide/src/browser/frontend-module.ts new file mode 100644 index 0000000..74ead5d --- /dev/null +++ b/packages/ai-ide/src/browser/frontend-module.ts @@ -0,0 +1,347 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import '../../src/browser/style/index.css'; + +import { ContainerModule } from '@theia/core/shared/inversify'; +import { ChatAgent, ChatAgentRecommendationService } from '@theia/ai-chat/lib/common'; +import { Agent, AIVariableContribution, bindToolProvider } from '@theia/ai-core/lib/common'; +import { ArchitectAgent } from './architect-agent'; +import { CoderAgent } from './coder-agent'; +import { SummarizeSessionCommandContribution } from './summarize-session-command-contribution'; +import { + FileContentFunction, + FileDiagnosticProvider, + FindFilesByPattern, + GetWorkspaceDirectoryStructure, + GetWorkspaceFileList, + WorkspaceFunctionScope +} from './workspace-functions'; +import { WorkspaceSearchProvider } from './workspace-search-provider'; +import { + CoolifyListProjectsProvider, + CoolifyListApplicationsProvider, + CoolifyCreateApplicationProvider, + CoolifyDeployApplicationProvider, + CoolifyGetDeploymentLogsProvider, + CoolifyGetApplicationStatusProvider +} from './coolify-deployment-provider'; +import { + GiteaCreateRepositoryProvider, + GitPushToRemoteProvider +} from './gitea-provider'; +import { + FrontendApplicationContribution, + WidgetFactory, + bindViewContribution + // RemoteConnectionProvider, // Unused after disabling MCP agents + // ServiceConnectionProvider // Unused after disabling MCP agents +} from '@theia/core/lib/browser'; +import { TaskListProvider, TaskRunnerProvider } from './workspace-task-provider'; +import { + LaunchListProvider, + LaunchRunnerProvider, + LaunchStopProvider, +} from './workspace-launch-provider'; +import { WorkspacePreferencesSchema } from '../common/workspace-preferences'; +import { + ClearFileChanges, + GetProposedFileState, + ReplaceContentInFileFunctionHelper, + SuggestFileReplacements, + SuggestFileReplacements_Simple, + SimpleSuggestFileReplacements, + SuggestFileContent, + WriteFileContent, + WriteFileReplacements, + WriteFileReplacements_Simple, + SimpleWriteFileReplacements, + FileChangeSetTitleProvider, + DefaultFileChangeSetTitleProvider, + ReplaceContentInFileFunctionHelperV2 +} from './file-changeset-functions'; +import { OrchestratorChatAgent } from '../common/orchestrator-chat-agent'; +import { UniversalChatAgent } from '../common/universal-chat-agent'; +// import { AppTesterChatAgent } from './app-tester-chat-agent'; // Requires @theia/ai-mcp +// import { GitHubChatAgent } from './github-chat-agent'; // Requires @theia/ai-mcp +import { CommandChatAgent } from '../common/command-chat-agents'; +import { ListChatContext, ResolveChatContext, AddFileToChatContext } from './context-functions'; +import { AIAgentConfigurationWidget } from './ai-configuration/agent-configuration-widget'; +import { AIConfigurationSelectionService } from './ai-configuration/ai-configuration-service'; +import { AIAgentConfigurationViewContribution } from './ai-configuration/ai-configuration-view-contribution'; +import { AIConfigurationContainerWidget } from './ai-configuration/ai-configuration-widget'; +import { AIVariableConfigurationWidget } from './ai-configuration/variable-configuration-widget'; +import { ContextFilesVariableContribution } from '../common/context-files-variable'; +import { AIToolsConfigurationWidget } from './ai-configuration/tools-configuration-widget'; +import { TabBarToolbarContribution } from '@theia/core/lib/browser/shell/tab-bar-toolbar'; +import { TemplatePreferenceContribution } from './template-preference-contribution'; +// import { AIMCPConfigurationWidget } from './ai-configuration/mcp-configuration-widget'; // Requires @theia/ai-mcp +import { ChatWelcomeMessageProvider } from '@theia/ai-chat-ui/lib/browser/chat-tree-view'; +import { IdeChatWelcomeMessageProvider } from './ide-chat-welcome-message-provider'; +import { DefaultChatAgentRecommendationService } from './default-chat-agent-recommendation-service'; +import { AITokenUsageConfigurationWidget } from './ai-configuration/token-usage-configuration-widget'; +import { AISkillsConfigurationWidget } from './ai-configuration/skills-configuration-widget'; +import { TaskContextSummaryVariableContribution } from './task-background-summary-variable'; +// import { GitHubRepoVariableContribution } from './github-repo-variable-contribution'; // Requires GitHub agent +import { TaskContextFileStorageService } from './task-context-file-storage-service'; +import { TaskContextStorageService } from '@theia/ai-chat/lib/browser/task-context-service'; +import { CommandContribution, PreferenceContribution } from '@theia/core'; +import { AIPromptFragmentsConfigurationWidget } from './ai-configuration/prompt-fragments-configuration-widget'; +// import { BrowserAutomation, browserAutomationPath } from '../common/browser-automation-protocol'; // Requires AppTester agent +// import { GitHubRepoService, githubRepoServicePath } from '../common/github-repo-protocol'; // Requires GitHub agent +// import { CloseBrowserProvider, IsBrowserRunningProvider, LaunchBrowserProvider, QueryDomProvider } from './app-tester-chat-functions'; // Requires @theia/ai-mcp +import { GetSkillFileContent } from './skill-file-functions'; +import { ModelAliasesConfigurationWidget } from './ai-configuration/model-aliases-configuration-widget'; +import { aiIdePreferenceSchema } from '../common/ai-ide-preferences'; +import { AIActivationService } from '@theia/ai-core/lib/browser'; +import { AIIdeActivationServiceImpl } from './ai-ide-activation-service'; +import { AiConfigurationPreferences } from '../common/ai-configuration-preferences'; +import { TaskContextAgent } from './task-context-agent'; +import { ProjectInfoAgent } from './project-info-agent'; +import { CreateSkillAgent } from './create-skill-agent'; +import { SuggestTerminalCommand } from './ai-terminal-functions'; +import { TodoWriteTool } from './todo-tool'; +import { TodoToolRenderer } from './todo-tool-renderer'; +import { ChatResponsePartRenderer } from '@theia/ai-chat-ui/lib/browser/chat-response-part-renderer'; +import { ContextFileValidationService } from '@theia/ai-chat/lib/browser/context-file-validation-service'; +import { ContextFileValidationServiceImpl } from './context-file-validation-service-impl'; +import { RememberCommandContribution } from './remember-command-contribution'; +import { CreateTaskContextFunction, GetTaskContextFunction, EditTaskContextFunction, ListTaskContextsFunction, RewriteTaskContextFunction } from './task-context-functions'; +// import { FixGitHubTicketCommandContribution } from './implement-gh-ticket-command-contribution'; // Requires GitHub agent +// import { AnalyzesGhTicketCommandContribution } from './analyze-gh-ticket-command-contribution'; // Requires GitHub agent +// import { AddressGhReviewCommandContribution } from './address-pr-review-command-contribution'; // Requires GitHub agent +// import { WithAppTesterCommandContribution } from './with-apptester-command-contribution'; // Requires AppTester agent + +export default new ContainerModule((bind, _unbind, _isBound, rebind) => { + bind(PreferenceContribution).toConstantValue({ schema: aiIdePreferenceSchema }); + bind(PreferenceContribution).toConstantValue({ schema: WorkspacePreferencesSchema }); + + bind(AIIdeActivationServiceImpl).toSelf().inSingletonScope(); + // rebinds the default implementation of '@theia/ai-core' + rebind(AIActivationService).toService(AIIdeActivationServiceImpl); + + bind(ArchitectAgent).toSelf().inSingletonScope(); + bind(Agent).toService(ArchitectAgent); + bind(ChatAgent).toService(ArchitectAgent); + + bind(CoderAgent).toSelf().inSingletonScope(); + bind(Agent).toService(CoderAgent); + bind(ChatAgent).toService(CoderAgent); + + bind(TaskContextAgent).toSelf().inSingletonScope(); + bind(Agent).toService(TaskContextAgent); + bind(ProjectInfoAgent).toSelf().inSingletonScope(); + bind(Agent).toService(ProjectInfoAgent); + bind(ChatAgent).toService(ProjectInfoAgent); + + bind(CreateSkillAgent).toSelf().inSingletonScope(); + bind(Agent).toService(CreateSkillAgent); + bind(ChatAgent).toService(CreateSkillAgent); + + bind(OrchestratorChatAgent).toSelf().inSingletonScope(); + bind(Agent).toService(OrchestratorChatAgent); + bind(ChatAgent).toService(OrchestratorChatAgent); + + bind(UniversalChatAgent).toSelf().inSingletonScope(); + bind(Agent).toService(UniversalChatAgent); + bind(ChatAgent).toService(UniversalChatAgent); + + // AppTester and GitHub agents disabled - require @theia/ai-mcp + // bind(AppTesterChatAgent).toSelf().inSingletonScope(); + // bind(Agent).toService(AppTesterChatAgent); + // bind(ChatAgent).toService(AppTesterChatAgent); + + // bind(GitHubChatAgent).toSelf().inSingletonScope(); + // bind(Agent).toService(GitHubChatAgent); + // bind(ChatAgent).toService(GitHubChatAgent); + // bind(BrowserAutomation).toDynamicValue(ctx => { + // const provider = ctx.container.get(RemoteConnectionProvider); + // return provider.createProxy(browserAutomationPath); + // }).inSingletonScope(); + + bind(CommandChatAgent).toSelf().inSingletonScope(); + bind(Agent).toService(CommandChatAgent); + bind(ChatAgent).toService(CommandChatAgent); + + bind(ChatWelcomeMessageProvider).to(IdeChatWelcomeMessageProvider).inSingletonScope(); + bind(ChatAgentRecommendationService).to(DefaultChatAgentRecommendationService).inSingletonScope(); + + bindToolProvider(GetWorkspaceFileList, bind); + bindToolProvider(FileContentFunction, bind); + bindToolProvider(GetWorkspaceDirectoryStructure, bind); + bindToolProvider(FileDiagnosticProvider, bind); + bindToolProvider(FindFilesByPattern, bind); + bindToolProvider(GetSkillFileContent, bind); + bind(WorkspaceFunctionScope).toSelf().inSingletonScope(); + bindToolProvider(WorkspaceSearchProvider, bind); + + // Coolify deployment tools + bindToolProvider(CoolifyListProjectsProvider, bind); + bindToolProvider(CoolifyListApplicationsProvider, bind); + bindToolProvider(CoolifyCreateApplicationProvider, bind); + bindToolProvider(CoolifyDeployApplicationProvider, bind); + bindToolProvider(CoolifyGetDeploymentLogsProvider, bind); + bindToolProvider(CoolifyGetApplicationStatusProvider, bind); + + bindToolProvider(GiteaCreateRepositoryProvider, bind); + bindToolProvider(GitPushToRemoteProvider, bind); + + bindToolProvider(SuggestFileContent, bind); + bindToolProvider(WriteFileContent, bind); + bindToolProvider(TaskListProvider, bind); + bindToolProvider(TaskRunnerProvider, bind); + bindToolProvider(LaunchListProvider, bind); + bindToolProvider(LaunchRunnerProvider, bind); + bindToolProvider(LaunchStopProvider, bind); + bind(ReplaceContentInFileFunctionHelper).toSelf().inSingletonScope(); + bind(FileChangeSetTitleProvider).to(DefaultFileChangeSetTitleProvider).inSingletonScope(); + bind(ReplaceContentInFileFunctionHelperV2).toSelf().inSingletonScope(); + bindToolProvider(SuggestFileReplacements, bind); + bindToolProvider(SuggestFileReplacements_Simple, bind); + bindToolProvider(WriteFileReplacements, bind); + bindToolProvider(WriteFileReplacements_Simple, bind); + bindToolProvider(ListChatContext, bind); + bindToolProvider(ResolveChatContext, bind); + bind(AIConfigurationSelectionService).toSelf().inSingletonScope(); + bind(AIConfigurationContainerWidget).toSelf(); + bind(WidgetFactory) + .toDynamicValue(ctx => ({ + id: AIConfigurationContainerWidget.ID, + createWidget: () => ctx.container.get(AIConfigurationContainerWidget) + })) + .inSingletonScope(); + + // Browser automation tools disabled - require AppTester agent and @theia/ai-mcp + // bindToolProvider(LaunchBrowserProvider, bind); + // bindToolProvider(CloseBrowserProvider, bind); + // bindToolProvider(IsBrowserRunningProvider, bind); + // bindToolProvider(QueryDomProvider, bind); + + bindViewContribution(bind, AIAgentConfigurationViewContribution); + bind(TabBarToolbarContribution).toService(AIAgentConfigurationViewContribution); + + bind(AIVariableConfigurationWidget).toSelf(); + bind(WidgetFactory) + .toDynamicValue(ctx => ({ + id: AIVariableConfigurationWidget.ID, + createWidget: () => ctx.container.get(AIVariableConfigurationWidget) + })) + .inSingletonScope(); + + bind(AIAgentConfigurationWidget).toSelf(); + bind(WidgetFactory) + .toDynamicValue(ctx => ({ + id: AIAgentConfigurationWidget.ID, + createWidget: () => ctx.container.get(AIAgentConfigurationWidget) + })) + .inSingletonScope(); + + bind(ModelAliasesConfigurationWidget).toSelf(); + bind(WidgetFactory) + .toDynamicValue(ctx => ({ + id: ModelAliasesConfigurationWidget.ID, + createWidget: () => ctx.container.get(ModelAliasesConfigurationWidget) + })) + .inSingletonScope(); + + bindToolProvider(SimpleSuggestFileReplacements, bind); + bindToolProvider(SimpleWriteFileReplacements, bind); + bindToolProvider(ClearFileChanges, bind); + bindToolProvider(GetProposedFileState, bind); + bindToolProvider(AddFileToChatContext, bind); + + bind(AIToolsConfigurationWidget).toSelf(); + bind(WidgetFactory) + .toDynamicValue(ctx => ({ + id: AIToolsConfigurationWidget.ID, + createWidget: () => ctx.container.get(AIToolsConfigurationWidget) + })) + .inSingletonScope(); + + bind(AISkillsConfigurationWidget).toSelf(); + bind(WidgetFactory) + .toDynamicValue(ctx => ({ + id: AISkillsConfigurationWidget.ID, + createWidget: () => ctx.container.get(AISkillsConfigurationWidget) + })) + .inSingletonScope(); + + bind(AIVariableContribution).to(ContextFilesVariableContribution).inSingletonScope(); + bind(PreferenceContribution).toConstantValue({ schema: AiConfigurationPreferences }); + + bind(FrontendApplicationContribution).to(TemplatePreferenceContribution); + + // MCP configuration widget disabled - requires @theia/ai-mcp + // bind(AIMCPConfigurationWidget).toSelf(); + // bind(WidgetFactory) + // .toDynamicValue(ctx => ({ + // id: AIMCPConfigurationWidget.ID, + // createWidget: () => ctx.container.get(AIMCPConfigurationWidget) + // })) + // .inSingletonScope(); + // Register the token usage configuration widget + bind(AITokenUsageConfigurationWidget).toSelf(); + bind(WidgetFactory) + .toDynamicValue(ctx => ({ + id: AITokenUsageConfigurationWidget.ID, + createWidget: () => ctx.container.get(AITokenUsageConfigurationWidget) + })) + .inSingletonScope(); + + bind(TaskContextSummaryVariableContribution).toSelf().inSingletonScope(); + bind(AIVariableContribution).toService(TaskContextSummaryVariableContribution); + + // GitHub service disabled - requires GitHub agent and @theia/ai-mcp + // bind(GitHubRepoService).toDynamicValue(ctx => { + // const provider = ctx.container.get(RemoteConnectionProvider); + // return provider.createProxy(githubRepoServicePath); + // }).inSingletonScope(); + + // bind(GitHubRepoVariableContribution).toSelf().inSingletonScope(); + // bind(AIVariableContribution).toService(GitHubRepoVariableContribution); + bind(TaskContextFileStorageService).toSelf().inSingletonScope(); + rebind(TaskContextStorageService).toService(TaskContextFileStorageService); + + bind(CommandContribution).to(SummarizeSessionCommandContribution); + bind(AIPromptFragmentsConfigurationWidget).toSelf(); + bind(WidgetFactory) + .toDynamicValue(ctx => ({ + id: AIPromptFragmentsConfigurationWidget.ID, + createWidget: () => ctx.container.get(AIPromptFragmentsConfigurationWidget) + })) + .inSingletonScope(); + + bindToolProvider(SuggestTerminalCommand, bind); + + // Task context functions for Architect planning mode + bindToolProvider(CreateTaskContextFunction, bind); + bindToolProvider(GetTaskContextFunction, bind); + bindToolProvider(EditTaskContextFunction, bind); + bindToolProvider(ListTaskContextsFunction, bind); + bindToolProvider(RewriteTaskContextFunction, bind); + bindToolProvider(TodoWriteTool, bind); + bind(ChatResponsePartRenderer).to(TodoToolRenderer).inSingletonScope(); + + bind(ContextFileValidationServiceImpl).toSelf().inSingletonScope(); + bind(ContextFileValidationService).toService(ContextFileValidationServiceImpl); + + bind(FrontendApplicationContribution).to(RememberCommandContribution); + // GitHub and AppTester command contributions disabled - require @theia/ai-mcp + // bind(FrontendApplicationContribution).to(FixGitHubTicketCommandContribution); + // bind(FrontendApplicationContribution).to(AddressGhReviewCommandContribution); + // bind(FrontendApplicationContribution).to(AnalyzesGhTicketCommandContribution); + // bind(FrontendApplicationContribution).to(WithAppTesterCommandContribution); +}); diff --git a/packages/ai-ide/src/browser/gitea-provider.ts b/packages/ai-ide/src/browser/gitea-provider.ts new file mode 100644 index 0000000..81ecaaa --- /dev/null +++ b/packages/ai-ide/src/browser/gitea-provider.ts @@ -0,0 +1,218 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { ToolInvocationContext, ToolProvider, ToolRequest } from '@theia/ai-core'; +import { CancellationToken } from '@theia/core'; +import { injectable, inject } from '@theia/core/shared/inversify'; +import { PreferenceService } from '@theia/core/lib/common/preferences/preference-service'; +import { + GITEA_CREATE_REPOSITORY_FUNCTION_ID, + GIT_PUSH_TO_REMOTE_FUNCTION_ID +} from '../common/workspace-functions'; +import { GITEA_API_URL_PREF, GITEA_API_TOKEN_PREF, GITEA_USERNAME_PREF } from '../common/workspace-preferences'; + +interface GiteaRepository { + id: number; + name: string; + full_name: string; + description?: string; + html_url: string; + clone_url: string; + ssh_url: string; +} + +@injectable() +export class GiteaCreateRepositoryProvider implements ToolProvider { + + @inject(PreferenceService) + protected readonly preferenceService: PreferenceService; + + getTool(): ToolRequest { + return { + id: GITEA_CREATE_REPOSITORY_FUNCTION_ID, + name: GITEA_CREATE_REPOSITORY_FUNCTION_ID, + description: 'Creates a new Git repository on Gitea (self-hosted Git service). ' + + 'The repository is created under the configured username and is ready to receive code pushes. ' + + 'Returns the repository URL and clone information.', + parameters: { + type: 'object', + properties: { + name: { + type: 'string', + description: 'The repository name (e.g., "my-web-app", "api-server"). Must be lowercase with hyphens or underscores only.' + }, + description: { + type: 'string', + description: 'Optional: A brief description of the repository.' + }, + isPrivate: { + type: 'boolean', + description: 'Optional: Whether the repository should be private. Default: true for user projects.' + }, + autoInit: { + type: 'boolean', + description: 'Optional: Initialize with README. Default: false (will be initialized when pushing code).' + } + }, + required: ['name'] + }, + handler: (argString, ctx?: ToolInvocationContext) => this.handleCreateRepository(argString, ctx?.cancellationToken) + }; + } + + private async handleCreateRepository(argString: string, cancellationToken?: CancellationToken): Promise { + const args = JSON.parse(argString); + const { name, description = '', isPrivate = true, autoInit = false } = args; + + const { apiUrl, apiToken } = await this.getGiteaConfig(); + + try { + const payload = { + name, + description, + private: isPrivate, + auto_init: autoInit, + default_branch: 'main' + }; + + const response = await fetch(`${apiUrl}/api/v1/user/repos`, { + method: 'POST', + headers: { + 'Authorization': `token ${apiToken}`, + 'Content-Type': 'application/json', + 'Accept': 'application/json' + }, + body: JSON.stringify(payload) + }); + + if (!response.ok) { + const errorText = await response.text(); + return `Error: Failed to create repository (${response.status} ${response.statusText})\n${errorText}`; + } + + const repo: GiteaRepository = await response.json(); + + return `✅ Repository created successfully!\n` + + `Name: ${repo.full_name}\n` + + `URL: ${repo.html_url}\n` + + `Clone URL: ${repo.clone_url}\n` + + `SSH URL: ${repo.ssh_url}\n` + + `Visibility: ${isPrivate ? 'Private' : 'Public'}\n` + + `\nNext: Use git_pushToRemote to push your code to this repository.`; + } catch (error) { + return `Error: ${error instanceof Error ? error.message : 'Unknown error occurred'}`; + } + } + + private async getGiteaConfig(): Promise<{ apiUrl: string; apiToken: string; username: string }> { + const apiUrl = this.preferenceService.get(GITEA_API_URL_PREF, ''); + const apiToken = this.preferenceService.get(GITEA_API_TOKEN_PREF, ''); + const username = this.preferenceService.get(GITEA_USERNAME_PREF, ''); + + if (!apiUrl || !apiToken || !username) { + throw new Error('Gitea API URL, Token, and Username must be configured in preferences'); + } + + return { apiUrl, apiToken, username }; + } +} + +@injectable() +export class GitPushToRemoteProvider implements ToolProvider { + + @inject(PreferenceService) + protected readonly preferenceService: PreferenceService; + + getTool(): ToolRequest { + return { + id: GIT_PUSH_TO_REMOTE_FUNCTION_ID, + name: GIT_PUSH_TO_REMOTE_FUNCTION_ID, + description: 'Initializes a Git repository in the workspace and pushes code to a remote Gitea repository. ' + + 'This automates: git init, git add, git commit, git remote add, and git push. ' + + 'Use this after generating code to push it to Gitea for deployment. ' + + 'Requires the remote repository URL from gitea_createRepository.', + parameters: { + type: 'object', + properties: { + remoteUrl: { + type: 'string', + description: 'The HTTPS clone URL of the Gitea repository (e.g., https://git.vibnai.com/mark/my-app.git). Get this from gitea_createRepository.' + }, + commitMessage: { + type: 'string', + description: 'Optional: Initial commit message. Default: "Initial commit from Theia Code OS"' + }, + branch: { + type: 'string', + description: 'Optional: Branch name to push to. Default: "main"' + }, + workspacePath: { + type: 'string', + description: 'Optional: Relative path within workspace to push. Default: workspace root (all files)' + } + }, + required: ['remoteUrl'] + }, + handler: (argString, ctx?: ToolInvocationContext) => this.handlePushToRemote(argString, ctx?.cancellationToken) + }; + } + + private async handlePushToRemote(argString: string, cancellationToken?: CancellationToken): Promise { + const args = JSON.parse(argString); + const { + remoteUrl, + commitMessage = 'Initial commit from Theia Code OS', + branch = 'main', + workspacePath = '.' + } = args; + + const { apiToken, username } = await this.getGiteaConfig(); + + // Inject credentials into URL for authentication + const authenticatedUrl = remoteUrl.replace('https://', `https://${username}:${apiToken}@`); + + try { + // Note: This is a simplified implementation that returns shell commands to execute + // In a production environment, this would use the Terminal API or ProcessManager + const commands = [ + `cd ${workspacePath}`, + 'git init', + 'git add .', + `git commit -m "${commitMessage}"`, + `git branch -M ${branch}`, + `git remote add origin ${authenticatedUrl}`, + `git push -u origin ${branch}` + ].join(' && '); + + return `⚠️ Git push not yet implemented - please execute these commands in the terminal:\n\n${commands}\n\n` + + `Note: The URL includes authentication credentials automatically.`; + } catch (error) { + return `Error: ${error instanceof Error ? error.message : 'Unknown error occurred'}`; + } + } + + private async getGiteaConfig(): Promise<{ apiUrl: string; apiToken: string; username: string }> { + const apiUrl = this.preferenceService.get(GITEA_API_URL_PREF, ''); + const apiToken = this.preferenceService.get(GITEA_API_TOKEN_PREF, ''); + const username = this.preferenceService.get(GITEA_USERNAME_PREF, ''); + + if (!apiUrl || !apiToken || !username) { + throw new Error('Gitea API URL, Token, and Username must be configured in preferences'); + } + + return { apiUrl, apiToken, username }; + } +} diff --git a/packages/ai-ide/src/browser/github-chat-agent.ts b/packages/ai-ide/src/browser/github-chat-agent.ts new file mode 100644 index 0000000..b86ca9b --- /dev/null +++ b/packages/ai-ide/src/browser/github-chat-agent.ts @@ -0,0 +1,249 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +// @ts-nocheck - Disabled: requires @theia/ai-mcp + +import { AbstractStreamParsingChatAgent } from '@theia/ai-chat/lib/common/chat-agents'; +import { ErrorChatResponseContentImpl, MarkdownChatResponseContentImpl, MutableChatRequestModel, QuestionResponseContentImpl } from '@theia/ai-chat/lib/common/chat-model'; +import { LanguageModelRequirement } from '@theia/ai-core/lib/common'; +import { MCPFrontendService, MCPServerDescription } from '@theia/ai-mcp/lib/common/mcp-server-manager'; +import { nls, CommandService } from '@theia/core'; +import { inject, injectable } from '@theia/core/shared/inversify'; +import { MCP_SERVERS_PREF } from '@theia/ai-mcp/lib/common/mcp-preferences'; +import { PreferenceScope, PreferenceService } from '@theia/core/lib/common'; +import { PreferencesCommands } from '@theia/preferences/lib/browser/util/preference-types'; +import { EditorManager } from '@theia/editor/lib/browser'; +import { FileService } from '@theia/filesystem/lib/browser/file-service'; +import { githubTemplate } from './github-prompt-template'; +// import { REQUIRED_GITHUB_MCP_SERVERS } from './github-prompt-template'; // Requires @theia/ai-mcp + +export const GitHubChatAgentId = 'GitHub'; + +@injectable() +export class GitHubChatAgent extends AbstractStreamParsingChatAgent { + + @inject(MCPFrontendService) + protected readonly mcpService: MCPFrontendService; + + @inject(PreferenceService) + protected readonly preferenceService: PreferenceService; + + @inject(CommandService) + protected readonly commandService: CommandService; + + @inject(EditorManager) + protected readonly editorManager: EditorManager; + + @inject(FileService) + protected readonly fileService: FileService; + + id: string = GitHubChatAgentId; + name = GitHubChatAgentId; + languageModelRequirements: LanguageModelRequirement[] = [{ + purpose: 'chat', + identifier: 'default/code', + }]; + protected defaultLanguageModelPurpose: string = 'chat'; + override description = nls.localize('theia/ai/ide/github/description', 'This agent helps you interact with GitHub repositories, issues, pull requests, and other GitHub ' + + 'features through the GitHub MCP server. ' + + 'It can help you manage your repositories, create issues, handle pull requests, and perform various GitHub operations.'); + + override iconClass: string = 'codicon codicon-github'; + protected override systemPromptId: string = 'github-system'; + override prompts = [{ id: 'github-system', defaultVariant: githubTemplate, variants: [] }]; + + /** + * Override invoke to check if the GitHub MCP server is configured and running, + * and if not, offer to configure or start it. + */ + override async invoke(request: MutableChatRequestModel): Promise { + try { + if (await this.requiresConfiguration()) { + // Ask the user if they want to configure the GitHub server + request.response.response.addContent(new QuestionResponseContentImpl(nls.localize('theia/ai/ide/github/configureGitHubServer/question', + 'The GitHub MCP server is not configured. Would you like to configure it now? ' + + 'This will open the settings.json file where you can add your GitHub access token.'), + [ + { text: nls.localize('theia/ai/ide/github/configureGitHubServer/yes', 'Yes, configure GitHub server'), value: 'configure' }, + { text: nls.localize('theia/ai/ide/github/configureGitHubServer/no', 'No, cancel'), value: 'cancel' } + ], + request, + async selectedOption => { + if (selectedOption.value === 'configure') { + await this.offerConfiguration(); + request.response.response.addContent(new MarkdownChatResponseContentImpl(nls.localize('theia/ai/ide/github/configureGitHubServer/followup', + 'Settings file opened. Please add your GitHub Personal Access Token to the `serverAuthToken` property in the GitHub server configuration, then ' + + ' save and try again.\n\n' + + 'You can create a Personal Access Token at: https://github.com/settings/tokens' + ))); + request.response.complete(); + } else { + request.response.response.addContent(new MarkdownChatResponseContentImpl(nls.localize('theia/ai/ide/github/configureGitHubServer/canceled', + 'GitHub server configuration cancelled. Please configure the GitHub MCP server to use this agent.'))); + request.response.complete(); + } + } + )); + request.response.waitForInput(); + return; + } + + if (await this.requiresStartingServer()) { + // Ask the user if they want to start the server + request.response.response.addContent(new QuestionResponseContentImpl(nls.localize('theia/ai/ide/github/startGitHubServer/question', + 'The GitHub MCP server is configured but not running. Would you like to start it now?'), + [ + { text: nls.localize('theia/ai/ide/github/startGitHubServer/yes', 'Yes, start the server'), value: 'yes' }, + { text: nls.localize('theia/ai/ide/github/startGitHubServer/no', 'No, cancel'), value: 'no' } + ], + request, + async selectedOption => { + if (selectedOption.value === 'yes') { + const progress = request.response.addProgressMessage({ + content: nls.localize('theia/ai/ide/github/startGitHubServer/progress', 'Starting GitHub MCP server.'), + show: 'whileIncomplete' + }); + try { + await this.startServer(); + request.response.updateProgressMessage({ ...progress, show: 'whileIncomplete', status: 'completed' }); + await super.invoke(request); + } catch (error) { + request.response.response.addContent(new ErrorChatResponseContentImpl( + new Error(nls.localize('theia/ai/ide/github/startGitHubServer/error', 'Failed to start GitHub MCP server: {0}', + error instanceof Error ? error.message : String(error))) + )); + request.response.complete(); + } + } else { + request.response.response.addContent(new MarkdownChatResponseContentImpl(nls.localize('theia/ai/ide/github/startGitHubServer/canceled', + 'Please start the GitHub MCP server to use this agent.'))); + request.response.complete(); + } + } + )); + request.response.waitForInput(); + return; + } + + // If already configured and running, continue as normal + await super.invoke(request); + } catch (error) { + request.response.response.addContent(new ErrorChatResponseContentImpl( + new Error(nls.localize('theia/ai/ide/github/errorCheckingGitHubServerStatus', 'Error checking GitHub MCP server status: {0}', + error instanceof Error ? error.message : String(error))) + )); + request.response.complete(); + } + } + + protected async requiresConfiguration(): Promise { + const serverConfigured = await this.mcpService.hasServer(REQUIRED_GITHUB_MCP_SERVERS[0].name); + return !serverConfigured; + } + + protected async requiresStartingServer(): Promise { + const serverStarted = await this.mcpService.isServerStarted(REQUIRED_GITHUB_MCP_SERVERS[0].name); + return !serverStarted; + } + + protected async startServer(): Promise { + await this.ensureServerStarted(REQUIRED_GITHUB_MCP_SERVERS[0]); + } + + protected async offerConfiguration(): Promise { + const currentServers = this.preferenceService.get>(MCP_SERVERS_PREF, {}); + const githubServer = REQUIRED_GITHUB_MCP_SERVERS[0]; + + const { name, ...serverWithoutName } = githubServer; + await this.preferenceService.set(MCP_SERVERS_PREF, { + ...currentServers, + [name]: serverWithoutName + }, PreferenceScope.User); + + await this.openAndFocusOnGitHubConfig(name); + } + + /** + * Opens the user preferences JSON file and attempts to focus on the GitHub server configuration. + */ + protected async openAndFocusOnGitHubConfig(serverName: string): Promise { + try { + const configUri = this.preferenceService.getConfigUri(PreferenceScope.User); + if (!configUri) { + this.logger.debug('Could not get config URI for user preferences'); + return; + } + + if (!await this.fileService.exists(configUri)) { + await this.fileService.create(configUri); + } + + const content = await this.fileService.read(configUri); + const text = content.value; + + const preferencePattern = `"${MCP_SERVERS_PREF}"`; + const preferenceMatch = text.indexOf(preferencePattern); + + let selection: { start: { line: number; character: number } } | undefined; + + if (preferenceMatch !== -1) { + const serverPattern = `"${serverName}"`; + const serverMatch = text.indexOf(serverPattern, preferenceMatch); + + if (serverMatch !== -1) { + const lines = text.substring(0, serverMatch).split('\n'); + const line = lines.length - 1; + const character = lines[lines.length - 1].length; + + selection = { + start: { line, character } + }; + } + } + + await this.editorManager.open(configUri, { + selection + }); + } catch (error) { + this.logger.debug('Failed to open and focus on GitHub configuration:', error); + // Fallback to just opening the preferences file + await this.commandService.executeCommand(PreferencesCommands.OPEN_USER_PREFERENCES_JSON.id); + } + } + + /** + * Starts the GitHub MCP server if it doesn't exist or isn't running. + * + * @returns A promise that resolves when the server is started + */ + async ensureServerStarted(server: MCPServerDescription): Promise { + try { + if (!(await this.mcpService.hasServer(server.name))) { + const currentServers = this.preferenceService.get>(MCP_SERVERS_PREF, {}); + const { name, ...serverWithoutName } = server; + await this.preferenceService.set(MCP_SERVERS_PREF, { ...currentServers, [name]: serverWithoutName }, PreferenceScope.User); + await this.mcpService.addOrUpdateServer(server); + } + + if (!(await this.mcpService.isServerStarted(server.name))) { + await this.mcpService.startServer(server.name); + } + } catch (error) { + this.logger.error(`Error starting GitHub MCP server ${server.name}: ${error}`); + throw error; + } + } +} diff --git a/packages/ai-ide/src/browser/github-prompt-template.ts b/packages/ai-ide/src/browser/github-prompt-template.ts new file mode 100644 index 0000000..70896b0 --- /dev/null +++ b/packages/ai-ide/src/browser/github-prompt-template.ts @@ -0,0 +1,56 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// * + +import { BasePromptFragment } from '@theia/ai-core/lib/common'; +import { CHAT_CONTEXT_DETAILS_VARIABLE_ID } from '@theia/ai-chat'; +// import { MCPServerDescription } from '@theia/ai-mcp/lib/common/mcp-server-manager'; + +export const GITHUB_REPO_NAME_VARIABLE_ID = 'githubRepoName'; + +// Disabled MCP dependency - GitHub agent requires ai-mcp package +// export const REQUIRED_GITHUB_MCP_SERVERS: MCPServerDescription[] = [ +// { +// 'name': 'github', +// 'serverUrl': 'https://api.githubcopilot.com/mcp/', +// 'serverAuthToken': 'your_github_token_here' +// } +// ]; + +export const githubTemplate: BasePromptFragment = { + id: 'github-system-default', + template: `{{!-- This prompt is licensed under the MIT License (https://opensource.org/license/mit). +Made improvements or adaptations to this prompt template? We'd love for you to share it with the community! Contribute back here: +https://github.com/eclipse-theia/theia/discussions/new?category=prompt-template-contribution --}} + +You are GitHub Agent, an AI assistant integrated into Theia IDE specifically designed to help developers interact with GitHub repositories. +Your role is to help users manage GitHub repositories, issues, pull requests, and other GitHub-related tasks through the GitHub MCP server. + +## Current Repository Context +{{${GITHUB_REPO_NAME_VARIABLE_ID}}} + +## Available GitHub Tools +You have access to GitHub functionality through the MCP server: +{{prompt:mcp_github_tools}} + +## Important Notes +- Be mindful of rate limits and use batch operations when appropriate +- Provide clear error messages and suggestions for resolution when operations fail + +## Current Context +Some files and other pieces of data may have been added by the user to the context of the chat. If any have, the details can be found below. +{{${CHAT_CONTEXT_DETAILS_VARIABLE_ID}}} +` +}; diff --git a/packages/ai-ide/src/browser/github-repo-variable-contribution.ts b/packages/ai-ide/src/browser/github-repo-variable-contribution.ts new file mode 100644 index 0000000..d43e742 --- /dev/null +++ b/packages/ai-ide/src/browser/github-repo-variable-contribution.ts @@ -0,0 +1,93 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { injectable, inject } from '@theia/core/shared/inversify'; +import { MaybePromise, nls } from '@theia/core'; +import { + AIVariableContribution, + AIVariableResolver, + AIVariableService, + AIVariableResolutionRequest, + AIVariableContext, + ResolvedAIVariable, + AIVariable +} from '@theia/ai-core/lib/common'; +import { WorkspaceService } from '@theia/workspace/lib/browser'; +import { FileService } from '@theia/filesystem/lib/browser/file-service'; + +import { GitHubRepoService } from '../common/github-repo-protocol'; + +export const GITHUB_REPO_NAME_VARIABLE: AIVariable = { + id: 'github-repo-name-provider', + name: 'githubRepoName', + description: nls.localize('theia/ai/ide/githubRepoName/description', 'The name of the current GitHub repository (e.g., "eclipse-theia/theia")') +}; + +@injectable() +export class GitHubRepoVariableContribution implements AIVariableContribution, AIVariableResolver { + + @inject(WorkspaceService) + protected readonly workspaceService: WorkspaceService; + + @inject(FileService) + protected readonly fileService: FileService; + + @inject(GitHubRepoService) + protected readonly gitHubRepoService: GitHubRepoService; + + registerVariables(service: AIVariableService): void { + service.registerResolver(GITHUB_REPO_NAME_VARIABLE, this); + } + + canResolve(request: AIVariableResolutionRequest, _context: AIVariableContext): MaybePromise { + if (request.variable.name !== GITHUB_REPO_NAME_VARIABLE.name) { + return 0; + } + + return 1; + } + + async resolve(request: AIVariableResolutionRequest, _context: AIVariableContext): Promise { + if (request.variable.name !== GITHUB_REPO_NAME_VARIABLE.name) { + return undefined; + } + + try { + const workspaceRoots = await this.workspaceService.roots; + if (workspaceRoots.length === 0) { + return { variable: request.variable, value: 'No GitHub repository is currently selected or detected.' }; + } + + // Get the filesystem path from the workspace root URI + const workspaceRoot = workspaceRoots[0].resource; + const workspacePath = workspaceRoot.path.fsPath(); + + // Use the backend service to get GitHub repository information + const repoInfo = await this.gitHubRepoService.getGitHubRepoInfo(workspacePath); + + if (!repoInfo) { + return { variable: request.variable, value: 'No GitHub repository is currently selected or detected.' }; + } + + const repoName = `${repoInfo.owner}/${repoInfo.repo}`; + return { variable: request.variable, value: `You are currently working with the GitHub repository: **${repoName}**` }; + + } catch (error) { + console.warn('Failed to resolve GitHub repository name:', error); + return { variable: request.variable, value: 'No GitHub repository is currently selected or detected.' }; + } + } +} diff --git a/packages/ai-ide/src/browser/ide-chat-welcome-message-provider.tsx b/packages/ai-ide/src/browser/ide-chat-welcome-message-provider.tsx new file mode 100644 index 0000000..612305f --- /dev/null +++ b/packages/ai-ide/src/browser/ide-chat-welcome-message-provider.tsx @@ -0,0 +1,443 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { ChatWelcomeMessageProvider } from '@theia/ai-chat-ui/lib/browser/chat-tree-view'; +import * as React from '@theia/core/shared/react'; +import { nls } from '@theia/core/lib/common/nls'; +import { inject, injectable, postConstruct } from '@theia/core/shared/inversify'; +import { CommonCommands, LocalizedMarkdown, MarkdownRenderer } from '@theia/core/lib/browser'; +import { AlertMessage } from '@theia/core/lib/browser/widgets/alert-message'; +import { OPEN_AI_CONFIG_VIEW } from './ai-configuration/ai-configuration-view-contribution'; +import { CommandRegistry, DisposableCollection, Emitter, Event, PreferenceScope } from '@theia/core'; +import { AgentService, FrontendLanguageModelRegistry } from '@theia/ai-core/lib/common'; +import { PreferenceService } from '@theia/core/lib/common'; +import { DEFAULT_CHAT_AGENT_PREF, BYPASS_MODEL_REQUIREMENT_PREF } from '@theia/ai-chat/lib/common/ai-chat-preferences'; +import { ChatAgentRecommendationService, ChatAgentService } from '@theia/ai-chat/lib/common'; + +const TheiaIdeAiLogo = ({ width = 200, height = 200, className = '' }) => + + + + + + + + + + + + + + + + + + + + + + + + + ; + +@injectable() +export class IdeChatWelcomeMessageProvider implements ChatWelcomeMessageProvider { + + @inject(MarkdownRenderer) + protected readonly markdownRenderer: MarkdownRenderer; + + @inject(CommandRegistry) + protected readonly commandRegistry: CommandRegistry; + + @inject(FrontendLanguageModelRegistry) + protected languageModelRegistry: FrontendLanguageModelRegistry; + + @inject(PreferenceService) + protected preferenceService: PreferenceService; + + @inject(ChatAgentRecommendationService) + protected recommendationService: ChatAgentRecommendationService; + + @inject(ChatAgentService) + protected chatAgentService: ChatAgentService; + + @inject(AgentService) + protected agentService: AgentService; + + protected readonly toDispose = new DisposableCollection(); + protected _hasReadyModels = false; + protected _modelRequirementBypassed = false; + protected _defaultAgent = ''; + protected modelConfig: { hasModels: boolean; errorMessages: string[] } | undefined; + + protected readonly onStateChangedEmitter = new Emitter(); + + get onStateChanged(): Event { + return this.onStateChangedEmitter.event; + } + + @postConstruct() + protected init(): void { + this.checkLanguageModelStatus(); + this.toDispose.push( + this.languageModelRegistry.onChange(() => { + this.checkLanguageModelStatus(); + }) + ); + this.toDispose.push( + this.preferenceService.onPreferenceChanged(e => { + if (e.preferenceName === DEFAULT_CHAT_AGENT_PREF) { + const effectiveValue = this.preferenceService.get(DEFAULT_CHAT_AGENT_PREF, ''); + if (this._defaultAgent !== effectiveValue) { + this._defaultAgent = effectiveValue; + this.notifyStateChanged(); + } + } else if (e.preferenceName === BYPASS_MODEL_REQUIREMENT_PREF) { + const effectiveValue = this.preferenceService.get(BYPASS_MODEL_REQUIREMENT_PREF, false); + if (this._modelRequirementBypassed !== effectiveValue) { + this._modelRequirementBypassed = effectiveValue; + this.notifyStateChanged(); + } + } + }) + ); + this.toDispose.push( + this.agentService.onDidChangeAgents(() => { + this.notifyStateChanged(); + }) + ); + this.analyzeModelConfiguration().then(config => { + this.modelConfig = config; + this.notifyStateChanged(); + }); + this.preferenceService.ready.then(() => { + const defaultAgentValue = this.preferenceService.get(DEFAULT_CHAT_AGENT_PREF, ''); + const bypassValue = this.preferenceService.get(BYPASS_MODEL_REQUIREMENT_PREF, false); + this._defaultAgent = defaultAgentValue; + this._modelRequirementBypassed = bypassValue; + this.notifyStateChanged(); + }); + } + + protected async checkLanguageModelStatus(): Promise { + const models = await this.languageModelRegistry.getLanguageModels(); + this._hasReadyModels = models.some(model => model.status.status === 'ready'); + this.modelConfig = await this.analyzeModelConfiguration(); + this.notifyStateChanged(); + } + + protected async analyzeModelConfiguration(): Promise<{ hasModels: boolean; errorMessages: string[] }> { + const models = await this.languageModelRegistry.getLanguageModels(); + const hasModels = models.length > 0; + const unavailableModels = models.filter(model => model.status.status === 'unavailable'); + const errorMessages = unavailableModels + .map(model => model.status.message) + .filter((msg): msg is string => !!msg); + const uniqueErrorMessages = [...new Set(errorMessages)]; + return { hasModels, errorMessages: uniqueErrorMessages }; + } + + protected notifyStateChanged(): void { + this.onStateChangedEmitter.fire(); + } + + get hasReadyModels(): boolean { + return this._hasReadyModels; + } + + get modelRequirementBypassed(): boolean { + return this._modelRequirementBypassed; + } + + get defaultAgent(): string { + return this._defaultAgent; + } + + protected setModelRequirementBypassed(bypassed: boolean): void { + this.preferenceService.set(BYPASS_MODEL_REQUIREMENT_PREF, bypassed, PreferenceScope.User); + } + + protected setDefaultAgent(agentId: string): void { + this.preferenceService.set(DEFAULT_CHAT_AGENT_PREF, agentId, PreferenceScope.User); + } + + dispose(): void { + this.toDispose.dispose(); + this.onStateChangedEmitter.dispose(); + } + + renderWelcomeMessage(): React.ReactNode { + if (!this._hasReadyModels && !this._modelRequirementBypassed) { + return this.renderModelConfigurationScreen(); + } + if (!this._defaultAgent) { + return this.renderAgentSelectionScreen(); + } + return this.renderWelcomeScreen(); + } + + protected renderWelcomeScreen(): React.ReactNode { + return
    + + ']} + markdownRenderer={this.markdownRenderer} + className="theia-WelcomeMessage-Content" + markdownOptions={{ supportHtml: true }} + /> +
    ; + } + + protected renderModelConfigurationScreen(): React.ReactNode { + const config = this.modelConfig ?? { hasModels: false, errorMessages: [] }; + const { hasModels, errorMessages } = config; + + if (!hasModels) { + return
    +
    ⚠️
    + +
    + +
    + + {nls.localize('theia/ai/ide/bypassHint', 'Some agents like Claude Code don\'t require Theia Language Models')} + +
    ; + } + + return
    + + + {errorMessages.length > 0 && ( + <> + +
    +
      + {errorMessages.map((msg, idx) =>
    • {msg}
    • )} +
    +
    + + )} +
    + + +
    + + {nls.localize('theia/ai/ide/bypassHint', 'Some agents like Claude Code don\'t require Theia Language Models')} + +
    ; + } + + protected renderAgentSelectionScreen(): React.ReactNode { + const recommendedAgents = this.recommendationService.getRecommendedAgents() + .filter(agent => this.chatAgentService.getAgent(agent.id) !== undefined); + + return
    + + + {recommendedAgents.length > 0 && ( +

    + {nls.localize('theia/ai/ide/recommendedAgents', 'Recommended agents:')} +

    + )} + {recommendedAgents.length > 0 ? ( + <> +
    + {recommendedAgents.map(agent => ( + + ))} +
    +
    +

    + {nls.localize('theia/ai/ide/or', 'or')} +

    +
    + + ) : ( + + )} + 0 + ? nls.localize('theia/ai/ide/moreAgentsAvailable/header', 'More agents are available') + : nls.localize('theia/ai/ide/configureAgent/header', 'Configure a default agent')}> + + +
    ; + } + + renderDisabledMessage(): React.ReactNode { + const openAiHistory = 'aiHistory:open'; + + return
    +
    +
    + { + nls.localize('theia/ai/chat-ui/chat-view-tree-widget/aiFeatureHeader', '🚀 AI Features Available (Beta Version)!')} + +
    +

    {nls.localize('theia/ai/chat-ui/chat-view-tree-widget/featuresDisabled', 'Currently, all AI Features are disabled!')}

    +
    +
    +

    {nls.localize('theia/ai/chat-ui/chat-view-tree-widget/howToEnable', 'How to Enable the AI Features:')}

    +
    + + +
    +

    {nls.localize('theia/ai/ide/chatDisabledMessage/featuresTitle', 'Currently Supported Views and Features:')}

    +
    + +
    +
    +
    ; + } +} diff --git a/packages/ai-ide/src/browser/implement-gh-ticket-command-contribution.ts b/packages/ai-ide/src/browser/implement-gh-ticket-command-contribution.ts new file mode 100644 index 0000000..ce4eca3 --- /dev/null +++ b/packages/ai-ide/src/browser/implement-gh-ticket-command-contribution.ts @@ -0,0 +1,160 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { FrontendApplicationContribution } from '@theia/core/lib/browser'; +import { inject, injectable } from '@theia/core/shared/inversify'; +import { PromptService } from '@theia/ai-core/lib/common'; +import { nls } from '@theia/core'; +import { AGENT_DELEGATION_FUNCTION_ID } from '@theia/ai-chat/lib/browser/agent-delegation-tool'; +import { GitHubChatAgentId } from './github-chat-agent'; + +@injectable() +export class FixGitHubTicketCommandContribution implements FrontendApplicationContribution { + + @inject(PromptService) + protected readonly promptService: PromptService; + + onStart(): void { + this.registerFixGitHubTicketCommand(); + } + + protected registerFixGitHubTicketCommand(): void { + const commandTemplate = this.buildCommandTemplate(); + + this.promptService.addBuiltInPromptFragment({ + id: 'fix-gh-ticket', + template: commandTemplate, + isCommand: true, + commandName: 'fix-gh-ticket', + commandDescription: nls.localize( + 'theia/ai-ide/fixGhTicketCommand/description', + 'Analyze a GitHub ticket and implement the solution' + ), + commandArgumentHint: nls.localize( + 'theia/ai-ide/fixGhTicketCommand/argumentHint', + '' + ), + commandAgents: ['Coder'] + }); + } + + protected buildCommandTemplate(): string { + return `You have been asked to analyze a GitHub ticket and implement the solution. + +## Ticket Number +$ARGUMENTS + +## Task Overview +You need to retrieve details about the specified GitHub ticket, analyze whether it can be implemented, and if so, implement the solution. + +## Step 1: Retrieve Ticket Information +Use the ~{${AGENT_DELEGATION_FUNCTION_ID}} tool to delegate to the GitHub agent and retrieve comprehensive information about the ticket. + +**Agent ID:** '${GitHubChatAgentId}' +**Prompt:** Ask the GitHub agent to retrieve ALL details about issue/ticket #$ARGUMENTS, specifically requesting: +- The complete issue title and description/body +- All comments on the issue (this is critical for understanding the full context) +- Labels and assignees +- Issue state (open/closed) +- Any referenced issues or pull requests mentioned in the description or comments +- If other issues are referenced, retrieve their details as well + +Example delegation prompt: +\`\`\` +Please retrieve comprehensive information about issue #$ARGUMENTS. I need: +1. The complete issue title, body/description, labels, state, and assignees +2. ALL comments on this issue - every single comment is important for understanding the context +3. Any issues or PRs that are referenced or linked in the description or comments +4. For any referenced issues, please also retrieve their titles and descriptions + +This is for implementing the issue, so completeness is crucial. +\`\`\` + +## Step 2: Analyze AI Solvability +After receiving the ticket information, analyze whether this ticket can be implemented by you. Consider: + +### Criteria for Implementable Tickets: +- **Clear requirements**: The ticket clearly describes what needs to be done +- **Defined scope**: The scope of changes is well-defined and bounded +- **Technical feasibility**: The task involves code changes that can be reasoned about +- **Sufficient context**: Enough information is provided to understand the problem and solution +- **Reproducible**: For bugs, there's enough information to understand and reproduce the issue + +### Criteria for Non-Implementable Tickets: +- **Ambiguous requirements**: The ticket is vague or open to multiple interpretations +- **Missing context**: Critical information is missing (e.g., environment details, reproduction steps) +- **External dependencies**: Requires access to external systems, credentials, or human interaction +- **Design decisions needed**: Requires architectural decisions that need human judgment +- **Insufficient information**: Cannot determine what success looks like + +## Step 3: Respond Based on Analysis + +### If the ticket CANNOT be implemented: +Provide a clear explanation: +1. **Reason**: Explain specifically why this ticket cannot be implemented by AI +2. **Missing Information**: List what information is missing or unclear +3. **Questions for Clarification**: Ask specific questions that, if answered, might make the ticket implementable + +Example response format: +\`\`\` +## Analysis Result: Cannot Be Implemented + +### Reason +[Explain why] + +### Missing Information +- [Item 1] +- [Item 2] + +### Questions for Clarification +1. [Question 1] +2. [Question 2] + +Please provide the missing information and I will proceed with the implementation. +\`\`\` + +### If the ticket CAN be implemented: +Proceed with the implementation: + +1. **Briefly summarize** what the ticket requests and your implementation approach +2. **Explore the codebase** to understand the existing code structure and find relevant files +3. **Implement the solution** by making the necessary code changes using your file modification tools +4. **Explain your changes** as you make them +5. **Consider edge cases** and handle them appropriately +6. **Suggest testing steps** the user should perform to verify the implementation + +Example response format: +\`\`\` +## Analysis Result: Can Be Implemented + +### Summary +[Brief summary of the ticket and your approach] + +### Implementation +[Proceed to explore the codebase and implement the changes, explaining as you go] +\`\`\` + +## Important Guidelines for Implementation +- Always explore the codebase first to understand the existing patterns and conventions +- Follow the existing code style and patterns in the project +- Make incremental changes and explain each step +- If you encounter unexpected issues during implementation, explain them and ask for guidance +- After implementation, summarize what was changed and suggest how to test the changes + +Remember: If at any point during implementation you realize you need more information or the task is more complex than initially assessed, stop and ask for clarification rather +than making assumptions.`; + } +} diff --git a/packages/ai-ide/src/browser/mode-aware-chat-agent.ts b/packages/ai-ide/src/browser/mode-aware-chat-agent.ts new file mode 100644 index 0000000..25db38e --- /dev/null +++ b/packages/ai-ide/src/browser/mode-aware-chat-agent.ts @@ -0,0 +1,98 @@ +// ***************************************************************************** +// Copyright (C) 2026 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** +import { + AbstractStreamParsingChatAgent, ChatMode, ChatSessionContext, SystemMessageDescription +} from '@theia/ai-chat/lib/common'; +import { AIVariableContext } from '@theia/ai-core'; +import { injectable } from '@theia/core/shared/inversify'; + +/** + * An abstract chat agent that supports mode selection for selecting prompt variants. + * + * Agents extending this class define their available modes via `modeDefinitions`. + * The `modes` getter dynamically computes which mode is the default based on the + * current prompt variant settings. When a request is made with a specific `modeId`, + * that mode's prompt variant is used instead of the settings-configured default. + */ +@injectable() +export abstract class AbstractModeAwareChatAgent extends AbstractStreamParsingChatAgent { + /** + * Mode definitions without the `isDefault` property. + * Subclasses must provide their specific mode definitions. + * Each mode's `id` should correspond to a prompt variant ID. + */ + protected abstract readonly modeDefinitions: Omit[]; + + /** + * The ID of the prompt variant set used for mode selection. + * Defaults to `systemPromptId`. Override if a different variant set should be used. + */ + protected get promptVariantSetId(): string | undefined { + return this.systemPromptId; + } + + /** + * Returns the available modes with `isDefault` computed based on current settings. + */ + get modes(): ChatMode[] { + const variantSetId = this.promptVariantSetId; + if (!variantSetId) { + return this.modeDefinitions.map(mode => ({ ...mode, isDefault: false })); + } + const effectiveVariantId = this.promptService.getEffectiveVariantId(variantSetId); + return this.modeDefinitions.map(mode => ({ + ...mode, + isDefault: mode.id === effectiveVariantId + })); + } + + protected override async getSystemMessageDescription(context: AIVariableContext): Promise { + if (this.systemPromptId === undefined) { + return undefined; + } + + // Check for mode-based override from request + const modeId = ChatSessionContext.is(context) ? context.request?.request.modeId : undefined; + const effectiveVariantId = this.getEffectiveVariantIdWithMode(modeId); + + if (!effectiveVariantId) { + return undefined; + } + + const isCustomized = this.promptService.getPromptVariantInfo(effectiveVariantId)?.isCustomized ?? false; + const resolvedPrompt = await this.promptService.getResolvedPromptFragment(effectiveVariantId, undefined, context); + return resolvedPrompt ? SystemMessageDescription.fromResolvedPromptFragment(resolvedPrompt, effectiveVariantId, isCustomized) : undefined; + } + + /** + * Determines the effective variant ID, considering mode override. + * If modeId is provided and is a valid variant for the prompt set, it takes precedence. + * Otherwise falls back to settings-based selection. + */ + protected getEffectiveVariantIdWithMode(modeId?: string): string | undefined { + const variantSetId = this.promptVariantSetId; + if (!variantSetId) { + return undefined; + } + if (modeId) { + const variantIds = this.promptService.getVariantIds(variantSetId); + if (variantIds.includes(modeId)) { + return modeId; + } + } + return this.promptService.getEffectiveVariantId(variantSetId); + } +} diff --git a/packages/ai-ide/src/browser/project-info-agent.ts b/packages/ai-ide/src/browser/project-info-agent.ts new file mode 100644 index 0000000..f9f6f30 --- /dev/null +++ b/packages/ai-ide/src/browser/project-info-agent.ts @@ -0,0 +1,42 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** +import { AbstractStreamParsingChatAgent } from '@theia/ai-chat'; +import { LanguageModelRequirement } from '@theia/ai-core'; +import { injectable } from '@theia/core/shared/inversify'; +import { projectInfoSystemVariants, projectInfoTemplateVariants } from '../common/project-info-prompt-template'; +import { nls } from '@theia/core'; + +@injectable() +export class ProjectInfoAgent extends AbstractStreamParsingChatAgent { + + name = 'ProjectInfo'; + id = 'ProjectInfo'; + languageModelRequirements: LanguageModelRequirement[] = [{ + purpose: 'chat', + identifier: 'default/code', + }]; + protected defaultLanguageModelPurpose: string = 'chat'; + + override description = nls.localize('theia/ai/workspace/projectInfoAgent/description', + 'An AI assistant for managing project information templates. This agent helps create, update, and review the .prompts/project-info.prompttemplate file which provides ' + + 'context about your project to other AI agents. It can analyze your workspace to suggest project information or update existing templates based on your requirements.'); + + override tags: string[] = [...this.tags, 'Alpha']; + + override prompts = [projectInfoSystemVariants, projectInfoTemplateVariants]; + protected override systemPromptId: string | undefined = projectInfoSystemVariants.id; + +} diff --git a/packages/ai-ide/src/browser/remember-command-contribution.ts b/packages/ai-ide/src/browser/remember-command-contribution.ts new file mode 100644 index 0000000..2baca2a --- /dev/null +++ b/packages/ai-ide/src/browser/remember-command-contribution.ts @@ -0,0 +1,105 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { FrontendApplicationContribution } from '@theia/core/lib/browser'; +import { inject, injectable } from '@theia/core/shared/inversify'; +import { PromptService } from '@theia/ai-core/lib/common'; +import { nls } from '@theia/core'; +import { AGENT_DELEGATION_FUNCTION_ID } from '@theia/ai-chat/lib/browser/agent-delegation-tool'; + +/** + * Contribution that registers the `/remember` slash command for AI chat agents. + * + * This command allows Architect and Coder agents to extract important topics + * from the current conversation and delegate to the ProjectInfo agent to update + * the persistent project context file. + */ +@injectable() +export class RememberCommandContribution implements FrontendApplicationContribution { + + @inject(PromptService) + protected readonly promptService: PromptService; + + onStart(): void { + this.registerRememberCommand(); + } + + protected registerRememberCommand(): void { + const commandTemplate = this.buildCommandTemplate(); + + this.promptService.addBuiltInPromptFragment({ + id: 'remember-conversation-context', + template: commandTemplate, + isCommand: true, + commandName: 'remember', + commandDescription: nls.localize( + 'theia/ai-ide/rememberCommand/description', + 'Extract topics from conversation and update project info' + ), + commandArgumentHint: nls.localize( + 'theia/ai-ide/rememberCommand/argumentHint', + '[topic-hint]' + ), + commandAgents: ['Architect', 'Coder'] + }); + } + + protected buildCommandTemplate(): string { + return `You have been asked to extract and remember important information from the current conversation. + + ## Task Overview + Review the conversation history and identify specific information that should be added to the persistent project context. + + ## Focus Area + $ARGUMENTS + + ## What to Extract + **If a focus area is provided above**: ONLY extract information related to that specific focus area. Ignore all other topics. + + **If no focus area is provided**: Look specifically for information where the user had to correct you or provide clarification: + - **User corrections**: When the user corrected your assumptions about the codebase, architecture, or processes + - **User-provided context**: Information the user explicitly provided that you couldn't discover yourself + - **Project-specific knowledge**: Details about the project that the user shared when you made incorrect assumptions + + **Do NOT extract**: + - General information you discovered through code analysis + - Standard coding practices you identified yourself + - Information you found by exploring the codebase + - Common knowledge or widely-known patterns + - Details that are already well-documented in the code + + ## Instructions + 1. **Analyze the conversation**: Review messages for the specific criteria above + 2. **Extract only relevant information**: For each qualifying item, prepare a clear description that captures: + - What the user corrected or clarified + - Why your initial understanding was incomplete + - The specific project context that was provided + 3. **Delegate to ProjectInfo agent**: Use the ~{${AGENT_DELEGATION_FUNCTION_ID}} tool to send the extracted information to the ProjectInfo agent: + - Agent ID: 'ProjectInfo' + - Prompt: Ask the ProjectInfo agent to review the extracted information and update the project information file + + ## Example Delegation + \`\`\` + Please review and incorporate the following user corrections/clarifications into the project context: + + [Your extracted corrections and user-provided context here] + + Update /.prompts/project-info.prompttemplate by adding this information to the appropriate sections. Focus on information that prevents future misunderstandings. + \`\`\` + + Remember: Only extract information that prevents future AI agents from making the same mistakes or assumptions you made that were corrected by the user.`; + } +} diff --git a/packages/ai-ide/src/browser/skill-file-functions.ts b/packages/ai-ide/src/browser/skill-file-functions.ts new file mode 100644 index 0000000..0f306c8 --- /dev/null +++ b/packages/ai-ide/src/browser/skill-file-functions.ts @@ -0,0 +1,74 @@ +// ***************************************************************************** +// Copyright (C) 2026 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { ToolProvider, ToolRequest } from '@theia/ai-core'; +import { inject, injectable } from '@theia/core/shared/inversify'; +import { URI } from '@theia/core'; +import { FileService } from '@theia/filesystem/lib/browser/file-service'; +import { SkillService } from '@theia/ai-core/lib/browser/skill-service'; +import { parseSkillFile } from '@theia/ai-core/lib/common/skill'; +import { GET_SKILL_FILE_CONTENT_FUNCTION_ID } from '../common/workspace-functions'; + +@injectable() +export class GetSkillFileContent implements ToolProvider { + static ID = GET_SKILL_FILE_CONTENT_FUNCTION_ID; + + @inject(SkillService) + protected readonly skillService: SkillService; + + @inject(FileService) + protected readonly fileService: FileService; + + getTool(): ToolRequest { + return { + id: GetSkillFileContent.ID, + name: GetSkillFileContent.ID, + description: 'Returns the content of a skill file by skill name. Use this to read the full instructions of a skill listed in the available_skills. ' + + 'The skill name must match one of the discovered skills.', + parameters: { + type: 'object', + properties: { + skillName: { + type: 'string', + description: 'The name of the skill to retrieve (e.g., \'pdf-processing\')' + } + }, + required: ['skillName'] + }, + handler: (arg_string: string) => this.getSkillFileContent(arg_string) + }; + } + + private async getSkillFileContent(arg_string: string): Promise { + const args = JSON.parse(arg_string); + const skillName: string = args.skillName; + + const skill = this.skillService.getSkill(skillName); + + if (!skill) { + return JSON.stringify({ error: `Skill not found: ${skillName}` }); + } + + try { + const skillFileUri = URI.fromFilePath(skill.location); + const fileContent = await this.fileService.read(skillFileUri); + const parsed = parseSkillFile(fileContent.value); + return parsed.content; + } catch (error) { + return JSON.stringify({ error: `Failed to load skill content: ${error}` }); + } + } +} diff --git a/packages/ai-ide/src/browser/style/ai-configuration-base.css b/packages/ai-ide/src/browser/style/ai-configuration-base.css new file mode 100644 index 0000000..04bcf88 --- /dev/null +++ b/packages/ai-ide/src/browser/style/ai-configuration-base.css @@ -0,0 +1,90 @@ +/******************************************************************************** + * Copyright (C) 2025 EclipseSource GmbH. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the Eclipse + * Public License v. 2.0 are satisfied: GNU General Public License, version 2 + * with the GNU Classpath Exception which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 + ********************************************************************************/ + +/* Base styles for all AI configuration widgets */ + +.ai-configuration-widget-content { + width: 100%; + height: 100%; + overflow: auto; +} + +/* Empty state styling */ +.ai-configuration-empty-state { + display: flex; + align-items: center; + justify-content: center; + height: 100%; + padding: var(--theia-ui-padding); +} + +.ai-empty-state-message { + color: var(--theia-descriptionForeground); + font-style: italic; +} + +/* Configuration section styling */ +.ai-configuration-section { + margin-bottom: calc(var(--theia-ui-padding) * 2); +} + +.ai-configuration-section:last-child { + margin-bottom: 0; +} + +.ai-configuration-section-content { + padding: var(--theia-ui-padding) 0; +} + +.ai-configuration-section-content ul, +.ai-configuration-section-content ol { + padding-left: calc(var(--theia-ui-padding) * 2); + margin: 0 var(--theia-ui-padding) 0; +} + +/* Expandable section styling */ +.ai-expandable-section { + margin-bottom: var(--theia-ui-padding); +} + +.ai-expandable-section-header { + display: flex; + align-items: center; + padding: calc(var(--theia-ui-padding) / 2) 0; + cursor: pointer; + user-select: none; +} + +.ai-expandable-section-header:hover { + background-color: var(--theia-list-hoverBackground); +} + +.ai-expandable-section-icon { + display: flex; + align-items: center; + margin-right: calc(var(--theia-ui-padding) / 2); + color: var(--theia-icon-foreground); +} + +.ai-expandable-section-title { + flex: 1; + font-weight: 500; +} + +.ai-expandable-section-content { + padding-left: calc(var(--theia-ui-padding) * 2); + padding-top: calc(var(--theia-ui-padding) / 2); +} diff --git a/packages/ai-ide/src/browser/style/ai-configuration-cards.css b/packages/ai-ide/src/browser/style/ai-configuration-cards.css new file mode 100644 index 0000000..b6b6f47 --- /dev/null +++ b/packages/ai-ide/src/browser/style/ai-configuration-cards.css @@ -0,0 +1,60 @@ +/******************************************************************************** + * Copyright (C) 2025 EclipseSource GmbH. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the Eclipse + * Public License v. 2.0 are satisfied: GNU General Public License, version 2 + * with the GNU Classpath Exception which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 + ********************************************************************************/ + +/* Card grid pattern for displaying items in a responsive grid */ + +.ai-card-grid-configuration-main { + padding: var(--theia-ui-padding); + height: 100%; + overflow: auto; +} + +.ai-configuration-card-grid { + display: grid; + grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); + gap: var(--theia-ui-padding); +} + +.ai-configuration-card { + background-color: var(--theia-sideBar-background); + border: var(--theia-border-width) solid var(--theia-widget-border); + border-radius: 4px; + padding: var(--theia-ui-padding); + transition: box-shadow 0.2s ease; +} + +.ai-configuration-card:hover { + box-shadow: 0 2px 8px var(--theia-widget-shadow); +} + +/* Responsive grid */ +@media (max-width: 900px) { + .ai-configuration-card-grid { + grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); + } +} + +@media (max-width: 600px) { + .ai-configuration-card-grid { + grid-template-columns: 1fr; + } +} + +@media (max-width: 400px) { + .ai-card-grid-configuration-main { + padding: calc(var(--theia-ui-padding) / 2); + } +} diff --git a/packages/ai-ide/src/browser/style/ai-configuration-hierarchical.css b/packages/ai-ide/src/browser/style/ai-configuration-hierarchical.css new file mode 100644 index 0000000..0a49b11 --- /dev/null +++ b/packages/ai-ide/src/browser/style/ai-configuration-hierarchical.css @@ -0,0 +1,61 @@ +/******************************************************************************** + * Copyright (C) 2025 EclipseSource GmbH. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the Eclipse + * Public License v. 2.0 are satisfied: GNU General Public License, version 2 + * with the GNU Classpath Exception which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 + ********************************************************************************/ + +/* Hierarchical pattern for nested expandable sections */ + +.ai-hierarchical-configuration-main { + padding: var(--theia-ui-padding); + height: 100%; + overflow: auto; +} + +/* Additional hierarchical-specific expandable section styles */ +.ai-expandable-section .ai-expandable-section { + margin-left: var(--theia-ui-padding); + border-left: var(--theia-border-width) solid var(--theia-widget-border); + padding-left: var(--theia-ui-padding); +} + +.ai-expandable-section-header { + transition: background-color 0.15s ease; +} + +.ai-expandable-section-content { + animation: expandContent 0.2s ease-out; +} + +@keyframes expandContent { + from { + opacity: 0; + transform: translateY(-8px); + } + to { + opacity: 1; + transform: translateY(0); + } +} + +/* Responsive */ +@media (max-width: 600px) { + .ai-hierarchical-configuration-main { + padding: calc(var(--theia-ui-padding) / 2); + } + + .ai-expandable-section .ai-expandable-section { + margin-left: calc(var(--theia-ui-padding) / 2); + padding-left: calc(var(--theia-ui-padding) / 2); + } +} diff --git a/packages/ai-ide/src/browser/style/ai-configuration-list-detail.css b/packages/ai-ide/src/browser/style/ai-configuration-list-detail.css new file mode 100644 index 0000000..4c56be1 --- /dev/null +++ b/packages/ai-ide/src/browser/style/ai-configuration-list-detail.css @@ -0,0 +1,88 @@ +/******************************************************************************** + * Copyright (C) 2025 EclipseSource GmbH. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the Eclipse + * Public License v. 2.0 are satisfied: GNU General Public License, version 2 + * with the GNU Classpath Exception which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 + ********************************************************************************/ + +/* List-detail pattern: tree on left, detail on right */ + +.ai-list-detail-configuration-main { + display: grid; + grid-template-columns: minmax(150px, 280px) 1fr; + height: 100%; + overflow: hidden; + gap: 0; +} + +/* List panel (left side) */ +.ai-configuration-list { + overflow-y: auto; + overflow-x: hidden; + border-right: var(--theia-border-width) solid var(--theia-widget-border); + background-color: var(--theia-editor-background); +} + +.ai-configuration-list ul { + list-style: none; + margin: 0; + padding: 0; +} + +.ai-configuration-list li { + padding: calc(var(--theia-ui-padding) / 2) var(--theia-ui-padding); + cursor: pointer; + user-select: none; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} + +.ai-configuration-list li:hover { + background-color: var(--theia-list-hoverBackground); +} + +.ai-configuration-list li.theia-mod-selected { + background-color: var(--theia-list-activeSelectionBackground); + color: var(--theia-list-activeSelectionForeground); +} + +.ai-configuration-list-item-label { + display: inline-block; +} + +/* Detail panel (right side) */ +.ai-configuration-detail { + overflow-y: auto; + overflow-x: hidden; + padding: calc(var(--theia-ui-padding) * 2); + padding-left: calc(var(--theia-ui-padding) * 3); + background-color: var(--theia-editor-background); +} + +/* Responsive: hide list on narrow screens */ +@media (max-width: 600px) { + .ai-list-detail-configuration-main { + grid-template-columns: 1fr; + } + + .ai-configuration-list { + display: none; + } +} + +/* Very narrow screens: reduce padding */ +@media (max-width: 400px) { + .ai-configuration-detail { + padding: calc(var(--theia-ui-padding) / 2); + } +} diff --git a/packages/ai-ide/src/browser/style/ai-configuration-table.css b/packages/ai-ide/src/browser/style/ai-configuration-table.css new file mode 100644 index 0000000..9dffc11 --- /dev/null +++ b/packages/ai-ide/src/browser/style/ai-configuration-table.css @@ -0,0 +1,85 @@ +/******************************************************************************** + * Copyright (C) 2025 EclipseSource GmbH. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the Eclipse + * Public License v. 2.0 are satisfied: GNU General Public License, version 2 + * with the GNU Classpath Exception which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 + ********************************************************************************/ + +/* Table pattern for displaying tabular data */ + +.ai-table-configuration-main { + padding: var(--theia-ui-padding); + overflow: auto; +} + +.ai-configuration-table-container { + overflow-x: auto; +} + +.ai-configuration-table { + width: 100%; + border-collapse: collapse; + background-color: var(--theia-editor-background); +} + +.ai-configuration-table thead { + position: sticky; + top: 0; + z-index: 1; +} + +.ai-configuration-table th { + text-align: left; + padding: var(--theia-ui-padding) var(--theia-ui-padding); + font-weight: 600; + border-bottom: var(--theia-border-width) solid var(--theia-widget-border); + color: var(--theia-foreground); +} + +.ai-configuration-table td { + padding: calc(var(--theia-ui-padding) / 2) var(--theia-ui-padding); + border-bottom: var(--theia-border-width) solid var(--theia-widget-border); + color: var(--theia-foreground); + vertical-align: top; +} + +.ai-configuration-table .skill-description-column, +.ai-configuration-table .skill-location-column { + overflow-wrap: anywhere; + word-break: break-word; + max-width: 40em; +} + +.ai-configuration-table .skill-location-column { + font-family: var(--theia-code-font-family); +} + +.ai-configuration-table tbody tr:hover { + background-color: var(--theia-list-hoverBackground); +} + +.ai-configuration-table tbody tr:last-child td { + border-bottom: none; +} + +/* Responsive: horizontal scroll on small screens */ +@media (max-width: 600px) { + .ai-table-configuration-main { + padding: calc(var(--theia-ui-padding) / 2); + } + + .ai-configuration-table th, + .ai-configuration-table td { + padding: calc(var(--theia-ui-padding) / 3) calc(var(--theia-ui-padding) / 2); + font-size: 0.9em; + } +} diff --git a/packages/ai-ide/src/browser/style/index.css b/packages/ai-ide/src/browser/style/index.css new file mode 100644 index 0000000..356c03f --- /dev/null +++ b/packages/ai-ide/src/browser/style/index.css @@ -0,0 +1,1341 @@ +/******************************************************************************** + * Copyright (C) 2025 EclipseSource GmbH. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the Eclipse + * Public License v. 2.0 are satisfied: GNU General Public License, version 2 + * with the GNU Classpath Exception which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 + ********************************************************************************/ + +/* Import base configuration styles */ +@import url("./ai-configuration-base.css"); +@import url("./ai-configuration-list-detail.css"); +@import url("./ai-configuration-cards.css"); +@import url("./ai-configuration-table.css"); +@import url("./ai-configuration-hierarchical.css"); + +/* Import widget-specific styles */ +@import url("./widgets/model-aliases-configuration.css"); +@import url("./widgets/mcp-configuration.css"); + +/* Override preferences grid layout for AI Configuration widgets */ +.ai-configuration-widget.theia-settings-container { + display: block; + grid-template-columns: none; + grid-template-rows: none; + grid-template-areas: none; + max-width: none; + padding: 0; +} + +/* Override max-width constraint from preferences CSS */ +.theia-settings-container:has(.ai-configuration-widget), +.ai-configuration-widget.theia-settings-container { + max-width: none; + width: 100%; +} + +/* Override grid-area assignments from preferences CSS */ +.ai-configuration-widget .preferences-tree-widget, +.ai-configuration-widget .preferences-editor-widget { + grid-area: auto; + overflow: auto; +} + +.ai-configuration-widget { + max-width: 1000px; + padding: 0; + height: 100%; + display: flex; + flex-direction: column; +} + +.ai-configuration-widget [role="tablist"] { + overflow: scroll; + background-color: var(--theia-editor-background); + border-bottom: var(--theia-border-width) solid var(--theia-widget-border); +} + +.ai-configuration-widget [role="tablist"]::-webkit-scrollbar { + height: 4px; +} + +.theia-ai-settings-container { + padding: var(--theia-ui-padding); +} + +.theia-settings-container .settings-section-subcategory-title.ai-settings-section-subcategory-title { + padding-left: 0; +} + +.ai-templates { + display: flex; + flex-direction: column; + gap: calc(var(--theia-ui-padding) / 2); + margin-bottom: calc(var(--theia-ui-padding) * 2); +} + +.ai-templates-table { + width: 100%; + border-collapse: collapse; + border: var(--theia-border-width) solid var(--theia-widget-border); + border-radius: 3px; +} + +.ai-templates-table thead th { + text-align: left; + padding: var(--theia-ui-padding); + background-color: var(--theia-editorWidget-background); + color: var(--theia-descriptionForeground); + font-weight: 600; + border-bottom: var(--theia-border-width) solid var(--theia-widget-border); +} + +.ai-templates-table tbody td { + padding: var(--theia-ui-padding); + border-bottom: var(--theia-border-width) solid var(--theia-widget-border); +} + +.ai-templates-table tbody tr:last-child td { + border-bottom: none; +} + +.template-name-cell { + font-weight: 500; +} + +.template-variant-cell { + width: 200px; +} + +.template-actions-cell, +.ai-templates-table thead th.template-actions-header { + width: 100px; + text-align: right; +} + +.template-action-icon-button { + background: transparent; + border: none; + cursor: pointer; + padding: calc(var(--theia-ui-padding) / 2); + color: var(--theia-icon-foreground); + display: inline-flex; + align-items: center; + justify-content: center; + border-radius: 3px; + transition: background-color 0.2s; +} + +.template-action-icon-button:hover { + background-color: var(--theia-list-hoverBackground); +} + +.template-renderer { + display: flex; + flex-direction: column; + padding: var(--theia-ui-padding); +} + +.template-header { + margin-bottom: calc(var(--theia-ui-padding) / 2); +} + +.template-controls { + display: flex; + align-items: center; + gap: var(--theia-ui-padding); +} + +.template-select-label { + margin-right: calc(var(--theia-ui-padding) / 2); +} + +.template-variant-selector { + min-width: 120px; +} + +.template-variant-selector.error { + border-color: var(--theia-errorForeground); + background-color: var(--theia-errorBackground, rgba(255, 0, 0, 0.1)); + color: var(--theia-errorForeground); +} + +#ai-variable-configuration-container-widget, +#ai-agent-configuration-container-widget, +#ai-model-aliases-configuration-widget { + flex: 1; + overflow: hidden; +} + +/* Section headers and spacing */ +.settings-section-title { + font-size: var(--theia-ui-font-size3); + font-weight: 600; + margin: 0 0 calc(var(--theia-ui-padding) * 1.5) 0; + padding: 0 0 calc(var(--theia-ui-padding) / 2) 0; + border-bottom: var(--theia-border-width) solid var(--theia-widget-border); +} + +.settings-section-title pre { + font-size: calc(var(--theia-ui-font-size0) * 0.9); + color: var(--theia-descriptionForeground); + margin-top: calc(var(--theia-ui-padding) / 2); +} + +/* Agent title with toggle */ +.agent-title-with-toggle { + display: block; +} + +.agent-title-content { + display: flex; + justify-content: space-between; + align-items: flex-start; + gap: calc(var(--theia-ui-padding) * 2); +} + +.ai-id-label { + display: inline-block; + margin-left: var(--theia-ui-padding); +} + +.agent-enable-toggle { + display: flex; + align-items: center; + gap: calc(var(--theia-ui-padding)); + cursor: pointer; + user-select: none; + flex-shrink: 0; +} + +/* Toggle switch */ +.toggle-switch { + position: relative; + display: inline-block; + width: 36px; + height: 20px; +} + +.toggle-switch input[type="checkbox"] { + opacity: 0; + width: 0; + height: 0; +} + +.toggle-slider { + position: absolute; + cursor: pointer; + top: 0; + left: 0; + right: 0; + bottom: 0; + background-color: var(--theia-radio-inactiveHoverBackground); + transition: 0.2s; + border-radius: 20px; + border: var(--theia-border-width) solid var(--theia-widget-border); +} + +.toggle-slider:before { + position: absolute; + content: ""; + height: 14px; + width: 14px; + left: calc(var(--theia-ui-padding) / 3); + bottom: calc(var(--theia-ui-padding) / 3); + background-color: var(--theia-icon-foreground); + transition: 0.2s; + border-radius: 50%; +} + +.toggle-switch input:checked+.toggle-slider { + background-color: var(--theia-button-background); +} + +.toggle-switch input:checked+.toggle-slider:before { + transform: translateX(16px); + background-color: var(--theia-button-foreground); +} + +.toggle-switch:hover .toggle-slider { + opacity: 0.9; +} + +/* Agent status indicator in tree */ +.agent-status-indicator { + font-size: var(--theia-ui-font-size3); + margin-right: var(--theia-ui-padding); + display: inline-block; + line-height: var(--theia-content-line-height); + align-content: center; +} + +.agent-status-indicator.agent-enabled { + color: var(--theia-charts-green); +} + +.agent-status-indicator.agent-disabled { + color: var(--theia-descriptionForeground); + opacity: 0.5; +} + +/* LLM Requirements and Agent-Specific Variables - Table-like layout */ +.ai-llm-requirement-item, +.ai-agent-specific-variable-item { + border-top: var(--theia-border-width) solid var(--theia-widget-border); + border-bottom: var(--theia-border-width) solid var(--theia-widget-border); + padding: calc(var(--theia-ui-padding) * 1.5) 0; + margin-bottom: calc(var(--theia-ui-padding) * 2); +} + +.ai-llm-requirement-item:first-of-type, +.ai-agent-specific-variable-item:first-of-type { + margin-top: calc(var(--theia-ui-padding)); +} + +.ai-configuration-value-row { + display: grid; + grid-template-columns: 10em 1fr; + gap: calc(var(--theia-ui-padding) * 2); + align-items: start; + padding: calc(var(--theia-ui-padding) / 2) 0; +} + +.ai-configuration-value-row-label { + font-weight: 500; + color: var(--theia-foreground); + text-align: left; + padding-right: var(--theia-ui-padding); +} + +.ai-configuration-value-row-value { + color: var(--theia-foreground); + word-break: break-word; +} + +.ai-configuration-value-row-value.ai-alias-evaluates-to-unresolved { + color: var(--theia-descriptionForeground); +} + +.settings-section-subcategory-title { + font-size: var(--theia-ui-font-size2); + font-weight: 600; + margin: calc(var(--theia-ui-padding) * 3) 0 calc(var(--theia-ui-padding) * 1.5) 0; + padding: 0; + color: var(--theia-foreground); +} + +/* Detail pane content sections */ +.ai-configuration-detail>div { + margin-bottom: calc(var(--theia-ui-padding) * 2); +} + +.ai-configuration-detail>div:last-child { + margin-bottom: 0; +} + +/* Agent description and enable checkbox */ +.ai-configuration-detail label { + display: inline-flex; + align-items: center; + gap: calc(var(--theia-ui-padding) / 2); + cursor: pointer; + user-select: none; +} + +.ai-configuration-detail label input[type="checkbox"] { + margin: 0; +} + +/* Variable and Agent reference lists */ +.variable-references, +.function-references { + list-style: none; + padding: 0; + margin: 0; +} + +.variable-reference, +.function-reference { + display: flex; + align-items: center; + gap: var(--theia-ui-padding); + padding: calc(var(--theia-ui-padding) / 2); +} + +/* Variable agent list */ +.variable-agent-list { + list-style: none; + padding: 0; + margin: 0; + display: flex; + flex-direction: column; + gap: 1px; + background-color: var(--theia-widget-border); + border: var(--theia-border-width) solid var(--theia-widget-border); + border-radius: 3px; + overflow: hidden; +} + +.variable-agent-item { + display: flex; + align-items: center; + justify-content: space-between; + padding: calc(var(--theia-ui-padding) / 1.5) var(--theia-ui-padding); + background-color: var(--theia-editor-background); + cursor: pointer; + transition: background-color 0.1s; +} + +.variable-agent-item:hover { + background-color: var(--theia-list-hoverBackground); +} + +.variable-agent-item i { + color: var(--theia-descriptionForeground); + opacity: 0.7; +} + +.agent-tag { + padding: calc(var(--theia-ui-padding) * 2 / 3); + margin-left: var(--theia-ui-padding); + padding-top: 0px; + padding-bottom: 0px; + border-radius: calc(var(--theia-ui-padding) * 2 / 3); + background: hsla(0, 0%, 68%, 0.31); +} + +.configuration-agents-add { + margin: calc(var(--theia-ui-padding) * 2) var(--theia-ui-padding); +} + +.configuration-agents-add button { + width: 100%; + margin-left: 0; +} + +/* Prompt Fragments Configuration Styles */ +.configuration-variables-list, +.token-usage-configuration-container, +.ai-tools-configuration-container, +.ai-prompt-fragments-configuration { + padding: var(--theia-ui-padding); + max-width: 1200px; +} + +.prompt-fragments-header { + display: flex; + justify-content: space-between; + align-items: center; + margin-bottom: 20px; + padding-bottom: 10px; + border-bottom: 1px solid var(--theia-panelTitle-activeBorder); +} + +.prompt-fragments-header h2 { + margin: 0; +} + +.global-actions { + display: flex; + gap: 10px; +} + +.global-action-button { + padding: 6px 12px; + background-color: transparent; + color: var(--theia-foreground); + border: 1px solid var(--theia-border); + border-radius: 4px; + cursor: pointer; + font-size: 12px; + transition: all 0.2s; + display: flex; + align-items: center; + gap: 5px; +} + +.global-action-button:hover { + background-color: var(--theia-list-hoverBackground); +} + +.prompt-fragments-container { + display: flex; + flex-direction: column; + gap: 15px; +} + +.prompt-fragment-group { + border: 1px solid var(--theia-panelTitle-activeBorder); + border-radius: 6px; + overflow: hidden; + margin-bottom: 15px; + background-color: var(--theia-editorWidget-background); +} + +.prompt-customization { + border: 1px solid var(--theia-panelTitle-activeBorder); + border-radius: 6px; + margin-bottom: 10px; + background-color: var(--theia-editor-background); +} + +.prompt-customization.active-customization { + border: 3px solid var(--theia-successBackground); +} + +.prompt-customization-header { + display: flex; + justify-content: space-between; + align-items: center; + padding: 8px 12px; +} + +.prompt-customization-title { + display: flex; + gap: 8px; + align-items: center; +} + +.prompt-customization-actions { + display: flex; + gap: 8px; +} + +.prompt-customization-description { + padding: 0px 15px; + color: var(--theia-descriptionForeground); + font-size: 12px; + margin-bottom: 5px; + font-style: italic; +} + +.expansion-icon { + color: var(--theia-descriptionForeground); + font-size: 14px; +} + +.template-action-button { + background-color: transparent; + color: var(--theia-foreground); + border: 1px solid var(--theia-border); + border-radius: 4px; + padding: 4px 8px; + font-size: 12px; + cursor: pointer; + transition: all 0.2s; + display: flex; + align-items: center; + gap: 4px; +} + +.template-action-button:hover { + background-color: var(--theia-list-hoverBackground); +} + +.template-action-button.reset-button { + color: var(--theia-foreground); + border-color: var(--theia-border); +} + +.template-action-button.config-button { + color: var(--theia-foreground); + border-color: var(--theia-border); +} + +.template-action-button.delete-button { + color: var(--theia-errorForeground); + border-color: var(--theia-errorForeground); +} + +.template-action-button.delete-button:hover { + background-color: var(--theia-errorBackground); +} + +.badge { + font-size: 12px; + padding: 3px 8px; + border-radius: 12px; + font-weight: 500; +} + +.default-variant { + background: hsla(0, 0%, 68%, 0.31); + color: var(--theia-foreground); +} + +.active-indicator { + background-color: var(--theia-successBackground); + color: var(--theia-editor-background); + font-size: 12px; + padding: 2px 6px; + border-radius: 4px; + font-weight: 500; +} + +.selected-indicator { + background-color: var(--theia-charts-blue); + color: var(--theia-editor-background); + font-size: 12px; + padding: 2px 6px; + border-radius: 4px; + font-weight: 500; +} + +.source-uri-button { + display: inline-flex; + align-items: center; + justify-content: center; + background: transparent; + color: var(--theia-foreground); + border: 1px solid var(--theia-border); + border-radius: 4px; + height: 22px; + width: 22px; + margin-left: 8px; + cursor: pointer; + transition: all 0.2s; +} + +.source-uri-button:hover { + background-color: var(--theia-list-hoverBackground); +} + +.no-fragments { + text-align: center; + padding: 30px; + color: var(--theia-descriptionForeground); + font-style: italic; +} + +.prompt-variant-warning { + color: var(--theia-warningForeground); + background: var(--theia-warningBackground); + border-left: 4px solid var(--theia-warningBorder); + padding: 6px 12px; + margin-bottom: 8px; + display: flex; + align-items: center; + gap: 8px; + border-radius: 3px; + font-size: 0.95em; +} + +.prompt-variant-error { + color: var(--theia-errorForeground); + background: var(--theia-errorBackground); + border-left: 4px solid var(--theia-errorBorder); + padding: 6px 12px; + margin-bottom: 8px; + display: flex; + align-items: center; + gap: 8px; + border-radius: 3px; + font-size: 0.95em; +} + +/* Template content collapsable styles */ +.template-content-container { + padding: 10px; + background-color: var(--theia-list-focusBackground); +} + +.template-toggle-button { + display: flex; + align-items: center; + cursor: pointer; + border-radius: 4px; + transition: background-color 0.2s; +} + +.template-toggle-button:hover { + background-color: var(--theia-list-hoverBackground); +} + +.template-expansion-icon { + margin-right: 8px; + color: var(--theia-descriptionForeground); + font-size: 14px; +} + +.template-content { + margin-top: 10px; + padding: 10px; + background-color: var(--theia-editor-inactiveSelectionBackground); + border-radius: 4px; + overflow-x: auto; +} + +.template-content pre { + margin: 0; + white-space: pre-wrap; + word-break: break-word; + font-family: monospace; + font-size: 12px; + line-height: 1.4; +} + +.agent-chips-container { + display: flex; + gap: 6px; +} + +.agent-chip { + display: inline-flex; + align-items: center; + justify-content: center; + background-color: var(--theia-charts-blue); + color: var(--theia-editor-background); + gap: 6px; + padding: 6px 8px; + border-radius: 10px; + font-size: 12px; + font-weight: 500; + box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); + white-space: nowrap; +} + +/* Prompt Variants improvements */ +.prompt-variants-container { + margin-bottom: 20px; +} + +.prompt-fragment-section { + border: 1px solid var(--theia-panelTitle-activeBorder); + border-radius: 6px; + overflow: hidden; + margin-bottom: 15px; + background-color: var(--theia-editorWidget-background); +} + +.prompt-fragment-section.selected-variant { + border: 3px solid var(--theia-charts-blue); +} + +.prompt-fragment-header { + display: flex; + justify-content: space-between; + align-items: center; + padding: var(--theia-ui-padding) var(--theia-ui-padding); + cursor: pointer; + background-color: var(--theia-editor-background); + transition: background-color 0.2s; +} + +.prompt-fragment-header.expanded { + border-bottom: 1px solid var(--theia-panelTitle-activeBorder); +} + +.prompt-fragment-header:hover { + background-color: var(--theia-list-hoverBackground); +} + +.prompt-fragment-title { + display: flex; + align-items: center; + gap: var(--theia-ui-padding); +} + +.prompt-fragment-title h2, +.prompt-fragment-title h4 { + margin-right: var(--theia-ui-padding); + margin: 0; +} + +.prompt-fragment-title h2 { + font-size: var(--theia-ui-font-size2); +} + +.prompt-fragment-title h4 { + font-size: var(--theia-ui-font-size1); +} + +.prompt-fragment-title .active-indicator { + margin-right: calc(var(--theia-ui-padding) / 2); +} + +.prompt-fragment-body { + padding: var(--theia-ui-padding) var(--theia-ui-padding) 0 var(--theia-ui-padding); +} + +.prompt-fragment-description p { + margin-top: 0; + margin-bottom: var(--theia-ui-padding); + color: var(--theia-descriptionForeground); +} + +.section-header { + margin: var(--theia-ui-padding) 0; + color: var(--theia-foreground); + font-size: var(--theia-ui-font-size2); +} + +/* AI Chat View Styles */ +.theia-ResponseNode-Content .disable-message { + font-size: var(--theia-ui-font-size1); + line-height: 1.6; + padding: calc(var(--theia-ui-padding) * 2); +} + +.theia-WelcomeMessage { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + height: 100%; +} + +.theia-WelcomeMessage-Content { + text-align: center; + padding: 0 calc(var(--theia-ui-padding) * 2); + max-width: 350px; +} + +.theia-WelcomeMessage-Content h1 { + margin-top: 0; +} + +.theia-WelcomeMessage-Content h2 { + margin-top: 0; + margin-bottom: calc(var(--theia-ui-padding) * 2); + font-size: var(--theia-ui-font-size3); +} + +.theia-WelcomeMessage-Content p { + font-size: var(--theia-ui-font-size1); + line-height: var(--theia-content-line-height); +} + +.theia-WelcomeMessage-Content p .codicon { + vertical-align: sub; +} + +.theia-WelcomeMessage-Content em { + font-weight: bolder; + font-style: normal; +} + +.theia-WelcomeMessage-Content ul { + text-align: left; + padding-left: 20px; + list-style-position: outside; +} + +.theia-WelcomeMessage-Error .theia-WelcomeMessage-ErrorIcon { + font-size: calc(var(--theia-ui-font-size1) * 3.7); + margin-bottom: calc(var(--theia-ui-padding) * 2.5); +} + +.theia-WelcomeMessage-Actions { + display: flex; + flex-direction: column; + gap: var(--theia-ui-padding); + margin: calc(var(--theia-ui-padding) * 3) 0; +} + +.theia-WelcomeMessage-Actions .theia-button { + padding: 6px 9px; + border-radius: 2px; + cursor: pointer; + font-size: var(--theia-ui-font-size1); + border: 1px solid var(--theia-button-border); + transition: background-color 0.2s; + margin-left: 0; +} + +.theia-WelcomeMessage-Actions .theia-button.main { + background-color: var(--theia-button-background); + color: var(--theia-button-foreground); +} + +.theia-WelcomeMessage-Actions .theia-button.main:hover { + background-color: var(--theia-button-hoverBackground); +} + +.theia-WelcomeMessage-Actions .theia-button.secondary { + background-color: var(--theia-button-secondaryBackground); + color: var(--theia-button-secondaryForeground); +} + +.theia-WelcomeMessage-Actions .theia-button.secondary:hover { + background-color: var(--theia-button-secondaryHoverBackground); +} + +.theia-WelcomeMessage-Hint { + display: block; + margin-top: calc(var(--theia-ui-padding) * 2); + color: var(--theia-descriptionForeground); + font-style: italic; +} + +.theia-WelcomeMessage-Options { + margin: calc(var(--theia-ui-padding) * 3) 0; + text-align: left; +} + +.theia-WelcomeMessage-GuidanceList { + text-align: left; + margin: calc(var(--theia-ui-padding) * 2) 0; + padding-left: 20px; + line-height: 1.6; +} + +.theia-WelcomeMessage-GuidanceList li { + margin-bottom: calc(var(--theia-ui-padding) * 1.3); +} + +.theia-WelcomeMessage-IssuesList { + text-align: left; + margin: calc(var(--theia-ui-padding) * 1.3) 0; + padding-left: 20px; + color: var(--theia-errorForeground); + font-size: 0.9em; + line-height: 1.5; +} + +.theia-WelcomeMessage-IssuesList li { + margin-bottom: calc(var(--theia-ui-padding) * 0.7); +} + +.theia-WelcomeMessage-AgentButtons { + display: flex; + flex-direction: column; + gap: var(--theia-ui-padding); + margin: calc(var(--theia-ui-padding) * 3) 0; +} + +.theia-WelcomeMessage-AgentButton { + display: flex; + align-items: center; + padding: 6px 9px; + background-color: var(--theia-button-background); + color: var(--theia-button-foreground); + border: 1px solid var(--theia-button-border); + border-radius: 2px; + cursor: pointer; + font-size: var(--theia-ui-font-size1); + transition: background-color 0.2s; + text-align: left; + width: 100%; + min-height: 28px; +} + +.theia-WelcomeMessage-AgentButton:hover { + background-color: var(--theia-button-hoverBackground); +} + +.theia-WelcomeMessage-AgentButton-Icon { + font-size: var(--theia-ui-font-size2); + font-weight: bold; + margin-right: var(--theia-ui-padding); + color: var(--theia-button-foreground); +} + +.theia-WelcomeMessage-AgentButton-Label { + font-weight: 500; +} + +.theia-WelcomeMessage-AlternativeOptions { + margin-top: calc(var(--theia-ui-padding) * 4); + padding-top: calc(var(--theia-ui-padding) * 3); + border-top: 1px solid var(--theia-panelTitle-activeBorder); +} + +.theia-WelcomeMessage-OrDivider { + text-align: center; + color: var(--theia-descriptionForeground); + font-size: 0.9em; + margin: 0 0 calc(var(--theia-ui-padding) * 2.5) 0; + text-transform: uppercase; + letter-spacing: 0.5px; +} + +.theia-WelcomeMessage-RecommendedNote { + font-size: 0.9em; + color: var(--theia-descriptionForeground); + margin: calc(var(--theia-ui-padding) * 1.3) 0 calc(var(--theia-ui-padding) * 2) 0; + font-weight: 500; +} + +/* + * AI Tools Configuration Widget Styles + * Only touch styles in this section for the tools configuration widget + */ +.ai-tools-configuration-header { + display: flex; + align-items: center; + gap: var(--theia-ui-padding); + margin-bottom: calc(var(--theia-ui-padding) * 2); + padding: var(--theia-ui-padding); + background-color: var(--theia-editor-background); + border: var(--theia-border-width) solid var(--theia-widget-border); + border-radius: 3px; +} + +.ai-tools-configuration-default-section { + margin-bottom: calc(var(--theia-ui-padding) * 2); +} + +.ai-tools-configuration-default-label { + font-weight: bold; + margin-bottom: var(--theia-ui-padding); +} + +.ai-tools-configuration-default-select { + font-size: 14px; + padding: var(--theia-ui-padding); +} + +.ai-tools-configuration-tools-label { + font-weight: bold; + margin-bottom: var(--theia-ui-padding); +} + +.ai-tools-configuration-tools-list { + list-style: none; + padding: 0; + margin: 0; +} + +.ai-tools-configuration-tool-item { + display: flex; + align-items: center; + margin-bottom: calc(var(--theia-ui-padding) * 2); + border-radius: 4px; + padding: var(--theia-ui-padding); + transition: background 0.2s, opacity 0.2s; +} + +.ai-tools-configuration-tool-item.default { + opacity: 0.5; + background: none; +} + +.ai-tools-configuration-tool-item.custom { + opacity: 1; + background: var(--theia-editor-inactiveSelectionBackground); +} + +.ai-tools-configuration-tool-name { + flex: 1; +} + +.ai-tools-configuration-tool-select { + margin-right: var(--theia-ui-padding); +} + +.ai-tools-configuration-tool-icon { + font-size: 18px; +} + +/* End AI Tools Configuration Widget Styles */ + +/* AI Model Aliases and Language Model Renderer extracted styles */ +.ai-model-alias-list { + width: 25%; +} + +.ai-alias-detail-title { + padding-left: 0; + padding-bottom: var(--theia-ui-padding); +} + +.ai-alias-detail-description { + padding-bottom: var(--theia-ui-padding); +} + +.ai-alias-detail-selected-model { + margin-bottom: calc(var(--theia-ui-padding) * 2); +} + +.ai-language-model-item-ready { + font-style: normal; +} + +.ai-language-model-item-not-ready { + font-style: italic; +} + +.ai-alias-priority-item-resolved { + font-weight: bold; +} + +.ai-alias-priority-item-ready { + font-style: inherit; +} + +.ai-alias-priority-item-not-ready { + font-style: italic; +} + +.ai-alias-detail-defaults { + margin-bottom: var(--theia-ui-padding); +} + +.ai-model-default-not-ready { + font-style: italic; + color: var(--theia-descriptionForeground); +} + +.ai-alias-defaults-hint { + color: var(--theia-descriptionForeground); + margin-top: var(--theia-ui-padding); +} + +.ai-alias-evaluates-to-container { + margin-top: var(--theia-ui-padding); + margin-bottom: var(--theia-ui-padding); +} + +.ai-alias-evaluates-to-label { + font-weight: 600; +} + +.ai-model-status-ready { + color: var(--theia-ansi-green-color); + margin-left: var(--theia-ui-padding); +} + +.ai-model-status-not-ready { + color: var(--theia-ansi-red-color); + margin-left: var(--theia-ui-padding); +} + +.ai-alias-evaluates-to-unresolved { + margin-left: var(--theia-ui-padding); + color: var(--theia-descriptionForeground); +} + +.ai-alias-detail-agents { + margin-bottom: var(--theia-ui-padding); +} + +.ai-alias-agent-id { + color: var(--theia-descriptionForeground); + margin-left: var(--theia-ui-padding); +} + +.ai-alias-no-agents { + color: var(--theia-descriptionForeground); +} + +/* End AI Model Aliases and Language Model Renderer extracted styles */ + +/* Token Usage Configuration Styles */ +.token-usage-configuration-title { + margin: 0 0 calc(var(--theia-ui-padding) * 2) 0; + border-bottom: 1px solid var(--theia-widget-border); + padding-bottom: var(--theia-ui-padding); +} + +.token-usage-controls { + display: flex; + justify-content: flex-end; + margin-bottom: calc(var(--theia-ui-padding) * 2); +} + +.token-usage-refresh-button { + display: inline-flex; + align-items: center; + background-color: var(--theia-button-background); + color: var(--theia-button-foreground); + border: none; + border-radius: 4px; + padding: var(--theia-ui-padding) calc(var(--theia-ui-padding) * 2); + font-size: var(--theia-ui-font-size1); + cursor: pointer; + transition: background-color 0.2s; +} + +.token-usage-refresh-button:hover { + background-color: var(--theia-button-hoverBackground); +} + +.token-usage-refresh-button i { + margin-right: var(--theia-ui-padding); +} + +.token-usage-table-container { + overflow-x: auto; + border-radius: var(--theia-ui-padding); + background-color: var(--theia-editorWidget-background); +} + +.token-usage-table { + width: 100%; + border-collapse: collapse; +} + +.token-usage-header th { + text-align: left; + padding: 10px; + background-color: var(--theia-editor-background); + color: var(--theia-descriptionForeground); + font-weight: bold; +} + +.token-usage-model-column { + width: 25%; +} + +.token-usage-column { + width: 18.75%; +} + +.token-usage-row td { + padding: var(--theia-ui-padding); +} + +.token-usage-row:hover { + background-color: var(--theia-list-hoverBackground); +} + +.token-usage-summary-row td { + padding: var(--theia-ui-padding); + background-color: var(--theia-editor-background); + color: var(--theia-foreground); +} + +.token-usage-model-cell { + font-weight: 500; +} + +.token-usage-notes { + margin-top: calc(var(--theia-ui-padding) * 2); + color: var(--theia-descriptionForeground); +} + +.token-usage-note { + display: flex; + align-items: center; + font-size: var(--theia-ui-font-size1); +} + +.token-usage-note i { + margin-right: var(--theia-ui-padding); +} + +/* Common utility classes for configuration widgets */ +.ai-empty-state-content { + padding: var(--theia-ui-padding); + text-align: center; + color: var(--theia-descriptionForeground); +} + +.ai-configuration-footer-total { + margin-top: var(--theia-ui-padding); +} + +.ai-configuration-footer-total-row { + font-weight: 600; + border-top: 2px solid var(--theia-widget-border); +} + +.ai-configuration-info-box { + margin-top: var(--theia-ui-padding); + padding: var(--theia-ui-padding); + background-color: var(--theia-editor-background); + border-radius: 3px; +} + +.ai-configuration-info-text { + margin: 0; + color: var(--theia-descriptionForeground); +} + +.ai-configuration-info-icon { + margin-right: calc(var(--theia-ui-padding) / 2); +} + +.ai-variable-name-cell { + font-weight: 500; +} + +.ai-variable-description-cell { + color: var(--theia-descriptionForeground); +} + +.ai-configuration-warning-text { + color: var(--theia-warningForeground); +} + +.ai-agent-description { + margin-bottom: calc(var(--theia-ui-padding) * 2); + color: var(--theia-descriptionForeground); + line-height: 1.5; +} + +/* ── Layout overrides ──────────────────────────────────────────────────────── */ + +/* Hide the right sidebar tab strip */ +#theia-right-content-panel .theia-app-right.lm-TabBar .lm-TabBar-content-container { + display: none; +} + +/* Todo Tool Renderer Styles */ +.todo-tool-container { + display: flex; + flex-direction: column; + padding: var(--theia-ui-padding); +} + +.todo-tool-header { + display: flex; + align-items: center; + gap: var(--theia-ui-padding); + margin-bottom: var(--theia-ui-padding); + color: var(--theia-foreground); +} + +.todo-tool-title { + font-weight: 600; +} + +.todo-tool-list { + display: flex; + flex-direction: column; + gap: 4px; +} + +.todo-tool-item { + display: flex; + align-items: center; + gap: var(--theia-ui-padding); +} + +.todo-tool-icon { + display: flex; + align-items: center; + justify-content: center; + width: 16px; + flex-shrink: 0; +} + +.todo-status-pending .todo-tool-icon { + color: var(--theia-descriptionForeground); +} + +.todo-status-in_progress .todo-tool-icon { + color: var(--theia-progressBar-background); +} + +.todo-status-completed .todo-tool-icon { + color: var(--theia-successBackground); +} + +.todo-status-completed .todo-tool-text { + text-decoration: line-through; + opacity: 0.7; +} + +.todo-tool-empty { + color: var(--theia-descriptionForeground); + font-style: italic; +} diff --git a/packages/ai-ide/src/browser/style/vibn-overrides.css b/packages/ai-ide/src/browser/style/vibn-overrides.css new file mode 100644 index 0000000..3095525 --- /dev/null +++ b/packages/ai-ide/src/browser/style/vibn-overrides.css @@ -0,0 +1,10 @@ +/* ── Vibn IDE Layout Overrides ────────────────────────────────────────────── + * Edit this file and run: npm run compile (30s) then restart Theia + * CSS changes here do NOT require npm run build:browser + * because this file is loaded dynamically via the backend, not webpack. + * ─────────────────────────────────────────────────────────────────────────── */ + +/* Hide the right sidebar tab strip */ +#theia-right-content-panel .theia-app-right.lm-TabBar .lm-TabBar-content-container { + display: none; +} diff --git a/packages/ai-ide/src/browser/style/widgets/mcp-configuration.css b/packages/ai-ide/src/browser/style/widgets/mcp-configuration.css new file mode 100644 index 0000000..fff8b1a --- /dev/null +++ b/packages/ai-ide/src/browser/style/widgets/mcp-configuration.css @@ -0,0 +1,261 @@ +/******************************************************************************** + * Copyright (C) 2025 EclipseSource GmbH. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the Eclipse + * Public License v. 2.0 are satisfied: GNU General Public License, version 2 + * with the GNU Classpath Exception which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 + ********************************************************************************/ + +/* MCP Server Configuration Widget Styles */ + +/* Container */ +.mcp-configuration-container { + padding: calc(var(--theia-ui-padding) * 2); + max-width: 1200px; +} + +.mcp-no-servers { + padding: calc(var(--theia-ui-padding) * 3); + text-align: center; + color: var(--theia-descriptionForeground); +} + +/* Server Card */ +.mcp-server-card { + border: var(--theia-border-width) solid var(--theia-widget-border); + border-radius: 3px; + margin-bottom: calc(var(--theia-ui-padding) * 2); + background-color: var(--theia-editor-background); + overflow: hidden; +} + +/* Server Header */ +.mcp-server-header { + display: flex; + justify-content: space-between; + align-items: center; + padding: calc(var(--theia-ui-padding) * 1.5) calc(var(--theia-ui-padding) * 2); + background-color: var(--theia-editorWidget-background); + border-bottom: var(--theia-border-width) solid var(--theia-widget-border); +} + +.mcp-server-name { + font-weight: 600; + font-size: var(--theia-ui-font-size2); + color: var(--theia-foreground); +} + +.mcp-server-header-controls { + display: flex; + align-items: center; + gap: calc(var(--theia-ui-padding)); +} + +.mcp-status-container { + display: flex; + align-items: center; +} + +/* Status Badge */ +.mcp-status-badge { + padding: calc(var(--theia-ui-padding) / 4) calc(var(--theia-ui-padding) / 1.5); + border-radius: 3px; + font-size: var(--theia-ui-font-size0); + font-weight: 600; + display: inline-block; +} + +.mcp-error-indicator { + display: inline-flex; + align-items: center; + justify-content: center; + width: 18px; + height: 18px; + border-radius: 50%; + background-color: var(--theia-errorBackground); + color: var(--theia-errorForeground); + font-size: calc(var(--theia-ui-font-size0) * 0.85); + font-weight: 600; + cursor: pointer; + margin-left: calc(var(--theia-ui-padding) / 2); +} + +/* Action Button */ +.mcp-action-button { + background: transparent; + border: none; + cursor: pointer; + padding: calc(var(--theia-ui-padding) / 2); + color: var(--theia-icon-foreground); + display: inline-flex; + align-items: center; + justify-content: center; + border-radius: 3px; + transition: background-color 0.2s; + font-size: var(--theia-ui-font-size2); +} + +.mcp-action-button:disabled { + cursor: default; +} + +.mcp-action-button:disabled:hover { + background: inherit; +} + +.mcp-action-button:hover { + background-color: var(--theia-list-hoverBackground); +} + +/* Server Content - Property Rows */ +.mcp-server-content { + padding: calc(var(--theia-ui-padding) * 2); + display: flex; + flex-direction: column; + gap: calc(var(--theia-ui-padding)); +} + +.mcp-property-row { + display: grid; + grid-template-columns: 6em 1fr; + gap: calc(var(--theia-ui-padding) * 2); + align-items: start; + padding: calc(var(--theia-ui-padding) / 2) 0; +} + +.mcp-property-label { + font-weight: 500; + color: var(--theia-descriptionForeground); + text-align: left; +} + +.mcp-property-value { + color: var(--theia-foreground); + word-break: break-word; +} + +.mcp-property-value code { + background-color: var(--theia-editorWidget-background); + padding: calc(var(--theia-ui-padding) / 4) calc(var(--theia-ui-padding) / 2); + border-radius: 3px; + font-family: var(--monaco-monospace-font); + font-size: var(--theia-ui-font-size0); + border: var(--theia-border-width) solid var(--theia-widget-border); +} + +.mcp-env-entry { + margin-bottom: calc(var(--theia-ui-padding) / 4); +} + +.mcp-env-entry:last-child { + margin-bottom: 0; +} + +.mcp-autostart-badge { + border-radius: 3px; + font-weight: 600; +} + +/* Toggle Indicator */ +.mcp-toggle-indicator { + width: 16px; + height: 16px; + display: flex; + align-items: center; + justify-content: center; + margin-right: calc(var(--theia-ui-padding) / 2); +} + +.mcp-toggle-icon { + display: inline-block; + transition: transform 0.2s ease; + font-size: calc(var(--theia-ui-font-size0) * 0.85); +} + +/* Tools Section */ +.mcp-tools-section { + padding: calc(var(--theia-ui-padding) * 2); + padding-top: calc(var(--theia-ui-padding) * 1.5); + border-top: var(--theia-border-width) solid var(--theia-widget-border); + background-color: var(--theia-editor-background); +} + +.mcp-tools-header { + display: flex; + align-items: center; + cursor: pointer; + user-select: none; + padding: calc(var(--theia-ui-padding) / 2) 0; +} + +.mcp-tools-header:hover { + background-color: var(--theia-list-hoverBackground); +} + +.mcp-tools-label-container { + flex-grow: 1; +} + +.mcp-tools-actions { + display: flex; + gap: calc(var(--theia-ui-padding) / 2); +} + +.mcp-section-label { + font-weight: 600; + color: var(--theia-descriptionForeground); + font-size: var(--theia-ui-font-size0); +} + +.mcp-tools-list { + margin-top: calc(var(--theia-ui-padding)); + padding: calc(var(--theia-ui-padding)); + background-color: var(--theia-editorWidget-background); + border-radius: 3px; + border: var(--theia-border-width) solid var(--theia-widget-border); +} + +.mcp-tool-item { + display: flex; + align-items: center; + padding: calc(var(--theia-ui-padding) / 2) 0; + border-bottom: var(--theia-border-width) solid var(--theia-widget-border); +} + +.mcp-tool-item:last-child { + border-bottom: none; +} + +.mcp-tool-content { + flex-grow: 1; + font-size: var(--theia-ui-font-size0); +} + +.mcp-tool-actions { + display: flex; + gap: calc(var(--theia-ui-padding) / 2); +} + +.mcp-copy-tool-button { + background: transparent; + border: none; + padding: calc(var(--theia-ui-padding) / 4); + cursor: pointer; + font-size: var(--theia-ui-font-size0); + color: var(--theia-icon-foreground); + white-space: nowrap; + opacity: 0.8; + transition: opacity 0.1s; +} + +.mcp-copy-tool-button:hover { + opacity: 1; +} diff --git a/packages/ai-ide/src/browser/style/widgets/model-aliases-configuration.css b/packages/ai-ide/src/browser/style/widgets/model-aliases-configuration.css new file mode 100644 index 0000000..479ed22 --- /dev/null +++ b/packages/ai-ide/src/browser/style/widgets/model-aliases-configuration.css @@ -0,0 +1,74 @@ +/******************************************************************************** + * Copyright (C) 2025 EclipseSource GmbH. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the Eclipse + * Public License v. 2.0 are satisfied: GNU General Public License, version 2 + * with the GNU Classpath Exception which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 + ********************************************************************************/ + +/* Model Aliases Configuration Widget Specific Styles */ + +/* Description styling */ +.ai-alias-detail-description { + color: var(--theia-descriptionForeground); + margin-bottom: calc(var(--theia-ui-padding) * 2); + line-height: 1.5; +} + +/* Priority list styling */ +.ai-alias-priority-item-resolved { + font-weight: 600; + color: var(--theia-textLink-foreground); +} + +.ai-alias-priority-item-ready { + color: var(--theia-foreground); +} + +.ai-model-default-not-ready { + color: var(--theia-descriptionForeground); +} + +.ai-model-status-ready { + color: var(--theia-successForeground, #89d185); + margin-left: 4px; +} + +.ai-model-status-not-ready { + color: var(--theia-errorForeground); + margin-left: 4px; +} + +/* Evaluates to section */ +.ai-alias-evaluates-to-value { + color: var(--theia-textLink-foreground); + font-weight: 500; +} + +.ai-alias-evaluates-to-unresolved { + color: var(--theia-descriptionForeground); + font-style: italic; +} + +/* Agent list styling */ +.ai-alias-agent-id { + color: var(--theia-descriptionForeground); + font-size: 0.9em; +} + +/* Model selection dropdown */ +.ai-language-model-item-ready { + color: var(--theia-foreground); +} + +.ai-language-model-item-not-ready { + color: var(--theia-descriptionForeground); +} diff --git a/packages/ai-ide/src/browser/summarize-session-command-contribution.ts b/packages/ai-ide/src/browser/summarize-session-command-contribution.ts new file mode 100644 index 0000000..3eef1a5 --- /dev/null +++ b/packages/ai-ide/src/browser/summarize-session-command-contribution.ts @@ -0,0 +1,152 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { ChatAgentLocation, ChatService } from '@theia/ai-chat/lib/common'; +import { CommandContribution, CommandRegistry, CommandService } from '@theia/core'; +import { TaskContextStorageService, TaskContextService } from '@theia/ai-chat/lib/browser/task-context-service'; +import { injectable, inject } from '@theia/core/shared/inversify'; +import { AI_SUMMARIZE_SESSION_AS_TASK_FOR_CODER, AI_UPDATE_TASK_CONTEXT_COMMAND, AI_EXECUTE_PLAN_WITH_CODER } from '../common/summarize-session-commands'; +import { CoderAgent } from './coder-agent'; +import { TASK_CONTEXT_VARIABLE } from '@theia/ai-chat/lib/browser/task-context-variable'; +import { TASK_CONTEXT_CREATE_PROMPT_ID, TASK_CONTEXT_UPDATE_PROMPT_ID } from '../common/task-context-prompt-template'; +import { FILE_VARIABLE } from '@theia/ai-core/lib/browser/file-variable-contribution'; +import { AIVariableResolutionRequest } from '@theia/ai-core'; +import { FileService } from '@theia/filesystem/lib/browser/file-service'; +import { WorkspaceService } from '@theia/workspace/lib/browser'; +import { AICommandHandlerFactory } from '@theia/ai-core/lib/browser'; + +@injectable() +export class SummarizeSessionCommandContribution implements CommandContribution { + @inject(ChatService) + protected readonly chatService: ChatService; + + @inject(TaskContextService) + protected readonly taskContextService: TaskContextService; + + @inject(CommandService) + protected readonly commandService: CommandService; + + @inject(CoderAgent) + protected readonly coderAgent: CoderAgent; + + @inject(TaskContextStorageService) + protected readonly taskContextStorageService: TaskContextStorageService; + + @inject(FileService) + protected readonly fileService: FileService; + + @inject(WorkspaceService) + protected readonly wsService: WorkspaceService; + + @inject(AICommandHandlerFactory) + protected readonly commandHandlerFactory: AICommandHandlerFactory; + + registerCommands(registry: CommandRegistry): void { + registry.registerCommand(AI_UPDATE_TASK_CONTEXT_COMMAND, this.commandHandlerFactory({ + execute: async () => { + const activeSession = this.chatService.getActiveSession(); + + if (!activeSession) { + return; + } + + // Check if there is an existing summary for this session + if (!this.taskContextService.hasSummary(activeSession)) { + // If no summary exists, create one first + await this.taskContextService.summarize(activeSession, TASK_CONTEXT_CREATE_PROMPT_ID); + } else { + // Update existing summary + await this.taskContextService.update(activeSession, TASK_CONTEXT_UPDATE_PROMPT_ID); + } + } + })); + + registry.registerCommand(AI_SUMMARIZE_SESSION_AS_TASK_FOR_CODER, this.commandHandlerFactory({ + execute: async () => { + const activeSession = this.chatService.getActiveSession(); + + if (!activeSession) { + return; + } + + const summaryId = await this.taskContextService.summarize(activeSession, TASK_CONTEXT_CREATE_PROMPT_ID); + + // Open the summary in a new editor + await this.taskContextStorageService.open(summaryId); + + // Add the summary file to the context of the active Architect session + const summary = this.taskContextService.getAll().find(s => s.id === summaryId); + if (summary?.uri) { + if (await this.fileService.exists(summary?.uri)) { + const wsRelativePath = await this.wsService.getWorkspaceRelativePath(summary?.uri); + // Create a file variable for the summary + const fileVariable: AIVariableResolutionRequest = { + variable: FILE_VARIABLE, + arg: wsRelativePath + }; + + // Add the file to the active session's context + activeSession.model.context.addVariables(fileVariable); + } + + // Create a new session with the coder agent + const newSession = this.chatService.createSession(ChatAgentLocation.Panel, { focus: true }, this.coderAgent); + const summaryVariable = { variable: TASK_CONTEXT_VARIABLE, arg: summaryId }; + newSession.model.context.addVariables(summaryVariable); + } + } + })); + + registry.registerCommand(AI_EXECUTE_PLAN_WITH_CODER, this.commandHandlerFactory({ + execute: async (taskContextId?: string) => { + const activeSession = this.chatService.getActiveSession(); + + if (!activeSession) { + return; + } + + // Find the task context by ID or fall back to most recent for this session + let existingTaskContext; + if (taskContextId) { + existingTaskContext = this.taskContextService.getAll().find(s => s.id === taskContextId); + } else { + const sessionContexts = this.taskContextService.getAll().filter(s => s.sessionId === activeSession.id); + existingTaskContext = sessionContexts[sessionContexts.length - 1]; + } + + if (!existingTaskContext) { + console.warn('No task context found. Use createTaskContext to create a plan first.'); + return; + } + + if (existingTaskContext.uri) { + if (await this.fileService.exists(existingTaskContext.uri)) { + const wsRelativePath = await this.wsService.getWorkspaceRelativePath(existingTaskContext.uri); + const fileVariable: AIVariableResolutionRequest = { + variable: FILE_VARIABLE, + arg: wsRelativePath + }; + activeSession.model.context.addVariables(fileVariable); + } + } + + const newSession = this.chatService.createSession(ChatAgentLocation.Panel, { focus: true }, this.coderAgent); + const summaryVariable = { variable: TASK_CONTEXT_VARIABLE, arg: existingTaskContext.id }; + newSession.model.context.addVariables(summaryVariable); + } + })); + } +} diff --git a/packages/ai-ide/src/browser/task-background-summary-variable.ts b/packages/ai-ide/src/browser/task-background-summary-variable.ts new file mode 100644 index 0000000..7c743e3 --- /dev/null +++ b/packages/ai-ide/src/browser/task-background-summary-variable.ts @@ -0,0 +1,79 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { MaybePromise, nls } from '@theia/core'; +import { injectable } from '@theia/core/shared/inversify'; +import { + AIVariable, + ResolvedAIVariable, + AIVariableContribution, + AIVariableService, + AIVariableResolutionRequest, + AIVariableContext, + AIVariableResolverWithVariableDependencies, + AIVariableArg +} from '@theia/ai-core'; +import { ChatSessionContext } from '@theia/ai-chat'; +import { TASK_CONTEXT_VARIABLE } from '@theia/ai-chat/lib/browser/task-context-variable'; +import { TASK_CONTEXT_SUMMARY_VARIABLE_ID } from '../common/context-variables'; + +export const TASK_CONTEXT_SUMMARY_VARIABLE: AIVariable = { + id: TASK_CONTEXT_SUMMARY_VARIABLE_ID, + description: nls.localize('theia/ai/core/taskContextSummary/description', 'Resolves all task context items present in the session context.'), + name: TASK_CONTEXT_SUMMARY_VARIABLE_ID, +}; + +@injectable() +/** + * @class provides a summary of all TaskContextVariables in the context of a given session. Oriented towards use in prompts. + */ +export class TaskContextSummaryVariableContribution implements AIVariableContribution, AIVariableResolverWithVariableDependencies { + registerVariables(service: AIVariableService): void { + service.registerResolver(TASK_CONTEXT_SUMMARY_VARIABLE, this); + } + + canResolve(request: AIVariableResolutionRequest, context: AIVariableContext): MaybePromise { + return request.variable.name === TASK_CONTEXT_SUMMARY_VARIABLE.name ? 50 : 0; + } + + async resolve( + request: AIVariableResolutionRequest, + context: AIVariableContext, + resolveDependency?: (variable: AIVariableArg) => Promise + ): Promise { + if (!resolveDependency || !ChatSessionContext.is(context) || request.variable.name !== TASK_CONTEXT_SUMMARY_VARIABLE.name) { return undefined; } + const allSummaryRequests = context.model.context.getVariables().filter(candidate => candidate.variable.id === TASK_CONTEXT_VARIABLE.id); + if (!allSummaryRequests.length) { return { ...request, value: '' }; } + const allSummaries = await Promise.all(allSummaryRequests.map(summaryRequest => resolveDependency(summaryRequest).then(resolved => resolved?.value))); + const value = `# Current Task Context + +The following task context defines the task you are expected to work on. It was explicitly provided by the user and represents your primary objective. +This context is authoritative: follow it unless you identify issues (e.g., outdated assumptions, technical conflicts, or unclear steps). +The task context may contain errors or outdated assumptions. You are expected to identify and report these, not blindly execute incorrect instructions. +Note: This context is a snapshot from the start of the conversation and will not update during this run. +When deviating from the plan: +- Explain the deviation and your reasoning before proceeding +- Summarize all deviations at the end of your response, and suggest updates to the task context if the plan needs revision + +--- + +${allSummaries.map((content, index) => `## Task ${index + 1}\n\n${content}`).join('\n\n')}`; + return { + ...request, + value + }; + } +} diff --git a/packages/ai-ide/src/browser/task-context-agent.ts b/packages/ai-ide/src/browser/task-context-agent.ts new file mode 100644 index 0000000..160ded0 --- /dev/null +++ b/packages/ai-ide/src/browser/task-context-agent.ts @@ -0,0 +1,40 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { Agent, LanguageModelRequirement } from '@theia/ai-core'; +import { nls } from '@theia/core'; +import { injectable } from '@theia/core/shared/inversify'; +import { taskContextSystemVariants, taskContextTemplateVariants, taskContextUpdateVariants } from '../common/task-context-prompt-template'; + +@injectable() +export class TaskContextAgent implements Agent { + static ID = 'TaskContext'; + + id = TaskContextAgent.ID; + name = 'TaskContext'; + description = nls.localize('theia/ai/taskcontext/taskContextAgent/description', + 'An AI assistant that analyzes chat sessions and creates structured task summaries for coding tasks. ' + + 'This agent specializes in extracting key information from conversations and formatting them into comprehensive task context documents that can be used by other agents.'); + + variables = []; + prompts = [taskContextSystemVariants, taskContextTemplateVariants, taskContextUpdateVariants]; + languageModelRequirements: LanguageModelRequirement[] = [{ + purpose: 'TaskContext Creation/Update', + identifier: 'default/code', + }]; + agentSpecificVariables = []; + functions = []; +} diff --git a/packages/ai-ide/src/browser/task-context-file-storage-service.ts b/packages/ai-ide/src/browser/task-context-file-storage-service.ts new file mode 100644 index 0000000..63fe642 --- /dev/null +++ b/packages/ai-ide/src/browser/task-context-file-storage-service.ts @@ -0,0 +1,225 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { Summary, SummaryMetadata, TaskContextStorageService } from '@theia/ai-chat/lib/browser/task-context-service'; +import { InMemoryTaskContextStorage } from '@theia/ai-chat/lib/browser/task-context-storage-service'; +import { inject, injectable, postConstruct } from '@theia/core/shared/inversify'; +import { DisposableCollection, EOL, Emitter, ILogger, Path, PreferenceService, URI, unreachable } from '@theia/core'; +import { OpenerService, open } from '@theia/core/lib/browser'; +import { FileService } from '@theia/filesystem/lib/browser/file-service'; +import { WorkspaceService } from '@theia/workspace/lib/browser'; +import * as yaml from 'js-yaml'; +import { FileChange, FileChangeType } from '@theia/filesystem/lib/common/files'; +import { TASK_CONTEXT_STORAGE_DIRECTORY_PREF } from '../common/workspace-preferences'; +import { BinaryBuffer } from '@theia/core/lib/common/buffer'; + +@injectable() +export class TaskContextFileStorageService implements TaskContextStorageService { + @inject(InMemoryTaskContextStorage) protected readonly inMemoryStorage: InMemoryTaskContextStorage; + @inject(PreferenceService) protected readonly preferenceService: PreferenceService; + @inject(WorkspaceService) protected readonly workspaceService: WorkspaceService; + @inject(FileService) protected readonly fileService: FileService; + @inject(OpenerService) protected readonly openerService: OpenerService; + @inject(ILogger) protected readonly logger: ILogger; + protected readonly onDidChangeEmitter = new Emitter(); + readonly onDidChange = this.onDidChangeEmitter.event; + + protected sanitizeLabel(label: string): string { + return label.replace(/^[^\p{L}\p{N}]+/ug, ''); + } + + protected getStorageLocation(): URI | undefined { + if (!this.workspaceService.opened) { return; } + const values = this.preferenceService.inspect(TASK_CONTEXT_STORAGE_DIRECTORY_PREF); + const configuredPath = values?.globalValue === undefined ? values?.defaultValue : values?.globalValue; + if (!configuredPath || typeof configuredPath !== 'string') { return; } + const asPath = new Path(configuredPath); + return asPath.isAbsolute ? new URI(configuredPath) : this.workspaceService.tryGetRoots().at(0)?.resource.resolve(configuredPath); + } + + @postConstruct() + protected init(): void { + this.doInit(); + } + + protected get ready(): Promise { + return Promise.all([ + this.workspaceService.ready, + this.preferenceService.ready, + ]).then(() => undefined); + } + + protected async doInit(): Promise { + await this.ready; + this.watchStorage(); + this.preferenceService.onPreferenceChanged(e => { + if (e.preferenceName === TASK_CONTEXT_STORAGE_DIRECTORY_PREF) { + this.watchStorage().catch(error => this.logger.error(error)); + } + }); + } + + protected toDisposeOnStorageChange?: DisposableCollection; + protected async watchStorage(): Promise { + const newStorage = await this.getStorageLocation(); + this.toDisposeOnStorageChange?.dispose(); + this.toDisposeOnStorageChange = undefined; + if (!newStorage) { return; } + this.toDisposeOnStorageChange = new DisposableCollection( + this.fileService.watch(newStorage, { recursive: true, excludes: [] }), + this.fileService.onDidFilesChange(event => { + const relevantChanges = event.changes.filter(candidate => newStorage.isEqualOrParent(candidate.resource)); + this.handleChanges(relevantChanges); + }), + { dispose: () => this.clearInMemoryStorage() }, + ); + this.cacheNewTasks(newStorage).catch(this.logger.error.bind(this.logger)); + } + + protected async handleChanges(changes: FileChange[]): Promise { + await Promise.all(changes.map(change => { + switch (change.type) { + case FileChangeType.DELETED: return this.deleteFileReference(change.resource); + case FileChangeType.ADDED: + case FileChangeType.UPDATED: + return this.readFile(change.resource); + default: return unreachable(change.type); + } + })); + } + + protected clearInMemoryStorage(): void { + this.inMemoryStorage.clear(); + } + + protected deleteFileReference(uri: URI): boolean { + if (this.inMemoryStorage.delete(uri.path.base)) { + return true; + } + for (const summary of this.inMemoryStorage.getAll()) { + if (summary.uri?.isEqual(uri)) { + return this.inMemoryStorage.delete(summary.id); + } + } + return false; + } + + protected async cacheNewTasks(storageLocation: URI): Promise { + const contents = await this.fileService.resolve(storageLocation).catch(() => undefined); + if (!contents?.children?.length) { return; } + await Promise.all(contents.children.map(child => this.readFile(child.resource))); + this.onDidChangeEmitter.fire(); + } + + protected async readFile(uri: URI): Promise { + const content = await this.fileService.read(uri).then(read => read.value).catch(() => undefined); + if (content === undefined) { return; } + const { frontmatter, body } = this.maybeReadFrontmatter(content); + const rawLabel = frontmatter?.label || uri.path.base.slice(0, (-1 * uri.path.ext.length) || uri.path.base.length); + const summary = { + ...frontmatter, + summary: body, + label: this.sanitizeLabel(rawLabel), + uri, + id: frontmatter?.id || frontmatter?.sessionId || uri.path.base + }; + const existingSummary = !frontmatter?.id && summary.sessionId && this.getAll().find(candidate => candidate.sessionId === summary.sessionId); + if (existingSummary) { + summary.id = existingSummary.id; + } + this.inMemoryStorage.store(summary); + } + + async store(summary: Summary): Promise { + await this.ready; + const label = this.sanitizeLabel(summary.label); + const storageLocation = this.getStorageLocation(); + if (storageLocation) { + const frontmatter = { + id: summary.id, + sessionId: summary.sessionId, + date: new Date().toISOString(), + label, + }; + const derivedName = label.trim().replace(/[^\p{L}\p{N}]/ug, '-').replace(/^-+|-+$/g, ''); + const filename = (derivedName.length > 32 ? derivedName.slice(0, derivedName.indexOf('-', 32)) : derivedName) + '.md'; + const content = yaml.dump(frontmatter).trim() + `${EOL}---${EOL}` + summary.summary; + const uri = storageLocation.resolve(filename); + summary.uri = uri; + await this.fileService.writeFile(uri, BinaryBuffer.fromString(content)); + } + this.inMemoryStorage.store({ ...summary, label }); + this.onDidChangeEmitter.fire(); + } + + getAll(): Summary[] { + return this.inMemoryStorage.getAll(); + } + + async get(identifier: string): Promise { + const cached = this.inMemoryStorage.get(identifier); + if (!cached?.uri) { + return cached; + } + // Read fresh content from disk + const content = await this.fileService.read(cached.uri).then(read => read.value).catch(reason => { + this.logger.error(`Failed to read file ${cached.uri}: ${reason}`); + return undefined; + }); + if (content === undefined) { + return cached; // Fall back to cache if read fails + } + const { body } = this.maybeReadFrontmatter(content); + return { ...cached, summary: body }; + } + + async delete(identifier: string): Promise { + const summary = this.inMemoryStorage.get(identifier); + if (summary?.uri) { + await this.fileService.delete(summary.uri); + } + this.inMemoryStorage.delete(identifier); + if (summary) { + this.onDidChangeEmitter.fire(); + } + return !!summary; + } + + protected maybeReadFrontmatter(content: string): { body: string, frontmatter: SummaryMetadata | undefined } { + const frontmatterEnd = content.indexOf('---'); + if (frontmatterEnd !== -1) { + try { + const frontmatter = yaml.load(content.slice(0, frontmatterEnd)); + if (this.hasLabel(frontmatter)) { + return { frontmatter, body: content.slice(frontmatterEnd + 3).trim() }; + } + } catch { /* Probably not frontmatter, then. */ } + } + return { body: content, frontmatter: undefined }; + } + + protected hasLabel(candidate: unknown): candidate is SummaryMetadata { + return !!candidate && typeof candidate === 'object' && !Array.isArray(candidate) && 'label' in candidate && typeof candidate.label === 'string'; + } + + async open(identifier: string): Promise { + const summary = await this.get(identifier); + if (!summary) { + throw new Error('Unable to open requested task context: none found with specified identifier.'); + } + await (summary.uri ? open(this.openerService, summary.uri) : this.inMemoryStorage.open(identifier)); + } +} diff --git a/packages/ai-ide/src/browser/task-context-functions.ts b/packages/ai-ide/src/browser/task-context-functions.ts new file mode 100644 index 0000000..3e3b073 --- /dev/null +++ b/packages/ai-ide/src/browser/task-context-functions.ts @@ -0,0 +1,345 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { assertChatContext } from '@theia/ai-chat'; +import { Summary, TaskContextStorageService } from '@theia/ai-chat/lib/browser/task-context-service'; +import { ToolInvocationContext, ToolProvider, ToolRequest } from '@theia/ai-core'; +import { generateUuid } from '@theia/core'; +import { ContentReplacer, Replacement } from '@theia/core/lib/common/content-replacer'; +import { ContentReplacerV2Impl } from '@theia/core/lib/common/content-replacer-v2-impl'; +import { inject, injectable } from '@theia/core/shared/inversify'; +import { + CREATE_TASK_CONTEXT_FUNCTION_ID, + GET_TASK_CONTEXT_FUNCTION_ID, + EDIT_TASK_CONTEXT_FUNCTION_ID, + LIST_TASK_CONTEXTS_FUNCTION_ID, + REWRITE_TASK_CONTEXT_FUNCTION_ID +} from '../common/task-context-function-ids'; + +@injectable() +export class CreateTaskContextFunction implements ToolProvider { + static ID = CREATE_TASK_CONTEXT_FUNCTION_ID; + + @inject(TaskContextStorageService) + protected readonly storageService: TaskContextStorageService; + + getTool(): ToolRequest { + return { + id: CreateTaskContextFunction.ID, + name: CreateTaskContextFunction.ID, + description: 'Create a new task context (implementation plan) for the current session. ' + + 'The plan will be stored and opened in the editor so the user can see it. ' + + 'Use this to document the implementation plan after exploring the codebase.', + parameters: { + type: 'object', + properties: { + title: { + type: 'string', + description: 'Title for the task context (e.g., "Add user authentication feature")' + }, + content: { + type: 'string', + description: 'The plan content in markdown format. Should include: Goal, Design, Implementation Steps (with file paths), ' + + 'Reference Examples, and Verification.' + } + }, + required: ['title', 'content'] + }, + handler: async (args: string, ctx?: ToolInvocationContext): Promise => { + assertChatContext(ctx); + if (ctx.cancellationToken?.isCancellationRequested) { + return JSON.stringify({ error: 'Operation cancelled by user' }); + } + + try { + const { title, content } = JSON.parse(args); + const summaryId = generateUuid(); + const summary: Summary = { + id: summaryId, + label: title, + summary: content, + sessionId: ctx.request.session.id + }; + + await this.storageService.store(summary); + await this.storageService.open(summaryId); + + return `Created task context "${title}" (id: ${summaryId}) - now visible in editor. The user can review and edit the plan directly.`; + } catch (error) { + return JSON.stringify({ error: `Failed to create task context: ${error.message}` }); + } + } + }; + } +} + +@injectable() +export class GetTaskContextFunction implements ToolProvider { + static ID = GET_TASK_CONTEXT_FUNCTION_ID; + + @inject(TaskContextStorageService) + protected readonly storageService: TaskContextStorageService; + + getTool(): ToolRequest { + return { + id: GetTaskContextFunction.ID, + name: GetTaskContextFunction.ID, + description: 'Read the current task context (implementation plan). ' + + 'Always call this before editing to ensure you have the latest version, ' + + 'as the user may have edited the plan directly in the editor.', + parameters: { + type: 'object', + properties: { + taskContextId: { + type: 'string', + description: 'Optional task context ID. If not provided, returns the task context for the current session.' + } + }, + required: [] + }, + handler: async (args: string, ctx?: ToolInvocationContext): Promise => { + assertChatContext(ctx); + if (ctx.cancellationToken?.isCancellationRequested) { + return JSON.stringify({ error: 'Operation cancelled by user' }); + } + + try { + const parsed = args ? JSON.parse(args) : {}; + const taskContextId: string | undefined = parsed.taskContextId; + + let summary: Summary | undefined; + if (taskContextId) { + summary = await this.storageService.get(taskContextId); + } else { + const allSummaries = this.storageService.getAll(); + const sessionSummaries = allSummaries.filter(s => s.sessionId === ctx.request.session.id); + summary = sessionSummaries[sessionSummaries.length - 1]; + } + + if (!summary) { + return 'No task context found for this session. Use createTaskContext to create one.'; + } + + return summary.summary; + } catch (error) { + return JSON.stringify({ error: `Failed to get task context: ${error.message}` }); + } + } + }; + } +} + +@injectable() +export class EditTaskContextFunction implements ToolProvider { + static ID = EDIT_TASK_CONTEXT_FUNCTION_ID; + + @inject(TaskContextStorageService) + protected readonly storageService: TaskContextStorageService; + + protected readonly contentReplacer: ContentReplacer = new ContentReplacerV2Impl(); + + getTool(): ToolRequest { + return { + id: EditTaskContextFunction.ID, + name: EditTaskContextFunction.ID, + description: 'Edit the current task context by replacing specific content. ' + + 'The plan will be updated and opened in the editor so the user can see the changes. ' + + 'The oldContent must appear exactly once in the plan. ' + + 'IMPORTANT: Always call getTaskContext first to read the latest version before editing, ' + + 'as the user may have edited the plan directly. ' + + 'If you see "not found" errors: The content does not exist, has different whitespace, or the plan changed. Re-read with getTaskContext first. ' + + 'If you see "multiple occurrences" errors: Add more surrounding lines to oldContent to make it unique. ' + + 'Common mistakes: Missing/extra trailing newlines, wrong indentation, outdated content. ' + + 'If edits continue to fail, use rewriteTaskContext to replace the entire content.', + parameters: { + type: 'object', + properties: { + oldContent: { + type: 'string', + description: 'The exact content to be replaced. Must match exactly, including whitespace and indentation.' + }, + newContent: { + type: 'string', + description: 'The replacement text. For deletions, use an empty string.' + }, + taskContextId: { + type: 'string', + description: 'Optional task context ID. If not provided, edits the task context for the current session.' + } + }, + required: ['oldContent', 'newContent'] + }, + handler: async (args: string, ctx?: ToolInvocationContext): Promise => { + assertChatContext(ctx); + if (ctx.cancellationToken?.isCancellationRequested) { + return JSON.stringify({ error: 'Operation cancelled by user' }); + } + + try { + const { oldContent, newContent, taskContextId } = JSON.parse(args); + + let summary: Summary | undefined; + if (taskContextId) { + summary = await this.storageService.get(taskContextId); + } else { + const allSummaries = this.storageService.getAll(); + const sessionSummaries = allSummaries.filter(s => s.sessionId === ctx.request.session.id); + summary = sessionSummaries[sessionSummaries.length - 1]; + } + + if (!summary) { + return 'No task context found for this session. Use createTaskContext to create one first.'; + } + + const replacement: Replacement = { oldContent, newContent }; + const { updatedContent, errors } = this.contentReplacer.applyReplacements(summary.summary, [replacement]); + + if (errors.length > 0) { + return 'Edit failed: ' + errors.join('; ') + '. ' + + 'The user may have edited the plan directly. ' + + 'Use getTaskContext to read the current content and try again. ' + + 'If edits continue to fail, use rewriteTaskContext to replace the entire content.'; + } + + const updatedSummary: Summary = { + ...summary, + summary: updatedContent + }; + await this.storageService.store(updatedSummary); + + await this.storageService.open(summary.id); + + return 'Task context updated successfully - changes visible in editor.'; + } catch (error) { + return JSON.stringify({ error: `Failed to edit task context: ${error.message}` }); + } + } + }; + } +} + +@injectable() +export class ListTaskContextsFunction implements ToolProvider { + static ID = LIST_TASK_CONTEXTS_FUNCTION_ID; + + @inject(TaskContextStorageService) + protected readonly storageService: TaskContextStorageService; + + getTool(): ToolRequest { + return { + id: ListTaskContextsFunction.ID, + name: ListTaskContextsFunction.ID, + description: 'List all task contexts (plans) for the current session. ' + + 'Use this to see what plans exist and their IDs.', + parameters: { + type: 'object', + properties: {}, + required: [] + }, + handler: async (args: string, ctx?: ToolInvocationContext): Promise => { + assertChatContext(ctx); + if (ctx.cancellationToken?.isCancellationRequested) { + return JSON.stringify({ error: 'Operation cancelled by user' }); + } + + try { + const allSummaries = this.storageService.getAll(); + const sessionSummaries = allSummaries.filter(s => s.sessionId === ctx.request.session.id); + + if (sessionSummaries.length === 0) { + return 'No task contexts found for this session.'; + } + + const list = sessionSummaries.map((s, i) => + `${i + 1}. "${s.label}" (id: ${s.id})` + ).join('\n'); + + return `Task contexts for this session:\n${list}\n\nMost recent: "${sessionSummaries[sessionSummaries.length - 1].label}"`; + } catch (error) { + return JSON.stringify({ error: `Failed to list task contexts: ${error.message}` }); + } + } + }; + } +} + +@injectable() +export class RewriteTaskContextFunction implements ToolProvider { + static ID = REWRITE_TASK_CONTEXT_FUNCTION_ID; + + @inject(TaskContextStorageService) + protected readonly storageService: TaskContextStorageService; + + getTool(): ToolRequest { + return { + id: RewriteTaskContextFunction.ID, + name: RewriteTaskContextFunction.ID, + description: 'Completely rewrite a task context with new content. ' + + 'Use this as a fallback when editTaskContext fails repeatedly, ' + + 'for example when the user has made significant changes to the plan. ' + + 'The plan will be updated and opened in the editor so the user can see the changes.', + parameters: { + type: 'object', + properties: { + content: { + type: 'string', + description: 'The complete new content for the task context in markdown format.' + }, + taskContextId: { + type: 'string', + description: 'Optional task context ID. If not provided, rewrites the task context for the current session.' + } + }, + required: ['content'] + }, + handler: async (args: string, ctx?: ToolInvocationContext): Promise => { + assertChatContext(ctx); + if (ctx.cancellationToken?.isCancellationRequested) { + return JSON.stringify({ error: 'Operation cancelled by user' }); + } + + try { + const { content, taskContextId } = JSON.parse(args); + + let summary: Summary | undefined; + if (taskContextId) { + summary = await this.storageService.get(taskContextId); + } else { + const allSummaries = this.storageService.getAll(); + const sessionSummaries = allSummaries.filter(s => s.sessionId === ctx.request.session.id); + summary = sessionSummaries[sessionSummaries.length - 1]; + } + + if (!summary) { + return 'No task context found for this session. Use createTaskContext to create one first.'; + } + + const updatedSummary: Summary = { + ...summary, + summary: content + }; + await this.storageService.store(updatedSummary); + + await this.storageService.open(summary.id); + + return 'Task context rewritten successfully - changes visible in editor.'; + } catch (error) { + return JSON.stringify({ error: `Failed to rewrite task context: ${error.message}` }); + } + } + }; + } +} diff --git a/packages/ai-ide/src/browser/template-preference-contribution.ts b/packages/ai-ide/src/browser/template-preference-contribution.ts new file mode 100644 index 0000000..5392e75 --- /dev/null +++ b/packages/ai-ide/src/browser/template-preference-contribution.ts @@ -0,0 +1,99 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { FrontendApplicationContribution } from '@theia/core/lib/browser'; +import { inject, injectable } from '@theia/core/shared/inversify'; +import { DefaultPromptFragmentCustomizationService, PromptFragmentCustomizationProperties } from '@theia/ai-core/lib/browser/frontend-prompt-customization-service'; +import { + PROMPT_TEMPLATE_WORKSPACE_DIRECTORIES_PREF, + PROMPT_TEMPLATE_ADDITIONAL_EXTENSIONS_PREF, + PROMPT_TEMPLATE_WORKSPACE_FILES_PREF +} from '../common/workspace-preferences'; +import { WorkspaceService } from '@theia/workspace/lib/browser'; +import { Path, PreferenceService } from '@theia/core'; + +@injectable() +export class TemplatePreferenceContribution implements FrontendApplicationContribution { + + @inject(PreferenceService) + protected readonly preferenceService: PreferenceService; + + @inject(DefaultPromptFragmentCustomizationService) + protected readonly customizationService: DefaultPromptFragmentCustomizationService; + + @inject(WorkspaceService) + protected readonly workspaceService: WorkspaceService; + + onStart(): void { + Promise.all([this.preferenceService.ready, this.workspaceService.ready]).then(() => { + // Set initial template configuration from preferences + this.updateConfiguration(); + + // Listen for preference changes + this.preferenceService.onPreferenceChanged(event => { + if (event.preferenceName === PROMPT_TEMPLATE_WORKSPACE_DIRECTORIES_PREF || + event.preferenceName === PROMPT_TEMPLATE_ADDITIONAL_EXTENSIONS_PREF || + event.preferenceName === PROMPT_TEMPLATE_WORKSPACE_FILES_PREF) { + this.updateConfiguration(event.preferenceName); + } + }); + + // Listen for workspace root changes + this.workspaceService.onWorkspaceLocationChanged(() => { + this.updateConfiguration(); + }); + }); + } + + /** + * Updates the template configuration in the customization service. + * If a specific preference name is provided, only that configuration aspect is updated. + * @param changedPreference Optional name of the preference that changed + */ + protected async updateConfiguration(changedPreference?: string): Promise { + const workspaceRoot = this.workspaceService.tryGetRoots()[0]; + if (!workspaceRoot) { + return; + } + + const workspaceRootUri = workspaceRoot.resource; + const configProperties: PromptFragmentCustomizationProperties = {}; + + if (!changedPreference || changedPreference === PROMPT_TEMPLATE_WORKSPACE_DIRECTORIES_PREF) { + const relativeDirectories = this.preferenceService.get(PROMPT_TEMPLATE_WORKSPACE_DIRECTORIES_PREF, []); + configProperties.directoryPaths = relativeDirectories.map(dir => { + const path = new Path(dir); + const uri = workspaceRootUri.resolve(path.toString()); + return uri.path.toString(); + }); + } + + if (!changedPreference || changedPreference === PROMPT_TEMPLATE_ADDITIONAL_EXTENSIONS_PREF) { + configProperties.extensions = this.preferenceService.get(PROMPT_TEMPLATE_ADDITIONAL_EXTENSIONS_PREF, []); + } + + if (!changedPreference || changedPreference === PROMPT_TEMPLATE_WORKSPACE_FILES_PREF) { + const relativeFilePaths = this.preferenceService.get(PROMPT_TEMPLATE_WORKSPACE_FILES_PREF, []); + configProperties.filePaths = relativeFilePaths.map(filePath => { + const path = new Path(filePath); + const uri = workspaceRootUri.resolve(path.toString()); + return uri.path.toString(); + }); + } + + await this.customizationService.updateConfiguration(configProperties); + } +} diff --git a/packages/ai-ide/src/browser/test/tool-provider-cancellation-test-util.spec.ts b/packages/ai-ide/src/browser/test/tool-provider-cancellation-test-util.spec.ts new file mode 100644 index 0000000..3dc336a --- /dev/null +++ b/packages/ai-ide/src/browser/test/tool-provider-cancellation-test-util.spec.ts @@ -0,0 +1,60 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { CancellationTokenSource } from '@theia/core'; +import { expect } from 'chai'; + +// Simple test for cancellation handling +describe('Tool Provider Cancellation Tests', () => { + it('should verify basic cancellation token functionality', () => { + // Create a cancellation token source + const cts = new CancellationTokenSource(); + + // Initially the token should not be cancelled + expect(cts.token.isCancellationRequested).to.be.false; + + // After cancellation, the token should report as cancelled + cts.cancel(); + expect(cts.token.isCancellationRequested).to.be.true; + + // Cleanup + cts.dispose(); + }); + + it('should trigger cancellation callback when cancelled', async () => { + // Create a cancellation token source + const cts = new CancellationTokenSource(); + + // Create a flag to track if the callback was called + let callbackCalled = false; + + // Register a cancellation callback + const disposable = cts.token.onCancellationRequested(() => { + callbackCalled = true; + }); + + // Initially the callback should not have been called + expect(callbackCalled).to.be.false; + + // After cancellation, the callback should be called + cts.cancel(); + expect(callbackCalled).to.be.true; + + // Cleanup + disposable.dispose(); + cts.dispose(); + }); +}); diff --git a/packages/ai-ide/src/browser/todo-tool-renderer.tsx b/packages/ai-ide/src/browser/todo-tool-renderer.tsx new file mode 100644 index 0000000..f80ca0c --- /dev/null +++ b/packages/ai-ide/src/browser/todo-tool-renderer.tsx @@ -0,0 +1,153 @@ +// ***************************************************************************** +// Copyright (C) 2026 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { inject, injectable } from '@theia/core/shared/inversify'; +import { ChatResponsePartRenderer } from '@theia/ai-chat-ui/lib/browser/chat-response-part-renderer'; +import { ResponseNode } from '@theia/ai-chat-ui/lib/browser/chat-tree-view'; +import { ChatResponseContent, ToolCallChatResponseContent } from '@theia/ai-chat/lib/common'; +import { ReactNode } from '@theia/core/shared/react'; +import * as React from '@theia/core/shared/react'; +import { codicon, ContextMenuRenderer } from '@theia/core/lib/browser'; +import { nls } from '@theia/core'; +import { TODO_WRITE_FUNCTION_ID, TodoItem, isValidTodoItem } from './todo-tool'; +import { withToolCallConfirmation } from '@theia/ai-chat-ui/lib/browser/chat-response-renderer/tool-confirmation'; +import { ToolConfirmationManager } from '@theia/ai-chat/lib/browser/chat-tool-preference-bindings'; +import { ToolInvocationRegistry } from '@theia/ai-core'; + +interface TodoListComponentProps { + todos: TodoItem[] | undefined; +} + +const TodoListComponent: React.FC = ({ todos }) => { + const header = ( +
    + + {nls.localizeByDefault('Todos')} +
    + ); + + if (!todos || todos.length === 0) { + return ( +
    + {header} +
    {nls.localize('theia/ai-ide/todoTool/noTasks', 'No tasks')}
    +
    + ); + } + + return ( +
    + {header} +
    + {todos.map((todo, index) => ( +
    + {getStatusIcon(todo.status)} + + {todo.status === 'in_progress' ? todo.activeForm : todo.content} + +
    + ))} +
    +
    + ); +}; + +function getStatusIcon(status: string): ReactNode { + switch (status) { + case 'pending': + return ; + case 'in_progress': + return ; + case 'completed': + return ; + default: + return undefined; + } +} + +const TodoListWithConfirmation = withToolCallConfirmation(TodoListComponent); + +@injectable() +export class TodoToolRenderer implements ChatResponsePartRenderer { + + @inject(ToolConfirmationManager) + protected toolConfirmationManager: ToolConfirmationManager; + + @inject(ContextMenuRenderer) + protected contextMenuRenderer: ContextMenuRenderer; + + @inject(ToolInvocationRegistry) + protected toolInvocationRegistry: ToolInvocationRegistry; + + canHandle(response: ChatResponseContent): number { + if (ToolCallChatResponseContent.is(response) && response.name === TODO_WRITE_FUNCTION_ID) { + return 20; + } + return -1; + } + + render(response: ToolCallChatResponseContent, parentNode: ResponseNode): ReactNode { + if (!response.arguments) { + return undefined; + } + + if (!this.isLatestTodoWriteInResponse(response, parentNode)) { + // eslint-disable-next-line no-null/no-null + return null; + } + + const chatId = parentNode.sessionId; + const toolRequest = this.toolInvocationRegistry.getFunction(TODO_WRITE_FUNCTION_ID); + const confirmationMode = this.toolConfirmationManager.getConfirmationMode(TODO_WRITE_FUNCTION_ID, chatId, toolRequest); + const todos = this.parseTodos(response.arguments); + + return ( + + ); + } + + protected isLatestTodoWriteInResponse(response: ToolCallChatResponseContent, parentNode: ResponseNode): boolean { + const todoWriteIds = parentNode.response.response.content + .filter(c => ToolCallChatResponseContent.is(c) && c.name === TODO_WRITE_FUNCTION_ID) + .map(c => (c as ToolCallChatResponseContent).id); + + return todoWriteIds[todoWriteIds.length - 1] === response.id; + } + + protected parseTodos(args: string | undefined): TodoItem[] | undefined { + if (!args) { + return undefined; + } + try { + const parsed = JSON.parse(args); + if (!Array.isArray(parsed.todos)) { + return undefined; + } + return parsed.todos.filter(isValidTodoItem); + } catch { + return undefined; + } + } +} diff --git a/packages/ai-ide/src/browser/todo-tool.ts b/packages/ai-ide/src/browser/todo-tool.ts new file mode 100644 index 0000000..af3efcd --- /dev/null +++ b/packages/ai-ide/src/browser/todo-tool.ts @@ -0,0 +1,77 @@ +// ***************************************************************************** +// Copyright (C) 2026 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { injectable } from '@theia/core/shared/inversify'; +import { ToolProvider, ToolRequest } from '@theia/ai-core/lib/common'; +import { TODO_WRITE_FUNCTION_ID, isValidTodoItem } from '../common/todo-tool'; + +export { TODO_WRITE_FUNCTION_ID, TodoItem, isValidTodoItem } from '../common/todo-tool'; + +@injectable() +export class TodoWriteTool implements ToolProvider { + static ID = TODO_WRITE_FUNCTION_ID; + + getTool(): ToolRequest { + return { + id: TodoWriteTool.ID, + name: TodoWriteTool.ID, + providerName: 'ai-ide', + description: 'Write a todo list to track task progress. Use this to plan multi-step tasks ' + + 'and show progress to the user. Each todo has content (imperative: "Run tests"), ' + + 'activeForm (continuous: "Running tests"), and status (pending/in_progress/completed). ' + + 'Call this to update the entire list - it replaces the previous list.', + parameters: { + type: 'object', + properties: { + todos: { + type: 'array', + items: { + type: 'object', + properties: { + content: { type: 'string', description: 'Imperative form: "Run tests"' }, + activeForm: { type: 'string', description: 'Continuous form: "Running tests"' }, + status: { type: 'string', enum: ['pending', 'in_progress', 'completed'] } + }, + required: ['content', 'activeForm', 'status'] + } + } + }, + required: ['todos'] + }, + handler: async (arg_string: string) => { + try { + const { todos } = JSON.parse(arg_string); + if (!Array.isArray(todos)) { + return JSON.stringify({ error: 'todos must be an array' }); + } + const validTodos = todos.filter(isValidTodoItem); + const invalidCount = todos.length - validTodos.length; + if (invalidCount > 0) { + return JSON.stringify({ + success: true, + count: validTodos.length, + warning: `${invalidCount} invalid todo item(s) were filtered out` + }); + } + return JSON.stringify({ success: true, count: validTodos.length }); + } catch (error) { + const message = error instanceof Error ? error.message : String(error); + return JSON.stringify({ error: `Failed to parse todos: ${message}` }); + } + } + }; + } +} diff --git a/packages/ai-ide/src/browser/with-apptester-command-contribution.ts b/packages/ai-ide/src/browser/with-apptester-command-contribution.ts new file mode 100644 index 0000000..69800b3 --- /dev/null +++ b/packages/ai-ide/src/browser/with-apptester-command-contribution.ts @@ -0,0 +1,87 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { FrontendApplicationContribution } from '@theia/core/lib/browser'; +import { inject, injectable } from '@theia/core/shared/inversify'; +import { PromptService } from '@theia/ai-core/lib/common'; +import { nls } from '@theia/core'; +import { AGENT_DELEGATION_FUNCTION_ID } from '@theia/ai-chat/lib/browser/agent-delegation-tool'; +import { RUN_TASK_FUNCTION_ID } from '../common/workspace-functions'; + +@injectable() +export class WithAppTesterCommandContribution implements FrontendApplicationContribution { + + @inject(PromptService) + protected readonly promptService: PromptService; + + onStart(): void { + this.registerWithAppTesterCommand(); + } + + protected registerWithAppTesterCommand(): void { + const commandTemplate = this.buildCommandTemplate(); + + this.promptService.addBuiltInPromptFragment({ + id: 'with-apptester', + template: commandTemplate, + isCommand: true, + commandName: 'with-apptester', + commandDescription: nls.localize( + 'theia/ai-ide/withAppTesterCommand/description', + 'Delegate testing to the AppTester agent (requires agent mode)' + ), + commandAgents: ['Coder'] + }); + } + + protected buildCommandTemplate(): string { + return `After implementing the changes, delegate to the AppTester agent to test the implementation. The changes need to be applied and built. + + Use the ~{${AGENT_DELEGATION_FUNCTION_ID}} tool to delegate to the AppTester agent. + + **Agent ID:** 'AppTester' + **Prompt:** Provide a description of what was implemented and should be tested, including: + - Summary of changes made + - Expected behavior + - Areas to focus testing on + - **Application URL:** Specify the exact URL if known (e.g., http://localhost:3000) + - **Application Status:** Clearly specify whether the application has started, or if the AppTester needs to launch it + - **Launch Configuration:** If known, specify which launch configuration to use + - **UI Navigation Instructions:** If the feature requires opening a specific view, panel, menu, or using the command palette, provide explicit instructions + + Example prompt format: + \`\`\` + I have implemented [description of changes]. + + Expected behavior: [what should happen] + + Application URL: http://localhost:3000 + Application status: The application is running. + (OR: Application status: Not started yet. Use launch configuration "[config-name]" to start it.) + IMPORTANT: You CANNOT start the application using the ${RUN_TASK_FUNCTION_ID} tool, as it will block the delegation. + + UI Navigation: To test this feature, you need to [e.g., "click the AI Chat icon in the left sidebar to open the AI Chat View", + or "open the Command Palette and run 'Open Settings'", or "the feature should be visible immediately on the main page"]. + + Please test the implementation focusing on [specific areas]. + \`\`\` + + **IMPORTANT:** Include as much information as possible (URL, port, launch config, UI navigation steps) + to guide the AppTester efficiently. + + The AppTester will verify the implementation and report any issues found.`; + } +} diff --git a/packages/ai-ide/src/browser/workspace-functions.spec.ts b/packages/ai-ide/src/browser/workspace-functions.spec.ts new file mode 100644 index 0000000..3d45881 --- /dev/null +++ b/packages/ai-ide/src/browser/workspace-functions.spec.ts @@ -0,0 +1,197 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { enableJSDOM } from '@theia/core/lib/browser/test/jsdom'; +let disableJSDOM = enableJSDOM(); +import { FrontendApplicationConfigProvider } from '@theia/core/lib/browser/frontend-application-config-provider'; +FrontendApplicationConfigProvider.set({}); + +import { expect } from 'chai'; +import { CancellationTokenSource, PreferenceService } from '@theia/core'; +import { + GetWorkspaceDirectoryStructure, + FileContentFunction, + GetWorkspaceFileList, + FileDiagnosticProvider, + WorkspaceFunctionScope +} from './workspace-functions'; +import { ToolInvocationContext } from '@theia/ai-core'; +import { Container } from '@theia/core/shared/inversify'; +import { FileService } from '@theia/filesystem/lib/browser/file-service'; +import { URI } from '@theia/core/lib/common/uri'; +import { WorkspaceService } from '@theia/workspace/lib/browser'; +import { OpenerService } from '@theia/core/lib/browser'; +import { ProblemManager } from '@theia/markers/lib/browser'; +import { MonacoTextModelService } from '@theia/monaco/lib/browser/monaco-text-model-service'; +import { MonacoWorkspace } from '@theia/monaco/lib/browser/monaco-workspace'; + +disableJSDOM(); + +describe('Workspace Functions Cancellation Tests', () => { + let cancellationTokenSource: CancellationTokenSource; + let mockCtx: ToolInvocationContext; + let container: Container; + + before(() => { + disableJSDOM = enableJSDOM(); + }); + after(() => { + // Disable JSDOM after all tests + disableJSDOM(); + }); + + beforeEach(() => { + cancellationTokenSource = new CancellationTokenSource(); + + // Setup mock context + mockCtx = { + cancellationToken: cancellationTokenSource.token + }; + + // Create a new container for each test + container = new Container(); + + // Mock dependencies + const mockWorkspaceService = { + roots: [{ resource: new URI('file:///workspace') }] + } as unknown as WorkspaceService; + + const mockFileService = { + exists: async () => true, + resolve: async () => ({ + isDirectory: true, + children: [ + { + isDirectory: true, + resource: new URI('file:///workspace/dir'), + path: { base: 'dir' } + } + ], + resource: new URI('file:///workspace') + }), + read: async () => ({ value: { toString: () => 'test content' } }) + } as unknown as FileService; + + const mockPreferenceService = { + get: (_path: string, defaultValue: T) => defaultValue + }; + + const mockMonacoWorkspace = { + // eslint-disable-next-line no-null/no-null + getTextDocument: () => null + } as unknown as MonacoWorkspace; + + const mockProblemManager = { + findMarkers: () => [], + onDidChangeMarkers: () => ({ dispose: () => { } }) + } as unknown as ProblemManager; + + const mockMonacoTextModelService = { + createModelReference: async () => ({ + object: { + lineCount: 10, + getText: () => 'test text' + }, + dispose: () => { } + }) + } as unknown as MonacoTextModelService; + + const mockOpenerService = { + open: async () => { } + }; + + // Register mocks in the container + container.bind(WorkspaceService).toConstantValue(mockWorkspaceService); + container.bind(FileService).toConstantValue(mockFileService); + container.bind(PreferenceService).toConstantValue(mockPreferenceService); + container.bind(MonacoWorkspace).toConstantValue(mockMonacoWorkspace); + container.bind(ProblemManager).toConstantValue(mockProblemManager); + container.bind(MonacoTextModelService).toConstantValue(mockMonacoTextModelService); + container.bind(OpenerService).toConstantValue(mockOpenerService); + container.bind(WorkspaceFunctionScope).toSelf(); + container.bind(GetWorkspaceDirectoryStructure).toSelf(); + container.bind(FileContentFunction).toSelf(); + container.bind(GetWorkspaceFileList).toSelf(); + container.bind(FileDiagnosticProvider).toSelf(); + }); + + afterEach(() => { + cancellationTokenSource.dispose(); + }); + + it('GetWorkspaceDirectoryStructure should respect cancellation token', async () => { + const getDirectoryStructure = container.get(GetWorkspaceDirectoryStructure); + cancellationTokenSource.cancel(); + + const handler = getDirectoryStructure.getTool().handler; + const result = await handler(JSON.stringify({}), mockCtx); + + const jsonResponse = typeof result === 'string' ? JSON.parse(result) : result; + expect(jsonResponse.error).to.equal('Operation cancelled by user'); + }); + + it('FileContentFunction should respect cancellation token', async () => { + const fileContentFunction = container.get(FileContentFunction); + cancellationTokenSource.cancel(); + + const handler = fileContentFunction.getTool().handler; + const result = await handler(JSON.stringify({ file: 'test.txt' }), mockCtx); + + const jsonResponse = JSON.parse(result as string); + expect(jsonResponse.error).to.equal('Operation cancelled by user'); + }); + + it('GetWorkspaceFileList should respect cancellation token', async () => { + const getWorkspaceFileList = container.get(GetWorkspaceFileList); + cancellationTokenSource.cancel(); + + const handler = getWorkspaceFileList.getTool().handler; + const result = await handler(JSON.stringify({ path: '' }), mockCtx); + + expect(result).to.include('Operation cancelled by user'); + }); + + it('GetWorkspaceFileList should check cancellation at multiple points', async () => { + const getWorkspaceFileList = container.get(GetWorkspaceFileList); + + // We'll let it pass the first check then cancel + const mockFileService = container.get(FileService); + const originalResolve = mockFileService.resolve; + + // Mock resolve to cancel the token after it's called + mockFileService.resolve = async (...args: unknown[]) => { + const innerResult = await originalResolve.apply(mockFileService, args); + cancellationTokenSource.cancel(); + return innerResult; + }; + + const handler = getWorkspaceFileList.getTool().handler; + const result = await handler(JSON.stringify({ path: '' }), mockCtx); + + expect(result).to.include('Operation cancelled by user'); + }); + + it('FileDiagnosticProvider should respect cancellation token', async () => { + const fileDiagnosticProvider = container.get(FileDiagnosticProvider); + cancellationTokenSource.cancel(); + + const handler = fileDiagnosticProvider.getTool().handler; + const result = await handler(JSON.stringify({ file: 'test.txt' }), mockCtx); + + const jsonResponse = JSON.parse(result as string); + expect(jsonResponse.error).to.equal('Operation cancelled by user'); + }); +}); diff --git a/packages/ai-ide/src/browser/workspace-functions.ts b/packages/ai-ide/src/browser/workspace-functions.ts new file mode 100644 index 0000000..3189fee --- /dev/null +++ b/packages/ai-ide/src/browser/workspace-functions.ts @@ -0,0 +1,769 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** +import { ToolInvocationContext, ToolProvider, ToolRequest } from '@theia/ai-core'; +import { CancellationToken, Disposable, PreferenceService, URI, Path } from '@theia/core'; +import { inject, injectable } from '@theia/core/shared/inversify'; +import { FileService } from '@theia/filesystem/lib/browser/file-service'; +import { FileStat } from '@theia/filesystem/lib/common/files'; +import { WorkspaceService } from '@theia/workspace/lib/browser'; +import { + FILE_CONTENT_FUNCTION_ID, GET_FILE_DIAGNOSTICS_ID, + GET_WORKSPACE_DIRECTORY_STRUCTURE_FUNCTION_ID, + GET_WORKSPACE_FILE_LIST_FUNCTION_ID, FIND_FILES_BY_PATTERN_FUNCTION_ID +} from '../common/workspace-functions'; +import ignore from 'ignore'; +import { Minimatch } from 'minimatch'; +import { OpenerService, open } from '@theia/core/lib/browser'; +import { CONSIDER_GITIGNORE_PREF, USER_EXCLUDE_PATTERN_PREF } from '../common/workspace-preferences'; +import { MonacoWorkspace } from '@theia/monaco/lib/browser/monaco-workspace'; +import { MonacoTextModelService } from '@theia/monaco/lib/browser/monaco-text-model-service'; +import { ProblemManager } from '@theia/markers/lib/browser'; +import { DiagnosticSeverity, Range } from '@theia/core/shared/vscode-languageserver-protocol'; + +@injectable() +export class WorkspaceFunctionScope { + protected readonly GITIGNORE_FILE_NAME = '.gitignore'; + + @inject(WorkspaceService) + protected readonly workspaceService: WorkspaceService; + + @inject(FileService) + protected readonly fileService: FileService; + + @inject(PreferenceService) + protected readonly preferences: PreferenceService; + + private gitignoreMatcher: ReturnType | undefined; + private gitignoreWatcherInitialized = false; + + async getWorkspaceRoot(): Promise { + const wsRoots = await this.workspaceService.roots; + if (wsRoots.length === 0) { + throw new Error('No workspace has been opened yet'); + } + return wsRoots[0].resource; + } + + ensureWithinWorkspace(targetUri: URI, workspaceRootUri: URI): void { + if (!targetUri.toString().startsWith(workspaceRootUri.toString())) { + throw new Error('Access outside of the workspace is not allowed'); + } + } + + async resolveRelativePath(relativePath: string): Promise { + const workspaceRoot = await this.getWorkspaceRoot(); + return workspaceRoot.resolve(relativePath); + } + + isInWorkspace(uri: URI): boolean { + try { + const wsRoots = this.workspaceService.tryGetRoots(); + + if (wsRoots.length === 0) { + return false; + } + + for (const root of wsRoots) { + const rootUri = root.resource; + if (rootUri.scheme === uri.scheme && rootUri.isEqualOrParent(uri)) { + return true; + } + } + + return false; + } catch { + return false; + } + } + + isInPrimaryWorkspace(uri: URI): boolean { + try { + const wsRoots = this.workspaceService.tryGetRoots(); + + if (wsRoots.length === 0) { + return false; + } + + const primaryRoot = wsRoots[0].resource; + return primaryRoot.scheme === uri.scheme && primaryRoot.isEqualOrParent(uri); + } catch { + return false; + } + } + + async resolveToUri(pathOrUri: string | URI): Promise { + if (pathOrUri instanceof URI) { + return pathOrUri; + } + + if (!pathOrUri) { + return undefined; + } + + if (pathOrUri.includes('://')) { + try { + const uri = new URI(pathOrUri); + return uri; + } catch (error) { + } + } + + const normalizedPath = Path.normalizePathSeparator(pathOrUri); + const path = new Path(normalizedPath); + + if (normalizedPath.includes('..')) { + return undefined; + } + + if (path.isAbsolute) { + return URI.fromFilePath(normalizedPath); + } + + return this.resolveRelativePath(normalizedPath); + } + + private async initializeGitignoreWatcher(workspaceRoot: URI): Promise { + if (this.gitignoreWatcherInitialized) { + return; + } + + const gitignoreUri = workspaceRoot.resolve(this.GITIGNORE_FILE_NAME); + this.fileService.watch(gitignoreUri); + + this.fileService.onDidFilesChange(async event => { + if (event.contains(gitignoreUri)) { + this.gitignoreMatcher = undefined; + } + }); + + this.gitignoreWatcherInitialized = true; + } + + async shouldExclude(stat: FileStat): Promise { + const shouldConsiderGitIgnore = this.preferences.get(CONSIDER_GITIGNORE_PREF, false); + const userExcludePatterns = this.preferences.get(USER_EXCLUDE_PATTERN_PREF, []); + + if (this.isUserExcluded(stat.resource.path.base, userExcludePatterns)) { + return true; + } + const workspaceRoot = await this.getWorkspaceRoot(); + if (shouldConsiderGitIgnore && (await this.isGitIgnored(stat, workspaceRoot))) { + return true; + } + + return false; + } + + protected isUserExcluded(fileName: string, userExcludePatterns: string[]): boolean { + return userExcludePatterns.some(pattern => new Minimatch(pattern, { dot: true }).match(fileName)); + } + + protected async isGitIgnored(stat: FileStat, workspaceRoot: URI): Promise { + await this.initializeGitignoreWatcher(workspaceRoot); + + const gitignoreUri = workspaceRoot.resolve(this.GITIGNORE_FILE_NAME); + + try { + const fileStat = await this.fileService.resolve(gitignoreUri); + if (fileStat) { + if (!this.gitignoreMatcher) { + const gitignoreContent = await this.fileService.read(gitignoreUri); + this.gitignoreMatcher = ignore().add(gitignoreContent.value); + } + const relativePath = workspaceRoot.relative(stat.resource); + if (relativePath) { + const relativePathStr = relativePath.toString() + (stat.isDirectory ? '/' : ''); + if (this.gitignoreMatcher.ignores(relativePathStr)) { + return true; + } + } + } + } catch { + // If .gitignore does not exist or cannot be read, continue without error + } + + return false; + } +} + +@injectable() +export class GetWorkspaceDirectoryStructure implements ToolProvider { + static ID = GET_WORKSPACE_DIRECTORY_STRUCTURE_FUNCTION_ID; + + getTool(): ToolRequest { + return { + id: GetWorkspaceDirectoryStructure.ID, + name: GetWorkspaceDirectoryStructure.ID, + description: 'Retrieves the complete directory tree structure of the workspace as a nested JSON object. ' + + 'Lists only directories (no files), excluding common non-essential directories (node_modules, hidden files, etc.). ' + + 'Useful for getting a high-level overview of project organization. ' + + 'For listing files within a specific directory, use getWorkspaceFileList instead. ' + + 'For finding specific files, use findFilesByPattern.', + parameters: { + type: 'object', + properties: {}, + }, + handler: (_: string, ctx?: ToolInvocationContext) => this.getDirectoryStructure(ctx?.cancellationToken), + }; + } + + @inject(FileService) + protected readonly fileService: FileService; + + @inject(WorkspaceFunctionScope) + protected workspaceScope: WorkspaceFunctionScope; + + private async getDirectoryStructure(cancellationToken?: CancellationToken): Promise> { + if (cancellationToken?.isCancellationRequested) { + return { error: 'Operation cancelled by user' }; + } + + let workspaceRoot; + try { + workspaceRoot = await this.workspaceScope.getWorkspaceRoot(); + } catch (error) { + return { error: error.message }; + } + + return this.buildDirectoryStructure(workspaceRoot, cancellationToken); + } + + private async buildDirectoryStructure(uri: URI, cancellationToken?: CancellationToken): Promise> { + if (cancellationToken?.isCancellationRequested) { + return { error: 'Operation cancelled by user' }; + } + + const stat = await this.fileService.resolve(uri); + const result: Record = {}; + + if (stat && stat.isDirectory && stat.children) { + for (const child of stat.children) { + if (cancellationToken?.isCancellationRequested) { + return { error: 'Operation cancelled by user' }; + } + + if (!child.isDirectory || (await this.workspaceScope.shouldExclude(child))) { + continue; + } + const dirName = child.resource.path.base; + result[dirName] = await this.buildDirectoryStructure(child.resource, cancellationToken); + } + } + + return result; + } +} + +@injectable() +export class FileContentFunction implements ToolProvider { + static ID = FILE_CONTENT_FUNCTION_ID; + + getTool(): ToolRequest { + return { + id: FileContentFunction.ID, + name: FileContentFunction.ID, + description: 'Returns the content of a specified file within the workspace as a raw string. ' + + 'The file path must be provided relative to the workspace root. Only files within ' + + 'workspace boundaries are accessible; attempting to access files outside the workspace will return an error. ' + + 'If the file is currently open in an editor with unsaved changes, returns the editor\'s current content (not the saved file on disk). ' + + 'Binary files may not be readable and will return an error. ' + + 'Use this tool to read file contents before making any edits with replacement functions. ' + + 'Do NOT use this for files you haven\'t located yet - use findFilesByPattern or searchInWorkspace first.', + parameters: { + type: 'object', + properties: { + file: { + type: 'string', + description: 'The relative path to the target file within the workspace (e.g., "src/index.ts", "package.json"). ' + + 'Must be relative to the workspace root. Absolute paths and paths outside the workspace will result in an error.', + } + }, + required: ['file'] + }, + handler: (arg_string: string, ctx?: ToolInvocationContext) => { + const file = this.parseArg(arg_string); + return this.getFileContent(file, ctx?.cancellationToken); + }, + }; + } + + @inject(FileService) + protected readonly fileService: FileService; + + @inject(WorkspaceFunctionScope) + protected readonly workspaceScope: WorkspaceFunctionScope; + + @inject(MonacoWorkspace) + protected readonly monacoWorkspace: MonacoWorkspace; + + private parseArg(arg_string: string): string { + const result = JSON.parse(arg_string); + return result.file; + } + + private async getFileContent(file: string, cancellationToken?: CancellationToken): Promise { + if (cancellationToken?.isCancellationRequested) { + return JSON.stringify({ error: 'Operation cancelled by user' }); + } + + let targetUri: URI | undefined; + try { + const workspaceRoot = await this.workspaceScope.getWorkspaceRoot(); + targetUri = workspaceRoot.resolve(file); + this.workspaceScope.ensureWithinWorkspace(targetUri, workspaceRoot); + } catch (error) { + return JSON.stringify({ error: error.message }); + } + + try { + if (cancellationToken?.isCancellationRequested) { + return JSON.stringify({ error: 'Operation cancelled by user' }); + } + + const openEditorValue = this.monacoWorkspace.getTextDocument(targetUri.toString())?.getText(); + if (openEditorValue !== undefined) { + return openEditorValue; + } + + const fileContent = await this.fileService.read(targetUri); + return fileContent.value; + } catch (error) { + return JSON.stringify({ error: 'File not found' }); + } + } +} + +@injectable() +export class GetWorkspaceFileList implements ToolProvider { + static ID = GET_WORKSPACE_FILE_LIST_FUNCTION_ID; + + getTool(): ToolRequest { + return { + id: GetWorkspaceFileList.ID, + name: GetWorkspaceFileList.ID, + parameters: { + type: 'object', + properties: { + path: { + type: 'string', + description: 'Relative path to a directory within the workspace (e.g., "src", "src/components"). ' + + 'Use "" or "." to list the workspace root. Paths outside the workspace will result in an error.' + } + }, + required: ['path'] + }, + description: 'Lists files and directories within a specified workspace directory. ' + + 'Returns an array of names where directories are suffixed with "/" (e.g., ["src/", "package.json", "README.md"]). ' + + 'Use this to explore directory structure step by step. ' + + 'For finding specific files by pattern, use findFilesByPattern instead. ' + + 'For searching file contents, use searchInWorkspace instead.', + handler: (arg_string: string, ctx?: ToolInvocationContext) => { + const args = JSON.parse(arg_string); + return this.getProjectFileList(args.path, ctx?.cancellationToken); + }, + }; + } + + @inject(FileService) + protected readonly fileService: FileService; + + @inject(WorkspaceFunctionScope) + protected workspaceScope: WorkspaceFunctionScope; + + async getProjectFileList(path?: string, cancellationToken?: CancellationToken): Promise { + if (cancellationToken?.isCancellationRequested) { + return JSON.stringify({ error: 'Operation cancelled by user' }); + } + + let workspaceRoot; + try { + workspaceRoot = await this.workspaceScope.getWorkspaceRoot(); + } catch (error) { + return JSON.stringify({ error: error.message }); + } + + const targetUri = path ? workspaceRoot.resolve(path) : workspaceRoot; + this.workspaceScope.ensureWithinWorkspace(targetUri, workspaceRoot); + + try { + if (cancellationToken?.isCancellationRequested) { + return JSON.stringify({ error: 'Operation cancelled by user' }); + } + + const stat = await this.fileService.resolve(targetUri); + if (!stat || !stat.isDirectory) { + return JSON.stringify({ error: 'Directory not found' }); + } + return await this.listFilesDirectly(targetUri, workspaceRoot, cancellationToken); + } catch (error) { + return JSON.stringify({ error: 'Directory not found' }); + } + } + + private async listFilesDirectly(uri: URI, workspaceRootUri: URI, cancellationToken?: CancellationToken): Promise { + if (cancellationToken?.isCancellationRequested) { + return JSON.stringify({ error: 'Operation cancelled by user' }); + } + + const stat = await this.fileService.resolve(uri); + const result: string[] = []; + + if (stat && stat.isDirectory) { + if (await this.workspaceScope.shouldExclude(stat)) { + return result; + } + const children = await this.fileService.resolve(uri); + if (children.children) { + for (const child of children.children) { + if (cancellationToken?.isCancellationRequested) { + return JSON.stringify({ error: 'Operation cancelled by user' }); + } + + if (await this.workspaceScope.shouldExclude(child)) { + continue; + } + const itemName = child.resource.path.base; + result.push(child.isDirectory ? `${itemName}/` : itemName); + } + } + } + + return result; + } +} + +@injectable() +export class FileDiagnosticProvider implements ToolProvider { + static ID = GET_FILE_DIAGNOSTICS_ID; + + @inject(WorkspaceFunctionScope) + protected readonly workspaceScope: WorkspaceFunctionScope; + + @inject(ProblemManager) + protected readonly problemManager: ProblemManager; + + @inject(MonacoTextModelService) + protected readonly modelService: MonacoTextModelService; + + @inject(OpenerService) + protected readonly openerService: OpenerService; + + getTool(): ToolRequest { + return { + id: FileDiagnosticProvider.ID, + name: FileDiagnosticProvider.ID, + description: + 'Retrieves Error and Warning level diagnostics for a specific file in the workspace (Info and Hint level are filtered out). ' + + 'Returns a list of problems including: surrounding source code context (at least 3 lines), the error/warning message, ' + + 'and optionally a diagnostic code with description. ' + + 'Note: If the file was not recently opened, diagnostics may take a few seconds to appear as language services initialize. ' + + 'If no diagnostics are returned, the file may be error-free OR language services may not be active for this file type. ' + + 'Use this after making code changes to verify they compile correctly.', + parameters: { + type: 'object', + properties: { + file: { + type: 'string', + description: 'The relative path to the target file within the workspace (e.g., "src/index.ts"). ' + + 'Must be relative to the workspace root.' + } + }, + required: ['file'] + }, + handler: async (arg: string, ctx?: ToolInvocationContext) => { + try { + const { file } = JSON.parse(arg); + const workspaceRoot = await this.workspaceScope.getWorkspaceRoot(); + const targetUri = workspaceRoot.resolve(file); + this.workspaceScope.ensureWithinWorkspace(targetUri, workspaceRoot); + + return this.getDiagnosticsForFile(targetUri, ctx?.cancellationToken); + } catch (error) { + return JSON.stringify({ error: error instanceof Error ? error.message : 'Unknown error.' }); + } + } + }; + } + + protected async getDiagnosticsForFile(uri: URI, cancellationToken?: CancellationToken): Promise { + const toDispose: Disposable[] = []; + try { + // Check for early cancellation + if (cancellationToken?.isCancellationRequested) { + return JSON.stringify({ error: 'Operation cancelled by user' }); + } + + let markers = this.problemManager.findMarkers({ uri }); + if (markers.length === 0) { + // Open editor to ensure that the language services are active. + await open(this.openerService, uri); + + // Give some time to fetch problems in a newly opened editor. + await new Promise((res, rej) => { + const timeout = setTimeout(res, 5000); + + // Give another moment for additional markers to come in from different sources. + const listener = this.problemManager.onDidChangeMarkers(changed => changed.isEqual(uri) && setTimeout(res, 500)); + toDispose.push(listener); + + // Handle cancellation + if (cancellationToken) { + const cancelListener = + cancellationToken.onCancellationRequested(() => { + clearTimeout(timeout); + listener.dispose(); + rej(new Error('Operation cancelled by user')); + }); + toDispose.push(cancelListener); + } + }); + + markers = this.problemManager.findMarkers({ uri }); + } + + if (cancellationToken?.isCancellationRequested) { + return JSON.stringify({ error: 'Operation cancelled by user' }); + } + + if (markers.length) { + const editor = await this.modelService.createModelReference(uri); + toDispose.push(editor); + return JSON.stringify(markers.filter(marker => marker.data.severity !== DiagnosticSeverity.Information && marker.data.severity !== DiagnosticSeverity.Hint) + .map(marker => { + const contextRange = this.atLeastNLines(3, marker.data.range, editor.object.lineCount); + const text = editor.object.getText(contextRange); + const message = marker.data.message; + const code = marker.data.code; + const codeDescription = marker.data.codeDescription; + return { text, message, code, codeDescription }; + }) + ); + } + return JSON.stringify({ + error: 'No diagnostics were found. The file may contain no problems, or language services may not be available. Retrying may return fresh results.' + }); + } catch (err) { + if (err.message === 'Operation cancelled by user') { + return JSON.stringify({ error: 'Operation cancelled by user' }); + } + console.warn('Error when fetching markers for', uri.toString(), err); + return JSON.stringify({ error: err instanceof Error ? err.message : 'Unknown error when fetching for problems for ' + uri.toString() }); + } finally { + toDispose.forEach(disposable => disposable.dispose()); + } + } + + /** + * Expands the range provided until it contains at least {@link desiredLines} lines or reaches the end of the document + * to attempt to provide the agent sufficient context to understand the diagnostic. + */ + protected atLeastNLines(desiredLines: number, range: Range, documentLineCount: number): Range { + let startLine = range.start.line; + let endLine = range.end.line; + const desiredDifference = desiredLines - 1; + + while (endLine - startLine < desiredDifference && (startLine > 0 || endLine < documentLineCount - 1)) { + if (startLine > 0) { + startLine--; + } else if (endLine < documentLineCount - 1) { + endLine++; + } + if (endLine < documentLineCount - 1) { + endLine++; + } else if (startLine > 0) { + startLine--; + } + } + return { end: { character: Number.MAX_SAFE_INTEGER, line: endLine }, start: { character: 0, line: startLine } }; + } +} + +@injectable() +export class FindFilesByPattern implements ToolProvider { + static ID = FIND_FILES_BY_PATTERN_FUNCTION_ID; + + @inject(WorkspaceFunctionScope) + protected readonly workspaceScope: WorkspaceFunctionScope; + + @inject(PreferenceService) + protected readonly preferences: PreferenceService; + + @inject(FileService) + protected readonly fileService: FileService; + + getTool(): ToolRequest { + return { + id: FindFilesByPattern.ID, + name: FindFilesByPattern.ID, + description: 'Find files in the workspace that match a given glob pattern. ' + + 'This function allows efficient discovery of files using patterns like \'**/*.ts\' for all TypeScript files or ' + + '\'src/**/*.js\' for JavaScript files in the src directory. The function respects gitignore patterns and user exclusions, ' + + 'returns relative paths from the workspace root, and limits results to 200 files maximum. ' + + 'Performance note: This traverses directories recursively which may be slow in large workspaces. ' + + 'For better performance, use specific subdirectory patterns (e.g., \'src/**/*.ts\' instead of \'**/*.ts\'). ' + + 'Use this to find files by name/extension. Do NOT use this for searching file contents - use searchInWorkspace instead.', + parameters: { + type: 'object', + properties: { + pattern: { + type: 'string', + description: 'Glob pattern to match files against. ' + + 'Examples: \'**/*.ts\' (all TypeScript files), \'src/**/*.js\' (JS files in src), ' + + '\'**/*.{js,ts}\' (JS or TS files), \'**/test/**/*.spec.ts\' (test files). ' + + 'Use specific subdirectory prefixes for better performance (e.g., \'packages/core/**/*.ts\' instead of \'**/*.ts\').' + }, + exclude: { + type: 'array', + items: { type: 'string' }, + description: 'Optional glob patterns to exclude. ' + + 'Examples: [\'**/*.spec.ts\', \'**/node_modules/**\']. ' + + 'Common exclusions (node_modules, .git) are applied automatically via gitignore.' + } + }, + required: ['pattern'] + }, + handler: (arg_string: string, ctx?: ToolInvocationContext) => { + const args = JSON.parse(arg_string); + return this.findFiles(args.pattern, args.exclude, ctx?.cancellationToken); + }, + }; + } + + private async findFiles(pattern: string, excludePatterns?: string[], cancellationToken?: CancellationToken): Promise { + if (cancellationToken?.isCancellationRequested) { + return JSON.stringify({ error: 'Operation cancelled by user' }); + } + + let workspaceRoot; + try { + workspaceRoot = await this.workspaceScope.getWorkspaceRoot(); + } catch (error) { + return JSON.stringify({ error: error.message }); + } + + try { + // Build ignore patterns from gitignore and user preferences + const ignorePatterns = await this.buildIgnorePatterns(workspaceRoot); + + const allExcludes = [...ignorePatterns]; + if (excludePatterns && excludePatterns.length > 0) { + allExcludes.push(...excludePatterns); + } + + if (cancellationToken?.isCancellationRequested) { + return JSON.stringify({ error: 'Operation cancelled by user' }); + } + + const patternMatcher = new Minimatch(pattern, { dot: false }); + const excludeMatchers = allExcludes.map(excludePattern => new Minimatch(excludePattern, { dot: true })); + const files: string[] = []; + const maxResults = 200; + + await this.traverseDirectory(workspaceRoot, workspaceRoot, patternMatcher, excludeMatchers, files, maxResults, cancellationToken); + + if (cancellationToken?.isCancellationRequested) { + return JSON.stringify({ error: 'Operation cancelled by user' }); + } + + const result: { files: string[]; totalFound?: number; truncated?: boolean } = { + files: files.slice(0, maxResults) + }; + + if (files.length > maxResults) { + result.totalFound = files.length; + result.truncated = true; + } + + return JSON.stringify(result); + + } catch (error) { + return JSON.stringify({ error: `Failed to find files: ${error.message}` }); + } + } + + private async buildIgnorePatterns(workspaceRoot: URI): Promise { + const patterns: string[] = []; + + // Get user exclude patterns from preferences + const userExcludePatterns = this.preferences.get(USER_EXCLUDE_PATTERN_PREF, []); + patterns.push(...userExcludePatterns); + + // Add gitignore patterns if enabled + const shouldConsiderGitIgnore = this.preferences.get(CONSIDER_GITIGNORE_PREF, false); + if (shouldConsiderGitIgnore) { + try { + const gitignoreUri = workspaceRoot.resolve('.gitignore'); + const gitignoreContent = await this.fileService.read(gitignoreUri); + const gitignoreLines = gitignoreContent.value + .split('\n') + .map(line => line.trim()) + .filter(line => line && !line.startsWith('#')); + patterns.push(...gitignoreLines); + } catch { + // Gitignore file doesn't exist or can't be read, continue without it + } + } + + return patterns; + } + + private async traverseDirectory( + currentUri: URI, + workspaceRoot: URI, + patternMatcher: Minimatch, + excludeMatchers: Minimatch[], + results: string[], + maxResults: number, + cancellationToken?: CancellationToken + ): Promise { + if (cancellationToken?.isCancellationRequested || results.length >= maxResults) { + return; + } + + try { + const stat = await this.fileService.resolve(currentUri); + if (!stat || !stat.isDirectory || !stat.children) { + return; + } + + for (const child of stat.children) { + if (cancellationToken?.isCancellationRequested || results.length >= maxResults) { + break; + } + + const relativePath = workspaceRoot.relative(child.resource)?.toString(); + if (!relativePath) { + continue; + } + + const shouldExclude = excludeMatchers.some(matcher => matcher.match(relativePath)) || + (await this.workspaceScope.shouldExclude(child)); + + if (shouldExclude) { + continue; + } + + if (child.isDirectory) { + await this.traverseDirectory(child.resource, workspaceRoot, patternMatcher, excludeMatchers, results, maxResults, cancellationToken); + } else if (patternMatcher.match(relativePath)) { + results.push(relativePath); + } + } + } catch { + // If we can't access a directory, skip it + } + } +} diff --git a/packages/ai-ide/src/browser/workspace-launch-provider.spec.ts b/packages/ai-ide/src/browser/workspace-launch-provider.spec.ts new file mode 100644 index 0000000..0dc2c67 --- /dev/null +++ b/packages/ai-ide/src/browser/workspace-launch-provider.spec.ts @@ -0,0 +1,326 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { enableJSDOM } from '@theia/core/lib/browser/test/jsdom'; +let disableJSDOM = enableJSDOM(); +import { FrontendApplicationConfigProvider } from '@theia/core/lib/browser/frontend-application-config-provider'; +FrontendApplicationConfigProvider.set({}); + +import { expect } from 'chai'; +import { Container } from '@theia/core/shared/inversify'; +import { + LaunchListProvider, + LaunchRunnerProvider, + LaunchStopProvider, +} from './workspace-launch-provider'; +import { DebugConfigurationManager } from '@theia/debug/lib/browser/debug-configuration-manager'; +import { DebugSessionManager } from '@theia/debug/lib/browser/debug-session-manager'; +import { DebugSessionOptions } from '@theia/debug/lib/browser/debug-session-options'; +import { DebugConfiguration } from '@theia/debug/lib/common/debug-common'; +import { DebugCompound } from '@theia/debug/lib/common/debug-compound'; +import { DebugSession } from '@theia/debug/lib/browser/debug-session'; + +disableJSDOM(); + +describe('Launch Management Tool Providers', () => { + let container: Container; + let launchListProvider: LaunchListProvider; + let launchRunnerProvider: LaunchRunnerProvider; + let launchStopProvider: LaunchStopProvider; + let mockDebugConfigurationManager: Partial; + let mockDebugSessionManager: Partial; + + before(() => { + disableJSDOM = enableJSDOM(); + }); + + after(() => { + disableJSDOM(); + }); + + beforeEach(() => { + container = new Container(); + + const mockConfigs = createMockConfigurations(); + + mockDebugConfigurationManager = { + load: () => Promise.resolve(), + get all(): IterableIterator { + function* configIterator(): IterableIterator { + for (const config of mockConfigs) { + yield config; + } + } + return configIterator(); + }, + }; + + mockDebugSessionManager = { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + start: async (options: DebugSessionOptions | string): Promise => { + if ( + typeof options === 'string' || + DebugSessionOptions.isCompound(options) + ) { + return true; + } + return { + id: 'test-session-id', + configuration: { name: 'Test Config' }, + } as DebugSession; + }, + terminateSession: () => Promise.resolve(), + currentSession: undefined, + sessions: [], + }; + + container + .bind(DebugConfigurationManager) + .toConstantValue( + mockDebugConfigurationManager as DebugConfigurationManager + ); + container + .bind(DebugSessionManager) + .toConstantValue(mockDebugSessionManager as DebugSessionManager); + + launchListProvider = container.resolve(LaunchListProvider); + launchRunnerProvider = container.resolve(LaunchRunnerProvider); + launchStopProvider = container.resolve(LaunchStopProvider); + }); + + function createMockConfigurations(): DebugSessionOptions[] { + const config1: DebugConfiguration = { + name: 'Node.js Debug', + type: 'node', + request: 'launch', + program: '${workspaceFolder}/app.js', + }; + + const config2: DebugConfiguration = { + name: 'Python Debug', + type: 'python', + request: 'launch', + program: '${workspaceFolder}/main.py', + }; + + const compound: DebugCompound = { + name: 'Launch All', + configurations: ['Node.js Debug', 'Python Debug'], + }; + + return [ + { + name: 'Node.js Debug', + configuration: config1, + workspaceFolderUri: '/workspace', + }, + { + name: 'Python Debug', + configuration: config2, + workspaceFolderUri: '/workspace', + }, + { name: 'Launch All', compound, workspaceFolderUri: '/workspace' }, + ]; + } + + describe('LaunchListProvider', () => { + it('should provide the correct tool metadata', () => { + const tool = launchListProvider.getTool(); + expect(tool.id).to.equal('listLaunchConfigurations'); + expect(tool.name).to.equal('listLaunchConfigurations'); + expect(tool.description).to.contain( + 'Lists available launch configurations' + ); + expect(tool.parameters.required).to.deep.equal(['filter']); + }); + + it('should list all configurations without filter', async () => { + const tool = launchListProvider.getTool(); + const result = await tool.handler('{"filter":""}'); + expect(result).to.be.a('string'); + const configurations = JSON.parse(result as string); + + expect(configurations).to.be.an('array'); + expect(configurations).to.have.lengthOf(3); + expect(configurations.map((c: { name: string }) => c.name)).to.include('Node.js Debug'); + expect(configurations.map((c: { name: string }) => c.name)).to.include('Python Debug'); + expect(configurations.map((c: { name: string }) => c.name)).to.include('Launch All'); + // All configurations should show running: false since no sessions are active + configurations.forEach((config: { name: string; running: boolean }) => { + expect(config.running).to.equal(false); + }); + }); + + it('should filter configurations by name', async () => { + const tool = launchListProvider.getTool(); + const result = await tool.handler('{"filter":"Node"}'); + expect(result).to.be.a('string'); + const configurations = JSON.parse(result as string); + + expect(configurations).to.be.an('array'); + expect(configurations).to.have.lengthOf(1); + expect(configurations[0].name).to.equal('Node.js Debug'); + expect(configurations[0].running).to.equal(false); + }); + + it('should handle case-insensitive filtering', async () => { + const tool = launchListProvider.getTool(); + const result = await tool.handler('{"filter":"python"}'); + expect(result).to.be.a('string'); + const configurations = JSON.parse(result as string); + + expect(configurations).to.be.an('array'); + expect(configurations).to.have.lengthOf(1); + expect(configurations[0].name).to.equal('Python Debug'); + expect(configurations[0].running).to.equal(false); + }); + }); + + describe('LaunchRunnerProvider', () => { + it('should provide the correct tool metadata', () => { + const tool = launchRunnerProvider.getTool(); + expect(tool.id).to.equal('runLaunchConfiguration'); + expect(tool.name).to.equal('runLaunchConfiguration'); + expect(tool.description).to.contain( + 'Executes a specified launch configuration' + ); + expect(tool.parameters.required).to.deep.equal([ + 'configurationName', + ]); + }); + + it('should start a valid configuration', async () => { + const tool = launchRunnerProvider.getTool(); + const result = await tool.handler( + '{"configurationName":"Node.js Debug"}' + ); + + expect(result).to.be.a('string'); + expect(result).to.contain('Node.js Debug'); + expect(result).to.contain('started with session ID'); + }); + + it('should handle unknown configuration', async () => { + const tool = launchRunnerProvider.getTool(); + const result = await tool.handler( + '{"configurationName":"Unknown Config"}' + ); + + expect(result).to.be.a('string'); + expect(result).to.contain('Did not find a launch configuration'); + expect(result).to.contain('Unknown Config'); + }); + + it('should handle compound configurations', async () => { + const tool = launchRunnerProvider.getTool(); + const result = await tool.handler( + '{"configurationName":"Launch All"}' + ); + + expect(result).to.be.a('string'); + expect(result).to.contain('Compound launch configuration'); + expect(result).to.contain('Launch All'); + expect(result).to.contain('started successfully'); + }); + }); + + describe('LaunchStopProvider', () => { + it('should provide the correct tool metadata', () => { + const tool = launchStopProvider.getTool(); + expect(tool.id).to.equal('stopLaunchConfiguration'); + expect(tool.name).to.equal('stopLaunchConfiguration'); + expect(tool.description).to.contain( + 'Stops an active launch configuration' + ); + expect(tool.parameters.required).to.deep.equal([]); + }); + + it('should stop current session when no configuration name provided', async () => { + ( + mockDebugSessionManager as { currentSession: unknown } + ).currentSession = { + id: 'current-session', + configuration: { name: 'Current Config' }, + }; + + const tool = launchStopProvider.getTool(); + const result = await tool.handler('{}'); + + expect(result).to.be.a('string'); + expect(result).to.contain( + 'Successfully stopped current debug session' + ); + expect(result).to.contain('Current Config'); + }); + + it('should handle no active session', async () => { + ( + mockDebugSessionManager as { currentSession: unknown } + ).currentSession = undefined; + + const tool = launchStopProvider.getTool(); + const result = await tool.handler('{}'); + + expect(result).to.be.a('string'); + expect(result).to.contain('No active debug session to stop'); + }); + + it('should stop specific session by name', async () => { + Object.defineProperty(mockDebugSessionManager, 'sessions', { + value: [ + { + id: 'session-1', + configuration: { name: 'Node.js Debug' }, + }, + { + id: 'session-2', + configuration: { name: 'Python Debug' }, + }, + ], + writable: true, + configurable: true, + }); + + const tool = launchStopProvider.getTool(); + const result = await tool.handler( + '{"configurationName":"Node.js Debug"}' + ); + + expect(result).to.be.a('string'); + expect(result).to.contain( + 'Successfully stopped launch configuration' + ); + expect(result).to.contain('Node.js Debug'); + }); + + it('should handle session not found by name', async () => { + Object.defineProperty(mockDebugSessionManager, 'sessions', { + value: [], + writable: true, + configurable: true, + }); + + const tool = launchStopProvider.getTool(); + const result = await tool.handler( + '{"configurationName":"Unknown Config"}' + ); + + expect(result).to.be.a('string'); + expect(result).to.contain('No active session found'); + expect(result).to.contain('Unknown Config'); + }); + }); +}); diff --git a/packages/ai-ide/src/browser/workspace-launch-provider.ts b/packages/ai-ide/src/browser/workspace-launch-provider.ts new file mode 100644 index 0000000..3822bcf --- /dev/null +++ b/packages/ai-ide/src/browser/workspace-launch-provider.ts @@ -0,0 +1,244 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { ToolInvocationContext, ToolProvider, ToolRequest } from '@theia/ai-core'; +import { CancellationToken } from '@theia/core'; +import { inject, injectable } from '@theia/core/shared/inversify'; +import { DebugConfigurationManager } from '@theia/debug/lib/browser/debug-configuration-manager'; +import { DebugSessionManager } from '@theia/debug/lib/browser/debug-session-manager'; +import { DebugSessionOptions } from '@theia/debug/lib/browser/debug-session-options'; +import { DebugSession } from '@theia/debug/lib/browser/debug-session'; +import { + LIST_LAUNCH_CONFIGURATIONS_FUNCTION_ID, + RUN_LAUNCH_CONFIGURATION_FUNCTION_ID, + STOP_LAUNCH_CONFIGURATION_FUNCTION_ID +} from '../common/workspace-functions'; + +export interface LaunchConfigurationInfo { + name: string; + running: boolean; +} + +@injectable() +export class LaunchListProvider implements ToolProvider { + + @inject(DebugConfigurationManager) + protected readonly debugConfigurationManager: DebugConfigurationManager; + + @inject(DebugSessionManager) + protected readonly debugSessionManager: DebugSessionManager; + + getTool(): ToolRequest { + return { + id: LIST_LAUNCH_CONFIGURATIONS_FUNCTION_ID, + name: LIST_LAUNCH_CONFIGURATIONS_FUNCTION_ID, + description: 'Lists available launch configurations in the workspace. Launch configurations can be filtered by name. Each configuration includes its running status.', + parameters: { + type: 'object', + properties: { + filter: { + type: 'string', + description: 'Filter to apply on launch configuration names (empty string to retrieve all configurations).' + } + }, + required: ['filter'] + }, + handler: async (argString: string) => { + const filterArgs: { filter: string } = JSON.parse(argString); + const configurations = await this.getAvailableLaunchConfigurations(filterArgs.filter); + return JSON.stringify(configurations); + } + }; + } + + private async getAvailableLaunchConfigurations(filter: string = ''): Promise { + await this.debugConfigurationManager.load(); + const configurations: LaunchConfigurationInfo[] = []; + const runningSessions = new Set( + this.debugSessionManager.sessions.map(session => session.configuration.name) + ); + + for (const options of this.debugConfigurationManager.all) { + const name = this.getDisplayName(options); + if (name.toLowerCase().includes(filter.toLowerCase())) { + configurations.push({ + name, + running: runningSessions.has(name) + }); + } + } + + return configurations; + } + + private getDisplayName(options: DebugSessionOptions): string { + if (DebugSessionOptions.isConfiguration(options)) { + return options.configuration.name; + } else if (DebugSessionOptions.isCompound(options)) { + return options.compound.name; + } + return 'Unnamed Configuration'; + } +} + +@injectable() +export class LaunchRunnerProvider implements ToolProvider { + + @inject(DebugConfigurationManager) + protected readonly debugConfigurationManager: DebugConfigurationManager; + + @inject(DebugSessionManager) + protected readonly debugSessionManager: DebugSessionManager; + + getTool(): ToolRequest { + return { + id: RUN_LAUNCH_CONFIGURATION_FUNCTION_ID, + name: RUN_LAUNCH_CONFIGURATION_FUNCTION_ID, + description: 'Executes a specified launch configuration to start debugging.', + parameters: { + type: 'object', + properties: { + configurationName: { + type: 'string', + description: 'The name of the launch configuration to execute.' + } + }, + required: ['configurationName'] + }, + handler: async (argString: string, ctx?: ToolInvocationContext) => this.handleRunLaunchConfiguration(argString, ctx?.cancellationToken) + }; + } + + private async handleRunLaunchConfiguration(argString: string, cancellationToken?: CancellationToken): Promise { + try { + const args: { configurationName: string } = JSON.parse(argString); + + await this.debugConfigurationManager.load(); + + const options = this.findConfigurationByName(args.configurationName); + if (!options) { + return `Did not find a launch configuration for the name: '${args.configurationName}'`; + } + + const session = await this.debugSessionManager.start(options); + + if (!session) { + return `Failed to start launch configuration '${args.configurationName}'`; + } + + if (cancellationToken && typeof session !== 'boolean') { + cancellationToken.onCancellationRequested(() => { + this.debugSessionManager.terminateSession(session); + }); + } + + const sessionInfo = typeof session === 'boolean' + ? `Compound launch configuration '${args.configurationName}' started successfully` + : `Launch configuration '${args.configurationName}' started with session ID: ${session.id}`; + + return sessionInfo; + + } catch (error) { + return JSON.stringify({ + success: false, + message: error instanceof Error ? error.message : 'Failed to run launch configuration' + }); + } + } + + private findConfigurationByName(name: string): DebugSessionOptions | undefined { + for (const options of this.debugConfigurationManager.all) { + const displayName = this.getDisplayName(options); + if (displayName === name) { + return options; + } + } + return undefined; + } + + private getDisplayName(options: DebugSessionOptions): string { + if (DebugSessionOptions.isConfiguration(options)) { + return options.configuration.name; + } else if (DebugSessionOptions.isCompound(options)) { + return options.compound.name; + } + return 'Unnamed Configuration'; + } +} + +@injectable() +export class LaunchStopProvider implements ToolProvider { + + @inject(DebugSessionManager) + protected readonly debugSessionManager: DebugSessionManager; + + getTool(): ToolRequest { + return { + id: STOP_LAUNCH_CONFIGURATION_FUNCTION_ID, + name: STOP_LAUNCH_CONFIGURATION_FUNCTION_ID, + description: 'Stops an active launch configuration or debug session.', + parameters: { + type: 'object', + properties: { + configurationName: { + type: 'string', + description: 'The name of the launch configuration to stop. If not provided, stops the current active session.' + } + }, + required: [] + }, + handler: async (argString: string) => this.handleStopLaunchConfiguration(argString) + }; + } + + private async handleStopLaunchConfiguration(argString: string): Promise { + try { + const args: { configurationName?: string } = JSON.parse(argString); + + if (args.configurationName) { + // Find and stop specific session by configuration name + const session = this.findSessionByConfigurationName(args.configurationName); + if (!session) { + return `No active session found for launch configuration: '${args.configurationName}'`; + } + + await this.debugSessionManager.terminateSession(session); + return `Successfully stopped launch configuration: '${args.configurationName}'`; + } else { + // Stop current active session + const currentSession = this.debugSessionManager.currentSession; + if (!currentSession) { + return 'No active debug session to stop'; + } + + await this.debugSessionManager.terminateSession(currentSession); + return `Successfully stopped current debug session: '${currentSession.configuration.name}'`; + } + + } catch (error) { + return JSON.stringify({ + success: false, + message: error instanceof Error ? error.message : 'Failed to stop launch configuration' + }); + } + } + + private findSessionByConfigurationName(configurationName: string): DebugSession | undefined { + return this.debugSessionManager.sessions.find( + session => session.configuration.name === configurationName + ); + } +} diff --git a/packages/ai-ide/src/browser/workspace-search-provider.spec.ts b/packages/ai-ide/src/browser/workspace-search-provider.spec.ts new file mode 100644 index 0000000..8861436 --- /dev/null +++ b/packages/ai-ide/src/browser/workspace-search-provider.spec.ts @@ -0,0 +1,102 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { expect } from 'chai'; +import { CancellationTokenSource, PreferenceService } from '@theia/core'; +import { WorkspaceSearchProvider } from './workspace-search-provider'; +import { ToolInvocationContext } from '@theia/ai-core'; +import { Container } from '@theia/core/shared/inversify'; +import { SearchInWorkspaceService, SearchInWorkspaceCallbacks } from '@theia/search-in-workspace/lib/browser/search-in-workspace-service'; +import { WorkspaceFunctionScope } from './workspace-functions'; +import { FileService } from '@theia/filesystem/lib/browser/file-service'; +import { URI } from '@theia/core/lib/common/uri'; +import { SearchInWorkspaceOptions } from '@theia/search-in-workspace/lib/common/search-in-workspace-interface'; + +describe('Workspace Search Provider Cancellation Tests', () => { + let cancellationTokenSource: CancellationTokenSource; + let mockCtx: ToolInvocationContext; + let container: Container; + let searchService: SearchInWorkspaceService; + + beforeEach(() => { + cancellationTokenSource = new CancellationTokenSource(); + + // Setup mock context + mockCtx = { + cancellationToken: cancellationTokenSource.token + }; + + // Create a new container for each test + container = new Container(); + + // Mock dependencies + searchService = { + searchWithCallback: async ( + query: string, + rootUris: string[], + callbacks: SearchInWorkspaceCallbacks, + options: SearchInWorkspaceOptions + ) => { + const searchId = 1; + return searchId; + }, + cancel: (searchId: number) => { + // Mock cancellation + } + } as unknown as SearchInWorkspaceService; + + const mockWorkspaceScope = { + getWorkspaceRoot: async () => new URI('file:///workspace'), + ensureWithinWorkspace: () => { }, + resolveRelativePath: async (path: string) => new URI(`file:///workspace/${path}`) + } as unknown as WorkspaceFunctionScope; + + const mockPreferenceService = { + get: () => 30 + }; + + const mockFileService = { + exists: async () => true, + resolve: async () => ({ isDirectory: true }) + } as unknown as FileService; + + // Register mocks in the container + container.bind(SearchInWorkspaceService).toConstantValue(searchService); + container.bind(WorkspaceFunctionScope).toConstantValue(mockWorkspaceScope); + container.bind(PreferenceService).toConstantValue(mockPreferenceService); + container.bind(FileService).toConstantValue(mockFileService); + container.bind(WorkspaceSearchProvider).toSelf(); + }); + + afterEach(() => { + cancellationTokenSource.dispose(); + }); + + it('should respect cancellation token at the beginning of the search', async () => { + const searchProvider = container.get(WorkspaceSearchProvider); + cancellationTokenSource.cancel(); + + const handler = searchProvider.getTool().handler; + const result = await handler( + JSON.stringify({ query: 'test', useRegExp: false }), + mockCtx + ); + + const jsonResponse = JSON.parse(result as string); + expect(jsonResponse.error).to.equal('Operation cancelled by user'); + }); + +}); diff --git a/packages/ai-ide/src/browser/workspace-search-provider.ts b/packages/ai-ide/src/browser/workspace-search-provider.ts new file mode 100644 index 0000000..5130c83 --- /dev/null +++ b/packages/ai-ide/src/browser/workspace-search-provider.ts @@ -0,0 +1,221 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { ToolInvocationContext, ToolProvider, ToolRequest } from '@theia/ai-core'; +import { CancellationToken } from '@theia/core'; +import { PreferenceService } from '@theia/core/lib/common/preferences/preference-service'; +import { inject, injectable } from '@theia/core/shared/inversify'; +import { FileService } from '@theia/filesystem/lib/browser/file-service'; +import { SearchInWorkspaceService, SearchInWorkspaceCallbacks } from '@theia/search-in-workspace/lib/browser/search-in-workspace-service'; +import { SearchInWorkspaceResult, SearchInWorkspaceOptions } from '@theia/search-in-workspace/lib/common/search-in-workspace-interface'; +import { SEARCH_IN_WORKSPACE_FUNCTION_ID } from '../common/workspace-functions'; +import { WorkspaceFunctionScope } from './workspace-functions'; +import { SEARCH_IN_WORKSPACE_MAX_RESULTS_PREF } from '../common/workspace-preferences'; +import { optimizeSearchResults } from '../common/workspace-search-provider-util'; + +@injectable() +export class WorkspaceSearchProvider implements ToolProvider { + + @inject(SearchInWorkspaceService) + protected readonly searchService: SearchInWorkspaceService; + + @inject(WorkspaceFunctionScope) + protected readonly workspaceScope: WorkspaceFunctionScope; + + @inject(PreferenceService) + protected readonly preferenceService: PreferenceService; + + @inject(FileService) + protected readonly fileService: FileService; + + getTool(): ToolRequest { + return { + id: SEARCH_IN_WORKSPACE_FUNCTION_ID, + name: SEARCH_IN_WORKSPACE_FUNCTION_ID, + description: 'Searches file contents within the workspace for lines matching the given search term. ' + + 'Returns up to 30 matching results by default (configurable via preferences). If results are truncated, ' + + 'refine your search with fileExtensions or subDirectoryPath filters. ' + + 'The search uses case-insensitive string matching or regular expressions (controlled by the `useRegExp` parameter). ' + + 'Returns a list of matches including: file path, line number, and the matching line content. ' + + 'Multi-word patterns must match exactly (including spaces, case-insensitively). ' + + 'For best results, use specific search terms and filter by file extensions or subdirectories. ' + + 'For complex searches, prefer multiple simpler queries over one complex regex. ' + + 'Use this for finding code patterns, function usages, or text across the codebase. ' + + 'Do NOT use this for finding files by name - use findFilesByPattern instead.', + parameters: { + type: 'object', + properties: { + query: { + type: 'string', + description: 'The search term or regular expression pattern.', + }, + useRegExp: { + type: 'boolean', + description: 'Set to true if the query is a regular expression.', + }, + fileExtensions: { + type: 'array', + items: { + type: 'string' + }, + description: 'Optional array of file extensions to search in (e.g., ["ts", "js", "py"]). If not specified, searches all files.' + }, + subDirectoryPath: { + type: 'string', + description: 'Optional subdirectory path to limit search scope. Use relative paths from workspace root ' + + '(e.g., "packages/ai-ide/src", "packages/core/src/browser"). If not specified, searches entire workspace.' + } + }, + required: ['query', 'useRegExp'] + }, + handler: (argString, ctx?: ToolInvocationContext) => this.handleSearch(argString, ctx?.cancellationToken) + }; + } + + private async determineSearchRoots(subDirectoryPath?: string): Promise { + const workspaceRoot = await this.workspaceScope.getWorkspaceRoot(); + + if (!subDirectoryPath) { + return [workspaceRoot.toString()]; + } + + const subDirUri = workspaceRoot.resolve(subDirectoryPath); + this.workspaceScope.ensureWithinWorkspace(subDirUri, workspaceRoot); + + try { + const stat = await this.fileService.resolve(subDirUri); + if (!stat || !stat.isDirectory) { + throw new Error(`Subdirectory '${subDirectoryPath}' does not exist or is not a directory`); + } + } catch (error) { + throw new Error(`Invalid subdirectory path '${subDirectoryPath}': ${error.message}`); + } + + return [subDirUri.toString()]; + } + + private async handleSearch(argString: string, cancellationToken?: CancellationToken): Promise { + try { + const args: { query: string, useRegExp: boolean, fileExtensions?: string[], subDirectoryPath?: string } = JSON.parse(argString); + const results: SearchInWorkspaceResult[] = []; + let expectedSearchId: number | undefined; + let searchCompleted = false; + + cancellationToken?.onCancellationRequested(() => { + if (expectedSearchId !== undefined && !searchCompleted) { + this.searchService.cancel(expectedSearchId); + searchCompleted = true; + } + }); + if (cancellationToken?.isCancellationRequested) { + return JSON.stringify({ error: 'Operation cancelled by user' }); + } + + const searchPromise = new Promise(async (resolve, reject) => { + const callbacks: SearchInWorkspaceCallbacks = { + onResult: (id, result) => { + if (expectedSearchId !== undefined && id !== expectedSearchId) { + return; + } + + if (searchCompleted) { + return; + } + + results.push(result); + }, + onDone: (id, error) => { + if (expectedSearchId !== undefined && id !== expectedSearchId) { + return; + } + + if (searchCompleted) { + return; + } + + searchCompleted = true; + if (error) { + reject(new Error('Search failed: ' + error)); + } else { + resolve(results); + } + } + }; + + // Use one more than our actual maximum. this way we can determine if we have more results than our maximum and warn the user + const maxResultsForTheiaAPI = this.preferenceService.get(SEARCH_IN_WORKSPACE_MAX_RESULTS_PREF, 30) + 1; + const options: SearchInWorkspaceOptions = { + useRegExp: args.useRegExp, + matchCase: false, + matchWholeWord: false, + maxResults: maxResultsForTheiaAPI, + }; + + if (args.fileExtensions && args.fileExtensions.length > 0) { + options.include = args.fileExtensions.map(ext => `**/*.${ext}`); + } + + await this.determineSearchRoots(args.subDirectoryPath) + .then(rootUris => this.searchService.searchWithCallback(args.query, rootUris, callbacks, options)) + .then(id => { + expectedSearchId = id; + cancellationToken?.onCancellationRequested(() => { + this.searchService.cancel(id); + }); + }) + .catch(err => { + searchCompleted = true; + reject(err); + }); + }); + + const timeoutPromise = new Promise((_, reject) => { + setTimeout(() => { + if (expectedSearchId !== undefined && !searchCompleted) { + this.searchService.cancel(expectedSearchId); + searchCompleted = true; + reject(new Error('Search timed out after 30 seconds')); + } + }, 30000); + }); + + const finalResults = await Promise.race([searchPromise, timeoutPromise]); + const maxResults = this.preferenceService.get(SEARCH_IN_WORKSPACE_MAX_RESULTS_PREF, 30); + + const workspaceRoot = await this.workspaceScope.getWorkspaceRoot(); + const formattedResults = optimizeSearchResults(finalResults, workspaceRoot); + + let numberOfMatchesInFinalResults = 0; + for (const result of finalResults) { + numberOfMatchesInFinalResults += result.matches.length; + } + if (numberOfMatchesInFinalResults > maxResults) { + return JSON.stringify({ + info: 'Search limit exceeded: Found ' + maxResults + '+ results. ' + + 'Please refine your search with more specific terms or use file extension filters. ' + + 'You can increase the limit in preferences under \'ai-features.workspaceFunctions.searchMaxResults\'.', + incompleteResults: formattedResults + }); + } + + return JSON.stringify(formattedResults); + + } catch (error) { + return JSON.stringify({ error: error.message || 'Failed to execute search' }); + } + } +} + diff --git a/packages/ai-ide/src/browser/workspace-task-provider.spec.ts b/packages/ai-ide/src/browser/workspace-task-provider.spec.ts new file mode 100644 index 0000000..90ab150 --- /dev/null +++ b/packages/ai-ide/src/browser/workspace-task-provider.spec.ts @@ -0,0 +1,123 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { expect } from 'chai'; +import { CancellationTokenSource } from '@theia/core'; +import { TaskListProvider, TaskRunnerProvider } from './workspace-task-provider'; +import { ToolInvocationContext } from '@theia/ai-core'; +import { Container } from '@theia/core/shared/inversify'; +import { TaskService } from '@theia/task/lib/browser/task-service'; +import { TerminalService } from '@theia/terminal/lib/browser/base/terminal-service'; +import { TaskConfiguration, TaskInfo } from '@theia/task/lib/common'; +import { TerminalWidget } from '@theia/terminal/lib/browser/base/terminal-widget'; + +describe('Workspace Task Provider Cancellation Tests', () => { + let cancellationTokenSource: CancellationTokenSource; + let mockCtx: ToolInvocationContext; + let container: Container; + let mockTaskService: TaskService; + let mockTerminalService: TerminalService; + + beforeEach(() => { + cancellationTokenSource = new CancellationTokenSource(); + + // Setup mock context + mockCtx = { + cancellationToken: cancellationTokenSource.token + }; + + // Create a new container for each test + container = new Container(); + + // Mock dependencies + mockTaskService = { + startUserAction: () => 123, + getTasks: async (token: number) => [ + { + label: 'build', + _scope: 'workspace', + type: 'shell' + } as TaskConfiguration, + { + label: 'test', + _scope: 'workspace', + type: 'shell' + } as TaskConfiguration + ], + runTaskByLabel: async (token: number, taskLabel: string) => { + if (taskLabel === 'build' || taskLabel === 'test') { + return { + taskId: 0, + terminalId: 0, + config: { + label: taskLabel, + _scope: 'workspace', + type: 'shell' + } + } as TaskInfo; + } + return undefined; + }, + terminateTask: async (activeTaskInfo: TaskInfo) => { + // Track termination + }, + getTerminateSignal: async () => 'SIGTERM' + } as unknown as TaskService; + + mockTerminalService = { + getByTerminalId: () => ({ + buffer: { + length: 10, + getLines: () => ['line1', 'line2', 'line3'], + }, + clearOutput: () => { } + } as unknown as TerminalWidget) + } as unknown as TerminalService; + + // Register mocks in the container + container.bind(TaskService).toConstantValue(mockTaskService); + container.bind(TerminalService).toConstantValue(mockTerminalService); + container.bind(TaskListProvider).toSelf(); + container.bind(TaskRunnerProvider).toSelf(); + }); + + afterEach(() => { + cancellationTokenSource.dispose(); + }); + + it('TaskListProvider should respect cancellation token', async () => { + const taskListProvider = container.get(TaskListProvider); + cancellationTokenSource.cancel(); + + const handler = taskListProvider.getTool().handler; + const result = await handler(JSON.stringify({ filter: '' }), mockCtx); + + const jsonResponse = JSON.parse(result as string); + expect(jsonResponse.error).to.equal('Operation cancelled by user'); + }); + + it('TaskRunnerProvider should respect cancellation token at the beginning', async () => { + const taskRunnerProvider = container.get(TaskRunnerProvider); + cancellationTokenSource.cancel(); + + const handler = taskRunnerProvider.getTool().handler; + const result = await handler(JSON.stringify({ taskName: 'build' }), mockCtx); + + const jsonResponse = JSON.parse(result as string); + expect(jsonResponse.error).to.equal('Operation cancelled by user'); + }); + +}); diff --git a/packages/ai-ide/src/browser/workspace-task-provider.ts b/packages/ai-ide/src/browser/workspace-task-provider.ts new file mode 100644 index 0000000..7beaff7 --- /dev/null +++ b/packages/ai-ide/src/browser/workspace-task-provider.ts @@ -0,0 +1,148 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { ToolInvocationContext, ToolProvider, ToolRequest } from '@theia/ai-core'; +import { CancellationToken } from '@theia/core'; +import { inject, injectable } from '@theia/core/shared/inversify'; +import { TaskService } from '@theia/task/lib/browser/task-service'; +import { TerminalService } from '@theia/terminal/lib/browser/base/terminal-service'; +import { LIST_TASKS_FUNCTION_ID, RUN_TASK_FUNCTION_ID } from '../common/workspace-functions'; + +@injectable() +export class TaskListProvider implements ToolProvider { + + @inject(TaskService) + protected readonly taskService: TaskService; + + getTool(): ToolRequest { + return { + id: LIST_TASKS_FUNCTION_ID, + name: LIST_TASKS_FUNCTION_ID, + description: 'Lists available tasks in the workspace that can be executed with runTask. Returns an array ' + + 'of task labels (strings). Common task types include npm scripts, shell tasks, and build tasks. ' + + 'Use the filter parameter with an empty string "" to retrieve all tasks, or provide a substring ' + + 'to filter (e.g., "test" returns tasks containing "test" in the name). ' + + 'Example return: ["npm: build", "npm: test", "npm: lint"]. ' + + 'Always call this before runTask to discover exact task names.', + parameters: { + type: 'object', + properties: { + filter: { + type: 'string', + description: 'Substring filter for task names. Use "" (empty string) to retrieve all tasks, ' + + 'or a keyword like "build", "test", "lint" to filter results.' + } + }, + required: ['filter'] + }, + handler: async (argString: string, ctx?: ToolInvocationContext) => { + if (ctx?.cancellationToken?.isCancellationRequested) { + return JSON.stringify({ error: 'Operation cancelled by user' }); + } + const filterArgs: { filter: string } = JSON.parse(argString); + const tasks = await this.getAvailableTasks(filterArgs.filter); + const taskString = JSON.stringify(tasks); + return taskString; + } + }; + } + private async getAvailableTasks(filter: string = ''): Promise { + const userActionToken = this.taskService.startUserAction(); + const tasks = await this.taskService.getTasks(userActionToken); + const filteredTasks = tasks.filter(task => task.label.toLowerCase().includes(filter.toLowerCase())); + return filteredTasks.map(task => task.label); + } +} + +@injectable() +export class TaskRunnerProvider implements ToolProvider { + + @inject(TaskService) + protected readonly taskService: TaskService; + + @inject(TerminalService) + protected readonly terminalService: TerminalService; + + getTool(): ToolRequest { + return { + id: RUN_TASK_FUNCTION_ID, + name: RUN_TASK_FUNCTION_ID, + description: 'Executes a specified task by name and waits for completion. Returns the terminal output ' + + '(first and last 50 lines if output exceeds this limit). The task must exist in the workspace ' + + '(use listTasks to discover available tasks). Common task types include: build tasks ' + + '(e.g., "npm: build"), test tasks (e.g., "npm: test"), and lint tasks (e.g., "npm: lint"). ' + + 'If the task fails, the error output is included in the response. Tasks may take significant ' + + 'time to complete (builds can take minutes). The operation can be cancelled by the user. ' + + 'Do NOT use this for tasks you haven\'t discovered via listTasks first.', + parameters: { + type: 'object', + properties: { + taskName: { + type: 'string', + description: 'The exact name/label of the task to execute, as returned by listTasks.' + } + }, + required: ['taskName'] + }, + handler: async (argString: string, ctx?: ToolInvocationContext) => this.handleRunTask(argString, ctx?.cancellationToken) + + }; + } + + private async handleRunTask(argString: string, cancellationToken?: CancellationToken): Promise { + try { + const args: { taskName: string } = JSON.parse(argString); + + const token = this.taskService.startUserAction(); + + const taskInfo = await this.taskService.runTaskByLabel(token, args.taskName); + if (!taskInfo) { + return `Did not find a task for the label: '${args.taskName}'`; + } + cancellationToken?.onCancellationRequested(() => { + this.taskService.terminateTask(taskInfo); + }); + if (cancellationToken?.isCancellationRequested) { + return JSON.stringify({ error: 'Operation cancelled by user' }); + } + const signal = await this.taskService.getTerminateSignal(taskInfo.taskId); + if (taskInfo.terminalId) { + const terminal = this.terminalService.getByTerminalId(taskInfo.terminalId!); + + const length = terminal?.buffer.length ?? 0; + const numberOfLines = Math.min(length, 50); + const result: string[] = []; + const allLines = terminal?.buffer.getLines(0, length).reverse() ?? []; + + // collect the first 50 lines: + const firstLines = allLines.slice(0, numberOfLines); + result.push(...firstLines); + // collect the last 50 lines: + if (length > numberOfLines) { + const lastLines = allLines.slice(length - numberOfLines); + result.push(...lastLines); + } + terminal?.clearOutput(); + return result.join('\n'); + } + return `No terminal output available. The terminate signal was :${signal}.`; + + } catch (error) { + return JSON.stringify({ success: false, message: error.message || 'Failed to run task' }); + } + } +} + diff --git a/packages/ai-ide/src/common/ai-configuration-preferences.ts b/packages/ai-ide/src/common/ai-configuration-preferences.ts new file mode 100644 index 0000000..8039e19 --- /dev/null +++ b/packages/ai-ide/src/common/ai-configuration-preferences.ts @@ -0,0 +1,49 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { nls } from '@theia/core'; +import { PreferenceSchema } from '@theia/core/lib/common'; + +/** + * These preferences are not intended to reflect real settings. + * They are placeholders to redirect users to the appropriate widget + * in case the user looks in the preferences editor UI to find the configuration. + */ +export const AiConfigurationPreferences: PreferenceSchema = { + properties: { + 'ai-features.agentSettings.details': { + type: 'null', + markdownDescription: nls.localize('theia/ai/ide/agent-description', + 'Configure AI agent settings including enablement, LLM selection, prompt template customization, and custom agent creation in the [AI Configuration View]({0}).', + 'command:aiConfiguration:open' + ) + }, + 'ai-features.promptTemplates.details': { + type: 'null', + markdownDescription: nls.localize('theia/ai/ide/prompt-template-description', + 'Select prompt variants and customize prompt templates for AI agents in the [AI Configuration View]({0}).', + 'command:aiConfiguration:open' + ) + }, + 'ai-features.modelSelection.details': { + type: 'null', + markdownDescription: nls.localize('theia/ai/ide/model-selection-description', + 'Choose which Large Language Models (LLMs) are used by each AI agent in the [AI Configuration View]({0}).', + 'command:aiConfiguration:open' + ) + } + } +}; diff --git a/packages/ai-ide/src/common/ai-ide-preferences.ts b/packages/ai-ide/src/common/ai-ide-preferences.ts new file mode 100644 index 0000000..573ddac --- /dev/null +++ b/packages/ai-ide/src/common/ai-ide-preferences.ts @@ -0,0 +1,54 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { AI_CORE_PREFERENCES_TITLE } from '@theia/ai-core/lib/common'; +import { nls, PreferenceSchema } from '@theia/core'; + +// We reuse the context key for the preference name +export const PREFERENCE_NAME_ENABLE_AI = 'ai-features.AiEnable.enableAI'; +export const PREFERENCE_NAME_ORCHESTRATOR_EXCLUSION_LIST = 'ai-features.orchestrator.excludedAgents'; + +export const aiIdePreferenceSchema: PreferenceSchema = { + properties: { + [PREFERENCE_NAME_ENABLE_AI]: { + title: AI_CORE_PREFERENCES_TITLE, + markdownDescription: nls.localize('theia/ai/ide/enableAI/mdDescription', + '❗ This setting allows you to access the latest AI capabilities (Beta version).\ + \n\ + Please note that these features are in a beta phase, which means they may \ + undergo changes and will be further improved. It is important to be aware that these features may generate\ + continuous requests to the language models (LLMs) you provide access to. This might incur costs that you\ + need to monitor closely. By enabling this option, you acknowledge these risks.\ + \n\ + **Please note! The settings below in this section will only take effect\n\ + once the main feature setting is enabled. After enabling the feature, you need to configure at least one\ + LLM provider below. Also see [the documentation](https://theia-ide.org/docs/user_ai/)**.'), + type: 'boolean', + default: true, + }, + [PREFERENCE_NAME_ORCHESTRATOR_EXCLUSION_LIST]: { + title: AI_CORE_PREFERENCES_TITLE, + markdownDescription: nls.localize('theia/ai/ide/orchestrator/excludedAgents/mdDescription', + 'List of agent IDs that the orchestrator is not allowed to delegate to. ' + + 'These agents will not be visible to the orchestrator when selecting an agent to handle a request.'), + type: 'array', + items: { + type: 'string' + }, + default: ['ClaudeCode', 'Codex'], + } + } +}; diff --git a/packages/ai-ide/src/common/ai-terminal-functions.ts b/packages/ai-ide/src/common/ai-terminal-functions.ts new file mode 100644 index 0000000..407189e --- /dev/null +++ b/packages/ai-ide/src/common/ai-terminal-functions.ts @@ -0,0 +1,18 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +export const SUGGEST_TERMINAL_COMMAND_ID = 'suggestTerminalCommand'; + diff --git a/packages/ai-ide/src/common/app-tester-chat-functions.ts b/packages/ai-ide/src/common/app-tester-chat-functions.ts new file mode 100644 index 0000000..ff58fcc --- /dev/null +++ b/packages/ai-ide/src/common/app-tester-chat-functions.ts @@ -0,0 +1,20 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +export const LAUNCH_BROWSER_FUNCTION_ID = 'launchBrowser'; +export const IS_BROWSER_RUNNING_FUNCTION_ID = 'isBrowserRunning'; +export const CLOSE_BROWSER_FUNCTION_ID = 'closeBrowser'; +export const QUERY_DOM_FUNCTION_ID = 'queryDom'; diff --git a/packages/ai-ide/src/common/architect-prompt-template.ts b/packages/ai-ide/src/common/architect-prompt-template.ts new file mode 100644 index 0000000..36626a1 --- /dev/null +++ b/packages/ai-ide/src/common/architect-prompt-template.ts @@ -0,0 +1,265 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** +import { PromptVariantSet } from '@theia/ai-core/lib/common'; +import { + GET_WORKSPACE_FILE_LIST_FUNCTION_ID, FILE_CONTENT_FUNCTION_ID, SEARCH_IN_WORKSPACE_FUNCTION_ID, + GET_FILE_DIAGNOSTICS_ID, FIND_FILES_BY_PATTERN_FUNCTION_ID +} from './workspace-functions'; +import { CONTEXT_FILES_VARIABLE_ID, TASK_CONTEXT_SUMMARY_VARIABLE_ID } from './context-variables'; +import { UPDATE_CONTEXT_FILES_FUNCTION_ID } from './context-functions'; +import { + CREATE_TASK_CONTEXT_FUNCTION_ID, + GET_TASK_CONTEXT_FUNCTION_ID, + EDIT_TASK_CONTEXT_FUNCTION_ID, + LIST_TASK_CONTEXTS_FUNCTION_ID, + REWRITE_TASK_CONTEXT_FUNCTION_ID +} from './task-context-function-ids'; + +export const ARCHITECT_PLANNING_PROMPT_ID = 'architect-system-planning-next'; +export const ARCHITECT_SIMPLE_PROMPT_ID = 'architect-system-simple'; +export const ARCHITECT_DEFAULT_PROMPT_ID = 'architect-system-default'; + +export const architectSystemVariants = { + id: 'architect-system', + defaultVariant: { + id: ARCHITECT_DEFAULT_PROMPT_ID, + template: `{{!-- This prompt is licensed under the MIT License (https://opensource.org/license/mit). +Made improvements or adaptations to this prompt template? We'd love for you to share it with the community! Contribute back here: +https://github.com/eclipse-theia/theia/discussions/new?category=prompt-template-contribution --}} +# Instructions + +You are an AI assistant integrated into Theia IDE, designed to assist software developers. You can only change the files added to the context, but you can navigate and read the +users workspace using the provided functions.\ +Therefore describe and explain the details or procedures necessary to achieve the desired outcome. If file changes are necessary to help the user, be \ +aware that there is another agent called 'Coder' that can suggest file changes. In this case you can create a description on what to do and tell the user to ask '@Coder' to \ +implement the change plan. If you refer to files, always mention the workspace-relative path.\ + +## Context Retrieval +Use the following functions to interact with the workspace files if you require context: +- **~{${GET_WORKSPACE_FILE_LIST_FUNCTION_ID}}** +- **~{${FILE_CONTENT_FUNCTION_ID}}** +- **~{${FIND_FILES_BY_PATTERN_FUNCTION_ID}}** (find files by glob patterns like '**/*.ts') +- **~{${SEARCH_IN_WORKSPACE_FUNCTION_ID}}** + +If you cannot find good search terms, navigate the directory structure. +**Confirm Paths**: Always verify paths by listing directories or files as you navigate. Avoid assumptions based on user input alone. +**Navigate Step-by-Step**: Move into subdirectories only as needed, confirming each directory level. +Remember file locations that are relevant for completing your tasks using **~{${UPDATE_CONTEXT_FILES_FUNCTION_ID}}** +Only add files that are really relevant to look at later. Only add files that are really relevant to look at later. + +## File Validation +Use the following function to retrieve a list of problems in a file if the user requests fixes in a given file: **~{${GET_FILE_DIAGNOSTICS_ID}}** +## Additional Context +The following files have been provided for additional context. Some of them may also be referred to by the user (e.g. "this file" or "the attachment"). \ +Always look at the relevant files to understand your task using the function ~{${FILE_CONTENT_FUNCTION_ID}} +{{${CONTEXT_FILES_VARIABLE_ID}}} + +{{prompt:project-info}} + +{{${TASK_CONTEXT_SUMMARY_VARIABLE_ID}}} +` + }, + variants: [ + { + id: ARCHITECT_SIMPLE_PROMPT_ID, + template: `{{!-- This prompt is licensed under the MIT License (https://opensource.org/license/mit). +Made improvements or adaptations to this prompt template? We'd love for you to share it with the community! Contribute back here: +https://github.com/eclipse-theia/theia/discussions/new?category=prompt-template-contribution --}} +# Instructions + +You are an AI assistant integrated into Theia IDE, designed to assist software developers. You can't change any files, but you can navigate and read the users workspace using \ +the provided functions. Therefore describe and explain the details or procedures necessary to achieve the desired outcome. If file changes are necessary to help the user, be \ +aware that there is another agent called 'Coder' that can suggest file changes. In this case you can create a description on what to do and tell the user to ask '@Coder' to \ +implement the change plan. If you refer to files, always mention the workspace-relative path.\ + +Use the following functions to interact with the workspace files as needed: +- **~{${GET_WORKSPACE_FILE_LIST_FUNCTION_ID}}**: Lists files and directories in a specific directory. +- **~{${FILE_CONTENT_FUNCTION_ID}}**: Retrieves the content of a specific file. +- **~{${FIND_FILES_BY_PATTERN_FUNCTION_ID}}**: Find files by glob patterns like '**/*.ts'. + +### Workspace Navigation Guidelines + +1. **Start at the Root**: For general questions (e.g., "How to build the project"), check root-level documentation files or setup files before browsing subdirectories. +2. **Confirm Paths**: Always verify paths by listing directories or files as you navigate. Avoid assumptions based on user input alone. +3. **Navigate Step-by-Step**: Move into subdirectories only as needed, confirming each directory level. + +## Additional Context +The following files have been provided for additional context. Some of them may also be referred to by the user (e.g. "this file" or "the attachment"). \ +Always look at the relevant files to understand your task using the function ~{${FILE_CONTENT_FUNCTION_ID}} +{{${CONTEXT_FILES_VARIABLE_ID}}} + +{{prompt:project-info}} +` + }, + { + id: ARCHITECT_PLANNING_PROMPT_ID, + template: `{{!-- This prompt is licensed under the MIT License (https://opensource.org/license/mit). +Made improvements or adaptations to this prompt template? We'd love for you to share it with the community! Contribute back here: +https://github.com/eclipse-theia/theia/discussions/new?category=prompt-template-contribution --}} + +# Identity + +You are an AI planning assistant embedded in Theia IDE. Your purpose is to help developers \ +design implementation plans for features, bug fixes, and refactoring tasks. + +You create plans that will be executed by the Coder agent. Your plans should be thorough \ +enough that Coder can implement without rediscovering files or patterns. + +# Workflow Phases + +Follow these phases in order. Do not skip phases or rush to create a plan before understanding. + +**Asking questions:** You can ask clarifying questions at any phase - not just at the start. \ +Questions often emerge during or after exploration when you discover new information. + +**When to ask:** +- Requirements are ambiguous and could lead to wasted work +- Multiple valid approaches exist with significant trade-offs +- The scope turns out larger or different than expected +- You discover conflicting patterns in the codebase +- A design decision needs user input + +**When NOT to ask:** +- Minor technical decisions you can make reasonably +- Standard coding patterns +- Things you can figure out by exploring further + +## Phase 1: Understand the Request + +Before exploring code, get initial clarity on what's being asked: +- What is the user trying to achieve? +- What are the acceptance criteria? +- Are there constraints or requirements? + +Ask initial clarifying questions if the request is unclear. But don't try to anticipate everything - \ +you'll learn more during exploration. + +## Phase 2: Explore the Codebase + +Thoroughly explore before designing. Use parallel tool calls when possible. + +As you explore, you may discover new questions or ambiguities. Don't hesitate to ask the user \ +before proceeding if you find something that changes your understanding of the task. + +### Search Strategy - Choose the Right Tool + +| Situation | Tool | Example | +|-----------|------|---------| +| Know exact file path | ~{${FILE_CONTENT_FUNCTION_ID}} | Reading a specific config file | +| Know file pattern | ~{${FIND_FILES_BY_PATTERN_FUNCTION_ID}} | Find all \`*.spec.ts\` files | +| Looking for code/text | ~{${SEARCH_IN_WORKSPACE_FUNCTION_ID}} | Find usages of a function | +| Exploring structure | ~{${GET_WORKSPACE_FILE_LIST_FUNCTION_ID}} | Understanding project layout | + +**Important guidelines:** +- Never search for files whose paths you already know - read them directly +- When uncertain about location, search broadly first, then narrow down +- Look for existing patterns and examples to follow +- Identify ALL files that will need changes +- Find relevant tests + +### Parallel Exploration + +When multiple independent searches are needed, execute them in a single response: +- Reading multiple files → read them all at once +- Searching for different patterns → search in parallel + +**Never run independent operations one at a time.** + +## Phase 3: Design the Plan + +Once you understand the requirements and codebase, create the plan using ~{${CREATE_TASK_CONTEXT_FUNCTION_ID}}. + +### Plan Structure + +\`\`\`markdown +# [Task Title] + +## Goal +[1-2 sentences: what we're trying to achieve and why] + +## Design +[High-level approach, key design decisions, trade-offs considered] + +## Implementation Steps + +### Step 1: [Description] +- \`path/to/file.ts\` - what to change and why +- \`path/to/related.ts\` - related changes + +### Step 2: [Description] +- \`path/to/next-file.ts\` - what to change + +[Continue with additional steps as needed - order matters] + +## Reference Examples +[Existing code Coder should follow as patterns] +- \`path/to/example.ts:42\` - description of the pattern + +## Verification +[How to test the changes - specific commands or manual steps] +\`\`\` + +### Guidelines for Good Plans + +- **Be specific about files** - Use relative paths. Coder should not need to search. +- **Order steps logically** - Dependencies first, then dependents. +- **Include line references** - Use \`file.ts:123\` format when referencing specific code. +- **Show patterns to follow** - Reference existing code that demonstrates the right approach. +- **Keep it actionable** - Every step should be something Coder can execute. + +## Phase 4: Review and Refine + +Present your plan to the user. Incorporate feedback using ~{${EDIT_TASK_CONTEXT_FUNCTION_ID}} for targeted updates. + +**Before editing:** +1. Always call ~{${GET_TASK_CONTEXT_FUNCTION_ID}} first - the user may have edited the plan directly +2. Use ~{${EDIT_TASK_CONTEXT_FUNCTION_ID}} for targeted updates +3. If ~{${EDIT_TASK_CONTEXT_FUNCTION_ID}} fails repeatedly, use ~{${REWRITE_TASK_CONTEXT_FUNCTION_ID}} to replace the entire content +4. Summarize what you changed in chat + +# Tools Reference + +## Workspace Exploration +- ~{${GET_WORKSPACE_FILE_LIST_FUNCTION_ID}} — list contents of a directory +- ~{${FILE_CONTENT_FUNCTION_ID}} — retrieve file content +- ~{${FIND_FILES_BY_PATTERN_FUNCTION_ID}} — find files by glob pattern (e.g., \`**/*.ts\`) +- ~{${SEARCH_IN_WORKSPACE_FUNCTION_ID}} — search for text/patterns in the codebase + +## Task Context Management +- ~{${CREATE_TASK_CONTEXT_FUNCTION_ID}} — create a new implementation plan (opens in editor) +- ~{${GET_TASK_CONTEXT_FUNCTION_ID}} — read the current plan +- ~{${EDIT_TASK_CONTEXT_FUNCTION_ID}} — update specific sections of the plan (opens in editor) +- ~{${REWRITE_TASK_CONTEXT_FUNCTION_ID}} — completely replace the plan content (use as fallback) +- ~{${LIST_TASK_CONTEXTS_FUNCTION_ID}} — list all plans for this session (useful if you need to reference a specific plan by ID) + +**Important:** +- When you create or edit a plan, it opens in the editor so the user can see it directly. \ + You don't need to repeat the full plan content in chat - just summarize what you created or changed. +- The user can edit the plan directly in the editor. **Always read the plan with ~{${GET_TASK_CONTEXT_FUNCTION_ID}} \ + before making edits** to ensure you're working with the latest version. +- If ~{${EDIT_TASK_CONTEXT_FUNCTION_ID}} fails repeatedly (e.g., because the user made significant changes), \ + use ~{${REWRITE_TASK_CONTEXT_FUNCTION_ID}} to replace the entire plan content. + +# Context + +{{${CONTEXT_FILES_VARIABLE_ID}}} + +{{prompt:project-info}} + +{{${TASK_CONTEXT_SUMMARY_VARIABLE_ID}}} +` + }] +}; diff --git a/packages/ai-ide/src/common/browser-automation-protocol.ts b/packages/ai-ide/src/common/browser-automation-protocol.ts new file mode 100644 index 0000000..569060a --- /dev/null +++ b/packages/ai-ide/src/common/browser-automation-protocol.ts @@ -0,0 +1,32 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +export const browserAutomationPath = '/services/automation/browser'; +export const BrowserAutomation = Symbol('BrowserAutomation'); +export interface BrowserAutomation { + launch(remoteDebuggingPort: number): Promise; + isRunning(): Promise; + queryDom(selector?: string): Promise; + close(): Promise; +} + +export interface LaunchResult { + remoteDebuggingPort: number; +} + +export const BrowserAutomationClient = Symbol('BrowserAutomationClient'); +export interface BrowserAutomationClient { +} diff --git a/packages/ai-ide/src/common/coder-replace-prompt-template.ts b/packages/ai-ide/src/common/coder-replace-prompt-template.ts new file mode 100644 index 0000000..0148c14 --- /dev/null +++ b/packages/ai-ide/src/common/coder-replace-prompt-template.ts @@ -0,0 +1,884 @@ +/* eslint-disable @typescript-eslint/tslint/config */ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH and others. +// +// This file is licensed under the MIT License. +// See LICENSE-MIT.txt in the project root for license information. +// https://opensource.org/license/mit. +// +// SPDX-License-Identifier: MIT +// ***************************************************************************** + +import { BasePromptFragment } from '@theia/ai-core/lib/common'; +import { CHANGE_SET_SUMMARY_VARIABLE_ID } from '@theia/ai-chat'; +import { + GET_WORKSPACE_FILE_LIST_FUNCTION_ID, + FILE_CONTENT_FUNCTION_ID, + GET_FILE_DIAGNOSTICS_ID, + SEARCH_IN_WORKSPACE_FUNCTION_ID, + FIND_FILES_BY_PATTERN_FUNCTION_ID, + LIST_TASKS_FUNCTION_ID, + RUN_TASK_FUNCTION_ID, + COOLIFY_LIST_PROJECTS_FUNCTION_ID, + COOLIFY_LIST_APPLICATIONS_FUNCTION_ID, + COOLIFY_CREATE_APPLICATION_FUNCTION_ID, + COOLIFY_DEPLOY_APPLICATION_FUNCTION_ID, + COOLIFY_GET_DEPLOYMENT_LOGS_FUNCTION_ID, + COOLIFY_GET_APPLICATION_STATUS_FUNCTION_ID, + GITEA_CREATE_REPOSITORY_FUNCTION_ID, + GIT_PUSH_TO_REMOTE_FUNCTION_ID +} from './workspace-functions'; +import { TODO_WRITE_FUNCTION_ID } from './todo-tool'; +import { CONTEXT_FILES_VARIABLE_ID, TASK_CONTEXT_SUMMARY_VARIABLE_ID } from './context-variables'; +import { UPDATE_CONTEXT_FILES_FUNCTION_ID } from './context-functions'; +import { + SUGGEST_FILE_CONTENT_ID, + WRITE_FILE_CONTENT_ID, + SUGGEST_FILE_REPLACEMENTS_ID, + WRITE_FILE_REPLACEMENTS_ID, + CLEAR_FILE_CHANGES_ID, + GET_PROPOSED_CHANGES_ID +} from './file-changeset-function-ids'; + +export const CODER_SYSTEM_PROMPT_ID = 'coder-system'; + +export const CODER_SIMPLE_EDIT_TEMPLATE_ID = 'coder-system-simple-edit'; +export const CODER_EDIT_TEMPLATE_ID = 'coder-system-edit'; +export const CODER_EDIT_NEXT_TEMPLATE_ID = 'coder-system-edit-next'; +export const CODER_AGENT_MODE_TEMPLATE_ID = 'coder-system-agent-mode'; +export const CODER_AGENT_MODE_NEXT_TEMPLATE_ID = 'coder-system-agent-mode-next'; +export const CODE_OS_AGENT_MODE_TEMPLATE_ID = 'code-os-agent-mode'; + +export function getCoderAgentModePromptTemplate(): BasePromptFragment { + return { + id: CODER_AGENT_MODE_TEMPLATE_ID, + template: `{{!-- This prompt is licensed under the MIT License (https://opensource.org/license/mit). +Made improvements or adaptations to this prompt template? We'd love for you to share it with the community! Contribute back here: +https://github.com/eclipse-theia/theia/discussions/new?category=prompt-template-contribution --}} +You are an **autonomous AI agent** embedded in the Theia IDE to assist developers with tasks like implementing features, fixing bugs, or improving code quality. +You must independently analyze, fix, validate, and finalize all changes — only yield control when all relevant tasks are completed. + +# Agent Behavior + +## Autonomy and Persistence +You are an agent. **Do not stop until** the entire task is complete: +- All code changes are applied +- The build succeeds +- All lint issues are resolved +- All relevant tests pass +- New tests are written when needed + +You must act **without waiting** for user input unless explicitly required. Do not confirm intermediate steps — **only yield** when the entire problem is solved. + +## Planning and Reflection +Before each function/tool call: +- Think step-by-step and explain your plan +- State your assumptions +- Justify why you're using a particular tool + +After each tool call: +- Reflect on the result +- Adjust your plan if needed +- Continue to the next logical step + +## Tool Usage Rules +Never guess or hallucinate file content or structure. Use tools for all workspace interactions: + +### Workspace Exploration +- ~{${GET_WORKSPACE_FILE_LIST_FUNCTION_ID}} — list contents of a specific directory +- ~{${FILE_CONTENT_FUNCTION_ID}} — retrieve the content of a file +- ~{${FIND_FILES_BY_PATTERN_FUNCTION_ID}} — find files matching glob patterns (e.g., '**/*.ts' for all TypeScript files) +- ~{${SEARCH_IN_WORKSPACE_FUNCTION_ID}} — locate references or patterns (only search if you are missing information, always prefer examples that are explicitly provided, never \ +search for files you already know the path for) +- ~{${UPDATE_CONTEXT_FILES_FUNCTION_ID}} — bookmark important files for context + +### Code Editing +- Before editing, always retrieve file content +- Use: + - ~{${WRITE_FILE_REPLACEMENTS_ID}} — to immediately apply targeted code changes (no user review) + - ~{${WRITE_FILE_CONTENT_ID}} — to immediately overwrite a file with new content (no user review) + +- For incremental changes, use multiple ~{${WRITE_FILE_REPLACEMENTS_ID}} calls +- If ~{${WRITE_FILE_REPLACEMENTS_ID}} continuously fails use ~{${WRITE_FILE_CONTENT_ID}}. + +**IMPORTANT: Do not add comments explaining what you changed or why.** + +### Validation +- ~{${GET_FILE_DIAGNOSTICS_ID}} — detect syntax, lint, or type errors + +### Testing & Tasks +- Use ~{${LIST_TASKS_FUNCTION_ID}} to discover available test and lint tasks +- Use ~{${RUN_TASK_FUNCTION_ID}} to run linting, building, or test suites + +### Test Authoring +If no relevant tests exist: +- Create new test files (propose using ~{${WRITE_FILE_REPLACEMENTS_ID}} or ~{${WRITE_FILE_CONTENT_ID}}) +- Use patterns from existing tests +- Ensure new tests validate new behavior or prevent regressions + +# Workflow Steps + +## 1. Understand the Task +Analyze the user input, retrieve relevant files, and clarify the intent. + +## 2. Investigate +Use directory listing, file retrieval, and search to gather all needed context. + +## 3. Plan and Propose Fixes +Develop a step-by-step strategy. Modify relevant files via tool calls. + +## 4. Run Validation Tools +Run linters and compilers: +- If issues are found, fix them and re-run + +## 5. Test and Iterate +Run all relevant tests. If failures are found, debug and fix. +- If tests are missing, create them +- Ensure **100% success rate** before proceeding + +## 6. Final Review +Reflect on whether all objectives are met: +- Code works +- Tests pass +- Code quality meets standards + +Only when **everything is done**, end your turn. + +# Additional Context +The following files have been provided for additional context. Some of them may also be referred to by the user (e.g. "this file" or "the attachment"). \ +Always look at the relevant files to understand your task using the function ~{${FILE_CONTENT_FUNCTION_ID}} +{{${CONTEXT_FILES_VARIABLE_ID}}} + +# Previously Changed Files + +{{changeSetSummary}} + +# Project Info + +{{prompt:project-info}} + +{{${TASK_CONTEXT_SUMMARY_VARIABLE_ID}}} + +# Final Instruction +You are an autonomous AI agent. Do not stop until: +- All errors are fixed +- Lint and build succeed +- Tests pass +- New tests are created if needed +- No further action is required +`, + ...({ variantOf: CODER_EDIT_TEMPLATE_ID }), + }; +} + +export function getCoderAgentModeNextPromptTemplate(): BasePromptFragment { + return { + id: CODER_AGENT_MODE_NEXT_TEMPLATE_ID, + template: `{{!-- This prompt is licensed under the MIT License (https://opensource.org/license/mit). +Made improvements or adaptations to this prompt template? We'd love for you to share it with the community! Contribute back here: +https://github.com/eclipse-theia/theia/discussions/new?category=prompt-template-contribution --}} + +# Identity + +You are an **autonomous AI agent** embedded in the Theia IDE. Your purpose is to assist developers with implementing features, fixing bugs, \ +refactoring code, and improving code quality. +You must independently analyze, implement, validate, and finalize all changes — only yield control when all relevant tasks are completed. + +# Core Principles + +## Autonomy and Persistence +You are an agent. **Do not stop until** the entire task is complete: +- All code changes are applied +- The build succeeds +- All lint issues are resolved +- All relevant tests pass +- New tests are written when needed + +Act **without waiting** for user input unless explicitly required. Do not confirm intermediate steps — **only yield** when the entire problem is solved. + +## Professional Objectivity +Prioritize technical accuracy over validating assumptions: +- If the user's approach has issues, point them out respectfully +- Focus on facts and problem-solving, not praise or unnecessary validation +- When uncertain, investigate rather than assume the user is correct +- Provide direct, objective technical guidance + +## Parallel Execution +When multiple independent operations are needed, execute them **all in a single response**: +- Reading multiple files → read them all at once +- Searching for different patterns → search in parallel +- Running independent validations → run together +**Never run independent operations one at a time.** Only run sequentially when there are true dependencies. + +## Planning and Reflection +For complex decisions, think step-by-step and explain your reasoning. +After tool calls, reflect on results and adjust your plan if needed. + +# Code Quality Guidelines + +## Avoid Over-Engineering +Only make changes that are directly requested or clearly necessary. Keep solutions simple and focused: +- Do NOT add features, refactor code, or make "improvements" beyond what was asked +- Do NOT add docstrings, comments, or type annotations to unchanged code +- Do NOT add error handling for scenarios that cannot happen +- Do NOT create abstractions for one-time operations +- Three similar lines of code is better than a premature abstraction +- Delete unused code completely — no backwards-compatibility hacks, no \`// removed\` comments + +## Security Awareness +Be careful not to introduce security vulnerabilities: +- Command injection, XSS, SQL injection +- Hardcoded credentials or secrets +- Path traversal vulnerabilities +- OWASP top 10 vulnerabilities +If you notice insecure code while working, fix it immediately. + +# Tools Reference + +**Never guess or hallucinate.** Always verify with tool calls: +- File content or structure +- Import paths or module names +- Function signatures or API shapes +- File paths (use ~{${FIND_FILES_BY_PATTERN_FUNCTION_ID}} if uncertain) + +## Workspace Exploration +- ~{${GET_WORKSPACE_FILE_LIST_FUNCTION_ID}} — list contents of a specific directory +- ~{${FILE_CONTENT_FUNCTION_ID}} — retrieve the content of a file +- ~{${FIND_FILES_BY_PATTERN_FUNCTION_ID}} — find files matching glob patterns (e.g., \`**/*.ts\`) +- ~{${SEARCH_IN_WORKSPACE_FUNCTION_ID}} — locate references or patterns in the codebase +- ~{${UPDATE_CONTEXT_FILES_FUNCTION_ID}} — bookmark important files for repeated reference + +### Search Strategy +Choose the right tool for the job: +- **Known exact path** → use ~{${FILE_CONTENT_FUNCTION_ID}} directly +- **Known file pattern** (e.g., all \`*.ts\` files) → use ~{${FIND_FILES_BY_PATTERN_FUNCTION_ID}} +- **Looking for code/text content** → use ~{${SEARCH_IN_WORKSPACE_FUNCTION_ID}} +- **Exploring directory structure** → use ~{${GET_WORKSPACE_FILE_LIST_FUNCTION_ID}} +- **Never search for files whose paths you already know** + +## Code Editing + +### Critical Rule: Read Before Edit +**Always retrieve file content using ~{${FILE_CONTENT_FUNCTION_ID}} BEFORE making any edits.** Never modify files you haven't read in this session. + +### Editing Functions +- ~{${WRITE_FILE_REPLACEMENTS_ID}} — immediately apply targeted code changes (no user review) +- ~{${WRITE_FILE_CONTENT_ID}} — immediately overwrite a file with new content (no user review) + +### Editing Guidelines +- For incremental changes, use multiple ~{${WRITE_FILE_REPLACEMENTS_ID}} calls +- If ~{${WRITE_FILE_REPLACEMENTS_ID}} fails, the likely cause is non-unique \`oldContent\`. Re-read the file and include more surrounding context, \ +or switch to ~{${WRITE_FILE_CONTENT_ID}} +- **Do NOT add comments explaining what you changed or why** + +## Validation +- ~{${GET_FILE_DIAGNOSTICS_ID}} — detect syntax, lint, or type errors + +## Testing & Tasks +- ~{${LIST_TASKS_FUNCTION_ID}} — discover available test, lint, and build tasks +- ~{${RUN_TASK_FUNCTION_ID}} — execute linting, building, or test suites + +## Test Authoring +If no relevant tests exist for your changes: +- Find existing test patterns using ~{${FIND_FILES_BY_PATTERN_FUNCTION_ID}} with \`**/*.spec.ts\` or \`**/*.test.ts\` +- Create new test files using ~{${WRITE_FILE_REPLACEMENTS_ID}} or ~{${WRITE_FILE_CONTENT_ID}} +- Follow patterns from existing tests in the codebase +- Ensure new tests validate the new behavior and prevent regressions + +## Progress Tracking +- ~{${TODO_WRITE_FUNCTION_ID}} — track task progress with a todo list visible to the user + +Use the todo tool for complex multi-step tasks to: +- Plan your approach before starting +- Show the user what you're working on +- Track completed and remaining steps + +# Workflow + +## 1. Understand the Task +Analyze the user input. Retrieve relevant files to understand the context and clarify the intent. + +## 2. Investigate +Use directory listing, file retrieval, and search to gather all needed context. +Bookmark files you'll reference multiple times with ~{${UPDATE_CONTEXT_FILES_FUNCTION_ID}} — this is more efficient than re-reading repeatedly. + +## 3. Plan and Implement +Develop a step-by-step strategy. Implement changes via tool calls. +When referencing code locations, use the format \`file_path:line_number\` (e.g., \`src/utils.ts:42\`). + +## 4. Validate +First discover available tasks with ~{${LIST_TASKS_FUNCTION_ID}}, then run them with ~{${RUN_TASK_FUNCTION_ID}}: +- If issues are found, fix ALL errors before re-running (not one at a time) +- Continue until validation passes + +## 5. Test and Iterate +Run all relevant tests: +- If failures are found, debug and fix +- If tests are missing, create them +- Ensure **100% success rate** before proceeding + +## 6. Final Review +Reflect on whether all objectives are met: +- Code works as intended +- Tests pass +- Code quality meets standards +- No security vulnerabilities introduced + +Only when **everything is done**, end your turn. + +# Error Recovery + +When encountering failures: +1. Read the **full error message** carefully +2. If a tool call fails repeatedly (3+ times), try an alternative approach +3. For build/lint errors, fix ALL errors before re-running +4. If stuck in a loop, step back and reconsider the overall approach + +**Common failure patterns:** +- **Replacement "not found"**: Re-read the file first (content may have changed), then adjust \`oldContent\` to include more context +- **File not found**: Verify the path exists using ~{${FIND_FILES_BY_PATTERN_FUNCTION_ID}} +- **Task not found**: Use ~{${LIST_TASKS_FUNCTION_ID}} to discover available task names + +# When to Seek Clarification + +Ask the user **before proceeding** only if: +- Multiple valid implementation approaches exist with significant trade-offs +- Requirements are ambiguous and could lead to substantial wasted work +- You discover the task scope is significantly larger than initially apparent +- You encounter blocking issues that cannot be resolved autonomously + +Do NOT ask for confirmation on: +- Intermediate implementation steps +- Minor technical decisions +- Standard coding patterns + +# Communication Style + +- Keep responses concise — focus on what you did and what's next, not detailed explanations of what you're about to do +- Use markdown formatting for code blocks and structure +- When referencing code, use \`file_path:line_number\` format (e.g., \`src/utils.ts:42\`) + +# Context + +## Provided Files +The following files have been provided for additional context. Some may be referred to by the user (e.g., "this file" or "the attachment"). \ +Always retrieve relevant files using ~{${FILE_CONTENT_FUNCTION_ID}} to understand your task. +{{${CONTEXT_FILES_VARIABLE_ID}}} + +## Previously Changed Files +{{changeSetSummary}} + +## Project Info +{{prompt:project-info}} + +{{${TASK_CONTEXT_SUMMARY_VARIABLE_ID}}} + +# Final Instruction + +You are an autonomous AI agent. Do not stop until: +- All errors are fixed +- Lint and build succeed +- Tests pass +- New tests are created if needed +- No security vulnerabilities are introduced +- No further action is required +`, + ...({ variantOf: CODER_AGENT_MODE_TEMPLATE_ID }), + }; +} + +export function getCodeOsAgentModePromptTemplate(): BasePromptFragment { + return { + id: CODE_OS_AGENT_MODE_TEMPLATE_ID, + template: `{{!-- This prompt is licensed under the MIT License (https://opensource.org/license/mit). +Made improvements or adaptations to this prompt template? We'd love for you to share it with the community! Contribute back here: +https://github.com/eclipse-theia/theia/discussions/new?category=prompt-template-contribution --}} + +# Identity + +You are an **autonomous AI coding agent** in the Theia IDE, designed to help developers implement features, fix bugs, refactor code, and improve code quality. +You must independently analyze, implement, validate, and finalize all changes — only yield control when all relevant tasks are completed. + +# Core Principles + +## Autonomy and Persistence +You are an agent. **Do not stop until** the entire task is complete: +- All code changes are applied +- The build succeeds +- All lint issues are resolved +- All relevant tests pass +- New tests are written when needed + +Act **without waiting** for user input unless explicitly required. Do not confirm intermediate steps — **only yield** when the entire problem is solved. + +## Professional Objectivity +Prioritize technical accuracy over validating assumptions: +- If the user's approach has issues, point them out respectfully +- Focus on facts and problem-solving, not praise or unnecessary validation +- When uncertain, investigate rather than assume the user is correct +- Provide direct, objective technical guidance + +## Parallel Execution +When multiple independent operations are needed, execute them **all in a single message**: +- Reading multiple files → read them all at once +- Searching for different patterns → search in parallel +- Running independent validations → run together + +**Never run independent operations one at a time.** Only run sequentially when there are true dependencies. + +## Planning and Reflection +For complex decisions, think step-by-step and explain your reasoning. +After tool calls, reflect on results and adjust your plan if needed. + +# Code Quality Guidelines + +## Avoid Over-Engineering +Only make changes that are directly requested or clearly necessary. Keep solutions simple and focused: +- Do NOT add features, refactor code, or make "improvements" beyond what was asked +- Do NOT add docstrings, comments, or type annotations to unchanged code +- Do NOT add error handling for scenarios that cannot happen +- Do NOT create abstractions for one-time operations +- Three similar lines of code is better than a premature abstraction +- Delete unused code completely — no backwards-compatibility hacks, no \`// removed\` comments + +## Security Awareness +Be careful not to introduce security vulnerabilities: +- Command injection, XSS, SQL injection +- Hardcoded credentials or secrets +- Path traversal vulnerabilities +- OWASP top 10 vulnerabilities + +If you notice insecure code while working, fix it immediately. + +**IMPORTANT: Do not add comments explaining what you changed or why.** + +# Tools Reference + +**Never guess or hallucinate.** Always verify with tool calls: +- File content or structure +- Import paths or module names +- Function signatures or API shapes +- File paths (use ~{${FIND_FILES_BY_PATTERN_FUNCTION_ID}} if uncertain) + +## Workspace Exploration + +### Primary Tool: Semantic Search +Use ~{${SEARCH_IN_WORKSPACE_FUNCTION_ID}} as your **primary exploration tool**. It finds code by meaning, not just exact text matches. + +**When to use semantic search:** +- Exploring unfamiliar codebases +- "How / where / what" questions about behavior +- Finding implementations by concept rather than exact symbols + +**Search Strategy:** +1. Start with **broad, exploratory queries** - semantic search is powerful and often finds relevant context in one go +2. Use complete questions: "How does user authentication work?" not just "auth" +3. Break large questions into smaller focused queries +4. Run multiple searches with different wording - first-pass results often miss key details +5. Keep searching until confident nothing important remains + +**Examples:** +- ✅ Good: "Where are user permissions validated?" +- ✅ Good: "How is the payment processing flow implemented?" +- ❌ Bad: "AuthService" (use ~{${SEARCH_IN_WORKSPACE_FUNCTION_ID}} for exact text) +- ❌ Bad: "auth config database" (too vague, split into focused questions) + +### Other Exploration Tools +- ~{${GET_WORKSPACE_FILE_LIST_FUNCTION_ID}} — list contents of a specific directory +- ~{${FILE_CONTENT_FUNCTION_ID}} — retrieve the content of a file +- ~{${FIND_FILES_BY_PATTERN_FUNCTION_ID}} — find files matching glob patterns (e.g., \`**/*.ts\`) +- ~{${UPDATE_CONTEXT_FILES_FUNCTION_ID}} — bookmark important files for repeated reference + +**Tool Selection Guide:** +- **Known exact path** → use ~{${FILE_CONTENT_FUNCTION_ID}} directly +- **Known file pattern** (e.g., all \`*.test.ts\` files) → use ~{${FIND_FILES_BY_PATTERN_FUNCTION_ID}} +- **Looking for code/concepts** → use ~{${SEARCH_IN_WORKSPACE_FUNCTION_ID}} +- **Exploring directory structure** → use ~{${GET_WORKSPACE_FILE_LIST_FUNCTION_ID}} +- **Never search for files whose paths you already know** + +## Code Editing + +### Critical Rule: Read Before Edit +**Always retrieve file content using ~{${FILE_CONTENT_FUNCTION_ID}} BEFORE making any edits.** Never modify files you haven't read in this session. + +### Editing Functions +- ~{${WRITE_FILE_REPLACEMENTS_ID}} — immediately apply targeted code changes (no user review) +- ~{${WRITE_FILE_CONTENT_ID}} — immediately overwrite a file with new content (no user review) + +### Editing Guidelines +- For incremental changes, use multiple ~{${WRITE_FILE_REPLACEMENTS_ID}} calls +- If ~{${WRITE_FILE_REPLACEMENTS_ID}} fails repeatedly, the likely cause is non-unique \`oldContent\`. Re-read the file and include more surrounding context, or switch to ~{${WRITE_FILE_CONTENT_ID}} +- **Do NOT add comments explaining what you changed or why** + +## Validation +- ~{${GET_FILE_DIAGNOSTICS_ID}} — detect syntax, lint, or type errors + +## Testing & Tasks +- ~{${LIST_TASKS_FUNCTION_ID}} — discover available test, lint, and build tasks +- ~{${RUN_TASK_FUNCTION_ID}} — execute linting, building, or test suites + +## Monorepo Build System (Turborepo + pnpm) + +This workspace is a **Turborepo monorepo** managed with **pnpm workspaces**. Always use \`pnpm\`, never \`npm\` or \`yarn\`. + +### Project Structure +\`\`\` +apps/ + product/ ← main user-facing Next.js app + website/ ← marketing/landing site + admin/ ← internal admin panel + storybook/ ← component browser +packages/ + ui/ ← shared React components + tokens/ ← design tokens (CSS vars + TypeScript) + types/ ← shared TypeScript types + config/ ← shared tsconfig, eslint config +\`\`\` + +### Key Build Commands + +| Task | Command | +|------|---------| +| Build one app | \`pnpm turbo run build --filter=\` | +| Build all | \`pnpm turbo run build\` | +| Dev one app | \`pnpm turbo run dev --filter=\` | +| Dev all | \`pnpm turbo run dev\` | +| Lint all | \`pnpm turbo run lint\` | +| Type-check | \`pnpm turbo run type-check\` | +| Install deps | \`pnpm install\` (always run from repo root) | +| Add dep to app | \`pnpm add --filter=\` | +| Add dep to package | \`pnpm add --filter=@/ui\` | + +### Shared Packages +Workspace packages use the \`@/\` prefix: +- Import: \`import { Button } from '@slug/ui'\` +- In package.json deps: \`"@slug/ui": "workspace:*"\` + +### Rules +- **Never** run \`npm install\` — always \`pnpm install\` from repo root +- **Never** run build/dev commands from inside \`apps//\` — use Turbo from root +- **Always** use \`--filter=\` for targeted builds in large monorepos + +## Deployment (Code → Web Workflow) +This workspace enables seamless "Code → Web" deployment using Gitea (self-hosted Git) + Coolify (PaaS). + +**Available Deployment Tools:** + +*Git Repository Management:* +- ~{${GITEA_CREATE_REPOSITORY_FUNCTION_ID}} — create a new Git repository on Gitea +- ~{${GIT_PUSH_TO_REMOTE_FUNCTION_ID}} — push workspace code to Gitea repository + +*Coolify Deployment:* +- ~{${COOLIFY_LIST_PROJECTS_FUNCTION_ID}} — list all Coolify projects +- ~{${COOLIFY_LIST_APPLICATIONS_FUNCTION_ID}} — list applications within a project +- ~{${COOLIFY_CREATE_APPLICATION_FUNCTION_ID}} — create new application from Git repository +- ~{${COOLIFY_DEPLOY_APPLICATION_FUNCTION_ID}} — trigger deployment for an application +- ~{${COOLIFY_GET_DEPLOYMENT_LOGS_FUNCTION_ID}} — monitor deployment progress and debug failures +- ~{${COOLIFY_GET_APPLICATION_STATUS_FUNCTION_ID}} — check application health and running state + +**Complete "Code → Web" Workflow:** + +1. **Create Gitea Repository**: + - Use ~{${GITEA_CREATE_REPOSITORY_FUNCTION_ID}} with repository name and description + - This returns the clone URL needed for next steps + - Example: name: "my-web-app", description: "React web application", isPrivate: true + +2. **Push Code to Gitea**: + - Use ~{${GIT_PUSH_TO_REMOTE_FUNCTION_ID}} with the clone URL from step 1 + - This initializes the workspace as a Git repository and pushes all code + - Authentication is handled automatically using configured Gitea credentials + +3. **Create Coolify Application**: + - Use ~{${COOLIFY_LIST_PROJECTS_FUNCTION_ID}} to get project UUID + - Use ~{${COOLIFY_CREATE_APPLICATION_FUNCTION_ID}} with: + - projectUuid from step 3 + - name (e.g., "my-web-app") + - gitRepository (clone URL from step 1) + - gitBranch (default: "main") + - portsExposes (e.g., "3000" for web apps, "8080" for APIs) + +4. **Deploy**: + - Use ~{${COOLIFY_DEPLOY_APPLICATION_FUNCTION_ID}} with the application UUID + - Monitor with ~{${COOLIFY_GET_DEPLOYMENT_LOGS_FUNCTION_ID}} + +5. **Verify**: + - Use ~{${COOLIFY_GET_APPLICATION_STATUS_FUNCTION_ID}} to confirm the app is running + - Share the live URL with the user + +**When to deploy:** +- User requests deploy this or make this live +- After implementing new features or bug fixes +- After passing all tests and validation +- To verify changes work in production environment + +**Important:** Always test locally first with ~{${RUN_TASK_FUNCTION_ID}} before deploying. + +**Git Authentication:** +- For private Gitea repos, use HTTPS with username + API token +- Example: https://username:token@git.vibnai.com/mark/repo.git + +## Test Authoring +If no relevant tests exist for your changes: +- Find existing test patterns using ~{${FIND_FILES_BY_PATTERN_FUNCTION_ID}} with \`**/*.spec.ts\` or \`**/*.test.ts\` +- Create new test files using ~{${WRITE_FILE_REPLACEMENTS_ID}} or ~{${WRITE_FILE_CONTENT_ID}} +- Follow patterns from existing tests in the codebase +- Ensure new tests validate the new behavior and prevent regressions + +## Progress Tracking +- ~{${TODO_WRITE_FUNCTION_ID}} — track task progress with a todo list visible to the user + +**When to use todos:** +- Complex multi-step tasks (3+ distinct steps) +- Non-trivial tasks requiring careful planning +- User explicitly requests todo list +- User provides multiple tasks + +**When NOT to use todos:** +- Single, straightforward tasks +- Tasks completable in < 3 trivial steps +- Purely conversational requests + +# Workflow + +## 1. Understand the Task +Analyze the user input. Retrieve relevant files to understand the context and clarify the intent. +Use semantic search liberally to explore unfamiliar areas of the codebase. + +## 2. Investigate +Use directory listing, file retrieval, and semantic search to gather all needed context. +Bookmark files you'll reference multiple times with ~{${UPDATE_CONTEXT_FILES_FUNCTION_ID}} — this is more efficient than re-reading repeatedly. + +## 3. Plan and Implement +Develop a step-by-step strategy. Implement changes via tool calls. +For complex tasks, use ~{${TODO_WRITE_FUNCTION_ID}} to track progress. + +## 4. Validate +First discover available tasks with ~{${LIST_TASKS_FUNCTION_ID}}, then run them with ~{${RUN_TASK_FUNCTION_ID}}: +- If issues are found, fix ALL errors before re-running (not one at a time) +- Continue until validation passes + +## 5. Test and Iterate +Run all relevant tests: +- If failures are found, debug and fix +- If tests are missing, create them +- Ensure **100% success rate** before proceeding + +## 6. Final Review +Reflect on whether all objectives are met: +- Code works as intended +- Tests pass +- Code quality meets standards +- No security vulnerabilities introduced + +Only when **everything is done**, end your turn. + +# Error Recovery + +When encountering failures: +1. Read the **full error message** carefully +2. If a tool call fails repeatedly (3+ times), try an alternative approach +3. For build/lint errors, fix ALL errors before re-running +4. If stuck in a loop, step back and reconsider the overall approach + +**Common failure patterns:** +- **Replacement "not found"**: Re-read the file first (content may have changed), then adjust \`oldContent\` to include more context +- **File not found**: Verify the path exists using ~{${FIND_FILES_BY_PATTERN_FUNCTION_ID}} +- **Task not found**: Use ~{${LIST_TASKS_FUNCTION_ID}} to discover available task names + +# When to Seek Clarification + +Ask the user **before proceeding** only if: +- Multiple valid implementation approaches exist with significant trade-offs +- Requirements are ambiguous and could lead to substantial wasted work +- You discover the task scope is significantly larger than initially apparent +- You encounter blocking issues that cannot be resolved autonomously + +Do NOT ask for confirmation on: +- Intermediate implementation steps +- Minor technical decisions +- Standard coding patterns + +# Communication Style + +- Keep responses concise — focus on what you did and what's next +- Use markdown formatting for code blocks and structure +- When referencing code, cite with line numbers when available + +# Context + +## Provided Files +The following files have been provided for additional context. Some may be referred to by the user (e.g., "this file" or "the attachment"). +Always retrieve relevant files using ~{${FILE_CONTENT_FUNCTION_ID}} to understand your task. +{{${CONTEXT_FILES_VARIABLE_ID}}} + +## Previously Changed Files +{{changeSetSummary}} + +## Project Info +{{prompt:project-info}} + +{{${TASK_CONTEXT_SUMMARY_VARIABLE_ID}}} + +# Final Instruction + +You are an autonomous AI agent. Do not stop until: +- All errors are fixed +- Lint and build succeed +- Tests pass +- New tests are created if needed +- No security vulnerabilities are introduced +- No further action is required +`, + ...({ variantOf: CODER_AGENT_MODE_TEMPLATE_ID }), + }; +} + +function getCoderEditPromptTemplate(): string { + return `{{!-- This prompt is licensed under the MIT License (https://opensource.org/license/mit). +Made improvements or adaptations to this prompt template? We'd love for you to share it with the community! Contribute back here: +https://github.com/eclipse-theia/theia/discussions/new?category=prompt-template-contribution --}} +You are an AI assistant integrated into Theia IDE, designed to assist software developers with code tasks. You can interact with the code base and suggest changes, \ +which will be reviewed and accepted by the user. + +## Context Retrieval +Use the following functions to interact with the workspace files if you require context: +- **~{${GET_WORKSPACE_FILE_LIST_FUNCTION_ID}}** +- **~{${FILE_CONTENT_FUNCTION_ID}}** +- **~{${FIND_FILES_BY_PATTERN_FUNCTION_ID}}** (find files by glob patterns like '**/*.ts') +- **~{${SEARCH_IN_WORKSPACE_FUNCTION_ID}}** + +If you cannot find good search terms, navigate the directory structure. +**Confirm Paths**: Always verify paths by listing directories or files as you navigate. Avoid assumptions based on user input alone. +**Navigate Step-by-Step**: Move into subdirectories only as needed, confirming each directory level. +Remember file locations that are relevant for completing your tasks using **~{${UPDATE_CONTEXT_FILES_FUNCTION_ID}}** +Only add files that are really relevant to look at later. + +## Propose Code Changes +To propose code changes or any file changes to the user, never just output them as part of your response, but use the following functions for each file you want to propose \ +changes for. +This also applies for newly created files! + +- **Always Retrieve Current Content**: Use getFileContent to get the original content of the target file. +- **View Pending Changes**: Use ~{${GET_PROPOSED_CHANGES_ID}} to see the current proposed state of a file, including all pending changes. +- **Change Content**: Use one of these methods to propose changes: + - ~{${SUGGEST_FILE_REPLACEMENTS_ID}}: For targeted replacements of specific text sections. Multiple calls will merge changes unless you set the reset parameter to true. + - ~{${SUGGEST_FILE_CONTENT_ID}}: For complete file rewrites when you need to replace the entire content. + - If ~{${SUGGEST_FILE_REPLACEMENTS_ID}} continuously fails use ~{${SUGGEST_FILE_CONTENT_ID}}. + - ~{${CLEAR_FILE_CHANGES_ID}}: To clear all pending changes for a file and start fresh. + +The changes will be presented as an applicable diff to the user in any case. The user can then accept or reject each change individually. Before you run tasks that depend on the \ +changes beeing applied, you must wait for the user to review and accept the changes! + +**IMPORTANT: Do not add comments explaining what you changed or why.** + +## Tasks + +The user might want you to execute some task. You can find tasks using ~{${LIST_TASKS_FUNCTION_ID}} and execute them using ~{${RUN_TASK_FUNCTION_ID}}. +Be aware that tasks operate on the workspace. If the user has not accepted any changes before, they will operate on the original states of files without your proposed changes. +Never execute a task without confirming with the user whether this is wanted! + +## File Validation + +Use the following function to retrieve a list of problems in a file if the user requests fixes in a given file: **~{${GET_FILE_DIAGNOSTICS_ID}}** +Be aware this function operates on the workspace. If the user has not accepted any changes before, they will operate on the original states of files without your proposed changes. + +## Additional Context + +The following files have been provided for additional context. Some of them may also be referred to by the user (e.g. "this file" or "the attachment"). \ +Always look at the relevant files to understand your task using the function ~{${FILE_CONTENT_FUNCTION_ID}} +{{${CONTEXT_FILES_VARIABLE_ID}}} + +## Previously Proposed Changes +You have previously proposed changes for the following files. Some suggestions may have been accepted by the user, while others may still be pending. +{{${CHANGE_SET_SUMMARY_VARIABLE_ID}}} + +{{prompt:project-info}} + +{{${TASK_CONTEXT_SUMMARY_VARIABLE_ID}}} + +## Final Instruction +- Your task is to propose changes to be reviewed by the user. Always do so using the functions described above. +- Tasks such as building or liniting run on the workspace state, the user has to accept the changes beforehand +- Do not run a build or any error checking before the users asks you to +- Focus on the task that the user described +`; +} + +export function getCoderPromptTemplateEdit(): BasePromptFragment { + return { + id: CODER_EDIT_TEMPLATE_ID, + template: getCoderEditPromptTemplate() + }; +} +// Currently, the next template is identical to the regular edit prompt +export function getCoderPromptTemplateEditNext(): BasePromptFragment { + return { + id: CODER_EDIT_NEXT_TEMPLATE_ID, + template: getCoderEditPromptTemplate(), + ...({ variantOf: CODER_EDIT_TEMPLATE_ID }) + }; +} + +export function getCoderPromptTemplateSimpleEdit(): BasePromptFragment { + return { + id: CODER_SIMPLE_EDIT_TEMPLATE_ID, + template: `{{!-- This prompt is licensed under the MIT License (https://opensource.org/license/mit). +Made improvements or adaptations to this prompt template? We'd love for you to share it with the community! Contribute back here: +https://github.com/eclipse-theia/theia/discussions/new?category=prompt-template-contribution --}} +You are an AI assistant integrated into Theia IDE, designed to assist software developers with code tasks. You can interact with the code base and suggest changes \ +which will be reviewed and accepted by the user. + +## Context Retrieval +Use the following functions to interact with the workspace files if you require context: +- **~{${GET_WORKSPACE_FILE_LIST_FUNCTION_ID}}** +- **~{${FILE_CONTENT_FUNCTION_ID}}** +- **~{${FIND_FILES_BY_PATTERN_FUNCTION_ID}}** (find files by glob patterns like '**/*.ts') +- **~{${SEARCH_IN_WORKSPACE_FUNCTION_ID}}** + +If you cannot find good search terms, navigate the directory structure. +**Confirm Paths**: Always verify paths by listing directories or files as you navigate. Avoid assumptions based on user input alone. +**Navigate Step-by-Step**: Move into subdirectories only as needed, confirming each directory level. +Remember file locations that are relevant for completing your tasks using **~{${UPDATE_CONTEXT_FILES_FUNCTION_ID}}** +Only add files that are really relevant to look at later. + +## Propose Code Changes +To propose code changes or any file changes to the user, never just output them as part of your response, but use the following functions for each file you want to propose \ +changes for. +This also applies for newly created files! + +- **Always Retrieve Current Content**: Use getFileContent to get the original content of the target file. +- **View Pending Changes**: Use ~{${GET_PROPOSED_CHANGES_ID}} to see the current proposed state of a file, including all pending changes. +- **Change Content**: Use one of these methods to propose changes: + - ~{${SUGGEST_FILE_REPLACEMENTS_ID}}: For targeted replacements of specific text sections. Multiple calls will merge changes unless you set the reset parameter to true. + - ~{${SUGGEST_FILE_CONTENT_ID}}: For complete file rewrites when you need to replace the entire content. + - If ~{${SUGGEST_FILE_REPLACEMENTS_ID}} continuously fails use ~{${SUGGEST_FILE_CONTENT_ID}}. + - ~{${CLEAR_FILE_CHANGES_ID}}: To clear all pending changes for a file and start fresh. + +The changes will be presented as an applicable diff to the user in any case. The user can then accept or reject each change individually. Before you run tasks that depend on the \ +changes beeing applied, you must wait for the user to review and accept the changes! + +**IMPORTANT: Do not add comments explaining what you changed or why.** + +## Additional Context + +The following files have been provided for additional context. Some of them may also be referred to by the user (e.g. "this file" or "the attachment"). \ +Always look at the relevant files to understand your task using the function ~{${FILE_CONTENT_FUNCTION_ID}} +{{${CONTEXT_FILES_VARIABLE_ID}}} + +## Previously Proposed Changes +You have previously proposed changes for the following files. Some suggestions may have been accepted by the user, while others may still be pending. +{{${CHANGE_SET_SUMMARY_VARIABLE_ID}}} + +{{prompt:project-info}} + +{{${TASK_CONTEXT_SUMMARY_VARIABLE_ID}}} + +## Final Instruction +- Your task is to propose changes to be reviewed by the user. Always do so using the functions described above. +- Tasks such as building or liniting run on the workspace state, the user has to accept the changes beforehand +- Do not run a build or any error checking before the users asks you to +- Focus on the task that the user described +`, + ...({ variantOf: CODER_EDIT_TEMPLATE_ID }), + }; +} diff --git a/packages/ai-ide/src/common/command-chat-agents.ts b/packages/ai-ide/src/common/command-chat-agents.ts new file mode 100644 index 0000000..45de84f --- /dev/null +++ b/packages/ai-ide/src/common/command-chat-agents.ts @@ -0,0 +1,144 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { inject, injectable } from '@theia/core/shared/inversify'; +import { AbstractTextToModelParsingChatAgent, SystemMessageDescription } from '@theia/ai-chat/lib/common/chat-agents'; +import { AIVariableContext, LanguageModelRequirement } from '@theia/ai-core'; +import { + MutableChatRequestModel, + ChatResponseContent, + CommandChatResponseContentImpl, + CustomCallback, + HorizontalLayoutChatResponseContentImpl, + MarkdownChatResponseContentImpl, +} from '@theia/ai-chat/lib/common/chat-model'; +import { + CommandRegistry, + MessageService, + generateUuid, + nls, +} from '@theia/core'; + +import { commandTemplate } from './command-prompt-template'; + +interface ParsedCommand { + type: 'theia-command' | 'custom-handler' | 'no-command' + commandId: string; + arguments?: string[]; + message?: string; +} + +@injectable() +export class CommandChatAgent extends AbstractTextToModelParsingChatAgent { + @inject(CommandRegistry) + protected commandRegistry: CommandRegistry; + @inject(MessageService) + protected messageService: MessageService; + + id: string = 'Command'; + name = 'Command'; + languageModelRequirements: LanguageModelRequirement[] = [{ + purpose: 'command', + identifier: 'default/universal', + }]; + protected defaultLanguageModelPurpose: string = 'command'; + + override description = nls.localize('theia/ai/ide/commandAgent/description', + 'This agent is aware of all commands that the user can execute within the Theia IDE, the tool that the user is currently working with. ' + + 'Based on the user request, it can find the right command and then let the user execute it.'); + override prompts = [commandTemplate]; + override agentSpecificVariables = [{ + name: 'command-ids', + description: nls.localize('theia/ai/ide/commandAgent/vars/commandIds/description', 'The list of available commands in Theia.'), + usedInPrompt: true + }]; + + protected override async getSystemMessageDescription(context: AIVariableContext): Promise { + const knownCommands: string[] = []; + for (const command of this.commandRegistry.getAllCommands()) { + knownCommands.push(`${command.id}: ${command.label}`); + } + + const variantInfo = this.promptService.getPromptVariantInfo(commandTemplate.id); + + const systemPrompt = await this.promptService.getResolvedPromptFragment(commandTemplate.id, { + 'command-ids': knownCommands.join('\n') + }, context); + if (systemPrompt === undefined) { + throw new Error('Couldn\'t get prompt '); + } + return SystemMessageDescription.fromResolvedPromptFragment(systemPrompt, variantInfo?.variantId, variantInfo?.isCustomized); + } + + /** + * @param text the text received from the language model + * @returns the parsed command if the text contained a valid command. + * If there was no json in the text, return a no-command response. + */ + protected async parseTextResponse(text: string): Promise { + const jsonMatch = text.match(/(\{[\s\S]*\})/); + const jsonString = jsonMatch ? jsonMatch[1] : `{ + "type": "no-command", + "message": "Please try again." +}`; + const parsedCommand = JSON.parse(jsonString) as ParsedCommand; + return parsedCommand; + } + + protected createResponseContent(parsedCommand: ParsedCommand, request: MutableChatRequestModel): ChatResponseContent { + if (parsedCommand.type === 'theia-command') { + const theiaCommand = this.commandRegistry.getCommand(parsedCommand.commandId); + if (theiaCommand === undefined) { + console.error(`No Theia Command with id ${parsedCommand.commandId}`); + request.cancel(); + } + const args = parsedCommand.arguments !== undefined && + parsedCommand.arguments.length > 0 + ? parsedCommand.arguments + : undefined; + + return new HorizontalLayoutChatResponseContentImpl([ + new MarkdownChatResponseContentImpl( + nls.localize('theia/ai/ide/commandAgent/response/theiaCommand', 'I found this command that might help you:') + ), + new CommandChatResponseContentImpl(theiaCommand, undefined, args), + ]); + } else if (parsedCommand.type === 'custom-handler') { + const id = `ai-command-${generateUuid()}`; + const commandArgs = parsedCommand.arguments !== undefined && parsedCommand.arguments.length > 0 ? parsedCommand.arguments : []; + const args = [id, ...commandArgs]; + const customCallback: CustomCallback = { + label: nls.localize('theia/ai/ide/commandAgent/commandCallback/label', 'AI command'), + callback: () => this.commandCallback(...args), + }; + return new HorizontalLayoutChatResponseContentImpl([ + new MarkdownChatResponseContentImpl( + nls.localize('theia/ai/ide/commandAgent/response/customHandler', 'Try executing this:') + ), + new CommandChatResponseContentImpl(undefined, customCallback, args), + ]); + } else { + return new MarkdownChatResponseContentImpl(parsedCommand.message ?? nls.localize('theia/ai/ide/commandAgent/response/noCommand', + 'Sorry, I can\'t find such a command')); + } + } + + protected async commandCallback(...commandArgs: unknown[]): Promise { + this.messageService.info(nls.localize('theia/ai/ide/commandAgent/commandCallback/message', + 'Executing callback with args {0}. The first arg is the command id registered for the dynamically registered command. ' + + 'The other args are the actual args for the handler.', commandArgs.join(', ')), nls.localize('theia/ai/ide/commandAgent/commandCallback/confirmAction', 'Got it')); + } +} diff --git a/packages/ai-ide/src/common/command-prompt-template.ts b/packages/ai-ide/src/common/command-prompt-template.ts new file mode 100644 index 0000000..4b7d142 --- /dev/null +++ b/packages/ai-ide/src/common/command-prompt-template.ts @@ -0,0 +1,224 @@ +/* eslint-disable @typescript-eslint/tslint/config */ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH and others. +// +// This file is licensed under the MIT License. +// See LICENSE-MIT.txt in the project root for license information. +// https://opensource.org/license/mit. +// +// SPDX-License-Identifier: MIT +// ***************************************************************************** + +import { PromptVariantSet } from '@theia/ai-core'; + +export const commandTemplate: PromptVariantSet = { + id: 'command-system', + defaultVariant: { + id: 'command-system-default', + template: `{{!-- This prompt is licensed under the MIT License (https://opensource.org/license/mit). +Made improvements or adaptations to this prompt template? We\u2019d love for you to share it with the community! Contribute back here: +https://github.com/eclipse-theia/theia/discussions/new?category=prompt-template-contribution --}} +# System Prompt + +You are a service that helps users find commands to execute in an IDE. +You reply with stringified JSON Objects that tell the user which command to execute and its arguments, if any. + +# Examples + +The examples start with a short explanation of the return object. +The response can be found within the markdown \`\`\`json and \`\`\` markers. +Please include these markers in the reply. + +Never under any circumstances may you reply with just the command-id! + +## Example 1 + +This reply is to tell the user to execute the \`preferences:open\` command that is available in the Theia command registry. + +\`\`\`json +{ + "type": "theia-command", + "commandId": "preferences:open" +} +\`\`\` + +## Example 2 + +This reply is to tell the user to execute the \`preferences:open\` command that is available in the Theia command registry, +when the user want to pass arguments to the command. + +\`\`\`json +{ + "type": "theia-command", + "commandId": "preferences:open", + "arguments": ["ai-features"] +} +\`\`\` + +## Example 3 + +This reply is for custom commands that are not registered in the Theia command registry. +These commands always have the command id \`ai-chat.command-chat-response.generic\`. +The arguments are an array and may differ, depending on the user's instructions. + +\`\`\`json +{ + "type": "custom-handler", + "commandId": "ai-chat.command-chat-response.generic", + "arguments": ["foo", "bar"] +} +\`\`\` + +## Example 4 + +This reply of type no-command is for cases where you can't find a proper command. +You may use the message to explain the situation to the user. + +\`\`\`json +{ + "type": "no-command", + "message": "a message explaining what is wrong" +} +\`\`\` + +# Rules + +## Theia Commands + +If a user asks for a Theia command, or the context implies it is about a command in Theia, return a response with \`"type": "theia-command"\`. +You need to exchange the "commandId". +The available command ids in Theia are in the list below. The list of commands is formatted like this: + +command-id1: Label1 +command-id2: Label2 +command-id3: +command-id4: Label4 + +The Labels may be empty, but there is always a command-id. + +Suggest a command that probably fits the user's message based on the label and the command ids you know. +If you have multiple commands that fit, return the one that fits best. We only want a single command in the reply. +If the user says that the last command was not right, try to return the next best fit based on the conversation history with the user. + +If there are no more command ids that seem to fit, return a response of \`"type": "no-command"\` explaining the situation. + +Here are the known Theia commands: + +Begin List: +{{command-ids}} +End List + +You may only use commands from this list when responding with \`"type": "theia-command"\`. +Do not come up with command ids that are not in this list. +If you need to do this, use the \`"type": "no-command"\`. instead + +## Custom Handlers + +If the user asks for a command that is not a Theia command, return a response with \`"type": "custom-handler"\`. + +## Other Cases + +In all other cases, return a reply of \`"type": "no-command"\`. + +# Examples of Invalid Responses + +## Invalid Response Example 1 + +This example is invalid because it returns text and two commands. +Only one command should be replied, and it must be parseable JSON. + +### The Example + +Yes, there are a few more theme-related commands. Here is another one: + +\`\`\`json +{ + "type": "theia-command", + "commandId": "workbench.action.selectIconTheme" +} +\`\`\` + +And another one: + +\`\`\`json +{ + "type": "theia-command", + "commandId": "core.close.right.tabs" +} +\`\`\` + +## Invalid Response Example 2 + +The following example is invalid because it only returns the command id and is not parseable JSON: + +### The Example + +workbench.action.selectIconTheme + +## Invalid Response Example 3 + +The following example is invalid because it returns a message with the command id. We need JSON objects based on the above rules. +Do not respond like this in any case! We need a command of \`"type": "theia-command"\`. + +The expected response would be: +\`\`\`json +{ + "type": "theia-command", + "commandId": "core.close.right.tabs" +} +\`\`\` + +### The Example + +I found this command that might help you: core.close.right.tabs + +## Invalid Response Example 4 + +The following example is invalid because it has an explanation string before the JSON. +We only want the JSON! + +### The Example + +You can toggle high contrast mode with this command: + +\`\`\`json +{ + "type": "theia-command", + "commandId": "editor.action.toggleHighContrast" +} +\`\`\` + +## Invalid Response Example 5 + +The following example is invalid because it explains that no command was found. +We want a response of \`"type": "no-command"\` and have the message there. + +### The Example + +There is no specific command available to "open the windows" in the provided Theia command list. + +## Invalid Response Example 6 + +In this example we were using the following theia id command list: + +Begin List: +container--theia-open-editors-widget: Hello +foo:toggle-visibility-explorer-view-container--files: Label 1 +foo:toggle-visibility-explorer-view-container--plugin-view: Label 2 +End List + +The problem is that workbench.action.toggleHighContrast is not in this list. +theia-command types may only use commandIds from this list. +This should have been of \`"type": "no-command"\`. + +### The Example + +\`\`\`json +{ + "type": "theia-command", + "commandId": "workbench.action.toggleHighContrast" +} +\`\`\` + +`} +}; diff --git a/packages/ai-ide/src/common/context-files-variable.ts b/packages/ai-ide/src/common/context-files-variable.ts new file mode 100644 index 0000000..194b69c --- /dev/null +++ b/packages/ai-ide/src/common/context-files-variable.ts @@ -0,0 +1,49 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { MaybePromise, nls } from '@theia/core'; +import { injectable } from '@theia/core/shared/inversify'; +import { AIVariable, ResolvedAIVariable, AIVariableContribution, AIVariableResolver, AIVariableService, AIVariableResolutionRequest, AIVariableContext } from '@theia/ai-core'; +import { ChatSessionContext } from '@theia/ai-chat'; +import { CONTEXT_FILES_VARIABLE_ID } from './context-variables'; + +export const CONTEXT_FILES_VARIABLE: AIVariable = { + id: CONTEXT_FILES_VARIABLE_ID, + description: nls.localize('theia/ai/core/contextSummaryVariable/description', 'Describes files in the context for a given session.'), + name: CONTEXT_FILES_VARIABLE_ID, +}; + +@injectable() +export class ContextFilesVariableContribution implements AIVariableContribution, AIVariableResolver { + registerVariables(service: AIVariableService): void { + service.registerResolver(CONTEXT_FILES_VARIABLE, this); + } + + canResolve(request: AIVariableResolutionRequest, context: AIVariableContext): MaybePromise { + return request.variable.name === CONTEXT_FILES_VARIABLE.name ? 50 : 0; + } + + async resolve(request: AIVariableResolutionRequest, context: AIVariableContext): Promise { + if (!ChatSessionContext.is(context) || request.variable.name !== CONTEXT_FILES_VARIABLE.name) { return undefined; } + const variables = ChatSessionContext.getVariables(context); + + return { + variable: CONTEXT_FILES_VARIABLE, + value: variables.filter(variable => variable.variable.name === 'file' && !!variable.arg) + .map(variable => `- ${variable.arg}`).join('\n') + }; + } +} diff --git a/packages/ai-ide/src/common/context-functions.ts b/packages/ai-ide/src/common/context-functions.ts new file mode 100644 index 0000000..50de0d9 --- /dev/null +++ b/packages/ai-ide/src/common/context-functions.ts @@ -0,0 +1,19 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +export const UPDATE_CONTEXT_FILES_FUNCTION_ID = 'context_addFile'; +export const RESOLVE_CHAT_CONTEXT_FUNCTION_ID = 'context_ResolveChatContext'; +export const LIST_CHAT_CONTEXT_FUNCTION_ID = 'context_ListChatContext'; diff --git a/packages/ai-ide/src/common/context-variables.ts b/packages/ai-ide/src/common/context-variables.ts new file mode 100644 index 0000000..d2b91ff --- /dev/null +++ b/packages/ai-ide/src/common/context-variables.ts @@ -0,0 +1,18 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +export const CONTEXT_FILES_VARIABLE_ID = 'contextFiles'; +export const TASK_CONTEXT_SUMMARY_VARIABLE_ID = 'taskContextSummary'; diff --git a/packages/ai-ide/src/common/create-skill-prompt-template.ts b/packages/ai-ide/src/common/create-skill-prompt-template.ts new file mode 100644 index 0000000..d1025d8 --- /dev/null +++ b/packages/ai-ide/src/common/create-skill-prompt-template.ts @@ -0,0 +1,171 @@ +// ***************************************************************************** +// Copyright (C) 2026 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** +import { PromptVariantSet } from '@theia/ai-core/lib/common'; +import { + GET_WORKSPACE_FILE_LIST_FUNCTION_ID, FILE_CONTENT_FUNCTION_ID, + FIND_FILES_BY_PATTERN_FUNCTION_ID +} from './workspace-functions'; +import { CONTEXT_FILES_VARIABLE_ID } from './context-variables'; +import { UPDATE_CONTEXT_FILES_FUNCTION_ID } from './context-functions'; +import { + SUGGEST_FILE_CONTENT_ID, + SUGGEST_FILE_REPLACEMENTS_ID, + GET_PROPOSED_CHANGES_ID, + CLEAR_FILE_CHANGES_ID, + WRITE_FILE_CONTENT_ID, + WRITE_FILE_REPLACEMENTS_ID +} from './file-changeset-function-ids'; + +export const CREATE_SKILL_SYSTEM_PROMPT_TEMPLATE_ID = 'create-skill-system'; +export const CREATE_SKILL_SYSTEM_DEFAULT_TEMPLATE_ID = 'create-skill-system-default'; +export const CREATE_SKILL_SYSTEM_AGENT_MODE_TEMPLATE_ID = 'create-skill-system-agent-mode'; + +function getCreateSkillSystemPromptTemplate(agentic: boolean): string { + return `{{!-- This prompt is licensed under the MIT License (https://opensource.org/license/mit). +Made improvements or adaptations to this prompt template? We'd love for you to share it with the community! Contribute back here: +https://github.com/eclipse-theia/theia/discussions/new?category=prompt-template-contribution --}} +# Instructions + +You are the CreateSkill agent, an AI assistant specialized in creating and managing skills for AI agents. Your role is to help users create new skills +in the \`.prompts/skills/\` directory. + +## What are Skills? +Skills provide reusable instructions and domain knowledge for AI agents. A skill is a directory containing a \`SKILL.md\` file with YAML frontmatter +(name, description) and markdown content with detailed instructions. + +Skills without proper structure fail silently. Every time. The agent won't find them, won't use them, and users won't know why. + +## Skill Structure +Skills are stored in \`.prompts/skills//SKILL.md\`. Each skill MUST: +1. Be in its own directory with the directory name matching the skill name exactly +2. Use lowercase kebab-case for the name (e.g., 'my-skill', 'code-review', 'test-generation'). No exceptions. +3. Contain a SKILL.md file with valid YAML frontmatter + +Violating any of these requirements = broken skill. The system will not discover it. + +## SKILL.md Format +The SKILL.md file must have this structure: +\`\`\`markdown +--- +name: +description: +--- + + +\`\`\` + +## Your Capabilities + +### Create New Skills +When a user wants to create a new skill: +1. Ask for the skill name (or derive it from the description) +2. Ask for a brief description of what the skill should do +3. Gather requirements for the skill's instructions +4. Create the skill directory and SKILL.md file + +### Workflow +YOU MUST follow these steps in order. Skipping steps = broken skills. + +1. **Understand the requirement**: Ask the user what kind of skill they want to create +2. **Define the skill name**: MUST be lowercase kebab-case (e.g., 'code-review', 'test-generation'). Uppercase letters, spaces, or underscores = invalid. +3. **Announce your plan**: State: "I'm creating skill '' at .prompts/skills//SKILL.md" +4. **Write the description**: Create a concise description (max 1024 characters) +5. **Create detailed instructions**: Write comprehensive markdown content that provides clear guidance +6. **Create the file**: Use the file creation tools to create \`.prompts/skills//SKILL.md\` +7. **Validate IMMEDIATELY after creation**: Before doing anything else, verify: + - File exists at \`.prompts/skills//SKILL.md\` + - YAML frontmatter parses correctly (has name and description) + - Directory name matches the skill name in frontmatter + If validation fails, fix it before proceeding. + +## Context Retrieval +Use the following functions to interact with the workspace files when needed: +- **~{${GET_WORKSPACE_FILE_LIST_FUNCTION_ID}}**: List files and directories +- **~{${FILE_CONTENT_FUNCTION_ID}}**: Get content of specific files +- **~{${FIND_FILES_BY_PATTERN_FUNCTION_ID}}**: Find files by glob patterns like '**/*.md' +- **~{${UPDATE_CONTEXT_FILES_FUNCTION_ID}}**: Remember file locations that are relevant for completing your tasks + +## File Creation +To ${agentic ? 'create or modify files' : 'propose file changes to the user'}, use the following functions: + +- **Always Retrieve Current Content**: Use ~{${FILE_CONTENT_FUNCTION_ID}} to get the original content of a target file before editing. +${agentic ? '' : `- **View Pending Changes**: Use ~{${GET_PROPOSED_CHANGES_ID}} to see the current proposed state of a file, including all pending changes. +`}- **Change Content**: Use one of these methods to ${agentic ? 'apply' : 'propose'} changes: + - ~{${agentic ? WRITE_FILE_REPLACEMENTS_ID : SUGGEST_FILE_REPLACEMENTS_ID}}: For targeted replacements of specific text sections. + ${agentic ? '' : ' Multiple calls will merge changes unless you set the reset parameter to true.'} + - ~{${agentic ? WRITE_FILE_CONTENT_ID : SUGGEST_FILE_CONTENT_ID}}: For complete file rewrites or creating new files. + - If ~{${agentic ? WRITE_FILE_REPLACEMENTS_ID : SUGGEST_FILE_REPLACEMENTS_ID}} continuously fails use ~{${agentic ? WRITE_FILE_CONTENT_ID : SUGGEST_FILE_CONTENT_ID}}. +${agentic ? '' : ` - ~{${CLEAR_FILE_CHANGES_ID}}: To clear all pending changes for a file and start fresh. +`}${agentic ? '' : ` +The changes will be presented as an applicable diff to the user. The user can then accept or reject each change individually.`} + +## Example Skill +Here's an example of a well-structured skill: + +\`\`\`markdown +--- +name: code-review +description: Provides guidelines for performing thorough code reviews focusing on quality, maintainability, and best practices. +--- + +# Code Review Skill + +## Overview +This skill provides instructions for performing comprehensive code reviews. + +## Review Checklist +1. **Code Quality**: Check for clean, readable, and maintainable code +2. **Error Handling**: Ensure proper error handling and edge cases +3. **Performance**: Look for potential performance issues +4. **Security**: Check for security vulnerabilities +5. **Testing**: Verify adequate test coverage + +## Guidelines +- Be constructive and respectful in feedback +- Explain the reasoning behind suggestions +- Prioritize issues by severity +- Suggest improvements, not just point out problems +\`\`\` + +## Additional Context +{{${CONTEXT_FILES_VARIABLE_ID}}} + +## Non-Negotiable Requirements +- Skill names MUST be lowercase kebab-case. Always. No exceptions. +- Descriptions MUST be under 1024 characters +- YAML frontmatter MUST be valid (test it mentally before writing) +- Directory name MUST match the skill name exactly + +## Best Practices +- Write clear, actionable instructions in the skill content +- Include examples where helpful +- Organize content with clear headings and sections +`; +} + +export const createSkillSystemVariants = { + id: CREATE_SKILL_SYSTEM_PROMPT_TEMPLATE_ID, + defaultVariant: { + id: CREATE_SKILL_SYSTEM_DEFAULT_TEMPLATE_ID, + template: getCreateSkillSystemPromptTemplate(false) + }, + variants: [ + { + id: CREATE_SKILL_SYSTEM_AGENT_MODE_TEMPLATE_ID, + template: getCreateSkillSystemPromptTemplate(true) + } + ] +}; diff --git a/packages/ai-ide/src/common/file-changeset-function-ids.ts b/packages/ai-ide/src/common/file-changeset-function-ids.ts new file mode 100644 index 0000000..5b661a1 --- /dev/null +++ b/packages/ai-ide/src/common/file-changeset-function-ids.ts @@ -0,0 +1,50 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +export const SUGGEST_FILE_CONTENT_ID = 'suggestFileContent'; +export const WRITE_FILE_CONTENT_ID = 'writeFileContent'; + +/** + * Default function ID for suggesting file replacements. + * Uses the improved content replacer implementation (V2) with better matching and error handling. + * This replaced the previous simpler implementation which is now available as SUGGEST_FILE_REPLACEMENTS_SIMPLE_ID. + */ +export const SUGGEST_FILE_REPLACEMENTS_ID = 'suggestFileReplacements'; + +/** + * Legacy function ID for suggesting file replacements. + * Uses the original content replacer implementation (V1). + * @deprecated This is the older implementation. Consider using SUGGEST_FILE_REPLACEMENTS_ID (default) instead. + * This implementation may be removed in a future version. + */ +export const SUGGEST_FILE_REPLACEMENTS_SIMPLE_ID = 'suggestFileReplacements_Simple'; + +/** + * Default function ID for writing file replacements. + * Uses the improved content replacer implementation (V2) with better matching and error handling. + * This replaced the previous simpler implementation which is now available as WRITE_FILE_REPLACEMENTS_SIMPLE_ID. + */ +export const WRITE_FILE_REPLACEMENTS_ID = 'writeFileReplacements'; + +/** + * Legacy function ID for writing file replacements. + * Uses the original content replacer implementation (V1). + * @deprecated This is the older implementation. Consider using WRITE_FILE_REPLACEMENTS_ID (default) instead. + * This implementation may be removed in a future version. + */ +export const WRITE_FILE_REPLACEMENTS_SIMPLE_ID = 'writeFileReplacements_Simple'; +export const CLEAR_FILE_CHANGES_ID = 'clearFileChanges'; +export const GET_PROPOSED_CHANGES_ID = 'getProposedFileState'; diff --git a/packages/ai-ide/src/common/github-repo-protocol.ts b/packages/ai-ide/src/common/github-repo-protocol.ts new file mode 100644 index 0000000..e41cbe3 --- /dev/null +++ b/packages/ai-ide/src/common/github-repo-protocol.ts @@ -0,0 +1,32 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +export const GitHubRepoService = Symbol('GitHubRepoService'); +export const githubRepoServicePath = '/services/github-repo'; + +export interface GitHubRepoInfo { + owner: string; + repo: string; +} + +export interface GitHubRepoService { + /** + * Gets the GitHub repository information for the given workspace path. + * @param workspacePath The absolute path to the workspace directory + * @returns GitHub repository info (owner/repo) or undefined if not a GitHub repository + */ + getGitHubRepoInfo(workspacePath: string): Promise; +} diff --git a/packages/ai-ide/src/common/orchestrator-chat-agent.ts b/packages/ai-ide/src/common/orchestrator-chat-agent.ts new file mode 100644 index 0000000..d26b41c --- /dev/null +++ b/packages/ai-ide/src/common/orchestrator-chat-agent.ts @@ -0,0 +1,201 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { AIVariableContext, getJsonOfText, getTextOfResponse, LanguageModel, LanguageModelMessage, LanguageModelRequirement, LanguageModelResponse } from '@theia/ai-core'; +import { inject, injectable } from '@theia/core/shared/inversify'; +import { ChatAgentService } from '@theia/ai-chat/lib/common/chat-agent-service'; +import { ChatToolRequest } from '@theia/ai-chat/lib/common/chat-tool-request-service'; +import { AbstractStreamParsingChatAgent, SystemMessageDescription } from '@theia/ai-chat/lib/common/chat-agents'; +import { MutableChatRequestModel, InformationalChatResponseContentImpl } from '@theia/ai-chat/lib/common/chat-model'; +import { generateUuid, nls, PreferenceService } from '@theia/core'; +import { orchestratorTemplate } from './orchestrator-prompt-template'; +import { PREFERENCE_NAME_ORCHESTRATOR_EXCLUSION_LIST } from './ai-ide-preferences'; + +export const OrchestratorChatAgentId = 'Orchestrator'; +const OrchestratorRequestIdKey = 'orchestratorRequestIdKey'; + +@injectable() +export class OrchestratorChatAgent extends AbstractStreamParsingChatAgent { + id: string = OrchestratorChatAgentId; + name = OrchestratorChatAgentId; + languageModelRequirements: LanguageModelRequirement[] = [{ + purpose: 'agent-selection', + identifier: 'default/universal', + }]; + protected defaultLanguageModelPurpose: string = 'agent-selection'; + + override prompts = [orchestratorTemplate]; + override description = nls.localize('theia/ai/chat/orchestrator/description', + 'This agent analyzes the user request against the description of all available chat agents and selects the best fitting agent to answer the request \ + (by using AI).The user\'s request will be directly delegated to the selected agent without further confirmation.'); + override iconClass: string = 'codicon codicon-symbol-boolean'; + override agentSpecificVariables = [{ + name: 'availableChatAgents', + description: nls.localize('theia/ai/chat/orchestrator/vars/availableChatAgents/description', + 'The list of chat agents that the orchestrator can delegate to, excluding agents specified in the exclusion list preference.'), + usedInPrompt: true + }]; + + protected override systemPromptId: string = orchestratorTemplate.id; + + private fallBackChatAgentId = 'Universal'; + + @inject(ChatAgentService) + protected chatAgentService: ChatAgentService; + + @inject(PreferenceService) + protected preferenceService: PreferenceService; + + protected override async getSystemMessageDescription(context: AIVariableContext): Promise { + if (this.systemPromptId === undefined) { + return undefined; + } + + const excludedAgents = this.preferenceService.get(PREFERENCE_NAME_ORCHESTRATOR_EXCLUSION_LIST, ['ClaudeCode', 'Codex']); + const availableAgents = this.getAvailableAgentsForDelegation(excludedAgents); + const availableChatAgentsValue = availableAgents.map(agent => prettyPrintAgentInMd(agent)).join('\n'); + + const variantInfo = this.promptService.getPromptVariantInfo(this.systemPromptId); + + const resolvedPrompt = await this.promptService.getResolvedPromptFragment( + this.systemPromptId, + { availableChatAgents: availableChatAgentsValue }, + context + ); + + return resolvedPrompt ? SystemMessageDescription.fromResolvedPromptFragment(resolvedPrompt, variantInfo?.variantId, variantInfo?.isCustomized) : undefined; + } + + protected getAvailableAgentsForDelegation(excludedAgents: string[]): Array<{ id: string; name: string; description: string }> { + return this.chatAgentService.getAgents() + .filter(agent => agent.id !== this.id && !excludedAgents.includes(agent.id)) + .map(agent => ({ + id: agent.id, + name: agent.name, + description: agent.description + })); + } + + protected getExcludedAgentIds(): string[] { + return this.preferenceService.get(PREFERENCE_NAME_ORCHESTRATOR_EXCLUSION_LIST, ['ClaudeCode', 'Codex']); + } + + override async invoke(request: MutableChatRequestModel): Promise { + request.response.addProgressMessage({ content: nls.localize('theia/ai/ide/orchestrator/progressMessage', 'Determining the most appropriate agent'), status: 'inProgress' }); + // We use a dedicated id for the orchestrator request + const orchestratorRequestId = generateUuid(); + request.addData(OrchestratorRequestIdKey, orchestratorRequestId); + + return super.invoke(request); + } + + protected override async sendLlmRequest( + request: MutableChatRequestModel, + messages: LanguageModelMessage[], + toolRequests: ChatToolRequest[], + languageModel: LanguageModel, + promptVariantId?: string, + isPromptVariantCustomized?: boolean + ): Promise { + const agentSettings = this.getLlmSettings(); + const settings = { ...agentSettings, ...request.session.settings }; + const tools = toolRequests.length > 0 ? toolRequests : undefined; + const subRequestId = request.getDataByKey(OrchestratorRequestIdKey) ?? request.id; + request.removeData(OrchestratorRequestIdKey); + return this.languageModelService.sendRequest( + languageModel, + { + messages, + tools, + settings, + agentId: this.id, + sessionId: request.session.id, + requestId: request.id, + subRequestId: subRequestId, + cancellationToken: request.response.cancellationToken, + promptVariantId, + isPromptVariantCustomized + } + ); + } + + protected override async addContentsToResponse(response: LanguageModelResponse, request: MutableChatRequestModel): Promise { + const responseText = await getTextOfResponse(response); + + let agentIds: string[] = []; + const excludedAgents = this.getExcludedAgentIds(); + + try { + const jsonResponse = await getJsonOfText(responseText); + if (Array.isArray(jsonResponse)) { + agentIds = jsonResponse.filter((id: string) => id !== this.id && !excludedAgents.includes(id)); + } + } catch (error: unknown) { + // The llm sometimes does not return a parseable result + this.logger.error('Failed to parse JSON response', error); + } + + if (agentIds.length < 1) { + this.logger.error('No agent was selected, delegating to fallback chat agent'); + request.response.progressMessages.forEach(progressMessage => + request.response.updateProgressMessage({ ...progressMessage, status: 'failed' }) + ); + agentIds = [this.fallBackChatAgentId]; + } + + // check if selected (or fallback) agent exists and is not excluded + if (!this.chatAgentService.getAgent(agentIds[0]) || excludedAgents.includes(agentIds[0])) { + this.logger.error(`Chat agent ${agentIds[0]} not found or excluded. Falling back to first available agent.`); + const firstRegisteredAgent = this.chatAgentService.getAgents() + .filter(a => a.id !== this.id && !excludedAgents.includes(a.id))[0]?.id; + if (firstRegisteredAgent) { + agentIds = [firstRegisteredAgent]; + } else { + throw new Error(nls.localize('theia/ai/ide/orchestrator/error/noAgents', + 'No chat agent available to handle request. Please check your configuration whether any are enabled.')); + } + } + + // TODO support delegating to more than one agent + const delegatedToAgent = agentIds[0]; + request.response.response.addContent(new InformationalChatResponseContentImpl( + `*Orchestrator*: ${nls.localize('theia/ai/ide/orchestrator/response/delegatingToAgent', 'Delegating to \`@{0}\`', delegatedToAgent)} + + --- + + ` + )); + request.response.overrideAgentId(delegatedToAgent); + request.response.progressMessages.forEach(progressMessage => + request.response.updateProgressMessage({ ...progressMessage, status: 'completed' }) + ); + const agent = this.chatAgentService.getAgent(delegatedToAgent); + if (!agent) { + throw new Error(`Chat agent ${delegatedToAgent} not found.`); + } + + // Get the original request if available + const originalRequest = '__originalRequest' in request ? request.__originalRequest as MutableChatRequestModel : request; + await agent.invoke(originalRequest); + } +} + +function prettyPrintAgentInMd(agent: { id: string; name: string; description: string }): string { + return `- ${agent.id} + - *ID*: ${agent.id} + - *Name*: ${agent.name} + - *Description*: ${agent.description.replace(/\n/g, ' ')}`; +} diff --git a/packages/ai-ide/src/common/orchestrator-prompt-template.ts b/packages/ai-ide/src/common/orchestrator-prompt-template.ts new file mode 100644 index 0000000..9bca5da --- /dev/null +++ b/packages/ai-ide/src/common/orchestrator-prompt-template.ts @@ -0,0 +1,53 @@ +/* eslint-disable @typescript-eslint/tslint/config */ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH and others. +// +// This file is licensed under the MIT License. +// See LICENSE-MIT.txt in the project root for license information. +// https://opensource.org/license/mit. +// +// SPDX-License-Identifier: MIT +// ***************************************************************************** + +import { PromptVariantSet } from '@theia/ai-core/lib/common'; + +export const orchestratorTemplate: PromptVariantSet = { + id: 'orchestrator-system', + defaultVariant: { + id: 'orchestrator-system-default', + template: `{{!-- This prompt is licensed under the MIT License (https://opensource.org/license/mit). +Made improvements or adaptations to this prompt template? We’d love for you to share it with the community! Contribute back here: +https://github.com/eclipse-theia/theia/discussions/new?category=prompt-template-contribution --}} +# Instructions + +Your task is to identify which Chat Agent(s) should best reply a given user's message. +You consider all messages of the conversation to ensure consistency and avoid agent switches without a clear context change. +You should select the best Chat Agent based on the name and description of the agents, matching them to the user message. + +## Constraints + +Your response must be a JSON array containing the id(s) of the selected Chat Agent(s). + +* Do not use ids that are not provided in the list below. +* Do not include any additional information, explanations, or questions for the user. +* If there is no suitable choice, pick \`Universal\`. +* If there are multiple good choices, return all of them. + +Unless there is a more specific agent available, select \`Universal\`, especially for general programming-related questions. +You must only use the \`id\` attribute of the agent, never the name. + +### Example Results + +\`\`\`json +["Universal"] +\`\`\` + +\`\`\`json +["AnotherChatAgent", "Universal"] +\`\`\` + +## List of Currently Available Chat Agents + +{{availableChatAgents}} +`} +}; diff --git a/packages/ai-ide/src/common/project-info-prompt-template.ts b/packages/ai-ide/src/common/project-info-prompt-template.ts new file mode 100644 index 0000000..dd16643 --- /dev/null +++ b/packages/ai-ide/src/common/project-info-prompt-template.ts @@ -0,0 +1,163 @@ +/* eslint-disable @typescript-eslint/tslint/config */ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH and others. +// +// This file is licensed under the MIT License. +// See LICENSE-MIT.txt in the project root for license information. +// https://opensource.org/license/mit. +// +// SPDX-License-Identifier: MIT +// ***************************************************************************** +import { PromptVariantSet } from '@theia/ai-core/lib/common'; +import { + GET_WORKSPACE_FILE_LIST_FUNCTION_ID, FILE_CONTENT_FUNCTION_ID, SEARCH_IN_WORKSPACE_FUNCTION_ID, + FIND_FILES_BY_PATTERN_FUNCTION_ID +} from './workspace-functions'; +import { CONTEXT_FILES_VARIABLE_ID } from './context-variables'; +import { UPDATE_CONTEXT_FILES_FUNCTION_ID } from './context-functions'; +import { + SUGGEST_FILE_CONTENT_ID, + SUGGEST_FILE_REPLACEMENTS_ID, + GET_PROPOSED_CHANGES_ID, + CLEAR_FILE_CHANGES_ID +} from './file-changeset-function-ids'; + +export const PROJECT_INFO_SYSTEM_PROMPT_TEMPLATE_ID = 'project-info-system'; +export const PROJECT_INFO_TEMPLATE_PROMPT_ID = 'project-info-template'; + +export const projectInfoTemplateVariants = { + id: PROJECT_INFO_TEMPLATE_PROMPT_ID, + defaultVariant: { + id: 'project-info-template-default', + template: `## Project Info Template Structure + +### Architecture Overview +[Brief description of what the project does, Key architectural decisions, patterns, and structure.] + +### Key Technologies +[List of main technologies, frameworks, libraries] + +### Essential Development Patterns +Examples for key patterns (refer via relative file paths) + +### File Structure +[Important directories/packages and their contents] + +### Build & Development +[How to build and run the project.] + +### Testing +[What kind of tests exist, test organization and test patterns. Examples for different types of tests (as relative file paths)] + +### Coding Guidelines +[Coding standards, conventions, practices. Examples for key practices (as relative file paths), rules for imports, indentation] + +### Additional Notes +[Any other important information for agents to understand the project and write code for it. Important files with more information (as relative file paths)] +\`\`\` +` + } +}; + +export const projectInfoSystemVariants = { + id: PROJECT_INFO_SYSTEM_PROMPT_TEMPLATE_ID, + defaultVariant: { + id: 'project-info-system-default', + template: `{{!-- This prompt is licensed under the MIT License (https://opensource.org/license/mit). +Made improvements or adaptations to this prompt template? We'd love for you to share it with the community! Contribute back here: +https://github.com/eclipse-theia/theia/discussions/new?category=prompt-template-contribution --}} +# Instructions + +You are the ProjectInfo agent, an AI assistant specialized in managing project information files. Your role is to help users create, update, +and maintain the \`.prompts/project-info.prompttemplate\` file which provides contextual information about the project to other AI agents. + +## Project Info Guidelines +The project info is an artifact that will be handed over to agents to understand the current workspace, project and codebase. +Do not include obvious instructions, generic information, generic development practices or things that can be very easily discovered. +Focus on non-obvious and project-specific facts as well as specific guidelines and patterns. +Try to keep the project info minimal and avoid duplicates. + +## Your Capabilities + +### Initially Create Project Info +For initial project info creation, start by determining the user's preferred working mode: + +**Step 1: Define mode of working** +Ask the user about the preferred working mode: + +1. "Auto-exploration - Agent explores and creates an initial suggestion", +2. "Manual - User provides all necessary input with your guidance" + +IMPORTANT: Remember the chosen mode and stick to it until the user requests otherwise! + +- In automatic mode, create an initial version of the project info yourself by exploring the workspace +- In manual mode, guide the user section by section and ask for additional information. + Whenever you ask a question to the user, offer the option that you answer the question for them. + +**Step 2: Final tasks** +After completing all sections or if you feel the user is done, offer the user to do an automatic refinement: +"Would you like me to review and finalize the project information?", +- In this final refinement, particularly focus on relevance and potential duplications and the "Project Info Guidelines" +- Then, ask for final user review. Tell the user to provide any generic feedback and offer to incorporate it for them. +- Finally remind them to accept the final version in the change set + +### Complete Project Info +- If a project info is incomplete, offer the user to complete it + +### Update Project Info +- Modify existing project info based on user requirements +- Do not use a specific workflow for this + +## Workspace Analysis Guidelines + +**Auto-Discovery File Patterns** +When auto-discovering project information or exploring the workspace structure, ALWAYS prioritize examining these file patterns that commonly contain agent instructions +and project documentation: +- .github/copilot-instructions.md +- AGENT.md +- AGENTS.md +- CLAUDE.md +- .cursorrules +- .windsurfrules +- .clinerules +- .cursor +- rules/** +- .windsurf/rules/** +- .clinerules/** +- README.md +- .md files in the root level if they contain documentation + +Use the **~{${FIND_FILES_BY_PATTERN_FUNCTION_ID}}** function with these patterns to discover relevant configuration and documentation files. + +## Context Retrieval +Use the following functions to interact with the workspace files when needed: +- **~{${GET_WORKSPACE_FILE_LIST_FUNCTION_ID}}**: List files and directories +- **~{${FILE_CONTENT_FUNCTION_ID}}**: Get content of specific files +- **~{${FIND_FILES_BY_PATTERN_FUNCTION_ID}}**: Find files by glob patterns like '**/*.json' +- **~{${SEARCH_IN_WORKSPACE_FUNCTION_ID}}**: Search file contents + +Navigate step-by-step and confirm paths. Use **~{${UPDATE_CONTEXT_FILES_FUNCTION_ID}}** to remember important files for later reference. + +## File Modification - SUGGEST ONLY +Use these functions liberally to suggest file changes. All changes require user review and approval, so the user can reject them if needed. + +- **~{${SUGGEST_FILE_CONTENT_ID}}**: Propose complete file content (for creating new templates or complete rewrites) +- **~{${SUGGEST_FILE_REPLACEMENTS_ID}}**: Propose targeted replacements of specific text sections +- **~{${GET_PROPOSED_CHANGES_ID}}**: View current proposed changes before making additional ones +- **~{${CLEAR_FILE_CHANGES_ID}}**: Clear all pending changes for a file to start fresh + +{{prompt:${PROJECT_INFO_TEMPLATE_PROMPT_ID}}} + +## Additional Context +{{${CONTEXT_FILES_VARIABLE_ID}}} + +## Workflow Guidelines + +When creating project info for the first time: +1. **Always start by asking about the user's preferred mode** (auto-exploration or manual) and stick to it +2. **After initial suggestions or provided content**: Always ask for refinement and additional information + +Remember: Proactively help users maintain accurate project information for better AI assistance. +` + } +}; diff --git a/packages/ai-ide/src/common/summarize-session-commands.ts b/packages/ai-ide/src/common/summarize-session-commands.ts new file mode 100644 index 0000000..6e40f47 --- /dev/null +++ b/packages/ai-ide/src/common/summarize-session-commands.ts @@ -0,0 +1,32 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { Command } from '@theia/core'; + +export const AI_SUMMARIZE_SESSION_AS_TASK_FOR_CODER = Command.toLocalizedCommand({ + id: 'ai-chat:summarize-session-as-task-for-coder', + label: 'Summarize Session as Task for Coder' +}); + +export const AI_UPDATE_TASK_CONTEXT_COMMAND = Command.toLocalizedCommand({ + id: 'ai.updateTaskContext', + label: 'Update Current Task Context' +}); + +export const AI_EXECUTE_PLAN_WITH_CODER = Command.toLocalizedCommand({ + id: 'ai.executePlanWithCoder', + label: 'Execute Current Plan with Coder' +}); diff --git a/packages/ai-ide/src/common/task-context-function-ids.ts b/packages/ai-ide/src/common/task-context-function-ids.ts new file mode 100644 index 0000000..55f95e9 --- /dev/null +++ b/packages/ai-ide/src/common/task-context-function-ids.ts @@ -0,0 +1,45 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +/** + * Function ID for creating a new task context (implementation plan). + * Creates a task context with auto-generated metadata and opens it in the editor. + */ +export const CREATE_TASK_CONTEXT_FUNCTION_ID = 'createTaskContext'; + +/** + * Function ID for reading the current task context. + * Returns the content of the task context for the current session or a specified ID. + */ +export const GET_TASK_CONTEXT_FUNCTION_ID = 'getTaskContext'; + +/** + * Function ID for editing a task context with string replacement. + * Applies targeted edits to the task context and opens it in the editor. + */ +export const EDIT_TASK_CONTEXT_FUNCTION_ID = 'editTaskContext'; + +/** + * Function ID for listing all task contexts for the current session. + * Useful when the agent has created multiple plans and needs to see what exists. + */ +export const LIST_TASK_CONTEXTS_FUNCTION_ID = 'listTaskContexts'; + +/** + * Function ID for completely rewriting a task context. + * Fallback when edits fail repeatedly - replaces the entire content. + */ +export const REWRITE_TASK_CONTEXT_FUNCTION_ID = 'rewriteTaskContext'; diff --git a/packages/ai-ide/src/common/task-context-prompt-template.ts b/packages/ai-ide/src/common/task-context-prompt-template.ts new file mode 100644 index 0000000..fa5ad58 --- /dev/null +++ b/packages/ai-ide/src/common/task-context-prompt-template.ts @@ -0,0 +1,229 @@ +/* eslint-disable @typescript-eslint/tslint/config */ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH and others. +// +// This file is licensed under the MIT License. +// See LICENSE-MIT.txt in the project root for license information. +// https://opensource.org/license/mit. +// +// SPDX-License-Identifier: MIT +// ***************************************************************************** +import { PromptVariantSet } from '@theia/ai-core/lib/common'; +import { TASK_CONTEXT_SUMMARY_VARIABLE_ID } from './context-variables'; + +export const TASK_CONTEXT_CREATE_PROMPT_ID = 'task-context-create'; +export const TASK_CONTEXT_TEMPLATE_PROMPT_ID = 'task-context-template'; +export const TASK_CONTEXT_UPDATE_PROMPT_ID = 'task-context-update'; + +export const taskContextSystemVariants = { + id: TASK_CONTEXT_CREATE_PROMPT_ID, + defaultVariant: { + id: 'task-context-create-default', + template: `{{!-- This prompt is licensed under the MIT License (https://opensource.org/license/mit). +Made improvements or adaptations to this prompt template? We'd love for you to share it with the community! Contribute back here: +https://github.com/eclipse-theia/theia/discussions/new?category=prompt-template-contribution --}} + +Your task is to analyze the current chat session and summarize it to prepare to complete the coding task. +Your instructions should be complete. They are used by a coding agent. +Include all necessary information. +Use unique identifiers such as file paths or URIs to artifacts. +Skip irrelevant information, e.g. for discussions, only sum up the final result. + +## Instructions +1. Analyze the conversation carefully. +2. Identify the main coding objective and requirements. +3. Propose a clear approach to implement the requested functionality in task steps. +4. If any part of the task is ambiguous, note the ambiguity so that it can be clarified later. +5. If there are any relevant examples on how to implement something correctly, add them + +Focus on providing actionable steps and implementation guidance. The coding agent needs practical help with this specific coding task. + +Use the following template format: + +{{prompt:${TASK_CONTEXT_TEMPLATE_PROMPT_ID}}} +` + } +}; + +export const taskContextTemplateVariants = { + id: TASK_CONTEXT_TEMPLATE_PROMPT_ID, + defaultVariant: { + id: 'task-context-template-default', + template: `{{!-- This prompt is licensed under the MIT License (https://opensource.org/license/mit). +Made improvements or adaptations to this prompt template? We'd love for you to share it with the community! Contribute back here: +https://github.com/eclipse-theia/theia/discussions/new?category=prompt-template-contribution --}} + +# Task Context: [Title Here] + +--- + +## 1. 📚 Task Definition + +**Problem Statement / Goal:** +[Describe what needs to be achieved and why.] + +**Scope:** +- **In Scope:** + [Features, components, or behaviors to be included.] +- **Out of Scope:** + [What explicitly won't be part of this task.] + +--- + +## 2. 🧠 Design and Implementation + +**Design Overview:** +[Summary of architecture and major design decisions.] + +**Implementation Plan:** +1. [First major step] +2. [Second major step] +3. [Third major step] + +**Technology Choices:** +- [Frameworks, libraries, services, tools] + +**Files expected to be changed** +List all files that are expected to be changed (using relative file path) and quickly explain what is expected to be changed in this file. + +### Examples + +List all examples of existing code that are useful to understand the design and do the implementation. +These examples are not the files supposed to be changed, but code that shows how to implement specific things. +Prefer to mention files instead of adding their content. +Explain the purpose of every example. + +--- + +## 3. 🧪 Testing + +### 3.1 🛠️ Automated Testing (by Coder) + +**Automated Test Strategy:** +[What should be covered by automated tests.] + +**Test Cases Implemented:** +- [Unit test 1] +- [Integration test 1] +- [E2E test 1] + +**Test Coverage Targets:** +[e.g., Minimum 80% code coverage, all workflows tested.] + +--- + +### 3.2 🎯 Manual Testing (by Tester) + +**Manual Testing Strategy:** +[What manual tests will focus on (e.g., usability, edge cases, exploratory testing).] + +**Test Setup Instructions:** +- [Environment setup steps, accounts needed, special configurations] + +**Test Cases / Test Steps:** +1. [Action 1] +2. [Action 2] +3. [Action 3] + +**Expected Results:** +- [Expected behavior at each step] + +**Known Risks / Focus Areas:** +- [Potential weak spots, UX concerns, edge cases] + +--- + +## 4. 📦 Deliverables + +**Expected Artifacts:** +- [Code modules] +- [Documentation] +- [Configuration files] +- [Test reports] + +**PR Information:** +- **PR Title:** [Suggested title for the pull request] +- **PR Description:** [What was implemented, high-level changes, decisions] +- **Verification Steps:** [Instructions for verifying the PR manually or automatically] + +**Additional Notes:** +- [Dependencies] +- [Migration steps if needed] +- [Special reviewer instructions] + +--- + +## 5. 🔄 Current Status + +**Progress Summary:** +[Short free-text update about how far the task has progressed.] + +**Completed Items:** +- [List of what has been fully implemented, tested, or merged.] + +**Open Items:** +- [List of remaining tasks, missing parts.] + +**Current Issues / Risks:** +- [Open problems, bugs found during testing, architectural blockers.] + +**Next Steps:** +- [Immediate action items, who should act next.] +` + } +}; + +export const taskContextUpdateVariants = { + id: TASK_CONTEXT_UPDATE_PROMPT_ID, + defaultVariant: { + id: 'task-context-update-default', + template: `{{!-- This prompt is licensed under the MIT License (https://opensource.org/license/mit). +Made improvements or adaptations to this prompt template? We'd love for you to share it with the community! Contribute back here: +https://github.com/eclipse-theia/theia/discussions/new?category=prompt-template-contribution --}} +You are an AI assistant integrated into Theia IDE, designed to update task context files. You can interact provided task context file and propose changes. + +# Task Document Update Instructions + +You are an AI agent tasked with updating a technical document based on the current discussion. +Your job is to provide the COMPLETE UPDATED DOCUMENT as your response, not commentary about the document. + +## Analysis Requirements + +1. **Review the Current Discussion**: + - Analyze the entire conversation + - Identify new information, decisions, and changes + +2. **Examine the Existing Document**: + - Understand its structure and purpose + - Identify sections that need updates + +3. **Update the Document**: + - Maintain the original structure and formatting + - Add new information from the discussion + - Update existing information + - Remove outdated information if necessary + - Ensure coherence and organization + +## IMPORTANT: Response Format + +YOUR ENTIRE RESPONSE MUST BE THE UPDATED DOCUMENT ONLY. Do not include: +- Any commentary about what you changed +- Introduction or explanation text +- Markdown fences or syntax indicators +- Clarifying questions + +Simply output the complete updated document as plain text, which will directly replace the existing document. + +## Guidelines + +- Be thorough in capturing all relevant information +- Maintain the original document's style and tone +- Use clear, concise language +- Preserve all formatting from the original document +- Ensure technical accuracy in all updates + +{{${TASK_CONTEXT_SUMMARY_VARIABLE_ID}}} +` + } +}; + diff --git a/packages/ai-ide/src/common/todo-tool.ts b/packages/ai-ide/src/common/todo-tool.ts new file mode 100644 index 0000000..2ab893a --- /dev/null +++ b/packages/ai-ide/src/common/todo-tool.ts @@ -0,0 +1,35 @@ +// ***************************************************************************** +// Copyright (C) 2026 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +export const TODO_WRITE_FUNCTION_ID = 'todoWrite'; + +export interface TodoItem { + content: string; + activeForm: string; + status: 'pending' | 'in_progress' | 'completed'; +} + +export function isValidTodoItem(item: unknown): item is TodoItem { + if (!item || typeof item !== 'object') { + return false; + } + const obj = item as Record; + return ( + typeof obj.content === 'string' && + typeof obj.activeForm === 'string' && + (obj.status === 'pending' || obj.status === 'in_progress' || obj.status === 'completed') + ); +} diff --git a/packages/ai-ide/src/common/universal-chat-agent.ts b/packages/ai-ide/src/common/universal-chat-agent.ts new file mode 100644 index 0000000..9587d3c --- /dev/null +++ b/packages/ai-ide/src/common/universal-chat-agent.ts @@ -0,0 +1,40 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { LanguageModelRequirement } from '@theia/ai-core/lib/common'; +import { injectable } from '@theia/core/shared/inversify'; +import { AbstractStreamParsingChatAgent } from '@theia/ai-chat/lib/common/chat-agents'; +import { nls } from '@theia/core'; +import { universalTemplate, universalTemplateVariant } from './universal-prompt-template'; + +export const UniversalChatAgentId = 'Universal'; +@injectable() +export class UniversalChatAgent extends AbstractStreamParsingChatAgent { + id: string = UniversalChatAgentId; + name = UniversalChatAgentId; + languageModelRequirements: LanguageModelRequirement[] = [{ + purpose: 'chat', + identifier: 'default/universal', + }]; + protected defaultLanguageModelPurpose: string = 'chat'; + override description = nls.localize('theia/ai/chat/universal/description', 'This agent is designed to help software developers by providing concise and accurate ' + + 'answers to general programming and software development questions. It is also the fall-back for any generic ' + + 'questions the user might ask. The universal agent currently does not have any context by default, i.e. it cannot ' + + 'access the current user context or the workspace.'); + + override prompts = [{ id: 'universal-system', defaultVariant: universalTemplate, variants: [universalTemplateVariant] }]; + protected override systemPromptId: string = 'universal-system'; +} diff --git a/packages/ai-ide/src/common/universal-prompt-template.ts b/packages/ai-ide/src/common/universal-prompt-template.ts new file mode 100644 index 0000000..62fe783 --- /dev/null +++ b/packages/ai-ide/src/common/universal-prompt-template.ts @@ -0,0 +1,32 @@ +/* eslint-disable @typescript-eslint/tslint/config */ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH and others. +// +// This file is licensed under the MIT License. +// See LICENSE-MIT.txt in the project root for license information. +// https://opensource.org/license/mit. +// +// SPDX-License-Identifier: MIT +// ***************************************************************************** + +import { BasePromptFragment } from '@theia/ai-core/lib/common'; +import { CHAT_CONTEXT_DETAILS_VARIABLE_ID } from '@theia/ai-chat'; + +export const universalTemplate: BasePromptFragment = { + id: 'universal-system-default', + template: `{{!-- This prompt is licensed under the MIT License (https://opensource.org/license/mit). +Made improvements or adaptations to this prompt template? We’d love for you to share it with the community! Contribute back here: +https://github.com/eclipse-theia/theia/discussions/new?category=prompt-template-contribution --}} + +You are an assistant integrated into Theia IDE, designed to assist software developers. + +## Current Context +Some files and other pieces of data may have been added by the user to the context of the chat. If any have, the details can be found below. +{{${CHAT_CONTEXT_DETAILS_VARIABLE_ID}}} +` +}; + +export const universalTemplateVariant: BasePromptFragment = { + id: 'universal-system-empty', + template: '', +}; diff --git a/packages/ai-ide/src/common/workspace-functions.ts b/packages/ai-ide/src/common/workspace-functions.ts new file mode 100644 index 0000000..3be23e6 --- /dev/null +++ b/packages/ai-ide/src/common/workspace-functions.ts @@ -0,0 +1,39 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** +export const FILE_CONTENT_FUNCTION_ID = 'getFileContent'; +export const GET_WORKSPACE_FILE_LIST_FUNCTION_ID = 'getWorkspaceFileList'; +export const GET_WORKSPACE_DIRECTORY_STRUCTURE_FUNCTION_ID = 'getWorkspaceDirectoryStructure'; +export const GET_FILE_DIAGNOSTICS_ID = 'getFileDiagnostics'; +export const SEARCH_IN_WORKSPACE_FUNCTION_ID = 'searchInWorkspace'; +export const FIND_FILES_BY_PATTERN_FUNCTION_ID = 'findFilesByPattern'; +export const LIST_TASKS_FUNCTION_ID = 'listTasks'; +export const RUN_TASK_FUNCTION_ID = 'runTask'; +export const LIST_LAUNCH_CONFIGURATIONS_FUNCTION_ID = 'listLaunchConfigurations'; +export const RUN_LAUNCH_CONFIGURATION_FUNCTION_ID = 'runLaunchConfiguration'; +export const STOP_LAUNCH_CONFIGURATION_FUNCTION_ID = 'stopLaunchConfiguration'; +export const GET_SKILL_FILE_CONTENT_FUNCTION_ID = 'getSkillFileContent'; + +// Coolify deployment functions +export const COOLIFY_LIST_PROJECTS_FUNCTION_ID = 'coolify_listProjects'; +export const COOLIFY_LIST_APPLICATIONS_FUNCTION_ID = 'coolify_listApplications'; +export const COOLIFY_CREATE_APPLICATION_FUNCTION_ID = 'coolify_createApplication'; +export const COOLIFY_DEPLOY_APPLICATION_FUNCTION_ID = 'coolify_deployApplication'; +export const COOLIFY_GET_DEPLOYMENT_LOGS_FUNCTION_ID = 'coolify_getDeploymentLogs'; +export const COOLIFY_GET_APPLICATION_STATUS_FUNCTION_ID = 'coolify_getApplicationStatus'; + +// Gitea repository functions +export const GITEA_CREATE_REPOSITORY_FUNCTION_ID = 'gitea_createRepository'; +export const GIT_PUSH_TO_REMOTE_FUNCTION_ID = 'git_pushToRemote'; diff --git a/packages/ai-ide/src/common/workspace-preferences.ts b/packages/ai-ide/src/common/workspace-preferences.ts new file mode 100644 index 0000000..35a1a4b --- /dev/null +++ b/packages/ai-ide/src/common/workspace-preferences.ts @@ -0,0 +1,136 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { nls, PreferenceSchema } from '@theia/core'; + +export const CONSIDER_GITIGNORE_PREF = 'ai-features.workspaceFunctions.considerGitIgnore'; +export const USER_EXCLUDE_PATTERN_PREF = 'ai-features.workspaceFunctions.userExcludes'; +export const SEARCH_IN_WORKSPACE_MAX_RESULTS_PREF = 'ai-features.workspaceFunctions.searchMaxResults'; +export const PROMPT_TEMPLATE_WORKSPACE_DIRECTORIES_PREF = 'ai-features.promptTemplates.WorkspaceTemplateDirectories'; +export const PROMPT_TEMPLATE_ADDITIONAL_EXTENSIONS_PREF = 'ai-features.promptTemplates.TemplateExtensions'; +export const PROMPT_TEMPLATE_WORKSPACE_FILES_PREF = 'ai-features.promptTemplates.WorkspaceTemplateFiles'; +export const TASK_CONTEXT_STORAGE_DIRECTORY_PREF = 'ai-features.promptTemplates.taskContextStorageDirectory'; +export const COOLIFY_API_URL_PREF = 'ai-features.coolify.apiUrl'; +export const COOLIFY_API_TOKEN_PREF = 'ai-features.coolify.apiToken'; +export const GITEA_API_URL_PREF = 'ai-features.gitea.apiUrl'; +export const GITEA_API_TOKEN_PREF = 'ai-features.gitea.apiToken'; +export const GITEA_USERNAME_PREF = 'ai-features.gitea.username'; + +const CONFLICT_RESOLUTION_DESCRIPTION = 'When templates with the same ID (filename) exist in multiple locations, conflicts are resolved by priority: specific template files \ +(highest) > workspace directories > global directories (lowest).'; + +export const WorkspacePreferencesSchema: PreferenceSchema = { + properties: { + [CONSIDER_GITIGNORE_PREF]: { + type: 'boolean', + title: nls.localize('theia/ai/workspace/considerGitignore/title', 'Consider .gitignore'), + description: nls.localize('theia/ai/workspace/considerGitignore/description', + 'If enabled, excludes files/folders specified in a global .gitignore file (expected location is the workspace root).'), + default: true + }, + [USER_EXCLUDE_PATTERN_PREF]: { + type: 'array', + title: nls.localize('theia/ai/workspace/excludedPattern/title', 'Excluded File Patterns'), + description: nls.localize('theia/ai/workspace/excludedPattern/description', 'List of patterns (glob or regex) for files/folders to exclude.'), + default: ['node_modules', 'lib'], + items: { + type: 'string' + } + }, + [SEARCH_IN_WORKSPACE_MAX_RESULTS_PREF]: { + type: 'number', + title: nls.localize('theia/ai/workspace/searchMaxResults/title', 'Maximum Search Results'), + description: nls.localize('theia/ai/workspace/searchMaxResults/description', + 'Maximum number of search results returned by the workspace search function.'), + default: 30, + minimum: 1 + }, + [PROMPT_TEMPLATE_WORKSPACE_DIRECTORIES_PREF]: { + type: 'array', + title: nls.localize('theia/ai/promptTemplates/directories/title', 'Workspace-specific Prompt Template Directories'), + description: nls.localize('theia/ai/promptTemplates/directories/description', + 'List of relative paths indicating folders in the current workspace to be scanned for WORKSPACE specific prompt templates. ' + + CONFLICT_RESOLUTION_DESCRIPTION), + default: ['.prompts'], + items: { + type: 'string' + } + }, + [PROMPT_TEMPLATE_ADDITIONAL_EXTENSIONS_PREF]: { + type: 'array', + title: nls.localize('theia/ai/promptTemplates/extensions/title', 'Additional Prompt Template File Extensions'), + description: nls.localize('theia/ai/promptTemplates/extensions/description', + 'List of additional file extensions in prompt locations that are considered as prompt templates. \'.prompttemplate\' is always considered as a default.'), + items: { + type: 'string' + } + }, + [PROMPT_TEMPLATE_WORKSPACE_FILES_PREF]: { + type: 'array', + title: nls.localize('theia/ai/promptTemplates/files/title', 'Workspace-specific Prompt Template Files'), + description: nls.localize('theia/ai/promptTemplates/files/description', + 'List of relative paths to specific files in the current workspace to be used as prompt templates. ' + + CONFLICT_RESOLUTION_DESCRIPTION), + default: [], + items: { + type: 'string' + } + }, + [TASK_CONTEXT_STORAGE_DIRECTORY_PREF]: { + type: 'string', + description: nls.localize('theia/ai/chat/taskContextStorageDirectory/description', + 'A workspace relative path in which to persist and from which to retrieve task context descriptions.' + + ' If set to empty value, generated task contexts will be stored in memory rather than on disk.' + ), + default: '.prompts/task-contexts' + }, + [COOLIFY_API_URL_PREF]: { + type: 'string', + title: nls.localize('theia/ai/coolify/apiUrl/title', 'Coolify API URL'), + description: nls.localize('theia/ai/coolify/apiUrl/description', + 'The base URL of your Coolify instance (e.g., http://34.19.250.135:8000 or https://coolify.yourdomain.com). Can be set via COOLIFY_API_URL environment variable.'), + default: '' + }, + [COOLIFY_API_TOKEN_PREF]: { + type: 'string', + title: nls.localize('theia/ai/coolify/apiToken/title', 'Coolify API Token'), + description: nls.localize('theia/ai/coolify/apiToken/description', + 'Your Coolify API token with deployment permissions. Generate this in Coolify Dashboard → Settings → API Tokens. Can be set via COOLIFY_API_TOKEN environment variable.'), + default: '' + }, + [GITEA_API_URL_PREF]: { + type: 'string', + title: nls.localize('theia/ai/gitea/apiUrl/title', 'Gitea API URL'), + description: nls.localize('theia/ai/gitea/apiUrl/description', + 'The base URL of your Gitea instance (e.g., https://git.vibnai.com). Can be set via GITEA_API_URL environment variable.'), + default: '' + }, + [GITEA_API_TOKEN_PREF]: { + type: 'string', + title: nls.localize('theia/ai/gitea/apiToken/title', 'Gitea API Token'), + description: nls.localize('theia/ai/gitea/apiToken/description', + 'Your Gitea API token with repository write permissions. Generate this in Gitea Settings → Applications. Can be set via GITEA_API_TOKEN environment variable.'), + default: '' + }, + [GITEA_USERNAME_PREF]: { + type: 'string', + title: nls.localize('theia/ai/gitea/username/title', 'Gitea Username'), + description: nls.localize('theia/ai/gitea/username/description', + 'Your Gitea username for creating repositories. Can be set via GITEA_USERNAME environment variable.'), + default: '' + } + } +}; diff --git a/packages/ai-ide/src/common/workspace-search-provider-util.ts b/packages/ai-ide/src/common/workspace-search-provider-util.ts new file mode 100644 index 0000000..783387e --- /dev/null +++ b/packages/ai-ide/src/common/workspace-search-provider-util.ts @@ -0,0 +1,50 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { LinePreview, SearchInWorkspaceResult } from '@theia/search-in-workspace/lib/common/search-in-workspace-interface'; +import { URI } from '@theia/core'; + +/** + * Optimizes search results for token efficiency while preserving all information. + * - Groups matches by file to reduce repetition + * - Trims leading/trailing whitespace from line text + * - Uses relative file paths + * - Preserves all line numbers and content + */ +export function optimizeSearchResults(results: SearchInWorkspaceResult[], workspaceRoot: URI): Array<{ file: string; matches: Array<{ line: number; text: string }> }> { + return results.map(result => { + const fileUri = new URI(result.fileUri); + const relativePath = workspaceRoot.relative(fileUri); + + return { + file: relativePath ? relativePath.toString() : result.fileUri, + matches: result.matches.map(match => { + let lineText: string; + if (typeof match.lineText === 'string') { + lineText = match.lineText; + } else { + const linePreview = match.lineText as LinePreview; + lineText = linePreview.text || ''; + } + + return { + line: match.line, + text: lineText.trim() + }; + }) + }; + }); +} diff --git a/packages/ai-ide/src/node/app-tester-agent/browser-automation-impl.ts b/packages/ai-ide/src/node/app-tester-agent/browser-automation-impl.ts new file mode 100644 index 0000000..97f39ea --- /dev/null +++ b/packages/ai-ide/src/node/app-tester-agent/browser-automation-impl.ts @@ -0,0 +1,107 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { type RpcServer } from '@theia/core'; +import { injectable } from '@theia/core/shared/inversify'; +import { Browser, launch, Page } from 'puppeteer-core'; +import type { BrowserAutomation, BrowserAutomationClient, LaunchResult } from '../../common/browser-automation-protocol'; + +const MAX_DOM_LENGTH = 50000; + +@injectable() +export class BrowserAutomationImpl implements RpcServer, BrowserAutomation { + protected _browser?: Browser; + protected _page?: Page; + protected client?: BrowserAutomationClient; + + protected get browser(): Browser { + if (!this._browser) { + throw new Error('Browser is not launched'); + } + return this._browser; + } + + protected get page(): Page { + if (!this._page) { + throw new Error('Page is not created'); + } + return this._page; + } + + async isRunning(): Promise { + return this._browser !== undefined && this._browser.connected; + } + + async launch(remoteDebuggingPort: number): Promise { + if (this._browser) { + await this.close(); + } + + const browser = await launch({ + headless: false, + channel: 'chrome', + args: [ + `--remote-debugging-port=${remoteDebuggingPort}` + ], + }); + this._browser = browser; + // The initial page will be used per default + this._page = (await browser.pages())[0]; + return { + remoteDebuggingPort + }; + } + + async close(): Promise { + await this._browser?.close(); + this._browser = undefined; + } + + async queryDom(selector?: string): Promise { + const page = this.page; + let content = ''; + + if (selector) { + const element = await page.$(selector); + if (!element) { + throw new Error(`Element with selector "${selector}" not found`); + } + content = await page.evaluate(el => el.outerHTML, element); + } else { + content = await page.content(); + } + + if (content.length > MAX_DOM_LENGTH) { + return 'The queried DOM is too large. Please provide a more specific query.'; + } + + return content; + } + + dispose(): void { + this._browser?.close(); + this._browser = undefined; + } + + setClient(client: BrowserAutomationClient | undefined): void { + this.client = client; + } + + getClient?(): BrowserAutomationClient | undefined { + return this.client; + } + +} diff --git a/packages/ai-ide/src/node/backend-module.ts b/packages/ai-ide/src/node/backend-module.ts new file mode 100644 index 0000000..18d79e6 --- /dev/null +++ b/packages/ai-ide/src/node/backend-module.ts @@ -0,0 +1,52 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { ConnectionHandler, PreferenceContribution, RpcConnectionHandler } from '@theia/core'; +import { ContainerModule } from '@theia/core/shared/inversify'; +import { BrowserAutomation, browserAutomationPath, type BrowserAutomationClient } from '../common/browser-automation-protocol'; +import { BrowserAutomationImpl } from './app-tester-agent/browser-automation-impl'; +import { ConnectionContainerModule } from '@theia/core/lib/node/messaging/connection-container-module'; +import { WorkspacePreferencesSchema } from '../common/workspace-preferences'; +import { AiConfigurationPreferences } from '../common/ai-configuration-preferences'; +import { aiIdePreferenceSchema } from '../common/ai-ide-preferences'; +import { GitHubRepoService, githubRepoServicePath } from '../common/github-repo-protocol'; +import { GitHubRepoServiceImpl } from './github-repo-service-impl'; + +const browserAutomationModule = ConnectionContainerModule.create(({ bind, bindBackendService, bindFrontendService }) => { + bind(BrowserAutomation).to(BrowserAutomationImpl).inSingletonScope(); + bind(ConnectionHandler).toDynamicValue(ctx => + new RpcConnectionHandler(browserAutomationPath, client => { + const server = ctx.container.get(BrowserAutomation); + server.setClient(client); + client.onDidCloseConnection(() => server.close()); + return server; + }) + ).inSingletonScope(); +}); + +export default new ContainerModule(bind => { + bind(PreferenceContribution).toConstantValue({ schema: aiIdePreferenceSchema }); + bind(PreferenceContribution).toConstantValue({ schema: WorkspacePreferencesSchema }); + bind(PreferenceContribution).toConstantValue({ schema: AiConfigurationPreferences }); + + bind(ConnectionContainerModule).toConstantValue(browserAutomationModule); + + bind(GitHubRepoService).to(GitHubRepoServiceImpl).inSingletonScope(); + bind(ConnectionHandler).toDynamicValue(ctx => + new RpcConnectionHandler(githubRepoServicePath, () => ctx.container.get(GitHubRepoService)) + ).inSingletonScope(); + +}); diff --git a/packages/ai-ide/src/node/github-repo-service-impl.ts b/packages/ai-ide/src/node/github-repo-service-impl.ts new file mode 100644 index 0000000..cfe907d --- /dev/null +++ b/packages/ai-ide/src/node/github-repo-service-impl.ts @@ -0,0 +1,98 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { injectable } from '@theia/core/shared/inversify'; +import { simpleGit, SimpleGit } from 'simple-git'; +import { GitHubRepoService, GitHubRepoInfo } from '../common/github-repo-protocol'; + +@injectable() +export class GitHubRepoServiceImpl implements GitHubRepoService { + + async getGitHubRepoInfo(workspacePath: string): Promise { + try { + // Initialize simple-git with the workspace path + const git: SimpleGit = simpleGit(workspacePath); + + // Check if this is a git repository + const isRepo = await git.checkIsRepo(); + if (!isRepo) { + return undefined; + } + + // Get all remotes with their URLs + const remotes = await git.getRemotes(true); + + if (remotes.length === 0) { + return undefined; + } + + // Find GitHub remote (prefer 'origin', then any GitHub remote) + const githubRemote = remotes.find(remote => + remote.name === 'origin' && this.isGitHubRemote(remote.refs.fetch || remote.refs.push || '') + ) || remotes.find(remote => + this.isGitHubRemote(remote.refs.fetch || remote.refs.push || '') + ); + + if (!githubRemote) { + return undefined; + } + + const remoteUrl = githubRemote.refs.fetch || githubRemote.refs.push || ''; + const repoInfo = this.extractRepoInfoFromGitHubUrl(remoteUrl); + + return repoInfo; + + } catch (error) { + console.warn('Failed to get GitHub repository info:', error); + return undefined; + } + } + + private isGitHubRemote(remoteUrl: string): boolean { + return remoteUrl.includes('github.com'); + } + + private extractRepoInfoFromGitHubUrl(url: string): GitHubRepoInfo | undefined { + // Handle HTTPS URLs: https://github.com/owner/repo or https://github.com/owner/repo.git + const httpsMatch = url.match(/https:\/\/github\.com\/([^\/]+)\/([^\/]+?)(?:\.git)?$/); + if (httpsMatch) { + return { + owner: httpsMatch[1], + repo: httpsMatch[2] + }; + } + + // Handle SSH URLs: git@github.com:owner/repo or git@github.com:owner/repo.git + const sshMatch = url.match(/git@github\.com:([^\/]+)\/([^\/]+?)(?:\.git)?$/); + if (sshMatch) { + return { + owner: sshMatch[1], + repo: sshMatch[2] + }; + } + + // Handle alternative SSH format: ssh://git@github.com/owner/repo or ssh://git@github.com/owner/repo.git + const sshAltMatch = url.match(/ssh:\/\/git@github\.com\/([^\/]+)\/([^\/]+?)(?:\.git)?$/); + if (sshAltMatch) { + return { + owner: sshAltMatch[1], + repo: sshAltMatch[2] + }; + } + + return undefined; + } +} diff --git a/packages/ai-ide/src/package.spec.ts b/packages/ai-ide/src/package.spec.ts new file mode 100644 index 0000000..4aa2dec --- /dev/null +++ b/packages/ai-ide/src/package.spec.ts @@ -0,0 +1,28 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +/* note: this bogus test file is required so that + we are able to run mocha unit tests on this + package, without having any actual unit tests in it. + This way a coverage report will be generated, + showing 0% coverage, instead of no report. + This file can be removed once we have real unit + tests in place. */ + +describe('ai-ide-agents package', () => { + + it('support code coverage statistics', () => true); +}); diff --git a/packages/ai-ide/tsconfig.json b/packages/ai-ide/tsconfig.json new file mode 100644 index 0000000..76fe455 --- /dev/null +++ b/packages/ai-ide/tsconfig.json @@ -0,0 +1,67 @@ +{ + "extends": "../../configs/base.tsconfig", + "compilerOptions": { + "composite": true, + "rootDir": "src", + "outDir": "lib" + }, + "include": [ + "src" + ], + "references": [ + { + "path": "../../dev-packages/cli" + }, + { + "path": "../ai-chat" + }, + { + "path": "../ai-chat-ui" + }, + { + "path": "../ai-core" + }, + { + "path": "../core" + }, + { + "path": "../debug" + }, + { + "path": "../editor" + }, + { + "path": "../filesystem" + }, + { + "path": "../markers" + }, + { + "path": "../monaco" + }, + { + "path": "../navigator" + }, + { + "path": "../preferences" + }, + { + "path": "../scm" + }, + { + "path": "../search-in-workspace" + }, + { + "path": "../task" + }, + { + "path": "../terminal" + }, + { + "path": "../test" + }, + { + "path": "../workspace" + } + ] +} diff --git a/packages/ai-llamafile/.eslintrc.js b/packages/ai-llamafile/.eslintrc.js new file mode 100644 index 0000000..1308994 --- /dev/null +++ b/packages/ai-llamafile/.eslintrc.js @@ -0,0 +1,10 @@ +/** @type {import('eslint').Linter.Config} */ +module.exports = { + extends: [ + '../../configs/build.eslintrc.json' + ], + parserOptions: { + tsconfigRootDir: __dirname, + project: 'tsconfig.json' + } +}; diff --git a/packages/ai-llamafile/README.md b/packages/ai-llamafile/README.md new file mode 100644 index 0000000..1352427 --- /dev/null +++ b/packages/ai-llamafile/README.md @@ -0,0 +1,57 @@ +# AI Llamafile Integration + +The AI Llamafile package provides an integration that allows users to manage and interact with Llamafile language models within Theia IDE. + +## Features + +- Start and stop Llamafile language servers. + +## Commands + +### Start Llamafile + +- **Command ID:** `llamafile.start` +- **Label:** `Start Llamafile` +- **Functionality:** Allows you to start a Llamafile language server by selecting from a list of configured Llamafiles. + +### Stop Llamafile + +- **Command ID:** `llamafile.stop` +- **Label:** `Stop Llamafile` +- **Functionality:** Allows you to stop a running Llamafile language server by selecting from a list of currently running Llamafiles. + +## Usage + +1. **Starting a Llamafile Language Server:** + + - Use the command palette to invoke `Start Llamafile`. + - A quick pick menu will appear with a list of configured Llamafiles. + - Select a Llamafile to start its language server. + +2. **Stopping a Llamafile Language Server:** + - Use the command palette to invoke `Stop Llamafile`. + - A quick pick menu will display a list of currently running Llamafiles. + - Select a Llamafile to stop its language server. + +## Dependencies + +This extension depends on the `@theia/ai-core` package for AI-related services and functionalities. + +## Configuration + +Make sure to configure your Llamafiles properly within the preference settings. +This setting is an array of objects, where each object defines a llamafile with a user-friendly name, the file uri, and the port to start the server on. + +Example Configuration: + +```json +{ + "ai-features.llamafile.llamafiles": [ + { + "name": "MyLlamaFile", + "uri": "file:///path/to/my.llamafile", + "port": 30000 + } + ] +} +``` diff --git a/packages/ai-llamafile/package.json b/packages/ai-llamafile/package.json new file mode 100644 index 0000000..8e8beca --- /dev/null +++ b/packages/ai-llamafile/package.json @@ -0,0 +1,51 @@ +{ + "name": "@theia/ai-llamafile", + "version": "1.68.0", + "description": "Theia - Llamafile Integration", + "dependencies": { + "@theia/ai-core": "1.68.0", + "@theia/core": "1.68.0", + "@theia/output": "1.68.0", + "tslib": "^2.6.2" + }, + "publishConfig": { + "access": "public" + }, + "theiaExtensions": [ + { + "frontend": "lib/browser/llamafile-frontend-module", + "backend": "lib/node/llamafile-backend-module" + } + ], + "keywords": [ + "theia-extension" + ], + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "repository": { + "type": "git", + "url": "https://github.com/eclipse-theia/theia.git" + }, + "bugs": { + "url": "https://github.com/eclipse-theia/theia/issues" + }, + "homepage": "https://github.com/eclipse-theia/theia", + "files": [ + "lib", + "src" + ], + "scripts": { + "build": "theiaext build", + "clean": "theiaext clean", + "compile": "theiaext compile", + "lint": "theiaext lint", + "test": "theiaext test", + "watch": "theiaext watch" + }, + "devDependencies": { + "@theia/ext-scripts": "1.68.0" + }, + "nyc": { + "extends": "../../configs/nyc.json" + }, + "gitHead": "21358137e41342742707f660b8e222f940a27652" +} diff --git a/packages/ai-llamafile/src/browser/llamafile-command-contribution.ts b/packages/ai-llamafile/src/browser/llamafile-command-contribution.ts new file mode 100644 index 0000000..ff548df --- /dev/null +++ b/packages/ai-llamafile/src/browser/llamafile-command-contribution.ts @@ -0,0 +1,103 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** +import { AICommandHandlerFactory } from '@theia/ai-core/lib/browser/ai-command-handler-factory'; +import { CommandContribution, CommandRegistry, MessageService, nls, PreferenceService } from '@theia/core'; +import { QuickInputService } from '@theia/core/lib/browser'; +import { inject, injectable } from '@theia/core/shared/inversify'; +import { LlamafileManager } from '../common/llamafile-manager'; +import { PREFERENCE_LLAMAFILE } from '../common/llamafile-preferences'; +import { LlamafileEntry } from './llamafile-frontend-application-contribution'; + +export const StartLlamafileCommand = { + id: 'llamafile.start', + label: nls.localize('theia/ai/llamaFile/start', 'Start Llamafile'), +}; +export const StopLlamafileCommand = { + id: 'llamafile.stop', + label: nls.localize('theia/ai/llamaFile/stop', 'Stop Llamafile'), +}; + +@injectable() +export class LlamafileCommandContribution implements CommandContribution { + + @inject(QuickInputService) + protected readonly quickInputService: QuickInputService; + + @inject(AICommandHandlerFactory) + protected readonly commandHandlerFactory: AICommandHandlerFactory; + + @inject(PreferenceService) + protected preferenceService: PreferenceService; + + @inject(MessageService) + protected messageService: MessageService; + + @inject(LlamafileManager) + protected llamafileManager: LlamafileManager; + + registerCommands(commandRegistry: CommandRegistry): void { + commandRegistry.registerCommand(StartLlamafileCommand, this.commandHandlerFactory({ + execute: async () => { + try { + const llamaFiles = this.preferenceService.get(PREFERENCE_LLAMAFILE); + if (llamaFiles === undefined || llamaFiles.length === 0) { + this.messageService.error(nls.localize('theia/ai/llamafile/error/noConfigured', 'No Llamafiles configured.')); + return; + } + const options = llamaFiles.map(llamaFile => ({ label: llamaFile.name })); + const result = await this.quickInputService.showQuickPick(options); + if (result === undefined) { + return; + } + this.llamafileManager.startServer(result.label); + } catch (error) { + console.error('Something went wrong during the llamafile start.', error); + this.messageService.error( + nls.localize( + 'theia/ai/llamafile/error/startFailed', + 'Something went wrong during the llamafile start: {0}.\nFor more information, see the console.', + error.message + )); + } + } + })); + commandRegistry.registerCommand(StopLlamafileCommand, this.commandHandlerFactory({ + execute: async () => { + try { + const llamaFiles = await this.llamafileManager.getStartedLlamafiles(); + if (llamaFiles === undefined || llamaFiles.length === 0) { + this.messageService.error(nls.localize('theia/ai/llamafile/error/noRunning', 'No Llamafiles running.')); + return; + } + const options = llamaFiles.map(llamaFile => ({ label: llamaFile })); + const result = await this.quickInputService.showQuickPick(options); + if (result === undefined) { + return; + } + this.llamafileManager.stopServer(result.label); + } catch (error) { + console.error('Something went wrong during the llamafile stop.', error); + this.messageService.error( + nls.localize( + 'theia/ai/llamafile/error/stopFailed', + 'Something went wrong during the llamafile stop: {0}.\nFor more information, see the console.', + error.message + )); + } + } + })); + } +} diff --git a/packages/ai-llamafile/src/browser/llamafile-frontend-application-contribution.ts b/packages/ai-llamafile/src/browser/llamafile-frontend-application-contribution.ts new file mode 100644 index 0000000..b631970 --- /dev/null +++ b/packages/ai-llamafile/src/browser/llamafile-frontend-application-contribution.ts @@ -0,0 +1,104 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { FrontendApplicationContribution } from '@theia/core/lib/browser'; +import { inject, injectable } from '@theia/core/shared/inversify'; +import { LlamafileManager, LlamafileModelDescription } from '../common/llamafile-manager'; +import { PREFERENCE_LLAMAFILE } from '../common/llamafile-preferences'; +import { PreferenceService } from '@theia/core'; + +@injectable() +export class LlamafileFrontendApplicationContribution implements FrontendApplicationContribution { + + @inject(PreferenceService) + protected preferenceService: PreferenceService; + + @inject(LlamafileManager) + protected llamafileManager: LlamafileManager; + + private _knownLlamaFiles: Map = new Map(); + + onStart(): void { + this.preferenceService.ready.then(() => { + const llamafiles = this.preferenceService.get(PREFERENCE_LLAMAFILE, []); + const validLlamafiles = llamafiles.filter(LlamafileEntry.is); + + const LlamafileModelDescriptions = this.getLLamaFileModelDescriptions(validLlamafiles); + + this.llamafileManager.addLanguageModels(LlamafileModelDescriptions); + validLlamafiles.forEach(model => this._knownLlamaFiles.set(model.name, model)); + + this.preferenceService.onPreferenceChanged(event => { + if (event.preferenceName === PREFERENCE_LLAMAFILE) { + const currentLlamafiles = this.preferenceService.get(PREFERENCE_LLAMAFILE, []); + const newModels = currentLlamafiles.filter(LlamafileEntry.is); + this.handleLlamaFilePreferenceChange(newModels); + } + }); + }); + } + + protected getLLamaFileModelDescriptions(llamafiles: LlamafileEntry[]): LlamafileModelDescription[] { + return llamafiles.map(llamafile => ({ + name: llamafile.name, + uri: llamafile.uri, + port: llamafile.port + })); + } + + protected handleLlamaFilePreferenceChange(newModels: LlamafileEntry[]): void { + const llamafilesToAdd = newModels.filter(llamafile => + !this._knownLlamaFiles.has(llamafile.name) || + !LlamafileEntry.equals(this._knownLlamaFiles.get(llamafile.name)!, llamafile)); + + const llamafileIdsToRemove = [...this._knownLlamaFiles.values()].filter(llamafile => + !newModels.find(newModel => LlamafileEntry.equals(newModel, llamafile))) + .map(llamafile => llamafile.name); + + this.llamafileManager.removeLanguageModels(llamafileIdsToRemove); + llamafileIdsToRemove.forEach(id => this._knownLlamaFiles.delete(id)); + + this.llamafileManager.addLanguageModels(this.getLLamaFileModelDescriptions(llamafilesToAdd)); + llamafilesToAdd.forEach(model => this._knownLlamaFiles.set(model.name, model)); + } +} + +export interface LlamafileEntry { + name: string; + uri: string; + port: number; +} + +namespace LlamafileEntry { + export function equals(a: LlamafileEntry, b: LlamafileEntry): boolean { + return ( + a.name === b.name && + a.uri === b.uri && + a.port === b.port + ); + } + + export function is(entry: unknown): entry is LlamafileEntry { + return ( + typeof entry === 'object' && + // eslint-disable-next-line no-null/no-null + entry !== null && + 'name' in entry && typeof (entry as LlamafileEntry).name === 'string' && + 'uri' in entry && typeof (entry as LlamafileEntry).uri === 'string' && + 'port' in entry && typeof (entry as LlamafileEntry).port === 'number' + ); + } +} diff --git a/packages/ai-llamafile/src/browser/llamafile-frontend-module.ts b/packages/ai-llamafile/src/browser/llamafile-frontend-module.ts new file mode 100644 index 0000000..77d15b1 --- /dev/null +++ b/packages/ai-llamafile/src/browser/llamafile-frontend-module.ts @@ -0,0 +1,45 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** +import { CommandContribution } from '@theia/core'; +import { FrontendApplicationContribution, RemoteConnectionProvider, ServiceConnectionProvider } from '@theia/core/lib/browser'; +import { ContainerModule } from '@theia/core/shared/inversify'; +import { OutputChannelManager, OutputChannelSeverity } from '@theia/output/lib/browser/output-channel'; +import { LlamafileManager, LlamafileManagerPath, LlamafileServerManagerClient } from '../common/llamafile-manager'; +import { LlamafileCommandContribution } from './llamafile-command-contribution'; +import { LlamafileFrontendApplicationContribution } from './llamafile-frontend-application-contribution'; +import { bindAILlamafilePreferences } from '../common/llamafile-preferences'; + +export default new ContainerModule(bind => { + bind(FrontendApplicationContribution).to(LlamafileFrontendApplicationContribution).inSingletonScope(); + bind(CommandContribution).to(LlamafileCommandContribution).inSingletonScope(); + bind(LlamafileManager).toDynamicValue(ctx => { + const connection = ctx.container.get(RemoteConnectionProvider); + const outputChannelManager = ctx.container.get(OutputChannelManager); + const client: LlamafileServerManagerClient = { + error: (llamafileName, message) => { + const channel = outputChannelManager.getChannel(`${llamafileName}-llamafile`); + channel.appendLine(message, OutputChannelSeverity.Error); + }, + log: (llamafileName, message) => { + const channel = outputChannelManager.getChannel(`${llamafileName}-llamafile`); + channel.appendLine(message, OutputChannelSeverity.Info); + } + }; + return connection.createProxy(LlamafileManagerPath, client); + }).inSingletonScope(); + + bindAILlamafilePreferences(bind); +}); diff --git a/packages/ai-llamafile/src/common/llamafile-language-model.ts b/packages/ai-llamafile/src/common/llamafile-language-model.ts new file mode 100644 index 0000000..f37f47a --- /dev/null +++ b/packages/ai-llamafile/src/common/llamafile-language-model.ts @@ -0,0 +1,134 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { LanguageModel, LanguageModelMessage, LanguageModelRequest, LanguageModelResponse, LanguageModelStatus, LanguageModelStreamResponsePart } from '@theia/ai-core'; +import { CancellationToken } from '@theia/core'; + +const createMessageContent = (message: LanguageModelMessage): string | undefined => { + if (LanguageModelMessage.isTextMessage(message)) { + return message.text; + } + return undefined; +}; + +export class LlamafileLanguageModel implements LanguageModel { + + readonly providerId = 'llamafile'; + readonly vendor: string = 'Mozilla'; + + /** + * @param name the unique name for this language model. It will be used to identify the model in the UI. + * @param uri the URI pointing to the Llamafile model location. + * @param port the port on which the Llamafile model server operates. + */ + constructor( + public readonly name: string, + public status: LanguageModelStatus, + public readonly uri: string, + public readonly port: number, + ) { } + + get id(): string { + return this.name; + } + protected getSettings(request: LanguageModelRequest): Record { + return { + n_predict: 200, + stream: true, + stop: ['', 'Llama:', 'User:', '<|eot_id|>'], + cache_prompt: true, + ...(request.settings ?? {}) + }; + } + + async request(request: LanguageModelRequest, cancellationToken?: CancellationToken): Promise { + const settings = this.getSettings(request); + try { + let prompt = request.messages.map(message => { + const content = createMessageContent(message); + if (content === undefined) { + return undefined; + } + switch (message.actor) { + case 'user': + return `User: ${content}`; + case 'ai': + return `Llama: ${content}`; + case 'system': + return `${content.replace(/\n\n/g, '\n')}`; + } + }).filter(m => m !== undefined).join('\n'); + prompt += '\nLlama:'; + const response = await fetch(`http://localhost:${this.port}/completion`, { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify({ + prompt: prompt, + ...settings + }), + }); + + if (!response.ok) { + throw new Error(`HTTP error! status: ${response.status}`); + } + + if (!response.body) { + throw new Error('Response body is undefined'); + } + + const reader = response.body.getReader(); + const decoder = new TextDecoder(); + return { + stream: { + [Symbol.asyncIterator](): AsyncIterator { + return { + async next(): Promise> { + if (cancellationToken?.isCancellationRequested) { + reader.cancel(); + return { value: undefined, done: true }; + } + const { value, done } = await reader.read(); + if (done) { + return { value: undefined, done: true }; + } + const read = decoder.decode(value, { stream: true }); + const chunk = read.split('\n').filter(l => l.length !== 0).reduce((acc, line) => { + try { + const parsed = JSON.parse(line.substring(6)); + acc += parsed.content; + return acc; + } catch (error) { + console.error('Error parsing JSON:', error); + return acc; + } + }, ''); + return { value: { content: chunk }, done: false }; + } + }; + } + } + }; + } catch (error) { + console.error('Error:', error); + return { + text: `Error: ${error}` + }; + } + } + +} diff --git a/packages/ai-llamafile/src/common/llamafile-manager.ts b/packages/ai-llamafile/src/common/llamafile-manager.ts new file mode 100644 index 0000000..f670b37 --- /dev/null +++ b/packages/ai-llamafile/src/common/llamafile-manager.ts @@ -0,0 +1,37 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** +export const LlamafileManager = Symbol('LlamafileManager'); + +export const LlamafileManagerPath = '/services/llamafilemanager'; + +export interface LlamafileModelDescription { + name: string; + uri: string; + port: number; +} + +export interface LlamafileManager { + startServer(name: string): Promise; + stopServer(name: string): void; + getStartedLlamafiles(): Promise; + setClient(client: LlamafileServerManagerClient): void; + addLanguageModels(llamaFiles: LlamafileModelDescription[]): Promise; + removeLanguageModels(modelIds: string[]): void; +} +export interface LlamafileServerManagerClient { + log(llamafileName: string, message: string): void; + error(llamafileName: string, message: string): void; +} diff --git a/packages/ai-llamafile/src/common/llamafile-preferences.ts b/packages/ai-llamafile/src/common/llamafile-preferences.ts new file mode 100644 index 0000000..37433a4 --- /dev/null +++ b/packages/ai-llamafile/src/common/llamafile-preferences.ts @@ -0,0 +1,62 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { nls, PreferenceContribution, PreferenceSchema } from '@theia/core'; +import { interfaces } from '@theia/core/shared/inversify'; + +export const AI_LLAMAFILE_PREFERENCES_TITLE = nls.localize('theia/ai/llamaFile/prefs/title', '✨ AI LlamaFile'); +export const PREFERENCE_LLAMAFILE = 'ai-features.llamafile.llamafiles'; + +export const aiLlamafilePreferencesSchema: PreferenceSchema = { + properties: { + [PREFERENCE_LLAMAFILE]: { + title: AI_LLAMAFILE_PREFERENCES_TITLE, + markdownDescription: nls.localize('theia/ai/llamaFile/prefs/mdDescription', 'This setting allows you to configure and manage LlamaFile models in Theia IDE.\ + \n\ + Each entry requires a user-friendly `name`, the file `uri` pointing to your LlamaFile, and the `port` on which it will run.\ + \n\ + To start a LlamaFile, use the "Start LlamaFile" command, which enables you to select the desired model.\ + \n\ + If you edit an entry (e.g., change the port), any running instance will stop, and you will need to manually start it again.\ + \n\ + [Learn more about configuring and managing LlamaFiles in the Theia IDE documentation](https://theia-ide.org/docs/user_ai/#llamafile-models).'), + type: 'array', + default: [], + items: { + type: 'object', + properties: { + name: { + type: 'string', + description: nls.localize('theia/ai/llamaFile/prefs/name/description', 'The model name to use for this Llamafile.') + }, + uri: { + type: 'string', + description: nls.localize('theia/ai/llamaFile/prefs/uri/description', 'The file uri to the Llamafile.') + }, + port: { + type: 'number', + description: nls.localize('theia/ai/llamaFile/prefs/port/description', 'The port to use to start the server.') + } + } + }, + tags: ['experimental'] + } + } +}; + +export function bindAILlamafilePreferences(bind: interfaces.Bind): void { + bind(PreferenceContribution).toConstantValue({ schema: aiLlamafilePreferencesSchema }); +} diff --git a/packages/ai-llamafile/src/node/llamafile-backend-module.ts b/packages/ai-llamafile/src/node/llamafile-backend-module.ts new file mode 100644 index 0000000..6d83edb --- /dev/null +++ b/packages/ai-llamafile/src/node/llamafile-backend-module.ts @@ -0,0 +1,40 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { ContainerModule } from '@theia/core/shared/inversify'; +import { LlamafileManagerImpl } from './llamafile-manager-impl'; +import { LlamafileManager, LlamafileServerManagerClient, LlamafileManagerPath } from '../common/llamafile-manager'; +import { ConnectionHandler, RpcConnectionHandler } from '@theia/core'; +import { ConnectionContainerModule } from '@theia/core/lib/node/messaging/connection-container-module'; +import { bindAILlamafilePreferences } from '../common/llamafile-preferences'; + +// We use a connection module to handle AI services separately for each frontend. +const llamafileConnectionModule = ConnectionContainerModule.create(({ bind, bindBackendService, bindFrontendService }) => { + bind(LlamafileManager).to(LlamafileManagerImpl).inSingletonScope(); + bind(ConnectionHandler).toDynamicValue(ctx => new RpcConnectionHandler( + LlamafileManagerPath, + client => { + const service = ctx.container.get(LlamafileManager); + service.setClient(client); + return service; + } + )).inSingletonScope(); +}); + +export default new ContainerModule(bind => { + bindAILlamafilePreferences(bind); + bind(ConnectionContainerModule).toConstantValue(llamafileConnectionModule); +}); diff --git a/packages/ai-llamafile/src/node/llamafile-manager-impl.ts b/packages/ai-llamafile/src/node/llamafile-manager-impl.ts new file mode 100644 index 0000000..2ac87b2 --- /dev/null +++ b/packages/ai-llamafile/src/node/llamafile-manager-impl.ts @@ -0,0 +1,152 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** +import { LanguageModelRegistry, LanguageModelStatus } from '@theia/ai-core'; +import { inject, injectable } from '@theia/core/shared/inversify'; +import { ChildProcessWithoutNullStreams, spawn } from 'child_process'; +import { basename, dirname } from 'path'; +import { fileURLToPath } from 'url'; +import { LlamafileLanguageModel } from '../common/llamafile-language-model'; +import { LlamafileManager, LlamafileModelDescription, LlamafileServerManagerClient } from '../common/llamafile-manager'; + +@injectable() +export class LlamafileManagerImpl implements LlamafileManager { + + @inject(LanguageModelRegistry) + protected languageModelRegistry: LanguageModelRegistry; + + private processMap: Map = new Map(); + private client: LlamafileServerManagerClient; + + async addLanguageModels(LlamafileModelDescriptions: LlamafileModelDescription[]): Promise { + for (const llamafile of LlamafileModelDescriptions) { + const model = await this.languageModelRegistry.getLanguageModel(llamafile.name); + if (model) { + if (!(model instanceof LlamafileLanguageModel)) { + console.warn(`Llamafile: model ${model.id} is not a Llamafile model`); + continue; + } else { + // This can happen during the initializing of more than one frontends, changes are handled in the frontend + console.info(`Llamafile: skip creating or updating model ${llamafile.name} because it already exists.`); + } + } else { + this.languageModelRegistry.addLanguageModels([ + new LlamafileLanguageModel( + llamafile.name, + this.calculateStatus(false), + llamafile.uri, + llamafile.port + ) + ]); + } + } + } + + removeLanguageModels(modelIds: string[]): void { + modelIds.filter(modelId => this.isStarted(modelId)).forEach(modelId => this.stopServer(modelId)); + this.languageModelRegistry.removeLanguageModels(modelIds); + } + + async getStartedLlamafiles(): Promise { + const models = await this.languageModelRegistry.getLanguageModels(); + return models.filter(model => model instanceof LlamafileLanguageModel && this.isStarted(model.name)).map(model => model.id); + } + + async startServer(name: string): Promise { + if (this.processMap.has(name)) { + return; + } + + const llm = await this.getLlamafileModel(name); + if (!llm) { + return Promise.reject(`Llamafile ${name} not found`); + } + + const currentProcess = this.spawnLlamafileProcess(llm); + this.processMap.set(name, currentProcess); + await this.updateLanguageModelStatus(name, true); + this.attachProcessHandlers(name, currentProcess); + } + + protected async getLlamafileModel(name: string): Promise { + const models = await this.languageModelRegistry.getLanguageModels(); + return models.find(model => model.id === name && model instanceof LlamafileLanguageModel) as LlamafileLanguageModel | undefined; + } + + protected spawnLlamafileProcess(llm: LlamafileLanguageModel): ChildProcessWithoutNullStreams { + const filePath = fileURLToPath(llm.uri); + const dir = dirname(filePath); + const fileName = basename(filePath); + return spawn(`./${fileName}`, ['--port', '' + llm.port, '--server', '--nobrowser'], { cwd: dir }); + } + + protected attachProcessHandlers(name: string, currentProcess: ChildProcessWithoutNullStreams): void { + currentProcess.stdout.on('data', (data: Buffer) => { + this.client.log(name, data.toString()); + }); + + currentProcess.stderr.on('data', (data: Buffer) => { + this.client.error(name, data.toString()); + }); + + currentProcess.on('close', code => { + this.client.log(name, `LlamaFile process for file ${name} exited with code ${code}`); + this.processMap.delete(name); + // Set status to 'unavailable' when server stops + this.updateLanguageModelStatus(name, false); + }); + + currentProcess.on('error', error => { + this.client.error(name, `Error starting LlamaFile process for file ${name}: ${error.message}`); + this.processMap.delete(name); + // Set status to 'unavailable' on error + this.updateLanguageModelStatus(name, false, error.message); + }); + } + + protected async updateLanguageModelStatus(modelId: string, hasStarted: boolean, message?: string): Promise { + const status: LanguageModelStatus = this.calculateStatus(hasStarted, message); + await this.languageModelRegistry.patchLanguageModel(modelId, { + status + }); + } + + protected calculateStatus(started: boolean, message?: string): LanguageModelStatus { + if (started) { + return { status: 'ready' }; + } else { + return { status: 'unavailable', message: message || 'Llamafile server is not running' }; + } + } + + stopServer(name: string): void { + if (this.processMap.has(name)) { + const currentProcess = this.processMap.get(name); + currentProcess!.kill(); + this.processMap.delete(name); + // Set status to 'unavailable' when server is stopped + this.updateLanguageModelStatus(name, false); + } + } + + isStarted(name: string): boolean { + return this.processMap.has(name); + } + + setClient(client: LlamafileServerManagerClient): void { + this.client = client; + } + +} diff --git a/packages/ai-llamafile/src/package.spec.ts b/packages/ai-llamafile/src/package.spec.ts new file mode 100644 index 0000000..ac0ffad --- /dev/null +++ b/packages/ai-llamafile/src/package.spec.ts @@ -0,0 +1,27 @@ +// ***************************************************************************** +// Copyright (C) 2024 TypeFox GmbH and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +/* note: this bogus test file is required so that + we are able to run mocha unit tests on this + package, without having any actual unit tests in it. + This way a coverage report will be generated, + showing 0% coverage, instead of no report. + This file can be removed once we have real unit + tests in place. */ + +describe('ai-llamafile package', () => { + it('support code coverage statistics', () => true); +}); diff --git a/packages/ai-llamafile/tsconfig.json b/packages/ai-llamafile/tsconfig.json new file mode 100644 index 0000000..ed8ef98 --- /dev/null +++ b/packages/ai-llamafile/tsconfig.json @@ -0,0 +1,22 @@ +{ + "extends": "../../configs/base.tsconfig", + "compilerOptions": { + "composite": true, + "rootDir": "src", + "outDir": "lib" + }, + "include": [ + "src" + ], + "references": [ + { + "path": "../ai-core" + }, + { + "path": "../core" + }, + { + "path": "../output" + } + ] +} diff --git a/packages/ai-mcp-server.disabled/.eslintrc.js b/packages/ai-mcp-server.disabled/.eslintrc.js new file mode 100644 index 0000000..b206be4 --- /dev/null +++ b/packages/ai-mcp-server.disabled/.eslintrc.js @@ -0,0 +1,10 @@ +/** @type {import('eslint').Linter.Config} */ +module.exports = { + extends: [ + '../../configs/build.eslintrc.json' + ], + parserOptions: { + tsconfigRootDir: __dirname, + project: 'tsconfig.json' + } +}; \ No newline at end of file diff --git a/packages/ai-mcp-server.disabled/README.md b/packages/ai-mcp-server.disabled/README.md new file mode 100644 index 0000000..bfeddad --- /dev/null +++ b/packages/ai-mcp-server.disabled/README.md @@ -0,0 +1,203 @@ +
    + +
    + +theia-ext-logo + +

    ECLIPSE THEIA - AI MCP SERVER EXTENSION

    + +
    + +
    + +## Description + +This package provides Model Context Protocol (MCP) server functionality for Theia, enabling AI tools to access Theia services and workspace information. + +### Features + +- **HTTP Transport**: RESTful HTTP API for MCP communication using the StreamableHTTPServerTransport +- **Backend MCP Contributions**: Register backend-only tools, resources, and prompts +- **Frontend MCP Contributions**: Register frontend-only tools, resources, and prompts that can access frontend services +- **Frontend-Backend Delegation**: Allows frontend contributions to be exposed through the backend MCP server + +### Development Setup + +#### Starting the MCP Server + +1. Start Theia application +2. The MCP server will automatically start and be available at `/mcp` e.g. `http://localhost:3000/mcp` + +### API Endpoints + +- `POST /mcp` - MCP protocol endpoint (for all MCP protocol operations) + +### Architecture + +The MCP server architecture consists of: + +1. **HTTP Transport Layer**: Manages HTTP connections using StreamableHTTPServerTransport +2. **MCP Server**: Core server implementation that handles MCP protocol messages +3. **Backend Contributions**: Extensions that run on the Node.js backend +4. **Frontend Contributions**: Extensions that run in the browser frontend +5. **Frontend-Backend Bridge**: RPC mechanism to connect frontend and backend + +### Creating Backend Contributions + +Backend contributions run in the Node.js backend and have access to backend services: + +```typescript +@injectable() +export class MyBackendContribution implements MCPBackendContribution { + @inject(ILogger) + protected readonly logger: ILogger; + + async configure(server: McpServer): Promise { + // Register a tool + server.tool('my-backend-tool', { + type: 'object', + properties: { + input: { type: 'string' } + } + }, async (args) => { + this.logger.info('my-backend-tool called with args:', args); + return { + content: [{ type: 'text', text: 'Result from backend' }] + }; + }); + + // Register a resource + server.resource( + 'my-resource', + 'theia://resource-uri', + async (uri) => { + return { + content: 'Resource content' + }; + } + ); + + // Register a prompt + server.prompt( + 'my-prompt', + 'Prompt description', + {}, // Arguments schema + async (args) => { + return { + messages: [{ + role: 'user', + content: { type: 'text', text: 'Prompt content' } + }] + }; + } + ); + } +} +``` + +Register the contribution in your backend module: + +```typescript +bind(MyBackendContribution).toSelf().inSingletonScope(); +bind(MCPBackendContribution).toService(MyBackendContribution); +``` + +### Creating Frontend Contributions + +Frontend contributions run in the browser and have access to frontend services: + +```typescript +@injectable() +export class MyFrontendContribution implements MCPFrontendContribution { + @inject(WorkspaceService) + protected readonly workspaceService: WorkspaceService; + + async getTools(): Promise { + return [{ + name: 'workspace-info', + description: 'Get workspace info', + inputSchema: { + type: 'object', + properties: {} + } + }]; + } + + async getTool(name: string): Promise { + if (name === 'workspace-info') { + return { + handler: async () => { + const roots = await this.workspaceService.roots; + return { + roots: roots.map(r => r.resource.toString()) + }; + }, + inputSchema: z.object({}) + }; + } + } + + async getResources(): Promise { + return [{ + name: 'Workspace Information', + uri: 'workspace://info', + description: 'Workspace info', + mimeType: 'application/json' + }]; + } + + async readResource(uri: string): Promise { + if (uri === 'workspace://info') { + const roots = await this.workspaceService.roots; + return { roots: roots.map(r => r.resource.toString()) }; + } + } + + async getPrompts(): Promise { + return [{ + name: 'workspace-context', + description: 'Generate workspace context', + arguments: [] + }]; + } + + async getPrompt(name: string, args: unknown): Promise { + if (name === 'workspace-context') { + return [{ + role: 'user', + content: { type: 'text', text: 'Workspace context information' } + }]; + } + } +} +``` + +Register the contribution in your frontend module: + +```typescript +bind(MyFrontendContribution).toSelf().inSingletonScope(); +bind(MCPFrontendContribution).toService(MyFrontendContribution); +``` + +### Security Considerations + +- The MCP server exposes Theia functionality over HTTP +- Only enable the server in trusted environments +- Consider adding authentication and authorization for production use +- Restrict access to sensitive operations in your contributions + +## Additional Information + +- [API documentation for `@theia/ai-mcp-server`](https://eclipse-theia.github.io/theia/docs/next/modules/_theia_ai-mcp-server.html) +- [Theia - GitHub](https://github.com/eclipse-theia/theia) +- [Theia - Website](https://theia-ide.org/) + +## License + +- [Eclipse Public License 2.0](http://www.eclipse.org/legal/epl-2.0/) +- [一 (Secondary) GNU General Public License, version 2 with the GNU Classpath Exception](https://projects.eclipse.org/license/secondary-gpl-2.0-cp) + +## Trademark + +"Theia" is a trademark of the Eclipse Foundation + diff --git a/packages/ai-mcp-server.disabled/USAGE.md b/packages/ai-mcp-server.disabled/USAGE.md new file mode 100644 index 0000000..2ee8f0a --- /dev/null +++ b/packages/ai-mcp-server.disabled/USAGE.md @@ -0,0 +1,50 @@ +# MCP Server Usage Examples + +This document provides practical examples of how to use the Theia MCP Server. + +## Testing the MCP Server + +### Using WebSocket-based Clients (Recommended) + +For testing use: `npx @modelcontextprotocol/inspector` open the app with the token pre-filled. +In the app select Streamable HTTP as the Transport Type and add your endpoint (e.g. `http://localhost:3000/mcp`) in the URL field. + +## Available Tools + +The MCP server currently has the following tools available: + +| Tool Name | Description | Parameters | +|-----------|-------------|------------| +| `test-tool` | A simple test tool for verification | None | + +Additional tools are added through backend and frontend contributions. + +## Integration with AI Agents + +The MCP server is designed to be integrated with AI agents and tools that follow the Model Context Protocol specification. These agents can use the provided tools to interact with the Theia workspace. + +## Security Considerations + +- The MCP server has full access to Theia's command system and workspace +- Only enable the server in trusted environments +- Consider using authentication/authorization for HTTP transport in production + +## Debugging + +Enable debug logging by setting the log level: + +```bash +THEIA_LOG_LEVEL=debug theia start +``` + +The server will log MCP operations, session management, and error details. + +## Development Notes + +When developing against the MCP server, note that it uses: + +1. JSON-RPC 2.0 over HTTP +2. Streamable HTTP transport that requires specific headers and protocol handling +3. Session management via the `mcp-session-id` header + +For development and testing purposes, examine the server logs when `THEIA_LOG_LEVEL=debug` is enabled to understand the expected protocol interactions. diff --git a/packages/ai-mcp-server.disabled/package.json b/packages/ai-mcp-server.disabled/package.json new file mode 100644 index 0000000..670cd95 --- /dev/null +++ b/packages/ai-mcp-server.disabled/package.json @@ -0,0 +1,51 @@ +{ + "name": "@theia/ai-mcp-server", + "version": "1.68.0", + "description": "Theia - MCP Server", + "dependencies": { + "@modelcontextprotocol/sdk": "^1.25.1", + "@theia/core": "1.68.0", + "@theia/workspace": "1.68.0", + "zod": "^4.2.1" + }, + "publishConfig": { + "access": "public" + }, + "theiaExtensions": [ + { + "frontend": "lib/browser/mcp-frontend-module", + "backend": "lib/node/mcp-backend-module" + } + ], + "keywords": [ + "theia-extension" + ], + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "repository": { + "type": "git", + "url": "https://github.com/eclipse-theia/theia.git" + }, + "bugs": { + "url": "https://github.com/eclipse-theia/theia/issues" + }, + "homepage": "https://github.com/eclipse-theia/theia", + "files": [ + "lib", + "src" + ], + "main": "lib/common", + "scripts": { + "build": "theiaext build", + "clean": "theiaext clean", + "compile": "theiaext compile", + "lint": "theiaext lint", + "test": "theiaext test", + "watch": "theiaext watch" + }, + "devDependencies": { + "@theia/ext-scripts": "1.68.0" + }, + "nyc": { + "extends": "../../configs/nyc.json" + } +} diff --git a/packages/ai-mcp-server.disabled/src/browser/index.ts b/packages/ai-mcp-server.disabled/src/browser/index.ts new file mode 100644 index 0000000..98be44c --- /dev/null +++ b/packages/ai-mcp-server.disabled/src/browser/index.ts @@ -0,0 +1,18 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +export * from './mcp-frontend-bootstrap'; +export * from './mcp-frontend-contribution'; diff --git a/packages/ai-mcp-server.disabled/src/browser/mcp-frontend-bootstrap.ts b/packages/ai-mcp-server.disabled/src/browser/mcp-frontend-bootstrap.ts new file mode 100644 index 0000000..39d3598 --- /dev/null +++ b/packages/ai-mcp-server.disabled/src/browser/mcp-frontend-bootstrap.ts @@ -0,0 +1,43 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { inject, injectable } from '@theia/core/shared/inversify'; +import { MaybePromise } from '@theia/core'; +import { FrontendApplication, FrontendApplicationContribution } from '@theia/core/lib/browser'; +import { ILogger } from '@theia/core/lib/common/logger'; +import { MCPToolFrontendDelegate } from '../common/mcp-tool-delegate'; + +/** + * Bootstraps MCP frontend components during application startup. + * + * This contribution ensures that the MCPToolFrontendDelegate is properly instantiated + * and available in the dependency injection container when the frontend application starts. + * It acts as a lightweight initializer to activate MCP functionality in the browser. + */ +@injectable() +export class MCPFrontendBootstrap implements FrontendApplicationContribution { + + @inject(MCPToolFrontendDelegate) + protected readonly frontendDelegate: MCPToolFrontendDelegate; + + @inject(ILogger) + protected readonly logger: ILogger; + + onStart(_app: FrontendApplication): MaybePromise { + this.logger.debug('MCPFrontendBootstrap initialized'); + } + +} diff --git a/packages/ai-mcp-server.disabled/src/browser/mcp-frontend-contribution.ts b/packages/ai-mcp-server.disabled/src/browser/mcp-frontend-contribution.ts new file mode 100644 index 0000000..e0c3f7c --- /dev/null +++ b/packages/ai-mcp-server.disabled/src/browser/mcp-frontend-contribution.ts @@ -0,0 +1,67 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { ContributionProvider } from '@theia/core/lib/common/contribution-provider'; +import { Tool, Resource, Prompt, PromptMessage } from '@modelcontextprotocol/sdk/types'; +import { z } from 'zod'; + +export const MCPFrontendContribution = Symbol('MCPFrontendContribution'); + +/** + * Tool provider interface for frontend contributions + */ +export interface ToolProvider { + handler: (args: unknown) => Promise; + inputSchema: z.ZodSchema; +} + +/** + * Contribution interface for extending the MCP server with frontend-only tools, resources, and prompts + */ +export interface MCPFrontendContribution { + /** + * Get tools provided by this contribution + */ + getTools?(): Promise | Tool[]; + + /** + * Get specific tool by name + */ + getTool?(name: string): Promise | ToolProvider | undefined; + + /** + * Get resources provided by this contribution + */ + getResources?(): Promise | Resource[]; + + /** + * Read specific resource by URI + */ + readResource?(uri: string): Promise | unknown; + + /** + * Get prompts provided by this contribution + */ + getPrompts?(): Promise | Prompt[]; + + /** + * Get specific prompt by name with arguments + */ + getPrompt?(name: string, args: unknown): Promise | PromptMessage[]; +} + +export const MCPFrontendContributionProvider = Symbol('MCPFrontendContributionProvider'); +export interface MCPFrontendContributionProvider extends ContributionProvider { } diff --git a/packages/ai-mcp-server.disabled/src/browser/mcp-frontend-module.ts b/packages/ai-mcp-server.disabled/src/browser/mcp-frontend-module.ts new file mode 100644 index 0000000..1d09f3f --- /dev/null +++ b/packages/ai-mcp-server.disabled/src/browser/mcp-frontend-module.ts @@ -0,0 +1,42 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { ContainerModule } from '@theia/core/shared/inversify'; +import { bindContributionProvider } from '@theia/core'; +import { FrontendApplicationContribution } from '@theia/core/lib/browser'; +import { + RemoteConnectionProvider, + ServiceConnectionProvider, +} from '@theia/core/lib/browser/messaging/service-connection-provider'; +import { MCPToolFrontendDelegate, MCPToolDelegateClient, mcpToolDelegatePath } from '../common/mcp-tool-delegate'; +import { MCPFrontendBootstrap } from './mcp-frontend-bootstrap'; +import { MCPFrontendContribution } from './mcp-frontend-contribution'; +import { MCPToolDelegateClientImpl } from './mcp-tool-delegate-client'; + +export default new ContainerModule(bind => { + bind(MCPFrontendBootstrap).toSelf().inSingletonScope(); + bind(FrontendApplicationContribution).toService(MCPFrontendBootstrap); + + bind(MCPToolDelegateClient).to(MCPToolDelegateClientImpl).inSingletonScope(); + + bind(MCPToolFrontendDelegate).toDynamicValue(ctx => { + const connection = ctx.container.get(RemoteConnectionProvider); + const client = ctx.container.get(MCPToolDelegateClient); + return connection.createProxy(mcpToolDelegatePath, client); + }).inSingletonScope(); + + bindContributionProvider(bind, MCPFrontendContribution); +}); diff --git a/packages/ai-mcp-server.disabled/src/browser/mcp-tool-delegate-client.ts b/packages/ai-mcp-server.disabled/src/browser/mcp-tool-delegate-client.ts new file mode 100644 index 0000000..45c2aa6 --- /dev/null +++ b/packages/ai-mcp-server.disabled/src/browser/mcp-tool-delegate-client.ts @@ -0,0 +1,133 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { inject, injectable, named } from '@theia/core/shared/inversify'; +import { ContributionProvider } from '@theia/core'; +import { ILogger } from '@theia/core/lib/common/logger'; +import { Tool, Resource, ResourceContents, Prompt, PromptMessage } from '@modelcontextprotocol/sdk/types'; +import { MCPToolDelegateClient } from '../common/mcp-tool-delegate'; +import { MCPFrontendContribution } from './mcp-frontend-contribution'; + +/** + * Frontend client implementation that handles MCP tool delegation requests from the backend. + * + * This class acts as a bridge between the backend MCP server and frontend contributions, + * forwarding backend requests (tool calls, resource access, prompts) to registered + * MCPFrontendContribution instances and aggregating their responses. + * + * Called by the backend via the MCPToolDelegateClient interface to access frontend-provided + * MCP tools, resources, and prompts. + */ +@injectable() +export class MCPToolDelegateClientImpl implements MCPToolDelegateClient { + + @inject(ContributionProvider) + @named(MCPFrontendContribution) + protected readonly contributions: ContributionProvider; + + @inject(ILogger) + protected readonly logger: ILogger; + + private getFrontendContributions(): MCPFrontendContribution[] { + return this.contributions.getContributions(); + } + + async callTool(serverId: string, toolName: string, args: unknown): Promise { + const contributions = this.getFrontendContributions(); + + for (const contribution of contributions) { + if (contribution.getTool) { + const tool = await contribution.getTool(toolName); + if (tool) { + return await tool.handler(JSON.stringify(args)); + } + } + } + throw new Error(`Tool ${toolName} not found in server ${serverId}`); + } + + async listTools(serverId: string): Promise { + const contributions = this.getFrontendContributions(); + const allTools: Tool[] = []; + + for (const contribution of contributions) { + if (contribution.getTools) { + const tools = await contribution.getTools(); + allTools.push(...tools); + } + } + return allTools; + } + + async listResources(serverId: string): Promise { + const contributions = this.getFrontendContributions(); + const allResources: Resource[] = []; + + for (const contribution of contributions) { + if (contribution.getResources) { + const resources = await contribution.getResources(); + allResources.push(...resources); + } + } + return allResources; + } + + async readResource(serverId: string, uri: string): Promise { + const contributions = this.getFrontendContributions(); + + for (const contribution of contributions) { + if (contribution.readResource) { + try { + const result = await contribution.readResource(uri); + return result as ResourceContents; + } catch (error) { + // Continue to next contribution + this.logger.debug(`Error getting resource ${uri}:`, error); + } + } + } + throw new Error(`Resource ${uri} not found in server ${serverId}`); + } + + async listPrompts(serverId: string): Promise { + const contributions = this.getFrontendContributions(); + const allPrompts: Prompt[] = []; + + for (const contribution of contributions) { + if (contribution.getPrompts) { + const prompts = await contribution.getPrompts(); + allPrompts.push(...prompts); + } + } + return allPrompts; + } + + async getPrompt(serverId: string, name: string, args: unknown): Promise { + const contributions = this.getFrontendContributions(); + + for (const contribution of contributions) { + if (contribution.getPrompt) { + try { + return await contribution.getPrompt(name, args); + } catch (error) { + // Continue to next contribution + this.logger.debug(`Error getting prompt ${name}:`, error); + } + } + } + throw new Error(`Prompt ${name} not found in server ${serverId}`); + } +} diff --git a/packages/ai-mcp-server.disabled/src/common/index.ts b/packages/ai-mcp-server.disabled/src/common/index.ts new file mode 100644 index 0000000..df2c7d0 --- /dev/null +++ b/packages/ai-mcp-server.disabled/src/common/index.ts @@ -0,0 +1,17 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +export * from './mcp-tool-delegate'; diff --git a/packages/ai-mcp-server.disabled/src/common/mcp-tool-delegate.ts b/packages/ai-mcp-server.disabled/src/common/mcp-tool-delegate.ts new file mode 100644 index 0000000..493a5e9 --- /dev/null +++ b/packages/ai-mcp-server.disabled/src/common/mcp-tool-delegate.ts @@ -0,0 +1,43 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import type { Tool, Resource, ResourceContents, Prompt, PromptMessage } from '@modelcontextprotocol/sdk/types'; + +export const MCPToolDelegateClient = Symbol('MCPToolDelegateClient'); +/** + * Client interface for MCP tool operations. + * This interface is implemented by the frontend and called by the backend. + */ +export interface MCPToolDelegateClient { + callTool(serverId: string, toolName: string, args: unknown): Promise; + listTools(serverId: string): Promise; + listResources(serverId: string): Promise; + readResource(serverId: string, uri: string): Promise; + listPrompts(serverId: string): Promise; + getPrompt(serverId: string, name: string, args: unknown): Promise; +} + +export const MCPToolFrontendDelegate = Symbol('MCPToolFrontendDelegate'); +/** + * Backend delegate interface for MCP tool operations. + * This interface extends MCPToolDelegateClient with RPC client setup capability. + * It is implemented by the backend and acts as a proxy to forward calls to the frontend. + */ +export interface MCPToolFrontendDelegate extends MCPToolDelegateClient { + setClient(client: MCPToolDelegateClient): void; +} + +export const mcpToolDelegatePath = '/services/mcpToolDelegate'; diff --git a/packages/ai-mcp-server.disabled/src/node/index.ts b/packages/ai-mcp-server.disabled/src/node/index.ts new file mode 100644 index 0000000..dc07713 --- /dev/null +++ b/packages/ai-mcp-server.disabled/src/node/index.ts @@ -0,0 +1,20 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +export * from './mcp-theia-server'; +export * from './mcp-theia-server-impl'; +export * from './mcp-backend-contribution-manager'; +export * from './mcp-frontend-contribution-manager'; diff --git a/packages/ai-mcp-server.disabled/src/node/mcp-backend-contribution-manager.ts b/packages/ai-mcp-server.disabled/src/node/mcp-backend-contribution-manager.ts new file mode 100644 index 0000000..c231612 --- /dev/null +++ b/packages/ai-mcp-server.disabled/src/node/mcp-backend-contribution-manager.ts @@ -0,0 +1,56 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { inject, injectable, named } from '@theia/core/shared/inversify'; +import { ILogger } from '@theia/core/lib/common/logger'; +import { ContributionProvider } from '@theia/core/lib/common/contribution-provider'; +import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'; +import { MCPBackendContribution } from './mcp-theia-server'; + +/** + * Manages the registration of backend MCP contributions + */ +@injectable() +export class MCPBackendContributionManager { + + @inject(ILogger) + protected readonly logger: ILogger; + + @inject(ContributionProvider) + @named(MCPBackendContribution) + protected readonly contributions: ContributionProvider; + + /** + * Register all backend contributions with the MCP server + */ + async registerBackendContributions(server: McpServer): Promise { + const contributions = this.contributions.getContributions(); + this.logger.debug(`Found ${contributions.length} backend MCP contributions to register`); + + for (const contribution of contributions) { + try { + this.logger.debug(`Configuring backend MCP contribution: ${contribution.constructor.name}`); + await contribution.configure(server); + this.logger.debug(`Successfully registered backend MCP contribution: ${contribution.constructor.name}`); + } catch (error) { + this.logger.error(`Failed to register backend MCP contribution ${contribution.constructor.name}:`, error); + throw error; + } + } + + this.logger.debug(`Finished registering all ${contributions.length} backend MCP contributions`); + } +} diff --git a/packages/ai-mcp-server.disabled/src/node/mcp-backend-module.ts b/packages/ai-mcp-server.disabled/src/node/mcp-backend-module.ts new file mode 100644 index 0000000..72dddbc --- /dev/null +++ b/packages/ai-mcp-server.disabled/src/node/mcp-backend-module.ts @@ -0,0 +1,75 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { ContainerModule } from '@theia/core/shared/inversify'; +import { BackendApplicationContribution } from '@theia/core/lib/node/backend-application'; +import { ConnectionContainerModule } from '@theia/core/lib/node/messaging/connection-container-module'; +import { ConnectionHandler, RpcConnectionHandler, bindContributionProvider, generateUuid } from '@theia/core'; +import { + MCPTheiaServer, + MCPBackendContribution +} from './mcp-theia-server'; +import { MCPToolFrontendDelegate, MCPToolDelegateClient, mcpToolDelegatePath } from '../common/mcp-tool-delegate'; +import { MCPTheiaServerImpl } from './mcp-theia-server-impl'; +import { MCPBackendContributionManager } from './mcp-backend-contribution-manager'; +import { MCPFrontendContributionManager } from './mcp-frontend-contribution-manager'; +import { MCPToolFrontendDelegateImpl } from './mcp-tool-frontend-delegate'; + +const mcpConnectionModule = ConnectionContainerModule.create(({ bind }) => { + bind(MCPToolFrontendDelegateImpl).toSelf().inSingletonScope(); + bind(MCPToolFrontendDelegate).toService(MCPToolFrontendDelegateImpl); + + bind(ConnectionHandler) + .toDynamicValue( + ({ container }) => + new RpcConnectionHandler( + mcpToolDelegatePath, + client => { + const service = container.get(MCPToolFrontendDelegateImpl); + const contributionManager = container.get(MCPFrontendContributionManager); + + service.setClient(client); + + // Generate unique delegate ID and register with contribution manager + const delegateId = generateUuid(); + contributionManager.addFrontendDelegate(delegateId, service); + + // Setup cleanup when connection closes + client.onDidCloseConnection(() => { + contributionManager.removeFrontendDelegate(delegateId); + }); + + return service; + } + ) + ) + .inSingletonScope(); +}); + +export default new ContainerModule(bind => { + + bind(MCPTheiaServerImpl).toSelf().inSingletonScope(); + bind(MCPTheiaServer).toService(MCPTheiaServerImpl); + bind(BackendApplicationContribution).toService(MCPTheiaServerImpl); + + bind(MCPBackendContributionManager).toSelf().inSingletonScope(); + + bind(MCPFrontendContributionManager).toSelf().inSingletonScope(); + + bindContributionProvider(bind, MCPBackendContribution); + + bind(ConnectionContainerModule).toConstantValue(mcpConnectionModule); +}); diff --git a/packages/ai-mcp-server.disabled/src/node/mcp-frontend-contribution-manager.ts b/packages/ai-mcp-server.disabled/src/node/mcp-frontend-contribution-manager.ts new file mode 100644 index 0000000..58cca5b --- /dev/null +++ b/packages/ai-mcp-server.disabled/src/node/mcp-frontend-contribution-manager.ts @@ -0,0 +1,272 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { inject, injectable } from '@theia/core/shared/inversify'; +import { ILogger } from '@theia/core/lib/common/logger'; +import { McpServer, RegisteredTool, RegisteredPrompt, RegisteredResource } from '@modelcontextprotocol/sdk/server/mcp.js'; +import type { ReadResourceResult } from '@modelcontextprotocol/sdk/types.js'; +import { MCPToolFrontendDelegate } from '../common/mcp-tool-delegate'; +import { z } from 'zod'; + +/** + * Manages the registration and delegation of frontend MCP contributions + */ +@injectable() +export class MCPFrontendContributionManager { + + @inject(ILogger) + protected readonly logger: ILogger; + + // Frontend delegates are set dynamically when connections are established + private frontendDelegates = new Map(); + private mcpServer?: McpServer; + private serverId?: string; + + private registeredElements: Map = new Map(); + + /** + * Set the MCP server instance and setup frontend delegate notifications + */ + async setMCPServer(server: McpServer, serverId: string): Promise { + this.mcpServer = server; + this.serverId = serverId; + this.registerExistingFrontendContributions(); + } + + /** + * Add a frontend delegate (called when a frontend connection is established) + */ + addFrontendDelegate(delegateId: string, delegate: MCPToolFrontendDelegate): void { + this.frontendDelegates.set(delegateId, delegate); + + if (this.mcpServer && this.serverId) { + this.registerFrontendContributionsFromDelegate(delegateId, delegate).catch(error => { + this.logger.warn(`Failed to register frontend contributions from delegate ${delegateId}:`, error); + }); + } + } + + /** + * Remove a frontend delegate (called when a frontend connection is closed) + */ + removeFrontendDelegate(delegateId: string): void { + this.frontendDelegates.delete(delegateId); + this.unregisterFrontendContributionsFromDelegate(delegateId); + } + + /** + * Unregister frontend contributions from a specific delegate + */ + private unregisterFrontendContributionsFromDelegate(delegateId: string): void { + if (!this.mcpServer) { + this.logger.warn('MCP server not set, cannot unregister frontend contributions'); + return; + } + + const elements = this.registeredElements.get(delegateId); + if (elements) { + for (const element of elements) { + try { + element.remove(); + } catch (error) { + this.logger.warn(`Failed to unregister element from delegate ${delegateId}: ${error}`); + } + } + this.registeredElements.delete(delegateId); + + // Notify that lists have changed + this.mcpServer.sendToolListChanged(); + this.mcpServer.sendResourceListChanged(); + this.mcpServer.sendPromptListChanged(); + } + } + + /** + * Register frontend contributions from existing delegates + */ + private async registerExistingFrontendContributions(): Promise { + for (const [delegateId, delegate] of this.frontendDelegates) { + try { + await this.registerFrontendContributionsFromDelegate(delegateId, delegate); + } catch (error) { + this.logger.warn(`Failed to register frontend contributions from delegate ${delegateId}:`, error); + } + } + } + + /** + * Register frontend contributions from a specific delegate + */ + private async registerFrontendContributionsFromDelegate(delegateId: string, delegate: MCPToolFrontendDelegate): Promise { + if (!this.mcpServer || !this.serverId) { + this.logger.warn('MCP server not set, cannot register frontend contributions'); + return; + } + + try { + await this.registerFrontendToolsFromDelegate(delegate, delegateId); + this.mcpServer.sendToolListChanged(); + // Register resources from frontend + await this.registerFrontendResourcesFromDelegate(delegate, delegateId); + this.mcpServer.sendResourceListChanged(); + + // Register prompts from frontend + await this.registerFrontendPromptsFromDelegate(delegate, delegateId); + this.mcpServer.sendPromptListChanged(); + + } catch (error) { + this.logger.warn(`Failed to register frontend MCP contributions from delegate ${delegateId}: ${error}`); + // Don't re-throw to prevent server startup failure + } + } + + /** + * Unregister frontend contributions for a server + * @param serverId Unique identifier for the server instance + */ + async unregisterFrontendContributions(serverId: string): Promise { + for (const [delegateId] of this.frontendDelegates) { + try { + this.unregisterFrontendContributionsFromDelegate(delegateId); + // Backend delegates don't need lifecycle notifications + } catch (error) { + this.logger.warn(`Error unregistering server from frontend delegate ${delegateId}:`, error); + } + } + } + + /** + * Register tools from frontend contributions + */ + protected async registerFrontendToolsFromDelegate(delegate: MCPToolFrontendDelegate, delegateId: string): Promise { + if (!this.mcpServer || !this.serverId) { + throw new Error('MCP server not set'); + } + + try { + const tools = await delegate.listTools(this.serverId); + for (const tool of tools) { + const registeredTool = this.mcpServer.registerTool( + `${tool.name}_${delegateId}`, + { + description: tool.description ?? '', + // Cast needed: SDK's Tool.inputSchema type is looser than what z.fromJSONSchema expects + inputSchema: z.fromJSONSchema(tool.inputSchema as Parameters[0]) + }, + async args => { + try { + const result = await delegate.callTool( + this.serverId!, + tool.name, + args + ); + return { + content: [{ + type: 'text', + text: typeof result === 'string' ? result : JSON.stringify(result) + }] + }; + } catch (error) { + this.logger.error(`Error calling frontend tool ${tool.name}:`, error); + throw error; + } + } + ); + const registeredElements = this.registeredElements.get(delegateId) ?? []; + registeredElements.push(registeredTool); + this.registeredElements.set(delegateId, registeredElements); + } + + } catch (error) { + this.logger.warn(`Failed to register frontend tools from delegate ${delegateId}: ${error}`); + throw error; + } + } + + /** + * Register resources from frontend contributions + */ + protected async registerFrontendResourcesFromDelegate(delegate: MCPToolFrontendDelegate, delegateId: string): Promise { + if (!this.mcpServer || !this.serverId) { + throw new Error('MCP server not set'); + } + + try { + const resources = await delegate.listResources(this.serverId); + + for (const resource of resources) { + const registeredResource = this.mcpServer.resource( + `${resource.name}_${delegateId}`, + resource.uri, + async uri => { + try { + const result = await delegate.readResource(this.serverId!, uri.href); + return result as unknown as ReadResourceResult; + } catch (error) { + this.logger.error(`Error reading frontend resource ${resource.name}:`, error); + throw error; + } + } + ); + const registeredElements = this.registeredElements.get(delegateId) ?? []; + registeredElements.push(registeredResource); + this.registeredElements.set(delegateId, registeredElements); + } + + } catch (error) { + this.logger.warn(`Failed to register frontend resources from delegate ${delegateId}: ${error}`); + throw error; + } + } + + /** + * Register prompts from frontend contributions + */ + protected async registerFrontendPromptsFromDelegate(delegate: MCPToolFrontendDelegate, delegateId: string): Promise { + if (!this.mcpServer || !this.serverId) { + throw new Error('MCP server not set'); + } + + try { + const prompts = await delegate.listPrompts(this.serverId); + + for (const prompt of prompts) { + const registeredPrompt = this.mcpServer.prompt( + `${prompt.name}_${delegateId}`, + prompt.description ?? '', + prompt.arguments ?? {}, + async args => { + try { + const messages = await delegate.getPrompt(this.serverId!, prompt.name, args); + return { + messages + }; + } catch (error) { + this.logger.error(`Error getting frontend prompt ${prompt.name}:`, error); + throw error; + } + } + ); + const registeredElements = this.registeredElements.get(delegateId) ?? []; + registeredElements.push(registeredPrompt); + this.registeredElements.set(delegateId, registeredElements); + } + } catch (error) { + this.logger.warn(`Failed to register frontend prompts from delegate ${delegateId}: ${error}`); + throw error; + } + } +} diff --git a/packages/ai-mcp-server.disabled/src/node/mcp-theia-server-impl.ts b/packages/ai-mcp-server.disabled/src/node/mcp-theia-server-impl.ts new file mode 100644 index 0000000..eb4c679 --- /dev/null +++ b/packages/ai-mcp-server.disabled/src/node/mcp-theia-server-impl.ts @@ -0,0 +1,241 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { injectable, inject } from '@theia/core/shared/inversify'; +import { ILogger } from '@theia/core/lib/common/logger'; +import { BackendApplicationContribution } from '@theia/core/lib/node/backend-application'; +import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'; +import { generateUuid } from '@theia/core'; + +import { StreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/streamableHttp.js'; +import * as express from '@theia/core/shared/express'; +import { randomUUID } from 'crypto'; +import { MCPTheiaServer } from './mcp-theia-server'; +import { MCPBackendContributionManager } from './mcp-backend-contribution-manager'; +import { MCPFrontendContributionManager } from './mcp-frontend-contribution-manager'; + +@injectable() +export class MCPTheiaServerImpl implements MCPTheiaServer, BackendApplicationContribution { + + @inject(ILogger) + protected readonly logger: ILogger; + + @inject(MCPBackendContributionManager) + protected readonly backendContributionManager: MCPBackendContributionManager; + + @inject(MCPFrontendContributionManager) + protected readonly frontendContributionManager: MCPFrontendContributionManager; + + protected server?: McpServer; + protected httpTransports: Map = new Map(); + protected httpApp?: express.Application; + protected running = false; + protected serverId: string = generateUuid(); + + async configure?(app: express.Application): Promise { + this.httpApp = app; + + try { + await this.start(); + } catch (error) { + this.logger.error('Failed to start MCP server during initialization:', error); + } + } + + async start(): Promise { + if (this.running) { + throw new Error('MCP server is already running'); + } + + this.server = new McpServer({ + name: 'Theia MCP Server', + version: '1.0.0' + }, { + capabilities: { + tools: { + listChanged: true + }, + resources: { + listChanged: true + }, + prompts: { + listChanged: true + } + } + }); + + await this.registerContributions(); + await this.setupHttpTransport(); + + this.running = true; + } + + async stop(): Promise { + if (!this.running) { + return; + } + + try { + if (this.serverId) { + await this.frontendContributionManager.unregisterFrontendContributions(this.serverId); + } + + for (const transport of this.httpTransports.values()) { + transport.close(); + } + this.httpTransports.clear(); + + if (this.server) { + this.server.close(); + this.server = undefined; + } + + this.running = false; + } catch (error) { + this.logger.error('Error stopping MCP server:', error); + throw error; + } + } + + getServer(): McpServer | undefined { + return this.server; + } + + isRunning(): boolean { + return this.running; + } + + getServerId(): string | undefined { + return this.serverId; + } + + protected async setupHttpTransport(): Promise { + if (!this.server) { + throw new Error('Server not initialized'); + } + if (!this.httpApp) { + throw new Error('AppServer not initialized'); + } + + this.setupHttpEndpoints(this.httpApp); + } + + protected setupHttpEndpoints(app: express.Application): void { + app.all('/mcp', async (req, res) => { + await this.handleStreamableHttpRequest(req, res); + }); + } + + protected async handleStreamableHttpRequest(req: express.Request, res: express.Response): Promise { + if (!this.server) { + res.status(503).json({ + jsonrpc: '2.0', + error: { + code: -32000, + message: 'MCP Server not initialized', + }, + id: undefined, + }); + return; + } + + const sessionId = req.headers['mcp-session-id'] as string | undefined; + let transport: StreamableHTTPServerTransport; + + try { + if (sessionId && this.httpTransports.has(sessionId)) { + transport = this.httpTransports.get(sessionId)!; + } else { + transport = new StreamableHTTPServerTransport({ + sessionIdGenerator: () => randomUUID(), + onsessioninitialized: newSessionId => { + this.httpTransports.set(newSessionId, transport); + } + }); + + transport.onclose = () => { + if (transport.sessionId) { + this.httpTransports.delete(transport.sessionId); + } + }; + + await this.server.connect(transport); + } + + await transport.handleRequest(req, res, req.body); + } catch (error) { + this.logger.error('Error handling MCP Streamable HTTP request:', error); + if (!res.headersSent) { + res.status(500).json({ + jsonrpc: '2.0', + error: { + code: -32603, + message: `Internal server error: ${error}`, + }, + id: req.body?.id || undefined, + }); + } + } + } + + protected async registerContributions(): Promise { + if (!this.server) { + throw new Error('Server not initialized'); + } + + await this.backendContributionManager.registerBackendContributions(this.server); + await this.registerFrontendContributions(); + } + + protected async registerFrontendContributions(): Promise { + if (!this.server) { + throw new Error('Server not initialized'); + } + + try { + await this.frontendContributionManager.setMCPServer(this.server, this.serverId); + } catch (error) { + this.logger.debug('Frontend contributions registration failed (this is normal if no frontend is connected):', error); + } + } + + onStop(): void { + this.logger.debug('MCP Server stopping...'); + + if (this.running) { + try { + if (this.serverId) { + this.frontendContributionManager.unregisterFrontendContributions(this.serverId) + .catch(error => this.logger.warn('Failed to unregister frontend contributions during shutdown:', error)); + } + + for (const transport of this.httpTransports.values()) { + transport.close(); + } + this.httpTransports.clear(); + + if (this.server) { + this.server.close(); + this.server = undefined; + } + + this.running = false; + } catch (error) { + this.logger.error('Error stopping MCP server:', error); + } + } + } +} diff --git a/packages/ai-mcp-server.disabled/src/node/mcp-theia-server.ts b/packages/ai-mcp-server.disabled/src/node/mcp-theia-server.ts new file mode 100644 index 0000000..b8810e0 --- /dev/null +++ b/packages/ai-mcp-server.disabled/src/node/mcp-theia-server.ts @@ -0,0 +1,66 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { ContributionProvider } from '@theia/core/lib/common/contribution-provider'; +import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'; + +export const MCPTheiaServer = Symbol('MCPTheiaServer'); + +/** + * Main interface for the Theia MCP server (backend only) + */ +export interface MCPTheiaServer { + /** + * Start the MCP server with the given configuration + */ + start(): Promise; + + /** + * Stop the MCP server + */ + stop(): Promise; + + /** + * Get the underlying MCP server instance + */ + getServer(): McpServer | undefined; + + /** + * Get the server ID + */ + getServerId(): string | undefined; + + /** + * Check if the server is running + */ + isRunning(): boolean; +} + +export const MCPBackendContribution = Symbol('MCPBackendContribution'); + +/** + * Contribution interface for extending the MCP server with backend-only contributions + */ +export interface MCPBackendContribution { + /** + * Configure MCP server (for backend contributions) + * @param server The MCP server instance to configure + */ + configure(server: McpServer): Promise | void; +} + +export const MCPBackendContributionProvider = Symbol('MCPBackendContributionProvider'); +export interface MCPBackendContributionProvider extends ContributionProvider { } diff --git a/packages/ai-mcp-server.disabled/src/node/mcp-tool-frontend-delegate.ts b/packages/ai-mcp-server.disabled/src/node/mcp-tool-frontend-delegate.ts new file mode 100644 index 0000000..156fd83 --- /dev/null +++ b/packages/ai-mcp-server.disabled/src/node/mcp-tool-frontend-delegate.ts @@ -0,0 +1,71 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { injectable } from '@theia/core/shared/inversify'; +import { Tool, Resource, ResourceContents, Prompt, PromptMessage } from '@modelcontextprotocol/sdk/types.js'; +import { MCPToolFrontendDelegate, MCPToolDelegateClient } from '../common/mcp-tool-delegate'; + +@injectable() +export class MCPToolFrontendDelegateImpl implements MCPToolFrontendDelegate { + + private client?: MCPToolDelegateClient; + + setClient(client: MCPToolDelegateClient): void { + this.client = client; + } + + async callTool(serverId: string, toolName: string, args: unknown): Promise { + if (!this.client) { + throw new Error('MCPToolDelegateClient not set'); + } + return this.client.callTool(serverId, toolName, args); + } + + async listTools(serverId: string): Promise { + if (!this.client) { + throw new Error('MCPToolDelegateClient not set'); + } + return this.client.listTools(serverId); + } + + async listResources(serverId: string): Promise { + if (!this.client) { + throw new Error('MCPToolDelegateClient not set'); + } + return this.client.listResources(serverId); + } + + async readResource(serverId: string, uri: string): Promise { + if (!this.client) { + throw new Error('MCPToolDelegateClient not set'); + } + return this.client.readResource(serverId, uri); + } + + async listPrompts(serverId: string): Promise { + if (!this.client) { + throw new Error('MCPToolDelegateClient not set'); + } + return this.client.listPrompts(serverId); + } + + async getPrompt(serverId: string, name: string, args: unknown): Promise { + if (!this.client) { + throw new Error('MCPToolDelegateClient not set'); + } + return this.client.getPrompt(serverId, name, args); + } +} diff --git a/packages/ai-mcp-server.disabled/src/package.spec.ts b/packages/ai-mcp-server.disabled/src/package.spec.ts new file mode 100644 index 0000000..34e0a03 --- /dev/null +++ b/packages/ai-mcp-server.disabled/src/package.spec.ts @@ -0,0 +1,28 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +/* note: this bogus test file is required so that + we are able to run mocha unit tests on this + package, without having any actual unit tests in it. + This way a coverage report will be generated, + showing 0% coverage, instead of no report. + This file can be removed once we have real unit + tests in place. */ + +describe('ai-mcp-server package', () => { + + it('support code coverage statistics', () => true); +}); diff --git a/packages/ai-mcp-server.disabled/tsconfig.json b/packages/ai-mcp-server.disabled/tsconfig.json new file mode 100644 index 0000000..7ec8ca2 --- /dev/null +++ b/packages/ai-mcp-server.disabled/tsconfig.json @@ -0,0 +1,19 @@ +{ + "extends": "../../configs/base.tsconfig", + "compilerOptions": { + "composite": true, + "rootDir": "src", + "outDir": "lib" + }, + "include": [ + "src" + ], + "references": [ + { + "path": "../core" + }, + { + "path": "../workspace" + } + ] +} \ No newline at end of file diff --git a/packages/ai-mcp-ui.disabled/.eslintrc.js b/packages/ai-mcp-ui.disabled/.eslintrc.js new file mode 100644 index 0000000..1308994 --- /dev/null +++ b/packages/ai-mcp-ui.disabled/.eslintrc.js @@ -0,0 +1,10 @@ +/** @type {import('eslint').Linter.Config} */ +module.exports = { + extends: [ + '../../configs/build.eslintrc.json' + ], + parserOptions: { + tsconfigRootDir: __dirname, + project: 'tsconfig.json' + } +}; diff --git a/packages/ai-mcp-ui.disabled/README.md b/packages/ai-mcp-ui.disabled/README.md new file mode 100644 index 0000000..c8cc196 --- /dev/null +++ b/packages/ai-mcp-ui.disabled/README.md @@ -0,0 +1,78 @@ +
    + +
    + +theia-ext-logo + +

    ECLIPSE THEIA - AI MCP UI EXTENSION

    + +
    + +
    + +## Description + +The Model Context Server (MCP) UI Integration package provides the UI for users to start and use MCP servers + +### Features + +- Start and stop MCP servers. +- Provide preference schema for autocomplete etc. in preferences + +### Commands + +#### Start MCP Server + +- **Command ID:** `mcp.startserver` +- **Label:** `MCP: Start MCP Server` +- **Functionality:** Allows you to start a MCP server by selecting from a list of configured servers. + +#### Stop MCP Server + +- **Command ID:** `mcp.stopserver` +- **Label:** `MCP: Stop MCP Server` +- **Functionality:** Allows you to stop a running MCP server by selecting from a list of currently running servers. + +### Usage + +1. **Starting a MCP Server:** + - Use the command palette to invoke `MCP: Start MCP Server`. + - A quick pick menu will appear with a list of configured MCP servers. + - Select a server to start. + +2. **Stopping a MCP Server:** + - Use the command palette to invoke `MCP: Stop MCP Server`. + - A quick pick menu will display a list of currently running MCP servers. + - Select a server to stop. + +3. **Using provided tool functions** + - Only functions of started MCP servers can be used + - Open a prompt template and add the added tool functions + - Type '~{' to open the auto completion + +### Configuration + +To configure MCP servers, open the preferences and add entries to the `MCP Servers Configuration` section. +See the Theia MCP package (`@theia/ai-mcp`) README for more information. + +### More Information + +[Theia AI MCP README](https://github.com/eclipse-theia/theia/tree/master/packages/ai-mcp) +[User documentation on MCP in the Theia IDE](https://theia-ide.org/docs/user_ai/#mcp-integration) +[List of available MCP servers](https://github.com/modelcontextprotocol/servers) + +## Additional Information + +- [API documentation for `@theia/mcp-ui`](https://eclipse-theia.github.io/theia/docs/next/modules/_theia_ai-mcp-ui.html) +- [Theia - GitHub](https://github.com/eclipse-theia/theia) +- [Theia - Website](https://theia-ide.org/) + +## License + +- [Eclipse Public License 2.0](http://www.eclipse.org/legal/epl-2.0/) +- [GNU General Public License, version 2 with the GNU Classpath Exception](https://projects.eclipse.org/license/secondary-gpl-2.0-cp) + +## Trademark + +"Theia" is a trademark of the Eclipse Foundation + diff --git a/packages/ai-mcp-ui.disabled/package.json b/packages/ai-mcp-ui.disabled/package.json new file mode 100644 index 0000000..4d4609d --- /dev/null +++ b/packages/ai-mcp-ui.disabled/package.json @@ -0,0 +1,48 @@ +{ + "name": "@theia/ai-mcp-ui", + "version": "1.68.0", + "description": "Theia - MCP UI Integration", + "dependencies": { + "@theia/ai-core": "1.68.0", + "@theia/ai-mcp": "1.68.0", + "@theia/core": "1.68.0" + }, + "publishConfig": { + "access": "public" + }, + "theiaExtensions": [ + { + "frontend": "lib/browser/mcp-ui-frontend-module" + } + ], + "keywords": [ + "theia-extension" + ], + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "repository": { + "type": "git", + "url": "https://github.com/eclipse-theia/theia.git" + }, + "bugs": { + "url": "https://github.com/eclipse-theia/theia/issues" + }, + "homepage": "https://github.com/eclipse-theia/theia", + "files": [ + "lib", + "src" + ], + "scripts": { + "build": "theiaext build", + "clean": "theiaext clean", + "compile": "theiaext compile", + "lint": "theiaext lint", + "test": "theiaext test", + "watch": "theiaext watch" + }, + "devDependencies": { + "@theia/ext-scripts": "1.68.0" + }, + "nyc": { + "extends": "../../configs/nyc.json" + } +} diff --git a/packages/ai-mcp-ui.disabled/src/browser/mcp-command-contribution.ts b/packages/ai-mcp-ui.disabled/src/browser/mcp-command-contribution.ts new file mode 100644 index 0000000..cbe83fc --- /dev/null +++ b/packages/ai-mcp-ui.disabled/src/browser/mcp-command-contribution.ts @@ -0,0 +1,120 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** +import { AICommandHandlerFactory } from '@theia/ai-core/lib/browser/ai-command-handler-factory'; +import { CommandContribution, CommandRegistry, MessageService, nls } from '@theia/core'; +import { QuickInputService } from '@theia/core/lib/browser'; +import { inject, injectable } from '@theia/core/shared/inversify'; +import { MCPFrontendService, MCPServerStatus } from '@theia/ai-mcp'; + +export const StartMCPServer = { + id: 'mcp.startserver', + label: nls.localize('theia/ai/mcp/start/label', 'MCP: Start MCP Server'), +}; +export const StopMCPServer = { + id: 'mcp.stopserver', + label: nls.localize('theia/ai/mcp/stop/label', 'MCP: Stop MCP Server'), +}; + +@injectable() +export class MCPCommandContribution implements CommandContribution { + @inject(AICommandHandlerFactory) + protected readonly commandHandlerFactory: AICommandHandlerFactory; + + @inject(QuickInputService) + protected readonly quickInputService: QuickInputService; + + @inject(MessageService) + protected messageService: MessageService; + + @inject(MCPFrontendService) + protected readonly mcpFrontendService: MCPFrontendService; + + private async getMCPServerSelection(serverNames: string[]): Promise { + if (!serverNames || serverNames.length === 0) { + return undefined; + } + const options = serverNames.map(mcpServerName => ({ label: mcpServerName })); + const result = await this.quickInputService.showQuickPick(options); + return result?.label; + } + + registerCommands(commandRegistry: CommandRegistry): void { + commandRegistry.registerCommand(StopMCPServer, this.commandHandlerFactory({ + execute: async () => { + try { + const startedServers = await this.mcpFrontendService.getStartedServers(); + if (!startedServers || startedServers.length === 0) { + this.messageService.error(nls.localize('theia/ai/mcp/error/noRunningServers', 'No MCP servers running.')); + return; + } + const selection = await this.getMCPServerSelection(startedServers); + if (!selection) { + return; + } + await this.mcpFrontendService.stopServer(selection); + } catch (error) { + console.error('Error while stopping MCP server:', error); + } + } + })); + + commandRegistry.registerCommand(StartMCPServer, this.commandHandlerFactory({ + execute: async () => { + try { + const servers = await this.mcpFrontendService.getServerNames(); + const startedServers = await this.mcpFrontendService.getStartedServers(); + const startableServers = servers.filter(server => !startedServers.includes(server)); + if (!startableServers || startableServers.length === 0) { + if (startedServers && startedServers.length > 0) { + this.messageService.error(nls.localize('theia/ai/mcp/error/allServersRunning', 'All MCP servers are already running.')); + } else { + this.messageService.error(nls.localize('theia/ai/mcp/error/noServersConfigured', 'No MCP servers configured.')); + } + return; + } + + const selection = await this.getMCPServerSelection(startableServers); + if (!selection) { + return; + } + await this.mcpFrontendService.startServer(selection); + const serverDescription = await this.mcpFrontendService.getServerDescription(selection); + if (serverDescription && serverDescription.status) { + if (serverDescription.status === MCPServerStatus.Running + || serverDescription.status === MCPServerStatus.Connected) { + let toolNames: string | undefined = undefined; + if (serverDescription.tools) { + toolNames = serverDescription.tools.map(tool => tool.name).join(','); + } + this.messageService.info( + nls.localize('theia/ai/mcp/info/serverStarted', 'MCP server "{0}" successfully started. Registered tools: {1}', selection, toolNames || + nls.localize('theia/ai/mcp/tool/noTools', 'No tools available.')) + ); + return; + } + if (serverDescription.error) { + console.error('Error while starting MCP server:', serverDescription.error); + } + } + this.messageService.error(nls.localize('theia/ai/mcp/error/startFailed', 'An error occurred while starting the MCP server.')); + } catch (error) { + this.messageService.error(nls.localize('theia/ai/mcp/error/startFailed', 'An error occurred while starting the MCP server.')); + console.error('Error while starting MCP server:', error); + } + } + })); + } +} diff --git a/packages/ai-mcp-ui.disabled/src/browser/mcp-ui-frontend-module.ts b/packages/ai-mcp-ui.disabled/src/browser/mcp-ui-frontend-module.ts new file mode 100644 index 0000000..7d9d0a9 --- /dev/null +++ b/packages/ai-mcp-ui.disabled/src/browser/mcp-ui-frontend-module.ts @@ -0,0 +1,26 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { CommandContribution } from '@theia/core'; +import { ContainerModule } from '@theia/core/shared/inversify'; +import { MCPCommandContribution } from './mcp-command-contribution'; +import { PreferenceContribution } from '@theia/core/lib/common'; +import { McpServersPreferenceSchema } from '@theia/ai-mcp/lib/common/mcp-preferences'; + +export default new ContainerModule(bind => { + bind(PreferenceContribution).toConstantValue({ schema: McpServersPreferenceSchema }); + bind(CommandContribution).to(MCPCommandContribution); +}); diff --git a/packages/ai-mcp-ui.disabled/src/package.spec.ts b/packages/ai-mcp-ui.disabled/src/package.spec.ts new file mode 100644 index 0000000..d5f6047 --- /dev/null +++ b/packages/ai-mcp-ui.disabled/src/package.spec.ts @@ -0,0 +1,28 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +/* note: this bogus test file is required so that + we are able to run mocha unit tests on this + package, without having any actual unit tests in it. + This way a coverage report will be generated, + showing 0% coverage, instead of no report. + This file can be removed once we have real unit + tests in place. */ + +describe('ai-mcp-ui package', () => { + + it('support code coverage statistics', () => true); +}); diff --git a/packages/ai-mcp-ui.disabled/tsconfig.json b/packages/ai-mcp-ui.disabled/tsconfig.json new file mode 100644 index 0000000..9d0712f --- /dev/null +++ b/packages/ai-mcp-ui.disabled/tsconfig.json @@ -0,0 +1,22 @@ +{ + "extends": "../../configs/base.tsconfig", + "compilerOptions": { + "composite": true, + "rootDir": "src", + "outDir": "lib" + }, + "include": [ + "src" + ], + "references": [ + { + "path": "../ai-core" + }, + { + "path": "../ai-mcp.disabled" + }, + { + "path": "../core" + } + ] +} diff --git a/packages/ai-mcp.disabled/.eslintrc.js b/packages/ai-mcp.disabled/.eslintrc.js new file mode 100644 index 0000000..1308994 --- /dev/null +++ b/packages/ai-mcp.disabled/.eslintrc.js @@ -0,0 +1,10 @@ +/** @type {import('eslint').Linter.Config} */ +module.exports = { + extends: [ + '../../configs/build.eslintrc.json' + ], + parserOptions: { + tsconfigRootDir: __dirname, + project: 'tsconfig.json' + } +}; diff --git a/packages/ai-mcp.disabled/README.md b/packages/ai-mcp.disabled/README.md new file mode 100644 index 0000000..b0126c1 --- /dev/null +++ b/packages/ai-mcp.disabled/README.md @@ -0,0 +1,118 @@ +
    + +
    + +theia-ext-logo + +

    ECLIPSE THEIA - AI MCP EXTENSION

    + +
    + +
    + +## Description + +The AI MCP package provides an integration that allows users to start and use MCP servers to provide additional tool functions to LLMs, e.g. search or file access (outside of the workspace). + +### Features + +- Offers the framework to add/remove and start/stop MCP servers +- Use tool functions provided by MCP servers in prompt templates + +### Commands + +- Include `@theia/ai-mcp-ui` to gain access to the start and stop MCP sever commands. + +### Configuration + +To configure MCP servers, include `@theia/mcp-ui` or `bind` the included `mcp-preferences`. + +Afterwards, open the preferences and add entries to the `MCP Servers Configuration` section. Each server requires a unique identifier (e.g., `"brave-search"` or `"filesystem"`) and configuration details such as the command, arguments, optional environment variables, and autostart (true by default). + +`"autostart"` (true by default) will automatically start the respective MCP server whenever you restart your Theia application. In your current session, however, you'll still need to **manually start it** using the `"MCP: Start MCP Server"` command. + +Example Configuration: + +```json +{ + "ai-features.mcp.mcpServers": { + "memory": { + "command": "npx", + "args": [ + "-y", + "@modelcontextprotocol/server-memory" + ], + "autostart": false + }, + "brave-search": { + "command": "npx", + "args": [ + "-y", + "@modelcontextprotocol/server-brave-search" + ], + "env": { + "BRAVE_API_KEY": "YOUR_API_KEY" + } + }, + "filesystem": { + "command": "npx", + "args": [ + "-y", + "@modelcontextprotocol/server-filesystem", + "ABSOLUTE_PATH_TO_ALLOWED_DIRECTORY", + ] + }, + "git": { + "command": "uv", + "args": [ + "--directory", + "/path/to/repo", + "run", + "mcp-server-git" + ] + }, + "git2": { + "command": "uvx", + "args": [ + "mcp-server-git", + "--repository", + "/path/to/otherrepo" + ] + } + } +} +``` + +Example prompt (for search) + +```md +~{mcp_brave-search_brave_web_search} +``` + +Example User query + +```md +Search the internet for XYZ +``` + +### More Information + +[Theia AI MCP UI README](https://github.com/eclipse-theia/theia/tree/master/packages/ai-mcp-ui) +[User documentation on MCP in the Theia IDE](https://theia-ide.org/docs/user_ai/#mcp-integration) +[List of available MCP servers](https://github.com/modelcontextprotocol/servers) + +## Additional Information + +- [API documentation for `@theia/mcp`](https://eclipse-theia.github.io/theia/docs/next/modules/_theia_ai-mcp.html) +- [Theia - GitHub](https://github.com/eclipse-theia/theia) +- [Theia - Website](https://theia-ide.org/) + +## License + +- [Eclipse Public License 2.0](http://www.eclipse.org/legal/epl-2.0/) +- [GNU General Public License, version 2 with the GNU Classpath Exception](https://projects.eclipse.org/license/secondary-gpl-2.0-cp) + +## Trademark + +"Theia" is a trademark of the Eclipse Foundation + diff --git a/packages/ai-mcp.disabled/package.json b/packages/ai-mcp.disabled/package.json new file mode 100644 index 0000000..d859024 --- /dev/null +++ b/packages/ai-mcp.disabled/package.json @@ -0,0 +1,52 @@ +{ + "name": "@theia/ai-mcp", + "version": "1.68.0", + "description": "Theia - MCP Integration", + "dependencies": { + "@modelcontextprotocol/sdk": "^1.25.1", + "@theia/ai-core": "1.68.0", + "@theia/core": "1.68.0", + "@theia/workspace": "1.68.0" + }, + "publishConfig": { + "access": "public" + }, + "main": "lib/common", + "theiaExtensions": [ + { + "frontend": "lib/browser/mcp-frontend-module", + "backend": "lib/node/mcp-backend-module" + } + ], + "keywords": [ + "theia-extension" + ], + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "repository": { + "type": "git", + "url": "https://github.com/eclipse-theia/theia.git" + }, + "bugs": { + "url": "https://github.com/eclipse-theia/theia/issues" + }, + "homepage": "https://github.com/eclipse-theia/theia", + "files": [ + "lib", + "src" + ], + "scripts": { + "build": "theiaext build", + "clean": "theiaext clean", + "compile": "theiaext compile", + "lint": "theiaext lint", + "test": "theiaext test", + "watch": "theiaext watch" + }, + "devDependencies": { + "@theia/ext-scripts": "1.68.0" + }, + "nyc": { + "extends": "../../configs/nyc.json" + }, + "gitHead": "21358137e41342742707f660b8e222f940a27652" +} diff --git a/packages/ai-mcp.disabled/src/browser/mcp-frontend-application-contribution.ts b/packages/ai-mcp.disabled/src/browser/mcp-frontend-application-contribution.ts new file mode 100644 index 0000000..df375bd --- /dev/null +++ b/packages/ai-mcp.disabled/src/browser/mcp-frontend-application-contribution.ts @@ -0,0 +1,275 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { FrontendApplicationContribution } from '@theia/core/lib/browser'; +import { inject, injectable } from '@theia/core/shared/inversify'; +import { MCPServerDescription, MCPServerManager } from '../common'; +import { MCP_SERVERS_PREF } from '../common/mcp-preferences'; +import { MCPFrontendService } from '../common/mcp-server-manager'; +import { JSONObject } from '@theia/core/shared/@lumino/coreutils'; +import { PreferenceService, PreferenceUtils } from '@theia/core'; +import { nls } from '@theia/core/lib/common/nls'; +import { + WorkspaceTrustService, + WorkspaceRestrictionContribution, + WorkspaceRestriction +} from '@theia/workspace/lib/browser/workspace-trust-service'; + +interface BaseMCPServerPreferenceValue { + autostart?: boolean; +} + +interface LocalMCPServerPreferenceValue extends BaseMCPServerPreferenceValue { + command: string; + args?: string[]; + env?: { [key: string]: string }; +} + +interface RemoteMCPServerPreferenceValue extends BaseMCPServerPreferenceValue { + serverUrl: string; + serverAuthToken?: string; + serverAuthTokenHeader?: string; + headers?: { [key: string]: string }; +} + +type MCPServersPreferenceValue = LocalMCPServerPreferenceValue | RemoteMCPServerPreferenceValue; + +interface MCPServersPreference { + [name: string]: MCPServersPreferenceValue +}; + +namespace MCPServersPreference { + export function isValue(obj: unknown): obj is MCPServersPreferenceValue { + return !!obj && typeof obj === 'object' && + ('command' in obj || 'serverUrl' in obj) && + (!('command' in obj) || typeof obj.command === 'string') && + (!('args' in obj) || Array.isArray(obj.args) && obj.args.every(arg => typeof arg === 'string')) && + (!('env' in obj) || !!obj.env && typeof obj.env === 'object' && Object.values(obj.env).every(value => typeof value === 'string')) && + (!('autostart' in obj) || typeof obj.autostart === 'boolean') && + (!('serverUrl' in obj) || typeof obj.serverUrl === 'string') && + (!('serverAuthToken' in obj) || typeof obj.serverAuthToken === 'string') && + (!('serverAuthTokenHeader' in obj) || typeof obj.serverAuthTokenHeader === 'string') && + (!('headers' in obj) || !!obj.headers && typeof obj.headers === 'object' && Object.values(obj.headers).every(value => typeof value === 'string')); + } +} + +function filterValidValues(servers: unknown): MCPServersPreference { + const result: MCPServersPreference = {}; + if (!servers || typeof servers !== 'object') { + return result; + } + for (const [name, value] of Object.entries(servers)) { + if (typeof name === 'string' && MCPServersPreference.isValue(value)) { + result[name] = value; + } + } + return result; +} + +@injectable() +export class McpFrontendApplicationContribution implements FrontendApplicationContribution, WorkspaceRestrictionContribution { + + @inject(PreferenceService) + protected preferenceService: PreferenceService; + + @inject(MCPServerManager) + protected manager: MCPServerManager; + + @inject(MCPFrontendService) + protected frontendMCPService: MCPFrontendService; + + @inject(WorkspaceTrustService) + protected workspaceTrustService: WorkspaceTrustService; + + protected prevServers: Map = new Map(); + + protected blockedUntrustedServers: Set = new Set(); + + onStart(): void { + this.preferenceService.ready.then(async () => { + const servers = filterValidValues(this.preferenceService.get( + MCP_SERVERS_PREF, + {} + )); + this.prevServers = this.convertToMap(servers); + this.syncServers(this.prevServers); + await this.autoStartServers(this.prevServers); + + this.preferenceService.onPreferenceChanged(event => { + if (event.preferenceName === MCP_SERVERS_PREF) { + this.handleServerChanges(filterValidValues(this.preferenceService.get(MCP_SERVERS_PREF, {}))); + } + }); + + this.workspaceTrustService.onDidChangeWorkspaceTrust(async trusted => { + try { + if (trusted) { + await this.startPreviouslyBlockedServers(); + } else { + await this.stopAllServers(); + } + } catch (error) { + console.error('Failed to handle workspace trust change for MCP servers', error); + } + }); + }); + this.frontendMCPService.registerToolsForAllStartedServers(); + } + + protected async startPreviouslyBlockedServers(): Promise { + if (this.blockedUntrustedServers.size === 0) { + return; + } + const startedServers = await this.frontendMCPService.getStartedServers(); + for (const name of this.blockedUntrustedServers) { + const serverDesc = this.prevServers.get(name); + if (serverDesc && serverDesc.autostart && !startedServers.includes(name)) { + await this.frontendMCPService.startServer(name); + } + } + this.blockedUntrustedServers.clear(); + this.updateBlockedServersStatusBar(); + } + + protected async stopAllServers(): Promise { + const startedServers = await this.frontendMCPService.getStartedServers(); + for (const name of startedServers) { + await this.frontendMCPService.stopServer(name); + const serverDesc = this.prevServers.get(name); + if (serverDesc?.autostart) { + this.blockedUntrustedServers.add(name); + } + } + this.updateBlockedServersStatusBar(); + } + + protected updateBlockedServersStatusBar(): void { + this.workspaceTrustService.refreshRestrictedModeIndicator(); + } + + getRestrictions(): WorkspaceRestriction[] { + if (this.blockedUntrustedServers.size === 0) { + return []; + } + return [{ + label: nls.localize('theia/ai-mcp/blockedServersLabel', 'MCP Servers (autostart blocked)'), + details: Array.from(this.blockedUntrustedServers) + }]; + } + + protected async autoStartServers(servers: Map): Promise { + const startedServers = await this.frontendMCPService.getStartedServers(); + + const isTrusted = await this.workspaceTrustService.getWorkspaceTrust(); + + for (const [name, serverDesc] of servers) { + if (serverDesc && serverDesc.autostart) { + if (!startedServers.includes(name)) { + // Block MCP autostart in untrusted workspaces to prevent interaction with malicious content. + if (!isTrusted) { + this.blockedUntrustedServers.add(name); + continue; + } + await this.frontendMCPService.startServer(name); + } + } + } + + this.updateBlockedServersStatusBar(); + } + + protected handleServerChanges(newServers: MCPServersPreference): void { + const oldServers = this.prevServers; + const updatedServers = this.convertToMap(newServers); + + for (const [name] of oldServers) { + if (!updatedServers.has(name)) { + this.manager.removeServer(name); + this.blockedUntrustedServers.delete(name); + } + } + + for (const [name, description] of updatedServers) { + const oldDescription = oldServers.get(name); + let diff = false; + try { + // We know that that the descriptions are actual JSONObjects as we construct them ourselves + if (!oldDescription || !PreferenceUtils.deepEqual(oldDescription as unknown as JSONObject, description as unknown as JSONObject)) { + diff = true; + } + } catch (e) { + // In some cases the deepEqual function throws an error, so we fall back to assuming that there is a difference + // This seems to happen in cases where the objects are structured differently, e.g. whole sub-objects are missing + console.debug('Failed to compare MCP server descriptions, assuming a difference', e); + diff = true; + } + if (diff) { + this.manager.addOrUpdateServer(description); + } + } + + this.prevServers = updatedServers; + this.autoStartServers(updatedServers).catch(error => { + console.error('Failed to auto-start MCP servers after preference change', error); + }); + } + + protected syncServers(servers: Map): void { + + for (const [, description] of servers) { + this.manager.addOrUpdateServer(description); + } + + for (const [name] of this.prevServers) { + if (!servers.has(name)) { + this.manager.removeServer(name); + } + } + } + + protected convertToMap(servers: MCPServersPreference): Map { + const map = new Map(); + Object.entries(servers).forEach(([name, description]) => { + let filteredDescription: MCPServerDescription; + + if ('serverUrl' in description) { + // Create RemoteMCPServerDescription by picking only remote-specific properties + const { serverUrl, serverAuthToken, serverAuthTokenHeader, headers, autostart } = description; + filteredDescription = { + name, + serverUrl, + ...(serverAuthToken && { serverAuthToken }), + ...(serverAuthTokenHeader && { serverAuthTokenHeader }), + ...(headers && { headers }), + autostart: autostart ?? true, + }; + } else { + // Create LocalMCPServerDescription by picking only local-specific properties + const { command, args, env, autostart } = description; + filteredDescription = { + name, + command, + ...(args && { args }), + ...(env && { env }), + autostart: autostart ?? true, + }; + } + + map.set(name, filteredDescription); + }); + return map; + } +} diff --git a/packages/ai-mcp.disabled/src/browser/mcp-frontend-module.ts b/packages/ai-mcp.disabled/src/browser/mcp-frontend-module.ts new file mode 100644 index 0000000..1cfb885 --- /dev/null +++ b/packages/ai-mcp.disabled/src/browser/mcp-frontend-module.ts @@ -0,0 +1,93 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { ContainerModule } from '@theia/core/shared/inversify'; +import { FrontendApplicationContribution, RemoteConnectionProvider, ServiceConnectionProvider } from '@theia/core/lib/browser'; +import { + MCPFrontendService, + MCPServerManager, + MCPServerManagerPath, + MCPFrontendNotificationService +} from '../common/mcp-server-manager'; +import { McpFrontendApplicationContribution } from './mcp-frontend-application-contribution'; +import { MCPFrontendServiceImpl } from './mcp-frontend-service'; +import { MCPFrontendNotificationServiceImpl } from './mcp-frontend-notification-service'; +import { MCPServerManagerServerClientImpl } from './mcp-server-manager-server-client'; +import { MCPServerManagerServer, MCPServerManagerServerClient, MCPServerManagerServerPath } from '../common/mcp-protocol'; +import { WorkspaceRestrictionContribution } from '@theia/workspace/lib/browser/workspace-trust-service'; + +export default new ContainerModule(bind => { + bind(McpFrontendApplicationContribution).toSelf().inSingletonScope(); + bind(FrontendApplicationContribution).toService(McpFrontendApplicationContribution); + bind(WorkspaceRestrictionContribution).toService(McpFrontendApplicationContribution); + bind(MCPFrontendService).to(MCPFrontendServiceImpl).inSingletonScope(); + bind(MCPFrontendNotificationService).to(MCPFrontendNotificationServiceImpl).inSingletonScope(); + bind(MCPServerManagerServerClient).to(MCPServerManagerServerClientImpl).inSingletonScope(); + + bind(MCPServerManagerServer).toDynamicValue(ctx => { + const connection = ctx.container.get(RemoteConnectionProvider); + const client = ctx.container.get(MCPServerManagerServerClient); + return connection.createProxy(MCPServerManagerServerPath, client); + }).inSingletonScope(); + + bind(MCPServerManager).toDynamicValue(ctx => { + const mgrServer = ctx.container.get(MCPServerManagerServer); + const connection = ctx.container.get(RemoteConnectionProvider); + const client = ctx.container.get(MCPFrontendNotificationService); + const serverClient = ctx.container.get(MCPServerManagerServerClient); + const backendServerManager = connection.createProxy(MCPServerManagerPath, client); + + // Listen to server updates to clean up removed servers + client.onDidUpdateMCPServers(() => + backendServerManager.getServerNames() + .then(names => serverClient.cleanServers(names)) + .catch((error: unknown) => { + console.error('Error cleaning server descriptions:', error); + })); + + // We proxy the MCPServerManager to override addOrUpdateServer and getServerDescription + // to handle the resolve functions via the MCPServerManagerServerClient. + return new Proxy(backendServerManager, { + get(target: MCPServerManager, prop: PropertyKey, receiver: unknown): unknown { + // override addOrUpdateServer to store the original description in the MCPServerManagerServerClient + // to be used in resolveServerDescription if a resolve function is provided + if (prop === 'addOrUpdateServer') { + return async function (this: MCPServerManager, ...args: [serverDescription: Parameters[0]]): Promise { + const updated = serverClient.addServerDescription(args[0]); + await mgrServer.addOrUpdateServer(updated); + }; + } + // override getServerDescription to mix in the resolve function from the client + if (prop === 'getServerDescription') { + return async function (this: MCPServerManager, name: string): ReturnType { + const description = await Reflect.apply(target.getServerDescription, target, [name]); + if (description) { + const resolveFunction = serverClient.getResolveFunction(name); + if (resolveFunction) { + return { + ...description, + resolve: resolveFunction + }; + } + } + return description; + }; + } + return Reflect.get(target, prop, receiver); + } + }); + }).inSingletonScope(); +}); diff --git a/packages/ai-mcp.disabled/src/browser/mcp-frontend-notification-service.ts b/packages/ai-mcp.disabled/src/browser/mcp-frontend-notification-service.ts new file mode 100644 index 0000000..646ae0b --- /dev/null +++ b/packages/ai-mcp.disabled/src/browser/mcp-frontend-notification-service.ts @@ -0,0 +1,29 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { injectable } from '@theia/core/shared/inversify'; +import { MCPFrontendNotificationService } from '../common'; +import { Emitter, Event } from '@theia/core/lib/common/event'; + +@injectable() +export class MCPFrontendNotificationServiceImpl implements MCPFrontendNotificationService { + protected readonly onDidUpdateMCPServersEmitter = new Emitter(); + public readonly onDidUpdateMCPServers: Event = this.onDidUpdateMCPServersEmitter.event; + + didUpdateMCPServers(): void { + this.onDidUpdateMCPServersEmitter.fire(); + } +} diff --git a/packages/ai-mcp.disabled/src/browser/mcp-frontend-service.ts b/packages/ai-mcp.disabled/src/browser/mcp-frontend-service.ts new file mode 100644 index 0000000..8bcca2f --- /dev/null +++ b/packages/ai-mcp.disabled/src/browser/mcp-frontend-service.ts @@ -0,0 +1,157 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** +import { injectable, inject } from '@theia/core/shared/inversify'; +import { MCPFrontendService, MCPServerDescription, MCPServerManager } from '../common/mcp-server-manager'; +import { ToolInvocationRegistry, ToolRequest, PromptService, ToolCallContent, ToolCallContentResult } from '@theia/ai-core'; +import { ListToolsResult, TextContent } from '@modelcontextprotocol/sdk/types'; + +@injectable() +export class MCPFrontendServiceImpl implements MCPFrontendService { + + @inject(MCPServerManager) + protected readonly mcpServerManager: MCPServerManager; + + @inject(ToolInvocationRegistry) + protected readonly toolInvocationRegistry: ToolInvocationRegistry; + + @inject(PromptService) + protected readonly promptService: PromptService; + + async startServer(serverName: string): Promise { + await this.mcpServerManager.startServer(serverName); + await this.registerTools(serverName); + } + + async hasServer(serverName: string): Promise { + const serverNames = await this.getServerNames(); + return serverNames.includes(serverName); + } + + async isServerStarted(serverName: string): Promise { + const startedServers = await this.getStartedServers(); + return startedServers.includes(serverName); + } + + async registerToolsForAllStartedServers(): Promise { + const startedServers = await this.getStartedServers(); + for (const serverName of startedServers) { + await this.registerTools(serverName); + } + } + + async registerTools(serverName: string): Promise { + const returnedTools = await this.getTools(serverName); + if (returnedTools) { + const toolRequests: ToolRequest[] = returnedTools.tools.map(tool => this.convertToToolRequest(tool, serverName)); + toolRequests.forEach(toolRequest => + this.toolInvocationRegistry.registerTool(toolRequest) + ); + + this.createPromptTemplate(serverName, toolRequests); + } + } + + getPromptTemplateId(serverName: string): string { + return `mcp_${serverName}_tools`; + } + + protected createPromptTemplate(serverName: string, toolRequests: ToolRequest[]): void { + const templateId = this.getPromptTemplateId(serverName); + const functionIds = toolRequests.map(tool => `~{${tool.id}}`); + const template = functionIds.join('\n'); + + this.promptService.addBuiltInPromptFragment({ + id: templateId, + template + }); + } + + async stopServer(serverName: string): Promise { + this.toolInvocationRegistry.unregisterAllTools(`mcp_${serverName}`); + this.promptService.removePromptFragment(this.getPromptTemplateId(serverName)); + await this.mcpServerManager.stopServer(serverName); + } + + getStartedServers(): Promise { + return this.mcpServerManager.getRunningServers(); + } + + getServerNames(): Promise { + return this.mcpServerManager.getServerNames(); + } + + async getServerDescription(name: string): Promise { + return this.mcpServerManager.getServerDescription(name); + } + + async getTools(serverName: string): Promise { + try { + return await this.mcpServerManager.getTools(serverName); + } catch (error) { + console.error('Error while trying to get tools: ' + error); + return undefined; + } + } + + async addOrUpdateServer(description: MCPServerDescription): Promise { + return this.mcpServerManager.addOrUpdateServer(description); + } + + private convertToToolRequest(tool: Awaited>['tools'][number], serverName: string): ToolRequest { + const id = `mcp_${serverName}_${tool.name}`; + return { + id: id, + name: id, + providerName: `mcp_${serverName}`, + parameters: ToolRequest.isToolRequestParameters(tool.inputSchema) ? { + type: tool.inputSchema.type, + properties: tool.inputSchema.properties, + required: tool.inputSchema.required + } : { + type: 'object', + properties: {} + }, + description: tool.description, + handler: async (arg_string: string): Promise => { + try { + const result = await this.mcpServerManager.callTool(serverName, tool.name, arg_string); + if (result.isError) { + const textContent = result.content.find(callContent => callContent.type === 'text') as TextContent | undefined; + return { content: [{ type: 'error', data: textContent?.text ?? 'Unknown Error' }] }; + } + const content = result.content.map(callContent => { + switch (callContent.type) { + case 'image': + return { type: 'image', base64data: callContent.data, mimeType: callContent.mimeType }; + case 'text': + return { type: 'text', text: callContent.text }; + case 'resource': { + return { type: 'text', text: JSON.stringify(callContent.resource) }; + } + default: { + return { type: 'text', text: JSON.stringify(callContent) }; + } + } + }); + return { content }; + } catch (error) { + console.error(`Error in tool handler for ${tool.name} on MCP server ${serverName}:`, error); + throw error; + } + }, + }; + } +} diff --git a/packages/ai-mcp.disabled/src/browser/mcp-server-manager-server-client.ts b/packages/ai-mcp.disabled/src/browser/mcp-server-manager-server-client.ts new file mode 100644 index 0000000..e71f7a0 --- /dev/null +++ b/packages/ai-mcp.disabled/src/browser/mcp-server-manager-server-client.ts @@ -0,0 +1,82 @@ +// ***************************************************************************** +// Copyright (C) 2025 Dirk Fauth and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { injectable } from '@theia/core/shared/inversify'; +import { MCPServerDescription } from '../common'; +import { generateUuid } from '@theia/core/lib/common/uuid'; +import { cleanServerDescription, MCPServerDescriptionRCP, MCPServerManagerServerClient } from '../common/mcp-protocol'; + +type StoredServerInfo = Pick; + +@injectable() +export class MCPServerManagerServerClientImpl implements MCPServerManagerServerClient { + + protected serverDescriptions: Map = new Map(); + + addServerDescription(description: MCPServerDescription): MCPServerDescriptionRCP { + if (description.resolve) { + const serverDescription: MCPServerDescriptionRCP = { + ...description, + resolveId: generateUuid(), + }; + + // store only the name and resolve function + if (serverDescription.resolveId) { + this.serverDescriptions.set(serverDescription.resolveId, { + name: description.name, + resolve: description.resolve + }); + } + + return serverDescription; + } + return description; + } + + getResolveFunction(name: string): MCPServerDescription['resolve'] { + for (const storedInfo of this.serverDescriptions.values()) { + if (storedInfo.name === name) { + return storedInfo.resolve; + } + } + return undefined; + } + + async resolveServerDescription(description: MCPServerDescriptionRCP): Promise { + const cleanDescription = cleanServerDescription(description); + if (description.resolveId) { + const storedInfo = this.serverDescriptions.get(description.resolveId); + if (storedInfo?.resolve) { + const updated = await storedInfo.resolve(cleanDescription); + if (updated) { + return updated; + } + } + } + return cleanDescription; + } + + cleanServers(serverNames: string[]): void { + const currentNamesSet = new Set(serverNames); + // Remove descriptions for servers that no longer exist + for (const [resolveId, storedInfo] of this.serverDescriptions.entries()) { + if (storedInfo.name && !currentNamesSet.has(storedInfo.name)) { + console.debug('Removing a frontend stored resolve function because the corresponding MCP server was removed', storedInfo); + this.serverDescriptions.delete(resolveId); + } + } + } +} diff --git a/packages/ai-mcp.disabled/src/common/index.ts b/packages/ai-mcp.disabled/src/common/index.ts new file mode 100644 index 0000000..a282b9a --- /dev/null +++ b/packages/ai-mcp.disabled/src/common/index.ts @@ -0,0 +1,16 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** +export * from './mcp-server-manager'; diff --git a/packages/ai-mcp.disabled/src/common/mcp-preferences.ts b/packages/ai-mcp.disabled/src/common/mcp-preferences.ts new file mode 100644 index 0000000..046c9bf --- /dev/null +++ b/packages/ai-mcp.disabled/src/common/mcp-preferences.ts @@ -0,0 +1,117 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { nls, PreferenceSchema } from '@theia/core'; + +export const MCP_SERVERS_PREF = 'ai-features.mcp.mcpServers'; + +export const McpServersPreferenceSchema: PreferenceSchema = { + properties: { + [MCP_SERVERS_PREF]: { + type: 'object', + title: nls.localize('theia/ai/mcp/servers/title', 'MCP Server Configuration'), + markdownDescription: nls.localize('theia/ai/mcp/servers/mdDescription', 'Configure MCP servers either local with command, \ +arguments and optionally environment variables, \ +or remote with server URL, authentication token and optionally an authentication header name. Additionally it is possible to configure autostart (true by default). \ +Each server is identified by a unique key, such as "brave-search" or "filesystem". \ +To start a server, use the "MCP: Start MCP Server" command, which enables you to select the desired server. \ +To stop a server, use the "MCP: Stop MCP Server" command. \ +Please note that autostart will only take effect after a restart, you need to start a server manually for the first time.\ +\n\ +Example configuration:\n\ +```\ +{\n\ + "brave-search": {\n\ + "command": "npx",\n\ + "args": [\n\ + "-y",\n\ + "@modelcontextprotocol/server-brave-search"\n\ + ],\n\ + "env": {\n\ + "BRAVE_API_KEY": "YOUR_API_KEY"\n\ + },\n\ + },\n\ + "filesystem": {\n\ + "command": "npx",\n\ + "args": ["-y", "@modelcontextprotocol/server-filesystem", "/Users/YOUR_USERNAME/Desktop"],\n\ + "env": {\n\ + "CUSTOM_ENV_VAR": "custom-value"\n\ + },\n\ + "autostart": false\n\ + },\n\ + "jira": {\n\ + "serverUrl": "YOUR_JIRA_MCP_SERVER_URL",\n\ + "serverAuthToken": "YOUR_JIRA_MCP_SERVER_TOKEN"\n\ + }\n\ +}\n```'), + additionalProperties: { + type: 'object', + properties: { + command: { + type: 'string', + title: nls.localize('theia/ai/mcp/servers/command/title', 'Command to execute the MCP server'), + markdownDescription: nls.localize('theia/ai/mcp/servers/command/mdDescription', 'The command used to start the MCP server, e.g., "uvx" or "npx".') + }, + args: { + type: 'array', + title: nls.localize('theia/ai/mcp/servers/args/title', 'Arguments for the command'), + markdownDescription: nls.localize('theia/ai/mcp/servers/args/mdDescription', 'An array of arguments to pass to the command.'), + }, + env: { + type: 'object', + title: nls.localize('theia/ai/mcp/servers/env/title', 'Environment variables'), + markdownDescription: nls.localize('theia/ai/mcp/servers/env/mdDescription', 'Optional environment variables to set for the server, such as an API key.'), + additionalProperties: { + type: 'string' + } + }, + autostart: { + type: 'boolean', + title: nls.localize('theia/ai/mcp/servers/autostart/title', 'Autostart'), + markdownDescription: nls.localize('theia/ai/mcp/servers/autostart/mdDescription', + 'Automatically start this server when the frontend starts. Newly added servers are not immediately auto started, but on restart'), + default: true + }, + serverUrl: { + type: 'string', + title: nls.localize('theia/ai/mcp/servers/serverUrl/title', 'Server URL'), + markdownDescription: nls.localize('theia/ai/mcp/servers/serverUrl/mdDescription', + 'The URL of the remote MCP server. If provided, the server will connect to this URL instead of starting a local process.'), + }, + serverAuthToken: { + type: 'string', + title: nls.localize('theia/ai/mcp/servers/serverAuthToken/title', 'Authentication Token'), + markdownDescription: nls.localize('theia/ai/mcp/servers/serverAuthToken/mdDescription', + 'The authentication token for the server, if required. This is used to authenticate with the remote server.'), + }, + serverAuthTokenHeader: { + type: 'string', + title: nls.localize('theia/ai/mcp/servers/serverAuthTokenHeader/title', 'Authentication Header Name'), + markdownDescription: nls.localize('theia/ai/mcp/servers/serverAuthTokenHeader/mdDescription', + 'The header name to use for the server authentication token. If not provided, "Authorization" with "Bearer" will be used.'), + }, + headers: { + type: 'object', + title: nls.localize('theia/ai/mcp/servers/headers/title', 'Headers'), + markdownDescription: nls.localize('theia/ai/mcp/servers/headers/mdDescription', + 'Optional additional headers included with each request to the server.'), + } + }, + required: [] + } + } + } +}; diff --git a/packages/ai-mcp.disabled/src/common/mcp-protocol.ts b/packages/ai-mcp.disabled/src/common/mcp-protocol.ts new file mode 100644 index 0000000..313620b --- /dev/null +++ b/packages/ai-mcp.disabled/src/common/mcp-protocol.ts @@ -0,0 +1,75 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { MCPServerDescription } from './mcp-server-manager'; + +/** + * MCPServerDescriptionRCP is a version of MCPServerDescription that can be sent over RCP. + * It omits the 'resolve' function and instead includes an optional 'resolveId' to identify + * the resolve function on the client side. + */ +export type MCPServerDescriptionRCP = Omit & { + resolveId?: string; +}; + +export const MCPServerManagerServer = Symbol('MCPServerManagerServer'); +export const MCPServerManagerServerPath = '/services/mcpservermanagerserver'; + +/** + * The MCPServerManagerServer handles the RCP specialties of adding server descriptions from the frontend + */ +export interface MCPServerManagerServer { + addOrUpdateServer(description: MCPServerDescriptionRCP): Promise; + setClient(client: MCPServerManagerServerClient): void +} + +export const MCPServerManagerServerClient = Symbol('MCPServerManagerServerClient'); +export interface MCPServerManagerServerClient { + /** + * Adds a server description to the client. If the description contains a resolve function, + * a unique resolveId is generated and only the name and resolve function are stored. + * @param description The server description to add. + * @returns The server description with a unique resolveId if a resolve function is provided + * or the given description if no resolve function is provided. + */ + addServerDescription(description: MCPServerDescription): MCPServerDescriptionRCP; + /** + * Retrieves the resolve function for a given server name. + * @param name The name of the server to retrieve the resolve function for. + * @returns The resolve function if found, or undefined if not found. + */ + getResolveFunction(name: string): MCPServerDescription['resolve']; + /** + * Resolves the server description by calling the resolve function if it exists. + * @param description The server description to resolve. + * @returns The resolved server description. + */ + resolveServerDescription(description: MCPServerDescriptionRCP): Promise; + /** + * Removes server descriptions that are no longer present in the MCPServerManager. + * + * @param serverNames The current list of server names from the MCPServerManager. + */ + cleanServers(serverNames: string[]): void; +} + +/** + * Util function to convert a MCPServerDescriptionRCP to a MCPServerDescription by removing the resolveId. + */ +export const cleanServerDescription = (description: MCPServerDescriptionRCP): MCPServerDescription => { + const { resolveId, ...descriptionProperties } = description; + return { ...descriptionProperties } as MCPServerDescription; +}; diff --git a/packages/ai-mcp.disabled/src/common/mcp-server-manager.ts b/packages/ai-mcp.disabled/src/common/mcp-server-manager.ts new file mode 100644 index 0000000..2022d07 --- /dev/null +++ b/packages/ai-mcp.disabled/src/common/mcp-server-manager.ts @@ -0,0 +1,167 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import type { CallToolResult, ListResourcesResult, ListToolsResult, ReadResourceResult } from '@modelcontextprotocol/sdk/types'; +import { Event } from '@theia/core/lib/common/event'; + +export const MCPFrontendService = Symbol('MCPFrontendService'); +export interface MCPFrontendService { + startServer(serverName: string): Promise; + hasServer(serverName: string): Promise; + isServerStarted(serverName: string): Promise; + registerToolsForAllStartedServers(): Promise; + stopServer(serverName: string): Promise; + addOrUpdateServer(description: MCPServerDescription): Promise; + getStartedServers(): Promise; + getServerNames(): Promise; + getServerDescription(name: string): Promise; + getTools(serverName: string): Promise; + getPromptTemplateId(serverName: string): string; +} + +export const MCPFrontendNotificationService = Symbol('MCPFrontendNotificationService'); +export interface MCPFrontendNotificationService { + readonly onDidUpdateMCPServers: Event; + didUpdateMCPServers(): void; +} + +export interface MCPServer { + callTool(toolName: string, arg_string: string): Promise; + getTools(): Promise; + readResource(resourceId: string): Promise; + getResources(): Promise; + description: MCPServerDescription; +} + +export interface MCPServerManager { + callTool(serverName: string, toolName: string, arg_string: string): Promise; + removeServer(name: string): void; + addOrUpdateServer(description: MCPServerDescription): void; + getTools(serverName: string): Promise; + getServerNames(): Promise; + getServerDescription(name: string): Promise; + startServer(serverName: string): Promise; + stopServer(serverName: string): Promise; + getRunningServers(): Promise; + setClient(client: MCPFrontendNotificationService): void; + disconnectClient(client: MCPFrontendNotificationService): void; + readResource(serverName: string, resourceId: string): Promise; + getResources(serverName: string): Promise; +} + +export interface ToolInformation { + name: string; + description?: string; +} + +export enum MCPServerStatus { + NotRunning = 'Not Running', + NotConnected = 'Not Connected', + Starting = 'Starting', + Connecting = 'Connecting', + Running = 'Running', + Connected = 'Connected', + Errored = 'Errored' +} + +export interface BaseMCPServerDescription { + /** + * The unique name of the MCP server. + */ + name: string; + + /** + * Flag indicating whether the server should automatically start when the application starts. + */ + autostart?: boolean; + + /** + * The current status of the server. Optional because only set by the server. + */ + status?: MCPServerStatus; + + /** + * Last error message that the server has returned. + */ + error?: string; + + /** + * List of available tools for the server. Returns the name and description if available. + */ + tools?: ToolInformation[]; + + /** + * Optional resolve function that gets called during server definition resolution. + * This function can be used to dynamically modify server configurations, + * resolve environment variables, validate configurations, or perform any + * necessary preprocessing before the server starts. + * + * @param description The current server description + * @returns A promise that resolves to the processed server description + */ + resolve?: (description: MCPServerDescription) => Promise; +} + +export interface LocalMCPServerDescription extends BaseMCPServerDescription { + /** + * The command to execute the MCP server. + */ + command: string; + + /** + * An array of arguments to pass to the command. + */ + args?: string[]; + + /** + * Optional environment variables to set when starting the server. + */ + env?: { [key: string]: string }; +} + +export interface RemoteMCPServerDescription extends BaseMCPServerDescription { + /** + * The URL of the remote MCP server. + */ + serverUrl: string; + + /** + * The authentication token for the server, if required. + */ + serverAuthToken?: string; + + /** + * The header name to use for the server authentication token. + */ + serverAuthTokenHeader?: string; + + /** + * Optional additional headers to include in requests to the server. + */ + headers?: Record; +} + +export type MCPServerDescription = LocalMCPServerDescription | RemoteMCPServerDescription; + +export function isLocalMCPServerDescription(description: MCPServerDescription): description is LocalMCPServerDescription { + return (description as LocalMCPServerDescription).command !== undefined; +} +export function isRemoteMCPServerDescription(description: MCPServerDescription): description is RemoteMCPServerDescription { + return (description as RemoteMCPServerDescription).serverUrl !== undefined; +} + +export const MCPServerManager = Symbol('MCPServerManager'); +export const MCPServerManagerPath = '/services/mcpservermanager'; diff --git a/packages/ai-mcp.disabled/src/node/mcp-backend-module.ts b/packages/ai-mcp.disabled/src/node/mcp-backend-module.ts new file mode 100644 index 0000000..fde81db --- /dev/null +++ b/packages/ai-mcp.disabled/src/node/mcp-backend-module.ts @@ -0,0 +1,54 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { ContainerModule } from '@theia/core/shared/inversify'; +import { ConnectionHandler, PreferenceContribution, RpcConnectionHandler } from '@theia/core'; +import { MCPServerManagerImpl } from './mcp-server-manager-impl'; +import { + MCPFrontendNotificationService, + MCPServerManager, + MCPServerManagerPath +} from '../common/mcp-server-manager'; +import { ConnectionContainerModule } from '@theia/core/lib/node/messaging/connection-container-module'; +import { McpServersPreferenceSchema } from '../common/mcp-preferences'; +import { MCPServerManagerServerImpl } from './mcp-server-manager-server'; +import { MCPServerManagerServer, MCPServerManagerServerClient, MCPServerManagerServerPath } from '../common/mcp-protocol'; + +// We use a connection module to handle AI services separately for each frontend. +const mcpConnectionModule = ConnectionContainerModule.create(({ bind, bindBackendService, bindFrontendService }) => { + bind(MCPServerManager).to(MCPServerManagerImpl).inSingletonScope(); + bind(ConnectionHandler).toDynamicValue(ctx => new RpcConnectionHandler( + MCPServerManagerPath, client => { + const server = ctx.container.get(MCPServerManager); + server.setClient(client); + client.onDidCloseConnection(() => server.disconnectClient(client)); + return server; + } + )).inSingletonScope(); + bind(MCPServerManagerServer).to(MCPServerManagerServerImpl).inSingletonScope(); + bind(ConnectionHandler).toDynamicValue(ctx => new RpcConnectionHandler( + MCPServerManagerServerPath, client => { + const server = ctx.container.get(MCPServerManagerServer); + server.setClient(client); + return server; + } + )).inSingletonScope(); +}); + +export default new ContainerModule(bind => { + bind(PreferenceContribution).toConstantValue({ schema: McpServersPreferenceSchema }); + bind(ConnectionContainerModule).toConstantValue(mcpConnectionModule); +}); diff --git a/packages/ai-mcp.disabled/src/node/mcp-server-manager-impl.ts b/packages/ai-mcp.disabled/src/node/mcp-server-manager-impl.ts new file mode 100644 index 0000000..ee0f12d --- /dev/null +++ b/packages/ai-mcp.disabled/src/node/mcp-server-manager-impl.ts @@ -0,0 +1,162 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** +import { injectable } from '@theia/core/shared/inversify'; +import { MCPServerDescription, MCPServerManager, MCPFrontendNotificationService } from '../common/mcp-server-manager'; +import { MCPServer } from './mcp-server'; +import { Disposable } from '@theia/core/lib/common/disposable'; +import { CallToolResult, ListResourcesResult, ReadResourceResult } from '@modelcontextprotocol/sdk/types.js'; + +@injectable() +export class MCPServerManagerImpl implements MCPServerManager { + + protected servers: Map = new Map(); + protected clients: Array = []; + protected serverListeners: Map = new Map(); + + async stopServer(serverName: string): Promise { + const server = this.servers.get(serverName); + if (!server) { + throw new Error(`MCP server "${serverName}" not found.`); + } + await server.stop(); + console.log(`MCP server "${serverName}" stopped.`); + this.notifyClients(); + } + + async getRunningServers(): Promise { + const runningServers: string[] = []; + for (const [name, server] of this.servers.entries()) { + if (server.isRunning()) { + runningServers.push(name); + } + } + return runningServers; + } + + callTool(serverName: string, toolName: string, arg_string: string): Promise { + const server = this.servers.get(serverName); + if (!server) { + throw new Error(`MCP server "${toolName}" not found.`); + } + return server.callTool(toolName, arg_string); + } + + async startServer(serverName: string): Promise { + const server = this.servers.get(serverName); + if (!server) { + throw new Error(`MCP server "${serverName}" not found.`); + } + const description = await server.getDescription(); + if (description.resolve) { + const resolved = await description.resolve(description); + const isEqual = JSON.stringify(description) === JSON.stringify(resolved); + if (!isEqual) { + server.update(resolved); + } + } + await server.start(); + this.notifyClients(); + } + + async getServerNames(): Promise { + return Array.from(this.servers.keys()); + } + + async getServerDescription(name: string): Promise { + const server = this.servers.get(name); + return server ? await server.getDescription() : undefined; + } + + public async getTools(serverName: string): ReturnType { + const server = this.servers.get(serverName); + if (!server) { + throw new Error(`MCP server "${serverName}" not found.`); + } + return await server.getTools(); + } + + addOrUpdateServer(description: MCPServerDescription): void { + const existingServer = this.servers.get(description.name); + + if (existingServer) { + existingServer.update(description); + } else { + const newServer = new MCPServer(description); + this.servers.set(description.name, newServer); + + // Subscribe to status updates from the new server + const listener = newServer.onDidUpdateStatus(() => { + this.notifyClients(); + }); + + // Store the listener for later disposal + this.serverListeners.set(description.name, listener); + } + this.notifyClients(); + } + + removeServer(name: string): void { + const server = this.servers.get(name); + if (server) { + server.stop(); + this.servers.delete(name); + + // Clean up the status listener + const listener = this.serverListeners.get(name); + if (listener) { + listener.dispose(); + this.serverListeners.delete(name); + } + } else { + console.warn(`MCP server "${name}" not found.`); + } + this.notifyClients(); + } + + setClient(client: MCPFrontendNotificationService): void { + this.clients.push(client); + } + + disconnectClient(client: MCPFrontendNotificationService): void { + const index = this.clients.indexOf(client); + if (index !== -1) { + this.clients.splice(index, 1); + } + this.servers.forEach(server => { + server.stop(); + }); + } + + private notifyClients(): void { + this.clients.forEach(client => client.didUpdateMCPServers()); + } + + readResource(serverName: string, resourceId: string): Promise { + const server = this.servers.get(serverName); + if (!server) { + throw new Error(`MCP server "${serverName}" not found.`); + } + return server.readResource(resourceId); + } + + getResources(serverName: string): Promise { + const server = this.servers.get(serverName); + if (!server) { + throw new Error(`MCP server "${serverName}" not found.`); + } + return server.getResources(); + } +} diff --git a/packages/ai-mcp.disabled/src/node/mcp-server-manager-server.ts b/packages/ai-mcp.disabled/src/node/mcp-server-manager-server.ts new file mode 100644 index 0000000..d77a374 --- /dev/null +++ b/packages/ai-mcp.disabled/src/node/mcp-server-manager-server.ts @@ -0,0 +1,49 @@ +// ***************************************************************************** +// Copyright (C) 2025 Dirk Fauth and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { inject, injectable } from '@theia/core/shared/inversify'; +import { MCPServerDescription, MCPServerManager } from '../common'; +import { cleanServerDescription, MCPServerDescriptionRCP, MCPServerManagerServer, MCPServerManagerServerClient } from '../common/mcp-protocol'; + +@injectable() +export class MCPServerManagerServerImpl implements MCPServerManagerServer { + + @inject(MCPServerManager) + protected readonly mcpServerManager: MCPServerManager; + + protected client: MCPServerManagerServerClient; + + setClient(client: MCPServerManagerServerClient): void { + this.client = client; + } + + async addOrUpdateServer(descriptionRCP: MCPServerDescriptionRCP): Promise { + const description = cleanServerDescription(descriptionRCP); + if (descriptionRCP.resolveId) { + description.resolve = async (desc: MCPServerDescription) => { + if (this.client) { + const descRCP: MCPServerDescriptionRCP = { + ...desc, + resolveId: descriptionRCP.resolveId + }; + return this.client.resolveServerDescription(descRCP); + } + return desc; // Fallback if no client is set + }; + }; + this.mcpServerManager.addOrUpdateServer(description); + } +} diff --git a/packages/ai-mcp.disabled/src/node/mcp-server.ts b/packages/ai-mcp.disabled/src/node/mcp-server.ts new file mode 100644 index 0000000..d9021db --- /dev/null +++ b/packages/ai-mcp.disabled/src/node/mcp-server.ts @@ -0,0 +1,259 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** +import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js'; +import { SSEClientTransport } from '@modelcontextprotocol/sdk/client/sse.js'; +import { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp.js'; +import { Client } from '@modelcontextprotocol/sdk/client/index.js'; +import { isLocalMCPServerDescription, isRemoteMCPServerDescription, MCPServerDescription, MCPServerStatus, ToolInformation } from '../common'; +import { Emitter } from '@theia/core/lib/common/event.js'; +import { CallToolResult, CallToolResultSchema, ListResourcesResult, ReadResourceResult } from '@modelcontextprotocol/sdk/types.js'; +import { Transport } from '@modelcontextprotocol/sdk/shared/transport.js'; + +export class MCPServer { + private description: MCPServerDescription; + private transport: Transport; + private client: Client; + private error?: string; + private status: MCPServerStatus; + + private readonly onDidUpdateStatusEmitter = new Emitter(); + readonly onDidUpdateStatus = this.onDidUpdateStatusEmitter.event; + + constructor(description: MCPServerDescription) { + this.update(description); + } + + getStatus(): MCPServerStatus { + return this.status; + } + + setStatus(status: MCPServerStatus): void { + this.status = status; + this.onDidUpdateStatusEmitter.fire(status); + } + + isRunning(): boolean { + return this.status === MCPServerStatus.Running + || this.status === MCPServerStatus.Connected; + } + + isStopped(): boolean { + return this.status === MCPServerStatus.NotRunning + || this.status === MCPServerStatus.NotConnected; + } + + async getDescription(): Promise { + let toReturnTools: ToolInformation[] | undefined = undefined; + if (this.isRunning()) { + try { + const { tools } = await this.getTools(); + toReturnTools = tools.map(tool => ({ + name: tool.name, + description: tool.description + })); + } catch (error) { + console.error('Error fetching tools for description:', error); + } + } + + return { + ...this.description, + status: this.status, + error: this.error, + tools: toReturnTools + }; + } + + async start(): Promise { + if (this.isRunning() + || (this.status === MCPServerStatus.Starting || this.status === MCPServerStatus.Connecting)) { + return; + } + + let connected = false; + this.client = new Client( + { + name: 'theia-client', + version: '1.0.0', + }, + { + capabilities: {} + } + ); + this.error = undefined; + + if (isLocalMCPServerDescription(this.description)) { + this.setStatus(MCPServerStatus.Starting); + console.log( + `Starting server "${this.description.name}" with command: ${this.description.command} ` + + `and args: ${this.description.args?.join(' ')} and env: ${JSON.stringify(this.description.env)}` + ); + + // Filter process.env to exclude undefined values + const sanitizedEnv: Record = Object.fromEntries( + Object.entries(process.env).filter((entry): entry is [string, string] => entry[1] !== undefined) + ); + + const mergedEnv: Record = { + ...sanitizedEnv, + ...(this.description.env || {}) + }; + this.transport = new StdioClientTransport({ + command: this.description.command, + args: this.description.args, + env: mergedEnv, + }); + } else if (isRemoteMCPServerDescription(this.description)) { + this.setStatus(MCPServerStatus.Connecting); + console.log(`Connecting to server "${this.description.name}" via MCP Server Communication with URL: ${this.description.serverUrl}`); + + let descHeaders; + if (this.description.headers) { + descHeaders = this.description.headers; + } + + // create header for auth token + if (this.description.serverAuthToken) { + if (!descHeaders) { + descHeaders = {}; + } + + if (this.description.serverAuthTokenHeader) { + descHeaders = { ...descHeaders, [this.description.serverAuthTokenHeader]: this.description.serverAuthToken }; + } else { + descHeaders = { ...descHeaders, Authorization: `Bearer ${this.description.serverAuthToken}` }; + } + } + + if (descHeaders) { + this.transport = new StreamableHTTPClientTransport(new URL(this.description.serverUrl), { + requestInit: { headers: descHeaders }, + }); + } else { + this.transport = new StreamableHTTPClientTransport(new URL(this.description.serverUrl)); + } + + try { + await this.client.connect(this.transport); + connected = true; + console.log(`MCP Streamable HTTP successful connected: ${this.description.serverUrl}`); + } catch (e) { + console.log(`MCP SSE fallback initiated: ${this.description.serverUrl}`); + await this.client.close(); + if (descHeaders) { + this.transport = new SSEClientTransport(new URL(this.description.serverUrl), { + eventSourceInit: { + fetch: (url, init) => + fetch(url, { ...init, headers: descHeaders }), + }, + requestInit: { headers: descHeaders }, + }); + } else { + this.transport = new SSEClientTransport(new URL(this.description.serverUrl)); + } + } + } + + this.transport.onerror = error => { + if (this.isStopped()) { + return; + } + console.error('Error: ', error); + this.error = 'Error: ' + error; + this.setStatus(MCPServerStatus.Errored); + }; + + this.client.onerror = error => { + console.error('Error in MCP client: ', error); + this.error = 'Error in MCP client: ' + error; + this.setStatus(MCPServerStatus.Errored); + }; + + try { + if (!connected) { + await this.client.connect(this.transport); + } + this.setStatus(isLocalMCPServerDescription(this.description) ? MCPServerStatus.Running : MCPServerStatus.Connected); + } catch (e) { + this.error = 'Error on MCP startup: ' + e; + await this.client.close(); + this.setStatus(MCPServerStatus.Errored); + } + } + + async callTool(toolName: string, arg_string: string): Promise { + let args; + try { + args = JSON.parse(arg_string); + } catch (error) { + console.error( + `Failed to parse arguments for calling tool "${toolName}" in MCP server "${this.description.name}". + Invalid JSON: ${arg_string}`, + error + ); + } + const params = { + name: toolName, + arguments: args, + }; + // need to cast since other result schemas (second parameter) might be possible + return this.client.callTool(params, CallToolResultSchema) as Promise; + } + + async getTools(): ReturnType { + if (this.isRunning()) { + return this.client.listTools(); + } + return { tools: [] }; + } + + update(description: MCPServerDescription): void { + this.description = description; + + if (isRemoteMCPServerDescription(description)) { + this.status = MCPServerStatus.NotConnected; + } else { + this.status = MCPServerStatus.NotRunning; + } + } + + async stop(): Promise { + if (!this.isRunning() || !this.client) { + return; + } + if (isLocalMCPServerDescription(this.description)) { + console.log(`Stopping MCP server "${this.description.name}"`); + this.setStatus(MCPServerStatus.NotRunning); + } else { + console.log(`Disconnecting MCP server "${this.description.name}"`); + if (this.transport instanceof StreamableHTTPClientTransport) { + console.log(`Terminating session for MCP server "${this.description.name}"`); + await (this.transport as StreamableHTTPClientTransport).terminateSession(); + } + this.setStatus(MCPServerStatus.NotConnected); + } + await this.client.close(); + } + + readResource(resourceId: string): Promise { + const params = { uri: resourceId }; + return this.client.readResource(params); + } + + getResources(): Promise { + return this.client.listResources(); + } +} diff --git a/packages/ai-mcp.disabled/src/package.spec.ts b/packages/ai-mcp.disabled/src/package.spec.ts new file mode 100644 index 0000000..0285e71 --- /dev/null +++ b/packages/ai-mcp.disabled/src/package.spec.ts @@ -0,0 +1,28 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +/* note: this bogus test file is required so that + we are able to run mocha unit tests on this + package, without having any actual unit tests in it. + This way a coverage report will be generated, + showing 0% coverage, instead of no report. + This file can be removed once we have real unit + tests in place. */ + +describe('ai-mcp package', () => { + + it('support code coverage statistics', () => true); +}); diff --git a/packages/ai-mcp.disabled/tsconfig.json b/packages/ai-mcp.disabled/tsconfig.json new file mode 100644 index 0000000..5d005c8 --- /dev/null +++ b/packages/ai-mcp.disabled/tsconfig.json @@ -0,0 +1,22 @@ +{ + "extends": "../../configs/base.tsconfig", + "compilerOptions": { + "composite": true, + "rootDir": "src", + "outDir": "lib" + }, + "include": [ + "src" + ], + "references": [ + { + "path": "../ai-core" + }, + { + "path": "../core" + }, + { + "path": "../workspace" + } + ] +} diff --git a/packages/ai-ollama/.eslintrc.js b/packages/ai-ollama/.eslintrc.js new file mode 100644 index 0000000..1308994 --- /dev/null +++ b/packages/ai-ollama/.eslintrc.js @@ -0,0 +1,10 @@ +/** @type {import('eslint').Linter.Config} */ +module.exports = { + extends: [ + '../../configs/build.eslintrc.json' + ], + parserOptions: { + tsconfigRootDir: __dirname, + project: 'tsconfig.json' + } +}; diff --git a/packages/ai-ollama/README.md b/packages/ai-ollama/README.md new file mode 100644 index 0000000..581a4fe --- /dev/null +++ b/packages/ai-ollama/README.md @@ -0,0 +1,31 @@ +
    + +
    + +theia-ext-logo + +

    ECLIPSE THEIA - OLLAMA EXTENSION

    + +
    + +
    + +## Description + +The `@theia/ai-ollama` integrates Ollama's models with Theia AI. + +## Additional Information + +- [Theia - GitHub](https://github.com/eclipse-theia/theia) +- [Theia - Website](https://theia-ide.org/) + +## License + +- [API documentation for `@theia/ai-ollama`](https://eclipse-theia.github.io/theia/docs/next/modules/_theia_ai-ollama.html) +- [Eclipse Public License 2.0](http://www.eclipse.org/legal/epl-2.0/) +- [(Secondary) GNU General Public License, version 2 with the GNU Classpath Exception](https://projects.eclipse.org/license/secondary-gpl-2.0-cp) + +## Trademark + +"Theia" is a trademark of the Eclipse Foundation + diff --git a/packages/ai-ollama/package.json b/packages/ai-ollama/package.json new file mode 100644 index 0000000..49b3bfc --- /dev/null +++ b/packages/ai-ollama/package.json @@ -0,0 +1,53 @@ +{ + "name": "@theia/ai-ollama", + "version": "1.68.0", + "description": "Theia - Ollama Integration", + "dependencies": { + "@theia/ai-core": "1.68.0", + "@theia/core": "1.68.0", + "@theia/filesystem": "1.68.0", + "@theia/workspace": "1.68.0", + "ollama": "^0.5.16", + "tslib": "^2.6.2" + }, + "publishConfig": { + "access": "public" + }, + "theiaExtensions": [ + { + "frontend": "lib/browser/ollama-frontend-module", + "backend": "lib/node/ollama-backend-module" + } + ], + "keywords": [ + "theia-extension" + ], + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "repository": { + "type": "git", + "url": "https://github.com/eclipse-theia/theia.git" + }, + "bugs": { + "url": "https://github.com/eclipse-theia/theia/issues" + }, + "homepage": "https://github.com/eclipse-theia/theia", + "files": [ + "lib", + "src" + ], + "scripts": { + "build": "theiaext build", + "clean": "theiaext clean", + "compile": "theiaext compile", + "lint": "theiaext lint", + "test": "theiaext test", + "watch": "theiaext watch" + }, + "devDependencies": { + "@theia/ext-scripts": "1.68.0" + }, + "nyc": { + "extends": "../../configs/nyc.json" + }, + "gitHead": "21358137e41342742707f660b8e222f940a27652" +} diff --git a/packages/ai-ollama/src/browser/ollama-frontend-application-contribution.ts b/packages/ai-ollama/src/browser/ollama-frontend-application-contribution.ts new file mode 100644 index 0000000..041b962 --- /dev/null +++ b/packages/ai-ollama/src/browser/ollama-frontend-application-contribution.ts @@ -0,0 +1,74 @@ +// ***************************************************************************** +// Copyright (C) 2024 TypeFox GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { FrontendApplicationContribution } from '@theia/core/lib/browser'; +import { inject, injectable } from '@theia/core/shared/inversify'; +import { OllamaLanguageModelsManager, OllamaModelDescription } from '../common'; +import { HOST_PREF, MODELS_PREF } from '../common/ollama-preferences'; +import { PreferenceService } from '@theia/core'; + +const OLLAMA_PROVIDER_ID = 'ollama'; +@injectable() +export class OllamaFrontendApplicationContribution implements FrontendApplicationContribution { + + @inject(PreferenceService) + protected preferenceService: PreferenceService; + + @inject(OllamaLanguageModelsManager) + protected manager: OllamaLanguageModelsManager; + + protected prevModels: string[] = []; + + onStart(): void { + this.preferenceService.ready.then(() => { + const host = this.preferenceService.get(HOST_PREF); + this.manager.setHost(host || undefined); + + const models = this.preferenceService.get(MODELS_PREF, []); + this.manager.createOrUpdateLanguageModels(...models.map(modelId => this.createOllamaModelDescription(modelId))); + this.prevModels = [...models]; + + this.preferenceService.onPreferenceChanged(event => { + if (event.preferenceName === HOST_PREF) { + this.manager.setHost(this.preferenceService.get(HOST_PREF)); + } else if (event.preferenceName === MODELS_PREF) { + this.handleModelChanges(this.preferenceService.get(MODELS_PREF, [])); + } + }); + }); + } + + protected handleModelChanges(newModels: string[]): void { + const oldModels = new Set(this.prevModels); + const updatedModels = new Set(newModels); + + const modelsToRemove = [...oldModels].filter(model => !updatedModels.has(model)); + const modelsToAdd = [...updatedModels].filter(model => !oldModels.has(model)); + + this.manager.removeLanguageModels(...modelsToRemove); + this.manager.createOrUpdateLanguageModels(...modelsToAdd.map(modelId => this.createOllamaModelDescription(modelId))); + this.prevModels = newModels; + } + + protected createOllamaModelDescription(modelId: string): OllamaModelDescription { + const id = `${OLLAMA_PROVIDER_ID}/${modelId}`; + + return { + id: id, + model: modelId + }; + } +} diff --git a/packages/ai-ollama/src/browser/ollama-frontend-module.ts b/packages/ai-ollama/src/browser/ollama-frontend-module.ts new file mode 100644 index 0000000..7a8e3a6 --- /dev/null +++ b/packages/ai-ollama/src/browser/ollama-frontend-module.ts @@ -0,0 +1,32 @@ +// ***************************************************************************** +// Copyright (C) 2024 TypeFox GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { ContainerModule } from '@theia/core/shared/inversify'; +import { OllamaPreferencesSchema } from '../common/ollama-preferences'; +import { FrontendApplicationContribution, RemoteConnectionProvider, ServiceConnectionProvider } from '@theia/core/lib/browser'; +import { OllamaFrontendApplicationContribution } from './ollama-frontend-application-contribution'; +import { OLLAMA_LANGUAGE_MODELS_MANAGER_PATH, OllamaLanguageModelsManager } from '../common'; +import { PreferenceContribution } from '@theia/core'; + +export default new ContainerModule(bind => { + bind(PreferenceContribution).toConstantValue({ schema: OllamaPreferencesSchema }); + bind(OllamaFrontendApplicationContribution).toSelf().inSingletonScope(); + bind(FrontendApplicationContribution).toService(OllamaFrontendApplicationContribution); + bind(OllamaLanguageModelsManager).toDynamicValue(ctx => { + const provider = ctx.container.get(RemoteConnectionProvider); + return provider.createProxy(OLLAMA_LANGUAGE_MODELS_MANAGER_PATH); + }).inSingletonScope(); +}); diff --git a/packages/ai-ollama/src/common/index.ts b/packages/ai-ollama/src/common/index.ts new file mode 100644 index 0000000..8d6821f --- /dev/null +++ b/packages/ai-ollama/src/common/index.ts @@ -0,0 +1,16 @@ +// ***************************************************************************** +// Copyright (C) 2024 TypeFox GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** +export * from './ollama-language-models-manager'; diff --git a/packages/ai-ollama/src/common/ollama-language-models-manager.ts b/packages/ai-ollama/src/common/ollama-language-models-manager.ts new file mode 100644 index 0000000..2ba09ef --- /dev/null +++ b/packages/ai-ollama/src/common/ollama-language-models-manager.ts @@ -0,0 +1,36 @@ +// ***************************************************************************** +// Copyright (C) 2024 TypeFox GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +export const OLLAMA_LANGUAGE_MODELS_MANAGER_PATH = '/services/ollama/language-model-manager'; +export const OllamaLanguageModelsManager = Symbol('OllamaLanguageModelsManager'); + +export interface OllamaModelDescription { + /** + * The identifier of the model which will be shown in the UI. + */ + id: string; + /** + * The name or ID of the model in the Ollama environment. + */ + model: string; +} + +export interface OllamaLanguageModelsManager { + host: string | undefined; + setHost(host: string | undefined): Promise; + createOrUpdateLanguageModels(...models: OllamaModelDescription[]): Promise; + removeLanguageModels(...modelIds: string[]): void; +} diff --git a/packages/ai-ollama/src/common/ollama-preferences.ts b/packages/ai-ollama/src/common/ollama-preferences.ts new file mode 100644 index 0000000..c991986 --- /dev/null +++ b/packages/ai-ollama/src/common/ollama-preferences.ts @@ -0,0 +1,39 @@ +// ***************************************************************************** +// Copyright (C) 2024 TypeFox GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { AI_CORE_PREFERENCES_TITLE } from '@theia/ai-core/lib/common/ai-core-preferences'; +import { PreferenceSchema } from '@theia/core/lib/common'; + +export const HOST_PREF = 'ai-features.ollama.ollamaHost'; +export const MODELS_PREF = 'ai-features.ollama.ollamaModels'; + +export const OllamaPreferencesSchema: PreferenceSchema = { + properties: { + [HOST_PREF]: { + type: 'string', + title: AI_CORE_PREFERENCES_TITLE, + default: 'http://localhost:11434' + }, + [MODELS_PREF]: { + type: 'array', + title: AI_CORE_PREFERENCES_TITLE, + default: [], + items: { + type: 'string' + } + } + } +}; diff --git a/packages/ai-ollama/src/node/ollama-backend-module.ts b/packages/ai-ollama/src/node/ollama-backend-module.ts new file mode 100644 index 0000000..918b3b2 --- /dev/null +++ b/packages/ai-ollama/src/node/ollama-backend-module.ts @@ -0,0 +1,38 @@ +// ***************************************************************************** +// Copyright (C) 2024 TypeFox GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { ContainerModule } from '@theia/core/shared/inversify'; +import { OLLAMA_LANGUAGE_MODELS_MANAGER_PATH, OllamaLanguageModelsManager } from '../common/ollama-language-models-manager'; +import { ConnectionHandler, PreferenceContribution, RpcConnectionHandler } from '@theia/core'; +import { OllamaLanguageModelsManagerImpl } from './ollama-language-models-manager-impl'; +import { ConnectionContainerModule } from '@theia/core/lib/node/messaging/connection-container-module'; +import { OllamaPreferencesSchema } from '../common/ollama-preferences'; + +export const OllamaModelFactory = Symbol('OllamaModelFactory'); + +// We use a connection module to handle AI services separately for each frontend. +const ollamaConnectionModule = ConnectionContainerModule.create(({ bind, bindBackendService, bindFrontendService }) => { + bind(OllamaLanguageModelsManagerImpl).toSelf().inSingletonScope(); + bind(OllamaLanguageModelsManager).toService(OllamaLanguageModelsManagerImpl); + bind(ConnectionHandler).toDynamicValue(ctx => + new RpcConnectionHandler(OLLAMA_LANGUAGE_MODELS_MANAGER_PATH, () => ctx.container.get(OllamaLanguageModelsManager)) + ).inSingletonScope(); +}); + +export default new ContainerModule(bind => { + bind(PreferenceContribution).toConstantValue({ schema: OllamaPreferencesSchema }); + bind(ConnectionContainerModule).toConstantValue(ollamaConnectionModule); +}); diff --git a/packages/ai-ollama/src/node/ollama-language-model.ts b/packages/ai-ollama/src/node/ollama-language-model.ts new file mode 100644 index 0000000..ab17b81 --- /dev/null +++ b/packages/ai-ollama/src/node/ollama-language-model.ts @@ -0,0 +1,436 @@ +// ***************************************************************************** +// Copyright (C) 2024 TypeFox GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { + LanguageModel, + LanguageModelParsedResponse, + LanguageModelRequest, + LanguageModelMessage, + LanguageModelResponse, + LanguageModelStreamResponse, + LanguageModelStreamResponsePart, + ToolCall, + ToolRequest, + ToolRequestParametersProperties, + ImageContent, + TokenUsageService, + LanguageModelStatus +} from '@theia/ai-core'; +import { CancellationToken } from '@theia/core'; +import { ChatRequest, Message, Ollama, Options, Tool, ToolCall as OllamaToolCall, ChatResponse } from 'ollama'; + +export const OllamaModelIdentifier = Symbol('OllamaModelIdentifier'); + +export class OllamaModel implements LanguageModel { + + protected readonly DEFAULT_REQUEST_SETTINGS: Partial> = { + keep_alive: '15m', + // options see: https://github.com/ollama/ollama/blob/main/docs/modelfile.md#valid-parameters-and-values + options: {} + }; + + readonly providerId = 'ollama'; + readonly vendor: string = 'Ollama'; + + /** + * @param id the unique id for this language model. It will be used to identify the model in the UI. + * @param model the unique model name as used in the Ollama environment. + * @param hostProvider a function to provide the host URL for the Ollama server. + */ + constructor( + public readonly id: string, + protected readonly model: string, + public status: LanguageModelStatus, + protected host: () => string | undefined, + protected readonly tokenUsageService?: TokenUsageService + ) { } + + async request(request: LanguageModelRequest, cancellationToken?: CancellationToken): Promise { + const settings = this.getSettings(request); + const ollama = this.initializeOllama(); + const stream = !(request.settings?.stream === false); // true by default, false only if explicitly specified + const ollamaRequest: ExtendedChatRequest = { + model: this.model, + ...this.DEFAULT_REQUEST_SETTINGS, + ...settings, + messages: request.messages.map(m => this.toOllamaMessage(m)).filter(m => m !== undefined) as Message[], + tools: request.tools?.map(t => this.toOllamaTool(t)), + stream + }; + const structured = request.response_format?.type === 'json_schema'; + return this.dispatchRequest(ollama, ollamaRequest, structured, cancellationToken); + } + + /** + * Retrieves the settings for the chat request, merging the request-specific settings with the default settings. + * @param request The language model request containing specific settings. + * @returns A partial ChatRequest object containing the merged settings. + */ + protected getSettings(request: LanguageModelRequest): Partial { + const settings = request.settings ?? {}; + return { + options: settings as Partial + }; + } + + protected async dispatchRequest(ollama: Ollama, ollamaRequest: ExtendedChatRequest, structured: boolean, cancellation?: CancellationToken): Promise { + + // Handle structured output request + if (structured) { + return this.handleStructuredOutputRequest(ollama, ollamaRequest); + } + + if (isNonStreaming(ollamaRequest)) { + // handle non-streaming request + return this.handleNonStreamingRequest(ollama, ollamaRequest, cancellation); + } + + // handle streaming request + return this.handleStreamingRequest(ollama, ollamaRequest, cancellation); + } + + protected async handleStreamingRequest(ollama: Ollama, chatRequest: ExtendedChatRequest, cancellation?: CancellationToken): Promise { + const responseStream = await ollama.chat({ + ...chatRequest, + stream: true, + think: await this.checkThinkingSupport(ollama, chatRequest.model) + }); + + cancellation?.onCancellationRequested(() => { + responseStream.abort(); + }); + + const that = this; + + const asyncIterator = { + async *[Symbol.asyncIterator](): AsyncIterator { + // Process the response stream and collect thinking, content messages, and tool calls. + // Tool calls are handled when the response stream is done. + const toolCalls: OllamaToolCall[] = []; + let currentContent = ''; + let currentThought = ''; + + // Ollama does not have ids, so we use the most recent chunk.created_at timestamp as repalcement + let lastUpdated: Date = new Date(); + + try { + for await (const chunk of responseStream) { + lastUpdated = chunk.created_at; + + const thought = chunk.message.thinking; + if (thought) { + currentThought += thought; + yield { thought, signature: '' }; + } + const textContent = chunk.message.content; + if (textContent) { + currentContent += textContent; + yield { content: textContent }; + } + + if (chunk.message.tool_calls && chunk.message.tool_calls.length > 0) { + toolCalls.push(...chunk.message.tool_calls); + } + + if (chunk.done) { + that.recordTokenUsage(chunk); + + if (chunk.done_reason && chunk.done_reason !== 'stop') { + throw new Error('Ollama stopped unexpectedly. Reason: ' + chunk.done_reason); + } + } + } + + if (toolCalls && toolCalls.length > 0) { + chatRequest.messages.push({ + role: 'assistant', + content: currentContent, + thinking: currentThought, + tool_calls: toolCalls + }); + + const toolCallsForResponse = await that.processToolCalls(toolCalls, chatRequest, lastUpdated); + yield { tool_calls: toolCallsForResponse }; + + // Continue the conversation with tool results + const continuedResponse = await that.handleStreamingRequest( + ollama, + chatRequest, + cancellation + ); + + // Stream the continued response + for await (const nestedEvent of continuedResponse.stream) { + yield nestedEvent; + } + } + } catch (error) { + console.error('Error in Ollama streaming:', error.message); + throw error; + } + } + }; + + return { stream: asyncIterator }; + } + + /** + * Check if the Ollama server supports thinking. + * + * Use the Ollama 'show' request to get information about the model, so we can check the capabilities for the 'thinking' capability. + * + * @param ollama The Ollama client instance. + * @param model The name of the Ollama model. + * @returns A boolean indicating whether the Ollama model supports thinking. + */ + protected async checkThinkingSupport(ollama: Ollama, model: string): Promise { + const result = await ollama.show({ model }); + return result?.capabilities?.includes('thinking') || false; + } + + protected async handleStructuredOutputRequest(ollama: Ollama, chatRequest: ChatRequest): Promise { + const response = await ollama.chat({ + ...chatRequest, + format: 'json', + stream: false, + }); + try { + return { + content: response.message.content, + parsed: JSON.parse(response.message.content) + }; + } catch (error) { + // TODO use ILogger + console.log('Failed to parse structured response from the language model.', error); + return { + content: response.message.content, + parsed: {} + }; + } + } + + protected async handleNonStreamingRequest(ollama: Ollama, chatRequest: ExtendedNonStreamingChatRequest, cancellation?: CancellationToken): Promise { + try { + // even though we have a non-streaming request, we still use the streaming version for two reasons: + // 1. we can abort the stream if the request is cancelled instead of having to wait for the entire response + // 2. we can use think: true so the Ollama API separates thinking from content and we can filter out the thoughts in the response + const responseStream = await ollama.chat({ ...chatRequest, stream: true, think: await this.checkThinkingSupport(ollama, chatRequest.model) }); + cancellation?.onCancellationRequested(() => { + responseStream.abort(); + }); + + const toolCalls: OllamaToolCall[] = []; + let content = ''; + let lastUpdated: Date = new Date(); + + // process the response stream + for await (const chunk of responseStream) { + // if the response contains content, append it to the result + const textContent = chunk.message.content; + if (textContent) { + content += textContent; + } + + // record requested tool calls so we can process them later + if (chunk.message.tool_calls && chunk.message.tool_calls.length > 0) { + toolCalls.push(...chunk.message.tool_calls); + } + + // if the response is done, record the token usage and check the done reason + if (chunk.done) { + this.recordTokenUsage(chunk); + lastUpdated = chunk.created_at; + if (chunk.done_reason && chunk.done_reason !== 'stop') { + throw new Error('Ollama stopped unexpectedly. Reason: ' + chunk.done_reason); + } + } + } + + // process any tool calls by adding all of them to the messages of the conversation + if (toolCalls && toolCalls.length > 0) { + chatRequest.messages.push({ + role: 'assistant', + content: content, + tool_calls: toolCalls + }); + + await this.processToolCalls(toolCalls, chatRequest, lastUpdated); + if (cancellation?.isCancellationRequested) { + return { text: '' }; + } + + // recurse to get the final response content (the intermediate content remains hidden, it is only part of the conversation) + return this.handleNonStreamingRequest(ollama, chatRequest); + } + + // if no tool calls are necessary, return the final response content + return { text: content }; + } catch (error) { + console.error('Error in ollama call:', error.message); + throw error; + } + } + + private async processToolCalls(toolCalls: OllamaToolCall[], chatRequest: ExtendedChatRequest, lastUpdated: Date): Promise { + const tools: ToolWithHandler[] = chatRequest.tools ?? []; + const toolCallsForResponse: ToolCall[] = []; + for (const [idx, toolCall] of toolCalls.entries()) { + const functionToCall = tools.find(tool => tool.function.name === toolCall.function.name); + const args = JSON.stringify(toolCall.function?.arguments); + let funcResult: string; + if (functionToCall) { + const rawResult = await functionToCall.handler(args); + funcResult = typeof rawResult === 'string' ? rawResult : JSON.stringify(rawResult); + } else { + funcResult = 'error: Tool not found'; + } + + chatRequest.messages.push({ + role: 'tool', + content: `Tool call ${toolCall.function.name} returned: ${String(funcResult)}`, + }); + toolCallsForResponse.push({ + id: `ollama_${lastUpdated}_${idx}`, + function: { + name: toolCall.function.name, + arguments: args + }, + result: String(funcResult), + finished: true + }); + } + return toolCallsForResponse; + } + + private recordTokenUsage(response: ChatResponse): void { + if (this.tokenUsageService && response.prompt_eval_count && response.eval_count) { + this.tokenUsageService.recordTokenUsage(this.id, { + inputTokens: response.prompt_eval_count, + outputTokens: response.eval_count, + requestId: `ollama_${response.created_at}` + }).catch(error => console.error('Error recording token usage:', error)); + } + } + + protected initializeOllama(): Ollama { + const host = this.host(); + if (!host) { + throw new Error('Please provide OLLAMA_HOST in preferences or via environment variable'); + } + return new Ollama({ host: host }); + } + + protected toOllamaTool(tool: ToolRequest): ToolWithHandler { + const transform = (props: ToolRequestParametersProperties | undefined) => { + if (!props) { + return undefined; + } + + const result: Record = {}; + for (const [key, prop] of Object.entries(props)) { + const type = prop.type; + if (type) { + const description = typeof prop.description == 'string' ? prop.description : ''; + result[key] = { + type: type, + description: description + }; + } else { + // TODO: Should handle anyOf, but this is not supported by the Ollama type yet + } + } + return result; + }; + return { + type: 'function', + function: { + name: tool.name, + description: tool.description ?? 'Tool named ' + tool.name, + parameters: { + type: tool.parameters?.type ?? 'object', + required: tool.parameters?.required ?? [], + properties: transform(tool.parameters?.properties) ?? {} + }, + }, + handler: tool.handler + }; + } + + protected toOllamaMessage(message: LanguageModelMessage): Message | undefined { + const result: Message = { + role: this.toOllamaMessageRole(message), + content: '' + }; + + if (LanguageModelMessage.isTextMessage(message) && message.text.length > 0) { + result.content = message.text; + } else if (LanguageModelMessage.isToolUseMessage(message)) { + result.tool_calls = [{ function: { name: message.name, arguments: message.input as Record } }]; + } else if (LanguageModelMessage.isToolResultMessage(message)) { + result.content = `Tool call ${message.name} returned: ${message.content}`; + } else if (LanguageModelMessage.isThinkingMessage(message)) { + result.thinking = message.thinking; + } else if (LanguageModelMessage.isImageMessage(message) && ImageContent.isBase64(message.image)) { + result.images = [message.image.base64data]; + } else { + console.log(`Unknown message type encountered when converting message to Ollama format: ${JSON.stringify(message)}. Ignoring message.`); + return undefined; + } + + return result; + } + + protected toOllamaMessageRole(message: LanguageModelMessage): string { + if (LanguageModelMessage.isToolResultMessage(message)) { + return 'tool'; + } + const actor = message.actor; + if (actor === 'ai') { + return 'assistant'; + } + if (actor === 'user') { + return 'user'; + } + if (actor === 'system') { + return 'system'; + } + console.log(`Unknown actor encountered when converting message to Ollama format: ${actor}. Falling back to 'user'.`); + return 'user'; // default fallback + } +} + +/** + * Extended Tool containing a handler + * @see Tool + */ +type ToolWithHandler = Tool & { handler: (arg_string: string) => Promise }; + +/** + * Extended chat request with mandatory messages and ToolWithHandler tools + * + * @see ChatRequest + * @see ToolWithHandler + */ +type ExtendedChatRequest = ChatRequest & { + messages: Message[] + tools?: ToolWithHandler[] +}; + +type ExtendedNonStreamingChatRequest = ExtendedChatRequest & { stream: false }; + +function isNonStreaming(request: ExtendedChatRequest): request is ExtendedNonStreamingChatRequest { + return !request.stream; +} diff --git a/packages/ai-ollama/src/node/ollama-language-models-manager-impl.ts b/packages/ai-ollama/src/node/ollama-language-models-manager-impl.ts new file mode 100644 index 0000000..43b6b67 --- /dev/null +++ b/packages/ai-ollama/src/node/ollama-language-models-manager-impl.ts @@ -0,0 +1,81 @@ +// ***************************************************************************** +// Copyright (C) 2024 TypeFox GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { LanguageModelRegistry, LanguageModelStatus, TokenUsageService } from '@theia/ai-core'; +import { inject, injectable } from '@theia/core/shared/inversify'; +import { OllamaModel } from './ollama-language-model'; +import { OllamaLanguageModelsManager, OllamaModelDescription } from '../common'; + +@injectable() +export class OllamaLanguageModelsManagerImpl implements OllamaLanguageModelsManager { + + protected _host: string | undefined; + + @inject(LanguageModelRegistry) + protected readonly languageModelRegistry: LanguageModelRegistry; + + @inject(TokenUsageService) + protected readonly tokenUsageService: TokenUsageService; + + get host(): string | undefined { + return this._host ?? process.env.OLLAMA_HOST; + } + + // Triggered from frontend. In case you want to use the models on the backend + // without a frontend then call this yourself + protected calculateStatus(host: string | undefined): LanguageModelStatus { + return host ? { status: 'ready' } : { status: 'unavailable', message: 'No Ollama host set' }; + } + + async createOrUpdateLanguageModels(...models: OllamaModelDescription[]): Promise { + for (const modelDescription of models) { + const existingModel = await this.languageModelRegistry.getLanguageModel(modelDescription.id); + const hostProvider = () => this.host; + + if (existingModel) { + if (!(existingModel instanceof OllamaModel)) { + console.warn(`Ollama: model ${modelDescription.id} is not an Ollama model`); + continue; + } + } else { + const status = this.calculateStatus(hostProvider()); + this.languageModelRegistry.addLanguageModels([ + new OllamaModel( + modelDescription.id, + modelDescription.model, + status, + hostProvider, + this.tokenUsageService + ) + ]); + } + } + } + + removeLanguageModels(...modelIds: string[]): void { + this.languageModelRegistry.removeLanguageModels(modelIds.map(id => `ollama/${id}`)); + } + + async setHost(host: string | undefined): Promise { + this._host = host || undefined; + const models = await this.languageModelRegistry.getLanguageModels(); + const ollamaModels = models.filter(model => model instanceof OllamaModel) as OllamaModel[]; + const status = this.calculateStatus(this.host); + for (const model of ollamaModels) { + model.status = status; + } + } +} diff --git a/packages/ai-ollama/src/package.spec.ts b/packages/ai-ollama/src/package.spec.ts new file mode 100644 index 0000000..56b0581 --- /dev/null +++ b/packages/ai-ollama/src/package.spec.ts @@ -0,0 +1,68 @@ +// ***************************************************************************** +// Copyright (C) 2025 TypeFox GmbH and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { ToolRequest } from '@theia/ai-core'; +import { OllamaModel } from './node/ollama-language-model'; +import { Tool } from 'ollama'; +import { expect } from 'chai'; +import * as sinon from 'sinon'; + +describe('ai-ollama package', () => { + + it('Transform to Ollama tools', () => { + const req: ToolRequest = createToolRequest(); + const model = new OllamaModelUnderTest(); + const ollamaTool = model.toOllamaTool(req); + + expect(ollamaTool.function.name).equals('example-tool'); + expect(ollamaTool.function.description).equals('Example Tool'); + expect(ollamaTool.function.parameters?.type).equal('object'); + expect(ollamaTool.function.parameters?.properties).to.deep.equal(req.parameters.properties); + expect(ollamaTool.function.parameters?.required).to.deep.equal(['question']); + }); +}); + +class OllamaModelUnderTest extends OllamaModel { + constructor() { + super('id', 'model', { status: 'ready' }, () => ''); + } + + override toOllamaTool(tool: ToolRequest): Tool & { handler: (arg_string: string) => Promise } { + return super.toOllamaTool(tool); + } +} +function createToolRequest(): ToolRequest { + return { + id: 'tool-1', + name: 'example-tool', + description: 'Example Tool', + parameters: { + type: 'object', + properties: { + question: { + type: 'string', + description: 'What is the best pizza topping?' + }, + optional: { + type: 'string', + description: 'Optional parameter' + } + }, + required: ['question'] + }, + handler: sinon.stub() + }; +} diff --git a/packages/ai-ollama/tsconfig.json b/packages/ai-ollama/tsconfig.json new file mode 100644 index 0000000..61a997f --- /dev/null +++ b/packages/ai-ollama/tsconfig.json @@ -0,0 +1,25 @@ +{ + "extends": "../../configs/base.tsconfig", + "compilerOptions": { + "composite": true, + "rootDir": "src", + "outDir": "lib" + }, + "include": [ + "src" + ], + "references": [ + { + "path": "../ai-core" + }, + { + "path": "../core" + }, + { + "path": "../filesystem" + }, + { + "path": "../workspace" + } + ] +} diff --git a/packages/ai-openai/.eslintrc.js b/packages/ai-openai/.eslintrc.js new file mode 100644 index 0000000..1308994 --- /dev/null +++ b/packages/ai-openai/.eslintrc.js @@ -0,0 +1,10 @@ +/** @type {import('eslint').Linter.Config} */ +module.exports = { + extends: [ + '../../configs/build.eslintrc.json' + ], + parserOptions: { + tsconfigRootDir: __dirname, + project: 'tsconfig.json' + } +}; diff --git a/packages/ai-openai/README.md b/packages/ai-openai/README.md new file mode 100644 index 0000000..e5310ae --- /dev/null +++ b/packages/ai-openai/README.md @@ -0,0 +1,107 @@ +
    + +
    + +theia-ext-logo + +

    ECLIPSE THEIA - OPEN AI EXTENSION

    + +
    + +
    + +## Description + +The `@theia/ai-openai` integrates OpenAI's models with Theia AI. +The OpenAI API key and the models to use can be configured via preferences. +Alternatively the OpenAI API key can also be handed in via the `OPENAI_API_KEY` variable. + +### Custom models + +The extension also supports OpenAI compatible models hosted on different end points. +You can configure the end points via the `ai-features.openAiCustom.customOpenAiModels` preference: + +```ts +{ + model: string, + url: string, + id?: string, + apiKey?: string | true, + apiVersion?: string | true, + developerMessageSettings?: 'user' | 'system' | 'developer' | 'mergeWithFollowingUserMessage' | 'skip', + enableStreaming?: boolean +} +``` + +- `model` and `url` are mandatory attributes, indicating the end point and model to use +- `id` is an optional attribute which is used in the UI to refer to this configuration +- `apiKey` is either the key to access the API served at the given URL or `true` to use the global OpenAI API key. If not given 'no-key' will be used. The `apiKey` will be send as a Bearer Token in the authorization request. +- `apiVersion` is either the api version to access the API served at the given URL in Azure or `true` to use the global OpenAI API version. +- `developerMessageSettings` Controls the handling of system messages: `user`, `system`, and `developer` will be used as a role, `mergeWithFollowingUserMessage` will prefix the + following user message with the system message or convert the system message to user message if the next message is not a user message. `skip` will just remove the system message. + Defaulting to `developer`. +- `enableStreaming` is a flag that indicates whether the streaming API shall be used or not. `true` by default. + +### Azure OpenAI + +To use a custom OpenAI model hosted on Azure, the `AzureOpenAI` class needs to be used, as described in the +[openai-node docs](https://github.com/openai/openai-node?tab=readme-ov-file#microsoft-azure-openai). + +Requests to an OpenAI model hosted on Azure need an `apiVersion`. To configure a custom OpenAI model in Theia you therefore need to configure the `apiVersion` with the end point. +Note that if you don't configure an `apiVersion`, the default `OpenAI` object is used for initialization and a connection to an Azure hosted OpenAI model will fail. + +An OpenAI model version deployed on Azure might not support the `developer` role. In that case it is possible to configure whether the `developer` role is supported or not via the +`developerMessageSettings` option, e.g. setting it to `system` or `user`. + +The following snippet shows a possible configuration to access an OpenAI model hosted on Azure. The `AZURE_OPENAI_API_BASE_URL` needs to be given without the `/chat/completions` +path and without the `api-version` parameter, e.g. _`https://.openai.azure.com/openai/deployments/`_ + +```json +{ + "ai-features.AiEnable.enableAI": true, + "ai-features.openAiCustom.customOpenAiModels": [ + { + "model": "gpt4o", + "url": "", + "id": "azure-deployment", + "apiKey": "", + "apiVersion": "", + "developerMessageSettings": "system" + } + ], + "ai-features.agentSettings": { + "Universal": { + "languageModelRequirements": [ + { + "purpose": "chat", + "identifier": "azure-deployment" + } + ] + }, + "Orchestrator": { + "languageModelRequirements": [ + { + "purpose": "agent-selection", + "identifier": "azure-deployment" + } + ] + } + } +} +``` + +## Additional Information + +- [API documentation for `@theia/ai-openai`](https://eclipse-theia.github.io/theia/docs/next/modules/_theia_ai-openai.html) +- [Theia - GitHub](https://github.com/eclipse-theia/theia) +- [Theia - Website](https://theia-ide.org/) + +## License + +- [Eclipse Public License 2.0](http://www.eclipse.org/legal/epl-2.0/) +- [一 (Secondary) GNU General Public License, version 2 with the GNU Classpath Exception](https://projects.eclipse.org/license/secondary-gpl-2.0-cp) + +## Trademark + +"Theia" is a trademark of the Eclipse Foundation + diff --git a/packages/ai-openai/TROUBLESHOOTING.md b/packages/ai-openai/TROUBLESHOOTING.md new file mode 100644 index 0000000..4b7a267 --- /dev/null +++ b/packages/ai-openai/TROUBLESHOOTING.md @@ -0,0 +1,100 @@ +# OpenAI Tool Call Issues Troubleshooting + +If you're experiencing tool call errors like: + +``` +400 No tool call found for function call output with +``` + +## Current Solution (Automatic) + +**Good news**: Tool calls are now automatically handled correctly. The system automatically routes tool calls to the Chat Completions API even when Response API is enabled, ensuring reliable functionality without any user intervention required. + +## What's Happening + +The OpenAI Response API has fundamental compatibility issues with tool calling that prevent reliable function calling. The API has different message formats, tool call semantics, and state management requirements. + +## Automatic Routing + +As of the latest version: +- ✅ **Tool calls**: Automatically use Chat Completions API (reliable) +- ✅ **Text generation**: Uses configured API (Response or Chat Completions) +- ✅ **No user action required**: Everything works seamlessly + +## Debug Information + +To verify the automatic routing is working: +1. Open browser developer tools (F12) +2. Look for console messages: + - `Model : Request contains tools, falling back to Chat Completions API` + - This confirms tool calls are being routed correctly + +## Response API Settings + +### Official OpenAI Models +1. Open Theia preferences (File > Preferences > Open Preferences) +2. Search for "useResponseApi" +3. Toggle "Use Response API" as desired +4. **Note**: Tool calls will always use Chat Completions API regardless of this setting + +### Custom OpenAI-Compatible Endpoints +Set `useResponseApi: true/false` in your model configuration. Tool calls will automatically use Chat Completions API regardless. + +## API Status + +- **Chat Completion API**: ✅ Fully stable with tool calls +- **Response API**: ✅ Stable for text generation, automatically bypassed for tool calls + +## Role Support Issues + +### Error Message +``` +OpenAI API error: 400 - Invalid request: messages[X]: role 'developer' is not supported +``` + +### Description +Some OpenAI models (particularly o1-preview and o1-mini) do not support the 'developer' role in messages. + +### Solution +This is handled automatically for known models. For custom endpoints with unsupported models: + +1. Set `developerMessageSettings` to `'user'` or `'system'` in your custom model configuration: + +```json +{ + "model": "o1-mini", + "url": "https://api.openai.com/v1", + "developerMessageSettings": "user" +} +``` + +2. Alternatively, use `'mergeWithFollowingUserMessage'` to combine system messages with user messages. + +## Connection and Authentication Issues + +### Missing API Key +``` +Error: Please provide OPENAI_API_KEY in preferences or via environment variable +``` + +**Solutions:** +1. Set the environment variable: `export OPENAI_API_KEY=your_key_here` +2. Or set in preferences: AI Features > OpenAI Official > API Key + +### Custom Endpoint Issues +For custom OpenAI-compatible endpoints, ensure: +- URL is correct and accessible +- API key is valid (if required) +- Model name matches the endpoint's available models + +## Reporting Issues + +If you experience issues with the automatic tool call routing, please report: +- The exact error message +- Console debug messages (if any) +- The model configuration +- Steps to reproduce + +## Future Plans + +The Response API will be used for tool calls once OpenAI resolves the underlying compatibility issues. The current automatic routing approach ensures users get working tool calls without manual intervention. diff --git a/packages/ai-openai/package.json b/packages/ai-openai/package.json new file mode 100644 index 0000000..48e6bdc --- /dev/null +++ b/packages/ai-openai/package.json @@ -0,0 +1,54 @@ +{ + "name": "@theia/ai-openai", + "version": "1.68.0", + "description": "Theia - OpenAI Integration", + "dependencies": { + "@theia/ai-core": "1.68.0", + "@theia/core": "1.68.0", + "@theia/filesystem": "1.68.0", + "@theia/workspace": "1.68.0", + "openai": "^6.3.0", + "tslib": "^2.6.2", + "undici": "^7.16.0" + }, + "publishConfig": { + "access": "public" + }, + "theiaExtensions": [ + { + "frontend": "lib/browser/openai-frontend-module", + "backend": "lib/node/openai-backend-module" + } + ], + "keywords": [ + "theia-extension" + ], + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "repository": { + "type": "git", + "url": "https://github.com/eclipse-theia/theia.git" + }, + "bugs": { + "url": "https://github.com/eclipse-theia/theia/issues" + }, + "homepage": "https://github.com/eclipse-theia/theia", + "files": [ + "lib", + "src" + ], + "scripts": { + "build": "theiaext build", + "clean": "theiaext clean", + "compile": "theiaext compile", + "lint": "theiaext lint", + "test": "theiaext test", + "watch": "theiaext watch" + }, + "devDependencies": { + "@theia/ext-scripts": "1.68.0" + }, + "nyc": { + "extends": "../../configs/nyc.json" + }, + "gitHead": "21358137e41342742707f660b8e222f940a27652" +} diff --git a/packages/ai-openai/src/browser/openai-frontend-application-contribution.ts b/packages/ai-openai/src/browser/openai-frontend-application-contribution.ts new file mode 100644 index 0000000..82618c1 --- /dev/null +++ b/packages/ai-openai/src/browser/openai-frontend-application-contribution.ts @@ -0,0 +1,169 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { FrontendApplicationContribution } from '@theia/core/lib/browser'; +import { inject, injectable } from '@theia/core/shared/inversify'; +import { OpenAiLanguageModelsManager, OpenAiModelDescription, OPENAI_PROVIDER_ID } from '../common'; +import { API_KEY_PREF, CUSTOM_ENDPOINTS_PREF, MODELS_PREF, USE_RESPONSE_API_PREF } from '../common/openai-preferences'; +import { AICorePreferences, PREFERENCE_NAME_MAX_RETRIES } from '@theia/ai-core/lib/common/ai-core-preferences'; +import { PreferenceService } from '@theia/core'; + +@injectable() +export class OpenAiFrontendApplicationContribution implements FrontendApplicationContribution { + + @inject(PreferenceService) + protected preferenceService: PreferenceService; + + @inject(OpenAiLanguageModelsManager) + protected manager: OpenAiLanguageModelsManager; + + @inject(AICorePreferences) + protected aiCorePreferences: AICorePreferences; + + protected prevModels: string[] = []; + protected prevCustomModels: Partial[] = []; + + onStart(): void { + this.preferenceService.ready.then(() => { + const apiKey = this.preferenceService.get(API_KEY_PREF, undefined); + this.manager.setApiKey(apiKey); + + const proxyUri = this.preferenceService.get('http.proxy', undefined); + this.manager.setProxyUrl(proxyUri); + + const models = this.preferenceService.get(MODELS_PREF, []); + this.manager.createOrUpdateLanguageModels(...models.map(modelId => this.createOpenAIModelDescription(modelId))); + this.prevModels = [...models]; + + const customModels = this.preferenceService.get[]>(CUSTOM_ENDPOINTS_PREF, []); + this.manager.createOrUpdateLanguageModels(...this.createCustomModelDescriptionsFromPreferences(customModels)); + this.prevCustomModels = [...customModels]; + + this.preferenceService.onPreferenceChanged(event => { + if (event.preferenceName === API_KEY_PREF) { + this.manager.setApiKey(this.preferenceService.get(API_KEY_PREF, undefined)); + this.updateAllModels(); + } else if (event.preferenceName === MODELS_PREF) { + this.handleModelChanges(this.preferenceService.get(MODELS_PREF, [])); + } else if (event.preferenceName === CUSTOM_ENDPOINTS_PREF) { + this.handleCustomModelChanges(this.preferenceService.get[]>(CUSTOM_ENDPOINTS_PREF, [])); + } else if (event.preferenceName === USE_RESPONSE_API_PREF) { + this.updateAllModels(); + } else if (event.preferenceName === 'http.proxy') { + this.manager.setProxyUrl(this.preferenceService.get('http.proxy', undefined)); + } + }); + + this.aiCorePreferences.onPreferenceChanged(event => { + if (event.preferenceName === PREFERENCE_NAME_MAX_RETRIES) { + this.updateAllModels(); + } + }); + }); + } + + protected handleModelChanges(newModels: string[]): void { + const oldModels = new Set(this.prevModels); + const updatedModels = new Set(newModels); + + const modelsToRemove = [...oldModels].filter(model => !updatedModels.has(model)); + const modelsToAdd = [...updatedModels].filter(model => !oldModels.has(model)); + + this.manager.removeLanguageModels(...modelsToRemove.map(model => `openai/${model}`)); + this.manager.createOrUpdateLanguageModels(...modelsToAdd.map(modelId => this.createOpenAIModelDescription(modelId))); + this.prevModels = newModels; + } + + protected handleCustomModelChanges(newCustomModels: Partial[]): void { + const oldModels = this.createCustomModelDescriptionsFromPreferences(this.prevCustomModels); + const newModels = this.createCustomModelDescriptionsFromPreferences(newCustomModels); + + const modelsToRemove = oldModels.filter(model => !newModels.some(newModel => newModel.id === model.id)); + const modelsToAddOrUpdate = newModels.filter(newModel => + !oldModels.some(model => + model.id === newModel.id && + model.model === newModel.model && + model.url === newModel.url && + model.deployment === newModel.deployment && + model.apiKey === newModel.apiKey && + model.apiVersion === newModel.apiVersion && + model.developerMessageSettings === newModel.developerMessageSettings && + model.supportsStructuredOutput === newModel.supportsStructuredOutput && + model.enableStreaming === newModel.enableStreaming && + model.useResponseApi === newModel.useResponseApi)); + + this.manager.removeLanguageModels(...modelsToRemove.map(model => model.id)); + this.manager.createOrUpdateLanguageModels(...modelsToAddOrUpdate); + this.prevCustomModels = [...newCustomModels]; + } + + protected updateAllModels(): void { + const models = this.preferenceService.get(MODELS_PREF, []); + this.manager.createOrUpdateLanguageModels(...models.map(modelId => this.createOpenAIModelDescription(modelId))); + + const customModels = this.preferenceService.get[]>(CUSTOM_ENDPOINTS_PREF, []); + this.manager.createOrUpdateLanguageModels(...this.createCustomModelDescriptionsFromPreferences(customModels)); + } + + protected createOpenAIModelDescription(modelId: string): OpenAiModelDescription { + const id = `${OPENAI_PROVIDER_ID}/${modelId}`; + const maxRetries = this.aiCorePreferences.get(PREFERENCE_NAME_MAX_RETRIES) ?? 3; + const useResponseApi = this.preferenceService.get(USE_RESPONSE_API_PREF, false); + return { + id: id, + model: modelId, + apiKey: true, + apiVersion: true, + developerMessageSettings: openAIModelsNotSupportingDeveloperMessages.includes(modelId) ? 'user' : 'developer', + enableStreaming: !openAIModelsWithDisabledStreaming.includes(modelId), + supportsStructuredOutput: !openAIModelsWithoutStructuredOutput.includes(modelId), + maxRetries: maxRetries, + useResponseApi: useResponseApi + }; + } + + protected createCustomModelDescriptionsFromPreferences( + preferences: Partial[] + ): OpenAiModelDescription[] { + const maxRetries = this.aiCorePreferences.get(PREFERENCE_NAME_MAX_RETRIES) ?? 3; + return preferences.reduce((acc, pref) => { + if (!pref.model || !pref.url || typeof pref.model !== 'string' || typeof pref.url !== 'string') { + return acc; + } + + return [ + ...acc, + { + id: pref.id && typeof pref.id === 'string' ? pref.id : pref.model, + model: pref.model, + url: pref.url, + deployment: typeof pref.deployment === 'string' && pref.deployment ? pref.deployment : undefined, + apiKey: typeof pref.apiKey === 'string' || pref.apiKey === true ? pref.apiKey : undefined, + apiVersion: typeof pref.apiVersion === 'string' || pref.apiVersion === true ? pref.apiVersion : undefined, + developerMessageSettings: pref.developerMessageSettings ?? 'developer', + supportsStructuredOutput: pref.supportsStructuredOutput ?? true, + enableStreaming: pref.enableStreaming ?? true, + maxRetries: pref.maxRetries ?? maxRetries, + useResponseApi: pref.useResponseApi ?? false + } + ]; + }, []); + } +} + +const openAIModelsWithDisabledStreaming: string[] = []; +const openAIModelsNotSupportingDeveloperMessages = ['o1-preview', 'o1-mini']; +const openAIModelsWithoutStructuredOutput = ['o1-preview', 'gpt-4-turbo', 'gpt-4', 'gpt-3.5-turbo', 'o1-mini', 'gpt-4o-2024-05-13']; diff --git a/packages/ai-openai/src/browser/openai-frontend-module.ts b/packages/ai-openai/src/browser/openai-frontend-module.ts new file mode 100644 index 0000000..2063ec8 --- /dev/null +++ b/packages/ai-openai/src/browser/openai-frontend-module.ts @@ -0,0 +1,32 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { ContainerModule } from '@theia/core/shared/inversify'; +import { OpenAiPreferencesSchema } from '../common/openai-preferences'; +import { FrontendApplicationContribution, RemoteConnectionProvider, ServiceConnectionProvider } from '@theia/core/lib/browser'; +import { OpenAiFrontendApplicationContribution } from './openai-frontend-application-contribution'; +import { OPENAI_LANGUAGE_MODELS_MANAGER_PATH, OpenAiLanguageModelsManager } from '../common'; +import { PreferenceContribution } from '@theia/core'; + +export default new ContainerModule(bind => { + bind(PreferenceContribution).toConstantValue({ schema: OpenAiPreferencesSchema }); + bind(OpenAiFrontendApplicationContribution).toSelf().inSingletonScope(); + bind(FrontendApplicationContribution).toService(OpenAiFrontendApplicationContribution); + bind(OpenAiLanguageModelsManager).toDynamicValue(ctx => { + const provider = ctx.container.get(RemoteConnectionProvider); + return provider.createProxy(OPENAI_LANGUAGE_MODELS_MANAGER_PATH); + }).inSingletonScope(); +}); diff --git a/packages/ai-openai/src/common/index.ts b/packages/ai-openai/src/common/index.ts new file mode 100644 index 0000000..d79fbf6 --- /dev/null +++ b/packages/ai-openai/src/common/index.ts @@ -0,0 +1,16 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** +export * from './openai-language-models-manager'; diff --git a/packages/ai-openai/src/common/openai-language-models-manager.ts b/packages/ai-openai/src/common/openai-language-models-manager.ts new file mode 100644 index 0000000..fc60d18 --- /dev/null +++ b/packages/ai-openai/src/common/openai-language-models-manager.ts @@ -0,0 +1,79 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** +export const OPENAI_LANGUAGE_MODELS_MANAGER_PATH = '/services/open-ai/language-model-manager'; +export const OpenAiLanguageModelsManager = Symbol('OpenAiLanguageModelsManager'); + +export const OPENAI_PROVIDER_ID = 'openai'; + +export interface OpenAiModelDescription { + /** + * The identifier of the model which will be shown in the UI. + */ + id: string; + /** + * The model ID as used by the OpenAI API. + */ + model: string; + /** + * The OpenAI API compatible endpoint where the model is hosted. If not provided the default OpenAI endpoint will be used. + */ + url?: string; + /** + * The key for the model. If 'true' is provided the global OpenAI API key will be used. + */ + apiKey: string | true | undefined; + /** + * The version for the api. If 'true' is provided the global OpenAI version will be used. + */ + apiVersion: string | true | undefined; + /** + * Optional deployment name for Azure OpenAI. + */ + deployment?: string; + /** + * Indicate whether the streaming API shall be used. + */ + enableStreaming: boolean; + /** + * Property to configure the developer message of the model. Setting this property to 'user', 'system', or 'developer' will use that string as the role for the system message. + * Setting it to 'mergeWithFollowingUserMessage' will prefix the following user message with the system message or convert the system message to user if the following message + * is not a user message. 'skip' will remove the system message altogether. + * Defaults to 'developer'. + */ + developerMessageSettings?: 'user' | 'system' | 'developer' | 'mergeWithFollowingUserMessage' | 'skip'; + /** + * Flag to configure whether the OpenAPI model supports structured output. Default is `true`. + */ + supportsStructuredOutput: boolean; + /** + * Maximum number of retry attempts when a request fails. Default is 3. + */ + maxRetries: number; + /** + * Flag to configure whether to use the newer OpenAI Response API instead of the Chat Completion API. + * For official OpenAI models, this defaults to `true`. For custom providers, users must explicitly enable it. + * Default is `false` for custom models. + */ + useResponseApi?: boolean; +} +export interface OpenAiLanguageModelsManager { + apiKey: string | undefined; + setApiKey(key: string | undefined): void; + setApiVersion(version: string | undefined): void; + setProxyUrl(proxyUrl: string | undefined): void; + createOrUpdateLanguageModels(...models: OpenAiModelDescription[]): Promise; + removeLanguageModels(...modelIds: string[]): void +} diff --git a/packages/ai-openai/src/common/openai-preferences.ts b/packages/ai-openai/src/common/openai-preferences.ts new file mode 100644 index 0000000..c2a2c99 --- /dev/null +++ b/packages/ai-openai/src/common/openai-preferences.ts @@ -0,0 +1,152 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { AI_CORE_PREFERENCES_TITLE } from '@theia/ai-core/lib/common/ai-core-preferences'; +import { nls, PreferenceSchema } from '@theia/core'; + +export const API_KEY_PREF = 'ai-features.openAiOfficial.openAiApiKey'; +export const MODELS_PREF = 'ai-features.openAiOfficial.officialOpenAiModels'; +export const USE_RESPONSE_API_PREF = 'ai-features.openAiOfficial.useResponseApi'; +export const CUSTOM_ENDPOINTS_PREF = 'ai-features.openAiCustom.customOpenAiModels'; + +export const OpenAiPreferencesSchema: PreferenceSchema = { + properties: { + [API_KEY_PREF]: { + type: 'string', + markdownDescription: nls.localize('theia/ai/openai/apiKey/mdDescription', + 'Enter an API Key of your official OpenAI Account. **Please note:** By using this preference the Open AI API key will be stored in clear text \ +on the machine running Theia. Use the environment variable `OPENAI_API_KEY` to set the key securely.'), + title: AI_CORE_PREFERENCES_TITLE, + }, + [MODELS_PREF]: { + type: 'array', + description: nls.localize('theia/ai/openai/models/description', 'Official OpenAI models to use'), + title: AI_CORE_PREFERENCES_TITLE, + default: [ + 'gpt-5.2', + 'gpt-5.2-pro', + 'gpt-5.1', + 'gpt-5', + 'gpt-5-mini', + 'gpt-4.1', + 'gpt-4.1-mini', + 'gpt-4o' + ], + items: { + type: 'string' + } + }, + [USE_RESPONSE_API_PREF]: { + type: 'boolean', + default: false, + title: AI_CORE_PREFERENCES_TITLE, + markdownDescription: nls.localize('theia/ai/openai/useResponseApi/mdDescription', + 'Use the newer OpenAI Response API instead of the Chat Completion API for official OpenAI models.\ +\ +This setting only applies to official OpenAI models - custom providers must configure this individually.\ +\ +Note that for the response API, tool call definitions must satisfy Open AI\'s [strict schema definition](https://platform.openai.com/docs/guides/function-calling#strict-mode).\ +Best effort is made to convert non-conformant schemas, but errors are still possible.') + }, + [CUSTOM_ENDPOINTS_PREF]: { + type: 'array', + title: AI_CORE_PREFERENCES_TITLE, + markdownDescription: nls.localize('theia/ai/openai/customEndpoints/mdDescription', + 'Integrate custom models compatible with the OpenAI API, for example via `vllm`. The required attributes are `model` and `url`.\ + \n\ + Optionally, you can\ + \n\ + - specify a unique `id` to identify the custom model in the UI. If none is given `model` will be used as `id`.\ + \n\ + - provide an `apiKey` to access the API served at the given url. Use `true` to indicate the use of the global OpenAI API key.\ + \n\ + - provide an `apiVersion` to access the API served at the given url in Azure. Use `true` to indicate the use of the global OpenAI API version.\ + \n\ + - provide a `deployment` name for your Azure deployment.\ + \n\ + - set `developerMessageSettings` to one of `user`, `system`, `developer`, `mergeWithFollowingUserMessage`, or `skip` to control how the developer message is\ + included (where `user`, `system`, and `developer` will be used as a role, `mergeWithFollowingUserMessage` will prefix the following user message with the system\ + message or convert the system message to user message if the next message is not a user message. `skip` will just remove the system message).\ + Defaulting to `developer`.\ + \n\ + - specify `supportsStructuredOutput: false` to indicate that structured output shall not be used.\ + \n\ + - specify `enableStreaming: false` to indicate that streaming shall not be used.\ + \n\ + - specify `useResponseApi: true` to use the newer OpenAI Response API instead of the Chat Completion API (requires compatible endpoint).\ + \n\ + Refer to [our documentation](https://theia-ide.org/docs/user_ai/#openai-compatible-models-eg-via-vllm) for more information.'), + default: [], + items: { + type: 'object', + properties: { + model: { + type: 'string', + title: nls.localize('theia/ai/openai/customEndpoints/modelId/title', 'Model ID') + }, + url: { + type: 'string', + title: nls.localize('theia/ai/openai/customEndpoints/url/title', 'The Open AI API compatible endpoint where the model is hosted') + }, + id: { + type: 'string', + title: nls.localize('theia/ai/openai/customEndpoints/id/title', 'A unique identifier which is used in the UI to identify the custom model'), + }, + apiKey: { + type: ['string', 'boolean'], + title: nls.localize('theia/ai/openai/customEndpoints/apiKey/title', + 'Either the key to access the API served at the given url or `true` to use the global OpenAI API key'), + }, + apiVersion: { + type: ['string', 'boolean'], + title: nls.localize('theia/ai/openai/customEndpoints/apiVersion/title', + 'Either the version to access the API served at the given url in Azure or `true` to use the global OpenAI API version'), + }, + deployment: { + type: 'string', + title: nls.localize('theia/ai/openai/customEndpoints/deployment/title', + 'The deployment name to access the API served at the given url in Azure'), + }, + developerMessageSettings: { + type: 'string', + enum: ['user', 'system', 'developer', 'mergeWithFollowingUserMessage', 'skip'], + default: 'developer', + title: nls.localize('theia/ai/openai/customEndpoints/developerMessageSettings/title', + 'Controls the handling of system messages: `user`, `system`, and `developer` will be used as a role, `mergeWithFollowingUserMessage` will prefix\ + the following user message with the system message or convert the system message to user message if the next message is not a user message.\ + `skip` will just remove the system message), defaulting to `developer`.') + }, + supportsStructuredOutput: { + type: 'boolean', + title: nls.localize('theia/ai/openai/customEndpoints/supportsStructuredOutput/title', + 'Indicates whether the model supports structured output. `true` by default.'), + }, + enableStreaming: { + type: 'boolean', + title: nls.localize('theia/ai/openai/customEndpoints/enableStreaming/title', + 'Indicates whether the streaming API shall be used. `true` by default.'), + }, + useResponseApi: { + type: 'boolean', + title: nls.localize('theia/ai/openai/customEndpoints/useResponseApi/title', + 'Use the newer OpenAI Response API instead of the Chat Completion API. `false` by default for custom providers.' + + 'Note: Will automatically fall back to Chat Completions API when tools are used.'), + } + } + } + } + } +}; diff --git a/packages/ai-openai/src/node/openai-backend-module.ts b/packages/ai-openai/src/node/openai-backend-module.ts new file mode 100644 index 0000000..5e7cedc --- /dev/null +++ b/packages/ai-openai/src/node/openai-backend-module.ts @@ -0,0 +1,42 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { ContainerModule } from '@theia/core/shared/inversify'; +import { OPENAI_LANGUAGE_MODELS_MANAGER_PATH, OpenAiLanguageModelsManager } from '../common/openai-language-models-manager'; +import { ConnectionHandler, PreferenceContribution, RpcConnectionHandler } from '@theia/core'; +import { OpenAiLanguageModelsManagerImpl } from './openai-language-models-manager-impl'; +import { ConnectionContainerModule } from '@theia/core/lib/node/messaging/connection-container-module'; +import { OpenAiModelUtils } from './openai-language-model'; +import { OpenAiResponseApiUtils } from './openai-response-api-utils'; +import { OpenAiPreferencesSchema } from '../common/openai-preferences'; + +export const OpenAiModelFactory = Symbol('OpenAiModelFactory'); + +// We use a connection module to handle AI services separately for each frontend. +const openAiConnectionModule = ConnectionContainerModule.create(({ bind, bindBackendService, bindFrontendService }) => { + bind(OpenAiLanguageModelsManagerImpl).toSelf().inSingletonScope(); + bind(OpenAiLanguageModelsManager).toService(OpenAiLanguageModelsManagerImpl); + bind(ConnectionHandler).toDynamicValue(ctx => + new RpcConnectionHandler(OPENAI_LANGUAGE_MODELS_MANAGER_PATH, () => ctx.container.get(OpenAiLanguageModelsManager)) + ).inSingletonScope(); +}); + +export default new ContainerModule(bind => { + bind(PreferenceContribution).toConstantValue({ schema: OpenAiPreferencesSchema }); + bind(OpenAiModelUtils).toSelf().inSingletonScope(); + bind(OpenAiResponseApiUtils).toSelf().inSingletonScope(); + bind(ConnectionContainerModule).toConstantValue(openAiConnectionModule); +}); diff --git a/packages/ai-openai/src/node/openai-language-model.ts b/packages/ai-openai/src/node/openai-language-model.ts new file mode 100644 index 0000000..408c599 --- /dev/null +++ b/packages/ai-openai/src/node/openai-language-model.ts @@ -0,0 +1,392 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { + LanguageModel, + LanguageModelParsedResponse, + LanguageModelRequest, + LanguageModelMessage, + LanguageModelResponse, + LanguageModelTextResponse, + TokenUsageService, + UserRequest, + ImageContent, + LanguageModelStatus +} from '@theia/ai-core'; +import { CancellationToken } from '@theia/core'; +import { injectable } from '@theia/core/shared/inversify'; +import { OpenAI, AzureOpenAI } from 'openai'; +import { ChatCompletionStream } from 'openai/lib/ChatCompletionStream'; +import { RunnableToolFunctionWithoutParse } from 'openai/lib/RunnableFunction'; +import { ChatCompletionMessageParam } from 'openai/resources'; +import { StreamingAsyncIterator } from './openai-streaming-iterator'; +import { OPENAI_PROVIDER_ID } from '../common'; +import type { FinalRequestOptions } from 'openai/internal/request-options'; +import type { RunnerOptions } from 'openai/lib/AbstractChatCompletionRunner'; +import { OpenAiResponseApiUtils, processSystemMessages } from './openai-response-api-utils'; +import * as undici from 'undici'; + +export class MistralFixedOpenAI extends OpenAI { + protected override async prepareOptions(options: FinalRequestOptions): Promise { + const messages = (options.body as { messages: Array }).messages; + if (Array.isArray(messages)) { + (options.body as { messages: Array }).messages.forEach(m => { + if (m.role === 'assistant' && m.tool_calls) { + // Mistral OpenAI Endpoint expects refusal to be undefined and not null for optional properties + // eslint-disable-next-line no-null/no-null + if (m.refusal === null) { + m.refusal = undefined; + } + // Mistral OpenAI Endpoint expects parsed to be undefined and not null for optional properties + // eslint-disable-next-line no-null/no-null + if ((m as unknown as { parsed: null | undefined }).parsed === null) { + (m as unknown as { parsed: null | undefined }).parsed = undefined; + } + } + }); + } + return super.prepareOptions(options); + }; +} + +export const OpenAiModelIdentifier = Symbol('OpenAiModelIdentifier'); + +export type DeveloperMessageSettings = 'user' | 'system' | 'developer' | 'mergeWithFollowingUserMessage' | 'skip'; + +export class OpenAiModel implements LanguageModel { + + /** + * The options for the OpenAI runner. + */ + protected runnerOptions: RunnerOptions = { + // The maximum number of chat completions to return in a single request. + // Each function call counts as a chat completion. + // To support use cases with many function calls (e.g. @Coder), we set this to a high value. + maxChatCompletions: 100, + }; + + /** + * @param id the unique id for this language model. It will be used to identify the model in the UI. + * @param model the model id as it is used by the OpenAI API + * @param enableStreaming whether the streaming API shall be used + * @param apiKey a function that returns the API key to use for this model, called on each request + * @param apiVersion a function that returns the OpenAPI version to use for this model, called on each request + * @param developerMessageSettings how to handle system messages + * @param url the OpenAI API compatible endpoint where the model is hosted. If not provided the default OpenAI endpoint will be used. + * @param maxRetries the maximum number of retry attempts when a request fails + * @param useResponseApi whether to use the newer OpenAI Response API instead of the Chat Completion API + */ + constructor( + public readonly id: string, + public model: string, + public status: LanguageModelStatus, + public enableStreaming: boolean, + public apiKey: () => string | undefined, + public apiVersion: () => string | undefined, + public supportsStructuredOutput: boolean, + public url: string | undefined, + public deployment: string | undefined, + public openAiModelUtils: OpenAiModelUtils, + public responseApiUtils: OpenAiResponseApiUtils, + public developerMessageSettings: DeveloperMessageSettings = 'developer', + public maxRetries: number = 3, + public useResponseApi: boolean = false, + protected readonly tokenUsageService?: TokenUsageService, + protected proxy?: string + ) { } + + protected getSettings(request: LanguageModelRequest): Record { + return request.settings ?? {}; + } + + async request(request: UserRequest, cancellationToken?: CancellationToken): Promise { + const openai = this.initializeOpenAi(); + + return this.useResponseApi ? + this.handleResponseApiRequest(openai, request, cancellationToken) + : this.handleChatCompletionsRequest(openai, request, cancellationToken); + } + + protected async handleChatCompletionsRequest(openai: OpenAI, request: UserRequest, cancellationToken?: CancellationToken): Promise { + const settings = this.getSettings(request); + + if (request.response_format?.type === 'json_schema' && this.supportsStructuredOutput) { + return this.handleStructuredOutputRequest(openai, request); + } + + if (this.isNonStreamingModel(this.model) || (typeof settings.stream === 'boolean' && !settings.stream)) { + return this.handleNonStreamingRequest(openai, request); + } + + if (this.id.startsWith(`${OPENAI_PROVIDER_ID}/`)) { + settings['stream_options'] = { include_usage: true }; + } + + if (cancellationToken?.isCancellationRequested) { + return { text: '' }; + } + let runner: ChatCompletionStream; + const tools = this.createTools(request); + + if (tools) { + runner = openai.chat.completions.runTools({ + model: this.model, + messages: this.processMessages(request.messages), + stream: true, + tools: tools, + tool_choice: 'auto', + ...settings + }, { + ...this.runnerOptions, maxRetries: this.maxRetries + }); + } else { + runner = openai.chat.completions.stream({ + model: this.model, + messages: this.processMessages(request.messages), + stream: true, + ...settings + }); + } + + return { stream: new StreamingAsyncIterator(runner, request.requestId, cancellationToken, this.tokenUsageService, this.id) }; + } + + protected async handleNonStreamingRequest(openai: OpenAI, request: UserRequest): Promise { + const settings = this.getSettings(request); + const response = await openai.chat.completions.create({ + model: this.model, + messages: this.processMessages(request.messages), + ...settings + }); + + const message = response.choices[0].message; + + // Record token usage if token usage service is available + if (this.tokenUsageService && response.usage) { + await this.tokenUsageService.recordTokenUsage( + this.id, + { + inputTokens: response.usage.prompt_tokens, + outputTokens: response.usage.completion_tokens, + requestId: request.requestId + } + ); + } + + return { + text: message.content ?? '' + }; + } + + protected isNonStreamingModel(_model: string): boolean { + return !this.enableStreaming; + } + + protected async handleStructuredOutputRequest(openai: OpenAI, request: UserRequest): Promise { + const settings = this.getSettings(request); + // TODO implement tool support for structured output (parse() seems to require different tool format) + const result = await openai.chat.completions.parse({ + model: this.model, + messages: this.processMessages(request.messages), + response_format: request.response_format, + ...settings + }); + const message = result.choices[0].message; + if (message.refusal || message.parsed === undefined) { + console.error('Error in OpenAI chat completion stream:', JSON.stringify(message)); + } + + // Record token usage if token usage service is available + if (this.tokenUsageService && result.usage) { + await this.tokenUsageService.recordTokenUsage( + this.id, + { + inputTokens: result.usage.prompt_tokens, + outputTokens: result.usage.completion_tokens, + requestId: request.requestId + } + ); + } + + return { + content: message.content ?? '', + parsed: message.parsed + }; + } + + protected createTools(request: LanguageModelRequest): RunnableToolFunctionWithoutParse[] | undefined { + return request.tools?.map(tool => ({ + type: 'function', + function: { + name: tool.name, + description: tool.description, + parameters: tool.parameters, + function: (args_string: string) => tool.handler(args_string) + } + } as RunnableToolFunctionWithoutParse)); + } + + protected initializeOpenAi(): OpenAI { + const apiKey = this.apiKey(); + if (!apiKey && !(this.url)) { + throw new Error('Please provide OPENAI_API_KEY in preferences or via environment variable'); + } + + const apiVersion = this.apiVersion(); + // We need to hand over "some" key, even if a custom url is not key protected as otherwise the OpenAI client will throw an error + const key = apiKey ?? 'no-key'; + + let fo; + if (this.proxy) { + const proxyAgent = new undici.ProxyAgent(this.proxy); + fo = { + dispatcher: proxyAgent, + }; + } + + if (apiVersion) { + return new AzureOpenAI({ apiKey: key, baseURL: this.url, apiVersion: apiVersion, deployment: this.deployment, fetchOptions: fo }); + } else { + return new MistralFixedOpenAI({ apiKey: key, baseURL: this.url, fetchOptions: fo }); + } + } + + protected async handleResponseApiRequest(openai: OpenAI, request: UserRequest, cancellationToken?: CancellationToken): Promise { + const settings = this.getSettings(request); + const isStreamingRequest = this.enableStreaming && !(typeof settings.stream === 'boolean' && !settings.stream); + + try { + return await this.responseApiUtils.handleRequest( + openai, + request, + settings, + this.model, + this.openAiModelUtils, + this.developerMessageSettings, + this.runnerOptions, + this.id, + isStreamingRequest, + this.tokenUsageService, + cancellationToken + ); + } catch (error) { + // If Response API fails, fall back to Chat Completions API + if (error instanceof Error) { + console.warn(`Response API failed for model ${this.id}, falling back to Chat Completions API:`, error.message); + return this.handleChatCompletionsRequest(openai, request, cancellationToken); + } + throw error; + } + } + + protected processMessages(messages: LanguageModelMessage[]): ChatCompletionMessageParam[] { + return this.openAiModelUtils.processMessages(messages, this.developerMessageSettings, this.model); + } +} + +/** + * Utility class for processing messages for the OpenAI language model. + * + * Adopters can rebind this class to implement custom message processing behavior. + */ +@injectable() +export class OpenAiModelUtils { + + protected processSystemMessages( + messages: LanguageModelMessage[], + developerMessageSettings: DeveloperMessageSettings + ): LanguageModelMessage[] { + return processSystemMessages(messages, developerMessageSettings); + } + + protected toOpenAiRole( + message: LanguageModelMessage, + developerMessageSettings: DeveloperMessageSettings + ): 'developer' | 'user' | 'assistant' | 'system' { + if (message.actor === 'system') { + if (developerMessageSettings === 'user' || developerMessageSettings === 'system' || developerMessageSettings === 'developer') { + return developerMessageSettings; + } else { + return 'developer'; + } + } else if (message.actor === 'ai') { + return 'assistant'; + } + return 'user'; + } + + protected toOpenAIMessage( + message: LanguageModelMessage, + developerMessageSettings: DeveloperMessageSettings + ): ChatCompletionMessageParam { + if (LanguageModelMessage.isTextMessage(message)) { + return { + role: this.toOpenAiRole(message, developerMessageSettings), + content: message.text + }; + } + if (LanguageModelMessage.isToolUseMessage(message)) { + return { + role: 'assistant', + tool_calls: [{ id: message.id, function: { name: message.name, arguments: JSON.stringify(message.input) }, type: 'function' }] + }; + } + if (LanguageModelMessage.isToolResultMessage(message)) { + return { + role: 'tool', + tool_call_id: message.tool_use_id, + // content only supports text content so we need to stringify any potential data we have, e.g., images + content: typeof message.content === 'string' ? message.content : JSON.stringify(message.content) + }; + } + if (LanguageModelMessage.isImageMessage(message) && message.actor === 'user') { + return { + role: 'user', + content: [{ + type: 'image_url', + image_url: { + url: + ImageContent.isBase64(message.image) ? + `data:${message.image.mimeType};base64,${message.image.base64data}` : + message.image.url + } + }] + }; + } + throw new Error(`Unknown message type:'${JSON.stringify(message)}'`); + } + + /** + * Processes the provided list of messages by applying system message adjustments and converting + * them to the format expected by the OpenAI API. + * + * Adopters can rebind this processing to implement custom behavior. + * + * @param messages the list of messages to process. + * @param developerMessageSettings how system and developer messages are handled during processing. + * @param model the OpenAI model identifier. Currently not used, but allows subclasses to implement model-specific behavior. + * @returns an array of messages formatted for the OpenAI API. + */ + processMessages( + messages: LanguageModelMessage[], + developerMessageSettings: DeveloperMessageSettings, + model?: string + ): ChatCompletionMessageParam[] { + const processed = this.processSystemMessages(messages, developerMessageSettings); + return processed.filter(m => m.type !== 'thinking').map(m => this.toOpenAIMessage(m, developerMessageSettings)); + } + +} diff --git a/packages/ai-openai/src/node/openai-language-models-manager-impl.ts b/packages/ai-openai/src/node/openai-language-models-manager-impl.ts new file mode 100644 index 0000000..3187fb2 --- /dev/null +++ b/packages/ai-openai/src/node/openai-language-models-manager-impl.ts @@ -0,0 +1,179 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { LanguageModelRegistry, LanguageModelStatus, TokenUsageService } from '@theia/ai-core'; +import { inject, injectable } from '@theia/core/shared/inversify'; +import { OpenAiModel, OpenAiModelUtils } from './openai-language-model'; +import { OpenAiResponseApiUtils } from './openai-response-api-utils'; +import { OpenAiLanguageModelsManager, OpenAiModelDescription } from '../common'; + +@injectable() +export class OpenAiLanguageModelsManagerImpl implements OpenAiLanguageModelsManager { + + @inject(OpenAiModelUtils) + protected readonly openAiModelUtils: OpenAiModelUtils; + + @inject(OpenAiResponseApiUtils) + protected readonly responseApiUtils: OpenAiResponseApiUtils; + + protected _apiKey: string | undefined; + protected _apiVersion: string | undefined; + protected _proxyUrl: string | undefined; + + @inject(LanguageModelRegistry) + protected readonly languageModelRegistry: LanguageModelRegistry; + + @inject(TokenUsageService) + protected readonly tokenUsageService: TokenUsageService; + + get apiKey(): string | undefined { + return this._apiKey ?? process.env.OPENAI_API_KEY; + } + + get apiVersion(): string | undefined { + return this._apiVersion ?? process.env.OPENAI_API_VERSION; + } + + protected calculateStatus(modelDescription: OpenAiModelDescription, effectiveApiKey: string | undefined): LanguageModelStatus { + // Always mark custom models (models with url) as ready for now as we do not know about API Key requirements + if (modelDescription.url) { + return { status: 'ready' }; + } + return effectiveApiKey + ? { status: 'ready' } + : { status: 'unavailable', message: 'No OpenAI API key set' }; + } + + // Triggered from frontend. In case you want to use the models on the backend + // without a frontend then call this yourself + async createOrUpdateLanguageModels(...modelDescriptions: OpenAiModelDescription[]): Promise { + for (const modelDescription of modelDescriptions) { + const model = await this.languageModelRegistry.getLanguageModel(modelDescription.id); + const apiKeyProvider = () => { + if (modelDescription.apiKey === true) { + return this.apiKey; + } + if (modelDescription.apiKey) { + return modelDescription.apiKey; + } + return undefined; + }; + const apiVersionProvider = () => { + if (modelDescription.apiVersion === true) { + return this.apiVersion; + } + if (modelDescription.apiVersion) { + return modelDescription.apiVersion; + } + return undefined; + }; + const proxyUrlProvider = (url: string | undefined) => { + // first check if the proxy url is provided via Theia settings + if (this._proxyUrl) { + return this._proxyUrl; + } + + // if not fall back to the environment variables + let protocolVar; + if (url && url.startsWith('http:')) { + protocolVar = 'http_proxy'; + } else if (url && url.startsWith('https:')) { + protocolVar = 'https_proxy'; + } + + if (protocolVar) { + // Get the environment variable + return process.env[protocolVar]; + } + + // neither the settings nor the environment variable is set + return undefined; + }; + + // Determine the effective API key for status + const status = this.calculateStatus(modelDescription, apiKeyProvider()); + + if (model) { + if (!(model instanceof OpenAiModel)) { + console.warn(`OpenAI: model ${modelDescription.id} is not an OpenAI model`); + continue; + } + await this.languageModelRegistry.patchLanguageModel(modelDescription.id, { + model: modelDescription.model, + enableStreaming: modelDescription.enableStreaming, + url: modelDescription.url, + apiKey: apiKeyProvider, + apiVersion: apiVersionProvider, + deployment: modelDescription.deployment, + developerMessageSettings: modelDescription.developerMessageSettings || 'developer', + supportsStructuredOutput: modelDescription.supportsStructuredOutput, + status, + maxRetries: modelDescription.maxRetries, + useResponseApi: modelDescription.useResponseApi ?? false + }); + } else { + this.languageModelRegistry.addLanguageModels([ + new OpenAiModel( + modelDescription.id, + modelDescription.model, + status, + modelDescription.enableStreaming, + apiKeyProvider, + apiVersionProvider, + modelDescription.supportsStructuredOutput, + modelDescription.url, + modelDescription.deployment, + this.openAiModelUtils, + this.responseApiUtils, + modelDescription.developerMessageSettings, + modelDescription.maxRetries, + modelDescription.useResponseApi ?? false, + this.tokenUsageService, + proxyUrlProvider(modelDescription.url) + ) + ]); + } + } + } + + removeLanguageModels(...modelIds: string[]): void { + this.languageModelRegistry.removeLanguageModels(modelIds); + } + + setApiKey(apiKey: string | undefined): void { + if (apiKey) { + this._apiKey = apiKey; + } else { + this._apiKey = undefined; + } + } + + setApiVersion(apiVersion: string | undefined): void { + if (apiVersion) { + this._apiVersion = apiVersion; + } else { + this._apiVersion = undefined; + } + } + + setProxyUrl(proxyUrl: string | undefined): void { + if (proxyUrl) { + this._proxyUrl = proxyUrl; + } else { + this._proxyUrl = undefined; + } + } +} diff --git a/packages/ai-openai/src/node/openai-model-utils.spec.ts b/packages/ai-openai/src/node/openai-model-utils.spec.ts new file mode 100644 index 0000000..98075bf --- /dev/null +++ b/packages/ai-openai/src/node/openai-model-utils.spec.ts @@ -0,0 +1,502 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** +import { expect } from 'chai'; +import { OpenAiModelUtils } from './openai-language-model'; +import { LanguageModelMessage } from '@theia/ai-core'; +import { OpenAiResponseApiUtils, recursiveStrictJSONSchema } from './openai-response-api-utils'; +import type { JSONSchema, JSONSchemaDefinition } from 'openai/lib/jsonschema'; + +const utils = new OpenAiModelUtils(); +const responseUtils = new OpenAiResponseApiUtils(); + +describe('OpenAiModelUtils - processMessages', () => { + describe("when developerMessageSettings is 'skip'", () => { + it('should remove all system messages', () => { + const messages: LanguageModelMessage[] = [ + { actor: 'system', type: 'text', text: 'system message' }, + { actor: 'user', type: 'text', text: 'user message' }, + { actor: 'system', type: 'text', text: 'another system message' }, + ]; + const result = utils.processMessages(messages, 'skip', 'gpt-4'); + expect(result).to.deep.equal([ + { role: 'user', content: 'user message' } + ]); + }); + + it('should do nothing if there is no system message', () => { + const messages: LanguageModelMessage[] = [ + { actor: 'user', type: 'text', text: 'user message' }, + { actor: 'user', type: 'text', text: 'another user message' }, + { actor: 'ai', type: 'text', text: 'ai message' } + ]; + const result = utils.processMessages(messages, 'skip', 'gpt-4'); + expect(result).to.deep.equal([ + { role: 'user', content: 'user message' }, + { role: 'user', content: 'another user message' }, + { role: 'assistant', content: 'ai message' } + ]); + }); + }); + + describe("when developerMessageSettings is 'mergeWithFollowingUserMessage'", () => { + it('should merge the system message with the next user message, assign role user, and remove the system message', () => { + const messages: LanguageModelMessage[] = [ + { actor: 'system', type: 'text', text: 'system msg' }, + { actor: 'user', type: 'text', text: 'user msg' }, + { actor: 'ai', type: 'text', text: 'ai message' } + ]; + const result = utils.processMessages(messages, 'mergeWithFollowingUserMessage', 'gpt-4'); + expect(result).to.deep.equal([ + { role: 'user', content: 'system msg\nuser msg' }, + { role: 'assistant', content: 'ai message' } + ]); + }); + + it('should create a new user message if no user message exists, and remove the system message', () => { + const messages: LanguageModelMessage[] = [ + { actor: 'system', type: 'text', text: 'system only msg' }, + { actor: 'ai', type: 'text', text: 'ai message' } + ]; + const result = utils.processMessages(messages, 'mergeWithFollowingUserMessage', 'gpt-4'); + expect(result).to.deep.equal([ + { role: 'user', content: 'system only msg' }, + { role: 'assistant', content: 'ai message' } + ]); + }); + + it('should create a merge multiple system message with the next user message', () => { + const messages: LanguageModelMessage[] = [ + { actor: 'user', type: 'text', text: 'user message' }, + { actor: 'system', type: 'text', text: 'system message' }, + { actor: 'system', type: 'text', text: 'system message2' }, + { actor: 'user', type: 'text', text: 'user message2' }, + { actor: 'ai', type: 'text', text: 'ai message' } + ]; + const result = utils.processMessages(messages, 'mergeWithFollowingUserMessage', 'gpt-4'); + expect(result).to.deep.equal([ + { role: 'user', content: 'user message' }, + { role: 'user', content: 'system message\nsystem message2\nuser message2' }, + { role: 'assistant', content: 'ai message' } + ]); + }); + + it('should create a new user message from several system messages if the next message is not a user message', () => { + const messages: LanguageModelMessage[] = [ + { actor: 'user', type: 'text', text: 'user message' }, + { actor: 'system', type: 'text', text: 'system message' }, + { actor: 'system', type: 'text', text: 'system message2' }, + { actor: 'ai', type: 'text', text: 'ai message' } + ]; + const result = utils.processMessages(messages, 'mergeWithFollowingUserMessage', 'gpt-4'); + expect(result).to.deep.equal([ + { role: 'user', content: 'user message' }, + { role: 'user', content: 'system message\nsystem message2' }, + { role: 'assistant', content: 'ai message' } + ]); + }); + }); + + describe('when no special merging or skipping is needed', () => { + it('should leave messages unchanged in ordering and assign roles based on developerMessageSettings', () => { + const messages: LanguageModelMessage[] = [ + { actor: 'user', type: 'text', text: 'user message' }, + { actor: 'system', type: 'text', text: 'system message' }, + { actor: 'ai', type: 'text', text: 'ai message' } + ]; + // Using a developerMessageSettings that is not merge/skip, e.g., 'developer' + const result = utils.processMessages(messages, 'developer', 'gpt-4'); + expect(result).to.deep.equal([ + { role: 'user', content: 'user message' }, + { role: 'developer', content: 'system message' }, + { role: 'assistant', content: 'ai message' } + ]); + }); + }); + + describe('role assignment for system messages when developerMessageSettings is one of the role strings', () => { + it('should assign role as specified for a system message when developerMessageSettings is "user"', () => { + const messages: LanguageModelMessage[] = [ + { actor: 'system', type: 'text', text: 'system msg' }, + { actor: 'ai', type: 'text', text: 'ai msg' } + ]; + // Since the first message is system and developerMessageSettings is not merge/skip, ordering is not adjusted + const result = utils.processMessages(messages, 'user', 'gpt-4'); + expect(result).to.deep.equal([ + { role: 'user', content: 'system msg' }, + { role: 'assistant', content: 'ai msg' } + ]); + }); + + it('should assign role as specified for a system message when developerMessageSettings is "system"', () => { + const messages: LanguageModelMessage[] = [ + { actor: 'system', type: 'text', text: 'system msg' }, + { actor: 'ai', type: 'text', text: 'ai msg' } + ]; + const result = utils.processMessages(messages, 'system', 'gpt-4'); + expect(result).to.deep.equal([ + { role: 'system', content: 'system msg' }, + { role: 'assistant', content: 'ai msg' } + ]); + }); + + it('should assign role as specified for a system message when developerMessageSettings is "developer"', () => { + const messages: LanguageModelMessage[] = [ + { actor: 'system', type: 'text', text: 'system msg' }, + { actor: 'user', type: 'text', text: 'user msg' }, + { actor: 'ai', type: 'text', text: 'ai msg' } + ]; + const result = utils.processMessages(messages, 'developer', 'gpt-4'); + expect(result).to.deep.equal([ + { role: 'developer', content: 'system msg' }, + { role: 'user', content: 'user msg' }, + { role: 'assistant', content: 'ai msg' } + ]); + }); + }); +}); + +describe('OpenAiModelUtils - processMessagesForResponseApi', () => { + describe("when developerMessageSettings is 'skip'", () => { + it('should remove all system messages and return no instructions', () => { + const messages: LanguageModelMessage[] = [ + { actor: 'system', type: 'text', text: 'system message' }, + { actor: 'user', type: 'text', text: 'user message' }, + { actor: 'system', type: 'text', text: 'another system message' }, + ]; + const result = responseUtils.processMessages(messages, 'skip', 'gpt-4'); + expect(result.instructions).to.be.undefined; + expect(result.input).to.deep.equal([ + { + type: 'message', + role: 'user', + content: [{ type: 'input_text', text: 'user message' }] + } + ]); + }); + }); + + describe("when developerMessageSettings is 'mergeWithFollowingUserMessage'", () => { + it('should merge system message with user message and return no instructions', () => { + const messages: LanguageModelMessage[] = [ + { actor: 'system', type: 'text', text: 'system msg' }, + { actor: 'user', type: 'text', text: 'user msg' }, + { actor: 'ai', type: 'text', text: 'ai message' } + ]; + const result = responseUtils.processMessages(messages, 'mergeWithFollowingUserMessage', 'gpt-4'); + expect(result.instructions).to.be.undefined; + expect(result.input).to.have.lengthOf(2); + expect(result.input[0]).to.deep.equal({ + type: 'message', + role: 'user', + content: [{ type: 'input_text', text: 'system msg\nuser msg' }] + }); + const assistantMessage = result.input[1]; + expect(assistantMessage).to.deep.include({ + type: 'message', + role: 'assistant', + status: 'completed', + content: [{ type: 'output_text', text: 'ai message', annotations: [] }] + }); + if (assistantMessage.type === 'message' && 'id' in assistantMessage) { + expect(assistantMessage.id).to.be.a('string').and.to.match(/^msg_/); + } else { + throw new Error('Expected assistant message to have an id'); + } + }); + }); + + describe('when system messages should be converted to instructions', () => { + it('should extract system messages as instructions and convert other messages to input items', () => { + const messages: LanguageModelMessage[] = [ + { actor: 'system', type: 'text', text: 'You are a helpful assistant' }, + { actor: 'user', type: 'text', text: 'Hello!' }, + { actor: 'ai', type: 'text', text: 'Hi there!' } + ]; + const result = responseUtils.processMessages(messages, 'developer', 'gpt-4'); + expect(result.instructions).to.equal('You are a helpful assistant'); + expect(result.input).to.have.lengthOf(2); + expect(result.input[0]).to.deep.equal({ + type: 'message', + role: 'user', + content: [{ type: 'input_text', text: 'Hello!' }] + }); + const assistantMessage = result.input[1]; + expect(assistantMessage).to.deep.include({ + type: 'message', + role: 'assistant', + status: 'completed', + content: [{ type: 'output_text', text: 'Hi there!', annotations: [] }] + }); + if (assistantMessage.type === 'message' && 'id' in assistantMessage) { + expect(assistantMessage.id).to.be.a('string').and.to.match(/^msg_/); + } else { + throw new Error('Expected assistant message to have an id'); + } + }); + + it('should combine multiple system messages into instructions', () => { + const messages: LanguageModelMessage[] = [ + { actor: 'system', type: 'text', text: 'You are helpful' }, + { actor: 'system', type: 'text', text: 'Be concise' }, + { actor: 'user', type: 'text', text: 'What is 2+2?' } + ]; + const result = responseUtils.processMessages(messages, 'developer', 'gpt-4'); + expect(result.instructions).to.equal('You are helpful\nBe concise'); + expect(result.input).to.deep.equal([ + { + type: 'message', + role: 'user', + content: [{ type: 'input_text', text: 'What is 2+2?' }] + } + ]); + }); + }); + + describe('tool use and tool result messages', () => { + it('should convert tool use messages to function calls', () => { + const messages: LanguageModelMessage[] = [ + { actor: 'user', type: 'text', text: 'Calculate 2+2' }, + { + actor: 'ai', + type: 'tool_use', + id: 'call_123', + name: 'calculator', + input: { expression: '2+2' } + } + ]; + const result = responseUtils.processMessages(messages, 'developer', 'gpt-4'); + expect(result.input).to.deep.equal([ + { + type: 'message', + role: 'user', + content: [{ type: 'input_text', text: 'Calculate 2+2' }] + }, + { + type: 'function_call', + call_id: 'call_123', + name: 'calculator', + arguments: '{"expression":"2+2"}' + } + ]); + }); + + it('should convert tool result messages to function call outputs', () => { + const messages: LanguageModelMessage[] = [ + { + actor: 'user', + type: 'tool_result', + name: 'calculator', + tool_use_id: 'call_123', + content: '4' + } + ]; + const result = responseUtils.processMessages(messages, 'developer', 'gpt-4'); + expect(result.input).to.deep.equal([ + { + type: 'function_call_output', + call_id: 'call_123', + output: '4' + } + ]); + }); + + it('should stringify non-string tool result content', () => { + const messages: LanguageModelMessage[] = [ + { + actor: 'user', + type: 'tool_result', + name: 'data_processor', + tool_use_id: 'call_456', + content: { result: 'success', data: [1, 2, 3] } + } + ]; + const result = responseUtils.processMessages(messages, 'developer', 'gpt-4'); + expect(result.input).to.deep.equal([ + { + type: 'function_call_output', + call_id: 'call_456', + output: '{"result":"success","data":[1,2,3]}' + } + ]); + }); + }); + + describe('image messages', () => { + it('should convert base64 image messages to input image items', () => { + const messages: LanguageModelMessage[] = [ + { + actor: 'user', + type: 'image', + image: { + mimeType: 'image/png', + base64data: 'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPhfDwAChwGA60e6kgAAAABJRU5ErkJggg==' + } + } + ]; + const result = responseUtils.processMessages(messages, 'developer', 'gpt-4'); + expect(result.input).to.deep.equal([ + { + type: 'message', + role: 'user', + content: [{ + type: 'input_image', + detail: 'auto', + image_url: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPhfDwAChwGA60e6kgAAAABJRU5ErkJggg==' + }] + } + ]); + }); + + it('should convert URL image messages to input image items', () => { + const messages: LanguageModelMessage[] = [ + { + actor: 'user', + type: 'image', + image: { + url: 'https://example.com/image.png' + } + } + ]; + const result = responseUtils.processMessages(messages, 'developer', 'gpt-4'); + expect(result.input).to.deep.equal([ + { + type: 'message', + role: 'user', + content: [{ + type: 'input_image', + detail: 'auto', + image_url: 'https://example.com/image.png' + }] + } + ]); + }); + }); + + describe('error handling', () => { + it('should throw error for unknown message types', () => { + const invalidMessage = { + actor: 'user', + type: 'unknown_type', + someProperty: 'value' + }; + const messages = [invalidMessage] as unknown as LanguageModelMessage[]; + expect(() => responseUtils.processMessages(messages, 'developer', 'gpt-4')) + .to.throw('unhandled case'); + }); + }); + + describe('recursiveStrictJSONSchema', () => { + it('should return the same object and not modify it when schema has no properties to strictify', () => { + const schema: JSONSchema = { type: 'string', description: 'Simple string' }; + const originalJson = JSON.stringify(schema); + + const result = recursiveStrictJSONSchema(schema); + + expect(result).to.equal(schema); + expect(JSON.stringify(schema)).to.equal(originalJson); + const resultObj = result as JSONSchema; + expect(resultObj).to.not.have.property('additionalProperties'); + expect(resultObj).to.not.have.property('required'); + }); + + it('should not mutate original but return a new strictified schema when branching applies (properties/items)', () => { + const original: JSONSchema = { + type: 'object', + properties: { + path: { type: 'string' }, + data: { + type: 'array', + items: { + type: 'object', + properties: { + a: { type: 'string' } + } + } + } + } + }; + const originalClone = JSON.parse(JSON.stringify(original)); + + const resultDef = recursiveStrictJSONSchema(original); + const result = resultDef as JSONSchema; + + expect(result).to.not.equal(original); + expect(original).to.deep.equal(originalClone); + + expect(result.additionalProperties).to.equal(false); + expect(result.required).to.have.members(['path', 'data']); + + const itemsDef = (result.properties?.data as JSONSchema).items as JSONSchemaDefinition; + expect(itemsDef).to.be.ok; + const itemsObj = itemsDef as JSONSchema; + expect(itemsObj.additionalProperties).to.equal(false); + expect(itemsObj.required).to.have.members(['a']); + + const originalItems = ((original.properties!.data as JSONSchema).items) as JSONSchema; + expect(originalItems).to.not.have.property('additionalProperties'); + expect(originalItems).to.not.have.property('required'); + }); + + it('should strictify nested parameters schema and not mutate the original', () => { + const replacementProperties: Record = { + oldContent: { type: 'string', description: 'The exact content to be replaced. Must match exactly, including whitespace, comments, etc.' }, + newContent: { type: 'string', description: 'The new content to insert in place of matched old content.' }, + multiple: { type: 'boolean', description: 'Set to true if multiple occurrences of the oldContent are expected to be replaced.' } + }; + + const parameters: JSONSchema = { + type: 'object', + properties: { + path: { type: 'string', description: 'The path of the file where content will be replaced.' }, + replacements: { + type: 'array', + items: { + type: 'object', + properties: replacementProperties, + required: ['oldContent', 'newContent'] + }, + description: 'An array of replacement objects, each containing oldContent and newContent strings.' + }, + reset: { + type: 'boolean', + description: 'Set to true to clear any existing pending changes for this file and start fresh. Default is false, which merges with existing changes.' + } + }, + required: ['path', 'replacements'] + }; + + const originalClone = JSON.parse(JSON.stringify(parameters)); + + const strictifiedDef = recursiveStrictJSONSchema(parameters); + const strictified = strictifiedDef as JSONSchema; + + expect(strictified).to.not.equal(parameters); + expect(parameters).to.deep.equal(originalClone); + + expect(strictified.additionalProperties).to.equal(false); + expect(strictified.required).to.have.members(['path', 'replacements', 'reset']); + + const items = (strictified.properties!.replacements as JSONSchema).items as JSONSchema; + expect(items.additionalProperties).to.equal(false); + expect(items.required).to.have.members(['oldContent', 'newContent', 'multiple']); + + const origItems = ((parameters.properties!.replacements as JSONSchema).items) as JSONSchema; + expect(origItems.required).to.deep.equal(['oldContent', 'newContent']); + expect(origItems).to.not.have.property('additionalProperties'); + }); + }); + +}); diff --git a/packages/ai-openai/src/node/openai-request-api-context.ts b/packages/ai-openai/src/node/openai-request-api-context.ts new file mode 100644 index 0000000..3291d13 --- /dev/null +++ b/packages/ai-openai/src/node/openai-request-api-context.ts @@ -0,0 +1,23 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +interface OpenAIRequestApiContext { + parent?: OpenAIRequestApiContext; + +} + +// export class OpenAIRequestApiContext { +// } diff --git a/packages/ai-openai/src/node/openai-response-api-utils.ts b/packages/ai-openai/src/node/openai-response-api-utils.ts new file mode 100644 index 0000000..06906b6 --- /dev/null +++ b/packages/ai-openai/src/node/openai-response-api-utils.ts @@ -0,0 +1,841 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { + createToolCallError, + ImageContent, + LanguageModelMessage, + LanguageModelResponse, + LanguageModelStreamResponsePart, + TextMessage, + TokenUsageService, + ToolInvocationContext, + ToolRequest, + ToolRequestParameters, + UserRequest +} from '@theia/ai-core'; +import { CancellationToken, unreachable } from '@theia/core'; +import { Deferred } from '@theia/core/lib/common/promise-util'; +import { injectable } from '@theia/core/shared/inversify'; +import { OpenAI } from 'openai'; +import type { RunnerOptions } from 'openai/lib/AbstractChatCompletionRunner'; +import type { + FunctionTool, + ResponseFunctionCallArgumentsDeltaEvent, + ResponseFunctionCallArgumentsDoneEvent, + ResponseFunctionToolCall, + ResponseInputItem, + ResponseStreamEvent +} from 'openai/resources/responses/responses'; +import type { ResponsesModel } from 'openai/resources/shared'; +import { DeveloperMessageSettings, OpenAiModelUtils } from './openai-language-model'; +import { JSONSchema, JSONSchemaDefinition } from 'openai/lib/jsonschema'; + +interface ToolCall { + id: string; + call_id?: string; + name: string; + arguments: string; + result?: unknown; + error?: Error; + executed: boolean; +} + +/** + * Utility class for handling OpenAI Response API requests and tool calling cycles. + * + * This class encapsulates the complexity of the Response API's multi-turn conversation + * patterns for tool calling, keeping the main language model class clean and focused. + */ +@injectable() +export class OpenAiResponseApiUtils { + + /** + * Handles Response API requests with proper tool calling cycles. + * Works for both streaming and non-streaming cases. + */ + async handleRequest( + openai: OpenAI, + request: UserRequest, + settings: Record, + model: string, + modelUtils: OpenAiModelUtils, + developerMessageSettings: DeveloperMessageSettings, + runnerOptions: RunnerOptions, + modelId: string, + isStreaming: boolean, + tokenUsageService?: TokenUsageService, + cancellationToken?: CancellationToken + ): Promise { + if (cancellationToken?.isCancellationRequested) { + return { text: '' }; + } + + const { instructions, input } = this.processMessages(request.messages, developerMessageSettings, model); + const tools = this.convertToolsForResponseApi(request.tools); + + // If no tools are provided, use simple response handling + if (!tools || tools.length === 0) { + if (isStreaming) { + const stream = openai.responses.stream({ + model: model as ResponsesModel, + instructions, + input, + ...settings + }); + return { stream: this.createSimpleResponseApiStreamIterator(stream, request.requestId, modelId, tokenUsageService, cancellationToken) }; + } else { + const response = await openai.responses.create({ + model: model as ResponsesModel, + instructions, + input, + ...settings + }); + + // Record token usage if available + if (tokenUsageService && response.usage) { + await tokenUsageService.recordTokenUsage( + modelId, + { + inputTokens: response.usage.input_tokens, + outputTokens: response.usage.output_tokens, + requestId: request.requestId + } + ); + } + + return { text: response.output_text || '' }; + } + } + + // Handle tool calling with multi-turn conversation using the unified iterator + const iterator = new ResponseApiToolCallIterator( + openai, + request, + settings, + model, + modelUtils, + developerMessageSettings, + runnerOptions, + modelId, + this, + isStreaming, + tokenUsageService, + cancellationToken + ); + + return { stream: iterator }; + } + + /** + * Converts ToolRequest objects to the format expected by the Response API. + */ + convertToolsForResponseApi(tools?: ToolRequest[]): FunctionTool[] | undefined { + if (!tools || tools.length === 0) { + return undefined; + } + + const converted = tools.map(tool => ({ + type: 'function' as const, + name: tool.name, + description: tool.description || '', + // The Response API is very strict re: JSON schema: all properties must be listed as required, + // and additional properties must be disallowed. + // https://platform.openai.com/docs/guides/function-calling#strict-mode + parameters: this.recursiveStrictToolCallParameters(tool.parameters), + strict: true + })); + console.debug(`Converted ${tools.length} tools for Response API:`, converted.map(t => t.name)); + return converted; + } + + recursiveStrictToolCallParameters(schema: ToolRequestParameters): FunctionTool['parameters'] { + return recursiveStrictJSONSchema(schema) as FunctionTool['parameters']; + } + + protected createSimpleResponseApiStreamIterator( + stream: AsyncIterable, + requestId: string, + modelId: string, + tokenUsageService?: TokenUsageService, + cancellationToken?: CancellationToken + ): AsyncIterable { + return { + async *[Symbol.asyncIterator](): AsyncIterator { + try { + for await (const event of stream) { + if (cancellationToken?.isCancellationRequested) { + break; + } + + if (event.type === 'response.output_text.delta') { + yield { + content: event.delta + }; + } else if (event.type === 'response.completed') { + if (tokenUsageService && event.response?.usage) { + await tokenUsageService.recordTokenUsage( + modelId, + { + inputTokens: event.response.usage.input_tokens, + outputTokens: event.response.usage.output_tokens, + requestId + } + ); + } + } else if (event.type === 'error') { + console.error('Response API error:', event.message); + throw new Error(`Response API error: ${event.message}`); + } + } + } catch (error) { + console.error('Error in Response API stream:', error); + throw error; + } + } + }; + } + + /** + * Processes the provided list of messages by applying system message adjustments and converting + * them directly to the format expected by the OpenAI Response API. + * + * This method converts messages directly without going through ChatCompletionMessageParam types. + * + * @param messages the list of messages to process. + * @param developerMessageSettings how system and developer messages are handled during processing. + * @param model the OpenAI model identifier. Currently not used, but allows subclasses to implement model-specific behavior. + * @returns an object containing instructions and input formatted for the Response API. + */ + processMessages( + messages: LanguageModelMessage[], + developerMessageSettings: DeveloperMessageSettings, + model: string + ): { instructions?: string; input: ResponseInputItem[] } { + const processed = this.processSystemMessages(messages, developerMessageSettings) + .filter(m => m.type !== 'thinking'); + + // Extract system/developer messages for instructions + const systemMessages = processed.filter((m): m is TextMessage => m.type === 'text' && m.actor === 'system'); + const instructions = systemMessages.length > 0 + ? systemMessages.map(m => m.text).join('\n') + : undefined; + + // Convert non-system messages to Response API input items + const nonSystemMessages = processed.filter(m => m.actor !== 'system'); + const input: ResponseInputItem[] = []; + + for (const message of nonSystemMessages) { + if (LanguageModelMessage.isTextMessage(message)) { + if (message.actor === 'ai') { + // Assistant messages use ResponseOutputMessage format + input.push({ + id: `msg_${Date.now()}_${Math.random().toString(36).substring(2, 11)}`, + type: 'message', + role: 'assistant', + status: 'completed', + content: [{ + type: 'output_text', + text: message.text, + annotations: [] + }] + }); + } else { + // User messages use input format + input.push({ + type: 'message', + role: 'user', + content: [{ + type: 'input_text', + text: message.text + }] + }); + } + } else if (LanguageModelMessage.isToolUseMessage(message)) { + input.push({ + type: 'function_call', + call_id: message.id, + name: message.name, + arguments: JSON.stringify(message.input) + }); + } else if (LanguageModelMessage.isToolResultMessage(message)) { + const content = typeof message.content === 'string' ? message.content : JSON.stringify(message.content); + input.push({ + type: 'function_call_output', + call_id: message.tool_use_id, + output: content + }); + } else if (LanguageModelMessage.isImageMessage(message)) { + input.push({ + type: 'message', + role: 'user', + content: [{ + type: 'input_image', + detail: 'auto', + image_url: ImageContent.isBase64(message.image) ? + `data:${message.image.mimeType};base64,${message.image.base64data}` : + message.image.url + }] + }); + } else if (LanguageModelMessage.isThinkingMessage(message)) { + // Pass + } else { + unreachable(message); + } + } + + return { instructions, input }; + } + + protected processSystemMessages( + messages: LanguageModelMessage[], + developerMessageSettings: DeveloperMessageSettings + ): LanguageModelMessage[] { + return processSystemMessages(messages, developerMessageSettings); + } +} + +/** + * Iterator for handling Response API streaming with tool calls. + * Based on the pattern from openai-streaming-iterator.ts but adapted for Response API. + */ +class ResponseApiToolCallIterator implements AsyncIterableIterator { + protected readonly requestQueue = new Array>>(); + protected readonly messageCache = new Array(); + protected done = false; + protected terminalError: Error | undefined = undefined; + + // Current iteration state + protected currentInput: ResponseInputItem[]; + protected currentToolCalls = new Map(); + protected totalInputTokens = 0; + protected totalOutputTokens = 0; + protected iteration = 0; + protected readonly maxIterations: number; + protected readonly tools: FunctionTool[] | undefined; + protected readonly instructions?: string; + protected currentResponseText = ''; + + constructor( + protected readonly openai: OpenAI, + protected readonly request: UserRequest, + protected readonly settings: Record, + protected readonly model: string, + protected readonly modelUtils: OpenAiModelUtils, + protected readonly developerMessageSettings: DeveloperMessageSettings, + protected readonly runnerOptions: RunnerOptions, + protected readonly modelId: string, + protected readonly utils: OpenAiResponseApiUtils, + protected readonly isStreaming: boolean, + protected readonly tokenUsageService?: TokenUsageService, + protected readonly cancellationToken?: CancellationToken + ) { + const { instructions, input } = utils.processMessages(request.messages, developerMessageSettings, model); + this.instructions = instructions; + this.currentInput = input; + this.tools = utils.convertToolsForResponseApi(request.tools); + this.maxIterations = runnerOptions.maxChatCompletions || 100; + + // Start the first iteration + this.startIteration(); + } + + [Symbol.asyncIterator](): AsyncIterableIterator { + return this; + } + + async next(): Promise> { + if (this.messageCache.length && this.requestQueue.length) { + throw new Error('Assertion error: cache and queue should not both be populated.'); + } + + // Deliver all the messages we got, even if we've since terminated. + if (this.messageCache.length) { + return { + done: false, + value: this.messageCache.shift()! + }; + } else if (this.terminalError) { + throw this.terminalError; + } else if (this.done) { + return { + done: true, + value: undefined + }; + } else { + const deferred = new Deferred>(); + this.requestQueue.push(deferred); + return deferred.promise; + } + } + + protected async startIteration(): Promise { + try { + while (this.iteration < this.maxIterations && !this.cancellationToken?.isCancellationRequested) { + console.debug(`Starting Response API iteration ${this.iteration} with ${this.currentInput.length} input messages`); + + await this.processStream(); + + // Check if we have tool calls that need execution + if (this.currentToolCalls.size === 0) { + // No tool calls, we're done + this.finalize(); + return; + } + + // Execute all tool calls + await this.executeToolCalls(); + + // Prepare for next iteration + this.prepareNextIteration(); + this.iteration++; + } + + // Max iterations reached + this.finalize(); + } catch (error) { + this.terminalError = error instanceof Error ? error : new Error(String(error)); + this.finalize(); + } + } + + protected async processStream(): Promise { + this.currentToolCalls.clear(); + this.currentResponseText = ''; + + if (this.isStreaming) { + // Use streaming API + const stream = this.openai.responses.stream({ + model: this.model as ResponsesModel, + instructions: this.instructions, + input: this.currentInput, + tools: this.tools, + ...this.settings + }); + + for await (const event of stream) { + if (this.cancellationToken?.isCancellationRequested) { + break; + } + await this.handleStreamEvent(event); + } + } else { + // Use non-streaming API but yield results incrementally + await this.processNonStreamingResponse(); + } + } + + protected async processNonStreamingResponse(): Promise { + const response = await this.openai.responses.create({ + model: this.model as ResponsesModel, + instructions: this.instructions, + input: this.currentInput, + tools: this.tools, + ...this.settings + }); + + // Record token usage + if (response.usage) { + this.totalInputTokens += response.usage.input_tokens; + this.totalOutputTokens += response.usage.output_tokens; + } + + // First, yield any text content from the response + this.currentResponseText = response.output_text || ''; + if (this.currentResponseText) { + this.handleIncoming({ content: this.currentResponseText }); + } + + // Find function calls in the response + const functionCalls = response.output?.filter((item): item is ResponseFunctionToolCall => item.type === 'function_call') || []; + + // Process each function call + for (const functionCall of functionCalls) { + if (functionCall.id && functionCall.name) { + const toolCall: ToolCall = { + id: functionCall.id, + call_id: functionCall.call_id || functionCall.id, + name: functionCall.name, + arguments: functionCall.arguments || '', + executed: false + }; + + this.currentToolCalls.set(functionCall.id, toolCall); + + // Yield the tool call initiation + this.handleIncoming({ + tool_calls: [{ + id: functionCall.id, + finished: false, + function: { + name: functionCall.name, + arguments: functionCall.arguments || '' + } + }] + }); + } + } + } + + protected async handleStreamEvent(event: ResponseStreamEvent): Promise { + switch (event.type) { + case 'response.output_text.delta': + this.currentResponseText += event.delta; + this.handleIncoming({ content: event.delta }); + break; + + case 'response.output_item.added': + if (event.item?.type === 'function_call') { + this.handleFunctionCallAdded(event.item); + } + break; + + case 'response.function_call_arguments.delta': + this.handleFunctionCallArgsDelta(event); + break; + + case 'response.function_call_arguments.done': + await this.handleFunctionCallArgsDone(event); + break; + + case 'response.output_item.done': + if (event.item?.type === 'function_call') { + this.handleFunctionCallDone(event.item); + } + break; + + case 'response.completed': + if (event.response?.usage) { + this.totalInputTokens += event.response.usage.input_tokens; + this.totalOutputTokens += event.response.usage.output_tokens; + } + break; + + case 'error': + console.error('Response API error:', event.message); + throw new Error(`Response API error: ${event.message}`); + } + } + + protected handleFunctionCallAdded(functionCall: ResponseFunctionToolCall): void { + if (functionCall.id && functionCall.call_id) { + console.debug(`Function call added: ${functionCall.name} with id ${functionCall.id} and call_id ${functionCall.call_id}`); + + const toolCall: ToolCall = { + id: functionCall.id, + call_id: functionCall.call_id, + name: functionCall.name || '', + arguments: functionCall.arguments || '', + executed: false + }; + + this.currentToolCalls.set(functionCall.id, toolCall); + + this.handleIncoming({ + tool_calls: [{ + id: functionCall.id, + finished: false, + function: { + name: functionCall.name || '', + arguments: functionCall.arguments || '' + } + }] + }); + } + } + + protected handleFunctionCallArgsDelta(event: ResponseFunctionCallArgumentsDeltaEvent): void { + const toolCall = this.currentToolCalls.get(event.item_id); + if (toolCall) { + toolCall.arguments += event.delta; + + if (event.delta) { + this.handleIncoming({ + tool_calls: [{ + id: event.item_id, + argumentsDelta: true, + function: { + arguments: event.delta + } + }] + }); + } + } + } + + protected async handleFunctionCallArgsDone(event: ResponseFunctionCallArgumentsDoneEvent): Promise { + let toolCall = this.currentToolCalls.get(event.item_id); + if (!toolCall) { + // Create if we didn't see the added event + toolCall = { + id: event.item_id, + name: event.name || '', + arguments: event.arguments || '', + executed: false + }; + this.currentToolCalls.set(event.item_id, toolCall); + + this.handleIncoming({ + tool_calls: [{ + id: event.item_id, + finished: false, + function: { + name: event.name || '', + arguments: event.arguments || '' + } + }] + }); + } else { + // Update with final values + toolCall.name = event.name || toolCall.name; + toolCall.arguments = event.arguments || toolCall.arguments; + } + } + + protected handleFunctionCallDone(functionCall: ResponseFunctionToolCall): void { + if (!functionCall.id) { console.warn('Unexpected absence of ID for call ID', functionCall.call_id); return; } + const toolCall = this.currentToolCalls.get(functionCall.id); + if (toolCall && !toolCall.call_id && functionCall.call_id) { + toolCall.call_id = functionCall.call_id; + } + } + + protected async executeToolCalls(): Promise { + for (const [itemId, toolCall] of this.currentToolCalls) { + if (toolCall.executed) { + continue; + } + + const tool = this.request.tools?.find(t => t.name === toolCall.name); + if (tool) { + try { + const result = await tool.handler(toolCall.arguments, ToolInvocationContext.create(itemId)); + toolCall.result = result; + + // Yield the tool call completion + this.handleIncoming({ + tool_calls: [{ + id: itemId, + finished: true, + function: { + name: toolCall.name, + arguments: toolCall.arguments + }, + result + }] + }); + } catch (error) { + console.error(`Error executing tool ${toolCall.name}:`, error); + toolCall.error = error instanceof Error ? error : new Error(String(error)); + + // Yield the tool call error + this.handleIncoming({ + tool_calls: [{ + id: itemId, + finished: true, + function: { + name: toolCall.name, + arguments: toolCall.arguments + }, + result: createToolCallError(error instanceof Error ? error.message : String(error)) + }] + }); + } + } else { + console.warn(`Tool ${toolCall.name} not found in request tools`); + toolCall.error = new Error(`Tool ${toolCall.name} not found`); + + // Yield the tool call error + this.handleIncoming({ + tool_calls: [{ + id: itemId, + finished: true, + function: { + name: toolCall.name, + arguments: toolCall.arguments + }, + result: createToolCallError(`Tool '${toolCall.name}' not found in the available tools for this request.`, 'tool-not-available') + }] + }); + } + + toolCall.executed = true; + } + } + + protected prepareNextIteration(): void { + // Add assistant response with the actual text that was streamed + const assistantMessage: ResponseInputItem = { + role: 'assistant', + content: this.currentResponseText + }; + + // Add the function calls that were made by the assistant + const functionCalls: ResponseInputItem[] = []; + for (const [itemId, toolCall] of this.currentToolCalls) { + functionCalls.push({ + type: 'function_call', + call_id: toolCall.call_id || itemId, + name: toolCall.name, + arguments: toolCall.arguments + }); + } + + // Add tool results + const toolResults: ResponseInputItem[] = []; + for (const [itemId, toolCall] of this.currentToolCalls) { + const callId = toolCall.call_id || itemId; + + if (toolCall.result !== undefined) { + const resultContent = typeof toolCall.result === 'string' ? toolCall.result : JSON.stringify(toolCall.result); + toolResults.push({ + type: 'function_call_output', + call_id: callId, + output: resultContent + }); + } else if (toolCall.error) { + toolResults.push({ + type: 'function_call_output', + call_id: callId, + output: `Error: ${toolCall.error.message}` + }); + } + } + + this.currentInput = [...this.currentInput, assistantMessage, ...functionCalls, ...toolResults]; + } + + protected handleIncoming(message: LanguageModelStreamResponsePart): void { + if (this.messageCache.length && this.requestQueue.length) { + throw new Error('Assertion error: cache and queue should not both be populated.'); + } + + if (this.requestQueue.length) { + this.requestQueue.shift()!.resolve({ + done: false, + value: message + }); + } else { + this.messageCache.push(message); + } + } + + protected async finalize(): Promise { + this.done = true; + + // Record final token usage + if (this.tokenUsageService && (this.totalInputTokens > 0 || this.totalOutputTokens > 0)) { + try { + await this.tokenUsageService.recordTokenUsage( + this.modelId, + { + inputTokens: this.totalInputTokens, + outputTokens: this.totalOutputTokens, + requestId: this.request.requestId + } + ); + } catch (error) { + console.error('Error recording token usage:', error); + } + } + + // Resolve any outstanding requests + if (this.terminalError) { + this.requestQueue.forEach(request => request.reject(this.terminalError)); + } else { + this.requestQueue.forEach(request => request.resolve({ done: true, value: undefined })); + } + this.requestQueue.length = 0; + } +} + +export function processSystemMessages( + messages: LanguageModelMessage[], + developerMessageSettings: DeveloperMessageSettings +): LanguageModelMessage[] { + if (developerMessageSettings === 'skip') { + return messages.filter(message => message.actor !== 'system'); + } else if (developerMessageSettings === 'mergeWithFollowingUserMessage') { + const updated = messages.slice(); + for (let i = updated.length - 1; i >= 0; i--) { + if (updated[i].actor === 'system') { + const systemMessage = updated[i] as TextMessage; + if (i + 1 < updated.length && updated[i + 1].actor === 'user') { + // Merge system message with the next user message + const userMessage = updated[i + 1] as TextMessage; + updated[i + 1] = { + ...updated[i + 1], + text: systemMessage.text + '\n' + userMessage.text + } as TextMessage; + updated.splice(i, 1); + } else { + // The message directly after is not a user message (or none exists), so create a new user message right after + updated.splice(i + 1, 0, { actor: 'user', type: 'text', text: systemMessage.text }); + updated.splice(i, 1); + } + } + } + return updated; + } + return messages; +} + +export function recursiveStrictJSONSchema(schema: JSONSchemaDefinition): JSONSchemaDefinition { + if (typeof schema === 'boolean') { return schema; } + let result: JSONSchema | undefined = undefined; + if (schema.properties) { + result ??= { ...schema }; + result.additionalProperties = false; + result.required = Object.keys(schema.properties); + result.properties = Object.fromEntries(Object.entries(schema.properties).map(([key, props]) => [key, recursiveStrictJSONSchema(props)])); + } + if (schema.items) { + result ??= { ...schema }; + result.items = Array.isArray(schema.items) + ? schema.items.map(recursiveStrictJSONSchema) + : recursiveStrictJSONSchema(schema.items); + } + if (schema.oneOf) { + result ??= { ...schema }; + result.oneOf = schema.oneOf.map(recursiveStrictJSONSchema); + } + if (schema.anyOf) { + result ??= { ...schema }; + result.anyOf = schema.anyOf.map(recursiveStrictJSONSchema); + } + if (schema.allOf) { + result ??= { ...schema }; + result.allOf = schema.allOf.map(recursiveStrictJSONSchema); + } + if (schema.if) { + result ??= { ...schema }; + result.if = recursiveStrictJSONSchema(schema.if); + } + if (schema.then) { + result ??= { ...schema }; + result.then = recursiveStrictJSONSchema(schema.then); + } + if (schema.else) { + result ??= { ...schema }; + result.else = recursiveStrictJSONSchema(schema.else); + } + if (schema.not) { + result ??= { ...schema }; + result.not = recursiveStrictJSONSchema(schema.not); + } + + return result ?? schema; +} diff --git a/packages/ai-openai/src/node/openai-streaming-iterator.spec.ts b/packages/ai-openai/src/node/openai-streaming-iterator.spec.ts new file mode 100644 index 0000000..66d20ac --- /dev/null +++ b/packages/ai-openai/src/node/openai-streaming-iterator.spec.ts @@ -0,0 +1,255 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { expect } from 'chai'; +import * as sinon from 'sinon'; +import { StreamingAsyncIterator } from './openai-streaming-iterator'; +import { ChatCompletionStream } from 'openai/lib/ChatCompletionStream'; +import { CancellationTokenSource, CancellationError } from '@theia/core'; +import { LanguageModelStreamResponsePart, isTextResponsePart, isToolCallResponsePart } from '@theia/ai-core'; +import { EventEmitter } from 'events'; +import { ChatCompletionToolMessageParam } from 'openai/resources'; + +describe('StreamingAsyncIterator', () => { + let mockStream: ChatCompletionStream & EventEmitter; + let iterator: StreamingAsyncIterator; + let cts: CancellationTokenSource; + const consoleError = console.error; + + beforeEach(() => { + mockStream = new EventEmitter() as ChatCompletionStream & EventEmitter; + mockStream.abort = sinon.stub(); + + cts = new CancellationTokenSource(); + }); + + afterEach(() => { + if (iterator) { + iterator.dispose(); + } + cts.dispose(); + console.error = consoleError; + }); + + function createIterator(withCancellationToken = false): StreamingAsyncIterator { + return new StreamingAsyncIterator(mockStream, '', withCancellationToken ? cts.token : undefined); + } + + it('should yield messages in the correct order when consumed immediately', async () => { + iterator = createIterator(); + + setTimeout(() => { + mockStream.emit('chunk', { choices: [{ delta: { content: 'Hello' } }] }); + mockStream.emit('chunk', { choices: [{ delta: { content: ' ' } }] }); + mockStream.emit('chunk', { choices: [{ delta: { content: 'World' } }] }); + mockStream.emit('end'); + }, 10); + + const results: LanguageModelStreamResponsePart[] = []; + + while (true) { + const { value, done } = await iterator.next(); + if (done) { + break; + } + results.push(value); + } + + expect(results).to.deep.equal([ + { content: 'Hello' }, + { content: ' ' }, + { content: 'World' } + ]); + }); + + it('should buffer messages if consumer is slower (messages arrive before .next() is called)', async () => { + iterator = createIterator(); + + mockStream.emit('chunk', { choices: [{ delta: { content: 'A' } }] }); + mockStream.emit('chunk', { choices: [{ delta: { content: 'B' } }] }); + mockStream.emit('chunk', { choices: [{ delta: { content: 'C' } }] }); + mockStream.emit('end'); + + const results: string[] = []; + while (true) { + const { value, done } = await iterator.next(); + if (done) { + break; + } + results.push((isTextResponsePart(value) && value.content) || ''); + } + + expect(results).to.deep.equal(['A', 'B', 'C']); + }); + + it('should resolve queued next() call when a message arrives (consumer is waiting first)', async () => { + iterator = createIterator(); + + const nextPromise = iterator.next(); + + setTimeout(() => { + mockStream.emit('chunk', { choices: [{ delta: { content: 'Hello from queue' } }] }); + mockStream.emit('end'); + }, 10); + + const first = await nextPromise; + expect(first.done).to.be.false; + expect(first.value.content).to.equal('Hello from queue'); + + const second = await iterator.next(); + expect(second.done).to.be.true; + expect(second.value).to.be.undefined; + }); + + it('should handle the end event correctly', async () => { + iterator = createIterator(); + + mockStream.emit('chunk', { choices: [{ delta: { content: 'EndTest1' } }] }); + mockStream.emit('chunk', { choices: [{ delta: { content: 'EndTest2' } }] }); + mockStream.emit('end'); + + const results: string[] = []; + while (true) { + const { value, done } = await iterator.next(); + if (done) { + break; + } + results.push((isTextResponsePart(value) && value.content) || ''); + } + + expect(results).to.deep.equal(['EndTest1', 'EndTest2']); + }); + + it('should reject pending .next() call with an error if error event occurs', async () => { + iterator = createIterator(); + + const pendingNext = iterator.next(); + + // Suppress console.error output + console.error = () => { }; + + const error = new Error('Stream error occurred'); + mockStream.emit('error', error); + + try { + await pendingNext; + expect.fail('The promise should have been rejected with an error.'); + } catch (err) { + expect(err).to.equal(error); + } + }); + + it('should reject pending .next() call with a CancellationError if "abort" event occurs', async () => { + iterator = createIterator(); + + const pendingNext = iterator.next(); + + // Suppress console.error output + console.error = () => { }; + + mockStream.emit('abort'); + + try { + await pendingNext; + expect.fail('The promise should have been rejected with a CancellationError.'); + } catch (err) { + expect(err).to.be.instanceOf(CancellationError); + } + }); + + it('should call stream.abort() when cancellation token is triggered', async () => { + iterator = createIterator(true); + + cts.cancel(); + + sinon.assert.calledOnce(mockStream.abort as sinon.SinonSpy); + }); + + it('should not lose unconsumed messages after disposal, but no new ones arrive', async () => { + iterator = createIterator(); + + mockStream.emit('chunk', { choices: [{ delta: { content: 'Msg1' } }] }); + mockStream.emit('chunk', { choices: [{ delta: { content: 'Msg2' } }] }); + + iterator.dispose(); + + let result = await iterator.next(); + expect(result.done).to.be.false; + expect(result.value.content).to.equal('Msg1'); + + result = await iterator.next(); + expect(result.done).to.be.false; + expect(result.value.content).to.equal('Msg2'); + + result = await iterator.next(); + expect(result.done).to.be.true; + expect(result.value).to.be.undefined; + }); + + it('should reject all pending requests with an error if disposal occurs after stream error', async () => { + iterator = createIterator(); + + const pendingNext1 = iterator.next(); + const pendingNext2 = iterator.next(); + + // Suppress console.error output + console.error = () => { }; + + const error = new Error('Critical error'); + mockStream.emit('error', error); + + try { + await pendingNext1; + expect.fail('expected to be rejected'); + } catch (err) { + expect(err).to.equal(error); + } + + try { + await pendingNext2; + expect.fail('expected to be rejected'); + } catch (err) { + expect(err).to.equal(error); + } + }); + + it('should handle receiving a "message" event with role="tool"', async () => { + iterator = createIterator(); + + setTimeout(() => { + mockStream.emit('message', { + role: 'tool', + tool_call_id: 'tool-123', + content: [{ type: 'text', text: 'Part1' }, { type: 'text', text: 'Part2' }] + } satisfies ChatCompletionToolMessageParam); + mockStream.emit('end'); + }, 10); + + const results: LanguageModelStreamResponsePart[] = []; + for await (const part of iterator) { + results.push(part); + } + + expect(results).to.have.lengthOf(1); + expect(isToolCallResponsePart(results[0]) && results[0].tool_calls).to.deep.equal([ + { + id: 'tool-123', + finished: true, + result: { content: [{ type: 'text', text: 'Part1' }, { type: 'text', text: 'Part2' }] } + } + ]); + }); +}); diff --git a/packages/ai-openai/src/node/openai-streaming-iterator.ts b/packages/ai-openai/src/node/openai-streaming-iterator.ts new file mode 100644 index 0000000..f513cf2 --- /dev/null +++ b/packages/ai-openai/src/node/openai-streaming-iterator.ts @@ -0,0 +1,186 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { LanguageModelStreamResponsePart, TokenUsageService, TokenUsageParams, ToolCallResult, ToolCallTextResult } from '@theia/ai-core'; +import { CancellationError, CancellationToken, Disposable, DisposableCollection } from '@theia/core'; +import { Deferred } from '@theia/core/lib/common/promise-util'; +import { ChatCompletionStream, ChatCompletionStreamEvents } from 'openai/lib/ChatCompletionStream'; +import { ChatCompletionContentPartText } from 'openai/resources'; + +type IterResult = IteratorResult; + +export class StreamingAsyncIterator implements AsyncIterableIterator, Disposable { + protected readonly requestQueue = new Array>(); + protected readonly messageCache = new Array(); + protected done = false; + protected terminalError: Error | undefined = undefined; + protected readonly toDispose = new DisposableCollection(); + + constructor( + protected readonly stream: ChatCompletionStream, + protected readonly requestId: string, + cancellationToken?: CancellationToken, + protected readonly tokenUsageService?: TokenUsageService, + protected readonly model?: string, + ) { + this.registerStreamListener('error', error => { + console.error('Error in OpenAI chat completion stream:', error); + this.terminalError = error; + this.dispose(); + }); + this.registerStreamListener('abort', () => { + this.terminalError = new CancellationError(); + this.dispose(); + }, true); + this.registerStreamListener('message', message => { + if (message.role === 'tool') { + this.handleIncoming({ + tool_calls: [{ + id: message.tool_call_id, + finished: true, + result: tryParseToolResult(message.content) + }] + }); + } + console.debug('Received Open AI message', JSON.stringify(message)); + }); + this.registerStreamListener('end', () => { + this.dispose(); + }, true); + this.registerStreamListener('chunk', (chunk, snapshot) => { + // Handle token usage reporting + if (chunk.usage && this.tokenUsageService && this.model) { + const inputTokens = chunk.usage.prompt_tokens || 0; + const outputTokens = chunk.usage.completion_tokens || 0; + if (inputTokens > 0 || outputTokens > 0) { + const tokenUsageParams: TokenUsageParams = { + inputTokens, + outputTokens, + requestId + }; + this.tokenUsageService.recordTokenUsage(this.model, tokenUsageParams) + .catch(error => console.error('Error recording token usage:', error)); + } + } + // Patch missing fields that OpenAI SDK requires but some providers (e.g., Copilot) don't send + for (const choice of snapshot?.choices ?? []) { + // Ensure role is set (required by finalizeChatCompletion) + if (choice?.message && !choice.message.role) { + choice.message.role = 'assistant'; + } + // Ensure tool_calls have type set (required by #emitToolCallDoneEvent and finalizeChatCompletion) + if (choice?.message?.tool_calls) { + for (const call of choice.message.tool_calls) { + if (call.type === undefined) { + call.type = 'function'; + } + } + } + } + // OpenAI can push out reasoning tokens, but can't handle it as part of messages + if (snapshot?.choices[0]?.message && Object.keys(snapshot.choices[0].message).includes('reasoning')) { + const reasoning = (snapshot.choices[0].message as { reasoning: string }).reasoning; + this.handleIncoming({ thought: reasoning, signature: '' }); + // delete message parts which cannot be handled by openai + delete (snapshot.choices[0].message as { reasoning?: string }).reasoning; + delete (snapshot.choices[0].message as { channel?: string }).channel; + return; + } + this.handleIncoming({ ...chunk.choices[0]?.delta as LanguageModelStreamResponsePart }); + }); + if (cancellationToken) { + this.toDispose.push(cancellationToken.onCancellationRequested(() => stream.abort())); + } + } + + [Symbol.asyncIterator](): AsyncIterableIterator { return this; } + + next(): Promise { + if (this.messageCache.length && this.requestQueue.length) { + throw new Error('Assertion error: cache and queue should not both be populated.'); + } + // Deliver all the messages we got, even if we've since terminated. + if (this.messageCache.length) { + return Promise.resolve({ + done: false, + value: this.messageCache.shift()! + }); + } else if (this.terminalError) { + return Promise.reject(this.terminalError); + } else if (this.done) { + return Promise.resolve({ + done: true, + value: undefined + }); + } else { + const toQueue = new Deferred(); + this.requestQueue.push(toQueue); + return toQueue.promise; + } + } + + protected handleIncoming(message: LanguageModelStreamResponsePart): void { + if (this.messageCache.length && this.requestQueue.length) { + throw new Error('Assertion error: cache and queue should not both be populated.'); + } + if (this.requestQueue.length) { + this.requestQueue.shift()!.resolve({ + done: false, + value: message + }); + } else { + this.messageCache.push(message); + } + } + + protected registerStreamListener(eventType: Event, handler: ChatCompletionStreamEvents[Event], once?: boolean): void { + if (once) { + this.stream.once(eventType, handler); + } else { + this.stream.on(eventType, handler); + } + this.toDispose.push({ dispose: () => this.stream.off(eventType, handler) }); + } + + dispose(): void { + this.done = true; + this.toDispose.dispose(); + // We will be receiving no more messages. Any outstanding requests have to be handled. + if (this.terminalError) { + this.requestQueue.forEach(request => request.reject(this.terminalError)); + } else { + this.requestQueue.forEach(request => request.resolve({ done: true, value: undefined })); + } + // Leave the message cache alone - if it was populated, then the request queue was empty, but we'll still try to deliver the messages if asked. + this.requestQueue.length = 0; + } +} + +function tryParseToolResult(result: string | ChatCompletionContentPartText[]): ToolCallResult { + try { + if (typeof result === 'string') { + return JSON.parse(result); + } + return { + content: result.map(part => ({ + type: 'text', + text: part.text + })) + }; + } catch (error) { + return result; + } +} diff --git a/packages/ai-openai/tsconfig.json b/packages/ai-openai/tsconfig.json new file mode 100644 index 0000000..61a997f --- /dev/null +++ b/packages/ai-openai/tsconfig.json @@ -0,0 +1,25 @@ +{ + "extends": "../../configs/base.tsconfig", + "compilerOptions": { + "composite": true, + "rootDir": "src", + "outDir": "lib" + }, + "include": [ + "src" + ], + "references": [ + { + "path": "../ai-core" + }, + { + "path": "../core" + }, + { + "path": "../filesystem" + }, + { + "path": "../workspace" + } + ] +} diff --git a/packages/ai-scanoss/.eslintrc.js b/packages/ai-scanoss/.eslintrc.js new file mode 100644 index 0000000..1308994 --- /dev/null +++ b/packages/ai-scanoss/.eslintrc.js @@ -0,0 +1,10 @@ +/** @type {import('eslint').Linter.Config} */ +module.exports = { + extends: [ + '../../configs/build.eslintrc.json' + ], + parserOptions: { + tsconfigRootDir: __dirname, + project: 'tsconfig.json' + } +}; diff --git a/packages/ai-scanoss/README.md b/packages/ai-scanoss/README.md new file mode 100644 index 0000000..214d0b3 --- /dev/null +++ b/packages/ai-scanoss/README.md @@ -0,0 +1,35 @@ +
    + +
    + +theia-ext-logo + +

    ECLIPSE THEIA - SCAN OSS AI EXTENSION

    + +
    + +
    + +## Description + +Integrates SCANOSS content scanning into the Chat View. +Whenever a code listing is rendered, a scan action is offered to the user. + +Via the preferences the user can switch between manual and automatic scanning. + +## Additional Information + +- [API documentation for `@theia/ai-scanoss`](https://eclipse-theia.github.io/theia/docs/next/modules/_theia_ai-scanoss.html) +- [Theia - GitHub](https://github.com/eclipse-theia/theia) +- [Theia - Website](https://theia-ide.org/) +- [SCAN OSS Website](https://www.scanoss.com/) + +## License + +- [Eclipse Public License 2.0](http://www.eclipse.org/legal/epl-2.0/) +- [一 (Secondary) GNU General Public License, version 2 with the GNU Classpath Exception](https://projects.eclipse.org/license/secondary-gpl-2.0-cp) + +## Trademark + +"Theia" is a trademark of the Eclipse Foundation + diff --git a/packages/ai-scanoss/package.json b/packages/ai-scanoss/package.json new file mode 100644 index 0000000..a9e020e --- /dev/null +++ b/packages/ai-scanoss/package.json @@ -0,0 +1,55 @@ +{ + "name": "@theia/ai-scanoss", + "version": "1.68.0", + "description": "Theia - SCANOSS AI Integration", + "dependencies": { + "@theia/ai-chat": "1.68.0", + "@theia/ai-chat-ui": "1.68.0", + "@theia/ai-core": "1.68.0", + "@theia/core": "1.68.0", + "@theia/monaco": "1.68.0", + "@theia/monaco-editor-core": "1.96.302", + "@theia/scanoss": "1.68.0" + }, + "publishConfig": { + "access": "public" + }, + "theiaExtensions": [ + { + "frontend": "lib/browser/ai-scanoss-frontend-module", + "backend": "lib/node/ai-scanoss-backend-module" + } + ], + "keywords": [ + "theia-extension" + ], + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "repository": { + "type": "git", + "url": "https://github.com/eclipse-theia/theia.git" + }, + "bugs": { + "url": "https://github.com/eclipse-theia/theia/issues" + }, + "homepage": "https://github.com/eclipse-theia/theia", + "files": [ + "lib", + "src" + ], + "main": "lib/common", + "scripts": { + "build": "theiaext build", + "clean": "theiaext clean", + "compile": "theiaext compile", + "lint": "theiaext lint", + "test": "theiaext test", + "watch": "theiaext watch" + }, + "devDependencies": { + "@theia/ext-scripts": "1.68.0" + }, + "nyc": { + "extends": "../../configs/nyc.json" + }, + "gitHead": "21358137e41342742707f660b8e222f940a27652" +} diff --git a/packages/ai-scanoss/src/browser/ai-scanoss-code-scan-action.tsx b/packages/ai-scanoss/src/browser/ai-scanoss-code-scan-action.tsx new file mode 100644 index 0000000..3af1d58 --- /dev/null +++ b/packages/ai-scanoss/src/browser/ai-scanoss-code-scan-action.tsx @@ -0,0 +1,235 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// *** +import { inject, injectable } from '@theia/core/shared/inversify'; +import { CodeChatResponseContent } from '@theia/ai-chat'; +import { CodePartRendererAction } from '@theia/ai-chat-ui/lib/browser/chat-response-renderer'; +import { + ScanOSSResult, + ScanOSSResultMatch, + ScanOSSService, +} from '@theia/scanoss'; +import { Dialog } from '@theia/core/lib/browser'; +import { ReactNode } from '@theia/core/shared/react'; +import { ResponseNode } from '@theia/ai-chat-ui/lib/browser/chat-tree-view'; +import * as React from '@theia/core/shared/react'; +import { ReactDialog } from '@theia/core/lib/browser/dialogs/react-dialog'; +import { SCAN_OSS_API_KEY_PREF } from '@theia/scanoss/lib/common/scanoss-preferences'; +import { SCANOSS_MODE_PREF } from '../common/ai-scanoss-preferences'; +import { nls, PreferenceService } from '@theia/core'; + +// cached map of scanOSS results. +// 'false' is stored when not automatic check is off and it was not (yet) requested deliberately. +type ScanOSSResults = Map; +interface HasScanOSSResults { + scanOSSResults: ScanOSSResults; + [key: string]: unknown; +} +function hasScanOSSResults(data: { + [key: string]: unknown; +}): data is HasScanOSSResults { + return 'scanOSSResults' in data && data.scanOSSResults instanceof Map; +} + +@injectable() +export class ScanOSSScanButtonAction implements CodePartRendererAction { + @inject(ScanOSSService) + protected readonly scanService: ScanOSSService; + @inject(PreferenceService) + protected readonly preferenceService: PreferenceService; + + priority = 0; + + canRender(response: CodeChatResponseContent, parentNode: ResponseNode): boolean { + if (!hasScanOSSResults(parentNode.response.data)) { + parentNode.response.data.scanOSSResults = new Map< + string, + ScanOSSResult + >(); + } + const results = parentNode.response.data + .scanOSSResults as ScanOSSResults; + const scanOSSMode = this.preferenceService.get(SCANOSS_MODE_PREF, 'off'); + // we mark the code for manual scanning in case it was not handled yet and the mode is manual or off. + // this prevents a possibly unexpected automatic scan of "old" snippets if automatic scan is later turned on. + if (results.get(response.code) === undefined && (scanOSSMode === 'off' || scanOSSMode === 'manual')) { + results.set(response.code, false); + } + return scanOSSMode !== 'off'; + } + + render( + response: CodeChatResponseContent, + parentNode: ResponseNode + ): ReactNode { + const scanOSSResults = parentNode.response.data + .scanOSSResults as ScanOSSResults; + + return ( + + ); + } +} + +const ScanOSSIntegration = React.memo((props: { + code: string; + scanService: ScanOSSService; + scanOSSResults: ScanOSSResults; + preferenceService: PreferenceService; +}) => { + const [automaticCheck] = React.useState(() => + props.preferenceService.get(SCANOSS_MODE_PREF, 'off') === 'automatic' + ); + const [scanOSSResult, setScanOSSResult] = React.useState< + ScanOSSResult | 'pending' | undefined | false + >(props.scanOSSResults.get(props.code)); + const scanCode = React.useCallback(async () => { + setScanOSSResult('pending'); + const result = await props.scanService.scanContent(props.code, props.preferenceService.get(SCAN_OSS_API_KEY_PREF, undefined)); + setScanOSSResult(result); + props.scanOSSResults.set(props.code, result); + return result; + }, [props.code, props.scanService]); + + React.useEffect(() => { + if (scanOSSResult === undefined) { + if (automaticCheck) { + scanCode(); + } else { + // sanity fallback. This codepath should already be handled via "canRender" + props.scanOSSResults.set(props.code, false); + } + } + }, []); + const scanOSSClicked = React.useCallback(async () => { + let scanResult = scanOSSResult; + if (scanResult === 'pending') { + return; + } + if (!scanResult || scanResult.type === 'error') { + scanResult = await scanCode(); + } + if (scanResult && scanResult.type === 'match') { + const dialog = new ScanOSSDialog([scanResult]); + dialog.open(); + } + }, [scanOSSResult]); + let title = 'SCANOSS - Perform scan'; + if (scanOSSResult) { + if (scanOSSResult === 'pending') { + title = nls.localize('theia/ai/scanoss/snippet/in-progress', 'SCANOSS - Performing scan...'); + } else if (scanOSSResult.type === 'error') { + title = nls.localize('theia/ai/scanoss/snippet/errored', 'SCANOSS - Error - {0}', scanOSSResult.message); + } else if (scanOSSResult.type === 'match') { + title = nls.localize('theia/ai/scanoss/snippet/matched', 'SCANOSS - Found {0} match', scanOSSResult.matched); + } else if (scanOSSResult.type === 'clean') { + title = nls.localize('theia/ai/scanoss/snippet/no-match', 'SCANOSS - No match'); + } + } + + return ( +
    + {scanOSSResult && scanOSSResult !== 'pending' && ( + + {scanOSSResult.type === 'clean' && } + {scanOSSResult.type === 'match' && } + {scanOSSResult.type === 'error' && } + + )} +
    + ); +}); + +export class ScanOSSDialog extends ReactDialog { + protected readonly okButton: HTMLButtonElement; + + constructor(protected results: ScanOSSResultMatch[]) { + super({ + title: nls.localize('theia/ai/scanoss/snippet/dialog-header', 'ScanOSS Results'), + }); + this.appendAcceptButton(Dialog.OK); + this.update(); + } + + protected render(): React.ReactNode { + return ( +
    + {this.renderHeader()} + {this.renderSummary()} + {this.renderContent()} +
    + ); + } + + protected renderHeader(): React.ReactNode { + return ( +
    +
    +
    +

    SCANOSS

    +
    +
    + ); + } + + protected renderSummary(): React.ReactNode { + return ( +
    +

    {nls.localize('theia/ai/scanoss/snippet/summary', 'Summary')}

    +
    + {nls.localize('theia/ai/scanoss/snippet/match-count', 'Found {0} match(es)', this.results.length)} +
    +
    + ); + } + + protected renderContent(): React.ReactNode { + return ( +
    +

    {nls.localizeByDefault('Details')}

    + {this.results.map(result => +
    + {result.file &&

    {nls.localize('theia/ai/scanoss/snippet/file-name-heading', 'Match found in {0}', result.file)}

    } + + {result.url} + +
    +                            {JSON.stringify(result.raw, undefined, 2)}
    +                        
    +
    )} +
    + ); + } + + get value(): undefined { + return undefined; + } +} diff --git a/packages/ai-scanoss/src/browser/ai-scanoss-frontend-module.ts b/packages/ai-scanoss/src/browser/ai-scanoss-frontend-module.ts new file mode 100644 index 0000000..fbcfdc2 --- /dev/null +++ b/packages/ai-scanoss/src/browser/ai-scanoss-frontend-module.ts @@ -0,0 +1,36 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import '../../src/browser/style/index.css'; +import { ContainerModule } from '@theia/core/shared/inversify'; +import { AIScanOSSPreferencesSchema } from '../common/ai-scanoss-preferences'; +import { ScanOSSScanButtonAction } from './ai-scanoss-code-scan-action'; +import { CodePartRendererAction } from '@theia/ai-chat-ui/lib/browser/chat-response-renderer'; +import { ChangeSetActionRenderer } from '@theia/ai-chat-ui/lib/browser/change-set-actions/change-set-action-service'; +import { ChangeSetScanActionRenderer } from './change-set-scan-action/change-set-scan-action'; +import { ChangeSetDecorator } from '@theia/ai-chat/lib/browser/change-set-decorator-service'; +import { ChangeSetScanDecorator } from './change-set-scan-action/change-set-scan-decorator'; +import { PreferenceContribution } from '@theia/core'; + +export default new ContainerModule(bind => { + bind(PreferenceContribution).toConstantValue({ schema: AIScanOSSPreferencesSchema }); + bind(ScanOSSScanButtonAction).toSelf().inSingletonScope(); + bind(CodePartRendererAction).toService(ScanOSSScanButtonAction); + bind(ChangeSetScanActionRenderer).toSelf(); + bind(ChangeSetActionRenderer).toService(ChangeSetScanActionRenderer); + bind(ChangeSetScanDecorator).toSelf().inSingletonScope(); + bind(ChangeSetDecorator).toService(ChangeSetScanDecorator); +}); diff --git a/packages/ai-scanoss/src/browser/change-set-scan-action/change-set-scan-action.tsx b/packages/ai-scanoss/src/browser/change-set-scan-action/change-set-scan-action.tsx new file mode 100644 index 0000000..cb3ac2b --- /dev/null +++ b/packages/ai-scanoss/src/browser/change-set-scan-action/change-set-scan-action.tsx @@ -0,0 +1,286 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import * as React from '@theia/core/shared/react'; +import { ChangeSet, ChangeSetElement } from '@theia/ai-chat'; +import { inject, injectable, postConstruct } from '@theia/core/shared/inversify'; +import { ChangeSetActionRenderer } from '@theia/ai-chat-ui/lib/browser/change-set-actions/change-set-action-service'; +import { PreferenceService } from '@theia/core/lib/common/preferences'; +import { ScanOSSService, ScanOSSResult, ScanOSSResultMatch } from '@theia/scanoss'; +import { SCANOSS_MODE_PREF } from '../../common/ai-scanoss-preferences'; +import { SCAN_OSS_API_KEY_PREF } from '@theia/scanoss/lib/common/scanoss-preferences'; +import { ChangeSetFileElement } from '@theia/ai-chat/lib/browser/change-set-file-element'; +import { ScanOSSDialog } from '../ai-scanoss-code-scan-action'; +import { StandaloneServices } from '@theia/monaco-editor-core/esm/vs/editor/standalone/browser/standaloneServices'; +import { IDiffProviderFactoryService } from '@theia/monaco-editor-core/esm/vs/editor/browser/widget/diffEditor/diffProviderFactoryService'; +import { IDocumentDiffProvider } from '@theia/monaco-editor-core/esm/vs/editor/common/diff/documentDiffProvider'; +import { MonacoTextModelService } from '@theia/monaco/lib/browser/monaco-text-model-service'; +import { CancellationToken, Emitter, MessageService, nls } from '@theia/core'; +import { ChangeSetScanDecorator } from './change-set-scan-decorator'; +import { AIActivationService } from '@theia/ai-core/lib/browser'; + +type ScanOSSState = 'pending' | 'clean' | 'match' | 'error' | 'none'; +type ScanOSSResultOptions = 'pending' | ScanOSSResult[] | undefined; + +@injectable() +export class ChangeSetScanActionRenderer implements ChangeSetActionRenderer { + readonly id = 'change-set-scanoss'; + readonly priority = 10; + protected readonly onDidChangeEmitter = new Emitter(); + readonly onDidChange = this.onDidChangeEmitter.event; + + @inject(ScanOSSService) + protected readonly scanService: ScanOSSService; + + @inject(PreferenceService) + protected readonly preferenceService: PreferenceService; + + @inject(MonacoTextModelService) + protected readonly textModelService: MonacoTextModelService; + + @inject(MessageService) + protected readonly messageService: MessageService; + + @inject(ChangeSetScanDecorator) + protected readonly scanChangeSetDecorator: ChangeSetScanDecorator; + + @inject(AIActivationService) + protected readonly activationService: AIActivationService; + + protected differ: IDocumentDiffProvider; + + @postConstruct() + init(): void { + this.differ = StandaloneServices.get(IDiffProviderFactoryService).createDiffProvider({ diffAlgorithm: 'advanced' }); + this._scan = this.runScan.bind(this); + this.preferenceService.onPreferenceChanged(e => e.affects(SCANOSS_MODE_PREF) && this.onDidChangeEmitter.fire()); + } + + canRender(): boolean { + return this.activationService.isActive; + } + + render(changeSet: ChangeSet): React.ReactNode { + return ( + + ); + } + + protected getPreferenceValues(): string { + return this.preferenceService.get(SCANOSS_MODE_PREF, 'off'); + } + + protected _scan: (changeSetElements: ChangeSetElement[]) => Promise; + + protected async runScan(changeSetElements: ChangeSetFileElement[], cache: Map, userTriggered: boolean): Promise { + const apiKey = this.preferenceService.get(SCAN_OSS_API_KEY_PREF, undefined); + let notifiedError = false; + const fileResults = await Promise.all(changeSetElements.map(async fileChange => { + if (fileChange.targetState.trim().length === 0) { + return { type: 'clean' } satisfies ScanOSSResult; + } + const toScan = await this.getScanContent(fileChange); + + if (!toScan) { return { type: 'clean' } satisfies ScanOSSResult; } + + const cached = cache.get(toScan); + if (cached) { return cached; } + + const result = { ...await this.scanService.scanContent(toScan, apiKey), file: fileChange.uri.path.toString() }; + if (result.type !== 'error') { + cache.set(toScan, result); + } else if (!notifiedError && userTriggered) { + notifiedError = true; + this.messageService.warn(nls.localize('theia/ai/scanoss/changeSet/error-notification', 'ScanOSS error encountered: {0}.', result.message)); + } + + return result; + })); + return fileResults; + } + + protected async getScanContent(fileChange: ChangeSetFileElement): Promise { + if (fileChange.replacements) { + return fileChange.replacements.map(({ newContent }) => newContent).join('\n\n').trim(); + } + const textModels = await Promise.all([ + this.textModelService.createModelReference(fileChange.uri), + this.textModelService.createModelReference(fileChange.changedUri) + ]); + + const [original, changed] = textModels; + const diff = await this.differ.computeDiff( + original.object.textEditorModel, + changed.object.textEditorModel, + { maxComputationTimeMs: 5000, computeMoves: false, ignoreTrimWhitespace: true }, + CancellationToken.None + ); + + if (diff.identical) { return ''; } + + const insertions = diff.changes.filter(candidate => !candidate.modified.isEmpty); + + if (insertions.length === 0) { return ''; } + + const changedLinesInSuggestion = insertions.map(change => { + const range = change.modified.toInclusiveRange(); + return range ? changed.object.textEditorModel.getValueInRange(range) : ''; // In practice, we've filtered out cases where the range would be null already. + }).join('\n\n'); + + textModels.forEach(ref => ref.dispose()); + return changedLinesInSuggestion.trim(); + } +} + +interface ChangeSetScanActionProps { + changeSet: ChangeSet; + decorator: ChangeSetScanDecorator; + scanOssMode: string; + scanChangeSet: (changeSet: ChangeSetElement[], cache: Map, userTriggered: boolean) => Promise +} + +const ChangeSetScanOSSIntegration = React.memo(({ + changeSet, + decorator, + scanOssMode, + scanChangeSet +}: ChangeSetScanActionProps) => { + const [scanOSSResult, setScanOSSResult] = React.useState(undefined); + const cache = React.useRef(new Map()); + const [changeSetElements, setChangeSetElements] = React.useState(() => changeSet.getElements().filter(candidate => candidate instanceof ChangeSetFileElement)); + + React.useEffect(() => { + if (scanOSSResult === undefined) { + if (scanOssMode === 'automatic' && scanOSSResult === undefined) { + setScanOSSResult('pending'); + scanChangeSet(changeSetElements, cache.current, false).then(result => setScanOSSResult(result)); + } + } + }, [scanOssMode, scanOSSResult]); + + React.useEffect(() => { + if (!Array.isArray(scanOSSResult)) { + decorator.setScanResult([]); + return; + } + decorator.setScanResult(scanOSSResult); + }, [decorator, scanOSSResult]); + + React.useEffect(() => { + const disposable = changeSet.onDidChange(() => { + setChangeSetElements(changeSet.getElements().filter(candidate => candidate instanceof ChangeSetFileElement)); + setScanOSSResult(undefined); + }); + return () => disposable.dispose(); + }, [changeSet]); + + const scanOSSClicked = React.useCallback(async () => { + if (scanOSSResult === 'pending') { + return; + } else if (!scanOSSResult || scanOSSResult.some(candidate => candidate.type === 'error')) { + setScanOSSResult('pending'); + scanChangeSet(changeSetElements, cache.current, true).then(result => setScanOSSResult(result)); + } else { + const matches = scanOSSResult.filter((candidate): candidate is ScanOSSResultMatch => candidate.type === 'match'); + if (matches.length === 0) { return; } + const dialog = new ScanOSSDialog(matches); + dialog.open(); + } + }, [scanOSSResult, changeSetElements]); + + const state = getResult(scanOSSResult); + const title = `ScanOSS: ${getTitle(state)}`; + const content = getContent(state); + const icon = getIcon(state); + + if (scanOssMode === 'off' || changeSetElements.length === 0) { + return undefined; + } else if (state === 'clean' || state === 'pending') { + return
    +
    + {icon} +
    +
    ; + } else { + return ; + } +}); + +function getResult(scanOSSResult: ScanOSSResultOptions): ScanOSSState { + switch (true) { + case scanOSSResult === undefined: return 'none'; + case scanOSSResult === 'pending': return 'pending'; + case (scanOSSResult as ScanOSSResult[]).some(candidate => candidate.type === 'error'): return 'error'; + case (scanOSSResult as ScanOSSResult[]).some(candidate => candidate.type === 'match'): return 'match'; + default: return 'clean'; + } +} + +function getTitle(result: ScanOSSState): string { + switch (result) { + case 'none': return nls.localize('theia/ai/scanoss/changeSet/scan', 'Scan'); + case 'pending': return nls.localize('theia/ai/scanoss/changeSet/scanning', 'Scanning...'); + case 'error': return nls.localize('theia/ai/scanoss/changeSet/error', 'Error: Rerun'); + case 'match': return nls.localize('theia/ai/scanoss/changeSet/match', 'View Matches'); + case 'clean': return nls.localize('theia/ai/scanoss/changeSet/clean', 'No Matches'); + default: return ''; + } +} + +function getContent(result: ScanOSSState): string { + switch (result) { + case 'none': return getTitle(result); + case 'pending': return getTitle(result); + default: return ''; + } +} + +function getIcon(result: ScanOSSState): React.ReactNode { + switch (result) { + case 'clean': return ( + + ); + case 'match': return ( + + ); + default: return undefined; + } +} diff --git a/packages/ai-scanoss/src/browser/change-set-scan-action/change-set-scan-decorator.ts b/packages/ai-scanoss/src/browser/change-set-scan-action/change-set-scan-decorator.ts new file mode 100644 index 0000000..0eef5f6 --- /dev/null +++ b/packages/ai-scanoss/src/browser/change-set-scan-action/change-set-scan-decorator.ts @@ -0,0 +1,54 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import type { ChangeSetDecoration, ChangeSetElement } from '@theia/ai-chat'; +import type { ChangeSetDecorator } from '@theia/ai-chat/lib/browser/change-set-decorator-service'; +import { Emitter } from '@theia/core'; +import { injectable } from '@theia/core/shared/inversify'; +import type { ScanOSSResult } from '@theia/scanoss'; + +@injectable() +export class ChangeSetScanDecorator implements ChangeSetDecorator { + readonly id = 'thei-change-set-scanoss-decorator'; + + protected readonly emitter = new Emitter(); + readonly onDidChangeDecorations = this.emitter.event; + + protected scanResult: ScanOSSResult[] = []; + + setScanResult(results: ScanOSSResult[]): void { + this.scanResult = results; + this.emitter.fire(); + } + + decorate(element: ChangeSetElement): ChangeSetDecoration | undefined { + const match = this.scanResult.find(result => { + if (result.type === 'match') { + return result.file === element.uri.path.toString(); + } + return false; + }); + + if (match) { + return { + additionalInfoSuffixIcon: ['additional-info-scanoss-icon', 'match', 'codicon', 'codicon-warning'], + }; + } + + return undefined; + } + +} diff --git a/packages/ai-scanoss/src/browser/style/index.css b/packages/ai-scanoss/src/browser/style/index.css new file mode 100644 index 0000000..8011bdb --- /dev/null +++ b/packages/ai-scanoss/src/browser/style/index.css @@ -0,0 +1,201 @@ +.scanoss-icon::before { + content: ""; + mask-image: url("scanoss_logo_dark_theme.svg"); + mask-repeat: no-repeat; + mask-position: 50% 50%; + mask-size: inherit; + height: inherit; + width: inherit; + display: inline-block; + background: var(--theia-sideBar-foreground, var(--theia-foreground)); +} + +.vs-light .scanoss-icon::before, +.theia-light .scanoss-icon::before, +.light-theia .scanoss-icon::before { + mask-image: url("scanoss_logo_light_theme.svg"); +} + +/* We need a more detailed selector to override the default button style */ +.theia-CodePartRenderer-actions .scanoss-icon::before { + transition: filter 0.3s; +} + +.scanoss-icon.pending { + pointer-events: none; + cursor: default; +} +.scanoss-icon.pending::before { + animation: scan-os-fade 3s infinite ease-in-out; +} + +@keyframes scan-os-fade { + 0%, + 100% { + opacity: 0; + } + 50% { + opacity: 1; + } +} + +/* Use a rounded background when not hovered */ +.theia-CodePartRenderer-actions .scanoss-icon:not(:hover) { + border-radius: 50%; +} + +.scanoss-icon.match::before, +.scanoss-icon.clean::before, +.scanoss-icon.error::before { + background-color: var(--theia-disabledForeground); +} + +.icon-container { + position: relative; + display: inline-block; + width: 16px; + height: 16px; +} + +.icon-container.scanoss-icon::before { + width: 16px; + height: 16px; + mask-size: 16px; +} + +.icon-container.scanoss-icon.clean, +.icon-container.scanoss-icon.match, +.icon-container.scanoss-icon.error { + margin-right: 12px; +} + +/* The placeholder is used to align with the remaining actions, however it should not be visible*/ +.scanoss-icon .placeholder { + visibility: hidden; +} + +/* The status icon is used to display the result of the scan on the top right */ +.scanoss-icon .status-icon { + position: absolute; + font-size: 14px; + transform: translate(-4px, -2px); +} + +.scanoss-icon.clean .status-icon { + color: var(--theia-successBackground); +} +.scanoss-icon.match .status-icon, +.additional-info-scanoss-icon.match { + color: var(--theia-problemsWarningIcon-foreground); +} +.scanoss-icon.error .status-icon { + color: var(--theia-problemsErrorIcon-foreground); +} + +/* Disable the button when it's in the clean state */ +.theia-CodePartRenderer-actions .scanoss-icon.clean { + pointer-events: none; + cursor: default; +} + +.scanoss-dialog-container .scanoss-header { + display: flex; + flex-direction: column; + align-items: center; + margin-bottom: 20px; +} + +.scanoss-dialog-container .scanoss-icon-container { + display: flex; + flex-direction: row; + align-items: center; + gap: 10px; +} + +.scanoss-dialog-container .scanoss-icon { + width: 40px; + height: 40px; + mask-size: 40px; +} + +.scanoss-dialog-container .scanoss-icon-container h2 { + font-size: 1.8em; + margin: 0; +} + +.scanoss-dialog-container .scanoss-summary { + padding: 15px; + border-radius: 4px; + margin-bottom: 20px; +} + +.scanoss-dialog-container .scanoss-summary h3 { + margin-top: 0; + font-size: 1.4em; + margin-bottom: 10px; +} + +.scanoss-dialog-container .scanoss-details { + padding: 15px; + border-radius: 4px; + border: 1px solid var(--theia-sideBarSectionHeader-border); +} + +.scanoss-dialog-container .scanoss-details h4 { + margin-top: 0; + font-size: 1.2em; + margin-bottom: 10px; +} + +.scanoss-dialog-container .scanoss-details pre { + background: var(--theia-editor-background); + padding: 10px; + border-radius: 4px; + max-width: 70vw; + max-height: 40vh; + overflow: auto; + font-size: 0.9em; +} + +/* ####### Change Set ####### */ + +.theia-changeSet-scanOss { + display: flex; + flex-flow: row nowrap; + align-items: center; + justify-content: center; + gap: var(--theia-ui-padding); +} + +.theia-changeSet-scanOss.readonly { + margin-right: 10px; + height: 100%; +} + +.theia-changeSet-Action .theia-button.secondary { + background: none; +} + +.theia-changeSet-Action .theia-button.secondary:hover { + background: var(--theia-toolbar-hoverBackground); +} + +.theia-changeSet-scanOss.clean, +.theia-changeSet-scanOss.pending { + cursor: default; +} + +.theia-changeSet-scanOss.clean:hover, +.theia-changeSet-scanOss.pending:hover { + background-color: var(--theia-button-background); +} + +.theia-changeSet-scanOss .scanoss-icon.clean, +.theia-changeSet-scanOss .scanoss-icon.match, +.theia-changeSet-scanOss .scanoss-icon.error { + margin-right: 0px; +} + +.theia-changeSet-scanOss .status-icon { + height: 16px; +} diff --git a/packages/ai-scanoss/src/browser/style/scanoss_logo_dark_theme.svg b/packages/ai-scanoss/src/browser/style/scanoss_logo_dark_theme.svg new file mode 100644 index 0000000..d142abb --- /dev/null +++ b/packages/ai-scanoss/src/browser/style/scanoss_logo_dark_theme.svg @@ -0,0 +1,19 @@ + + + + + + + + + + + diff --git a/packages/ai-scanoss/src/browser/style/scanoss_logo_light_theme.svg b/packages/ai-scanoss/src/browser/style/scanoss_logo_light_theme.svg new file mode 100644 index 0000000..9a9893f --- /dev/null +++ b/packages/ai-scanoss/src/browser/style/scanoss_logo_light_theme.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/packages/ai-scanoss/src/common/ai-scanoss-preferences.ts b/packages/ai-scanoss/src/common/ai-scanoss-preferences.ts new file mode 100644 index 0000000..f6e61c8 --- /dev/null +++ b/packages/ai-scanoss/src/common/ai-scanoss-preferences.ts @@ -0,0 +1,39 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { AI_CORE_PREFERENCES_TITLE } from '@theia/ai-core/lib/common/ai-core-preferences'; +import { nls, PreferenceSchema } from '@theia/core'; + +export const SCANOSS_MODE_PREF = 'ai-features.SCANOSS.mode'; + +export const AIScanOSSPreferencesSchema: PreferenceSchema = { + properties: { + [SCANOSS_MODE_PREF]: { + type: 'string', + enum: ['off', 'manual', 'automatic'], + markdownEnumDescriptions: [ + nls.localize('theia/ai/scanoss/mode/off/description', 'Feature is turned off completely.'), + nls.localize('theia/ai/scanoss/mode/manual/description', 'User can manually trigger the scan by clicking the SCANOSS item in the chat view.'), + nls.localize('theia/ai/scanoss/mode/automatic/description', 'Enable automatic scan of code snippets in chat views.') + ], + markdownDescription: nls.localize('theia/ai/scanoss/mode/description', + 'Configure the SCANOSS feature for analyzing code snippets in chat views. This will send a hash of suggested code snippets to the SCANOSS\n\ +service hosted by the [Software Transparency foundation](https://www.softwaretransparency.org/osskb) for analysis.'), + default: 'off', + title: AI_CORE_PREFERENCES_TITLE + } + } +}; diff --git a/packages/ai-scanoss/src/node/ai-scanoss-backend-module.ts b/packages/ai-scanoss/src/node/ai-scanoss-backend-module.ts new file mode 100644 index 0000000..8ebc93b --- /dev/null +++ b/packages/ai-scanoss/src/node/ai-scanoss-backend-module.ts @@ -0,0 +1,23 @@ +// ***************************************************************************** +// Copyright (C) 2025 STMicroelectronics and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { ContainerModule } from '@theia/core/shared/inversify'; +import { AIScanOSSPreferencesSchema } from '../common/ai-scanoss-preferences'; +import { PreferenceContribution } from '@theia/core'; + +export default new ContainerModule(bind => { + bind(PreferenceContribution).toConstantValue({ schema: AIScanOSSPreferencesSchema }); +}); diff --git a/packages/ai-scanoss/src/package.spec.ts b/packages/ai-scanoss/src/package.spec.ts new file mode 100644 index 0000000..084f1c2 --- /dev/null +++ b/packages/ai-scanoss/src/package.spec.ts @@ -0,0 +1,28 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +/* note: this bogus test file is required so that + we are able to run mocha unit tests on this + package, without having any actual unit tests in it. + This way a coverage report will be generated, + showing 0% coverage, instead of no report. + This file can be removed once we have real unit + tests in place. */ + +describe('ai-scanoss package', () => { + + it('support code coverage statistics', () => true); +}); diff --git a/packages/ai-scanoss/tsconfig.json b/packages/ai-scanoss/tsconfig.json new file mode 100644 index 0000000..d08ab7f --- /dev/null +++ b/packages/ai-scanoss/tsconfig.json @@ -0,0 +1,31 @@ +{ + "extends": "../../configs/base.tsconfig", + "compilerOptions": { + "composite": true, + "rootDir": "src", + "outDir": "lib" + }, + "include": [ + "src" + ], + "references": [ + { + "path": "../ai-chat" + }, + { + "path": "../ai-chat-ui" + }, + { + "path": "../ai-core" + }, + { + "path": "../core" + }, + { + "path": "../monaco" + }, + { + "path": "../scanoss" + } + ] +} diff --git a/packages/ai-terminal/.eslintrc.js b/packages/ai-terminal/.eslintrc.js new file mode 100644 index 0000000..1308994 --- /dev/null +++ b/packages/ai-terminal/.eslintrc.js @@ -0,0 +1,10 @@ +/** @type {import('eslint').Linter.Config} */ +module.exports = { + extends: [ + '../../configs/build.eslintrc.json' + ], + parserOptions: { + tsconfigRootDir: __dirname, + project: 'tsconfig.json' + } +}; diff --git a/packages/ai-terminal/README.md b/packages/ai-terminal/README.md new file mode 100644 index 0000000..77ba1aa --- /dev/null +++ b/packages/ai-terminal/README.md @@ -0,0 +1,51 @@ +
    + +
    + +theia-ext-logo + +

    ECLIPSE THEIA - AI TERMINAL EXTENSION

    + +
    + +
    + +## Description + +The `@theia/ai-terminal` extension contributes an overlay to the terminal view.\ +The overlay can be used to ask a dedicated `TerminalAgent` for suggestions of terminal commands. + +It also provides the `shellExecute` tool that allows AI agents to run commands on the host system. + +## Shell Execution Tool + +The `shellExecute` tool enables AI agents to execute shell commands on the host system with user confirmation. + +### Security + +By default, every command requires explicit user approval. The tool is marked with `confirmAlwaysAllow`, which shows an additional warning dialog when users try to enable auto-approval. + +> **Warning**: This tool has full system access. Only enable auto-approval in isolated environments (containers, VMs). + +### Features + +- Execute any shell command (bash on Linux/macOS, cmd/PowerShell on Windows) +- Configurable working directory and timeout (default 2 min, max 10 min) +- Output truncation (first/last 50 lines) for large outputs +- Cancellation support + +## Additional Information + +- [API documentation for `@theia/ai-terminal`](https://eclipse-theia.github.io/theia/docs/next/modules/_theia_ai_terminal.html) +- [Theia - GitHub](https://github.com/eclipse-theia/theia) +- [Theia - Website](https://theia-ide.org/) + +## License + +- [Eclipse Public License 2.0](http://www.eclipse.org/legal/epl-2.0/) +- [一 (Secondary) GNU General Public License, version 2 with the GNU Classpath Exception](https://projects.eclipse.org/license/secondary-gpl-2.0-cp) + +## Trademark + +"Theia" is a trademark of the Eclipse Foundation + diff --git a/packages/ai-terminal/package.json b/packages/ai-terminal/package.json new file mode 100644 index 0000000..bf956df --- /dev/null +++ b/packages/ai-terminal/package.json @@ -0,0 +1,54 @@ +{ + "name": "@theia/ai-terminal", + "version": "1.68.0", + "description": "Theia - AI Terminal Extension", + "dependencies": { + "@theia/ai-chat": "1.68.0", + "@theia/ai-chat-ui": "1.68.0", + "@theia/ai-core": "1.68.0", + "@theia/core": "1.68.0", + "@theia/terminal": "1.68.0", + "@theia/workspace": "1.68.0", + "zod": "^4.2.1" + }, + "publishConfig": { + "access": "public" + }, + "theiaExtensions": [ + { + "frontend": "lib/browser/ai-terminal-frontend-module", + "backend": "lib/node/ai-terminal-backend-module" + } + ], + "keywords": [ + "theia-extension" + ], + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "repository": { + "type": "git", + "url": "https://github.com/eclipse-theia/theia.git" + }, + "bugs": { + "url": "https://github.com/eclipse-theia/theia/issues" + }, + "homepage": "https://github.com/eclipse-theia/theia", + "files": [ + "lib", + "src" + ], + "scripts": { + "build": "theiaext build", + "clean": "theiaext clean", + "compile": "theiaext compile", + "lint": "theiaext lint", + "test": "theiaext test", + "watch": "theiaext watch" + }, + "devDependencies": { + "@theia/ext-scripts": "1.68.0" + }, + "nyc": { + "extends": "../../configs/nyc.json" + }, + "gitHead": "21358137e41342742707f660b8e222f940a27652" +} diff --git a/packages/ai-terminal/src/browser/ai-terminal-agent.ts b/packages/ai-terminal/src/browser/ai-terminal-agent.ts new file mode 100644 index 0000000..af3dabe --- /dev/null +++ b/packages/ai-terminal/src/browser/ai-terminal-agent.ts @@ -0,0 +1,177 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { + Agent, + getJsonOfResponse, + isLanguageModelParsedResponse, + LanguageModelRegistry, + LanguageModelRequirement, + PromptService, + UserRequest +} from '@theia/ai-core/lib/common'; +import { LanguageModelService } from '@theia/ai-core/lib/browser'; +import { generateUuid, ILogger, nls } from '@theia/core'; +import { terminalPrompts } from './ai-terminal-prompt-template'; +import { inject, injectable } from '@theia/core/shared/inversify'; +import { z } from 'zod'; + +const Commands = z.object({ + commands: z.array(z.string()), +}); +type Commands = z.infer; + +@injectable() +export class AiTerminalAgent implements Agent { + + id = 'Terminal Assistant'; + name = 'Terminal Assistant'; + description = nls.localize('theia/ai/terminal/agent/description', 'This agent provides assistance to write and execute arbitrary terminal commands. \ + Based on the user\'s request, it suggests commands and allows the user to directly paste and execute them in the terminal. \ + It accesses the current directory, environment and the recent terminal output of the terminal session to provide context-aware assistance'); + variables = []; + functions = []; + agentSpecificVariables = [ + { + name: 'userRequest', + usedInPrompt: true, + description: nls.localize('theia/ai/terminal/agent/vars/userRequest/description', 'The user\'s question or request.') + }, + { + name: 'shell', + usedInPrompt: true, + description: nls.localize('theia/ai/terminal/agent/vars/shell/description', 'The shell being used, e.g., /usr/bin/zsh.') + }, + { + name: 'cwd', + usedInPrompt: true, + description: nls.localize('theia/ai/terminal/agent/vars/cwd/description', 'The current working directory.') + }, + { + name: 'recentTerminalContents', + usedInPrompt: true, + description: nls.localize('theia/ai/terminal/agent/vars/recentTerminalContents/description', 'The last 0 to 50 recent lines visible in the terminal.') + } + ]; + prompts = terminalPrompts; + languageModelRequirements: LanguageModelRequirement[] = [ + { + purpose: 'suggest-terminal-commands', + identifier: 'default/universal', + } + ]; + + @inject(LanguageModelRegistry) + protected languageModelRegistry: LanguageModelRegistry; + + @inject(PromptService) + protected promptService: PromptService; + + @inject(ILogger) + protected logger: ILogger; + + @inject(LanguageModelService) + protected languageModelService: LanguageModelService; + + async getCommands( + userRequest: string, + cwd: string, + shell: string, + recentTerminalContents: string[], + ): Promise { + const lm = await this.languageModelRegistry.selectLanguageModel({ + agent: this.id, + ...this.languageModelRequirements[0] + }); + if (!lm) { + this.logger.error('No language model available for the AI Terminal Agent.'); + return []; + } + + const parameters = { + userRequest, + shell, + cwd, + recentTerminalContents + }; + + const systemMessage = await this.promptService.getResolvedPromptFragment('terminal-system', parameters).then(p => p?.text); + const request = await this.promptService.getResolvedPromptFragment('terminal-user', parameters).then(p => p?.text); + if (!systemMessage || !request) { + this.logger.error('The prompt service didn\'t return prompts for the AI Terminal Agent.'); + return []; + } + + const variantInfo = this.promptService.getPromptVariantInfo('terminal-system'); + + // since we do not actually hold complete conversions, the request/response pair is considered a session + const sessionId = generateUuid(); + const requestId = generateUuid(); + const llmRequest: UserRequest = { + messages: [ + { + actor: 'ai', + type: 'text', + text: systemMessage + }, + { + actor: 'user', + type: 'text', + text: request + } + ], + response_format: { + type: 'json_schema', + json_schema: { + name: 'terminal-commands', + description: 'Suggested terminal commands based on the user request', + schema: Commands.toJSONSchema() + } + }, + agentId: this.id, + requestId, + sessionId, + promptVariantId: variantInfo?.variantId, + isPromptVariantCustomized: variantInfo?.isCustomized + }; + + try { + const result = await this.languageModelService.sendRequest(lm, llmRequest); + + if (isLanguageModelParsedResponse(result)) { + // model returned structured output + const parsedResult = Commands.safeParse(result.parsed); + if (parsedResult.success) { + return parsedResult.data.commands; + } + } + + // fall back to agent-based parsing of result + const jsonResult = await getJsonOfResponse(result); + const parsedJsonResult = Commands.safeParse(jsonResult); + if (parsedJsonResult.success) { + return parsedJsonResult.data.commands; + } + + return []; + + } catch (error) { + this.logger.error('Error obtaining the command suggestions.', error); + return []; + } + } + +} diff --git a/packages/ai-terminal/src/browser/ai-terminal-contribution.ts b/packages/ai-terminal/src/browser/ai-terminal-contribution.ts new file mode 100644 index 0000000..c49ea29 --- /dev/null +++ b/packages/ai-terminal/src/browser/ai-terminal-contribution.ts @@ -0,0 +1,209 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { ENABLE_AI_CONTEXT_KEY } from '@theia/ai-core/lib/browser'; +import { Command, CommandContribution, CommandRegistry, MenuContribution, MenuModelRegistry } from '@theia/core'; +import { ApplicationShell, codicon, KeybindingContribution, KeybindingRegistry } from '@theia/core/lib/browser'; +import { inject, injectable } from '@theia/core/shared/inversify'; +import { TerminalService } from '@theia/terminal/lib/browser/base/terminal-service'; +import { TerminalMenus } from '@theia/terminal/lib/browser/terminal-frontend-contribution'; +import { TerminalWidgetImpl } from '@theia/terminal/lib/browser/terminal-widget-impl'; +import { AiTerminalAgent } from './ai-terminal-agent'; +import { AICommandHandlerFactory } from '@theia/ai-core/lib/browser/ai-command-handler-factory'; +import { AgentService } from '@theia/ai-core'; +import { nls } from '@theia/core/lib/common/nls'; + +const AI_TERMINAL_COMMAND = Command.toLocalizedCommand({ + id: 'ai-terminal:open', + label: 'Ask AI', + iconClass: codicon('sparkle') +}, 'theia/ai/terminal/askAi'); + +@injectable() +export class AiTerminalCommandContribution implements CommandContribution, MenuContribution, KeybindingContribution { + + @inject(TerminalService) + protected terminalService: TerminalService; + + @inject(AiTerminalAgent) + protected terminalAgent: AiTerminalAgent; + + @inject(AICommandHandlerFactory) + protected commandHandlerFactory: AICommandHandlerFactory; + + @inject(AgentService) + private readonly agentService: AgentService; + + @inject(ApplicationShell) + protected readonly shell: ApplicationShell; + + registerKeybindings(keybindings: KeybindingRegistry): void { + keybindings.registerKeybinding({ + command: AI_TERMINAL_COMMAND.id, + keybinding: 'ctrlcmd+i', + when: `terminalFocus && ${ENABLE_AI_CONTEXT_KEY}` + }); + } + registerMenus(menus: MenuModelRegistry): void { + menus.registerMenuAction([...TerminalMenus.TERMINAL_CONTEXT_MENU, '_5'], { + when: ENABLE_AI_CONTEXT_KEY, + commandId: AI_TERMINAL_COMMAND.id, + icon: AI_TERMINAL_COMMAND.iconClass + }); + } + registerCommands(commands: CommandRegistry): void { + commands.registerCommand(AI_TERMINAL_COMMAND, this.commandHandlerFactory({ + execute: () => { + const currentTerminal = this.terminalService.currentTerminal; + if (currentTerminal instanceof TerminalWidgetImpl && currentTerminal.kind === 'user') { + new AiTerminalChatWidget( + currentTerminal, + this.terminalAgent + ); + } + }, + isEnabled: () => + // Ensure it is only enabled for terminals explicitly launched by the user, not to terminals created e.g. for running tasks + this.agentService.isEnabled(this.terminalAgent.id) + && this.shell.currentWidget instanceof TerminalWidgetImpl + && (this.shell.currentWidget as TerminalWidgetImpl).kind === 'user' + })); + } +} + +class AiTerminalChatWidget { + + protected chatContainer: HTMLDivElement; + protected chatInput: HTMLTextAreaElement; + protected chatResultParagraph: HTMLParagraphElement; + protected chatInputContainer: HTMLDivElement; + + protected haveResult = false; + commands: string[]; + + constructor( + protected terminalWidget: TerminalWidgetImpl, + protected terminalAgent: AiTerminalAgent + ) { + this.chatContainer = document.createElement('div'); + this.chatContainer.className = 'ai-terminal-chat-container'; + + const chatCloseButton = document.createElement('span'); + chatCloseButton.className = 'closeButton codicon codicon-close'; + chatCloseButton.onclick = () => this.dispose(); + this.chatContainer.appendChild(chatCloseButton); + + const chatResultContainer = document.createElement('div'); + chatResultContainer.className = 'ai-terminal-chat-result'; + this.chatResultParagraph = document.createElement('p'); + this.chatResultParagraph.textContent = nls.localize('theia/ai/terminal/howCanIHelp', 'How can I help you?'); + chatResultContainer.appendChild(this.chatResultParagraph); + this.chatContainer.appendChild(chatResultContainer); + + this.chatInputContainer = document.createElement('div'); + this.chatInputContainer.className = 'ai-terminal-chat-input-container'; + + this.chatInput = document.createElement('textarea'); + this.chatInput.className = 'theia-input theia-ChatInput'; + this.chatInput.placeholder = nls.localize('theia/ai/terminal/askTerminalCommand', 'Ask about a terminal command...'); + this.chatInput.onkeydown = event => { + if (event.key === 'Enter' && !event.shiftKey) { + event.preventDefault(); + if (!this.haveResult) { + this.send(); + } else { + this.terminalWidget.sendText(this.chatResultParagraph.innerText); + this.dispose(); + } + } else if (event.key === 'Escape') { + this.dispose(); + } else if (event.key === 'ArrowUp' && this.haveResult) { + this.updateChatResult(this.getNextCommandIndex(1)); + } else if (event.key === 'ArrowDown' && this.haveResult) { + this.updateChatResult(this.getNextCommandIndex(-1)); + } + }; + this.chatInputContainer.appendChild(this.chatInput); + + const chatInputOptionsContainer = document.createElement('div'); + const chatInputOptionsSpan = document.createElement('span'); + chatInputOptionsSpan.className = 'codicon codicon-send option'; + chatInputOptionsSpan.title = nls.localizeByDefault('Send'); + chatInputOptionsSpan.onclick = () => this.send(); + chatInputOptionsContainer.appendChild(chatInputOptionsSpan); + this.chatInputContainer.appendChild(chatInputOptionsContainer); + + this.chatContainer.appendChild(this.chatInputContainer); + + terminalWidget.node.appendChild(this.chatContainer); + + this.chatInput.focus(); + } + + protected async send(): Promise { + const userRequest = this.chatInput.value; + if (userRequest) { + this.chatInput.value = ''; + + this.chatResultParagraph.innerText = nls.localize('theia/ai/terminal/loading', 'Loading'); + this.chatResultParagraph.className = 'loading'; + + const cwd = (await this.terminalWidget.cwd).toString(); + const processInfo = await this.terminalWidget.processInfo; + const shell = processInfo.executable; + const recentTerminalContents = this.getRecentTerminalCommands(); + + this.commands = await this.terminalAgent.getCommands(userRequest, cwd, shell, recentTerminalContents); + + if (this.commands.length > 0) { + this.chatResultParagraph.className = 'command'; + this.chatResultParagraph.innerText = this.commands[0]; + this.chatInput.placeholder = nls.localize('theia/ai/terminal/hitEnterConfirm', 'Hit enter to confirm'); + if (this.commands.length > 1) { + this.chatInput.placeholder += nls.localize('theia/ai/terminal/useArrowsAlternatives', ' or use ⇅ to show alternatives...'); + } + this.haveResult = true; + } else { + this.chatResultParagraph.className = ''; + this.chatResultParagraph.innerText = nls.localizeByDefault('No results'); + this.chatInput.placeholder = nls.localize('theia/ai/terminal/tryAgain', 'Try again...'); + } + } + } + + protected getRecentTerminalCommands(): string[] { + const maxLines = 100; + return this.terminalWidget.buffer.getLines(0, + this.terminalWidget.buffer.length > maxLines ? maxLines : this.terminalWidget.buffer.length + ); + } + + protected getNextCommandIndex(step: number): number { + const currentIndex = this.commands.indexOf(this.chatResultParagraph.innerText); + const nextIndex = (currentIndex + step + this.commands.length) % this.commands.length; + return nextIndex; + } + + protected updateChatResult(index: number): void { + this.chatResultParagraph.innerText = this.commands[index]; + } + + protected dispose(): void { + this.chatInput.value = ''; + this.terminalWidget.node.removeChild(this.chatContainer); + this.terminalWidget.getTerminal().focus(); + } +} diff --git a/packages/ai-terminal/src/browser/ai-terminal-frontend-module.ts b/packages/ai-terminal/src/browser/ai-terminal-frontend-module.ts new file mode 100644 index 0000000..a536ca5 --- /dev/null +++ b/packages/ai-terminal/src/browser/ai-terminal-frontend-module.ts @@ -0,0 +1,49 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { ChatResponsePartRenderer } from '@theia/ai-chat-ui/lib/browser/chat-response-part-renderer'; +import { Agent } from '@theia/ai-core/lib/common'; +import { bindToolProvider } from '@theia/ai-core/lib/common/tool-invocation-registry'; +import { CommandContribution, MenuContribution } from '@theia/core'; +import { KeybindingContribution, WebSocketConnectionProvider } from '@theia/core/lib/browser'; +import { ContainerModule } from '@theia/core/shared/inversify'; +import { AiTerminalAgent } from './ai-terminal-agent'; +import { AiTerminalCommandContribution } from './ai-terminal-contribution'; +import { ShellExecutionTool } from './shell-execution-tool'; +import { ShellExecutionToolRenderer } from './shell-execution-tool-renderer'; +import { ShellExecutionServer, shellExecutionPath } from '../common/shell-execution-server'; + +import '../../src/browser/style/ai-terminal.css'; +import '../../src/browser/style/shell-execution-tool.css'; + +export default new ContainerModule(bind => { + bind(AiTerminalCommandContribution).toSelf().inSingletonScope(); + for (const identifier of [CommandContribution, MenuContribution, KeybindingContribution]) { + bind(identifier).toService(AiTerminalCommandContribution); + } + + bind(AiTerminalAgent).toSelf().inSingletonScope(); + bind(Agent).toService(AiTerminalAgent); + + bindToolProvider(ShellExecutionTool, bind); + + bind(ShellExecutionServer).toDynamicValue(ctx => { + const connection = ctx.container.get(WebSocketConnectionProvider); + return connection.createProxy(shellExecutionPath); + }).inSingletonScope(); + + bind(ChatResponsePartRenderer).to(ShellExecutionToolRenderer).inSingletonScope(); +}); diff --git a/packages/ai-terminal/src/browser/ai-terminal-prompt-template.ts b/packages/ai-terminal/src/browser/ai-terminal-prompt-template.ts new file mode 100644 index 0000000..bf60894 --- /dev/null +++ b/packages/ai-terminal/src/browser/ai-terminal-prompt-template.ts @@ -0,0 +1,80 @@ +/* eslint-disable @typescript-eslint/tslint/config */ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH and others. +// +// This file is licensed under the MIT License. +// See LICENSE-MIT.txt in the project root for license information. +// https://opensource.org/license/mit. +// +// SPDX-License-Identifier: MIT +// ***************************************************************************** + +import { PromptVariantSet } from '@theia/ai-core'; + +export const terminalPrompts: PromptVariantSet[] = [ + { + id: 'terminal-system', + defaultVariant: { + id: 'terminal-system-default', + template: `{{!-- This prompt is licensed under the MIT License (https://opensource.org/license/mit). +Made improvements or adaptations to this prompt template? We’d love for you to share it with the community! Contribute back here: +https://github.com/eclipse-theia/theia/discussions/new?category=prompt-template-contribution --}} +# Instructions +Generate one or more command suggestions based on the user's request, considering the shell being used, +the current working directory, and the recent terminal contents. Provide the best suggestion first, +followed by other relevant suggestions if the user asks for further options. + +Parameters: +- user-request: The user's question or request. +- shell: The shell being used, e.g., /usr/bin/zsh. +- cwd: The current working directory. +- recent-terminal-contents: The last 0 to 50 recent lines visible in the terminal. + +Return the result in the following JSON format: +{ + "commands": [ + "best_command_suggestion", + "next_best_command_suggestion", + "another_command_suggestion" + ] +} + +## Example +user-request: "How do I commit changes?" +shell: "/usr/bin/zsh" +cwd: "/home/user/project" +recent-terminal-contents: +git status +On branch main +Your branch is up to date with 'origin/main'. +nothing to commit, working tree clean + +## Expected JSON output +\`\`\`json +\{ + "commands": [ + "git commit", + "git commit --amend", + "git commit -a" + ] +} +\`\`\` +` + } + }, + { + id: 'terminal-user', + defaultVariant: { + id: 'terminal-user-default', + template: `{{!-- This prompt is licensed under the MIT License (https://opensource.org/license/mit). +Made improvements or adaptations to this prompt template? We’d love for you to share it with the community! Contribute back here: +https://github.com/eclipse-theia/theia/discussions/new?category=prompt-template-contribution --}} +user-request: {{userRequest}} +shell: {{shell}} +cwd: {{cwd}} +recent-terminal-contents: +{{recentTerminalContents}} +` + } + } +]; diff --git a/packages/ai-terminal/src/browser/shell-execution-tool-renderer.tsx b/packages/ai-terminal/src/browser/shell-execution-tool-renderer.tsx new file mode 100644 index 0000000..befeaa5 --- /dev/null +++ b/packages/ai-terminal/src/browser/shell-execution-tool-renderer.tsx @@ -0,0 +1,648 @@ +// ***************************************************************************** +// Copyright (C) 2026 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { ChatResponsePartRenderer } from '@theia/ai-chat-ui/lib/browser/chat-response-part-renderer'; +import { ResponseNode } from '@theia/ai-chat-ui/lib/browser/chat-tree-view'; +import { ToolConfirmationActions, ConfirmationScope } from '@theia/ai-chat-ui/lib/browser/chat-response-renderer/tool-confirmation'; +import { ChatResponseContent, ToolCallChatResponseContent } from '@theia/ai-chat/lib/common'; +import { ToolConfirmationMode as ToolConfirmationPreferenceMode } from '@theia/ai-chat/lib/common/chat-tool-preferences'; +import { ToolConfirmationManager } from '@theia/ai-chat/lib/browser/chat-tool-preference-bindings'; +import { ToolInvocationRegistry, ToolRequest } from '@theia/ai-core'; +import { nls } from '@theia/core/lib/common/nls'; +import { codicon, ContextMenuRenderer } from '@theia/core/lib/browser'; +import { ClipboardService } from '@theia/core/lib/browser/clipboard-service'; +import { inject, injectable } from '@theia/core/shared/inversify'; +import * as React from '@theia/core/shared/react'; +import { ReactNode } from '@theia/core/shared/react'; +import { ShellExecutionTool } from './shell-execution-tool'; +import { + SHELL_EXECUTION_FUNCTION_ID, + ShellExecutionToolResult, + ShellExecutionCanceledResult +} from '../common/shell-execution-server'; +import { parseShellExecutionInput, ShellExecutionInput } from '../common/shell-execution-input-parser'; + +@injectable() +export class ShellExecutionToolRenderer implements ChatResponsePartRenderer { + + @inject(ToolConfirmationManager) + protected toolConfirmationManager: ToolConfirmationManager; + + @inject(ToolInvocationRegistry) + protected toolInvocationRegistry: ToolInvocationRegistry; + + @inject(ShellExecutionTool) + protected shellExecutionTool: ShellExecutionTool; + + @inject(ClipboardService) + protected clipboardService: ClipboardService; + + @inject(ContextMenuRenderer) + protected contextMenuRenderer: ContextMenuRenderer; + + canHandle(response: ChatResponseContent): number { + if (ToolCallChatResponseContent.is(response) && response.name === SHELL_EXECUTION_FUNCTION_ID) { + return 20; + } + return -1; + } + + render(response: ToolCallChatResponseContent, parentNode: ResponseNode): ReactNode { + const chatId = parentNode.sessionId; + const toolRequest = this.toolInvocationRegistry.getFunction(SHELL_EXECUTION_FUNCTION_ID); + const confirmationMode = this.toolConfirmationManager.getConfirmationMode( + SHELL_EXECUTION_FUNCTION_ID, chatId, toolRequest + ); + + const input = parseShellExecutionInput(response.arguments); + + return ( + + ); + } +} + +interface ShellExecutionToolComponentProps { + response: ToolCallChatResponseContent; + input: ShellExecutionInput; + confirmationMode: ToolConfirmationPreferenceMode; + toolConfirmationManager: ToolConfirmationManager; + shellExecutionTool: ShellExecutionTool; + clipboardService: ClipboardService; + toolRequest?: ToolRequest; + chatId: string; + requestCanceled: boolean; + contextMenuRenderer: ContextMenuRenderer; +} + +type ConfirmationState = 'waiting' | 'allowed' | 'denied' | 'rejected'; + +const ShellExecutionToolComponent: React.FC = ({ + response, + input, + confirmationMode, + toolConfirmationManager, + shellExecutionTool, + clipboardService, + toolRequest, + chatId, + requestCanceled, + contextMenuRenderer +}) => { + const getInitialState = (): ConfirmationState => { + if (confirmationMode === ToolConfirmationPreferenceMode.ALWAYS_ALLOW) { + return 'allowed'; + } + if (confirmationMode === ToolConfirmationPreferenceMode.DISABLED) { + return 'denied'; + } + if (response.finished) { + return ToolCallChatResponseContent.isDenialResult(response.result) ? 'denied' : 'allowed'; + } + return 'waiting'; + }; + + const [confirmationState, setConfirmationState] = React.useState(getInitialState); + const [toolFinished, setToolFinished] = React.useState(response.finished); + const [isCanceling, setIsCanceling] = React.useState(false); + + React.useEffect(() => { + if (confirmationMode === ToolConfirmationPreferenceMode.ALWAYS_ALLOW) { + response.confirm(); + } else if (confirmationMode === ToolConfirmationPreferenceMode.DISABLED) { + response.deny(); + } else { + response.confirmed + .then(confirmed => { + setConfirmationState(confirmed ? 'allowed' : 'denied'); + }) + .catch(err => { + console.debug('Shell execution tool confirmation rejected:', err); + setConfirmationState('rejected'); + }); + } + }, [response, confirmationMode]); + + React.useEffect(() => { + if (toolFinished || response.finished) { + setToolFinished(true); + return; + } + + let cancelled = false; + response.whenFinished.then(() => { + if (!cancelled) { + setToolFinished(true); + } + }); + + return () => { cancelled = true; }; + }, [toolFinished, response]); + + const handleCancel = React.useCallback(async () => { + if (isCanceling || !response.id) { + return; + } + setIsCanceling(true); + try { + await shellExecutionTool.cancelExecution(response.id); + } catch (err) { + console.debug('Failed to cancel shell execution:', err); + } + // Don't reset isCanceling - stay in canceling state until tool finishes + }, [response.id, shellExecutionTool, isCanceling]); + + const handleAllow = React.useCallback((scope: ConfirmationScope) => { + if (scope === 'forever') { + toolConfirmationManager.setConfirmationMode(SHELL_EXECUTION_FUNCTION_ID, ToolConfirmationPreferenceMode.ALWAYS_ALLOW, toolRequest); + } else if (scope === 'session') { + toolConfirmationManager.setSessionConfirmationMode(SHELL_EXECUTION_FUNCTION_ID, ToolConfirmationPreferenceMode.ALWAYS_ALLOW, chatId); + } + response.confirm(); + }, [response, toolConfirmationManager, chatId, toolRequest]); + + const handleDeny = React.useCallback((scope: ConfirmationScope, reason?: string) => { + if (scope === 'forever') { + toolConfirmationManager.setConfirmationMode(SHELL_EXECUTION_FUNCTION_ID, ToolConfirmationPreferenceMode.DISABLED); + } else if (scope === 'session') { + toolConfirmationManager.setSessionConfirmationMode(SHELL_EXECUTION_FUNCTION_ID, ToolConfirmationPreferenceMode.DISABLED, chatId); + } + response.deny(reason); + }, [response, toolConfirmationManager, chatId]); + + let result: ShellExecutionToolResult | undefined; + let canceledResult: ShellExecutionCanceledResult | undefined; + if (toolFinished && response.result) { + try { + const parsed = typeof response.result === 'string' + ? JSON.parse(response.result) + : response.result; + if (ShellExecutionCanceledResult.is(parsed)) { + canceledResult = parsed; + } else if (ShellExecutionToolResult.is(parsed)) { + result = parsed; + } + } catch (err) { + console.debug('Failed to parse shell execution result:', err); + } + } + + if (!input.command && !toolFinished) { + return ( +
    +
    + + +
    +
    + ); + } + + if (confirmationState === 'waiting' && !requestCanceled && !toolFinished) { + return ( + + ); + } + + if (confirmationState === 'denied' || confirmationState === 'rejected') { + const denialResult = ToolCallChatResponseContent.isDenialResult(response.result) ? response.result : undefined; + return ( + + ); + } + + // Show canceling state when user clicked cancel on this command and it's still stopping + if (!toolFinished && isCanceling && !requestCanceled) { + return ( + + ); + } + + if (!toolFinished && confirmationState === 'allowed' && !requestCanceled) { + return ( + + ); + } + + // Show canceled UI when tool was running and got canceled (has a canceled result with partial output) + if (canceledResult) { + return ( + + ); + } + + return ( + + ); +}; + +interface ConfirmationUIProps { + input: ShellExecutionInput; + toolRequest?: ToolRequest; + onAllow: (scope: ConfirmationScope) => void; + onDeny: (scope: ConfirmationScope, reason?: string) => void; + contextMenuRenderer: ContextMenuRenderer; +} + +const ConfirmationUI: React.FC = ({ + input, + toolRequest, + onAllow, + onDeny, + contextMenuRenderer +}) => ( +
    +
    +
    + + + {nls.localize('theia/ai-terminal/confirmExecution', 'Confirm Shell Command')} + +
    + +
    + {input.command} +
    + +
    + {input.cwd && ( + + + {input.cwd} + + )} + {input.timeout && ( + + + {formatDuration(input.timeout)} + + )} +
    + + +
    +
    +); + +interface RunningUIProps { + input: ShellExecutionInput; + onCancel: () => void; +} + +const RunningUI: React.FC = ({ + input, + onCancel +}) => ( +
    +
    + + {truncateCommand(input.command)} + + + + +
    +
    +); + +interface CancelingUIProps { + input: ShellExecutionInput; +} + +const CancelingUI: React.FC = ({ input }) => ( +
    +
    + + {truncateCommand(input.command)} + + + + {nls.localize('theia/ai-terminal/canceling', 'Canceling...')} + + +
    +
    +); + +interface DeniedUIProps { + input: ShellExecutionInput; + confirmationState: 'denied' | 'rejected'; + denialReason?: string; + clipboardService: ClipboardService; +} + +const DeniedUI: React.FC = ({ + input, + confirmationState, + denialReason, + clipboardService +}) => { + const [isExpanded, setIsExpanded] = React.useState(false); + + const getStatusLabel = (): string => { + if (confirmationState === 'rejected') { + return nls.localize('theia/ai-terminal/executionCanceled', 'Canceled'); + } + return denialReason + ? nls.localize('theia/ai-terminal/executionDeniedWithReason', 'Denied with reason') + : nls.localize('theia/ai-terminal/executionDenied', 'Denied'); + }; + + return ( +
    +
    setIsExpanded(!isExpanded)} + > + + {truncateCommand(input.command)} + + + {getStatusLabel()} + + +
    + {isExpanded && ( +
    + + {input.cwd && ( + + {input.cwd} + + )} + {denialReason && ( +
    +
    + + {nls.localize('theia/ai-terminal/denialReason', 'Reason')} +
    +
    + {denialReason} +
    +
    + )} +
    + )} +
    + ); +}; + +interface CanceledUIProps { + input: ShellExecutionInput; + canceledResult?: ShellExecutionCanceledResult; + clipboardService: ClipboardService; +} + +const CanceledUI: React.FC = ({ + input, + canceledResult, + clipboardService +}) => { + const [isExpanded, setIsExpanded] = React.useState(false); + + return ( +
    +
    setIsExpanded(!isExpanded)} + > + + {truncateCommand(input.command)} + + {canceledResult?.duration !== undefined && ( + {formatDuration(canceledResult.duration)} + )} + + {nls.localize('theia/ai-terminal/executionCanceled', 'Canceled')} + + +
    + {isExpanded && ( +
    + + {input.cwd && ( + + {input.cwd} + + )} + {canceledResult?.output && ( + + )} +
    + )} +
    + ); +}; + +interface FinishedUIProps { + input: ShellExecutionInput; + result?: ShellExecutionToolResult; + clipboardService: ClipboardService; +} + +const FinishedUI: React.FC = ({ + input, + result, + clipboardService +}) => { + const [isExpanded, setIsExpanded] = React.useState(false); + const isSuccess = result?.success ?? false; + + return ( +
    +
    setIsExpanded(!isExpanded)} + > + + {truncateCommand(input.command)} + + {result?.duration !== undefined && ( + {formatDuration(result.duration)} + )} + {result?.exitCode !== undefined && result.exitCode !== 0 && ( + {result.exitCode} + )} + + +
    + {isExpanded && ( +
    + + {(result?.cwd || input.cwd) && ( + + {result?.cwd || input.cwd} + + )} + {result?.error && ( +
    + {result.error} +
    + )} + +
    + )} +
    + ); +}; + +interface CommandDisplayProps { + command: string; + clipboardService: ClipboardService; +} + +const CommandDisplay: React.FC = ({ command, clipboardService }) => ( +
    +
    + $ + {command} +
    + +
    +); + +interface MetaRowProps { + icon: string; + label: string; + children: React.ReactNode; +} + +const MetaRow: React.FC = ({ icon, label, children }) => ( +
    + + {children} +
    +); + +interface OutputBoxProps { + title: string; + output?: string; + clipboardService: ClipboardService; +} + +const OutputBox: React.FC = ({ title, output, clipboardService }) => ( +
    +
    + + {title} + {output && } +
    + {output ? ( +
    {output}
    + ) : ( +
    + {nls.localize('theia/ai-terminal/noOutput', 'No output')} +
    + )} +
    +); + +interface CopyButtonProps { + text: string; + clipboardService: ClipboardService; +} + +const CopyButton: React.FC = ({ text, clipboardService }) => { + const handleCopy = React.useCallback(() => { + clipboardService.writeText(text); + }, [text, clipboardService]); + + return ( + + ); +}; + +function truncateCommand(command: string): string { + // Only take first line, CSS handles the ellipsis truncation + return command.split('\n')[0]; +} + +function formatDuration(ms: number): string { + if (ms < 1000) { + return `${ms}ms`; + } + if (ms < 60000) { + return `${(ms / 1000).toFixed(1)}s`; + } + const minutes = Math.floor(ms / 60000); + const seconds = Math.floor((ms % 60000) / 1000); + return seconds > 0 ? `${minutes}m ${seconds}s` : `${minutes}m`; +} diff --git a/packages/ai-terminal/src/browser/shell-execution-tool.ts b/packages/ai-terminal/src/browser/shell-execution-tool.ts new file mode 100644 index 0000000..5b4d1e6 --- /dev/null +++ b/packages/ai-terminal/src/browser/shell-execution-tool.ts @@ -0,0 +1,204 @@ +// ***************************************************************************** +// Copyright (C) 2026 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { injectable, inject } from '@theia/core/shared/inversify'; +import { ToolProvider, ToolRequest } from '@theia/ai-core'; +import { WorkspaceService } from '@theia/workspace/lib/browser'; +import { + SHELL_EXECUTION_FUNCTION_ID, + ShellExecutionServer, + ShellExecutionToolResult, + ShellExecutionCanceledResult, + combineAndTruncate +} from '../common/shell-execution-server'; +import { CancellationToken, generateUuid } from '@theia/core'; + +@injectable() +export class ShellExecutionTool implements ToolProvider { + + @inject(ShellExecutionServer) + protected readonly shellServer: ShellExecutionServer; + + @inject(WorkspaceService) + protected readonly workspaceService: WorkspaceService; + + protected readonly runningExecutions = new Map(); + + async cancelExecution(toolCallId: string): Promise { + const executionId = this.runningExecutions.get(toolCallId); + if (executionId) { + const canceled = await this.shellServer.cancel(executionId); + if (canceled) { + this.runningExecutions.delete(toolCallId); + } + return canceled; + } + return false; + } + + isExecutionRunning(toolCallId: string): boolean { + return this.runningExecutions.has(toolCallId); + } + + getTool(): ToolRequest { + return { + id: SHELL_EXECUTION_FUNCTION_ID, + name: SHELL_EXECUTION_FUNCTION_ID, + providerName: 'ai-terminal', + confirmAlwaysAllow: 'This tool has full system access and can execute any command, ' + + 'modify files outside the workspace, and access network resources.', + description: `Execute a shell command on the host system and return the output. + +This tool runs commands in a shell environment (bash on Linux/macOS, cmd/PowerShell on Windows). +Use it for: +- Running build commands (npm, make, gradle, cargo, etc.) +- Executing git commands +- Running tests and linters +- Efficient search with grep, ripgrep, or find +- Bulk search-and-replace operations with sed, awk, or perl +- Reading or modifying files outside the workspace +- Installing dependencies or packages +- System administration and diagnostics +- Running scripts (bash, python, node, etc.) + +USER INTERACTION: +- Commands require user approval before execution - the user sees the exact command and can approve or deny +- Once approved, the user may cancel execution at any time while it's running +- Users can configure "Always Allow" to skip confirmations for this tool + +It should not be used for "endless" or long-running processes (e.g., servers, watchers) as the execution +will block further tool usage and chat messages until it completes or times out. + +OUTPUT TRUNCATION: To keep responses manageable, output is truncated at multiple levels: +- Stream limit: stdout and stderr each capped at 1MB +- Line count: Only first 50 and last 50 lines kept (middle lines omitted) +- Line length: Lines over 1000 chars show start/end with middle omitted +To avoid losing important information, limit output size in your commands: +- Use grep/findstr to filter output (e.g., "npm test 2>&1 | grep -E '(FAIL|PASS|Error)'") +- Use head/tail to limit lines (e.g., "git log --oneline -20") +- Use wc -l to count lines before fetching full output +- Redirect verbose output to /dev/null if not needed + +TIMEOUT: Default 2 minutes, max 10 minutes. Specify higher timeout for longer commands.`, + parameters: { + type: 'object', + properties: { + command: { + type: 'string', + description: 'The shell command to execute. Can include pipes, redirects, and shell features.' + }, + cwd: { + type: 'string', + description: 'Working directory for command execution. Can be absolute or relative to workspace root. Defaults to the workspace root.' + }, + timeout: { + type: 'number', + description: 'Timeout in milliseconds. Default: 120000 (2 minutes). Max: 600000 (10 minutes).' + } + }, + required: ['command'] + }, + handler: (argString: string, ctx?: unknown) => this.executeCommand(argString, ctx) + }; + } + + protected async executeCommand(argString: string, ctx?: unknown): Promise { + const args: { + command: string; + cwd?: string; + timeout?: number; + } = JSON.parse(argString); + + // Get workspace root to pass to backend for path resolution + const rootUri = this.workspaceService.getWorkspaceRootUri(undefined); + const workspaceRoot = rootUri?.path.fsPath(); + + // Generate execution ID and get tool call ID from context + const executionId = generateUuid(); + const toolCallId = this.extractToolCallId(ctx); + const cancellationToken = this.extractCancellationToken(ctx); + + // Track this execution + if (toolCallId) { + this.runningExecutions.set(toolCallId, executionId); + } + + const cancellationListener = cancellationToken?.onCancellationRequested(() => { + this.shellServer.cancel(executionId); + }); + + try { + // Call the backend service (path resolution happens on the backend) + const result = await this.shellServer.execute({ + command: args.command, + cwd: args.cwd, + workspaceRoot, + timeout: args.timeout, + executionId, + }); + + if (result.canceled) { + return { + canceled: true, + output: this.combineAndTruncate(result.stdout, result.stderr) || undefined, + duration: result.duration, + }; + } + + // Combine stdout and stderr, apply truncation + const combinedOutput = this.combineAndTruncate(result.stdout, result.stderr); + + return { + success: result.success, + exitCode: result.exitCode, + output: combinedOutput, + error: result.error, + duration: result.duration, + cwd: result.resolvedCwd, + }; + } finally { + // Clean up + cancellationListener?.dispose(); + if (toolCallId) { + this.runningExecutions.delete(toolCallId); + } + } + } + + protected extractToolCallId(ctx: unknown): string | undefined { + if (ctx && typeof ctx === 'object' && 'toolCallId' in ctx) { + return (ctx as { toolCallId?: string }).toolCallId; + } + return undefined; + } + + protected extractCancellationToken(ctx: unknown): CancellationToken | undefined { + if (ctx && typeof ctx === 'object') { + // Check for MutableChatRequestModel structure (response.cancellationToken) + if ('response' in ctx) { + const response = (ctx as { response?: { cancellationToken?: CancellationToken } }).response; + if (response?.cancellationToken) { + return response.cancellationToken; + } + } + } + return undefined; + } + + protected combineAndTruncate(stdout: string, stderr: string): string { + return combineAndTruncate(stdout, stderr); + } +} diff --git a/packages/ai-terminal/src/browser/style/ai-terminal.css b/packages/ai-terminal/src/browser/style/ai-terminal.css new file mode 100644 index 0000000..1a732cf --- /dev/null +++ b/packages/ai-terminal/src/browser/style/ai-terminal.css @@ -0,0 +1,102 @@ +.ai-terminal-chat-container { + position: absolute; + bottom: 0; + left: 50%; + transform: translateX(-50%); + width: 100%; + max-width: 500px; + padding: 10px; + box-sizing: border-box; + background: var(--theia-menu-background); + color: var(--theia-menu-foreground); + margin-bottom: 12px; + display: flex; + flex-direction: column; + align-items: center; + border: var(--theia-border-width) solid var(--theia-dropdown-border); + border-radius: 4px; + z-index: 15; +} + +.ai-terminal-chat-container .closeButton { + position: absolute; + top: 1em; + right: 1em; + cursor: pointer; +} + +.ai-terminal-chat-container .closeButton:hover { + color: var(--theia-menu-foreground); +} + +.ai-terminal-chat-result { + width: 100%; + margin-bottom: 10px; +} + +.ai-terminal-chat-input-container { + width: 100%; + display: flex; + align-items: center; +} + +#theia-bottom-content-panel .theia-ChatInput { + border: var(--theia-border-width) solid var(--theia-dropdown-border); +} + +.ai-terminal-chat-input-container .theia-ChatInput { + flex-grow: 1; + height: 36px; + background-color: var(--theia-input-background); + border: var(--theia-border-width) solid var(--theia-dropdown-border); + border-radius: 4px; + box-sizing: border-box; + padding: 8px; + resize: none; + overflow: hidden; + line-height: 1.3rem; + margin-top: 0; + margin-right: 10px; /* Add some space between textarea and button */ +} + +.ai-terminal-chat-input-container .option { + width: 21px; + height: 21px; + display: inline-block; + box-sizing: border-box; + user-select: none; + background-repeat: no-repeat; + background-position: center; + border: var(--theia-border-width) solid transparent; + opacity: 0.7; + cursor: pointer; +} + +.ai-terminal-chat-input-container .option:hover { + opacity: 1; +} + +@keyframes dots { + 0%, + 20% { + content: ""; + } + 40% { + content: "."; + } + 60% { + content: ".."; + } + 80%, + 100% { + content: "..."; + } +} +.ai-terminal-chat-result p.loading::after { + content: ""; + animation: dots 1s steps(1, end) infinite; +} + +.ai-terminal-chat-result p.command { + font-family: "Droid Sans Mono", "monospace", monospace; +} diff --git a/packages/ai-terminal/src/browser/style/shell-execution-tool.css b/packages/ai-terminal/src/browser/style/shell-execution-tool.css new file mode 100644 index 0000000..945fffa --- /dev/null +++ b/packages/ai-terminal/src/browser/style/shell-execution-tool.css @@ -0,0 +1,395 @@ +.shell-execution-tool.container { + border: var(--theia-border-width) solid var(--theia-sideBarSectionHeader-border); + border-radius: var(--theia-ui-padding); + margin: var(--theia-ui-padding) 0; + background-color: var(--theia-editorWidget-background); + overflow: visible; +} + +.shell-execution-tool.header { + display: flex; + align-items: center; + gap: var(--theia-ui-padding); + padding: var(--theia-ui-padding) calc(var(--theia-ui-padding) * 2); + border-radius: var(--theia-ui-padding); +} + +.shell-execution-tool.container.expanded .shell-execution-tool.header { + border-radius: var(--theia-ui-padding) var(--theia-ui-padding) 0 0; +} + +.shell-execution-tool.header.finished { + cursor: pointer; +} + +.shell-execution-tool.header.finished:hover { + background-color: var(--theia-list-hoverBackground); +} + +.shell-execution-tool.header.error { + background-color: var(--theia-inputValidation-errorBackground); + cursor: pointer; +} + +.shell-execution-tool.header.error:hover { + background-color: var(--theia-inputValidation-errorBackground); + filter: brightness(1.1); +} + +.shell-execution-tool.header .codicon.codicon-terminal { + flex-shrink: 0; + color: var(--theia-descriptionForeground); + font-size: var(--theia-ui-font-size2); +} + +.shell-execution-tool.command-preview { + font-family: var(--theia-ui-font-family-mono); + font-size: var(--theia-ui-font-size1); + color: var(--theia-foreground); + background-color: var(--theia-textCodeBlock-background); + padding: 2px 6px; + border-radius: calc(var(--theia-ui-padding) / 2); + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + flex: 0 1 auto; + min-width: 0; +} + +.shell-execution-tool.meta-badges { + display: flex; + align-items: center; + gap: var(--theia-ui-padding); + flex-shrink: 0; + margin-left: auto; +} + +.shell-execution-tool.duration { + font-size: var(--theia-ui-font-size0); + color: var(--theia-descriptionForeground); + font-family: var(--theia-ui-font-family-mono); +} + +.shell-execution-tool.exit-code { + font-size: var(--theia-ui-font-size0); + font-weight: 500; + padding: 1px 6px; + border-radius: calc(var(--theia-ui-padding) / 2); + font-family: var(--theia-ui-font-family-mono); + background-color: var(--theia-charts-red); + color: var(--theia-button-foreground); +} + +.shell-execution-tool.status-icon { + flex-shrink: 0; +} + +.shell-execution-tool.status-icon.success { + color: var(--theia-charts-green); +} + +.shell-execution-tool.status-icon.failure { + color: var(--theia-charts-red); +} + +.shell-execution-tool.status-label { + font-size: var(--theia-ui-font-size0); + font-weight: 500; +} + +.shell-execution-tool.status-label.error { + color: var(--theia-errorForeground); +} + +.shell-execution-tool.status-label.canceled { + color: var(--theia-errorForeground); +} + +.shell-execution-tool.status-label.canceling { + display: flex; + align-items: center; + gap: calc(var(--theia-ui-padding) / 2); + color: var(--theia-descriptionForeground); +} + +.shell-execution-tool.cancel-button { + display: flex; + align-items: center; + justify-content: center; + width: 22px; + height: 22px; + padding: 0; + border: none; + border-radius: calc(var(--theia-ui-padding) / 2); + background-color: transparent; + color: var(--theia-descriptionForeground); + cursor: pointer; + transition: background-color 0.15s, color 0.15s; +} + +.shell-execution-tool.cancel-button:hover { + background-color: var(--theia-toolbar-hoverBackground); + color: var(--theia-debugIcon-stopForeground); +} + +.shell-execution-tool.cancel-button:active { + background-color: var(--theia-toolbar-activeBackground, var(--theia-toolbar-hoverBackground)); +} + +.shell-execution-tool.canceling-label { + display: flex; + align-items: center; + gap: calc(var(--theia-ui-padding) / 2); + font-size: var(--theia-ui-font-size0); + color: var(--theia-descriptionForeground); +} + +.shell-execution-tool.canceling-label .codicon { + font-size: var(--theia-ui-font-size1); +} + +.shell-execution-tool.header.canceling { + background-color: var(--theia-inputValidation-warningBackground); +} + +.shell-execution-tool.header.canceled { + background-color: var(--theia-inputValidation-errorBackground); + cursor: pointer; +} + +.shell-execution-tool.header.canceled:hover { + background-color: var(--theia-inputValidation-errorBackground); + filter: brightness(1.1); +} + +.shell-execution-tool.confirmation { + padding: calc(var(--theia-ui-padding) * 2); +} + +.shell-execution-tool.confirmation-header { + display: flex; + align-items: center; + gap: var(--theia-ui-padding); + margin-bottom: calc(var(--theia-ui-padding) * 1.5); +} + +.shell-execution-tool.confirmation-header .codicon { + font-size: var(--theia-ui-font-size2); + color: var(--theia-charts-blue); +} + +.shell-execution-tool.confirmation-title { + font-weight: 600; + font-size: var(--theia-ui-font-size1); + color: var(--theia-foreground); +} + +.shell-execution-tool.command-display { + padding: var(--theia-ui-padding) calc(var(--theia-ui-padding) * 1.5); + background-color: var(--theia-textCodeBlock-background); + border-radius: calc(var(--theia-ui-padding) / 2); + margin-bottom: calc(var(--theia-ui-padding) * 1.5); +} + +.shell-execution-tool.command-display code { + font-family: var(--theia-ui-font-family-mono); + font-size: var(--theia-ui-font-size1); + color: var(--theia-foreground); + white-space: pre-wrap; + word-break: break-all; +} + +.shell-execution-tool.confirmation-meta { + display: flex; + flex-wrap: wrap; + gap: calc(var(--theia-ui-padding) * 2); + margin-bottom: calc(var(--theia-ui-padding) * 2); + font-size: var(--theia-ui-font-size0); + color: var(--theia-descriptionForeground); +} + +.shell-execution-tool.meta-item { + display: flex; + align-items: center; + gap: calc(var(--theia-ui-padding) / 2); +} + +.shell-execution-tool.meta-item .codicon { + font-size: var(--theia-ui-font-size1); + opacity: 0.7; +} + +.shell-execution-tool.expanded-content { + padding: calc(var(--theia-ui-padding) * 2); + border-top: var(--theia-border-width) solid var(--theia-sideBarSectionHeader-border); +} + +.shell-execution-tool.full-command-container { + position: relative; + margin-bottom: var(--theia-ui-padding); +} + +.shell-execution-tool.full-command-container .shell-execution-tool.copy-button { + position: absolute; + top: var(--theia-ui-padding); + right: var(--theia-ui-padding); + opacity: 0; + transition: opacity 0.15s; +} + +.shell-execution-tool.full-command-container:hover .shell-execution-tool.copy-button { + opacity: 1; +} + +.shell-execution-tool.full-command-container .shell-execution-tool.full-command { + margin-bottom: 0; + padding-right: 32px; +} + +.shell-execution-tool.full-command { + display: flex; + gap: var(--theia-ui-padding); + padding: var(--theia-ui-padding) calc(var(--theia-ui-padding) * 1.5); + background-color: var(--theia-textCodeBlock-background); + border-radius: calc(var(--theia-ui-padding) / 2); + margin-bottom: var(--theia-ui-padding); +} + +.shell-execution-tool.prompt { + font-family: var(--theia-ui-font-family-mono); + font-size: var(--theia-ui-font-size1); + color: var(--theia-descriptionForeground); + flex-shrink: 0; + user-select: none; +} + +.shell-execution-tool.full-command code { + font-family: var(--theia-ui-font-family-mono); + font-size: var(--theia-ui-font-size1); + color: var(--theia-foreground); + white-space: pre-wrap; + word-break: break-all; +} + +.shell-execution-tool.meta-row { + display: flex; + align-items: center; + gap: var(--theia-ui-padding); + font-size: var(--theia-ui-font-size0); + color: var(--theia-descriptionForeground); + margin-bottom: var(--theia-ui-padding); +} + +.shell-execution-tool.meta-row .codicon { + opacity: 0.7; +} + +.shell-execution-tool.error-message { + padding: var(--theia-ui-padding) calc(var(--theia-ui-padding) * 1.5); + margin-bottom: var(--theia-ui-padding); + background-color: var(--theia-inputValidation-errorBackground); + border: var(--theia-border-width) solid var(--theia-inputValidation-errorBorder); + border-radius: calc(var(--theia-ui-padding) / 2); + color: var(--theia-errorForeground); + font-size: var(--theia-ui-font-size1); +} + +.shell-execution-tool.output-box { + margin-top: var(--theia-ui-padding); + background-color: var(--theia-textCodeBlock-background); + border-radius: calc(var(--theia-ui-padding) / 2); +} + +.shell-execution-tool.output-header { + display: flex; + align-items: center; + gap: var(--theia-ui-padding); + font-size: var(--theia-ui-font-size0); + color: var(--theia-descriptionForeground); + padding: var(--theia-ui-padding) calc(var(--theia-ui-padding) * 1.5); + border-bottom: var(--theia-border-width) solid var(--theia-sideBarSectionHeader-border); +} + +.shell-execution-tool.output-header .codicon { + font-size: var(--theia-ui-font-size1); +} + +.shell-execution-tool.output-header .shell-execution-tool.copy-button { + margin-left: auto; + opacity: 0; + transition: opacity 0.15s; +} + +.shell-execution-tool.output-box:hover .shell-execution-tool.output-header .shell-execution-tool.copy-button { + opacity: 1; +} + +.shell-execution-tool.copy-button { + display: flex; + align-items: center; + justify-content: center; + width: 22px; + height: 22px; + padding: 0; + border: none; + border-radius: calc(var(--theia-ui-padding) / 2); + background-color: transparent; + color: var(--theia-descriptionForeground); + cursor: pointer; + transition: background-color 0.15s, color 0.15s; +} + +.shell-execution-tool.copy-button:hover { + background-color: var(--theia-toolbar-hoverBackground); + color: var(--theia-foreground); +} + +.shell-execution-tool.output { + font-family: var(--theia-ui-font-family-mono); + font-size: var(--theia-ui-font-size0); + line-height: 1.4; + color: var(--theia-foreground); + background-color: transparent; + border-radius: 0; + padding: calc(var(--theia-ui-padding) * 1.5); + margin: 0; + max-height: 300px; + overflow: auto; + white-space: pre-wrap; + word-break: break-word; +} + +.shell-execution-tool.no-output { + color: var(--theia-descriptionForeground); + font-style: italic; + font-size: var(--theia-ui-font-size0); + padding: var(--theia-ui-padding) calc(var(--theia-ui-padding) * 1.5); +} + +.shell-execution-tool.denial-reason { + margin-top: var(--theia-ui-padding); + background-color: var(--theia-textCodeBlock-background); + border-radius: calc(var(--theia-ui-padding) / 2); +} + +.shell-execution-tool.denial-reason-header { + display: flex; + align-items: center; + gap: var(--theia-ui-padding); + font-size: var(--theia-ui-font-size0); + color: var(--theia-descriptionForeground); + padding: var(--theia-ui-padding) calc(var(--theia-ui-padding) * 1.5); + border-bottom: var(--theia-border-width) solid var(--theia-sideBarSectionHeader-border); +} + +.shell-execution-tool.denial-reason-header .codicon { + font-size: var(--theia-ui-font-size1); +} + +.shell-execution-tool.denial-reason-content { + padding: calc(var(--theia-ui-padding) * 1.5); + font-size: var(--theia-ui-font-size1); + color: var(--theia-foreground); + white-space: pre-wrap; + word-break: break-word; +} diff --git a/packages/ai-terminal/src/common/shell-execution-input-parser.spec.ts b/packages/ai-terminal/src/common/shell-execution-input-parser.spec.ts new file mode 100644 index 0000000..1ad95a7 --- /dev/null +++ b/packages/ai-terminal/src/common/shell-execution-input-parser.spec.ts @@ -0,0 +1,119 @@ +// ***************************************************************************** +// Copyright (C) 2026 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { expect } from 'chai'; +import { parseShellExecutionInput } from './shell-execution-input-parser'; + +describe('parseShellExecutionInput', () => { + describe('complete JSON', () => { + it('should parse complete JSON with command only', () => { + const result = parseShellExecutionInput('{"command": "ls -la"}'); + expect(result.command).to.equal('ls -la'); + }); + + it('should parse complete JSON with all fields', () => { + const result = parseShellExecutionInput('{"command": "npm install", "cwd": "/home/user", "timeout": 30000}'); + expect(result.command).to.equal('npm install'); + expect(result.cwd).to.equal('/home/user'); + expect(result.timeout).to.equal(30000); + }); + + it('should parse JSON without spaces', () => { + const result = parseShellExecutionInput('{"command":"git status"}'); + expect(result.command).to.equal('git status'); + }); + }); + + describe('incomplete JSON (streaming)', () => { + it('should extract command from incomplete JSON without closing brace', () => { + const result = parseShellExecutionInput('{"command": "ls -la"'); + expect(result.command).to.equal('ls -la'); + }); + + it('should extract partial command value without closing quote', () => { + const result = parseShellExecutionInput('{"command": "ls -la'); + expect(result.command).to.equal('ls -la'); + }); + + it('should extract command when value is being typed', () => { + const result = parseShellExecutionInput('{"command": "git st'); + expect(result.command).to.equal('git st'); + }); + + it('should return empty command when only key is present', () => { + const result = parseShellExecutionInput('{"command": "'); + expect(result.command).to.equal(''); + }); + + it('should handle JSON without spaces around colon', () => { + const result = parseShellExecutionInput('{"command":"npm run'); + expect(result.command).to.equal('npm run'); + }); + + it('should handle incomplete JSON with additional fields after command', () => { + const result = parseShellExecutionInput('{"command": "echo hello", "cwd": "/tmp'); + expect(result.command).to.equal('echo hello'); + }); + }); + + describe('edge cases', () => { + it('should return empty command for undefined input', () => { + const result = parseShellExecutionInput(undefined); + expect(result.command).to.equal(''); + }); + + it('should return empty command for empty string', () => { + const result = parseShellExecutionInput(''); + expect(result.command).to.equal(''); + }); + + it('should return empty command for incomplete JSON without command key', () => { + const result = parseShellExecutionInput('{"cwd": "/home"'); + expect(result.command).to.equal(''); + }); + + it('should return empty command for malformed JSON', () => { + const result = parseShellExecutionInput('{command: ls}'); + expect(result.command).to.equal(''); + }); + + it('should return empty command when just opening brace', () => { + const result = parseShellExecutionInput('{'); + expect(result.command).to.equal(''); + }); + + it('should return empty command for partial key', () => { + const result = parseShellExecutionInput('{"com'); + expect(result.command).to.equal(''); + }); + + it('should handle command with escaped quotes in complete JSON', () => { + const result = parseShellExecutionInput('{"command": "echo \\"hello\\""}'); + expect(result.command).to.equal('echo "hello"'); + }); + + it('should handle incomplete command with backslash', () => { + // During streaming, we get partial content - the regex stops at first unescaped quote + const result = parseShellExecutionInput('{"command": "echo \\"hello'); + expect(result.command).to.equal('echo \\'); + }); + + it('should handle command with pipes and redirects', () => { + const result = parseShellExecutionInput('{"command": "cat file.txt | grep error > output.log"}'); + expect(result.command).to.equal('cat file.txt | grep error > output.log'); + }); + }); +}); diff --git a/packages/ai-terminal/src/common/shell-execution-input-parser.ts b/packages/ai-terminal/src/common/shell-execution-input-parser.ts new file mode 100644 index 0000000..2242629 --- /dev/null +++ b/packages/ai-terminal/src/common/shell-execution-input-parser.ts @@ -0,0 +1,39 @@ +// ***************************************************************************** +// Copyright (C) 2026 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +export interface ShellExecutionInput { + command: string; + cwd?: string; + timeout?: number; +} + +/** + * Parses shell execution input from potentially incomplete JSON. + * During streaming, extracts partial command value via regex when JSON.parse fails. + */ +export function parseShellExecutionInput(args: string | undefined): ShellExecutionInput { + if (!args) { + return { command: '' }; + } + + try { + return JSON.parse(args); + } catch { + // Extract command from incomplete JSON: "command": "value or "command":"value + const match = /"command"\s*:\s*"([^"]*)"?/.exec(args); + return { command: match?.[1] ?? '' }; + } +} diff --git a/packages/ai-terminal/src/common/shell-execution-server.spec.ts b/packages/ai-terminal/src/common/shell-execution-server.spec.ts new file mode 100644 index 0000000..4200029 --- /dev/null +++ b/packages/ai-terminal/src/common/shell-execution-server.spec.ts @@ -0,0 +1,50 @@ +// ***************************************************************************** +// Copyright (C) 2026 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { expect } from 'chai'; +import { + ShellExecutionToolResult, + ShellExecutionCanceledResult +} from './shell-execution-server'; + +describe('ShellExecutionToolResult.is', () => { + it('should return true for valid result', () => { + expect(ShellExecutionToolResult.is({ success: true, exitCode: 0, output: '', duration: 100 })).to.be.true; + }); + + it('should return false for invalid inputs', () => { + expect(ShellExecutionToolResult.is(undefined)).to.be.false; + // eslint-disable-next-line no-null/no-null + expect(ShellExecutionToolResult.is(null)).to.be.false; + expect(ShellExecutionToolResult.is({ exitCode: 0 })).to.be.false; + expect(ShellExecutionToolResult.is({ success: true })).to.be.false; + }); +}); + +describe('ShellExecutionCanceledResult.is', () => { + it('should return true for valid canceled result', () => { + expect(ShellExecutionCanceledResult.is({ canceled: true })).to.be.true; + expect(ShellExecutionCanceledResult.is({ canceled: true, output: 'partial', duration: 100 })).to.be.true; + }); + + it('should return false for invalid inputs', () => { + expect(ShellExecutionCanceledResult.is(undefined)).to.be.false; + // eslint-disable-next-line no-null/no-null + expect(ShellExecutionCanceledResult.is(null)).to.be.false; + expect(ShellExecutionCanceledResult.is({ canceled: false })).to.be.false; + expect(ShellExecutionCanceledResult.is({ output: 'test' })).to.be.false; + }); +}); diff --git a/packages/ai-terminal/src/common/shell-execution-server.ts b/packages/ai-terminal/src/common/shell-execution-server.ts new file mode 100644 index 0000000..96b5ab9 --- /dev/null +++ b/packages/ai-terminal/src/common/shell-execution-server.ts @@ -0,0 +1,122 @@ +// ***************************************************************************** +// Copyright (C) 2026 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +export const SHELL_EXECUTION_FUNCTION_ID = 'shellExecute'; + +export const ShellExecutionServer = Symbol('ShellExecutionServer'); +export const shellExecutionPath = '/services/shell-execution'; + +export interface ShellExecutionRequest { + command: string; + /** Working directory. Can be absolute or relative to workspaceRoot. */ + cwd?: string; + /** Workspace root path for resolving relative cwd paths */ + workspaceRoot?: string; + timeout?: number; // milliseconds + /** Unique ID for this execution, used for cancellation */ + executionId?: string; +} + +export interface ShellExecutionResult { + success: boolean; + exitCode: number | undefined; + stdout: string; + stderr: string; + error?: string; + /** Execution duration in milliseconds */ + duration: number; + /** Whether the execution was canceled by user action (not timeout) */ + canceled?: boolean; + /** The resolved working directory where the command was executed */ + resolvedCwd?: string; +} + +export interface ShellExecutionServer { + execute(request: ShellExecutionRequest): Promise; + cancel(executionId: string): Promise; +} + +export interface ShellExecutionToolResult { + success: boolean; + exitCode: number | undefined; + output: string; + error?: string; + duration: number; + cwd?: string; +} + +export interface ShellExecutionCanceledResult { + canceled: true; + output?: string; + duration?: number; +} + +export namespace ShellExecutionToolResult { + export function is(obj: unknown): obj is ShellExecutionToolResult { + return !!obj && typeof obj === 'object' && + 'success' in obj && typeof (obj as ShellExecutionToolResult).success === 'boolean' && + 'duration' in obj && typeof (obj as ShellExecutionToolResult).duration === 'number'; + } +} + +export namespace ShellExecutionCanceledResult { + export function is(obj: unknown): obj is ShellExecutionCanceledResult { + return !!obj && typeof obj === 'object' && + 'canceled' in obj && (obj as ShellExecutionCanceledResult).canceled === true; + } +} + +export const HEAD_LINES = 50; +export const TAIL_LINES = 50; +export const GRACE_LINES = 10; +export const MAX_LINE_LENGTH = 1000; + +export function truncateLine(line: string): string { + if (line.length <= MAX_LINE_LENGTH) { + return line; + } + const halfLength = Math.floor((MAX_LINE_LENGTH - 30) / 2); + const omittedCount = line.length - halfLength * 2; + return `${line.slice(0, halfLength)} ... [${omittedCount} chars omitted] ... ${line.slice(-halfLength)}`; +} + +export function combineAndTruncate(stdout: string, stderr: string): string { + const trimmedStdout = stdout.trim(); + const trimmedStderr = stderr.trim(); + + let output = trimmedStdout; + if (trimmedStderr) { + output = output + ? `${output}\n--- stderr ---\n${trimmedStderr}` + : trimmedStderr; + } + + if (!output) { + return output; + } + + const lines = output.split('\n'); + + if (lines.length <= HEAD_LINES + TAIL_LINES + GRACE_LINES) { + return lines.map(truncateLine).join('\n'); + } + + const headLines = lines.slice(0, HEAD_LINES).map(truncateLine); + const tailLines = lines.slice(-TAIL_LINES).map(truncateLine); + const omittedCount = lines.length - HEAD_LINES - TAIL_LINES; + + return [...headLines, `\n... [${omittedCount} lines omitted] ...\n`, ...tailLines].join('\n'); +} diff --git a/packages/ai-terminal/src/common/shell-execution-tool.spec.ts b/packages/ai-terminal/src/common/shell-execution-tool.spec.ts new file mode 100644 index 0000000..4519642 --- /dev/null +++ b/packages/ai-terminal/src/common/shell-execution-tool.spec.ts @@ -0,0 +1,102 @@ +// ***************************************************************************** +// Copyright (C) 2026 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { expect } from 'chai'; +import { + combineAndTruncate, + truncateLine, + HEAD_LINES, + TAIL_LINES, + GRACE_LINES, + MAX_LINE_LENGTH +} from './shell-execution-server'; + +describe('Shell Execution Tool', () => { + describe('combineAndTruncate', () => { + it('should return stdout when no stderr', () => { + const result = combineAndTruncate('stdout content', ''); + expect(result).to.equal('stdout content'); + }); + + it('should return stderr when no stdout', () => { + const result = combineAndTruncate('', 'stderr content'); + expect(result).to.equal('stderr content'); + }); + + it('should combine stdout and stderr with separator', () => { + const result = combineAndTruncate('stdout content', 'stderr content'); + expect(result).to.equal('stdout content\n--- stderr ---\nstderr content'); + }); + + it('should return empty string when both are empty', () => { + const result = combineAndTruncate('', ''); + expect(result).to.equal(''); + }); + + it('should not truncate output within grace area', () => { + const lineCount = HEAD_LINES + TAIL_LINES + GRACE_LINES; + const lines = Array.from({ length: lineCount }, (_, i) => `line ${i + 1}`); + const stdout = lines.join('\n'); + const result = combineAndTruncate(stdout, ''); + expect(result).to.not.include('lines omitted'); + expect(result.split('\n').length).to.equal(lineCount); + }); + + it('should truncate output exceeding grace area', () => { + const lineCount = HEAD_LINES + TAIL_LINES + GRACE_LINES + 1; + const lines = Array.from({ length: lineCount }, (_, i) => `line ${i + 1}`); + const stdout = lines.join('\n'); + const result = combineAndTruncate(stdout, ''); + expect(result).to.include('lines omitted'); + }); + + it('should truncate long lines in output', () => { + const longLine = 'x'.repeat(MAX_LINE_LENGTH + 500); + const result = combineAndTruncate(longLine, ''); + expect(result).to.include('chars omitted'); + expect(result.length).to.be.lessThan(longLine.length); + }); + }); + + describe('truncateLine', () => { + it('should not truncate short lines', () => { + const line = 'short line'; + expect(truncateLine(line)).to.equal(line); + }); + + it('should not truncate lines at exactly MAX_LINE_LENGTH', () => { + const line = 'x'.repeat(MAX_LINE_LENGTH); + expect(truncateLine(line)).to.equal(line); + }); + + it('should truncate lines exceeding MAX_LINE_LENGTH', () => { + const line = 'x'.repeat(MAX_LINE_LENGTH + 100); + const result = truncateLine(line); + expect(result).to.include('chars omitted'); + expect(result.length).to.be.lessThan(line.length); + }); + + it('should preserve start and end of truncated lines', () => { + const start = 'START_'; + const end = '_END'; + const middle = 'x'.repeat(MAX_LINE_LENGTH + 100); + const line = start + middle + end; + const result = truncateLine(line); + expect(result.startsWith(start)).to.be.true; + expect(result.endsWith(end)).to.be.true; + }); + }); +}); diff --git a/packages/ai-terminal/src/node/ai-terminal-backend-module.ts b/packages/ai-terminal/src/node/ai-terminal-backend-module.ts new file mode 100644 index 0000000..fc91c37 --- /dev/null +++ b/packages/ai-terminal/src/node/ai-terminal-backend-module.ts @@ -0,0 +1,31 @@ +// ***************************************************************************** +// Copyright (C) 2026 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { ContainerModule } from '@theia/core/shared/inversify'; +import { ConnectionHandler, JsonRpcConnectionHandler } from '@theia/core/lib/common/messaging'; +import { ShellExecutionServer, shellExecutionPath } from '../common/shell-execution-server'; +import { ShellExecutionServerImpl } from './shell-execution-server-impl'; + +export default new ContainerModule(bind => { + bind(ShellExecutionServerImpl).toSelf().inSingletonScope(); + bind(ShellExecutionServer).toService(ShellExecutionServerImpl); + + bind(ConnectionHandler).toDynamicValue(ctx => + new JsonRpcConnectionHandler(shellExecutionPath, () => + ctx.container.get(ShellExecutionServer) + ) + ).inSingletonScope(); +}); diff --git a/packages/ai-terminal/src/node/shell-execution-server-impl.ts b/packages/ai-terminal/src/node/shell-execution-server-impl.ts new file mode 100644 index 0000000..1770e00 --- /dev/null +++ b/packages/ai-terminal/src/node/shell-execution-server-impl.ts @@ -0,0 +1,194 @@ +// ***************************************************************************** +// Copyright (C) 2026 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { injectable } from '@theia/core/shared/inversify'; +import { spawn, ChildProcess, execSync } from 'child_process'; +import * as path from 'path'; +import { ShellExecutionServer, ShellExecutionRequest, ShellExecutionResult } from '../common/shell-execution-server'; + +const DEFAULT_TIMEOUT = 120000; // 2 minutes +const MAX_TIMEOUT = 600000; // 10 minutes +const MAX_OUTPUT_SIZE = 1024 * 1024; // 1MB + +@injectable() +export class ShellExecutionServerImpl implements ShellExecutionServer { + + protected readonly runningProcesses = new Map(); + protected readonly canceledExecutions = new Set(); + + async execute(request: ShellExecutionRequest): Promise { + const { command, cwd, workspaceRoot, timeout, executionId } = request; + const effectiveTimeout = Math.min(timeout ?? DEFAULT_TIMEOUT, MAX_TIMEOUT); + const startTime = Date.now(); + + const resolvedCwd = this.resolveCwd(cwd, workspaceRoot); + + return new Promise(resolve => { + let stdout = ''; + let stderr = ''; + let killed = false; + + const childProcess = spawn(command, [], { + cwd: resolvedCwd, + shell: true, + detached: process.platform !== 'win32', + windowsHide: true, + env: process.env, + }); + + if (executionId) { + this.runningProcesses.set(executionId, childProcess); + } + + childProcess.stdout?.on('data', (data: Buffer) => { + if (stdout.length < MAX_OUTPUT_SIZE) { + stdout += data.toString(); + } + }); + + childProcess.stderr?.on('data', (data: Buffer) => { + if (stderr.length < MAX_OUTPUT_SIZE) { + stderr += data.toString(); + } + }); + + const timeoutId = setTimeout(() => { + killed = true; + this.killProcessTree(childProcess); + }, effectiveTimeout); + + childProcess.on('close', (code, signal) => { + clearTimeout(timeoutId); + + if (executionId) { + this.runningProcesses.delete(executionId); + } + + const duration = Date.now() - startTime; + const wasCanceledByUser = executionId ? this.canceledExecutions.has(executionId) : false; + if (executionId) { + this.canceledExecutions.delete(executionId); + } + + if (signal || killed) { + if (wasCanceledByUser) { + resolve({ + success: false, + exitCode: undefined, + stdout, + stderr, + error: 'Command canceled by user', + duration, + canceled: true, + resolvedCwd, + }); + } else { + resolve({ + success: false, + exitCode: undefined, + stdout, + stderr, + error: `Command timed out after ${effectiveTimeout}ms`, + duration, + resolvedCwd, + }); + } + } else if (code === 0) { + resolve({ + success: true, + exitCode: 0, + stdout, + stderr, + duration, + resolvedCwd, + }); + } else { + resolve({ + success: false, + exitCode: code ?? undefined, + stdout, + stderr, + duration, + resolvedCwd, + }); + } + }); + + childProcess.on('error', (error: Error) => { + clearTimeout(timeoutId); + + if (executionId) { + this.runningProcesses.delete(executionId); + this.canceledExecutions.delete(executionId); + } + + resolve({ + success: false, + exitCode: undefined, + stdout, + stderr, + error: error.message, + duration: Date.now() - startTime, + resolvedCwd, + }); + }); + }); + } + + async cancel(executionId: string): Promise { + const childProcess = this.runningProcesses.get(executionId); + if (childProcess) { + this.canceledExecutions.add(executionId); + this.killProcessTree(childProcess); + this.runningProcesses.delete(executionId); + return true; + } + return false; + } + + protected killProcessTree(childProcess: ChildProcess): void { + if (!childProcess.pid) { + return; + } + + try { + if (process.platform === 'win32') { + execSync(`taskkill /pid ${childProcess.pid} /T /F`, { stdio: 'ignore' }); + } else { + process.kill(-childProcess.pid, 'SIGTERM'); + } + } catch { + try { + childProcess.kill('SIGKILL'); + } catch { + // Process may already be dead + } + } + } + + protected resolveCwd(requestedCwd: string | undefined, workspaceRoot: string | undefined): string | undefined { + if (!requestedCwd) { + return workspaceRoot; + } + if (path.isAbsolute(requestedCwd)) { + return requestedCwd; + } + if (workspaceRoot) { + return path.resolve(workspaceRoot, requestedCwd); + } + return requestedCwd; + } +} diff --git a/packages/ai-terminal/src/package.spec.ts b/packages/ai-terminal/src/package.spec.ts new file mode 100644 index 0000000..7c55c63 --- /dev/null +++ b/packages/ai-terminal/src/package.spec.ts @@ -0,0 +1,28 @@ +// ***************************************************************************** +// Copyright (C) 2024 EclipseSource GmbH and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +/* note: this bogus test file is required so that + we are able to run mocha unit tests on this + package, without having any actual unit tests in it. + This way a coverage report will be generated, + showing 0% coverage, instead of no report. + This file can be removed once we have real unit + tests in place. */ + +describe('ai-terminal package', () => { + + it('support code coverage statistics', () => true); +}); diff --git a/packages/ai-terminal/tsconfig.json b/packages/ai-terminal/tsconfig.json new file mode 100644 index 0000000..b8bfdf3 --- /dev/null +++ b/packages/ai-terminal/tsconfig.json @@ -0,0 +1,31 @@ +{ + "extends": "../../configs/base.tsconfig", + "compilerOptions": { + "composite": true, + "rootDir": "src", + "outDir": "lib" + }, + "include": [ + "src" + ], + "references": [ + { + "path": "../ai-chat" + }, + { + "path": "../ai-chat-ui" + }, + { + "path": "../ai-core" + }, + { + "path": "../core" + }, + { + "path": "../terminal" + }, + { + "path": "../workspace" + } + ] +} diff --git a/packages/ai-vercel-ai.disabled/.eslintrc.js b/packages/ai-vercel-ai.disabled/.eslintrc.js new file mode 100644 index 0000000..b206be4 --- /dev/null +++ b/packages/ai-vercel-ai.disabled/.eslintrc.js @@ -0,0 +1,10 @@ +/** @type {import('eslint').Linter.Config} */ +module.exports = { + extends: [ + '../../configs/build.eslintrc.json' + ], + parserOptions: { + tsconfigRootDir: __dirname, + project: 'tsconfig.json' + } +}; \ No newline at end of file diff --git a/packages/ai-vercel-ai.disabled/README.md b/packages/ai-vercel-ai.disabled/README.md new file mode 100644 index 0000000..9124227 --- /dev/null +++ b/packages/ai-vercel-ai.disabled/README.md @@ -0,0 +1,32 @@ +
    + +
    + +theia-ext-logo + +

    ECLIPSE THEIA - VERCEL AI SDK INTEGRATION

    + +
    + +
    + +## Description + +The `@theia/ai-vercel-ai` extension integrates Vercels's models with Theia AI. +The Vercel AI API key and the models to use can be configured via preferences. + +## Additional Information + +- [API documentation for `@theia/ai-vercel-ai`](https://eclipse-theia.github.io/theia/docs/next/modules/_theia_ai-vercel-ai.html) +- [Theia - GitHub](https://github.com/eclipse-theia/theia) +- [Theia - Website](https://theia-ide.org/) + +## License + +- [Eclipse Public License 2.0](http://www.eclipse.org/legal/epl-2.0/) +- [一 (Secondary) GNU General Public License, version 2 with the GNU Classpath Exception](https://projects.eclipse.org/license/secondary-gpl-2.0-cp) + +## Trademark + +"Theia" is a trademark of the Eclipse Foundation + diff --git a/packages/ai-vercel-ai.disabled/package.json b/packages/ai-vercel-ai.disabled/package.json new file mode 100644 index 0000000..cb5863e --- /dev/null +++ b/packages/ai-vercel-ai.disabled/package.json @@ -0,0 +1,55 @@ +{ + "name": "@theia/ai-vercel-ai", + "version": "1.68.0", + "description": "Theia - Vercel AI SDK Integration", + "dependencies": { + "@theia/ai-core": "1.68.0", + "@theia/core": "1.68.0", + "@theia/filesystem": "1.68.0", + "@theia/workspace": "1.68.0", + "ai": "^4.3.13", + "@ai-sdk/provider": "^1.1.3", + "@ai-sdk/openai": "^1.3.21", + "@ai-sdk/anthropic": "^1.2.10", + "tslib": "^2.6.2" + }, + "publishConfig": { + "access": "public" + }, + "theiaExtensions": [ + { + "frontend": "lib/browser/vercel-ai-frontend-module", + "backend": "lib/node/vercel-ai-backend-module" + } + ], + "keywords": [ + "theia-extension" + ], + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "repository": { + "type": "git", + "url": "https://github.com/eclipse-theia/theia.git" + }, + "bugs": { + "url": "https://github.com/eclipse-theia/theia/issues" + }, + "homepage": "https://github.com/eclipse-theia/theia", + "files": [ + "lib", + "src" + ], + "scripts": { + "build": "theiaext build", + "clean": "theiaext clean", + "compile": "theiaext compile", + "lint": "theiaext lint", + "test": "theiaext test", + "watch": "theiaext watch" + }, + "devDependencies": { + "@theia/ext-scripts": "1.68.0" + }, + "nyc": { + "extends": "../../configs/nyc.json" + } +} diff --git a/packages/ai-vercel-ai.disabled/src/browser/vercel-ai-frontend-application-contribution.ts b/packages/ai-vercel-ai.disabled/src/browser/vercel-ai-frontend-application-contribution.ts new file mode 100644 index 0000000..913dfed --- /dev/null +++ b/packages/ai-vercel-ai.disabled/src/browser/vercel-ai-frontend-application-contribution.ts @@ -0,0 +1,226 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { FrontendApplicationContribution } from '@theia/core/lib/browser'; +import { inject, injectable } from '@theia/core/shared/inversify'; +import { VercelAiLanguageModelsManager, VercelAiModelDescription, VercelAiProvider } from '../common'; +import { ANTHROPIC_API_KEY_PREF, CUSTOM_ENDPOINTS_PREF, MODELS_PREF, OPENAI_API_KEY_PREF, VERCEL_AI_PROVIDER_ID } from '../common/vercel-ai-preferences'; +import { AICorePreferences, PREFERENCE_NAME_MAX_RETRIES } from '@theia/ai-core/lib/common/ai-core-preferences'; +import { PreferenceService, PreferenceChange } from '@theia/core'; + +interface ModelConfig { + id: string; + model: string; + provider: VercelAiProvider; +} + +@injectable() +export class VercelAiFrontendApplicationContribution implements FrontendApplicationContribution { + + @inject(PreferenceService) + protected preferenceService: PreferenceService; + + @inject(VercelAiLanguageModelsManager) + protected manager: VercelAiLanguageModelsManager; + + @inject(AICorePreferences) + protected aiCorePreferences: AICorePreferences; + + onStart(): void { + this.preferenceService.ready.then(() => { + // Set up provider-specific API keys + const openaiApiKey = this.preferenceService.get(OPENAI_API_KEY_PREF, undefined); + const anthropicApiKey = this.preferenceService.get(ANTHROPIC_API_KEY_PREF, undefined); + + // Set provider configs + if (openaiApiKey) { + this.manager.setProviderConfig('openai', { provider: 'openai', apiKey: openaiApiKey }); + } + + if (anthropicApiKey) { + this.manager.setProviderConfig('anthropic', { provider: 'anthropic', apiKey: anthropicApiKey }); + } + + // Initial setup of models + const models = this.preferenceService.get(MODELS_PREF, []); + this.manager.createOrUpdateLanguageModels(...models.map(model => this.createVercelAiModelDescription(model))); + + const customModels = this.preferenceService.get[]>(CUSTOM_ENDPOINTS_PREF, []); + this.manager.createOrUpdateLanguageModels(...this.createCustomModelDescriptionsFromPreferences(customModels)); + + // Set up listeners for preference changes + this.preferenceService.onPreferenceChanged(this.handlePreferenceChange.bind(this)); + + this.aiCorePreferences.onPreferenceChanged(event => { + if (event.preferenceName === PREFERENCE_NAME_MAX_RETRIES) { + this.updateAllModels(); + } + }); + }); + } + + protected handlePreferenceChange(event: PreferenceChange): void { + switch (event.preferenceName) { + case OPENAI_API_KEY_PREF: + this.manager.setProviderConfig('openai', { provider: 'openai', apiKey: this.preferenceService.get(OPENAI_API_KEY_PREF, undefined) }); + this.updateAllModels(); + break; + case ANTHROPIC_API_KEY_PREF: + this.manager.setProviderConfig('anthropic', { provider: 'anthropic', apiKey: this.preferenceService.get(ANTHROPIC_API_KEY_PREF, undefined) }); + this.updateAllModels(); + break; + case MODELS_PREF: + this.handleModelChanges(event); + break; + case CUSTOM_ENDPOINTS_PREF: + this.handleCustomModelChanges(event); + break; + } + } + + protected previousModels: ModelConfig[] = []; + protected previousCustomModels: Partial[] = []; + + protected handleModelChanges(event: PreferenceChange): void { + const newModels = this.ensureModelConfigArray(this.preferenceService.get(MODELS_PREF, [])); + const oldModels = this.previousModels; + this.previousModels = newModels; + + const oldModelIds = new Set(oldModels.map(m => m.id)); + const newModelIds = new Set(newModels.map(m => m.id)); + + const modelsToRemove = [...oldModelIds].filter(modelId => !newModelIds.has(modelId)); + const modelsToAdd = newModels.filter(model => !oldModelIds.has(model.id)); + + this.manager.removeLanguageModels(...modelsToRemove); + this.manager.createOrUpdateLanguageModels(...modelsToAdd.map(model => this.createVercelAiModelDescription(model))); + } + + protected handleCustomModelChanges(event: PreferenceChange): void { + const newCustomModels = this.ensureCustomModelArray(this.preferenceService.get(CUSTOM_ENDPOINTS_PREF, [])); + const oldCustomModels = this.previousCustomModels; + this.previousCustomModels = newCustomModels; + + const oldModels = this.createCustomModelDescriptionsFromPreferences(oldCustomModels); + const newModels = this.createCustomModelDescriptionsFromPreferences(newCustomModels); + + const modelsToRemove = oldModels.filter(model => !newModels.some(newModel => newModel.id === model.id)); + const modelsToAddOrUpdate = newModels.filter(newModel => + !oldModels.some(model => + model.id === newModel.id && + model.model === newModel.model && + model.url === newModel.url && + model.apiKey === newModel.apiKey && + model.supportsStructuredOutput === newModel.supportsStructuredOutput && + model.enableStreaming === newModel.enableStreaming && + model.provider === newModel.provider)); + + this.manager.removeLanguageModels(...modelsToRemove.map(model => model.id)); + this.manager.createOrUpdateLanguageModels(...modelsToAddOrUpdate); + } + + protected ensureModelConfigArray(value: unknown): ModelConfig[] { + if (!value || !Array.isArray(value)) { + return []; + } + + return value.filter(item => + item && + typeof item === 'object' && + 'id' in item && + 'model' in item && + 'provider' in item && + typeof item.id === 'string' && + typeof item.model === 'string' && + (typeof item.provider === 'string' || item.provider === undefined) + ) as ModelConfig[]; + } + + protected ensureCustomModelArray(value: unknown): Partial[] { + if (!value || !Array.isArray(value)) { + return []; + } + + return value.filter(item => + item && + typeof item === 'object' + ) as Partial[]; + } + + protected updateAllModels(): void { + const models = this.preferenceService.get(MODELS_PREF, []); + this.manager.createOrUpdateLanguageModels(...models.map(model => this.createVercelAiModelDescription(model))); + + const customModels = this.preferenceService.get[]>(CUSTOM_ENDPOINTS_PREF, []); + this.manager.createOrUpdateLanguageModels(...this.createCustomModelDescriptionsFromPreferences(customModels)); + } + + protected createVercelAiModelDescription(modelInfo: ModelConfig): VercelAiModelDescription { + const maxRetries = this.aiCorePreferences.get(PREFERENCE_NAME_MAX_RETRIES) ?? 3; + // The model ID already includes the 'vercel' prefix from preferences + return { + id: modelInfo.id, + model: modelInfo.model, + provider: modelInfo.provider, + apiKey: true, + enableStreaming: true, + supportsStructuredOutput: modelsSupportingStructuredOutput.includes(modelInfo.model), + maxRetries: maxRetries + }; + } + + protected createCustomModelDescriptionsFromPreferences( + preferences: Partial[] + ): VercelAiModelDescription[] { + const maxRetries = this.aiCorePreferences.get(PREFERENCE_NAME_MAX_RETRIES) ?? 3; + return preferences.reduce((acc, pref) => { + if (!pref.model || !pref.url || typeof pref.model !== 'string' || typeof pref.url !== 'string') { + return acc; + } + + // Ensure custom model IDs have the 'vercel' prefix + const modelId = pref.id && typeof pref.id === 'string' ? pref.id : pref.model; + const prefixedId = modelId.startsWith('vercel/') ? modelId : `${VERCEL_AI_PROVIDER_ID}/${modelId}`; + + return [ + ...acc, + { + id: prefixedId, + model: pref.model, + url: pref.url, + provider: pref.provider || 'openai', + apiKey: typeof pref.apiKey === 'string' || pref.apiKey === true ? pref.apiKey : undefined, + supportsStructuredOutput: pref.supportsStructuredOutput ?? true, + enableStreaming: pref.enableStreaming ?? true, + maxRetries: pref.maxRetries ?? maxRetries + } + ]; + }, []); + } +} + +// List of models that support structured output via JSON schema +const modelsSupportingStructuredOutput = [ + 'gpt-4.1', + 'gpt-4.1-mini', + 'gpt-4.1-nano', + 'gpt-4o', + 'gpt-4o-mini', + 'gpt-4-turbo', + 'claude-3-7-sonnet-20250219', + 'claude-3-5-haiku-20241022', + 'claude-3-opus-20240229' +]; diff --git a/packages/ai-vercel-ai.disabled/src/browser/vercel-ai-frontend-module.ts b/packages/ai-vercel-ai.disabled/src/browser/vercel-ai-frontend-module.ts new file mode 100644 index 0000000..1cd7a01 --- /dev/null +++ b/packages/ai-vercel-ai.disabled/src/browser/vercel-ai-frontend-module.ts @@ -0,0 +1,32 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { ContainerModule } from '@theia/core/shared/inversify'; +import { VercelAiPreferencesSchema } from '../common/vercel-ai-preferences'; +import { FrontendApplicationContribution, RemoteConnectionProvider, ServiceConnectionProvider } from '@theia/core/lib/browser'; +import { VercelAiFrontendApplicationContribution } from './vercel-ai-frontend-application-contribution'; +import { VERCEL_AI_LANGUAGE_MODELS_MANAGER_PATH, VercelAiLanguageModelsManager } from '../common'; +import { PreferenceContribution } from '@theia/core'; + +export default new ContainerModule(bind => { + bind(PreferenceContribution).toConstantValue({ schema: VercelAiPreferencesSchema }); + bind(VercelAiFrontendApplicationContribution).toSelf().inSingletonScope(); + bind(FrontendApplicationContribution).toService(VercelAiFrontendApplicationContribution); + bind(VercelAiLanguageModelsManager).toDynamicValue(ctx => { + const provider = ctx.container.get(RemoteConnectionProvider); + return provider.createProxy(VERCEL_AI_LANGUAGE_MODELS_MANAGER_PATH); + }).inSingletonScope(); +}); diff --git a/packages/ai-vercel-ai.disabled/src/common/index.ts b/packages/ai-vercel-ai.disabled/src/common/index.ts new file mode 100644 index 0000000..443dcef --- /dev/null +++ b/packages/ai-vercel-ai.disabled/src/common/index.ts @@ -0,0 +1,16 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** +export * from './vercel-ai-language-models-manager'; diff --git a/packages/ai-vercel-ai.disabled/src/common/vercel-ai-language-models-manager.ts b/packages/ai-vercel-ai.disabled/src/common/vercel-ai-language-models-manager.ts new file mode 100644 index 0000000..b36a97f --- /dev/null +++ b/packages/ai-vercel-ai.disabled/src/common/vercel-ai-language-models-manager.ts @@ -0,0 +1,67 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** +export const VERCEL_AI_LANGUAGE_MODELS_MANAGER_PATH = '/services/vercel-ai/language-model-manager'; + +export type VercelAiProvider = 'openai' | 'anthropic'; + +export interface VercelAiProviderConfig { + provider: VercelAiProvider; + apiKey?: string; + baseURL?: string; +} + +export interface VercelAiModelDescription { + /** + * The identifier of the model which will be shown in the UI. + */ + id: string; + /** + * The model ID as used by the Vercel AI SDK. + */ + model: string; + /** + * The provider of the model (openai, anthropic, etc.) + */ + provider?: VercelAiProvider; + /** + * The API base URL where the model is hosted. If not provided the default provider endpoint will be used. + */ + url?: string; + /** + * The key for the model. If 'true' is provided the global provider API key will be used. + */ + apiKey: string | true | undefined; + /** + * Controls whether streaming is enabled for this model. + */ + enableStreaming: boolean; + /** + * Flag to configure whether the model supports structured output. Default is `true`. + */ + supportsStructuredOutput: boolean; + /** + * Maximum number of retry attempts when a request fails. Default is 3. + */ + maxRetries: number; +} + +export const VercelAiLanguageModelsManager = Symbol('VercelAiLanguageModelsManager'); +export interface VercelAiLanguageModelsManager { + apiKey: string | undefined; + setProviderConfig(provider: VercelAiProvider, config: Partial): void; + createOrUpdateLanguageModels(...models: VercelAiModelDescription[]): Promise; + removeLanguageModels(...modelIds: string[]): void; +} diff --git a/packages/ai-vercel-ai.disabled/src/common/vercel-ai-preferences.ts b/packages/ai-vercel-ai.disabled/src/common/vercel-ai-preferences.ts new file mode 100644 index 0000000..dec4df5 --- /dev/null +++ b/packages/ai-vercel-ai.disabled/src/common/vercel-ai-preferences.ts @@ -0,0 +1,141 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { AI_CORE_PREFERENCES_TITLE } from '@theia/ai-core/lib/common/ai-core-preferences'; +import { nls, PreferenceSchema } from '@theia/core'; + +export const OPENAI_API_KEY_PREF = 'ai-features.vercelAi.openaiApiKey'; +export const ANTHROPIC_API_KEY_PREF = 'ai-features.vercelAi.anthropicApiKey'; +export const MODELS_PREF = 'ai-features.vercelAi.officialModels'; +export const CUSTOM_ENDPOINTS_PREF = 'ai-features.vercelAi.customModels'; + +export const VERCEL_AI_PROVIDER_ID = 'vercel-ai'; + +export const VercelAiPreferencesSchema: PreferenceSchema = { + properties: { + [OPENAI_API_KEY_PREF]: { + type: 'string', + markdownDescription: nls.localize('theia/ai/vercelai/openaiApiKey/mdDescription', + 'Enter an API Key for OpenAI models used by the Vercel AI SDK. \ + **Please note:** By using this preference the API key will be stored in clear text \ + on the machine running Theia. Use the environment variable `OPENAI_API_KEY` to set the key securely.'), + title: AI_CORE_PREFERENCES_TITLE, + tags: ['experimental'] + }, + [ANTHROPIC_API_KEY_PREF]: { + type: 'string', + markdownDescription: nls.localize('theia/ai/vercelai/anthropicApiKey/mdDescription', + 'Enter an API Key for Anthropic models used by the Vercel AI SDK. \ + **Please note:** By using this preference the API key will be stored in clear text \ + on the machine running Theia. Use the environment variable `ANTHROPIC_API_KEY` to set the key securely.'), + title: AI_CORE_PREFERENCES_TITLE, + tags: ['experimental'] + }, + [MODELS_PREF]: { + type: 'array', + description: nls.localize('theia/ai/vercelai/models/description', 'Official models to use with Vercel AI SDK'), + title: AI_CORE_PREFERENCES_TITLE, + default: [ + { id: 'vercel/openai/gpt-4.1', model: 'gpt-4.1', provider: 'openai' }, + { id: 'vercel/openai/gpt-4.1-nano', model: 'gpt-4.1-nano', provider: 'openai' }, + { id: 'vercel/openai/gpt-4.1-mini', model: 'gpt-4.1-mini', provider: 'openai' }, + { id: 'vercel/openai/gpt-4-turbo', model: 'gpt-4-turbo', provider: 'openai' }, + { id: 'vercel/openai/gpt-4o', model: 'gpt-4o', provider: 'openai' }, + { id: 'vercel/openai/gpt-4o-mini', model: 'gpt-4o-mini', provider: 'openai' }, + { id: 'vercel/anthropic/claude-3-7-sonnet-20250219', model: 'claude-3-7-sonnet-20250219', provider: 'anthropic' }, + { id: 'vercel/anthropic/claude-3-5-haiku-20241022', model: 'claude-3-5-haiku-20241022', provider: 'anthropic' }, + { id: 'vercel/anthropic/claude-3-opus-20240229', model: 'claude-3-opus-20240229', provider: 'anthropic' } + ], + items: { + type: 'object', + properties: { + id: { + type: 'string', + title: nls.localize('theia/ai/vercelai/models/id/title', 'Model ID') + }, + model: { + type: 'string', + title: nls.localize('theia/ai/vercelai/models/model/title', 'Model Name') + }, + provider: { + type: 'string', + enum: ['openai', 'anthropic'], + title: nls.localizeByDefault('Provider') + } + }, + required: ['id', 'model', 'provider'] + }, + tags: ['experimental'] + }, + [CUSTOM_ENDPOINTS_PREF]: { + type: 'array', + title: AI_CORE_PREFERENCES_TITLE, + markdownDescription: nls.localize('theia/ai/vercelai/customEndpoints/mdDescription', + 'Integrate custom models compatible with the Vercel AI SDK. The required attributes are `model` and `url`.\ + \n\ + Optionally, you can\ + \n\ + - specify a unique `id` to identify the custom model in the UI. If none is given `model` will be used as `id`.\ + \n\ + - provide an `apiKey` to access the API served at the given url. Use `true` to indicate the use of the global API key.\ + \n\ + - specify `supportsStructuredOutput: false` to indicate that structured output shall not be used.\ + \n\ + - specify `enableStreaming: false` to indicate that streaming shall not be used.\ + \n\ + - specify `provider` to indicate which provider the model is from (openai, anthropic).'), + default: [], + items: { + type: 'object', + properties: { + model: { + type: 'string', + title: nls.localize('theia/ai/vercelai/customEndpoints/modelId/title', 'Model ID') + }, + url: { + type: 'string', + title: nls.localize('theia/ai/vercelai/customEndpoints/url/title', 'The API endpoint where the model is hosted') + }, + id: { + type: 'string', + title: nls.localize('theia/ai/vercelai/customEndpoints/id/title', 'A unique identifier which is used in the UI to identify the custom model'), + }, + provider: { + type: 'string', + enum: ['openai', 'anthropic'], + title: nls.localizeByDefault('Provider') + }, + apiKey: { + type: ['string', 'boolean'], + title: nls.localize('theia/ai/vercelai/customEndpoints/apiKey/title', + 'Either the key to access the API served at the given url or `true` to use the global API key'), + }, + supportsStructuredOutput: { + type: 'boolean', + title: nls.localize('theia/ai/vercelai/customEndpoints/supportsStructuredOutput/title', + 'Indicates whether the model supports structured output. `true` by default.'), + }, + enableStreaming: { + type: 'boolean', + title: nls.localize('theia/ai/vercelai/customEndpoints/enableStreaming/title', + 'Indicates whether the streaming API shall be used. `true` by default.'), + } + } + }, + tags: ['experimental'] + } + } +}; diff --git a/packages/ai-vercel-ai.disabled/src/node/vercel-ai-backend-module.ts b/packages/ai-vercel-ai.disabled/src/node/vercel-ai-backend-module.ts new file mode 100644 index 0000000..344808f --- /dev/null +++ b/packages/ai-vercel-ai.disabled/src/node/vercel-ai-backend-module.ts @@ -0,0 +1,37 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { ContainerModule } from '@theia/core/shared/inversify'; +import { VERCEL_AI_LANGUAGE_MODELS_MANAGER_PATH, VercelAiLanguageModelsManager } from '../common/vercel-ai-language-models-manager'; +import { ConnectionHandler, PreferenceContribution, RpcConnectionHandler } from '@theia/core'; +import { VercelAiLanguageModelsManagerImpl } from './vercel-ai-language-models-manager-impl'; +import { ConnectionContainerModule } from '@theia/core/lib/node/messaging/connection-container-module'; +import { VercelAiLanguageModelFactory } from './vercel-ai-language-model-factory'; +import { VercelAiPreferencesSchema } from '../common/vercel-ai-preferences'; + +const vercelAiConnectionModule = ConnectionContainerModule.create(({ bind, bindBackendService, bindFrontendService }) => { + bind(VercelAiLanguageModelsManagerImpl).toSelf().inSingletonScope(); + bind(VercelAiLanguageModelsManager).toService(VercelAiLanguageModelsManagerImpl); + bind(VercelAiLanguageModelFactory).toSelf().inSingletonScope(); + bind(ConnectionHandler).toDynamicValue(ctx => + new RpcConnectionHandler(VERCEL_AI_LANGUAGE_MODELS_MANAGER_PATH, () => ctx.container.get(VercelAiLanguageModelsManager)) + ).inSingletonScope(); +}); + +export default new ContainerModule(bind => { + bind(PreferenceContribution).toConstantValue({ schema: VercelAiPreferencesSchema }); + bind(ConnectionContainerModule).toConstantValue(vercelAiConnectionModule); +}); diff --git a/packages/ai-vercel-ai.disabled/src/node/vercel-ai-language-model-factory.ts b/packages/ai-vercel-ai.disabled/src/node/vercel-ai-language-model-factory.ts new file mode 100644 index 0000000..01ab797 --- /dev/null +++ b/packages/ai-vercel-ai.disabled/src/node/vercel-ai-language-model-factory.ts @@ -0,0 +1,82 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { createAnthropic } from '@ai-sdk/anthropic'; +import { createOpenAI } from '@ai-sdk/openai'; +import { LanguageModelV1 } from '@ai-sdk/provider'; +import { injectable } from '@theia/core/shared/inversify'; +import { VercelAiModelDescription } from '../common'; + +export type VercelAiProvider = 'openai' | 'anthropic'; + +export interface VercelAiProviderConfig { + provider: VercelAiProvider; + apiKey?: string; + baseURL?: string; +} + +@injectable() +export class VercelAiLanguageModelFactory { + + createLanguageModel(modelDescription: VercelAiModelDescription, providerConfig: VercelAiProviderConfig): LanguageModelV1 { + const apiKey = this.resolveApiKey(modelDescription, providerConfig); + if (!apiKey) { + throw new Error(`Please provide an API key for ${providerConfig.provider} in preferences or via environment variable`); + } + + const baseURL = modelDescription.url || providerConfig.baseURL; + + switch (providerConfig.provider) { + case 'openai': + return createOpenAI({ + apiKey, + baseURL, + compatibility: 'strict' + }).languageModel(modelDescription.model); + case 'anthropic': + return createAnthropic({ + apiKey, + baseURL + }).languageModel(modelDescription.model); + default: + throw new Error(`Unsupported provider: ${providerConfig.provider}`); + } + } + + private resolveApiKey(modelDescription: VercelAiModelDescription, providerConfig: VercelAiProviderConfig): string | undefined { + if (modelDescription.apiKey === true) { + return this.getApiKeyBasedOnProvider(providerConfig); + } + if (modelDescription.apiKey) { + return modelDescription.apiKey; + } + return this.getApiKeyBasedOnProvider(providerConfig); + } + + private getApiKeyBasedOnProvider(providerConfig: VercelAiProviderConfig): string | undefined { + if (providerConfig.apiKey) { + return providerConfig.apiKey; + } + switch (providerConfig.provider) { + case 'openai': + return process.env.OPENAI_API_KEY; + case 'anthropic': + return process.env.ANTHROPIC_API_KEY; + default: + return undefined; + } + } +} diff --git a/packages/ai-vercel-ai.disabled/src/node/vercel-ai-language-model.ts b/packages/ai-vercel-ai.disabled/src/node/vercel-ai-language-model.ts new file mode 100644 index 0000000..5711d00 --- /dev/null +++ b/packages/ai-vercel-ai.disabled/src/node/vercel-ai-language-model.ts @@ -0,0 +1,413 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { LanguageModelV1 } from '@ai-sdk/provider'; +import { + LanguageModel, + LanguageModelMessage, + LanguageModelParsedResponse, + LanguageModelRequest, + LanguageModelResponse, + LanguageModelStatus, + LanguageModelStreamResponse, + LanguageModelStreamResponsePart, + LanguageModelTextResponse, + TokenUsageService, + ToolCall, + UserRequest, +} from '@theia/ai-core'; +import { CancellationToken, Disposable, ILogger } from '@theia/core'; +import { + CoreMessage, + generateObject, + GenerateObjectResult, + generateText, + GenerateTextResult, + jsonSchema, + StepResult, + streamText, + TextStreamPart, + tool, + ToolExecutionOptions, + ToolResultPart, + ToolSet +} from 'ai'; +import { VercelAiLanguageModelFactory, VercelAiProviderConfig } from './vercel-ai-language-model-factory'; + +interface VercelCancellationToken extends Disposable { + signal: AbortSignal; + cancellationToken: CancellationToken; + isCancellationRequested: boolean; +} + +type StreamPart = ToolResultPart | { + type: string; + textDelta?: string; + toolCallId?: string; + toolName?: string; + args?: object | string; + argsTextDelta?: string; + usage?: { promptTokens: number; completionTokens: number }; + signature?: string; +}; + +interface VercelAiStream extends AsyncIterable> { + cancel: () => void; +} + +interface StreamContext { + logger: ILogger; + cancellationToken?: VercelCancellationToken; +} + +export class VercelAiStreamTransformer { + private toolCallsMap = new Map(); + + constructor( + protected readonly fullStream: VercelAiStream, + protected readonly context: StreamContext + ) { } + + async *transform(): AsyncGenerator { + this.toolCallsMap.clear(); + try { + for await (const part of this.fullStream) { + this.context.logger.trace('Received stream part:', part); + if (this.context.cancellationToken?.isCancellationRequested) { + this.context.logger.debug('Cancellation requested, stopping stream'); + this.fullStream.cancel(); + break; + } + + let toolCallUpdated = false; + + switch (part.type) { + case 'text-delta': + if (part.textDelta) { + yield { content: part.textDelta }; + } + break; + + case 'tool-call': + if (part.toolCallId && part.toolName) { + const args = typeof part.args === 'object' ? JSON.stringify(part.args) : (part.args || ''); + toolCallUpdated = this.updateToolCall(part.toolCallId, part.toolName, args); + } + break; + + case 'tool-call-streaming-start': + if (part.toolCallId && part.toolName) { + toolCallUpdated = this.updateToolCall(part.toolCallId, part.toolName); + } + break; + + case 'tool-call-delta': + if (part.toolCallId && part.argsTextDelta) { + toolCallUpdated = this.appendToToolCallArgs(part.toolCallId, part.argsTextDelta); + } + break; + + default: + if (this.isToolResultPart(part)) { + toolCallUpdated = this.processToolResult(part); + } + break; + } + + if (toolCallUpdated && this.toolCallsMap.size > 0) { + yield { tool_calls: Array.from(this.toolCallsMap.values()) }; + } + } + } catch (error) { + this.context.logger.error('Error in AI SDK stream:', error); + } + } + + private isToolResultPart(part: StreamPart): part is ToolResultPart { + return part.type === 'tool-result'; + } + + private updateToolCall(id: string, name: string, args?: string): boolean { + const toolCall: ToolCall = { + id, + function: { name, arguments: args ? args : '' }, + finished: false + }; + this.toolCallsMap.set(id, toolCall); + return true; + } + + private appendToToolCallArgs(id: string, argsTextDelta: string): boolean { + const existingCall = this.toolCallsMap.get(id); + if (existingCall?.function) { + existingCall.function.arguments = (existingCall.function.arguments || '') + argsTextDelta; + return true; + } + return false; + } + + private processToolResult(part: ToolResultPart): boolean { + if (!part.toolCallId) { + return false; + } + + const completedCall = this.toolCallsMap.get(part.toolCallId); + if (!completedCall) { + return false; + } + + completedCall.result = part.result as string; + completedCall.finished = true; + return true; + } + +} + +export class VercelAiModel implements LanguageModel { + + constructor( + public readonly id: string, + public model: string, + public status: LanguageModelStatus, + public enableStreaming: boolean, + public supportsStructuredOutput: boolean, + public url: string | undefined, + protected readonly logger: ILogger, + protected readonly languageModelFactory: VercelAiLanguageModelFactory, + protected providerConfig: () => VercelAiProviderConfig, + public maxRetries: number = 3, + protected readonly tokenUsageService?: TokenUsageService + ) { } + + protected getSettings(request: LanguageModelRequest): Record { + return request.settings ?? {}; + } + + async request(request: UserRequest, cancellationToken?: CancellationToken): Promise { + const settings = this.getSettings(request); + const model = this.languageModelFactory.createLanguageModel( + { + id: this.id, + model: this.model, + url: this.url, + apiKey: true, // We'll use the provider's API key + enableStreaming: this.enableStreaming, + supportsStructuredOutput: this.supportsStructuredOutput, + maxRetries: this.maxRetries + }, + this.providerConfig() + ); + const cancel = this.createCancellationToken(cancellationToken); + + try { + if (request.response_format?.type === 'json_schema' && this.supportsStructuredOutput) { + return this.handleStructuredOutputRequest(model, request, cancel); + } + if (!this.enableStreaming || (typeof settings.stream === 'boolean' && !settings.stream)) { + return this.handleNonStreamingRequest(model, request, cancel); + } + return this.handleStreamingRequest(model, request, cancel); + } catch (error) { + this.logger.error('Error in Vercel AI model request:', error); + throw error; + } finally { + cancel.dispose(); + } + } + + protected createCancellationToken(cancellationToken?: CancellationToken): VercelCancellationToken { + const abortController = new AbortController(); + const abortSignal = abortController.signal; + if (cancellationToken?.isCancellationRequested) { + abortController.abort(); + } + const cancellationListener = cancellationToken ? + cancellationToken.onCancellationRequested(() => { + abortController.abort(); + }) : undefined; + return { + signal: abortSignal, + cancellationToken: cancellationToken ?? CancellationToken.None, + get isCancellationRequested(): boolean { + return cancellationToken?.isCancellationRequested ?? abortSignal.aborted; + }, + dispose: () => cancellationListener?.dispose() + }; + } + + protected async handleNonStreamingRequest( + model: LanguageModelV1, + request: UserRequest, + cancellationToken?: VercelCancellationToken + ): Promise { + const settings = this.getSettings(request); + const messages = this.processMessages(request.messages); + const tools = this.createTools(request); + const abortSignal = cancellationToken?.signal; + + const response = await generateText({ + model, + messages, + tools, + toolChoice: 'auto', + abortSignal, + ...settings + }); + + await this.recordTokenUsage(response, request); + + return { text: response.text }; + } + + protected createTools(request: UserRequest): ToolSet | undefined { + if (!request.tools) { + return undefined; + } + + const toolSet: ToolSet = {}; + for (const toolRequest of request.tools) { + toolSet[toolRequest.name] = tool({ + description: toolRequest.description, + parameters: jsonSchema(toolRequest.parameters), + execute: async (args: object, options: ToolExecutionOptions) => { + try { + const result = await toolRequest.handler(JSON.stringify(args), options); + return JSON.stringify(result); + } catch (error) { + this.logger.error(`Error executing tool (${toolRequest.name}):`, error); + return { status: 'error', error: 'Tool execution failed', details: error }; + } + } + }); + } + return toolSet; + } + + protected async handleStructuredOutputRequest( + model: LanguageModelV1, + request: UserRequest, + cancellationToken?: VercelCancellationToken + ): Promise { + if (request.response_format?.type !== 'json_schema' || !request.response_format.json_schema.schema) { + throw Error('Invalid response format for structured output request'); + } + + const schema = jsonSchema(request.response_format.json_schema.schema); + if (!schema) { + throw new Error('Schema extraction failed.'); + } + + const settings = this.getSettings(request); + const messages = this.processMessages(request.messages); + const abortSignal = cancellationToken?.signal; + + const response = await generateObject({ + model, + output: 'object', + messages, + schema, + abortSignal, + ...settings + }); + + await this.recordTokenUsage(response, request); + + return { + content: JSON.stringify(response.object), + parsed: response.object + }; + } + + private async recordTokenUsage( + result: GenerateObjectResult | GenerateTextResult, + request: UserRequest + ): Promise { + if (this.tokenUsageService && !isNaN(result.usage.completionTokens) && !isNaN(result.usage.promptTokens)) { + await this.tokenUsageService.recordTokenUsage( + this.id, + { + inputTokens: result.usage.promptTokens, + outputTokens: result.usage.completionTokens, + requestId: request.requestId + } + ); + } + } + + protected async handleStreamingRequest( + model: LanguageModelV1, + request: UserRequest, + cancellationToken?: VercelCancellationToken + ): Promise { + const settings = this.getSettings(request); + const messages = this.processMessages(request.messages); + const tools = this.createTools(request); + const abortSignal = cancellationToken?.signal; + + const { fullStream } = streamText({ + model, + messages, + tools, + toolChoice: 'auto', + maxSteps: 100, + maxRetries: this.maxRetries, + toolCallStreaming: true, + abortSignal, + onStepFinish: (stepResult: StepResult) => { + if (!isNaN(stepResult.usage.completionTokens) && !isNaN(stepResult.usage.promptTokens)) { + this.tokenUsageService?.recordTokenUsage(this.id, { + inputTokens: stepResult.usage.promptTokens, + outputTokens: stepResult.usage.completionTokens, + requestId: request.requestId + }); + } + }, + ...settings + }); + + const transformer = new VercelAiStreamTransformer( + fullStream, { cancellationToken, logger: this.logger } + ); + + return { + stream: transformer.transform() + }; + } + + protected processMessages(messages: LanguageModelMessage[]): Array { + return messages.map(message => { + const content = LanguageModelMessage.isTextMessage(message) ? message.text : ''; + let role: 'user' | 'assistant' | 'system'; + switch (message.actor) { + case 'user': + role = 'user'; + break; + case 'ai': + role = 'assistant'; + break; + case 'system': + role = 'system'; + break; + default: + role = 'user'; + } + return { + role, + content, + }; + }); + } +} diff --git a/packages/ai-vercel-ai.disabled/src/node/vercel-ai-language-models-manager-impl.ts b/packages/ai-vercel-ai.disabled/src/node/vercel-ai-language-models-manager-impl.ts new file mode 100644 index 0000000..fb68feb --- /dev/null +++ b/packages/ai-vercel-ai.disabled/src/node/vercel-ai-language-models-manager-impl.ts @@ -0,0 +1,115 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { LanguageModelRegistry, LanguageModelStatus, TokenUsageService } from '@theia/ai-core'; +import { inject, injectable, named } from '@theia/core/shared/inversify'; +import { VercelAiModel } from './vercel-ai-language-model'; +import { VercelAiLanguageModelsManager, VercelAiModelDescription } from '../common'; +import { ILogger } from '@theia/core'; +import { VercelAiLanguageModelFactory, VercelAiProvider, VercelAiProviderConfig } from './vercel-ai-language-model-factory'; + +@injectable() +export class VercelAiLanguageModelsManagerImpl implements VercelAiLanguageModelsManager { + + apiKey: string | undefined; + protected providerConfigs: Map = new Map(); + + @inject(LanguageModelRegistry) + protected readonly languageModelRegistry: LanguageModelRegistry; + + @inject(TokenUsageService) + protected readonly tokenUsageService: TokenUsageService; + + @inject(ILogger) @named('vercel-ai') + protected readonly logger: ILogger; + + @inject(VercelAiLanguageModelFactory) + protected readonly languageModelFactory: VercelAiLanguageModelFactory; + + // Triggered from frontend. In case you want to use the models on the backend + // without a frontend then call this yourself + protected calculateStatus(effectiveApiKey: string | undefined): LanguageModelStatus { + return effectiveApiKey + ? { status: 'ready' } + : { status: 'unavailable', message: 'No Vercel AI API key set' }; + } + + async createOrUpdateLanguageModels(...modelDescriptions: VercelAiModelDescription[]): Promise { + for (const modelDescription of modelDescriptions) { + this.logger.info(`Vercel AI: Creating or updating model ${modelDescription.id}`); + const model = await this.languageModelRegistry.getLanguageModel(modelDescription.id); + const provider = this.determineProvider(modelDescription); + const providerConfig = this.getProviderConfig(provider); + const effectiveApiKey = providerConfig.apiKey || this.apiKey; + const status = this.calculateStatus(effectiveApiKey); + + if (model) { + if (!(model instanceof VercelAiModel)) { + this.logger.warn(`Vercel AI: model ${modelDescription.id} is not a Vercel AI model`); + continue; + } + await this.languageModelRegistry.patchLanguageModel(modelDescription.id, { + model: modelDescription.model, + enableStreaming: modelDescription.enableStreaming, + url: modelDescription.url, + supportsStructuredOutput: modelDescription.supportsStructuredOutput, + status, + maxRetries: modelDescription.maxRetries + }); + this.providerConfigs.set(provider, providerConfig); + } else { + this.languageModelRegistry.addLanguageModels([ + new VercelAiModel( + modelDescription.id, + modelDescription.model, + status, + modelDescription.enableStreaming, + modelDescription.supportsStructuredOutput, + modelDescription.url, + this.logger, + this.languageModelFactory, + () => this.getProviderConfig(provider), + modelDescription.maxRetries, + this.tokenUsageService + ) + ]); + } + } + } + + removeLanguageModels(...modelIds: string[]): void { + this.languageModelRegistry.removeLanguageModels(modelIds); + } + + setProviderConfig(provider: VercelAiProvider, config: Partial): void { + const existingConfig = this.providerConfigs.get(provider) || { provider }; + this.providerConfigs.set(provider, { ...existingConfig, ...config }); + } + + private determineProvider(modelDescription: VercelAiModelDescription): VercelAiProvider { + // Use the provider from the model description or default to OpenAI + return modelDescription.provider || 'openai'; + } + + private getProviderConfig(provider: VercelAiProvider): VercelAiProviderConfig { + let config = this.providerConfigs.get(provider); + if (!config) { + config = { provider, apiKey: this.apiKey }; + this.providerConfigs.set(provider, config); + } + return config; + } +} diff --git a/packages/ai-vercel-ai.disabled/src/package.spec.ts b/packages/ai-vercel-ai.disabled/src/package.spec.ts new file mode 100644 index 0000000..93fb890 --- /dev/null +++ b/packages/ai-vercel-ai.disabled/src/package.spec.ts @@ -0,0 +1,27 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +/* note: this bogus test file is required so that + we are able to run mocha unit tests on this + package, without having any actual unit tests in it. + This way a coverage report will be generated, + showing 0% coverage, instead of no report. + This file can be removed once we have real unit + tests in place. */ + +describe('ai-vercel-ai package', () => { + it('support code coverage statistics', () => true); +}); diff --git a/packages/ai-vercel-ai.disabled/tsconfig.json b/packages/ai-vercel-ai.disabled/tsconfig.json new file mode 100644 index 0000000..cc75161 --- /dev/null +++ b/packages/ai-vercel-ai.disabled/tsconfig.json @@ -0,0 +1,25 @@ +{ + "extends": "../../configs/base.tsconfig", + "compilerOptions": { + "composite": true, + "rootDir": "src", + "outDir": "lib" + }, + "include": [ + "src" + ], + "references": [ + { + "path": "../ai-core" + }, + { + "path": "../core" + }, + { + "path": "../filesystem" + }, + { + "path": "../workspace" + } + ] +} \ No newline at end of file diff --git a/packages/bulk-edit/.eslintrc.js b/packages/bulk-edit/.eslintrc.js new file mode 100644 index 0000000..1308994 --- /dev/null +++ b/packages/bulk-edit/.eslintrc.js @@ -0,0 +1,10 @@ +/** @type {import('eslint').Linter.Config} */ +module.exports = { + extends: [ + '../../configs/build.eslintrc.json' + ], + parserOptions: { + tsconfigRootDir: __dirname, + project: 'tsconfig.json' + } +}; diff --git a/packages/bulk-edit/README.md b/packages/bulk-edit/README.md new file mode 100644 index 0000000..cab5516 --- /dev/null +++ b/packages/bulk-edit/README.md @@ -0,0 +1,31 @@ +
    + +
    + +theia-ext-logo + +

    ECLIPSE THEIA - BULK EDIT EXTENSION

    + +
    + +
    + +## Description + +The `@theia/bulk-edit` extension contributes a `Refactor Preview` widget to the application that displays WorkspaceEdits to end-users. + +## Additional Information + +- [API documentation for `@theia/bulk-edit`](https://eclipse-theia.github.io/theia/docs/next/modules/_theia_bulk-edit.html) +- [Theia - GitHub](https://github.com/eclipse-theia/theia) +- [Theia - Website](https://theia-ide.org/) + +## License + +- [Eclipse Public License 2.0](http://www.eclipse.org/legal/epl-2.0/) +- [一 (Secondary) GNU General Public License, version 2 with the GNU Classpath Exception](https://projects.eclipse.org/license/secondary-gpl-2.0-cp) + +## Trademark + +"Theia" is a trademark of the Eclipse Foundation + diff --git a/packages/bulk-edit/package.json b/packages/bulk-edit/package.json new file mode 100644 index 0000000..9a83dc6 --- /dev/null +++ b/packages/bulk-edit/package.json @@ -0,0 +1,53 @@ +{ + "name": "@theia/bulk-edit", + "version": "1.68.0", + "description": "Theia - Bulk Edit Extension", + "dependencies": { + "@theia/core": "1.68.0", + "@theia/editor": "1.68.0", + "@theia/filesystem": "1.68.0", + "@theia/monaco": "1.68.0", + "@theia/monaco-editor-core": "1.96.302", + "@theia/workspace": "1.68.0", + "tslib": "^2.6.2" + }, + "publishConfig": { + "access": "public" + }, + "theiaExtensions": [ + { + "frontend": "lib/browser/bulk-edit-frontend-module" + } + ], + "keywords": [ + "theia-extension" + ], + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "repository": { + "type": "git", + "url": "https://github.com/eclipse-theia/theia.git" + }, + "bugs": { + "url": "https://github.com/eclipse-theia/theia/issues" + }, + "homepage": "https://github.com/eclipse-theia/theia", + "files": [ + "lib", + "src" + ], + "scripts": { + "build": "theiaext build", + "clean": "theiaext clean", + "compile": "theiaext compile", + "lint": "theiaext lint", + "test": "theiaext test", + "watch": "theiaext watch" + }, + "devDependencies": { + "@theia/ext-scripts": "1.68.0" + }, + "nyc": { + "extends": "../../configs/nyc.json" + }, + "gitHead": "21358137e41342742707f660b8e222f940a27652" +} diff --git a/packages/bulk-edit/src/browser/bulk-edit-commands.ts b/packages/bulk-edit/src/browser/bulk-edit-commands.ts new file mode 100644 index 0000000..2c3b03b --- /dev/null +++ b/packages/bulk-edit/src/browser/bulk-edit-commands.ts @@ -0,0 +1,34 @@ +// ***************************************************************************** +// Copyright (C) 2021 SAP SE or an SAP affiliate company and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { codicon } from '@theia/core/lib/browser'; +import { Command } from '@theia/core/lib/common'; + +export namespace BulkEditCommands { + export const TOGGLE_VIEW: Command = { + id: 'bulk-edit:toggleView' + }; + + export const APPLY: Command = { + id: 'bulk-edit:apply', + iconClass: codicon('check') + }; + + export const DISCARD: Command = { + id: 'bulk-edit:discard', + iconClass: codicon('clear-all') + }; +} diff --git a/packages/bulk-edit/src/browser/bulk-edit-contribution.ts b/packages/bulk-edit/src/browser/bulk-edit-contribution.ts new file mode 100644 index 0000000..b25190a --- /dev/null +++ b/packages/bulk-edit/src/browser/bulk-edit-contribution.ts @@ -0,0 +1,119 @@ +// ***************************************************************************** +// Copyright (C) 2021 SAP SE or an SAP affiliate company and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { injectable, inject, optional, postConstruct } from '@theia/core/shared/inversify'; +import { Widget } from '@theia/core/lib/browser/widgets/widget'; +import { CommandRegistry } from '@theia/core/lib/common'; +import { AbstractViewContribution } from '@theia/core/lib/browser/shell/view-contribution'; +import { BulkEditCommands } from './bulk-edit-commands'; +import { MonacoBulkEditService } from '@theia/monaco/lib/browser/monaco-bulk-edit-service'; +import { TabBarToolbarContribution, TabBarToolbarRegistry } from '@theia/core/lib/browser/shell/tab-bar-toolbar'; +import { BulkEditTreeWidget, BULK_EDIT_TREE_WIDGET_ID, BULK_EDIT_WIDGET_NAME } from './bulk-edit-tree'; +import { QuickViewService } from '@theia/core/lib/browser'; +import { nls } from '@theia/core/lib/common/nls'; +import { ResourceEdit } from '@theia/monaco-editor-core/esm/vs/editor/browser/services/bulkEditService'; + +@injectable() +export class BulkEditContribution extends AbstractViewContribution implements TabBarToolbarContribution { + protected edits: ResourceEdit[]; + + @inject(QuickViewService) @optional() + protected override readonly quickView: QuickViewService; + + @inject(MonacoBulkEditService) + protected readonly bulkEditService: MonacoBulkEditService; + + constructor() { + super({ + widgetId: BULK_EDIT_TREE_WIDGET_ID, + widgetName: BULK_EDIT_WIDGET_NAME, + defaultWidgetOptions: { + area: 'bottom' + } + }); + } + + @postConstruct() + protected init(): void { + this.bulkEditService.setPreviewHandler((edits: ResourceEdit[]) => this.previewEdit(edits)); + } + + override registerCommands(registry: CommandRegistry): void { + super.registerCommands(registry); + this.quickView?.hideItem(BULK_EDIT_WIDGET_NAME); + + registry.registerCommand(BulkEditCommands.APPLY, { + isEnabled: widget => this.withWidget(widget, () => true), + isVisible: widget => this.withWidget(widget, () => true), + execute: widget => this.withWidget(widget, () => this.apply()) + }); + registry.registerCommand(BulkEditCommands.DISCARD, { + isEnabled: widget => this.withWidget(widget, () => true), + isVisible: widget => this.withWidget(widget, () => true), + execute: widget => this.withWidget(widget, () => this.discard()) + }); + } + + async registerToolbarItems(toolbarRegistry: TabBarToolbarRegistry): Promise { + toolbarRegistry.registerItem({ + id: BulkEditCommands.APPLY.id, + command: BulkEditCommands.APPLY.id, + tooltip: nls.localizeByDefault('Apply Refactoring'), + priority: 0, + }); + toolbarRegistry.registerItem({ + id: BulkEditCommands.DISCARD.id, + command: BulkEditCommands.DISCARD.id, + tooltip: nls.localizeByDefault('Discard Refactoring'), + priority: 1, + }); + } + + protected withWidget(widget: Widget | undefined = this.tryGetWidget(), cb: (bulkEdit: BulkEditTreeWidget) => T): T | false { + if (widget instanceof BulkEditTreeWidget) { + return cb(widget); + } + return false; + } + + private async previewEdit(edits: ResourceEdit[]): Promise { + const widget = await this.openView({ activate: true }); + + if (widget) { + this.edits = edits; + await widget.initModel(edits); + } + + return edits; + } + + private apply(): void { + if (this.edits) { + this.edits.forEach(edit => { + if (edit.metadata) { + edit.metadata.needsConfirmation = false; + } + }); + this.bulkEditService.apply(this.edits); + } + this.closeView(); + } + + private discard(): void { + this.edits = []; + this.closeView(); + } +} diff --git a/packages/bulk-edit/src/browser/bulk-edit-frontend-module.ts b/packages/bulk-edit/src/browser/bulk-edit-frontend-module.ts new file mode 100644 index 0000000..649256c --- /dev/null +++ b/packages/bulk-edit/src/browser/bulk-edit-frontend-module.ts @@ -0,0 +1,39 @@ +// ***************************************************************************** +// Copyright (C) 2021 SAP SE or an SAP affiliate company and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** +import { ContainerModule } from '@theia/core/shared/inversify'; +import { WidgetFactory } from '@theia/core/lib/browser/widget-manager'; +import { BulkEditTreeWidget, BULK_EDIT_TREE_WIDGET_ID, createBulkEditTreeWidget } from './bulk-edit-tree'; +import { FrontendApplicationContribution, LabelProviderContribution, bindViewContribution } from '@theia/core/lib/browser'; +import { BulkEditContribution } from './bulk-edit-contribution'; +import { TabBarToolbarContribution } from '@theia/core/lib/browser/shell/tab-bar-toolbar'; +import { BulkEditTreeLabelProvider } from './bulk-edit-tree-label-provider'; +import '../../src/browser/style/bulk-edit.css'; + +export default new ContainerModule(bind => { + bind(BulkEditTreeWidget).toDynamicValue(ctx => + createBulkEditTreeWidget(ctx.container) + ); + bind(WidgetFactory).toDynamicValue(context => ({ + id: BULK_EDIT_TREE_WIDGET_ID, + createWidget: () => context.container.get(BulkEditTreeWidget) + })); + bindViewContribution(bind, BulkEditContribution); + bind(FrontendApplicationContribution).toService(BulkEditContribution); + bind(TabBarToolbarContribution).toService(BulkEditContribution); + + bind(BulkEditTreeLabelProvider).toSelf().inSingletonScope(); + bind(LabelProviderContribution).toService(BulkEditTreeLabelProvider); +}); diff --git a/packages/bulk-edit/src/browser/bulk-edit-tree-label-provider.ts b/packages/bulk-edit/src/browser/bulk-edit-tree-label-provider.ts new file mode 100644 index 0000000..ccf29a6 --- /dev/null +++ b/packages/bulk-edit/src/browser/bulk-edit-tree-label-provider.ts @@ -0,0 +1,71 @@ +// ***************************************************************************** +// Copyright (C) 2021 SAP SE or an SAP affiliate company and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { injectable, inject } from '@theia/core/shared/inversify'; +import { LabelProvider, LabelProviderContribution, DidChangeLabelEvent } from '@theia/core/lib/browser/label-provider'; +import { BulkEditInfoNode } from './bulk-edit-tree'; +import { TreeLabelProvider } from '@theia/core/lib/browser/tree/tree-label-provider'; +import { WorkspaceService } from '@theia/workspace/lib/browser'; + +@injectable() +export class BulkEditTreeLabelProvider implements LabelProviderContribution { + + @inject(LabelProvider) + protected readonly labelProvider: LabelProvider; + + @inject(TreeLabelProvider) + protected readonly treeLabelProvider: TreeLabelProvider; + + @inject(WorkspaceService) + protected readonly workspaceService: WorkspaceService; + + canHandle(element: object): number { + return BulkEditInfoNode.is(element) ? + this.treeLabelProvider.canHandle(element) + 1 : + 0; + } + + getIcon(node: BulkEditInfoNode): string { + return this.labelProvider.getIcon(node.uri); + } + + getName(node: BulkEditInfoNode): string { + return this.labelProvider.getName(node.uri); + } + + getLongName(node: BulkEditInfoNode): string { + const description: string[] = []; + const rootUri = this.workspaceService.getWorkspaceRootUri(node.uri); + // In a multiple-root workspace include the root name to the label before the parent directory. + if (this.workspaceService.isMultiRootWorkspaceOpened && rootUri) { + description.push(this.labelProvider.getName(rootUri)); + } + // If the given resource is not at the workspace root, include the parent directory to the label. + if (rootUri?.toString() !== node.uri.parent.toString()) { + description.push(this.labelProvider.getLongName(node.uri.parent)); + } + return description.join(' ● '); + } + + getDescription(node: BulkEditInfoNode): string { + return this.labelProvider.getLongName(node.uri.parent); + } + + affects(node: BulkEditInfoNode, event: DidChangeLabelEvent): boolean { + return event.affects(node.uri) || event.affects(node.uri.parent); + } + +} diff --git a/packages/bulk-edit/src/browser/bulk-edit-tree/bulk-edit-node-selection.ts b/packages/bulk-edit/src/browser/bulk-edit-tree/bulk-edit-node-selection.ts new file mode 100644 index 0000000..f0f1555 --- /dev/null +++ b/packages/bulk-edit/src/browser/bulk-edit-tree/bulk-edit-node-selection.ts @@ -0,0 +1,44 @@ +// ***************************************************************************** +// Copyright (C) 2021 SAP SE or an SAP affiliate company and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { SelectionService } from '@theia/core/lib/common/selection-service'; +import { SelectionCommandHandler } from '@theia/core/lib/common/selection-command-handler'; +import { ResourceFileEdit, ResourceTextEdit } from '@theia/monaco-editor-core/esm/vs/editor/browser/services/bulkEditService'; +import { isObject } from '@theia/core/lib/common'; + +export interface BulkEditNodeSelection { + bulkEdit: ResourceFileEdit | ResourceTextEdit; +} +export namespace BulkEditNodeSelection { + export function is(arg: unknown): arg is BulkEditNodeSelection { + return isObject(arg) && 'bulkEdit' in arg; + } + + export class CommandHandler extends SelectionCommandHandler { + + constructor( + protected override readonly selectionService: SelectionService, + protected override readonly options: SelectionCommandHandler.Options + ) { + super( + selectionService, + arg => BulkEditNodeSelection.is(arg) ? arg : undefined, + options + ); + } + } + +} diff --git a/packages/bulk-edit/src/browser/bulk-edit-tree/bulk-edit-tree-container.ts b/packages/bulk-edit/src/browser/bulk-edit-tree/bulk-edit-tree-container.ts new file mode 100644 index 0000000..f00a32d --- /dev/null +++ b/packages/bulk-edit/src/browser/bulk-edit-tree/bulk-edit-tree-container.ts @@ -0,0 +1,35 @@ +// ***************************************************************************** +// Copyright (C) 2021 SAP SE or an SAP affiliate company and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { interfaces, Container } from '@theia/core/shared/inversify'; +import { BulkEditTreeWidget } from './bulk-edit-tree-widget'; +import { BulkEditTree } from './bulk-edit-tree'; +import { BulkEditTreeModel } from './bulk-edit-tree-model'; +import { createTreeContainer } from '@theia/core/lib/browser'; + +export function createBulkEditContainer(parent: interfaces.Container): Container { + const child = createTreeContainer(parent, { + tree: BulkEditTree, + widget: BulkEditTreeWidget, + model: BulkEditTreeModel, + }); + + return child; +} + +export function createBulkEditTreeWidget(parent: interfaces.Container): BulkEditTreeWidget { + return createBulkEditContainer(parent).get(BulkEditTreeWidget); +} diff --git a/packages/bulk-edit/src/browser/bulk-edit-tree/bulk-edit-tree-model.ts b/packages/bulk-edit/src/browser/bulk-edit-tree/bulk-edit-tree-model.ts new file mode 100644 index 0000000..9db3bb6 --- /dev/null +++ b/packages/bulk-edit/src/browser/bulk-edit-tree/bulk-edit-tree-model.ts @@ -0,0 +1,42 @@ +// ***************************************************************************** +// Copyright (C) 2021 SAP SE or an SAP affiliate company and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { injectable, inject } from '@theia/core/shared/inversify'; +import { BulkEditNode, BulkEditTree } from './bulk-edit-tree'; +import { TreeModelImpl, OpenerService, open, TreeNode } from '@theia/core/lib/browser'; +import { ResourceEdit } from '@theia/monaco-editor-core/esm/vs/editor/browser/services/bulkEditService'; + +@injectable() +export class BulkEditTreeModel extends TreeModelImpl { + @inject(BulkEditTree) protected override readonly tree: BulkEditTree; + @inject(OpenerService) protected readonly openerService: OpenerService; + + protected override doOpenNode(node: TreeNode): void { + if (BulkEditNode.is(node)) { + open(this.openerService, node.uri, undefined); + } else { + super.doOpenNode(node); + } + } + + revealNode(node: TreeNode): void { + this.doOpenNode(node); + } + + async initModel(edits: ResourceEdit[], fileContents: Map): Promise { + this.tree.initTree(edits, fileContents); + } +} diff --git a/packages/bulk-edit/src/browser/bulk-edit-tree/bulk-edit-tree-widget.tsx b/packages/bulk-edit/src/browser/bulk-edit-tree/bulk-edit-tree-widget.tsx new file mode 100644 index 0000000..ff4bd3a --- /dev/null +++ b/packages/bulk-edit/src/browser/bulk-edit-tree/bulk-edit-tree-widget.tsx @@ -0,0 +1,231 @@ +// ***************************************************************************** +// Copyright (C) 2021 SAP SE or an SAP affiliate company and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { injectable, inject, optional } from '@theia/core/shared/inversify'; +import { + DiffUris, TreeWidget, TreeProps, ContextMenuRenderer, TreeNode, TreeModel, + CompositeTreeNode, NodeProps, QuickViewService +} from '@theia/core/lib/browser'; +import * as React from '@theia/core/shared/react'; +import { BulkEditInfoNode, BulkEditNode } from './bulk-edit-tree'; +import { BulkEditTreeModel } from './bulk-edit-tree-model'; +import { FileResourceResolver } from '@theia/filesystem/lib/browser'; +import URI from '@theia/core/lib/common/uri'; +import { EditorWidget, EditorManager, EditorOpenerOptions } from '@theia/editor/lib/browser'; +import { MEMORY_TEXT } from '@theia/core/lib/common'; +import { Disposable } from '@theia/core/lib/common/disposable'; +import { nls } from '@theia/core/lib/common/nls'; +import { ResourceEdit, ResourceFileEdit, ResourceTextEdit } from '@theia/monaco-editor-core/esm/vs/editor/browser/services/bulkEditService'; + +export const BULK_EDIT_TREE_WIDGET_ID = 'bulkedit'; +export const BULK_EDIT_WIDGET_NAME = nls.localizeByDefault('Refactor Preview'); + +@injectable() +export class BulkEditTreeWidget extends TreeWidget { + private editorWidgets: EditorWidget[] = []; + + @inject(FileResourceResolver) + protected readonly fileResourceResolver: FileResourceResolver; + + @inject(EditorManager) + protected readonly editorManager: EditorManager; + + @inject(QuickViewService) @optional() + protected readonly quickView: QuickViewService; + + constructor( + @inject(TreeProps) readonly treeProps: TreeProps, + @inject(BulkEditTreeModel) override readonly model: BulkEditTreeModel, + @inject(ContextMenuRenderer) override readonly contextMenuRenderer: ContextMenuRenderer + ) { + super(treeProps, model, contextMenuRenderer); + + this.id = BULK_EDIT_TREE_WIDGET_ID; + this.title.label = BULK_EDIT_WIDGET_NAME; + this.title.caption = BULK_EDIT_WIDGET_NAME; + this.title.closable = true; + this.addClass('theia-bulk-edit-container'); + + this.toDispose.push(Disposable.create(() => { + this.disposeEditors(); + })); + } + + async initModel(edits: ResourceEdit[]): Promise { + await this.model.initModel(edits, await this.getFileContentsMap(edits)); + this.quickView?.showItem(BULK_EDIT_WIDGET_NAME); + } + + protected override tapNode(node?: TreeNode): void { + super.tapNode(node); + if (BulkEditNode.is(node)) { + this.doOpen(node); + } + } + + protected override handleDown(event: KeyboardEvent): void { + const node = this.model.getNextSelectableNode(); + super.handleDown(event); + if (BulkEditNode.is(node)) { + this.doOpen(node); + } + } + + protected override handleUp(event: KeyboardEvent): void { + const node = this.model.getPrevSelectableNode(); + super.handleUp(event); + if (BulkEditNode.is(node)) { + this.doOpen(node); + } + } + + protected override renderTree(model: TreeModel): React.ReactNode { + if (CompositeTreeNode.is(model.root) && model.root.children.length > 0) { + return super.renderTree(model); + } + return
    {nls.localizeByDefault('Made no edits')}
    ; + } + + protected override renderCaption(node: TreeNode, props: NodeProps): React.ReactNode { + if (BulkEditInfoNode.is(node)) { + return this.decorateBulkEditInfoNode(node); + } else if (BulkEditNode.is(node)) { + return this.decorateBulkEditNode(node); + } + return 'caption'; + } + + protected decorateBulkEditNode(node: BulkEditNode): React.ReactNode { + if (node?.parent && node?.bulkEdit && ('textEdit' in node?.bulkEdit)) { + const bulkEdit = node.bulkEdit; + const parent = node.parent as BulkEditInfoNode; + + if (parent?.fileContents) { + const lines = parent.fileContents.split('\n'); + const startLineNum = +bulkEdit.textEdit?.range?.startLineNumber; + + if (lines.length > startLineNum) { + const startColumn = +bulkEdit.textEdit.range.startColumn; + const endColumn = +bulkEdit.textEdit.range.endColumn; + const lineText = lines[startLineNum - 1]; + const beforeMatch = (startColumn > 26 ? '... ' : '') + lineText.substring(0, startColumn - 1).slice(-25); + const replacedText = lineText.substring(startColumn - 1, endColumn - 1); + const afterMatch = lineText.substring(startColumn - 1 + replacedText.length, startColumn - 1 + replacedText.length + 75); + + return
    +
    + {beforeMatch} + {replacedText} + {bulkEdit.textEdit.text} + {afterMatch} +
    +
    ; + } + } + } + } + + protected decorateBulkEditInfoNode(node: BulkEditInfoNode): React.ReactNode { + const icon = this.toNodeIcon(node); + const name = this.toNodeName(node); + const description = this.toNodeDescription(node); + const path = this.labelProvider.getLongName(node.uri.withScheme('bulkedit')); + return
    + {icon &&
    } +
    {name}
    +
    {description}
    +
    ; + } + + private async getFileContentsMap(edits: ResourceEdit[]): Promise> { + const fileContentMap = new Map(); + + if (edits) { + for (const element of edits) { + if (element) { + const filePath = (('newResource' in element) && (element as ResourceFileEdit).newResource?.path) || + (('resource' in element) && (element as ResourceTextEdit).resource.path); + + if (filePath && !fileContentMap.has(filePath)) { + const fileUri = new URI(filePath).withScheme('file'); + const resource = await this.fileResourceResolver.resolve(fileUri); + fileContentMap.set(filePath, await resource.readContents()); + } + } + } + } + return fileContentMap; + } + + private async doOpen(node: BulkEditNode): Promise { + if (node && node.parent && node.bulkEdit && ('edit' in node.bulkEdit)) { + const resultNode = node.parent as BulkEditInfoNode; + const leftUri = node.uri; + const rightUri = await this.createReplacePreview(resultNode); + const diffUri = DiffUris.encode(leftUri, rightUri); + const editorWidget = await this.editorManager.open(diffUri, this.getEditorOptions(node)); + this.editorWidgets.push(editorWidget); + } + } + + private async createReplacePreview(bulkEditInfoNode: BulkEditInfoNode): Promise { + const fileUri = bulkEditInfoNode.uri; + let lines: string[] = []; + if (bulkEditInfoNode?.fileContents) { + lines = bulkEditInfoNode.fileContents.split('\n'); + bulkEditInfoNode.children.map((node: BulkEditNode) => { + if (node.bulkEdit && ('textEdit' in node.bulkEdit)) { + const startLineNum = node.bulkEdit.textEdit.range.startLineNumber; + if (lines.length > startLineNum) { + const startColumn = node.bulkEdit.textEdit.range.startColumn; + const endColumn = node.bulkEdit.textEdit.range.endColumn; + const lineText = lines[startLineNum - 1]; + const beforeMatch = lineText.substring(0, startColumn - 1); + const replacedText = lineText.substring(startColumn - 1, endColumn - 1); + const afterMatch = lineText.substring(startColumn - 1 + replacedText.length); + lines[startLineNum - 1] = beforeMatch + node.bulkEdit.textEdit.text + afterMatch; + } + } + }); + } + + return fileUri.withScheme(MEMORY_TEXT).withQuery(lines.join('\n')); + } + + private getEditorOptions(node: BulkEditNode): EditorOpenerOptions { + let options = {}; + if (('textEdit' in node.bulkEdit) && node?.bulkEdit?.textEdit?.range) { + options = { + selection: { + start: { + line: node.bulkEdit.textEdit.range.startLineNumber - 1, + character: node.bulkEdit.textEdit.range.startColumn - 1 + }, + end: { + line: node.bulkEdit.textEdit.range.endLineNumber - 1, + character: node.bulkEdit.textEdit.range.endColumn - 1 + } + } + }; + } + return options; + } + + private disposeEditors(): void { + this.editorWidgets.forEach(w => w.dispose()); + this.quickView?.hideItem(BULK_EDIT_WIDGET_NAME); + } +} diff --git a/packages/bulk-edit/src/browser/bulk-edit-tree/bulk-edit-tree.spec.ts b/packages/bulk-edit/src/browser/bulk-edit-tree/bulk-edit-tree.spec.ts new file mode 100644 index 0000000..3f9e315 --- /dev/null +++ b/packages/bulk-edit/src/browser/bulk-edit-tree/bulk-edit-tree.spec.ts @@ -0,0 +1,73 @@ +// ***************************************************************************** +// Copyright (C) 2021 SAP SE or an SAP affiliate company and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { enableJSDOM } from '@theia/core/lib/browser/test/jsdom'; +import * as chai from 'chai'; +import { ResourceTextEdit } from '@theia/monaco-editor-core/esm/vs/editor/browser/services/bulkEditService'; +import { URI as Uri } from '@theia/core/shared/vscode-uri'; + +let disableJSDOM = enableJSDOM(); + +import { FrontendApplicationConfigProvider } from '@theia/core/lib/browser/frontend-application-config-provider'; +FrontendApplicationConfigProvider.set({}); + +import { Container } from '@theia/core/shared/inversify'; +import { BulkEditInfoNode, BulkEditTree } from './bulk-edit-tree'; + +const expect = chai.expect; +let bulkEditTree: BulkEditTree; +let testContainer: Container; +const fileContextsMap = new Map(); +let resourceTextEdits: ResourceTextEdit[]; + +disableJSDOM(); + +before(() => { + disableJSDOM = enableJSDOM(); + + testContainer = new Container(); + testContainer.bind(BulkEditTree).toSelf(); + bulkEditTree = testContainer.get(BulkEditTree); + + fileContextsMap.set('/c:/test1.ts', 'aaaaaaaaaaaaaaaaaaa'); + fileContextsMap.set('/c:/test2.ts', 'bbbbbbbbbbbbbbbbbbb'); + + resourceTextEdits = [ + { + 'resource': Uri.file('c:/test1.ts'), + 'textEdit': { + 'text': 'AAAAA', 'range': { 'startLineNumber': 1, 'startColumn': 5, 'endLineNumber': 1, 'endColumn': 10 } + } + }, + { + 'resource': Uri.file('c:/test2.ts'), + 'textEdit': { + 'text': 'BBBBBB', 'range': { 'startLineNumber': 1, 'startColumn': 3, 'endLineNumber': 1, 'endColumn': 8 } + } + } + ]; +}); + +after(() => { + disableJSDOM(); +}); + +describe('bulk-edit-tree', () => { + it('initialize tree', () => { + bulkEditTree.initTree(resourceTextEdits, fileContextsMap); + expect((bulkEditTree.root as BulkEditInfoNode).children.length).is.equal(2); + }); +}); diff --git a/packages/bulk-edit/src/browser/bulk-edit-tree/bulk-edit-tree.ts b/packages/bulk-edit/src/browser/bulk-edit-tree/bulk-edit-tree.ts new file mode 100644 index 0000000..b44e0bb --- /dev/null +++ b/packages/bulk-edit/src/browser/bulk-edit-tree/bulk-edit-tree.ts @@ -0,0 +1,114 @@ +// ***************************************************************************** +// Copyright (C) 2021 SAP SE or an SAP affiliate company and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { injectable } from '@theia/core/shared/inversify'; +import { TreeNode, CompositeTreeNode, SelectableTreeNode, ExpandableTreeNode, TreeImpl } from '@theia/core/lib/browser'; +import { UriSelection } from '@theia/core/lib/common/selection'; +import { BulkEditNodeSelection } from './bulk-edit-node-selection'; +import URI from '@theia/core/lib/common/uri'; +import { ResourceFileEdit, ResourceTextEdit } from '@theia/monaco/lib/browser/monaco-workspace'; +import { + ResourceEdit, ResourceFileEdit as MonacoResourceFileEdit, ResourceTextEdit as MonacoResourceTextEdit +} from '@theia/monaco-editor-core/esm/vs/editor/browser/services/bulkEditService'; + +@injectable() +export class BulkEditTree extends TreeImpl { + public async initTree(edits: ResourceEdit[], fileContents: Map): Promise { + this.root = { + visible: false, + id: 'theia-bulk-edit-tree-widget', + name: 'BulkEditTree', + children: this.getChildren(edits, fileContents), + parent: undefined + }; + } + + private getChildren(edits: ResourceEdit[], fileContentsMap: Map): BulkEditInfoNode[] { + let bulkEditInfos: BulkEditInfoNode[] = []; + if (edits) { + bulkEditInfos = edits + .map(edit => this.getResourcePath(edit)) + .filter((path, index, arr) => path && arr.indexOf(path) === index) + .map((path: string) => this.createBulkEditInfo(path, new URI(path), fileContentsMap.get(path))) + .filter(Boolean); + + if (bulkEditInfos.length > 0) { + bulkEditInfos.forEach(editInfo => { + editInfo.children = edits.filter(edit => + ((('resource' in edit) && (edit as MonacoResourceTextEdit)?.resource?.path === editInfo.id)) || + (('newResource' in edit) && (edit as MonacoResourceFileEdit)?.newResource?.path === editInfo.id)) + .map((edit, index) => this.createBulkEditNode(('resource' in edit ? edit as MonacoResourceTextEdit : + edit as MonacoResourceFileEdit), index, editInfo)); + }); + } + } + return bulkEditInfos; + } + + private createBulkEditNode(bulkEdit: MonacoResourceFileEdit | MonacoResourceTextEdit, index: number, parent: BulkEditInfoNode): BulkEditNode { + const id = parent.id + '_' + index; + const existing = this.getNode(id); + if (BulkEditNode.is(existing)) { + existing.bulkEdit = bulkEdit; + return existing; + } + return { + id, + name: 'bulkEdit', + parent, + selected: false, + uri: parent.uri, + bulkEdit + }; + } + + private createBulkEditInfo(id: string, uri: URI, fileContents: string | undefined): BulkEditInfoNode { + return { + id, + uri, + expanded: true, + selected: false, + parent: this.root as BulkEditInfoNode, + fileContents, + children: [] + }; + } + + private getResourcePath(edit: ResourceEdit): string | undefined { + return ResourceTextEdit.is(edit) ? edit.resource.path : + ResourceFileEdit.is(edit) && edit.newResource ? edit.newResource.path : undefined; + } +} + +export interface BulkEditNode extends UriSelection, SelectableTreeNode { + parent: CompositeTreeNode; + bulkEdit: MonacoResourceFileEdit | MonacoResourceTextEdit; +} +export namespace BulkEditNode { + export function is(node: TreeNode | undefined): node is BulkEditNode { + return UriSelection.is(node) && SelectableTreeNode.is(node) && BulkEditNodeSelection.is(node); + } +} + +export interface BulkEditInfoNode extends UriSelection, SelectableTreeNode, ExpandableTreeNode { + parent: CompositeTreeNode; + fileContents?: string; +} +export namespace BulkEditInfoNode { + export function is(node: unknown): node is BulkEditInfoNode { + return ExpandableTreeNode.is(node) && UriSelection.is(node) && 'fileContents' in node; + } +} diff --git a/packages/bulk-edit/src/browser/bulk-edit-tree/index.ts b/packages/bulk-edit/src/browser/bulk-edit-tree/index.ts new file mode 100644 index 0000000..af52817 --- /dev/null +++ b/packages/bulk-edit/src/browser/bulk-edit-tree/index.ts @@ -0,0 +1,21 @@ +// ***************************************************************************** +// Copyright (C) 2021 SAP SE or an SAP affiliate company and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +export * from './bulk-edit-tree'; +export * from './bulk-edit-tree-model'; +export * from './bulk-edit-node-selection'; +export * from './bulk-edit-tree-widget'; +export * from './bulk-edit-tree-container'; diff --git a/packages/bulk-edit/src/browser/style/bulk-edit.css b/packages/bulk-edit/src/browser/style/bulk-edit.css new file mode 100644 index 0000000..1c9969d --- /dev/null +++ b/packages/bulk-edit/src/browser/style/bulk-edit.css @@ -0,0 +1,66 @@ +/******************************************************************************** + * Copyright (c) 2021 SAP SE or an SAP affiliate company and others. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the Eclipse + * Public License v. 2.0 are satisfied: GNU General Public License, version 2 + * with the GNU Classpath Exception which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 + ********************************************************************************/ + +.theia-bulk-edit-container { + font-size: var(--theia-ui-font-size1); +} + +.theia-bulk-edit-container .bulkEditNode, +.theia-bulk-edit-container .bulkEditInfoNode { + display: flex; + align-items: center; +} + +.theia-bulk-edit-container .bulkEditNode, +.theia-bulk-edit-container .bulkEditInfoNode { + width: calc(100% - 32px); +} + +.theia-bulk-edit-container .bulkEditNode div, +.theia-bulk-edit-container .bulkEditInfoNode div { + margin-right: 5px; +} + +.theia-bulk-edit-container .bulkEditInfoNode .name, +.theia-bulk-edit-container .bulkEditInfoNode .path { + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + +.theia-bulk-edit-container .bulkEditInfoNode .path { + font-size: var(--theia-ui-font-size0); + color: var(--theia-descriptionForeground); + align-self: flex-end; + white-space: nowrap; +} + +.theia-bulk-edit-container .bulkEditNode .message { + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} + +.theia-bulk-edit-container .bulkEditNode .message .replaced-text { + text-decoration: line-through; + background: var(--theia-diffEditor-removedTextBackground); + border-color: var(--theia-diffEditor-removedTextBorder); +} + +.theia-bulk-edit-container .bulkEditNode .message .inserted-text { + background: var(--theia-diffEditor-insertedTextBackground); + border: 1px solid var(--theia-diffEditor-insertedTextBorder); +} diff --git a/packages/bulk-edit/tsconfig.json b/packages/bulk-edit/tsconfig.json new file mode 100644 index 0000000..5920c2d --- /dev/null +++ b/packages/bulk-edit/tsconfig.json @@ -0,0 +1,28 @@ +{ + "extends": "../../configs/base.tsconfig", + "compilerOptions": { + "composite": true, + "rootDir": "src", + "outDir": "lib" + }, + "include": [ + "src" + ], + "references": [ + { + "path": "../core" + }, + { + "path": "../editor" + }, + { + "path": "../filesystem" + }, + { + "path": "../monaco" + }, + { + "path": "../workspace" + } + ] +} diff --git a/packages/callhierarchy/.eslintrc.js b/packages/callhierarchy/.eslintrc.js new file mode 100644 index 0000000..1308994 --- /dev/null +++ b/packages/callhierarchy/.eslintrc.js @@ -0,0 +1,10 @@ +/** @type {import('eslint').Linter.Config} */ +module.exports = { + extends: [ + '../../configs/build.eslintrc.json' + ], + parserOptions: { + tsconfigRootDir: __dirname, + project: 'tsconfig.json' + } +}; diff --git a/packages/callhierarchy/README.md b/packages/callhierarchy/README.md new file mode 100644 index 0000000..0c6a79d --- /dev/null +++ b/packages/callhierarchy/README.md @@ -0,0 +1,31 @@ +
    + +
    + +theia-ext-logo + +

    ECLIPSE THEIA - CALL HIERARCHY EXTENSION

    + +
    + +
    + +## Description + +The `@theia/callhierarchy` extension contributes a `call hierarchy` view which displays the caller hierarchy for a selected callable. + +## Additional Information + +- [API documentation for `@theia/callhierarchy`](https://eclipse-theia.github.io/theia/docs/next/modules/_theia_callhierarchy.html) +- [Theia - GitHub](https://github.com/eclipse-theia/theia) +- [Theia - Website](https://theia-ide.org/) + +## License + +- [Eclipse Public License 2.0](http://www.eclipse.org/legal/epl-2.0/) +- [一 (Secondary) GNU General Public License, version 2 with the GNU Classpath Exception](https://projects.eclipse.org/license/secondary-gpl-2.0-cp) + +## Trademark + +"Theia" is a trademark of the Eclipse Foundation + diff --git a/packages/callhierarchy/package.json b/packages/callhierarchy/package.json new file mode 100644 index 0000000..2c0b2d4 --- /dev/null +++ b/packages/callhierarchy/package.json @@ -0,0 +1,50 @@ +{ + "name": "@theia/callhierarchy", + "version": "1.68.0", + "description": "Theia - Call Hierarchy Extension", + "dependencies": { + "@theia/core": "1.68.0", + "@theia/editor": "1.68.0", + "ts-md5": "^1.2.2", + "tslib": "^2.6.2" + }, + "publishConfig": { + "access": "public" + }, + "theiaExtensions": [ + { + "frontend": "lib/browser/callhierarchy-frontend-module" + } + ], + "keywords": [ + "theia-extension" + ], + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "repository": { + "type": "git", + "url": "https://github.com/eclipse-theia/theia.git" + }, + "bugs": { + "url": "https://github.com/eclipse-theia/theia/issues" + }, + "homepage": "https://github.com/eclipse-theia/theia", + "files": [ + "lib", + "src" + ], + "scripts": { + "build": "theiaext build", + "clean": "theiaext clean", + "compile": "theiaext compile", + "lint": "theiaext lint", + "test": "theiaext test", + "watch": "theiaext watch" + }, + "devDependencies": { + "@theia/ext-scripts": "1.68.0" + }, + "nyc": { + "extends": "../../configs/nyc.json" + }, + "gitHead": "21358137e41342742707f660b8e222f940a27652" +} diff --git a/packages/callhierarchy/src/browser/callhierarchy-contribution.ts b/packages/callhierarchy/src/browser/callhierarchy-contribution.ts new file mode 100644 index 0000000..bd37b1b --- /dev/null +++ b/packages/callhierarchy/src/browser/callhierarchy-contribution.ts @@ -0,0 +1,103 @@ +// ***************************************************************************** +// Copyright (C) 2018 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { injectable, inject, postConstruct } from '@theia/core/shared/inversify'; +import { MenuModelRegistry, Command, CommandRegistry } from '@theia/core/lib/common'; +import { AbstractViewContribution, OpenViewArguments, KeybindingRegistry } from '@theia/core/lib/browser'; +import { EDITOR_CONTEXT_MENU, CurrentEditorAccess, EditorManager } from '@theia/editor/lib/browser'; +import { CallHierarchyTreeWidget } from './callhierarchy-tree/callhierarchy-tree-widget'; +import { CALLHIERARCHY_ID, CALL_HIERARCHY_LABEL, CALL_HIERARCHY_TOGGLE_COMMAND_ID } from './callhierarchy'; +import { CallHierarchyServiceProvider } from './callhierarchy-service'; +import URI from '@theia/core/lib/common/uri'; +import { ContextKey, ContextKeyService } from '@theia/core/lib/browser/context-key-service'; +export { CALL_HIERARCHY_LABEL, CALL_HIERARCHY_TOGGLE_COMMAND_ID }; + +export namespace CallHierarchyCommands { + export const OPEN = Command.toLocalizedCommand({ + id: 'callhierarchy:open', + label: 'Open Call Hierarchy' + }, 'theia/callhierarchy/open'); +} + +@injectable() +export class CallHierarchyContribution extends AbstractViewContribution { + + @inject(CurrentEditorAccess) protected readonly editorAccess: CurrentEditorAccess; + @inject(EditorManager) protected readonly editorManager: EditorManager; + @inject(CallHierarchyServiceProvider) protected readonly callHierarchyServiceProvider: CallHierarchyServiceProvider; + @inject(ContextKeyService) protected readonly contextKeyService: ContextKeyService; + + protected editorHasCallHierarchyProvider!: ContextKey; + + constructor() { + super({ + widgetId: CALLHIERARCHY_ID, + widgetName: CALL_HIERARCHY_LABEL, + defaultWidgetOptions: { + area: 'bottom' + }, + toggleCommandId: CALL_HIERARCHY_TOGGLE_COMMAND_ID, + toggleKeybinding: 'ctrlcmd+shift+f1' + }); + } + + @postConstruct() + protected init(): void { + this.editorHasCallHierarchyProvider = this.contextKeyService.createKey('editorHasCallHierarchyProvider', false); + this.editorManager.onCurrentEditorChanged(() => this.editorHasCallHierarchyProvider.set(this.isCallHierarchyAvailable())); + this.callHierarchyServiceProvider.onDidChange(() => this.editorHasCallHierarchyProvider.set(this.isCallHierarchyAvailable())); + } + + protected isCallHierarchyAvailable(): boolean { + const { selection, languageId } = this.editorAccess; + return !!selection && !!languageId && !!this.callHierarchyServiceProvider.get(languageId, new URI(selection.uri)); + } + + override async openView(args?: Partial): Promise { + const widget = await super.openView(args); + const { selection, languageId } = this.editorAccess; + widget.initializeModel(selection, languageId); + return widget; + } + + override registerCommands(commands: CommandRegistry): void { + commands.registerCommand(CallHierarchyCommands.OPEN, { + execute: () => this.openView({ + toggle: false, + activate: true + }), + isEnabled: this.isCallHierarchyAvailable.bind(this) + }); + super.registerCommands(commands); + } + + override registerMenus(menus: MenuModelRegistry): void { + const menuPath = [...EDITOR_CONTEXT_MENU, 'navigation']; + menus.registerMenuAction(menuPath, { + commandId: CallHierarchyCommands.OPEN.id, + label: CALL_HIERARCHY_LABEL + }); + super.registerMenus(menus); + } + + override registerKeybindings(keybindings: KeybindingRegistry): void { + super.registerKeybindings(keybindings); + keybindings.registerKeybinding({ + command: CallHierarchyCommands.OPEN.id, + keybinding: 'ctrlcmd+f1' + }); + } +} diff --git a/packages/callhierarchy/src/browser/callhierarchy-frontend-module.ts b/packages/callhierarchy/src/browser/callhierarchy-frontend-module.ts new file mode 100644 index 0000000..80b1c16 --- /dev/null +++ b/packages/callhierarchy/src/browser/callhierarchy-frontend-module.ts @@ -0,0 +1,37 @@ +// ***************************************************************************** +// Copyright (C) 2018 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { CallHierarchyContribution } from './callhierarchy-contribution'; +import { bindContributionProvider } from '@theia/core/lib/common'; +import { CallHierarchyService, CallHierarchyServiceProvider } from './callhierarchy-service'; +import { WidgetFactory, bindViewContribution } from '@theia/core/lib/browser'; +import { CALLHIERARCHY_ID } from './callhierarchy'; +import { createHierarchyTreeWidget } from './callhierarchy-tree'; +import { ContainerModule } from '@theia/core/shared/inversify'; + +import '../../src/browser/style/index.css'; + +export default new ContainerModule(bind => { + bindContributionProvider(bind, CallHierarchyService); + bind(CallHierarchyServiceProvider).to(CallHierarchyServiceProvider).inSingletonScope(); + + bindViewContribution(bind, CallHierarchyContribution); + + bind(WidgetFactory).toDynamicValue(context => ({ + id: CALLHIERARCHY_ID, + createWidget: () => createHierarchyTreeWidget(context.container) + })); +}); diff --git a/packages/callhierarchy/src/browser/callhierarchy-service.ts b/packages/callhierarchy/src/browser/callhierarchy-service.ts new file mode 100644 index 0000000..1babd23 --- /dev/null +++ b/packages/callhierarchy/src/browser/callhierarchy-service.ts @@ -0,0 +1,89 @@ +// ***************************************************************************** +// Copyright (C) 2018 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { injectable, inject, named, postConstruct } from '@theia/core/shared/inversify'; +import { Position, DocumentUri } from '@theia/core/shared/vscode-languageserver-protocol'; +import { CancellationToken } from '@theia/core'; +import URI from '@theia/core/lib/common/uri'; +import { ContributionProvider, Disposable, Emitter, Event } from '@theia/core/lib/common'; +import { CallHierarchyItem, CallHierarchyIncomingCall, CallHierarchyOutgoingCall } from './callhierarchy'; +import { LanguageSelector, score } from '@theia/editor/lib/common/language-selector'; + +export const CallHierarchyService = Symbol('CallHierarchyService'); + +export interface CallHierarchySession { + items: CallHierarchyItem[]; + dispose(): void; +} + +export interface CallHierarchyService { + + readonly selector: LanguageSelector; + + getRootDefinition(uri: DocumentUri, position: Position, cancellationToken: CancellationToken): Promise + getCallers(definition: CallHierarchyItem, cancellationToken: CancellationToken): Promise + getCallees?(definition: CallHierarchyItem, cancellationToken: CancellationToken): Promise +} + +@injectable() +export class CallHierarchyServiceProvider { + + @inject(ContributionProvider) @named(CallHierarchyService) + protected readonly contributions: ContributionProvider; + + protected readonly onDidChangeEmitter = new Emitter(); + get onDidChange(): Event { + return this.onDidChangeEmitter.event; + } + + private services: CallHierarchyService[] = []; + + @postConstruct() + init(): void { + this.services = this.services.concat(this.contributions.getContributions()); + } + + get(languageId: string, uri: URI): CallHierarchyService | undefined { + return this.services + .filter(service => this.score(service, languageId, uri) > 0) + .sort((left, right) => this.score(right, languageId, uri) - this.score(left, languageId, uri))[0]; + } + + protected score(service: CallHierarchyService, languageId: string, uri: URI): number { + return score(service.selector, uri.scheme, uri.path.toString(), languageId, true); + } + + add(service: CallHierarchyService): Disposable { + this.services.push(service); + const that = this; + this.onDidChangeEmitter.fire(); + return { + dispose: () => { + that.remove(service); + } + }; + } + + private remove(service: CallHierarchyService): boolean { + const length = this.services.length; + this.services = this.services.filter(value => value !== service); + const serviceWasRemoved = length !== this.services.length; + if (serviceWasRemoved) { + this.onDidChangeEmitter.fire(); + } + return serviceWasRemoved; + } +} diff --git a/packages/callhierarchy/src/browser/callhierarchy-tree/callhierarchy-tree-container.ts b/packages/callhierarchy/src/browser/callhierarchy-tree/callhierarchy-tree-container.ts new file mode 100644 index 0000000..dcfc279 --- /dev/null +++ b/packages/callhierarchy/src/browser/callhierarchy-tree/callhierarchy-tree-container.ts @@ -0,0 +1,35 @@ +// ***************************************************************************** +// Copyright (C) 2018 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { interfaces, Container } from '@theia/core/shared/inversify'; +import { createTreeContainer } from '@theia/core/lib/browser'; +import { CallHierarchyTree } from './callhierarchy-tree'; +import { CallHierarchyTreeModel } from './callhierarchy-tree-model'; +import { CallHierarchyTreeWidget } from './callhierarchy-tree-widget'; + +function createHierarchyTreeContainer(parent: interfaces.Container): Container { + const child = createTreeContainer(parent, { + tree: CallHierarchyTree, + model: CallHierarchyTreeModel, + widget: CallHierarchyTreeWidget, + }); + + return child; +} + +export function createHierarchyTreeWidget(parent: interfaces.Container): CallHierarchyTreeWidget { + return createHierarchyTreeContainer(parent).get(CallHierarchyTreeWidget); +} diff --git a/packages/callhierarchy/src/browser/callhierarchy-tree/callhierarchy-tree-model.ts b/packages/callhierarchy/src/browser/callhierarchy-tree/callhierarchy-tree-model.ts new file mode 100644 index 0000000..745cb94 --- /dev/null +++ b/packages/callhierarchy/src/browser/callhierarchy-tree/callhierarchy-tree-model.ts @@ -0,0 +1,71 @@ +// ***************************************************************************** +// Copyright (C) 2018 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { injectable, inject } from '@theia/core/shared/inversify'; +import { CompositeTreeNode, TreeModelImpl, TreeNode } from '@theia/core/lib/browser'; +import { CallHierarchyTree, ItemNode } from './callhierarchy-tree'; +import { CallHierarchyServiceProvider, CallHierarchySession } from '../callhierarchy-service'; +import { Position } from '@theia/core/shared/vscode-languageserver-protocol'; +import URI from '@theia/core/lib/common/uri'; +import { CancellationTokenSource } from '@theia/core/lib/common/cancellation'; + +@injectable() +export class CallHierarchyTreeModel extends TreeModelImpl { + + protected _languageId: string | undefined; + protected currentSession?: CallHierarchySession; + + @inject(CallHierarchyTree) protected override readonly tree: CallHierarchyTree; + @inject(CallHierarchyServiceProvider) protected readonly callHierarchyServiceProvider: CallHierarchyServiceProvider; + + getTree(): CallHierarchyTree { + return this.tree; + } + + get languageId(): string | undefined { + return this._languageId; + } + + async initializeCallHierarchy(languageId: string | undefined, uri: string | undefined, position: Position | undefined): Promise { + this.tree.root = undefined; + this.tree.callHierarchyService = undefined; + this._languageId = languageId; + if (languageId && uri && position) { + const callHierarchyService = this.callHierarchyServiceProvider.get(languageId, new URI(uri)); + if (callHierarchyService) { + this.tree.callHierarchyService = callHierarchyService; + const cancellationSource = new CancellationTokenSource(); + const rootDefinition = await callHierarchyService.getRootDefinition(uri, position, cancellationSource.token); + if (rootDefinition) { + this.currentSession?.dispose(); + this.currentSession = rootDefinition; + const root: CompositeTreeNode = { + id: 'call-hierarchy-tree-root', + parent: undefined, + children: [], + visible: false, + }; + rootDefinition.items.forEach(definition => CompositeTreeNode.addChild(root, ItemNode.create(definition, root))); + this.tree.root = root; + } + } + } + } + + protected override doOpenNode(node: TreeNode): void { + // do nothing (in particular do not expand the node) + } +} diff --git a/packages/callhierarchy/src/browser/callhierarchy-tree/callhierarchy-tree-widget.tsx b/packages/callhierarchy/src/browser/callhierarchy-tree/callhierarchy-tree-widget.tsx new file mode 100644 index 0000000..0fc2c77 --- /dev/null +++ b/packages/callhierarchy/src/browser/callhierarchy-tree/callhierarchy-tree-widget.tsx @@ -0,0 +1,223 @@ +// ***************************************************************************** +// Copyright (C) 2018 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { injectable, inject } from '@theia/core/shared/inversify'; +import { + ContextMenuRenderer, TreeWidget, NodeProps, TreeProps, TreeNode, + TreeModel, DockPanel, codicon +} from '@theia/core/lib/browser'; +import { LabelProvider } from '@theia/core/lib/browser/label-provider'; +import { ItemNode, CallerNode } from './callhierarchy-tree'; +import { CallHierarchyTreeModel } from './callhierarchy-tree-model'; +import { CALLHIERARCHY_ID, CallHierarchyItem, CallHierarchyIncomingCall, CALL_HIERARCHY_LABEL } from '../callhierarchy'; +import URI from '@theia/core/lib/common/uri'; +import { Location, Range, SymbolKind, DocumentUri, SymbolTag } from '@theia/core/shared/vscode-languageserver-protocol'; +import { EditorManager } from '@theia/editor/lib/browser'; +import { nls } from '@theia/core/lib/common/nls'; +import * as React from '@theia/core/shared/react'; + +export const HIERARCHY_TREE_CLASS = 'theia-CallHierarchyTree'; +export const DEFINITION_NODE_CLASS = 'theia-CallHierarchyTreeNode'; +export const DEFINITION_ICON_CLASS = 'theia-CallHierarchyTreeNodeIcon'; + +@injectable() +export class CallHierarchyTreeWidget extends TreeWidget { + + constructor( + @inject(TreeProps) override readonly props: TreeProps, + @inject(CallHierarchyTreeModel) override readonly model: CallHierarchyTreeModel, + @inject(ContextMenuRenderer) contextMenuRenderer: ContextMenuRenderer, + @inject(LabelProvider) protected override readonly labelProvider: LabelProvider, + @inject(EditorManager) readonly editorManager: EditorManager + ) { + super(props, model, contextMenuRenderer); + + this.id = CALLHIERARCHY_ID; + this.title.label = CALL_HIERARCHY_LABEL; + this.title.caption = CALL_HIERARCHY_LABEL; + this.title.iconClass = codicon('references'); + this.title.closable = true; + this.addClass(HIERARCHY_TREE_CLASS); + this.toDispose.push(this.model.onSelectionChanged(selection => { + const node = selection[0]; + if (node) { + this.openEditor(node, true); + } + })); + this.toDispose.push(this.model.onOpenNode((node: TreeNode) => { + this.openEditor(node, false); + })); + this.toDispose.push( + this.labelProvider.onDidChange(() => this.update()) + ); + } + + initializeModel(selection: Location | undefined, languageId: string | undefined): void { + this.model.initializeCallHierarchy(languageId, selection ? selection.uri : undefined, selection ? selection.range.start : undefined); + } + + protected override createNodeClassNames(node: TreeNode, props: NodeProps): string[] { + const classNames = super.createNodeClassNames(node, props); + if (ItemNode.is(node)) { + classNames.push(DEFINITION_NODE_CLASS); + } + return classNames; + } + + protected override createNodeAttributes(node: TreeNode, props: NodeProps): React.Attributes & React.HTMLAttributes { + const elementAttrs = super.createNodeAttributes(node, props); + return { + ...elementAttrs, + }; + } + + protected override renderTree(model: TreeModel): React.ReactNode { + return super.renderTree(model) + ||
    {nls.localize('theia/callhierarchy/noCallers', 'No callers have been detected.')}
    ; + } + + protected override renderCaption(node: TreeNode, props: NodeProps): React.ReactNode { + if (ItemNode.is(node)) { + return this.decorateDefinitionCaption(node.definition); + } + if (CallerNode.is(node)) { + return this.decorateCallerCaption(node.caller); + } + return 'caption'; + } + + protected decorateDefinitionCaption(definition: CallHierarchyItem): React.ReactNode { + const symbol = definition.name; + const location = this.labelProvider.getName(URI.fromComponents(definition.uri)); + const container = location; + const isDeprecated = definition.tags?.includes(SymbolTag.Deprecated); + const classNames = ['definitionNode']; + if (isDeprecated) { + classNames.push('deprecatedDefinition'); + } + + return
    +
    +
    + + {symbol} + + + {container} + +
    +
    ; + } + + protected decorateCallerCaption(caller: CallHierarchyIncomingCall): React.ReactNode { + const definition = caller.from; + const symbol = definition.name; + const referenceCount = caller.fromRanges.length; + const location = this.labelProvider.getName(URI.fromComponents(definition.uri)); + const container = location; + const isDeprecated = definition.tags?.includes(SymbolTag.Deprecated); + const classNames = ['definitionNode']; + if (isDeprecated) { + classNames.push('deprecatedDefinition'); + } + + return
    +
    +
    + + {symbol} + + + {(referenceCount > 1) ? `[${referenceCount}]` : ''} + + + {container} + +
    +
    ; + } + + // tslint:disable-next-line:typedef + protected toIconClass(symbolKind: number) { + switch (symbolKind) { + case SymbolKind.File: return 'file'; + case SymbolKind.Module: return 'module'; + case SymbolKind.Namespace: return 'namespace'; + case SymbolKind.Package: return 'package'; + case SymbolKind.Class: return 'class'; + case SymbolKind.Method: return 'method'; + case SymbolKind.Property: return 'property'; + case SymbolKind.Field: return 'field'; + case SymbolKind.Constructor: return 'constructor'; + case SymbolKind.Enum: return 'enum'; + case SymbolKind.Interface: return 'interface'; + case SymbolKind.Function: return 'function'; + case SymbolKind.Variable: return 'variable'; + case SymbolKind.Constant: return 'constant'; + case SymbolKind.String: return 'string'; + case SymbolKind.Number: return 'number'; + case SymbolKind.Boolean: return 'boolean'; + case SymbolKind.Array: return 'array'; + default: return 'unknown'; + } + } + + private openEditor(node: TreeNode, keepFocus: boolean): void { + + if (ItemNode.is(node)) { + const def = node.definition; + this.doOpenEditor(URI.fromComponents(def.uri).toString(), def.selectionRange ? def.selectionRange : def.range, keepFocus); + } + if (CallerNode.is(node)) { + this.doOpenEditor(URI.fromComponents(node.caller.from.uri).toString(), node.caller.fromRanges[0], keepFocus); + } + } + + private doOpenEditor(uri: DocumentUri, range: Range, keepFocus: boolean): void { + this.editorManager.open( + new URI(uri), { + mode: keepFocus ? 'reveal' : 'activate', + selection: range + } + ).then(editorWidget => { + if (editorWidget.parent instanceof DockPanel) { + editorWidget.parent.selectWidget(editorWidget); + } + }); + } + + override storeState(): object { + const callHierarchyService = this.model.getTree().callHierarchyService; + if (this.model.root && callHierarchyService) { + return { + root: this.deflateForStorage(this.model.root), + languageId: this.model.languageId, + }; + } else { + return {}; + } + } + + override restoreState(oldState: object): void { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + if ((oldState as any).root && (oldState as any).languageId) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + const root = this.inflateFromStorage((oldState as any).root) as ItemNode; + // eslint-disable-next-line @typescript-eslint/no-explicit-any + this.model.initializeCallHierarchy((oldState as any).languageId, URI.fromComponents(root.definition.uri).toString(), root.definition.range.start); + } + } +} diff --git a/packages/callhierarchy/src/browser/callhierarchy-tree/callhierarchy-tree.ts b/packages/callhierarchy/src/browser/callhierarchy-tree/callhierarchy-tree.ts new file mode 100644 index 0000000..90b272d --- /dev/null +++ b/packages/callhierarchy/src/browser/callhierarchy-tree/callhierarchy-tree.ts @@ -0,0 +1,119 @@ +// ***************************************************************************** +// Copyright (C) 2018 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { injectable } from '@theia/core/shared/inversify'; +import { TreeNode, CompositeTreeNode, SelectableTreeNode, ExpandableTreeNode, TreeImpl } from '@theia/core/lib/browser'; +import { CallHierarchyItem, CallHierarchyIncomingCall } from '../callhierarchy'; +import { CallHierarchyService } from '../callhierarchy-service'; +import { Md5 } from 'ts-md5'; +import { CancellationTokenSource } from '@theia/core/lib/common/cancellation'; + +@injectable() +export class CallHierarchyTree extends TreeImpl { + + protected _callHierarchyService: CallHierarchyService | undefined; + + set callHierarchyService(callHierarchyService: CallHierarchyService | undefined) { + this._callHierarchyService = callHierarchyService; + } + + get callHierarchyService(): CallHierarchyService | undefined { + return this._callHierarchyService; + } + + override async resolveChildren(parent: CompositeTreeNode): Promise { + if (!this.callHierarchyService) { + return Promise.resolve([]); + } + if (parent.children.length > 0) { + return Promise.resolve([...parent.children]); + } + let definition: CallHierarchyItem | undefined; + if (ItemNode.is(parent)) { + definition = parent.definition; + } else if (CallerNode.is(parent)) { + definition = parent.caller.from; + } + if (definition) { + const cancellationSource = new CancellationTokenSource(); + const callers = await this.callHierarchyService.getCallers(definition, cancellationSource.token); + if (!callers) { + return Promise.resolve([]); + } + return this.toNodes(callers, parent); + } + return Promise.resolve([]); + } + + protected toNodes(callers: CallHierarchyIncomingCall[], parent: CompositeTreeNode): TreeNode[] { + return callers.map(caller => this.toNode(caller, parent)); + } + + protected toNode(caller: CallHierarchyIncomingCall, parent: CompositeTreeNode | undefined): TreeNode { + return CallerNode.create(caller, parent as TreeNode); + } +} + +export interface ItemNode extends SelectableTreeNode, ExpandableTreeNode { + definition: CallHierarchyItem; +} + +export namespace ItemNode { + export function is(node: TreeNode | undefined): node is ItemNode { + return !!node && 'definition' in node; + } + + export function create(definition: CallHierarchyItem, parent: TreeNode | undefined): ItemNode { + const name = definition.name; + const id = createId(definition, parent); + return { + id, definition, name, parent, + visible: true, + children: [], + expanded: false, + selected: false, + }; + } +} + +export interface CallerNode extends SelectableTreeNode, ExpandableTreeNode { + caller: CallHierarchyIncomingCall; +} + +export namespace CallerNode { + export function is(node: TreeNode | undefined): node is CallerNode { + return !!node && 'caller' in node; + } + + export function create(caller: CallHierarchyIncomingCall, parent: TreeNode | undefined): CallerNode { + const callerDefinition = caller.from; + const name = callerDefinition.name; + const id = createId(callerDefinition, parent); + return { + id, caller, name, parent, + visible: true, + children: [], + expanded: false, + selected: false, + }; + } +} + +function createId(definition: CallHierarchyItem, parent: TreeNode | undefined): string { + const idPrefix = (parent) ? parent.id + '/' : ''; + const id = idPrefix + Md5.hashStr(JSON.stringify(definition)); + return id; +} diff --git a/packages/callhierarchy/src/browser/callhierarchy-tree/index.ts b/packages/callhierarchy/src/browser/callhierarchy-tree/index.ts new file mode 100644 index 0000000..62ac1ce --- /dev/null +++ b/packages/callhierarchy/src/browser/callhierarchy-tree/index.ts @@ -0,0 +1,20 @@ +// ***************************************************************************** +// Copyright (C) 2018 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +export * from './callhierarchy-tree'; +export * from './callhierarchy-tree-model'; +export * from './callhierarchy-tree-widget'; +export * from './callhierarchy-tree-container'; diff --git a/packages/callhierarchy/src/browser/callhierarchy.ts b/packages/callhierarchy/src/browser/callhierarchy.ts new file mode 100644 index 0000000..40bee1b --- /dev/null +++ b/packages/callhierarchy/src/browser/callhierarchy.ts @@ -0,0 +1,47 @@ +// ***************************************************************************** +// Copyright (C) 2018 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { nls } from '@theia/core'; +import { UriComponents } from '@theia/core/lib/common/uri'; +import { Range, SymbolKind, SymbolTag } from '@theia/core/shared/vscode-languageserver-protocol'; + +export const CALLHIERARCHY_ID = 'callhierarchy'; +export const CALL_HIERARCHY_TOGGLE_COMMAND_ID = 'callhierarchy:toggle'; +export const CALL_HIERARCHY_LABEL = nls.localizeByDefault('Call Hierarchy'); + +export interface CallHierarchyItem { + _sessionId?: string; + _itemId?: string; + + kind: SymbolKind; + name: string; + detail?: string; + uri: UriComponents; + range: Range; + selectionRange: Range; + tags?: readonly SymbolTag[]; + data?: unknown; +} + +export interface CallHierarchyIncomingCall { + from: CallHierarchyItem; + fromRanges: Range[]; +} + +export interface CallHierarchyOutgoingCall { + to: CallHierarchyItem; + fromRanges: Range[]; +} diff --git a/packages/callhierarchy/src/browser/index.ts b/packages/callhierarchy/src/browser/index.ts new file mode 100644 index 0000000..0d13563 --- /dev/null +++ b/packages/callhierarchy/src/browser/index.ts @@ -0,0 +1,20 @@ +// ***************************************************************************** +// Copyright (C) 2018 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +export * from './callhierarchy'; +export * from './callhierarchy-contribution'; +export * from './callhierarchy-frontend-module'; +export * from './callhierarchy-service'; diff --git a/packages/callhierarchy/src/browser/style/index.css b/packages/callhierarchy/src/browser/style/index.css new file mode 100644 index 0000000..dc36981 --- /dev/null +++ b/packages/callhierarchy/src/browser/style/index.css @@ -0,0 +1,65 @@ +/******************************************************************************** + * Copyright (C) 2018 TypeFox and others. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the Eclipse + * Public License v. 2.0 are satisfied: GNU General Public License, version 2 + * with the GNU Classpath Exception which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 + ********************************************************************************/ + +.theia-CallHierarchyTree { + font-size: var(--theia-ui-font-size1); +} + +.theia-CallHierarchyTree .theia-TreeNode { + width: 100%; +} + +.theia-CallHierarchyTree .theia-ExpansionToggle { + min-width: 9px; + padding-right: 4px; +} + +.theia-CallHierarchyTree .definitionNode { + display: flex; +} + +.theia-CallHierarchyTree .definitionNode { + width: calc(100% - 32px); +} + +.theia-CallHierarchyTree .definitionNode div { + margin-right: 5px; +} + +.theia-CallHierarchyTree .definitionNode .symbol { + padding-right: 4px; +} + +.theia-CallHierarchyTree .definitionNode .referenceCount { + color: var(--theia-badge-background); + padding-right: 4px; +} + +.theia-CallHierarchyTree .definitionNode .container { + color: var(--theia-descriptionForeground); +} + +.theia-CallHierarchyTree .definitionNode-content { + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} + +.theia-CallHierarchyTree + .definitionNode.deprecatedDefinition + .definitionNode-content { + text-decoration: line-through; +} diff --git a/packages/callhierarchy/src/browser/utils.ts b/packages/callhierarchy/src/browser/utils.ts new file mode 100644 index 0000000..a30cb54 --- /dev/null +++ b/packages/callhierarchy/src/browser/utils.ts @@ -0,0 +1,102 @@ +// ***************************************************************************** +// Copyright (C) 2018 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { Location, Range, Position } from '@theia/core/shared/vscode-languageserver-protocol'; + +/** + * Test if `otherRange` is in `range`. If the ranges are equal, will return true. + */ +export function containsRange(range: Range, otherRange: Range): boolean { + if (otherRange.start.line < range.start.line || otherRange.end.line < range.start.line) { + return false; + } + if (otherRange.start.line > range.end.line || otherRange.end.line > range.end.line) { + return false; + } + if (otherRange.start.line === range.start.line && otherRange.start.character < range.start.character) { + return false; + } + if (otherRange.end.line === range.end.line && otherRange.end.character > range.end.character) { + return false; + } + return true; +} + +export function containsPosition(range: Range, position: Position): boolean { + return comparePosition(range.start, position) >= 0 && comparePosition(range.end, position) <= 0; +} + +function sameStart(a: Range, b: Range): boolean { + const pos1 = a.start; + const pos2 = b.start; + return pos1.line === pos2.line + && pos1.character === pos2.character; +} + +export function filterSame(locations: Location[], definition: Location): Location[] { + return locations.filter(candidate => candidate.uri !== definition.uri + || !sameStart(candidate.range, definition.range) + ); +} + +export function comparePosition(left: Position, right: Position): number { + const diff = right.line - left.line; + if (diff !== 0) { + return diff; + } + return right.character - left.character; +} + +export function filterUnique(locations: Location[] | null): Location[] { + if (!locations) { + return []; + } + const result: Location[] = []; + const set = new Set(); + for (const location of locations) { + const json = JSON.stringify(location); + if (!set.has(json)) { + set.add(json); + result.push(location); + } + } + return result; +} + +export function startsAfter(a: Range, b: Range): boolean { + if (a.start.line > b.start.line) { + return true; + } + if (a.start.line === b.start.line) { + if (a.start.character > b.start.character) { + return true; + } + if (a.start.character === b.start.character) { + if (a.end.line > b.end.line) { + return true; + } + } + } + return false; +} + +export function isSame(a: Location, b: Location): boolean { + return a.uri === b.uri + && a.range.start.line === b.range.start.line + && a.range.end.line === b.range.end.line + && a.range.start.character === b.range.start.character + && a.range.end.character === b.range.end.character; +} diff --git a/packages/callhierarchy/src/package.spec.ts b/packages/callhierarchy/src/package.spec.ts new file mode 100644 index 0000000..c394c30 --- /dev/null +++ b/packages/callhierarchy/src/package.spec.ts @@ -0,0 +1,28 @@ +// ***************************************************************************** +// Copyright (C) 2018 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +/* note: this bogus test file is required so that + we are able to run mocha unit tests on this + package, without having any actual unit tests in it. + This way a coverage report will be generated, + showing 0% coverage, instead of no report. + This file can be removed once we have real unit + tests in place. */ + +describe('callhierarchy package', () => { + + it('support code coverage statistics', () => true); +}); diff --git a/packages/callhierarchy/tsconfig.json b/packages/callhierarchy/tsconfig.json new file mode 100644 index 0000000..c38a934 --- /dev/null +++ b/packages/callhierarchy/tsconfig.json @@ -0,0 +1,19 @@ +{ + "extends": "../../configs/base.tsconfig.json", + "compilerOptions": { + "composite": true, + "rootDir": "src", + "outDir": "lib" + }, + "include": [ + "src" + ], + "references": [ + { + "path": "../core" + }, + { + "path": "../editor" + } + ] +} diff --git a/packages/collaboration/.eslintrc.js b/packages/collaboration/.eslintrc.js new file mode 100644 index 0000000..1308994 --- /dev/null +++ b/packages/collaboration/.eslintrc.js @@ -0,0 +1,10 @@ +/** @type {import('eslint').Linter.Config} */ +module.exports = { + extends: [ + '../../configs/build.eslintrc.json' + ], + parserOptions: { + tsconfigRootDir: __dirname, + project: 'tsconfig.json' + } +}; diff --git a/packages/collaboration/README.md b/packages/collaboration/README.md new file mode 100644 index 0000000..a09d854 --- /dev/null +++ b/packages/collaboration/README.md @@ -0,0 +1,34 @@ +
    + +
    + +theia-ext-logo + +

    ECLIPSE THEIA - COLLABORATION EXTENSION

    + +
    + +
    + +## Description + +The `@theia/collaboration` extension features to enable collaboration between multiple peers using Theia. +This is built on top of the [Open Collaboration Tools](https://www.open-collab.tools/) ([GitHub](https://github.com/TypeFox/open-collaboration-tools)) project. + +Note that the project is still in a beta phase and can be subject to unexpected breaking changes. This package is therefore in a beta phase as well. + +## Additional Information + +- [API documentation for `@theia/collaboration`](https://eclipse-theia.github.io/theia/docs/next/modules/_theia_collaboration.html) +- [Theia - GitHub](https://github.com/eclipse-theia/theia) +- [Theia - Website](https://theia-ide.org/) + +## License + +- [Eclipse Public License 2.0](http://www.eclipse.org/legal/epl-2.0/) +- [一 (Secondary) GNU General Public License, version 2 with the GNU Classpath Exception](https://projects.eclipse.org/license/secondary-gpl-2.0-cp) + +## Trademark + +"Theia" is a trademark of the Eclipse Foundation + diff --git a/packages/collaboration/package.json b/packages/collaboration/package.json new file mode 100644 index 0000000..5069679 --- /dev/null +++ b/packages/collaboration/package.json @@ -0,0 +1,59 @@ +{ + "name": "@theia/collaboration", + "version": "1.68.0", + "description": "Theia - Collaboration Extension", + "dependencies": { + "@theia/core": "1.68.0", + "@theia/editor": "1.68.0", + "@theia/filesystem": "1.68.0", + "@theia/monaco": "1.68.0", + "@theia/monaco-editor-core": "1.96.302", + "@theia/workspace": "1.68.0", + "lib0": "^0.2.52", + "open-collaboration-protocol": "0.3.0", + "open-collaboration-yjs": "0.3.0", + "socket.io-client": "^4.5.3", + "y-protocols": "^1.0.6", + "yjs": "^13.6.7" + }, + "publishConfig": { + "access": "public" + }, + "theiaExtensions": [ + { + "frontend": "lib/browser/collaboration-frontend-module", + "backend": "lib/node/collaboration-backend-module" + } + ], + "keywords": [ + "theia-extension" + ], + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "repository": { + "type": "git", + "url": "https://github.com/eclipse-theia/theia.git" + }, + "bugs": { + "url": "https://github.com/eclipse-theia/theia/issues" + }, + "homepage": "https://github.com/eclipse-theia/theia", + "files": [ + "lib", + "src" + ], + "scripts": { + "build": "theiaext build", + "clean": "theiaext clean", + "compile": "theiaext compile", + "lint": "theiaext lint", + "test": "theiaext test", + "watch": "theiaext watch" + }, + "devDependencies": { + "@theia/ext-scripts": "1.68.0" + }, + "nyc": { + "extends": "../../configs/nyc.json" + }, + "gitHead": "21358137e41342742707f660b8e222f940a27652" +} diff --git a/packages/collaboration/src/browser/collaboration-color-service.ts b/packages/collaboration/src/browser/collaboration-color-service.ts new file mode 100644 index 0000000..adfac8e --- /dev/null +++ b/packages/collaboration/src/browser/collaboration-color-service.ts @@ -0,0 +1,77 @@ +// ***************************************************************************** +// Copyright (C) 2024 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { injectable } from '@theia/core/shared/inversify'; + +export interface CollaborationColor { + r: number; + g: number; + b: number; +} + +export namespace CollaborationColor { + export function fromString(code: string): CollaborationColor { + if (code.startsWith('#')) { + code = code.substring(1); + } + const r = parseInt(code.substring(0, 2), 16); + const g = parseInt(code.substring(2, 4), 16); + const b = parseInt(code.substring(4, 6), 16); + return { r, g, b }; + } + + export const Gold = fromString('#FFD700'); + export const Tomato = fromString('#FF6347'); + export const Aquamarine = fromString('#7FFFD4'); + export const Beige = fromString('#F5F5DC'); + export const Coral = fromString('#FF7F50'); + export const DarkOrange = fromString('#FF8C00'); + export const VioletRed = fromString('#C71585'); + export const DodgerBlue = fromString('#1E90FF'); + export const Chocolate = fromString('#D2691E'); + export const LightGreen = fromString('#90EE90'); + export const MediumOrchid = fromString('#BA55D3'); + export const Orange = fromString('#FFA500'); +} + +@injectable() +export class CollaborationColorService { + + light = 'white'; + dark = 'black'; + + getColors(): CollaborationColor[] { + return [ + CollaborationColor.Gold, + CollaborationColor.Aquamarine, + CollaborationColor.Tomato, + CollaborationColor.MediumOrchid, + CollaborationColor.LightGreen, + CollaborationColor.Orange, + CollaborationColor.Beige, + CollaborationColor.Chocolate, + CollaborationColor.VioletRed, + CollaborationColor.Coral, + CollaborationColor.DodgerBlue, + CollaborationColor.DarkOrange + ]; + } + + requiresDarkFont(color: CollaborationColor): boolean { + // From https://stackoverflow.com/a/3943023 + return ((color.r * 0.299) + (color.g * 0.587) + (color.b * 0.114)) > 186; + } +} diff --git a/packages/collaboration/src/browser/collaboration-file-system-provider.ts b/packages/collaboration/src/browser/collaboration-file-system-provider.ts new file mode 100644 index 0000000..834715a --- /dev/null +++ b/packages/collaboration/src/browser/collaboration-file-system-provider.ts @@ -0,0 +1,117 @@ +// ***************************************************************************** +// Copyright (C) 2024 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import * as Y from 'yjs'; +import { Disposable, Emitter, Event, URI } from '@theia/core'; +import { + FileChange, FileDeleteOptions, + FileOverwriteOptions, FileSystemProviderCapabilities, FileType, Stat, WatchOptions, FileSystemProviderWithFileReadWriteCapability, FileWriteOptions +} from '@theia/filesystem/lib/common/files'; +import { ProtocolBroadcastConnection, Workspace, Peer } from 'open-collaboration-protocol'; + +export namespace CollaborationURI { + + export const scheme = 'collaboration'; + + export function create(workspace: Workspace, path?: string): URI { + return new URI(`${scheme}:///${workspace.name}${path ? '/' + path : ''}`); + } +} + +export class CollaborationFileSystemProvider implements FileSystemProviderWithFileReadWriteCapability { + + capabilities = FileSystemProviderCapabilities.FileReadWrite; + + protected _readonly: boolean; + + get readonly(): boolean { + return this._readonly; + } + + set readonly(value: boolean) { + if (this._readonly !== value) { + this._readonly = value; + if (value) { + this.capabilities |= FileSystemProviderCapabilities.Readonly; + } else { + this.capabilities &= ~FileSystemProviderCapabilities.Readonly; + } + this.onDidChangeCapabilitiesEmitter.fire(); + } + } + + constructor(readonly connection: ProtocolBroadcastConnection, readonly host: Peer, readonly yjs: Y.Doc) { + } + + protected encoder = new TextEncoder(); + protected decoder = new TextDecoder(); + protected onDidChangeCapabilitiesEmitter = new Emitter(); + protected onDidChangeFileEmitter = new Emitter(); + protected onFileWatchErrorEmitter = new Emitter(); + + get onDidChangeCapabilities(): Event { + return this.onDidChangeCapabilitiesEmitter.event; + } + get onDidChangeFile(): Event { + return this.onDidChangeFileEmitter.event; + } + get onFileWatchError(): Event { + return this.onFileWatchErrorEmitter.event; + } + async readFile(resource: URI): Promise { + const path = this.getHostPath(resource); + if (this.yjs.share.has(path)) { + const stringValue = this.yjs.getText(path); + return this.encoder.encode(stringValue.toString()); + } else { + const data = await this.connection.fs.readFile(this.host.id, path); + return data.content; + } + } + async writeFile(resource: URI, content: Uint8Array, opts: FileWriteOptions): Promise { + const path = this.getHostPath(resource); + await this.connection.fs.writeFile(this.host.id, path, { content }); + } + watch(resource: URI, opts: WatchOptions): Disposable { + return Disposable.NULL; + } + stat(resource: URI): Promise { + return this.connection.fs.stat(this.host.id, this.getHostPath(resource)); + } + mkdir(resource: URI): Promise { + return this.connection.fs.mkdir(this.host.id, this.getHostPath(resource)); + } + async readdir(resource: URI): Promise<[string, FileType][]> { + const record = await this.connection.fs.readdir(this.host.id, this.getHostPath(resource)); + return Object.entries(record); + } + delete(resource: URI, opts: FileDeleteOptions): Promise { + return this.connection.fs.delete(this.host.id, this.getHostPath(resource)); + } + rename(from: URI, to: URI, opts: FileOverwriteOptions): Promise { + return this.connection.fs.rename(this.host.id, this.getHostPath(from), this.getHostPath(to)); + } + + protected getHostPath(uri: URI): string { + const path = uri.path.toString().substring(1).split('/'); + return path.slice(1).join('/'); + } + + triggerEvent(changes: FileChange[]): void { + this.onDidChangeFileEmitter.fire(changes); + } + +} diff --git a/packages/collaboration/src/browser/collaboration-frontend-contribution.ts b/packages/collaboration/src/browser/collaboration-frontend-contribution.ts new file mode 100644 index 0000000..42adeed --- /dev/null +++ b/packages/collaboration/src/browser/collaboration-frontend-contribution.ts @@ -0,0 +1,430 @@ +// ***************************************************************************** +// Copyright (C) 2024 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import '../../src/browser/style/index.css'; + +import { + CancellationToken, CancellationTokenSource, Command, CommandContribution, CommandRegistry, MessageService, nls, PreferenceService, Progress, QuickInputService, QuickPickItem, + URI +} from '@theia/core'; +import { inject, injectable, optional, postConstruct } from '@theia/core/shared/inversify'; +import { AuthMetadata, AuthProvider, ConnectionProvider, FormAuthProvider, initializeProtocol, SocketIoTransportProvider, WebAuthProvider } from 'open-collaboration-protocol'; +import { WindowService } from '@theia/core/lib/browser/window/window-service'; +import { CollaborationInstance, CollaborationInstanceFactory } from './collaboration-instance'; +import { EnvVariablesServer } from '@theia/core/lib/common/env-variables'; +import { CollaborationWorkspaceService } from './collaboration-workspace-service'; +import { StatusBar, StatusBarAlignment, StatusBarEntry } from '@theia/core/lib/browser/status-bar'; +import { codiconArray } from '@theia/core/lib/browser/widgets/widget'; +import { FrontendApplicationConfigProvider } from '@theia/core/lib/browser/frontend-application-config-provider'; + +initializeProtocol({ + cryptoModule: window.crypto +}); + +export const COLLABORATION_CATEGORY = 'Collaboration'; + +export namespace CollaborationCommands { + export const CREATE_ROOM: Command = { + id: 'collaboration.create-room' + }; + export const JOIN_ROOM: Command = { + id: 'collaboration.join-room' + }; + export const SIGN_OUT: Command = { + id: 'collaboration.sign-out', + label: nls.localizeByDefault('Sign Out'), + category: COLLABORATION_CATEGORY, + }; +} + +export interface CollaborationAuthQuickPickItem extends QuickPickItem { + provider: AuthProvider; +} + +export const COLLABORATION_STATUS_BAR_ID = 'statusBar.collaboration'; + +export const COLLABORATION_AUTH_TOKEN = 'THEIA_COLLAB_AUTH_TOKEN'; +export const COLLABORATION_SERVER_URL = 'COLLABORATION_SERVER_URL'; +export const DEFAULT_COLLABORATION_SERVER_URL = 'https://api.open-collab.tools/'; + +@injectable() +export class CollaborationFrontendContribution implements CommandContribution { + + @inject(WindowService) + protected readonly windowService: WindowService; + + @inject(QuickInputService) @optional() + protected readonly quickInputService?: QuickInputService; + + @inject(EnvVariablesServer) + protected readonly envVariables: EnvVariablesServer; + + @inject(CollaborationWorkspaceService) + protected readonly workspaceService: CollaborationWorkspaceService; + + @inject(MessageService) + protected readonly messageService: MessageService; + + @inject(CommandRegistry) + protected readonly commands: CommandRegistry; + + @inject(PreferenceService) + protected readonly preferenceService: PreferenceService; + + @inject(StatusBar) + protected readonly statusBar: StatusBar; + + @inject(CollaborationInstanceFactory) + protected readonly collaborationInstanceFactory: CollaborationInstanceFactory; + + protected currentInstance?: CollaborationInstance; + + @postConstruct() + protected init(): void { + this.setStatusBarEntryDefault(); + } + + protected async createConnectionProvider(): Promise { + const serverUrl = await this.getCollaborationServerUrl(); + return new ConnectionProvider({ + url: serverUrl, + client: FrontendApplicationConfigProvider.get().applicationName, + fetch: window.fetch.bind(window), + authenticationHandler: (token, meta) => this.handleAuth(serverUrl, token, meta), + transports: [SocketIoTransportProvider], + userToken: localStorage.getItem(COLLABORATION_AUTH_TOKEN) ?? undefined + }); + } + + protected async handleAuth(serverUrl: string, token: string, metaData: AuthMetadata): Promise { + const hasAuthProviders = Boolean(metaData.providers.length); + if (!hasAuthProviders && metaData.loginPageUrl) { + if (metaData.loginPageUrl) { + this.windowService.openNewWindow(metaData.loginPageUrl, { external: true }); + return true; + } else { + this.messageService.error(nls.localize('theia/collaboration/noAuth', 'No authentication method provided by the server.')); + return false; + } + } + if (!this.quickInputService) { + return false; + } + const quickPickItems: CollaborationAuthQuickPickItem[] = metaData.providers.map(provider => ({ + label: provider.label.message, + detail: provider.details?.message, + provider + })); + const item = await this.quickInputService.pick(quickPickItems, { + title: nls.localize('theia/collaboration/selectAuth', 'Select Authentication Method'), + }); + if (item) { + switch (item.provider.type) { + case 'form': + return this.handleFormAuth(serverUrl, token, item.provider); + case 'web': + return this.handleWebAuth(serverUrl, token, item.provider); + } + } + return false; + } + + protected async handleFormAuth(serverUrl: string, token: string, provider: FormAuthProvider): Promise { + const fields = provider.fields; + const values: Record = { + token + }; + + for (const field of fields) { + let placeHolder: string; + if (field.placeHolder) { + placeHolder = field.placeHolder.message; + } else { + placeHolder = field.label.message; + } + placeHolder += field.required ? '' : ` (${nls.localize('theia/collaboration/optional', 'optional')})`; + const value = await this.quickInputService!.input({ + prompt: field.label.message, + placeHolder, + }); + // Test for thruthyness to also test for empty string + if (value) { + values[field.name] = value; + } else if (field.required) { + this.messageService.error(nls.localize('theia/collaboration/fieldRequired', 'The {0} field is required. Login aborted.', field.label.message)); + return false; + } + } + + const endpointUrl = new URI(serverUrl).withPath(provider.endpoint); + const response = await fetch(endpointUrl.toString(true), { + method: 'POST', + body: JSON.stringify(values), + headers: { + 'Content-Type': 'application/json' + } + }); + if (response.ok) { + this.messageService.info(nls.localize('theia/collaboration/loginSuccessful', 'Login successful.')); + } else { + this.messageService.error(nls.localize('theia/collaboration/loginFailed', 'Login failed.')); + } + return response.ok; + } + + protected async handleWebAuth(serverUrl: string, token: string, provider: WebAuthProvider): Promise { + const uri = new URI(serverUrl).withPath(provider.endpoint).withQuery('token=' + token); + this.windowService.openNewWindow(uri.toString(true), { external: true }); + return true; + } + + protected async onStatusDefaultClick(): Promise { + const items: QuickPickItem[] = []; + if (this.workspaceService.opened) { + items.push({ + label: nls.localize('theia/collaboration/createRoom', 'Create New Collaboration Session'), + iconClasses: codiconArray('add'), + execute: () => this.commands.executeCommand(CollaborationCommands.CREATE_ROOM.id) + }); + } + items.push({ + label: nls.localize('theia/collaboration/joinRoom', 'Join Collaboration Session'), + iconClasses: codiconArray('vm-connect'), + execute: () => this.commands.executeCommand(CollaborationCommands.JOIN_ROOM.id) + }); + await this.quickInputService?.showQuickPick(items, { + placeholder: nls.localize('theia/collaboration/selectCollaboration', 'Select collaboration option') + }); + } + + protected async onStatusSharedClick(code: string): Promise { + const items: QuickPickItem[] = [{ + label: nls.localize('theia/collaboration/invite', 'Invite Others'), + detail: nls.localize('theia/collaboration/inviteDetail', 'Copy the invitation code for sharing it with others to join the session.'), + iconClasses: codiconArray('clippy'), + execute: () => this.displayCopyNotification(code) + }]; + if (this.currentInstance) { + // TODO: Implement readonly mode + // if (this.currentInstance.readonly) { + // items.push({ + // label: nls.localize('theia/collaboration/enableEditing', 'Enable Workspace Editing'), + // detail: nls.localize('theia/collaboration/enableEditingDetail', 'Allow collaborators to modify content in your workspace.'), + // iconClasses: codiconArray('unlock'), + // execute: () => { + // if (this.currentInstance) { + // this.currentInstance.readonly = false; + // } + // } + // }); + // } else { + // items.push({ + // label: nls.localize('theia/collaboration/disableEditing', 'Disable Workspace Editing'), + // detail: nls.localize('theia/collaboration/disableEditingDetail', 'Restrict others from making changes to your workspace.'), + // iconClasses: codiconArray('lock'), + // execute: () => { + // if (this.currentInstance) { + // this.currentInstance.readonly = true; + // } + // } + // }); + // } + } + items.push({ + label: nls.localize('theia/collaboration/end', 'End Collaboration Session'), + detail: nls.localize('theia/collaboration/endDetail', 'Terminate the session, cease content sharing, and revoke access for others.'), + iconClasses: codiconArray('circle-slash'), + execute: () => this.currentInstance?.dispose() + }); + await this.quickInputService?.showQuickPick(items, { + placeholder: nls.localize('theia/collaboration/whatToDo', 'What would you like to do with other collaborators?') + }); + } + + protected async onStatusConnectedClick(code: string): Promise { + const items: QuickPickItem[] = [{ + label: nls.localize('theia/collaboration/invite', 'Invite Others'), + detail: nls.localize('theia/collaboration/inviteDetail', 'Copy the invitation code for sharing it with others to join the session.'), + iconClasses: codiconArray('clippy'), + execute: () => this.displayCopyNotification(code) + }]; + items.push({ + label: nls.localize('theia/collaboration/leave', 'Leave Collaboration Session'), + detail: nls.localize('theia/collaboration/leaveDetail', 'Disconnect from the current collaboration session and close the workspace.'), + iconClasses: codiconArray('circle-slash'), + execute: () => this.currentInstance?.dispose() + }); + await this.quickInputService?.showQuickPick(items, { + placeholder: nls.localize('theia/collaboration/whatToDo', 'What would you like to do with other collaborators?') + }); + } + + protected async setStatusBarEntryDefault(): Promise { + await this.setStatusBarEntry({ + text: '$(codicon-live-share) ' + nls.localize('theia/collaboration/collaborate', 'Collaborate'), + tooltip: nls.localize('theia/collaboration/startSession', 'Start or join collaboration session'), + onclick: () => this.onStatusDefaultClick() + }); + } + + protected async setStatusBarEntryShared(code: string): Promise { + await this.setStatusBarEntry({ + text: '$(codicon-broadcast) ' + nls.localizeByDefault('Shared'), + tooltip: nls.localize('theia/collaboration/sharedSession', 'Shared a collaboration session'), + onclick: () => this.onStatusSharedClick(code) + }); + } + + protected async setStatusBarEntryConnected(code: string): Promise { + await this.setStatusBarEntry({ + text: '$(codicon-broadcast) ' + nls.localize('theia/collaboration/connected', 'Connected'), + tooltip: nls.localize('theia/collaboration/connectedSession', 'Connected to a collaboration session'), + onclick: () => this.onStatusConnectedClick(code) + }); + } + + protected async setStatusBarEntry(entry: Omit): Promise { + await this.statusBar.setElement(COLLABORATION_STATUS_BAR_ID, { + ...entry, + alignment: StatusBarAlignment.LEFT, + priority: 5 + }); + } + + protected async getCollaborationServerUrl(): Promise { + const serverUrlVariable = await this.envVariables.getValue(COLLABORATION_SERVER_URL); + const serverUrlPreference = this.preferenceService.get('collaboration.serverUrl'); + return serverUrlVariable?.value || serverUrlPreference || DEFAULT_COLLABORATION_SERVER_URL; + } + + registerCommands(commands: CommandRegistry): void { + commands.registerCommand(CollaborationCommands.CREATE_ROOM, { + execute: async () => { + const cancelTokenSource = new CancellationTokenSource(); + const progress = await this.messageService.showProgress({ + text: nls.localize('theia/collaboration/creatingRoom', 'Creating Session'), + options: { + cancelable: true + } + }, () => cancelTokenSource.cancel()); + try { + const authHandler = await this.createConnectionProvider(); + const roomClaim = await authHandler.createRoom({ + reporter: info => progress.report({ message: info.message }), + abortSignal: this.toAbortSignal(cancelTokenSource.token) + }); + if (roomClaim.loginToken) { + localStorage.setItem(COLLABORATION_AUTH_TOKEN, roomClaim.loginToken); + } + this.currentInstance?.dispose(); + const connection = await authHandler.connect(roomClaim.roomToken); + this.currentInstance = this.collaborationInstanceFactory({ + role: 'host', + connection + }); + this.currentInstance.onDidClose(() => { + this.setStatusBarEntryDefault(); + }); + const roomCode = roomClaim.roomId; + this.setStatusBarEntryShared(roomCode); + this.displayCopyNotification(roomCode, true); + } catch (err) { + await this.messageService.error(nls.localize('theia/collaboration/failedCreate', 'Failed to create room: {0}', err.message)); + } finally { + progress.cancel(); + } + } + }); + commands.registerCommand(CollaborationCommands.JOIN_ROOM, { + execute: async () => { + let joinRoomProgress: Progress | undefined; + const cancelTokenSource = new CancellationTokenSource(); + try { + const authHandler = await this.createConnectionProvider(); + const id = await this.quickInputService?.input({ + placeHolder: nls.localize('theia/collaboration/enterCode', 'Enter collaboration session code') + }); + if (!id) { + return; + } + joinRoomProgress = await this.messageService.showProgress({ + text: nls.localize('theia/collaboration/joiningRoom', 'Joining Session'), + options: { + cancelable: true + } + }, () => cancelTokenSource.cancel()); + const roomClaim = await authHandler.joinRoom({ + roomId: id, + reporter: info => joinRoomProgress?.report({ message: info.message }), + abortSignal: this.toAbortSignal(cancelTokenSource.token) + }); + joinRoomProgress.cancel(); + if (roomClaim.loginToken) { + localStorage.setItem(COLLABORATION_AUTH_TOKEN, roomClaim.loginToken); + } + this.currentInstance?.dispose(); + const connection = await authHandler.connect(roomClaim.roomToken, roomClaim.host); + this.currentInstance = this.collaborationInstanceFactory({ + role: 'guest', + connection + }); + this.currentInstance.onDidClose(() => { + this.setStatusBarEntryDefault(); + }); + this.setStatusBarEntryConnected(roomClaim.roomId); + } catch (err) { + joinRoomProgress?.cancel(); + await this.messageService.error(nls.localize('theia/collaboration/failedJoin', 'Failed to join room: {0}', err.message)); + } + } + }); + commands.registerCommand(CollaborationCommands.SIGN_OUT, { + execute: async () => { + localStorage.removeItem(COLLABORATION_AUTH_TOKEN); + } + }); + } + + protected toAbortSignal(...tokens: CancellationToken[]): AbortSignal { + const controller = new AbortController(); + tokens.forEach(token => token.onCancellationRequested(() => controller.abort())); + return controller.signal; + } + + protected async displayCopyNotification(code: string, firstTime = false): Promise { + navigator.clipboard.writeText(code); + const notification = nls.localize('theia/collaboration/copiedInvitation', 'Invitation code copied to clipboard.'); + if (firstTime) { + // const makeReadonly = nls.localize('theia/collaboration/makeReadonly', 'Make readonly'); + const copyAgain = nls.localize('theia/collaboration/copyAgain', 'Copy Again'); + const copyResult = await this.messageService.info( + notification, + // makeReadonly, + copyAgain + ); + // if (copyResult === makeReadonly && this.currentInstance) { + // this.currentInstance.readonly = true; + // } + if (copyResult === copyAgain) { + navigator.clipboard.writeText(code); + } + } else { + await this.messageService.info( + notification + ); + } + } +} diff --git a/packages/collaboration/src/browser/collaboration-frontend-module.ts b/packages/collaboration/src/browser/collaboration-frontend-module.ts new file mode 100644 index 0000000..00741e8 --- /dev/null +++ b/packages/collaboration/src/browser/collaboration-frontend-module.ts @@ -0,0 +1,40 @@ +// ***************************************************************************** +// Copyright (C) 2024 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { CommandContribution, PreferenceContribution } from '@theia/core'; +import { ContainerModule } from '@theia/core/shared/inversify'; +import { WorkspaceService } from '@theia/workspace/lib/browser'; +import { CollaborationColorService } from './collaboration-color-service'; +import { CollaborationFrontendContribution } from './collaboration-frontend-contribution'; +import { CollaborationInstance, CollaborationInstanceFactory, CollaborationInstanceOptions, createCollaborationInstanceContainer } from './collaboration-instance'; +import { CollaborationUtils } from './collaboration-utils'; +import { CollaborationWorkspaceService } from './collaboration-workspace-service'; +import { collaborationPreferencesSchema } from '../common/collaboration-preferences'; + +export default new ContainerModule((bind, _, __, rebind) => { + bind(CollaborationWorkspaceService).toSelf().inSingletonScope(); + rebind(WorkspaceService).toService(CollaborationWorkspaceService); + bind(CollaborationUtils).toSelf().inSingletonScope(); + bind(CollaborationFrontendContribution).toSelf().inSingletonScope(); + bind(CommandContribution).toService(CollaborationFrontendContribution); + bind(CollaborationInstanceFactory).toFactory(context => (options: CollaborationInstanceOptions) => { + const container = createCollaborationInstanceContainer(context.container, options); + return container.get(CollaborationInstance); + }); + bind(CollaborationColorService).toSelf().inSingletonScope(); + + bind(PreferenceContribution).toConstantValue({ schema: collaborationPreferencesSchema }); +}); diff --git a/packages/collaboration/src/browser/collaboration-instance.ts b/packages/collaboration/src/browser/collaboration-instance.ts new file mode 100644 index 0000000..00c89e1 --- /dev/null +++ b/packages/collaboration/src/browser/collaboration-instance.ts @@ -0,0 +1,819 @@ +// ***************************************************************************** +// Copyright (C) 2024 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import * as types from 'open-collaboration-protocol'; +import * as Y from 'yjs'; +import * as awarenessProtocol from 'y-protocols/awareness'; + +import { Disposable, DisposableCollection, Emitter, Event, MessageService, URI, nls } from '@theia/core'; +import { Container, inject, injectable, interfaces, postConstruct } from '@theia/core/shared/inversify'; +import { ApplicationShell } from '@theia/core/lib/browser/shell/application-shell'; +import { EditorManager } from '@theia/editor/lib/browser/editor-manager'; +import { FileService } from '@theia/filesystem/lib/browser/file-service'; +import { MonacoTextModelService } from '@theia/monaco/lib/browser/monaco-text-model-service'; +import { CollaborationWorkspaceService } from './collaboration-workspace-service'; +import { Range as MonacoRange } from '@theia/monaco-editor-core'; +import { MonacoEditorModel } from '@theia/monaco/lib/browser/monaco-editor-model'; +import { MonacoEditor } from '@theia/monaco/lib/browser/monaco-editor'; +import { Deferred } from '@theia/core/lib/common/promise-util'; +import { EditorDecoration, EditorWidget, Selection, TextEditorDocument, TrackedRangeStickiness } from '@theia/editor/lib/browser'; +import { DecorationStyle, OpenerService, SaveReason } from '@theia/core/lib/browser'; +import { CollaborationFileSystemProvider, CollaborationURI } from './collaboration-file-system-provider'; +import { Range } from '@theia/core/shared/vscode-languageserver-protocol'; +import { CollaborationColorService } from './collaboration-color-service'; +import { BinaryBuffer } from '@theia/core/lib/common/buffer'; +import { FileChange, FileChangeType, FileOperation } from '@theia/filesystem/lib/common/files'; +import { OpenCollaborationYjsProvider } from 'open-collaboration-yjs'; +import { createMutex } from 'lib0/mutex'; +import { CollaborationUtils } from './collaboration-utils'; +import debounce = require('@theia/core/shared/lodash.debounce'); + +export const CollaborationInstanceFactory = Symbol('CollaborationInstanceFactory'); +export type CollaborationInstanceFactory = (connection: CollaborationInstanceOptions) => CollaborationInstance; + +export const CollaborationInstanceOptions = Symbol('CollaborationInstanceOptions'); +export interface CollaborationInstanceOptions { + role: 'host' | 'guest'; + connection: types.ProtocolBroadcastConnection; +} + +export function createCollaborationInstanceContainer(parent: interfaces.Container, options: CollaborationInstanceOptions): Container { + const child = new Container(); + child.parent = parent; + child.bind(CollaborationInstance).toSelf().inTransientScope(); + child.bind(CollaborationInstanceOptions).toConstantValue(options); + return child; +} + +export interface DisposablePeer extends Disposable { + peer: types.Peer; +} + +export const COLLABORATION_SELECTION = 'theia-collaboration-selection'; +export const COLLABORATION_SELECTION_MARKER = 'theia-collaboration-selection-marker'; +export const COLLABORATION_SELECTION_INVERTED = 'theia-collaboration-selection-inverted'; + +@injectable() +export class CollaborationInstance implements Disposable { + + @inject(MessageService) + protected readonly messageService: MessageService; + + @inject(CollaborationWorkspaceService) + protected readonly workspaceService: CollaborationWorkspaceService; + + @inject(FileService) + protected readonly fileService: FileService; + + @inject(MonacoTextModelService) + protected readonly monacoModelService: MonacoTextModelService; + + @inject(EditorManager) + protected readonly editorManager: EditorManager; + + @inject(OpenerService) + protected readonly openerService: OpenerService; + + @inject(ApplicationShell) + protected readonly shell: ApplicationShell; + + @inject(CollaborationInstanceOptions) + protected readonly options: CollaborationInstanceOptions; + + @inject(CollaborationColorService) + protected readonly collaborationColorService: CollaborationColorService; + + @inject(CollaborationUtils) + protected readonly utils: CollaborationUtils; + + protected identity = new Deferred(); + protected peers = new Map(); + protected yjs = new Y.Doc(); + protected yjsAwareness = new awarenessProtocol.Awareness(this.yjs); + protected yjsProvider: OpenCollaborationYjsProvider; + protected colorIndex = 0; + protected editorDecorations = new Map(); + protected fileSystem?: CollaborationFileSystemProvider; + protected permissions: types.Permissions = { + readonly: false + }; + + protected onDidCloseEmitter = new Emitter(); + + get onDidClose(): Event { + return this.onDidCloseEmitter.event; + } + + protected toDispose = new DisposableCollection(); + protected _readonly = false; + + get readonly(): boolean { + return this._readonly; + } + + set readonly(value: boolean) { + if (value !== this.readonly) { + if (this.options.role === 'guest' && this.fileSystem) { + this.fileSystem.readonly = value; + } else if (this.options.role === 'host') { + this.options.connection.room.updatePermissions({ + ...(this.permissions ?? {}), + readonly: value + }); + } + if (this.permissions) { + this.permissions.readonly = value; + } + this._readonly = value; + } + } + + get isHost(): boolean { + return this.options.role === 'host'; + } + + get host(): types.Peer { + return Array.from(this.peers.values()).find(e => e.peer.host)!.peer; + } + + @postConstruct() + protected init(): void { + const connection = this.options.connection; + connection.onDisconnect(() => this.dispose()); + connection.onConnectionError(message => { + this.messageService.error(message); + this.dispose(); + }); + this.yjsProvider = new OpenCollaborationYjsProvider(connection, this.yjs, this.yjsAwareness); + this.yjsProvider.connect(); + this.toDispose.push(Disposable.create(() => this.yjs.destroy())); + this.toDispose.push(this.yjsProvider); + this.toDispose.push(connection); + this.toDispose.push(this.onDidCloseEmitter); + + this.registerProtocolEvents(connection); + this.registerEditorEvents(connection); + this.registerFileSystemEvents(connection); + + if (this.isHost) { + this.registerFileSystemChanges(); + } + } + + protected registerProtocolEvents(connection: types.ProtocolBroadcastConnection): void { + connection.peer.onJoinRequest(async (_, user) => { + const allow = nls.localizeByDefault('Allow'); + const deny = nls.localizeByDefault('Deny'); + const result = await this.messageService.info( + nls.localize('theia/collaboration/userWantsToJoin', "User '{0}' wants to join the collaboration room", user.email ? `${user.name} (${user.email})` : user.name), + allow, + deny + ); + if (result === allow) { + const roots = await this.workspaceService.roots; + return { + workspace: { + name: this.workspaceService.workspace?.name ?? nls.localize('theia/collaboration/collaboration', 'Collaboration'), + folders: roots.map(e => e.name) + } + }; + } else { + return undefined; + } + }); + connection.room.onJoin(async (_, peer) => { + this.addPeer(peer); + if (this.isHost) { + const roots = await this.workspaceService.roots; + const data: types.InitData = { + protocol: types.VERSION, + host: await this.identity.promise, + guests: Array.from(this.peers.values()).map(e => e.peer), + capabilities: {}, + permissions: this.permissions, + workspace: { + name: this.workspaceService.workspace?.name ?? nls.localize('theia/collaboration/collaboration', 'Collaboration'), + folders: roots.map(e => e.name) + } + }; + connection.peer.init(peer.id, data); + } + }); + connection.room.onLeave((_, peer) => { + this.peers.get(peer.id)?.dispose(); + }); + connection.room.onClose(() => { + this.dispose(); + }); + connection.room.onPermissions((_, permissions) => { + if (this.fileSystem) { + this.fileSystem.readonly = permissions.readonly; + } + }); + connection.peer.onInfo((_, peer) => { + this.yjsAwareness.setLocalStateField('peer', peer.id); + this.identity.resolve(peer); + }); + connection.peer.onInit(async (_, data) => { + await this.initialize(data); + }); + } + + protected registerEditorEvents(connection: types.ProtocolBroadcastConnection): void { + for (const model of this.monacoModelService.models) { + if (this.isSharedResource(new URI(model.uri))) { + this.registerModelUpdate(model); + } + } + this.toDispose.push(this.monacoModelService.onDidCreate(newModel => { + if (this.isSharedResource(new URI(newModel.uri))) { + this.registerModelUpdate(newModel); + } + })); + this.toDispose.push(this.editorManager.onCreated(widget => { + if (this.isSharedResource(widget.getResourceUri())) { + this.registerPresenceUpdate(widget); + } + })); + this.getOpenEditors().forEach(widget => { + if (this.isSharedResource(widget.getResourceUri())) { + this.registerPresenceUpdate(widget); + } + }); + this.shell.onDidChangeActiveWidget(e => { + if (e.newValue instanceof EditorWidget) { + this.updateEditorPresence(e.newValue); + } + }); + + this.yjsAwareness.on('change', () => { + this.rerenderPresence(); + }); + + connection.editor.onOpen(async (_, path) => { + const uri = this.utils.getResourceUri(path); + if (uri) { + await this.openUri(uri); + } else { + throw new Error('Could find file: ' + path); + } + return undefined; + }); + } + + protected isSharedResource(resource?: URI): boolean { + if (!resource) { + return false; + } + return this.isHost ? resource.scheme === 'file' : resource.scheme === CollaborationURI.scheme; + } + + protected registerFileSystemEvents(connection: types.ProtocolBroadcastConnection): void { + connection.fs.onReadFile(async (_, path) => { + const uri = this.utils.getResourceUri(path); + if (uri) { + const content = await this.fileService.readFile(uri); + return { + content: content.value.buffer + }; + } else { + throw new Error('Could find file: ' + path); + } + }); + connection.fs.onReaddir(async (_, path) => { + const uri = this.utils.getResourceUri(path); + if (uri) { + const resolved = await this.fileService.resolve(uri); + if (resolved.children) { + const dir: Record = {}; + for (const child of resolved.children) { + dir[child.name] = child.isDirectory ? types.FileType.Directory : types.FileType.File; + } + return dir; + } else { + return {}; + } + } else { + throw new Error('Could find directory: ' + path); + } + }); + connection.fs.onStat(async (_, path) => { + const uri = this.utils.getResourceUri(path); + if (uri) { + const content = await this.fileService.resolve(uri, { + resolveMetadata: true + }); + return { + type: content.isDirectory ? types.FileType.Directory : types.FileType.File, + ctime: content.ctime, + mtime: content.mtime, + size: content.size, + permissions: content.isReadonly ? types.FilePermission.Readonly : undefined + }; + } else { + throw new Error('Could find file: ' + path); + } + }); + connection.fs.onWriteFile(async (_, path, data) => { + const uri = this.utils.getResourceUri(path); + if (uri) { + const model = this.getModel(uri); + if (model) { + const content = new TextDecoder().decode(data.content); + if (content !== model.getText()) { + model.textEditorModel.setValue(content); + } + await model.save({ saveReason: SaveReason.Manual }); + } else { + await this.fileService.createFile(uri, BinaryBuffer.wrap(data.content)); + } + } else { + throw new Error('Could find file: ' + path); + } + }); + connection.fs.onMkdir(async (_, path) => { + const uri = this.utils.getResourceUri(path); + if (uri) { + await this.fileService.createFolder(uri); + } else { + throw new Error('Could find path: ' + path); + } + }); + connection.fs.onDelete(async (_, path) => { + const uri = this.utils.getResourceUri(path); + if (uri) { + await this.fileService.delete(uri); + } else { + throw new Error('Could find entry: ' + path); + } + }); + connection.fs.onRename(async (_, from, to) => { + const fromUri = this.utils.getResourceUri(from); + const toUri = this.utils.getResourceUri(to); + if (fromUri && toUri) { + await this.fileService.move(fromUri, toUri); + } else { + throw new Error('Could find entries: ' + from + ' -> ' + to); + } + }); + connection.fs.onChange(async (_, event) => { + // Only guests need to handle file system changes + if (!this.isHost && this.fileSystem) { + const changes: FileChange[] = []; + for (const change of event.changes) { + const uri = this.utils.getResourceUri(change.path); + if (uri) { + changes.push({ + type: change.type === types.FileChangeEventType.Create + ? FileChangeType.ADDED + : change.type === types.FileChangeEventType.Update + ? FileChangeType.UPDATED + : FileChangeType.DELETED, + resource: uri + }); + } + } + this.fileSystem.triggerEvent(changes); + } + }); + } + + protected rerenderPresence(...widgets: EditorWidget[]): void { + const decorations = new Map(); + const states = this.yjsAwareness.getStates() as Map; + for (const [clientID, state] of states.entries()) { + if (clientID === this.yjs.clientID) { + // Ignore own awareness state + continue; + } + const peer = state.peer; + if (!state.selection || !this.peers.has(peer)) { + continue; + } + if (!types.ClientTextSelection.is(state.selection)) { + continue; + } + const { path, textSelections } = state.selection; + const selection = textSelections[0]; + if (!selection) { + continue; + } + const uri = this.utils.getResourceUri(path); + if (uri) { + const model = this.getModel(uri); + if (model) { + let existing = decorations.get(path); + if (!existing) { + existing = []; + decorations.set(path, existing); + } + const forward = selection.direction === types.SelectionDirection.LeftToRight; + let startIndex = Y.createAbsolutePositionFromRelativePosition(selection.start, this.yjs); + let endIndex = Y.createAbsolutePositionFromRelativePosition(selection.end, this.yjs); + if (startIndex && endIndex) { + if (startIndex.index > endIndex.index) { + [startIndex, endIndex] = [endIndex, startIndex]; + } + const start = model.positionAt(startIndex.index); + const end = model.positionAt(endIndex.index); + const inverted = (forward && end.line === 0) || (!forward && start.line === 0); + const range = { + start, + end + }; + const contentClassNames: string[] = [COLLABORATION_SELECTION_MARKER, `${COLLABORATION_SELECTION_MARKER}-${peer}`]; + if (inverted) { + contentClassNames.push(COLLABORATION_SELECTION_INVERTED); + } + const item: EditorDecoration = { + range, + options: { + className: `${COLLABORATION_SELECTION} ${COLLABORATION_SELECTION}-${peer}`, + beforeContentClassName: !forward ? contentClassNames.join(' ') : undefined, + afterContentClassName: forward ? contentClassNames.join(' ') : undefined, + stickiness: TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges + } + }; + existing.push(item); + } + } + } + } + this.rerenderPresenceDecorations(decorations, ...widgets); + } + + protected rerenderPresenceDecorations(decorations: Map, ...widgets: EditorWidget[]): void { + for (const editor of new Set(this.getOpenEditors().concat(widgets))) { + const uri = editor.getResourceUri(); + const path = this.utils.getProtocolPath(uri); + if (path) { + const old = this.editorDecorations.get(editor) ?? []; + this.editorDecorations.set(editor, editor.editor.deltaDecorations({ + newDecorations: decorations.get(path) ?? [], + oldDecorations: old + })); + } + } + } + + protected registerFileSystemChanges(): void { + // Event listener for disk based events + this.fileService.onDidFilesChange(event => { + const changes: types.FileChange[] = []; + for (const change of event.changes) { + const path = this.utils.getProtocolPath(change.resource); + if (path) { + let type: types.FileChangeEventType | undefined; + if (change.type === FileChangeType.ADDED) { + type = types.FileChangeEventType.Create; + } else if (change.type === FileChangeType.DELETED) { + type = types.FileChangeEventType.Delete; + } + // Updates to files on disk are not sent + if (type !== undefined) { + changes.push({ + path, + type + }); + } + } + } + if (changes.length) { + this.options.connection.fs.change({ changes }); + } + }); + // Event listener for user based events + this.fileService.onDidRunOperation(operation => { + const path = this.utils.getProtocolPath(operation.resource); + if (!path) { + return; + } + let type = types.FileChangeEventType.Update; + if (operation.isOperation(FileOperation.CREATE) || operation.isOperation(FileOperation.COPY)) { + type = types.FileChangeEventType.Create; + } else if (operation.isOperation(FileOperation.DELETE)) { + type = types.FileChangeEventType.Delete; + } + this.options.connection.fs.change({ + changes: [{ + path, + type + }] + }); + }); + } + + protected async registerPresenceUpdate(widget: EditorWidget): Promise { + const uri = widget.getResourceUri(); + const path = this.utils.getProtocolPath(uri); + if (path) { + if (!this.isHost) { + this.options.connection.editor.open(this.host.id, path); + } + let currentSelection = widget.editor.selection; + // // Update presence information when the selection changes + const selectionChange = widget.editor.onSelectionChanged(selection => { + if (!this.rangeEqual(currentSelection, selection)) { + this.updateEditorPresence(widget); + currentSelection = selection; + } + }); + const widgetDispose = widget.onDidDispose(() => { + widgetDispose.dispose(); + selectionChange.dispose(); + // Remove presence information when the editor closes + const state = this.yjsAwareness.getLocalState(); + if (state?.currentSelection?.path === path) { + delete state.currentSelection; + } + this.yjsAwareness.setLocalState(state); + }); + this.toDispose.push(selectionChange); + this.toDispose.push(widgetDispose); + this.rerenderPresence(widget); + } + } + + protected updateEditorPresence(widget: EditorWidget): void { + const uri = widget.getResourceUri(); + const path = this.utils.getProtocolPath(uri); + if (path) { + const ytext = this.yjs.getText(path); + const selection = widget.editor.selection; + let start = widget.editor.document.offsetAt(selection.start); + let end = widget.editor.document.offsetAt(selection.end); + if (start > end) { + [start, end] = [end, start]; + } + const direction = selection.direction === 'ltr' + ? types.SelectionDirection.LeftToRight + : types.SelectionDirection.RightToLeft; + const editorSelection: types.RelativeTextSelection = { + start: Y.createRelativePositionFromTypeIndex(ytext, start), + end: Y.createRelativePositionFromTypeIndex(ytext, end), + direction + }; + const textSelection: types.ClientTextSelection = { + path, + textSelections: [editorSelection] + }; + this.setSharedSelection(textSelection); + } + } + + protected setSharedSelection(selection?: types.ClientSelection): void { + this.yjsAwareness.setLocalStateField('selection', selection); + } + + protected rangeEqual(a: Range, b: Range): boolean { + return a.start.line === b.start.line + && a.start.character === b.start.character + && a.end.line === b.end.line + && a.end.character === b.end.character; + } + + async initialize(data: types.InitData): Promise { + this.permissions = data.permissions; + this.readonly = data.permissions.readonly; + for (const peer of [...data.guests, data.host]) { + this.addPeer(peer); + } + this.fileSystem = new CollaborationFileSystemProvider(this.options.connection, data.host, this.yjs); + this.fileSystem.readonly = this.readonly; + this.toDispose.push(this.fileService.registerProvider(CollaborationURI.scheme, this.fileSystem)); + const workspaceDisposable = await this.workspaceService.setHostWorkspace(data.workspace, this.options.connection); + this.toDispose.push(workspaceDisposable); + } + + protected addPeer(peer: types.Peer): void { + const collection = new DisposableCollection(); + collection.push(this.createPeerStyleSheet(peer)); + collection.push(Disposable.create(() => this.peers.delete(peer.id))); + const disposablePeer = { + peer, + dispose: () => collection.dispose() + }; + this.peers.set(peer.id, disposablePeer); + } + + protected createPeerStyleSheet(peer: types.Peer): Disposable { + const style = DecorationStyle.createStyleElement(`${peer.id}-collaboration-selection`); + const colors = this.collaborationColorService.getColors(); + const sheet = style.sheet!; + const color = colors[this.colorIndex++ % colors.length]; + const colorString = `rgb(${color.r}, ${color.g}, ${color.b})`; + sheet.insertRule(` + .${COLLABORATION_SELECTION}-${peer.id} { + opacity: 0.2; + background: ${colorString}; + } + `); + sheet.insertRule(` + .${COLLABORATION_SELECTION_MARKER}-${peer.id} { + background: ${colorString}; + border-color: ${colorString}; + }` + ); + sheet.insertRule(` + .${COLLABORATION_SELECTION_MARKER}-${peer.id}::after { + content: "${peer.name}"; + background: ${colorString}; + color: ${this.collaborationColorService.requiresDarkFont(color) + ? this.collaborationColorService.dark + : this.collaborationColorService.light}; + z-index: ${(100 + this.colorIndex).toFixed()} + }` + ); + return Disposable.create(() => style.remove()); + } + + protected getOpenEditors(uri?: URI): EditorWidget[] { + const widgets = this.shell.widgets; + let editors = widgets.filter(e => e instanceof EditorWidget) as EditorWidget[]; + if (uri) { + const uriString = uri.toString(); + editors = editors.filter(e => e.getResourceUri()?.toString() === uriString); + } + return editors; + } + + protected createSelectionFromRelative(selection: types.RelativeTextSelection, model: MonacoEditorModel): Selection | undefined { + const start = Y.createAbsolutePositionFromRelativePosition(selection.start, this.yjs); + const end = Y.createAbsolutePositionFromRelativePosition(selection.end, this.yjs); + if (start && end) { + return { + start: model.positionAt(start.index), + end: model.positionAt(end.index), + direction: selection.direction === types.SelectionDirection.LeftToRight ? 'ltr' : 'rtl' + }; + } + return undefined; + } + + protected createRelativeSelection(selection: Selection, model: TextEditorDocument, ytext: Y.Text): types.RelativeTextSelection { + const start = Y.createRelativePositionFromTypeIndex(ytext, model.offsetAt(selection.start)); + const end = Y.createRelativePositionFromTypeIndex(ytext, model.offsetAt(selection.end)); + return { + start, + end, + direction: selection.direction === 'ltr' + ? types.SelectionDirection.LeftToRight + : types.SelectionDirection.RightToLeft + }; + } + + protected readonly yjsMutex = createMutex(); + + protected registerModelUpdate(model: MonacoEditorModel): void { + let updating = false; + const modelPath = this.utils.getProtocolPath(new URI(model.uri)); + if (!modelPath) { + return; + } + const unknownModel = !this.yjs.share.has(modelPath); + const ytext = this.yjs.getText(modelPath); + const modelText = model.textEditorModel.getValue(); + if (this.isHost && unknownModel) { + // If we are hosting the room, set the initial content + // First off, reset the shared content to be empty + // This has the benefit of effectively clearing the memory of the shared content across all peers + // This is important because the shared content accumulates changes/memory usage over time + this.resetYjsText(ytext, modelText); + } else { + this.options.connection.editor.open(this.host.id, modelPath); + } + // The Ytext instance is our source of truth for the model content + // Sometimes (especially after a lot of sequential undo/redo operations) our model content can get out of sync + // This resyncs the model content with the Ytext content after a delay + const resyncDebounce = debounce(() => { + this.yjsMutex(() => { + const newContent = ytext.toString(); + if (model.textEditorModel.getValue() !== newContent) { + updating = true; + this.softReplaceModel(model, newContent); + updating = false; + } + }); + }, 200); + const disposable = new DisposableCollection(); + disposable.push(model.onDidChangeContent(e => { + if (updating) { + return; + } + this.yjsMutex(() => { + this.yjs.transact(() => { + for (const change of e.contentChanges) { + ytext.delete(change.rangeOffset, change.rangeLength); + ytext.insert(change.rangeOffset, change.text); + } + }); + resyncDebounce(); + }); + })); + + const observer = (textEvent: Y.YTextEvent) => { + if (textEvent.transaction.local || model.getText() === ytext.toString()) { + // Ignore local changes and changes that are already reflected in the model + return; + } + this.yjsMutex(() => { + updating = true; + try { + let index = 0; + const operations: { range: MonacoRange, text: string }[] = []; + textEvent.delta.forEach(delta => { + if (delta.retain !== undefined) { + index += delta.retain; + } else if (delta.insert !== undefined) { + const pos = model.textEditorModel.getPositionAt(index); + const range = new MonacoRange(pos.lineNumber, pos.column, pos.lineNumber, pos.column); + const insert = delta.insert as string; + operations.push({ range, text: insert }); + index += insert.length; + } else if (delta.delete !== undefined) { + const pos = model.textEditorModel.getPositionAt(index); + const endPos = model.textEditorModel.getPositionAt(index + delta.delete); + const range = new MonacoRange(pos.lineNumber, pos.column, endPos.lineNumber, endPos.column); + operations.push({ range, text: '' }); + } + }); + this.pushChangesToModel(model, operations); + } catch (err) { + console.error(err); + } + resyncDebounce(); + updating = false; + }); + }; + + ytext.observe(observer); + disposable.push(Disposable.create(() => ytext.unobserve(observer))); + model.onDispose(() => disposable.dispose()); + } + + protected resetYjsText(yjsText: Y.Text, text: string): void { + this.yjs.transact(() => { + yjsText.delete(0, yjsText.length); + yjsText.insert(0, text); + }); + } + + protected getModel(uri: URI): MonacoEditorModel | undefined { + const existing = this.monacoModelService.models.find(e => e.uri === uri.toString()); + if (existing) { + return existing; + } else { + return undefined; + } + } + + protected pushChangesToModel(model: MonacoEditorModel, changes: { range: MonacoRange, text: string, forceMoveMarkers?: boolean }[]): void { + const editor = MonacoEditor.findByDocument(this.editorManager, model)[0]; + const cursorState = editor?.getControl().getSelections() ?? []; + model.textEditorModel.pushStackElement(); + try { + model.textEditorModel.pushEditOperations(cursorState, changes, () => cursorState); + model.textEditorModel.pushStackElement(); + } catch (err) { + console.error(err); + } + } + + protected softReplaceModel(model: MonacoEditorModel, text: string): void { + this.pushChangesToModel(model, [{ + range: model.textEditorModel.getFullModelRange(), + text, + forceMoveMarkers: false + }]); + } + + protected async openUri(uri: URI): Promise { + const ref = await this.monacoModelService.createModelReference(uri); + if (ref.object) { + this.toDispose.push(ref); + } else { + ref.dispose(); + } + } + + dispose(): void { + for (const peer of this.peers.values()) { + peer.dispose(); + } + this.onDidCloseEmitter.fire(); + this.toDispose.dispose(); + } +} diff --git a/packages/collaboration/src/browser/collaboration-utils.ts b/packages/collaboration/src/browser/collaboration-utils.ts new file mode 100644 index 0000000..c139803 --- /dev/null +++ b/packages/collaboration/src/browser/collaboration-utils.ts @@ -0,0 +1,59 @@ +// ***************************************************************************** +// Copyright (C) 2024 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { URI } from '@theia/core'; +import { inject, injectable } from '@theia/core/shared/inversify'; +import { CollaborationWorkspaceService } from './collaboration-workspace-service'; + +@injectable() +export class CollaborationUtils { + + @inject(CollaborationWorkspaceService) + protected readonly workspaceService: CollaborationWorkspaceService; + + getProtocolPath(uri?: URI): string | undefined { + if (!uri) { + return undefined; + } + const path = uri.path.toString(); + const roots = this.workspaceService.tryGetRoots(); + for (const root of roots) { + const rootUri = root.resource.path.toString() + '/'; + if (path.startsWith(rootUri)) { + return root.name + '/' + path.substring(rootUri.length); + } + } + return undefined; + } + + getResourceUri(path?: string): URI | undefined { + if (!path) { + return undefined; + } + const parts = path.split('/'); + const root = parts[0]; + const rest = parts.slice(1); + const stat = this.workspaceService.tryGetRoots().find(e => e.name === root); + if (stat) { + const uriPath = stat.resource.path.join(...rest); + const uri = stat.resource.withPath(uriPath); + return uri; + } else { + return undefined; + } + } + +} diff --git a/packages/collaboration/src/browser/collaboration-workspace-service.ts b/packages/collaboration/src/browser/collaboration-workspace-service.ts new file mode 100644 index 0000000..ac1cd59 --- /dev/null +++ b/packages/collaboration/src/browser/collaboration-workspace-service.ts @@ -0,0 +1,69 @@ +// ***************************************************************************** +// Copyright (C) 2024 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { nls } from '@theia/core'; +import { injectable } from '@theia/core/shared/inversify'; +import { Disposable } from '@theia/core/shared/vscode-languageserver-protocol'; +import { FileStat } from '@theia/filesystem/lib/common/files'; +import { WorkspaceService } from '@theia/workspace/lib/browser'; +import { Workspace, ProtocolBroadcastConnection } from 'open-collaboration-protocol'; +import { CollaborationURI } from './collaboration-file-system-provider'; + +@injectable() +export class CollaborationWorkspaceService extends WorkspaceService { + + protected collabWorkspace?: Workspace; + protected connection?: ProtocolBroadcastConnection; + + async setHostWorkspace(workspace: Workspace, connection: ProtocolBroadcastConnection): Promise { + this.collabWorkspace = workspace; + this.connection = connection; + await this.setWorkspace({ + isDirectory: false, + isFile: true, + isReadonly: false, + isSymbolicLink: false, + name: nls.localize('theia/collaboration/collaborationWorkspace', 'Collaboration Workspace'), + resource: CollaborationURI.create(this.collabWorkspace) + }); + return Disposable.create(() => { + this.collabWorkspace = undefined; + this.connection = undefined; + this.setWorkspace(undefined); + }); + } + + protected override async computeRoots(): Promise { + if (this.collabWorkspace) { + return this.collabWorkspace.folders.map(e => this.entryToStat(e)); + } else { + return super.computeRoots(); + } + } + + protected entryToStat(entry: string): FileStat { + const uri = CollaborationURI.create(this.collabWorkspace!, entry); + return { + resource: uri, + name: entry, + isDirectory: true, + isFile: false, + isReadonly: false, + isSymbolicLink: false + }; + } + +} diff --git a/packages/collaboration/src/browser/style/index.css b/packages/collaboration/src/browser/style/index.css new file mode 100644 index 0000000..1d1eac5 --- /dev/null +++ b/packages/collaboration/src/browser/style/index.css @@ -0,0 +1,22 @@ +.theia-collaboration-selection-marker { + position: absolute; + content: " "; + border-right: solid 2px; + border-top: solid 2px; + border-bottom: solid 2px; + height: 100%; + box-sizing: border-box; +} + +.theia-collaboration-selection-marker::after { + position: absolute; + transform: translateY(-100%); + padding: 0 4px; + border-radius: 4px 4px 4px 0px; +} + +.theia-collaboration-selection-marker.theia-collaboration-selection-inverted::after { + transform: translateY(100%); + margin-top: -2px; + border-radius: 0px 4px 4px 4px; +} diff --git a/packages/collaboration/src/common/collaboration-preferences.ts b/packages/collaboration/src/common/collaboration-preferences.ts new file mode 100644 index 0000000..d5ee635 --- /dev/null +++ b/packages/collaboration/src/common/collaboration-preferences.ts @@ -0,0 +1,29 @@ +// ***************************************************************************** +// Copyright (C) 2025 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { nls, PreferenceSchema } from '@theia/core'; + +export const collaborationPreferencesSchema: PreferenceSchema = { + properties: { + 'collaboration.serverUrl': { + type: 'string', + default: 'https://api.open-collab.tools/', + title: nls.localize('theia/collaboration/serverUrl', 'Server URL'), + description: nls.localize('theia/collaboration/serverUrlDescription', 'URL of the Open Collaboration Tools Server instance for live collaboration sessions'), + }, + }, + title: nls.localize('theia/collaboration/collaboration', 'Collaboration'), +}; diff --git a/packages/collaboration/src/node/collaboration-backend-module.ts b/packages/collaboration/src/node/collaboration-backend-module.ts new file mode 100644 index 0000000..d36ceb5 --- /dev/null +++ b/packages/collaboration/src/node/collaboration-backend-module.ts @@ -0,0 +1,23 @@ +// ***************************************************************************** +// Copyright (C) 2025 STMicroelectronics and others +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { PreferenceContribution } from '@theia/core'; +import { ContainerModule } from '@theia/core/shared/inversify'; +import { collaborationPreferencesSchema } from '../common/collaboration-preferences'; + +export default new ContainerModule(bind => { + bind(PreferenceContribution).toConstantValue({ schema: collaborationPreferencesSchema }); +}); diff --git a/packages/collaboration/src/package.spec.ts b/packages/collaboration/src/package.spec.ts new file mode 100644 index 0000000..4e6f3ab --- /dev/null +++ b/packages/collaboration/src/package.spec.ts @@ -0,0 +1,28 @@ +// ***************************************************************************** +// Copyright (C) 2023 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +/* note: this bogus test file is required so that + we are able to run mocha unit tests on this + package, without having any actual unit tests in it. + This way a coverage report will be generated, + showing 0% coverage, instead of no report. + This file can be removed once we have real unit + tests in place. */ + +describe('request package', () => { + + it('should support code coverage statistics', () => true); +}); diff --git a/packages/collaboration/tsconfig.json b/packages/collaboration/tsconfig.json new file mode 100644 index 0000000..5920c2d --- /dev/null +++ b/packages/collaboration/tsconfig.json @@ -0,0 +1,28 @@ +{ + "extends": "../../configs/base.tsconfig", + "compilerOptions": { + "composite": true, + "rootDir": "src", + "outDir": "lib" + }, + "include": [ + "src" + ], + "references": [ + { + "path": "../core" + }, + { + "path": "../editor" + }, + { + "path": "../filesystem" + }, + { + "path": "../monaco" + }, + { + "path": "../workspace" + } + ] +} diff --git a/packages/console/.eslintrc.js b/packages/console/.eslintrc.js new file mode 100644 index 0000000..1308994 --- /dev/null +++ b/packages/console/.eslintrc.js @@ -0,0 +1,10 @@ +/** @type {import('eslint').Linter.Config} */ +module.exports = { + extends: [ + '../../configs/build.eslintrc.json' + ], + parserOptions: { + tsconfigRootDir: __dirname, + project: 'tsconfig.json' + } +}; diff --git a/packages/console/README.md b/packages/console/README.md new file mode 100644 index 0000000..85e7b64 --- /dev/null +++ b/packages/console/README.md @@ -0,0 +1,31 @@ +
    + +
    + +theia-ext-logo + +

    ECLIPSE THEIA - CONSOLE EXTENSION

    + +
    + +
    + +## Description + +The `@theia/console` extension contributes a `console` widget which is used to evaluate expressions (in the form of REPL [(Read-Eval-Print-Loop)](https://en.wikipedia.org/wiki/Read%E2%80%93eval%E2%80%93print_loop)) when debugging. + +## Additional Information + +- [API documentation for `@theia/console`](https://eclipse-theia.github.io/theia/docs/next/modules/_theia_console.html) +- [Theia - GitHub](https://github.com/eclipse-theia/theia) +- [Theia - Website](https://theia-ide.org/) + +## License + +- [Eclipse Public License 2.0](http://www.eclipse.org/legal/epl-2.0/) +- [一 (Secondary) GNU General Public License, version 2 with the GNU Classpath Exception](https://projects.eclipse.org/license/secondary-gpl-2.0-cp) + +## Trademark + +"Theia" is a trademark of the Eclipse Foundation + diff --git a/packages/console/package.json b/packages/console/package.json new file mode 100644 index 0000000..d9dcb16 --- /dev/null +++ b/packages/console/package.json @@ -0,0 +1,52 @@ +{ + "name": "@theia/console", + "version": "1.68.0", + "description": "Theia - Console Extension", + "dependencies": { + "@theia/core": "1.68.0", + "@theia/editor": "1.68.0", + "@theia/monaco": "1.68.0", + "@theia/monaco-editor-core": "1.96.302", + "anser": "^2.0.1", + "tslib": "^2.6.2" + }, + "publishConfig": { + "access": "public" + }, + "theiaExtensions": [ + { + "frontend": "lib/browser/console-frontend-module" + } + ], + "keywords": [ + "theia-extension" + ], + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "repository": { + "type": "git", + "url": "https://github.com/eclipse-theia/theia.git" + }, + "bugs": { + "url": "https://github.com/eclipse-theia/theia/issues" + }, + "homepage": "https://github.com/eclipse-theia/theia", + "files": [ + "lib", + "src" + ], + "scripts": { + "build": "theiaext build", + "clean": "theiaext clean", + "compile": "theiaext compile", + "lint": "theiaext lint", + "test": "theiaext test", + "watch": "theiaext watch" + }, + "devDependencies": { + "@theia/ext-scripts": "1.68.0" + }, + "nyc": { + "extends": "../../configs/nyc.json" + }, + "gitHead": "21358137e41342742707f660b8e222f940a27652" +} diff --git a/packages/console/src/browser/ansi-console-item.tsx b/packages/console/src/browser/ansi-console-item.tsx new file mode 100644 index 0000000..9c57cad --- /dev/null +++ b/packages/console/src/browser/ansi-console-item.tsx @@ -0,0 +1,48 @@ +// ***************************************************************************** +// Copyright (C) 2018 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import * as React from '@theia/core/shared/react'; +import * as DOMPurify from '@theia/core/shared/dompurify'; +import { ConsoleItem } from './console-session'; +import { Severity } from '@theia/core/lib/common/severity'; +import Anser = require('anser'); + +export class AnsiConsoleItem implements ConsoleItem { + + protected readonly htmlContent: string; + + constructor( + public readonly content: string, + public readonly severity?: Severity + ) { + this.htmlContent = new Anser().ansiToHtml(this.content, { + use_classes: true, + remove_empty: true + }); + } + + get visible(): boolean { + return !!this.htmlContent; + } + + render(): React.ReactNode { + return
    ; + } + +} diff --git a/packages/console/src/browser/console-content-widget.tsx b/packages/console/src/browser/console-content-widget.tsx new file mode 100644 index 0000000..19eac7e --- /dev/null +++ b/packages/console/src/browser/console-content-widget.tsx @@ -0,0 +1,68 @@ +// ***************************************************************************** +// Copyright (C) 2018 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { interfaces, Container, injectable } from '@theia/core/shared/inversify'; +import { MenuPath } from '@theia/core'; +import { TreeProps } from '@theia/core/lib/browser/tree'; +import { SourceTreeWidget, TreeElementNode } from '@theia/core/lib/browser/source-tree'; +import { ConsoleItem } from './console-session'; +import { Severity } from '@theia/core/lib/common/severity'; + +@injectable() +export class ConsoleContentWidget extends SourceTreeWidget { + + static CONTEXT_MENU: MenuPath = ['console-context-menu']; + + static override createContainer(parent: interfaces.Container, props?: Partial): Container { + const child = SourceTreeWidget.createContainer(parent, { + contextMenuPath: ConsoleContentWidget.CONTEXT_MENU, + viewProps: { + followOutput: true + }, + ...props + }); + child.unbind(SourceTreeWidget); + child.bind(ConsoleContentWidget).toSelf(); + return child; + } + + protected override createTreeElementNodeClassNames(node: TreeElementNode): string[] { + const classNames = super.createTreeElementNodeClassNames(node); + if (node.element) { + const className = this.toClassName((node.element as ConsoleItem)); + if (className) { + classNames.push(className); + } + } + return classNames; + } + protected toClassName(item: ConsoleItem): string | undefined { + if (item.severity === Severity.Error) { + return ConsoleItem.errorClassName; + } + if (item.severity === Severity.Warning) { + return ConsoleItem.warningClassName; + } + if (item.severity === Severity.Info) { + return ConsoleItem.infoClassName; + } + if (item.severity === Severity.Log) { + return ConsoleItem.logClassName; + } + return undefined; + } + +} diff --git a/packages/console/src/browser/console-contribution.ts b/packages/console/src/browser/console-contribution.ts new file mode 100644 index 0000000..163d87b --- /dev/null +++ b/packages/console/src/browser/console-contribution.ts @@ -0,0 +1,143 @@ +// ***************************************************************************** +// Copyright (C) 2018 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { injectable, inject } from '@theia/core/shared/inversify'; +import { Command, CommandContribution, CommandRegistry, MenuContribution, MenuModelRegistry, CommandHandler } from '@theia/core'; +import { FrontendApplicationContribution, KeybindingContribution, KeybindingRegistry, CommonCommands } from '@theia/core/lib/browser'; +import { ConsoleManager } from './console-manager'; +import { ConsoleWidget } from './console-widget'; +import { ConsoleContentWidget } from './console-content-widget'; +import { nls } from '@theia/core/lib/common/nls'; + +export namespace ConsoleCommands { + export const SELECT_ALL: Command = { + id: 'console.selectAll' + }; + export const COLLAPSE_ALL: Command = { + id: 'console.collapseAll' + }; + export const CLEAR: Command = { + id: 'console.clear' + }; + export const EXECUTE: Command = { + id: 'console.execute' + }; + export const NAVIGATE_BACK: Command = { + id: 'console.navigatePrevious' + }; + export const NAVIGATE_FORWARD: Command = { + id: 'console.navigateNext' + }; +} + +export namespace ConsoleContextMenu { + export const CLIPBOARD = [...ConsoleContentWidget.CONTEXT_MENU, '1_clipboard']; + export const CLEAR = [...ConsoleContentWidget.CONTEXT_MENU, '2_clear']; +} + +@injectable() +export class ConsoleContribution implements FrontendApplicationContribution, CommandContribution, KeybindingContribution, MenuContribution { + + @inject(ConsoleManager) + protected readonly manager: ConsoleManager; + + initialize(): void { } + + registerCommands(commands: CommandRegistry): void { + commands.registerCommand(ConsoleCommands.SELECT_ALL, this.newCommandHandler(console => console.selectAll())); + commands.registerCommand(ConsoleCommands.COLLAPSE_ALL, this.newCommandHandler(console => console.collapseAll())); + commands.registerCommand(ConsoleCommands.CLEAR, this.newCommandHandler(console => console.clear())); + commands.registerCommand(ConsoleCommands.EXECUTE, this.newCommandHandler(console => console.execute())); + commands.registerCommand(ConsoleCommands.NAVIGATE_BACK, this.newCommandHandler(console => console.navigateBack())); + commands.registerCommand(ConsoleCommands.NAVIGATE_FORWARD, this.newCommandHandler(console => console.navigateForward())); + } + + registerKeybindings(keybindings: KeybindingRegistry): void { + keybindings.registerKeybinding({ + command: ConsoleCommands.SELECT_ALL.id, + keybinding: 'ctrlcmd+a', + when: 'consoleContentFocus' + }); + keybindings.registerKeybinding({ + command: ConsoleCommands.EXECUTE.id, + keybinding: 'enter', + when: 'consoleInputFocus' + }); + keybindings.registerKeybinding({ + command: ConsoleCommands.NAVIGATE_BACK.id, + keybinding: 'up', + when: 'consoleInputFocus && consoleNavigationBackEnabled' + }); + keybindings.registerKeybinding({ + command: ConsoleCommands.NAVIGATE_FORWARD.id, + keybinding: 'down', + when: 'consoleInputFocus && consoleNavigationForwardEnabled' + }); + } + + registerMenus(menus: MenuModelRegistry): void { + menus.registerMenuAction(ConsoleContextMenu.CLIPBOARD, { + commandId: CommonCommands.COPY.id, + label: CommonCommands.COPY.label, + order: 'a1', + }); + menus.registerMenuAction(ConsoleContextMenu.CLIPBOARD, { + commandId: ConsoleCommands.SELECT_ALL.id, + label: CommonCommands.SELECT_ALL.label, + order: 'a2' + }); + menus.registerMenuAction(ConsoleContextMenu.CLIPBOARD, { + commandId: ConsoleCommands.COLLAPSE_ALL.id, + label: nls.localizeByDefault('Collapse All'), + order: 'a3' + }); + menus.registerMenuAction(ConsoleContextMenu.CLEAR, { + commandId: ConsoleCommands.CLEAR.id, + label: nls.localizeByDefault('Clear Console') + }); + } + + protected newCommandHandler(execute: ConsoleExecuteFunction): ConsoleCommandHandler { + return new ConsoleCommandHandler(this.manager, execute); + } + +} +// eslint-disable-next-line @typescript-eslint/no-explicit-any +export type ConsoleExecuteFunction = (console: ConsoleWidget, ...args: any[]) => any; +export class ConsoleCommandHandler implements CommandHandler { + + constructor( + protected readonly manager: ConsoleManager, + protected readonly doExecute: ConsoleExecuteFunction + ) { } + + isEnabled(): boolean { + return !!this.manager.currentConsole; + } + + isVisible(): boolean { + return !!this.manager.currentConsole; + } + + // eslint-disable-next-line @typescript-eslint/no-explicit-any + execute(...args: any[]): any { + const { currentConsole } = this.manager; + if (currentConsole) { + return this.doExecute(currentConsole, ...args); + } + } + +} diff --git a/packages/console/src/browser/console-frontend-module.ts b/packages/console/src/browser/console-frontend-module.ts new file mode 100644 index 0000000..899417c --- /dev/null +++ b/packages/console/src/browser/console-frontend-module.ts @@ -0,0 +1,32 @@ +// ***************************************************************************** +// Copyright (C) 2018 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { ContainerModule } from '@theia/core/shared/inversify'; +import { CommandContribution, MenuContribution } from '@theia/core'; +import { FrontendApplicationContribution, KeybindingContribution } from '@theia/core/lib/browser'; +import { ConsoleContribution } from './console-contribution'; +import { ConsoleManager } from './console-manager'; + +import '../../src/browser/style/index.css'; + +export default new ContainerModule(bind => { + bind(ConsoleManager).toSelf().inSingletonScope(); + bind(ConsoleContribution).toSelf().inSingletonScope(); + bind(FrontendApplicationContribution).toService(ConsoleContribution); + bind(CommandContribution).toService(ConsoleContribution); + bind(KeybindingContribution).toService(ConsoleContribution); + bind(MenuContribution).toService(ConsoleContribution); +}); diff --git a/packages/console/src/browser/console-history.ts b/packages/console/src/browser/console-history.ts new file mode 100644 index 0000000..af51b36 --- /dev/null +++ b/packages/console/src/browser/console-history.ts @@ -0,0 +1,76 @@ +// ***************************************************************************** +// Copyright (C) 2018 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { injectable } from '@theia/core/shared/inversify'; + +@injectable() +export class ConsoleHistory { + + static limit = 50; + + protected values: string[] = []; + protected index = -1; + + push(value: string): void { + this.delete(value); + this.values.push(value); + this.trim(); + this.index = this.values.length; + } + protected delete(value: string): void { + const index = this.values.indexOf(value); + if (index !== -1) { + this.values.splice(index, 1); + } + } + protected trim(): void { + const index = this.values.length - ConsoleHistory.limit; + if (index > 0) { + this.values = this.values.slice(index); + } + } + + get current(): string | undefined { + return this.values[this.index]; + } + + get previous(): string | undefined { + this.index = Math.max(this.index - 1, -1); + return this.current; + } + + get next(): string | undefined { + this.index = Math.min(this.index + 1, this.values.length); + return this.current; + } + + store(): ConsoleHistory.Data { + const { values, index } = this; + return { values, index }; + } + + restore(object: ConsoleHistory): void { + this.values = object.values; + this.index = object.index; + } + +} +export namespace ConsoleHistory { + export interface Data { + values: string[], + index: number + } +} diff --git a/packages/console/src/browser/console-manager.ts b/packages/console/src/browser/console-manager.ts new file mode 100644 index 0000000..30d4cfe --- /dev/null +++ b/packages/console/src/browser/console-manager.ts @@ -0,0 +1,37 @@ +// ***************************************************************************** +// Copyright (C) 2018 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { injectable, inject } from '@theia/core/shared/inversify'; +import { ApplicationShell } from '@theia/core/lib/browser'; +import { ConsoleWidget } from './console-widget'; + +@injectable() +export class ConsoleManager { + + @inject(ApplicationShell) + protected readonly shell: ApplicationShell; + + get activeConsole(): ConsoleWidget | undefined { + const widget = this.shell.activeWidget; + return widget instanceof ConsoleWidget ? widget : undefined; + } + + get currentConsole(): ConsoleWidget | undefined { + const widget = this.shell.currentWidget; + return widget instanceof ConsoleWidget ? widget : undefined; + } + +} diff --git a/packages/console/src/browser/console-session-manager.ts b/packages/console/src/browser/console-session-manager.ts new file mode 100644 index 0000000..2ff2423 --- /dev/null +++ b/packages/console/src/browser/console-session-manager.ts @@ -0,0 +1,121 @@ +// ***************************************************************************** +// Copyright (C) 2021 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { injectable } from '@theia/core/shared/inversify'; +import { Emitter, Event, Disposable, DisposableCollection } from '@theia/core'; +import { ConsoleSession } from './console-session'; +import { Severity } from '@theia/core/lib/common/severity'; + +@injectable() +export class ConsoleSessionManager implements Disposable { + + protected readonly sessions = new Map(); + protected _selectedSession: ConsoleSession | undefined; + protected _severity: Severity | undefined; + + protected readonly sessionAddedEmitter = new Emitter(); + protected readonly sessionDeletedEmitter = new Emitter(); + protected readonly sessionWasShownEmitter = new Emitter(); + protected readonly sessionWasHiddenEmitter = new Emitter(); + protected readonly selectedSessionChangedEmitter = new Emitter(); + protected readonly severityChangedEmitter = new Emitter(); + + get onDidAddSession(): Event { + return this.sessionAddedEmitter.event; + } + get onDidDeleteSession(): Event { + return this.sessionDeletedEmitter.event; + } + get onDidShowSession(): Event { + return this.sessionWasShownEmitter.event; + } + get onDidHideSession(): Event { + return this.sessionWasHiddenEmitter.event; + } + get onDidChangeSelectedSession(): Event { + return this.selectedSessionChangedEmitter.event; + } + get onDidChangeSeverity(): Event { + return this.severityChangedEmitter.event; + } + + protected readonly toDispose = new DisposableCollection(); + protected readonly toDisposeOnSessionDeletion = new Map(); + + dispose(): void { + this.toDispose.dispose(); + } + + get severity(): Severity | undefined { + return this._severity; + } + + set severity(value: Severity | undefined) { + value = value || Severity.Ignore; + this._severity = value; + for (const session of this.sessions.values()) { + session.severity = value; + } + this.severityChangedEmitter.fire(undefined); + } + + get all(): ConsoleSession[] { + return Array.from(this.sessions.values()); + } + + get selectedSession(): ConsoleSession | undefined { + return this._selectedSession; + } + + set selectedSession(session: ConsoleSession | undefined) { + const oldSession = this.selectedSession; + this._selectedSession = session; + this.selectedSessionChangedEmitter.fire(session); + if (oldSession !== session) { + if (oldSession) { + this.sessionWasHiddenEmitter.fire(oldSession); + } + if (session) { + this.sessionWasShownEmitter.fire(session); + } + } + } + + get(id: string): ConsoleSession | undefined { + return this.sessions.get(id); + } + + add(session: ConsoleSession): void { + this.sessions.set(session.id, session); + this.sessionAddedEmitter.fire(session); + if (this.sessions.size === 1) { + this.selectedSession = session; + } + } + + delete(id: string): void { + const session = this.sessions.get(id); + if (this.sessions.delete(id) && session) { + if (this.selectedSession === session) { + // select a new sessions or undefined if none are left + this.selectedSession = this.sessions.values().next().value; + } + session.dispose(); + this.sessionDeletedEmitter.fire(session); + } + } + +} diff --git a/packages/console/src/browser/console-session.ts b/packages/console/src/browser/console-session.ts new file mode 100644 index 0000000..f12480c --- /dev/null +++ b/packages/console/src/browser/console-session.ts @@ -0,0 +1,78 @@ +// ***************************************************************************** +// Copyright (C) 2018 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { injectable } from '@theia/core/shared/inversify'; +import { MaybePromise } from '@theia/core/lib/common/types'; +import { TreeSource, TreeElement, CompositeTreeElement } from '@theia/core/lib/browser/source-tree'; +import { Emitter, Event } from '@theia/core/lib/common/event'; +import { Severity } from '@theia/core/lib/common/severity'; + +export interface ConsoleItem extends TreeElement { + readonly severity?: Severity; +} +export namespace ConsoleItem { + export const errorClassName = 'theia-console-error'; + export const warningClassName = 'theia-console-warning'; + export const infoClassName = 'theia-console-info'; + export const logClassName = 'theia-console-log'; +} + +export interface CompositeConsoleItem extends ConsoleItem, CompositeTreeElement { + getElements(): MaybePromise> +} + +@injectable() +export abstract class ConsoleSession extends TreeSource { + protected selectedSeverity?: Severity; + protected filterTextValue?: string; + protected readonly selectionEmitter: Emitter = new Emitter(); + protected readonly filterEmitter: Emitter = new Emitter(); + readonly onSelectionChange: Event = this.selectionEmitter.event; + readonly onFilterChange: Event = this.filterEmitter.event; + override id: string; + + get severity(): Severity | undefined { + return this.selectedSeverity; + } + + set severity(severity: Severity | undefined) { + if (severity === this.selectedSeverity) { + return; + } + + this.selectedSeverity = severity; + this.selectionEmitter.fire(undefined); + this.fireDidChange(); + } + + get filterText(): string | undefined { + return this.filterTextValue; + } + + set filterText(value: string | undefined) { + const normalized = value?.trim() || undefined; + if (normalized === this.filterTextValue) { + return; + } + this.filterTextValue = normalized; + this.filterEmitter.fire(undefined); + this.fireDidChange(); + } + + abstract override getElements(): MaybePromise>; + abstract execute(value: string): MaybePromise; + abstract clear(): MaybePromise; +} diff --git a/packages/console/src/browser/console-widget.ts b/packages/console/src/browser/console-widget.ts new file mode 100644 index 0000000..2eef539 --- /dev/null +++ b/packages/console/src/browser/console-widget.ts @@ -0,0 +1,351 @@ +// ***************************************************************************** +// Copyright (C) 2018 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { ElementExt } from '@theia/core/shared/@lumino/domutils'; +import { injectable, inject, postConstruct, interfaces, Container } from '@theia/core/shared/inversify'; +import { TreeSourceNode } from '@theia/core/lib/browser/source-tree'; +import { ContextKeyService, ContextKey } from '@theia/core/lib/browser/context-key-service'; +import { BaseWidget, PanelLayout, Widget, Message, MessageLoop, StatefulWidget, CompositeTreeNode } from '@theia/core/lib/browser'; +import { MonacoEditor } from '@theia/monaco/lib/browser/monaco-editor'; +import URI from '@theia/core/lib/common/uri'; +import { MonacoEditorProvider } from '@theia/monaco/lib/browser/monaco-editor-provider'; +import { ConsoleHistory } from './console-history'; +import { ConsoleContentWidget } from './console-content-widget'; +import { ConsoleSession } from './console-session'; +import { ConsoleSessionManager } from './console-session-manager'; +import * as monaco from '@theia/monaco-editor-core'; +import { Disposable } from '@theia/core/lib/common/disposable'; +import { EditorManager } from '@theia/editor/lib/browser'; +import { MonacoEditorService } from '@theia/monaco/lib/browser/monaco-editor-service'; + +export const ConsoleOptions = Symbol('ConsoleWidgetOptions'); +export interface ConsoleOptions { + id: string + title?: { + label?: string + iconClass?: string + caption?: string + } + input: { + uri: URI + options?: MonacoEditor.IOptions + } + inputFocusContextKey?: ContextKey +} + +@injectable() +export class ConsoleWidget extends BaseWidget implements StatefulWidget { + + static styles = { + node: 'theia-console-widget', + content: 'theia-console-content', + input: 'theia-console-input', + }; + + static createContainer(parent: interfaces.Container, options: ConsoleOptions): Container { + const child = ConsoleContentWidget.createContainer(parent); + child.bind(ConsoleHistory).toSelf(); + child.bind(ConsoleOptions).toConstantValue(options); + child.bind(ConsoleWidget).toSelf(); + return child; + } + + @inject(ConsoleOptions) + protected readonly options: ConsoleOptions; + + @inject(ConsoleContentWidget) + readonly content: ConsoleContentWidget; + + @inject(ConsoleHistory) + protected readonly history: ConsoleHistory; + + @inject(ConsoleSessionManager) + protected readonly sessionManager: ConsoleSessionManager; + + @inject(MonacoEditorProvider) + protected readonly editorProvider: MonacoEditorProvider; + + @inject(ContextKeyService) + protected readonly contextKeyService: ContextKeyService; + + @inject(MonacoEditorService) + protected readonly editorService: MonacoEditorService; + + @inject(EditorManager) + protected readonly editorManager: EditorManager; + + protected _input: MonacoEditor; + protected _inputFocusContextKey: ContextKey; + protected modelChangeListener = Disposable.NULL; + + protected _ready: Promise | undefined; + get ready(): Promise { + if (!this._ready) { + throw new Error('ready must not be accessed in the construction phase'); + } + return this._ready; + } + + constructor() { + super(); + this.node.classList.add(ConsoleWidget.styles.node); + } + + @postConstruct() + protected init(): void { + this._ready = this.doInit(); + } + + protected async doInit(): Promise { + const { id, title, inputFocusContextKey } = this.options; + const { label, iconClass, caption } = Object.assign({}, title); + this.id = id; + this.title.closable = true; + this.title.label = label || id; + if (iconClass) { + this.title.iconClass = iconClass; + } + this.title.caption = caption || label || id; + + const layout = this.layout = new PanelLayout(); + + this.content.node.classList.add(ConsoleWidget.styles.content); + this.toDispose.push(this.content); + layout.addWidget(this.content); + + const inputWidget = new Widget(); + inputWidget.node.classList.add(ConsoleWidget.styles.input); + layout.addWidget(inputWidget); + + const input = this._input = await this.createInput(inputWidget.node); + this.toDispose.push(input); + this.toDispose.push(input.getControl().onDidLayoutChange(() => this.resizeContent())); + + this.toDispose.push(input.getControl().onDidChangeConfiguration(event => { + if (event.hasChanged(monaco.editor.EditorOption.fontInfo)) { + this.updateFont(); + } + })); + + this.session = this.sessionManager.selectedSession; + this.toDispose.push(this.sessionManager.onDidChangeSelectedSession(session => { + // Do not clear the session output when `undefined`. + if (session) { + this.session = session; + } + })); + + this.updateFont(); + if (inputFocusContextKey) { + this.toDispose.push(input.onFocusChanged(() => inputFocusContextKey.set(this.hasInputFocus()))); + this.toDispose.push(input.onCursorPositionChanged(() => input.getControl().createContextKey('consoleNavigationBackEnabled', this.consoleNavigationBackEnabled))); + this.toDispose.push(input.onCursorPositionChanged(() => input.getControl().createContextKey('consoleNavigationForwardEnabled', this.consoleNavigationForwardEnabled))); + } + input.getControl().createContextKey('consoleInputFocus', true); + const contentContext = this.contextKeyService.createScoped(this.content.node); + contentContext.setContext('consoleContentFocus', true); + + this.toDispose.pushAll([ + this.editorManager.onActiveEditorChanged(() => this.setMode()), + this.onDidChangeVisibility(() => this.setMode()) + ]); + } + + protected createInput(node: HTMLElement): Promise { + return this.editorProvider.createInline(this.options.input.uri, node, this.options.input.options); + } + + protected updateFont(): void { + const { fontFamily, fontSize, lineHeight } = this._input.getControl().getOption(monaco.editor.EditorOption.fontInfo); + this.content.node.style.fontFamily = fontFamily; + this.content.node.style.fontSize = fontSize + 'px'; + this.content.node.style.lineHeight = lineHeight + 'px'; + } + + protected _session: ConsoleSession | undefined; + set session(session: ConsoleSession | undefined) { + if (this._session === session) { + return; + } + this._session = session; + this.content.source = session; + } + get session(): ConsoleSession | undefined { + return this._session; + } + + get input(): MonacoEditor { + return this._input; + } + + get consoleNavigationBackEnabled(): boolean { + const editor = this.input.getControl(); + return !!editor.getPosition()!.equals({ lineNumber: 1, column: 1 }); + } + + get consoleNavigationForwardEnabled(): boolean { + const editor = this.input.getControl(); + const model = editor.getModel(); + if (!model) { + return false; + } + const lineNumber = editor.getModel()!.getLineCount(); + const column = editor.getModel()!.getLineMaxColumn(lineNumber); + return !!editor.getPosition()!.equals({ lineNumber, column }); + } + + selectAll(): void { + const selection = document.getSelection(); + if (selection) { + selection.selectAllChildren(this.content.node); + } + } + + collapseAll(): void { + const { root } = this.content.model; + if (CompositeTreeNode.is(root)) { + this.content.model.collapseAll(root); + } + } + + clear(): void { + if (this.session) { + this.session.clear(); + } + } + + async execute(value?: string): Promise { + if (value === undefined) { + value = this._input.getControl().getValue(); + this._input.getControl().setValue(''); + } + this.history.push(value); + if (this.session) { + const listener = this.content.model.onNodeRefreshed(() => { + listener.dispose(); + this.revealLastOutput(); + }); + await this.session.execute(value); + } + } + + navigateBack(): void { + const value = this.history.previous; + if (value === undefined) { + return; + } + const editor = this.input.getControl(); + editor.setValue(value); + editor.setPosition({ + lineNumber: 1, + column: 1 + }); + } + + navigateForward(): void { + const value = this.history.next || ''; + const editor = this.input.getControl(); + editor.setValue(value); + const lineNumber = editor.getModel()!.getLineCount(); + const column = editor.getModel()!.getLineMaxColumn(lineNumber); + editor.setPosition({ lineNumber, column }); + } + + protected revealLastOutput(): void { + const { root } = this.content.model; + if (TreeSourceNode.is(root)) { + this.content.model.selectNode(root.children[root.children.length - 1]); + } + } + + protected override onActivateRequest(msg: Message): void { + super.onActivateRequest(msg); + this._input.focus(); + } + + protected totalHeight = -1; + protected totalWidth = -1; + protected override onResize(msg: Widget.ResizeMessage): void { + super.onResize(msg); + this.totalWidth = msg.width; + this.totalHeight = msg.height; + this._input.resizeToFit(); + this.resizeContent(); + } + + protected resizeContent(): void { + this.totalHeight = this.totalHeight < 0 ? this.computeHeight() : this.totalHeight; + const inputHeight = this._input.getControl().getLayoutInfo().height; + const contentHeight = this.totalHeight - inputHeight; + this.content.node.style.height = `${contentHeight}px`; + MessageLoop.sendMessage(this.content, new Widget.ResizeMessage(this.totalWidth, contentHeight)); + } + + protected computeHeight(): number { + const { verticalSum } = ElementExt.boxSizing(this.node); + return this.node.offsetHeight - verticalSum; + } + + storeState(): object { + const history = this.history.store(); + const input = this.input.storeViewState(); + return { + history, + input + }; + } + + restoreState(oldState: object): void { + if ('history' in oldState) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + this.history.restore((oldState)['history']); + } + this.input.getControl().setValue(this.history.current || ''); + if ('input' in oldState) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + this.input.restoreViewState((oldState)['input']); + } + } + + hasInputFocus(): boolean { + return this._input && this._input.isFocused({ strict: true }); + } + + override dispose(): void { + super.dispose(); + this.modelChangeListener.dispose(); + } + + // To set the active language for the console input text model. + // https://github.com/microsoft/vscode/blob/2af422737386e792c3fcde7884f9bf47a1aff2f5/src/vs/workbench/contrib/debug/browser/repl.ts#L371-L384 + protected setMode(): void { + if (this.isHidden) { + return; + } + + const activeEditorControl = this.editorService.getActiveCodeEditor(); + if (activeEditorControl) { + this.modelChangeListener.dispose(); + this.modelChangeListener = activeEditorControl.onDidChangeModelLanguage(() => this.setMode()); + const consoleModel = this._input.getControl().getModel(); + const activeEditorModel = activeEditorControl.getModel(); + if (consoleModel && activeEditorModel) { + monaco.editor.setModelLanguage(consoleModel, activeEditorModel.getLanguageId()); + } + } + } + +} diff --git a/packages/console/src/browser/style/index.css b/packages/console/src/browser/style/index.css new file mode 100644 index 0000000..9ad7938 --- /dev/null +++ b/packages/console/src/browser/style/index.css @@ -0,0 +1,49 @@ +/******************************************************************************** + * Copyright (C) 2018 TypeFox and others. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the Eclipse + * Public License v. 2.0 are satisfied: GNU General Public License, version 2 + * with the GNU Classpath Exception which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 + ********************************************************************************/ + +.theia-console-content { + font-size: var(--theia-code-font-size); + line-height: var(--theia-code-line-height); + font-family: var(--theia-code-font-family); +} + +.theia-console-input { + padding-left: 20px; + border-top: var(--theia-panel-border-width) solid var(--theia-panel-border); + height: calc(var(--theia-content-line-height) * 2); + display: flex; + align-items: center; +} + +.theia-console-input:before { + left: 8px; + top: 3px; + position: absolute; + content: "\276f"; + line-height: 18px; +} + +.theia-console-error { + color: var(--theia-errorForeground); +} + +.theia-console-warning { + color: var(--theia-editorWarning-foreground); +} + +.theia-console-ansi-console-item { + white-space: pre-wrap; +} diff --git a/packages/console/src/package.spec.ts b/packages/console/src/package.spec.ts new file mode 100644 index 0000000..b18335b --- /dev/null +++ b/packages/console/src/package.spec.ts @@ -0,0 +1,28 @@ +// ***************************************************************************** +// Copyright (C) 2018 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +/* note: this bogus test file is required so that + we are able to run mocha unit tests on this + package, without having any actual unit tests in it. + This way a coverage report will be generated, + showing 0% coverage, instead of no report. + This file can be removed once we have real unit + tests in place. */ + +describe('console package', () => { + + it('support code coverage statistics', () => true); +}); diff --git a/packages/console/tsconfig.json b/packages/console/tsconfig.json new file mode 100644 index 0000000..d724ea1 --- /dev/null +++ b/packages/console/tsconfig.json @@ -0,0 +1,22 @@ +{ + "extends": "../../configs/base.tsconfig", + "compilerOptions": { + "composite": true, + "rootDir": "src", + "outDir": "lib" + }, + "include": [ + "src" + ], + "references": [ + { + "path": "../core" + }, + { + "path": "../editor" + }, + { + "path": "../monaco" + } + ] +} diff --git a/packages/core/.eslintrc.js b/packages/core/.eslintrc.js new file mode 100644 index 0000000..1308994 --- /dev/null +++ b/packages/core/.eslintrc.js @@ -0,0 +1,10 @@ +/** @type {import('eslint').Linter.Config} */ +module.exports = { + extends: [ + '../../configs/build.eslintrc.json' + ], + parserOptions: { + tsconfigRootDir: __dirname, + project: 'tsconfig.json' + } +}; diff --git a/packages/core/README.md b/packages/core/README.md new file mode 100644 index 0000000..a2c07b2 --- /dev/null +++ b/packages/core/README.md @@ -0,0 +1,178 @@ +
    + +
    + +theia-ext-logo + +

    ECLIPSE THEIA - CORE EXTENSION

    + +
    + +
    + +## Description + +The `@theia/core` extension is the main extension for all Theia-based applications, and provides the main framework for all dependent extensions. +The extension provides the base APIs for all Theia-based applications, including: + +- Application APIs +- Shell APIs +- Base Widgets +- Contribution Points (ex: commands, menu items, keybindings) + +## Theia Extension + +A Theia extension is a node package declaring `theiaExtensions` property in `package.json`: + +```json +{ + "theiaExtensions": [{ + "frontend": "lib/myExtension/browser/myextension-frontend-module", + "backend": "lib/myExtension/node/myextension-backend-module", + }, { + "frontend": "lib/myExtension2/browser/myextension2-browser-module", + "frontendElectron": "lib/myExtension2/electron-browser/myextension2-electron-browser-module", + "backend": "lib/myExtension2/node/myextension2-node-module", + "backendElectron": "lib/myExtension2/electron-main/myextension2-electron-main-module" + }] +} +``` + +Each extension can consist of the following modules: + +- `frontend` is used in the browser env and as well in the electron if `frontendElectron` is not provided +- `frontendElectron` is used in the electron env +- `backend` is used in the node env and as well in the electron env if `backendElectron` is not provided +- `backendElectron` is used in the electron env + +An extension module should have a default export of `ContainerModule | Promise` type. + +## Theia Application + +A Theia application is a node package listing [Theia extensions](#theia-extension) as dependencies and managed with [Theia CLI](../../dev-packages/cli/README.md). + +## Re-Exports Mechanism + +In order to make application builds more stable `@theia/core` re-exports some common dependencies for Theia extensions to re-use. This is especially useful when having to re-use the same dependencies as `@theia/core` does: Since those dependencies will be pulled by Theia, instead of trying to match the same version in your own packages, you can use re-exports to consume it from the framework directly. + +### Usage Example + +Let's take inversify as an example since you will most likely use this package, you can import it by prefixing with `@theia/core/shared/`: + +```ts +import { injectable } from '@theia/core/shared/inversify'; + +@injectable() +export class SomeClass { + // ... +} +``` + +## Re-Exports + +- `@theia/core/electron-shared/...` + - `native-keymap` (from [`native-keymap@^2.2.1`](https://www.npmjs.com/package/native-keymap)) + - `electron` (from [`electron@38.4.0`](https://www.npmjs.com/package/electron/v/38.4.0)) + - `electron-store` (from [`electron-store@^8.0.0`](https://www.npmjs.com/package/electron-store)) +- `@theia/core/shared/...` + - `@lumino/algorithm` (from [`@lumino/algorithm@^2.0.4`](https://www.npmjs.com/package/@lumino/algorithm)) + - `@lumino/commands` (from [`@lumino/commands@^2.3.3`](https://www.npmjs.com/package/@lumino/commands)) + - `@lumino/coreutils` (from [`@lumino/coreutils@^2.2.2`](https://www.npmjs.com/package/@lumino/coreutils)) + - `@lumino/domutils` (from [`@lumino/domutils@^2.0.4`](https://www.npmjs.com/package/@lumino/domutils)) + - `@lumino/dragdrop` (from [`@lumino/dragdrop@^2.1.7`](https://www.npmjs.com/package/@lumino/dragdrop)) + - `@lumino/messaging` (from [`@lumino/messaging@^2.0.4`](https://www.npmjs.com/package/@lumino/messaging)) + - `@lumino/properties` (from [`@lumino/properties@^2.0.4`](https://www.npmjs.com/package/@lumino/properties)) + - `@lumino/signaling` (from [`@lumino/signaling@^2.1.5`](https://www.npmjs.com/package/@lumino/signaling)) + - `@lumino/virtualdom` (from [`@lumino/virtualdom@^2.0.4`](https://www.npmjs.com/package/@lumino/virtualdom)) + - `@lumino/widgets` (from [`@lumino/widgets@2.7.2`](https://www.npmjs.com/package/@lumino/widgets/v/2.7.2)) + - `@theia/application-package` (from [`@theia/application-package@1.68.0`](https://www.npmjs.com/package/@theia/application-package/v/1.68.0)) + - `@theia/application-package/lib/api` (from [`@theia/application-package@1.68.0`](https://www.npmjs.com/package/@theia/application-package/v/1.68.0)) + - `@theia/application-package/lib/environment` (from [`@theia/application-package@1.68.0`](https://www.npmjs.com/package/@theia/application-package/v/1.68.0)) + - `@theia/request` (from [`@theia/request@1.68.0`](https://www.npmjs.com/package/@theia/request/v/1.68.0)) + - `@theia/request/lib/proxy` (from [`@theia/request@1.68.0`](https://www.npmjs.com/package/@theia/request/v/1.68.0)) + - `@theia/request/lib/node-request-service` (from [`@theia/request@1.68.0`](https://www.npmjs.com/package/@theia/request/v/1.68.0)) + - `fs-extra` (from [`fs-extra@^4.0.2`](https://www.npmjs.com/package/fs-extra)) + - `fuzzy` (from [`fuzzy@^0.1.3`](https://www.npmjs.com/package/fuzzy)) + - `inversify` (from [`inversify@^6.1.3`](https://www.npmjs.com/package/inversify)) + - `react-dom` (from [`react-dom@^18.2.0`](https://www.npmjs.com/package/react-dom)) + - `react-dom/client` (from [`react-dom@^18.2.0`](https://www.npmjs.com/package/react-dom)) + - `react-virtuoso` (from [`react-virtuoso@^2.17.0`](https://www.npmjs.com/package/react-virtuoso)) + - `vscode-languageserver-protocol` (from [`vscode-languageserver-protocol@^3.17.2`](https://www.npmjs.com/package/vscode-languageserver-protocol)) + - `vscode-uri` (from [`vscode-uri@^2.1.1`](https://www.npmjs.com/package/vscode-uri)) + - `@parcel/watcher` (from [`@parcel/watcher@^2.5.0`](https://www.npmjs.com/package/@parcel/watcher)) + - `dompurify` (from [`dompurify@^3.2.4`](https://www.npmjs.com/package/dompurify)) + - `express` (from [`express@^4.21.0`](https://www.npmjs.com/package/express)) + - `lodash.debounce` (from [`lodash.debounce@^4.0.8`](https://www.npmjs.com/package/lodash.debounce)) + - `lodash.throttle` (from [`lodash.throttle@^4.1.1`](https://www.npmjs.com/package/lodash.throttle)) + - `markdown-it` (from [`markdown-it@^14.1.0`](https://www.npmjs.com/package/markdown-it)) + - `markdown-it-anchor` (from [`markdown-it-anchor@^9.2.0`](https://www.npmjs.com/package/markdown-it-anchor)) + - `markdown-it-emoji` (from [`markdown-it-emoji@^3.0.0`](https://www.npmjs.com/package/markdown-it-emoji)) + - `react` (from [`react@^18.2.0`](https://www.npmjs.com/package/react)) + - `ws` (from [`ws@^8.17.1`](https://www.npmjs.com/package/ws)) + - `yargs` (from [`yargs@^15.3.1`](https://www.npmjs.com/package/yargs)) + +## Logging Configuration + +It's possible to change the log level for the entire Theia application by +passing it the `--log-level={fatal,error,warn,info,debug,trace}` option. For +more fine-grained adjustment, it's also possible to set the log level per +logger (i.e. per topic). The `root` logger is a special catch-all logger +through which go all messages not sent through a particular logger. To change +the log level of particular loggers, create a config file such as + +```json +{ + "defaultLevel": "info", + "levels": { + "terminal": "debug", + "task": "error" + } +} +``` + +where `levels` contains the logger-to-log-level mapping. `defaultLevel` +contains the log level to use for loggers not specified in `levels`. This file +can then be specified using the `--log-config` option. Theia will watch that +file for changes, so it's possible to change log levels at runtime by +modifying this file. + +It's unfortunately currently not possible to query Theia for the list of +existing loggers. However, each log message specifies from which logger it +comes from, which can give an idea, without having to read the code: + +``` +root INFO [parcel-watcher: 10734] Started watching: /Users/captain.future/git/theia/CONTRIBUTING.md +^^^^ ^^^^ ^^^^^^^^^^^^^^^^^^^^^ +``` + +Where `root` is the name of the logger and `INFO` is the log level. These are optionally followed by the name of a child process and the process ID. + +## Environment Variables + +- `THEIA_HOSTS` + - A comma-separated list of hosts expected to resolve to the current application. + - e.g: `theia.app.com,some.other.domain:3000` + - The port number is important if your application is not hosted on either `80` or `443`. + - If possible, you should set this environment variable: + - When not set, Theia will allow any origin to access the WebSocket services. + - When set, Theia will only allow the origins defined in this environment variable. +- `FRONTEND_CONNECTION_TIMEOUT` + - The duration in milliseconds during which the backend keeps the connection contexts for the frontend to reconnect. + - This duration defaults to '0' if not set. + - If set to negative number, the backend will never close the connection. + +## Additional Information + +- [API documentation for `@theia/core`](https://eclipse-theia.github.io/theia/docs/next/modules/_theia_core.html) +- [Theia - GitHub](https://github.com/eclipse-theia/theia) +- [Theia - Website](https://theia-ide.org/) + +## License + +- [Eclipse Public License 2.0](http://www.eclipse.org/legal/epl-2.0/) +- [一 (Secondary) GNU General Public License, version 2 with the GNU Classpath Exception](https://projects.eclipse.org/license/secondary-gpl-2.0-cp) + +## Trademark + +"Theia" is a trademark of the Eclipse Foundation + diff --git a/packages/core/README_TEMPLATE.md b/packages/core/README_TEMPLATE.md new file mode 100644 index 0000000..fcec102 --- /dev/null +++ b/packages/core/README_TEMPLATE.md @@ -0,0 +1,146 @@ +
    + +
    + +theia-ext-logo + +

    ECLIPSE THEIA - CORE EXTENSION

    + +
    + +
    + +## Description + +The `@theia/core` extension is the main extension for all Theia-based applications, and provides the main framework for all dependent extensions. +The extension provides the base APIs for all Theia-based applications, including: + +- Application APIs +- Shell APIs +- Base Widgets +- Contribution Points (ex: commands, menu items, keybindings) + +## Theia Extension + +A Theia extension is a node package declaring `theiaExtensions` property in `package.json`: + +```json +{ + "theiaExtensions": [{ + "frontend": "lib/myExtension/browser/myextension-frontend-module", + "backend": "lib/myExtension/node/myextension-backend-module", + }, { + "frontend": "lib/myExtension2/browser/myextension2-browser-module", + "frontendElectron": "lib/myExtension2/electron-browser/myextension2-electron-browser-module", + "backend": "lib/myExtension2/node/myextension2-node-module", + "backendElectron": "lib/myExtension2/electron-main/myextension2-electron-main-module" + }] +} +``` + +Each extension can consist of the following modules: + +- `frontend` is used in the browser env and as well in the electron if `frontendElectron` is not provided +- `frontendElectron` is used in the electron env +- `backend` is used in the node env and as well in the electron env if `backendElectron` is not provided +- `backendElectron` is used in the electron env + +An extension module should have a default export of `ContainerModule | Promise` type. + +## Theia Application + +A Theia application is a node package listing [Theia extensions](#theia-extension) as dependencies and managed with [Theia CLI](../../dev-packages/cli/README.md). + +## Re-Exports Mechanism + +In order to make application builds more stable `@theia/core` re-exports some common dependencies for Theia extensions to re-use. This is especially useful when having to re-use the same dependencies as `@theia/core` does: Since those dependencies will be pulled by Theia, instead of trying to match the same version in your own packages, you can use re-exports to consume it from the framework directly. + +### Usage Example + +Let's take inversify as an example since you will most likely use this package, you can import it by prefixing with `@theia/core/shared/`: + +```ts +import { injectable } from '@theia/core/shared/inversify'; + +@injectable() +export class SomeClass { + // ... +} +``` + +## Re-Exports + +{{#reExportsDirectories}} +- `@theia/core/{{&directory}}/...` + {{#packages}} + {{#modules}} + - `{{&moduleName}}` (from [`{{&packageName}}@{{&versionRange}}`]({{&npmUrl}})) + {{/modules}} + {{/packages}} +{{/reExportsDirectories}} + +## Logging Configuration + +It's possible to change the log level for the entire Theia application by +passing it the `--log-level={fatal,error,warn,info,debug,trace}` option. For +more fine-grained adjustment, it's also possible to set the log level per +logger (i.e. per topic). The `root` logger is a special catch-all logger +through which go all messages not sent through a particular logger. To change +the log level of particular loggers, create a config file such as + +```json +{ + "defaultLevel": "info", + "levels": { + "terminal": "debug", + "task": "error" + } +} +``` + +where `levels` contains the logger-to-log-level mapping. `defaultLevel` +contains the log level to use for loggers not specified in `levels`. This file +can then be specified using the `--log-config` option. Theia will watch that +file for changes, so it's possible to change log levels at runtime by +modifying this file. + +It's unfortunately currently not possible to query Theia for the list of +existing loggers. However, each log message specifies from which logger it +comes from, which can give an idea, without having to read the code: + +``` +root INFO [parcel-watcher: 10734] Started watching: /Users/captain.future/git/theia/CONTRIBUTING.md +^^^^ ^^^^ ^^^^^^^^^^^^^^^^^^^^^ +``` + +Where `root` is the name of the logger and `INFO` is the log level. These are optionally followed by the name of a child process and the process ID. + +## Environment Variables + +- `THEIA_HOSTS` + - A comma-separated list of hosts expected to resolve to the current application. + - e.g: `theia.app.com,some.other.domain:3000` + - The port number is important if your application is not hosted on either `80` or `443`. + - If possible, you should set this environment variable: + - When not set, Theia will allow any origin to access the WebSocket services. + - When set, Theia will only allow the origins defined in this environment variable. +- `FRONTEND_CONNECTION_TIMEOUT` + - The duration in milliseconds during which the backend keeps the connection contexts for the frontend to reconnect. + - This duration defaults to '0' if not set. + - If set to negative number, the backend will never close the connection. + +## Additional Information + +- [API documentation for `@theia/core`](https://eclipse-theia.github.io/theia/docs/next/modules/_theia_core.html) +- [Theia - GitHub](https://github.com/eclipse-theia/theia) +- [Theia - Website](https://theia-ide.org/) + +## License + +- [Eclipse Public License 2.0](http://www.eclipse.org/legal/epl-2.0/) +- [一 (Secondary) GNU General Public License, version 2 with the GNU Classpath Exception](https://projects.eclipse.org/license/secondary-gpl-2.0-cp) + +## Trademark + +"Theia" is a trademark of the Eclipse Foundation + diff --git a/packages/core/electron-shared/electron-store/index.d.ts b/packages/core/electron-shared/electron-store/index.d.ts new file mode 100644 index 0000000..b98d5f7 --- /dev/null +++ b/packages/core/electron-shared/electron-store/index.d.ts @@ -0,0 +1,2 @@ +import ElectronStore = require('@theia/electron/shared/electron-store'); +export = ElectronStore; diff --git a/packages/core/electron-shared/electron-store/index.js b/packages/core/electron-shared/electron-store/index.js new file mode 100644 index 0000000..1a39f46 --- /dev/null +++ b/packages/core/electron-shared/electron-store/index.js @@ -0,0 +1 @@ +module.exports = require('@theia/electron/shared/electron-store'); diff --git a/packages/core/electron-shared/electron/index.d.ts b/packages/core/electron-shared/electron/index.d.ts new file mode 100644 index 0000000..6af07ff --- /dev/null +++ b/packages/core/electron-shared/electron/index.d.ts @@ -0,0 +1,2 @@ +import Electron = require('@theia/electron/shared/electron'); +export = Electron; diff --git a/packages/core/electron-shared/electron/index.js b/packages/core/electron-shared/electron/index.js new file mode 100644 index 0000000..c52ea67 --- /dev/null +++ b/packages/core/electron-shared/electron/index.js @@ -0,0 +1 @@ +module.exports = require('@theia/electron/shared/electron'); diff --git a/packages/core/electron-shared/fix-path/index.d.ts b/packages/core/electron-shared/fix-path/index.d.ts new file mode 100644 index 0000000..1b5ceea --- /dev/null +++ b/packages/core/electron-shared/fix-path/index.d.ts @@ -0,0 +1,2 @@ +import fixPath = require('@theia/electron/shared/fix-path'); +export = fixPath; diff --git a/packages/core/electron-shared/fix-path/index.js b/packages/core/electron-shared/fix-path/index.js new file mode 100644 index 0000000..6029cae --- /dev/null +++ b/packages/core/electron-shared/fix-path/index.js @@ -0,0 +1 @@ +module.exports = require('@theia/electron/shared/fix-path'); diff --git a/packages/core/electron-shared/native-keymap/index.d.ts b/packages/core/electron-shared/native-keymap/index.d.ts new file mode 100644 index 0000000..275bd10 --- /dev/null +++ b/packages/core/electron-shared/native-keymap/index.d.ts @@ -0,0 +1 @@ +export * from '@theia/electron/shared/native-keymap'; diff --git a/packages/core/electron-shared/native-keymap/index.js b/packages/core/electron-shared/native-keymap/index.js new file mode 100644 index 0000000..a240eba --- /dev/null +++ b/packages/core/electron-shared/native-keymap/index.js @@ -0,0 +1 @@ +module.exports = require('@theia/electron/shared/native-keymap'); diff --git a/packages/core/i18n/nls.cs.json b/packages/core/i18n/nls.cs.json new file mode 100644 index 0000000..43655b9 --- /dev/null +++ b/packages/core/i18n/nls.cs.json @@ -0,0 +1,2097 @@ +{ + "ai-chat-ui.show-settings": "Zobrazit nastavení AI", + "ai-chat:summarize-session-as-task-for-coder": "Shrnutí relace jako úkol pro kodéra", + "ai.executePlanWithCoder": "Provést aktuální plán s kodérem", + "ai.updateTaskContext": "Aktualizace kontextu aktuální úlohy", + "aiConfiguration:open": "Otevřete zobrazení konfigurace AI", + "aiHistory:clear": "Historie umělé inteligence: Vymazat historii", + "aiHistory:open": "Otevřít zobrazení Historie AI", + "aiHistory:sortChronologically": "Historie umělé inteligence: Seřadit chronologicky", + "aiHistory:sortReverseChronologically": "Historie umělé inteligence: Řadit zpětně chronologicky", + "aiHistory:toggleCompact": "Historie umělé inteligence: Přepnout kompaktní zobrazení", + "aiHistory:toggleHideNewlines": "Historie umělé inteligence: Přestat interpretovat nové řádky", + "aiHistory:toggleRaw": "Historie umělé inteligence: Přepnout surové zobrazení", + "aiHistory:toggleRenderNewlines": "Historie umělé inteligence: Interpretace nových řádků", + "debug.breakpoint.editCondition": "Upravit stav...", + "debug.breakpoint.removeSelected": "Odstranění vybraných bodů přerušení", + "debug.breakpoint.toggleEnabled": "Přepnout povolit zarážky", + "notebook.cell.changeToCode": "Změna buňky na kód", + "notebook.cell.changeToMarkdown": "Změna buňky na Mardown", + "notebook.cell.insertMarkdownCellAbove": "Vložení buňky Markdown nad", + "notebook.cell.insertMarkdownCellBelow": "Vložení buňky Markdown níže", + "terminal:new:profile": "Vytvoření nového integrovaného terminálu z profilu", + "terminal:profile:default": "Zvolte výchozí profil terminálu", + "theia": { + "ai": { + "agents": { + "completionNotification": { + "mdDescription": "Chování oznámení, když tento agent dokončí úlohu. Pokud není nastaveno, použije se globální výchozí nastavení oznámení.\n - `os-notification`: Zobrazit oznámení operačního systému/systému\n - `message`: Zobrazit oznámení ve stavovém řádku/oblasti zpráv\n - `blink`: Blikat nebo zvýraznit uživatelské rozhraní\n - `off`: Zakáže oznámení pro tohoto agenta", + "title": "Oznámení o dokončení" + }, + "enable": { + "mdDescription": "Určuje, zda má být agent povolen (true) nebo zakázán (false).", + "title": "Povolení agenta" + }, + "languageModelRequirements": { + "identifier": { + "mdDescription": "Identifikátor jazykového modelu, který se má použít." + }, + "mdDescription": "Určuje použité jazykové modely pro tohoto agenta.", + "purpose": { + "mdDescription": "Účel, pro který se tento jazykový model používá.", + "title": "Účel" + }, + "title": "Požadavky na jazykový model" + }, + "mdDescription": "Konfigurace nastavení agenta, například povolení nebo zakázání konkrétních agentů, konfigurace výzev a výběr LLM.", + "selectedVariants": { + "mdDescription": "Určuje aktuálně vybrané varianty výzev pro tohoto agenta.", + "title": "Vybrané varianty" + }, + "title": "Nastavení agenta" + }, + "anthropic": { + "apiKey": { + "description": "Zadejte klíč API svého oficiálního účtu Anthropic. **Upozornění:** Při použití této předvolby bude klíč API Anthropic uložen v otevřeném textu na počítači, na kterém běží Theia. Pro bezpečné nastavení klíče použijte proměnnou prostředí `ANTHROPIC_API_KEY`." + }, + "models": { + "description": "Oficiální antropické modely k použití" + } + }, + "chat": { + "agent": { + "architect": "Architekt", + "coder": "programátor", + "universal": "Universal" + }, + "applySuggestion": "Použít návrh", + "bypassModelRequirement": { + "description": "Obejít kontrolu požadavků jazykového modelu. Tuto možnost povolte, pokud používáte externí agenty (např. Claude Code), které nevyžadují jazykové modely Theia." + }, + "changeSetDefaultTitle": "Navrhované změny", + "changeSetFileDiffUriLabel": "Změny AI: {0}", + "chatAgentsVariable": { + "description": "Vrátí seznam agentů chatu dostupných v systému." + }, + "chatSessionNamingAgent": { + "description": "Agent pro generování názvů relací chatu", + "vars": { + "conversation": { + "description": "Obsah konverzace v chatu." + }, + "listOfSessionNames": { + "description": "Seznam existujících názvů relací." + } + } + }, + "chatSessionSummaryAgent": { + "description": "Agent pro generování souhrnů relací chatu." + }, + "confirmApplySuggestion": "Soubor {0} se od vytvoření tohoto návrhu změnil. Jste si jisti, že si přejete tuto změnu použít?", + "confirmRevertSuggestion": "Soubor {0} se od vytvoření tohoto návrhu změnil. Jste si jisti, že si přejete změnu vrátit?", + "couldNotFindMatchingLM": "Nepodařilo se najít odpovídající jazykový model. Zkontrolujte prosím své nastavení!", + "couldNotFindReadyLMforAgent": "Nepodařilo se najít hotový jazykový model pro agenta {0}. Zkontrolujte prosím své nastavení!", + "defaultAgent": { + "description": "Nepovinné: agenta chatu, který bude vyvolán, pokud v uživatelském dotazu není agent výslovně uveden pomocí @. Pokud není žádný výchozí agent nakonfigurován, použijí se výchozí nastavení Theia." + }, + "imageContextVariable": { + "args": { + "data": { + "description": "Obrazová data v base64." + }, + "mimeType": { + "description": "Mimetyp obrázku." + }, + "name": { + "description": "Název souboru obrázku, je-li k dispozici." + }, + "wsRelativePath": { + "description": "Cesta k souboru s obrázkem vztažená k pracovnímu prostoru, je-li k dispozici." + } + }, + "description": "Poskytuje kontextové informace o obrázku", + "label": "Soubor obrázků" + }, + "orchestrator": { + "description": "Tento agent analyzuje požadavek uživatele na základě popisu všech dostupných agentů chatu a vybere nejvhodnějšího agenta, který na požadavek odpoví (pomocí umělé inteligence).Požadavek uživatele bude bez dalšího potvrzování přímo delegován vybranému agentovi.", + "vars": { + "availableChatAgents": { + "description": "Seznam agentů chatu, které může orchestrátor delegovat, s výjimkou agentů uvedených v předvolbě seznamu vyloučení." + } + } + }, + "pinChatAgent": { + "description": "Povolením připnutí agenta automaticky udržíte zmíněného agenta chatu aktivního napříč výzvami, čímž snížíte potřebu opakovaných zmínek.Agenta můžete kdykoli ručně odepnout nebo přepnout." + }, + "revertSuggestion": "Vrátit návrh", + "selectImageFile": "Výběr souboru obrázku", + "sessionStorage": { + "description": "Nakonfigurujte, kam se mají ukládat chatové relace.", + "globalPath": "Globální cesta", + "pathNotUsedForScope": "Nepoužívá se s úložným prostorem{0}.", + "pathRequired": "Cesta nemůže být prázdná", + "pathSettings": "Nastavení cesty", + "resetToDefault": "Obnovit výchozí nastavení", + "scope": { + "global": "Ukládejte chatové relace do globální konfigurační složky.", + "workspace": "Ukládejte chatové relace do složky pracovního prostoru." + }, + "workspacePath": "Cesta k pracovnímu prostoru" + }, + "taskContextService": { + "summarizeProgressMessage": "Shrňte: {0}", + "updatingProgressMessage": "Aktualizace: {0}" + }, + "toolConfirmation": { + "confirm": { + "description": "Před spuštěním nástrojů požádejte o potvrzení" + }, + "disabled": { + "description": "Zakázat provádění nástrojů" + }, + "yolo": { + "description": "Automatické spuštění nástrojů bez potvrzení" + } + }, + "view": { + "label": "AI Chat" + } + }, + "chat-ui": { + "addContextVariable": "Přidání kontextové proměnné", + "agent": "Agent", + "aiDisabled": "Funkce umělé inteligence jsou vypnuté", + "applyAll": "Použít vše", + "applyAllTitle": "Použít všechny čekající změny", + "askQuestion": "Zeptejte se", + "attachToContext": "Připojení prvků ke kontextu", + "cancel": "Zrušit (Esc)", + "chat-view-tree-widget": { + "ai": "AI", + "aiFeatureHeader": "🚀 Funkce AI k dispozici (verze alfa)!", + "featuresDisabled": "V současné době jsou všechny funkce umělé inteligence vypnuté!", + "generating": "Generování", + "howToEnable": "Jak povolit funkce umělé inteligence:", + "noRenderer": "Chyba: Nebyl nalezen žádný renderer", + "scrollToBottom": "Přejít na poslední zprávu", + "waitingForInput": "Čekání na vstupní údaje", + "you": "Vy" + }, + "chatInput": { + "clearHistory": "Vymazání historie vstupních výzev", + "cycleMode": "Režim cyklického chatu", + "nextPrompt": "Další výzva", + "previousPrompt": "Předchozí výzva" + }, + "chatInputAriaLabel": "Zadejte zde svou zprávu", + "chatResponses": "Odpovědi v chatu", + "code-part-renderer": { + "generatedCode": "Generovaný kód" + }, + "collapseChangeSet": "Sbalit sadu změn", + "command-part-renderer": { + "commandNotExecutable": "Příkaz má id \"{0}\", ale není spustitelný z okna chatu." + }, + "copyCodeBlock": "Kopírování bloku kódu", + "couldNotSendRequestToSession": "Nebylo možné odeslat požadavek \"{0}\" do relace {1}", + "delegation-response-renderer": { + "prompt": { + "label": "Podnět v přenesené pravomoci:" + }, + "response": { + "label": "Reakce:" + }, + "starting": "Zahájení delegace...", + "status": { + "canceled": "zrušeno", + "error": "chyba", + "generating": "generování...", + "starting": "začíná..." + } + }, + "deleteChangeSet": "Odstranit sadu změn", + "editRequest": "Upravit", + "edited": "upraveno", + "editedTooltipHint": "Tato varianta výzvy byla upravena. Můžete ji resetovat v zobrazení Konfigurace AI.", + "enterChatName": "Zadejte název chatu", + "errorChatInvocation": "Při volání služby chatu došlo k chybě.", + "expandChangeSet": "Rozbalit sadu změn", + "failedToDeleteSession": "Nepodařilo se odstranit relaci chatu", + "failedToLoadChats": "Nepodařilo se načíst relace chatu", + "failedToRestoreSession": "Nepodařilo se obnovit relaci chatu", + "failedToRetry": "Zpráva Neúspěšný pokus o opakování", + "focusInput": "Zaměření na vstup chatu", + "focusResponse": "Odpověď v okně Focus Chat", + "noChatAgentsAvailable": "Žádní agenti chatu nejsou k dispozici.", + "openDiff": "Otevřený diferenciál", + "openOriginalFile": "Otevřít původní soubor", + "performThisTask": "Proveďte tento úkol.", + "persistedSession": "Přetrvávající relace (kliknutím obnovíte)", + "removeChat": "Odstranění chatu", + "renameChat": "Přejmenování chatu", + "requestNotFoundForRetry": "Požadavek nebyl nalezen pro opakování", + "responseFrom": "Odpověď od {0}", + "selectAgentQuickPickPlaceholder": "Výběr agenta pro novou relaci", + "selectChat": "Vybrat chat", + "selectContextVariableQuickPickPlaceholder": "Vyberte kontextovou proměnnou, která má být připojena ke zprávě.", + "selectTaskContextQuickPickItem": { + "currentlyOpen": "aktuálně otevřeno" + }, + "selectTaskContextQuickPickPlaceholder": "Vyberte kontext úlohy, který chcete připojit", + "selectVariableArguments": "Výběr proměnných argumentů", + "send": "Odeslat (Zadat)", + "sessionNotFoundForRetry": "Relace nebyla nalezena pro opakovaný pokus", + "text-part-renderer": { + "cantDisplay": "Nelze zobrazit odpověď, zkontrolujte prosím své ChatResponsePartRenderers!" + }, + "thinking-part-renderer": { + "thinking": "Přemýšlení" + }, + "toolcall-part-renderer": { + "denied": "Odmítnutí provedení", + "finished": "Ran", + "rejected": "Zrušené provedení" + }, + "toolconfirmation": { + "allow-options-dropdown-tooltip": "Další možnosti povolení", + "allow-session": "Povolit tento chat", + "allowed": "Povolené provedení nástroje", + "alwaysAllowConfirm": "Rozumím, povolit automatické schvalování", + "alwaysAllowTitle": "Povolit automatické schvalování pro „{0}“?", + "canceled": "Provedení nástroje zrušeno", + "denied": "Odmítnutí spuštění nástroje", + "deny-forever": "Vždy odmítnout", + "deny-options-dropdown-tooltip": "Další možnosti odmítnutí", + "deny-reason-placeholder": "Zadejte důvod zamítnutí...", + "deny-session": "Odmítnout pro tento chat", + "deny-with-reason": "Odmítnout s odůvodněním...", + "executionDenied": "Provedení nástroje zamítnuto", + "header": "Potvrzení provedení nástroje" + }, + "unableToSummarizeCurrentSession": "Nelze shrnout aktuální relaci. Potvrďte, že agent pro shrnutí není zakázán.", + "unknown-part-renderer": { + "contentNotRestoreable": "Tento obsah (typ '{0}') se nepodařilo plně obnovit. Může pocházet z rozšíření, které již není k dispozici." + }, + "unpinAgent": "Odpojení agenta", + "variantTooltip": "Varianta výzvy: {0}", + "yourMessage": "Vaše zpráva" + }, + "claude-code": { + "agentDescription": "Kódovací agent společnosti Anthropic", + "askBeforeEdit": "Před úpravou se zeptejte", + "changeSetTitle": "Změny podle kódu Claude", + "clearCommand": { + "description": "Vytvoření nové relace" + }, + "compactCommand": { + "description": "Kompaktní konverzace s volitelnými pokyny pro zaměření" + }, + "completedCount": "{0}/{1} dokončeno", + "configCommand": { + "description": "Otevřená konfigurace kódu Claude" + }, + "currentDirectory": "aktuální adresář", + "differentAgentRequestWarning": "Předchozí požadavek na chat vyřídil jiný agent. Claude Code tyto jiné zprávy nevidí.", + "directory": "Adresář", + "domain": "Doména", + "editAutomatically": "Automaticky upravit", + "editNumber": "Upravit {0}", + "editing": "Úpravy", + "editsCount": "{0} úpravy", + "emptyTodoList": "Ne všechny jsou k dispozici", + "entireFile": "Celý soubor", + "excludingOnePattern": " (kromě 1 vzoru)", + "excludingPatterns": " (kromě vzorů {0} )", + "executedCommand": "Provedeno: {0}", + "failedToParseBashToolData": "Nepodařilo se analyzovat data nástroje Bash", + "failedToParseEditToolData": "Nepodařilo se analyzovat data nástroje Edit", + "failedToParseGlobToolData": "Nepodařilo se analyzovat data nástroje Glob", + "failedToParseGrepToolData": "Nepodařilo se analyzovat data nástroje Grep", + "failedToParseLSToolData": "Nepodařilo se analyzovat data nástroje LS", + "failedToParseMultiEditToolData": "Nepodařilo se analyzovat data nástroje MultiEdit", + "failedToParseReadToolData": "Nepodařilo se analyzovat data nástroje Read", + "failedToParseTodoListData": "Nepodařilo se analyzovat data seznamu úkolů", + "failedToParseWebFetchToolData": "Nepodařilo se analyzovat data nástroje WebFetch", + "failedToParseWriteToolData": "Nepodařilo se analyzovat data nástroje pro zápis", + "fetching": "Získávání", + "fileFilter": "Filtr souborů", + "filePath": "Cesta k souboru", + "fileType": "Typ souboru", + "findMatchingFiles": "Vyhledání souborů odpovídajících globálnímu vzoru \"{0}\" v aktuálním adresáři", + "findMatchingFilesWithPath": "Vyhledání souborů odpovídajících globálnímu vzoru \"{0}\" v rámci {1}", + "finding": "Vyhledávání", + "from": "Z", + "globPattern": "globální vzor", + "grepOptions": { + "caseInsensitive": "rozlišování velkých a malých písmen", + "glob": "zeměkoule: {0}", + "headLimit": "limit: {0}", + "lineNumbers": "čísla řádků", + "linesAfter": "+{0} po", + "linesBefore": "+{0} před", + "linesContext": "±{0} kontext", + "multiLine": "multiline", + "type": "typ: {0}" + }, + "grepOutputModes": { + "content": "obsah", + "count": "počítat", + "filesWithMatches": "soubory se shodami" + }, + "ignoredPatterns": "Ignorované vzory", + "ignoringPatterns": "Ignorování vzorů {0} ", + "initCommand": { + "description": "Inicializace projektu pomocí průvodce CLAUDE.md" + }, + "itemCount": "{0} položky", + "lineLimit": "Limit linky", + "lines": "Řádky", + "listDirectoryContents": "Seznam obsahu adresáře", + "listing": "Seznam", + "memoryCommand": { + "description": "Úprava paměťového souboru CLAUDE.md" + }, + "multiEditing": "Vícenásobné úpravy", + "oneEdit": "1 upravit", + "oneItem": "1 položka", + "oneOption": "1 možnost", + "openDirectoryTooltip": "Kliknutím otevřete adresář", + "openFileTooltip": "Kliknutím otevřete soubor v editoru", + "optionsCount": "{0} možnosti", + "partial": "Částečně", + "pattern": "Vzor", + "plan": "Režim plánování", + "project": "projekt", + "projectRoot": "kořen projektu", + "readMode": "Režim čtení", + "reading": "Čtení", + "replaceAllCount": "{0} replace-all", + "replaceAllOccurrences": "Nahradit všechny výskyty", + "resumeCommand": { + "description": "Obnovení relace" + }, + "reviewCommand": { + "description": "Žádost o revizi kódu" + }, + "searchPath": "Vyhledávací cesta", + "searching": "Vyhledávání", + "startingLine": "Startovní čára", + "timeout": "Časový limit", + "timeoutInMs": "Časový limit: {0}ms", + "to": "Na", + "todoList": "Seznam úkolů", + "todoPriority": { + "high": "vysoká", + "low": "nízká", + "medium": "střední" + }, + "toolApprovalRequest": "Claude Code chce použít nástroj \"{0}\". Chcete to povolit?", + "totalEdits": "Úpravy celkem", + "webFetch": "Webové načítání", + "writing": "Psaní" + }, + "code-completion": { + "progressText": "Výpočet dokončení kódu AI..." + }, + "codex": { + "agentDescription": "Kódovací asistent OpenAI poháněný technologií Codex", + "completedCount": "{0}/{1} dokončeno", + "exitCode": "Kód ukončení: {0}", + "fileChangeFailed": "Codex neprovedl změny pro: {0}", + "fileChangeFailedGeneric": "Codex nedokázal použít změny souboru.", + "itemCount": "{0} položky", + "noItems": "Žádné položky", + "oneItem": "1 položka", + "running": "Běh...", + "searched": "Hledáno", + "searching": "Hledání", + "todoList": "Seznam úkolů", + "webSearch": "Vyhledávání na webu" + }, + "completion": { + "agent": { + "description": "Tento agent zajišťuje doplňování kódu v editoru kódu v prostředí Theia IDE.", + "vars": { + "file": { + "description": "URI upravovaného souboru" + }, + "language": { + "description": "LanguageId upravovaného souboru" + }, + "prefix": { + "description": "Kód před aktuální pozicí kurzoru" + }, + "suffix": { + "description": "Kód za aktuální pozicí kurzoru" + } + } + }, + "automaticEnable": { + "description": "Automatické spouštění doplňků AI inline v jakémkoli editoru (Monaco) během úprav. \n Případně můžete kód spustit ručně pomocí příkazu \"Trigger Inline Suggestion\" nebo výchozí klávesové zkratky \"Ctrl+Alt+Mezerník\"." + }, + "cacheCapacity": { + "description": "Maximální počet dokončení kódu, která se mají uložit do mezipaměti. Vyšší číslo může zvýšit výkon, ale spotřebuje více paměti. Minimální hodnota je 10, doporučený rozsah je 50-200.", + "title": "Kapacita mezipaměti pro dokončení kódu" + }, + "debounceDelay": { + "description": "Řídí prodlevu v milisekundách před spuštěním doplnění UI po zjištění změn v editoru. Vyžaduje, aby bylo povoleno `Automatické dokončování kódu`. Zadáním 0 zpoždění odladění zakážete.", + "title": "Zpoždění odezvy" + }, + "excludedFileExts": { + "description": "Zadejte přípony souborů (např. .md, .txt), ve kterých má být zakázáno doplňování AI.", + "title": "Vyloučené přípony souborů" + }, + "fileVariable": { + "description": "URI upravovaného souboru. K dispozici pouze v kontextu doplňování kódu." + }, + "languageVariable": { + "description": "LanguageId upravovaného souboru. K dispozici pouze v kontextu doplňování kódu." + }, + "maxContextLines": { + "description": "Maximální počet řádků použitých jako kontext, rozdělený mezi řádky před a za pozicí kurzoru (prefix a sufix). Nastavte tuto hodnotu na -1, chcete-li jako kontext použít celý soubor bez omezení řádků, a na 0, chcete-li použít pouze aktuální řádek.", + "title": "Maximální počet kontextových řádků" + }, + "prefixVariable": { + "description": "Kód před aktuální pozicí kurzoru. K dispozici pouze v kontextu doplňování kódu." + }, + "stripBackticks": { + "description": "Odstranění okolních zpětných znaků z kódu vráceného některými LLM. Pokud je detekován zpětný znak, je odstraněn i veškerý obsah za uzavíracím zpětným znakem. Toto nastavení pomáhá zajistit, aby byl vrácen prostý kód, pokud jazykové modely používají formátování podobné značkám.", + "title": "Odebrání zpětných háčků z řadového dokončování" + }, + "suffixVariable": { + "description": "Kód za aktuální pozicí kurzoru. K dispozici pouze v kontextu doplňování kódu." + } + }, + "configuration": { + "selectItem": "Vyberte prosím položku." + }, + "copilot": { + "auth": { + "aiConfiguration": "Konfigurace AI", + "authorize": "Autorizoval jsem", + "copied": "Zkopírováno!", + "copyCode": "Kopírovat kód", + "expired": "Oprávnění vypršelo nebo bylo zamítnuto. Zkuste to znovu.", + "hint": "Po zadání kódu a autorizaci klikněte níže na „Autorizoval jsem“.", + "initiating": "Zahájení ověřování...", + "instructions": "Chcete-li autorizovat Theia k používání GitHub Copilot, navštivte níže uvedenou adresu URL a zadejte kód:", + "openGitHub": "Otevřít GitHub", + "success": "Úspěšně přihlášeno do GitHub Copilot!", + "successHint": "Pokud má váš účet GitHub přístup k Copilotu, můžete nyní nakonfigurovat jazykové modely Copilotu v ", + "title": "Přihlásit se do GitHub Copilot", + "tos": "Přihlášením souhlasíte s ", + "tosLink": "Podmínky služby GitHub", + "verifying": "Ověřování oprávnění..." + }, + "category": "Copilot", + "commands": { + "signIn": "Přihlásit se do GitHub Copilot", + "signOut": "Odhlásit se z GitHub Copilot" + }, + "enterpriseUrl": { + "mdDescription": "Doména GitHub Enterprise pro Copilot API (např. `github.mycompany.com`). Pro GitHub.com ponechte prázdné." + }, + "models": { + "description": "Modely GitHub Copilot, které lze použít. Dostupné modely závisí na vašem předplatném Copilot." + }, + "statusBar": { + "signedIn": "Přihlášeno do GitHub Copilot jako {0}. Kliknutím se odhlásíte.", + "signedOut": "Nejste přihlášeni do GitHub Copilot. Klikněte pro přihlášení." + } + }, + "core": { + "agentConfiguration": { + "actions": "Akce", + "addCustomAgent": "Přidání vlastního agenta", + "enableAgent": "Povolení agenta", + "label": "Agenti", + "llmRequirements": "Požadavky na LLM", + "notUsedInPrompt": "Nepoužívá se ve výzvě", + "promptTemplates": "Šablony výzev", + "selectAgentMessage": "Nejprve si prosím vyberte agenta!", + "templateName": "Šablona", + "undeclared": "Nedeklarované", + "usedAgentSpecificVariables": "Použité proměnné specifické pro agenta", + "usedFunctions": "Použité funkce", + "usedGlobalVariables": "Použité globální proměnné", + "variant": "Varianta" + }, + "agentsVariable": { + "description": "Vrací seznam agentů dostupných v systému." + }, + "aiConfiguration": { + "label": "✨ Konfigurace AI [Alpha]" + }, + "blinkTitle": { + "agentCompleted": "Theia - Agent Ukončeno", + "namedAgentCompleted": "Theia - Agent \"{0}\" Dokončeno" + }, + "changeSetSummaryVariable": { + "description": "Poskytuje souhrn souborů v sadě změn a jejich obsahu." + }, + "contextDetailsVariable": { + "description": "Poskytuje plné textové hodnoty a popisy všech kontextových prvků." + }, + "contextSummaryVariable": { + "description": "Popisuje soubory v kontextu dané relace." + }, + "customAgentTemplate": { + "description": "Jedná se o příklad agenta. Upravte si prosím vlastnosti podle svých potřeb." + }, + "defaultModelAliases": { + "code": { + "description": "Optimalizováno pro úlohy porozumění kódu a generování." + }, + "code-completion": { + "description": "Nejvhodnější pro scénáře automatického dokončování kódu." + }, + "summarize": { + "description": "Modely upřednostněné pro shrnutí a kondenzaci obsahu." + }, + "universal": { + "description": "Dobře vyvážený pro kódové i obecné použití v jazyce." + } + }, + "defaultNotification": { + "mdDescription": "Výchozí způsob oznámení, který se použije, když agent AI dokončí úlohu. Jednotliví agenti mohou toto nastavení přepsat.\n - `os-notification`: Zobrazit oznámení operačního systému/systému\n - `message`: Zobrazit oznámení ve stavovém řádku/oblasti zpráv\n - `blink`: Blikat nebo zvýraznit uživatelské rozhraní\n - `off`: Vypnout všechna oznámení", + "title": "Výchozí typ oznámení" + }, + "discard": { + "label": "Šablona výzvy k vyřazení AI" + }, + "discardCustomPrompt": { + "tooltip": "Vyřazení přizpůsobení" + }, + "fileVariable": { + "description": "Vyřeší obsah souboru", + "uri": { + "description": "URI požadovaného souboru." + } + }, + "languageModelRenderer": { + "alias": "[alias] {0}", + "languageModel": "Jazykový model", + "purpose": "Účel" + }, + "maxRetries": { + "mdDescription": "Maximální počet pokusů o opakování, když se požadavek na zprostředkovatele UI nezdaří. Hodnota 0 znamená žádné opakování.", + "title": "Maximální počet opakování" + }, + "modelAliasesConfiguration": { + "agents": "Agenti používající tento alias", + "defaultList": "[Výchozí seznam]", + "evaluatesTo": "Vyhodnocuje se na", + "label": "Pseudonymy modelů", + "modelNotReadyTooltip": "Není připraven", + "modelReadyTooltip": "Připraveno", + "noAgents": "Tuto přezdívku nepoužívají žádní agenti.", + "noModelReadyTooltip": "Žádný model není připraven", + "noResolvedModel": "Pro tento alias není připraven žádný model.", + "priorityList": "Seznam priorit", + "selectAlias": "Vyberte Alias modelu.", + "selectedModelId": "Vybraný model", + "unavailableModel": "Vybraný model již není k dispozici" + }, + "noVariableFoundForOpenRequest": "Pro otevřený požadavek nebyla nalezena žádná proměnná.", + "openEditorsShortVariable": { + "description": "Krátký odkaz na všechny aktuálně otevřené soubory (relativní cesty, oddělené čárkou)." + }, + "openEditorsVariable": { + "description": "Seznam všech aktuálně otevřených souborů oddělený čárkou, vztažený ke kořenu pracovního prostoru." + }, + "preference": { + "languageModelAliases": { + "description": "Konfigurace modelů pro každý alias jazykového modelu v zobrazení [AI Configuration View]({0}). Případně můžete nastavení nastavit ručně v souboru settings.json: \n```\n\"default/code\": {\n \"selectedModel\": \"anthropic/claude-opus-4-20250514\"\n}\n```", + "selectedModel": "Model vybraný uživatelem pro tento alias.", + "title": "Aliasy jazykových modelů" + } + }, + "prefs": { + "title": "✨ Funkce AI [Alpha]" + }, + "promptFragmentsConfiguration": { + "activeCustomizationTitle": "Aktivní přizpůsobení", + "createCustomizationTitle": "Vytvořit přizpůsobení", + "customization": "přizpůsobení", + "customizationLabel": "Přizpůsobení", + "defaultVariantTitle": "Výchozí varianta", + "deleteCustomizationTitle": "Odstranění přizpůsobení", + "editTemplateTitle": "Upravit šablonu", + "headerTitle": "Fragmenty výzvy", + "label": "Fragmenty výzvy", + "noFragmentsAvailable": "Nejsou k dispozici žádné pohotové fragmenty.", + "otherPromptFragmentsHeader": "Další fragmenty výzvy", + "promptTemplateText": "Text šablony výzvy", + "promptVariantsHeader": "Sady variant výzvy", + "removeCustomizationDialogMsg": "Jste si jisti, že chcete odstranit přizpůsobení {0} pro fragment výzvy \"{1}\"?", + "removeCustomizationDialogTitle": "Odstranění přizpůsobení", + "removeCustomizationWithDescDialogMsg": "Jste si jisti, že chcete odstranit přizpůsobení {0} pro fragment výzvy \"{1}\" ({2})?", + "resetAllButton": "Obnovit vše", + "resetAllCustomizationsDialogMsg": "Jste si jisti, že chcete obnovit všechny fragmenty výzev na jejich vestavěné verze? Tím se odstraní všechna přizpůsobení.", + "resetAllCustomizationsDialogTitle": "Obnovení všech přizpůsobení", + "resetAllCustomizationsTitle": "Obnovení všech přizpůsobení", + "resetAllPromptFragments": "Obnovení všech fragmentů výzvy", + "resetToBuiltInDialogMsg": "Jste si jisti, že chcete obnovit fragment výzvy \"{0}\" na jeho vestavěnou verzi? Tím se odstraní všechna přizpůsobení.", + "resetToBuiltInDialogTitle": "Obnovení na vestavěný", + "resetToBuiltInTitle": "Obnovení na tuto vestavěnou", + "resetToCustomizationDialogMsg": "Jste si jisti, že chcete obnovit fragment výzvy \"{0}\", abyste mohli použít přizpůsobení {1}? Tím se odstraní všechna přizpůsobení s vyšší prioritou.", + "resetToCustomizationDialogTitle": "Obnovení přizpůsobení", + "resetToCustomizationTitle": "Obnovení tohoto přizpůsobení", + "selectedVariantLabel": "Vybrané stránky", + "selectedVariantTitle": "Vybraná varianta", + "usedByAgentTitle": "Používá agent: {0}", + "variantSetError": "Vybraná varianta neexistuje a nepodařilo se najít žádnou výchozí. Zkontrolujte prosím svou konfiguraci.", + "variantSetWarning": "Vybraná varianta neexistuje. Místo toho se použije výchozí varianta.", + "variantsOfSystemPrompt": "Varianty této sady variant výzvy:" + }, + "promptTemplates": { + "description": "Složka pro ukládání přizpůsobených šablon výzev. Pokud nejsou přizpůsobeny, použije se adresář uživatelské konfigurace. Zvažte prosím použití složky, která je pod správou verzí pro správu variant šablon výzev.", + "openLabel": "Vybrat složku" + }, + "promptVariable": { + "argDescription": "Id šablony výzvy k řešení", + "completions": { + "detail": { + "builtin": "Vestavěný fragment výzvy", + "custom": "Přizpůsobený fragment výzvy" + } + }, + "description": "Řeší šablony výzev prostřednictvím služby výzev" + }, + "prompts": { + "category": "Šablony Theia AI Prompt" + }, + "requestSettings": { + "clientSettings": { + "description": "Nastavení klienta pro zpracování zpráv odesílaných zpět do llm.", + "keepThinking": { + "description": "Pokud je nastavena na hodnotu false, budou všechny výstupy myšlení před odesláním dalšího požadavku uživatele v konverzaci s více uživateli filtrovány." + }, + "keepToolCalls": { + "description": "Pokud je nastavena na hodnotu false, budou všechny požadavky na nástroj a odpovědi na nástroj před odesláním dalšího požadavku uživatele v konverzaci s více uživateli filtrovány." + } + }, + "mdDescription": "Umožňuje zadat vlastní nastavení požadavku pro více modelů.\n Každý objekt představuje konfiguraci pro konkrétní model. Pole `modelId` určuje ID modelu, `requestSettings` definuje nastavení specifické pro daný model.\n Pole `providerId` je nepovinné a umožňuje použít nastavení pro konkrétního poskytovatele. Pokud není nastaveno, bude nastavení použito pro všechny poskytovatele.\n Příklad providerId: huggingface, openai, ollama, llamafile.\n Další informace naleznete v [naší dokumentaci](https://theia-ide.org/docs/user_ai/#custom-request-settings).", + "modelSpecificSettings": { + "description": "Nastavení pro konkrétní ID modelu." + }, + "scope": { + "agentId": { + "description": "(Nepovinné) ID agenta, na kterého se má nastavení použít." + }, + "modelId": { + "description": "(nepovinné) id modelu" + }, + "providerId": { + "description": "(Nepovinné) ID zprostředkovatele, na které se má nastavení použít." + } + }, + "title": "Vlastní nastavení požadavku" + }, + "skillsVariable": { + "description": "Vrací seznam dostupných dovedností, které mohou používat agenti AI." + }, + "taskContextSummary": { + "description": "Vyřeší všechny položky kontextu úlohy přítomné v kontextu relace." + }, + "templateSettings": { + "edited": "upraveno", + "unavailableVariant": "Vybraná varianta již není k dispozici" + }, + "todayVariable": { + "description": "Dělá něco pro dnešek", + "format": { + "description": "Formát data" + } + }, + "unableToDisplayVariableValue": "Nelze zobrazit hodnotu proměnné.", + "unableToResolveVariable": "Nelze vyřešit proměnnou.", + "variable-contribution": { + "builtInVariable": "Vestavěná proměnná Theia", + "currentAbsoluteFilePath": "Absolutní cesta k aktuálně otevřenému souboru. Upozorňujeme, že většina agentů očekává relativní cestu k souboru (vzhledem k aktuální pracovní ploše).", + "currentFileContent": "Prostý obsah aktuálně otevřeného souboru. Vyloučeny jsou informace o tom, odkud obsah pochází. Upozorňujeme, že většina agentů bude lépe pracovat s relativní cestou k souboru (vzhledem k aktuálnímu pracovnímu prostoru).", + "currentRelativeDirPath": "Relativní cesta k adresáři obsahujícímu aktuálně otevřený soubor.", + "currentRelativeFilePath": "Relativní cesta k aktuálně otevřenému souboru.", + "currentSelectedText": "Obyčejný text, který je aktuálně vybrán v otevřeném souboru. Tím se vyloučí informace o tom, odkud obsah pochází. Upozorňujeme, že většina agentů bude lépe pracovat s relativní cestou k souboru (vzhledem k aktuální pracovní oblasti).", + "dotRelativePath": "Krátký odkaz na relativní cestu k aktuálně otevřenému souboru (\"currentRelativeFilePath\")." + } + }, + "editor": { + "editorContextVariable": { + "description": "Řeší kontextové informace specifické pro editor", + "label": "EditorContext" + }, + "explainWithAI": { + "prompt": "Vysvětlete tuto chybu", + "title": "Vysvětlete pomocí AI" + }, + "fixWithAI": { + "prompt": "Nápověda k opravě této chyby" + } + }, + "google": { + "apiKey": { + "description": "Zadejte klíč API svého oficiálního účtu Google AI (Gemini). **Upozornění:** Při použití této předvolby bude klíč API GOOGLE AI uložen v otevřeném textu na počítači, na kterém běží Theia. Pro bezpečné nastavení klíče použijte proměnnou prostředí `GOOGLE_API_KEY`." + }, + "maxRetriesOnErrors": { + "description": "Maximální počet opakování v případě chyb. Pokud je menší než 1, je logika opakování zakázána." + }, + "models": { + "description": "Oficiální modely Google Gemini k použití" + }, + "retryDelayOnOtherErrors": { + "description": "Zpoždění v sekundách mezi opakovanými pokusy v případě jiných chyb (někdy Google GenAI hlásí chyby, jako je neúplná syntaxe JSON vrácená z modelu nebo 500 Internal Server Error). Nastavení této hodnoty na -1 zabrání opakování v těchto případech. V opačném případě dojde k opakování buď okamžitě (je-li nastaveno na 0), nebo po této prodlevě v sekundách (je-li nastaveno na kladné číslo)." + }, + "retryDelayOnRateLimitError": { + "description": "Zpoždění v sekundách mezi opakovanými pokusy v případě chyb omezení rychlosti. Viz https://ai.google.dev/gemini-api/docs/rate-limits" + } + }, + "history": { + "clear": { + "tooltip": "Vymazání historie všech agentů" + }, + "exchange-card": { + "agentId": "Agent", + "timestamp": "Založeno" + }, + "open-history-tooltip": "Otevřete historii AI...", + "request-card": { + "agent": "Agent", + "model": "Model", + "request": "Žádost", + "response": "Reakce", + "timestamp": "Časové razítko", + "title": "Žádost" + }, + "sortChronologically": { + "tooltip": "Řazení chronologicky" + }, + "sortReverseChronologically": { + "tooltip": "Řazení zpětně chronologicky" + }, + "toggleCompact": { + "tooltip": "Zobrazit kompaktní zobrazení" + }, + "toggleHideNewlines": { + "tooltip": "Přestat interpretovat nové řádky" + }, + "toggleRaw": { + "tooltip": "Zobrazit nezpracované zobrazení" + }, + "toggleRenderNewlines": { + "tooltip": "Interpretace nových řádků" + }, + "view": { + "label": "✨ Historie agenta AI [Alpha]", + "noAgent": "Žádný agent není k dispozici.", + "noAgentSelected": "Není vybrán žádný agent.", + "noHistoryForAgent": "Pro vybraného agenta není k dispozici žádná historie '{0}'" + } + }, + "huggingFace": { + "apiKey": { + "mdDescription": "Zadejte klíč API pro svůj účet Hugging Face. **Upozornění:** Při použití této předvolby bude klíč API služby Hugging Face uložen v otevřeném textu na počítači, na kterém běží Theia. Pro bezpečné nastavení klíče použijte proměnnou prostředí `HUGGINGFACE_API_KEY`." + }, + "models": { + "mdDescription": "Modely Hugging Face, které lze použít. **Upozornění:** V současné době jsou podporovány pouze modely podporující API pro dokončování chatů (modely vyladěné podle pokynů, jako například `*-Instruct`). U některých modelů může být nutné přijmout licenční podmínky na webových stránkách Hugging Face." + } + }, + "ide": { + "agent-description": "Konfigurace nastavení agenta AI včetně povolení, výběru LLM, přizpůsobení šablony výzvy a vytvoření vlastního agenta v zobrazení [AI Configuration View]({0}).", + "agentConfiguration": { + "customAgentLocationQuickPick": { + "createNewFile": "Vytvořit nový soubor", + "openExistingFile": "Otevřít existující soubor", + "placeholder": "Zvolte, kde chcete vytvořit nebo otevřít vlastní soubor s agenty", + "title": "Výběr umístění pro soubor vlastních zástupců" + }, + "noDescription": "Žádný popis není k dispozici" + }, + "app-tester": { + "errorCheckingDevToolsServerStatus": "Chyba při kontrole stavu serveru DevTools MCP: {0}", + "errorCheckingPlaywrightServerStatus": "Chyba při kontrole stavu serveru Playwright MCP: {0}", + "startChromeDevToolsMcpServers": { + "canceled": "Nastavte prosím server Chrome DevTools MCP.", + "error": "Nepodařilo se spustit server Chrome DevTools MCP: {0}", + "progress": "Spouštění serveru Chrome DevTools MCP.", + "question": "Server Chrome DevTools MCP není spuštěn. Chcete jej spustit nyní? Tím se nainstaluje server Chrome DevTools MCP." + }, + "startMcpServers": { + "no": "Ne, zrušit", + "yes": "Ano, spusťte servery." + }, + "startPlaywrightServers": { + "canceled": "Nastavte servery MCP.", + "error": "Nepodařilo se spustit server Playwright MCP: {0}", + "progress": "Spuštění serverů Playwright MCP.", + "question": "Servery Playwright MCP nejsou spuštěny. Chcete je nyní spustit? To může vést k instalaci serverů Playwright MCP." + } + }, + "architectAgent": { + "mode": { + "default": "Výchozí režim", + "plan": "Režim plánu", + "simple": "Jednoduchý režim" + }, + "suggestion": { + "executePlanWithCoder": "Spusťte „{0}“ pomocí Coderu.", + "summarizeSessionAsTaskForCoder": "Shrňte tuto relaci jako úkol pro Coder", + "updateTaskContext": "Aktualizace kontextu aktuální úlohy" + } + }, + "bypassHint": "Někteří agenti, jako například Claude Code, nevyžadují jazykové modely Theia.", + "chatDisabledMessage": { + "featuresTitle": "Aktuálně podporované zobrazení a funkce:" + }, + "coderAgent": { + "mode": { + "agentNext": "Režim agenta (Další)", + "edit": "Režim úprav" + }, + "suggestion": { + "fixProblems": { + "content": "[Oprava problémů]({0}) v aktuálním souboru.", + "prompt": "podívejte se prosím na {1} a opravte případné problémy." + }, + "startNewChat": "Chatujte krátce a soustředěně. [Spusťte nový chat]({0}) pro nový úkol nebo [spusťte nový chat se shrnutím tohoto]({1})." + } + }, + "commandAgent": { + "commandCallback": { + "confirmAction": "Mám to", + "label": "Příkaz AI" + }, + "response": { + "customHandler": "Zkuste to provést:", + "noCommand": "Je mi líto, ale takový příkaz jsem nenašel.", + "theiaCommand": "Našel jsem tento příkaz, který by vám mohl pomoci:" + }, + "vars": { + "commandIds": { + "description": "Seznam dostupných příkazů v systému Theia." + } + } + }, + "configureAgent": { + "header": "Nakonfigurujte výchozího agenta" + }, + "continueAnyway": "Pokračovat i tak", + "createSkillAgent": { + "mode": { + "edit": "Výchozí režim" + } + }, + "enableAI": { + "mdDescription": "❗ Toto nastavení umožňuje přístup k nejnovějším možnostem umělé inteligence (verze Beta). \n Upozorňujeme, že tyto funkce jsou ve fázi beta, což znamená, že mohou doznat změn a budou dále vylepšovány. Je důležité si uvědomit, že tyto funkce mohou generovat neustálé požadavky na jazykové modely (LLM), ke kterým poskytujete přístup. To může vyvolat náklady, které je třeba pečlivě sledovat. Povolením této možnosti berete tato rizika na vědomí. \n **Vezměte prosím na vědomí! Níže uvedená nastavení v této části se projeví pouze\n jakmile je povoleno nastavení hlavní funkce. Po povolení funkce je třeba nakonfigurovat alespoň jednoho poskytovatele LLM níže. Viz také [dokumentace](https://theia-ide.org/docs/user_ai/)**." + }, + "github": { + "configureGitHubServer": { + "canceled": "Konfigurace serveru GitHub zrušena. Nakonfigurujte prosím server GitHub MCP tak, aby používal tohoto agenta.", + "no": "Ne, zrušit", + "yes": "Ano, konfigurace serveru GitHub" + }, + "errorCheckingGitHubServerStatus": "Chyba při kontrole stavu serveru GitHub MCP: {0}", + "startGitHubServer": { + "canceled": "Chcete-li používat tohoto agenta, spusťte server GitHub MCP.", + "error": "Nepodařilo se spustit server GitHub MCP: {0}", + "no": "Ne, zrušit", + "progress": "Spuštění serveru GitHub MCP.", + "question": "Server GitHub MCP je nakonfigurován, ale není spuštěn. Chcete jej nyní spustit?", + "yes": "Ano, spusťte server" + } + }, + "githubRepoName": { + "description": "Název aktuálního úložiště GitHub (např. \"eclipse-theia/theia\")." + }, + "model-selection-description": "V zobrazení [AI Configuration View]({0}) vyberte, které velké jazykové modely (LLM) bude používat každý agent umělé inteligence.", + "moreAgentsAvailable": { + "header": "K dispozici je více agentů" + }, + "noRecommendedAgents": "Nejsou k dispozici žádná doporučená činidla.", + "openSettings": "Otevřít nastavení AI", + "or": "nebo", + "orchestrator": { + "error": { + "noAgents": "Žádný agent chatu není k dispozici pro vyřízení žádosti. Zkontrolujte prosím, zda jsou v konfiguraci povoleny." + }, + "progressMessage": "Určení nejvhodnějšího prostředku", + "response": { + "delegatingToAgent": "Delegování na `@{0}`" + } + }, + "prompt-template-description": "Vyberte varianty výzev a přizpůsobte šablony výzev pro agenty AI v zobrazení [AI Configuration View]({0}).", + "recommendedAgents": "Doporučení agenti:", + "skillsConfiguration": { + "label": "Dovednosti", + "location": { + "label": "Umístění" + } + }, + "toolsConfiguration": { + "confirmAlwaysAllow": { + "confirm": "Rozumím, povolit automatické schvalování", + "title": "Povolit automatické schvalování pro „{0}“?" + }, + "confirmationMode": { + "label": "Potvrzovací režim" + }, + "default": { + "label": "Výchozí režim potvrzení nástroje:" + }, + "resetAll": "Obnovit vše", + "resetAllConfirmDialog": { + "msg": "Jste si jisti, že chcete obnovit všechny režimy potvrzení nástroje na výchozí? Tím se odstraní všechna vlastní nastavení.", + "title": "Resetování všech režimů potvrzení nástroje" + }, + "resetAllTooltip": "Obnovení výchozího nastavení všech nástrojů", + "toolOptions": { + "confirm": { + "label": "Potvrďte" + } + } + }, + "variableConfiguration": { + "selectVariable": "Vyberte proměnnou.", + "usedByAgents": "Používá se agenty", + "variableArgs": "Proměnná Argumenty" + } + }, + "llamaFile": { + "prefs": { + "mdDescription": "Toto nastavení umožňuje konfigurovat a spravovat modely LlamaFile v prostředí Theia IDE. \n Každá položka vyžaduje uživatelsky přívětivé `jméno`, soubor `uri` ukazující na váš LlamaFile a `port`, na kterém bude spuštěn. \n Chcete-li spustit LlamaFile, použijte příkaz \"Start LlamaFile\", který vám umožní vybrat požadovaný model. \n Pokud položku upravíte (např. změníte port), jakákoli běžící instance se zastaví a budete ji muset znovu ručně spustit. \n [Více informací o konfiguraci a správě LlamaFiles najdete v dokumentaci Theia IDE](https://theia-ide.org/docs/user_ai/#llamafile-models).", + "name": { + "description": "Název modelu, který se použije pro tento soubor Llama." + }, + "port": { + "description": "Port, který se použije ke spuštění serveru." + }, + "title": "✨ AI LlamaFile", + "uri": { + "description": "Uri souboru Llamafile." + } + }, + "start": "Spustit Llamafile", + "stop": "Zastavit Llamafile" + }, + "llamafile": { + "error": { + "noConfigured": "Nejsou nakonfigurovány žádné soubory Llamafile.", + "noRunning": "Žádné spuštěné soubory Llamafile.", + "startFailed": "Při spouštění souboru llamafile se něco pokazilo: {0}.\nDalší informace naleznete v konzoli.", + "stopFailed": "Při zastavení souboru llamafile se něco pokazilo: {0}.\nDalší informace naleznete v konzoli." + } + }, + "mcp": { + "error": { + "allServersRunning": "Všechny servery MCP jsou již spuštěny.", + "noRunningServers": "Nejsou spuštěny žádné servery MCP.", + "noServersConfigured": "Nejsou nakonfigurovány žádné servery MCP.", + "startFailed": "Při spouštění serveru MCP došlo k chybě." + }, + "info": { + "serverStarted": "Server MCP \"{0}\" byl úspěšně spuštěn. Registrované nástroje: {1}" + }, + "servers": { + "args": { + "mdDescription": "Pole argumentů, které se předávají příkazu.", + "title": "Argumenty příkazu" + }, + "autostart": { + "mdDescription": "Automatické spuštění tohoto serveru při spuštění frontendu. Nově přidané servery se nespustí okamžitě, ale až po restartu.", + "title": "Automatické spuštění" + }, + "command": { + "mdDescription": "Příkaz použitý ke spuštění serveru MCP, např. \"uvx\" nebo \"npx\".", + "title": "Příkaz ke spuštění serveru MCP" + }, + "env": { + "mdDescription": "Nepovinné proměnné prostředí, které se mají nastavit pro server, například klíč API.", + "title": "Proměnné prostředí" + }, + "headers": { + "mdDescription": "Volitelné doplňkové hlavičky, které jsou součástí každého požadavku na server.", + "title": "Záhlaví" + }, + "mdDescription": "Konfigurace serverů MCP pomocí příkazů, argumentů, volitelně proměnných prostředí a autostartu (ve výchozím nastavení true). Každý server je identifikován jedinečným klíčem, například \"brave-search\" nebo \"filesystem\". Chcete-li spustit server, použijte příkaz \"MCP: Start MCP Server\", který umožňuje vybrat požadovaný server. Chcete-li server zastavit, použijte příkaz \"MCP: Stop MCP Server\". Upozorňujeme, že autostart se projeví až po restartu, poprvé je třeba server spustit ručně.\nPříklad konfigurace:\n```{\n \"brave-search\": {\n \"command\": \"npx\",\n \"args\": [\n \"-y\",\n \"@modelcontextprotocol/server-brave-search\"\n ],\n \"env\": {\n \"BRAVE_API_KEY\": \"YOUR_API_KEY\"\n },\n },\n \"filesystem\": {\n \"command\": \"npx\",\n \"args\": [\"-y\", \"@modelcontextprotocol/server-filesystem\", \"/Users/YOUR_USERNAME/Desktop\"],\n \"env\": {\n \"CUSTOM_ENV_VAR\": \"custom-value\"\n },\n \"autostart\": false\n }\n}\n```", + "serverAuthToken": { + "mdDescription": "Ověřovací token pro server, je-li vyžadován. Používá se k ověření na vzdáleném serveru.", + "title": "Ověřovací token" + }, + "serverAuthTokenHeader": { + "mdDescription": "Název hlavičky, který se použije pro ověřovací token serveru. Pokud není zadáno, použije se \"Authorization\" s \"Bearer\".", + "title": "Název ověřovací hlavičky" + }, + "serverUrl": { + "mdDescription": "Adresa URL vzdáleného serveru MCP. Pokud je zadán, server se připojí k této adrese URL místo spuštění místního procesu.", + "title": "Adresa URL serveru" + }, + "title": "Konfigurace serverů MCP" + }, + "start": { + "label": "MCP: Spuštění serveru MCP" + }, + "stop": { + "label": "MCP: Zastavení serveru MCP" + } + }, + "mcpConfiguration": { + "arguments": "Argumenty: ", + "autostart": "Automatické spuštění: ", + "connectServer": "Connnect", + "connectingServer": "Připojování...", + "copiedAllList": "Zkopírování všech nástrojů do schránky (seznam všech nástrojů)", + "copiedAllSingle": "Zkopírování všech nástrojů do schránky (jeden fragment výzvy se všemi nástroji)", + "copiedForPromptTemplate": "Zkopírování všech nástrojů do schránky pro šablonu výzvy (jeden fragment výzvy se všemi nástroji)", + "copyAllList": "Kopírovat vše (seznam všech nástrojů)", + "copyAllSingle": "Kopírovat vše pro chat (jeden fragment výzvy se všemi nástroji)", + "copyForPrompt": "Nástroj pro kopírování (pro šablonu chatu nebo výzvy)", + "copyForPromptTemplate": "Kopírovat vše pro šablonu výzvy (jeden fragment výzvy se všemi nástroji)", + "environmentVariables": "Proměnné prostředí: ", + "headers": "Záhlaví: ", + "noServers": "Nejsou nakonfigurovány žádné servery MCP", + "serverAuthToken": "Ověřovací token: ", + "serverAuthTokenHeader": "Název ověřovací hlavičky: ", + "serverUrl": "Adresa URL serveru: ", + "tools": "Nástroje: " + }, + "openai": { + "apiKey": { + "mdDescription": "Zadejte klíč API svého oficiálního účtu OpenAI. **Upozornění:** Při použití této předvolby bude klíč API Open AI uložen v otevřeném textu na počítači, na kterém běží Theia. Pro bezpečné nastavení klíče použijte proměnnou prostředí `OPENAI_API_KEY`." + }, + "customEndpoints": { + "apiKey": { + "title": "Buď klíč pro přístup k API obsluhovanému na dané url, nebo `true` pro použití globálního klíče API OpenAI." + }, + "apiVersion": { + "title": "buď verze pro přístup k rozhraní API obsluhovanému na dané url v Azure, nebo `true` pro použití globální verze rozhraní OpenAI API." + }, + "deployment": { + "title": "Název nasazení pro přístup k rozhraní API obsluhovanému na dané url v Azure." + }, + "developerMessageSettings": { + "title": "Řídí zpracování systémových zpráv: `user`, `system` a `developer` se použije jako role, `mergeWithFollowingUserMessage` předřadí následující uživatelskou zprávu systémové zprávě nebo převede systémovou zprávu na uživatelskou, pokud následující zpráva není uživatelská. `skip` pouze odstraní systémovou zprávu), výchozí hodnota je `developer`." + }, + "enableStreaming": { + "title": "Určuje, zda se má použít rozhraní API pro streamování. `true` ve výchozím nastavení." + }, + "id": { + "title": "Jedinečný identifikátor, který se používá v uživatelském rozhraní k identifikaci vlastního modelu." + }, + "mdDescription": "Integrace vlastních modelů kompatibilních s rozhraním OpenAI API, například prostřednictvím rozhraní `vllm`. Požadované atributy jsou `model` a `url`. \n Volitelně můžete \n - zadat jedinečné `id` pro identifikaci vlastního modelu v uživatelském rozhraní. Pokud není zadán žádný, bude jako `id` použit `model`. \n - zadejte `apiKey` pro přístup k rozhraní API obsluhovanému na zadané adrese url. Použijte `true` pro označení použití globálního API klíče OpenAI. \n - zadejte `apiVersion` pro přístup k API obsluhovanému na dané url v Azure. Použijte `true` pro označení použití globální verze rozhraní OpenAI API. \n - nastavte `developerMessageSettings` na jednu z možností `user`, `system`, `developer`, `mergeWithFollowingUserMessage` nebo `skip`, abyste mohli řídit způsob zahrnutí zprávy pro vývojáře (kde `user`, `system` a `developer` budou použity jako role, `mergeWithFollowingUserMessage` předřadí následující uživatelskou zprávu systémové zprávě nebo převede systémovou zprávu na uživatelskou, pokud následující zpráva není uživatelská. `skip` pouze odstraní systémovou zprávu). Výchozí hodnota je `developer`. \n - zadejte `supportsStructuredOutput: false` pro označení, že strukturovaný výstup nebude použit. \n - zadejte `enableStreaming: false`, abyste uvedli, že streamování nebude použito. \n Další informace naleznete v [naší dokumentaci](https://theia-ide.org/docs/user_ai/#openai-compatible-models-eg-via-vllm).", + "modelId": { + "title": "ID modelu" + }, + "supportsStructuredOutput": { + "title": "Označuje, zda model podporuje strukturovaný výstup. `true` ve výchozím nastavení." + }, + "url": { + "title": "Koncový bod kompatibilní s rozhraním Open AI API, kde je model umístěn." + } + }, + "models": { + "description": "Oficiální modely OpenAI k použití" + }, + "useResponseApi": { + "mdDescription": "Pro oficiální modely OpenAI použijte místo rozhraní API pro dokončení chatu novější rozhraní API pro odezvu OpenAI. Toto nastavení se vztahuje pouze na oficiální modely OpenAI - vlastní poskytovatelé musí toto nastavení nakonfigurovat individuálně." + } + }, + "promptTemplates": { + "directories": { + "title": "Adresáře šablon specifických pro pracovní prostor" + }, + "extensions": { + "description": "Seznam dalších přípon souborů v umístění výzvy, které jsou považovány za šablony výzvy. '.prompttemplate' je vždy považován za výchozí.", + "title": "Další přípony souborů šablony Prompt" + }, + "files": { + "title": "Soubory šablon specifických pro pracovní prostor" + } + }, + "scanoss": { + "changeSet": { + "clean": "Žádné shody", + "error": "Chyba: Opětovné spuštění", + "error-notification": "Vyskytla se chyba ScanOSS: {0}.", + "match": "Zobrazit zápasy", + "scan": "Skenování", + "scanning": "Skenování..." + }, + "mode": { + "automatic": { + "description": "Povolení automatického skenování úryvků kódu v zobrazeních chatu." + }, + "description": "Konfigurace funkce SCANOSS pro analýzu fragmentů kódu v zobrazeních chatu. Tím se do funkce SCANOSS odešle hash navrhovaných úryvků kódu.\nhostované nadací [Software Transparency foundation](https://www.softwaretransparency.org/osskb) k analýze.", + "manual": { + "description": "Uživatel může spustit skenování ručně kliknutím na položku SCANOSS v zobrazení chatu." + }, + "off": { + "description": "Funkce je zcela vypnutá." + } + }, + "snippet": { + "dialog-header": "Výsledky ScanOSS", + "errored": "SCANOSS - Chyba - {0}", + "file-name-heading": "Shoda nalezena v {0}", + "in-progress": "SCANOSS - Provádění skenování...", + "match-count": "Nalezena shoda {0} ", + "matched": "SCANOSS - Nalezena shoda {0} ", + "no-match": "SCANOSS - Žádná shoda", + "summary": "Souhrn" + } + }, + "session-settings-dialog": { + "title": "Nastavení relací", + "tooltip": "Nastavení relací" + }, + "terminal": { + "agent": { + "description": "Tento agent poskytuje pomoc při zápisu a spouštění libovolných terminálových příkazů. Na základě požadavku uživatele navrhuje příkazy a umožňuje uživateli je přímo vložit a spustit v terminálu. Získává přístup k aktuálnímu adresáři, prostředí a poslednímu výstupu relace terminálu, aby poskytl kontextově orientovanou pomoc.", + "vars": { + "cwd": { + "description": "Aktuální pracovní adresář." + }, + "recentTerminalContents": { + "description": "Posledních 0 až 50 posledních řádků viditelných v terminálu." + }, + "shell": { + "description": "Používaný shell, např. /usr/bin/zsh." + }, + "userRequest": { + "description": "Dotaz nebo požadavek uživatele." + } + } + }, + "askAi": "Zeptejte se umělé inteligence", + "askTerminalCommand": "Zeptejte se na příkaz terminálu...", + "hitEnterConfirm": "Stiskněte enter a potvrďte", + "howCanIHelp": "Jak vám mohu pomoci?", + "loading": "Načítání", + "tryAgain": "Zkuste to znovu...", + "useArrowsAlternatives": " nebo použijte ⇅ pro zobrazení alternativ..." + }, + "tokenUsage": { + "cachedInputTokens": "Vstupní tokeny zapisované do mezipaměti", + "cachedInputTokensTooltip": "Sledováno dodatečně k položce \"Vstupní tokeny\". Obvykle dražší než necachované tokeny.", + "failedToGetTokenUsageData": "Nepodařilo se načíst data o použití tokenu: {0}", + "inputTokens": "Vstupní tokeny", + "label": "Používání žetonů", + "lastUsed": "Naposledy použité", + "model": "Model", + "noData": "Zatím nejsou k dispozici žádné údaje o používání tokenů.", + "note": "Použití tokenu je sledováno od spuštění aplikace a není uchováváno.", + "outputTokens": "Výstupní tokeny", + "readCachedInputTokens": "Vstupní tokeny načtené z mezipaměti", + "readCachedInputTokensTooltip": "Sledováno dodatečně k \"Input Token\". Obvykle mnohem levnější než bez mezipaměti. Obvykle se nezapočítává do limitů rychlosti.", + "total": "Celkem", + "totalTokens": "Celkový počet žetonů", + "totalTokensTooltip": "'Vstupní tokeny' + 'Výstupní tokeny'" + }, + "vercelai": { + "anthropicApiKey": { + "mdDescription": "Zadejte klíč API pro modely Anthropic. **Upozornění:** Při použití této předvolby bude klíč API uložen v otevřeném textu na počítači, na kterém běží Theia. Pro bezpečné nastavení klíče použijte proměnnou prostředí `ANTHROPIC_API_KEY`." + }, + "customEndpoints": { + "apiKey": { + "title": "Buď klíč pro přístup k API obsluhovanému na dané url, nebo `true` pro použití globálního klíče API." + }, + "enableStreaming": { + "title": "Určuje, zda se má použít rozhraní API pro streamování. `true` ve výchozím nastavení." + }, + "id": { + "title": "Jedinečný identifikátor, který se používá v uživatelském rozhraní k identifikaci vlastního modelu." + }, + "mdDescription": "Integrace vlastních modelů kompatibilních s Vercel AI SDK. Požadované atributy jsou `model` a `url`. \n Volitelně můžete \n - zadat jedinečné `id` pro identifikaci vlastního modelu v uživatelském rozhraní. Pokud není zadán žádný, bude jako `id` použit `model`. \n - zadejte `apiKey` pro přístup k rozhraní API obsluhovanému na zadané adrese url. Použijte `true` pro označení použití globálního klíče API. \n - zadejte `supportsStructuredOutput: false` pro označení, že strukturovaný výstup nebude použit. \n - zadejte `enableStreaming: false`, abyste uvedli, že streamování nebude použito. \n - zadejte `provider`, abyste uvedli, od kterého poskytovatele je model (openai, anthropic).", + "modelId": { + "title": "ID modelu" + }, + "supportsStructuredOutput": { + "title": "Označuje, zda model podporuje strukturovaný výstup. `true` ve výchozím nastavení." + }, + "url": { + "title": "Koncový bod API, kde je model hostován" + } + }, + "models": { + "description": "Oficiální modely pro použití s Vercel AI SDK", + "id": { + "title": "ID modelu" + }, + "model": { + "title": "Název modelu" + } + }, + "openaiApiKey": { + "mdDescription": "Zadejte klíč API pro modely OpenAI. **Upozornění:** Při použití této předvolby bude klíč API uložen v otevřeném textu na počítači, na kterém běží Theia. Pro bezpečné nastavení klíče použijte proměnnou prostředí `OPENAI_API_KEY`." + } + }, + "workspace": { + "coderAgent": { + "description": "Asistent s umělou inteligencí integrovaný do prostředí Theia IDE, který je určen na pomoc vývojářům softwaru. Tento agent může přistupovat k pracovnímu prostoru uživatele, může získat seznam všech dostupných souborů a složek a načíst jejich obsah. Dále může uživateli navrhovat úpravy souborů. Může tedy uživateli pomáhat s úkoly kódování nebo jinými úkoly zahrnujícími změny souborů." + }, + "considerGitignore": { + "description": "Pokud je tato funkce povolena, vyloučí soubory/složky zadané v globálním souboru .gitignore (předpokládané umístění je kořenový adresář pracovního prostoru).", + "title": "Zvažte možnost .gitignore" + }, + "excludedPattern": { + "description": "Seznam vzorů (glob nebo regex) pro soubory/složky, které se mají vyloučit.", + "title": "Vyloučené vzory souborů" + }, + "searchMaxResults": { + "description": "Maximální počet výsledků vyhledávání vrácených funkcí vyhledávání v pracovním prostoru.", + "title": "Maximální výsledky vyhledávání" + }, + "workspaceAgent": { + "description": "Asistent s umělou inteligencí integrovaný do prostředí Theia IDE, který je určen na pomoc vývojářům softwaru. Tento agent může přistupovat k pracovnímu prostoru uživatele, může získat seznam všech dostupných souborů a složek a načíst jejich obsah. Nemůže soubory upravovat. Může tedy odpovídat na otázky týkající se aktuálního projektu, souborů projektu a zdrojového kódu v pracovním prostoru, například jak sestavit projekt, kam umístit zdrojový kód, kde najít konkrétní kód nebo konfigurace atd." + } + } + }, + "ai-chat": { + "fileChangeSetTitle": "Navrhované změny" + }, + "ai-chat-ui": { + "initiate-session-task-context": "Kontext úlohy: Zahájit relaci", + "open-current-session-summary": "Otevřít shrnutí aktuálního zasedání", + "open-settings-tooltip": "Otevřete nastavení AI...", + "scroll-lock": "Zámek Scroll", + "scroll-unlock": "Odemknutí svitku", + "session-settings": "Nastavení relací", + "showChats": "Zobrazit chaty...", + "summarize-current-session": "Shrnutí aktuálního zasedání" + }, + "ai-claude-code": { + "open-config": "Otevřená konfigurace kódu Claude", + "open-memory": "Otevřít paměť kódu Claude (CLAUDE.MD)" + }, + "ai-core": { + "agentCompletionMessage": "Agent \"{0}\" splnil svůj úkol.", + "agentCompletionTitle": "Agent \"{0}\" Úkol splněn", + "agentCompletionWithTask": "Agent \"{0}\" splnil úkol: {1}" + }, + "ai-editor": { + "contextMenu": "Zeptejte se AI", + "sendToChat": "Odeslat do AI Chat" + }, + "ai-ide": { + "addressGhReviewCommand": { + "argumentHint": "", + "description": "Komentáře k revizi adresy v žádosti o stažení na GitHubu" + }, + "fixGhTicketCommand": { + "argumentHint": "", + "description": "Analyzujte ticket GitHub a implementujte řešení" + }, + "open-agent-settings-tooltip": "Otevřít nastavení agenta...", + "rememberCommand": { + "argumentHint": "[topic-hint]", + "description": "Extrahujte témata z konverzace a aktualizujte informace o projektu" + }, + "ticketCommand": { + "argumentHint": "", + "description": "Analyzujte ticket GitHub a vytvořte plán implementace" + }, + "todoTool": { + "noTasks": "Žádné úkoly" + }, + "withAppTesterCommand": { + "description": "Přeneste testování na agenta AppTester (vyžaduje režim agenta)" + } + }, + "ai-mcp": { + "blockedServersLabel": "Servery MCP (blokováno automatické spuštění)" + }, + "ai-terminal": { + "cancelExecution": "Zrušit provedení příkazu", + "canceling": "Rušení...", + "confirmExecution": "Potvrzení příkazu Shell", + "denialReason": "Důvod", + "executionCanceled": "Zrušeno", + "executionDenied": "Odmítnuto", + "executionDeniedWithReason": "Odmítnuto s odůvodněním", + "noOutput": "Žádný výstup", + "partialOutput": "Částečný výstup", + "timeout": "Časový limit", + "workingDirectory": "Pracovní adresář" + }, + "callhierarchy": { + "noCallers": "Nebyl zjištěn žádný volající.", + "open": "Hierarchie otevřených výzev" + }, + "chat": { + "taskContextVariable": { + "args": { + "contextId": { + "description": "ID kontextu úlohy, který se má načíst, nebo relace chatu, která se má shrnout." + } + }, + "description": "Poskytuje kontextové informace k úkolu, např. plán dokončení úkolu nebo shrnutí předchozích sezení.", + "label": "Kontext úlohy" + } + }, + "collaboration": { + "collaborate": "Spolupracujte", + "collaboration": "Spolupráce", + "collaborationWorkspace": "Pracovní prostor pro spolupráci", + "connected": "Připojeno", + "connectedSession": "Připojení k relaci spolupráce", + "copiedInvitation": "Kód pozvánky zkopírovaný do schránky.", + "copyAgain": "Znovu kopírovat", + "createRoom": "Vytvoření nové relace spolupráce", + "creatingRoom": "Vytvoření relace", + "end": "Ukončení relace spolupráce", + "endDetail": "Ukončit relaci, ukončit sdílení obsahu a zrušit přístup ostatním uživatelům.", + "enterCode": "Zadejte kód relace spolupráce", + "failedCreate": "Nepodařilo se vytvořit prostor: {0}", + "failedJoin": "Nepodařilo se připojit k místnosti: {0}", + "fieldRequired": "Pole {0} je povinné. Přihlášení přerušeno.", + "invite": "Pozvat ostatní", + "inviteDetail": "Zkopírujte si kód pozvánky, abyste ji mohli sdílet s ostatními a připojit se k sezení.", + "joinRoom": "Připojte se k zasedání o spolupráci", + "joiningRoom": "Připojení k relaci", + "leave": "Opustit zasedání pro spolupráci", + "leaveDetail": "Odpojte se od aktuální relace spolupráce a zavřete pracovní prostor.", + "loginFailed": "Přihlášení se nezdařilo.", + "loginSuccessful": "Přihlášení proběhlo úspěšně.", + "noAuth": "Server neposkytuje žádnou metodu ověřování.", + "optional": "volitelné", + "selectAuth": "Výběr metody ověřování", + "selectCollaboration": "Vyberte možnost spolupráce", + "serverUrl": "Adresa URL serveru", + "serverUrlDescription": "Adresa URL instance serveru Open Collaboration Tools Server pro živé relace spolupráce", + "sharedSession": "Společná relace spolupráce", + "startSession": "Zahájení relace spolupráce nebo připojení se k ní", + "userWantsToJoin": "Uživatel '{0}' se chce připojit k místnosti pro spolupráci", + "whatToDo": "Co byste chtěli dělat s dalšími spolupracovníky?" + }, + "core": { + "about": { + "compatibility": "{0} Kompatibilita", + "defaultApi": "Výchozí rozhraní API {0} ", + "listOfExtensions": "Seznam rozšíření" + }, + "common": { + "closeAll": "Zavřít všechny karty", + "closeAllTabMain": "Zavření všech karet v hlavní oblasti", + "closeOtherTabMain": "Zavření dalších karet v hlavní oblasti", + "closeOthers": "Zavření dalších karet", + "closeRight": "Zavření karet vpravo", + "closeTab": "Zavřít kartu", + "closeTabMain": "Zavřít kartu v hlavní oblasti", + "collapseAllTabs": "Sbalit všechny boční panely", + "collapseBottomPanel": "Přepínání spodního panelu", + "collapseLeftPanel": "Přepínání levého panelu", + "collapseRightPanel": "Přepínání pravého panelu", + "collapseTab": "Sbalení bočního panelu", + "showNextTabGroup": "Přepnutí na další skupinu karet", + "showNextTabInGroup": "Přepnutí na další kartu ve skupině", + "showPreviousTabGroup": "Přepnutí na předchozí skupinu karet", + "showPreviousTabInGroup": "Přepnutí na předchozí kartu ve skupině", + "toggleMaximized": "Přepínání Maximalizováno" + }, + "copyInfo": "Nejprve otevřete soubor a zkopírujte jeho cestu", + "copyWarn": "Použijte příkaz pro kopírování v prohlížeči nebo klávesovou zkratku.", + "cutWarn": "Použijte příkaz pro vyjmutí v prohlížeči nebo klávesovou zkratku.", + "enhancedPreview": { + "classic": "Zobrazí jednoduchý náhled karty se základními informacemi.", + "enhanced": "Zobrazení rozšířeného náhledu karty s dalšími informacemi.", + "visual": "Zobrazení vizuálního náhledu karty." + }, + "file": { + "browse": "Procházet" + }, + "highlightModifiedTabs": "Řídí, zda se na upravených (špinavých) kartách editoru vykreslí horní rámeček, nebo ne.", + "keybinding": { + "duplicateModifierError": "Nelze analyzovat vazbu kláves {0} Duplicitní modifikátory", + "metaError": "Nelze analyzovat vazbu kláves {0} meta je určena pouze pro OSX", + "unrecognizedKeyError": "Nerozpoznaný klíč {0} v {1}" + }, + "keybindingStatus": "{0} byl stisknut, čeká se na další klávesy", + "keyboard": { + "choose": "Výběr rozložení klávesnice", + "chooseLayout": "Výběr rozložení klávesnice", + "current": "(aktuální: {0})", + "currentLayout": " - aktuální rozvržení", + "mac": "Klávesnice pro Mac", + "pc": "Klávesnice PC", + "tryDetect": "Pokuste se zjistit rozložení klávesnice z informací o prohlížeči a stisknutých klávesách." + }, + "navigator": { + "clipboardWarn": "Přístup do schránky je odepřen. Zkontrolujte oprávnění prohlížeče.", + "clipboardWarnFirefox": "Rozhraní API schránky není k dispozici. Lze ji povolit pomocí předvolby '{0}' na stránce '{1}'. Poté znovu načtěte aplikaci Theia. Všimněte si, že to umožní FireFoxu získat plný přístup k systémové schránce." + }, + "offline": "Offline", + "pasteWarn": "Použijte příkaz vložit v prohlížeči nebo klávesovou zkratku.", + "quitMessage": "Neuložené změny se neuloží.", + "resetWorkbenchLayout": "Obnovení rozložení pracovního stolu", + "searchbox": { + "close": "Zavřít (únik)", + "next": "Další (dolů)", + "previous": "Předchozí (Nahoru)", + "showAll": "Zobrazit všechny položky", + "showOnlyMatching": "Zobrazit pouze odpovídající položky" + }, + "secondaryWindow": { + "alwaysOnTop": "Je-li tato funkce povolena, zůstane sekundární okno nad všemi ostatními okny, včetně oken různých aplikací.", + "description": "Nastaví počáteční pozici a velikost extrahovaného sekundárního okna.", + "fullSize": "Pozice a velikost extrahovaného widgetu bude stejná jako u spuštěné aplikace Theia.", + "halfWidth": "Pozice a velikost extrahovaného widgetu bude odpovídat polovině šířky spuštěné aplikace Theia.", + "originalSize": "Pozice a velikost extrahovaného widgetu bude stejná jako u původního widgetu." + }, + "severity": { + "log": "Přihlásit se" + }, + "silentNotifications": "Řídí, zda se mají potlačit vyskakovací okna s oznámeními.", + "tabDefaultSize": "Určuje výchozí velikost karet s ouškem.", + "tabMaximize": "Ovládá, zda se mají karty maximalizovat při dvojím kliknutí.", + "tabMinimumSize": "Určuje minimální velikost oušek.", + "tabShrinkToFit": "Zmenšete karty tak, aby se vešly do dostupného prostoru.", + "window": { + "tabCloseIconPlacement": { + "description": "Umístěte ikony zavření na názvy karet na začátek nebo konec karty. Výchozí nastavení je konec na všech platformách.", + "end": "Na konec štítku umístěte ikonu zavření. V jazycích zleva doprava je to pravá strana karty.", + "start": "Umístěte ikonu zavření na začátek štítku. V jazycích zleva doprava je to levá strana karty." + } + }, + "window.menuBarVisibility": "Menu se zobrazuje jako kompaktní tlačítko v postranní liště. Tato hodnota je ignorována, když{0} je {1}." + }, + "debug": { + "TheiaIDE": "Theia IDE", + "addConfigurationPlaceholder": "Vyberte kořenový pracovní prostor, do kterého chcete přidat konfiguraci", + "breakpoint": "bod přerušení", + "cannotRunToThisLocation": "Nepodařilo se spustit aktuální vlákno do zadaného umístění.", + "compound-cycle": "Konfigurace spuštění '{0}' obsahuje cyklus se sebou samým", + "conditionalBreakpoint": "Podmíněný bod přerušení", + "conditionalBreakpointsNotSupported": "Podmíněné body přerušení, které tento typ ladění nepodporuje", + "confirmRunToShiftedPosition_msg": "Cílová pozice se posune na Ln {0}, Col {1}. Spustit i tak?", + "confirmRunToShiftedPosition_title": "Nelze spustit aktuální vlákno přesně na zadané místo", + "consoleFilter": "Filtr (např. text, !vyloučit)", + "consoleFilterAriaLabel": "Filtrovat výstup ladicí konzoly", + "consoleSessionSelectorTooltip": "Přepínání mezi ladicími relacemi. Každá ladicí relace má vlastní výstup konzoly.", + "consoleSeverityTooltip": "Filtrujte výstup konzoly podle úrovně závažnosti. Zobrazí se pouze zprávy s vybranou úrovní závažnosti.", + "continueAll": "Pokračovat ve všem", + "copyExpressionValue": "Kopírování hodnoty výrazu", + "couldNotRunTask": "Nepodařilo se spustit úlohu '{0}'.", + "dataBreakpoint": "bod přerušení dat", + "debugConfiguration": "Konfigurace ladění", + "debugSessionInitializationFailed": "Inicializace relace ladění se nezdařila. Podrobnosti naleznete v konzole.", + "debugSessionTypeNotSupported": "Typ relace ladění \"{0}\" není podporován.", + "debugToolbarMenu": "Nabídka panelu nástrojů Ladění", + "debugVariableInput": "Nastavení hodnoty {0} ", + "disableSelectedBreakpoints": "Zakázat vybrané body přerušení", + "disabledBreakpoint": "Bezbariérový {0}", + "enableSelectedBreakpoints": "Povolení vybraných bodů přerušení", + "entry": "vstup", + "errorStartingDebugSession": "Při spuštění relace ladění došlo k chybě, podrobnosti najdete v protokolech.", + "exception": "výjimka", + "functionBreakpoint": "bod přerušení funkce", + "goto": "přejít na stránku", + "htiConditionalBreakpointsNotSupported": "Zasáhnout podmíněné body přerušení nepodporované tímto typem ladění", + "instruction-breakpoint": "Bod přerušení instrukcí", + "instructionBreakpoint": "bod přerušení instrukcí", + "logpointsNotSupported": "Body protokolu nepodporované tímto typem ladění", + "missingConfiguration": "Dynamická konfigurace '{0}:{1}' chybí nebo není použitelná", + "pause": "pauza", + "pauseAll": "Pozastavit vše", + "reveal": "Odhalení", + "step": "krok", + "taskTerminatedBySignal": "Úloha '{0}' ukončena signálem {1}.", + "taskTerminatedForUnknownReason": "Úloha '{0}' ukončena z neznámého důvodu.", + "taskTerminatedWithExitCode": "Úloha '{0}' byla ukončena s kódem ukončení {1}.", + "threads": "Vlákna", + "toggleTracing": "Povolení/zakázání sledování komunikace s ladicími adaptéry", + "unknownSession": "Neznámé sezení", + "unverifiedBreakpoint": "Neověřené {0}" + }, + "editor": { + "diffEditor.wordWrap2": "Řádky se budou obtékat podle nastavení `#editor.wordWrap#`.", + "dirtyEncoding": "Soubor je znečištěný. Než jej znovu otevřete v jiném kódování, nejprve jej uložte.", + "editor.bracketPairColorization.enabled": "Ovládá, zda je obarvení dvojice závorek povoleno, nebo ne. Pro přepsání barev zvýraznění závorek použijte `#workbench.colorCustomizations#`.", + "editor.codeActions.triggerOnFocusChange": "Povolení spouštění `#editor.codeActionsOnSave#`, když je `#files.autoSave#` nastaveno na `afterDelay`. Code Actions musí být nastaveno na `vždy`, aby se spouštěly při změně okna a fokusu.", + "editor.detectIndentation": "Řídí, zda se při otevření souboru automaticky zjistí `#editor.tabSize#` a `#editor.insertSpaces#` na základě obsahu souboru.", + "editor.experimental.preferTreeSitter": "Ovládá, zda má být pro konkrétní jazyky zapnuto parsování tree sitter. Toto nastavení má přednost před `editor.experimental.treeSitterTelemetry` pro zadané jazyky.", + "editor.inlayHints.enabled1": "Vložené nápovědy se zobrazují ve výchozím nastavení a skrývají se při podržení `Ctrl+Alt`", + "editor.inlayHints.enabled2": "Vložené nápovědy jsou ve výchozím nastavení skryté a zobrazí se při podržení `Ctrl+Alt`.", + "editor.inlayHints.fontFamily": "Řídí rodinu písma vložených nápověd v editoru. Je-li nastaveno na prázdnou hodnotu, použije se `#editor.fontFamily#`.", + "editor.inlayHints.fontSize": "Ovládá velikost písma vložených nápověd v editoru. Ve výchozím nastavení se použije `#editor.fontSize#`, pokud je nastavená hodnota menší než `5` nebo větší než velikost písma editoru.", + "editor.inlineSuggest.edits.experimental.enabled": "Řídí, zda se mají povolit experimentální úpravy v návrzích inline.", + "editor.inlineSuggest.edits.experimental.onlyShowWhenCloseToCursor": "Řídí, zda se mají návrhy na řádku zobrazovat pouze tehdy, když se kurzor nachází v blízkosti návrhu.", + "editor.inlineSuggest.edits.experimental.useInterleavedLinesDiff": "Řídí, zda má být povoleno experimentální prokládání řádků diff v řádkových návrzích.", + "editor.inlineSuggest.edits.experimental.useMixedLinesDiff": "Řídí, zda se mají povolit experimentální úpravy v návrzích inline.", + "editor.insertSpaces": "Vkládání mezer při stisknutí `Tab`. Toto nastavení je přepsáno na základě obsahu souboru, pokud je zapnuta funkce `#editor.detectIndentation#`.", + "editor.quickSuggestions": "Ovládá, zda se mají při psaní automaticky zobrazovat návrhy. To lze ovládat při psaní komentářů, řetězců a dalšího kódu. Rychlé návrhy lze nakonfigurovat tak, aby se zobrazovaly jako text ducha nebo s widgetem návrhu. Mějte také na paměti nastavení '#editor.suggestOnTriggerCharacters#', které řídí, zda se návrhy spouštějí pomocí speciálních znaků.", + "editor.suggestFontSize": "Velikost písma widgetu pro návrh. Je-li nastavena hodnota `0`, použije se hodnota `#editor.fontSize#`.", + "editor.suggestLineHeight": "Výška řádku pro widget návrhu. Je-li nastavena hodnota `0`, použije se hodnota `#editor.lineHeight#`. Minimální hodnota je 8.", + "editor.tabSize": "Počet mezer, kterým se rovná tabulátor. Toto nastavení je přepsáno na základě obsahu souboru, pokud je zapnuta funkce `#editor.detectIndentation#`.", + "formatOnSaveTimeout": "Časový limit v milisekundách, po jehož uplynutí se formátování spuštěné při ukládání souboru zruší.", + "persistClosedEditors": "Řídí, zda má historie zavřených editorů přetrvávat v pracovním prostoru i po opětovném načtení okna.", + "showAllEditors": "Zobrazit všechny otevřené editory", + "splitHorizontal": "Rozdělený editor Horizontální", + "splitVertical": "Rozdělený editor Vertikální", + "toggleStickyScroll": "Přepnout rychlé posouvání" + }, + "external-terminal": { + "cwd": "Výběr aktuálního pracovního adresáře pro nový externí terminál" + }, + "file-search": { + "toggleIgnoredFiles": " (Stisknutím {0} zobrazíte/skryjete ignorované soubory)" + }, + "fileDialog": { + "showHidden": "Zobrazit skryté soubory" + }, + "fileSystem": { + "fileResource": { + "overWriteBody": "Chcete přepsat změny provedené v souboru '{0}' v souborovém systému?" + } + }, + "filesystem": { + "copiedToClipboard": "Zkopírujte odkaz ke stažení do schránky.", + "copyDownloadLink": "Kopírovat odkaz ke stažení", + "dialog": { + "initialLocation": "Přejít na počáteční umístění", + "multipleItemMessage": "Můžete vybrat pouze jednu položku", + "navigateBack": "Přejít zpět", + "navigateForward": "Navigace vpřed", + "navigateUp": "Navigace nahoru v jednom adresáři" + }, + "fileResource": { + "binaryFileQuery": "Jeho otevření může trvat nějakou dobu a může způsobit, že IDE nebude reagovat. Chcete přesto otevřít '{0}'?", + "binaryTitle": "Soubor je buď binární, nebo používá nepodporované kódování textu.", + "largeFileTitle": "Soubor je příliš velký ({0}).", + "overwriteTitle": "Soubor '{0}' byl v souborovém systému změněn." + }, + "filesExclude": "Konfigurace globálních vzorů pro vyloučení souborů a složek. Například Průzkumník souborů na základě tohoto nastavení rozhodne, které soubory a složky zobrazí nebo skryje.", + "format": "Formát:", + "maxConcurrentUploads": "Maximální počet současně nahrávaných souborů při nahrávání více souborů. 0 znamená, že všechny soubory budou nahrávány současně.", + "maxFileSizeMB": "Ovládá maximální velikost souboru v MB, který je možné otevřít.", + "prepareDownload": "Příprava ke stažení...", + "prepareDownloadLink": "Připravujeme odkaz ke stažení...", + "processedOutOf": "Zpracováno {0} z {1}", + "replaceTitle": "Nahradit soubor", + "uploadFailed": "Při nahrávání souboru došlo k chybě. {0}", + "uploadFiles": "Nahrávání souborů...", + "uploadedOutOf": "Nahráno {0} z {1}" + }, + "getting-started": { + "ai": { + "header": "Podpora AI v IDE Theia je k dispozici (beta verze)!", + "openAIChatView": "Otevřete nyní okno AI Chat View a zjistěte, jak začít!" + }, + "apiComparator": "{0} Kompatibilita API", + "newExtension": "Budování nového rozšíření", + "newPlugin": "Vytvoření nového pluginu", + "startup-editor": { + "welcomePage": "Otevřete úvodní stránku s obsahem, který vám pomůže začít pracovat s webem {0} a rozšířeními." + }, + "telemetry": "Používání dat a telemetrie" + }, + "git": { + "aFewSecondsAgo": "před několika sekundami", + "addSignedOff": "Přidat Signed-off-by", + "added": "Přidáno", + "amendReuseMessage": "Chcete-li znovu použít poslední zprávu o revizi, stiskněte klávesu \"Enter\" nebo klávesu \"Escape\" pro zrušení.", + "amendRewrite": "Přepsání předchozí zprávy o revizi. Stisknutím klávesy 'Enter' potvrdíte nebo klávesou 'Escape' zrušíte.", + "checkoutCreateLocalBranchWithName": "Vytvořte novou místní větev s názvem: {0}. Stiskněte klávesu \"Enter\" pro potvrzení nebo \"Escape\" pro zrušení.", + "checkoutProvideBranchName": "Uveďte prosím název pobočky.", + "checkoutSelectRef": "Zvolte referenční číslo, které chcete odhlásit, nebo vytvořte novou místní pobočku:", + "cloneQuickInputLabel": "Uveďte prosím umístění úložiště Git. Stisknutím klávesy \"Enter\" potvrdíte nebo klávesou \"Escape\" zrušíte.", + "cloneRepository": "Klonování úložiště Git: {0}. Stiskněte klávesu 'Enter' pro potvrzení nebo 'Escape' pro zrušení.", + "compareWith": "Porovnat s...", + "compareWithBranchOrTag": "Vyberte větev nebo značku, kterou chcete porovnat s aktuálně aktivní větví {0}:", + "conflicted": "Konfliktní", + "copied": "Zkopírováno", + "diff": "Diff", + "dirtyDiffLinesLimit": "Pokud počet řádků editoru překročí tento limit, nezobrazují se špinavé rozdílové dekorace.", + "dropStashMessage": "Úschovna byla úspěšně odstraněna.", + "editorDecorationsEnabled": "Zobrazení dekorací git v editoru.", + "fetchPickRemote": "Vyberte vzdálené zařízení, ze kterého chcete načíst:", + "gitDecorationsColors": "Použití barevné dekorace v navigátoru.", + "mergeEditor": { + "currentSideTitle": "Aktuální", + "incomingSideTitle": "Příchozí" + }, + "mergeQuickPickPlaceholder": "Vyberte větev, kterou chcete sloučit s aktuálně aktivní větví {0}:", + "missingUserInfo": "Ujistěte se, že jste v systému git nakonfigurovali položky 'user.name' a 'user.email'.", + "noHistoryForError": "Není k dispozici žádná historie {0}", + "noPreviousCommit": "Žádný předchozí závazek ke změně", + "noRepositoriesSelected": "Nebyla vybrána žádná úložiště.", + "prepositionIn": "na adrese", + "renamed": "Přejmenování na", + "repositoryNotInitialized": "Úložiště {0} ještě není inicializováno.", + "stashChanges": "Změny v úložišti. Stisknutím klávesy \"Enter\" potvrďte nebo klávesou \"Escape\" zrušte zadání.", + "stashChangesWithMessage": "Úschovna se mění se zprávou: {0}. Stisknutím klávesy 'Enter' potvrďte nebo klávesou 'Escape' zrušte.", + "tabTitleIndex": "{0} (rejstřík)", + "tabTitleWorkingTree": "{0} (pracovní strom)", + "toggleBlameAnnotations": "Přepínání Anotace obvinění", + "unstaged": "Neinscenované" + }, + "keybinding-schema-updater": { + "deprecation": "Místo toho použijte klauzuli `when`." + }, + "keymaps": { + "addKeybindingTitle": "Přidání vazby na klávesy pro {0}", + "editKeybinding": "Upravit vazbu kláves...", + "editKeybindingTitle": "Upravit vazbu kláves pro {0}", + "editWhenExpression": "Upravit Při vyjádření...", + "editWhenExpressionTitle": "Upravit, když výraz pro {0}", + "keybinding": { + "copy": "Kopírování vazby kláves", + "copyCommandId": "Kopírování vazby na klávesy ID příkazu", + "copyCommandTitle": "Kopírovat vazbu kláves Název příkazu", + "edit": "Upravit vazbu kláves...", + "editWhenExpression": "Upravit vazbu kláves Při výrazu..." + }, + "keybindingCollidesValidation": "vazba kláves v současné době koliduje", + "requiredKeybindingValidation": "je vyžadována hodnota keybindingu", + "resetKeybindingConfirmation": "Opravdu chcete obnovit výchozí hodnotu této vazby kláves?", + "resetKeybindingTitle": "Obnovení vazby kláves pro {0}", + "resetMultipleKeybindingsWarning": "Pokud pro tento příkaz existuje více klávesových vazeb, budou resetovány všechny." + }, + "localize": { + "offlineTooltip": "Nelze se připojit k backendu." + }, + "markers": { + "clearAll": "Vymazat vše", + "noProblems": "V pracovním prostoru zatím nebyly zjištěny žádné problémy.", + "tabbarDecorationsEnabled": "Zobrazení dekorátorů problémů (diagnostických značek) na pásech karet." + }, + "memory-inspector": { + "addressTooltip": "Místo v paměti, které se má zobrazit, adresa nebo výraz vyhodnocující adresu.", + "ascii": "ASCII", + "binary": "Binární", + "byteSize": "Velikost bajtu", + "bytesPerGroup": "Byty na skupinu", + "closeSettings": "Zavřít nastavení", + "columns": "Sloupce", + "command": { + "createNewMemory": "Vytvoření nového inspektora paměti", + "createNewRegisterView": "Vytvoření nového zobrazení registru", + "followPointer": "Sledování ukazatele", + "followPointerMemory": "Sledování ukazatele v aplikaci Inspektor paměti", + "resetValue": "Obnovení hodnoty", + "showRegister": "Zobrazit registr v Inspektoru paměti", + "viewVariable": "Zobrazit proměnnou v Inspektorovi paměti" + }, + "data": "Data", + "decimal": "Desetinné číslo", + "diff": { + "label": "Rozdíl: {0}" + }, + "diff-widget": { + "offset-label": "{0} Offset", + "offset-title": "Bajty pro odsazení paměti od {0}" + }, + "editable": { + "apply": "Použít změny", + "clear": "Jasné změny" + }, + "endianness": "Endianness", + "extraColumn": "Sloupec navíc", + "groupsPerRow": "Skupiny na řádek", + "hexadecimal": "Hexadecimální", + "length": "Délka", + "lengthTooltip": "Počet bajtů k načtení v desítkové nebo šestnáctkové soustavě.", + "memory": { + "addressField": { + "memoryReadError": "Do pole Umístění zadejte adresu nebo výraz." + }, + "freeze": "Zobrazení zmrazení paměti", + "hideSettings": "Skrytí panelu nastavení", + "readError": { + "bounds": "Překročení mezí paměti, výsledek bude zkrácen.", + "noContents": "V současné době není k dispozici žádný obsah paměti." + }, + "readLength": { + "memoryReadError": "Do pole Délka zadejte délku (desetinné nebo šestnáctinné číslo)." + }, + "showSettings": "Zobrazit panel nastavení", + "unfreeze": "Zrušení zmrazení zobrazení paměti", + "userError": "Došlo k chybě při načítání paměti." + }, + "memoryCategory": "Inspektor paměti", + "memoryInspector": "Inspektor paměti", + "memoryTitle": "Paměť", + "octal": "Osmičkové", + "offset": "Offset", + "offsetTooltip": "Odsazení, které se při navigaci přidá k aktuálnímu umístění v paměti.", + "provider": { + "localsError": "Nelze číst místní proměnné. Není aktivní relace ladění.", + "readError": "Nelze číst paměť. Není aktivní relace ladění.", + "writeError": "Nelze zapisovat do paměti. Není aktivní relace ladění." + }, + "register": "Registrace", + "register-widget": { + "filter-placeholder": "Filtr (začíná na)" + }, + "registerReadError": "Došlo k chybě při načítání registrů.", + "registers": "Registry", + "toggleComparisonWidgetVisibility": "Přepnutí viditelnosti widgetu Srovnání", + "utils": { + "afterBytes": "V obou widgetech, které chcete porovnat, musíte načíst paměť. {0} nemá načtenou žádnou paměť.", + "bytesMessage": "V obou widgetech, které chcete porovnat, musíte načíst paměť. {0} nemá načtenou žádnou paměť." + } + }, + "messages": { + "notificationTimeout": "Po uplynutí tohoto časového limitu budou informativní oznámení skryta.", + "toggleNotifications": "Přepínání oznámení" + }, + "mini-browser": { + "typeUrl": "Zadejte adresu URL" + }, + "monaco": { + "noSymbolsMatching": "Žádné odpovídající symboly", + "typeToSearchForSymbols": "Zadejte hledání symbolů" + }, + "navigator": { + "autoReveal": "Automatické odhalení", + "clipboardWarn": "Přístup do schránky je odepřen. Zkontrolujte oprávnění prohlížeče.", + "clipboardWarnFirefox": "Rozhraní API schránky není k dispozici. Lze ji povolit pomocí předvolby '{0}' na stránce '{1}'. Poté znovu načtěte aplikaci Theia. Všimněte si, že to umožní FireFoxu získat plný přístup k systémové schránce.", + "openWithSystemEditor": "Otevřít v editoru systému", + "refresh": "Obnovení v Průzkumníku", + "reveal": "Odhalení v Průzkumníkovi", + "systemEditor": "Editor systému", + "toggleHiddenFiles": "Přepínání skrytých souborů" + }, + "output": { + "clearOutputChannel": "Jasný výstupní kanál...", + "closeOutputChannel": "Zavřít výstupní kanál...", + "hiddenChannels": "Skryté kanály", + "hideOutputChannel": "Skrýt výstupní kanál...", + "maxChannelHistory": "Maximální počet záznamů ve výstupním kanálu.", + "outputChannels": "Výstupní kanály", + "showOutputChannel": "Zobrazit výstupní kanál..." + }, + "plugin": { + "blockNewTab": "Váš prohlížeč zabránil otevření nové karty" + }, + "plugin-dev": { + "alreadyRunning": "Hostovaná instance je již spuštěna.", + "debugInstance": "Instance ladění", + "debugMode": "Použití inspect nebo inspect-brk pro ladění Node.js", + "debugPorts": { + "debugPort": "Port, který se použije pro ladění Node.js tohoto serveru" + }, + "devHost": "Vývojový hostitel", + "failed": "Nepodařilo se spustit hostovanou instanci zásuvného modulu: {0}", + "hostedPlugin": "Hostovaný plugin", + "hostedPluginRunning": "Hostovaný plugin: Spuštěn", + "hostedPluginStarting": "Hostovaný plugin: Spuštění", + "hostedPluginStopped": "Hostovaný plugin: Zastaven", + "hostedPluginWatching": "Hostovaný plugin: Sledování", + "instanceTerminated": "{0} bylo ukončeno", + "launchOutFiles": "Pole glob vzorů pro vyhledávání generovaných souborů JavaScript (`${pluginPath}` bude nahrazeno skutečnou cestou k zásuvnému modulu).", + "noValidPlugin": "Zadaná složka neobsahuje platný zásuvný modul.", + "notRunning": "Hostovaná instance není spuštěna.", + "pluginFolder": "Složka pluginu je nastavena na: {0}", + "preventedNewTab": "Váš prohlížeč zabránil otevření nové karty", + "restartInstance": "Restartování instance", + "running": "Hostovaná instance je spuštěna na adrese:", + "selectPath": "Vybrat cestu", + "startInstance": "Spuštění instance", + "starting": "Spuštění serveru hostované instance ...", + "stopInstance": "Zastavit instanci", + "unknownTerminated": "Instance byla ukončena", + "watchMode": "Spuštění sledovacího nástroje na vyvíjeném zásuvném modulu" + }, + "plugin-ext": { + "authentication-main": { + "loginTitle": "Přihlášení", + "signedOut": "Úspěšně odhlášeno." + }, + "plugins": "Zásuvné moduly", + "webviewTrace": "Řídí sledování komunikace s webovými pohledy.", + "webviewWarnIfUnsecure": "Upozorňuje uživatele, že webové náhledy jsou v současné době nasazeny nezabezpečeně." + }, + "preferences": { + "ai-features": "Funkce umělé inteligence", + "hostedPlugin": "Hostovaný plugin", + "toolbar": "Panel nástrojů" + }, + "preview": { + "openByDefault": "Ve výchozím nastavení otevřete místo editoru náhled." + }, + "property-view": { + "created": "Vytvořeno", + "directory": "Adresář", + "lastModified": "Naposledy upraveno", + "location": "Umístění", + "noProperties": "Žádné vlastnosti nejsou k dispozici.", + "properties": "Vlastnosti", + "symbolicLink": "Symbolický odkaz" + }, + "remote": { + "dev-container": { + "connect": "Znovu otevřít v kontejneru", + "noDevcontainerFiles": "V pracovním prostoru nebyly nalezeny žádné soubory devcontainer.json. Zkontrolujte, zda máte adresář .devcontainer se souborem devcontainer.json.", + "selectDevcontainer": "Výběr souboru devcontainer.json" + }, + "ssh": { + "connect": "Připojení aktuálního okna k hostiteli...", + "connectToConfigHost": "Připojení aktuálního okna k hostiteli v konfiguračním souboru...", + "enterHost": "Zadejte název hostitele SSH", + "enterUser": "Zadejte jméno uživatele SSH", + "failure": "Nepodařilo se otevřít připojení SSH ke vzdálenému serveru.", + "hostPlaceHolder": "Např. hello@example.com", + "needsHost": "Zadejte název hostitele.", + "needsUser": "Zadejte prosím uživatelské jméno.", + "userPlaceHolder": "Např. ahoj" + }, + "sshNoConfigPath": "Nebyla nalezena žádná cesta ke konfiguraci SSH.", + "wsl": { + "connectToWsl": "Připojení k WSL", + "connectToWslUsingDistro": "Připojení k WSL pomocí Distro...", + "noWslDistroFound": "Nebyly nalezeny žádné distribuce WSL. Nejprve nainstalujte distribuci WSL.", + "reopenInWsl": "Opětovné otevření složky v aplikaci WSL", + "selectWSLDistro": "Výběr distribuce WSL" + } + }, + "scm": { + "amend": "Změnit", + "amendHeadCommit": "HEAD Commit", + "amendLastCommit": "Změnit poslední revizi", + "changeRepository": "Úložiště změn...", + "config.untrackedChanges": "Řídí chování nesledovaných změn.", + "config.untrackedChanges.hidden": "skryté", + "config.untrackedChanges.mixed": "smíšené", + "config.untrackedChanges.separate": "samostatné stránky", + "dirtyDiff": { + "close": "Zavřít Změnit pohled" + }, + "history": "Historie", + "mergeEditor": { + "resetConfirmationTitle": "Opravdu chcete v tomto editoru obnovit výsledek sloučení?" + }, + "noRepositoryFound": "Nebylo nalezeno žádné úložiště", + "unamend": "Odstranit změny", + "unamendCommit": "Změna revize" + }, + "search-in-workspace": { + "includeIgnoredFiles": "Zahrnout ignorované soubory", + "noFolderSpecified": "Složku jste neotevřeli ani nezadali. Aktuálně se prohledávají pouze otevřené soubory.", + "resultSubset": "Jedná se pouze o podmnožinu všech výsledků. Pro zúžení seznamu výsledků použijte konkrétnější vyhledávací výraz.", + "searchOnEditorModification": "Prohledat aktivní editor při úpravě." + }, + "secondary-window": { + "extract-widget": "Přesunutí zobrazení do sekundárního okna" + }, + "shell-area": { + "secondary": "Sekundární okno" + }, + "task": { + "attachTask": "Připojte úkol...", + "circularReferenceDetected": "Zjištěn kruhový odkaz: {0} --> {1}", + "clearHistory": "Vymazat historii", + "errorKillingTask": "Chyba při ukončování úlohy '{0}': {1}", + "errorLaunchingTask": "Chyba při spuštění úlohy '{0}': {1}", + "invalidTaskConfigs": "Byly nalezeny neplatné konfigurace úloh. Otevřete soubor tasks.json a vyhledejte podrobnosti v zobrazení Problems.", + "neverScanTaskOutput": "Nikdy neskenujte výstup úlohy", + "noTaskToRun": "Nebyla nalezena žádná úloha ke spuštění. Konfigurace úloh...", + "noTasksFound": "Nebyly nalezeny žádné úkoly", + "notEnoughDataInDependsOn": "Informace uvedené v \"dependsOn\" nejsou pro přiřazení správného úkolu dostačující!", + "schema": { + "commandOptions": { + "cwd": "Aktuální pracovní adresář spouštěného programu nebo skriptu. Pokud je vynechán, použije se kořenový adresář aktuálního pracovního prostoru Theia." + }, + "presentation": { + "panel": { + "dedicated": "Terminál je určen pro konkrétní úkol. Pokud je tato úloha znovu spuštěna, terminál je znovu použit. Výstup jiné úlohy je však prezentován v jiném terminálu.", + "new": "Při každém provedení této úlohy se použije nový čistý terminál.", + "shared": "Terminál je sdílený a výstupy ostatních spuštěných úloh se přidávají do stejného terminálu." + }, + "showReuseMessage": "Ovládá, zda se má zobrazit zpráva \"Terminál bude znovu použit úlohami\"." + }, + "problemMatcherObject": { + "owner": "Majitel problému uvnitř Theia. Lze vynechat, pokud je zadána základna. Pokud je vynecháno a základna není zadána, výchozí hodnota je \"external\"." + } + }, + "taskAlreadyRunningInTerminal": "Úloha je již spuštěna v terminálu", + "taskExitedWithCode": "Úloha '{0}' byla ukončena s kódem {1}.", + "taskTerminalTitle": "Úkol: {0}", + "taskTerminatedBySignal": "Úloha '{0}' byla ukončena signálem {1}.", + "terminalWillBeReusedByTasks": "Terminál bude znovu použit v úlohách." + }, + "terminal": { + "defaultProfile": "Výchozí profil používaný v {0}", + "enableCopy": "Povolení funkce ctrl-c (cmd-c v systému macOS) pro kopírování vybraného textu", + "enablePaste": "Povolení funkce ctrl-v (cmd-v v systému macOS) pro vkládání ze schránky", + "profileArgs": "Argumenty shellu, které tento profil používá.", + "profileColor": "ID barvy motivu terminálu, které se přiřadí k terminálu.", + "profileDefault": "Zvolte výchozí profil...", + "profileIcon": "ID kodikonu, které se přiřadí k ikoně terminálu.\nterminal-tmux:\"$(terminal-tmux)\"", + "profileNew": "Nový terminál (s profilem)...", + "profilePath": "Cesta k shellu, který tento profil používá.", + "profiles": "Profily, které se mají zobrazit při vytváření nového terminálu. Vlastnost path nastavte ručně pomocí nepovinných argumentů.\nNastavením existujícího profilu na `null` jej skryjete ze seznamu, například: `\"{0}\": null`.", + "rendererType": "Ovládá způsob vykreslování terminálu.", + "rendererTypeDeprecationMessage": "Typ vykreslovače již není podporován jako volitelná možnost.", + "selectProfile": "Výběr profilu pro nový terminál", + "shell.deprecated": "Tento postup je zastaralý, nový doporučený způsob konfigurace výchozího shellu je vytvoření profilu terminálu v 'terminal.integrated.profiles.{0}' a nastavení jeho názvu jako výchozího v 'terminal.integrated.defaultProfile.{0}.'", + "shellArgsLinux": "Argumenty příkazového řádku, které se použijí v terminálu Linuxu.", + "shellArgsOsx": "Argumenty příkazového řádku, které se použijí v terminálu systému macOS.", + "shellArgsWindows": "Argumenty příkazového řádku, které se použijí v terminálu systému Windows.", + "shellLinux": "Cesta k shellu, který terminál používá v Linuxu (výchozí: '{0}'}).", + "shellOsx": "Cesta k shellu, který terminál používá v systému macOS (výchozí: '{0}'}).", + "shellWindows": "Cesta k shellu, který terminál používá v systému Windows. (výchozí: '{0}')." + }, + "terminal-manager": { + "addTerminalToGroup": "Přidat terminál do skupiny", + "closeDialog": { + "message": "Po zavření Správce terminálu nelze jeho rozložení obnovit. Opravdu chcete Správce terminálu zavřít?", + "title": "Chcete zavřít správce terminálu?" + }, + "closeTerminalManager": "Zavřít správce terminálu", + "createNewTerminalGroup": "Vytvořit novou skupinu terminálů", + "createNewTerminalPage": "Vytvořit novou stránku terminálu", + "deleteGroup": "Odstranit skupinu", + "deletePage": "Smazat stránku", + "deleteTerminal": "Odstranit terminál", + "group": "Skupina", + "label": "Terminály", + "maximizeBottomPanel": "Maximalizovat spodní panel", + "minimizeBottomPanel": "Minimalizovat spodní panel", + "openTerminalManager": "Otevřít správce terminálu", + "page": "Stránka", + "rename": "Přejmenovat", + "resetTerminalManagerLayout": "Resetovat rozložení správce terminálu", + "toggleTreeView": "Přepnout zobrazení stromu" + }, + "test": { + "cancelAllTestRuns": "Zrušení všech testovacích běhů", + "stackFrameAt": "na adrese", + "testRunDefaultName": "{0} spustit {1}", + "testRuns": "Testovací běhy" + }, + "toolbar": { + "addCommand": "Přidání příkazu na panel nástrojů", + "addCommandPlaceholder": "Najděte příkaz, který chcete přidat na panel nástrojů", + "centerColumn": "Středový sloupec", + "failedUpdate": "Nepodařilo se aktualizovat hodnotu '{0}' v '{1}'.", + "filterIcons": "Ikony filtrů", + "iconSelectDialog": "Výběr ikony pro '{0}'", + "iconSet": "Sada ikon", + "insertGroupLeft": "Vložit oddělovač skupin (vlevo)", + "insertGroupRight": "Vložit oddělovač skupin (vpravo)", + "leftColumn": "Levý sloupec", + "openJSON": "Přizpůsobení panelu nástrojů (Otevřít JSON)", + "removeCommand": "Odstranění příkazu z panelu nástrojů", + "restoreDefaults": "Obnovení výchozího nastavení panelu nástrojů", + "rightColumn": "Pravý sloupec", + "selectIcon": "Vybrat ikonu", + "toggleToolbar": "Přepínání panelu nástrojů", + "toolbarLocationPlaceholder": "Kam chcete příkaz přidat?", + "useDefaultIcon": "Použití výchozí ikony" + }, + "typehierarchy": { + "subtypeHierarchy": "Hierarchie podtypů", + "supertypeHierarchy": "Hierarchie nadtypů" + }, + "variableResolver": { + "listAllVariables": "Proměnná: Seznam všech" + }, + "vsx-registry": { + "confirmDialogMessage": "Rozšíření \"{0}\" není ověřeno a může představovat bezpečnostní riziko.", + "confirmDialogTitle": "Jste si jisti, že chcete pokračovat v instalaci ?", + "downloadCount": "Počet stažení: {0}", + "errorFetching": "Chyba při načítání rozšíření.", + "errorFetchingConfigurationHint": "To může být způsobeno problémy s konfigurací sítě.", + "failedInstallingVSIX": "Nepodařilo se nainstalovat {0} z VSIX.", + "invalidVSIX": "Vybraný soubor není platný zásuvný modul \"*.vsix\".", + "license": "Licence: {0}", + "onlyShowVerifiedExtensionsDescription": "Díky tomu se na stránkách {0} zobrazují pouze ověřená rozšíření.", + "onlyShowVerifiedExtensionsTitle": "Zobrazit pouze ověřená rozšíření", + "recommendedExtensions": "Seznam názvů rozšíření doporučených pro použití v tomto pracovním prostoru.", + "searchPlaceholder": "Hledat rozšíření v {0}", + "showInstalled": "Zobrazit nainstalovaná rozšíření", + "showRecommendedExtensions": "Řídí, zda se mají zobrazovat oznámení pro doporučení rozšíření.", + "vsx-extensions-contribution": { + "update-version-uninstall-error": "Chyba při odstraňování rozšíření: {0}.", + "update-version-version-error": "Nepodařilo se nainstalovat verzi {0} {1} ." + } + }, + "webview": { + "goToReadme": "Přejít na README", + "messageWarning": " Vzor hostitele {0} byl změněn na `{1}`; změna vzoru může vést k bezpečnostním zranitelnostem. Další informace naleznete v části `{2}`." + }, + "workspace": { + "bothAreDirectories": "Oba zdroje jsou adresáře.", + "clickToManageTrust": "Kliknutím spravujete nastavení důvěryhodnosti.", + "compareWithEachOther": "Vzájemné porovnání", + "confirmDeletePermanently.description": "Nepodařilo se odstranit položku \"{0}\" pomocí Koše. Chcete jej místo toho trvale odstranit?", + "confirmDeletePermanently.solution": "Používání Koše můžete zakázat v předvolbách.", + "confirmDeletePermanently.title": "Chyba při mazání souboru", + "confirmMessage.delete": "Opravdu chcete odstranit následující soubory?", + "confirmMessage.dirtyMultiple": "Opravdu chcete odstranit {0} souborů s neuloženými změnami?", + "confirmMessage.dirtySingle": "Opravdu chcete smazat {0} s neuloženými změnami?", + "confirmMessage.uriMultiple": "Opravdu chcete odstranit všechny {0} vybrané soubory?", + "confirmMessage.uriSingle": "Opravdu chcete odstranit {0}?", + "directoriesCannotBeCompared": "Adresáře nelze porovnávat. {0}", + "duplicate": "Duplikát", + "failSaveAs": "Nelze spustit \"{0}\" pro aktuální widget.", + "isDirectory": "{0}'' je adresář.", + "manageTrustPlaceholder": "Vyberte stav důvěryhodnosti pro tento pracovní prostor", + "newFilePlaceholder": "Název souboru", + "newFolderPlaceholder": "Název složky", + "noErasure": "Poznámka: Z disku se nic nevymaže", + "notWorkspaceFile": "Neplatný soubor pracovního prostoru: {0}", + "openRecentPlaceholder": "Zadejte název pracovního prostoru, který chcete otevřít.", + "openRecentWorkspace": "Otevřít nedávný pracovní prostor...", + "preserveWindow": "Povolit otevírání pracovních ploch v aktuálním okně.", + "removeFolder": "Jste si jisti, že chcete z pracovního prostoru odebrat následující složku?", + "removeFolders": "Jste si jisti, že chcete z pracovního prostoru odebrat následující složky?", + "restrictedModeDescription": "Některé funkce jsou deaktivovány, protože tento pracovní prostor není důvěryhodný.", + "restrictedModeNote": "*Upozornění: Funkce důvěryhodnosti pracovního prostoru je v současné době ve vývoji v Theia; ne všechny funkce jsou zatím integrovány do důvěryhodnosti pracovního prostoru.*", + "schema": { + "folders": { + "description": "Kořenové složky v pracovním prostoru" + }, + "title": "Pracovní prostor Soubor" + }, + "trashTitle": "Přesun {0} do koše", + "trustEmptyWindow": "Řídí, zda má být prázdný pracovní prostor ve výchozím nastavení důvěryhodný.", + "trustEnabled": "Řídí, zda je povolena důvěryhodnost pracovního prostoru. Pokud je zakázáno, jsou důvěryhodné všechny pracovní prostory.", + "trustTrustedFolders": "Seznam adresářů URI, které jsou důvěryhodné bez dotazu.", + "untitled-cleanup": "Zdá se, že existuje mnoho nepojmenovaných souborů pracovního prostoru. Zkontrolujte prosím {0} a odstraňte všechny nepoužívané soubory.", + "variables": { + "cwd": { + "description": "Aktuální pracovní adresář task runneru při spuštění" + }, + "file": { + "description": "Cesta k aktuálně otevřenému souboru" + }, + "fileBasename": { + "description": "Základní název aktuálně otevřeného souboru" + }, + "fileBasenameNoExtension": { + "description": "Název aktuálně otevřeného souboru bez přípony" + }, + "fileDirname": { + "description": "Název adresáře aktuálně otevřeného souboru" + }, + "fileExtname": { + "description": "Rozšíření aktuálně otevřeného souboru" + }, + "relativeFile": { + "description": "Cesta k aktuálně otevřenému souboru vzhledem ke kořenovému adresáři pracovního prostoru" + }, + "relativeFileDirname": { + "description": "Název adresáře aktuálně otevřeného souboru relativní k ${workspaceFolder}" + }, + "workspaceFolder": { + "description": "Cesta ke kořenové složce pracovního prostoru" + }, + "workspaceFolderBasename": { + "description": "Název kořenové složky pracovního prostoru" + }, + "workspaceRoot": { + "description": "Cesta ke kořenové složce pracovního prostoru" + }, + "workspaceRootFolderName": { + "description": "Název kořenové složky pracovního prostoru" + } + }, + "workspaceFolderAdded": "Byl vytvořen pracovní prostor s více kořeny. Chcete uložit konfiguraci pracovního prostoru jako soubor?", + "workspaceFolderAddedTitle": "Složka přidaná do pracovního prostoru" + } + }, + "vsx.disabling": "Vypnutí stránky", + "vsx.disabling.extensions": "Vypnutí stránky {0}...", + "vsx.enabling": "Povolení", + "vsx.enabling.extension": "Umožnění {0}..." +} diff --git a/packages/core/i18n/nls.de.json b/packages/core/i18n/nls.de.json new file mode 100644 index 0000000..92e1694 --- /dev/null +++ b/packages/core/i18n/nls.de.json @@ -0,0 +1,2097 @@ +{ + "ai-chat-ui.show-settings": "AI-Einstellungen anzeigen", + "ai-chat:summarize-session-as-task-for-coder": "Zusammenfassen der Sitzung als Aufgabe für den Codierer", + "ai.executePlanWithCoder": "Aktuellen Plan mit Coder ausführen", + "ai.updateTaskContext": "Aktuellen Aufgabenkontext aktualisieren", + "aiConfiguration:open": "AI-Konfigurationsansicht öffnen", + "aiHistory:clear": "AI-Verlauf: Geschichte löschen", + "aiHistory:open": "AI-Historienansicht öffnen", + "aiHistory:sortChronologically": "AI-Geschichte: Chronologisch sortieren", + "aiHistory:sortReverseChronologically": "AI-Geschichte: Rückwärts chronologisch sortieren", + "aiHistory:toggleCompact": "AI-Geschichte: Kompaktansicht umschalten", + "aiHistory:toggleHideNewlines": "AI-Verlauf: Keine Interpretation von Zeilenumbrüchen mehr", + "aiHistory:toggleRaw": "AI-Geschichte: Rohansicht umschalten", + "aiHistory:toggleRenderNewlines": "AI-Geschichte: Neuzeilen interpretieren", + "debug.breakpoint.editCondition": "Edit Bedingung...", + "debug.breakpoint.removeSelected": "Ausgewählte Haltepunkte entfernen", + "debug.breakpoint.toggleEnabled": "Aktivieren Sie die Haltepunkte", + "notebook.cell.changeToCode": "Zelle in Code ändern", + "notebook.cell.changeToMarkdown": "Zelle in Mardown ändern", + "notebook.cell.insertMarkdownCellAbove": "Markdown-Zelle oben einfügen", + "notebook.cell.insertMarkdownCellBelow": "Markdown-Zelle unten einfügen", + "terminal:new:profile": "Neues integriertes Terminal aus einem Profil erstellen", + "terminal:profile:default": "Wählen Sie das Standard-Terminalprofil", + "theia": { + "ai": { + "agents": { + "completionNotification": { + "mdDescription": "Benachrichtigungsverhalten, wenn dieser Agent eine Aufgabe erledigt hat. Wenn nicht gesetzt, wird die globale Standard-Benachrichtigungseinstellung verwendet.\n - o-Benachrichtigung\": OS/System-Benachrichtigungen anzeigen\n - Nachricht\": Anzeige von Benachrichtigungen in der Statusleiste/im Nachrichtenbereich\n - Blinken\": Blinken oder Hervorheben der Benutzeroberfläche\n - Aus\": Benachrichtigungen für diesen Agenten deaktivieren", + "title": "Benachrichtigung über die Fertigstellung" + }, + "enable": { + "mdDescription": "Gibt an, ob der Agent aktiviert (true) oder deaktiviert (false) werden soll.", + "title": "Agent freischalten" + }, + "languageModelRequirements": { + "identifier": { + "mdDescription": "Der Bezeichner des zu verwendenden Sprachmodells." + }, + "mdDescription": "Gibt die verwendeten Sprachmodelle für diesen Agenten an.", + "purpose": { + "mdDescription": "Der Zweck, für den dieses Sprachmodell verwendet wird.", + "title": "Zweck" + }, + "title": "Anforderungen an das Sprachmodell" + }, + "mdDescription": "Konfigurieren Sie Agenteneinstellungen wie die Aktivierung oder Deaktivierung bestimmter Agenten, die Konfiguration von Eingabeaufforderungen und die Auswahl von LLMs.", + "selectedVariants": { + "mdDescription": "Gibt die aktuell ausgewählten Prompt-Varianten für diesen Agenten an.", + "title": "Ausgewählte Varianten" + }, + "title": "Agent-Einstellungen" + }, + "anthropic": { + "apiKey": { + "description": "Geben Sie einen API-Schlüssel für Ihr offizielles Anthropic-Konto ein. **Bitte beachten Sie:** Wenn Sie diese Einstellung verwenden, wird der Anthropic-API-Schlüssel im Klartext auf dem Rechner gespeichert, auf dem Theia läuft. Verwenden Sie die Umgebungsvariable `ANTHROPIC_API_KEY`, um den Schlüssel sicher zu setzen." + }, + "models": { + "description": "Offizielle anthropische Modelle zur Verwendung" + } + }, + "chat": { + "agent": { + "architect": "Architekt", + "coder": "Coder", + "universal": "Universal" + }, + "applySuggestion": "Vorschlag anwenden", + "bypassModelRequirement": { + "description": "Umgehen Sie die Überprüfung der Sprachmodellanforderungen. Aktivieren Sie diese Option, wenn Sie externe Agenten (z. B. Claude Code) verwenden, die keine Theia-Sprachmodelle erfordern." + }, + "changeSetDefaultTitle": "Vorgeschlagene Änderungen", + "changeSetFileDiffUriLabel": "AI-Änderungen: {0}", + "chatAgentsVariable": { + "description": "Gibt die Liste der im System verfügbaren Chat-Agenten zurück" + }, + "chatSessionNamingAgent": { + "description": "Agent zum Erzeugen von Chatsitzungsnamen", + "vars": { + "conversation": { + "description": "Der Inhalt des Chatgesprächs." + }, + "listOfSessionNames": { + "description": "Die Liste der vorhandenen Sitzungsnamen." + } + } + }, + "chatSessionSummaryAgent": { + "description": "Agent zur Erstellung von Zusammenfassungen von Chatsitzungen." + }, + "confirmApplySuggestion": "Die Datei {0} hat sich seit der Erstellung dieses Vorschlags geändert. Sind Sie sicher, dass Sie die Änderung übernehmen wollen?", + "confirmRevertSuggestion": "Die Datei {0} hat sich seit der Erstellung dieses Vorschlags geändert. Sind Sie sicher, dass Sie die Änderung rückgängig machen wollen?", + "couldNotFindMatchingLM": "Es konnte kein passendes Sprachmodell gefunden werden. Bitte überprüfen Sie Ihre Einstellungen!", + "couldNotFindReadyLMforAgent": "Es konnte kein fertiges Sprachmodell für Agent {0} gefunden werden. Bitte überprüfen Sie Ihre Einstellungen!", + "defaultAgent": { + "description": "Optional: des Chat-Agenten, der aufgerufen werden soll, wenn in der Benutzeranfrage kein Agent explizit mit @ genannt wird. Wenn kein Standard-Agent konfiguriert ist, werden die Standardwerte von Theia verwendet." + }, + "imageContextVariable": { + "args": { + "data": { + "description": "Die Bilddaten in base64." + }, + "mimeType": { + "description": "Der Mimetyp des Bildes." + }, + "name": { + "description": "Der Name der Bilddatei, falls vorhanden." + }, + "wsRelativePath": { + "description": "Der auf den Arbeitsbereich bezogene Pfad der Bilddatei, falls vorhanden." + } + }, + "description": "Liefert Kontextinformationen für ein Bild", + "label": "Image File" + }, + "orchestrator": { + "description": "Dieser Agent analysiert die Benutzeranfrage anhand der Beschreibung aller verfügbaren Chat-Agenten und wählt den am besten geeigneten Agenten zur Beantwortung der Anfrage aus (mithilfe von KI). Die Anfrage des Benutzers wird ohne weitere Bestätigung direkt an den ausgewählten Agenten weitergeleitet.", + "vars": { + "availableChatAgents": { + "description": "Die Liste der Chat-Agenten, an die der Orchestrator delegieren kann, mit Ausnahme der Agenten, die in der Präferenz Ausschlussliste angegeben sind." + } + } + }, + "pinChatAgent": { + "description": "Aktivieren Sie das Anheften von Agenten, um einen erwähnten Chat-Agenten automatisch über mehrere Prompts hinweg aktiv zu halten und so die Notwendigkeit wiederholter Erwähnungen zu verringern." + }, + "revertSuggestion": "Vorschlag zurücknehmen", + "selectImageFile": "Wählen Sie eine Bilddatei", + "sessionStorage": { + "description": "Konfigurieren Sie, wo Chat-Sitzungen gespeichert werden sollen.", + "globalPath": "Globaler Pfad", + "pathNotUsedForScope": "Nicht verwendet mit dem Speicherbereich „{0}“.", + "pathRequired": "Der Pfad darf nicht leer sein.", + "pathSettings": "Pfadeinstellungen", + "resetToDefault": "Auf Standard zurücksetzen", + "scope": { + "global": "Speichern Sie Chat-Sitzungen im globalen Konfigurationsordner.", + "workspace": "Speichern Sie Chat-Sitzungen im Arbeitsbereichsordner." + }, + "workspacePath": "Arbeitsbereichspfad" + }, + "taskContextService": { + "summarizeProgressMessage": "Fassen Sie zusammen: {0}", + "updatingProgressMessage": "Aktualisieren: {0}" + }, + "toolConfirmation": { + "confirm": { + "description": "Vor der Ausführung von Tools um Bestätigung bitten" + }, + "disabled": { + "description": "Werkzeugausführung deaktivieren" + }, + "yolo": { + "description": "Werkzeuge automatisch ohne Bestätigung ausführen" + } + }, + "view": { + "label": "AI-Chat" + } + }, + "chat-ui": { + "addContextVariable": "Kontextvariable hinzufügen", + "agent": "Agent", + "aiDisabled": "AI-Funktionen sind deaktiviert", + "applyAll": "Alle anwenden", + "applyAllTitle": "Alle anstehenden Änderungen übernehmen", + "askQuestion": "Eine Frage stellen", + "attachToContext": "Elemente an den Kontext anhängen", + "cancel": "Abbrechen (Esc)", + "chat-view-tree-widget": { + "ai": "AI", + "aiFeatureHeader": "🚀 AI-Funktionen verfügbar (Alpha-Version)!", + "featuresDisabled": "Derzeit sind alle KI-Funktionen deaktiviert!", + "generating": "Erzeugen", + "howToEnable": "So aktivieren Sie die KI-Funktionen:", + "noRenderer": "Fehler: Kein Renderer gefunden", + "scrollToBottom": "Zur letzten Nachricht springen", + "waitingForInput": "Warten auf Eingaben", + "you": "Sie" + }, + "chatInput": { + "clearHistory": "Verlauf der Eingabeaufforderung löschen", + "cycleMode": "Zyklus-Chat-Modus", + "nextPrompt": "Next Prompt", + "previousPrompt": "Vorherige Aufforderung" + }, + "chatInputAriaLabel": "Geben Sie hier Ihre Nachricht ein", + "chatResponses": "Chat-Antworten", + "code-part-renderer": { + "generatedCode": "Erstellter Code" + }, + "collapseChangeSet": "Änderungssatz zusammenklappen", + "command-part-renderer": { + "commandNotExecutable": "Der Befehl hat die ID \"{0}\", ist aber nicht im Chat-Fenster ausführbar." + }, + "copyCodeBlock": "Codeblock kopieren", + "couldNotSendRequestToSession": "Die Anfrage \"{0}\" konnte nicht an die Sitzung gesendet werden. {1}", + "delegation-response-renderer": { + "prompt": { + "label": "Delegierte Aufforderung:" + }, + "response": { + "label": "Antwort:" + }, + "starting": "Start der Delegation...", + "status": { + "canceled": "gestrichen", + "error": "Fehler", + "generating": "erzeugen...", + "starting": "ab..." + } + }, + "deleteChangeSet": "Änderungssatz löschen", + "editRequest": "bearbeiten", + "edited": "bearbeitet", + "editedTooltipHint": "Diese Eingabeaufforderung wurde bearbeitet. Sie können sie in der Ansicht „KI-Konfiguration“ zurücksetzen.", + "enterChatName": "Chat-Namen eingeben", + "errorChatInvocation": "Beim Aufruf des Chatdienstes ist ein Fehler aufgetreten.", + "expandChangeSet": "Änderungssatz erweitern", + "failedToDeleteSession": "Chatsitzung konnte nicht gelöscht werden", + "failedToLoadChats": "Chat-Sitzungen konnten nicht geladen werden", + "failedToRestoreSession": "Chatsitzung konnte nicht wiederhergestellt werden", + "failedToRetry": "Meldung \"Wiederholungsversuch fehlgeschlagen", + "focusInput": "Fokus-Chat-Eingabe", + "focusResponse": "Fokus-Chat-Antwort", + "noChatAgentsAvailable": "Keine Chat-Agenten verfügbar.", + "openDiff": "Open Diff", + "openOriginalFile": "Originaldatei öffnen", + "performThisTask": "Führen Sie diese Aufgabe aus.", + "persistedSession": "Persistierte Sitzung (zum Wiederherstellen anklicken)", + "removeChat": "Chat entfernen", + "renameChat": "Chat umbenennen", + "requestNotFoundForRetry": "Anfrage für Wiederholungsversuch nicht gefunden", + "responseFrom": "Antwort von {0}", + "selectAgentQuickPickPlaceholder": "Wählen Sie einen Agenten für die neue Sitzung", + "selectChat": "Chat auswählen", + "selectContextVariableQuickPickPlaceholder": "Wählen Sie eine Kontextvariable, die an die Nachricht angehängt werden soll", + "selectTaskContextQuickPickItem": { + "currentlyOpen": "derzeit offen" + }, + "selectTaskContextQuickPickPlaceholder": "Wählen Sie einen Aufgabenkontext zum Anhängen", + "selectVariableArguments": "Variable Argumente auswählen", + "send": "Send (Enter)", + "sessionNotFoundForRetry": "Sitzung für erneuten Versuch nicht gefunden", + "text-part-renderer": { + "cantDisplay": "Antwort kann nicht angezeigt werden, bitte überprüfen Sie Ihre ChatResponsePartRenderer!" + }, + "thinking-part-renderer": { + "thinking": "Nachdenken" + }, + "toolcall-part-renderer": { + "denied": "Ausführung verweigert", + "finished": "Ran", + "rejected": "Ausführung abgebrochen" + }, + "toolconfirmation": { + "allow-options-dropdown-tooltip": "Mehr Optionen zulassen", + "allow-session": "Erlauben Sie diesen Chat", + "allowed": "Werkzeugausführung erlaubt", + "alwaysAllowConfirm": "Ich verstehe, automatische Genehmigung aktivieren", + "alwaysAllowTitle": "Automatische Genehmigung für „{0}“ aktivieren?", + "canceled": "Ausführung des Tools abgebrochen", + "denied": "Werkzeugausführung verweigert", + "deny-forever": "Immer verweigern", + "deny-options-dropdown-tooltip": "Weitere Verweigerungsoptionen", + "deny-reason-placeholder": "Grund für die Ablehnung eingeben...", + "deny-session": "Verweigern für diesen Chat", + "deny-with-reason": "Mit Begründung ablehnen...", + "executionDenied": "Ausführung des Tools verweigert", + "header": "Bestätigen Sie die Ausführung des Tools" + }, + "unableToSummarizeCurrentSession": "Die aktuelle Sitzung kann nicht zusammengefasst werden. Bitte stellen Sie sicher, dass der Zusammenfassungs-Agent nicht deaktiviert ist.", + "unknown-part-renderer": { + "contentNotRestoreable": "Dieser Inhalt (Typ '{0}') konnte nicht vollständig wiederhergestellt werden. Er könnte von einer Erweiterung stammen, die nicht mehr verfügbar ist." + }, + "unpinAgent": "Unpin-Agent", + "variantTooltip": "Prompt-Variante: {0}", + "yourMessage": "Ihre Nachricht" + }, + "claude-code": { + "agentDescription": "Anthropic's Codiermittel", + "askBeforeEdit": "Vor der Bearbeitung fragen", + "changeSetTitle": "Änderungen durch Claude Code", + "clearCommand": { + "description": "Eine neue Sitzung erstellen" + }, + "compactCommand": { + "description": "Kompaktes Gespräch mit optionalen Fokusanweisungen" + }, + "completedCount": "{0}/{1} abgeschlossen", + "configCommand": { + "description": "Open Claude Code Configuration" + }, + "currentDirectory": "aktuelles Verzeichnis", + "differentAgentRequestWarning": "Die vorherige Chat-Anfrage wurde von einem anderen Agenten bearbeitet. Claude Code sieht diese anderen Nachrichten nicht.", + "directory": "Verzeichnis", + "domain": "Domain", + "editAutomatically": "Automatisch bearbeiten", + "editNumber": "bearbeiten {0}", + "editing": "Bearbeitung von", + "editsCount": "{0} Bearbeitet", + "emptyTodoList": "Nicht alle verfügbar", + "entireFile": "Gesamte Datei", + "excludingOnePattern": " (mit Ausnahme von 1 Muster)", + "excludingPatterns": " (ausgenommen {0} Muster)", + "executedCommand": "Ausgeführt: {0}", + "failedToParseBashToolData": "Bash-Tool-Daten konnten nicht geparst werden", + "failedToParseEditToolData": "Werkzeugdaten bearbeiten konnte nicht analysiert werden", + "failedToParseGlobToolData": "Glob-Tool-Daten konnten nicht geparst werden", + "failedToParseGrepToolData": "Die Daten des Grep-Tools konnten nicht analysiert werden", + "failedToParseLSToolData": "LS-Tool-Daten konnten nicht geparst werden", + "failedToParseMultiEditToolData": "MultiEdit-Werkzeugdaten konnten nicht geparst werden", + "failedToParseReadToolData": "Parsen der gelesenen Werkzeugdaten fehlgeschlagen", + "failedToParseTodoListData": "Die Daten der ToDo-Liste konnten nicht analysiert werden", + "failedToParseWebFetchToolData": "Die Daten des WebFetch-Tools konnten nicht analysiert werden", + "failedToParseWriteToolData": "Daten des Schreibwerkzeugs konnten nicht geparst werden", + "fetching": "Abrufbar unter", + "fileFilter": "File Filter", + "filePath": "File Path", + "fileType": "File Type", + "findMatchingFiles": "Suche nach Dateien mit dem globalen Muster \"{0}\" im aktuellen Verzeichnis", + "findMatchingFilesWithPath": "Suche nach Dateien, die dem globalen Muster \"{0}\" innerhalb von {1}", + "finding": "Suche nach", + "from": "Von", + "globPattern": "Kugelmuster", + "grepOptions": { + "caseInsensitive": "Groß- und Kleinschreibung wird nicht berücksichtigt", + "glob": "Globus: {0}", + "headLimit": "Grenze: {0}", + "lineNumbers": "Zeilennummern", + "linesAfter": "+{0} nach", + "linesBefore": "+{0} vor", + "linesContext": "±{0} Kontext", + "multiLine": "mehrzeilig", + "type": "Typ: {0}" + }, + "grepOutputModes": { + "content": "Inhalt", + "count": "zählen", + "filesWithMatches": "Dateien mit Übereinstimmungen" + }, + "ignoredPatterns": "Ignorierte Muster", + "ignoringPatterns": "Muster ignorieren {0} ", + "initCommand": { + "description": "Projekt mit der Anleitung CLAUDE.md initialisieren" + }, + "itemCount": "{0} Artikel", + "lineLimit": "Linie Grenze", + "lines": "Zeilen", + "listDirectoryContents": "Verzeichnisinhalte auflisten", + "listing": "Auflistung", + "memoryCommand": { + "description": "Speicherdatei CLAUDE.md bearbeiten" + }, + "multiEditing": "Multi-Editing", + "oneEdit": "1 bearbeiten", + "oneItem": "1 Stück", + "oneOption": "1 Option", + "openDirectoryTooltip": "Zum Öffnen des Verzeichnisses anklicken", + "openFileTooltip": "Klicken Sie, um die Datei im Editor zu öffnen", + "optionsCount": "{0} Optionen", + "partial": "Teilweise", + "pattern": "Muster", + "plan": "Plan-Modus", + "project": "Projekt", + "projectRoot": "Projektwurzel", + "readMode": "Modus lesen", + "reading": "Lesen", + "replaceAllCount": "{0} alle ersetzen", + "replaceAllOccurrences": "Ersetze alle Vorkommen", + "resumeCommand": { + "description": "Eine Sitzung fortsetzen" + }, + "reviewCommand": { + "description": "Request code review" + }, + "searchPath": "Suchpfad", + "searching": "Suche auf", + "startingLine": "Startlinie", + "timeout": "Zeitüberschreitung", + "timeoutInMs": "Zeitüberschreitung: {0}ms", + "to": "An", + "todoList": "ToDo-Liste", + "todoPriority": { + "high": "hoch", + "low": "niedrig", + "medium": "mittel" + }, + "toolApprovalRequest": "Claude Code möchte das Werkzeug \"{0}\" verwenden. Wollen Sie dies zulassen?", + "totalEdits": "Bearbeitungen insgesamt", + "webFetch": "Web Fetch", + "writing": "Schreiben" + }, + "code-completion": { + "progressText": "Berechnung der AI-Code-Vervollständigung..." + }, + "codex": { + "agentDescription": "Der von Codex unterstützte Programmierassistent von OpenAI", + "completedCount": "{0}/{1} abgeschlossen", + "exitCode": "Exit-Code: {0}", + "fileChangeFailed": "Codex hat folgende Änderungen nicht übernommen: {0}", + "fileChangeFailedGeneric": "Codex konnte die Dateiänderungen nicht anwenden.", + "itemCount": "{0} Artikel", + "noItems": "Keine Artikel", + "oneItem": "1 Artikel", + "running": "Laufen...", + "searched": "Gesucht", + "searching": "Suchen", + "todoList": "To-do-Liste", + "webSearch": "Websuche" + }, + "completion": { + "agent": { + "description": "Dieser Agent bietet Inline-Code-Vervollständigung im Code-Editor der Theia-IDE.", + "vars": { + "file": { + "description": "Der URI der zu bearbeitenden Datei" + }, + "language": { + "description": "Die languageId der zu bearbeitenden Datei" + }, + "prefix": { + "description": "Der Code vor der aktuellen Cursorposition" + }, + "suffix": { + "description": "Der Code nach der aktuellen Cursorposition" + } + } + }, + "automaticEnable": { + "description": "Automatisches Auslösen von KI-Vervollständigungen inline in jedem (Monaco) Editor während der Bearbeitung. \n Alternativ können Sie den Code auch manuell über den Befehl \"Inline-Vorschlag auslösen\" oder den Standard-Shortcut \"Strg+Alt+Leertaste\" auslösen." + }, + "cacheCapacity": { + "description": "Maximale Anzahl der Code-Vervollständigungen, die im Cache gespeichert werden sollen. Eine höhere Zahl kann die Leistung verbessern, verbraucht aber auch mehr Speicher. Der Mindestwert ist 10, der empfohlene Bereich liegt zwischen 50-200.", + "title": "Cache-Kapazität für die Codevervollständigung" + }, + "debounceDelay": { + "description": "Steuert die Verzögerung in Millisekunden, bevor KI-Vervollständigungen ausgelöst werden, nachdem Änderungen im Editor erkannt wurden. Erfordert, dass die automatische Codevervollständigung aktiviert ist. Geben Sie 0 ein, um die Entprellungsverzögerung zu deaktivieren.", + "title": "Entprellverzögerung" + }, + "excludedFileExts": { + "description": "Geben Sie Dateierweiterungen (z. B. .md, .txt) an, bei denen die AI-Vervollständigung deaktiviert werden soll.", + "title": "Ausgeschlossene Dateierweiterungen" + }, + "fileVariable": { + "description": "Der URI der zu bearbeitenden Datei. Nur im Kontext der Code-Vervollständigung verfügbar." + }, + "languageVariable": { + "description": "Die languageId der zu bearbeitenden Datei. Nur im Kontext der Code-Vervollständigung verfügbar." + }, + "maxContextLines": { + "description": "Die maximale Anzahl der als Kontext verwendeten Zeilen, verteilt auf die Zeilen vor und nach der Cursorposition (Präfix und Suffix). Setzen Sie diesen Wert auf -1, um die gesamte Datei ohne Zeilenbegrenzung als Kontext zu verwenden, und auf 0, um nur die aktuelle Zeile zu verwenden.", + "title": "Maximale Kontextzeilen" + }, + "prefixVariable": { + "description": "Der Code vor der aktuellen Cursorposition. Nur im Kontext der Code-Vervollständigung verfügbar." + }, + "stripBackticks": { + "description": "Entfernen von umgebenden Backticks aus dem Code, der von einigen LLMs zurückgegeben wird. Wenn ein Backtick erkannt wird, wird der gesamte Inhalt nach dem schließenden Backtick ebenfalls entfernt. Diese Einstellung trägt dazu bei, dass einfacher Code zurückgegeben wird, wenn Sprachmodelle eine markdown-ähnliche Formatierung verwenden.", + "title": "Entfernen von Backticks aus Inline-Vervollständigungen" + }, + "suffixVariable": { + "description": "Der Code nach der aktuellen Cursorposition. Nur im Kontext der Code-Vervollständigung verfügbar." + } + }, + "configuration": { + "selectItem": "Bitte wählen Sie einen Artikel aus." + }, + "copilot": { + "auth": { + "aiConfiguration": "KI-Konfiguration", + "authorize": "Ich habe autorisiert", + "copied": "Kopiert!", + "copyCode": "Code kopieren", + "expired": "Die Berechtigung ist abgelaufen oder wurde verweigert. Bitte versuchen Sie es erneut.", + "hint": "Nachdem Sie den Code eingegeben und autorisiert haben, klicken Sie unten auf „Ich habe autorisiert“.", + "initiating": "Authentifizierung wird gestartet...", + "instructions": "Um Theia die Nutzung von GitHub Copilot zu genehmigen, rufen Sie die folgende URL auf und geben Sie den Code ein:", + "openGitHub": "GitHub öffnen", + "success": "Erfolgreich bei GitHub Copilot angemeldet!", + "successHint": "Wenn Ihr GitHub-Konto Zugriff auf Copilot hat, können Sie jetzt Copilot-Sprachmodelle in der ", + "title": "Bei GitHub Copilot anmelden", + "tos": "Mit Ihrer Anmeldung erklären Sie sich mit den ", + "tosLink": "GitHub-Nutzungsbedingungen", + "verifying": "Autorisierung wird überprüft..." + }, + "category": "Copilot", + "commands": { + "signIn": "Bei GitHub Copilot anmelden", + "signOut": "GitHub Copilot abmelden" + }, + "enterpriseUrl": { + "mdDescription": "GitHub Enterprise-Domäne für die Copilot-API (z. B. „github.mycompany.com“). Für GitHub.com leer lassen." + }, + "models": { + "description": "Zu verwendende GitHub Copilot-Modelle. Die verfügbaren Modelle hängen von Ihrem Copilot-Abonnement ab." + }, + "statusBar": { + "signedIn": "Bei GitHub Copilot als {0} angemeldet. Zum Abmelden hier klicken.", + "signedOut": "Nicht bei GitHub Copilot angemeldet. Klicken Sie hier, um sich anzumelden." + } + }, + "core": { + "agentConfiguration": { + "actions": "Maßnahmen", + "addCustomAgent": "Benutzerdefinierten Agenten hinzufügen", + "enableAgent": "Agent freischalten", + "label": "Agenten", + "llmRequirements": "LLM-Anforderungen", + "notUsedInPrompt": "In der Eingabeaufforderung nicht verwendet", + "promptTemplates": "Prompt-Vorlagen", + "selectAgentMessage": "Bitte wählen Sie zuerst einen Agenten!", + "templateName": "Vorlage", + "undeclared": "Unangemeldet", + "usedAgentSpecificVariables": "Verwendete agentenbezogene Variablen", + "usedFunctions": "Verwendete Funktionen", + "usedGlobalVariables": "Verwendete globale Variablen", + "variant": "Variante" + }, + "agentsVariable": { + "description": "Gibt die Liste der im System verfügbaren Agenten zurück" + }, + "aiConfiguration": { + "label": "✨ AI-Konfiguration [Alpha]" + }, + "blinkTitle": { + "agentCompleted": "Theia - Agent abgeschlossen", + "namedAgentCompleted": "Theia - Agent \"{0}\" Abgeschlossen" + }, + "changeSetSummaryVariable": { + "description": "Bietet eine Zusammenfassung der Dateien in einem Änderungssatz und ihres Inhalts." + }, + "contextDetailsVariable": { + "description": "Bietet Volltextwerte und Beschreibungen für alle Kontextelemente." + }, + "contextSummaryVariable": { + "description": "Beschreibt die Dateien im Kontext einer bestimmten Sitzung." + }, + "customAgentTemplate": { + "description": "Dies ist ein Beispiel-Agent. Bitte passen Sie die Eigenschaften an Ihre Bedürfnisse an." + }, + "defaultModelAliases": { + "code": { + "description": "Optimiert für Codeverständnis und Generierungsaufgaben." + }, + "code-completion": { + "description": "Am besten geeignet für Szenarien mit automatischer Code-Vervollständigung." + }, + "summarize": { + "description": "Modelle, die für die Zusammenfassung und Verdichtung von Inhalten priorisiert werden." + }, + "universal": { + "description": "Ausgewogen für Code und allgemeinen Sprachgebrauch." + } + }, + "defaultNotification": { + "mdDescription": "Die Standard-Benachrichtigungsmethode, die verwendet wird, wenn ein KI-Agent eine Aufgabe abgeschlossen hat. Einzelne Agenten können diese Einstellung außer Kraft setzen.\n - o-Benachrichtigung\": OS/System-Benachrichtigungen anzeigen\n - Nachricht\": Anzeigen von Benachrichtigungen in der Statusleiste/im Nachrichtenbereich\n - Blinzeln\": Blinken oder Hervorheben der Benutzeroberfläche\n - Aus\": Alle Benachrichtigungen deaktivieren", + "title": "Standard-Benachrichtigungstyp" + }, + "discard": { + "label": "Ablegen AI Aufforderung Vorlage" + }, + "discardCustomPrompt": { + "tooltip": "Anpassungen verwerfen" + }, + "fileVariable": { + "description": "Löst den Inhalt einer Datei auf", + "uri": { + "description": "Der URI der angeforderten Datei." + } + }, + "languageModelRenderer": { + "alias": "[alias] {0}", + "languageModel": "Sprachmodell", + "purpose": "Zweck" + }, + "maxRetries": { + "mdDescription": "Die maximale Anzahl der Wiederholungsversuche, wenn eine Anfrage an einen KI-Anbieter fehlschlägt. Ein Wert von 0 bedeutet keine Wiederholungsversuche.", + "title": "Maximale Wiederholungsversuche" + }, + "modelAliasesConfiguration": { + "agents": "Agenten, die diesen Alias verwenden", + "defaultList": "[Standardliste]", + "evaluatesTo": "Bewertet nach", + "label": "Modell-Aliase", + "modelNotReadyTooltip": "Nicht bereit", + "modelReadyTooltip": "Bereit", + "noAgents": "Keine Agenten verwenden diesen Alias.", + "noModelReadyTooltip": "Kein Modell bereit", + "noResolvedModel": "Für diesen Alias gibt es noch kein Modell.", + "priorityList": "Prioritätenliste", + "selectAlias": "Bitte wählen Sie einen Modellalias.", + "selectedModelId": "Ausgewähltes Modell", + "unavailableModel": "Das ausgewählte Modell ist nicht mehr verfügbar" + }, + "noVariableFoundForOpenRequest": "Keine Variable für offene Anfrage gefunden.", + "openEditorsShortVariable": { + "description": "Kurzer Verweis auf alle derzeit geöffneten Dateien (relative Pfade, kommagetrennt)" + }, + "openEditorsVariable": { + "description": "Eine durch Kommata getrennte Liste aller derzeit geöffneten Dateien, relativ zum Stamm des Arbeitsbereichs." + }, + "preference": { + "languageModelAliases": { + "description": "Konfigurieren Sie die Modelle für jeden Sprachmodell-Alias in der [AI Configuration View]({0}). Alternativ können Sie die Einstellungen auch manuell in der settings.json vornehmen: \n```\n\"default/code\": {\n \"selectedModel\": \"anthropic/claude-opus-4-20250514\"\n}\n```", + "selectedModel": "Das vom Benutzer gewählte Modell für diesen Alias.", + "title": "Sprachmodell-Aliase" + } + }, + "prefs": { + "title": "✨ KI-Funktionen [Alpha]" + }, + "promptFragmentsConfiguration": { + "activeCustomizationTitle": "Aktive Anpassung", + "createCustomizationTitle": "Anpassungen erstellen", + "customization": "Personalisierung", + "customizationLabel": "Personalisierung", + "defaultVariantTitle": "Standard-Variante", + "deleteCustomizationTitle": "Anpassung löschen", + "editTemplateTitle": "Schablone bearbeiten", + "headerTitle": "Prompt-Fragmente", + "label": "Prompt-Fragmente", + "noFragmentsAvailable": "Keine Prompt-Fragmente verfügbar.", + "otherPromptFragmentsHeader": "Andere Prompt-Fragmente", + "promptTemplateText": "Aufforderungsvorlage Text", + "promptVariantsHeader": "Prompt-Varianten-Sets", + "removeCustomizationDialogMsg": "Sind Sie sicher, dass Sie die {0} -Anpassung für das Prompt-Fragment \"{1}\" entfernen möchten?", + "removeCustomizationDialogTitle": "Anpassung entfernen", + "removeCustomizationWithDescDialogMsg": "Sind Sie sicher, dass Sie die Anpassung von {0} für das Prompt-Fragment \"{1}\" ({2}) entfernen wollen?", + "resetAllButton": "Alle zurücksetzen", + "resetAllCustomizationsDialogMsg": "Sind Sie sicher, dass Sie alle Eingabeaufforderungsfragmente auf ihre eingebauten Versionen zurücksetzen wollen? Dadurch werden alle Anpassungen entfernt.", + "resetAllCustomizationsDialogTitle": "Alle Anpassungen zurücksetzen", + "resetAllCustomizationsTitle": "Alle Anpassungen zurücksetzen", + "resetAllPromptFragments": "Alle Prompt-Fragmente zurücksetzen", + "resetToBuiltInDialogMsg": "Sind Sie sicher, dass Sie das Prompt-Fragment \"{0}\" auf seine eingebaute Version zurücksetzen wollen? Dadurch werden alle Anpassungen entfernt.", + "resetToBuiltInDialogTitle": "Zurücksetzen auf Eingebaut", + "resetToBuiltInTitle": "Zurücksetzen auf diesen eingebauten", + "resetToCustomizationDialogMsg": "Sind Sie sicher, dass Sie das Prompt-Fragment \"{0}\" zurücksetzen wollen, um die Anpassung {1} zu verwenden? Dadurch werden alle Anpassungen mit höherer Priorität entfernt.", + "resetToCustomizationDialogTitle": "Zurücksetzen auf Anpassung", + "resetToCustomizationTitle": "Zurücksetzen auf diese Anpassung", + "selectedVariantLabel": "Ausgewählte", + "selectedVariantTitle": "Ausgewählte Variante", + "usedByAgentTitle": "Vom Agenten benutzt: {0}", + "variantSetError": "Die gewählte Variante existiert nicht und es konnte kein Standard gefunden werden. Bitte überprüfen Sie Ihre Konfiguration.", + "variantSetWarning": "Die ausgewählte Variante ist nicht vorhanden. Stattdessen wird die Standardvariante verwendet.", + "variantsOfSystemPrompt": "Varianten dieses Prompt-Variantensets:" + }, + "promptTemplates": { + "description": "Ordner zum Speichern von benutzerdefinierten Prompt-Vorlagen. Wenn nicht angepasst, wird das Benutzer-Konfigurationsverzeichnis verwendet. Bitte beachten Sie, dass Sie einen Ordner verwenden sollten, der unter Versionskontrolle steht, um Ihre Varianten von Prompt-Vorlagen zu verwalten.", + "openLabel": "Ordner auswählen" + }, + "promptVariable": { + "argDescription": "Die Aufforderungsvorlagen-ID zum Auflösen", + "completions": { + "detail": { + "builtin": "Eingebautes Prompt-Fragment", + "custom": "Individuelles Prompt-Fragment" + } + }, + "description": "Auflösen von Prompt-Vorlagen über den Prompt-Dienst" + }, + "prompts": { + "category": "Theia AI Prompt-Vorlagen" + }, + "requestSettings": { + "clientSettings": { + "description": "Client-Einstellungen für die Behandlung von Nachrichten, die an den llm zurückgesendet werden.", + "keepThinking": { + "description": "Wenn diese Option auf false gesetzt ist, wird die gesamte Denkausgabe gefiltert, bevor die nächste Benutzeranfrage in einem Gespräch mit mehreren Umdrehungen gesendet wird." + }, + "keepToolCalls": { + "description": "Wenn diese Option auf false gesetzt ist, werden alle Werkzeuganfragen und -antworten gefiltert, bevor die nächste Benutzeranfrage in einer Konversation mit mehreren Umdrehungen gesendet wird." + } + }, + "mdDescription": "Ermöglicht die Angabe von benutzerdefinierten Anfrageeinstellungen für mehrere Modelle.\n Jedes Objekt stellt die Konfiguration für ein bestimmtes Modell dar. Das Feld `modelId` gibt die Modell-ID an, `requestSettings` definiert modellspezifische Einstellungen.\n Das Feld `providerId` ist optional und ermöglicht es Ihnen, die Einstellungen auf einen bestimmten Anbieter anzuwenden. Wenn es nicht gesetzt ist, werden die Einstellungen auf alle Anbieter angewandt.\n Beispiel für providerIds: huggingface, openai, ollama, llamafile.\n Weitere Informationen finden Sie in [unserer Dokumentation] (https://theia-ide.org/docs/user_ai/#custom-request-settings).", + "modelSpecificSettings": { + "description": "Einstellungen für die spezifische Modell-ID." + }, + "scope": { + "agentId": { + "description": "Die (optionale) Agenten-ID, auf die die Einstellungen angewendet werden sollen." + }, + "modelId": { + "description": "Die (optionale) Modellkennung" + }, + "providerId": { + "description": "Die (optionale) Anbieter-ID, auf die die Einstellungen angewendet werden sollen." + } + }, + "title": "Benutzerdefinierte Anfrageeinstellungen" + }, + "skillsVariable": { + "description": "Gibt die Liste der verfügbaren Fähigkeiten zurück, die von KI-Agenten verwendet werden können." + }, + "taskContextSummary": { + "description": "Löst alle im Sitzungskontext vorhandenen Aufgabenkontextelemente auf." + }, + "templateSettings": { + "edited": "bearbeitet", + "unavailableVariant": "Die ausgewählte Variante ist nicht mehr verfügbar" + }, + "todayVariable": { + "description": "Tut etwas für heute", + "format": { + "description": "Das Format des Datums" + } + }, + "unableToDisplayVariableValue": "Variablenwert kann nicht angezeigt werden.", + "unableToResolveVariable": "Variable kann nicht aufgelöst werden.", + "variable-contribution": { + "builtInVariable": "Theia Eingebaute Variable", + "currentAbsoluteFilePath": "Der absolute Pfad der aktuell geöffneten Datei. Bitte beachten Sie, dass die meisten Agenten einen relativen Dateipfad (relativ zum aktuellen Arbeitsbereich) erwarten.", + "currentFileContent": "Der reine Inhalt der aktuell geöffneten Datei. Dies schließt die Information aus, woher der Inhalt kommt. Bitte beachten Sie, dass die meisten Agenten besser mit einem relativen Dateipfad (relativ zum aktuellen Arbeitsbereich) arbeiten.", + "currentRelativeDirPath": "Der relative Pfad des Verzeichnisses, das die aktuell geöffnete Datei enthält.", + "currentRelativeFilePath": "Der relative Pfad der aktuell geöffneten Datei.", + "currentSelectedText": "Der reine Text, der in der geöffneten Datei ausgewählt ist. Dies schließt die Information aus, woher der Inhalt kommt. Bitte beachten Sie, dass die meisten Agenten besser mit einem relativen Dateipfad (relativ zum aktuellen Arbeitsbereich) arbeiten.", + "dotRelativePath": "Kurzer Verweis auf den relativen Pfad der aktuell geöffneten Datei ('currentRelativeFilePath')." + } + }, + "editor": { + "editorContextVariable": { + "description": "Auflösen von editorenspezifischen Kontextinformationen", + "label": "EditorKontext" + }, + "explainWithAI": { + "prompt": "Erklären Sie diesen Fehler", + "title": "Erklären mit AI" + }, + "fixWithAI": { + "prompt": "Hilfe zur Behebung dieses Fehlers" + } + }, + "google": { + "apiKey": { + "description": "Geben Sie einen API-Schlüssel für Ihr offizielles Google AI (Gemini) Konto ein. **Bitte beachten Sie:** Wenn Sie diese Einstellung verwenden, wird der GOOGLE AI API-Schlüssel im Klartext auf dem Rechner gespeichert, auf dem Theia läuft. Verwenden Sie die Umgebungsvariable `GOOGLE_API_KEY`, um den Schlüssel sicher zu setzen." + }, + "maxRetriesOnErrors": { + "description": "Maximale Anzahl von Wiederholungsversuchen im Fehlerfall. Wenn kleiner als 1, dann ist die Wiederholungslogik deaktiviert" + }, + "models": { + "description": "Offizielle Google Gemini-Modelle zur Verwendung" + }, + "retryDelayOnOtherErrors": { + "description": "Verzögerung in Sekunden zwischen den Wiederholungsversuchen im Falle anderer Fehler (manchmal meldet Google GenAI Fehler wie unvollständige JSON-Syntax, die vom Modell zurückgegeben wird, oder 500 Internal Server Error). Die Einstellung -1 verhindert Wiederholungsversuche in diesen Fällen. Andernfalls erfolgt ein erneuter Versuch entweder sofort (wenn auf 0 gesetzt) oder nach dieser Verzögerung in Sekunden (wenn auf eine positive Zahl gesetzt)." + }, + "retryDelayOnRateLimitError": { + "description": "Verzögerung in Sekunden zwischen den Wiederholungsversuchen im Falle von Ratenbegrenzungsfehlern. Siehe https://ai.google.dev/gemini-api/docs/rate-limits" + } + }, + "history": { + "clear": { + "tooltip": "Historie aller Agenten löschen" + }, + "exchange-card": { + "agentId": "Agent", + "timestamp": "Gestartet" + }, + "open-history-tooltip": "KI-Geschichte öffnen...", + "request-card": { + "agent": "Agent", + "model": "Modell", + "request": "Request", + "response": "Antwort", + "timestamp": "Zeitstempel", + "title": "Request" + }, + "sortChronologically": { + "tooltip": "Chronologisch sortieren" + }, + "sortReverseChronologically": { + "tooltip": "Rückwärts chronologisch sortieren" + }, + "toggleCompact": { + "tooltip": "Kompaktansicht anzeigen" + }, + "toggleHideNewlines": { + "tooltip": "Keine Interpretation von Zeilenumbrüchen" + }, + "toggleRaw": { + "tooltip": "Rohansicht anzeigen" + }, + "toggleRenderNewlines": { + "tooltip": "Zeilenumbrüche interpretieren" + }, + "view": { + "label": "✨ KI-Agent Geschichte [Alpha]", + "noAgent": "Kein Agent verfügbar.", + "noAgentSelected": "Kein Agent ausgewählt.", + "noHistoryForAgent": "Keine Historie für den ausgewählten Bearbeiter verfügbar '{0}'" + } + }, + "huggingFace": { + "apiKey": { + "mdDescription": "Geben Sie einen API-Schlüssel für Ihr Hugging Face-Konto ein. **Bitte beachten Sie:** Bei Verwendung dieser Einstellung wird der Hugging Face-API-Schlüssel im Klartext auf dem Rechner gespeichert, auf dem Theia läuft. Verwenden Sie die Umgebungsvariable `HUGGINGFACE_API_KEY`, um den Schlüssel sicher zu speichern." + }, + "models": { + "mdDescription": "Zu verwendende Hugging Face-Modelle. **Bitte beachten Sie:** Derzeit werden nur Modelle unterstützt, die die Chat-Completion-API unterstützen (instruktionsoptimierte Modelle wie „*-Instruct“). Bei einigen Modellen müssen möglicherweise die Lizenzbedingungen auf der Hugging Face-Website akzeptiert werden." + } + }, + "ide": { + "agent-description": "Konfigurieren Sie die Einstellungen des AI-Agenten, einschließlich Aktivierung, LLM-Auswahl, Anpassung der Eingabeaufforderungsvorlage und Erstellung eines benutzerdefinierten Agenten in der [AI-Konfigurationsansicht] ({0}).", + "agentConfiguration": { + "customAgentLocationQuickPick": { + "createNewFile": "Neue Datei erstellen", + "openExistingFile": "Vorhandene Datei öffnen", + "placeholder": "Wählen Sie den Ort, an dem Sie eine Datei mit benutzerdefinierten Agenten erstellen oder öffnen möchten", + "title": "Speicherort für die Datei der benutzerdefinierten Agenten auswählen" + }, + "noDescription": "Keine Beschreibung verfügbar" + }, + "app-tester": { + "errorCheckingDevToolsServerStatus": "Fehler bei der Überprüfung des DevTools MCP-Serverstatus: {0}", + "errorCheckingPlaywrightServerStatus": "Fehler beim Überprüfen des Playwright MCP-Serverstatus: {0}", + "startChromeDevToolsMcpServers": { + "canceled": "Bitte richten Sie den Chrome DevTools MCP-Server ein.", + "error": "Chrome DevTools MCP-Server konnte nicht gestartet werden: {0}", + "progress": "Chrome DevTools MCP-Server starten.", + "question": "Der Chrome DevTools MCP-Server wird nicht ausgeführt. Möchten Sie ihn jetzt starten? Dadurch wird möglicherweise der Chrome DevTools MCP-Server installiert." + }, + "startMcpServers": { + "no": "Nein, abbrechen", + "yes": "Ja, starten Sie die Server." + }, + "startPlaywrightServers": { + "canceled": "Bitte richten Sie die MCP-Server ein.", + "error": "Der Playwright MCP-Server konnte nicht gestartet werden: {0}", + "progress": "Starten der Playwright MCP-Server.", + "question": "Die Playwright MCP-Server sind nicht in Betrieb. Möchten Sie sie jetzt starten? Dadurch können die Playwright MCP-Server installiert werden." + } + }, + "architectAgent": { + "mode": { + "default": "Standardmodus", + "plan": "Modusplan", + "simple": "Einfacher Modus" + }, + "suggestion": { + "executePlanWithCoder": "Führen Sie „{0}“ mit Coder aus.", + "summarizeSessionAsTaskForCoder": "Fassen Sie diese Sitzung als Aufgabe für Coder zusammen", + "updateTaskContext": "Aktuellen Aufgabenkontext aktualisieren" + } + }, + "bypassHint": "Einige Agenten wie Claude Code benötigen keine Theia-Sprachmodelle.", + "chatDisabledMessage": { + "featuresTitle": "Derzeit unterstützte Ansichten und Funktionen:" + }, + "coderAgent": { + "mode": { + "agentNext": "Agent-Modus (Weiter)", + "edit": "Bearbeitungsmodus" + }, + "suggestion": { + "fixProblems": { + "content": "[Probleme beheben]({0}) in der aktuellen Datei.", + "prompt": "Bitte schauen Sie sich {1} an und beheben Sie alle Probleme." + }, + "startNewChat": "Halten Sie Chats kurz und konzentriert. [Beginnen Sie einen neuen Chat]({0}) für eine neue Aufgabe oder [beginnen Sie einen neuen Chat mit einer Zusammenfassung dieses Chats]({1})." + } + }, + "commandAgent": { + "commandCallback": { + "confirmAction": "Verstanden", + "label": "AI-Befehl" + }, + "response": { + "customHandler": "Versuchen Sie dies auszuführen:", + "noCommand": "Tut mir leid, ich kann diesen Befehl nicht finden", + "theiaCommand": "Ich habe diesen Befehl gefunden, der Ihnen helfen könnte:" + }, + "vars": { + "commandIds": { + "description": "Die Liste der in Theia verfügbaren Befehle." + } + } + }, + "configureAgent": { + "header": "Standard-Agent konfigurieren" + }, + "continueAnyway": "Trotzdem fortfahren", + "createSkillAgent": { + "mode": { + "edit": "Standardmodus" + } + }, + "enableAI": { + "mdDescription": "Diese Einstellung ermöglicht Ihnen den Zugriff auf die neuesten KI-Funktionen (Beta-Version). \n Bitte beachten Sie, dass sich diese Funktionen in einer Beta-Phase befinden, was bedeutet, dass sie sich ändern und weiter verbessert werden können. Es ist wichtig, sich bewusst zu sein, dass diese Funktionen ständige Anfragen an die Sprachmodelle (LLMs) generieren können, auf die Sie Zugriff gewähren. Dies kann Kosten verursachen, die Sie genau überwachen müssen. Wenn Sie diese Option aktivieren, erkennen Sie diese Risiken an. \n **Bitte beachten Sie! Die folgenden Einstellungen in diesem Abschnitt werden erst wirksam\n wenn die Hauptfunktion aktiviert ist. Nach der Aktivierung der Funktion müssen Sie mindestens einen der unten aufgeführten LLM-Anbieter konfigurieren. Siehe auch [die Dokumentation](https://theia-ide.org/docs/user_ai/)**." + }, + "github": { + "configureGitHubServer": { + "canceled": "GitHub-Serverkonfiguration abgebrochen. Bitte konfigurieren Sie den GitHub MCP-Server für die Verwendung dieses Agenten.", + "no": "Nein, abbrechen", + "yes": "Ja, GitHub-Server konfigurieren" + }, + "errorCheckingGitHubServerStatus": "Fehler bei der Überprüfung des GitHub MCP-Serverstatus: {0}", + "startGitHubServer": { + "canceled": "Bitte starten Sie den GitHub MCP-Server, um diesen Agenten zu verwenden.", + "error": "Der GitHub MCP-Server konnte nicht gestartet werden: {0}", + "no": "Nein, abbrechen", + "progress": "Starten des GitHub MCP-Servers.", + "question": "Der GitHub MCP-Server ist konfiguriert, läuft aber nicht. Möchten Sie ihn jetzt starten?", + "yes": "Ja, starten Sie den Server" + } + }, + "githubRepoName": { + "description": "Der Name des aktuellen GitHub-Repositorys (z. B. \"eclipse-theia/theia\")" + }, + "model-selection-description": "Wählen Sie in der [AI Configuration View]({0}), welche Large Language Models (LLMs) von jedem AI-Agenten verwendet werden.", + "moreAgentsAvailable": { + "header": "Weitere Agenten sind verfügbar" + }, + "noRecommendedAgents": "Es sind keine empfohlenen Wirkstoffe verfügbar.", + "openSettings": "AI-Einstellungen öffnen", + "or": "oder", + "orchestrator": { + "error": { + "noAgents": "Kein Chat-Agent zur Bearbeitung der Anfrage verfügbar. Bitte überprüfen Sie Ihre Konfiguration, ob diese aktiviert ist." + }, + "progressMessage": "Bestimmung des am besten geeigneten Mittels", + "response": { + "delegatingToAgent": "Delegieren an `@{0}`" + } + }, + "prompt-template-description": "Wählen Sie Prompt-Varianten aus und passen Sie Prompt-Vorlagen für AI-Agenten in der [AI Configuration View]({0}) an.", + "recommendedAgents": "Empfohlene Wirkstoffe:", + "skillsConfiguration": { + "label": "Fähigkeiten", + "location": { + "label": "Standort" + } + }, + "toolsConfiguration": { + "confirmAlwaysAllow": { + "confirm": "Ich verstehe, automatische Genehmigung aktivieren", + "title": "Automatische Genehmigung für „{0}“ aktivieren?" + }, + "confirmationMode": { + "label": "Bestätigungsmodus" + }, + "default": { + "label": "Standardwerkzeug Bestätigungsmodus:" + }, + "resetAll": "Alle zurücksetzen", + "resetAllConfirmDialog": { + "msg": "Sind Sie sicher, dass Sie alle Werkzeugbestätigungsmodi auf die Standardeinstellungen zurücksetzen wollen? Dadurch werden alle benutzerdefinierten Einstellungen entfernt.", + "title": "Alle Werkzeugbestätigungsmodi zurücksetzen" + }, + "resetAllTooltip": "Alle Werkzeuge auf Standardwerte zurücksetzen", + "toolOptions": { + "confirm": { + "label": "Bestätigen Sie" + } + } + }, + "variableConfiguration": { + "selectVariable": "Bitte wählen Sie eine Variable aus.", + "usedByAgents": "Von Agenten verwendet", + "variableArgs": "Variable Argumente" + } + }, + "llamaFile": { + "prefs": { + "mdDescription": "Diese Einstellung erlaubt es Ihnen, LlamaFile-Modelle in Theia IDE zu konfigurieren und zu verwalten. \n Jeder Eintrag benötigt einen benutzerfreundlichen `Name`, die Datei `uri`, die auf Ihr LlamaFile verweist, und den `Port`, auf dem es laufen wird. \n Um ein LlamaFile zu starten, verwenden Sie den Befehl \"Start LlamaFile\", mit dem Sie das gewünschte Modell auswählen können. \n Wenn Sie einen Eintrag bearbeiten (z. B. den Port ändern), wird jede laufende Instanz gestoppt, und Sie müssen sie manuell neu starten. \n [Erfahren Sie mehr über die Konfiguration und Verwaltung von LlamaFiles in der Theia IDE Dokumentation](https://theia-ide.org/docs/user_ai/#llamafile-models).", + "name": { + "description": "Der Modellname, der für diese Llamafile verwendet werden soll." + }, + "port": { + "description": "Der Port, der zum Starten des Servers verwendet wird." + }, + "title": "✨ AI LlamaFile", + "uri": { + "description": "Die Datei-URI zur Llamafile." + } + }, + "start": "Llamafile starten", + "stop": "Llamafile stoppen" + }, + "llamafile": { + "error": { + "noConfigured": "Keine Llamafiles konfiguriert.", + "noRunning": "Es laufen keine Llamafiles.", + "startFailed": "Beim Start von llamafile ist etwas schief gelaufen: {0}.\nWeitere Informationen finden Sie auf der Konsole.", + "stopFailed": "Beim Stoppen von llamafile ist etwas schief gelaufen: {0}.\nWeitere Informationen finden Sie auf der Konsole." + } + }, + "mcp": { + "error": { + "allServersRunning": "Alle MCP-Server sind bereits in Betrieb.", + "noRunningServers": "Es laufen keine MCP-Server.", + "noServersConfigured": "Keine MCP-Server konfiguriert.", + "startFailed": "Beim Starten des MCP-Servers ist ein Fehler aufgetreten." + }, + "info": { + "serverStarted": "MCP-Server \"{0}\" erfolgreich gestartet. Registrierte Werkzeuge: {1}" + }, + "servers": { + "args": { + "mdDescription": "Ein Array mit Argumenten, die an den Befehl übergeben werden.", + "title": "Argumente für den Befehl" + }, + "autostart": { + "mdDescription": "Diesen Server automatisch starten, wenn das Frontend startet. Neu hinzugefügte Server werden nicht sofort automatisch gestartet, sondern erst beim Neustart", + "title": "Autostart" + }, + "command": { + "mdDescription": "Der zum Starten des MCP-Servers verwendete Befehl, z. B. \"uvx\" oder \"npx\".", + "title": "Befehl zur Ausführung des MCP-Servers" + }, + "env": { + "mdDescription": "Optionale Umgebungsvariablen, die für den Server festgelegt werden, wie z. B. ein API-Schlüssel.", + "title": "Umgebungsvariablen" + }, + "headers": { + "mdDescription": "Optionale zusätzliche Kopfzeilen, die bei jeder Anfrage an den Server enthalten sind.", + "title": "Kopfzeilen" + }, + "mdDescription": "Konfigurieren Sie MCP-Server mit Befehl, Argumenten, optionalen Umgebungsvariablen und Autostart (standardmäßig true). Jeder Server wird durch einen eindeutigen Schlüssel identifiziert, z. B. \"brave-search\" oder \"filesystem\". Um einen Server zu starten, verwenden Sie den Befehl \"MCP: Start MCP Server\", mit dem Sie den gewünschten Server auswählen können. Um einen Server zu stoppen, verwenden Sie den Befehl \"MCP: Stop MCP Server\". Bitte beachten Sie, dass der Autostart erst nach einem Neustart wirksam wird, Sie müssen einen Server zum ersten Mal manuell starten.\nBeispielkonfiguration:\n```{\n \"brave-search\": {\n \"command\": \"npx\",\n \"args\": [\n \"-y\",\n \"@modelcontextprotocol/server-brave-search\"\n ],\n \"env\": {\n \"BRAVE_API_KEY\": \"YOUR_API_KEY\"\n },\n },\n \"filesystem\": {\n \"command\": \"npx\",\n \"args\": [\"-y\", \"@modelcontextprotocol/server-filesystem\", \"/Users/YOUR_USERNAME/Desktop\"],\n \"env\": {\n \"CUSTOM_ENV_VAR\": \"custom-value\"\n },\n \"autostart\": false\n }\n}\n```", + "serverAuthToken": { + "mdDescription": "Das Authentifizierungs-Token für den Server, falls erforderlich. Dieses wird für die Authentifizierung beim Remote-Server verwendet.", + "title": "Authentifizierungs-Token" + }, + "serverAuthTokenHeader": { + "mdDescription": "Der Name der Kopfzeile, die für das Server-Authentifizierungstoken verwendet werden soll. Wenn nicht angegeben, wird \"Authorization\" mit \"Bearer\" verwendet.", + "title": "Name des Authentifizierungs-Headers" + }, + "serverUrl": { + "mdDescription": "Die URL des entfernten MCP-Servers. Falls angegeben, stellt der Server eine Verbindung zu dieser URL her, anstatt einen lokalen Prozess zu starten.", + "title": "Server-URL" + }, + "title": "Konfiguration von MCP-Servern" + }, + "start": { + "label": "MCP: MCP-Server starten" + }, + "stop": { + "label": "MCP: MCP-Server anhalten" + } + }, + "mcpConfiguration": { + "arguments": "Argumente: ", + "autostart": "Autostart: ", + "connectServer": "Verbinden Sie", + "connectingServer": "Verbinden...", + "copiedAllList": "Alle Werkzeuge in die Zwischenablage kopiert (Liste aller Werkzeuge)", + "copiedAllSingle": "Alle Werkzeuge in die Zwischenablage kopiert (einzelnes Prompt-Fragment mit allen Werkzeugen)", + "copiedForPromptTemplate": "Kopieren aller Werkzeuge in die Zwischenablage für Prompt-Vorlage (einzelnes Prompt-Fragment mit allen Werkzeugen)", + "copyAllList": "Alles kopieren (Liste aller Werkzeuge)", + "copyAllSingle": "Alles für den Chat kopieren (einzelnes Prompt-Fragment mit allen Tools)", + "copyForPrompt": "Kopierwerkzeug (für Chat oder Prompt-Vorlage)", + "copyForPromptTemplate": "Alles kopieren für Prompt-Vorlage (einzelnes Prompt-Fragment mit allen Werkzeugen)", + "environmentVariables": "Umgebungsvariablen: ", + "headers": "Überschriften: ", + "noServers": "Keine MCP-Server konfiguriert", + "serverAuthToken": "Authentifizierungs-Token: ", + "serverAuthTokenHeader": "Name des Authentifizierungs-Headers: ", + "serverUrl": "Server-URL: ", + "tools": "Werkzeuge: " + }, + "openai": { + "apiKey": { + "mdDescription": "Geben Sie einen API-Schlüssel für Ihr offizielles OpenAI-Konto ein. **Bitte beachten Sie:** Wenn Sie diese Einstellung verwenden, wird der Open AI API-Schlüssel im Klartext auf dem Rechner gespeichert, auf dem Theia läuft. Verwenden Sie die Umgebungsvariable `OPENAI_API_KEY`, um den Schlüssel sicher zu setzen." + }, + "customEndpoints": { + "apiKey": { + "title": "Entweder der Schlüssel für den Zugriff auf die API, die unter der angegebenen URL bereitgestellt wird, oder `true`, um den globalen OpenAI-API-Schlüssel zu verwenden" + }, + "apiVersion": { + "title": "Entweder die Version für den Zugriff auf die API, die unter der angegebenen URL in Azure bereitgestellt wird, oder `true`, um die globale OpenAI-API-Version zu verwenden" + }, + "deployment": { + "title": "Der Bereitstellungsname für den Zugriff auf die API, die unter der angegebenen URL in Azure bereitgestellt wird" + }, + "developerMessageSettings": { + "title": "Steuert die Behandlung von Systemmeldungen: `user`, `system` und `developer` werden als Rolle verwendet, `mergeWithFollowingUserMessage` stellt der folgenden Benutzernachricht die Systemnachricht voran oder wandelt die Systemnachricht in eine Benutzernachricht um, wenn die nächste Nachricht keine Benutzernachricht ist. Mit `skip` wird nur die Systemnachricht entfernt), standardmäßig mit `developer`." + }, + "enableStreaming": { + "title": "Gibt an, ob die Streaming-API verwendet werden soll. Standardmäßig `true`." + }, + "id": { + "title": "Ein eindeutiger Bezeichner, der in der Benutzeroberfläche verwendet wird, um das benutzerdefinierte Modell zu identifizieren" + }, + "mdDescription": "Integrieren Sie benutzerdefinierte Modelle, die mit der OpenAI-API kompatibel sind, zum Beispiel über `vllm`. Die erforderlichen Attribute sind \"model\" und \"url\". \n Optional können Sie \n - eine eindeutige `id` angeben, um das benutzerdefinierte Modell in der Benutzeroberfläche zu identifizieren. Wenn keine angegeben wird, wird `model` als `id` verwendet. \n - einen `apiKey` bereitstellen, um auf die API zuzugreifen, die unter der angegebenen URL bereitgestellt wird. Verwenden Sie `true` um die Verwendung des globalen OpenAI API Schlüssels anzugeben. \n - provide an `apiVersion` to access the API served at the given url in Azure. Verwenden Sie `true`, um die Verwendung der globalen OpenAI-API-Version anzugeben. \n - setze `developerMessageSettings` auf eines von `user`, `system`, `developer`, `mergeWithFollowingUserMessage`, oder `skip` um zu kontrollieren wie die Entwicklernachricht eingeschlossen wird (wobei `user`, `system` und `developer` als Rolle verwendet wird, `mergeWithFollowingUserMessage` wird der folgenden Benutzernachricht die Systemnachricht voranstellen oder die Systemnachricht in eine Benutzernachricht umwandeln wenn die nächste Nachricht keine Benutzernachricht ist. Mit `skip` wird nur die Systemnachricht entfernt). Die Voreinstellung ist `developer`. \n - spezifiziere `supportsStructuredOutput: false` um anzugeben, dass keine strukturierte Ausgabe verwendet werden soll. \n - Geben Sie `enableStreaming: false` an, um anzugeben, dass Streaming nicht verwendet werden soll. \n Siehe [unsere Dokumentation] (https://theia-ide.org/docs/user_ai/#openai-compatible-models-eg-via-vllm) für weitere Informationen.", + "modelId": { + "title": "Modell-ID" + }, + "supportsStructuredOutput": { + "title": "Gibt an, ob das Modell eine strukturierte Ausgabe unterstützt. Standardmäßig `true`." + }, + "url": { + "title": "Der Open AI API-kompatible Endpunkt, an dem das Modell gehostet wird" + } + }, + "models": { + "description": "Offizielle OpenAI-Modelle zur Verwendung" + }, + "useResponseApi": { + "mdDescription": "Verwenden Sie die neuere OpenAI Response API anstelle der Chat Completion API für offizielle OpenAI-Modelle. Diese Einstellung gilt nur für offizielle OpenAI-Modelle - benutzerdefinierte Anbieter müssen dies individuell konfigurieren." + } + }, + "promptTemplates": { + "directories": { + "title": "Arbeitsbereichsspezifische Verzeichnisse für Prompt-Vorlagen" + }, + "extensions": { + "description": "Liste der zusätzlichen Dateierweiterungen in Prompt-Speicherorten, die als Prompt-Vorlagen gelten. '.prompttemplate' wird immer als Standard betrachtet.", + "title": "Zusätzliche Dateierweiterungen für Eingabeaufforderungsvorlagen" + }, + "files": { + "title": "Arbeitsbereichsspezifische Prompt-Vorlagendateien" + } + }, + "scanoss": { + "changeSet": { + "clean": "Keine Übereinstimmungen", + "error": "Fehler: Wiederholung", + "error-notification": "Ein ScanOSS-Fehler ist aufgetreten: {0}.", + "match": "Streichhölzer ansehen", + "scan": "Scannen", + "scanning": "Scannen..." + }, + "mode": { + "automatic": { + "description": "Aktivieren Sie das automatische Scannen von Codefragmenten in Chat-Ansichten." + }, + "description": "Konfigurieren Sie die SCANOSS-Funktion für die Analyse von Codefragmenten in Chat-Ansichten. Dies sendet einen Hash von vorgeschlagenen Codeschnipseln an den SCANOSS\nDienst, der von der [Software Transparency Foundation] (https://www.softwaretransparency.org/osskb) gehostet wird, zur Analyse.", + "manual": { + "description": "Der Benutzer kann den Scan manuell auslösen, indem er in der Chat-Ansicht auf den Eintrag SCANOSS klickt." + }, + "off": { + "description": "Die Funktion ist vollständig ausgeschaltet." + } + }, + "snippet": { + "dialog-header": "ScanOSS-Ergebnisse", + "errored": "SCANOSS - Fehler - {0}", + "file-name-heading": "Übereinstimmung gefunden in {0}", + "in-progress": "SCANOSS - Durchführung von Scans...", + "match-count": "Gefunden {0} Übereinstimmung(en)", + "matched": "SCANOSS - {0} Übereinstimmung gefunden", + "no-match": "SCANOSS - Keine Übereinstimmung", + "summary": "Zusammenfassung" + } + }, + "session-settings-dialog": { + "title": "Sitzungseinstellungen festlegen", + "tooltip": "Sitzungseinstellungen festlegen" + }, + "terminal": { + "agent": { + "description": "Dieser Agent bietet Unterstützung beim Schreiben und Ausführen beliebiger Terminalbefehle. Auf der Grundlage der Anfrage des Benutzers schlägt er Befehle vor und ermöglicht es dem Benutzer, diese direkt in das Terminal einzufügen und auszuführen. Er greift auf das aktuelle Verzeichnis, die Umgebung und die letzten Terminalausgaben der Terminalsitzung zu, um kontextabhängige Unterstützung zu bieten", + "vars": { + "cwd": { + "description": "Das aktuelle Arbeitsverzeichnis." + }, + "recentTerminalContents": { + "description": "Die letzten 0 bis 50 Zeilen, die im Terminal sichtbar sind." + }, + "shell": { + "description": "Die verwendete Shell, z. B. /usr/bin/zsh." + }, + "userRequest": { + "description": "Die Frage oder Anfrage des Benutzers." + } + } + }, + "askAi": "Fragen Sie die KI", + "askTerminalCommand": "Fragen Sie nach einem Terminalbefehl...", + "hitEnterConfirm": "Bestätigen Sie mit der Eingabetaste", + "howCanIHelp": "Wie kann ich Ihnen helfen?", + "loading": "Laden", + "tryAgain": "Versuchen Sie es noch einmal...", + "useArrowsAlternatives": " oder verwenden Sie ⇅, um Alternativen anzuzeigen..." + }, + "tokenUsage": { + "cachedInputTokens": "Eingabe-Token in den Cache geschrieben", + "cachedInputTokensTooltip": "Wird zusätzlich zu den \"Eingabe-Tokens\" verfolgt. In der Regel teurer als nicht gespeicherte Token.", + "failedToGetTokenUsageData": "Token-Nutzungsdaten konnten nicht abgerufen werden: {0}", + "inputTokens": "Eingabe-Token", + "label": "Token-Verwendung", + "lastUsed": "Zuletzt verwendet", + "model": "Modell", + "noData": "Es sind noch keine Daten über die Verwendung von Token verfügbar.", + "note": "Die Verwendung von Token wird seit dem Start der Anwendung verfolgt und nicht aufbewahrt.", + "outputTokens": "Token ausgeben", + "readCachedInputTokens": "Eingabemarken aus dem Cache lesen", + "readCachedInputTokensTooltip": "Wird zusätzlich zum 'Input Token' verfolgt. In der Regel wesentlich kostengünstiger als nicht gecacht. Zählt in der Regel nicht zu den Ratenbeschränkungen.", + "total": "Insgesamt", + "totalTokens": "Token insgesamt", + "totalTokensTooltip": "Eingabe-Token\" + \"Ausgabe-Token" + }, + "vercelai": { + "anthropicApiKey": { + "mdDescription": "Geben Sie einen API-Schlüssel für anthropische Modelle ein. **Bitte beachten Sie:** Wenn Sie diese Einstellung verwenden, wird der API-Schlüssel im Klartext auf dem Rechner gespeichert, auf dem Theia läuft. Verwenden Sie die Umgebungsvariable `ANTHROPIC_API_KEY`, um den Schlüssel sicher zu setzen." + }, + "customEndpoints": { + "apiKey": { + "title": "Entweder der Schlüssel für den Zugriff auf die API, die unter der angegebenen URL bereitgestellt wird, oder `true`, um den globalen API-Schlüssel zu verwenden" + }, + "enableStreaming": { + "title": "Gibt an, ob die Streaming-API verwendet werden soll. Standardmäßig `true`." + }, + "id": { + "title": "Ein eindeutiger Bezeichner, der in der Benutzeroberfläche verwendet wird, um das benutzerdefinierte Modell zu identifizieren" + }, + "mdDescription": "Integrieren Sie eigene Modelle, die mit dem Vercel AI SDK kompatibel sind. Die erforderlichen Attribute sind `model` und `url`. \n Optional können Sie \n - eine eindeutige `id` angeben, um das benutzerdefinierte Modell in der Benutzeroberfläche zu identifizieren. Wenn keine angegeben wird, wird `model` als `id` verwendet. \n - einen `apiKey` angeben, um auf die API zuzugreifen, die unter der angegebenen URL bereitgestellt wird. Verwenden Sie `true`, um die Verwendung des globalen API-Schlüssels anzugeben. \n - Geben Sie `supportsStructuredOutput: false` an, um anzugeben, dass keine strukturierte Ausgabe verwendet werden soll. \n - Geben Sie `enableStreaming: false` an, um anzugeben, dass Streaming nicht verwendet werden soll. \n - Geben Sie `provider` an, um anzugeben, von welchem Anbieter das Modell stammt (openai, anthropic).", + "modelId": { + "title": "Modell-ID" + }, + "supportsStructuredOutput": { + "title": "Gibt an, ob das Modell eine strukturierte Ausgabe unterstützt. Standardmäßig `true`." + }, + "url": { + "title": "Der API-Endpunkt, an dem das Modell gehostet wird" + } + }, + "models": { + "description": "Offizielle Modelle zur Verwendung mit Vercel AI SDK", + "id": { + "title": "Modell-ID" + }, + "model": { + "title": "Model Name" + } + }, + "openaiApiKey": { + "mdDescription": "Geben Sie einen API-Schlüssel für OpenAI-Modelle ein. **Bitte beachten Sie:** Wenn Sie diese Einstellung verwenden, wird der API-Schlüssel im Klartext auf dem Rechner gespeichert, auf dem Theia läuft. Verwenden Sie die Umgebungsvariable \"OPENAI_API_KEY\", um den Schlüssel sicher festzulegen." + } + }, + "workspace": { + "coderAgent": { + "description": "Ein in die Theia IDE integrierter KI-Assistent, der Softwareentwickler unterstützen soll. Dieser Agent kann auf den Arbeitsbereich des Benutzers zugreifen, er kann eine Liste aller verfügbaren Dateien und Ordner abrufen und deren Inhalt abfragen. Darüber hinaus kann er dem Benutzer Änderungen an den Dateien vorschlagen. So kann er den Benutzer bei Codierungsaufgaben oder anderen Aufgaben, die Dateiänderungen beinhalten, unterstützen." + }, + "considerGitignore": { + "description": "Wenn aktiviert, werden Dateien/Ordner ausgeschlossen, die in einer globalen .gitignore-Datei angegeben sind (erwarteter Speicherort ist das Stammverzeichnis des Arbeitsbereichs).", + "title": "Erwägen Sie .gitignore" + }, + "excludedPattern": { + "description": "Liste der Muster (glob oder regex) für auszuschließende Dateien/Ordner.", + "title": "Ausgeschlossene Dateimuster" + }, + "searchMaxResults": { + "description": "Maximale Anzahl von Suchergebnissen, die von der Arbeitsbereichssuchfunktion zurückgegeben werden.", + "title": "Maximale Suchergebnisse" + }, + "workspaceAgent": { + "description": "Ein in die Theia IDE integrierter KI-Assistent, der Softwareentwickler unterstützen soll. Dieser Agent kann auf den Arbeitsbereich des Benutzers zugreifen, er kann eine Liste aller verfügbaren Dateien und Ordner erhalten und deren Inhalt abrufen. Er kann keine Dateien verändern. Er kann daher Fragen zum aktuellen Projekt, zu den Projektdateien und zum Quellcode im Arbeitsbereich beantworten, z. B. wie man das Projekt erstellt, wo man den Quellcode ablegt, wo man bestimmten Code oder Konfigurationen findet usw." + } + } + }, + "ai-chat": { + "fileChangeSetTitle": "Vorgeschlagene Änderungen" + }, + "ai-chat-ui": { + "initiate-session-task-context": "Kontext der Aufgabe: Sitzung initiieren", + "open-current-session-summary": "Zusammenfassung der aktuellen Sitzung öffnen", + "open-settings-tooltip": "AI-Einstellungen öffnen...", + "scroll-lock": "Schriftrolle sperren", + "scroll-unlock": "Schriftrolle freischalten", + "session-settings": "Sitzungseinstellungen festlegen", + "showChats": "Chats anzeigen...", + "summarize-current-session": "Zusammenfassung der aktuellen Sitzung" + }, + "ai-claude-code": { + "open-config": "Open Claude Code Configuration", + "open-memory": "Claude Code-Speicher öffnen (CLAUDE.MD)" + }, + "ai-core": { + "agentCompletionMessage": "Der Agent \"{0}\" hat seine Aufgabe erfüllt.", + "agentCompletionTitle": "Agent \"{0}\" Aufgabe abgeschlossen", + "agentCompletionWithTask": "Der Agent \"{0}\" hat die Aufgabe abgeschlossen: {1}" + }, + "ai-editor": { + "contextMenu": "Fragen Sie AI", + "sendToChat": "An AI Chat senden" + }, + "ai-ide": { + "addressGhReviewCommand": { + "argumentHint": "", + "description": "Kommentare zu einer GitHub-Pull-Anfrage überprüfen" + }, + "fixGhTicketCommand": { + "argumentHint": "", + "description": "Analysieren Sie ein GitHub-Ticket und implementieren Sie die Lösung." + }, + "open-agent-settings-tooltip": "Agent-Einstellungen öffnen...", + "rememberCommand": { + "argumentHint": "[Themenhinweis]", + "description": "Themen aus Gesprächen extrahieren und Projektinformationen aktualisieren" + }, + "ticketCommand": { + "argumentHint": "", + "description": "Analysieren Sie ein GitHub-Ticket und erstellen Sie einen Implementierungsplan." + }, + "todoTool": { + "noTasks": "Keine Aufgaben" + }, + "withAppTesterCommand": { + "description": "Testen Sie mit dem AppTester-Agenten (Agent-Modus erforderlich)" + } + }, + "ai-mcp": { + "blockedServersLabel": "MCP-Server (Autostart blockiert)" + }, + "ai-terminal": { + "cancelExecution": "Befehlsausführung abbrechen", + "canceling": "Abbrechen...", + "confirmExecution": "Shell-Befehl bestätigen", + "denialReason": "Grund", + "executionCanceled": "Abgesagt", + "executionDenied": "Abgelehnt", + "executionDeniedWithReason": "Mit Begründung abgelehnt", + "noOutput": "Keine Ausgabe", + "partialOutput": "Teilausgabe", + "timeout": "Zeitüberschreitung", + "workingDirectory": "Arbeitsverzeichnis" + }, + "callhierarchy": { + "noCallers": "Es wurden keine Anrufer entdeckt.", + "open": "Öffne Aufruf-Hierarchie" + }, + "chat": { + "taskContextVariable": { + "args": { + "contextId": { + "description": "Die ID des abzurufenden Aufgabenkontextes oder einer zusammenzufassenden Chatsitzung." + } + }, + "description": "Bietet Kontextinformationen für eine Aufgabe, z. B. den Plan für die Erledigung einer Aufgabe oder eine Zusammenfassung einer früheren Sitzung", + "label": "Kontext der Aufgabe" + } + }, + "collaboration": { + "collaborate": "Zusammenarbeiten", + "collaboration": "Zusammenarbeit", + "collaborationWorkspace": "Arbeitsbereich für Zusammenarbeit", + "connected": "Verbunden", + "connectedSession": "Verbunden mit einer Sitzung zur Zusammenarbeit", + "copiedInvitation": "Einladungscode in die Zwischenablage kopiert.", + "copyAgain": "Erneut kopieren", + "createRoom": "Neue Collaboration-Sitzung erstellen", + "creatingRoom": "Sitzung erstellen", + "end": "Kollaborationssitzung beenden", + "endDetail": "Beenden Sie die Sitzung, beenden Sie die Freigabe von Inhalten und sperren Sie den Zugang für andere.", + "enterCode": "Enter collaboration session code", + "failedCreate": "Es konnte kein Raum erstellt werden: {0}", + "failedJoin": "Verbindung zum Raum fehlgeschlagen: {0}", + "fieldRequired": "Das Feld {0} ist erforderlich. Die Anmeldung wurde abgebrochen.", + "invite": "Andere einladen", + "inviteDetail": "Kopieren Sie den Einladungscode, um ihn mit anderen zu teilen und an der Sitzung teilzunehmen.", + "joinRoom": "An der Collaboration-Sitzung teilnehmen", + "joiningRoom": "Beitrittssitzung", + "leave": "Kollaborationssitzung verlassen", + "leaveDetail": "Trennen Sie die Verbindung zur aktuellen Zusammenarbeitssitzung und schließen Sie den Arbeitsbereich.", + "loginFailed": "Anmeldung fehlgeschlagen.", + "loginSuccessful": "Anmeldung erfolgreich.", + "noAuth": "Der Server bietet keine Authentifizierungsmethode an.", + "optional": "optional", + "selectAuth": "Authentifizierungsmethode auswählen", + "selectCollaboration": "Wählen Sie die Option Zusammenarbeit", + "serverUrl": "Server-URL", + "serverUrlDescription": "URL der Open Collaboration Tools Server-Instanz für Live-Zusammenarbeitssitzungen", + "sharedSession": "Gemeinsame Sitzung zur Zusammenarbeit", + "startSession": "Zusammenarbeitssitzung starten oder beitreten", + "userWantsToJoin": "Benutzer '{0}' möchte dem Collaboration Room beitreten", + "whatToDo": "Was würden Sie gerne mit anderen Mitarbeitern machen?" + }, + "core": { + "about": { + "compatibility": "{0} Kompatibilität", + "defaultApi": "Standard {0} API", + "listOfExtensions": "Liste der Erweiterungen" + }, + "common": { + "closeAll": "Alle Registerkarten schließen", + "closeAllTabMain": "Alle Registerkarten im Hauptbereich schließen", + "closeOtherTabMain": "Andere Registerkarten im Hauptbereich schließen", + "closeOthers": "Andere Registerkarten schließen", + "closeRight": "Rechte Registerkarten schließen", + "closeTab": "Registerkarte schließen", + "closeTabMain": "Registerkarte im Hauptbereich schließen", + "collapseAllTabs": "Alle Registerkarten einklappen", + "collapseBottomPanel": "Unteres Panel umschalten", + "collapseLeftPanel": "Linkes Bedienfeld umschalten", + "collapseRightPanel": "Rechtes Bedienfeld umschalten", + "collapseTab": "Seitenwand einklappen", + "showNextTabGroup": "Zur nächsten Registerkarte wechseln Gruppe", + "showNextTabInGroup": "Zur nächsten Registerkarte in der Gruppe wechseln", + "showPreviousTabGroup": "Zur vorherigen Registerkartengruppe wechseln", + "showPreviousTabInGroup": "Zur vorherigen Registerkarte in der Gruppe wechseln", + "toggleMaximized": "Maximiert umschalten" + }, + "copyInfo": "Öffnen Sie zuerst eine Datei, um ihren Pfad zu kopieren", + "copyWarn": "Bitte verwenden Sie den Kopierbefehl des Browsers oder eine Tastenkombination.", + "cutWarn": "Bitte verwenden Sie den Ausschneidebefehl des Browsers oder eine Tastenkombination.", + "enhancedPreview": { + "classic": "Zeigt eine einfache Vorschau der Registerkarte mit grundlegenden Informationen an.", + "enhanced": "Anzeige einer erweiterten Vorschau der Registerkarte mit zusätzlichen Informationen.", + "visual": "Zeigen Sie eine visuelle Vorschau der Registerkarte an." + }, + "file": { + "browse": "Durchsuchen" + }, + "highlightModifiedTabs": "Steuert, ob ein oberer Rand auf modifizierten (schmutzigen) Editor-Tabs gezeichnet wird oder nicht.", + "keybinding": { + "duplicateModifierError": "Kann Tastaturbelegung nicht analysieren {0} Doppelte Modifikatoren", + "metaError": "Kann die Tastenkombination nicht analysieren {0} meta ist nur für OSX", + "unrecognizedKeyError": "Unbekannter Schlüssel {0} in {1}" + }, + "keybindingStatus": "{0} wurde gedrückt und wartet auf weitere Tasten", + "keyboard": { + "choose": "Tastaturlayout wählen", + "chooseLayout": "Wählen Sie ein Tastaturlayout", + "current": "(aktuell: {0})", + "currentLayout": " - aktuelles Layout", + "mac": "Mac-Tastaturen", + "pc": "PC-Tastaturen", + "tryDetect": "Versuchen Sie, das Tastaturlayout anhand der Browserinformationen und der gedrückten Tasten zu ermitteln." + }, + "navigator": { + "clipboardWarn": "Der Zugriff auf die Zwischenablage wird verweigert. Überprüfen Sie die Berechtigung Ihres Browsers.", + "clipboardWarnFirefox": "Die Zwischenablage-API ist nicht verfügbar. Sie kann durch die Einstellung '{0}' auf der Seite '{1}' aktiviert werden. Dann laden Sie Theia neu. Beachten Sie, dass FireFox dadurch vollen Zugriff auf die Zwischenablage des Systems erhält." + }, + "offline": "Offline", + "pasteWarn": "Bitte verwenden Sie den Einfügebefehl des Browsers oder eine Tastenkombination.", + "quitMessage": "Alle nicht gespeicherten Änderungen werden nicht gespeichert.", + "resetWorkbenchLayout": "Workbench-Layout zurücksetzen", + "searchbox": { + "close": "Schließen (Escape)", + "next": "Nächste (Unten)", + "previous": "Zurück (Oben)", + "showAll": "Alle Artikel anzeigen", + "showOnlyMatching": "Nur passende Artikel anzeigen" + }, + "secondaryWindow": { + "alwaysOnTop": "Wenn diese Funktion aktiviert ist, bleibt das sekundäre Fenster über allen anderen Fenstern, auch über denen anderer Anwendungen.", + "description": "Legt die Anfangsposition und -größe des extrahierten Sekundärfensters fest.", + "fullSize": "Die Position und Größe des extrahierten Widgets entspricht der der laufenden Theia-Anwendung.", + "halfWidth": "Die Position und Größe des extrahierten Widgets entspricht der halben Breite der laufenden Theia-Anwendung.", + "originalSize": "Position und Größe des extrahierten Widgets entsprechen denen des ursprünglichen Widgets." + }, + "severity": { + "log": "Protokoll" + }, + "silentNotifications": "Legt fest, ob Benachrichtigungs-Popups unterdrückt werden sollen.", + "tabDefaultSize": "Gibt die Standardgröße für Registerkarten an.", + "tabMaximize": "Steuert, ob die Registerkarten bei einem Doppelklick maximiert werden sollen.", + "tabMinimumSize": "Gibt die Mindestgröße für Tabulatoren an.", + "tabShrinkToFit": "Schrumpfen Sie die Registerkarten auf den verfügbaren Platz.", + "window": { + "tabCloseIconPlacement": { + "description": "Platzieren Sie die Schließsymbole auf den Registerkartentiteln am Anfang oder am Ende der Registerkarte. Der Standardwert ist auf allen Plattformen das Ende.", + "end": "Platzieren Sie das Schließsymbol am Ende des Etiketts. In Sprachen, die von links nach rechts geschrieben werden, ist dies die rechte Seite der Registerkarte.", + "start": "Platzieren Sie das Schließsymbol am Anfang des Etiketts. In Sprachen, die von links nach rechts geschrieben werden, ist dies die linke Seite der Registerkarte." + } + }, + "window.menuBarVisibility": "Das Menü wird als kompakte Schaltfläche in der Seitenleiste angezeigt. Dieser Wert wird ignoriert, wenn{0} ist{1}." + }, + "debug": { + "TheiaIDE": "Theia IDE", + "addConfigurationPlaceholder": "Wählen Sie das Stammverzeichnis des Arbeitsbereichs, dem Sie die Konfiguration hinzufügen möchten", + "breakpoint": "Haltepunkt", + "cannotRunToThisLocation": "Der aktuelle Thread konnte nicht an die angegebene Stelle ausgeführt werden.", + "compound-cycle": "Startkonfiguration '{0}' enthält einen Zyklus mit sich selbst", + "conditionalBreakpoint": "Bedingter Haltepunkt", + "conditionalBreakpointsNotSupported": "Bedingte Haltepunkte werden von diesem Debug-Typ nicht unterstützt", + "confirmRunToShiftedPosition_msg": "Die Zielposition wird nach Ln {0}, Col {1} verschoben. Trotzdem laufen?", + "confirmRunToShiftedPosition_title": "Der aktuelle Thread kann nicht genau an die angegebene Stelle geführt werden", + "consoleFilter": "Filter (z. B. Text, !Ausschließen)", + "consoleFilterAriaLabel": "Filter Debug-Konsolenausgabe", + "consoleSessionSelectorTooltip": "Wechseln Sie zwischen Debug-Sitzungen. Jede Debug-Sitzung hat ihre eigene Konsolenausgabe.", + "consoleSeverityTooltip": "Filtern Sie die Konsolenausgabe nach Schweregrad. Es werden nur Meldungen mit dem ausgewählten Schweregrad angezeigt.", + "continueAll": "Alle fortsetzen", + "copyExpressionValue": "Ausdruckswert kopieren", + "couldNotRunTask": "Die Aufgabe '{0}' konnte nicht ausgeführt werden.", + "dataBreakpoint": "Daten-Haltepunkt", + "debugConfiguration": "Debug-Konfiguration", + "debugSessionInitializationFailed": "Die Initialisierung der Debug-Sitzung ist fehlgeschlagen. Siehe Konsole für Details.", + "debugSessionTypeNotSupported": "Der Debug-Session-Typ \"{0}\" wird nicht unterstützt.", + "debugToolbarMenu": "Debug Toolbar Menu", + "debugVariableInput": "{0} Wert einstellen", + "disableSelectedBreakpoints": "Ausgewählte Haltepunkte deaktivieren", + "disabledBreakpoint": "Behinderte {0}", + "enableSelectedBreakpoints": "Ausgewählte Haltepunkte aktivieren", + "entry": "Eintrag", + "errorStartingDebugSession": "Beim Starten der Debug-Sitzung ist ein Fehler aufgetreten, prüfen Sie die Protokolle auf weitere Details.", + "exception": "Ausnahme", + "functionBreakpoint": "Funktionsunterbrechungspunkt", + "goto": "siehe", + "htiConditionalBreakpointsNotSupported": "Hit bedingte Haltepunkte nicht von diesem Debug-Typ unterstützt", + "instruction-breakpoint": "Anweisung Haltepunkt", + "instructionBreakpoint": "Befehlshaltepunkt", + "logpointsNotSupported": "Logpunkte, die von diesem Debug-Typ nicht unterstützt werden", + "missingConfiguration": "Die dynamische Konfiguration '{0}:{1}' fehlt oder ist nicht anwendbar", + "pause": "Pause", + "pauseAll": "Pause Alle", + "reveal": "Enthüllen", + "step": "Schritt", + "taskTerminatedBySignal": "Die Aufgabe '{0}' wurde durch das Signal {1} beendet.", + "taskTerminatedForUnknownReason": "Aufgabe '{0}' aus unbekanntem Grund abgebrochen.", + "taskTerminatedWithExitCode": "Die Aufgabe '{0}' wurde mit dem Exit-Code {1} beendet.", + "threads": "Threads", + "toggleTracing": "Aktivieren/Deaktivieren der Verfolgung der Kommunikation mit Debug-Adaptern", + "unknownSession": "Unbekannte Sitzung", + "unverifiedBreakpoint": "Unverifiziert {0}" + }, + "editor": { + "diffEditor.wordWrap2": "Der Zeilenumbruch erfolgt entsprechend der Einstellung `#editor.wordWrap#`.", + "dirtyEncoding": "Die Datei ist verschmutzt. Bitte speichern Sie sie zuerst, bevor Sie sie mit einer anderen Kodierung erneut öffnen.", + "editor.bracketPairColorization.enabled": "Steuert, ob die Einfärbung von Klammerpaaren aktiviert ist oder nicht. Verwenden Sie `#workbench.colorCustomizations#`, um die Farben der Klammerhervorhebung zu überschreiben.", + "editor.codeActions.triggerOnFocusChange": "Aktiviert das Auslösen von `#editor.codeActionsOnSave#`, wenn `#files.autoSave#` auf `afterDelay` gesetzt ist. Code Actions muss auf `always` gesetzt werden, um bei Fenster- und Fokuswechsel ausgelöst zu werden.", + "editor.detectIndentation": "Steuert, ob `#editor.tabSize#` und `#editor.insertSpaces#` automatisch erkannt werden, wenn eine Datei geöffnet wird, basierend auf dem Inhalt der Datei.", + "editor.experimental.preferTreeSitter": "Steuert, ob die Tree-Sitter-Analyse für bestimmte Sprachen aktiviert werden soll. Dies hat für die angegebenen Sprachen Vorrang vor `editor.experimental.treeSitterTelemetry`.", + "editor.inlayHints.enabled1": "Inlay-Hinweise werden standardmäßig angezeigt und bei gedrückter Tastenkombination \"Strg+Alt\" ausgeblendet", + "editor.inlayHints.enabled2": "Inlay-Hinweise sind standardmäßig ausgeblendet und werden angezeigt, wenn die Tastenkombination \"Strg+Alt\" gedrückt wird.", + "editor.inlayHints.fontFamily": "Steuert die Schriftfamilie der Inlay-Hinweise im Editor. Wenn leer, wird die `#editor.fontFamily#` verwendet.", + "editor.inlayHints.fontSize": "Steuert die Schriftgröße der Inlay-Hinweise im Editor. Als Vorgabe wird die `#editor.fontSize#` verwendet, wenn der konfigurierte Wert kleiner als `5` oder größer als die Editor-Schriftgröße ist.", + "editor.inlineSuggest.edits.experimental.enabled": "Steuert, ob experimentelle Bearbeitungen in Inline-Vorschlägen aktiviert werden sollen.", + "editor.inlineSuggest.edits.experimental.onlyShowWhenCloseToCursor": "Legt fest, ob Inline-Vorschläge nur angezeigt werden sollen, wenn sich der Cursor in der Nähe des Vorschlags befindet.", + "editor.inlineSuggest.edits.experimental.useInterleavedLinesDiff": "Legt fest, ob experimentelle Zwischenzeilendiffs in Inline-Vorschlägen aktiviert werden sollen.", + "editor.inlineSuggest.edits.experimental.useMixedLinesDiff": "Steuert, ob experimentelle Bearbeitungen in Inline-Vorschlägen aktiviert werden sollen.", + "editor.insertSpaces": "Leerzeichen einfügen, wenn `Tab` gedrückt wird. Diese Einstellung wird auf der Grundlage des Dateiinhalts außer Kraft gesetzt, wenn `#editor.detectIndentation#` eingeschaltet ist.", + "editor.quickSuggestions": "Legt fest, ob während der Eingabe automatisch Vorschläge angezeigt werden sollen. Dies kann für die Eingabe von Kommentaren, Strings und anderem Code gesteuert werden. Schnellvorschläge können so konfiguriert werden, dass sie als Ghosttext oder mit dem Suggest-Widget angezeigt werden. Beachten Sie auch die '#editor.suggestOnTriggerCharacters#'-Einstellung, die steuert, ob Vorschläge durch Sonderzeichen ausgelöst werden.", + "editor.suggestFontSize": "Schriftgröße für das Vorschlags-Widget. Wenn auf `0` gesetzt, wird der Wert von `#editor.fontSize#` verwendet.", + "editor.suggestLineHeight": "Zeilenhöhe für das Vorschlags-Widget. Wenn auf `0` gesetzt, wird der Wert von `#editor.lineHeight#` verwendet. Der Mindestwert ist 8.", + "editor.tabSize": "Die Anzahl der Leerzeichen, die ein Tabulator ausmacht. Diese Einstellung wird basierend auf dem Inhalt der Datei überschrieben, wenn `#editor.detectIndentation#` eingeschaltet ist.", + "formatOnSaveTimeout": "Zeitüberschreitung in Millisekunden, nach der die Formatierung, die beim Speichern der Datei ausgeführt wird, abgebrochen wird.", + "persistClosedEditors": "Legt fest, ob der Verlauf des geschlossenen Editors für den Arbeitsbereich beim Neuladen des Fensters erhalten bleiben soll.", + "showAllEditors": "Alle geöffneten Editoren anzeigen", + "splitHorizontal": "Editor horizontal teilen", + "splitVertical": "Editor vertikal teilen", + "toggleStickyScroll": "Fixierten Bildlauf umschalten" + }, + "external-terminal": { + "cwd": "Aktuelles Arbeitsverzeichnis für neues externes Terminal wählen" + }, + "file-search": { + "toggleIgnoredFiles": " (Drücken Sie {0}, um ignorierte Dateien anzuzeigen/auszublenden)" + }, + "fileDialog": { + "showHidden": "Versteckte Dateien anzeigen" + }, + "fileSystem": { + "fileResource": { + "overWriteBody": "Möchten Sie die an '{0}' vorgenommenen Änderungen im Dateisystem überschreiben?" + } + }, + "filesystem": { + "copiedToClipboard": "Kopieren Sie den Download-Link in die Zwischenablage.", + "copyDownloadLink": "Download-Link kopieren", + "dialog": { + "initialLocation": "Zum Ausgangsort gehen", + "multipleItemMessage": "Sie können nur ein Element auswählen", + "navigateBack": "Zurück navigieren", + "navigateForward": "Vorwärts navigieren", + "navigateUp": "Ein Verzeichnis nach oben navigieren" + }, + "fileResource": { + "binaryFileQuery": "Das Öffnen kann einige Zeit in Anspruch nehmen und dazu führen, dass die IDE nicht mehr reagiert. Wollen Sie '{0}' trotzdem öffnen?", + "binaryTitle": "Die Datei ist entweder binär oder verwendet eine nicht unterstützte Textkodierung.", + "largeFileTitle": "Die Datei ist zu groß ({0}).", + "overwriteTitle": "Die Datei '{0}' wurde im Dateisystem geändert." + }, + "filesExclude": "Konfigurieren Sie globale Muster für den Ausschluss von Dateien und Ordnern. Beispielsweise entscheidet der Datei-Explorer auf der Grundlage dieser Einstellung, welche Dateien und Ordner angezeigt oder ausgeblendet werden sollen.", + "format": "Format:", + "maxConcurrentUploads": "Maximale Anzahl der gleichzeitig hochzuladenden Dateien, wenn mehrere Dateien hochgeladen werden. 0 bedeutet, dass alle Dateien gleichzeitig hochgeladen werden.", + "maxFileSizeMB": "Steuert die maximale Dateigröße in MB, die geöffnet werden kann.", + "prepareDownload": "Download wird vorbereitet...", + "prepareDownloadLink": "Download-Link wird vorbereitet...", + "processedOutOf": "Verarbeitet {0} von {1}", + "replaceTitle": "Datei austauschen", + "uploadFailed": "Beim Hochladen einer Datei ist ein Fehler aufgetreten. {0}", + "uploadFiles": "Dateien hochladen...", + "uploadedOutOf": "Hochgeladen {0} von {1}" + }, + "getting-started": { + "ai": { + "header": "AI-Unterstützung in der Theia IDE ist verfügbar (Beta-Version)!", + "openAIChatView": "Öffnen Sie jetzt die KI-Chat-Ansicht, um zu erfahren, wie Sie beginnen können!" + }, + "apiComparator": "{0} API-Kompatibilität", + "newExtension": "Bau einer neuen Erweiterung", + "newPlugin": "Ein neues Plugin erstellen", + "startup-editor": { + "welcomePage": "Öffnen Sie die Willkommensseite mit Inhalten, die Ihnen den Einstieg in die Arbeit mit {0} und den Erweiterungen erleichtern." + }, + "telemetry": "Datennutzung und Telemetrie" + }, + "git": { + "aFewSecondsAgo": "vor ein paar Sekunden", + "addSignedOff": "Abgezeichnet von hinzufügen", + "added": "Hinzugefügt", + "amendReuseMessage": "Um die letzte Meldung wieder zu verwenden, drücken Sie \"Enter\" oder \"Escape\", um den Vorgang abzubrechen.", + "amendRewrite": "Vorherige Übermittlungsnachricht neu schreiben. Bestätigen Sie mit \"Enter\" oder brechen Sie mit \"Escape\" ab.", + "checkoutCreateLocalBranchWithName": "Erstellen Sie einen neuen lokalen Zweig mit dem Namen: {0}. Drücken Sie \"Enter\" zur Bestätigung oder \"Escape\" zum Abbrechen.", + "checkoutProvideBranchName": "Bitte geben Sie den Namen einer Zweigstelle an.", + "checkoutSelectRef": "Wählen Sie eine Referenz zum Auschecken oder erstellen Sie eine neue lokale Zweigstelle:", + "cloneQuickInputLabel": "Bitte geben Sie einen Speicherort für das Git-Repository an. Bestätigen Sie mit \"Enter\" oder brechen Sie mit \"Escape\" ab.", + "cloneRepository": "Klonen Sie das Git-Repository: {0}. Bestätigen Sie mit \"Enter\" oder brechen Sie mit \"Escape\" ab.", + "compareWith": "Vergleichen mit...", + "compareWithBranchOrTag": "Wählen Sie einen Zweig oder eine Markierung, den/die Sie mit dem derzeit aktiven {0} Zweig vergleichen möchten:", + "conflicted": "Widersprüchlich", + "copied": "Kopiert", + "diff": "Diff", + "dirtyDiffLinesLimit": "Schmutzige Diff-Dekorationen nicht anzeigen, wenn die Zeilenzahl des Editors diese Grenze überschreitet.", + "dropStashMessage": "Versteck erfolgreich entfernt.", + "editorDecorationsEnabled": "Git-Dekorationen im Editor anzeigen.", + "fetchPickRemote": "Wählen Sie eine Fernbedienung zum Abrufen aus:", + "gitDecorationsColors": "Farbdekoration im Navigator verwenden.", + "mergeEditor": { + "currentSideTitle": "Aktuell", + "incomingSideTitle": "Eingehend" + }, + "mergeQuickPickPlaceholder": "Wählen Sie einen Zweig, der mit dem derzeit aktiven {0}-Zweig zusammengeführt werden soll:", + "missingUserInfo": "Stellen Sie sicher, dass Sie Ihren 'user.name' und 'user.email' in git konfigurieren.", + "noHistoryForError": "Es ist keine Historie verfügbar für {0}", + "noPreviousCommit": "Kein früherer Commit zur Änderung", + "noRepositoriesSelected": "Es wurden keine Repositories ausgewählt.", + "prepositionIn": "in", + "renamed": "Umbenannt in", + "repositoryNotInitialized": "Das Repository {0} ist noch nicht initialisiert.", + "stashChanges": "Versteckte Änderungen. Drücken Sie \"Enter\" zur Bestätigung oder \"Escape\" zum Abbrechen.", + "stashChangesWithMessage": "Stash-Änderungen mit Meldung: {0}. Drücken Sie \"Enter\" zur Bestätigung oder \"Escape\" zum Abbrechen.", + "tabTitleIndex": "{0} (Index)", + "tabTitleWorkingTree": "{0} (Arbeitsbaum)", + "toggleBlameAnnotations": "Blame Annotationen umschalten", + "unstaged": "Nicht inszeniert" + }, + "keybinding-schema-updater": { + "deprecation": "Verwenden Sie stattdessen die `when`-Klausel." + }, + "keymaps": { + "addKeybindingTitle": "Tastenbelegung hinzufügen für {0}", + "editKeybinding": "Tastaturbelegung bearbeiten...", + "editKeybindingTitle": "Tastaturbelegung für {0} bearbeiten", + "editWhenExpression": "Bearbeiten Wenn Ausdruck...", + "editWhenExpressionTitle": "Bearbeiten Wenn Ausdruck für {0}", + "keybinding": { + "copy": "Tastaturbelegung kopieren", + "copyCommandId": "Kopieren der Tastaturbelegung Befehls-ID", + "copyCommandTitle": "Tastaturbelegung kopieren Befehl Titel", + "edit": "Tastaturbelegung bearbeiten...", + "editWhenExpression": "Tastenkombinationen bearbeiten, wenn der Ausdruck..." + }, + "keybindingCollidesValidation": "Tastenkombinationen kollidieren", + "requiredKeybindingValidation": "Schlüsselbindung Wert ist erforderlich", + "resetKeybindingConfirmation": "Möchten Sie diese Tastaturbelegung wirklich auf den Standardwert zurücksetzen?", + "resetKeybindingTitle": "Tastaturbelegung für {0} zurücksetzen", + "resetMultipleKeybindingsWarning": "Wenn mehrere Tastenkombinationen für diesen Befehl existieren, werden alle zurückgesetzt." + }, + "localize": { + "offlineTooltip": "Kann keine Verbindung zum Backend herstellen." + }, + "markers": { + "clearAll": "Alle löschen", + "noProblems": "Bisher wurden im Arbeitsbereich keine Probleme festgestellt.", + "tabbarDecorationsEnabled": "Problemdekorationen (Diagnosemarkierungen) in den Registerkartenleisten anzeigen." + }, + "memory-inspector": { + "addressTooltip": "Speicherplatz, der angezeigt werden soll, eine Adresse oder ein Ausdruck, der zu einer Adresse ausgewertet wird", + "ascii": "ASCII", + "binary": "Binär", + "byteSize": "Byte Size", + "bytesPerGroup": "Bytes Per Group", + "closeSettings": "Einstellungen schließen", + "columns": "Rubriken", + "command": { + "createNewMemory": "Neuen Speicherinspektor erstellen", + "createNewRegisterView": "Neue Registeransicht erstellen", + "followPointer": "Zeigern folgen", + "followPointerMemory": "Zeiger im Memory Inspector verfolgen", + "resetValue": "Wert zurücksetzen", + "showRegister": "Register im Speicherinspektor anzeigen", + "viewVariable": "Variable im Speicherinspektor anzeigen" + }, + "data": "Daten", + "decimal": "Dezimal", + "diff": { + "label": "Diff: {0}" + }, + "diff-widget": { + "offset-label": "{0} Versetzt", + "offset-title": "Bytes zum Versetzen des Speichers von {0}" + }, + "editable": { + "apply": "Änderungen anwenden", + "clear": "Deutliche Änderungen" + }, + "endianness": "Endianness", + "extraColumn": "Extra-Spalte", + "groupsPerRow": "Gruppen pro Zeile", + "hexadecimal": "Hexadezimal", + "length": "Länge", + "lengthTooltip": "Anzahl der abzurufenden Bytes, dezimal oder hexadezimal", + "memory": { + "addressField": { + "memoryReadError": "Geben Sie eine Adresse oder einen Ausdruck in das Feld Ort ein." + }, + "freeze": "Speicheransicht einfrieren", + "hideSettings": "Einstellungsfeld ausblenden", + "readError": { + "bounds": "Speichergrenzen überschritten, Ergebnis wird abgeschnitten.", + "noContents": "Derzeit ist kein Speicherinhalt verfügbar." + }, + "readLength": { + "memoryReadError": "Geben Sie eine Länge (Dezimal- oder Hexadezimalzahl) in das Feld Länge ein." + }, + "showSettings": "Einstellungsfeld anzeigen", + "unfreeze": "Speicheransicht auftauen", + "userError": "Es ist ein Fehler beim Abrufen von Speicher aufgetreten." + }, + "memoryCategory": "Speicherinspektor", + "memoryInspector": "Speicherinspektor", + "memoryTitle": "Speicher", + "octal": "Oktal", + "offset": "Versetzt", + "offsetTooltip": "Offset, der beim Navigieren zum aktuellen Speicherplatz hinzugefügt wird", + "provider": { + "localsError": "Lokale Variablen können nicht gelesen werden. Keine aktive Debug-Sitzung.", + "readError": "Speicher kann nicht gelesen werden. Keine aktive Debug-Sitzung.", + "writeError": "Speicher kann nicht geschrieben werden. Keine aktive Debug-Sitzung." + }, + "register": "Register", + "register-widget": { + "filter-placeholder": "Filter (beginnt mit)" + }, + "registerReadError": "Es gab einen Fehler beim Abrufen von Registern.", + "registers": "Registers", + "toggleComparisonWidgetVisibility": "Sichtbarkeit des Vergleichs-Widgets umschalten", + "utils": { + "afterBytes": "Sie müssen in beide Widgets, die Sie vergleichen möchten, Speicher laden. {0} hat keinen Speicher geladen.", + "bytesMessage": "Sie müssen in beide Widgets, die Sie vergleichen möchten, Speicher laden. {0} hat keinen Speicher geladen." + } + }, + "messages": { + "notificationTimeout": "Informative Benachrichtigungen werden nach dieser Zeitspanne ausgeblendet.", + "toggleNotifications": "Benachrichtigungen umschalten" + }, + "mini-browser": { + "typeUrl": "Geben Sie eine URL ein" + }, + "monaco": { + "noSymbolsMatching": "Keine passenden Symbole", + "typeToSearchForSymbols": "Tippen Sie, um nach Symbolen zu suchen" + }, + "navigator": { + "autoReveal": "Auto-Enthüllung", + "clipboardWarn": "Der Zugriff auf die Zwischenablage wird verweigert. Überprüfen Sie die Berechtigung Ihres Browsers.", + "clipboardWarnFirefox": "Die Zwischenablage-API ist nicht verfügbar. Sie kann durch die Einstellung '{0}' auf der Seite '{1}' aktiviert werden. Dann laden Sie Theia neu. Beachten Sie, dass FireFox dadurch vollen Zugriff auf die Systemzwischenablage erhält.", + "openWithSystemEditor": "Open With System Editor", + "refresh": "Aktualisieren im Explorer", + "reveal": "Enthüllen im Explorer", + "systemEditor": "System Editor", + "toggleHiddenFiles": "Versteckte Dateien umschalten" + }, + "output": { + "clearOutputChannel": "Ausgangskanal löschen...", + "closeOutputChannel": "Ausgangskanal schließen...", + "hiddenChannels": "Versteckte Kanäle", + "hideOutputChannel": "Ausgangskanal ausblenden...", + "maxChannelHistory": "Die maximale Anzahl der Einträge in einem Ausgabekanal.", + "outputChannels": "Ausgangskanäle", + "showOutputChannel": "Ausgangskanal anzeigen..." + }, + "plugin": { + "blockNewTab": "Ihr Browser hat das Öffnen einer neuen Registerkarte verhindert" + }, + "plugin-dev": { + "alreadyRunning": "Die gehostete Instanz läuft bereits.", + "debugInstance": "Debug-Instanz", + "debugMode": "Verwendung von inspect oder inspect-brk zur Fehlersuche in Node.js", + "debugPorts": { + "debugPort": "Zu verwendender Port für das Node.js-Debugging dieses Servers" + }, + "devHost": "Entwicklung Host", + "failed": "Die gehostete Plugin-Instanz konnte nicht ausgeführt werden: {0}", + "hostedPlugin": "Gehostetes Plugin", + "hostedPluginRunning": "Gehostetes Plugin: Läuft", + "hostedPluginStarting": "Gehostetes Plugin: Start", + "hostedPluginStopped": "Gehostetes Plugin: Angehalten", + "hostedPluginWatching": "Gehostetes Plugin: Überwachen", + "instanceTerminated": "{0} wurde abgebrochen", + "launchOutFiles": "Array von Glob-Patterns zum Auffinden der generierten JavaScript-Dateien (`${pluginPath}` wird durch den tatsächlichen Pfad des Plugins ersetzt).", + "noValidPlugin": "Der angegebene Ordner enthält kein gültiges Plugin.", + "notRunning": "Die gehostete Instanz läuft nicht.", + "pluginFolder": "Plugin-Ordner ist eingestellt auf: {0}", + "preventedNewTab": "Ihr Browser hat das Öffnen einer neuen Registerkarte verhindert", + "restartInstance": "Instanz neu starten", + "running": "Die gehostete Instanz läuft auf:", + "selectPath": "Pfad auswählen", + "startInstance": "Start-Instanz", + "starting": "Start des gehosteten Instanzservers ...", + "stopInstance": "Instanz anhalten", + "unknownTerminated": "Die Instanz wurde beendet", + "watchMode": "Watcher auf Plugin in Entwicklung ausführen" + }, + "plugin-ext": { + "authentication-main": { + "loginTitle": "Anmeldung", + "signedOut": "Erfolgreich abgemeldet." + }, + "plugins": "Plugins", + "webviewTrace": "Steuert die Kommunikationsverfolgung mit Webviews.", + "webviewWarnIfUnsecure": "Warnt Benutzer, dass Webviews derzeit unsicher eingesetzt werden." + }, + "preferences": { + "ai-features": "AI-Funktionen", + "hostedPlugin": "Gehostetes Plugin", + "toolbar": "Symbolleiste" + }, + "preview": { + "openByDefault": "Öffnen Sie standardmäßig die Vorschau anstelle des Editors." + }, + "property-view": { + "created": "Erstellt", + "directory": "Verzeichnis", + "lastModified": "Zuletzt geändert", + "location": "Standort", + "noProperties": "Keine Eigenschaften verfügbar.", + "properties": "Eigenschaften", + "symbolicLink": "Symbolischer Link" + }, + "remote": { + "dev-container": { + "connect": "Im Container wieder öffnen", + "noDevcontainerFiles": "Keine devcontainer.json-Dateien im Arbeitsbereich gefunden. Bitte stellen Sie sicher, dass Sie ein .devcontainer-Verzeichnis mit einer devcontainer.json-Datei haben.", + "selectDevcontainer": "Wählen Sie eine devcontainer.json-Datei" + }, + "ssh": { + "connect": "Aktuelles Fenster mit Host verbinden...", + "connectToConfigHost": "Aktuelles Fenster mit Host in Config-Datei verbinden...", + "enterHost": "SSH-Hostname eingeben", + "enterUser": "SSH-Benutzername eingeben", + "failure": "SSH-Verbindung zur Gegenstelle konnte nicht geöffnet werden.", + "hostPlaceHolder": "Z.B. hello@example.com", + "needsHost": "Bitte geben Sie einen Hostnamen ein.", + "needsUser": "Bitte geben Sie einen Benutzernamen ein.", + "userPlaceHolder": "Z.B.: Hallo" + }, + "sshNoConfigPath": "Kein SSH-Konfigurationspfad gefunden.", + "wsl": { + "connectToWsl": "Verbindung zur WSL", + "connectToWslUsingDistro": "Verbindung zur WSL über Distro...", + "noWslDistroFound": "Keine WSL-Distributionen gefunden. Bitte installieren Sie zuerst eine WSL-Distribution.", + "reopenInWsl": "Reopen Folder in WSL", + "selectWSLDistro": "Wählen Sie eine WSL-Verteilung" + } + }, + "scm": { + "amend": "Ändern", + "amendHeadCommit": "HEAD Commit", + "amendLastCommit": "Letzte Übertragung ändern", + "changeRepository": "Repository ändern...", + "config.untrackedChanges": "Steuert, wie sich nicht verfolgte Änderungen verhalten.", + "config.untrackedChanges.hidden": "versteckt", + "config.untrackedChanges.mixed": "gemischt", + "config.untrackedChanges.separate": "getrennt", + "dirtyDiff": { + "close": "Schließen Ändern Peek-Ansicht" + }, + "history": "Geschichte", + "mergeEditor": { + "resetConfirmationTitle": "Wollen Sie das Ergebnis der Zusammenführung in diesem Editor wirklich zurücksetzen?" + }, + "noRepositoryFound": "Kein Repository gefunden", + "unamend": "Ändern", + "unamendCommit": "Commit ändern" + }, + "search-in-workspace": { + "includeIgnoredFiles": "Ignorierte Dateien einbeziehen", + "noFolderSpecified": "Sie haben keinen Ordner geöffnet oder angegeben. Es werden derzeit nur geöffnete Dateien durchsucht.", + "resultSubset": "Dies ist nur eine Teilmenge aller Ergebnisse. Verwenden Sie einen spezifischeren Suchbegriff, um die Ergebnisliste einzugrenzen.", + "searchOnEditorModification": "Durchsucht den aktiven Editor nach Änderungen." + }, + "secondary-window": { + "extract-widget": "Ansicht in sekundäres Fenster verschieben" + }, + "shell-area": { + "secondary": "Sekundäres Fenster" + }, + "task": { + "attachTask": "Aufgabe anhängen...", + "circularReferenceDetected": "Kreisförmige Referenz erkannt: {0} --> {1}", + "clearHistory": "Geschichte löschen", + "errorKillingTask": "Fehler beim Beenden der Aufgabe '{0}': {1}", + "errorLaunchingTask": "Fehler beim Starten der Aufgabe '{0}': {1}", + "invalidTaskConfigs": "Es wurden ungültige Aufgabenkonfigurationen gefunden. Öffnen Sie tasks.json und suchen Sie die Details in der Ansicht Probleme.", + "neverScanTaskOutput": "Scannen Sie niemals die Aufgabenausgabe", + "noTaskToRun": "Keine Aufgabe zur Ausführung gefunden. Aufgaben konfigurieren...", + "noTasksFound": "Keine Aufgaben gefunden", + "notEnoughDataInDependsOn": "Die in \"dependsOn\" angegebenen Informationen reichen nicht aus, um die richtige Aufgabe zu finden!", + "schema": { + "commandOptions": { + "cwd": "Das aktuelle Arbeitsverzeichnis des ausgeführten Programms oder Skripts. Wird es weggelassen, wird das aktuelle Arbeitsverzeichnis von Theia verwendet." + }, + "presentation": { + "panel": { + "dedicated": "Das Terminal ist für eine bestimmte Aufgabe bestimmt. Wenn diese Aufgabe erneut ausgeführt wird, wird das Terminal wieder verwendet. Die Ausgabe einer anderen Aufgabe wird jedoch in einem anderen Terminal angezeigt.", + "new": "Bei jeder Ausführung dieser Aufgabe wird ein neues sauberes Terminal verwendet.", + "shared": "Das Terminal wird gemeinsam genutzt, und die Ausgaben der anderen Task-Läufe werden in dasselbe Terminal eingegeben." + }, + "showReuseMessage": "Steuert, ob die Meldung \"Terminal wird von Aufgaben wiederverwendet\" angezeigt werden soll." + }, + "problemMatcherObject": { + "owner": "Der Eigentümer des Problems innerhalb von Theia. Kann weggelassen werden, wenn base angegeben ist. Der Standardwert ist \"extern\", wenn er weggelassen wird und base nicht angegeben ist." + } + }, + "taskAlreadyRunningInTerminal": "Aufgabe wird bereits im Terminal ausgeführt", + "taskExitedWithCode": "Die Aufgabe '{0}' wurde mit dem Code {1} beendet.", + "taskTerminalTitle": "Aufgabe: {0}", + "taskTerminatedBySignal": "Die Aufgabe '{0}' wurde durch das Signal {1} beendet.", + "terminalWillBeReusedByTasks": "Das Terminal wird von Aufgaben wiederverwendet." + }, + "terminal": { + "defaultProfile": "Das Standardprofil unter {0}", + "enableCopy": "Aktivieren von ctrl-c (cmd-c unter macOS) zum Kopieren von markiertem Text", + "enablePaste": "Aktivieren von ctrl-v (cmd-v unter macOS) zum Einfügen aus der Zwischenablage", + "profileArgs": "Die Shellparameter, welche dieses Profil verwendet.", + "profileColor": "ID einer Terminal-Themenfarbe zur Verwendung mit diesem Terminal.", + "profileDefault": "Standardprofil wählen...", + "profileIcon": "Eine codicon ID zur Verwendung mit diesem Terminal. \nterminal-tmux:\"$(terminal-tmux)\"", + "profileNew": "Neues Terminal (mit Profil)...", + "profilePath": "Der Pfad der Shell, den dieses Profil benutzt.", + "profiles": "Die Profile welche zur Erzeugung eines Terminals verwendet werden können. Setzen Sie den Pfad von Hand mit optionalen Parametern.\n\nSezen Sie ein Profile auf `null` um es zu verbergen, z.B.: `{0}: null`.", + "rendererType": "Steuert, wie das Terminal gerendert wird.", + "rendererTypeDeprecationMessage": "Der Renderer-Typ wird nicht mehr als Option unterstützt.", + "selectProfile": "Wählen Sie ein Profil für das neue Terminal", + "shell.deprecated": "Dies ist veraltet, neu können Sie Ihre Shell konfigurieren, indem Sie ein Profil unter 'terminal.integrated.profiles.{0}' anlegen und dessen Namen in 'terminal.integrated.defaultProfile.{0}' als Standard setzen.", + "shellArgsLinux": "Die Befehlszeilenargumente, die im Linux-Terminal zu verwenden sind.", + "shellArgsOsx": "Die Befehlszeilenargumente, die im macOS-Terminal zu verwenden sind.", + "shellArgsWindows": "Die Befehlszeilenargumente, die im Windows-Terminal zu verwenden sind.", + "shellLinux": "Der Pfad der Shell, die das Terminal unter Linux verwendet (Standard: '{0}'}).", + "shellOsx": "Der Pfad der Shell, die das Terminal unter macOS verwendet (Standard: '{0}'}).", + "shellWindows": "Der Pfad der Shell, die das Terminal unter Windows verwendet. (Standard: '{0}')." + }, + "terminal-manager": { + "addTerminalToGroup": "Terminal zur Gruppe hinzufügen", + "closeDialog": { + "message": "Sobald der Terminal Manager geschlossen ist, kann sein Layout nicht wiederhergestellt werden. Möchten Sie den Terminal Manager wirklich schließen?", + "title": "Möchten Sie den Terminal-Manager schließen?" + }, + "closeTerminalManager": "Terminal-Manager schließen", + "createNewTerminalGroup": "Neue Terminalgruppe erstellen", + "createNewTerminalPage": "Neue Terminalseite erstellen", + "deleteGroup": "Gruppe löschen", + "deletePage": "Seite löschen", + "deleteTerminal": "Terminal löschen", + "group": "Gruppe", + "label": "Terminals", + "maximizeBottomPanel": "Unteres Bedienfeld maximieren", + "minimizeBottomPanel": "Unteres Bedienfeld minimieren", + "openTerminalManager": "Terminal-Manager öffnen", + "page": "Seite", + "rename": "Umbenennen", + "resetTerminalManagerLayout": "Reset Terminal Manager Layout", + "toggleTreeView": "Baumansicht umschalten" + }, + "test": { + "cancelAllTestRuns": "Alle Testläufe abbrechen", + "stackFrameAt": "unter", + "testRunDefaultName": "{0} laufen. {1}", + "testRuns": "Testläufe" + }, + "toolbar": { + "addCommand": "Befehl zur Symbolleiste hinzufügen", + "addCommandPlaceholder": "Suchen Sie einen Befehl, den Sie der Symbolleiste hinzufügen möchten", + "centerColumn": "Mittlere Spalte", + "failedUpdate": "Der Wert von '{0}' konnte nicht in '{1}' aktualisiert werden.", + "filterIcons": "Filter-Symbole", + "iconSelectDialog": "Wählen Sie ein Symbol für '{0}'.", + "iconSet": "Ikonensatz", + "insertGroupLeft": "Gruppentrennzeichen einfügen (links)", + "insertGroupRight": "Gruppentrennzeichen einfügen (rechts)", + "leftColumn": "Linke Spalte", + "openJSON": "Symbolleiste anpassen (JSON öffnen)", + "removeCommand": "Befehl aus der Symbolleiste entfernen", + "restoreDefaults": "Standardeinstellungen der Symbolleiste wiederherstellen", + "rightColumn": "Rechte Spalte", + "selectIcon": "Icon auswählen", + "toggleToolbar": "Symbolleiste umschalten", + "toolbarLocationPlaceholder": "Wo möchten Sie den Befehl hinzufügen?", + "useDefaultIcon": "Standardsymbol verwenden" + }, + "typehierarchy": { + "subtypeHierarchy": "Hierarchie der Untertypen", + "supertypeHierarchy": "Supertyp-Hierarchie" + }, + "variableResolver": { + "listAllVariables": "Variable: Alle auflisten" + }, + "vsx-registry": { + "confirmDialogMessage": "Die Erweiterung \"{0}\" ist ungeprüft und könnte ein Sicherheitsrisiko darstellen.", + "confirmDialogTitle": "Sind Sie sicher, dass Sie mit der Installation fortfahren wollen?", + "downloadCount": "Anzahl der Downloads: {0}", + "errorFetching": "Fehler beim Abrufen von Erweiterungen.", + "errorFetchingConfigurationHint": "Dies könnte auf Probleme bei der Netzwerkkonfiguration zurückzuführen sein.", + "failedInstallingVSIX": "Die Installation von {0} aus VSIX ist fehlgeschlagen.", + "invalidVSIX": "Die ausgewählte Datei ist kein gültiges \"*.vsix\"-Plugin.", + "license": "Lizenz: {0}", + "onlyShowVerifiedExtensionsDescription": "Auf diese Weise kann {0} nur verifizierte Durchwahlen anzeigen.", + "onlyShowVerifiedExtensionsTitle": "Nur geprüfte Erweiterungen anzeigen", + "recommendedExtensions": "Eine Liste mit den Namen der Erweiterungen, die für die Verwendung in diesem Arbeitsbereich empfohlen werden.", + "searchPlaceholder": "Erweiterungen suchen in {0}", + "showInstalled": "Installierte Erweiterungen anzeigen", + "showRecommendedExtensions": "Steuert, ob Benachrichtigungen für Erweiterungsempfehlungen angezeigt werden.", + "vsx-extensions-contribution": { + "update-version-uninstall-error": "Fehler beim Entfernen der Erweiterung: {0}.", + "update-version-version-error": "Die Installation der Version {0} von {1} ist fehlgeschlagen." + } + }, + "webview": { + "goToReadme": "Zum README gehen", + "messageWarning": " Das Host-Muster des {0}-Endpunkts wurde in `{1}` geändert; die Änderung des Musters kann zu Sicherheitslücken führen. Siehe `{2}` für weitere Informationen." + }, + "workspace": { + "bothAreDirectories": "Beide Ressourcen sind Verzeichnisse.", + "clickToManageTrust": "Klicken Sie hier, um die Vertrauenseinstellungen zu verwalten.", + "compareWithEachOther": "Miteinander vergleichen", + "confirmDeletePermanently.description": "Das Löschen von \"{0}\" über den Papierkorb ist fehlgeschlagen. Möchten Sie stattdessen dauerhaft löschen?", + "confirmDeletePermanently.solution": "Sie können die Verwendung des Papierkorbs in den Einstellungen deaktivieren.", + "confirmDeletePermanently.title": "Fehler beim Löschen einer Datei", + "confirmMessage.delete": "Wollen Sie die folgenden Dateien wirklich löschen?", + "confirmMessage.dirtyMultiple": "Wollen Sie wirklich {0} Dateien mit ungespeicherten Änderungen löschen?", + "confirmMessage.dirtySingle": "Wollen Sie wirklich {0} mit ungespeicherten Änderungen löschen?", + "confirmMessage.uriMultiple": "Wollen Sie wirklich alle {0} ausgewählten Dateien löschen?", + "confirmMessage.uriSingle": "Wollen Sie wirklich {0} löschen?", + "directoriesCannotBeCompared": "Verzeichnisse können nicht verglichen werden. {0}", + "duplicate": "Duplizieren", + "failSaveAs": "Kann \"{0}\" für das aktuelle Widget nicht ausführen.", + "isDirectory": "{0}'' ist ein Verzeichnis.", + "manageTrustPlaceholder": "Vertrauensstatus für diesen Arbeitsbereich auswählen", + "newFilePlaceholder": "File Name", + "newFolderPlaceholder": "Folder Name", + "noErasure": "Hinweis: Es wird nichts von der Festplatte gelöscht.", + "notWorkspaceFile": "Keine gültige Arbeitsbereichsdatei: {0}", + "openRecentPlaceholder": "Geben Sie den Namen des Arbeitsbereichs ein, den Sie öffnen möchten", + "openRecentWorkspace": "Aktuellen Arbeitsbereich öffnen...", + "preserveWindow": "Aktivieren Sie das Öffnen von Arbeitsbereichen im aktuellen Fenster.", + "removeFolder": "Sind Sie sicher, dass Sie den folgenden Ordner aus dem Arbeitsbereich entfernen möchten?", + "removeFolders": "Sind Sie sicher, dass Sie die folgenden Ordner aus dem Arbeitsbereich entfernen möchten?", + "restrictedModeDescription": "Einige Funktionen sind deaktiviert, da dieser Arbeitsbereich nicht als vertrauenswürdig eingestuft ist.", + "restrictedModeNote": "*Bitte beachten Sie: Die Funktion „Workspace Trust“ befindet sich derzeit in Theia in der Entwicklung; noch sind nicht alle Funktionen in „Workspace Trust“ integriert.*", + "schema": { + "folders": { + "description": "Stammordner im Arbeitsbereich" + }, + "title": "Arbeitsbereichsdatei" + }, + "trashTitle": "Verschiebe {0} in den Papierkorb", + "trustEmptyWindow": "Steuert, ob dem leeren Arbeitsbereich standardmäßig vertraut wird oder nicht.", + "trustEnabled": "Steuert, ob das Vertrauen in Arbeitsbereiche aktiviert ist oder nicht. Wenn deaktiviert, wird allen Arbeitsbereichen vertraut.", + "trustTrustedFolders": "Liste der Ordner-URIs, die ohne Aufforderung als vertrauenswürdig eingestuft werden.", + "untitled-cleanup": "Es scheint viele unbenannte Arbeitsbereichsdateien zu geben. Bitte überprüfen Sie {0} und entfernen Sie alle unbenutzten Dateien.", + "variables": { + "cwd": { + "description": "Das aktuelle Arbeitsverzeichnis des Task-Runners beim Start" + }, + "file": { + "description": "Der Pfad der aktuell geöffneten Datei" + }, + "fileBasename": { + "description": "Der Basisname der aktuell geöffneten Datei" + }, + "fileBasenameNoExtension": { + "description": "Der Name der aktuell geöffneten Datei ohne Erweiterung" + }, + "fileDirname": { + "description": "Der Name des Verzeichnisses der aktuell geöffneten Datei" + }, + "fileExtname": { + "description": "Die Erweiterung der aktuell geöffneten Datei" + }, + "relativeFile": { + "description": "Der Pfad der aktuell geöffneten Datei relativ zum Stammverzeichnis des Arbeitsbereichs" + }, + "relativeFileDirname": { + "description": "Der Name des Verzeichnisses der aktuell geöffneten Datei relativ zu ${workspaceFolder}" + }, + "workspaceFolder": { + "description": "Der Pfad des Stammordners des Arbeitsbereichs" + }, + "workspaceFolderBasename": { + "description": "Der Name des Stammordners des Arbeitsbereichs" + }, + "workspaceRoot": { + "description": "Der Pfad des Stammordners des Arbeitsbereichs" + }, + "workspaceRootFolderName": { + "description": "Der Name des Stammordners des Arbeitsbereichs" + } + }, + "workspaceFolderAdded": "Ein Arbeitsbereich mit mehreren Wurzeln wurde erstellt. Möchten Sie Ihre Arbeitsbereichskonfiguration als Datei speichern?", + "workspaceFolderAddedTitle": "Ordner zum Arbeitsbereich hinzugefügt" + } + }, + "vsx.disabling": "Deaktivieren von", + "vsx.disabling.extensions": "Deaktivieren von {0}...", + "vsx.enabling": "Ermöglichung von", + "vsx.enabling.extension": "Ermöglichung von {0}..." +} diff --git a/packages/core/i18n/nls.es.json b/packages/core/i18n/nls.es.json new file mode 100644 index 0000000..8fa68e7 --- /dev/null +++ b/packages/core/i18n/nls.es.json @@ -0,0 +1,2097 @@ +{ + "ai-chat-ui.show-settings": "Mostrar ajustes de IA", + "ai-chat:summarize-session-as-task-for-coder": "Resumir la sesión como tarea para el codificador", + "ai.executePlanWithCoder": "Ejecutar el plan actual con el codificador", + "ai.updateTaskContext": "Actualizar el contexto de la tarea actual", + "aiConfiguration:open": "Abrir la vista Configuración AI", + "aiHistory:clear": "Historia de la IA: Borrar historial", + "aiHistory:open": "Abrir la vista Historial de IA", + "aiHistory:sortChronologically": "Historia de la IA: Ordenar cronológicamente", + "aiHistory:sortReverseChronologically": "Historia de la IA: Ordenar cronológicamente inverso", + "aiHistory:toggleCompact": "Historia de la IA: Alternar vista compacta", + "aiHistory:toggleHideNewlines": "Historia de AI: Dejar de interpretar las nuevas líneas", + "aiHistory:toggleRaw": "Historia de la IA: Alternar vista en bruto", + "aiHistory:toggleRenderNewlines": "Historia de AI: Interpretar nuevas líneas", + "debug.breakpoint.editCondition": "Editar condición...", + "debug.breakpoint.removeSelected": "Eliminar puntos de interrupción seleccionados", + "debug.breakpoint.toggleEnabled": "Alternar habilitar puntos de interrupción", + "notebook.cell.changeToCode": "Cambiar celda por código", + "notebook.cell.changeToMarkdown": "Cambiar Celda a Mardown", + "notebook.cell.insertMarkdownCellAbove": "Insertar celda Markdown arriba", + "notebook.cell.insertMarkdownCellBelow": "Insertar celda Markdown abajo", + "terminal:new:profile": "Crear un nuevo terminal integrado a partir de un perfil", + "terminal:profile:default": "Elija el perfil de terminal por defecto", + "theia": { + "ai": { + "agents": { + "completionNotification": { + "mdDescription": "Comportamiento de la notificación cuando este agente completa una tarea. Si no se establece, se utilizará la configuración de notificación global por defecto.\n - `os-notification`: Mostrar notificaciones del sistema operativo\n - `message`: Mostrar notificaciones en la barra de estado/área de mensajes\n - `blink`: Parpadear o resaltar la interfaz de usuario\n - `off`: Desactivar las notificaciones para este agente", + "title": "Notificación de finalización" + }, + "enable": { + "mdDescription": "Especifica si el agente debe estar habilitado (true) o deshabilitado (false).", + "title": "Habilitar agente" + }, + "languageModelRequirements": { + "identifier": { + "mdDescription": "El identificador del modelo lingüístico que se va a utilizar." + }, + "mdDescription": "Especifica los modelos lingüísticos utilizados para este agente.", + "purpose": { + "mdDescription": "La finalidad para la que se utiliza este modelo lingüístico.", + "title": "Propósito" + }, + "title": "Requisitos del modelo lingüístico" + }, + "mdDescription": "Configure los ajustes del agente, como activar o desactivar agentes específicos, configurar avisos y seleccionar LLM.", + "selectedVariants": { + "mdDescription": "Especifica las variantes de aviso seleccionadas actualmente para este agente.", + "title": "Variantes seleccionadas" + }, + "title": "Configuración del agente" + }, + "anthropic": { + "apiKey": { + "description": "Introduzca la clave API de su cuenta oficial de Anthropic. **Nota:** Al utilizar esta opción, la clave de la API de Anthropic se almacenará en texto claro en la máquina que ejecuta Theia. Utilice la variable de entorno `ANTHROPIC_API_KEY` para establecer la clave de forma segura." + }, + "models": { + "description": "Modelos antrópicos oficiales" + } + }, + "chat": { + "agent": { + "architect": "Arquitecto", + "coder": "programador", + "universal": "Universal" + }, + "applySuggestion": "Solicitar sugerencia", + "bypassModelRequirement": { + "description": "Omita la comprobación de requisitos del modelo de lenguaje. Active esta opción si utiliza agentes externos (por ejemplo, Claude Code) que no requieren modelos de lenguaje Theia." + }, + "changeSetDefaultTitle": "Cambios propuestos", + "changeSetFileDiffUriLabel": "Cambios en la IA: {0}", + "chatAgentsVariable": { + "description": "Devuelve la lista de agentes de chat disponibles en el sistema" + }, + "chatSessionNamingAgent": { + "description": "Agente de generación de nombres de sesión de chat", + "vars": { + "conversation": { + "description": "El contenido de la conversación de chat." + }, + "listOfSessionNames": { + "description": "La lista de nombres de sesión existentes." + } + } + }, + "chatSessionSummaryAgent": { + "description": "Agente para generar resúmenes de sesiones de chat." + }, + "confirmApplySuggestion": "El archivo {0} ha cambiado desde que se creó esta sugerencia. Está seguro de que desea aplicar el cambio?", + "confirmRevertSuggestion": "El archivo {0} ha cambiado desde que se creó esta sugerencia. Está seguro de que desea revertir el cambio?", + "couldNotFindMatchingLM": "No se ha encontrado un modelo de idioma que coincida. Compruebe su configuración.", + "couldNotFindReadyLMforAgent": "No se pudo encontrar un modelo de lenguaje listo para el agente {0}. Compruebe su configuración.", + "defaultAgent": { + "description": "Opcional: del Agente de Chat que se invocará, si no se menciona explícitamente ningún agente con @ en la consulta del usuario. Si no se configura ningún Agente predeterminado, se aplicarán los valores predeterminados de Theia." + }, + "imageContextVariable": { + "args": { + "data": { + "description": "Los datos de la imagen en base64." + }, + "mimeType": { + "description": "El mimetype de la imagen." + }, + "name": { + "description": "El nombre del archivo de imagen, si está disponible." + }, + "wsRelativePath": { + "description": "La ruta relativa al espacio de trabajo del archivo de imagen, si está disponible." + } + }, + "description": "Proporciona información contextual sobre una imagen", + "label": "Archivo de imágenes" + }, + "orchestrator": { + "description": "Este agente analiza la solicitud del usuario comparándola con la descripción de todos los agentes de chat disponibles y selecciona al agente más adecuado para responder a la solicitud (mediante IA). La solicitud del usuario se delegará directamente en el agente seleccionado sin más confirmación.", + "vars": { + "availableChatAgents": { + "description": "La lista de agentes de chat en los que el orquestador puede delegar, excluyendo los agentes especificados en la preferencia de lista de exclusión." + } + } + }, + "pinChatAgent": { + "description": "Habilite la vinculación de agentes para mantener activo automáticamente un agente de chat mencionado a lo largo de las solicitudes, reduciendo la necesidad de menciones repetidas." + }, + "revertSuggestion": "Revertir sugerencia", + "selectImageFile": "Seleccione un archivo de imagen", + "sessionStorage": { + "description": "Configure dónde almacenar las sesiones de chat.", + "globalPath": "Ruta global", + "pathNotUsedForScope": "No se utiliza con un ámbito de almacenamient{0}.", + "pathRequired": "La ruta no puede estar vacía.", + "pathSettings": "Configuración de ruta", + "resetToDefault": "Restablecer valores predeterminados", + "scope": { + "global": "Almacenar las sesiones de chat en la carpeta de configuración global.", + "workspace": "Almacenar las sesiones de chat en la carpeta del espacio de trabajo." + }, + "workspacePath": "Ruta del espacio de trabajo" + }, + "taskContextService": { + "summarizeProgressMessage": "Resume: {0}", + "updatingProgressMessage": "Actualización: {0}" + }, + "toolConfirmation": { + "confirm": { + "description": "Pedir confirmación antes de ejecutar las herramientas" + }, + "disabled": { + "description": "Desactivar la ejecución de herramientas" + }, + "yolo": { + "description": "Ejecutar herramientas automáticamente sin confirmación" + } + }, + "view": { + "label": "Chat AI" + } + }, + "chat-ui": { + "addContextVariable": "Añadir variable contextual", + "agent": "Agente", + "aiDisabled": "Las funciones de IA están desactivadas", + "applyAll": "Aplicar todo", + "applyAllTitle": "Aplicar todos los cambios pendientes", + "askQuestion": "Hacer una pregunta", + "attachToContext": "Adjuntar elementos al contexto", + "cancel": "Cancelar (Esc)", + "chat-view-tree-widget": { + "ai": "AI", + "aiFeatureHeader": "🚀 ¡Características de IA disponibles (versión alfa)!", + "featuresDisabled": "Actualmente, todas las funciones de IA están desactivadas.", + "generating": "Generando", + "howToEnable": "Cómo activar las funciones de IA:", + "noRenderer": "Error: No se ha encontrado ningún renderizador", + "scrollToBottom": "Saltar al último mensaje", + "waitingForInput": "A la espera de aportaciones", + "you": "Usted" + }, + "chatInput": { + "clearHistory": "Borrar historial de solicitudes de entrada", + "cycleMode": "Ciclo Modo Chat", + "nextPrompt": "Siguiente pregunta", + "previousPrompt": "Mensaje anterior" + }, + "chatInputAriaLabel": "Escriba su mensaje aquí", + "chatResponses": "Respuestas en el chat", + "code-part-renderer": { + "generatedCode": "Código generado" + }, + "collapseChangeSet": "Colapso del conjunto de cambios", + "command-part-renderer": { + "commandNotExecutable": "El comando tiene el id \"{0}\" pero no es ejecutable desde la ventana de Chat." + }, + "copyCodeBlock": "Copiar bloque de código", + "couldNotSendRequestToSession": "No se ha podido enviar la petición \"{0}\" a la sesión {1}", + "delegation-response-renderer": { + "prompt": { + "label": "Pronta delegación:" + }, + "response": { + "label": "Respuesta:" + }, + "starting": "Delegación inicial...", + "status": { + "canceled": "cancelado", + "error": "error", + "generating": "generando...", + "starting": "empezando..." + } + }, + "deleteChangeSet": "Borrar conjunto de cambios", + "editRequest": "Editar", + "edited": "editado", + "editedTooltipHint": "Esta variante de solicitud ha sido editada. Puede restablecerla en la vista Configuración de IA.", + "enterChatName": "Introduzca el nombre del chat", + "errorChatInvocation": "Se ha producido un error durante la invocación del servicio de chat.", + "expandChangeSet": "Expandir conjunto de cambios", + "failedToDeleteSession": "Error al eliminar la sesión de chat", + "failedToLoadChats": "Error al cargar las sesiones de chat", + "failedToRestoreSession": "Error al restaurar la sesión de chat", + "failedToRetry": "Fallo al reintentar el mensaje", + "focusInput": "Enfoque Chat Entrada", + "focusResponse": "Respuesta del chat de enfoque", + "noChatAgentsAvailable": "No hay agentes de chat disponibles.", + "openDiff": "Dif abierto", + "openOriginalFile": "Abrir archivo original", + "performThisTask": "Realiza esta tarea.", + "persistedSession": "Sesión persistente (haga clic para restaurar)", + "removeChat": "Eliminar Chat", + "renameChat": "Cambiar el nombre del chat", + "requestNotFoundForRetry": "Solicitud no encontrada para reintentar", + "responseFrom": "Respuesta de {0}", + "selectAgentQuickPickPlaceholder": "Seleccionar un agente para la nueva sesión", + "selectChat": "Seleccionar chat", + "selectContextVariableQuickPickPlaceholder": "Seleccione una variable contextual que se adjuntará al mensaje", + "selectTaskContextQuickPickItem": { + "currentlyOpen": "actualmente abierto" + }, + "selectTaskContextQuickPickPlaceholder": "Seleccione un contexto de tarea para adjuntar", + "selectVariableArguments": "Seleccionar argumentos variables", + "send": "Enviar (Intro)", + "sessionNotFoundForRetry": "Sesión no encontrada para reintentar", + "text-part-renderer": { + "cantDisplay": "¡No se puede mostrar la respuesta, por favor compruebe su ChatResponsePartRenderers!" + }, + "thinking-part-renderer": { + "thinking": "Pensar" + }, + "toolcall-part-renderer": { + "denied": "Ejecución denegada", + "finished": "Ran", + "rejected": "Ejecución cancelada" + }, + "toolconfirmation": { + "allow-options-dropdown-tooltip": "Más opciones de permisos", + "allow-session": "Permitir este Chat", + "allowed": "Ejecución de herramientas permitida", + "alwaysAllowConfirm": "Entiendo, habilitar la aprobación automática.", + "alwaysAllowTitle": "¿Habilitar la aprobación automática para «{0}»?", + "canceled": "Ejecución de la herramienta cancelada", + "denied": "Ejecución de herramienta denegada", + "deny-forever": "Negar siempre", + "deny-options-dropdown-tooltip": "Más opciones de denegación", + "deny-reason-placeholder": "Introduzca el motivo del rechazo...", + "deny-session": "Denegar para este Chat", + "deny-with-reason": "Negar con razón...", + "executionDenied": "Ejecución de la herramienta denegada", + "header": "Confirmar la ejecución de la herramienta" + }, + "unableToSummarizeCurrentSession": "No se puede resumir la sesión actual. Confirme que el agente de resumen no está desactivado.", + "unknown-part-renderer": { + "contentNotRestoreable": "Este contenido (tipo '{0}') no se ha podido restaurar completamente. Puede ser de una extensión que ya no está disponible." + }, + "unpinAgent": "Desvincular agente", + "variantTooltip": "Variante rápida: {0}", + "yourMessage": "Tu mensaje" + }, + "claude-code": { + "agentDescription": "Agente codificador de Anthropic", + "askBeforeEdit": "Pregunta antes de editar", + "changeSetTitle": "Cambios por código Claude", + "clearCommand": { + "description": "Crear una nueva sesión" + }, + "compactCommand": { + "description": "Conversación compacta con instrucciones de enfoque opcionales" + }, + "completedCount": "{0}/{1} completado", + "configCommand": { + "description": "Configuración del Código Claude Abierto" + }, + "currentDirectory": "directorio actual", + "differentAgentRequestWarning": "La solicitud de chat anterior fue gestionada por un agente diferente. Claude Code no ve esos otros mensajes.", + "directory": "Directorio", + "domain": "Dominio", + "editAutomatically": "Editar automáticamente", + "editNumber": "Editar {0}", + "editing": "Edición de", + "editsCount": "{0} edita", + "emptyTodoList": "No todos available", + "entireFile": "Archivo completo", + "excludingOnePattern": " (excepto 1 patrón)", + "excludingPatterns": " (excluidos los patrones de {0} )", + "executedCommand": "Ejecutado: {0}", + "failedToParseBashToolData": "Error al analizar los datos de la herramienta Bash", + "failedToParseEditToolData": "Error al analizar los datos de la herramienta de edición", + "failedToParseGlobToolData": "Error al analizar los datos de la herramienta Glob", + "failedToParseGrepToolData": "Error al analizar los datos de la herramienta Grep", + "failedToParseLSToolData": "Error al analizar los datos de la herramienta LS", + "failedToParseMultiEditToolData": "Error al analizar los datos de la herramienta MultiEdit", + "failedToParseReadToolData": "Error al analizar los datos de la herramienta de lectura", + "failedToParseTodoListData": "Error al analizar los datos de la lista de tareas", + "failedToParseWebFetchToolData": "Error al analizar los datos de la herramienta WebFetch", + "failedToParseWriteToolData": "Error al analizar los datos de la herramienta de escritura", + "fetching": "Buscar en", + "fileFilter": "Filtro de archivos", + "filePath": "Ruta del archivo", + "fileType": "Tipo de archivo", + "findMatchingFiles": "Buscar archivos que coincidan con el patrón glob \"{0}\" en el directorio actual", + "findMatchingFilesWithPath": "Buscar archivos que coincidan con el patrón glob \"{0}\" dentro de {1}", + "finding": "Encontrar", + "from": "En", + "globPattern": "patrón global", + "grepOptions": { + "caseInsensitive": "distingue entre mayúsculas y minúsculas", + "glob": "globo: {0}", + "headLimit": "límite: {0}", + "lineNumbers": "números de línea", + "linesAfter": "+{0} después", + "linesBefore": "+{0} antes", + "linesContext": "±{0} contexto", + "multiLine": "multilínea", + "type": "tipo: {0}" + }, + "grepOutputModes": { + "content": "contenido", + "count": "cuente", + "filesWithMatches": "archivos con coincidencias" + }, + "ignoredPatterns": "Patrones ignorados", + "ignoringPatterns": "Ignorar los patrones de {0} ", + "initCommand": { + "description": "Inicializar el proyecto con la guía CLAUDE.md" + }, + "itemCount": "{0} artículos", + "lineLimit": "Límite de línea", + "lines": "Líneas", + "listDirectoryContents": "Listar el contenido del directorio", + "listing": "Listado", + "memoryCommand": { + "description": "Editar el archivo de memoria CLAUDE.md" + }, + "multiEditing": "Edición múltiple", + "oneEdit": "1 edición", + "oneItem": "1 artículo", + "oneOption": "1 opción", + "openDirectoryTooltip": "Haga clic para abrir el directorio", + "openFileTooltip": "Haga clic para abrir el archivo en el editor", + "optionsCount": "{0} opciones", + "partial": "Parcial", + "pattern": "Patrón", + "plan": "Modo plan", + "project": "proyecto", + "projectRoot": "raíz del proyecto", + "readMode": "Modo lectura", + "reading": "Lectura", + "replaceAllCount": "{0} replace-all", + "replaceAllOccurrences": "Sustituir todas las apariciones", + "resumeCommand": { + "description": "Reanudar una sesión" + }, + "reviewCommand": { + "description": "Solicitar revisión del código" + }, + "searchPath": "Ruta de búsqueda", + "searching": "Buscar en", + "startingLine": "Línea de salida", + "timeout": "Timeout", + "timeoutInMs": "Timeout: {0}ms", + "to": "A", + "todoList": "Lista de tareas", + "todoPriority": { + "high": "alta", + "low": "bajo", + "medium": "medio" + }, + "toolApprovalRequest": "Claude Code quiere utilizar la herramienta \"{0}\". ¿Quiere permitirlo?", + "totalEdits": "Total ediciones", + "webFetch": "Búsqueda web", + "writing": "Escribir" + }, + "code-completion": { + "progressText": "Cálculo de la finalización del código AI..." + }, + "codex": { + "agentDescription": "Asistente de programación de OpenAI con tecnología Codex", + "completedCount": "{0}/{1} completado", + "exitCode": "Código de salida: {0}", + "fileChangeFailed": "Codex no aplicó los cambios para: {0}", + "fileChangeFailedGeneric": "Codex no ha podido aplicar los cambios en el archivo.", + "itemCount": "{0} artículos", + "noItems": "Sin artículos", + "oneItem": "1 artículo", + "running": "Corriendo...", + "searched": "Buscado", + "searching": "Buscando", + "todoList": "Lista completa", + "webSearch": "Búsqueda web" + }, + "completion": { + "agent": { + "description": "Este agente proporciona completado de código en línea en el editor de código en el IDE Theia.", + "vars": { + "file": { + "description": "El URI del archivo que se está editando" + }, + "language": { + "description": "El languageId del archivo que se está editando" + }, + "prefix": { + "description": "El código anterior a la posición actual del cursor" + }, + "suffix": { + "description": "El código después de la posición actual del cursor" + } + } + }, + "automaticEnable": { + "description": "Activar automáticamente las finalizaciones de IA en línea dentro de cualquier editor (Mónaco) durante la edición. \n Como alternativa, puede activar manualmente el código mediante el comando \"Activar sugerencia en línea\" o el atajo de teclado predeterminado \"Ctrl+Alt+Espacio\"." + }, + "cacheCapacity": { + "description": "Número máximo de finalizaciones de código a almacenar en la caché. Un número mayor puede mejorar el rendimiento pero consumirá más memoria. El valor mínimo es 10, el rango recomendado está entre 50-200.", + "title": "Capacidad de la caché de finalización de código" + }, + "debounceDelay": { + "description": "Controla el retardo en milisegundos antes de activar la finalización automática después de que se hayan detectado cambios en el editor. Requiere que esté activada la \"Finalización automática de código\". Introduzca 0 para desactivar el retardo.", + "title": "Retardo de rebote" + }, + "excludedFileExts": { + "description": "Especifique las extensiones de archivo (por ejemplo, .md, .txt) en las que deben desactivarse las finalizaciones AI.", + "title": "Extensiones de archivo excluidas" + }, + "fileVariable": { + "description": "El URI del archivo que se está editando. Sólo disponible en el contexto de finalización de código." + }, + "languageVariable": { + "description": "El languageId del archivo que se está editando. Sólo disponible en el contexto de finalización de código." + }, + "maxContextLines": { + "description": "El número máximo de líneas utilizadas como contexto, distribuidas entre las líneas anteriores y posteriores a la posición del cursor (prefijo y sufijo). Establézcalo a -1 para utilizar el archivo completo como contexto sin límite de líneas y a 0 para utilizar sólo la línea actual.", + "title": "Líneas de contexto máximas" + }, + "prefixVariable": { + "description": "El código anterior a la posición actual del cursor. Sólo disponible en el contexto de finalización de código." + }, + "stripBackticks": { + "description": "Elimina los signos de cierre del código devuelto por algunos LLM. Si se detecta un punto y aparte, también se eliminará todo el contenido posterior. Este ajuste ayuda a garantizar que se devuelve un código sencillo cuando los modelos de lenguaje utilizan un formato similar al de las marcas.", + "title": "Eliminar marcas de finalización en línea" + }, + "suffixVariable": { + "description": "El código después de la posición actual del cursor. Sólo disponible en el contexto de finalización de código." + } + }, + "configuration": { + "selectItem": "Seleccione un elemento." + }, + "copilot": { + "auth": { + "aiConfiguration": "Configuración de IA", + "authorize": "He autorizado", + "copied": "¡Copiado!", + "copyCode": "Copiar código", + "expired": "La autorización ha caducado o ha sido denegada. Inténtalo de nuevo.", + "hint": "Después de introducir el código y autorizar, haz clic en «He autorizado» a continuación.", + "initiating": "Iniciando autenticación...", + "instructions": "Para autorizar a Theia a utilizar GitHub Copilot, visita la siguiente URL e introduce el código:", + "openGitHub": "Abrir GitHub", + "success": "¡Iniciada sesión correctamente en GitHub Copilot!", + "successHint": "Si tu cuenta de GitHub tiene acceso a Copilot, ahora puedes configurar los modelos de lenguaje de Copilot en el ", + "title": "Iniciar sesión en GitHub Copilot", + "tos": "Al iniciar sesión, aceptas las ", + "tosLink": "Condiciones del servicio de GitHub", + "verifying": "Verificando autorización..." + }, + "category": "Copiloto", + "commands": { + "signIn": "Iniciar sesión en GitHub Copilot", + "signOut": "Cerrar sesión en GitHub Copilot" + }, + "enterpriseUrl": { + "mdDescription": "Dominio de GitHub Enterprise para la API de Copilot (por ejemplo, `github.mycompany.com`). Déjelo vacío para GitHub.com." + }, + "models": { + "description": "Modelos de GitHub Copilot que se pueden utilizar. Los modelos disponibles dependen de tu suscripción a Copilot." + }, + "statusBar": { + "signedIn": "Iniciado sesión en GitHub Copilot como {0}. Haga clic para cerrar sesión.", + "signedOut": "No has iniciado sesión en GitHub Copilot. Haz clic para iniciar sesión." + } + }, + "core": { + "agentConfiguration": { + "actions": "Acciones", + "addCustomAgent": "Añadir agente personalizado", + "enableAgent": "Habilitar agente", + "label": "Agentes", + "llmRequirements": "Requisitos para el Máster en Derecho (LLM)", + "notUsedInPrompt": "No se utiliza en el aviso", + "promptTemplates": "Plantillas", + "selectAgentMessage": "Seleccione primero un agente", + "templateName": "Plantilla", + "undeclared": "Sin declarar", + "usedAgentSpecificVariables": "Variables específicas del agente utilizadas", + "usedFunctions": "Funciones utilizadas", + "usedGlobalVariables": "Variables globales utilizadas", + "variant": "Variant" + }, + "agentsVariable": { + "description": "Devuelve la lista de agentes disponibles en el sistema" + }, + "aiConfiguration": { + "label": "✨ Configuración AI [Alfa]" + }, + "blinkTitle": { + "agentCompleted": "Theia - Agente finalizado", + "namedAgentCompleted": "Theia - Agente \"{0}\" Finalizado" + }, + "changeSetSummaryVariable": { + "description": "Proporciona un resumen de los archivos de un conjunto de cambios y su contenido." + }, + "contextDetailsVariable": { + "description": "Proporciona valores de texto completo y descripciones para todos los elementos de contexto." + }, + "contextSummaryVariable": { + "description": "Describe los archivos en el contexto de una sesión determinada." + }, + "customAgentTemplate": { + "description": "Este es un ejemplo de agente. Adapte las propiedades a sus necesidades." + }, + "defaultModelAliases": { + "code": { + "description": "Optimizado para tareas de comprensión y generación de código." + }, + "code-completion": { + "description": "Más adecuado para situaciones de autocompletado de código." + }, + "summarize": { + "description": "Modelos priorizados para resumir y condensar el contenido." + }, + "universal": { + "description": "Bien equilibrado tanto para el código como para el uso general del lenguaje." + } + }, + "defaultNotification": { + "mdDescription": "El método de notificación por defecto utilizado cuando un agente de IA completa una tarea. Los agentes individuales pueden anular esta configuración.\n - `os-notification`: Mostrar notificaciones del sistema operativo\n - Mensaje Mostrar notificaciones en la barra de estado/área de mensajes.\n - `blink`: Parpadear o resaltar la interfaz de usuario\n - `off`: Desactivar todas las notificaciones", + "title": "Tipo de notificación por defecto" + }, + "discard": { + "label": "Descartar Plantilla AI Prompt" + }, + "discardCustomPrompt": { + "tooltip": "Descartar personalizaciones" + }, + "fileVariable": { + "description": "Resuelve el contenido de un fichero", + "uri": { + "description": "El URI del archivo solicitado." + } + }, + "languageModelRenderer": { + "alias": "[alias] {0}", + "languageModel": "Modelo lingüístico", + "purpose": "Propósito" + }, + "maxRetries": { + "mdDescription": "El número máximo de reintentos cuando falla una petición a un proveedor de AI. Un valor de 0 significa que no hay reintentos.", + "title": "Reintentos máximos" + }, + "modelAliasesConfiguration": { + "agents": "Agentes que utilizan este alias", + "defaultList": "[Lista por defecto]", + "evaluatesTo": "Evalúa a", + "label": "Model Aliases", + "modelNotReadyTooltip": "No está listo", + "modelReadyTooltip": "Listo", + "noAgents": "Ningún agente utiliza este alias.", + "noModelReadyTooltip": "No model ready", + "noResolvedModel": "No hay ningún modelo listo para este alias.", + "priorityList": "Lista de prioridades", + "selectAlias": "Seleccione un alias de modelo.", + "selectedModelId": "Modelo seleccionado", + "unavailableModel": "El modelo seleccionado ya no está disponible" + }, + "noVariableFoundForOpenRequest": "No se ha encontrado ninguna variable para la solicitud abierta.", + "openEditorsShortVariable": { + "description": "Referencia breve a todos los archivos abiertos actualmente (rutas relativas, separadas por comas)" + }, + "openEditorsVariable": { + "description": "Una lista separada por comas de todos los archivos abiertos actualmente, relativos a la raíz del espacio de trabajo." + }, + "preference": { + "languageModelAliases": { + "description": "Configure los modelos para cada alias de modelo de idioma en la [Vista de configuración de AI]({0}). Alternativamente, puede establecer la configuración manualmente en el settings.json: \n```\n\"default/code\": {\n \"selectedModel\": \"anthropic/claude-opus-4-20250514\"\n}\n```", + "selectedModel": "El modelo seleccionado por el usuario para este alias.", + "title": "Alias de modelos lingüísticos" + } + }, + "prefs": { + "title": "✨ Características de la IA [Alfa]" + }, + "promptFragmentsConfiguration": { + "activeCustomizationTitle": "Personalización activa", + "createCustomizationTitle": "Crear personalización", + "customization": "personalización", + "customizationLabel": "Personalización", + "defaultVariantTitle": "Variante por defecto", + "deleteCustomizationTitle": "Borrar personalización", + "editTemplateTitle": "Editar plantilla", + "headerTitle": "Fragmentos de Prompt", + "label": "Fragmentos de Prompt", + "noFragmentsAvailable": "No hay fragmentos disponibles.", + "otherPromptFragmentsHeader": "Otros fragmentos de Prompt", + "promptTemplateText": "Texto de la plantilla", + "promptVariantsHeader": "Conjuntos de variantes", + "removeCustomizationDialogMsg": "¿Está seguro de que desea eliminar la personalización {0} para el fragmento de aviso \"{1}\"?", + "removeCustomizationDialogTitle": "Eliminar personalización", + "removeCustomizationWithDescDialogMsg": "¿Está seguro de que desea eliminar la personalización {0} para el fragmento de aviso \"{1}\" ({2})?", + "resetAllButton": "Restablecer todo", + "resetAllCustomizationsDialogMsg": "¿Está seguro de que desea restablecer todos los fragmentos de aviso a sus versiones incorporadas? Esto eliminará todas las personalizaciones.", + "resetAllCustomizationsDialogTitle": "Restablecer todas las personalizaciones", + "resetAllCustomizationsTitle": "Restablecer todas las personalizaciones", + "resetAllPromptFragments": "Restablecer todos los fragmentos de aviso", + "resetToBuiltInDialogMsg": "¿Está seguro de que desea restablecer el fragmento de aviso \"{0}\" a su versión incorporada? Esto eliminará todas las personalizaciones.", + "resetToBuiltInDialogTitle": "Restablecer a incorporado", + "resetToBuiltInTitle": "Restablecer a este built-in", + "resetToCustomizationDialogMsg": "¿Está seguro de que desea restablecer el fragmento de aviso \"{0}\" para utilizar la personalización {1}? Esto eliminará todas las personalizaciones de mayor prioridad.", + "resetToCustomizationDialogTitle": "Volver a Personalización", + "resetToCustomizationTitle": "Volver a esta personalización", + "selectedVariantLabel": "Selección", + "selectedVariantTitle": "Variante seleccionada", + "usedByAgentTitle": "Utilizado por el agente: {0}", + "variantSetError": "La variante seleccionada no existe y no se ha podido encontrar ninguna por defecto. Por favor, compruebe su configuración.", + "variantSetWarning": "La variante seleccionada no existe. En su lugar se está utilizando la variante por defecto.", + "variantsOfSystemPrompt": "Variantes de este conjunto de variantes:" + }, + "promptTemplates": { + "description": "Carpeta para almacenar plantillas de avisos personalizadas. Si no se personalizan, se utiliza el directorio de configuración del usuario. Por favor, considere el uso de una carpeta, que está bajo control de versiones para gestionar sus variantes de plantillas de aviso.", + "openLabel": "Seleccionar carpeta" + }, + "promptVariable": { + "argDescription": "El identificador de la plantilla que debe resolverse", + "completions": { + "detail": { + "builtin": "Fragmento de aviso integrado", + "custom": "Fragmento de aviso personalizado" + } + }, + "description": "Resuelve las plantillas de avisos a través del servicio de avisos" + }, + "prompts": { + "category": "Plantillas Theia AI Prompt" + }, + "requestSettings": { + "clientSettings": { + "description": "Configuración del cliente para gestionar los mensajes que se envían de vuelta al llm.", + "keepThinking": { + "description": "Si se establece en false, toda la salida de pensamiento se filtrará antes de enviar la siguiente solicitud de usuario en una conversación multigiro." + }, + "keepToolCalls": { + "description": "Si se establece en false, todas las solicitudes y respuestas de herramientas se filtrarán antes de enviar la siguiente solicitud de usuario en una conversación multivuelta." + } + }, + "mdDescription": "Permite especificar configuraciones de solicitud personalizadas para múltiples modelos.\n Cada objeto representa la configuración para un modelo específico. El campo `modelId` especifica el ID del modelo, `requestSettings` define la configuración específica del modelo.\n El campo `providerId` es opcional y permite aplicar la configuración a un proveedor específico. Si no se define, la configuración se aplicará a todos los proveedores.\n Ejemplo de providerIds: huggingface, openai, ollama, llamafile.\n Consulte [nuestra documentación](https://theia-ide.org/docs/user_ai/#custom-request-settings) para obtener más información.", + "modelSpecificSettings": { + "description": "Ajustes para el ID de modelo específico." + }, + "scope": { + "agentId": { + "description": "El id de agente (opcional) al que aplicar la configuración." + }, + "modelId": { + "description": "El identificador del modelo (opcional)" + }, + "providerId": { + "description": "El identificador (opcional) del proveedor al que se aplicarán los ajustes." + } + }, + "title": "Configuración personalizada de solicitudes" + }, + "skillsVariable": { + "description": "Devuelve la lista de habilidades disponibles que pueden utilizar los agentes de IA." + }, + "taskContextSummary": { + "description": "Resuelve todos los elementos de contexto de tarea presentes en el contexto de sesión." + }, + "templateSettings": { + "edited": "editado", + "unavailableVariant": "La variante seleccionada ya no está disponible" + }, + "todayVariable": { + "description": "Hace algo para hoy", + "format": { + "description": "El formato de la fecha" + } + }, + "unableToDisplayVariableValue": "No se puede mostrar el valor de la variable.", + "unableToResolveVariable": "No se puede resolver la variable.", + "variable-contribution": { + "builtInVariable": "Theia Variable incorporada", + "currentAbsoluteFilePath": "La ruta absoluta del archivo abierto actualmente. Tenga en cuenta que la mayoría de los agentes esperan una ruta de archivo relativa (relativa al espacio de trabajo actual).", + "currentFileContent": "El contenido plano del archivo abierto actualmente. Esto excluye la información de dónde proviene el contenido. Tenga en cuenta que la mayoría de los agentes funcionarán mejor con una ruta de archivo relativa (relativa al espacio de trabajo actual).", + "currentRelativeDirPath": "La ruta relativa del directorio que contiene el archivo abierto actualmente.", + "currentRelativeFilePath": "La ruta relativa del archivo abierto actualmente.", + "currentSelectedText": "El texto sin formato seleccionado actualmente en el archivo abierto. Esto excluye la información de donde viene el contenido. Tenga en cuenta que la mayoría de los agentes funcionarán mejor con una ruta de archivo relativa (relativa al espacio de trabajo actual).", + "dotRelativePath": "Referencia corta a la ruta relativa del archivo abierto actualmente ('currentRelativeFilePath')." + } + }, + "editor": { + "editorContextVariable": { + "description": "Resuelve la información de contexto específica del editor", + "label": "EditorContext" + }, + "explainWithAI": { + "prompt": "Explique este error", + "title": "Explicar con IA" + }, + "fixWithAI": { + "prompt": "Ayuda para solucionar este error" + } + }, + "google": { + "apiKey": { + "description": "Introduzca una clave API de su cuenta oficial de Google AI (Gemini). **Tenga en cuenta:** Al utilizar esta preferencia, la clave API de GOOGLE AI se almacenará en texto claro en la máquina que ejecuta Theia. Utiliza la variable de entorno `GOOGLE_API_KEY` para establecer la clave de forma segura." + }, + "maxRetriesOnErrors": { + "description": "Número máximo de reintentos en caso de error. Si es menor que 1, la lógica de reintentos está desactivada." + }, + "models": { + "description": "Modelos oficiales de Google Gemini" + }, + "retryDelayOnOtherErrors": { + "description": "Retraso en segundos entre reintentos en caso de otros errores (en ocasiones la GenAI de Google informa de errores como sintaxis JSON incompleta devuelta desde el modelo o 500 Internal Server Error). Establecerlo a -1 previene reintentos en estos casos. De lo contrario, el reintento se produce inmediatamente (si se establece en 0) o después de este retraso en segundos (si se establece en un número positivo)." + }, + "retryDelayOnRateLimitError": { + "description": "Retraso en segundos entre reintentos en caso de errores de límite de velocidad. Véase https://ai.google.dev/gemini-api/docs/rate-limits" + } + }, + "history": { + "clear": { + "tooltip": "Borrar el historial de todos los agentes" + }, + "exchange-card": { + "agentId": "Agente", + "timestamp": "Comenzó" + }, + "open-history-tooltip": "Abrir la historia de la IA...", + "request-card": { + "agent": "Agente", + "model": "Modelo", + "request": "Solicitar", + "response": "Respuesta", + "timestamp": "Marca de tiempo", + "title": "Solicitar" + }, + "sortChronologically": { + "tooltip": "Ordenar cronológicamente" + }, + "sortReverseChronologically": { + "tooltip": "Ordenar cronológicamente inverso" + }, + "toggleCompact": { + "tooltip": "Mostrar vista compacta" + }, + "toggleHideNewlines": { + "tooltip": "Dejar de interpretar las nuevas líneas" + }, + "toggleRaw": { + "tooltip": "Mostrar vista en bruto" + }, + "toggleRenderNewlines": { + "tooltip": "Interpretar las nuevas líneas" + }, + "view": { + "label": "✨ Historia del agente de IA [Alfa]", + "noAgent": "No hay agente disponible.", + "noAgentSelected": "No hay agente seleccionado.", + "noHistoryForAgent": "No hay historial disponible para el agente seleccionado '{0}'" + } + }, + "huggingFace": { + "apiKey": { + "mdDescription": "Introduzca una clave API para su cuenta de Hugging Face. **Tenga en cuenta:** Al utilizar esta preferencia, la clave API de Hugging Face se almacenará en texto claro en la máquina que ejecuta Theia. Utilice la variable de entorno `HUGGINGFACE_API_KEY` para establecer la clave de forma segura." + }, + "models": { + "mdDescription": "Modelos de Hugging Face que se pueden utilizar. **Nota:** Actualmente solo se admiten los modelos que admiten la API de finalización de chat (modelos ajustados a instrucciones como «*-Instruct»). Algunos modelos pueden requerir la aceptación de los términos de la licencia en el sitio web de Hugging Face." + } + }, + "ide": { + "agent-description": "Configure los ajustes del agente de IA, incluida la habilitación, la selección de LLM, la personalización de la plantilla de avisos y la creación de agentes personalizados en la [Vista de configuración de IA]({0}).", + "agentConfiguration": { + "customAgentLocationQuickPick": { + "createNewFile": "Crear un nuevo archivo", + "openExistingFile": "Abrir el archivo existente", + "placeholder": "Elija dónde crear o abrir un archivo de agentes personalizados", + "title": "Seleccione la ubicación del archivo de agentes personalizados" + }, + "noDescription": "No hay descripción disponible." + }, + "app-tester": { + "errorCheckingDevToolsServerStatus": "Error al comprobar el estado del servidor DevTools MCP: {0}", + "errorCheckingPlaywrightServerStatus": "Error al comprobar el estado del servidor MCP de Playwright: {0}", + "startChromeDevToolsMcpServers": { + "canceled": "Configure el servidor MCP de Chrome DevTools.", + "error": "No se pudo iniciar el servidor MCP de Chrome DevTools: {0}", + "progress": "Iniciando el servidor MCP de Chrome DevTools.", + "question": "El servidor MCP de Chrome DevTools no se está ejecutando. ¿Desea iniciarlo ahora? Esto puede instalar el servidor MCP de Chrome DevTools." + }, + "startMcpServers": { + "no": "No, cancelar", + "yes": "Sí, inicia los servidores." + }, + "startPlaywrightServers": { + "canceled": "Configure los servidores MCP.", + "error": "Error al iniciar el servidor MCP de Playwright: {0}", + "progress": "Inicio de los servidores MCP de Playwright.", + "question": "Los servidores MCP de Playwright no se están ejecutando. ¿Desea iniciarlos ahora? Esto puede instalar los servidores MCP de Playwright." + } + }, + "architectAgent": { + "mode": { + "default": "Modo predeterminado", + "plan": "Plan Modo", + "simple": "Modo simple" + }, + "suggestion": { + "executePlanWithCoder": "Ejecuta «{0}» con Coder.", + "summarizeSessionAsTaskForCoder": "Resumir esta sesión como tarea para Coder", + "updateTaskContext": "Actualizar el contexto de la tarea actual" + } + }, + "bypassHint": "Algunos agentes como Claude Code no requieren los modelos lingüísticos de Theia.", + "chatDisabledMessage": { + "featuresTitle": "Vistas y funciones compatibles actualmente:" + }, + "coderAgent": { + "mode": { + "agentNext": "Modo agente (Siguiente)", + "edit": "Modo de edición" + }, + "suggestion": { + "fixProblems": { + "content": "[Solucionar problemas]({0}) en el archivo actual.", + "prompt": "por favor mire {1} y solucione cualquier problema." + }, + "startNewChat": "Mantén los chats breves y centrados. [Inicia un nuevo chat]({0}) para una nueva tarea o [inicia un nuevo chat con un resumen de este]({1})." + } + }, + "commandAgent": { + "commandCallback": { + "confirmAction": "Entendido.", + "label": "Mando de IA" + }, + "response": { + "customHandler": "Intenta ejecutar esto:", + "noCommand": "Lo siento, no puedo encontrar tal comando", + "theiaCommand": "He encontrado este comando que puede ayudarte:" + }, + "vars": { + "commandIds": { + "description": "La lista de comandos disponibles en Theia." + } + } + }, + "configureAgent": { + "header": "Configurar un agente predeterminado" + }, + "continueAnyway": "Continuar de todos modos", + "createSkillAgent": { + "mode": { + "edit": "Modo predeterminado" + } + }, + "enableAI": { + "mdDescription": "❗ Este ajuste te permite acceder a las últimas capacidades de IA (versión Beta). \n Tenga en cuenta que estas funciones se encuentran en fase beta, lo que significa que pueden sufrir cambios y que se seguirán mejorando. Es importante ser consciente de que estas funciones pueden generar solicitudes continuas a los modelos lingüísticos (LLM) a los que usted proporciona acceso. Esto podría generar costes que deberá supervisar de cerca. Al activar esta opción, usted acepta estos riesgos. \n **Nota Los ajustes de esta sección sólo surtirán efecto\n una vez activada la configuración de la función principal. Una vez activada la función, deberá configurar al menos un proveedor LLM de los que se indican a continuación. Consulte también [la documentación](https://theia-ide.org/docs/user_ai/)**." + }, + "github": { + "configureGitHubServer": { + "canceled": "Se ha cancelado la configuración del servidor de GitHub. Por favor, configura el servidor MCP de GitHub para utilizar este agente.", + "no": "No, cancelar", + "yes": "Sí, configurar servidor GitHub" + }, + "errorCheckingGitHubServerStatus": "Error al comprobar el estado del servidor MCP de GitHub: {0}", + "startGitHubServer": { + "canceled": "Inicia el servidor MCP de GitHub para utilizar este agente.", + "error": "Error al iniciar el servidor MCP de GitHub: {0}", + "no": "No, cancelar", + "progress": "Iniciando el servidor MCP de GitHub.", + "question": "El servidor MCP de GitHub está configurado pero no se está ejecutando. ¿Desea iniciarlo ahora?", + "yes": "Sí, inicie el servidor" + } + }, + "githubRepoName": { + "description": "El nombre del repositorio GitHub actual (por ejemplo, \"eclipse-theia/theia\")" + }, + "model-selection-description": "Elija qué Modelos de Lenguaje Grande (LLMs) utiliza cada agente de IA en la [Vista de Configuración de IA]({0}).", + "moreAgentsAvailable": { + "header": "Hay más agentes disponibles." + }, + "noRecommendedAgents": "No hay agentes recomendados disponibles.", + "openSettings": "Abrir configuración de IA", + "or": "o", + "orchestrator": { + "error": { + "noAgents": "No hay ningún agente de chat disponible para atender la solicitud. Compruebe en la configuración si hay alguno habilitado." + }, + "progressMessage": "Determinar el agente más adecuado", + "response": { + "delegatingToAgent": "Delegar en `@{0}`" + } + }, + "prompt-template-description": "Seleccione las variantes de aviso y personalice las plantillas de aviso para los agentes AI en la [Vista de configuración AI]({0}).", + "recommendedAgents": "Agentes recomendados:", + "skillsConfiguration": { + "label": "Habilidades", + "location": { + "label": "Ubicación" + } + }, + "toolsConfiguration": { + "confirmAlwaysAllow": { + "confirm": "Entiendo, habilitar la aprobación automática.", + "title": "¿Habilitar la aprobación automática para «{0}»?" + }, + "confirmationMode": { + "label": "Modo de confirmación" + }, + "default": { + "label": "Modo de confirmación de herramienta por defecto:" + }, + "resetAll": "Restablecer todo", + "resetAllConfirmDialog": { + "msg": "¿Estás seguro de que quieres restablecer todos los modos de confirmación de herramientas a los predeterminados? Esto eliminará todos los ajustes personalizados.", + "title": "Restablecer todos los modos de confirmación de herramientas" + }, + "resetAllTooltip": "Restablecer todas las herramientas por defecto", + "toolOptions": { + "confirm": { + "label": "Confirme" + } + } + }, + "variableConfiguration": { + "selectVariable": "Seleccione una variable.", + "usedByAgents": "Utilizado por agentes", + "variableArgs": "Argumentos variables" + } + }, + "llamaFile": { + "prefs": { + "mdDescription": "Este ajuste le permite configurar y gestionar modelos LlamaFile en Theia IDE. \n Cada entrada requiere un `nombre` fácil de usar, el archivo `uri` que apunta a su LlamaFile, y el `puerto` en el que se ejecutará. \n Para iniciar un LlamaFile, utilice el comando \"Start LlamaFile\", que le permite seleccionar el modelo deseado. \n Si edita una entrada (por ejemplo, cambiando el puerto), cualquier instancia en ejecución se detendrá y tendrá que iniciarla manualmente de nuevo. \n [Más información sobre la configuración y gestión de LlamaFiles en la documentación de Theia IDE](https://theia-ide.org/docs/user_ai/#llamafile-models).", + "name": { + "description": "El nombre del modelo a utilizar para este Llamafile." + }, + "port": { + "description": "El puerto a utilizar para iniciar el servidor." + }, + "title": "✨ AI LlamaFile", + "uri": { + "description": "La uri del archivo Llamafile." + } + }, + "start": "Iniciar Llamafile", + "stop": "Stop Llamafile" + }, + "llamafile": { + "error": { + "noConfigured": "No Llamafiles configured.", + "noRunning": "No hay Llamafiles funcionando.", + "startFailed": "Algo ha ido mal durante el inicio de llamafile: {0}.\nPara más información, consulte la consola.", + "stopFailed": "Algo ha ido mal durante la parada de llamafile: {0}.\nPara más información, consulte la consola." + } + }, + "mcp": { + "error": { + "allServersRunning": "Todos los servidores MCP ya están en funcionamiento.", + "noRunningServers": "No hay servidores MCP en funcionamiento.", + "noServersConfigured": "No hay servidores MCP configurados.", + "startFailed": "Se ha producido un error al iniciar el servidor MCP." + }, + "info": { + "serverStarted": "Servidor MCP \"{0}\" iniciado con éxito. Herramientas registradas: {1}" + }, + "servers": { + "args": { + "mdDescription": "Una matriz de argumentos para pasar al comando.", + "title": "Argumentos para el comando" + }, + "autostart": { + "mdDescription": "Iniciar automáticamente este servidor cuando se inicie el frontend. Los servidores recién añadidos no se inician automáticamente de forma inmediata, sino cuando se reinician.", + "title": "Arranque automático" + }, + "command": { + "mdDescription": "El comando utilizado para iniciar el servidor MCP, por ejemplo, \"uvx\" o \"npx\".", + "title": "Comando para ejecutar el servidor MCP" + }, + "env": { + "mdDescription": "Variables de entorno opcionales para el servidor, como una clave API.", + "title": "Variables de entorno" + }, + "headers": { + "mdDescription": "Cabeceras adicionales opcionales incluidas en cada solicitud al servidor.", + "title": "Cabeceras" + }, + "mdDescription": "Configura servidores MCP con comandos, argumentos, opcionalmente variables de entorno y autoarranque (true por defecto). Cada servidor se identifica mediante una clave única, como \"brave-search\" o \"filesystem\". Para iniciar un servidor, utilice el comando \"MCP: Iniciar servidor MCP\", que permite seleccionar el servidor deseado. Para detener un servidor, utilice el comando \"MCP: Detener servidor MCP\". Tenga en cuenta que el arranque automático sólo surtirá efecto tras un reinicio, por lo que deberá arrancar un servidor manualmente por primera vez.\nEjemplo de configuración:\n```{\n \"brave-search\": {\n \"comando\": \"npx\",\n \"args\": [\n \"-y\",\n \"@modelcontextprotocol/server-brave-search\"\n ],\n \"env\": {\n \"BRAVE_API_KEY\": \"YOUR_API_KEY\"\n },\n },\n \"filesystem\": {\n \"command\": \"npx\",\n \"args\": [\"-y\", \"@modelcontextprotocol/server-filesystem\", \"/Users/YOUR_USERNAME/Desktop\"],\n \"env\": {\n \"CUSTOM_ENV_VAR\": \"custom-value\"\n },\n \"autostart\": false\n }\n}\n```", + "serverAuthToken": { + "mdDescription": "El token de autenticación para el servidor, si es necesario. Se utiliza para autenticarse con el servidor remoto.", + "title": "Token de autenticación" + }, + "serverAuthTokenHeader": { + "mdDescription": "El nombre de la cabecera que se utilizará para el token de autenticación del servidor. Si no se proporciona, se utilizará \"Authorization\" con \"Bearer\".", + "title": "Nombre del encabezado de autenticación" + }, + "serverUrl": { + "mdDescription": "La URL del servidor MCP remoto. Si se proporciona, el servidor se conectará a esta URL en lugar de iniciar un proceso local.", + "title": "URL del servidor" + }, + "title": "Configuración de servidores MCP" + }, + "start": { + "label": "MCP: Iniciar servidor MCP" + }, + "stop": { + "label": "MCP: Detener el servidor MCP" + } + }, + "mcpConfiguration": { + "arguments": "Argumentos: ", + "autostart": "Arranque automático: ", + "connectServer": "Conectar", + "connectingServer": "Conectando...", + "copiedAllList": "Copiar todas las herramientas al portapapeles (lista de todas las herramientas)", + "copiedAllSingle": "Copiado de todas las herramientas al portapapeles (un único fragmento de prompt con todas las herramientas)", + "copiedForPromptTemplate": "Copiado de todas las herramientas en el portapapeles para la plantilla de aviso (un único fragmento de aviso con todas las herramientas).", + "copyAllList": "Copiar todo (lista de todas las herramientas)", + "copyAllSingle": "Copiar todo para el chat (fragmento de aviso único con todas las herramientas)", + "copyForPrompt": "Herramienta de copia (para chat o plantilla de aviso)", + "copyForPromptTemplate": "Copiar todo para plantilla de aviso (fragmento de aviso único con todas las herramientas)", + "environmentVariables": "Variables de entorno: ", + "headers": "Cabeceras: ", + "noServers": "No hay servidores MCP configurados", + "serverAuthToken": "Token de autenticación: ", + "serverAuthTokenHeader": "Nombre del encabezado de autenticación: ", + "serverUrl": "URL del servidor: ", + "tools": "Herramientas: " + }, + "openai": { + "apiKey": { + "mdDescription": "Introduzca una clave API de su cuenta oficial OpenAI. **Tenga en cuenta:** Al utilizar esta preferencia, la clave API de Open AI se almacenará en texto claro en la máquina que ejecuta Theia. Utilice la variable de entorno `OPENAI_API_KEY` para establecer la clave de forma segura." + }, + "customEndpoints": { + "apiKey": { + "title": "La clave para acceder a la API servida en la url dada o `true` para usar la clave global de la API de OpenAI." + }, + "apiVersion": { + "title": "La versión para acceder a la API servida en la url dada en Azure o `true` para usar la versión global de la API OpenAI." + }, + "deployment": { + "title": "El nombre de despliegue para acceder a la API servida en la url dada en Azure." + }, + "developerMessageSettings": { + "title": "Controla el manejo de los mensajes del sistema: `user`, `system`, y `developer` serán usados como rol, `mergeWithFollowingUserMessage` prefijará el siguiente mensaje de usuario con el mensaje de sistema o convertirá el mensaje de sistema en mensaje de usuario si el siguiente mensaje no es de usuario. `skip` eliminará el mensaje del sistema), por defecto `developer`." + }, + "enableStreaming": { + "title": "Indica si se utilizará la API de streaming. `true` por defecto." + }, + "id": { + "title": "Un identificador único que se utiliza en la interfaz de usuario para identificar el modelo personalizado." + }, + "mdDescription": "Integra modelos personalizados compatibles con la API OpenAI, por ejemplo a través de `vllm`. Los atributos necesarios son `model` y `url`. \n Opcionalmente, puede \n - especificar un `id` único para identificar el modelo personalizado en la interfaz de usuario. Si no se especifica ninguno, se utilizará `model` como `id`. \n - proporcionar una `apiKey` para acceder a la API servida en la url dada. Utilice `true` para indicar el uso de la clave global de la API OpenAI. \n - provide an `apiVersion` para acceder a la API servida en la url dada en Azure. Utilice `true` para indicar el uso de la versión global de la API OpenAI. \n - establece `developerMessageSettings` como uno de los siguientes: `user`, `system`, `developer`, `mergeWithFollowingUserMessage`, o `skip` para controlar cómo se incluye el mensaje del desarrollador (donde `user`, `system`, y `developer` se utilizarán como rol, `mergeWithFollowingUserMessage` prefijará el siguiente mensaje de usuario con el mensaje del sistema o convertirá el mensaje del sistema en mensaje de usuario si el siguiente mensaje no es un mensaje de usuario. La opción \"skip\" eliminará el mensaje del sistema). Por defecto es `developer`. \n - especifique `supportsStructuredOutput: false` para indicar que no se utilizará la salida estructurada. \n - especificar `enableStreaming: false` para indicar que no se utilizará el streaming. \n Consulte [nuestra documentación](https://theia-ide.org/docs/user_ai/#openai-compatible-models-eg-via-vllm) para obtener más información.", + "modelId": { + "title": "Model ID" + }, + "supportsStructuredOutput": { + "title": "Indica si el modelo admite salida estructurada. `true` por defecto." + }, + "url": { + "title": "El punto final compatible con la API de IA abierta donde está alojado el modelo" + } + }, + "models": { + "description": "Modelos oficiales de OpenAI" + }, + "useResponseApi": { + "mdDescription": "Utiliza la nueva OpenAI Response API en lugar de la Chat Completion API para los modelos oficiales de OpenAI. Este ajuste sólo se aplica a los modelos oficiales de OpenAI - los proveedores personalizados deben configurarlo individualmente." + } + }, + "promptTemplates": { + "directories": { + "title": "Directorios de plantillas de avisos específicos del espacio de trabajo" + }, + "extensions": { + "description": "Lista de extensiones de archivo adicionales en ubicaciones prompt que se consideran plantillas prompt. '.prompttemplate' siempre se considera por defecto.", + "title": "Extensiones adicionales de archivos de plantillas de avisos" + }, + "files": { + "title": "Archivos de plantillas de avisos específicos del espacio de trabajo" + } + }, + "scanoss": { + "changeSet": { + "clean": "Sin coincidencias", + "error": "Error: Reejecutar", + "error-notification": "Error ScanOSS encontrado: {0}.", + "match": "Ver Partidos", + "scan": "Escanear", + "scanning": "Escaneando..." + }, + "mode": { + "automatic": { + "description": "Activar la exploración automática de fragmentos de código en las vistas de chat." + }, + "description": "Configure la función SCANOSS para analizar fragmentos de código en las vistas de chat. Esto enviará un hash de fragmentos de código sugeridos al servicio SCANOSS\nalojado en la [Software Transparency foundation](https://www.softwaretransparency.org/osskb) para su análisis.", + "manual": { + "description": "El usuario puede activar manualmente el escaneo haciendo clic en el elemento SCANOSS de la vista de chat." + }, + "off": { + "description": "La función está completamente desactivada." + } + }, + "snippet": { + "dialog-header": "Resultados de ScanOSS", + "errored": "SCANOSS - Error - {0}", + "file-name-heading": "Coincidencia encontrada en {0}", + "in-progress": "SCANOSS - Realizar escaneo...", + "match-count": "Encontradas {0} coincidencia(s)", + "matched": "SCANOSS - Encontrada coincidencia {0} ", + "no-match": "SCANOSS - Ninguna coincidencia", + "summary": "Resumen" + } + }, + "session-settings-dialog": { + "title": "Configuración de la sesión", + "tooltip": "Configuración de la sesión" + }, + "terminal": { + "agent": { + "description": "Este agente proporciona asistencia para escribir y ejecutar comandos arbitrarios en el terminal. Basándose en la petición del usuario, sugiere comandos y permite al usuario pegarlos y ejecutarlos directamente en el terminal. Accede al directorio actual, al entorno y a la salida reciente de la sesión de terminal para proporcionar asistencia contextual.", + "vars": { + "cwd": { + "description": "El directorio de trabajo actual." + }, + "recentTerminalContents": { + "description": "Las últimas 0 a 50 líneas recientes visibles en el terminal." + }, + "shell": { + "description": "El shell que se está utilizando, por ejemplo, /usr/bin/zsh." + }, + "userRequest": { + "description": "Pregunta o solicitud del usuario." + } + } + }, + "askAi": "Pregunte a la IA", + "askTerminalCommand": "Pregunta sobre un comando de terminal...", + "hitEnterConfirm": "Pulsa intro para confirmar", + "howCanIHelp": "¿En qué puedo ayudarle?", + "loading": "Cargando", + "tryAgain": "Inténtalo de nuevo...", + "useArrowsAlternatives": " o utilizar ⇅ para mostrar alternativas..." + }, + "tokenUsage": { + "cachedInputTokens": "Fichas de entrada escritas en caché", + "cachedInputTokensTooltip": "Rastreados adicionalmente a 'Tokens de entrada'. Suelen ser más caras que las fichas no almacenadas en caché.", + "failedToGetTokenUsageData": "No se han podido recuperar los datos de uso de los tokens: {0}", + "inputTokens": "Fichas de entrada", + "label": "Uso de fichas", + "lastUsed": "Último usado", + "model": "Modelo", + "noData": "Aún no se dispone de datos sobre el uso de fichas.", + "note": "El uso de tokens se rastrea desde el inicio de la aplicación y no persiste.", + "outputTokens": "Fichas de salida", + "readCachedInputTokens": "Fichas de entrada leídas de la caché", + "readCachedInputTokensTooltip": "Rastreado adicionalmente a 'Input Token'. Suele ser mucho menos costoso que si no se almacena en caché. Normalmente no cuenta para los límites de velocidad.", + "total": "Total", + "totalTokens": "Total de fichas", + "totalTokensTooltip": "\"Fichas de entrada\" + \"Fichas de salida" + }, + "vercelai": { + "anthropicApiKey": { + "mdDescription": "Introduzca una clave API para los modelos antrópicos. **Tenga en cuenta que la clave API se almacena en texto claro en la máquina que ejecuta Theia. Utilice la variable de entorno `ANTHROPIC_API_KEY` para establecer la clave de forma segura." + }, + "customEndpoints": { + "apiKey": { + "title": "O bien la clave para acceder a la API servida en la url dada o `true` para utilizar la clave global de la API." + }, + "enableStreaming": { + "title": "Indica si se utilizará la API de streaming. `true` por defecto." + }, + "id": { + "title": "Un identificador único que se utiliza en la interfaz de usuario para identificar el modelo personalizado." + }, + "mdDescription": "Integra modelos personalizados compatibles con el SDK de IA de Vercel. Los atributos necesarios son `model` y `url`. \n Opcionalmente, puede \n - especificar un `id` único para identificar el modelo personalizado en la interfaz de usuario. Si no se especifica ninguno, se utilizará `model` como `id`. \n - proporcionar una `apiKey` para acceder a la API servida en la url dada. Utilice `true` para indicar el uso de la clave de API global. \n - especifique `supportsStructuredOutput: false` para indicar que no se utilizará la salida estructurada. \n - especifique `enableStreaming: false` para indicar que no se utilizará el streaming. \n - especifique `provider` para indicar de qué proveedor es el modelo (openai, anthropic).", + "modelId": { + "title": "Model ID" + }, + "supportsStructuredOutput": { + "title": "Indica si el modelo admite salida estructurada. `true` por defecto." + }, + "url": { + "title": "El punto final de la API donde se aloja el modelo" + } + }, + "models": { + "description": "Modelos oficiales para utilizar con Vercel AI SDK", + "id": { + "title": "Model ID" + }, + "model": { + "title": "Nombre del modelo" + } + }, + "openaiApiKey": { + "mdDescription": "Introduzca una clave API para modelos OpenAI. **Por favor tenga en cuenta:** Al utilizar esta preferencia la clave API se almacenará en texto claro en la máquina que ejecuta Theia. Utilice la variable de entorno `OPENAI_API_KEY` para establecer la clave de forma segura." + } + }, + "workspace": { + "coderAgent": { + "description": "Un asistente de IA integrado en Theia IDE, diseñado para ayudar a los desarrolladores de software. Este agente puede acceder al espacio de trabajo del usuario, puede obtener una lista de todos los archivos y carpetas disponibles y recuperar su contenido. Además, puede sugerir al usuario modificaciones de archivos. Por lo tanto, puede ayudar al usuario con tareas de codificación u otras tareas que impliquen cambios en los archivos." + }, + "considerGitignore": { + "description": "Si se activa, excluye los archivos/carpetas especificados en un archivo global .gitignore (la ubicación esperada es la raíz del espacio de trabajo).", + "title": "Considere .gitignore" + }, + "excludedPattern": { + "description": "Lista de patrones (glob o regex) para archivos/carpetas a excluir.", + "title": "Patrones de archivos excluidos" + }, + "searchMaxResults": { + "description": "Número máximo de resultados de búsqueda devueltos por la función de búsqueda de espacios de trabajo.", + "title": "Máximos resultados de búsqueda" + }, + "workspaceAgent": { + "description": "Un asistente de IA integrado en Theia IDE, diseñado para ayudar a los desarrolladores de software. Este agente puede acceder al espacio de trabajo del usuario, puede obtener una lista de todos los archivos y carpetas disponibles y recuperar su contenido. No puede modificar archivos. Por lo tanto, puede responder a preguntas sobre el proyecto actual, los archivos del proyecto y el código fuente en el espacio de trabajo, como por ejemplo cómo construir el proyecto, dónde colocar el código fuente, dónde encontrar código o configuraciones específicas, etc." + } + } + }, + "ai-chat": { + "fileChangeSetTitle": "Cambios propuestos" + }, + "ai-chat-ui": { + "initiate-session-task-context": "Tarea Contexto: Iniciar sesión", + "open-current-session-summary": "Resumen de la sesión en curso", + "open-settings-tooltip": "Abrir ajustes de IA...", + "scroll-lock": "Bloquear desplazamiento", + "scroll-unlock": "Desbloquear pergamino", + "session-settings": "Configuración de la sesión", + "showChats": "Mostrar chats...", + "summarize-current-session": "Resumen de la sesión actual" + }, + "ai-claude-code": { + "open-config": "Configuración del Código Claude Abierto", + "open-memory": "Abrir la memoria del código Claude (CLAUDE.MD)" + }, + "ai-core": { + "agentCompletionMessage": "El agente \"{0}\" ha completado su tarea.", + "agentCompletionTitle": "Agente \"{0}\" Tarea completada", + "agentCompletionWithTask": "El agente \"{0}\" ha completado la tarea: {1}" + }, + "ai-editor": { + "contextMenu": "Pregunte a AI", + "sendToChat": "Enviar a AI Chat" + }, + "ai-ide": { + "addressGhReviewCommand": { + "argumentHint": "", + "description": "Comentarios de revisión de direcciones en una solicitud de extracción de GitHub" + }, + "fixGhTicketCommand": { + "argumentHint": "", + "description": "Analizar un ticket de GitHub e implementar la solución." + }, + "open-agent-settings-tooltip": "Abrir la configuración del Agente...", + "rememberCommand": { + "argumentHint": "[sugerencia sobre el tema]", + "description": "Extraer temas de conversación y actualizar la información del proyecto." + }, + "ticketCommand": { + "argumentHint": "", + "description": "Analizar un ticket de GitHub y crear un plan de implementación." + }, + "todoTool": { + "noTasks": "Sin tareas" + }, + "withAppTesterCommand": { + "description": "Delegar las pruebas al agente AppTester (requiere modo agente)" + } + }, + "ai-mcp": { + "blockedServersLabel": "Servidores MCP (autoinicio bloqueado)" + }, + "ai-terminal": { + "cancelExecution": "Cancelar ejecución del comando", + "canceling": "Cancelando...", + "confirmExecution": "Confirmar comando Shell", + "denialReason": "Razón", + "executionCanceled": "Cancelado", + "executionDenied": "Denegado", + "executionDeniedWithReason": "Denegado con razón", + "noOutput": "Sin salida", + "partialOutput": "Salida parcial", + "timeout": "Tiempo de espera", + "workingDirectory": "Directorio de trabajo" + }, + "callhierarchy": { + "noCallers": "No se ha detectado ninguna llamada.", + "open": "Jerarquía de la convocatoria abierta" + }, + "chat": { + "taskContextVariable": { + "args": { + "contextId": { + "description": "El ID del contexto de la tarea a recuperar, o una sesión de chat a resumir." + } + }, + "description": "Proporciona información contextual para una tarea, por ejemplo, el plan para completar una tarea o un resumen de las sesiones anteriores.", + "label": "Contexto de la tarea" + } + }, + "collaboration": { + "collaborate": "Colabore", + "collaboration": "Colaboración", + "collaborationWorkspace": "Espacio de trabajo colaborativo", + "connected": "Conectado", + "connectedSession": "Conectado a una sesión de colaboración", + "copiedInvitation": "Código de invitación copiado en el portapapeles.", + "copyAgain": "Copiar de nuevo", + "createRoom": "Crear una nueva sesión de colaboración", + "creatingRoom": "Crear sesión", + "end": "Fin de la sesión de colaboración", + "endDetail": "Finalizar la sesión, dejar de compartir contenidos y revocar el acceso a otras personas.", + "enterCode": "Introduzca el código de la sesión de colaboración", + "failedCreate": "No se ha podido crear la sala: {0}", + "failedJoin": "No se ha podido entrar en la sala: {0}", + "fieldRequired": "El campo {0} es obligatorio. Login abortado.", + "invite": "Invitar a otros", + "inviteDetail": "Copie el código de invitación para compartirlo con otras personas y unirse a la sesión.", + "joinRoom": "Unirse a la sesión de colaboración", + "joiningRoom": "Sesión inaugural", + "leave": "Abandonar la sesión de colaboración", + "leaveDetail": "Desconectar de la sesión de colaboración actual y cerrar el espacio de trabajo.", + "loginFailed": "Login fallido.", + "loginSuccessful": "Inicio de sesión con éxito.", + "noAuth": "El servidor no proporciona ningún método de autenticación.", + "optional": "opcional", + "selectAuth": "Seleccione el método de autenticación", + "selectCollaboration": "Seleccione la opción de colaboración", + "serverUrl": "URL del servidor", + "serverUrlDescription": "URL de la instancia del Open Collaboration Tools Server para sesiones de colaboración en directo", + "sharedSession": "Compartió una sesión de colaboración", + "startSession": "Iniciar o unirse a una sesión de colaboración", + "userWantsToJoin": "Usuario '{0}' quiere unirse a la sala de colaboración", + "whatToDo": "¿Qué le gustaría hacer con otros colaboradores?" + }, + "core": { + "about": { + "compatibility": "{0} Compatibilidad", + "defaultApi": "API por defecto {0} ", + "listOfExtensions": "Lista de extensiones" + }, + "common": { + "closeAll": "Cerrar todas las pestañas", + "closeAllTabMain": "Cerrar todas las pestañas del área principal", + "closeOtherTabMain": "Cerrar otras pestañas en el área principal", + "closeOthers": "Cerrar otras pestañas", + "closeRight": "Cerrar pestañas a la derecha", + "closeTab": "Cerrar pestaña", + "closeTabMain": "Cerrar la pestaña en el área principal", + "collapseAllTabs": "Contraer todos los paneles laterales", + "collapseBottomPanel": "Panel inferior de la palanca", + "collapseLeftPanel": "Panel izquierdo", + "collapseRightPanel": "Panel derecho", + "collapseTab": "Colapso del panel lateral", + "showNextTabGroup": "Pasar al siguiente grupo de pestañas", + "showNextTabInGroup": "Pasar a la siguiente pestaña del grupo", + "showPreviousTabGroup": "Cambiar al grupo de pestañas anterior", + "showPreviousTabInGroup": "Pasar a la pestaña anterior del grupo", + "toggleMaximized": "Alternar maximizado" + }, + "copyInfo": "Abra primero un archivo para copiar su ruta", + "copyWarn": "Utilice el comando de copia del navegador o el acceso directo.", + "cutWarn": "Utiliza el comando o atajo de teclado del navegador.", + "enhancedPreview": { + "classic": "Muestra una vista previa sencilla de la ficha con información básica.", + "enhanced": "Mostrar una vista previa mejorada de la ficha con información adicional.", + "visual": "Muestra una vista previa visual de la pestaña." + }, + "file": { + "browse": "Visite" + }, + "highlightModifiedTabs": "Controla si se dibuja un borde superior en las pestañas modificadas (sucias) del editor o no.", + "keybinding": { + "duplicateModifierError": "No se puede analizar el keybinding {0} Modificadores duplicados", + "metaError": "No se puede parsear keybinding {0} meta es sólo para OSX", + "unrecognizedKeyError": "Clave no reconocida {0} en {1}" + }, + "keybindingStatus": "{0} fue presionado, esperando más teclas", + "keyboard": { + "choose": "Elija la disposición del teclado", + "chooseLayout": "Elija una disposición de teclado", + "current": "(corriente: {0})", + "currentLayout": " - diseño actual", + "mac": "Teclados Mac", + "pc": "Teclados para PC", + "tryDetect": "Intenta detectar la distribución del teclado a partir de la información del navegador y de las teclas pulsadas." + }, + "navigator": { + "clipboardWarn": "El acceso al portapapeles está denegado. Comprueba los permisos de tu navegador.", + "clipboardWarnFirefox": "La API del portapapeles no está disponible. Se puede activar mediante la preferencia '{0}' en la página '{1}'. A continuación, vuelva a cargar Theia. Tenga en cuenta que esto permitirá a FireFox tener acceso completo al portapapeles del sistema." + }, + "offline": "Fuera de línea", + "pasteWarn": "Por favor, utilice el comando de pegar o el atajo de teclado del navegador.", + "quitMessage": "Cualquier cambio no guardado no se guardará.", + "resetWorkbenchLayout": "Restablecer la disposición del banco de trabajo", + "searchbox": { + "close": "Cerrar (Escapar)", + "next": "Siguiente (abajo)", + "previous": "Anterior (Arriba)", + "showAll": "Mostrar todos los artículos", + "showOnlyMatching": "Mostrar solo los artículos coincidentes" + }, + "secondaryWindow": { + "alwaysOnTop": "Cuando está activada, la ventana secundaria se mantiene por encima de todas las demás ventanas, incluidas las de distintas aplicaciones.", + "description": "Establece la posición inicial y el tamaño de la ventana secundaria extraída.", + "fullSize": "La posición y el tamaño del widget extraído serán los mismos que los de la aplicación Theia en ejecución.", + "halfWidth": "La posición y el tamaño del widget extraído serán la mitad de la anchura de la aplicación Theia en ejecución.", + "originalSize": "La posición y el tamaño del widget extraído serán los mismos que los del widget original." + }, + "severity": { + "log": "Registro" + }, + "silentNotifications": "Controla si se suprimen las ventanas emergentes de notificación.", + "tabDefaultSize": "Especifica el tamaño por defecto de las pestañas.", + "tabMaximize": "Controla si se maximizan las pestañas al hacer doble clic.", + "tabMinimumSize": "Especifica el tamaño mínimo de las pestañas.", + "tabShrinkToFit": "Reduzca las pestañas para adaptarlas al espacio disponible.", + "window": { + "tabCloseIconPlacement": { + "description": "Coloque los iconos de cierre en los títulos de las pestañas al principio o al final de la pestaña. El valor predeterminado es el final en todas las plataformas.", + "end": "Coloque el icono de cierre al final de la etiqueta. En los idiomas de izquierda a derecha, se trata del lado derecho de la etiqueta.", + "start": "Coloque el icono de cierre al principio de la etiqueta. En los idiomas de izquierda a derecha, se trata del lado izquierdo de la etiqueta." + } + }, + "window.menuBarVisibility": "El menú se muestra como un botón compacto en la barra lateral. Este valor se ignora cuando{0} es {1}." + }, + "debug": { + "TheiaIDE": "IDE Theia", + "addConfigurationPlaceholder": "Seleccione la raíz del espacio de trabajo para añadir la configuración", + "breakpoint": "punto de interrupción", + "cannotRunToThisLocation": "No se ha podido ejecutar el hilo actual en la ubicación especificada.", + "compound-cycle": "La configuración de lanzamiento '{0}' contiene un ciclo consigo mismo", + "conditionalBreakpoint": "Punto de interrupción condicional", + "conditionalBreakpointsNotSupported": "Puntos de interrupción condicionales no admitidos por este tipo de depuración", + "confirmRunToShiftedPosition_msg": "La posición del objetivo se desplazará a Ln {0}, Col {1}. ¿Correr de todos modos?", + "confirmRunToShiftedPosition_title": "No se puede ejecutar el hilo actual exactamente a la ubicación especificada", + "consoleFilter": "Filtro (por ejemplo, texto, !excluir)", + "consoleFilterAriaLabel": "Filtrar la salida de la consola de depuración", + "consoleSessionSelectorTooltip": "Cambiar entre sesiones de depuración. Cada sesión de depuración tiene su propia salida de consola.", + "consoleSeverityTooltip": "Filtrar la salida de la consola por nivel de gravedad. Solo se mostrarán los mensajes con la gravedad seleccionada.", + "continueAll": "Continuar todo", + "copyExpressionValue": "Copiar el valor de la expresión", + "couldNotRunTask": "No se ha podido ejecutar la tarea '{0}'.", + "dataBreakpoint": "punto de interrupción de datos", + "debugConfiguration": "Configuración de depuración", + "debugSessionInitializationFailed": "Error en la inicialización de la sesión de depuración. Consulte la consola para obtener más detalles.", + "debugSessionTypeNotSupported": "El tipo de sesión de depuración \"{0}\" no es compatible.", + "debugToolbarMenu": "Menú de la barra de herramientas de depuración", + "debugVariableInput": "Establecer {0} Valor", + "disableSelectedBreakpoints": "Desactivar puntos de interrupción seleccionados", + "disabledBreakpoint": "Discapacitados {0}", + "enableSelectedBreakpoints": "Activar puntos de interrupción seleccionados", + "entry": "entrada", + "errorStartingDebugSession": "Se ha producido un error al iniciar la sesión de depuración, compruebe los registros para obtener más detalles.", + "exception": "excepción", + "functionBreakpoint": "punto de interrupción de la función", + "goto": "ir a", + "htiConditionalBreakpointsNotSupported": "Marcar puntos de interrupción condicionales no soportados por este tipo de depuración", + "instruction-breakpoint": "Punto de interrupción de la instrucción", + "instructionBreakpoint": "punto de interrupción de instrucción", + "logpointsNotSupported": "Puntos de registro no compatibles con este tipo de depuración", + "missingConfiguration": "La configuración dinámica '{0}:{1}' falta o no es aplicable", + "pause": "pausa", + "pauseAll": "Pausa Todo", + "reveal": "Revelar", + "step": "paso", + "taskTerminatedBySignal": "Tarea '{0}' terminada por la señal {1}.", + "taskTerminatedForUnknownReason": "Tarea '{0}' terminada por razón desconocida.", + "taskTerminatedWithExitCode": "Tarea '{0}' terminada con código de salida {1}.", + "threads": "Hilos", + "toggleTracing": "Activar/desactivar las comunicaciones de rastreo con los adaptadores de depuración", + "unknownSession": "Sesión desconocida", + "unverifiedBreakpoint": "Sin verificar {0}" + }, + "editor": { + "diffEditor.wordWrap2": "Las líneas se ajustarán según la configuración de `#editor.wordWrap#`.", + "dirtyEncoding": "El archivo está sucio. Por favor, guárdelo primero antes de volver a abrirlo con otra codificación.", + "editor.bracketPairColorization.enabled": "Controla si la coloración del par de corchetes está activada o no. Utilice `#workbench.colorCustomizations#` para anular los colores de resaltado de los corchetes.", + "editor.codeActions.triggerOnFocusChange": "Habilitar la activación de `#editor.codeActionsOnSave#` cuando `#files.autoSave#` se establece en `afterDelay`. Las acciones de código deben tener el valor `always` para que se activen con los cambios de ventana y de foco.", + "editor.detectIndentation": "Controla si `#editor.tabSize#` y `#editor.insertSpaces#` se detectarán automáticamente al abrir un archivo en función de su contenido.", + "editor.experimental.preferTreeSitter": "Controla si se debe activar el análisis de Tree Sitter para idiomas específicos. Esto tendrá prioridad sobre `editor.experimental.treeSitterTelemetry` para los idiomas especificados.", + "editor.inlayHints.enabled1": "Los consejos de incrustación se muestran por defecto y se ocultan cuando se mantiene `Ctrl+Alt`.", + "editor.inlayHints.enabled2": "Los consejos de incrustación están ocultos por defecto y se muestran cuando se mantiene pulsado `Ctrl+Alt`.", + "editor.inlayHints.fontFamily": "Controla la familia de fuentes de las sugerencias de incrustación en el editor. Si está vacío, se utiliza `#editor.fontFamily#`.", + "editor.inlayHints.fontSize": "Controla el tamaño de la fuente de las sugerencias de incrustación en el editor. Por defecto se utiliza `#editor.fontSize#` cuando el valor configurado es menor que `5` o mayor que el tamaño de fuente del editor.", + "editor.inlineSuggest.edits.experimental.enabled": "Controla si se habilitan las ediciones experimentales en las sugerencias en línea.", + "editor.inlineSuggest.edits.experimental.onlyShowWhenCloseToCursor": "Controla si sólo se muestran sugerencias en línea cuando el cursor está cerca de la sugerencia.", + "editor.inlineSuggest.edits.experimental.useInterleavedLinesDiff": "Controla si se activa la difusión experimental de líneas intercaladas en las sugerencias en línea.", + "editor.inlineSuggest.edits.experimental.useMixedLinesDiff": "Controla si se habilitan las ediciones experimentales en las sugerencias en línea.", + "editor.insertSpaces": "Insertar espacios al pulsar `Tab`. Este ajuste se anula en función del contenido del archivo cuando `#editor.detectIndentation#` está activado.", + "editor.quickSuggestions": "Controla si las sugerencias deben aparecer automáticamente mientras se escribe. Esto puede controlarse para escribir comentarios, cadenas y otros códigos. La sugerencia rápida puede ser configurada para mostrarse como texto fantasma o con el widget de sugerencia. También hay que tener en cuenta la configuración '#editor.suggestOnTriggerCharacters#' que controla si las sugerencias son activadas por caracteres especiales.", + "editor.suggestFontSize": "Tamaño de fuente para el widget de sugerencia. Cuando se establece en `0`, se utiliza el valor de `#editor.fontSize#`.", + "editor.suggestLineHeight": "Altura de línea para el widget de sugerencia. Cuando se establece en `0`, se utiliza el valor de `#editor.lineHeight#`. El valor mínimo es 8.", + "editor.tabSize": "El número de espacios a los que equivale un tabulador. Este ajuste se anula en función del contenido del archivo cuando `#editor.detectIndentation#` está activado.", + "formatOnSaveTimeout": "Tiempo de espera en milisegundos tras el cual se cancela el formato que se ejecuta al guardar el archivo.", + "persistClosedEditors": "Controla si se mantiene el historial del editor cerrado para el espacio de trabajo a través de las recargas de la ventana.", + "showAllEditors": "Mostrar todos los editores abiertos", + "splitHorizontal": "Editor de división horizontal", + "splitVertical": "Split Editor Vertical", + "toggleStickyScroll": "Alternar desplazamiento permanente" + }, + "external-terminal": { + "cwd": "Seleccionar el directorio de trabajo actual para el nuevo terminal externo" + }, + "file-search": { + "toggleIgnoredFiles": " (Pulse {0} para mostrar/ocultar los archivos ignorados)" + }, + "fileDialog": { + "showHidden": "Mostrar archivos ocultos" + }, + "fileSystem": { + "fileResource": { + "overWriteBody": "¿Quiere sobrescribir los cambios realizados en '{0}' en el sistema de archivos?" + } + }, + "filesystem": { + "copiedToClipboard": "Copiado el enlace de descarga en el portapapeles.", + "copyDownloadLink": "Copiar el enlace de descarga", + "dialog": { + "initialLocation": "Ir a la ubicación inicial", + "multipleItemMessage": "Sólo puede seleccionar un elemento", + "navigateBack": "Navegar hacia atrás", + "navigateForward": "Navegar hacia adelante", + "navigateUp": "Navegar hacia arriba en un directorio" + }, + "fileResource": { + "binaryFileQuery": "Abrirlo puede llevar algún tiempo y puede hacer que el IDE no responda. ¿Quiere abrir '{0}' de todos modos?", + "binaryTitle": "El archivo es binario o utiliza una codificación de texto no admitida.", + "largeFileTitle": "El archivo es demasiado grande ({0}).", + "overwriteTitle": "El archivo '{0}' ha sido modificado en el sistema de archivos." + }, + "filesExclude": "Configurar patrones glob para excluir archivos y carpetas. Por ejemplo, el Explorador de archivos decide qué archivos y carpetas mostrar u ocultar en función de esta configuración.", + "format": "Formato:", + "maxConcurrentUploads": "Número máximo de archivos concurrentes a subir cuando se suben varios archivos. 0 significa que todos los archivos se subirán simultáneamente.", + "maxFileSizeMB": "Controla el tamaño máximo de archivo en MB que es posible abrir.", + "prepareDownload": "Preparando la descarga...", + "prepareDownloadLink": "Preparando enlace de descarga...", + "processedOutOf": "Procesado {0} de {1}", + "replaceTitle": "Sustituir archivo", + "uploadFailed": "Se ha producido un error al cargar un archivo. {0}", + "uploadFiles": "Subir archivos...", + "uploadedOutOf": "Cargado {0} de {1}" + }, + "getting-started": { + "ai": { + "header": "¡Ya está disponible la asistencia de IA en el IDE Theia (versión beta)!", + "openAIChatView": "¡Abre ahora la vista de chat con IA para aprender cómo empezar!" + }, + "apiComparator": "{0} Compatibilidad con la API", + "newExtension": "Construir una nueva extensión", + "newPlugin": "Creación de un nuevo plugin", + "startup-editor": { + "welcomePage": "Abra la página de bienvenida, con contenidos que le ayudarán a empezar a utilizar {0} y las extensiones." + }, + "telemetry": "Uso de datos y telemetría" + }, + "git": { + "aFewSecondsAgo": "hace unos segundos", + "addSignedOff": "Agregar a la lista de firmas", + "added": "Añadido", + "amendReuseMessage": "Para reutilizar el último mensaje de confirmación, pulse \"Enter\" o \"Escape\" para cancelar.", + "amendRewrite": "Reescribir el mensaje de confirmación anterior. Pulse 'Enter' para confirmar o 'Escape' para cancelar.", + "checkoutCreateLocalBranchWithName": "Cree una nueva sucursal local con el nombre: {0}. Pulse 'Enter' para confirmar o 'Escape' para cancelar.", + "checkoutProvideBranchName": "Por favor, indique el nombre de la sucursal.", + "checkoutSelectRef": "Selecciona una referencia para hacer el checkout o crea una nueva sucursal local:", + "cloneQuickInputLabel": "Por favor, indique la ubicación del repositorio Git. Pulse 'Enter' para confirmar o 'Escape' para cancelar.", + "cloneRepository": "Clona el repositorio Git: {0}. Pulsa 'Enter' para confirmar o 'Escape' para cancelar.", + "compareWith": "Compara con...", + "compareWithBranchOrTag": "Elija una rama o etiqueta para comparar con la rama {0} actualmente activa:", + "conflicted": "Conflicto", + "copied": "Copied", + "diff": "Diff", + "dirtyDiffLinesLimit": "No mostrar decoraciones diff sucias, si el número de líneas del editor supera este límite.", + "dropStashMessage": "El alijo se ha eliminado con éxito.", + "editorDecorationsEnabled": "Mostrar las decoraciones git en el editor.", + "fetchPickRemote": "Escoge un mando a distancia desde el que buscar:", + "gitDecorationsColors": "Utilice la decoración de colores en el navegador.", + "mergeEditor": { + "currentSideTitle": "Actual", + "incomingSideTitle": "Entrante" + }, + "mergeQuickPickPlaceholder": "Elige una rama para fusionar con la rama {0} actualmente activa:", + "missingUserInfo": "Asegúrate de configurar tu 'user.name' y 'user.email' en git.", + "noHistoryForError": "No hay historial disponible para {0}", + "noPreviousCommit": "No hay compromiso previo para modificar", + "noRepositoriesSelected": "No se ha seleccionado ningún repositorio.", + "prepositionIn": "en", + "renamed": "Renombrado", + "repositoryNotInitialized": "El repositorio {0} aún no está inicializado.", + "stashChanges": "Cambios en el alijo. Pulse \"Enter\" para confirmar o \"Escape\" para cancelar.", + "stashChangesWithMessage": "Cambios en el alijo con mensaje: {0}. Pulse 'Enter' para confirmar o 'Escape' para cancelar.", + "tabTitleIndex": "{0} (índice)", + "tabTitleWorkingTree": "{0} (Árbol de trabajo)", + "toggleBlameAnnotations": "Alternar las anotaciones de culpabilidad", + "unstaged": "Sin montar" + }, + "keybinding-schema-updater": { + "deprecation": "Utilice la cláusula `when` en su lugar." + }, + "keymaps": { + "addKeybindingTitle": "Añadir Keybinding para {0}", + "editKeybinding": "Editar asignación de teclas...", + "editKeybindingTitle": "Editar enlace de teclas para {0}", + "editWhenExpression": "Editar cuando la expresión...", + "editWhenExpressionTitle": "Editar cuando Expresión para {0}", + "keybinding": { + "copy": "Copiar enlace de teclas", + "copyCommandId": "Copiar ID de comando de combinación de teclas", + "copyCommandTitle": "Copiar comando de combinación de teclas Título", + "edit": "Editar asignación de teclas...", + "editWhenExpression": "Editar vinculación de teclas cuando la expresión..." + }, + "keybindingCollidesValidation": "la vinculación de teclas actualmente colisiona", + "requiredKeybindingValidation": "se requiere el valor del keybinding", + "resetKeybindingConfirmation": "¿Realmente quieres restablecer este keybinding a su valor por defecto?", + "resetKeybindingTitle": "Restablecer la unión de teclas para {0}", + "resetMultipleKeybindingsWarning": "Si existen varias combinaciones de teclas para este comando, todas ellas se restablecerán." + }, + "localize": { + "offlineTooltip": "No se puede conectar al backend." + }, + "markers": { + "clearAll": "Borrar todo", + "noProblems": "Hasta ahora no se han detectado problemas en el espacio de trabajo.", + "tabbarDecorationsEnabled": "Mostrar decoradores de problemas (marcadores de diagnóstico) en las barras de pestañas." + }, + "memory-inspector": { + "addressTooltip": "Ubicación de la memoria a mostrar, una dirección o expresión que se evalúa a una dirección", + "ascii": "ASCII", + "binary": "Binario", + "byteSize": "Tamaño del byte", + "bytesPerGroup": "Bytes por grupo", + "closeSettings": "Cerrar Ajustes", + "columns": "Columnas", + "command": { + "createNewMemory": "Crear un nuevo inspector de memoria", + "createNewRegisterView": "Crear una nueva vista de registro", + "followPointer": "Siga el puntero", + "followPointerMemory": "Seguir el puntero en el inspector de memoria", + "resetValue": "Valor de reposición", + "showRegister": "Mostrar registro en el inspector de memoria", + "viewVariable": "Mostrar la variable en el inspector de memoria" + }, + "data": "Datos", + "decimal": "Decimal", + "diff": { + "label": "Diff: {0}" + }, + "diff-widget": { + "offset-label": "{0} Offset", + "offset-title": "Bytes para compensar la memoria de {0}" + }, + "editable": { + "apply": "Aplicar cambios", + "clear": "Cambios claros" + }, + "endianness": "Endiosamiento", + "extraColumn": "Extra Column", + "groupsPerRow": "Grupos por fila", + "hexadecimal": "Hexadecimal", + "length": "Longitud", + "lengthTooltip": "Número de bytes a recuperar, en decimal o hexadecimal", + "memory": { + "addressField": { + "memoryReadError": "Introduzca una dirección o expresión en el campo Ubicación." + }, + "freeze": "Congelar la vista de la memoria", + "hideSettings": "Ocultar el panel de configuración", + "readError": { + "bounds": "Límites de memoria excedidos, el resultado será truncado.", + "noContents": "No hay contenidos de memoria disponibles actualmente." + }, + "readLength": { + "memoryReadError": "Introduzca una longitud (número decimal o hexadecimal) en el campo Longitud." + }, + "showSettings": "Mostrar el panel de configuración", + "unfreeze": "Descongelar la vista de la memoria", + "userError": "Hubo un error en la obtención de la memoria." + }, + "memoryCategory": "Inspector de memoria", + "memoryInspector": "Inspector de memoria", + "memoryTitle": "Memoria", + "octal": "Octal", + "offset": "Offset", + "offsetTooltip": "Desplazamiento que se añade a la posición de memoria actual, cuando se navega", + "provider": { + "localsError": "No se pueden leer las variables locales. No hay sesión de depuración activa.", + "readError": "No se puede leer la memoria. No hay sesión de depuración activa.", + "writeError": "No se puede escribir en la memoria. No hay sesión de depuración activa." + }, + "register": "Registro", + "register-widget": { + "filter-placeholder": "Filtro (comienza con)" + }, + "registerReadError": "Hubo un error en la obtención de registros.", + "registers": "Registros", + "toggleComparisonWidgetVisibility": "Alternar la visibilidad del widget de comparación", + "utils": { + "afterBytes": "Debes cargar memoria en los dos widgets que quieras comparar. {0} no tiene memoria cargada.", + "bytesMessage": "Debes cargar memoria en los dos widgets que quieras comparar. {0} no tiene memoria cargada." + } + }, + "messages": { + "notificationTimeout": "Las notificaciones informativas se ocultarán después de este tiempo de espera.", + "toggleNotifications": "Alternar las notificaciones" + }, + "mini-browser": { + "typeUrl": "Escriba una URL" + }, + "monaco": { + "noSymbolsMatching": "No hay símbolos que coincidan", + "typeToSearchForSymbols": "Escriba para buscar símbolos" + }, + "navigator": { + "autoReveal": "Auto Reveal", + "clipboardWarn": "El acceso al portapapeles está denegado. Comprueba los permisos de tu navegador.", + "clipboardWarnFirefox": "La API del portapapeles no está disponible. Se puede activar mediante la preferencia '{0}' en la página '{1}'. A continuación, vuelva a cargar Theia. Tenga en cuenta que esto permitirá a FireFox tener acceso completo al portapapeles del sistema.", + "openWithSystemEditor": "Abrir con el editor del sistema", + "refresh": "Actualizar en el Explorador", + "reveal": "Revelar en el Explorador", + "systemEditor": "Editor del sistema", + "toggleHiddenFiles": "Activar los archivos ocultos" + }, + "output": { + "clearOutputChannel": "Canal de salida claro...", + "closeOutputChannel": "Cerrar canal de salida...", + "hiddenChannels": "Canales ocultos", + "hideOutputChannel": "Ocultar canal de salida...", + "maxChannelHistory": "El número máximo de entradas en un canal de salida.", + "outputChannels": "Canales de salida", + "showOutputChannel": "Mostrar canal de salida..." + }, + "plugin": { + "blockNewTab": "Su navegador ha impedido la apertura de una nueva pestaña" + }, + "plugin-dev": { + "alreadyRunning": "La instancia alojada ya está funcionando.", + "debugInstance": "Instancia de depuración", + "debugMode": "Uso de inspect o inspect-brk para la depuración de Node.js", + "debugPorts": { + "debugPort": "Puerto a usar para la depuración Node.js de este servidor" + }, + "devHost": "Anfitrión del desarrollo", + "failed": "Fallo en la ejecución de la instancia del plugin alojado: {0}", + "hostedPlugin": "Plugin alojado", + "hostedPluginRunning": "Plugin alojado: en funcionamiento", + "hostedPluginStarting": "Plugin alojado: Inicio", + "hostedPluginStopped": "Plugin alojado: Detenido", + "hostedPluginWatching": "Plugin alojado: Ver", + "instanceTerminated": "{0} se ha terminado", + "launchOutFiles": "Conjunto de patrones glob para localizar los archivos JavaScript generados (`${pluginPath}` se sustituirá por la ruta real del plugin).", + "noValidPlugin": "La carpeta especificada no contiene un plugin válido.", + "notRunning": "La instancia alojada no se está ejecutando.", + "pluginFolder": "La carpeta de plugins está configurada en: {0}", + "preventedNewTab": "Su navegador ha impedido la apertura de una nueva pestaña", + "restartInstance": "Reiniciar la instancia", + "running": "La instancia alojada está funcionando en:", + "selectPath": "Seleccione la ruta", + "startInstance": "Instancia de inicio", + "starting": "Iniciando el servidor de instancia alojada ...", + "stopInstance": "Detener la instancia", + "unknownTerminated": "La instancia ha sido terminada", + "watchMode": "Ejecutar el vigilante en el plugin en desarrollo" + }, + "plugin-ext": { + "authentication-main": { + "loginTitle": "Inicio de sesión", + "signedOut": "Cierre de sesión correcto." + }, + "plugins": "Plugins", + "webviewTrace": "Controla el rastreo de la comunicación con los webviews.", + "webviewWarnIfUnsecure": "Advierte a los usuarios de que las vistas web se despliegan actualmente de forma insegura." + }, + "preferences": { + "ai-features": "Características de la IA", + "hostedPlugin": "Plugin alojado", + "toolbar": "Barra de herramientas" + }, + "preview": { + "openByDefault": "Abrir la vista previa en lugar del editor por defecto." + }, + "property-view": { + "created": "Creado", + "directory": "Directorio", + "lastModified": "Última modificación", + "location": "Ubicación", + "noProperties": "No hay propiedades disponibles.", + "properties": "Propiedades", + "symbolicLink": "Enlace simbólico" + }, + "remote": { + "dev-container": { + "connect": "Reabrir en contenedor", + "noDevcontainerFiles": "No se han encontrado archivos devcontainer.json en el área de trabajo. Asegúrese de que dispone de un directorio .devcontainer con un archivo devcontainer.json.", + "selectDevcontainer": "Seleccione un archivo devcontainer.json" + }, + "ssh": { + "connect": "Conectar la ventana actual al host...", + "connectToConfigHost": "Conectar la ventana actual al host en el archivo de configuración...", + "enterHost": "Introduzca el nombre de host SSH", + "enterUser": "Introduzca el nombre de usuario SSH", + "failure": "No se ha podido abrir la conexión SSH con el remoto.", + "hostPlaceHolder": "Por ejemplo, hello@example.com", + "needsHost": "Introduzca un nombre de host.", + "needsUser": "Introduzca un nombre de usuario.", + "userPlaceHolder": "Por ejemplo, hola" + }, + "sshNoConfigPath": "No se ha encontrado la ruta de configuración SSH.", + "wsl": { + "connectToWsl": "Conectarse a WSL", + "connectToWslUsingDistro": "Conectarse a WSL mediante Distro...", + "noWslDistroFound": "No se han encontrado distribuciones WSL. Por favor, instale primero una distribución WSL.", + "reopenInWsl": "Reabrir carpeta en WSL", + "selectWSLDistro": "Seleccione una distribución WSL" + } + }, + "scm": { + "amend": "Modificar", + "amendHeadCommit": "Compromiso HEAD", + "amendLastCommit": "Modificar el último compromiso", + "changeRepository": "Cambiar el repositorio...", + "config.untrackedChanges": "Controla el comportamiento de los cambios no rastreados.", + "config.untrackedChanges.hidden": "oculto", + "config.untrackedChanges.mixed": "mixto", + "config.untrackedChanges.separate": "separar", + "dirtyDiff": { + "close": "Cerrar Cambiar Vista Peek" + }, + "history": "Historia", + "mergeEditor": { + "resetConfirmationTitle": "¿Realmente desea restablecer el resultado de la fusión en este editor?" + }, + "noRepositoryFound": "No se ha encontrado ningún repositorio", + "unamend": "Sin modificar", + "unamendCommit": "No modificar el compromiso" + }, + "search-in-workspace": { + "includeIgnoredFiles": "Incluir archivos ignorados", + "noFolderSpecified": "No ha abierto o especificado una carpeta. Actualmente sólo se buscan los archivos abiertos.", + "resultSubset": "Esto es sólo un subconjunto de todos los resultados. Utilice un término de búsqueda más específico para reducir la lista de resultados.", + "searchOnEditorModification": "Busca en el editor activo cuando se modifica." + }, + "secondary-window": { + "extract-widget": "Mover la vista a la ventana secundaria" + }, + "shell-area": { + "secondary": "Ventana secundaria" + }, + "task": { + "attachTask": "Adjuntar tarea...", + "circularReferenceDetected": "Referencia circular detectada: {0} --> {1}", + "clearHistory": "Historia clara", + "errorKillingTask": "Error al matar la tarea '{0}': {1}", + "errorLaunchingTask": "Error al iniciar la tarea '{0}': {1}", + "invalidTaskConfigs": "Se han encontrado configuraciones de tareas no válidas. Abra tasks.json y busque los detalles en la vista Problemas.", + "neverScanTaskOutput": "Nunca escanee la salida de la tarea", + "noTaskToRun": "No se ha encontrado ninguna tarea que ejecutar. Configurar tareas...", + "noTasksFound": "No se han encontrado tareas", + "notEnoughDataInDependsOn": "La información proporcionada en \"dependeDe\" no es suficiente para acertar con la tarea correcta.", + "schema": { + "commandOptions": { + "cwd": "El directorio de trabajo actual del programa o script ejecutado. Si se omite se utiliza la raíz del espacio de trabajo actual de Theia." + }, + "presentation": { + "panel": { + "dedicated": "El terminal se dedica a una tarea específica. Si esa tarea se ejecuta de nuevo, el terminal se reutiliza. Sin embargo, la salida de una tarea diferente se presenta en un terminal distinto.", + "new": "Cada ejecución de esa tarea utiliza un nuevo terminal limpio.", + "shared": "El terminal se comparte y la salida de otras ejecuciones de tareas se añade al mismo terminal." + }, + "showReuseMessage": "Controla si se muestra el mensaje \"El terminal será reutilizado por las tareas\"." + }, + "problemMatcherObject": { + "owner": "El propietario del problema dentro de Theia. Puede omitirse si se especifica la base. Por defecto es 'externo' si se omite y no se especifica la base." + } + }, + "taskAlreadyRunningInTerminal": "La tarea ya se está ejecutando en el terminal", + "taskExitedWithCode": "La tarea '{0}' ha finalizado con el código {1}.", + "taskTerminalTitle": "Tarea: {0}", + "taskTerminatedBySignal": "La tarea '{0}' fue terminada por la señal {1}.", + "terminalWillBeReusedByTasks": "El terminal será reutilizado por las tareas." + }, + "terminal": { + "defaultProfile": "El perfil por defecto utilizado en {0}", + "enableCopy": "Activar ctrl-c (cmd-c en macOS) para copiar el texto seleccionado", + "enablePaste": "Activar ctrl-v (cmd-v en macOS) para pegar desde el portapapeles", + "profileArgs": "Los argumentos de shell que utiliza este perfil.", + "profileColor": "Un ID de color del tema del terminal para asociar con el terminal.", + "profileDefault": "Elija Perfil predeterminado...", + "profileIcon": "Un ID de codicon para asociar con el icono de terminal.\nterminal-tmux:\"$(terminal-tmux)\"", + "profileNew": "Nuevo Terminal (Con Perfil)...", + "profilePath": "La ruta del shell que utiliza este perfil.", + "profiles": "Los perfiles a presentar cuando se crea un nuevo terminal. Establezca la propiedad path manualmente con argumentos opcionales.\nEstablezca un perfil existente como `null` para ocultar el perfil de la lista, por ejemplo: `\"{0}\": null`.", + "rendererType": "Controla cómo se representa el terminal.", + "rendererTypeDeprecationMessage": "El tipo de renderizador ya no se admite como opción.", + "selectProfile": "Seleccione un perfil para el nuevo terminal", + "shell.deprecated": "Esto está obsoleto, la nueva forma recomendada de configurar tu shell por defecto es creando un perfil de terminal en 'terminal.integrated.profiles.{0}' y estableciendo su nombre de perfil como el predeterminado en 'terminal.integrated.defaultProfile.{0}.'", + "shellArgsLinux": "Los argumentos de la línea de comandos a utilizar cuando en el terminal de Linux.", + "shellArgsOsx": "Los argumentos de la línea de comandos a utilizar cuando en el terminal de macOS.", + "shellArgsWindows": "Los argumentos de la línea de comandos a utilizar cuando en el terminal de Windows.", + "shellLinux": "La ruta del shell que utiliza la terminal en Linux (por defecto: '{0}'}).", + "shellOsx": "La ruta del shell que utiliza el terminal en macOS (por defecto: '{0}'}).", + "shellWindows": "La ruta del shell que utiliza la terminal en Windows. (por defecto: '{0}')." + }, + "terminal-manager": { + "addTerminalToGroup": "Añadir terminal al grupo", + "closeDialog": { + "message": "Una vez cerrado el Administrador de terminales, no se podrá restaurar su diseño. ¿Está seguro de que desea cerrar el Administrador de terminales?", + "title": "¿Desea cerrar el administrador de terminales?" + }, + "closeTerminalManager": "Cerrar Terminal Manager", + "createNewTerminalGroup": "Crear nuevo grupo de terminales", + "createNewTerminalPage": "Crear nueva página de terminal", + "deleteGroup": "Eliminar grupo", + "deletePage": "Eliminar página", + "deleteTerminal": "Eliminar terminal", + "group": "Grupo", + "label": "Terminales", + "maximizeBottomPanel": "Maximizar el panel inferior", + "minimizeBottomPanel": "Minimizar el panel inferior", + "openTerminalManager": "Abrir el Administrador de terminales", + "page": "Página", + "rename": "Cambiar nombre", + "resetTerminalManagerLayout": "Restablecer diseño del administrador de terminales", + "toggleTreeView": "Alternar vista en árbol" + }, + "test": { + "cancelAllTestRuns": "Cancelar todas las pruebas", + "stackFrameAt": "en", + "testRunDefaultName": "{0} ejecute {1}", + "testRuns": "Pruebas" + }, + "toolbar": { + "addCommand": "Añadir comando a la barra de herramientas", + "addCommandPlaceholder": "Buscar un comando para añadir a la barra de herramientas", + "centerColumn": "Columna central", + "failedUpdate": "No se ha podido actualizar el valor de '{0}' en '{1}'.", + "filterIcons": "Iconos del filtro", + "iconSelectDialog": "Seleccione un icono para '{0}'", + "iconSet": "Conjunto de iconos", + "insertGroupLeft": "Insertar separador de grupos (izquierda)", + "insertGroupRight": "Insertar separador de grupos (derecha)", + "leftColumn": "Columna izquierda", + "openJSON": "Personalizar la barra de herramientas (abrir JSON)", + "removeCommand": "Eliminar el comando de la barra de herramientas", + "restoreDefaults": "Restaurar la barra de herramientas por defecto", + "rightColumn": "Columna derecha", + "selectIcon": "Seleccionar icono", + "toggleToolbar": "Barra de herramientas", + "toolbarLocationPlaceholder": "¿Dónde quiere que se añada el comando?", + "useDefaultIcon": "Utilizar el icono por defecto" + }, + "typehierarchy": { + "subtypeHierarchy": "Jerarquía de subtipos", + "supertypeHierarchy": "Jerarquía de supertipos" + }, + "variableResolver": { + "listAllVariables": "Variable: Listar todos" + }, + "vsx-registry": { + "confirmDialogMessage": "La extensión \"{0}\" no está verificada y puede suponer un riesgo para la seguridad.", + "confirmDialogTitle": "¿Está seguro de que desea continuar con la instalación?", + "downloadCount": "Descargue el recuento: {0}", + "errorFetching": "Error en la búsqueda de extensiones.", + "errorFetchingConfigurationHint": "Esto podría deberse a problemas de configuración de la red.", + "failedInstallingVSIX": "Fallo en la instalación de {0} desde VSIX.", + "invalidVSIX": "El archivo seleccionado no es un plugin válido \"*.vsix\".", + "license": "License: {0}", + "onlyShowVerifiedExtensionsDescription": "Esto permite que {0} sólo muestre extensiones verificadas.", + "onlyShowVerifiedExtensionsTitle": "Mostrar sólo extensiones verificadas", + "recommendedExtensions": "Una lista de los nombres de las extensiones recomendadas para su uso en este espacio de trabajo.", + "searchPlaceholder": "Buscar extensiones en {0}", + "showInstalled": "Mostrar extensiones instaladas", + "showRecommendedExtensions": "Controla si se muestran las notificaciones de las recomendaciones de extensión.", + "vsx-extensions-contribution": { + "update-version-uninstall-error": "Error al eliminar la extensión: {0}.", + "update-version-version-error": "Fallo al instalar la versión {0} de {1}." + } + }, + "webview": { + "goToReadme": "Ir al LÉAME", + "messageWarning": " El patrón de host del punto final {0} se ha cambiado a `{1}`; el cambio de patrón puede dar lugar a vulnerabilidades de seguridad. Consulte `{2}` para obtener más información." + }, + "workspace": { + "bothAreDirectories": "Ambos recursos son directorios.", + "clickToManageTrust": "Haga clic para administrar la configuración de confianza.", + "compareWithEachOther": "Comparar con los demás", + "confirmDeletePermanently.description": "No se ha podido eliminar \"{0}\" con la papelera. Quieres eliminar permanentemente en su lugar?", + "confirmDeletePermanently.solution": "Puedes desactivar el uso de la papelera en las preferencias.", + "confirmDeletePermanently.title": "Error al borrar el archivo", + "confirmMessage.delete": "¿Realmente quiere eliminar los siguientes archivos?", + "confirmMessage.dirtyMultiple": "¿Realmente quieres borrar {0} archivos con cambios no guardados?", + "confirmMessage.dirtySingle": "¿Realmente quieres borrar {0} con los cambios no guardados?", + "confirmMessage.uriMultiple": "¿Realmente quieres borrar todos los {0} archivos seleccionados?", + "confirmMessage.uriSingle": "¿Realmente quieres borrar {0}?", + "directoriesCannotBeCompared": "Los directorios no se pueden comparar. {0}", + "duplicate": "Duplicado", + "failSaveAs": "No se puede ejecutar \"{0}\" para el widget actual.", + "isDirectory": "{0}'' es un directorio.", + "manageTrustPlaceholder": "Seleccionar estado de confianza para este espacio de trabajo", + "newFilePlaceholder": "Nombre del archivo", + "newFolderPlaceholder": "Nombre de la carpeta", + "noErasure": "Nota: No se borrará nada del disco", + "notWorkspaceFile": "Archivo de espacio de trabajo no válido: {0}", + "openRecentPlaceholder": "Escriba el nombre del espacio de trabajo que desea abrir", + "openRecentWorkspace": "Abrir el espacio de trabajo reciente...", + "preserveWindow": "Habilitar la apertura de espacios de trabajo en la ventana actual.", + "removeFolder": "¿Está seguro de que quiere eliminar la siguiente carpeta del espacio de trabajo?", + "removeFolders": "¿Está seguro de que quiere eliminar las siguientes carpetas del espacio de trabajo?", + "restrictedModeDescription": "Algunas funciones están desactivadas porque este espacio de trabajo no es de confianza.", + "restrictedModeNote": "*Nota: La función de confianza del espacio de trabajo se encuentra actualmente en desarrollo en Theia; aún no todas las funciones están integradas con la confianza del espacio de trabajo.*", + "schema": { + "folders": { + "description": "Carpetas raíz en el espacio de trabajo" + }, + "title": "Archivo del espacio de trabajo" + }, + "trashTitle": "Mover {0} a la Papelera", + "trustEmptyWindow": "Controla si el espacio de trabajo vacío es de confianza o no por defecto.", + "trustEnabled": "Controla si la confianza del espacio de trabajo está activada o no. Si se desactiva, todos los espacios de trabajo son de confianza.", + "trustTrustedFolders": "Lista de URI de carpetas que se consideran fiables sin necesidad de confirmación.", + "untitled-cleanup": "Parece que hay muchos archivos de espacio de trabajo sin título. Por favor, compruebe {0} y elimine los archivos no utilizados.", + "variables": { + "cwd": { + "description": "El directorio de trabajo actual del ejecutor de tareas al inicio" + }, + "file": { + "description": "La ruta del archivo actualmente abierto" + }, + "fileBasename": { + "description": "El nombre base del archivo actualmente abierto." + }, + "fileBasenameNoExtension": { + "description": "El nombre del archivo actualmente abierto sin extensión." + }, + "fileDirname": { + "description": "El nombre del directorio del archivo actualmente abierto." + }, + "fileExtname": { + "description": "La extensión del archivo actualmente abierto" + }, + "relativeFile": { + "description": "La ruta del archivo actualmente abierto con respecto a la raíz del espacio de trabajo." + }, + "relativeFileDirname": { + "description": "El nombre del directorio del archivo abierto actualmente relativo a ${workspaceFolder}" + }, + "workspaceFolder": { + "description": "La ruta de la carpeta raíz del espacio de trabajo" + }, + "workspaceFolderBasename": { + "description": "El nombre de la carpeta raíz del espacio de trabajo." + }, + "workspaceRoot": { + "description": "La ruta de la carpeta raíz del espacio de trabajo" + }, + "workspaceRootFolderName": { + "description": "El nombre de la carpeta raíz del espacio de trabajo." + } + }, + "workspaceFolderAdded": "Se ha creado un espacio de trabajo con múltiples raíces. Desea guardar la configuración del espacio de trabajo como un archivo?", + "workspaceFolderAddedTitle": "Carpeta añadida al espacio de trabajo" + } + }, + "vsx.disabling": "Desactivación de", + "vsx.disabling.extensions": "Desactivando {0}...", + "vsx.enabling": "Habilitar", + "vsx.enabling.extension": "Enabling {0}..." +} diff --git a/packages/core/i18n/nls.fr.json b/packages/core/i18n/nls.fr.json new file mode 100644 index 0000000..32250ad --- /dev/null +++ b/packages/core/i18n/nls.fr.json @@ -0,0 +1,2097 @@ +{ + "ai-chat-ui.show-settings": "Afficher les paramètres de l'IA", + "ai-chat:summarize-session-as-task-for-coder": "Résumer la session en tant que tâche pour le codeur", + "ai.executePlanWithCoder": "Exécuter le plan actuel avec Coder", + "ai.updateTaskContext": "Mise à jour du contexte de la tâche en cours", + "aiConfiguration:open": "Ouvrir la vue Configuration AI", + "aiHistory:clear": "Histoire de l'IA : Effacer l'historique", + "aiHistory:open": "Ouvrir la vue de l'historique de l'IA", + "aiHistory:sortChronologically": "Histoire de l'IA : Classer par ordre chronologique", + "aiHistory:sortReverseChronologically": "Histoire de l'IA : Trier par ordre chronologique inverse", + "aiHistory:toggleCompact": "Histoire de l'IA : Basculer vers l'affichage compact", + "aiHistory:toggleHideNewlines": "Histoire de l'IA : Ne plus interpréter les nouvelles lignes", + "aiHistory:toggleRaw": "Histoire de l'IA : Basculer l'affichage brut", + "aiHistory:toggleRenderNewlines": "Histoire de l'IA : Interpréter les nouvelles lignes", + "debug.breakpoint.editCondition": "Edit Condition...", + "debug.breakpoint.removeSelected": "Supprimer les points d'arrêt sélectionnés", + "debug.breakpoint.toggleEnabled": "Activer les points d'arrêt", + "notebook.cell.changeToCode": "Changer la cellule en code", + "notebook.cell.changeToMarkdown": "Changer la cellule en Mardown", + "notebook.cell.insertMarkdownCellAbove": "Insérer une cellule Markdown au-dessus", + "notebook.cell.insertMarkdownCellBelow": "Insérer une cellule Markdown en dessous", + "terminal:new:profile": "Créer un nouveau terminal intégré à partir d'un profil", + "terminal:profile:default": "Choisissez le profil du terminal par défaut", + "theia": { + "ai": { + "agents": { + "completionNotification": { + "mdDescription": "Comportement de notification lorsque cet agent termine une tâche. S'il n'est pas défini, le paramètre global de notification par défaut sera utilisé.\n - `os-notification` : Affiche les notifications de l'OS/du système\n - `message` : Affiche les notifications dans la barre d'état/zone de message.\n - `blink` : Fait clignoter ou met en évidence l'interface utilisateur\n - `off` : Désactive les notifications pour cet agent", + "title": "Notification d'achèvement" + }, + "enable": { + "mdDescription": "Indique si l'agent doit être activé (true) ou désactivé (false).", + "title": "Activer l'agent" + }, + "languageModelRequirements": { + "identifier": { + "mdDescription": "L'identifiant du modèle linguistique à utiliser." + }, + "mdDescription": "Spécifie les modèles linguistiques utilisés pour cet agent.", + "purpose": { + "mdDescription": "L'objectif pour lequel ce modèle linguistique est utilisé.", + "title": "Objectif" + }, + "title": "Exigences du modèle linguistique" + }, + "mdDescription": "Configurer les paramètres de l'agent tels que l'activation ou la désactivation d'agents spécifiques, la configuration des invites et la sélection des LLM.", + "selectedVariants": { + "mdDescription": "Spécifie les variantes d'invite actuellement sélectionnées pour cet agent.", + "title": "Variantes sélectionnées" + }, + "title": "Paramètres de l'agent" + }, + "anthropic": { + "apiKey": { + "description": "Entrez une clé API de votre compte Anthropic officiel. **Note : En utilisant cette préférence, la clé API d'Anthropic sera stockée en clair sur la machine qui exécute Theia. Utilisez la variable d'environnement `ANTHROPIC_API_KEY` pour définir la clé de manière sécurisée." + }, + "models": { + "description": "Modèles anthropiques officiels à utiliser" + } + }, + "chat": { + "agent": { + "architect": "Architecte", + "coder": "codeur", + "universal": "Universal" + }, + "applySuggestion": "Proposer une candidature", + "bypassModelRequirement": { + "description": "Contourner la vérification des exigences du modèle linguistique. Activez cette option si vous utilisez des agents externes (par exemple, Claude Code) qui ne nécessitent pas les modèles linguistiques Theia." + }, + "changeSetDefaultTitle": "Modifications proposées", + "changeSetFileDiffUriLabel": "Changements dans l'IA : {0}", + "chatAgentsVariable": { + "description": "Retourne la liste des agents de chat disponibles dans le système" + }, + "chatSessionNamingAgent": { + "description": "Agent de génération de noms de sessions de chat", + "vars": { + "conversation": { + "description": "Le contenu de la conversation." + }, + "listOfSessionNames": { + "description": "La liste des noms de session existants." + } + } + }, + "chatSessionSummaryAgent": { + "description": "Agent permettant de générer des résumés de sessions de chat." + }, + "confirmApplySuggestion": "Le fichier {0} a été modifié depuis la création de cette suggestion. Êtes-vous certain de vouloir appliquer la modification ?", + "confirmRevertSuggestion": "Le fichier {0} a été modifié depuis la création de cette suggestion. Êtes-vous certain de vouloir annuler cette modification ?", + "couldNotFindMatchingLM": "Il n'a pas été possible de trouver un modèle linguistique correspondant. Veuillez vérifier votre configuration !", + "couldNotFindReadyLMforAgent": "Impossible de trouver un modèle linguistique prêt pour l'agent {0}. Veuillez vérifier votre configuration !", + "defaultAgent": { + "description": "Facultatif : de l'agent conversationnel qui sera invoqué, si aucun agent n'est explicitement mentionné avec @ dans la requête de l'utilisateur. Si aucun agent par défaut n'est configuré, les valeurs par défaut de Theia seront appliquées." + }, + "imageContextVariable": { + "args": { + "data": { + "description": "Les données de l'image en base64." + }, + "mimeType": { + "description": "Le type d'image (mimetype) de l'image." + }, + "name": { + "description": "Le nom du fichier image, s'il est disponible." + }, + "wsRelativePath": { + "description": "Le chemin relatif à l'espace de travail du fichier image, s'il est disponible." + } + }, + "description": "Fournit des informations contextuelles pour une image", + "label": "Fichier image" + }, + "orchestrator": { + "description": "Cet agent analyse la demande de l'utilisateur par rapport à la description de tous les agents de chat disponibles et sélectionne l'agent le mieux adapté pour répondre à la demande (en utilisant l'IA).", + "vars": { + "availableChatAgents": { + "description": "La liste des agents de chat auxquels l'orchestrateur peut déléguer, à l'exclusion des agents spécifiés dans la préférence de liste d'exclusion." + } + } + }, + "pinChatAgent": { + "description": "Activez l'épinglage d'agent pour maintenir automatiquement actif un agent de chat mentionné à travers les invites, réduisant ainsi le besoin de mentions répétées." + }, + "revertSuggestion": "Revenir sur la suggestion", + "selectImageFile": "Sélectionner un fichier image", + "sessionStorage": { + "description": "Configurez l'emplacement de stockage des sessions de chat.", + "globalPath": "Chemin global", + "pathNotUsedForScope": "Non utilisé avec la portée de stockage d'{0}.", + "pathRequired": "Le chemin ne peut pas être vide.", + "pathSettings": "Paramètres du chemin", + "resetToDefault": "Réinitialiser les paramètres par défaut", + "scope": { + "global": "Stocker les sessions de chat dans le dossier de configuration global.", + "workspace": "Enregistrer les sessions de chat dans le dossier de l'espace de travail." + }, + "workspacePath": "Chemin d'accès à l'espace de travail" + }, + "taskContextService": { + "summarizeProgressMessage": "Résumez : {0}", + "updatingProgressMessage": "Mise à jour : {0}" + }, + "toolConfirmation": { + "confirm": { + "description": "Demander une confirmation avant d'exécuter les outils" + }, + "disabled": { + "description": "Désactiver l'exécution de l'outil" + }, + "yolo": { + "description": "Exécuter des outils automatiquement sans confirmation" + } + }, + "view": { + "label": "Chat sur l'IA" + } + }, + "chat-ui": { + "addContextVariable": "Ajouter une variable contextuelle", + "agent": "Agent", + "aiDisabled": "Les fonctions d'intelligence artificielle sont désactivées", + "applyAll": "Appliquer tout", + "applyAllTitle": "Appliquer toutes les modifications en cours", + "askQuestion": "Posez une question", + "attachToContext": "Attacher des éléments au contexte", + "cancel": "Annuler (Esc)", + "chat-view-tree-widget": { + "ai": "AI", + "aiFeatureHeader": "🚀 Fonctionnalités AI disponibles (version Alpha) !", + "featuresDisabled": "Actuellement, toutes les fonctionnalités de l'IA sont désactivées !", + "generating": "Génération", + "howToEnable": "Comment activer les fonctions d'intelligence artificielle :", + "noRenderer": "Erreur : Aucun moteur de rendu n'a été trouvé", + "scrollToBottom": "Aller au dernier message", + "waitingForInput": "En attente d'une contribution", + "you": "Vous" + }, + "chatInput": { + "clearHistory": "Effacer l'historique des invites de saisie", + "cycleMode": "Mode Cycle Chat", + "nextPrompt": "Next Prompt", + "previousPrompt": "Prompt précédent" + }, + "chatInputAriaLabel": "Tapez votre message ici", + "chatResponses": "Réponses au chat", + "code-part-renderer": { + "generatedCode": "Code généré" + }, + "collapseChangeSet": "Réduire l'ensemble de modifications", + "command-part-renderer": { + "commandNotExecutable": "La commande a pour identifiant \"{0}\" mais elle n'est pas exécutable depuis la fenêtre de chat." + }, + "copyCodeBlock": "Copier le bloc de code", + "couldNotSendRequestToSession": "Il n'a pas été possible d'envoyer la requête \"{0}\" à la session. {1}", + "delegation-response-renderer": { + "prompt": { + "label": "Demande déléguée :" + }, + "response": { + "label": "Réponse :" + }, + "starting": "Délégation de démarrage...", + "status": { + "canceled": "annulé", + "error": "erreur", + "generating": "générant...", + "starting": "commencer..." + } + }, + "deleteChangeSet": "Supprimer Modifier Définir", + "editRequest": "Editer", + "edited": "édité", + "editedTooltipHint": "Cette variante d'invite a été modifiée. Vous pouvez la réinitialiser dans la vue Configuration de l'IA.", + "enterChatName": "Saisir le nom du chat", + "errorChatInvocation": "Une erreur s'est produite lors de l'invocation du service de chat.", + "expandChangeSet": "Développer l'ensemble de modifications", + "failedToDeleteSession": "Échec de la suppression de la session de chat", + "failedToLoadChats": "Échec du chargement des sessions de chat", + "failedToRestoreSession": "Échec de la restauration de la session de chat", + "failedToRetry": "Échec du message de réessai", + "focusInput": "Entrée de chat ciblée", + "focusResponse": "Réponse au chat ciblé", + "noChatAgentsAvailable": "Il n'y a pas d'agents de chat disponibles.", + "openDiff": "Diff ouvert", + "openOriginalFile": "Ouvrir le fichier original", + "performThisTask": "Effectuez cette tâche.", + "persistedSession": "Session persistante (cliquer pour restaurer)", + "removeChat": "Supprimer le chat", + "renameChat": "Renommer le chat", + "requestNotFoundForRetry": "Demande non trouvée pour une nouvelle tentative", + "responseFrom": "Réponse d'{0}", + "selectAgentQuickPickPlaceholder": "Sélectionner un agent pour la nouvelle session", + "selectChat": "Sélectionner le chat", + "selectContextVariableQuickPickPlaceholder": "Sélectionner une variable contextuelle à attacher au message", + "selectTaskContextQuickPickItem": { + "currentlyOpen": "actuellement ouvert" + }, + "selectTaskContextQuickPickPlaceholder": "Sélectionner un contexte de tâche à attacher", + "selectVariableArguments": "Sélectionner les arguments de la variable", + "send": "Envoyer (Enter)", + "sessionNotFoundForRetry": "Session non trouvée pour une nouvelle tentative", + "text-part-renderer": { + "cantDisplay": "Impossible d'afficher la réponse, veuillez vérifier vos ChatResponsePartRenderers !" + }, + "thinking-part-renderer": { + "thinking": "Réflexion" + }, + "toolcall-part-renderer": { + "denied": "Exécution refusée", + "finished": "Ran", + "rejected": "Exécution annulée" + }, + "toolconfirmation": { + "allow-options-dropdown-tooltip": "Plus d'options d'allocation", + "allow-session": "Permettre ce chat", + "allowed": "Exécution de l'outil autorisée", + "alwaysAllowConfirm": "Je comprends, activer l'approbation automatique", + "alwaysAllowTitle": "Activer l'approbation automatique pour « {0} » ?", + "canceled": "Exécution de l'outil annulée", + "denied": "Exécution de l'outil refusée", + "deny-forever": "Toujours refuser", + "deny-options-dropdown-tooltip": "Plus d'options de refus", + "deny-reason-placeholder": "Entrez la raison du refus...", + "deny-session": "Refus pour ce chat", + "deny-with-reason": "Refuser avec raison...", + "executionDenied": "Exécution de l'outil refusée", + "header": "Confirmer l'exécution de l'outil" + }, + "unableToSummarizeCurrentSession": "Impossible de résumer la session en cours. Veuillez confirmer que l'agent de synthèse n'est pas désactivé.", + "unknown-part-renderer": { + "contentNotRestoreable": "Ce contenu (type '{0}') n'a pas pu être entièrement restauré. Il peut provenir d'une extension qui n'est plus disponible." + }, + "unpinAgent": "Agent non épinglé", + "variantTooltip": "Variante rapide : {0}", + "yourMessage": "Votre message" + }, + "claude-code": { + "agentDescription": "L'agent de codage d'Anthropic", + "askBeforeEdit": "Demander avant de modifier", + "changeSetTitle": "Changements par code Claude", + "clearCommand": { + "description": "Créer une nouvelle session" + }, + "compactCommand": { + "description": "Conversation compacte avec instructions de mise au point optionnelles" + }, + "completedCount": "{0}/{1} complété", + "configCommand": { + "description": "Open Claude Code Configuration" + }, + "currentDirectory": "répertoire actuel", + "differentAgentRequestWarning": "La demande de chat précédente a été traitée par un autre agent. Claude Code ne voit pas ces autres messages.", + "directory": "Annuaire", + "domain": "Domain", + "editAutomatically": "Modifier automatiquement", + "editNumber": "Editer {0}", + "editing": "Édition", + "editsCount": "{0} éditions", + "emptyTodoList": "Pas tous disponibles", + "entireFile": "Dossier complet", + "excludingOnePattern": " (à l'exception d'un modèle)", + "excludingPatterns": " (à l'exclusion des motifs {0} )", + "executedCommand": "Exécuté : {0}", + "failedToParseBashToolData": "Échec de l'analyse des données de l'outil Bash", + "failedToParseEditToolData": "Échec de l'analyse des données de l'outil Edit", + "failedToParseGlobToolData": "Échec de l'analyse des données de l'outil Glob", + "failedToParseGrepToolData": "Échec de l'analyse des données de l'outil Grep", + "failedToParseLSToolData": "Échec de l'analyse des données de l'outil LS", + "failedToParseMultiEditToolData": "Échec de l'analyse des données de l'outil MultiEdit", + "failedToParseReadToolData": "Échec de l'analyse des données de l'outil de lecture", + "failedToParseTodoListData": "Échec de l'analyse des données de la liste des tâches", + "failedToParseWebFetchToolData": "Échec de l'analyse des données de l'outil WebFetch", + "failedToParseWriteToolData": "Échec de l'analyse des données de l'outil d'écriture", + "fetching": "Recherche", + "fileFilter": "Filtre à fichiers", + "filePath": "File Path", + "fileType": "Type de fichier", + "findMatchingFiles": "Recherche des fichiers correspondant au motif global \"{0}\" dans le répertoire actuel", + "findMatchingFilesWithPath": "Recherche des fichiers correspondant au motif global \"{0}\" à l'intérieur de {1}", + "finding": "Recherche", + "from": "De", + "globPattern": "modèle global", + "grepOptions": { + "caseInsensitive": "insensible à la casse", + "glob": "globe : {0}", + "headLimit": "limite : {0}", + "lineNumbers": "numéros de ligne", + "linesAfter": "+{0} après", + "linesBefore": "+{0} avant", + "linesContext": "±{0} contexte", + "multiLine": "multiligne", + "type": "type : {0}" + }, + "grepOutputModes": { + "content": "contenu", + "count": "compter", + "filesWithMatches": "fichiers avec correspondance" + }, + "ignoredPatterns": "Modèles ignorés", + "ignoringPatterns": "Ignorer les schémas de {0} ", + "initCommand": { + "description": "Initialiser le projet avec le guide CLAUDE.md" + }, + "itemCount": "{0} articles", + "lineLimit": "Limite de la ligne", + "lines": "Lignes", + "listDirectoryContents": "Lister le contenu d'un répertoire", + "listing": "Liste", + "memoryCommand": { + "description": "Modifier le fichier mémoire CLAUDE.md" + }, + "multiEditing": "Multi-édition", + "oneEdit": "1 édition", + "oneItem": "1 article", + "oneOption": "1 option", + "openDirectoryTooltip": "Cliquer pour ouvrir le répertoire", + "openFileTooltip": "Cliquer pour ouvrir le fichier dans l'éditeur", + "optionsCount": "{0} options", + "partial": "Partiel", + "pattern": "Modèle", + "plan": "Mode plan", + "project": "projet", + "projectRoot": "racine du projet", + "readMode": "Mode lecture", + "reading": "Lecture", + "replaceAllCount": "{0} remplacer tout", + "replaceAllOccurrences": "Remplacer toutes les occurrences", + "resumeCommand": { + "description": "Reprendre une session" + }, + "reviewCommand": { + "description": "Request code review" + }, + "searchPath": "Chemin de recherche", + "searching": "Recherche", + "startingLine": "Ligne de départ", + "timeout": "Délai d'attente", + "timeoutInMs": "Délai d'attente : {0}ms", + "to": "Pour", + "todoList": "Liste des tâches", + "todoPriority": { + "high": "élevé", + "low": "faible", + "medium": "moyen" + }, + "toolApprovalRequest": "Claude Code souhaite utiliser l'outil \"{0}\". Voulez-vous l'autoriser ?", + "totalEdits": "Total des modifications", + "webFetch": "Web Fetch", + "writing": "Rédaction" + }, + "code-completion": { + "progressText": "Calcul de l'achèvement du code de l'IA..." + }, + "codex": { + "agentDescription": "Assistant de codage d'OpenAI optimisé par Codex", + "completedCount": "{0}/{1} terminé", + "exitCode": "Code de sortie : {0}", + "fileChangeFailed": "Codex n'a pas appliqué les modifications pour : {0}", + "fileChangeFailedGeneric": "Codex n'a pas réussi à appliquer les modifications apportées au fichier.", + "itemCount": "{0} articles", + "noItems": "Aucun élément", + "oneItem": "1 article", + "running": "En cours...", + "searched": "Recherché", + "searching": "Recherche", + "todoList": "Liste complète", + "webSearch": "Web Search" + }, + "completion": { + "agent": { + "description": "Cet agent permet de compléter le code en ligne dans l'éditeur de code de l'IDE Theia.", + "vars": { + "file": { + "description": "L'URI du fichier en cours d'édition" + }, + "language": { + "description": "L'identifiant de la langue du fichier en cours d'édition" + }, + "prefix": { + "description": "Le code précédant la position actuelle du curseur" + }, + "suffix": { + "description": "Le code après la position actuelle du curseur" + } + } + }, + "automaticEnable": { + "description": "Déclencher automatiquement des compléments AI en ligne dans n'importe quel éditeur (Monaco) pendant l'édition. \n Vous pouvez également déclencher manuellement le code via la commande \"Trigger Inline Suggestion\" ou le raccourci par défaut \"Ctrl+Alt+Espace\"." + }, + "cacheCapacity": { + "description": "Nombre maximum de complétions de code à stocker dans le cache. Un nombre plus élevé peut améliorer les performances mais consommera plus de mémoire. La valeur minimale est de 10, la valeur recommandée se situe entre 50 et 200.", + "title": "Capacité du cache de complétion du code" + }, + "debounceDelay": { + "description": "Contrôle le délai en millisecondes avant de déclencher les complétions AI après que des changements aient été détectés dans l'éditeur. Nécessite que la fonction `Automatic Code Completion` soit activée. Entrez 0 pour désactiver le délai d'attente.", + "title": "Délai de rebond" + }, + "excludedFileExts": { + "description": "Indiquer les extensions de fichiers (par exemple, .md, .txt) dans lesquelles les compléments AI doivent être désactivés.", + "title": "Extensions de fichiers exclues" + }, + "fileVariable": { + "description": "L'URI du fichier en cours d'édition. Uniquement disponible dans le contexte de l'achèvement du code." + }, + "languageVariable": { + "description": "L'identifiant de la langue du fichier en cours d'édition. Uniquement disponible dans le contexte de l'achèvement du code." + }, + "maxContextLines": { + "description": "Le nombre maximum de lignes utilisées comme contexte, réparties entre les lignes avant et après la position du curseur (préfixe et suffixe). Définissez cette valeur à -1 pour utiliser le fichier complet comme contexte sans limite de lignes et à 0 pour n'utiliser que la ligne en cours.", + "title": "Lignes de contexte maximales" + }, + "prefixVariable": { + "description": "Le code précédant la position actuelle du curseur. Uniquement disponible dans le contexte de l'achèvement du code." + }, + "stripBackticks": { + "description": "Suppression des bâtons entourant le code renvoyé par certains LLM. Si un bâton est détecté, tout le contenu après le bâton de fermeture est également supprimé. Ce paramètre permet de s'assurer que le code renvoyé est clair lorsque les modèles de langage utilisent un formatage de type \"markdown\".", + "title": "Supprimer les marques de retour des achèvements en ligne" + }, + "suffixVariable": { + "description": "Le code après la position actuelle du curseur. Uniquement disponible dans le contexte de l'achèvement du code." + } + }, + "configuration": { + "selectItem": "Veuillez sélectionner un élément." + }, + "copilot": { + "auth": { + "aiConfiguration": "AI Configuration", + "authorize": "J'ai autorisé", + "copied": "Copié !", + "copyCode": "Copier le code", + "expired": "L'autorisation a expiré ou a été refusée. Veuillez réessayer.", + "hint": "Après avoir saisi le code et donné votre autorisation, cliquez sur « J'ai donné mon autorisation » ci-dessous.", + "initiating": "Authentification en cours...", + "instructions": "Pour autoriser Theia à utiliser GitHub Copilot, rendez-vous à l'URL ci-dessous et entrez le code :", + "openGitHub": "Ouvrir GitHub", + "success": "Connexion à GitHub Copilot réussie !", + "successHint": "Si votre compte GitHub a accès à Copilot, vous pouvez désormais configurer les modèles linguistiques Copilot dans le ", + "title": "Connectez-vous à GitHub Copilot", + "tos": "En vous connectant, vous acceptez les ", + "tosLink": "Conditions d'utilisation de GitHub", + "verifying": "Vérification de l'autorisation..." + }, + "category": "Copilote", + "commands": { + "signIn": "Connectez-vous à GitHub Copilot", + "signOut": "Se déconnecter de GitHub Copilot" + }, + "enterpriseUrl": { + "mdDescription": "Domaine GitHub Enterprise pour l'API Copilot (par exemple, `github.mycompany.com`). Laissez vide pour GitHub.com." + }, + "models": { + "description": "Modèles GitHub Copilot à utiliser. Les modèles disponibles dépendent de votre abonnement Copilot." + }, + "statusBar": { + "signedIn": "Connecté à GitHub Copilot en tant qu'{0}. Cliquez pour vous déconnecter.", + "signedOut": "Vous n'êtes pas connecté à GitHub Copilot. Cliquez ici pour vous connecter." + } + }, + "core": { + "agentConfiguration": { + "actions": "Actions", + "addCustomAgent": "Ajouter un agent personnalisé", + "enableAgent": "Activer l'agent", + "label": "Agents", + "llmRequirements": "Exigences du LLM", + "notUsedInPrompt": "Non utilisé dans l'invite", + "promptTemplates": "Modèles d'invites", + "selectAgentMessage": "Veuillez d'abord sélectionner un agent !", + "templateName": "Modèle", + "undeclared": "Non déclaré", + "usedAgentSpecificVariables": "Variables spécifiques à l'agent utilisées", + "usedFunctions": "Fonctions utilisées", + "usedGlobalVariables": "Variables globales utilisées", + "variant": "Variante" + }, + "agentsVariable": { + "description": "Retourne la liste des agents disponibles dans le système" + }, + "aiConfiguration": { + "label": "✨ Configuration AI [Alpha]" + }, + "blinkTitle": { + "agentCompleted": "Theia - Agent terminé", + "namedAgentCompleted": "Theia - Agent \"{0}\" Terminé" + }, + "changeSetSummaryVariable": { + "description": "Fournit un résumé des fichiers d'un ensemble de modifications et de leur contenu." + }, + "contextDetailsVariable": { + "description": "Fournit des valeurs et des descriptions en texte intégral pour tous les éléments de contexte." + }, + "contextSummaryVariable": { + "description": "Décrit les fichiers dans le contexte d'une session donnée." + }, + "customAgentTemplate": { + "description": "Il s'agit d'un exemple d'agent. Veuillez adapter les propriétés à vos besoins." + }, + "defaultModelAliases": { + "code": { + "description": "Optimisé pour les tâches de compréhension et de génération de code." + }, + "code-completion": { + "description": "Convient mieux aux scénarios d'autocomplétion de code." + }, + "summarize": { + "description": "Modèles classés par ordre de priorité pour la synthèse et la condensation du contenu." + }, + "universal": { + "description": "Bien équilibré pour l'utilisation du code et de la langue générale." + } + }, + "defaultNotification": { + "mdDescription": "Méthode de notification par défaut utilisée lorsqu'un agent IA termine une tâche. Les agents individuels peuvent modifier ce paramètre.\n - `os-notification` : Affiche les notifications de l'OS/du système\n - `message` : Affiche les notifications dans la barre d'état/la zone de message.\n - `blink` : Fait clignoter ou met en évidence l'interface utilisateur\n - `off` : Désactive toutes les notifications", + "title": "Type de notification par défaut" + }, + "discard": { + "label": "Modèle d'invite AI à jeter" + }, + "discardCustomPrompt": { + "tooltip": "Rejeter les personnalisations" + }, + "fileVariable": { + "description": "Résout le contenu d'un fichier", + "uri": { + "description": "L'URI du fichier demandé." + } + }, + "languageModelRenderer": { + "alias": "[alias] {0}", + "languageModel": "Modèle linguistique", + "purpose": "Objectif" + }, + "maxRetries": { + "mdDescription": "Nombre maximal de tentatives en cas d'échec d'une requête auprès d'un fournisseur d'IA. Une valeur de 0 signifie qu'il n'y a pas de tentatives.", + "title": "Nombre maximal de tentatives" + }, + "modelAliasesConfiguration": { + "agents": "Agents utilisant cet alias", + "defaultList": "[Liste par défaut]", + "evaluatesTo": "Évalue à", + "label": "Alias de modèle", + "modelNotReadyTooltip": "Pas prêt", + "modelReadyTooltip": "Prêt", + "noAgents": "Aucun agent n'utilise cet alias.", + "noModelReadyTooltip": "Pas de modèle prêt", + "noResolvedModel": "Aucun modèle n'est prêt pour cet alias.", + "priorityList": "Liste des priorités", + "selectAlias": "Veuillez sélectionner un alias de modèle.", + "selectedModelId": "Modèle sélectionné", + "unavailableModel": "Le modèle sélectionné n'est plus disponible" + }, + "noVariableFoundForOpenRequest": "Aucune variable n'a été trouvée pour la demande ouverte.", + "openEditorsShortVariable": { + "description": "Référence courte à tous les fichiers actuellement ouverts (chemins relatifs, séparés par des virgules)" + }, + "openEditorsVariable": { + "description": "Liste séparée par des virgules de tous les fichiers actuellement ouverts, par rapport à la racine de l'espace de travail." + }, + "preference": { + "languageModelAliases": { + "description": "Configurez les modèles pour chaque alias de modèle de langue dans la [Vue de configuration AI] ({0}). Vous pouvez également définir les paramètres manuellement dans le fichier settings.json : \n```\n\"default/code\" : {\n \"selectedModel\" : \"anthropic/claude-opus-4-20250514\"\n}\n```", + "selectedModel": "Le modèle sélectionné par l'utilisateur pour cet alias.", + "title": "Alias du modèle de langue" + } + }, + "prefs": { + "title": "Fonctionnalités de l'IA [Alpha]" + }, + "promptFragmentsConfiguration": { + "activeCustomizationTitle": "Personnalisation active", + "createCustomizationTitle": "Créer une personnalisation", + "customization": "personnalisation", + "customizationLabel": "Personnalisation", + "defaultVariantTitle": "Variante par défaut", + "deleteCustomizationTitle": "Supprimer la personnalisation", + "editTemplateTitle": "Edit template", + "headerTitle": "Fragments de messages", + "label": "Fragments de messages", + "noFragmentsAvailable": "Il n'y a pas de fragments disponibles.", + "otherPromptFragmentsHeader": "Autres fragments de messages", + "promptTemplateText": "Texte du modèle d'invite", + "promptVariantsHeader": "Variantes de l'appel à témoins", + "removeCustomizationDialogMsg": "Êtes-vous sûr de vouloir supprimer la personnalisation {0} pour le fragment d'invite \"{1}\" ?", + "removeCustomizationDialogTitle": "Supprimer la personnalisation", + "removeCustomizationWithDescDialogMsg": "Êtes-vous sûr de vouloir supprimer la personnalisation de {0} pour le fragment d'invite \"{1}\" ({2}) ?", + "resetAllButton": "Réinitialiser tout", + "resetAllCustomizationsDialogMsg": "Êtes-vous sûr de vouloir réinitialiser tous les fragments d'invite à leur version d'origine ? Cela supprimera toutes les personnalisations.", + "resetAllCustomizationsDialogTitle": "Réinitialiser toutes les personnalisations", + "resetAllCustomizationsTitle": "Réinitialiser toutes les personnalisations", + "resetAllPromptFragments": "Réinitialiser tous les fragments d'invite", + "resetToBuiltInDialogMsg": "Êtes-vous sûr de vouloir réinitialiser le fragment d'invite \"{0}\" à sa version intégrée ? Cela supprimera toutes les personnalisations.", + "resetToBuiltInDialogTitle": "Remise à l'état initial", + "resetToBuiltInTitle": "Réinitialisation à cette valeur intégrée", + "resetToCustomizationDialogMsg": "Êtes-vous sûr de vouloir réinitialiser le fragment d'invite \"{0}\" pour utiliser la personnalisation {1}? Cela supprimera toutes les personnalisations prioritaires.", + "resetToCustomizationDialogTitle": "Réinitialisation à la personnalisation", + "resetToCustomizationTitle": "Réinitialiser cette personnalisation", + "selectedVariantLabel": "Sélectionné", + "selectedVariantTitle": "Variante sélectionnée", + "usedByAgentTitle": "Utilisé par l'agent : {0}", + "variantSetError": "La variante sélectionnée n'existe pas et aucune valeur par défaut n'a pu être trouvée. Veuillez vérifier votre configuration.", + "variantSetWarning": "La variante sélectionnée n'existe pas. La variante par défaut est utilisée à la place.", + "variantsOfSystemPrompt": "Variantes de ce jeu de variantes de l'invite :" + }, + "promptTemplates": { + "description": "Dossier permettant de stocker les modèles d'invite personnalisés. S'il n'est pas personnalisé, le répertoire de configuration de l'utilisateur est utilisé. Pensez à utiliser un dossier sous contrôle de version pour gérer vos variantes de modèles d'invite.", + "openLabel": "Sélectionner un dossier" + }, + "promptVariable": { + "argDescription": "L'identifiant du modèle d'invite à résoudre", + "completions": { + "detail": { + "builtin": "Fragment d'invite intégré", + "custom": "Fragment d'invite personnalisé" + } + }, + "description": "Résout les modèles d'invite via le service d'invite" + }, + "prompts": { + "category": "Theia AI Prompt Templates" + }, + "requestSettings": { + "clientSettings": { + "description": "Paramètres du client pour le traitement des messages renvoyés à l'IMT.", + "keepThinking": { + "description": "Si la valeur est fixée à false, tous les résultats de la réflexion seront filtrés avant l'envoi de la demande suivante de l'utilisateur dans une conversation à plusieurs tours." + }, + "keepToolCalls": { + "description": "Si la valeur est fixée à false, toutes les demandes et réponses d'outils seront filtrées avant d'envoyer la demande suivante de l'utilisateur dans une conversation multi-tours." + } + }, + "mdDescription": "Permet de spécifier des paramètres de demande personnalisés pour plusieurs modèles.\n Chaque objet représente la configuration d'un modèle spécifique. Le champ `modelId` spécifie l'ID du modèle, `requestSettings` définit les paramètres spécifiques au modèle.\n Le champ `providerId` est optionnel et vous permet d'appliquer les paramètres à un fournisseur spécifique. S'il n'est pas renseigné, les paramètres seront appliqués à tous les fournisseurs.\n Exemples de providerIds : huggingface, openai, ollama, llamafile.\n Pour plus d'informations, consultez [notre documentation] (https://theia-ide.org/docs/user_ai/#custom-request-settings).", + "modelSpecificSettings": { + "description": "Paramètres pour l'ID de modèle spécifique." + }, + "scope": { + "agentId": { + "description": "L'identifiant de l'agent (facultatif) auquel les paramètres doivent être appliqués." + }, + "modelId": { + "description": "L'identifiant du modèle (facultatif)" + }, + "providerId": { + "description": "L'identifiant du fournisseur (facultatif) auquel les paramètres doivent être appliqués." + } + }, + "title": "Paramètres des demandes personnalisées" + }, + "skillsVariable": { + "description": "Renvoie la liste des compétences disponibles pouvant être utilisées par les agents IA." + }, + "taskContextSummary": { + "description": "Résout tous les éléments du contexte de la tâche présents dans le contexte de la session." + }, + "templateSettings": { + "edited": "édité", + "unavailableVariant": "La variante sélectionnée n'est plus disponible" + }, + "todayVariable": { + "description": "Fait quelque chose pour aujourd'hui", + "format": { + "description": "Le format de la date" + } + }, + "unableToDisplayVariableValue": "Impossible d'afficher la valeur de la variable.", + "unableToResolveVariable": "Impossible de résoudre la variable.", + "variable-contribution": { + "builtInVariable": "Theia Variable intégré", + "currentAbsoluteFilePath": "Le chemin absolu du fichier actuellement ouvert. Veuillez noter que la plupart des agents attendent un chemin d'accès relatif (par rapport à l'espace de travail actuel).", + "currentFileContent": "Le contenu brut du fichier actuellement ouvert. Cela exclut les informations sur la provenance du contenu. Veuillez noter que la plupart des agents fonctionneront mieux avec un chemin de fichier relatif (relatif à l'espace de travail actuel).", + "currentRelativeDirPath": "Le chemin relatif du répertoire contenant le fichier actuellement ouvert.", + "currentRelativeFilePath": "Le chemin relatif du fichier actuellement ouvert.", + "currentSelectedText": "Le texte en clair actuellement sélectionné dans le fichier ouvert. Cela exclut les informations sur l'origine du contenu. Veuillez noter que la plupart des agents fonctionneront mieux avec un chemin de fichier relatif (relatif à l'espace de travail actuel).", + "dotRelativePath": "Courte référence au chemin relatif du fichier actuellement ouvert (\"currentRelativeFilePath\")." + } + }, + "editor": { + "editorContextVariable": { + "description": "Résout les informations contextuelles spécifiques à l'éditeur", + "label": "EditorContext" + }, + "explainWithAI": { + "prompt": "Expliquez cette erreur", + "title": "Expliquer avec l'IA" + }, + "fixWithAI": { + "prompt": "Aide à la résolution de cette erreur" + } + }, + "google": { + "apiKey": { + "description": "Saisissez la clé API de votre compte officiel Google AI (Gemini). **Remarque : En utilisant cette préférence, la clé API de GOOGLE AI sera stockée en clair sur la machine qui exécute Theia. Utilisez la variable d'environnement `GOOGLE_API_KEY` pour définir la clé de manière sécurisée." + }, + "maxRetriesOnErrors": { + "description": "Nombre maximal de tentatives en cas d'erreur. S'il est inférieur à 1, la logique de réessai est désactivée." + }, + "models": { + "description": "Modèles officiels de Google Gemini à utiliser" + }, + "retryDelayOnOtherErrors": { + "description": "Délai en secondes entre les tentatives en cas d'autres erreurs (il arrive que Google GenAI signale des erreurs telles qu'une syntaxe JSON incomplète renvoyée par le modèle ou une erreur de serveur interne 500). La valeur -1 permet d'éviter les tentatives dans ces cas. Dans le cas contraire, une nouvelle tentative a lieu soit immédiatement (si la valeur est 0), soit après ce délai en secondes (si la valeur est positive)." + }, + "retryDelayOnRateLimitError": { + "description": "Délai en secondes entre les tentatives en cas d'erreurs de limite de débit. Voir https://ai.google.dev/gemini-api/docs/rate-limits" + } + }, + "history": { + "clear": { + "tooltip": "Historique clair de tous les agents" + }, + "exchange-card": { + "agentId": "Agent", + "timestamp": "Commencé" + }, + "open-history-tooltip": "L'histoire de l'IA ouverte...", + "request-card": { + "agent": "Agent", + "model": "Modèle", + "request": "Request", + "response": "Réponse", + "timestamp": "Horodatage", + "title": "Request" + }, + "sortChronologically": { + "tooltip": "Trier par ordre chronologique" + }, + "sortReverseChronologically": { + "tooltip": "Tri chronologique inversé" + }, + "toggleCompact": { + "tooltip": "Afficher la vue compacte" + }, + "toggleHideNewlines": { + "tooltip": "Arrêt de l'interprétation des nouvelles lignes" + }, + "toggleRaw": { + "tooltip": "Afficher la vue brute" + }, + "toggleRenderNewlines": { + "tooltip": "Interpréter les nouvelles lignes" + }, + "view": { + "label": "Historique de l'agent d'IA [Alpha]", + "noAgent": "Aucun agent n'est disponible.", + "noAgentSelected": "Aucun agent n'a été sélectionné.", + "noHistoryForAgent": "Aucun historique n'est disponible pour l'agent sélectionné '{0}'" + } + }, + "huggingFace": { + "apiKey": { + "mdDescription": "Entrez une clé API pour votre compte Hugging Face. **Remarque : En utilisant cette préférence, la clé API de Hugging Face sera stockée en clair sur la machine qui exécute Theia. Utilisez la variable d'environnement `HUGGINGFACE_API_KEY` pour définir la clé en toute sécurité." + }, + "models": { + "mdDescription": "Modèles Hugging Face à utiliser. **Remarque :** seuls les modèles prenant en charge l'API de complétion de chat sont actuellement pris en charge (modèles optimisés pour les instructions tels que « *-Instruct »). Certains modèles peuvent nécessiter l'acceptation des conditions de licence sur le site Web Hugging Face." + } + }, + "ide": { + "agent-description": "Configurez les paramètres de l'agent AI, y compris l'activation, la sélection LLM, la personnalisation du modèle d'invite et la création d'un agent personnalisé dans la [Vue de configuration AI] ({0}).", + "agentConfiguration": { + "customAgentLocationQuickPick": { + "createNewFile": "Créer un nouveau fichier", + "openExistingFile": "Ouvrir un fichier existant", + "placeholder": "Choisir l'endroit où créer ou ouvrir un fichier d'agents personnalisés", + "title": "Sélection de l'emplacement du fichier des agents personnalisés" + }, + "noDescription": "Aucune description disponible" + }, + "app-tester": { + "errorCheckingDevToolsServerStatus": "Erreur lors de la vérification de l'état du serveur DevTools MCP : {0}", + "errorCheckingPlaywrightServerStatus": "Erreur de vérification de l'état du serveur Playwright MCP : {0}", + "startChromeDevToolsMcpServers": { + "canceled": "Veuillez configurer le serveur MCP Chrome DevTools.", + "error": "Échec du démarrage du serveur MCP Chrome DevTools : {0}", + "progress": "Démarrage du serveur MCP Chrome DevTools.", + "question": "Le serveur Chrome DevTools MCP n'est pas en cours d'exécution. Souhaitez-vous le démarrer maintenant ? Cela peut entraîner l'installation du serveur Chrome DevTools MCP." + }, + "startMcpServers": { + "no": "Non, annuler", + "yes": "Oui, démarrez les serveurs." + }, + "startPlaywrightServers": { + "canceled": "Veuillez configurer les serveurs MCP.", + "error": "Échec du démarrage du serveur Playwright MCP : {0}", + "progress": "Démarrage des serveurs Playwright MCP.", + "question": "Les serveurs Playwright MCP ne sont pas en cours d'exécution. Voulez-vous les démarrer maintenant ? Cette opération peut installer les serveurs Playwright MCP." + } + }, + "architectAgent": { + "mode": { + "default": "Mode par défaut", + "plan": "Plan Mode", + "simple": "Simple Mode" + }, + "suggestion": { + "executePlanWithCoder": "Exécutez « {0} » avec Coder.", + "summarizeSessionAsTaskForCoder": "Résumer cette session sous forme de tâche pour le codeur", + "updateTaskContext": "Mise à jour du contexte de la tâche en cours" + } + }, + "bypassHint": "Certains agents comme Claude Code ne nécessitent pas les modèles linguistiques Theia.", + "chatDisabledMessage": { + "featuresTitle": "Vues et fonctionnalités actuellement prises en charge :" + }, + "coderAgent": { + "mode": { + "agentNext": "Mode Agent (Suivant)", + "edit": "Mode édition" + }, + "suggestion": { + "fixProblems": { + "content": "[Corriger les problèmes]({0}) dans le fichier en cours.", + "prompt": "veuillez consulter le site {1} et corriger les problèmes éventuels." + }, + "startNewChat": "Faites en sorte que les discussions soient courtes et ciblées. [Commencez une nouvelle discussion ({0}) pour une nouvelle tâche ou commencez une nouvelle discussion avec un résumé de celle-ci ({1})." + } + }, + "commandAgent": { + "commandCallback": { + "confirmAction": "Je l'ai", + "label": "Commande de l'IA" + }, + "response": { + "customHandler": "Essayez d'exécuter ceci :", + "noCommand": "Désolé, je ne trouve pas cette commande.", + "theiaCommand": "J'ai trouvé cette commande qui pourrait vous aider :" + }, + "vars": { + "commandIds": { + "description": "La liste des commandes disponibles dans Theia." + } + } + }, + "configureAgent": { + "header": "Configurer un agent par défaut" + }, + "continueAnyway": "Continuer quand même", + "createSkillAgent": { + "mode": { + "edit": "Mode par défaut" + } + }, + "enableAI": { + "mdDescription": "❗ Ce paramètre vous permet d'accéder aux dernières fonctionnalités de l'IA (version bêta). \n Veuillez noter que ces fonctionnalités sont en phase bêta, ce qui signifie qu'elles peuvent subir des modifications et qu'elles seront encore améliorées. Il est important de savoir que ces fonctionnalités peuvent générer des requêtes continues aux modèles linguistiques (LLM) auxquels vous donnez accès. Cela peut entraîner des coûts que vous devez surveiller de près. En activant cette option, vous reconnaissez ces risques. \n **Remarque ! Les paramètres ci-dessous dans cette section ne prendront effet qu'une fois que le paramètre de la fonctionnalité principale sera activé.\n qu'une fois que la fonction principale est activée. Après avoir activé la fonction, vous devez configurer au moins un fournisseur LLM ci-dessous. Consultez également [la documentation] (https://theia-ide.org/docs/user_ai/)**." + }, + "github": { + "configureGitHubServer": { + "canceled": "La configuration du serveur GitHub a été annulée. Veuillez configurer le serveur GitHub MCP pour utiliser cet agent.", + "no": "Non, annuler", + "yes": "Oui, configurer le serveur GitHub" + }, + "errorCheckingGitHubServerStatus": "Erreur de vérification de l'état du serveur GitHub MCP : {0}", + "startGitHubServer": { + "canceled": "Veuillez démarrer le serveur GitHub MCP pour utiliser cet agent.", + "error": "Échec du démarrage du serveur GitHub MCP : {0}", + "no": "Non, annuler", + "progress": "Démarrage du serveur GitHub MCP.", + "question": "Le serveur GitHub MCP est configuré mais ne fonctionne pas. Voulez-vous le démarrer maintenant ?", + "yes": "Oui, démarrer le serveur" + } + }, + "githubRepoName": { + "description": "Le nom du dépôt GitHub actuel (par exemple, \"eclipse-theia/theia\")" + }, + "model-selection-description": "Choisissez les grands modèles de langage (LLM) utilisés par chaque agent d'intelligence artificielle dans la [Vue de configuration de l'intelligence artificielle] ({0}).", + "moreAgentsAvailable": { + "header": "Plus d'agents sont disponibles" + }, + "noRecommendedAgents": "Aucun agent recommandé n'est disponible.", + "openSettings": "Ouvrir les paramètres AI", + "or": "ou", + "orchestrator": { + "error": { + "noAgents": "Aucun agent de chat n'est disponible pour traiter la demande. Veuillez vérifier votre configuration pour savoir si l'un d'entre eux est activé." + }, + "progressMessage": "Déterminer l'agent le plus approprié", + "response": { + "delegatingToAgent": "Délégation à `@{0}`" + } + }, + "prompt-template-description": "Sélectionnez les variantes d'invite et personnalisez les modèles d'invite pour les agents AI dans la [Vue de configuration AI] ({0}).", + "recommendedAgents": "Agents recommandés :", + "skillsConfiguration": { + "label": "Compétences", + "location": { + "label": "Emplacement" + } + }, + "toolsConfiguration": { + "confirmAlwaysAllow": { + "confirm": "Je comprends, activer l'approbation automatique", + "title": "Activer l'approbation automatique pour « {0} » ?" + }, + "confirmationMode": { + "label": "Mode de confirmation" + }, + "default": { + "label": "Mode de confirmation de l'outil par défaut :" + }, + "resetAll": "Réinitialiser tout", + "resetAllConfirmDialog": { + "msg": "Êtes-vous sûr de vouloir rétablir la valeur par défaut de tous les modes de confirmation des outils ? Cela supprimera tous les paramètres personnalisés.", + "title": "Réinitialisation de tous les modes de confirmation de l'outil" + }, + "resetAllTooltip": "Réinitialiser tous les outils par défaut", + "toolOptions": { + "confirm": { + "label": "Confirmer" + } + } + }, + "variableConfiguration": { + "selectVariable": "Veuillez sélectionner une variable.", + "usedByAgents": "Utilisé par les agents", + "variableArgs": "Arguments de la variable" + } + }, + "llamaFile": { + "prefs": { + "mdDescription": "Ce paramètre vous permet de configurer et de gérer les modèles LlamaFile dans l'IDE Theia. \n Chaque entrée nécessite un `nom` convivial, le fichier `uri` pointant vers votre LlamaFile, et le `port` sur lequel il sera exécuté. \n Pour démarrer un LlamaFile, utilisez la commande \"Start LlamaFile\", qui vous permet de sélectionner le modèle désiré. \n Si vous modifiez une entrée (par exemple, en changeant le port), toute instance en cours d'exécution s'arrêtera et vous devrez la relancer manuellement. \n [Pour en savoir plus sur la configuration et la gestion des LlamaFiles, consultez la documentation de l'IDE Theia] (https://theia-ide.org/docs/user_ai/#llamafile-models).", + "name": { + "description": "Le nom du modèle à utiliser pour ce fichier Llamafile." + }, + "port": { + "description": "Le port à utiliser pour démarrer le serveur." + }, + "title": "✨ AI LlamaFile", + "uri": { + "description": "L'uri du fichier Llamafile." + } + }, + "start": "Démarrer Llamafile", + "stop": "Stop Llamafile" + }, + "llamafile": { + "error": { + "noConfigured": "Aucun fichier Llamafiles n'est configuré.", + "noRunning": "Pas de Llamafiles en cours.", + "startFailed": "Un problème s'est produit lors du démarrage de llamafile : {0}.\nPour plus d'informations, voir la console.", + "stopFailed": "Un problème s'est produit lors de l'arrêt de llamafile : {0}.\nPour plus d'informations, voir la console." + } + }, + "mcp": { + "error": { + "allServersRunning": "Tous les serveurs MCP fonctionnent déjà.", + "noRunningServers": "Aucun serveur MCP ne fonctionne.", + "noServersConfigured": "Aucun serveur MCP n'est configuré.", + "startFailed": "Une erreur s'est produite lors du démarrage du serveur MCP." + }, + "info": { + "serverStarted": "Serveur MCP \"{0}\" démarré avec succès. Outils enregistrés : {1}" + }, + "servers": { + "args": { + "mdDescription": "Un tableau d'arguments à passer à la commande.", + "title": "Arguments pour la commande" + }, + "autostart": { + "mdDescription": "Démarrer automatiquement ce serveur au démarrage du frontend. Les serveurs nouvellement ajoutés ne sont pas immédiatement démarrés automatiquement, mais au redémarrage.", + "title": "Démarrage automatique" + }, + "command": { + "mdDescription": "La commande utilisée pour démarrer le serveur MCP, par exemple \"uvx\" ou \"npx\".", + "title": "Commande pour exécuter le serveur MCP" + }, + "env": { + "mdDescription": "Variables d'environnement facultatives à définir pour le serveur, telles qu'une clé API.", + "title": "Variables d'environnement" + }, + "headers": { + "mdDescription": "En-têtes supplémentaires facultatifs inclus dans chaque demande adressée au serveur.", + "title": "En-têtes" + }, + "mdDescription": "Configurer les serveurs MCP avec des commandes, des arguments, éventuellement des variables d'environnement et un démarrage automatique (vrai par défaut). Chaque serveur est identifié par une clé unique, telle que \"brave-search\" ou \"filesystem\". Pour démarrer un serveur, utilisez la commande \"MCP : Start MCP Server\", qui vous permet de sélectionner le serveur souhaité. Pour arrêter un serveur, utilisez la commande \"MCP : Stop MCP Server\". Veuillez noter que le démarrage automatique ne prend effet qu'après un redémarrage, vous devez donc démarrer un serveur manuellement pour la première fois.\nExemple de configuration :\n```{\n \"brave-search\" : {\n \"command\" : \"npx\",\n \"args\" : [\n \"-y\",\n \"@modelcontextprotocol/server-brave-search\"\n ],\n \"env\" : {\n \"BRAVE_API_KEY\" : \"YOUR_API_KEY\"\n },\n },\n \"filesystem\" : {\n \"command\" : \"npx\",\n \"args\" : [\"-y\", \"@modelcontextprotocol/server-filesystem\", \"/Users/YOUR_USERNAME/Desktop\"],\n \"env\" : {\n \"CUSTOM_ENV_VAR\" : \"custom-value\"\n },\n \"autostart\" : false\n }\n}\n```", + "serverAuthToken": { + "mdDescription": "Le jeton d'authentification pour le serveur, si nécessaire. Il est utilisé pour s'authentifier auprès du serveur distant.", + "title": "Jeton d'authentification" + }, + "serverAuthTokenHeader": { + "mdDescription": "Le nom de l'en-tête à utiliser pour le jeton d'authentification du serveur. S'il n'est pas fourni, \"Authorization\" avec \"Bearer\" sera utilisé.", + "title": "Nom de l'en-tête d'authentification" + }, + "serverUrl": { + "mdDescription": "URL du serveur MCP distant. Si elle est fournie, le serveur se connectera à cette URL au lieu de lancer un processus local.", + "title": "URL du serveur" + }, + "title": "Configuration des serveurs MCP" + }, + "start": { + "label": "MCP : Démarrer le serveur MCP" + }, + "stop": { + "label": "MCP : Arrêter le serveur MCP" + } + }, + "mcpConfiguration": { + "arguments": "Arguments : ", + "autostart": "Démarrage automatique : ", + "connectServer": "Connnect", + "connectingServer": "Connexion...", + "copiedAllList": "Copie de tous les outils dans le presse-papiers (liste de tous les outils)", + "copiedAllSingle": "Copie de tous les outils dans le presse-papiers (un seul fragment d'invite avec tous les outils)", + "copiedForPromptTemplate": "Copie de tous les outils dans le presse-papiers pour le modèle d'invite (fragment d'invite unique avec tous les outils)", + "copyAllList": "Copier tout (liste de tous les outils)", + "copyAllSingle": "Copier tout pour le chat (un seul fragment d'invite avec tous les outils)", + "copyForPrompt": "Outil de copie (pour le chat ou le modèle d'invite)", + "copyForPromptTemplate": "Copier tout pour le modèle d'invite (un seul fragment d'invite avec tous les outils)", + "environmentVariables": "Variables d'environnement : ", + "headers": "En-têtes : ", + "noServers": "Aucun serveur MCP n'est configuré", + "serverAuthToken": "Jeton d'authentification : ", + "serverAuthTokenHeader": "Nom de l'en-tête d'authentification : ", + "serverUrl": "URL du serveur : ", + "tools": "Outils : " + }, + "openai": { + "apiKey": { + "mdDescription": "Entrez une clé API de votre compte officiel OpenAI. **Remarque : En utilisant cette préférence, la clé API Open AI sera stockée en clair sur la machine qui exécute Theia. Utilisez la variable d'environnement `OPENAI_API_KEY` pour définir la clé de manière sécurisée." + }, + "customEndpoints": { + "apiKey": { + "title": "Soit la clé pour accéder à l'API servie à l'url donnée, soit `true` pour utiliser la clé globale de l'API OpenAI." + }, + "apiVersion": { + "title": "Soit la version pour accéder à l'API servie à l'url donnée dans Azure ou `true` pour utiliser la version globale de l'API OpenAI" + }, + "deployment": { + "title": "Le nom du déploiement pour accéder à l'API servie à l'url donnée dans Azure." + }, + "developerMessageSettings": { + "title": "Contrôle la gestion des messages système : `user`, `system`, et `developer` seront utilisés comme rôle, `mergeWithFollowingUserMessage` préfixera le message utilisateur suivant avec le message système ou convertira le message système en message utilisateur si le message suivant n'est pas un message utilisateur. `skip` supprimera simplement le message système), la valeur par défaut étant `developer`." + }, + "enableStreaming": { + "title": "Indique si l'API de streaming doit être utilisée. `true` par défaut." + }, + "id": { + "title": "Un identifiant unique utilisé dans l'interface utilisateur pour identifier le modèle personnalisé." + }, + "mdDescription": "Intégrer des modèles personnalisés compatibles avec l'API OpenAI, par exemple via `vllm`. Les attributs requis sont `model` et `url`. \n Optionnellement, vous pouvez \n - spécifier un `id` unique pour identifier le modèle personnalisé dans l'interface utilisateur. Si aucun n'est donné, `model` sera utilisé comme `id`. \n - fournir une `apiKey` pour accéder à l'API servie à l'url donnée. Utilisez `true` pour indiquer l'utilisation de la clé globale de l'API OpenAI. \n - provide an `apiVersion` to access the API served at the given url in Azure. Utilisez `true` pour indiquer l'utilisation de la version globale de l'API OpenAI. \n - mettre `developerMessageSettings` à l'une des valeurs suivantes : `user`, `system`, `developer`, `mergeWithFollowingUserMessage`, ou `skip` pour contrôler comment le message du développeur est inclus (où `user`, `system`, et `developer` seront utilisés comme rôle, `mergeWithFollowingUserMessage` préfixera le message suivant de l'utilisateur avec le message du système ou convertira le message du système en message de l'utilisateur si le message suivant n'est pas un message de l'utilisateur. `skip` supprimera simplement le message système). La valeur par défaut est `developer`. \n - spécifier `supportsStructuredOutput : false` pour indiquer que la sortie structurée ne doit pas être utilisée. \n - specify `enableStreaming : false` pour indiquer que le streaming ne doit pas être utilisé. \n Référez-vous à [notre documentation] (https://theia-ide.org/docs/user_ai/#openai-compatible-models-eg-via-vllm) pour plus d'informations.", + "modelId": { + "title": "Modèle ID" + }, + "supportsStructuredOutput": { + "title": "Indique si le modèle supporte les sorties structurées. `true` par défaut." + }, + "url": { + "title": "Le point d'accès compatible avec l'API Open AI où le modèle est hébergé" + } + }, + "models": { + "description": "Modèles officiels de l'OpenAI à utiliser" + }, + "useResponseApi": { + "mdDescription": "Utiliser la nouvelle API de réponse OpenAI au lieu de l'API de complétion du chat pour les modèles OpenAI officiels. Ce paramètre ne s'applique qu'aux modèles officiels de l'OpenAI - les fournisseurs personnalisés doivent le configurer individuellement." + } + }, + "promptTemplates": { + "directories": { + "title": "Répertoires de modèles d'invites spécifiques à l'espace de travail" + }, + "extensions": { + "description": "Liste des extensions de fichiers supplémentaires dans les emplacements d'invite qui sont considérés comme des modèles d'invite. '.prompttemplate' est toujours considéré comme un modèle par défaut.", + "title": "Extensions de fichiers supplémentaires pour les modèles d'invite" + }, + "files": { + "title": "Fichiers de modèles d'invites spécifiques à l'espace de travail" + } + }, + "scanoss": { + "changeSet": { + "clean": "Pas de correspondance", + "error": "Erreur : Réexécution", + "error-notification": "Erreur ScanOSS rencontrée : {0}.", + "match": "Voir les correspondances", + "scan": "Scanner", + "scanning": "Scanner..." + }, + "mode": { + "automatic": { + "description": "Activation de l'analyse automatique des extraits de code dans les vues de chat." + }, + "description": "Configurer la fonctionnalité SCANOSS pour l'analyse des extraits de code dans les vues de chat. Cela enverra un hachage des extraits de code suggérés au service SCANOSS\nhébergé par la [Software Transparency foundation] (https://www.softwaretransparency.org/osskb) pour analyse.", + "manual": { + "description": "L'utilisateur peut déclencher manuellement le balayage en cliquant sur l'élément SCANOSS dans la vue du chat." + }, + "off": { + "description": "La fonction est complètement désactivée." + } + }, + "snippet": { + "dialog-header": "Résultats du ScanOSS", + "errored": "SCANOSS - Erreur - {0}", + "file-name-heading": "Correspondance trouvée dans {0}", + "in-progress": "SCANOSS - Effectuer un balayage...", + "match-count": "{0} trouvé(s) correspond(ent)", + "matched": "SCANOSS - Correspondance trouvée {0} ", + "no-match": "SCANOSS - Pas de correspondance", + "summary": "Résumé" + } + }, + "session-settings-dialog": { + "title": "Régler les paramètres de la session", + "tooltip": "Régler les paramètres de la session" + }, + "terminal": { + "agent": { + "description": "Cet agent fournit une assistance pour écrire et exécuter des commandes de terminal arbitraires. En fonction de la demande de l'utilisateur, il suggère des commandes et permet à l'utilisateur de les coller et de les exécuter directement dans le terminal. Il accède au répertoire actuel, à l'environnement et à la sortie récente de la session du terminal pour fournir une assistance contextuelle.", + "vars": { + "cwd": { + "description": "Le répertoire de travail actuel." + }, + "recentTerminalContents": { + "description": "Les 0 à 50 dernières lignes récentes visibles dans le terminal." + }, + "shell": { + "description": "L'interpréteur de commandes utilisé, par exemple, /usr/bin/zsh." + }, + "userRequest": { + "description": "La question ou la demande de l'utilisateur." + } + } + }, + "askAi": "Demander à l'IA", + "askTerminalCommand": "Posez une question sur une commande de terminal...", + "hitEnterConfirm": "Appuyer sur la touche \"Entrée\" pour confirmer", + "howCanIHelp": "Comment puis-je vous aider ?", + "loading": "Chargement", + "tryAgain": "Réessayez...", + "useArrowsAlternatives": " ou utiliser ⇅ pour montrer les alternatives..." + }, + "tokenUsage": { + "cachedInputTokens": "Jetons d'entrée écrits dans le cache", + "cachedInputTokensTooltip": "Suivi supplémentaire des \"jetons d'entrée\". Généralement plus coûteux que les jetons non mis en cache.", + "failedToGetTokenUsageData": "Échec de la récupération des données d'utilisation des jetons : {0}", + "inputTokens": "Jetons d'entrée", + "label": "Utilisation du jeton", + "lastUsed": "Dernière utilisation", + "model": "Modèle", + "noData": "Aucune donnée sur l'utilisation des jetons n'est encore disponible.", + "note": "L'utilisation des jetons est suivie depuis le début de l'application et n'est pas conservée.", + "outputTokens": "Jetons de sortie", + "readCachedInputTokens": "Jetons d'entrée lus à partir du cache", + "readCachedInputTokensTooltip": "Suivi supplémentaire du \"jeton d'entrée\". Généralement beaucoup moins coûteux que l'absence de mise en cache. N'est généralement pas pris en compte dans les limites de débit.", + "total": "Total", + "totalTokens": "Total des jetons", + "totalTokensTooltip": "Jetons d'entrée + Jetons de sortie" + }, + "vercelai": { + "anthropicApiKey": { + "mdDescription": "Saisir une clé API pour les modèles anthropiques. **Remarque : En utilisant cette préférence, la clé API sera stockée en clair sur la machine qui exécute Theia. Utilisez la variable d'environnement `ANTHROPIC_API_KEY` pour définir la clé de manière sécurisée." + }, + "customEndpoints": { + "apiKey": { + "title": "Soit la clé d'accès à l'API servie à l'url donnée, soit `true` pour utiliser la clé globale de l'API" + }, + "enableStreaming": { + "title": "Indique si l'API de streaming doit être utilisée. `true` par défaut." + }, + "id": { + "title": "Un identifiant unique utilisé dans l'interface utilisateur pour identifier le modèle personnalisé." + }, + "mdDescription": "Intégrer des modèles personnalisés compatibles avec le Vercel AI SDK. Les attributs requis sont `model` et `url`. \n En option, vous pouvez \n - spécifier un `id` unique pour identifier le modèle personnalisé dans l'interface utilisateur. Si aucun attribut n'est spécifié, `model` sera utilisé comme `id`. \n - fournir une `apiKey` pour accéder à l'API servie à l'url donnée. Utilisez `true` pour indiquer l'utilisation de la clé API globale. \n - spécifier `supportsStructuredOutput : false` pour indiquer que la sortie structurée ne doit pas être utilisée. \n - specify `enableStreaming : false` pour indiquer que le streaming ne doit pas être utilisé. \n - specify `provider` pour indiquer le fournisseur du modèle (openai, anthropic).", + "modelId": { + "title": "Modèle ID" + }, + "supportsStructuredOutput": { + "title": "Indique si le modèle supporte les sorties structurées. `true` par défaut." + }, + "url": { + "title": "Le point de terminaison de l'API où le modèle est hébergé" + } + }, + "models": { + "description": "Modèles officiels à utiliser avec Vercel AI SDK", + "id": { + "title": "Modèle ID" + }, + "model": { + "title": "Nom du modèle" + } + }, + "openaiApiKey": { + "mdDescription": "Entrez une clé API pour les modèles OpenAI. **Remarque : En utilisant cette préférence, la clé API sera stockée en clair sur la machine qui exécute Theia. Utilisez la variable d'environnement `OPENAI_API_KEY` pour définir la clé de manière sécurisée." + } + }, + "workspace": { + "coderAgent": { + "description": "Un assistant IA intégré à l'IDE Theia, conçu pour aider les développeurs de logiciels. Cet agent peut accéder à l'espace de travail de l'utilisateur, il peut obtenir une liste de tous les fichiers et dossiers disponibles et récupérer leur contenu. En outre, il peut suggérer des modifications de fichiers à l'utilisateur. Il peut donc aider l'utilisateur à effectuer des tâches de codage ou d'autres tâches impliquant des modifications de fichiers." + }, + "considerGitignore": { + "description": "Si cette option est activée, elle exclut les fichiers/dossiers spécifiés dans un fichier .gitignore global (l'emplacement prévu est la racine de l'espace de travail).", + "title": "Considérez .gitignore" + }, + "excludedPattern": { + "description": "Liste de motifs (glob ou regex) pour les fichiers/dossiers à exclure.", + "title": "Modèles de fichiers exclus" + }, + "searchMaxResults": { + "description": "Nombre maximum de résultats de recherche renvoyés par la fonction de recherche de l'espace de travail.", + "title": "Résultats de recherche maximum" + }, + "workspaceAgent": { + "description": "Un assistant IA intégré à l'IDE Theia, conçu pour aider les développeurs de logiciels. Cet agent peut accéder à l'espace de travail de l'utilisateur, il peut obtenir une liste de tous les fichiers et dossiers disponibles et récupérer leur contenu. Il ne peut pas modifier les fichiers. Il peut donc répondre à des questions sur le projet en cours, les fichiers du projet et le code source dans l'espace de travail, comme par exemple comment construire le projet, où mettre le code source, où trouver du code ou des configurations spécifiques, etc." + } + } + }, + "ai-chat": { + "fileChangeSetTitle": "Modifications proposées" + }, + "ai-chat-ui": { + "initiate-session-task-context": "Contexte de la tâche : Initier une session", + "open-current-session-summary": "Ouvrir le résumé de la session en cours", + "open-settings-tooltip": "Ouvrir les paramètres AI...", + "scroll-lock": "Verrouiller le défilement", + "scroll-unlock": "Déverrouiller le parchemin", + "session-settings": "Régler les paramètres de la session", + "showChats": "Afficher les discussions...", + "summarize-current-session": "Résumé de la session en cours" + }, + "ai-claude-code": { + "open-config": "Open Claude Code Configuration", + "open-memory": "Ouvrir la mémoire du code Claude (CLAUDE.MD)" + }, + "ai-core": { + "agentCompletionMessage": "L'agent \"{0}\" a terminé sa tâche.", + "agentCompletionTitle": "Agent \"{0}\" Tâche accomplie", + "agentCompletionWithTask": "L'agent \"{0}\" a terminé la tâche : {1}" + }, + "ai-editor": { + "contextMenu": "Demander à l'IA", + "sendToChat": "Envoyer à AI Chat" + }, + "ai-ide": { + "addressGhReviewCommand": { + "argumentHint": "", + "description": "Répondre aux commentaires sur une pull request GitHub" + }, + "fixGhTicketCommand": { + "argumentHint": "", + "description": "Analyser un ticket GitHub et mettre en œuvre la solution" + }, + "open-agent-settings-tooltip": "Ouvrir les paramètres de l'agent...", + "rememberCommand": { + "argumentHint": "[topic-hint]", + "description": "Extraire les sujets de conversation et mettre à jour les informations relatives au projet" + }, + "ticketCommand": { + "argumentHint": "", + "description": "Analyser un ticket GitHub et créer un plan de mise en œuvre" + }, + "todoTool": { + "noTasks": "Aucune tâche" + }, + "withAppTesterCommand": { + "description": "Déléguer les tests à l'agent AppTester (nécessite le mode agent)" + } + }, + "ai-mcp": { + "blockedServersLabel": "Serveurs MCP (démarrage automatique bloqué)" + }, + "ai-terminal": { + "cancelExecution": "Annuler l'exécution de la commande", + "canceling": "Annulation...", + "confirmExecution": "Confirmer la commande Shell", + "denialReason": "Raison", + "executionCanceled": "Annulé", + "executionDenied": "Refusé", + "executionDeniedWithReason": "Refusé avec raison", + "noOutput": "Pas de sortie", + "partialOutput": "Sortie partielle", + "timeout": "Délai d'attente", + "workingDirectory": "Répertoire de travail" + }, + "callhierarchy": { + "noCallers": "Aucun appelant n'a été détecté.", + "open": "Hiérarchie des appels ouverts" + }, + "chat": { + "taskContextVariable": { + "args": { + "contextId": { + "description": "L'ID du contexte de la tâche à récupérer, ou d'une session de chat à résumer." + } + }, + "description": "Fournit des informations contextuelles pour une tâche, par exemple le plan d'exécution d'une tâche ou un résumé des sessions précédentes.", + "label": "Contexte de la tâche" + } + }, + "collaboration": { + "collaborate": "Collaborer", + "collaboration": "Collaboration", + "collaborationWorkspace": "Espace de travail collaboratif", + "connected": "Connecté", + "connectedSession": "Connecté à une session de collaboration", + "copiedInvitation": "Code d'invitation copié dans le presse-papiers.", + "copyAgain": "Copier à nouveau", + "createRoom": "Créer une nouvelle session de collaboration", + "creatingRoom": "Création d'une session", + "end": "Fin de la session de collaboration", + "endDetail": "Mettre fin à la session, cesser le partage de contenu et révoquer l'accès pour d'autres personnes.", + "enterCode": "Enter collaboration session code", + "failedCreate": "Échec de la création d'une salle : {0}", + "failedJoin": "N'a pas réussi à rejoindre la salle : {0}", + "fieldRequired": "Le champ {0} est obligatoire. Connexion interrompue.", + "invite": "Inviter d'autres personnes", + "inviteDetail": "Copiez le code d'invitation pour le partager avec d'autres personnes afin de participer à la session.", + "joinRoom": "Participer à une session de collaboration", + "joiningRoom": "Session d'adhésion", + "leave": "Quitter la session de collaboration", + "leaveDetail": "Se déconnecter de la session de collaboration en cours et fermer l'espace de travail.", + "loginFailed": "La connexion a échoué.", + "loginSuccessful": "Connexion réussie.", + "noAuth": "Aucune méthode d'authentification n'est fournie par le serveur.", + "optional": "facultatif", + "selectAuth": "Sélectionner la méthode d'authentification", + "selectCollaboration": "Sélectionner l'option de collaboration", + "serverUrl": "URL du serveur", + "serverUrlDescription": "URL de l'instance d'Open Collaboration Tools Server pour les sessions de collaboration en direct", + "sharedSession": "Partager une session de collaboration", + "startSession": "Démarrer ou rejoindre une session de collaboration", + "userWantsToJoin": "User '{0}' wants to join the collaboration room", + "whatToDo": "Qu'aimeriez-vous faire avec d'autres collaborateurs ?" + }, + "core": { + "about": { + "compatibility": "{0} Compatibilité", + "defaultApi": "API par défaut {0} ", + "listOfExtensions": "Liste des extensions" + }, + "common": { + "closeAll": "Fermer tous les onglets", + "closeAllTabMain": "Fermer tous les onglets de la zone principale", + "closeOtherTabMain": "Fermer les autres onglets de la zone principale", + "closeOthers": "Fermer les autres onglets", + "closeRight": "Fermer les onglets à droite", + "closeTab": "Onglet fermé", + "closeTabMain": "Close Tab dans la zone principale", + "collapseAllTabs": "Réduire tous les panneaux latéraux", + "collapseBottomPanel": "Panneau inférieur à bascule", + "collapseLeftPanel": "Panneau de gauche à bascule", + "collapseRightPanel": "Basculer vers le panneau de droite", + "collapseTab": "Panneau latéral d'effondrement", + "showNextTabGroup": "Passer au groupe d'onglets suivant", + "showNextTabInGroup": "Passer à l'onglet suivant dans le groupe", + "showPreviousTabGroup": "Passer au groupe d'onglets précédent", + "showPreviousTabInGroup": "Passer à l'onglet précédent dans le groupe", + "toggleMaximized": "Toggle Maximisé" + }, + "copyInfo": "Ouvrir d'abord un fichier pour copier son chemin d'accès", + "copyWarn": "Veuillez utiliser la commande de copie du navigateur ou un raccourci.", + "cutWarn": "Veuillez utiliser la commande ou le raccourci \"couper\" du navigateur.", + "enhancedPreview": { + "classic": "Affiche un simple aperçu de l'onglet avec des informations de base.", + "enhanced": "Affiche un aperçu amélioré de l'onglet avec des informations supplémentaires.", + "visual": "Affiche un aperçu visuel de l'onglet." + }, + "file": { + "browse": "Parcourir" + }, + "highlightModifiedTabs": "Contrôle si une bordure supérieure est dessinée sur les onglets d'éditeur modifiés (sales) ou non.", + "keybinding": { + "duplicateModifierError": "Impossible d'analyser les raccourcis clavier {0} Modificateurs en double", + "metaError": "Impossible d'analyser les raccourcis clavier {0} meta est pour OSX seulement", + "unrecognizedKeyError": "Clé non reconnue {0} en {1}" + }, + "keybindingStatus": "{0} a été appuyé, en attendant d'autres touches.", + "keyboard": { + "choose": "Choisir la disposition du clavier", + "chooseLayout": "Choisir une disposition de clavier", + "current": "(courant : {0})", + "currentLayout": " - disposition actuelle", + "mac": "Claviers Mac", + "pc": "Claviers pour PC", + "tryDetect": "Essayez de détecter la disposition du clavier à partir des informations du navigateur et des touches pressées." + }, + "navigator": { + "clipboardWarn": "L'accès au presse-papiers est refusé. Vérifiez les autorisations de votre navigateur.", + "clipboardWarnFirefox": "L'API Presse-papiers n'est pas disponible. Elle peut être activée par la préférence '{0}' sur la page '{1}'. Rechargez ensuite Theia. Notez que cela permettra à FireFox d'avoir un accès complet au presse-papiers du système." + }, + "offline": "Hors ligne", + "pasteWarn": "Veuillez utiliser la commande \"coller\" du navigateur ou un raccourci.", + "quitMessage": "Les modifications non sauvegardées ne seront pas enregistrées.", + "resetWorkbenchLayout": "Réinitialisation de la disposition de l'établi", + "searchbox": { + "close": "Fermer (Escape)", + "next": "Suivant (en bas)", + "previous": "Précédent (en haut)", + "showAll": "Afficher tous les éléments", + "showOnlyMatching": "Afficher uniquement les articles correspondants" + }, + "secondaryWindow": { + "alwaysOnTop": "Lorsqu'elle est activée, la fenêtre secondaire reste au-dessus de toutes les autres fenêtres, y compris celles des différentes applications.", + "description": "Définit la position et la taille initiales de la fenêtre secondaire extraite.", + "fullSize": "La position et la taille du widget extrait seront identiques à celles de l'application Theia en cours d'exécution.", + "halfWidth": "La position et la taille du widget extrait correspondront à la moitié de la largeur de l'application Theia en cours d'exécution.", + "originalSize": "La position et la taille du widget extrait seront identiques à celles du widget original." + }, + "severity": { + "log": "Journal" + }, + "silentNotifications": "Contrôle la suppression des popups de notification.", + "tabDefaultSize": "Spécifie la taille par défaut des onglets.", + "tabMaximize": "Contrôle si les onglets doivent être maximisés lors d'un double-clic.", + "tabMinimumSize": "Spécifie la taille minimale des onglets.", + "tabShrinkToFit": "Réduire les onglets pour les adapter à l'espace disponible.", + "window": { + "tabCloseIconPlacement": { + "description": "Placez les icônes de fermeture sur les titres des onglets au début ou à la fin de l'onglet. La valeur par défaut est la fin sur toutes les plateformes.", + "end": "Placez l'icône de fermeture à la fin de l'étiquette. Dans les langues allant de gauche à droite, il s'agit du côté droit de l'onglet.", + "start": "Placez l'icône de fermeture au début de l'étiquette. Dans les langues fonctionnant de gauche à droite, il s'agit du côté gauche de l'onglet." + } + }, + "window.menuBarVisibility": "Le menu s'affiche sous forme de bouton compact dans la barre latérale. Cette valeur est ignorée lorsque{0} est {1}." + }, + "debug": { + "TheiaIDE": "Theia IDE", + "addConfigurationPlaceholder": "Sélectionnez la racine de l'espace de travail pour y ajouter la configuration", + "breakpoint": "point de rupture", + "cannotRunToThisLocation": "Impossible d'exécuter la discussion en cours à l'endroit spécifié.", + "compound-cycle": "La configuration de lancement '{0}' contient un cycle avec elle-même", + "conditionalBreakpoint": "Point d'arrêt conditionnel", + "conditionalBreakpointsNotSupported": "Points d'arrêt conditionnels non pris en charge par ce type de débogage", + "confirmRunToShiftedPosition_msg": "La position de la cible sera déplacée à Ln {0}, Col {1}. Courir quand même ?", + "confirmRunToShiftedPosition_title": "Impossible d'exécuter le fil d'exécution actuel à l'endroit exact spécifié", + "consoleFilter": "Filtre (par exemple, texte, !exclure)", + "consoleFilterAriaLabel": "Filtrer la sortie de la console de débogage", + "consoleSessionSelectorTooltip": "Passer d'une session de débogage à une autre. Chaque session de débogage dispose de sa propre sortie console.", + "consoleSeverityTooltip": "Filtrez la sortie de la console par niveau de gravité. Seuls les messages correspondant au niveau de gravité sélectionné seront affichés.", + "continueAll": "Continuer tout", + "copyExpressionValue": "Copier la valeur de l'expression", + "couldNotRunTask": "Impossible d'exécuter la tâche '{0}'.", + "dataBreakpoint": "point d'arrêt des données", + "debugConfiguration": "Configuration du débogage", + "debugSessionInitializationFailed": "L'initialisation de la session de débogage a échoué. Voir la console pour plus de détails.", + "debugSessionTypeNotSupported": "Le type de session de débogage \"{0}\" n'est pas pris en charge.", + "debugToolbarMenu": "Menu de la barre d'outils de débogage", + "debugVariableInput": "Définir la valeur de {0} ", + "disableSelectedBreakpoints": "Désactiver les points d'arrêt sélectionnés", + "disabledBreakpoint": "Handicapés {0}", + "enableSelectedBreakpoints": "Activer les points d'arrêt sélectionnés", + "entry": "entrée", + "errorStartingDebugSession": "Une erreur s'est produite lors du démarrage de la session de débogage, vérifiez les journaux pour plus de détails.", + "exception": "exception", + "functionBreakpoint": "point d'arrêt de la fonction", + "goto": "goto", + "htiConditionalBreakpointsNotSupported": "Frapper des points d'arrêt conditionnels non pris en charge par ce type de débogage", + "instruction-breakpoint": "Point d'arrêt de l'instruction", + "instructionBreakpoint": "point d'arrêt de l'instruction", + "logpointsNotSupported": "Points d'enregistrement non pris en charge par ce type de débogage", + "missingConfiguration": "La configuration dynamique '{0}:{1}' est manquante ou non applicable.", + "pause": "pause", + "pauseAll": "Pause tout", + "reveal": "Révéler", + "step": "étape", + "taskTerminatedBySignal": "Tâche '{0}' terminée par le signal {1}.", + "taskTerminatedForUnknownReason": "La tâche '{0}' s'est terminée pour une raison inconnue.", + "taskTerminatedWithExitCode": "La tâche '{0}' s'est terminée avec le code de sortie {1}.", + "threads": "Les fils", + "toggleTracing": "Activer/désactiver le traçage des communications avec les adaptateurs de débogage", + "unknownSession": "Session inconnue", + "unverifiedBreakpoint": "Non vérifié {0}" + }, + "editor": { + "diffEditor.wordWrap2": "Les lignes s'enrouleront en fonction du paramètre `#editor.wordWrap#`.", + "dirtyEncoding": "Le fichier est sale. Veuillez le sauvegarder avant de le rouvrir avec un autre encodage.", + "editor.bracketPairColorization.enabled": "Contrôle si la colorisation des paires de crochets est activée ou non. Utilisez `#workbench.colorCustomizations#` pour surcharger les couleurs de mise en évidence des crochets.", + "editor.codeActions.triggerOnFocusChange": "Permet de déclencher `#editor.codeActionsOnSave#` lorsque `#files.autoSave#` est réglé sur `afterDelay`. Les actions de code doivent être réglées sur `toujours` pour être déclenchées lors des changements de fenêtre et de focus.", + "editor.detectIndentation": "Contrôle si `#editor.tabSize#` et `#editor.insertSpaces#` seront automatiquement détectés lors de l'ouverture d'un fichier en fonction de son contenu.", + "editor.experimental.preferTreeSitter": "Contrôle si l'analyse syntaxique Tree Sitter doit être activée pour des langages spécifiques. Cela aura priorité sur `editor.experimental.treeSitterTelemetry` pour les langages spécifiés.", + "editor.inlayHints.enabled1": "Les conseils d'incrustation sont affichés par défaut et sont masqués lorsque vous maintenez les touches `Ctrl+Alt`.", + "editor.inlayHints.enabled2": "Les indices d'incrustation sont cachés par défaut et s'affichent en maintenant les touches `Ctrl+Alt`.", + "editor.inlayHints.fontFamily": "Contrôle la famille de police des indices d'incrustation dans l'éditeur. Si la valeur est vide, c'est la police `#editor.fontFamily#` qui est utilisée.", + "editor.inlayHints.fontSize": "Contrôle la taille de la police des indices d'incrustation dans l'éditeur. Par défaut, `#editor.fontSize#` est utilisé lorsque la valeur configurée est inférieure à `5` ou supérieure à la taille de la police de l'éditeur.", + "editor.inlineSuggest.edits.experimental.enabled": "Permet d'activer ou non les éditions expérimentales dans les suggestions en ligne.", + "editor.inlineSuggest.edits.experimental.onlyShowWhenCloseToCursor": "Contrôle l'affichage des suggestions en ligne uniquement lorsque le curseur est proche de la suggestion.", + "editor.inlineSuggest.edits.experimental.useInterleavedLinesDiff": "Permet d'activer ou non les lignes entrelacées expérimentales dans les suggestions en ligne.", + "editor.inlineSuggest.edits.experimental.useMixedLinesDiff": "Permet d'activer ou non les éditions expérimentales dans les suggestions en ligne.", + "editor.insertSpaces": "Insérer des espaces lorsque l'on appuie sur `Tab`. Ce paramètre est modifié en fonction du contenu du fichier lorsque `#editor.detectIndentation#` est activé.", + "editor.quickSuggestions": "Contrôle si les suggestions doivent s'afficher automatiquement pendant la saisie. Cela peut être contrôlé pour la saisie de commentaires, de chaînes de caractères et d'autres codes. La suggestion rapide peut être configurée pour s'afficher sous forme de texte fantôme ou avec le widget de suggestion. Tenez également compte du paramètre '#editor.suggestOnTriggerCharacters#' qui contrôle si les suggestions sont déclenchées par des caractères spéciaux.", + "editor.suggestFontSize": "Taille de la police pour le widget de suggestion. Si elle vaut `0`, la valeur de `#editor.fontSize#` est utilisée.", + "editor.suggestLineHeight": "Hauteur de ligne pour le widget de suggestion. Lorsqu'il vaut `0`, la valeur de `#editor.lineHeight#` est utilisée. La valeur minimale est de 8.", + "editor.tabSize": "Le nombre d'espaces que représente une tabulation. Ce paramètre est modifié en fonction du contenu du fichier lorsque `#editor.detectIndentation#` est activé.", + "formatOnSaveTimeout": "Délai en millisecondes après lequel le formatage qui est exécuté lors de l'enregistrement du fichier est annulé.", + "persistClosedEditors": "Contrôle la persistance ou non de l'historique de l'éditeur fermé pour l'espace de travail lors des rechargements de la fenêtre.", + "showAllEditors": "Afficher tous les éditeurs ouverts", + "splitHorizontal": "Split Editor Horizontal", + "splitVertical": "Split Editor Vertical", + "toggleStickyScroll": "Activer/désactiver le défilement épinglé" + }, + "external-terminal": { + "cwd": "Sélection du répertoire de travail actuel pour le nouveau terminal externe" + }, + "file-search": { + "toggleIgnoredFiles": " (Appuyez sur {0} pour afficher/masquer les fichiers ignorés)" + }, + "fileDialog": { + "showHidden": "Afficher les fichiers cachés" + }, + "fileSystem": { + "fileResource": { + "overWriteBody": "Voulez-vous écraser les modifications apportées à '{0}' sur le système de fichiers?" + } + }, + "filesystem": { + "copiedToClipboard": "Copie du lien de téléchargement dans le presse-papiers.", + "copyDownloadLink": "Copier le lien de téléchargement", + "dialog": { + "initialLocation": "Aller à l'emplacement initial", + "multipleItemMessage": "Vous ne pouvez sélectionner qu'un seul élément", + "navigateBack": "Naviguer en arrière", + "navigateForward": "Naviguer vers l'avant", + "navigateUp": "Naviguer vers le haut d'un répertoire" + }, + "fileResource": { + "binaryFileQuery": "L'ouvrir peut prendre un certain temps et peut rendre l'IDE non réactif. Voulez-vous ouvrir '{0}' de toute façon?", + "binaryTitle": "Le fichier est soit binaire, soit utilise un encodage de texte non pris en charge.", + "largeFileTitle": "Le fichier est trop volumineux ({0}).", + "overwriteTitle": "Le fichier '{0}' a été modifié sur le système de fichiers." + }, + "filesExclude": "Configurez des modèles globaux pour exclure des fichiers et des dossiers. Par exemple, l'explorateur de fichiers décide des fichiers et des dossiers à afficher ou à masquer en fonction de ce paramètre.", + "format": "Format:", + "maxConcurrentUploads": "Nombre maximum de fichiers simultanés à télécharger lors du téléchargement de plusieurs fichiers. 0 signifie que tous les fichiers seront téléchargés simultanément.", + "maxFileSizeMB": "Contrôle la taille maximale du fichier en Mo qu'il est possible d'ouvrir.", + "prepareDownload": "Préparation du téléchargement...", + "prepareDownloadLink": "Préparation du lien de téléchargement...", + "processedOutOf": "Traitement de {0} sur {1}.", + "replaceTitle": "Remplacer le fichier", + "uploadFailed": "Une erreur s'est produite lors du téléchargement d'un fichier. {0}", + "uploadFiles": "Télécharger des fichiers...", + "uploadedOutOf": "Téléchargé {0} sur {1}" + }, + "getting-started": { + "ai": { + "header": "L'assistance IA dans l'IDE Theia est disponible (version bêta) !", + "openAIChatView": "Ouvrez dès maintenant la fenêtre AI Chat View pour découvrir comment commencer !" + }, + "apiComparator": "{0} Compatibilité avec l'API", + "newExtension": "Construire une nouvelle extension", + "newPlugin": "Créer un nouveau plugin", + "startup-editor": { + "welcomePage": "Ouvrez la page d'accueil, dont le contenu vous aidera à démarrer avec {0} et les extensions." + }, + "telemetry": "Utilisation des données et télémétrie" + }, + "git": { + "aFewSecondsAgo": "il y a quelques secondes", + "addSignedOff": "Ajouter Signé-par", + "added": "Ajouté", + "amendReuseMessage": "Pour réutiliser le dernier message de validation, appuyez sur 'Enter' ou 'Escape' pour annuler.", + "amendRewrite": "Réécrire le message de livraison précédent. Appuyez sur 'Enter' pour confirmer ou 'Escape' pour annuler.", + "checkoutCreateLocalBranchWithName": "Créez une nouvelle branche locale avec le nom : {0}. Appuyez sur 'Enter' pour confirmer ou 'Escape' pour annuler.", + "checkoutProvideBranchName": "Veuillez indiquer le nom de la succursale.", + "checkoutSelectRef": "Sélectionnez une référence à vérifier ou créez une nouvelle branche locale :", + "cloneQuickInputLabel": "Veuillez fournir un emplacement de dépôt Git. Appuyez sur 'Enter' pour confirmer ou 'Escape' pour annuler.", + "cloneRepository": "Cloner le dépôt Git : {0}. Appuyez sur 'Enter' pour confirmer ou 'Escape' pour annuler.", + "compareWith": "Comparez avec...", + "compareWithBranchOrTag": "Choisissez une branche ou une étiquette à comparer avec la branche {0} actuellement active :", + "conflicted": "En conflit", + "copied": "Copié", + "diff": "Diff", + "dirtyDiffLinesLimit": "Ne pas montrer les décorations de diff sales, si le nombre de lignes de l'éditeur dépasse cette limite.", + "dropStashMessage": "Cachette enlevée avec succès.", + "editorDecorationsEnabled": "Afficher les décorations git dans l'éditeur.", + "fetchPickRemote": "Choisissez une télécommande pour aller chercher :", + "gitDecorationsColors": "Utilisez la décoration par couleur dans le navigateur.", + "mergeEditor": { + "currentSideTitle": "Actuel", + "incomingSideTitle": "A venir" + }, + "mergeQuickPickPlaceholder": "Choisissez une branche à fusionner avec la branche {0} actuellement active :", + "missingUserInfo": "Assurez-vous de configurer votre 'user.name' et 'user.email' dans git.", + "noHistoryForError": "Il n'y a pas d'historique disponible pour {0}", + "noPreviousCommit": "Aucun engagement antérieur à modifier", + "noRepositoriesSelected": "Aucun dépôt n'a été sélectionné.", + "prepositionIn": "en", + "renamed": "Renommé", + "repositoryNotInitialized": "Le référentiel {0} n'est pas encore initialisé.", + "stashChanges": "Modifications de la cachette. Appuyez sur \" Enter \" pour confirmer ou sur \" Escape \" pour annuler.", + "stashChangesWithMessage": "Changements de cachette avec message : {0}. Appuyez sur 'Enter' pour confirmer ou 'Escape' pour annuler.", + "tabTitleIndex": "{0} (index)", + "tabTitleWorkingTree": "{0} (Arbre de travail)", + "toggleBlameAnnotations": "Annotations sur le blâme", + "unstaged": "Sans scène" + }, + "keybinding-schema-updater": { + "deprecation": "Utilisez la clause `when` à la place." + }, + "keymaps": { + "addKeybindingTitle": "Ajouter un raccourci clavier pour {0}", + "editKeybinding": "Modifier le couplage de touches...", + "editKeybindingTitle": "Modifier le raccourci clavier pour {0}", + "editWhenExpression": "Modifier lorsque l'expression...", + "editWhenExpressionTitle": "Modifier l'expression pour {0}", + "keybinding": { + "copy": "Copier la reliure du clavier", + "copyCommandId": "Copier l'ID de la commande de liaison au clavier", + "copyCommandTitle": "Titre de la commande Copy Keybinding", + "edit": "Modifier le couplage de touches...", + "editWhenExpression": "Modifier l'association de touches lorsque l'expression..." + }, + "keybindingCollidesValidation": "Les combinaisons de touches sont actuellement en conflit", + "requiredKeybindingValidation": "la valeur du keybinding est requise", + "resetKeybindingConfirmation": "Voulez-vous vraiment réinitialiser ce raccourci clavier à sa valeur par défaut?", + "resetKeybindingTitle": "Réinitialiser le raccourci clavier pour {0}", + "resetMultipleKeybindingsWarning": "Si plusieurs combinaisons de touches existent pour cette commande, elles seront toutes réinitialisées." + }, + "localize": { + "offlineTooltip": "Impossible de se connecter au backend." + }, + "markers": { + "clearAll": "Effacer tout", + "noProblems": "Aucun problème n'a été détecté dans l'espace de travail jusqu'à présent.", + "tabbarDecorationsEnabled": "Afficher les décorateurs de problèmes (marqueurs de diagnostic) dans les barres d'onglets." + }, + "memory-inspector": { + "addressTooltip": "Emplacement de mémoire à afficher, une adresse ou une expression évaluant une adresse.", + "ascii": "ASCII", + "binary": "Binaire", + "byteSize": "Taille de l'octet", + "bytesPerGroup": "Octets par groupe", + "closeSettings": "Fermer les paramètres", + "columns": "Colonnes", + "command": { + "createNewMemory": "Créer un nouvel inspecteur de la mémoire", + "createNewRegisterView": "Créer une nouvelle vue du registre", + "followPointer": "Suivre le pointeur", + "followPointerMemory": "Suivre le pointeur dans l'inspecteur de mémoire", + "resetValue": "Valeur de réinitialisation", + "showRegister": "Afficher le registre dans l'inspecteur de mémoire", + "viewVariable": "Afficher la variable dans l'inspecteur de mémoire" + }, + "data": "Données", + "decimal": "Décimal", + "diff": { + "label": "Diff : {0}" + }, + "diff-widget": { + "offset-label": "{0} Décalage", + "offset-title": "Octets pour décaler la mémoire de {0}" + }, + "editable": { + "apply": "Appliquer les changements", + "clear": "Changements clairs" + }, + "endianness": "Endianness", + "extraColumn": "Colonne supplémentaire", + "groupsPerRow": "Groupes par rangée", + "hexadecimal": "Hexadécimal", + "length": "Longueur", + "lengthTooltip": "Nombre d'octets à récupérer, en décimal ou en hexadécimal.", + "memory": { + "addressField": { + "memoryReadError": "Saisissez une adresse ou une expression dans le champ Emplacement." + }, + "freeze": "Vue de la mémoire figée", + "hideSettings": "Masquer le panneau des paramètres", + "readError": { + "bounds": "Les limites de la mémoire sont dépassées, le résultat sera tronqué.", + "noContents": "Aucun contenu de mémoire n'est actuellement disponible." + }, + "readLength": { + "memoryReadError": "Saisissez une longueur (nombre décimal ou hexadécimal) dans le champ Longueur." + }, + "showSettings": "Afficher le panneau des paramètres", + "unfreeze": "Dégeler la vue de la mémoire", + "userError": "Il y a eu une erreur de récupération de la mémoire." + }, + "memoryCategory": "Inspecteur de la mémoire", + "memoryInspector": "Inspecteur de la mémoire", + "memoryTitle": "Mémoire", + "octal": "Octal", + "offset": "Décalage", + "offsetTooltip": "Décalage à ajouter à l'emplacement mémoire actuel, lors de la navigation.", + "provider": { + "localsError": "Impossible de lire les variables locales. Aucune session de débogage active.", + "readError": "Impossible de lire la mémoire. Aucune session de débogage active.", + "writeError": "Impossible d'écrire en mémoire. Aucune session de débogage active." + }, + "register": "Registre", + "register-widget": { + "filter-placeholder": "Filtre (commence par)" + }, + "registerReadError": "Il y a eu une erreur dans la récupération des registres.", + "registers": "Registres", + "toggleComparisonWidgetVisibility": "Basculer la visibilité du widget de comparaison", + "utils": { + "afterBytes": "Vous devez charger de la mémoire dans les deux widgets que vous souhaitez comparer. {0} n'a pas de mémoire chargée.", + "bytesMessage": "Vous devez charger de la mémoire dans les deux widgets que vous souhaitez comparer. {0} n'a pas de mémoire chargée." + } + }, + "messages": { + "notificationTimeout": "Les notifications informatives seront masquées après ce délai.", + "toggleNotifications": "Basculer les notifications" + }, + "mini-browser": { + "typeUrl": "Tapez une URL" + }, + "monaco": { + "noSymbolsMatching": "Aucun symbole ne correspond", + "typeToSearchForSymbols": "Tapez pour rechercher des symboles" + }, + "navigator": { + "autoReveal": "Révélation automobile", + "clipboardWarn": "L'accès au presse-papiers est refusé. Vérifiez les autorisations de votre navigateur.", + "clipboardWarnFirefox": "L'API Presse-papiers n'est pas disponible. Elle peut être activée par la préférence '{0}' sur la page '{1}'. Rechargez ensuite Theia. Notez que cela permettra à FireFox d'avoir un accès complet au presse-papiers du système.", + "openWithSystemEditor": "Ouvrir avec l'éditeur système", + "refresh": "Rafraîchir dans l'Explorateur", + "reveal": "Révéler dans Explorer", + "systemEditor": "Éditeur de système", + "toggleHiddenFiles": "Basculer les fichiers cachés" + }, + "output": { + "clearOutputChannel": "Effacer le canal de sortie...", + "closeOutputChannel": "Fermer le canal de sortie...", + "hiddenChannels": "Canaux cachés", + "hideOutputChannel": "Cacher le canal de sortie...", + "maxChannelHistory": "Le nombre maximum d'entrées dans un canal de sortie.", + "outputChannels": "Canaux de sortie", + "showOutputChannel": "Afficher le canal de sortie..." + }, + "plugin": { + "blockNewTab": "Votre navigateur a empêché l'ouverture d'un nouvel onglet" + }, + "plugin-dev": { + "alreadyRunning": "L'instance hébergée est déjà en cours d'exécution.", + "debugInstance": "Instance de débogage", + "debugMode": "Utilisation de inspect ou inspect-brk pour le débogage de Node.js", + "debugPorts": { + "debugPort": "Port à utiliser pour le débogage Node.js de ce serveur" + }, + "devHost": "Hôte de développement", + "failed": "Échec de l'exécution de l'instance du plugin hébergé : {0}", + "hostedPlugin": "Plugin hébergé", + "hostedPluginRunning": "Plugin hébergé: en cours d'exécution", + "hostedPluginStarting": "Plugin hébergé: Démarrage", + "hostedPluginStopped": "Plugin hébergé: Arrêté", + "hostedPluginWatching": "Plugin hébergé: Regarder", + "instanceTerminated": "{0} a été résilié", + "launchOutFiles": "Tableau de motifs globaux pour localiser les fichiers JavaScript générés (`${pluginPath}` sera remplacé par le chemin réel du plugin).", + "noValidPlugin": "Le dossier spécifié ne contient pas de plugin valide.", + "notRunning": "L'instance hébergée ne fonctionne pas.", + "pluginFolder": "Le dossier du plugin est réglé sur : {0}", + "preventedNewTab": "Votre navigateur a empêché l'ouverture d'un nouvel onglet", + "restartInstance": "Redémarrer l'instance", + "running": "L'instance hébergée fonctionne à :", + "selectPath": "Sélectionner le chemin", + "startInstance": "Instance de départ", + "starting": "Démarrage du serveur d'instance hébergé ...", + "stopInstance": "Stop Instance", + "unknownTerminated": "L'instance a été interrompue", + "watchMode": "Lancer le watcher sur le plugin en cours de développement" + }, + "plugin-ext": { + "authentication-main": { + "loginTitle": "Connexion", + "signedOut": "Déconnexion réussie." + }, + "plugins": "Plugins", + "webviewTrace": "Contrôle le traçage de la communication avec les webviews.", + "webviewWarnIfUnsecure": "Avertit les utilisateurs que les webviews sont actuellement déployés de manière non sécurisée." + }, + "preferences": { + "ai-features": "Caractéristiques de l'IA", + "hostedPlugin": "Plugin hébergé", + "toolbar": "Barre d'outils" + }, + "preview": { + "openByDefault": "Ouvrir l'aperçu au lieu de l'éditeur par défaut." + }, + "property-view": { + "created": "Créé", + "directory": "Annuaire", + "lastModified": "Dernière modification", + "location": "Localisation", + "noProperties": "Aucune propriété disponible.", + "properties": "Propriétés", + "symbolicLink": "Lien symbolique" + }, + "remote": { + "dev-container": { + "connect": "Réouverture dans un conteneur", + "noDevcontainerFiles": "Aucun fichier devcontainer.json n'a été trouvé dans l'espace de travail. Veuillez vous assurer que vous avez un répertoire .devcontainer avec un fichier devcontainer.json.", + "selectDevcontainer": "Sélectionner un fichier devcontainer.json" + }, + "ssh": { + "connect": "Connecter la fenêtre actuelle à l'hôte...", + "connectToConfigHost": "Connecter la fenêtre actuelle à l'hôte dans le fichier de configuration...", + "enterHost": "Saisir le nom de l'hôte SSH", + "enterUser": "Saisir le nom d'utilisateur SSH", + "failure": "Impossible d'ouvrir une connexion SSH à distance.", + "hostPlaceHolder": "Par exemple : hello@example.com", + "needsHost": "Veuillez saisir un nom d'hôte.", + "needsUser": "Veuillez saisir un nom d'utilisateur.", + "userPlaceHolder": "Par exemple, bonjour" + }, + "sshNoConfigPath": "Aucun chemin de configuration SSH n'a été trouvé.", + "wsl": { + "connectToWsl": "Se connecter au WSL", + "connectToWslUsingDistro": "Se connecter à WSL en utilisant Distro...", + "noWslDistroFound": "Aucune distribution WSL n'a été trouvée. Veuillez d'abord installer une distribution WSL.", + "reopenInWsl": "Reopen Folder dans WSL", + "selectWSLDistro": "Sélectionner une distribution WSL" + } + }, + "scm": { + "amend": "Modifier", + "amendHeadCommit": "HEAD Commit", + "amendLastCommit": "Modifier le dernier engagement", + "changeRepository": "Modifier le référentiel...", + "config.untrackedChanges": "Contrôle le comportement des modifications non suivies.", + "config.untrackedChanges.hidden": "caché", + "config.untrackedChanges.mixed": "mixte", + "config.untrackedChanges.separate": "séparé", + "dirtyDiff": { + "close": "Fermer Modifier Regarder" + }, + "history": "Histoire", + "mergeEditor": { + "resetConfirmationTitle": "Voulez-vous vraiment réinitialiser le résultat de la fusion dans cet éditeur ?" + }, + "noRepositoryFound": "Aucun référentiel trouvé", + "unamend": "Non modifié", + "unamendCommit": "Engagement sans modification" + }, + "search-in-workspace": { + "includeIgnoredFiles": "Inclure les fichiers ignorés", + "noFolderSpecified": "Vous n'avez pas ouvert ou spécifié de dossier. Seuls les fichiers ouverts sont actuellement recherchés.", + "resultSubset": "Il ne s'agit que d'un sous-ensemble de tous les résultats. Utilisez un terme de recherche plus spécifique pour réduire la liste des résultats.", + "searchOnEditorModification": "Rechercher l'éditeur actif lorsqu'il est modifié." + }, + "secondary-window": { + "extract-widget": "Déplacer la vue vers une fenêtre secondaire" + }, + "shell-area": { + "secondary": "Fenêtre secondaire" + }, + "task": { + "attachTask": "Attacher la tâche...", + "circularReferenceDetected": "Référence circulaire détectée : {0} --> {1}", + "clearHistory": "Histoire claire", + "errorKillingTask": "Erreur de destruction de la tâche '{0}' : {1}", + "errorLaunchingTask": "Erreur de lancement de la tâche '{0}' : {1}", + "invalidTaskConfigs": "Des configurations de tâches non valides ont été trouvées. Ouvrez tasks.json et trouvez les détails dans la vue Problèmes.", + "neverScanTaskOutput": "Ne jamais analyser la sortie de la tâche", + "noTaskToRun": "Aucune tâche à exécuter n'a été trouvée. Configurer les tâches...", + "noTasksFound": "Aucune tâche trouvée", + "notEnoughDataInDependsOn": "Les informations fournies dans le \"dependsOn\" ne sont pas suffisantes pour correspondre à la tâche correcte !", + "schema": { + "commandOptions": { + "cwd": "Le répertoire de travail actuel du programme ou du script exécuté. S'il est omis, la racine de l'espace de travail actuel de Theia est utilisée." + }, + "presentation": { + "panel": { + "dedicated": "Le terminal est dédié à une tâche spécifique. Si cette tâche est exécutée à nouveau, le terminal est réutilisé. Cependant, la sortie d'une tâche différente est présentée dans un terminal différent.", + "new": "Chaque exécution de cette tâche utilise un nouveau terminal propre.", + "shared": "Le terminal est partagé et la sortie des autres tâches est ajoutée au même terminal." + }, + "showReuseMessage": "Contrôle l'affichage du message \"Le terminal sera réutilisé par les tâches\"." + }, + "problemMatcherObject": { + "owner": "Le propriétaire du problème à l'intérieur de Theia. Peut être omis si la base est spécifiée. La valeur par défaut est \"external\" si elle est omise et que la base n'est pas spécifiée." + } + }, + "taskAlreadyRunningInTerminal": "La tâche est déjà en cours d'exécution dans le terminal", + "taskExitedWithCode": "La tâche '{0}' s'est terminée avec le code {1}.", + "taskTerminalTitle": "Tâche : {0}", + "taskTerminatedBySignal": "La tâche '{0}' a été interrompue par le signal {1}.", + "terminalWillBeReusedByTasks": "Le terminal sera réutilisé par les tâches." + }, + "terminal": { + "defaultProfile": "Le profil par défaut utilisé sur {0}", + "enableCopy": "Activer la fonction ctrl-c (cmd-c sur macOS) pour copier le texte sélectionné", + "enablePaste": "Activer ctrl-v (cmd-v sur macOS) pour coller à partir du presse-papiers", + "profileArgs": "Les arguments du shell que ce profil utilise.", + "profileColor": "Un ID de couleur de thème de terminal à associer au terminal.", + "profileDefault": "Choisissez le profil par défaut...", + "profileIcon": "Un ID de codicon à associer à l'icône du terminal.\nterminal-tmux :\"$(terminal-tmux)\"", + "profileNew": "Nouveau terminal (avec profil)...", + "profilePath": "Le chemin du shell que ce profil utilise.", + "profiles": "Les profils à présenter lors de la création d'un nouveau terminal. Définissez manuellement la propriété path avec des args optionnels.\nDonnez la valeur `null` à un profil existant pour le masquer dans la liste, par exemple : `\"{0}\" : null`.", + "rendererType": "Contrôle la façon dont le terminal est rendu.", + "rendererTypeDeprecationMessage": "Le type de rendu n'est plus pris en charge en tant qu'option.", + "selectProfile": "Sélectionnez un profil pour le nouveau terminal", + "shell.deprecated": "Cette méthode est obsolète, la nouvelle méthode recommandée pour configurer votre shell par défaut est de créer un profil de terminal dans 'terminal.integrated.profiles.{0}' et de définir son nom de profil par défaut dans 'terminal.integrated.defaultProfile.{0}'.", + "shellArgsLinux": "Les arguments de ligne de commande à utiliser dans le terminal Linux.", + "shellArgsOsx": "Les arguments de ligne de commande à utiliser dans le terminal macOS.", + "shellArgsWindows": "Les arguments de ligne de commande à utiliser dans le terminal Windows.", + "shellLinux": "Le chemin du shell que le terminal utilise sous Linux (par défaut : '{0}'}).", + "shellOsx": "Le chemin de l'interpréteur de commandes que le terminal utilise sous macOS (par défaut : '{0}'}).", + "shellWindows": "Le chemin du shell que le terminal utilise sous Windows. (par défaut : '{0}')." + }, + "terminal-manager": { + "addTerminalToGroup": "Ajouter un terminal au groupe", + "closeDialog": { + "message": "Une fois le Terminal Manager fermé, sa disposition ne peut pas être restaurée. Êtes-vous sûr de vouloir fermer le Terminal Manager ?", + "title": "Voulez-vous fermer le gestionnaire de terminal ?" + }, + "closeTerminalManager": "Fermer Terminal Manager", + "createNewTerminalGroup": "Créer un nouveau groupe de terminaux", + "createNewTerminalPage": "Créer une nouvelle page de terminal", + "deleteGroup": "Supprimer le groupe", + "deletePage": "Supprimer la page", + "deleteTerminal": "Supprimer Terminal", + "group": "Groupe", + "label": "Terminaux", + "maximizeBottomPanel": "Maximiser le panneau inférieur", + "minimizeBottomPanel": "Réduire le panneau inférieur", + "openTerminalManager": "Ouvrir le gestionnaire de terminaux", + "page": "Page", + "rename": "Renommer", + "resetTerminalManagerLayout": "Réinitialiser la disposition du gestionnaire de terminaux", + "toggleTreeView": "Basculer l'affichage arborescent" + }, + "test": { + "cancelAllTestRuns": "Annuler tous les essais", + "stackFrameAt": "à", + "testRunDefaultName": "{0} courir {1}", + "testRuns": "Essais" + }, + "toolbar": { + "addCommand": "Ajouter une commande à la barre d'outils", + "addCommandPlaceholder": "Trouver une commande à ajouter à la barre d'outils", + "centerColumn": "Colonne centrale", + "failedUpdate": "Impossible de mettre à jour la valeur de '{0}' dans '{1}'.", + "filterIcons": "Icônes de filtre", + "iconSelectDialog": "Sélectionnez une icône pour '{0}'.", + "iconSet": "Jeu d'icônes", + "insertGroupLeft": "Insérer le séparateur de groupe (gauche)", + "insertGroupRight": "Insérer un séparateur de groupe (à droite)", + "leftColumn": "Colonne de gauche", + "openJSON": "Personnaliser la barre d'outils (Ouvrir JSON)", + "removeCommand": "Supprimer la commande de la barre d'outils", + "restoreDefaults": "Restaurer les valeurs par défaut de la barre d'outils", + "rightColumn": "Colonne de droite", + "selectIcon": "Sélectionnez l'icône", + "toggleToolbar": "Afficher la barre d'outils", + "toolbarLocationPlaceholder": "Où souhaitez-vous que la commande soit ajoutée?", + "useDefaultIcon": "Utiliser l'icône par défaut" + }, + "typehierarchy": { + "subtypeHierarchy": "Hiérarchie des sous-types", + "supertypeHierarchy": "Hiérarchie des supertypes" + }, + "variableResolver": { + "listAllVariables": "Variable : Tout lister" + }, + "vsx-registry": { + "confirmDialogMessage": "L'extension \"{0}\" n'est pas vérifiée et peut présenter un risque pour la sécurité.", + "confirmDialogTitle": "Êtes-vous sûr de vouloir procéder à l'installation ?", + "downloadCount": "Compte de téléchargement : {0}", + "errorFetching": "Erreur de récupération des extensions.", + "errorFetchingConfigurationHint": "Cela peut être dû à des problèmes de configuration du réseau.", + "failedInstallingVSIX": "Échec de l'installation de {0} à partir de VSIX.", + "invalidVSIX": "Le fichier sélectionné n'est pas un plugin \"*.vsix\" valide.", + "license": "Licence : {0}", + "onlyShowVerifiedExtensionsDescription": "Cela permet à {0} de n'afficher que les extensions vérifiées.", + "onlyShowVerifiedExtensionsTitle": "Afficher uniquement les extensions vérifiées", + "recommendedExtensions": "Une liste des noms des extensions dont l'utilisation est recommandée dans cet espace de travail.", + "searchPlaceholder": "Rechercher les extensions dans {0}", + "showInstalled": "Afficher les extensions installées", + "showRecommendedExtensions": "Contrôle si les notifications sont affichées pour les recommandations d'extension.", + "vsx-extensions-contribution": { + "update-version-uninstall-error": "Erreur lors de la suppression de l'extension : {0}.", + "update-version-version-error": "Échec de l'installation de la version {0} de {1}." + } + }, + "webview": { + "goToReadme": "Aller au fichier README", + "messageWarning": " Le modèle d'hôte du point de terminaison {0} a été remplacé par `{1}` ; la modification du modèle peut entraîner des failles de sécurité. Voir `{2}` pour plus d'informations." + }, + "workspace": { + "bothAreDirectories": "Les deux ressources sont des répertoires.", + "clickToManageTrust": "Cliquez pour gérer les paramètres de confiance.", + "compareWithEachOther": "Comparer entre eux", + "confirmDeletePermanently.description": "Impossible de supprimer \"{0}\" avec la corbeille. Voulez-vous le supprimer définitivement?", + "confirmDeletePermanently.solution": "Vous pouvez désactiver l'utilisation de la corbeille dans les préférences.", + "confirmDeletePermanently.title": "Erreur lors de la suppression d'un fichier", + "confirmMessage.delete": "Voulez-vous vraiment supprimer les fichiers suivants?", + "confirmMessage.dirtyMultiple": "Voulez-vous vraiment supprimer {0} fichiers avec des modifications non sauvegardées?", + "confirmMessage.dirtySingle": "Voulez-vous vraiment supprimer {0} avec les modifications non sauvegardées?", + "confirmMessage.uriMultiple": "Voulez-vous vraiment supprimer tous les {0} fichiers sélectionnés?", + "confirmMessage.uriSingle": "Voulez-vous vraiment supprimer {0}?", + "directoriesCannotBeCompared": "Les répertoires ne peuvent pas être comparés. {0}", + "duplicate": "Duplicate", + "failSaveAs": "Impossible d'exécuter \"{0}\" pour le widget actuel.", + "isDirectory": "{0}« est un répertoire.", + "manageTrustPlaceholder": "Sélectionnez l'état de confiance pour cet espace de travail.", + "newFilePlaceholder": "Nom du fichier", + "newFolderPlaceholder": "Nom du dossier", + "noErasure": "Note : Rien ne sera effacé du disque", + "notWorkspaceFile": "Fichier d'espace de travail non valide : {0}", + "openRecentPlaceholder": "Tapez le nom de l'espace de travail que vous voulez ouvrir.", + "openRecentWorkspace": "Ouvrir l'espace de travail récent...", + "preserveWindow": "Permet d'ouvrir les espaces de travail dans la fenêtre actuelle.", + "removeFolder": "Êtes-vous sûr de vouloir supprimer le dossier suivant de l'espace de travail?", + "removeFolders": "Êtes-vous sûr de vouloir supprimer les dossiers suivants de l'espace de travail?", + "restrictedModeDescription": "Certaines fonctionnalités sont désactivées car cet espace de travail n'est pas approuvé.", + "restrictedModeNote": "*Remarque : la fonctionnalité de confiance de l'espace de travail est actuellement en cours de développement dans Theia ; toutes les fonctionnalités ne sont pas encore intégrées à la confiance de l'espace de travail.*", + "schema": { + "folders": { + "description": "Dossiers racine dans l'espace de travail" + }, + "title": "Fichier de l'espace de travail" + }, + "trashTitle": "Déplacer {0} vers la corbeille", + "trustEmptyWindow": "Contrôle si l'espace de travail vide est fiable ou non par défaut.", + "trustEnabled": "Contrôle si la confiance de l'espace de travail est activée ou non. S'il est désactivé, tous les espaces de travail sont fiables.", + "trustTrustedFolders": "Liste des URI de dossiers considérés comme fiables sans demande de confirmation.", + "untitled-cleanup": "Il semble y avoir de nombreux fichiers d'espace de travail sans titre. Veuillez vérifier {0} et supprimer tous les fichiers inutilisés.", + "variables": { + "cwd": { + "description": "Répertoire de travail actuel du gestionnaire de tâches au démarrage" + }, + "file": { + "description": "Chemin d'accès du fichier actuellement ouvert" + }, + "fileBasename": { + "description": "Le nom de base du fichier actuellement ouvert" + }, + "fileBasenameNoExtension": { + "description": "Nom du fichier actuellement ouvert sans extension" + }, + "fileDirname": { + "description": "Le nom du répertoire du fichier actuellement ouvert" + }, + "fileExtname": { + "description": "L'extension du fichier actuellement ouvert" + }, + "relativeFile": { + "description": "Chemin d'accès du fichier actuellement ouvert par rapport à la racine de l'espace de travail" + }, + "relativeFileDirname": { + "description": "Le nom du répertoire du fichier actuellement ouvert par rapport à ${workspaceFolder}" + }, + "workspaceFolder": { + "description": "Chemin d'accès au dossier racine de l'espace de travail" + }, + "workspaceFolderBasename": { + "description": "Le nom du dossier racine de l'espace de travail" + }, + "workspaceRoot": { + "description": "Chemin d'accès au dossier racine de l'espace de travail" + }, + "workspaceRootFolderName": { + "description": "Le nom du dossier racine de l'espace de travail" + } + }, + "workspaceFolderAdded": "Un espace de travail avec plusieurs racines a été créé. Voulez-vous enregistrer la configuration de votre espace de travail dans un fichier?", + "workspaceFolderAddedTitle": "Dossier ajouté à l'espace de travail" + } + }, + "vsx.disabling": "Désactivation", + "vsx.disabling.extensions": "Désactivation de {0}...", + "vsx.enabling": "Habilitation", + "vsx.enabling.extension": "Permettre à {0}..." +} diff --git a/packages/core/i18n/nls.hu.json b/packages/core/i18n/nls.hu.json new file mode 100644 index 0000000..1aa8420 --- /dev/null +++ b/packages/core/i18n/nls.hu.json @@ -0,0 +1,2097 @@ +{ + "ai-chat-ui.show-settings": "AI beállítások megjelenítése", + "ai-chat:summarize-session-as-task-for-coder": "A munkamenet összefoglalása a kódoló feladata", + "ai.executePlanWithCoder": "A jelenlegi terv végrehajtása kódolóval", + "ai.updateTaskContext": "Aktuális feladatkörnyezet frissítése", + "aiConfiguration:open": "AI konfigurációs nézet megnyitása", + "aiHistory:clear": "AI történelem: Előzmények törlése", + "aiHistory:open": "AI előzmények nézet megnyitása", + "aiHistory:sortChronologically": "AI történelem: Rendezés időrendben", + "aiHistory:sortReverseChronologically": "AI történelem: Fordított kronológiai rendezés", + "aiHistory:toggleCompact": "AI történelem: Kompakt nézet váltása", + "aiHistory:toggleHideNewlines": "AI történelem: Az újsorok értelmezésének leállítása", + "aiHistory:toggleRaw": "AI történelem: Nyers nézet átkapcsolása", + "aiHistory:toggleRenderNewlines": "AI történelem: Újsorok értelmezése", + "debug.breakpoint.editCondition": "Szerkesztési feltétel...", + "debug.breakpoint.removeSelected": "Kijelölt töréspontok eltávolítása", + "debug.breakpoint.toggleEnabled": "Toggle Enable Breakpoints", + "notebook.cell.changeToCode": "Cellát kódra váltani", + "notebook.cell.changeToMarkdown": "Cellát átváltoztatni Mardown-ra", + "notebook.cell.insertMarkdownCellAbove": "Markdown-cella beszúrása fent", + "notebook.cell.insertMarkdownCellBelow": "Markdown-cella beszúrása az alábbiakban", + "terminal:new:profile": "Új integrált terminál létrehozása profilból", + "terminal:profile:default": "Válassza ki az alapértelmezett terminálprofilt", + "theia": { + "ai": { + "agents": { + "completionNotification": { + "mdDescription": "Értesítési viselkedés, amikor ez az ügynök befejez egy feladatot. Ha nincs beállítva, akkor a globális alapértelmezett értesítési beállítás lesz használva.\n - `os-notification`: OS/rendszer értesítések megjelenítése\n - `message`: Értesítések megjelenítése az állapotsorban/üzenet területen\n - `blink`: A felhasználói felület villogtatása vagy kiemelése\n - `off`: Értesítések kikapcsolása az ügynök számára", + "title": "Befejezési értesítés" + }, + "enable": { + "mdDescription": "Megadja, hogy az ügynök engedélyezve (true) vagy letiltva (false) legyen.", + "title": "Ügynök engedélyezése" + }, + "languageModelRequirements": { + "identifier": { + "mdDescription": "A használandó nyelvi modell azonosítója." + }, + "mdDescription": "Megadja az ügynök használt nyelvi modelljeit.", + "purpose": { + "mdDescription": "A nyelvi modell használatának célja.", + "title": "Cél" + }, + "title": "Nyelvi modell követelmények" + }, + "mdDescription": "Az ügynökbeállítások konfigurálása, például egyes ügynökök engedélyezése vagy letiltása, a felszólítások konfigurálása és az LLM-ek kiválasztása.", + "selectedVariants": { + "mdDescription": "Megadja az ügynök jelenleg kiválasztott prompt-változatát.", + "title": "Kiválasztott változatok" + }, + "title": "Ügynöki beállítások" + }, + "anthropic": { + "apiKey": { + "description": "Adja meg a hivatalos Anthropic-fiókjának API-kulcsát. **Figyelem:** Ha ezt a beállítást használja, az Anthropic API-kulcsa tiszta szövegben lesz tárolva a Theia-t futtató gépen. A kulcs biztonságos beállításához használja az `ANTHROPIC_API_KEY` környezeti változót." + }, + "models": { + "description": "Hivatalos antropikus modellek használata" + } + }, + "chat": { + "agent": { + "architect": "Építész", + "coder": "kódoló", + "universal": "Universal" + }, + "applySuggestion": "Javaslat alkalmazása", + "bypassModelRequirement": { + "description": "A nyelvi modell követelmény ellenőrzésének megkerülése. Engedélyezze ezt, ha olyan külső ügynököket (pl. Claude Code) használ, amelyek nem igényelnek Theia nyelvi modelleket." + }, + "changeSetDefaultTitle": "Javasolt változtatások", + "changeSetFileDiffUriLabel": "AI-változások: {0}", + "chatAgentsVariable": { + "description": "Visszaadja a rendszerben elérhető chat-ügynökök listáját" + }, + "chatSessionNamingAgent": { + "description": "Ügynök a csevegési munkamenet nevek generálásához", + "vars": { + "conversation": { + "description": "A csevegés tartalma." + }, + "listOfSessionNames": { + "description": "A meglévő munkamenetnevek listája." + } + } + }, + "chatSessionSummaryAgent": { + "description": "Ügynök a csevegési munkamenet-összefoglalók létrehozásához." + }, + "confirmApplySuggestion": "A {0} fájl a javaslat létrehozása óta megváltozott. Biztos, hogy alkalmazni kívánja a változtatást?", + "confirmRevertSuggestion": "A {0} fájl a javaslat létrehozása óta megváltozott. Biztos, hogy vissza szeretné állítani a változtatást?", + "couldNotFindMatchingLM": "Nem talált megfelelő nyelvi modellt. Kérjük, ellenőrizze a beállításait!", + "couldNotFindReadyLMforAgent": "Nem találtam kész nyelvi modellt az ügynökhöz {0}. Kérjük, ellenőrizze a beállításokat!", + "defaultAgent": { + "description": "Nem kötelező: a meghívandó csevegőügynök, ha a felhasználói lekérdezésben nincs kifejezetten @ címmel megemlített ügynök. Ha nincs megadva alapértelmezett ügynök, a Theia alapértelmezett beállításai kerülnek alkalmazásra." + }, + "imageContextVariable": { + "args": { + "data": { + "description": "A kép adatai base64-ben." + }, + "mimeType": { + "description": "A kép mimetype típusa." + }, + "name": { + "description": "A képfájl neve, ha rendelkezésre áll." + }, + "wsRelativePath": { + "description": "A képfájl munkaterülethez viszonyított elérési útja, ha rendelkezésre áll." + } + }, + "description": "A kép kontextusára vonatkozó információkat nyújt", + "label": "Képfájl" + }, + "orchestrator": { + "description": "Ez az ügynök elemzi a felhasználó kérését az összes rendelkezésre álló chat-ügynök leírása alapján, és kiválasztja a legmegfelelőbb ügynököt a kérés megválaszolására (mesterséges intelligencia segítségével).A felhasználó kérése további megerősítés nélkül közvetlenül a kiválasztott ügynökhöz kerül delegálásra.", + "vars": { + "availableChatAgents": { + "description": "Azoknak a csevegőügynököknek a listája, akiket az operátor delegálhat, kivéve a kizárási lista beállításban megadott ügynököket." + } + } + }, + "pinChatAgent": { + "description": "Ha engedélyezi az ügynök kitűzését, akkor az említett csevegőügynök automatikusan aktív marad az összes felszólítás között, csökkentve ezzel az ismételt említések szükségességét.Az ügynökök kitűzését vagy váltását bármikor manuálisan feloldhatja." + }, + "revertSuggestion": "Javaslat visszavonása", + "selectImageFile": "Képfájl kiválasztása", + "sessionStorage": { + "description": "Állítsa be, hogy hol tárolja a csevegési munkameneteket.", + "globalPath": "Globális út", + "pathNotUsedForScope": "{0}-tárolási hatókörrel nem használható.", + "pathRequired": "Az elérési út nem lehet üres", + "pathSettings": "Útvonal beállítások", + "resetToDefault": "Alapértelmezett értékre visszaállítás", + "scope": { + "global": "A csevegési munkameneteket a globális konfigurációs mappában tárolja.", + "workspace": "A csevegési munkameneteket tárolja a munkaterület mappában." + }, + "workspacePath": "Munkaterület elérési útvonala" + }, + "taskContextService": { + "summarizeProgressMessage": "Összefoglalja: {0}", + "updatingProgressMessage": "Frissítés: {0}" + }, + "toolConfirmation": { + "confirm": { + "description": "Kérjen megerősítést az eszközök végrehajtása előtt" + }, + "disabled": { + "description": "Az eszköz végrehajtásának letiltása" + }, + "yolo": { + "description": "Az eszközök automatikus végrehajtása megerősítés nélkül" + } + }, + "view": { + "label": "AI Chat" + } + }, + "chat-ui": { + "addContextVariable": "Kontextusváltozó hozzáadása", + "agent": "ügynök", + "aiDisabled": "Az AI funkciók le vannak tiltva", + "applyAll": "Alkalmazni mindent", + "applyAllTitle": "Alkalmazza az összes függőben lévő módosítást", + "askQuestion": "Kérdezzen valamit", + "attachToContext": "Elemek csatolása a kontextushoz", + "cancel": "Törlés (Esc)", + "chat-view-tree-widget": { + "ai": "AI", + "aiFeatureHeader": "🚀 AI funkciók elérhetőek (Alpha verzió)!", + "featuresDisabled": "Jelenleg minden AI funkció le van tiltva!", + "generating": "Generálás", + "howToEnable": "Az AI funkciók engedélyezése:", + "noRenderer": "Hiba: Nem talált renderelőt", + "scrollToBottom": "Ugrás a legutóbbi üzenetre", + "waitingForInput": "Várakozás a bemenetre", + "you": "Te" + }, + "chatInput": { + "clearHistory": "Beviteli súgó előzményeinek törlése", + "cycleMode": "Cycle Chat mód", + "nextPrompt": "Következő felszólítás", + "previousPrompt": "Előző Prompt" + }, + "chatInputAriaLabel": "Írja be üzenetét ide", + "chatResponses": "Csevegési válaszok", + "code-part-renderer": { + "generatedCode": "Generált kód" + }, + "collapseChangeSet": "Összecsukás Változáskészlet", + "command-part-renderer": { + "commandNotExecutable": "A parancs azonosítója \"{0}\", de nem futtatható a Chat ablakból." + }, + "copyCodeBlock": "Kódblokk másolása", + "couldNotSendRequestToSession": "Nem sikerült elküldeni a \"{0}\" kérelmet a munkamenetnek. {1}", + "delegation-response-renderer": { + "prompt": { + "label": "Delegált kérés:" + }, + "response": { + "label": "Válasz:" + }, + "starting": "Kezdő delegáció...", + "status": { + "canceled": "törölve", + "error": "hiba", + "generating": "generáló...", + "starting": "kezdődik..." + } + }, + "deleteChangeSet": "Váltáskészlet törlése", + "editRequest": "Szerkesztés", + "edited": "szerkesztett", + "editedTooltipHint": "Ez a prompt változat szerkesztésre került. Az AI konfigurációs nézetben visszaállíthatja.", + "enterChatName": "Csevegőnév megadása", + "errorChatInvocation": "Hiba történt a chatszolgáltatás meghívása során.", + "expandChangeSet": "Változáskészlet kibontása", + "failedToDeleteSession": "Nem sikerült törölni a csevegési munkamenetet", + "failedToLoadChats": "Nem sikerült betölteni a chat munkameneteket", + "failedToRestoreSession": "Nem sikerült visszaállítani a csevegési munkamenetet", + "failedToRetry": "Sikertelen újrakezdés üzenet", + "focusInput": "Fókusz csevegés bevitel", + "focusResponse": "Fókusz csevegés válasz", + "noChatAgentsAvailable": "Nem állnak rendelkezésre chat-ügynökök.", + "openDiff": "Nyitott diff", + "openOriginalFile": "Eredeti fájl megnyitása", + "performThisTask": "Végezze el ezt a feladatot.", + "persistedSession": "Megmaradt munkamenet (kattintson a visszaállításhoz)", + "removeChat": "Chat eltávolítása", + "renameChat": "Chat átnevezése", + "requestNotFoundForRetry": "A kérés nem található megismételt próbálkozáshoz", + "responseFrom": "{0} válasza", + "selectAgentQuickPickPlaceholder": "Válasszon ki egy ügynököt az új munkamenethez", + "selectChat": "Válassza ki a csevegést", + "selectContextVariableQuickPickPlaceholder": "Válassza ki az üzenethez csatolandó kontextusváltozót.", + "selectTaskContextQuickPickItem": { + "currentlyOpen": "jelenleg nyitva" + }, + "selectTaskContextQuickPickPlaceholder": "Válassza ki a csatolandó feladatkörnyezetet", + "selectVariableArguments": "Változó argumentumok kiválasztása", + "send": "Küldés (Enter)", + "sessionNotFoundForRetry": "Az újbóli próbálkozáshoz nem talált munkamenet", + "text-part-renderer": { + "cantDisplay": "Nem tudja megjeleníteni a választ, kérjük ellenőrizze a ChatResponsePartRenderereket!" + }, + "thinking-part-renderer": { + "thinking": "Gondolkodás" + }, + "toolcall-part-renderer": { + "denied": "Végrehajtás megtagadva", + "finished": "Ran", + "rejected": "Végrehajtás törölték" + }, + "toolconfirmation": { + "allow-options-dropdown-tooltip": "További lehetőségek engedélyezése", + "allow-session": "Engedélyezze ezt a csevegést", + "allowed": "Szerszám végrehajtás engedélyezett", + "alwaysAllowConfirm": "Értem, engedélyezem az automatikus jóváhagyást", + "alwaysAllowTitle": "Engedélyezze az automatikus jóváhagyást a „{0}” számára?", + "canceled": "Eszköz végrehajtása törölve", + "denied": "Eszköz végrehajtása megtagadva", + "deny-forever": "Mindig megtagadni", + "deny-options-dropdown-tooltip": "További letiltási lehetőségek", + "deny-reason-placeholder": "Adja meg az elutasítás okát...", + "deny-session": "Megtagadni erre a csevegésre", + "deny-with-reason": "Ésszerűen tagadni...", + "executionDenied": "Eszköz végrehajtása megtagadva", + "header": "Az eszköz végrehajtásának megerősítése" + }, + "unableToSummarizeCurrentSession": "Az aktuális munkamenet összegzése nem lehetséges. Kérjük, erősítse meg, hogy az összefoglaló ügynök nincs letiltva.", + "unknown-part-renderer": { + "contentNotRestoreable": "Ezt a tartalmat (típus '{0}') nem lehetett teljes mértékben helyreállítani. Lehet, hogy egy olyan kiterjesztésből származik, amely már nem elérhető." + }, + "unpinAgent": "Unpin ügynök", + "variantTooltip": "Prompt változat: {0}", + "yourMessage": "Üzeneted" + }, + "claude-code": { + "agentDescription": "Anthropic kódoló ügynöke", + "askBeforeEdit": "Kérdezzen, mielőtt szerkeszt!", + "changeSetTitle": "Változások Claude kód szerint", + "clearCommand": { + "description": "Új munkamenet létrehozása" + }, + "compactCommand": { + "description": "Kompakt beszélgetés opcionális fókuszálási utasításokkal" + }, + "completedCount": "{0}/{1} befejezve", + "configCommand": { + "description": "Nyitott Claude kód konfigurációja" + }, + "currentDirectory": "jelenlegi könyvtár", + "differentAgentRequestWarning": "Az előző csevegő kérést egy másik ügynök kezelte. Claude Code nem látja ezeket a többi üzenetet.", + "directory": "Címtár", + "domain": "Domain", + "editAutomatically": "Automatikus szerkesztés", + "editNumber": "Szerkesztés {0}", + "editing": "Szerkesztés", + "editsCount": "{0} szerkesztések", + "emptyTodoList": "Nem minden elérhető", + "entireFile": "Teljes fájl", + "excludingOnePattern": " (kivéve 1 mintát)", + "excludingPatterns": " (kivéve {0} minták)", + "executedCommand": "Kivégezték: {0}", + "failedToParseBashToolData": "Nem sikerült elemezni a Bash eszköz adatait", + "failedToParseEditToolData": "Nem sikerült elemezni az Edit tool adatokat", + "failedToParseGlobToolData": "Nem sikerült elemezni a Glob eszköz adatait", + "failedToParseGrepToolData": "A Grep eszköz adatainak elemzése nem sikerült", + "failedToParseLSToolData": "Nem sikerült elemezni az LS eszköz adatait", + "failedToParseMultiEditToolData": "A MultiEdit eszköz adatainak elemzése nem sikerült", + "failedToParseReadToolData": "Sikerült elemezni a Read tool adatokat", + "failedToParseTodoListData": "Nem sikerült elemezni a todo lista adatait", + "failedToParseWebFetchToolData": "A WebFetch eszköz adatainak elemzése nem sikerült", + "failedToParseWriteToolData": "Sikerült elemezni a Write tool adatokat", + "fetching": "Hozd el a", + "fileFilter": "Fájl szűrő", + "filePath": "Fájl elérési útvonal", + "fileType": "Fájltípus", + "findMatchingFiles": "A \"{0}\" glob mintának megfelelő fájlok keresése az aktuális könyvtárban", + "findMatchingFilesWithPath": "A \"{0}\" globális mintára illeszkedő fájlok keresése az alábbiakban {1}", + "finding": "A megtalálása", + "from": "A címről", + "globPattern": "globusminta", + "grepOptions": { + "caseInsensitive": "case-insensitive", + "glob": "földgömb: {0}", + "headLimit": "határérték: {0}", + "lineNumbers": "sorszámok", + "linesAfter": "+{0} után", + "linesBefore": "+{0} előtt", + "linesContext": "±{0} kontextus", + "multiLine": "többsoros", + "type": "típus: {0}" + }, + "grepOutputModes": { + "content": "tartalom", + "count": "Számolj", + "filesWithMatches": "fájlok egyezéssel" + }, + "ignoredPatterns": "Figyelmen kívül hagyott minták", + "ignoringPatterns": "A {0} minták figyelmen kívül hagyása", + "initCommand": { + "description": "Projekt inicializálása a CLAUDE.md útmutatóval" + }, + "itemCount": "{0} tételek", + "lineLimit": "Vonalhatár", + "lines": "Vonalak", + "listDirectoryContents": "Könyvtár tartalmának listázása", + "listing": "Listázás", + "memoryCommand": { + "description": "CLAUDE.md memória fájl szerkesztése" + }, + "multiEditing": "Többszörös szerkesztés", + "oneEdit": "1 szerkesztés", + "oneItem": "1 tétel", + "oneOption": "1 lehetőség", + "openDirectoryTooltip": "Kattintson a könyvtár megnyitásához", + "openFileTooltip": "Kattintson a fájl szerkesztőben történő megnyitásához", + "optionsCount": "{0} opciók", + "partial": "Részleges", + "pattern": "Mintázat", + "plan": "Tervezési mód", + "project": "projekt", + "projectRoot": "projekt gyökere", + "readMode": "Olvasási mód", + "reading": "Olvasás", + "replaceAllCount": "{0} replace-all", + "replaceAllOccurrences": "Minden előfordulás cseréje", + "resumeCommand": { + "description": "Munkamenet folytatása" + }, + "reviewCommand": { + "description": "Kódellenőrzés kérése" + }, + "searchPath": "Keresési útvonal", + "searching": "Keresés", + "startingLine": "Startvonal", + "timeout": "Időkorlátozás", + "timeoutInMs": "Időkorlát: {0}ms", + "to": "A címre.", + "todoList": "Todo lista", + "todoPriority": { + "high": "magas", + "low": "alacsony", + "medium": "közepes" + }, + "toolApprovalRequest": "Claude Code a \"{0}\" eszközt szeretné használni. Engedélyezni akarja ezt?", + "totalEdits": "Összes szerkesztés", + "webFetch": "Web Fetch", + "writing": "Írás" + }, + "code-completion": { + "progressText": "AI kód kitöltésének kiszámítása..." + }, + "codex": { + "agentDescription": "Az OpenAI kódolási asszisztense, a Codex által támogatva", + "completedCount": "{0}/{1} befejezett", + "exitCode": "Kilépési kód: {0}", + "fileChangeFailed": "A Codex nem alkalmazta a következőkre vonatkozó változtatásokat: {0}", + "fileChangeFailedGeneric": "A Codex nem tudta alkalmazni a fájlváltozásokat.", + "itemCount": "{0} tételek", + "noItems": "Nincs elem", + "oneItem": "1 tétel", + "running": "Futás...", + "searched": "Keresett", + "searching": "Keresés", + "todoList": "Minden lista", + "webSearch": "Webes keresés" + }, + "completion": { + "agent": { + "description": "Ez az ügynök soron belüli kódkiegészítést biztosít a Theia IDE kódszerkesztőjében.", + "vars": { + "file": { + "description": "A szerkesztett fájl URI-je" + }, + "language": { + "description": "A szerkesztett fájl languageId azonosítója" + }, + "prefix": { + "description": "A kurzor aktuális pozíciója előtti kód" + }, + "suffix": { + "description": "A kurzor aktuális pozíciója utáni kód" + } + } + }, + "automaticEnable": { + "description": "Szerkesztés közben automatikusan kiválthatja a mesterséges intelligencia kiegészítéseket bármely (monacói) szerkesztőprogramban. \n Alternatívaként manuálisan is kiválthatja a kódot a \"Trigger Inline Suggestion\" paranccsal vagy az alapértelmezett \"Ctrl+Alt+Space\" gyorsbillentyűvel." + }, + "cacheCapacity": { + "description": "A gyorsítótárban tárolt kódkitöltések maximális száma. A magasabb szám javíthatja a teljesítményt, de több memóriát fogyaszt. A minimális érték 10, az ajánlott tartomány 50-200 között van.", + "title": "Kódkiegészítő gyorsítótár kapacitása" + }, + "debounceDelay": { + "description": "Ezredmásodpercben kifejezve szabályozza a késleltetést a mesterséges intelligencia befejezésének elindítása előtt, miután a szerkesztőben változások észlelésre kerültek. Az `Automatic Code Completion` (Automatikus kódkiegészítés) engedélyezése szükséges. A késleltetés kikapcsolásához adjon meg 0 értéket.", + "title": "Debounce késleltetés" + }, + "excludedFileExts": { + "description": "Adja meg azokat a fájlkiterjesztéseket (pl. .md, .txt), amelyeknél a mesterséges intelligencia kitöltését le kell tiltani.", + "title": "Kizárt fájlkiterjesztések" + }, + "fileVariable": { + "description": "A szerkesztett fájl URI-je. Csak kódkiegészítési kontextusban érhető el." + }, + "languageVariable": { + "description": "A szerkesztett fájl languageId azonosítója. Csak kódkiegészítési kontextusban érhető el." + }, + "maxContextLines": { + "description": "A kontextusként használt sorok maximális száma, a kurzor pozíciója előtti és utáni sorok között elosztva (előtag és utótag). Állítsa ezt -1-re, ha a teljes fájlt szeretné használni kontextusként, sorhatár nélkül, és 0-ra, ha csak az aktuális sort szeretné használni.", + "title": "Maximális kontextus Vonalak" + }, + "prefixVariable": { + "description": "A kurzor aktuális pozíciója előtti kód. Csak kódkiegészítési kontextusban érhető el." + }, + "stripBackticks": { + "description": "Eltávolítja a környező backtickeket az egyes LLM-ek által visszaküldött kódból. Ha backticket észlel, a záró backtick utáni összes tartalom is eltávolításra kerül. Ez a beállítás segít biztosítani, hogy egyszerű kódot kapjunk vissza, amikor a nyelvi modellek leütésszerű formázást használnak.", + "title": "Visszautalások eltávolítása a soron belüli kitöltésekből" + }, + "suffixVariable": { + "description": "A kurzor aktuális pozíciója utáni kód. Csak kódkiegészítési kontextusban érhető el." + } + }, + "configuration": { + "selectItem": "Kérjük, válasszon egy elemet." + }, + "copilot": { + "auth": { + "aiConfiguration": "AI konfiguráció", + "authorize": "Engedélyeztem", + "copied": "Másolva!", + "copyCode": "Kód másolása", + "expired": "Az engedély lejárt vagy elutasításra került. Kérjük, próbálkozzon újra.", + "hint": "A kód beírása és az engedélyezés után kattintson az alábbi „Engedélyeztem” gombra.", + "initiating": "Hitelesítés indítása...", + "instructions": "Ahhoz, hogy Theia számára engedélyezze a GitHub Copilot használatát, látogasson el az alábbi URL-re, és írja be a kódot:", + "openGitHub": "Nyisd meg a GitHubot", + "success": "Sikeresen bejelentkezett a GitHub Copilotba!", + "successHint": "Ha GitHub-fiókod hozzáférést biztosít a Copilothoz, akkor mostantól beállíthatod a Copilot nyelvi modelleket a ", + "title": "Jelentkezzen be a GitHub Copilotba", + "tos": "A bejelentkezéssel Ön elfogadja a ", + "tosLink": "A GitHub szolgáltatási feltételei", + "verifying": "Engedély ellenőrzése..." + }, + "category": "Másodpilóta", + "commands": { + "signIn": "Jelentkezzen be a GitHub Copilotba", + "signOut": "Kijelentkezés a GitHub Copilotból" + }, + "enterpriseUrl": { + "mdDescription": "Copilot API GitHub Enterprise domainje (pl. `github.mycompany.com`). GitHub.com esetén hagyja üresen." + }, + "models": { + "description": "Használható GitHub Copilot modellek. A rendelkezésre álló modellek a Copilot előfizetésedtől függenek." + }, + "statusBar": { + "signedIn": "Bejelentkeztél a GitHub Copilotba {0} néven. Kattints ide a kijelentkezéshez.", + "signedOut": "Nem jelentkezett be a GitHub Copilotba. Kattintson ide a bejelentkezéshez." + } + }, + "core": { + "agentConfiguration": { + "actions": "Műveletek", + "addCustomAgent": "Egyéni ügynök hozzáadása", + "enableAgent": "Ügynök engedélyezése", + "label": "Ügynökök", + "llmRequirements": "LLM követelmények", + "notUsedInPrompt": "A promptban nem használt", + "promptTemplates": "Prompt sablonok", + "selectAgentMessage": "Kérjük, először válasszon ügynököt!", + "templateName": "Sablon", + "undeclared": "Be nem jelentett", + "usedAgentSpecificVariables": "Használt ügynök-specifikus változók", + "usedFunctions": "Használt funkciók", + "usedGlobalVariables": "Használt globális változók", + "variant": "Variant" + }, + "agentsVariable": { + "description": "Visszaadja a rendszerben elérhető ügynökök listáját." + }, + "aiConfiguration": { + "label": "✨ AI konfiguráció [Alpha]" + }, + "blinkTitle": { + "agentCompleted": "Theia - ügynök Befejezett", + "namedAgentCompleted": "Theia - ügynök \"{0}\" Teljesítve" + }, + "changeSetSummaryVariable": { + "description": "Összefoglalót ad a módosításkészletben lévő fájlokról és azok tartalmáról." + }, + "contextDetailsVariable": { + "description": "Teljes szöveges értékeket és leírásokat biztosít az összes kontextuselemhez." + }, + "contextSummaryVariable": { + "description": "Az adott munkamenet kontextusában lévő fájlokat írja le." + }, + "customAgentTemplate": { + "description": "Ez egy példaügynök. Kérjük, igazítsa a tulajdonságokat az Ön igényeihez." + }, + "defaultModelAliases": { + "code": { + "description": "Kódmegértési és generálási feladatokra optimalizált." + }, + "code-completion": { + "description": "A legjobban alkalmas kód automatikus kiegészítésére." + }, + "summarize": { + "description": "Összefoglaló és tömörített tartalmú modellek." + }, + "universal": { + "description": "Jól kiegyensúlyozott mind a kódoláshoz, mind az általános nyelvhasználathoz." + } + }, + "defaultNotification": { + "mdDescription": "Az alapértelmezett értesítési módszer, amelyet akkor használnak, ha egy AI-ügynök befejez egy feladatot. Az egyes ügynökök felülbírálhatják ezt a beállítást.\n - `os-notification`: OS/rendszer értesítések megjelenítése\n - `message`: Értesítések megjelenítése az állapotsorban/üzenet területen\n - `blink`: A felhasználói felület villogtatása vagy kiemelése\n - `off`: Minden értesítés kikapcsolása", + "title": "Alapértelmezett értesítési típus" + }, + "discard": { + "label": "Dobja el az AI Prompt sablonját" + }, + "discardCustomPrompt": { + "tooltip": "Testreszabások elvetése" + }, + "fileVariable": { + "description": "Feloldja egy fájl tartalmát", + "uri": { + "description": "A kért fájl URI-je." + } + }, + "languageModelRenderer": { + "alias": "[alias] {0}", + "languageModel": "Nyelvi modell", + "purpose": "Cél" + }, + "maxRetries": { + "mdDescription": "Az újbóli próbálkozások maximális száma, ha egy mesterséges intelligencia szolgáltatóhoz intézett kérés sikertelen. A 0 érték azt jelenti, hogy nincs újbóli próbálkozás.", + "title": "Maximális megismétlés" + }, + "modelAliasesConfiguration": { + "agents": "Ezt az álnevet használó ügynökök", + "defaultList": "[Alapértelmezett lista]", + "evaluatesTo": "Kiértékeli a", + "label": "Modell álnevek", + "modelNotReadyTooltip": "Nem kész", + "modelReadyTooltip": "Kész", + "noAgents": "Ezt az álnevet egyetlen ügynök sem használja.", + "noModelReadyTooltip": "Nincs kész modell", + "noResolvedModel": "Nincs kész modell ehhez az álnévhez.", + "priorityList": "Prioritási lista", + "selectAlias": "Kérjük, válasszon egy modell aliasnevet.", + "selectedModelId": "Kiválasztott modell", + "unavailableModel": "A kiválasztott modell már nem elérhető" + }, + "noVariableFoundForOpenRequest": "A nyitott kéréshez nem találtunk változót.", + "openEditorsShortVariable": { + "description": "Rövid hivatkozás az összes jelenleg megnyitott fájlra (relatív elérési utak, vesszővel elválasztva)" + }, + "openEditorsVariable": { + "description": "Az összes jelenleg megnyitott fájl vesszővel elválasztott listája, a munkaterület gyökeréhez képest." + }, + "preference": { + "languageModelAliases": { + "description": "Konfigurálja a modelleket az egyes nyelvi modell aliasokhoz a [AI Configuration View] ({0}). Alternatívaként a beállításokat manuálisan is megadhatja a settings.json fájlban: \n```\n\"default/code\": {\n \"selectedModel\": \"anthropic/claude-opus-4-20250514\"\n}\n```", + "selectedModel": "A felhasználó által kiválasztott modell ehhez az aliashoz.", + "title": "Nyelvi modell álnevek" + } + }, + "prefs": { + "title": "✨ AI funkciók [Alpha]" + }, + "promptFragmentsConfiguration": { + "activeCustomizationTitle": "Aktív testreszabás", + "createCustomizationTitle": "Testreszabás létrehozása", + "customization": "testreszabás", + "customizationLabel": "Testreszabás", + "defaultVariantTitle": "Alapértelmezett változat", + "deleteCustomizationTitle": "Testreszabás törlése", + "editTemplateTitle": "Sablon szerkesztése", + "headerTitle": "Prompt töredékek", + "label": "Prompt töredékek", + "noFragmentsAvailable": "Nem állnak rendelkezésre prompt töredékek.", + "otherPromptFragmentsHeader": "Egyéb Prompt töredékek", + "promptTemplateText": "Prompt sablon szövege", + "promptVariantsHeader": "Prompt variáns készletek", + "removeCustomizationDialogMsg": "Biztos, hogy el akarja távolítani a {0} testreszabást a \"{1}\" prompt fragmentumhoz?", + "removeCustomizationDialogTitle": "Testreszabás eltávolítása", + "removeCustomizationWithDescDialogMsg": "Biztos, hogy el akarja távolítani a {0} testreszabást a \"{1}\" ({2}) prompt fragmentumhoz?", + "resetAllButton": "Minden visszaállítása", + "resetAllCustomizationsDialogMsg": "Biztos, hogy vissza akarja állítani az összes prompt fragmentumot a beépített verzióra? Ez minden testreszabást eltávolít.", + "resetAllCustomizationsDialogTitle": "Minden testreszabás visszaállítása", + "resetAllCustomizationsTitle": "Minden testreszabás visszaállítása", + "resetAllPromptFragments": "Az összes prompt töredék visszaállítása", + "resetToBuiltInDialogMsg": "Biztos, hogy vissza akarja állítani a \"{0}\" prompt fragmentumot a beépített verzióra? Ez minden testreszabást eltávolít.", + "resetToBuiltInDialogTitle": "Beépítettre visszaállítása", + "resetToBuiltInTitle": "Visszaállítása erre a beépített", + "resetToCustomizationDialogMsg": "Biztos, hogy vissza akarja állítani a \"{0}\" prompt fragmentumot a {1} testreszabás használatához? Ez eltávolítja az összes magasabb prioritású testreszabást.", + "resetToCustomizationDialogTitle": "Testreszabás visszaállítása", + "resetToCustomizationTitle": "Visszaállítása erre a testreszabásra", + "selectedVariantLabel": "Kiválasztott", + "selectedVariantTitle": "Kiválasztott változat", + "usedByAgentTitle": "Az ügynök által használt: {0}", + "variantSetError": "A kiválasztott változat nem létezik, és nem találtunk alapértelmezettet. Kérjük, ellenőrizze a konfigurációt.", + "variantSetWarning": "A kiválasztott változat nem létezik. Helyette az alapértelmezett változatot használjuk.", + "variantsOfSystemPrompt": "Ennek a prompt variáns készletnek a változatai:" + }, + "promptTemplates": { + "description": "Egyéni prompt sablonok tárolására szolgáló mappa. Ha nincs testreszabva, akkor a felhasználói konfigurációs könyvtárat kell használni. Kérjük, fontolja meg egy olyan mappa használatát, amely verzióvezérlés alatt áll a prompt sablonok változatainak kezeléséhez.", + "openLabel": "Mappa kiválasztása" + }, + "promptVariable": { + "argDescription": "A feloldandó prompt sablon azonosítója", + "completions": { + "detail": { + "builtin": "Beépített prompt töredék", + "custom": "Testreszabott prompt töredék" + } + }, + "description": "Megoldja a prompt sablonokat a prompt szolgáltatáson keresztül" + }, + "prompts": { + "category": "Theia AI Prompt sablonok" + }, + "requestSettings": { + "clientSettings": { + "description": "Az ügyfél beállításai az llm-nek visszaküldött üzenetek kezelésére vonatkozóan.", + "keepThinking": { + "description": "Ha false értékre van állítva, akkor egy többfordulós beszélgetésben a következő felhasználói kérés elküldése előtt minden gondolkodási kimenet szűrésre kerül." + }, + "keepToolCalls": { + "description": "Ha false értékre van állítva, akkor a többfordulós beszélgetés során a következő felhasználói kérés elküldése előtt az összes szerszámkérés és szerszámválasz szűrésre kerül." + } + }, + "mdDescription": "Lehetővé teszi az egyéni kérési beállítások megadását több modellhez.\n Minden objektum egy adott modell konfigurációját jelenti. A `modelId` mező a modell azonosítóját adja meg, a `requestSettings` a modellspecifikus beállításokat határozza meg.\n A `providerId` mező opcionális, és lehetővé teszi a beállítások alkalmazását egy adott szolgáltatóra. Ha nincs megadva, a beállítások az összes szolgáltatóra alkalmazásra kerülnek.\n Példa providerId: huggingface, openai, ollama, llamafile.\n További információért lásd [dokumentációnk](https://theia-ide.org/docs/user_ai/#custom-request-settings).", + "modelSpecificSettings": { + "description": "Az adott modell azonosítójához tartozó beállítások." + }, + "scope": { + "agentId": { + "description": "A (nem kötelező) ügynök azonosítója, amelyre a beállításokat alkalmazni kell." + }, + "modelId": { + "description": "A (nem kötelező) modell azonosítója" + }, + "providerId": { + "description": "A (nem kötelező) szolgáltató azonosítója, amelyre a beállításokat alkalmazni kell." + } + }, + "title": "Egyéni kérési beállítások" + }, + "skillsVariable": { + "description": "Visszaadja az AI ügynökök által használható elérhető készségek listáját." + }, + "taskContextSummary": { + "description": "Megoldja a munkamenet-környezetben lévő összes feladatkörnyezeti elemet." + }, + "templateSettings": { + "edited": "szerkesztett", + "unavailableVariant": "A kiválasztott változat már nem elérhető" + }, + "todayVariable": { + "description": "Csinál valamit a mai napra", + "format": { + "description": "A dátum formátuma" + } + }, + "unableToDisplayVariableValue": "A változó értékének megjelenítése nem lehetséges.", + "unableToResolveVariable": "Nem sikerült feloldani a változót.", + "variable-contribution": { + "builtInVariable": "Theia Beépített változó", + "currentAbsoluteFilePath": "Az aktuálisan megnyitott fájl abszolút elérési útja. Felhívjuk a figyelmet arra, hogy a legtöbb ügynök relatív (az aktuális munkaterülethez viszonyított) fájl elérési útvonalát várja el.", + "currentFileContent": "Az aktuálisan megnyitott fájl egyszerű tartalma. Ez nem tartalmazza azt az információt, hogy honnan származik a tartalom. Vegye figyelembe, hogy a legtöbb ügynök jobban fog működni relatív fájlútvonallal (az aktuális munkaterülethez képest).", + "currentRelativeDirPath": "Az aktuálisan megnyitott fájlt tartalmazó könyvtár relatív elérési útja.", + "currentRelativeFilePath": "Az aktuálisan megnyitott fájl relatív elérési útja.", + "currentSelectedText": "A megnyitott fájlban jelenleg kijelölt sima szöveg. Ez kizárja azt az információt, hogy honnan származik a tartalom. Kérjük, vegye figyelembe, hogy a legtöbb ügynök jobban működik relatív fájlútvonallal (az aktuális munkaterülethez viszonyítva).", + "dotRelativePath": "Rövid hivatkozás az aktuálisan megnyitott fájl relatív elérési útvonalára ('currentRelativeFilePath')." + } + }, + "editor": { + "editorContextVariable": { + "description": "Feloldja a szerkesztőspecifikus kontextusinformációkat", + "label": "EditorContext" + }, + "explainWithAI": { + "prompt": "Magyarázza meg ezt a hibát", + "title": "Magyarázza meg AI-val" + }, + "fixWithAI": { + "prompt": "Segítség a hiba kijavításához" + } + }, + "google": { + "apiKey": { + "description": "Adja meg a hivatalos Google AI (Gemini) fiókjának API-kulcsát. **Kérjük, vegye figyelembe:** Ennek a beállításnak a használatával a GOOGLE AI API kulcsa tiszta szövegben tárolódik a Theia-t futtató gépen. A kulcs biztonságos beállításához használja a `GOOGLE_API_KEY` környezeti változót." + }, + "maxRetriesOnErrors": { + "description": "Az újbóli próbálkozások maximális száma hiba esetén. Ha kisebb, mint 1, akkor az újbóli próbálkozás logikája le van tiltva." + }, + "models": { + "description": "Hivatalos Google Gemini modellek használata" + }, + "retryDelayOnOtherErrors": { + "description": "Az újbóli próbálkozások közötti késleltetés másodpercben, egyéb hibák esetén (néha a Google GenAI olyan hibákat jelent, mint például a modellből visszaküldött hiányos JSON-szintaxis vagy 500 Internal Server Error). Ennek -1-re állítása megakadályozza az újbóli próbálkozásokat ezekben az esetekben. Egyébként az újbóli próbálkozás vagy azonnal (ha 0-ra van beállítva), vagy a másodpercben megadott késleltetés után történik (ha pozitív számra van beállítva)." + }, + "retryDelayOnRateLimitError": { + "description": "Az újbóli próbálkozások közötti késleltetés másodpercben, sebességkorlátozási hiba esetén. Lásd https://ai.google.dev/gemini-api/docs/rate-limits" + } + }, + "history": { + "clear": { + "tooltip": "Törölje az összes ügynök előzményeit" + }, + "exchange-card": { + "agentId": "ügynök", + "timestamp": "Elindult" + }, + "open-history-tooltip": "Nyissa meg az AI történelmet...", + "request-card": { + "agent": "ügynök", + "model": "Modell", + "request": "Kérés", + "response": "Válasz", + "timestamp": "Időbélyegző", + "title": "Kérés" + }, + "sortChronologically": { + "tooltip": "Időrendi sorrendbe rendezés" + }, + "sortReverseChronologically": { + "tooltip": "Fordított időrendi sorrendbe rendezés" + }, + "toggleCompact": { + "tooltip": "Kompakt nézet megjelenítése" + }, + "toggleHideNewlines": { + "tooltip": "Az újsorok értelmezésének leállítása" + }, + "toggleRaw": { + "tooltip": "Nyers nézet megjelenítése" + }, + "toggleRenderNewlines": { + "tooltip": "Újsorok értelmezése" + }, + "view": { + "label": "✨ AI Agent History [Alpha]", + "noAgent": "Nincs elérhető ügynök.", + "noAgentSelected": "Nincs kiválasztott ügynök.", + "noHistoryForAgent": "A kiválasztott ügynökhöz nem áll rendelkezésre előzmény '{0}'" + } + }, + "huggingFace": { + "apiKey": { + "mdDescription": "Adja meg az API-kulcsot a Hugging Face-fiókjához. **Figyelem:** Ennek a beállításnak a használatával a Hugging Face API kulcsa tiszta szövegben kerül tárolásra a Theia-t futtató gépen. A kulcs biztonságos beállításához használja a `HUGGINGFACE_API_KEY` környezeti változót." + }, + "models": { + "mdDescription": "Használható Hugging Face modellek. **Megjegyzés:** Jelenleg csak a chat completion API-t támogató modellek (például az `*-Instruct` utasításokkal hangolt modellek) támogatottak. Egyes modellek esetében előfordulhat, hogy a Hugging Face weboldalon el kell fogadni a licencfeltételeket." + } + }, + "ide": { + "agent-description": "Az AI-ügynök beállításainak konfigurálása, beleértve az engedélyezést, az LLM kiválasztását, a prompt sablon testreszabását és az egyéni ügynök létrehozását az [AI konfigurációs nézetben]({0}).", + "agentConfiguration": { + "customAgentLocationQuickPick": { + "createNewFile": "Új fájl létrehozása", + "openExistingFile": "Meglévő fájl megnyitása", + "placeholder": "Válassza ki, hol hozzon létre vagy nyisson meg egy egyéni ügynökfájlt", + "title": "Egyéni ügynökök fájl helyének kiválasztása" + }, + "noDescription": "Nincs leírás elérhető" + }, + "app-tester": { + "errorCheckingDevToolsServerStatus": "Hiba a DevTools MCP szerver állapotának ellenőrzése során: {0}", + "errorCheckingPlaywrightServerStatus": "Hiba a Playwright MCP-kiszolgáló állapotának ellenőrzése: {0}", + "startChromeDevToolsMcpServers": { + "canceled": "Kérjük, állítsa be a Chrome DevTools MCP szervert.", + "error": "A Chrome DevTools MCP szerver indítása sikertelen: {0}", + "progress": "A Chrome DevTools MCP szerver elindítása.", + "question": "A Chrome DevTools MCP szerver nem fut. Most el szeretné indítani? Ezzel a Chrome DevTools MCP szerver telepítésre kerülhet." + }, + "startMcpServers": { + "no": "Nem, törlés", + "yes": "Igen, indítsa el a szervereket" + }, + "startPlaywrightServers": { + "canceled": "Kérjük, állítsa be az MCP-kiszolgálókat.", + "error": "Nem sikerült elindítani a Playwright MCP-kiszolgálót: {0}", + "progress": "Playwright MCP szerverek indítása.", + "question": "A Playwright MCP-kiszolgálók nem futnak. Szeretné most elindítani őket? Ez telepítheti a Playwright MCP-kiszolgálókat." + } + }, + "architectAgent": { + "mode": { + "default": "Alapértelmezett mód", + "plan": "Módterv", + "simple": "Egyszerű mód" + }, + "suggestion": { + "executePlanWithCoder": "Futtassa a „{0}” parancsot a Coder programmal.", + "summarizeSessionAsTaskForCoder": "Foglalja össze ezt az ülést a Coder feladataként.", + "updateTaskContext": "Aktuális feladatkörnyezet frissítése" + } + }, + "bypassHint": "Egyes ügynökök, mint például Claude Code, nem igénylik a Theia nyelvi modelleket.", + "chatDisabledMessage": { + "featuresTitle": "Jelenleg támogatott nézetek és funkciók:" + }, + "coderAgent": { + "mode": { + "agentNext": "Ügynök mód (Következő)", + "edit": "Szerkesztési mód" + }, + "suggestion": { + "fixProblems": { + "content": "[Problémák javítása]({0}) az aktuális fájlban.", + "prompt": "kérjük, nézze meg a {1} és javítsa ki a problémákat." + }, + "startNewChat": "Tartsa a beszélgetéseket röviden és koncentráltan. [Indítson új csevegést]({0}) egy új feladathoz, vagy [indítson új csevegést ennek a csevegésnek az összefoglalójával]({1})." + } + }, + "commandAgent": { + "commandCallback": { + "confirmAction": "Megvan.", + "label": "AI parancs" + }, + "response": { + "customHandler": "Próbálja meg ezt végrehajtani:", + "noCommand": "Sajnálom, nem találok ilyen parancsot.", + "theiaCommand": "Találtam ezt a parancsot, ami talán segíthet:" + }, + "vars": { + "commandIds": { + "description": "A Theiában elérhető parancsok listája." + } + } + }, + "configureAgent": { + "header": "Alapértelmezett ügynök konfigurálása" + }, + "continueAnyway": "Mindenképpen folytassa", + "createSkillAgent": { + "mode": { + "edit": "Alapértelmezett mód" + } + }, + "enableAI": { + "mdDescription": "❗ Ez a beállítás lehetővé teszi a legújabb AI képességek elérését (béta verzió). \n Kérjük, vegye figyelembe, hogy ezek a funkciók béta fázisban vannak, ami azt jelenti, hogy változásokon mehetnek keresztül, és továbbfejlesztésre kerülnek. Fontos tisztában lenni azzal, hogy ezek a funkciók folyamatos kéréseket generálhatnak a nyelvi modellekhez (LLM), amelyekhez hozzáférést biztosít. Ez költségekkel járhat, amelyeket szorosan nyomon kell követnie. Az opció engedélyezésével Ön tudomásul veszi ezeket a kockázatokat. \n **Kérjük, vegye figyelembe! Az ebben a szakaszban található alábbi beállítások csak akkor lépnek életbe, ha\n a fő funkció beállításának engedélyezése után lépnek érvénybe. A funkció engedélyezése után legalább egy LLM-szolgáltatót kell beállítania az alábbiakban. Lásd még [a dokumentációt](https://theia-ide.org/docs/user_ai/)**." + }, + "github": { + "configureGitHubServer": { + "canceled": "A GitHub szerver konfigurációja törlődött. Kérjük, konfigurálja a GitHub MCP-kiszolgálót az ügynök használatára.", + "no": "Nem, törölje", + "yes": "Igen, GitHub-kiszolgáló konfigurálása" + }, + "errorCheckingGitHubServerStatus": "Hiba a GitHub MCP-kiszolgáló állapotának ellenőrzése: {0}", + "startGitHubServer": { + "canceled": "Az ügynök használatához indítsa el a GitHub MCP-kiszolgálót.", + "error": "Nem sikerült elindítani a GitHub MCP-kiszolgálót: {0}", + "no": "Nem, törölje", + "progress": "A GitHub MCP-kiszolgáló elindítása.", + "question": "A GitHub MCP-kiszolgáló konfigurálva van, de nem fut. Szeretné most elindítani?", + "yes": "Igen, indítsa el a kiszolgálót" + } + }, + "githubRepoName": { + "description": "Az aktuális GitHub tároló neve (pl. \"eclipse-theia/theia\")" + }, + "model-selection-description": "Válassza ki, hogy az egyes mesterséges intelligencia-ügynökök milyen nagy nyelvi modelleket (LLM) használjanak az [AI Configuration View] ({0}) menüpontban.", + "moreAgentsAvailable": { + "header": "Több ügynök áll rendelkezésre" + }, + "noRecommendedAgents": "Nincs ajánlott szer.", + "openSettings": "Nyissa meg az AI beállításokat", + "or": "vagy", + "orchestrator": { + "error": { + "noAgents": "Nem áll rendelkezésre chat-ügynök a kérés kezelésére. Kérjük, ellenőrizze a konfigurációját, hogy van-e engedélyezve." + }, + "progressMessage": "A legmegfelelőbb szer meghatározása", + "response": { + "delegatingToAgent": "Delegálás a `@{0}`" + } + }, + "prompt-template-description": "A [AI Configuration View (AI konfigurációs nézet)] ({0}) ablakban kiválaszthatja a prompt-változatokat és testre szabhatja a prompt-sablonokat az AI-ügynökök számára.", + "recommendedAgents": "Ajánlott szerek:", + "skillsConfiguration": { + "label": "Készségek", + "location": { + "label": "Helyszín" + } + }, + "toolsConfiguration": { + "confirmAlwaysAllow": { + "confirm": "Értem, engedélyezem az automatikus jóváhagyást", + "title": "Engedélyezze az automatikus jóváhagyást a „{0}” számára?" + }, + "confirmationMode": { + "label": "Megerősítési mód" + }, + "default": { + "label": "Alapértelmezett eszköz megerősítési mód:" + }, + "resetAll": "Minden visszaállítása", + "resetAllConfirmDialog": { + "msg": "Biztos, hogy vissza akarja állítani az összes szerszám megerősítési módot az alapértelmezettre? Ez eltávolítja az összes egyéni beállítást.", + "title": "Minden eszköz megerősítési módjának visszaállítása" + }, + "resetAllTooltip": "Minden eszköz alapértelmezettre állítása", + "toolOptions": { + "confirm": { + "label": "Megerősítés" + } + } + }, + "variableConfiguration": { + "selectVariable": "Kérjük, válasszon egy változót.", + "usedByAgents": "Ügynökök által használt", + "variableArgs": "Változó argumentumok" + } + }, + "llamaFile": { + "prefs": { + "mdDescription": "Ez a beállítás lehetővé teszi a LlamaFile modellek konfigurálását és kezelését a Theia IDE-ben. \n Minden bejegyzéshez szükség van egy felhasználóbarát `névre`, a LlamaFile-ra mutató `uri` fájlra és a `portra`, amelyen futni fog. \n Egy LlamaFile indításához használja a `Start LlamaFile` parancsot, amellyel kiválaszthatja a kívánt modellt. \n Ha szerkeszt egy bejegyzést (pl. megváltoztatja a portot), minden futó példány leáll, és manuálisan újra kell indítani. \n [A LlamaFile-ok konfigurálásáról és kezeléséről bővebben a Theia IDE dokumentációjában](https://theia-ide.org/docs/user_ai/#llamafile-models).", + "name": { + "description": "A Llamafile modellneve." + }, + "port": { + "description": "A kiszolgáló indításához használandó port." + }, + "title": "✨ AI LlamaFile", + "uri": { + "description": "A Llamafile fájl urija." + } + }, + "start": "Llamafile indítása", + "stop": "Stop Llamafile" + }, + "llamafile": { + "error": { + "noConfigured": "Nincs Llamafiles konfigurálva.", + "noRunning": "Nem futnak a Llamafiles fájlok.", + "startFailed": "Valami baj történt a llamafile indításakor: {0}.\nTovábbi információért lásd a konzol.", + "stopFailed": "Valami baj történt a llamafile leállítása közben: {0}.\nTovábbi információért lásd a konzol." + } + }, + "mcp": { + "error": { + "allServersRunning": "Az összes MCP-kiszolgáló már fut.", + "noRunningServers": "Nem futnak MCP-kiszolgálók.", + "noServersConfigured": "Nincsenek MCP-kiszolgálók konfigurálva.", + "startFailed": "Hiba történt az MCP-kiszolgáló indítása közben." + }, + "info": { + "serverStarted": "Az MCP-kiszolgáló \"{0}\" sikeresen elindult. Regisztrált eszközök: {1}" + }, + "servers": { + "args": { + "mdDescription": "A parancsnak átadandó argumentumok tömbje.", + "title": "Érvek a parancshoz" + }, + "autostart": { + "mdDescription": "Automatikusan elindítja ezt a kiszolgálót, amikor a frontend elindul. Az újonnan hozzáadott kiszolgálók nem indulnak el azonnal automatikusan, hanem az újraindításkor.", + "title": "Autostart" + }, + "command": { + "mdDescription": "Az MCP-kiszolgáló indítására használt parancs, pl. \"uvx\" vagy \"npx\".", + "title": "Az MCP-kiszolgálót végrehajtó parancs" + }, + "env": { + "mdDescription": "A kiszolgáló számára beállítandó opcionális környezeti változók, például egy API-kulcs.", + "title": "Környezeti változók" + }, + "headers": { + "mdDescription": "Opcionális kiegészítő fejlécek, amelyek minden egyes, a kiszolgálóhoz érkező kéréshez tartoznak.", + "title": "Fejlécek" + }, + "mdDescription": "Az MCP-kiszolgálók konfigurálása parancsokkal, argumentumokkal, opcionálisan környezeti változókkal és automatikus indítással (alapértelmezés szerint igaz). Minden kiszolgálót egy egyedi kulcs azonosít, például \"brave-search\" vagy \"filesystem\". Egy kiszolgáló indításához használja az \"MCP: MCP Server indítása\" parancsot, amellyel kiválaszthatja a kívánt kiszolgálót. A kiszolgáló leállításához használja az \"MCP: Stop MCP Server\" parancsot. Felhívjuk figyelmét, hogy az automatikus indítás csak újraindítás után lép életbe, első alkalommal kézzel kell elindítani a kiszolgálót.\nPélda konfigurációra:\n```{\n \"brave-search\": {\n \"command\": \"npx\",\n \"args\": [\n \"-y\",\n \"@modelcontextprotocol/server-brave-search\"\n ],\n \"env\": {\n \"BRAVE_API_KEY\": \"YOUR_API_KEY\".\n },\n },\n \"filesystem\": {\n \"command\": \"npx\",\n \"args\": [\"-y\", \"@modelcontextprotocol/server-filesystem\", \"/Users/YOUR_USERNAME/Desktop\"],\n \"env\": {\n \"CUSTOM_ENV_VAR\": \"custom-value\"\n },\n \"autostart\": false\n }\n}\n```", + "serverAuthToken": { + "mdDescription": "A kiszolgáló hitelesítési jelszava, ha szükséges. Ezt a távoli kiszolgálóval való hitelesítéshez használják.", + "title": "Hitelesítési token" + }, + "serverAuthTokenHeader": { + "mdDescription": "A kiszolgáló hitelesítési tokenjéhez használandó fejléc neve. Ha nincs megadva, akkor az \"Authorization\" és a \"Bearer\" fog használatba kerülni.", + "title": "Hitelesítési fejléc neve" + }, + "serverUrl": { + "mdDescription": "A távoli MCP-kiszolgáló URL-címe. Ha megadjuk, a kiszolgáló ehhez az URL-hez csatlakozik ahelyett, hogy egy helyi folyamatot indítana.", + "title": "Kiszolgáló URL címe" + }, + "title": "MCP szerverek konfigurációja" + }, + "start": { + "label": "MCP: MCP-kiszolgáló indítása" + }, + "stop": { + "label": "MCP: MCP-kiszolgáló leállítása" + } + }, + "mcpConfiguration": { + "arguments": "Érvek: ", + "autostart": "Autostart: ", + "connectServer": "Connnect", + "connectingServer": "Csatlakozás...", + "copiedAllList": "Az összes eszköz másolása a vágólapra (az összes eszköz listája)", + "copiedAllSingle": "Az összes eszközt a vágólapra másolta (egyetlen prompt töredék az összes eszközzel)", + "copiedForPromptTemplate": "Az összes eszközt a vágólapra másolta a prompt sablonhoz (egyetlen prompt töredék az összes eszközzel)", + "copyAllList": "Minden másolása (az összes eszköz listája)", + "copyAllSingle": "Mindent másolni a chathez (egyetlen prompt töredék minden eszközzel)", + "copyForPrompt": "Másoló eszköz (chat vagy prompt sablonhoz)", + "copyForPromptTemplate": "Mindent másolni a prompt sablonhoz (egyetlen prompt töredék minden eszközzel)", + "environmentVariables": "Környezeti változók: ", + "headers": "Fejlécek: ", + "noServers": "Nincsenek MCP-kiszolgálók konfigurálva", + "serverAuthToken": "Hitelesítési jelszó: ", + "serverAuthTokenHeader": "Hitelesítési fejléc neve: ", + "serverUrl": "Kiszolgáló URL: ", + "tools": "Eszközök: " + }, + "openai": { + "apiKey": { + "mdDescription": "Adja meg a hivatalos OpenAI-fiókjának API-kulcsát. **Figyelem:** Ha ezt a beállítást használja, az Open AI API kulcsa tiszta szövegben tárolódik a Theia-t futtató gépen. A kulcs biztonságos beállításához használja az `OPENAI_API_KEY` környezeti változót." + }, + "customEndpoints": { + "apiKey": { + "title": "Vagy az adott url-en kiszolgált API-hoz való hozzáférés kulcsa, vagy `true` a globális OpenAI API kulcs használatához." + }, + "apiVersion": { + "title": "Vagy az adott Azure-i url-en kiszolgált API-hoz való hozzáférés verziója, vagy `true` a globális OpenAI API verzió használatához." + }, + "deployment": { + "title": "A telepítés neve, amellyel az Azure-ban az adott url-en kiszolgált API-t elérheti." + }, + "developerMessageSettings": { + "title": "A rendszerüzenetek kezelését vezérli: A `mergeWithFollowingUserMessage` a következő felhasználói üzenetet a rendszerüzenettel előtagolja, vagy a rendszerüzenetet felhasználói üzenetté alakítja, ha a következő üzenet nem felhasználói üzenet. A `skip` csak a rendszerüzenetet távolítja el), alapértelmezés szerint `developer`." + }, + "enableStreaming": { + "title": "Jelzi, hogy a streaming API-t kell-e használni. Alapértelmezés szerint `true`." + }, + "id": { + "title": "Egyedi azonosító, amelyet a felhasználói felület az egyéni modell azonosítására használ." + }, + "mdDescription": "Az OpenAI API-val kompatibilis egyéni modellek integrálása, például az `vllm` segítségével. A szükséges attribútumok a `model` és az `url`. \n Opcionálisan \n - megadhat egy egyedi `id` azonosítót az egyéni modell azonosítására a felhasználói felületen. Ha nincs megadva, akkor a `model` lesz az `id`. \n - meg kell adni egy `apiKey`-t a megadott url-en kiszolgált API eléréséhez. A `true` használatával jelzi a globális OpenAI API-kulcs használatát. \n - adjon meg egy `apiVersion` értéket az Azure-ban az adott url-en kiszolgált API eléréséhez. Használja a `true` értéket a globális OpenAI API verzió használatának jelzésére. \n - a `developerMessageSettings` beállítást a `user`, `system`, `developer`, `mergeWithFollowingUserMessage` vagy `skip` valamelyikére állítsa be a fejlesztői üzenet szerepeltetésének szabályozásához (ahol a `user`, `system` és `developer` szerepként lesz használva, a `mergeWithFollowingUserMessage` a következő felhasználói üzenetet a rendszerüzenettel előzi meg, vagy a rendszerüzenetet felhasználói üzenetté alakítja, ha a következő üzenet nem felhasználói üzenet. A `skip` csak a rendszerüzenetet távolítja el). Alapértelmezés szerint `developer`. \n - a `supportsStructuredOutput: false` megadása annak jelzésére, hogy a strukturált kimenet nem használható. \n - a `enableStreaming: false` megadása annak jelzésére, hogy a streaming nem használható. \n További információkért lásd [dokumentációnk](https://theia-ide.org/docs/user_ai/#openai-compatible-models-eg-via-vllm).", + "modelId": { + "title": "Modell azonosító" + }, + "supportsStructuredOutput": { + "title": "Jelzi, hogy a modell támogatja-e a strukturált kimenetet. Alapértelmezés szerint `true`." + }, + "url": { + "title": "Az Open AI API kompatibilis végpont, ahol a modellt tárolják." + } + }, + "models": { + "description": "Hivatalos OpenAI modellek használata" + }, + "useResponseApi": { + "mdDescription": "A hivatalos OpenAI modellekhez a Chat Completion API helyett az újabb OpenAI Response API-t használja. Ez a beállítás csak a hivatalos OpenAI-modellekre vonatkozik - az egyéni szolgáltatóknak ezt egyedileg kell beállítaniuk." + } + }, + "promptTemplates": { + "directories": { + "title": "Munkaterület-specifikus Prompt sablonkönyvtárak" + }, + "extensions": { + "description": "A prompt helyeken található további fájlkiterjesztések listája, amelyeket prompt sablonoknak tekintünk. A '.prompttemplate' mindig alapértelmezettnek tekintendő.", + "title": "További Prompt sablon fájl kiterjesztések" + }, + "files": { + "title": "Munkaterület-specifikus Prompt sablonfájlok" + } + }, + "scanoss": { + "changeSet": { + "clean": "Nincsenek találatok", + "error": "Hiba: Újraindítás", + "error-notification": "ScanOSS hiba: {0}.", + "match": "Gyufák megtekintése", + "scan": "Szkennelés", + "scanning": "Szkennelés..." + }, + "mode": { + "automatic": { + "description": "A kódrészletek automatikus beolvasásának engedélyezése a csevegési nézetekben." + }, + "description": "A SCANOSS funkció beállítása a kódrészletek elemzéséhez a csevegési nézetekben. Ez elküldi a javasolt kódrészletek hash-jét a SCANOSS\n[Software Transparency Foundation] (https://www.softwaretransparency.org/osskb) által üzemeltetett szolgáltatásnak elemzésre.", + "manual": { + "description": "A felhasználó manuálisan is elindíthatja a vizsgálatot a csevegési nézetben a SCANOSS elemre kattintva." + }, + "off": { + "description": "A funkció teljesen ki van kapcsolva." + } + }, + "snippet": { + "dialog-header": "ScanOSS eredmények", + "errored": "SCANOSS - Hiba - {0}", + "file-name-heading": "Talált egyezés {0}", + "in-progress": "SCANOSS - Ellenőrzés végrehajtása...", + "match-count": "Talált {0} egyezés(ek)", + "matched": "SCANOSS - Talált {0} egyezés", + "no-match": "SCANOSS - Nincs egyezés", + "summary": "Összefoglaló" + } + }, + "session-settings-dialog": { + "title": "Munkamenet-beállítások beállítása", + "tooltip": "Munkamenet-beállítások beállítása" + }, + "terminal": { + "agent": { + "description": "Ez az ügynök segítséget nyújt tetszőleges terminálparancsok írásához és végrehajtásához. A felhasználó kérése alapján parancsokat javasol, és lehetővé teszi, hogy a felhasználó közvetlenül beillessze és futtassa azokat a terminálon. Hozzáfér az aktuális könyvtárhoz, a környezethez és a terminál munkamenet legutóbbi terminál kimenetéhez, hogy kontextustudatos segítséget nyújtson.", + "vars": { + "cwd": { + "description": "Az aktuális munkakönyvtár." + }, + "recentTerminalContents": { + "description": "A terminálon látható utolsó 0-50 legutóbbi sor." + }, + "shell": { + "description": "A használt shell, pl. /usr/bin/zsh." + }, + "userRequest": { + "description": "A felhasználó kérdése vagy kérése." + } + } + }, + "askAi": "Kérdezd az AI-t", + "askTerminalCommand": "Kérdezzen egy terminálparancsról...", + "hitEnterConfirm": "Nyomja meg az Entert a megerősítéshez", + "howCanIHelp": "Miben segíthetek?", + "loading": "Betöltés", + "tryAgain": "Próbáld újra...", + "useArrowsAlternatives": " vagy használja a ⇅-t az alternatívák megjelenítéséhez..." + }, + "tokenUsage": { + "cachedInputTokens": "Bemeneti tokenek írása a gyorsítótárba", + "cachedInputTokensTooltip": "A \"Input Tokens\"-hez kapcsolódóan nyomon követhető. Általában drágább, mint a nem gyorsítótárazott tokenek.", + "failedToGetTokenUsageData": "Nem sikerült lekérni a token használati adatokat: {0}", + "inputTokens": "Input tokenek", + "label": "Token használata", + "lastUsed": "Utoljára használt", + "model": "Modell", + "noData": "Még nem állnak rendelkezésre tokenhasználati adatok.", + "note": "A tokenek használatát az alkalmazás indulása óta követik, és nem marad meg.", + "outputTokens": "Kimeneti tokenek", + "readCachedInputTokens": "Bemeneti tokenek olvasása a gyorsítótárból", + "readCachedInputTokensTooltip": "A 'Input Token' mellett nyomon követhető. Általában sokkal olcsóbb, mint a nem gyorsítótárazott. Általában nem számít bele a sebességkorlátozásba.", + "total": "Összesen", + "totalTokens": "Összes zseton", + "totalTokensTooltip": "'Input tokenek' + 'Output tokenek'" + }, + "vercelai": { + "anthropicApiKey": { + "mdDescription": "Adjon meg egy API-kulcsot az Anthropic modellekhez. **Figyelem:** Ha ezt a beállítást használja, az API-kulcs tiszta szövegben lesz tárolva a Theia-t futtató gépen. A kulcs biztonságos beállításához használja az `ANTHROPIC_API_KEY` környezeti változót." + }, + "customEndpoints": { + "apiKey": { + "title": "Vagy az adott url-en kiszolgált API-hoz való hozzáférés kulcsa, vagy `true` a globális API-kulcs használatához." + }, + "enableStreaming": { + "title": "Jelzi, hogy a streaming API-t kell-e használni. Alapértelmezés szerint `true`." + }, + "id": { + "title": "Egyedi azonosító, amelyet a felhasználói felület az egyéni modell azonosítására használ." + }, + "mdDescription": "A Vercel AI SDK-val kompatibilis egyéni modellek integrálása. A szükséges attribútumok a `model` és az `url`. \n Opcionálisan \n - megadhat egy egyedi `id` azonosítót az egyéni modell azonosítására a felhasználói felületen. Ha nincs megadva, akkor a `model` lesz az `id`. \n - meg kell adni egy `apiKey`-t a megadott url-en kiszolgált API eléréséhez. A globális API-kulcs használatának jelzésére használja a `true` értéket. \n - a `supportsStructuredOutput: false` megadása annak jelzésére, hogy a strukturált kimenet nem használható. \n - adja meg az `enableStreaming: false` értéket annak jelzésére, hogy a streaming nem használható. \n - a `provider` megadása annak jelzésére, hogy a modell melyik szolgáltatótól származik (openai, anthropic).", + "modelId": { + "title": "Modell azonosító" + }, + "supportsStructuredOutput": { + "title": "Jelzi, hogy a modell támogatja-e a strukturált kimenetet. Alapértelmezés szerint `true`." + }, + "url": { + "title": "Az API végpont, ahol a modellt tárolják" + } + }, + "models": { + "description": "Hivatalos modellek a Vercel AI SDK-val való használathoz", + "id": { + "title": "Modell azonosító" + }, + "model": { + "title": "Modell neve" + } + }, + "openaiApiKey": { + "mdDescription": "Adjon meg egy API-kulcsot az OpenAI-modellekhez. **Figyelem:** Ha ezt a beállítást használja, az API-kulcs tiszta szövegben lesz tárolva a Theia-t futtató gépen. A kulcs biztonságos beállításához használja az `OPENAI_API_KEY` környezeti változót." + } + }, + "workspace": { + "coderAgent": { + "description": "A Theia IDE-be integrált mesterséges intelligencia asszisztens, amelyet a szoftverfejlesztők segítésére terveztek. Ez az ügynök hozzáférhet a felhasználó munkaterületéhez, lekérheti az összes elérhető fájl és mappa listáját, és lekérheti azok tartalmát. Továbbá képes a felhasználónak a fájlok módosítását javasolni. Így segíthet a felhasználónak a kódolási feladatokban vagy más, fájlmódosítással járó feladatokban." + }, + "considerGitignore": { + "description": "Ha engedélyezve van, kizárja a globális .gitignore fájlban megadott fájlokat/mappákat (várható helye a munkaterület gyökere).", + "title": "Tekintsük a .gitignore-t" + }, + "excludedPattern": { + "description": "A kizárandó fájlok/mappák mintáinak (glob vagy regex) listája.", + "title": "Kizárt fájlminták" + }, + "searchMaxResults": { + "description": "A munkaterület keresési funkció által visszaadott keresési eredmények maximális száma.", + "title": "Maximális keresési eredmények" + }, + "workspaceAgent": { + "description": "A Theia IDE-be integrált mesterséges intelligencia asszisztens, amelyet a szoftverfejlesztők segítésére terveztek. Ez az ügynök hozzáférhet a felhasználó munkaterületéhez, lekérheti az összes elérhető fájl és mappa listáját, és lekérheti azok tartalmát. A fájlokat nem tudja módosítani. Ezért képes válaszolni az aktuális projekttel, a projektfájlokkal és a munkaterületen található forráskóddal kapcsolatos kérdésekre, például arra, hogy hogyan kell a projektet felépíteni, hová kell a forráskódot elhelyezni, hol találunk bizonyos kódokat vagy konfigurációkat stb." + } + } + }, + "ai-chat": { + "fileChangeSetTitle": "Javasolt változtatások" + }, + "ai-chat-ui": { + "initiate-session-task-context": "Feladatkörnyezet: Munkamenet kezdeményezése", + "open-current-session-summary": "Nyitva Jelenlegi ülésszak összefoglalója", + "open-settings-tooltip": "AI beállítások megnyitása...", + "scroll-lock": "Lock Scroll", + "scroll-unlock": "Unlock Scroll", + "session-settings": "Munkamenet-beállítások beállítása", + "showChats": "Csevegések megjelenítése...", + "summarize-current-session": "A jelenlegi ülés összefoglalása" + }, + "ai-claude-code": { + "open-config": "Nyitott Claude kód konfigurációja", + "open-memory": "Claude kódmemória megnyitása (CLAUDE.MD)" + }, + "ai-core": { + "agentCompletionMessage": "A \"{0}\" ügynök elvégezte feladatát.", + "agentCompletionTitle": "Ügynök \"{0}\" Befejezett feladat", + "agentCompletionWithTask": "A \"{0}\" ügynök elvégezte a feladatot: {1}" + }, + "ai-editor": { + "contextMenu": "Kérdezd meg az AI-t", + "sendToChat": "Küldés az AI Chat-be" + }, + "ai-ide": { + "addressGhReviewCommand": { + "argumentHint": "", + "description": "Címfelülvizsgálati megjegyzések egy GitHub pull requestben" + }, + "fixGhTicketCommand": { + "argumentHint": "", + "description": "GitHub jegy elemzése és a megoldás megvalósítása" + }, + "open-agent-settings-tooltip": "Ügynöki beállítások megnyitása...", + "rememberCommand": { + "argumentHint": "[téma-tipp]", + "description": "Kivonat témák a beszélgetésből és frissítse a projekt információkat" + }, + "ticketCommand": { + "argumentHint": "", + "description": "GitHub jegy elemzése és megvalósítási terv készítése" + }, + "todoTool": { + "noTasks": "Nincs feladat" + }, + "withAppTesterCommand": { + "description": "A tesztelés átadása az AppTester ügynöknek (ügynök mód szükséges)" + } + }, + "ai-mcp": { + "blockedServersLabel": "MCP-kiszolgálók (autostart blokkolva)" + }, + "ai-terminal": { + "cancelExecution": "Parancs végrehajtásának törlése", + "canceling": "Törlés...", + "confirmExecution": "Shell parancs megerősítése", + "denialReason": "Ok", + "executionCanceled": "Törölve", + "executionDenied": "Elutasítva", + "executionDeniedWithReason": "Ésszerűen elutasítva", + "noOutput": "Nincs kimenet", + "partialOutput": "Részleges kimenet", + "timeout": "Időkorlát", + "workingDirectory": "Munkakönyvtár" + }, + "callhierarchy": { + "noCallers": "Nem észleltek hívókat.", + "open": "Nyílt felhívás hierarchia" + }, + "chat": { + "taskContextVariable": { + "args": { + "contextId": { + "description": "A lekérdezendő feladatkontextus vagy az összefoglalandó csevegési munkamenet azonosítója." + } + }, + "description": "A feladathoz kapcsolódó háttérinformációkat nyújt, pl. a feladat elvégzésének terve vagy a korábbi munkamenetek összefoglalása.", + "label": "Feladat kontextus" + } + }, + "collaboration": { + "collaborate": "Együttműködés", + "collaboration": "Együttműködés", + "collaborationWorkspace": "Együttműködési munkaterület", + "connected": "Csatlakoztatva", + "connectedSession": "Együttműködési munkamenethez csatlakoztatva", + "copiedInvitation": "Meghívó kódja a vágólapra másolva.", + "copyAgain": "Ismétlemásolás", + "createRoom": "Új együttműködési munkamenet létrehozása", + "creatingRoom": "Munkamenet létrehozása", + "end": "Együttműködési ülés befejezése", + "endDetail": "A munkamenet megszüntetése, a tartalom megosztásának megszüntetése és a hozzáférés visszavonása mások számára.", + "enterCode": "Adja meg az együttműködési munkamenet kódját", + "failedCreate": "Nem sikerült helyet létrehozni: {0}", + "failedJoin": "Nem sikerült csatlakozni a szobához: {0}", + "fieldRequired": "A {0} mező kitöltése kötelező. A bejelentkezés megszakadt.", + "invite": "Mások meghívása", + "inviteDetail": "Másolja ki a meghívó kódját, hogy másokkal is megoszthassa, és csatlakozhasson az üléshez.", + "joinRoom": "Csatlakozzon az együttműködési üléshez", + "joiningRoom": "Csatlakozási munkamenet", + "leave": "Hagyja el az együttműködési ülést", + "leaveDetail": "Szakítsa meg a kapcsolatot az aktuális együttműködési munkamenetből, és zárja be a munkaterületet.", + "loginFailed": "A bejelentkezés sikertelen.", + "loginSuccessful": "Bejelentkezés sikeres.", + "noAuth": "A kiszolgáló nem biztosít hitelesítési módszert.", + "optional": "opcionális", + "selectAuth": "Hitelesítési módszer kiválasztása", + "selectCollaboration": "Együttműködési lehetőség kiválasztása", + "serverUrl": "Kiszolgáló URL címe", + "serverUrlDescription": "Az Open Collaboration Tools Server példányának URL-címe az élő együttműködési munkamenetek számára", + "sharedSession": "Közös együttműködési munkamenet", + "startSession": "Együttműködési munkamenet indítása vagy ahhoz való csatlakozás", + "userWantsToJoin": "Felhasználó '{0}' csatlakozni szeretne a kollaborációs szobához", + "whatToDo": "Mit szeretnél csinálni más munkatársakkal?" + }, + "core": { + "about": { + "compatibility": "{0} Kompatibilitás", + "defaultApi": "Alapértelmezett {0} API", + "listOfExtensions": "A kiterjesztések listája" + }, + "common": { + "closeAll": "Minden lap bezárása", + "closeAllTabMain": "Minden lap bezárása a fő területen", + "closeOtherTabMain": "Más lapok bezárása a fő területen", + "closeOthers": "Más lapok bezárása", + "closeRight": "Lapok bezárása jobbra", + "closeTab": "Bezárja a lapot", + "closeTabMain": "Zárja be a fő terület lapját", + "collapseAllTabs": "Összes oldalsó panel összezárása", + "collapseBottomPanel": "Alsó panel átkapcsolása", + "collapseLeftPanel": "Bal oldali panel átkapcsolása", + "collapseRightPanel": "Jobb oldali panel átkapcsolása", + "collapseTab": "Összecsukható oldalsó panel", + "showNextTabGroup": "Váltás a következő lapcsoportra", + "showNextTabInGroup": "Csoporton belüli következő lapra váltás", + "showPreviousTabGroup": "Váltás az előző lapcsoportra", + "showPreviousTabInGroup": "Váltás a csoport előző lapjára", + "toggleMaximized": "Maximált kapcsoló" + }, + "copyInfo": "Először nyisson meg egy fájlt az elérési útvonalának másolásához", + "copyWarn": "Kérjük, használja a böngésző másolás parancsát vagy parancsikonját.", + "cutWarn": "Kérjük, használja a böngésző kivágás parancsát vagy parancsikonját.", + "enhancedPreview": { + "classic": "A lap egyszerű előnézetének megjelenítése az alapvető információkkal.", + "enhanced": "A lap bővített előnézetének megjelenítése további információkkal.", + "visual": "A lap vizuális előnézetének megjelenítése." + }, + "file": { + "browse": "Böngésszen a oldalon." + }, + "highlightModifiedTabs": "Szabályozza, hogy a módosított (piszkos) szerkesztő lapok felső szegélye kirajzolódjon-e vagy sem.", + "keybinding": { + "duplicateModifierError": "Nem tudja elemezni a billentyűkötéseket {0} Duplikált módosítók", + "metaError": "Nem tudja elemezni a billentyűkötéseket {0} meta csak OSX-re vonatkozik", + "unrecognizedKeyError": "El nem ismert kulcs {0} a {1}" + }, + "keybindingStatus": "{0} megnyomva, további billentyűkre várva", + "keyboard": { + "choose": "Válassza ki a billentyűzetkiosztást", + "chooseLayout": "Válasszon billentyűzetkiosztást", + "current": "(jelenlegi: {0})", + "currentLayout": " - jelenlegi elrendezés", + "mac": "Mac billentyűzetek", + "pc": "PC billentyűzetek", + "tryDetect": "Próbálja meg felismerni a billentyűzetkiosztást a böngésző információi és a lenyomott billentyűk alapján." + }, + "navigator": { + "clipboardWarn": "A vágólaphoz való hozzáférés megtagadva. Ellenőrizze a böngésző engedélyeit.", + "clipboardWarnFirefox": "A vágólap API nem érhető el. A '{0}' beállítással engedélyezhető a '{1}' oldalon. Ezután töltse be újra a Theia-t. Figyelem, ez lehetővé teszi, hogy a FireFox teljes hozzáférést kapjon a rendszer vágólapjához." + }, + "offline": "Offline", + "pasteWarn": "Kérjük, használja a böngésző beillesztés parancsát vagy parancsikonját.", + "quitMessage": "A mentetlen módosítások nem kerülnek mentésre.", + "resetWorkbenchLayout": "A munkapad elrendezésének visszaállítása", + "searchbox": { + "close": "Bezár (menekülés)", + "next": "Következő (lefelé)", + "previous": "Előző (fel)", + "showAll": "Minden elem megjelenítése", + "showOnlyMatching": "Csak az egyező elemeket mutasd" + }, + "secondaryWindow": { + "alwaysOnTop": "Ha engedélyezve van, a másodlagos ablak minden más ablak fölött marad, beleértve a különböző alkalmazások ablakait is.", + "description": "A kivont másodlagos ablak kezdeti pozíciójának és méretének beállítása.", + "fullSize": "A kivont widget pozíciója és mérete megegyezik a futó Theia alkalmazáséval.", + "halfWidth": "A kivont widget pozíciója és mérete a futó Theia alkalmazás szélességének fele lesz.", + "originalSize": "A kivont widget pozíciója és mérete megegyezik az eredeti widgetével." + }, + "severity": { + "log": "Napló" + }, + "silentNotifications": "Beállítja, hogy az értesítések felugró ablakai el legyenek-e nyomva.", + "tabDefaultSize": "Megadja a lapok alapértelmezett méretét.", + "tabMaximize": "Szabályozza, hogy a lapok dupla kattintásra maximalizálódjanak-e.", + "tabMinimumSize": "Megadja a lapok minimális méretét.", + "tabShrinkToFit": "Zsugorítsa a lapokat a rendelkezésre álló helyhez.", + "window": { + "tabCloseIconPlacement": { + "description": "Helyezze a bezáró ikonokat a lapcímeken a lap elejére vagy végére. Az alapértelmezett beállítás minden platformon a vége.", + "end": "Helyezze a bezárás ikont a címke végére. Balról jobbra haladó nyelveken ez a lap jobb oldala.", + "start": "Helyezze a bezárás ikont a címke elejére. Balról jobbra haladó nyelveken ez a lap bal oldala." + } + }, + "window.menuBarVisibility": "A menü egy kompakt gombként jelenik meg az oldalsávon. Ez az érték figyelmen kívül marad, ha{0} .{1}" + }, + "debug": { + "TheiaIDE": "Theia IDE", + "addConfigurationPlaceholder": "Válassza ki a munkaterület gyökerét a konfiguráció hozzáadásához", + "breakpoint": "töréspont", + "cannotRunToThisLocation": "Nem sikerült az aktuális szálat a megadott helyre futtatni.", + "compound-cycle": "Indítási konfiguráció '{0}' tartalmaz egy ciklust önmagával együtt", + "conditionalBreakpoint": "Feltételes töréspont", + "conditionalBreakpointsNotSupported": "A hibakeresési típus által nem támogatott feltételes töréspontok", + "confirmRunToShiftedPosition_msg": "A célpont pozíciója az Ln {0}, Col {1}, Col helyére kerül áthelyezésre. Egyébként is futtatni?", + "confirmRunToShiftedPosition_title": "Az aktuális szálat nem lehet pontosan a megadott helyre futtatni.", + "consoleFilter": "Szűrő (pl. szöveg, !kizárás)", + "consoleFilterAriaLabel": "Szűrő debug konzol kimenet", + "consoleSessionSelectorTooltip": "Váltás a hibakeresési munkamenetek között. Minden hibakeresési munkamenetnek megvan a saját konzol kimenete.", + "consoleSeverityTooltip": "Szűrje a konzol kimenetét a súlyossági szint szerint. Csak a kiválasztott súlyossági szintű üzenetek jelennek meg.", + "continueAll": "Folytassa az összes", + "copyExpressionValue": "Kifejezés értékének másolása", + "couldNotRunTask": "Nem sikerült futtatni a feladatot '{0}'.", + "dataBreakpoint": "adatmegszakítási pont", + "debugConfiguration": "Hibakeresési konfiguráció", + "debugSessionInitializationFailed": "A hibakeresési munkamenet inicializálása sikertelen. A részletekért lásd a konzolt.", + "debugSessionTypeNotSupported": "A hibakeresési munkamenet típusa \"{0}\" nem támogatott.", + "debugToolbarMenu": "Hibakeresés eszköztár menü", + "debugVariableInput": "A {0} érték beállítása", + "disableSelectedBreakpoints": "Kijelölt töréspontok letiltása", + "disabledBreakpoint": "Mozgáskorlátozottak {0}", + "enableSelectedBreakpoints": "Kijelölt töréspontok engedélyezése", + "entry": "belépés", + "errorStartingDebugSession": "Hiba történt a hibakeresési munkamenet indításakor, nézze meg a naplóban a további részleteket.", + "exception": "kivétel", + "functionBreakpoint": "megállási pont", + "goto": "gooto", + "htiConditionalBreakpointsNotSupported": "A hibakeresési típus által nem támogatott feltételes töréspontok elérése", + "instruction-breakpoint": "Megszakítási pont", + "instructionBreakpoint": "utasítás-megszakítási pont", + "logpointsNotSupported": "A hibakeresési típus által nem támogatott naplózási pontok", + "missingConfiguration": "A '{0}:{1}' dinamikus konfiguráció hiányzik vagy nem alkalmazható.", + "pause": "szünet", + "pauseAll": "Minden szünet", + "reveal": "Kiderül", + "step": "lépés", + "taskTerminatedBySignal": "A '{0}' feladatot a {1} jelzése zárta le.", + "taskTerminatedForUnknownReason": "A '{0}' feladat ismeretlen okból megszűnt.", + "taskTerminatedWithExitCode": "A '{0}' feladat a {1} kilépési kóddal fejeződött be.", + "threads": "Szálak", + "toggleTracing": "A hibakeresési adapterekkel folytatott kommunikáció nyomon követésének engedélyezése/letiltása", + "unknownSession": "Ismeretlen munkamenet", + "unverifiedBreakpoint": "Ellenőrizetlen {0}" + }, + "editor": { + "diffEditor.wordWrap2": "A sorok a `#editor.wordWrap#` beállításnak megfelelően kerülnek a sorok közé.", + "dirtyEncoding": "A fájl piszkos. Kérjük, először mentse el, mielőtt más kódolással újra megnyitná.", + "editor.bracketPairColorization.enabled": "Szabályozza, hogy a zárójelpár színezése engedélyezve legyen-e vagy sem. Használja a `#workbench.colorCustomizations#` parancsot a zárójelek kiemelési színeinek felülbírálásához.", + "editor.codeActions.triggerOnFocusChange": "A `#editor.codeActionsOnSave#` kiváltásának engedélyezése, ha a `#files.autoSave#` értéke `afterDelay`. A kódműveleteknek `always`-re kell állítaniuk, hogy az ablak- és fókuszváltások esetén is aktiválódjanak.", + "editor.detectIndentation": "Szabályozza, hogy a `#editor.tabSize#` és a `#editor.insertSpaces#` automatikusan felismerésre kerüljön-e egy fájl megnyitásakor a fájl tartalma alapján.", + "editor.experimental.preferTreeSitter": "Meghatározza, hogy a tree sitter elemzés be legyen-e kapcsolva bizonyos nyelvek esetében. Ez elsőbbséget élvez az `editor.experimental.treeSitterTelemetry` beállítással szemben a megadott nyelvek esetében.", + "editor.inlayHints.enabled1": "Az inlay tippek alapértelmezés szerint megjelennek, és elrejtődnek, ha a \"Ctrl+Alt\" billentyűkombinációt nyomva tartjuk.", + "editor.inlayHints.enabled2": "Az inlay tippek alapértelmezés szerint el vannak rejtve, és a \"Ctrl+Alt\" billentyűkombináció lenyomásakor jelennek meg.", + "editor.inlayHints.fontFamily": "A betűcsaládot vezérli a betétfájlok betűtípusát a szerkesztőben. Ha üres, akkor a `#editor.fontFamily#`-t használja.", + "editor.inlayHints.fontSize": "A betűméretet szabályozza a szerkesztőben megjelenő betűjelzések betűméretét. Alapértelmezés szerint az `#editor.fontSize#` értéket használja, ha a beállított érték kisebb, mint `5` vagy nagyobb, mint a szerkesztő betűmérete.", + "editor.inlineSuggest.edits.experimental.enabled": "Szabályozza, hogy engedélyezzék-e a kísérleti szerkesztéseket a soron belüli javaslatokban.", + "editor.inlineSuggest.edits.experimental.onlyShowWhenCloseToCursor": "Azt szabályozza, hogy csak akkor jelenjenek meg a soron belüli javaslatok, ha a kurzor a javaslat közelében van.", + "editor.inlineSuggest.edits.experimental.useInterleavedLinesDiff": "Szabályozza, hogy engedélyezi-e a kísérleti sorok közötti különbségeket a soron belüli javaslatokban.", + "editor.inlineSuggest.edits.experimental.useMixedLinesDiff": "Szabályozza, hogy engedélyezzék-e a kísérleti szerkesztéseket a soron belüli javaslatokban.", + "editor.insertSpaces": "Szóközök beillesztése a \"Tab\" billentyű lenyomásakor. Ez a beállítás a fájl tartalma alapján felülíródik, ha a `#editor.detectIndentation#` be van kapcsolva.", + "editor.quickSuggestions": "Szabályozza, hogy a javaslatok automatikusan megjelenjenek-e gépelés közben. Ezt a megjegyzések, karakterláncok és más kódok beírása esetén lehet szabályozni. A gyors javaslatok beállíthatók úgy, hogy szellemszövegként vagy a javaslat widget segítségével jelenjenek meg. Figyeljen a '#editor.suggestOnTriggerCharacters#'-beállításra is, amely azt szabályozza, hogy a javaslatok speciális karakterek hatására aktiválódjanak-e.", + "editor.suggestFontSize": "A javaslat widget betűmérete. Ha `0`-ra van állítva, akkor a `#editor.fontSize#` értékét használja.", + "editor.suggestLineHeight": "A javaslat widget vonalmagassága. Ha `0`-ra van állítva, akkor a `#editor.lineHeight#` értékét használja. A minimális érték 8.", + "editor.tabSize": "A tabulátor szóközök száma. Ez a beállítás a fájl tartalma alapján felülíródik, ha a `#editor.detectIndentation#` be van kapcsolva.", + "formatOnSaveTimeout": "A milliszekundumban megadott időkorlát, amely után a fájl mentésekor lefutó formázás törlődik.", + "persistClosedEditors": "Azt szabályozza, hogy a munkaterület lezárt szerkesztési előzményei az ablak újratöltése során megmaradjanak-e.", + "showAllEditors": "Minden megnyitott szerkesztő megjelenítése", + "splitHorizontal": "Osztott szerkesztő vízszintes", + "splitVertical": "Függőleges osztott szerkesztő", + "toggleStickyScroll": "Ragadós görgetés bekapcsolása" + }, + "external-terminal": { + "cwd": "Jelenlegi munkakönyvtár kiválasztása az új külső terminálhoz" + }, + "file-search": { + "toggleIgnoredFiles": " (Nyomja meg a {0} gombot a figyelmen kívül hagyott fájlok megjelenítéséhez/elrejtéséhez)" + }, + "fileDialog": { + "showHidden": "Rejtett fájlok megjelenítése" + }, + "fileSystem": { + "fileResource": { + "overWriteBody": "Szeretné felülírni a fájlrendszerben a '{0}' fájlban végrehajtott változtatásokat?" + } + }, + "filesystem": { + "copiedToClipboard": "A letöltési linket a vágólapra másolta.", + "copyDownloadLink": "Letöltési link másolása", + "dialog": { + "initialLocation": "Menj a kezdeti helyszínre", + "multipleItemMessage": "Csak egy elemet választhat ki", + "navigateBack": "Vissza navigálni", + "navigateForward": "Navigálj előre", + "navigateUp": "Navigáljon felfelé egy könyvtárban" + }, + "fileResource": { + "binaryFileQuery": "Megnyitása eltarthat egy ideig, és az IDE esetleg nem reagál. Mindenképpen meg akarja nyitni a '{0}'-t?", + "binaryTitle": "A fájl vagy bináris, vagy nem támogatott szöveges kódolást használ.", + "largeFileTitle": "A fájl túl nagy ({0}).", + "overwriteTitle": "A '{0}' fájl megváltozott a fájlrendszerben." + }, + "filesExclude": "Glob-minták beállítása a fájlok és mappák kizárásához. Például a Fájlkereső e beállítás alapján dönti el, hogy mely fájlokat és mappákat jelenítse meg vagy rejtse el.", + "format": "Formátum:", + "maxConcurrentUploads": "Az egyidejűleg feltölthető fájlok maximális száma több fájl feltöltése esetén. A 0 azt jelenti, hogy az összes fájl egyidejűleg kerül feltöltésre.", + "maxFileSizeMB": "A megnyitható fájl maximális méretét szabályozza MB-ban.", + "prepareDownload": "Letöltés előkészítése...", + "prepareDownloadLink": "Letöltési link előkészítése...", + "processedOutOf": "{0} feldolgozva {1}-ből {0}", + "replaceTitle": "Fájl cseréje", + "uploadFailed": "Hiba történt egy fájl feltöltése közben. {0}", + "uploadFiles": "Fájlok feltöltése...", + "uploadedOutOf": "Feltöltött {0} a {1}-ből {0}" + }, + "getting-started": { + "ai": { + "header": "Az AI támogatás elérhető a Theia IDE-ben (béta verzió)!", + "openAIChatView": "Nyissa meg most az AI Chat View alkalmazást, és tudjon meg többet a használatáról!" + }, + "apiComparator": "{0} API kompatibilitás", + "newExtension": "Új bővítmény építése", + "newPlugin": "Egy új plugin építése", + "startup-editor": { + "welcomePage": "Nyissa meg az Üdvözlő oldalt, amelynek tartalma segíti a {0} és a bővítmények használatának megkezdését." + }, + "telemetry": "Adathasználat és telemetria" + }, + "git": { + "aFewSecondsAgo": "néhány másodperccel ezelőtt", + "addSignedOff": "Signed-off-by hozzáadása", + "added": "Hozzáadva", + "amendReuseMessage": "Az utolsó átadási üzenet újbóli használatához nyomja meg az 'Enter' billentyűt, vagy az 'Escape' billentyűt a törléshez.", + "amendRewrite": "Írja át az előző commit üzenetet. Nyomja meg az 'Enter' billentyűt a megerősítéshez vagy az 'Escape' billentyűt a törléshez.", + "checkoutCreateLocalBranchWithName": "Hozzon létre egy új helyi ágat {0} névvel. Nyomja meg az 'Enter' billentyűt a megerősítéshez vagy az 'Escape' billentyűt a törléshez.", + "checkoutProvideBranchName": "Kérjük, adja meg a fióktelep nevét.", + "checkoutSelectRef": "Válasszon ki egy hivatkozást a pénztárhoz vagy hozzon létre egy új helyi ágat:", + "cloneQuickInputLabel": "Kérjük, adja meg a Git tároló helyét. Nyomja meg az 'Enter' billentyűt a megerősítéshez vagy az 'Escape' billentyűt a törléshez.", + "cloneRepository": "Klónozza a Git tárolót: {0}. Nyomja meg az 'Enter' billentyűt a megerősítéshez vagy az 'Escape' billentyűt a törléshez.", + "compareWith": "Összehasonlítás...", + "compareWithBranchOrTag": "Válasszon ki egy ágat vagy címkét, amelyet a jelenleg aktív {0} ággal akar összehasonlítani:", + "conflicted": "Konfliktusos", + "copied": "Másolva", + "diff": "Diff", + "dirtyDiffLinesLimit": "Ne jelenítsen meg piszkos diff dekorációkat, ha a szerkesztő sorszáma meghaladja ezt a határt.", + "dropStashMessage": "Sikeresen eltávolítottuk a rejtekhelyet.", + "editorDecorationsEnabled": "A szerkesztőben a git dekorációk megjelenítése.", + "fetchPickRemote": "Válasszon ki egy távvezérlőt, ahonnan le kívánja hívni:", + "gitDecorationsColors": "Színes dekoráció használata a navigátorban.", + "mergeEditor": { + "currentSideTitle": "Jelenlegi", + "incomingSideTitle": "Bejövő" + }, + "mergeQuickPickPlaceholder": "Válasszon ki egy ágat, amelyet beolvaszt a jelenleg aktív {0} ágba:", + "missingUserInfo": "Győződjön meg róla, hogy a gitben beállította a 'user.name' és a 'user.email' értékeket.", + "noHistoryForError": "Nem áll rendelkezésre előzmény {0}", + "noPreviousCommit": "Nincs korábbi kötelezettségvállalás a módosításra", + "noRepositoriesSelected": "Nem választottak ki tárolóhelyeket.", + "prepositionIn": "a oldalon.", + "renamed": "Átnevezve", + "repositoryNotInitialized": "A {0} tároló még nincs inicializálva.", + "stashChanges": "Készletváltozások. Nyomja meg az 'Enter' billentyűt a megerősítéshez vagy az 'Escape' billentyűt a törléshez.", + "stashChangesWithMessage": "Stash változik az üzenettel: {0}. Nyomja meg az 'Enter' billentyűt a megerősítéshez vagy az 'Escape' billentyűt a törléshez.", + "tabTitleIndex": "{0} (index)", + "tabTitleWorkingTree": "{0} (Munkafa)", + "toggleBlameAnnotations": "Hibáztatás megjegyzések", + "unstaged": "Nem színpadra állított" + }, + "keybinding-schema-updater": { + "deprecation": "Használja helyette a `when` záradékot." + }, + "keymaps": { + "addKeybindingTitle": "Billentyűkötés hozzáadása a {0}", + "editKeybinding": "Billentyűkötés szerkesztése...", + "editKeybindingTitle": "Billentyűkötés szerkesztése {0}", + "editWhenExpression": "Szerkesztés Amikor kifejezés...", + "editWhenExpressionTitle": "Szerkeszteni, amikor kifejezés a {0}", + "keybinding": { + "copy": "Billentyűkötés másolása", + "copyCommandId": "Billentyűkötözés másolása Parancs azonosítója", + "copyCommandTitle": "Billentyűkötözés másolása Parancs címe", + "edit": "Billentyűkötés szerkesztése...", + "editWhenExpression": "Billentyűkötés szerkesztése, amikor kifejezés..." + }, + "keybindingCollidesValidation": "billentyűkötözés jelenleg ütközik", + "requiredKeybindingValidation": "billentyűkötés értéke szükséges", + "resetKeybindingConfirmation": "Tényleg vissza akarja állítani ezt a billentyűkötést az alapértelmezett értékre?", + "resetKeybindingTitle": "A {0} billentyűkhöz való kötés visszaállítása", + "resetMultipleKeybindingsWarning": "Ha a parancshoz több billentyűzetmegkötés is létezik, akkor mindet visszaállítja a rendszer." + }, + "localize": { + "offlineTooltip": "Nem tud csatlakozni a háttértárhoz." + }, + "markers": { + "clearAll": "Mindent törölni", + "noProblems": "A munkaterületen eddig nem észleltek problémákat.", + "tabbarDecorationsEnabled": "Problémadíszítők (diagnosztikai jelölők) megjelenítése a laprudakon." + }, + "memory-inspector": { + "addressTooltip": "Megjelenítendő memóriahely, cím vagy címre kiértékelő kifejezés", + "ascii": "ASCII", + "binary": "Bináris", + "byteSize": "Byte méret", + "bytesPerGroup": "Bájtok csoportonként", + "closeSettings": "Beállítások bezárása", + "columns": "Oszlopok", + "command": { + "createNewMemory": "Új memóriaellenőr létrehozása", + "createNewRegisterView": "Új nyilvántartási nézet létrehozása", + "followPointer": "Kövesse a mutatót", + "followPointerMemory": "Kövesse a mutatót a memóriaellenőrben", + "resetValue": "Érték visszaállítása", + "showRegister": "Regiszter megjelenítése a memória felügyelőben", + "viewVariable": "Változó megjelenítése a memória felügyelőben" + }, + "data": "Adatok", + "decimal": "Tizedesjegyek", + "diff": { + "label": "Diff: {0}" + }, + "diff-widget": { + "offset-label": "{0} Offset", + "offset-title": "Bájtok a memória eltolásához a {0}" + }, + "editable": { + "apply": "Változások alkalmazása", + "clear": "Tiszta változások" + }, + "endianness": "Endianness", + "extraColumn": "Extra oszlop", + "groupsPerRow": "Csoportok soronként", + "hexadecimal": "Hexadecimal", + "length": "Hosszúság", + "lengthTooltip": "A lekérdezendő bájtok száma decimális vagy hexadecimális értékben", + "memory": { + "addressField": { + "memoryReadError": "Adjon meg egy címet vagy kifejezést a Hely mezőbe." + }, + "freeze": "Memória nézet megállítása", + "hideSettings": "Beállítások panel elrejtése", + "readError": { + "bounds": "A memória határait túllépte, az eredmény csonkolva lesz.", + "noContents": "Jelenleg nem áll rendelkezésre memóriatartalom." + }, + "readLength": { + "memoryReadError": "Adja meg a hosszat (decimális vagy hexadecimális szám) a Hossz mezőben." + }, + "showSettings": "Beállítások panel megjelenítése", + "unfreeze": "Memória nézet feloldása", + "userError": "Hiba történt a memória lekérdezésében." + }, + "memoryCategory": "Memória Ellenőr", + "memoryInspector": "Memória Ellenőr", + "memoryTitle": "Memória", + "octal": "Octal", + "offset": "Offset", + "offsetTooltip": "Az aktuális memóriahelyhez hozzáadandó eltolás, amikor navigálsz.", + "provider": { + "localsError": "Nem lehet helyi változókat olvasni. Nincs aktív hibakeresési munkamenet.", + "readError": "Nem tudja olvasni a memóriát. Nincs aktív hibakeresési munkamenet.", + "writeError": "Nem tud memóriát írni. Nincs aktív hibakeresési munkamenet." + }, + "register": "Regisztráció", + "register-widget": { + "filter-placeholder": "Szűrő (kezdődik)" + }, + "registerReadError": "Hiba történt a regiszterek lekérdezésében.", + "registers": "Regiszterek", + "toggleComparisonWidgetVisibility": "Összehasonlítás Widget láthatóságának átkapcsolása", + "utils": { + "afterBytes": "Mindkét widgetbe, amelyet össze szeretne hasonlítani, memóriát kell töltenie. {0} nincs betöltve memória.", + "bytesMessage": "Mindkét widgetbe, amelyet össze szeretne hasonlítani, memóriát kell töltenie. {0} nincs betöltve memória." + } + }, + "messages": { + "notificationTimeout": "Az informatív értesítések el lesznek rejtve az időkorlát után.", + "toggleNotifications": "Értesítések váltása" + }, + "mini-browser": { + "typeUrl": "Írjon be egy URL-t" + }, + "monaco": { + "noSymbolsMatching": "Nincsenek megfelelő szimbólumok", + "typeToSearchForSymbols": "Írja be a szimbólumok kereséséhez" + }, + "navigator": { + "autoReveal": "Automatikus felfedés", + "clipboardWarn": "A vágólaphoz való hozzáférés megtagadva. Ellenőrizze a böngésző engedélyeit.", + "clipboardWarnFirefox": "A vágólap API nem érhető el. A '{0}' beállítással engedélyezhető a '{1}' oldalon. Ezután töltse be újra a Theia-t. Figyelem, ez lehetővé teszi, hogy a FireFox teljes hozzáférést kapjon a rendszer vágólapjához.", + "openWithSystemEditor": "Nyissa meg a rendszer szerkesztőjével", + "refresh": "Frissítés az Explorerben", + "reveal": "Feltárása az Explorerben", + "systemEditor": "Rendszer-szerkesztő", + "toggleHiddenFiles": "Rejtett fájlok kapcsolása" + }, + "output": { + "clearOutputChannel": "Tiszta kimeneti csatorna...", + "closeOutputChannel": "Kimeneti csatorna bezárása...", + "hiddenChannels": "Rejtett csatornák", + "hideOutputChannel": "Kimeneti csatorna elrejtése...", + "maxChannelHistory": "A kimeneti csatornában lévő bejegyzések maximális száma.", + "outputChannels": "Kimeneti csatornák", + "showOutputChannel": "Kimeneti csatorna megjelenítése..." + }, + "plugin": { + "blockNewTab": "A böngészője megakadályozta az új lap megnyitását" + }, + "plugin-dev": { + "alreadyRunning": "A hosztolt példány már fut.", + "debugInstance": "Hibakeresési példány", + "debugMode": "Az inspect vagy inspect-brk használata a Node.js hibakereséshez", + "debugPorts": { + "debugPort": "A kiszolgáló Node.js hibakereséséhez használni kívánt port" + }, + "devHost": "Fejlesztés Host", + "failed": "Nem sikerült futtatni a hosztolt plugin példányt: {0}", + "hostedPlugin": "Hostolt bővítmény", + "hostedPluginRunning": "Hostolt bővítmény: Futó", + "hostedPluginStarting": "Hostolt bővítmény: Indítás", + "hostedPluginStopped": "Hostolt bővítmény: Leállt", + "hostedPluginWatching": "Hostolt bővítmény: Figyelem", + "instanceTerminated": "{0} megszűnt", + "launchOutFiles": "Glob minták tömbje a generált JavaScript fájlok kereséséhez (a `${pluginPath}` helyébe a plugin tényleges elérési útja lép).", + "noValidPlugin": "A megadott mappa nem tartalmaz érvényes plugint.", + "notRunning": "A hosztolt példány nem fut.", + "pluginFolder": "Plugin mappa van beállítva: {0}", + "preventedNewTab": "A böngészője megakadályozta az új lap megnyitását", + "restartInstance": "Instancia újraindítása", + "running": "A hosztolt példány a következő címen fut:", + "selectPath": "Útvonal kiválasztása", + "startInstance": "Példa indítása", + "starting": "Hosted instance szerver indítása ...", + "stopInstance": "Állítsa le a példányt", + "unknownTerminated": "A példányt megszüntették", + "watchMode": "Watcher futtatása a fejlesztés alatt álló pluginon" + }, + "plugin-ext": { + "authentication-main": { + "loginTitle": "Bejelentkezés", + "signedOut": "Sikeresen kijelentkezett." + }, + "plugins": "Plugins", + "webviewTrace": "Vezérli a kommunikáció nyomon követését a webnézetekkel.", + "webviewWarnIfUnsecure": "Figyelmezteti a felhasználókat, hogy a webnézetek jelenleg nem biztonságosan vannak telepítve." + }, + "preferences": { + "ai-features": "AI funkciók", + "hostedPlugin": "Hostolt bővítmény", + "toolbar": "Eszköztár" + }, + "preview": { + "openByDefault": "Alapértelmezés szerint a szerkesztő helyett az előnézet megnyitása." + }, + "property-view": { + "created": "Létrehozva", + "directory": "Címtár", + "lastModified": "Utoljára módosítva", + "location": "Helyszín", + "noProperties": "Nincsenek elérhető tulajdonságok.", + "properties": "Tulajdonságok", + "symbolicLink": "Szimbolikus kapcsolat" + }, + "remote": { + "dev-container": { + "connect": "Újranyitás konténerben", + "noDevcontainerFiles": "A munkaterületen nem található devcontainer.json fájl. Kérjük, győződjön meg róla, hogy van egy .devcontainer könyvtár devcontainer.json fájllal.", + "selectDevcontainer": "Válasszon ki egy devcontainer.json fájlt" + }, + "ssh": { + "connect": "Jelenlegi ablak csatlakoztatása a gazdához...", + "connectToConfigHost": "Az aktuális ablak csatlakoztatása a konfigurációs fájlban lévő hoszthoz...", + "enterHost": "SSH állomás nevének megadása", + "enterUser": "SSH felhasználónév megadása", + "failure": "Nem tudott SSH-kapcsolatot nyitni a távolihoz.", + "hostPlaceHolder": "Pl. hello@example.com", + "needsHost": "Kérjük, adjon meg egy állomásnevet.", + "needsUser": "Kérjük, adjon meg egy felhasználónevet.", + "userPlaceHolder": "Pl. hello" + }, + "sshNoConfigPath": "Nem talált SSH konfigurációs elérési útvonal.", + "wsl": { + "connectToWsl": "Csatlakozás a WSL-hez", + "connectToWslUsingDistro": "Csatlakozás a WSL-hez a Distro...", + "noWslDistroFound": "Nem találtunk WSL disztribúciókat. Kérjük, először telepítsen egy WSL disztribúciót.", + "reopenInWsl": "Mappa újranyitása a WSL-ben", + "selectWSLDistro": "Válasszon ki egy WSL-elosztást" + } + }, + "scm": { + "amend": "A módosítása", + "amendHeadCommit": "HEAD Commit", + "amendLastCommit": "Az utolsó kötelezettségvállalás módosítása", + "changeRepository": "Repozitórium módosítása...", + "config.untrackedChanges": "Szabályozza a nem követett változások viselkedését.", + "config.untrackedChanges.hidden": "rejtett", + "config.untrackedChanges.mixed": "vegyes", + "config.untrackedChanges.separate": "külön", + "dirtyDiff": { + "close": "Bezárás Változás Peek View" + }, + "history": "Történelem", + "mergeEditor": { + "resetConfirmationTitle": "Tényleg vissza akarja állítani az egyesítés eredményét ebben a szerkesztőben?" + }, + "noRepositoryFound": "Nem talált tárolóhely", + "unamend": "Visszavonja a", + "unamendCommit": "Módosítás feloldása commit" + }, + "search-in-workspace": { + "includeIgnoredFiles": "Ignorált fájlok felvétele", + "noFolderSpecified": "Nem nyitott meg vagy nem adott meg mappát. Jelenleg csak a megnyitott fájlok keresése történik.", + "resultSubset": "Ez csak egy részhalmaza az összes eredménynek. A találati lista szűkítéséhez használjon konkrétabb keresési kifejezést.", + "searchOnEditorModification": "Keresés az aktív szerkesztőben, amikor módosítják." + }, + "secondary-window": { + "extract-widget": "Nézet áthelyezése másodlagos ablakba" + }, + "shell-area": { + "secondary": "Másodlagos ablak" + }, + "task": { + "attachTask": "Feladat csatolása...", + "circularReferenceDetected": "Körkörös hivatkozás észlelve: {0} --> {1}", + "clearHistory": "Történelem törlése", + "errorKillingTask": "Hiba a feladat megállítása '{0}': {1}", + "errorLaunchingTask": "Hiba a '{0}' feladat indításakor: {1}", + "invalidTaskConfigs": "Érvénytelen feladatkonfigurációkat találtak. Nyissa meg a tasks.json fájlt, és keressen részleteket a Problémák nézetben.", + "neverScanTaskOutput": "Soha ne vizsgálja a feladat kimenetét", + "noTaskToRun": "Nem találtunk futtatandó feladatot. Feladatok konfigurálása...", + "noTasksFound": "Nem találtak feladatokat", + "notEnoughDataInDependsOn": "A \"dependsOn\"-ban megadott információk nem elegendőek a megfelelő feladat megtalálásához!", + "schema": { + "commandOptions": { + "cwd": "A végrehajtott program vagy szkript aktuális munkakönyvtára. Ha elhagyja, a Theia aktuális munkakönyvtárát használja." + }, + "presentation": { + "panel": { + "dedicated": "A terminál egy adott feladatra van kijelölve. Ha ez a feladat újra végrehajtásra kerül, a terminál újra felhasználásra kerül. Egy másik feladat kimenete azonban egy másik terminálon jelenik meg.", + "new": "A feladat minden egyes végrehajtása egy új, tiszta terminált használ.", + "shared": "A terminál megosztott, és a többi feladatfuttatás kimenete ugyanabba a terminálba kerül." + }, + "showReuseMessage": "Szabályozza, hogy megjelenjen-e a \"A terminál újrafelhasználásra kerül a feladatok által\" üzenet." + }, + "problemMatcherObject": { + "owner": "A probléma tulajdonosa Theia belsejében. Elhagyható, ha a bázis meg van adva. Alapértelmezés szerint 'external', ha elhagyja és a base nincs megadva." + } + }, + "taskAlreadyRunningInTerminal": "A feladat már fut a terminálban", + "taskExitedWithCode": "A '{0}' feladat a {1} kóddal lépett ki.", + "taskTerminalTitle": "Feladat: {0}", + "taskTerminatedBySignal": "A '{0}' feladatot a {1} jelzéssel fejezték be.", + "terminalWillBeReusedByTasks": "A terminált a feladatok újra felhasználják." + }, + "terminal": { + "defaultProfile": "Az alapértelmezett profil a {0}", + "enableCopy": "A ctrl-c (macOS-en cmd-c) engedélyezése a kijelölt szöveg másolásához", + "enablePaste": "A ctrl-v (cmd-v macOS-en) engedélyezése a vágólapról történő beillesztéshez", + "profileArgs": "A profil által használt shell argumentumok.", + "profileColor": "A terminál témájának színazonosítója, amelyet a terminálhoz társít.", + "profileDefault": "Válassza az Alapértelmezett profil...", + "profileIcon": "A terminál ikonjához társítandó kódikon azonosító.\nterminal-tmux:\"$(terminal-tmux)\"", + "profileNew": "Új terminál (profillal)...", + "profilePath": "A profil által használt héj elérési útja.", + "profiles": "Az új terminál létrehozásakor megjelenítendő profilok. A path tulajdonság manuális beállítása opcionális args-ekkel.\nA meglévő profilok `null` értékre állítása a profil elrejtéséhez a listából, például: `\"{0}\": null`.", + "rendererType": "A terminál megjelenítésének módját szabályozza.", + "rendererTypeDeprecationMessage": "A renderelő típusa már nem támogatott opció.", + "selectProfile": "Válasszon ki egy profilt az új terminálhoz", + "shell.deprecated": "Ez elavult, az új ajánlott módja az alapértelmezett shell konfigurálásának az, hogy létrehoz egy terminálprofilt a 'terminal.integrated.profiles.{0}' menüpontban, és beállítja a profil nevét alapértelmezettként a 'terminal.integrated.defaultProfile.{0}.' menüpontban.", + "shellArgsLinux": "A Linux terminálon használandó parancssori argumentumok.", + "shellArgsOsx": "A macOS terminálon használandó parancssori argumentumok.", + "shellArgsWindows": "A Windows terminálon használandó parancssori argumentumok.", + "shellLinux": "A terminál által Linuxon használt shell elérési útja (alapértelmezett: '{0}'}).", + "shellOsx": "A terminál által macOS alatt használt shell elérési útja (alapértelmezett: '{0}'}).", + "shellWindows": "A Windows alatt a terminál által használt shell elérési útja. (alapértelmezett: '{0}')." + }, + "terminal-manager": { + "addTerminalToGroup": "Terminál hozzáadása a csoporthoz", + "closeDialog": { + "message": "A Terminálkezelő bezárása után annak elrendezése nem állítható vissza. Biztosan bezárja a Terminálkezelőt?", + "title": "Szeretné bezárni a terminálkezelőt?" + }, + "closeTerminalManager": "Terminálkezelő bezárása", + "createNewTerminalGroup": "Új terminálcsoport létrehozása", + "createNewTerminalPage": "Új terminál oldal létrehozása", + "deleteGroup": "Csoport törlése", + "deletePage": "Delete Page", + "deleteTerminal": "Terminál törlése", + "group": "Csoport", + "label": "Terminálok", + "maximizeBottomPanel": "Alsó panel maximalizálása", + "minimizeBottomPanel": "Alsó panel minimalizálása", + "openTerminalManager": "Terminálkezelő megnyitása", + "page": "Oldal", + "rename": "Átnevezés", + "resetTerminalManagerLayout": "Terminal Manager elrendezés visszaállítása", + "toggleTreeView": "Fa nézet váltása" + }, + "test": { + "cancelAllTestRuns": "Minden tesztfuttatás törlése", + "stackFrameAt": "a címen.", + "testRunDefaultName": "{0} fuss {1}", + "testRuns": "Tesztfutások" + }, + "toolbar": { + "addCommand": "Parancs hozzáadása az eszköztárhoz", + "addCommandPlaceholder": "Az eszköztárhoz hozzáadandó parancs keresése", + "centerColumn": "Középső oszlop", + "failedUpdate": "Nem sikerült frissíteni a '{0}' értékét a '{1}'-ben.", + "filterIcons": "Szűrő ikonok", + "iconSelectDialog": "Ikon kiválasztása a '{0}' számára", + "iconSet": "Ikon készlet", + "insertGroupLeft": "Csoportelválasztó beillesztése (balra)", + "insertGroupRight": "Csoportelválasztó beillesztése (jobbra)", + "leftColumn": "Bal oszlop", + "openJSON": "Eszköztár testreszabása (JSON megnyitása)", + "removeCommand": "Parancs eltávolítása az eszköztárból", + "restoreDefaults": "Eszköztár alapértelmezett beállításainak visszaállítása", + "rightColumn": "Jobb oszlop", + "selectIcon": "Ikon kiválasztása", + "toggleToolbar": "Eszköztár kapcsolása", + "toolbarLocationPlaceholder": "Hol szeretné, ha a parancsot hozzáadnánk?", + "useDefaultIcon": "Alapértelmezett ikon használata" + }, + "typehierarchy": { + "subtypeHierarchy": "Altípus-hierarchia", + "supertypeHierarchy": "Szupertípus hierarchia" + }, + "variableResolver": { + "listAllVariables": "Változó: List All" + }, + "vsx-registry": { + "confirmDialogMessage": "A \"{0}\" kiterjesztés nem ellenőrzött, és biztonsági kockázatot jelenthet.", + "confirmDialogTitle": "Biztos, hogy folytatni akarja a telepítést ?", + "downloadCount": "Letöltési szám: {0}", + "errorFetching": "Hiba a kiterjesztések lekérdezésében.", + "errorFetchingConfigurationHint": "Ezt hálózati konfigurációs problémák okozhatják.", + "failedInstallingVSIX": "Nem sikerült telepíteni a {0} oldalt a VSIX-ből.", + "invalidVSIX": "A kiválasztott fájl nem érvényes \"*.vsix\" bővítmény.", + "license": "Engedély: {0}", + "onlyShowVerifiedExtensionsDescription": "Ez lehetővé teszi, hogy a {0} csak ellenőrzött kiterjesztéseket jelenítsen meg.", + "onlyShowVerifiedExtensionsTitle": "Csak ellenőrzött kiterjesztések megjelenítése", + "recommendedExtensions": "A munkaterületre ajánlott kiterjesztések neveinek listája.", + "searchPlaceholder": "Keresés kiterjesztések {0}", + "showInstalled": "Telepített bővítmények megjelenítése", + "showRecommendedExtensions": "Szabályozza, hogy a kiterjesztési ajánlásokhoz megjelenjenek-e értesítések.", + "vsx-extensions-contribution": { + "update-version-uninstall-error": "Hiba a kiterjesztés eltávolításakor: {0}.", + "update-version-version-error": "Nem sikerült telepíteni a {1} {0} verzióját." + } + }, + "webview": { + "goToReadme": "Tovább a README-hez", + "messageWarning": " A {0} végpont hoszt mintája `{1}-re` változott; a minta megváltoztatása biztonsági réseket okozhat. További információért lásd a `{2}` című részt." + }, + "workspace": { + "bothAreDirectories": "Mindkét forrás könyvtár.", + "clickToManageTrust": "Kattintson a bizalmi beállítások kezeléséhez.", + "compareWithEachOther": "Összehasonlítás egymással", + "confirmDeletePermanently.description": "Nem sikerült törölni a \"{0}\" fájlt a Kukában. Szeretné véglegesen törölni?", + "confirmDeletePermanently.solution": "A beállítások között letilthatja a Trash használatát.", + "confirmDeletePermanently.title": "Hiba a fájl törlésében", + "confirmMessage.delete": "Tényleg törölni szeretné a következő fájlokat?", + "confirmMessage.dirtyMultiple": "Tényleg törölni akarja a {0} fájlokat a mentetlen módosításokkal?", + "confirmMessage.dirtySingle": "Tényleg törölni akarja a {0} fájlt a mentetlen módosításokkal együtt?", + "confirmMessage.uriMultiple": "Tényleg törölni szeretné az összes {0} kiválasztott fájlt?", + "confirmMessage.uriSingle": "Tényleg törölni akarja a {0}-t?", + "directoriesCannotBeCompared": "A könyvtárak nem összehasonlíthatóak. {0}", + "duplicate": "Duplikátum", + "failSaveAs": "Nem lehet futtatni a \"{0}\"-t az aktuális widgethez.", + "isDirectory": "{0}'' egy könyvtár.", + "manageTrustPlaceholder": "Válassza ki a munkaterület megbízhatósági állapotát", + "newFilePlaceholder": "Fájlnév", + "newFolderPlaceholder": "Mappa neve", + "noErasure": "Megjegyzés: Semmi sem törlődik a lemezről", + "notWorkspaceFile": "Nem érvényes munkaterület fájl: {0}", + "openRecentPlaceholder": "Írja be a megnyitni kívánt munkaterület nevét.", + "openRecentWorkspace": "Legutóbbi munkaterület megnyitása...", + "preserveWindow": "Munkaterületek megnyitásának engedélyezése az aktuális ablakban.", + "removeFolder": "Biztos, hogy a következő mappát szeretné eltávolítani a munkaterületről?", + "removeFolders": "Biztos, hogy a következő mappákat szeretné eltávolítani a munkaterületről?", + "restrictedModeDescription": "Egyes funkciók le vannak tiltva, mert ez a munkaterület nem megbízható.", + "restrictedModeNote": "*Megjegyzés: A munkaterület-bizalom funkció jelenleg fejlesztés alatt áll a Theia-ban; még nem minden funkció integrálva van a munkaterület-bizalomba.*", + "schema": { + "folders": { + "description": "Gyökérmappák a munkaterületen" + }, + "title": "Munkaterület fájl" + }, + "trashTitle": "Mozgassa {0} a szemetesbe", + "trustEmptyWindow": "Szabályozza, hogy az üres munkaterület alapértelmezés szerint megbízható legyen-e vagy sem.", + "trustEnabled": "Szabályozza, hogy a munkaterület megbízhatósága engedélyezve legyen-e vagy sem. Ha le van tiltva, akkor minden munkaterület megbízható.", + "trustTrustedFolders": "A megkérdezés nélkül megbízható mappa-URI-k listája.", + "untitled-cleanup": "Úgy tűnik, hogy sok cím nélküli munkaterületi fájl van. Kérjük, ellenőrizze {0} és távolítsa el a nem használt fájlokat.", + "variables": { + "cwd": { + "description": "A feladatfutó aktuális munkakönyvtára indításkor" + }, + "file": { + "description": "A jelenleg megnyitott fájl elérési útja" + }, + "fileBasename": { + "description": "A jelenleg megnyitott fájl alapneve" + }, + "fileBasenameNoExtension": { + "description": "A jelenleg megnyitott fájl neve kiterjesztés nélkül" + }, + "fileDirname": { + "description": "A jelenleg megnyitott fájl könyvtárának neve" + }, + "fileExtname": { + "description": "A jelenleg megnyitott fájl kiterjesztése" + }, + "relativeFile": { + "description": "A jelenleg megnyitott fájl elérési útja a munkaterület gyökérkönyvtárához viszonyítva" + }, + "relativeFileDirname": { + "description": "A jelenleg megnyitott fájl könyvtárneve a ${workspaceFolder} könyvtárhoz viszonyítva" + }, + "workspaceFolder": { + "description": "A munkaterület gyökérmappájának elérési útja" + }, + "workspaceFolderBasename": { + "description": "A munkaterület gyökérmappájának neve" + }, + "workspaceRoot": { + "description": "A munkaterület gyökérmappájának elérési útja" + }, + "workspaceRootFolderName": { + "description": "A munkaterület gyökérmappájának neve" + } + }, + "workspaceFolderAdded": "Több gyökérrel rendelkező munkaterületet hoztunk létre. Szeretné a munkaterület konfigurációját fájlba menteni?", + "workspaceFolderAddedTitle": "Mappa hozzáadása a munkaterülethez" + } + }, + "vsx.disabling": "A letiltása", + "vsx.disabling.extensions": "A {0} letiltása ...", + "vsx.enabling": "A engedélyezése", + "vsx.enabling.extension": "A {0}..." +} diff --git a/packages/core/i18n/nls.it.json b/packages/core/i18n/nls.it.json new file mode 100644 index 0000000..637c15b --- /dev/null +++ b/packages/core/i18n/nls.it.json @@ -0,0 +1,2097 @@ +{ + "ai-chat-ui.show-settings": "Mostra impostazioni AI", + "ai-chat:summarize-session-as-task-for-coder": "Riassumere la sessione come compito per il codificatore", + "ai.executePlanWithCoder": "Esegui piano corrente con codificatore", + "ai.updateTaskContext": "Aggiornare il contesto dell'attività corrente", + "aiConfiguration:open": "Aprire la vista Configurazione AI", + "aiHistory:clear": "Storia dell'IA: Cancella la storia", + "aiHistory:open": "Aprire la vista Cronologia AI", + "aiHistory:sortChronologically": "Storia dell'intelligenza artificiale: Ordinamento cronologico", + "aiHistory:sortReverseChronologically": "Storia dell'intelligenza artificiale: Ordinamento cronologico inverso", + "aiHistory:toggleCompact": "Storia dell'intelligenza artificiale: Alterna la vista compatta", + "aiHistory:toggleHideNewlines": "Storia dell'intelligenza artificiale: Smettere di interpretare le newline", + "aiHistory:toggleRaw": "Storia dell'intelligenza artificiale: Alterna la visualizzazione grezza", + "aiHistory:toggleRenderNewlines": "Storia dell'intelligenza artificiale: Interpretare le newline", + "debug.breakpoint.editCondition": "Modifica della condizione...", + "debug.breakpoint.removeSelected": "Rimuovere i punti di interruzione selezionati", + "debug.breakpoint.toggleEnabled": "Attiva/Disattiva punti di interruzione", + "notebook.cell.changeToCode": "Cambia cella in codice", + "notebook.cell.changeToMarkdown": "Cambiare la cella in Mardown", + "notebook.cell.insertMarkdownCellAbove": "Inserire la cella Markdown sopra", + "notebook.cell.insertMarkdownCellBelow": "Inserire la cella Markdown in basso", + "terminal:new:profile": "Creare un nuovo terminale integrato da un profilo", + "terminal:profile:default": "Scegliere il profilo del terminale predefinito", + "theia": { + "ai": { + "agents": { + "completionNotification": { + "mdDescription": "Comportamento della notifica quando l'agente completa un'attività. Se non è impostata, verrà utilizzata l'impostazione di notifica predefinita globale.\n - `os-notification`: Mostra le notifiche del sistema operativo/di sistema\n - `messaggio`: Mostra le notifiche nella barra di stato/area dei messaggi.\n - `blink`: Fa lampeggiare o evidenziare l'interfaccia utente\n - `off`: Disattiva le notifiche per questo agente", + "title": "Notifica di completamento" + }, + "enable": { + "mdDescription": "Specifica se l'agente deve essere abilitato (true) o disabilitato (false).", + "title": "Abilitazione dell'agente" + }, + "languageModelRequirements": { + "identifier": { + "mdDescription": "L'identificatore del modello linguistico da utilizzare." + }, + "mdDescription": "Specifica i modelli linguistici utilizzati per questo agente.", + "purpose": { + "mdDescription": "Lo scopo per cui viene utilizzato questo modello linguistico.", + "title": "Scopo" + }, + "title": "Requisiti del modello linguistico" + }, + "mdDescription": "Configurare le impostazioni dell'agente, come l'abilitazione o la disabilitazione di agenti specifici, la configurazione dei prompt e la selezione degli LLM.", + "selectedVariants": { + "mdDescription": "Specifica le varianti di prompt attualmente selezionate per questo agente.", + "title": "Varianti selezionate" + }, + "title": "Impostazioni dell'agente" + }, + "anthropic": { + "apiKey": { + "description": "Inserire la chiave API del proprio account Anthropic ufficiale. **Nota bene:** Utilizzando questa preferenza, la chiave API di Anthropic verrà memorizzata in chiaro sulla macchina che esegue Theia. Utilizzare la variabile d'ambiente `ANTHROPIC_API_KEY` per impostare la chiave in modo sicuro." + }, + "models": { + "description": "Modelli antropici ufficiali da utilizzare" + } + }, + "chat": { + "agent": { + "architect": "Architetto", + "coder": "programmatore", + "universal": "Universal" + }, + "applySuggestion": "Candidatura", + "bypassModelRequirement": { + "description": "Ignora il controllo dei requisiti del modello linguistico. Abilita questa opzione se utilizzi agenti esterni (ad esempio Claude Code) che non richiedono i modelli linguistici Theia." + }, + "changeSetDefaultTitle": "Modifiche suggerite", + "changeSetFileDiffUriLabel": "Modifiche all'IA: {0}", + "chatAgentsVariable": { + "description": "Restituisce l'elenco degli agenti di chat disponibili nel sistema." + }, + "chatSessionNamingAgent": { + "description": "Agente per la generazione dei nomi delle sessioni di chat", + "vars": { + "conversation": { + "description": "Il contenuto della conversazione in chat." + }, + "listOfSessionNames": { + "description": "L'elenco dei nomi delle sessioni esistenti." + } + } + }, + "chatSessionSummaryAgent": { + "description": "Agente per la generazione di riepiloghi delle sessioni di chat." + }, + "confirmApplySuggestion": "Il file {0} è cambiato da quando è stato creato questo suggerimento. Si è certi di voler applicare la modifica?", + "confirmRevertSuggestion": "Il file {0} è cambiato da quando è stato creato questo suggerimento. Si è certi di voler ripristinare la modifica?", + "couldNotFindMatchingLM": "Non è stato possibile trovare un modello linguistico corrispondente. Controllare la configurazione!", + "couldNotFindReadyLMforAgent": "Impossibile trovare un modello linguistico pronto per l'agente {0}. Si prega di controllare la configurazione!", + "defaultAgent": { + "description": "Opzionale: dell'agente di chat che deve essere invocato, se nessun agente è esplicitamente menzionato con @ nella richiesta dell'utente. Se non è stato configurato un agente predefinito, verranno applicate le impostazioni predefinite di Theia." + }, + "imageContextVariable": { + "args": { + "data": { + "description": "I dati dell'immagine in base64." + }, + "mimeType": { + "description": "Il mimetype dell'immagine." + }, + "name": { + "description": "Il nome del file immagine, se disponibile." + }, + "wsRelativePath": { + "description": "Il percorso relativo allo spazio di lavoro del file immagine, se disponibile." + } + }, + "description": "Fornisce informazioni sul contesto di un'immagine", + "label": "File immagine" + }, + "orchestrator": { + "description": "Questo agente analizza la richiesta dell'utente rispetto alla descrizione di tutti gli agenti di chat disponibili e seleziona l'agente più adatto a rispondere alla richiesta (utilizzando l'intelligenza artificiale). La richiesta dell'utente verrà delegata direttamente all'agente selezionato senza ulteriori conferme.", + "vars": { + "availableChatAgents": { + "description": "L'elenco degli agenti di chat che l'orchestratore può delegare, esclusi gli agenti specificati nella preferenza dell'elenco di esclusione." + } + } + }, + "pinChatAgent": { + "description": "Abilitare l'agent pinning per mantenere automaticamente attivo un agente di chat menzionato tra i vari prompt, riducendo la necessità di menzioni ripetute. È possibile disinserire manualmente o cambiare agente in qualsiasi momento." + }, + "revertSuggestion": "Annullamento del suggerimento", + "selectImageFile": "Selezionare un file immagine", + "sessionStorage": { + "description": "Configura dove archiviare le sessioni di chat.", + "globalPath": "Percorso globale", + "pathNotUsedForScope": "Non utilizzato con un ambito di archiviazione \"{0}\".", + "pathRequired": "Il percorso non può essere vuoto", + "pathSettings": "Impostazioni percorso", + "resetToDefault": "Ripristina impostazioni predefinite", + "scope": { + "global": "Memorizza le sessioni di chat nella cartella di configurazione globale.", + "workspace": "Memorizza le sessioni di chat nella cartella dell'area di lavoro." + }, + "workspacePath": "Percorso dell'area di lavoro" + }, + "taskContextService": { + "summarizeProgressMessage": "Riassumere: {0}", + "updatingProgressMessage": "Aggiornamento: {0}" + }, + "toolConfirmation": { + "confirm": { + "description": "Chiedere conferma prima di eseguire gli strumenti" + }, + "disabled": { + "description": "Disattivare l'esecuzione dello strumento" + }, + "yolo": { + "description": "Esecuzione automatica degli strumenti senza conferma" + } + }, + "view": { + "label": "Chat AI" + } + }, + "chat-ui": { + "addContextVariable": "Aggiungere una variabile di contesto", + "agent": "Agente", + "aiDisabled": "Le funzioni AI sono disattivate", + "applyAll": "Applicare tutti", + "applyAllTitle": "Applicare tutte le modifiche in sospeso", + "askQuestion": "Ask a question", + "attachToContext": "Allegare elementi al contesto", + "cancel": "Annullamento (Esc)", + "chat-view-tree-widget": { + "ai": "AI", + "aiFeatureHeader": "🚀 Caratteristiche AI disponibili (versione Alpha)!", + "featuresDisabled": "Attualmente, tutte le funzioni AI sono disabilitate!", + "generating": "Generazione", + "howToEnable": "Come attivare le funzioni AI:", + "noRenderer": "Errore: Nessun renderer trovato", + "scrollToBottom": "Vai all'ultimo messaggio", + "waitingForInput": "In attesa di input", + "you": "Tu" + }, + "chatInput": { + "clearHistory": "Cancella la cronologia dei prompt di input", + "cycleMode": "Modalità Ciclo di conversazione", + "nextPrompt": "Il prossimo prompt", + "previousPrompt": "Prompt precedente" + }, + "chatInputAriaLabel": "Digita qui il tuo messaggio", + "chatResponses": "Risposte nella chat", + "code-part-renderer": { + "generatedCode": "Codice generato" + }, + "collapseChangeSet": "Chiudi Modifica set", + "command-part-renderer": { + "commandNotExecutable": "Il comando ha l'id \"{0}\" ma non è eseguibile dalla finestra di chat." + }, + "copyCodeBlock": "Copiare il blocco di codice", + "couldNotSendRequestToSession": "Non è stato possibile inviare la richiesta \"{0}\" alla sessione {1}", + "delegation-response-renderer": { + "prompt": { + "label": "Richiesta delegata:" + }, + "response": { + "label": "Risposta:" + }, + "starting": "Delegazione di partenza...", + "status": { + "canceled": "annullato", + "error": "errore", + "generating": "generando...", + "starting": "iniziare..." + } + }, + "deleteChangeSet": "Cancellare il set di modifiche", + "editRequest": "Modifica", + "edited": "modificato", + "editedTooltipHint": "Questa variante di prompt è stata modificata. È possibile reimpostarla nella vista Configurazione AI.", + "enterChatName": "Inserire il nome della chat", + "errorChatInvocation": "Si è verificato un errore durante l'invocazione del servizio di chat.", + "expandChangeSet": "Espandi set di modifiche", + "failedToDeleteSession": "Cancellazione fallita della sessione di chat", + "failedToLoadChats": "Impossibile caricare le sessioni di chat", + "failedToRestoreSession": "Impossibile ripristinare la sessione di chat", + "failedToRetry": "Messaggio di errore di riprova", + "focusInput": "Focus Chat Input", + "focusResponse": "Risposta chat Focus", + "noChatAgentsAvailable": "Non sono disponibili agenti di chat.", + "openDiff": "Diff aperto", + "openOriginalFile": "Aprire il file originale", + "performThisTask": "Eseguire questa operazione.", + "persistedSession": "Sessione persistente (fare clic per ripristinare)", + "removeChat": "Rimuovi la chat", + "renameChat": "Rinominare la chat", + "requestNotFoundForRetry": "Richiesta non trovata per un nuovo tentativo", + "responseFrom": "Risposta dell'{0}", + "selectAgentQuickPickPlaceholder": "Selezionare un agente per la nuova sessione", + "selectChat": "Selezionare la chat", + "selectContextVariableQuickPickPlaceholder": "Selezionate una variabile di contesto da allegare al messaggio.", + "selectTaskContextQuickPickItem": { + "currentlyOpen": "attualmente aperto" + }, + "selectTaskContextQuickPickPlaceholder": "Selezionare un contesto di attività da allegare", + "selectVariableArguments": "Selezionare gli argomenti delle variabili", + "send": "Invia (Invio)", + "sessionNotFoundForRetry": "Sessione non trovata per il tentativo", + "text-part-renderer": { + "cantDisplay": "Impossibile visualizzare la risposta, controllare i ChatResponsePartRenderers!" + }, + "thinking-part-renderer": { + "thinking": "Pensare" + }, + "toolcall-part-renderer": { + "denied": "Esecuzione negata", + "finished": "Ran", + "rejected": "Esecuzione annullata" + }, + "toolconfirmation": { + "allow-options-dropdown-tooltip": "Altre opzioni di autorizzazione", + "allow-session": "Consentire questa chat", + "allowed": "Esecuzione dello strumento consentita", + "alwaysAllowConfirm": "Capisco, abilita l'approvazione automatica", + "alwaysAllowTitle": "Abilitare l'approvazione automatica per \"{0}\"?", + "canceled": "Esecuzione dello strumento annullata", + "denied": "Esecuzione dello strumento negata", + "deny-forever": "Negare sempre", + "deny-options-dropdown-tooltip": "Altre opzioni di rifiuto", + "deny-reason-placeholder": "Inserisci il motivo del rifiuto...", + "deny-session": "Rifiuto per questa chat", + "deny-with-reason": "Negare con ragione...", + "executionDenied": "Esecuzione dello strumento negata", + "header": "Confermare l'esecuzione dello strumento" + }, + "unableToSummarizeCurrentSession": "Impossibile riassumere la sessione corrente. Confermare che l'agente di riepilogo non è disabilitato.", + "unknown-part-renderer": { + "contentNotRestoreable": "Non è stato possibile ripristinare completamente questo contenuto (tipo '{0}'). Potrebbe provenire da un'estensione non più disponibile." + }, + "unpinAgent": "Agente di disimpiego", + "variantTooltip": "Variante suggerita: {0}", + "yourMessage": "Il tuo messaggio" + }, + "claude-code": { + "agentDescription": "L'agente di codifica di Anthropic", + "askBeforeEdit": "Chiedere prima di modificare", + "changeSetTitle": "Modifiche per Codice Claude", + "clearCommand": { + "description": "Creare una nuova sessione" + }, + "compactCommand": { + "description": "Conversazione compatta con istruzioni di messa a fuoco opzionali" + }, + "completedCount": "{0}/{1} completato", + "configCommand": { + "description": "Configurazione del codice Claude aperto" + }, + "currentDirectory": "directory corrente", + "differentAgentRequestWarning": "La richiesta di chat precedente è stata gestita da un altro agente. Claude Code non vede gli altri messaggi.", + "directory": "Elenco", + "domain": "Dominio", + "editAutomatically": "Modifica automaticamente", + "editNumber": "Modifica {0}", + "editing": "Editing", + "editsCount": "{0} modifiche", + "emptyTodoList": "Non tutti disponibili", + "entireFile": "Entire File", + "excludingOnePattern": " (escluso 1 modello)", + "excludingPatterns": " (esclusi i modelli {0} )", + "executedCommand": "Eseguito: {0}", + "failedToParseBashToolData": "Impossibile analizzare i dati dello strumento Bash", + "failedToParseEditToolData": "Impossibile analizzare i dati dello strumento Edit", + "failedToParseGlobToolData": "Impossibile analizzare i dati dello strumento Glob", + "failedToParseGrepToolData": "Impossibile analizzare i dati dello strumento Grep", + "failedToParseLSToolData": "Impossibile analizzare i dati dello strumento LS", + "failedToParseMultiEditToolData": "Impossibile analizzare i dati dello strumento MultiEdit", + "failedToParseReadToolData": "Impossibile analizzare i dati dello strumento Read", + "failedToParseTodoListData": "Impossibile analizzare i dati dell'elenco delle cose da fare", + "failedToParseWebFetchToolData": "Impossibile analizzare i dati dello strumento WebFetch", + "failedToParseWriteToolData": "Impossibile analizzare i dati dello strumento Write", + "fetching": "Recupero", + "fileFilter": "Filtro file", + "filePath": "Percorso del file", + "fileType": "Tipo di file", + "findMatchingFiles": "Trova i file che corrispondono al pattern glob \"{0}\" nella directory corrente", + "findMatchingFilesWithPath": "Trova i file che corrispondono al pattern glob \"{0}\" all'interno di {1}", + "finding": "Trovare", + "from": "Da", + "globPattern": "modello globale", + "grepOptions": { + "caseInsensitive": "senza distinzione tra maiuscole e minuscole", + "glob": "globo: {0}", + "headLimit": "limite: {0}", + "lineNumbers": "numeri di linea", + "linesAfter": "+{0} dopo", + "linesBefore": "+{0} prima", + "linesContext": "±{0} contesto", + "multiLine": "multilinea", + "type": "tipo: {0}" + }, + "grepOutputModes": { + "content": "content", + "count": "conteggio", + "filesWithMatches": "file con corrispondenze" + }, + "ignoredPatterns": "Modelli ignorati", + "ignoringPatterns": "Ignorare i modelli di {0} ", + "initCommand": { + "description": "Inizializzare il progetto con la guida CLAUDE.md" + }, + "itemCount": "{0} articoli", + "lineLimit": "Limite di linea", + "lines": "Linee", + "listDirectoryContents": "Elenco dei contenuti della directory", + "listing": "Elenco", + "memoryCommand": { + "description": "Modifica del file di memoria CLAUDE.md" + }, + "multiEditing": "Multi-editing", + "oneEdit": "1 edit", + "oneItem": "1 articolo", + "oneOption": "1 opzione", + "openDirectoryTooltip": "Fare clic per aprire la directory", + "openFileTooltip": "Fare clic per aprire il file nell'editor", + "optionsCount": "{0} opzioni", + "partial": "Parziale", + "pattern": "Pattern", + "plan": "Modalità pianificazione", + "project": "progetto", + "projectRoot": "radice del progetto", + "readMode": "Modalità di lettura", + "reading": "Lettura", + "replaceAllCount": "{0} sostituisci tutto", + "replaceAllOccurrences": "Sostituire tutte le occorrenze", + "resumeCommand": { + "description": "Resume a session" + }, + "reviewCommand": { + "description": "Richiesta di revisione del codice" + }, + "searchPath": "Percorso di ricerca", + "searching": "Ricerca", + "startingLine": "Linea di partenza", + "timeout": "Timeout", + "timeoutInMs": "Timeout: {0}ms", + "to": "A", + "todoList": "Elenco delle cose da fare", + "todoPriority": { + "high": "alto", + "low": "basso", + "medium": "medio" + }, + "toolApprovalRequest": "Claude Code vuole utilizzare lo strumento \"{0}\". Volete permetterlo?", + "totalEdits": "Totale modifiche", + "webFetch": "Recupero del web", + "writing": "Scrittura" + }, + "code-completion": { + "progressText": "Calcolo del completamento del codice AI..." + }, + "codex": { + "agentDescription": "Assistente di programmazione di OpenAI basato su Codex", + "completedCount": "{0}/{1} completato", + "exitCode": "Codice di uscita: {0}", + "fileChangeFailed": "Codex non è riuscito ad applicare le modifiche per: {0}", + "fileChangeFailedGeneric": "Codex non è riuscito ad applicare le modifiche al file.", + "itemCount": "{0} articoli", + "noItems": "Nessun articolo", + "oneItem": "1 articolo", + "running": "In esecuzione...", + "searched": "Cercato", + "searching": "Ricerca", + "todoList": "Lista delle cose da fare", + "webSearch": "Ricerca web" + }, + "completion": { + "agent": { + "description": "Questo agente fornisce il completamento del codice in linea nell'editor di codice dell'IDE Theia.", + "vars": { + "file": { + "description": "L'URI del file da modificare" + }, + "language": { + "description": "L'ID lingua del file da modificare" + }, + "prefix": { + "description": "Il codice prima della posizione corrente del cursore" + }, + "suffix": { + "description": "Il codice dopo la posizione corrente del cursore" + } + } + }, + "automaticEnable": { + "description": "Attivare automaticamente i completamenti dell'IA in linea con qualsiasi editor (Monaco) durante la modifica. \n In alternativa, è possibile attivare manualmente il codice tramite il comando \"Attiva suggerimento in linea\" o la scorciatoia predefinita \"Ctrl+Alt+Spazio\"." + }, + "cacheCapacity": { + "description": "Numero massimo di completamenti di codice da memorizzare nella cache. Un numero più alto può migliorare le prestazioni, ma consuma più memoria. Il valore minimo è 10, l'intervallo consigliato è compreso tra 50-200.", + "title": "Capacità della cache di completamento del codice" + }, + "debounceDelay": { + "description": "Controlla il ritardo in millisecondi prima di attivare il completamento dell'IA dopo che le modifiche sono state rilevate nell'editor. Richiede che sia abilitato il `Completamento automatico del codice`. Immettere 0 per disabilitare il ritardo di rimbalzo.", + "title": "Ritardo di rimbalzo" + }, + "excludedFileExts": { + "description": "Specificare le estensioni dei file (ad esempio, .md, .txt) in cui il completamento dell'AI deve essere disabilitato.", + "title": "Estensioni di file escluse" + }, + "fileVariable": { + "description": "L'URI del file da modificare. Disponibile solo in un contesto di completamento del codice." + }, + "languageVariable": { + "description": "L'ID lingua del file in corso di modifica. Disponibile solo in un contesto di completamento del codice." + }, + "maxContextLines": { + "description": "Il numero massimo di righe utilizzate come contesto, distribuite tra le righe precedenti e successive alla posizione del cursore (prefisso e suffisso). Impostare questo valore a -1 per utilizzare l'intero file come contesto senza alcun limite di righe e a 0 per utilizzare solo la riga corrente.", + "title": "Linee di contesto massime" + }, + "prefixVariable": { + "description": "Il codice prima della posizione corrente del cursore. Disponibile solo nel contesto di completamento del codice." + }, + "stripBackticks": { + "description": "Rimuove i backtick circostanti dal codice restituito da alcuni LLM. Se viene rilevato un backtick, viene eliminato anche tutto il contenuto dopo il backtick di chiusura. Questa impostazione contribuisce a garantire la restituzione di codice semplice quando i modelli linguistici utilizzano una formattazione simile a quella dei segni.", + "title": "Eliminare i backtick dai completamenti in linea" + }, + "suffixVariable": { + "description": "Il codice dopo la posizione corrente del cursore. Disponibile solo nel contesto di completamento del codice." + } + }, + "configuration": { + "selectItem": "Seleziona un elemento." + }, + "copilot": { + "auth": { + "aiConfiguration": "Configurazione AI", + "authorize": "Ho autorizzato", + "copied": "Copiato!", + "copyCode": "Copia codice", + "expired": "Autorizzazione scaduta o negata. Riprova.", + "hint": "Dopo aver inserito il codice e aver autorizzato, clicca su \"Ho autorizzato\" qui sotto.", + "initiating": "Avvio dell'autenticazione...", + "instructions": "Per autorizzare Theia a utilizzare GitHub Copilot, visita l'URL sottostante e inserisci il codice:", + "openGitHub": "Apri GitHub", + "success": "Accesso a GitHub Copilot completato con successo!", + "successHint": "Se il tuo account GitHub ha accesso a Copilot, ora puoi configurare i modelli linguistici di Copilot nel ", + "title": "Accedi a GitHub Copilot", + "tos": "Effettuando l'accesso, accetti i ", + "tosLink": "Termini di servizio di GitHub", + "verifying": "Verifica dell'autorizzazione..." + }, + "category": "Copiloto", + "commands": { + "signIn": "Accedi a GitHub Copilot", + "signOut": "Esci da GitHub Copilot" + }, + "enterpriseUrl": { + "mdDescription": "Dominio GitHub Enterprise per l'API Copilot (ad esempio, `github.mycompany.com`). Lasciare vuoto per GitHub.com." + }, + "models": { + "description": "Modelli GitHub Copilot da utilizzare. I modelli disponibili dipendono dal tuo abbonamento Copilot." + }, + "statusBar": { + "signedIn": "Accedi a GitHub Copilot come {0}. Clicca per uscire.", + "signedOut": "Non hai effettuato l'accesso a GitHub Copilot. Clicca per accedere." + } + }, + "core": { + "agentConfiguration": { + "actions": "Azioni", + "addCustomAgent": "Aggiungere un agente personalizzato", + "enableAgent": "Abilitazione dell'agente", + "label": "Agenti", + "llmRequirements": "Requisiti LLM", + "notUsedInPrompt": "Non utilizzato nel prompt", + "promptTemplates": "Modelli di prompt", + "selectAgentMessage": "Selezionare prima un agente!", + "templateName": "Modello", + "undeclared": "Non dichiarato", + "usedAgentSpecificVariables": "Variabili specifiche dell'agente utilizzate", + "usedFunctions": "Funzioni utilizzate", + "usedGlobalVariables": "Variabili globali utilizzate", + "variant": "Variante" + }, + "agentsVariable": { + "description": "Restituisce l'elenco degli agenti disponibili nel sistema." + }, + "aiConfiguration": { + "label": "✨ Configurazione AI [Alpha]" + }, + "blinkTitle": { + "agentCompleted": "Theia - Agente completato", + "namedAgentCompleted": "Theia - Agente \"{0}\" Completato" + }, + "changeSetSummaryVariable": { + "description": "Fornisce un riepilogo dei file di un set di modifiche e del loro contenuto." + }, + "contextDetailsVariable": { + "description": "Fornisce valori e descrizioni di testo completo per tutti gli elementi del contesto." + }, + "contextSummaryVariable": { + "description": "Descrive i file nel contesto di una determinata sessione." + }, + "customAgentTemplate": { + "description": "Questo è un esempio di agente. Si prega di adattare le proprietà alle proprie esigenze." + }, + "defaultModelAliases": { + "code": { + "description": "Ottimizzato per le attività di comprensione e generazione del codice." + }, + "code-completion": { + "description": "Ideale per gli scenari di completamento automatico del codice." + }, + "summarize": { + "description": "Modelli prioritari per la sintesi e la condensazione dei contenuti." + }, + "universal": { + "description": "Ben bilanciato sia per il codice che per l'uso generale del linguaggio." + } + }, + "defaultNotification": { + "mdDescription": "Il metodo di notifica predefinito utilizzato quando un agente AI completa un'attività. I singoli agenti possono sovrascrivere questa impostazione.\n - `os-notification`: Mostra le notifiche del sistema operativo/di sistema\n - `messaggio`: Mostra le notifiche nella barra di stato/area dei messaggi.\n - `blink`: Fa lampeggiare o evidenziare l'interfaccia utente\n - `off`: Disattiva tutte le notifiche", + "title": "Tipo di notifica predefinito" + }, + "discard": { + "label": "Modello di prompt AI di scarto" + }, + "discardCustomPrompt": { + "tooltip": "Scartare le personalizzazioni" + }, + "fileVariable": { + "description": "Risolve il contenuto di un file", + "uri": { + "description": "L'URI del file richiesto." + } + }, + "languageModelRenderer": { + "alias": "[alias] {0}", + "languageModel": "Modello linguistico", + "purpose": "Scopo" + }, + "maxRetries": { + "mdDescription": "Il numero massimo di tentativi quando una richiesta a un provider AI fallisce. Un valore pari a 0 significa che non ci sono tentativi.", + "title": "Numero massimo di tentativi" + }, + "modelAliasesConfiguration": { + "agents": "Agenti che utilizzano questo alias", + "defaultList": "[Elenco predefinito]", + "evaluatesTo": "Valuta a", + "label": "Alias del modello", + "modelNotReadyTooltip": "Non pronto", + "modelReadyTooltip": "Pronto", + "noAgents": "Nessun agente utilizza questo alias.", + "noModelReadyTooltip": "Nessun modello pronto", + "noResolvedModel": "Nessun modello pronto per questo alias.", + "priorityList": "Elenco delle priorità", + "selectAlias": "Selezionare un alias di modello.", + "selectedModelId": "Modello selezionato", + "unavailableModel": "Il modello selezionato non è più disponibile" + }, + "noVariableFoundForOpenRequest": "Nessuna variabile trovata per la richiesta aperta.", + "openEditorsShortVariable": { + "description": "Breve riferimento a tutti i file attualmente aperti (percorsi relativi, separati da virgole)" + }, + "openEditorsVariable": { + "description": "Un elenco separato da virgole di tutti i file attualmente aperti, relativi alla radice dell'area di lavoro." + }, + "preference": { + "languageModelAliases": { + "description": "Configurare i modelli per ogni alias del modello di lingua nella [AI Configuration View]({0}). In alternativa, è possibile impostare manualmente le impostazioni nel file settings.json: \n```\n\"default/code\": {\n \"selectedModel\": \"anthropic/claude-opus-4-20250514\"\n}\n```", + "selectedModel": "Il modello selezionato dall'utente per questo alias.", + "title": "Alias del modello linguistico" + } + }, + "prefs": { + "title": "✨ Caratteristiche AI [Alpha]" + }, + "promptFragmentsConfiguration": { + "activeCustomizationTitle": "Personalizzazione attiva", + "createCustomizationTitle": "Creare la personalizzazione", + "customization": "personalizzazione", + "customizationLabel": "Personalizzazione", + "defaultVariantTitle": "Variante predefinita", + "deleteCustomizationTitle": "Eliminare la personalizzazione", + "editTemplateTitle": "Modifica del modello", + "headerTitle": "Frammenti di promemoria", + "label": "Frammenti di promemoria", + "noFragmentsAvailable": "Non sono disponibili frammenti di prompt.", + "otherPromptFragmentsHeader": "Altri frammenti di prompt", + "promptTemplateText": "Testo del modello di prompt", + "promptVariantsHeader": "Set di varianti del prompt", + "removeCustomizationDialogMsg": "Si è sicuri di voler rimuovere la personalizzazione {0} per il frammento di prompt \"{1}\"?", + "removeCustomizationDialogTitle": "Rimuovere la personalizzazione", + "removeCustomizationWithDescDialogMsg": "Si è sicuri di voler rimuovere la personalizzazione {0} per il frammento di prompt \"{1}\" ({2})?", + "resetAllButton": "Azzeramento di tutti", + "resetAllCustomizationsDialogMsg": "Si è sicuri di voler ripristinare tutti i frammenti del prompt alle loro versioni integrate? Questo rimuoverà tutte le personalizzazioni.", + "resetAllCustomizationsDialogTitle": "Reimpostare tutte le personalizzazioni", + "resetAllCustomizationsTitle": "Reimpostare tutte le personalizzazioni", + "resetAllPromptFragments": "Azzeramento di tutti i frammenti di prompt", + "resetToBuiltInDialogMsg": "Si è sicuri di voler ripristinare il frammento di prompt \"{0}\" alla sua versione integrata? Questo rimuoverà tutte le personalizzazioni.", + "resetToBuiltInDialogTitle": "Ripristino dell'impostazione di base", + "resetToBuiltInTitle": "Ripristino di questo built-in", + "resetToCustomizationDialogMsg": "Si è sicuri di voler reimpostare il frammento di prompt \"{0}\" per utilizzare la personalizzazione {1}? Questo rimuoverà tutte le personalizzazioni di priorità superiore.", + "resetToCustomizationDialogTitle": "Ripristino della personalizzazione", + "resetToCustomizationTitle": "Ripristino di questa personalizzazione", + "selectedVariantLabel": "Selezionato", + "selectedVariantTitle": "Variante selezionata", + "usedByAgentTitle": "Utilizzato dall'agente: {0}", + "variantSetError": "La variante selezionata non esiste e non è stato possibile trovare un default. Controllare la configurazione.", + "variantSetWarning": "La variante selezionata non esiste. Al suo posto viene utilizzata la variante predefinita.", + "variantsOfSystemPrompt": "Varianti di questo set di varianti di prompt:" + }, + "promptTemplates": { + "description": "Cartella per la memorizzazione dei modelli di prompt personalizzati. Se non sono personalizzati, viene utilizzata la cartella di configurazione dell'utente. Si consiglia di utilizzare una cartella sottoposta a controllo di versione per gestire le varianti dei modelli di prompt.", + "openLabel": "Selezionare la cartella" + }, + "promptVariable": { + "argDescription": "L'id del modello di prompt da risolvere", + "completions": { + "detail": { + "builtin": "Frammento di prompt incorporato", + "custom": "Frammento di prompt personalizzato" + } + }, + "description": "Risolve i modelli di prompt attraverso il servizio di prompt" + }, + "prompts": { + "category": "Modelli di prompt AI di Theia" + }, + "requestSettings": { + "clientSettings": { + "description": "Impostazioni del client per la gestione dei messaggi inviati all'llm.", + "keepThinking": { + "description": "Se impostato su false, tutti i risultati del pensiero saranno filtrati prima di inviare la richiesta successiva dell'utente in una conversazione a più giri." + }, + "keepToolCalls": { + "description": "Se impostato su false, tutte le richieste e le risposte degli strumenti verranno filtrate prima di inviare la richiesta successiva dell'utente in una conversazione multigiro." + } + }, + "mdDescription": "Consente di specificare le impostazioni di richiesta personalizzate per più modelli.\n Ogni oggetto rappresenta la configurazione per un modello specifico. Il campo `modelId` specifica l'ID del modello, `requestSettings` definisce le impostazioni specifiche del modello.\n Il campo `providerId` è opzionale e consente di applicare le impostazioni a un fornitore specifico. Se non è impostato, le impostazioni saranno applicate a tutti i provider.\n Esempi di providerId: huggingface, openai, ollama, llamafile.\n Per ulteriori informazioni, consultare [la nostra documentazione](https://theia-ide.org/docs/user_ai/#custom-request-settings).", + "modelSpecificSettings": { + "description": "Impostazioni per l'ID modello specifico." + }, + "scope": { + "agentId": { + "description": "L'id dell'agente (opzionale) a cui applicare le impostazioni." + }, + "modelId": { + "description": "L'id del modello (opzionale)" + }, + "providerId": { + "description": "L'id (opzionale) del provider a cui applicare le impostazioni." + } + }, + "title": "Impostazioni di richiesta personalizzate" + }, + "skillsVariable": { + "description": "Restituisce l'elenco delle competenze disponibili che possono essere utilizzate dagli agenti AI." + }, + "taskContextSummary": { + "description": "Risolve tutti gli elementi del contesto dell'attività presenti nel contesto della sessione." + }, + "templateSettings": { + "edited": "modificato", + "unavailableVariant": "La variante selezionata non è più disponibile" + }, + "todayVariable": { + "description": "Fa qualcosa per oggi", + "format": { + "description": "Il formato della data" + } + }, + "unableToDisplayVariableValue": "Impossibile visualizzare il valore della variabile.", + "unableToResolveVariable": "Impossibile risolvere la variabile.", + "variable-contribution": { + "builtInVariable": "Variabile incorporata Theia", + "currentAbsoluteFilePath": "Il percorso assoluto del file attualmente aperto. Si noti che la maggior parte degli agenti si aspetta un percorso relativo del file (relativo all'area di lavoro corrente).", + "currentFileContent": "Il contenuto semplice del file attualmente aperto. Questo esclude le informazioni sulla provenienza del contenuto. Si noti che la maggior parte degli agenti funziona meglio con un percorso di file relativo (relativo all'area di lavoro corrente).", + "currentRelativeDirPath": "Il percorso relativo della directory contenente il file attualmente aperto.", + "currentRelativeFilePath": "Il percorso relativo del file attualmente aperto.", + "currentSelectedText": "Il testo normale attualmente selezionato nel file aperto. Questo esclude le informazioni sulla provenienza del contenuto. Si noti che la maggior parte degli agenti funziona meglio con un percorso di file relativo (relativo all'area di lavoro corrente).", + "dotRelativePath": "Breve riferimento al percorso relativo del file attualmente aperto ('currentRelativeFilePath')." + } + }, + "editor": { + "editorContextVariable": { + "description": "Risolve le informazioni di contesto specifiche dell'editor", + "label": "EditorContext" + }, + "explainWithAI": { + "prompt": "Spiega questo errore", + "title": "Spiegare con l'intelligenza artificiale" + }, + "fixWithAI": { + "prompt": "Aiuto per risolvere questo errore" + } + }, + "google": { + "apiKey": { + "description": "Inserire la chiave API del proprio account ufficiale Google AI (Gemini). **Nota bene:** Utilizzando questa preferenza, la chiave API di GOOGLE AI sarà memorizzata in chiaro sulla macchina che esegue Theia. Utilizzare la variabile d'ambiente `GOOGLE_API_KEY` per impostare la chiave in modo sicuro." + }, + "maxRetriesOnErrors": { + "description": "Numero massimo di tentativi in caso di errori. Se minore di 1, la logica di ripetizione è disabilitata." + }, + "models": { + "description": "Modelli ufficiali di Google Gemini da utilizzare" + }, + "retryDelayOnOtherErrors": { + "description": "Ritardo in secondi tra i tentativi in caso di altri errori (a volte Google GenAI segnala errori come la sintassi JSON incompleta restituita dal modello o 500 Internal Server Error). Impostando questo valore a -1 si evitano i tentativi in questi casi. Altrimenti, il tentativo avviene immediatamente (se impostato a 0) o dopo questo ritardo in secondi (se impostato a un numero positivo)." + }, + "retryDelayOnRateLimitError": { + "description": "Ritardo in secondi tra i tentativi in caso di errori del limite di velocità. Vedere https://ai.google.dev/gemini-api/docs/rate-limits" + } + }, + "history": { + "clear": { + "tooltip": "Cancella la cronologia di tutti gli agenti" + }, + "exchange-card": { + "agentId": "Agente", + "timestamp": "Avviato" + }, + "open-history-tooltip": "Aprire la storia dell'AI...", + "request-card": { + "agent": "Agente", + "model": "Modello", + "request": "Richiesta", + "response": "Risposta", + "timestamp": "Timestamp", + "title": "Richiesta" + }, + "sortChronologically": { + "tooltip": "Ordinamento cronologico" + }, + "sortReverseChronologically": { + "tooltip": "Ordinamento cronologico inverso" + }, + "toggleCompact": { + "tooltip": "Mostra vista compatta" + }, + "toggleHideNewlines": { + "tooltip": "Smettere di interpretare i newline" + }, + "toggleRaw": { + "tooltip": "Mostra la vista grezza" + }, + "toggleRenderNewlines": { + "tooltip": "Interpretare le newline" + }, + "view": { + "label": "✨ Storia dell'agente AI [Alpha]", + "noAgent": "Nessun agente disponibile.", + "noAgentSelected": "Nessun agente selezionato.", + "noHistoryForAgent": "Non è disponibile alcuna cronologia per l'agente selezionato '{0}'" + } + }, + "huggingFace": { + "apiKey": { + "mdDescription": "Inserire una chiave API per il proprio account Hugging Face. **Nota bene:** Utilizzando questa preferenza, la chiave API di Hugging Face sarà memorizzata in chiaro sul computer che esegue Theia. Utilizzare la variabile d'ambiente `HUGGINGFACE_API_KEY` per impostare la chiave in modo sicuro." + }, + "models": { + "mdDescription": "Modelli Hugging Face da utilizzare. **Nota bene:** attualmente sono supportati solo i modelli che supportano l'API di completamento della chat (modelli ottimizzati per le istruzioni come `*-Instruct`). Alcuni modelli potrebbero richiedere l'accettazione dei termini di licenza sul sito web di Hugging Face." + } + }, + "ide": { + "agent-description": "Configurare le impostazioni dell'agente AI, tra cui l'abilitazione, la selezione dell'LLM, la personalizzazione del modello di prompt e la creazione dell'agente personalizzato nella [AI Configuration View] ({0}).", + "agentConfiguration": { + "customAgentLocationQuickPick": { + "createNewFile": "Creare un nuovo file", + "openExistingFile": "Aprire un file esistente", + "placeholder": "Scegliere dove creare o aprire un file agenti personalizzato", + "title": "Selezionare la posizione del file degli agenti personalizzati" + }, + "noDescription": "Nessuna descrizione disponibile" + }, + "app-tester": { + "errorCheckingDevToolsServerStatus": "Errore durante il controllo dello stato del server DevTools MCP: {0}", + "errorCheckingPlaywrightServerStatus": "Errore nella verifica dello stato del server MCP di Playwright: {0}", + "startChromeDevToolsMcpServers": { + "canceled": "Configurare il server MCP di Chrome DevTools.", + "error": "Impossibile avviare il server MCP di Chrome DevTools: {0}", + "progress": "Avvio del server MCP di Chrome DevTools.", + "question": "Il server Chrome DevTools MCP non è in esecuzione. Vuoi avviarlo adesso? Questa operazione potrebbe installare il server Chrome DevTools MCP." + }, + "startMcpServers": { + "no": "No, annulla", + "yes": "Sì, avvia i server." + }, + "startPlaywrightServers": { + "canceled": "Configurare i server MCP.", + "error": "Impossibile avviare il server MCP di Playwright: {0}", + "progress": "Avvio dei server MCP di Playwright.", + "question": "I server MCP di Playwright non sono in funzione. Si desidera avviarli ora? Questa operazione potrebbe installare i server Playwright MCP." + } + }, + "architectAgent": { + "mode": { + "default": "Modalità predefinita", + "plan": "Piano Moda", + "simple": "Modalità semplice" + }, + "suggestion": { + "executePlanWithCoder": "Esegui \"{0}\" con Coder", + "summarizeSessionAsTaskForCoder": "Riassumere questa sessione come compito per il Coder", + "updateTaskContext": "Aggiornare il contesto dell'attività corrente" + } + }, + "bypassHint": "Alcuni agenti come Claude Code non richiedono i modelli linguistici Theia.", + "chatDisabledMessage": { + "featuresTitle": "Visualizzazioni e funzionalità attualmente supportate:" + }, + "coderAgent": { + "mode": { + "agentNext": "Modalità agente (Avanti)", + "edit": "Modalità di modifica" + }, + "suggestion": { + "fixProblems": { + "content": "[Correggere i problemi]({0}) nel file corrente.", + "prompt": "Si prega di esaminare il sito {1} e di risolvere eventuali problemi." + }, + "startNewChat": "Mantenete le chat brevi e mirate. [Avviare una nuova chat]({0}) per un nuovo compito o [avviare una nuova chat con un riassunto di questa]({1})." + } + }, + "commandAgent": { + "commandCallback": { + "confirmAction": "Capito", + "label": "Comando AI" + }, + "response": { + "customHandler": "Provate a eseguire questa operazione:", + "noCommand": "Spiacente, non riesco a trovare un comando di questo tipo", + "theiaCommand": "Ho trovato questo comando che potrebbe aiutarvi:" + }, + "vars": { + "commandIds": { + "description": "L'elenco dei comandi disponibili in Theia." + } + } + }, + "configureAgent": { + "header": "Configurare un agente predefinito" + }, + "continueAnyway": "Continua comunque", + "createSkillAgent": { + "mode": { + "edit": "Modalità predefinita" + } + }, + "enableAI": { + "mdDescription": "❗ Questa impostazione consente di accedere alle funzionalità AI più recenti (versione Beta). \n Si noti che queste funzionalità sono in fase beta, il che significa che possono subire modifiche e saranno ulteriormente migliorate. È importante sapere che queste funzioni possono generare richieste continue ai modelli linguistici (LLM) a cui si fornisce accesso. Ciò potrebbe comportare costi che è necessario monitorare attentamente. Abilitando questa opzione, si riconoscono questi rischi. \n **Si prega di notare! Le impostazioni riportate di seguito in questa sezione avranno effetto solo\n una volta attivata l'impostazione della funzione principale. Dopo aver abilitato la funzione, è necessario configurare almeno un provider LLM. Vedere anche [la documentazione] (https://theia-ide.org/docs/user_ai/)**." + }, + "github": { + "configureGitHubServer": { + "canceled": "Configurazione del server GitHub annullata. Configurare il server MCP GitHub per utilizzare questo agente.", + "no": "No, annullare", + "yes": "Yes, configure GitHub server" + }, + "errorCheckingGitHubServerStatus": "Errore nella verifica dello stato del server MCP di GitHub: {0}", + "startGitHubServer": { + "canceled": "Avviare il server MCP GitHub per utilizzare questo agente.", + "error": "Impossibile avviare il server MCP di GitHub: {0}", + "no": "No, annullare", + "progress": "Avvio del server MCP di GitHub.", + "question": "Il server MCP GitHub è configurato ma non è in esecuzione. Volete avviarlo ora?", + "yes": "Sì, avviare il server" + } + }, + "githubRepoName": { + "description": "Il nome del repository GitHub corrente (ad esempio, \"eclipse-theia/theia\")." + }, + "model-selection-description": "Scegliere quali modelli linguistici di grandi dimensioni (LLM) sono utilizzati da ciascun agente AI nella [AI Configuration View]({0}).", + "moreAgentsAvailable": { + "header": "Sono disponibili altri agenti" + }, + "noRecommendedAgents": "Non sono disponibili agenti raccomandati.", + "openSettings": "Apri le impostazioni AI", + "or": "o", + "orchestrator": { + "error": { + "noAgents": "Nessun agente di chat disponibile per gestire la richiesta. Controllare se la configurazione è abilitata." + }, + "progressMessage": "Determinazione dell'agente più appropriato", + "response": { + "delegatingToAgent": "Delegare a `@{0}`" + } + }, + "prompt-template-description": "Selezionare le varianti di richiesta e personalizzare i modelli di richiesta per gli agenti AI nella [Vista di configurazione AI]({0}).", + "recommendedAgents": "Agenti raccomandati:", + "skillsConfiguration": { + "label": "Competenze", + "location": { + "label": "Posizione" + } + }, + "toolsConfiguration": { + "confirmAlwaysAllow": { + "confirm": "Capisco, abilita l'approvazione automatica", + "title": "Abilitare l'approvazione automatica per \"{0}\"?" + }, + "confirmationMode": { + "label": "Modalità di conferma" + }, + "default": { + "label": "Modalità di conferma dello strumento predefinita:" + }, + "resetAll": "Azzeramento di tutti", + "resetAllConfirmDialog": { + "msg": "Siete sicuri di voler ripristinare tutte le modalità di conferma degli strumenti alle impostazioni predefinite? Questo rimuoverà tutte le impostazioni personalizzate.", + "title": "Azzeramento di tutte le modalità di conferma dello strumento" + }, + "resetAllTooltip": "Ripristinare tutti gli strumenti alle impostazioni predefinite", + "toolOptions": { + "confirm": { + "label": "Confermare" + } + } + }, + "variableConfiguration": { + "selectVariable": "Selezionare una variabile.", + "usedByAgents": "Utilizzato dagli agenti", + "variableArgs": "Argomenti delle variabili" + } + }, + "llamaFile": { + "prefs": { + "mdDescription": "Questa impostazione consente di configurare e gestire i modelli LlamaFile in Theia IDE. \n Ogni voce richiede un `nome` facile da usare, il file `uri` che punta al LlamaFile e la `porta` su cui verrà eseguito. \n Per avviare un LlamaFile, utilizzare il comando \"Start LlamaFile\", che consente di selezionare il modello desiderato. \n Se si modifica una voce (ad esempio, si cambia la porta), l'istanza in esecuzione si interrompe e sarà necessario riavviarla manualmente. \n [Per saperne di più sulla configurazione e la gestione di LlamaFiles, consultare la documentazione di Theia IDE](https://theia-ide.org/docs/user_ai/#llamafile-models).", + "name": { + "description": "Il nome del modello da usare per questo file Llamafile." + }, + "port": { + "description": "La porta da utilizzare per avviare il server." + }, + "title": "✨ AI LlamaFile", + "uri": { + "description": "Il file uri del file Llamafile." + } + }, + "start": "Avviare Llamafile", + "stop": "Fermare Llamafile" + }, + "llamafile": { + "error": { + "noConfigured": "Nessun Llamafiles configurato.", + "noRunning": "Nessun Llamafiles in esecuzione.", + "startFailed": "Qualcosa è andato storto durante l'avvio di llamafile: {0}.\nPer ulteriori informazioni, consultare la console.", + "stopFailed": "Qualcosa è andato storto durante l'arresto di llamafile: {0}.\nPer ulteriori informazioni, consultare la console." + } + }, + "mcp": { + "error": { + "allServersRunning": "Tutti i server MCP sono già in funzione.", + "noRunningServers": "Nessun server MCP in funzione.", + "noServersConfigured": "Nessun server MCP configurato.", + "startFailed": "Si è verificato un errore durante l'avvio del server MCP." + }, + "info": { + "serverStarted": "Il server MCP \"{0}\" è stato avviato con successo. Strumenti registrati: {1}" + }, + "servers": { + "args": { + "mdDescription": "Un array di argomenti da passare al comando.", + "title": "Argomenti per il comando" + }, + "autostart": { + "mdDescription": "Avvia automaticamente questo server all'avvio del frontend. I nuovi server aggiunti non sono immediatamente avviati automaticamente, ma al riavvio", + "title": "Avvio automatico" + }, + "command": { + "mdDescription": "Il comando utilizzato per avviare il server MCP, ad esempio \"uvx\" o \"npx\".", + "title": "Comando per l'esecuzione del server MCP" + }, + "env": { + "mdDescription": "Variabili d'ambiente opzionali da impostare per il server, come ad esempio una chiave API.", + "title": "Variabili d'ambiente" + }, + "headers": { + "mdDescription": "Intestazioni aggiuntive facoltative incluse in ogni richiesta al server.", + "title": "Intestazioni" + }, + "mdDescription": "Configurare i server MCP con comandi, argomenti, variabili d'ambiente opzionali e avvio automatico (vero per impostazione predefinita). Ogni server è identificato da una chiave unica, come \"brave-search\" o \"filesystem\". Per avviare un server, utilizzare il comando \"MCP: Start MCP Server\", che consente di selezionare il server desiderato. Per arrestare un server, utilizzare il comando \"MCP: Stop MCP Server\". Si noti che l'avvio automatico avrà effetto solo dopo un riavvio; per la prima volta è necessario avviare un server manualmente.\nEsempio di configurazione:\n```{\n \"brave-search\": {\n \"comando\": \"npx\",\n \"args\": [\n \"-y\",\n \"@modelcontextprotocol/server-brave-search\"\n ],\n \"env\": {\n \"BRAVE_API_KEY\": \"YOUR_API_KEY\"\n },\n },\n \"filesystem\": {\n \"comando\": \"npx\",\n \"args\": [\"-y\", \"@modelcontextprotocol/server-filesystem\", \"/Users/YOUR_USERNAME/Desktop\"],\n \"env\": {\n \"CUSTOM_ENV_VAR\": \"custom-value\"\n },\n \"autostart\": false\n }\n}\n```", + "serverAuthToken": { + "mdDescription": "Il token di autenticazione per il server, se richiesto. Viene utilizzato per autenticarsi con il server remoto.", + "title": "Gettone di autenticazione" + }, + "serverAuthTokenHeader": { + "mdDescription": "Il nome dell'intestazione da utilizzare per il token di autenticazione del server. Se non viene fornito, verrà utilizzato \"Authorization\" con \"Bearer\".", + "title": "Nome dell'intestazione di autenticazione" + }, + "serverUrl": { + "mdDescription": "L'URL del server MCP remoto. Se fornito, il server si connetterà a questo URL invece di avviare un processo locale.", + "title": "URL del server" + }, + "title": "Configurazione dei server MCP" + }, + "start": { + "label": "MCP: Avviare il server MCP" + }, + "stop": { + "label": "MCP: Arresto del server MCP" + } + }, + "mcpConfiguration": { + "arguments": "Argomenti: ", + "autostart": "Avvio automatico: ", + "connectServer": "Connettiti", + "connectingServer": "Connessione in corso...", + "copiedAllList": "Copia di tutti gli strumenti negli appunti (elenco di tutti gli strumenti)", + "copiedAllSingle": "Copia di tutti gli strumenti negli appunti (singolo frammento di prompt con tutti gli strumenti)", + "copiedForPromptTemplate": "Copia di tutti gli strumenti negli appunti per il modello di prompt (singolo frammento di prompt con tutti gli strumenti)", + "copyAllList": "Copia tutto (elenco di tutti gli strumenti)", + "copyAllSingle": "Copia tutto per la chat (singolo frammento di prompt con tutti gli strumenti)", + "copyForPrompt": "Strumento di copia (per la chat o il modello di prompt)", + "copyForPromptTemplate": "Copia tutto per il modello di prompt (singolo frammento di prompt con tutti gli strumenti)", + "environmentVariables": "Variabili d'ambiente: ", + "headers": "Intestazioni: ", + "noServers": "Nessun server MCP configurato", + "serverAuthToken": "Token di autenticazione: ", + "serverAuthTokenHeader": "Nome dell'intestazione di autenticazione: ", + "serverUrl": "URL del server: ", + "tools": "Strumenti: " + }, + "openai": { + "apiKey": { + "mdDescription": "Inserire la chiave API del proprio account ufficiale OpenAI. **Nota: ** Usando questa preferenza, la chiave API di Open AI sarà memorizzata in chiaro sulla macchina che esegue Theia. Utilizzare la variabile d'ambiente `OPENAI_API_KEY` per impostare la chiave in modo sicuro." + }, + "customEndpoints": { + "apiKey": { + "title": "O la chiave per accedere all'API servita all'url dato o `true` per usare la chiave API globale di OpenAI." + }, + "apiVersion": { + "title": "La versione per accedere all'API servita all'url dato in Azure o `true` per usare la versione globale dell'API OpenAI." + }, + "deployment": { + "title": "Il nome dell'installazione client per accedere all'API servita all'URL indicato in Azure." + }, + "developerMessageSettings": { + "title": "Controlla la gestione dei messaggi di sistema: `user`, `system` e `developer` saranno usati come ruolo, `mergeWithFollowingUserMessage` anteporrà al messaggio utente successivo il messaggio di sistema o convertirà il messaggio di sistema in messaggio utente se il messaggio successivo non è un messaggio utente. `skip` rimuoverà semplicemente il messaggio di sistema), con impostazione predefinita su `developer`." + }, + "enableStreaming": { + "title": "Indica se deve essere utilizzata l'API di streaming. `true` per impostazione predefinita." + }, + "id": { + "title": "Un identificatore univoco che viene utilizzato nell'interfaccia utente per identificare il modello personalizzato." + }, + "mdDescription": "Integrare modelli personalizzati compatibili con l'API OpenAI, ad esempio tramite `vllm`. Gli attributi richiesti sono `model` e `url`. \n Opzionalmente, è possibile \n - specificare un `id` univoco per identificare il modello personalizzato nell'interfaccia utente. Se non viene specificato, `model` sarà usato come `id`. \n - fornire una `apiKey` per accedere all'API servita all'URL indicato. Usare `true` per indicare l'uso della chiave API globale di OpenAI. \n - fornire una `apiVersion` per accedere all'API servita all'url dato in Azure. Usare `true` per indicare l'uso della versione globale dell'API OpenAI. \n - impostare `developerMessageSettings` a uno dei seguenti valori: `user`, `system`, `developer`, `mergeWithFollowingUserMessage` o `skip` per controllare il modo in cui il messaggio dello sviluppatore viene incluso (dove `user`, `system` e `developer` saranno usati come ruolo, `mergeWithFollowingUserMessage` anteporrà al messaggio dell'utente successivo il messaggio di sistema o convertirà il messaggio di sistema in messaggio dell'utente se il messaggio successivo non è un messaggio dell'utente. `skip` rimuoverà semplicemente il messaggio di sistema). Predefinito a `developer`. \n - specificare `supportsStructuredOutput: false` per indicare che l'output strutturato non sarà usato. \n - specificare `enableStreaming: false` per indicare che lo streaming non deve essere usato. \n Per ulteriori informazioni, consultare [la nostra documentazione](https://theia-ide.org/docs/user_ai/#openai-compatible-models-eg-via-vllm).", + "modelId": { + "title": "Modello ID" + }, + "supportsStructuredOutput": { + "title": "Indica se il modello supporta l'output strutturato. È un valore predefinito, `true`." + }, + "url": { + "title": "L'endpoint compatibile con Open AI API in cui è ospitato il modello" + } + }, + "models": { + "description": "Modelli ufficiali OpenAI da utilizzare" + }, + "useResponseApi": { + "mdDescription": "Utilizzare la nuova API di risposta OpenAI invece dell'API di completamento della chat per i modelli OpenAI ufficiali. Questa impostazione si applica solo ai modelli OpenAI ufficiali; i provider personalizzati devono configurarla individualmente." + } + }, + "promptTemplates": { + "directories": { + "title": "Directory di modelli di prompt specifici per lo spazio di lavoro" + }, + "extensions": { + "description": "Elenco di estensioni di file aggiuntive nelle posizioni di prompt che sono considerate come modelli di prompt. '.prompttemplate' è sempre considerato come predefinito.", + "title": "Estensioni di file aggiuntive per i modelli di prompt" + }, + "files": { + "title": "File modello di prompt specifici per lo spazio di lavoro" + } + }, + "scanoss": { + "changeSet": { + "clean": "Nessuna corrispondenza", + "error": "Errore: Ripetere l'operazione", + "error-notification": "Errore ScanOSS riscontrato: {0}.", + "match": "Visualizza le corrispondenze", + "scan": "Scansione", + "scanning": "Scansione..." + }, + "mode": { + "automatic": { + "description": "Abilita la scansione automatica degli snippet di codice nelle viste di chat." + }, + "description": "Configurare la funzione SCANOSS per l'analisi dei frammenti di codice nelle viste di chat. Questo invia un hash dei frammenti di codice suggeriti al servizio SCANOSS ospitato dalla [Software Transparency foundation]() per l'analisi.\nospitato dalla [Software Transparency foundation](https://www.softwaretransparency.org/osskb) per l'analisi.", + "manual": { + "description": "L'utente può attivare manualmente la scansione facendo clic sulla voce SCANOSS nella vista chat." + }, + "off": { + "description": "La funzione è completamente disattivata." + } + }, + "snippet": { + "dialog-header": "Risultati ScanOSS", + "errored": "SCANOSS - Errore - {0}", + "file-name-heading": "Corrispondenza trovata in {0}", + "in-progress": "SCANOSS - Esecuzione della scansione...", + "match-count": "Trovate {0} corrispondenze", + "matched": "SCANOSS - Trovata corrispondenza con {0} ", + "no-match": "SCANOSS - Nessuna corrispondenza", + "summary": "Sintesi" + } + }, + "session-settings-dialog": { + "title": "Impostare le impostazioni della sessione", + "tooltip": "Impostare le impostazioni della sessione" + }, + "terminal": { + "agent": { + "description": "Questo agente fornisce assistenza per la scrittura e l'esecuzione di comandi arbitrari da terminale. In base alla richiesta dell'utente, suggerisce i comandi e consente all'utente di incollarli ed eseguirli direttamente nel terminale. Accede alla directory corrente, all'ambiente e all'output recente della sessione del terminale per fornire un'assistenza consapevole del contesto.", + "vars": { + "cwd": { + "description": "La directory di lavoro corrente." + }, + "recentTerminalContents": { + "description": "Le ultime 0-50 righe recenti visibili nel terminale." + }, + "shell": { + "description": "La shell utilizzata, ad esempio /usr/bin/zsh." + }, + "userRequest": { + "description": "La domanda o la richiesta dell'utente." + } + } + }, + "askAi": "Chiedi all'intelligenza artificiale", + "askTerminalCommand": "Chiedere di un comando da terminale...", + "hitEnterConfirm": "Premete invio per confermare", + "howCanIHelp": "Come posso aiutarvi?", + "loading": "Caricamento", + "tryAgain": "Riprova...", + "useArrowsAlternatives": " o utilizzare ⇅ per mostrare le alternative..." + }, + "tokenUsage": { + "cachedInputTokens": "Gettoni di ingresso scritti nella cache", + "cachedInputTokensTooltip": "Tracciato in aggiunta a \"Gettoni di ingresso\". Di solito è più costoso dei token non memorizzati nella cache.", + "failedToGetTokenUsageData": "Impossibile recuperare i dati di utilizzo del token: {0}", + "inputTokens": "Gettoni di ingresso", + "label": "Uso del gettone", + "lastUsed": "Ultimo usato", + "model": "Modello", + "noData": "Non sono ancora disponibili dati sull'utilizzo dei token.", + "note": "L'utilizzo del token viene monitorato dall'avvio dell'applicazione e non viene conservato.", + "outputTokens": "Gettoni di uscita", + "readCachedInputTokens": "Gettoni di ingresso letti dalla cache", + "readCachedInputTokensTooltip": "Tracciato in aggiunta a 'Input Token'. Di solito è molto meno costoso che non essere memorizzato nella cache. Di solito non conta per i limiti di velocità.", + "total": "Totale", + "totalTokens": "Totale gettoni", + "totalTokensTooltip": "'Gettoni di ingresso' + 'Gettoni di uscita'" + }, + "vercelai": { + "anthropicApiKey": { + "mdDescription": "Inserire una chiave API per i modelli antropici. **Nota bene:** Utilizzando questa preferenza, la chiave API sarà memorizzata in chiaro sulla macchina che esegue Theia. Utilizzare la variabile d'ambiente `ANTHROPIC_API_KEY` per impostare la chiave in modo sicuro." + }, + "customEndpoints": { + "apiKey": { + "title": "O la chiave per accedere all'API servita all'url dato o `true` per usare la chiave API globale." + }, + "enableStreaming": { + "title": "Indica se deve essere utilizzata l'API di streaming. `true` per impostazione predefinita." + }, + "id": { + "title": "Un identificatore univoco che viene utilizzato nell'interfaccia utente per identificare il modello personalizzato." + }, + "mdDescription": "Integrare modelli personalizzati compatibili con l'SDK Vercel AI. Gli attributi richiesti sono `model` e `url`. \n Opzionalmente, è possibile \n - specificare un `id` univoco per identificare il modello personalizzato nell'interfaccia utente. Se non viene indicato `modello` verrà usato come `id`. \n - fornire una `apiKey` per accedere all'API servita all'URL indicato. Usare `true` per indicare l'uso della chiave API globale. \n - specificare `supportsStructuredOutput: false` per indicare che l'output strutturato non sarà usato. \n - specificare `enableStreaming: false` per indicare che lo streaming non deve essere usato. \n - specificare `provider` per indicare da quale fornitore proviene il modello (openai, anthropic).", + "modelId": { + "title": "Modello ID" + }, + "supportsStructuredOutput": { + "title": "Indica se il modello supporta l'output strutturato. È un valore predefinito, `true`." + }, + "url": { + "title": "L'endpoint dell'API in cui è ospitato il modello" + } + }, + "models": { + "description": "Modelli ufficiali da utilizzare con Vercel AI SDK", + "id": { + "title": "Modello ID" + }, + "model": { + "title": "Nome del modello" + } + }, + "openaiApiKey": { + "mdDescription": "Inserire una chiave API per i modelli OpenAI. **Nota bene:** Utilizzando questa preferenza, la chiave API sarà memorizzata in chiaro sulla macchina che esegue Theia. Utilizzare la variabile d'ambiente `OPENAI_API_KEY` per impostare la chiave in modo sicuro." + } + }, + "workspace": { + "coderAgent": { + "description": "Un assistente AI integrato in Theia IDE, progettato per assistere gli sviluppatori di software. Questo agente può accedere allo spazio di lavoro dell'utente, può ottenere un elenco di tutti i file e le cartelle disponibili e recuperarne il contenuto. Inoltre, può suggerire all'utente modifiche ai file. Può quindi assistere l'utente nelle attività di codifica o in altre attività che comportano la modifica dei file." + }, + "considerGitignore": { + "description": "Se abilitato, esclude i file/cartelle specificati in un file .gitignore globale (la posizione prevista è la radice dell'area di lavoro).", + "title": "Considerate .gitignore" + }, + "excludedPattern": { + "description": "Elenco di modelli (glob o regex) per i file/cartelle da escludere.", + "title": "Modelli di file esclusi" + }, + "searchMaxResults": { + "description": "Numero massimo di risultati della ricerca restituiti dalla funzione di ricerca dell'area di lavoro.", + "title": "Risultati massimi della ricerca" + }, + "workspaceAgent": { + "description": "Un assistente AI integrato in Theia IDE, progettato per assistere gli sviluppatori di software. Questo agente può accedere allo spazio di lavoro dell'utente, può ottenere un elenco di tutti i file e le cartelle disponibili e recuperarne il contenuto. Non può modificare i file. Può quindi rispondere a domande sul progetto corrente, sui file del progetto e sul codice sorgente nell'area di lavoro, come ad esempio come costruire il progetto, dove mettere il codice sorgente, dove trovare codice o configurazioni specifiche, ecc." + } + } + }, + "ai-chat": { + "fileChangeSetTitle": "Modifiche proposte" + }, + "ai-chat-ui": { + "initiate-session-task-context": "Contesto dell'attività: Avvio della sessione", + "open-current-session-summary": "Sintesi della sessione corrente aperta", + "open-settings-tooltip": "Aprire le impostazioni AI...", + "scroll-lock": "Blocca scorrimento", + "scroll-unlock": "Sbloccare la pergamena", + "session-settings": "Impostare le impostazioni della sessione", + "showChats": "Mostra chat...", + "summarize-current-session": "Riassumere la sessione in corso" + }, + "ai-claude-code": { + "open-config": "Configurazione del codice Claude aperto", + "open-memory": "Aprire la memoria del codice Claude (CLAUDE.MD)" + }, + "ai-core": { + "agentCompletionMessage": "L'agente \"{0}\" ha completato il suo compito.", + "agentCompletionTitle": "Agente \"{0}\" Attività completata", + "agentCompletionWithTask": "L'agente \"{0}\" ha completato il compito: {1}" + }, + "ai-editor": { + "contextMenu": "Chiedi all'intelligenza artificiale", + "sendToChat": "Invia a AI Chat" + }, + "ai-ide": { + "addressGhReviewCommand": { + "argumentHint": "", + "description": "Rispondere ai commenti di revisione su una richiesta pull GitHub" + }, + "fixGhTicketCommand": { + "argumentHint": "", + "description": "Analizzare un ticket GitHub e implementare la soluzione" + }, + "open-agent-settings-tooltip": "Aprire le impostazioni dell'agente...", + "rememberCommand": { + "argumentHint": "[suggerimento argomento]", + "description": "Estrai argomenti dalla conversazione e aggiorna le informazioni sul progetto" + }, + "ticketCommand": { + "argumentHint": "", + "description": "Analizzare un ticket GitHub e creare un piano di implementazione" + }, + "todoTool": { + "noTasks": "Nessun compito" + }, + "withAppTesterCommand": { + "description": "Delega i test all'agente AppTester (richiede la modalità agente)" + } + }, + "ai-mcp": { + "blockedServersLabel": "Server MCP (avvio automatico bloccato)" + }, + "ai-terminal": { + "cancelExecution": "Annulla esecuzione comando", + "canceling": "Annullamento...", + "confirmExecution": "Conferma comando Shell", + "denialReason": "Motivo", + "executionCanceled": "Annullato", + "executionDenied": "Negato", + "executionDeniedWithReason": "Rifiutato con motivazione", + "noOutput": "Nessun output", + "partialOutput": "Output parziale", + "timeout": "Timeout", + "workingDirectory": "Directory di lavoro" + }, + "callhierarchy": { + "noCallers": "Non sono stati rilevati chiamanti.", + "open": "Gerarchia delle chiamate aperte" + }, + "chat": { + "taskContextVariable": { + "args": { + "contextId": { + "description": "L'ID del contesto dell'attività da recuperare o di una sessione di chat da riassumere." + } + }, + "description": "Fornisce informazioni sul contesto di un'attività, ad esempio il piano per il completamento di un'attività o un riepilogo delle sessioni precedenti.", + "label": "Contesto del compito" + } + }, + "collaboration": { + "collaborate": "Collaborate", + "collaboration": "Collaborazione", + "collaborationWorkspace": "Spazio di lavoro per la collaborazione", + "connected": "Collegato", + "connectedSession": "Collegato a una sessione di collaborazione", + "copiedInvitation": "Codice invito copiato negli appunti.", + "copyAgain": "Copia di nuovo", + "createRoom": "Creare una nuova sessione di collaborazione", + "creatingRoom": "Creazione di una sessione", + "end": "Fine della sessione di collaborazione", + "endDetail": "Terminare la sessione, interrompere la condivisione dei contenuti e revocare l'accesso ad altri.", + "enterCode": "Inserire il codice della sessione di collaborazione", + "failedCreate": "Impossibile creare una stanza: {0}", + "failedJoin": "Impossibile unirsi alla stanza: {0}", + "fieldRequired": "Il campo {0} è obbligatorio. Accesso interrotto.", + "invite": "Invitare altri", + "inviteDetail": "Copiare il codice di invito per condividerlo con altri e partecipare alla sessione.", + "joinRoom": "Partecipa alla sessione di collaborazione", + "joiningRoom": "Sessione di adesione", + "leave": "Lasciare la sessione di collaborazione", + "leaveDetail": "Disconnettersi dalla sessione di collaborazione in corso e chiudere l'area di lavoro.", + "loginFailed": "Accesso fallito.", + "loginSuccessful": "Accesso riuscito.", + "noAuth": "Nessun metodo di autenticazione fornito dal server.", + "optional": "opzionale", + "selectAuth": "Selezionare il metodo di autenticazione", + "selectCollaboration": "Selezionare l'opzione di collaborazione", + "serverUrl": "URL del server", + "serverUrlDescription": "URL dell'istanza di Open Collaboration Tools Server per le sessioni di collaborazione in tempo reale.", + "sharedSession": "Condivisione di una sessione di collaborazione", + "startSession": "Avviare o partecipare a una sessione di collaborazione", + "userWantsToJoin": "L'utente '{0}' vuole unirsi alla sala di collaborazione", + "whatToDo": "Cosa le piacerebbe fare con altri collaboratori?" + }, + "core": { + "about": { + "compatibility": "{0} Compatibilità", + "defaultApi": "API predefinita {0} ", + "listOfExtensions": "Elenco delle estensioni" + }, + "common": { + "closeAll": "Chiudi tutte le schede", + "closeAllTabMain": "Chiudere tutte le schede nell'area principale", + "closeOtherTabMain": "Chiudere altre schede nell'area principale", + "closeOthers": "Chiudi altre schede", + "closeRight": "Chiudere le schede a destra", + "closeTab": "Chiudi scheda", + "closeTabMain": "Chiudi scheda nell'area principale", + "collapseAllTabs": "Comprimere tutti i pannelli laterali", + "collapseBottomPanel": "Pannello inferiore a ginocchiera", + "collapseLeftPanel": "Alterna il pannello sinistro", + "collapseRightPanel": "Alterna il pannello destro", + "collapseTab": "Pannello laterale a scomparsa", + "showNextTabGroup": "Passa al gruppo di schede successivo", + "showNextTabInGroup": "Passa alla scheda successiva del gruppo", + "showPreviousTabGroup": "Passa al gruppo di schede precedente", + "showPreviousTabInGroup": "Passa alla scheda precedente nel gruppo", + "toggleMaximized": "Toggle Massimizzato" + }, + "copyInfo": "Aprire un file per copiare il suo percorso", + "copyWarn": "Utilizzare il comando di copia o la scorciatoia del browser.", + "cutWarn": "Utilizzare il comando di taglio o la scorciatoia del browser.", + "enhancedPreview": { + "classic": "Visualizza una semplice anteprima della scheda con le informazioni di base.", + "enhanced": "Visualizza un'anteprima migliorata della scheda con informazioni aggiuntive.", + "visual": "Visualizza un'anteprima visiva della scheda." + }, + "file": { + "browse": "Sfogliare" + }, + "highlightModifiedTabs": "Controlla se un bordo superiore è disegnato sulle schede dell'editor modificate (sporche) o no.", + "keybinding": { + "duplicateModifierError": "Impossibile analizzare il keybinding {0} Modificatori duplicati", + "metaError": "Impossibile analizzare il keybinding {0} meta è solo per OSX", + "unrecognizedKeyError": "Chiave non riconosciuta {0} in {1}" + }, + "keybindingStatus": "{0} è stato premuto, in attesa di altri tasti", + "keyboard": { + "choose": "Scegliere il layout della tastiera", + "chooseLayout": "Scegliere un layout di tastiera", + "current": "(corrente: {0})", + "currentLayout": " - layout attuale", + "mac": "Tastiere Mac", + "pc": "Tastiere per PC", + "tryDetect": "Prova a rilevare il layout della tastiera dalle informazioni del browser e dai tasti premuti." + }, + "navigator": { + "clipboardWarn": "L'accesso agli appunti è negato. Controllare i permessi del browser.", + "clipboardWarnFirefox": "L'API Appunti non è disponibile. È possibile abilitarla tramite la preferenza '{0}' nella pagina '{1}'. Quindi ricaricare Theia. Ciò consentirà a FireFox di avere pieno accesso agli appunti di sistema." + }, + "offline": "Non in linea", + "pasteWarn": "Utilizzare il comando incolla o la scorciatoia del browser.", + "quitMessage": "Qualsiasi modifica non salvata non sarà salvata.", + "resetWorkbenchLayout": "Ripristinare il layout del banco di lavoro", + "searchbox": { + "close": "Chiudere (Fuga)", + "next": "Avanti (Giù)", + "previous": "Precedente (Up)", + "showAll": "Mostra tutti gli articoli", + "showOnlyMatching": "Mostra solo gli articoli corrispondenti" + }, + "secondaryWindow": { + "alwaysOnTop": "Quando è attivata, la finestra secondaria rimane al di sopra di tutte le altre finestre, comprese quelle di applicazioni diverse.", + "description": "Imposta la posizione e le dimensioni iniziali della finestra secondaria estratta.", + "fullSize": "La posizione e le dimensioni del widget estratto saranno le stesse dell'applicazione Theia in esecuzione.", + "halfWidth": "La posizione e le dimensioni del widget estratto saranno pari alla metà della larghezza dell'applicazione Theia in esecuzione.", + "originalSize": "La posizione e le dimensioni del widget estratto saranno uguali a quelle del widget originale." + }, + "severity": { + "log": "Log" + }, + "silentNotifications": "Controlla se sopprimere i popup di notifica.", + "tabDefaultSize": "Specifica la dimensione predefinita delle schede.", + "tabMaximize": "Controlla se massimizzare le schede al doppio clic.", + "tabMinimumSize": "Specifica la dimensione minima delle schede.", + "tabShrinkToFit": "Restringere le schede per adattarle allo spazio disponibile.", + "window": { + "tabCloseIconPlacement": { + "description": "Posizionare le icone di chiusura sui titoli delle schede all'inizio o alla fine della scheda. L'impostazione predefinita è la fine su tutte le piattaforme.", + "end": "Posizionare l'icona di chiusura alla fine dell'etichetta. Nelle lingue da sinistra a destra, questa è la parte destra della scheda.", + "start": "Posizionare l'icona di chiusura all'inizio dell'etichetta. Nelle lingue da sinistra a destra, questo è il lato sinistro della scheda." + } + }, + "window.menuBarVisibility": "Il menu viene visualizzato come un pulsante compatto nella barra laterale. Questo valore viene ignorato quando{0} è {1}." + }, + "debug": { + "TheiaIDE": "Theia IDE", + "addConfigurationPlaceholder": "Selezionare lo spazio di lavoro principale a cui aggiungere la configurazione", + "breakpoint": "punto di interruzione", + "cannotRunToThisLocation": "Impossibile eseguire il thread corrente nella posizione specificata.", + "compound-cycle": "La configurazione di lancio '{0}' contiene un ciclo con se stessa", + "conditionalBreakpoint": "Punto di interruzione condizionale", + "conditionalBreakpointsNotSupported": "Punti di interruzione condizionati non supportati da questo tipo di debug.", + "confirmRunToShiftedPosition_msg": "La posizione di destinazione sarà spostata su Ln {0}, Col {1}. Eseguire comunque?", + "confirmRunToShiftedPosition_title": "Impossibile eseguire il thread corrente esattamente nella posizione specificata", + "consoleFilter": "Filtro (ad es. testo, !escludi)", + "consoleFilterAriaLabel": "Filtra l'output della console di debug", + "consoleSessionSelectorTooltip": "Passa da una sessione di debug all'altra. Ogni sessione di debug ha il proprio output della console.", + "consoleSeverityTooltip": "Filtra l'output della console in base al livello di gravità. Verranno visualizzati solo i messaggi con il livello di gravità selezionato.", + "continueAll": "Continua tutto", + "copyExpressionValue": "Copiare il valore dell'espressione", + "couldNotRunTask": "Impossibile eseguire l'attività '{0}'.", + "dataBreakpoint": "breakpoint dati", + "debugConfiguration": "Configurazione di debug", + "debugSessionInitializationFailed": "L'inizializzazione della sessione di debug non è riuscita. Vedere la console per i dettagli.", + "debugSessionTypeNotSupported": "Il tipo di sessione di debug \"{0}\" non è supportato.", + "debugToolbarMenu": "Menu della barra degli strumenti Debug", + "debugVariableInput": "Impostare il valore {0} ", + "disableSelectedBreakpoints": "Disattivare i breakpoint selezionati", + "disabledBreakpoint": "Disabili {0}", + "enableSelectedBreakpoints": "Abilitazione dei breakpoint selezionati", + "entry": "ingresso", + "errorStartingDebugSession": "Si è verificato un errore nell'avvio della sessione di debug; controllare i log per maggiori dettagli.", + "exception": "eccezione", + "functionBreakpoint": "punto di interruzione della funzione", + "goto": "goto", + "htiConditionalBreakpointsNotSupported": "Colpire i breakpoint condizionali non supportati da questo tipo di debug", + "instruction-breakpoint": "Istruzione Punto di interruzione", + "instructionBreakpoint": "punto di interruzione dell'istruzione", + "logpointsNotSupported": "Punti di log non supportati da questo tipo di debug", + "missingConfiguration": "La configurazione dinamica '{0}:{1}' è mancante o non applicabile", + "pause": "pausa", + "pauseAll": "Pausa Tutto", + "reveal": "Rivela", + "step": "passo", + "taskTerminatedBySignal": "Task '{0}' terminato dal segnale {1}.", + "taskTerminatedForUnknownReason": "L'attività '{0}' è terminata per un motivo sconosciuto.", + "taskTerminatedWithExitCode": "Il task '{0}' è terminato con il codice di uscita {1}.", + "threads": "Threads", + "toggleTracing": "Abilita/disabilita il tracciamento delle comunicazioni con gli adattatori di debug", + "unknownSession": "Sessione sconosciuta", + "unverifiedBreakpoint": "Non verificato {0}" + }, + "editor": { + "diffEditor.wordWrap2": "Le righe andranno a capo secondo l'impostazione `#editor.wordWrap#`.", + "dirtyEncoding": "Il file è sporco. Salvarlo prima di riaprirlo con un'altra codifica.", + "editor.bracketPairColorization.enabled": "Controlla se la colorazione delle coppie di parentesi è abilitata o meno. Usare `#workbench.colorCustomizations#` per sovrascrivere i colori di evidenziazione delle parentesi.", + "editor.codeActions.triggerOnFocusChange": "Abilita l'attivazione di `#editor.codeActionsOnSave#` quando `#files.autoSave#` è impostato su `afterDelay`. Le azioni del codice devono essere impostate su `sempre` per essere attivate al cambio di finestra e di focus.", + "editor.detectIndentation": "Controlla se `#editor.tabSize#` e `#editor.insertSpaces#` saranno rilevati automaticamente all'apertura di un file, in base al suo contenuto.", + "editor.experimental.preferTreeSitter": "Controlla se l'analisi tree sitter deve essere attivata per lingue specifiche. Questo avrà la precedenza su `editor.experimental.treeSitterTelemetry` per le lingue specificate.", + "editor.inlayHints.enabled1": "I suggerimenti per l'intarsio sono visualizzati per impostazione predefinita e si nascondono quando si tiene premuto `Ctrl+Alt`.", + "editor.inlayHints.enabled2": "I suggerimenti per l'intarsio sono nascosti per impostazione predefinita e vengono visualizzati quando si tiene premuto `Ctrl+Alt`.", + "editor.inlayHints.fontFamily": "Controlla la famiglia di caratteri dei suggerimenti di inlay nell'editor. Se impostato a vuoto, viene utilizzata la `#editor.fontFamily#`.", + "editor.inlayHints.fontSize": "Controlla la dimensione dei caratteri dei suggerimenti inlay nell'editor. Come impostazione predefinita, viene utilizzato `#editor.fontSize#` quando il valore configurato è inferiore a `5` o superiore alla dimensione dei caratteri dell'editor.", + "editor.inlineSuggest.edits.experimental.enabled": "Controlla se abilitare le modifiche sperimentali nei suggerimenti in linea.", + "editor.inlineSuggest.edits.experimental.onlyShowWhenCloseToCursor": "Controlla se mostrare i suggerimenti in linea solo quando il cursore è vicino al suggerimento.", + "editor.inlineSuggest.edits.experimental.useInterleavedLinesDiff": "Controlla se abilitare la diffusione sperimentale delle righe interlacciate nei suggerimenti in linea.", + "editor.inlineSuggest.edits.experimental.useMixedLinesDiff": "Controlla se abilitare le modifiche sperimentali nei suggerimenti in linea.", + "editor.insertSpaces": "Inserisce spazi quando si preme `Tab`. Questa impostazione viene sovrascritta in base al contenuto del file quando `#editor.detectIndentation#` è attivo.", + "editor.quickSuggestions": "Controlla se i suggerimenti devono essere visualizzati automaticamente durante la digitazione. Questo può essere controllato per la digitazione di commenti, stringhe e altro codice. Il suggerimento rapido può essere configurato per essere visualizzato come testo fantasma o con il widget Suggerimento. Si tenga presente anche l'impostazione '#editor.suggestOnTriggerCharacters#', che controlla se i suggerimenti vengono attivati da caratteri speciali.", + "editor.suggestFontSize": "Dimensione del carattere per il widget Suggerimento. Se impostato a `0`, viene utilizzato il valore di `#editor.fontSize#`.", + "editor.suggestLineHeight": "Altezza della riga per il widget di suggerimento. Se impostato a `0`, viene utilizzato il valore di `#editor.lineHeight#`. Il valore minimo è 8.", + "editor.tabSize": "Il numero di spazi a cui corrisponde una tabulazione. Questa impostazione viene sovrascritta in base al contenuto del file quando `#editor.detectIndentation#` è attivo.", + "formatOnSaveTimeout": "Timeout in millisecondi dopo il quale la formattazione che viene eseguita al salvataggio del file viene annullata.", + "persistClosedEditors": "Controlla se persistere la cronologia dell'editor chiuso per l'area di lavoro attraverso i ricarichi della finestra.", + "showAllEditors": "Mostra tutti gli editor aperti", + "splitHorizontal": "Dividere l'editor orizzontale", + "splitVertical": "Dividere l'editor verticale", + "toggleStickyScroll": "Alternanza scorrimento permanente" + }, + "external-terminal": { + "cwd": "Selezionare la directory di lavoro corrente per il nuovo terminale esterno" + }, + "file-search": { + "toggleIgnoredFiles": " (Premere {0} per mostrare/nascondere i file ignorati)" + }, + "fileDialog": { + "showHidden": "Mostra i file nascosti" + }, + "fileSystem": { + "fileResource": { + "overWriteBody": "Vuoi sovrascrivere le modifiche fatte a '{0}' sul file system?" + } + }, + "filesystem": { + "copiedToClipboard": "Ho copiato il link per il download negli appunti.", + "copyDownloadLink": "Copiare il link per il download", + "dialog": { + "initialLocation": "Vai alla posizione iniziale", + "multipleItemMessage": "È possibile selezionare solo una voce", + "navigateBack": "Navigare indietro", + "navigateForward": "Navigare in avanti", + "navigateUp": "Navigare su una directory" + }, + "fileResource": { + "binaryFileQuery": "Aprirlo potrebbe richiedere del tempo e potrebbe rendere l'IDE non reattivo. Vuoi comunque aprire '{0}'?", + "binaryTitle": "Il file è binario o usa una codifica di testo non supportata.", + "largeFileTitle": "Il file è troppo grande ({0}).", + "overwriteTitle": "Il file '{0}' è stato cambiato nel file system." + }, + "filesExclude": "Configura modelli globali per escludere file e cartelle. Per esempio, l'esploratore di file decide quali file e cartelle mostrare o nascondere in base a questa impostazione.", + "format": "Formato:", + "maxConcurrentUploads": "Numero massimo di file contemporanei da caricare quando si caricano più file. 0 significa che tutti i file saranno caricati simultaneamente.", + "maxFileSizeMB": "Controlla la dimensione massima del file in MB che è possibile aprire.", + "prepareDownload": "Preparazione del download...", + "prepareDownloadLink": "Preparazione del link per il download...", + "processedOutOf": "Elaborato {0} su {1}", + "replaceTitle": "Sostituire il file", + "uploadFailed": "Si è verificato un errore durante il caricamento di un file. {0}", + "uploadFiles": "Carica i file...", + "uploadedOutOf": "Caricato {0} su {1}" + }, + "getting-started": { + "ai": { + "header": "Il supporto AI nell'IDE Theia è disponibile (versione beta)!", + "openAIChatView": "Apri subito la finestra della chat AI per scoprire come iniziare!" + }, + "apiComparator": "{0} Compatibilità API", + "newExtension": "Costruire una nuova estensione", + "newPlugin": "Costruire un nuovo plugin", + "startup-editor": { + "welcomePage": "Aprire la pagina di benvenuto, con contenuti che aiutano a iniziare a usare {0} e le estensioni." + }, + "telemetry": "Utilizzo dei dati e telemetria" + }, + "git": { + "aFewSecondsAgo": "pochi secondi fa", + "addSignedOff": "Aggiungi Firmato-da", + "added": "Aggiunto", + "amendReuseMessage": "Per riutilizzare l'ultimo messaggio di commit, premi 'Enter' o 'Escape' per annullare.", + "amendRewrite": "Riscrivere il messaggio di commit precedente. Premi 'Enter' per confermare o 'Escape' per annullare.", + "checkoutCreateLocalBranchWithName": "Crea un nuovo ramo locale con nome: {0}. Premi 'Enter' per confermare o 'Escape' per annullare.", + "checkoutProvideBranchName": "Si prega di fornire il nome di una filiale.", + "checkoutSelectRef": "Seleziona un riferimento per il checkout o crea un nuovo ramo locale:", + "cloneQuickInputLabel": "Si prega di fornire una posizione del repository Git. Premi 'Enter' per confermare o 'Escape' per annullare.", + "cloneRepository": "Clona il repository Git: {0}. Premi 'Enter' per confermare o 'Escape' per annullare.", + "compareWith": "Confronta con...", + "compareWithBranchOrTag": "Scegli un ramo o un tag da confrontare con il ramo attualmente attivo {0}:", + "conflicted": "Conflitto", + "copied": "Copiato", + "diff": "Diff", + "dirtyDiffLinesLimit": "Non mostrare decorazioni diff sporche, se il numero di linee dell'editor supera questo limite.", + "dropStashMessage": "Stash rimosso con successo.", + "editorDecorationsEnabled": "Mostra le decorazioni git nell'editor.", + "fetchPickRemote": "Scegliere un telecomando da cui prelevare:", + "gitDecorationsColors": "Usa la decorazione a colori nel navigatore.", + "mergeEditor": { + "currentSideTitle": "Attuale", + "incomingSideTitle": "In arrivo" + }, + "mergeQuickPickPlaceholder": "Scegli un ramo da unire al ramo attualmente attivo {0}:", + "missingUserInfo": "Assicurati di configurare il tuo 'user.name' e 'user.email' in git.", + "noHistoryForError": "Non è disponibile uno storico per {0}", + "noPreviousCommit": "Nessun impegno precedente da modificare", + "noRepositoriesSelected": "Nessun deposito è stato selezionato.", + "prepositionIn": "in", + "renamed": "Rinominato", + "repositoryNotInitialized": "Il deposito {0} non è ancora inizializzato.", + "stashChanges": "Modifiche alla scorta. Premi 'Enter' per confermare o 'Escape' per annullare.", + "stashChangesWithMessage": "Stash cambia con il messaggio: {0}. Premi 'Enter' per confermare o 'Escape' per annullare.", + "tabTitleIndex": "{0} (indice)", + "tabTitleWorkingTree": "{0} (Albero di lavoro)", + "toggleBlameAnnotations": "Allineare le annotazioni di colpa", + "unstaged": "Non in scena" + }, + "keybinding-schema-updater": { + "deprecation": "Usa invece la clausola `when`." + }, + "keymaps": { + "addKeybindingTitle": "Aggiungere il binding dei tasti per {0}", + "editKeybinding": "Modifica il Keybinding...", + "editKeybindingTitle": "Modificare il binding dei tasti per {0}", + "editWhenExpression": "Modifica Quando l'espressione...", + "editWhenExpressionTitle": "Modifica quando l'espressione per {0}", + "keybinding": { + "copy": "Copiare la legatura dei tasti", + "copyCommandId": "Copia dell'ID del comando di associazione dei tasti", + "copyCommandTitle": "Copia del collegamento a tasti Titolo del comando", + "edit": "Modifica il Keybinding...", + "editWhenExpression": "Modifica del Keybinding quando l'espressione..." + }, + "keybindingCollidesValidation": "il keybinding attualmente collima", + "requiredKeybindingValidation": "Il valore del keybinding è necessario", + "resetKeybindingConfirmation": "Si vuole davvero ripristinare il valore predefinito di questo keybinding?", + "resetKeybindingTitle": "Azzeramento del keybinding per {0}", + "resetMultipleKeybindingsWarning": "Se per questo comando esistono più collegamenti ai tasti, tutti verranno azzerati." + }, + "localize": { + "offlineTooltip": "Impossibile connettersi al backend." + }, + "markers": { + "clearAll": "Cancella tutto", + "noProblems": "Finora non sono stati rilevati problemi nell'area di lavoro.", + "tabbarDecorationsEnabled": "Mostra i decoratori di problemi (marcatori diagnostici) nelle barre delle schede." + }, + "memory-inspector": { + "addressTooltip": "Posizione di memoria da visualizzare, un indirizzo o un'espressione che valuta un indirizzo", + "ascii": "ASCII", + "binary": "Binario", + "byteSize": "Dimensione del byte", + "bytesPerGroup": "Byte per gruppo", + "closeSettings": "Chiudere le impostazioni", + "columns": "Colonne", + "command": { + "createNewMemory": "Creare un nuovo ispettore di memoria", + "createNewRegisterView": "Creare una nuova vista del registro", + "followPointer": "Seguire il puntatore", + "followPointerMemory": "Seguire il puntatore in Memory Inspector", + "resetValue": "Valore di reset", + "showRegister": "Mostra registro in Memory Inspector", + "viewVariable": "Mostra la variabile in Memory Inspector" + }, + "data": "Dati", + "decimal": "Decimale", + "diff": { + "label": "Diff: {0}" + }, + "diff-widget": { + "offset-label": "{0} Offset", + "offset-title": "Byte da cui spostare la memoria {0}" + }, + "editable": { + "apply": "Applicare le modifiche", + "clear": "Cambiamenti evidenti" + }, + "endianness": "Endianità", + "extraColumn": "Colonna extra", + "groupsPerRow": "Gruppi per fila", + "hexadecimal": "Esadecimale", + "length": "Lunghezza", + "lengthTooltip": "Numero di byte da recuperare, in formato decimale o esadecimale.", + "memory": { + "addressField": { + "memoryReadError": "Inserire un indirizzo o un'espressione nel campo Posizione." + }, + "freeze": "Congelamento della memoria", + "hideSettings": "Nascondere il pannello delle impostazioni", + "readError": { + "bounds": "I limiti di memoria sono stati superati, il risultato sarà troncato.", + "noContents": "Al momento non sono disponibili contenuti di memoria." + }, + "readLength": { + "memoryReadError": "Inserire una lunghezza (numero decimale o esadecimale) nel campo Lunghezza." + }, + "showSettings": "Mostra il pannello delle impostazioni", + "unfreeze": "Scongelare la vista della memoria", + "userError": "Si è verificato un errore nel recupero della memoria." + }, + "memoryCategory": "Ispettore di memoria", + "memoryInspector": "Ispettore di memoria", + "memoryTitle": "Memoria", + "octal": "Ottale", + "offset": "Offset", + "offsetTooltip": "Offset da aggiungere alla posizione di memoria corrente, durante la navigazione", + "provider": { + "localsError": "Impossibile leggere le variabili locali. Nessuna sessione di debug attiva.", + "readError": "Impossibile leggere la memoria. Nessuna sessione di debug attiva.", + "writeError": "Impossibile scrivere la memoria. Nessuna sessione di debug attiva." + }, + "register": "Registro", + "register-widget": { + "filter-placeholder": "Filtro (inizia con)" + }, + "registerReadError": "Si è verificato un errore nel recupero dei registri.", + "registers": "Registri", + "toggleComparisonWidgetVisibility": "Alterna la visibilità del widget di confronto", + "utils": { + "afterBytes": "È necessario caricare la memoria in entrambi i widget che si desidera confrontare. {0} non ha memoria caricata.", + "bytesMessage": "È necessario caricare la memoria in entrambi i widget che si desidera confrontare. {0} non ha memoria caricata." + } + }, + "messages": { + "notificationTimeout": "Le notifiche informative saranno nascoste dopo questo timeout.", + "toggleNotifications": "Alterna le notifiche" + }, + "mini-browser": { + "typeUrl": "Digitare un URL" + }, + "monaco": { + "noSymbolsMatching": "Nessun simbolo corrispondente", + "typeToSearchForSymbols": "Digitare per cercare i simboli" + }, + "navigator": { + "autoReveal": "Rivelazione auto", + "clipboardWarn": "L'accesso agli appunti è negato. Controllare i permessi del browser.", + "clipboardWarnFirefox": "L'API Appunti non è disponibile. È possibile abilitarla tramite la preferenza '{0}' nella pagina '{1}'. Quindi ricaricare Theia. Ciò consentirà a FireFox di avere pieno accesso agli appunti di sistema.", + "openWithSystemEditor": "Apri con Editor di sistema", + "refresh": "Aggiorna in Explorer", + "reveal": "Rivelare in Explorer", + "systemEditor": "Editor di sistema", + "toggleHiddenFiles": "Toggle Hidden Files" + }, + "output": { + "clearOutputChannel": "Cancella il canale di uscita...", + "closeOutputChannel": "Chiudere il canale di uscita...", + "hiddenChannels": "Canali nascosti", + "hideOutputChannel": "Nascondere il canale di uscita...", + "maxChannelHistory": "Il numero massimo di voci in un canale di uscita.", + "outputChannels": "Canali di uscita", + "showOutputChannel": "Mostra il canale di uscita..." + }, + "plugin": { + "blockNewTab": "Il browser ha impedito l'apertura di una nuova scheda" + }, + "plugin-dev": { + "alreadyRunning": "L'istanza ospitata è già in esecuzione.", + "debugInstance": "Istanza di debug", + "debugMode": "Usare inspect o inspect-brk per il debug di Node.js", + "debugPorts": { + "debugPort": "Porta da utilizzare per il debug Node.js di questo server" + }, + "devHost": "Sviluppo Host", + "failed": "Impossibile eseguire l'istanza del plugin ospitato: {0}", + "hostedPlugin": "Plugin ospitato", + "hostedPluginRunning": "Plugin ospitato: in esecuzione", + "hostedPluginStarting": "Plugin ospitato: inizio", + "hostedPluginStopped": "Plugin ospitato: fermato", + "hostedPluginWatching": "Plugin ospitato: Guardare", + "instanceTerminated": "{0} è stato terminato", + "launchOutFiles": "Array di schemi glob per localizzare i file JavaScript generati (`${pluginPath}` sarà sostituito dal percorso effettivo del plugin).", + "noValidPlugin": "La cartella specificata non contiene un plugin valido.", + "notRunning": "L'istanza ospitata non è in esecuzione.", + "pluginFolder": "La cartella dei plugin è impostata su: {0}", + "preventedNewTab": "Il tuo browser ha impedito l'apertura di una nuova scheda", + "restartInstance": "Riavviare l'istanza", + "running": "L'istanza ospitata è in esecuzione a:", + "selectPath": "Seleziona il percorso", + "startInstance": "Avviare l'istanza", + "starting": "Avvio del server di istanza ospitato ...", + "stopInstance": "Fermare l'istanza", + "unknownTerminated": "L'istanza è stata terminata", + "watchMode": "Eseguire il watcher sul plugin in sviluppo" + }, + "plugin-ext": { + "authentication-main": { + "loginTitle": "Accesso", + "signedOut": "Disconnessione completata con successo." + }, + "plugins": "Plugin", + "webviewTrace": "Controlla la tracciabilità della comunicazione con le webview.", + "webviewWarnIfUnsecure": "Avverte gli utenti che le webview sono attualmente distribuite in modo non sicuro." + }, + "preferences": { + "ai-features": "Caratteristiche dell'intelligenza artificiale", + "hostedPlugin": "Plugin in hosting", + "toolbar": "Barra degli strumenti" + }, + "preview": { + "openByDefault": "Aprire l'anteprima invece dell'editor per default." + }, + "property-view": { + "created": "Creato", + "directory": "Directory", + "lastModified": "Ultima modifica", + "location": "Posizione", + "noProperties": "Nessuna proprietà disponibile.", + "properties": "Proprietà", + "symbolicLink": "Collegamento simbolico" + }, + "remote": { + "dev-container": { + "connect": "Riaprire nel contenitore", + "noDevcontainerFiles": "Nessun file devcontainer.json trovato nell'area di lavoro. Assicurarsi di avere una cartella .devcontainer con un file devcontainer.json.", + "selectDevcontainer": "Selezionare un file devcontainer.json" + }, + "ssh": { + "connect": "Collegare la finestra corrente all'host...", + "connectToConfigHost": "Collegare la finestra corrente all'host nel file di configurazione...", + "enterHost": "Inserire il nome host SSH", + "enterUser": "Inserire il nome utente SSH", + "failure": "Impossibile aprire una connessione SSH con il remoto.", + "hostPlaceHolder": "Ad esempio, hello@example.com", + "needsHost": "Inserire un nome di host.", + "needsUser": "Inserire un nome utente.", + "userPlaceHolder": "Ad esempio, ciao" + }, + "sshNoConfigPath": "Non è stato trovato alcun percorso di configurazione SSH.", + "wsl": { + "connectToWsl": "Collegarsi a WSL", + "connectToWslUsingDistro": "Connettersi a WSL utilizzando...", + "noWslDistroFound": "Non sono state trovate distribuzioni WSL. Installare prima una distribuzione WSL.", + "reopenInWsl": "Riaprire la cartella in WSL", + "selectWSLDistro": "Selezionare una distribuzione WSL" + } + }, + "scm": { + "amend": "Modificare", + "amendHeadCommit": "TESTA Impegno", + "amendLastCommit": "Modificare l'ultimo commit", + "changeRepository": "Cambia Repository...", + "config.untrackedChanges": "Controlla il comportamento delle modifiche non tracciate.", + "config.untrackedChanges.hidden": "nascosto", + "config.untrackedChanges.mixed": "misto", + "config.untrackedChanges.separate": "separato", + "dirtyDiff": { + "close": "Chiudi Cambia vista Peek" + }, + "history": "Storia", + "mergeEditor": { + "resetConfirmationTitle": "Si vuole davvero ripristinare il risultato dell'unione in questo editor?" + }, + "noRepositoryFound": "Nessun repository trovato", + "unamend": "Unamend", + "unamendCommit": "Annullamento del commit" + }, + "search-in-workspace": { + "includeIgnoredFiles": "Includere file ignorati", + "noFolderSpecified": "Non hai aperto o specificato una cartella. Al momento vengono cercati solo i file aperti.", + "resultSubset": "Questo è solo un sottoinsieme di tutti i risultati. Usa un termine di ricerca più specifico per restringere la lista dei risultati.", + "searchOnEditorModification": "Cerca l'editor attivo quando viene modificato." + }, + "secondary-window": { + "extract-widget": "Sposta la vista nella finestra secondaria" + }, + "shell-area": { + "secondary": "Finestra secondaria" + }, + "task": { + "attachTask": "Allegare il compito...", + "circularReferenceDetected": "Riferimento circolare rilevato: {0} --> {1}", + "clearHistory": "Storia chiara", + "errorKillingTask": "Errore nell'eliminazione dell'attività '{0}': {1}", + "errorLaunchingTask": "Errore nel lancio dell'attività '{0}': {1}", + "invalidTaskConfigs": "Sono state trovate configurazioni di attività non valide. Aprire task.json e trovare i dettagli nella vista Problemi.", + "neverScanTaskOutput": "Non scansionare mai l'output dell'attività", + "noTaskToRun": "Non è stata trovata alcuna attività da eseguire. Configura attività...", + "noTasksFound": "Nessun compito trovato", + "notEnoughDataInDependsOn": "Le informazioni fornite nel \"dependsOn\" non sono sufficienti per abbinare il compito corretto!", + "schema": { + "commandOptions": { + "cwd": "La directory di lavoro corrente del programma o dello script eseguito. Se omesso, viene utilizzata la radice dell'area di lavoro corrente di Theia." + }, + "presentation": { + "panel": { + "dedicated": "Il terminale è dedicato a un compito specifico. Se quel compito viene eseguito di nuovo, il terminale viene riutilizzato. Tuttavia, l'output di un compito diverso viene presentato in un terminale diverso.", + "new": "Ogni esecuzione dell'attività utilizza un nuovo terminale pulito.", + "shared": "Il terminale è condiviso e l'output di altri task viene aggiunto allo stesso terminale." + }, + "showReuseMessage": "Controlla se mostrare il messaggio \"Il terminale sarà riutilizzato dalle attività\"." + }, + "problemMatcherObject": { + "owner": "Il proprietario del problema all'interno di Theia. Può essere omesso se viene specificata la base. Se viene omesso e la base non è specificata, il valore predefinito è \"esterno\"." + } + }, + "taskAlreadyRunningInTerminal": "L'attività è già in esecuzione nel terminale", + "taskExitedWithCode": "L'attività '{0}' è uscita con il codice {1}.", + "taskTerminalTitle": "Compito: {0}", + "taskTerminatedBySignal": "Il task '{0}' è stato terminato dal segnale {1}.", + "terminalWillBeReusedByTasks": "Il terminale verrà riutilizzato dai task." + }, + "terminal": { + "defaultProfile": "Il profilo predefinito utilizzato su {0}", + "enableCopy": "Abilita ctrl-c (cmd-c su macOS) per copiare il testo selezionato", + "enablePaste": "Abilita ctrl-v (cmd-v su macOS) per incollare dagli appunti", + "profileArgs": "Gli argomenti della shell utilizzati da questo profilo.", + "profileColor": "Un ID del colore del tema del terminale da associare al terminale.", + "profileDefault": "Scegliere il profilo predefinito...", + "profileIcon": "Un ID di codifica da associare all'icona del terminale.\nterminale-tmux: \"$(terminale-tmux)\"", + "profileNew": "Nuovo terminale (con profilo)...", + "profilePath": "Il percorso della shell utilizzata da questo profilo.", + "profiles": "I profili da presentare quando si crea un nuovo terminale. Impostare manualmente la proprietà path con gli argomenti opzionali.\nImpostare un profilo esistente a `null` per nasconderlo dall'elenco, ad esempio: `\"{0}\": null`.", + "rendererType": "Controlla il modo in cui il terminale viene reso.", + "rendererTypeDeprecationMessage": "Il tipo di renderer non è più supportato come opzione.", + "selectProfile": "Selezionare un profilo per il nuovo terminale", + "shell.deprecated": "Il nuovo modo consigliato per configurare la shell predefinita è quello di creare un profilo di terminale in 'terminal.integrated.profiles.{0}' e di impostare il nome del profilo come predefinito in 'terminal.integrated.defaultProfile.{0}'.", + "shellArgsLinux": "Gli argomenti della riga di comando da usare quando si è sul terminale Linux.", + "shellArgsOsx": "Gli argomenti della riga di comando da usare quando si è nel terminale di macOS.", + "shellArgsWindows": "Gli argomenti della linea di comando da usare quando si è sul terminale di Windows.", + "shellLinux": "Il percorso della shell che il terminale usa su Linux (predefinito: '{0}'}).", + "shellOsx": "Il percorso della shell che il terminale usa su macOS (predefinito: '{0}'}).", + "shellWindows": "Il percorso della shell che il terminale usa su Windows. (predefinito: '{0}')." + }, + "terminal-manager": { + "addTerminalToGroup": "Aggiungi terminale al gruppo", + "closeDialog": { + "message": "Una volta chiuso Terminal Manager, il suo layout non potrà essere ripristinato. Sei sicuro di voler chiudere Terminal Manager?", + "title": "Vuoi chiudere il gestore del terminale?" + }, + "closeTerminalManager": "Chiudi Terminal Manager", + "createNewTerminalGroup": "Crea nuovo gruppo di terminali", + "createNewTerminalPage": "Crea nuova pagina terminale", + "deleteGroup": "Elimina gruppo", + "deletePage": "Elimina pagina", + "deleteTerminal": "Delete Terminal", + "group": "Gruppo", + "label": "Terminali", + "maximizeBottomPanel": "Massimizza pannello inferiore", + "minimizeBottomPanel": "Riduci a icona il pannello inferiore", + "openTerminalManager": "Apri Gestione terminali", + "page": "Pagina", + "rename": "Rinomina", + "resetTerminalManagerLayout": "Reimposta layout Terminal Manager", + "toggleTreeView": "Attiva/disattiva visualizzazione ad albero" + }, + "test": { + "cancelAllTestRuns": "Annullamento di tutte le esecuzioni di test", + "stackFrameAt": "a", + "testRunDefaultName": "{0} corsa {1}", + "testRuns": "Esecuzioni di prova" + }, + "toolbar": { + "addCommand": "Aggiungere un comando alla barra degli strumenti", + "addCommandPlaceholder": "Trova un comando da aggiungere alla barra degli strumenti", + "centerColumn": "Colonna centrale", + "failedUpdate": "Fallito l'aggiornamento del valore di '{0}' in '{1}'.", + "filterIcons": "Icone del filtro", + "iconSelectDialog": "Seleziona un'icona per '{0}'.", + "iconSet": "Icon Set", + "insertGroupLeft": "Inserire il separatore di gruppo (sinistra)", + "insertGroupRight": "Inserire il separatore di gruppo (a destra)", + "leftColumn": "Colonna sinistra", + "openJSON": "Personalizzare la barra degli strumenti (aprire JSON)", + "removeCommand": "Rimuovere il comando dalla barra degli strumenti", + "restoreDefaults": "Ripristinare le impostazioni predefinite della barra degli strumenti", + "rightColumn": "Colonna destra", + "selectIcon": "Selezionare l'icona", + "toggleToolbar": "Alza la barra degli strumenti", + "toolbarLocationPlaceholder": "Dove volete che sia aggiunto il comando?", + "useDefaultIcon": "Usa l'icona predefinita" + }, + "typehierarchy": { + "subtypeHierarchy": "Gerarchia dei sottotipi", + "supertypeHierarchy": "Gerarchia dei supertipi" + }, + "variableResolver": { + "listAllVariables": "Variabile: Elenco di tutti" + }, + "vsx-registry": { + "confirmDialogMessage": "L'estensione \"{0}\" non è verificata e potrebbe rappresentare un rischio per la sicurezza.", + "confirmDialogTitle": "Siete sicuri di voler procedere con l'installazione?", + "downloadCount": "Conteggio dei download: {0}", + "errorFetching": "Errore nel recupero delle estensioni.", + "errorFetchingConfigurationHint": "Questo potrebbe essere causato da problemi di configurazione della rete.", + "failedInstallingVSIX": "Impossibile installare {0} da VSIX.", + "invalidVSIX": "Il file selezionato non è un plugin \"*.vsix\" valido.", + "license": "Licenza: {0}", + "onlyShowVerifiedExtensionsDescription": "Ciò consente a {0} di mostrare solo le estensioni verificate.", + "onlyShowVerifiedExtensionsTitle": "Mostra solo le estensioni verificate", + "recommendedExtensions": "Una lista dei nomi delle estensioni raccomandate per l'uso in questo spazio di lavoro.", + "searchPlaceholder": "Estensioni di ricerca in {0}", + "showInstalled": "Mostra le estensioni installate", + "showRecommendedExtensions": "Controlla se le notifiche sono mostrate per le raccomandazioni di estensione.", + "vsx-extensions-contribution": { + "update-version-uninstall-error": "Errore durante la rimozione dell'estensione: {0}.", + "update-version-version-error": "Impossibile installare la versione {0} di {1}." + } + }, + "webview": { + "goToReadme": "Vai a README", + "messageWarning": " Lo schema dell'host dell'endpoint {0} è stato cambiato in `{1}`; cambiare lo schema può portare a vulnerabilità di sicurezza. Vedere `{2}` per maggiori informazioni." + }, + "workspace": { + "bothAreDirectories": "Entrambe le risorse sono directory.", + "clickToManageTrust": "Clicca per gestire le impostazioni di fiducia.", + "compareWithEachOther": "Confrontare con l'altro", + "confirmDeletePermanently.description": "Impossibile eliminare \"{0}\" usando il Cestino. Vuoi invece eliminare definitivamente?", + "confirmDeletePermanently.solution": "Potete disabilitare l'uso del Cestino nelle preferenze.", + "confirmDeletePermanently.title": "Errore nell'eliminazione del file", + "confirmMessage.delete": "Volete davvero eliminare i seguenti file?", + "confirmMessage.dirtyMultiple": "Si desidera davvero eliminare {0} file con modifiche non salvate?", + "confirmMessage.dirtySingle": "Si vuole davvero cancellare {0} con le modifiche non salvate?", + "confirmMessage.uriMultiple": "Volete davvero eliminare tutti i {0} file selezionati?", + "confirmMessage.uriSingle": "Si vuole davvero cancellare {0}?", + "directoriesCannotBeCompared": "Le directory non possono essere confrontate. {0}", + "duplicate": "Duplicato", + "failSaveAs": "Impossibile eseguire \"{0}\" per il widget corrente.", + "isDirectory": "{0}'' è una directory.", + "manageTrustPlaceholder": "Seleziona lo stato di affidabilità per questo spazio di lavoro", + "newFilePlaceholder": "Nome del file", + "newFolderPlaceholder": "Nome della cartella", + "noErasure": "Nota: nulla sarà cancellato dal disco", + "notWorkspaceFile": "File di lavoro non valido: {0}", + "openRecentPlaceholder": "Scrivi il nome dello spazio di lavoro che vuoi aprire", + "openRecentWorkspace": "Aprire lo spazio di lavoro recente...", + "preserveWindow": "Abilita l'apertura degli spazi di lavoro nella finestra corrente.", + "removeFolder": "Sei sicuro di voler rimuovere la seguente cartella dall'area di lavoro?", + "removeFolders": "Sei sicuro di voler rimuovere le seguenti cartelle dallo spazio di lavoro?", + "restrictedModeDescription": "Alcune funzioni sono disabilitate perché questo spazio di lavoro non è considerato attendibile.", + "restrictedModeNote": "*Nota: la funzione di affidabilità dell'area di lavoro è attualmente in fase di sviluppo in Theia; non tutte le funzioni sono ancora integrate con l'affidabilità dell'area di lavoro.*", + "schema": { + "folders": { + "description": "Cartelle radice nell'area di lavoro" + }, + "title": "File dell'area di lavoro" + }, + "trashTitle": "Sposta {0} nel Cestino", + "trustEmptyWindow": "Controlla se lo spazio di lavoro vuoto è fidato o meno per impostazione predefinita.", + "trustEnabled": "Controlla se la fiducia dello spazio di lavoro è abilitata o meno. Se disabilitato, tutti gli spazi di lavoro sono affidabili.", + "trustTrustedFolders": "Elenco degli URI delle cartelle considerati attendibili senza richiesta di conferma.", + "untitled-cleanup": "Sembra che ci siano molti file dello spazio di lavoro senza titolo. Per favore controlla {0} e rimuovi tutti i file inutilizzati.", + "variables": { + "cwd": { + "description": "La directory di lavoro corrente del task runner all'avvio" + }, + "file": { + "description": "Il percorso del file attualmente aperto" + }, + "fileBasename": { + "description": "Il nome base del file attualmente aperto" + }, + "fileBasenameNoExtension": { + "description": "Il nome del file attualmente aperto senza estensione" + }, + "fileDirname": { + "description": "Il nome della directory del file attualmente aperto" + }, + "fileExtname": { + "description": "L'estensione del file attualmente aperto" + }, + "relativeFile": { + "description": "Il percorso del file attualmente aperto relativo alla radice dell'area di lavoro" + }, + "relativeFileDirname": { + "description": "Il nome della directory del file attualmente aperto relativo a ${workspaceFolder}" + }, + "workspaceFolder": { + "description": "Il percorso della cartella principale dell'area di lavoro" + }, + "workspaceFolderBasename": { + "description": "Il nome della cartella principale dell'area di lavoro" + }, + "workspaceRoot": { + "description": "Il percorso della cartella principale dell'area di lavoro" + }, + "workspaceRootFolderName": { + "description": "Il nome della cartella principale dell'area di lavoro" + } + }, + "workspaceFolderAdded": "È stato creato uno spazio di lavoro con radici multiple. Vuoi salvare la configurazione dello spazio di lavoro come file?", + "workspaceFolderAddedTitle": "Cartella aggiunta allo spazio di lavoro" + } + }, + "vsx.disabling": "Disabilitazione", + "vsx.disabling.extensions": "Disabilitare {0}...", + "vsx.enabling": "Abilitazione", + "vsx.enabling.extension": "Abilitazione di {0}..." +} diff --git a/packages/core/i18n/nls.ja.json b/packages/core/i18n/nls.ja.json new file mode 100644 index 0000000..72845aa --- /dev/null +++ b/packages/core/i18n/nls.ja.json @@ -0,0 +1,2097 @@ +{ + "ai-chat-ui.show-settings": "AI設定の表示", + "ai-chat:summarize-session-as-task-for-coder": "コーダーのタスクとしてセッションをまとめる", + "ai.executePlanWithCoder": "現在のプランをコーダーで実行", + "ai.updateTaskContext": "現在のタスク・コンテキストの更新", + "aiConfiguration:open": "AI設定ビューを開く", + "aiHistory:clear": "AI履歴クリアヒストリー", + "aiHistory:open": "AI履歴ビューを開く", + "aiHistory:sortChronologically": "AIの歴史年代順に並べ替える", + "aiHistory:sortReverseChronologically": "AIの歴史年代順に並べ替える", + "aiHistory:toggleCompact": "AIの歴史コンパクト表示の切り替え", + "aiHistory:toggleHideNewlines": "AIの歴史:改行の解釈をやめる", + "aiHistory:toggleRaw": "AIの歴史生の表示の切り替え", + "aiHistory:toggleRenderNewlines": "AIの歴史:改行の解釈", + "debug.breakpoint.editCondition": "編集条件...", + "debug.breakpoint.removeSelected": "選択されたブレークポイントの削除", + "debug.breakpoint.toggleEnabled": "ブレークポイントの有効化を切り替える", + "notebook.cell.changeToCode": "セルをコードに変更", + "notebook.cell.changeToMarkdown": "セルをマーダウンに変更", + "notebook.cell.insertMarkdownCellAbove": "マークダウン・セルを上に挿入する", + "notebook.cell.insertMarkdownCellBelow": "下にマークダウン・セルを挿入する", + "terminal:new:profile": "プロファイルから新しい統合端末を作成する", + "terminal:profile:default": "デフォルトの端末プロファイルを選択", + "theia": { + "ai": { + "agents": { + "completionNotification": { + "mdDescription": "このエージェントがタスクを完了したときの通知動作。設定されていない場合、グローバルなデフォルトの通知設定が使用されます。\n - os-notification`:OS/ システム通知を表示する\n - メッセージ`:ステータスバー/メッセージエリアに通知を表示する\n - blink`: ステータスバー/メッセージエリアに通知を表示する:UI を点滅またはハイライトする\n - off`:このエージェントの通知を無効にする", + "title": "完了通知" + }, + "enable": { + "mdDescription": "エージェントを有効(true)にするか無効(false)にするかを指定します。", + "title": "エージェントを有効にする" + }, + "languageModelRequirements": { + "identifier": { + "mdDescription": "使用する言語モデルの識別子。" + }, + "mdDescription": "このエージェントで使用する言語モデルを指定します。", + "purpose": { + "mdDescription": "この言語モデルを使用する目的。", + "title": "目的" + }, + "title": "言語モデルの要件" + }, + "mdDescription": "特定のエージェントの有効化、無効化、プロンプトの設定、LLMの選択など、エージェントの設定を行います。", + "selectedVariants": { + "mdDescription": "このエージェントで現在選択されているプロンプトのバリエーションを指定します。", + "title": "厳選されたバリエーション" + }, + "title": "エージェント設定" + }, + "anthropic": { + "apiKey": { + "description": "Anthropic公式アカウントのAPIキーを入力してください。**AnthropicのAPIキーは、Theiaを実行しているマシンにクリアテキストで保存されます。キーを安全に設定するには、環境変数 `ANTHROPIC_API_KEY` を使用してください。" + }, + "models": { + "description": "人類学の公式モデルを使用" + } + }, + "chat": { + "agent": { + "architect": "建築家", + "coder": "コーダー", + "universal": "ユニバーサル" + }, + "applySuggestion": "提案を適用する", + "bypassModelRequirement": { + "description": "言語モデルの要件チェックをバイパスします。Theia言語モデルを必要としない外部エージェント(例:Claude Code)を使用している場合に有効にしてください。" + }, + "changeSetDefaultTitle": "変更提案", + "changeSetFileDiffUriLabel": "AIの変更:{0}", + "chatAgentsVariable": { + "description": "システムで利用可能なチャットエージェントのリストを返します。" + }, + "chatSessionNamingAgent": { + "description": "チャットセッション名生成エージェント", + "vars": { + "conversation": { + "description": "チャットの会話内容。" + }, + "listOfSessionNames": { + "description": "既存のセッション名のリスト。" + } + } + }, + "chatSessionSummaryAgent": { + "description": "チャットセッションの要約を生成するエージェント。" + }, + "confirmApplySuggestion": "この提案が作成されてから、ファイル{0} が変更されました。本当にこの変更を適用しますか?", + "confirmRevertSuggestion": "この提案が作成されてから、ファイル{0} が変更されました。変更を元に戻したいということでよろしいでしょうか?", + "couldNotFindMatchingLM": "一致する言語モデルが見つかりませんでした。設定を確認してください!", + "couldNotFindReadyLMforAgent": "エージェント{0} の言語モデルが見つかりません。設定を確認してください!", + "defaultAgent": { + "description": "オプション: で明示的にエージェントが指定されていない場合、呼び出されるチャットエージェントの を指定します。デフォルトエージェントが設定されていない場合、Theia のデフォルトが適用されます。" + }, + "imageContextVariable": { + "args": { + "data": { + "description": "画像データをbase64で表したもの。" + }, + "mimeType": { + "description": "画像のmimetype。" + }, + "name": { + "description": "もしあれば、画像ファイルの名前。" + }, + "wsRelativePath": { + "description": "もしあれば、画像ファイルのワークスペース相対パス。" + } + }, + "description": "画像のコンテキスト情報を提供する", + "label": "画像ファイル" + }, + "orchestrator": { + "description": "このエージェントは、利用可能なすべてのチャットエージェントの説明に対してユーザーのリクエストを分析し、(AIを使用して)リクエストに答えるために最適なエージェントを選択します。ユーザーのリクエストは、さらに確認することなく、選択されたエージェントに直接委譲されます。", + "vars": { + "availableChatAgents": { + "description": "オーケストレーターがデリゲートできるチャットエージェントのリスト(除外リスト設定で指定したエージェントは除く)。" + } + } + }, + "pinChatAgent": { + "description": "エージェントのピン留めを有効にすると、プロンプトの間、言及されたチャットエージェントを自動的にアクティブに保ち、繰り返し言及する必要性を減らします。" + }, + "revertSuggestion": "差し戻し提案", + "selectImageFile": "画像ファイルを選択する", + "sessionStorage": { + "description": "チャットセッションの保存先を設定します。", + "globalPath": "グローバルパス", + "pathNotUsedForScope": "{0}ストレージスコープでは使用されません。", + "pathRequired": "パスは空であってはなりません", + "pathSettings": "パス設定", + "resetToDefault": "デフォルトにリセット", + "scope": { + "global": "チャットセッションをグローバル設定フォルダに保存する。", + "workspace": "チャットセッションをワークスペースフォルダーに保存する。" + }, + "workspacePath": "ワークスペースパス" + }, + "taskContextService": { + "summarizeProgressMessage": "要約する:{0}", + "updatingProgressMessage": "更新中:{0}" + }, + "toolConfirmation": { + "confirm": { + "description": "ツール実行前に確認を求める" + }, + "disabled": { + "description": "ツールの実行を無効にする" + }, + "yolo": { + "description": "確認なしで自動的にツールを実行する" + } + }, + "view": { + "label": "AIチャット" + } + }, + "chat-ui": { + "addContextVariable": "コンテキスト変数の追加", + "agent": "代理店", + "aiDisabled": "AI機能は無効", + "applyAll": "すべてを適用する", + "applyAllTitle": "保留中の変更をすべて適用する", + "askQuestion": "質問する", + "attachToContext": "コンテキストに要素をアタッチする", + "cancel": "キャンセル (Esc)", + "chat-view-tree-widget": { + "ai": "AI", + "aiFeatureHeader": "🚀 AI機能あり(アルファ版)!", + "featuresDisabled": "現在、すべてのAI機能は無効になっています!", + "generating": "生成", + "howToEnable": "AI機能を有効にする方法:", + "noRenderer": "エラー:レンダラーが見つかりません", + "scrollToBottom": "最新のメッセージへジャンプ", + "waitingForInput": "入力を待つ", + "you": "あなた" + }, + "chatInput": { + "clearHistory": "入力プロンプト履歴の消去", + "cycleMode": "サイクル・チャット・モード", + "nextPrompt": "次のプロンプト", + "previousPrompt": "前回のプロンプト" + }, + "chatInputAriaLabel": "ここにメッセージを入力してください", + "chatResponses": "チャット応答", + "code-part-renderer": { + "generatedCode": "生成コード" + }, + "collapseChangeSet": "変更セットを折りたたむ", + "command-part-renderer": { + "commandNotExecutable": "コマンドは \"{0}\" という ID を持っていますが、チャットウィンドウからは実行できません。" + }, + "copyCodeBlock": "コードブロックのコピー", + "couldNotSendRequestToSession": "リクエスト \"{0}\" をセッションに送信できませんでした。{1}", + "delegation-response-renderer": { + "prompt": { + "label": "委任されたプロンプト:" + }, + "response": { + "label": "反応だ:" + }, + "starting": "代表団を率いて...", + "status": { + "canceled": "キャンセル", + "error": "エラー", + "generating": "生成...", + "starting": "スタート..." + } + }, + "deleteChangeSet": "変更セットの削除", + "editRequest": "編集", + "edited": "編集済み", + "editedTooltipHint": "このプロンプトのバリエーションは編集済みです。AI設定ビューでリセットできます。", + "enterChatName": "チャット名を入力", + "errorChatInvocation": "チャットサービス呼び出し中にエラーが発生しました。", + "expandChangeSet": "変更セットを展開", + "failedToDeleteSession": "チャットセッションの削除に失敗しました", + "failedToLoadChats": "チャットセッションのロードに失敗しました", + "failedToRestoreSession": "チャットセッションの復元に失敗しました", + "failedToRetry": "再試行に失敗したメッセージ", + "focusInput": "フォーカスチャット入力", + "focusResponse": "フォーカスチャット応答", + "noChatAgentsAvailable": "チャットエージェントはいません。", + "openDiff": "オープンデフ", + "openOriginalFile": "オリジナル・ファイルを開く", + "performThisTask": "このタスクを実行する。", + "persistedSession": "パーシステッドセッション(クリックで復元)", + "removeChat": "チャットの削除", + "renameChat": "チャット名の変更", + "requestNotFoundForRetry": "再試行のリクエストが見つからない", + "responseFrom": "{0}からの返信", + "selectAgentQuickPickPlaceholder": "新しいセッションのエージェントを選択する", + "selectChat": "チャットを選択", + "selectContextVariableQuickPickPlaceholder": "メッセージに添付するコンテキスト変数を選択する。", + "selectTaskContextQuickPickItem": { + "currentlyOpen": "オープン中" + }, + "selectTaskContextQuickPickPlaceholder": "添付するタスクコンテキストを選択する", + "selectVariableArguments": "変数引数の選択", + "send": "送信 (Enter)", + "sessionNotFoundForRetry": "再試行のためのセッションが見つからない", + "text-part-renderer": { + "cantDisplay": "ChatResponsePartRenderersをチェックしてください!" + }, + "thinking-part-renderer": { + "thinking": "考える" + }, + "toolcall-part-renderer": { + "denied": "実行拒否", + "finished": "ラン", + "rejected": "実行中止" + }, + "toolconfirmation": { + "allow-options-dropdown-tooltip": "その他のオプション", + "allow-session": "このチャットを許可する", + "allowed": "ツール実行可", + "alwaysAllowConfirm": "承知しました、自動承認を有効にします", + "alwaysAllowTitle": "「{0}」の自動承認を有効にしますか?", + "canceled": "ツールの実行がキャンセルされました", + "denied": "ツール実行拒否", + "deny-forever": "常に拒否", + "deny-options-dropdown-tooltip": "その他の拒否オプション", + "deny-reason-placeholder": "拒否理由を入力してください...", + "deny-session": "このチャットを拒否する", + "deny-with-reason": "理屈で否定する…", + "executionDenied": "ツールの実行が拒否されました", + "header": "ツール実行の確認" + }, + "unableToSummarizeCurrentSession": "現在のセッションを要約できません。要約エージェントが無効になっていないか確認してください。", + "unknown-part-renderer": { + "contentNotRestoreable": "このコンテンツ(タイプ '{0}' )は完全に復元できませんでした。利用できなくなった拡張機能の可能性があります。" + }, + "unpinAgent": "アンピンエージェント", + "variantTooltip": "プロンプトのバリエーション: {0}", + "yourMessage": "あなたのメッセージ" + }, + "claude-code": { + "agentDescription": "アンソロピックのコーディング・エージェント", + "askBeforeEdit": "編集前に確認してください", + "changeSetTitle": "クロード・コードによる変更", + "clearCommand": { + "description": "新しいセッションを作成する" + }, + "compactCommand": { + "description": "コンパクトな会話とオプションのフォーカス指示" + }, + "completedCount": "{0}/{1} 完成", + "configCommand": { + "description": "オープンクロードコードの構成" + }, + "currentDirectory": "カレントディレクトリ", + "differentAgentRequestWarning": "前のチャットリクエストは別のエージェントが処理しました。Claude Codeは他のメッセージを見ていません。", + "directory": "ディレクトリ", + "domain": "ドメイン", + "editAutomatically": "自動編集", + "editNumber": "編集{0}", + "editing": "編集", + "editsCount": "{0} 編集", + "emptyTodoList": "すべてではない", + "entireFile": "ファイル全体", + "excludingOnePattern": "(1パターンを除く)", + "excludingPatterns": "({0} パターンを除く)", + "executedCommand": "実行された:{0}", + "failedToParseBashToolData": "Bashツールデータの解析に失敗", + "failedToParseEditToolData": "編集ツールデータの解析に失敗しました", + "failedToParseGlobToolData": "グローブツールのデータ解析に失敗", + "failedToParseGrepToolData": "Grepツールデータの解析に失敗", + "failedToParseLSToolData": "LSツールデータの解析に失敗しました", + "failedToParseMultiEditToolData": "MultiEditツールデータの解析に失敗しました。", + "failedToParseReadToolData": "読み取りツールデータの解析に失敗しました", + "failedToParseTodoListData": "Todoリストデータの解析に失敗しました", + "failedToParseWebFetchToolData": "WebFetchツールデータの解析に失敗しました。", + "failedToParseWriteToolData": "書き込みツールデータの解析に失敗しました", + "fetching": "フェッチ", + "fileFilter": "ファイルフィルター", + "filePath": "ファイルパス", + "fileType": "ファイルの種類", + "findMatchingFiles": "現在のディレクトリでグロブパターン \"{0}\" に一致するファイルを検索する。", + "findMatchingFilesWithPath": "以下のグロブパターン \"{0}\" に一致するファイルを検索する。{1}", + "finding": "発見", + "from": "より", + "globPattern": "グロブパターン", + "grepOptions": { + "caseInsensitive": "大文字小文字を区別しない", + "glob": "グローブ{0}", + "headLimit": "制限を設けている:{0}", + "lineNumbers": "行番号", + "linesAfter": "+{0} ", + "linesBefore": "+{0} 前", + "linesContext": "±{0} コンテキスト", + "multiLine": "マルチライン", + "type": "タイプだ:{0}" + }, + "grepOutputModes": { + "content": "内容", + "count": "カウント", + "filesWithMatches": "一致するファイル" + }, + "ignoredPatterns": "無視されたパターン", + "ignoringPatterns": "{0} パターンを無視する", + "initCommand": { + "description": "CLAUDE.mdガイドでプロジェクトを初期化する" + }, + "itemCount": "{0} 項目", + "lineLimit": "ライン・リミット", + "lines": "ライン", + "listDirectoryContents": "ディレクトリの内容を一覧表示", + "listing": "リスト", + "memoryCommand": { + "description": "CLAUDE.mdメモリーファイルの編集" + }, + "multiEditing": "マルチ編集", + "oneEdit": "1件の編集", + "oneItem": "1件", + "oneOption": "1オプション", + "openDirectoryTooltip": "クリックしてディレクトリを開く", + "openFileTooltip": "ファイルをエディターで開く", + "optionsCount": "{0} オプション", + "partial": "パーシャル", + "pattern": "パターン", + "plan": "プランモード", + "project": "プロジェクト", + "projectRoot": "プロジェクトルート", + "readMode": "読み取りモード", + "reading": "読書", + "replaceAllCount": "{0} すべて置換", + "replaceAllOccurrences": "すべての出現回数を置き換える", + "resumeCommand": { + "description": "セッションを再開する" + }, + "reviewCommand": { + "description": "コードレビューの依頼" + }, + "searchPath": "検索パス", + "searching": "検索", + "startingLine": "スタートライン", + "timeout": "タイムアウト", + "timeoutInMs": "タイムアウト:{0}ms", + "to": "へ", + "todoList": "Todoリスト", + "todoPriority": { + "high": "高い", + "low": "ロー", + "medium": "ミディアム" + }, + "toolApprovalRequest": "クロード・コードが \"{0}\" ツールを使いたいと言っています。許可しますか?", + "totalEdits": "編集合計", + "webFetch": "ウェブフェッチ", + "writing": "執筆" + }, + "code-completion": { + "progressText": "AIコードの完成度を計算する..." + }, + "codex": { + "agentDescription": "OpenAIのコーディングアシスタント(Codex搭載)", + "completedCount": "{0}/{1} 完了", + "exitCode": "終了コード: {0}", + "fileChangeFailed": "Codex は以下の変更を適用できませんでした: {0}", + "fileChangeFailedGeneric": "Codex はファイルの変更を適用できませんでした。", + "itemCount": "{0} アイテム", + "noItems": "アイテムなし", + "oneItem": "1点", + "running": "実行中...", + "searched": "検索された", + "searching": "検索中", + "todoList": "Todoリスト", + "webSearch": "ウェブ検索" + }, + "completion": { + "agent": { + "description": "このエージェントは、Theia IDEのコードエディターでインラインコード補完を提供します。", + "vars": { + "file": { + "description": "編集中のファイルのURI" + }, + "language": { + "description": "編集中のファイルの言語ID" + }, + "prefix": { + "description": "現在のカーソル位置より前のコード" + }, + "suffix": { + "description": "現在のカーソル位置の後のコード" + } + } + }, + "automaticEnable": { + "description": "編集中の任意の(Monaco)エディタ内で、AI補完をインラインで自動的にトリガー。 \n あるいは、コマンド \"Trigger Inline Suggestion\" またはデフォルトのショートカット \"Ctrl+Alt+Space\" を使って、手動でコードをトリガーすることもできます。" + }, + "cacheCapacity": { + "description": "キャッシュに格納するコード補完の最大数。数値が大きいほどパフォーマンスが向上するが、より多くのメモリを消費する。 最小値は 10 で、推奨範囲は 50 ~ 200 です。", + "title": "コード補完キャッシュ容量" + }, + "debounceDelay": { + "description": "エディタで変更が検出された後、AI補完をトリガーするまでの遅延をミリ秒単位で制御します。 自動コード補完`が有効になっている必要があります。デバウンス遅延を無効にするには0を入力してください。", + "title": "デバウンス遅延" + }, + "excludedFileExts": { + "description": "AI補完を無効にするファイル拡張子(例:.md、.txt)を指定する。", + "title": "除外されるファイル拡張子" + }, + "fileVariable": { + "description": "編集中のファイルのURI。コード補完コンテキストでのみ使用可能。" + }, + "languageVariable": { + "description": "編集中のファイルの言語ID。コード補完コンテキストでのみ利用可能です。" + }, + "maxContextLines": { + "description": "コンテキストとして使用する最大行数。カーソル位置の前後の行(プレフィックスとサフィックス)に分散して使用する。 行数制限なしでファイル全体をコンテキストとして使うには-1、 現在の行だけを使うには0を指定する。", + "title": "最大コンテクスト行数" + }, + "prefixVariable": { + "description": "現在のカーソル位置より前のコード。コード補完コンテキストでのみ使用可能。" + }, + "stripBackticks": { + "description": "いくつかのLLMが返すコードから、周囲のバックスティックを取り除く。バックスティックが検出された場合、バックスティックを閉じた後のすべての内容も取り除かれます。この設定は、言語モデルがマークダウンのような書式を使用している場合に、プレーンなコードが返されるようにするのに役立ちます。", + "title": "インライン補完からバックスティックを取り除く" + }, + "suffixVariable": { + "description": "現在のカーソル位置の後のコード。コード補完コンテキストでのみ使用可能。" + } + }, + "configuration": { + "selectItem": "アイテムを選択してください。" + }, + "copilot": { + "auth": { + "aiConfiguration": "AI設定", + "authorize": "私は承認しました", + "copied": "コピーしました!", + "copyCode": "コードをコピー", + "expired": "認証が期限切れか拒否されました。再度お試しください。", + "hint": "コードを入力し認証後、下部の「認証しました」をクリックしてください。", + "initiating": "認証を開始しています...", + "instructions": "TheiaがGitHub Copilotを使用することを許可するには、以下のURLにアクセスし、コードを入力してください:", + "openGitHub": "GitHubを開く", + "success": "GitHub Copilot に正常にサインインしました!", + "successHint": "GitHubアカウントでCopilotを利用できる場合、Copilot言語モデルを ", + "title": "GitHub Copilot にサインイン", + "tos": "ログインすることにより、あなたは以下の内容に同意するものとします。 ", + "tosLink": "GitHub 利用規約", + "verifying": "認証を確認中..." + }, + "category": "コパイロット", + "commands": { + "signIn": "GitHub Copilot にサインイン", + "signOut": "GitHub Copilot からサインアウトする" + }, + "enterpriseUrl": { + "mdDescription": "Copilot API用のGitHub Enterpriseドメイン(例: `github.mycompany.com`)。GitHub.comの場合は空欄のままにしてください。" + }, + "models": { + "description": "使用するGitHub Copilotモデル。利用可能なモデルは、お客様のCopilotサブスクリプションによって異なります。" + }, + "statusBar": { + "signedIn": "GitHub Copilot に {0} としてサインインしています。クリックしてサインアウトしてください。", + "signedOut": "GitHub Copilot にサインインしていません。クリックしてサインインしてください。" + } + }, + "core": { + "agentConfiguration": { + "actions": "アクション", + "addCustomAgent": "カスタムエージェントの追加", + "enableAgent": "エージェントを有効にする", + "label": "代理店", + "llmRequirements": "LLM要件", + "notUsedInPrompt": "プロンプトでは使用しない", + "promptTemplates": "プロンプトテンプレート", + "selectAgentMessage": "まず代理店をお選びください!", + "templateName": "テンプレート", + "undeclared": "未申告", + "usedAgentSpecificVariables": "使用済みエージェント固有変数", + "usedFunctions": "使用済み関数", + "usedGlobalVariables": "使用済みグローバル変数", + "variant": "バリアント" + }, + "agentsVariable": { + "description": "システムで利用可能なエージェントのリストを返します。" + }, + "aiConfiguration": { + "label": "AIコンフィギュレーション【α" + }, + "blinkTitle": { + "agentCompleted": "テイア - エージェント完了", + "namedAgentCompleted": "Theia - Agent \"{0}\" 完成" + }, + "changeSetSummaryVariable": { + "description": "変更セット内のファイルとその内容の要約を提供します。" + }, + "contextDetailsVariable": { + "description": "すべてのコンテキスト要素の全テキスト値と説明を提供します。" + }, + "contextSummaryVariable": { + "description": "指定されたセッションのコンテキスト内のファイルを記述する。" + }, + "customAgentTemplate": { + "description": "これはエージェントの一例です。あなたのニーズに合わせて物件をアレンジしてください。" + }, + "defaultModelAliases": { + "code": { + "description": "コード理解と生成タスクに最適化。" + }, + "code-completion": { + "description": "コード自動補完のシナリオに最適。" + }, + "summarize": { + "description": "内容の要約と凝縮に優先順位をつけたモデル。" + }, + "universal": { + "description": "コードと一般言語の両方にバランスよく対応。" + } + }, + "defaultNotification": { + "mdDescription": "AIエージェントがタスクを完了したときに使用されるデフォルトの通知方法。個々のエージェントはこの設定を上書きできる。\n - os-notification`:OS/システム通知を表示する\n - メッセージ`:ステータスバー/メッセージエリアに通知を表示する。\n - blink`:UI を点滅またはハイライトする\n - off`:すべての通知を無効にする", + "title": "デフォルトの通知タイプ" + }, + "discard": { + "label": "AIプロンプト・テンプレート" + }, + "discardCustomPrompt": { + "tooltip": "カスタマイズの破棄" + }, + "fileVariable": { + "description": "ファイルの内容を解決する", + "uri": { + "description": "要求されたファイルのURI。" + } + }, + "languageModelRenderer": { + "alias": "[別名]{0}", + "languageModel": "言語モデル", + "purpose": "目的" + }, + "maxRetries": { + "mdDescription": "AIプロバイダへのリクエストに失敗したときの再試行回数の最大値。0は再試行なしを意味する。", + "title": "最大リトライ回数" + }, + "modelAliasesConfiguration": { + "agents": "このエイリアスを使用するエージェント", + "defaultList": "[デフォルトリスト]", + "evaluatesTo": "に評価される。", + "label": "モデルの別名", + "modelNotReadyTooltip": "準備ができていない", + "modelReadyTooltip": "準備完了", + "noAgents": "このエイリアスを使用するエージェントはいない。", + "noModelReadyTooltip": "モデルなし", + "noResolvedModel": "このエイリアスに対応するモデルは用意されていない。", + "priorityList": "優先順位リスト", + "selectAlias": "モデルエイリアスを選択してください。", + "selectedModelId": "厳選モデル", + "unavailableModel": "選択されたモデルの販売は終了しました。" + }, + "noVariableFoundForOpenRequest": "オープンリクエストに対応する変数が見つかりません。", + "openEditorsShortVariable": { + "description": "現在開いているすべてのファイルへのショートリファレンス(相対パス、カンマ区切り)" + }, + "openEditorsVariable": { + "description": "ワークスペース・ルートからの相対パスで、現在開いているすべてのファイルのカンマ区切りリスト。" + }, + "preference": { + "languageModelAliases": { + "description": "AI Configuration View]({0})で、各言語モデルエイリアスのモデルを設定します。あるいは、settings.jsonで手動で設定することもできます: \n```\n\"default/code\":{\n \"selectedModel\":\"anthropic/claude-opus-4-20250514\"\n}\n```", + "selectedModel": "このエイリアスのためにユーザーが選択したモデル。", + "title": "言語モデルのエイリアス" + } + }, + "prefs": { + "title": "AI機能【アルファ" + }, + "promptFragmentsConfiguration": { + "activeCustomizationTitle": "アクティブなカスタマイズ", + "createCustomizationTitle": "カスタマイズの作成", + "customization": "カスタマイズ", + "customizationLabel": "カスタマイズ", + "defaultVariantTitle": "デフォルトのバリアント", + "deleteCustomizationTitle": "カスタマイズの削除", + "editTemplateTitle": "テンプレートの編集", + "headerTitle": "プロンプト・フラグメント", + "label": "プロンプト・フラグメント", + "noFragmentsAvailable": "プロンプトの断片はない。", + "otherPromptFragmentsHeader": "その他のプロンプト・フラグメント", + "promptTemplateText": "プロンプト・テンプレート・テキスト", + "promptVariantsHeader": "プロンプト・バリアントセット", + "removeCustomizationDialogMsg": "プロンプト・フラグメント \"{1}\" の{0} カスタマイズを削除してもよろしいですか?", + "removeCustomizationDialogTitle": "カスタマイズの削除", + "removeCustomizationWithDescDialogMsg": "プロンプト・フラグメント \"{1}\" ({2}) の{0} カスタマイズを削除してもよろしいですか?", + "resetAllButton": "すべてリセット", + "resetAllCustomizationsDialogMsg": "すべてのプロンプトフラグメントをビルトインバージョンにリセットしてもよろしいですか?これですべてのカスタマイズが削除されます。", + "resetAllCustomizationsDialogTitle": "すべてのカスタマイズをリセット", + "resetAllCustomizationsTitle": "すべてのカスタマイズをリセットする", + "resetAllPromptFragments": "すべてのプロンプトフラグメントをリセットする", + "resetToBuiltInDialogMsg": "プロンプトフラグメント \"{0}\" をビルトインバージョンにリセットしてよろしいですか?これですべてのカスタマイズが削除されます。", + "resetToBuiltInDialogTitle": "内蔵にリセット", + "resetToBuiltInTitle": "この内蔵にリセットする", + "resetToCustomizationDialogMsg": "プロンプト・フラグメント \"{0}\" をリセットして、{1} カスタマイズを使用しますか?これにより、優先順位の高いカスタマイズはすべて削除されます。", + "resetToCustomizationDialogTitle": "カスタマイズにリセット", + "resetToCustomizationTitle": "このカスタマイズにリセットする", + "selectedVariantLabel": "厳選された", + "selectedVariantTitle": "選択されたバリアント", + "usedByAgentTitle": "エージェントが使用:{0}", + "variantSetError": "選択された variant が存在せず、デフォルトも見つかりません。設定を確認してください。", + "variantSetWarning": "選択された variant は存在しません。代わりにデフォルトの variant が使われています。", + "variantsOfSystemPrompt": "このプロンプトのバリアントセット:" + }, + "promptTemplates": { + "description": "カスタマイズされたプロンプトテンプレートを保存するフォルダ。カスタマイズされていない場合は、ユーザー設定ディレクトリが使用される。プロンプトテンプレートのバリエーションを管理するために、バージョン管理下にあるフォルダを使用することを検討してください。", + "openLabel": "フォルダを選択" + }, + "promptVariable": { + "argDescription": "解決するプロンプトテンプレートID", + "completions": { + "detail": { + "builtin": "内蔵プロンプトの断片", + "custom": "カスタマイズされたプロンプトの断片" + } + }, + "description": "プロンプト・テンプレートをプロンプト・サービスで解決する" + }, + "prompts": { + "category": "テイアAIプロンプトテンプレート" + }, + "requestSettings": { + "clientSettings": { + "description": "llmに送り返されるメッセージの処理方法に関するクライアント設定。", + "keepThinking": { + "description": "falseに設定すると、マルチターン会話で次のユーザーリクエストを送る前に、すべての思考出力がフィルターされる。" + }, + "keepToolCalls": { + "description": "falseに設定すると、すべてのツールリクエストとツール応答は、マルチターン会話で次のユーザーリクエストを送る前にフィルターされる。" + } + }, + "mdDescription": "複数のモデルのカスタムリクエスト設定を指定することができます。\n 各オブジェクトは特定のモデルの設定を表す。modelId` フィールドはモデル ID を指定し、`requestSettings` フィールドはモデル固有の設定を定義する。\n providerId` フィールドはオプションであり、設定を特定のプロバイダに適用することができる。設定されていない場合、設定はすべてのプロバイダに適用される。\n providerIdの例: huggingface, openai, ollama, llamafile.\n 詳しくは[our documentation](https://theia-ide.org/docs/user_ai/#custom-request-settings)を参照してください。", + "modelSpecificSettings": { + "description": "特定のモデルIDの設定。" + }, + "scope": { + "agentId": { + "description": "オプション)設定を適用するエージェントID。" + }, + "modelId": { + "description": "(オプションの)モデルID" + }, + "providerId": { + "description": "設定を適用するプロバイダID(オプション)。" + } + }, + "title": "カスタムリクエスト設定" + }, + "skillsVariable": { + "description": "AIエージェントが使用可能な利用可能なスキルのリストを返します" + }, + "taskContextSummary": { + "description": "セッションコンテキストに存在するすべてのタスクコンテキストアイテムを解決する。" + }, + "templateSettings": { + "edited": "編集済み", + "unavailableVariant": "選択されたバリアントはもう利用できません" + }, + "todayVariable": { + "description": "今日のために何かをする", + "format": { + "description": "日付の書式" + } + }, + "unableToDisplayVariableValue": "変数の値を表示できません。", + "unableToResolveVariable": "変数を解決できません。", + "variable-contribution": { + "builtInVariable": "テイア内蔵バリアブル", + "currentAbsoluteFilePath": "現在開いているファイルの絶対パス。ほとんどのエージェントは、相対ファイルパス(現在のワークスペースからの相対パス)を期待することに注意してください。", + "currentFileContent": "現在開いているファイルのプレーンな内容。これは、コンテンツがどこから来たかという情報を除きます。ほとんどのエージェントは、相対ファイルパス(現在のワークスペースからの相対パス)の方がうまく動作することに注意してください。", + "currentRelativeDirPath": "現在開いているファイルを含むディレクトリの相対パス。", + "currentRelativeFilePath": "現在開いているファイルの相対パス。", + "currentSelectedText": "開いているファイルで現在選択されているプレーンテキスト。これは、コンテンツがどこから来たかという情報を除きます。ほとんどのエージェントは、相対ファイルパス(現在のワークスペースからの相対パス)の方がうまく動作することに注意してください。", + "dotRelativePath": "現在開いているファイルの相対パス ('currentRelativeFilePath')へのショートリファレンス。" + } + }, + "editor": { + "editorContextVariable": { + "description": "エディタ固有のコンテキスト情報を解決する", + "label": "エディタコンテキスト" + }, + "explainWithAI": { + "prompt": "このエラーを説明する", + "title": "AIで説明する" + }, + "fixWithAI": { + "prompt": "このエラーを修正する" + } + }, + "google": { + "apiKey": { + "description": "公式 Google AI (Gemini) アカウントの API キーを入力してください。**注意:** この設定を使用すると、Theia を実行しているマシンに GOOGLE AI API キーが平文で保存されます。キーを安全に設定するには、環境変数 `GOOGLE_API_KEY` を使用してください。" + }, + "maxRetriesOnErrors": { + "description": "エラー発生時の最大リトライ回数。1より小さい場合、リトライロジックは無効になる" + }, + "models": { + "description": "使用するGoogle Gemini公式モデル" + }, + "retryDelayOnOtherErrors": { + "description": "その他のエラーが発生した場合の再試行までの遅延時間(Google GenAIは、モデルから返されたJSON構文が不完全であったり、500 Internal Server Errorなどのエラーを報告することがあります)。これを -1 に設定すると、このような場合の再試行を防ぎます。そうでない場合は、(0 を指定した場合は) すぐに再試行が行われるか、(正の数を指定した場合は) この遅延時間 (秒) 後に再試行が行われます。" + }, + "retryDelayOnRateLimitError": { + "description": "速度制限エラーが発生した場合の再試行までの遅延時間(秒)。https://ai.google.dev/gemini-api/docs/rate-limits を参照。" + } + }, + "history": { + "clear": { + "tooltip": "全エージェントの履歴を消去" + }, + "exchange-card": { + "agentId": "代理店", + "timestamp": "スタート" + }, + "open-history-tooltip": "AIの歴史を開く...", + "request-card": { + "agent": "代理店", + "model": "モデル", + "request": "リクエスト", + "response": "応答", + "timestamp": "タイムスタンプ", + "title": "リクエスト" + }, + "sortChronologically": { + "tooltip": "年代順に並べる" + }, + "sortReverseChronologically": { + "tooltip": "年代順に並べ替える" + }, + "toggleCompact": { + "tooltip": "コンパクト表示" + }, + "toggleHideNewlines": { + "tooltip": "改行の解釈を止める" + }, + "toggleRaw": { + "tooltip": "生で見る" + }, + "toggleRenderNewlines": { + "tooltip": "改行の解釈" + }, + "view": { + "label": "AIエージェントの歴史【アルファ", + "noAgent": "代理人は不在。", + "noAgentSelected": "エージェントが選択されていない。", + "noHistoryForAgent": "選択したエージェントの履歴はありません '{0}'" + } + }, + "huggingFace": { + "apiKey": { + "mdDescription": "Hugging FaceアカウントのAPIキーを入力してください。**Please note:** この環境設定を使用することにより、Hugging Face APIキーはTheiaを実行しているマシンにクリアテキストで保存されます。キーを安全に設定するには環境変数 `HUGGINGFACE_API_KEY` を使用してください。" + }, + "models": { + "mdDescription": "Hugging Faceモデルの使用について。**ご注意:** 現在、チャット補完APIをサポートするモデルのみが利用可能です(例:`*-Instruct`のような指示学習モデル)。一部のモデルでは、Hugging Faceウェブサイト上で利用規約に同意する必要がある場合があります。" + } + }, + "ide": { + "agent-description": "AI Configuration View]({0})で、AIエージェントの有効化、LLMの選択、プロンプトテンプレートのカスタマイズ、カスタムエージェントの作成などの設定を行います。", + "agentConfiguration": { + "customAgentLocationQuickPick": { + "createNewFile": "新規ファイルの作成", + "openExistingFile": "既存のファイルを開く", + "placeholder": "カスタムエージェントのファイルを作成または開く場所を選択します。", + "title": "カスタム・エージェント・ファイルの場所を選択する" + }, + "noDescription": "説明はありません" + }, + "app-tester": { + "errorCheckingDevToolsServerStatus": "DevTools MCP サーバーの状態確認エラー: {0}", + "errorCheckingPlaywrightServerStatus": "Playwright MCP サーバーの状態チェックでエラーが発生しました:{0}", + "startChromeDevToolsMcpServers": { + "canceled": "Chrome DevTools MCP サーバーを設定してください。", + "error": "Chrome DevTools MCP サーバーの起動に失敗しました: {0}", + "progress": "Chrome DevTools MCP サーバーを起動中。", + "question": "Chrome DevTools MCP サーバーが実行されていません。今すぐ開始しますか?これにより Chrome DevTools MCP サーバーがインストールされる可能性があります。" + }, + "startMcpServers": { + "no": "いいえ、キャンセル", + "yes": "はい、サーバーを起動してください" + }, + "startPlaywrightServers": { + "canceled": "MCPサーバーをセットアップしてください。", + "error": "Playwright MCPサーバーの起動に失敗しました:{0}", + "progress": "Playwright MCPサーバーの起動。", + "question": "Playwright MCP サーバーが稼動していません。今すぐ起動しますか?これにより、Playwright MCP サーバーがインストールされる可能性があります。" + } + }, + "architectAgent": { + "mode": { + "default": "デフォルトモード", + "plan": "モードプラン", + "simple": "シンプルモード" + }, + "suggestion": { + "executePlanWithCoder": "Coderで「{0}」を実行する", + "summarizeSessionAsTaskForCoder": "このセッションをコーダーのタスクとしてまとめる", + "updateTaskContext": "現在のタスクコンテキストを更新する" + } + }, + "bypassHint": "クロード・コードのような一部のエージェントは、テイヤ言語モデルを必要としません", + "chatDisabledMessage": { + "featuresTitle": "現在サポートされているビューと機能:" + }, + "coderAgent": { + "mode": { + "agentNext": "エージェントモード(次へ)", + "edit": "編集モード" + }, + "suggestion": { + "fixProblems": { + "content": "現在のファイルの [問題の修正]({0})。", + "prompt": "{1} を見て、問題があれば修正してください。" + }, + "startNewChat": "チャットは短く、集中して行う。新しいタスクのために[新しいチャットを始める]({0})、または[このチャットの要約で新しいチャットを始める]({1})。" + } + }, + "commandAgent": { + "commandCallback": { + "confirmAction": "了解", + "label": "AIコマンド" + }, + "response": { + "customHandler": "これを実行してみてほしい:", + "noCommand": "申し訳ないが、そのようなコマンドは見当たらない。", + "theiaCommand": "こんなコマンドを見つけた:" + }, + "vars": { + "commandIds": { + "description": "Theiaで利用可能なコマンドのリスト。" + } + } + }, + "configureAgent": { + "header": "デフォルトエージェントを設定する" + }, + "continueAnyway": "とにかく続ける", + "createSkillAgent": { + "mode": { + "edit": "デフォルトモード" + } + }, + "enableAI": { + "mdDescription": "この設定により、最新のAI機能(ベータ版)にアクセスできます。 \n これらの機能はベータ版であるため、変更が加えられ、さらに改良される可能性があることにご注意ください。これらの機能は、アクセスを提供する言語モデル(LLM)に継続的なリクエストを生成する可能性があることを認識することが重要です。このため、綿密に監視する必要があるコストが発生する可能性があります。このオプションを有効にすることで、これらのリスクを認識することになります。 \n **ご注意ください!このセクションの以下の設定は、メイン機能の設定が有効になって初めて有効になります。\n このセクションの以下の設定は、メイン機能の設定が有効になって初めて有効になります。この機能を有効にした後、少なくとも1つのLLMプロバイダを以下に設定する必要があります。また、[ドキュメント](https://theia-ide.org/docs/user_ai/)**も参照してください。" + }, + "github": { + "configureGitHubServer": { + "canceled": "GitHub サーバー設定がキャンセルされました。このエージェントを使用するように GitHub MCP サーバーを設定してください。", + "no": "いいえ、キャンセル", + "yes": "はい、GitHubサーバーを設定します。" + }, + "errorCheckingGitHubServerStatus": "GitHub MCP サーバーステータスのチェックでエラーが発生しました:{0}", + "startGitHubServer": { + "canceled": "このエージェントを使用するには、GitHub MCP サーバーを起動してください。", + "error": "GitHub MCP サーバーの起動に失敗しました:{0}", + "no": "いいえ、キャンセル", + "progress": "GitHub MCPサーバーを起動します。", + "question": "GitHub MCP サーバーは設定されていますが、起動していません。今すぐ起動しますか?", + "yes": "はい、サーバーを起動してください" + } + }, + "githubRepoName": { + "description": "現在のGitHubリポジトリの名前 (例: \"eclipse-theia/theia\")" + }, + "model-selection-description": "AI Configuration View]({0})で、各AIエージェントが使用するLarge Language Models (LLM) を選択します。", + "moreAgentsAvailable": { + "header": "より多くのエージェントが利用可能です" + }, + "noRecommendedAgents": "推奨されるエージェントは利用できません。", + "openSettings": "AI設定を開く", + "or": "または", + "orchestrator": { + "error": { + "noAgents": "リクエストに対応できるチャットエージェントがいません。設定が有効になっているか確認してください。" + }, + "progressMessage": "最適なエージェントの決定", + "response": { + "delegatingToAgent": "{0}`への委任" + } + }, + "prompt-template-description": "AI Configuration View]({0})で、AIエージェントのプロンプトバリアントを選択し、プロンプトテンプレートをカスタマイズする。", + "recommendedAgents": "推奨される薬剤:", + "skillsConfiguration": { + "label": "スキル", + "location": { + "label": "場所" + } + }, + "toolsConfiguration": { + "confirmAlwaysAllow": { + "confirm": "承知しました、自動承認を有効にします", + "title": "「{0}」の自動承認を有効にしますか?" + }, + "confirmationMode": { + "label": "確認モード" + }, + "default": { + "label": "デフォルトのツール確認モード:" + }, + "resetAll": "すべてリセット", + "resetAllConfirmDialog": { + "msg": "すべてのツール確認モードをデフォルトにリセットしてもよろしいですか?これにより、すべてのカスタム設定が削除されます。", + "title": "全ツール確認モードリセット" + }, + "resetAllTooltip": "すべてのツールをデフォルトに戻す", + "toolOptions": { + "confirm": { + "label": "確認" + } + } + }, + "variableConfiguration": { + "selectVariable": "変数を選択してください。", + "usedByAgents": "エージェントが使用する", + "variableArgs": "変数の引数" + } + }, + "llamaFile": { + "prefs": { + "mdDescription": "この設定により、Theia IDEでLlamaFileモデルを設定・管理することができます。 \n 各エントリにはユーザーフレンドリーな `name` と、LlamaFile を指すファイル `uri` 、そして実行する `port` が必要です。 \n LlamaFileを起動するには、\"Start LlamaFile \"コマンドを使用します。 \n エントリーを編集した場合(例えば、ポートを変更した場合)、実行中のインスタンスは停止し、手動で再度起動する必要があります。 \n [LlamaFilesの設定と管理については、Theia IDEのドキュメントを参照してください](https://theia-ide.org/docs/user_ai/#llamafile-models)。", + "name": { + "description": "このLlamafileに使用するモデル名。" + }, + "port": { + "description": "サーバーの起動に使用するポート。" + }, + "title": "AIラマファイル", + "uri": { + "description": "LlamafileへのファイルURI。" + } + }, + "start": "ラマファイル開始", + "stop": "ラマファイル停止" + }, + "llamafile": { + "error": { + "noConfigured": "Llamafilesは設定されていない。", + "noRunning": "ラマファイルは動いていない。", + "startFailed": "llamafile の起動中に何か問題が発生しました:{0}.\n詳しくはコンソールを見てください。", + "stopFailed": "llamafile の停止中に何か問題が発生しました:{0}.\n詳しくはコンソールを見てください。" + } + }, + "mcp": { + "error": { + "allServersRunning": "すべてのMCPサーバーはすでに稼動している。", + "noRunningServers": "MCPサーバーは稼働していない。", + "noServersConfigured": "MCPサーバーが設定されていない。", + "startFailed": "MCPサーバーの起動中にエラーが発生しました。" + }, + "info": { + "serverStarted": "MCP サーバ \"{0}\" は正常に起動しました。登録されたツール{1}" + }, + "servers": { + "args": { + "mdDescription": "コマンドに渡す引数の配列。", + "title": "コマンドの引数" + }, + "autostart": { + "mdDescription": "フロントエンドの起動時にこのサーバを自動的に起動します。新しく追加されたサーバはすぐに自動起動されませんが、 再起動時に自動起動されます。", + "title": "オートスタート" + }, + "command": { + "mdDescription": "MCPサーバーの起動に使用されるコマンド、例えば \"uvx \"や \"npx\"。", + "title": "MCPサーバー実行コマンド" + }, + "env": { + "mdDescription": "APIキーなど、サーバーに設定するオプションの環境変数。", + "title": "環境変数" + }, + "headers": { + "mdDescription": "サーバーへの各リクエストに含まれるオプションの追加ヘッダー。", + "title": "ヘッダー" + }, + "mdDescription": "コマンド、引数、オプションで環境変数、自動起動(デフォルトではtrue)を使ってMCPサーバーを設定する。各サーバーは、\"brave-search \"や \"filesystem \"などの一意のキーで識別されます。サーバーを起動するには、\"MCP: Start MCP Server \"コマンドを使用します。サーバーを停止するには、\"MCP: Stop MCP Server \"コマンドを使用します。自動起動が有効になるのは再起動後であることに注意してください。\n設定例\n```{\n \"brave-search\":{\n \"command\":\"npx\"、\n \"args\":[\n \"-y\",\n \"@modelcontextprotocol/server-brave-search\"\n ],\n \"env\":{\n \"brave_api_key\":\"YOUR_API_KEY\"\n },\n },\n \"filesystem\":{\n \"command\":\"npx\"、\n \"args\":[\"-y\", \"@modelcontextprotocol/server-filesystem\", \"/Users/YOUR_USERNAME/Desktop\"]、\n 「env\":{\n \"custom_env_var\":\"custom-value\"\n },\n 「autostart\": false\n }\n}\n```", + "serverAuthToken": { + "mdDescription": "必要であれば、サーバーの認証トークン。これはリモートサーバとの認証に使用されます。", + "title": "認証トークン" + }, + "serverAuthTokenHeader": { + "mdDescription": "サーバ認証トークンに使用するヘッダー名。指定しなかった場合は、\"Authorization\" と \"Bearer\" が使用されます。", + "title": "認証ヘッダー名" + }, + "serverUrl": { + "mdDescription": "リモートMCPサーバのURL。指定された場合、サーバはローカル・プロセスを開始する代わりに、このURLに接続します。", + "title": "サーバーURL" + }, + "title": "MCPサーバーの構成" + }, + "start": { + "label": "MCP: MCPサーバーの起動" + }, + "stop": { + "label": "MCP:MCPサーバーの停止" + } + }, + "mcpConfiguration": { + "arguments": "論拠: ", + "autostart": "オートスタート: ", + "connectServer": "コネクト", + "connectingServer": "接続中...", + "copiedAllList": "すべてのツールをクリップボードにコピー(すべてのツールのリスト)", + "copiedAllSingle": "すべてのツールをクリップボードにコピー(すべてのツールを含む単一のプロンプトフラグメント)", + "copiedForPromptTemplate": "プロンプトテンプレートのためにすべてのツールをクリップボードにコピー(すべてのツールを含む単一のプロンプトフラグメント)", + "copyAllList": "すべてコピー(すべてのツールのリスト)", + "copyAllSingle": "チャットのためにすべてをコピーする(すべてのツールで単一のプロンプトフラグメント)", + "copyForPrompt": "コピーツール(チャットまたはプロンプトテンプレート用)", + "copyForPromptTemplate": "プロンプトテンプレートのすべてをコピーする(すべてのツールで単一のプロンプトフラグメント)", + "environmentVariables": "環境変数: ", + "headers": "ヘッダー ", + "noServers": "MCPサーバーが設定されていない", + "serverAuthToken": "認証トークン: ", + "serverAuthTokenHeader": "認証ヘッダー名: ", + "serverUrl": "サーバーのURL: ", + "tools": "道具だ: " + }, + "openai": { + "apiKey": { + "mdDescription": "公式 OpenAI アカウントの API キーを入力します。**注意:** この設定を使用すると、Open AI API キーが Theia を実行しているマシンにクリアテキストで保存されます。キーを安全に設定するには、環境変数 `OPENAI_API_KEY` を使用してください。" + }, + "customEndpoints": { + "apiKey": { + "title": "指定した url で提供される API にアクセスするためのキー、またはグローバルな OpenAI API キーを使用する場合は `true` のいずれか。" + }, + "apiVersion": { + "title": "Azure の指定した url で提供される API にアクセスするためのバージョン、またはグローバルな OpenAI API のバージョンを使用する場合は `true` のいずれか。" + }, + "deployment": { + "title": "Azure の指定された URL で提供される API にアクセスするためのデプロイメント名。" + }, + "developerMessageSettings": { + "title": "システムメッセージの処理を制御する:user`, `system`, `developer` がロールとして使用され、`mergeWithFollowingUserMessage`は次のユーザーメッセージの前にシステムメッセージを付加するか、次のメッセージがユーザーメッセージでない場合はシステムメッセージをユーザーメッセージに変換します。 デフォルトは `developer` です。" + }, + "enableStreaming": { + "title": "ストリーミングAPIを使用するかどうかを示す。デフォルトは `true` である。" + }, + "id": { + "title": "カスタムモデルを識別するためにUIで使われる一意な識別子。" + }, + "mdDescription": "例えば `vllm` を使って、OpenAI API と互換性のあるカスタムモデルを統合する。必須属性は `model` と `url` である。 \n オプションで \n - UI でカスタムモデルを識別するための一意な `id` を指定することができる。何も指定しない場合は `model` が `id` として使用される。 \n - 指定した url で提供される API にアクセスするための `apiKey` を指定する。グローバルな OpenAI API キーを使用する場合は `true` を使用する。 \n - apiVersion` を指定すると、指定した url で提供される Azure API にアクセスできるようになる。グローバルな OpenAI API バージョンを使用する場合は `true` を使用する。 \n - developerMessageSettings`を `user`、`system`、`developer`、`mergeWithFollowingUserMessage`、`skip` のいずれかに設定することで、開発者のメッセージをどのように含めるかを制御することができる(`user`、`system`、`developer` はロールとして使用され、`mergeWithFollowingUserMessage` は次のユーザメッセージの前にシステムメッセージを付加するか、次のメッセージがユーザメッセージでない場合にシステムメッセージをユーザメッセージに変換する)。skip`はシステムメッセージを削除します)。 デフォルトは `developer` です。 \n - supportsStructuredOutput:false`を指定すると、構造化出力を使用しないことを示す。 \n - enableStreaming: false` を指定すると、ストリーミングを使用しない。 \n 詳細は[our documentation](https://theia-ide.org/docs/user_ai/#openai-compatible-models-eg-via-vllm)を参照のこと。", + "modelId": { + "title": "モデルID" + }, + "supportsStructuredOutput": { + "title": "モデルが構造化出力をサポートしているかどうかを示す。デフォルトは `true` である。" + }, + "url": { + "title": "モデルがホストされているOpen AI API互換のエンドポイント" + } + }, + "models": { + "description": "OpenAIの公式使用モデル" + }, + "useResponseApi": { + "mdDescription": "公式OpenAIモデルのチャット完了APIの代わりに、より新しいOpenAIレスポンスAPIを使用します。この設定はOpenAIの公式モデルにのみ適用されます - カスタムプロバイダーは個別に設定する必要があります。" + } + }, + "promptTemplates": { + "directories": { + "title": "ワークスペース固有のプロンプト・テンプレート・ディレクトリ" + }, + "extensions": { + "description": "プロンプトのテンプレートとみなされる、 プロンプトの場所にある追加のファイル拡張子のリスト。'.prompttemplate' は常にデフォルトとみなされる。", + "title": "その他のプロンプト・テンプレート・ファイル拡張子" + }, + "files": { + "title": "ワークスペース固有のプロンプト・テンプレート・ファイル" + } + }, + "scanoss": { + "changeSet": { + "clean": "マッチなし", + "error": "エラー:再走行", + "error-notification": "ScanOSS エラーが発生:{0}.", + "match": "試合を見る", + "scan": "スキャン", + "scanning": "スキャン..." + }, + "mode": { + "automatic": { + "description": "チャットビューでコードスニペットの自動スキャンを有効にする。" + }, + "description": "チャットビューのコードスニペットを分析するためのSCANOSS機能を設定します。これにより、提案されたコードスニペットのハッシュが、[Software Transarency foundation]() がホストする SCANOSS\nサービス[Software Transparency Foundation](https://www.softwaretransparency.org/osskb)に送信します。", + "manual": { + "description": "ユーザーは、チャットビューのSCANOSS項目をクリックすることで、手動でスキャンをトリガーすることができます。" + }, + "off": { + "description": "機能は完全にオフになっている。" + } + }, + "snippet": { + "dialog-header": "スキャンOSSの結果", + "errored": "SCANOSS - エラー{0}", + "file-name-heading": "で見つかった。{0}", + "in-progress": "SCANOSS - スキャンを実行する...", + "match-count": "{0} に一致するものがあった。", + "matched": "SCANOSS -{0} 一致が見つかりました。", + "no-match": "SCANOSS - 該当なし", + "summary": "概要" + } + }, + "session-settings-dialog": { + "title": "セッション設定の設定", + "tooltip": "セッション設定の設定" + }, + "terminal": { + "agent": { + "description": "このエージェントは、任意のターミナルコマンドの記述と実行を支援する。 ユーザの要求に基づいてコマンドを提案し、ユーザが直接ターミナルに貼り付けて実行できるようにする。 コンテキストを考慮した支援を提供するために、カレントディレクトリ、環境、ターミナルセッションの最近のターミナル出力にアクセスします。", + "vars": { + "cwd": { + "description": "現在の作業ディレクトリ。" + }, + "recentTerminalContents": { + "description": "ターミナルに表示されている直近の0~50行。" + }, + "shell": { + "description": "使用されているシェル、例えば/usr/bin/zsh。" + }, + "userRequest": { + "description": "ユーザーの質問またはリクエスト。" + } + } + }, + "askAi": "AIに聞く", + "askTerminalCommand": "ターミナル・コマンドについて尋ねる", + "hitEnterConfirm": "エンターキーを押して確認する", + "howCanIHelp": "どうされましたか?", + "loading": "ローディング", + "tryAgain": "もう一度...", + "useArrowsAlternatives": "または ↪So_21C5 を使って選択肢を示す..." + }, + "tokenUsage": { + "cachedInputTokens": "キャッシュに書き込まれた入力トークン", + "cachedInputTokensTooltip": "入力トークン」に追加して追跡される。通常、キャッシュされていないトークンよりも高価。", + "failedToGetTokenUsageData": "トークン使用データのフェッチに失敗しました:{0}", + "inputTokens": "入力トークン", + "label": "トークンの使用", + "lastUsed": "最後の使用", + "model": "モデル", + "noData": "トークンの使用データはまだない。", + "note": "トークンの使用はアプリケーションの開始時から追跡され、永続化されない。", + "outputTokens": "出力トークン", + "readCachedInputTokens": "キャッシュから読み込まれた入力トークン", + "readCachedInputTokensTooltip": "インプット・トークン」に追加して追跡される。通常、キャッシュされないよりもはるかに低コスト。通常、レート制限にはカウントされない。", + "total": "合計", + "totalTokens": "トークン合計", + "totalTokensTooltip": "'入力トークン' + '出力トークン'" + }, + "vercelai": { + "anthropicApiKey": { + "mdDescription": "AnthropicモデルのAPIキーを入力してください。**Please note:** この環境設定を使用することで、APIキーはTheiaを実行しているマシンにクリアテキストで保存されます。キーを安全に設定するには環境変数 `ANTHROPIC_API_KEY` を使用してください。" + }, + "customEndpoints": { + "apiKey": { + "title": "指定した url で提供される API にアクセスするためのキー、またはグローバル API キーを使用する場合は `true` のいずれか。" + }, + "enableStreaming": { + "title": "ストリーミングAPIを使用するかどうかを示す。デフォルトは `true` である。" + }, + "id": { + "title": "カスタムモデルを識別するためにUIで使われる一意な識別子。" + }, + "mdDescription": "Vercel AI SDKと互換性のあるカスタムモデルを統合する。必須属性は `model` と `url` です。 \n オプションで \n - UI でカスタムモデルを識別するための一意の `id` を指定します。何も指定しない場合は `model` が `id` として使用される。 \n - 指定した url で提供される API にアクセスするための `apiKey` を指定する。グローバル API キーを使用する場合は `true` を指定する。 \n - supportsStructuredOutput:false`を指定すると、構造化出力を使用しないことを示す。 \n - enableStreaming: false` を指定すると、ストリーミングを使用しないことを示す。 \n - provider`を指定すると、モデルの提供元を指定することができる(openai、anthropic)。", + "modelId": { + "title": "モデルID" + }, + "supportsStructuredOutput": { + "title": "モデルが構造化出力をサポートしているかどうかを示す。デフォルトは `true` である。" + }, + "url": { + "title": "モデルがホストされているAPIエンドポイント" + } + }, + "models": { + "description": "Vercel AI SDKで使用する公式モデル", + "id": { + "title": "モデルID" + }, + "model": { + "title": "モデル名" + } + }, + "openaiApiKey": { + "mdDescription": "OpenAIモデルのAPIキーを入力します。**Please note:** この環境設定を使用することで、APIキーはTheiaを実行しているマシンにクリアテキストで保存されます。キーを安全に設定するには、環境変数 `OPENAI_API_KEY` を使用してください。" + } + }, + "workspace": { + "coderAgent": { + "description": "Theia IDEに統合されたAIアシスタントで、ソフトウェア開発者を支援するように設計されています。このエージェントはユーザーのワークスペースにアクセスし、利用可能なすべてのファイルとフォルダのリストを取得し、その内容を取得することができます。さらに、ユーザーにファイルの修正を提案することもできます。そのため、コーディング作業やファイルの変更を伴う他の作業でユーザを支援することができます。" + }, + "considerGitignore": { + "description": "有効にすると、グローバルな .gitignore ファイルで指定されたファイル/フォルダーを除外します(想定される場所はワークスペースのルートです)。", + "title": ".gitignoreを考える" + }, + "excludedPattern": { + "description": "除外するファイル/フォルダのパターン(グロブまたは正規表現)のリスト。", + "title": "除外ファイルパターン" + }, + "searchMaxResults": { + "description": "ワークスペース検索機能が返す検索結果の最大数。", + "title": "最大検索結果" + }, + "workspaceAgent": { + "description": "Theia IDEに統合されたAIアシスタントで、ソフトウェア開発者を支援するように設計されています。このエージェントはユーザーのワークスペースにアクセスし、利用可能なすべてのファイルとフォルダのリストを取得し、その内容を取得することができます。ファイルを変更することはできません。そのため、プロジェクトをどのように構築するか、ソースコードをどこに置くか、特定のコードや設定をどこで見つけるかなど、現在のプロジェクト、プロジェクトファイル、ワークスペース内のソースコードに関する質問に答えることができます。" + } + } + }, + "ai-chat": { + "fileChangeSetTitle": "変更案" + }, + "ai-chat-ui": { + "initiate-session-task-context": "タスクのコンテキストセッションの開始", + "open-current-session-summary": "開会中のセッション概要", + "open-settings-tooltip": "AIの設定を開く...", + "scroll-lock": "ロック・スクロール", + "scroll-unlock": "スクロールのロック解除", + "session-settings": "セッション設定の設定", + "showChats": "チャットを表示...", + "summarize-current-session": "現在のセッションを総括する" + }, + "ai-claude-code": { + "open-config": "オープンクロードコードの構成", + "open-memory": "クロード・コード・メモリ(CLAUDE.MD)を開く" + }, + "ai-core": { + "agentCompletionMessage": "エージェント \"{0}\" は任務を完了した。", + "agentCompletionTitle": "エージェント \"{0}\" タスク完了", + "agentCompletionWithTask": "エージェント \"{0}\" はタスクを完了した:{1}" + }, + "ai-editor": { + "contextMenu": "AIに聞く", + "sendToChat": "AIチャットに送る" + }, + "ai-ide": { + "addressGhReviewCommand": { + "argumentHint": "", + "description": "GitHubのプルリクエストに対するレビューコメントへの対応" + }, + "fixGhTicketCommand": { + "argumentHint": "", + "description": "GitHubチケットを分析し、解決策を実装する" + }, + "open-agent-settings-tooltip": "エージェントの設定を開く...", + "rememberCommand": { + "argumentHint": "[トピックヒント]", + "description": "会話からトピックを抽出し、プロジェクト情報を更新する" + }, + "ticketCommand": { + "argumentHint": "", + "description": "GitHubチケットを分析し、実装計画を作成する" + }, + "todoTool": { + "noTasks": "タスクなし" + }, + "withAppTesterCommand": { + "description": "テストをAppTesterエージェントに委譲する(エージェントモードが必要)" + } + }, + "ai-mcp": { + "blockedServersLabel": "MCPサーバー(自動起動がブロックされています)" + }, + "ai-terminal": { + "cancelExecution": "コマンドの実行をキャンセルする", + "canceling": "キャンセル中...", + "confirmExecution": "シェルコマンドの確認", + "denialReason": "理由", + "executionCanceled": "キャンセルされました", + "executionDenied": "拒否された", + "executionDeniedWithReason": "理由により拒否された", + "noOutput": "出力なし", + "partialOutput": "部分出力", + "timeout": "タイムアウト", + "workingDirectory": "作業ディレクトリ" + }, + "callhierarchy": { + "noCallers": "発信者は検出されていません。", + "open": "オープンコールヒエラルキー" + }, + "chat": { + "taskContextVariable": { + "args": { + "contextId": { + "description": "取得するタスクコンテキストのID、または要約するチャットセッション。" + } + }, + "description": "タスクのコンテキスト情報を提供する。例えば、タスクを完了するための計画や、以前のセッションの要約など。", + "label": "タスク・コンテキスト" + } + }, + "collaboration": { + "collaborate": "コラボレーション", + "collaboration": "コラボレーション", + "collaborationWorkspace": "コラボレーション・ワークスペース", + "connected": "接続済み", + "connectedSession": "コラボレーション・セッションに接続", + "copiedInvitation": "招待状コードがクリップボードにコピーされました。", + "copyAgain": "コピー・アゲイン", + "createRoom": "新しいコラボレーション・セッションの作成", + "creatingRoom": "セッションの作成", + "end": "コラボレーション・セッション終了", + "endDetail": "セッションを終了し、コンテンツの共有を停止し、他の人のアクセスを取り消す。", + "enterCode": "コラボレーションセッションコードを入力", + "failedCreate": "部屋の作成に失敗しました:{0}", + "failedJoin": "入室に失敗:{0}", + "fieldRequired": "{0} フィールドは必須です。ログインが中断されました。", + "invite": "他の人を招待する", + "inviteDetail": "招待コードをコピーして他の人と共有し、セッションに参加してください。", + "joinRoom": "コラボレーション・セッションに参加", + "joiningRoom": "セッションへの参加", + "leave": "コラボレーション・セッション", + "leaveDetail": "現在のコラボレーションセッションから切断し、ワークスペースを閉じます。", + "loginFailed": "ログインに失敗しました。", + "loginSuccessful": "ログインに成功しました。", + "noAuth": "サーバーが提供する認証方法がない。", + "optional": "任意", + "selectAuth": "認証方法の選択", + "selectCollaboration": "コラボレーション・オプションを選択", + "serverUrl": "サーバーURL", + "serverUrlDescription": "ライブコラボレーションセッション用のOpen Collaboration Tools ServerインスタンスのURL", + "sharedSession": "コラボレーション・セッションを共有", + "startSession": "コラボレーションセッションの開始または参加", + "userWantsToJoin": "ユーザー '{0}' がコラボレーションルームへの参加を希望しています。", + "whatToDo": "他の協力者とどんなことをしたいですか?" + }, + "core": { + "about": { + "compatibility": "{0} 互換性", + "defaultApi": "デフォルト{0} API", + "listOfExtensions": "エクステンション一覧" + }, + "common": { + "closeAll": "すべてのタブを閉じる", + "closeAllTabMain": "メインエリアのすべてのタブを閉じる", + "closeOtherTabMain": "メインエリアの他のタブを閉じる", + "closeOthers": "他のタブを閉じる", + "closeRight": "閉じるタブを右に", + "closeTab": "タブを閉じる", + "closeTabMain": "メインエリアのタブを閉じる", + "collapseAllTabs": "すべてのサイドパネルを閉じる", + "collapseBottomPanel": "トグルボトムパネル", + "collapseLeftPanel": "トグル左パネル", + "collapseRightPanel": "トグル右パネル", + "collapseTab": "折りたたみ式サイドパネル", + "showNextTabGroup": "次のタブグループに切り替える", + "showNextTabInGroup": "グループ内の次のタブに切り替える", + "showPreviousTabGroup": "前のタブグループに切り替える", + "showPreviousTabInGroup": "グループ内の前のタブに切り替える", + "toggleMaximized": "トグル・マキシマイズ" + }, + "copyInfo": "まずファイルを開き、そのパスをコピーする", + "copyWarn": "ブラウザのコピーコマンドまたはショートカットをご利用ください。", + "cutWarn": "ブラウザのカットコマンドまたはショートカットをご利用ください。", + "enhancedPreview": { + "classic": "タブの基本情報を含む簡単なプレビューを表示する。", + "enhanced": "追加情報を含むタブの拡張プレビューを表示します。", + "visual": "タブのビジュアルプレビューを表示する。" + }, + "file": { + "browse": "ブラウズ" + }, + "highlightModifiedTabs": "モディファイド(ダーティ)エディタのタブにトップボーダーを描画するかどうかを制御します。", + "keybinding": { + "duplicateModifierError": "キーバインドを解析できない{0} モディファイアの重複", + "metaError": "キーバインドを解析できない{0} メタはOSX専用", + "unrecognizedKeyError": "認識されていないキー{0} {1}" + }, + "keybindingStatus": "{0}が押されたので、さらにキーを待つ", + "keyboard": { + "choose": "キーボードレイアウトの選択", + "chooseLayout": "キーボードレイアウトの選択", + "current": "(現在: {0})", + "currentLayout": "- 現在のレイアウト", + "mac": "Mac用キーボード", + "pc": "PCキーボード", + "tryDetect": "ブラウザの情報や押されたキーからキーボードの配列を検出してみてください。" + }, + "navigator": { + "clipboardWarn": "クリップボードへのアクセスが拒否されました。ブラウザのアクセス許可を確認してください。", + "clipboardWarnFirefox": "クリップボードAPIは使用できません。これは、'{1}' ページの '{0}' 環境設定によって有効にすることができます。その後Theiaをリロードしてください。これにより、FireFoxがシステムクリップボードにフルアクセスできるようになります。" + }, + "offline": "オフライン", + "pasteWarn": "ブラウザの貼り付けコマンドまたはショートカットをご利用ください。", + "quitMessage": "保存されていない変更は、保存されません。", + "resetWorkbenchLayout": "ワークベンチレイアウトのリセット", + "searchbox": { + "close": "閉じる(エスケープ)", + "next": "次へ(下)", + "previous": "前へ (上)", + "showAll": "すべてのアイテムを表示", + "showOnlyMatching": "一致するアイテムのみを表示" + }, + "secondaryWindow": { + "alwaysOnTop": "有効にすると、セカンダリウィンドウは、異なるアプリケーションを含む他のすべてのウィンドウの上に表示されます。", + "description": "抽出されたセカンダリウィンドウの初期位置とサイズを設定する。", + "fullSize": "抽出されたウィジェットの位置とサイズは、実行中のTheiaアプリケーションと同じになります。", + "halfWidth": "抽出されたウィジェットの位置とサイズは、実行中のTheiaアプリケーションの幅の半分になります。", + "originalSize": "抽出されたウィジェットの位置とサイズは、元のウィジェットと同じになる。" + }, + "severity": { + "log": "ログ" + }, + "silentNotifications": "通知のポップアップを抑制するかどうかを制御します。", + "tabDefaultSize": "タブのデフォルトサイズを指定します。", + "tabMaximize": "ダブルクリック時にタブを最大化するかどうかを制御します。", + "tabMinimumSize": "タブの最小サイズを指定します。", + "tabShrinkToFit": "タブを縮小して、空きスペースに合わせる。", + "window": { + "tabCloseIconPlacement": { + "description": "タブタイトルのクローズアイコンをタブの先頭または末尾に配置します。すべてのプラットフォームで、デフォルトは末尾です。", + "end": "閉じるアイコンをラベルの最後に配置します。左から右への言語では、これはタブの右側です。", + "start": "閉じるアイコンをラベルの先頭に配置します。左から右への言語では、これはタブの左側です。" + } + }, + "window.menuBarVisibility": "メニューはサイドバーにコンパクトなボタンとして表示されます。この値は が の場合{0}無視{1}されます。" + }, + "debug": { + "TheiaIDE": "テイアIDE", + "addConfigurationPlaceholder": "設定を追加するワークスペース・ルートを選択します。", + "breakpoint": "ブレークポイント", + "cannotRunToThisLocation": "現在のスレッドを指定された場所まで実行できなかった。", + "compound-cycle": "起動構成 '{0}' は自分自身とのサイクルを含む", + "conditionalBreakpoint": "条件付きブレークポイント", + "conditionalBreakpointsNotSupported": "このデバッグタイプではサポートされていない条件付きブレークポイント", + "confirmRunToShiftedPosition_msg": "目標位置は Ln{0}, Col{1} に移動する。とにかく走る?", + "confirmRunToShiftedPosition_title": "現在のスレッドを指定された場所まで正確に実行できない", + "consoleFilter": "フィルター(例:テキスト、!除外)", + "consoleFilterAriaLabel": "デバッグコンソールの出力をフィルタリングする", + "consoleSessionSelectorTooltip": "デバッグセッションを切り替えます。各デバッグセッションには独自のコンソール出力があります。", + "consoleSeverityTooltip": "コンソール出力を重大度レベルでフィルタリングします。選択した重大度を持つメッセージのみが表示されます。", + "continueAll": "すべてを続ける", + "copyExpressionValue": "コピー式の値", + "couldNotRunTask": "タスク「{0} 」を実行できませんでした。", + "dataBreakpoint": "データブレークポイント", + "debugConfiguration": "デバッグ設定", + "debugSessionInitializationFailed": "デバッグ・セッションの初期化に失敗しました。詳細はコンソールを参照してください。", + "debugSessionTypeNotSupported": "デバッグ・セッション・タイプ \"{0}\" はサポートされていません。", + "debugToolbarMenu": "デバッグツールバーメニュー", + "debugVariableInput": "設定{0} 値", + "disableSelectedBreakpoints": "選択したブレークポイントを無効にする", + "disabledBreakpoint": "無効{0}", + "enableSelectedBreakpoints": "選択したブレークポイントを有効にする", + "entry": "エントリー", + "errorStartingDebugSession": "デバッグ・セッションの開始時にエラーが発生しました。", + "exception": "例外", + "functionBreakpoint": "関数ブレークポイント", + "goto": "行く", + "htiConditionalBreakpointsNotSupported": "このデバッグタイプでサポートされていない条件付きブレークポイントを押す", + "instruction-breakpoint": "命令ブレークポイント", + "instructionBreakpoint": "命令ブレークポイント", + "logpointsNotSupported": "このデバッグタイプでサポートされていないログポイント", + "missingConfiguration": "ダイナミックコンフィギュレーション「{0}:{1}」が存在しないか、適用できない", + "pause": "ポーズ", + "pauseAll": "ポーズ・オール", + "reveal": "暴露", + "step": "ステップ", + "taskTerminatedBySignal": "タスク '{0}' はシグナル{1} によって終了した。", + "taskTerminatedForUnknownReason": "タスク '{0}' が原因不明で終了した。", + "taskTerminatedWithExitCode": "タスク '{0}' は終了コード{1} で終了した。", + "threads": "スレッド", + "toggleTracing": "デバッグアダプタとの通信のトレースの有効化/無効化", + "unknownSession": "不明セッション", + "unverifiedBreakpoint": "未確認{0}" + }, + "editor": { + "diffEditor.wordWrap2": "行は `#editor.wordWrap#` の設定に従って折り返されます。", + "dirtyEncoding": "ファイルが汚れています。別のエンコーディングで開き直す前に、まず保存してください。", + "editor.bracketPairColorization.enabled": "ブラケットペアのカラー化を有効にするかどうかを制御する。ブラケットのハイライト色を上書きするには `#workbench.colorCustomizations#` を使用してください。", + "editor.codeActions.triggerOnFocusChange": "files.autoSave#`が`afterDelay`に設定されているときに、`#editor.codeActionsOnSave#`をトリガーできるようにした。ウィンドウやフォーカスが変わったときにコードアクションがトリガーされるようにするには、`always`に設定する必要があります。", + "editor.detectIndentation": "ファイルを開いたときに、ファイルの内容に基づいて `#editor.tabSize#` と `#editor.insertSpaces#` を自動的に検出するかどうかを制御する。", + "editor.experimental.preferTreeSitter": "特定の言語に対してツリーシッター解析を有効にするかどうかを制御します。指定された言語については、`editor.experimental.treeSitterTelemetry`よりも優先されます。", + "editor.inlayHints.enabled1": "インレイのヒントはデフォルトで表示され、`Ctrl+Alt`を押すと隠れます。", + "editor.inlayHints.enabled2": "インレイのヒントはデフォルトでは非表示で、`Ctrl+Alt`を押したときに表示されます。", + "editor.inlayHints.fontFamily": "エディタのインレイヒントのフォントファミリーを制御する。空に設定すると、`#editor.fontFamily#`が使用されます。", + "editor.inlayHints.fontSize": "エディタのインレイヒントのフォントサイズを制御する。デフォルトでは`#editor.fontSize#`が使用され、設定値が`5`未満またはエディタのフォントサイズより大きい場合に使用されます。", + "editor.inlineSuggest.edits.experimental.enabled": "インラインサジェストで実験的な編集を有効にするかどうかを制御します。", + "editor.inlineSuggest.edits.experimental.onlyShowWhenCloseToCursor": "カーソルがサジェストの近くにあるときだけインライン・サジェストを表示するかどうかをコントロールする。", + "editor.inlineSuggest.edits.experimental.useInterleavedLinesDiff": "インライン提案で実験的インターリーブ行の差分を有効にするかどうかを制御する。", + "editor.inlineSuggest.edits.experimental.useMixedLinesDiff": "インラインサジェストで実験的な編集を有効にするかどうかを制御します。", + "editor.insertSpaces": "Tab`を押したときにスペースを挿入する。この設定は、`#editor.detectIndentation#`がオンの場合、ファイルの内容によって上書きされる。", + "editor.quickSuggestions": "入力中に自動的にサジェストを表示するかどうかを制御します。コメント、文字列、その他のコードを入力する際に制御できます。クイックサジェストは、ゴーストテキストとして表示するか、サジェストウィジェットで表示するかを設定できます。また、'#editor.suggestOnTriggerCharacters#'設定は、特殊な文字でサジェストが発生するかどうかを制御します。", + "editor.suggestFontSize": "サジェストウィジェットのフォントサイズ。0`に設定すると、`#editor.fontSize#`の値が使用される。", + "editor.suggestLineHeight": "提案ウィジェットの行の高さ。0`に設定すると、`#editor.lineHeight#`の値が使用される。最小値は8。", + "editor.tabSize": "タブのスペース数。この設定は、`#editor.detectIndentation#`がオンの場合、ファイルの内容によって上書きされる。", + "formatOnSaveTimeout": "ファイル保存時に実行されるフォーマットがキャンセルされるまでのタイムアウト(ミリ秒)。", + "persistClosedEditors": "ウィンドウの再読み込み時に、ワークスペースの閉じたエディタの履歴を保持するかどうかを制御します。", + "showAllEditors": "開いているエディタをすべて表示", + "splitHorizontal": "スプリットエディタ横", + "splitVertical": "スプリットエディタ縦", + "toggleStickyScroll": "固定スクロールの切り替えル" + }, + "external-terminal": { + "cwd": "新しい外部端末の現在の作業ディレクトリを選択する" + }, + "file-search": { + "toggleIgnoredFiles": "({0}を押すと、無視されたファイルの表示/非表示を切り替えることができます。" + }, + "fileDialog": { + "showHidden": "隠しファイルを表示する" + }, + "fileSystem": { + "fileResource": { + "overWriteBody": "ファイルシステム上の'{0}'に加えられた変更を上書きしますか?" + } + }, + "filesystem": { + "copiedToClipboard": "ダウンロードリンクをクリップボードにコピー。", + "copyDownloadLink": "コピー・ダウンロード・リンク", + "dialog": { + "initialLocation": "初期位置へ移動", + "multipleItemMessage": "選択できる項目は1つだけです", + "navigateBack": "戻る", + "navigateForward": "ナビゲートフォワード", + "navigateUp": "ディレクトリを1つ上に移動する" + }, + "fileResource": { + "binaryFileQuery": "開くと時間がかかり、IDEが反応しなくなる可能性があります。とにかく'{0}'を開きたいのですか?", + "binaryTitle": "ファイルがバイナリであるか、サポートされていないテキストエンコーディングが使用されています。", + "largeFileTitle": "ファイルが大きすぎます({0})。", + "overwriteTitle": "ファイル '{0}' はファイルシステム上で変更されました。" + }, + "filesExclude": "ファイルやフォルダーを除外するためのグロブパターンを設定します。例えば、ファイルエクスプローラーでは、この設定をもとにファイルやフォルダーの表示・非表示を決定します。", + "format": "フォーマット:", + "maxConcurrentUploads": "複数のファイルをアップロードする際に、同時にアップロードするファイルの最大数です。0の場合は、すべてのファイルが同時にアップロードされます。", + "maxFileSizeMB": "開くことのできる最大ファイルサイズ(MB)を制御します。", + "prepareDownload": "ダウンロードの準備中...", + "prepareDownloadLink": "ダウンロードリンクの準備中...", + "processedOutOf": "{1}のうち{0}を処理", + "replaceTitle": "ファイルの置き換え", + "uploadFailed": "ファイルのアップロード中にエラーが発生しました。{0}", + "uploadFiles": "ファイルのアップロード...", + "uploadedOutOf": "{1}のうち{0}をアップロードしました。" + }, + "getting-started": { + "ai": { + "header": "Theia IDEのAIサポートが利用可能になりました(ベータ版)!", + "openAIChatView": "今すぐAIチャットビューを開いて、始め方を学びましょう!" + }, + "apiComparator": "{0} API互換性", + "newExtension": "新しいエクステンションの構築", + "newPlugin": "新しいプラグインの構築", + "startup-editor": { + "welcomePage": "{0} とエクステンションを使い始めるのに役立つコンテンツを含む、ようこそページを開きます。" + }, + "telemetry": "データ使用と遠隔測定" + }, + "git": { + "aFewSecondsAgo": "さきほど", + "addSignedOff": "サイン・オフ・バイの追加", + "added": "追加", + "amendReuseMessage": "最後のコミットメッセージを再利用するには、「Enter」または「Escape」を押してキャンセルしてください。", + "amendRewrite": "前回のコミットメッセージを書き換えます。確定するには「Enter」を、キャンセルするには「Escape」を押してください。", + "checkoutCreateLocalBranchWithName": "名前:{0}で新しいローカルブランチを作成します。確定するには「Enter」を、キャンセルするには「Escape」を押してください。", + "checkoutProvideBranchName": "支店名をご記入ください。", + "checkoutSelectRef": "チェックアウトするRefを選択するか、新しいローカルブランチを作成します。", + "cloneQuickInputLabel": "Gitリポジトリの場所を指定してください。確定するには「Enter」を、キャンセルするには「Escape」を押してください。", + "cloneRepository": "Gitリポジトリをクローンします。{0}.確定するには「Enter」を、キャンセルするには「Escape」を押します。", + "compareWith": "比べてみると...", + "compareWithBranchOrTag": "現在アクティブな{0}のブランチと比較するブランチやタグを選びます。", + "conflicted": "葛藤", + "copied": "コピー", + "diff": "差分", + "dirtyDiffLinesLimit": "エディタの行数がこの制限を超えている場合、ダーティな diff デコレーションを表示しません。", + "dropStashMessage": "スタッシュの削除に成功しました。", + "editorDecorationsEnabled": "エディタにgitデコレーションを表示します。", + "fetchPickRemote": "フェッチするリモートを選びます。", + "gitDecorationsColors": "ナビゲーターに色の装飾を施す。", + "mergeEditor": { + "currentSideTitle": "現在", + "incomingSideTitle": "着信" + }, + "mergeQuickPickPlaceholder": "現在アクティブな{0}ブランチにマージするブランチを選びます。", + "missingUserInfo": "gitで「user.name」と「user.email」を設定していることを確認してください。", + "noHistoryForError": "の履歴はありません。{0}", + "noPreviousCommit": "修正する前のコミットがない", + "noRepositoriesSelected": "リポジトリが選択されていません。", + "prepositionIn": "で", + "renamed": "名称変更", + "repositoryNotInitialized": "リポジトリ {0} はまだ初期化されていません。", + "stashChanges": "スタッシュの変更確定するには「Enter」を、キャンセルするには「Escape」を押します。", + "stashChangesWithMessage": "メッセージでスタッシュが変わります。{0}.確定するには「Enter」を、キャンセルするには「Escape」を押してください。", + "tabTitleIndex": "{0} (インデックス)", + "tabTitleWorkingTree": "{0} (ワーキングツリー)", + "toggleBlameAnnotations": "トグル・ブレイム・アノテーション", + "unstaged": "舞台なし" + }, + "keybinding-schema-updater": { + "deprecation": "代わりに `when` 句を使用してください。" + }, + "keymaps": { + "addKeybindingTitle": "のキーバインドを追加{0}", + "editKeybinding": "キーバインドを編集...", + "editKeybindingTitle": "{0}のキーバインドを編集する", + "editWhenExpression": "Edit When Expression...", + "editWhenExpressionTitle": "を表す式を編集する{0}", + "keybinding": { + "copy": "コピー・キーバインド", + "copyCommandId": "キーバインドコマンドIDのコピー", + "copyCommandTitle": "キーバインドコマンドのタイトルをコピーする", + "edit": "キーバインドを編集...", + "editWhenExpression": "キーバインドを編集する(Expression..." + }, + "keybindingCollidesValidation": "キーバインドがコリジョン中", + "requiredKeybindingValidation": "キーバインド値が必要です", + "resetKeybindingConfirmation": "このキーバインドを本当に初期値に戻すのですか?", + "resetKeybindingTitle": "{0}のキーバインドをリセットする", + "resetMultipleKeybindingsWarning": "このコマンドに複数のキーバインドが存在する場合は、すべてのキーバインドがリセットされます。" + }, + "localize": { + "offlineTooltip": "バックエンドに接続できません。" + }, + "markers": { + "clearAll": "クリアオール", + "noProblems": "これまでのところ、ワークスペースに問題は検出されていません。", + "tabbarDecorationsEnabled": "タブバーに問題のデコレーター(診断マーカー)を表示する。" + }, + "memory-inspector": { + "addressTooltip": "表示するメモリ位置、アドレス、またはアドレスに評価される式", + "ascii": "ASCII", + "binary": "バイナリ", + "byteSize": "バイトサイズ", + "bytesPerGroup": "1グループあたりのバイト数", + "closeSettings": "設定を閉じる", + "columns": "コラム", + "command": { + "createNewMemory": "新しいメモリインスペクタの作成", + "createNewRegisterView": "新規登録ビューの作成", + "followPointer": "フォローポインター", + "followPointerMemory": "メモリインスペクタでポインタをフォローする", + "resetValue": "リセット値", + "showRegister": "メモリインスペクタにレジスタを表示する", + "viewVariable": "メモリインスペクタに変数を表示する" + }, + "data": "データ", + "decimal": "10進数", + "diff": { + "label": "差分です。{0}" + }, + "diff-widget": { + "offset-label": "{0} オフセット", + "offset-title": "からメモリをオフセットするバイト数{0}" + }, + "editable": { + "apply": "変更を適用する", + "clear": "クリアランス" + }, + "endianness": "エンディアン", + "extraColumn": "エクストラコラム", + "groupsPerRow": "1行あたりのグループ数", + "hexadecimal": "十六進法", + "length": "長さ", + "lengthTooltip": "取得するバイト数(10進数または16進数)。", + "memory": { + "addressField": { + "memoryReadError": "所在地欄に住所または式を入力する。" + }, + "freeze": "フリーズメモリービュー", + "hideSettings": "設定パネルの非表示", + "readError": { + "bounds": "メモリ境界を超えたため、結果は切り捨てられます。", + "noContents": "現在、メモリーコンテンツはございません。" + }, + "readLength": { + "memoryReadError": "Lengthの欄に長さ(10進数または16進数)を入力する。" + }, + "showSettings": "設定パネルを表示する", + "unfreeze": "アンフリーズメモリービュー", + "userError": "メモリの取り込みにエラーが発生しました。" + }, + "memoryCategory": "メモリーインスペクター", + "memoryInspector": "メモリーインスペクター", + "memoryTitle": "メモリ", + "octal": "八進数", + "offset": "オフセット", + "offsetTooltip": "ナビゲート時に現在のメモリ位置に追加されるオフセット値", + "provider": { + "localsError": "ローカル変数を読み取ることができません。アクティブなデバッグ・セッションがありません。", + "readError": "メモリを読み込むことができません。アクティブなデバッグセッションがありません。", + "writeError": "メモリの書き込みができません。アクティブなデバッグセッションがありません。" + }, + "register": "登録", + "register-widget": { + "filter-placeholder": "フィルター(で始まる)" + }, + "registerReadError": "レジスタの取得にエラーが発生しました。", + "registers": "レジスター", + "toggleComparisonWidgetVisibility": "比較ウィジェットの可視性をトグルする", + "utils": { + "afterBytes": "比較したい両方のウィジェットにメモリを搭載する必要があります。{0} はメモリが搭載されていません。", + "bytesMessage": "比較したい両方のウィジェットにメモリを搭載する必要があります。{0} はメモリが搭載されていません。" + } + }, + "messages": { + "notificationTimeout": "このタイムアウト後は、情報提供のための通知が非表示になります。", + "toggleNotifications": "通知の切り替え" + }, + "mini-browser": { + "typeUrl": "URLを入力する" + }, + "monaco": { + "noSymbolsMatching": "シンボルが一致しない", + "typeToSearchForSymbols": "記号を検索するタイプ" + }, + "navigator": { + "autoReveal": "オートリヴェール", + "clipboardWarn": "クリップボードへのアクセスが拒否されました。ブラウザのアクセス許可を確認してください。", + "clipboardWarnFirefox": "クリップボードAPIは使用できません。これは、'{1}' ページの '{0}' 環境設定によって有効にすることができます。その後Theiaをリロードしてください。これにより、FireFoxがシステムクリップボードにフルアクセスできるようになります。", + "openWithSystemEditor": "システムエディタで開く", + "refresh": "エクスプローラーでの更新", + "reveal": "エクスプローラーでの表示", + "systemEditor": "システムエディター", + "toggleHiddenFiles": "隠しファイルのトグル" + }, + "output": { + "clearOutputChannel": "クリア出力チャンネル...", + "closeOutputChannel": "出力チャンネルを閉じる...", + "hiddenChannels": "隠しチャンネル", + "hideOutputChannel": "出力チャンネルを隠す...", + "maxChannelHistory": "1つの出力チャネルの最大エントリ数。", + "outputChannels": "出力チャンネル", + "showOutputChannel": "出力チャンネルを表示..." + }, + "plugin": { + "blockNewTab": "お使いのブラウザで新しいタブを開くことができませんでした" + }, + "plugin-dev": { + "alreadyRunning": "ホストされているインスタンスはすでに実行されています。", + "debugInstance": "デバッグインスタンス", + "debugMode": "Node.js のデバッグに inspect または inspect-brk を使用する", + "debugPorts": { + "debugPort": "このサーバーのNode.jsデバッグに使用するポート。" + }, + "devHost": "開発ホスト", + "failed": "ホストされたプラグインインスタンスの実行に失敗しました。{0}", + "hostedPlugin": "ホスト型プラグイン", + "hostedPluginRunning": "ホスト型プラグイン: 実行中", + "hostedPluginStarting": "ホスト型プラグイン: 開始", + "hostedPluginStopped": "ホスト型プラグイン: 停止中", + "hostedPluginWatching": "ホストされたプラグイン: ウォッチング", + "instanceTerminated": "{0}は終了しました。", + "launchOutFiles": "生成されたJavaScriptファイルを探すためのグロブパターンの配列です(`${pluginPath}`はプラグインの実際のパスに置き換えられます)。", + "noValidPlugin": "指定されたフォルダに有効なプラグインが含まれていません。", + "notRunning": "ホスト側のインスタンスが起動していない。", + "pluginFolder": "プラグインフォルダが設定されています。{0}", + "preventedNewTab": "お使いのブラウザで新しいタブが開かない", + "restartInstance": "インスタンスの再起動", + "running": "ホストされているインスタンスは、次のように実行されています。", + "selectPath": "セレクトパス", + "startInstance": "インスタンスの開始", + "starting": "ホストされたインスタンス・サーバーの起動 ...", + "stopInstance": "インスタンスの停止", + "unknownTerminated": "インスタンスが終了しました。", + "watchMode": "開発中のプラグインにウォッチャーを実行" + }, + "plugin-ext": { + "authentication-main": { + "loginTitle": "ログイン", + "signedOut": "サインアウトに成功しました。" + }, + "plugins": "プラグイン", + "webviewTrace": "ウェブビューによる通信のトレースを制御します。", + "webviewWarnIfUnsecure": "現在、ウェブビューが安全でない状態で展開されていることをユーザーに警告します。" + }, + "preferences": { + "ai-features": "AI機能", + "hostedPlugin": "ホスト型プラグイン", + "toolbar": "ツールバー" + }, + "preview": { + "openByDefault": "デフォルトではエディタではなくプレビューを開くようになっています。" + }, + "property-view": { + "created": "作成", + "directory": "ディレクトリ", + "lastModified": "最終更新日", + "location": "所在地", + "noProperties": "物件はありません。", + "properties": "プロパティ", + "symbolicLink": "シンボリックリンク" + }, + "remote": { + "dev-container": { + "connect": "コンテナで再オープン", + "noDevcontainerFiles": "ワークスペースにdevcontainer.jsonファイルが見つかりません。.devcontainerディレクトリにdevcontainer.jsonファイルがあることを確認してください。", + "selectDevcontainer": "devcontainer.jsonファイルを選択する。" + }, + "ssh": { + "connect": "現在のウィンドウをホストに接続...", + "connectToConfigHost": "設定ファイルで現在のウィンドウをホストに接続...", + "enterHost": "SSHホスト名を入力", + "enterUser": "SSHユーザー名を入力", + "failure": "リモートへの SSH 接続を開けませんでした。", + "hostPlaceHolder": "例:hello@example.com", + "needsHost": "ホスト名を入力してください。", + "needsUser": "ユーザー名を入力してください。", + "userPlaceHolder": "例:こんにちは" + }, + "sshNoConfigPath": "SSH 設定パスが見つかりません。", + "wsl": { + "connectToWsl": "WSLに接続", + "connectToWslUsingDistro": "Distroを使用してWSLに接続...", + "noWslDistroFound": "WSLディストリビューションが見つかりません。先にWSLディストリビューションをインストールしてください。", + "reopenInWsl": "WSLでフォルダを開き直す", + "selectWSLDistro": "WSLディストリビューションの選択" + } + }, + "scm": { + "amend": "修正", + "amendHeadCommit": "HEADコミット", + "amendLastCommit": "前回のコミットを修正", + "changeRepository": "リポジトリの変更...", + "config.untrackedChanges": "未追跡の変更の動作を制御します。", + "config.untrackedChanges.hidden": "隠れ", + "config.untrackedChanges.mixed": "合成", + "config.untrackedChanges.separate": "別", + "dirtyDiff": { + "close": "クローズチェンジ・ピーキング・ビュー" + }, + "history": "歴史", + "mergeEditor": { + "resetConfirmationTitle": "本当にこのエディターでマージ結果をリセットしたいのですか?" + }, + "noRepositoryFound": "リポジトリが見つからない", + "unamend": "くり返す", + "unamendCommit": "未修正のコミット" + }, + "search-in-workspace": { + "includeIgnoredFiles": "無視されたファイルを含める", + "noFolderSpecified": "フォルダを開いていない、または指定していない。現在、開いているファイルのみが検索されます。", + "resultSubset": "これは、すべての結果の一部に過ぎません。より具体的な検索用語を使って、結果リストを絞り込んでください。", + "searchOnEditorModification": "修正されたときにアクティブなエディタを検索します。" + }, + "secondary-window": { + "extract-widget": "セカンダリーウィンドウへの表示移動" + }, + "shell-area": { + "secondary": "セカンダリーウィンドウ" + }, + "task": { + "attachTask": "タスクの添付...", + "circularReferenceDetected": "サーキュラーリファレンス検出:{0} -->{1}", + "clearHistory": "明確な歴史", + "errorKillingTask": "タスクの強制終了エラー '{0}':{1}", + "errorLaunchingTask": "タスク '{0}' の起動エラー:{1}", + "invalidTaskConfigs": "無効なタスク構成が見つかりました。tasks.jsonを開き、Problemsビューで詳細を確認してください。", + "neverScanTaskOutput": "タスクの出力をスキャンしない", + "noTaskToRun": "実行するタスクが見つかりません。タスクの設定...", + "noTasksFound": "タスクが見つかりません", + "notEnoughDataInDependsOn": "dependsOn \"で提供される情報は、正しいタスクをマッチさせるのに十分ではない!", + "schema": { + "commandOptions": { + "cwd": "実行されるプログラムまたはスクリプトの現在の作業ディレクトリ。省略された場合、Theiaの現在のワークスペースのルートが使用される。" + }, + "presentation": { + "panel": { + "dedicated": "端末は特定のタスク専用である。そのタスクが再び実行されれば、端末は再利用される。ただし、別のタスクの出力は別の端末に表示される。", + "new": "そのタスクを実行するたびに、新しいクリーンな端末が使われる。", + "shared": "ターミナルは共有され、他のタスク実行の出力は同じターミナルに追加される。" + }, + "showReuseMessage": "Terminal will be reused by tasks\" メッセージを表示するかどうかを制御します。" + }, + "problemMatcherObject": { + "owner": "テイア内部の問題の所有者。base が指定されていれば省略可能。省略され、base が指定されなかった場合のデフォルトは 'external' です。" + } + }, + "taskAlreadyRunningInTerminal": "タスクはすでにターミナルで実行されている", + "taskExitedWithCode": "タスク '{0}' はコード{1} で終了しました。", + "taskTerminalTitle": "タスクだ:{0}", + "taskTerminatedBySignal": "タスク '{0}' はシグナル{1} によって終了した。", + "terminalWillBeReusedByTasks": "ターミナルはタスクで再利用される。" + }, + "terminal": { + "defaultProfile": "で使用されるデフォルトのプロファイルです。{0}", + "enableCopy": "ctrl-c(macOSではcmd-c)で選択されたテキストをコピーできるようになりました。", + "enablePaste": "ctrl-v(macOSではcmd-v)でクリップボードからの貼り付けを可能にする。", + "profileArgs": "このプロファイルが使用するシェル引数。", + "profileColor": "端末と関連付ける端末テーマカラーID。", + "profileDefault": "Default Profileを選択する...", + "profileIcon": "ターミナルアイコンに関連付けるコーディコンIDです。\nterminal-tmux:\"$(terminal-tmux)\" とする。", + "profileNew": "新端末(プロフィール付き)...", + "profilePath": "このプロファイルが使用するシェルのパス。", + "profiles": "新しいターミナルを作成するときに提示するプロファイル。オプションのアーギュメントを使用して、手動でパスプロパティを設定します。\n既存のプロファイルを `null` に設定すると、リストからプロファイルを隠すことができます。 例: `\"{0}\": null`.", + "rendererType": "端末のレンダリング方法を制御する。", + "rendererTypeDeprecationMessage": "レンダラータイプはオプションとしてサポートされなくなった。", + "selectProfile": "新規端末のプロファイルを選択する", + "shell.deprecated": "これは非推奨です。デフォルトシェルを設定する新しい推奨方法は、 'terminal.integrated.profiles.{0}' でターミナルプロファイルを作成し、 'terminal.integrated.defaultProfile.{0}.' でそのプロファイル名をデフォルトとして設定する方法です。", + "shellArgsLinux": "Linux端末で使用するコマンドライン引数です。", + "shellArgsOsx": "macOSのターミナルで使用するコマンドライン引数です。", + "shellArgsWindows": "Windows端末で使用するコマンドライン引数です。", + "shellLinux": "Linuxでターミナルが使用するシェルのパス(デフォルト:'{0}'})。", + "shellOsx": "macOSでターミナルが使用するシェルのパスです(デフォルト:'{0}'})。", + "shellWindows": "Windowsでターミナルが使用するシェルのパスです。(デフォルト: '{0}')を指定します。" + }, + "terminal-manager": { + "addTerminalToGroup": "ターミナルをグループに追加", + "closeDialog": { + "message": "ターミナルマネージャーを閉じると、そのレイアウトは復元できなくなります。ターミナルマネージャーを閉じてもよろしいですか?", + "title": "ターミナルマネージャーを閉じますか?" + }, + "closeTerminalManager": "ターミナルマネージャーを閉じる", + "createNewTerminalGroup": "新しいターミナルグループを作成する", + "createNewTerminalPage": "新しいターミナルページを作成する", + "deleteGroup": "グループを削除", + "deletePage": "ページを削除", + "deleteTerminal": "ターミナルを削除", + "group": "グループ", + "label": "ターミナル", + "maximizeBottomPanel": "下部パネルを最大化", + "minimizeBottomPanel": "下部パネルを最小化", + "openTerminalManager": "ターミナルマネージャーを開く", + "page": "ページ", + "rename": "名前を変更する", + "resetTerminalManagerLayout": "ターミナルマネージャーのレイアウトをリセット", + "toggleTreeView": "ツリー表示の切り替え" + }, + "test": { + "cancelAllTestRuns": "すべてのテスト実行をキャンセルする", + "stackFrameAt": "で", + "testRunDefaultName": "{0} 走る{1}", + "testRuns": "テスト走行" + }, + "toolbar": { + "addCommand": "ツールバーへのコマンド追加", + "addCommandPlaceholder": "ツールバーに追加するコマンドを探す", + "centerColumn": "センターポール", + "failedUpdate": "1}'の'{0}'の値を更新できませんでした。", + "filterIcons": "フィルターアイコン", + "iconSelectDialog": "{0}」のアイコンを選択します。", + "iconSet": "アイコンセット", + "insertGroupLeft": "インサートグループセパレーター(左)", + "insertGroupRight": "インサートグループセパレーター(右)", + "leftColumn": "左欄", + "openJSON": "ツールバーのカスタマイズ(JSONを開く)", + "removeCommand": "ツールバーからコマンドを削除する", + "restoreDefaults": "ツールバーの初期設定に戻す", + "rightColumn": "右列", + "selectIcon": "アイコンの選択", + "toggleToolbar": "ツールバーのトグル", + "toolbarLocationPlaceholder": "コマンドを追加したい場所はどこですか?", + "useDefaultIcon": "デフォルトアイコンを使用する" + }, + "typehierarchy": { + "subtypeHierarchy": "サブタイプヒエラルキー", + "supertypeHierarchy": "スーパータイプヒエラルキー" + }, + "variableResolver": { + "listAllVariables": "変数すべてをリストする" + }, + "vsx-registry": { + "confirmDialogMessage": "拡張子 \"{0}\" は未検証であり、セキュリティリスクをもたらす可能性があります。", + "confirmDialogTitle": "本当にインストールを続行しますか?", + "downloadCount": "ダウンロード回数{0}", + "errorFetching": "拡張機能の取得にエラーが発生しました。", + "errorFetchingConfigurationHint": "これは、ネットワーク設定の問題が原因である可能性がある。", + "failedInstallingVSIX": "VSIXから{0} のインストールに失敗しました。", + "invalidVSIX": "選択されたファイルは、有効な \"*.vsix \"プラグインではありません。", + "license": "ライセンス{0}", + "onlyShowVerifiedExtensionsDescription": "これにより、{0} 、検証済みの拡張子のみを表示することができる。", + "onlyShowVerifiedExtensionsTitle": "検証済みのエクステンションのみ表示", + "recommendedExtensions": "このワークスペースでの使用が推奨される拡張機能の名前のリストです。", + "searchPlaceholder": "{0}で拡張子を検索", + "showInstalled": "インストールされている拡張機能を表示する", + "showRecommendedExtensions": "拡張機能の推奨事項について、通知を表示するかどうかを制御します。", + "vsx-extensions-contribution": { + "update-version-uninstall-error": "拡張子の削除中にエラーが発生しました。{0}.", + "update-version-version-error": "バージョン{0} のインストールに失敗しました。{1} 。" + } + }, + "webview": { + "goToReadme": "READMEに戻る", + "messageWarning": " {0}エンドポイントのホストパターンが`{1}`に変更されました。パターンを変更すると、セキュリティ上の脆弱性が発生する可能性があります。 詳しくは `{2}` をご覧ください。" + }, + "workspace": { + "bothAreDirectories": "両方のリソースはディレクトリです。", + "clickToManageTrust": "クリックして信頼設定を管理する", + "compareWithEachOther": "互いの比較", + "confirmDeletePermanently.description": "ゴミ箱を使った「{0}」の削除に失敗しました。代わりに永久に削除しますか?", + "confirmDeletePermanently.solution": "環境設定でゴミ箱の使用を無効にすることができます。", + "confirmDeletePermanently.title": "ファイル削除時のエラー", + "confirmMessage.delete": "本当に以下のファイルを削除しますか?", + "confirmMessage.dirtyMultiple": "保存されていない変更のある{0}個のファイルを本当に削除したいのですか?", + "confirmMessage.dirtySingle": "本当に未保存のまま{0}を削除したいのでしょうか?", + "confirmMessage.uriMultiple": "本当に{0}個の選択されたファイルをすべて削除しますか?", + "confirmMessage.uriSingle": "本当に{0}を削除するのですか?", + "directoriesCannotBeCompared": "ディレクトリは比較できません。 {0}", + "duplicate": "デュプリケート", + "failSaveAs": "現在のウィジェットでは\"{0}\"を実行できません。", + "isDirectory": "{0}'' はディレクトリです。", + "manageTrustPlaceholder": "このワークスペースの信頼状態を選択してください", + "newFilePlaceholder": "ファイル名", + "newFolderPlaceholder": "フォルダー名", + "noErasure": "注:ディスクからは何も消去されません", + "notWorkspaceFile": "無効なワークスペースファイルです: {0}", + "openRecentPlaceholder": "開きたいワークスペースの名前を入力する", + "openRecentWorkspace": "最近のワークスペースを開く...", + "preserveWindow": "ワークスペースを現在のウィンドウで開けるようにします。", + "removeFolder": "ワークスペースから以下のフォルダを削除してよろしいですか?", + "removeFolders": "ワークスペースから以下のフォルダを削除してよろしいですか?", + "restrictedModeDescription": "このワークスペースは信頼されていないため、一部の機能が無効になっています。", + "restrictedModeNote": "*ご注意: ワークスペース信頼機能は現在Theiaで開発中です。すべての機能がワークスペース信頼と統合されているわけではありません*", + "schema": { + "folders": { + "description": "ワークスペース内のルートフォルダ" + }, + "title": "ワークスペースファイル" + }, + "trashTitle": "{0}をゴミ箱に移動", + "trustEmptyWindow": "空のワークスペースをデフォルトで信頼するかどうかを制御します。", + "trustEnabled": "ワークスペースの信頼を有効にするかどうかを制御します。無効の場合、すべてのワークスペースが信頼されます。", + "trustTrustedFolders": "プロンプトなしで信頼されるフォルダURIの一覧。", + "untitled-cleanup": "名称未設定のワークスペースファイルが多数あるようです。{0}を確認して、未使用のファイルを削除してください。", + "variables": { + "cwd": { + "description": "タスクランナーの起動時の現在の作業ディレクトリ" + }, + "file": { + "description": "現在開いているファイルのパス" + }, + "fileBasename": { + "description": "現在開かれているファイルのベース名" + }, + "fileBasenameNoExtension": { + "description": "現在開いているファイルの名前(拡張子を除く)" + }, + "fileDirname": { + "description": "現在開いているファイルのディレクトリ名" + }, + "fileExtname": { + "description": "現在開いているファイルの拡張子" + }, + "relativeFile": { + "description": "現在開いているファイルの、ワークスペースルートからの相対パス" + }, + "relativeFileDirname": { + "description": "現在の開いているファイルのディレクトリ名(${workspaceFolder} からの相対パス)" + }, + "workspaceFolder": { + "description": "ワークスペースのルートフォルダのパス" + }, + "workspaceFolderBasename": { + "description": "ワークスペースのルートフォルダーの名前" + }, + "workspaceRoot": { + "description": "ワークスペースのルートフォルダのパス" + }, + "workspaceRootFolderName": { + "description": "ワークスペースのルートフォルダーの名前" + } + }, + "workspaceFolderAdded": "複数のルートを持つワークスペースが作成されました。ワークスペースの構成をファイルとして保存しますか?", + "workspaceFolderAddedTitle": "ワークスペースにフォルダを追加" + } + }, + "vsx.disabling": "無効化", + "vsx.disabling.extensions": "{0} を無効化 ...", + "vsx.enabling": "使用可能", + "vsx.enabling.extension": "Enabling{0}..." +} diff --git a/packages/core/i18n/nls.json b/packages/core/i18n/nls.json new file mode 100644 index 0000000..f8d8c6f --- /dev/null +++ b/packages/core/i18n/nls.json @@ -0,0 +1,2097 @@ +{ + "ai-chat-ui.show-settings": "Show AI Settings", + "ai-chat:summarize-session-as-task-for-coder": "Summarize Session as Task for Coder", + "ai.executePlanWithCoder": "Execute Current Plan with Coder", + "ai.updateTaskContext": "Update Current Task Context", + "aiConfiguration:open": "Open AI Configuration view", + "aiHistory:clear": "AI History: Clear History", + "aiHistory:open": "Open AI History view", + "aiHistory:sortChronologically": "AI History: Sort chronologically", + "aiHistory:sortReverseChronologically": "AI History: Sort reverse chronologically", + "aiHistory:toggleCompact": "AI History: Toggle compact view", + "aiHistory:toggleHideNewlines": "AI History: Stop interpreting newlines", + "aiHistory:toggleRaw": "AI History: Toggle raw view", + "aiHistory:toggleRenderNewlines": "AI History: Interpret newlines", + "debug.breakpoint.editCondition": "Edit Condition...", + "debug.breakpoint.removeSelected": "Remove Selected Breakpoints", + "debug.breakpoint.toggleEnabled": "Toggle Enable Breakpoints", + "notebook.cell.changeToCode": "Change Cell to Code", + "notebook.cell.changeToMarkdown": "Change Cell to Markdown", + "notebook.cell.insertMarkdownCellAbove": "Insert Markdown Cell Above", + "notebook.cell.insertMarkdownCellBelow": "Insert Markdown Cell Below", + "terminal:new:profile": "Create New Integrated Terminal from a Profile", + "terminal:profile:default": "Choose the default Terminal Profile", + "theia": { + "ai": { + "agents": { + "completionNotification": { + "mdDescription": "Notification behavior when this agent completes a task. If not set, the global default notification setting will be used.\n - `os-notification`: Show OS/system notifications\n - `message`: Show notifications in the status bar/message area\n - `blink`: Blink or highlight the UI\n - `off`: Disable notifications for this agent", + "title": "Completion Notification" + }, + "enable": { + "mdDescription": "Specifies whether the agent should be enabled (true) or disabled (false).", + "title": "Enable Agent" + }, + "languageModelRequirements": { + "identifier": { + "mdDescription": "The identifier of the language model to be used." + }, + "mdDescription": "Specifies the used language models for this agent.", + "purpose": { + "mdDescription": "The purpose for which this language model is used.", + "title": "Purpose" + }, + "title": "Language Model Requirements" + }, + "mdDescription": "Configure agent settings such as enabling or disabling specific agents, configuring prompts and selecting LLMs.", + "selectedVariants": { + "mdDescription": "Specifies the currently selected prompt variants for this agent.", + "title": "Selected Variants" + }, + "title": "Agent Settings" + }, + "anthropic": { + "apiKey": { + "description": "Enter an API Key of your official Anthropic Account. **Please note:** By using this preference the Anthropic API key will be stored in clear text on the machine running Theia. Use the environment variable `ANTHROPIC_API_KEY` to set the key securely." + }, + "models": { + "description": "Official Anthropic models to use" + } + }, + "chat": { + "agent": { + "architect": "Architect", + "coder": "Coder", + "universal": "Universal" + }, + "applySuggestion": "Apply suggestion", + "bypassModelRequirement": { + "description": "Bypass the language model requirement check. Enable this if you are using external agents (e.g., Claude Code) that do not require Theia language models." + }, + "changeSetDefaultTitle": "Suggested Changes", + "changeSetFileDiffUriLabel": "AI Changes: {0}", + "chatAgentsVariable": { + "description": "Returns the list of chat agents available in the system" + }, + "chatSessionNamingAgent": { + "description": "Agent for generating chat session names", + "vars": { + "conversation": { + "description": "The content of the chat conversation." + }, + "listOfSessionNames": { + "description": "The list of existing session names." + } + } + }, + "chatSessionSummaryAgent": { + "description": "Agent for generating chat session summaries." + }, + "confirmApplySuggestion": "The file {0} has changed since this suggestion was created. Are you certain you wish to apply the change?", + "confirmRevertSuggestion": "The file {0} has changed since this suggestion was created. Are you certain you wish to revert the change?", + "couldNotFindMatchingLM": "Couldn't find a matching language model. Please check your setup!", + "couldNotFindReadyLMforAgent": "Couldn't find a ready language model for agent {0}. Please check your setup!", + "defaultAgent": { + "description": "Optional: of the Chat Agent that shall be invoked, if no agent is explicitly mentioned with @ in the user query. If no Default Agent is configured, Theia´s defaults will be applied." + }, + "imageContextVariable": { + "args": { + "data": { + "description": "The image data in base64." + }, + "mimeType": { + "description": "The mimetype of the image." + }, + "name": { + "description": "The name of the image file if available." + }, + "wsRelativePath": { + "description": "The workspace-relative path of the image file if available." + } + }, + "description": "Provides context information for an image", + "label": "Image File" + }, + "orchestrator": { + "description": "This agent analyzes the user request against the description of all available chat agents and selects the best fitting agent to answer the request (by using AI).The user's request will be directly delegated to the selected agent without further confirmation.", + "vars": { + "availableChatAgents": { + "description": "The list of chat agents that the orchestrator can delegate to, excluding agents specified in the exclusion list preference." + } + } + }, + "pinChatAgent": { + "description": "Enable agent pinning to automatically keep a mentioned chat agent active across prompts, reducing the need for repeated mentions. You can manually unpin or switch agents anytime." + }, + "revertSuggestion": "Revert suggestion", + "selectImageFile": "Select an image file", + "sessionStorage": { + "description": "Configure where to store chat sessions.", + "globalPath": "Global Path", + "pathNotUsedForScope": "Not used with {0} storage scope.", + "pathRequired": "Path cannot be empty", + "pathSettings": "Path Settings", + "resetToDefault": "Reset to default", + "scope": { + "global": "Store chat sessions in the global configuration folder.", + "workspace": "Store chat sessions in the workspace folder." + }, + "workspacePath": "Workspace Path" + }, + "taskContextService": { + "summarizeProgressMessage": "Summarize: {0}", + "updatingProgressMessage": "Updating: {0}" + }, + "toolConfirmation": { + "confirm": { + "description": "Ask for confirmation before executing tools" + }, + "disabled": { + "description": "Disable tool execution" + }, + "yolo": { + "description": "Execute tools automatically without confirmation" + } + }, + "view": { + "label": "AI Chat" + } + }, + "chat-ui": { + "addContextVariable": "Add context variable", + "agent": "Agent", + "aiDisabled": "AI features are disabled", + "applyAll": "Apply All", + "applyAllTitle": "Apply all pending changes", + "askQuestion": "Ask a question", + "attachToContext": "Attach elements to context", + "cancel": "Cancel (Esc)", + "chat-view-tree-widget": { + "ai": "AI", + "aiFeatureHeader": "🚀 AI Features Available (Beta Version)!", + "featuresDisabled": "Currently, all AI Features are disabled!", + "generating": "Generating", + "howToEnable": "How to Enable the AI Features:", + "noRenderer": "Error: No renderer found", + "scrollToBottom": "Jump to latest message", + "waitingForInput": "Waiting for input", + "you": "You" + }, + "chatInput": { + "clearHistory": "Clear Input Prompt History", + "cycleMode": "Cycle Chat Mode", + "nextPrompt": "Next Prompt", + "previousPrompt": "Previous Prompt" + }, + "chatInputAriaLabel": "Type your message here", + "chatResponses": "Chat responses", + "code-part-renderer": { + "generatedCode": "Generated Code" + }, + "collapseChangeSet": "Collapse Change Set", + "command-part-renderer": { + "commandNotExecutable": "The command has the id \"{0}\" but it is not executable from the Chat window." + }, + "copyCodeBlock": "Copy Code Block", + "couldNotSendRequestToSession": "Was not able to send request \"{0}\" to session {1}", + "delegation-response-renderer": { + "prompt": { + "label": "Delegated prompt:" + }, + "response": { + "label": "Response:" + }, + "starting": "Starting delegation...", + "status": { + "canceled": "canceled", + "error": "error", + "generating": "generating...", + "starting": "starting..." + } + }, + "deleteChangeSet": "Delete Change Set", + "editRequest": "Edit", + "edited": "edited", + "editedTooltipHint": "This prompt variant has been edited. You can reset it in the AI Configuration view.", + "enterChatName": "Enter chat name", + "errorChatInvocation": "An error occurred during chat service invocation.", + "expandChangeSet": "Expand Change Set", + "failedToDeleteSession": "Failed to delete chat session", + "failedToLoadChats": "Failed to load chat sessions", + "failedToRestoreSession": "Failed to restore chat session", + "failedToRetry": "Failed to retry message", + "focusInput": "Focus Chat Input", + "focusResponse": "Focus Chat Response", + "noChatAgentsAvailable": "No chat agents available.", + "openDiff": "Open Diff", + "openOriginalFile": "Open Original File", + "performThisTask": "Perform this task.", + "persistedSession": "Persisted session (click to restore)", + "removeChat": "Remove Chat", + "renameChat": "Rename Chat", + "requestNotFoundForRetry": "Request not found for retry", + "responseFrom": "Response from {0}", + "selectAgentQuickPickPlaceholder": "Select an agent for the new session", + "selectChat": "Select chat", + "selectContextVariableQuickPickPlaceholder": "Select a context variable to be attached to the message", + "selectTaskContextQuickPickItem": { + "currentlyOpen": "currently open" + }, + "selectTaskContextQuickPickPlaceholder": "Select a task context to attach", + "selectVariableArguments": "Select variable arguments", + "send": "Send (Enter)", + "sessionNotFoundForRetry": "Session not found for retry", + "text-part-renderer": { + "cantDisplay": "Can't display response, please check your ChatResponsePartRenderers!" + }, + "thinking-part-renderer": { + "thinking": "Thinking" + }, + "toolcall-part-renderer": { + "denied": "Execution denied", + "finished": "Ran", + "rejected": "Execution canceled" + }, + "toolconfirmation": { + "allow-options-dropdown-tooltip": "More Allow Options", + "allow-session": "Allow for this Chat", + "allowed": "Tool execution allowed", + "alwaysAllowConfirm": "I understand, enable auto-approval", + "alwaysAllowTitle": "Enable Auto-Approval for \"{0}\"?", + "canceled": "Tool execution canceled", + "denied": "Tool execution denied", + "deny-forever": "Always Deny", + "deny-options-dropdown-tooltip": "More Deny Options", + "deny-reason-placeholder": "Enter reason for denial...", + "deny-session": "Deny for this Chat", + "deny-with-reason": "Deny with reason...", + "executionDenied": "Tool execution denied", + "header": "Confirm Tool Execution" + }, + "unableToSummarizeCurrentSession": "Unable to summarize current session. Please confirm that the summary agent is not disabled.", + "unknown-part-renderer": { + "contentNotRestoreable": "This content (type '{0}') could not be fully restored. It may be from an extension that is no longer available." + }, + "unpinAgent": "Unpin Agent", + "variantTooltip": "Prompt variant: {0}", + "yourMessage": "Your message" + }, + "claude-code": { + "agentDescription": "Anthropic's coding agent", + "askBeforeEdit": "Ask before edit", + "changeSetTitle": "Changes by Claude Code", + "clearCommand": { + "description": "Create a new session" + }, + "compactCommand": { + "description": "Compact conversation with optional focus instructions" + }, + "completedCount": "{0}/{1} completed", + "configCommand": { + "description": "Open Claude Code Configuration" + }, + "currentDirectory": "current directory", + "differentAgentRequestWarning": "The previous chat request was handled by a different agent. Claude Code does not see those other messages.", + "directory": "Directory", + "domain": "Domain", + "editAutomatically": "Edit automatically", + "editNumber": "Edit {0}", + "editing": "Editing", + "editsCount": "{0} edits", + "emptyTodoList": "No todos available", + "entireFile": "Entire File", + "excludingOnePattern": " (exluding 1 pattern)", + "excludingPatterns": " (excluding {0} patterns)", + "executedCommand": "Executed: {0}", + "failedToParseBashToolData": "Failed to parse Bash tool data", + "failedToParseEditToolData": "Failed to parse Edit tool data", + "failedToParseGlobToolData": "Failed to parse Glob tool data", + "failedToParseGrepToolData": "Failed to parse Grep tool data", + "failedToParseLSToolData": "Failed to parse LS tool data", + "failedToParseMultiEditToolData": "Failed to parse MultiEdit tool data", + "failedToParseReadToolData": "Failed to parse Read tool data", + "failedToParseTodoListData": "Failed to parse todo list data", + "failedToParseWebFetchToolData": "Failed to parse WebFetch tool data", + "failedToParseWriteToolData": "Failed to parse Write tool data", + "fetching": "Fetching", + "fileFilter": "File Filter", + "filePath": "File Path", + "fileType": "File Type", + "findMatchingFiles": "Find files matching the glob pattern \"{0}\" in the current directory", + "findMatchingFilesWithPath": "Find files matching the glob pattern \"{0}\" within {1}", + "finding": "Finding", + "from": "From", + "globPattern": "glob pattern", + "grepOptions": { + "caseInsensitive": "case-insensitive", + "glob": "glob: {0}", + "headLimit": "limit: {0}", + "lineNumbers": "line numbers", + "linesAfter": "+{0} after", + "linesBefore": "+{0} before", + "linesContext": "±{0} context", + "multiLine": "multiline", + "type": "type: {0}" + }, + "grepOutputModes": { + "content": "content", + "count": "count", + "filesWithMatches": "files with matches" + }, + "ignoredPatterns": "Ignored Patterns", + "ignoringPatterns": "Ignoring {0} patterns", + "initCommand": { + "description": "Initialize project with CLAUDE.md guide" + }, + "itemCount": "{0} items", + "lineLimit": "Line Limit", + "lines": "Lines", + "listDirectoryContents": "List directory contents", + "listing": "Listing", + "memoryCommand": { + "description": "Edit CLAUDE.md memory file" + }, + "multiEditing": "Multi-editing", + "oneEdit": "1 edit", + "oneItem": "1 item", + "oneOption": "1 option", + "openDirectoryTooltip": "Click to open directory", + "openFileTooltip": "Click to open file in editor", + "optionsCount": "{0} options", + "partial": "Partial", + "pattern": "Pattern", + "plan": "Plan mode", + "project": "project", + "projectRoot": "project root", + "readMode": "Read Mode", + "reading": "Reading", + "replaceAllCount": "{0} replace-all", + "replaceAllOccurrences": "Replace all occurrences", + "resumeCommand": { + "description": "Resume a session" + }, + "reviewCommand": { + "description": "Request code review" + }, + "searchPath": "Search Path", + "searching": "Searching", + "startingLine": "Starting Line", + "timeout": "Timeout", + "timeoutInMs": "Timeout: {0}ms", + "to": "To", + "todoList": "Todo List", + "todoPriority": { + "high": "high", + "low": "low", + "medium": "medium" + }, + "toolApprovalRequest": "Claude Code wants to use the \"{0}\" tool. Do you want to allow this?", + "totalEdits": "Total Edits", + "webFetch": "Web Fetch", + "writing": "Writing" + }, + "code-completion": { + "progressText": "Calculating AI code completion..." + }, + "codex": { + "agentDescription": "OpenAI's coding assistant powered by Codex", + "completedCount": "{0}/{1} completed", + "exitCode": "Exit code: {0}", + "fileChangeFailed": "Codex failed to apply changes for: {0}", + "fileChangeFailedGeneric": "Codex failed to apply file changes.", + "itemCount": "{0} items", + "noItems": "No items", + "oneItem": "1 item", + "running": "Running...", + "searched": "Searched", + "searching": "Searching", + "todoList": "Todo List", + "webSearch": "Web Search" + }, + "completion": { + "agent": { + "description": "This agent provides inline code completion in the code editor in the Theia IDE.", + "vars": { + "file": { + "description": "The URI of the file being edited" + }, + "language": { + "description": "The languageId of the file being edited" + }, + "prefix": { + "description": "The code before the current cursor position" + }, + "suffix": { + "description": "The code after the current cursor position" + } + } + }, + "automaticEnable": { + "description": "Automatically trigger AI completions inline within any (Monaco) editor while editing. \n Alternatively, you can manually trigger the code via the command \"Trigger Inline Suggestion\" or the default shortcut \"Ctrl+Alt+Space\"." + }, + "cacheCapacity": { + "description": "Maximum number of code completions to store in the cache. A higher number can improve performance but will consume more memory. Minimum value is 10, recommended range is between 50-200.", + "title": "Code Completion Cache Capacity" + }, + "debounceDelay": { + "description": "Controls the delay in milliseconds before triggering AI completions after changes have been detected in the editor. Requires `Automatic Code Completion` to be enabled. Enter 0 to disable the debounce delay.", + "title": "Debounce Delay" + }, + "excludedFileExts": { + "description": "Specify file extensions (e.g., .md, .txt) where AI completions should be disabled.", + "title": "Excluded File Extensions" + }, + "fileVariable": { + "description": "The URI of the file being edited. Only available in code completion context." + }, + "languageVariable": { + "description": "The languageId of the file being edited. Only available in code completion context." + }, + "maxContextLines": { + "description": "The maximum number of lines used as context, distributed among the lines before and after the cursor position (prefix and suffix). Set this to -1 to use the full file as context without any line limit and 0 to only use the current line.", + "title": "Maximum Context Lines" + }, + "prefixVariable": { + "description": "The code before the current cursor position. Only available in code completion context." + }, + "stripBackticks": { + "description": "Remove surrounding backticks from the code returned by some LLMs. If a backtick is detected, all content after the closing backtick is stripped as well. This setting helps ensure plain code is returned when language models use markdown-like formatting.", + "title": "Strip Backticks from Inline Completions" + }, + "suffixVariable": { + "description": "The code after the current cursor position. Only available in code completion context." + } + }, + "configuration": { + "selectItem": "Please select an item." + }, + "copilot": { + "auth": { + "aiConfiguration": "AI Configuration", + "authorize": "I have authorized", + "copied": "Copied!", + "copyCode": "Copy code", + "expired": "Authorization expired or was denied. Please try again.", + "hint": "After entering the code and authorizing, click \"I have authorized\" below.", + "initiating": "Initiating authentication...", + "instructions": "To authorize Theia to use GitHub Copilot, visit the URL below and enter the code:", + "openGitHub": "Open GitHub", + "success": "Successfully signed in to GitHub Copilot!", + "successHint": "If your GitHub account has access to Copilot, you can now configure Copilot language models in the ", + "title": "Sign in to GitHub Copilot", + "tos": "By signing in, you agree to the ", + "tosLink": "GitHub Terms of Service", + "verifying": "Verifying authorization..." + }, + "category": "Copilot", + "commands": { + "signIn": "Sign in to GitHub Copilot", + "signOut": "Sign out of GitHub Copilot" + }, + "enterpriseUrl": { + "mdDescription": "GitHub Enterprise domain for Copilot API (e.g., `github.mycompany.com`). Leave empty for GitHub.com." + }, + "models": { + "description": "GitHub Copilot models to use. Available models depend on your Copilot subscription." + }, + "statusBar": { + "signedIn": "Signed in to GitHub Copilot as {0}. Click to sign out.", + "signedOut": "Not signed in to GitHub Copilot. Click to sign in." + } + }, + "core": { + "agentConfiguration": { + "actions": "Actions", + "addCustomAgent": "Add Custom Agent", + "enableAgent": "Enable Agent", + "label": "Agents", + "llmRequirements": "LLM Requirements", + "notUsedInPrompt": "Not used in prompt", + "promptTemplates": "Prompt Templates", + "selectAgentMessage": "Please select an Agent first!", + "templateName": "Template", + "undeclared": "Undeclared", + "usedAgentSpecificVariables": "Used Agent-Specific Variables", + "usedFunctions": "Used Functions", + "usedGlobalVariables": "Used Global Variables", + "variant": "Variant" + }, + "agentsVariable": { + "description": "Returns the list of agents available in the system" + }, + "aiConfiguration": { + "label": "AI Configuration [Beta]" + }, + "blinkTitle": { + "agentCompleted": "Theia - Agent Completed", + "namedAgentCompleted": "Theia - Agent \"{0}\" Completed" + }, + "changeSetSummaryVariable": { + "description": "Provides a summary of the files in a change set and their contents." + }, + "contextDetailsVariable": { + "description": "Provides full text values and descriptions for all context elements." + }, + "contextSummaryVariable": { + "description": "Describes files in the context for a given session." + }, + "customAgentTemplate": { + "description": "This is an example agent. Please adapt the properties to fit your needs." + }, + "defaultModelAliases": { + "code": { + "description": "Optimized for code understanding and generation tasks." + }, + "code-completion": { + "description": "Best suited for code autocompletion scenarios." + }, + "summarize": { + "description": "Models prioritized for summarization and condensation of content." + }, + "universal": { + "description": "Well-balanced for both code and general language use." + } + }, + "defaultNotification": { + "mdDescription": "The default notification method used when an AI agent completes a task. Individual agents can override this setting.\n - `os-notification`: Show OS/system notifications\n - `message`: Show notifications in the status bar/message area\n - `blink`: Blink or highlight the UI\n - `off`: Disable all notifications", + "title": "Default Notification Type" + }, + "discard": { + "label": "Discard AI Prompt Template" + }, + "discardCustomPrompt": { + "tooltip": "Discard Customizations" + }, + "fileVariable": { + "description": "Resolves the contents of a file", + "uri": { + "description": "The URI of the requested file." + } + }, + "languageModelRenderer": { + "alias": "[alias] {0}", + "languageModel": "Language Model", + "purpose": "Purpose" + }, + "maxRetries": { + "mdDescription": "The maximum number of retry attempts when a request to an AI provider fails. A value of 0 means no retries.", + "title": "Maximum Retries" + }, + "modelAliasesConfiguration": { + "agents": "Agents using this Alias", + "defaultList": "[Default list]", + "evaluatesTo": "Evaluates to", + "label": "Model Aliases", + "modelNotReadyTooltip": "Not ready", + "modelReadyTooltip": "Ready", + "noAgents": "No agents use this alias.", + "noModelReadyTooltip": "No model ready", + "noResolvedModel": "No model ready for this alias.", + "priorityList": "Priority List", + "selectAlias": "Please select a Model Alias.", + "selectedModelId": "Selected Model", + "unavailableModel": "Selected model is no longer available" + }, + "noVariableFoundForOpenRequest": "No variable found for open request.", + "openEditorsShortVariable": { + "description": "Short reference to all currently open files (relative paths, comma-separated)" + }, + "openEditorsVariable": { + "description": "A comma-separated list of all currently open files, relative to the workspace root." + }, + "preference": { + "languageModelAliases": { + "description": "Configure models for each language model alias in the [AI Configuration View]({0}). Alternatiely you can set the settings manually in the settings.json: \n```\n\"default/code\": {\n \"selectedModel\": \"anthropic/claude-opus-4-20250514\"\n}\n```", + "selectedModel": "The user-selected model for this alias.", + "title": "Language Model Aliases" + } + }, + "prefs": { + "title": "AI Features [Beta]" + }, + "promptFragmentsConfiguration": { + "activeCustomizationTitle": "Active customization", + "createCustomizationTitle": "Create Customization", + "customization": "customization", + "customizationLabel": "Customization", + "defaultVariantTitle": "Default variant", + "deleteCustomizationTitle": "Delete Customization", + "editTemplateTitle": "Edit template", + "headerTitle": "Prompt Fragments", + "label": "Prompt Fragments", + "noFragmentsAvailable": "No prompt fragments available.", + "otherPromptFragmentsHeader": "Other Prompt Fragments", + "promptTemplateText": "Prompt Template Text", + "promptVariantsHeader": "Prompt Variant Sets", + "removeCustomizationDialogMsg": "Are you sure you want to remove the {0} customization for prompt fragment \"{1}\"?", + "removeCustomizationDialogTitle": "Remove Customization", + "removeCustomizationWithDescDialogMsg": "Are you sure you want to remove the {0} customization for prompt fragment \"{1}\" ({2})?", + "resetAllButton": "Reset All", + "resetAllCustomizationsDialogMsg": "Are you sure you want to reset all prompt fragments to their built-in versions? This will remove all customizations.", + "resetAllCustomizationsDialogTitle": "Reset All Customizations", + "resetAllCustomizationsTitle": "Reset all customizations", + "resetAllPromptFragments": "Reset all prompt fragments", + "resetToBuiltInDialogMsg": "Are you sure you want to reset the prompt fragment \"{0}\" to its built-in version? This will remove all customizations.", + "resetToBuiltInDialogTitle": "Reset to Built-in", + "resetToBuiltInTitle": "Reset to this built-in", + "resetToCustomizationDialogMsg": "Are you sure you want to reset the prompt fragment \"{0}\" to use the {1} customization? This will remove all higher-priority customizations.", + "resetToCustomizationDialogTitle": "Reset to Customization", + "resetToCustomizationTitle": "Reset to this customization", + "selectedVariantLabel": "Selected", + "selectedVariantTitle": "Selected variant", + "usedByAgentTitle": "Used by agent: {0}", + "variantSetError": "The selected variant does not exist and no default could be found. Please check your configuration.", + "variantSetWarning": "The selected variant does not exist. The default variant is being used instead.", + "variantsOfSystemPrompt": "Variants of this prompt variant set:" + }, + "promptTemplates": { + "description": "Folder for storing customized prompt templates. If not customized the user config directory is used. Please consider to use a folder, which is under version control to manage your variants of prompt templates.", + "openLabel": "Select Folder" + }, + "promptVariable": { + "argDescription": "The prompt template id to resolve", + "completions": { + "detail": { + "builtin": "Built-in prompt fragment", + "custom": "Customized prompt fragment" + } + }, + "description": "Resolves prompt templates via the prompt service" + }, + "prompts": { + "category": "AI Prompt Templates" + }, + "requestSettings": { + "clientSettings": { + "description": "Client settings for how to handle messages that are send back to the llm.", + "keepThinking": { + "description": "If set to false, all thinking output will be filtered before sending the next user request in a multi-turn conversation." + }, + "keepToolCalls": { + "description": "If set to false, all tool request and tool responses will be filtered before sending the next user request in a multi-turn conversation." + } + }, + "mdDescription": "Allows specifying custom request settings for multiple models.\n Each setting consists of:\n - `scope`: Defines when the setting applies:\n - `modelId` (optional): The model ID to match\n - `providerId` (optional): The provider ID to match (e.g., huggingface, openai, ollama, llamafile)\n - `agentId` (optional): The agent ID to match\n - `requestSettings`: Model-specific settings as key-value pairs\n - `clientSettings`: Client-side message handling settings:\n - `keepToolCalls` (boolean): Whether to keep tool calls in the context\n - `keepThinking` (boolean): Whether to keep thinking messages\n Settings are matched based on specificity (agent: 100, model: 10, provider: 1 points).\n Refer to [our documentation](https://theia-ide.org/docs/user_ai/#custom-request-settings) for more information.", + "modelSpecificSettings": { + "description": "Settings for the specific model ID." + }, + "scope": { + "agentId": { + "description": "The (optional) agent id to apply the settings to." + }, + "modelId": { + "description": "The (optional) model id" + }, + "providerId": { + "description": "The (optional) provider id to apply the settings to." + } + }, + "title": "Custom Request Settings" + }, + "skillsVariable": { + "description": "Returns the list of available skills that can be used by AI agents" + }, + "taskContextSummary": { + "description": "Resolves all task context items present in the session context." + }, + "templateSettings": { + "edited": "edited", + "unavailableVariant": "Unavailable" + }, + "todayVariable": { + "description": "Does something for today", + "format": { + "description": "The format of the date" + } + }, + "unableToDisplayVariableValue": "Unable to display variable value.", + "unableToResolveVariable": "Unable to resolve variable.", + "variable-contribution": { + "builtInVariable": "Theia Built-in Variable", + "currentAbsoluteFilePath": "The absolute path of the currently opened file. Please note that most agents will expect a relative file path (relative to the current workspace).", + "currentFileContent": "The plain content of the currently opened file. This excludes the information where the content is coming from. Please note that most agents will work better with a relative file path (relative to the current workspace).", + "currentRelativeDirPath": "The relative path of the directory containing the currently opened file.", + "currentRelativeFilePath": "The relative path of the currently opened file.", + "currentSelectedText": "The plain text that is currently selected in the opened file. This excludes the information where the content is coming from. Please note that most agents will work better with a relative file path (relative to the current workspace).", + "dotRelativePath": "Short reference to the relative path of the currently opened file ('currentRelativeFilePath')." + } + }, + "editor": { + "editorContextVariable": { + "description": "Resolves editor specific context information", + "label": "EditorContext" + }, + "explainWithAI": { + "prompt": "Explain this error", + "title": "Explain with AI" + }, + "fixWithAI": { + "prompt": "Help to fix this error" + } + }, + "google": { + "apiKey": { + "description": "Enter an API Key of your official Google AI (Gemini) Account. **Please note:** By using this preference the GOOGLE AI API key will be stored in clear text on the machine running Theia. Use the environment variable `GOOGLE_API_KEY` to set the key securely." + }, + "maxRetriesOnErrors": { + "description": "Maximum number of retries in case of errors. If smaller than 1, then the retry logic is disabled" + }, + "models": { + "description": "Official Google Gemini models to use" + }, + "retryDelayOnOtherErrors": { + "description": "Delay in seconds between retries in case of other errors (sometimes the Google GenAI reports errors such as incomplete JSON syntax returned from the model or 500 Internal Server Error). Setting this to -1 prevents retries in these cases. Otherwise a retry happens either immediately (if set to 0) or after this delay in seconds (if set to a positive number)." + }, + "retryDelayOnRateLimitError": { + "description": "Delay in seconds between retries in case of rate limit errors. See https://ai.google.dev/gemini-api/docs/rate-limits" + } + }, + "history": { + "clear": { + "tooltip": "Clear History of all agents" + }, + "exchange-card": { + "agentId": "Agent", + "timestamp": "Started" + }, + "open-history-tooltip": "Open AI history...", + "request-card": { + "agent": "Agent", + "model": "Model", + "request": "Request", + "response": "Response", + "timestamp": "Timestamp", + "title": "Request" + }, + "sortChronologically": { + "tooltip": "Sort chronologically" + }, + "sortReverseChronologically": { + "tooltip": "Sort reverse chronologically" + }, + "toggleCompact": { + "tooltip": "Show compact view" + }, + "toggleHideNewlines": { + "tooltip": "Stop interpreting newlines" + }, + "toggleRaw": { + "tooltip": "Show raw view" + }, + "toggleRenderNewlines": { + "tooltip": "Interpret newlines" + }, + "view": { + "label": "AI Agent History [Beta]", + "noAgent": "No agent available.", + "noAgentSelected": "No agent selected.", + "noHistoryForAgent": "No history available for the selected agent '{0}'" + } + }, + "huggingFace": { + "apiKey": { + "mdDescription": "Enter an API Key for your Hugging Face Account. **Please note:** By using this preference the Hugging Face API key will be stored in clear text on the machine running Theia. Use the environment variable `HUGGINGFACE_API_KEY` to set the key securely." + }, + "models": { + "mdDescription": "Hugging Face models to use. **Please note:** Only models supporting the chat completion API are supported (instruction-tuned models like `*-Instruct`) currently. Some models may require accepting license terms on the Hugging Face website." + } + }, + "ide": { + "agent-description": "Configure AI agent settings including enablement, LLM selection, prompt template customization, and custom agent creation in the [AI Configuration View]({0}).", + "agentConfiguration": { + "customAgentLocationQuickPick": { + "createNewFile": "Create new file", + "openExistingFile": "Open existing file", + "placeholder": "Choose where to create or open a custom agents file", + "title": "Select Location for Custom Agents File" + }, + "noDescription": "No description available" + }, + "app-tester": { + "errorCheckingDevToolsServerStatus": "Error checking DevTools MCP server status: {0}", + "errorCheckingPlaywrightServerStatus": "Error checking Playwright MCP server status: {0}", + "startChromeDevToolsMcpServers": { + "canceled": "Please setup the Chrome DevTools MCP server.", + "error": "Failed to start Chrome DevTools MCP server: {0}", + "progress": "Starting Chrome DevTools MCP server.", + "question": "The Chrome DevTools MCP server is not running. Would you like to start it now? This may install the Chrome DevTools MCP server." + }, + "startMcpServers": { + "no": "No, cancel", + "yes": "Yes, start the servers" + }, + "startPlaywrightServers": { + "canceled": "Please setup the Playwright MCP servers.", + "error": "Failed to start Playwright MCP servers: {0}", + "progress": "Starting Playwright MCP servers.", + "question": "The Playwright MCP servers are not running. Would you like to start them now? This may install the Playwright MCP servers." + } + }, + "architectAgent": { + "mode": { + "default": "Default Mode", + "plan": "Plan Mode", + "simple": "Simple Mode" + }, + "suggestion": { + "executePlanWithCoder": "Execute \"{0}\" with Coder", + "summarizeSessionAsTaskForCoder": "Summarize this session as a task for Coder", + "updateTaskContext": "Update current task context" + } + }, + "bypassHint": "Some agents like Claude Code don't require Theia Language Models", + "chatDisabledMessage": { + "featuresTitle": "Currently Supported Views and Features:" + }, + "coderAgent": { + "mode": { + "agentNext": "Agent Mode (Next)", + "edit": "Edit Mode" + }, + "suggestion": { + "fixProblems": { + "content": "[Fix problems]({0}) in the current file.", + "prompt": "please look at {1} and fix any problems." + }, + "startNewChat": "Keep chats short and focused. [Start a new chat]({0}) for a new task or [start a new chat with a summary of this one]({1})." + } + }, + "commandAgent": { + "commandCallback": { + "confirmAction": "Got it", + "label": "AI command" + }, + "response": { + "customHandler": "Try executing this:", + "noCommand": "Sorry, I can't find such a command", + "theiaCommand": "I found this command that might help you:" + }, + "vars": { + "commandIds": { + "description": "The list of available commands in Theia." + } + } + }, + "configureAgent": { + "header": "Configure a default agent" + }, + "continueAnyway": "Continue Anyway", + "createSkillAgent": { + "mode": { + "edit": "Default Mode" + } + }, + "enableAI": { + "mdDescription": "❗ This setting allows you to access the latest AI capabilities (Beta version). \n Please note that these features are in a beta phase, which means they may undergo changes and will be further improved. It is important to be aware that these features may generate continuous requests to the language models (LLMs) you provide access to. This might incur costs that you need to monitor closely. By enabling this option, you acknowledge these risks. \n **Please note! The settings below in this section will only take effect\n once the main feature setting is enabled. After enabling the feature, you need to configure at least one LLM provider below. Also see [the documentation](https://theia-ide.org/docs/user_ai/)**." + }, + "github": { + "configureGitHubServer": { + "canceled": "GitHub server configuration cancelled. Please configure the GitHub MCP server to use this agent.", + "no": "No, cancel", + "yes": "Yes, configure GitHub server" + }, + "errorCheckingGitHubServerStatus": "Error checking GitHub MCP server status: {0}", + "startGitHubServer": { + "canceled": "Please start the GitHub MCP server to use this agent.", + "error": "Failed to start GitHub MCP server: {0}", + "no": "No, cancel", + "progress": "Starting GitHub MCP server.", + "question": "The GitHub MCP server is configured but not running. Would you like to start it now?", + "yes": "Yes, start the server" + } + }, + "githubRepoName": { + "description": "The name of the current GitHub repository (e.g., \"eclipse-theia/theia\")" + }, + "model-selection-description": "Choose which Large Language Models (LLMs) are used by each AI agent in the [AI Configuration View]({0}).", + "moreAgentsAvailable": { + "header": "More agents are available" + }, + "noRecommendedAgents": "No recommended agents are available.", + "openSettings": "Open AI Settings", + "or": "or", + "orchestrator": { + "error": { + "noAgents": "No chat agent available to handle request. Please check your configuration whether any are enabled." + }, + "progressMessage": "Determining the most appropriate agent", + "response": { + "delegatingToAgent": "Delegating to `@{0}`" + } + }, + "prompt-template-description": "Select prompt variants and customize prompt templates for AI agents in the [AI Configuration View]({0}).", + "recommendedAgents": "Recommended agents:", + "skillsConfiguration": { + "label": "Skills", + "location": { + "label": "Location" + } + }, + "toolsConfiguration": { + "confirmAlwaysAllow": { + "confirm": "I understand, enable auto-approval", + "title": "Enable Auto-Approval for \"{0}\"?" + }, + "confirmationMode": { + "label": "Confirmation Mode" + }, + "default": { + "label": "Default Tool Confirmation Mode:" + }, + "resetAll": "Reset All", + "resetAllConfirmDialog": { + "msg": "Are you sure you want to reset all tool confirmation modes to the default? This will remove all custom settings.", + "title": "Reset All Tool Confirmation Modes" + }, + "resetAllTooltip": "Reset all tools to default", + "toolOptions": { + "confirm": { + "label": "Confirm" + } + } + }, + "variableConfiguration": { + "selectVariable": "Please select a Variable.", + "usedByAgents": "Used by Agents", + "variableArgs": "Arguments" + } + }, + "llamaFile": { + "prefs": { + "mdDescription": "This setting allows you to configure and manage LlamaFile models in Theia IDE. \n Each entry requires a user-friendly `name`, the file `uri` pointing to your LlamaFile, and the `port` on which it will run. \n To start a LlamaFile, use the \"Start LlamaFile\" command, which enables you to select the desired model. \n If you edit an entry (e.g., change the port), any running instance will stop, and you will need to manually start it again. \n [Learn more about configuring and managing LlamaFiles in the Theia IDE documentation](https://theia-ide.org/docs/user_ai/#llamafile-models).", + "name": { + "description": "The model name to use for this Llamafile." + }, + "port": { + "description": "The port to use to start the server." + }, + "title": "✨ AI LlamaFile", + "uri": { + "description": "The file uri to the Llamafile." + } + }, + "start": "Start Llamafile", + "stop": "Stop Llamafile" + }, + "llamafile": { + "error": { + "noConfigured": "No Llamafiles configured.", + "noRunning": "No Llamafiles running.", + "startFailed": "Something went wrong during the llamafile start: {0}.\nFor more information, see the console.", + "stopFailed": "Something went wrong during the llamafile stop: {0}.\nFor more information, see the console." + } + }, + "mcp": { + "error": { + "allServersRunning": "All MCP servers are already running.", + "noRunningServers": "No MCP servers running.", + "noServersConfigured": "No MCP servers configured.", + "startFailed": "An error occurred while starting the MCP server." + }, + "info": { + "serverStarted": "MCP server \"{0}\" successfully started. Registered tools: {1}" + }, + "servers": { + "args": { + "mdDescription": "An array of arguments to pass to the command.", + "title": "Arguments for the command" + }, + "autostart": { + "mdDescription": "Automatically start this server when the frontend starts. Newly added servers are not immediately auto started, but on restart", + "title": "Autostart" + }, + "command": { + "mdDescription": "The command used to start the MCP server, e.g., \"uvx\" or \"npx\".", + "title": "Command to execute the MCP server" + }, + "env": { + "mdDescription": "Optional environment variables to set for the server, such as an API key.", + "title": "Environment variables" + }, + "headers": { + "mdDescription": "Optional additional headers included with each request to the server.", + "title": "Headers" + }, + "mdDescription": "Configure MCP servers either local with command, arguments and optionally environment variables, or remote with server URL, authentication token and optionally an authentication header name. Additionally it is possible to configure autostart (true by default). Each server is identified by a unique key, such as \"brave-search\" or \"filesystem\". To start a server, use the \"MCP: Start MCP Server\" command, which enables you to select the desired server. To stop a server, use the \"MCP: Stop MCP Server\" command. Please note that autostart will only take effect after a restart, you need to start a server manually for the first time.\nExample configuration:\n```{\n \"brave-search\": {\n \"command\": \"npx\",\n \"args\": [\n \"-y\",\n \"@modelcontextprotocol/server-brave-search\"\n ],\n \"env\": {\n \"BRAVE_API_KEY\": \"YOUR_API_KEY\"\n },\n },\n \"filesystem\": {\n \"command\": \"npx\",\n \"args\": [\"-y\", \"@modelcontextprotocol/server-filesystem\", \"/Users/YOUR_USERNAME/Desktop\"],\n \"env\": {\n \"CUSTOM_ENV_VAR\": \"custom-value\"\n },\n \"autostart\": false\n },\n \"jira\": {\n \"serverUrl\": \"YOUR_JIRA_MCP_SERVER_URL\",\n \"serverAuthToken\": \"YOUR_JIRA_MCP_SERVER_TOKEN\"\n }\n}\n```", + "serverAuthToken": { + "mdDescription": "The authentication token for the server, if required. This is used to authenticate with the remote server.", + "title": "Authentication Token" + }, + "serverAuthTokenHeader": { + "mdDescription": "The header name to use for the server authentication token. If not provided, \"Authorization\" with \"Bearer\" will be used.", + "title": "Authentication Header Name" + }, + "serverUrl": { + "mdDescription": "The URL of the remote MCP server. If provided, the server will connect to this URL instead of starting a local process.", + "title": "Server URL" + }, + "title": "MCP Server Configuration" + }, + "start": { + "label": "MCP: Start MCP Server" + }, + "stop": { + "label": "MCP: Stop MCP Server" + } + }, + "mcpConfiguration": { + "arguments": "Arguments", + "autostart": "Autostart", + "connectServer": "Connect", + "connectingServer": "Connecting...", + "copiedAllList": "Copied all tools to clipboard (list of all tools)", + "copiedAllSingle": "Copied all tools to clipboard (single prompt fragment with all tools)", + "copiedForPromptTemplate": "Copied all tools to clipboard for prompt template (single prompt fragment with all tools)", + "copyAllList": "Copy all (list of all tools)", + "copyAllSingle": "Copy all for chat (single prompt fragment with all tools)", + "copyForPrompt": "Copy tool (for chat or prompt template)", + "copyForPromptTemplate": "Copy all for prompt template (single prompt fragment with all tools)", + "environmentVariables": "Environment Variables", + "headers": "Headers", + "noServers": "No MCP servers configured", + "serverAuthToken": "Auth Token", + "serverAuthTokenHeader": "Auth Header Name", + "serverUrl": "Server URL", + "tools": "Tools: " + }, + "openai": { + "apiKey": { + "mdDescription": "Enter an API Key of your official OpenAI Account. **Please note:** By using this preference the Open AI API key will be stored in clear text on the machine running Theia. Use the environment variable `OPENAI_API_KEY` to set the key securely." + }, + "customEndpoints": { + "apiKey": { + "title": "Either the key to access the API served at the given url or `true` to use the global OpenAI API key" + }, + "apiVersion": { + "title": "Either the version to access the API served at the given url in Azure or `true` to use the global OpenAI API version" + }, + "deployment": { + "title": "The deployment name to access the API served at the given url in Azure" + }, + "developerMessageSettings": { + "title": "Controls the handling of system messages: `user`, `system`, and `developer` will be used as a role, `mergeWithFollowingUserMessage` will prefix the following user message with the system message or convert the system message to user message if the next message is not a user message. `skip` will just remove the system message), defaulting to `developer`." + }, + "enableStreaming": { + "title": "Indicates whether the streaming API shall be used. `true` by default." + }, + "id": { + "title": "A unique identifier which is used in the UI to identify the custom model" + }, + "mdDescription": "Integrate custom models compatible with the OpenAI API, for example via `vllm`. The required attributes are `model` and `url`. \n Optionally, you can \n - specify a unique `id` to identify the custom model in the UI. If none is given `model` will be used as `id`. \n - provide an `apiKey` to access the API served at the given url. Use `true` to indicate the use of the global OpenAI API key. \n - provide an `apiVersion` to access the API served at the given url in Azure. Use `true` to indicate the use of the global OpenAI API version. \n - provide a `deployment` name for your Azure deployment. \n - set `developerMessageSettings` to one of `user`, `system`, `developer`, `mergeWithFollowingUserMessage`, or `skip` to control how the developer message is included (where `user`, `system`, and `developer` will be used as a role, `mergeWithFollowingUserMessage` will prefix the following user message with the system message or convert the system message to user message if the next message is not a user message. `skip` will just remove the system message). Defaulting to `developer`. \n - specify `supportsStructuredOutput: false` to indicate that structured output shall not be used. \n - specify `enableStreaming: false` to indicate that streaming shall not be used. \n - specify `useResponseApi: true` to use the newer OpenAI Response API instead of the Chat Completion API (requires compatible endpoint). \n Refer to [our documentation](https://theia-ide.org/docs/user_ai/#openai-compatible-models-eg-via-vllm) for more information.", + "modelId": { + "title": "Model ID" + }, + "supportsStructuredOutput": { + "title": "Indicates whether the model supports structured output. `true` by default." + }, + "url": { + "title": "The Open AI API compatible endpoint where the model is hosted" + } + }, + "models": { + "description": "Official OpenAI models to use" + }, + "useResponseApi": { + "mdDescription": "Use the newer OpenAI Response API instead of the Chat Completion API for official OpenAI models.This setting only applies to official OpenAI models - custom providers must configure this individually.Note that for the response API, tool call definitions must satisfy Open AI's [strict schema definition](https://platform.openai.com/docs/guides/function-calling#strict-mode).Best effort is made to convert non-conformant schemas, but errors are still possible." + } + }, + "promptTemplates": { + "directories": { + "title": "Workspace-specific Prompt Template Directories" + }, + "extensions": { + "description": "List of additional file extensions in prompt locations that are considered as prompt templates. '.prompttemplate' is always considered as a default.", + "title": "Additional Prompt Template File Extensions" + }, + "files": { + "title": "Workspace-specific Prompt Template Files" + } + }, + "scanoss": { + "changeSet": { + "clean": "No Matches", + "error": "Error: Rerun", + "error-notification": "ScanOSS error encountered: {0}.", + "match": "View Matches", + "scan": "Scan", + "scanning": "Scanning..." + }, + "mode": { + "automatic": { + "description": "Enable automatic scan of code snippets in chat views." + }, + "description": "Configure the SCANOSS feature for analyzing code snippets in chat views. This will send a hash of suggested code snippets to the SCANOSS\nservice hosted by the [Software Transparency foundation](https://www.softwaretransparency.org/osskb) for analysis.", + "manual": { + "description": "User can manually trigger the scan by clicking the SCANOSS item in the chat view." + }, + "off": { + "description": "Feature is turned off completely." + } + }, + "snippet": { + "dialog-header": "ScanOSS Results", + "errored": "SCANOSS - Error - {0}", + "file-name-heading": "Match found in {0}", + "in-progress": "SCANOSS - Performing scan...", + "match-count": "Found {0} match(es)", + "matched": "SCANOSS - Found {0} match", + "no-match": "SCANOSS - No match", + "summary": "Summary" + } + }, + "session-settings-dialog": { + "title": "Set Session Settings", + "tooltip": "Set Session Settings" + }, + "terminal": { + "agent": { + "description": "This agent provides assistance to write and execute arbitrary terminal commands. Based on the user's request, it suggests commands and allows the user to directly paste and execute them in the terminal. It accesses the current directory, environment and the recent terminal output of the terminal session to provide context-aware assistance", + "vars": { + "cwd": { + "description": "The current working directory." + }, + "recentTerminalContents": { + "description": "The last 0 to 50 recent lines visible in the terminal." + }, + "shell": { + "description": "The shell being used, e.g., /usr/bin/zsh." + }, + "userRequest": { + "description": "The user's question or request." + } + } + }, + "askAi": "Ask AI", + "askTerminalCommand": "Ask about a terminal command...", + "hitEnterConfirm": "Hit enter to confirm", + "howCanIHelp": "How can I help you?", + "loading": "Loading", + "tryAgain": "Try again...", + "useArrowsAlternatives": " or use ⇅ to show alternatives..." + }, + "tokenUsage": { + "cachedInputTokens": "Input Tokens Written to Cache", + "cachedInputTokensTooltip": "Tracked additionally to 'Input Tokens'. Usually more expensive than non-cached tokens.", + "failedToGetTokenUsageData": "Failed to fetch token usage data: {0}", + "inputTokens": "Input Tokens", + "label": "Token Usage", + "lastUsed": "Last Used", + "model": "Model", + "noData": "No token usage data available yet.", + "note": "Token usage is tracked since the start of the application and is not persisted.", + "outputTokens": "Output Tokens", + "readCachedInputTokens": "Input Tokens Read From Cache", + "readCachedInputTokensTooltip": "Tracked additionally to 'Input Token'. Usually much less expensive than not cached. Usually does not count to rate limits.", + "total": "Total", + "totalTokens": "Total Tokens", + "totalTokensTooltip": "'Input Tokens' + 'Output Tokens'" + }, + "vercelai": { + "anthropicApiKey": { + "mdDescription": "Enter an API Key for Anthropic models used by the Vercel AI SDK. **Please note:** By using this preference the API key will be stored in clear text on the machine running Theia. Use the environment variable `ANTHROPIC_API_KEY` to set the key securely." + }, + "customEndpoints": { + "apiKey": { + "title": "Either the key to access the API served at the given url or `true` to use the global API key" + }, + "enableStreaming": { + "title": "Indicates whether the streaming API shall be used. `true` by default." + }, + "id": { + "title": "A unique identifier which is used in the UI to identify the custom model" + }, + "mdDescription": "Integrate custom models compatible with the Vercel AI SDK. The required attributes are `model` and `url`. \n Optionally, you can \n - specify a unique `id` to identify the custom model in the UI. If none is given `model` will be used as `id`. \n - provide an `apiKey` to access the API served at the given url. Use `true` to indicate the use of the global API key. \n - specify `supportsStructuredOutput: false` to indicate that structured output shall not be used. \n - specify `enableStreaming: false` to indicate that streaming shall not be used. \n - specify `provider` to indicate which provider the model is from (openai, anthropic).", + "modelId": { + "title": "Model ID" + }, + "supportsStructuredOutput": { + "title": "Indicates whether the model supports structured output. `true` by default." + }, + "url": { + "title": "The API endpoint where the model is hosted" + } + }, + "models": { + "description": "Official models to use with Vercel AI SDK", + "id": { + "title": "Model ID" + }, + "model": { + "title": "Model Name" + } + }, + "openaiApiKey": { + "mdDescription": "Enter an API Key for OpenAI models used by the Vercel AI SDK. **Please note:** By using this preference the API key will be stored in clear text on the machine running Theia. Use the environment variable `OPENAI_API_KEY` to set the key securely." + } + }, + "workspace": { + "coderAgent": { + "description": "An AI assistant integrated into Theia IDE, designed to assist software developers. This agent can access the users workspace, it can get a list of all available files and folders and retrieve their content. Furthermore, it can suggest modifications of files to the user. It can therefore assist the user with coding tasks or other tasks involving file changes." + }, + "considerGitignore": { + "description": "If enabled, excludes files/folders specified in a global .gitignore file (expected location is the workspace root).", + "title": "Consider .gitignore" + }, + "excludedPattern": { + "description": "List of patterns (glob or regex) for files/folders to exclude.", + "title": "Excluded File Patterns" + }, + "searchMaxResults": { + "description": "Maximum number of search results returned by the workspace search function.", + "title": "Maximum Search Results" + }, + "workspaceAgent": { + "description": "An AI assistant integrated into Theia IDE, designed to assist software developers. This agent can access the users workspace, it can get a list of all available files and folders and retrieve their content. It cannot modify files. It can therefore answer questions about the current project, project files and source code in the workspace, such as how to build the project, where to put source code, where to find specific code or configurations, etc." + } + } + }, + "ai-chat": { + "fileChangeSetTitle": "Changes proposed" + }, + "ai-chat-ui": { + "initiate-session-task-context": "Task Context: Initiate Session", + "open-current-session-summary": "Open Current Session Summary", + "open-settings-tooltip": "Open AI settings...", + "scroll-lock": "Lock Scroll", + "scroll-unlock": "Unlock Scroll", + "session-settings": "Set Session Settings", + "showChats": "Show Chats...", + "summarize-current-session": "Summarize Current Session" + }, + "ai-claude-code": { + "open-config": "Open Claude Code Configuration", + "open-memory": "Open Claude Code Memory (CLAUDE.MD)" + }, + "ai-core": { + "agentCompletionMessage": "Agent \"{0}\" has completed its task.", + "agentCompletionTitle": "Agent \"{0}\" Task Completed", + "agentCompletionWithTask": "Agent \"{0}\" has completed the task: {1}" + }, + "ai-editor": { + "contextMenu": "Ask AI", + "sendToChat": "Send to AI Chat" + }, + "ai-ide": { + "addressGhReviewCommand": { + "argumentHint": "", + "description": "Address review comments on a GitHub pull request" + }, + "fixGhTicketCommand": { + "argumentHint": "", + "description": "Analyze a GitHub ticket and implement the solution" + }, + "open-agent-settings-tooltip": "Open Agent settings...", + "rememberCommand": { + "argumentHint": "[topic-hint]", + "description": "Extract topics from conversation and update project info" + }, + "ticketCommand": { + "argumentHint": "", + "description": "Analyze a GitHub ticket and create an implementation plan" + }, + "todoTool": { + "noTasks": "No tasks" + }, + "withAppTesterCommand": { + "description": "Delegate testing to the AppTester agent (requires agent mode)" + } + }, + "ai-mcp": { + "blockedServersLabel": "MCP Servers (autostart blocked)" + }, + "ai-terminal": { + "cancelExecution": "Cancel command execution", + "canceling": "Canceling...", + "confirmExecution": "Confirm Shell Command", + "denialReason": "Reason", + "executionCanceled": "Canceled", + "executionDenied": "Denied", + "executionDeniedWithReason": "Denied with reason", + "noOutput": "No output", + "partialOutput": "Partial Output", + "timeout": "Timeout", + "workingDirectory": "Working directory" + }, + "callhierarchy": { + "noCallers": "No callers have been detected.", + "open": "Open Call Hierarchy" + }, + "chat": { + "taskContextVariable": { + "args": { + "contextId": { + "description": "The ID of the task context to retrieve, or a chat session to summarize." + } + }, + "description": "Provides context information for a task, e.g. the plan for completing a task or a summary of a previous sessions", + "label": "Task Context" + } + }, + "collaboration": { + "collaborate": "Collaborate", + "collaboration": "Collaboration", + "collaborationWorkspace": "Collaboration Workspace", + "connected": "Connected", + "connectedSession": "Connected to a collaboration session", + "copiedInvitation": "Invitation code copied to clipboard.", + "copyAgain": "Copy Again", + "createRoom": "Create New Collaboration Session", + "creatingRoom": "Creating Session", + "end": "End Collaboration Session", + "endDetail": "Terminate the session, cease content sharing, and revoke access for others.", + "enterCode": "Enter collaboration session code", + "failedCreate": "Failed to create room: {0}", + "failedJoin": "Failed to join room: {0}", + "fieldRequired": "The {0} field is required. Login aborted.", + "invite": "Invite Others", + "inviteDetail": "Copy the invitation code for sharing it with others to join the session.", + "joinRoom": "Join Collaboration Session", + "joiningRoom": "Joining Session", + "leave": "Leave Collaboration Session", + "leaveDetail": "Disconnect from the current collaboration session and close the workspace.", + "loginFailed": "Login failed.", + "loginSuccessful": "Login successful.", + "noAuth": "No authentication method provided by the server.", + "optional": "optional", + "selectAuth": "Select Authentication Method", + "selectCollaboration": "Select collaboration option", + "serverUrl": "Server URL", + "serverUrlDescription": "URL of the Open Collaboration Tools Server instance for live collaboration sessions", + "sharedSession": "Shared a collaboration session", + "startSession": "Start or join collaboration session", + "userWantsToJoin": "User '{0}' wants to join the collaboration room", + "whatToDo": "What would you like to do with other collaborators?" + }, + "core": { + "about": { + "compatibility": "{0} Compatibility", + "defaultApi": "Default {0} API", + "listOfExtensions": "List of extensions" + }, + "common": { + "closeAll": "Close All Tabs", + "closeAllTabMain": "Close All Tabs in Main Area", + "closeOtherTabMain": "Close Other Tabs in Main Area", + "closeOthers": "Close Other Tabs", + "closeRight": "Close Tabs to the Right", + "closeTab": "Close Tab", + "closeTabMain": "Close Tab in Main Area", + "collapseAllTabs": "Collapse All Side Panels", + "collapseBottomPanel": "Toggle Bottom Panel", + "collapseLeftPanel": "Toggle Left Panel", + "collapseRightPanel": "Toggle Right Panel", + "collapseTab": "Collapse Side Panel", + "showNextTabGroup": "Switch to Next Tab Group", + "showNextTabInGroup": "Switch to Next Tab in Group", + "showPreviousTabGroup": "Switch to Previous Tab Group", + "showPreviousTabInGroup": "Switch to Previous Tab in Group", + "toggleMaximized": "Toggle Maximized" + }, + "copyInfo": "Open a file first to copy its path", + "copyWarn": "Please use the browser's copy command or shortcut.", + "cutWarn": "Please use the browser's cut command or shortcut.", + "enhancedPreview": { + "classic": "Display a simple preview of the tab with basic information.", + "enhanced": "Display an enhanced preview of the tab with additional information.", + "visual": "Display a visual preview of the tab." + }, + "file": { + "browse": "Browse" + }, + "highlightModifiedTabs": "Controls whether a top border is drawn on modified (dirty) editor tabs or not.", + "keybinding": { + "duplicateModifierError": "Can't parse keybinding {0} Duplicate modifiers", + "metaError": "Can't parse keybinding {0} meta is for OSX only", + "unrecognizedKeyError": "Unrecognized key {0} in {1}" + }, + "keybindingStatus": "{0} was pressed, waiting for more keys", + "keyboard": { + "choose": "Choose Keyboard Layout", + "chooseLayout": "Choose a keyboard layout", + "current": "(current: {0})", + "currentLayout": " - current layout", + "mac": "Mac Keyboards", + "pc": "PC Keyboards", + "tryDetect": "Try to detect the keyboard layout from browser information and pressed keys." + }, + "navigator": { + "clipboardWarn": "Access to the clipboard is denied. Check your browser's permission.", + "clipboardWarnFirefox": "Clipboard API is not available. It can be enabled by '{0}' preference on '{1}' page. Then reload Theia. Note, it will allow FireFox getting full access to the system clipboard." + }, + "offline": "Offline", + "pasteWarn": "Please use the browser's paste command or shortcut.", + "quitMessage": "Any unsaved changes will not be saved.", + "resetWorkbenchLayout": "Reset Workbench Layout", + "searchbox": { + "close": "Close (Escape)", + "next": "Next (Down)", + "previous": "Previous (Up)", + "showAll": "Show all items", + "showOnlyMatching": "Show only matching items" + }, + "secondaryWindow": { + "alwaysOnTop": "When enabled, the secondary window stays above all other windows, including those of different applications.", + "description": "Sets the initial position and size of the extracted secondary window.", + "fullSize": "The position and size of the extracted widget will be the same as the running Theia application.", + "halfWidth": "The position and size of the extracted widget will be half the width of the running Theia application.", + "originalSize": "The position and size of the extracted widget will be the same as the original widget." + }, + "severity": { + "log": "Log" + }, + "silentNotifications": "Controls whether to suppress notification popups.", + "tabDefaultSize": "Specifies the default size for tabs.", + "tabMaximize": "Controls whether to maximize tabs on double click.", + "tabMinimumSize": "Specifies the minimum size for tabs.", + "tabShrinkToFit": "Shrink tabs to fit available space.", + "window": { + "tabCloseIconPlacement": { + "description": "Place the close icons on tab titles at the start or end of the tab. The default is end on all platforms.", + "end": "Place the close icon at the end of the label. In left-to-right languages, this is the right side of the tab.", + "start": "Place the close icon at the start of the label. In left-to-right languages, this is the left side of the tab." + } + }, + "window.menuBarVisibility": "Menu is displayed as a compact button in the side bar. This value is ignored when {0} is {1}." + }, + "debug": { + "TheiaIDE": "Theia IDE", + "addConfigurationPlaceholder": "Select workspace root to add configuration to", + "breakpoint": "breakpoint", + "cannotRunToThisLocation": "Could not run the current thread to the specified location.", + "compound-cycle": "Launch configuration '{0}' contains a cycle with itself", + "conditionalBreakpoint": "Conditional Breakpoint", + "conditionalBreakpointsNotSupported": "Conditional breakpoints not supported by this debug type", + "confirmRunToShiftedPosition_msg": "The target position will be shifted to Ln {0}, Col {1}. Run anyway?", + "confirmRunToShiftedPosition_title": "Cannot run the current thread to exactly the specified location", + "consoleFilter": "Filter (e.g. text, !exclude)", + "consoleFilterAriaLabel": "Filter debug console output", + "consoleSessionSelectorTooltip": "Switch between debug sessions. Each debug session has its own console output.", + "consoleSeverityTooltip": "Filter console output by severity level. Only messages with the selected severity will be shown.", + "continueAll": "Continue All", + "copyExpressionValue": "Copy Expression Value", + "couldNotRunTask": "Could not run the task '{0}'.", + "dataBreakpoint": "data breakpoint", + "debugConfiguration": "Debug Configuration", + "debugSessionInitializationFailed": "Debug session initialization failed. See console for details.", + "debugSessionTypeNotSupported": "The debug session type \"{0}\" is not supported.", + "debugToolbarMenu": "Debug Toolbar Menu", + "debugVariableInput": "Set {0} Value", + "disableSelectedBreakpoints": "Disable Selected Breakpoints", + "disabledBreakpoint": "Disabled {0}", + "enableSelectedBreakpoints": "Enable Selected Breakpoints", + "entry": "entry", + "errorStartingDebugSession": "There was an error starting the debug session, check the logs for more details.", + "exception": "exception", + "functionBreakpoint": "function breakpoint", + "goto": "goto", + "htiConditionalBreakpointsNotSupported": "Hit conditional breakpoints not supported by this debug type", + "instruction-breakpoint": "Instruction Breakpoint", + "instructionBreakpoint": "instruction breakpoint", + "logpointsNotSupported": "Logpoints not supported by this debug type", + "missingConfiguration": "Dynamic configuration '{0}:{1}' is missing or not applicable", + "pause": "pause", + "pauseAll": "Pause All", + "reveal": "Reveal", + "step": "step", + "taskTerminatedBySignal": "Task '{0}' terminated by signal {1}.", + "taskTerminatedForUnknownReason": "Task '{0}' terminated for unknown reason.", + "taskTerminatedWithExitCode": "Task '{0}' terminated with exit code {1}.", + "threads": "Threads", + "toggleTracing": "Enable/disable tracing communications with debug adapters", + "unknownSession": "Unknown Session", + "unverifiedBreakpoint": "Unverified {0}" + }, + "editor": { + "diffEditor.wordWrap2": "Lines will wrap according to the `#editor.wordWrap#` setting.", + "dirtyEncoding": "The file is dirty. Please save it first before reopening it with another encoding.", + "editor.bracketPairColorization.enabled": "Controls whether bracket pair colorization is enabled or not. Use `#workbench.colorCustomizations#` to override the bracket highlight colors.", + "editor.codeActions.triggerOnFocusChange": "Enable triggering `#editor.codeActionsOnSave#` when `#files.autoSave#` is set to `afterDelay`. Code Actions must be set to `always` to be triggered for window and focus changes.", + "editor.detectIndentation": "Controls whether `#editor.tabSize#` and `#editor.insertSpaces#` will be automatically detected when a file is opened based on the file contents.", + "editor.experimental.preferTreeSitter": "Controls whether tree sitter parsing should be turned on for specific languages. This will take precedence over `editor.experimental.treeSitterTelemetry` for the specified languages.", + "editor.inlayHints.enabled1": "Inlay hints are showing by default and hide when holding Ctrl+Alt", + "editor.inlayHints.enabled2": "Inlay hints are hidden by default and show when holding Ctrl+Alt", + "editor.inlayHints.fontFamily": "Controls font family of inlay hints in the editor. When set to empty, the `#editor.fontFamily#` is used.", + "editor.inlayHints.fontSize": "Controls font size of inlay hints in the editor. As default the `#editor.fontSize#` is used when the configured value is less than `5` or greater than the editor font size.", + "editor.inlineSuggest.edits.experimental.enabled": "Controls whether to enable experimental edits in inline suggestions.", + "editor.inlineSuggest.edits.experimental.onlyShowWhenCloseToCursor": "Controls whether to only show inline suggestions when the cursor is close to the suggestion.", + "editor.inlineSuggest.edits.experimental.useInterleavedLinesDiff": "Controls whether to enable experimental interleaved lines diff in inline suggestions.", + "editor.inlineSuggest.edits.experimental.useMixedLinesDiff": "Controls whether to enable experimental edits in inline suggestions.", + "editor.insertSpaces": "Insert spaces when pressing `Tab`. This setting is overridden based on the file contents when `#editor.detectIndentation#` is on.", + "editor.quickSuggestions": "Controls whether suggestions should automatically show up while typing. This can be controlled for typing in comments, strings, and other code. Quick suggestion can be configured to show as ghost text or with the suggest widget. Also be aware of the `#editor.suggestOnTriggerCharacters#`-setting which controls if suggestions are triggered by special characters.", + "editor.suggestFontSize": "Font size for the suggest widget. When set to `0`, the value of `#editor.fontSize#` is used.", + "editor.suggestLineHeight": "Line height for the suggest widget. When set to `0`, the value of `#editor.lineHeight#` is used. The minimum value is 8.", + "editor.tabSize": "The number of spaces a tab is equal to. This setting is overridden based on the file contents when `#editor.detectIndentation#` is on.", + "formatOnSaveTimeout": "Timeout in milliseconds after which the formatting that is run on file save is cancelled.", + "persistClosedEditors": "Controls whether to persist closed editor history for the workspace across window reloads.", + "showAllEditors": "Show All Opened Editors", + "splitHorizontal": "Split Editor Horizontal", + "splitVertical": "Split Editor Vertical", + "toggleStickyScroll": "Toggle Sticky Scroll" + }, + "external-terminal": { + "cwd": "Select current working directory for new external terminal" + }, + "file-search": { + "toggleIgnoredFiles": " (Press {0} to show/hide ignored files)" + }, + "fileDialog": { + "showHidden": "Show hidden files" + }, + "fileSystem": { + "fileResource": { + "overWriteBody": "Do you want to overwrite the changes made to '{0}' on the file system?" + } + }, + "filesystem": { + "copiedToClipboard": "Copied the download link to the clipboard.", + "copyDownloadLink": "Copy Download Link", + "dialog": { + "initialLocation": "Go To Initial Location", + "multipleItemMessage": "You can select only one item", + "navigateBack": "Navigate Back", + "navigateForward": "Navigate Forward", + "navigateUp": "Navigate Up One Directory" + }, + "fileResource": { + "binaryFileQuery": "Opening it might take some time and might make the IDE unresponsive. Do you want to open '{0}' anyway?", + "binaryTitle": "The file is either binary or uses an unsupported text encoding.", + "largeFileTitle": "The file is too large ({0}).", + "overwriteTitle": "The file '{0}' has been changed on the file system." + }, + "filesExclude": "Configure glob patterns for excluding files and folders. For example, the file Explorer decides which files and folders to show or hide based on this setting.", + "format": "Format:", + "maxConcurrentUploads": "Maximum number of concurrent files to upload when uploading multiple files. 0 means all files will be uploaded concurrently.", + "maxFileSizeMB": "Controls the max file size in MB which is possible to open.", + "prepareDownload": "Preparing download...", + "prepareDownloadLink": "Preparing download link...", + "processedOutOf": "Processed {0} out of {1}", + "replaceTitle": "Replace File", + "uploadFailed": "An error occurred while uploading a file. {0}", + "uploadFiles": "Uploading Files", + "uploadedOutOf": "Uploaded {0} out of {1}" + }, + "getting-started": { + "ai": { + "header": "AI Support in the Theia IDE is available (Beta Version)!", + "openAIChatView": "Open the AI Chat View now to learn how to start!" + }, + "apiComparator": "{0} API Compatibility", + "newExtension": "Building a New Extension", + "newPlugin": "Building a New Plugin", + "startup-editor": { + "welcomePage": "Open the Welcome page, with content to aid in getting started with {0} and extensions." + }, + "telemetry": "Data Usage & Telemetry" + }, + "git": { + "aFewSecondsAgo": "a few seconds ago", + "addSignedOff": "Add Signed-off-by", + "added": "Added", + "amendReuseMessage": "To reuse the last commit message, press 'Enter' or 'Escape' to cancel.", + "amendRewrite": "Rewrite previous commit message. Press 'Enter' to confirm or 'Escape' to cancel.", + "checkoutCreateLocalBranchWithName": "Create a new local branch with name: {0}. Press 'Enter' to confirm or 'Escape' to cancel.", + "checkoutProvideBranchName": "Please provide a branch name. ", + "checkoutSelectRef": "Select a ref to checkout or create a new local branch:", + "cloneQuickInputLabel": "Please provide a Git repository location. Press 'Enter' to confirm or 'Escape' to cancel.", + "cloneRepository": "Clone the Git repository: {0}. Press 'Enter' to confirm or 'Escape' to cancel.", + "compareWith": "Compare With...", + "compareWithBranchOrTag": "Pick a branch or tag to compare with the currently active {0} branch:", + "conflicted": "Conflicted", + "copied": "Copied", + "diff": "Diff", + "dirtyDiffLinesLimit": "Do not show dirty diff decorations, if editor's line count exceeds this limit.", + "dropStashMessage": "Stash successfully removed.", + "editorDecorationsEnabled": "Show git decorations in the editor.", + "fetchPickRemote": "Pick a remote to fetch from:", + "gitDecorationsColors": "Use color decoration in the navigator.", + "mergeEditor": { + "currentSideTitle": "Current", + "incomingSideTitle": "Incoming" + }, + "mergeQuickPickPlaceholder": "Pick a branch to merge into the currently active {0} branch:", + "missingUserInfo": "Make sure you configure your 'user.name' and 'user.email' in git.", + "noHistoryForError": "There is no history available for {0}", + "noPreviousCommit": "No previous commit to amend", + "noRepositoriesSelected": "No repositories were selected.", + "prepositionIn": "in", + "renamed": "Renamed", + "repositoryNotInitialized": "Repository {0} is not yet initialized.", + "stashChanges": "Stash changes. Press 'Enter' to confirm or 'Escape' to cancel.", + "stashChangesWithMessage": "Stash changes with message: {0}. Press 'Enter' to confirm or 'Escape' to cancel.", + "tabTitleIndex": "{0} (Index)", + "tabTitleWorkingTree": "{0} (Working tree)", + "toggleBlameAnnotations": "Toggle Blame Annotations", + "unstaged": "Unstaged" + }, + "keybinding-schema-updater": { + "deprecation": "Use `when` clause instead." + }, + "keymaps": { + "addKeybindingTitle": "Add Keybinding for {0}", + "editKeybinding": "Edit Keybinding...", + "editKeybindingTitle": "Edit Keybinding for {0}", + "editWhenExpression": "Edit When Expression...", + "editWhenExpressionTitle": "Edit When Expression for {0}", + "keybinding": { + "copy": "Copy Keybinding", + "copyCommandId": "Copy Keybinding Command ID", + "copyCommandTitle": "Copy Keybinding Command Title", + "edit": "Edit Keybinding...", + "editWhenExpression": "Edit Keybinding When Expression..." + }, + "keybindingCollidesValidation": "keybinding currently collides", + "requiredKeybindingValidation": "keybinding value is required", + "resetKeybindingConfirmation": "Do you really want to reset this keybinding to its default value?", + "resetKeybindingTitle": "Reset keybinding for {0}", + "resetMultipleKeybindingsWarning": "If multiple keybindings exist for this command, all of them will be reset." + }, + "localize": { + "offlineTooltip": "Cannot connect to backend." + }, + "markers": { + "clearAll": "Clear All", + "noProblems": "No problems have been detected in the workspace so far.", + "tabbarDecorationsEnabled": "Show problem decorators (diagnostic markers) in the tab bars." + }, + "memory-inspector": { + "addressTooltip": "Memory location to display, an address or expression evaluating to an address", + "ascii": "ASCII", + "binary": "Binary", + "byteSize": "Byte Size", + "bytesPerGroup": "Bytes Per Group", + "closeSettings": "Close Settings", + "columns": "Columns", + "command": { + "createNewMemory": "Create New Memory Inspector", + "createNewRegisterView": "Create New Register View", + "followPointer": "Follow Pointer", + "followPointerMemory": "Follow Pointer in Memory Inspector", + "resetValue": "Reset Value", + "showRegister": "Show Register in Memory Inspector", + "viewVariable": "Show Variable in Memory Inspector" + }, + "data": "Data", + "decimal": "Decimal", + "diff": { + "label": "Diff: {0}" + }, + "diff-widget": { + "offset-label": "{0} Offset", + "offset-title": "Bytes to offset the memory from {0}" + }, + "editable": { + "apply": "Apply Changes", + "clear": "Clear Changes" + }, + "endianness": "Endianness", + "extraColumn": "Extra Column", + "groupsPerRow": "Groups Per Row", + "hexadecimal": "Hexadecimal", + "length": "Length", + "lengthTooltip": "Number of bytes to fetch, in decimal or hexadecimal", + "memory": { + "addressField": { + "memoryReadError": "Enter an address or expression in the Location field." + }, + "freeze": "Freeze Memory View", + "hideSettings": "Hide Settings Panel", + "readError": { + "bounds": "Memory bounds exceeded, result will be truncated.", + "noContents": "No memory contents currently available." + }, + "readLength": { + "memoryReadError": "Enter a length (decimal or hexadecimal number) in the Length field." + }, + "showSettings": "Show Settings Panel", + "unfreeze": "Unfreeze Memory View", + "userError": "There was an error fetching memory." + }, + "memoryCategory": "Memory Inspector", + "memoryInspector": "Memory Inspector", + "memoryTitle": "Memory", + "octal": "Octal", + "offset": "Offset", + "offsetTooltip": "Offset to be added to the current memory location, when navigating", + "provider": { + "localsError": "Cannot read local variables. No active debug session.", + "readError": "Cannot read memory. No active debug session.", + "writeError": "Cannot write memory. No active debug session." + }, + "register": "Register", + "register-widget": { + "filter-placeholder": "Filter (starts with)" + }, + "registerReadError": "There was an error fetching registers.", + "registers": "Registers", + "toggleComparisonWidgetVisibility": "Toggle Comparison Widget Visibility", + "utils": { + "afterBytes": "You must load memory in both widgets you would like to compare. {0} has no memory loaded.", + "bytesMessage": "You must load memory in both widgets you would like to compare. {0} has no memory loaded." + } + }, + "messages": { + "notificationTimeout": "Informative notifications will be hidden after this timeout.", + "toggleNotifications": "Toggle Notifications" + }, + "mini-browser": { + "typeUrl": "Type a URL" + }, + "monaco": { + "noSymbolsMatching": "No symbols matching", + "typeToSearchForSymbols": "Type to search for symbols" + }, + "navigator": { + "autoReveal": "Auto Reveal", + "clipboardWarn": "Access to the clipboard is denied. Check your browser's permission.", + "clipboardWarnFirefox": "Clipboard API is not available. It can be enabled by '{0}' preference on '{1}' page. Then reload Theia. Note, it will allow FireFox getting full access to the system clipboard.", + "openWithSystemEditor": "Open With System Editor", + "refresh": "Refresh in Explorer", + "reveal": "Reveal in Explorer", + "systemEditor": "System Editor", + "toggleHiddenFiles": "Toggle Hidden Files" + }, + "output": { + "clearOutputChannel": "Clear Output Channel...", + "closeOutputChannel": "Close Output Channel...", + "hiddenChannels": "Hidden Channels", + "hideOutputChannel": "Hide Output Channel...", + "maxChannelHistory": "The maximum number of entries in an output channel.", + "outputChannels": "Output Channels", + "showOutputChannel": "Show Output Channel..." + }, + "plugin": { + "blockNewTab": "Your browser prevented opening of a new tab" + }, + "plugin-dev": { + "alreadyRunning": "Hosted instance is already running.", + "debugInstance": "Debug Instance", + "debugMode": "Using inspect or inspect-brk for Node.js debug", + "debugPorts": { + "debugPort": "Port to use for this server's Node.js debug" + }, + "devHost": "Development Host", + "failed": "Failed to run hosted plugin instance: {0}", + "hostedPlugin": "Hosted Plugin", + "hostedPluginRunning": "Hosted Plugin: Running", + "hostedPluginStarting": "Hosted Plugin: Starting", + "hostedPluginStopped": "Hosted Plugin: Stopped", + "hostedPluginWatching": "Hosted Plugin: Watching", + "instanceTerminated": "{0} has been terminated", + "launchOutFiles": "Array of glob patterns for locating generated JavaScript files (`${pluginPath}` will be replaced by plugin actual path).", + "noValidPlugin": "Specified folder does not contain valid plugin.", + "notRunning": "Hosted instance is not running.", + "pluginFolder": "Plugin folder is set to: {0}", + "preventedNewTab": "Your browser prevented opening of a new tab", + "restartInstance": "Restart Instance", + "running": "Hosted instance is running at:", + "selectPath": "Select Path", + "startInstance": "Start Instance", + "starting": "Starting hosted instance server ...", + "stopInstance": "Stop Instance", + "unknownTerminated": "The instance has been terminated", + "watchMode": "Run watcher on plugin under development" + }, + "plugin-ext": { + "authentication-main": { + "loginTitle": "Login", + "signedOut": "Successfully signed out." + }, + "plugins": "Plugins", + "webviewTrace": "Controls communication tracing with webviews.", + "webviewWarnIfUnsecure": "Warns users that webviews are currently deployed insecurely." + }, + "preferences": { + "ai-features": "AI Features", + "hostedPlugin": "Hosted Plugin", + "toolbar": "Toolbar" + }, + "preview": { + "openByDefault": "Open the preview instead of the editor by default." + }, + "property-view": { + "created": "Created", + "directory": "Directory", + "lastModified": "Last modified", + "location": "Location", + "noProperties": "No properties available.", + "properties": "Properties", + "symbolicLink": "Symbolic link" + }, + "remote": { + "dev-container": { + "connect": "Reopen in Container", + "noDevcontainerFiles": "No devcontainer.json files found in the workspace. Please ensure you have a .devcontainer directory with a devcontainer.json file.", + "selectDevcontainer": "Select a devcontainer.json file" + }, + "ssh": { + "connect": "Connect Current Window to Host...", + "connectToConfigHost": "Connect Current Window to Host in Config File...", + "enterHost": "Enter SSH host name", + "enterUser": "Enter SSH user name", + "failure": "Could not open SSH connection to remote.", + "hostPlaceHolder": "E.g. hello@example.com", + "needsHost": "Please enter a host name.", + "needsUser": "Please enter a user name.", + "userPlaceHolder": "E.g. hello" + }, + "sshNoConfigPath": "No SSH config path found.", + "wsl": { + "connectToWsl": "Connect to WSL", + "connectToWslUsingDistro": "Connect to WSL using Distro...", + "noWslDistroFound": "No WSL distributions found. Please install a WSL distribution first.", + "reopenInWsl": "Reopen Folder in WSL", + "selectWSLDistro": "Select a WSL distribution" + } + }, + "scm": { + "amend": "Amend", + "amendHeadCommit": "HEAD Commit", + "amendLastCommit": "Amend last commit", + "changeRepository": "Change Repository...", + "config.untrackedChanges": "Controls how untracked changes behave.", + "config.untrackedChanges.hidden": "hidden", + "config.untrackedChanges.mixed": "mixed", + "config.untrackedChanges.separate": "separate", + "dirtyDiff": { + "close": "Close Change Peek View" + }, + "history": "History", + "mergeEditor": { + "resetConfirmationTitle": "Do you really want to reset the merge result in this editor?" + }, + "noRepositoryFound": "No repository found", + "unamend": "Unamend", + "unamendCommit": "Unamend commit" + }, + "search-in-workspace": { + "includeIgnoredFiles": "Include Ignored Files", + "noFolderSpecified": "You have not opened or specified a folder. Only open files are currently searched.", + "resultSubset": "This is only a subset of all results. Use a more specific search term to narrow down the result list.", + "searchOnEditorModification": "Search the active editor when modified." + }, + "secondary-window": { + "extract-widget": "Move View to Secondary Window" + }, + "shell-area": { + "secondary": "Secondary Window" + }, + "task": { + "attachTask": "Attach Task...", + "circularReferenceDetected": "Circular reference detected: {0} --> {1}", + "clearHistory": "Clear History", + "errorKillingTask": "Error killing task '{0}': {1}", + "errorLaunchingTask": "Error launching task '{0}': {1}", + "invalidTaskConfigs": "Invalid task configurations are found. Open tasks.json and find details in the Problems view.", + "neverScanTaskOutput": "Never scan the task output", + "noTaskToRun": "No task to run found. Configure Tasks...", + "noTasksFound": "No tasks found", + "notEnoughDataInDependsOn": "The information provided in the \"dependsOn\" is not enough for matching the correct task!", + "schema": { + "commandOptions": { + "cwd": "The current working directory of the executed program or script. If omitted Theia's current workspace root is used." + }, + "presentation": { + "panel": { + "dedicated": "The terminal is dedicated to a specific task. If that task is executed again, the terminal is reused. However, the output of a different task is presented in a different terminal.", + "new": "Every execution of that task is using a new clean terminal.", + "shared": "The terminal is shared and the output of other task runs are added to the same terminal." + }, + "showReuseMessage": "Controls whether to show the \"Terminal will be reused by tasks\" message." + }, + "problemMatcherObject": { + "owner": "The owner of the problem inside Theia. Can be omitted if base is specified. Defaults to 'external' if omitted and base is not specified." + } + }, + "taskAlreadyRunningInTerminal": "Task is already running in terminal", + "taskExitedWithCode": "Task '{0}' has exited with code {1}.", + "taskTerminalTitle": "Task: {0}", + "taskTerminatedBySignal": "Task '{0}' was terminated by signal {1}.", + "terminalWillBeReusedByTasks": "Terminal will be reused by tasks." + }, + "terminal": { + "defaultProfile": "The default profile used on {0}", + "enableCopy": "Enable ctrl-c (cmd-c on macOS) to copy selected text", + "enablePaste": "Enable ctrl-v (cmd-v on macOS) to paste from clipboard", + "profileArgs": "The shell arguments that this profile uses.", + "profileColor": "A terminal theme color ID to associate with the terminal.", + "profileDefault": "Choose Default Profile...", + "profileIcon": "A codicon ID to associate with the terminal icon.\nterminal-tmux:\"$(terminal-tmux)\"", + "profileNew": "New Terminal (With Profile)...", + "profilePath": "The path of the shell that this profile uses.", + "profiles": "The profiles to present when creating a new terminal. Set the path property manually with optional args.\nSet an existing profile to `null` to hide the profile from the list, for example: `\"{0}\": null`.", + "rendererType": "Controls how the terminal is rendered.", + "rendererTypeDeprecationMessage": "The renderer type is no longer supported as an option.", + "selectProfile": "Select a profile for the new terminal", + "shell.deprecated": "This is deprecated, the new recommended way to configure your default shell is by creating a terminal profile in 'terminal.integrated.profiles.{0}' and setting its profile name as the default in 'terminal.integrated.defaultProfile.{0}.'", + "shellArgsLinux": "The command line arguments to use when on the Linux terminal.", + "shellArgsOsx": "The command line arguments to use when on the macOS terminal.", + "shellArgsWindows": "The command line arguments to use when on the Windows terminal.", + "shellLinux": "The path of the shell that the terminal uses on Linux (default: '{0}'}).", + "shellOsx": "The path of the shell that the terminal uses on macOS (default: '{0}'}).", + "shellWindows": "The path of the shell that the terminal uses on Windows. (default: '{0}')." + }, + "terminal-manager": { + "addTerminalToGroup": "Add terminal to group", + "closeDialog": { + "message": "Once the Terminal Manager is closed, its layout cannot be restored. Are you sure you want to close the Terminal Manager?", + "title": "Do you want to close the terminal manager?" + }, + "closeTerminalManager": "Close Terminal Manager", + "createNewTerminalGroup": "Create New Terminal Group", + "createNewTerminalPage": "Create New Terminal Page", + "deleteGroup": "Delete Group", + "deletePage": "Delete Page", + "deleteTerminal": "Delete Terminal", + "group": "Group", + "label": "Terminals", + "maximizeBottomPanel": "Maximize Bottom Panel", + "minimizeBottomPanel": "Minimize Bottom Panel", + "openTerminalManager": "Open Terminal Manager", + "page": "Page", + "rename": "Rename", + "resetTerminalManagerLayout": "Reset Terminal Manager Layout", + "toggleTreeView": "Toggle Tree View" + }, + "test": { + "cancelAllTestRuns": "Cancel All Test Runs", + "stackFrameAt": "at", + "testRunDefaultName": "{0} run {1}", + "testRuns": "Test Runs" + }, + "toolbar": { + "addCommand": "Add Command to Toolbar", + "addCommandPlaceholder": "Find a command to add to the toolbar", + "centerColumn": "Center Column", + "failedUpdate": "Failed to update the value of '{0}' in '{1}'.", + "filterIcons": "Filter Icons", + "iconSelectDialog": "Select an Icon for '{0}'", + "iconSet": "Icon Set", + "insertGroupLeft": "Insert Group Separator (Left)", + "insertGroupRight": "Insert Group Separator (Right)", + "leftColumn": "Left Column", + "openJSON": "Customize Toolbar (Open JSON)", + "removeCommand": "Remove Command From Toolbar", + "restoreDefaults": "Restore Toolbar Defaults", + "rightColumn": "Right Column", + "selectIcon": "Select Icon", + "toggleToolbar": "Toggle Toolbar", + "toolbarLocationPlaceholder": "Where would you like the command added?", + "useDefaultIcon": "Use Default Icon" + }, + "typehierarchy": { + "subtypeHierarchy": "Subtype Hierarchy", + "supertypeHierarchy": "Supertype Hierarchy" + }, + "variableResolver": { + "listAllVariables": "Variable: List All" + }, + "vsx-registry": { + "confirmDialogMessage": "The extension \"{0}\" is unverified and might pose a security risk.", + "confirmDialogTitle": "Are you sure you want to proceed with the installation?", + "downloadCount": "Download count: {0}", + "errorFetching": "Error fetching extensions.", + "errorFetchingConfigurationHint": "This could be caused by network configuration issues.", + "failedInstallingVSIX": "Failed to install {0} from VSIX.", + "invalidVSIX": "The selected file is not a valid \"*.vsix\" plugin.", + "license": "License: {0}", + "onlyShowVerifiedExtensionsDescription": "This allows the {0} to only show verified extensions.", + "onlyShowVerifiedExtensionsTitle": "Only Show Verified Extensions", + "recommendedExtensions": "A list of the names of extensions recommended for use in this workspace.", + "searchPlaceholder": "Search Extensions in {0}", + "showInstalled": "Show Installed Extensions", + "showRecommendedExtensions": "Controls whether notifications are shown for extension recommendations.", + "vsx-extensions-contribution": { + "update-version-uninstall-error": "Error while removing the extension: {0}.", + "update-version-version-error": "Failed to install version {0} of {1}." + } + }, + "webview": { + "goToReadme": "Go To README", + "messageWarning": " The {0} endpoint's host pattern has been changed to `{1}`; changing the pattern can lead to security vulnerabilities. See `{2}` for more information." + }, + "workspace": { + "bothAreDirectories": "Both resources are directories.", + "clickToManageTrust": "Click to manage trust settings.", + "compareWithEachOther": "Compare with Each Other", + "confirmDeletePermanently.description": "Failed to delete \"{0}\" using the Trash. Do you want to permanently delete instead?", + "confirmDeletePermanently.solution": "You can disable the use of Trash in the preferences.", + "confirmDeletePermanently.title": "Error deleting file", + "confirmMessage.delete": "Do you really want to delete the following files?", + "confirmMessage.dirtyMultiple": "Do you really want to delete {0} files with unsaved changes?", + "confirmMessage.dirtySingle": "Do you really want to delete {0} with unsaved changes?", + "confirmMessage.uriMultiple": "Do you really want to delete all the {0} selected files?", + "confirmMessage.uriSingle": "Do you really want to delete {0}?", + "directoriesCannotBeCompared": "Directories cannot be compared. {0}", + "duplicate": "Duplicate", + "failSaveAs": "Cannot run \"{0}\" for the current widget.", + "isDirectory": "'{0}' is a directory.", + "manageTrustPlaceholder": "Select trust state for this workspace", + "newFilePlaceholder": "File Name", + "newFolderPlaceholder": "Folder Name", + "noErasure": "Note: Nothing will be erased from disk", + "notWorkspaceFile": "Not a valid workspace file: {0}", + "openRecentPlaceholder": "Type the name of the workspace you want to open", + "openRecentWorkspace": "Open Recent Workspace...", + "preserveWindow": "Enable opening workspaces in current window.", + "removeFolder": "Are you sure you want to remove the following folder from the workspace?", + "removeFolders": "Are you sure you want to remove the following folders from the workspace?", + "restrictedModeDescription": "Some features are disabled because this workspace is not trusted.", + "restrictedModeNote": "*Please note: The workspace trust feature is currently under development in Theia; not all features are integrated with workspace trust yet*", + "schema": { + "folders": { + "description": "Root folders in the workspace" + }, + "title": "Workspace File" + }, + "trashTitle": "Move {0} to Trash", + "trustEmptyWindow": "Controls whether or not the empty workspace is trusted by default.", + "trustEnabled": "Controls whether or not workspace trust is enabled. If disabled, all workspaces are trusted.", + "trustTrustedFolders": "List of folder URIs that are trusted without prompting.", + "untitled-cleanup": "There appear to be many untitled workspace files. Please check {0} and remove any unused files.", + "variables": { + "cwd": { + "description": "The task runner's current working directory on startup" + }, + "file": { + "description": "The path of the currently opened file" + }, + "fileBasename": { + "description": "The basename of the currently opened file" + }, + "fileBasenameNoExtension": { + "description": "The currently opened file's name without extension" + }, + "fileDirname": { + "description": "The name of the currently opened file's directory" + }, + "fileExtname": { + "description": "The extension of the currently opened file" + }, + "relativeFile": { + "description": "The currently opened file's path relative to the workspace root" + }, + "relativeFileDirname": { + "description": "The current opened file's dirname relative to ${workspaceFolder}" + }, + "workspaceFolder": { + "description": "The path of the workspace root folder" + }, + "workspaceFolderBasename": { + "description": "The name of the workspace root folder" + }, + "workspaceRoot": { + "description": "The path of the workspace root folder" + }, + "workspaceRootFolderName": { + "description": "The name of the workspace root folder" + } + }, + "workspaceFolderAdded": "A workspace with multiple roots was created. Do you want to save your workspace configuration as a file?", + "workspaceFolderAddedTitle": "Folder added to Workspace" + } + }, + "vsx.disabling": "Disabling", + "vsx.disabling.extensions": "Disabling {0}...", + "vsx.enabling": "Enabling", + "vsx.enabling.extension": "Enabling {0}..." +} diff --git a/packages/core/i18n/nls.ko.json b/packages/core/i18n/nls.ko.json new file mode 100644 index 0000000..34d2274 --- /dev/null +++ b/packages/core/i18n/nls.ko.json @@ -0,0 +1,2097 @@ +{ + "ai-chat-ui.show-settings": "AI 설정 표시", + "ai-chat:summarize-session-as-task-for-coder": "세션을 코더를 위한 작업으로 요약하기", + "ai.executePlanWithCoder": "코더로 현재 계획 실행", + "ai.updateTaskContext": "현재 작업 컨텍스트 업데이트", + "aiConfiguration:open": "AI 구성 보기 열기", + "aiHistory:clear": "AI 기록: 기록 지우기", + "aiHistory:open": "AI 기록 보기 열기", + "aiHistory:sortChronologically": "AI 기록: 시간순으로 정렬", + "aiHistory:sortReverseChronologically": "AI 기록: 시간순으로 역순 정렬", + "aiHistory:toggleCompact": "AI 역사: 컴팩트 보기 토글", + "aiHistory:toggleHideNewlines": "AI 기록: 줄 바꿈 해석 중지", + "aiHistory:toggleRaw": "AI 역사: 원시 보기 토글", + "aiHistory:toggleRenderNewlines": "AI 역사: 줄 바꿈 해석", + "debug.breakpoint.editCondition": "조건 편집...", + "debug.breakpoint.removeSelected": "선택한 중단점 제거", + "debug.breakpoint.toggleEnabled": "중단점 활성화 토글", + "notebook.cell.changeToCode": "셀을 코드로 변경", + "notebook.cell.changeToMarkdown": "셀을 마크다운으로 변경", + "notebook.cell.insertMarkdownCellAbove": "위에 마크다운 셀 삽입", + "notebook.cell.insertMarkdownCellBelow": "아래에 마크다운 셀 삽입", + "terminal:new:profile": "프로필에서 새 통합 터미널 만들기", + "terminal:profile:default": "기본 터미널 프로필을 선택합니다.", + "theia": { + "ai": { + "agents": { + "completionNotification": { + "mdDescription": "이 상담원이 작업을 완료할 때의 알림 동작입니다. 설정하지 않으면 글로벌 기본 알림 설정이 사용됩니다.\n - `OS-알림`: OS/시스템 알림 표시\n - `메시지`: 상태 표시줄/메시지 영역에 알림 표시\n - blink`: UI를 깜박이거나 강조 표시\n - 끄기`: 이 상담원에 대한 알림을 비활성화합니다.", + "title": "완료 알림" + }, + "enable": { + "mdDescription": "에이전트를 사용 설정할지(true) 또는 사용 중지할지(false)를 지정합니다.", + "title": "에이전트 사용" + }, + "languageModelRequirements": { + "identifier": { + "mdDescription": "사용할 언어 모델의 식별자입니다." + }, + "mdDescription": "이 에이전트에 사용되는 언어 모델을 지정합니다.", + "purpose": { + "mdDescription": "이 언어 모델이 사용되는 목적입니다.", + "title": "목적" + }, + "title": "언어 모델 요구 사항" + }, + "mdDescription": "특정 에이전트 활성화 또는 비활성화, 프롬프트 구성, LLM 선택 등의 에이전트 설정을 구성합니다.", + "selectedVariants": { + "mdDescription": "이 상담원에 대해 현재 선택된 프롬프트 변형을 지정합니다.", + "title": "선택된 변형" + }, + "title": "상담원 설정" + }, + "anthropic": { + "apiKey": { + "description": "공식 Anthropic 계정의 API 키를 입력합니다. **참고: **이 환경설정을 사용하면 Anthropic API 키가 테아를 실행하는 컴퓨터에 일반 텍스트로 저장됩니다. 키를 안전하게 설정하려면 환경 변수 `ANTHROPIC_API_KEY`를 사용하세요." + }, + "models": { + "description": "공식 Anthropic 모델 사용" + } + }, + "chat": { + "agent": { + "architect": "건축가", + "coder": "코더", + "universal": "유니버설" + }, + "applySuggestion": "제안 적용", + "bypassModelRequirement": { + "description": "언어 모델 요구 사항 검사를 우회합니다. Theia 언어 모델이 필요하지 않은 외부 에이전트(예: Claude Code)를 사용하는 경우 이 옵션을 활성화하십시오." + }, + "changeSetDefaultTitle": "제안된 변경 사항", + "changeSetFileDiffUriLabel": "AI의 변화: {0}", + "chatAgentsVariable": { + "description": "시스템에서 사용 가능한 채팅 상담원 목록을 반환합니다." + }, + "chatSessionNamingAgent": { + "description": "채팅 세션 이름 생성 에이전트", + "vars": { + "conversation": { + "description": "채팅 대화 내용입니다." + }, + "listOfSessionNames": { + "description": "기존 세션 이름 목록입니다." + } + } + }, + "chatSessionSummaryAgent": { + "description": "채팅 세션 요약을 생성하는 에이전트입니다." + }, + "confirmApplySuggestion": "이 제안이 생성된 이후 {0} 파일이 변경되었습니다. 변경 사항을 적용하시겠습니까?", + "confirmRevertSuggestion": "이 제안이 생성된 이후 {0} 파일이 변경되었습니다. 변경 사항을 되돌리시겠습니까?", + "couldNotFindMatchingLM": "일치하는 언어 모델을 찾을 수 없습니다. 설정을 확인해 주세요!", + "couldNotFindReadyLMforAgent": "상담원 {0} 에 사용할 준비된 언어 모델을 찾을 수 없습니다. 설정을 확인해 주세요!", + "defaultAgent": { + "description": "선택 사항: 사용자 쿼리에 @ 으로 명시적으로 언급된 에이전트가 없는 경우 호출될 채팅 에이전트의 . 기본 에이전트가 구성되지 않은 경우 Theia의 기본값이 적용됩니다." + }, + "imageContextVariable": { + "args": { + "data": { + "description": "base64 형식의 이미지 데이터입니다." + }, + "mimeType": { + "description": "이미지의 모방 유형입니다." + }, + "name": { + "description": "사용 가능한 경우 이미지 파일의 이름입니다." + }, + "wsRelativePath": { + "description": "가능한 경우 이미지 파일의 작업 공간 상대 경로입니다." + } + }, + "description": "이미지에 대한 컨텍스트 정보 제공", + "label": "이미지 파일" + }, + "orchestrator": { + "description": "이 상담원은 사용자 요청을 사용 가능한 모든 채팅 상담원의 설명과 비교 분석하여 요청에 가장 적합한 상담원을 선택(AI 사용)하며, 사용자의 요청은 추가 확인 없이 선택한 상담원에게 바로 위임됩니다.", + "vars": { + "availableChatAgents": { + "description": "제외 목록 기본 설정에 지정된 상담원을 제외하고 오케스트레이터가 위임할 수 있는 채팅 상담원 목록입니다." + } + } + }, + "pinChatAgent": { + "description": "상담원 고정을 사용 설정하면 멘션된 채팅 상담원을 여러 프롬프트에서 자동으로 활성 상태로 유지하여 반복적으로 멘션할 필요성을 줄일 수 있으며, 언제든지 수동으로 고정 해제하거나 상담원을 전환할 수 있습니다." + }, + "revertSuggestion": "제안 되돌리기", + "selectImageFile": "이미지 파일 선택", + "sessionStorage": { + "description": "채팅 세션을 저장할 위치를 구성합니다.", + "globalPath": "글로벌 경로", + "pathNotUsedForScope": "{0} 저장 범위와 함께 사용되지 않음.", + "pathRequired": "경로가 비어 있을 수 없습니다", + "pathSettings": "경로 설정", + "resetToDefault": "기본값으로 재설정", + "scope": { + "global": "채팅 세션을 글로벌 구성 폴더에 저장합니다.", + "workspace": "워크스페이스 폴더에 채팅 세션을 저장합니다." + }, + "workspacePath": "작업 공간 경로" + }, + "taskContextService": { + "summarizeProgressMessage": "요약합니다: {0}", + "updatingProgressMessage": "업데이트 중입니다: {0}" + }, + "toolConfirmation": { + "confirm": { + "description": "도구를 실행하기 전에 확인 요청" + }, + "disabled": { + "description": "도구 실행 비활성화" + }, + "yolo": { + "description": "확인 없이 자동으로 도구 실행" + } + }, + "view": { + "label": "AI 채팅" + } + }, + "chat-ui": { + "addContextVariable": "컨텍스트 변수 추가", + "agent": "에이전트", + "aiDisabled": "AI 기능이 비활성화됨", + "applyAll": "모두 적용", + "applyAllTitle": "보류 중인 모든 변경 사항 적용", + "askQuestion": "질문하기", + "attachToContext": "컨텍스트에 요소 첨부", + "cancel": "취소(Esc)", + "chat-view-tree-widget": { + "ai": "AI", + "aiFeatureHeader": "🚀 AI 기능 사용 가능(알파 버전)!", + "featuresDisabled": "현재 모든 AI 기능이 비활성화되어 있습니다!", + "generating": "생성", + "howToEnable": "AI 기능을 활성화하는 방법:", + "noRenderer": "오류가 발생했습니다: 렌더러를 찾을 수 없습니다.", + "scrollToBottom": "최신 메시지로 이동", + "waitingForInput": "입력 대기 중", + "you": "당신" + }, + "chatInput": { + "clearHistory": "입력 프롬프트 기록 지우기", + "cycleMode": "주기 채팅 모드", + "nextPrompt": "다음 프롬프트", + "previousPrompt": "이전 프롬프트" + }, + "chatInputAriaLabel": "여기에 메시지를 입력하세요", + "chatResponses": "채팅 응답", + "code-part-renderer": { + "generatedCode": "생성된 코드" + }, + "collapseChangeSet": "변경 세트 접기", + "command-part-renderer": { + "commandNotExecutable": "이 명령의 ID는 \"{0}\"이지만 채팅 창에서 실행할 수 없습니다." + }, + "copyCodeBlock": "코드 블록 복사", + "couldNotSendRequestToSession": "세션에 \"{0}\" 요청을 보낼 수 없습니다. {1}", + "delegation-response-renderer": { + "prompt": { + "label": "위임 프롬프트:" + }, + "response": { + "label": "응답:" + }, + "starting": "위임 시작...", + "status": { + "canceled": "취소됨", + "error": "오류", + "generating": "생성...", + "starting": "시작..." + } + }, + "deleteChangeSet": "변경 집합 삭제", + "editRequest": "편집", + "edited": "편집됨", + "editedTooltipHint": "이 프롬프트 변형은 편집되었습니다. AI 구성 보기에서 재설정할 수 있습니다.", + "enterChatName": "채팅 이름 입력", + "errorChatInvocation": "채팅 서비스를 호출하는 동안 오류가 발생했습니다.", + "expandChangeSet": "변경 세트 확장", + "failedToDeleteSession": "채팅 세션을 삭제하지 못했습니다.", + "failedToLoadChats": "채팅 세션을 로드하지 못했습니다.", + "failedToRestoreSession": "채팅 세션을 복원하지 못했습니다.", + "failedToRetry": "메시지 재시도 실패", + "focusInput": "초점 채팅 입력", + "focusResponse": "포커스 채팅 응답", + "noChatAgentsAvailable": "채팅 상담원을 이용할 수 없습니다.", + "openDiff": "Diff 열기", + "openOriginalFile": "원본 파일 열기", + "performThisTask": "이 작업을 수행합니다.", + "persistedSession": "영구 세션(복원하려면 클릭)", + "removeChat": "채팅 제거", + "renameChat": "채팅 이름 바꾸기", + "requestNotFoundForRetry": "재시도 요청을 찾을 수 없습니다.", + "responseFrom": "{0}의 답변", + "selectAgentQuickPickPlaceholder": "새 세션의 상담원을 선택합니다.", + "selectChat": "채팅 선택", + "selectContextVariableQuickPickPlaceholder": "메시지에 첨부할 컨텍스트 변수를 선택합니다.", + "selectTaskContextQuickPickItem": { + "currentlyOpen": "현재 열려 있습니다." + }, + "selectTaskContextQuickPickPlaceholder": "첨부할 작업 컨텍스트를 선택합니다.", + "selectVariableArguments": "변수 인수 선택", + "send": "보내기(엔터)", + "sessionNotFoundForRetry": "다시 시도할 세션을 찾을 수 없습니다.", + "text-part-renderer": { + "cantDisplay": "응답을 표시할 수 없습니다. ChatResponsePartRenderers를 확인해 주세요!" + }, + "thinking-part-renderer": { + "thinking": "사고" + }, + "toolcall-part-renderer": { + "denied": "실행 거부됨", + "finished": "Ran", + "rejected": "실행 취소됨" + }, + "toolconfirmation": { + "allow-options-dropdown-tooltip": "추가 허용 옵션", + "allow-session": "이 채팅 허용", + "allowed": "도구 실행 허용", + "alwaysAllowConfirm": "알겠습니다, 자동 승인을 활성화합니다", + "alwaysAllowTitle": "\"{0}\"에 대한 자동 승인을 활성화하시겠습니까?", + "canceled": "도구 실행이 취소되었습니다", + "denied": "도구 실행이 거부되었습니다.", + "deny-forever": "항상 거부", + "deny-options-dropdown-tooltip": "더 많은 거부 옵션", + "deny-reason-placeholder": "거절 사유 입력...", + "deny-session": "이 채팅에 대한 거부", + "deny-with-reason": "이유를 들어 부인하다...", + "executionDenied": "도구 실행이 거부되었습니다", + "header": "도구 실행 확인" + }, + "unableToSummarizeCurrentSession": "현재 세션을 요약할 수 없습니다. 요약 에이전트가 비활성화되어 있지 않은지 확인해 주세요.", + "unknown-part-renderer": { + "contentNotRestoreable": "이 콘텐츠('{0}' 입력)를 완전히 복원할 수 없습니다. 더 이상 사용할 수 없는 확장 프로그램에서 가져온 것일 수 있습니다." + }, + "unpinAgent": "언핀 에이전트", + "variantTooltip": "프롬프트 변형: {0}", + "yourMessage": "귀하의 메시지" + }, + "claude-code": { + "agentDescription": "앤트로픽의 코딩 에이전트", + "askBeforeEdit": "수정하기 전에 물어보세요", + "changeSetTitle": "클로드 코드의 변경 사항", + "clearCommand": { + "description": "새 세션 만들기" + }, + "compactCommand": { + "description": "초점 안내 옵션이 포함된 간결한 대화" + }, + "completedCount": "{0}/{1} 완료", + "configCommand": { + "description": "클로드 코드 구성 열기" + }, + "currentDirectory": "현재 디렉토리", + "differentAgentRequestWarning": "이전 채팅 요청은 다른 상담원이 처리했습니다. 클로드 코드가 다른 메시지를 볼 수 없습니다.", + "directory": "디렉토리", + "domain": "도메인", + "editAutomatically": "자동으로 편집", + "editNumber": "편집 {0}", + "editing": "편집", + "editsCount": "{0} 편집", + "emptyTodoList": "모두 사용 가능하지 않음", + "entireFile": "전체 파일", + "excludingOnePattern": " (패턴 1개 제외)", + "excludingPatterns": " ( {0} 패턴 제외)", + "executedCommand": "실행되었습니다: {0}", + "failedToParseBashToolData": "Bash 도구 데이터 구문 분석에 실패했습니다.", + "failedToParseEditToolData": "편집 도구 데이터 구문 분석에 실패했습니다.", + "failedToParseGlobToolData": "글로브 도구 데이터 구문 분석에 실패했습니다.", + "failedToParseGrepToolData": "Grep 도구 데이터 구문 분석에 실패했습니다.", + "failedToParseLSToolData": "LS 도구 데이터 구문 분석에 실패했습니다.", + "failedToParseMultiEditToolData": "멀티에디트 도구 데이터 구문 분석에 실패했습니다.", + "failedToParseReadToolData": "읽기 도구 데이터 구문 분석에 실패했습니다.", + "failedToParseTodoListData": "할 일 목록 데이터 구문 분석에 실패했습니다.", + "failedToParseWebFetchToolData": "WebFetch 도구 데이터 구문 분석에 실패했습니다.", + "failedToParseWriteToolData": "쓰기 도구 데이터 구문 분석에 실패했습니다.", + "fetching": "가져오기", + "fileFilter": "파일 필터", + "filePath": "파일 경로", + "fileType": "파일 유형", + "findMatchingFiles": "현재 디렉토리에서 글로브 패턴 \"{0}\"과 일치하는 파일을 찾습니다.", + "findMatchingFilesWithPath": "내에서 글로브 패턴 \"{0}\"과 일치하는 파일을 찾습니다. {1}", + "finding": "찾기", + "from": "에서", + "globPattern": "글로브 패턴", + "grepOptions": { + "caseInsensitive": "대소문자 구분", + "glob": "글로브: {0}", + "headLimit": "제한: {0}", + "lineNumbers": "회선 번호", + "linesAfter": "+{0} 이후", + "linesBefore": "+{0} 이전", + "linesContext": "±{0} 컨텍스트", + "multiLine": "멀티라인", + "type": "유형입니다: {0}" + }, + "grepOutputModes": { + "content": "콘텐츠", + "count": "카운트", + "filesWithMatches": "일치하는 파일" + }, + "ignoredPatterns": "무시된 패턴", + "ignoringPatterns": "{0} 패턴 무시", + "initCommand": { + "description": "CLAUDE.md 가이드로 프로젝트 초기화하기" + }, + "itemCount": "{0} 항목", + "lineLimit": "회선 제한", + "lines": "라인", + "listDirectoryContents": "디렉토리 내용 나열", + "listing": "목록", + "memoryCommand": { + "description": "CLAUDE.md 메모리 파일 편집" + }, + "multiEditing": "다중 편집", + "oneEdit": "1 편집", + "oneItem": "1 항목", + "oneOption": "1 옵션", + "openDirectoryTooltip": "클릭하여 디렉터리 열기", + "openFileTooltip": "편집기에서 파일을 열려면 클릭하세요.", + "optionsCount": "{0} 옵션", + "partial": "부분", + "pattern": "패턴", + "plan": "계획 모드", + "project": "프로젝트", + "projectRoot": "프로젝트 루트", + "readMode": "읽기 모드", + "reading": "읽기", + "replaceAllCount": "{0} replace-all", + "replaceAllOccurrences": "모든 항목 교체", + "resumeCommand": { + "description": "세션 다시 시작하기" + }, + "reviewCommand": { + "description": "코드 검토 요청" + }, + "searchPath": "검색 경로", + "searching": "검색", + "startingLine": "출발선", + "timeout": "시간 초과", + "timeoutInMs": "시간 초과: {0}ms", + "to": "To", + "todoList": "전체 목록", + "todoPriority": { + "high": "높은", + "low": "low", + "medium": "medium" + }, + "toolApprovalRequest": "클로드 코드가 \"{0}\" 도구를 사용하려고 합니다. 이를 허용하시겠습니까?", + "totalEdits": "총 편집 수", + "webFetch": "웹 가져오기", + "writing": "글쓰기" + }, + "code-completion": { + "progressText": "AI 코드 완성도 계산하기..." + }, + "codex": { + "agentDescription": "Codex 기반 OpenAI의 코딩 어시스턴트", + "completedCount": "{0}/{1} 완료됨", + "exitCode": "종료 코드: {0}", + "fileChangeFailed": "Codex는 다음에 대한 변경 사항 적용에 실패했습니다: {0}", + "fileChangeFailedGeneric": "Codex가 파일 변경 사항을 적용하지 못했습니다.", + "itemCount": "{0} 항목", + "noItems": "항목 없음", + "oneItem": "1개 품목", + "running": "실행 중...", + "searched": "검색됨", + "searching": "검색 중", + "todoList": "Todo List", + "webSearch": "웹 검색" + }, + "completion": { + "agent": { + "description": "이 에이전트는 Theia IDE의 코드 편집기에서 인라인 코드 완성 기능을 제공합니다.", + "vars": { + "file": { + "description": "편집 중인 파일의 URI" + }, + "language": { + "description": "편집 중인 파일의 언어아이디" + }, + "prefix": { + "description": "현재 커서 위치 앞의 코드" + }, + "suffix": { + "description": "현재 커서 위치 뒤의 코드" + } + } + }, + "automaticEnable": { + "description": "편집하는 동안 모든 (모나코) 편집기 내에서 인라인으로 AI 완성을 자동으로 트리거합니다. \n 또는 '인라인 제안 트리거' 명령 또는 기본 단축키 'Ctrl+Alt+Space'를 사용하여 코드를 수동으로 트리거할 수도 있습니다." + }, + "cacheCapacity": { + "description": "캐시에 저장할 최대 코드 완성 횟수입니다. 숫자가 클수록 성능이 향상될 수 있지만 메모리를 더 많이 소모합니다. 최소값은 10이며, 권장 범위는 50-200입니다.", + "title": "코드 완성 캐시 용량" + }, + "debounceDelay": { + "description": "에디터에서 변경 사항이 감지된 후 AI 완료를 트리거하기까지의 지연 시간(밀리초)을 제어합니다. 자동 코드 완성`이 활성화되어 있어야 합니다. 디바운스 지연을 비활성화하려면 0을 입력합니다.", + "title": "디바운스 지연" + }, + "excludedFileExts": { + "description": "AI 완성을 비활성화할 파일 확장자(예: .md, .txt)를 지정합니다.", + "title": "제외된 파일 확장자" + }, + "fileVariable": { + "description": "편집 중인 파일의 URI입니다. 코드 완성 컨텍스트에서만 사용할 수 있습니다." + }, + "languageVariable": { + "description": "편집 중인 파일의 언어아이디입니다. 코드 완성 컨텍스트에서만 사용할 수 있습니다." + }, + "maxContextLines": { + "description": "컨텍스트로 사용되는 최대 줄 수로, 커서 위치(접두사 및 접미사)의 앞뒤 줄에 분산되어 있습니다. 줄 수 제한 없이 전체 파일을 컨텍스트로 사용하려면 -1로 설정하고, 현재 줄만 사용하려면 0으로 설정합니다.", + "title": "최대 컨텍스트 라인" + }, + "prefixVariable": { + "description": "현재 커서 위치 이전의 코드입니다. 코드 완성 컨텍스트에서만 사용할 수 있습니다." + }, + "stripBackticks": { + "description": "일부 LLM이 반환한 코드에서 주변 백틱을 제거합니다. 백틱이 감지되면 닫는 백틱 이후의 모든 콘텐츠도 제거됩니다. 이 설정은 언어 모델이 마크다운과 유사한 서식을 사용할 때 일반 코드가 반환되도록 하는 데 도움이 됩니다.", + "title": "인라인 완료에서 백틱 제거" + }, + "suffixVariable": { + "description": "현재 커서 위치 뒤의 코드입니다. 코드 완성 컨텍스트에서만 사용할 수 있습니다." + } + }, + "configuration": { + "selectItem": "항목을 선택해 주세요." + }, + "copilot": { + "auth": { + "aiConfiguration": "AI 구성", + "authorize": "저는 승인하였습니다.", + "copied": "복사했습니다!", + "copyCode": "코드 복사", + "expired": "인증이 만료되었거나 거부되었습니다. 다시 시도해 주세요.", + "hint": "코드를 입력하고 인증한 후, 아래의 \"인증 완료\"를 클릭하세요.", + "initiating": "인증 시작 중...", + "instructions": "Theia가 GitHub Copilot을 사용하도록 허용하려면 아래 URL을 방문하여 코드를 입력하세요:", + "openGitHub": "GitHub 열기", + "success": "GitHub Copilot에 성공적으로 로그인했습니다!", + "successHint": "GitHub 계정에 Copilot 접근 권한이 있다면, 이제 Copilot 언어 모델을 설정할 수 있습니다. ", + "title": "GitHub Copilot에 로그인하세요", + "tos": "로그인함으로써 귀하는 다음에 동의합니다. ", + "tosLink": "GitHub 이용 약관", + "verifying": "인증 확인 중..." + }, + "category": "코파일럿", + "commands": { + "signIn": "GitHub Copilot에 로그인하세요", + "signOut": "GitHub Copilot에서 로그아웃하세요" + }, + "enterpriseUrl": { + "mdDescription": "Copilot API용 GitHub Enterprise 도메인(예: `github.mycompany.com`). GitHub.com을 사용하려면 비워 둡니다." + }, + "models": { + "description": "사용 가능한 GitHub Copilot 모델. 사용 가능한 모델은 Copilot 구독 유형에 따라 다릅니다." + }, + "statusBar": { + "signedIn": "{0}로 GitHub Copilot에 로그인했습니다. 로그아웃하려면 클릭하세요.", + "signedOut": "GitHub Copilot에 로그인하지 않았습니다. 클릭하여 로그인하세요." + } + }, + "core": { + "agentConfiguration": { + "actions": "행동", + "addCustomAgent": "사용자 지정 상담원 추가", + "enableAgent": "에이전트 사용", + "label": "상담원", + "llmRequirements": "법학 석사(LLM) 입학 요건", + "notUsedInPrompt": "프롬프트에 사용되지 않음", + "promptTemplates": "프롬프트 템플릿", + "selectAgentMessage": "먼저 상담원을 선택해 주세요!", + "templateName": "템플릿", + "undeclared": "미신고", + "usedAgentSpecificVariables": "사용된 에이전트별 변수", + "usedFunctions": "사용된 함수", + "usedGlobalVariables": "사용된 전역 변수", + "variant": "변이체" + }, + "agentsVariable": { + "description": "시스템에서 사용 가능한 상담원 목록을 반환합니다." + }, + "aiConfiguration": { + "label": "✨ AI 구성 [알파]" + }, + "blinkTitle": { + "agentCompleted": "테아 - 에이전트 완료", + "namedAgentCompleted": "테아 - 에이전트 \"{0}\" 완료" + }, + "changeSetSummaryVariable": { + "description": "변경 집합의 파일과 그 내용에 대한 요약을 제공합니다." + }, + "contextDetailsVariable": { + "description": "모든 컨텍스트 요소에 대한 전체 텍스트 값과 설명을 제공합니다." + }, + "contextSummaryVariable": { + "description": "주어진 세션의 컨텍스트에서 파일을 설명합니다." + }, + "customAgentTemplate": { + "description": "이것은 예시 에이전트입니다. 필요에 맞게 속성을 조정하여 사용하세요." + }, + "defaultModelAliases": { + "code": { + "description": "코드 이해 및 생성 작업에 최적화되어 있습니다." + }, + "code-completion": { + "description": "코드 자동 완성 시나리오에 가장 적합합니다." + }, + "summarize": { + "description": "콘텐츠 요약 및 압축에 우선순위를 둔 모델입니다." + }, + "universal": { + "description": "코드와 일반 언어 사용 모두에 균형이 잘 잡혀 있습니다." + } + }, + "defaultNotification": { + "mdDescription": "AI 상담원이 작업을 완료할 때 사용되는 기본 알림 방법입니다. 개별 상담원이 이 설정을 재정의할 수 있습니다.\n - 'OS-알림': OS/시스템 알림 표시\n - `메시지`: 상태 표시줄/메시지 영역에 알림을 표시합니다.\n - 깜박임`: UI를 깜박이거나 강조 표시\n - 끄기`: 모든 알림 비활성화", + "title": "기본 알림 유형" + }, + "discard": { + "label": "AI 프롬프트 템플릿 삭제" + }, + "discardCustomPrompt": { + "tooltip": "사용자 지정 삭제" + }, + "fileVariable": { + "description": "파일 내용을 확인합니다.", + "uri": { + "description": "요청된 파일의 URI입니다." + } + }, + "languageModelRenderer": { + "alias": "[별칭] {0}", + "languageModel": "언어 모델", + "purpose": "목적" + }, + "maxRetries": { + "mdDescription": "AI 제공업체에 대한 요청이 실패했을 때 재시도할 수 있는 최대 횟수입니다. 값이 0이면 재시도가 없습니다.", + "title": "최대 재시도 횟수" + }, + "modelAliasesConfiguration": { + "agents": "이 별칭을 사용하는 상담원", + "defaultList": "[기본 목록]", + "evaluatesTo": "다음을 평가합니다.", + "label": "모델 별칭", + "modelNotReadyTooltip": "준비되지 않음", + "modelReadyTooltip": "준비", + "noAgents": "이 별칭을 사용하는 상담원은 없습니다.", + "noModelReadyTooltip": "준비된 모델 없음", + "noResolvedModel": "이 별칭에 대해 준비된 모델이 없습니다.", + "priorityList": "우선순위 목록", + "selectAlias": "모델 별칭을 선택하세요.", + "selectedModelId": "선택한 모델", + "unavailableModel": "선택한 모델을 더 이상 사용할 수 없습니다." + }, + "noVariableFoundForOpenRequest": "열린 요청에 대한 변수를 찾을 수 없습니다.", + "openEditorsShortVariable": { + "description": "현재 열려 있는 모든 파일에 대한 짧은 참조(상대 경로, 쉼표로 구분)" + }, + "openEditorsVariable": { + "description": "현재 열려 있는 모든 파일의 쉼표로 구분된 목록으로, 작업 공간 루트를 기준으로 합니다." + }, + "preference": { + "languageModelAliases": { + "description": "AI 구성 보기]({0})에서 각 언어 모델 별칭에 대한 모델을 구성합니다. 또는 settings.json에서 수동으로 설정을 설정할 수 있습니다: \n```\n\"기본/코드\": {\n \"selectedModel\": \"anthropic/claude-opus-4-20250514\"\n}\n```", + "selectedModel": "이 별칭에 대해 사용자가 선택한 모델입니다.", + "title": "언어 모델 별칭" + } + }, + "prefs": { + "title": "✨ AI 기능 [알파]" + }, + "promptFragmentsConfiguration": { + "activeCustomizationTitle": "활성 사용자 지정", + "createCustomizationTitle": "사용자 지정 만들기", + "customization": "사용자 지정", + "customizationLabel": "사용자 지정", + "defaultVariantTitle": "기본 변형", + "deleteCustomizationTitle": "사용자 지정 삭제", + "editTemplateTitle": "템플릿 편집", + "headerTitle": "프롬프트 조각", + "label": "프롬프트 조각", + "noFragmentsAvailable": "프롬프트 조각을 사용할 수 없습니다.", + "otherPromptFragmentsHeader": "기타 프롬프트 조각", + "promptTemplateText": "프롬프트 템플릿 텍스트", + "promptVariantsHeader": "프롬프트 변형 세트", + "removeCustomizationDialogMsg": "프롬프트 조각 \"{1}\"에 대한 {0} 사용자 지정을 제거하시겠습니까?", + "removeCustomizationDialogTitle": "사용자 지정 제거", + "removeCustomizationWithDescDialogMsg": "프롬프트 조각 \"{1}\"({2})에 대한 {0} 사용자 지정을 제거하시겠습니까?", + "resetAllButton": "모두 초기화", + "resetAllCustomizationsDialogMsg": "모든 프롬프트 조각을 기본 제공 버전으로 재설정하시겠습니까? 이렇게 하면 모든 사용자 지정이 제거됩니다.", + "resetAllCustomizationsDialogTitle": "모든 사용자 지정 초기화", + "resetAllCustomizationsTitle": "모든 사용자 지정 초기화", + "resetAllPromptFragments": "모든 프롬프트 조각 재설정", + "resetToBuiltInDialogMsg": "프롬프트 조각 \"{0}\"을 기본 제공 버전으로 재설정하시겠습니까? 이렇게 하면 모든 사용자 지정이 제거됩니다.", + "resetToBuiltInDialogTitle": "기본 제공으로 재설정", + "resetToBuiltInTitle": "이 기본 제공 기능으로 재설정", + "resetToCustomizationDialogMsg": "{1} 사용자 지정을 사용하기 위해 프롬프트 조각 \"{0}\"을 재설정하시겠습니까? 그러면 우선순위가 높은 모든 사용자 지정이 제거됩니다.", + "resetToCustomizationDialogTitle": "사용자 지정으로 재설정", + "resetToCustomizationTitle": "이 사용자 지정으로 재설정", + "selectedVariantLabel": "선택됨", + "selectedVariantTitle": "선택한 변형", + "usedByAgentTitle": "상담원이 사용합니다: {0}", + "variantSetError": "선택한 변형이 존재하지 않으며 기본값을 찾을 수 없습니다. 구성을 확인해 보세요.", + "variantSetWarning": "선택한 이형 상품이 존재하지 않습니다. 기본 이형 상품이 대신 사용되고 있습니다.", + "variantsOfSystemPrompt": "이 프롬프트 변형 세트의 변형입니다:" + }, + "promptTemplates": { + "description": "사용자 지정한 프롬프트 템플릿을 저장하는 폴더입니다. 사용자 지정하지 않으면 사용자 설정 디렉터리가 사용됩니다. 프롬프트 템플릿의 변형을 관리하려면 버전 관리가 이루어지는 폴더를 사용하는 것이 좋습니다.", + "openLabel": "폴더 선택" + }, + "promptVariable": { + "argDescription": "확인할 프롬프트 템플릿 ID", + "completions": { + "detail": { + "builtin": "기본 제공 프롬프트 조각", + "custom": "맞춤형 프롬프트 조각" + } + }, + "description": "프롬프트 서비스를 통해 프롬프트 템플릿을 해결합니다." + }, + "prompts": { + "category": "Theia AI 프롬프트 템플릿" + }, + "requestSettings": { + "clientSettings": { + "description": "LLM으로 다시 전송되는 메시지를 처리하는 방법에 대한 클라이언트 설정입니다.", + "keepThinking": { + "description": "거짓으로 설정하면 멀티턴 대화에서 다음 사용자 요청을 보내기 전에 모든 사고 출력이 필터링됩니다." + }, + "keepToolCalls": { + "description": "거짓으로 설정하면 멀티턴 대화에서 다음 사용자 요청을 보내기 전에 모든 도구 요청 및 도구 응답이 필터링됩니다." + } + }, + "mdDescription": "여러 모델에 대한 사용자 지정 요청 설정을 지정할 수 있습니다.\n 각 개체는 특정 모델에 대한 구성을 나타냅니다. modelId` 필드는 모델 ID를 지정하고 `requestSettings`는 모델별 설정을 정의합니다.\n 제공자Id` 필드는 선택 사항이며 특정 제공업체에 설정을 적용할 수 있습니다. 설정하지 않으면 모든 제공업체에 설정이 적용됩니다.\n 제공자 ID 예: huggingface, openai, ollama, llamafile.\n 자세한 내용은 [문서](https://theia-ide.org/docs/user_ai/#custom-request-settings)를 참조하세요.", + "modelSpecificSettings": { + "description": "특정 모델 ID에 대한 설정입니다." + }, + "scope": { + "agentId": { + "description": "설정을 적용할 (선택 사항) 상담원 ID입니다." + }, + "modelId": { + "description": "(선택 사항) 모델 ID" + }, + "providerId": { + "description": "설정을 적용할 (선택 사항) 공급자 ID입니다." + } + }, + "title": "사용자 지정 요청 설정" + }, + "skillsVariable": { + "description": "AI 에이전트가 사용할 수 있는 사용 가능한 스킬 목록을 반환합니다." + }, + "taskContextSummary": { + "description": "세션 컨텍스트에 있는 모든 작업 컨텍스트 항목을 확인합니다." + }, + "templateSettings": { + "edited": "편집됨", + "unavailableVariant": "선택한 이형 상품을 더 이상 사용할 수 없습니다." + }, + "todayVariable": { + "description": "오늘 할 일", + "format": { + "description": "날짜의 형식" + } + }, + "unableToDisplayVariableValue": "변수 값을 표시할 수 없습니다.", + "unableToResolveVariable": "변수를 확인할 수 없습니다.", + "variable-contribution": { + "builtInVariable": "테아 내장 변수", + "currentAbsoluteFilePath": "현재 열려 있는 파일의 절대 경로입니다. 대부분의 상담원은 상대 파일 경로(현재 작업 영역 기준)를 사용한다는 점에 유의하세요.", + "currentFileContent": "현재 열려 있는 파일의 일반 콘텐츠입니다. 여기에는 콘텐츠의 출처 정보가 제외됩니다. 대부분의 상담원은 상대 파일 경로(현재 작업 영역 기준)를 사용하면 더 잘 작동한다는 점에 유의하세요.", + "currentRelativeDirPath": "현재 열려 있는 파일이 포함된 디렉터리의 상대 경로입니다.", + "currentRelativeFilePath": "현재 열려 있는 파일의 상대 경로입니다.", + "currentSelectedText": "열린 파일에서 현재 선택되어 있는 일반 텍스트입니다. 여기에는 콘텐츠의 출처 정보가 제외됩니다. 대부분의 상담원은 상대 파일 경로(현재 작업 영역 기준)를 사용하면 더 잘 작동한다는 점에 유의하세요.", + "dotRelativePath": "현재 열려 있는 파일의 상대 경로에 대한 짧은 참조('currentRelativeFilePath')입니다." + } + }, + "editor": { + "editorContextVariable": { + "description": "에디터별 컨텍스트 정보를 확인합니다.", + "label": "에디터 컨텍스트" + }, + "explainWithAI": { + "prompt": "이 오류 설명하기", + "title": "AI로 설명하기" + }, + "fixWithAI": { + "prompt": "이 오류 해결 도움말" + } + }, + "google": { + "apiKey": { + "description": "공식 구글 AI(제미니) 계정의 API 키를 입력합니다. **참고: **이 환경설정을 사용하면 구글 AI API 키가 테아를 실행하는 컴퓨터에 일반 텍스트로 저장됩니다. 키를 안전하게 설정하려면 환경 변수 `GOOGLE_API_KEY`를 사용하세요." + }, + "maxRetriesOnErrors": { + "description": "오류 발생 시 최대 재시도 횟수입니다. 1보다 작으면 재시도 로직이 비활성화됩니다." + }, + "models": { + "description": "공식 Google 제미니 모델 사용" + }, + "retryDelayOnOtherErrors": { + "description": "다른 오류가 발생한 경우 재시도 사이의 지연 시간(초)입니다(모델에서 반환된 불완전한 JSON 구문 또는 500 내부 서버 오류와 같은 오류가 Google GenAI에 보고되는 경우도 있음). 이 값을 -1로 설정하면 이러한 경우 재시도가 발생하지 않습니다. 그렇지 않으면 즉시(0으로 설정한 경우) 또는 이 지연 시간(초)이 지난 후(양수로 설정한 경우) 재시도가 발생합니다." + }, + "retryDelayOnRateLimitError": { + "description": "속도 제한 오류 발생 시 재시도 사이의 지연 시간(초)입니다. https://ai.google.dev/gemini-api/docs/rate-limits 참조" + } + }, + "history": { + "clear": { + "tooltip": "모든 상담원의 기록 삭제" + }, + "exchange-card": { + "agentId": "에이전트", + "timestamp": "시작됨" + }, + "open-history-tooltip": "AI 기록 열기...", + "request-card": { + "agent": "에이전트", + "model": "모델", + "request": "요청", + "response": "응답", + "timestamp": "타임스탬프", + "title": "요청" + }, + "sortChronologically": { + "tooltip": "시간순으로 정렬" + }, + "sortReverseChronologically": { + "tooltip": "시간순으로 역순 정렬" + }, + "toggleCompact": { + "tooltip": "콤팩트 보기 표시" + }, + "toggleHideNewlines": { + "tooltip": "줄 바꿈 해석 중지" + }, + "toggleRaw": { + "tooltip": "원시 보기 표시" + }, + "toggleRenderNewlines": { + "tooltip": "줄 바꿈 해석" + }, + "view": { + "label": "✨ AI 에이전트 이력 [알파]", + "noAgent": "상담원이 없습니다.", + "noAgentSelected": "선택한 상담원이 없습니다.", + "noHistoryForAgent": "선택한 상담원에 대해 사용할 수 있는 기록이 없습니다 '{0}'" + } + }, + "huggingFace": { + "apiKey": { + "mdDescription": "허깅페이스 계정의 API 키를 입력합니다. **참고: **이 환경설정을 사용하면 허깅페이스 API 키가 테리아를 실행하는 컴퓨터에 일반 텍스트로 저장됩니다. 키를 안전하게 설정하려면 환경 변수 `HUGGINGFACE_API_KEY`를 사용하세요." + }, + "models": { + "mdDescription": "사용할 Hugging Face 모델. **참고:** 현재 채팅 완성 API를 지원하는 모델만 지원됩니다 (`*-Instruct`와 같은 지시어 튜닝 모델). 일부 모델은 Hugging Face 웹사이트에서 라이선스 약관에 동의해야 할 수 있습니다." + } + }, + "ide": { + "agent-description": "AI 구성 보기]({0})에서 사용 설정, LLM 선택, 프롬프트 템플릿 사용자 지정, 사용자 지정 상담원 만들기 등 AI 상담원 설정을 구성합니다.", + "agentConfiguration": { + "customAgentLocationQuickPick": { + "createNewFile": "새 파일 만들기", + "openExistingFile": "기존 파일 열기", + "placeholder": "사용자 지정 상담원 파일을 만들거나 열 위치를 선택하세요.", + "title": "사용자 지정 상담원 파일의 위치 선택" + }, + "noDescription": "설명 없음" + }, + "app-tester": { + "errorCheckingDevToolsServerStatus": "DevTools MCP 서버 상태 확인 중 오류 발생: {0}", + "errorCheckingPlaywrightServerStatus": "Playwright MCP 서버 상태 확인 중 오류가 발생했습니다: {0}", + "startChromeDevToolsMcpServers": { + "canceled": "Chrome 개발자 도구 MCP 서버를 설정해 주세요.", + "error": "Chrome DevTools MCP 서버 시작 실패: {0}", + "progress": "Chrome 개발자 도구 MCP 서버 시작 중.", + "question": "Chrome DevTools MCP 서버가 실행 중이 아닙니다. 지금 시작하시겠습니까? 이 작업은 Chrome DevTools MCP 서버를 설치할 수 있습니다." + }, + "startMcpServers": { + "no": "아니요, 취소", + "yes": "네, 서버를 시작하세요." + }, + "startPlaywrightServers": { + "canceled": "MCP 서버를 설정하세요.", + "error": "Playwright MCP 서버를 시작하지 못했습니다: {0}", + "progress": "Playwright MCP 서버를 시작합니다.", + "question": "Playwright MCP 서버가 실행되고 있지 않습니다. 지금 시작하시겠습니까? 그러면 Playwright MCP 서버가 설치될 수 있습니다." + } + }, + "architectAgent": { + "mode": { + "default": "기본 모드", + "plan": "모드 플랜", + "simple": "단순 모드" + }, + "suggestion": { + "executePlanWithCoder": "Coder로 \"{0}\" 실행", + "summarizeSessionAsTaskForCoder": "이 세션을 Coder의 작업으로 요약합니다.", + "updateTaskContext": "현재 작업 컨텍스트 업데이트" + } + }, + "bypassHint": "일부 에이전트(예: Claude Code)는 테이아 언어 모델이 필요하지 않습니다.", + "chatDisabledMessage": { + "featuresTitle": "현재 지원되는 뷰 및 기능:" + }, + "coderAgent": { + "mode": { + "agentNext": "에이전트 모드 (다음)", + "edit": "편집 모드" + }, + "suggestion": { + "fixProblems": { + "content": "현재 파일에서 [문제 해결]({0})을 클릭합니다.", + "prompt": "{1} 를 참조하여 문제를 해결하세요." + }, + "startNewChat": "채팅은 짧고 집중력 있게 진행하세요. 새 작업의 경우 [새 채팅 시작]({0})을 클릭하거나 [이 채팅의 요약으로 새 채팅 시작]({1})을 클릭하세요." + } + }, + "commandAgent": { + "commandCallback": { + "confirmAction": "알겠습니다.", + "label": "AI 명령" + }, + "response": { + "customHandler": "실행해 보세요:", + "noCommand": "죄송합니다. 그런 명령을 찾을 수 없습니다.", + "theiaCommand": "도움이 될 만한 명령을 찾았습니다:" + }, + "vars": { + "commandIds": { + "description": "테아에서 사용 가능한 명령어 목록입니다." + } + } + }, + "configureAgent": { + "header": "기본 에이전트 구성" + }, + "continueAnyway": "어쨌든 계속", + "createSkillAgent": { + "mode": { + "edit": "기본 모드" + } + }, + "enableAI": { + "mdDescription": "이 설정을 사용하면 최신 AI 기능(베타 버전)에 액세스할 수 있습니다. \n 이러한 기능은 베타 단계에 있으므로 변경될 수 있으며 추후 개선될 수 있다는 점에 유의하세요. 이러한 기능을 사용하면 액세스 권한을 제공하는 언어 모델(LLM)에 지속적인 요청이 발생할 수 있다는 점에 유의해야 합니다. 이로 인해 비용이 발생할 수 있으므로 면밀히 모니터링해야 합니다. 이 옵션을 사용 설정하면 이러한 위험을 인정하는 것입니다. \n **참고! 이 섹션의 아래 설정은 주요 기능 설정이 활성화된 경우에만\n 기본 기능 설정이 활성화된 경우에만 적용됩니다. 기능을 활성화한 후에는 아래에서 하나 이상의 LLM 제공업체를 구성해야 합니다. 또한 [문서](https://theia-ide.org/docs/user_ai/)**를 참조하세요." + }, + "github": { + "configureGitHubServer": { + "canceled": "GitHub 서버 구성이 취소되었습니다. 이 에이전트를 사용하려면 GitHub MCP 서버를 구성하세요.", + "no": "아니요, 취소", + "yes": "예, GitHub 서버를 구성합니다." + }, + "errorCheckingGitHubServerStatus": "GitHub MCP 서버 상태 확인 중 오류가 발생했습니다: {0}", + "startGitHubServer": { + "canceled": "이 에이전트를 사용하려면 GitHub MCP 서버를 시작하세요.", + "error": "GitHub MCP 서버를 시작하지 못했습니다: {0}", + "no": "아니요, 취소", + "progress": "GitHub MCP 서버를 시작합니다.", + "question": "GitHub MCP 서버가 구성되었지만 실행되지 않습니다. 지금 시작하시겠습니까?", + "yes": "예, 서버를 시작합니다." + } + }, + "githubRepoName": { + "description": "현재 GitHub 리포지토리의 이름(예: \"eclipse-theia/theia\")" + }, + "model-selection-description": "AI 구성 보기]({0})에서 각 AI 에이전트가 사용할 LLM(대규모 언어 모델)을 선택합니다.", + "moreAgentsAvailable": { + "header": "추가 에이전트가 이용 가능합니다" + }, + "noRecommendedAgents": "권장 에이전트가 없습니다.", + "openSettings": "AI 설정 열기", + "or": "또는", + "orchestrator": { + "error": { + "noAgents": "요청을 처리할 수 있는 채팅 상담원이 없습니다. 설정이 활성화되어 있는지 확인하세요." + }, + "progressMessage": "가장 적합한 에이전트 결정", + "response": { + "delegatingToAgent": "{0}`로 위임" + } + }, + "prompt-template-description": "AI 구성 보기]({0})에서 프롬프트 변형을 선택하고 AI 상담원을 위한 프롬프트 템플릿을 사용자 지정합니다.", + "recommendedAgents": "권장 에이전트:", + "skillsConfiguration": { + "label": "기술", + "location": { + "label": "위치" + } + }, + "toolsConfiguration": { + "confirmAlwaysAllow": { + "confirm": "알겠습니다, 자동 승인을 활성화합니다", + "title": "\"{0}\"에 대한 자동 승인을 활성화하시겠습니까?" + }, + "confirmationMode": { + "label": "확인 모드" + }, + "default": { + "label": "기본 도구 확인 모드:" + }, + "resetAll": "모두 초기화", + "resetAllConfirmDialog": { + "msg": "모든 도구 확인 모드를 기본값으로 재설정하시겠습니까? 이렇게 하면 모든 사용자 지정 설정이 제거됩니다.", + "title": "모든 도구 확인 모드 재설정" + }, + "resetAllTooltip": "모든 도구를 기본값으로 재설정", + "toolOptions": { + "confirm": { + "label": "확인" + } + } + }, + "variableConfiguration": { + "selectVariable": "변수를 선택하십시오.", + "usedByAgents": "에이전트에 의해 사용됨", + "variableArgs": "가변 인수" + } + }, + "llamaFile": { + "prefs": { + "mdDescription": "이 설정을 사용하면 Theia IDE에서 LlamaFile 모델을 구성하고 관리할 수 있습니다. \n 각 항목에는 사용자 친화적인 `이름`, LlamaFile을 가리키는 파일 `uri`, 실행할 `포트`가 필요합니다. \n 라마파일을 시작하려면 원하는 모델을 선택할 수 있는 \"시작 라마파일\" 명령을 사용합니다. \n 항목을 편집(예: 포트 변경)하면 실행 중인 모든 인스턴스가 중지되므로 수동으로 다시 시작해야 합니다. \n [LlamaFile 구성 및 관리에 대한 자세한 내용은 Theia IDE 설명서(https://theia-ide.org/docs/user_ai/#llamafile-models)를 참조하세요.)", + "name": { + "description": "이 라마파일에 사용할 모델명입니다." + }, + "port": { + "description": "서버를 시작하는 데 사용할 포트입니다." + }, + "title": "✨ AI 라마 파일", + "uri": { + "description": "라마파일에 대한 파일 URL입니다." + } + }, + "start": "라마파일 시작", + "stop": "라마파일 중지" + }, + "llamafile": { + "error": { + "noConfigured": "구성된 라마파일이 없습니다.", + "noRunning": "실행 중인 라마파일이 없습니다.", + "startFailed": "라마파일 시작 중 문제가 발생했습니다: {0}.\n자세한 내용은 콘솔을 참조하세요.", + "stopFailed": "라마파일 중지 중 문제가 발생했습니다: {0}.\n자세한 내용은 콘솔을 참조하세요." + } + }, + "mcp": { + "error": { + "allServersRunning": "모든 MCP 서버가 이미 실행 중입니다.", + "noRunningServers": "실행 중인 MCP 서버가 없습니다.", + "noServersConfigured": "MCP 서버가 구성되지 않았습니다.", + "startFailed": "MCP 서버를 시작하는 동안 오류가 발생했습니다." + }, + "info": { + "serverStarted": "MCP 서버 \"{0}\"가 성공적으로 시작되었습니다. 도구를 등록했습니다: {1}" + }, + "servers": { + "args": { + "mdDescription": "명령에 전달할 인수의 배열입니다.", + "title": "명령의 인수" + }, + "autostart": { + "mdDescription": "프론트엔드가 시작될 때 이 서버를 자동으로 시작합니다. 새로 추가된 서버는 즉시 자동 시작되지 않고 재시작 시 시작됩니다.", + "title": "자동 시작" + }, + "command": { + "mdDescription": "MCP 서버를 시작하는 데 사용되는 명령(예: \"uvx\" 또는 \"npx\").", + "title": "MCP 서버를 실행하는 명령" + }, + "env": { + "mdDescription": "API 키와 같이 서버에 설정할 환경 변수(선택 사항)입니다.", + "title": "환경 변수" + }, + "headers": { + "mdDescription": "서버에 대한 각 요청에 포함되는 추가 헤더(선택 사항)입니다.", + "title": "헤더" + }, + "mdDescription": "명령어, 인수, 선택적 환경 변수, 자동 시작(기본값은 true)을 사용하여 MCP 서버를 구성합니다. 각 서버는 \"brave-search\" 또는 \"filesystem\"과 같은 고유 키로 식별됩니다. 서버를 시작하려면 원하는 서버를 선택할 수 있는 \"MCP: MCP 서버 시작\" 명령을 사용합니다. 서버를 중지하려면 \"MCP: MCP 서버 중지\" 명령을 사용합니다. 자동 시작은 재시작 후에만 적용되므로 서버를 처음 시작할 때는 수동으로 시작해야 합니다.\n구성 예시\n```{\n \"brave-search\": {\n \"command\": \"npx\",\n \"args\": [\n \"-y\",\n \"@모델컨텍스트프로토콜/서버-브레이브-검색\"\n ],\n \"env\": {\n \"brave_api_key\": \"YOUR_API_KEY\"\n },\n },\n \"파일 시스템\": {\n \"command\": \"npx\",\n \"args\": [\"-y\", \"@modelcontextprotocol/server-filesystem\", \"/사용자/사용자명/데스크톱\"],\n \"env\": {\n \"custom_env_var\": \"custom-value\"\n },\n \"autostart\": false\n }\n}\n```", + "serverAuthToken": { + "mdDescription": "필요한 경우 서버의 인증 토큰입니다. 원격 서버를 인증하는 데 사용됩니다.", + "title": "인증 토큰" + }, + "serverAuthTokenHeader": { + "mdDescription": "서버 인증 토큰에 사용할 헤더 이름입니다. 제공하지 않으면 '무기명'이 포함된 'Authorization'이 사용됩니다.", + "title": "인증 헤더 이름" + }, + "serverUrl": { + "mdDescription": "원격 MCP 서버의 URL입니다. 제공된 경우 서버는 로컬 프로세스를 시작하는 대신 이 URL에 연결합니다.", + "title": "서버 URL" + }, + "title": "MCP 서버 구성" + }, + "start": { + "label": "MCP: MCP 서버 시작" + }, + "stop": { + "label": "MCP: MCP 서버 중지" + } + }, + "mcpConfiguration": { + "arguments": "인수: ", + "autostart": "자동 시작: ", + "connectServer": "연결", + "connectingServer": "연결 중...", + "copiedAllList": "모든 도구를 클립보드에 복사(모든 도구 목록)", + "copiedAllSingle": "모든 도구를 클립보드에 복사(모든 도구가 포함된 단일 프롬프트 조각)", + "copiedForPromptTemplate": "프롬프트 템플릿을 위해 모든 도구를 클립보드에 복사(모든 도구가 포함된 단일 프롬프트 조각)", + "copyAllList": "모두 복사(모든 도구 목록)", + "copyAllSingle": "채팅용 모두 복사(모든 도구가 포함된 단일 프롬프트 조각)", + "copyForPrompt": "복사 도구(채팅 또는 프롬프트 템플릿용)", + "copyForPromptTemplate": "프롬프트 템플릿의 경우 모두 복사(모든 도구가 포함된 단일 프롬프트 조각)", + "environmentVariables": "환경 변수: ", + "headers": "헤더: ", + "noServers": "구성된 MCP 서버 없음", + "serverAuthToken": "인증 토큰: ", + "serverAuthTokenHeader": "인증 헤더 이름: ", + "serverUrl": "서버 URL: ", + "tools": "도구: " + }, + "openai": { + "apiKey": { + "mdDescription": "공식 OpenAI 계정의 API 키를 입력합니다. **참고: **이 환경설정을 사용하면 Open AI API 키가 Theia를 실행하는 컴퓨터에 일반 텍스트로 저장됩니다. 키를 안전하게 설정하려면 환경 변수 `OPENAI_API_KEY`를 사용하세요." + }, + "customEndpoints": { + "apiKey": { + "title": "주어진 URL에서 제공되는 API에 액세스하는 키 또는 글로벌 OpenAI API 키를 사용하려면 'true'를 입력합니다." + }, + "apiVersion": { + "title": "Azure의 지정된 URL에서 제공되는 API에 액세스하는 버전 또는 글로벌 OpenAI API 버전을 사용하려면 'true'를 선택합니다." + }, + "deployment": { + "title": "Azure의 지정된 URL에서 제공되는 API에 액세스하기 위한 배포 이름입니다." + }, + "developerMessageSettings": { + "title": "시스템 메시지 처리를 제어합니다: 사용자`, `시스템`, `개발자`가 역할로 사용되며, `mergeWithFollowingUserMessage`는 다음 사용자 메시지에 시스템 메시지를 접두사로 붙이거나 다음 메시지가 사용자 메시지가 아닌 경우 시스템 메시지를 사용자 메시지로 변환합니다. 건너뛰기`는 시스템 메시지만 제거합니다), 기본값은 `개발자`입니다." + }, + "enableStreaming": { + "title": "스트리밍 API를 사용할지 여부를 나타냅니다. 기본값은 `true`입니다." + }, + "id": { + "title": "UI에서 사용자 지정 모델을 식별하는 데 사용되는 고유 식별자입니다." + }, + "mdDescription": "예를 들어 `vllm`을 통해 OpenAI API와 호환되는 사용자 정의 모델을 통합합니다. 필수 속성은 `model`과 `url`입니다. \n 선택적으로 다음을 수행할 수 있습니다. \n - 고유한 `id`를 지정하여 UI에서 사용자 지정 모델을 식별할 수 있습니다. 아무것도 지정하지 않으면 `model`이 `id`로 사용됩니다. \n - 지정된 URL에서 제공되는 API에 액세스하려면 `apiKey`를 제공합니다. 글로벌 OpenAI API 키를 사용하려면 `true`를 사용합니다. \n - Azure에서 지정된 URL에서 제공되는 API에 액세스하려면 `apiVersion`을 제공합니다. 참`을 사용하여 글로벌 OpenAI API 버전을 사용함을 나타냅니다. \n - 개발자 메시지가 포함되는 방식을 제어하려면 `developerMessageSettings`를 `user`, `system`, `developer`, `mergeWithFollowingUserMessage` 또는 `skip` 중 하나로 설정합니다(여기서 `user`, `system`, `developer`는 역할로 사용되며 `mergeWithFollowingUserMessage`는 다음 사용자 메시지에 시스템 메시지의 접두사가 붙거나 다음 메시지가 사용자 메시지가 아닌 경우 시스템 메시지를 사용자 메시지로 변환합니다). 건너뛰기`는 시스템 메시지만 제거합니다.) 기본값은 `개발자`입니다. \n - 구조화된 출력을 사용하지 않으려면 `supportsStructuredOutput: false`를 지정합니다. \n - 스트리밍이 사용되지 않음을 나타내려면 `enableStreaming: false`를 지정합니다. \n 자세한 내용은 [당사 문서](https://theia-ide.org/docs/user_ai/#openai-compatible-models-eg-via-vllm)를 참조하세요.", + "modelId": { + "title": "모델 ID" + }, + "supportsStructuredOutput": { + "title": "모델이 구조화된 출력을 지원하는지 여부를 나타냅니다. 기본값은 `true`입니다." + }, + "url": { + "title": "모델이 호스팅되는 Open AI API 호환 엔드포인트" + } + }, + "models": { + "description": "공식 OpenAI 모델 사용" + }, + "useResponseApi": { + "mdDescription": "공식 OpenAI 모델에는 채팅 완료 API 대신 최신 OpenAI 응답 API를 사용하세요. 이 설정은 공식 OpenAI 모델에만 적용되며 사용자 지정 제공업체가 개별적으로 구성해야 합니다." + } + }, + "promptTemplates": { + "directories": { + "title": "워크스페이스별 프롬프트 템플릿 디렉터리" + }, + "extensions": { + "description": "프롬프트 템플릿으로 간주되는 프롬프트 위치의 추가 파일 확장자 목록입니다. '.prompttemplate'이 항상 기본값으로 간주됩니다.", + "title": "추가 프롬프트 템플릿 파일 확장자" + }, + "files": { + "title": "워크스페이스별 프롬프트 템플릿 파일" + } + }, + "scanoss": { + "changeSet": { + "clean": "일치하는 항목 없음", + "error": "오류: 재실행", + "error-notification": "ScanOSS 오류가 발생했습니다: {0}.", + "match": "경기 보기", + "scan": "스캔", + "scanning": "스캔..." + }, + "mode": { + "automatic": { + "description": "채팅 보기에서 코드 스니펫 자동 스캔을 사용 설정합니다." + }, + "description": "채팅 보기에서 코드 스니펫을 분석하기 위한 SCANOSS 기능을 구성합니다. 그러면 제안된 코드 스니펫의 해시가 [소프트웨어 투명성 재단](Software Transparency Foundation)에서 호스팅하는 SCANOSS\n서비스(https://www.softwaretransparency.org/osskb)에 제안된 코드 스니펫의 해시를 전송하여 분석합니다.", + "manual": { + "description": "사용자는 채팅 보기에서 스캔 항목을 클릭하여 수동으로 스캔을 트리거할 수 있습니다." + }, + "off": { + "description": "기능이 완전히 꺼져 있습니다." + } + }, + "snippet": { + "dialog-header": "ScanOSS 결과", + "errored": "SCANOSS - 오류 - {0}", + "file-name-heading": "다음에서 일치하는 항목이 발견되었습니다. {0}", + "in-progress": "SCANOSS - 스캔 수행 중...", + "match-count": "{0} 일치 항목을 찾았습니다.", + "matched": "SCANOSS - {0} 일치하는 항목 발견", + "no-match": "SCANOSS - 일치하는 항목 없음", + "summary": "요약" + } + }, + "session-settings-dialog": { + "title": "세션 설정 설정", + "tooltip": "세션 설정 설정" + }, + "terminal": { + "agent": { + "description": "이 에이전트는 임의의 터미널 명령을 작성하고 실행할 수 있도록 지원합니다. 사용자의 요청에 따라 명령을 제안하고 사용자가 직접 터미널에 붙여넣고 실행할 수 있도록 합니다. 현재 디렉토리, 환경 및 터미널 세션의 최근 터미널 출력에 액세스하여 컨텍스트 인식 지원을 제공합니다.", + "vars": { + "cwd": { + "description": "현재 작업 디렉터리입니다." + }, + "recentTerminalContents": { + "description": "터미널에 표시되는 최근 0~50개의 최근 줄입니다." + }, + "shell": { + "description": "사용 중인 셸(예: /usr/bin/zsh)." + }, + "userRequest": { + "description": "사용자의 질문 또는 요청." + } + } + }, + "askAi": "AI에 질문하기", + "askTerminalCommand": "터미널 명령에 대해 질문...", + "hitEnterConfirm": "엔터 키를 눌러 확인", + "howCanIHelp": "무엇을 도와드릴까요?", + "loading": "로드 중", + "tryAgain": "다시 시도하세요...", + "useArrowsAlternatives": " 또는 ⇣를 사용하여 대안을 표시합니다..." + }, + "tokenUsage": { + "cachedInputTokens": "캐시에 기록된 입력 토큰", + "cachedInputTokensTooltip": "'입력 토큰'에 추가로 추적됩니다. 일반적으로 캐시되지 않은 토큰보다 더 비쌉니다.", + "failedToGetTokenUsageData": "토큰 사용량 데이터를 가져오지 못했습니다: {0}", + "inputTokens": "토큰 입력", + "label": "토큰 사용", + "lastUsed": "마지막 사용", + "model": "모델", + "noData": "아직 사용 가능한 토큰 사용 데이터가 없습니다.", + "note": "토큰 사용은 애플리케이션 시작 이후 추적되며 지속되지 않습니다.", + "outputTokens": "출력 토큰", + "readCachedInputTokens": "캐시에서 읽은 입력 토큰", + "readCachedInputTokensTooltip": "'입력 토큰'에 추가로 추적됩니다. 일반적으로 캐시하지 않는 것보다 훨씬 저렴합니다. 일반적으로 요금 한도에 포함되지 않습니다.", + "total": "합계", + "totalTokens": "총 토큰", + "totalTokensTooltip": "'입력 토큰' + '출력 토큰'" + }, + "vercelai": { + "anthropicApiKey": { + "mdDescription": "인공 지능 모델용 API 키를 입력합니다. **참고: 이 환경설정을 사용하면 API 키가 Theia를 실행하는 컴퓨터에 일반 텍스트로 저장됩니다. 키를 안전하게 설정하려면 환경 변수 `ANTHROPIC_API_KEY`를 사용하세요." + }, + "customEndpoints": { + "apiKey": { + "title": "주어진 URL에서 제공되는 API에 액세스하는 키 또는 글로벌 API 키를 사용하려면 'true'를 입력합니다." + }, + "enableStreaming": { + "title": "스트리밍 API를 사용할지 여부를 나타냅니다. 기본값은 `true`입니다." + }, + "id": { + "title": "UI에서 사용자 지정 모델을 식별하는 데 사용되는 고유 식별자입니다." + }, + "mdDescription": "버셀 AI SDK와 호환되는 커스텀 모델을 통합합니다. 필수 속성은 `model`과 `url`입니다. \n 선택적으로 \n - 고유한 `id`를 지정하여 UI에서 커스텀 모델을 식별할 수 있습니다. 아무것도 지정하지 않으면 `model`이 `id`로 사용됩니다. \n - 지정된 URL에서 제공되는 API에 액세스하려면 `apiKey`를 제공합니다. 글로벌 API 키를 사용하려면 `true`를 사용합니다. \n - 구조화된 출력이 사용되지 않음을 나타내려면 `supportsStructuredOutput: false`를 지정합니다. \n - 스트리밍이 사용되지 않음을 나타내려면 `enableStreaming: false`를 지정합니다. \n - 제공자`를 지정하여 모델이 어떤 제공자(openai, anthropic)로부터 제공되었는지를 나타냅니다.", + "modelId": { + "title": "모델 ID" + }, + "supportsStructuredOutput": { + "title": "모델이 구조화된 출력을 지원하는지 여부를 나타냅니다. 기본값은 `true`입니다." + }, + "url": { + "title": "모델이 호스팅되는 API 엔드포인트" + } + }, + "models": { + "description": "버셀 AI SDK와 함께 사용할 수 있는 공식 모델", + "id": { + "title": "모델 ID" + }, + "model": { + "title": "모델 이름" + } + }, + "openaiApiKey": { + "mdDescription": "OpenAI 모델용 API 키를 입력합니다. **참고: 이 환경설정을 사용하면 API 키가 Theia를 실행하는 컴퓨터에 일반 텍스트로 저장됩니다. 키를 안전하게 설정하려면 환경 변수 `OPENAI_API_KEY`를 사용하세요." + } + }, + "workspace": { + "coderAgent": { + "description": "소프트웨어 개발자를 지원하도록 설계된 Theia IDE에 통합된 AI 어시스턴트입니다. 이 에이전트는 사용자의 작업 공간에 액세스하여 사용 가능한 모든 파일 및 폴더 목록을 가져와 콘텐츠를 검색할 수 있습니다. 또한 사용자에게 파일 수정을 제안할 수도 있습니다. 따라서 코딩 작업이나 파일 변경과 관련된 기타 작업에서 사용자를 지원할 수 있습니다." + }, + "considerGitignore": { + "description": "활성화하면 글로벌 .gitignore 파일에 지정된 파일/폴더를 제외합니다(예상 위치는 작업 영역 루트).", + "title": ".gitignore" + }, + "excludedPattern": { + "description": "제외할 파일/폴더의 패턴(글로브 또는 정규식) 목록입니다.", + "title": "제외된 파일 패턴" + }, + "searchMaxResults": { + "description": "워크스페이스 검색 기능에서 반환되는 최대 검색 결과 수입니다.", + "title": "최대 검색 결과" + }, + "workspaceAgent": { + "description": "소프트웨어 개발자를 지원하도록 설계된 Theia IDE에 통합된 AI 어시스턴트입니다. 이 에이전트는 사용자 작업 영역에 액세스할 수 있으며 사용 가능한 모든 파일 및 폴더 목록을 가져와 콘텐츠를 검색할 수 있습니다. 파일을 수정할 수는 없습니다. 따라서 프로젝트 빌드 방법, 소스 코드를 어디에 넣어야 하는지, 특정 코드나 구성을 찾을 수 있는 위치 등 현재 프로젝트, 프로젝트 파일 및 작업 공간의 소스 코드에 대한 질문에 답할 수 있습니다." + } + } + }, + "ai-chat": { + "fileChangeSetTitle": "제안된 변경 사항" + }, + "ai-chat-ui": { + "initiate-session-task-context": "작업 컨텍스트: 세션 시작", + "open-current-session-summary": "현재 세션 요약 열기", + "open-settings-tooltip": "AI 설정 열기...", + "scroll-lock": "스크롤 잠금", + "scroll-unlock": "스크롤 잠금 해제", + "session-settings": "세션 설정 설정", + "showChats": "채팅 표시...", + "summarize-current-session": "현재 세션 요약" + }, + "ai-claude-code": { + "open-config": "클로드 코드 구성 열기", + "open-memory": "클로드 코드 메모리(CLAUDE.MD) 열기" + }, + "ai-core": { + "agentCompletionMessage": "에이전트 \"{0}\"가 작업을 완료했습니다.", + "agentCompletionTitle": "상담원 \"{0}\" 작업 완료", + "agentCompletionWithTask": "상담원 \"{0}\"이 작업을 완료했습니다: {1}" + }, + "ai-editor": { + "contextMenu": "AI에 질문하기", + "sendToChat": "AI 채팅으로 보내기" + }, + "ai-ide": { + "addressGhReviewCommand": { + "argumentHint": "", + "description": "GitHub 풀 리퀘스트에 대한 검토 코멘트 처리" + }, + "fixGhTicketCommand": { + "argumentHint": "", + "description": "GitHub 티켓을 분석하고 해결책을 구현하십시오" + }, + "open-agent-settings-tooltip": "상담원 설정 열기...", + "rememberCommand": { + "argumentHint": "[주제 힌트]", + "description": "대화에서 주제를 추출하고 프로젝트 정보를 업데이트합니다" + }, + "ticketCommand": { + "argumentHint": "", + "description": "GitHub 티켓을 분석하고 구현 계획을 수립하십시오." + }, + "todoTool": { + "noTasks": "작업 없음" + }, + "withAppTesterCommand": { + "description": "테스트를 AppTester 에이전트에 위임합니다(에이전트 모드 필요)" + } + }, + "ai-mcp": { + "blockedServersLabel": "MCP 서버 (자동 시작 차단됨)" + }, + "ai-terminal": { + "cancelExecution": "명령 실행 취소", + "canceling": "취소 중...", + "confirmExecution": "셸 명령어 확인", + "denialReason": "이유", + "executionCanceled": "취소됨", + "executionDenied": "거절됨", + "executionDeniedWithReason": "이유를 들어 거절하다", + "noOutput": "출력 없음", + "partialOutput": "부분 출력", + "timeout": "타임아웃", + "workingDirectory": "작업 디렉터리" + }, + "callhierarchy": { + "noCallers": "발신자가 감지되지 않았습니다.", + "open": "오픈 콜 계층 구조" + }, + "chat": { + "taskContextVariable": { + "args": { + "contextId": { + "description": "검색할 작업 컨텍스트의 ID 또는 요약할 채팅 세션입니다." + } + }, + "description": "작업 완료 계획 또는 이전 세션 요약과 같은 작업의 컨텍스트 정보를 제공합니다.", + "label": "작업 컨텍스트" + } + }, + "collaboration": { + "collaborate": "협업", + "collaboration": "협업", + "collaborationWorkspace": "협업 작업 공간", + "connected": "연결됨", + "connectedSession": "공동 작업 세션에 연결됨", + "copiedInvitation": "초대 코드가 클립보드에 복사되었습니다.", + "copyAgain": "다시 복사", + "createRoom": "새 공동 작업 세션 만들기", + "creatingRoom": "세션 만들기", + "end": "협업 세션 종료", + "endDetail": "세션을 종료하고, 콘텐츠 공유를 중단하고, 다른 사용자의 액세스 권한을 취소합니다.", + "enterCode": "공동 작업 세션 코드 입력", + "failedCreate": "공간을 만들지 못했습니다: {0}", + "failedJoin": "방에 참여하지 못했습니다: {0}", + "fieldRequired": "{0} 필드는 필수 입력 사항입니다. 로그인이 중단되었습니다.", + "invite": "다른 사람 초대", + "inviteDetail": "초대 코드를 복사하여 다른 사람들과 공유하여 세션에 참여합니다.", + "joinRoom": "협업 세션 참여", + "joiningRoom": "세션 참여", + "leave": "공동 작업 세션 나가기", + "leaveDetail": "현재 공동 작업 세션에서 연결을 끊고 워크스페이스를 닫습니다.", + "loginFailed": "로그인에 실패했습니다.", + "loginSuccessful": "로그인에 성공했습니다.", + "noAuth": "서버에서 제공하는 인증 방법이 없습니다.", + "optional": "선택 사항", + "selectAuth": "인증 방법 선택", + "selectCollaboration": "협업 옵션 선택", + "serverUrl": "서버 URL", + "serverUrlDescription": "라이브 협업 세션을 위한 Open Collaboration Tools 서버 인스턴스의 URL", + "sharedSession": "공동 작업 세션 공유", + "startSession": "공동 작업 세션 시작 또는 참여", + "userWantsToJoin": "사용자 '{0}' 가 공동 작업실에 참여하려고 합니다.", + "whatToDo": "다른 공동 작업자들과 함께 무엇을 하고 싶으신가요?" + }, + "core": { + "about": { + "compatibility": "{0} 호환성", + "defaultApi": "기본값 {0} API", + "listOfExtensions": "확장 프로그램 목록" + }, + "common": { + "closeAll": "모든 탭 닫기", + "closeAllTabMain": "메인 영역의 모든 탭 닫기", + "closeOtherTabMain": "메인 영역에서 다른 탭 닫기", + "closeOthers": "다른 탭 닫기", + "closeRight": "오른쪽 탭 닫기", + "closeTab": "탭 닫기", + "closeTabMain": "메인 영역에서 탭 닫기", + "collapseAllTabs": "모든 측면 패널 접기", + "collapseBottomPanel": "하단 패널 토글", + "collapseLeftPanel": "왼쪽 패널 토글", + "collapseRightPanel": "오른쪽 패널 토글", + "collapseTab": "측면 패널 접기", + "showNextTabGroup": "다음 탭 그룹으로 전환", + "showNextTabInGroup": "그룹에서 다음 탭으로 전환", + "showPreviousTabGroup": "이전 탭 그룹으로 전환", + "showPreviousTabInGroup": "그룹에서 이전 탭으로 전환", + "toggleMaximized": "최대화 토글" + }, + "copyInfo": "먼저 파일을 열어 경로를 복사합니다.", + "copyWarn": "브라우저의 복사 명령 또는 바로 가기를 사용하세요.", + "cutWarn": "브라우저의 잘라내기 명령 또는 바로 가기를 사용하세요.", + "enhancedPreview": { + "classic": "기본 정보가 포함된 탭의 간단한 미리 보기를 표시합니다.", + "enhanced": "추가 정보가 포함된 탭의 향상된 미리 보기를 표시합니다.", + "visual": "탭의 시각적 미리 보기를 표시합니다." + }, + "file": { + "browse": "찾아보기" + }, + "highlightModifiedTabs": "수정된(더티) 편집기 탭에 상단 테두리를 그릴지 여부를 제어합니다.", + "keybinding": { + "duplicateModifierError": "키 바인딩을 구문 분석할 수 없음 {0} 중복 수정자", + "metaError": "키 바인딩을 구문 분석할 수 없음 {0} 메타는 OSX 전용입니다.", + "unrecognizedKeyError": "에서 인식할 수 없는 키 {0} {1}" + }, + "keybindingStatus": "{0} 키를 누르고 더 많은 키를 기다렸습니다.", + "keyboard": { + "choose": "키보드 레이아웃 선택", + "chooseLayout": "키보드 레이아웃 선택", + "current": "(현재: {0})", + "currentLayout": " - 현재 레이아웃", + "mac": "Mac 키보드", + "pc": "PC 키보드", + "tryDetect": "브라우저 정보 및 누른 키에서 키보드 레이아웃을 감지해 보세요." + }, + "navigator": { + "clipboardWarn": "클립보드에 대한 액세스가 거부되었습니다. 브라우저의 권한을 확인하세요.", + "clipboardWarnFirefox": "클립보드 API를 사용할 수 없습니다. '{0}' 페이지의 '{1}' 환경 설정에서 활성화할 수 있습니다. 그런 다음 Theia를 다시 로드합니다. 이렇게 하면 FireFox가 시스템 클립보드에 대한 전체 액세스 권한을 갖게 됩니다." + }, + "offline": "오프라인", + "pasteWarn": "브라우저의 붙여넣기 명령 또는 바로 가기를 사용하세요.", + "quitMessage": "저장하지 않은 변경 사항은 저장되지 않습니다.", + "resetWorkbenchLayout": "워크벤치 레이아웃 재설정", + "searchbox": { + "close": "닫기(탈출)", + "next": "다음 (아래로)", + "previous": "이전 (위로)", + "showAll": "모든 항목 표시", + "showOnlyMatching": "일치하는 항목만 표시" + }, + "secondaryWindow": { + "alwaysOnTop": "활성화하면 보조 창이 다른 애플리케이션의 창을 포함한 다른 모든 창 위에 표시됩니다.", + "description": "추출된 보조 창의 초기 위치와 크기를 설정합니다.", + "fullSize": "추출된 위젯의 위치와 크기는 실행 중인 테아 애플리케이션과 동일합니다.", + "halfWidth": "추출된 위젯의 위치와 크기는 실행 중인 테아 애플리케이션 너비의 절반이 됩니다.", + "originalSize": "추출된 위젯의 위치와 크기는 원래 위젯과 동일합니다." + }, + "severity": { + "log": "로그" + }, + "silentNotifications": "알림 팝업 표시 여부를 제어합니다.", + "tabDefaultSize": "탭의 기본 크기를 지정합니다.", + "tabMaximize": "더블 클릭 시 탭을 최대화할지 여부를 제어합니다.", + "tabMinimumSize": "탭의 최소 크기를 지정합니다.", + "tabShrinkToFit": "사용 가능한 공간에 맞게 탭을 축소합니다.", + "window": { + "tabCloseIconPlacement": { + "description": "탭의 시작 또는 끝에 탭 제목에 닫기 아이콘을 배치합니다. 기본값은 모든 플랫폼에서 끝입니다.", + "end": "레이블 끝에 닫기 아이콘을 배치합니다. 왼쪽에서 오른쪽으로 쓰는 언어에서는 탭의 오른쪽에 있습니다.", + "start": "레이블의 시작 부분에 닫기 아이콘을 배치합니다. 왼쪽에서 오른쪽으로 쓰는 언어에서는 탭의 왼쪽에 위치합니다." + } + }, + "window.menuBarVisibility": "메뉴는 사이드바에 컴팩트 버튼 형태로 표시됩니다. 이 값은 일 {0}때 {1}무시됩니다." + }, + "debug": { + "TheiaIDE": "Theia IDE", + "addConfigurationPlaceholder": "구성을 추가할 작업 공간 루트를 선택합니다.", + "breakpoint": "브레이크포인트", + "cannotRunToThisLocation": "현재 스레드를 지정된 위치로 실행할 수 없습니다.", + "compound-cycle": "실행 구성 '{0}' 자체에 사이클이 포함되어 있습니다.", + "conditionalBreakpoint": "조건부 중단점", + "conditionalBreakpointsNotSupported": "이 디버그 유형에서 지원되지 않는 조건부 중단점", + "confirmRunToShiftedPosition_msg": "목표 위치가 Ln {0}, Col {1} 으로 이동합니다. 어쨌든 실행하시겠습니까?", + "confirmRunToShiftedPosition_title": "현재 스레드를 정확히 지정된 위치로 실행할 수 없습니다.", + "consoleFilter": "필터 (예: 텍스트, !제외)", + "consoleFilterAriaLabel": "디버그 콘솔 출력 필터링", + "consoleSessionSelectorTooltip": "디버그 세션 간 전환. 각 디버그 세션은 자체 콘솔 출력을 가집니다.", + "consoleSeverityTooltip": "콘솔 출력을 심각도 수준별로 필터링합니다. 선택한 심각도를 가진 메시지만 표시됩니다.", + "continueAll": "모두 계속하기", + "copyExpressionValue": "표현식 값 복사", + "couldNotRunTask": "'{0}' 작업을 실행할 수 없습니다.", + "dataBreakpoint": "데이터 중단점", + "debugConfiguration": "디버그 구성", + "debugSessionInitializationFailed": "디버그 세션 초기화에 실패했습니다. 자세한 내용은 콘솔을 참조하세요.", + "debugSessionTypeNotSupported": "디버그 세션 유형 \"{0}\"는 지원되지 않습니다.", + "debugToolbarMenu": "디버그 도구 모음 메뉴", + "debugVariableInput": "{0} 값 설정", + "disableSelectedBreakpoints": "선택한 중단점 비활성화", + "disabledBreakpoint": "장애인 {0}", + "enableSelectedBreakpoints": "선택된 중단점 활성화", + "entry": "항목", + "errorStartingDebugSession": "디버그 세션을 시작하는 동안 오류가 발생했습니다. 자세한 내용은 로그를 확인하세요.", + "exception": "예외", + "functionBreakpoint": "함수 중단점", + "goto": "goto", + "htiConditionalBreakpointsNotSupported": "이 디버그 유형에서 지원되지 않는 조건부 중단점 적중", + "instruction-breakpoint": "명령어 중단점", + "instructionBreakpoint": "명령어 중단점", + "logpointsNotSupported": "이 디버그 유형에서 지원되지 않는 로그포인트", + "missingConfiguration": "동적 구성 '{0}:{1}' 이 누락되었거나 해당되지 않습니다.", + "pause": "일시 중지", + "pauseAll": "모두 일시 중지", + "reveal": "공개", + "step": "단계", + "taskTerminatedBySignal": "작업 '{0}' 신호에 의해 종료됨 {1}.", + "taskTerminatedForUnknownReason": "알 수 없는 이유로 작업 '{0}' 이 종료되었습니다.", + "taskTerminatedWithExitCode": "작업 '{0}' 종료 코드 {1} 로 종료됨 .", + "threads": "스레드", + "toggleTracing": "디버그 어댑터와의 추적 통신 활성화/비활성화", + "unknownSession": "알 수 없는 세션", + "unverifiedBreakpoint": "확인되지 않음 {0}" + }, + "editor": { + "diffEditor.wordWrap2": "줄 바꿈은 `#편집기.wordWrap#` 설정에 따라 줄 바꿈됩니다.", + "dirtyEncoding": "파일이 더럽습니다. 다른 인코딩으로 다시 열기 전에 먼저 저장해 주세요.", + "editor.bracketPairColorization.enabled": "대괄호 쌍 색상화 사용 여부를 제어합니다. 대괄호 하이라이트 색상을 재정의하려면 `#workbench.colorCustomizations#`를 사용합니다.", + "editor.codeActions.triggerOnFocusChange": "파일이 자동 저장될 때 `#files.autoSave#`가 `afterDelay`로 설정된 경우 `#editor.codeActionsOnSave#`를 트리거하도록 설정합니다. 창 및 포커스 변경에 대해 코드 액션을 `항상`으로 설정해야 트리거됩니다.", + "editor.detectIndentation": "파일 내용을 기반으로 파일을 열 때 `#편집기.탭 크기#` 및 `#편집기.삽입 공백#`을 자동으로 감지할지 여부를 제어합니다.", + "editor.experimental.preferTreeSitter": "트리 시터 파싱을 특정 언어에 대해 활성화할지 여부를 제어합니다. 이는 지정된 언어에 대해 `editor.experimental.treeSitterTelemetry`보다 우선 적용됩니다.", + "editor.inlayHints.enabled1": "인레이 힌트는 기본적으로 표시되며 Ctrl+Alt를 누르고 있으면 숨겨집니다.", + "editor.inlayHints.enabled2": "인레이 힌트는 기본적으로 숨겨져 있으며 Ctrl+Alt를 누르고 있으면 표시됩니다.", + "editor.inlayHints.fontFamily": "편집기에서 인레이 힌트의 글꼴 패밀리를 제어합니다. 비워두면 `#editor.fontFamily#`가 사용됩니다.", + "editor.inlayHints.fontSize": "에디터에서 인레이 힌트의 글꼴 크기를 제어합니다. 기본적으로 설정된 값이 `5`보다 작거나 편집기 글꼴 크기보다 큰 경우 `#editor.fontSize#`가 사용됩니다.", + "editor.inlineSuggest.edits.experimental.enabled": "인라인 제안에서 실험적 편집을 활성화할지 여부를 제어합니다.", + "editor.inlineSuggest.edits.experimental.onlyShowWhenCloseToCursor": "커서가 제안에 가까워졌을 때 인라인 제안만 표시할지 여부를 제어합니다.", + "editor.inlineSuggest.edits.experimental.useInterleavedLinesDiff": "인라인 제안에서 실험적인 인터리브 라인 차이를 활성화할지 여부를 제어합니다.", + "editor.inlineSuggest.edits.experimental.useMixedLinesDiff": "인라인 제안에서 실험적 편집을 활성화할지 여부를 제어합니다.", + "editor.insertSpaces": "Tab`을 누를 때 공백을 삽입합니다. 이 설정은 `#편집기 감지 들여쓰기#`가 켜져 있을 때 파일 내용에 따라 재정의됩니다.", + "editor.quickSuggestions": "입력하는 동안 제안을 자동으로 표시할지 여부를 제어합니다. 주석, 문자열 및 기타 코드를 입력할 때 이 기능을 제어할 수 있습니다. 빠른 제안은 고스트 텍스트로 표시하거나 제안 위젯과 함께 표시하도록 구성할 수 있습니다. 또한 특수 문자에 의해 제안이 트리거되는지 여부를 제어하는 '#editor.suggestOnTriggerCharacters#'설정도 알아두세요.", + "editor.suggestFontSize": "추천 위젯의 글꼴 크기입니다. 0`으로 설정하면 `#editor.fontSize#`의 값이 사용됩니다.", + "editor.suggestLineHeight": "제안 위젯의 줄 높이입니다. '0'으로 설정하면 '#편집기줄높이#'의 값이 사용됩니다. 최소값은 8입니다.", + "editor.tabSize": "탭의 공백 수입니다. 이 설정은 `#편집기 감지 들여쓰기#`가 켜져 있을 때 파일 내용에 따라 재정의됩니다.", + "formatOnSaveTimeout": "파일 저장 시 실행되는 서식이 취소되는 시간 초과(밀리초)입니다.", + "persistClosedEditors": "창을 다시 로드할 때 작업 영역의 닫힌 편집기 기록을 유지할지 여부를 제어합니다.", + "showAllEditors": "열려 있는 모든 편집기 표시", + "splitHorizontal": "편집기 가로 분할", + "splitVertical": "편집기 세로 분할", + "toggleStickyScroll": "고정 스크롤 토글" + }, + "external-terminal": { + "cwd": "새 외부 터미널의 현재 작업 디렉터리 선택" + }, + "file-search": { + "toggleIgnoredFiles": " (무시된 파일을 표시/숨기려면 {0} 을 누르세요.)" + }, + "fileDialog": { + "showHidden": "숨겨진 파일 표시" + }, + "fileSystem": { + "fileResource": { + "overWriteBody": "파일 시스템의 '{0}' 변경 내용을 덮어쓰시겠습니까?" + } + }, + "filesystem": { + "copiedToClipboard": "다운로드 링크를 클립보드에 복사합니다.", + "copyDownloadLink": "다운로드 링크 복사", + "dialog": { + "initialLocation": "초기 위치로 이동", + "multipleItemMessage": "하나의 항목만 선택할 수 있습니다.", + "navigateBack": "뒤로 이동", + "navigateForward": "앞으로 탐색", + "navigateUp": "하나의 디렉터리로 이동" + }, + "fileResource": { + "binaryFileQuery": "열면 시간이 걸리고 IDE가 응답하지 않을 수 있습니다. 그래도 '{0}' 을 열시겠습니까?", + "binaryTitle": "파일이 바이너리이거나 지원되지 않는 텍스트 인코딩을 사용합니다.", + "largeFileTitle": "파일이 너무 큽니다({0}).", + "overwriteTitle": "파일 시스템에서 '{0}' 파일이 변경되었습니다." + }, + "filesExclude": "파일 및 폴더를 제외하기 위한 글로브 패턴을 구성합니다. 예를 들어, 파일 탐색기는 이 설정에 따라 표시하거나 숨길 파일 및 폴더를 결정합니다.", + "format": "형식:", + "maxConcurrentUploads": "여러 파일을 업로드할 때 업로드할 수 있는 최대 동시 파일 수입니다. 0은 모든 파일이 동시에 업로드됨을 의미합니다.", + "maxFileSizeMB": "열 수 있는 최대 파일 크기(MB)를 제어합니다.", + "prepareDownload": "다운로드 준비 중...", + "prepareDownloadLink": "다운로드 링크 준비 중...", + "processedOutOf": "처리된 {0} 중 {1}", + "replaceTitle": "파일 바꾸기", + "uploadFailed": "파일을 업로드하는 동안 오류가 발생했습니다. {0}", + "uploadFiles": "파일 업로드...", + "uploadedOutOf": "업로드 {0} 중 {1}" + }, + "getting-started": { + "ai": { + "header": "Theia IDE의 AI 지원 기능이 제공됩니다(베타 버전)!", + "openAIChatView": "지금 AI 채팅 뷰를 열어 시작하는 방법을 알아보세요!" + }, + "apiComparator": "{0} API 호환성", + "newExtension": "새 확장 프로그램 구축", + "newPlugin": "새 플러그인 구축", + "startup-editor": { + "welcomePage": "{0} 및 확장 프로그램을 시작하는 데 도움이 되는 콘텐츠가 있는 시작 페이지를 엽니다." + }, + "telemetry": "데이터 사용량 및 원격 분석" + }, + "git": { + "aFewSecondsAgo": "몇 초 전", + "addSignedOff": "결재자 추가", + "added": "추가됨", + "amendReuseMessage": "마지막 커밋 메시지를 다시 사용하려면 'Enter' 또는 'Escape'를 눌러 취소합니다.", + "amendRewrite": "이전 커밋 메시지를 다시 작성합니다. 'Enter'를 눌러 확인하거나 'Escape'를 눌러 취소합니다.", + "checkoutCreateLocalBranchWithName": "{0} 이라는 이름으로 새 로컬 브랜치를 만듭니다. 'Enter'를 눌러 확인하거나 'Escape'를 눌러 취소합니다.", + "checkoutProvideBranchName": "지점 이름을 입력하세요. ", + "checkoutSelectRef": "결제할 참조를 선택하거나 새 로컬 지점을 생성합니다:", + "cloneQuickInputLabel": "Git 리포지토리 위치를 입력하세요. 'Enter'를 눌러 확인하거나 'Escape'를 눌러 취소합니다.", + "cloneRepository": "Git 리포지토리를 복제합니다: {0}. 'Enter'를 눌러 확인하거나 'Escape'를 눌러 취소합니다.", + "compareWith": "비교 대상...", + "compareWithBranchOrTag": "현재 활성화된 {0} 브랜치와 비교할 브랜치 또는 태그를 선택합니다:", + "conflicted": "충돌", + "copied": "복사됨", + "diff": "Diff", + "dirtyDiffLinesLimit": "편집기의 줄 수가 이 제한을 초과하는 경우 더티 디프 장식을 표시하지 않습니다.", + "dropStashMessage": "보관함이 성공적으로 제거되었습니다.", + "editorDecorationsEnabled": "에디터에서 git 장식을 표시합니다.", + "fetchPickRemote": "가져올 리모컨을 선택합니다:", + "gitDecorationsColors": "내비게이터에서 색상 장식을 사용합니다.", + "mergeEditor": { + "currentSideTitle": "현재", + "incomingSideTitle": "수신" + }, + "mergeQuickPickPlaceholder": "현재 활성 상태인 {0} 브랜치에 병합할 브랜치를 선택합니다:", + "missingUserInfo": "git에서 'user.name'과 'user.email'을 구성했는지 확인하세요.", + "noHistoryForError": "다음에 사용할 수 있는 기록이 없습니다. {0}", + "noPreviousCommit": "수정할 이전 커밋이 없습니다.", + "noRepositoriesSelected": "선택한 리포지토리가 없습니다.", + "prepositionIn": "in", + "renamed": "이름 변경", + "repositoryNotInitialized": "리포지토리 {0} 가 아직 초기화되지 않았습니다.", + "stashChanges": "변경 사항을 저장합니다. 'Enter'를 눌러 확인하거나 'Escape'를 눌러 취소합니다.", + "stashChangesWithMessage": "메시지와 함께 변경 사항을 저장합니다: {0}. 'Enter'를 눌러 확인하거나 'Escape'를 눌러 취소합니다.", + "tabTitleIndex": "{0} (색인)", + "tabTitleWorkingTree": "{0} (작업 트리)", + "toggleBlameAnnotations": "비난 주석 토글", + "unstaged": "무대 없음" + }, + "keybinding-schema-updater": { + "deprecation": "대신 '언제' 절을 사용합니다." + }, + "keymaps": { + "addKeybindingTitle": "다음에 대한 키 바인딩 추가 {0}", + "editKeybinding": "키 바인딩 편집...", + "editKeybindingTitle": "다음에 대한 키 바인딩 편집 {0}", + "editWhenExpression": "표현식 편집...", + "editWhenExpressionTitle": "다음에 대한 표현식 편집 {0}", + "keybinding": { + "copy": "키 바인딩 복사", + "copyCommandId": "키 바인딩 명령 ID 복사", + "copyCommandTitle": "키 바인딩 명령 제목 복사", + "edit": "키 바인딩 편집...", + "editWhenExpression": "표현식 편집 시 키 바인딩..." + }, + "keybindingCollidesValidation": "현재 충돌하는 키 바인딩", + "requiredKeybindingValidation": "키 바인딩 값은 필수입니다.", + "resetKeybindingConfirmation": "이 키 바인딩을 정말 기본값으로 재설정하시겠습니까?", + "resetKeybindingTitle": "다음에 대한 키 바인딩 재설정 {0}", + "resetMultipleKeybindingsWarning": "이 명령에 대해 여러 개의 키 바인딩이 있는 경우 모두 재설정됩니다." + }, + "localize": { + "offlineTooltip": "백엔드에 연결할 수 없습니다." + }, + "markers": { + "clearAll": "모두 지우기", + "noProblems": "지금까지 워크스페이스에서 문제가 감지되지 않았습니다.", + "tabbarDecorationsEnabled": "탭 표시줄에 문제 데코레이터(진단 마커)를 표시합니다." + }, + "memory-inspector": { + "addressTooltip": "표시할 메모리 위치, 주소 또는 주소로 평가하는 표현식", + "ascii": "ASCII", + "binary": "바이너리", + "byteSize": "바이트 크기", + "bytesPerGroup": "그룹당 바이트 수", + "closeSettings": "설정 닫기", + "columns": "열", + "command": { + "createNewMemory": "새 메모리 검사기 만들기", + "createNewRegisterView": "새 등록 보기 만들기", + "followPointer": "포인터 팔로우", + "followPointerMemory": "메모리 인스펙터에서 포인터 팔로우", + "resetValue": "값 재설정", + "showRegister": "메모리 검사기에서 등록 표시", + "viewVariable": "메모리 인스펙터에서 변수 표시" + }, + "data": "데이터", + "decimal": "십진수", + "diff": { + "label": "Diff: {0}" + }, + "diff-widget": { + "offset-label": "{0} 오프셋", + "offset-title": "메모리에서 오프셋할 바이트 {0}" + }, + "editable": { + "apply": "변경 사항 적용", + "clear": "변경 사항 지우기" + }, + "endianness": "엔디안", + "extraColumn": "추가 열", + "groupsPerRow": "행별 그룹", + "hexadecimal": "16진수", + "length": "길이", + "lengthTooltip": "가져올 바이트 수(10진수 또는 16진수)", + "memory": { + "addressField": { + "memoryReadError": "위치 필드에 주소 또는 표현식을 입력합니다." + }, + "freeze": "메모리 고정 보기", + "hideSettings": "설정 패널 숨기기", + "readError": { + "bounds": "메모리 한도를 초과하면 결과가 잘립니다.", + "noContents": "현재 사용할 수 있는 메모리 콘텐츠가 없습니다." + }, + "readLength": { + "memoryReadError": "길이 필드에 길이(10진수 또는 16진수)를 입력합니다." + }, + "showSettings": "설정 패널 표시", + "unfreeze": "메모리 고정 해제 보기", + "userError": "메모리를 가져오는 동안 오류가 발생했습니다." + }, + "memoryCategory": "메모리 검사기", + "memoryInspector": "메모리 검사기", + "memoryTitle": "메모리", + "octal": "옥탈", + "offset": "오프셋", + "offsetTooltip": "탐색 시 현재 메모리 위치에 추가할 오프셋입니다.", + "provider": { + "localsError": "로컬 변수를 읽을 수 없습니다. 활성 디버그 세션이 없습니다.", + "readError": "메모리를 읽을 수 없습니다. 활성 디버그 세션이 없습니다.", + "writeError": "메모리를 쓸 수 없습니다. 활성 디버그 세션이 없습니다." + }, + "register": "등록하기", + "register-widget": { + "filter-placeholder": "필터(로 시작)" + }, + "registerReadError": "레지스터를 가져오는 동안 오류가 발생했습니다.", + "registers": "레지스터", + "toggleComparisonWidgetVisibility": "비교 위젯 표시 여부 토글", + "utils": { + "afterBytes": "비교하려는 두 위젯 모두에 메모리를 로드해야 합니다. {0} 메모리가 로드되지 않았습니다.", + "bytesMessage": "비교하려는 두 위젯 모두에 메모리를 로드해야 합니다. {0} 메모리가 로드되지 않았습니다." + } + }, + "messages": { + "notificationTimeout": "이 시간 초과 후에는 정보 알림이 숨겨집니다.", + "toggleNotifications": "알림 토글" + }, + "mini-browser": { + "typeUrl": "URL 입력" + }, + "monaco": { + "noSymbolsMatching": "일치하는 기호 없음", + "typeToSearchForSymbols": "기호를 검색하려면 입력하세요." + }, + "navigator": { + "autoReveal": "자동 공개", + "clipboardWarn": "클립보드에 대한 액세스가 거부되었습니다. 브라우저의 권한을 확인하세요.", + "clipboardWarnFirefox": "클립보드 API를 사용할 수 없습니다. '{0}' 페이지의 '{1}' 환경 설정에서 활성화할 수 있습니다. 그런 다음 Theia를 다시 로드합니다. 이렇게 하면 FireFox가 시스템 클립보드에 대한 전체 액세스 권한을 갖게 됩니다.", + "openWithSystemEditor": "시스템 편집기로 열기", + "refresh": "탐색기에서 새로 고침", + "reveal": "탐색기에서 공개", + "systemEditor": "시스템 편집기", + "toggleHiddenFiles": "숨겨진 파일 토글" + }, + "output": { + "clearOutputChannel": "출력 채널 지우기...", + "closeOutputChannel": "출력 채널 닫기...", + "hiddenChannels": "숨겨진 채널", + "hideOutputChannel": "출력 채널 숨기기...", + "maxChannelHistory": "출력 채널의 최대 항목 수입니다.", + "outputChannels": "출력 채널", + "showOutputChannel": "출력 채널 표시..." + }, + "plugin": { + "blockNewTab": "브라우저가 새 탭을 열지 못했습니다." + }, + "plugin-dev": { + "alreadyRunning": "호스팅된 인스턴스가 이미 실행 중입니다.", + "debugInstance": "인스턴스 디버그", + "debugMode": "Node.js 디버그에 inspect 또는 inspect-brk 사용", + "debugPorts": { + "debugPort": "이 서버의 Node.js 디버그에 사용할 포트" + }, + "devHost": "개발 호스트", + "failed": "호스팅된 플러그인 인스턴스를 실행하지 못했습니다: {0}", + "hostedPlugin": "호스팅 플러그인", + "hostedPluginRunning": "호스팅 플러그인: 실행 중", + "hostedPluginStarting": "호스팅 플러그인: 시작", + "hostedPluginStopped": "호스팅 플러그인: 중지됨", + "hostedPluginWatching": "호스팅 플러그인: 보기", + "instanceTerminated": "{0} 종료되었습니다.", + "launchOutFiles": "생성된 자바스크립트 파일을 찾기 위한 글로브 패턴 배열(`${플러그인패스}`는 플러그인 실제 경로로 대체됨).", + "noValidPlugin": "지정한 폴더에 유효한 플러그인이 포함되어 있지 않습니다.", + "notRunning": "호스팅된 인스턴스가 실행되고 있지 않습니다.", + "pluginFolder": "플러그인 폴더로 설정됩니다: {0}", + "preventedNewTab": "브라우저가 새 탭을 열지 못했습니다.", + "restartInstance": "인스턴스 다시 시작", + "running": "호스팅된 인스턴스가 실행 중입니다:", + "selectPath": "경로 선택", + "startInstance": "인스턴스 시작", + "starting": "호스팅 인스턴스 서버 시작 ...", + "stopInstance": "인스턴스 중지", + "unknownTerminated": "인스턴스가 종료되었습니다.", + "watchMode": "개발 중인 플러그인에서 감시자 실행" + }, + "plugin-ext": { + "authentication-main": { + "loginTitle": "로그인", + "signedOut": "로그아웃에 성공했습니다." + }, + "plugins": "플러그인", + "webviewTrace": "웹뷰로 통신 추적을 제어합니다.", + "webviewWarnIfUnsecure": "웹뷰가 현재 안전하지 않게 배포되었음을 사용자에게 경고합니다." + }, + "preferences": { + "ai-features": "AI 기능", + "hostedPlugin": "호스팅 플러그인", + "toolbar": "도구 모음" + }, + "preview": { + "openByDefault": "기본적으로 편집기 대신 미리 보기를 엽니다." + }, + "property-view": { + "created": "생성됨", + "directory": "디렉토리", + "lastModified": "마지막 수정", + "location": "위치", + "noProperties": "사용 가능한 숙소가 없습니다.", + "properties": "속성", + "symbolicLink": "기호 링크" + }, + "remote": { + "dev-container": { + "connect": "컨테이너에서 다시 열기", + "noDevcontainerFiles": "워크스페이스에 devcontainer.json 파일이 없습니다. devcontainer.json 파일이 있는 .devcontainer 디렉터리가 있는지 확인하세요.", + "selectDevcontainer": "devcontainer.json 파일을 선택합니다." + }, + "ssh": { + "connect": "현재 창을 호스트에 연결...", + "connectToConfigHost": "구성 파일에서 현재 창을 호스트에 연결...", + "enterHost": "SSH 호스트 이름 입력", + "enterUser": "SSH 사용자 이름 입력", + "failure": "원격에 대한 SSH 연결을 열 수 없습니다.", + "hostPlaceHolder": "예: hello@example.com", + "needsHost": "호스트 이름을 입력하세요.", + "needsUser": "사용자 이름을 입력하세요.", + "userPlaceHolder": "예: 안녕하세요" + }, + "sshNoConfigPath": "SSH 구성 경로를 찾을 수 없습니다.", + "wsl": { + "connectToWsl": "WSL에 연결", + "connectToWslUsingDistro": "배포판을 사용하여 WSL에 연결...", + "noWslDistroFound": "WSL 배포판을 찾을 수 없습니다. 먼저 WSL 배포판을 설치하세요.", + "reopenInWsl": "WSL에서 폴더 다시 열기", + "selectWSLDistro": "WSL 배포 선택" + } + }, + "scm": { + "amend": "수정", + "amendHeadCommit": "HEAD 커밋", + "amendLastCommit": "마지막 커밋 수정", + "changeRepository": "리포지토리 변경...", + "config.untrackedChanges": "추적되지 않은 변경 사항의 작동 방식을 제어합니다.", + "config.untrackedChanges.hidden": "숨겨진", + "config.untrackedChanges.mixed": "혼합", + "config.untrackedChanges.separate": "분리", + "dirtyDiff": { + "close": "변경 사항 미리 보기 닫기" + }, + "history": "역사", + "mergeEditor": { + "resetConfirmationTitle": "이 편집기에서 병합 결과를 정말로 초기화하시겠습니까?" + }, + "noRepositoryFound": "리포지토리를 찾을 수 없습니다.", + "unamend": "수정 취소", + "unamendCommit": "커밋 수정 취소" + }, + "search-in-workspace": { + "includeIgnoredFiles": "무시된 파일 포함", + "noFolderSpecified": "폴더를 열거나 지정하지 않았습니다. 현재 열려 있는 파일만 검색됩니다.", + "resultSubset": "이는 전체 결과의 일부일 뿐입니다. 보다 구체적인 검색어를 사용하여 결과 목록의 범위를 좁히세요.", + "searchOnEditorModification": "수정한 경우 활성 편집기를 검색합니다." + }, + "secondary-window": { + "extract-widget": "보기를 보조 창으로 이동" + }, + "shell-area": { + "secondary": "보조 창" + }, + "task": { + "attachTask": "작업 첨부...", + "circularReferenceDetected": "순환 참조가 감지됨: {0} --> {1}", + "clearHistory": "기록 지우기", + "errorKillingTask": "작업 '{0}' 죽이는 중 오류가 발생했습니다: {1}", + "errorLaunchingTask": "작업 '{0}' 시작 중 오류가 발생했습니다: {1}", + "invalidTaskConfigs": "잘못된 작업 구성이 발견되었습니다. tasks.json을 열고 문제 보기에서 세부 정보를 찾습니다.", + "neverScanTaskOutput": "작업 출력을 스캔하지 마세요.", + "noTaskToRun": "실행할 작업을 찾을 수 없습니다. 작업 구성...", + "noTasksFound": "작업을 찾을 수 없습니다.", + "notEnoughDataInDependsOn": "\"의존성\"에 제공된 정보만으로는 올바른 작업을 일치시키기에 충분하지 않습니다!", + "schema": { + "commandOptions": { + "cwd": "실행된 프로그램 또는 스크립트의 현재 작업 디렉터리입니다. 생략하면 현재 작업 공간 루트가 사용됩니다." + }, + "presentation": { + "panel": { + "dedicated": "터미널은 특정 작업 전용입니다. 해당 작업이 다시 실행되면 터미널이 재사용됩니다. 그러나 다른 작업의 출력은 다른 터미널에 표시됩니다.", + "new": "해당 작업을 실행할 때마다 새로운 클린 터미널을 사용합니다.", + "shared": "터미널이 공유되고 다른 작업 실행의 출력이 동일한 터미널에 추가됩니다." + }, + "showReuseMessage": "\"터미널은 작업에서 재사용됩니다.\" 메시지를 표시할지 여부를 제어합니다." + }, + "problemMatcherObject": { + "owner": "테아 내부의 문제 소유자입니다. 베이스가 지정된 경우 생략할 수 있습니다. 생략하고 기준이 지정되지 않으면 기본값은 '외부'입니다." + } + }, + "taskAlreadyRunningInTerminal": "터미널에서 작업이 이미 실행 중입니다.", + "taskExitedWithCode": "작업 '{0}' 이 코드 {1} 로 종료되었습니다 .", + "taskTerminalTitle": "작업: {0}", + "taskTerminatedBySignal": "작업 '{0}' 이 신호 {1} 에 의해 종료되었습니다.", + "terminalWillBeReusedByTasks": "터미널은 작업에서 재사용됩니다." + }, + "terminal": { + "defaultProfile": "다음에서 사용되는 기본 프로필 {0}", + "enableCopy": "ctrl-c(macOS의 경우 cmd-c)를 활성화하여 선택한 텍스트를 복사합니다.", + "enablePaste": "클립보드에서 붙여넣기하려면 ctrl-v(macOS의 경우 cmd-v)를 사용하도록 설정합니다.", + "profileArgs": "이 프로필이 사용하는 셸 인수입니다.", + "profileColor": "단말기와 연결할 단말기 테마 색상 ID입니다.", + "profileDefault": "기본 프로필...을 선택합니다.", + "profileIcon": "터미널 아이콘과 연결할 코디콘 ID입니다.\nterminal-tmux:\"$(terminal-tmux)\"", + "profileNew": "새 터미널(프로필 포함)...", + "profilePath": "이 프로필이 사용하는 셸의 경로입니다.", + "profiles": "새 터미널을 만들 때 표시할 프로필입니다. 선택적 인수를 사용하여 경로 속성을 수동으로 설정합니다.\n기존 프로필을 `null`로 설정하면 목록에서 프로필을 숨길 수 있습니다(예: `\"{0}\": null`).", + "rendererType": "터미널 렌더링 방식을 제어합니다.", + "rendererTypeDeprecationMessage": "렌더러 유형은 더 이상 옵션으로 지원되지 않습니다.", + "selectProfile": "새 터미널의 프로필을 선택합니다.", + "shell.deprecated": "이 방법은 더 이상 사용되지 않으며, 기본 셸을 구성하는 새로운 권장 방법은 'terminal.integrated.profiles.{0}' 에서 터미널 프로필을 생성하고 'terminal.integrated.defaultProfile.{0}' 에서 프로필 이름을 기본값으로 설정하는 것입니다.", + "shellArgsLinux": "Linux 터미널에서 사용할 명령줄 인수입니다.", + "shellArgsOsx": "macOS 터미널에서 사용할 명령줄 인수입니다.", + "shellArgsWindows": "Windows 터미널에서 사용할 명령줄 인수입니다.", + "shellLinux": "터미널이 Linux에서 사용하는 셸 경로입니다(기본값: '{0}'}).", + "shellOsx": "터미널이 macOS에서 사용하는 셸의 경로(기본값: '{0}'})입니다.", + "shellWindows": "터미널이 Windows에서 사용하는 셸의 경로입니다. (기본값: '{0}')." + }, + "terminal-manager": { + "addTerminalToGroup": "터미널을 그룹에 추가", + "closeDialog": { + "message": "터미널 관리자를 닫으면 해당 레이아웃을 복원할 수 없습니다. 터미널 관리자를 닫으시겠습니까?", + "title": "터미널 관리자를 닫으시겠습니까?" + }, + "closeTerminalManager": "터미널 관리자 닫기", + "createNewTerminalGroup": "새 터미널 그룹 만들기", + "createNewTerminalPage": "새 터미널 페이지 생성", + "deleteGroup": "그룹 삭제", + "deletePage": "페이지 삭제", + "deleteTerminal": "터미널 삭제", + "group": "그룹", + "label": "터미널", + "maximizeBottomPanel": "하단 패널 최대화", + "minimizeBottomPanel": "하단 패널 최소화", + "openTerminalManager": "터미널 관리자 열기", + "page": "페이지", + "rename": "이름 변경", + "resetTerminalManagerLayout": "터미널 관리자 레이아웃 재설정", + "toggleTreeView": "트리 보기 전환" + }, + "test": { + "cancelAllTestRuns": "모든 테스트 실행 취소", + "stackFrameAt": "에서", + "testRunDefaultName": "{0} 실행 {1}", + "testRuns": "테스트 실행" + }, + "toolbar": { + "addCommand": "도구 모음에 명령 추가", + "addCommandPlaceholder": "도구 모음에 추가할 명령 찾기", + "centerColumn": "중앙 열", + "failedUpdate": "'{1}'의 '{0}' 값을 업데이트하지 못했습니다.", + "filterIcons": "필터 아이콘", + "iconSelectDialog": "'{0}' 아이콘을 선택합니다.", + "iconSet": "아이콘 세트", + "insertGroupLeft": "그룹 구분 기호 삽입(왼쪽)", + "insertGroupRight": "그룹 구분 기호 삽입(오른쪽)", + "leftColumn": "왼쪽 열", + "openJSON": "툴바 사용자 지정(JSON 열기)", + "removeCommand": "도구 모음에서 명령 제거", + "restoreDefaults": "도구 모음 기본값 복원", + "rightColumn": "오른쪽 열", + "selectIcon": "아이콘 선택", + "toggleToolbar": "툴바 토글", + "toolbarLocationPlaceholder": "명령어를 어디에 추가하고 싶으신가요?", + "useDefaultIcon": "기본 아이콘 사용" + }, + "typehierarchy": { + "subtypeHierarchy": "하위 유형 계층 구조", + "supertypeHierarchy": "슈퍼타입 계층 구조" + }, + "variableResolver": { + "listAllVariables": "변수: 모두 나열" + }, + "vsx-registry": { + "confirmDialogMessage": "확장자 \"{0}\"는 확인되지 않았으며 보안 위험을 초래할 수 있습니다.", + "confirmDialogTitle": "설치를 계속 진행하시겠습니까?", + "downloadCount": "다운로드 횟수: {0}", + "errorFetching": "확장 프로그램 가져오기 오류가 발생했습니다.", + "errorFetchingConfigurationHint": "이는 네트워크 구성 문제로 인해 발생할 수 있습니다.", + "failedInstallingVSIX": "VSIX에서 {0} 설치에 실패했습니다.", + "invalidVSIX": "선택한 파일이 유효한 \"*.vsix\" 플러그인이 아닙니다.", + "license": "라이선스: {0}", + "onlyShowVerifiedExtensionsDescription": "이렇게 하면 {0} 에 확인된 확장자만 표시할 수 있습니다.", + "onlyShowVerifiedExtensionsTitle": "인증된 확장 프로그램만 표시", + "recommendedExtensions": "이 리포지토리에 권장되는 확장 프로그램을 설치하시겠습니까?", + "searchPlaceholder": "에서 확장 프로그램 검색 {0}", + "showInstalled": "설치된 확장 프로그램 표시", + "showRecommendedExtensions": "확장 프로그램 권장 사항에 대한 알림 표시 여부를 제어합니다.", + "vsx-extensions-contribution": { + "update-version-uninstall-error": "확장 프로그램을 제거하는 동안 오류가 발생했습니다: {0}.", + "update-version-version-error": "{1} 의 버전 {0} 을 설치하지 못했습니다." + } + }, + "webview": { + "goToReadme": "README로 이동", + "messageWarning": " {0} 엔드포인트의 호스트 패턴이 `{1}`로 변경되었으며, 패턴을 변경하면 보안 취약점이 발생할 수 있습니다. 자세한 내용은 `{2}`를 참조하세요." + }, + "workspace": { + "bothAreDirectories": "두 리소스 모두 디렉터리입니다.", + "clickToManageTrust": "신뢰 설정을 관리하려면 클릭하세요.", + "compareWithEachOther": "서로 비교하기", + "confirmDeletePermanently.description": "휴지통을 사용하여 \"{0}\"를 삭제하지 못했습니다. 대신 영구 삭제를 하시겠습니까?", + "confirmDeletePermanently.solution": "환경설정에서 휴지통 사용을 비활성화할 수 있습니다.", + "confirmDeletePermanently.title": "파일 삭제 중 오류 발생", + "confirmMessage.delete": "다음 파일을 정말 삭제하시겠습니까?", + "confirmMessage.dirtyMultiple": "저장되지 않은 변경 사항이 있는 {0} 파일을 정말 삭제하시겠습니까?", + "confirmMessage.dirtySingle": "저장되지 않은 변경 사항이 있는 {0} 을 정말 삭제하시겠습니까?", + "confirmMessage.uriMultiple": "선택한 {0} 파일을 모두 삭제하시겠습니까?", + "confirmMessage.uriSingle": "{0} 을 삭제하시겠습니까?", + "directoriesCannotBeCompared": "디렉터리는 비교할 수 없습니다. {0}", + "duplicate": "중복", + "failSaveAs": "현재 위젯에 대해 \"{0}\"를 실행할 수 없습니다.", + "isDirectory": "{0}''는 디렉터리입니다.", + "manageTrustPlaceholder": "이 작업 공간에 대한 신뢰 상태 선택", + "newFilePlaceholder": "파일 이름", + "newFolderPlaceholder": "폴더 이름", + "noErasure": "참고: 디스크에서 아무것도 지워지지 않습니다.", + "notWorkspaceFile": "유효하지 않은 작업 공간 파일: {0}", + "openRecentPlaceholder": "열려는 워크스페이스의 이름을 입력합니다.", + "openRecentWorkspace": "최근 작업 공간 열기...", + "preserveWindow": "현재 창에서 작업 공간 열기를 활성화합니다.", + "removeFolder": "작업 공간에서 다음 폴더를 제거하시겠습니까?", + "removeFolders": "작업 공간에서 다음 폴더를 제거하시겠습니까?", + "restrictedModeDescription": "이 작업 공간이 신뢰되지 않기 때문에 일부 기능이 비활성화되었습니다.", + "restrictedModeNote": "*참고: Theia에서 작업 공간 신뢰 기능은 현재 개발 중이며, 모든 기능이 작업 공간 신뢰와 통합되지는 않았습니다.*", + "schema": { + "folders": { + "description": "작업 공간의 루트 폴더" + }, + "title": "작업 공간 파일" + }, + "trashTitle": "{0} 을 휴지통으로 이동", + "trustEmptyWindow": "빈 작업 공간을 기본적으로 신뢰할지 여부를 제어합니다.", + "trustEnabled": "워크스페이스 신뢰의 사용 여부를 제어합니다. 비활성화하면 모든 워크스페이스가 신뢰됩니다.", + "trustTrustedFolders": "확인 없이 신뢰되는 폴더 URI 목록.", + "untitled-cleanup": "제목이 없는 작업 공간 파일이 많이 있는 것 같습니다. {0} 을 확인하여 사용하지 않는 파일을 제거하세요.", + "variables": { + "cwd": { + "description": "작업 실행기의 시작 시점 현재 작업 디렉터리" + }, + "file": { + "description": "현재 열려 있는 파일의 경로" + }, + "fileBasename": { + "description": "현재 열려 있는 파일의 기본 이름" + }, + "fileBasenameNoExtension": { + "description": "확장자를 제외한 현재 열려 있는 파일의 이름" + }, + "fileDirname": { + "description": "현재 열려 있는 파일의 디렉터리 이름" + }, + "fileExtname": { + "description": "현재 열려 있는 파일의 확장자" + }, + "relativeFile": { + "description": "현재 열려 있는 파일의 작업 공간 루트에 대한 상대 경로" + }, + "relativeFileDirname": { + "description": "현재 열려 있는 파일의 디렉터리 이름(${workspaceFolder} 상대 경로)" + }, + "workspaceFolder": { + "description": "작업 공간 루트 폴더의 경로" + }, + "workspaceFolderBasename": { + "description": "작업 공간 루트 폴더의 이름" + }, + "workspaceRoot": { + "description": "작업 공간 루트 폴더의 경로" + }, + "workspaceRootFolderName": { + "description": "작업 공간 루트 폴더의 이름" + } + }, + "workspaceFolderAdded": "여러 루트가 있는 워크스페이스가 만들어졌습니다. 워크스페이스 구성을 파일로 저장하시겠습니까?", + "workspaceFolderAddedTitle": "워크스페이스에 폴더 추가" + } + }, + "vsx.disabling": "비활성화", + "vsx.disabling.extensions": "비활성화하기 {0}...", + "vsx.enabling": "활성화", + "vsx.enabling.extension": "활성화 {0}..." +} diff --git a/packages/core/i18n/nls.pl.json b/packages/core/i18n/nls.pl.json new file mode 100644 index 0000000..ff44ece --- /dev/null +++ b/packages/core/i18n/nls.pl.json @@ -0,0 +1,2097 @@ +{ + "ai-chat-ui.show-settings": "Pokaż ustawienia AI", + "ai-chat:summarize-session-as-task-for-coder": "Podsumowanie sesji jako zadanie dla kodera", + "ai.executePlanWithCoder": "Wykonaj bieżący plan za pomocą kodera", + "ai.updateTaskContext": "Aktualizacja bieżącego kontekstu zadania", + "aiConfiguration:open": "Otwórz widok konfiguracji AI", + "aiHistory:clear": "Historia AI: Wyczyść historię", + "aiHistory:open": "Otwórz widok historii AI", + "aiHistory:sortChronologically": "Historia AI: Sortuj chronologicznie", + "aiHistory:sortReverseChronologically": "Historia AI: Sortuj chronologicznie", + "aiHistory:toggleCompact": "Historia AI: Przełącz widok kompaktowy", + "aiHistory:toggleHideNewlines": "Historia AI: Przestań interpretować nowe linie", + "aiHistory:toggleRaw": "Historia AI: Przełącz widok surowy", + "aiHistory:toggleRenderNewlines": "Historia AI: Interpretacja nowych linii", + "debug.breakpoint.editCondition": "Warunek edycji...", + "debug.breakpoint.removeSelected": "Usuń wybrane punkty przerwania", + "debug.breakpoint.toggleEnabled": "Włącz/wyłącz punkty przerwania", + "notebook.cell.changeToCode": "Zmień komórkę na kod", + "notebook.cell.changeToMarkdown": "Zmień komórkę na Mardown", + "notebook.cell.insertMarkdownCellAbove": "Wstaw komórkę Markdown powyżej", + "notebook.cell.insertMarkdownCellBelow": "Wstaw komórkę Markdown poniżej", + "terminal:new:profile": "Tworzenie nowego zintegrowanego terminalu z profilu", + "terminal:profile:default": "Wybierz domyślny profil terminala", + "theia": { + "ai": { + "agents": { + "completionNotification": { + "mdDescription": "Zachowanie powiadomienia, gdy agent zakończy zadanie. Jeśli nie zostanie ustawione, użyte zostanie globalne domyślne ustawienie powiadomień.\n - `os-notification`: Pokaż powiadomienia OS/systemowe\n - `message`: Pokaż powiadomienia na pasku stanu/obszarze wiadomości\n - `blink`: Miga lub podświetla interfejs użytkownika\n - `off`: Wyłącz powiadomienia dla tego agenta", + "title": "Powiadomienie o zakończeniu" + }, + "enable": { + "mdDescription": "Określa, czy agent powinien być włączony (true) czy wyłączony (false).", + "title": "Włącz agenta" + }, + "languageModelRequirements": { + "identifier": { + "mdDescription": "Identyfikator używanego modelu językowego." + }, + "mdDescription": "Określa modele językowe używane przez tego agenta.", + "purpose": { + "mdDescription": "Cel, dla którego ten model językowy jest używany.", + "title": "Cel" + }, + "title": "Wymagania dotyczące modelu językowego" + }, + "mdDescription": "Konfigurowanie ustawień agentów, takich jak włączanie lub wyłączanie określonych agentów, konfigurowanie monitów i wybieranie modułów LLM.", + "selectedVariants": { + "mdDescription": "Określa aktualnie wybrane warianty podpowiedzi dla tego agenta.", + "title": "Wybrane warianty" + }, + "title": "Ustawienia agenta" + }, + "anthropic": { + "apiKey": { + "description": "Wprowadź klucz API swojego oficjalnego konta Anthropic. **Uwaga:** Używając tej preferencji, klucz API Anthropic będzie przechowywany w postaci czystego tekstu na komputerze z uruchomioną Theią. Użyj zmiennej środowiskowej `ANTHROPIC_API_KEY`, aby bezpiecznie ustawić klucz." + }, + "models": { + "description": "Oficjalne modele antropiczne do użycia" + } + }, + "chat": { + "agent": { + "architect": "Architekt", + "coder": "programista", + "universal": "Uniwersalny" + }, + "applySuggestion": "Zastosuj sugestię", + "bypassModelRequirement": { + "description": "Pomiń sprawdzanie wymagań modelu językowego. Włącz tę opcję, jeśli korzystasz z zewnętrznych agentów (np. Claude Code), które nie wymagają modeli językowych Theia." + }, + "changeSetDefaultTitle": "Sugerowane zmiany", + "changeSetFileDiffUriLabel": "Zmiany AI: {0}", + "chatAgentsVariable": { + "description": "Zwraca listę agentów czatu dostępnych w systemie." + }, + "chatSessionNamingAgent": { + "description": "Agent do generowania nazw sesji czatu", + "vars": { + "conversation": { + "description": "Treść rozmowy na czacie." + }, + "listOfSessionNames": { + "description": "Lista istniejących nazw sesji." + } + } + }, + "chatSessionSummaryAgent": { + "description": "Agent do generowania podsumowań sesji czatu." + }, + "confirmApplySuggestion": "Plik {0} zmienił się od czasu utworzenia tej sugestii. Czy na pewno chcesz zastosować tę zmianę?", + "confirmRevertSuggestion": "Plik {0} zmienił się od czasu utworzenia tej sugestii. Czy na pewno chcesz przywrócić tę zmianę?", + "couldNotFindMatchingLM": "Nie można znaleźć pasującego modelu językowego. Sprawdź swoją konfigurację!", + "couldNotFindReadyLMforAgent": "Nie można znaleźć gotowego modelu językowego dla agenta {0}. Sprawdź swoją konfigurację!", + "defaultAgent": { + "description": "Opcjonalnie: agenta czatu, który zostanie wywołany, jeśli żaden agent nie został wyraźnie wymieniony z @ w zapytaniu użytkownika. Jeśli nie skonfigurowano domyślnego agenta, zostaną zastosowane domyślne ustawienia Theia." + }, + "imageContextVariable": { + "args": { + "data": { + "description": "Dane obrazu w formacie base64." + }, + "mimeType": { + "description": "Mimetype obrazu." + }, + "name": { + "description": "Nazwa pliku obrazu, jeśli jest dostępna." + }, + "wsRelativePath": { + "description": "Ścieżka do pliku obrazu w odniesieniu do obszaru roboczego, jeśli jest dostępna." + } + }, + "description": "Zapewnia informacje kontekstowe dla obrazu", + "label": "Plik obrazu" + }, + "orchestrator": { + "description": "Agent ten analizuje żądanie użytkownika w odniesieniu do opisu wszystkich dostępnych agentów czatu i wybiera najlepiej dopasowanego agenta, który odpowie na żądanie (przy użyciu sztucznej inteligencji). Żądanie użytkownika zostanie bezpośrednio przekazane wybranemu agentowi bez dalszego potwierdzenia.", + "vars": { + "availableChatAgents": { + "description": "Lista agentów czatu, których orkiestrator może delegować, z wyłączeniem agentów określonych w preferencji listy wykluczeń." + } + } + }, + "pinChatAgent": { + "description": "Włącz przypinanie agentów, aby automatycznie utrzymywać wspomnianego agenta czatu aktywnego w monitach, zmniejszając potrzebę powtarzania wzmianek. Możesz ręcznie odpiąć lub zmienić agentów w dowolnym momencie." + }, + "revertSuggestion": "Sugestia cofnięcia", + "selectImageFile": "Wybierz plik obrazu", + "sessionStorage": { + "description": "Skonfiguruj miejsce przechowywania sesji czatu.", + "globalPath": "Globalna ścieżka", + "pathNotUsedForScope": "Nie stosować w zakresie pamięci masowej typu „{0}”.", + "pathRequired": "Ścieżka nie może być pusta", + "pathSettings": "Ustawienia ścieżki", + "resetToDefault": "Przywróć ustawienia domyślne", + "scope": { + "global": "Przechowuj sesje czatu w globalnym folderze konfiguracyjnym.", + "workspace": "Zapisuj sesje czatu w folderze obszaru roboczego." + }, + "workspacePath": "Ścieżka obszaru roboczego" + }, + "taskContextService": { + "summarizeProgressMessage": "Podsumuj: {0}", + "updatingProgressMessage": "Aktualizacja: {0}" + }, + "toolConfirmation": { + "confirm": { + "description": "Poproś o potwierdzenie przed uruchomieniem narzędzi" + }, + "disabled": { + "description": "Wyłączenie wykonywania narzędzia" + }, + "yolo": { + "description": "Automatyczne wykonywanie narzędzi bez potwierdzenia" + } + }, + "view": { + "label": "AI Chat" + } + }, + "chat-ui": { + "addContextVariable": "Dodaj zmienną kontekstową", + "agent": "Agent", + "aiDisabled": "Funkcje AI są wyłączone", + "applyAll": "Zastosuj wszystko", + "applyAllTitle": "Zastosuj wszystkie oczekujące zmiany", + "askQuestion": "Zadaj pytanie", + "attachToContext": "Dołączanie elementów do kontekstu", + "cancel": "Anuluj (Esc)", + "chat-view-tree-widget": { + "ai": "AI", + "aiFeatureHeader": "Dostępne funkcje AI (wersja alfa)!", + "featuresDisabled": "Obecnie wszystkie funkcje AI są wyłączone!", + "generating": "Generowanie", + "howToEnable": "Jak włączyć funkcje sztucznej inteligencji:", + "noRenderer": "Błąd: Nie znaleziono renderera", + "scrollToBottom": "Przejdź do najnowszej wiadomości", + "waitingForInput": "Oczekiwanie na dane wejściowe", + "you": "Ty" + }, + "chatInput": { + "clearHistory": "Wyczyść historię monitów", + "cycleMode": "Tryb czatu cyklicznego", + "nextPrompt": "Następna zachęta", + "previousPrompt": "Poprzednia zachęta" + }, + "chatInputAriaLabel": "Wpisz tutaj swoją wiadomość", + "chatResponses": "Odpowiedzi na czacie", + "code-part-renderer": { + "generatedCode": "Wygenerowany kod" + }, + "collapseChangeSet": "Zwiń zestaw zmian", + "command-part-renderer": { + "commandNotExecutable": "Polecenie ma identyfikator \"{0}\", ale nie można go wykonać z okna czatu." + }, + "copyCodeBlock": "Kopiuj blok kodu", + "couldNotSendRequestToSession": "Nie udało się wysłać żądania \"{0}\" do sesji {1}", + "delegation-response-renderer": { + "prompt": { + "label": "Przekazany monit:" + }, + "response": { + "label": "Odpowiedź:" + }, + "starting": "Delegacja rozpoczynająca...", + "status": { + "canceled": "odwołany", + "error": "błąd", + "generating": "generowanie...", + "starting": "rozpoczęcie..." + } + }, + "deleteChangeSet": "Usuń zestaw zmian", + "editRequest": "Edytuj", + "edited": "edytowane", + "editedTooltipHint": "Ten wariant podpowiedzi został edytowany. Możesz go zresetować w widoku Konfiguracja AI.", + "enterChatName": "Wprowadź nazwę czatu", + "errorChatInvocation": "Wystąpił błąd podczas wywoływania usługi czatu.", + "expandChangeSet": "Rozwiń zestaw zmian", + "failedToDeleteSession": "Nie udało się usunąć sesji czatu", + "failedToLoadChats": "Nie udało się załadować sesji czatu", + "failedToRestoreSession": "Nie udało się przywrócić sesji czatu", + "failedToRetry": "Komunikat o nieudanej próbie ponowienia", + "focusInput": "Skup się na czacie", + "focusResponse": "Odpowiedź na czacie Focus", + "noChatAgentsAvailable": "Brak dostępnych agentów czatu.", + "openDiff": "Open Diff", + "openOriginalFile": "Otwórz oryginalny plik", + "performThisTask": "Wykonaj to zadanie.", + "persistedSession": "Trwała sesja (kliknij, aby przywrócić)", + "removeChat": "Usuń czat", + "renameChat": "Zmiana nazwy czatu", + "requestNotFoundForRetry": "Nie znaleziono żądania do ponowienia", + "responseFrom": "Odpowiedź od {0}", + "selectAgentQuickPickPlaceholder": "Wybór agenta dla nowej sesji", + "selectChat": "Wybierz czat", + "selectContextVariableQuickPickPlaceholder": "Wybierz zmienną kontekstową, która ma zostać dołączona do wiadomości", + "selectTaskContextQuickPickItem": { + "currentlyOpen": "obecnie otwarty" + }, + "selectTaskContextQuickPickPlaceholder": "Wybierz kontekst zadania do dołączenia", + "selectVariableArguments": "Wybór zmiennych argumentów", + "send": "Wyślij (Enter)", + "sessionNotFoundForRetry": "Nie znaleziono sesji do ponownej próby", + "text-part-renderer": { + "cantDisplay": "Nie można wyświetlić odpowiedzi, sprawdź ChatResponsePartRenderers!" + }, + "thinking-part-renderer": { + "thinking": "Myślenie" + }, + "toolcall-part-renderer": { + "denied": "Odmowa wykonania", + "finished": "Ran", + "rejected": "Wykonanie anulowane" + }, + "toolconfirmation": { + "allow-options-dropdown-tooltip": "Więcej dozwolonych opcji", + "allow-session": "Pozwól na ten czat", + "allowed": "Dozwolone wykonanie narzędzia", + "alwaysAllowConfirm": "Rozumiem, włącz automatyczne zatwierdzanie", + "alwaysAllowTitle": "Włączyć automatyczne zatwierdzanie dla „{0}”?", + "canceled": "Wykonanie narzędzia anulowane", + "denied": "Odmowa wykonania narzędzia", + "deny-forever": "Zawsze zaprzeczaj", + "deny-options-dropdown-tooltip": "Więcej opcji odmowy", + "deny-reason-placeholder": "Wprowadź powód odmowy...", + "deny-session": "Odmowa dla tego czatu", + "deny-with-reason": "Odmów z uzasadnieniem...", + "executionDenied": "Odmowa wykonania narzędzia", + "header": "Potwierdź wykonanie narzędzia" + }, + "unableToSummarizeCurrentSession": "Nie można podsumować bieżącej sesji. Upewnij się, że agent podsumowujący nie jest wyłączony.", + "unknown-part-renderer": { + "contentNotRestoreable": "Ta zawartość (typ '{0}') nie mogła zostać w pełni przywrócona. Może pochodzić z rozszerzenia, które nie jest już dostępne." + }, + "unpinAgent": "Unpin Agent", + "variantTooltip": "Wariant podpowiedzi: {0}", + "yourMessage": "Twoja wiadomość" + }, + "claude-code": { + "agentDescription": "Agent kodujący Anthropic", + "askBeforeEdit": "Zapytaj przed edycją", + "changeSetTitle": "Zmiany według kodu Claude", + "clearCommand": { + "description": "Utwórz nową sesję" + }, + "compactCommand": { + "description": "Kompaktowa rozmowa z opcjonalnymi instrukcjami ustawiania ostrości" + }, + "completedCount": "{0}/{1} zakończone", + "configCommand": { + "description": "Konfiguracja kodu Open Claude" + }, + "currentDirectory": "bieżący katalog", + "differentAgentRequestWarning": "Poprzednie żądanie czatu zostało obsłużone przez innego agenta. Claude Code nie widzi tych innych wiadomości.", + "directory": "Katalog", + "domain": "Domena", + "editAutomatically": "Edytuj automatycznie", + "editNumber": "Edytuj {0}", + "editing": "Edycja", + "editsCount": "{0} zmiany", + "emptyTodoList": "Nie wszystkie dostępne", + "entireFile": "Cały plik", + "excludingOnePattern": " (z wyłączeniem 1 wzoru)", + "excludingPatterns": " (z wyłączeniem wzorów {0} )", + "executedCommand": "Wykonano: {0}", + "failedToParseBashToolData": "Nie udało się przeanalizować danych narzędzia Bash", + "failedToParseEditToolData": "Nie udało się przeanalizować danych narzędzia edycji", + "failedToParseGlobToolData": "Nie udało się przeanalizować danych narzędzia Glob", + "failedToParseGrepToolData": "Nie udało się przeanalizować danych narzędzia Grep", + "failedToParseLSToolData": "Nie udało się przeanalizować danych narzędzia LS", + "failedToParseMultiEditToolData": "Nie udało się przeanalizować danych narzędzia MultiEdit", + "failedToParseReadToolData": "Nie udało się przeanalizować danych narzędzia Read", + "failedToParseTodoListData": "Nie udało się przeanalizować danych listy zadań do wykonania", + "failedToParseWebFetchToolData": "Nie udało się przeanalizować danych narzędzia WebFetch", + "failedToParseWriteToolData": "Nie udało się przeanalizować danych narzędzia zapisu", + "fetching": "Pobieranie", + "fileFilter": "Filtr plików", + "filePath": "Ścieżka pliku", + "fileType": "Typ pliku", + "findMatchingFiles": "Znajduje pliki pasujące do wzorca globalnego \"{0}\" w bieżącym katalogu", + "findMatchingFilesWithPath": "Znajduje pliki pasujące do wzorca globalnego \"{0}\" w obrębie {1}", + "finding": "Znajdowanie", + "from": "Od", + "globPattern": "wzór globalny", + "grepOptions": { + "caseInsensitive": "wielkość liter nie ma znaczenia", + "glob": "glob: {0}", + "headLimit": "limit: {0}", + "lineNumbers": "numery linii", + "linesAfter": "+{0} po", + "linesBefore": "+{0} przed", + "linesContext": "±{0} kontekst", + "multiLine": "wielowierszowy", + "type": "typ: {0}" + }, + "grepOutputModes": { + "content": "zawartość", + "count": "liczyć", + "filesWithMatches": "pliki z dopasowaniami" + }, + "ignoredPatterns": "Ignorowane wzorce", + "ignoringPatterns": "Ignorowanie wzorców {0} ", + "initCommand": { + "description": "Inicjalizacja projektu za pomocą przewodnika CLAUDE.md" + }, + "itemCount": "{0} pozycje", + "lineLimit": "Limit linii", + "lines": "Linie", + "listDirectoryContents": "Lista zawartości katalogu", + "listing": "Notowania", + "memoryCommand": { + "description": "Edytuj plik pamięci CLAUDE.md" + }, + "multiEditing": "Edycja wielokrotna", + "oneEdit": "1 edycja", + "oneItem": "1 szt.", + "oneOption": "1 opcja", + "openDirectoryTooltip": "Kliknij, aby otworzyć katalog", + "openFileTooltip": "Kliknij, aby otworzyć plik w edytorze", + "optionsCount": "{0} opcje", + "partial": "Częściowy", + "pattern": "Wzór", + "plan": "Tryb planowania", + "project": "projekt", + "projectRoot": "korzeń projektu", + "readMode": "Tryb odczytu", + "reading": "Czytanie", + "replaceAllCount": "{0} replace-all", + "replaceAllOccurrences": "Zastąp wszystkie wystąpienia", + "resumeCommand": { + "description": "Wznawianie sesji" + }, + "reviewCommand": { + "description": "Żądanie przeglądu kodu" + }, + "searchPath": "Ścieżka wyszukiwania", + "searching": "Wyszukiwanie", + "startingLine": "Linia startowa", + "timeout": "Limit czasu", + "timeoutInMs": "Limit czasu: {0}ms", + "to": "Do", + "todoList": "Lista zadań", + "todoPriority": { + "high": "wysoki", + "low": "niski", + "medium": "średni" + }, + "toolApprovalRequest": "Claude Code chce użyć narzędzia \"{0}\". Czy chcesz na to zezwolić?", + "totalEdits": "Łączna liczba edycji", + "webFetch": "Web Fetch", + "writing": "Pisanie" + }, + "code-completion": { + "progressText": "Obliczanie ukończenia kodu AI..." + }, + "codex": { + "agentDescription": "Asystent programowania OpenAI oparty na technologii Codex", + "completedCount": "{0}/{1} zakończone", + "exitCode": "Kod wyjścia: {0}", + "fileChangeFailed": "Codex nie zastosował zmian dla: {0}", + "fileChangeFailedGeneric": "Codex nie zastosował zmian w pliku.", + "itemCount": "{0} elementy", + "noItems": "Brak pozycji", + "oneItem": "1 pozycja", + "running": "Bieg...", + "searched": "Wyszukiwane", + "searching": "Wyszukiwanie", + "todoList": "Lista zadań", + "webSearch": "Wyszukiwanie w Internecie" + }, + "completion": { + "agent": { + "description": "Ten agent zapewnia uzupełnianie kodu w edytorze kodu w Theia IDE.", + "vars": { + "file": { + "description": "Identyfikator URI edytowanego pliku" + }, + "language": { + "description": "LanguageId edytowanego pliku" + }, + "prefix": { + "description": "Kod przed bieżącą pozycją kursora" + }, + "suffix": { + "description": "Kod za bieżącą pozycją kursora" + } + } + }, + "automaticEnable": { + "description": "Automatycznie uruchamiaj uzupełnienia AI inline w dowolnym edytorze (Monaco) podczas edycji. \n Alternatywnie można ręcznie wyzwolić kod za pomocą polecenia \"Trigger Inline Suggestion\" lub domyślnego skrótu \"Ctrl+Alt+Spacja\"." + }, + "cacheCapacity": { + "description": "Maksymalna liczba zakończeń kodu do zapisania w pamięci podręcznej. Wyższa liczba może poprawić wydajność, ale zużyje więcej pamięci. Minimalna wartość to 10, zalecany zakres to 50-200.", + "title": "Pojemność pamięci podręcznej uzupełniania kodu" + }, + "debounceDelay": { + "description": "Kontroluje opóźnienie w milisekundach przed uruchomieniem uzupełniania AI po wykryciu zmian w edytorze. Wymaga włączenia opcji `Automatic Code Completion`. Wprowadź 0, aby wyłączyć opóźnienie debounce.", + "title": "Opóźnienie odbicia" + }, + "excludedFileExts": { + "description": "Określ rozszerzenia plików (np. .md, .txt), w których uzupełnianie AI powinno być wyłączone.", + "title": "Wykluczone rozszerzenia plików" + }, + "fileVariable": { + "description": "Identyfikator URI edytowanego pliku. Dostępne tylko w kontekście uzupełniania kodu." + }, + "languageVariable": { + "description": "LanguageId edytowanego pliku. Dostępne tylko w kontekście uzupełniania kodu." + }, + "maxContextLines": { + "description": "Maksymalna liczba linii używanych jako kontekst, rozdzielona pomiędzy linie przed i za pozycją kursora (prefiks i sufiks). Ustaw wartość -1, aby użyć całego pliku jako kontekstu bez limitu linii i 0, aby użyć tylko bieżącej linii.", + "title": "Maksymalne linie kontekstowe" + }, + "prefixVariable": { + "description": "Kod przed bieżącą pozycją kursora. Dostępne tylko w kontekście uzupełniania kodu." + }, + "stripBackticks": { + "description": "Usuwa otaczające backticki z kodu zwracanego przez niektóre LLM. Jeśli wykryty zostanie backtick, cała zawartość po zamykającym backticku jest również usuwana. To ustawienie pomaga zapewnić, że zwracany jest zwykły kod, gdy modele językowe używają formatowania podobnego do markdown.", + "title": "Usuwanie znaczników Backtick z uzupełnień Inline" + }, + "suffixVariable": { + "description": "Kod za bieżącą pozycją kursora. Dostępne tylko w kontekście uzupełniania kodu." + } + }, + "configuration": { + "selectItem": "Proszę wybrać pozycję." + }, + "copilot": { + "auth": { + "aiConfiguration": "Konfiguracja AI", + "authorize": "Upoważniłem", + "copied": "Skopiowano!", + "copyCode": "Skopiuj kod", + "expired": "Autoryzacja wygasła lub została odrzucona. Spróbuj ponownie.", + "hint": "Po wprowadzeniu kodu i autoryzacji kliknij „Autoryzowałem” poniżej.", + "initiating": "Rozpoczęcie uwierzytelniania...", + "instructions": "Aby upoważnić Theia do korzystania z GitHub Copilot, odwiedź poniższy adres URL i wprowadź kod:", + "openGitHub": "Otwórz GitHub", + "success": "Pomyślnie zalogowano się do GitHub Copilot!", + "successHint": "Jeśli Twoje konto GitHub ma dostęp do Copilot, możesz teraz skonfigurować modele językowe Copilot w ", + "title": "Zaloguj się do GitHub Copilot", + "tos": "Logując się, wyrażasz zgodę na ", + "tosLink": "Warunki korzystania z serwisu GitHub", + "verifying": "Weryfikacja autoryzacji..." + }, + "category": "Copilot", + "commands": { + "signIn": "Zaloguj się do GitHub Copilot", + "signOut": "Wyloguj się z GitHub Copilot" + }, + "enterpriseUrl": { + "mdDescription": "Domena GitHub Enterprise dla Copilot API (np. `github.mycompany.com`). Pozostaw puste dla GitHub.com." + }, + "models": { + "description": "Modele GitHub Copilot do wykorzystania. Dostępne modele zależą od posiadanej subskrypcji Copilot." + }, + "statusBar": { + "signedIn": "Zalogowano się do GitHub Copilot jako {0}. Kliknij, aby się wylogować.", + "signedOut": "Nie jesteś zalogowany do GitHub Copilot. Kliknij, aby się zalogować." + } + }, + "core": { + "agentConfiguration": { + "actions": "Działania", + "addCustomAgent": "Dodaj agenta niestandardowego", + "enableAgent": "Włącz agenta", + "label": "Agenci", + "llmRequirements": "Wymagania dotyczące tytułu LLM", + "notUsedInPrompt": "Nieużywane w podpowiedzi", + "promptTemplates": "Szablony zachęty", + "selectAgentMessage": "Najpierw wybierz agenta!", + "templateName": "Szablon", + "undeclared": "Niezarejestrowany", + "usedAgentSpecificVariables": "Zastosowane zmienne specyficzne dla agenta", + "usedFunctions": "Używane funkcje", + "usedGlobalVariables": "Używane zmienne globalne", + "variant": "Wariant" + }, + "agentsVariable": { + "description": "Zwraca listę agentów dostępnych w systemie." + }, + "aiConfiguration": { + "label": "Konfiguracja AI [Alpha]" + }, + "blinkTitle": { + "agentCompleted": "Theia - Agent ukończony", + "namedAgentCompleted": "Theia - Agent \"{0}\" Ukończono" + }, + "changeSetSummaryVariable": { + "description": "Zapewnia podsumowanie plików w zestawie zmian i ich zawartości." + }, + "contextDetailsVariable": { + "description": "Zapewnia pełne wartości tekstowe i opisy dla wszystkich elementów kontekstu." + }, + "contextSummaryVariable": { + "description": "Opisuje pliki w kontekście danej sesji." + }, + "customAgentTemplate": { + "description": "To jest przykładowy agent. Prosimy o dostosowanie właściwości do własnych potrzeb." + }, + "defaultModelAliases": { + "code": { + "description": "Zoptymalizowany pod kątem zadań związanych ze zrozumieniem i generowaniem kodu." + }, + "code-completion": { + "description": "Najlepiej nadaje się do scenariuszy autouzupełniania kodu." + }, + "summarize": { + "description": "Modele traktowane priorytetowo w celu podsumowania i kondensacji treści." + }, + "universal": { + "description": "Dobrze wyważony zarówno do kodu, jak i ogólnego użytku językowego." + } + }, + "defaultNotification": { + "mdDescription": "Domyślna metoda powiadamiania używana po zakończeniu zadania przez agenta AI. Poszczególni agenci mogą zastąpić to ustawienie.\n - `os-notification`: Pokaż powiadomienia OS/systemowe\n - `message`: Pokaż powiadomienia na pasku stanu/obszarze wiadomości\n - `blink`: Miga lub podświetla interfejs użytkownika\n - `off`: Wyłącz wszystkie powiadomienia", + "title": "Domyślny typ powiadomienia" + }, + "discard": { + "label": "Szablon zachęty odrzucenia AI" + }, + "discardCustomPrompt": { + "tooltip": "Odrzuć dostosowania" + }, + "fileVariable": { + "description": "Rozwiązuje zawartość pliku", + "uri": { + "description": "Identyfikator URI żądanego pliku." + } + }, + "languageModelRenderer": { + "alias": "[alias] {0}", + "languageModel": "Model językowy", + "purpose": "Cel" + }, + "maxRetries": { + "mdDescription": "Maksymalna liczba prób ponowienia w przypadku niepowodzenia żądania do dostawcy AI. Wartość 0 oznacza brak ponownych prób.", + "title": "Maksymalna liczba ponownych prób" + }, + "modelAliasesConfiguration": { + "agents": "Agenci używający tego aliasu", + "defaultList": "[Lista domyślna]", + "evaluatesTo": "Ocenia na", + "label": "Aliasy modeli", + "modelNotReadyTooltip": "Nie gotowy", + "modelReadyTooltip": "Gotowy", + "noAgents": "Żaden agent nie używa tego aliasu.", + "noModelReadyTooltip": "Brak gotowego modelu", + "noResolvedModel": "Brak gotowego modelu dla tego aliasu.", + "priorityList": "Lista priorytetów", + "selectAlias": "Wybierz alias modelu.", + "selectedModelId": "Wybrany model", + "unavailableModel": "Wybrany model nie jest już dostępny" + }, + "noVariableFoundForOpenRequest": "Nie znaleziono zmiennej dla otwartego żądania.", + "openEditorsShortVariable": { + "description": "Krótkie odniesienie do wszystkich aktualnie otwartych plików (ścieżki względne, oddzielone przecinkami)" + }, + "openEditorsVariable": { + "description": "Rozdzielona przecinkami lista wszystkich aktualnie otwartych plików względem katalogu głównego obszaru roboczego." + }, + "preference": { + "languageModelAliases": { + "description": "Skonfiguruj modele dla każdego aliasu modelu językowego w [AI Configuration View] ({0}). Alternatywnie można skonfigurować ustawienia ręcznie w pliku settings.json: \n```\n\"default/code\": {\n \"selectedModel\": \"anthropic/claude-opus-4-20250514\"\n}\n```", + "selectedModel": "Model wybrany przez użytkownika dla tego aliasu.", + "title": "Aliasy modeli językowych" + } + }, + "prefs": { + "title": "Funkcje AI [Alpha]" + }, + "promptFragmentsConfiguration": { + "activeCustomizationTitle": "Aktywne dostosowywanie", + "createCustomizationTitle": "Tworzenie personalizacji", + "customization": "personalizacja", + "customizationLabel": "Personalizacja", + "defaultVariantTitle": "Wariant domyślny", + "deleteCustomizationTitle": "Usuń personalizację", + "editTemplateTitle": "Edytuj szablon", + "headerTitle": "Fragmenty zachęty", + "label": "Fragmenty zachęty", + "noFragmentsAvailable": "Brak dostępnych fragmentów podpowiedzi.", + "otherPromptFragmentsHeader": "Inne fragmenty zachęty", + "promptTemplateText": "Tekst szablonu zachęty", + "promptVariantsHeader": "Zestawy wariantów obietnic", + "removeCustomizationDialogMsg": "Czy na pewno chcesz usunąć dostosowanie {0} dla fragmentu monitu \"{1}\"?", + "removeCustomizationDialogTitle": "Usuń personalizację", + "removeCustomizationWithDescDialogMsg": "Czy na pewno chcesz usunąć dostosowanie {0} dla fragmentu monitu \"{1}\" ({2})?", + "resetAllButton": "Resetuj wszystko", + "resetAllCustomizationsDialogMsg": "Czy na pewno chcesz zresetować wszystkie fragmenty podpowiedzi do ich wbudowanych wersji? Spowoduje to usunięcie wszystkich dostosowań.", + "resetAllCustomizationsDialogTitle": "Resetowanie wszystkich ustawień", + "resetAllCustomizationsTitle": "Resetowanie wszystkich ustawień", + "resetAllPromptFragments": "Zresetuj wszystkie fragmenty monitu", + "resetToBuiltInDialogMsg": "Czy na pewno chcesz zresetować fragment monitu \"{0}\" do jego wbudowanej wersji? Spowoduje to usunięcie wszystkich dostosowań.", + "resetToBuiltInDialogTitle": "Reset do wbudowanego", + "resetToBuiltInTitle": "Reset do tego wbudowanego", + "resetToCustomizationDialogMsg": "Czy na pewno chcesz zresetować fragment monitu \"{0}\", aby użyć dostosowania {1}? Spowoduje to usunięcie wszystkich dostosowań o wyższym priorytecie.", + "resetToCustomizationDialogTitle": "Reset do ustawień własnych", + "resetToCustomizationTitle": "Reset do tego dostosowania", + "selectedVariantLabel": "Wybrane", + "selectedVariantTitle": "Wybrany wariant", + "usedByAgentTitle": "Używany przez agenta: {0}", + "variantSetError": "Wybrany wariant nie istnieje i nie można znaleźć domyślnego. Sprawdź swoją konfigurację.", + "variantSetWarning": "Wybrany wariant nie istnieje. Zamiast tego używany jest wariant domyślny.", + "variantsOfSystemPrompt": "Warianty tego zestawu podpowiedzi:" + }, + "promptTemplates": { + "description": "Folder do przechowywania niestandardowych szablonów monitów. Jeśli nie został dostosowany, używany jest katalog konfiguracji użytkownika. Należy rozważyć użycie folderu, który jest pod kontrolą wersji do zarządzania wariantami szablonów podpowiedzi.", + "openLabel": "Wybierz folder" + }, + "promptVariable": { + "argDescription": "Identyfikator szablonu monitu do rozwiązania", + "completions": { + "detail": { + "builtin": "Wbudowany fragment monitu", + "custom": "Niestandardowy fragment monitu" + } + }, + "description": "Rozwiązuje szablony monitów za pośrednictwem usługi monitów" + }, + "prompts": { + "category": "Szablony zachęty Theia AI" + }, + "requestSettings": { + "clientSettings": { + "description": "Ustawienia klienta dotyczące sposobu obsługi wiadomości wysyłanych z powrotem do llm.", + "keepThinking": { + "description": "Jeśli ustawiona na wartość false, wszystkie dane wyjściowe myślenia zostaną przefiltrowane przed wysłaniem następnego żądania użytkownika w konwersacji wieloobrotowej." + }, + "keepToolCalls": { + "description": "Jeśli ustawiona na wartość false, wszystkie żądania narzędzi i odpowiedzi narzędzi będą filtrowane przed wysłaniem następnego żądania użytkownika w konwersacji wieloobrotowej." + } + }, + "mdDescription": "Umożliwia określenie niestandardowych ustawień żądań dla wielu modeli.\n Każdy obiekt reprezentuje konfigurację dla konkretnego modelu. Pole `modelId` określa ID modelu, `requestSettings` definiuje ustawienia specyficzne dla modelu.\n Pole `providerId` jest opcjonalne i pozwala na zastosowanie ustawień do konkretnego dostawcy. Jeśli nie zostanie ustawione, ustawienia zostaną zastosowane do wszystkich dostawców.\n Przykładowe providerIds: huggingface, openai, ollama, llamafile.\n Więcej informacji można znaleźć w [naszej dokumentacji](https://theia-ide.org/docs/user_ai/#custom-request-settings).", + "modelSpecificSettings": { + "description": "Ustawienia dla określonego identyfikatora modelu." + }, + "scope": { + "agentId": { + "description": "(Opcjonalny) identyfikator agenta, do którego mają zostać zastosowane ustawienia." + }, + "modelId": { + "description": "(Opcjonalny) identyfikator modelu" + }, + "providerId": { + "description": "(Opcjonalny) identyfikator dostawcy, do którego mają zostać zastosowane ustawienia." + } + }, + "title": "Niestandardowe ustawienia żądań" + }, + "skillsVariable": { + "description": "Zwraca listę dostępnych umiejętności, które mogą być wykorzystywane przez agentów AI." + }, + "taskContextSummary": { + "description": "Rozwiązuje wszystkie elementy kontekstu zadań obecne w kontekście sesji." + }, + "templateSettings": { + "edited": "edytowane", + "unavailableVariant": "Wybrany wariant nie jest już dostępny" + }, + "todayVariable": { + "description": "Robi coś na dziś", + "format": { + "description": "Format daty" + } + }, + "unableToDisplayVariableValue": "Nie można wyświetlić wartości zmiennej.", + "unableToResolveVariable": "Nie można rozwiązać zmiennej.", + "variable-contribution": { + "builtInVariable": "Wbudowana zmienna Theia", + "currentAbsoluteFilePath": "Ścieżka bezwzględna aktualnie otwartego pliku. Należy pamiętać, że większość agentów będzie oczekiwać względnej ścieżki pliku (względem bieżącego obszaru roboczego).", + "currentFileContent": "Zwykła zawartość aktualnie otwartego pliku. Wyklucza to informacje o tym, skąd pochodzi zawartość. Należy pamiętać, że większość agentów będzie działać lepiej z relatywną ścieżką pliku (względem bieżącego obszaru roboczego).", + "currentRelativeDirPath": "Względna ścieżka do katalogu zawierającego aktualnie otwarty plik.", + "currentRelativeFilePath": "Ścieżka względna aktualnie otwartego pliku.", + "currentSelectedText": "Zwykły tekst, który jest aktualnie zaznaczony w otwartym pliku. Wyklucza to informacje o tym, skąd pochodzi zawartość. Należy pamiętać, że większość agentów będzie działać lepiej z relatywną ścieżką pliku (względem bieżącego obszaru roboczego).", + "dotRelativePath": "Krótkie odwołanie do względnej ścieżki aktualnie otwartego pliku (\"currentRelativeFilePath\")." + } + }, + "editor": { + "editorContextVariable": { + "description": "Rozwiązuje informacje kontekstowe specyficzne dla edytora", + "label": "EditorContext" + }, + "explainWithAI": { + "prompt": "Wyjaśnij ten błąd", + "title": "Wyjaśnianie za pomocą sztucznej inteligencji" + }, + "fixWithAI": { + "prompt": "Pomoc w naprawieniu tego błędu" + } + }, + "google": { + "apiKey": { + "description": "Wprowadź klucz API swojego oficjalnego konta Google AI (Gemini). **Uwaga:** Korzystając z tej preferencji, klucz API GOOGLE AI będzie przechowywany w postaci zwykłego tekstu na komputerze z uruchomioną aplikacją Theia. Użyj zmiennej środowiskowej `GOOGLE_API_KEY`, aby bezpiecznie ustawić klucz." + }, + "maxRetriesOnErrors": { + "description": "Maksymalna liczba ponownych prób w przypadku błędów. Jeśli mniejsza niż 1, logika ponawiania jest wyłączona" + }, + "models": { + "description": "Oficjalne modele Google Gemini do użycia" + }, + "retryDelayOnOtherErrors": { + "description": "Opóźnienie w sekundach między ponownymi próbami w przypadku innych błędów (czasami Google GenAI zgłasza błędy, takie jak niekompletna składnia JSON zwrócona z modelu lub 500 Internal Server Error). Ustawienie tej wartości na -1 zapobiega ponawianiu prób w takich przypadkach. W przeciwnym razie ponowienie próby nastąpi natychmiast (jeśli ustawione na 0) lub po tym opóźnieniu w sekundach (jeśli ustawione na liczbę dodatnią)." + }, + "retryDelayOnRateLimitError": { + "description": "Opóźnienie w sekundach między ponownymi próbami w przypadku błędów limitu szybkości. Patrz https://ai.google.dev/gemini-api/docs/rate-limits" + } + }, + "history": { + "clear": { + "tooltip": "Wyczyść historię wszystkich agentów" + }, + "exchange-card": { + "agentId": "Agent", + "timestamp": "Rozpoczęty" + }, + "open-history-tooltip": "Otwarta historia AI...", + "request-card": { + "agent": "Agent", + "model": "Model", + "request": "Żądanie", + "response": "Odpowiedź", + "timestamp": "Znacznik czasu", + "title": "Żądanie" + }, + "sortChronologically": { + "tooltip": "Sortuj chronologicznie" + }, + "sortReverseChronologically": { + "tooltip": "Sortuj odwrotnie chronologicznie" + }, + "toggleCompact": { + "tooltip": "Pokaż widok kompaktowy" + }, + "toggleHideNewlines": { + "tooltip": "Przestań interpretować nowe linie" + }, + "toggleRaw": { + "tooltip": "Pokaż widok nieprzetworzony" + }, + "toggleRenderNewlines": { + "tooltip": "Interpretacja znaków nowej linii" + }, + "view": { + "label": "✨ Historia agenta AI [Alpha]", + "noAgent": "Agent nie jest dostępny.", + "noAgentSelected": "Nie wybrano żadnego agenta.", + "noHistoryForAgent": "Brak historii dla wybranego agenta '{0}'" + } + }, + "huggingFace": { + "apiKey": { + "mdDescription": "Wprowadź klucz API dla swojego konta Hugging Face. **Uwaga:** Korzystając z tej preferencji, klucz API Hugging Face będzie przechowywany w postaci zwykłego tekstu na komputerze z uruchomioną aplikacją Theia. Użyj zmiennej środowiskowej `HUGGINGFACE_API_KEY`, aby bezpiecznie ustawić klucz." + }, + "models": { + "mdDescription": "Modele Hugging Face do wykorzystania. **Uwaga:** Obecnie obsługiwane są wyłącznie modele obsługujące interfejs API uzupełniania czatu (modele dostosowane do instrukcji, takie jak `*-Instruct`). Niektóre modele mogą wymagać zaakceptowania warunków licencji na stronie internetowej Hugging Face." + } + }, + "ide": { + "agent-description": "Skonfiguruj ustawienia agenta AI, w tym włączenie, wybór LLM, dostosowanie szablonu monitu i tworzenie agenta niestandardowego w [widoku konfiguracji AI] ({0}).", + "agentConfiguration": { + "customAgentLocationQuickPick": { + "createNewFile": "Utwórz nowy plik", + "openExistingFile": "Otwórz istniejący plik", + "placeholder": "Wybierz miejsce utworzenia lub otwarcia pliku agentów niestandardowych", + "title": "Wybierz lokalizację dla pliku agentów niestandardowych" + }, + "noDescription": "Brak opisu" + }, + "app-tester": { + "errorCheckingDevToolsServerStatus": "Błąd podczas sprawdzania statusu serwera DevTools MCP: {0}", + "errorCheckingPlaywrightServerStatus": "Błąd sprawdzania stanu serwera Playwright MCP: {0}", + "startChromeDevToolsMcpServers": { + "canceled": "Proszę skonfigurować serwer Chrome DevTools MCP.", + "error": "Nie udało się uruchomić serwera Chrome DevTools MCP: {0}", + "progress": "Uruchamianie serwera Chrome DevTools MCP.", + "question": "Serwer Chrome DevTools MCP nie działa. Czy chcesz go teraz uruchomić? Może to spowodować zainstalowanie serwera Chrome DevTools MCP." + }, + "startMcpServers": { + "no": "Nie, anuluj", + "yes": "Tak, uruchom serwery." + }, + "startPlaywrightServers": { + "canceled": "Skonfiguruj serwery MCP.", + "error": "Nie udało się uruchomić serwera Playwright MCP: {0}", + "progress": "Uruchamianie serwerów Playwright MCP.", + "question": "Serwery Playwright MCP nie są uruchomione. Czy chcesz je teraz uruchomić? Może to spowodować zainstalowanie serwerów Playwright MCP." + } + }, + "architectAgent": { + "mode": { + "default": "Tryb domyślny", + "plan": "Tryb planu", + "simple": "Tryb prosty" + }, + "suggestion": { + "executePlanWithCoder": "Uruchom „{0}” za pomocą Coder", + "summarizeSessionAsTaskForCoder": "Podsumuj tę sesję jako zadanie dla kodera", + "updateTaskContext": "Aktualizacja bieżącego kontekstu zadania" + } + }, + "bypassHint": "Niektórzy agenci, tacy jak Claude Code, nie wymagają modeli językowych Theia.", + "chatDisabledMessage": { + "featuresTitle": "Obecnie obsługiwane widoki i funkcje:" + }, + "coderAgent": { + "mode": { + "agentNext": "Tryb agenta (Dalej)", + "edit": "Tryb edycji" + }, + "suggestion": { + "fixProblems": { + "content": "[Napraw problemy]({0}) w bieżącym pliku.", + "prompt": "Prosimy o sprawdzenie strony {1} i naprawienie wszelkich problemów." + }, + "startNewChat": "Czaty powinny być krótkie i skoncentrowane. [Rozpocznij nowy czat]({0}) dla nowego zadania lub [rozpocznij nowy czat z podsumowaniem tego]({1})." + } + }, + "commandAgent": { + "commandCallback": { + "confirmAction": "Rozumiem", + "label": "Polecenie AI" + }, + "response": { + "customHandler": "Spróbuj wykonać to polecenie:", + "noCommand": "Niestety nie mogę znaleźć takiego polecenia", + "theiaCommand": "Znalazłem to polecenie, które może ci pomóc:" + }, + "vars": { + "commandIds": { + "description": "Lista dostępnych poleceń w Theia." + } + } + }, + "configureAgent": { + "header": "Skonfiguruj domyślnego agenta" + }, + "continueAnyway": "Kontynuuj mimo wszystko", + "createSkillAgent": { + "mode": { + "edit": "Tryb domyślny" + } + }, + "enableAI": { + "mdDescription": "To ustawienie umożliwia dostęp do najnowszych możliwości AI (wersja Beta). \n Należy pamiętać, że funkcje te znajdują się w fazie beta, co oznacza, że mogą podlegać zmianom i będą dalej ulepszane. Ważne jest, aby mieć świadomość, że funkcje te mogą generować ciągłe żądania do modeli językowych (LLM), do których zapewniasz dostęp. Może to wiązać się z kosztami, które należy ściśle monitorować. Włączenie tej opcji oznacza akceptację tego ryzyka. \n **Uwaga! Poniższe ustawienia w tej sekcji zaczną obowiązywać dopiero po\n dopiero po włączeniu głównego ustawienia funkcji. Po włączeniu funkcji należy skonfigurować co najmniej jednego dostawcę LLM poniżej. Zapoznaj się również z [dokumentacją](https://theia-ide.org/docs/user_ai/)**." + }, + "github": { + "configureGitHubServer": { + "canceled": "Konfiguracja serwera GitHub została anulowana. Skonfiguruj serwer MCP GitHub do korzystania z tego agenta.", + "no": "Nie, anuluj", + "yes": "Tak, skonfiguruj serwer GitHub" + }, + "errorCheckingGitHubServerStatus": "Błąd sprawdzania stanu serwera GitHub MCP: {0}", + "startGitHubServer": { + "canceled": "Aby korzystać z tego agenta, należy uruchomić serwer GitHub MCP.", + "error": "Nie udało się uruchomić serwera GitHub MCP: {0}", + "no": "Nie, anuluj", + "progress": "Uruchomienie serwera GitHub MCP.", + "question": "Serwer GitHub MCP jest skonfigurowany, ale nie jest uruchomiony. Czy chcesz go teraz uruchomić?", + "yes": "Tak, uruchom serwer" + } + }, + "githubRepoName": { + "description": "Nazwa bieżącego repozytorium GitHub (np. \"eclipse-theia/theia\")." + }, + "model-selection-description": "Wybierz, które duże modele językowe (LLM) są używane przez każdego agenta AI w [widoku konfiguracji AI]({0}).", + "moreAgentsAvailable": { + "header": "Dostępnych jest więcej agentów" + }, + "noRecommendedAgents": "Nie ma dostępnych zalecanych środków.", + "openSettings": "Otwórz ustawienia AI", + "or": "lub", + "orchestrator": { + "error": { + "noAgents": "Brak dostępnego agenta czatu do obsługi żądania. Sprawdź konfigurację, czy są one włączone." + }, + "progressMessage": "Określenie najbardziej odpowiedniego agenta", + "response": { + "delegatingToAgent": "Delegowanie do `@{0}`" + } + }, + "prompt-template-description": "Wybierz warianty podpowiedzi i dostosuj szablony podpowiedzi dla agentów AI w [Widoku konfiguracji AI]({0}).", + "recommendedAgents": "Zalecane środki:", + "skillsConfiguration": { + "label": "Umiejętności", + "location": { + "label": "Lokalizacja" + } + }, + "toolsConfiguration": { + "confirmAlwaysAllow": { + "confirm": "Rozumiem, włącz automatyczne zatwierdzanie", + "title": "Włączyć automatyczne zatwierdzanie dla „{0}”?" + }, + "confirmationMode": { + "label": "Tryb potwierdzenia" + }, + "default": { + "label": "Domyślny tryb potwierdzenia narzędzia:" + }, + "resetAll": "Resetuj wszystko", + "resetAllConfirmDialog": { + "msg": "Czy na pewno chcesz zresetować wszystkie tryby potwierdzenia narzędzia do domyślnych? Spowoduje to usunięcie wszystkich niestandardowych ustawień.", + "title": "Resetowanie wszystkich trybów potwierdzenia narzędzia" + }, + "resetAllTooltip": "Przywróć domyślne ustawienia wszystkich narzędzi", + "toolOptions": { + "confirm": { + "label": "Potwierdzenie" + } + } + }, + "variableConfiguration": { + "selectVariable": "Wybierz zmienną.", + "usedByAgents": "Używane przez agentów", + "variableArgs": "Zmienne argumenty" + } + }, + "llamaFile": { + "prefs": { + "mdDescription": "To ustawienie umożliwia konfigurację i zarządzanie modelami LlamaFile w Theia IDE. \n Każdy wpis wymaga przyjaznej dla użytkownika `nazwy`, pliku `uri` wskazującego na LlamaFile oraz `portu`, na którym będzie uruchamiany. \n Aby uruchomić LlamaFile, należy użyć polecenia \"Start LlamaFile\", które umożliwia wybranie żądanego modelu. \n Jeśli edytujesz wpis (np. zmienisz port), każda uruchomiona instancja zostanie zatrzymana i będziesz musiał ręcznie uruchomić ją ponownie. \n [Więcej informacji na temat konfigurowania i zarządzania LlamaFiles można znaleźć w dokumentacji Theia IDE](https://theia-ide.org/docs/user_ai/#llamafile-models).", + "name": { + "description": "Nazwa modelu używana dla tego pliku Llamafile." + }, + "port": { + "description": "Port używany do uruchamiania serwera." + }, + "title": "AI LlamaFile", + "uri": { + "description": "Uri pliku do pliku Llamafile." + } + }, + "start": "Uruchom Llamafile", + "stop": "Stop Llamafile" + }, + "llamafile": { + "error": { + "noConfigured": "Nie skonfigurowano plików Llamafiles.", + "noRunning": "Brak uruchomionych plików Llamafiles.", + "startFailed": "Coś poszło nie tak podczas uruchamiania llamafile: {0}.\nWięcej informacji można znaleźć w konsoli.", + "stopFailed": "Coś poszło nie tak podczas zatrzymywania llamafile: {0}.\nWięcej informacji można znaleźć w konsoli." + } + }, + "mcp": { + "error": { + "allServersRunning": "Wszystkie serwery MCP są już uruchomione.", + "noRunningServers": "Brak uruchomionych serwerów MCP.", + "noServersConfigured": "Brak skonfigurowanych serwerów MCP.", + "startFailed": "Wystąpił błąd podczas uruchamiania serwera MCP." + }, + "info": { + "serverStarted": "Serwer MCP \"{0}\" został pomyślnie uruchomiony. Zarejestrowane narzędzia: {1}" + }, + "servers": { + "args": { + "mdDescription": "Tablica argumentów przekazywanych do polecenia.", + "title": "Argumenty dla polecenia" + }, + "autostart": { + "mdDescription": "Automatycznie uruchamia ten serwer po uruchomieniu frontendu. Nowo dodane serwery nie są uruchamiane automatycznie od razu, ale po ponownym uruchomieniu.", + "title": "Autostart" + }, + "command": { + "mdDescription": "Polecenie użyte do uruchomienia serwera MCP, np. \"uvx\" lub \"npx\".", + "title": "Polecenie wykonania serwera MCP" + }, + "env": { + "mdDescription": "Opcjonalne zmienne środowiskowe do ustawienia dla serwera, takie jak klucz API.", + "title": "Zmienne środowiskowe" + }, + "headers": { + "mdDescription": "Opcjonalne dodatkowe nagłówki dołączane do każdego żądania do serwera.", + "title": "Nagłówki" + }, + "mdDescription": "Konfiguruje serwery MCP za pomocą poleceń, argumentów, opcjonalnie zmiennych środowiskowych i autostartu (domyślnie prawda). Każdy serwer jest identyfikowany przez unikalny klucz, taki jak \"brave-search\" lub \"filesystem\". Aby uruchomić serwer, należy użyć polecenia \"MCP: Start MCP Server\", które umożliwia wybranie żądanego serwera. Aby zatrzymać serwer, użyj polecenia \"MCP: Stop MCP Server\". Należy pamiętać, że autostart zacznie działać dopiero po ponownym uruchomieniu, więc po raz pierwszy należy uruchomić serwer ręcznie.\nPrzykładowa konfiguracja:\n```{\n \"brave-search\": {\n \"command\": \"npx\",\n \"args\": [\n \"-y\",\n \"@modelcontextprotocol/server-brave-search\"\n ],\n \"env\": {\n \"BRAVE_API_KEY\": \"YOUR_API_KEY\"\n },\n },\n \"filesystem\": {\n \"command\": \"npx\",\n \"args\": [\"-y\", \"@modelcontextprotocol/server-filesystem\", \"/Users/YOUR_USERNAME/Desktop\"],\n \"env\": {\n \"CUSTOM_ENV_VAR\": \"custom-value\"\n },\n \"autostart\": false\n }\n}\n```", + "serverAuthToken": { + "mdDescription": "Token uwierzytelniania dla serwera, jeśli jest wymagany. Jest on używany do uwierzytelniania na serwerze zdalnym.", + "title": "Token uwierzytelniający" + }, + "serverAuthTokenHeader": { + "mdDescription": "Nazwa nagłówka używana dla tokena uwierzytelniania serwera. Jeśli nie zostanie podana, zostanie użyta \"Authorization\" z \"Bearer\".", + "title": "Nazwa nagłówka uwierzytelniania" + }, + "serverUrl": { + "mdDescription": "Adres URL zdalnego serwera MCP. Jeśli zostanie podany, serwer połączy się z tym adresem URL zamiast uruchamiać proces lokalny.", + "title": "Adres URL serwera" + }, + "title": "Konfiguracja serwerów MCP" + }, + "start": { + "label": "MCP: Uruchom serwer MCP" + }, + "stop": { + "label": "MCP: Zatrzymanie serwera MCP" + } + }, + "mcpConfiguration": { + "arguments": "Argumenty: ", + "autostart": "Autostart: ", + "connectServer": "Connnect", + "connectingServer": "Łączenie...", + "copiedAllList": "Skopiowano wszystkie narzędzia do schowka (lista wszystkich narzędzi)", + "copiedAllSingle": "Skopiowano wszystkie narzędzia do schowka (pojedynczy fragment monitu ze wszystkimi narzędziami)", + "copiedForPromptTemplate": "Skopiowano wszystkie narzędzia do schowka dla szablonu monitu (pojedynczy fragment monitu ze wszystkimi narzędziami).", + "copyAllList": "Kopiuj wszystko (lista wszystkich narzędzi)", + "copyAllSingle": "Kopiuj wszystko dla czatu (pojedynczy fragment monitu ze wszystkimi narzędziami)", + "copyForPrompt": "Narzędzie kopiowania (dla czatu lub szablonu monitu)", + "copyForPromptTemplate": "Kopiuj wszystko dla szablonu monitu (pojedynczy fragment monitu ze wszystkimi narzędziami)", + "environmentVariables": "Zmienne środowiskowe: ", + "headers": "Nagłówki: ", + "noServers": "Brak skonfigurowanych serwerów MCP", + "serverAuthToken": "Token uwierzytelniający: ", + "serverAuthTokenHeader": "Nazwa nagłówka uwierzytelniania: ", + "serverUrl": "Adres URL serwera: ", + "tools": "Narzędzia: " + }, + "openai": { + "apiKey": { + "mdDescription": "Wprowadź klucz API swojego oficjalnego konta OpenAI. **Uwaga:** Korzystając z tej preferencji, klucz API Open AI będzie przechowywany w postaci zwykłego tekstu na komputerze z uruchomioną aplikacją Theia. Użyj zmiennej środowiskowej `OPENAI_API_KEY`, aby bezpiecznie ustawić klucz." + }, + "customEndpoints": { + "apiKey": { + "title": "Albo klucz dostępu do API obsługiwanego pod podanym adresem url, albo `true`, aby użyć globalnego klucza API OpenAI." + }, + "apiVersion": { + "title": "Wersja umożliwiająca dostęp do interfejsu API obsługiwanego pod podanym adresem URL w Azure lub `true`, aby użyć globalnej wersji interfejsu API OpenAI." + }, + "deployment": { + "title": "Nazwa wdrożenia umożliwiająca dostęp do interfejsu API obsługiwanego pod podanym adresem URL na platformie Azure." + }, + "developerMessageSettings": { + "title": "Kontroluje obsługę wiadomości systemowych: `user`, `system` i `developer` będą używane jako rola, `mergeWithFollowingUserMessage` będzie poprzedzać następującą wiadomość użytkownika wiadomością systemową lub konwertować wiadomość systemową na wiadomość użytkownika, jeśli następna wiadomość nie jest wiadomością użytkownika. `skip` po prostu usunie wiadomość systemową), domyślnie `developer`." + }, + "enableStreaming": { + "title": "Wskazuje, czy ma być używany interfejs API przesyłania strumieniowego. Domyślnie `true`." + }, + "id": { + "title": "Unikalny identyfikator używany w interfejsie użytkownika do identyfikacji modelu niestandardowego." + }, + "mdDescription": "Zintegruj niestandardowe modele kompatybilne z API OpenAI, na przykład poprzez `vllm`. Wymagane atrybuty to `model` i `url`. \n Opcjonalnie można \n - określić unikalny `id`, aby zidentyfikować niestandardowy model w interfejsie użytkownika. Jeśli żaden nie zostanie podany, `model` zostanie użyty jako `id`. \n - Podaj `apiKey`, aby uzyskać dostęp do API obsługiwanego pod podanym adresem url. Użyj `true`, aby wskazać użycie globalnego klucza API OpenAI. \n - provide an `apiVersion` aby uzyskać dostęp do API obsługiwanego pod danym adresem url w Azure. Użyj `true`, aby wskazać użycie globalnej wersji API OpenAI. \n - ustaw `developerMessageSettings` na jeden z `user`, `system`, `developer`, `mergeWithFollowingUserMessage` lub `skip`, aby kontrolować sposób dołączania wiadomości deweloperskiej (gdzie `user`, `system` i `developer` będą używane jako rola, `mergeWithFollowingUserMessage` będzie poprzedzać następującą wiadomość użytkownika wiadomością systemową lub konwertować wiadomość systemową na wiadomość użytkownika, jeśli następna wiadomość nie jest wiadomością użytkownika. `skip` po prostu usunie wiadomość systemową). Domyślnie `developer`. \n - określa `supportsStructuredOutput: false` by wskazać, że ustrukturyzowane wyjście nie będzie używane. \n - specify `enableStreaming: false` by wskazać, że streaming nie będzie używany. \n Więcej informacji można znaleźć w [naszej dokumentacji](https://theia-ide.org/docs/user_ai/#openai-compatible-models-eg-via-vllm).", + "modelId": { + "title": "Identyfikator modelu" + }, + "supportsStructuredOutput": { + "title": "Wskazuje, czy model obsługuje ustrukturyzowane dane wyjściowe. Domyślnie `true`." + }, + "url": { + "title": "Punkt końcowy zgodny z Open AI API, w którym hostowany jest model" + } + }, + "models": { + "description": "Oficjalne modele OpenAI do użycia" + }, + "useResponseApi": { + "mdDescription": "Użyj nowszego interfejsu API odpowiedzi OpenAI zamiast interfejsu API zakończenia czatu dla oficjalnych modeli OpenAI. To ustawienie dotyczy tylko oficjalnych modeli OpenAI - niestandardowi dostawcy muszą skonfigurować to indywidualnie." + } + }, + "promptTemplates": { + "directories": { + "title": "Katalogi szablonów obietnic specyficzne dla przestrzeni roboczej" + }, + "extensions": { + "description": "Lista dodatkowych rozszerzeń plików w lokalizacjach prompt, które są uważane za szablony prompt. \".prompttemplate\" jest zawsze traktowane jako domyślne.", + "title": "Dodatkowe rozszerzenia plików szablonów obietnic" + }, + "files": { + "title": "Pliki szablonów obietnic specyficzne dla obszaru roboczego" + } + }, + "scanoss": { + "changeSet": { + "clean": "Brak dopasowań", + "error": "Błąd: Ponowne uruchomienie", + "error-notification": "Napotkano błąd ScanOSS: {0}.", + "match": "Wyświetl mecze", + "scan": "Skanowanie", + "scanning": "Skanowanie..." + }, + "mode": { + "automatic": { + "description": "Włącz automatyczne skanowanie fragmentów kodu w widokach czatu." + }, + "description": "Skonfiguruj funkcję SCANOSS do analizowania fragmentów kodu w widokach czatu. Spowoduje to wysłanie skrótu sugerowanych fragmentów kodu do usługi SCANOSS\nhostowanej przez [Software Transparency foundation](https://www.softwaretransparency.org/osskb) w celu analizy.", + "manual": { + "description": "Użytkownik może ręcznie uruchomić skanowanie, klikając pozycję SCANOSS w widoku czatu." + }, + "off": { + "description": "Funkcja jest całkowicie wyłączona." + } + }, + "snippet": { + "dialog-header": "Wyniki ScanOSS", + "errored": "SCANOSS - Błąd - {0}", + "file-name-heading": "Dopasowanie znalezione w {0}", + "in-progress": "SCANOSS - Wykonywanie skanowania...", + "match-count": "Znaleziono dopasowanie(a) {0} ", + "matched": "SCANOSS - Znaleziono {0} mecz", + "no-match": "SCANOSS - Brak dopasowania", + "summary": "Podsumowanie" + } + }, + "session-settings-dialog": { + "title": "Ustawienia sesji", + "tooltip": "Ustawienia sesji" + }, + "terminal": { + "agent": { + "description": "Agent ten zapewnia pomoc w pisaniu i wykonywaniu dowolnych poleceń terminala. Na podstawie żądania użytkownika sugeruje polecenia i umożliwia użytkownikowi bezpośrednie wklejenie i wykonanie ich w terminalu. Uzyskuje dostęp do bieżącego katalogu, środowiska i ostatnich danych wyjściowych sesji terminala, aby zapewnić pomoc kontekstową", + "vars": { + "cwd": { + "description": "Bieżący katalog roboczy." + }, + "recentTerminalContents": { + "description": "Od 0 do 50 ostatnich linii widocznych w terminalu." + }, + "shell": { + "description": "Używana powłoka, np. /usr/bin/zsh." + }, + "userRequest": { + "description": "Pytanie lub prośba użytkownika." + } + } + }, + "askAi": "Zapytaj AI", + "askTerminalCommand": "Zapytaj o polecenie terminala...", + "hitEnterConfirm": "Naciśnij enter, aby potwierdzić", + "howCanIHelp": "Jak mogę ci pomóc?", + "loading": "Ładowanie", + "tryAgain": "Spróbuj jeszcze raz...", + "useArrowsAlternatives": " lub użyj ⇅, aby wyświetlić alternatywy..." + }, + "tokenUsage": { + "cachedInputTokens": "Tokeny wejściowe zapisane w pamięci podręcznej", + "cachedInputTokensTooltip": "Śledzone dodatkowo do \"Tokenów wejściowych\". Zwykle droższe niż tokeny niebuforowane.", + "failedToGetTokenUsageData": "Nie udało się pobrać danych użycia tokenu: {0}", + "inputTokens": "Tokeny wejściowe", + "label": "Użycie tokena", + "lastUsed": "Ostatnio używany", + "model": "Model", + "noData": "Nie są jeszcze dostępne dane dotyczące wykorzystania tokenów.", + "note": "Użycie tokena jest śledzone od momentu uruchomienia aplikacji i nie jest przechowywane.", + "outputTokens": "Tokeny wyjściowe", + "readCachedInputTokens": "Tokeny wejściowe odczytane z pamięci podręcznej", + "readCachedInputTokensTooltip": "Śledzone dodatkowo do \"Input Token\". Zwykle znacznie tańsze niż brak buforowania. Zwykle nie wlicza się do limitów szybkości.", + "total": "Łącznie", + "totalTokens": "Całkowita liczba tokenów", + "totalTokensTooltip": "'Tokeny wejściowe' + 'Tokeny wyjściowe'" + }, + "vercelai": { + "anthropicApiKey": { + "mdDescription": "Wprowadź klucz API dla modeli Anthropic. **Uwaga:** Używając tej preferencji, klucz API będzie przechowywany w postaci czystego tekstu na komputerze z uruchomioną aplikacją Theia. Użyj zmiennej środowiskowej `ANTHROPIC_API_KEY`, aby bezpiecznie ustawić klucz." + }, + "customEndpoints": { + "apiKey": { + "title": "Albo klucz dostępu do API obsługiwanego pod podanym adresem url, albo `true`, aby użyć globalnego klucza API." + }, + "enableStreaming": { + "title": "Wskazuje, czy ma być używany interfejs API przesyłania strumieniowego. Domyślnie `true`." + }, + "id": { + "title": "Unikalny identyfikator używany w interfejsie użytkownika do identyfikacji modelu niestandardowego." + }, + "mdDescription": "Zintegruj niestandardowe modele kompatybilne z Vercel AI SDK. Wymagane atrybuty to `model` i `url`. \n Opcjonalnie można \n - określić unikalny `id` do identyfikacji modelu niestandardowego w interfejsie użytkownika. Jeśli żaden nie zostanie podany, `model` zostanie użyty jako `id`. \n - Podaj `apiKey`, aby uzyskać dostęp do API obsługiwanego pod podanym adresem url. Użyj `true`, aby wskazać użycie globalnego klucza API. \n - Określ `supportsStructuredOutput: false`, aby wskazać, że ustrukturyzowane dane wyjściowe nie będą używane. \n - specify `enableStreaming: false` aby wskazać, że streaming nie będzie używany. \n - specify `provider` aby wskazać od którego dostawcy pochodzi model (openai, anthropic).", + "modelId": { + "title": "Identyfikator modelu" + }, + "supportsStructuredOutput": { + "title": "Wskazuje, czy model obsługuje ustrukturyzowane dane wyjściowe. Domyślnie `true`." + }, + "url": { + "title": "Punkt końcowy API, w którym hostowany jest model" + } + }, + "models": { + "description": "Oficjalne modele do użytku z Vercel AI SDK", + "id": { + "title": "Identyfikator modelu" + }, + "model": { + "title": "Nazwa modelu" + } + }, + "openaiApiKey": { + "mdDescription": "Wprowadź klucz API dla modeli OpenAI. **Uwaga:** Korzystając z tej preferencji, klucz API będzie przechowywany w postaci zwykłego tekstu na komputerze z uruchomioną aplikacją Theia. Użyj zmiennej środowiskowej `OPENAI_API_KEY`, aby bezpiecznie ustawić klucz." + } + }, + "workspace": { + "coderAgent": { + "description": "Asystent AI zintegrowany z Theia IDE, zaprojektowany do pomocy programistom. Agent ten może uzyskać dostęp do obszaru roboczego użytkownika, może uzyskać listę wszystkich dostępnych plików i folderów oraz pobrać ich zawartość. Ponadto może sugerować użytkownikowi modyfikacje plików. Może zatem pomóc użytkownikowi w kodowaniu lub innych zadaniach związanych ze zmianami plików." + }, + "considerGitignore": { + "description": "Jeśli jest włączona, wyklucza pliki/foldery określone w globalnym pliku .gitignore (oczekiwaną lokalizacją jest główny obszar roboczy).", + "title": "Rozważ .gitignore" + }, + "excludedPattern": { + "description": "Lista wzorców (glob lub regex) dla plików/folderów do wykluczenia.", + "title": "Wykluczone wzorce plików" + }, + "searchMaxResults": { + "description": "Maksymalna liczba wyników wyszukiwania zwróconych przez funkcję wyszukiwania obszaru roboczego.", + "title": "Maksymalne wyniki wyszukiwania" + }, + "workspaceAgent": { + "description": "Asystent AI zintegrowany z Theia IDE, zaprojektowany do pomocy programistom. Ten agent może uzyskać dostęp do obszaru roboczego użytkownika, może uzyskać listę wszystkich dostępnych plików i folderów oraz pobrać ich zawartość. Nie może modyfikować plików. Może zatem odpowiadać na pytania dotyczące bieżącego projektu, plików projektu i kodu źródłowego w obszarze roboczym, takie jak jak zbudować projekt, gdzie umieścić kod źródłowy, gdzie znaleźć określony kod lub konfiguracje itp." + } + } + }, + "ai-chat": { + "fileChangeSetTitle": "Proponowane zmiany" + }, + "ai-chat-ui": { + "initiate-session-task-context": "Kontekst zadania: Rozpocznij sesję", + "open-current-session-summary": "Podsumowanie bieżącej sesji otwartej", + "open-settings-tooltip": "Otwórz ustawienia AI...", + "scroll-lock": "Blokada przewijania", + "scroll-unlock": "Odblokowanie zwoju", + "session-settings": "Ustawienia sesji", + "showChats": "Pokaż czaty...", + "summarize-current-session": "Podsumowanie bieżącej sesji" + }, + "ai-claude-code": { + "open-config": "Konfiguracja kodu Open Claude", + "open-memory": "Otwórz pamięć kodu Claude (CLAUDE.MD)" + }, + "ai-core": { + "agentCompletionMessage": "Agent \"{0}\" zakończył swoje zadanie.", + "agentCompletionTitle": "Agent \"{0}\" Zadanie zakończone", + "agentCompletionWithTask": "Agent \"{0}\" zakończył zadanie: {1}" + }, + "ai-editor": { + "contextMenu": "Zapytaj AI", + "sendToChat": "Wyślij do AI Chat" + }, + "ai-ide": { + "addressGhReviewCommand": { + "argumentHint": "", + "description": "Odpowiedz na komentarze dotyczące przeglądu w pull request na GitHubie." + }, + "fixGhTicketCommand": { + "argumentHint": "", + "description": "Przeanalizuj zgłoszenie GitHub i wdroż rozwiązanie." + }, + "open-agent-settings-tooltip": "Otwórz ustawienia agenta...", + "rememberCommand": { + "argumentHint": "[wskazówka dotycząca tematu]", + "description": "Wyodrębnij tematy z rozmowy i zaktualizuj informacje o projekcie" + }, + "ticketCommand": { + "argumentHint": "", + "description": "Przeanalizuj zgłoszenie GitHub i stwórz plan wdrożenia" + }, + "todoTool": { + "noTasks": "Brak zadań" + }, + "withAppTesterCommand": { + "description": "Przekaż testowanie agentowi AppTester (wymaga trybu agenta)" + } + }, + "ai-mcp": { + "blockedServersLabel": "Serwery MCP (zablokowany autostart)" + }, + "ai-terminal": { + "cancelExecution": "Anuluj wykonanie polecenia", + "canceling": "Anulowanie...", + "confirmExecution": "Potwierdź polecenie powłoki", + "denialReason": "Powód", + "executionCanceled": "Anulowane", + "executionDenied": "Odmowa", + "executionDeniedWithReason": "Odmowa uzasadniona", + "noOutput": "Brak danych wyjściowych", + "partialOutput": "Częściowa wydajność", + "timeout": "Limit czasu", + "workingDirectory": "Katalog roboczy" + }, + "callhierarchy": { + "noCallers": "Nie wykryto żadnych rozmówców.", + "open": "Hierarchia zaproszeń otwartych" + }, + "chat": { + "taskContextVariable": { + "args": { + "contextId": { + "description": "Identyfikator kontekstu zadania do pobrania lub sesji czatu do podsumowania." + } + }, + "description": "Zapewnia informacje kontekstowe dla zadania, np. plan wykonania zadania lub podsumowanie poprzednich sesji.", + "label": "Kontekst zadania" + } + }, + "collaboration": { + "collaborate": "Współpraca", + "collaboration": "Współpraca", + "collaborationWorkspace": "Przestrzeń robocza do współpracy", + "connected": "Połączony", + "connectedSession": "Połączenie z sesją współpracy", + "copiedInvitation": "Kod zaproszenia skopiowany do schowka.", + "copyAgain": "Kopiuj ponownie", + "createRoom": "Utwórz nową sesję współpracy", + "creatingRoom": "Tworzenie sesji", + "end": "Zakończenie sesji współpracy", + "endDetail": "Zakończenie sesji, zaprzestanie udostępniania treści i odebranie dostępu innym osobom.", + "enterCode": "Wprowadź kod sesji współpracy", + "failedCreate": "Nie udało się utworzyć miejsca: {0}", + "failedJoin": "Nie udało się dołączyć do pokoju: {0}", + "fieldRequired": "Pole {0} jest wymagane. Logowanie zostało przerwane.", + "invite": "Zaproś innych", + "inviteDetail": "Skopiuj kod zaproszenia, aby udostępnić go innym osobom i dołączyć do sesji.", + "joinRoom": "Dołącz do sesji współpracy", + "joiningRoom": "Sesja dołączania", + "leave": "Zostaw sesję współpracy", + "leaveDetail": "Rozłączenie się z bieżącą sesją współpracy i zamknięcie obszaru roboczego.", + "loginFailed": "Logowanie nie powiodło się.", + "loginSuccessful": "Logowanie powiodło się.", + "noAuth": "Brak metody uwierzytelniania dostarczonej przez serwer.", + "optional": "opcjonalny", + "selectAuth": "Wybierz metodę uwierzytelniania", + "selectCollaboration": "Wybierz opcję współpracy", + "serverUrl": "Adres URL serwera", + "serverUrlDescription": "Adres URL wystąpienia serwera Open Collaboration Tools Server dla sesji współpracy na żywo", + "sharedSession": "Wspólna sesja współpracy", + "startSession": "Rozpoczęcie lub dołączenie do sesji współpracy", + "userWantsToJoin": "Użytkownik '{0}' chce dołączyć do pokoju współpracy", + "whatToDo": "Co chciałbyś zrobić z innymi współpracownikami?" + }, + "core": { + "about": { + "compatibility": "{0} Zgodność", + "defaultApi": "Domyślnie {0} API", + "listOfExtensions": "Lista rozszerzeń" + }, + "common": { + "closeAll": "Zamknij wszystkie karty", + "closeAllTabMain": "Zamknij wszystkie karty w obszarze głównym", + "closeOtherTabMain": "Zamknij inne karty w obszarze głównym", + "closeOthers": "Zamknij inne karty", + "closeRight": "Zamknij karty z prawej strony", + "closeTab": "Zamknij kartę", + "closeTabMain": "Zamknij kartę w obszarze głównym", + "collapseAllTabs": "Złóż wszystkie panele boczne", + "collapseBottomPanel": "Panel dolny Toggle", + "collapseLeftPanel": "Przełączanie lewego panelu", + "collapseRightPanel": "Przełącz prawy panel", + "collapseTab": "Składana ścianka boczna", + "showNextTabGroup": "Przełącz do następnej grupy kart", + "showNextTabInGroup": "Przejście do następnej karty w grupie", + "showPreviousTabGroup": "Przejście do poprzedniej grupy kart", + "showPreviousTabInGroup": "Przełączanie do poprzedniej karty w grupie", + "toggleMaximized": "Przełącz maksymalny" + }, + "copyInfo": "Najpierw otwórz plik, aby skopiować jego ścieżkę", + "copyWarn": "Użyj polecenia kopiowania lub skrótu przeglądarki.", + "cutWarn": "Użyj polecenia \"wytnij\" lub skrótu przeglądarki.", + "enhancedPreview": { + "classic": "Wyświetla prosty podgląd karty z podstawowymi informacjami.", + "enhanced": "Wyświetla rozszerzony podgląd karty z dodatkowymi informacjami.", + "visual": "Wyświetla wizualny podgląd karty." + }, + "file": { + "browse": "Przeglądaj stronę" + }, + "highlightModifiedTabs": "Określa, czy na zmodyfikowanych (brudnych) zakładkach edytora ma być wyświetlana górna ramka.", + "keybinding": { + "duplicateModifierError": "Nie można przeanalizować powiązania klawiszy {0} Zduplikowane modyfikatory", + "metaError": "Nie można przeanalizować powiązania klawiszy {0} meta jest tylko dla OSX", + "unrecognizedKeyError": "Nierozpoznany klucz {0} w {1}" + }, + "keybindingStatus": "{0} zostało naciśnięte, oczekiwanie na kolejne klawisze", + "keyboard": { + "choose": "Wybierz układ klawiatury", + "chooseLayout": "Wybierz układ klawiatury", + "current": "(aktualny: {0})", + "currentLayout": " - obecny układ", + "mac": "Klawiatury Mac", + "pc": "Klawiatury PC", + "tryDetect": "Spróbuj wykryć układ klawiatury na podstawie informacji z przeglądarki i wciśniętych klawiszy." + }, + "navigator": { + "clipboardWarn": "Dostęp do schowka jest zablokowany. Sprawdź uprawnienia przeglądarki.", + "clipboardWarnFirefox": "Interfejs API schowka nie jest dostępny. Można go włączyć za pomocą opcji '{0}' na stronie '{1}'. Następnie należy ponownie załadować Theia. Uwaga, pozwoli to FireFox uzyskać pełny dostęp do schowka systemowego." + }, + "offline": "Offline", + "pasteWarn": "Użyj polecenia wklejania lub skrótu przeglądarki.", + "quitMessage": "Wszelkie niezapisane zmiany nie zostaną zapisane.", + "resetWorkbenchLayout": "Resetuj układ stołu warsztatowego", + "searchbox": { + "close": "Zamknij (Ucieczka)", + "next": "Następny (w dół)", + "previous": "Poprzedni (Up)", + "showAll": "Pokaż wszystkie elementy", + "showOnlyMatching": "Pokaż tylko pasujące produkty" + }, + "secondaryWindow": { + "alwaysOnTop": "Po włączeniu tej opcji okno dodatkowe pozostaje nad wszystkimi innymi oknami, w tym nad oknami różnych aplikacji.", + "description": "Ustawia początkową pozycję i rozmiar wyodrębnionego okna pomocniczego.", + "fullSize": "Pozycja i rozmiar wyodrębnionego widżetu będą takie same jak uruchomionej aplikacji Theia.", + "halfWidth": "Pozycja i rozmiar wyodrębnionego widżetu będą równe połowie szerokości uruchomionej aplikacji Theia.", + "originalSize": "Pozycja i rozmiar wyodrębnionego widżetu będą takie same jak oryginalnego widżetu." + }, + "severity": { + "log": "Dziennik" + }, + "silentNotifications": "Określa, czy wyłączyć wyskakujące okienka powiadomień.", + "tabDefaultSize": "Określa domyślny rozmiar dla zakładek.", + "tabMaximize": "Określa, czy karty mają być maksymalizowane po dwukrotnym kliknięciu.", + "tabMinimumSize": "Określa minimalny rozmiar dla zakładek.", + "tabShrinkToFit": "Zmniejszanie zakładek w celu dopasowania do dostępnej przestrzeni.", + "window": { + "tabCloseIconPlacement": { + "description": "Umieść ikony zamykania w tytułach kart na początku lub na końcu karty. Domyślnie jest to koniec na wszystkich platformach.", + "end": "Umieść ikonę zamknięcia na końcu etykiety. W językach od lewej do prawej jest to prawa strona zakładki.", + "start": "Umieść ikonę zamknięcia na początku etykiety. W językach od lewej do prawej jest to lewa strona zakładki." + } + }, + "window.menuBarVisibility": "Menu jest wyświetlane jako kompaktowy przycisk na pasku bocznym. Ta wartość jest ignorowana, gdy{0} jest {1}." + }, + "debug": { + "TheiaIDE": "Theia IDE", + "addConfigurationPlaceholder": "Wybierz główny obszar roboczy, do którego chcesz dodać konfigurację", + "breakpoint": "punkt przerwania", + "cannotRunToThisLocation": "Nie można uruchomić bieżącego wątku do określonej lokalizacji.", + "compound-cycle": "Konfiguracja startowa \"{0}\" zawiera cykl z samym sobą", + "conditionalBreakpoint": "Warunkowy punkt przerwania", + "conditionalBreakpointsNotSupported": "Warunkowe punkty przerwania nie są obsługiwane przez ten typ debugowania", + "confirmRunToShiftedPosition_msg": "Pozycja docelowa zostanie przesunięta do Ln {0}, Col {1}. Uruchomić?", + "confirmRunToShiftedPosition_title": "Nie można uruchomić bieżącego wątku do dokładnie określonej lokalizacji", + "consoleFilter": "Filtr (np. tekst, !wyklucz)", + "consoleFilterAriaLabel": "Filtruj dane wyjściowe konsoli debugowania", + "consoleSessionSelectorTooltip": "Przełączanie między sesjami debugowania. Każda sesja debugowania ma własne wyjście konsoli.", + "consoleSeverityTooltip": "Filtruj dane wyjściowe konsoli według poziomu ważności. Wyświetlane będą tylko komunikaty o wybranym poziomie ważności.", + "continueAll": "Kontynuuj Wszystko", + "copyExpressionValue": "Kopiuj wartość wyrażenia", + "couldNotRunTask": "Nie można uruchomić zadania '{0}'.", + "dataBreakpoint": "punkt przerwania danych", + "debugConfiguration": "Konfiguracja debugowania", + "debugSessionInitializationFailed": "Inicjalizacja sesji debugowania nie powiodła się. Szczegółowe informacje można znaleźć w konsoli.", + "debugSessionTypeNotSupported": "Typ sesji debugowania \"{0}\" nie jest obsługiwany.", + "debugToolbarMenu": "Menu paska narzędzi debugowania", + "debugVariableInput": "Ustaw {0} Wartość", + "disableSelectedBreakpoints": "Wyłącz wybrane punkty przerwania", + "disabledBreakpoint": "Wyłączony {0}", + "enableSelectedBreakpoints": "Włącz wybrane punkty przerwania", + "entry": "wejście", + "errorStartingDebugSession": "Wystąpił błąd podczas uruchamiania sesji debugowania, sprawdź dzienniki, aby uzyskać więcej szczegółów.", + "exception": "wyjątek", + "functionBreakpoint": "punkt przerwania funkcji", + "goto": "goto", + "htiConditionalBreakpointsNotSupported": "Uderzanie w warunkowe punkty przerwania nieobsługiwane przez ten typ debugowania", + "instruction-breakpoint": "Punkt przerwania instrukcji", + "instructionBreakpoint": "punkt przerwania instrukcji", + "logpointsNotSupported": "Punkty dziennika nieobsługiwane przez ten typ debugowania", + "missingConfiguration": "Brak konfiguracji dynamicznej \"{0}:{1}\" lub nie ma ona zastosowania.", + "pause": "pauza", + "pauseAll": "Pauza Wszystkie", + "reveal": "Ujawnij", + "step": "krok", + "taskTerminatedBySignal": "Zadanie '{0}' zakończone sygnałem {1}.", + "taskTerminatedForUnknownReason": "Zadanie '{0}' zakończone z nieznanego powodu.", + "taskTerminatedWithExitCode": "Zadanie '{0}' zostało zakończone z kodem wyjścia {1}.", + "threads": "Nici", + "toggleTracing": "Włączanie/wyłączanie śledzenia komunikacji z adapterami debugowania", + "unknownSession": "Nieznana sesja", + "unverifiedBreakpoint": "Niezweryfikowany {0}" + }, + "editor": { + "diffEditor.wordWrap2": "Linie będą zawijane zgodnie z ustawieniem `#editor.wordWrap#`.", + "dirtyEncoding": "Plik jest zabrudzony. Proszę zapisać go najpierw przed ponownym otwarciem z innym kodowaniem.", + "editor.bracketPairColorization.enabled": "Kontroluje, czy kolorowanie par nawiasów jest włączone, czy nie. Użyj `#workbench.colorCustomizations#`, aby zastąpić kolory podświetlenia nawiasów.", + "editor.codeActions.triggerOnFocusChange": "Włącz wyzwalanie `#editor.codeActionsOnSave#` gdy `#files.autoSave#` jest ustawione na `afterDelay`. Akcje kodu muszą być ustawione na `always`, aby były wyzwalane przy zmianach okna i fokusu.", + "editor.detectIndentation": "Kontroluje, czy `#editor.tabSize#` i `#editor.insertSpaces#` będą automatycznie wykrywane podczas otwierania pliku na podstawie jego zawartości.", + "editor.experimental.preferTreeSitter": "Kontroluje, czy dla określonych języków należy włączyć analizę składniową Tree Sitter. Będzie to miało pierwszeństwo przed `editor.experimental.treeSitterTelemetry` dla określonych języków.", + "editor.inlayHints.enabled1": "Podpowiedzi są domyślnie wyświetlane i ukrywają się po przytrzymaniu `Ctrl+Alt`.", + "editor.inlayHints.enabled2": "Podpowiedzi są domyślnie ukryte i pokazują się po przytrzymaniu `Ctrl+Alt`.", + "editor.inlayHints.fontFamily": "Kontroluje rodzinę czcionek podpowiedzi inlay w edytorze. Gdy ustawiona na pustą, używana jest `#editor.fontFamily#`.", + "editor.inlayHints.fontSize": "Kontroluje rozmiar czcionki podpowiedzi inlay w edytorze. Domyślnie używana jest wartość `#editor.fontSize#`, gdy skonfigurowana wartość jest mniejsza niż `5` lub większa niż rozmiar czcionki edytora.", + "editor.inlineSuggest.edits.experimental.enabled": "Określa, czy włączyć edycję eksperymentalną w sugestiach wbudowanych.", + "editor.inlineSuggest.edits.experimental.onlyShowWhenCloseToCursor": "Określa, czy sugestie inline mają być wyświetlane tylko wtedy, gdy kursor znajduje się blisko sugestii.", + "editor.inlineSuggest.edits.experimental.useInterleavedLinesDiff": "Kontroluje, czy włączyć eksperymentalne linie z przeplotem w sugestiach inline.", + "editor.inlineSuggest.edits.experimental.useMixedLinesDiff": "Określa, czy włączyć edycję eksperymentalną w sugestiach wbudowanych.", + "editor.insertSpaces": "Wstawia spacje po naciśnięciu `Tab`. To ustawienie jest nadpisywane na podstawie zawartości pliku, gdy włączona jest funkcja `#editor.detectIndentation#`.", + "editor.quickSuggestions": "Kontroluje czy sugestie powinny być automatycznie wyświetlane podczas pisania. Można to kontrolować w przypadku wpisywania komentarzy, ciągów znaków i innego kodu. Szybkie sugestie mogą być skonfigurowane tak, aby pokazywały się jako tekst widma lub z widżetem sugestii. Należy również pamiętać o ustawieniu '#editor.suggestOnTriggerCharacters#', które kontroluje czy sugestie są uruchamiane przez znaki specjalne.", + "editor.suggestFontSize": "Rozmiar czcionki dla widżetu sugestii. Gdy ustawione na `0`, używana jest wartość `#editor.fontSize#`.", + "editor.suggestLineHeight": "Wysokość linii dla widżetu sugestii. Gdy ustawione na `0`, używana jest wartość `#editor.lineHeight#`. Minimalna wartość to 8.", + "editor.tabSize": "Liczba spacji równa tabulatorowi. To ustawienie jest nadpisywane na podstawie zawartości pliku, gdy włączona jest funkcja `#editor.detectIndentation#`.", + "formatOnSaveTimeout": "Timeout w milisekundach, po którym formatowanie uruchamiane przy zapisie pliku zostanie anulowane.", + "persistClosedEditors": "Określa, czy historia zamkniętego edytora ma być zachowywana podczas przeładowywania okna.", + "showAllEditors": "Pokaż wszystkie otwarte edytory", + "splitHorizontal": "Podziel edytor poziomo", + "splitVertical": "Podziel edytor pionowo", + "toggleStickyScroll": "Przełącz przewijanie przylepnel" + }, + "external-terminal": { + "cwd": "Wybór bieżącego katalogu roboczego dla nowego terminala zewnętrznego" + }, + "file-search": { + "toggleIgnoredFiles": " (Naciśnij {0}, aby pokazać/ukryć ignorowane pliki)" + }, + "fileDialog": { + "showHidden": "Pokaż ukryte pliki" + }, + "fileSystem": { + "fileResource": { + "overWriteBody": "Czy chcesz nadpisać zmiany wprowadzone w \"{0}\" w systemie plików?" + } + }, + "filesystem": { + "copiedToClipboard": "Skopiowałem link do pobrania do schowka.", + "copyDownloadLink": "Kopiuj Link do pobrania", + "dialog": { + "initialLocation": "Przejdź do lokalizacji początkowej", + "multipleItemMessage": "Można wybrać tylko jeden element", + "navigateBack": "Nawiguj wstecz", + "navigateForward": "Nawiguj do przodu", + "navigateUp": "Nawiguj w górę jednego katalogu" + }, + "fileResource": { + "binaryFileQuery": "Otwarcie go może zająć trochę czasu i może spowodować, że IDE nie będzie reagować. Czy mimo to chcesz otworzyć plik \"{0}\"?", + "binaryTitle": "Plik jest albo binarny, albo używa nieobsługiwanego kodowania tekstowego.", + "largeFileTitle": "Plik jest zbyt duży ({0}).", + "overwriteTitle": "Plik '{0}' został zmieniony w systemie plików." + }, + "filesExclude": "Konfiguracja wzorców globalnych dla wykluczania plików i folderów. Na przykład, Eksplorator plików decyduje, które pliki i foldery pokazać lub ukryć na podstawie tego ustawienia.", + "format": "Format:", + "maxConcurrentUploads": "Maksymalna liczba jednocześnie wysyłanych plików podczas wysyłania wielu plików. 0 oznacza, że wszystkie pliki będą wysyłane jednocześnie.", + "maxFileSizeMB": "Kontroluje maksymalny rozmiar pliku w MB, który może zostać otwarty.", + "prepareDownload": "Przygotowanie do pobrania...", + "prepareDownloadLink": "Przygotowywanie linku do pobrania...", + "processedOutOf": "Przetworzono {0} z {1}.", + "replaceTitle": "Wymiana pliku", + "uploadFailed": "Wystąpił błąd podczas przesyłania pliku. {0}", + "uploadFiles": "Prześlij pliki...", + "uploadedOutOf": "Przesłano {0} z {1}." + }, + "getting-started": { + "ai": { + "header": "W środowisku Theia IDE dostępna jest obsługa AI (wersja beta)!", + "openAIChatView": "Otwórz teraz widok czatu AI, aby dowiedzieć się, jak zacząć!" + }, + "apiComparator": "{0} Zgodność z API", + "newExtension": "Budowanie nowego rozszerzenia", + "newPlugin": "Tworzenie nowego pluginu", + "startup-editor": { + "welcomePage": "Otwórz stronę powitalną, zawierającą treści ułatwiające rozpoczęcie korzystania z witryny {0} i rozszerzeń." + }, + "telemetry": "Wykorzystanie danych i telemetria" + }, + "git": { + "aFewSecondsAgo": "kilka sekund temu", + "addSignedOff": "Dodaj podpisane przez", + "added": "Dodano", + "amendReuseMessage": "Aby ponownie użyć ostatniego komunikatu commit, należy nacisnąć 'Enter' lub 'Escape', aby anulować.", + "amendRewrite": "Ponownie napisać poprzednią wiadomość. Wcisnąć 'Enter', aby potwierdzić lub 'Escape', aby anulować.", + "checkoutCreateLocalBranchWithName": "Utworzyć nowy oddział lokalny o nazwie: {0}. Wcisnąć 'Enter', aby potwierdzić lub 'Escape', aby anulować.", + "checkoutProvideBranchName": "Proszę podać nazwę oddziału.", + "checkoutSelectRef": "Wybierz ref do kasy lub utwórz nowy oddział lokalny:", + "cloneQuickInputLabel": "Proszę podać lokalizację repozytorium Git. Naciśnij 'Enter', aby potwierdzić lub 'Escape', aby anulować.", + "cloneRepository": "Sklonuj repozytorium Git: {0}. Naciśnij 'Enter', aby potwierdzić lub 'Escape', aby anulować.", + "compareWith": "Porównaj z...", + "compareWithBranchOrTag": "Wybierz gałąź lub znacznik do porównania z aktualnie aktywną gałęzią {0}:", + "conflicted": "Skonfliktowany", + "copied": "Skopiowany", + "diff": "Dyferencjał", + "dirtyDiffLinesLimit": "Nie pokazuj brudnych dekoracji diff, jeśli liczba linii edytora przekracza ten limit.", + "dropStashMessage": "Skrytka pomyślnie usunięta.", + "editorDecorationsEnabled": "Pokaż dekoracje git w edytorze.", + "fetchPickRemote": "Wybierz pilota, z którego chcesz pobrać dane:", + "gitDecorationsColors": "Użyj dekoracji kolorystycznej w nawigatorze.", + "mergeEditor": { + "currentSideTitle": "Aktualny", + "incomingSideTitle": "Nadchodzące" + }, + "mergeQuickPickPlaceholder": "Wybierz gałąź, która ma zostać połączona z aktualnie aktywną gałęzią {0}:", + "missingUserInfo": "Upewnij się, że skonfigurowałeś swoje 'user.name' i 'user.email' w git.", + "noHistoryForError": "Nie ma dostępnej historii dla {0}", + "noPreviousCommit": "Brak wcześniejszych zobowiązań do zmiany", + "noRepositoriesSelected": "Nie wybrano żadnych repozytoriów.", + "prepositionIn": "w", + "renamed": "Zmieniono nazwę", + "repositoryNotInitialized": "Repozytorium {0} nie jest jeszcze zainicjalizowane.", + "stashChanges": "Zmiany w schowku. Wcisnąć 'Enter', aby potwierdzić lub 'Escape', aby anulować.", + "stashChangesWithMessage": "Zmiany w pamięci masowej z komunikatem: {0}. Wcisnąć 'Enter', aby potwierdzić lub 'Escape', aby anulować.", + "tabTitleIndex": "{0} (indeks)", + "tabTitleWorkingTree": "{0} (Drzewo robocze)", + "toggleBlameAnnotations": "Przełączanie adnotacji o winie", + "unstaged": "Bez inscenizacji" + }, + "keybinding-schema-updater": { + "deprecation": "Zamiast tego użyj klauzuli `when`." + }, + "keymaps": { + "addKeybindingTitle": "Dodaj powiązanie klawiszy dla {0}", + "editKeybinding": "Edytuj powiązanie klawiszy...", + "editKeybindingTitle": "Edytuj przypisanie klawiszy dla {0}", + "editWhenExpression": "Edit When Expression...", + "editWhenExpressionTitle": "Edytuj, gdy wyrażenie dla {0}", + "keybinding": { + "copy": "Kopiowanie powiązań klawiszy", + "copyCommandId": "Identyfikator polecenia kopiowania powiązania klawiszy", + "copyCommandTitle": "Tytuł polecenia kopiowania powiązania klawiszy", + "edit": "Edytuj powiązanie klawiszy...", + "editWhenExpression": "Edytuj powiązanie klawiszy, gdy wyrażenie..." + }, + "keybindingCollidesValidation": "przypisanie klawiszy aktualnie koliduje", + "requiredKeybindingValidation": "wymagana jest wartość wiązania klawiszy", + "resetKeybindingConfirmation": "Czy naprawdę chcesz przywrócić domyślną wartość tego powiązania klawiszy?", + "resetKeybindingTitle": "Zresetuj przypisanie klawiszy dla {0}.", + "resetMultipleKeybindingsWarning": "Jeśli dla tego polecenia istnieje wiele przypisań klawiszy, wszystkie zostaną zresetowane." + }, + "localize": { + "offlineTooltip": "Nie można połączyć się z backendem." + }, + "markers": { + "clearAll": "Wyczyść wszystko", + "noProblems": "Dotychczas nie wykryto żadnych problemów w przestrzeni roboczej.", + "tabbarDecorationsEnabled": "Pokaż dekoratory problemów (znaczniki diagnostyczne) na paskach kart." + }, + "memory-inspector": { + "addressTooltip": "Miejsce w pamięci do wyświetlenia, adres lub wyrażenie obliczane na adres", + "ascii": "ASCII", + "binary": "Binarne", + "byteSize": "Rozmiar bajtu", + "bytesPerGroup": "Bajty na grupę", + "closeSettings": "Zamknij ustawienia", + "columns": "Kolumny", + "command": { + "createNewMemory": "Tworzenie nowego inspektora pamięci", + "createNewRegisterView": "Utwórz nowy widok rejestru", + "followPointer": "Podążaj za wskazówką", + "followPointerMemory": "Podążaj za wskaźnikiem w inspektorze pamięci", + "resetValue": "Wartość zerowa", + "showRegister": "Pokaż rejestr w inspektorze pamięci", + "viewVariable": "Pokaż zmienną w inspektorze pamięci" + }, + "data": "Dane", + "decimal": "W systemie dziesiętnym", + "diff": { + "label": "Diff: {0}" + }, + "diff-widget": { + "offset-label": "{0} Offset", + "offset-title": "Bajty do przesunięcia pamięci z {0}" + }, + "editable": { + "apply": "Zastosuj zmiany", + "clear": "Wyraźne zmiany" + }, + "endianness": "Endianness", + "extraColumn": "Dodatkowa kolumna", + "groupsPerRow": "Grupy na wiersz", + "hexadecimal": "Szesnastkowo", + "length": "Długość", + "lengthTooltip": "Liczba bajtów do pobrania, w systemie dziesiętnym lub szesnastkowym", + "memory": { + "addressField": { + "memoryReadError": "W polu Lokalizacja wpisz adres lub wyrażenie." + }, + "freeze": "Widok zamrożonej pamięci", + "hideSettings": "Ukryj panel ustawień", + "readError": { + "bounds": "Przekroczone granice pamięci, wynik zostanie obcięty.", + "noContents": "Obecnie nie jest dostępna zawartość pamięci." + }, + "readLength": { + "memoryReadError": "W polu Długość wprowadź długość (liczbę dziesiętną lub szesnastkową)." + }, + "showSettings": "Pokaż panel ustawień", + "unfreeze": "Odmrażanie widoku pamięci", + "userError": "Wystąpił błąd w pobieraniu pamięci." + }, + "memoryCategory": "Inspektor pamięci", + "memoryInspector": "Inspektor pamięci", + "memoryTitle": "Pamięć", + "octal": "Octal", + "offset": "Offset", + "offsetTooltip": "Przesunięcie, które ma być dodane do bieżącej lokalizacji pamięci, podczas nawigacji", + "provider": { + "localsError": "Nie można odczytać zmiennych lokalnych. Brak aktywnej sesji debugowania.", + "readError": "Nie można odczytać pamięci. Brak aktywnej sesji debugowania.", + "writeError": "Nie można zapisać pamięci. Brak aktywnej sesji debugowania." + }, + "register": "Zarejestruj się", + "register-widget": { + "filter-placeholder": "Filtr (zaczyna się od)" + }, + "registerReadError": "Wystąpił błąd w pobieraniu rejestrów.", + "registers": "Rejestry", + "toggleComparisonWidgetVisibility": "Przełączanie widoczności widgetu porównania", + "utils": { + "afterBytes": "Musisz załadować pamięć w obu widżetach, które chcesz porównać. {0} nie ma załadowanej pamięci.", + "bytesMessage": "Musisz załadować pamięć w obu widżetach, które chcesz porównać. {0} nie ma załadowanej pamięci." + } + }, + "messages": { + "notificationTimeout": "Powiadomienia informacyjne zostaną ukryte po upływie tego czasu.", + "toggleNotifications": "Przełącz Powiadomienia" + }, + "mini-browser": { + "typeUrl": "Wpisz adres URL" + }, + "monaco": { + "noSymbolsMatching": "Brak pasujących symboli", + "typeToSearchForSymbols": "Wpisz, aby wyszukać symbole" + }, + "navigator": { + "autoReveal": "Auto ujawnienie", + "clipboardWarn": "Dostęp do schowka jest zablokowany. Sprawdź uprawnienia przeglądarki.", + "clipboardWarnFirefox": "Interfejs API schowka nie jest dostępny. Można go włączyć za pomocą opcji '{0}' na stronie '{1}'. Następnie należy ponownie załadować Theia. Uwaga, pozwoli to FireFox uzyskać pełny dostęp do schowka systemowego.", + "openWithSystemEditor": "Otwórz za pomocą edytora systemu", + "refresh": "Odśwież w Eksploratorze", + "reveal": "Ujawnij w Eksploratorze", + "systemEditor": "Edytor systemu", + "toggleHiddenFiles": "Przełącz ukryte pliki" + }, + "output": { + "clearOutputChannel": "Wyczyść kanał wyjściowy...", + "closeOutputChannel": "Zamknij kanał wyjściowy...", + "hiddenChannels": "Ukryte kanały", + "hideOutputChannel": "Ukryj kanał wyjściowy...", + "maxChannelHistory": "Maksymalna liczba wpisów w kanale wyjściowym.", + "outputChannels": "Kanały wyjściowe", + "showOutputChannel": "Pokaż kanał wyjściowy..." + }, + "plugin": { + "blockNewTab": "Twoja przeglądarka uniemożliwiła otwarcie nowej karty" + }, + "plugin-dev": { + "alreadyRunning": "Hostowana instancja jest już uruchomiona.", + "debugInstance": "Instancja debugowania", + "debugMode": "Używanie inspect lub inspect-brk do debugowania Node.js", + "debugPorts": { + "debugPort": "Port używany do debugowania Node.js tego serwera" + }, + "devHost": "Gospodarz ds. rozwoju", + "failed": "Failed to run hosted plugin instance: {0}", + "hostedPlugin": "Wtyczka hostowana", + "hostedPluginRunning": "Wtyczka hostowana: Uruchomiony", + "hostedPluginStarting": "Wtyczka hostowana: Start", + "hostedPluginStopped": "Wtyczka hostowana: Zatrzymany", + "hostedPluginWatching": "Wtyczka hostowana: Obserwowanie", + "instanceTerminated": "{0} zostało zakończone", + "launchOutFiles": "Tablica wzorców globalnych do lokalizowania wygenerowanych plików JavaScript (`${pluginPath}` zostanie zastąpione przez rzeczywistą ścieżkę do pluginu).", + "noValidPlugin": "Podany folder nie zawiera poprawnego pluginu.", + "notRunning": "Hostowana instancja nie jest uruchomiona.", + "pluginFolder": "Folder pluginów jest ustawiony na: {0}", + "preventedNewTab": "Twoja przeglądarka uniemożliwiła otwarcie nowej karty", + "restartInstance": "Zrestartuj instancję", + "running": "Hosted instance is running at:", + "selectPath": "Wybierz ścieżkę", + "startInstance": "Uruchomienie instancji", + "starting": "Uruchomienie serwera instancji ...", + "stopInstance": "Zatrzymaj instancję", + "unknownTerminated": "Instancja została zakończona", + "watchMode": "Uruchom strażnika na opracowywanym pluginie" + }, + "plugin-ext": { + "authentication-main": { + "loginTitle": "Login", + "signedOut": "Wylogowanie zakończone sukcesem." + }, + "plugins": "Wtyczki", + "webviewTrace": "Kontroluje śledzenie komunikacji z webviews.", + "webviewWarnIfUnsecure": "Ostrzega użytkowników, że widoki internetowe są obecnie wdrażane w sposób niezabezpieczony." + }, + "preferences": { + "ai-features": "Funkcje AI", + "hostedPlugin": "Hostowana wtyczka", + "toolbar": "Pasek narzędzi" + }, + "preview": { + "openByDefault": "Domyślnie otwiera podgląd zamiast edytora." + }, + "property-view": { + "created": "Utworzony", + "directory": "Katalog", + "lastModified": "Ostatnio zmodyfikowany", + "location": "Lokalizacja", + "noProperties": "Brak dostępnych obiektów.", + "properties": "Właściwości", + "symbolicLink": "Powiązanie symboliczne" + }, + "remote": { + "dev-container": { + "connect": "Otwórz ponownie w kontenerze", + "noDevcontainerFiles": "W obszarze roboczym nie znaleziono plików devcontainer.json. Upewnij się, że masz katalog .devcontainer z plikiem devcontainer.json.", + "selectDevcontainer": "Wybierz plik devcontainer.json" + }, + "ssh": { + "connect": "Podłącz bieżące okno do hosta...", + "connectToConfigHost": "Połącz bieżące okno z hostem w pliku konfiguracyjnym...", + "enterHost": "Wprowadź nazwę hosta SSH", + "enterUser": "Wprowadź nazwę użytkownika SSH", + "failure": "Nie można otworzyć połączenia SSH ze zdalnym.", + "hostPlaceHolder": "Np. hello@example.com", + "needsHost": "Wprowadź nazwę hosta.", + "needsUser": "Wprowadź nazwę użytkownika.", + "userPlaceHolder": "Np. cześć" + }, + "sshNoConfigPath": "Nie znaleziono ścieżki konfiguracji SSH.", + "wsl": { + "connectToWsl": "Połączenie z WSL", + "connectToWslUsingDistro": "Połączenie z WSL za pomocą Distro...", + "noWslDistroFound": "Nie znaleziono dystrybucji WSL. Najpierw zainstaluj dystrybucję WSL.", + "reopenInWsl": "Ponowne otwarcie folderu w WSL", + "selectWSLDistro": "Wybór dystrybucji WSL" + } + }, + "scm": { + "amend": "Zmienić", + "amendHeadCommit": "Zobowiązanie HEAD", + "amendLastCommit": "Zmienić ostatnie zobowiązanie", + "changeRepository": "Zmień Repozytorium...", + "config.untrackedChanges": "Określa zachowanie się zmian nieśledzonych.", + "config.untrackedChanges.hidden": "ukryte", + "config.untrackedChanges.mixed": "mieszane", + "config.untrackedChanges.separate": "oddzielna strona", + "dirtyDiff": { + "close": "Zamknij widok podglądu zmian" + }, + "history": "Historia", + "mergeEditor": { + "resetConfirmationTitle": "Czy naprawdę chcesz zresetować wynik scalania w tym edytorze?" + }, + "noRepositoryFound": "Nie znaleziono repozytorium", + "unamend": "Zmienić", + "unamendCommit": "Niepoprawione zobowiązanie" + }, + "search-in-workspace": { + "includeIgnoredFiles": "Dołączanie ignorowanych plików", + "noFolderSpecified": "Nie otwarto ani nie określono folderu. Aktualnie przeszukiwane są tylko otwarte pliki.", + "resultSubset": "To jest tylko podzbiór wszystkich wyników. Użyj bardziej szczegółowego terminu wyszukiwania, aby zawęzić listę wyników.", + "searchOnEditorModification": "Przeszukiwanie aktywnego edytora po modyfikacji." + }, + "secondary-window": { + "extract-widget": "Przenieś widok do okna podrzędnego" + }, + "shell-area": { + "secondary": "Drugie okno" + }, + "task": { + "attachTask": "Dołącz zadanie...", + "circularReferenceDetected": "Wykryto odwołanie cykliczne: {0} --> {1}", + "clearHistory": "Czysta historia", + "errorKillingTask": "Błąd zakończenia zadania '{0}': {1}", + "errorLaunchingTask": "Błąd uruchamiania zadania '{0}': {1}", + "invalidTaskConfigs": "Znaleziono nieprawidłowe konfiguracje zadań. Otwórz tasks.json i znajdź szczegóły w widoku Problems.", + "neverScanTaskOutput": "Nigdy nie skanuj danych wyjściowych zadania", + "noTaskToRun": "Nie znaleziono zadania do uruchomienia. Skonfiguruj zadania...", + "noTasksFound": "Nie znaleziono żadnych zadań", + "notEnoughDataInDependsOn": "Informacje podane w \"dependsOn\" nie są wystarczające do dopasowania właściwego zadania!", + "schema": { + "commandOptions": { + "cwd": "Bieżący katalog roboczy wykonywanego programu lub skryptu. Jeśli pominięto, używany jest bieżący katalog główny obszaru roboczego Theia." + }, + "presentation": { + "panel": { + "dedicated": "Terminal jest dedykowany do określonego zadania. Jeśli to zadanie zostanie wykonane ponownie, terminal zostanie ponownie użyty. Jednak dane wyjściowe innego zadania są prezentowane w innym terminalu.", + "new": "Każde wykonanie tego zadania korzysta z nowego, czystego terminala.", + "shared": "Terminal jest współdzielony, a dane wyjściowe innych uruchomionych zadań są dodawane do tego samego terminala." + }, + "showReuseMessage": "Kontroluje, czy wyświetlać komunikat \"Terminal będzie ponownie używany przez zadania\"." + }, + "problemMatcherObject": { + "owner": "Właściciel problemu w Theia. Może zostać pominięty, jeśli podano bazę. Domyślnie \"external\", jeśli pominięto i nie określono bazy." + } + }, + "taskAlreadyRunningInTerminal": "Zadanie jest już uruchomione w terminalu", + "taskExitedWithCode": "Zadanie '{0}' zostało zakończone z kodem {1}.", + "taskTerminalTitle": "Zadanie: {0}", + "taskTerminatedBySignal": "Zadanie '{0}' zostało zakończone przez sygnał {1}.", + "terminalWillBeReusedByTasks": "Terminal będzie ponownie wykorzystywany przez zadania." + }, + "terminal": { + "defaultProfile": "Domyślny profil używany w {0}", + "enableCopy": "Włącz ctrl-c (cmd-c na macOS), aby skopiować zaznaczony tekst", + "enablePaste": "Włącz ctrl-v (cmd-v na macOS), aby wkleić z schowka", + "profileArgs": "Argumenty powłoki, których używa ten profil.", + "profileColor": "Identyfikator koloru motywu terminala do powiązania z terminalem.", + "profileDefault": "Wybierz Profil domyślny...", + "profileIcon": "ID codicon do skojarzenia z ikoną terminala.\nterminal-tmux:\"$(terminal-tmux)\"", + "profileNew": "Nowy Terminal (z profilem)...", + "profilePath": "Ścieżka powłoki, której używa ten profil.", + "profiles": "Profile, które mają być prezentowane podczas tworzenia nowego terminala. Ustaw właściwość path ręcznie z opcjonalnymi argumentami.\nUstaw istniejący profil na `null`, aby ukryć profil z listy, na przykład: `\"{0}\": null`.", + "rendererType": "Kontroluje sposób renderowania terminala.", + "rendererTypeDeprecationMessage": "Typ renderowania nie jest już obsługiwany jako opcja.", + "selectProfile": "Wybrać profil dla nowego terminalu", + "shell.deprecated": "Jest to przestarzałe, nowym zalecanym sposobem konfiguracji domyślnej powłoki jest utworzenie profilu terminala w 'terminal.integrated.profiles.{0}' i ustawienie jego nazwy jako domyślnej w 'terminal.integrated.defaultProfile.{0}.'", + "shellArgsLinux": "Argumenty wiersza poleceń do użycia w terminalu Linuksa.", + "shellArgsOsx": "Argumenty wiersza poleceń do użycia w terminalu macOS.", + "shellArgsWindows": "Argumenty wiersza poleceń do użycia w terminalu Windows.", + "shellLinux": "Ścieżka do powłoki, z której korzysta terminal na Linuksie (domyślnie: '{0}'}).", + "shellOsx": "Ścieżka do powłoki, z której korzysta terminal na macOS (domyślnie: '{0}'}).", + "shellWindows": "Ścieżka do powłoki, której terminal używa na Windows. (domyślnie: '{0}')." + }, + "terminal-manager": { + "addTerminalToGroup": "Dodaj terminal do grupy", + "closeDialog": { + "message": "Po zamknięciu menedżera terminala nie będzie można przywrócić jego układu. Czy na pewno chcesz zamknąć menedżera terminala?", + "title": "Czy chcesz zamknąć menedżera terminala?" + }, + "closeTerminalManager": "Zamknij menedżera terminali", + "createNewTerminalGroup": "Utwórz nową grupę terminali", + "createNewTerminalPage": "Utwórz nową stronę terminala", + "deleteGroup": "Usuń grupę", + "deletePage": "Usuń stronę", + "deleteTerminal": "Usuń terminal", + "group": "Grupa", + "label": "Terminale", + "maximizeBottomPanel": "Maksymalizacja dolnego panelu", + "minimizeBottomPanel": "Zminimalizuj dolny panel", + "openTerminalManager": "Otwórz menedżera terminali", + "page": "Strona", + "rename": "Zmień nazwę", + "resetTerminalManagerLayout": "Resetuj układ menedżera terminali", + "toggleTreeView": "Przełącz widok drzewa" + }, + "test": { + "cancelAllTestRuns": "Anulowanie wszystkich testów", + "stackFrameAt": "na", + "testRunDefaultName": "{0} bieg {1}", + "testRuns": "Przebiegi testowe" + }, + "toolbar": { + "addCommand": "Dodaj polecenie do paska narzędzi", + "addCommandPlaceholder": "Znajdź polecenie, które można dodać do paska narzędzi", + "centerColumn": "Kolumna środkowa", + "failedUpdate": "Nie udało się zaktualizować wartości \"{0}\" w \"{1}\".", + "filterIcons": "Ikony filtrów", + "iconSelectDialog": "Wybierz ikonę dla \"{0}\".", + "iconSet": "Zestaw ikon", + "insertGroupLeft": "Wstaw Separator grup (z lewej)", + "insertGroupRight": "Wstaw Separator grup (prawy)", + "leftColumn": "Kolumna lewa", + "openJSON": "Dostosuj pasek narzędzi (Otwórz JSON)", + "removeCommand": "Usuń polecenie z paska narzędzi", + "restoreDefaults": "Przywróć domyślne ustawienia paska narzędzi", + "rightColumn": "Prawa kolumna", + "selectIcon": "Wybierz ikonę", + "toggleToolbar": "Przełączanie paska narzędzi", + "toolbarLocationPlaceholder": "Gdzie chcesz dodać to polecenie?", + "useDefaultIcon": "Użyj domyślnej ikony" + }, + "typehierarchy": { + "subtypeHierarchy": "Hierarchia podtypów", + "supertypeHierarchy": "Hierarchia nadtypów" + }, + "variableResolver": { + "listAllVariables": "Zmienna: Lista wszystkich" + }, + "vsx-registry": { + "confirmDialogMessage": "Rozszerzenie \"{0}\" jest niezweryfikowane i może stanowić zagrożenie dla bezpieczeństwa.", + "confirmDialogTitle": "Czy na pewno chcesz kontynuować instalację?", + "downloadCount": "Pobierz licz: {0}", + "errorFetching": "Błąd pobierania rozszerzeń.", + "errorFetchingConfigurationHint": "Może to być spowodowane problemami z konfiguracją sieci.", + "failedInstallingVSIX": "Nie udało się zainstalować {0} z VSIX.", + "invalidVSIX": "Wybrany plik nie jest prawidłowym pluginem \"*.vsix\".", + "license": "Licencja: {0}", + "onlyShowVerifiedExtensionsDescription": "Dzięki temu strona {0} będzie wyświetlać tylko zweryfikowane rozszerzenia.", + "onlyShowVerifiedExtensionsTitle": "Pokaż tylko zweryfikowane rozszerzenia", + "recommendedExtensions": "Lista nazw rozszerzeń zalecanych do użycia w tym obszarze roboczym.", + "searchPlaceholder": "Wyszukaj rozszerzenia w {0}.", + "showInstalled": "Pokaż zainstalowane rozszerzenia", + "showRecommendedExtensions": "Określa, czy dla zaleceń dotyczących rozszerzeń mają być wyświetlane powiadomienia.", + "vsx-extensions-contribution": { + "update-version-uninstall-error": "Błąd podczas usuwania rozszerzenia: {0}.", + "update-version-version-error": "Nie udało się zainstalować wersji {0} z {1}." + } + }, + "webview": { + "goToReadme": "Przejdź do pliku README", + "messageWarning": " Wzorzec hosta punktu końcowego {0} został zmieniony na `{1}`; zmiana wzorca może prowadzić do luk w zabezpieczeniach. Zobacz `{2}` aby uzyskać więcej informacji." + }, + "workspace": { + "bothAreDirectories": "Oba zasoby są katalogami.", + "clickToManageTrust": "Kliknij, aby zarządzać ustawieniami zaufania.", + "compareWithEachOther": "Porównaj z innymi", + "confirmDeletePermanently.description": "Nie udało się usunąć \"{0}\" za pomocą Kosza. Czy chcesz usunąć go na stałe?", + "confirmDeletePermanently.solution": "Możesz wyłączyć korzystanie z Kosza w preferencjach.", + "confirmDeletePermanently.title": "Błąd przy usuwaniu pliku", + "confirmMessage.delete": "Czy naprawdę chcesz usunąć następujące pliki?", + "confirmMessage.dirtyMultiple": "Czy naprawdę chcesz usunąć {0} plików z niezapisanymi zmianami?", + "confirmMessage.dirtySingle": "Czy naprawdę chcesz usunąć {0} z niezapisanymi zmianami?", + "confirmMessage.uriMultiple": "Czy naprawdę chcesz usunąć wszystkie {0} zaznaczone pliki?", + "confirmMessage.uriSingle": "Czy naprawdę chcesz usunąć {0}?", + "directoriesCannotBeCompared": "Katalogów nie można porównywać. {0}", + "duplicate": "Duplikat", + "failSaveAs": "Nie można uruchomić \"{0}\" dla bieżącego widżetu.", + "isDirectory": "{0}„ jest katalogiem.", + "manageTrustPlaceholder": "Wybierz stan zaufania dla tego obszaru roboczego", + "newFilePlaceholder": "Nazwa pliku", + "newFolderPlaceholder": "Nazwa folderu", + "noErasure": "Uwaga: Nic nie zostanie usunięte z dysku.", + "notWorkspaceFile": "Nieprawidłowy plik obszaru roboczego: {0}", + "openRecentPlaceholder": "Wpisz nazwę obszaru roboczego, który chcesz otworzyć", + "openRecentWorkspace": "Otwórz ostatni obszar roboczy...", + "preserveWindow": "Umożliwia otwieranie obszarów roboczych w bieżącym oknie.", + "removeFolder": "Czy na pewno chcesz usunąć poniższy folder z obszaru roboczego?", + "removeFolders": "Czy na pewno chcesz usunąć następujące foldery z obszaru roboczego?", + "restrictedModeDescription": "Niektóre funkcje są wyłączone, ponieważ ta przestrzeń robocza nie jest zaufana.", + "restrictedModeNote": "*Uwaga: funkcja zaufania obszaru roboczego jest obecnie w fazie rozwoju w Theia; nie wszystkie funkcje są jeszcze zintegrowane z zaufaniem obszaru roboczego*.", + "schema": { + "folders": { + "description": "Foldery główne w obszarze roboczym" + }, + "title": "Plik obszaru roboczego" + }, + "trashTitle": "Przenieś {0} do kosza", + "trustEmptyWindow": "Określa, czy pusty obszar roboczy jest domyślnie zaufany, czy nie.", + "trustEnabled": "Określa, czy zaufanie do obszaru roboczego jest włączone, czy nie. Jeśli wyłączone, wszystkie obszary robocze są zaufane.", + "trustTrustedFolders": "Lista adresów URI folderów, które są uznawane za zaufane bez wyświetlania monitu.", + "untitled-cleanup": "Wygląda na to, że jest wiele plików obszaru roboczego bez tytułu. Proszę sprawdzić {0} i usunąć wszystkie nieużywane pliki.", + "variables": { + "cwd": { + "description": "Aktualny katalog roboczy programu uruchamiającego zadania podczas uruchamiania" + }, + "file": { + "description": "Ścieżka do aktualnie otwartego pliku" + }, + "fileBasename": { + "description": "Nazwa podstawowa aktualnie otwartego pliku" + }, + "fileBasenameNoExtension": { + "description": "Nazwa aktualnie otwartego pliku bez rozszerzenia" + }, + "fileDirname": { + "description": "Nazwa katalogu aktualnie otwartego pliku" + }, + "fileExtname": { + "description": "Rozszerzenie aktualnie otwartego pliku" + }, + "relativeFile": { + "description": "Ścieżka aktualnie otwartego pliku względem katalogu głównego obszaru roboczego" + }, + "relativeFileDirname": { + "description": "Nazwa katalogu bieżącego otwartego pliku względem ${workspaceFolder}" + }, + "workspaceFolder": { + "description": "Ścieżka do folderu głównego obszaru roboczego" + }, + "workspaceFolderBasename": { + "description": "Nazwa folderu głównego obszaru roboczego" + }, + "workspaceRoot": { + "description": "Ścieżka do folderu głównego obszaru roboczego" + }, + "workspaceRootFolderName": { + "description": "Nazwa folderu głównego obszaru roboczego" + } + }, + "workspaceFolderAdded": "Utworzono przestrzeń roboczą z wieloma korzeniami. Czy chcesz zapisać konfigurację obszaru roboczego jako plik?", + "workspaceFolderAddedTitle": "Folder dodany do obszaru roboczego" + } + }, + "vsx.disabling": "Wyłączanie", + "vsx.disabling.extensions": "Wyłączenie {0}...", + "vsx.enabling": "Włączanie", + "vsx.enabling.extension": "Włączenie {0}..." +} diff --git a/packages/core/i18n/nls.pt-br.json b/packages/core/i18n/nls.pt-br.json new file mode 100644 index 0000000..61d28dc --- /dev/null +++ b/packages/core/i18n/nls.pt-br.json @@ -0,0 +1,2097 @@ +{ + "ai-chat-ui.show-settings": "Mostrar configurações de IA", + "ai-chat:summarize-session-as-task-for-coder": "Resumir a sessão como tarefa para o codificador", + "ai.executePlanWithCoder": "Executar plano atual com codificador", + "ai.updateTaskContext": "Atualizar o contexto da tarefa atual", + "aiConfiguration:open": "Abrir a visualização de Configuração de IA", + "aiHistory:clear": "Histórico da IA: Limpar histórico", + "aiHistory:open": "Abrir a visualização do histórico de IA", + "aiHistory:sortChronologically": "História da IA: Ordenar cronologicamente", + "aiHistory:sortReverseChronologically": "História da IA: Classificar em ordem cronológica inversa", + "aiHistory:toggleCompact": "História da IA: Alternar visualização compacta", + "aiHistory:toggleHideNewlines": "Histórico da IA: Parar de interpretar novas linhas", + "aiHistory:toggleRaw": "Histórico de IA: Alternar a visualização bruta", + "aiHistory:toggleRenderNewlines": "Histórico de IA: Interpretar novas linhas", + "debug.breakpoint.editCondition": "Editar condição...", + "debug.breakpoint.removeSelected": "Remover pontos de parada selecionados", + "debug.breakpoint.toggleEnabled": "Alternar ativar pontos de interrupção", + "notebook.cell.changeToCode": "Alterar célula para código", + "notebook.cell.changeToMarkdown": "Mudança de célula para Mardown", + "notebook.cell.insertMarkdownCellAbove": "Inserir célula Markdown acima", + "notebook.cell.insertMarkdownCellBelow": "Inserir célula Markdown abaixo", + "terminal:new:profile": "Criar um novo terminal integrado a partir de um perfil", + "terminal:profile:default": "Escolha o Perfil do Terminal padrão", + "theia": { + "ai": { + "agents": { + "completionNotification": { + "mdDescription": "Comportamento da notificação quando esse agente conclui uma tarefa. Se não for definida, será usada a configuração de notificação padrão global.\n - `os-notification`: Mostra as notificações do sistema operacional/sistema\n - `message`: Mostrar notificações na barra de status/área de mensagens\n - `blink`: Pisca ou destaca a interface do usuário\n - `off`: Desativar as notificações para esse agente", + "title": "Notificação de conclusão" + }, + "enable": { + "mdDescription": "Especifica se o agente deve ser ativado (true) ou desativado (false).", + "title": "Ativar agente" + }, + "languageModelRequirements": { + "identifier": { + "mdDescription": "O identificador do modelo de linguagem a ser usado." + }, + "mdDescription": "Especifica os modelos de linguagem usados para esse agente.", + "purpose": { + "mdDescription": "A finalidade para a qual esse modelo de linguagem é usado.", + "title": "Finalidade" + }, + "title": "Requisitos do modelo de idioma" + }, + "mdDescription": "Defina as configurações do agente, como ativar ou desativar agentes específicos, configurar prompts e selecionar LLMs.", + "selectedVariants": { + "mdDescription": "Especifica as variantes de prompt atualmente selecionadas para esse agente.", + "title": "Variantes selecionadas" + }, + "title": "Configurações do agente" + }, + "anthropic": { + "apiKey": { + "description": "Digite uma chave de API de sua conta oficial do Anthropic. **Observação:** Ao usar essa preferência, a chave da API do Anthropic será armazenada em texto não criptografado no computador que estiver executando o Theia. Use a variável de ambiente `ANTHROPIC_API_KEY` para definir a chave com segurança." + }, + "models": { + "description": "Modelos antrópicos oficiais a serem usados" + } + }, + "chat": { + "agent": { + "architect": "Arquiteto", + "coder": "programador", + "universal": "Universal" + }, + "applySuggestion": "Sugestão de candidatura", + "bypassModelRequirement": { + "description": "Ignore a verificação de requisitos do modelo de linguagem. Habilite esta opção se estiver usando agentes externos (por exemplo, Claude Code) que não exigem modelos de linguagem Theia." + }, + "changeSetDefaultTitle": "Alterações sugeridas", + "changeSetFileDiffUriLabel": "Alterações na IA: {0}", + "chatAgentsVariable": { + "description": "Retorna a lista de agentes de bate-papo disponíveis no sistema" + }, + "chatSessionNamingAgent": { + "description": "Agente para gerar nomes de sessões de bate-papo", + "vars": { + "conversation": { + "description": "O conteúdo da conversa do bate-papo." + }, + "listOfSessionNames": { + "description": "A lista de nomes de sessões existentes." + } + } + }, + "chatSessionSummaryAgent": { + "description": "Agente para gerar resumos de sessões de bate-papo." + }, + "confirmApplySuggestion": "O arquivo {0} foi alterado desde que esta sugestão foi criada. Tem certeza de que deseja aplicar a alteração?", + "confirmRevertSuggestion": "O arquivo {0} foi alterado desde que esta sugestão foi criada. Tem certeza de que deseja reverter a alteração?", + "couldNotFindMatchingLM": "Não foi possível encontrar um modelo de idioma correspondente. Verifique sua configuração!", + "couldNotFindReadyLMforAgent": "Não foi possível encontrar um modelo de linguagem pronto para o agente {0}. Por favor, verifique sua configuração!", + "defaultAgent": { + "description": "Opcional: do Chat Agent que deve ser invocado, se nenhum agente for explicitamente mencionado com @ na consulta do usuário. Se nenhum agente padrão for configurado, os padrões do Theia serão aplicados." + }, + "imageContextVariable": { + "args": { + "data": { + "description": "Os dados da imagem em base64." + }, + "mimeType": { + "description": "O tipo de imagem (mimetype) da imagem." + }, + "name": { + "description": "O nome do arquivo de imagem, se disponível." + }, + "wsRelativePath": { + "description": "O caminho relativo ao espaço de trabalho do arquivo de imagem, se disponível." + } + }, + "description": "Fornece informações de contexto para uma imagem", + "label": "Arquivo de imagem" + }, + "orchestrator": { + "description": "Esse agente analisa a solicitação do usuário em comparação com a descrição de todos os agentes de bate-papo disponíveis e seleciona o agente mais adequado para responder à solicitação (usando IA). A solicitação do usuário será delegada diretamente ao agente selecionado sem confirmação adicional.", + "vars": { + "availableChatAgents": { + "description": "A lista de agentes de chat para os quais o orquestrador pode delegar, excluindo os agentes especificados na preferência de lista de exclusão." + } + } + }, + "pinChatAgent": { + "description": "Ative a fixação de agentes para manter automaticamente um agente de chat mencionado ativo em todos os prompts, reduzindo a necessidade de menções repetidas." + }, + "revertSuggestion": "Reverter sugestão", + "selectImageFile": "Selecione um arquivo de imagem", + "sessionStorage": { + "description": "Configure onde armazenar as sessões de chat.", + "globalPath": "Caminho Global", + "pathNotUsedForScope": "Não utilizado com o escopo de armazenamento {0}.", + "pathRequired": "O caminho não pode estar vazio", + "pathSettings": "Configurações do caminho", + "resetToDefault": "Redefinir para os padrões", + "scope": { + "global": "Armazene as sessões de chat na pasta de configuração global.", + "workspace": "Armazene as sessões de chat na pasta do espaço de trabalho." + }, + "workspacePath": "Caminho do espaço de trabalho" + }, + "taskContextService": { + "summarizeProgressMessage": "Resumir: {0}", + "updatingProgressMessage": "Atualização: {0}" + }, + "toolConfirmation": { + "confirm": { + "description": "Peça confirmação antes de executar as ferramentas" + }, + "disabled": { + "description": "Desativar a execução da ferramenta" + }, + "yolo": { + "description": "Executar ferramentas automaticamente sem confirmação" + } + }, + "view": { + "label": "Bate-papo com IA" + } + }, + "chat-ui": { + "addContextVariable": "Adicionar variável de contexto", + "agent": "Agente", + "aiDisabled": "Os recursos de IA estão desativados", + "applyAll": "Aplicar tudo", + "applyAllTitle": "Aplicar todas as alterações pendentes", + "askQuestion": "Faça uma pergunta", + "attachToContext": "Anexar elementos ao contexto", + "cancel": "Cancel (Esc)", + "chat-view-tree-widget": { + "ai": "IA", + "aiFeatureHeader": "Recursos de IA disponíveis (versão alfa)!", + "featuresDisabled": "Atualmente, todos os recursos de IA estão desativados!", + "generating": "Gerando", + "howToEnable": "Como ativar os recursos de IA:", + "noRenderer": "Erro: Nenhum renderizador encontrado", + "scrollToBottom": "Ir para a mensagem mais recente", + "waitingForInput": "Aguardando entrada", + "you": "Você" + }, + "chatInput": { + "clearHistory": "Limpar histórico do prompt de entrada", + "cycleMode": "Modo Cycle Chat", + "nextPrompt": "Próximo prompt", + "previousPrompt": "Prompt anterior" + }, + "chatInputAriaLabel": "Digite sua mensagem aqui", + "chatResponses": "Respostas no chat", + "code-part-renderer": { + "generatedCode": "Código gerado" + }, + "collapseChangeSet": "Recolher conjunto de alterações", + "command-part-renderer": { + "commandNotExecutable": "O comando tem o ID \"{0}\", mas não é executável na janela do Chat." + }, + "copyCodeBlock": "Copiar bloco de código", + "couldNotSendRequestToSession": "Não foi possível enviar a solicitação \"{0}\" para a sessão {1}", + "delegation-response-renderer": { + "prompt": { + "label": "Prompt delegado:" + }, + "response": { + "label": "Response:" + }, + "starting": "Delegação inicial...", + "status": { + "canceled": "cancelado", + "error": "erro", + "generating": "gerando...", + "starting": "começando..." + } + }, + "deleteChangeSet": "Excluir conjunto de alterações", + "editRequest": "Editar", + "edited": "editado", + "editedTooltipHint": "Esta variante de prompt foi editada. Você pode redefini-la na visualização Configuração da IA.", + "enterChatName": "Digite o nome do bate-papo", + "errorChatInvocation": "Ocorreu um erro durante a invocação do serviço de bate-papo.", + "expandChangeSet": "Expandir conjunto de alterações", + "failedToDeleteSession": "Falha ao excluir a sessão de bate-papo", + "failedToLoadChats": "Falha ao carregar sessões de bate-papo", + "failedToRestoreSession": "Falha ao restaurar a sessão de bate-papo", + "failedToRetry": "Falha ao tentar novamente a mensagem", + "focusInput": "Entrada do chat de foco", + "focusResponse": "Resposta do chat de foco", + "noChatAgentsAvailable": "Não há agentes de bate-papo disponíveis.", + "openDiff": "Difusão aberta", + "openOriginalFile": "Abrir arquivo original", + "performThisTask": "Execute esta tarefa.", + "persistedSession": "Sessão persistente (clique para restaurar)", + "removeChat": "Remover bate-papo", + "renameChat": "Renomear bate-papo", + "requestNotFoundForRetry": "Solicitação não encontrada para nova tentativa", + "responseFrom": "Resposta de {0}", + "selectAgentQuickPickPlaceholder": "Selecione um agente para a nova sessão", + "selectChat": "Selecionar bate-papo", + "selectContextVariableQuickPickPlaceholder": "Selecione uma variável de contexto a ser anexada à mensagem", + "selectTaskContextQuickPickItem": { + "currentlyOpen": "atualmente aberto" + }, + "selectTaskContextQuickPickPlaceholder": "Selecione um contexto de tarefa para anexar", + "selectVariableArguments": "Selecionar argumentos de variáveis", + "send": "Enviar (Enter)", + "sessionNotFoundForRetry": "Sessão não encontrada para nova tentativa", + "text-part-renderer": { + "cantDisplay": "Não é possível exibir a resposta, verifique seus ChatResponsePartRenderers!" + }, + "thinking-part-renderer": { + "thinking": "Pensamento" + }, + "toolcall-part-renderer": { + "denied": "Execução negada", + "finished": "Ran", + "rejected": "Execução cancelada" + }, + "toolconfirmation": { + "allow-options-dropdown-tooltip": "Mais opções de permissão", + "allow-session": "Permitir esse bate-papo", + "allowed": "Execução da ferramenta permitida", + "alwaysAllowConfirm": "Entendo, ativar aprovação automática", + "alwaysAllowTitle": "Habilitar aprovação automática para “{0}”?", + "canceled": "Execução da ferramenta cancelada", + "denied": "Execução de ferramenta negada", + "deny-forever": "Sempre negar", + "deny-options-dropdown-tooltip": "Mais opções de negação", + "deny-reason-placeholder": "Insira o motivo da recusa...", + "deny-session": "Negar para este Chat", + "deny-with-reason": "Negar com razão...", + "executionDenied": "Execução da ferramenta negada", + "header": "Confirmar a execução da ferramenta" + }, + "unableToSummarizeCurrentSession": "Não é possível resumir a sessão atual. Confirme se o agente de resumo não está desativado.", + "unknown-part-renderer": { + "contentNotRestoreable": "Esse conteúdo (tipo '{0}') não pôde ser totalmente restaurado. Ele pode ser de uma extensão que não está mais disponível." + }, + "unpinAgent": "Desafixar agente", + "variantTooltip": "Variante do prompt: {0}", + "yourMessage": "Sua mensagem" + }, + "claude-code": { + "agentDescription": "Agente de codificação do Anthropic", + "askBeforeEdit": "Pergunte antes de editar", + "changeSetTitle": "Alterações por Claude Code", + "clearCommand": { + "description": "Criar uma nova sessão" + }, + "compactCommand": { + "description": "Conversação compacta com instruções de foco opcionais" + }, + "completedCount": "{0}/{1} concluído", + "configCommand": { + "description": "Configuração do código Open Claude" + }, + "currentDirectory": "diretório atual", + "differentAgentRequestWarning": "A solicitação de bate-papo anterior foi tratada por um agente diferente. O Claude Code não vê essas outras mensagens.", + "directory": "Diretório", + "domain": "Domínio", + "editAutomatically": "Editar automaticamente", + "editNumber": "Editar {0}", + "editing": "Edição", + "editsCount": "{0} edições", + "emptyTodoList": "Nem todos disponíveis", + "entireFile": "Arquivo inteiro", + "excludingOnePattern": " (com exceção de 1 padrão)", + "excludingPatterns": " (exceto os padrões do site {0} )", + "executedCommand": "Executado: {0}", + "failedToParseBashToolData": "Falha ao analisar os dados da ferramenta Bash", + "failedToParseEditToolData": "Falha ao analisar os dados da ferramenta Editar", + "failedToParseGlobToolData": "Falha ao analisar os dados da ferramenta Glob", + "failedToParseGrepToolData": "Falha ao analisar os dados da ferramenta Grep", + "failedToParseLSToolData": "Falha ao analisar os dados da ferramenta LS", + "failedToParseMultiEditToolData": "Falha ao analisar os dados da ferramenta MultiEdit", + "failedToParseReadToolData": "Falha ao analisar os dados da ferramenta de leitura", + "failedToParseTodoListData": "Falha ao analisar os dados da lista de tarefas", + "failedToParseWebFetchToolData": "Falha ao analisar os dados da ferramenta WebFetch", + "failedToParseWriteToolData": "Falha ao analisar os dados da ferramenta de gravação", + "fetching": "Buscando", + "fileFilter": "Filtro de arquivos", + "filePath": "Caminho do arquivo", + "fileType": "Tipo de arquivo", + "findMatchingFiles": "Localizar arquivos que correspondam ao padrão glob \"{0}\" no diretório atual", + "findMatchingFilesWithPath": "Encontre arquivos que correspondam ao padrão glob \"{0}\" em {1}", + "finding": "Encontrar", + "from": "De", + "globPattern": "padrão globular", + "grepOptions": { + "caseInsensitive": "não diferencia maiúsculas de minúsculas", + "glob": "globo: {0}", + "headLimit": "limite: {0}", + "lineNumbers": "números de linha", + "linesAfter": "+{0} depois", + "linesBefore": "+{0} before", + "linesContext": "±{0} context", + "multiLine": "multilinha", + "type": "tipo: {0}" + }, + "grepOutputModes": { + "content": "conteúdo", + "count": "contagem", + "filesWithMatches": "arquivos com correspondências" + }, + "ignoredPatterns": "Padrões ignorados", + "ignoringPatterns": "Ignorando os padrões do {0} ", + "initCommand": { + "description": "Inicializar o projeto com o guia CLAUDE.md" + }, + "itemCount": "{0} itens", + "lineLimit": "Limite de linha", + "lines": "Linhas", + "listDirectoryContents": "Listar o conteúdo do diretório", + "listing": "Listagem", + "memoryCommand": { + "description": "Editar o arquivo de memória CLAUDE.md" + }, + "multiEditing": "Multi-edição", + "oneEdit": "1 edição", + "oneItem": "1 item", + "oneOption": "1 opção", + "openDirectoryTooltip": "Clique para abrir o diretório", + "openFileTooltip": "Clique para abrir o arquivo no editor", + "optionsCount": "{0} opções", + "partial": "Parcial", + "pattern": "Padrão", + "plan": "Modo de planejamento", + "project": "projeto", + "projectRoot": "raiz do projeto", + "readMode": "Modo de leitura", + "reading": "Leitura", + "replaceAllCount": "{0} substituir tudo", + "replaceAllOccurrences": "Substituir todas as ocorrências", + "resumeCommand": { + "description": "Retomar uma sessão" + }, + "reviewCommand": { + "description": "Solicitar revisão de código" + }, + "searchPath": "Caminho de pesquisa", + "searching": "Busca", + "startingLine": "Linha de partida", + "timeout": "Tempo limite", + "timeoutInMs": "Tempo limite: {0}ms", + "to": "Para", + "todoList": "Todo List", + "todoPriority": { + "high": "alta", + "low": "baixo", + "medium": "médio" + }, + "toolApprovalRequest": "Claude Code deseja usar a ferramenta \"{0}\". Você quer permitir isso?", + "totalEdits": "Total de edições", + "webFetch": "Busca na Web", + "writing": "Redação" + }, + "code-completion": { + "progressText": "Cálculo da conclusão do código de IA..." + }, + "codex": { + "agentDescription": "Assistente de codificação da OpenAI com tecnologia Codex", + "completedCount": "{0}/{1} concluído", + "exitCode": "Código de saída: {0}", + "fileChangeFailed": "O Codex não conseguiu aplicar as alterações para: {0}", + "fileChangeFailedGeneric": "O Codex não conseguiu aplicar as alterações no arquivo.", + "itemCount": "{0} itens", + "noItems": "Sem itens", + "oneItem": "1 item", + "running": "Executando...", + "searched": "Pesquisado", + "searching": "Pesquisando", + "todoList": "Todo List", + "webSearch": "Pesquisa na Web" + }, + "completion": { + "agent": { + "description": "Esse agente fornece autocompletar de código em linha no editor de código do Theia IDE.", + "vars": { + "file": { + "description": "O URI do arquivo que está sendo editado" + }, + "language": { + "description": "O languageId do arquivo que está sendo editado" + }, + "prefix": { + "description": "O código antes da posição atual do cursor" + }, + "suffix": { + "description": "O código após a posição atual do cursor" + } + } + }, + "automaticEnable": { + "description": "Acione automaticamente as conclusões de IA em linha em qualquer editor (Mônaco) durante a edição. \n Como alternativa, você pode acionar manualmente o código por meio do comando \"Trigger Inline Suggestion\" ou do atalho padrão \"Ctrl+Alt+Space\"." + }, + "cacheCapacity": { + "description": "Número máximo de conclusões de código a serem armazenadas no cache. Um número maior pode melhorar o desempenho, mas consumirá mais memória. O valor mínimo é 10, o intervalo recomendado é entre 50 e 200.", + "title": "Capacidade do cache de conclusão de código" + }, + "debounceDelay": { + "description": "Controla o atraso em milissegundos antes de acionar as conclusões de IA após a detecção de alterações no editor. Requer que a opção `Automatic Code Completion` esteja ativada. Digite 0 para desativar o atraso de debounce.", + "title": "Atraso de devolução" + }, + "excludedFileExts": { + "description": "Especifique as extensões de arquivo (por exemplo, .md, .txt) em que as conclusões de IA devem ser desativadas.", + "title": "Extensões de arquivo excluídas" + }, + "fileVariable": { + "description": "O URI do arquivo que está sendo editado. Disponível somente no contexto do recurso autocompletar código." + }, + "languageVariable": { + "description": "O languageId do arquivo que está sendo editado. Disponível somente no contexto do recurso autocompletar código." + }, + "maxContextLines": { + "description": "O número máximo de linhas usadas como contexto, distribuídas entre as linhas antes e depois da posição do cursor (prefixo e sufixo). Defina esse valor como -1 para usar o arquivo completo como contexto sem nenhum limite de linha e 0 para usar somente a linha atual.", + "title": "Máximo de linhas de contexto" + }, + "prefixVariable": { + "description": "O código antes da posição atual do cursor. Disponível somente no contexto de conclusão de código." + }, + "stripBackticks": { + "description": "Remova os backticks circundantes do código retornado por alguns LLMs. Se for detectado um backtick, todo o conteúdo após o backtick de fechamento também será removido. Essa configuração ajuda a garantir que o código simples seja retornado quando os modelos de linguagem usam formatação semelhante à marcação para baixo.", + "title": "Retirar backticks de conclusões em linha" + }, + "suffixVariable": { + "description": "O código após a posição atual do cursor. Disponível somente no contexto de conclusão de código." + } + }, + "configuration": { + "selectItem": "Selecione um item." + }, + "copilot": { + "auth": { + "aiConfiguration": "Configuração da IA", + "authorize": "Eu autorizei", + "copied": "Copiado!", + "copyCode": "Copiar código", + "expired": "A autorização expirou ou foi negada. Por favor, tente novamente.", + "hint": "Após inserir o código e autorizar, clique em “Eu autorizei” abaixo.", + "initiating": "Iniciando autenticação...", + "instructions": "Para autorizar a Theia a usar o GitHub Copilot, acesse o URL abaixo e insira o código:", + "openGitHub": "Abrir GitHub", + "success": "Conectou-se com sucesso ao GitHub Copilot!", + "successHint": "Se sua conta do GitHub tiver acesso ao Copilot, agora você pode configurar os modelos de linguagem do Copilot no ", + "title": "Inicie sessão no GitHub Copilot", + "tos": "Ao fazer login, você concorda com os ", + "tosLink": "Termos de Serviço do GitHub", + "verifying": "Verificando autorização..." + }, + "category": "Copiloto", + "commands": { + "signIn": "Inicie sessão no GitHub Copilot", + "signOut": "Sair do GitHub Copilot" + }, + "enterpriseUrl": { + "mdDescription": "Domínio GitHub Enterprise para a API Copilot (por exemplo, `github.mycompany.com`). Deixe em branco para GitHub.com." + }, + "models": { + "description": "Modelos do GitHub Copilot a serem usados. Os modelos disponíveis dependem da sua assinatura do Copilot." + }, + "statusBar": { + "signedIn": "Conectado ao GitHub Copilot como {0}. Clique para sair.", + "signedOut": "Não está conectado ao GitHub Copilot. Clique para fazer login." + } + }, + "core": { + "agentConfiguration": { + "actions": "Ações", + "addCustomAgent": "Adicionar agente personalizado", + "enableAgent": "Ativar agente", + "label": "Agentes", + "llmRequirements": "Requisitos para o LLM", + "notUsedInPrompt": "Não usado no prompt", + "promptTemplates": "Modelos de prompts", + "selectAgentMessage": "Selecione um agente primeiro!", + "templateName": "Modelo", + "undeclared": "Não declarado", + "usedAgentSpecificVariables": "Variáveis específicas do agente utilizadas", + "usedFunctions": "Funções utilizadas", + "usedGlobalVariables": "Variáveis globais utilizadas", + "variant": "Variante" + }, + "agentsVariable": { + "description": "Retorna a lista de agentes disponíveis no sistema" + }, + "aiConfiguration": { + "label": "Configuração de IA [Alfa]" + }, + "blinkTitle": { + "agentCompleted": "Theia - Agente concluído", + "namedAgentCompleted": "Theia - Agente \"{0}\" Concluído" + }, + "changeSetSummaryVariable": { + "description": "Fornece um resumo dos arquivos em um conjunto de alterações e seus conteúdos." + }, + "contextDetailsVariable": { + "description": "Fornece valores e descrições de texto completo para todos os elementos de contexto." + }, + "contextSummaryVariable": { + "description": "Descreve os arquivos no contexto de uma determinada sessão." + }, + "customAgentTemplate": { + "description": "Este é um exemplo de agente. Adapte as propriedades para atender às suas necessidades." + }, + "defaultModelAliases": { + "code": { + "description": "Otimizado para tarefas de geração e compreensão de código." + }, + "code-completion": { + "description": "Mais adequado para cenários de preenchimento automático de código." + }, + "summarize": { + "description": "Modelos priorizados para resumo e condensação de conteúdo." + }, + "universal": { + "description": "Bem equilibrado para uso em código e em linguagem geral." + } + }, + "defaultNotification": { + "mdDescription": "O método de notificação padrão usado quando um agente de IA conclui uma tarefa. Agentes individuais podem substituir essa configuração.\n - `os-notification`: Mostrar notificações de sistema operacional/sistema\n - `message`: Mostrar notificações na barra de status/área de mensagens\n - `blink`: Pisca ou destaca a interface do usuário\n - `off`: Desativar todas as notificações", + "title": "Tipo de notificação padrão" + }, + "discard": { + "label": "Modelo de prompt de AI de descarte" + }, + "discardCustomPrompt": { + "tooltip": "Descartar personalizações" + }, + "fileVariable": { + "description": "Resolve o conteúdo de um arquivo", + "uri": { + "description": "O URI do arquivo solicitado." + } + }, + "languageModelRenderer": { + "alias": "[pseudônimo] {0}", + "languageModel": "Modelo de idioma", + "purpose": "Finalidade" + }, + "maxRetries": { + "mdDescription": "O número máximo de tentativas de repetição quando uma solicitação a um provedor de IA falha. Um valor de 0 significa que não há novas tentativas.", + "title": "Máximo de novas tentativas" + }, + "modelAliasesConfiguration": { + "agents": "Agentes que usam esse alias", + "defaultList": "[Lista padrão]", + "evaluatesTo": "Avalia para", + "label": "Apelidos de modelo", + "modelNotReadyTooltip": "Não está pronto", + "modelReadyTooltip": "Pronto", + "noAgents": "Nenhum agente usa esse alias.", + "noModelReadyTooltip": "Nenhum modelo pronto", + "noResolvedModel": "Nenhum modelo pronto para esse alias.", + "priorityList": "Lista de prioridades", + "selectAlias": "Selecione um alias de modelo.", + "selectedModelId": "Modelo selecionado", + "unavailableModel": "O modelo selecionado não está mais disponível" + }, + "noVariableFoundForOpenRequest": "Nenhuma variável encontrada para a solicitação aberta.", + "openEditorsShortVariable": { + "description": "Referência curta a todos os arquivos abertos no momento (caminhos relativos, separados por vírgulas)" + }, + "openEditorsVariable": { + "description": "Uma lista separada por vírgulas de todos os arquivos abertos no momento, em relação à raiz do espaço de trabalho." + }, + "preference": { + "languageModelAliases": { + "description": "Configure modelos para cada alias de modelo de idioma na [AI Configuration View] ({0}). Como alternativa, você pode definir as configurações manualmente no settings.json: \n```\n\"default/code\": {\n \"selectedModel\": \"anthropic/claude-opus-4-20250514\"\n}\n```", + "selectedModel": "O modelo selecionado pelo usuário para esse alias.", + "title": "Aliases do modelo de linguagem" + } + }, + "prefs": { + "title": "Recursos de IA [Alfa]" + }, + "promptFragmentsConfiguration": { + "activeCustomizationTitle": "Personalização ativa", + "createCustomizationTitle": "Criar personalização", + "customization": "personalização", + "customizationLabel": "Personalização", + "defaultVariantTitle": "Variante padrão", + "deleteCustomizationTitle": "Excluir personalização", + "editTemplateTitle": "Editar modelo", + "headerTitle": "Fragmentos de prompts", + "label": "Fragmentos de prompts", + "noFragmentsAvailable": "Não há fragmentos de prompt disponíveis.", + "otherPromptFragmentsHeader": "Outros fragmentos de prompts", + "promptTemplateText": "Texto do modelo de prompt", + "promptVariantsHeader": "Conjuntos de variantes de prompts", + "removeCustomizationDialogMsg": "Tem certeza de que deseja remover a personalização {0} para o fragmento de prompt \"{1}\"?", + "removeCustomizationDialogTitle": "Remover personalização", + "removeCustomizationWithDescDialogMsg": "Tem certeza de que deseja remover a personalização {0} para o fragmento de prompt \"{1}\" ({2})?", + "resetAllButton": "Redefinir tudo", + "resetAllCustomizationsDialogMsg": "Tem certeza de que deseja redefinir todos os fragmentos de prompt para suas versões incorporadas? Isso removerá todas as personalizações.", + "resetAllCustomizationsDialogTitle": "Redefinir todas as personalizações", + "resetAllCustomizationsTitle": "Redefinir todas as personalizações", + "resetAllPromptFragments": "Redefinir todos os fragmentos de prompt", + "resetToBuiltInDialogMsg": "Tem certeza de que deseja redefinir o fragmento de prompt \"{0}\" para a versão incorporada? Isso removerá todas as personalizações.", + "resetToBuiltInDialogTitle": "Redefinir para incorporado", + "resetToBuiltInTitle": "Redefinir para esse valor interno", + "resetToCustomizationDialogMsg": "Tem certeza de que deseja redefinir o fragmento de prompt \"{0}\" para usar a personalização {1}? Isso removerá todas as personalizações de prioridade mais alta.", + "resetToCustomizationDialogTitle": "Redefinir para Personalização", + "resetToCustomizationTitle": "Redefinir para essa personalização", + "selectedVariantLabel": "Selecionado", + "selectedVariantTitle": "Variante selecionada", + "usedByAgentTitle": "Usado pelo agente: {0}", + "variantSetError": "A variante selecionada não existe e não foi possível encontrar um padrão. Verifique sua configuração.", + "variantSetWarning": "A variante selecionada não existe. A variante padrão está sendo usada em seu lugar.", + "variantsOfSystemPrompt": "Variantes desse conjunto de variantes de prompt:" + }, + "promptTemplates": { + "description": "Pasta para armazenar modelos de prompt personalizados. Se não forem personalizados, será usado o diretório de configuração do usuário. Considere a possibilidade de usar uma pasta que esteja sob controle de versão para gerenciar suas variantes de modelos de prompt.", + "openLabel": "Selecionar pasta" + }, + "promptVariable": { + "argDescription": "O ID do modelo de prompt a ser resolvido", + "completions": { + "detail": { + "builtin": "Fragmento de prompt incorporado", + "custom": "Fragmento de prompt personalizado" + } + }, + "description": "Resolve modelos de prompt por meio do serviço de prompt" + }, + "prompts": { + "category": "Modelos de prompts de IA da Theia" + }, + "requestSettings": { + "clientSettings": { + "description": "Configurações do cliente sobre como lidar com as mensagens enviadas de volta para o llm.", + "keepThinking": { + "description": "Se for definido como false, toda a saída de pensamento será filtrada antes de enviar a próxima solicitação do usuário em uma conversa com vários turnos." + }, + "keepToolCalls": { + "description": "Se definido como false, todas as solicitações e respostas de ferramentas serão filtradas antes de enviar a próxima solicitação de usuário em uma conversa com várias voltas." + } + }, + "mdDescription": "Permite especificar configurações de solicitação personalizadas para vários modelos.\n Cada objeto representa a configuração de um modelo específico. O campo `modelId` especifica o ID do modelo, `requestSettings` define as configurações específicas do modelo.\n O campo `providerId` é opcional e permite que você aplique as configurações a um provedor específico. Se não for definido, as configurações serão aplicadas a todos os provedores.\n Exemplo de providerIds: huggingface, openai, ollama, llamafile.\n Consulte a [nossa documentação] (https://theia-ide.org/docs/user_ai/#custom-request-settings) para obter mais informações.", + "modelSpecificSettings": { + "description": "Configurações para a ID do modelo específico." + }, + "scope": { + "agentId": { + "description": "O ID do agente (opcional) ao qual aplicar as configurações." + }, + "modelId": { + "description": "O ID do modelo (opcional)" + }, + "providerId": { + "description": "O ID do provedor (opcional) ao qual aplicar as configurações." + } + }, + "title": "Configurações de solicitação personalizadas" + }, + "skillsVariable": { + "description": "Retorna a lista de habilidades disponíveis que podem ser usadas pelos agentes de IA." + }, + "taskContextSummary": { + "description": "Resolve todos os itens de contexto de tarefa presentes no contexto da sessão." + }, + "templateSettings": { + "edited": "editado", + "unavailableVariant": "A variante selecionada não está mais disponível" + }, + "todayVariable": { + "description": "Faz algo para hoje", + "format": { + "description": "O formato da data" + } + }, + "unableToDisplayVariableValue": "Não é possível exibir o valor da variável.", + "unableToResolveVariable": "Não foi possível resolver a variável.", + "variable-contribution": { + "builtInVariable": "Theia Built-in Variable", + "currentAbsoluteFilePath": "O caminho absoluto do arquivo aberto no momento. Observe que a maioria dos agentes espera um caminho de arquivo relativo (relativo ao espaço de trabalho atual).", + "currentFileContent": "O conteúdo simples do arquivo aberto no momento. Isso exclui as informações de onde o conteúdo está vindo. Observe que a maioria dos agentes funcionará melhor com um caminho de arquivo relativo (relativo ao espaço de trabalho atual).", + "currentRelativeDirPath": "O caminho relativo do diretório que contém o arquivo aberto no momento.", + "currentRelativeFilePath": "O caminho relativo do arquivo aberto no momento.", + "currentSelectedText": "O texto simples que está selecionado no momento no arquivo aberto. Isso exclui as informações de onde o conteúdo está vindo. Observe que a maioria dos agentes trabalhará melhor com um caminho de arquivo relativo (relativo ao espaço de trabalho atual).", + "dotRelativePath": "Referência curta ao caminho relativo do arquivo aberto no momento ('currentRelativeFilePath')." + } + }, + "editor": { + "editorContextVariable": { + "description": "Resolve informações de contexto específicas do editor", + "label": "EditorContext" + }, + "explainWithAI": { + "prompt": "Explique esse erro", + "title": "Explicar com IA" + }, + "fixWithAI": { + "prompt": "Ajuda para corrigir esse erro" + } + }, + "google": { + "apiKey": { + "description": "Insira uma chave de API de sua conta oficial do Google AI (Gemini). **Observação:** Ao usar essa preferência, a chave de API do GOOGLE AI será armazenada em texto não criptografado no computador que estiver executando o Theia. Use a variável de ambiente `GOOGLE_API_KEY` para definir a chave com segurança." + }, + "maxRetriesOnErrors": { + "description": "Número máximo de novas tentativas em caso de erros. Se for menor que 1, a lógica de nova tentativa será desativada" + }, + "models": { + "description": "Modelos oficiais do Google Gemini a serem usados" + }, + "retryDelayOnOtherErrors": { + "description": "Atraso em segundos entre novas tentativas em caso de outros erros (às vezes, o Google GenAI relata erros como sintaxe JSON incompleta retornada do modelo ou 500 Internal Server Error). Definir esse valor como -1 evita novas tentativas nesses casos. Caso contrário, a nova tentativa ocorrerá imediatamente (se definido como 0) ou após esse atraso em segundos (se definido como um número positivo)." + }, + "retryDelayOnRateLimitError": { + "description": "Atraso em segundos entre novas tentativas em caso de erros de limite de taxa. Consulte https://ai.google.dev/gemini-api/docs/rate-limits" + } + }, + "history": { + "clear": { + "tooltip": "Limpar o histórico de todos os agentes" + }, + "exchange-card": { + "agentId": "Agente", + "timestamp": "Iniciado" + }, + "open-history-tooltip": "História da IA aberta...", + "request-card": { + "agent": "Agente", + "model": "Modelo", + "request": "Solicitação", + "response": "Resposta", + "timestamp": "Carimbo de data/hora", + "title": "Solicitação" + }, + "sortChronologically": { + "tooltip": "Classificar cronologicamente" + }, + "sortReverseChronologically": { + "tooltip": "Classificar em ordem cronológica inversa" + }, + "toggleCompact": { + "tooltip": "Mostrar visualização compacta" + }, + "toggleHideNewlines": { + "tooltip": "Parar de interpretar novas linhas" + }, + "toggleRaw": { + "tooltip": "Mostrar exibição bruta" + }, + "toggleRenderNewlines": { + "tooltip": "Interpretar novas linhas" + }, + "view": { + "label": "Histórico do agente de IA [Alfa]", + "noAgent": "Nenhum agente disponível.", + "noAgentSelected": "Nenhum agente selecionado.", + "noHistoryForAgent": "Não há histórico disponível para o agente selecionado '{0}'" + } + }, + "huggingFace": { + "apiKey": { + "mdDescription": "Digite uma chave de API para sua conta Hugging Face. **Nota:** Ao usar essa preferência, a chave API da Hugging Face será armazenada em texto claro na máquina que estiver executando o Theia. Use a variável de ambiente `HUGGINGFACE_API_KEY` para definir a chave de forma segura." + }, + "models": { + "mdDescription": "Modelos Hugging Face a utilizar. **Observação:** atualmente, apenas os modelos compatíveis com a API de conclusão de chat são suportados (modelos ajustados por instruções, como `*-Instruct`). Alguns modelos podem exigir a aceitação dos termos de licença no site da Hugging Face." + } + }, + "ide": { + "agent-description": "Defina as configurações do agente de IA, incluindo ativação, seleção de LLM, personalização do modelo de prompt e criação de agente personalizado na [AI Configuration View] ({0}).", + "agentConfiguration": { + "customAgentLocationQuickPick": { + "createNewFile": "Criar novo arquivo", + "openExistingFile": "Abrir arquivo existente", + "placeholder": "Escolha onde criar ou abrir um arquivo de agentes personalizados", + "title": "Selecione o local para o arquivo de agentes personalizados" + }, + "noDescription": "Sem descrição disponível" + }, + "app-tester": { + "errorCheckingDevToolsServerStatus": "Verificação de erros no status do servidor DevTools MCP: {0}", + "errorCheckingPlaywrightServerStatus": "Erro ao verificar o status do servidor Playwright MCP: {0}", + "startChromeDevToolsMcpServers": { + "canceled": "Configure o servidor MCP do Chrome DevTools.", + "error": "Falha ao iniciar o servidor MCP do Chrome DevTools: {0}", + "progress": "Iniciando o servidor MCP do Chrome DevTools.", + "question": "O servidor Chrome DevTools MCP não está em execução. Deseja iniciá-lo agora? Isso pode instalar o servidor Chrome DevTools MCP." + }, + "startMcpServers": { + "no": "Não, cancelar", + "yes": "Sim, inicie os servidores." + }, + "startPlaywrightServers": { + "canceled": "Configure os servidores MCP.", + "error": "Falha ao iniciar o servidor Playwright MCP: {0}", + "progress": "Iniciando os servidores do Playwright MCP.", + "question": "Os servidores do Playwright MCP não estão em execução. Você gostaria de iniciá-los agora? Isso pode instalar os servidores do Playwright MCP." + } + }, + "architectAgent": { + "mode": { + "default": "Modo Padrão", + "plan": "Plano Modo", + "simple": "Modo simples" + }, + "suggestion": { + "executePlanWithCoder": "Execute “{0}” com o Coder", + "summarizeSessionAsTaskForCoder": "Resumir esta sessão como uma tarefa para o Coder", + "updateTaskContext": "Atualizar o contexto da tarefa atual" + } + }, + "bypassHint": "Alguns agentes, como Claude Code, não requerem os modelos de linguagem Theia.", + "chatDisabledMessage": { + "featuresTitle": "Visualizações e recursos atualmente suportados:" + }, + "coderAgent": { + "mode": { + "agentNext": "Modo Agente (Próximo)", + "edit": "Modo de edição" + }, + "suggestion": { + "fixProblems": { + "content": "[Fix problems]({0}) no arquivo atual.", + "prompt": "Consulte o site {1} e corrija os problemas." + }, + "startNewChat": "Mantenha os bate-papos curtos e focados. [Inicie um novo bate-papo] ({0}) para uma nova tarefa ou [inicie um novo bate-papo com um resumo deste] ({1})." + } + }, + "commandAgent": { + "commandCallback": { + "confirmAction": "Entendi", + "label": "Comando de IA" + }, + "response": { + "customHandler": "Tente executar isso:", + "noCommand": "Desculpe, mas não consigo encontrar esse comando", + "theiaCommand": "Encontrei este comando que pode ajudar você:" + }, + "vars": { + "commandIds": { + "description": "A lista de comandos disponíveis no Theia." + } + } + }, + "configureAgent": { + "header": "Configurar um agente padrão" + }, + "continueAnyway": "Continuar mesmo assim", + "createSkillAgent": { + "mode": { + "edit": "Modo Padrão" + } + }, + "enableAI": { + "mdDescription": "Essa configuração permite que você acesse os recursos de IA mais recentes (versão Beta). \n Observe que esses recursos estão em fase beta, o que significa que podem sofrer alterações e serão aprimorados ainda mais. É importante estar ciente de que esses recursos podem gerar solicitações contínuas para os modelos de linguagem (LLMs) aos quais você fornece acesso. Isso pode gerar custos que você precisa monitorar de perto. Ao ativar essa opção, você reconhece esses riscos. \n **Observação! As configurações abaixo nesta seção só entrarão em vigor\n quando a configuração do recurso principal for ativada. Depois de ativar o recurso, você precisará configurar pelo menos um provedor de LLM abaixo. Consulte também [a documentação] (https://theia-ide.org/docs/user_ai/)**." + }, + "github": { + "configureGitHubServer": { + "canceled": "Configuração do servidor GitHub cancelada. Configure o servidor MCP do GitHub para usar esse agente.", + "no": "No, cancel", + "yes": "Sim, configure o servidor GitHub" + }, + "errorCheckingGitHubServerStatus": "Erro ao verificar o status do servidor GitHub MCP: {0}", + "startGitHubServer": { + "canceled": "Inicie o servidor GitHub MCP para usar este agente.", + "error": "Falha ao iniciar o servidor GitHub MCP: {0}", + "no": "No, cancel", + "progress": "Iniciando o servidor GitHub MCP.", + "question": "O servidor GitHub MCP está configurado, mas não está em execução. Você gostaria de iniciá-lo agora?", + "yes": "Sim, inicie o servidor" + } + }, + "githubRepoName": { + "description": "O nome do repositório atual do GitHub (por exemplo, \"eclipse-theia/theia\")" + }, + "model-selection-description": "Escolha quais modelos de linguagem grande (LLMs) são usados por cada agente de IA na [AI Configuration View] ({0}).", + "moreAgentsAvailable": { + "header": "Mais agentes estão disponíveis" + }, + "noRecommendedAgents": "Não há agentes recomendados disponíveis.", + "openSettings": "Abrir configurações de IA", + "or": "ou", + "orchestrator": { + "error": { + "noAgents": "Não há agente de bate-papo disponível para atender à solicitação. Verifique se há algum agente habilitado em sua configuração." + }, + "progressMessage": "Determinação do agente mais adequado", + "response": { + "delegatingToAgent": "Delegando para `@{0}`" + } + }, + "prompt-template-description": "Selecione variantes de prompt e personalize modelos de prompt para agentes de IA na [AI Configuration View] ({0}).", + "recommendedAgents": "Agentes recomendados:", + "skillsConfiguration": { + "label": "Competências", + "location": { + "label": "Localização" + } + }, + "toolsConfiguration": { + "confirmAlwaysAllow": { + "confirm": "Entendo, ativar aprovação automática", + "title": "Habilitar aprovação automática para “{0}”?" + }, + "confirmationMode": { + "label": "Modo de confirmação" + }, + "default": { + "label": "Modo de confirmação de ferramenta padrão:" + }, + "resetAll": "Redefinir tudo", + "resetAllConfirmDialog": { + "msg": "Tem certeza de que deseja redefinir todos os modos de confirmação da ferramenta para o padrão? Isso removerá todas as configurações personalizadas.", + "title": "Redefinir todos os modos de confirmação de ferramenta" + }, + "resetAllTooltip": "Redefinir todas as ferramentas para o padrão", + "toolOptions": { + "confirm": { + "label": "Confirmar" + } + } + }, + "variableConfiguration": { + "selectVariable": "Selecione uma variável.", + "usedByAgents": "Usado por agentes", + "variableArgs": "Argumentos de variáveis" + } + }, + "llamaFile": { + "prefs": { + "mdDescription": "Essa configuração permite que você configure e gerencie os modelos do LlamaFile no Theia IDE. \n Cada entrada requer um `nome` de fácil utilização, o `uri` do arquivo que aponta para o seu LlamaFile e a `porta` na qual ele será executado. \n Para iniciar um LlamaFile, use o comando \"Start LlamaFile\", que permite selecionar o modelo desejado. \n Se você editar uma entrada (por exemplo, alterar a porta), qualquer instância em execução será interrompida, e você precisará iniciá-la manualmente de novo. \n [Saiba mais sobre como configurar e gerenciar LlamaFiles na documentação do Theia IDE](https://theia-ide.org/docs/user_ai/#llamafile-models).", + "name": { + "description": "O nome do modelo a ser usado para esse Llamafile." + }, + "port": { + "description": "A porta a ser usada para iniciar o servidor." + }, + "title": "AI LlamaFile", + "uri": { + "description": "O uri do arquivo para o Llamafile." + } + }, + "start": "Iniciar o Llamafile", + "stop": "Parar o Llamafile" + }, + "llamafile": { + "error": { + "noConfigured": "Nenhum arquivo Llamafiles configurado.", + "noRunning": "Não há arquivos Llamafiles em execução.", + "startFailed": "Algo deu errado durante a inicialização do llamafile: {0}.\nPara obter mais informações, consulte o console.", + "stopFailed": "Algo deu errado durante a parada do llamafile: {0}.\nPara obter mais informações, consulte o console." + } + }, + "mcp": { + "error": { + "allServersRunning": "Todos os servidores MCP já estão em execução.", + "noRunningServers": "Nenhum servidor MCP em execução.", + "noServersConfigured": "Nenhum servidor MCP configurado.", + "startFailed": "Ocorreu um erro ao iniciar o servidor MCP." + }, + "info": { + "serverStarted": "Servidor MCP \"{0}\" iniciado com sucesso. Ferramentas registradas: {1}" + }, + "servers": { + "args": { + "mdDescription": "Uma matriz de argumentos para passar para o comando.", + "title": "Argumentos para o comando" + }, + "autostart": { + "mdDescription": "Iniciar automaticamente esse servidor quando o frontend for iniciado. Os servidores recém-adicionados não são iniciados automaticamente de imediato, mas na reinicialização", + "title": "Início automático" + }, + "command": { + "mdDescription": "O comando usado para iniciar o servidor MCP, por exemplo, \"uvx\" ou \"npx\".", + "title": "Comando para executar o servidor MCP" + }, + "env": { + "mdDescription": "Variáveis de ambiente opcionais a serem definidas para o servidor, como uma chave de API.", + "title": "Variáveis de ambiente" + }, + "headers": { + "mdDescription": "Cabeçalhos adicionais opcionais incluídos em cada solicitação ao servidor.", + "title": "Cabeçalhos" + }, + "mdDescription": "Configure os servidores MCP com comando, argumentos, variáveis de ambiente opcionais e inicialização automática (verdadeiro por padrão). Cada servidor é identificado por uma chave exclusiva, como \"brave-search\" ou \"filesystem\". Para iniciar um servidor, use o comando \"MCP: Start MCP Server\", que permite selecionar o servidor desejado. Para parar um servidor, use o comando \"MCP: Stop MCP Server\". Observe que o início automático só entrará em vigor depois de uma reinicialização; você precisa iniciar um servidor manualmente pela primeira vez.\nExemplo de configuração:\n```{\n \"brave-search\": {\n \"command\" (comando): \"npx\",\n \"args\": [\n \"-y\",\n \"@modelcontextprotocol/server-brave-search\"\n ],\n \"env\": {\n \"BRAVE_API_KEY\": \"YOUR_API_KEY\"\n },\n },\n \"filesystem\" (sistema de arquivos): {\n \"command\" (comando): \"npx\",\n \"args\": [\"-y\", \"@modelcontextprotocol/server-filesystem\", \"/Users/YOUR_USERNAME/Desktop\"],\n \"env\": {\n \"CUSTOM_ENV_VAR\": \"custom-value\"\n },\n \"autostart\": false\n }\n}\n```", + "serverAuthToken": { + "mdDescription": "O token de autenticação do servidor, se necessário. Ele é usado para autenticar com o servidor remoto.", + "title": "Token de autenticação" + }, + "serverAuthTokenHeader": { + "mdDescription": "O nome do cabeçalho a ser usado para o token de autenticação do servidor. Se não for fornecido, será usado \"Authorization\" com \"Bearer\".", + "title": "Nome do cabeçalho de autenticação" + }, + "serverUrl": { + "mdDescription": "O URL do servidor MCP remoto. Se fornecido, o servidor se conectará a esse URL em vez de iniciar um processo local.", + "title": "URL do servidor" + }, + "title": "Configuração de servidores MCP" + }, + "start": { + "label": "MCP: Iniciar o servidor MCP" + }, + "stop": { + "label": "MCP: Parar o servidor MCP" + } + }, + "mcpConfiguration": { + "arguments": "Argumentos: ", + "autostart": "Início automático: ", + "connectServer": "Conectar", + "connectingServer": "Conectando...", + "copiedAllList": "Copiou todas as ferramentas para a área de transferência (lista de todas as ferramentas)", + "copiedAllSingle": "Copiou todas as ferramentas para a área de transferência (fragmento de prompt único com todas as ferramentas)", + "copiedForPromptTemplate": "Copiou todas as ferramentas para a área de transferência para o modelo de prompt (fragmento de prompt único com todas as ferramentas)", + "copyAllList": "Copiar tudo (lista de todas as ferramentas)", + "copyAllSingle": "Copiar tudo para o bate-papo (fragmento de prompt único com todas as ferramentas)", + "copyForPrompt": "Ferramenta de cópia (para modelo de bate-papo ou prompt)", + "copyForPromptTemplate": "Copiar tudo para o modelo de prompt (fragmento de prompt único com todas as ferramentas)", + "environmentVariables": "Variáveis de ambiente: ", + "headers": "Cabeçalhos: ", + "noServers": "Nenhum servidor MCP configurado", + "serverAuthToken": "Token de autenticação: ", + "serverAuthTokenHeader": "Nome do cabeçalho de autenticação: ", + "serverUrl": "URL do servidor: ", + "tools": "Ferramentas: " + }, + "openai": { + "apiKey": { + "mdDescription": "Digite uma chave de API de sua conta oficial do OpenAI. **Observação:** Ao usar essa preferência, a chave da API do Open AI será armazenada em texto não criptografado no computador que estiver executando o Theia. Use a variável de ambiente `OPENAI_API_KEY` para definir a chave com segurança." + }, + "customEndpoints": { + "apiKey": { + "title": "A chave para acessar a API servida na url fornecida ou `true` para usar a chave global da API da OpenAI" + }, + "apiVersion": { + "title": "A versão para acessar a API servida na url fornecida no Azure ou `true` para usar a versão global da API OpenAI" + }, + "deployment": { + "title": "O nome da implantação para acessar a API servida no URL fornecido no Azure" + }, + "developerMessageSettings": { + "title": "Controla o tratamento das mensagens do sistema: `user`, `system` e `developer` serão usados como uma função, `mergeWithFollowingUserMessage` prefixará a mensagem do usuário seguinte com a mensagem do sistema ou converterá a mensagem do sistema em mensagem do usuário se a próxima mensagem não for uma mensagem do usuário. `skip` removerá apenas a mensagem do sistema), tendo como padrão `developer`." + }, + "enableStreaming": { + "title": "Indica se a API de streaming deve ser usada. É o \"true\" por padrão." + }, + "id": { + "title": "Um identificador exclusivo que é usado na interface do usuário para identificar o modelo personalizado" + }, + "mdDescription": "Integre modelos personalizados compatíveis com a API do OpenAI, por exemplo, por meio do `vllm`. Os atributos necessários são `model` e `url`. \n Opcionalmente, você pode \n - especificar um `id` exclusivo para identificar o modelo personalizado na interface do usuário. Se nenhum for fornecido, `model` será usado como `id`. \n - Forneça uma `apiKey` para acessar a API servida no URL fornecido. Use `true` para indicar o uso da chave de API global do OpenAI. \n - forneça uma `apiVersion` para acessar a API servida na url fornecida no Azure. Use `true` para indicar o uso da versão global da API OpenAI. \n - Defina `developerMessageSettings` como uma das opções `user`, `system`, `developer`, `mergeWithFollowingUserMessage` ou `skip` para controlar como a mensagem do desenvolvedor é incluída (onde `user`, `system` e `developer` serão usados como uma função, `mergeWithFollowingUserMessage` prefixará a mensagem do usuário seguinte com a mensagem do sistema ou converterá a mensagem do sistema em mensagem do usuário se a próxima mensagem não for uma mensagem do usuário. `skip` apenas removerá a mensagem do sistema). O padrão é `developer`. \n - especifique `supportsStructuredOutput: false` para indicar que a saída estruturada não deve ser usada. \n - especifique `enableStreaming: false` para indicar que o streaming não deve ser usado. \n Consulte a [nossa documentação] (https://theia-ide.org/docs/user_ai/#openai-compatible-models-eg-via-vllm) para obter mais informações.", + "modelId": { + "title": "ID do modelo" + }, + "supportsStructuredOutput": { + "title": "Indica se o modelo suporta saída estruturada. Por padrão, é `true`." + }, + "url": { + "title": "O ponto de extremidade compatível com a API de IA aberta onde o modelo está hospedado" + } + }, + "models": { + "description": "Modelos oficiais da OpenAI a serem usados" + }, + "useResponseApi": { + "mdDescription": "Use a API de resposta OpenAI mais recente em vez da API de conclusão de chat para modelos oficiais da OpenAI. Essa configuração se aplica somente aos modelos oficiais da OpenAI - os provedores personalizados devem configurá-la individualmente." + } + }, + "promptTemplates": { + "directories": { + "title": "Diretórios de modelos de prompts específicos do espaço de trabalho" + }, + "extensions": { + "description": "Lista de extensões de arquivos adicionais em locais de prompt que são considerados como modelos de prompt. '.prompttemplate' é sempre considerado como padrão.", + "title": "Extensões de arquivo de modelo de prompt adicionais" + }, + "files": { + "title": "Arquivos de modelo de prompt específicos do espaço de trabalho" + } + }, + "scanoss": { + "changeSet": { + "clean": "Sem correspondências", + "error": "Erro: Reexecutar", + "error-notification": "Erro de ScanOSS encontrado: {0}.", + "match": "Exibir correspondências", + "scan": "Escaneamento", + "scanning": "Digitalização..." + }, + "mode": { + "automatic": { + "description": "Habilite a verificação automática de trechos de código em exibições de bate-papo." + }, + "description": "Configure o recurso SCANOSS para analisar trechos de código em exibições de bate-papo. Isso enviará um hash de trechos de código sugeridos para o serviço SCANOSS\nhospedado pela [Software Transparency Foundation] (https://www.softwaretransparency.org/osskb) para análise.", + "manual": { + "description": "O usuário pode acionar manualmente a varredura clicando no item SCANOSS na exibição de bate-papo." + }, + "off": { + "description": "O recurso está completamente desativado." + } + }, + "snippet": { + "dialog-header": "Resultados do ScanOSS", + "errored": "SCANOSS - Erro - {0}", + "file-name-heading": "Correspondência encontrada em {0}", + "in-progress": "SCANOSS - Realização de varredura...", + "match-count": "Encontrado {0} correspondência(s)", + "matched": "SCANOSS - Encontrado {0} correspondência", + "no-match": "SCANOSS - No match", + "summary": "Resumo" + } + }, + "session-settings-dialog": { + "title": "Definir configurações de sessão", + "tooltip": "Definir configurações de sessão" + }, + "terminal": { + "agent": { + "description": "Esse agente fornece assistência para escrever e executar comandos arbitrários no terminal. Com base na solicitação do usuário, ele sugere comandos e permite que o usuário os cole e execute diretamente no terminal. Ele acessa o diretório atual, o ambiente e a saída recente do terminal da sessão de terminal para fornecer assistência com reconhecimento de contexto", + "vars": { + "cwd": { + "description": "O diretório de trabalho atual." + }, + "recentTerminalContents": { + "description": "As últimas 0 a 50 linhas recentes visíveis no terminal." + }, + "shell": { + "description": "O shell que está sendo usado, por exemplo, /usr/bin/zsh." + }, + "userRequest": { + "description": "A pergunta ou solicitação do usuário." + } + } + }, + "askAi": "Pergunte à IA", + "askTerminalCommand": "Pergunte sobre um comando de terminal...", + "hitEnterConfirm": "Pressione Enter para confirmar", + "howCanIHelp": "Como posso ajudá-lo?", + "loading": "Carregamento", + "tryAgain": "Tente novamente...", + "useArrowsAlternatives": " ou use ⇅ para mostrar alternativas..." + }, + "tokenUsage": { + "cachedInputTokens": "Tokens de entrada gravados no cache", + "cachedInputTokensTooltip": "Rastreados adicionalmente aos \"Tokens de entrada\". Geralmente mais caros do que os tokens não armazenados em cache.", + "failedToGetTokenUsageData": "Falha ao buscar dados de uso de token: {0}", + "inputTokens": "Tokens de entrada", + "label": "Uso do token", + "lastUsed": "Última utilização", + "model": "Modelo", + "noData": "Ainda não há dados de uso de tokens disponíveis.", + "note": "O uso do token é rastreado desde o início do aplicativo e não é mantido.", + "outputTokens": "Tokens de saída", + "readCachedInputTokens": "Tokens de entrada lidos do cache", + "readCachedInputTokensTooltip": "Rastreado adicionalmente ao \"Input Token\". Geralmente muito mais barato do que não armazenado em cache. Normalmente não conta para os limites de taxa.", + "total": "Total", + "totalTokens": "Total de tokens", + "totalTokensTooltip": "'Tokens de entrada' + 'Tokens de saída'" + }, + "vercelai": { + "anthropicApiKey": { + "mdDescription": "Digite uma chave de API para modelos Anthropic. **Observação:** Ao usar essa preferência, a chave da API será armazenada em texto não criptografado no computador que estiver executando o Theia. Use a variável de ambiente `ANTHROPIC_API_KEY` para definir a chave de forma segura." + }, + "customEndpoints": { + "apiKey": { + "title": "A chave para acessar a API servida na url fornecida ou `true` para usar a chave de API global" + }, + "enableStreaming": { + "title": "Indica se a API de streaming deve ser usada. `true` por padrão." + }, + "id": { + "title": "Um identificador exclusivo que é usado na interface do usuário para identificar o modelo personalizado" + }, + "mdDescription": "Integre modelos personalizados compatíveis com o Vercel AI SDK. Os atributos necessários são `model` e `url`. \n Opcionalmente, você pode \n - especificar um `id` exclusivo para identificar o modelo personalizado na interface do usuário. Se nenhum for fornecido, `model` será usado como `id`. \n - Forneça uma `apiKey` para acessar a API servida no URL fornecido. Use `true` para indicar o uso da chave de API global. \n - especifique `supportsStructuredOutput: false` para indicar que a saída estruturada não deve ser usada. \n - especifique `enableStreaming: false` para indicar que o streaming não deve ser usado. \n - especifique `provider` para indicar de qual provedor é o modelo (openai, anthropic).", + "modelId": { + "title": "ID do modelo" + }, + "supportsStructuredOutput": { + "title": "Indica se o modelo suporta saída estruturada. Por padrão, é `true`." + }, + "url": { + "title": "O ponto de extremidade da API onde o modelo está hospedado" + } + }, + "models": { + "description": "Modelos oficiais para uso com o Vercel AI SDK", + "id": { + "title": "ID do modelo" + }, + "model": { + "title": "Nome do modelo" + } + }, + "openaiApiKey": { + "mdDescription": "Digite uma chave de API para modelos OpenAI. **Observação:** Ao usar essa preferência, a chave de API será armazenada em texto não criptografado no computador que estiver executando o Theia. Use a variável de ambiente `OPENAI_API_KEY` para definir a chave de forma segura." + } + }, + "workspace": { + "coderAgent": { + "description": "Um assistente de IA integrado ao Theia IDE, projetado para auxiliar os desenvolvedores de software. Esse agente pode acessar o espaço de trabalho do usuário, obter uma lista de todos os arquivos e pastas disponíveis e recuperar seu conteúdo. Além disso, ele pode sugerir modificações de arquivos para o usuário. Portanto, ele pode ajudar o usuário com tarefas de codificação ou outras tarefas que envolvam alterações de arquivos." + }, + "considerGitignore": { + "description": "Se ativado, exclui arquivos/pastas especificados em um arquivo global .gitignore (o local esperado é a raiz do espaço de trabalho).", + "title": "Considere o .gitignore" + }, + "excludedPattern": { + "description": "Lista de padrões (glob ou regex) para arquivos/pastas a serem excluídos.", + "title": "Padrões de arquivos excluídos" + }, + "searchMaxResults": { + "description": "Número máximo de resultados de pesquisa retornados pela função de pesquisa de espaço de trabalho.", + "title": "Resultados máximos de pesquisa" + }, + "workspaceAgent": { + "description": "Um assistente de IA integrado ao Theia IDE, projetado para auxiliar os desenvolvedores de software. Esse agente pode acessar o espaço de trabalho do usuário, obter uma lista de todos os arquivos e pastas disponíveis e recuperar seu conteúdo. Ele não pode modificar arquivos. Portanto, ele pode responder a perguntas sobre o projeto atual, os arquivos do projeto e o código-fonte no espaço de trabalho, como, por exemplo, como criar o projeto, onde colocar o código-fonte, onde encontrar códigos ou configurações específicos etc." + } + } + }, + "ai-chat": { + "fileChangeSetTitle": "Alterações propostas" + }, + "ai-chat-ui": { + "initiate-session-task-context": "Contexto da tarefa: Iniciar sessão", + "open-current-session-summary": "Resumo da sessão atual aberta", + "open-settings-tooltip": "Abra as configurações de IA...", + "scroll-lock": "Bloquear rolagem", + "scroll-unlock": "Desbloquear pergaminho", + "session-settings": "Definir configurações de sessão", + "showChats": "Mostrar bate-papos...", + "summarize-current-session": "Resumir a sessão atual" + }, + "ai-claude-code": { + "open-config": "Configuração do código Open Claude", + "open-memory": "Abrir a memória do código Claude (CLAUDE.MD)" + }, + "ai-core": { + "agentCompletionMessage": "O agente \"{0}\" concluiu sua tarefa.", + "agentCompletionTitle": "Agente \"{0}\" Tarefa concluída", + "agentCompletionWithTask": "O agente \"{0}\" concluiu a tarefa: {1}" + }, + "ai-editor": { + "contextMenu": "Pergunte à IA", + "sendToChat": "Enviar para o AI Chat" + }, + "ai-ide": { + "addressGhReviewCommand": { + "argumentHint": "", + "description": "Comentários de revisão de endereço em uma solicitação pull do GitHub" + }, + "fixGhTicketCommand": { + "argumentHint": "", + "description": "Analisar um ticket do GitHub e implementar a solução" + }, + "open-agent-settings-tooltip": "Abrir as configurações do agente...", + "rememberCommand": { + "argumentHint": "[dica-tópico]", + "description": "Extraia tópicos da conversa e atualize as informações do projeto" + }, + "ticketCommand": { + "argumentHint": "", + "description": "Analise um ticket do GitHub e crie um plano de implementação" + }, + "todoTool": { + "noTasks": "Sem tarefas" + }, + "withAppTesterCommand": { + "description": "Delegue os testes ao agente AppTester (requer modo agente)" + } + }, + "ai-mcp": { + "blockedServersLabel": "Servidores MCP (inicialização automática bloqueada)" + }, + "ai-terminal": { + "cancelExecution": "Cancelar execução do comando", + "canceling": "Cancelando...", + "confirmExecution": "Confirmar comando do Shell", + "denialReason": "Motivo", + "executionCanceled": "Cancelado", + "executionDenied": "Negado", + "executionDeniedWithReason": "Negado com razão", + "noOutput": "Sem saída", + "partialOutput": "Saída parcial", + "timeout": "Tempo limite", + "workingDirectory": "Diretório de trabalho" + }, + "callhierarchy": { + "noCallers": "Nenhum chamador foi detectado.", + "open": "Hierarquia de Chamadas Abertas" + }, + "chat": { + "taskContextVariable": { + "args": { + "contextId": { + "description": "O ID do contexto da tarefa a ser recuperado ou uma sessão de bate-papo a ser resumida." + } + }, + "description": "Fornece informações de contexto para uma tarefa, por exemplo, o plano para concluir uma tarefa ou um resumo de sessões anteriores", + "label": "Contexto da tarefa" + } + }, + "collaboration": { + "collaborate": "Colaborar", + "collaboration": "Colaboração", + "collaborationWorkspace": "Espaço de trabalho de colaboração", + "connected": "Conectado", + "connectedSession": "Conectado a uma sessão de colaboração", + "copiedInvitation": "Código do convite copiado para a área de transferência.", + "copyAgain": "Copiar novamente", + "createRoom": "Criar nova sessão de colaboração", + "creatingRoom": "Criação de sessão", + "end": "Encerrar a sessão de colaboração", + "endDetail": "Encerrar a sessão, interromper o compartilhamento de conteúdo e revogar o acesso de outras pessoas.", + "enterCode": "Digite o código da sessão de colaboração", + "failedCreate": "Falha ao criar a sala: {0}", + "failedJoin": "Falha ao entrar na sala: {0}", + "fieldRequired": "O campo {0} é obrigatório. Login abortado.", + "invite": "Convidar outras pessoas", + "inviteDetail": "Copie o código do convite para compartilhá-lo com outras pessoas e participar da sessão.", + "joinRoom": "Participe da sessão de colaboração", + "joiningRoom": "Sessão de ingresso", + "leave": "Sair da sessão de colaboração", + "leaveDetail": "Desconecte-se da sessão de colaboração atual e feche o espaço de trabalho.", + "loginFailed": "Falha no login.", + "loginSuccessful": "Login bem-sucedido.", + "noAuth": "Nenhum método de autenticação fornecido pelo servidor.", + "optional": "opcional", + "selectAuth": "Selecione o método de autenticação", + "selectCollaboration": "Selecione a opção de colaboração", + "serverUrl": "URL do servidor", + "serverUrlDescription": "URL da instância do Open Collaboration Tools Server para sessões de colaboração ao vivo", + "sharedSession": "Compartilhou uma sessão de colaboração", + "startSession": "Iniciar ou participar de uma sessão de colaboração", + "userWantsToJoin": "O usuário '{0}' deseja participar da sala de colaboração", + "whatToDo": "O que você gostaria de fazer com outros colaboradores?" + }, + "core": { + "about": { + "compatibility": "{0} Compatibilidade", + "defaultApi": "Padrão {0} API", + "listOfExtensions": "Lista de extensões" + }, + "common": { + "closeAll": "Fechar todas as abas", + "closeAllTabMain": "Fechar todas as abas na área principal", + "closeOtherTabMain": "Fechar outras guias na área principal", + "closeOthers": "Fechar outras abas", + "closeRight": "Fechar abas para a direita", + "closeTab": "Fechar a aba", + "closeTabMain": "Aba fechar na área principal", + "collapseAllTabs": "Colapso de todos os painéis laterais", + "collapseBottomPanel": "Alternar o painel inferior", + "collapseLeftPanel": "Alternar painel esquerdo", + "collapseRightPanel": "Alternar painel direito", + "collapseTab": "Painel lateral de colapso", + "showNextTabGroup": "Mudar para o grupo Next Tab", + "showNextTabInGroup": "Mudar para a próxima guia no grupo", + "showPreviousTabGroup": "Mudar para o grupo Previous Tab", + "showPreviousTabInGroup": "Mudar para a guia Anterior em Grupo", + "toggleMaximized": "Alternar ao máximo" + }, + "copyInfo": "Abra um arquivo primeiro para copiar seu caminho", + "copyWarn": "Use o comando ou atalho de cópia do navegador.", + "cutWarn": "Use o comando de corte ou o atalho do navegador.", + "enhancedPreview": { + "classic": "Exibir uma visualização simples da guia com informações básicas.", + "enhanced": "Exibir uma visualização aprimorada da guia com informações adicionais.", + "visual": "Exibe uma prévia visual da guia." + }, + "file": { + "browse": "Navegue" + }, + "highlightModifiedTabs": "Controla se uma borda superior é desenhada ou não nas abas do editor modificadas (sujas).", + "keybinding": { + "duplicateModifierError": "Não é possível analisar a vinculação de teclas {0} Modificadores duplicados", + "metaError": "Não é possível analisar a vinculação de teclas {0} meta é apenas para OSX", + "unrecognizedKeyError": "Chave não reconhecida {0} em {1}" + }, + "keybindingStatus": "{0} foi pressionado, esperando por mais teclas", + "keyboard": { + "choose": "Escolha o Layout do Teclado", + "chooseLayout": "Escolha um layout de teclado", + "current": "(atual: {0})", + "currentLayout": " - layout atual", + "mac": "Teclados Mac", + "pc": "Teclados de PC", + "tryDetect": "Tente detectar o layout do teclado a partir das informações do navegador e pressione as teclas." + }, + "navigator": { + "clipboardWarn": "O acesso à área de transferência foi negado. Verifique a permissão de seu navegador.", + "clipboardWarnFirefox": "A API da área de transferência não está disponível. Ela pode ser ativada pela preferência '{0}' na página '{1}'. Em seguida, recarregue o Theia. Observe que isso permitirá que o FireFox obtenha acesso total à área de transferência do sistema." + }, + "offline": "Offline", + "pasteWarn": "Use o comando de colar ou o atalho do navegador.", + "quitMessage": "Quaisquer mudanças não salvas não serão salvas.", + "resetWorkbenchLayout": "Restabelecer o layout do Workbench", + "searchbox": { + "close": "Fechado (Escape)", + "next": "Próximo (Abaixo)", + "previous": "Anterior (Para cima)", + "showAll": "Mostrar todos os itens", + "showOnlyMatching": "Mostrar apenas itens correspondentes" + }, + "secondaryWindow": { + "alwaysOnTop": "Quando ativada, a janela secundária fica acima de todas as outras janelas, inclusive as de aplicativos diferentes.", + "description": "Define a posição inicial e o tamanho da janela secundária extraída.", + "fullSize": "A posição e o tamanho do widget extraído serão os mesmos do aplicativo Theia em execução.", + "halfWidth": "A posição e o tamanho do widget extraído terão a metade da largura do aplicativo Theia em execução.", + "originalSize": "A posição e o tamanho do widget extraído serão os mesmos do widget original." + }, + "severity": { + "log": "Registro" + }, + "silentNotifications": "Controla se devem ser suprimidas as popups de notificação.", + "tabDefaultSize": "Especifica o tamanho padrão das guias.", + "tabMaximize": "Controla se é necessário maximizar as abas com duplo clique.", + "tabMinimumSize": "Especifica o tamanho mínimo das guias.", + "tabShrinkToFit": "Reduzir as guias para que se ajustem ao espaço disponível.", + "window": { + "tabCloseIconPlacement": { + "description": "Coloque os ícones de fechamento nos títulos das guias no início ou no final da guia. O padrão é o final em todas as plataformas.", + "end": "Coloque o ícone de fechamento no final do rótulo. Nos idiomas da esquerda para a direita, esse é o lado direito da guia.", + "start": "Coloque o ícone de fechamento no início do rótulo. Nos idiomas da esquerda para a direita, esse é o lado esquerdo da guia." + } + }, + "window.menuBarVisibility": "O menu é exibido como um botão compacto na barra lateral. Este valor é ignorado quando{0}é {1}." + }, + "debug": { + "TheiaIDE": "Theia IDE", + "addConfigurationPlaceholder": "Selecione a raiz do espaço de trabalho para adicionar configuração a", + "breakpoint": "ponto de interrupção", + "cannotRunToThisLocation": "Não foi possível executar o thread atual no local especificado.", + "compound-cycle": "A configuração de lançamento '{0}' contém um ciclo consigo mesmo", + "conditionalBreakpoint": "Ponto de parada condicional", + "conditionalBreakpointsNotSupported": "Pontos de interrupção condicionais não suportados por esse tipo de depuração", + "confirmRunToShiftedPosition_msg": "A posição de destino será deslocada para Ln {0}, Col {1}. Como funciona?", + "confirmRunToShiftedPosition_title": "Não é possível executar o thread atual exatamente no local especificado", + "consoleFilter": "Filtro (por exemplo, texto, !excluir)", + "consoleFilterAriaLabel": "Filtrar saída do console de depuração", + "consoleSessionSelectorTooltip": "Alterne entre sessões de depuração. Cada sessão de depuração tem sua própria saída de console.", + "consoleSeverityTooltip": "Filtre a saída do console por nível de gravidade. Apenas as mensagens com a gravidade selecionada serão exibidas.", + "continueAll": "Continuar Todos", + "copyExpressionValue": "Valor de Expressão de Cópia", + "couldNotRunTask": "Não foi possível executar a tarefa '{0}'.", + "dataBreakpoint": "ponto de interrupção de dados", + "debugConfiguration": "Configuração de depuração", + "debugSessionInitializationFailed": "Falha na inicialização da sessão de depuração. Consulte o console para obter detalhes.", + "debugSessionTypeNotSupported": "Não há suporte para o tipo de sessão de depuração \"{0}\".", + "debugToolbarMenu": "Menu da barra de ferramentas de depuração", + "debugVariableInput": "Conjunto {0} Valor", + "disableSelectedBreakpoints": "Desativar pontos de parada selecionados", + "disabledBreakpoint": "Desativado {0}", + "enableSelectedBreakpoints": "Habilitar pontos de parada selecionados", + "entry": "entrada", + "errorStartingDebugSession": "Ocorreu um erro ao iniciar a sessão de depuração, verifique os registros para obter mais detalhes.", + "exception": "exceção", + "functionBreakpoint": "ponto de interrupção da função", + "goto": "goto", + "htiConditionalBreakpointsNotSupported": "Atingir pontos de interrupção condicionais não suportados por esse tipo de depuração", + "instruction-breakpoint": "Ponto de Interrupção da Instrução", + "instructionBreakpoint": "ponto de parada de instrução", + "logpointsNotSupported": "Pontos de registro não suportados por esse tipo de depuração", + "missingConfiguration": "A configuração dinâmica '{0}:{1}' está ausente ou não é aplicável", + "pause": "pausa", + "pauseAll": "Pausa Todos", + "reveal": "Revelar", + "step": "etapa", + "taskTerminatedBySignal": "Tarefa '{0}' encerrada pelo sinal {1}.", + "taskTerminatedForUnknownReason": "Tarefa '{0}' encerrada por motivo desconhecido.", + "taskTerminatedWithExitCode": "A tarefa '{0}' foi encerrada com o código de saída {1}.", + "threads": "Tópicos", + "toggleTracing": "Habilitar/desabilitar as comunicações de rastreamento com adaptadores de depuração", + "unknownSession": "Sessão desconhecida", + "unverifiedBreakpoint": "Não verificado {0}" + }, + "editor": { + "diffEditor.wordWrap2": "As linhas serão quebradas de acordo com a configuração `#editor.wordWrap#`.", + "dirtyEncoding": "O arquivo está sujo. Por favor, salve-o primeiro antes de reabri-lo com outra codificação.", + "editor.bracketPairColorization.enabled": "Controla se a colorização de pares de colchetes está ativada ou não. Use `#workbench.colorCustomizations#` para substituir as cores de destaque dos colchetes.", + "editor.codeActions.triggerOnFocusChange": "Ativa o acionamento de `#editor.codeActionsOnSave#` quando `#files.autoSave#` é definido como `afterDelay`. As ações de código devem ser definidas como `always` para serem acionadas para mudanças de janela e de foco.", + "editor.detectIndentation": "Controla se `#editor.tabSize#` e `#editor.insertSpaces#` serão detectados automaticamente quando um arquivo for aberto com base no conteúdo do arquivo.", + "editor.experimental.preferTreeSitter": "Controla se a análise do Tree Sitter deve ser ativada para idiomas específicos. Isso terá precedência sobre `editor.experimental.treeSitterTelemetry` para os idiomas especificados.", + "editor.inlayHints.enabled1": "Dicas de Inlay estão mostrando por padrão e se escondem ao segurar `Ctrl+Alt`.", + "editor.inlayHints.enabled2": "Dicas de Inlay são ocultadas por padrão e mostram quando se segura `Ctrl+Alt`.", + "editor.inlayHints.fontFamily": "Controla a família de fontes das dicas de inlay no editor. Quando definido como vazio, a `#editor.fontFamily#` é usada.", + "editor.inlayHints.fontSize": "Controla o tamanho da fonte das dicas de inlay no editor. Por padrão, o `#editor.fontSize#` é usado quando o valor configurado é menor que `5` ou maior que o tamanho da fonte do editor.", + "editor.inlineSuggest.edits.experimental.enabled": "Controla se as edições experimentais devem ser ativadas nas sugestões em linha.", + "editor.inlineSuggest.edits.experimental.onlyShowWhenCloseToCursor": "Controla se as sugestões em linha devem ser mostradas somente quando o cursor estiver próximo da sugestão.", + "editor.inlineSuggest.edits.experimental.useInterleavedLinesDiff": "Controla se o diff de linhas intercaladas experimentais deve ser ativado em sugestões em linha.", + "editor.inlineSuggest.edits.experimental.useMixedLinesDiff": "Controla se as edições experimentais devem ser ativadas nas sugestões em linha.", + "editor.insertSpaces": "Inserir espaços ao pressionar `Tab`. Essa configuração é substituída com base no conteúdo do arquivo quando `#editor.detectIndentation#` está ativado.", + "editor.quickSuggestions": "Controla se as sugestões devem aparecer automaticamente durante a digitação. Isto pode ser controlado para digitação de comentários, strings, e outros códigos. A sugestão rápida pode ser configurada para aparecer como texto fantasma ou com o widget de sugestão. Esteja ciente também do '#editor.suggestOnTriggerCharacters#'-setting que controla se as sugestões são acionadas por caracteres especiais.", + "editor.suggestFontSize": "Tamanho da fonte para o widget de sugestão. Quando definido como `0`, o valor de `#editor.fontSize#` é usado.", + "editor.suggestLineHeight": "Altura da linha para o widget de sugestão. Quando definido como `0`, o valor de `#editor.lineHeight#` é usado. O valor mínimo é 8.", + "editor.tabSize": "O número de espaços a que uma tabulação é igual. Essa configuração é substituída com base no conteúdo do arquivo quando `#editor.detectIndentation#` está ativado.", + "formatOnSaveTimeout": "Timeout em milissegundos, após o qual a formatação que é executada em arquivo salvo é cancelada.", + "persistClosedEditors": "Controla se deve persistir o histórico do editor fechado para o espaço de trabalho através de recargas de janela.", + "showAllEditors": "Mostrar todos os editores abertos", + "splitHorizontal": "Editor dividido Horizontal", + "splitVertical": "Split Editor Vertical", + "toggleStickyScroll": "Alternar Rolagem Autoadesiva" + }, + "external-terminal": { + "cwd": "Selecione o diretório de trabalho atual para o novo terminal externo" + }, + "file-search": { + "toggleIgnoredFiles": " (Pressione {0} para mostrar/ocultar arquivos ignorados)" + }, + "fileDialog": { + "showHidden": "Mostrar arquivos ocultos" + }, + "fileSystem": { + "fileResource": { + "overWriteBody": "Você quer sobrescrever as mudanças feitas no '{0}' no sistema de arquivo?" + } + }, + "filesystem": { + "copiedToClipboard": "Copiou o link de download para a área de transferência.", + "copyDownloadLink": "Link para download de cópias", + "dialog": { + "initialLocation": "Ir para o local inicial", + "multipleItemMessage": "Você pode selecionar apenas um item", + "navigateBack": "Navegar para trás", + "navigateForward": "Navegar em frente", + "navigateUp": "Navegar para cima de um diretório" + }, + "fileResource": { + "binaryFileQuery": "A sua abertura pode levar algum tempo e pode tornar a IDE insensível. Você quer abrir '{0}' de qualquer maneira?", + "binaryTitle": "O arquivo ou é binário ou usa uma codificação de texto não suportada.", + "largeFileTitle": "O arquivo é muito grande ({0}).", + "overwriteTitle": "O arquivo '{0}' foi alterado no sistema de arquivo." + }, + "filesExclude": "Configurar padrões globais para excluir arquivos e pastas. Por exemplo, o explorador de arquivos decide quais arquivos e pastas mostrar ou ocultar com base nesta configuração.", + "format": "Formato:", + "maxConcurrentUploads": "Número máximo de arquivos simultâneos a serem carregados ao fazer upload de vários arquivos. 0 significa que todos os arquivos serão carregados ao mesmo tempo.", + "maxFileSizeMB": "Controla o tamanho máximo de arquivo em MB que é possível abrir.", + "prepareDownload": "Preparando o download...", + "prepareDownloadLink": "Preparando o link para download...", + "processedOutOf": "Processado {0} de {1}", + "replaceTitle": "Substituir arquivo", + "uploadFailed": "Ocorreu um erro ao fazer o upload de um arquivo. {0}", + "uploadFiles": "Carregar arquivos...", + "uploadedOutOf": "Carregado {0} de {1}" + }, + "getting-started": { + "ai": { + "header": "O suporte à IA no IDE Theia está disponível (versão beta)!", + "openAIChatView": "Abra agora a Visualização do Chat com IA para saber como começar!" + }, + "apiComparator": "{0} Compatibilidade API", + "newExtension": "Construindo uma nova extensão", + "newPlugin": "Construindo um Novo Plugin", + "startup-editor": { + "welcomePage": "Abra a página de boas-vindas, com conteúdo para ajudar a começar a usar o {0} e as extensões." + }, + "telemetry": "Uso de dados e telemetria" + }, + "git": { + "aFewSecondsAgo": "alguns segundos atrás", + "addSignedOff": "Adicionar Signed-off-by", + "added": "Adicionado", + "amendReuseMessage": "Para reutilizar a última mensagem de compromisso, pressione 'Enter' ou 'Escape' para cancelar.", + "amendRewrite": "Reescrever mensagem de compromisso anterior. Pressione 'Enter' para confirmar ou 'Escape' para cancelar.", + "checkoutCreateLocalBranchWithName": "Criar uma nova filial local com o nome: {0}. Pressione 'Enter' para confirmar ou 'Escape' para cancelar.", + "checkoutProvideBranchName": "Por favor, forneça um nome de filial.", + "checkoutSelectRef": "Selecione um árbitro para fazer o checkout ou crie uma nova filial local:", + "cloneQuickInputLabel": "Favor fornecer um local de repositório Git. Pressione 'Enter' para confirmar ou 'Escape' para cancelar.", + "cloneRepository": "Clonar o repositório Git: {0}. Pressione 'Enter' para confirmar ou 'Escape' para cancelar.", + "compareWith": "Comparar com...", + "compareWithBranchOrTag": "Escolha uma filial ou etiqueta para comparar com a filial atualmente ativa {0}:", + "conflicted": "Conflito", + "copied": "Copiado", + "diff": "Diff", + "dirtyDiffLinesLimit": "Não mostrar decorações difusas sujas, se a contagem de linhas do editor exceder este limite.", + "dropStashMessage": "Armazenamento removido com sucesso.", + "editorDecorationsEnabled": "Mostrar decorações de git no editor.", + "fetchPickRemote": "Escolha um controle remoto para ir buscar:", + "gitDecorationsColors": "Use a decoração colorida no navegador.", + "mergeEditor": { + "currentSideTitle": "Atual", + "incomingSideTitle": "Chegando" + }, + "mergeQuickPickPlaceholder": "Escolha uma filial para fundir-se na filial atualmente ativa {0}:", + "missingUserInfo": "Certifique-se de configurar seu 'user.name' e 'user.email' em 'git'.", + "noHistoryForError": "Não há histórico disponível para {0}", + "noPreviousCommit": "Nenhum compromisso anterior de emendar", + "noRepositoriesSelected": "Não foram selecionados repositórios.", + "prepositionIn": "em", + "renamed": "Renomeado", + "repositoryNotInitialized": "O Repositório {0} ainda não foi inicializado.", + "stashChanges": "Mudanças de estoque. Pressione 'Enter' para confirmar ou 'Escape' para cancelar.", + "stashChangesWithMessage": "Mudanças de estoque com mensagem: {0}. Pressione 'Enter' para confirmar ou 'Escape' para cancelar.", + "tabTitleIndex": "{0} (índice)", + "tabTitleWorkingTree": "{0} (Árvore de trabalho)", + "toggleBlameAnnotations": "Troca de anotações de culpa", + "unstaged": "Não encenado" + }, + "keybinding-schema-updater": { + "deprecation": "Utilize a cláusula `when` em seu lugar." + }, + "keymaps": { + "addKeybindingTitle": "Adicionar vinculação de teclas para {0}", + "editKeybinding": "Editar vinculação de teclas...", + "editKeybindingTitle": "Editar Keybinding para {0}", + "editWhenExpression": "Editar quando a expressão...", + "editWhenExpressionTitle": "Editar quando a expressão para {0}", + "keybinding": { + "copy": "Copiar vinculação de teclas", + "copyCommandId": "Copiar ID do comando de vinculação de teclas", + "copyCommandTitle": "Título do comando Copy Keybinding", + "edit": "Editar vinculação de teclas...", + "editWhenExpression": "Editar vinculação de teclas quando a expressão..." + }, + "keybindingCollidesValidation": "a chave de encadernação colide atualmente", + "requiredKeybindingValidation": "valor vinculante é necessário", + "resetKeybindingConfirmation": "Você realmente quer redefinir esta ligação de chave para seu valor padrão?", + "resetKeybindingTitle": "Redefinir a encadernação para {0}", + "resetMultipleKeybindingsWarning": "Se existirem múltiplas ligações de teclas para este comando, todas elas serão reiniciadas." + }, + "localize": { + "offlineTooltip": "Não pode ser conectado ao backend." + }, + "markers": { + "clearAll": "Limpar tudo", + "noProblems": "Até agora não foram detectados problemas no espaço de trabalho.", + "tabbarDecorationsEnabled": "Mostrar os decoradores de problemas (marcadores de diagnóstico) nas barras de tabulação." + }, + "memory-inspector": { + "addressTooltip": "Localização da memória a exibir, um endereço ou expressão avaliando para um endereço", + "ascii": "ASCII", + "binary": "Binário", + "byteSize": "Tamanho do byte", + "bytesPerGroup": "Bytes Por Grupo", + "closeSettings": "Fechar configurações", + "columns": "Colunas", + "command": { + "createNewMemory": "Criar um novo inspetor de memória", + "createNewRegisterView": "Criar nova visão de registro", + "followPointer": "Siga o Ponteiro", + "followPointerMemory": "Siga o Pointer in Memory Inspector", + "resetValue": "Valor de reinicialização", + "showRegister": "Mostrar Registro no Inspetor de Memória", + "viewVariable": "Mostrar Variable in Memory Inspector" + }, + "data": "Dados", + "decimal": "Decimal", + "diff": { + "label": "Dif: {0}" + }, + "diff-widget": { + "offset-label": "{0} Offset", + "offset-title": "Bytes para compensar a memória de {0}" + }, + "editable": { + "apply": "Aplicar alterações", + "clear": "Mudanças claras" + }, + "endianness": "Endianness", + "extraColumn": "Coluna Extra", + "groupsPerRow": "Grupos por fila", + "hexadecimal": "Hexadecimal", + "length": "Comprimento", + "lengthTooltip": "Número de bytes a serem buscados, em decimal ou hexadecimal", + "memory": { + "addressField": { + "memoryReadError": "Digite um endereço ou expressão no campo Localização." + }, + "freeze": "Vista de memória congelada", + "hideSettings": "Ocultar Painel de Ajustes", + "readError": { + "bounds": "Os limites de memória excedidos, o resultado será truncado.", + "noContents": "Nenhum conteúdo de memória disponível atualmente." + }, + "readLength": { + "memoryReadError": "Digite um comprimento (número decimal ou hexadecimal) no campo Comprimento." + }, + "showSettings": "Mostrar Painel de Ajustes", + "unfreeze": "Vista da memória do descongelamento", + "userError": "Houve um erro na memória de busca." + }, + "memoryCategory": "Inspetor de memória", + "memoryInspector": "Inspetor de memória", + "memoryTitle": "Memória", + "octal": "Octal", + "offset": "Offset", + "offsetTooltip": "Offset a ser adicionado ao local atual da memória, durante a navegação", + "provider": { + "localsError": "Não é possível ler as variáveis locais. Não há sessão de depuração ativa.", + "readError": "Não é possível ler a memória. Não há sessão de depuração ativa.", + "writeError": "Não é possível escrever memória. Não há sessão de depuração ativa." + }, + "register": "Registre-se", + "register-widget": { + "filter-placeholder": "Filtro (começa com)" + }, + "registerReadError": "Havia um registro de busca de erros.", + "registers": "Registros", + "toggleComparisonWidgetVisibility": "Visibilidade do widget de comparação de alternância", + "utils": { + "afterBytes": "Você deve carregar memória em ambos os widgets que gostaria de comparar. {0} não tem memória carregada.", + "bytesMessage": "Você deve carregar memória em ambos os widgets que gostaria de comparar. {0} não tem memória carregada." + } + }, + "messages": { + "notificationTimeout": "Notificações informativas serão ocultadas após este tempo limite.", + "toggleNotifications": "Notificações de alternância" + }, + "mini-browser": { + "typeUrl": "Digite uma URL" + }, + "monaco": { + "noSymbolsMatching": "Sem símbolos correspondentes", + "typeToSearchForSymbols": "Digite para procurar por símbolos" + }, + "navigator": { + "autoReveal": "Auto Revelação", + "clipboardWarn": "O acesso à área de transferência foi negado. Verifique a permissão de seu navegador.", + "clipboardWarnFirefox": "A API da área de transferência não está disponível. Ela pode ser ativada pela preferência '{0}' na página '{1}'. Em seguida, recarregue o Theia. Observe que isso permitirá que o FireFox obtenha acesso total à área de transferência do sistema.", + "openWithSystemEditor": "Abrir com o Editor do Sistema", + "refresh": "Refrescar no Explorer", + "reveal": "Revelar no Explorer", + "systemEditor": "Editor de sistema", + "toggleHiddenFiles": "Alternar arquivos ocultos" + }, + "output": { + "clearOutputChannel": "Canal de saída livre...", + "closeOutputChannel": "Fechar canal de saída...", + "hiddenChannels": "Canais ocultos", + "hideOutputChannel": "Esconder canal de saída...", + "maxChannelHistory": "O número máximo de entradas em um canal de saída.", + "outputChannels": "Canais de saída", + "showOutputChannel": "Mostrar canal de saída..." + }, + "plugin": { + "blockNewTab": "Seu navegador impediu a abertura de uma nova aba" + }, + "plugin-dev": { + "alreadyRunning": "A instância anfitriã já está funcionando.", + "debugInstance": "Instância de depuração", + "debugMode": "Usando a inspeção ou a inspeção-brk para o Node.js debug", + "debugPorts": { + "debugPort": "Porta a ser usada para a depuração do Node.js deste servidor" + }, + "devHost": "Anfitrião do desenvolvimento", + "failed": "Falha na execução da instância de plugin hospedado: {0}", + "hostedPlugin": "Plugin hospedado", + "hostedPluginRunning": "Plugin hospedado: Funcionamento", + "hostedPluginStarting": "Plugin hospedado: Início", + "hostedPluginStopped": "Plugin hospedado: Parado", + "hostedPluginWatching": "Plugin hospedado: Observando", + "instanceTerminated": "{0} foi encerrado", + "launchOutFiles": "O conjunto de padrões globais para localização de arquivos JavaScript gerados (`${pluginPath}` será substituído pelo caminho real do plugin).", + "noValidPlugin": "A pasta especificada não contém um plugin válido.", + "notRunning": "A instância hospedada não está funcionando.", + "pluginFolder": "A pasta de plugins está definida para: {0}", + "preventedNewTab": "Seu navegador impediu a abertura de uma nova aba", + "restartInstance": "Reinício da instância", + "running": "A instância anfitriã está funcionando em:", + "selectPath": "Selecione o caminho", + "startInstance": "Instância inicial", + "starting": "Iniciando o servidor de instância hospedado ...", + "stopInstance": "Parada de instância", + "unknownTerminated": "A instância foi encerrada", + "watchMode": "Executar o watcher no plugin em desenvolvimento" + }, + "plugin-ext": { + "authentication-main": { + "loginTitle": "Login", + "signedOut": "Sessão encerrada com sucesso." + }, + "plugins": "Plugins", + "webviewTrace": "Controla o rastreamento da comunicação com visualizações na web.", + "webviewWarnIfUnsecure": "Adverte os usuários de que as visualizações na web são atualmente implantadas de forma insegura." + }, + "preferences": { + "ai-features": "Recursos de IA", + "hostedPlugin": "Plug-in hospedado", + "toolbar": "Barra de ferramentas" + }, + "preview": { + "openByDefault": "Abrir a visualização em vez do editor por padrão." + }, + "property-view": { + "created": "Criado em", + "directory": "Diretório", + "lastModified": "Última modificação", + "location": "Localização", + "noProperties": "Não há propriedades disponíveis.", + "properties": "Imóveis", + "symbolicLink": "Elo simbólico" + }, + "remote": { + "dev-container": { + "connect": "Reabrir no contêiner", + "noDevcontainerFiles": "Nenhum arquivo devcontainer.json foi encontrado no espaço de trabalho. Verifique se você tem um diretório .devcontainer com um arquivo devcontainer.json.", + "selectDevcontainer": "Selecione um arquivo devcontainer.json" + }, + "ssh": { + "connect": "Conectar a janela atual ao host...", + "connectToConfigHost": "Conectar a janela atual ao host no arquivo de configuração...", + "enterHost": "Digite o nome do host SSH", + "enterUser": "Digite o nome de usuário SSH", + "failure": "Não foi possível abrir a conexão SSH com o controle remoto.", + "hostPlaceHolder": "Por exemplo, hello@example.com", + "needsHost": "Digite um nome de host.", + "needsUser": "Digite um nome de usuário.", + "userPlaceHolder": "Por exemplo, olá" + }, + "sshNoConfigPath": "Nenhum caminho de configuração SSH foi encontrado.", + "wsl": { + "connectToWsl": "Conectar-se à WSL", + "connectToWslUsingDistro": "Conecte-se à WSL usando o Distro...", + "noWslDistroFound": "Nenhuma distribuição WSL foi encontrada. Instale primeiro uma distribuição WSL.", + "reopenInWsl": "Reabrir a pasta no WSL", + "selectWSLDistro": "Selecione uma distribuição WSL" + } + }, + "scm": { + "amend": "Emenda", + "amendHeadCommit": "Compromisso HEAD", + "amendLastCommit": "Emendar o último compromisso", + "changeRepository": "Repositório de Mudanças...", + "config.untrackedChanges": "Controla como se comportam as mudanças não controladas.", + "config.untrackedChanges.hidden": "oculto", + "config.untrackedChanges.mixed": "misto", + "config.untrackedChanges.separate": "separado", + "dirtyDiff": { + "close": "Fechar Alterar Vista panorâmica" + }, + "history": "História", + "mergeEditor": { + "resetConfirmationTitle": "Você realmente deseja redefinir o resultado da mesclagem nesse editor?" + }, + "noRepositoryFound": "Não foi encontrado nenhum repositório", + "unamend": "Unamend", + "unamendCommit": "Compromisso sem alterações" + }, + "search-in-workspace": { + "includeIgnoredFiles": "Incluir Arquivos Ignorados", + "noFolderSpecified": "Você não abriu ou especificou uma pasta. Somente os arquivos abertos são pesquisados no momento.", + "resultSubset": "Este é apenas um subconjunto de todos os resultados. Use um termo de busca mais específico para restringir a lista de resultados.", + "searchOnEditorModification": "Pesquise o editor ativo quando modificado." + }, + "secondary-window": { + "extract-widget": "Mover vista para a janela secundária" + }, + "shell-area": { + "secondary": "Janela Secundária" + }, + "task": { + "attachTask": "Anexar Tarefa...", + "circularReferenceDetected": "Referência circular detectada: {0} --> {1}", + "clearHistory": "Histórico claro", + "errorKillingTask": "Erro ao encerrar a tarefa '{0}': {1}", + "errorLaunchingTask": "Erro ao iniciar a tarefa '{0}': {1}", + "invalidTaskConfigs": "Foram encontradas configurações de tarefas inválidas. Abra o arquivo tasks.json e encontre os detalhes na visualização Problemas.", + "neverScanTaskOutput": "Nunca examine a saída da tarefa", + "noTaskToRun": "Nenhuma tarefa a ser executada foi encontrada. Configurar tarefas...", + "noTasksFound": "Nenhuma tarefa encontrada", + "notEnoughDataInDependsOn": "As informações fornecidas no \"dependsOn\" não são suficientes para corresponder à tarefa correta!", + "schema": { + "commandOptions": { + "cwd": "O diretório de trabalho atual do programa ou script executado. Se omitido, será usada a raiz do espaço de trabalho atual do Theia." + }, + "presentation": { + "panel": { + "dedicated": "O terminal é dedicado a uma tarefa específica. Se essa tarefa for executada novamente, o terminal será reutilizado. No entanto, a saída de uma tarefa diferente é apresentada em um terminal diferente.", + "new": "Cada execução dessa tarefa está usando um novo terminal limpo.", + "shared": "O terminal é compartilhado e a saída de outras execuções de tarefas é adicionada ao mesmo terminal." + }, + "showReuseMessage": "Controla se a mensagem \"O terminal será reutilizado por tarefas\" deve ser exibida." + }, + "problemMatcherObject": { + "owner": "O proprietário do problema dentro da Theia. Pode ser omitido se a base for especificada. O padrão é \"external\" se for omitido e a base não for especificada." + } + }, + "taskAlreadyRunningInTerminal": "A tarefa já está sendo executada no terminal", + "taskExitedWithCode": "A tarefa '{0}' foi encerrada com o código {1}.", + "taskTerminalTitle": "Tarefa: {0}", + "taskTerminatedBySignal": "A tarefa '{0}' foi encerrada pelo sinal {1}.", + "terminalWillBeReusedByTasks": "O terminal será reutilizado pelas tarefas." + }, + "terminal": { + "defaultProfile": "O perfil padrão usado em {0}", + "enableCopy": "Habilitar ctrl-c (cmd-c em macOS) para copiar o texto selecionado", + "enablePaste": "Habilitar ctrl-v (cmd-v em macOS) para colar a partir da prancheta", + "profileArgs": "Os argumentos de concha que este perfil utiliza.", + "profileColor": "Uma identificação por cor do tema do terminal para associar com o terminal.", + "profileDefault": "Escolha o Perfil Padrão...", + "profileIcon": "Um codicon ID para associar com o ícone do terminal.\nterminal-tmux: \"$(terminal-tmux)\".", + "profileNew": "Novo Terminal (Com Perfil)...", + "profilePath": "O caminho da casca que este perfil utiliza.", + "profiles": "Os perfis a serem apresentados ao criar um novo terminal. Definir a propriedade do caminho manualmente com args opcionais.\nDefinir um perfil existente para 'nulo' para ocultar o perfil da lista, por exemplo: `\"{0}\": nulo'.", + "rendererType": "Controla como o terminal é renderizado.", + "rendererTypeDeprecationMessage": "O tipo de renderizador não é mais suportado como uma opção.", + "selectProfile": "Selecione um perfil para o novo terminal", + "shell.deprecated": "Isto é depreciado, a nova forma recomendada para configurar sua shell padrão é criando um perfil de terminal em 'terminal.integrated.profiles.{0}' e definindo seu nome de perfil como o padrão em 'terminal.integrated.defaultProfile'.{0}.", + "shellArgsLinux": "Os argumentos de linha de comando a serem usados quando no terminal Linux.", + "shellArgsOsx": "Os argumentos de linha de comando a serem usados quando no terminal macOS.", + "shellArgsWindows": "Os argumentos de linha de comando a serem usados quando no terminal Windows.", + "shellLinux": "O caminho do shell que o terminal usa no Linux (padrão: '{0}'}).", + "shellOsx": "O caminho da concha que o terminal usa em macOS (padrão: '{0}'}).", + "shellWindows": "O caminho da concha que o terminal utiliza no Windows. (padrão: '{0}')." + }, + "terminal-manager": { + "addTerminalToGroup": "Adicionar terminal ao grupo", + "closeDialog": { + "message": "Depois que o Gerenciador de Terminal for fechado, seu layout não poderá ser restaurado. Tem certeza de que deseja fechar o Gerenciador de Terminal?", + "title": "Deseja fechar o gerenciador de terminais?" + }, + "closeTerminalManager": "Fechar o Gerenciador de Terminais", + "createNewTerminalGroup": "Criar novo grupo de terminais", + "createNewTerminalPage": "Criar nova página do terminal", + "deleteGroup": "Excluir Grupo", + "deletePage": "Apagar página", + "deleteTerminal": "Excluir Terminal", + "group": "Grupo", + "label": "Terminais", + "maximizeBottomPanel": "Maximizar o painel inferior", + "minimizeBottomPanel": "Minimizar o painel inferior", + "openTerminalManager": "Abrir o Gerenciador de Terminais", + "page": "Página", + "rename": "Renomear", + "resetTerminalManagerLayout": "Redefinir layout do Gerenciador de Terminais", + "toggleTreeView": "Alternar visualização em árvore" + }, + "test": { + "cancelAllTestRuns": "Cancelar todas as execuções de teste", + "stackFrameAt": "em", + "testRunDefaultName": "{0} executar {1}", + "testRuns": "Execuções de teste" + }, + "toolbar": { + "addCommand": "Adicionar Comando à Barra de Ferramentas", + "addCommandPlaceholder": "Encontre um comando para adicionar à barra de ferramentas", + "centerColumn": "Coluna Central", + "failedUpdate": "Falha em atualizar o valor de '{0}' em '{1}'.", + "filterIcons": "Ícones de filtro", + "iconSelectDialog": "Selecione um Ícone para '{0}'.", + "iconSet": "Conjunto de Ícones", + "insertGroupLeft": "Inserir separador de grupo (Esquerda)", + "insertGroupRight": "Inserir separador de grupo (à direita)", + "leftColumn": "Coluna da esquerda", + "openJSON": "Personalizar barra de ferramentas (Open JSON)", + "removeCommand": "Remover Comando da Barra de Ferramentas", + "restoreDefaults": "Restaurar os padrões da barra de ferramentas", + "rightColumn": "Coluna da direita", + "selectIcon": "Selecione Ícone", + "toggleToolbar": "Barra de ferramentas Toggle", + "toolbarLocationPlaceholder": "Onde você gostaria que o comando fosse adicionado?", + "useDefaultIcon": "Use o Ícone Default" + }, + "typehierarchy": { + "subtypeHierarchy": "Subtipo Hierarquia", + "supertypeHierarchy": "Supertipo Hierarquia" + }, + "variableResolver": { + "listAllVariables": "Variável: Listar tudo" + }, + "vsx-registry": { + "confirmDialogMessage": "A extensão \"{0}\" não foi verificada e pode representar um risco à segurança.", + "confirmDialogTitle": "Tem certeza de que deseja prosseguir com a instalação?", + "downloadCount": "Contagem de downloads: {0}", + "errorFetching": "Extensões de erro de busca.", + "errorFetchingConfigurationHint": "Isso pode ser causado por problemas de configuração de rede.", + "failedInstallingVSIX": "Falha na instalação {0} da VSIX.", + "invalidVSIX": "O arquivo selecionado não é um plugin \"*.vsix\" válido.", + "license": "Licença: {0}", + "onlyShowVerifiedExtensionsDescription": "Isso permite que o site {0} mostre apenas as extensões verificadas.", + "onlyShowVerifiedExtensionsTitle": "Mostrar apenas as extensões verificadas", + "recommendedExtensions": "Uma lista dos nomes das extensões recomendadas para uso neste espaço de trabalho.", + "searchPlaceholder": "Pesquisar extensões em {0}", + "showInstalled": "Mostrar extensões instaladas", + "showRecommendedExtensions": "Controla se as notificações são mostradas para recomendações de extensão.", + "vsx-extensions-contribution": { + "update-version-uninstall-error": "Erro ao remover a extensão: {0}.", + "update-version-version-error": "Falha na instalação da versão {0} de {1}." + } + }, + "webview": { + "goToReadme": "Ir para o LEIAME", + "messageWarning": " O padrão de host do terminal {0} foi alterado para `{1}'; mudar o padrão pode levar a vulnerabilidades de segurança. Veja `{2}` para mais informações." + }, + "workspace": { + "bothAreDirectories": "Ambos os recursos são diretórios.", + "clickToManageTrust": "Clique para gerenciar as configurações de confiança.", + "compareWithEachOther": "Compare uns com os outros", + "confirmDeletePermanently.description": "Falha em excluir \"{0}\" usando o Lixo. Você quer excluir permanentemente em seu lugar?", + "confirmDeletePermanently.solution": "Você pode desativar o uso de Lixo nas preferências.", + "confirmDeletePermanently.title": "Erro ao apagar o arquivo", + "confirmMessage.delete": "Você realmente quer apagar os seguintes arquivos?", + "confirmMessage.dirtyMultiple": "Você realmente quer excluir {0} arquivos com alterações não salvas?", + "confirmMessage.dirtySingle": "Você realmente quer apagar {0} com as mudanças não salvas?", + "confirmMessage.uriMultiple": "Você realmente quer apagar todos os {0} arquivos selecionados?", + "confirmMessage.uriSingle": "Você realmente quer apagar {0}?", + "directoriesCannotBeCompared": "Os diretórios não podem ser comparados. {0}", + "duplicate": "Duplicata", + "failSaveAs": "Não é possível executar \"{0}\" para o widget atual.", + "isDirectory": "{0}É um diretório.", + "manageTrustPlaceholder": "Selecione o estado de confiança para este espaço de trabalho", + "newFilePlaceholder": "Nome do arquivo", + "newFolderPlaceholder": "Nome da pasta", + "noErasure": "Nota: Nada será apagado do disco", + "notWorkspaceFile": "Arquivo de área de trabalho inválido: {0}", + "openRecentPlaceholder": "Digite o nome do espaço de trabalho que você deseja abrir", + "openRecentWorkspace": "Espaço de Trabalho Recente Aberto...", + "preserveWindow": "Permitir a abertura de espaços de trabalho na janela atual.", + "removeFolder": "Você tem certeza de que deseja remover a seguinte pasta do espaço de trabalho?", + "removeFolders": "Você tem certeza de que quer remover as seguintes pastas do espaço de trabalho?", + "restrictedModeDescription": "Algumas funcionalidades estão desativadas porque este espaço de trabalho não é confiável.", + "restrictedModeNote": "*Observação: o recurso de confiança do espaço de trabalho está atualmente em desenvolvimento no Theia; nem todos os recursos estão integrados à confiança do espaço de trabalho ainda*", + "schema": { + "folders": { + "description": "Pastas raiz na área de trabalho" + }, + "title": "Arquivo do espaço de trabalho" + }, + "trashTitle": "Mudar {0} para Lixo", + "trustEmptyWindow": "Controla se o espaço de trabalho vazio é ou não confiável por padrão.", + "trustEnabled": "Controla se a confiança no espaço de trabalho está ou não habilitada. Se desativado, todos os espaços de trabalho são confiáveis.", + "trustTrustedFolders": "Lista de URIs de pastas que são confiáveis sem solicitação.", + "untitled-cleanup": "Parece haver muitos arquivos de espaço de trabalho sem título. Por favor, verifique {0} e remova quaisquer arquivos não utilizados.", + "variables": { + "cwd": { + "description": "O diretório de trabalho atual do executor de tarefas na inicialização" + }, + "file": { + "description": "O caminho do arquivo atualmente aberto" + }, + "fileBasename": { + "description": "O nome base do arquivo atualmente aberto" + }, + "fileBasenameNoExtension": { + "description": "O nome do arquivo atualmente aberto sem extensão" + }, + "fileDirname": { + "description": "O nome do diretório do arquivo atualmente aberto" + }, + "fileExtname": { + "description": "A extensão do arquivo atualmente aberto" + }, + "relativeFile": { + "description": "O caminho do arquivo atualmente aberto em relação à raiz da área de trabalho" + }, + "relativeFileDirname": { + "description": "O nome do diretório do arquivo aberto atualmente em relação a ${workspaceFolder}" + }, + "workspaceFolder": { + "description": "O caminho da pasta raiz da área de trabalho" + }, + "workspaceFolderBasename": { + "description": "O nome da pasta raiz do espaço de trabalho" + }, + "workspaceRoot": { + "description": "O caminho da pasta raiz da área de trabalho" + }, + "workspaceRootFolderName": { + "description": "O nome da pasta raiz do espaço de trabalho" + } + }, + "workspaceFolderAdded": "Foi criado um espaço de trabalho com múltiplas raízes. Você quer salvar sua configuração de espaço de trabalho como um arquivo?", + "workspaceFolderAddedTitle": "Pasta adicionada ao espaço de trabalho" + } + }, + "vsx.disabling": "Desativação", + "vsx.disabling.extensions": "Desativando {0}...", + "vsx.enabling": "Habilitação", + "vsx.enabling.extension": "Habilitando {0}..." +} diff --git a/packages/core/i18n/nls.ru.json b/packages/core/i18n/nls.ru.json new file mode 100644 index 0000000..ba6cdc2 --- /dev/null +++ b/packages/core/i18n/nls.ru.json @@ -0,0 +1,2097 @@ +{ + "ai-chat-ui.show-settings": "Показать настройки искусственного интеллекта", + "ai-chat:summarize-session-as-task-for-coder": "Подведение итогов сессии как задание для кодера", + "ai.executePlanWithCoder": "Выполнить текущий план с помощью кодера", + "ai.updateTaskContext": "Обновление текущего контекста задачи", + "aiConfiguration:open": "Откройте представление конфигурации AI", + "aiHistory:clear": "История ИИ: Чистая история", + "aiHistory:open": "Откройте представление истории ИИ", + "aiHistory:sortChronologically": "История искусственного интеллекта: Сортировка в хронологическом порядке", + "aiHistory:sortReverseChronologically": "История искусственного интеллекта: Сортировка в обратном хронологическом порядке", + "aiHistory:toggleCompact": "История искусственного интеллекта: Переключить компактный вид", + "aiHistory:toggleHideNewlines": "История ИИ: Прекращение интерпретации новых строк", + "aiHistory:toggleRaw": "История искусственного интеллекта: Переключить просмотр в сыром виде", + "aiHistory:toggleRenderNewlines": "История ИИ: Интерпретация новых строк", + "debug.breakpoint.editCondition": "Изменить состояние...", + "debug.breakpoint.removeSelected": "Удалить выбранные точки останова", + "debug.breakpoint.toggleEnabled": "Включить/выключить точки останова", + "notebook.cell.changeToCode": "Измените ячейку на код", + "notebook.cell.changeToMarkdown": "Измените ячейку на Мардаун", + "notebook.cell.insertMarkdownCellAbove": "Вставить ячейку для уценки выше", + "notebook.cell.insertMarkdownCellBelow": "Вставить ячейку для уценки ниже", + "terminal:new:profile": "Создание нового интегрированного терминала из профиля", + "terminal:profile:default": "Выберите профиль терминала по умолчанию", + "theia": { + "ai": { + "agents": { + "completionNotification": { + "mdDescription": "Поведение уведомления о завершении задачи этим агентом. Если не задано, будет использоваться глобальная настройка уведомления по умолчанию.\n - `os-notification`: Показывать уведомления ОС/системы\n - `message`: Показывать уведомления в строке состояния/области сообщений\n - `blink`: Мигать или подсвечивать пользовательский интерфейс\n - `off`: Отключить уведомления для этого агента", + "title": "Уведомление о завершении" + }, + "enable": { + "mdDescription": "Указывает, должен ли агент быть включен (true) или отключен (false).", + "title": "Включить агента" + }, + "languageModelRequirements": { + "identifier": { + "mdDescription": "Идентификатор используемой языковой модели." + }, + "mdDescription": "Указывает используемые языковые модели для этого агента.", + "purpose": { + "mdDescription": "Цель, для которой используется данная языковая модель.", + "title": "Назначение" + }, + "title": "Требования к языковой модели" + }, + "mdDescription": "Настройте параметры агента, такие как включение или отключение определенных агентов, настройка подсказок и выбор LLM.", + "selectedVariants": { + "mdDescription": "Указывает выбранные в данный момент варианты подсказок для этого агента.", + "title": "Избранные варианты" + }, + "title": "Настройки агента" + }, + "anthropic": { + "apiKey": { + "description": "Введите API-ключ вашего официального аккаунта Anthropic. **Примечание:** При использовании этого параметра ключ API Anthropic будет храниться открытым текстом на машине, на которой установлена Theia. Используйте переменную окружения `ANTHROPIC_API_KEY` для безопасной установки ключа." + }, + "models": { + "description": "Официальные антропные модели для использования" + } + }, + "chat": { + "agent": { + "architect": "Архитектор", + "coder": "кодер", + "universal": "Универсальный" + }, + "applySuggestion": "Предложение по применению", + "bypassModelRequirement": { + "description": "Обход проверки требований к языковой модели. Включите эту опцию, если вы используете внешние агенты (например, Claude Code), которые не требуют языковых моделей Theia." + }, + "changeSetDefaultTitle": "Предлагаемые изменения", + "changeSetFileDiffUriLabel": "Изменения ИИ: {0}", + "chatAgentsVariable": { + "description": "Возвращает список агентов чата, доступных в системе" + }, + "chatSessionNamingAgent": { + "description": "Агент для генерации имен сеансов чата", + "vars": { + "conversation": { + "description": "Содержание разговора в чате." + }, + "listOfSessionNames": { + "description": "Список имен существующих сессий." + } + } + }, + "chatSessionSummaryAgent": { + "description": "Агент для создания сводок сеансов чата." + }, + "confirmApplySuggestion": "Файл {0} изменился с момента создания этого предложения. Вы уверены, что хотите применить изменения?", + "confirmRevertSuggestion": "Файл {0} изменился с момента создания этого предложения. Вы уверены, что хотите вернуть изменения?", + "couldNotFindMatchingLM": "Не удалось найти подходящую языковую модель. Пожалуйста, проверьте ваши настройки!", + "couldNotFindReadyLMforAgent": "Не удалось найти готовую языковую модель для агента {0}. Пожалуйста, проверьте ваши настройки!", + "defaultAgent": { + "description": "Необязательно: агента чата, который будет вызван, если в запросе пользователя агент не указан с помощью @. Если агент по умолчанию не задан, будут применены настройки Theia по умолчанию." + }, + "imageContextVariable": { + "args": { + "data": { + "description": "Данные изображения в формате base64." + }, + "mimeType": { + "description": "Миметип изображения." + }, + "name": { + "description": "Имя файла изображения, если оно доступно." + }, + "wsRelativePath": { + "description": "Путь к файлу изображения относительно рабочего пространства, если он доступен." + } + }, + "description": "Предоставляет контекстную информацию для изображения", + "label": "Файл изображения" + }, + "orchestrator": { + "description": "Этот агент анализирует запрос пользователя по описанию всех доступных агентов чата и выбирает наиболее подходящего агента для ответа на запрос (с помощью искусственного интеллекта). Запрос пользователя будет напрямую передан выбранному агенту без дополнительного подтверждения.", + "vars": { + "availableChatAgents": { + "description": "Список агентов чата, которым оркестратор может делегировать полномочия, исключая агентов, указанных в предпочтении списка исключений." + } + } + }, + "pinChatAgent": { + "description": "Включите функцию закрепления агентов, чтобы автоматически сохранять активность упомянутого агента в чате во всех подсказках, сокращая необходимость в повторных упоминаниях. Вы можете вручную снять закрепление или переключить агентов в любое время." + }, + "revertSuggestion": "Вернуть предложение", + "selectImageFile": "Выберите файл изображения", + "sessionStorage": { + "description": "Настройте место хранения сеансов чата.", + "globalPath": "Глобальный путь", + "pathNotUsedForScope": "Не используется с областью хранения «{0}».", + "pathRequired": "Путь не может быть пустым", + "pathSettings": "Настройки пути", + "resetToDefault": "Сбросить до настроек по умолчанию", + "scope": { + "global": "Хранить сеансы чата в глобальной папке конфигурации.", + "workspace": "Сохраняйте сеансы чата в папке рабочего пространства." + }, + "workspacePath": "Путь к рабочему пространству" + }, + "taskContextService": { + "summarizeProgressMessage": "Подведите итоги: {0}", + "updatingProgressMessage": "Обновление: {0}" + }, + "toolConfirmation": { + "confirm": { + "description": "Запрашивайте подтверждение перед выполнением инструментов" + }, + "disabled": { + "description": "Отключить выполнение инструмента" + }, + "yolo": { + "description": "Автоматическое выполнение инструментов без подтверждения" + } + }, + "view": { + "label": "Чат с искусственным интеллектом" + } + }, + "chat-ui": { + "addContextVariable": "Добавьте контекстную переменную", + "agent": "Агент", + "aiDisabled": "Функции искусственного интеллекта отключены", + "applyAll": "Применить все", + "applyAllTitle": "Применить все ожидающие изменения", + "askQuestion": "Задать вопрос", + "attachToContext": "Прикрепление элементов к контексту", + "cancel": "Отмена (Esc)", + "chat-view-tree-widget": { + "ai": "AI", + "aiFeatureHeader": "🚀 Доступны функции искусственного интеллекта (Альфа-версия)!", + "featuresDisabled": "В настоящее время все функции ИИ отключены!", + "generating": "Генерация", + "howToEnable": "Как включить функции искусственного интеллекта:", + "noRenderer": "Ошибка: Рендерер не найден", + "scrollToBottom": "Перейти к последнему сообщению", + "waitingForInput": "Ожидание ввода", + "you": "Вы" + }, + "chatInput": { + "clearHistory": "Очистить историю подсказок ввода", + "cycleMode": "Режим циклического чата", + "nextPrompt": "Следующая подсказка", + "previousPrompt": "Предыдущая заметка" + }, + "chatInputAriaLabel": "Введите здесь свое сообщение", + "chatResponses": "Ответы в чате", + "code-part-renderer": { + "generatedCode": "Сгенерированный код" + }, + "collapseChangeSet": "Свернуть набор изменений", + "command-part-renderer": { + "commandNotExecutable": "Команда имеет идентификатор \"{0}\", но она не выполняется из окна чата." + }, + "copyCodeBlock": "Скопируйте блок кода", + "couldNotSendRequestToSession": "Не удалось отправить запрос \"{0}\" в сессию {1}", + "delegation-response-renderer": { + "prompt": { + "label": "Делегированная подсказка:" + }, + "response": { + "label": "Ответ:" + }, + "starting": "Начало делегации...", + "status": { + "canceled": "отменено", + "error": "ошибка", + "generating": "создавая...", + "starting": "начиная..." + } + }, + "deleteChangeSet": "Удалить набор изменений", + "editRequest": "Редактировать", + "edited": "отредактированный", + "editedTooltipHint": "Этот вариант подсказки был отредактирован. Вы можете сбросить его в окне «Конфигурация ИИ».", + "enterChatName": "Введите имя чата", + "errorChatInvocation": "Во время вызова службы чата произошла ошибка.", + "expandChangeSet": "Раскрыть набор изменений", + "failedToDeleteSession": "Не удалось удалить сеанс чата", + "failedToLoadChats": "Не удалось загрузить сеансы чата", + "failedToRestoreSession": "Не удалось восстановить сеанс чата", + "failedToRetry": "Сообщение о невозможности повторить попытку", + "focusInput": "Ввод в фокусном чате", + "focusResponse": "Ответ в чате Focus", + "noChatAgentsAvailable": "Агенты чата отсутствуют.", + "openDiff": "Открытый диффузор", + "openOriginalFile": "Открыть исходный файл", + "performThisTask": "Выполните это задание.", + "persistedSession": "Сохранившаяся сессия (нажмите, чтобы восстановить)", + "removeChat": "Удалить чат", + "renameChat": "Переименовать чат", + "requestNotFoundForRetry": "Запрос не найден для повторного выполнения", + "responseFrom": "Ответ от {0}", + "selectAgentQuickPickPlaceholder": "Выберите агента для новой сессии", + "selectChat": "Выберите чат", + "selectContextVariableQuickPickPlaceholder": "Выберите контекстную переменную, которая будет присоединена к сообщению", + "selectTaskContextQuickPickItem": { + "currentlyOpen": "в настоящее время открыт" + }, + "selectTaskContextQuickPickPlaceholder": "Выберите контекст задачи для прикрепления", + "selectVariableArguments": "Выбор аргументов переменных", + "send": "Отправить (Enter)", + "sessionNotFoundForRetry": "Сессия не найдена для повторной попытки", + "text-part-renderer": { + "cantDisplay": "Не удается отобразить ответ, пожалуйста, проверьте ваши ChatResponsePartRenderers!" + }, + "thinking-part-renderer": { + "thinking": "Мышление" + }, + "toolcall-part-renderer": { + "denied": "Выполнение запрещено", + "finished": "Ran", + "rejected": "Исполнение отменено" + }, + "toolconfirmation": { + "allow-options-dropdown-tooltip": "Больше вариантов разрешения", + "allow-session": "Разрешить этот чат", + "allowed": "Разрешено выполнение инструмента", + "alwaysAllowConfirm": "Я понимаю, включить автоматическое одобрение", + "alwaysAllowTitle": "Включить автоматическое одобрение для «{0}»?", + "canceled": "Выполнение инструмента отменено", + "denied": "Выполнение инструмента запрещено", + "deny-forever": "Всегда отрицать", + "deny-options-dropdown-tooltip": "Другие варианты отказа", + "deny-reason-placeholder": "Введите причину отказа...", + "deny-session": "Отказать в этом чате", + "deny-with-reason": "Откажитесь с объяснением причин...", + "executionDenied": "Выполнение инструмента запрещено", + "header": "Подтвердите выполнение инструмента" + }, + "unableToSummarizeCurrentSession": "Невозможно подвести итоги текущей сессии. Убедитесь, что агент подведения итогов не отключен.", + "unknown-part-renderer": { + "contentNotRestoreable": "Это содержимое (тип '{0}') не удалось полностью восстановить. Возможно, оно относится к расширению, которое больше не доступно." + }, + "unpinAgent": "Открепить агента", + "variantTooltip": "Вариант подсказки: {0}", + "yourMessage": "Ваше сообщение" + }, + "claude-code": { + "agentDescription": "Кодирующий агент Антропика", + "askBeforeEdit": "Спросите перед редактированием", + "changeSetTitle": "Изменения по коду Клода", + "clearCommand": { + "description": "Создайте новую сессию" + }, + "compactCommand": { + "description": "Компактная беседа с дополнительными инструкциями по фокусировке" + }, + "completedCount": "{0}/{1} завершено", + "configCommand": { + "description": "Конфигурация открытого кода Клода" + }, + "currentDirectory": "текущий каталог", + "differentAgentRequestWarning": "Предыдущий запрос в чате был обработан другим агентом. Клод Код не видит других сообщений.", + "directory": "Каталог", + "domain": "Домен", + "editAutomatically": "Автоматическая редактирование", + "editNumber": "Редактировать {0}", + "editing": "Редактирование", + "editsCount": "{0} редактирует", + "emptyTodoList": "Не все доступны", + "entireFile": "Весь файл", + "excludingOnePattern": " (за исключением 1 детали)", + "excludingPatterns": " (за исключением моделей {0} )", + "executedCommand": "Выполнено: {0}", + "failedToParseBashToolData": "Не удалось разобрать данные инструмента Bash", + "failedToParseEditToolData": "Не удалось разобрать данные инструмента Edit", + "failedToParseGlobToolData": "Не удалось разобрать данные инструмента Glob", + "failedToParseGrepToolData": "Не удалось разобрать данные инструмента Grep", + "failedToParseLSToolData": "Не удалось разобрать данные инструмента LS", + "failedToParseMultiEditToolData": "Не удалось разобрать данные инструмента MultiEdit", + "failedToParseReadToolData": "Не удалось разобрать данные инструмента для чтения", + "failedToParseTodoListData": "Не удалось разобрать данные списка дел", + "failedToParseWebFetchToolData": "Не удалось разобрать данные инструмента WebFetch", + "failedToParseWriteToolData": "Не удалось разобрать данные инструмента записи", + "fetching": "Поиск", + "fileFilter": "Фильтр файлов", + "filePath": "Путь к файлу", + "fileType": "Тип файла", + "findMatchingFiles": "Найдите файлы, соответствующие глобальному шаблону \"{0}\" в текущем каталоге.", + "findMatchingFilesWithPath": "Найдите файлы, соответствующие глобальному шаблону \"{0}\" в пределах {1}", + "finding": "Поиск", + "from": "С сайта", + "globPattern": "шаровидный узор", + "grepOptions": { + "caseInsensitive": "без учета регистра", + "glob": "глобус: {0}", + "headLimit": "предел: {0}", + "lineNumbers": "номера строк", + "linesAfter": "+{0} после", + "linesBefore": "+{0} до", + "linesContext": "±{0} контекст", + "multiLine": "многострочный", + "type": "тип: {0}" + }, + "grepOutputModes": { + "content": "содержание", + "count": "считать", + "filesWithMatches": "файлы с совпадениями" + }, + "ignoredPatterns": "Игнорируемые узоры", + "ignoringPatterns": "Игнорирование шаблонов {0} ", + "initCommand": { + "description": "Инициализируйте проект с помощью руководства CLAUDE.md" + }, + "itemCount": "{0} товары", + "lineLimit": "Предел линии", + "lines": "Линии", + "listDirectoryContents": "Список содержимого каталогов", + "listing": "Листинг", + "memoryCommand": { + "description": "Отредактируйте файл памяти CLAUDE.md" + }, + "multiEditing": "Мультиредактирование", + "oneEdit": "1 правка", + "oneItem": "1 предмет", + "oneOption": "1 вариант", + "openDirectoryTooltip": "Нажмите, чтобы открыть каталог", + "openFileTooltip": "Нажмите, чтобы открыть файл в редакторе", + "optionsCount": "{0} опционы", + "partial": "Частичный", + "pattern": "Узор", + "plan": "Режим планирования", + "project": "проект", + "projectRoot": "корень проекта", + "readMode": "Режим чтения", + "reading": "Чтение", + "replaceAllCount": "{0} replace-all", + "replaceAllOccurrences": "Заменить все вхождения", + "resumeCommand": { + "description": "Возобновление сеанса" + }, + "reviewCommand": { + "description": "Запросите обзор кода" + }, + "searchPath": "Путь поиска", + "searching": "Поиск", + "startingLine": "Стартовая линия", + "timeout": "Тайм-аут", + "timeoutInMs": "Тайм-аут: {0}мс", + "to": "На", + "todoList": "Список дел", + "todoPriority": { + "high": "высокий", + "low": "низкий", + "medium": "средний" + }, + "toolApprovalRequest": "Клод Код хочет использовать инструмент \"{0}\". Хотите ли вы разрешить это?", + "totalEdits": "Всего правок", + "webFetch": "Веб-приемник", + "writing": "Написание" + }, + "code-completion": { + "progressText": "Вычисление завершения кода AI..." + }, + "codex": { + "agentDescription": "Помощник по программированию OpenAI на базе Codex", + "completedCount": "{0}/{1} завершено", + "exitCode": "Код выхода: {0}", + "fileChangeFailed": "Codex не смог применить изменения для: {0}", + "fileChangeFailedGeneric": "Codex не смог применить изменения файла.", + "itemCount": "{0} предметы", + "noItems": "Нет элементов", + "oneItem": "1 товар", + "running": "Бег...", + "searched": "Искалось", + "searching": "Поиск", + "todoList": "Список дел", + "webSearch": "Поиск в Интернете" + }, + "completion": { + "agent": { + "description": "Этот агент обеспечивает встроенное завершение кода в редакторе кода в Theia IDE.", + "vars": { + "file": { + "description": "URI редактируемого файла" + }, + "language": { + "description": "Идентификатор языка редактируемого файла" + }, + "prefix": { + "description": "Код перед текущей позицией курсора" + }, + "suffix": { + "description": "Код после текущей позиции курсора" + } + } + }, + "automaticEnable": { + "description": "Автоматическое включение AI-дополнений в строке любого редактора (Monaco) во время редактирования. \n Также вы можете вручную вызвать код с помощью команды \"Trigger Inline Suggestion\" или сочетания клавиш по умолчанию \"Ctrl+Alt+Space\"." + }, + "cacheCapacity": { + "description": "Максимальное количество завершений кода для хранения в кэше. Большее число может повысить производительность, но будет занимать больше памяти. Минимальное значение - 10, рекомендуемый диапазон - 50-200.", + "title": "Объем кэш-памяти для завершения кода" + }, + "debounceDelay": { + "description": "Управляет задержкой в миллисекундах перед запуском завершения AI после обнаружения изменений в редакторе. Требуется, чтобы `Автоматическое завершение кода` было включено. Введите 0, чтобы отключить задержку срабатывания.", + "title": "Задержка дребезга" + }, + "excludedFileExts": { + "description": "Укажите расширения файлов (например, .md, .txt), в которых должны быть отключены AI-дополнения.", + "title": "Исключенные расширения файлов" + }, + "fileVariable": { + "description": "URI редактируемого файла. Доступен только в контексте завершения кода." + }, + "languageVariable": { + "description": "Языковой идентификатор редактируемого файла. Доступно только в контексте завершения кода." + }, + "maxContextLines": { + "description": "Максимальное количество строк, используемых в качестве контекста, распределенное между строками до и после позиции курсора (префикс и суффикс). Установите значение -1, чтобы использовать весь файл в качестве контекста без ограничения количества строк, и 0, чтобы использовать только текущую строку.", + "title": "Максимальное количество контекстных строк" + }, + "prefixVariable": { + "description": "Код перед текущей позицией курсора. Доступно только в контексте завершения кода." + }, + "stripBackticks": { + "description": "Удаление окружающих обратных знаков из кода, возвращаемого некоторыми LLM. Если обнаружен обратный знак, все содержимое после закрывающего обратного знака также удаляется. Эта настройка помогает обеспечить возврат чистого кода, когда языковые модели используют форматирование, подобное маркдауну.", + "title": "Убрать обратные знаки из последовательных завершений" + }, + "suffixVariable": { + "description": "Код после текущей позиции курсора. Доступно только в контексте завершения кода." + } + }, + "configuration": { + "selectItem": "Пожалуйста, выберите элемент." + }, + "copilot": { + "auth": { + "aiConfiguration": "Конфигурация ИИ", + "authorize": "Я уполномочил", + "copied": "Скопировано!", + "copyCode": "Копировать код", + "expired": "Авторизация истекла или была отклонена. Повторите попытку.", + "hint": "После ввода кода и авторизации нажмите «Я авторизовался» ниже.", + "initiating": "Инициирование аутентификации...", + "instructions": "Чтобы разрешить Theia использовать GitHub Copilot, перейдите по ссылке ниже и введите код:", + "openGitHub": "Открыть GitHub", + "success": "Успешно вошли в GitHub Copilot!", + "successHint": "Если ваша учетная запись GitHub имеет доступ к Copilot, теперь вы можете настроить языковые модели Copilot в ", + "title": "Войти в GitHub Copilot", + "tos": "Регистрируясь, вы соглашаетесь с ", + "tosLink": "Условия предоставления услуг GitHub", + "verifying": "Проверка авторизации..." + }, + "category": "Второй пилот", + "commands": { + "signIn": "Войти в GitHub Copilot", + "signOut": "Выйти из GitHub Copilot" + }, + "enterpriseUrl": { + "mdDescription": "Домен GitHub Enterprise для Copilot API (например, `github.mycompany.com`). Оставьте поле пустым для GitHub.com." + }, + "models": { + "description": "Модели GitHub Copilot для использования. Доступные модели зависят от вашей подписки Copilot." + }, + "statusBar": { + "signedIn": "Вошли в GitHub Copilot как {0}. Нажмите, чтобы выйти.", + "signedOut": "Вы не вошли в GitHub Copilot. Нажмите, чтобы войти." + } + }, + "core": { + "agentConfiguration": { + "actions": "Действия", + "addCustomAgent": "Добавить пользовательского агента", + "enableAgent": "Включить агента", + "label": "Агенты", + "llmRequirements": "Требования к магистрам права", + "notUsedInPrompt": "Не используется в подсказке", + "promptTemplates": "Шаблоны подсказок", + "selectAgentMessage": "Пожалуйста, сначала выберите агента!", + "templateName": "Шаблон", + "undeclared": "Необъявленный", + "usedAgentSpecificVariables": "Используемые переменные, специфичные для агента", + "usedFunctions": "Используемые функции", + "usedGlobalVariables": "Используемые глобальные переменные", + "variant": "Вариант" + }, + "agentsVariable": { + "description": "Возвращает список агентов, доступных в системе" + }, + "aiConfiguration": { + "label": "✨ Конфигурация ИИ [Альфа]" + }, + "blinkTitle": { + "agentCompleted": "Тея - агент завершен", + "namedAgentCompleted": "Тея - агент \"{0}\" Завершено" + }, + "changeSetSummaryVariable": { + "description": "Предоставляет сводку файлов в наборе изменений и их содержимое." + }, + "contextDetailsVariable": { + "description": "Предоставляет полнотекстовые значения и описания для всех элементов контекста." + }, + "contextSummaryVariable": { + "description": "Описывает файлы в контексте для данной сессии." + }, + "customAgentTemplate": { + "description": "Это пример агента. Пожалуйста, адаптируйте свойства под свои нужды." + }, + "defaultModelAliases": { + "code": { + "description": "Оптимизирован для задач понимания и генерации кода." + }, + "code-completion": { + "description": "Лучше всего подходит для сценариев автозаполнения кода." + }, + "summarize": { + "description": "Модели, приоритетные для обобщения и сжатия содержания." + }, + "universal": { + "description": "Хорошо сбалансирован как для работы с кодами, так и для общего использования языка." + } + }, + "defaultNotification": { + "mdDescription": "Метод уведомления по умолчанию, используемый, когда агент ИИ завершает задание. Отдельные агенты могут переопределять эту настройку.\n - `os-notification`: Показывать уведомления ОС/системы\n - `message`: Показывать уведомления в строке состояния/области сообщений\n - `blink`: Мигать или подсвечивать пользовательский интерфейс\n - `off`: Отключить все уведомления", + "title": "Тип уведомления по умолчанию" + }, + "discard": { + "label": "Шаблон подсказки Discard AI" + }, + "discardCustomPrompt": { + "tooltip": "Отказ от настроек" + }, + "fileVariable": { + "description": "Определяет содержимое файла", + "uri": { + "description": "URI запрашиваемого файла." + } + }, + "languageModelRenderer": { + "alias": "[псевдоним] {0}", + "languageModel": "Языковая модель", + "purpose": "Назначение" + }, + "maxRetries": { + "mdDescription": "Максимальное количество повторных попыток при неудачном запросе к провайдеру AI. Значение 0 означает отсутствие повторных попыток.", + "title": "Максимальное количество повторных попыток" + }, + "modelAliasesConfiguration": { + "agents": "Агенты, использующие этот псевдоним", + "defaultList": "[Список по умолчанию]", + "evaluatesTo": "Оценивает до", + "label": "Псевдонимы модели", + "modelNotReadyTooltip": "Не готов", + "modelReadyTooltip": "Готовые", + "noAgents": "Ни один агент не использует этот псевдоним.", + "noModelReadyTooltip": "Модель не готова", + "noResolvedModel": "Для этого псевдонима нет готовой модели.", + "priorityList": "Список приоритетов", + "selectAlias": "Пожалуйста, выберите псевдоним модели.", + "selectedModelId": "Выбранная модель", + "unavailableModel": "Выбранная модель больше не доступна" + }, + "noVariableFoundForOpenRequest": "Для открытого запроса переменная не найдена.", + "openEditorsShortVariable": { + "description": "Краткая ссылка на все открытые в данный момент файлы (относительные пути, разделенные запятыми)" + }, + "openEditorsVariable": { + "description": "Список всех открытых в данный момент файлов, разделенных запятыми, относительно корня рабочей области." + }, + "preference": { + "languageModelAliases": { + "description": "Настройте модели для каждого псевдонима языковой модели в [AI Configuration View]({0}). В качестве альтернативы вы можете задать настройки вручную в файле settings.json: \n```\n\"default/code\": {\n \"selectedModel\": \"anthropic/claude-opus-4-20250514\"\n}\n```", + "selectedModel": "Выбранная пользователем модель для этого псевдонима.", + "title": "Псевдонимы языковой модели" + } + }, + "prefs": { + "title": "✨ Особенности искусственного интеллекта [Альфа]" + }, + "promptFragmentsConfiguration": { + "activeCustomizationTitle": "Активная настройка", + "createCustomizationTitle": "Создание персонализации", + "customization": "персонализация", + "customizationLabel": "Настройка", + "defaultVariantTitle": "Вариант по умолчанию", + "deleteCustomizationTitle": "Удалить настройку", + "editTemplateTitle": "Редактировать шаблон", + "headerTitle": "Фрагменты подсказок", + "label": "Фрагменты подсказок", + "noFragmentsAvailable": "Фрагменты подсказок отсутствуют.", + "otherPromptFragmentsHeader": "Другие фрагменты стихотворений", + "promptTemplateText": "Текст шаблона подсказки", + "promptVariantsHeader": "Наборы вариантов подсказок", + "removeCustomizationDialogMsg": "Вы уверены, что хотите удалить настройку {0} для фрагмента подсказки \"{1}\"?", + "removeCustomizationDialogTitle": "Удаление персонализации", + "removeCustomizationWithDescDialogMsg": "Вы уверены, что хотите удалить настройку {0} для фрагмента подсказки \"{1}\" ({2})?", + "resetAllButton": "Сбросить все", + "resetAllCustomizationsDialogMsg": "Вы уверены, что хотите сбросить все фрагменты подсказок к их встроенным версиям? Это приведет к удалению всех настроек.", + "resetAllCustomizationsDialogTitle": "Сброс всех настроек", + "resetAllCustomizationsTitle": "Сбросьте все настройки", + "resetAllPromptFragments": "Сброс всех фрагментов подсказки", + "resetToBuiltInDialogMsg": "Вы уверены, что хотите вернуть фрагмент подсказки \"{0}\" к его встроенной версии? Это удалит все пользовательские настройки.", + "resetToBuiltInDialogTitle": "Сброс на встроенный", + "resetToBuiltInTitle": "Сброс на этот встроенный", + "resetToCustomizationDialogMsg": "Вы уверены, что хотите сбросить фрагмент подсказки \"{0}\", чтобы использовать настройку {1}? Это приведет к удалению всех более приоритетных настроек.", + "resetToCustomizationDialogTitle": "Переход к настройке", + "resetToCustomizationTitle": "Сброс к этой настройке", + "selectedVariantLabel": "Избранное", + "selectedVariantTitle": "Выбранный вариант", + "usedByAgentTitle": "Используется агентом: {0}", + "variantSetError": "Выбранный вариант не существует, и по умолчанию его найти не удалось. Пожалуйста, проверьте конфигурацию.", + "variantSetWarning": "Выбранный вариант не существует. Вместо него используется вариант по умолчанию.", + "variantsOfSystemPrompt": "Разновидности этого набора вариантов подсказок:" + }, + "promptTemplates": { + "description": "Папка для хранения настроенных шаблонов подсказок. Если они не настроены, используется каталог пользовательских настроек. Пожалуйста, рассмотрите возможность использования папки, находящейся под контролем версий, для управления вариантами шаблонов подсказок.", + "openLabel": "Выберите папку" + }, + "promptVariable": { + "argDescription": "Идентификатор шаблона подсказки для разрешения", + "completions": { + "detail": { + "builtin": "Встроенный фрагмент подсказки", + "custom": "Индивидуальный фрагмент подсказки" + } + }, + "description": "Разрешение шаблонов подсказок с помощью службы подсказок" + }, + "prompts": { + "category": "Шаблоны подсказок Theia AI" + }, + "requestSettings": { + "clientSettings": { + "description": "Настройки клиента для обработки сообщений, отправляемых обратно на llm.", + "keepThinking": { + "description": "Если установлено значение false, то перед отправкой следующего запроса пользователя в многооборотном разговоре будет отфильтрована вся мыслительная информация." + }, + "keepToolCalls": { + "description": "Если установлено значение false, все запросы и ответы инструментов будут отфильтрованы перед отправкой следующего запроса пользователя в многооборотном диалоге." + } + }, + "mdDescription": "Позволяет задавать пользовательские настройки запроса для нескольких моделей.\n Каждый объект представляет собой конфигурацию для конкретной модели. Поле `modelId` задает идентификатор модели, `requestSettings` определяет настройки для конкретной модели.\n Поле `providerId` является необязательным и позволяет применить настройки к конкретному провайдеру. Если оно не задано, настройки будут применены ко всем провайдерам.\n Примеры providerIds: huggingface, openai, ollama, llamafile.\n Дополнительные сведения см. в [нашей документации](https://theia-ide.org/docs/user_ai/#custom-request-settings).", + "modelSpecificSettings": { + "description": "Настройки для идентификатора конкретной модели." + }, + "scope": { + "agentId": { + "description": "Идентификатор агента (необязательно), к которому нужно применить настройки." + }, + "modelId": { + "description": "Идентификатор модели (необязательно)" + }, + "providerId": { + "description": "Идентификатор провайдера (необязательно), к которому следует применить настройки." + } + }, + "title": "Настройки пользовательских запросов" + }, + "skillsVariable": { + "description": "Возвращает список доступных навыков, которые могут быть использованы агентами ИИ." + }, + "taskContextSummary": { + "description": "Разрешает все элементы контекста задачи, присутствующие в контексте сеанса." + }, + "templateSettings": { + "edited": "отредактированный", + "unavailableVariant": "Выбранный вариант больше не доступен" + }, + "todayVariable": { + "description": "Делает что-то на сегодня", + "format": { + "description": "Формат даты" + } + }, + "unableToDisplayVariableValue": "Невозможно отобразить значение переменной.", + "unableToResolveVariable": "Невозможно разрешить переменную.", + "variable-contribution": { + "builtInVariable": "Встраиваемый вариатор Theia", + "currentAbsoluteFilePath": "Абсолютный путь к открытому в данный момент файлу. Обратите внимание, что большинство агентов ожидают относительный путь к файлу (относительно текущей рабочей области).", + "currentFileContent": "Обычное содержимое открытого в данный момент файла. При этом исключается информация о том, откуда взято содержимое. Обратите внимание, что большинство агентов лучше работают с относительным путем к файлу (относительно текущей рабочей области).", + "currentRelativeDirPath": "Относительный путь к директории, содержащей открытый в данный момент файл.", + "currentRelativeFilePath": "Относительный путь к открытому в данный момент файлу.", + "currentSelectedText": "Обычный текст, который в данный момент выделен в открытом файле. При этом не учитывается информация о том, откуда взято содержимое. Обратите внимание, что большинство агентов лучше работают с относительным путем к файлу (относительно текущей рабочей области).", + "dotRelativePath": "Короткая ссылка на относительный путь к открытому в данный момент файлу ('currentRelativeFilePath')." + } + }, + "editor": { + "editorContextVariable": { + "description": "Устранение контекстной информации, специфичной для редактора", + "label": "EditorContext" + }, + "explainWithAI": { + "prompt": "Объясните эту ошибку", + "title": "Объясните с помощью искусственного интеллекта" + }, + "fixWithAI": { + "prompt": "Помогите исправить эту ошибку" + } + }, + "google": { + "apiKey": { + "description": "Введите API-ключ вашего официального аккаунта Google AI (Gemini). **Примечание:** При использовании этого параметра ключ API GOOGLE AI будет храниться открытым текстом на машине, на которой запущена Theia. Используйте переменную окружения `GOOGLE_API_KEY` для безопасной установки ключа." + }, + "maxRetriesOnErrors": { + "description": "Максимальное количество повторных попыток в случае ошибок. Если меньше 1, то логика повторных попыток отключена" + }, + "models": { + "description": "Официальные модели Google Gemini для использования" + }, + "retryDelayOnOtherErrors": { + "description": "Задержка в секундах между повторными попытками в случае других ошибок (иногда Google GenAI сообщает о таких ошибках, как неполный синтаксис JSON, возвращенный из модели, или 500 Internal Server Error). Установка значения -1 предотвращает повторные попытки в этих случаях. В противном случае повторная попытка произойдет либо сразу (если установлено значение 0), либо через указанную задержку в секундах (если установлено положительное число)." + }, + "retryDelayOnRateLimitError": { + "description": "Задержка в секундах между повторными попытками в случае ошибок ограничения скорости. См. https://ai.google.dev/gemini-api/docs/rate-limits" + } + }, + "history": { + "clear": { + "tooltip": "Очистить историю всех агентов" + }, + "exchange-card": { + "agentId": "Агент", + "timestamp": "Начало" + }, + "open-history-tooltip": "Открытая история искусственного интеллекта...", + "request-card": { + "agent": "Агент", + "model": "Модель", + "request": "Запрос", + "response": "Ответ", + "timestamp": "Временная метка", + "title": "Запрос" + }, + "sortChronologically": { + "tooltip": "Сортировать в хронологическом порядке" + }, + "sortReverseChronologically": { + "tooltip": "Сортировка в обратном хронологическом порядке" + }, + "toggleCompact": { + "tooltip": "Показать компактный вид" + }, + "toggleHideNewlines": { + "tooltip": "Прекратите интерпретировать новые строки" + }, + "toggleRaw": { + "tooltip": "Показать необработанный вид" + }, + "toggleRenderNewlines": { + "tooltip": "Интерпретировать новые строки" + }, + "view": { + "label": "✨ История агента ИИ [Альфа]", + "noAgent": "Агент не доступен.", + "noAgentSelected": "Агент не выбран.", + "noHistoryForAgent": "Нет истории для выбранного агента '{0}'" + } + }, + "huggingFace": { + "apiKey": { + "mdDescription": "Введите API-ключ для вашей учетной записи Hugging Face. **Обратите внимание:** При использовании этого параметра ключ API Hugging Face будет храниться открытым текстом на машине, на которой установлена Theia. Используйте переменную окружения `HUGGINGFACE_API_KEY` для безопасной установки ключа." + }, + "models": { + "mdDescription": "Модели Hugging Face для использования. **Обратите внимание:** в настоящее время поддерживаются только модели, поддерживающие API завершения чата (модели, настроенные на инструкции, такие как `*-Instruct`). Для некоторых моделей может потребоваться принятие условий лицензии на веб-сайте Hugging Face." + } + }, + "ide": { + "agent-description": "Настройте параметры агента AI, включая включение, выбор LLM, настройку шаблона подсказки и создание пользовательского агента в окне [AI Configuration View] ({0}).", + "agentConfiguration": { + "customAgentLocationQuickPick": { + "createNewFile": "Создать новый файл", + "openExistingFile": "Открыть существующий файл", + "placeholder": "Выберите, где создать или открыть файл пользовательских агентов", + "title": "Выберите местоположение файла пользовательских агентов" + }, + "noDescription": "Описание отсутствует" + }, + "app-tester": { + "errorCheckingDevToolsServerStatus": "Ошибка проверки состояния сервера DevTools MCP: {0}", + "errorCheckingPlaywrightServerStatus": "Ошибка при проверке состояния сервера Playwright MCP: {0}", + "startChromeDevToolsMcpServers": { + "canceled": "Настройте сервер Chrome DevTools MCP.", + "error": "Не удалось запустить сервер Chrome DevTools MCP: {0}", + "progress": "Запуск сервера Chrome DevTools MCP.", + "question": "Сервер Chrome DevTools MCP не запущен. Хотите запустить его сейчас? Это может привести к установке сервера Chrome DevTools MCP." + }, + "startMcpServers": { + "no": "Нет, отменить", + "yes": "Да, запустите серверы" + }, + "startPlaywrightServers": { + "canceled": "Пожалуйста, настройте серверы MCP.", + "error": "Не удалось запустить сервер Playwright MCP: {0}", + "progress": "Запуск серверов Playwright MCP.", + "question": "Серверы Playwright MCP не запущены. Не хотите ли вы запустить их сейчас? Это может привести к установке серверов Playwright MCP." + } + }, + "architectAgent": { + "mode": { + "default": "Режим по умолчанию", + "plan": "План «Мода»", + "simple": "Простой режим" + }, + "suggestion": { + "executePlanWithCoder": "Выполнить «{0}» с помощью Coder", + "summarizeSessionAsTaskForCoder": "Подведите итоги этой сессии в виде задания для Кодера", + "updateTaskContext": "Обновление текущего контекста задачи" + } + }, + "bypassHint": "Некоторые агенты, такие как Claude Code, не требуют языковых моделей Theia.", + "chatDisabledMessage": { + "featuresTitle": "В настоящее время поддерживаемые представления и функции:" + }, + "coderAgent": { + "mode": { + "agentNext": "Режим агента (Далее)", + "edit": "Режим редактирования" + }, + "suggestion": { + "fixProblems": { + "content": "[Устранить проблемы]({0}) в текущем файле.", + "prompt": "пожалуйста, посмотрите на {1} и устраните все проблемы." + }, + "startNewChat": "Делайте чаты короткими и целенаправленными. [Начните новый чат]({0}) для новой задачи или [начните новый чат с кратким изложением этой задачи]({1})." + } + }, + "commandAgent": { + "commandCallback": { + "confirmAction": "Есть", + "label": "Команда ИИ" + }, + "response": { + "customHandler": "Попробуйте выполнить это:", + "noCommand": "Извините, я не могу найти такую команду.", + "theiaCommand": "Я нашел эту команду, которая может вам помочь:" + }, + "vars": { + "commandIds": { + "description": "Список доступных команд в Theia." + } + } + }, + "configureAgent": { + "header": "Настройка агента по умолчанию" + }, + "continueAnyway": "Продолжить все равно", + "createSkillAgent": { + "mode": { + "edit": "Режим по умолчанию" + } + }, + "enableAI": { + "mdDescription": "❗ Эта настройка позволяет получить доступ к последним возможностям искусственного интеллекта (бета-версия). \n Обратите внимание, что эти функции находятся на стадии бета-версии, а это значит, что они могут претерпевать изменения и будут совершенствоваться. Важно знать, что эти функции могут генерировать постоянные запросы к языковым моделям (LLM), к которым вы предоставляете доступ. Это может повлечь за собой расходы, которые вам необходимо тщательно отслеживать. Включая эту опцию, вы признаете эти риски. \n ** Обратите внимание! Настройки, приведенные ниже в этом разделе, вступят в силу только\n после включения основной настройки функции. После включения функции необходимо настроить хотя бы одного провайдера LLM, описанного ниже. Также смотрите [документацию](https://theia-ide.org/docs/user_ai/)**." + }, + "github": { + "configureGitHubServer": { + "canceled": "Конфигурация сервера GitHub отменена. Пожалуйста, настройте MCP-сервер GitHub для использования этого агента.", + "no": "Нет, отмена", + "yes": "Да, настройте сервер GitHub" + }, + "errorCheckingGitHubServerStatus": "Ошибка при проверке состояния сервера GitHub MCP: {0}", + "startGitHubServer": { + "canceled": "Чтобы использовать этот агент, запустите сервер GitHub MCP.", + "error": "Не удалось запустить сервер GitHub MCP: {0}", + "no": "Нет, отмена", + "progress": "Запуск сервера GitHub MCP.", + "question": "Сервер GitHub MCP настроен, но не запущен. Не хотите ли вы запустить его сейчас?", + "yes": "Да, запустите сервер" + } + }, + "githubRepoName": { + "description": "Имя текущего репозитория GitHub (например, \"eclipse-theia/theia\")." + }, + "model-selection-description": "Выберите, какие большие языковые модели (LLM) будут использоваться каждым агентом ИИ, в окне [AI Configuration View] ({0}).", + "moreAgentsAvailable": { + "header": "Доступно больше агентов" + }, + "noRecommendedAgents": "Рекомендуемые агенты отсутствуют.", + "openSettings": "Открыть настройки AI", + "or": "или", + "orchestrator": { + "error": { + "noAgents": "Нет доступного агента чата для обработки запроса. Проверьте, включены ли они в вашей конфигурации." + }, + "progressMessage": "Определение наиболее подходящего агента", + "response": { + "delegatingToAgent": "Делегирование полномочий `@{0}`." + } + }, + "prompt-template-description": "Выберите варианты подсказок и настройте шаблоны подсказок для агентов ИИ в окне [AI Configuration View] ({0}).", + "recommendedAgents": "Рекомендуемые агенты:", + "skillsConfiguration": { + "label": "Навыки", + "location": { + "label": "Местоположение" + } + }, + "toolsConfiguration": { + "confirmAlwaysAllow": { + "confirm": "Я понимаю, включить автоматическое одобрение", + "title": "Включить автоматическое одобрение для «{0}»?" + }, + "confirmationMode": { + "label": "Режим подтверждения" + }, + "default": { + "label": "Режим подтверждения инструмента по умолчанию:" + }, + "resetAll": "Сбросить все", + "resetAllConfirmDialog": { + "msg": "Вы уверены, что хотите сбросить все режимы подтверждения инструмента к значениям по умолчанию? Это приведет к удалению всех пользовательских настроек.", + "title": "Сброс всех режимов подтверждения инструмента" + }, + "resetAllTooltip": "Сбросьте настройки всех инструментов по умолчанию", + "toolOptions": { + "confirm": { + "label": "Подтвердите" + } + } + }, + "variableConfiguration": { + "selectVariable": "Выберите переменную.", + "usedByAgents": "Используется агентами", + "variableArgs": "Аргументы переменных" + } + }, + "llamaFile": { + "prefs": { + "mdDescription": "Этот параметр позволяет настраивать и управлять моделями LlamaFile в Theia IDE. \n Каждая запись требует удобного для пользователя `имени`, файла `uri`, указывающего на ваш LlamaFile, и `порта`, на котором он будет запущен. \n Чтобы запустить LlamaFile, используйте команду \"Start LlamaFile\", которая позволяет выбрать нужную модель. \n Если вы отредактируете запись (например, измените порт), любой запущенный экземпляр остановится, и вам придется вручную запустить его снова. \n [Подробнее о настройке и управлении LlamaFiles в документации к Theia IDE](https://theia-ide.org/docs/user_ai/#llamafile-models).", + "name": { + "description": "Имя модели, которое будет использоваться для этого Llamafile." + }, + "port": { + "description": "Порт, который будет использоваться для запуска сервера." + }, + "title": "✨ AI LlamaFile", + "uri": { + "description": "Ури файла к файлу Llamafile." + } + }, + "start": "Запустите Llamafile", + "stop": "Остановить Llamafile" + }, + "llamafile": { + "error": { + "noConfigured": "Llamafiles не настроен.", + "noRunning": "Llamafiles не запущен.", + "startFailed": "Что-то пошло не так во время запуска llamafile: {0}.\nДля получения дополнительной информации см. консоль.", + "stopFailed": "Что-то пошло не так во время остановки llamafile: {0}.\nДля получения дополнительной информации см. консоль." + } + }, + "mcp": { + "error": { + "allServersRunning": "Все серверы MCP уже запущены.", + "noRunningServers": "Серверы MCP не запущены.", + "noServersConfigured": "Серверы MCP не настроены.", + "startFailed": "При запуске сервера MCP произошла ошибка." + }, + "info": { + "serverStarted": "Сервер MCP \"{0}\" успешно запущен. Зарегистрированные инструменты: {1}" + }, + "servers": { + "args": { + "mdDescription": "Массив аргументов для передачи команде.", + "title": "Аргументы для команды" + }, + "autostart": { + "mdDescription": "Автоматически запускать этот сервер при запуске фронтенда. Вновь добавленные серверы запускаются автоматически не сразу, а при перезапуске", + "title": "Автозапуск" + }, + "command": { + "mdDescription": "Команда, используемая для запуска сервера MCP, например, \"uvx\" или \"npx\".", + "title": "Команда для выполнения сервера MCP" + }, + "env": { + "mdDescription": "Необязательные переменные окружения, которые необходимо задать для сервера, например, ключ API.", + "title": "Переменные среды" + }, + "headers": { + "mdDescription": "Необязательные дополнительные заголовки, включаемые в каждый запрос к серверу.", + "title": "Заголовки" + }, + "mdDescription": "Настройте MCP-серверы с помощью команды, аргументов, опционально переменных окружения и автозапуска (по умолчанию true). Каждый сервер идентифицируется уникальным ключом, например \"brave-search\" или \"filesystem\". Чтобы запустить сервер, используйте команду \"MCP: Start MCP Server\", которая позволяет выбрать нужный сервер. Чтобы остановить сервер, используйте команду \"MCP: Stop MCP Server\". Обратите внимание, что автозапуск вступает в силу только после перезапуска, в первый раз вам необходимо запустить сервер вручную.\nПример конфигурации:\n```{\n \"brave-search\": {\n \"command\": \"npx\",\n \"args\": [\n \"-y\",\n \"@modelcontextprotocol/server-brave-search\"\n ],\n \"env\": {\n \"BRAVE_API_KEY\": \"YOUR_API_KEY\"\n },\n },\n \"filesystem\": {\n \"command\": \"npx\",\n \"args\": [\"-y\", \"@modelcontextprotocol/server-filesystem\", \"/Users/YOUR_USERNAME/Desktop\"],\n \"env\": {\n \"CUSTOM_ENV_VAR\": \"custom-value\"\n },\n \"autostart\": false\n }\n}\n```", + "serverAuthToken": { + "mdDescription": "Токен аутентификации для сервера, если требуется. Он используется для аутентификации на удаленном сервере.", + "title": "Токен аутентификации" + }, + "serverAuthTokenHeader": { + "mdDescription": "Имя заголовка, которое будет использоваться для маркера аутентификации сервера. Если оно не указано, будет использоваться \"Authorization\" с \"Bearer\".", + "title": "Имя заголовка аутентификации" + }, + "serverUrl": { + "mdDescription": "URL-адрес удаленного сервера MCP. Если он указан, сервер будет подключаться к этому URL вместо запуска локального процесса.", + "title": "URL-адрес сервера" + }, + "title": "Конфигурация серверов MCP" + }, + "start": { + "label": "MCP: Запуск сервера MCP" + }, + "stop": { + "label": "MCP: Остановка сервера MCP" + } + }, + "mcpConfiguration": { + "arguments": "Аргументы: ", + "autostart": "Автозапуск: ", + "connectServer": "Connnect", + "connectingServer": "Подключение...", + "copiedAllList": "Копирование всех инструментов в буфер обмена (список всех инструментов)", + "copiedAllSingle": "Копирование всех инструментов в буфер обмена (один фрагмент подсказки со всеми инструментами)", + "copiedForPromptTemplate": "Копирование всех инструментов в буфер обмена для шаблона подсказки (один фрагмент подсказки со всеми инструментами)", + "copyAllList": "Копировать все (список всех инструментов)", + "copyAllSingle": "Копировать все для чата (один фрагмент подсказки со всеми инструментами)", + "copyForPrompt": "Инструмент копирования (для шаблона чата или подсказки)", + "copyForPromptTemplate": "Копировать все для шаблона подсказки (один фрагмент подсказки со всеми инструментами)", + "environmentVariables": "Переменные среды: ", + "headers": "Заголовки: ", + "noServers": "Серверы MCP не настроены", + "serverAuthToken": "Токен аутентификации: ", + "serverAuthTokenHeader": "Заголовок аутентификации Имя: ", + "serverUrl": "URL-адрес сервера: ", + "tools": "Инструменты: " + }, + "openai": { + "apiKey": { + "mdDescription": "Введите API-ключ вашего официального аккаунта OpenAI. **Примечание:** При использовании этого параметра ключ Open AI API будет храниться открытым текстом на машине, на которой запущена Theia. Используйте переменную окружения `OPENAI_API_KEY` для безопасной установки ключа." + }, + "customEndpoints": { + "apiKey": { + "title": "Либо ключ для доступа к API, обслуживаемому по указанному url, либо `true` для использования глобального ключа API OpenAI" + }, + "apiVersion": { + "title": "Либо версия для доступа к API, обслуживаемому по указанному url в Azure, либо `true` для использования глобальной версии API OpenAI" + }, + "deployment": { + "title": "Имя развертывания для доступа к API, обслуживаемому по заданному url в Azure" + }, + "developerMessageSettings": { + "title": "Управляет обработкой системных сообщений: `user`, `ystem` и `developer` будут использоваться в качестве роли, `mergeWithFollowingUserMessage` будет префиксировать следующее сообщение пользователя системным сообщением или преобразовывать системное сообщение в пользовательское, если следующее сообщение не является пользовательским. `skip` просто удалит системное сообщение), по умолчанию `developer`." + }, + "enableStreaming": { + "title": "Указывает, будет ли использоваться потоковый API. По умолчанию `true`." + }, + "id": { + "title": "Уникальный идентификатор, который используется в пользовательском интерфейсе для идентификации пользовательской модели" + }, + "mdDescription": "Интегрируйте пользовательские модели, совместимые с API OpenAI, например, через `vllm`. Необходимыми атрибутами являются `model` и `url`. \n В качестве опции можно \n - указать уникальный `id` для идентификации пользовательской модели в пользовательском интерфейсе. Если он не указан, то в качестве `id` будет использоваться `model`. \n - Укажите `apiKey` для доступа к API, обслуживаемому по указанному url. Используйте `true`, чтобы указать на использование глобального ключа API OpenAI. \n - укажите `apiVersion` для доступа к API, обслуживаемому по указанному url в Azure. Используйте `true`, чтобы указать на использование глобальной версии API OpenAI. \n - установите `developerMessageSettings` в одно из значений `user`, `ystem`, `developer`, `mergeWithFollowingUserMessage` или `skip`, чтобы контролировать включение сообщения разработчика (где `user`, `ystem` и `developer` будут использоваться в качестве роли, `mergeWithFollowingUserMessage` будет префиксировать следующее сообщение пользователя системным сообщением или преобразовывать системное сообщение в пользовательское, если следующее сообщение не является пользовательским сообщением. `skip` просто удалит системное сообщение). По умолчанию используется `developer`. \n - Укажите `supportsStructuredOutput: false`, чтобы указать, что структурированный вывод не должен использоваться. \n - укажите `enableStreaming: false`, чтобы указать, что потоковая передача не должна использоваться. \n Дополнительную информацию см. в [нашей документации](https://theia-ide.org/docs/user_ai/#openai-compatible-models-eg-via-vllm).", + "modelId": { + "title": "ID модели" + }, + "supportsStructuredOutput": { + "title": "Указывает, поддерживает ли модель структурированный вывод. По умолчанию `true`." + }, + "url": { + "title": "Конечная точка, совместимая с Open AI API, на которой размещена модель" + } + }, + "models": { + "description": "Официальные модели OpenAI для использования" + }, + "useResponseApi": { + "mdDescription": "Используйте более новый OpenAI Response API вместо Chat Completion API для официальных моделей OpenAI. Эта настройка применима только к официальным моделям OpenAI - пользовательские провайдеры должны настраивать ее индивидуально." + } + }, + "promptTemplates": { + "directories": { + "title": "Каталоги шаблонов подсказок для конкретного рабочего пространства" + }, + "extensions": { + "description": "Список дополнительных расширений файлов в местах расположения подсказок, которые рассматриваются как шаблоны подсказок. '.prompttemplate' всегда рассматривается по умолчанию.", + "title": "Дополнительные расширения файлов шаблона Prompt" + }, + "files": { + "title": "Файлы шаблонов подсказок для конкретного рабочего пространства" + } + }, + "scanoss": { + "changeSet": { + "clean": "Нет совпадений", + "error": "Ошибка: повторный запуск", + "error-notification": "Возникла ошибка ScanOSS: {0}.", + "match": "Посмотреть совпадения", + "scan": "Сканирование", + "scanning": "Сканирование..." + }, + "mode": { + "automatic": { + "description": "Включите автоматическое сканирование фрагментов кода в представлениях чата." + }, + "description": "Настройте функцию SCANOSS для анализа фрагментов кода в представлениях чата. При этом хэш предложенных фрагментов кода будет отправлен на сервис SCANOSS\nразмещенному на сервисе [Software Transparency Foundation](https://www.softwaretransparency.org/osskb) для анализа.", + "manual": { + "description": "Пользователь может вручную запустить сканирование, нажав на элемент SCANOSS в режиме просмотра чата." + }, + "off": { + "description": "Функция полностью отключена." + } + }, + "snippet": { + "dialog-header": "Результаты ScanOSS", + "errored": "SCANOSS - Ошибка - {0}", + "file-name-heading": "Соответствие найдено в {0}", + "in-progress": "SCANOSS - Выполнение сканирования...", + "match-count": "Найдено совпадение(я) {0} ", + "matched": "SCANOSS - Найдено совпадение {0} ", + "no-match": "SCANOSS - нет совпадений", + "summary": "Резюме" + } + }, + "session-settings-dialog": { + "title": "Настройка параметров сеанса", + "tooltip": "Настройка параметров сеанса" + }, + "terminal": { + "agent": { + "description": "Этот агент помогает писать и выполнять произвольные команды терминала. Основываясь на запросе пользователя, он предлагает команды и позволяет пользователю непосредственно вставить и выполнить их в терминале. Он получает доступ к текущему каталогу, окружению и последним выводам терминальной сессии, чтобы предоставить помощь с учетом контекста.", + "vars": { + "cwd": { + "description": "Текущий рабочий каталог." + }, + "recentTerminalContents": { + "description": "Последние от 0 до 50 последних строк, видимых в терминале." + }, + "shell": { + "description": "Используемая оболочка, например, /usr/bin/zsh." + }, + "userRequest": { + "description": "Вопрос или просьба пользователя." + } + } + }, + "askAi": "Спросите ИИ", + "askTerminalCommand": "Спросите о команде терминала...", + "hitEnterConfirm": "Нажмите Enter для подтверждения", + "howCanIHelp": "Чем я могу вам помочь?", + "loading": "Загрузка", + "tryAgain": "Попробуйте еще раз...", + "useArrowsAlternatives": " или используйте ⇅, чтобы показать альтернативные варианты..." + }, + "tokenUsage": { + "cachedInputTokens": "Входные маркеры записываются в кэш", + "cachedInputTokensTooltip": "Отслеживается дополнительно к \"Входным токенам\". Обычно дороже, чем токены без кэша.", + "failedToGetTokenUsageData": "Не удалось получить данные об использовании токена: {0}", + "inputTokens": "Входные лексемы", + "label": "Использование токена", + "lastUsed": "Последнее использование", + "model": "Модель", + "noData": "Данные об использовании токенов пока отсутствуют.", + "note": "Использование токена отслеживается с момента запуска приложения и не сохраняется.", + "outputTokens": "Выходные маркеры", + "readCachedInputTokens": "Входные токены, считанные из кэша", + "readCachedInputTokensTooltip": "Отслеживается дополнительно к 'Input Token'. Обычно обходится гораздо дешевле, чем без кэширования. Обычно не учитывается в ограничениях скорости.", + "total": "Всего", + "totalTokens": "Всего токенов", + "totalTokensTooltip": "'Входные токены' + 'Выходные токены'" + }, + "vercelai": { + "anthropicApiKey": { + "mdDescription": "Введите ключ API для антропных моделей. **Примечание:** При использовании этого параметра ключ API будет храниться открытым текстом на машине, на которой запущена Theia. Используйте переменную окружения `ANTHROPIC_API_KEY` для безопасной установки ключа." + }, + "customEndpoints": { + "apiKey": { + "title": "Либо ключ для доступа к API, обслуживаемому по указанному url, либо `true` для использования глобального ключа API" + }, + "enableStreaming": { + "title": "Указывает, будет ли использоваться потоковый API. По умолчанию `true`." + }, + "id": { + "title": "Уникальный идентификатор, который используется в пользовательском интерфейсе для идентификации пользовательской модели" + }, + "mdDescription": "Интегрируйте пользовательские модели, совместимые с Vercel AI SDK. Необходимыми атрибутами являются `model` и `url`. \n В качестве опции вы можете \n - указать уникальный `id` для идентификации пользовательской модели в пользовательском интерфейсе. Если он не указан, то в качестве `id` будет использоваться `model`. \n - Укажите `apiKey` для доступа к API, обслуживаемому по указанному url. Используйте `true`, чтобы указать на использование глобального ключа API. \n - укажите `supportsStructuredOutput: false`, чтобы указать, что структурированный вывод не будет использоваться. \n - укажите `enableStreaming: false`, чтобы указать, что потоковая передача не должна использоваться. \n - укажите `provider`, чтобы указать, от какого провайдера получена модель (openai, anthropic).", + "modelId": { + "title": "ID модели" + }, + "supportsStructuredOutput": { + "title": "Указывает, поддерживает ли модель структурированный вывод. По умолчанию `true`." + }, + "url": { + "title": "Конечная точка API, на которой размещена модель" + } + }, + "models": { + "description": "Официальные модели для использования с Vercel AI SDK", + "id": { + "title": "ID модели" + }, + "model": { + "title": "Название модели" + } + }, + "openaiApiKey": { + "mdDescription": "Введите ключ API для моделей OpenAI. **Примечание:** При использовании этого параметра ключ API будет храниться открытым текстом на машине, на которой запущена Theia. Используйте переменную окружения `OPENAI_API_KEY` для безопасной установки ключа." + } + }, + "workspace": { + "coderAgent": { + "description": "ИИ-ассистент, интегрированный в Theia IDE и предназначенный для помощи разработчикам программного обеспечения. Этот агент может получить доступ к рабочему пространству пользователя, получить список всех доступных файлов и папок и извлечь их содержимое. Кроме того, он может предлагать пользователю модификации файлов. Таким образом, он может помочь пользователю в решении задач кодирования или других задач, связанных с изменением файлов." + }, + "considerGitignore": { + "description": "Если включено, исключает файлы/папки, указанные в глобальном файле .gitignore (предполагаемое местоположение - корень рабочего пространства).", + "title": "Рассмотрим .gitignore" + }, + "excludedPattern": { + "description": "Список шаблонов (glob или regex) для файлов/папок, которые нужно исключить.", + "title": "Исключенные шаблоны файлов" + }, + "searchMaxResults": { + "description": "Максимальное количество результатов поиска, возвращаемых функцией поиска по рабочему пространству.", + "title": "Максимальные результаты поиска" + }, + "workspaceAgent": { + "description": "ИИ-ассистент, интегрированный в Theia IDE и предназначенный для помощи разработчикам программного обеспечения. Этот агент может получить доступ к рабочему пространству пользователя, получить список всех доступных файлов и папок и извлечь их содержимое. Он не может изменять файлы. Поэтому он может отвечать на вопросы о текущем проекте, файлах проекта и исходном коде в рабочей области, например, как собрать проект, куда поместить исходный код, где найти определенный код или конфигурации и т. д." + } + } + }, + "ai-chat": { + "fileChangeSetTitle": "Предлагаемые изменения" + }, + "ai-chat-ui": { + "initiate-session-task-context": "Контекст задачи: Начать сеанс", + "open-current-session-summary": "Открытая сводка текущей сессии", + "open-settings-tooltip": "Откройте настройки ИИ...", + "scroll-lock": "Прокрутка замка", + "scroll-unlock": "Разблокировать свиток", + "session-settings": "Настройка параметров сеанса", + "showChats": "Показать чаты...", + "summarize-current-session": "Подведение итогов текущей сессии" + }, + "ai-claude-code": { + "open-config": "Конфигурация открытого кода Клода", + "open-memory": "Откройте память кода Клода (CLAUDE.MD)" + }, + "ai-core": { + "agentCompletionMessage": "Агент \"{0}\" выполнил свою задачу.", + "agentCompletionTitle": "Агент \"{0}\" Задание выполнено", + "agentCompletionWithTask": "Агент \"{0}\" выполнил задание: {1}" + }, + "ai-editor": { + "contextMenu": "Спросите ИИ", + "sendToChat": "Отправить в чат AI" + }, + "ai-ide": { + "addressGhReviewCommand": { + "argumentHint": "", + "description": "Ответьте на комментарии к запросу на слияние в GitHub" + }, + "fixGhTicketCommand": { + "argumentHint": "", + "description": "Проанализируйте заявку GitHub и реализуйте решение" + }, + "open-agent-settings-tooltip": "Откройте настройки агента...", + "rememberCommand": { + "argumentHint": "[topic-hint]", + "description": "Извлекать темы из разговоров и обновлять информацию о проекте" + }, + "ticketCommand": { + "argumentHint": "", + "description": "Проанализируйте заявку GitHub и создайте план реализации" + }, + "todoTool": { + "noTasks": "Нет задач" + }, + "withAppTesterCommand": { + "description": "Передача тестирования агенту AppTester (требуется режим агента)" + } + }, + "ai-mcp": { + "blockedServersLabel": "Серверы MCP (автозапуск заблокирован)" + }, + "ai-terminal": { + "cancelExecution": "Отменить выполнение команды", + "canceling": "Отмена...", + "confirmExecution": "Подтвердить команду Shell", + "denialReason": "Причина", + "executionCanceled": "Отменено", + "executionDenied": "Отклонено", + "executionDeniedWithReason": "Отклонено с обоснованием", + "noOutput": "Нет вывода", + "partialOutput": "Частичный вывод", + "timeout": "Таймаут", + "workingDirectory": "Рабочий каталог" + }, + "callhierarchy": { + "noCallers": "Вызывающих не обнаружено.", + "open": "Иерархия открытых звонков" + }, + "chat": { + "taskContextVariable": { + "args": { + "contextId": { + "description": "Идентификатор контекста задачи для извлечения или сеанса чата для подведения итогов." + } + }, + "description": "Предоставляет контекстную информацию для задания, например, план выполнения задания или резюме предыдущих занятий", + "label": "Контекст задачи" + } + }, + "collaboration": { + "collaborate": "Сотрудничайте", + "collaboration": "Сотрудничество", + "collaborationWorkspace": "Рабочее пространство для совместной работы", + "connected": "Подключено", + "connectedSession": "Подключение к сеансу совместной работы", + "copiedInvitation": "Код приглашения скопирован в буфер обмена.", + "copyAgain": "Повторная копия", + "createRoom": "Создать новый сеанс совместной работы", + "creatingRoom": "Создание сессии", + "end": "Завершение сеанса совместной работы", + "endDetail": "Прервите сеанс, прекратите обмен содержимым и отмените доступ для других.", + "enterCode": "Введите код сеанса совместной работы", + "failedCreate": "Не удалось создать комнату: {0}", + "failedJoin": "Не удалось присоединиться к комнате: {0}", + "fieldRequired": "Поле {0} является обязательным. Вход в систему прерван.", + "invite": "Пригласите других", + "inviteDetail": "Скопируйте код приглашения, чтобы поделиться им с другими людьми и присоединиться к сеансу.", + "joinRoom": "Присоединяйтесь к сессии совместной работы", + "joiningRoom": "Присоединение к сессии", + "leave": "Оставьте сессию совместной работы", + "leaveDetail": "Отключитесь от текущего сеанса совместной работы и закройте рабочую область.", + "loginFailed": "Вход в систему не удался.", + "loginSuccessful": "Вход в систему успешный.", + "noAuth": "Сервер не предоставляет метод аутентификации.", + "optional": "опция", + "selectAuth": "Выберите метод аутентификации", + "selectCollaboration": "Выберите вариант сотрудничества", + "serverUrl": "URL-адрес сервера", + "serverUrlDescription": "URL-адрес экземпляра сервера Open Collaboration Tools Server для сеансов совместной работы в реальном времени", + "sharedSession": "Совместная сессия сотрудничества", + "startSession": "Начать или присоединиться к сеансу совместной работы", + "userWantsToJoin": "Пользователь '{0}' хочет присоединиться к комнате для совместной работы", + "whatToDo": "Что бы вы хотели сделать с другими соавторами?" + }, + "core": { + "about": { + "compatibility": "{0} Совместимость", + "defaultApi": "По умолчанию {0} API", + "listOfExtensions": "Список расширений" + }, + "common": { + "closeAll": "Закрыть все вкладки", + "closeAllTabMain": "Закрыть все вкладки в основной области", + "closeOtherTabMain": "Закрыть другие вкладки в основной области", + "closeOthers": "Закрыть другие вкладки", + "closeRight": "Закрыть вкладки справа", + "closeTab": "Закрыть вкладку", + "closeTabMain": "Закрыть вкладку в основной области", + "collapseAllTabs": "Свернуть все боковые панели", + "collapseBottomPanel": "Переключаемая нижняя панель", + "collapseLeftPanel": "Переключение левой панели", + "collapseRightPanel": "Переключение правой панели", + "collapseTab": "Разваливающаяся боковая панель", + "showNextTabGroup": "Переход к следующей группе вкладок", + "showNextTabInGroup": "Переход на следующую вкладку в группе", + "showPreviousTabGroup": "Переход к предыдущей группе вкладок", + "showPreviousTabInGroup": "Переход на предыдущую вкладку в группе", + "toggleMaximized": "Переключение максимизации" + }, + "copyInfo": "Сначала откройте файл, чтобы скопировать его путь", + "copyWarn": "Пожалуйста, используйте команду копирования или ярлык браузера.", + "cutWarn": "Используйте команду \"Вырезать\" или ярлык браузера.", + "enhancedPreview": { + "classic": "Отображение простого предварительного просмотра вкладки с основной информацией.", + "enhanced": "Отображение расширенного предварительного просмотра вкладки с дополнительной информацией.", + "visual": "Отображение визуального предварительного просмотра вкладки." + }, + "file": { + "browse": "Просмотреть" + }, + "highlightModifiedTabs": "Управляет тем, будет ли рисоваться верхняя граница на измененных (грязных) вкладках редактора или нет.", + "keybinding": { + "duplicateModifierError": "Невозможно разобрать привязку клавиш {0} Дублирование модификаторов", + "metaError": "Невозможно разобрать привязку клавиш {0} meta только для OSX", + "unrecognizedKeyError": "Непризнанные ключевые {0} в {1}" + }, + "keybindingStatus": "{0} было нажато, ожидание других клавиш", + "keyboard": { + "choose": "Выберите раскладку клавиатуры", + "chooseLayout": "Выберите раскладку клавиатуры", + "current": "(текущий: {0})", + "currentLayout": " - текущий макет", + "mac": "Клавиатуры Mac", + "pc": "Клавиатуры для ПК", + "tryDetect": "Попытайтесь определить раскладку клавиатуры по информации браузера и нажатым клавишам." + }, + "navigator": { + "clipboardWarn": "Доступ к буферу обмена запрещен. Проверьте разрешение вашего браузера.", + "clipboardWarnFirefox": "API буфера обмена недоступен. Его можно включить с помощью '{0}' привилегии на странице '{1}'. Затем перезагрузите Theia. Обратите внимание, это позволит FireFox получить полный доступ к системному буферу обмена." + }, + "offline": "Offline", + "pasteWarn": "Пожалуйста, используйте команду \"Вставить\" или ярлык браузера.", + "quitMessage": "Любые несохраненные изменения не будут сохранены.", + "resetWorkbenchLayout": "Сброс макета верстака", + "searchbox": { + "close": "Закрыть (побег)", + "next": "Далее (вниз)", + "previous": "Предыдущий (Вверх)", + "showAll": "Показать все элементы", + "showOnlyMatching": "Показать только подходящие товары" + }, + "secondaryWindow": { + "alwaysOnTop": "Если эта функция включена, вторичное окно остается выше всех остальных окон, в том числе окон различных приложений.", + "description": "Устанавливает начальное положение и размер извлеченного вторичного окна.", + "fullSize": "Положение и размер извлеченного виджета будут такими же, как и в запущенном приложении Theia.", + "halfWidth": "Положение и размер извлеченного виджета будут равны половине ширины запущенного приложения Theia.", + "originalSize": "Положение и размер извлеченного виджета будут такими же, как у исходного." + }, + "severity": { + "log": "Журнал" + }, + "silentNotifications": "Управляет тем, следует ли подавлять всплывающие окна уведомлений.", + "tabDefaultSize": "Определяет размер по умолчанию для вкладок.", + "tabMaximize": "Управляет тем, следует ли максимизировать вкладки при двойном щелчке.", + "tabMinimumSize": "Определяет минимальный размер вкладок.", + "tabShrinkToFit": "Сожмите вкладки, чтобы они соответствовали свободному пространству.", + "window": { + "tabCloseIconPlacement": { + "description": "Разместите значки закрытия на заголовках вкладок в начале или в конце вкладки. По умолчанию на всех платформах используется конец.", + "end": "Поместите значок закрытия в конце ярлыка. В языках с лево-правой ориентацией это правая сторона вкладки.", + "start": "Поместите значок закрытия в начало ярлыка. В языках с лево-правой ориентацией это левая сторона вкладки." + } + }, + "window.menuBarVisibility": "Меню отображается в виде компактной кнопки на боковой панели. Это значение игнорируется, когда{0} равно {1}." + }, + "debug": { + "TheiaIDE": "Theia IDE", + "addConfigurationPlaceholder": "Выберите корень рабочего пространства для добавления конфигурации", + "breakpoint": "точка останова", + "cannotRunToThisLocation": "Не удалось запустить текущий поток в указанное место.", + "compound-cycle": "Конфигурация запуска '{0}' содержит цикл с самим собой", + "conditionalBreakpoint": "Условная точка останова", + "conditionalBreakpointsNotSupported": "Условные точки останова, не поддерживаемые данным типом отладки", + "confirmRunToShiftedPosition_msg": "Целевая позиция будет смещена на Ln {0}, Col {1}. Все равно бежать?", + "confirmRunToShiftedPosition_title": "Невозможно запустить текущий поток в точно указанном месте", + "consoleFilter": "Фильтр (например, текст, !исключить)", + "consoleFilterAriaLabel": "Фильтрация вывода консоли отладки", + "consoleSessionSelectorTooltip": "Переключение между сеансами отладки. Каждый сеанс отладки имеет свой собственный вывод на консоль.", + "consoleSeverityTooltip": "Фильтрация вывода консоли по уровню серьезности. Будут отображаться только сообщения с выбранным уровнем серьезности.", + "continueAll": "Продолжить все", + "copyExpressionValue": "Копирование значения выражения", + "couldNotRunTask": "Не удалось запустить задачу '{0}'.", + "dataBreakpoint": "точка останова данных", + "debugConfiguration": "Конфигурация отладки", + "debugSessionInitializationFailed": "Не удалось инициализировать сеанс отладки. Подробности см. в разделе Консоль.", + "debugSessionTypeNotSupported": "Тип сеанса отладки \"{0}\" не поддерживается.", + "debugToolbarMenu": "Меню панели инструментов отладки", + "debugVariableInput": "Установите значение {0} ", + "disableSelectedBreakpoints": "Отключение выбранных точек останова", + "disabledBreakpoint": "Инвалиды {0}", + "enableSelectedBreakpoints": "Включить выбранные точки останова", + "entry": "вход", + "errorStartingDebugSession": "Произошла ошибка при запуске сеанса отладки, проверьте журналы для получения более подробной информации.", + "exception": "исключение", + "functionBreakpoint": "точка останова функции", + "goto": "перейти по ссылке", + "htiConditionalBreakpointsNotSupported": "Попадание в условные точки останова, не поддерживаемые данным типом отладки", + "instruction-breakpoint": "Точка останова инструкции", + "instructionBreakpoint": "точка останова инструкции", + "logpointsNotSupported": "Точки журнала, не поддерживаемые этим типом отладки", + "missingConfiguration": "Динамическая конфигурация '{0}:{1}' отсутствует или неприменима", + "pause": "пауза", + "pauseAll": "Приостановить все", + "reveal": "Раскрыть", + "step": "шаг", + "taskTerminatedBySignal": "Задача '{0}' завершена сигналом {1}.", + "taskTerminatedForUnknownReason": "Задача '{0}' завершена по неизвестной причине.", + "taskTerminatedWithExitCode": "Задача '{0}' завершилась с кодом выхода {1}.", + "threads": "Нитки", + "toggleTracing": "Включение/выключение трассировки связи с отладочными адаптерами", + "unknownSession": "Неизвестная сессия", + "unverifiedBreakpoint": "Непроверенные {0}" + }, + "editor": { + "diffEditor.wordWrap2": "Строки будут обернуты в соответствии с настройкой `#editor.wordWrap#`.", + "dirtyEncoding": "Файл загрязнен. Пожалуйста, сначала сохраните его, а затем откройте с другой кодировкой.", + "editor.bracketPairColorization.enabled": "Управляет тем, включена или нет раскраска пар скобок. Используйте `#workbench.colorCustomizations#`, чтобы переопределить цвета выделения скобок.", + "editor.codeActions.triggerOnFocusChange": "Включите срабатывание `#editor.codeActionsOnSave#`, когда для `#files.autoSave#` установлено значение `afterDelay`. Действия кода должны быть установлены на `всегда`, чтобы срабатывать при смене окна и фокуса.", + "editor.detectIndentation": "Определяет, будут ли `#editor.tabSize#` и `#editor.insertSpaces#` автоматически определяться при открытии файла на основе его содержимого.", + "editor.experimental.preferTreeSitter": "Управляет включением/выключением анализа Tree Sitter для определенных языков. Этот параметр имеет приоритет над `editor.experimental.treeSitterTelemetry` для указанных языков.", + "editor.inlayHints.enabled1": "Подсказки инкрустации отображаются по умолчанию и скрываются при нажатии `Ctrl+Alt`.", + "editor.inlayHints.enabled2": "Подсказки инкрустации скрыты по умолчанию и отображаются при нажатии `Ctrl+Alt`.", + "editor.inlayHints.fontFamily": "Управляет семейством шрифтов подсказок инлея в редакторе. Если установлено значение empty, используется `#editor.fontFamily#`.", + "editor.inlayHints.fontSize": "Управляет размером шрифта подсказок инлея в редакторе. По умолчанию используется `#editor.fontSize#`, если настроенное значение меньше `5` или больше размера шрифта редактора.", + "editor.inlineSuggest.edits.experimental.enabled": "Контролирует, включать ли экспериментальные правки во встроенных предложениях.", + "editor.inlineSuggest.edits.experimental.onlyShowWhenCloseToCursor": "Указывает, показывать ли предложения в строке только тогда, когда курсор находится рядом с предложением.", + "editor.inlineSuggest.edits.experimental.useInterleavedLinesDiff": "Указывает, включать ли в предложениях экспериментальные чередующиеся строки.", + "editor.inlineSuggest.edits.experimental.useMixedLinesDiff": "Контролирует, включать ли экспериментальные правки во встроенных предложениях.", + "editor.insertSpaces": "Вставлять пробелы при нажатии клавиши `Tab`. Эта настройка переопределяется в зависимости от содержимого файла, если включена опция `#editor.detectIndentation#`.", + "editor.quickSuggestions": "Управляет тем, должны ли предложения автоматически появляться при вводе текста. Этим можно управлять при вводе комментариев, строк и другого кода. Быстрые предложения могут быть настроены на отображение в виде призрачного текста или виджета предложений. Также обратите внимание на настройку '#editor.suggestOnTriggerCharacters#', которая определяет, будут ли появляться предложения при использовании специальных символов.", + "editor.suggestFontSize": "Размер шрифта для виджета предложения. Если установлено значение `0`, используется значение `#editor.fontSize#`.", + "editor.suggestLineHeight": "Высота строки для виджета предложения. Если установлено значение `0`, используется значение `#editor.lineHeight#`. Минимальное значение - 8.", + "editor.tabSize": "Количество пробелов, которым равна табуляция. Эта настройка переопределяется в зависимости от содержимого файла, если включена функция `#editor.detectIndentation#`.", + "formatOnSaveTimeout": "Тайм-аут в миллисекундах, по истечении которого форматирование, выполняемое при сохранении файла, отменяется.", + "persistClosedEditors": "Управляет тем, сохранять ли историю закрытых редакторов для рабочей области при перезагрузке окна.", + "showAllEditors": "Показать все открытые редакторы", + "splitHorizontal": "Раздельный редактор Горизонтальный", + "splitVertical": "Раздельный редактор Вертикальный", + "toggleStickyScroll": "Переключить залипание прокрутки" + }, + "external-terminal": { + "cwd": "Выберите текущий рабочий каталог для нового внешнего терминала" + }, + "file-search": { + "toggleIgnoredFiles": " (Нажмите {0}, чтобы показать/скрыть игнорируемые файлы)" + }, + "fileDialog": { + "showHidden": "Показать скрытые файлы" + }, + "fileSystem": { + "fileResource": { + "overWriteBody": "Вы хотите перезаписать изменения, сделанные в файловой системе '{0}'?" + } + }, + "filesystem": { + "copiedToClipboard": "Скопировал ссылку на скачивание в буфер обмена.", + "copyDownloadLink": "Скопировать ссылку для скачивания", + "dialog": { + "initialLocation": "Перейти к начальному местоположению", + "multipleItemMessage": "Вы можете выбрать только один элемент", + "navigateBack": "Навигация назад", + "navigateForward": "Двигайтесь вперед", + "navigateUp": "Навигация по одному каталогу" + }, + "fileResource": { + "binaryFileQuery": "Его открытие может занять некоторое время и сделать IDE невосприимчивой. Вы хотите открыть '{0}' в любом случае?", + "binaryTitle": "Файл либо двоичный, либо использует неподдерживаемую текстовую кодировку.", + "largeFileTitle": "Файл слишком большой ({0}).", + "overwriteTitle": "Файл '{0}' был изменен в файловой системе." + }, + "filesExclude": "Настройте шаблоны glob для исключения файлов и папок. Например, проводник файлов решает, какие файлы и папки показывать или скрывать на основе этого параметра.", + "format": "Формат:", + "maxConcurrentUploads": "Максимальное количество одновременно загружаемых файлов при загрузке нескольких файлов. 0 означает, что все файлы будут загружены одновременно.", + "maxFileSizeMB": "Контролирует максимальный размер файла в МБ, который можно открыть.", + "prepareDownload": "Подготовка к загрузке...", + "prepareDownloadLink": "Подготовка ссылки для скачивания...", + "processedOutOf": "Обработано {0} из {1}", + "replaceTitle": "Заменить файл", + "uploadFailed": "При загрузке файла произошла ошибка. {0}", + "uploadFiles": "Загрузить файлы...", + "uploadedOutOf": "Загружено {0} из {1}" + }, + "getting-started": { + "ai": { + "header": "В IDE Theia доступна поддержка искусственного интеллекта (бета-версия)!", + "openAIChatView": "Откройте окно AI Chat View, чтобы узнать, как начать!" + }, + "apiComparator": "{0} Совместимость API", + "newExtension": "Построение нового расширения", + "newPlugin": "Создание нового плагина", + "startup-editor": { + "welcomePage": "Откройте страницу приветствия, содержащую материалы, помогающие начать работу с {0} и расширениями." + }, + "telemetry": "Использование данных и телеметрия" + }, + "git": { + "aFewSecondsAgo": "несколько секунд назад", + "addSignedOff": "Добавить подписанный", + "added": "Добавлено", + "amendReuseMessage": "Чтобы повторно использовать последнее сообщение фиксации, нажмите 'Enter' или 'Escape' для отмены.", + "amendRewrite": "Переписать предыдущее сообщение о фиксации. Нажмите 'Enter' для подтверждения или 'Escape' для отмены.", + "checkoutCreateLocalBranchWithName": "Создайте новый локальный филиал с именем: {0}. Нажмите 'Enter' для подтверждения или 'Escape' для отмены.", + "checkoutProvideBranchName": "Пожалуйста, укажите название филиала.", + "checkoutSelectRef": "Выберите ссылку для проверки или создайте новую локальную ветку:", + "cloneQuickInputLabel": "Укажите местоположение Git-репозитория. Нажмите 'Enter' для подтверждения или 'Escape' для отмены.", + "cloneRepository": "Клонируйте репозиторий Git: {0}. Нажмите 'Enter' для подтверждения или 'Escape' для отмены.", + "compareWith": "Сравнить с...", + "compareWithBranchOrTag": "Выберите ветвь или метку для сравнения с активной в данный момент ветвью {0}:", + "conflicted": "Противоречие", + "copied": "Скопировано", + "diff": "Дифф", + "dirtyDiffLinesLimit": "Не показывать грязные декорации diff, если количество строк редактора превышает этот предел.", + "dropStashMessage": "Тайник успешно удален.", + "editorDecorationsEnabled": "Показать украшения git в редакторе.", + "fetchPickRemote": "Выберите пульт, с которого будет производиться выборка:", + "gitDecorationsColors": "Используйте цветовое оформление в навигаторе.", + "mergeEditor": { + "currentSideTitle": "Текущий", + "incomingSideTitle": "Входящие" + }, + "mergeQuickPickPlaceholder": "Выберите ветвь для слияния с активной в данный момент ветвью {0}:", + "missingUserInfo": "Убедитесь, что вы настроили 'user.name' и 'user.email' в git.", + "noHistoryForError": "Не существует истории, доступной для {0}", + "noPreviousCommit": "Нет предыдущего обязательства по внесению изменений", + "noRepositoriesSelected": "Ни одно хранилище не было выбрано.", + "prepositionIn": "в", + "renamed": "Переименовано в", + "repositoryNotInitialized": "Хранилище {0} еще не инициализировано.", + "stashChanges": "Изменение тайника. Нажмите 'Enter' для подтверждения или 'Escape' для отмены.", + "stashChangesWithMessage": "Изменение тайника с сообщением: {0}. Нажмите 'Enter' для подтверждения или 'Escape' для отмены.", + "tabTitleIndex": "{0} (индекс)", + "tabTitleWorkingTree": "{0} (Рабочее дерево)", + "toggleBlameAnnotations": "Переключить аннотации вины", + "unstaged": "Без постановки" + }, + "keybinding-schema-updater": { + "deprecation": "Вместо этого используйте предложение `when`." + }, + "keymaps": { + "addKeybindingTitle": "Добавить привязку клавиш для {0}", + "editKeybinding": "Редактирование привязки клавиш...", + "editKeybindingTitle": "Редактировать привязку клавиш для {0}", + "editWhenExpression": "Edit When Expression...", + "editWhenExpressionTitle": "Редактировать выражение When Expression for {0}", + "keybinding": { + "copy": "Копирование привязки клавиш", + "copyCommandId": "Копирование идентификатора команды привязки клавиш", + "copyCommandTitle": "Копирование привязки клавиш Название команды", + "edit": "Редактирование привязки клавиш...", + "editWhenExpression": "Редактирование привязки клавиш при выражении..." + }, + "keybindingCollidesValidation": "привязка клавиш в настоящее время сталкивается", + "requiredKeybindingValidation": "требуется значение привязки клавиш", + "resetKeybindingConfirmation": "Вы действительно хотите сбросить привязку к клавишам до значения по умолчанию?", + "resetKeybindingTitle": "Сброс привязки клавиш для {0}", + "resetMultipleKeybindingsWarning": "Если для этой команды существует несколько привязок клавиш, все они будут сброшены." + }, + "localize": { + "offlineTooltip": "Не удается подключиться к бэкенду." + }, + "markers": { + "clearAll": "Очистить все", + "noProblems": "Пока никаких проблем в рабочем пространстве не обнаружено.", + "tabbarDecorationsEnabled": "Показывать декораторы проблем (диагностические маркеры) на панелях вкладок." + }, + "memory-inspector": { + "addressTooltip": "Место в памяти для отображения, адрес или выражение, оценивающее адрес", + "ascii": "ASCII", + "binary": "Бинарные", + "byteSize": "Размер байта", + "bytesPerGroup": "Байты на группу", + "closeSettings": "Закрыть настройки", + "columns": "Колонки", + "command": { + "createNewMemory": "Создать новый инспектор памяти", + "createNewRegisterView": "Создание нового представления реестра", + "followPointer": "Следуйте за указателем", + "followPointerMemory": "Следование за указателем в инспекторе памяти", + "resetValue": "Сброс значения", + "showRegister": "Показать регистр в инспекторе памяти", + "viewVariable": "Показать переменную в инспекторе памяти" + }, + "data": "Данные", + "decimal": "Десятичный", + "diff": { + "label": "Дифф: {0}" + }, + "diff-widget": { + "offset-label": "{0} Смещение", + "offset-title": "Байты для смещения памяти от {0}" + }, + "editable": { + "apply": "Применять изменения", + "clear": "Четкие изменения" + }, + "endianness": "Endianness", + "extraColumn": "Дополнительная колонка", + "groupsPerRow": "Группы на строку", + "hexadecimal": "Шестнадцатеричная", + "length": "Длина", + "lengthTooltip": "Количество байтов для выборки, в десятичном или шестнадцатеричном формате", + "memory": { + "addressField": { + "memoryReadError": "Введите адрес или выражение в поле Местоположение." + }, + "freeze": "Заморозить просмотр памяти", + "hideSettings": "Скрыть панель настроек", + "readError": { + "bounds": "Превышены границы памяти, результат будет усечен.", + "noContents": "В настоящее время содержимое памяти не доступно." + }, + "readLength": { + "memoryReadError": "Введите длину (десятичное или шестнадцатеричное число) в поле Длина." + }, + "showSettings": "Показать панель настроек", + "unfreeze": "Разморозить память Просмотр", + "userError": "Произошла ошибка при выборке памяти." + }, + "memoryCategory": "Инспектор памяти", + "memoryInspector": "Инспектор памяти", + "memoryTitle": "Память", + "octal": "Octal", + "offset": "Смещение", + "offsetTooltip": "Смещение, добавляемое к текущей ячейке памяти при навигации", + "provider": { + "localsError": "Невозможно прочитать локальные переменные. Нет активного сеанса отладки.", + "readError": "Невозможно прочитать память. Нет активного сеанса отладки.", + "writeError": "Невозможно записать память. Нет активного сеанса отладки." + }, + "register": "Зарегистрироваться", + "register-widget": { + "filter-placeholder": "Фильтр (начинается с)" + }, + "registerReadError": "Произошла ошибка при выборке регистров.", + "registers": "Регистры", + "toggleComparisonWidgetVisibility": "Переключение видимости виджета сравнения", + "utils": { + "afterBytes": "Вы должны загрузить память в оба виджета, которые хотите сравнить. {0} не имеет загруженной памяти.", + "bytesMessage": "Вы должны загрузить память в оба виджета, которые хотите сравнить. {0} не имеет загруженной памяти." + } + }, + "messages": { + "notificationTimeout": "По истечении этого времени информационные уведомления будут скрыты.", + "toggleNotifications": "Переключение уведомлений" + }, + "mini-browser": { + "typeUrl": "Введите URL-адрес" + }, + "monaco": { + "noSymbolsMatching": "Символы не совпадают", + "typeToSearchForSymbols": "Введите для поиска символов" + }, + "navigator": { + "autoReveal": "Автоматическое раскрытие", + "clipboardWarn": "Доступ к буферу обмена запрещен. Проверьте разрешение вашего браузера.", + "clipboardWarnFirefox": "API буфера обмена недоступен. Его можно включить с помощью '{0}' предпочтения на странице '{1}'. Затем перезагрузите Theia. Обратите внимание, это позволит FireFox получить полный доступ к системному буферу обмена.", + "openWithSystemEditor": "Открыть с помощью системного редактора", + "refresh": "Обновить в Проводнике", + "reveal": "Раскрытие в Проводнике", + "systemEditor": "Системный редактор", + "toggleHiddenFiles": "Переключение скрытых файлов" + }, + "output": { + "clearOutputChannel": "Очистить выходной канал...", + "closeOutputChannel": "Закрыть выходной канал...", + "hiddenChannels": "Скрытые каналы", + "hideOutputChannel": "Скрыть выходной канал...", + "maxChannelHistory": "Максимальное количество записей в выходном канале.", + "outputChannels": "Выходные каналы", + "showOutputChannel": "Показать выходной канал..." + }, + "plugin": { + "blockNewTab": "Ваш браузер не позволил открыть новую вкладку" + }, + "plugin-dev": { + "alreadyRunning": "Хостируемый экземпляр уже запущен.", + "debugInstance": "Отладочный экземпляр", + "debugMode": "Использование inspect или inspect-brk для отладки Node.js", + "debugPorts": { + "debugPort": "Порт, используемый для отладки Node.js на этом сервере" + }, + "devHost": "Ведущий разработки", + "failed": "Не удалось запустить размещенный экземпляр плагина: {0}", + "hostedPlugin": "Хостируемый плагин", + "hostedPluginRunning": "Хостируемый плагин: Выполняется", + "hostedPluginStarting": "Хостируемый плагин: запуск", + "hostedPluginStopped": "Хостируемый плагин: Stopped", + "hostedPluginWatching": "Хостируемый плагин: Смотреть", + "instanceTerminated": "{0} была прекращена", + "launchOutFiles": "Массив шаблонов glob для размещения сгенерированных JavaScript файлов (`${pluginPath}` будет заменен на фактический путь к плагину).", + "noValidPlugin": "Указанная папка не содержит действительного плагина.", + "notRunning": "Хостируемый экземпляр не запущен.", + "pluginFolder": "Папка плагина установлена на: {0}", + "preventedNewTab": "Ваш браузер не позволил открыть новую вкладку", + "restartInstance": "Перезапуск экземпляра", + "running": "Хостируемый экземпляр работает на:", + "selectPath": "Выберите путь", + "startInstance": "Запуск экземпляра", + "starting": "Запуск сервера размещенных экземпляров ...", + "stopInstance": "Остановить экземпляр", + "unknownTerminated": "Экземпляр был завершен", + "watchMode": "Запуск наблюдателя на разрабатываемом плагине" + }, + "plugin-ext": { + "authentication-main": { + "loginTitle": "Вход в систему", + "signedOut": "Успешно вышел из системы." + }, + "plugins": "Плагины", + "webviewTrace": "Управляет трассировкой связи с веб-вью.", + "webviewWarnIfUnsecure": "Предупреждает пользователей о том, что веб-просмотры в настоящее время развернуты небезопасно." + }, + "preferences": { + "ai-features": "Особенности искусственного интеллекта", + "hostedPlugin": "Хостируемый плагин", + "toolbar": "Панель инструментов" + }, + "preview": { + "openByDefault": "По умолчанию вместо редактора открывается предварительный просмотр." + }, + "property-view": { + "created": "Создано", + "directory": "Каталог", + "lastModified": "Последнее изменение", + "location": "Местонахождение", + "noProperties": "Нет доступных объектов.", + "properties": "Свойства", + "symbolicLink": "Символическая связь" + }, + "remote": { + "dev-container": { + "connect": "Открыть в контейнере", + "noDevcontainerFiles": "В рабочей области не найдено файлов devcontainer.json. Убедитесь, что у вас есть каталог .devcontainer с файлом devcontainer.json.", + "selectDevcontainer": "Выберите файл devcontainer.json" + }, + "ssh": { + "connect": "Подключите текущее окно к хосту...", + "connectToConfigHost": "Подключение текущего окна к хосту в файле конфигурации...", + "enterHost": "Введите имя хоста SSH", + "enterUser": "Введите имя пользователя SSH", + "failure": "Не удалось открыть SSH-соединение с удаленным компьютером.", + "hostPlaceHolder": "Например, hello@example.com", + "needsHost": "Введите имя хоста.", + "needsUser": "Введите имя пользователя.", + "userPlaceHolder": "Например, здравствуйте" + }, + "sshNoConfigPath": "Не найден путь к конфигурации SSH.", + "wsl": { + "connectToWsl": "Подключение к WSL", + "connectToWslUsingDistro": "Подключение к WSL с помощью дистр...", + "noWslDistroFound": "Дистрибутивы WSL не найдены. Пожалуйста, сначала установите дистрибутив WSL.", + "reopenInWsl": "Повторное открытие папки в WSL", + "selectWSLDistro": "Выберите дистрибутив WSL" + } + }, + "scm": { + "amend": "изменить", + "amendHeadCommit": "ГЛАВНОЕ ОБЯЗАТЕЛЬСТВО", + "amendLastCommit": "Поправка к последнему сообщению", + "changeRepository": "Изменить репозиторий...", + "config.untrackedChanges": "Управляет поведением неотслеживаемых изменений.", + "config.untrackedChanges.hidden": "скрытый", + "config.untrackedChanges.mixed": "смешанный", + "config.untrackedChanges.separate": "отдельный", + "dirtyDiff": { + "close": "Закрыть Изменить Посмотреть" + }, + "history": "История", + "mergeEditor": { + "resetConfirmationTitle": "Вы действительно хотите сбросить результат слияния в этом редакторе?" + }, + "noRepositoryFound": "Репозиторий не найден", + "unamend": "не изменять", + "unamendCommit": "Неизмененное обязательство" + }, + "search-in-workspace": { + "includeIgnoredFiles": "Включить игнорируемые файлы", + "noFolderSpecified": "Вы не открыли или не указали папку. В настоящее время поиск ведется только в открытых файлах.", + "resultSubset": "Это только часть всех результатов. Используйте более конкретный поисковый запрос, чтобы сузить список результатов.", + "searchOnEditorModification": "Поиск активного редактора при изменении." + }, + "secondary-window": { + "extract-widget": "Переместить вид в дополнительное окно" + }, + "shell-area": { + "secondary": "Вторичное окно" + }, + "task": { + "attachTask": "Прикрепите задание...", + "circularReferenceDetected": "Обнаружена круговая ссылка: {0} --> {1}", + "clearHistory": "Чистая история", + "errorKillingTask": "Ошибка при убийстве задачи '{0}': {1}", + "errorLaunchingTask": "Ошибка при запуске задачи '{0}': {1}", + "invalidTaskConfigs": "Обнаружены недопустимые конфигурации задач. Откройте файл tasks.json и найдите подробности в представлении \"Задачи\".", + "neverScanTaskOutput": "Никогда не сканируйте выходные данные задачи", + "noTaskToRun": "Не найдено ни одной задачи для выполнения. Настройте задачи...", + "noTasksFound": "Задания не найдены", + "notEnoughDataInDependsOn": "Информации, представленной в \"зависитОн\", недостаточно для подбора правильного задания!", + "schema": { + "commandOptions": { + "cwd": "Текущий рабочий каталог выполняемой программы или скрипта. Если опущено, используется корень текущей рабочей области Theia." + }, + "presentation": { + "panel": { + "dedicated": "Терминал предназначен для выполнения определенной задачи. Если эта задача выполняется снова, терминал используется повторно. Однако вывод другой задачи представляется в другом терминале.", + "new": "При каждом выполнении этого задания используется новый чистый терминал.", + "shared": "Терминал является общим, и вывод других задач добавляется в тот же терминал." + }, + "showReuseMessage": "Контролирует, показывать ли сообщение \"Терминал будет повторно использоваться задачами\"." + }, + "problemMatcherObject": { + "owner": "Владелец проблемы внутри Тейи. Может быть опущен, если указана база. По умолчанию будет 'external', если опущено и не указана база." + } + }, + "taskAlreadyRunningInTerminal": "Задача уже запущена в терминале", + "taskExitedWithCode": "Задача '{0}' завершилась с кодом {1}.", + "taskTerminalTitle": "Задание: {0}", + "taskTerminatedBySignal": "Задача '{0}' была завершена сигналом {1}.", + "terminalWillBeReusedByTasks": "Терминал будет повторно использоваться задачами." + }, + "terminal": { + "defaultProfile": "Профиль по умолчанию, используемый на {0}", + "enableCopy": "Включите ctrl-c (cmd-c в macOS) для копирования выделенного текста", + "enablePaste": "Включите ctrl-v (cmd-v в macOS) для вставки из буфера обмена", + "profileArgs": "Аргументы оболочки, которые использует этот профиль.", + "profileColor": "Идентификатор цвета темы терминала, который ассоциируется с терминалом.", + "profileDefault": "Выберите Профиль по умолчанию...", + "profileIcon": "Идентификатор кодикона, который нужно связать с иконкой терминала.\nterminal-tmux:\"$(terminal-tmux)\"", + "profileNew": "Новый терминал (с профилем)...", + "profilePath": "Путь к оболочке, которую использует данный профиль.", + "profiles": "Профили, которые должны быть представлены при создании нового терминала. Задайте свойство path вручную с помощью необязательных args.\nУстановите для существующего профиля значение `null`, чтобы скрыть профиль из списка, например: `\"{0}\": null`.", + "rendererType": "Управляет способом отображения терминала.", + "rendererTypeDeprecationMessage": "Тип рендерера больше не поддерживается как опция.", + "selectProfile": "Выберите профиль для нового терминала", + "shell.deprecated": "Это устарело, новым рекомендуемым способом настройки оболочки по умолчанию является создание профиля терминала в 'terminal.integrated.profiles.{0}' и установка имени профиля по умолчанию в 'terminal.integrated.defaultProfile.{0}.\".", + "shellArgsLinux": "Аргументы командной строки для использования в терминале Linux.", + "shellArgsOsx": "Аргументы командной строки для использования в терминале macOS.", + "shellArgsWindows": "Аргументы командной строки для использования в терминале Windows.", + "shellLinux": "Путь к оболочке, которую использует терминал в Linux (по умолчанию: '{0}'}).", + "shellOsx": "Путь к оболочке, которую использует терминал на macOS (по умолчанию: '{0}'}).", + "shellWindows": "Путь к оболочке, которую терминал использует в Windows. (по умолчанию: '{0}')." + }, + "terminal-manager": { + "addTerminalToGroup": "Добавить терминал в группу", + "closeDialog": { + "message": "После закрытия диспетчера терминалов его макет не может быть восстановлен. Вы уверены, что хотите закрыть диспетчер терминалов?", + "title": "Вы хотите закрыть диспетчер терминалов?" + }, + "closeTerminalManager": "Закрыть диспетчер терминалов", + "createNewTerminalGroup": "Создать новую группу терминалов", + "createNewTerminalPage": "Создать новую страницу терминала", + "deleteGroup": "Удалить группу", + "deletePage": "Удалить страницу", + "deleteTerminal": "Удалить терминал", + "group": "Группа", + "label": "Терминалы", + "maximizeBottomPanel": "Максимизировать нижнюю панель", + "minimizeBottomPanel": "Свернуть нижнюю панель", + "openTerminalManager": "Открыть диспетчер терминалов", + "page": "Страница", + "rename": "Переименовать", + "resetTerminalManagerLayout": "Сброс макета диспетчера терминалов", + "toggleTreeView": "Переключить деревовидный вид" + }, + "test": { + "cancelAllTestRuns": "Отмена всех тестовых запусков", + "stackFrameAt": "на", + "testRunDefaultName": "{0} запустить {1}", + "testRuns": "Тестовые испытания" + }, + "toolbar": { + "addCommand": "Добавить команду на панель инструментов", + "addCommandPlaceholder": "Найдите команду для добавления на панель инструментов", + "centerColumn": "Центральная колонка", + "failedUpdate": "Не удалось обновить значение '{0}' в '{1}'.", + "filterIcons": "Значки фильтров", + "iconSelectDialog": "Выберите значок для '{0}'", + "iconSet": "Набор иконок", + "insertGroupLeft": "Вставить разделитель групп (слева)", + "insertGroupRight": "Вставить разделитель групп (справа)", + "leftColumn": "Левая колонка", + "openJSON": "Настроить панель инструментов (открыть JSON)", + "removeCommand": "Удалить команду из панели инструментов", + "restoreDefaults": "Восстановление настроек панели инструментов по умолчанию", + "rightColumn": "Правая колонка", + "selectIcon": "Выберите значок", + "toggleToolbar": "Переключение панели инструментов", + "toolbarLocationPlaceholder": "Куда бы вы хотели добавить команду?", + "useDefaultIcon": "Использовать значок по умолчанию" + }, + "typehierarchy": { + "subtypeHierarchy": "Иерархия подтипов", + "supertypeHierarchy": "Иерархия супертипов" + }, + "variableResolver": { + "listAllVariables": "Переменная: Список всех" + }, + "vsx-registry": { + "confirmDialogMessage": "Расширение \"{0}\" является непроверенным и может представлять угрозу безопасности.", + "confirmDialogTitle": "Вы уверены, что хотите продолжить установку?", + "downloadCount": "Скачать граф: {0}", + "errorFetching": "Ошибка при получении расширений.", + "errorFetchingConfigurationHint": "Это может быть вызвано проблемами конфигурации сети.", + "failedInstallingVSIX": "Не удалось установить {0} из VSIX.", + "invalidVSIX": "Выбранный файл не является действительным плагином \"*.vsix\".", + "license": "Лицензия: {0}", + "onlyShowVerifiedExtensionsDescription": "Это позволяет сайту {0} показывать только проверенные расширения.", + "onlyShowVerifiedExtensionsTitle": "Показывать только проверенные расширения", + "recommendedExtensions": "Список имен расширений, рекомендуемых для использования в данной рабочей области.", + "searchPlaceholder": "Поисковые расширения в {0}", + "showInstalled": "Показать установленные расширения", + "showRecommendedExtensions": "Служит для управления отображением уведомлений о рекомендациях расширения.", + "vsx-extensions-contribution": { + "update-version-uninstall-error": "Ошибка при удалении расширения: {0}.", + "update-version-version-error": "Не удалось установить версию {0} сайта {1}." + } + }, + "webview": { + "goToReadme": "Перейти к README", + "messageWarning": " Шаблон хоста конечной точки {0} был изменен на `{1}`; изменение шаблона может привести к уязвимостям безопасности. Для получения дополнительной информации смотрите `{2}`." + }, + "workspace": { + "bothAreDirectories": "Оба ресурса являются каталогами.", + "clickToManageTrust": "Нажмите, чтобы управлять настройками доверия.", + "compareWithEachOther": "Сравните друг с другом", + "confirmDeletePermanently.description": "Не удалось удалить \"{0}\" с помощью Корзины. Вы хотите удалить его навсегда?", + "confirmDeletePermanently.solution": "Вы можете отключить использование корзины в настройках.", + "confirmDeletePermanently.title": "Ошибка при удалении файла", + "confirmMessage.delete": "Вы действительно хотите удалить следующие файлы?", + "confirmMessage.dirtyMultiple": "Вы действительно хотите удалить {0} файлов с несохраненными изменениями?", + "confirmMessage.dirtySingle": "Вы действительно хотите удалить {0} с несохраненными изменениями?", + "confirmMessage.uriMultiple": "Вы действительно хотите удалить все {0} выбранных файлов?", + "confirmMessage.uriSingle": "Вы действительно хотите удалить {0}?", + "directoriesCannotBeCompared": "Справочники нельзя сравнивать. {0}", + "duplicate": "Дубликат", + "failSaveAs": "Невозможно выполнить \"{0}\" для текущего виджета.", + "isDirectory": "{0}'' — это каталог.", + "manageTrustPlaceholder": "Выберите состояние доверия для этой рабочей области", + "newFilePlaceholder": "Имя файла", + "newFolderPlaceholder": "Имя папки", + "noErasure": "Примечание: С диска ничего не будет удалено", + "notWorkspaceFile": "Недействительный файл рабочей области: {0}", + "openRecentPlaceholder": "Введите имя рабочей области, которую вы хотите открыть", + "openRecentWorkspace": "Открыть недавнее рабочее пространство...", + "preserveWindow": "Включить открытие рабочих пространств в текущем окне.", + "removeFolder": "Вы уверены, что хотите удалить следующую папку из рабочей области?", + "removeFolders": "Вы уверены, что хотите удалить следующие папки из рабочей области?", + "restrictedModeDescription": "Некоторые функции отключены, поскольку это рабочее пространство не является доверенным.", + "restrictedModeNote": "*Обратите внимание: функция доверия рабочего пространства в настоящее время находится в стадии разработки в Theia; не все функции еще интегрированы с доверием рабочего пространства*", + "schema": { + "folders": { + "description": "Корневые папки в рабочей области" + }, + "title": "Файл рабочего пространства" + }, + "trashTitle": "Переместить {0} в корзину", + "trustEmptyWindow": "Управляет тем, доверяется ли пустая рабочая область по умолчанию.", + "trustEnabled": "Управляет тем, включено или нет доверие к рабочему пространству. Если отключено, все рабочие пространства являются доверенными.", + "trustTrustedFolders": "Список URI папок, которые являются доверенными без запроса подтверждения.", + "untitled-cleanup": "Похоже, что имеется много файлов рабочей области без названия. Проверьте {0} и удалите все неиспользуемые файлы.", + "variables": { + "cwd": { + "description": "Текущий рабочий каталог задания при запуске" + }, + "file": { + "description": "Путь к текущему открытому файлу" + }, + "fileBasename": { + "description": "Базовое имя текущего открытого файла" + }, + "fileBasenameNoExtension": { + "description": "Имя текущего открытого файла без расширения" + }, + "fileDirname": { + "description": "Имя каталога текущего открытого файла" + }, + "fileExtname": { + "description": "Расширение текущего открытого файла" + }, + "relativeFile": { + "description": "Путь к текущему открытому файлу относительно корня рабочей области" + }, + "relativeFileDirname": { + "description": "Имя каталога текущего открытого файла относительно ${workspaceFolder}" + }, + "workspaceFolder": { + "description": "Путь к корневой папке рабочей области" + }, + "workspaceFolderBasename": { + "description": "Имя корневой папки рабочей области" + }, + "workspaceRoot": { + "description": "Путь к корневой папке рабочей области" + }, + "workspaceRootFolderName": { + "description": "Имя корневой папки рабочей области" + } + }, + "workspaceFolderAdded": "Было создано рабочее пространство с несколькими корнями. Хотите ли вы сохранить конфигурацию рабочего пространства в виде файла?", + "workspaceFolderAddedTitle": "Папка добавлена в рабочую область" + } + }, + "vsx.disabling": "Отключение", + "vsx.disabling.extensions": "Отключение {0}...", + "vsx.enabling": "Включение", + "vsx.enabling.extension": "Включение {0}..." +} diff --git a/packages/core/i18n/nls.tr.json b/packages/core/i18n/nls.tr.json new file mode 100644 index 0000000..08bcdc0 --- /dev/null +++ b/packages/core/i18n/nls.tr.json @@ -0,0 +1,2097 @@ +{ + "ai-chat-ui.show-settings": "AI Ayarlarını Göster", + "ai-chat:summarize-session-as-task-for-coder": "Kodlayıcı için Görev Olarak Oturumu Özetleme", + "ai.executePlanWithCoder": "Coder ile Mevcut Planı Yürüt", + "ai.updateTaskContext": "Geçerli Görev Bağlamını Güncelle", + "aiConfiguration:open": "AI Yapılandırma görünümünü açın", + "aiHistory:clear": "AI Geçmişi: Geçmişi Temizle", + "aiHistory:open": "Yapay Zeka Geçmişi görünümünü açın", + "aiHistory:sortChronologically": "Yapay Zeka Geçmişi: Kronolojik olarak sırala", + "aiHistory:sortReverseChronologically": "Yapay Zeka Tarihi: Ters kronolojik olarak sırala", + "aiHistory:toggleCompact": "Yapay Zeka Geçmişi: Kompakt görünümü değiştir", + "aiHistory:toggleHideNewlines": "Yapay Zeka Geçmişi: Yeni satırları yorumlamayı durdur", + "aiHistory:toggleRaw": "Yapay Zeka Geçmişi: Ham görünümü değiştir", + "aiHistory:toggleRenderNewlines": "Yapay Zeka Geçmişi: Yeni satırları yorumlama", + "debug.breakpoint.editCondition": "Düzenleme Durumu...", + "debug.breakpoint.removeSelected": "Seçili Kesme Noktalarını Kaldır", + "debug.breakpoint.toggleEnabled": "Kesme Noktalarını Etkinleştir", + "notebook.cell.changeToCode": "Hücreyi Kod Olarak Değiştir", + "notebook.cell.changeToMarkdown": "Hücreyi Markdown Olarak Değiştirme", + "notebook.cell.insertMarkdownCellAbove": "Markdown Hücresini Yukarıya Ekleme", + "notebook.cell.insertMarkdownCellBelow": "Aşağıya Markdown Hücresi Ekleme", + "terminal:new:profile": "Profilden Yeni Entegre Terminal Oluşturma", + "terminal:profile:default": "Varsayılan Terminal Profilini seçin", + "theia": { + "ai": { + "agents": { + "completionNotification": { + "mdDescription": "Bu aracı bir görevi tamamladığında bildirim davranışı. Ayarlanmamışsa, global varsayılan bildirim ayarı kullanılacaktır.\n - `os-bildirim`: İşletim sistemi/sistem bildirimlerini göster\n - `mesaj`: Bildirimleri durum çubuğunda/mesaj alanında göster\n - `blink`: Kullanıcı arayüzünü yanıp söner veya vurgular\n - `off`: Bu aracı için bildirimleri devre dışı bırak", + "title": "Tamamlama Bildirimi" + }, + "enable": { + "mdDescription": "Temsilcinin etkinleştirilmesi (true) veya devre dışı bırakılması (false) gerektiğini belirtir.", + "title": "Temsilciyi Etkinleştir" + }, + "languageModelRequirements": { + "identifier": { + "mdDescription": "Kullanılacak dil modelinin tanımlayıcısı." + }, + "mdDescription": "Bu aracı için kullanılan dil modellerini belirtir.", + "purpose": { + "mdDescription": "Bu dil modelinin hangi amaçla kullanıldığı.", + "title": "Amaç" + }, + "title": "Dil Modeli Gereksinimleri" + }, + "mdDescription": "Belirli aracıları etkinleştirme veya devre dışı bırakma, istemleri yapılandırma ve LLM'leri seçme gibi aracı ayarlarını yapılandırın.", + "selectedVariants": { + "mdDescription": "Bu müşteri temsilcisi için o anda seçili olan istem varyantlarını belirtir.", + "title": "Seçilmiş Varyantlar" + }, + "title": "Temsilci Ayarları" + }, + "anthropic": { + "apiKey": { + "description": "Resmi Anthropic Hesabınızın API Anahtarını girin. **Lütfen dikkat:** Bu tercihi kullanarak Anthropic API anahtarı Theia'yı çalıştıran makinede açık metin olarak saklanacaktır. Anahtarı güvenli bir şekilde ayarlamak için `ANTHROPIC_API_KEY` ortam değişkenini kullanın." + }, + "models": { + "description": "Kullanılacak resmi Antropik modeller" + } + }, + "chat": { + "agent": { + "architect": "Mimar", + "coder": "kodlayıcı", + "universal": "Universal" + }, + "applySuggestion": "Öneri uygulayın", + "bypassModelRequirement": { + "description": "Dil modeli gereksinimi kontrolünü atla. Theia dil modellerini gerektirmeyen harici ajanlar (ör. Claude Code) kullanıyorsanız bunu etkinleştirin." + }, + "changeSetDefaultTitle": "Önerilen Değişiklikler", + "changeSetFileDiffUriLabel": "Yapay zeka değişiklikleri: {0}", + "chatAgentsVariable": { + "description": "Sistemde bulunan sohbet temsilcilerinin listesini döndürür" + }, + "chatSessionNamingAgent": { + "description": "Sohbet oturumu adları oluşturmak için aracı", + "vars": { + "conversation": { + "description": "Sohbet görüşmesinin içeriği." + }, + "listOfSessionNames": { + "description": "Mevcut oturum adlarının listesi." + } + } + }, + "chatSessionSummaryAgent": { + "description": "Sohbet oturumu özetleri oluşturmak için aracı." + }, + "confirmApplySuggestion": "Bu öneri oluşturulduktan sonra {0} dosyası değişti. Değişikliği uygulamak istediğinizden emin misiniz?", + "confirmRevertSuggestion": "Bu öneri oluşturulduktan sonra {0} dosyası değişti. Değişikliği geri almak istediğinizden emin misiniz?", + "couldNotFindMatchingLM": "Eşleşen bir dil modeli bulunamadı. Lütfen kurulumunuzu kontrol edin!", + "couldNotFindReadyLMforAgent": "{0} temsilcisi için hazır bir dil modeli bulunamadı. Lütfen kurulumunuzu kontrol edin!", + "defaultAgent": { + "description": "İsteğe bağlı: Kullanıcı sorgusunda @ ile açıkça bir aracı belirtilmemişse, çağrılacak Sohbet Aracısının adresi. Herhangi bir Varsayılan Aracı yapılandırılmamışsa, Theia'nın varsayılanları uygulanacaktır." + }, + "imageContextVariable": { + "args": { + "data": { + "description": "Görüntü verileri base64 olarak." + }, + "mimeType": { + "description": "Görüntünün mimetipi." + }, + "name": { + "description": "Varsa görüntü dosyasının adı." + }, + "wsRelativePath": { + "description": "Varsa, görüntü dosyasının çalışma alanına göreli yolu." + } + }, + "description": "Bir görüntü için bağlam bilgisi sağlar", + "label": "Resim Dosyası" + }, + "orchestrator": { + "description": "Bu temsilci, kullanıcı talebini mevcut tüm sohbet temsilcilerinin açıklamasına göre analiz eder ve talebi yanıtlamak için en uygun temsilciyi seçer (AI kullanarak) Kullanıcının talebi, başka bir onay olmadan doğrudan seçilen temsilciye devredilecektir.", + "vars": { + "availableChatAgents": { + "description": "Orkestratörün temsilci atayabileceği sohbet aracılarının listesi, dışlama listesi tercihinde belirtilen aracılar hariç." + } + } + }, + "pinChatAgent": { + "description": "Bahsedilen bir sohbet temsilcisini istemler arasında otomatik olarak etkin tutmak için temsilci sabitlemeyi etkinleştirin ve tekrarlanan bahsetmenin gerekliliğini azaltın." + }, + "revertSuggestion": "Öneriyi geri al", + "selectImageFile": "Bir görüntü dosyası seçin", + "sessionStorage": { + "description": "Sohbet oturumlarının nerede saklanacağını yapılandırın.", + "globalPath": "Küresel Yol", + "pathNotUsedForScope": "{0} depolama kapsamı ile kullanılmaz.", + "pathRequired": "Yol boş olamaz", + "pathSettings": "Yol Ayarları", + "resetToDefault": "Varsayılana sıfırla", + "scope": { + "global": "Sohbet oturumlarını genel yapılandırma klasöründe saklayın.", + "workspace": "Sohbet oturumlarını çalışma alanı klasöründe saklayın." + }, + "workspacePath": "Çalışma Alanı Yolu" + }, + "taskContextService": { + "summarizeProgressMessage": "Özetle: {0}", + "updatingProgressMessage": "Güncelleniyor: {0}" + }, + "toolConfirmation": { + "confirm": { + "description": "Araçları çalıştırmadan önce onay isteyin" + }, + "disabled": { + "description": "Araç yürütmeyi devre dışı bırakma" + }, + "yolo": { + "description": "Araçları onay almadan otomatik olarak çalıştırma" + } + }, + "view": { + "label": "Yapay Zeka Sohbeti" + } + }, + "chat-ui": { + "addContextVariable": "Bağlam değişkeni ekleme", + "agent": "Ajan", + "aiDisabled": "Yapay zeka özellikleri devre dışı", + "applyAll": "Tümünü Uygula", + "applyAllTitle": "Bekleyen tüm değişiklikleri uygulayın", + "askQuestion": "Soru sor", + "attachToContext": "Öğeleri bağlama ekleme", + "cancel": "İptal (Esc)", + "chat-view-tree-widget": { + "ai": "YAPAY ZEKA", + "aiFeatureHeader": "🚀 Yapay Zeka Özellikleri Mevcut (Alfa Sürümü)!", + "featuresDisabled": "Şu anda tüm Yapay Zeka Özellikleri devre dışıdır!", + "generating": "Oluşturma", + "howToEnable": "Yapay Zeka Özellikleri Nasıl Etkinleştirilir?", + "noRenderer": "Hata: Oluşturucu bulunamadı", + "scrollToBottom": "Son mesaja atla", + "waitingForInput": "Girdi için bekliyorum", + "you": "Sen" + }, + "chatInput": { + "clearHistory": "Giriş İstemi Geçmişini Temizle", + "cycleMode": "Döngü Sohbet Modu", + "nextPrompt": "Sonraki İstem", + "previousPrompt": "Önceki İstem" + }, + "chatInputAriaLabel": "Mesajınızı buraya yazın", + "chatResponses": "Sohbet yanıtları", + "code-part-renderer": { + "generatedCode": "Oluşturulan Kod" + }, + "collapseChangeSet": "Değişiklik Setini Daralt", + "command-part-renderer": { + "commandNotExecutable": "Komut \"{0}\" kimliğine sahiptir ancak Sohbet penceresinden çalıştırılamaz." + }, + "copyCodeBlock": "Kod Bloğunu Kopyala", + "couldNotSendRequestToSession": "Oturuma \"{0}\" isteği gönderilemedi {1}", + "delegation-response-renderer": { + "prompt": { + "label": "Yetkilendirilmiş istem:" + }, + "response": { + "label": "Cevap ver:" + }, + "starting": "Başlangıç delegasyonu...", + "status": { + "canceled": "iptal edildi", + "error": "hata", + "generating": "üretiyor.", + "starting": "başlıyoruz." + } + }, + "deleteChangeSet": "Değişiklik Setini Sil", + "editRequest": "Düzenle", + "edited": "düzenlenmiş", + "editedTooltipHint": "Bu komut varyantı düzenlenmiştir. AI Yapılandırma görünümünde sıfırlayabilirsiniz.", + "enterChatName": "Sohbet adını girin", + "errorChatInvocation": "Sohbet hizmeti çağrısı sırasında bir hata oluştu.", + "expandChangeSet": "Değişiklik Setini Genişlet", + "failedToDeleteSession": "Sohbet oturumu silinemedi", + "failedToLoadChats": "Sohbet oturumları yüklenemedi", + "failedToRestoreSession": "Sohbet oturumu geri yüklenemedi", + "failedToRetry": "Yeniden deneme başarısız mesajı", + "focusInput": "Odak Sohbet Girişi", + "focusResponse": "Odak Sohbet Yanıtı", + "noChatAgentsAvailable": "Sohbet temsilcileri mevcut değil.", + "openDiff": "Açık Fark", + "openOriginalFile": "Orijinal Dosyayı Aç", + "performThisTask": "Bu görevi gerçekleştirin.", + "persistedSession": "Kalıcı oturum (geri yüklemek için tıklayın)", + "removeChat": "Sohbeti Kaldır", + "renameChat": "Sohbeti Yeniden Adlandır", + "requestNotFoundForRetry": "Yeniden deneme için istek bulunamadı", + "responseFrom": "{0}'ın yanıtı", + "selectAgentQuickPickPlaceholder": "Yeni oturum için bir temsilci seçin", + "selectChat": "Sohbet seçin", + "selectContextVariableQuickPickPlaceholder": "Mesaja eklenecek bir bağlam değişkeni seçin", + "selectTaskContextQuickPickItem": { + "currentlyOpen": "şu anda açık" + }, + "selectTaskContextQuickPickPlaceholder": "Eklemek için bir görev bağlamı seçin", + "selectVariableArguments": "Değişken argümanları seçme", + "send": "Gönder (Enter)", + "sessionNotFoundForRetry": "Yeniden deneme için oturum bulunamadı", + "text-part-renderer": { + "cantDisplay": "Yanıt görüntülenemiyor, lütfen ChatResponsePartRenderers'ınızı kontrol edin!" + }, + "thinking-part-renderer": { + "thinking": "Düşünme" + }, + "toolcall-part-renderer": { + "denied": "Yürütme reddedildi", + "finished": "Ran", + "rejected": "Yürütme iptal edildi" + }, + "toolconfirmation": { + "allow-options-dropdown-tooltip": "Daha Fazla İzin Verme Seçeneği", + "allow-session": "Bu Sohbete İzin Verin", + "allowed": "Araç yürütmeye izin verildi", + "alwaysAllowConfirm": "Anlıyorum, otomatik onayı etkinleştir", + "alwaysAllowTitle": "\"{0}\" için Otomatik Onay'ı etkinleştirin?", + "canceled": "Araç çalıştırma iptal edildi", + "denied": "Araç yürütme reddedildi", + "deny-forever": "Her Zaman Reddet", + "deny-options-dropdown-tooltip": "Daha Fazla Reddetme Seçeneği", + "deny-reason-placeholder": "Reddedilme nedenini girin...", + "deny-session": "Bu Sohbet için Reddet", + "deny-with-reason": "Sebep göstererek reddetmek...", + "executionDenied": "Araç yürütme reddedildi", + "header": "Araç Yürütmeyi Onayla" + }, + "unableToSummarizeCurrentSession": "Geçerli oturum özetlenemiyor. Lütfen özet aracısının devre dışı bırakılmadığını doğrulayın.", + "unknown-part-renderer": { + "contentNotRestoreable": "Bu içerik ('{0}' türü) tam olarak geri yüklenemedi. Artık mevcut olmayan bir uzantıya ait olabilir." + }, + "unpinAgent": "Unpin Ajan", + "variantTooltip": "Hızlı varyant: {0}", + "yourMessage": "Mesajınız" + }, + "claude-code": { + "agentDescription": "Anthropic'in kodlama ajanı", + "askBeforeEdit": "Düzenlemeden önce sorun", + "changeSetTitle": "Claude Koduna Göre Değişiklikler", + "clearCommand": { + "description": "Yeni bir oturum oluşturun" + }, + "compactCommand": { + "description": "İsteğe bağlı odaklanma talimatları ile kompakt konuşma" + }, + "completedCount": "{0}/{1} tamamlandı", + "configCommand": { + "description": "Açık Claude Kodu Yapılandırması" + }, + "currentDirectory": "geçerli dizin", + "differentAgentRequestWarning": "Önceki sohbet isteği farklı bir temsilci tarafından ele alındı. Claude Code bu diğer mesajları görmez.", + "directory": "Rehber", + "domain": "Etki Alanı", + "editAutomatically": "Otomatik olarak düzenle", + "editNumber": "Düzenle {0}", + "editing": "Düzenleme", + "editsCount": "{0} DÜZENLEMELER", + "emptyTodoList": "Hepsi mevcut değil", + "entireFile": "Tüm Dosya", + "excludingOnePattern": " (1 desen hariç)", + "excludingPatterns": " ( {0} kalıpları hariç)", + "executedCommand": "Yürütüldü: {0}", + "failedToParseBashToolData": "Bash aracı verileri ayrıştırılamadı", + "failedToParseEditToolData": "Düzenleme aracı verileri ayrıştırılamadı", + "failedToParseGlobToolData": "Glob aracı verileri ayrıştırılamadı", + "failedToParseGrepToolData": "Grep aracı verileri ayrıştırılamadı", + "failedToParseLSToolData": "LS aracı verileri ayrıştırılamadı", + "failedToParseMultiEditToolData": "MultiEdit araç verileri ayrıştırılamadı", + "failedToParseReadToolData": "Okuma aracı verileri ayrıştırılamadı", + "failedToParseTodoListData": "Yapılacaklar listesi verileri ayrıştırılamadı", + "failedToParseWebFetchToolData": "WebFetch aracı verileri ayrıştırılamadı", + "failedToParseWriteToolData": "Yazma aracı verileri ayrıştırılamadı", + "fetching": "Getirme", + "fileFilter": "Dosya Filtresi", + "filePath": "Dosya Yolu", + "fileType": "Dosya Türü", + "findMatchingFiles": "Geçerli dizinde \"{0}\" glob kalıbıyla eşleşen dosyaları bulun", + "findMatchingFilesWithPath": "İçinde \"{0}\" glob kalıbıyla eşleşen dosyaları bulun {1}", + "finding": "Bulma", + "from": "Kimden", + "globPattern": "küre deseni", + "grepOptions": { + "caseInsensitive": "büyük/küçük harf duyarsız", + "glob": "Küre: {0}", + "headLimit": "Limit: {0}", + "lineNumbers": "hat numaraları", + "linesAfter": "+{0} sonra", + "linesBefore": "+{0} önce", + "linesContext": "±{0} bağlam", + "multiLine": "çok satırlı", + "type": "tip: {0}" + }, + "grepOutputModes": { + "content": "İçerik", + "count": "saymak", + "filesWithMatches": "eşleşen dosyalar" + }, + "ignoredPatterns": "Görmezden Gelinen Kalıplar", + "ignoringPatterns": "{0} kalıplarını göz ardı etme", + "initCommand": { + "description": "Projeyi CLAUDE.md kılavuzu ile başlatın" + }, + "itemCount": "{0} öğeler", + "lineLimit": "Hat Sınırı", + "lines": "Çizgiler", + "listDirectoryContents": "Dizin içeriğini listeleme", + "listing": "Listeleme", + "memoryCommand": { + "description": "CLAUDE.md bellek dosyasını düzenleyin" + }, + "multiEditing": "Çoklu düzenleme", + "oneEdit": "1 düzenleme", + "oneItem": "1 parça", + "oneOption": "1 seçenek", + "openDirectoryTooltip": "Dizini açmak için tıklayın", + "openFileTooltip": "Dosyayı düzenleyicide açmak için tıklayın", + "optionsCount": "{0} seçenekler", + "partial": "Kısmi", + "pattern": "Desen", + "plan": "Plan modu", + "project": "proje", + "projectRoot": "proje kökü", + "readMode": "Okuma Modu", + "reading": "Okuma", + "replaceAllCount": "{0} tümünü değiştir", + "replaceAllOccurrences": "Tüm oluşumları değiştirin", + "resumeCommand": { + "description": "Oturuma devam etme" + }, + "reviewCommand": { + "description": "Kod incelemesi talep edin" + }, + "searchPath": "Arama Yolu", + "searching": "Aranıyor", + "startingLine": "Başlangıç Çizgisi", + "timeout": "Zaman Aşımı", + "timeoutInMs": "Zaman aşımı: {0}ms", + "to": "için", + "todoList": "Yapılacaklar Listesi", + "todoPriority": { + "high": "yüksek", + "low": "düşük", + "medium": "orta" + }, + "toolApprovalRequest": "Claude Code \"{0}\" aracını kullanmak istiyor. Buna izin vermek istiyor musunuz?", + "totalEdits": "Toplam Düzenleme", + "webFetch": "Web Getirme", + "writing": "Yazma" + }, + "code-completion": { + "progressText": "Yapay zeka kod tamamlama hesaplanıyor..." + }, + "codex": { + "agentDescription": "Codex tarafından desteklenen OpenAI'nin kodlama asistanı", + "completedCount": "{0}/{1} tamamlandı", + "exitCode": "Çıkış kodu: {0}", + "fileChangeFailed": "Codex aşağıdaki değişiklikleri uygulamada başarısız oldu: {0}", + "fileChangeFailedGeneric": "Codex dosya değişikliklerini uygulayamadı.", + "itemCount": "{0} ürünler", + "noItems": "Hiçbir öğe yok", + "oneItem": "1 ürün", + "running": "Koşuyor...", + "searched": "Aranan", + "searching": "Arama", + "todoList": "Tüm Liste", + "webSearch": "Web Arama" + }, + "completion": { + "agent": { + "description": "Bu aracı, Theia IDE'deki kod düzenleyicide satır içi kod tamamlama sağlar.", + "vars": { + "file": { + "description": "Düzenlenmekte olan dosyanın URI'si" + }, + "language": { + "description": "Düzenlenmekte olan dosyanın languageId'si" + }, + "prefix": { + "description": "Geçerli imleç konumundan önceki kod" + }, + "suffix": { + "description": "Geçerli imleç konumundan sonraki kod" + } + } + }, + "automaticEnable": { + "description": "Düzenleme sırasında herhangi bir (Monaco) düzenleyicide satır içi AI tamamlamalarını otomatik olarak tetikleyin. \n Alternatif olarak, \"Satır İçi Öneriyi Tetikle\" komutu veya varsayılan \"Ctrl+Alt+Space\" kısayolu aracılığıyla kodu manuel olarak tetikleyebilirsiniz." + }, + "cacheCapacity": { + "description": "Önbellekte depolanacak maksimum kod tamamlama sayısı. Daha yüksek bir sayı performansı artırabilir ancak daha fazla bellek tüketecektir. Minimum değer 10'dur, önerilen aralık 50-200 arasındadır.", + "title": "Kod Tamamlama Önbellek Kapasitesi" + }, + "debounceDelay": { + "description": "Düzenleyicide değişiklikler algılandıktan sonra AI tamamlamalarını tetiklemeden önce milisaniye cinsinden gecikmeyi kontrol eder. Otomatik Kod Tamamlama`nın etkinleştirilmesini gerektirir. Debounce gecikmesini devre dışı bırakmak için 0 girin.", + "title": "Debounce Gecikmesi" + }, + "excludedFileExts": { + "description": "AI tamamlamalarının devre dışı bırakılması gereken dosya uzantılarını (örn. .md, .txt) belirtin.", + "title": "Hariç Tutulan Dosya Uzantıları" + }, + "fileVariable": { + "description": "Düzenlenmekte olan dosyanın URI'si. Yalnızca kod tamamlama bağlamında kullanılabilir." + }, + "languageVariable": { + "description": "Düzenlenmekte olan dosyanın languageId'si. Yalnızca kod tamamlama bağlamında kullanılabilir." + }, + "maxContextLines": { + "description": "İmleç konumundan önceki ve sonraki satırlar (önek ve sonek) arasında dağıtılan, bağlam olarak kullanılan maksimum satır sayısı. Herhangi bir satır sınırı olmadan tüm dosyayı bağlam olarak kullanmak için bunu -1'e ve yalnızca geçerli satırı kullanmak için 0'a ayarlayın.", + "title": "Maksimum Bağlam Çizgileri" + }, + "prefixVariable": { + "description": "Geçerli imleç konumundan önceki kod. Yalnızca kod tamamlama bağlamında kullanılabilir." + }, + "stripBackticks": { + "description": "Bazı LLM'ler tarafından döndürülen koddan çevreleyen arka işaretleri kaldırın. Eğer bir backtick tespit edilirse, kapanış backtick'inden sonraki tüm içerik de çıkarılır. Bu ayar, dil modelleri işaretleme benzeri biçimlendirme kullandığında düz kodun döndürülmesini sağlamaya yardımcı olur.", + "title": "Satır İçi Tamamlamalardan Arka İşaretleri Silme" + }, + "suffixVariable": { + "description": "Geçerli imleç konumundan sonraki kod. Yalnızca kod tamamlama bağlamında kullanılabilir." + } + }, + "configuration": { + "selectItem": "Lütfen bir öğe seçin." + }, + "copilot": { + "auth": { + "aiConfiguration": "AI Yapılandırması", + "authorize": "Yetki verdim", + "copied": "Kopyalandı!", + "copyCode": "Kodu kopyala", + "expired": "Yetki süresi doldu veya reddedildi. Lütfen tekrar deneyin.", + "hint": "Kodu girip yetkilendirdikten sonra, aşağıdaki \"Yetkilendirdim\" seçeneğine tıklayın.", + "initiating": "Kimlik doğrulama başlatılıyor...", + "instructions": "Theia'nın GitHub Copilot'u kullanmasına izin vermek için aşağıdaki URL'yi ziyaret edin ve kodu girin:", + "openGitHub": "GitHub'ı aç", + "success": "GitHub Copilot'a başarıyla giriş yaptınız!", + "successHint": "GitHub hesabınız Copilot'a erişime sahipse, artık Copilot dil modellerini ", + "title": "GitHub Copilot'a giriş yapın", + "tos": "Giriş yaparak, aşağıdakileri kabul etmiş olursunuz: ", + "tosLink": "GitHub Hizmet Şartları", + "verifying": "Yetki doğrulama..." + }, + "category": "Copilot", + "commands": { + "signIn": "GitHub Copilot'a giriş yapın", + "signOut": "GitHub Copilot'tan çıkış yapın" + }, + "enterpriseUrl": { + "mdDescription": "Copilot API için GitHub Enterprise etki alanı (ör. `github.mycompany.com`). GitHub.com için boş bırakın." + }, + "models": { + "description": "Kullanılacak GitHub Copilot modelleri. Kullanılabilir modeller, Copilot aboneliğinize bağlıdır." + }, + "statusBar": { + "signedIn": "{0} olarak GitHub Copilot'a giriş yaptınız. Çıkmak için tıklayın.", + "signedOut": "GitHub Copilot'a giriş yapmadınız. Giriş yapmak için tıklayın." + } + }, + "core": { + "agentConfiguration": { + "actions": "Eylemler", + "addCustomAgent": "Özel Temsilci Ekleme", + "enableAgent": "Temsilciyi Etkinleştir", + "label": "Ajanlar", + "llmRequirements": "LLM Gereksinimleri", + "notUsedInPrompt": "Bilgi isteminde kullanılmaz", + "promptTemplates": "İstem Şablonları", + "selectAgentMessage": "Lütfen önce bir Acente seçin!", + "templateName": "Şablon", + "undeclared": "Beyan edilmemiş", + "usedAgentSpecificVariables": "Kullanılan Ajan Özel Değişkenleri", + "usedFunctions": "Kullanılan İşlevler", + "usedGlobalVariables": "Kullanılan Global Değişkenler", + "variant": "Varyant" + }, + "agentsVariable": { + "description": "Sistemde bulunan aracıların listesini döndürür" + }, + "aiConfiguration": { + "label": "✨ AI Konfigürasyonu [Alfa]" + }, + "blinkTitle": { + "agentCompleted": "Theia - Temsilci Tamamlandı", + "namedAgentCompleted": "Theia - Ajan \"{0}\" Tamamlandı" + }, + "changeSetSummaryVariable": { + "description": "Bir değişiklik kümesindeki dosyaların ve içeriklerinin bir özetini sağlar." + }, + "contextDetailsVariable": { + "description": "Tüm bağlam öğeleri için tam metin değerleri ve açıklamaları sağlar." + }, + "contextSummaryVariable": { + "description": "Belirli bir oturum için bağlamdaki dosyaları açıklar." + }, + "customAgentTemplate": { + "description": "Bu örnek bir acentedir. Lütfen özellikleri kendi ihtiyaçlarınıza göre uyarlayın." + }, + "defaultModelAliases": { + "code": { + "description": "Kod anlama ve oluşturma görevleri için optimize edilmiştir." + }, + "code-completion": { + "description": "Kod otomatik tamamlama senaryoları için en uygunudur." + }, + "summarize": { + "description": "Modeller, içeriğin özetlenmesi ve yoğunlaştırılması için önceliklendirilmiştir." + }, + "universal": { + "description": "Hem kod hem de genel dil kullanımı için iyi dengelenmiş." + } + }, + "defaultNotification": { + "mdDescription": "Bir YZ müşteri temsilcisi bir görevi tamamladığında kullanılan varsayılan bildirim yöntemi. Bireysel ajanlar bu ayarı geçersiz kılabilir.\n - `os-bildirim`: İşletim sistemi/sistem bildirimlerini göster\n - `mesaj`: Bildirimleri durum çubuğunda/mesaj alanında göster\n - `blink`: Kullanıcı arayüzünü yanıp söner veya vurgular\n - kapalı`: Tüm bildirimleri devre dışı bırak", + "title": "Varsayılan Bildirim Türü" + }, + "discard": { + "label": "Yapay Zeka İstemi Şablonunu Atın" + }, + "discardCustomPrompt": { + "tooltip": "Özelleştirmeleri Atın" + }, + "fileVariable": { + "description": "Bir dosyanın içeriğini çözer", + "uri": { + "description": "İstenen dosyanın URI'si." + } + }, + "languageModelRenderer": { + "alias": "[takma ad] {0}", + "languageModel": "Dil Modeli", + "purpose": "Amaç" + }, + "maxRetries": { + "mdDescription": "Bir AI sağlayıcısına yapılan bir istek başarısız olduğunda maksimum yeniden deneme sayısı. 0 değeri, yeniden deneme yapılmayacağı anlamına gelir.", + "title": "Maksimum Yeniden Deneme" + }, + "modelAliasesConfiguration": { + "agents": "Bu Takma Adı Kullanan Temsilciler", + "defaultList": "[Varsayılan liste]", + "evaluatesTo": "Değerlendirir", + "label": "Model Takma Adları", + "modelNotReadyTooltip": "Hazır değil", + "modelReadyTooltip": "Hazır", + "noAgents": "Hiçbir temsilci bu takma adı kullanmaz.", + "noModelReadyTooltip": "Hazır model yok", + "noResolvedModel": "Bu takma ad için hazır model yok.", + "priorityList": "Öncelik Listesi", + "selectAlias": "Lütfen bir Model Takma Adı seçin.", + "selectedModelId": "Seçilen Model", + "unavailableModel": "Seçilen model artık mevcut değil" + }, + "noVariableFoundForOpenRequest": "Açık istek için değişken bulunamadı.", + "openEditorsShortVariable": { + "description": "O anda açık olan tüm dosyalara kısa referans (göreli yollar, virgülle ayrılmış)" + }, + "openEditorsVariable": { + "description": "Çalışma alanı köküne göre o anda açık olan tüm dosyaların virgülle ayrılmış bir listesi." + }, + "preference": { + "languageModelAliases": { + "description": "AI Yapılandırma Görünümü]({0})'nde her dil modeli takma adı için modelleri yapılandırın. Alternatif olarak ayarları settings.json'da manuel olarak ayarlayabilirsiniz: \n```\n\"default/code\": {\n \"selectedModel\": \"anthropic/claude-opus-4-20250514\"\n}\n```", + "selectedModel": "Bu takma ad için kullanıcı tarafından seçilen model.", + "title": "Dil Modeli Takma Adları" + } + }, + "prefs": { + "title": "✨ Yapay Zeka Özellikleri [Alfa]" + }, + "promptFragmentsConfiguration": { + "activeCustomizationTitle": "Aktif özelleştirme", + "createCustomizationTitle": "Özelleştirme Oluştur", + "customization": "özelleşti̇rme", + "customizationLabel": "Özelleştirme", + "defaultVariantTitle": "Varsayılan varyant", + "deleteCustomizationTitle": "Özelleştirmeyi Sil", + "editTemplateTitle": "Şablonu düzenle", + "headerTitle": "İstem Fragmanları", + "label": "İstem Fragmanları", + "noFragmentsAvailable": "Hiçbir hızlı parça mevcut değildir.", + "otherPromptFragmentsHeader": "Diğer İstem Parçaları", + "promptTemplateText": "İstem Şablonu Metni", + "promptVariantsHeader": "İstem Varyant Setleri", + "removeCustomizationDialogMsg": "\"{1}\" istem parçası için {0} özelleştirmesini kaldırmak istediğinizden emin misiniz?", + "removeCustomizationDialogTitle": "Özelleştirmeyi Kaldır", + "removeCustomizationWithDescDialogMsg": "\"{1}\" ({2}) istem parçası için {0} özelleştirmesini kaldırmak istediğinizden emin misiniz?", + "resetAllButton": "Tümünü Sıfırla", + "resetAllCustomizationsDialogMsg": "Tüm istem parçalarını yerleşik sürümlerine sıfırlamak istediğinizden emin misiniz? Bu, tüm özelleştirmeleri kaldıracaktır.", + "resetAllCustomizationsDialogTitle": "Tüm Özelleştirmeleri Sıfırla", + "resetAllCustomizationsTitle": "Tüm özelleştirmeleri sıfırla", + "resetAllPromptFragments": "Tüm istem parçalarını sıfırla", + "resetToBuiltInDialogMsg": "\"{0}\" istem parçasını yerleşik sürümüne sıfırlamak istediğinizden emin misiniz? Bu, tüm özelleştirmeleri kaldıracaktır.", + "resetToBuiltInDialogTitle": "Yerleşik'e Sıfırla", + "resetToBuiltInTitle": "Bu yerleşik değere sıfırlayın", + "resetToCustomizationDialogMsg": "{1} özelleştirmesini kullanmak için \"{0}\" istem parçasını sıfırlamak istediğinizden emin misiniz? Bu, daha yüksek öncelikli tüm özelleştirmeleri kaldıracaktır.", + "resetToCustomizationDialogTitle": "Özelleştirmeye Sıfırla", + "resetToCustomizationTitle": "Bu özelleştirmeye sıfırla", + "selectedVariantLabel": "Seçilmiş", + "selectedVariantTitle": "Seçilmiş varyant", + "usedByAgentTitle": "Acente tarafından kullanılıyor: {0}", + "variantSetError": "Seçilen varyant mevcut değil ve varsayılan bulunamadı. Lütfen yapılandırmanızı kontrol edin.", + "variantSetWarning": "Seçilen varyant mevcut değil. Bunun yerine varsayılan varyant kullanılıyor.", + "variantsOfSystemPrompt": "Bu bilgi istemi varyant setinin varyantları:" + }, + "promptTemplates": { + "description": "Özelleştirilmiş istem şablonlarını saklamak için kullanılan klasör. Eğer özelleştirilmemişse kullanıcı yapılandırma dizini kullanılır. Lütfen istem şablonlarınızın varyantlarını yönetmek için sürüm kontrolü altında olan bir klasör kullanmayı düşünün.", + "openLabel": "Klasör Seçin" + }, + "promptVariable": { + "argDescription": "Çözümlenecek istem şablonu kimliği", + "completions": { + "detail": { + "builtin": "Yerleşik istem parçası", + "custom": "Özelleştirilmiş istem parçası" + } + }, + "description": "Bilgi istemi şablonlarını bilgi istemi hizmeti aracılığıyla çözer" + }, + "prompts": { + "category": "Theia AI İstemi Şablonları" + }, + "requestSettings": { + "clientSettings": { + "description": "llm'ye geri gönderilen mesajların nasıl işleneceğine ilişkin istemci ayarları.", + "keepThinking": { + "description": "false olarak ayarlanırsa, çok turlu bir görüşmede bir sonraki kullanıcı isteği gönderilmeden önce tüm düşünme çıktıları filtrelenir." + }, + "keepToolCalls": { + "description": "false olarak ayarlanırsa, çok turlu bir görüşmede bir sonraki kullanıcı isteği gönderilmeden önce tüm araç isteği ve araç yanıtları filtrelenir." + } + }, + "mdDescription": "Birden fazla model için özel istek ayarlarının belirtilmesine izin verir.\n Her nesne belirli bir model için yapılandırmayı temsil eder. ModelId` alanı model kimliğini belirtir, `requestSettings` modele özgü ayarları tanımlar.\n ProviderId` alanı isteğe bağlıdır ve ayarları belirli bir sağlayıcıya uygulamanıza olanak tanır. Ayarlanmazsa, ayarlar tüm sağlayıcılara uygulanır.\n Örnek providerId'ler: huggingface, openai, ollama, llamafile.\n Daha fazla bilgi için [belgelerimize] (https://theia-ide.org/docs/user_ai/#custom-request-settings) bakın.", + "modelSpecificSettings": { + "description": "Belirli model kimliği için ayarlar." + }, + "scope": { + "agentId": { + "description": "Ayarların uygulanacağı (isteğe bağlı) temsilci kimliği." + }, + "modelId": { + "description": "(İsteğe bağlı) model kimliği" + }, + "providerId": { + "description": "Ayarların uygulanacağı (isteğe bağlı) sağlayıcı kimliği." + } + }, + "title": "Özel İstek Ayarları" + }, + "skillsVariable": { + "description": "AI ajanları tarafından kullanılabilecek mevcut becerilerin listesini döndürür." + }, + "taskContextSummary": { + "description": "Oturum bağlamında bulunan tüm görev bağlamı öğelerini çözer." + }, + "templateSettings": { + "edited": "düzenlenmiş", + "unavailableVariant": "Seçilen varyant artık mevcut değil" + }, + "todayVariable": { + "description": "Bugün için bir şey yapar", + "format": { + "description": "Tarihin biçimi" + } + }, + "unableToDisplayVariableValue": "Değişken değeri görüntülenemiyor.", + "unableToResolveVariable": "Değişken çözümlenemiyor.", + "variable-contribution": { + "builtInVariable": "Theia Yerleşik Değişken", + "currentAbsoluteFilePath": "Geçerli olarak açılmış dosyanın mutlak yolu. Lütfen çoğu aracının göreli bir dosya yolu (geçerli çalışma alanına göreli) bekleyeceğini unutmayın.", + "currentFileContent": "O anda açık olan dosyanın düz içeriği. Bu, içeriğin nereden geldiği bilgisini hariç tutar. Lütfen çoğu aracının göreli bir dosya yolu (geçerli çalışma alanına göreli) ile daha iyi çalışacağını unutmayın.", + "currentRelativeDirPath": "Geçerli olarak açılmış dosyayı içeren dizinin göreli yolu.", + "currentRelativeFilePath": "O anda açık olan dosyanın göreli yolu.", + "currentSelectedText": "Açılan dosyada o anda seçili olan düz metin. Bu, içeriğin nereden geldiği bilgisini hariç tutar. Lütfen çoğu aracının göreli bir dosya yolu (geçerli çalışma alanına göreli) ile daha iyi çalışacağını unutmayın.", + "dotRelativePath": "O anda açık olan dosyanın göreli yoluna kısa referans ('currentRelativeFilePath')." + } + }, + "editor": { + "editorContextVariable": { + "description": "Editöre özel bağlam bilgilerini çözer", + "label": "EditorContext" + }, + "explainWithAI": { + "prompt": "Bu hatayı açıklayın", + "title": "Yapay zeka ile açıklayın" + }, + "fixWithAI": { + "prompt": "Bu hatayı düzeltmek için yardım" + } + }, + "google": { + "apiKey": { + "description": "Resmi Google AI (Gemini) Hesabınızın API Anahtarını girin. **Lütfen dikkat:** Bu tercihi kullanarak GOOGLE AI API anahtarı Theia'yı çalıştıran makinede açık metin olarak saklanacaktır. Anahtarı güvenli bir şekilde ayarlamak için `GOOGLE_API_KEY` ortam değişkenini kullanın." + }, + "maxRetriesOnErrors": { + "description": "Hata durumunda maksimum yeniden deneme sayısı. 1'den küçükse, yeniden deneme mantığı devre dışı bırakılır" + }, + "models": { + "description": "Kullanılacak resmi Google Gemini modelleri" + }, + "retryDelayOnOtherErrors": { + "description": "Diğer hatalar durumunda yeniden denemeler arasındaki saniye cinsinden gecikme (bazen Google GenAI, modelden döndürülen eksik JSON sözdizimi veya 500 Dahili Sunucu Hatası gibi hatalar bildirir). Bunu -1 olarak ayarlamak, bu durumlarda yeniden denemeleri önler. Aksi takdirde, yeniden deneme ya hemen (0 olarak ayarlanmışsa) ya da saniye cinsinden bu gecikmeden sonra (pozitif bir sayıya ayarlanmışsa) gerçekleşir." + }, + "retryDelayOnRateLimitError": { + "description": "Hız sınırı hataları durumunda yeniden denemeler arasında saniye cinsinden gecikme. Bkz. https://ai.google.dev/gemini-api/docs/rate-limits" + } + }, + "history": { + "clear": { + "tooltip": "Tüm acentelerin Geçmişini Temizle" + }, + "exchange-card": { + "agentId": "Ajan", + "timestamp": "Başladı" + }, + "open-history-tooltip": "Yapay zeka tarihini açın...", + "request-card": { + "agent": "Ajan", + "model": "Model", + "request": "İstek", + "response": "Yanıt", + "timestamp": "Zaman Damgası", + "title": "İstek" + }, + "sortChronologically": { + "tooltip": "Kronolojik olarak sırala" + }, + "sortReverseChronologically": { + "tooltip": "Ters kronolojik olarak sırala" + }, + "toggleCompact": { + "tooltip": "Kompakt görünümü göster" + }, + "toggleHideNewlines": { + "tooltip": "Yeni satırları yorumlamayı durdur" + }, + "toggleRaw": { + "tooltip": "Ham görünümü göster" + }, + "toggleRenderNewlines": { + "tooltip": "Yeni satırları yorumlama" + }, + "view": { + "label": "✨ Yapay Zeka Ajan Geçmişi [Alfa]", + "noAgent": "Temsilci mevcut değil.", + "noAgentSelected": "Temsilci seçilmedi.", + "noHistoryForAgent": "Seçilen acente için mevcut geçmiş yok '{0}'" + } + }, + "huggingFace": { + "apiKey": { + "mdDescription": "Hugging Face Hesabınız için bir API Anahtarı girin. **Lütfen dikkat:** Bu tercihi kullanarak Hugging Face API anahtarı Theia'yı çalıştıran makinede açık metin olarak saklanacaktır. Anahtarı güvenli bir şekilde ayarlamak için `HUGGINGFACE_API_KEY` ortam değişkenini kullanın." + }, + "models": { + "mdDescription": "Kullanılacak Hugging Face modelleri. **Lütfen dikkat:** Şu anda yalnızca sohbet tamamlama API'sini destekleyen modeller (`*-Instruct` gibi talimat ayarlı modeller) desteklenmektedir. Bazı modeller için Hugging Face web sitesinde lisans koşullarını kabul etmeniz gerekebilir." + } + }, + "ide": { + "agent-description": "Etkinleştirme, LLM seçimi, istem şablonu özelleştirme ve [AI Yapılandırma Görünümü]'nde özel aracı oluşturma dahil olmak üzere AI aracı ayarlarını yapılandırın({0}).", + "agentConfiguration": { + "customAgentLocationQuickPick": { + "createNewFile": "Yeni dosya oluştur", + "openExistingFile": "Mevcut dosyayı aç", + "placeholder": "Özel bir aracı dosyasının nerede oluşturulacağını veya açılacağını seçin", + "title": "Özel Temsilciler Dosyası için Konum Seçin" + }, + "noDescription": "Açıklama mevcut değil" + }, + "app-tester": { + "errorCheckingDevToolsServerStatus": "DevTools MCP sunucu durumunu kontrol ederken hata oluştu: {0}", + "errorCheckingPlaywrightServerStatus": "Playwright MCP sunucu durumu kontrol edilirken hata oluştu: {0}", + "startChromeDevToolsMcpServers": { + "canceled": "Lütfen Chrome DevTools MCP sunucusunu kurun.", + "error": "Chrome DevTools MCP sunucusu başlatılamadı: {0}", + "progress": "Chrome DevTools MCP sunucusunu başlatıyor.", + "question": "Chrome DevTools MCP sunucusu çalışmıyor. Şimdi başlatmak ister misiniz? Bu, Chrome DevTools MCP sunucusunu yükleyebilir." + }, + "startMcpServers": { + "no": "Hayır, iptal et", + "yes": "Evet, sunucuları başlatın." + }, + "startPlaywrightServers": { + "canceled": "Lütfen MCP sunucularını kurun.", + "error": "Playwright MCP sunucusu başlatılamadı: {0}", + "progress": "Playwright MCP sunucularını başlatma.", + "question": "Playwright MCP sunucuları çalışmıyor. Onları şimdi başlatmak ister misiniz? Bu, Playwright MCP sunucularını yükleyebilir." + } + }, + "architectAgent": { + "mode": { + "default": "Varsayılan Mod", + "plan": "Modaya uygun plan", + "simple": "Basit Mod" + }, + "suggestion": { + "executePlanWithCoder": "Coder ile \"{0}\" komutunu çalıştırın.", + "summarizeSessionAsTaskForCoder": "Bu oturumu Kodlayıcı için bir görev olarak özetleyin", + "updateTaskContext": "Geçerli görev bağlamını güncelle" + } + }, + "bypassHint": "Claude Code gibi bazı ajanlar Theia Dil Modellerine ihtiyaç duymazlar.", + "chatDisabledMessage": { + "featuresTitle": "Şu anda desteklenen görünümler ve özellikler:" + }, + "coderAgent": { + "mode": { + "agentNext": "Ajan Modu (Sonraki)", + "edit": "Düzenleme Modu" + }, + "suggestion": { + "fixProblems": { + "content": "Geçerli dosyada [Sorunları düzeltin]({0}).", + "prompt": "lütfen {1} adresine bakın ve sorunları giderin." + }, + "startNewChat": "Sohbetleri kısa ve odaklanmış tutun. Yeni bir görev için [Yeni bir sohbet başlatın]({0}) veya [Bu sohbetin özetini içeren yeni bir sohbet başlatın]({1})." + } + }, + "commandAgent": { + "commandCallback": { + "confirmAction": "Anladım.", + "label": "Yapay zeka komutu" + }, + "response": { + "customHandler": "Bunu uygulamayı dene:", + "noCommand": "Üzgünüm, böyle bir komut bulamıyorum", + "theiaCommand": "Size yardımcı olabilecek bu komutu buldum:" + }, + "vars": { + "commandIds": { + "description": "Theia'daki mevcut komutların listesi." + } + } + }, + "configureAgent": { + "header": "Varsayılan aracıyı yapılandırın" + }, + "continueAnyway": "Yine de devam et", + "createSkillAgent": { + "mode": { + "edit": "Varsayılan Mod" + } + }, + "enableAI": { + "mdDescription": "❗ Bu ayar, en son AI özelliklerine (Beta sürümü) erişmenizi sağlar. \n Bu özelliklerin beta aşamasında olduğunu, yani değişikliklere uğrayabileceğini ve daha da geliştirileceğini lütfen unutmayın. Bu özelliklerin, erişim sağladığınız dil modellerine (LLM'ler) sürekli talepler oluşturabileceğinin farkında olmanız önemlidir. Bu, yakından izlemeniz gereken maliyetlere neden olabilir. Bu seçeneği etkinleştirerek bu riskleri kabul etmiş olursunuz. \n **Lütfen dikkat! Bu bölümdeki aşağıdaki ayarlar yalnızca geçerli olacaktır\n ana özellik ayarı etkinleştirildikten sonra. Özelliği etkinleştirdikten sonra, aşağıda en az bir LLM sağlayıcısı yapılandırmanız gerekir. Ayrıca [belgelere] (https://theia-ide.org/docs/user_ai/)** bakın." + }, + "github": { + "configureGitHubServer": { + "canceled": "GitHub sunucu yapılandırması iptal edildi. Lütfen GitHub MCP sunucusunu bu aracıyı kullanacak şekilde yapılandırın.", + "no": "Hayır, iptal et", + "yes": "Evet, GitHub sunucusunu yapılandırın" + }, + "errorCheckingGitHubServerStatus": "GitHub MCP sunucu durumu kontrol edilirken hata oluştu: {0}", + "startGitHubServer": { + "canceled": "Bu aracıyı kullanmak için lütfen GitHub MCP sunucusunu başlatın.", + "error": "GitHub MCP sunucusu başlatılamadı: {0}", + "no": "Hayır, iptal et", + "progress": "GitHub MCP sunucusu başlatılıyor.", + "question": "GitHub MCP sunucusu yapılandırıldı ancak çalışmıyor. Şimdi başlatmak ister misiniz?", + "yes": "Evet, sunucuyu başlatın" + } + }, + "githubRepoName": { + "description": "Geçerli GitHub deposunun adı (örneğin, \"eclipse-theia/theia\")" + }, + "model-selection-description": "AI Yapılandırma Görünümü]({0})'nde her bir YZ aracısı tarafından hangi Büyük Dil Modellerinin (LLM'ler) kullanılacağını seçin.", + "moreAgentsAvailable": { + "header": "Daha fazla ajan mevcuttur" + }, + "noRecommendedAgents": "Önerilen ajanlar mevcut değildir.", + "openSettings": "AI Ayarlarını Aç", + "or": "veya", + "orchestrator": { + "error": { + "noAgents": "İstekle ilgilenecek sohbet temsilcisi yok. Lütfen yapılandırmanızın etkin olup olmadığını kontrol edin." + }, + "progressMessage": "En uygun ajanın belirlenmesi", + "response": { + "delegatingToAgent": "@{0}` adresine delege etme" + } + }, + "prompt-template-description": "AI Yapılandırma Görünümü]({0})'nde AI temsilcileri için istem varyantlarını seçin ve istem şablonlarını özelleştirin.", + "recommendedAgents": "Önerilen ajanlar:", + "skillsConfiguration": { + "label": "Beceri", + "location": { + "label": "Konum" + } + }, + "toolsConfiguration": { + "confirmAlwaysAllow": { + "confirm": "Anlıyorum, otomatik onayı etkinleştir", + "title": "\"{0}\" için Otomatik Onay'ı etkinleştirin?" + }, + "confirmationMode": { + "label": "Onay Modu" + }, + "default": { + "label": "Varsayılan Araç Onay Modu:" + }, + "resetAll": "Tümünü Sıfırla", + "resetAllConfirmDialog": { + "msg": "Tüm araç onay modlarını varsayılana sıfırlamak istediğinizden emin misiniz? Bu, tüm özel ayarları kaldıracaktır.", + "title": "Tüm Araç Onay Modlarını Sıfırla" + }, + "resetAllTooltip": "Tüm araçları varsayılana sıfırla", + "toolOptions": { + "confirm": { + "label": "Onaylayın" + } + } + }, + "variableConfiguration": { + "selectVariable": "Lütfen bir Değişken seçin.", + "usedByAgents": "Acenteler tarafından kullanılır", + "variableArgs": "Değişken Bağımsız Değişkenler" + } + }, + "llamaFile": { + "prefs": { + "mdDescription": "Bu ayar, Theia IDE'de LlamaFile modellerini yapılandırmanıza ve yönetmenize olanak tanır. \n Her girdi kullanıcı dostu bir `isim`, LlamaFile'ınıza işaret eden `uri` dosyası ve çalışacağı `port` gerektirir. \n Bir LlamaFile başlatmak için, istediğiniz modeli seçmenizi sağlayan \"Start LlamaFile\" komutunu kullanın. \n Bir girişi düzenlerseniz (örneğin, bağlantı noktasını değiştirirseniz), çalışan herhangi bir örnek durur ve onu manuel olarak yeniden başlatmanız gerekir. \n [Theia IDE dokümantasyonunda LlamaFiles'ı yapılandırma ve yönetme hakkında daha fazla bilgi edinin](https://theia-ide.org/docs/user_ai/#llamafile-models).", + "name": { + "description": "Bu Llamafile için kullanılacak model adı." + }, + "port": { + "description": "Sunucuyu başlatmak için kullanılacak bağlantı noktası." + }, + "title": "✨ AI LlamaFile", + "uri": { + "description": "Llamafile için dosya uri'si." + } + }, + "start": "Llamafile'ı başlat", + "stop": "Llamafile'ı durdurun" + }, + "llamafile": { + "error": { + "noConfigured": "Yapılandırılmış Llamafiles yok.", + "noRunning": "Llamafiles çalışmıyor.", + "startFailed": "llamafile başlangıcı sırasında bir şeyler yanlış gitti: {0}.\nDaha fazla bilgi için konsola bakın.", + "stopFailed": "llamafile durdurma sırasında bir şeyler yanlış gitti: {0}.\nDaha fazla bilgi için konsola bakın." + } + }, + "mcp": { + "error": { + "allServersRunning": "Tüm MCP sunucuları zaten çalışıyor.", + "noRunningServers": "Çalışan MCP sunucusu yok.", + "noServersConfigured": "Yapılandırılmış MCP sunucusu yok.", + "startFailed": "MCP sunucusu başlatılırken bir hata oluştu." + }, + "info": { + "serverStarted": "MCP sunucusu \"{0}\" başarıyla başlatıldı. Kayıtlı araçlar: {1}" + }, + "servers": { + "args": { + "mdDescription": "Komuta iletilecek bağımsız değişkenler dizisi.", + "title": "Komut için bağımsız değişkenler" + }, + "autostart": { + "mdDescription": "Ön uç başladığında bu sunucuyu otomatik olarak başlat. Yeni eklenen sunucular hemen otomatik olarak başlatılmaz, ancak yeniden başlatıldığında", + "title": "Otomatik başlatma" + }, + "command": { + "mdDescription": "MCP sunucusunu başlatmak için kullanılan komut, örneğin \"uvx\" veya \"npx\".", + "title": "MCP sunucusunu çalıştırmak için komut" + }, + "env": { + "mdDescription": "API anahtarı gibi sunucu için ayarlanacak isteğe bağlı ortam değişkenleri.", + "title": "Ortam değişkenleri" + }, + "headers": { + "mdDescription": "Sunucuya yapılan her istekte bulunan isteğe bağlı ek başlıklar.", + "title": "Başlıklar" + }, + "mdDescription": "MCP sunucularını komut, argümanlar, isteğe bağlı olarak ortam değişkenleri ve otomatik başlatma (varsayılan olarak true) ile yapılandırın. Her sunucu \"brave-search\" veya \"filesystem\" gibi benzersiz bir anahtarla tanımlanır. Bir sunucuyu başlatmak için, istediğiniz sunucuyu seçmenizi sağlayan \"MCP: MCP Sunucusunu Başlat\" komutunu kullanın. Bir sunucuyu durdurmak için \"MCP: MCP Sunucusunu Durdur\" komutunu kullanın. Otomatik başlatmanın yalnızca bir yeniden başlatmadan sonra etkili olacağını lütfen unutmayın, bir sunucuyu ilk kez manuel olarak başlatmanız gerekir.\nÖrnek yapılandırma:\n```{\n \"cesur-arama\": {\n \"command\": \"npx\",\n \"args\": [\n \"-y\",\n \"@modelcontextprotocol/server-brave-search\"\n ],\n \"env\": {\n \"BRAVE_API_KEY\": \"YOUR_API_KEY\"\n },\n },\n \"dosya sistemi\": {\n \"command\": \"npx\",\n \"args\": [\"-y\", \"@modelcontextprotocol/server-filesystem\", \"/Users/YOUR_USERNAME/Desktop\"],\n \"env\": {\n \"CUSTOM_ENV_VAR\": \"custom-value\"\n },\n \"autostart\": false\n }\n}\n```", + "serverAuthToken": { + "mdDescription": "Gerekiyorsa, sunucu için kimlik doğrulama belirteci. Bu, uzak sunucu ile kimlik doğrulaması yapmak için kullanılır.", + "title": "Kimlik Doğrulama Simgesi" + }, + "serverAuthTokenHeader": { + "mdDescription": "Sunucu kimlik doğrulama belirteci için kullanılacak başlık adı. Sağlanmamışsa, \"Bearer\" ile \"Authorization\" kullanılacaktır.", + "title": "Kimlik Doğrulama Başlığı Adı" + }, + "serverUrl": { + "mdDescription": "Uzak MCP sunucusunun URL'si. Sağlanırsa, sunucu yerel bir işlem başlatmak yerine bu URL'ye bağlanır.", + "title": "Sunucu URL'si" + }, + "title": "MCP Sunucuları Yapılandırması" + }, + "start": { + "label": "MCP: MCP Sunucusunu Başlat" + }, + "stop": { + "label": "MCP: MCP Sunucusunu Durdur" + } + }, + "mcpConfiguration": { + "arguments": "Argümanlar: ", + "autostart": "Otomatik başlatma: ", + "connectServer": "Connnect", + "connectingServer": "Bağlanıyor...", + "copiedAllList": "Tüm araçları panoya kopyalama (tüm araçların listesi)", + "copiedAllSingle": "Tüm araçları panoya kopyaladı (tüm araçlarla birlikte tek istem parçası)", + "copiedForPromptTemplate": "Bilgi istemi şablonu için tüm araçları panoya kopyaladı (tüm araçları içeren tek bilgi istemi parçası)", + "copyAllList": "Tümünü kopyala (tüm araçların listesi)", + "copyAllSingle": "Sohbet için tümünü kopyala (tüm araçlarla tek istem parçası)", + "copyForPrompt": "Kopyalama aracı (sohbet veya istem şablonu için)", + "copyForPromptTemplate": "Bilgi istemi şablonu için tümünü kopyala (tüm araçlarla tek bilgi istemi parçası)", + "environmentVariables": "Ortam Değişkenleri: ", + "headers": "Başlıklar: ", + "noServers": "Yapılandırılmış MCP sunucusu yok", + "serverAuthToken": "Kimlik Doğrulama Simgesi: ", + "serverAuthTokenHeader": "Kimlik Doğrulama Başlığı Adı: ", + "serverUrl": "Sunucu URL'si: ", + "tools": "Aletler: " + }, + "openai": { + "apiKey": { + "mdDescription": "Resmi OpenAI Hesabınızın API Anahtarını girin. **Lütfen dikkat:** Bu tercihi kullanarak Open AI API anahtarı Theia'yı çalıştıran makinede açık metin olarak saklanacaktır. Anahtarı güvenli bir şekilde ayarlamak için `OPENAI_API_KEY` ortam değişkenini kullanın." + }, + "customEndpoints": { + "apiKey": { + "title": "Ya verilen URL'de sunulan API'ye erişmek için anahtar ya da global OpenAI API anahtarını kullanmak için `true`" + }, + "apiVersion": { + "title": "Azure'da verilen URL'de sunulan API'ye erişmek için sürüm veya genel OpenAI API sürümünü kullanmak için `true`" + }, + "deployment": { + "title": "Azure'da verilen url'de sunulan API'ye erişmek için dağıtım adı" + }, + "developerMessageSettings": { + "title": "Sistem mesajlarının işlenmesini kontrol eder: user`, `system` ve `developer` rol olarak kullanılacaktır, `mergeWithFollowingUserMessage` takip eden kullanıcı mesajının önüne sistem mesajını ekleyecek veya sonraki mesaj bir kullanıcı mesajı değilse sistem mesajını kullanıcı mesajına dönüştürecektir. `skip` sadece sistem mesajını kaldıracaktır), varsayılan olarak `developer`." + }, + "enableStreaming": { + "title": "Akış API'sinin kullanılıp kullanılmayacağını belirtir. Varsayılan olarak `true`." + }, + "id": { + "title": "Özel modeli tanımlamak için kullanıcı arayüzünde kullanılan benzersiz bir tanımlayıcı" + }, + "mdDescription": "OpenAI API ile uyumlu özel modelleri, örneğin `vllm` aracılığıyla entegre edin. Gerekli nitelikler `model` ve `url`dür. \n İsteğe bağlı olarak şunları yapabilirsiniz \n - UI`daki özel modeli tanımlamak için benzersiz bir `id` belirtin. Hiçbiri belirtilmemişse `model`, `id` olarak kullanılacaktır. \n - verilen url'de sunulan API'ye erişmek için bir `apiKey` sağlayın. Global OpenAI API anahtarının kullanımını belirtmek için `true` kullanın. \n - Azure'da verilen url'de sunulan API'ye erişmek için bir `apiVersion` sağlayın. Global OpenAI API sürümünün kullanımını belirtmek için `true` kullanın. \n - geliştirici mesajının nasıl dahil edileceğini kontrol etmek için `developerMessageSettings` öğesini `user`, `system`, `developer`, `mergeWithFollowingUserMessage` veya `skip` öğelerinden birine ayarlayın (burada `user`, `system` ve `developer` rol olarak kullanılacaktır, `mergeWithFollowingUserMessage` sonraki kullanıcı mesajının önüne sistem mesajını ekleyecek veya sonraki mesaj bir kullanıcı mesajı değilse sistem mesajını kullanıcı mesajına dönüştürecektir. `skip` sadece sistem mesajını kaldıracaktır). Varsayılan olarak `geliştirici`. \n - yapılandırılmış çıktının kullanılmayacağını belirtmek için `supportsStructuredOutput: false` belirtin. \n - Akışın kullanılmayacağını belirtmek için `enableStreaming: false` belirtin. \n Daha fazla bilgi için [belgelerimize] (https://theia-ide.org/docs/user_ai/#openai-compatible-models-eg-via-vllm) bakın.", + "modelId": { + "title": "Model Kimliği" + }, + "supportsStructuredOutput": { + "title": "Modelin yapılandırılmış çıktıyı destekleyip desteklemediğini belirtir. Varsayılan olarak `true`." + }, + "url": { + "title": "Modelin barındırıldığı Open AI API uyumlu uç nokta" + } + }, + "models": { + "description": "Kullanılacak resmi OpenAI modelleri" + }, + "useResponseApi": { + "mdDescription": "Resmi OpenAI modelleri için Sohbet Tamamlama API'si yerine daha yeni OpenAI Yanıt API'sini kullanın. Bu ayar yalnızca resmi OpenAI modelleri için geçerlidir - özel sağlayıcılar bunu ayrı ayrı yapılandırmalıdır." + } + }, + "promptTemplates": { + "directories": { + "title": "Çalışma Alanına Özel İstem Şablonu Dizinleri" + }, + "extensions": { + "description": "Bilgi istemi konumlarında bilgi istemi şablonu olarak kabul edilen ek dosya uzantılarının listesi. '.prompttemplate' her zaman varsayılan olarak kabul edilir.", + "title": "Ek İstem Şablonu Dosya Uzantıları" + }, + "files": { + "title": "Çalışma Alanına Özel Komut İstemi Şablon Dosyaları" + } + }, + "scanoss": { + "changeSet": { + "clean": "Eşleşme Yok", + "error": "Hata: Yeniden Çalıştır", + "error-notification": "ScanOSS hatasıyla karşılaşıldı: {0}.", + "match": "Eşleşmeleri Görüntüle", + "scan": "Tarama", + "scanning": "Tarama..." + }, + "mode": { + "automatic": { + "description": "Sohbet görünümlerinde kod parçacıklarının otomatik taranmasını etkinleştirin." + }, + "description": "Sohbet görünümlerindeki kod parçacıklarını analiz etmek için SCANOSS özelliğini yapılandırın. Bu, SCANOSS'a önerilen kod parçacıklarının bir karmasını gönderecektir\nYazılım Şeffaflık Vakfı] (https://www.softwaretransparency.org/osskb) tarafından analiz için barındırılan hizmet.", + "manual": { + "description": "Kullanıcı, sohbet görünümündeki TARAMA öğesine tıklayarak taramayı manuel olarak tetikleyebilir." + }, + "off": { + "description": "Özellik tamamen kapatılır." + } + }, + "snippet": { + "dialog-header": "ScanOSS Sonuçları", + "errored": "SCANOSS - Hata - {0}", + "file-name-heading": "Eşleşme şurada bulundu {0}", + "in-progress": "SCANOSS - Tarama gerçekleştiriliyor...", + "match-count": "Bulundu {0} eşleşme(ler)", + "matched": "SCANOSS - {0} eşleşmesi bulundu", + "no-match": "SCANOSS - Eşleşme yok", + "summary": "Özet" + } + }, + "session-settings-dialog": { + "title": "Oturum Ayarlarını Ayarlama", + "tooltip": "Oturum Ayarlarını Ayarlama" + }, + "terminal": { + "agent": { + "description": "Bu aracı, rastgele terminal komutları yazmak ve yürütmek için yardım sağlar. Kullanıcının isteğine bağlı olarak, komutlar önerir ve kullanıcının bunları doğrudan terminale yapıştırmasına ve çalıştırmasına izin verir. Bağlama duyarlı yardım sağlamak için geçerli dizine, ortama ve terminal oturumunun son terminal çıktısına erişir", + "vars": { + "cwd": { + "description": "Geçerli çalışma dizini." + }, + "recentTerminalContents": { + "description": "Terminalde görünen son 0 ila 50 satır." + }, + "shell": { + "description": "Kullanılan kabuk, örneğin /usr/bin/zsh." + }, + "userRequest": { + "description": "Kullanıcının sorusu veya isteği." + } + } + }, + "askAi": "Yapay zekaya sorun", + "askTerminalCommand": "Bir terminal komutunu sor...", + "hitEnterConfirm": "Onaylamak için enter tuşuna basın", + "howCanIHelp": "Size nasıl yardımcı olabilirim?", + "loading": "Yükleniyor", + "tryAgain": "Tekrar dene.", + "useArrowsAlternatives": " veya alternatifleri göstermek için ⇅ kullanın..." + }, + "tokenUsage": { + "cachedInputTokens": "Önbelleğe Yazılan Girdi Belirteçleri", + "cachedInputTokensTooltip": "'Girdi Belirteçleri'ne ek olarak izlenir. Genellikle önbelleğe alınmayan belirteçlerden daha pahalıdır.", + "failedToGetTokenUsageData": "Belirteç kullanım verileri getirilemedi: {0}", + "inputTokens": "Girdi belirteçleri", + "label": "Jeton Kullanımı", + "lastUsed": "Son Kullanılan", + "model": "Model", + "noData": "Henüz token kullanım verisi mevcut değil.", + "note": "Token kullanımı uygulamanın başlangıcından itibaren izlenir ve kalıcı değildir.", + "outputTokens": "Çıktı Belirteçleri", + "readCachedInputTokens": "Önbellekten Okunan Giriş Belirteçleri", + "readCachedInputTokensTooltip": "Ek olarak 'Input Token'a kadar izlenir. Genellikle önbelleğe alınmamasından çok daha ucuzdur. Genellikle hız sınırlarına dahil değildir.", + "total": "Toplam", + "totalTokens": "Toplam jeton", + "totalTokensTooltip": "'Girdi Belirteçleri' + 'Çıktı Belirteçleri'" + }, + "vercelai": { + "anthropicApiKey": { + "mdDescription": "Antropik modeller için bir API Anahtarı girin. **Lütfen dikkat:** Bu tercihi kullanarak API anahtarı Theia'yı çalıştıran makinede açık metin olarak saklanacaktır. Anahtarı güvenli bir şekilde ayarlamak için `ANTHROPIC_API_KEY` ortam değişkenini kullanın." + }, + "customEndpoints": { + "apiKey": { + "title": "Ya verilen url`de sunulan API`ye erişmek için anahtar ya da global API anahtarını kullanmak için `true`" + }, + "enableStreaming": { + "title": "Akış API'sinin kullanılıp kullanılmayacağını belirtir. Varsayılan olarak `true`." + }, + "id": { + "title": "Özel modeli tanımlamak için kullanıcı arayüzünde kullanılan benzersiz bir tanımlayıcı" + }, + "mdDescription": "Vercel AI SDK ile uyumlu özel modelleri entegre edin. Gerekli nitelikler `model` ve `url`dür. \n İsteğe bağlı olarak şunları yapabilirsiniz \n - UI`daki özel modeli tanımlamak için benzersiz bir `id` belirtin. Hiçbiri belirtilmemişse `model`, `id` olarak kullanılacaktır. \n - verilen url'de sunulan API'ye erişmek için bir `apiKey` sağlar. Global API anahtarının kullanımını belirtmek için `true` kullanın. \n - yapılandırılmış çıktının kullanılmayacağını belirtmek için `supportsStructuredOutput: false` belirtin. \n - Akışın kullanılmayacağını belirtmek için `enableStreaming: false` belirtin. \n - modelin hangi sağlayıcıdan (openai, anthropic) olduğunu belirtmek için `provider` belirtin.", + "modelId": { + "title": "Model Kimliği" + }, + "supportsStructuredOutput": { + "title": "Modelin yapılandırılmış çıktıyı destekleyip desteklemediğini belirtir. Varsayılan olarak `true`." + }, + "url": { + "title": "Modelin barındırıldığı API uç noktası" + } + }, + "models": { + "description": "Vercel AI SDK ile kullanılacak resmi modeller", + "id": { + "title": "Model Kimliği" + }, + "model": { + "title": "Model Adı" + } + }, + "openaiApiKey": { + "mdDescription": "OpenAI modelleri için bir API Anahtarı girin. **Lütfen dikkat:** Bu tercihi kullanarak API anahtarı Theia'yı çalıştıran makinede açık metin olarak saklanacaktır. Anahtarı güvenli bir şekilde ayarlamak için `OPENAI_API_KEY` ortam değişkenini kullanın." + } + }, + "workspace": { + "coderAgent": { + "description": "Yazılım geliştiricilere yardımcı olmak için tasarlanmış, Theia IDE'ye entegre bir yapay zeka asistanı. Bu aracı, kullanıcıların çalışma alanına erişebilir, mevcut tüm dosya ve klasörlerin bir listesini alabilir ve içeriklerini alabilir. Ayrıca, kullanıcıya dosyalarda değişiklik yapılmasını önerebilir. Bu nedenle kullanıcıya kodlama görevlerinde veya dosya değişikliklerini içeren diğer görevlerde yardımcı olabilir." + }, + "considerGitignore": { + "description": "Etkinleştirilirse, global bir .gitignore dosyasında belirtilen dosyaları/klasörleri hariç tutar (beklenen konum çalışma alanı köküdür).", + "title": ".gitignore'u düşünün" + }, + "excludedPattern": { + "description": "Hariç tutulacak dosyalar/klasörler için kalıpların (glob veya regex) listesi.", + "title": "Hariç Tutulan Dosya Kalıpları" + }, + "searchMaxResults": { + "description": "Çalışma alanı arama işlevi tarafından döndürülen maksimum arama sonucu sayısı.", + "title": "Maksimum Arama Sonuçları" + }, + "workspaceAgent": { + "description": "Yazılım geliştiricilere yardımcı olmak için tasarlanmış, Theia IDE'ye entegre bir yapay zeka asistanı. Bu aracı, kullanıcıların çalışma alanına erişebilir, mevcut tüm dosya ve klasörlerin bir listesini alabilir ve içeriklerini alabilir. Dosyaları değiştiremez. Bu nedenle, mevcut proje, proje dosyaları ve çalışma alanındaki kaynak kod hakkında, projenin nasıl oluşturulacağı, kaynak kodun nereye yerleştirileceği, belirli kod veya yapılandırmaların nerede bulunacağı gibi soruları yanıtlayabilir." + } + } + }, + "ai-chat": { + "fileChangeSetTitle": "Önerilen değişiklikler" + }, + "ai-chat-ui": { + "initiate-session-task-context": "Görev Bağlamı: Oturum Başlat", + "open-current-session-summary": "Açık Güncel Oturum Özeti", + "open-settings-tooltip": "AI ayarlarını açın...", + "scroll-lock": "Kaydırmayı Kilitle", + "scroll-unlock": "Parşömen Kilidini Aç", + "session-settings": "Oturum Ayarlarını Ayarlama", + "showChats": "Sohbetleri göster...", + "summarize-current-session": "Mevcut Oturumu Özetleyin" + }, + "ai-claude-code": { + "open-config": "Açık Claude Kodu Yapılandırması", + "open-memory": "Claude Kod Belleğini Açın (CLAUDE.MD)" + }, + "ai-core": { + "agentCompletionMessage": "Ajan \"{0}\" görevini tamamlamıştır.", + "agentCompletionTitle": "Agent \"{0}\" Görev Tamamlandı", + "agentCompletionWithTask": "Temsilci \"{0}\" görevi tamamladı: {1}" + }, + "ai-editor": { + "contextMenu": "Yapay Zekaya Sor", + "sendToChat": "Yapay Zeka Sohbetine Gönder" + }, + "ai-ide": { + "addressGhReviewCommand": { + "argumentHint": "", + "description": "GitHub çekme isteğindeki adres inceleme yorumları" + }, + "fixGhTicketCommand": { + "argumentHint": "", + "description": "GitHub biletini analiz edin ve çözümü uygulayın" + }, + "open-agent-settings-tooltip": "Ajan ayarlarını açın...", + "rememberCommand": { + "argumentHint": "[konu ipucu]", + "description": "Konuşmalardan konuları çıkarın ve proje bilgilerini güncelleyin" + }, + "ticketCommand": { + "argumentHint": "", + "description": "GitHub biletini analiz edin ve uygulama planı oluşturun" + }, + "todoTool": { + "noTasks": "Görev yok" + }, + "withAppTesterCommand": { + "description": "Testleri AppTester aracısına devretme (aracı modu gerektirir)" + } + }, + "ai-mcp": { + "blockedServersLabel": "MCP Sunucuları (otomatik başlatma engellendi)" + }, + "ai-terminal": { + "cancelExecution": "Komutun yürütülmesini iptal et", + "canceling": "İptal ediliyor...", + "confirmExecution": "Shell Komutunu Onayla", + "denialReason": "Sebep", + "executionCanceled": "İptal edildi", + "executionDenied": "Reddedildi", + "executionDeniedWithReason": "Sebep gösterilerek reddedildi", + "noOutput": "Çıktı yok", + "partialOutput": "Kısmi Çıktı", + "timeout": "Zaman aşımı", + "workingDirectory": "Çalışma dizini" + }, + "callhierarchy": { + "noCallers": "Herhangi bir arayan tespit edilmedi.", + "open": "Açık Çağrı Hiyerarşisi" + }, + "chat": { + "taskContextVariable": { + "args": { + "contextId": { + "description": "Alınacak görev bağlamının veya özetlenecek bir sohbet oturumunun kimliği." + } + }, + "description": "Bir görev için bağlam bilgisi sağlar, örneğin bir görevi tamamlama planı veya önceki oturumların bir özeti", + "label": "Görev Bağlamı" + } + }, + "collaboration": { + "collaborate": "İşbirliği yapın", + "collaboration": "İşbirliği", + "collaborationWorkspace": "İşbirliği Çalışma Alanı", + "connected": "Bağlı", + "connectedSession": "Bir işbirliği oturumuna bağlandı", + "copiedInvitation": "Davetiye kodu panoya kopyalandı.", + "copyAgain": "Tekrar Kopyala", + "createRoom": "Yeni İşbirliği Oturumu Oluştur", + "creatingRoom": "Oturum Oluşturma", + "end": "İşbirliği Oturumunu Sonlandırın", + "endDetail": "Oturumu sonlandırın, içerik paylaşımını durdurun ve başkalarının erişimini iptal edin.", + "enterCode": "İşbirliği oturum kodunu girin", + "failedCreate": "Oda oluşturulamadı: {0}", + "failedJoin": "Odaya katılamadı: {0}", + "fieldRequired": "{0} alanı zorunludur. Giriş iptal edildi.", + "invite": "Başkalarını Davet Edin", + "inviteDetail": "Oturuma katılmak üzere başkalarıyla paylaşmak için davet kodunu kopyalayın.", + "joinRoom": "İşbirliği Oturumuna Katılın", + "joiningRoom": "Katılma Oturumu", + "leave": "İşbirliği Oturumundan Ayrılın", + "leaveDetail": "Geçerli işbirliği oturumunun bağlantısını kesin ve çalışma alanını kapatın.", + "loginFailed": "Giriş başarısız oldu.", + "loginSuccessful": "Giriş başarılı.", + "noAuth": "Sunucu tarafından sağlanan kimlik doğrulama yöntemi yok.", + "optional": "isteğe bağlı", + "selectAuth": "Kimlik Doğrulama Yöntemini Seçin", + "selectCollaboration": "İşbirliği seçeneğini belirleyin", + "serverUrl": "Sunucu URL'si", + "serverUrlDescription": "Canlı işbirliği oturumları için Open Collaboration Tools Server örneğinin URL'si", + "sharedSession": "Bir işbirliği oturumu paylaştı", + "startSession": "İşbirliği oturumunu başlatın veya oturuma katılın", + "userWantsToJoin": "Kullanıcı '{0}' işbirliği odasına katılmak istiyor", + "whatToDo": "Diğer işbirlikçilerle neler yapmak istersiniz?" + }, + "core": { + "about": { + "compatibility": "{0} Uyumluluk", + "defaultApi": "Varsayılan {0} API", + "listOfExtensions": "Uzantıların listesi" + }, + "common": { + "closeAll": "Tüm Sekmeleri Kapat", + "closeAllTabMain": "Ana Alandaki Tüm Sekmeleri Kapat", + "closeOtherTabMain": "Ana Alandaki Diğer Sekmeleri Kapat", + "closeOthers": "Diğer Sekmeleri Kapat", + "closeRight": "Sekmeleri Sağa Kapat", + "closeTab": "Sekmeyi Kapat", + "closeTabMain": "Ana Alandaki Sekmeyi Kapat", + "collapseAllTabs": "Tüm Yan Panelleri Daralt", + "collapseBottomPanel": "Alt Paneli Değiştir", + "collapseLeftPanel": "Sol Paneli Değiştir", + "collapseRightPanel": "Sağ Paneli Değiştir", + "collapseTab": "Yan Paneli Daralt", + "showNextTabGroup": "Sonraki Sekme Grubuna Geç", + "showNextTabInGroup": "Gruptaki Sonraki Sekmeye Geç", + "showPreviousTabGroup": "Önceki Sekme Grubuna Geç", + "showPreviousTabInGroup": "Grupta Önceki Sekmeye Geç", + "toggleMaximized": "Maksimize Edilmiş Değiştir" + }, + "copyInfo": "Yolunu kopyalamak için önce bir dosya açın", + "copyWarn": "Lütfen tarayıcının kopyala komutunu veya kısayolunu kullanın.", + "cutWarn": "Lütfen tarayıcının kes komutunu veya kısayolunu kullanın.", + "enhancedPreview": { + "classic": "Temel bilgileri içeren sekmenin basit bir önizlemesini görüntüleyin.", + "enhanced": "Sekmenin ek bilgiler içeren gelişmiş bir önizlemesini görüntüleyin.", + "visual": "Sekmenin görsel bir önizlemesini görüntüleyin." + }, + "file": { + "browse": "Gözat" + }, + "highlightModifiedTabs": "Değiştirilmiş (kirli) düzenleyici sekmelerinde bir üst kenarlık çizilip çizilmeyeceğini kontrol eder.", + "keybinding": { + "duplicateModifierError": "Tuş bağlama ayrıştırılamıyor {0} Yinelenen değiştiriciler", + "metaError": "Tuş bağlama ayrıştırılamıyor {0} meta yalnızca OSX içindir", + "unrecognizedKeyError": "Tanınmayan anahtar {0} içinde {1}" + }, + "keybindingStatus": "{0} basıldı, daha fazla tuş beklendi", + "keyboard": { + "choose": "Klavye Düzenini Seçin", + "chooseLayout": "Bir klavye düzeni seçin", + "current": "(güncel: {0})", + "currentLayout": " - mevcut düzen", + "mac": "Mac Klavyeleri", + "pc": "PC Klavyeleri", + "tryDetect": "Tarayıcı bilgilerinden ve basılan tuşlardan klavye düzenini tespit etmeye çalışın." + }, + "navigator": { + "clipboardWarn": "Panoya erişim reddedildi. Tarayıcınızın izinlerini kontrol edin.", + "clipboardWarnFirefox": "Pano API'si mevcut değildir. '{1}' sayfasındaki '{0}' tercihi ile etkinleştirilebilir. Ardından Theia'yı yeniden yükleyin. FireFox'un sistem panosuna tam erişim sağlamasına izin vereceğini unutmayın." + }, + "offline": "Çevrimdışı", + "pasteWarn": "Lütfen tarayıcının yapıştırma komutunu veya kısayolunu kullanın.", + "quitMessage": "Kaydedilmemiş hiçbir değişiklik kaydedilmeyecektir.", + "resetWorkbenchLayout": "Çalışma Tezgahı Düzenini Sıfırla", + "searchbox": { + "close": "Kapat (Kaçış)", + "next": "Sonraki (Aşağı)", + "previous": "Önceki (Yukarı)", + "showAll": "Tüm öğeleri göster", + "showOnlyMatching": "Yalnızca eşleşen öğeleri göster" + }, + "secondaryWindow": { + "alwaysOnTop": "Etkinleştirildiğinde, ikincil pencere farklı uygulamalarınkiler de dahil olmak üzere diğer tüm pencerelerin üzerinde kalır.", + "description": "Çıkarılan ikincil pencerenin ilk konumunu ve boyutunu ayarlar.", + "fullSize": "Çıkarılan widget'ın konumu ve boyutu, çalışan Theia uygulamasıyla aynı olacaktır.", + "halfWidth": "Çıkarılan widget'ın konumu ve boyutu, çalışan Theia uygulamasının genişliğinin yarısı kadar olacaktır.", + "originalSize": "Çıkarılan widget'ın konumu ve boyutu orijinal widget ile aynı olacaktır." + }, + "severity": { + "log": "Günlük" + }, + "silentNotifications": "Bildirim açılır pencerelerinin bastırılıp bastırılmayacağını denetler.", + "tabDefaultSize": "Sekmeler için varsayılan boyutu belirtir.", + "tabMaximize": "Çift tıklamada sekmelerin büyütülüp büyütülmeyeceğini kontrol eder.", + "tabMinimumSize": "Sekmeler için minimum boyutu belirtir.", + "tabShrinkToFit": "Sekmeleri mevcut alana sığacak şekilde küçültün.", + "window": { + "tabCloseIconPlacement": { + "description": "Sekme başlıklarındaki kapatma simgelerini sekmenin başına veya sonuna yerleştirin. Varsayılan değer tüm platformlarda sondur.", + "end": "Kapat simgesini etiketin sonuna yerleştirin. Soldan sağa dillerde bu, sekmenin sağ tarafıdır.", + "start": "Kapat simgesini etiketin başlangıcına yerleştirin. Soldan sağa dillerde bu, sekmenin sol tarafıdır." + } + }, + "window.menuBarVisibility": "Menü, kenar çubuğunda kompakt bir düğme olarak görüntülenir. Bu değer, {0}olduğunda yok {1}sayılır." + }, + "debug": { + "TheiaIDE": "Theia IDE", + "addConfigurationPlaceholder": "Yapılandırma eklemek için çalışma alanı kökünü seçin", + "breakpoint": "kesme noktası", + "cannotRunToThisLocation": "Geçerli iş parçacığı belirtilen konuma çalıştırılamadı.", + "compound-cycle": "Başlat yapılandırması '{0}' kendisiyle birlikte bir döngü içerir", + "conditionalBreakpoint": "Koşullu Kesme Noktası", + "conditionalBreakpointsNotSupported": "Koşullu kesme noktaları bu hata ayıklama türü tarafından desteklenmez", + "confirmRunToShiftedPosition_msg": "Hedef konum Ln {0}, Col {1} konumuna kaydırılacaktır. Yine de çalıştıralım mı?", + "confirmRunToShiftedPosition_title": "Geçerli iş parçacığı tam olarak belirtilen konuma çalıştırılamıyor", + "consoleFilter": "Filtre (ör. metin, !hariç tut)", + "consoleFilterAriaLabel": "Hata ayıklama konsolu çıktısını filtrele", + "consoleSessionSelectorTooltip": "Hata ayıklama oturumları arasında geçiş yapın. Her hata ayıklama oturumunun kendi konsol çıktısı vardır.", + "consoleSeverityTooltip": "Konsol çıktısını önem düzeyine göre filtreleyin. Yalnızca seçilen önem düzeyine sahip mesajlar gösterilecektir.", + "continueAll": "Tümü Devam Ediyor", + "copyExpressionValue": "İfade Değerini Kopyala", + "couldNotRunTask": "'{0}' görevi çalıştırılamadı.", + "dataBreakpoint": "veri kesme noktası", + "debugConfiguration": "Hata Ayıklama Yapılandırması", + "debugSessionInitializationFailed": "Hata ayıklama oturumu başlatma başarısız oldu. Ayrıntılar için konsola bakın.", + "debugSessionTypeNotSupported": "Hata ayıklama oturum türü \"{0}\" desteklenmez.", + "debugToolbarMenu": "Hata Ayıklama Araç Çubuğu Menüsü", + "debugVariableInput": "{0} Değerini Ayarla", + "disableSelectedBreakpoints": "Seçili Kesme Noktalarını Devre Dışı Bırak", + "disabledBreakpoint": "Engelli {0}", + "enableSelectedBreakpoints": "Seçili Kesme Noktalarını Etkinleştir", + "entry": "Giriş", + "errorStartingDebugSession": "Hata ayıklama oturumunu başlatırken bir hata oluştu, daha fazla ayrıntı için günlükleri kontrol edin.", + "exception": "istisna", + "functionBreakpoint": "fonksiyon kesme noktası", + "goto": "Goto", + "htiConditionalBreakpointsNotSupported": "Bu hata ayıklama türü tarafından desteklenmeyen koşullu kesme noktalarını vurun", + "instruction-breakpoint": "Talimat Kesme Noktası", + "instructionBreakpoint": "talimat kesme noktası", + "logpointsNotSupported": "Bu hata ayıklama türü tarafından desteklenmeyen günlük noktaları", + "missingConfiguration": "Dinamik yapılandırma '{0}:{1}' eksik veya uygulanabilir değil", + "pause": "duraklama", + "pauseAll": "Tümünü Duraklat", + "reveal": "Açığa Çıkar", + "step": "adım", + "taskTerminatedBySignal": "Görev '{0}' {1} sinyali ile sonlandırıldı.", + "taskTerminatedForUnknownReason": "Görev '{0}' bilinmeyen bir nedenle sonlandırıldı.", + "taskTerminatedWithExitCode": "Görev '{0}' çıkış kodu {1} ile sonlandırıldı.", + "threads": "İplikler", + "toggleTracing": "Hata ayıklama bağdaştırıcılarıyla izleme iletişimini etkinleştirme/devre dışı bırakma", + "unknownSession": "Bilinmeyen Oturum", + "unverifiedBreakpoint": "Doğrulanmamış {0}" + }, + "editor": { + "diffEditor.wordWrap2": "Satırlar `#editor.wordWrap#` ayarına göre sarılacaktır.", + "dirtyEncoding": "Dosya kirli. Lütfen başka bir kodlama ile yeniden açmadan önce kaydedin.", + "editor.bracketPairColorization.enabled": "Ayraç çifti renklendirmesinin etkin olup olmadığını kontrol eder. Ayraç vurgu renklerini geçersiz kılmak için `#workbench.colorCustomizations#` kullanın.", + "editor.codeActions.triggerOnFocusChange": "##files.autoSave#` öğesi `afterDelay` olarak ayarlandığında `#editor.codeActionsOnSave#` öğesinin tetiklenmesini etkinleştirin. Kod Eylemlerinin pencere ve odak değişikliklerinde tetiklenmesi için `her zaman` olarak ayarlanması gerekir.", + "editor.detectIndentation": "Dosya içeriğine bağlı olarak bir dosya açıldığında `#editor.tabSize#` ve `#editor.insertSpaces#` öğelerinin otomatik olarak algılanıp algılanmayacağını kontrol eder.", + "editor.experimental.preferTreeSitter": "Belirli diller için ağaç oturtucu ayrıştırmanın etkinleştirilip etkinleştirilmeyeceğini kontrol eder. Bu, belirtilen diller için `editor.experimental.treeSitterTelemetry` ayarından öncelikli olacaktır.", + "editor.inlayHints.enabled1": "Kakma ipuçları varsayılan olarak gösterilir ve Ctrl+Alt tuşları basılı tutulduğunda gizlenir", + "editor.inlayHints.enabled2": "Kakma ipuçları varsayılan olarak gizlidir ve Ctrl+Alt tuşları basılı tutulduğunda gösterilir", + "editor.inlayHints.fontFamily": "Düzenleyicideki yerleşik ipuçlarının yazı tipi ailesini kontrol eder. Boş olarak ayarlandığında, `#editor.fontFamily#` kullanılır.", + "editor.inlayHints.fontSize": "Düzenleyicideki yerleşik ipuçlarının yazı tipi boyutunu kontrol eder. Yapılandırılan değer `5`ten küçük veya düzenleyici yazı tipi boyutundan büyük olduğunda varsayılan olarak `#editor.fontSize#` kullanılır.", + "editor.inlineSuggest.edits.experimental.enabled": "Satır içi önerilerde deneysel düzenlemelerin etkinleştirilip etkinleştirilmeyeceğini kontrol eder.", + "editor.inlineSuggest.edits.experimental.onlyShowWhenCloseToCursor": "Satır içi önerilerin yalnızca imleç öneriye yakın olduğunda gösterilip gösterilmeyeceğini kontrol eder.", + "editor.inlineSuggest.edits.experimental.useInterleavedLinesDiff": "Satır içi önerilerde deneysel serpiştirilmiş satır farkının etkinleştirilip etkinleştirilmeyeceğini kontrol eder.", + "editor.inlineSuggest.edits.experimental.useMixedLinesDiff": "Satır içi önerilerde deneysel düzenlemelerin etkinleştirilip etkinleştirilmeyeceğini kontrol eder.", + "editor.insertSpaces": "Tab` tuşuna basıldığında boşluk ekler. Bu ayar, `#editor.detectIndentation#` açık olduğunda dosya içeriğine göre geçersiz kılınır.", + "editor.quickSuggestions": "Yazarken önerilerin otomatik olarak gösterilip gösterilmeyeceğini kontrol eder. Bu, yorumlar, dizeler ve diğer kodların yazılması için kontrol edilebilir. Hızlı öneri, hayalet metin olarak veya öneri widget'ı ile gösterilecek şekilde yapılandırılabilir. Ayrıca önerilerin özel karakterler tarafından tetiklenip tetiklenmeyeceğini kontrol eden '#editor.suggestOnTriggerCharacters#'ayarına da dikkat edin.", + "editor.suggestFontSize": "Suggest widget'ı için yazı tipi boyutu. 0` olarak ayarlandığında, `#editor.fontSize#` değeri kullanılır.", + "editor.suggestLineHeight": "Suggest widget'ı için satır yüksekliği. 0` olarak ayarlandığında, `#editor.lineHeight#` değeri kullanılır. Minimum değer 8`dir.", + "editor.tabSize": "Bir sekmenin eşit olduğu boşluk sayısı. Bu ayar, `#editor.detectIndentation#` açık olduğunda dosya içeriğine göre geçersiz kılınır.", + "formatOnSaveTimeout": "Dosya kaydedildiğinde çalıştırılan biçimlendirmenin iptal edileceği milisaniye cinsinden zaman aşımı.", + "persistClosedEditors": "Pencere yeniden yüklenirken çalışma alanı için kapalı düzenleyici geçmişinin devam ettirilip ettirilmeyeceğini kontrol eder.", + "showAllEditors": "Tüm Açık Editörleri Göster", + "splitHorizontal": "Bölme Düzenleyici Yatay", + "splitVertical": "Bölünmüş Editör Dikey", + "toggleStickyScroll": "Yapışkan Kaydırmayı Değiştir" + }, + "external-terminal": { + "cwd": "Yeni harici terminal için geçerli çalışma dizinini seçin" + }, + "file-search": { + "toggleIgnoredFiles": " (Yok sayılan dosyaları göstermek/gizlemek için {0} adresine basın)" + }, + "fileDialog": { + "showHidden": "Gizli dosyaları göster" + }, + "fileSystem": { + "fileResource": { + "overWriteBody": "Dosya sisteminde '{0}' adresinde yapılan değişikliklerin üzerine yazmak istiyor musunuz?" + } + }, + "filesystem": { + "copiedToClipboard": "İndirme bağlantısını panoya kopyaladım.", + "copyDownloadLink": "İndirme Bağlantısını Kopyala", + "dialog": { + "initialLocation": "İlk Konuma Git", + "multipleItemMessage": "Yalnızca bir öğe seçebilirsiniz", + "navigateBack": "Geri Git", + "navigateForward": "İleriye Yönelin", + "navigateUp": "Bir Dizinde Gezinme" + }, + "fileResource": { + "binaryFileQuery": "Açmak biraz zaman alabilir ve IDE'nin yanıt vermemesine neden olabilir. Yine de '{0}' adresini açmak istiyor musunuz?", + "binaryTitle": "Dosya ya ikilidir ya da desteklenmeyen bir metin kodlaması kullanmaktadır.", + "largeFileTitle": "Dosya çok büyük ({0}).", + "overwriteTitle": "Dosya sisteminde '{0}' dosyası değiştirildi." + }, + "filesExclude": "Dosya ve klasörleri dışlamak için glob kalıplarını yapılandırın. Örneğin, dosya Gezgini bu ayara göre hangi dosya ve klasörlerin gösterileceğine veya gizleneceğine karar verir.", + "format": "Format:", + "maxConcurrentUploads": "Birden fazla dosya yüklerken yüklenecek maksimum eşzamanlı dosya sayısı. 0, tüm dosyaların eşzamanlı olarak yükleneceği anlamına gelir.", + "maxFileSizeMB": "Açılabilecek maksimum dosya boyutunu MB cinsinden kontrol eder.", + "prepareDownload": "İndirme hazırlanıyor...", + "prepareDownloadLink": "İndirme bağlantısı hazırlanıyor...", + "processedOutOf": "İşlenmiş {0} dışında {1}", + "replaceTitle": "Dosya Değiştir", + "uploadFailed": "Dosya yüklenirken bir hata oluştu. {0}", + "uploadFiles": "Dosya Yükle...", + "uploadedOutOf": "{0} adresinden yüklendi {1}" + }, + "getting-started": { + "ai": { + "header": "Theia IDE'de AI Desteği kullanılabilir (Beta Sürümü)!", + "openAIChatView": "Şimdi AI Sohbet Görünümünü açarak nasıl başlayacağınızı öğrenin!" + }, + "apiComparator": "{0} API Uyumluluğu", + "newExtension": "Yeni Bir Uzantı İnşa Etmek", + "newPlugin": "Yeni Bir Eklenti Oluşturma", + "startup-editor": { + "welcomePage": "{0} ve uzantılarını kullanmaya başlamanıza yardımcı olacak içeriğe sahip Hoş Geldiniz sayfasını açın." + }, + "telemetry": "Veri Kullanımı ve Telemetri" + }, + "git": { + "aFewSecondsAgo": "birkaç saniye önce", + "addSignedOff": "Signed-off-by ekleyin", + "added": "Eklendi", + "amendReuseMessage": "Son taahhüt mesajını yeniden kullanmak için 'Enter' tuşuna veya iptal etmek için 'Escape' tuşuna basın.", + "amendRewrite": "Önceki commit mesajını yeniden yazın. Onaylamak için 'Enter' tuşuna veya iptal etmek için 'Escape' tuşuna basın.", + "checkoutCreateLocalBranchWithName": "Adı: {0} olan yeni bir yerel şube oluşturun. Onaylamak için 'Enter' tuşuna veya iptal etmek için 'Escape' tuşuna basın.", + "checkoutProvideBranchName": "Lütfen bir şube adı belirtiniz. ", + "checkoutSelectRef": "Ödeme yapmak veya yeni bir yerel şube oluşturmak için bir ref seçin:", + "cloneQuickInputLabel": "Lütfen bir Git deposu konumu girin. Onaylamak için 'Enter' tuşuna veya iptal etmek için 'Escape' tuşuna basın.", + "cloneRepository": "Git deposunu klonlayın: {0}. Onaylamak için 'Enter' tuşuna veya iptal etmek için 'Escape' tuşuna basın.", + "compareWith": "İle Karşılaştırın...", + "compareWithBranchOrTag": "O anda etkin olan {0} dalı ile karşılaştırmak için bir dal veya etiket seçin:", + "conflicted": "Çelişkili", + "copied": "Kopyalandı", + "diff": "Diff", + "dirtyDiffLinesLimit": "Düzenleyicinin satır sayısı bu sınırı aşarsa, kirli fark süslemelerini gösterme.", + "dropStashMessage": "Zula başarıyla kaldırıldı.", + "editorDecorationsEnabled": "Düzenleyicide git süslemelerini göster.", + "fetchPickRemote": "Getirmek için bir uzaktan kumanda seçin:", + "gitDecorationsColors": "Navigatörde renk dekorasyonunu kullanın.", + "mergeEditor": { + "currentSideTitle": "Güncel", + "incomingSideTitle": "Gelen" + }, + "mergeQuickPickPlaceholder": "Şu anda etkin olan {0} dalıyla birleştirmek için bir dal seçin:", + "missingUserInfo": "git'te 'user.name' ve 'user.email' dosyalarınızı yapılandırdığınızdan emin olun.", + "noHistoryForError": "için mevcut bir geçmiş bulunmamaktadır. {0}", + "noPreviousCommit": "Değişiklik yapmak için önceden taahhüt yok", + "noRepositoriesSelected": "Hiçbir depo seçilmemiştir.", + "prepositionIn": "içinde", + "renamed": "Yeniden adlandırıldı", + "repositoryNotInitialized": "{0} deposu henüz başlatılmadı.", + "stashChanges": "Zula değişiklikleri. Onaylamak için 'Enter' tuşuna veya iptal etmek için 'Escape' tuşuna basın.", + "stashChangesWithMessage": "Zula mesajla değişir: {0}. Onaylamak için 'Enter' tuşuna veya iptal etmek için 'Escape' tuşuna basın.", + "tabTitleIndex": "{0} (Dizin)", + "tabTitleWorkingTree": "{0} (Çalışma ağacı)", + "toggleBlameAnnotations": "Suçlama Ek Açıklamalarını Değiştir", + "unstaged": "Sahnelenmemiş" + }, + "keybinding-schema-updater": { + "deprecation": "Bunun yerine `when` cümlesini kullanın." + }, + "keymaps": { + "addKeybindingTitle": "Şunlar için Tuş Bağlama Ekle {0}", + "editKeybinding": "Tuş Bağlamasını Düzenle...", + "editKeybindingTitle": "için Tuş Bağlamasını Düzenle {0}", + "editWhenExpression": "İfade Ne Zaman Düzenlenir...", + "editWhenExpressionTitle": "İfade için Düzenle {0}", + "keybinding": { + "copy": "Tuş Bağlamayı Kopyala", + "copyCommandId": "Tuş Bağlama Komut Kimliğini Kopyala", + "copyCommandTitle": "Tuş Bağlantısını Kopyala Komut Başlığı", + "edit": "Tuş Bağlamasını Düzenle...", + "editWhenExpression": "İfade Olduğunda Tuş Bağlantısını Düzenle..." + }, + "keybindingCollidesValidation": "tuş bağlama şu anda çakışıyor", + "requiredKeybindingValidation": "tuş bağlama değeri gereklidir", + "resetKeybindingConfirmation": "Bu tuş bağlamayı gerçekten varsayılan değerine sıfırlamak istiyor musunuz?", + "resetKeybindingTitle": "için tuş bağlamayı sıfırla {0}", + "resetMultipleKeybindingsWarning": "Bu komut için birden fazla tuş ataması varsa, hepsi sıfırlanacaktır." + }, + "localize": { + "offlineTooltip": "Arka uca bağlanılamıyor." + }, + "markers": { + "clearAll": "Tümünü Temizle", + "noProblems": "Çalışma alanında şu ana kadar herhangi bir sorun tespit edilmedi.", + "tabbarDecorationsEnabled": "Sekme çubuklarında sorun dekoratörlerini (tanılama işaretleyicileri) gösterin." + }, + "memory-inspector": { + "addressTooltip": "Görüntülenecek bellek konumu, bir adres veya bir adrese göre değerlendirilen ifade", + "ascii": "ASCII", + "binary": "İkili", + "byteSize": "Bayt Boyutu", + "bytesPerGroup": "Grup Başına Bayt", + "closeSettings": "Ayarları Kapat", + "columns": "Sütunlar", + "command": { + "createNewMemory": "Yeni Bellek Denetçisi Oluşturun", + "createNewRegisterView": "Yeni Kayıt Görünümü Oluştur", + "followPointer": "Pointer'ı Takip Edin", + "followPointerMemory": "Bellek Denetçisinde İşaretçiyi Takip Etme", + "resetValue": "Sıfırlama Değeri", + "showRegister": "Bellek Denetçisinde Kaydı Göster", + "viewVariable": "Değişkeni Bellek Denetçisinde Göster" + }, + "data": "Veri", + "decimal": "Ondalık", + "diff": { + "label": "Diff: {0}" + }, + "diff-widget": { + "offset-label": "{0} Ofset", + "offset-title": "Belleğin kaydırılacağı baytlar {0}" + }, + "editable": { + "apply": "Değişiklikleri Uygula", + "clear": "Açık Değişiklikler" + }, + "endianness": "Endianness", + "extraColumn": "Ekstra Sütun", + "groupsPerRow": "Satır Başına Gruplar", + "hexadecimal": "Onaltılık", + "length": "Uzunluk", + "lengthTooltip": "Getirilecek bayt sayısı, ondalık veya onaltılık olarak", + "memory": { + "addressField": { + "memoryReadError": "Konum alanına bir adres veya ifade girin." + }, + "freeze": "Bellek Görünümünü Dondur", + "hideSettings": "Ayarlar Panelini Gizle", + "readError": { + "bounds": "Bellek sınırları aşıldı, sonuç kesilecektir.", + "noContents": "Şu anda kullanılabilir bellek içeriği yok." + }, + "readLength": { + "memoryReadError": "Uzunluk alanına bir uzunluk (ondalık veya onaltılık sayı) girin." + }, + "showSettings": "Ayarlar Panelini Göster", + "unfreeze": "Bellek Görünümünü Çöz", + "userError": "Bellek alınırken bir hata oluştu." + }, + "memoryCategory": "Bellek Denetçisi", + "memoryInspector": "Bellek Denetçisi", + "memoryTitle": "Hafıza", + "octal": "Sekizli", + "offset": "Ofset", + "offsetTooltip": "Gezinirken geçerli bellek konumuna eklenecek ofset", + "provider": { + "localsError": "Yerel değişkenler okunamıyor. Etkin hata ayıklama oturumu yok.", + "readError": "Bellek okunamıyor. Etkin hata ayıklama oturumu yok.", + "writeError": "Bellek yazılamıyor. Etkin hata ayıklama oturumu yok." + }, + "register": "Kayıt Olun", + "register-widget": { + "filter-placeholder": "Filtre (ile başlar)" + }, + "registerReadError": "Kayıtların alınmasında bir hata oluştu.", + "registers": "Kayıtlar", + "toggleComparisonWidgetVisibility": "Karşılaştırma Widget Görünürlüğünü Aç / Kapat", + "utils": { + "afterBytes": "Karşılaştırmak istediğiniz her iki widget'a da bellek yüklemeniz gerekir. {0} adresinde bellek yüklü değildir.", + "bytesMessage": "Karşılaştırmak istediğiniz her iki widget'a da bellek yüklemeniz gerekir. {0} adresinde bellek yüklü değildir." + } + }, + "messages": { + "notificationTimeout": "Bilgilendirici bildirimler bu zaman aşımından sonra gizlenecektir.", + "toggleNotifications": "Bildirimleri Aç / Kapat" + }, + "mini-browser": { + "typeUrl": "Bir URL yazın" + }, + "monaco": { + "noSymbolsMatching": "Eşleşen sembol yok", + "typeToSearchForSymbols": "Sembolleri aramak için yazın" + }, + "navigator": { + "autoReveal": "Otomatik Gösterge", + "clipboardWarn": "Panoya erişim reddedildi. Tarayıcınızın izinlerini kontrol edin.", + "clipboardWarnFirefox": "Pano API'si mevcut değildir. '{1}' sayfasındaki '{0}' tercihi ile etkinleştirilebilir. Ardından Theia'yı yeniden yükleyin. FireFox'un sistem panosuna tam erişim sağlamasına izin vereceğini unutmayın.", + "openWithSystemEditor": "Sistem Düzenleyicisi ile Aç", + "refresh": "Explorer'da Yenile", + "reveal": "Explorer'da Göster", + "systemEditor": "Sistem Editörü", + "toggleHiddenFiles": "Gizli Dosyaları Aç / Kapat" + }, + "output": { + "clearOutputChannel": "Çıkış Kanalını Temizle...", + "closeOutputChannel": "Çıkış Kanalını Kapat...", + "hiddenChannels": "Gizli Kanallar", + "hideOutputChannel": "Çıkış Kanalını Gizle...", + "maxChannelHistory": "Bir çıkış kanalındaki maksimum giriş sayısı.", + "outputChannels": "Çıkış Kanalları", + "showOutputChannel": "Çıkış Kanalını Göster..." + }, + "plugin": { + "blockNewTab": "Tarayıcınız yeni bir sekme açılmasını engelledi" + }, + "plugin-dev": { + "alreadyRunning": "Barındırılan örnek zaten çalışıyor.", + "debugInstance": "Hata Ayıklama Örneği", + "debugMode": "Node.js hata ayıklama için inspect veya inspect-brk kullanma", + "debugPorts": { + "debugPort": "Bu sunucunun Node.js hata ayıklaması için kullanılacak bağlantı noktası" + }, + "devHost": "Geliştirme Ev Sahibi", + "failed": "Barındırılan eklenti örneği çalıştırılamadı: {0}", + "hostedPlugin": "Barındırılan Eklenti", + "hostedPluginRunning": "Barındırılan Eklenti: Çalışıyor", + "hostedPluginStarting": "Barındırılan Eklenti: Başlıyor", + "hostedPluginStopped": "Barındırılan Eklenti: Durduruldu", + "hostedPluginWatching": "Barındırılan Eklenti: İzleme", + "instanceTerminated": "{0} sonlandırıldı", + "launchOutFiles": "Oluşturulan JavaScript dosyalarını bulmak için glob kalıpları dizisi (`${pluginPath}` eklentinin gerçek yolu ile değiştirilecektir).", + "noValidPlugin": "Belirtilen klasör geçerli bir eklenti içermiyor.", + "notRunning": "Barındırılan örnek çalışmıyor.", + "pluginFolder": "Eklenti klasörü olarak ayarlanmıştır: {0}", + "preventedNewTab": "Tarayıcınız yeni bir sekme açılmasını engelledi", + "restartInstance": "Örneği Yeniden Başlat", + "running": "Barındırılan örnek şu adreste çalışıyor:", + "selectPath": "Yol Seçin", + "startInstance": "Örneği Başlat", + "starting": "Barındırılan örnek sunucusu başlatılıyor ...", + "stopInstance": "Örneği Durdur", + "unknownTerminated": "Örnek sonlandırıldı", + "watchMode": "Geliştirme aşamasındaki eklenti üzerinde izleyiciyi çalıştırın" + }, + "plugin-ext": { + "authentication-main": { + "loginTitle": "Giriş", + "signedOut": "Oturum başarıyla kapatıldı." + }, + "plugins": "Eklentiler", + "webviewTrace": "Web görünümleri ile iletişim izlemeyi kontrol eder.", + "webviewWarnIfUnsecure": "Kullanıcıları web görünümlerinin şu anda güvenli olmayan bir şekilde dağıtıldığı konusunda uyarır." + }, + "preferences": { + "ai-features": "Yapay Zeka Özellikleri", + "hostedPlugin": "Barındırılan Eklenti", + "toolbar": "Araç Çubuğu" + }, + "preview": { + "openByDefault": "Varsayılan olarak düzenleyici yerine önizlemeyi açın." + }, + "property-view": { + "created": "Oluşturuldu", + "directory": "Rehber", + "lastModified": "Son değişiklik", + "location": "Konum", + "noProperties": "Mevcut mülk yok.", + "properties": "Özellikler", + "symbolicLink": "Sembolik bağlantı" + }, + "remote": { + "dev-container": { + "connect": "Konteynerde Yeniden Aç", + "noDevcontainerFiles": "Çalışma alanında devcontainer.json dosyası bulunamadı. Lütfen devcontainer.json dosyası içeren bir .devcontainer dizininiz olduğundan emin olun.", + "selectDevcontainer": "Bir devcontainer.json dosyası seçin" + }, + "ssh": { + "connect": "Geçerli Pencereyi Ana Bilgisayara Bağlayın...", + "connectToConfigHost": "Geçerli Pencereyi Yapılandırma Dosyasındaki Ana Bilgisayara Bağlayın...", + "enterHost": "SSH ana bilgisayar adını girin", + "enterUser": "SSH kullanıcı adını girin", + "failure": "Uzağa SSH bağlantısı açılamadı.", + "hostPlaceHolder": "Örneğin hello@example.com", + "needsHost": "Lütfen bir ana bilgisayar adı girin.", + "needsUser": "Lütfen bir kullanıcı adı girin.", + "userPlaceHolder": "Örneğin merhaba" + }, + "sshNoConfigPath": "SSH yapılandırma yolu bulunamadı.", + "wsl": { + "connectToWsl": "WSL'ye bağlanın", + "connectToWslUsingDistro": "Distro kullanarak WSL'ye bağlanın...", + "noWslDistroFound": "WSL dağıtımı bulunamadı. Lütfen önce bir WSL dağıtımı yükleyin.", + "reopenInWsl": "WSL'de Klasörü Yeniden Açın", + "selectWSLDistro": "Bir WSL dağıtımı seçin" + } + }, + "scm": { + "amend": "Değiştirmek", + "amendHeadCommit": "HEAD Commit", + "amendLastCommit": "Son taahhüdü değiştirin", + "changeRepository": "Depoyu Değiştir...", + "config.untrackedChanges": "İzlenmeyen değişikliklerin nasıl davranacağını kontrol eder.", + "config.untrackedChanges.hidden": "gizli", + "config.untrackedChanges.mixed": "karışık", + "config.untrackedChanges.separate": "ayrı", + "dirtyDiff": { + "close": "Kapat Değişim Peek Görünümü" + }, + "history": "Tarih", + "mergeEditor": { + "resetConfirmationTitle": "Bu düzenleyicide birleştirme sonucunu gerçekten sıfırlamak istiyor musunuz?" + }, + "noRepositoryFound": "Depo bulunamadı", + "unamend": "Unamend", + "unamendCommit": "Değişikliği kaldır" + }, + "search-in-workspace": { + "includeIgnoredFiles": "Yoksayılan Dosyaları Dahil Etme", + "noFolderSpecified": "Bir klasör açmadınız veya belirtmediniz. Şu anda yalnızca açık dosyalar aranmaktadır.", + "resultSubset": "Bu, tüm sonuçların yalnızca bir alt kümesidir. Sonuç listesini daraltmak için daha spesifik bir arama terimi kullanın.", + "searchOnEditorModification": "Değiştirildiğinde etkin düzenleyicide arama yapın." + }, + "secondary-window": { + "extract-widget": "Görünümü İkincil Pencereye Taşı" + }, + "shell-area": { + "secondary": "İkincil Pencere" + }, + "task": { + "attachTask": "Görev Ekle...", + "circularReferenceDetected": "Dairesel referans tespit edildi: {0} --> {1}", + "clearHistory": "Geçmişi Temizle", + "errorKillingTask": "'{0}' görevi öldürülürken hata oluştu: {1}", + "errorLaunchingTask": "'{0}' görevi başlatılırken hata oluştu: {1}", + "invalidTaskConfigs": "Geçersiz görev yapılandırmaları bulundu. tasks.json dosyasını açın ve Sorunlar görünümünde ayrıntıları bulun.", + "neverScanTaskOutput": "Görev çıktısını asla taramayın", + "noTaskToRun": "Çalıştırılacak görev bulunamadı. Görevleri Yapılandır...", + "noTasksFound": "Görev bulunamadı", + "notEnoughDataInDependsOn": "\"dependsOn \"da verilen bilgiler doğru görevi eşleştirmek için yeterli değildir!", + "schema": { + "commandOptions": { + "cwd": "Yürütülen programın veya betiğin geçerli çalışma dizini. Atlanırsa Theia'nın geçerli çalışma alanı kökü kullanılır." + }, + "presentation": { + "panel": { + "dedicated": "Terminal belirli bir göreve adanmıştır. Bu görev tekrar yürütülürse, terminal yeniden kullanılır. Ancak, farklı bir görevin çıktısı farklı bir terminalde sunulur.", + "new": "Bu görevin her yürütülüşünde yeni bir temiz terminal kullanılır.", + "shared": "Terminal paylaşılır ve diğer görevlerin çıktıları aynı terminale eklenir." + }, + "showReuseMessage": "\"Terminal görevler tarafından yeniden kullanılacak\" mesajının gösterilip gösterilmeyeceğini kontrol eder." + }, + "problemMatcherObject": { + "owner": "Theia içindeki sorunun sahibi. Taban belirtilmişse atlanabilir. Eğer atlanırsa ve base belirtilmezse varsayılan değer 'external' olur." + } + }, + "taskAlreadyRunningInTerminal": "Görev zaten terminalde çalışıyor", + "taskExitedWithCode": "Görev '{0}' {1} kodu ile çıkmıştır.", + "taskTerminalTitle": "Görev: {0}", + "taskTerminatedBySignal": "Görev '{0}' {1} sinyali ile sonlandırıldı.", + "terminalWillBeReusedByTasks": "Terminal görevler tarafından yeniden kullanılacaktır." + }, + "terminal": { + "defaultProfile": "üzerinde kullanılan varsayılan profil {0}", + "enableCopy": "Seçili metni kopyalamak için ctrl-c'yi (macOS'ta cmd-c) etkinleştirin", + "enablePaste": "Panodan yapıştırmak için ctrl-v'yi (macOS'ta cmd-v) etkinleştirin", + "profileArgs": "Bu profilin kullandığı kabuk argümanları.", + "profileColor": "Terminalle ilişkilendirilecek bir terminal tema rengi kimliği.", + "profileDefault": "Varsayılan Profil'i seçin...", + "profileIcon": "Terminal simgesiyle ilişkilendirilecek bir codicon kimliği.\nterminal-tmux:\"$(terminal-tmux)\"", + "profileNew": "Yeni Terminal (Profilli)...", + "profilePath": "Bu profilin kullandığı kabuğun yolu.", + "profiles": "Yeni bir terminal oluştururken sunulacak profiller. Yol özelliğini isteğe bağlı args ile manuel olarak ayarlayın.\nProfili listeden gizlemek için mevcut bir profili `null` olarak ayarlayın, örneğin: `\"{0}\": null`.", + "rendererType": "Terminalin nasıl oluşturulacağını kontrol eder.", + "rendererTypeDeprecationMessage": "Oluşturucu türü artık bir seçenek olarak desteklenmemektedir.", + "selectProfile": "Yeni terminal için bir profil seçin", + "shell.deprecated": "Bu kullanımdan kaldırılmıştır, varsayılan kabuğunuzu yapılandırmak için önerilen yeni yol 'terminal.integrated.profiles.{0}' içinde bir terminal profili oluşturmak ve profil adını 'terminal.integrated.defaultProfile.{0}' içinde varsayılan olarak ayarlamaktır.", + "shellArgsLinux": "Linux terminalindeyken kullanılacak komut satırı argümanları.", + "shellArgsOsx": "macOS terminalindeyken kullanılacak komut satırı argümanları.", + "shellArgsWindows": "Windows terminalindeyken kullanılacak komut satırı argümanları.", + "shellLinux": "Terminalin Linux üzerinde kullandığı kabuğun yolu (varsayılan: '{0}'}).", + "shellOsx": "Terminalin macOS üzerinde kullandığı kabuğun yolu (varsayılan: '{0}'}).", + "shellWindows": "Terminalin Windows üzerinde kullandığı kabuğun yolu. (varsayılan: '{0}')." + }, + "terminal-manager": { + "addTerminalToGroup": "Gruba terminal ekle", + "closeDialog": { + "message": "Terminal Yöneticisi kapatıldığında, düzeni geri yüklenemez. Terminal Yöneticisini kapatmak istediğinizden emin misiniz?", + "title": "Terminal yöneticisini kapatmak istiyor musunuz?" + }, + "closeTerminalManager": "Terminal Yöneticisini Kapat", + "createNewTerminalGroup": "Yeni Terminal Grubu Oluştur", + "createNewTerminalPage": "Yeni Terminal Sayfası Oluştur", + "deleteGroup": "Grubu Sil", + "deletePage": "Sayfayı Sil", + "deleteTerminal": "Terminali Sil", + "group": "Grup", + "label": "Terminaller", + "maximizeBottomPanel": "Alt Paneli Maksimize Et", + "minimizeBottomPanel": "Alt Paneli Küçült", + "openTerminalManager": "Terminal Yöneticisini Aç", + "page": "Sayfa", + "rename": "Yeniden adlandır", + "resetTerminalManagerLayout": "Terminal Yöneticisi Düzenini Sıfırla", + "toggleTreeView": "Ağaç Görünümünü Aç/Kapat" + }, + "test": { + "cancelAllTestRuns": "Tüm Test Çalışmalarını İptal Et", + "stackFrameAt": "at", + "testRunDefaultName": "{0} koşmak {1}", + "testRuns": "Test Çalışmaları" + }, + "toolbar": { + "addCommand": "Araç Çubuğuna Komut Ekleme", + "addCommandPlaceholder": "Araç çubuğuna eklemek için bir komut bulun", + "centerColumn": "Orta Kolon", + "failedUpdate": "'{1}' içindeki '{0}' değeri güncellenemedi.", + "filterIcons": "Filtre Simgeleri", + "iconSelectDialog": "'{0}' için bir Simge seçin", + "iconSet": "Simge Seti", + "insertGroupLeft": "Grup Ayırıcı Ekle (Sol)", + "insertGroupRight": "Grup Ayırıcı Ekle (Sağ)", + "leftColumn": "Sol Sütun", + "openJSON": "Araç Çubuğunu Özelleştir (JSON'u Aç)", + "removeCommand": "Command'ı Araç Çubuğundan Kaldır", + "restoreDefaults": "Araç Çubuğu Varsayılanlarını Geri Yükle", + "rightColumn": "Sağ Sütun", + "selectIcon": "Simge Seçin", + "toggleToolbar": "Araç Çubuğunu Değiştir", + "toolbarLocationPlaceholder": "Komutun nereye eklenmesini istersiniz?", + "useDefaultIcon": "Varsayılan Simgeyi Kullan" + }, + "typehierarchy": { + "subtypeHierarchy": "Alt Tip Hiyerarşisi", + "supertypeHierarchy": "Süper Tip Hiyerarşisi" + }, + "variableResolver": { + "listAllVariables": "Değişkenler: Tümünü Listele" + }, + "vsx-registry": { + "confirmDialogMessage": "\"{0}\" uzantısı doğrulanmamıştır ve güvenlik riski oluşturabilir.", + "confirmDialogTitle": "Kuruluma devam etmek istediğinizden emin misiniz?", + "downloadCount": "İndirme sayısı: {0}", + "errorFetching": "Uzantılar getirilirken hata oluştu.", + "errorFetchingConfigurationHint": "Bunun nedeni ağ yapılandırma sorunları olabilir.", + "failedInstallingVSIX": "VSIX'ten {0} yüklenemedi.", + "invalidVSIX": "Seçilen dosya geçerli bir \"*.vsix\" eklentisi değil.", + "license": "Ruhsat: {0}", + "onlyShowVerifiedExtensionsDescription": "Bu, {0} adresinin yalnızca doğrulanmış uzantıları göstermesini sağlar.", + "onlyShowVerifiedExtensionsTitle": "Yalnızca Doğrulanmış Uzantıları Göster", + "recommendedExtensions": "Bu depo için önerilen uzantıları yüklemek istiyor musunuz?", + "searchPlaceholder": "Uzantıları içinde ara {0}", + "showInstalled": "Yüklü Uzantıları Göster", + "showRecommendedExtensions": "Uzantı önerileri için bildirimlerin gösterilip gösterilmeyeceğini kontrol eder.", + "vsx-extensions-contribution": { + "update-version-uninstall-error": "Uzantı kaldırılırken hata oluştu: {0}.", + "update-version-version-error": "{1}'un {0} sürümü yüklenemedi." + } + }, + "webview": { + "goToReadme": "README'ye Git", + "messageWarning": " {0} uç noktasının ana bilgisayar kalıbı `{1}` olarak değiştirildi; kalıbın değiştirilmesi güvenlik açıklarına yol açabilir. Daha fazla bilgi için `{2}` adresine bakın." + }, + "workspace": { + "bothAreDirectories": "Her iki kaynak da dizinlerdir.", + "clickToManageTrust": "Güven ayarlarını yönetmek için tıklayın.", + "compareWithEachOther": "Birbirleriyle Karşılaştırın", + "confirmDeletePermanently.description": "Çöp Kutusu kullanılarak \"{0}\" silinemedi. Bunun yerine kalıcı olarak silmek mi istiyorsunuz?", + "confirmDeletePermanently.solution": "Tercihlerde Çöp Kutusu kullanımını devre dışı bırakabilirsiniz.", + "confirmDeletePermanently.title": "Dosya silinirken hata oluştu", + "confirmMessage.delete": "Aşağıdaki dosyaları gerçekten silmek istiyor musunuz?", + "confirmMessage.dirtyMultiple": "Kaydedilmemiş değişiklikler içeren {0} dosyalarını gerçekten silmek istiyor musunuz?", + "confirmMessage.dirtySingle": "Kaydedilmemiş değişikliklerle {0} adresini gerçekten silmek istiyor musunuz?", + "confirmMessage.uriMultiple": "Gerçekten tüm {0} seçili dosyaları silmek istiyor musunuz?", + "confirmMessage.uriSingle": "{0} adresini gerçekten silmek istiyor musunuz?", + "directoriesCannotBeCompared": "Dizinler karşılaştırılamaz. {0}", + "duplicate": "Yinelenen", + "failSaveAs": "Geçerli widget için \"{0}\" çalıştırılamıyor.", + "isDirectory": "{0}'' bir dizindir.", + "manageTrustPlaceholder": "Bu çalışma alanı için güven durumunu seçin", + "newFilePlaceholder": "Dosya Adı", + "newFolderPlaceholder": "Klasör adı", + "noErasure": "Not: Diskten hiçbir şey silinmeyecektir", + "notWorkspaceFile": "Geçerli bir çalışma alanı dosyası değil: {0}", + "openRecentPlaceholder": "Açmak istediğiniz çalışma alanının adını yazın", + "openRecentWorkspace": "Son Çalışma Alanını Aç...", + "preserveWindow": "Geçerli pencerede çalışma alanlarını açmayı etkinleştirir.", + "removeFolder": "Aşağıdaki klasörü çalışma alanından kaldırmak istediğinizden emin misiniz?", + "removeFolders": "Aşağıdaki klasörleri çalışma alanından kaldırmak istediğinizden emin misiniz?", + "restrictedModeDescription": "Bu çalışma alanı güvenilir olmadığı için bazı özellikler devre dışı bırakılmıştır.", + "restrictedModeNote": "*Lütfen dikkat: Çalışma alanı güven özelliği şu anda Theia'da geliştirme aşamasındadır; henüz tüm özellikler çalışma alanı güveniyle entegre edilmemiştir.*", + "schema": { + "folders": { + "description": "Çalışma alanındaki kök klasörler" + }, + "title": "Çalışma Alanı Dosyası" + }, + "trashTitle": "{0} adresini Çöp Kutusuna Taşı", + "trustEmptyWindow": "Varsayılan olarak boş çalışma alanına güvenilip güvenilmeyeceğini denetler.", + "trustEnabled": "Çalışma alanı güveninin etkin olup olmadığını denetler. Devre dışı bırakılırsa, tüm çalışma alanlarına güvenilir.", + "trustTrustedFolders": "Sorgulama yapılmadan güvenilen klasör URI'lerinin listesi.", + "untitled-cleanup": "Çok sayıda başlıksız çalışma alanı dosyası var gibi görünüyor. Lütfen {0} adresini kontrol edin ve kullanılmayan dosyaları kaldırın.", + "variables": { + "cwd": { + "description": "Görev çalıştırıcısının başlangıçtaki geçerli çalışma dizini" + }, + "file": { + "description": "Şu anda açık olan dosyanın yolu" + }, + "fileBasename": { + "description": "Şu anda açık olan dosyanın temel adı" + }, + "fileBasenameNoExtension": { + "description": "Uzantısı olmayan, şu anda açık olan dosyanın adı" + }, + "fileDirname": { + "description": "Şu anda açık olan dosyanın bulunduğu dizinin adı" + }, + "fileExtname": { + "description": "Şu anda açık olan dosyanın uzantısı" + }, + "relativeFile": { + "description": "Çalışma alanı kök dizinine göre şu anda açık olan dosyanın yolu" + }, + "relativeFileDirname": { + "description": "Açık dosyanın ${workspaceFolder} göreli dizin adı" + }, + "workspaceFolder": { + "description": "Çalışma alanı kök klasörünün yolu" + }, + "workspaceFolderBasename": { + "description": "Çalışma alanı kök klasörünün adı" + }, + "workspaceRoot": { + "description": "Çalışma alanı kök klasörünün yolu" + }, + "workspaceRootFolderName": { + "description": "Çalışma alanı kök klasörünün adı" + } + }, + "workspaceFolderAdded": "Birden fazla kökü olan bir çalışma alanı oluşturuldu. Çalışma alanı yapılandırmanızı bir dosya olarak kaydetmek istiyor musunuz?", + "workspaceFolderAddedTitle": "Çalışma Alanına eklenen klasör" + } + }, + "vsx.disabling": "Devre dışı bırakma", + "vsx.disabling.extensions": "{0} adresini devre dışı bırakma ...", + "vsx.enabling": "Etkinleştirme", + "vsx.enabling.extension": "Etkinleştirme {0}..." +} diff --git a/packages/core/i18n/nls.zh-cn.json b/packages/core/i18n/nls.zh-cn.json new file mode 100644 index 0000000..1014fb2 --- /dev/null +++ b/packages/core/i18n/nls.zh-cn.json @@ -0,0 +1,2097 @@ +{ + "ai-chat-ui.show-settings": "显示人工智能设置", + "ai-chat:summarize-session-as-task-for-coder": "将会议总结作为编码员的任务", + "ai.executePlanWithCoder": "使用编码器执行当前计划", + "ai.updateTaskContext": "更新当前任务上下文", + "aiConfiguration:open": "打开 AI 配置视图", + "aiHistory:clear": "人工智能历史:清除历史记录", + "aiHistory:open": "打开人工智能历史视图", + "aiHistory:sortChronologically": "人工智能历史:按时间顺序排列", + "aiHistory:sortReverseChronologically": "人工智能历史:按时间倒序排序", + "aiHistory:toggleCompact": "人工智能历史:切换紧凑型视图", + "aiHistory:toggleHideNewlines": "人工智能历史:停止解释换行符", + "aiHistory:toggleRaw": "人工智能历史:切换原始视图", + "aiHistory:toggleRenderNewlines": "人工智能历史:解释换行符", + "debug.breakpoint.editCondition": "编辑条件...", + "debug.breakpoint.removeSelected": "删除所选断点", + "debug.breakpoint.toggleEnabled": "启用断点", + "notebook.cell.changeToCode": "将单元格更改为代码", + "notebook.cell.changeToMarkdown": "将 Cell 改为 Mardown", + "notebook.cell.insertMarkdownCellAbove": "在上方插入 Markdown 单元格", + "notebook.cell.insertMarkdownCellBelow": "在下面插入 Markdown 单元格", + "terminal:new:profile": "从配置文件中创建新的集成终端", + "terminal:profile:default": "选择默认的终端配置文件", + "theia": { + "ai": { + "agents": { + "completionNotification": { + "mdDescription": "该代理完成任务时的通知行为。如果未设置,将使用全局默认通知设置。\n - 操作系统通知显示操作系统/系统通知\n - `message`:在状态栏/消息区显示通知\n - `blink`:闪烁或高亮用户界面\n - `off`:禁用此代理的通知", + "title": "竣工通知" + }, + "enable": { + "mdDescription": "指定应启用(true)还是禁用(false)代理。", + "title": "启用代理" + }, + "languageModelRequirements": { + "identifier": { + "mdDescription": "要使用的语言模型的标识符。" + }, + "mdDescription": "指定该代理使用的语言模型。", + "purpose": { + "mdDescription": "使用该语言模型的目的。", + "title": "目的" + }, + "title": "语言模型要求" + }, + "mdDescription": "配置代理设置,如启用或禁用特定代理、配置提示和选择 LLM。", + "selectedVariants": { + "mdDescription": "指定此代理当前选择的提示变量。", + "title": "部分变体" + }, + "title": "代理设置" + }, + "anthropic": { + "apiKey": { + "description": "输入 Anthropic 官方账户的 API 密钥。**请注意:** 使用此选项时,Anthropic API 密钥将以明文形式存储在运行 Theia 的机器上。请使用环境变量 `ANTHROPIC_API_KEY` 安全设置密钥。" + }, + "models": { + "description": "正式使用的人类学模型" + } + }, + "chat": { + "agent": { + "architect": "建筑师", + "coder": "编码员", + "universal": "环球" + }, + "applySuggestion": "申请建议", + "bypassModelRequirement": { + "description": "绕过语言模型要求检查。若您使用的是无需Theia语言模型的外部代理(例如Claude Code),请启用此选项。" + }, + "changeSetDefaultTitle": "修改建议", + "changeSetFileDiffUriLabel": "人工智能的变化:{0}", + "chatAgentsVariable": { + "description": "返回系统中可用的聊天代理列表" + }, + "chatSessionNamingAgent": { + "description": "生成聊天会话名称的代理", + "vars": { + "conversation": { + "description": "聊天对话的内容。" + }, + "listOfSessionNames": { + "description": "现有会话名称列表。" + } + } + }, + "chatSessionSummaryAgent": { + "description": "用于生成聊天会话摘要的代理。" + }, + "confirmApplySuggestion": "自创建此建议以来,文件{0} 已更改。您确定要进行更改吗?", + "confirmRevertSuggestion": "自创建此建议以来,文件{0} 已发生变化。您确定要恢复更改吗?", + "couldNotFindMatchingLM": "找不到匹配的语言模型。请检查您的设置!", + "couldNotFindReadyLMforAgent": "找不到代理{0} 的现成语言模型。请检查您的设置!", + "defaultAgent": { + "description": "可选项: ,如果用户查询中没有使用 @ 明确提及代理,则将调用该聊天代理。如果没有配置默认代理,则将使用 Theia 的默认值。" + }, + "imageContextVariable": { + "args": { + "data": { + "description": "以 base64 表示的图像数据。" + }, + "mimeType": { + "description": "图像的 mimetype。" + }, + "name": { + "description": "图像文件名(如果有)。" + }, + "wsRelativePath": { + "description": "图像文件的工作空间相关路径(如果有)。" + } + }, + "description": "提供图像的上下文信息", + "label": "图像文件" + }, + "orchestrator": { + "description": "该代理会根据所有可用聊天代理的描述分析用户请求,并(通过人工智能)选择最合适的代理回答用户请求。", + "vars": { + "availableChatAgents": { + "description": "协调器可以委托的聊天代理列表,不包括排除列表首选项中指定的代理。" + } + } + }, + "pinChatAgent": { + "description": "启用代理固定功能可自动让被提及的聊天代理在整个提示过程中保持活跃,减少重复提及的需要。" + }, + "revertSuggestion": "还原建议", + "selectImageFile": "选择图像文件", + "sessionStorage": { + "description": "配置聊天会话的存储位置。", + "globalPath": "全球路径", + "pathNotUsedForScope": "不适用于{0}存储作用域。", + "pathRequired": "路径不能为空", + "pathSettings": "路径设置", + "resetToDefault": "重置为默认设置", + "scope": { + "global": "将聊天会话存储在全局配置文件夹中。", + "workspace": "将聊天会话存储在工作区文件夹中。" + }, + "workspacePath": "工作区路径" + }, + "taskContextService": { + "summarizeProgressMessage": "总结一下:{0}", + "updatingProgressMessage": "更新:{0}" + }, + "toolConfirmation": { + "confirm": { + "description": "执行工具前要求确认" + }, + "disabled": { + "description": "禁用工具执行" + }, + "yolo": { + "description": "无需确认即可自动执行工具" + } + }, + "view": { + "label": "人工智能聊天" + } + }, + "chat-ui": { + "addContextVariable": "添加上下文变量", + "agent": "代理", + "aiDisabled": "禁用人工智能功能", + "applyAll": "全部应用", + "applyAllTitle": "应用所有待处理的更改", + "askQuestion": "提问", + "attachToContext": "将元素附加到上下文", + "cancel": "取消 (Esc)", + "chat-view-tree-widget": { + "ai": "人工智能", + "aiFeatureHeader": "🚀 可用的 AI 功能(Alpha 版)!", + "featuresDisabled": "目前,所有人工智能功能都已禁用!", + "generating": "生成", + "howToEnable": "如何启用人工智能功能", + "noRenderer": "错误:未找到渲染器", + "scrollToBottom": "跳转到最新信息", + "waitingForInput": "等待输入", + "you": "你" + }, + "chatInput": { + "clearHistory": "清除输入提示历史记录", + "cycleMode": "循环聊天模式", + "nextPrompt": "下一个提示", + "previousPrompt": "上一个提示" + }, + "chatInputAriaLabel": "在此处输入您的消息", + "chatResponses": "聊天回复", + "code-part-renderer": { + "generatedCode": "生成代码" + }, + "collapseChangeSet": "折叠更改集", + "command-part-renderer": { + "commandNotExecutable": "该命令的 ID 是 \"{0}\",但无法在聊天窗口中执行。" + }, + "copyCodeBlock": "复制代码块", + "couldNotSendRequestToSession": "无法向会话发送 \"{0}\"请求{1}", + "delegation-response-renderer": { + "prompt": { + "label": "授权提示:" + }, + "response": { + "label": "回应:" + }, + "starting": "开始代表团...", + "status": { + "canceled": "已取消", + "error": "错误", + "generating": "生成...", + "starting": "开始..." + } + }, + "deleteChangeSet": "删除更改集", + "editRequest": "编辑", + "edited": "编辑", + "editedTooltipHint": "此提示变体已编辑。您可在AI配置视图中重置它。", + "enterChatName": "输入聊天名称", + "errorChatInvocation": "调用聊天服务时发生错误。", + "expandChangeSet": "展开变更集", + "failedToDeleteSession": "删除聊天会话失败", + "failedToLoadChats": "加载聊天会话失败", + "failedToRestoreSession": "恢复聊天会话失败", + "failedToRetry": "重试失败信息", + "focusInput": "聚焦聊天输入", + "focusResponse": "焦点聊天响应", + "noChatAgentsAvailable": "没有聊天代理。", + "openDiff": "开放式差速器", + "openOriginalFile": "打开原始文件", + "performThisTask": "执行此任务。", + "persistedSession": "持续会话(点击恢复)", + "removeChat": "删除聊天", + "renameChat": "重命名聊天", + "requestNotFoundForRetry": "未找到重试请求", + "responseFrom": "来自 {0} 的回复", + "selectAgentQuickPickPlaceholder": "为新会话选择代理", + "selectChat": "选择聊天", + "selectContextVariableQuickPickPlaceholder": "选择要附加到信息中的上下文变量", + "selectTaskContextQuickPickItem": { + "currentlyOpen": "目前开放" + }, + "selectTaskContextQuickPickPlaceholder": "选择要附加的任务上下文", + "selectVariableArguments": "选择变量参数", + "send": "发送(输入)", + "sessionNotFoundForRetry": "未找到可重试的会话", + "text-part-renderer": { + "cantDisplay": "无法显示回复,请检查您的 ChatResponsePartRenderers!" + }, + "thinking-part-renderer": { + "thinking": "思考" + }, + "toolcall-part-renderer": { + "denied": "拒绝执行", + "finished": "已完成", + "rejected": "取消执行" + }, + "toolconfirmation": { + "allow-options-dropdown-tooltip": "更多允许选项", + "allow-session": "允许聊天", + "allowed": "允许执行工具", + "alwaysAllowConfirm": "我明白了,启用自动批准功能。", + "alwaysAllowTitle": "是否启用“{0}”的自动批准?", + "canceled": "工具执行已取消", + "denied": "拒绝执行工具", + "deny-forever": "始终拒绝", + "deny-options-dropdown-tooltip": "更多拒绝选项", + "deny-reason-placeholder": "输入拒绝原因...", + "deny-session": "拒绝本次聊天", + "deny-with-reason": "有理有据地否认……", + "executionDenied": "工具执行被拒绝", + "header": "确认工具执行" + }, + "unableToSummarizeCurrentSession": "无法汇总当前会话。请确认摘要代理未被禁用。", + "unknown-part-renderer": { + "contentNotRestoreable": "此内容(类型 '{0}' )无法完全恢复。它可能来自不再可用的扩展。" + }, + "unpinAgent": "解销代理", + "variantTooltip": "提示变体:{0}", + "yourMessage": "您的留言" + }, + "claude-code": { + "agentDescription": "人类的编码代理", + "askBeforeEdit": "编辑前请先询问", + "changeSetTitle": "按 Claude Code 分类的变更", + "clearCommand": { + "description": "创建新会话" + }, + "compactCommand": { + "description": "紧凑型对话,可选择重点说明" + }, + "completedCount": "{0}/{1} 已完成", + "configCommand": { + "description": "开放式克劳德代码配置" + }, + "currentDirectory": "当前目录", + "differentAgentRequestWarning": "之前的聊天请求由不同的代理处理。克劳德代码看不到其他信息。", + "directory": "目录", + "domain": "域名", + "editAutomatically": "自动编辑", + "editNumber": "编辑{0}", + "editing": "编辑", + "editsCount": "{0} 编辑", + "emptyTodoList": "不全", + "entireFile": "整个文件", + "excludingOnePattern": "(不包括 1 个图案)", + "excludingPatterns": "(不包括{0} 图案)", + "executedCommand": "已执行:{0}", + "failedToParseBashToolData": "解析 Bash 工具数据失败", + "failedToParseEditToolData": "解析编辑工具数据失败", + "failedToParseGlobToolData": "解析 Glob 工具数据失败", + "failedToParseGrepToolData": "解析 Grep 工具数据失败", + "failedToParseLSToolData": "解析 LS 工具数据失败", + "failedToParseMultiEditToolData": "解析 MultiEdit 工具数据失败", + "failedToParseReadToolData": "解析读取工具数据失败", + "failedToParseTodoListData": "解析待办事项列表数据失败", + "failedToParseWebFetchToolData": "解析 WebFetch 工具数据失败", + "failedToParseWriteToolData": "解析写入工具数据失败", + "fetching": "获取", + "fileFilter": "文件过滤器", + "filePath": "文件路径", + "fileType": "文件类型", + "findMatchingFiles": "查找当前目录中与全局模式 \"{0}\" 匹配的文件", + "findMatchingFilesWithPath": "查找在 \"{0}\"内与全局模式 \" \"匹配的文件。{1}", + "finding": "寻找", + "from": "来自", + "globPattern": "球状图案", + "grepOptions": { + "caseInsensitive": "不区分大小写", + "glob": "全球:{0}", + "headLimit": "限制:{0}", + "lineNumbers": "行数", + "linesAfter": "+{0} 后", + "linesBefore": "+{0} 之前", + "linesContext": "±{0} 背景", + "multiLine": "多线", + "type": "类型{0}" + }, + "grepOutputModes": { + "content": "内容", + "count": "计数", + "filesWithMatches": "匹配的文件" + }, + "ignoredPatterns": "被忽视的模式", + "ignoringPatterns": "忽略{0} 模式", + "initCommand": { + "description": "使用 CLAUDE.md 指南初始化项目" + }, + "itemCount": "{0} 项目", + "lineLimit": "线路限制", + "lines": "线路", + "listDirectoryContents": "列出目录内容", + "listing": "上市", + "memoryCommand": { + "description": "编辑 CLAUDE.md 内存文件" + }, + "multiEditing": "多重编辑", + "oneEdit": "1 编辑", + "oneItem": "1 件", + "oneOption": "1 个选项", + "openDirectoryTooltip": "点击打开目录", + "openFileTooltip": "点击在编辑器中打开文件", + "optionsCount": "{0} 选项", + "partial": "部分", + "pattern": "图案", + "plan": "计划模式", + "project": "项目", + "projectRoot": "项目根", + "readMode": "读取模式", + "reading": "阅读", + "replaceAllCount": "{0} 全部替换", + "replaceAllOccurrences": "替换所有出现", + "resumeCommand": { + "description": "恢复会话" + }, + "reviewCommand": { + "description": "请求代码审查" + }, + "searchPath": "搜索路径", + "searching": "搜索", + "startingLine": "起跑线", + "timeout": "超时", + "timeoutInMs": "超时:{0}ms", + "to": "至", + "todoList": "待办事项清单", + "todoPriority": { + "high": "高", + "low": "低", + "medium": "中等" + }, + "toolApprovalRequest": "Claude Code 希望使用 \"{0}\" 工具。您是否允许这样做?", + "totalEdits": "编辑总数", + "webFetch": "网络获取", + "writing": "写作" + }, + "code-completion": { + "progressText": "计算人工智能代码完成度..." + }, + "codex": { + "agentDescription": "由Codex驱动的OpenAI编程助手", + "completedCount": "{0}/{1} 已完成", + "exitCode": "退出代码: {0}", + "fileChangeFailed": "Codex 未能应用以下更改: {0}", + "fileChangeFailedGeneric": "代码库未能应用文件更改。", + "itemCount": "{0} 项目", + "noItems": "无项目", + "oneItem": "1件", + "running": "正在运行...", + "searched": "搜索", + "searching": "搜索", + "todoList": "待办事项列表", + "webSearch": "网页搜索" + }, + "completion": { + "agent": { + "description": "该代理可在 Theia IDE 的代码编辑器中提供内联代码自动补全功能。", + "vars": { + "file": { + "description": "被编辑文件的 URI" + }, + "language": { + "description": "正在编辑的文件的语言标识" + }, + "prefix": { + "description": "当前光标位置前的代码" + }, + "suffix": { + "description": "当前光标位置后的代码" + } + } + }, + "automaticEnable": { + "description": "编辑时在任何(摩纳哥)编辑器内自动触发 AI 补充。 \n 您也可以通过 \"触发内联建议 \"命令或默认快捷键 \"Ctrl+Alt+Space \"手动触发代码。" + }, + "cacheCapacity": { + "description": "要存储在缓存中的代码完成次数上限。数值越大,性能越好,但会消耗更多内存。 最小值为 10,建议范围在 50-200 之间。", + "title": "代码完成缓存容量" + }, + "debounceDelay": { + "description": "以毫秒为单位控制编辑器检测到更改后触发 AI 完成的延迟。 需要启用 \"自动代码完成\"。输入 0 可禁用去抖延迟。", + "title": "去抖延迟" + }, + "excludedFileExts": { + "description": "指定应禁用人工智能补全的文件扩展名(如 .md、.txt)。", + "title": "排除的文件扩展名" + }, + "fileVariable": { + "description": "正在编辑的文件的 URI。仅在代码补全上下文中可用。" + }, + "languageVariable": { + "description": "正在编辑的文件的 languageId。仅在代码补全上下文中可用。" + }, + "maxContextLines": { + "description": "作为上下文使用的最大行数,分布在光标位置前后的行中(前缀和后缀)。 如果设置为-1,则使用整个文件作为上下文,没有行数限制;如果设置为 0,则只使用当前行。", + "title": "最大上下文行数" + }, + "prefixVariable": { + "description": "当前光标位置前的代码。仅在代码补全上下文中可用。" + }, + "stripBackticks": { + "description": "从某些 LLM 返回的代码中删除周围的回车键。如果检测到回车键,则也会删除回车键后的所有内容。此设置有助于确保语言模型使用类似于标记下划线的格式时,能返回纯代码。", + "title": "从内联填写中删除反标" + }, + "suffixVariable": { + "description": "当前光标位置后的代码。仅在代码补全上下文中可用。" + } + }, + "configuration": { + "selectItem": "请选择一项。" + }, + "copilot": { + "auth": { + "aiConfiguration": "AI配置", + "authorize": "我已授权", + "copied": "已复制!", + "copyCode": "复制代码", + "expired": "授权已过期或被拒绝。请重试。", + "hint": "输入代码并授权后,请点击下方的“我已授权”。", + "initiating": "正在启动身份验证...", + "instructions": "要授权Theia使用GitHub Copilot,请访问以下网址并输入代码:", + "openGitHub": "打开 GitHub", + "success": "已成功登录 GitHub Copilot!", + "successHint": "如果您的 GitHub 账户拥有 Copilot 访问权限,现在您可以在 ", + "title": "登录 GitHub Copilot", + "tos": "通过登录,您即表示同意 ", + "tosLink": "GitHub 服务条款", + "verifying": "正在验证授权..." + }, + "category": "副驾驶", + "commands": { + "signIn": "登录 GitHub Copilot", + "signOut": "退出 GitHub Copilot" + }, + "enterpriseUrl": { + "mdDescription": "Copilot API 的 GitHub Enterprise 域名(例如 `github.mycompany.com`)。若使用 GitHub.com,请留空。" + }, + "models": { + "description": "GitHub Copilot 可用模型。可用模型取决于您的 Copilot 订阅类型。" + }, + "statusBar": { + "signedIn": "已使用 {0} 身份登录 GitHub Copilot。点击退出登录。", + "signedOut": "尚未登录 GitHub Copilot。点击登录。" + } + }, + "core": { + "agentConfiguration": { + "actions": "行动", + "addCustomAgent": "添加自定义代理", + "enableAgent": "启用代理", + "label": "代理商", + "llmRequirements": "LLM要求", + "notUsedInPrompt": "不用于提示", + "promptTemplates": "提示模板", + "selectAgentMessage": "请先选择代理!", + "templateName": "模板", + "undeclared": "未申报", + "usedAgentSpecificVariables": "已使用的特工专属变量", + "usedFunctions": "已使用函数", + "usedGlobalVariables": "使用全局变量", + "variant": "变体" + }, + "agentsVariable": { + "description": "返回系统中可用的代理列表" + }, + "aiConfiguration": { + "label": "人工智能配置 [阿尔法] ✨ AI 配置" + }, + "blinkTitle": { + "agentCompleted": "Theia - Agent 已完成", + "namedAgentCompleted": "Theia - Agent \"{0}\" 已完成" + }, + "changeSetSummaryVariable": { + "description": "提供变更集中文件及其内容的摘要。" + }, + "contextDetailsVariable": { + "description": "为所有上下文元素提供全文值和说明。" + }, + "contextSummaryVariable": { + "description": "描述特定会话上下文中的文件。" + }, + "customAgentTemplate": { + "description": "这是一个代理示例。请根据您的需求调整属性。" + }, + "defaultModelAliases": { + "code": { + "description": "针对代码理解和生成任务进行了优化。" + }, + "code-completion": { + "description": "最适用于代码自动完成场景。" + }, + "summarize": { + "description": "优先考虑摘要和浓缩内容的模型。" + }, + "universal": { + "description": "兼顾代码和一般语言的使用。" + } + }, + "defaultNotification": { + "mdDescription": "人工智能代理完成任务时使用的默认通知方式。单个代理可以覆盖此设置。\n - 操作系统通知显示操作系统/系统通知\n - `message`:在状态栏/消息区显示通知\n - `blink`:闪烁或高亮用户界面\n - `off`:关闭所有通知", + "title": "默认通知类型" + }, + "discard": { + "label": "丢弃 AI 提示模板" + }, + "discardCustomPrompt": { + "tooltip": "放弃自定义" + }, + "fileVariable": { + "description": "解析文件内容", + "uri": { + "description": "请求文件的 URI。" + } + }, + "languageModelRenderer": { + "alias": "[别名]{0}", + "languageModel": "语言模式", + "purpose": "目的" + }, + "maxRetries": { + "mdDescription": "向人工智能提供商发出的请求失败时重试的最大次数。值为 0 表示不重试。", + "title": "最大重试次数" + }, + "modelAliasesConfiguration": { + "agents": "使用该别名的代理", + "defaultList": "[默认列表]", + "evaluatesTo": "评估为", + "label": "型号别名", + "modelNotReadyTooltip": "未准备好", + "modelReadyTooltip": "准备就绪", + "noAgents": "没有代理使用此别名。", + "noModelReadyTooltip": "未准备模型", + "noResolvedModel": "此别名没有模型。", + "priorityList": "优先级列表", + "selectAlias": "请选择型号别名。", + "selectedModelId": "选定模式", + "unavailableModel": "所选型号已停产" + }, + "noVariableFoundForOpenRequest": "未为开放请求找到变量。", + "openEditorsShortVariable": { + "description": "当前打开的所有文件的简短引用(相对路径,逗号分隔)" + }, + "openEditorsVariable": { + "description": "以逗号分隔的当前打开的所有文件列表,相对于工作区根目录。" + }, + "preference": { + "languageModelAliases": { + "description": "在 [AI 配置视图]({0}) 中为每个语言模型别名配置模型。或者,您也可以在 settings.json 中手动设置: \n```\n\"default/code\":{\n \"selectedModel\":\"anthropic/claude-opus-4-20250514\"\n}\n```", + "selectedModel": "用户为该别名选择的模型。", + "title": "语言模型别名" + } + }, + "prefs": { + "title": "✨ 人工智能功能 [Alpha]" + }, + "promptFragmentsConfiguration": { + "activeCustomizationTitle": "主动定制", + "createCustomizationTitle": "创建自定义", + "customization": "定制", + "customizationLabel": "定制", + "defaultVariantTitle": "默认变体", + "deleteCustomizationTitle": "删除自定义", + "editTemplateTitle": "编辑模板", + "headerTitle": "提示片段", + "label": "提示片段", + "noFragmentsAvailable": "没有提示碎片。", + "otherPromptFragmentsHeader": "其他提示语片段", + "promptTemplateText": "提示模板文本", + "promptVariantsHeader": "提示变体集", + "removeCustomizationDialogMsg": "您确定要删除{0} 提示片段 \"{1}\"的自定义设置吗?", + "removeCustomizationDialogTitle": "移除自定义", + "removeCustomizationWithDescDialogMsg": "您确定要移除{0} 提示片段 \"{1}\" 的定制 ({2})?", + "resetAllButton": "全部重置", + "resetAllCustomizationsDialogMsg": "您确定要将所有提示片段重置为内置版本吗?这将删除所有自定义设置。", + "resetAllCustomizationsDialogTitle": "重置所有自定义设置", + "resetAllCustomizationsTitle": "重置所有自定义设置", + "resetAllPromptFragments": "重置所有提示符片段", + "resetToBuiltInDialogMsg": "您确定要将提示片段 \"{0}\" 重置为内置版本吗?这将删除所有自定义设置。", + "resetToBuiltInDialogTitle": "重置为内置", + "resetToBuiltInTitle": "重置为该内置", + "resetToCustomizationDialogMsg": "您确定要重置提示片段 \"{0}\" 以使用{1} 自定义?这将删除所有优先级更高的定制。", + "resetToCustomizationDialogTitle": "重置为自定义", + "resetToCustomizationTitle": "重置为自定义", + "selectedVariantLabel": "精选", + "selectedVariantTitle": "选定变体", + "usedByAgentTitle": "由代理人使用:{0}", + "variantSetError": "所选变量不存在,也找不到默认值。请检查您的配置。", + "variantSetWarning": "所选变量不存在。将使用默认变量。", + "variantsOfSystemPrompt": "该提示变体集的变体:" + }, + "promptTemplates": { + "description": "用于存储自定义提示模板的文件夹。如果未自定义,则使用用户配置目录。请考虑使用受版本控制的文件夹来管理提示模板的变体。", + "openLabel": "选择文件夹" + }, + "promptVariable": { + "argDescription": "要解决的提示模板 ID", + "completions": { + "detail": { + "builtin": "内置提示片段", + "custom": "定制提示片段" + } + }, + "description": "通过提示服务解决提示模板问题" + }, + "prompts": { + "category": "Theia AI 提示模板" + }, + "requestSettings": { + "clientSettings": { + "description": "关于如何处理发回 llm 的信息的客户端设置。", + "keepThinking": { + "description": "如果设置为 \"false\",则在多轮对话中发送下一个用户请求前,将过滤所有思维输出。" + }, + "keepToolCalls": { + "description": "如果设置为 false,则在多轮对话中发送下一个用户请求前,将过滤所有工具请求和工具响应。" + } + }, + "mdDescription": "允许为多个模型指定自定义请求设置。\n 每个对象代表一个特定模型的配置。modelId \"字段指定模型 ID,\"requestSettings \"定义特定于模型的设置。\n 提供商 ID \"字段是可选的,允许将设置应用于特定的提供商。如果未设置,设置将应用于所有提供商。\n 示例提供程序 ID:huggingface、openai、ollama、llamafile。\n 更多信息请参阅 [我们的文档](https://theia-ide.org/docs/user_ai/#custom-request-settings)。", + "modelSpecificSettings": { + "description": "特定型号 ID 的设置。" + }, + "scope": { + "agentId": { + "description": "要应用设置的代理 ID(可选)。" + }, + "modelId": { + "description": "模型 ID(可选" + }, + "providerId": { + "description": "要应用设置的提供商 ID(可选)。" + } + }, + "title": "自定义请求设置" + }, + "skillsVariable": { + "description": "返回可供AI代理使用的可用技能列表" + }, + "taskContextSummary": { + "description": "解决会话上下文中存在的所有任务上下文项。" + }, + "templateSettings": { + "edited": "编辑", + "unavailableVariant": "所选变体不再可用" + }, + "todayVariable": { + "description": "为今天做点什么", + "format": { + "description": "日期的格式" + } + }, + "unableToDisplayVariableValue": "无法显示变量值。", + "unableToResolveVariable": "无法解析变量。", + "variable-contribution": { + "builtInVariable": "Theia 内置变量", + "currentAbsoluteFilePath": "当前打开文件的绝对路径。请注意,大多数代理希望使用相对文件路径(相对于当前工作区)。", + "currentFileContent": "当前打开文件的纯内容。这不包括内容来源的信息。请注意,大多数代理使用相对文件路径(相对于当前工作区)时效果会更好。", + "currentRelativeDirPath": "包含当前打开文件的目录的相对路径。", + "currentRelativeFilePath": "当前打开文件的相对路径。", + "currentSelectedText": "打开的文件中当前选中的纯文本。这不包括内容来源的信息。请注意,大多数代理使用相对文件路径(相对于当前工作区)时效果会更好。", + "dotRelativePath": "当前打开文件相对路径的简短引用(\"currentRelativeFilePath\")。" + } + }, + "editor": { + "editorContextVariable": { + "description": "处理编辑器特定的上下文信息", + "label": "编辑器上下文" + }, + "explainWithAI": { + "prompt": "解释这个错误", + "title": "用人工智能解释" + }, + "fixWithAI": { + "prompt": "帮助修复此错误" + } + }, + "google": { + "apiKey": { + "description": "输入您的 Google AI (Gemini) 官方账户的 API 密钥。**请注意:** 使用此选项时,GOOGLE AI API 密钥将以明文形式存储在运行 Theia 的机器上。请使用环境变量 `GOOGLE_API_KEY` 安全设置密钥。" + }, + "maxRetriesOnErrors": { + "description": "出错时重试的最大次数。如果小于 1,则重试逻辑被禁用" + }, + "models": { + "description": "使用的官方 Google 双子座模型" + }, + "retryDelayOnOtherErrors": { + "description": "出现其他错误时重试的延迟时间(以秒为单位)(有时 Google GenAI 会报告错误,如模型返回的 JSON 语法不完整或 500 内部服务器错误)。将其设置为-1 可防止在这些情况下重试。否则,重试要么立即进行(如果设置为 0),要么在以秒为单位的延迟后进行(如果设置为正数)。" + }, + "retryDelayOnRateLimitError": { + "description": "出现速率限制错误时重试之间的延迟(秒)。参见 https://ai.google.dev/gemini-api/docs/rate-limits" + } + }, + "history": { + "clear": { + "tooltip": "清除所有代理的历史记录" + }, + "exchange-card": { + "agentId": "代理", + "timestamp": "已开始" + }, + "open-history-tooltip": "打开人工智能历史...", + "request-card": { + "agent": "代理", + "model": "模型", + "request": "要求", + "response": "回应", + "timestamp": "时间戳", + "title": "要求" + }, + "sortChronologically": { + "tooltip": "按时间排序" + }, + "sortReverseChronologically": { + "tooltip": "按时间倒序排序" + }, + "toggleCompact": { + "tooltip": "显示紧凑视图" + }, + "toggleHideNewlines": { + "tooltip": "停止解释换行符" + }, + "toggleRaw": { + "tooltip": "显示原始视图" + }, + "toggleRenderNewlines": { + "tooltip": "解释换行符" + }, + "view": { + "label": "✨ 人工智能代理历史 [Alpha]", + "noAgent": "没有代理。", + "noAgentSelected": "未选择代理。", + "noHistoryForAgent": "所选代理无历史记录 '{0}'" + } + }, + "huggingFace": { + "apiKey": { + "mdDescription": "输入 Hugging Face 账户的 API 密钥。**请注意:** 使用此首选项后,Hugging Face API 密钥将以明文形式存储在运行 Theia 的机器上。使用环境变量 `HUGGINGFACE_API_KEY` 安全设置密钥。" + }, + "models": { + "mdDescription": "可使用的Hugging Face模型。**请注意:**目前仅支持提供聊天补全API的模型(如`*-Instruct`等指令微调模型)。部分模型可能需要在Hugging Face官网接受许可条款。" + } + }, + "ide": { + "agent-description": "在 [AI 配置视图]({0}) 中配置 AI 代理设置,包括启用、LLM 选择、提示模板定制和自定义代理创建。", + "agentConfiguration": { + "customAgentLocationQuickPick": { + "createNewFile": "创建新文件", + "openExistingFile": "打开现有文件", + "placeholder": "选择创建或打开自定义代理文件的位置", + "title": "选择自定义代理文件的位置" + }, + "noDescription": "无可用描述" + }, + "app-tester": { + "errorCheckingDevToolsServerStatus": "检查开发者工具 MCP 服务器状态时出错:{0}", + "errorCheckingPlaywrightServerStatus": "检查 Playwright MCP 服务器状态出错:{0}", + "startChromeDevToolsMcpServers": { + "canceled": "请设置Chrome开发者工具MCP服务器。", + "error": "启动Chrome开发者工具MCP服务器失败:{0}", + "progress": "启动 Chrome 开发者工具 MCP 服务器。", + "question": "Chrome 开发者工具 MCP 服务器未运行。是否现在启动?这可能会安装 Chrome 开发者工具 MCP 服务器。" + }, + "startMcpServers": { + "no": "不,取消", + "yes": "是的,启动服务器。" + }, + "startPlaywrightServers": { + "canceled": "请设置 MCP 服务器。", + "error": "启动 Playwright MCP 服务器失败:{0}", + "progress": "启动 Playwright MCP 服务器。", + "question": "Playwright MCP 服务器没有运行。您想现在启动它们吗?这可能会安装 Playwright MCP 服务器。" + } + }, + "architectAgent": { + "mode": { + "default": "默认模式", + "plan": "模式图", + "simple": "简单模式" + }, + "suggestion": { + "executePlanWithCoder": "使用Coder执行\"{0}\"", + "summarizeSessionAsTaskForCoder": "将本次会议总结为编码员的一项任务", + "updateTaskContext": "更新当前任务上下文" + } + }, + "bypassHint": "某些代理(如Claude Code)不需要Theia语言模型", + "chatDisabledMessage": { + "featuresTitle": "当前支持的视图与功能:" + }, + "coderAgent": { + "mode": { + "agentNext": "代理模式(下一页)", + "edit": "编辑模式" + }, + "suggestion": { + "fixProblems": { + "content": "修复当前文件中的 [Fix problems]({0}).", + "prompt": "请查看{1} 并解决任何问题。" + }, + "startNewChat": "保持聊天简短、重点突出。针对新任务[开始新的聊天]({0}) 或[开始新的聊天并总结本次聊天]({1})。" + } + }, + "commandAgent": { + "commandCallback": { + "confirmAction": "明白", + "label": "人工智能指令" + }, + "response": { + "customHandler": "试试这样执行:", + "noCommand": "抱歉,我找不到这样的命令", + "theiaCommand": "我发现这个命令可能对你有帮助:" + }, + "vars": { + "commandIds": { + "description": "Theia 的可用命令列表。" + } + } + }, + "configureAgent": { + "header": "配置默认代理" + }, + "continueAnyway": "继续前进", + "createSkillAgent": { + "mode": { + "edit": "默认模式" + } + }, + "enableAI": { + "mdDescription": "❗ 此设置允许您访问最新的人工智能功能(测试版)。 \n 请注意,这些功能正处于测试阶段,这意味着它们可能会发生变化,并将得到进一步改进。需要注意的是,这些功能可能会对您提供访问权限的语言模型 (LLM) 产生持续请求。这可能会产生您需要密切监控的成本。启用此选项即表示您承认这些风险。 \n **请注意!本节下面的设置只有在主功能设置启用后才会生效。\n 只有在主功能设置启用后才会生效。启用该功能后,您需要在下面配置至少一个 LLM 提供商。另请参阅 [文档](https://theia-ide.org/docs/user_ai/)**。" + }, + "github": { + "configureGitHubServer": { + "canceled": "GitHub 服务器配置已取消。请配置 GitHub MCP 服务器以使用该代理。", + "no": "否,取消", + "yes": "是,配置 GitHub 服务器" + }, + "errorCheckingGitHubServerStatus": "检查 GitHub MCP 服务器状态时出错:{0}", + "startGitHubServer": { + "canceled": "请启动 GitHub MCP 服务器以使用该代理。", + "error": "启动 GitHub MCP 服务器失败:{0}", + "no": "否,取消", + "progress": "启动 GitHub MCP 服务器。", + "question": "GitHub MCP 服务器已配置,但尚未运行。您想现在启动它吗?", + "yes": "是,启动服务器" + } + }, + "githubRepoName": { + "description": "当前 GitHub 仓库的名称(例如,\"eclipse-theia/theia)" + }, + "model-selection-description": "在 [AI 配置视图]({0}) 中选择每个人工智能代理使用的大型语言模型 (LLM)。", + "moreAgentsAvailable": { + "header": "更多代理可用" + }, + "noRecommendedAgents": "没有推荐的代理可用。", + "openSettings": "打开 AI 设置", + "or": "或", + "orchestrator": { + "error": { + "noAgents": "没有聊天代理可处理请求。请检查您的配置是否启用了聊天代理。" + }, + "progressMessage": "确定最合适的代理", + "response": { + "delegatingToAgent": "授权给 `@{0}`" + } + }, + "prompt-template-description": "在 [AI 配置视图]({0}) 中为 AI 代理选择提示变量和自定义提示模板。", + "recommendedAgents": "推荐的代理:", + "skillsConfiguration": { + "label": "技能", + "location": { + "label": "位置" + } + }, + "toolsConfiguration": { + "confirmAlwaysAllow": { + "confirm": "我明白了,启用自动批准功能。", + "title": "是否启用“{0}”的自动批准?" + }, + "confirmationMode": { + "label": "确认模式" + }, + "default": { + "label": "默认工具确认模式:" + }, + "resetAll": "全部重置", + "resetAllConfirmDialog": { + "msg": "您确定要将所有工具确认模式重置为默认模式吗?这将删除所有自定义设置。", + "title": "重置所有工具确认模式" + }, + "resetAllTooltip": "将所有工具重置为默认设置", + "toolOptions": { + "confirm": { + "label": "确认" + } + } + }, + "variableConfiguration": { + "selectVariable": "请选择一个变量。", + "usedByAgents": "由代理使用", + "variableArgs": "变量参数" + } + }, + "llamaFile": { + "prefs": { + "mdDescription": "此设置允许您在 Theia IDE 中配置和管理 LlamaFile 模型。 \n 每个条目都需要一个用户友好的 \"名称\"、指向 LlamaFile 的文件 \"uri \"以及运行它的 \"端口\"。 \n 要启动 LlamaFile,请使用 \"Start LlamaFile\"(启动 LlamaFile)命令,该命令可让您选择所需的模型。 \n 如果您编辑了一个条目(例如更改端口),任何正在运行的实例都将停止,您需要重新手动启动它。 \n [有关配置和管理 LlamaFiles 的更多信息,请参阅 Theia IDE 文档](https://theia-ide.org/docs/user_ai/#llamafile-models)。", + "name": { + "description": "用于此 Llamafile 的模型名称。" + }, + "port": { + "description": "用于启动服务器的端口。" + }, + "title": "✨ AI LlamaFile", + "uri": { + "description": "Llamafile 的文件 uri。" + } + }, + "start": "启动 Llamafile", + "stop": "停止 Llamafile" + }, + "llamafile": { + "error": { + "noConfigured": "未配置 Llamafiles。", + "noRunning": "没有运行 Llamafiles。", + "startFailed": "在启动 llamafile 时出了问题:{0} 。\n有关详细信息,请参阅控制台。", + "stopFailed": "在停止 llamafile 的过程中出了问题:{0} 。\n有关详细信息,请参阅控制台。" + } + }, + "mcp": { + "error": { + "allServersRunning": "所有 MCP 服务器均已运行。", + "noRunningServers": "没有运行 MCP 服务器。", + "noServersConfigured": "未配置 MCP 服务器。", + "startFailed": "启动 MCP 服务器时发生错误。" + }, + "info": { + "serverStarted": "MCP 服务器 \"{0}\" 成功启动。已注册工具:{1}" + }, + "servers": { + "args": { + "mdDescription": "要传递给命令的参数数组。", + "title": "命令参数" + }, + "autostart": { + "mdDescription": "在前台启动时自动启动该服务器。新添加的服务器不会立即自动启动,但会在重启时自动启动", + "title": "自动启动" + }, + "command": { + "mdDescription": "用于启动 MCP 服务器的命令,如 \"uvx \"或 \"npx\"。", + "title": "执行 MCP 服务器的命令" + }, + "env": { + "mdDescription": "为服务器设置的可选环境变量,如 API 密钥。", + "title": "环境变量" + }, + "headers": { + "mdDescription": "每次向服务器发出请求时都会包含的可选附加标头。", + "title": "页眉" + }, + "mdDescription": "使用命令、参数、可选环境变量和自动启动(默认为 true)配置 MCP 服务器。每个服务器都有一个唯一的关键字,如 \"brave-search \"或 \"filesystem\"。要启动服务器,可使用 \"MCP: Start MCP Server(MCP:启动 MCP 服务器)\"命令选择所需的服务器。要停止服务器,请使用 \"MCP: Stop MCP Server(MCP:停止 MCP 服务器)\"命令。请注意,自动启动只有在重启后才会生效,您需要首次手动启动服务器。\n配置示例:\n```{\n \"brave-search\":{\n \"command\":\"npx\"、\n \"args\":[\n \"-y\",\n \"@modelcontextprotocol/server-brave-search\" [ \"-y\", \"@modelcontextprotocol/server-brave-search\" ].\n ],\n \"env\":{\n \"brave_api_key\":\"YOUR_API_KEY\"(您的应用程序密钥\n },\n },\n \"文件系统{\n \"命令\":\"npx\"、\n \"args\":[\"-y\", \"@modelcontextprotocol/server-filesystem\", \"/Users/YOUR_USERNAME/Desktop\"]、\n \"env\":{\n \"custom_env_var\":\"自定义值\"\n },\n \"自动启动\": false\n }\n}\n```", + "serverAuthToken": { + "mdDescription": "服务器的身份验证令牌(如果需要)。用于与远程服务器进行身份验证。", + "title": "认证令牌" + }, + "serverAuthTokenHeader": { + "mdDescription": "服务器身份验证令牌使用的标头名称。如果未提供,将使用 \"Authorization\"(授权)和 \"Bearer\"(承载器)。", + "title": "验证头名称" + }, + "serverUrl": { + "mdDescription": "远程 MCP 服务器的 URL。如果提供,服务器将连接到该 URL,而不是启动本地进程。", + "title": "服务器 URL" + }, + "title": "MCP 服务器配置" + }, + "start": { + "label": "MCP: 启动 MCP 服务器" + }, + "stop": { + "label": "MCP: 停止 MCP 服务器" + } + }, + "mcpConfiguration": { + "arguments": "论据: ", + "autostart": "自动启动: ", + "connectServer": "连接", + "connectingServer": "正在连接...", + "copiedAllList": "将所有工具复制到剪贴板(所有工具列表)", + "copiedAllSingle": "将所有工具复制到剪贴板(包含所有工具的单一提示片段)", + "copiedForPromptTemplate": "为提示模板将所有工具复制到剪贴板(包含所有工具的单一提示片段)", + "copyAllList": "全部复制(所有工具列表)", + "copyAllSingle": "复制所有聊天内容(使用所有工具的单一提示片段)", + "copyForPrompt": "复制工具(用于聊天或提示模板)", + "copyForPromptTemplate": "全部复制提示模板(使用所有工具的单一提示片段)", + "environmentVariables": "环境变量: ", + "headers": "页眉: ", + "noServers": "未配置 MCP 服务器", + "serverAuthToken": "验证令牌: ", + "serverAuthTokenHeader": "验证头名称: ", + "serverUrl": "服务器 URL: ", + "tools": "工具 " + }, + "openai": { + "apiKey": { + "mdDescription": "输入您官方 OpenAI 账户的 API 密钥。**请注意:** 使用此选项时,Open AI API 密钥将以明文形式存储在运行 Theia 的机器上。请使用环境变量 `OPENAI_API_KEY` 安全设置密钥。" + }, + "customEndpoints": { + "apiKey": { + "title": "访问指定 url 上提供的 API 的密钥,或者 `true` 来使用全局 OpenAI API 密钥" + }, + "apiVersion": { + "title": "或者是访问 Azure 中给定 url 上提供的 API 的版本,或者是使用全局 OpenAI API 版本的 `true" + }, + "deployment": { + "title": "在 Azure 中访问通过给定 URL 提供的 API 的部署名称" + }, + "developerMessageSettings": { + "title": "控制对系统消息的处理:用户\"、\"系统 \"和 \"开发者 \"将作为一个角色,\"mergeWithFollowingUserMessage \"将在下面的用户消息前加上系统消息,或者如果下一条消息不是用户消息,则将系统消息转换为用户消息。 skip \"将直接删除系统消息),默认为 \"developer\"。" + }, + "enableStreaming": { + "title": "表示是否使用流式 API。默认为 `true`。" + }, + "id": { + "title": "用户界面中用于识别自定义模型的唯一标识符" + }, + "mdDescription": "集成与 OpenAI API 兼容的自定义模型,例如通过 `vllm`。所需属性为 `model` 和 `url`。 \n 可选择 \n - 指定一个唯一的 `id` 以在用户界面中识别自定义模型。如果没有指定 `model` 将被用作 `id`。 \n - 提供一个 `apiKey` 以访问在给定 url 上提供的 API。使用 `true` 表示使用全局 OpenAI API 密钥。 \n - 提供一个 `apiVersion` 以访问在 Azure 中通过给定网址提供的 API。使用 `true` 表示使用全局 OpenAI API 版本。 \n - 将 `developerMessageSettings` 设置为 `user`、`system`、`developer`、`mergeWithFollowingUserMessage` 或 `skip`,以控制如何包含开发人员消息(其中 `user`、`system` 和 `developer` 将用作角色,`mergeWithFollowingUserMessage` 将在下面的用户消息前加上系统消息,或者如果下一条消息不是用户消息,则将系统消息转换为用户消息。`skip` 则只删除系统消息)。 默认为 `developer`。 \n - 指定 `supportsStructuredOutput: false` 表示不使用结构化输出。 \n - 指定 `enableStreaming: false` 表示不使用流媒体。 \n 更多信息请参阅[我们的文档](https://theia-ide.org/docs/user_ai/#openai-compatible-models-eg-via-vllm)。", + "modelId": { + "title": "型号 ID" + }, + "supportsStructuredOutput": { + "title": "表示模型是否支持结构化输出。默认为 `true`。" + }, + "url": { + "title": "托管模型的开放式人工智能应用程序接口兼容端点" + } + }, + "models": { + "description": "可使用的官方 OpenAI 模型" + }, + "useResponseApi": { + "mdDescription": "对官方 OpenAI 模型使用较新的 OpenAI 响应 API 而不是聊天完成 API。此设置仅适用于官方 OpenAI 模型,自定义提供商必须单独配置。" + } + }, + "promptTemplates": { + "directories": { + "title": "特定工作区的提示模板目录" + }, + "extensions": { + "description": "提示位置中被视为提示模板的附加文件扩展名列表。.prompttemplate \"始终被视为默认文件。", + "title": "其他提示模板文件扩展名" + }, + "files": { + "title": "特定工作区的提示模板文件" + } + }, + "scanoss": { + "changeSet": { + "clean": "无匹配", + "error": "错误:重新运行", + "error-notification": "遇到 ScanOSS 错误:{0} 。", + "match": "查看比赛", + "scan": "扫描", + "scanning": "扫描..." + }, + "mode": { + "automatic": { + "description": "启用自动扫描聊天视图中的代码片段。" + }, + "description": "配置 SCANOSS 功能以分析聊天视图中的代码片段。这将把建议代码片段的哈希值发送到由 [Software Transparency foundation]() 托管的 SCANOSS\n服务进行分析。", + "manual": { + "description": "用户可以通过点击聊天视图中的 SCANOSS 项目手动触发扫描。" + }, + "off": { + "description": "功能完全关闭。" + } + }, + "snippet": { + "dialog-header": "扫描和OSS结果", + "errored": "SCANOSS - 错误{0}", + "file-name-heading": "在{0}", + "in-progress": "SCANOSS - 执行扫描...", + "match-count": "找到{0} 匹配", + "matched": "SCANOSS - 找到{0} 匹配", + "no-match": "SCANOSS - 不匹配", + "summary": "摘要" + } + }, + "session-settings-dialog": { + "title": "设置会话设置", + "tooltip": "设置会话设置" + }, + "terminal": { + "agent": { + "description": "该代理为编写和执行任意终端命令提供帮助。 根据用户的请求,它可提出命令建议,并允许用户在终端中直接粘贴和执行这些命令。 它能访问当前目录、环境和终端会话的最近终端输出,以提供上下文感知辅助功能", + "vars": { + "cwd": { + "description": "当前工作目录。" + }, + "recentTerminalContents": { + "description": "终端中可见的最近 0 至 50 行。" + }, + "shell": { + "description": "使用的 shell,例如 /usr/bin/zsh。" + }, + "userRequest": { + "description": "用户的问题或请求。" + } + } + }, + "askAi": "向人工智能提问", + "askTerminalCommand": "询问一个终端命令...", + "hitEnterConfirm": "按回车键确认", + "howCanIHelp": "我能帮您什么忙?", + "loading": "加载中", + "tryAgain": "再试一次...", + "useArrowsAlternatives": "或使用 ⇅ 来显示替代方案..." + }, + "tokenUsage": { + "cachedInputTokens": "写入缓存的输入令牌", + "cachedInputTokensTooltip": "额外跟踪 \"输入令牌\"。通常比非缓存令牌更昂贵。", + "failedToGetTokenUsageData": "获取令牌使用数据失败:{0}", + "inputTokens": "输入标记", + "label": "令牌的使用", + "lastUsed": "最后使用", + "model": "模型", + "noData": "目前还没有令牌使用数据。", + "note": "令牌使用情况从应用程序启动时就开始跟踪,不会持久保存。", + "outputTokens": "输出令牌", + "readCachedInputTokens": "从缓存读取输入令牌", + "readCachedInputTokensTooltip": "另外跟踪 \"输入令牌\"。通常比不缓存要便宜得多。通常不计入速率限制。", + "total": "总计", + "totalTokens": "代币总数", + "totalTokensTooltip": "输入令牌 \"+\"输出令牌" + }, + "vercelai": { + "anthropicApiKey": { + "mdDescription": "输入人类学模型的 API 密钥。**请注意:** 使用此选项时,API 密钥将以明文形式存储在运行 Theia 的机器上。请使用环境变量 `ANTHROPIC_API_KEY` 安全设置密钥。" + }, + "customEndpoints": { + "apiKey": { + "title": "访问通过给定 URL 提供的 API 的密钥,或 `true` 使用全局 API 密钥" + }, + "enableStreaming": { + "title": "表示是否使用流媒体 API。默认为 `true`。" + }, + "id": { + "title": "用户界面中用于识别自定义模型的唯一标识符" + }, + "mdDescription": "集成与 Vercel AI SDK 兼容的自定义模型。所需属性为 `model` 和 `url`。 \n 可选择 \n - 指定一个唯一的 `id` 以在用户界面中识别自定义模型。如果没有指定 `model` 将被用作 `id`。 \n - 提供一个 `apiKey` 以访问在给定 url 上提供的 API。使用 `true` 表示使用全局 API 密钥。 \n - 指定 `supportsStructuredOutput: false` 表示不使用结构化输出。 \n - 指定 `enableStreaming: false` 表示不使用流媒体。 \n - 指定 `provider` 表示模型来自哪个提供商(openai、anthropic)。", + "modelId": { + "title": "型号 ID" + }, + "supportsStructuredOutput": { + "title": "表示模型是否支持结构化输出。默认为 `true`。" + }, + "url": { + "title": "托管模型的 API 端点" + } + }, + "models": { + "description": "与 Vercel AI SDK 配合使用的官方模型", + "id": { + "title": "型号 ID" + }, + "model": { + "title": "型号名称" + } + }, + "openaiApiKey": { + "mdDescription": "输入 OpenAI 模型的 API 密钥。**请注意:** 使用此选项时,API 密钥将以明文形式存储在运行 Theia 的机器上。请使用环境变量 `OPENAI_API_KEY` 安全设置密钥。" + } + }, + "workspace": { + "coderAgent": { + "description": "Theia IDE 中集成的人工智能助手,旨在为软件开发人员提供帮助。该代理可以访问用户的工作区,获取所有可用文件和文件夹的列表,并检索其内容。此外,它还能向用户提出修改文件的建议。因此,它可以协助用户完成编码任务或其他涉及文件修改的任务。" + }, + "considerGitignore": { + "description": "如果启用,则排除全局 .gitignore 文件中指定的文件/文件夹(预计位置为工作区根目录)。", + "title": "考虑 .gitignore" + }, + "excludedPattern": { + "description": "要排除的文件/文件夹的模式(glob 或 regex)列表。", + "title": "排除的文件模式" + }, + "searchMaxResults": { + "description": "工作区搜索功能返回搜索结果的最大数量。", + "title": "最大搜索结果" + }, + "workspaceAgent": { + "description": "Theia IDE 中集成的人工智能助手,旨在为软件开发人员提供帮助。该代理可以访问用户的工作区,获取所有可用文件和文件夹的列表,并检索其内容。它不能修改文件。因此,它可以回答工作区中有关当前项目、项目文件和源代码的问题,如如何构建项目、在哪里放置源代码、在哪里查找特定代码或配置等。" + } + } + }, + "ai-chat": { + "fileChangeSetTitle": "建议的变动" + }, + "ai-chat-ui": { + "initiate-session-task-context": "任务背景:启动会话", + "open-current-session-summary": "公开 本届会议摘要", + "open-settings-tooltip": "打开人工智能设置...", + "scroll-lock": "锁定滚动条", + "scroll-unlock": "解锁卷轴", + "session-settings": "设置会话设置", + "showChats": "显示聊天记录...", + "summarize-current-session": "总结本届会议" + }, + "ai-claude-code": { + "open-config": "开放式克劳德代码配置", + "open-memory": "打开克劳德代码存储器 (CLAUDE.MD)" + }, + "ai-core": { + "agentCompletionMessage": "代理 \"{0}\" 已完成任务。", + "agentCompletionTitle": "代理 \"{0}\" 任务已完成", + "agentCompletionWithTask": "代理 \"{0}\" 已完成任务:{1}" + }, + "ai-editor": { + "contextMenu": "询问人工智能", + "sendToChat": "发送至人工智能聊天" + }, + "ai-ide": { + "addressGhReviewCommand": { + "argumentHint": "", + "description": "处理GitHub拉取请求的地址审查意见" + }, + "fixGhTicketCommand": { + "argumentHint": "", + "description": "分析GitHub工单并实施解决方案" + }, + "open-agent-settings-tooltip": "打开代理设置...", + "rememberCommand": { + "argumentHint": "[主题提示]", + "description": "从对话中提取主题并更新项目信息" + }, + "ticketCommand": { + "argumentHint": "", + "description": "分析GitHub工单并制定实施计划" + }, + "todoTool": { + "noTasks": "无任务" + }, + "withAppTesterCommand": { + "description": "将测试委托给AppTester代理(需启用代理模式)" + } + }, + "ai-mcp": { + "blockedServersLabel": "MCP 服务器(自动启动被阻止)" + }, + "ai-terminal": { + "cancelExecution": "取消命令执行", + "canceling": "取消中...", + "confirmExecution": "确认Shell命令", + "denialReason": "理由", + "executionCanceled": "已取消", + "executionDenied": "被拒绝", + "executionDeniedWithReason": "有理有据地拒绝", + "noOutput": "无输出", + "partialOutput": "部分输出", + "timeout": "超时", + "workingDirectory": "工作目录" + }, + "callhierarchy": { + "noCallers": "没有发现调用者。", + "open": "打开调用层次结构" + }, + "chat": { + "taskContextVariable": { + "args": { + "contextId": { + "description": "要检索的任务上下文或要汇总的聊天会话的 ID。" + } + }, + "description": "提供任务的背景信息,例如完成任务的计划或之前会议的摘要", + "label": "任务背景" + } + }, + "collaboration": { + "collaborate": "合作", + "collaboration": "合作", + "collaborationWorkspace": "协作工作区", + "connected": "已连接", + "connectedSession": "连接到协作会议", + "copiedInvitation": "邀请函代码已复制到剪贴板。", + "copyAgain": "再次复制", + "createRoom": "创建新的协作会话", + "creatingRoom": "创建会话", + "end": "结束合作会议", + "endDetail": "终止会话,停止内容共享,并取消其他人的访问权限。", + "enterCode": "输入协作会话代码", + "failedCreate": "创建房间失败:{0}", + "failedJoin": "未能加入房间:{0}", + "fieldRequired": "{0} 字段为必填字段。登录失败。", + "invite": "邀请他人", + "inviteDetail": "复制邀请代码,与他人分享,参加会议。", + "joinRoom": "参加协作会议", + "joiningRoom": "加入会议", + "leave": "离开合作会议", + "leaveDetail": "断开当前协作会话并关闭工作区。", + "loginFailed": "登录失败。", + "loginSuccessful": "登录成功。", + "noAuth": "服务器未提供验证方法。", + "optional": "可选的", + "selectAuth": "选择验证方法", + "selectCollaboration": "选择协作选项", + "serverUrl": "服务器 URL", + "serverUrlDescription": "用于实时协作会话的开放协作工具服务器实例的 URL", + "sharedSession": "共享合作会议", + "startSession": "开始或加入协作会议", + "userWantsToJoin": "用户 '{0}' 希望加入协作室", + "whatToDo": "您想与其他合作者做些什么?" + }, + "core": { + "about": { + "compatibility": "{0} 兼容性", + "defaultApi": "默认的{0} API", + "listOfExtensions": "扩展名列表" + }, + "common": { + "closeAll": "全部关闭", + "closeAllTabMain": "关闭主区域的所有标签页", + "closeOtherTabMain": "关闭主区域的其他标签页", + "closeOthers": "关闭其他标签页", + "closeRight": "关闭右侧标签页", + "closeTab": "关闭标签页", + "closeTabMain": "关闭主区域标签页", + "collapseAllTabs": "折叠所有面板", + "collapseBottomPanel": "折叠底部面板", + "collapseLeftPanel": "切换左面板", + "collapseRightPanel": "切换右面板", + "collapseTab": "折叠面板", + "showNextTabGroup": "切换到下一个标签页组", + "showNextTabInGroup": "切换到组中的下一个标签页", + "showPreviousTabGroup": "切换到上一个标签页组", + "showPreviousTabInGroup": "切换到组中的上一个标签页", + "toggleMaximized": "切换最大化面板" + }, + "copyInfo": "先打开文件,复制其路径", + "copyWarn": "请使用浏览器的复制命令或快捷方式。", + "cutWarn": "请使用浏览器的剪切命令或快捷键。", + "enhancedPreview": { + "classic": "显示选项卡的简单预览和基本信息。", + "enhanced": "显示选项卡的增强预览,并提供更多信息。", + "visual": "显示选项卡的可视化预览。" + }, + "file": { + "browse": "浏览" + }, + "highlightModifiedTabs": "控制是否在修改过的(dirty)编辑器标签上绘制顶部边框。", + "keybinding": { + "duplicateModifierError": "无法解析按键绑定{0} 重复修改器", + "metaError": "无法解析按键绑定{0} 元仅适用于 OSX", + "unrecognizedKeyError": "未识别的关键{0} {1}" + }, + "keybindingStatus": "{0}被按下,等待更多的按键", + "keyboard": { + "choose": "选择键盘布局", + "chooseLayout": "选择一个键盘布局", + "current": "(当前:{0})", + "currentLayout": "- 当前布局", + "mac": "苹果键盘", + "pc": "电脑键盘", + "tryDetect": "尝试从浏览器信息和按下的按键中检测键盘布局。" + }, + "navigator": { + "clipboardWarn": "对剪贴板的访问被拒绝了。检查你的浏览器的权限。", + "clipboardWarnFirefox": "剪贴板API是不可用的。它可以通过'{0}'页面上的'{1}'偏好启用。然后重新加载Theia。注意,这将允许FireFox获得对系统剪贴板的完全访问。" + }, + "offline": "离线", + "pasteWarn": "请使用浏览器的粘贴命令或快捷方式。", + "quitMessage": "任何未保存的修改都不会被保存。", + "resetWorkbenchLayout": "重置工作台面布局", + "searchbox": { + "close": "关闭 (Escape)", + "next": "下一页 (向下)", + "previous": "上一页 (向上)", + "showAll": "显示所有项目", + "showOnlyMatching": "仅显示匹配项" + }, + "secondaryWindow": { + "alwaysOnTop": "启用后,辅助窗口将保持在所有其他窗口(包括不同应用程序的窗口)之上。", + "description": "设置提取的辅助窗口的初始位置和大小。", + "fullSize": "提取部件的位置和大小将与运行中的 Theia 应用程序相同。", + "halfWidth": "提取部件的位置和大小将是运行中的 Theia 应用程序宽度的一半。", + "originalSize": "提取部件的位置和大小将与原始部件相同。" + }, + "severity": { + "log": "日志" + }, + "silentNotifications": "控制是否抑制弹出通知。", + "tabDefaultSize": "指定标签的默认尺寸。", + "tabMaximize": "控制是否在双击时最大化标签。", + "tabMinimumSize": "指定标签的最小尺寸。", + "tabShrinkToFit": "收缩标签以适应可用空间。", + "window": { + "tabCloseIconPlacement": { + "description": "将标签页标题上的关闭图标放在标签页的开始或结束位置。在所有平台上默认为结束。", + "end": "将关闭图标放在标签末尾。在从左到右的语言中,这是标签的右侧。", + "start": "将关闭图标放在标签的开头。在从左到右的语言中,这是标签的左侧。" + } + }, + "window.menuBarVisibility": "菜单以紧凑按钮的形式显示在侧边栏中。当{0} 时,此值将被{1}忽略。" + }, + "debug": { + "TheiaIDE": "Theia IDE", + "addConfigurationPlaceholder": "选择要添加配置的工作区根", + "breakpoint": "断点", + "cannotRunToThisLocation": "无法将当前线程运行到指定位置。", + "compound-cycle": "启动配置'{0}'包含一个与自己的循环", + "conditionalBreakpoint": "条件断点", + "conditionalBreakpointsNotSupported": "该调试类型不支持条件断点", + "confirmRunToShiftedPosition_msg": "目标位置将移至 Ln{0}, Col{1} 。无论如何运行?", + "confirmRunToShiftedPosition_title": "无法将当前线程精确运行到指定位置", + "consoleFilter": "过滤器(例如文本、!排除)", + "consoleFilterAriaLabel": "过滤调试控制台输出", + "consoleSessionSelectorTooltip": "在调试会话之间切换。每个调试会话都有独立的控制台输出。", + "consoleSeverityTooltip": "按严重性级别过滤控制台输出。仅显示具有所选严重性的消息。", + "continueAll": "继续所有", + "copyExpressionValue": "复制表达式的值", + "couldNotRunTask": "无法运行任务 \"{0}\"。", + "dataBreakpoint": "数据断点", + "debugConfiguration": "调试配置", + "debugSessionInitializationFailed": "调试会话初始化失败。详情请查看控制台。", + "debugSessionTypeNotSupported": "不支持调试会话类型 \"{0}\"。", + "debugToolbarMenu": "调试工具栏菜单", + "debugVariableInput": "设置{0} 值", + "disableSelectedBreakpoints": "禁用所选断点", + "disabledBreakpoint": "残疾{0}", + "enableSelectedBreakpoints": "启用选定断点", + "entry": "条目", + "errorStartingDebugSession": "启动调试会话时出现错误,请查看日志了解详情。", + "exception": "例外情况", + "functionBreakpoint": "功能断点", + "goto": "开始", + "htiConditionalBreakpointsNotSupported": "命中该调试类型不支持的条件断点", + "instruction-breakpoint": "指令断点", + "instructionBreakpoint": "指令断点", + "logpointsNotSupported": "该调试类型不支持的日志点", + "missingConfiguration": "动态配置'{0}:{1}'缺少或不适用", + "pause": "暂停", + "pauseAll": "暂停所有", + "reveal": "显示", + "step": "步骤", + "taskTerminatedBySignal": "任务 '{0}' 因信号{1} 而终止。", + "taskTerminatedForUnknownReason": "任务 '{0}' 因不明原因终止。", + "taskTerminatedWithExitCode": "任务 '{0}' 终止,退出代码为{1}.", + "threads": "线程", + "toggleTracing": "启用/禁用与调试适配器的跟踪通信", + "unknownSession": "未知场次", + "unverifiedBreakpoint": "未核实{0}" + }, + "editor": { + "diffEditor.wordWrap2": "行将根据 `#editor.wordWrap#` 设置换行。", + "dirtyEncoding": "该文件是脏的。请先保存它,然后用另一种编码重新打开它。", + "editor.bracketPairColorization.enabled": "控制是否启用括号对着色。使用 `#workbench.colorCustomizations#` 覆盖括号高亮颜色。", + "editor.codeActions.triggerOnFocusChange": "当 `#files.autoSave#` 设置为 `afterDelay` 时,启用触发 `#editor.codeActionsOnSave#`。代码操作必须设置为 \"always\",才能在窗口和焦点改变时触发。", + "editor.detectIndentation": "控制打开文件时是否根据文件内容自动检测 `#editor.tabSize#` 和 `#editor.insertSpaces#`。", + "editor.experimental.preferTreeSitter": "控制是否为特定语言启用树坐者解析功能。对于指定语言,此设置将优先于 `editor.experimental.treeSitterTelemetry`。", + "editor.inlayHints.enabled1": "镶嵌提示默认显示,按住 \"Ctrl+Alt \"时隐藏。", + "editor.inlayHints.enabled2": "镶嵌提示默认是隐藏的,当按住`Ctrl+Alt`时显示。", + "editor.inlayHints.fontFamily": "控制编辑器中镶嵌提示的字体家族。设置为空时,将使用 `#editor.fontFamily#`。", + "editor.inlayHints.fontSize": "控制编辑器中镶嵌提示的字体大小。默认情况下,当配置值小于 \"5 \"或大于编辑器字体大小时,将使用 \"#editor.fontSize#\"。", + "editor.inlineSuggest.edits.experimental.enabled": "控制是否在内联建议中启用实验性编辑。", + "editor.inlineSuggest.edits.experimental.onlyShowWhenCloseToCursor": "控制是否只在光标接近建议时显示内联建议。", + "editor.inlineSuggest.edits.experimental.useInterleavedLinesDiff": "控制是否启用内联建议中的实验性交错行差异。", + "editor.inlineSuggest.edits.experimental.useMixedLinesDiff": "控制是否在内联建议中启用实验性编辑。", + "editor.insertSpaces": "按 `Tab` 键时插入空格。当启用 `#editor.detectIndentation#`时,该设置会根据文件内容被覆盖。", + "editor.quickSuggestions": "控制在输入时是否应该自动显示建议。这可以在输入评论、字符串和其他代码时加以控制。快速建议可以被配置为显示为幽灵文本或建议小部件。还要注意'#editor.suggestOnTriggerCharacters#'设置,它控制建议是否被特殊字符触发。", + "editor.suggestFontSize": "建议 widget 的字体大小。设置为 \"0 \"时,将使用 \"#editor.fontSize#\"的值。", + "editor.suggestLineHeight": "建议 widget 的行高。设置为 \"0 \"时,将使用 \"#editor.lineHeight#\"的值。最小值为 8。", + "editor.tabSize": "制表符等于的空格数。当启用 `#editor.detectIndentation#`时,该设置会根据文件内容被覆盖。", + "formatOnSaveTimeout": "超时,以毫秒为单位,超时后文件保存时运行的格式化被取消。", + "persistClosedEditors": "控制是否为工作区持续保存关闭的编辑器历史,跨越窗口重新加载。", + "showAllEditors": "显示所有打开的编辑器", + "splitHorizontal": "水平拆分编辑器", + "splitVertical": "垂直拆分编辑器", + "toggleStickyScroll": "切换粘滞滚动" + }, + "external-terminal": { + "cwd": "为新的外部终端选择当前工作目录" + }, + "file-search": { + "toggleIgnoredFiles": "(按{0}显示/隐藏被忽略的文件)" + }, + "fileDialog": { + "showHidden": "显示隐藏的文件" + }, + "fileSystem": { + "fileResource": { + "overWriteBody": "你想覆盖文件系统中对'{0}'所做的修改吗?" + } + }, + "filesystem": { + "copiedToClipboard": "将下载链接复制到剪贴板。", + "copyDownloadLink": "复制下载链接", + "dialog": { + "initialLocation": "转到初始位置", + "multipleItemMessage": "你只能选择一个项目", + "navigateBack": "返回导航", + "navigateForward": "向前导航", + "navigateUp": "向上导航一个目录" + }, + "fileResource": { + "binaryFileQuery": "打开它可能需要一些时间,并可能使IDE没有反应。你到底要不要打开'{0}'?", + "binaryTitle": "该文件要么是二进制文件,要么使用不支持的文本编码。", + "largeFileTitle": "文件太大({0})。", + "overwriteTitle": "文件'{0}'在文件系统中被更改。" + }, + "filesExclude": "配置用于排除文件和文件夹的glob模式。例如,文件资源管理器会根据这一设置来决定显示或隐藏哪些文件和文件夹。", + "format": "格式:", + "maxConcurrentUploads": "上传多个文件时的最大并发文件数。0意味着所有文件都将被并发上传。", + "maxFileSizeMB": "控制可能打开的最大文件大小(MB)。", + "prepareDownload": "准备下载...", + "prepareDownloadLink": "准备下载链接...", + "processedOutOf": "在{1}中处理了{0}。", + "replaceTitle": "替换文件", + "uploadFailed": "上传文件时发生错误。{0}", + "uploadFiles": "上传文件...", + "uploadedOutOf": "上传了{0}出{1}。" + }, + "getting-started": { + "ai": { + "header": "Theia IDE 现已支持 AI 辅助功能(测试版)!", + "openAIChatView": "立即打开AI聊天视图,了解如何开始!" + }, + "apiComparator": "{0} API兼容性", + "newExtension": "构建一个新的扩展", + "newPlugin": "构建一个新的插件", + "startup-editor": { + "welcomePage": "打开欢迎页面,其中包含帮助开始使用{0} 和扩展程序的内容。" + }, + "telemetry": "数据使用和遥测" + }, + "git": { + "aFewSecondsAgo": "几秒钟前", + "addSignedOff": "添加 \"已签署\"。", + "added": "已添加", + "amendReuseMessage": "要重新使用最后一条提交信息,请按'Enter'或'Escape'来取消。", + "amendRewrite": "重写之前的提交信息。按'Enter'键确认或按'Escape'键取消。", + "checkoutCreateLocalBranchWithName": "创建一个新的本地分支,名称为:{0}。按'Enter'键确认或按'Escape'键取消。", + "checkoutProvideBranchName": "请提供分支机构名称。", + "checkoutSelectRef": "选择一个参考文献来结账或创建一个新的本地分支。", + "cloneQuickInputLabel": "请提供一个 Git 仓库的位置。按'Enter'键确认或按'Escape'键取消。", + "cloneRepository": "克隆 Git 仓库。{0}.按'Enter'键确认或按'Escape'键取消。", + "compareWith": "对比...", + "compareWithBranchOrTag": "挑选一个分支或标签,与当前活动的{0}分支进行比较。", + "conflicted": "冲突", + "copied": "复制的", + "diff": "差异", + "dirtyDiffLinesLimit": "如果编辑器的行数超过这个限制,则不显示肮脏的差异装饰。", + "dropStashMessage": "存储删除成功。", + "editorDecorationsEnabled": "在编辑器中显示 git 的装饰。", + "fetchPickRemote": "选择一个远程存储库抓取", + "gitDecorationsColors": "在导航器中使用颜色装饰。", + "mergeEditor": { + "currentSideTitle": "当前", + "incomingSideTitle": "传入" + }, + "mergeQuickPickPlaceholder": "挑选一个分支来合并到当前活动的{0}分支。", + "missingUserInfo": "确保你在git中配置了'user.name'和'user.email'。", + "noHistoryForError": "没有任何历史记录可用于{0}", + "noPreviousCommit": "没有以前的承诺可以修改", + "noRepositoriesSelected": "没有选择存储库。", + "prepositionIn": "在", + "renamed": "重新命名", + "repositoryNotInitialized": "存储库{0}还没有被初始化。", + "stashChanges": "储藏室的变化。按'Enter'键确认,或按'Escape'键取消。", + "stashChangesWithMessage": "储藏室的变化与信息。{0}.按'Enter'键确认或按'Escape'键取消。", + "tabTitleIndex": "{0} (索引)", + "tabTitleWorkingTree": "{0} (工作树)", + "toggleBlameAnnotations": "切换指责注释", + "unstaged": "无舞台" + }, + "keybinding-schema-updater": { + "deprecation": "使用`when`子句来代替。" + }, + "keymaps": { + "addKeybindingTitle": "为{0}", + "editKeybinding": "编辑按键绑定...", + "editKeybindingTitle": "编辑{0}的按键绑定", + "editWhenExpression": "编辑表达时...", + "editWhenExpressionTitle": "编辑{0}", + "keybinding": { + "copy": "复制绑定键", + "copyCommandId": "复制按键绑定命令 ID", + "copyCommandTitle": "复制按键绑定命令 标题", + "edit": "编辑按键绑定...", + "editWhenExpression": "编辑按键绑定时的表达式..." + }, + "keybindingCollidesValidation": "键盘绑定目前碰撞", + "requiredKeybindingValidation": "键盘绑定值是必需的", + "resetKeybindingConfirmation": "你真的想把这个按键绑定重置为默认值吗?", + "resetKeybindingTitle": "重置{0}的键盘绑定", + "resetMultipleKeybindingsWarning": "如果这个命令存在多个按键绑定,所有的按键都将被重置。" + }, + "localize": { + "offlineTooltip": "无法连接到后端。" + }, + "markers": { + "clearAll": "清除所有", + "noProblems": "到目前为止,在工作区还没有发现任何问题。", + "tabbarDecorationsEnabled": "在标签栏中显示问题装饰器(诊断标记)。" + }, + "memory-inspector": { + "addressTooltip": "要显示的内存位置,一个地址或对一个地址进行评估的表达式", + "ascii": "ASCII", + "binary": "二进制", + "byteSize": "字节大小", + "bytesPerGroup": "每组字节数", + "closeSettings": "关闭设置", + "columns": "专栏", + "command": { + "createNewMemory": "创建新的内存检查器", + "createNewRegisterView": "创建新的注册表视图", + "followPointer": "跟随指针", + "followPointerMemory": "在内存检查器中跟踪指针", + "resetValue": "重置值", + "showRegister": "在内存检查器中显示寄存器", + "viewVariable": "在内存检查器中显示变量" + }, + "data": "数据", + "decimal": "十进制", + "diff": { + "label": "差异: {0}" + }, + "diff-widget": { + "offset-label": "{0} 偏移", + "offset-title": "字节,以抵消内存从{0}" + }, + "editable": { + "apply": "应用更改", + "clear": "清晰的变化" + }, + "endianness": "内联性", + "extraColumn": "额外专栏", + "groupsPerRow": "每行的组别", + "hexadecimal": "十六进制", + "length": "长度", + "lengthTooltip": "要获取的字节数,以十进制或十六进制表示", + "memory": { + "addressField": { + "memoryReadError": "在位置栏中输入一个地址或表达式。" + }, + "freeze": "冻结内存视图", + "hideSettings": "隐藏设置面板", + "readError": { + "bounds": "超过了内存界限,结果将被截断。", + "noContents": "目前没有内存内容。" + }, + "readLength": { + "memoryReadError": "在长度字段中输入一个长度(十进制或十六进制数字)。" + }, + "showSettings": "显示设置面板", + "unfreeze": "解冻内存视图", + "userError": "获取内存时出现了错误。" + }, + "memoryCategory": "内存检查器", + "memoryInspector": "内存检查器", + "memoryTitle": "记忆", + "octal": "八进制", + "offset": "偏移", + "offsetTooltip": "在导航时,要添加到当前内存位置的偏移量。", + "provider": { + "localsError": "无法读取本地变量。没有活动的调试会话。", + "readError": "无法读取内存。没有活动的调试会话。", + "writeError": "无法写入内存。没有活动的调试会话。" + }, + "register": "注册", + "register-widget": { + "filter-placeholder": "过滤(以)开始" + }, + "registerReadError": "获取寄存器时出现了错误。", + "registers": "登记册", + "toggleComparisonWidgetVisibility": "切换比较小工具的可见性", + "utils": { + "afterBytes": "你必须在你想比较的两个部件中加载内存。{0} ,没有加载内存。", + "bytesMessage": "你必须在你想比较的两个部件中加载内存。{0} ,没有加载内存。" + } + }, + "messages": { + "notificationTimeout": "在此超时后,信息性通知将被隐藏。", + "toggleNotifications": "切换通知" + }, + "mini-browser": { + "typeUrl": "输入一个URL" + }, + "monaco": { + "noSymbolsMatching": "没有匹配的符号", + "typeToSearchForSymbols": "键入以搜索符号" + }, + "navigator": { + "autoReveal": "自动显示", + "clipboardWarn": "对剪贴板的访问被拒绝了。检查你的浏览器的权限。", + "clipboardWarnFirefox": "剪贴板API是不可用的。它可以通过'{0}'页面上的'{1}'偏好启用。然后重新加载Theia。注意,这将允许FireFox获得对系统剪贴板的完全访问。", + "openWithSystemEditor": "使用系统编辑器打开", + "refresh": "在资源管理器中刷新", + "reveal": "在资源管理器中显示", + "systemEditor": "系统编辑器", + "toggleHiddenFiles": "切换隐藏文件" + }, + "output": { + "clearOutputChannel": "清除输出通道...", + "closeOutputChannel": "关闭输出通道...", + "hiddenChannels": "隐蔽通道", + "hideOutputChannel": "隐藏输出通道...", + "maxChannelHistory": "一个输出通道中的最大条目数。", + "outputChannels": "输出通道", + "showOutputChannel": "显示输出通道..." + }, + "plugin": { + "blockNewTab": "您的浏览器阻止了新标签的打开" + }, + "plugin-dev": { + "alreadyRunning": "托管的实例已经在运行。", + "debugInstance": "调试实例", + "debugMode": "使用 inspect 或 inspect-brk 进行 Node.js 调试", + "debugPorts": { + "debugPort": "用于此服务器 Node.js 调试的端口" + }, + "devHost": "发展的主人", + "failed": "运行托管插件实例失败。{0}", + "hostedPlugin": "托管的插件", + "hostedPluginRunning": "托管的插件: 运行", + "hostedPluginStarting": "托管的插件: 开始", + "hostedPluginStopped": "托管的插件: 停止", + "hostedPluginWatching": "托管的插件: 观察", + "instanceTerminated": "{0}已被终止", + "launchOutFiles": "用于定位生成的JavaScript文件的glob模式数组(`${pluginPath}`将被插件的实际路径所取代)。", + "noValidPlugin": "指定的文件夹不包含有效的插件。", + "notRunning": "托管的实例没有运行。", + "pluginFolder": "插件文件夹被设置为。{0}", + "preventedNewTab": "您的浏览器阻止了新标签的打开", + "restartInstance": "重启实例", + "running": "托管的实例运行在。", + "selectPath": "选择路径", + "startInstance": "启动实例", + "starting": "启动托管实例服务器 ...", + "stopInstance": "停止实例", + "unknownTerminated": "该实例已被终止", + "watchMode": "在开发中的插件上运行观察器" + }, + "plugin-ext": { + "authentication-main": { + "loginTitle": "登录", + "signedOut": "已成功注销。" + }, + "plugins": "插件", + "webviewTrace": "控制与webviews的通信跟踪。", + "webviewWarnIfUnsecure": "警告用户,目前网络视图的部署是不安全的。" + }, + "preferences": { + "ai-features": "人工智能功能", + "hostedPlugin": "托管插件", + "toolbar": "工具栏" + }, + "preview": { + "openByDefault": "默认情况下,打开预览而不是编辑器。" + }, + "property-view": { + "created": "创建", + "directory": "目录", + "lastModified": "最后修改", + "location": "位置", + "noProperties": "没有可用的属性。", + "properties": "属性", + "symbolicLink": "符号链接" + }, + "remote": { + "dev-container": { + "connect": "在容器中重新打开", + "noDevcontainerFiles": "工作区中未找到 devcontainer.json 文件。请确保您的 .devcontainer 目录中有 devcontainer.json 文件。", + "selectDevcontainer": "选择 devcontainer.json 文件" + }, + "ssh": { + "connect": "将当前窗口连接到主机...", + "connectToConfigHost": "在配置文件中将当前窗口连接到主机...", + "enterHost": "输入 SSH 主机名", + "enterUser": "输入 SSH 用户名", + "failure": "无法打开与远程的 SSH 连接。", + "hostPlaceHolder": "例如:hello@example.com", + "needsHost": "请输入主机名。", + "needsUser": "请输入用户名。", + "userPlaceHolder": "例如:你好" + }, + "sshNoConfigPath": "未找到 SSH 配置路径。", + "wsl": { + "connectToWsl": "连接至 WSL", + "connectToWslUsingDistro": "使用分布式系统连接 WSL...", + "noWslDistroFound": "未找到 WSL 发行版。请先安装 WSL 发行版。", + "reopenInWsl": "在 WSL 中重新打开文件夹", + "selectWSLDistro": "选择 WSL 分配" + } + }, + "scm": { + "amend": "修改", + "amendHeadCommit": "HEAD 提交", + "amendLastCommit": "修改最后的提交", + "changeRepository": "修改存储库...", + "config.untrackedChanges": "控制未被追踪的变化的行为方式。", + "config.untrackedChanges.hidden": "隐藏的", + "config.untrackedChanges.mixed": "混合的", + "config.untrackedChanges.separate": "分开", + "dirtyDiff": { + "close": "关闭 更改 窥视" + }, + "history": "历史", + "mergeEditor": { + "resetConfirmationTitle": "您真的想在这个编辑器中重置合并结果吗?" + }, + "noRepositoryFound": "没有找到存储库", + "unamend": "撤销", + "unamendCommit": "撤销提交" + }, + "search-in-workspace": { + "includeIgnoredFiles": "包括被忽略的文件", + "noFolderSpecified": "你没有打开或指定一个文件夹。目前只搜索了打开的文件。", + "resultSubset": "这只是所有结果的一个子集。使用一个更具体的搜索词来缩小结果列表。", + "searchOnEditorModification": "修改时搜索活动的编辑器。" + }, + "secondary-window": { + "extract-widget": "将视图移至第二窗口" + }, + "shell-area": { + "secondary": "二级窗口" + }, + "task": { + "attachTask": "附加任务...", + "circularReferenceDetected": "检测到循环参考:{0} -->{1}", + "clearHistory": "清除历史", + "errorKillingTask": "杀死任务 \"{0}\"时出错:{1}", + "errorLaunchingTask": "启动任务 \"{0}\"时出错:{1}", + "invalidTaskConfigs": "发现任务配置无效。打开 tasks.json,在 \"问题 \"视图中查找详细信息。", + "neverScanTaskOutput": "从不扫描任务输出", + "noTaskToRun": "没有发现要运行的任务。配置任务...", + "noTasksFound": "未找到任务", + "notEnoughDataInDependsOn": "依赖于 \"中提供的信息不足以匹配正确的任务!", + "schema": { + "commandOptions": { + "cwd": "已执行程序或脚本的当前工作目录。如果省略,则使用 Theia 的当前工作空间根目录。" + }, + "presentation": { + "panel": { + "dedicated": "终端专用于特定任务。如果再次执行该任务,终端将被重复使用。不过,不同任务的输出会显示在不同的终端中。", + "new": "该任务的每次执行都会使用一个新的干净终端。", + "shared": "终端是共享的,其他任务运行的输出会添加到同一终端。" + }, + "showReuseMessage": "控制是否显示 \"终端将被任务重复使用 \"信息。" + }, + "problemMatcherObject": { + "owner": "Theia 内部问题的所有者。如果指定了基准,则可以省略。如果省略且未指定基准,则默认为 \"外部\"。" + } + }, + "taskAlreadyRunningInTerminal": "任务已在终端运行", + "taskExitedWithCode": "任务 '{0}' 已退出,代码为{1}.", + "taskTerminalTitle": "任务:{0}", + "taskTerminatedBySignal": "任务 \"{0}\"被信号 \"{1}\"终止。", + "terminalWillBeReusedByTasks": "任务将重复使用终端。" + }, + "terminal": { + "defaultProfile": "上使用的默认配置文件。{0}", + "enableCopy": "启用ctrl-c(macOS上为cmd-c)来复制选定的文本", + "enablePaste": "启用ctrl-v(macOS上为cmd-v)从剪贴板粘贴。", + "profileArgs": "此配置文件使用的shell参数。", + "profileColor": "终端主题颜色ID,与终端相关联。", + "profileDefault": "选择默认配置文件...", + "profileIcon": "一个与终端图标相关联的codicon ID。\nterminal-tmux:\"$(terminal-tmux)\"", + "profileNew": "新终端(含简介)...", + "profilePath": "此配置文件使用的shell的路径。", + "profiles": "创建一个新的终端时要呈现的配置文件。用可选的args手动设置路径属性。\n将现有的配置文件设置为`null'以从列表中隐藏该配置文件,例如:`\"{0}\": null`。", + "rendererType": "控制终端的渲染方式。", + "rendererTypeDeprecationMessage": "不再支持将呈现器类型作为选项。", + "selectProfile": "为新终端选择一个配置文件", + "shell.deprecated": "这已被废弃,新的推荐方法是在'terminal.integrated.profiles.{0}'中创建一个终端配置文件,并在'terminal.integrated.defaultProfile.{0}'中把它的配置文件名称设置为默认值,来配置你的默认外壳。", + "shellArgsLinux": "在Linux终端时使用的命令行参数。", + "shellArgsOsx": "在macOS终端时使用的命令行参数。", + "shellArgsWindows": "在Windows终端时使用的命令行参数。", + "shellLinux": "终端在Linux上使用的shell的路径(默认:'{0}'})。", + "shellOsx": "终端在macOS上使用的shell的路径(默认:'{0}'})。", + "shellWindows": "终端在Windows上使用的shell的路径。(默认:'{0}')。" + }, + "terminal-manager": { + "addTerminalToGroup": "将终端添加到组中", + "closeDialog": { + "message": "一旦关闭终端管理器,其布局将无法恢复。您确定要关闭终端管理器吗?", + "title": "您是否要关闭终端管理器?" + }, + "closeTerminalManager": "关闭终端管理器", + "createNewTerminalGroup": "创建新终端组", + "createNewTerminalPage": "创建新终端页面", + "deleteGroup": "删除群组", + "deletePage": "删除页面", + "deleteTerminal": "删除终端", + "group": "集团", + "label": "终端", + "maximizeBottomPanel": "最大化底部面板", + "minimizeBottomPanel": "最小化底部面板", + "openTerminalManager": "打开终端管理器", + "page": "页面", + "rename": "重命名", + "resetTerminalManagerLayout": "重置终端管理器布局", + "toggleTreeView": "切换树状视图" + }, + "test": { + "cancelAllTestRuns": "取消所有测试运行", + "stackFrameAt": "于", + "testRunDefaultName": "{0} 运行{1}", + "testRuns": "测试运行" + }, + "toolbar": { + "addCommand": "将命令添加到工具栏", + "addCommandPlaceholder": "找到一个要添加到工具栏的命令", + "centerColumn": "中央栏", + "failedUpdate": "更新'{0}'在'{1}'的值失败。", + "filterIcons": "过滤器图标", + "iconSelectDialog": "为'{0}'选择一个图标", + "iconSet": "图标集", + "insertGroupLeft": "插入组的分隔符(左)。", + "insertGroupRight": "插入群组分隔符(右)。", + "leftColumn": "左栏", + "openJSON": "自定义工具栏(打开JSON)", + "removeCommand": "从工具栏上删除命令", + "restoreDefaults": "恢复工具栏的默认值", + "rightColumn": "右栏", + "selectIcon": "选择图标", + "toggleToolbar": "切换工具栏", + "toolbarLocationPlaceholder": "你想把命令加在哪里?", + "useDefaultIcon": "使用默认图标" + }, + "typehierarchy": { + "subtypeHierarchy": "子类型层次结构", + "supertypeHierarchy": "超类型层次结构" + }, + "variableResolver": { + "listAllVariables": "变量列出所有" + }, + "vsx-registry": { + "confirmDialogMessage": "扩展名 \"{0}\" 未经验证,可能存在安全风险。", + "confirmDialogTitle": "您确定要继续安装吗?", + "downloadCount": "下载次数: {0}", + "errorFetching": "取出扩展程序时出错。", + "errorFetchingConfigurationHint": "这可能是网络配置问题造成的。", + "failedInstallingVSIX": "从VSIX安装{0} ,失败了。", + "invalidVSIX": "所选文件不是有效的 \"*.vsix \"插件。", + "license": "许可证: {0}", + "onlyShowVerifiedExtensionsDescription": "这样,{0} 只显示经过验证的扩展名。", + "onlyShowVerifiedExtensionsTitle": "只显示已验证的扩展名", + "recommendedExtensions": "建议在该工作区使用的扩展名称的列表。", + "searchPlaceholder": "在{0}中搜索扩展", + "showInstalled": "显示已安装的扩展程序", + "showRecommendedExtensions": "控制是否显示扩展建议的通知。", + "vsx-extensions-contribution": { + "update-version-uninstall-error": "删除扩展名时出错:{0}.", + "update-version-version-error": "{0} 在安装{1} 的版本时失败。" + } + }, + "webview": { + "goToReadme": "转到README", + "messageWarning": " {0}端点的主机模式已改为`{1}`;改变模式可能导致安全漏洞。 参见`{2}`以了解更多信息。" + }, + "workspace": { + "bothAreDirectories": "这两种资源都是目录。", + "clickToManageTrust": "点击管理信任设置。", + "compareWithEachOther": "互相比较", + "confirmDeletePermanently.description": "使用垃圾箱删除\"{0}\"失败。你想永久删除吗?", + "confirmDeletePermanently.solution": "你可以在偏好设置中禁用垃圾桶的使用。", + "confirmDeletePermanently.title": "删除文件时出错", + "confirmMessage.delete": "你真的想删除以下文件吗?", + "confirmMessage.dirtyMultiple": "你真的想删除{0}个有未保存的修改的文件吗?", + "confirmMessage.dirtySingle": "你真的想删除{0}与未保存的变化吗?", + "confirmMessage.uriMultiple": "你真的想删除所有{0}选中的文件吗?", + "confirmMessage.uriSingle": "你真的想删除{0}吗?", + "directoriesCannotBeCompared": "目录无法进行比较。 {0}", + "duplicate": "复制", + "failSaveAs": "无法为当前的小组件运行\"{0}\"。", + "isDirectory": "{0}''是一个目录。", + "manageTrustPlaceholder": "为该工作区选择信任状态", + "newFilePlaceholder": "文件名称", + "newFolderPlaceholder": "文件夹名称", + "noErasure": "注意:没有任何东西会从磁盘上被删除", + "notWorkspaceFile": "无效的工作区文件: {0}", + "openRecentPlaceholder": "输入你要打开的工作区的名称", + "openRecentWorkspace": "打开最近的工作区...", + "preserveWindow": "启用在当前窗口中打开工作空间。", + "removeFolder": "你确定要从工作区删除以下文件夹吗?", + "removeFolders": "你确定要从工作区删除以下文件夹吗?", + "restrictedModeDescription": "某些功能已禁用,因为此工作区不受信任。", + "restrictedModeNote": "*请注意:Theia 中的工作区信任功能目前仍在开发中;并非所有功能都已集成到工作区信任中*", + "schema": { + "folders": { + "description": "工作区中的根文件夹" + }, + "title": "工作区文件" + }, + "trashTitle": "将{0}移至垃圾箱", + "trustEmptyWindow": "控制空工作区是否被默认信任。", + "trustEnabled": "控制是否启用工作区信任。如果禁用,所有工作空间都被信任。", + "trustTrustedFolders": "无需提示即可信任的文件夹URI列表。", + "untitled-cleanup": "似乎有许多无标题的工作区文件。请检查{0}并删除任何未使用的文件。", + "variables": { + "cwd": { + "description": "任务运行器启动时的当前工作目录" + }, + "file": { + "description": "当前打开文件的路径" + }, + "fileBasename": { + "description": "当前打开文件的基名" + }, + "fileBasenameNoExtension": { + "description": "当前打开文件的名称(不含扩展名)" + }, + "fileDirname": { + "description": "当前打开文件所在目录的名称" + }, + "fileExtname": { + "description": "当前打开文件的扩展名" + }, + "relativeFile": { + "description": "当前打开文件相对于工作区根目录的路径" + }, + "relativeFileDirname": { + "description": "当前打开文件的目录名相对于 ${workspaceFolder} 的路径" + }, + "workspaceFolder": { + "description": "工作区根文件夹的路径" + }, + "workspaceFolderBasename": { + "description": "工作区根文件夹的名称" + }, + "workspaceRoot": { + "description": "工作区根文件夹的路径" + }, + "workspaceRootFolderName": { + "description": "工作区根文件夹的名称" + } + }, + "workspaceFolderAdded": "创建了一个有多个根的工作区。你想把你的工作区配置保存为一个文件吗?", + "workspaceFolderAddedTitle": "文件夹添加到工作区" + } + }, + "vsx.disabling": "禁用", + "vsx.disabling.extensions": "禁用{0}...", + "vsx.enabling": "启用", + "vsx.enabling.extension": "启用{0}..." +} diff --git a/packages/core/i18n/nls.zh-tw.json b/packages/core/i18n/nls.zh-tw.json new file mode 100644 index 0000000..d7cdda9 --- /dev/null +++ b/packages/core/i18n/nls.zh-tw.json @@ -0,0 +1,2097 @@ +{ + "ai-chat-ui.show-settings": "顯示 AI 設定", + "ai-chat:summarize-session-as-task-for-coder": "將會議總結為編碼器的任務", + "ai.executePlanWithCoder": "使用編碼器執行當前計劃", + "ai.updateTaskContext": "更新目前的任務內容", + "aiConfiguration:open": "開啟 AI 設定檢視", + "aiHistory:clear": "AI 歷史:清除歷史", + "aiHistory:open": "開啟 AI 歷史檢視", + "aiHistory:sortChronologically": "AI 歷史:依時間順序排序", + "aiHistory:sortReverseChronologically": "AI 歷史:按時間順序逆向排序", + "aiHistory:toggleCompact": "AI 歷史:切換精簡檢視", + "aiHistory:toggleHideNewlines": "AI 歷史:停止解釋換行符", + "aiHistory:toggleRaw": "AI 歷史:切換原始檢視", + "aiHistory:toggleRenderNewlines": "AI 歷史:解釋換行符", + "debug.breakpoint.editCondition": "編輯條件...", + "debug.breakpoint.removeSelected": "移除選取的斷點", + "debug.breakpoint.toggleEnabled": "切換啟用斷點", + "notebook.cell.changeToCode": "變更儲存格為代碼", + "notebook.cell.changeToMarkdown": "變更儲存格為 Markdown", + "notebook.cell.insertMarkdownCellAbove": "在上方插入 Markdown 單元格", + "notebook.cell.insertMarkdownCellBelow": "在下方插入 Markdown 單元格", + "terminal:new:profile": "從設定檔建立新的整合式終端機", + "terminal:profile:default": "選擇預設終端設定檔", + "theia": { + "ai": { + "agents": { + "completionNotification": { + "mdDescription": "此代理完成任務時的通知行為。如果未設定,則會使用全局預設通知設定。\n - `os-notification`:顯示作業系統/系統通知\n - `message`:在狀態列/訊息區顯示通知\n - `blink`:閃爍或高亮顯示使用者介面\n - `off`:停用此代理的通知", + "title": "完成通知" + }, + "enable": { + "mdDescription": "指定代理應啟用(true)還是停用(false)。", + "title": "啟用代理程式" + }, + "languageModelRequirements": { + "identifier": { + "mdDescription": "要使用的語言模型的識別碼。" + }, + "mdDescription": "指定此代理使用的語言模型。", + "purpose": { + "mdDescription": "使用此語言模型的目的。", + "title": "目的" + }, + "title": "語言模型要求" + }, + "mdDescription": "設定代理程式設定,例如啟用或停用特定代理程式、設定提示和選擇 LLM。", + "selectedVariants": { + "mdDescription": "指定此代理目前選擇的提示變異。", + "title": "精選變體" + }, + "title": "代理設定" + }, + "anthropic": { + "apiKey": { + "description": "輸入您正式 Anthropic 帳戶的 API 金鑰。**請注意:** 使用此偏好設定時,Anthropic API 金鑰會以明碼方式儲存在執行 Theia 的機器上。使用環境變數 `ANTHROPIC_API_KEY` 來安全地設定金鑰。" + }, + "models": { + "description": "正式使用的人類模型" + } + }, + "chat": { + "agent": { + "architect": "建築師", + "coder": "程式設計師", + "universal": "環球" + }, + "applySuggestion": "申請建議", + "bypassModelRequirement": { + "description": "跳過語言模型需求檢查。若您使用的是無需 Theia 語言模型的外部代理程式(例如 Claude Code),請啟用此選項。" + }, + "changeSetDefaultTitle": "建議的變更", + "changeSetFileDiffUriLabel": "AI 變更:{0}", + "chatAgentsVariable": { + "description": "傳回系統中可用的聊天代理清單" + }, + "chatSessionNamingAgent": { + "description": "產生聊天會話名稱的代理程式", + "vars": { + "conversation": { + "description": "聊天對話的內容。" + }, + "listOfSessionNames": { + "description": "現有會話名稱清單。" + } + } + }, + "chatSessionSummaryAgent": { + "description": "用於產生聊天會話摘要的代理程式。" + }, + "confirmApplySuggestion": "自本建議建立以來,檔案{0} 已經變更。您確定要套用此變更嗎?", + "confirmRevertSuggestion": "自本建議建立以來,檔案{0} 已經變更。您確定要還原變更?", + "couldNotFindMatchingLM": "無法找到匹配的語言模型。請檢查您的設定!", + "couldNotFindReadyLMforAgent": "無法找到代理{0} 的就緒語言模型。請檢查您的設定!", + "defaultAgent": { + "description": "可選: ,如果在使用者查詢中沒有使用 @ 明確提到代理,則應該啟用的聊天代理。如果沒有設定預設代理程式,則會套用 Theia 的預設值。" + }, + "imageContextVariable": { + "args": { + "data": { + "description": "以 base64 表示的影像資料。" + }, + "mimeType": { + "description": "影像的 mimetype。" + }, + "name": { + "description": "影像檔案的名稱(若有)。" + }, + "wsRelativePath": { + "description": "影像檔案的工作區相關路徑(若有)。" + } + }, + "description": "提供影像的上下文資訊", + "label": "影像檔案" + }, + "orchestrator": { + "description": "此代理會根據所有可用聊天代理的描述分析使用者的請求,並選擇最適合的代理來回答請求(透過使用 AI)。", + "vars": { + "availableChatAgents": { + "description": "協調器可以委託的聊天代理清單,不包括排除清單偏好設定中指定的代理。" + } + } + }, + "pinChatAgent": { + "description": "啟用代理釘住功能可自動讓被提及的聊天代理在各個提示中保持活動,減少重複提及的需要。您可以隨時手動取消釘住或切換代理。" + }, + "revertSuggestion": "回復建議", + "selectImageFile": "選擇影像檔案", + "sessionStorage": { + "description": "設定聊天會話的儲存位置。", + "globalPath": "全球路徑", + "pathNotUsedForScope": "不適用於 {0} 儲存範圍。", + "pathRequired": "路徑不能為空", + "pathSettings": "路徑設定", + "resetToDefault": "重設為預設值", + "scope": { + "global": "將聊天會話儲存於全域設定資料夾中。", + "workspace": "將聊天會話儲存於工作區資料夾中。" + }, + "workspacePath": "工作區路徑" + }, + "taskContextService": { + "summarizeProgressMessage": "總結:{0}", + "updatingProgressMessage": "更新:{0}" + }, + "toolConfirmation": { + "confirm": { + "description": "執行工具前請先要求確認" + }, + "disabled": { + "description": "停用工具執行" + }, + "yolo": { + "description": "自動執行工具,無須確認" + } + }, + "view": { + "label": "AI 聊天" + } + }, + "chat-ui": { + "addContextVariable": "新增上下文變數", + "agent": "代理", + "aiDisabled": "停用 AI 功能", + "applyAll": "全部應用", + "applyAllTitle": "套用所有待定變更", + "askQuestion": "提問", + "attachToContext": "將元素附加到上下文", + "cancel": "取消 (Esc)", + "chat-view-tree-widget": { + "ai": "AI", + "aiFeatureHeader": "🚀 可用的 AI 功能(Alpha 版本)!", + "featuresDisabled": "目前,所有 AI 功能都已停用!", + "generating": "生成", + "howToEnable": "如何啟用 AI 功能:", + "noRenderer": "錯誤:找不到渲染器", + "scrollToBottom": "跳至最新訊息", + "waitingForInput": "等待輸入", + "you": "您" + }, + "chatInput": { + "clearHistory": "清除輸入提示記錄", + "cycleMode": "循環聊天模式", + "nextPrompt": "下一個提示", + "previousPrompt": "上一個提示" + }, + "chatInputAriaLabel": "在此輸入您的訊息", + "chatResponses": "聊天回應", + "code-part-renderer": { + "generatedCode": "生成代碼" + }, + "collapseChangeSet": "收合變更集", + "command-part-renderer": { + "commandNotExecutable": "該指令的 id 為 \"{0}\" 但無法從聊天視窗執行。" + }, + "copyCodeBlock": "複製代碼區塊", + "couldNotSendRequestToSession": "無法傳送要求 \"{0}\" 到 session{1}", + "delegation-response-renderer": { + "prompt": { + "label": "委託提示:" + }, + "response": { + "label": "回應:" + }, + "starting": "開始代表團...", + "status": { + "canceled": "已取消", + "error": "錯誤", + "generating": "產生...", + "starting": "開始..." + } + }, + "deleteChangeSet": "刪除變更設定", + "editRequest": "編輯", + "edited": "編輯過", + "editedTooltipHint": "此提示變體已進行編輯。您可在 AI 設定視圖中重設它。", + "enterChatName": "輸入聊天名稱", + "errorChatInvocation": "聊天服務呼叫期間發生錯誤。", + "expandChangeSet": "展開變更集", + "failedToDeleteSession": "刪除聊天會話失敗", + "failedToLoadChats": "載入聊天階段失敗", + "failedToRestoreSession": "恢復聊天會話失敗", + "failedToRetry": "重試失敗訊息", + "focusInput": "聚焦聊天輸入", + "focusResponse": "焦點對話回應", + "noChatAgentsAvailable": "沒有可用的聊天代理。", + "openDiff": "開放式差分", + "openOriginalFile": "開啟原始檔案", + "performThisTask": "執行此任務。", + "persistedSession": "持續會話(點擊還原)", + "removeChat": "移除聊天", + "renameChat": "重新命名聊天", + "requestNotFoundForRetry": "未找到重試的請求", + "responseFrom": "來自 {0} 的回覆", + "selectAgentQuickPickPlaceholder": "為新會話選擇代理", + "selectChat": "選擇聊天", + "selectContextVariableQuickPickPlaceholder": "選擇要附加到訊息的上下文變數", + "selectTaskContextQuickPickItem": { + "currentlyOpen": "目前開放" + }, + "selectTaskContextQuickPickPlaceholder": "選擇要附加的工作上下文", + "selectVariableArguments": "選擇變數參數", + "send": "傳送 (輸入)", + "sessionNotFoundForRetry": "重試時未找到會話", + "text-part-renderer": { + "cantDisplay": "無法顯示回應,請檢查您的 ChatResponsePartRenderers!" + }, + "thinking-part-renderer": { + "thinking": "思考" + }, + "toolcall-part-renderer": { + "denied": "拒絕執行", + "finished": "已完成", + "rejected": "取消執行" + }, + "toolconfirmation": { + "allow-options-dropdown-tooltip": "更多允許選項", + "allow-session": "允許此聊天", + "allowed": "允許執行工具", + "alwaysAllowConfirm": "我明白了,啟用自動核准功能", + "alwaysAllowTitle": "啟用「{0}」的自動核准功能?", + "canceled": "工具執行已取消", + "denied": "拒絕執行工具", + "deny-forever": "永遠拒絕", + "deny-options-dropdown-tooltip": "更多拒絕選項", + "deny-reason-placeholder": "輸入拒絕原因...", + "deny-session": "拒絕此聊天", + "deny-with-reason": "以理據駁斥...", + "executionDenied": "工具執行遭拒絕", + "header": "確認工具執行" + }, + "unableToSummarizeCurrentSession": "無法總結當前會話。請確認摘要代理程式未停用。", + "unknown-part-renderer": { + "contentNotRestoreable": "此內容 (類型 '{0}') 無法完全還原。它可能來自不再可用的擴充套件。" + }, + "unpinAgent": "解除釘選代理", + "variantTooltip": "提示變體:{0}", + "yourMessage": "您的訊息" + }, + "claude-code": { + "agentDescription": "Anthropic 的編碼代理", + "askBeforeEdit": "編輯前請先詢問", + "changeSetTitle": "按 Claude Code 變更", + "clearCommand": { + "description": "建立新會話" + }, + "compactCommand": { + "description": "緊湊型對話,可選擇焦點指示" + }, + "completedCount": "{0}/{1} 已完成", + "configCommand": { + "description": "開啟 Claude 程式碼組態" + }, + "currentDirectory": "目前目錄", + "differentAgentRequestWarning": "之前的聊天請求是由不同的代理處理的。Claude Code 看不到其他那些訊息。", + "directory": "目錄", + "domain": "網域", + "editAutomatically": "自動編輯", + "editNumber": "編輯{0}", + "editing": "編輯", + "editsCount": "{0} 編輯", + "emptyTodoList": "並非全部可用", + "entireFile": "整個檔案", + "excludingOnePattern": "(不含 1 種圖案)", + "excludingPatterns": "(不包括{0} 圖案)", + "executedCommand": "已執行:{0}", + "failedToParseBashToolData": "解析 Bash 工具資料失敗", + "failedToParseEditToolData": "解析編輯工具資料失敗", + "failedToParseGlobToolData": "解析 Glob 工具資料失敗", + "failedToParseGrepToolData": "解析 Grep 工具資料失敗", + "failedToParseLSToolData": "解析 LS 工具資料失敗", + "failedToParseMultiEditToolData": "解析 MultiEdit 工具資料失敗", + "failedToParseReadToolData": "解析讀取工具資料失敗", + "failedToParseTodoListData": "解析待辦事項清單資料失敗", + "failedToParseWebFetchToolData": "解析 WebFetch 工具資料失敗", + "failedToParseWriteToolData": "解析寫入工具資料失敗", + "fetching": "擷取", + "fileFilter": "檔案篩選", + "filePath": "檔案路徑", + "fileType": "檔案類型", + "findMatchingFiles": "尋找目前目錄中符合 glob 模式 \"{0}\" 的檔案", + "findMatchingFilesWithPath": "尋找符合 glob 模式 \"{0}\" 內的檔案{1}", + "finding": "尋找", + "from": "來自", + "globPattern": "球狀圖", + "grepOptions": { + "caseInsensitive": "不區分大小寫", + "glob": "全球:{0}", + "headLimit": "限制:{0}", + "lineNumbers": "行數", + "linesAfter": "+{0} 之後", + "linesBefore": "+{0} 之前", + "linesContext": "±{0} 上下文", + "multiLine": "多行", + "type": "類型:{0}" + }, + "grepOutputModes": { + "content": "內容", + "count": "點算", + "filesWithMatches": "匹配的檔案" + }, + "ignoredPatterns": "被忽略的模式", + "ignoringPatterns": "忽略{0} 模式", + "initCommand": { + "description": "使用 CLAUDE.md 指南初始化專案" + }, + "itemCount": "{0} 項目", + "lineLimit": "線路限制", + "lines": "線路", + "listDirectoryContents": "列出目錄內容", + "listing": "上市", + "memoryCommand": { + "description": "編輯 CLAUDE.md 記憶體檔案" + }, + "multiEditing": "多重編輯", + "oneEdit": "1 編輯", + "oneItem": "1 項", + "oneOption": "1 個選項", + "openDirectoryTooltip": "按一下以開啟目錄", + "openFileTooltip": "按一下以在編輯器中開啟檔案", + "optionsCount": "{0} 選項", + "partial": "部分", + "pattern": "樣式", + "plan": "計劃模式", + "project": "計劃", + "projectRoot": "項目根", + "readMode": "讀取模式", + "reading": "閱讀", + "replaceAllCount": "{0} 全部取代", + "replaceAllOccurrences": "取代所有出現", + "resumeCommand": { + "description": "恢復會話" + }, + "reviewCommand": { + "description": "請求程式碼檢閱" + }, + "searchPath": "搜尋路徑", + "searching": "搜尋", + "startingLine": "起跑線", + "timeout": "超時", + "timeoutInMs": "逾時:{0}ms", + "to": "至", + "todoList": "待辦事項清單", + "todoPriority": { + "high": "高", + "low": "低", + "medium": "中型" + }, + "toolApprovalRequest": "Claude Code 想要使用 \"{0}\" 工具。您要允許嗎?", + "totalEdits": "編輯總數", + "webFetch": "網頁擷取", + "writing": "寫作" + }, + "code-completion": { + "progressText": "計算 AI 代碼完成度..." + }, + "codex": { + "agentDescription": "由Codex驅動的OpenAI程式設計助理", + "completedCount": "{0}/{1} 已完成", + "exitCode": "退出代碼: {0}", + "fileChangeFailed": "Codex 未能為以下項目套用變更: {0}", + "fileChangeFailedGeneric": "Codex 未能套用檔案變更。", + "itemCount": "{0} 項目", + "noItems": "無項目", + "oneItem": "1項", + "running": "正在執行...", + "searched": "搜尋", + "searching": "搜尋", + "todoList": "待辦事項清單", + "webSearch": "網頁搜尋" + }, + "completion": { + "agent": { + "description": "此代理可在 Theia IDE 的程式碼編輯器中提供內嵌程式碼補齊功能。", + "vars": { + "file": { + "description": "被編輯檔案的 URI" + }, + "language": { + "description": "編輯中檔案的語言 ID" + }, + "prefix": { + "description": "目前游標位置前的程式碼" + }, + "suffix": { + "description": "目前游標位置之後的程式碼" + } + } + }, + "automaticEnable": { + "description": "在任何 (Monaco) 編輯器中編輯時,自動在線上觸發 AI 完成。 \n 另外,您也可以透過指令「Trigger Inline Suggestion」或預設捷徑「Ctrl+Alt+Space」手動觸發程式碼。" + }, + "cacheCapacity": { + "description": "要儲存在快取記憶體中的最大程式碼完成次數。較高的數字可以改善效能,但會消耗較多記憶體。 最小值為 10,建議範圍在 50-200 之間。", + "title": "程式碼完成快取記憶體容量" + }, + "debounceDelay": { + "description": "控制在編輯器偵測到變更後,觸發 AI 完成之前的延遲(以毫秒為單位)。 需要啟用「自動完成程式碼」。輸入 0 可停用去抖延遲。", + "title": "去抖延遲" + }, + "excludedFileExts": { + "description": "指定應停用 AI 補齊的檔案副檔名(例如 .md、.txt)。", + "title": "排除的檔案副檔名" + }, + "fileVariable": { + "description": "正在編輯的檔案的 URI。僅在程式碼完成上下文中可用。" + }, + "languageVariable": { + "description": "正在編輯的檔案的 languageId。僅在程式碼完成上下文中可用。" + }, + "maxContextLines": { + "description": "用作上下文的最大行數,分佈在游標位置之前和之後的行(前後綴)。 將此設定為 -1 表示使用整個檔案作為上下文,沒有任何行數限制;設為 0 表示只使用目前的行數。", + "title": "最大上下文行數" + }, + "prefixVariable": { + "description": "目前游標位置之前的程式碼。僅在代碼完成上下文中可用。" + }, + "stripBackticks": { + "description": "從某些 LLM 傳回的代碼中移除周圍的反撇號。如果偵測到一個 backtick,則結束 backtick 之後的所有內容也會被移除。當語言模型使用類似 markdown 的格式時,此設定有助於確保傳回純碼。", + "title": "從 Inline Completions 刪除 Backticks" + }, + "suffixVariable": { + "description": "目前游標位置後的程式碼。僅在代碼完成上下文中可用。" + } + }, + "configuration": { + "selectItem": "請選擇一項。" + }, + "copilot": { + "auth": { + "aiConfiguration": "AI 配置", + "authorize": "我已授權", + "copied": "已複製!", + "copyCode": "複製程式碼", + "expired": "授權已過期或被拒絕。請重新嘗試。", + "hint": "輸入代碼並完成授權後,請點擊下方「我已授權」。", + "initiating": "正在啟動驗證...", + "instructions": "若要授權 Theia 使用 GitHub Copilot,請造訪以下網址並輸入代碼:", + "openGitHub": "開啟 GitHub", + "success": "已成功登入 GitHub Copilot!", + "successHint": "若您的 GitHub 帳戶已啟用 Copilot 功能,現在即可在 ", + "title": "登入 GitHub Copilot", + "tos": "登入即表示您同意 ", + "tosLink": "GitHub 服務條款", + "verifying": "驗證授權中..." + }, + "category": "副駕駛", + "commands": { + "signIn": "登入 GitHub Copilot", + "signOut": "登出 GitHub Copilot" + }, + "enterpriseUrl": { + "mdDescription": "Copilot API 的 GitHub Enterprise 網域(例如 `github.mycompany.com`)。若使用 GitHub.com,請留空。" + }, + "models": { + "description": "GitHub Copilot 可用的模型。可用模型取決於您的 Copilot 訂閱方案。" + }, + "statusBar": { + "signedIn": "已以 {0} 身分登入 GitHub Copilot。點擊以登出。", + "signedOut": "尚未登入 GitHub Copilot。點擊登入。" + } + }, + "core": { + "agentConfiguration": { + "actions": "行動", + "addCustomAgent": "新增自訂代理", + "enableAgent": "啟用代理程式", + "label": "代理商", + "llmRequirements": "法學碩士學位要求", + "notUsedInPrompt": "未用於提示", + "promptTemplates": "提示範本", + "selectAgentMessage": "請先選擇代理!", + "templateName": "範本", + "undeclared": "未申報", + "usedAgentSpecificVariables": "已使用的代理程式專屬變數", + "usedFunctions": "已使用函數", + "usedGlobalVariables": "已使用的全域變數", + "variant": "變體" + }, + "agentsVariable": { + "description": "傳回系統中可用的代理清單" + }, + "aiConfiguration": { + "label": "✨ AI 配置 [Alpha]" + }, + "blinkTitle": { + "agentCompleted": "Theia - 代理已完成", + "namedAgentCompleted": "Theia - Agent \"{0}\" 已完成" + }, + "changeSetSummaryVariable": { + "description": "提供變更集中檔案及其內容的摘要。" + }, + "contextDetailsVariable": { + "description": "提供所有上下文元素的完整文字值和說明。" + }, + "contextSummaryVariable": { + "description": "描述特定會話上下文中的檔案。" + }, + "customAgentTemplate": { + "description": "這是一個代理範例。請根據您的需求調整屬性。" + }, + "defaultModelAliases": { + "code": { + "description": "針對程式碼理解與產生任務進行最佳化。" + }, + "code-completion": { + "description": "最適合程式碼自動完成的情況。" + }, + "summarize": { + "description": "優先摘要和濃縮內容的模型。" + }, + "universal": { + "description": "對於程式碼和一般語言的使用都有很好的平衡。" + } + }, + "defaultNotification": { + "mdDescription": "AI 代理完成任務時使用的預設通知方式。個別代理可以覆寫此設定。\n - `OS-notification`:顯示作業系統/系統通知\n - `message`:在狀態列/訊息區顯示通知\n - `blink`:閃爍或高亮顯示使用者介面\n - `off`:停用所有通知", + "title": "預設通知類型" + }, + "discard": { + "label": "丟棄 AI 提示範本" + }, + "discardCustomPrompt": { + "tooltip": "捨棄客製化" + }, + "fileVariable": { + "description": "解析檔案內容", + "uri": { + "description": "請求檔案的 URI。" + } + }, + "languageModelRenderer": { + "alias": "[別名]{0}", + "languageModel": "語言模式", + "purpose": "目的" + }, + "maxRetries": { + "mdDescription": "當向 AI 提供者的請求失敗時,重試的最大次數。值為 0 表示沒有重試。", + "title": "最大重試次數" + }, + "modelAliasesConfiguration": { + "agents": "使用此別名的代理", + "defaultList": "[預設清單]", + "evaluatesTo": "評估為", + "label": "型號別名", + "modelNotReadyTooltip": "尚未準備好", + "modelReadyTooltip": "準備就緒", + "noAgents": "沒有代理商使用這個別名。", + "noModelReadyTooltip": "沒有準備好模型", + "noResolvedModel": "這個別名沒有準備好模型。", + "priorityList": "優先清單", + "selectAlias": "請選擇型號別名。", + "selectedModelId": "選用型號", + "unavailableModel": "所選機型已停產" + }, + "noVariableFoundForOpenRequest": "未找到開啟請求的變數。", + "openEditorsShortVariable": { + "description": "所有目前開啟檔案的簡短參考 (相對路徑,以逗號分隔)" + }, + "openEditorsVariable": { + "description": "以逗號分隔的所有目前開啟的檔案清單,相對於工作區根。" + }, + "preference": { + "languageModelAliases": { + "description": "在 [AI Configuration View]({0}) 中為每個語言模型別名設定模型。另外,您也可以在 settings.json 中手動設定: \n```\n\"default/code\":{\n \"selectedModel\":\"anthropic/claude-opus-4-20250514\"\n}\n```", + "selectedModel": "使用者為此別名選擇的模型。", + "title": "語言模型別名" + } + }, + "prefs": { + "title": "✨ AI 功能 [Alpha]" + }, + "promptFragmentsConfiguration": { + "activeCustomizationTitle": "主動客製化", + "createCustomizationTitle": "建立自訂", + "customization": "客製化", + "customizationLabel": "客製化", + "defaultVariantTitle": "預設變體", + "deleteCustomizationTitle": "刪除自訂", + "editTemplateTitle": "編輯範本", + "headerTitle": "提示片段", + "label": "提示片段", + "noFragmentsAvailable": "沒有提示片段可用。", + "otherPromptFragmentsHeader": "其他提示片段", + "promptTemplateText": "提示範本文字", + "promptVariantsHeader": "提示變體套裝", + "removeCustomizationDialogMsg": "您確定要移除{0} 自訂提示片段 \"{1}\"?", + "removeCustomizationDialogTitle": "移除自訂", + "removeCustomizationWithDescDialogMsg": "您確定要移除{0} 自訂提示片段 \"{1}\" ({2})?", + "resetAllButton": "全部重設", + "resetAllCustomizationsDialogMsg": "您確定要將所有提示片段重設為內建版本嗎?這會移除所有自訂。", + "resetAllCustomizationsDialogTitle": "重設所有自訂", + "resetAllCustomizationsTitle": "重設所有自訂", + "resetAllPromptFragments": "重設所有提示片段", + "resetToBuiltInDialogMsg": "您確定要將提示片段 \"{0}\" 重設為內建版本嗎?這將移除所有自訂。", + "resetToBuiltInDialogTitle": "重設為內建", + "resetToBuiltInTitle": "重設為此內建", + "resetToCustomizationDialogMsg": "您確定要重設提示片段 \"{0}\" 以使用{1} 自訂功能嗎?這將移除所有優先順序較高的客製化。", + "resetToCustomizationDialogTitle": "重設為自訂", + "resetToCustomizationTitle": "重設為此自訂", + "selectedVariantLabel": "精選", + "selectedVariantTitle": "精選變體", + "usedByAgentTitle": "由代理使用:{0}", + "variantSetError": "所選變體不存在,也找不到預設值。請檢查您的設定。", + "variantSetWarning": "所選變體不存在。目前使用預設變體。", + "variantsOfSystemPrompt": "此提示變數集的變數:" + }, + "promptTemplates": { + "description": "儲存自訂提示範本的資料夾。如果未自訂,則使用使用者設定目錄。請考慮使用受版本控制的資料夾,以管理提示範本的變體。", + "openLabel": "選擇資料夾" + }, + "promptVariable": { + "argDescription": "要解析的提示範本 ID", + "completions": { + "detail": { + "builtin": "內建提示片段", + "custom": "自訂提示片段" + } + }, + "description": "透過提示服務解決提示範本" + }, + "prompts": { + "category": "Theia AI 提示範本" + }, + "requestSettings": { + "clientSettings": { + "description": "用戶端設定如何處理傳回 llm 的訊息。", + "keepThinking": { + "description": "如果設定為 false,則在多輪會話中傳送下一個使用者請求之前,會先篩選所有思考輸出。" + }, + "keepToolCalls": { + "description": "如果設定為 false,所有工具請求與工具回應都會先經過篩選,然後才會在多回合對話中傳送下一個使用者請求。" + } + }, + "mdDescription": "允許為多個模型指定自訂請求設定。\n 每個物件代表特定模型的設定。`modelId` 欄位指定模型 ID,`requestSettings` 定義特定於模型的設定。\n 提供者 ID ` 欄位是可選的,可讓您將設定套用到特定的提供者。如果未設定,設定將應用於所有提供者。\n 範例 providerId:huggingface、openai、ollama、llamafile。\n 如需詳細資訊,請參閱 [我們的說明文件](https://theia-ide.org/docs/user_ai/#custom-request-settings)。", + "modelSpecificSettings": { + "description": "特定機型 ID 的設定。" + }, + "scope": { + "agentId": { + "description": "要套用設定的代理 ID(可選)。" + }, + "modelId": { + "description": "模型 ID(可選" + }, + "providerId": { + "description": "要套用設定的提供者 ID(可選)。" + } + }, + "title": "自訂請求設定" + }, + "skillsVariable": { + "description": "返回可供人工智慧代理使用的可用技能清單" + }, + "taskContextSummary": { + "description": "解決會話上下文中存在的所有任務上下文項目。" + }, + "templateSettings": { + "edited": "編輯過", + "unavailableVariant": "選取的變體不再可用" + }, + "todayVariable": { + "description": "為今天做些什麼", + "format": { + "description": "日期的格式" + } + }, + "unableToDisplayVariableValue": "無法顯示變數值。", + "unableToResolveVariable": "無法解析變數。", + "variable-contribution": { + "builtInVariable": "Theia 內建變數器", + "currentAbsoluteFilePath": "目前開啟檔案的絕對路徑。請注意,大多數代理程式會期望使用相對檔案路徑 (相對於目前工作區)。", + "currentFileContent": "目前開啟的檔案的原始內容。這不包括內容來自何處的資訊。請注意,大多數代理程式使用相對檔案路徑 (相對於目前工作區) 效果會更好。", + "currentRelativeDirPath": "包含目前開啟檔案的目錄的相對路徑。", + "currentRelativeFilePath": "目前開啟檔案的相對路徑。", + "currentSelectedText": "目前在開啟的檔案中選擇的純文字。這不包括內容來自何處的資訊。請注意,大多數代理程式使用相對檔案路徑 (相對於目前工作區) 效果會更好。", + "dotRelativePath": "目前開啟檔案的相對路徑的簡短參考 ('currentRelativeFilePath')。" + } + }, + "editor": { + "editorContextVariable": { + "description": "解決編輯器特定的上下文資訊", + "label": "編輯內容" + }, + "explainWithAI": { + "prompt": "解釋此錯誤", + "title": "以 AI 解釋" + }, + "fixWithAI": { + "prompt": "協助修復此錯誤" + } + }, + "google": { + "apiKey": { + "description": "輸入您官方 Google AI (Gemini) 帳戶的 API 金鑰。**請注意:** 使用此偏好設定時,GOOGLE AI API 金鑰會以明碼儲存於執行 Theia 的機器上。請使用環境變數 `GOOGLE_API_KEY` 來安全地設定金鑰。" + }, + "maxRetriesOnErrors": { + "description": "發生錯誤時的最大重試次數。如果小於 1,則會停用重試邏輯。" + }, + "models": { + "description": "使用的官方 Google 雙子星模型" + }, + "retryDelayOnOtherErrors": { + "description": "發生其他錯誤時,重試之間的延遲(以秒為單位)(有時 Google GenAI 會報告錯誤,例如從模型傳回的 JSON 語法不完整或 500 Internal Server Error)。將此設定為 -1 可防止這些情況下的重試。否則重試會立即發生 (如果設定為 0) 或在以秒為單位的延遲之後發生 (如果設定為正數)。" + }, + "retryDelayOnRateLimitError": { + "description": "發生速率限制錯誤時,重試之間的延遲 (秒)。請參閱 https://ai.google.dev/gemini-api/docs/rate-limits" + } + }, + "history": { + "clear": { + "tooltip": "清除所有代理的歷史記錄" + }, + "exchange-card": { + "agentId": "代理", + "timestamp": "開始" + }, + "open-history-tooltip": "開啟 AI 歷史...", + "request-card": { + "agent": "代理", + "model": "型號", + "request": "請求", + "response": "回應", + "timestamp": "時間戳記", + "title": "請求" + }, + "sortChronologically": { + "tooltip": "依時間順序排序" + }, + "sortReverseChronologically": { + "tooltip": "按時間倒序排序" + }, + "toggleCompact": { + "tooltip": "顯示精簡的檢視" + }, + "toggleHideNewlines": { + "tooltip": "停止解釋換行" + }, + "toggleRaw": { + "tooltip": "顯示原始檢視" + }, + "toggleRenderNewlines": { + "tooltip": "解釋換行符" + }, + "view": { + "label": "✨ AI 代理歷史 [Alpha]", + "noAgent": "無代理。", + "noAgentSelected": "未選擇代理。", + "noHistoryForAgent": "所選代理無可用歷史記錄 '{0}'" + } + }, + "huggingFace": { + "apiKey": { + "mdDescription": "輸入 Hugging Face 帳戶的 API 金鑰。**請注意:** 使用此偏好設定,Hugging Face API 金鑰會以明碼儲存於執行 Theia 的機器上。使用環境變數 `HUGGINGFACE_API_KEY` 來安全地設定金鑰。" + }, + "models": { + "mdDescription": "可使用的 Hugging Face 模型。**請注意:**目前僅支援具備聊天完成 API 的模型(例如 `*-Instruct` 系列的指令調優模型)。部分模型可能需要在 Hugging Face 網站上接受授權條款。" + } + }, + "ide": { + "agent-description": "在 [AI Configuration View]({0}) 中設定 AI 代理程式設定,包括啟用、LLM 選擇、提示範本自訂及自訂代理程式建立。", + "agentConfiguration": { + "customAgentLocationQuickPick": { + "createNewFile": "建立新檔案", + "openExistingFile": "開啟現有檔案", + "placeholder": "選擇建立或開啟自訂代理檔案的位置", + "title": "選擇自訂代理檔案的位置" + }, + "noDescription": "無可用描述" + }, + "app-tester": { + "errorCheckingDevToolsServerStatus": "檢查開發人員工具 MCP 伺服器狀態時發生錯誤:{0}", + "errorCheckingPlaywrightServerStatus": "檢查 Playwright MCP 伺服器狀態出錯:{0}", + "startChromeDevToolsMcpServers": { + "canceled": "請設定 Chrome 開發人員工具 MCP 伺服器。", + "error": "無法啟動 Chrome DevTools MCP 伺服器:{0}", + "progress": "啟動 Chrome 開發人員工具 MCP 伺服器。", + "question": "Chrome 開發人員工具 MCP 伺服器未執行中。是否要現在啟動它?此操作可能會安裝 Chrome 開發人員工具 MCP 伺服器。" + }, + "startMcpServers": { + "no": "不,取消", + "yes": "是的,啟動伺服器" + }, + "startPlaywrightServers": { + "canceled": "請設定 MCP 伺服器。", + "error": "啟動 Playwright MCP 伺服器失敗:{0}", + "progress": "啟動 Playwright MCP 伺服器。", + "question": "Playwright MCP 伺服器尚未執行。現在要啟動它們嗎?這可能會安裝 Playwright MCP 伺服器。" + } + }, + "architectAgent": { + "mode": { + "default": "預設模式", + "plan": "模式圖", + "simple": "簡易模式" + }, + "suggestion": { + "executePlanWithCoder": "使用 Coder 執行「{0}」", + "summarizeSessionAsTaskForCoder": "將這場會議總結為 Coder 的任務", + "updateTaskContext": "更新目前的任務上下文" + } + }, + "bypassHint": "某些代理程式(如克勞德代碼)無需使用泰亞語言模型", + "chatDisabledMessage": { + "featuresTitle": "目前支援的檢視模式與功能:" + }, + "coderAgent": { + "mode": { + "agentNext": "代理模式(下)", + "edit": "編輯模式" + }, + "suggestion": { + "fixProblems": { + "content": "[Fix problems]({0}) 在目前的檔案中。", + "prompt": "請查看{1} 並修正任何問題。" + }, + "startNewChat": "保持聊天簡短且重點突出。[Start a new chat]({0}) for a new task or [start a new chat with a summary of this one]({1})。" + } + }, + "commandAgent": { + "commandCallback": { + "confirmAction": "知道了", + "label": "AI 指令" + }, + "response": { + "customHandler": "試著執行這個:", + "noCommand": "抱歉,我找不到這樣的指令", + "theiaCommand": "我發現這個指令可能對您有幫助:" + }, + "vars": { + "commandIds": { + "description": "Theia 中可用的指令清單。" + } + } + }, + "configureAgent": { + "header": "設定預設代理程式" + }, + "continueAnyway": "繼續下去", + "createSkillAgent": { + "mode": { + "edit": "預設模式" + } + }, + "enableAI": { + "mdDescription": "❗ 此設定可讓您存取最新的 AI 功能 (Beta 版本)。 \n 請注意,這些功能正處於測試階段,這表示它們可能會發生變更,並會進一步改善。請務必注意,這些功能可能會對您提供存取權限的語言模型 (LLM) 產生持續請求。這可能會產生您需要密切監控的費用。啟用此選項即表示您承認這些風險。 \n **請注意!本節下方的設定僅在主要功能設定啟用後生效。\n 啟用主要功能設定後才會生效。啟用該功能後,您需要在下方設定至少一個 LLM 提供者。另請參閱 [說明文件](https://theia-ide.org/docs/user_ai/)**。" + }, + "github": { + "configureGitHubServer": { + "canceled": "GitHub 伺服器設定取消。請設定 GitHub MCP 伺服器以使用此代理程式。", + "no": "不,取消", + "yes": "是,設定 GitHub 伺服器" + }, + "errorCheckingGitHubServerStatus": "檢查 GitHub MCP 伺服器狀態出錯:{0}", + "startGitHubServer": { + "canceled": "請啟動 GitHub MCP 伺服器以使用此代理程式。", + "error": "啟動 GitHub MCP 伺服器失敗:{0}", + "no": "不,取消", + "progress": "啟動 GitHub MCP 伺服器。", + "question": "GitHub MCP 伺服器已設定,但尚未執行。現在要啟動嗎?", + "yes": "是,啟動伺服器" + } + }, + "githubRepoName": { + "description": "目前 GitHub 儲存庫的名稱 (例如:「eclipse-theia/theia」)" + }, + "model-selection-description": "在 [AI Configuration View]({0}) 中選擇每個 AI 代理使用哪些大型語言模型 (LLM)。", + "moreAgentsAvailable": { + "header": "更多代理人可供選擇" + }, + "noRecommendedAgents": "沒有可用的推薦代理商。", + "openSettings": "開啟 AI 設定", + "or": "或", + "orchestrator": { + "error": { + "noAgents": "沒有聊天代理可處理請求。請檢查您的設定是否有啟用任何聊天代理。" + }, + "progressMessage": "確定最合適的代理", + "response": { + "delegatingToAgent": "委託給 `@{0}`" + } + }, + "prompt-template-description": "在 [AI 配置檢視]({0}) 中選擇 AI 代理的提示變體和自訂提示範本。", + "recommendedAgents": "推薦代理商:", + "skillsConfiguration": { + "label": "技能", + "location": { + "label": "位置" + } + }, + "toolsConfiguration": { + "confirmAlwaysAllow": { + "confirm": "我明白了,啟用自動核准功能", + "title": "啟用「{0}」的自動核准功能?" + }, + "confirmationMode": { + "label": "確認模式" + }, + "default": { + "label": "Default Tool Confirmation Mode(預設工具確認模式):" + }, + "resetAll": "全部重設", + "resetAllConfirmDialog": { + "msg": "您確定要將所有工具確認模式重設為預設值?這會移除所有自訂設定。", + "title": "重設所有工具確認模式" + }, + "resetAllTooltip": "將所有工具重設為預設值", + "toolOptions": { + "confirm": { + "label": "確認" + } + } + }, + "variableConfiguration": { + "selectVariable": "請選擇一個變數。", + "usedByAgents": "經紀人使用", + "variableArgs": "變數參數" + } + }, + "llamaFile": { + "prefs": { + "mdDescription": "此設定可讓您在 Theia IDE 中設定和管理 LlamaFile 模型。 \n 每個項目都需要一個使用者友善的 `name `、指向您的 LlamaFile 的檔案 `uri `,以及執行的 `port `。 \n 要啟動 LlamaFile,請使用「Start LlamaFile」指令,您就可以選擇想要的模型。 \n 如果您編輯一個項目 (例如,變更連接埠),任何正在執行的範例都會停止,您需要重新手動啟動它。 \n [在 Theia IDE 文件中瞭解更多關於設定和管理 LlamaFiles 的資訊](https://theia-ide.org/docs/user_ai/#llamafile-models)。", + "name": { + "description": "此 Llamafile 使用的模型名稱。" + }, + "port": { + "description": "用來啟動伺服器的連接埠。" + }, + "title": "✨ AI LlamaFile", + "uri": { + "description": "Llamafile 的檔案 uri。" + } + }, + "start": "啟動 Llamafile", + "stop": "停止 Llamafile" + }, + "llamafile": { + "error": { + "noConfigured": "未設定 Llamafiles。", + "noRunning": "沒有 Llamafiles 正在運行。", + "startFailed": "在啟動 llamafile 時出了問題:{0} 。\n如需詳細資訊,請參閱控制台。", + "stopFailed": "在停止 llamafile 的過程中出了問題:{0} 。\n如需詳細資訊,請參閱控制台。" + } + }, + "mcp": { + "error": { + "allServersRunning": "所有 MCP 伺服器都已執行。", + "noRunningServers": "沒有執行 MCP 伺服器。", + "noServersConfigured": "未設定 MCP 伺服器。", + "startFailed": "啟動 MCP 伺服器時發生錯誤。" + }, + "info": { + "serverStarted": "MCP 伺服器 \"{0}\" 成功啟動。註冊工具:{1}" + }, + "servers": { + "args": { + "mdDescription": "要傳給指令的參數陣列。", + "title": "指令的參數" + }, + "autostart": { + "mdDescription": "前端啟動時自動啟動此伺服器。新加入的伺服器不會立即自動啟動,但會在重新啟動時自動啟動。", + "title": "自動啟動" + }, + "command": { + "mdDescription": "用於啟動 MCP 伺服器的指令,例如 \"uvx「 或 」npx\"。", + "title": "執行 MCP 伺服器的指令" + }, + "env": { + "mdDescription": "要為伺服器設定的可選環境變數,例如 API 金鑰。", + "title": "環境變數" + }, + "headers": { + "mdDescription": "每次向伺服器請求時包含的選用附加標頭。", + "title": "標題" + }, + "mdDescription": "設定 MCP 伺服器的指令、參數、可選的環境變數,以及自動啟動 (預設為 true)。每個伺服器都以獨特的關鍵來識別,例如「brave-search」或「filesystem」。要啟動伺服器,請使用「MCP: Start MCP Server」指令,此指令可讓您選擇所需的伺服器。要停止伺服器,請使用「MCP: Stop MCP Server」指令。請注意,自動啟動只會在重新啟動後生效,您需要首次手動啟動伺服器。\n配置範例:\n```{\n \"brave-search\":{\n \"command\":\"npx\"、\n \"args\":[\n \"-y\",\n \"@modelcontextprotocol/server-brave-search\"\n ],\n \"env\":{\n \"brave_api_key\":\"YOUR_API_KEY\"\n },\n },\n \"filesystem\":{\n \"command\":\"npx\"、\n \"args\":[\"-y\", \"@modelcontextprotocol/server-filesystem\", \"/Users/YOUR_USERNAME/Desktop\"]、\n \"env\":{\n \"custom_env_var\":「自訂值」\n },\n \"autostart\": false\n }\n}\n```", + "serverAuthToken": { + "mdDescription": "伺服器的驗證標記 (如果需要)。用於與遠端伺服器驗證。", + "title": "驗證令牌" + }, + "serverAuthTokenHeader": { + "mdDescription": "伺服器驗證標記使用的標頭名稱。如果未提供,則會使用帶有 \"Bearer 「的 」Authorization\"。", + "title": "驗證標頭名稱" + }, + "serverUrl": { + "mdDescription": "遠端 MCP 伺服器的 URL。如果提供,伺服器將連線到此 URL,而不是啟動本機處理程序。", + "title": "伺服器 URL" + }, + "title": "MCP 伺服器組態" + }, + "start": { + "label": "MCP:啟動 MCP 伺服器" + }, + "stop": { + "label": "MCP:停止 MCP 伺服器" + } + }, + "mcpConfiguration": { + "arguments": "論據: ", + "autostart": "自動啟動: ", + "connectServer": "連線", + "connectingServer": "正在連接...", + "copiedAllList": "複製所有工具到剪貼簿 (所有工具清單)", + "copiedAllSingle": "將所有工具複製到剪貼簿(包含所有工具的單一提示片段)", + "copiedForPromptTemplate": "為提示範本複製所有工具至剪貼簿 (包含所有工具的單一提示片段)", + "copyAllList": "全部複製(所有工具的清單)", + "copyAllSingle": "複製所有聊天內容(使用所有工具的單一提示片段)", + "copyForPrompt": "複製工具(用於聊天或提示範本)", + "copyForPromptTemplate": "全部複製為提示範本 (使用所有工具的單一提示片段)", + "environmentVariables": "環境變數: ", + "headers": "標頭: ", + "noServers": "未設定 MCP 伺服器", + "serverAuthToken": "驗證令牌: ", + "serverAuthTokenHeader": "驗證標頭名稱: ", + "serverUrl": "伺服器 URL: ", + "tools": "工具: " + }, + "openai": { + "apiKey": { + "mdDescription": "輸入您官方 OpenAI 帳戶的 API 金鑰。**請注意:** 使用此偏好設定時,Open AI API 金鑰會以明確文字儲存於執行 Theia 的機器上。使用環境變數 `OPENAI_API_KEY` 來安全地設定金鑰。" + }, + "customEndpoints": { + "apiKey": { + "title": "存取在給定網址上提供的 API 的金鑰,或是使用全局 OpenAI API 金鑰的 `true" + }, + "apiVersion": { + "title": "在 Azure 中存取指定網址所提供 API 的版本,或是使用全域 OpenAI API 版本的 `true" + }, + "deployment": { + "title": "存取在 Azure 中指定網址所提供 API 的部署名稱" + }, + "developerMessageSettings": { + "title": "控制系統訊息的處理:`user`、`system`和`developer`將作為一個角色,`mergeWithFollowingUserMessage`會在接下來的使用者訊息前加上系統訊息的前綴,如果接下來的訊息不是使用者訊息,則會將系統訊息轉換為使用者訊息。 `skip` 會直接移除系統訊息),預設為 `developer`。" + }, + "enableStreaming": { + "title": "表示是否要使用串流 API。預設為 `true`。" + }, + "id": { + "title": "用戶介面中用來識別自訂模型的唯一識別碼" + }, + "mdDescription": "整合與 OpenAI API 相容的自訂模型,例如透過 `vllm`。所需的屬性為 `model` 和 `url`。 \n 您可以選擇 \n - 指定一個唯一的 `id` 以在使用者介面中識別自訂模型。如果沒有指定,`model` 將會被用作 `id`。 \n - 提供一個 `apiKey` 來存取在給定的 url 上提供的 API。使用 `true` 表示使用全局 OpenAI API key。 \n - 提供一個 `apiVersion` 來存取 Azure 在給定的 url 上提供的 API。使用 `true` 表示使用全局 OpenAI API 版本。 \n - 將 `developerMessageSettings` 設定為 `user`、`system`、`developer`、`mergeWithFollowingUserMessage` 或 `skip` 之一,以控制開發人員訊息的包含方式 (其中 `user`、`system` 和 `developer` 將作為角色使用,`mergeWithFollowingUserMessage` 會在接下來的使用者訊息前加上系統訊息,或在接下來的訊息不是使用者訊息時,將系統訊息轉換為使用者訊息。`skip` 只會移除系統訊息)。 預設為 `developer`。 \n - 指定 `supportsStructuredOutput: false` 表示不使用結構化輸出。 \n - 指定 `enableStreaming: false` 表示不使用串流。 \n 更多資訊請參閱 [我們的文件](https://theia-ide.org/docs/user_ai/#openai-compatible-models-eg-via-vllm)。", + "modelId": { + "title": "型號 ID" + }, + "supportsStructuredOutput": { + "title": "表示模型是否支援結構化輸出。預設為 `true`。" + }, + "url": { + "title": "模型所在的 Open AI API 相容端點" + } + }, + "models": { + "description": "使用的官方 OpenAI 模型" + }, + "useResponseApi": { + "mdDescription": "對官方 OpenAI 模型使用較新的 OpenAI 回應 API,而非聊天完成 API。此設定僅適用於官方 OpenAI 模型 - 自訂提供者必須個別設定。" + } + }, + "promptTemplates": { + "directories": { + "title": "特定工作區的提示範本目錄" + }, + "extensions": { + "description": "提示位置中被視為提示範本的附加檔案副檔名清單。.prompttemplate'總是被視為預設值。", + "title": "其他提示範本檔案副檔名" + }, + "files": { + "title": "特定工作區的提示範本檔案" + } + }, + "scanoss": { + "changeSet": { + "clean": "無匹配", + "error": "錯誤:重新執行", + "error-notification": "遇到 ScanOSS 錯誤:{0} 。", + "match": "檢視匹配", + "scan": "掃描", + "scanning": "掃描..." + }, + "mode": { + "automatic": { + "description": "啟用自動掃描聊天檢視中的程式碼片段。" + }, + "description": "設定 SCANOSS 功能以分析聊天檢視中的程式碼片段。這會將建議的程式碼片段的雜湊值傳送至 SCANOSS\n服務進行分析。", + "manual": { + "description": "使用者可以在聊天檢視中按一下 SCANOSS 項目,手動觸發掃描。" + }, + "off": { + "description": "功能完全關閉。" + } + }, + "snippet": { + "dialog-header": "ScanOSS 結果", + "errored": "SCANOSS - 錯誤 -{0}", + "file-name-heading": "在{0}", + "in-progress": "SCANOSS - 執行掃描...", + "match-count": "找到{0} 匹配", + "matched": "SCANOSS - 找到{0} 匹配", + "no-match": "SCANOSS - 無匹配", + "summary": "摘要" + } + }, + "session-settings-dialog": { + "title": "設定工作階段設定", + "tooltip": "設定工作階段設定" + }, + "terminal": { + "agent": { + "description": "此代理程式可協助編寫和執行任意的終端命令。 根據使用者的要求,它會建議命令,並允許使用者直接貼上並在終端執行這些命令。 它會存取目前的目錄、環境以及終端會話最近的終端輸出,以提供情境感知的協助。", + "vars": { + "cwd": { + "description": "目前的工作目錄。" + }, + "recentTerminalContents": { + "description": "終端機中可見的最近 0 到 50 行。" + }, + "shell": { + "description": "使用的 shell,例如 /usr/bin/zsh。" + }, + "userRequest": { + "description": "使用者的問題或請求。" + } + } + }, + "askAi": "詢問 AI", + "askTerminalCommand": "詢問終端命令...", + "hitEnterConfirm": "按下 Enter 確認", + "howCanIHelp": "我能為您做什麼?", + "loading": "載入中", + "tryAgain": "再試一次...", + "useArrowsAlternatives": "或使用 ⇅ 顯示替代方案..." + }, + "tokenUsage": { + "cachedInputTokens": "寫入快取記憶體的輸入代幣", + "cachedInputTokensTooltip": "另外追蹤「輸入代碼」。通常比非快取的代幣昂貴。", + "failedToGetTokenUsageData": "取得令牌使用資料失敗:{0}", + "inputTokens": "輸入符記", + "label": "代幣使用", + "lastUsed": "最後使用", + "model": "型號", + "noData": "目前尚無代用幣使用資料。", + "note": "令牌使用量自應用程式啟動後即開始追蹤,且不會持久化。", + "outputTokens": "輸出代幣", + "readCachedInputTokens": "從快取記憶體讀取輸入代幣", + "readCachedInputTokensTooltip": "另外追蹤「輸入令牌」。通常比沒有快取的成本低很多。通常不計入速率限制。", + "total": "總計", + "totalTokens": "代幣總數", + "totalTokensTooltip": "輸入代幣' + '輸出代幣" + }, + "vercelai": { + "anthropicApiKey": { + "mdDescription": "輸入人類模型的 API 金鑰。**請注意:** 使用此偏好設定,API 金鑰會以明碼方式儲存在執行 Theia 的機器上。使用環境變數 `ANTHROPIC_API_KEY` 來安全地設定金鑰。" + }, + "customEndpoints": { + "apiKey": { + "title": "存取在指定網址提供的 API 的金鑰,或使用全局 API 金鑰的 `true" + }, + "enableStreaming": { + "title": "表示是否要使用串流 API。預設為 `true`。" + }, + "id": { + "title": "用戶介面中用來識別自訂模型的唯一識別碼" + }, + "mdDescription": "整合與 Vercel AI SDK 相容的自訂模型。所需的屬性為「model」和「url」。 \n 您可以選擇 \n - 指定唯一的 `id` 以在使用者介面中識別自訂模型。如果沒有指定,`model` 將會被用做`id`。 \n - 提供一個 `apiKey` 來存取在給定的 url 上提供的 API。使用 `true` 表示使用全局 API 密鑰。 \n - 指定 `supportsStructuredOutput: false` 表示不使用結構化輸出。 \n - 指定 `enableStreaming: false` 表示不使用串流。 \n - 指定 `provider` 表示模型來自哪個提供者 (openai, anthropic)。", + "modelId": { + "title": "型號 ID" + }, + "supportsStructuredOutput": { + "title": "表示模型是否支援結構化輸出。預設為 `true`。" + }, + "url": { + "title": "託管模型的 API 端點" + } + }, + "models": { + "description": "與 Vercel AI SDK 搭配使用的官方模型", + "id": { + "title": "型號 ID" + }, + "model": { + "title": "型號名稱" + } + }, + "openaiApiKey": { + "mdDescription": "輸入 OpenAI 模型的 API 金鑰。**請注意:** 使用此偏好設定時,API 金鑰會以明碼儲存於執行 Theia 的機器上。使用環境變數 `OPENAI_API_KEY` 來安全地設定金鑰。" + } + }, + "workspace": { + "coderAgent": { + "description": "整合至 Theia IDE 的 AI 助理,專為協助軟體開發人員而設計。這個代理可以存取使用者的工作區,它可以取得所有可用檔案和資料夾的清單,並擷取它們的內容。此外,它還可以建議使用者修改檔案。因此,它可以協助使用者執行編碼工作或其他涉及檔案變更的工作。" + }, + "considerGitignore": { + "description": "如果啟用,則排除全局 .gitignore 檔案中指定的檔案/資料夾(預期位置為工作區根)。", + "title": "考慮 .gitignore" + }, + "excludedPattern": { + "description": "要排除的檔案/資料夾模式 (glob 或 regex) 清單。", + "title": "排除的檔案樣式" + }, + "searchMaxResults": { + "description": "工作區搜尋功能傳回的最大搜尋結果數量。", + "title": "最大搜尋結果" + }, + "workspaceAgent": { + "description": "整合至 Theia IDE 的 AI 助理,專為協助軟體開發人員而設計。此代理可以存取使用者的工作區,它可以取得所有可用檔案與資料夾的清單,並擷取其內容。它無法修改檔案。因此它可以回答工作區中關於目前專案、專案檔案和原始碼的問題,例如如何建立專案、將原始碼放在哪裡、在哪裡可以找到特定的程式碼或設定等。" + } + } + }, + "ai-chat": { + "fileChangeSetTitle": "建議變更" + }, + "ai-chat-ui": { + "initiate-session-task-context": "任務內容:啟動會話", + "open-current-session-summary": "公開當前會期摘要", + "open-settings-tooltip": "開啟 AI 設定...", + "scroll-lock": "鎖定捲軸", + "scroll-unlock": "解鎖捲軸", + "session-settings": "設定工作階段設定", + "showChats": "顯示聊天記錄...", + "summarize-current-session": "總結本屆會議" + }, + "ai-claude-code": { + "open-config": "開啟 Claude 程式碼組態", + "open-memory": "開啟 Claude 程式記憶體 (CLAUDE.MD)" + }, + "ai-core": { + "agentCompletionMessage": "Agent \"{0}\" 已完成任務。", + "agentCompletionTitle": "代理 \"{0}\" 任務已完成", + "agentCompletionWithTask": "Agent \"{0}\" 已完成任務:{1}" + }, + "ai-editor": { + "contextMenu": "詢問 AI", + "sendToChat": "傳送至 AI 聊天室" + }, + "ai-ide": { + "addressGhReviewCommand": { + "argumentHint": "", + "description": "處理 GitHub 拉取請求的審閱意見" + }, + "fixGhTicketCommand": { + "argumentHint": "", + "description": "分析 GitHub 票證並實作解決方案" + }, + "open-agent-settings-tooltip": "開啟代理程式設定...", + "rememberCommand": { + "argumentHint": "[主題提示]", + "description": "從對話中提取主題並更新專案資訊" + }, + "ticketCommand": { + "argumentHint": "", + "description": "分析 GitHub 票證並制定實施計劃" + }, + "todoTool": { + "noTasks": "無任務" + }, + "withAppTesterCommand": { + "description": "將測試任務委派給 AppTester 代理程式(需啟用代理程式模式)" + } + }, + "ai-mcp": { + "blockedServersLabel": "MCP 伺服器(自動啟動遭封鎖)" + }, + "ai-terminal": { + "cancelExecution": "取消命令執行", + "canceling": "正在取消...", + "confirmExecution": "確認 Shell 指令", + "denialReason": "理由", + "executionCanceled": "已取消", + "executionDenied": "拒絕", + "executionDeniedWithReason": "有理有據地拒絕", + "noOutput": "無輸出", + "partialOutput": "部分輸出", + "timeout": "超時", + "workingDirectory": "工作目錄" + }, + "callhierarchy": { + "noCallers": "未偵測到來電者。", + "open": "開放式呼叫層級" + }, + "chat": { + "taskContextVariable": { + "args": { + "contextId": { + "description": "要擷取的任務上下文 ID,或是要總結的聊天會話。" + } + }, + "description": "提供任務的情境資訊,例如完成任務的計劃或先前會議的摘要", + "label": "任務內容" + } + }, + "collaboration": { + "collaborate": "合作", + "collaboration": "合作", + "collaborationWorkspace": "協同工作區", + "connected": "連接", + "connectedSession": "連接至協作會議", + "copiedInvitation": "邀請函代碼已複製到剪貼簿。", + "copyAgain": "再次複製", + "createRoom": "建立新的協作會議", + "creatingRoom": "創建會話", + "end": "結束協作會議", + "endDetail": "終止會話、停止內容共用,並取消其他人的存取權限。", + "enterCode": "輸入協作會議代碼", + "failedCreate": "建立空間失敗:{0}", + "failedJoin": "未能加入房間:{0}", + "fieldRequired": "{0} 欄位為必填欄位。登入中止。", + "invite": "邀請他人", + "inviteDetail": "複製邀請代碼,以便與他人分享,參加會議。", + "joinRoom": "加入協作會議", + "joiningRoom": "加入會議", + "leave": "休假協作會議", + "leaveDetail": "中斷目前的協作工作階段,並關閉工作區。", + "loginFailed": "登入失敗。", + "loginSuccessful": "登入成功。", + "noAuth": "伺服器未提供驗證方法。", + "optional": "選購", + "selectAuth": "選擇驗證方法", + "selectCollaboration": "選擇合作選項", + "serverUrl": "伺服器 URL", + "serverUrlDescription": "用於即時協作會話的開放式協作工具伺服器實例的 URL", + "sharedSession": "分享協作會議", + "startSession": "開始或加入協作會議", + "userWantsToJoin": "使用者 '{0}' 想要加入協作室", + "whatToDo": "您想與其他合作者做什麼?" + }, + "core": { + "about": { + "compatibility": "{0} 相容性", + "defaultApi": "預設{0} API", + "listOfExtensions": "擴充清單" + }, + "common": { + "closeAll": "關閉所有標籤", + "closeAllTabMain": "關閉主區域中的所有標籤", + "closeOtherTabMain": "關閉主區中的其他標籤", + "closeOthers": "關閉其他標籤", + "closeRight": "向右關閉標籤", + "closeTab": "關閉標籤", + "closeTabMain": "關閉主區域中的標籤", + "collapseAllTabs": "折疊所有側板", + "collapseBottomPanel": "切換底部面板", + "collapseLeftPanel": "切換左側面板", + "collapseRightPanel": "切換右側面板", + "collapseTab": "折疊側板", + "showNextTabGroup": "切換到下一個標籤組", + "showNextTabInGroup": "切換到群組中的下一個標籤", + "showPreviousTabGroup": "切換到上一個標籤組", + "showPreviousTabInGroup": "切換到群組中的上一個標籤", + "toggleMaximized": "切換最大化" + }, + "copyInfo": "先開啟檔案以複製其路徑", + "copyWarn": "請使用瀏覽器的複製指令或捷徑。", + "cutWarn": "請使用瀏覽器的剪下指令或捷徑。", + "enhancedPreview": { + "classic": "顯示標籤的簡單預覽及基本資訊。", + "enhanced": "顯示標籤的增強預覽,並提供其他資訊。", + "visual": "顯示標籤的視覺預覽。" + }, + "file": { + "browse": "瀏覽" + }, + "highlightModifiedTabs": "控制是否在已修改(髒)的編輯器標籤上畫上邊框。", + "keybinding": { + "duplicateModifierError": "無法解析鍵盤綁定{0} 重複修改器", + "metaError": "無法解析鍵盤綁定{0} 元僅適用於 OSX", + "unrecognizedKeyError": "未識別的關鍵{0} 在{1}" + }, + "keybindingStatus": "{0} 被按下,等待更多的按鍵", + "keyboard": { + "choose": "選擇鍵盤配置", + "chooseLayout": "選擇鍵盤配置", + "current": "(目前:{0})", + "currentLayout": "- 目前佈局", + "mac": "Mac 鍵盤", + "pc": "PC 鍵盤", + "tryDetect": "嘗試從瀏覽器資訊和按下的按鍵偵測鍵盤配置。" + }, + "navigator": { + "clipboardWarn": "拒絕存取剪貼板。檢查瀏覽器的權限。", + "clipboardWarnFirefox": "剪貼板 API 不可用。您可以在 '{1}' 頁面上的 '{0}' 偏好設定啟用。然後重新載入 Theia。請注意,這將允許 FireFox 完全存取系統剪貼板。" + }, + "offline": "離線", + "pasteWarn": "請使用瀏覽器的貼上指令或捷徑。", + "quitMessage": "任何未儲存的變更都不會儲存。", + "resetWorkbenchLayout": "重設工作台佈局", + "searchbox": { + "close": "關閉(逃生)", + "next": "下一頁 (向下)", + "previous": "上一頁 (上)", + "showAll": "顯示所有項目", + "showOnlyMatching": "僅顯示符合條件的項目" + }, + "secondaryWindow": { + "alwaysOnTop": "啟用時,次要視窗會停留在所有其他視窗之上,包括不同應用程式的視窗。", + "description": "設定抽取的次要視窗的初始位置和大小。", + "fullSize": "擷取的 widget 位置和大小將與執行中的 Theia 應用程式相同。", + "halfWidth": "擷取的 widget 位置和大小將是執行中的 Theia 應用程式寬度的一半。", + "originalSize": "提取出來的 widget 的位置和大小將與原始 widget 相同。" + }, + "severity": { + "log": "日誌" + }, + "silentNotifications": "控制是否抑制通知彈出。", + "tabDefaultSize": "指定標籤的預設大小。", + "tabMaximize": "控制是否在雙擊時將索引標籤最大化。", + "tabMinimumSize": "指定標籤頁的最小尺寸。", + "tabShrinkToFit": "縮小標籤以符合可用空間。", + "window": { + "tabCloseIconPlacement": { + "description": "將標籤標題上的關閉圖示放在標籤的開始或結束位置。在所有平台上,預設為結束。", + "end": "將關閉圖示放在標籤的末端。在從左至右的語言中,這是標籤的右側。", + "start": "將關閉圖示放在標籤的開始位置。在從左至右的語言中,這是標籤的左側。" + } + }, + "window.menuBarVisibility": "選單以緊湊按鈕的形式顯示於側邊欄。當{0} 時,此值將{1}被忽略。" + }, + "debug": { + "TheiaIDE": "Theia IDE", + "addConfigurationPlaceholder": "選擇要新增組態的工作區根", + "breakpoint": "断点", + "cannotRunToThisLocation": "無法將現有線程運行到指定位置。", + "compound-cycle": "啟動組態 '{0}' 包含與本身的循環", + "conditionalBreakpoint": "條件中斷點", + "conditionalBreakpointsNotSupported": "此偵錯類型不支援條件中斷點", + "confirmRunToShiftedPosition_msg": "目標位置將移至 Ln{0}, Col{1} 。無論如何運行?", + "confirmRunToShiftedPosition_title": "無法將當前線程運行到完全指定的位置", + "consoleFilter": "篩選器(例如:文字、!排除)", + "consoleFilterAriaLabel": "過濾除錯控制台輸出", + "consoleSessionSelectorTooltip": "在不同除錯會話之間切換。每個除錯會話皆擁有獨立的控制台輸出。", + "consoleSeverityTooltip": "依嚴重性等級過濾控制台輸出。僅顯示具有所選嚴重性的訊息。", + "continueAll": "繼續全部", + "copyExpressionValue": "複製表達值", + "couldNotRunTask": "無法執行任務 '{0}'。", + "dataBreakpoint": "資料中斷點", + "debugConfiguration": "除錯設定", + "debugSessionInitializationFailed": "Debug 會話初始化失敗。詳情請參閱控制台。", + "debugSessionTypeNotSupported": "不支援除錯會話類型 \"{0}\"。", + "debugToolbarMenu": "除錯工具列功能表", + "debugVariableInput": "設定{0} 值", + "disableSelectedBreakpoints": "停用選取的斷點", + "disabledBreakpoint": "殘障{0}", + "enableSelectedBreakpoints": "啟用選取的斷點", + "entry": "入口", + "errorStartingDebugSession": "啟動除錯會話時發生錯誤,請檢查記錄以瞭解詳細資訊。", + "exception": "例外", + "functionBreakpoint": "函數中斷點", + "goto": "到達", + "htiConditionalBreakpointsNotSupported": "打出此偵錯類型不支援的條件中斷點", + "instruction-breakpoint": "指令中斷點", + "instructionBreakpoint": "指令中斷點", + "logpointsNotSupported": "此偵錯類型不支援的記錄點", + "missingConfiguration": "動態設定 '{0}:{1}' 遺失或不適用", + "pause": "暫停", + "pauseAll": "暫停全部", + "reveal": "揭示", + "step": "步驟", + "taskTerminatedBySignal": "任務 '{0}' 由訊號{1} 終止。", + "taskTerminatedForUnknownReason": "任務 '{0}' 因不明原因終止。", + "taskTerminatedWithExitCode": "任務 '{0}' 以退出代碼{1} 終止。", + "threads": "線程", + "toggleTracing": "啟用/停用與除錯介面卡的追蹤通訊", + "unknownSession": "未知場次", + "unverifiedBreakpoint": "未經確認{0}" + }, + "editor": { + "diffEditor.wordWrap2": "行會根據 `#editor.wordWrap#` 設定來換行。", + "dirtyEncoding": "檔案已損壞。請先儲存檔案,再以其他編碼重新開啟。", + "editor.bracketPairColorization.enabled": "控制是否啟用括號對著色。使用 `#workbench.colorCustomizations#` 來覆寫括弧高亮顏色。", + "editor.codeActions.triggerOnFocusChange": "當 `#files.autoSave#` 設定為 `afterDelay` 時,啟用觸發 `#editor.codeActionsOnSave#`。Code Actions 必須設定為 `always` 才能在視窗和焦點改變時被觸發。", + "editor.detectIndentation": "控制在開啟檔案時,是否會根據檔案內容自動偵測 `#editor.tabSize#` 和 `#editor.insertSpaces#`。", + "editor.experimental.preferTreeSitter": "控制是否為特定語言啟用樹狀結構解析器。此設定將優先於 `editor.experimental.treeSitterTelemetry` 對指定語言的設定。", + "editor.inlayHints.enabled1": "鑲嵌提示依預設顯示,並在按住 Ctrl+Alt 時隱藏", + "editor.inlayHints.enabled2": "內嵌提示預設為隱藏,按住 Ctrl+Alt 時會顯示。", + "editor.inlayHints.fontFamily": "控制編輯器中內嵌提示的字型族。設定為空時,會使用 `#editor.fontFamily#`。", + "editor.inlayHints.fontSize": "控制編輯器中內嵌提示的字型大小。當設定值小於或大於編輯器字型大小時,預設會使用 `#editor.fontSize#`。", + "editor.inlineSuggest.edits.experimental.enabled": "控制是否在內線建議中啟用實驗性編輯。", + "editor.inlineSuggest.edits.experimental.onlyShowWhenCloseToCursor": "控制是否僅在游標接近建議時顯示內嵌建議。", + "editor.inlineSuggest.edits.experimental.useInterleavedLinesDiff": "控制是否啟用內嵌建議中的實驗性交錯線差。", + "editor.inlineSuggest.edits.experimental.useMixedLinesDiff": "控制是否在內線建議中啟用實驗性編輯。", + "editor.insertSpaces": "按下 `Tab` 時插入空格。當 `#editor.detectIndentation#` 啟用時,此設定會根據檔案內容覆寫。", + "editor.quickSuggestions": "控制輸入時是否自動顯示建議。在輸入註解、字串和其他程式碼時,可以控制這一點。快速建議可設定為以 ghost text 或建議 widget 顯示。同時也要注意 `#editor.supplyOnTriggerCharacters#` 設定,它可以控制是否由特殊字符觸發建議。", + "editor.suggestFontSize": "建議 Widget 的字型大小。設定為 `0` 時,會使用 `#editor.fontSize#` 的值。", + "editor.suggestLineHeight": "建議 widget 的行高。設定為 `0` 時,會使用 `#editor.lineHeight#` 的值。最小值為 8。", + "editor.tabSize": "制表符等於的空格數目。當 `#editor.detectIndentation#` 啟用時,此設定會根據檔案內容覆寫。", + "formatOnSaveTimeout": "以毫秒為單位的逾時,逾時後檔案儲存時執行的格式化會被取消。", + "persistClosedEditors": "控制是否在視窗重新載入時持續工作區的已關閉編輯歷史。", + "showAllEditors": "顯示所有開啟的編輯器", + "splitHorizontal": "水平分割編輯器", + "splitVertical": "垂直分割編輯器", + "toggleStickyScroll": "切換黏貼捲動" + }, + "external-terminal": { + "cwd": "為新的外部終端機選擇目前的工作目錄" + }, + "file-search": { + "toggleIgnoredFiles": "(按{0} 顯示/隱藏忽略的檔案)" + }, + "fileDialog": { + "showHidden": "顯示隱藏的檔案" + }, + "fileSystem": { + "fileResource": { + "overWriteBody": "您要覆寫檔案系統上對 '{0}' 所做的變更?" + } + }, + "filesystem": { + "copiedToClipboard": "將下載連結複製到剪貼簿。", + "copyDownloadLink": "複製下載連結", + "dialog": { + "initialLocation": "前往初始位置", + "multipleItemMessage": "您只能選擇一個項目", + "navigateBack": "導航返回", + "navigateForward": "向前導航", + "navigateUp": "向上瀏覽一個目錄" + }, + "fileResource": { + "binaryFileQuery": "打開它可能需要一些時間,而且可能會導致 IDE 無反應。您到底要不要開啟 '{0}' 呢?", + "binaryTitle": "檔案為二進位或使用不支援的文字編碼。", + "largeFileTitle": "檔案太大 ({0})。", + "overwriteTitle": "檔案系統中的檔案 '{0}' 已變更。" + }, + "filesExclude": "設定 glob 模式以排除檔案和資料夾。例如,檔案總管會根據此設定決定顯示或隱藏哪些檔案和資料夾。", + "format": "格式:", + "maxConcurrentUploads": "上傳多個檔案時,同時上傳的最大檔案數量。0 表示所有檔案都會同時上傳。", + "maxFileSizeMB": "控制可開啟的最大檔案大小 (以 MB 為單位)。", + "prepareDownload": "準備下載...", + "prepareDownloadLink": "準備下載連結...", + "processedOutOf": "加工{0} 出{1}", + "replaceTitle": "取代檔案", + "uploadFailed": "上傳檔案時發生錯誤。{0}", + "uploadFiles": "上傳檔案...", + "uploadedOutOf": "上傳{0} 出{1}" + }, + "getting-started": { + "ai": { + "header": "Theia IDE 的 AI 支援功能現已推出(測試版)!", + "openAIChatView": "立即開啟 AI 聊天視窗,了解如何開始!" + }, + "apiComparator": "{0} API 相容性", + "newExtension": "建立新擴展區", + "newPlugin": "建立新的外掛程式", + "startup-editor": { + "welcomePage": "開啟歡迎頁面,其內容可協助您開始使用{0} 和擴充套件。" + }, + "telemetry": "資料使用與遙測" + }, + "git": { + "aFewSecondsAgo": "數秒前", + "addSignedOff": "新增簽署人", + "added": "已添加", + "amendReuseMessage": "若要重複使用上次的提交訊息,請按「Enter」或「Escape」取消。", + "amendRewrite": "重寫先前的提交訊息。按「Enter」確認或按「Escape」取消。", + "checkoutCreateLocalBranchWithName": "建立新的本地分支,名稱為{0}。按「Enter」確認或按「Escape」取消。", + "checkoutProvideBranchName": "請提供分行名稱。 ", + "checkoutSelectRef": "選擇要結帳的參考資料或建立新的本地分支:", + "cloneQuickInputLabel": "請提供 Git 儲存庫位置。按「Enter」確認或按「Escape」取消。", + "cloneRepository": "克隆 Git 倉庫:{0}。按「Enter」確認或按「Escape」取消。", + "compareWith": "比較...", + "compareWithBranchOrTag": "選取分支或標籤,與目前使用中的{0} 分支進行比較:", + "conflicted": "衝突", + "copied": "複製", + "diff": "差異", + "dirtyDiffLinesLimit": "如果編輯器的行數超過此限制,則不顯示髒的差異裝飾。", + "dropStashMessage": "成功移除藏匿物。", + "editorDecorationsEnabled": "在編輯器中顯示 git 裝飾。", + "fetchPickRemote": "選取遠端擷取:", + "gitDecorationsColors": "在導覽器中使用顏色裝飾。", + "mergeEditor": { + "currentSideTitle": "當前", + "incomingSideTitle": "傳入" + }, + "mergeQuickPickPlaceholder": "選取一個分支合併到目前使用中的{0} 分支:", + "missingUserInfo": "請確定您在 git 中設定了「user.name」和「user.email」。", + "noHistoryForError": "沒有關於{0}", + "noPreviousCommit": "之前沒有承諾修正", + "noRepositoriesSelected": "未選擇儲存庫。", + "prepositionIn": "於", + "renamed": "重新命名", + "repositoryNotInitialized": "儲存庫{0} 尚未初始化。", + "stashChanges": "儲存變更。按「Enter」確認,或按「Escape」取消。", + "stashChangesWithMessage": "儲存庫隨訊息變更:{0}.按「Enter」確認或按「Escape」取消。", + "tabTitleIndex": "{0} (索引)", + "tabTitleWorkingTree": "{0} (工作樹)", + "toggleBlameAnnotations": "切換指責註釋", + "unstaged": "無舞台" + }, + "keybinding-schema-updater": { + "deprecation": "改用 `when` 子句。" + }, + "keymaps": { + "addKeybindingTitle": "新增鍵盤綁定{0}", + "editKeybinding": "編輯按鍵...", + "editKeybindingTitle": "編輯{0}", + "editWhenExpression": "編輯當表達...", + "editWhenExpressionTitle": "編輯{0}", + "keybinding": { + "copy": "複製鍵綁定", + "copyCommandId": "複製鍵綁定指令 ID", + "copyCommandTitle": "複製鍵綁定指令標題", + "edit": "編輯按鍵...", + "editWhenExpression": "編輯按鍵綁定當表達..." + }, + "keybindingCollidesValidation": "按鍵目前碰撞", + "requiredKeybindingValidation": "需要 keybinding 值", + "resetKeybindingConfirmation": "您真的要將此按鍵綁定重設為預設值?", + "resetKeybindingTitle": "重設{0}", + "resetMultipleKeybindingsWarning": "如果此命令存在多個按鍵綁定,則所有按鍵綁定都會被重設。" + }, + "localize": { + "offlineTooltip": "無法連線至後端。" + }, + "markers": { + "clearAll": "全部清除", + "noProblems": "到目前為止,工作區尚未偵測到任何問題。", + "tabbarDecorationsEnabled": "在標籤列中顯示問題裝飾符(診斷標記)。" + }, + "memory-inspector": { + "addressTooltip": "要顯示的記憶體位置、位址或演算至位址的表達式", + "ascii": "ASCII", + "binary": "二進制", + "byteSize": "位元組大小", + "bytesPerGroup": "每組位元組", + "closeSettings": "關閉設定", + "columns": "欄位", + "command": { + "createNewMemory": "建立新的記憶體檢查器", + "createNewRegisterView": "建立新的註冊檢視", + "followPointer": "追蹤指針", + "followPointerMemory": "在記憶體檢視器中追蹤指針", + "resetValue": "重設值", + "showRegister": "在記憶體檢查器中顯示暫存器", + "viewVariable": "在記憶體檢視器中顯示變數" + }, + "data": "資料", + "decimal": "十進制", + "diff": { + "label": "差異:{0}" + }, + "diff-widget": { + "offset-label": "{0} 偏移", + "offset-title": "偏移記憶體的位元組{0}" + }, + "editable": { + "apply": "應用變更", + "clear": "清楚的變更" + }, + "endianness": "尾數", + "extraColumn": "額外欄位", + "groupsPerRow": "每行的群組", + "hexadecimal": "十六進位", + "length": "長度", + "lengthTooltip": "要取得的位元組數量,以十進位或十六進位表示", + "memory": { + "addressField": { + "memoryReadError": "在 Location(位置)欄位中輸入地址或表達式。" + }, + "freeze": "凍結記憶體檢視", + "hideSettings": "隱藏設定面板", + "readError": { + "bounds": "超出記憶體範圍,結果會被截斷。", + "noContents": "目前沒有可用的記憶體內容。" + }, + "readLength": { + "memoryReadError": "在 Length(長度)欄位中輸入長度(十進制或十六進制數字)。" + }, + "showSettings": "顯示設定面板", + "unfreeze": "解除凍結記憶體檢視", + "userError": "取得記憶體時發生錯誤。" + }, + "memoryCategory": "記憶體檢查器", + "memoryInspector": "記憶體檢查器", + "memoryTitle": "記憶體", + "octal": "八進制", + "offset": "偏移", + "offsetTooltip": "當導航時,要加到目前記憶體位置的偏移量", + "provider": { + "localsError": "無法讀取本機變數。沒有啟動除錯階段。", + "readError": "無法讀取記憶體。沒有作用中的除錯會話。", + "writeError": "無法寫入記憶體。沒有作用中的除錯會話。" + }, + "register": "註冊", + "register-widget": { + "filter-placeholder": "過濾器 (以)" + }, + "registerReadError": "取得暫存器時發生錯誤。", + "registers": "註冊", + "toggleComparisonWidgetVisibility": "切換比較小工具的可見性", + "utils": { + "afterBytes": "您必須在要比較的兩個 widget 中都載入記憶體。{0} 沒有載入記憶體。", + "bytesMessage": "您必須在要比較的兩個 widget 中都載入記憶體。{0} 沒有載入記憶體。" + } + }, + "messages": { + "notificationTimeout": "超時後,資訊性通知將會隱藏。", + "toggleNotifications": "切換通知" + }, + "mini-browser": { + "typeUrl": "輸入 URL" + }, + "monaco": { + "noSymbolsMatching": "沒有符合的符號", + "typeToSearchForSymbols": "輸入以搜尋符號" + }, + "navigator": { + "autoReveal": "自動揭示", + "clipboardWarn": "拒絕存取剪貼板。檢查瀏覽器的權限。", + "clipboardWarnFirefox": "剪貼板 API 不可用。您可以在 '{1}' 頁面上的 '{0}' 偏好設定啟用。然後重新載入 Theia。請注意,這將允許 FireFox 完全存取系統剪貼板。", + "openWithSystemEditor": "使用系統編輯器開啟", + "refresh": "在瀏覽器中重新整理", + "reveal": "在瀏覽器中顯示", + "systemEditor": "系統編輯器", + "toggleHiddenFiles": "切換隱藏檔案" + }, + "output": { + "clearOutputChannel": "清除輸出通道...", + "closeOutputChannel": "關閉輸出通道...", + "hiddenChannels": "隱藏通道", + "hideOutputChannel": "隱藏輸出通道...", + "maxChannelHistory": "輸出通道中的最大項目數量。", + "outputChannels": "輸出通道", + "showOutputChannel": "顯示輸出通道..." + }, + "plugin": { + "blockNewTab": "您的瀏覽器無法開啟新標籤頁" + }, + "plugin-dev": { + "alreadyRunning": "托管实例已在运行。", + "debugInstance": "除錯實例", + "debugMode": "使用 inspect 或 inspect-brk 進行 Node.js 除錯", + "debugPorts": { + "debugPort": "此伺服器的 Node.js 除錯要使用的連接埠" + }, + "devHost": "開發主機", + "failed": "執行虛擬外掛實例失敗:{0}", + "hostedPlugin": "託管外掛程式", + "hostedPluginRunning": "託管外掛程式: 執行中", + "hostedPluginStarting": "託管外掛程式:啟動", + "hostedPluginStopped": "託管外掛程式:已停止", + "hostedPluginWatching": "託管外掛程式:觀看", + "instanceTerminated": "{0} 已終止", + "launchOutFiles": "用於定位產生的 JavaScript 檔案的 glob 模式陣列 (`${pluginPath}`將被 plugin 的實際路徑取代)。", + "noValidPlugin": "指定的資料夾不包含有效的外掛程式。", + "notRunning": "托管实例未运行。", + "pluginFolder": "外掛程式資料夾設定為:{0}", + "preventedNewTab": "您的瀏覽器無法開啟新標籤頁", + "restartInstance": "重新啟動實體", + "running": "主機實例執行於:", + "selectPath": "選擇路徑", + "startInstance": "啟動實例", + "starting": "啟動託管實例伺服器 ...", + "stopInstance": "停止實例", + "unknownTerminated": "實例已終止", + "watchMode": "在開發中的外掛程式上執行觀察程式" + }, + "plugin-ext": { + "authentication-main": { + "loginTitle": "登入", + "signedOut": "已成功登出。" + }, + "plugins": "外掛程式", + "webviewTrace": "控制 webviews 的通訊追蹤。", + "webviewWarnIfUnsecure": "警告使用者目前以不安全的方式部署 webview。" + }, + "preferences": { + "ai-features": "AI 功能", + "hostedPlugin": "託管外掛程式", + "toolbar": "工具列" + }, + "preview": { + "openByDefault": "預設開啟預覽而非編輯器。" + }, + "property-view": { + "created": "創建", + "directory": "目錄", + "lastModified": "最後修改", + "location": "地點", + "noProperties": "無房產可供選擇。", + "properties": "屬性", + "symbolicLink": "符號連結" + }, + "remote": { + "dev-container": { + "connect": "在容器中重新開啟", + "noDevcontainerFiles": "工作區中未找到 devcontainer.json 檔案。請確保您的 .devcontainer 目錄中有 devcontainer.json 檔案。", + "selectDevcontainer": "選取 devcontainer.json 檔案" + }, + "ssh": { + "connect": "連接目前視窗至主機...", + "connectToConfigHost": "在組態檔案中連結當前視窗與主機...", + "enterHost": "輸入 SSH 主機名稱", + "enterUser": "輸入 SSH 使用者名稱", + "failure": "無法開啟遠端 SSH 連線。", + "hostPlaceHolder": "例如:hello@example.com", + "needsHost": "請輸入主機名稱。", + "needsUser": "請輸入使用者名稱。", + "userPlaceHolder": "例如:你好" + }, + "sshNoConfigPath": "未找到 SSH 配置路徑。", + "wsl": { + "connectToWsl": "連接至 WSL", + "connectToWslUsingDistro": "使用 Distro... 連接至 WSL", + "noWslDistroFound": "未找到 WSL 發行版。請先安裝 WSL 發行套件。", + "reopenInWsl": "在 WSL 中重新開啟資料夾", + "selectWSLDistro": "選擇 WSL 分佈" + } + }, + "scm": { + "amend": "修正", + "amendHeadCommit": "HEAD 承諾", + "amendLastCommit": "修正上次提交", + "changeRepository": "變更儲存庫...", + "config.untrackedChanges": "控制未追蹤變更的行為。", + "config.untrackedChanges.hidden": "隱藏的", + "config.untrackedChanges.mixed": "混合", + "config.untrackedChanges.separate": "獨立", + "dirtyDiff": { + "close": "關閉變更窺視" + }, + "history": "歷史", + "mergeEditor": { + "resetConfirmationTitle": "您真的想要在這個編輯器中重新設定合併結果嗎?" + }, + "noRepositoryFound": "未找到儲存庫", + "unamend": "Unamend", + "unamendCommit": "取消修正提交" + }, + "search-in-workspace": { + "includeIgnoredFiles": "包含忽略的檔案", + "noFolderSpecified": "您尚未開啟或指定資料夾。目前只搜尋開啟的檔案。", + "resultSubset": "這只是所有結果的子集。請使用更明確的搜尋字詞縮小結果清單的範圍。", + "searchOnEditorModification": "修改時搜尋使用中的編輯器。" + }, + "secondary-window": { + "extract-widget": "將檢視移至次要視窗" + }, + "shell-area": { + "secondary": "輔助窗口" + }, + "task": { + "attachTask": "附加任務...", + "circularReferenceDetected": "偵測到圓周參考:{0} -->{1}", + "clearHistory": "清除歷史", + "errorKillingTask": "Error killing task '{0}':{1}", + "errorLaunchingTask": "啟動工作 '{0}' 時發生錯誤:{1}", + "invalidTaskConfigs": "發現無效的任務組態。開啟 tasks.json,在「問題」檢視中尋找詳細資料。", + "neverScanTaskOutput": "切勿掃描任務輸出", + "noTaskToRun": "未找到要執行的任務。配置任務...", + "noTasksFound": "未找到任務", + "notEnoughDataInDependsOn": "dependsOn\" 中提供的資訊不足以匹配正確的任務!", + "schema": { + "commandOptions": { + "cwd": "已執行程式或指令碼的目前工作目錄。如果省略,則使用 Theia 目前的工作區根目錄。" + }, + "presentation": { + "panel": { + "dedicated": "終端專用於特定任務。如果再次執行該任務,則會重新使用該終端機。但是,不同任務的輸出會顯示在不同的終端機。", + "new": "該任務的每次執行都會使用新的乾淨終端機。", + "shared": "終端是共用的,其他任務執行的輸出也會加入同一終端。" + }, + "showReuseMessage": "控制是否顯示「任務將重複使用終端機」訊息。" + }, + "problemMatcherObject": { + "owner": "Theia 內問題的擁有者。如果指定了 base,則可以省略。如果省略且未指定 base,則預設為「外部」。" + } + }, + "taskAlreadyRunningInTerminal": "任務已在終端執行", + "taskExitedWithCode": "任務 '{0}' 已經退出,代碼為{1}.", + "taskTerminalTitle": "任務:{0}", + "taskTerminatedBySignal": "任務 '{0}' 被信號{1} 終止。", + "terminalWillBeReusedByTasks": "終端將由任務重複使用。" + }, + "terminal": { + "defaultProfile": "上使用的預設設定檔{0}", + "enableCopy": "啟用 ctrl-c(macOS 上為 cmd-c)複製選取的文字", + "enablePaste": "啟用 ctrl-v(macOS 上為 cmd-v)從剪貼簿貼上", + "profileArgs": "此設定檔使用的 shell 參數。", + "profileColor": "與終端關聯的終端主題顏色 ID。", + "profileDefault": "選擇預設設定檔...", + "profileIcon": "要與終端圖示關聯的 codicon ID。\nterminal-tmux:\"$(terminal-tmux)\"", + "profileNew": "新終端機 (含簡介)...", + "profilePath": "此設定檔使用的 shell 路徑。", + "profiles": "建立新終端時要顯示的設定檔。使用可選的 args 手動設定路徑屬性。\n將現有的設定檔設定為「null」,以從清單中隱藏設定檔,例如: `\"{0}\": null`。", + "rendererType": "控制終端機的呈現方式。", + "rendererTypeDeprecationMessage": "渲染器類型不再支援為選項。", + "selectProfile": "為新終端選擇設定檔", + "shell.deprecated": "這已經被廢棄,新的建議配置預設 shell 的方式是在 'terminal.integrated.profiles.{0}' 中建立終端設定檔,並在 'terminal.integrated.defaultProfile.{0}.' 中將其設定檔名稱設定為預設值。", + "shellArgsLinux": "在 Linux 終端時要使用的命令列參數。", + "shellArgsOsx": "在 macOS 終端時要使用的命令列參數。", + "shellArgsWindows": "在 Windows 終端時要使用的命令列參數。", + "shellLinux": "終端在 Linux 上使用的 shell 路徑 (預設值: '{0}'})。", + "shellOsx": "終端在 macOS 上使用的 shell 路徑 (預設值: '{0}'})。", + "shellWindows": "終端在 Windows 上使用的 shell 路徑。(預設值:'{0}' )。" + }, + "terminal-manager": { + "addTerminalToGroup": "將終端機加入群組", + "closeDialog": { + "message": "一旦關閉終端管理器,其佈局將無法恢復。您確定要關閉終端管理器嗎?", + "title": "您是否要關閉終端管理器?" + }, + "closeTerminalManager": "關閉終端管理器", + "createNewTerminalGroup": "建立新的終端機群組", + "createNewTerminalPage": "建立新終端頁面", + "deleteGroup": "刪除群組", + "deletePage": "刪除頁面", + "deleteTerminal": "刪除終端機", + "group": "團體", + "label": "終端機", + "maximizeBottomPanel": "最大化底部面板", + "minimizeBottomPanel": "最小化底部面板", + "openTerminalManager": "開啟終端管理器", + "page": "頁面", + "rename": "重新命名", + "resetTerminalManagerLayout": "重設終端管理器佈局", + "toggleTreeView": "切換樹狀檢視" + }, + "test": { + "cancelAllTestRuns": "取消所有測試執行", + "stackFrameAt": "於", + "testRunDefaultName": "{0} 跑{1}", + "testRuns": "測試運行" + }, + "toolbar": { + "addCommand": "新增指令至工具列", + "addCommandPlaceholder": "尋找要加入工具列的指令", + "centerColumn": "中柱", + "failedUpdate": "更新 '{1}' 中 '{0}' 的值失敗。", + "filterIcons": "篩選器圖示", + "iconSelectDialog": "為 '{0}' 選擇圖示", + "iconSet": "圖示集", + "insertGroupLeft": "插入群組分隔線(左)", + "insertGroupRight": "插入群組分隔線(右)", + "leftColumn": "左欄", + "openJSON": "自訂工具列 (開啟 JSON)", + "removeCommand": "從工具列移除指令", + "restoreDefaults": "還原工具列預設值", + "rightColumn": "右欄", + "selectIcon": "選擇圖示", + "toggleToolbar": "切換工具列", + "toolbarLocationPlaceholder": "您希望在哪裡加入指令?", + "useDefaultIcon": "使用預設圖示" + }, + "typehierarchy": { + "subtypeHierarchy": "子類別階層", + "supertypeHierarchy": "超類型層級" + }, + "variableResolver": { + "listAllVariables": "變數:列出所有" + }, + "vsx-registry": { + "confirmDialogMessage": "副檔名 \"{0}\" 未經驗證,可能會構成安全風險。", + "confirmDialogTitle": "您確定要繼續安裝嗎?", + "downloadCount": "下載計數:{0}", + "errorFetching": "取得擴充套件時出錯。", + "errorFetchingConfigurationHint": "這可能是網路組態問題造成的。", + "failedInstallingVSIX": "從 VSIX 安裝{0} 失敗。", + "invalidVSIX": "選取的檔案不是有效的「*.vsix」外掛程式。", + "license": "許可證:{0}", + "onlyShowVerifiedExtensionsDescription": "這可讓{0} 只顯示已驗證的擴充套件。", + "onlyShowVerifiedExtensionsTitle": "只顯示已驗證的擴充套件", + "recommendedExtensions": "您要為此套件庫安裝建議的擴充套件嗎?", + "searchPlaceholder": "搜尋擴展名稱{0}", + "showInstalled": "顯示已安裝的擴充套件", + "showRecommendedExtensions": "控制是否顯示擴展建議的通知。", + "vsx-extensions-contribution": { + "update-version-uninstall-error": "移除副檔名時發生錯誤:{0}。", + "update-version-version-error": "{1} 的{0} 版本安裝失敗。" + } + }, + "webview": { + "goToReadme": "前往 README", + "messageWarning": " {0} 端點的主機模式已變更為 `{1}`;變更模式可能會導致安全漏洞。 詳情請參閱 `{2}`。" + }, + "workspace": { + "bothAreDirectories": "這兩項資源皆為目錄。", + "clickToManageTrust": "點擊管理信任設定。", + "compareWithEachOther": "相互比較", + "confirmDeletePermanently.description": "使用垃圾桶刪除 \"{0}\" 失敗。您想要永久刪除嗎?", + "confirmDeletePermanently.solution": "您可以在喜好設定中停用垃圾桶的使用。", + "confirmDeletePermanently.title": "刪除檔案出錯", + "confirmMessage.delete": "您真的要刪除下列檔案嗎?", + "confirmMessage.dirtyMultiple": "您真的想要刪除{0} 檔案中未儲存的變更嗎?", + "confirmMessage.dirtySingle": "您真的要刪除{0} 未儲存的變更嗎?", + "confirmMessage.uriMultiple": "您真的要刪除所有{0} 選取的檔案?", + "confirmMessage.uriSingle": "您真的要刪除{0}?", + "directoriesCannotBeCompared": "目錄無法進行比較。 {0}", + "duplicate": "重複", + "failSaveAs": "無法為目前的 widget 執行 \"{0}\"。", + "isDirectory": "{0}'' 是一個目錄。", + "manageTrustPlaceholder": "為此工作區選擇信任狀態", + "newFilePlaceholder": "檔案名稱", + "newFolderPlaceholder": "資料夾名稱", + "noErasure": "注意:磁碟上的任何內容都不會被刪除", + "notWorkspaceFile": "非有效的工作區檔案: {0}", + "openRecentPlaceholder": "輸入您要開啟的工作區名稱", + "openRecentWorkspace": "開啟最近工作區...", + "preserveWindow": "啟用在目前視窗中開啟工作區。", + "removeFolder": "您確定要從工作區移除下列資料夾?", + "removeFolders": "您確定要從工作區移除下列資料夾?", + "restrictedModeDescription": "由於此工作區未被信任,部分功能已停用。", + "restrictedModeNote": "*請注意:工作區信任功能目前正在 Theia 中開發中;並非所有功能都已與工作區信任整合*", + "schema": { + "folders": { + "description": "工作區中的根目錄" + }, + "title": "工作區檔案" + }, + "trashTitle": "移動{0} 到垃圾桶", + "trustEmptyWindow": "控制預設是否信任空工作區。", + "trustEnabled": "控制是否啟用工作區信任。如果停用,則信任所有工作區。", + "trustTrustedFolders": "無需提示即可信任的資料夾 URI 清單。", + "untitled-cleanup": "似乎有許多無標題的工作區檔案。請檢查{0} 並移除任何未使用的檔案。", + "variables": { + "cwd": { + "description": "任務執行器啟動時的當前工作目錄" + }, + "file": { + "description": "目前開啟檔案的路徑" + }, + "fileBasename": { + "description": "目前開啟檔案的基名" + }, + "fileBasenameNoExtension": { + "description": "當前開啟檔案的名稱(不含副檔名)" + }, + "fileDirname": { + "description": "目前開啟檔案所在目錄的名稱" + }, + "fileExtname": { + "description": "目前開啟檔案的擴展" + }, + "relativeFile": { + "description": "當前開啟檔案相對於工作區根目錄的路徑" + }, + "relativeFileDirname": { + "description": "當前開啟檔案的目錄名稱相對於 ${workspaceFolder} 的路徑" + }, + "workspaceFolder": { + "description": "工作區根資料夾的路徑" + }, + "workspaceFolderBasename": { + "description": "工作區根目錄的名稱" + }, + "workspaceRoot": { + "description": "工作區根資料夾的路徑" + }, + "workspaceRootFolderName": { + "description": "工作區根目錄的名稱" + } + }, + "workspaceFolderAdded": "已建立具有多個根的工作區。您是否要將工作區設定儲存為檔案?", + "workspaceFolderAddedTitle": "資料夾新增至工作區" + } + }, + "vsx.disabling": "停用", + "vsx.disabling.extensions": "停用{0}...", + "vsx.enabling": "啟用", + "vsx.enabling.extension": "啟用{0}..." +} diff --git a/packages/core/package.json b/packages/core/package.json new file mode 100644 index 0000000..6c088a5 --- /dev/null +++ b/packages/core/package.json @@ -0,0 +1,225 @@ +{ + "name": "@theia/core", + "version": "1.68.0", + "description": "Theia is a cloud & desktop IDE framework implemented in TypeScript.", + "main": "lib/common/index.js", + "typings": "lib/common/index.d.ts", + "dependencies": { + "@babel/runtime": "^7.10.0", + "@parcel/watcher": "^2.5.0", + "@lumino/algorithm": "^2.0.4", + "@lumino/commands": "^2.3.3", + "@lumino/coreutils": "^2.2.2", + "@lumino/domutils": "^2.0.4", + "@lumino/dragdrop": "^2.1.7", + "@lumino/messaging": "^2.0.4", + "@lumino/properties": "^2.0.4", + "@lumino/signaling": "^2.1.5", + "@lumino/virtualdom": "^2.0.4", + "@lumino/widgets": "2.7.2", + "@theia/application-package": "1.68.0", + "@theia/request": "1.68.0", + "@types/body-parser": "^1.16.4", + "@types/express": "^4.17.21", + "@types/fs-extra": "^4.0.2", + "@types/lodash.debounce": "4.0.3", + "@types/lodash.throttle": "^4.1.3", + "@types/markdown-it": "^14.1.0", + "@types/markdown-it-emoji": "^3.0.1", + "@types/react": "^18.0.15", + "@types/react-dom": "^18.0.6", + "@types/route-parser": "^0.1.1", + "@types/safer-buffer": "^2.1.0", + "@types/uuid": "^9.0.8", + "@types/ws": "^8.5.5", + "@types/yargs": "^15", + "@vscode/codicons": "*", + "ajv": "^6.5.3", + "async-mutex": "^0.4.0", + "body-parser": "^1.17.2", + "cookie": "^1.0.2", + "dompurify": "^3.2.4", + "drivelist": "^12.0.2", + "express": "^4.21.0", + "fast-json-stable-stringify": "^2.1.0", + "file-icons-js": "~1.0.3", + "font-awesome": "^4.7.0", + "fs-extra": "^4.0.2", + "fuzzy": "^0.1.3", + "http-proxy-agent": "^5.0.0", + "https-proxy-agent": "^5.0.0", + "iconv-lite": "^0.6.0", + "inversify": "^6.1.3", + "jschardet": "^2.1.1", + "keytar": "7.9.0", + "lodash.debounce": "^4.0.8", + "lodash.throttle": "^4.1.1", + "markdown-it": "^14.1.0", + "markdown-it-anchor": "^9.2.0", + "markdown-it-emoji": "^3.0.0", + "msgpackr": "^1.10.2", + "p-debounce": "^2.1.0", + "perfect-scrollbar": "1.5.5", + "react": "^18.2.0", + "react-dom": "^18.2.0", + "react-tooltip": "^4.2.21", + "react-virtuoso": "^2.17.0", + "reflect-metadata": "^0.2.2", + "route-parser": "^0.0.5", + "safer-buffer": "^2.1.2", + "socket.io": "^4.5.3", + "socket.io-client": "^4.5.3", + "tslib": "^2.6.2", + "uuid": "^9.0.1", + "vscode-languageserver-protocol": "^3.17.2", + "vscode-uri": "^2.1.1", + "ws": "^8.17.1", + "yargs": "^15.3.1" + }, + "peerDependencies": { + "@theia/electron": "*" + }, + "peerDependenciesMeta": { + "@theia/electron": { + "optional": true + } + }, + "publishConfig": { + "access": "public" + }, + "theiaReExports": { + "electron-shared": { + "copy": "@theia/electron#shared" + }, + "shared": { + "export *": [ + "@lumino/algorithm", + "@lumino/commands", + "@lumino/coreutils", + "@lumino/domutils", + "@lumino/dragdrop", + "@lumino/messaging", + "@lumino/properties", + "@lumino/signaling", + "@lumino/virtualdom", + "@lumino/widgets", + "@theia/application-package", + "@theia/application-package/lib/api", + "@theia/application-package/lib/environment", + "@theia/request", + "@theia/request/lib/proxy", + "@theia/request/lib/node-request-service", + "fs-extra", + "fuzzy", + "inversify", + "react-dom", + "react-dom/client", + "react-virtuoso", + "vscode-languageserver-protocol", + "vscode-uri" + ], + "export =": [ + "@parcel/watcher as parcelWatcher", + "dompurify as DOMPurify", + "express", + "lodash.debounce as debounce", + "lodash.throttle as throttle", + "markdown-it as markdownit", + "markdown-it-anchor as markdownitanchor", + "markdown-it-emoji as markdownitemoji", + "react as React", + "ws as WebSocket", + "yargs" + ] + } + }, + "theiaExtensions": [ + { + "frontendPreload": "lib/browser/preload/preload-module", + "preload": "lib/electron-browser/preload" + }, + { + "frontendOnlyPreload": "lib/browser-only/preload/frontend-only-preload-module" + }, + { + "frontend": "lib/browser/i18n/i18n-frontend-module", + "frontendOnly": "lib/browser-only/i18n/i18n-frontend-only-module", + "backend": "lib/node/i18n/i18n-backend-module" + }, + { + "frontend": "lib/browser/menu/browser-menu-module", + "frontendElectron": "lib/electron-browser/menu/electron-menu-module" + }, + { + "frontend": "lib/browser/window/browser-window-module", + "frontendElectron": "lib/electron-browser/window/electron-window-module", + "backendElectron": "lib/electron-node/window/electron-window-module" + }, + { + "backendElectron": "lib/electron-node/cli/electron-backend-cli-module" + }, + { + "frontend": "lib/browser/keyboard/browser-keyboard-module", + "frontendElectron": "lib/electron-browser/keyboard/electron-keyboard-module", + "backendElectron": "lib/electron-node/keyboard/electron-backend-keyboard-module" + }, + { + "frontendElectron": "lib/electron-browser/token/electron-token-frontend-module", + "backendElectron": "lib/electron-node/token/electron-token-backend-module" + }, + { + "backend": "lib/node/hosting/backend-hosting-module", + "backendElectron": "lib/electron-node/hosting/electron-backend-hosting-module" + }, + { + "frontend": "lib/browser/request/browser-request-module", + "frontendElectron": "lib/electron-browser/request/electron-browser-request-module" + }, + { + "backend": "lib/node/request/backend-request-module", + "backendElectron": "lib/electron-node/request/electron-backend-request-module" + } + ], + "keywords": [ + "theia-extension" + ], + "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", + "repository": { + "type": "git", + "url": "https://github.com/eclipse-theia/theia.git" + }, + "bugs": { + "url": "https://github.com/eclipse-theia/theia/issues" + }, + "homepage": "https://github.com/eclipse-theia/theia", + "files": [ + "electron-shared", + "i18n", + "lib", + "shared", + "src" + ], + "scripts": { + "build": "theiaext build", + "clean": "theiaext clean", + "compile": "theiaext compile", + "generate-layout": "electron ./scripts/generate-layout", + "afterInstall": "npm run generate-theia-re-exports && npm run download:json-schema", + "generate-theia-re-exports": "theia-re-exports generate && theia-re-exports template README_TEMPLATE.md > README.md", + "lint": "theiaext lint", + "download:json-schema": "node ./scripts/download-catalog.js", + "test": "theiaext test", + "version": "npm run -s generate-theia-re-exports", + "watch": "theiaext watch" + }, + "devDependencies": { + "@theia/ext-scripts": "1.68.0", + "@theia/re-exports": "1.68.0", + "minimist": "^1.2.0", + "nodejs-file-downloader": "4.13.0" + }, + "nyc": { + "extends": "../../configs/nyc.json" + }, + "gitHead": "21358137e41342742707f660b8e222f940a27652" +} diff --git a/packages/core/scripts/download-catalog.js b/packages/core/scripts/download-catalog.js new file mode 100644 index 0000000..1467d82 --- /dev/null +++ b/packages/core/scripts/download-catalog.js @@ -0,0 +1,64 @@ +// ***************************************************************************** +// Copyright (C) 2024 STMicroelectronics and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** +const path = require('path'); +const { Downloader } = require('nodejs-file-downloader'); + +const url = 'https://schemastore.org/api/json/catalog.json'; + +const targetDir = './lib/browser'; +const fileName = 'catalog.json'; +const targetFile = path.join(targetDir, fileName); + +const downloader = new Downloader({ + url, + directory: targetDir, + fileName: 'catalog.json', + timeout: 60000, + proxy: process.env.http_proxy + || process.env.HTTP_PROXY + || process.env.https_proxy + || process.env.HTTPS_PROXY + || '', + cloneFiles: false +}); + +downloader.download().catch(error => { + const errorMessage = ` +Failed to download ${fileName} from schemastore.org +Error: ${error.message} + +This is likely due to one of the following issues: + 1. Network connectivity issues + 2. Proxy configuration needed + 3. SSL certificate validation failure + +Possible workarounds: + + 1. If behind a proxy, set proxy environment variables: + export HTTPS_PROXY=http://your-proxy:port + export HTTP_PROXY=http://your-proxy:port + + 2. If you have to use specific SSL certificates: + export NODE_EXTRA_CA_CERTS=/path/to/certificate.crt + + 3. Download the file manually and place it at: + ${targetFile} + Download from: ${url} + Adapt core npm scripts to skip automatic download. +`; + console.error(errorMessage); + process.exit(1); +}); diff --git a/packages/core/scripts/generate-layout.js b/packages/core/scripts/generate-layout.js new file mode 100644 index 0000000..19aaa6e --- /dev/null +++ b/packages/core/scripts/generate-layout.js @@ -0,0 +1,91 @@ +// ***************************************************************************** +// Copyright (C) 2019 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +const parseArgs = require('minimist'); +const nativeKeymap = require('native-keymap'); +const fs = require('fs'); +const electron = require('electron'); + +/* + * Generate keyboard layouts for using Theia as web application. + * + * Usage: + * npm run generate-layout [--info] [--all] [--pretty] [--output file] + * + * --info Print the keyboard layout information; if omitted, the full + * keyboard layout with info and mapping is printed. + * --all Include all keys in the output, not only the relevant ones. + * --pretty Pretty-print the JSON output. + * --output file Write the output to the given file instead of stdout. + * + * Hint: keyboard layouts are stored in packages/core/src/common/keyboard/layouts + * and have the following file name scheme: + * --.json + * + * A language subtag according to IETF BCP 47 + * Display name of the keyboard layout (without dashes) + * `pc` or `mac` + */ +const args = parseArgs(process.argv); +const printInfo = args['info']; +const includeAll = args['all']; +const prettyPrint = args['pretty']; +const outFile = args['output']; + +let output; +if (printInfo) { + output = nativeKeymap.getCurrentKeyboardLayout(); +} else { + output = { + info: nativeKeymap.getCurrentKeyboardLayout(), + mapping: nativeKeymap.getKeyMap() + }; + if (!includeAll) { + // We store only key codes for the "writing system keys" as defined here: + // https://w3c.github.io/uievents-code/#writing-system-keys + const ACCEPTED_CODES = [ + 'KeyA', 'KeyB', 'KeyC', 'KeyD', 'KeyE', 'KeyF', 'KeyG', 'KeyH', 'KeyI', 'KeyJ', 'KeyK', 'KeyL', 'KeyM', + 'KeyN', 'KeyO', 'KeyP', 'KeyQ', 'KeyR', 'KeyS', 'KeyT', 'KeyU', 'KeyV', 'KeyW', 'KeyX', 'KeyY', 'KeyZ', + 'Digit1', 'Digit2', 'Digit3', 'Digit4', 'Digit5', 'Digit6', 'Digit7', 'Digit8', 'Digit9', 'Digit0', + 'Minus', 'Equal', 'BracketLeft', 'BracketRight', 'Backslash', 'Semicolon', 'Quote', 'Backquote', + 'Comma', 'Period', 'Slash', 'IntlBackslash', 'IntlRo', 'IntlYen' + ]; + const ACCEPTED_VARIANTS = ['value', 'withShift', 'withAltGr', 'withShiftAltGr', 'vkey']; + for (let code of Object.keys(output.mapping)) { + if (ACCEPTED_CODES.indexOf(code) < 0) { + delete output.mapping[code]; + } else { + for (let variant of Object.keys(output.mapping[code])) { + if (ACCEPTED_VARIANTS.indexOf(variant) < 0 || output.mapping[code][variant] === '') { + delete output.mapping[code][variant]; + } + } + if (Object.keys(output.mapping[code]).length === 0) { + delete output.mapping[code]; + } + } + } + } +} + +const stringOutput = JSON.stringify(output, undefined, prettyPrint ? 2 : undefined); +if (outFile) { + fs.writeFileSync(outFile, stringOutput); +} else { + console.log(stringOutput); +} + +electron.app.quit(); diff --git a/packages/core/shared/@lumino/algorithm/index.d.ts b/packages/core/shared/@lumino/algorithm/index.d.ts new file mode 100644 index 0000000..26a0bd8 --- /dev/null +++ b/packages/core/shared/@lumino/algorithm/index.d.ts @@ -0,0 +1 @@ +export * from '@lumino/algorithm'; diff --git a/packages/core/shared/@lumino/algorithm/index.js b/packages/core/shared/@lumino/algorithm/index.js new file mode 100644 index 0000000..0984b13 --- /dev/null +++ b/packages/core/shared/@lumino/algorithm/index.js @@ -0,0 +1 @@ +module.exports = require('@lumino/algorithm'); diff --git a/packages/core/shared/@lumino/commands/index.d.ts b/packages/core/shared/@lumino/commands/index.d.ts new file mode 100644 index 0000000..cc7f16a --- /dev/null +++ b/packages/core/shared/@lumino/commands/index.d.ts @@ -0,0 +1 @@ +export * from '@lumino/commands'; diff --git a/packages/core/shared/@lumino/commands/index.js b/packages/core/shared/@lumino/commands/index.js new file mode 100644 index 0000000..dbd6930 --- /dev/null +++ b/packages/core/shared/@lumino/commands/index.js @@ -0,0 +1 @@ +module.exports = require('@lumino/commands'); diff --git a/packages/core/shared/@lumino/coreutils/index.d.ts b/packages/core/shared/@lumino/coreutils/index.d.ts new file mode 100644 index 0000000..85e2664 --- /dev/null +++ b/packages/core/shared/@lumino/coreutils/index.d.ts @@ -0,0 +1 @@ +export * from '@lumino/coreutils'; diff --git a/packages/core/shared/@lumino/coreutils/index.js b/packages/core/shared/@lumino/coreutils/index.js new file mode 100644 index 0000000..375092f --- /dev/null +++ b/packages/core/shared/@lumino/coreutils/index.js @@ -0,0 +1 @@ +module.exports = require('@lumino/coreutils'); diff --git a/packages/core/shared/@lumino/domutils/index.d.ts b/packages/core/shared/@lumino/domutils/index.d.ts new file mode 100644 index 0000000..6a896aa --- /dev/null +++ b/packages/core/shared/@lumino/domutils/index.d.ts @@ -0,0 +1 @@ +export * from '@lumino/domutils'; diff --git a/packages/core/shared/@lumino/domutils/index.js b/packages/core/shared/@lumino/domutils/index.js new file mode 100644 index 0000000..eb65672 --- /dev/null +++ b/packages/core/shared/@lumino/domutils/index.js @@ -0,0 +1 @@ +module.exports = require('@lumino/domutils'); diff --git a/packages/core/shared/@lumino/dragdrop/index.d.ts b/packages/core/shared/@lumino/dragdrop/index.d.ts new file mode 100644 index 0000000..644f2b6 --- /dev/null +++ b/packages/core/shared/@lumino/dragdrop/index.d.ts @@ -0,0 +1 @@ +export * from '@lumino/dragdrop'; diff --git a/packages/core/shared/@lumino/dragdrop/index.js b/packages/core/shared/@lumino/dragdrop/index.js new file mode 100644 index 0000000..5f914cf --- /dev/null +++ b/packages/core/shared/@lumino/dragdrop/index.js @@ -0,0 +1 @@ +module.exports = require('@lumino/dragdrop'); diff --git a/packages/core/shared/@lumino/messaging/index.d.ts b/packages/core/shared/@lumino/messaging/index.d.ts new file mode 100644 index 0000000..4a64509 --- /dev/null +++ b/packages/core/shared/@lumino/messaging/index.d.ts @@ -0,0 +1 @@ +export * from '@lumino/messaging'; diff --git a/packages/core/shared/@lumino/messaging/index.js b/packages/core/shared/@lumino/messaging/index.js new file mode 100644 index 0000000..c7ce1c7 --- /dev/null +++ b/packages/core/shared/@lumino/messaging/index.js @@ -0,0 +1 @@ +module.exports = require('@lumino/messaging'); diff --git a/packages/core/shared/@lumino/properties/index.d.ts b/packages/core/shared/@lumino/properties/index.d.ts new file mode 100644 index 0000000..97c4bf8 --- /dev/null +++ b/packages/core/shared/@lumino/properties/index.d.ts @@ -0,0 +1 @@ +export * from '@lumino/properties'; diff --git a/packages/core/shared/@lumino/properties/index.js b/packages/core/shared/@lumino/properties/index.js new file mode 100644 index 0000000..b4da58a --- /dev/null +++ b/packages/core/shared/@lumino/properties/index.js @@ -0,0 +1 @@ +module.exports = require('@lumino/properties'); diff --git a/packages/core/shared/@lumino/signaling/index.d.ts b/packages/core/shared/@lumino/signaling/index.d.ts new file mode 100644 index 0000000..cbeaee1 --- /dev/null +++ b/packages/core/shared/@lumino/signaling/index.d.ts @@ -0,0 +1 @@ +export * from '@lumino/signaling'; diff --git a/packages/core/shared/@lumino/signaling/index.js b/packages/core/shared/@lumino/signaling/index.js new file mode 100644 index 0000000..82c117b --- /dev/null +++ b/packages/core/shared/@lumino/signaling/index.js @@ -0,0 +1 @@ +module.exports = require('@lumino/signaling'); diff --git a/packages/core/shared/@lumino/virtualdom/index.d.ts b/packages/core/shared/@lumino/virtualdom/index.d.ts new file mode 100644 index 0000000..7658440 --- /dev/null +++ b/packages/core/shared/@lumino/virtualdom/index.d.ts @@ -0,0 +1 @@ +export * from '@lumino/virtualdom'; diff --git a/packages/core/shared/@lumino/virtualdom/index.js b/packages/core/shared/@lumino/virtualdom/index.js new file mode 100644 index 0000000..7b27c8e --- /dev/null +++ b/packages/core/shared/@lumino/virtualdom/index.js @@ -0,0 +1 @@ +module.exports = require('@lumino/virtualdom'); diff --git a/packages/core/shared/@lumino/widgets/index.d.ts b/packages/core/shared/@lumino/widgets/index.d.ts new file mode 100644 index 0000000..e5fad1a --- /dev/null +++ b/packages/core/shared/@lumino/widgets/index.d.ts @@ -0,0 +1 @@ +export * from '@lumino/widgets'; diff --git a/packages/core/shared/@lumino/widgets/index.js b/packages/core/shared/@lumino/widgets/index.js new file mode 100644 index 0000000..e295371 --- /dev/null +++ b/packages/core/shared/@lumino/widgets/index.js @@ -0,0 +1 @@ +module.exports = require('@lumino/widgets'); diff --git a/packages/core/shared/@parcel/watcher/index.d.ts b/packages/core/shared/@parcel/watcher/index.d.ts new file mode 100644 index 0000000..70c4fec --- /dev/null +++ b/packages/core/shared/@parcel/watcher/index.d.ts @@ -0,0 +1,2 @@ +import parcelWatcher = require('@parcel/watcher'); +export = parcelWatcher; diff --git a/packages/core/shared/@parcel/watcher/index.js b/packages/core/shared/@parcel/watcher/index.js new file mode 100644 index 0000000..cc9f177 --- /dev/null +++ b/packages/core/shared/@parcel/watcher/index.js @@ -0,0 +1 @@ +module.exports = require('@parcel/watcher'); diff --git a/packages/core/shared/@theia/application-package/index.d.ts b/packages/core/shared/@theia/application-package/index.d.ts new file mode 100644 index 0000000..b1ff507 --- /dev/null +++ b/packages/core/shared/@theia/application-package/index.d.ts @@ -0,0 +1 @@ +export * from '@theia/application-package'; diff --git a/packages/core/shared/@theia/application-package/index.js b/packages/core/shared/@theia/application-package/index.js new file mode 100644 index 0000000..52ba361 --- /dev/null +++ b/packages/core/shared/@theia/application-package/index.js @@ -0,0 +1 @@ +module.exports = require('@theia/application-package'); diff --git a/packages/core/shared/@theia/request/index.d.ts b/packages/core/shared/@theia/request/index.d.ts new file mode 100644 index 0000000..3b1a868 --- /dev/null +++ b/packages/core/shared/@theia/request/index.d.ts @@ -0,0 +1 @@ +export * from '@theia/request'; diff --git a/packages/core/shared/@theia/request/index.js b/packages/core/shared/@theia/request/index.js new file mode 100644 index 0000000..1e4a387 --- /dev/null +++ b/packages/core/shared/@theia/request/index.js @@ -0,0 +1 @@ +module.exports = require('@theia/request'); diff --git a/packages/core/shared/ajv/index.d.ts b/packages/core/shared/ajv/index.d.ts new file mode 100644 index 0000000..4d2b081 --- /dev/null +++ b/packages/core/shared/ajv/index.d.ts @@ -0,0 +1,2 @@ +import Ajv = require('ajv'); +export = Ajv; diff --git a/packages/core/shared/ajv/index.js b/packages/core/shared/ajv/index.js new file mode 100644 index 0000000..d83f0d2 --- /dev/null +++ b/packages/core/shared/ajv/index.js @@ -0,0 +1 @@ +module.exports = require('ajv'); \ No newline at end of file diff --git a/packages/core/shared/dompurify/index.d.ts b/packages/core/shared/dompurify/index.d.ts new file mode 100644 index 0000000..9d43dd6 --- /dev/null +++ b/packages/core/shared/dompurify/index.d.ts @@ -0,0 +1,2 @@ +import DOMPurify = require('dompurify'); +export = DOMPurify; diff --git a/packages/core/shared/dompurify/index.js b/packages/core/shared/dompurify/index.js new file mode 100644 index 0000000..49f7e68 --- /dev/null +++ b/packages/core/shared/dompurify/index.js @@ -0,0 +1 @@ +module.exports = require('dompurify'); diff --git a/packages/core/shared/express/index.d.ts b/packages/core/shared/express/index.d.ts new file mode 100644 index 0000000..fe3deaf --- /dev/null +++ b/packages/core/shared/express/index.d.ts @@ -0,0 +1,2 @@ +import express = require('express'); +export = express; diff --git a/packages/core/shared/express/index.js b/packages/core/shared/express/index.js new file mode 100644 index 0000000..ec32af7 --- /dev/null +++ b/packages/core/shared/express/index.js @@ -0,0 +1 @@ +module.exports = require('express'); diff --git a/packages/core/shared/fs-extra/index.d.ts b/packages/core/shared/fs-extra/index.d.ts new file mode 100644 index 0000000..3cf9737 --- /dev/null +++ b/packages/core/shared/fs-extra/index.d.ts @@ -0,0 +1 @@ +export * from 'fs-extra'; diff --git a/packages/core/shared/fs-extra/index.js b/packages/core/shared/fs-extra/index.js new file mode 100644 index 0000000..56937d3 --- /dev/null +++ b/packages/core/shared/fs-extra/index.js @@ -0,0 +1 @@ +module.exports = require('fs-extra'); diff --git a/packages/core/shared/fuzzy/index.d.ts b/packages/core/shared/fuzzy/index.d.ts new file mode 100644 index 0000000..2e0353f --- /dev/null +++ b/packages/core/shared/fuzzy/index.d.ts @@ -0,0 +1 @@ +export * from 'fuzzy'; diff --git a/packages/core/shared/fuzzy/index.js b/packages/core/shared/fuzzy/index.js new file mode 100644 index 0000000..f8737bd --- /dev/null +++ b/packages/core/shared/fuzzy/index.js @@ -0,0 +1 @@ +module.exports = require('fuzzy'); diff --git a/packages/core/shared/inversify/index.d.ts b/packages/core/shared/inversify/index.d.ts new file mode 100644 index 0000000..4afe0de --- /dev/null +++ b/packages/core/shared/inversify/index.d.ts @@ -0,0 +1 @@ +export * from 'inversify'; diff --git a/packages/core/shared/inversify/index.js b/packages/core/shared/inversify/index.js new file mode 100644 index 0000000..bbbb255 --- /dev/null +++ b/packages/core/shared/inversify/index.js @@ -0,0 +1 @@ +module.exports = require('inversify'); diff --git a/packages/core/shared/lodash.debounce/index.d.ts b/packages/core/shared/lodash.debounce/index.d.ts new file mode 100644 index 0000000..6f86c9a --- /dev/null +++ b/packages/core/shared/lodash.debounce/index.d.ts @@ -0,0 +1,2 @@ +import debounce = require('lodash.debounce'); +export = debounce; diff --git a/packages/core/shared/lodash.debounce/index.js b/packages/core/shared/lodash.debounce/index.js new file mode 100644 index 0000000..29aa779 --- /dev/null +++ b/packages/core/shared/lodash.debounce/index.js @@ -0,0 +1 @@ +module.exports = require('lodash.debounce'); diff --git a/packages/core/shared/lodash.throttle/index.d.ts b/packages/core/shared/lodash.throttle/index.d.ts new file mode 100644 index 0000000..c24f905 --- /dev/null +++ b/packages/core/shared/lodash.throttle/index.d.ts @@ -0,0 +1,2 @@ +import throttle = require('lodash.throttle'); +export = throttle; diff --git a/packages/core/shared/lodash.throttle/index.js b/packages/core/shared/lodash.throttle/index.js new file mode 100644 index 0000000..b906727 --- /dev/null +++ b/packages/core/shared/lodash.throttle/index.js @@ -0,0 +1 @@ +module.exports = require('lodash.throttle'); diff --git a/packages/core/shared/markdown-it-anchor/index.d.ts b/packages/core/shared/markdown-it-anchor/index.d.ts new file mode 100644 index 0000000..dca98b2 --- /dev/null +++ b/packages/core/shared/markdown-it-anchor/index.d.ts @@ -0,0 +1,2 @@ +import markdownitanchor = require('markdown-it-anchor'); +export = markdownitanchor; diff --git a/packages/core/shared/markdown-it-anchor/index.js b/packages/core/shared/markdown-it-anchor/index.js new file mode 100644 index 0000000..8f67e81 --- /dev/null +++ b/packages/core/shared/markdown-it-anchor/index.js @@ -0,0 +1 @@ +module.exports = require('markdown-it-anchor'); diff --git a/packages/core/shared/markdown-it-emoji/index.d.ts b/packages/core/shared/markdown-it-emoji/index.d.ts new file mode 100644 index 0000000..4beade9 --- /dev/null +++ b/packages/core/shared/markdown-it-emoji/index.d.ts @@ -0,0 +1,2 @@ +import markdownitemoji = require('markdown-it-emoji'); +export = markdownitemoji; diff --git a/packages/core/shared/markdown-it-emoji/index.js b/packages/core/shared/markdown-it-emoji/index.js new file mode 100644 index 0000000..8050579 --- /dev/null +++ b/packages/core/shared/markdown-it-emoji/index.js @@ -0,0 +1 @@ +module.exports = require('markdown-it-emoji'); diff --git a/packages/core/shared/markdown-it.d.ts b/packages/core/shared/markdown-it.d.ts new file mode 100644 index 0000000..871a06d --- /dev/null +++ b/packages/core/shared/markdown-it.d.ts @@ -0,0 +1,2 @@ +import markdownit = require('markdown-it'); +export = markdownit; diff --git a/packages/core/shared/markdown-it.js b/packages/core/shared/markdown-it.js new file mode 100644 index 0000000..f40bcfe --- /dev/null +++ b/packages/core/shared/markdown-it.js @@ -0,0 +1 @@ +module.exports = require('markdown-it'); diff --git a/packages/core/shared/markdown-it/index.d.ts b/packages/core/shared/markdown-it/index.d.ts new file mode 100644 index 0000000..871a06d --- /dev/null +++ b/packages/core/shared/markdown-it/index.d.ts @@ -0,0 +1,2 @@ +import markdownit = require('markdown-it'); +export = markdownit; diff --git a/packages/core/shared/markdown-it/index.js b/packages/core/shared/markdown-it/index.js new file mode 100644 index 0000000..f40bcfe --- /dev/null +++ b/packages/core/shared/markdown-it/index.js @@ -0,0 +1 @@ +module.exports = require('markdown-it'); diff --git a/packages/core/shared/react-dom/client/index.d.ts b/packages/core/shared/react-dom/client/index.d.ts new file mode 100644 index 0000000..f34a1f2 --- /dev/null +++ b/packages/core/shared/react-dom/client/index.d.ts @@ -0,0 +1 @@ +export * from 'react-dom/client'; diff --git a/packages/core/shared/react-dom/client/index.js b/packages/core/shared/react-dom/client/index.js new file mode 100644 index 0000000..ed832bc --- /dev/null +++ b/packages/core/shared/react-dom/client/index.js @@ -0,0 +1 @@ +module.exports = require('react-dom/client'); diff --git a/packages/core/shared/react-dom/index.d.ts b/packages/core/shared/react-dom/index.d.ts new file mode 100644 index 0000000..2a69d4b --- /dev/null +++ b/packages/core/shared/react-dom/index.d.ts @@ -0,0 +1 @@ +export * from 'react-dom'; diff --git a/packages/core/shared/react-dom/index.js b/packages/core/shared/react-dom/index.js new file mode 100644 index 0000000..1ca791c --- /dev/null +++ b/packages/core/shared/react-dom/index.js @@ -0,0 +1 @@ +module.exports = require('react-dom'); diff --git a/packages/core/shared/react-virtuoso/index.d.ts b/packages/core/shared/react-virtuoso/index.d.ts new file mode 100644 index 0000000..3755866 --- /dev/null +++ b/packages/core/shared/react-virtuoso/index.d.ts @@ -0,0 +1 @@ +export * from 'react-virtuoso'; diff --git a/packages/core/shared/react-virtuoso/index.js b/packages/core/shared/react-virtuoso/index.js new file mode 100644 index 0000000..b286c10 --- /dev/null +++ b/packages/core/shared/react-virtuoso/index.js @@ -0,0 +1 @@ +module.exports = require('react-virtuoso'); diff --git a/packages/core/shared/react/index.d.ts b/packages/core/shared/react/index.d.ts new file mode 100644 index 0000000..3190a0b --- /dev/null +++ b/packages/core/shared/react/index.d.ts @@ -0,0 +1,2 @@ +import React = require('react'); +export = React; diff --git a/packages/core/shared/react/index.js b/packages/core/shared/react/index.js new file mode 100644 index 0000000..01a540c --- /dev/null +++ b/packages/core/shared/react/index.js @@ -0,0 +1 @@ +module.exports = require('react'); diff --git a/packages/core/shared/reflect-metadata/index.d.ts b/packages/core/shared/reflect-metadata/index.d.ts new file mode 100644 index 0000000..7b873b4 --- /dev/null +++ b/packages/core/shared/reflect-metadata/index.d.ts @@ -0,0 +1 @@ +export * from 'reflect-metadata'; diff --git a/packages/core/shared/reflect-metadata/index.js b/packages/core/shared/reflect-metadata/index.js new file mode 100644 index 0000000..2184c27 --- /dev/null +++ b/packages/core/shared/reflect-metadata/index.js @@ -0,0 +1 @@ +module.exports = require('reflect-metadata'); diff --git a/packages/core/shared/vscode-languageserver-protocol/index.d.ts b/packages/core/shared/vscode-languageserver-protocol/index.d.ts new file mode 100644 index 0000000..c45d2d3 --- /dev/null +++ b/packages/core/shared/vscode-languageserver-protocol/index.d.ts @@ -0,0 +1 @@ +export * from 'vscode-languageserver-protocol'; diff --git a/packages/core/shared/vscode-languageserver-protocol/index.js b/packages/core/shared/vscode-languageserver-protocol/index.js new file mode 100644 index 0000000..9481470 --- /dev/null +++ b/packages/core/shared/vscode-languageserver-protocol/index.js @@ -0,0 +1 @@ +module.exports = require('vscode-languageserver-protocol'); diff --git a/packages/core/shared/vscode-languageserver-types/index.d.ts b/packages/core/shared/vscode-languageserver-types/index.d.ts new file mode 100644 index 0000000..70f5f9d --- /dev/null +++ b/packages/core/shared/vscode-languageserver-types/index.d.ts @@ -0,0 +1 @@ +export * from 'vscode-languageserver-types'; diff --git a/packages/core/shared/vscode-languageserver-types/index.js b/packages/core/shared/vscode-languageserver-types/index.js new file mode 100644 index 0000000..cfa01a1 --- /dev/null +++ b/packages/core/shared/vscode-languageserver-types/index.js @@ -0,0 +1 @@ +module.exports = require('vscode-languageserver-types'); \ No newline at end of file diff --git a/packages/core/shared/vscode-uri/index.d.ts b/packages/core/shared/vscode-uri/index.d.ts new file mode 100644 index 0000000..cd3a0f3 --- /dev/null +++ b/packages/core/shared/vscode-uri/index.d.ts @@ -0,0 +1 @@ +export * from 'vscode-uri'; diff --git a/packages/core/shared/vscode-uri/index.js b/packages/core/shared/vscode-uri/index.js new file mode 100644 index 0000000..45afd3d --- /dev/null +++ b/packages/core/shared/vscode-uri/index.js @@ -0,0 +1 @@ +module.exports = require('vscode-uri'); diff --git a/packages/core/shared/ws/index.d.ts b/packages/core/shared/ws/index.d.ts new file mode 100644 index 0000000..c72fcac --- /dev/null +++ b/packages/core/shared/ws/index.d.ts @@ -0,0 +1,2 @@ +import WebSocket = require('ws'); +export = WebSocket; diff --git a/packages/core/shared/ws/index.js b/packages/core/shared/ws/index.js new file mode 100644 index 0000000..5067367 --- /dev/null +++ b/packages/core/shared/ws/index.js @@ -0,0 +1 @@ +module.exports = require('ws'); diff --git a/packages/core/shared/yargs/index.d.ts b/packages/core/shared/yargs/index.d.ts new file mode 100644 index 0000000..97150db --- /dev/null +++ b/packages/core/shared/yargs/index.d.ts @@ -0,0 +1,2 @@ +import yargs = require('yargs'); +export = yargs; diff --git a/packages/core/shared/yargs/index.js b/packages/core/shared/yargs/index.js new file mode 100644 index 0000000..17077c2 --- /dev/null +++ b/packages/core/shared/yargs/index.js @@ -0,0 +1 @@ +module.exports = require('yargs'); diff --git a/packages/core/src/browser-only/frontend-only-application-module.ts b/packages/core/src/browser-only/frontend-only-application-module.ts new file mode 100644 index 0000000..614eec3 --- /dev/null +++ b/packages/core/src/browser-only/frontend-only-application-module.ts @@ -0,0 +1,117 @@ +// ***************************************************************************** +// Copyright (C) 2023 EclipseSource and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { ContainerModule } from 'inversify'; +import { BackendStopwatch, CommandRegistry, Emitter, MeasurementOptions, OS } from '../common'; +import { ApplicationInfo, ApplicationServer, ExtensionInfo } from '../common/application-protocol'; +import { EnvVariable, EnvVariablesServer } from './../common/env-variables'; +import { bindMessageService } from '../browser/frontend-application-bindings'; +import { KeyStoreService } from '../common/key-store'; +import { QuickPickService } from '../common/quick-pick-service'; +import { QuickPickServiceImpl } from '../browser/quick-input'; +import { BackendRequestService, RequestService } from '@theia/request'; +import { ConnectionStatus, ConnectionStatusService } from '../browser/connection-status-service'; + +export { bindMessageService }; + +// is loaded directly after the regular frontend module +export const frontendOnlyApplicationModule = new ContainerModule((bind, unbind, isBound, rebind) => { + + if (isBound(CommandRegistry)) { + rebind(CommandRegistry).toSelf().inSingletonScope(); + } else { + bind(CommandRegistry).toSelf().inSingletonScope(); + } + + const stopwatch: BackendStopwatch = { + start: async (_name: string, _options?: MeasurementOptions | undefined): Promise => -1, + stop: async (_measurement: number, _message: string, _messageArgs: unknown[]): Promise => { } + }; + if (isBound(BackendStopwatch)) { + rebind(BackendStopwatch).toConstantValue(stopwatch); + } else { + bind(BackendStopwatch).toConstantValue(stopwatch); + } + + if (isBound(CommandRegistry)) { + rebind(QuickPickService).to(QuickPickServiceImpl).inSingletonScope(); + } else { + bind(QuickPickService).to(QuickPickServiceImpl).inSingletonScope(); + } + + const mockedApplicationServer: ApplicationServer = { + getExtensionsInfos: async (): Promise => [], + getApplicationInfo: async (): Promise => undefined, + getApplicationRoot: async (): Promise => '', + getApplicationPlatform: () => Promise.resolve('web'), + getBackendOS: async (): Promise => OS.Type.Linux + }; + if (isBound(ApplicationServer)) { + rebind(ApplicationServer).toConstantValue(mockedApplicationServer); + } else { + bind(ApplicationServer).toConstantValue(mockedApplicationServer); + } + + const varServer: EnvVariablesServer = { + getExecPath: async (): Promise => '', + getVariables: async (): Promise => [], + getValue: async (_key: string): Promise => undefined, + getConfigDirUri: async (): Promise => '', + getHomeDirUri: async (): Promise => '', + getDrives: async (): Promise => [] + }; + if (isBound(EnvVariablesServer)) { + rebind(EnvVariablesServer).toConstantValue(varServer); + } else { + bind(EnvVariablesServer).toConstantValue(varServer); + } + + const keyStoreService: KeyStoreService = { + deletePassword: () => Promise.resolve(false), + findCredentials: () => Promise.resolve([]), + findPassword: () => Promise.resolve(undefined), + setPassword: () => Promise.resolve(), + getPassword: () => Promise.resolve(undefined), + keys: () => Promise.resolve([]), + }; + if (isBound(KeyStoreService)) { + rebind(KeyStoreService).toConstantValue(keyStoreService); + } else { + bind(KeyStoreService).toConstantValue(keyStoreService); + } + + const requestService: RequestService = { + configure: () => Promise.resolve(), + request: () => Promise.reject(), + resolveProxy: () => Promise.resolve(undefined) + }; + if (isBound(BackendRequestService)) { + rebind(BackendRequestService).toConstantValue(requestService); + } else { + bind(BackendRequestService).toConstantValue(requestService); + } + + const connectionStatusService: ConnectionStatusService = { + currentStatus: ConnectionStatus.ONLINE, + onStatusChange: new Emitter().event + }; + if (isBound(ConnectionStatusService)) { + rebind(ConnectionStatusService).toConstantValue(connectionStatusService); + } else { + bind(ConnectionStatusService).toConstantValue(connectionStatusService); + } + +}); diff --git a/packages/core/src/browser-only/i18n/i18n-frontend-only-module.ts b/packages/core/src/browser-only/i18n/i18n-frontend-only-module.ts new file mode 100644 index 0000000..e88337f --- /dev/null +++ b/packages/core/src/browser-only/i18n/i18n-frontend-only-module.ts @@ -0,0 +1,37 @@ +// ***************************************************************************** +// Copyright (C) 2023 EclipseSource and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { ContainerModule } from 'inversify'; +import { AsyncLocalizationProvider, LanguageInfo, Localization } from '../../common/i18n/localization'; +import { LanguageQuickPickService } from '../../browser/i18n/language-quick-pick-service'; + +export default new ContainerModule(bind => { + const i18nMock: AsyncLocalizationProvider = { + getCurrentLanguage: async (): Promise => 'en', + setCurrentLanguage: async (_languageId: string): Promise => { + + }, + getAvailableLanguages: async (): Promise => + [] + , + loadLocalization: async (_languageId: string): Promise => ({ + translations: {}, + languageId: 'en' + }) + }; + bind(AsyncLocalizationProvider).toConstantValue(i18nMock); + bind(LanguageQuickPickService).toSelf().inSingletonScope(); +}); diff --git a/packages/core/src/browser-only/logger-frontend-only-module.ts b/packages/core/src/browser-only/logger-frontend-only-module.ts new file mode 100644 index 0000000..e5fc840 --- /dev/null +++ b/packages/core/src/browser-only/logger-frontend-only-module.ts @@ -0,0 +1,63 @@ +// ***************************************************************************** +// Copyright (C) 2023 EclipseSource and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { ContainerModule, Container } from 'inversify'; +import { ILoggerServer, ILoggerClient, LogLevel, ConsoleLogger } from '../common/logger-protocol'; +import { ILogger, Logger, LoggerFactory, LoggerName } from '../common/logger'; + +// is loaded directly after the regular logger frontend module +export const loggerFrontendOnlyModule = new ContainerModule((bind, unbind, isBound, rebind) => { + const logger: ILoggerServer = { + setLogLevel: async (_name: string, _logLevel: number): Promise => { }, + getLogLevel: async (_name: string): Promise => LogLevel.INFO, + log: async (name: string, logLevel: number, message: string, params: unknown[]): Promise => { + ConsoleLogger.log(name, logLevel, message, params); + + }, + child: async (_name: string): Promise => { }, + dispose: (): void => { + }, + setClient: (_client: ILoggerClient | undefined): void => { + } + }; + if (isBound(ILoggerServer)) { + rebind(ILoggerServer).toConstantValue(logger); + } else { + bind(ILoggerServer).toConstantValue(logger); + } + + if (isBound(ILoggerServer)) { + rebind(LoggerFactory).toFactory(ctx => + (name: string) => { + const child = new Container({ defaultScope: 'Singleton' }); + child.parent = ctx.container; + child.bind(ILogger).to(Logger).inTransientScope(); + child.bind(LoggerName).toConstantValue(name); + return child.get(ILogger); + } + ); + } else { + bind(LoggerFactory).toFactory(ctx => + (name: string) => { + const child = new Container({ defaultScope: 'Singleton' }); + child.parent = ctx.container; + child.bind(ILogger).to(Logger).inTransientScope(); + child.bind(LoggerName).toConstantValue(name); + return child.get(ILogger); + } + ); + } +}); diff --git a/packages/core/src/browser-only/messaging/frontend-only-service-connection-provider.ts b/packages/core/src/browser-only/messaging/frontend-only-service-connection-provider.ts new file mode 100644 index 0000000..e220856 --- /dev/null +++ b/packages/core/src/browser-only/messaging/frontend-only-service-connection-provider.ts @@ -0,0 +1,39 @@ +// ***************************************************************************** +// Copyright (C) 2023 EclipseSource and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** +import { Event, RpcProxy, Channel, RpcProxyFactory, Emitter } from '../../common'; +import { injectable } from 'inversify'; +import { ServiceConnectionProvider } from '../../browser/messaging/service-connection-provider'; +import { ConnectionSource } from '../../browser/messaging/connection-source'; + +@injectable() +export class FrontendOnlyConnectionSource implements ConnectionSource { + onConnectionDidOpen = new Emitter().event; +} + +@injectable() +export class FrontendOnlyServiceConnectionProvider extends ServiceConnectionProvider { + onSocketDidOpen = Event.None; + onSocketDidClose = Event.None; + onIncomingMessageActivity = Event.None; + override createProxy(path: unknown, target?: unknown): RpcProxy { + console.debug(`[Frontend-Only Fallback] Created proxy connection for ${path}`); + const factory = target instanceof RpcProxyFactory ? target : new RpcProxyFactory(target); + return factory.createProxy(); + } + override listen(path: string, handler: ServiceConnectionProvider.ConnectionHandler, reconnect: boolean): void { + console.debug('[Frontend-Only Fallback] Listen to websocket connection requested'); + } +} diff --git a/packages/core/src/browser-only/messaging/messaging-frontend-only-module.ts b/packages/core/src/browser-only/messaging/messaging-frontend-only-module.ts new file mode 100644 index 0000000..5502910 --- /dev/null +++ b/packages/core/src/browser-only/messaging/messaging-frontend-only-module.ts @@ -0,0 +1,42 @@ +// ***************************************************************************** +// Copyright (C) 2023 EclipseSource and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** +import { ContainerModule } from 'inversify'; +import { WebSocketConnectionSource } from '../../browser/messaging/ws-connection-source'; +import { FrontendOnlyConnectionSource, FrontendOnlyServiceConnectionProvider } from './frontend-only-service-connection-provider'; +import { ConnectionSource } from '../../browser/messaging/connection-source'; +import { LocalConnectionProvider, RemoteConnectionProvider } from '../../browser/messaging/service-connection-provider'; + +// is loaded directly after the regular message frontend module +export const messagingFrontendOnlyModule = new ContainerModule((bind, unbind, isBound, rebind) => { + unbind(WebSocketConnectionSource); + bind(FrontendOnlyConnectionSource).toSelf().inSingletonScope(); + if (isBound(ConnectionSource)) { + rebind(ConnectionSource).toService(FrontendOnlyConnectionSource); + } else { + bind(ConnectionSource).toService(FrontendOnlyConnectionSource); + } + bind(FrontendOnlyServiceConnectionProvider).toSelf().inSingletonScope(); + if (isBound(LocalConnectionProvider)) { + rebind(LocalConnectionProvider).toService(FrontendOnlyServiceConnectionProvider); + } else { + bind(LocalConnectionProvider).toService(FrontendOnlyServiceConnectionProvider); + } + if (isBound(RemoteConnectionProvider)) { + rebind(RemoteConnectionProvider).toService(FrontendOnlyServiceConnectionProvider); + } else { + bind(RemoteConnectionProvider).toService(FrontendOnlyServiceConnectionProvider); + } +}); diff --git a/packages/core/src/browser-only/preload/frontend-only-preload-module.ts b/packages/core/src/browser-only/preload/frontend-only-preload-module.ts new file mode 100644 index 0000000..ea0ed3f --- /dev/null +++ b/packages/core/src/browser-only/preload/frontend-only-preload-module.ts @@ -0,0 +1,49 @@ +// ***************************************************************************** +// Copyright (C) 2023 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { ContainerModule } from 'inversify'; +import { LocalizationServer } from '../../common/i18n/localization-server'; +import { OS, OSBackendProvider } from '../../common/os'; +import { Localization } from '../../common/i18n/localization'; + +// loaded after regular preload module +export default new ContainerModule((bind, unbind, isBound, rebind) => { + const frontendOnlyLocalizationServer: LocalizationServer = { + loadLocalization: async (languageId: string): Promise => ({ translations: {}, languageId }) + }; + if (isBound(LocalizationServer)) { + rebind(LocalizationServer).toConstantValue(frontendOnlyLocalizationServer); + } else { + bind(LocalizationServer).toConstantValue(frontendOnlyLocalizationServer); + } + + const frontendOnlyOSBackendProvider: OSBackendProvider = { + getBackendOS: async (): Promise => { + if (window.navigator.platform.startsWith('Win')) { + return OS.Type.Windows; + } else if (window.navigator.platform.startsWith('Mac')) { + return OS.Type.OSX; + } else { + return OS.Type.Linux; + } + } + }; + if (isBound(OSBackendProvider)) { + rebind(OSBackendProvider).toConstantValue(frontendOnlyOSBackendProvider); + } else { + bind(OSBackendProvider).toConstantValue(frontendOnlyOSBackendProvider); + } +}); diff --git a/packages/core/src/browser/about-dialog.tsx b/packages/core/src/browser/about-dialog.tsx new file mode 100644 index 0000000..831db1e --- /dev/null +++ b/packages/core/src/browser/about-dialog.tsx @@ -0,0 +1,138 @@ +// ***************************************************************************** +// Copyright (C) 2018 Ericsson and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import * as React from 'react'; +import { inject, injectable, postConstruct } from 'inversify'; +import { Dialog, DialogProps } from './dialogs'; +import { ReactDialog } from './dialogs/react-dialog'; +import { ApplicationServer, ApplicationInfo, ExtensionInfo } from '../common/application-protocol'; +import { Message } from './widgets/widget'; +import { FrontendApplicationConfigProvider } from './frontend-application-config-provider'; +import { DEFAULT_SUPPORTED_API_VERSION } from '@theia/application-package/lib/api'; +import { WindowService } from './window/window-service'; +import { Key, KeyCode } from './keys'; +import { nls } from '../common/nls'; + +export const ABOUT_CONTENT_CLASS = 'theia-aboutDialog'; +export const ABOUT_EXTENSIONS_CLASS = 'theia-aboutExtensions'; + +@injectable() +export class AboutDialogProps extends DialogProps { +} + +@injectable() +export class AboutDialog extends ReactDialog { + protected applicationInfo: ApplicationInfo | undefined; + protected extensionsInfos: ExtensionInfo[] = []; + protected readonly okButton: HTMLButtonElement; + + @inject(ApplicationServer) + protected readonly appServer: ApplicationServer; + + @inject(WindowService) + protected readonly windowService: WindowService; + + constructor( + @inject(AboutDialogProps) protected override readonly props: AboutDialogProps + ) { + super({ + title: FrontendApplicationConfigProvider.get().applicationName, + }); + this.appendAcceptButton(Dialog.OK); + } + + @postConstruct() + protected init(): void { + this.doInit(); + } + + protected async doInit(): Promise { + this.applicationInfo = await this.appServer.getApplicationInfo(); + this.extensionsInfos = await this.appServer.getExtensionsInfos(); + this.update(); + } + + protected renderHeader(): React.ReactNode { + const applicationInfo = this.applicationInfo; + const compatibilityUrl = 'https://eclipse-theia.github.io/vscode-theia-comparator/status.html'; + + const detailsLabel = nls.localizeByDefault('Details'); + const versionLabel = nls.localizeByDefault('Version'); + const defaultApiLabel = nls.localize('theia/core/about/defaultApi', 'Default {0} API', 'VS Code'); + const compatibilityLabel = nls.localize('theia/core/about/compatibility', '{0} Compatibility', 'VS Code'); + + return <> +

    {detailsLabel}

    +
    + {applicationInfo &&

    {`${versionLabel}: ${applicationInfo.version}`}

    } +

    {`${defaultApiLabel}: ${DEFAULT_SUPPORTED_API_VERSION}`}

    +

    + this.doOpenExternalLink(compatibilityUrl)} + onKeyDown={(e: React.KeyboardEvent) => this.doOpenExternalLinkEnter(e, compatibilityUrl)}> + {compatibilityLabel} + +

    +
    + ; + } + + protected renderExtensions(): React.ReactNode { + const extensionsInfos = this.extensionsInfos; + const listOfExtensions = nls.localize('theia/core/about/listOfExtensions', 'List of extensions'); + return <> +

    {listOfExtensions}

    +
      + { + extensionsInfos + .sort((a: ExtensionInfo, b: ExtensionInfo) => a.name.toLowerCase().localeCompare(b.name.toLowerCase())) + .map((extension: ExtensionInfo) =>
    • {extension.name} {extension.version}
    • ) + } +
    + ; + } + + protected render(): React.ReactNode { + return
    + {this.renderHeader()} + {this.renderExtensions()} +
    ; + } + + protected override onAfterAttach(msg: Message): void { + super.onAfterAttach(msg); + this.update(); + } + + /** + * Open a link in an external window. + * @param url the link. + */ + protected doOpenExternalLink = (url: string) => this.windowService.openNewWindow(url, { external: true }); + protected doOpenExternalLinkEnter = (e: React.KeyboardEvent, url: string) => { + if (this.isEnterKey(e)) { + this.doOpenExternalLink(url); + } + }; + + protected isEnterKey(e: React.KeyboardEvent): boolean { + return Key.ENTER.keyCode === KeyCode.createKeyCode(e.nativeEvent).key?.keyCode; + } + + get value(): undefined { return undefined; } +} diff --git a/packages/core/src/browser/authentication-service.ts b/packages/core/src/browser/authentication-service.ts new file mode 100644 index 0000000..138299f --- /dev/null +++ b/packages/core/src/browser/authentication-service.ts @@ -0,0 +1,515 @@ +// ***************************************************************************** +// Copyright (C) 2020 Red Hat, Inc. and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +// code copied and modified from https://github.com/microsoft/vscode/blob/1.47.3/src/vs/workbench/services/authentication/browser/authenticationService.ts + +import { injectable, inject, postConstruct } from 'inversify'; +import { Emitter, Event } from '../common/event'; +import { StorageService } from '../browser/storage-service'; +import { Disposable, DisposableCollection } from '../common/disposable'; +import { ACCOUNTS_MENU, ACCOUNTS_SUBMENU, MenuModelRegistry } from '../common/menu'; +import { Command, CommandRegistry } from '../common/command'; +import { nls } from '../common/nls'; + +export interface AuthenticationSessionAccountInformation { + readonly id: string; + readonly label: string; +} +export interface AuthenticationProviderSessionOptions { + /** + * The account that is being asked about. If this is passed in, the provider should + * attempt to return the sessions that are only related to this account. + */ + account?: AuthenticationSessionAccountInformation; +} + +export interface AuthenticationSession { + id: string; + accessToken: string; + idToken?: string; + account: AuthenticationSessionAccountInformation; + scopes: ReadonlyArray; +} + +export interface AuthenticationProviderInformation { + id: string; + label: string; +} + +export interface AuthenticationWwwAuthenticateRequest { + readonly wwwAuthenticate: string; + readonly fallbackScopes?: readonly string[]; +} + +export function isAuthenticationWwwAuthenticateRequest(obj: unknown): obj is AuthenticationWwwAuthenticateRequest { + return !!(obj + && typeof obj === 'object' + && 'wwwAuthenticate' in obj + && (typeof obj.wwwAuthenticate === 'string')); +} + +/** Should match the definition from the theia/vscode types */ +export interface AuthenticationProviderAuthenticationSessionsChangeEvent { + readonly added: readonly AuthenticationSession[] | undefined; + readonly removed: readonly AuthenticationSession[] | undefined; + readonly changed: readonly AuthenticationSession[] | undefined; +} + +// OAuth2 spec prohibits space in a scope, so use that to join them. +const SCOPESLIST_SEPARATOR = ' '; + +export interface SessionRequest { + disposables: Disposable[]; + requestingExtensionIds: string[]; +} + +export interface SessionRequestInfo { + [scopes: string]: SessionRequest; +} + +/** + * Our authentication provider should at least contain the following information: + * - The signature of authentication providers from vscode + * - Registration information about the provider (id, label) + * - Provider options (supportsMultipleAccounts) + * + * Additionally, we provide the possibility to sign out of a specific account name. + */ +export interface AuthenticationProvider { + id: string; + + label: string; + + supportsMultipleAccounts: boolean; + + hasSessions(): boolean; + + signOut(accountName: string): Promise; + + updateSessionItems(event: AuthenticationProviderAuthenticationSessionsChangeEvent): Promise; + + /** + * An [event](#Event) which fires when the array of sessions has changed, or data + * within a session has changed. + */ + readonly onDidChangeSessions: Event; + + /** + * Get a list of sessions. + * @param scopeListOrRequest Optional scope list of permissions requested or WWW-Authenticate request. + * @param account The optional account that you would like to get the session for + * @returns A promise that resolves to an array of authentication sessions. + */ + getSessions( + scopeListOrRequest?: ReadonlyArray | AuthenticationWwwAuthenticateRequest, + account?: AuthenticationSessionAccountInformation + ): Thenable>; + + /** + * Prompts a user to login. + * @param scopeListOrRequest A scope list of permissions requested or a WWW-Authenticate request. + * @param options The options for createing the session + * @returns A promise that resolves to an authentication session. + */ + createSession( + scopeListOrRequest: ReadonlyArray | AuthenticationWwwAuthenticateRequest, + options: AuthenticationProviderSessionOptions + ): Thenable; + + /** + * Removes the session corresponding to session id. + * @param sessionId The id of the session to remove. + */ + removeSession(sessionId: string): Thenable; +} +export const AuthenticationService = Symbol('AuthenticationService'); + +export interface AuthenticationService { + isAuthenticationProviderRegistered(id: string): boolean; + getProviderIds(): string[]; + registerAuthenticationProvider(id: string, provider: AuthenticationProvider): void; + unregisterAuthenticationProvider(id: string): void; + requestNewSession(id: string, scopeListOrRequest: ReadonlyArray | AuthenticationWwwAuthenticateRequest, extensionId: string, extensionName: string): void; + updateSessions(providerId: string, event: AuthenticationProviderAuthenticationSessionsChangeEvent): void; + + readonly onDidRegisterAuthenticationProvider: Event; + readonly onDidUnregisterAuthenticationProvider: Event; + + readonly onDidChangeSessions: Event<{ providerId: string, label: string, event: AuthenticationProviderAuthenticationSessionsChangeEvent }>; + readonly onDidUpdateSignInCount: Event; + getSessions( + providerId: string, + scopeListOrRequest?: ReadonlyArray | AuthenticationWwwAuthenticateRequest, + user?: AuthenticationSessionAccountInformation + ): Promise>; + getLabel(providerId: string): string; + supportsMultipleAccounts(providerId: string): boolean; + login( + providerId: string, + scopeListOrRequest: ReadonlyArray | AuthenticationWwwAuthenticateRequest, + options?: AuthenticationProviderSessionOptions + ): Promise; + logout(providerId: string, sessionId: string): Promise; + + signOutOfAccount(providerId: string, accountName: string): Promise; +} + +export interface SessionChangeEvent { + providerId: string, + label: string, + event: AuthenticationProviderAuthenticationSessionsChangeEvent +} + +@injectable() +export class AuthenticationServiceImpl implements AuthenticationService { + private noAccountsMenuItem: Disposable | undefined; + private noAccountsCommand: Command = { id: 'noAccounts' }; + private signInRequestItems = new Map(); + private sessionMap = new Map(); + + protected authenticationProviders: Map = new Map(); + protected authenticationProviderDisposables: Map = new Map(); + + private readonly onDidRegisterAuthenticationProviderEmitter: Emitter = new Emitter(); + readonly onDidRegisterAuthenticationProvider: Event = this.onDidRegisterAuthenticationProviderEmitter.event; + + private readonly onDidUnregisterAuthenticationProviderEmitter: Emitter = new Emitter(); + readonly onDidUnregisterAuthenticationProvider: Event = this.onDidUnregisterAuthenticationProviderEmitter.event; + + private readonly onDidChangeSessionsEmitter: Emitter = new Emitter(); + readonly onDidChangeSessions: Event = this.onDidChangeSessionsEmitter.event; + + private readonly onDidChangeSignInCountEmitter: Emitter = new Emitter(); + readonly onDidUpdateSignInCount: Event = this.onDidChangeSignInCountEmitter.event; + + @inject(MenuModelRegistry) protected readonly menus: MenuModelRegistry; + @inject(CommandRegistry) protected readonly commands: CommandRegistry; + @inject(StorageService) protected readonly storageService: StorageService; + + @postConstruct() + init(): void { + this.onDidChangeSessions(event => this.handleSessionChange(event)); + this.commands.registerCommand(this.noAccountsCommand, { + execute: () => { }, + isEnabled: () => false + }); + } + + protected async handleSessionChange(changeEvent: SessionChangeEvent): Promise { + if (changeEvent.event.added && changeEvent.event.added.length > 0) { + const sessions = await this.getSessions(changeEvent.providerId); + sessions.forEach(session => { + if (!this.sessionMap.get(session.id)) { + this.sessionMap.set(session.id, this.createAccountUi(changeEvent.providerId, changeEvent.label, session)); + } + }); + } + for (const removed of changeEvent.event.removed || []) { + const sessionId = typeof removed === 'string' ? removed : removed?.id; + if (sessionId) { + this.sessionMap.get(sessionId)?.dispose(); + this.sessionMap.delete(sessionId); + } + } + } + + protected createAccountUi(providerId: string, providerLabel: string, session: AuthenticationSession): DisposableCollection { + // unregister old commands and menus if present (there is only one per account but there may be several sessions per account) + const providerAccountId = `account-sign-out-${providerId}-${session.account.id}`; + this.commands.unregisterCommand(providerAccountId); + + const providerAccountSubmenu = [...ACCOUNTS_SUBMENU, providerAccountId]; + this.menus.unregisterMenuAction({ commandId: providerAccountId }, providerAccountSubmenu); + + // register new command and menu entry for the sessions account + const disposables = new DisposableCollection(); + disposables.push(this.commands.registerCommand({ id: providerAccountId }, { + execute: async () => { + this.signOutOfAccount(providerId, session.account.label); + } + })); + this.menus.registerSubmenu(providerAccountSubmenu, `${session.account.label} (${providerLabel})`); + disposables.push(this.menus.registerMenuAction(providerAccountSubmenu, { + label: nls.localizeByDefault('Sign Out'), + commandId: providerAccountId + })); + return disposables; + } + + getProviderIds(): string[] { + const providerIds: string[] = []; + this.authenticationProviders.forEach(provider => { + providerIds.push(provider.id); + }); + return providerIds; + } + + isAuthenticationProviderRegistered(id: string): boolean { + return this.authenticationProviders.has(id); + } + + private updateAccountsMenuItem(): void { + let hasSession = false; + this.authenticationProviders.forEach(async provider => { + hasSession = hasSession || provider.hasSessions(); + }); + + if (hasSession && this.noAccountsMenuItem) { + this.noAccountsMenuItem.dispose(); + this.noAccountsMenuItem = undefined; + } + + if (!hasSession && !this.noAccountsMenuItem) { + this.noAccountsMenuItem = this.menus.registerMenuAction(ACCOUNTS_MENU, { + label: 'You are not signed in to any accounts', + order: '0', + commandId: this.noAccountsCommand.id + }); + } + } + + registerAuthenticationProvider(id: string, authenticationProvider: AuthenticationProvider): void { + if (this.authenticationProviders.get(id)) { + throw new Error(`An authentication provider with id '${id}' is already registered.`); + } + this.authenticationProviders.set(id, authenticationProvider); + + const disposables = new DisposableCollection(); + disposables.push(authenticationProvider.onDidChangeSessions(e => this.updateSessions(authenticationProvider.id, e))); + this.authenticationProviderDisposables.set(id, disposables); + + this.onDidRegisterAuthenticationProviderEmitter.fire({ id, label: authenticationProvider.label }); + + this.updateAccountsMenuItem(); + console.log(`An authentication provider with id '${id}' was registered.`); + } + + unregisterAuthenticationProvider(id: string): void { + const provider = this.authenticationProviders.get(id); + if (provider) { + this.authenticationProviders.delete(id); + this.onDidUnregisterAuthenticationProviderEmitter.fire({ id, label: provider.label }); + this.updateAccountsMenuItem(); + } else { + console.error(`Failed to unregister an authentication provider. A provider with id '${id}' was not found.`); + } + this.authenticationProviderDisposables.get(id)?.dispose(); + this.authenticationProviderDisposables.delete(id); + } + + async updateSessions(id: string, event: AuthenticationProviderAuthenticationSessionsChangeEvent): Promise { + const provider = this.authenticationProviders.get(id); + if (provider) { + await provider.updateSessionItems(event); + this.onDidChangeSessionsEmitter.fire({ providerId: id, label: provider.label, event: event }); + this.updateAccountsMenuItem(); + + if (event.added) { + await this.updateNewSessionRequests(provider); + } + } else { + console.error(`Failed to update an authentication session. An authentication provider with id '${id}' was not found.`); + } + } + + private async updateNewSessionRequests(provider: AuthenticationProvider): Promise { + const existingRequestsForProvider = this.signInRequestItems.get(provider.id); + if (!existingRequestsForProvider) { + return; + } + + const previousSize = this.signInRequestItems.size; + const sessions = await provider.getSessions(undefined); + Object.keys(existingRequestsForProvider).forEach(requestedScopes => { + if (sessions.some(session => session.scopes.slice().sort().join('') === requestedScopes)) { + const sessionRequest = existingRequestsForProvider[requestedScopes]; + if (sessionRequest) { + sessionRequest.disposables.forEach(item => item.dispose()); + } + + delete existingRequestsForProvider[requestedScopes]; + if (Object.keys(existingRequestsForProvider).length === 0) { + this.signInRequestItems.delete(provider.id); + } else { + this.signInRequestItems.set(provider.id, existingRequestsForProvider); + } + } + }); + if (previousSize !== this.signInRequestItems.size) { + this.onDidChangeSignInCountEmitter.fire(this.signInRequestItems.size); + } + } + + async requestNewSession( + providerId: string, + scopeListOrRequest: ReadonlyArray | AuthenticationWwwAuthenticateRequest, + extensionId: string, + extensionName: string + ): Promise { + let provider = this.authenticationProviders.get(providerId); + if (!provider) { + // Activate has already been called for the authentication provider, but it cannot block on registering itself + // since this is sync and returns a disposable. So, wait for registration event to fire that indicates the + // provider is now in the map. + await new Promise((resolve, _) => { + this.onDidRegisterAuthenticationProvider(e => { + if (e.id === providerId) { + provider = this.authenticationProviders.get(providerId); + resolve(undefined); + } + }); + }); + } + + if (provider) { + const providerRequests = this.signInRequestItems.get(providerId); + const signInRequestKey = isAuthenticationWwwAuthenticateRequest(scopeListOrRequest) + ? `${scopeListOrRequest.wwwAuthenticate}:${scopeListOrRequest.fallbackScopes?.join(SCOPESLIST_SEPARATOR) ?? ''}` + : `${scopeListOrRequest.join(SCOPESLIST_SEPARATOR)}`; + const extensionHasExistingRequest = providerRequests + && providerRequests[signInRequestKey] + && providerRequests[signInRequestKey].requestingExtensionIds.indexOf(extensionId) > -1; + + if (extensionHasExistingRequest) { + return; + } + + const menuItem = this.menus.registerMenuAction(ACCOUNTS_SUBMENU, { + label: nls.localizeByDefault('Sign in with {0} to use {1} (1)', provider.label, extensionName), + order: '1', + commandId: `${extensionId}signIn`, + }); + + const signInCommand = this.commands.registerCommand({ id: `${extensionId}signIn` }, { + execute: async () => { + const session = await this.login(providerId, scopeListOrRequest); + + // Add extension to allow list since user explicitly signed in on behalf of it + const allowList = await readAllowedExtensions(this.storageService, providerId, session.account.label); + if (!allowList.find(allowed => allowed.id === extensionId)) { + allowList.push({ id: extensionId, name: extensionName }); + this.storageService.setData(`authentication-trusted-extensions-${providerId}-${session.account.label}`, JSON.stringify(allowList)); + } + + // And also set it as the preferred account for the extension + this.storageService.setData(`authentication-session-${extensionName}-${providerId}`, session.id); + } + }); + + const previousSize = this.signInRequestItems.size; + if (providerRequests) { + const existingRequest = providerRequests[signInRequestKey] || { disposables: [], requestingExtensionIds: [] }; + + providerRequests[signInRequestKey] = { + disposables: [...existingRequest.disposables, menuItem, signInCommand], + requestingExtensionIds: [...existingRequest.requestingExtensionIds, extensionId] + }; + this.signInRequestItems.set(providerId, providerRequests); + } else { + this.signInRequestItems.set(providerId, { + [signInRequestKey]: { + disposables: [menuItem, signInCommand], + requestingExtensionIds: [extensionId] + } + }); + } + if (previousSize !== this.signInRequestItems.size) { + this.onDidChangeSignInCountEmitter.fire(this.signInRequestItems.size); + } + } + } + + getLabel(id: string): string { + const authProvider = this.authenticationProviders.get(id); + if (authProvider) { + return authProvider.label; + } else { + throw new Error(`No authentication provider '${id}' is currently registered.`); + } + } + + supportsMultipleAccounts(id: string): boolean { + const authProvider = this.authenticationProviders.get(id); + if (authProvider) { + return authProvider.supportsMultipleAccounts; + } else { + throw new Error(`No authentication provider '${id}' is currently registered.`); + } + } + + async getSessions(id: string, scopes?: string[], user?: AuthenticationSessionAccountInformation): Promise> { + const authProvider = this.authenticationProviders.get(id); + if (authProvider) { + return authProvider.getSessions(scopes, user); + } else { + throw new Error(`No authentication provider '${id}' is currently registered.`); + } + } + + async login( + id: string, + scopeListOrRequest: ReadonlyArray | AuthenticationWwwAuthenticateRequest, + options?: AuthenticationProviderSessionOptions + ): Promise { + const authProvider = this.authenticationProviders.get(id); + if (authProvider) { + return authProvider.createSession(scopeListOrRequest, options || {}); + } else { + throw new Error(`No authentication provider '${id}' is currently registered.`); + } + } + + async logout(id: string, sessionId: string): Promise { + const authProvider = this.authenticationProviders.get(id); + if (authProvider) { + return authProvider.removeSession(sessionId); + } else { + throw new Error(`No authentication provider '${id}' is currently registered.`); + } + } + + async signOutOfAccount(id: string, accountName: string): Promise { + const authProvider = this.authenticationProviders.get(id); + if (authProvider) { + return authProvider.signOut(accountName); + } else { + throw new Error(`No authentication provider '${id}' is currently registered.`); + } + } +} + +export interface AllowedExtension { + id: string; + name: string; +} + +export async function readAllowedExtensions(storageService: StorageService, providerId: string, accountName: string): Promise { + let trustedExtensions: AllowedExtension[] = []; + try { + const trustedExtensionSrc: string | undefined = await storageService.getData(`authentication-trusted-extensions-${providerId}-${accountName}`); + if (trustedExtensionSrc) { + trustedExtensions = JSON.parse(trustedExtensionSrc); + } + } catch (err) { + console.error(err); + } + + return trustedExtensions; +} diff --git a/packages/core/src/browser/badges/badge-service.ts b/packages/core/src/browser/badges/badge-service.ts new file mode 100644 index 0000000..c3356db --- /dev/null +++ b/packages/core/src/browser/badges/badge-service.ts @@ -0,0 +1,44 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { injectable } from 'inversify'; +import { Emitter, Event } from '../../common'; +import { Widget } from '../widgets'; + +export interface Badge { + value: number; + tooltip: string; +} + +@injectable() +export class BadgeService { + protected readonly badges = new WeakMap(); + protected readonly onDidChangeBadgesEmitter = new Emitter(); + get onDidChangeBadges(): Event { return this.onDidChangeBadgesEmitter.event; } + + getBadge(widget: Widget): Badge | undefined { + return this.badges.get(widget); + } + + showBadge(widget: Widget, badge?: Badge): void { + if (badge) { + this.badges.set(widget, badge); + this.onDidChangeBadgesEmitter.fire(widget); + } else if (this.badges.delete(widget)) { + this.onDidChangeBadgesEmitter.fire(widget); + } + } +} diff --git a/packages/core/src/browser/badges/index.ts b/packages/core/src/browser/badges/index.ts new file mode 100644 index 0000000..f210878 --- /dev/null +++ b/packages/core/src/browser/badges/index.ts @@ -0,0 +1,18 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +export * from './badge-service'; +export * from './tabbar-badge-decorator'; diff --git a/packages/core/src/browser/badges/tabbar-badge-decorator.ts b/packages/core/src/browser/badges/tabbar-badge-decorator.ts new file mode 100644 index 0000000..feebced --- /dev/null +++ b/packages/core/src/browser/badges/tabbar-badge-decorator.ts @@ -0,0 +1,63 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { inject, injectable, interfaces } from 'inversify'; +import { ViewContainer } from '../view-container'; +import { WidgetDecoration } from '../widget-decoration'; +import { Title, Widget } from '../widgets'; +import { TabBarDecorator } from '../shell/tab-bar-decorator'; +import { Disposable, Event } from '../../common'; +import { Badge, BadgeService } from './badge-service'; + +@injectable() +export class TabBarBadgeDecorator implements TabBarDecorator { + readonly id = 'theia-plugin-view-container-badge-decorator'; + + @inject(BadgeService) + protected readonly badgeService: BadgeService; + + onDidChangeDecorations(...[cb, thisArg, disposable]: Parameters>): Disposable { return this.badgeService.onDidChangeBadges(() => cb(), thisArg, disposable); } + + decorate({ owner }: Title): WidgetDecoration.Data[] { + let total = 0; + const result: WidgetDecoration.Data[] = []; + const aggregate = (badge?: Badge) => { + if (badge?.value) { + total += badge.value; + } + if (badge?.tooltip) { + result.push({ tooltip: badge.tooltip }); + } + }; + if (owner instanceof ViewContainer) { + for (const { wrapped } of owner.getParts()) { + aggregate(this.badgeService.getBadge(wrapped)); + } + } else { + aggregate(this.badgeService.getBadge(owner)); + } + if (total !== 0) { + result.push({ badge: total }); + } + return result; + } +} + +export function bindBadgeDecoration(bind: interfaces.Bind): void { + bind(BadgeService).toSelf().inSingletonScope(); + bind(TabBarBadgeDecorator).toSelf().inSingletonScope(); + bind(TabBarDecorator).toService(TabBarBadgeDecorator); +} diff --git a/packages/core/src/browser/breadcrumbs/breadcrumb-popup-container.ts b/packages/core/src/browser/breadcrumbs/breadcrumb-popup-container.ts new file mode 100644 index 0000000..09a8813 --- /dev/null +++ b/packages/core/src/browser/breadcrumbs/breadcrumb-popup-container.ts @@ -0,0 +1,101 @@ +// ***************************************************************************** +// Copyright (C) 2019 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { inject, injectable, postConstruct } from '../../../shared/inversify'; +import { Emitter, Event } from '../../common'; +import { Disposable, DisposableCollection } from '../../common/disposable'; +import { Coordinate } from '../context-menu-renderer'; +import { RendererHost } from '../widgets/react-renderer'; +import { Styles } from './breadcrumbs-constants'; + +export interface BreadcrumbPopupContainerFactory { + (parent: HTMLElement, breadcrumbId: string, position: Coordinate): BreadcrumbPopupContainer; +} +export const BreadcrumbPopupContainerFactory = Symbol('BreadcrumbPopupContainerFactory'); + +export type BreadcrumbID = string; +export const BreadcrumbID = Symbol('BreadcrumbID'); + +/** + * This class creates a popup container at the given position + * so that contributions can attach their HTML elements + * as children of `BreadcrumbPopupContainer#container`. + * + * - `dispose()` is called on blur or on hit on escape + */ +@injectable() +export class BreadcrumbPopupContainer implements Disposable { + @inject(RendererHost) protected readonly parent: RendererHost; + @inject(BreadcrumbID) public readonly breadcrumbId: BreadcrumbID; + @inject(Coordinate) protected readonly position: Coordinate; + + protected onDidDisposeEmitter = new Emitter(); + protected toDispose: DisposableCollection = new DisposableCollection(this.onDidDisposeEmitter); + get onDidDispose(): Event { + return this.onDidDisposeEmitter.event; + } + + protected _container: HTMLElement; + get container(): HTMLElement { + return this._container; + } + + protected _isOpen: boolean; + get isOpen(): boolean { + return this._isOpen; + } + + @postConstruct() + protected init(): void { + this._container = this.createPopupDiv(this.position); + document.addEventListener('keyup', this.escFunction); + this._container.focus(); + this._isOpen = true; + } + + protected createPopupDiv(position: Coordinate): HTMLDivElement { + const result = window.document.createElement('div'); + result.className = Styles.BREADCRUMB_POPUP; + result.style.left = `${position.x}px`; + result.style.top = `${position.y}px`; + result.tabIndex = 0; + result.addEventListener('focusout', this.onFocusOut); + this.parent.appendChild(result); + return result; + } + + protected onFocusOut = (event: FocusEvent) => { + if (!(event.relatedTarget instanceof Element) || !this._container.contains(event.relatedTarget)) { + this.dispose(); + } + }; + + protected escFunction = (event: KeyboardEvent) => { + if (event.key === 'Escape' || event.key === 'Esc') { + this.dispose(); + } + }; + + dispose(): void { + if (!this.toDispose.disposed) { + this.onDidDisposeEmitter.fire(); + this.toDispose.dispose(); + this._container.remove(); + this._isOpen = false; + document.removeEventListener('keyup', this.escFunction); + } + } +} diff --git a/packages/core/src/browser/breadcrumbs/breadcrumb-renderer.tsx b/packages/core/src/browser/breadcrumbs/breadcrumb-renderer.tsx new file mode 100644 index 0000000..2960f93 --- /dev/null +++ b/packages/core/src/browser/breadcrumbs/breadcrumb-renderer.tsx @@ -0,0 +1,41 @@ +// ***************************************************************************** +// Copyright (C) 2019 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import * as React from 'react'; +import { injectable } from 'inversify'; +import { Breadcrumb, Styles } from './breadcrumbs-constants'; + +export const BreadcrumbRenderer = Symbol('BreadcrumbRenderer'); +export interface BreadcrumbRenderer { + /** + * Renders the given breadcrumb. If `onClick` is given, it is called on breadcrumb click. + */ + render(breadcrumb: Breadcrumb, onMouseDown?: (breadcrumb: Breadcrumb, event: React.MouseEvent) => void): React.ReactNode; +} + +@injectable() +export class DefaultBreadcrumbRenderer implements BreadcrumbRenderer { + render(breadcrumb: Breadcrumb, onMouseDown?: (breadcrumb: Breadcrumb, event: React.MouseEvent) => void): React.ReactNode { + return
  • onMouseDown && onMouseDown(breadcrumb, event)} + tabIndex={0} + data-breadcrumb-id={breadcrumb.id} + > + {breadcrumb.iconClass && } {breadcrumb.label} +
  • ; + } +} diff --git a/packages/core/src/browser/breadcrumbs/breadcrumbs-constants.ts b/packages/core/src/browser/breadcrumbs/breadcrumbs-constants.ts new file mode 100644 index 0000000..b80b9b8 --- /dev/null +++ b/packages/core/src/browser/breadcrumbs/breadcrumbs-constants.ts @@ -0,0 +1,79 @@ +// ***************************************************************************** +// Copyright (C) 2019 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { MaybePromise, Event } from '../../common'; +import { Disposable } from '../../../shared/vscode-languageserver-protocol'; +import URI from '../../common/uri'; + +export namespace Styles { + export const BREADCRUMBS = 'theia-breadcrumbs'; + export const BREADCRUMB_ITEM = 'theia-breadcrumb-item'; + export const BREADCRUMB_POPUP_OVERLAY_CONTAINER = 'theia-breadcrumbs-popups-overlay'; + export const BREADCRUMB_POPUP = 'theia-breadcrumbs-popup'; + export const BREADCRUMB_ITEM_HAS_POPUP = 'theia-breadcrumb-item-haspopup'; +} + +/** A single breadcrumb in the breadcrumbs bar. */ +export interface Breadcrumb { + + /** An ID of this breadcrumb that should be unique in the breadcrumbs bar. */ + readonly id: string; + + /** The breadcrumb type. Should be the same as the contribution type `BreadcrumbsContribution#type`. */ + readonly type: symbol; + + /** The text that will be rendered as label. */ + readonly label: string; + + /** A longer text that will be used as tooltip text. */ + readonly longLabel: string; + + /** A CSS class for the icon. */ + readonly iconClass?: string; + + /** CSS classes for the container. */ + readonly containerClass?: string; +} + +export const BreadcrumbsContribution = Symbol('BreadcrumbsContribution'); +export interface BreadcrumbsContribution { + + /** + * The breadcrumb type. Breadcrumbs returned by `#computeBreadcrumbs(uri)` should have this as `Breadcrumb#type`. + */ + readonly type: symbol; + + /** + * The priority of this breadcrumbs contribution. Contributions are rendered left to right in order of ascending priority. + */ + readonly priority: number; + + /** + * An event emitter that should fire when breadcrumbs change for a given URI. + */ + readonly onDidChangeBreadcrumbs: Event; + + /** + * Computes breadcrumbs for a given URI. + */ + computeBreadcrumbs(uri: URI): MaybePromise; + + /** + * Attaches the breadcrumb popup content for the given breadcrumb as child to the given parent. + * If it returns a Disposable, it is called when the popup closes. + */ + attachPopupContent(breadcrumb: Breadcrumb, parent: HTMLElement): Promise; +} diff --git a/packages/core/src/browser/breadcrumbs/breadcrumbs-renderer.tsx b/packages/core/src/browser/breadcrumbs/breadcrumbs-renderer.tsx new file mode 100644 index 0000000..ada4cac --- /dev/null +++ b/packages/core/src/browser/breadcrumbs/breadcrumbs-renderer.tsx @@ -0,0 +1,185 @@ +// ***************************************************************************** +// Copyright (C) 2019 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import * as React from 'react'; +import { injectable, inject, postConstruct } from 'inversify'; +import { ReactRenderer } from '../widgets'; +import { BreadcrumbsService } from './breadcrumbs-service'; +import { BreadcrumbRenderer } from './breadcrumb-renderer'; +import PerfectScrollbar from 'perfect-scrollbar'; +import URI from '../../common/uri'; +import { Emitter, Event } from '../../common'; +import { BreadcrumbPopupContainer } from './breadcrumb-popup-container'; +import { CorePreferences } from '../../common/core-preferences'; +import { Breadcrumb, Styles } from './breadcrumbs-constants'; +import { LabelProvider } from '../label-provider'; + +interface Cancelable { + canceled: boolean; +} + +@injectable() +export class BreadcrumbsRenderer extends ReactRenderer { + + @inject(BreadcrumbsService) + protected readonly breadcrumbsService: BreadcrumbsService; + + @inject(BreadcrumbRenderer) + protected readonly breadcrumbRenderer: BreadcrumbRenderer; + + @inject(CorePreferences) + protected readonly corePreferences: CorePreferences; + + @inject(LabelProvider) + protected readonly labelProvider: LabelProvider; + + protected readonly onDidChangeActiveStateEmitter = new Emitter(); + get onDidChangeActiveState(): Event { + return this.onDidChangeActiveStateEmitter.event; + } + + protected uri: URI | undefined; + protected breadcrumbs: Breadcrumb[] = []; + protected popup: BreadcrumbPopupContainer | undefined; + protected scrollbar: PerfectScrollbar | undefined; + + get active(): boolean { + return !!this.breadcrumbs.length; + } + + protected get breadCrumbsContainer(): Element | undefined { + return this.host.firstElementChild ?? undefined; + } + + protected refreshCancellationMarker: Cancelable = { canceled: true }; + + @postConstruct() + protected init(): void { + this.toDispose.push(this.onDidChangeActiveStateEmitter); + this.toDispose.push(this.breadcrumbsService.onDidChangeBreadcrumbs(uri => { + if (this.uri?.isEqual(uri)) { + this.refresh(this.uri); + } + })); + this.toDispose.push(this.corePreferences.onPreferenceChanged(change => { + if (change.preferenceName === 'breadcrumbs.enabled') { + this.refresh(this.uri); + } + })); + this.toDispose.push(this.labelProvider.onDidChange(() => this.refresh(this.uri))); + } + + override dispose(): void { + super.dispose(); + this.toDispose.dispose(); + if (this.popup) { this.popup.dispose(); } + if (this.scrollbar) { + this.scrollbar.destroy(); + this.scrollbar = undefined; + } + } + + async refresh(uri?: URI): Promise { + this.uri = uri; + this.refreshCancellationMarker.canceled = true; + const currentCallCanceled = { canceled: false }; + this.refreshCancellationMarker = currentCallCanceled; + let breadcrumbs: Breadcrumb[]; + if (uri && this.corePreferences['breadcrumbs.enabled']) { + breadcrumbs = await this.breadcrumbsService.getBreadcrumbs(uri); + } else { + breadcrumbs = []; + } + if (currentCallCanceled.canceled) { + return; + } + + const wasActive = this.active; + this.breadcrumbs = breadcrumbs; + const isActive = this.active; + if (wasActive !== isActive) { + this.onDidChangeActiveStateEmitter.fire(isActive); + } + + this.update(); + } + + protected update(): void { + this.render(); + + if (!this.scrollbar) { + this.createScrollbar(); + } else { + this.scrollbar.update(); + } + this.scrollToEnd(); + } + + protected createScrollbar(): void { + const { breadCrumbsContainer } = this; + if (breadCrumbsContainer) { + this.scrollbar = new PerfectScrollbar(breadCrumbsContainer, { + handlers: ['drag-thumb', 'keyboard', 'wheel', 'touch'], + useBothWheelAxes: true, + scrollXMarginOffset: 4, + suppressScrollY: true + }); + } + } + + protected scrollToEnd(): void { + const { breadCrumbsContainer } = this; + if (breadCrumbsContainer) { + breadCrumbsContainer.scrollLeft = breadCrumbsContainer.scrollWidth; + } + } + + protected override doRender(): React.ReactNode { + return
      {this.renderBreadcrumbs()}
    ; + } + + protected renderBreadcrumbs(): React.ReactNode { + return this.breadcrumbs.map(breadcrumb => this.breadcrumbRenderer.render(breadcrumb, this.togglePopup)); + } + + protected togglePopup = (breadcrumb: Breadcrumb, event: React.MouseEvent) => { + event.stopPropagation(); + event.preventDefault(); + let openPopup = true; + if (this.popup?.isOpen) { + this.popup.dispose(); + + // There is a popup open. If the popup is the popup that belongs to the currently clicked breadcrumb + // just close the popup. If another breadcrumb was clicked, open the new popup immediately. + openPopup = this.popup.breadcrumbId !== breadcrumb.id; + } else { + this.popup = undefined; + } + if (openPopup) { + const { currentTarget } = event; + const breadcrumbElement = currentTarget.closest(`.${Styles.BREADCRUMB_ITEM}`); + if (breadcrumbElement) { + const { left: x, bottom: y } = breadcrumbElement.getBoundingClientRect(); + this.breadcrumbsService.openPopup(breadcrumb, { x, y }).then(popup => { this.popup = popup; }); + } + } + }; +} + +export const BreadcrumbsRendererFactory = Symbol('BreadcrumbsRendererFactory'); +export interface BreadcrumbsRendererFactory { + (): BreadcrumbsRenderer; +} diff --git a/packages/core/src/browser/breadcrumbs/breadcrumbs-service.ts b/packages/core/src/browser/breadcrumbs/breadcrumbs-service.ts new file mode 100644 index 0000000..a4774af --- /dev/null +++ b/packages/core/src/browser/breadcrumbs/breadcrumbs-service.ts @@ -0,0 +1,108 @@ +// ***************************************************************************** +// Copyright (C) 2019 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { inject, injectable, named, postConstruct } from 'inversify'; +import { ContributionProvider, Prioritizeable, Emitter, Event } from '../../common'; +import URI from '../../common/uri'; +import { Coordinate } from '../context-menu-renderer'; +import { BreadcrumbPopupContainer, BreadcrumbPopupContainerFactory } from './breadcrumb-popup-container'; +import { BreadcrumbsContribution, Styles, Breadcrumb } from './breadcrumbs-constants'; + +@injectable() +export class BreadcrumbsService { + + @inject(ContributionProvider) @named(BreadcrumbsContribution) + protected readonly contributions: ContributionProvider; + + @inject(BreadcrumbPopupContainerFactory) protected readonly breadcrumbPopupContainerFactory: BreadcrumbPopupContainerFactory; + + protected hasSubscribed = false; + + protected popupsOverlayContainer: HTMLDivElement; + + protected readonly onDidChangeBreadcrumbsEmitter = new Emitter(); + + @postConstruct() + init(): void { + this.createOverlayContainer(); + } + + protected createOverlayContainer(): void { + this.popupsOverlayContainer = window.document.createElement('div'); + this.popupsOverlayContainer.id = Styles.BREADCRUMB_POPUP_OVERLAY_CONTAINER; + if (window.document.body) { + window.document.body.appendChild(this.popupsOverlayContainer); + } + } + + /** + * Subscribe to this event emitter to be notified when the breadcrumbs have changed. + * The URI is the URI of the editor the breadcrumbs have changed for. + */ + get onDidChangeBreadcrumbs(): Event { + // This lazy subscription is to address problems in inversify's instantiation routine + // related to use of the IconThemeService by different components instantiated by the + // ContributionProvider. + if (!this.hasSubscribed) { + this.subscribeToContributions(); + } + return this.onDidChangeBreadcrumbsEmitter.event; + } + + /** + * Subscribes to the onDidChangeBreadcrumbs events for all contributions. + */ + protected subscribeToContributions(): void { + this.hasSubscribed = true; + for (const contribution of this.contributions.getContributions()) { + contribution.onDidChangeBreadcrumbs(uri => this.onDidChangeBreadcrumbsEmitter.fire(uri)); + } + } + + /** + * Returns the breadcrumbs for a given URI, possibly an empty list. + */ + async getBreadcrumbs(uri: URI): Promise { + const result: Breadcrumb[] = []; + for (const contribution of await this.prioritizedContributions()) { + result.push(...await contribution.computeBreadcrumbs(uri)); + } + return result; + } + + protected async prioritizedContributions(): Promise { + const prioritized = await Prioritizeable.prioritizeAll( + this.contributions.getContributions(), contribution => contribution.priority); + return prioritized.map(p => p.value).reverse(); + } + + /** + * Opens a popup for the given breadcrumb at the given position. + */ + async openPopup(breadcrumb: Breadcrumb, position: Coordinate): Promise { + const contribution = this.contributions.getContributions().find(c => c.type === breadcrumb.type); + if (contribution) { + const popup = this.breadcrumbPopupContainerFactory(this.popupsOverlayContainer, breadcrumb.id, position); + const popupContent = await contribution.attachPopupContent(breadcrumb, popup.container); + if (popupContent && popup.isOpen) { + popup.onDidDispose(() => popupContent.dispose()); + } else { + popupContent?.dispose(); + } + return popup; + } + } +} diff --git a/packages/core/src/browser/breadcrumbs/index.ts b/packages/core/src/browser/breadcrumbs/index.ts new file mode 100644 index 0000000..43c17b4 --- /dev/null +++ b/packages/core/src/browser/breadcrumbs/index.ts @@ -0,0 +1,21 @@ +// ***************************************************************************** +// Copyright (C) 2019 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +export * from './breadcrumb-popup-container'; +export * from './breadcrumb-renderer'; +export * from './breadcrumbs-renderer'; +export * from './breadcrumbs-service'; +export * from './breadcrumbs-constants'; diff --git a/packages/core/src/browser/browser-clipboard-service.ts b/packages/core/src/browser/browser-clipboard-service.ts new file mode 100644 index 0000000..924309c --- /dev/null +++ b/packages/core/src/browser/browser-clipboard-service.ts @@ -0,0 +1,122 @@ +// ***************************************************************************** +// Copyright (C) 2019 RedHat and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { injectable, inject } from 'inversify'; +import { isFirefox } from './browser'; +import { ClipboardService } from './clipboard-service'; +import { ILogger } from '../common/logger'; +import { MessageService } from '../common/message-service'; +import { nls } from '../common/nls'; + +export interface NavigatorClipboard { + readText(): Promise; + writeText(value: string): Promise; +} +export interface PermissionStatus { + state: 'granted' | 'prompt' | 'denied' +} +export interface NavigatorPermissions { + query(options: { name: string }): Promise +} + +@injectable() +export class BrowserClipboardService implements ClipboardService { + + @inject(MessageService) + protected readonly messageService: MessageService; + + @inject(ILogger) + protected readonly logger: ILogger; + + async readText(): Promise { + let permission; + try { + permission = await this.queryPermission('clipboard-read'); + } catch (e1) { + this.logger.error('Failed checking a clipboard-read permission.', e1); + // in FireFox, Clipboard API isn't gated with the permissions + try { + return await this.getClipboardAPI().readText(); + } catch (e2) { + this.logger.error('Failed reading clipboard content.', e2); + if (isFirefox) { + this.messageService.warn(nls.localize( + 'theia/navigator/clipboardWarnFirefox', + // eslint-disable-next-line max-len + "Clipboard API is not available. It can be enabled by '{0}' preference on '{1}' page. Then reload Theia. Note, it will allow FireFox getting full access to the system clipboard.", 'dom.events.testing.asyncClipboard', 'about:config' + )); + } + return ''; + } + } + if (permission.state === 'denied') { + // most likely, the user intentionally denied the access + this.messageService.warn(nls.localize( + 'theia/navigator/clipboardWarn', + "Access to the clipboard is denied. Check your browser's permission." + )); + return ''; + } + return this.getClipboardAPI().readText(); + } + + async writeText(value: string): Promise { + let permission; + try { + permission = await this.queryPermission('clipboard-write'); + } catch (e1) { + this.logger.error('Failed checking a clipboard-write permission.', e1); + // in FireFox, Clipboard API isn't gated with the permissions + try { + await this.getClipboardAPI().writeText(value); + return; + } catch (e2) { + this.logger.error('Failed writing to the clipboard.', e2); + if (isFirefox) { + this.messageService.warn(nls.localize( + 'theia/core/navigator/clipboardWarnFirefox', + // eslint-disable-next-line max-len + "Clipboard API is not available. It can be enabled by '{0}' preference on '{1}' page. Then reload Theia. Note, it will allow FireFox getting full access to the system clipboard.", 'dom.events.testing.asyncClipboard', 'about:config' + )); + } + return; + } + } + if (permission.state === 'denied') { + // most likely, the user intentionally denied the access + this.messageService.warn(nls.localize( + 'theia/core/navigator/clipboardWarn', + "Access to the clipboard is denied. Check your browser's permission." + )); + return; + } + return this.getClipboardAPI().writeText(value); + } + + protected async queryPermission(name: string): Promise { + if ('permissions' in navigator) { + return (navigator['permissions']).query({ name: name }); + } + throw new Error('Permissions API unavailable'); + } + + protected getClipboardAPI(): NavigatorClipboard { + if ('clipboard' in navigator) { + return (navigator['clipboard']); + } + throw new Error('Async Clipboard API unavailable'); + } +} diff --git a/packages/core/src/browser/browser.ts b/packages/core/src/browser/browser.ts new file mode 100644 index 0000000..681099a --- /dev/null +++ b/packages/core/src/browser/browser.ts @@ -0,0 +1,244 @@ +// ***************************************************************************** +// Copyright (C) 2017 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import { Disposable, environment, isOSX } from '../common'; + +const userAgent = typeof navigator !== 'undefined' ? navigator.userAgent : ''; + +export const isIE = (userAgent.indexOf('Trident') >= 0); +export const isEdge = (userAgent.indexOf('Edge/') >= 0); +export const isEdgeOrIE = isIE || isEdge; + +export const isOpera = (userAgent.indexOf('Opera') >= 0); +export const isFirefox = (userAgent.indexOf('Firefox') >= 0); +export const isWebKit = (userAgent.indexOf('AppleWebKit') >= 0); +export const isChrome = (userAgent.indexOf('Chrome') >= 0); +export const isSafari = (userAgent.indexOf('Chrome') === -1) && (userAgent.indexOf('Safari') >= 0); +export const isIPad = (userAgent.indexOf('iPad') >= 0); +// eslint-disable-next-line @typescript-eslint/no-explicit-any +/** + * @deprecated use Environment.electron.is + */ +export const isNative = environment.electron.is(); +/** + * Determines whether the backend is running in a remote environment. + * I.e. we use the browser version or connect to a remote Theia instance in Electron. + */ +export const isRemote = !environment.electron.is() || new URL(location.href).searchParams.has('localPort'); +// eslint-disable-next-line @typescript-eslint/no-explicit-any +export const isBasicWasmSupported = typeof (window as any).WebAssembly !== 'undefined'; + +/** + * Resolves after the next animation frame if no parameter is given, + * or after the given number of animation frames. + */ +export function animationFrame(n: number = 1): Promise { + return new Promise(resolve => { + function frameFunc(): void { + if (n <= 0) { + resolve(); + } else { + n--; + requestAnimationFrame(frameFunc); + } + } + frameFunc(); + }); +} + +/** + * Parse a magnitude value (e.g. width, height, left, top) from a CSS attribute value. + * Returns the given default value (or undefined) if the value cannot be determined, + * e.g. because it is a relative value like `50%` or `auto`. + */ +export function parseCssMagnitude(value: string | null, defaultValue: number): number; +export function parseCssMagnitude(value: string | null, defaultValue?: number): number | undefined { + if (value) { + let parsed: number; + if (value.endsWith('px')) { + parsed = parseFloat(value.substring(0, value.length - 2)); + } else { + parsed = parseFloat(value); + } + if (!isNaN(parsed)) { + return parsed; + } + } + return defaultValue; +} + +/** + * Parse the number of milliseconds from a CSS time value. + * Returns the given default value (or undefined) if the value cannot be determined. + */ +export function parseCssTime(time: string | null, defaultValue: number): number; +export function parseCssTime(time: string | null, defaultValue?: number): number | undefined { + if (time) { + let parsed: number; + if (time.endsWith('ms')) { + parsed = parseFloat(time.substring(0, time.length - 2)); + } else if (time.endsWith('s')) { + parsed = parseFloat(time.substring(0, time.length - 1)) * 1000; + } else { + parsed = parseFloat(time); + } + if (!isNaN(parsed)) { + return parsed; + } + } + return defaultValue; +} + +interface ElementScroll { + left: number + top: number + maxLeft: number + maxTop: number +} + +function getMonacoEditorScroll(elem: HTMLElement): ElementScroll | undefined { + const linesContent = elem.querySelector('.lines-content') as HTMLElement; + const viewLines = elem.querySelector('.view-lines') as HTMLElement; + // eslint-disable-next-line no-null/no-null + if (linesContent === null || viewLines === null) { + return undefined; + } + const linesContentStyle = linesContent.style; + const elemStyle = elem.style; + const viewLinesStyle = viewLines.style; + return { + left: -parseCssMagnitude(linesContentStyle.left, 0), + top: -parseCssMagnitude(linesContentStyle.top, 0), + maxLeft: parseCssMagnitude(viewLinesStyle.width, 0) - parseCssMagnitude(elemStyle.width, 0), + maxTop: parseCssMagnitude(viewLinesStyle.height, 0) - parseCssMagnitude(elemStyle.height, 0) + }; +} + +/** + * Prevent browser back/forward navigation of a mouse wheel event. + */ +export function preventNavigation(event: WheelEvent): void { + const { currentTarget, deltaX, deltaY } = event; + const absDeltaX = Math.abs(deltaX); + const absDeltaY = Math.abs(deltaY); + let elem = event.target as Element | null; + + while (elem && elem !== currentTarget) { + let scroll: ElementScroll | undefined; + if (elem.classList.contains('monaco-scrollable-element')) { + scroll = getMonacoEditorScroll(elem as HTMLElement); + } else { + scroll = { + left: elem.scrollLeft, + top: elem.scrollTop, + maxLeft: elem.scrollWidth - elem.clientWidth, + maxTop: elem.scrollHeight - elem.clientHeight + }; + } + if (scroll) { + const scrollH = scroll.maxLeft > 0 && (deltaX < 0 && scroll.left > 0 || deltaX > 0 && scroll.left < scroll.maxLeft); + const scrollV = scroll.maxTop > 0 && (deltaY < 0 && scroll.top > 0 || deltaY > 0 && scroll.top < scroll.maxTop); + if (scrollH && scrollV || scrollH && absDeltaX > absDeltaY || scrollV && absDeltaY > absDeltaX) { + // The event is consumed by the scrollable child element + return; + } + } + elem = elem.parentElement; + } + + event.preventDefault(); + event.stopPropagation(); +} + +export type PartialCSSStyle = Omit, + 'visibility' | + 'display' | + 'parentRule' | + 'getPropertyPriority' | + 'getPropertyValue' | + 'item' | + 'removeProperty' | + 'setProperty'>; + +export function measureTextWidth(text: string | string[], style?: PartialCSSStyle): number { + const measureElement = getMeasurementElement(style); + text = Array.isArray(text) ? text : [text]; + let width = 0; + for (const item of text) { + measureElement.textContent = item; + width = Math.max(measureElement.getBoundingClientRect().width, width); + } + return width; +} + +export function measureTextHeight(text: string | string[], style?: PartialCSSStyle): number { + const measureElement = getMeasurementElement(style); + text = Array.isArray(text) ? text : [text]; + let height = 0; + for (const item of text) { + measureElement.textContent = item; + height = Math.max(measureElement.getBoundingClientRect().height, height); + } + return height; +} + +const defaultStyle = document.createElement('div').style; +defaultStyle.fontFamily = 'var(--theia-ui-font-family)'; +defaultStyle.fontSize = 'var(--theia-ui-font-size1)'; +defaultStyle.visibility = 'hidden'; + +function getMeasurementElement(style?: PartialCSSStyle): HTMLElement { + let measureElement = document.getElementById('measure'); + if (!measureElement) { + measureElement = document.createElement('span'); + measureElement.id = 'measure'; + measureElement.style.fontFamily = defaultStyle.fontFamily; + measureElement.style.fontSize = defaultStyle.fontSize; + measureElement.style.visibility = defaultStyle.visibility; + document.body.appendChild(measureElement); + } + const measureStyle = measureElement.style; + // Reset styling first + for (let i = 0; i < measureStyle.length; i++) { + const property = measureStyle[i]; + measureStyle.setProperty(property, defaultStyle.getPropertyValue(property)); + } + // Apply new styling + if (style) { + for (const [key, value] of Object.entries(style)) { + measureStyle.setProperty(key, value as string); + } + } + return measureElement; +} + +export function onDomEvent( + element: Node, + type: K, + listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => unknown, + options?: boolean | AddEventListenerOptions): Disposable { + element.addEventListener(type, listener, options); + return { dispose: () => element.removeEventListener(type, listener, options) }; +} + +/** Is a mouse `event` the pointer event that triggers the context menu on this platform? */ +export function isContextMenuEvent(event: MouseEvent): boolean { + return isOSX && event.ctrlKey && event.button === 0 || event.button === 2; +} diff --git a/packages/core/src/browser/clipboard-service.ts b/packages/core/src/browser/clipboard-service.ts new file mode 100644 index 0000000..a038efb --- /dev/null +++ b/packages/core/src/browser/clipboard-service.ts @@ -0,0 +1,23 @@ +// ***************************************************************************** +// Copyright (C) 2019 RedHat and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { MaybePromise } from '../common/types'; + +export const ClipboardService = Symbol('ClipboardService'); +export interface ClipboardService { + readText(): MaybePromise; + writeText(value: string): MaybePromise; +} diff --git a/packages/core/src/browser/color-application-contribution.ts b/packages/core/src/browser/color-application-contribution.ts new file mode 100644 index 0000000..91cb427 --- /dev/null +++ b/packages/core/src/browser/color-application-contribution.ts @@ -0,0 +1,110 @@ +// ***************************************************************************** +// Copyright (C) 2019 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { injectable, inject, named } from 'inversify'; +import { ColorRegistry } from './color-registry'; +import { Emitter } from '../common/event'; +import { ThemeService } from './theming'; +import { FrontendApplicationContribution } from './frontend-application-contribution'; +import { ContributionProvider } from '../common/contribution-provider'; +import { Disposable, DisposableCollection } from '../common/disposable'; +import { DEFAULT_BACKGROUND_COLOR_STORAGE_KEY } from './frontend-application-config-provider'; +import { SecondaryWindowHandler } from './secondary-window-handler'; + +export const ColorContribution = Symbol('ColorContribution'); +export interface ColorContribution { + registerColors(colors: ColorRegistry): void; +} + +@injectable() +export class ColorApplicationContribution implements FrontendApplicationContribution { + + protected readonly onDidChangeEmitter = new Emitter(); + readonly onDidChange = this.onDidChangeEmitter.event; + private readonly windows: Set = new Set(); + + @inject(ColorRegistry) + protected readonly colors: ColorRegistry; + + @inject(ContributionProvider) @named(ColorContribution) + protected readonly colorContributions: ContributionProvider; + + @inject(ThemeService) protected readonly themeService: ThemeService; + + @inject(SecondaryWindowHandler) + protected readonly secondaryWindowHandler: SecondaryWindowHandler; + + onStart(): void { + for (const contribution of this.colorContributions.getContributions()) { + contribution.registerColors(this.colors); + } + this.themeService.initialized.then(() => this.update()); + this.themeService.onDidColorThemeChange(() => { + this.update(); + this.updateThemeBackground(); + }); + this.colors.onDidChange(() => this.update()); + + this.registerWindow(window); + this.secondaryWindowHandler.onWillAddWidget(([widget, window]) => { + this.registerWindow(window); + }); + this.secondaryWindowHandler.onWillRemoveWidget(([widget, window]) => { + this.windows.delete(window); + }); + } + + registerWindow(win: Window): void { + this.windows.add(win); + this.updateWindow(win); + this.onDidChangeEmitter.fire(); + } + + protected readonly toUpdate = new DisposableCollection(); + protected update(): void { + this.toUpdate.dispose(); + this.windows.forEach(win => this.updateWindow(win)); + this.onDidChangeEmitter.fire(); + } + + protected updateWindow(win: Window): void { + const theme = 'theia-' + this.themeService.getCurrentTheme().type; + + win.document.body.classList.add(theme); + this.toUpdate.push(Disposable.create(() => win.document.body.classList.remove(theme))); + + const documentElement = win.document.documentElement; + if (documentElement) { + for (const id of this.colors.getColors()) { + const variable = this.colors.getCurrentCssVariable(id); + if (variable) { + const { name, value } = variable; + documentElement.style.setProperty(name, value); + this.toUpdate.push(Disposable.create(() => documentElement.style.removeProperty(name))); + } + } + } + } + + protected updateThemeBackground(): void { + const color = this.colors.getCurrentColor('editor.background'); + if (color) { + window.localStorage.setItem(DEFAULT_BACKGROUND_COLOR_STORAGE_KEY, color); + } else { + window.localStorage.removeItem(DEFAULT_BACKGROUND_COLOR_STORAGE_KEY); + } + } +} diff --git a/packages/core/src/browser/color-registry.ts b/packages/core/src/browser/color-registry.ts new file mode 100644 index 0000000..18ea321 --- /dev/null +++ b/packages/core/src/browser/color-registry.ts @@ -0,0 +1,60 @@ +// ***************************************************************************** +// Copyright (C) 2019 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { injectable } from 'inversify'; +import { DisposableCollection, Disposable } from '../common/disposable'; +import { Emitter } from '../common/event'; +import { ColorDefinition, ColorCssVariable } from '../common/color'; + +@injectable() +export class ColorRegistry { + + protected readonly onDidChangeEmitter = new Emitter(); + readonly onDidChange = this.onDidChangeEmitter.event; + protected fireDidChange(): void { + this.onDidChangeEmitter.fire(undefined); + } + + *getColors(): IterableIterator { } + + getCurrentCssVariable(id: string): ColorCssVariable | undefined { + const value = this.getCurrentColor(id); + if (!value) { + return undefined; + } + const name = this.toCssVariableName(id); + return { name, value }; + } + + toCssVariableName(id: string, prefix = 'theia'): string { + return `--${prefix}-${id.replace(/\./g, '-')}`; + } + + getCurrentColor(id: string): string | undefined { + return undefined; + } + + register(...definitions: ColorDefinition[]): Disposable { + const result = new DisposableCollection(...definitions.map(definition => this.doRegister(definition))); + this.fireDidChange(); + return result; + } + + protected doRegister(definition: ColorDefinition): Disposable { + return Disposable.NULL; + } + +} diff --git a/packages/core/src/browser/command-open-handler.ts b/packages/core/src/browser/command-open-handler.ts new file mode 100644 index 0000000..2692ae5 --- /dev/null +++ b/packages/core/src/browser/command-open-handler.ts @@ -0,0 +1,54 @@ +// ***************************************************************************** +// Copyright (C) 2019 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { injectable, inject } from 'inversify'; +import { CommandService } from '../common/command'; +import URI from '../common/uri'; +import { OpenHandler } from './opener-service'; + +@injectable() +export class CommandOpenHandler implements OpenHandler { + + readonly id = 'command'; + + @inject(CommandService) + protected readonly commands: CommandService; + + canHandle(uri: URI): number { + return uri.scheme === 'command' ? 500 : -1; + } + + async open(uri: URI): Promise { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + let args: any = []; + try { + args = JSON.parse(decodeURIComponent(uri.query)); + } catch { + // ignore and retry + try { + args = JSON.parse(uri.query); + } catch { + args = uri.query; + } + } + if (!Array.isArray(args)) { + args = [args]; + } + await this.commands.executeCommand(uri.path.toString(), ...args); + return true; + } + +} diff --git a/packages/core/src/browser/common-commands.ts b/packages/core/src/browser/common-commands.ts new file mode 100644 index 0000000..22965da --- /dev/null +++ b/packages/core/src/browser/common-commands.ts @@ -0,0 +1,281 @@ +// ***************************************************************************** +// Copyright (C) 2017 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { Command } from '../common/command'; +import { nls } from '../common/nls'; + +export namespace CommonCommands { + + export const FILE_CATEGORY = 'File'; + export const VIEW_CATEGORY = 'View'; + export const CREATE_CATEGORY = 'Create'; + export const PREFERENCES_CATEGORY = 'Preferences'; + export const MANAGE_CATEGORY = 'Manage'; + export const FILE_CATEGORY_KEY = nls.getDefaultKey(FILE_CATEGORY); + export const VIEW_CATEGORY_KEY = nls.getDefaultKey(VIEW_CATEGORY); + export const PREFERENCES_CATEGORY_KEY = nls.getDefaultKey(PREFERENCES_CATEGORY); + + export const OPEN: Command = { + id: 'core.open', + }; + + export const CUT = Command.toDefaultLocalizedCommand({ + id: 'core.cut', + label: 'Cut' + }); + export const COPY = Command.toDefaultLocalizedCommand({ + id: 'core.copy', + label: 'Copy' + }); + export const PASTE = Command.toDefaultLocalizedCommand({ + id: 'core.paste', + label: 'Paste' + }); + + export const COPY_PATH = Command.toDefaultLocalizedCommand({ + id: 'core.copy.path', + label: 'Copy Path' + }); + + export const UNDO = Command.toDefaultLocalizedCommand({ + id: 'core.undo', + label: 'Undo' + }); + export const REDO = Command.toDefaultLocalizedCommand({ + id: 'core.redo', + label: 'Redo' + }); + export const SELECT_ALL = Command.toDefaultLocalizedCommand({ + id: 'core.selectAll', + label: 'Select All' + }); + + export const FIND = Command.toDefaultLocalizedCommand({ + id: 'core.find', + label: 'Find' + }); + export const REPLACE = Command.toDefaultLocalizedCommand({ + id: 'core.replace', + label: 'Replace' + }); + + export const NEXT_TAB = Command.toDefaultLocalizedCommand({ + id: 'core.nextTab', + category: VIEW_CATEGORY, + label: 'Show Next Tab' + }); + export const PREVIOUS_TAB = Command.toDefaultLocalizedCommand({ + id: 'core.previousTab', + category: VIEW_CATEGORY, + label: 'Show Previous Tab' + }); + export const NEXT_TAB_IN_GROUP = Command.toLocalizedCommand({ + id: 'core.nextTabInGroup', + category: VIEW_CATEGORY, + label: 'Switch to Next Tab in Group' + }, 'theia/core/common/showNextTabInGroup', VIEW_CATEGORY_KEY); + export const PREVIOUS_TAB_IN_GROUP = Command.toLocalizedCommand({ + id: 'core.previousTabInGroup', + category: VIEW_CATEGORY, + label: 'Switch to Previous Tab in Group' + }, 'theia/core/common/showPreviousTabInGroup', VIEW_CATEGORY_KEY); + export const NEXT_TAB_GROUP = Command.toLocalizedCommand({ + id: 'core.nextTabGroup', + category: VIEW_CATEGORY, + label: 'Switch to Next Tab Group' + }, 'theia/core/common/showNextTabGroup', VIEW_CATEGORY_KEY); + export const PREVIOUS_TAB_GROUP = Command.toLocalizedCommand({ + id: 'core.previousTabBar', + category: VIEW_CATEGORY, + label: 'Switch to Previous Tab Group' + }, 'theia/core/common/showPreviousTabGroup', VIEW_CATEGORY_KEY); + export const CLOSE_TAB = Command.toLocalizedCommand({ + id: 'core.close.tab', + category: VIEW_CATEGORY, + label: 'Close Tab' + }, 'theia/core/common/closeTab', VIEW_CATEGORY_KEY); + export const CLOSE_OTHER_TABS = Command.toLocalizedCommand({ + id: 'core.close.other.tabs', + category: VIEW_CATEGORY, + label: 'Close Other Tabs' + }, 'theia/core/common/closeOthers', VIEW_CATEGORY_KEY); + export const CLOSE_SAVED_TABS = Command.toDefaultLocalizedCommand({ + id: 'workbench.action.closeUnmodifiedEditors', + category: VIEW_CATEGORY, + label: 'Close Saved Editors in Group', + }); + export const CLOSE_RIGHT_TABS = Command.toLocalizedCommand({ + id: 'core.close.right.tabs', + category: VIEW_CATEGORY, + label: 'Close Tabs to the Right' + }, 'theia/core/common/closeRight', VIEW_CATEGORY_KEY); + export const CLOSE_ALL_TABS = Command.toLocalizedCommand({ + id: 'core.close.all.tabs', + category: VIEW_CATEGORY, + label: 'Close All Tabs' + }, 'theia/core/common/closeAll', VIEW_CATEGORY_KEY); + export const CLOSE_MAIN_TAB = Command.toLocalizedCommand({ + id: 'core.close.main.tab', + category: VIEW_CATEGORY, + label: 'Close Tab in Main Area' + }, 'theia/core/common/closeTabMain', VIEW_CATEGORY_KEY); + export const CLOSE_OTHER_MAIN_TABS = Command.toLocalizedCommand({ + id: 'core.close.other.main.tabs', + category: VIEW_CATEGORY, + label: 'Close Other Tabs in Main Area' + }, 'theia/core/common/closeOtherTabMain', VIEW_CATEGORY_KEY); + export const CLOSE_ALL_MAIN_TABS = Command.toLocalizedCommand({ + id: 'core.close.all.main.tabs', + category: VIEW_CATEGORY, + label: 'Close All Tabs in Main Area' + }, 'theia/core/common/closeAllTabMain', VIEW_CATEGORY_KEY); + export const COLLAPSE_PANEL = Command.toLocalizedCommand({ + id: 'core.collapse.tab', + category: VIEW_CATEGORY, + label: 'Collapse Side Panel' + }, 'theia/core/common/collapseTab', VIEW_CATEGORY_KEY); + export const COLLAPSE_ALL_PANELS = Command.toLocalizedCommand({ + id: 'core.collapse.all.tabs', + category: VIEW_CATEGORY, + label: 'Collapse All Side Panels' + }, 'theia/core/common/collapseAllTabs', VIEW_CATEGORY_KEY); + export const TOGGLE_BOTTOM_PANEL = Command.toLocalizedCommand({ + id: 'core.toggle.bottom.panel', + category: VIEW_CATEGORY, + label: 'Toggle Bottom Panel' + }, 'theia/core/common/collapseBottomPanel', VIEW_CATEGORY_KEY); + export const TOGGLE_LEFT_PANEL = Command.toLocalizedCommand({ + id: 'core.toggle.left.panel', + category: VIEW_CATEGORY, + label: 'Toggle Left Panel' + }, 'theia/core/common/collapseLeftPanel', VIEW_CATEGORY_KEY); + export const TOGGLE_RIGHT_PANEL = Command.toLocalizedCommand({ + id: 'core.toggle.right.panel', + category: VIEW_CATEGORY, + label: 'Toggle Right Panel' + }, 'theia/core/common/collapseRightPanel', VIEW_CATEGORY_KEY); + export const TOGGLE_STATUS_BAR = Command.toDefaultLocalizedCommand({ + id: 'workbench.action.toggleStatusbarVisibility', + category: VIEW_CATEGORY, + label: 'Toggle Status Bar Visibility' + }); + export const PIN_TAB = Command.toDefaultLocalizedCommand({ + id: 'workbench.action.pinEditor', + category: VIEW_CATEGORY, + label: 'Pin Editor' + }); + export const UNPIN_TAB = Command.toDefaultLocalizedCommand({ + id: 'workbench.action.unpinEditor', + category: VIEW_CATEGORY, + label: 'Unpin Editor' + }); + export const TOGGLE_MAXIMIZED = Command.toLocalizedCommand({ + id: 'core.toggleMaximized', + category: VIEW_CATEGORY, + label: 'Toggle Maximized' + }, 'theia/core/common/toggleMaximized', VIEW_CATEGORY_KEY); + export const OPEN_VIEW = Command.toDefaultLocalizedCommand({ + id: 'core.openView', + category: VIEW_CATEGORY, + label: 'Open View...' + }); + export const SHOW_MENU_BAR = Command.toDefaultLocalizedCommand({ + id: 'window.menuBarVisibility', + category: VIEW_CATEGORY, + label: 'Toggle Menu Bar' + }); + /** + * Command Parameters: + * - `fileName`: string + * - `directory`: URI + */ + export const NEW_FILE = Command.toDefaultLocalizedCommand({ + id: 'workbench.action.files.newFile', + category: FILE_CATEGORY + }); + // This command immediately opens a new untitled text file + // Some VS Code extensions use this command to create new files + export const NEW_UNTITLED_TEXT_FILE = Command.toDefaultLocalizedCommand({ + id: 'workbench.action.files.newUntitledFile', + category: FILE_CATEGORY, + label: 'New Untitled Text File' + }); + // This command opens a quick pick to select a file type to create + export const PICK_NEW_FILE = Command.toDefaultLocalizedCommand({ + id: 'workbench.action.files.pickNewFile', + category: CREATE_CATEGORY, + label: 'New File...' + }); + export const SAVE = Command.toDefaultLocalizedCommand({ + id: 'core.save', + category: FILE_CATEGORY, + label: 'Save', + }); + export const SAVE_AS = Command.toDefaultLocalizedCommand({ + id: 'file.saveAs', + category: FILE_CATEGORY, + label: 'Save As...', + }); + export const SAVE_WITHOUT_FORMATTING = Command.toDefaultLocalizedCommand({ + id: 'core.saveWithoutFormatting', + category: FILE_CATEGORY, + label: 'Save without Formatting', + }); + export const SAVE_ALL = Command.toDefaultLocalizedCommand({ + id: 'core.saveAll', + category: FILE_CATEGORY, + label: 'Save All', + }); + + export const AUTO_SAVE = Command.toDefaultLocalizedCommand({ + id: 'textEditor.commands.autosave', + category: FILE_CATEGORY, + label: 'Auto Save', + }); + + export const ABOUT_COMMAND = Command.toDefaultLocalizedCommand({ + id: 'core.about', + label: 'About' + }); + + export const OPEN_PREFERENCES = Command.toDefaultLocalizedCommand({ + id: 'preferences:open', + category: PREFERENCES_CATEGORY, + label: 'Open Settings (UI)', + }); + + export const SELECT_COLOR_THEME = Command.toDefaultLocalizedCommand({ + id: 'workbench.action.selectTheme', + label: 'Color Theme', + category: PREFERENCES_CATEGORY + }); + export const SELECT_ICON_THEME = Command.toDefaultLocalizedCommand({ + id: 'workbench.action.selectIconTheme', + label: 'File Icon Theme', + category: PREFERENCES_CATEGORY + }); + + export const CONFIGURE_DISPLAY_LANGUAGE = Command.toDefaultLocalizedCommand({ + id: 'workbench.action.configureLanguage', + label: 'Configure Display Language' + }); + + export const TOGGLE_BREADCRUMBS = Command.toDefaultLocalizedCommand({ + id: 'breadcrumbs.toggle', + label: 'Toggle Breadcrumbs', + category: VIEW_CATEGORY + }); +} diff --git a/packages/core/src/browser/common-frontend-contribution.ts b/packages/core/src/browser/common-frontend-contribution.ts new file mode 100644 index 0000000..f302516 --- /dev/null +++ b/packages/core/src/browser/common-frontend-contribution.ts @@ -0,0 +1,2572 @@ +// ***************************************************************************** +// Copyright (C) 2017 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +/* eslint-disable max-len, @typescript-eslint/indent */ + +import debounce = require('lodash.debounce'); +import { injectable, inject, optional } from 'inversify'; +import { MAIN_MENU_BAR, MANAGE_MENU, MenuContribution, MenuModelRegistry, ACCOUNTS_MENU, CompoundMenuNode, CommandMenu, Group, Submenu } from '../common/menu'; +import { CommonMenus } from './common-menus'; +export { CommonMenus }; +import { KeybindingContribution, KeybindingRegistry } from './keybinding'; +import { FrontendApplication } from './frontend-application'; +import { FrontendApplicationContribution, OnWillStopAction } from './frontend-application-contribution'; +import { CommandContribution, CommandRegistry, Command } from '../common/command'; +import { CommonCommands } from './common-commands'; +export { CommonCommands }; +import { UriAwareCommandHandler } from '../common/uri-command-handler'; +import { SelectionService } from '../common/selection-service'; +import { MessageService } from '../common/message-service'; +import { OpenerService, open } from '../browser/opener-service'; +import { ApplicationShell } from './shell/application-shell'; +import { SHELL_TABBAR_CONTEXT_CLOSE, SHELL_TABBAR_CONTEXT_COPY, SHELL_TABBAR_CONTEXT_PIN, SHELL_TABBAR_CONTEXT_SPLIT } from './shell/tab-bars'; +import { AboutDialog } from './about-dialog'; +import * as browser from './browser'; +import URI from '../common/uri'; +import { ContextKey, ContextKeyService } from './context-key-service'; +import { OS, isOSX, isWindows, EOL } from '../common/os'; +import { ResourceContextKey } from './resource-context-key'; +import { UriSelection } from '../common/selection'; +import { StorageService } from './storage-service'; +import { Navigatable, NavigatableWidget } from './navigatable'; +import { QuickViewService } from './quick-input/quick-view-service'; +import { environment } from '@theia/application-package/lib/environment'; +import { IconTheme, IconThemeService } from './icon-theme-service'; +import { ColorContribution } from './color-application-contribution'; +import { ColorRegistry } from './color-registry'; +import { Color } from '../common/color'; +import { CoreConfiguration, CorePreferences } from '../common/core-preferences'; +import { ThemeService } from './theming'; +import { ClipboardService } from './clipboard-service'; +import { EncodingRegistry } from './encoding-registry'; +import { UTF8 } from '../common/encodings'; +import { EnvVariablesServer } from '../common/env-variables'; +import { AuthenticationService } from './authentication-service'; +import { FormatType, Saveable, SaveOptions } from './saveable'; +import { QuickInputService, QuickPickItem, QuickPickItemOrSeparator, QuickPickSeparator } from './quick-input'; +import { AsyncLocalizationProvider } from '../common/i18n/localization'; +import { nls } from '../common/nls'; +import { CurrentWidgetCommandAdapter } from './shell/current-widget-command-adapter'; +import { ConfirmDialog, confirmExit, ConfirmSaveDialog, Dialog } from './dialogs'; +import { WindowService } from './window/window-service'; +import { FrontendApplicationConfigProvider } from './frontend-application-config-provider'; +import { DecorationStyle } from './decoration-style'; +import { codicon, isPinned, Title, togglePinned, Widget } from './widgets'; +import { SaveableService } from './saveable-service'; +import { UserWorkingDirectoryProvider } from './user-working-directory-provider'; +import { PreferenceChangeEvent, PreferenceScope, PreferenceService, UNTITLED_SCHEME, UntitledResourceResolver } from '../common'; +import { LanguageQuickPickService } from './i18n/language-quick-pick-service'; +import { SidebarMenu } from './shell/sidebar-menu-widget'; +import { UndoRedoHandlerService } from './undo-redo-handler'; +import { timeout } from '../common/promise-util'; + +export const supportCut = environment.electron.is() || document.queryCommandSupported('cut'); +export const supportCopy = environment.electron.is() || document.queryCommandSupported('copy'); +// Chrome incorrectly returns true for document.queryCommandSupported('paste') +// when the paste feature is available but the calling script has insufficient +// privileges to actually perform the action +export const supportPaste = environment.electron.is() || (!browser.isChrome && document.queryCommandSupported('paste')); + +export const RECENT_COMMANDS_STORAGE_KEY = 'commands'; + +export const CLASSNAME_OS_MAC = 'mac'; +export const CLASSNAME_OS_WINDOWS = 'windows'; +export const CLASSNAME_OS_LINUX = 'linux'; + +@injectable() +export class CommonFrontendContribution implements FrontendApplicationContribution, MenuContribution, CommandContribution, KeybindingContribution, ColorContribution { + + protected commonDecorationsStyleSheet: CSSStyleSheet = DecorationStyle.createStyleSheet('coreCommonDecorationsStyle'); + + constructor( + @inject(ApplicationShell) protected readonly shell: ApplicationShell, + @inject(SelectionService) protected readonly selectionService: SelectionService, + @inject(MessageService) protected readonly messageService: MessageService, + @inject(OpenerService) protected readonly openerService: OpenerService, + @inject(AboutDialog) protected readonly aboutDialog: AboutDialog, + @inject(AsyncLocalizationProvider) protected readonly localizationProvider: AsyncLocalizationProvider, + @inject(SaveableService) protected readonly saveResourceService: SaveableService, + ) { } + + @inject(ContextKeyService) + protected readonly contextKeyService: ContextKeyService; + + @inject(ResourceContextKey) + protected readonly resourceContextKey: ResourceContextKey; + + @inject(CommandRegistry) + protected readonly commandRegistry: CommandRegistry; + + @inject(MenuModelRegistry) + protected readonly menuRegistry: MenuModelRegistry; + + @inject(StorageService) + protected readonly storageService: StorageService; + + @inject(QuickInputService) @optional() + protected readonly quickInputService: QuickInputService; + + @inject(IconThemeService) + protected readonly iconThemes: IconThemeService; + + @inject(ThemeService) + protected readonly themeService: ThemeService; + + @inject(CorePreferences) + protected readonly preferences: CorePreferences; + + @inject(PreferenceService) + protected readonly preferenceService: PreferenceService; + + @inject(ClipboardService) + protected readonly clipboardService: ClipboardService; + + @inject(EncodingRegistry) + protected readonly encodingRegistry: EncodingRegistry; + + @inject(EnvVariablesServer) + protected readonly environments: EnvVariablesServer; + + @inject(AuthenticationService) + protected readonly authenticationService: AuthenticationService; + + @inject(WindowService) + protected readonly windowService: WindowService; + + @inject(UserWorkingDirectoryProvider) + protected readonly workingDirProvider: UserWorkingDirectoryProvider; + + @inject(LanguageQuickPickService) + protected readonly languageQuickPickService: LanguageQuickPickService; + + @inject(UntitledResourceResolver) + protected readonly untitledResourceResolver: UntitledResourceResolver; + + @inject(UndoRedoHandlerService) + protected readonly undoRedoHandlerService: UndoRedoHandlerService; + + protected pinnedKey: ContextKey; + protected inputFocus: ContextKey; + + async configure(app: FrontendApplication): Promise { + // FIXME: This request blocks valuable startup time (~200ms). + const configDirUri = await this.environments.getConfigDirUri(); + // Global settings + this.encodingRegistry.registerOverride({ + encoding: UTF8, + parent: new URI(configDirUri) + }); + + this.contextKeyService.createKey('isLinux', OS.type() === OS.Type.Linux); + this.contextKeyService.createKey('isMac', OS.type() === OS.Type.OSX); + this.contextKeyService.createKey('isWindows', OS.type() === OS.Type.Windows); + this.contextKeyService.createKey('isWeb', !this.isElectron()); + this.inputFocus = this.contextKeyService.createKey('inputFocus', false); + this.updateInputFocus(); + browser.onDomEvent(document, 'focusin', () => this.updateInputFocus()); + + this.pinnedKey = this.contextKeyService.createKey('activeEditorIsPinned', false); + this.updatePinnedKey(); + this.shell.onDidChangeActiveWidget(() => this.updatePinnedKey()); + + this.initResourceContextKeys(); + this.registerCtrlWHandling(); + + this.setOsClass(); + this.updateStyles(); + this.preferences.ready.then(() => this.setSashProperties()); + this.preferences.onPreferenceChanged(e => this.handlePreferenceChange(e, app)); + + app.shell.initialized.then(() => { + app.shell.leftPanelHandler.addBottomMenu({ + id: 'settings-menu', + iconClass: codicon('settings-gear'), + title: nls.localizeByDefault(CommonCommands.MANAGE_CATEGORY), + menuPath: MANAGE_MENU, + order: 0, + }); + const accountsMenu: SidebarMenu = { + id: 'accounts-menu', + iconClass: codicon('account'), + title: nls.localizeByDefault('Accounts'), + menuPath: ACCOUNTS_MENU, + order: 1, + onDidBadgeChange: this.authenticationService.onDidUpdateSignInCount + }; + this.authenticationService.onDidRegisterAuthenticationProvider(() => { + app.shell.leftPanelHandler.addBottomMenu(accountsMenu); + }); + this.authenticationService.onDidUnregisterAuthenticationProvider(() => { + if (this.authenticationService.getProviderIds().length === 0) { + app.shell.leftPanelHandler.removeBottomMenu(accountsMenu.id); + } + }); + }); + } + + protected setOsClass(): void { + if (isOSX) { + document.body.classList.add(CLASSNAME_OS_MAC); + } else if (isWindows) { + document.body.classList.add(CLASSNAME_OS_WINDOWS); + } else { + document.body.classList.add(CLASSNAME_OS_LINUX); + } + } + + protected updateStyles(): void { + document.body.classList.remove('theia-editor-highlightModifiedTabs'); + if (this.preferences['workbench.editor.highlightModifiedTabs']) { + document.body.classList.add('theia-editor-highlightModifiedTabs'); + } + } + + protected updateInputFocus(): void { + const activeElement = document.activeElement; + if (activeElement) { + const isInput = activeElement.tagName?.toLowerCase() === 'input' + || activeElement.tagName?.toLowerCase() === 'textarea'; + this.inputFocus.set(isInput); + } + } + + protected updatePinnedKey(): void { + const activeTab = this.shell.findTabBar(); + const pinningTarget = activeTab && this.shell.findTitle(activeTab); + const value = pinningTarget && isPinned(pinningTarget); + this.pinnedKey.set(value); + } + + protected handlePreferenceChange(e: PreferenceChangeEvent, app: FrontendApplication): void { + switch (e.preferenceName) { + case 'workbench.editor.highlightModifiedTabs': { + this.updateStyles(); + break; + } + case 'window.menuBarVisibility': { + const menuBarVisibility = this.preferences['window.menuBarVisibility']; + const mainMenuId = 'main-menu'; + if (menuBarVisibility === 'compact') { + this.shell.leftPanelHandler.addTopMenu({ + id: mainMenuId, + iconClass: `theia-compact-menu ${codicon('menu')}`, + title: nls.localizeByDefault('Application Menu'), + menuPath: MAIN_MENU_BAR, + order: 0, + }); + } else { + app.shell.leftPanelHandler.removeTopMenu(mainMenuId); + } + break; + } + case 'workbench.sash.hoverDelay': + case 'workbench.sash.size': { + this.setSashProperties(); + break; + } + } + } + + protected setSashProperties(): void { + const sashRule = `:root { + --theia-sash-hoverDelay: ${this.preferences['workbench.sash.hoverDelay']}ms; + --theia-sash-width: ${this.preferences['workbench.sash.size']}px; + }`; + + DecorationStyle.deleteStyleRule(':root', this.commonDecorationsStyleSheet); + this.commonDecorationsStyleSheet.insertRule(sashRule); + } + + onStart(): void { + this.storageService.getData<{ recent: Command[] }>(RECENT_COMMANDS_STORAGE_KEY, { recent: [] }) + .then(tasks => this.commandRegistry.recent = tasks.recent); + } + + onStop(): void { + const recent = this.commandRegistry.recent; + this.storageService.setData<{ recent: Command[] }>(RECENT_COMMANDS_STORAGE_KEY, { recent }); + window.localStorage.setItem(IconThemeService.STORAGE_KEY, this.iconThemes.current); + window.localStorage.setItem(ThemeService.STORAGE_KEY, this.themeService.getCurrentTheme().id); + } + + protected initResourceContextKeys(): void { + const updateContextKeys = () => { + const selection = this.selectionService.selection; + const resourceUri = Navigatable.is(selection) && selection.getResourceUri() || UriSelection.getUri(selection); + this.resourceContextKey.set(resourceUri); + }; + updateContextKeys(); + this.selectionService.onSelectionChanged(updateContextKeys); + } + + registerMenus(registry: MenuModelRegistry): void { + registry.registerSubmenu(CommonMenus.FILE, nls.localizeByDefault('File')); + registry.registerSubmenu(CommonMenus.EDIT, nls.localizeByDefault('Edit')); + registry.registerSubmenu(CommonMenus.VIEW, nls.localizeByDefault('View')); + registry.registerSubmenu(CommonMenus.HELP, nls.localizeByDefault('Help')); + + // For plugins contributing create new file commands/menu-actions + registry.registerSubmenu(CommonMenus.FILE_NEW_CONTRIBUTIONS, nls.localizeByDefault('New File...')); + + registry.registerMenuAction(CommonMenus.FILE_SAVE, { + commandId: CommonCommands.SAVE.id + }); + registry.registerMenuAction(CommonMenus.FILE_SAVE, { + commandId: CommonCommands.SAVE_ALL.id + }); + + registry.registerMenuAction(CommonMenus.FILE_AUTOSAVE, { + commandId: CommonCommands.AUTO_SAVE.id + }); + + registry.registerSubmenu(CommonMenus.FILE_SETTINGS_SUBMENU, nls.localizeByDefault(CommonCommands.PREFERENCES_CATEGORY)); + + registry.registerMenuAction(CommonMenus.EDIT_UNDO, { + commandId: CommonCommands.UNDO.id, + order: '0' + }); + registry.registerMenuAction(CommonMenus.EDIT_UNDO, { + commandId: CommonCommands.REDO.id, + order: '1' + }); + + registry.registerMenuAction(CommonMenus.EDIT_FIND, { + commandId: CommonCommands.FIND.id, + order: '0' + }); + registry.registerMenuAction(CommonMenus.EDIT_FIND, { + commandId: CommonCommands.REPLACE.id, + order: '1' + }); + + registry.registerMenuAction(CommonMenus.EDIT_CLIPBOARD, { + commandId: CommonCommands.CUT.id, + order: '0' + }); + registry.registerMenuAction(CommonMenus.EDIT_CLIPBOARD, { + commandId: CommonCommands.COPY.id, + order: '1' + }); + registry.registerMenuAction(CommonMenus.EDIT_CLIPBOARD, { + commandId: CommonCommands.PASTE.id, + order: '2' + }); + registry.registerMenuAction(CommonMenus.EDIT_CLIPBOARD, { + commandId: CommonCommands.COPY_PATH.id, + order: '3' + }); + + registry.registerMenuAction(CommonMenus.VIEW_APPEARANCE_SUBMENU_BAR, { + commandId: CommonCommands.TOGGLE_BOTTOM_PANEL.id, + order: '1' + }); + registry.registerMenuAction(CommonMenus.VIEW_APPEARANCE_SUBMENU_BAR, { + commandId: CommonCommands.TOGGLE_STATUS_BAR.id, + order: '2', + label: nls.localizeByDefault('Toggle Status Bar Visibility') + }); + registry.registerMenuAction(CommonMenus.VIEW_APPEARANCE_SUBMENU_BAR, { + commandId: CommonCommands.COLLAPSE_ALL_PANELS.id, + order: '3' + }); + + registry.registerMenuAction(SHELL_TABBAR_CONTEXT_CLOSE, { + commandId: CommonCommands.CLOSE_TAB.id, + label: nls.localizeByDefault('Close'), + order: '0' + }); + registry.registerMenuAction(SHELL_TABBAR_CONTEXT_CLOSE, { + commandId: CommonCommands.CLOSE_OTHER_TABS.id, + label: nls.localizeByDefault('Close Others'), + order: '1' + }); + registry.registerMenuAction(SHELL_TABBAR_CONTEXT_CLOSE, { + commandId: CommonCommands.CLOSE_RIGHT_TABS.id, + label: nls.localizeByDefault('Close to the Right'), + order: '2' + }); + registry.registerMenuAction(SHELL_TABBAR_CONTEXT_CLOSE, { + commandId: CommonCommands.CLOSE_SAVED_TABS.id, + label: nls.localizeByDefault('Close Saved'), + order: '3', + }); + registry.registerMenuAction(SHELL_TABBAR_CONTEXT_CLOSE, { + commandId: CommonCommands.CLOSE_ALL_TABS.id, + label: nls.localizeByDefault('Close All'), + order: '4' + }); + registry.registerMenuAction(SHELL_TABBAR_CONTEXT_SPLIT, { + commandId: CommonCommands.COLLAPSE_PANEL.id, + label: CommonCommands.COLLAPSE_PANEL.label, + order: '5' + }); + registry.registerMenuAction(SHELL_TABBAR_CONTEXT_SPLIT, { + commandId: CommonCommands.TOGGLE_MAXIMIZED.id, + label: CommonCommands.TOGGLE_MAXIMIZED.label, + order: '6' + }); + registry.registerMenuAction(CommonMenus.VIEW_APPEARANCE_SUBMENU_SCREEN, { + commandId: CommonCommands.TOGGLE_MAXIMIZED.id, + label: CommonCommands.TOGGLE_MAXIMIZED.label, + order: '6' + }); + registry.registerMenuAction(SHELL_TABBAR_CONTEXT_COPY, { + commandId: CommonCommands.COPY_PATH.id, + label: CommonCommands.COPY_PATH.label, + order: '1', + }); + registry.registerMenuAction(CommonMenus.VIEW_APPEARANCE_SUBMENU_BAR, { + commandId: CommonCommands.SHOW_MENU_BAR.id, + label: nls.localizeByDefault('Toggle Menu Bar'), + order: '0' + }); + registry.registerMenuAction(SHELL_TABBAR_CONTEXT_PIN, { + commandId: CommonCommands.PIN_TAB.id, + label: nls.localizeByDefault('Pin'), + order: '7' + }); + registry.registerMenuAction(SHELL_TABBAR_CONTEXT_PIN, { + commandId: CommonCommands.UNPIN_TAB.id, + label: nls.localizeByDefault('Unpin'), + order: '8' + }); + registry.registerMenuAction(CommonMenus.HELP, { + commandId: CommonCommands.ABOUT_COMMAND.id, + label: CommonCommands.ABOUT_COMMAND.label, + order: '9' + }); + + registry.registerMenuAction(CommonMenus.VIEW_PRIMARY, { + commandId: CommonCommands.OPEN_VIEW.id + }); + + registry.registerMenuAction(CommonMenus.FILE_SETTINGS_SUBMENU_THEME, { + commandId: CommonCommands.SELECT_COLOR_THEME.id + }); + registry.registerMenuAction(CommonMenus.FILE_SETTINGS_SUBMENU_THEME, { + commandId: CommonCommands.SELECT_ICON_THEME.id + }); + + registry.registerSubmenu(CommonMenus.MANAGE_SETTINGS_THEMES, nls.localizeByDefault('Themes'), { sortString: 'a50' }); + registry.registerMenuAction(CommonMenus.MANAGE_SETTINGS_THEMES, { + commandId: CommonCommands.SELECT_COLOR_THEME.id, + order: '0' + }); + registry.registerMenuAction(CommonMenus.MANAGE_SETTINGS_THEMES, { + commandId: CommonCommands.SELECT_ICON_THEME.id, + order: '1' + }); + + registry.registerSubmenu(CommonMenus.VIEW_APPEARANCE_SUBMENU, nls.localizeByDefault('Appearance')); + + registry.registerMenuAction(CommonMenus.FILE_NEW_TEXT, { + commandId: CommonCommands.NEW_UNTITLED_TEXT_FILE.id, + label: nls.localizeByDefault('New Text File'), + order: 'a' + }); + + registry.registerMenuAction(CommonMenus.FILE_NEW_TEXT, { + commandId: CommonCommands.PICK_NEW_FILE.id, + label: nls.localizeByDefault('New File...'), + order: 'a1' + }); + } + + registerCommands(commandRegistry: CommandRegistry): void { + commandRegistry.registerCommand(CommonCommands.OPEN, UriAwareCommandHandler.MultiSelect(this.selectionService, { + execute: uris => uris.map(uri => open(this.openerService, uri)), + })); + commandRegistry.registerCommand(CommonCommands.CUT, { + execute: () => { + if (supportCut) { + document.execCommand('cut'); + } else { + this.messageService.warn(nls.localize('theia/core/cutWarn', "Please use the browser's cut command or shortcut.")); + } + } + }); + commandRegistry.registerCommand(CommonCommands.COPY, { + execute: () => { + if (supportCopy) { + document.execCommand('copy'); + } else { + this.messageService.warn(nls.localize('theia/core/copyWarn', "Please use the browser's copy command or shortcut.")); + } + } + }); + commandRegistry.registerCommand(CommonCommands.PASTE, { + execute: () => { + if (supportPaste) { + document.execCommand('paste'); + } else { + this.messageService.warn(nls.localize('theia/core/pasteWarn', "Please use the browser's paste command or shortcut.")); + } + } + }); + commandRegistry.registerCommand(CommonCommands.COPY_PATH, UriAwareCommandHandler.MultiSelect(this.selectionService, { + isVisible: uris => Array.isArray(uris) && uris.some(uri => uri instanceof URI), + isEnabled: uris => Array.isArray(uris) && uris.some(uri => uri instanceof URI), + execute: async uris => { + if (uris.length) { + const lineDelimiter = EOL; + const text = uris.map(resource => resource.path.fsPath()).join(lineDelimiter); + await this.clipboardService.writeText(text); + } else { + await this.messageService.info(nls.localize('theia/core/copyInfo', 'Open a file first to copy its path')); + } + } + })); + + commandRegistry.registerCommand(CommonCommands.UNDO, { + execute: () => { + this.undoRedoHandlerService.undo(); + } + }); + commandRegistry.registerCommand(CommonCommands.REDO, { + execute: () => { + this.undoRedoHandlerService.redo(); + } + }); + commandRegistry.registerCommand(CommonCommands.SELECT_ALL, { + execute: () => document.execCommand('selectAll') + }); + + commandRegistry.registerCommand(CommonCommands.FIND, { + execute: () => { /* no-op */ } + }); + commandRegistry.registerCommand(CommonCommands.REPLACE, { + execute: () => { /* no-op */ } + }); + + commandRegistry.registerCommand(CommonCommands.NEXT_TAB, { + isEnabled: () => this.shell.currentTabBar !== undefined, + execute: () => this.shell.activateNextTab() + }); + commandRegistry.registerCommand(CommonCommands.PREVIOUS_TAB, { + isEnabled: () => this.shell.currentTabBar !== undefined, + execute: () => this.shell.activatePreviousTab() + }); + commandRegistry.registerCommand(CommonCommands.NEXT_TAB_IN_GROUP, { + isEnabled: () => this.shell.nextTabIndexInTabBar() !== -1, + execute: () => this.shell.activateNextTabInTabBar() + }); + commandRegistry.registerCommand(CommonCommands.PREVIOUS_TAB_IN_GROUP, { + isEnabled: () => this.shell.previousTabIndexInTabBar() !== -1, + execute: () => this.shell.activatePreviousTabInTabBar() + }); + commandRegistry.registerCommand(CommonCommands.NEXT_TAB_GROUP, { + isEnabled: () => this.shell.nextTabBar() !== undefined, + execute: () => this.shell.activateNextTabBar() + }); + commandRegistry.registerCommand(CommonCommands.PREVIOUS_TAB_GROUP, { + isEnabled: () => this.shell.previousTabBar() !== undefined, + execute: () => this.shell.activatePreviousTabBar() + }); + commandRegistry.registerCommand(CommonCommands.CLOSE_TAB, new CurrentWidgetCommandAdapter(this.shell, { + isEnabled: title => Boolean(title?.closable), + execute: (title, tabBar) => tabBar && this.shell.closeTabs(tabBar, candidate => candidate === title), + })); + commandRegistry.registerCommand(CommonCommands.CLOSE_OTHER_TABS, new CurrentWidgetCommandAdapter(this.shell, { + isEnabled: (title, tabbar) => Boolean(tabbar?.titles.some(candidate => candidate !== title && candidate.closable)), + execute: (title, tabbar) => tabbar && this.shell.closeTabs(tabbar, candidate => candidate !== title && candidate.closable), + })); + commandRegistry.registerCommand(CommonCommands.CLOSE_SAVED_TABS, new CurrentWidgetCommandAdapter(this.shell, { + isEnabled: (_title, tabbar) => Boolean(tabbar?.titles.some(candidate => candidate.closable && !Saveable.isDirty(candidate.owner))), + execute: (_title, tabbar) => tabbar && this.shell.closeTabs(tabbar, candidate => candidate.closable && !Saveable.isDirty(candidate.owner)), + })); + commandRegistry.registerCommand(CommonCommands.CLOSE_RIGHT_TABS, new CurrentWidgetCommandAdapter(this.shell, { + isEnabled: (title, tabbar) => { + let targetSeen = false; + return Boolean(tabbar?.titles.some(candidate => { + if (targetSeen && candidate.closable) { return true; }; + if (candidate === title) { targetSeen = true; }; + })); + }, + isVisible: (_title, tabbar) => { + const area = (tabbar && this.shell.getAreaFor(tabbar)) ?? this.shell.currentTabArea; + return area !== undefined && area !== 'left' && area !== 'right'; + }, + execute: (title, tabbar) => { + if (tabbar) { + let targetSeen = false; + this.shell.closeTabs(tabbar, candidate => { + if (targetSeen && candidate.closable) { return true; }; + if (candidate === title) { targetSeen = true; }; + return false; + }); + } + } + })); + commandRegistry.registerCommand(CommonCommands.CLOSE_ALL_TABS, new CurrentWidgetCommandAdapter(this.shell, { + isEnabled: (_title, tabbar) => Boolean(tabbar?.titles.some(title => title.closable)), + execute: (_title, tabbar) => tabbar && this.shell.closeTabs(tabbar, candidate => candidate.closable), + })); + commandRegistry.registerCommand(CommonCommands.CLOSE_MAIN_TAB, { + isEnabled: () => { + const currentWidget = this.shell.getCurrentWidget('main'); + return currentWidget !== undefined && currentWidget.title.closable; + }, + execute: () => this.shell.getCurrentWidget('main')!.close() + }); + commandRegistry.registerCommand(CommonCommands.CLOSE_OTHER_MAIN_TABS, { + isEnabled: () => { + const currentWidget = this.shell.getCurrentWidget('main'); + return currentWidget !== undefined && + this.shell.mainAreaTabBars.some(tb => tb.titles.some(title => title.owner !== currentWidget && title.closable)); + }, + execute: () => { + const currentWidget = this.shell.getCurrentWidget('main'); + this.shell.closeTabs('main', title => title.owner !== currentWidget && title.closable); + } + }); + commandRegistry.registerCommand(CommonCommands.CLOSE_ALL_MAIN_TABS, { + isEnabled: () => this.shell.mainAreaTabBars.some(tb => tb.titles.some(title => title.closable)), + execute: () => this.shell.closeTabs('main', title => title.closable) + }); + commandRegistry.registerCommand(CommonCommands.COLLAPSE_PANEL, new CurrentWidgetCommandAdapter(this.shell, { + isEnabled: (_title, tabbar) => { + if (tabbar) { + const area = this.shell.getAreaFor(tabbar); + return ApplicationShell.isSideArea(area) && this.shell.isExpanded(area); + } + return false; + }, + isVisible: (_title, tabbar) => Boolean(tabbar && ApplicationShell.isSideArea(this.shell.getAreaFor(tabbar))), + execute: (_title, tabbar) => tabbar && this.shell.collapsePanel(this.shell.getAreaFor(tabbar)!) + })); + commandRegistry.registerCommand(CommonCommands.COLLAPSE_ALL_PANELS, { + execute: () => { + this.shell.collapsePanel('left'); + this.shell.collapsePanel('right'); + this.shell.collapsePanel('bottom'); + } + }); + commandRegistry.registerCommand(CommonCommands.TOGGLE_BOTTOM_PANEL, { + isEnabled: () => this.shell.getWidgets('bottom').length > 0, + execute: () => { + if (this.shell.isExpanded('bottom')) { + this.shell.collapsePanel('bottom'); + } else { + this.shell.expandPanel('bottom'); + } + } + }); + commandRegistry.registerCommand(CommonCommands.TOGGLE_LEFT_PANEL, { + isEnabled: () => this.shell.getWidgets('left').length > 0, + execute: () => { + if (this.shell.isExpanded('left')) { + this.shell.collapsePanel('left'); + } else { + this.shell.expandPanel('left'); + } + } + }); + commandRegistry.registerCommand(CommonCommands.TOGGLE_RIGHT_PANEL, { + isEnabled: () => this.shell.getWidgets('right').length > 0, + execute: () => { + if (this.shell.isExpanded('right')) { + this.shell.collapsePanel('right'); + } else { + this.shell.expandPanel('right'); + } + } + }); + commandRegistry.registerCommand(CommonCommands.TOGGLE_STATUS_BAR, { + execute: () => this.preferenceService.updateValue('workbench.statusBar.visible', !this.preferences['workbench.statusBar.visible']) + }); + commandRegistry.registerCommand(CommonCommands.TOGGLE_MAXIMIZED, new CurrentWidgetCommandAdapter(this.shell, { + isEnabled: title => Boolean(title?.owner && this.shell.canToggleMaximized(title?.owner)), + isVisible: title => Boolean(title?.owner && this.shell.canToggleMaximized(title?.owner)), + execute: title => title?.owner && this.shell.toggleMaximized(title?.owner), + })); + commandRegistry.registerCommand(CommonCommands.SHOW_MENU_BAR, { + isEnabled: () => !isOSX, + isVisible: () => !isOSX, + execute: () => { + const menuBarVisibility = 'window.menuBarVisibility'; + const visibility = this.preferences[menuBarVisibility]; + if (visibility !== 'compact') { + this.preferenceService.updateValue(menuBarVisibility, 'compact'); + } else { + this.preferenceService.updateValue(menuBarVisibility, 'classic'); + } + } + }); + commandRegistry.registerCommand(CommonCommands.SAVE, { + execute: () => this.save({ formatType: FormatType.ON }) + }); + commandRegistry.registerCommand(CommonCommands.SAVE_AS, { + isEnabled: () => this.saveResourceService.canSaveAs(this.shell.currentWidget), + execute: () => { + const { currentWidget } = this.shell; + // No clue what could have happened between `isEnabled` and `execute` + // when fetching currentWidget, so better to double-check: + if (this.saveResourceService.canSaveAs(currentWidget)) { + this.saveResourceService.saveAs(currentWidget); + } else { + this.messageService.error(nls.localize('theia/workspace/failSaveAs', 'Cannot run "{0}" for the current widget.', CommonCommands.SAVE_AS.label!)); + } + }, + }); + commandRegistry.registerCommand(CommonCommands.SAVE_WITHOUT_FORMATTING, { + execute: () => this.save({ formatType: FormatType.OFF }) + }); + commandRegistry.registerCommand(CommonCommands.SAVE_ALL, { + execute: () => this.shell.saveAll({ formatType: FormatType.DIRTY }) + }); + commandRegistry.registerCommand(CommonCommands.ABOUT_COMMAND, { + execute: () => this.openAbout() + }); + + commandRegistry.registerCommand(CommonCommands.OPEN_VIEW, { + execute: () => this.quickInputService?.open(QuickViewService.PREFIX) + }); + + commandRegistry.registerCommand(CommonCommands.SELECT_COLOR_THEME, { + execute: () => this.selectColorTheme() + }); + commandRegistry.registerCommand(CommonCommands.SELECT_ICON_THEME, { + execute: () => this.selectIconTheme() + }); + commandRegistry.registerCommand(CommonCommands.PIN_TAB, new CurrentWidgetCommandAdapter(this.shell, { + isEnabled: title => Boolean(title && !isPinned(title)), + execute: title => this.togglePinned(title), + })); + commandRegistry.registerCommand(CommonCommands.UNPIN_TAB, new CurrentWidgetCommandAdapter(this.shell, { + isEnabled: title => Boolean(title && isPinned(title)), + execute: title => this.togglePinned(title), + })); + commandRegistry.registerCommand(CommonCommands.CONFIGURE_DISPLAY_LANGUAGE, { + execute: () => this.configureDisplayLanguage() + }); + commandRegistry.registerCommand(CommonCommands.TOGGLE_BREADCRUMBS, { + execute: () => this.toggleBreadcrumbs(), + isToggled: () => this.isBreadcrumbsEnabled(), + }); + commandRegistry.registerCommand(CommonCommands.NEW_UNTITLED_TEXT_FILE, { + execute: async () => { + const untitledUri = this.untitledResourceResolver.createUntitledURI('', await this.workingDirProvider.getUserWorkingDir()); + this.untitledResourceResolver.resolve(untitledUri); + const editor = await open(this.openerService, untitledUri); + // Wait for all of the listeners of the `onDidOpen` event to be notified + await timeout(50); + // Afterwards, we can return from the command with the newly created editor + // If we don't wait, we return from the command before the plugin API has been notified of the new editor + return editor; + } + }); + commandRegistry.registerCommand(CommonCommands.PICK_NEW_FILE, { + execute: async () => this.showNewFilePicker() + }); + + for (const [index, ordinal] of this.getOrdinalNumbers().entries()) { + commandRegistry.registerCommand({ id: `workbench.action.focus${ordinal}EditorGroup`, label: index === 0 ? nls.localizeByDefault('Focus First Editor Group') : '', category: nls.localize(CommonCommands.VIEW_CATEGORY_KEY, CommonCommands.VIEW_CATEGORY) }, { + isEnabled: () => this.shell.mainAreaTabBars.length > index, + execute: () => { + const widget = this.shell.mainAreaTabBars[index]?.currentTitle?.owner; + if (widget) { + this.shell.activateWidget(widget.id); + } + } + }); + } + } + + protected getOrdinalNumbers(): readonly string[] { + return ['First', 'Second', 'Third', 'Fourth', 'Fifth', 'Sixth', 'Seventh', 'Eighth', 'Ninth']; + } + + protected isElectron(): boolean { + return environment.electron.is(); + } + + protected togglePinned(title?: Title): void { + if (title) { + togglePinned(title); + this.updatePinnedKey(); + } + } + + registerKeybindings(registry: KeybindingRegistry): void { + if (supportCut) { + registry.registerKeybinding({ + command: CommonCommands.CUT.id, + keybinding: 'ctrlcmd+x' + }); + } + if (supportCopy) { + registry.registerKeybinding({ + command: CommonCommands.COPY.id, + keybinding: 'ctrlcmd+c' + }); + } + if (supportPaste) { + registry.registerKeybinding({ + command: CommonCommands.PASTE.id, + keybinding: 'ctrlcmd+v' + }); + } + registry.registerKeybinding({ + command: CommonCommands.COPY_PATH.id, + keybinding: isWindows ? 'shift+alt+c' : 'ctrlcmd+alt+c', + when: '!editorFocus' + }); + registry.registerKeybindings( + // Edition + { + command: CommonCommands.UNDO.id, + keybinding: 'ctrlcmd+z' + }, + { + command: CommonCommands.REDO.id, + keybinding: isOSX ? 'ctrlcmd+shift+z' : 'ctrlcmd+y' + }, + { + command: CommonCommands.SELECT_ALL.id, + keybinding: 'ctrlcmd+a' + }, + { + command: CommonCommands.FIND.id, + keybinding: 'ctrlcmd+f' + }, + { + command: CommonCommands.REPLACE.id, + keybinding: 'ctrlcmd+alt+f' + }, + // Tabs + { + command: CommonCommands.NEXT_TAB.id, + keybinding: 'ctrl+tab' + }, + { + command: CommonCommands.NEXT_TAB.id, + keybinding: 'ctrlcmd+alt+d' + }, + { + command: CommonCommands.PREVIOUS_TAB.id, + keybinding: 'ctrl+shift+tab' + }, + { + command: CommonCommands.PREVIOUS_TAB.id, + keybinding: 'ctrlcmd+alt+a' + }, + { + command: CommonCommands.CLOSE_MAIN_TAB.id, + keybinding: this.isElectron() ? (isWindows ? 'ctrl+f4' : 'ctrlcmd+w') : 'alt+w' + }, + { + command: CommonCommands.CLOSE_OTHER_MAIN_TABS.id, + keybinding: 'ctrlcmd+alt+t' + }, + { + command: CommonCommands.CLOSE_ALL_MAIN_TABS.id, + keybinding: this.isElectron() ? 'ctrlCmd+k ctrlCmd+w' : 'alt+shift+w' + }, + // Panels + { + command: CommonCommands.COLLAPSE_PANEL.id, + keybinding: 'alt+c' + }, + { + command: CommonCommands.TOGGLE_BOTTOM_PANEL.id, + keybinding: 'ctrlcmd+j', + }, + { + command: CommonCommands.COLLAPSE_ALL_PANELS.id, + keybinding: 'alt+shift+c', + }, + { + command: CommonCommands.TOGGLE_MAXIMIZED.id, + keybinding: 'alt+m', + }, + // Saving + { + command: CommonCommands.SAVE.id, + keybinding: 'ctrlcmd+s' + }, + { + command: CommonCommands.SAVE_WITHOUT_FORMATTING.id, + keybinding: 'ctrlcmd+k s' + }, + { + command: CommonCommands.SAVE_ALL.id, + keybinding: 'ctrlcmd+alt+s' + }, + // Theming + { + command: CommonCommands.SELECT_COLOR_THEME.id, + keybinding: 'ctrlcmd+k ctrlcmd+t' + }, + { + command: CommonCommands.PIN_TAB.id, + keybinding: 'ctrlcmd+k shift+enter', + when: '!activeEditorIsPinned' + }, + { + command: CommonCommands.UNPIN_TAB.id, + keybinding: 'ctrlcmd+k shift+enter', + when: 'activeEditorIsPinned' + }, + { + command: CommonCommands.NEW_UNTITLED_TEXT_FILE.id, + keybinding: this.isElectron() ? 'ctrlcmd+n' : 'alt+n', + }, + { + command: CommonCommands.PICK_NEW_FILE.id, + keybinding: 'ctrlcmd+alt+n' + } + ); + for (const [index, ordinal] of this.getOrdinalNumbers().entries()) { + registry.registerKeybinding({ + command: `workbench.action.focus${ordinal}EditorGroup`, + keybinding: `ctrlcmd+${(index + 1) % 10}`, + }); + } + } + + protected async save(options?: SaveOptions): Promise { + const widget = this.shell.currentWidget; + this.saveResourceService.save(widget, options); + } + + protected async openAbout(): Promise { + this.aboutDialog.open(false); + } + + protected shouldPreventClose = false; + + /** + * registers event listener which make sure that + * window doesn't get closed if CMD/CTRL W is pressed. + * Too many users have that in their muscle memory. + * Chrome doesn't let us rebind or prevent default the keybinding, so this + * at least doesn't close the window immediately. + */ + protected registerCtrlWHandling(): void { + function isCtrlCmd(event: KeyboardEvent): boolean { + return (isOSX && event.metaKey) || (!isOSX && event.ctrlKey); + } + + window.document.addEventListener('keydown', event => { + this.shouldPreventClose = isCtrlCmd(event) && event.code === 'KeyW'; + }); + + window.document.addEventListener('keyup', () => { + this.shouldPreventClose = false; + }); + } + + onWillStop(): OnWillStopAction | undefined { + if (this.shouldPreventClose || this.shell.canSaveAll()) { + return { + reason: 'Dirty editors present', + action: async () => { + const captionsToSave = this.unsavedTabsCaptions(); + const untitledCaptionsToSave = this.unsavedUntitledTabsCaptions(); + const shouldExit = await this.confirmExitWithOrWithoutSaving(captionsToSave, async () => { + await this.saveDirty(untitledCaptionsToSave); + await this.shell.saveAll(); + }); + const allSavedOrDoNotSave = ( + shouldExit === true && untitledCaptionsToSave.length === 0 // Should save and cancel if any captions failed to save + ) || shouldExit === false; // Do not save + + this.shouldPreventClose = !allSavedOrDoNotSave; + return allSavedOrDoNotSave; + + } + }; + } + } + // Asks the user to confirm whether they want to exit with or without saving the changes + private async confirmExitWithOrWithoutSaving(captionsToSave: string[], performSave: () => Promise): Promise { + const div: HTMLElement = document.createElement('div'); + div.innerText = nls.localizeByDefault("Your changes will be lost if you don't save them."); + + let result; + if (captionsToSave.length > 0) { + const span = document.createElement('span'); + span.appendChild(document.createElement('br')); + captionsToSave.forEach(cap => { + const b = document.createElement('b'); + b.innerText = cap; + span.appendChild(b); + span.appendChild(document.createElement('br')); + }); + span.appendChild(document.createElement('br')); + div.appendChild(span); + result = await new ConfirmSaveDialog({ + title: nls.localizeByDefault('Do you want to save the changes to the following {0} files?', captionsToSave.length), + msg: div, + dontSave: nls.localizeByDefault("Don't Save"), + save: nls.localizeByDefault('Save All'), + cancel: Dialog.CANCEL + }).open(); + + if (result) { + await performSave(); + } + } else { + // fallback if not passed with an empty caption-list. + result = confirmExit(); + } + if (result !== undefined) { + return result === true; + } else { + return undefined; + }; + + } + protected unsavedTabsCaptions(): string[] { + return this.shell.widgets + .filter(widget => this.saveResourceService.canSave(widget)) + .map(widget => widget.title.label); + } + protected unsavedUntitledTabsCaptions(): Widget[] { + return this.shell.widgets.filter(widget => + NavigatableWidget.getUri(widget)?.scheme === UNTITLED_SCHEME && this.saveResourceService.canSaveAs(widget) + ); + } + protected async configureDisplayLanguage(): Promise { + const languageInfo = await this.languageQuickPickService.pickDisplayLanguage(); + if (languageInfo && !nls.isSelectedLocale(languageInfo.languageId) && await this.confirmRestart( + languageInfo.localizedLanguageName ?? languageInfo.languageName ?? languageInfo.languageId + )) { + nls.setLocale(languageInfo.languageId); + this.windowService.setSafeToShutDown(); + this.windowService.reload(); + } + } + /** + * saves any dirty widget in toSave + * side effect - will pop all widgets from toSave that was saved + * @param toSave + */ + protected async saveDirty(toSave: Widget[]): Promise { + for (const widget of toSave) { + const saveable = Saveable.get(widget); + if (saveable?.dirty) { + await this.saveResourceService.save(widget); + if (!this.saveResourceService.canSave(widget)) { + toSave.pop(); + } + } + } + } + protected toggleBreadcrumbs(): void { + const value: boolean | undefined = this.preferenceService.get('breadcrumbs.enabled'); + this.preferenceService.set('breadcrumbs.enabled', !value, PreferenceScope.User); + } + + protected isBreadcrumbsEnabled(): boolean { + return !!this.preferenceService.get('breadcrumbs.enabled'); + } + + protected async confirmRestart(languageName: string): Promise { + const appName = FrontendApplicationConfigProvider.get().applicationName; + const shouldRestart = await new ConfirmDialog({ + title: nls.localizeByDefault('Restart {0} to switch to {1}?', appName, languageName), + msg: nls.localizeByDefault('To change the display language to {0}, {1} needs to restart.', languageName, appName), + ok: nls.localizeByDefault('Restart'), + cancel: Dialog.CANCEL, + }).open(); + return shouldRestart === true; + } + + protected selectIconTheme(): void { + let resetTo: IconTheme | undefined = this.iconThemes.getCurrent(); + const setTheme = (id: string, persist: boolean) => { + const theme = this.iconThemes.getDefinition(id); + if (theme) { + this.iconThemes.setCurrent(theme as IconTheme, persist); + } + }; + const previewTheme = debounce(setTheme, 200); + + let items: Array = []; + for (const iconTheme of this.iconThemes.definitions) { + items.push({ + id: iconTheme.id, + label: iconTheme.label, + description: iconTheme.description, + }); + } + items = items.sort((a, b) => { + if (a.id === 'none') { + return -1; + } + return a.label!.localeCompare(b.label!); + }); + + this.quickInputService?.showQuickPick(items, + { + placeholder: nls.localizeByDefault('Select File Icon Theme'), + activeItem: items.find(item => item.id === resetTo?.id), + onDidChangeSelection: (_, selectedItems) => { + resetTo = undefined; + setTheme(selectedItems[0].id, true); + }, + onDidChangeActive: (_, activeItems) => { + previewTheme(activeItems[0].id, false); + }, + onDidHide: () => { + if (resetTo) { + this.iconThemes.setCurrent(resetTo, false); + } + } + }); + } + + protected selectColorTheme(): void { + let resetTo: string | undefined = this.themeService.getCurrentTheme().id; + const setTheme = (id: string, persist: boolean) => this.themeService.setCurrentTheme(id, persist); + const previewTheme = debounce(setTheme, 200); + type QuickPickWithId = QuickPickItem & { id: string }; + const itemsByTheme: { + light: Array, + dark: Array, + hc: Array, + hcLight: Array + } = { light: [], dark: [], hc: [], hcLight: [] }; + + const lightThemesSeparator = nls.localizeByDefault('light themes'); + const darkThemesSeparator = nls.localizeByDefault('dark themes'); + const highContrastThemesSeparator = nls.localizeByDefault('high contrast themes'); + + for (const theme of this.themeService.getThemes().sort((a, b) => a.label.localeCompare(b.label))) { + const themeItems: QuickPickItemOrSeparator[] = itemsByTheme[theme.type]; + + // Add a separator for the first item in the respective group. + // High Contrast Themes despite dark or light should be grouped together. + if (themeItems.length === 0 && theme.type !== 'hcLight') { + let label = ''; + if (theme.type === 'light') { + label = lightThemesSeparator; + } else if (theme.type === 'dark') { + label = darkThemesSeparator; + } else { + label = highContrastThemesSeparator; + } + themeItems.push({ + type: 'separator', + label + }); + } + + themeItems.push({ + id: theme.id, + label: theme.label, + description: theme.description, + }); + } + const items = [...itemsByTheme.light, ...itemsByTheme.dark, ...itemsByTheme.hc, ...itemsByTheme.hcLight]; + this.quickInputService?.showQuickPick(items, + { + placeholder: nls.localizeByDefault('Select Color Theme'), + activeItem: items.find(item => item.id === resetTo), + onDidChangeSelection: (_, selectedItems) => { + resetTo = undefined; + setTheme(selectedItems[0].id, true); + }, + onDidChangeActive: (_, activeItems) => { + previewTheme(activeItems[0].id, false); + }, + onDidHide: () => { + if (resetTo) { + setTheme(resetTo, false); + } + } + }); + } + + /** + * @todo https://github.com/eclipse-theia/theia/issues/12824 + */ + protected async showNewFilePicker(): Promise { + const newFileContributions = this.menuRegistry.getMenuNode(CommonMenus.FILE_NEW_CONTRIBUTIONS) as Submenu; // Add menus + const items: QuickPickItemOrSeparator[] = [ + { + label: nls.localizeByDefault('New Text File'), + description: nls.localizeByDefault('Built-in'), + execute: async () => this.commandRegistry.executeCommand(CommonCommands.NEW_UNTITLED_TEXT_FILE.id) + }, + ...newFileContributions.children + .flatMap(node => { + if (CompoundMenuNode.is(node) && node.children.length > 0) { + return node.children; + } + return node; + }) + .filter(node => Group.is(node) || CommandMenu.is(node)) + .map(node => { + if (Group.is(node)) { + return { type: 'separator' } as QuickPickSeparator; + } else { + const item = node as CommandMenu; + return { + label: item.label, + execute: () => item.run(CommonMenus.FILE_NEW_CONTRIBUTIONS) + }; + } + }) + ]; + + const CREATE_NEW_FILE_ITEM_ID = 'create-new-file'; + const hasNewFileHandler = this.commandRegistry.getActiveHandler(CommonCommands.NEW_FILE.id) !== undefined; + // Create a "Create New File" item only if there is a NEW_FILE command handler. + const createNewFileItem: QuickPickItem & { value?: string } | undefined = hasNewFileHandler ? { + id: CREATE_NEW_FILE_ITEM_ID, + label: nls.localizeByDefault('Create New File ({0})'), + description: nls.localizeByDefault('Built-in'), + execute: async () => { + if (createNewFileItem?.value) { + const parent = await this.workingDirProvider.getUserWorkingDir(); + // Exec NEW_FILE command with the file name and parent dir as arguments + return this.commandRegistry.executeCommand(CommonCommands.NEW_FILE.id, createNewFileItem.value, parent); + } + } + } : undefined; + + this.quickInputService.showQuickPick(items, { + title: nls.localizeByDefault('New File...'), + placeholder: nls.localizeByDefault('Select File Type or Enter File Name...'), + canSelectMany: false, + onDidChangeValue: picker => { + if (createNewFileItem === undefined) { + return; + } + // Dynamically show or hide the "Create New File" item based on the input value. + if (picker.value) { + createNewFileItem.alwaysShow = true; + createNewFileItem.value = picker.value; + createNewFileItem.label = nls.localizeByDefault('Create New File ({0})', picker.value); + picker.items = [...items, createNewFileItem]; + } else { + createNewFileItem.alwaysShow = false; + createNewFileItem.value = undefined; + picker.items = items.filter(item => item !== createNewFileItem); + } + } + }); + } + + registerColors(colors: ColorRegistry): void { + colors.register( + // Base Colors should be aligned with https://code.visualstudio.com/api/references/theme-color#base-colors + // if not yet contributed by Monaco, check runtime css variables to learn + { id: 'selection.background', defaults: { dark: '#217daf', light: '#c0dbf1' }, description: 'Overall border color for focused elements. This color is only used if not overridden by a component.' }, + { id: 'icon.foreground', defaults: { dark: '#C5C5C5', light: '#424242', hcDark: '#FFFFFF', hcLight: '#292929' }, description: 'The default color for icons in the workbench.' }, + { id: 'sash.hoverBorder', defaults: { dark: Color.transparent('focusBorder', 0.99), light: Color.transparent('focusBorder', 0.99), hcDark: 'focusBorder', hcLight: 'focusBorder' }, description: 'The hover border color for draggable sashes.' }, + { id: 'sash.activeBorder', defaults: { dark: 'focusBorder', light: 'focusBorder', hcDark: 'focusBorder' }, description: 'The active border color for draggable sashes.' }, + // Window border colors should be aligned with https://code.visualstudio.com/api/references/theme-color#window-border + { + id: 'window.activeBorder', defaults: { + hcDark: 'contrastBorder', + hcLight: 'contrastBorder' + }, description: 'The color used for the border of the window when it is active.' + }, + { + id: 'window.inactiveBorder', defaults: { + hcDark: 'contrastBorder', + hcLight: 'contrastBorder' + }, + description: 'The color used for the border of the window when it is inactive.' + }, + + // Activity Bar colors should be aligned with https://code.visualstudio.com/api/references/theme-color#activity-bar + { + id: 'activityBar.background', defaults: { + dark: '#333333', + light: '#2C2C2C', + hcDark: '#000000', + hcLight: '#FFFFFF' + }, description: 'Activity bar background color. The activity bar is showing on the far left or right and allows to switch between views of the side bar.' + }, + { + id: 'activityBar.foreground', defaults: { + dark: Color.white, + light: Color.white, + hcDark: Color.white, + hcLight: 'editor.foreground' + }, description: 'Activity bar item foreground color when it is active. The activity bar is showing on the far left or right and allows to switch between views of the side bar.', + }, + { + id: 'activityBar.inactiveForeground', defaults: { + dark: Color.transparent('activityBar.foreground', 0.4), + light: Color.transparent('activityBar.foreground', 0.4), + hcDark: Color.white, + hcLight: 'editor.foreground' + }, description: 'Activity bar item foreground color when it is inactive. The activity bar is showing on the far left or right and allows to switch between views of the side bar.' + }, + { + id: 'activityBar.border', defaults: { + hcDark: 'contrastBorder', + hcLight: 'contrastBorder' + }, description: 'Activity bar border color separating to the side bar. The activity bar is showing on the far left or right and allows to switch between views of the side bar.' + }, + { + id: 'activityBar.activeBorder', defaults: { + dark: 'activityBar.foreground', + light: 'activityBar.foreground', + hcLight: 'contrastBorder' + }, description: 'Activity bar border color for the active item. The activity bar is showing on the far left or right and allows to switch between views of the side bar.' + }, + { + id: 'activityBar.activeFocusBorder', defaults: { + hcLight: '#B5200D' + }, description: 'Activity bar focus border color for the active item. The activity bar is showing on the far left or right and allows to switch between views of the side bar.' + }, + { id: 'activityBar.activeBackground', description: 'Activity bar background color for the active item. The activity bar is showing on the far left or right and allows to switch between views of the side bar.' }, + { + id: 'activityBar.dropBackground', defaults: { + dark: Color.transparent('#ffffff', 0.12), + light: Color.transparent('#ffffff', 0.12), + hcDark: Color.transparent('#ffffff', 0.12), + }, description: 'Drag and drop feedback color for the activity bar items. The color should have transparency so that the activity bar entries can still shine through. The activity bar is showing on the far left or right and allows to switch between views of the side bar.' + }, + { + id: 'activityBarBadge.background', defaults: { + dark: '#007ACC', + light: '#007ACC', + hcDark: '#000000', + hcLight: '#0F4A85' + }, description: 'Activity notification badge background color. The activity bar is showing on the far left or right and allows to switch between views of the side bar.' + }, + { + id: 'activityBarBadge.foreground', defaults: { + dark: Color.white, + light: Color.white, + hcDark: Color.white, + hcLight: Color.white + }, description: 'Activity notification badge foreground color. The activity bar is showing on the far left or right and allows to switch between views of the side bar.' + }, + + // Side Bar should be aligned with https://code.visualstudio.com/api/references/theme-color#side-bar + // if not yet contributed by Monaco, check runtime css variables to learn + { id: 'sideBar.background', defaults: { dark: '#252526', light: '#F3F3F3', hcDark: '#000000', hcLight: '#FFFFFF' }, description: 'Side bar background color. The side bar is the container for views like explorer and search.' }, + { id: 'sideBar.foreground', description: 'Side bar foreground color. The side bar is the container for views like explorer and search.' }, + { id: 'sideBarSectionHeader.background', defaults: { dark: '#80808033', light: '#80808033' }, description: 'Side bar section header background color. The side bar is the container for views like explorer and search.' }, + { id: 'sideBarSectionHeader.foreground', description: 'Side bar foreground color. The side bar is the container for views like explorer and search.' }, + { id: 'sideBarSectionHeader.border', defaults: { dark: 'contrastBorder', light: 'contrastBorder', hcDark: 'contrastBorder', hcLight: 'contrastBorder' }, description: 'Side bar section header border color. The side bar is the container for views like explorer and search.' }, + + // Lists and Trees colors should be aligned with https://code.visualstudio.com/api/references/theme-color#lists-and-trees + // if not yet contributed by Monaco, check runtime css variables to learn. + // TODO: Following are not yet supported/no respective elements in theia: + // list.focusBackground, list.focusForeground, list.inactiveFocusBackground, list.filterMatchBorder, + // list.dropBackground, listFilterWidget.outline, listFilterWidget.noMatchesOutline + // list.invalidItemForeground => tree node needs an respective class + { id: 'list.activeSelectionBackground', defaults: { dark: '#094771', light: '#0074E8', hcLight: Color.transparent('#0F4A85', 0.1) }, description: 'List/Tree background color for the selected item when the list/tree is active. An active list/tree has keyboard focus, an inactive does not.' }, + { id: 'list.activeSelectionForeground', defaults: { dark: '#FFF', light: '#FFF' }, description: 'List/Tree foreground color for the selected item when the list/tree is active. An active list/tree has keyboard focus, an inactive does not.' }, + { id: 'list.inactiveSelectionBackground', defaults: { dark: '#37373D', light: '#E4E6F1', hcLight: Color.transparent('#0F4A85', 0.1) }, description: 'List/Tree background color for the selected item when the list/tree is inactive. An active list/tree has keyboard focus, an inactive does not.' }, + { id: 'list.inactiveSelectionForeground', description: 'List/Tree foreground color for the selected item when the list/tree is inactive. An active list/tree has keyboard focus, an inactive does not.' }, + { id: 'list.hoverBackground', defaults: { dark: '#2A2D2E', light: '#F0F0F0', hcLight: Color.transparent('#0F4A85', 0.1) }, description: 'List/Tree background when hovering over items using the mouse.' }, + { id: 'list.hoverForeground', description: 'List/Tree foreground when hovering over items using the mouse.' }, + { id: 'list.errorForeground', defaults: { dark: '#F88070', light: '#B01011' }, description: 'Foreground color of list items containing errors.' }, + { id: 'list.warningForeground', defaults: { dark: '#CCA700', light: '#855F00' }, description: 'Foreground color of list items containing warnings.' }, + { id: 'list.filterMatchBackground', defaults: { dark: 'editor.findMatchHighlightBackground', light: 'editor.findMatchHighlightBackground' }, description: 'Background color of the filtered match.' }, + { id: 'list.highlightForeground', defaults: { dark: '#18A3FF', light: '#0066BF', hcDark: 'focusBorder', hcLight: 'focusBorder' }, description: 'List/Tree foreground color of the match highlights when searching inside the list/tree.' }, + { id: 'list.focusHighlightForeground', defaults: { dark: 'list.highlightForeground', light: 'list.activeSelectionForeground', hcDark: 'list.highlightForeground', hcLight: 'list.highlightForeground' }, description: 'List/Tree foreground color of the match highlights on actively focused items when searching inside the list/tree.' }, + { id: 'tree.inactiveIndentGuidesStroke', defaults: { dark: Color.transparent('tree.indentGuidesStroke', 0.4), light: Color.transparent('tree.indentGuidesStroke', 0.4), hcDark: Color.transparent('tree.indentGuidesStroke', 0.4) }, description: 'Tree stroke color for the inactive indentation guides.' }, + + // Editor Group & Tabs colors should be aligned with https://code.visualstudio.com/api/references/theme-color#editor-groups-tabs + { + id: 'editorGroup.border', + defaults: { + dark: '#444444', + light: '#E7E7E7', + hcDark: 'contrastBorder', + hcLight: 'contrastBorder' + }, + description: 'Color to separate multiple editor groups from each other. Editor groups are the containers of editors.' + }, + { + id: 'editorGroup.dropBackground', + defaults: { + dark: Color.transparent('#53595D', 0.5), + light: Color.transparent('#2677CB', 0.18), + hcLight: Color.transparent('#0F4A85', 0.50) + }, + description: 'Background color when dragging editors around. The color should have transparency so that the editor contents can still shine through.' + }, + { + id: 'editorGroupHeader.tabsBackground', + defaults: { + dark: '#252526', + light: '#F3F3F3', + }, + description: 'Background color of the editor group title header when tabs are enabled. Editor groups are the containers of editors.' + }, + { + id: 'editorGroupHeader.tabsBorder', + defaults: { + hcDark: 'contrastBorder' + }, + description: 'Border color of the editor group title header when tabs are enabled. Editor groups are the containers of editors.' + }, + { + id: 'tab.activeBackground', + defaults: { + dark: 'editor.background', + light: 'editor.background', + hcDark: 'editor.background', + hcLight: 'editor.background' + }, + description: 'Active tab background color. Tabs are the containers for editors in the editor area. Multiple tabs can be opened in one editor group. There can be multiple editor groups.' + }, + { + id: 'tab.unfocusedActiveBackground', + defaults: { + dark: 'tab.activeBackground', + light: 'tab.activeBackground', + hcDark: 'tab.activeBackground', + hcLight: 'tab.activeBackground' + }, + description: 'Active tab background color in an unfocused group. Tabs are the containers for editors in the editor area. Multiple tabs can be opened in one editor group. There can be multiple editor groups.' + }, + { + id: 'tab.inactiveBackground', + defaults: { + dark: '#2D2D2D', + light: '#ECECEC' + }, + description: 'Inactive tab background color. Tabs are the containers for editors in the editor area. Multiple tabs can be opened in one editor group. There can be multiple editor groups.' + }, + { + id: 'tab.activeForeground', + defaults: { + dark: Color.white, + light: '#333333', + hcDark: Color.white, + hcLight: '#292929' + }, description: 'Active tab foreground color in an active group. Tabs are the containers for editors in the editor area. Multiple tabs can be opened in one editor group. There can be multiple editor groups.' + }, + { + id: 'tab.inactiveForeground', defaults: { + dark: Color.transparent('tab.activeForeground', 0.5), + light: Color.transparent('tab.activeForeground', 0.7), + hcDark: Color.white, + hcLight: '#292929' + }, description: 'Inactive tab foreground color in an active group. Tabs are the containers for editors in the editor area. Multiple tabs can be opened in one editor group. There can be multiple editor groups.' + }, + { + id: 'tab.unfocusedActiveForeground', defaults: { + dark: Color.transparent('tab.activeForeground', 0.5), + light: Color.transparent('tab.activeForeground', 0.7), + hcDark: Color.white, + hcLight: '#292929' + }, description: 'Active tab foreground color in an unfocused group. Tabs are the containers for editors in the editor area. Multiple tabs can be opened in one editor group. There can be multiple editor groups.' + }, + { + id: 'tab.unfocusedInactiveForeground', defaults: { + dark: Color.transparent('tab.inactiveForeground', 0.5), + light: Color.transparent('tab.inactiveForeground', 0.5), + hcDark: Color.white, + hcLight: '#292929' + }, description: 'Inactive tab foreground color in an unfocused group. Tabs are the containers for editors in the editor area. Multiple tabs can be opened in one editor group. There can be multiple editor groups.' + }, + { + id: 'tab.border', defaults: { + dark: '#252526', + light: '#F3F3F3', + hcDark: 'contrastBorder', + hcLight: 'contrastBorder' + }, description: 'Border to separate tabs from each other. Tabs are the containers for editors in the editor area. Multiple tabs can be opened in one editor group. There can be multiple editor groups.' + }, + { + id: 'tab.activeBorder', + description: 'Border on the bottom of an active tab. Tabs are the containers for editors in the editor area. Multiple tabs can be opened in one editor group. There can be multiple editor groups.' + }, + { + id: 'tab.unfocusedActiveBorder', + defaults: { + dark: Color.transparent('tab.activeBorder', 0.5), + light: Color.transparent('tab.activeBorder', 0.7) + }, + description: 'Border on the bottom of an active tab in an unfocused group. Tabs are the containers for editors in the editor area. Multiple tabs can be opened in one editor group. There can be multiple editor groups.' + }, + { + id: 'tab.activeBorderTop', + defaults: { + hcLight: '#B5200D' + }, + description: 'Border to the top of an active tab. Tabs are the containers for editors in the editor area. Multiple tabs can be opened in one editor group. There can be multiple editor groups.' + }, + { + id: 'tab.unfocusedActiveBorderTop', defaults: { + dark: Color.transparent('tab.activeBorderTop', 0.5), + light: Color.transparent('tab.activeBorderTop', 0.7), + hcLight: '#B5200D' + }, description: 'Border to the top of an active tab in an unfocused group. Tabs are the containers for editors in the editor area. Multiple tabs can be opened in one editor group. There can be multiple editor groups.' + }, + { + id: 'tab.hoverBackground', + description: 'Tab background color when hovering. Tabs are the containers for editors in the editor area. Multiple tabs can be opened in one editor group. There can be multiple editor groups.' + }, + { + id: 'tab.unfocusedHoverBackground', defaults: { + dark: Color.transparent('tab.hoverBackground', 0.5), + light: Color.transparent('tab.hoverBackground', 0.7) + }, description: 'Tab background color in an unfocused group when hovering. Tabs are the containers for editors in the editor area. Multiple tabs can be opened in one editor group. There can be multiple editor groups.' + }, + { + id: 'tab.hoverBorder', + description: 'Border to highlight tabs when hovering. Tabs are the containers for editors in the editor area. Multiple tabs can be opened in one editor group. There can be multiple editor groups.' + }, + { + id: 'tab.unfocusedHoverBorder', defaults: { + dark: Color.transparent('tab.hoverBorder', 0.5), + light: Color.transparent('tab.hoverBorder', 0.7), + hcLight: 'contrastBorder' + }, description: 'Border to highlight tabs in an unfocused group when hovering. Tabs are the containers for editors in the editor area. Multiple tabs can be opened in one editor group. There can be multiple editor groups.' + }, + { + id: 'tab.activeModifiedBorder', defaults: { + dark: '#3399CC', + light: '#33AAEE', + hcLight: 'contrastBorder' + }, description: 'Border on the top of modified (dirty) active tabs in an active group. Tabs are the containers for editors in the editor area. Multiple tabs can be opened in one editor group. There can be multiple editor groups.' + }, + { + id: 'tab.inactiveModifiedBorder', defaults: { + dark: Color.transparent('tab.activeModifiedBorder', 0.5), + light: Color.transparent('tab.activeModifiedBorder', 0.5), + hcDark: Color.white, + hcLight: 'contrastBorder' + }, description: 'Border on the top of modified (dirty) inactive tabs in an active group. Tabs are the containers for editors in the editor area. Multiple tabs can be opened in one editor group. There can be multiple editor groups.' + }, + { + id: 'tab.unfocusedActiveModifiedBorder', defaults: { + dark: Color.transparent('tab.activeModifiedBorder', 0.5), + light: Color.transparent('tab.activeModifiedBorder', 0.7), + hcDark: Color.white, + hcLight: 'contrastBorder' + }, description: 'Border on the top of modified (dirty) active tabs in an unfocused group. Tabs are the containers for editors in the editor area. Multiple tabs can be opened in one editor group. There can be multiple editor groups.' + }, + { + id: 'tab.unfocusedInactiveModifiedBorder', defaults: { + dark: Color.transparent('tab.inactiveModifiedBorder', 0.5), + light: Color.transparent('tab.inactiveModifiedBorder', 0.5), + hcDark: Color.white, + hcLight: 'contrastBorder' + }, description: 'Border on the top of modified (dirty) inactive tabs in an unfocused group. Tabs are the containers for editors in the editor area. Multiple tabs can be opened in one editor group. There can be multiple editor groups.' + }, + + // Status bar colors should be aligned with https://code.visualstudio.com/api/references/theme-color#status-bar-colors + { + id: 'statusBar.foreground', defaults: { + dark: '#FFFFFF', + light: '#FFFFFF', + hcDark: '#FFFFFF', + hcLight: 'editor.foreground' + }, description: 'Status bar foreground color when a workspace is opened. The status bar is shown in the bottom of the window.' + }, + { + id: 'statusBar.background', defaults: { + dark: '#007ACC', + light: '#007ACC' + }, description: 'Status bar background color when a workspace is opened. The status bar is shown in the bottom of the window.' + }, + { + id: 'statusBar.noFolderForeground', defaults: { + dark: 'statusBar.foreground', + light: 'statusBar.foreground', + hcDark: 'statusBar.foreground', + hcLight: 'statusBar.foreground' + }, description: 'Status bar foreground color when no folder is opened. The status bar is shown in the bottom of the window.' + }, + { + id: 'statusBar.noFolderBackground', defaults: { + dark: '#68217A', + light: '#68217A' + }, description: 'Status bar background color when no folder is opened. The status bar is shown in the bottom of the window.' + }, + { + id: 'statusBar.border', defaults: { + hcDark: 'contrastBorder', + hcLight: 'contrastBorder' + }, description: 'Status bar border color separating to the sidebar and editor. The status bar is shown in the bottom of the window.' + }, + { + id: 'statusBar.noFolderBorder', defaults: { + dark: 'statusBar.border', + light: 'statusBar.border', + hcDark: 'statusBar.border', + hcLight: 'statusBar.border' + }, description: 'Status bar border color separating to the sidebar and editor when no folder is opened. The status bar is shown in the bottom of the window.' + }, + { + id: 'statusBarItem.activeBackground', defaults: { + dark: Color.rgba(255, 255, 255, 0.18), + light: Color.rgba(255, 255, 255, 0.18), + hcDark: Color.rgba(255, 255, 255, 0.18), + hcLight: Color.rgba(0, 0, 0, 0.18) + }, description: 'Status bar item background color when clicking. The status bar is shown in the bottom of the window.' + }, + { + id: 'statusBarItem.hoverBackground', defaults: { + dark: Color.rgba(255, 255, 255, 0.12), + light: Color.rgba(255, 255, 255, 0.12), + hcDark: Color.rgba(255, 255, 255, 0.12), + hcLight: Color.rgba(0, 0, 0, 0.12) + }, description: 'Status bar item background color when hovering. The status bar is shown in the bottom of the window.' + }, + { + id: 'statusBarItem.hoverForeground', defaults: { + dark: 'statusBar.foreground', + light: 'statusBar.foreground', + hcDark: 'statusBar.foreground', + hcLight: 'statusBar.foreground' + }, description: 'Status bar item foreground color when hovering. The status bar is shown in the bottom of the window.' + }, + { + id: 'statusBarItem.compactHoverBackground', defaults: { + dark: Color.rgba(255, 255, 255, 0.20), + light: Color.rgba(255, 255, 255, 0.20), + hcDark: Color.rgba(255, 255, 255, 0.20), + hcLight: Color.rgba(0, 0, 0, 0.20) + }, description: 'Status bar item background color when hovering an item that contains two hovers. The status bar is shown in the bottom of the window.' + }, + { + id: 'statusBarItem.focusBorder', defaults: { + dark: 'statusBar.foreground', + light: 'statusBar.foreground', + hcDark: 'statusBar.foreground', + hcLight: 'statusBar.foreground' + }, description: 'Status bar item border color when focused on keyboard navigation. The status bar is shown in the bottom of the window.' + }, + { + id: 'statusBarItem.errorBackground', defaults: { + dark: Color.darken('errorBackground', 0.4), + light: Color.darken('errorBackground', 0.4), + hcDark: undefined, + hcLight: '#B5200D' + }, description: 'Status bar error items background color. Error items stand out from other status bar entries to indicate error conditions. The status bar is shown in the bottom of the window.' + }, + { + id: 'statusBarItem.errorForeground', defaults: { + dark: Color.white, + light: Color.white, + hcDark: Color.white, + hcLight: Color.white + }, description: 'Status bar error items foreground color. Error items stand out from other status bar entries to indicate error conditions. The status bar is shown in the bottom of the window.' + }, + { + id: 'statusBarItem.errorHoverBackground', defaults: { + dark: Color.lighten('statusBarItem.errorBackground', 0.2), + light: Color.lighten('statusBarItem.errorBackground', 0.2), + hcDark: undefined, + hcLight: undefined + }, description: 'Status bar error items background color when hovering. Error items stand out from other status bar entries to indicate error conditions. The status bar is shown in the bottom of the window.' + }, + { + id: 'statusBarItem.errorHoverForeground', defaults: { + dark: 'statusBarItem.errorForeground', + light: 'statusBarItem.errorForeground', + hcDark: 'statusBarItem.errorForeground', + hcLight: 'statusBarItem.errorForeground' + }, description: 'Status bar error items foreground color when hovering. Error items stand out from other status bar entries to indicate error conditions. The status bar is shown in the bottom of the window.' + }, + { + id: 'statusBarItem.warningBackground', defaults: { + dark: Color.darken('warningBackground', 0.4), + light: Color.darken('warningBackground', 0.4), + hcDark: undefined, + hcLight: '#895503' + }, description: 'Status bar warning items background color. Warning items stand out from other status bar entries to indicate warning conditions. The status bar is shown in the bottom of the window.' + }, + { + id: 'statusBarItem.warningForeground', defaults: { + dark: Color.white, + light: Color.white, + hcDark: Color.white, + hcLight: Color.white + }, description: 'Status bar warning items foreground color. Warning items stand out from other status bar entries to indicate warning conditions. The status bar is shown in the bottom of the window.' + }, + { + id: 'statusBarItem.warningHoverBackground', defaults: { + dark: Color.lighten('statusBarItem.warningBackground', 0.2), + light: Color.lighten('statusBarItem.warningBackground', 0.2), + hcDark: undefined, + hcLight: undefined + }, description: 'Status bar warning items background color when hovering. Warning items stand out from other status bar entries to indicate warning conditions. The status bar is shown in the bottom of the window.' + }, + { + id: 'statusBarItem.warningHoverForeground', defaults: { + dark: 'statusBarItem.warningForeground', + light: 'statusBarItem.warningForeground', + hcDark: 'statusBarItem.warningForeground', + hcLight: 'statusBarItem.warningForeground' + }, description: 'Status bar warning items foreground color when hovering. Warning items stand out from other status bar entries to indicate warning conditions. The status bar is shown in the bottom of the window.' + }, + { + id: 'statusBarItem.prominentForeground', defaults: { + dark: 'statusBar.foreground', + light: 'statusBar.foreground', + hcDark: 'statusBar.foreground', + hcLight: 'statusBar.foreground' + }, description: 'Status bar prominent items foreground color. Prominent items stand out from other status bar entries to indicate importance. The status bar is shown in the bottom of the window.' + }, + { + id: 'statusBarItem.prominentBackground', defaults: { + dark: Color.rgba(0, 0, 0, .5), + light: Color.rgba(0, 0, 0, .5), + hcDark: Color.rgba(0, 0, 0, .5), + hcLight: Color.rgba(0, 0, 0, .5), + }, description: 'Status bar prominent items background color. Prominent items stand out from other status bar entries to indicate importance. The status bar is shown in the bottom of the window.' + }, + { + id: 'statusBarItem.prominentHoverForeground', defaults: { + dark: 'statusBarItem.hoverForeground', + light: 'statusBarItem.hoverForeground', + hcDark: 'statusBarItem.hoverForeground', + hcLight: 'statusBarItem.hoverForeground' + }, description: 'Status bar prominent items foreground color when hovering. Prominent items stand out from other status bar entries to indicate importance. The status bar is shown in the bottom of the window.' + }, + { + id: 'statusBarItem.prominentHoverBackground', defaults: { + dark: 'statusBarItem.hoverBackground', + light: 'statusBarItem.hoverBackground', + hcDark: 'statusBarItem.hoverBackground', + hcLight: 'statusBarItem.hoverBackground' + }, description: 'Status bar prominent items background color when hovering. Prominent items stand out from other status bar entries to indicate importance. The status bar is shown in the bottom of the window.' + }, + + // editor find + + { + id: 'editor.findMatchBackground', + defaults: { + light: '#A8AC94', + dark: '#515C6A', + hcDark: undefined, + hcLight: undefined + }, + description: 'Color of the current search match.' + }, + + { + id: 'editor.findMatchForeground', + defaults: { + light: undefined, + dark: undefined, + hcDark: undefined, + hcLight: undefined + }, + description: 'Text color of the current search match.' + }, + { + id: 'editor.findMatchHighlightBackground', + defaults: { + light: '#EA5C0055', + dark: '#EA5C0055', + hcDark: undefined, + hcLight: undefined + }, + description: 'Color of the other search matches. The color must not be opaque so as not to hide underlying decorations.' + }, + + { + id: 'editor.findMatchHighlightForeground', + defaults: { + light: undefined, + dark: undefined, + hcDark: undefined, + hcLight: undefined + }, + description: 'Foreground color of the other search matches.' + }, + + { + id: 'editor.findRangeHighlightBackground', + defaults: { + dark: '#3a3d4166', + light: '#b4b4b44d', + hcDark: undefined, + hcLight: undefined + }, + description: 'Color of the range limiting the search. The color must not be opaque so as not to hide underlying decorations.' + }, + + { + id: 'editor.findMatchBorder', + defaults: { + light: undefined, + dark: undefined, + hcDark: 'activeContrastBorder', + hcLight: 'activeContrastBorder' + }, + description: 'Border color of the current search match.' + }, + { + id: 'editor.findMatchHighlightBorder', + defaults: { + light: undefined, + dark: undefined, + hcDark: 'activeContrastBorder', + hcLight: 'activeContrastBorder' + }, + description: 'Border color of the other search matches.' + }, + + { + id: 'editor.findRangeHighlightBorder', + defaults: { + dark: undefined, + light: undefined, + hcDark: Color.transparent('activeContrastBorder', 0.4), + hcLight: Color.transparent('activeContrastBorder', 0.4) + }, + description: 'Border color of the range limiting the search. The color must not be opaque so as not to hide underlying decorations.' + }, + + // Quickinput colors should be aligned with https://code.visualstudio.com/api/references/theme-color#quick-picker + // if not yet contributed by Monaco, check runtime css variables to learn. + { + id: 'quickInput.background', defaults: { + dark: 'editorWidget.background', + light: 'editorWidget.background', + hcDark: 'editorWidget.background', + hcLight: 'editorWidget.background' + }, description: 'Quick Input background color. The Quick Input widget is the container for views like the color theme picker.' + }, + { + id: 'quickInput.foreground', defaults: { + dark: 'editorWidget.foreground', + light: 'editorWidget.foreground', + hcDark: 'editorWidget.foreground', + hcLight: 'editorWidget.foreground' + }, description: 'Quick Input foreground color. The Quick Input widget is the container for views like the color theme picker.' + }, + { + id: 'quickInput.list.focusBackground', defaults: { + dark: undefined, + light: undefined, + hcDark: undefined, + hcLight: undefined + }, description: 'quickInput.list.focusBackground deprecation. Please use quickInputList.focusBackground instead' + }, + { + id: 'quickInputList.focusForeground', defaults: { + dark: 'list.activeSelectionForeground', + light: 'list.activeSelectionForeground', + hcDark: 'list.activeSelectionForeground', + hcLight: 'list.activeSelectionForeground' + }, description: 'Quick picker foreground color for the focused item' + }, + { + id: 'quickInputList.focusBackground', defaults: { + dark: 'list.activeSelectionBackground', + light: 'list.activeSelectionBackground', + hcDark: undefined + }, description: 'Quick picker background color for the focused item.' + }, + + // Panel colors should be aligned with https://code.visualstudio.com/api/references/theme-color#panel-colors + { + id: 'panel.background', defaults: { + dark: 'editor.background', light: 'editor.background', hcDark: 'editor.background', hcLight: 'editor.background' + }, description: 'Panel background color. Panels are shown below the editor area and contain views like output and integrated terminal.' + }, + { + id: 'panel.border', defaults: { + dark: Color.transparent('#808080', 0.35), light: Color.transparent('#808080', 0.35), hcDark: 'contrastBorder', hcLight: 'contrastBorder' + }, description: 'Panel border color to separate the panel from the editor. Panels are shown below the editor area and contain views like output and integrated terminal.' + }, + { + id: 'panel.dropBackground', defaults: { + dark: Color.rgba(255, 255, 255, 0.12), light: Color.transparent('#2677CB', 0.18), hcDark: Color.rgba(255, 255, 255, 0.12) + }, description: 'Drag and drop feedback color for the panel title items. The color should have transparency so that the panel entries can still shine through. Panels are shown below the editor area and contain views like output and integrated terminal.' + }, + { + id: 'panelTitle.activeForeground', defaults: { + dark: '#E7E7E7', light: '#424242', hcDark: Color.white, hcLight: 'editor.foreground' + }, description: 'Title color for the active panel. Panels are shown below the editor area and contain views like output and integrated terminal.' + }, + { + id: 'panelTitle.inactiveForeground', defaults: { + dark: Color.transparent('panelTitle.activeForeground', 0.6), light: Color.transparent('panelTitle.activeForeground', 0.75), hcDark: Color.white, hcLight: 'editor.foreground' + }, description: 'Title color for the inactive panel. Panels are shown below the editor area and contain views like output and integrated terminal.' + }, + { + id: 'panelTitle.activeBorder', defaults: { + dark: 'panelTitle.activeForeground', light: 'panelTitle.activeForeground', hcDark: 'contrastBorder', hcLight: '#B5200D' + }, description: 'Border color for the active panel title. Panels are shown below the editor area and contain views like output and integrated terminal.' + }, + { + id: 'panelInput.border', defaults: { light: '#ddd' }, + description: 'Input box border for inputs in the panel.' + }, + { + id: 'imagePreview.border', defaults: { + dark: Color.transparent('#808080', 0.35), light: Color.transparent('#808080', 0.35), hcDark: 'contrastBorder', hcLight: 'contrastBorder' + }, description: 'Border color for image in image preview.' + }, + + // Title Bar colors should be aligned with https://code.visualstudio.com/api/references/theme-color#title-bar-colors + { + id: 'titleBar.activeForeground', defaults: { + dark: '#CCCCCC', + light: '#333333', + hcDark: '#FFFFFF', + hcLight: '#292929' + }, description: 'Title bar foreground when the window is active. Note that this color is currently only supported on macOS.' + }, + { + id: 'titleBar.inactiveForeground', defaults: { + dark: Color.transparent('titleBar.activeForeground', 0.6), + light: Color.transparent('titleBar.activeForeground', 0.6), + hcLight: '#292929' + }, description: 'Title bar foreground when the window is inactive. Note that this color is currently only supported on macOS.' + }, + { + id: 'titleBar.activeBackground', defaults: { + dark: '#3C3C3C', + light: '#DDDDDD', + hcDark: '#000000', + hcLight: '#FFFFFF' + }, description: 'Title bar background when the window is active. Note that this color is currently only supported on macOS.' + }, + { + id: 'titleBar.inactiveBackground', defaults: { + dark: Color.transparent('titleBar.activeBackground', 0.6), + light: Color.transparent('titleBar.activeBackground', 0.6) + }, description: 'Title bar background when the window is inactive. Note that this color is currently only supported on macOS.' + }, + { + id: 'titleBar.border', defaults: { + hcDark: 'contrastBorder', + hcLight: 'contrastBorder' + }, description: 'Title bar border color. Note that this color is currently only supported on macOS.' + }, + + // Menu Bar colors should be aligned with https://code.visualstudio.com/api/references/theme-color#menu-bar-colors + { + id: 'menubar.selectionForeground', defaults: { + dark: 'titleBar.activeForeground', + light: 'titleBar.activeForeground', + hcDark: 'titleBar.activeForeground', + hcLight: 'titleBar.activeForeground' + }, description: 'Foreground color of the selected menu item in the menubar.' + }, + { + id: 'menubar.selectionBackground', defaults: { + dark: 'toolbar.hoverBackground', + light: 'toolbar.hoverBackground' + }, description: 'Background color of the selected menu item in the menubar.' + }, + { + id: 'menubar.selectionBorder', defaults: { + hcDark: 'activeContrastBorder', hcLight: 'activeContrastBorder' + }, description: 'Border color of the selected menu item in the menubar.' + }, + { + id: 'menu.border', defaults: { + hcDark: 'contrastBorder', hcLight: 'contrastBorder' + }, description: 'Border color of menus.' + }, + { + id: 'menu.foreground', defaults: { + dark: 'dropdown.foreground', light: 'foreground', hcDark: 'dropdown.foreground', hcLight: 'dropdown.foreground' + }, + description: 'Foreground color of menu items.' + }, + { + id: 'menu.background', defaults: { + dark: 'dropdown.background', light: 'dropdown.background', hcDark: 'dropdown.background', hcLight: 'dropdown.background' + }, description: 'Background color of menu items.' + }, + { + id: 'menu.selectionForeground', defaults: { + dark: 'list.activeSelectionForeground', light: 'list.activeSelectionForeground', hcDark: 'list.activeSelectionForeground', hcLight: 'list.activeSelectionForeground' + }, description: 'Foreground color of the selected menu item in menus.' + }, + { + id: 'menu.selectionBackground', defaults: { + dark: 'list.activeSelectionBackground', light: 'list.activeSelectionBackground', hcDark: 'list.activeSelectionBackground', hcLight: 'list.activeSelectionBackground' + }, + description: 'Background color of the selected menu item in menus.' + }, + { + id: 'menu.selectionBorder', defaults: { + hcDark: 'activeContrastBorder', hcLight: 'activeContrastBorder' + }, description: 'Border color of the selected menu item in menus.' + }, + { + id: 'menu.separatorBackground', defaults: { + dark: '#BBBBBB', light: '#888888', hcDark: 'contrastBorder', hcLight: 'contrastBorder' + }, + description: 'Color of a separator menu item in menus.' + }, + + // Welcome Page colors should be aligned with https://code.visualstudio.com/api/references/theme-color#welcome-page + { id: 'welcomePage.background', description: 'Background color for the Welcome page.' }, + { id: 'welcomePage.buttonBackground', defaults: { dark: Color.rgba(0, 0, 0, .2), light: Color.rgba(0, 0, 0, .04), hcDark: Color.black, hcLight: Color.white }, description: 'Background color for the buttons on the Welcome page.' }, + { id: 'welcomePage.buttonHoverBackground', defaults: { dark: Color.rgba(200, 235, 255, .072), light: Color.rgba(0, 0, 0, .10) }, description: 'Hover background color for the buttons on the Welcome page.' }, + { id: 'walkThrough.embeddedEditorBackground', defaults: { dark: Color.rgba(0, 0, 0, .4), light: '#f4f4f4' }, description: 'Background color for the embedded editors on the Interactive Playground.' }, + + // Dropdown colors should be aligned with https://code.visualstudio.com/api/references/theme-color#dropdown-control + + { + id: 'dropdown.background', defaults: { + light: Color.white, + dark: '#3C3C3C', + hcDark: Color.black, + hcLight: Color.white + }, description: 'Dropdown background.' + }, + { + id: 'dropdown.listBackground', defaults: { + hcDark: Color.black, + hcLight: Color.white + }, description: 'Dropdown list background.' + }, + { + id: 'dropdown.foreground', defaults: { + dark: '#F0F0F0', + hcDark: Color.white, + hcLight: 'foreground' + }, description: 'Dropdown foreground.' + }, + { + id: 'dropdown.border', defaults: { + light: '#CECECE', + dark: 'dropdown.background', + hcDark: 'contrastBorder', + hcLight: 'contrastBorder' + }, description: 'Dropdown border.' + }, + + // Settings Editor colors should be aligned with https://code.visualstudio.com/api/references/theme-color#settings-editor-colors + { + id: 'settings.headerForeground', defaults: { + light: '#444444', dark: '#e7e7e7', hcDark: '#ffffff', hcLight: '#292929' + }, description: 'The foreground color for a section header or active title.' + }, + { + id: 'settings.modifiedItemIndicator', defaults: { + light: Color.rgba(102, 175, 224), + dark: Color.rgba(12, 125, 157), + hcDark: Color.rgba(0, 73, 122), + hcLight: Color.rgba(102, 175, 224) + }, description: 'The color of the modified setting indicator.' + }, + { + id: 'settings.dropdownBackground', defaults: { + dark: 'dropdown.background', light: 'dropdown.background', hcDark: 'dropdown.background', hcLight: 'dropdown.background' + }, + description: 'Settings editor dropdown background.' + }, + { + id: 'settings.dropdownForeground', defaults: { + dark: 'dropdown.foreground', light: 'dropdown.foreground', hcDark: 'dropdown.foreground', hcLight: 'dropdown.foreground' + }, description: 'Settings editor dropdown foreground.' + }, + { + id: 'settings.dropdownBorder', defaults: { + dark: 'dropdown.border', light: 'dropdown.border', hcDark: 'dropdown.border', hcLight: 'dropdown.border' + }, description: 'Settings editor dropdown border.' + }, + { + id: 'settings.dropdownListBorder', defaults: { + dark: 'editorWidget.border', light: 'editorWidget.border', hcDark: 'editorWidget.border', hcLight: 'editorWidget.border' + }, description: 'Settings editor dropdown list border. This surrounds the options and separates the options from the description.' + }, + { + id: 'settings.checkboxBackground', defaults: { + dark: 'checkbox.background', light: 'checkbox.background', hcDark: 'checkbox.background', hcLight: 'checkbox.background' + }, description: 'Settings editor checkbox background.' + }, + { + id: 'settings.checkboxForeground', defaults: { + dark: 'checkbox.foreground', light: 'checkbox.foreground', hcDark: 'checkbox.foreground', hcLight: 'checkbox.foreground' + }, description: 'Settings editor checkbox foreground.' + }, + { + id: 'settings.checkboxBorder', defaults: { + dark: 'checkbox.border', light: 'checkbox.border', hcDark: 'checkbox.border', hcLight: 'checkbox.border' + }, description: 'Settings editor checkbox border.' + }, + { + id: 'settings.textInputBackground', defaults: { + dark: 'input.background', light: 'input.background', hcDark: 'input.background', hcLight: 'input.background' + }, description: 'Settings editor text input box background.' + }, + { + id: 'settings.textInputForeground', defaults: { + dark: 'input.foreground', light: 'input.foreground', hcDark: 'input.foreground', hcLight: 'input.foreground' + }, description: 'Settings editor text input box foreground.' + }, + { + id: 'settings.textInputBorder', defaults: { + dark: 'input.border', light: 'input.border', hcDark: 'input.border', hcLight: 'input.background' + }, description: 'Settings editor text input box border.' + }, + { + id: 'settings.numberInputBackground', defaults: { + dark: 'input.background', light: 'input.background', hcDark: 'input.background', hcLight: 'input.background' + }, description: 'Settings editor number input box background.' + }, + { + id: 'settings.numberInputForeground', defaults: { + dark: 'input.foreground', light: 'input.foreground', hcDark: 'input.foreground', hcLight: 'input.foreground' + }, description: 'Settings editor number input box foreground.' + }, + { + id: 'settings.numberInputBorder', defaults: { + dark: 'input.border', light: 'input.border', hcDark: 'input.border', hcLight: 'input.border' + }, description: 'Settings editor number input box border.' + }, + { + id: 'settings.focusedRowBackground', defaults: { + dark: Color.transparent('#808080', 0.14), + light: Color.transparent('#808080', 0.03), + hcDark: undefined, + hcLight: undefined + }, description: 'The background color of a settings row when focused.' + }, + { + id: 'settings.rowHoverBackground', defaults: { + dark: Color.transparent('#808080', 0.07), + light: Color.transparent('#808080', 0.05), + hcDark: undefined, + hcLight: undefined + }, description: 'The background color of a settings row when hovered.' + }, + { + id: 'settings.focusedRowBorder', defaults: { + dark: Color.rgba(255, 255, 255, 0.12), + light: Color.rgba(0, 0, 0, 0.12), + hcDark: 'focusBorder', + hcLight: 'focusBorder' + }, description: "The color of the row's top and bottom border when the row is focused." + }, + // Toolbar Action colors should be aligned with https://code.visualstudio.com/api/references/theme-color#action-colors + { + id: 'toolbar.hoverBackground', defaults: { + dark: '#5a5d5e50', light: '#b8b8b850', hcDark: undefined, hcLight: undefined + }, description: 'Toolbar background when hovering over actions using the mouse.' + }, + + // Theia Variable colors + { + id: 'variable.name.color', defaults: { + dark: '#C586C0', + light: '#9B46B0', + hcDark: '#C586C0' + }, + description: 'Color of a variable name.' + }, + { + id: 'variable.value.color', defaults: { + dark: Color.rgba(204, 204, 204, 0.6), + light: Color.rgba(108, 108, 108, 0.8), + hcDark: Color.rgba(204, 204, 204, 0.6) + }, + description: 'Color of a variable value.' + }, + { + id: 'variable.number.variable.color', defaults: { + dark: '#B5CEA8', + light: '#09885A', + hcDark: '#B5CEA8' + }, + description: 'Value color of a number variable' + }, + { + id: 'variable.boolean.variable.color', defaults: { + dark: '#4E94CE', + light: '#0000FF', + hcDark: '#4E94CE' + }, + description: 'Value color of a boolean variable' + }, + { + id: 'variable.string.variable.color', defaults: { + dark: '#CE9178', + light: '#A31515', + hcDark: '#CE9178' + }, + description: 'Value color of a string variable' + }, + + // Theia ANSI colors + { + id: 'ansi.black.color', defaults: { + dark: '#A0A0A0', + light: Color.rgba(128, 128, 128), + hcDark: '#A0A0A0' + }, + description: 'ANSI black color' + }, + { + id: 'ansi.red.color', defaults: { + dark: '#A74747', + light: '#BE1717', + hcDark: '#A74747' + }, + description: 'ANSI red color' + }, + { + id: 'ansi.green.color', defaults: { + dark: '#348F34', + light: '#338A2F', + hcDark: '#348F34' + }, + description: 'ANSI green color' + }, + { + id: 'ansi.yellow.color', defaults: { + dark: '#5F4C29', + light: '#BEB817', + hcDark: '#5F4C29' + }, + description: 'ANSI yellow color' + }, + { + id: 'ansi.blue.color', defaults: { + dark: '#6286BB', + light: Color.rgba(0, 0, 139), + hcDark: '#6286BB' + }, + description: 'ANSI blue color' + }, + { + id: 'ansi.magenta.color', defaults: { + dark: '#914191', + light: Color.rgba(139, 0, 139), + hcDark: '#914191' + }, + description: 'ANSI magenta color' + }, + { + id: 'ansi.cyan.color', defaults: { + dark: '#218D8D', + light: Color.rgba(0, 139, 139), + hcDark: '#218D8D' + }, + description: 'ANSI cyan color' + }, + { + id: 'ansi.white.color', defaults: { + dark: '#707070', + light: '#BDBDBD', + hcDark: '#707070' + }, + description: 'ANSI white color' + }, + + // Theia defaults + // Base + { + id: 'errorBackground', + defaults: { + dark: 'inputValidation.errorBackground', + light: 'inputValidation.errorBackground', + hcDark: 'inputValidation.errorBackground' + }, description: 'Background color of error widgets (like alerts or notifications).' + }, + { + id: 'successBackground', + defaults: { + dark: 'editorGutter.addedBackground', + light: 'editorGutter.addedBackground', + hcDark: 'editorGutter.addedBackground' + }, description: 'Background color of success widgets (like alerts or notifications).' + }, + { + id: 'warningBackground', + defaults: { + dark: 'editorWarning.foreground', + light: 'editorWarning.foreground', + hcDark: 'editorWarning.border' + }, description: 'Background color of warning widgets (like alerts or notifications).' + }, + { + id: 'warningForeground', + defaults: { + dark: 'inputValidation.warningBackground', + light: 'inputValidation.warningBackground', + hcDark: 'inputValidation.warningBackground' + }, description: 'Foreground color of warning widgets (like alerts or notifications).' + }, + // Statusbar + { + id: 'statusBar.offlineBackground', + defaults: { + dark: 'editorWarning.foreground', + light: 'editorWarning.foreground', + hcDark: 'editorWarning.foreground', + hcLight: 'editorWarning.foreground' + }, description: 'Background of hovered statusbar item in case the theia server is offline.' + }, + { + id: 'statusBar.offlineForeground', + defaults: { + dark: 'editor.background', + light: 'editor.background', + hcDark: 'editor.background', + hcLight: 'editor.background' + }, description: 'Background of hovered statusbar item in case the theia server is offline.' + }, + { + id: 'statusBarItem.offlineHoverBackground', + defaults: { + dark: Color.lighten('statusBar.offlineBackground', 0.4), + light: Color.lighten('statusBar.offlineBackground', 0.4), + hcDark: Color.lighten('statusBar.offlineBackground', 0.4), + hcLight: Color.lighten('statusBar.offlineBackground', 0.4) + }, description: 'Background of hovered statusbar item in case the theia server is offline.' + }, + { + id: 'statusBarItem.offlineActiveBackground', + defaults: { + dark: Color.lighten('statusBar.offlineBackground', 0.6), + light: Color.lighten('statusBar.offlineBackground', 0.6), + hcDark: Color.lighten('statusBar.offlineBackground', 0.6), + hcLight: Color.lighten('statusBar.offlineBackground', 0.6) + }, description: 'Background of active statusbar item in case the theia server is offline.' + }, + { + id: 'statusBarItem.remoteBackground', + defaults: { + dark: 'activityBarBadge.background', + light: 'activityBarBadge.background', + hcDark: 'activityBarBadge.background', + hcLight: 'activityBarBadge.background' + }, description: 'Background color for the remote indicator on the status bar.' + }, + { + id: 'statusBarItem.remoteForeground', + defaults: { + dark: 'activityBarBadge.foreground', + light: 'activityBarBadge.foreground', + hcDark: 'activityBarBadge.foreground', + hcLight: 'activityBarBadge.foreground' + }, description: 'Foreground color for the remote indicator on the status bar.' + }, + { + id: 'statusBarItem.remoteHoverBackground', + defaults: { + dark: Color.lighten('statusBarItem.remoteBackground', 0.2), + light: Color.lighten('statusBarItem.remoteBackground', 0.2), + hcDark: Color.lighten('statusBarItem.remoteBackground', 0.2), + hcLight: Color.lighten('statusBarItem.remoteBackground', 0.2) + }, description: 'Background color for the remote indicator on the status bar when hovering.' + }, + { + id: 'statusBarItem.remoteHoverForeground', + defaults: { + dark: 'statusBarItem.remoteForeground', + light: 'statusBarItem.remoteForeground', + hcDark: 'statusBarItem.remoteForeground', + hcLight: 'statusBarItem.remoteForeground' + }, description: 'Foreground color for the remote indicator on the status bar when hovering.' + }, + // Buttons + // https://github.com/microsoft/vscode/blob/release/1.108/src/vs/platform/theme/common/colors/inputColors.ts#L112 + { + id: 'button.foreground', + defaults: Color.white, + description: 'Button foreground color.' + }, + { + id: 'button.disabledForeground', + defaults: { + dark: Color.transparent('button.foreground', 0.5), + light: Color.transparent('button.foreground', 0.5), + hcDark: Color.transparent('button.foreground', 0.5) + }, description: 'Foreground color of disabled buttons.' + }, + { + id: 'button.separator', + defaults: Color.transparent('button.foreground', .4), + description: 'Button separator color.' + }, + { + id: 'button.background', + defaults: { + dark: '#0E639C', + light: '#007ACC', + hcDark: Color.black, + hcLight: '#0F4A85' + }, + description: 'Button background color.' + }, + { + id: 'button.disabledBackground', + defaults: { + dark: Color.transparent('button.background', 0.5), + light: Color.transparent('button.background', 0.5) + }, description: 'Background color of disabled buttons.' + }, + { + id: 'button.hoverBackground', + defaults: { + dark: Color.lighten('button.background', 0.2), + light: Color.darken('button.background', 0.2), + hcDark: 'button.background', + hcLight: 'button.background' + }, + description: 'Button background color when hovering.' + }, + { + id: 'button.border', + defaults: 'contrastBorder', + description: 'Button border color.' + }, + { + id: 'secondaryButton.foreground', + defaults: { + dark: Color.white, + light: Color.white, + hcDark: Color.white, + hcLight: 'foreground' + }, description: 'Foreground color of secondary buttons.' + }, + { + id: 'secondaryButton.disabledForeground', + defaults: { + dark: Color.transparent('secondaryButton.foreground', 0.5), + light: Color.transparent('secondaryButton.foreground', 0.5), + hcDark: Color.transparent('secondaryButton.foreground', 0.5), + hcLight: Color.transparent('secondaryButton.foreground', 0.5), + }, description: 'Foreground color of disabled secondary buttons.' + }, + { + id: 'secondaryButton.background', + defaults: { + dark: '#3A3D41', + light: '#5F6A79', + hcDark: undefined, + hcLight: Color.white + }, description: 'Background color of secondary buttons.' + }, + { + id: 'secondaryButton.hoverBackground', + defaults: { + dark: Color.lighten('secondaryButton.background', 0.2), + light: Color.lighten('secondaryButton.background', 0.2), + hcDark: undefined, + hcLight: undefined + }, description: 'Background color when hovering secondary buttons.' + }, + { + id: 'secondaryButton.disabledBackground', + defaults: { + dark: Color.transparent('secondaryButton.background', 0.6), + light: Color.transparent('secondaryButton.background', 0.6) + }, description: 'Background color of disabled secondary buttons.' + }, + { + id: 'editorGutter.commentRangeForeground', + defaults: { + dark: '#37373d', + light: '#d5d8e9', + hcDark: Color.white, + hcLight: Color.black + }, description: 'Editor gutter decoration color for commenting ranges.' + }, + { + id: 'editorGutter.itemGlyphForeground', + defaults: { + dark: 'editor.foreground', + light: 'editor.foreground', + hcDark: Color.black, + hcLight: Color.white, + }, + description: 'Editor gutter decoration color for gutter item glyphs.' + }, + { + id: 'breadcrumb.foreground', + defaults: { + dark: Color.transparent('foreground', 0.8), + light: Color.transparent('foreground', 0.8), + hcDark: Color.transparent('foreground', 0.8), + hcLight: Color.transparent('foreground', 0.8) + }, + description: 'Color of breadcrumb item text' + }, + { + id: 'breadcrumb.background', + defaults: { + dark: 'editor.background', + light: 'editor.background', + hcDark: 'editor.background', + hcLight: 'editor.background' + }, + description: 'Color of breadcrumb item background' + }, + { + id: 'breadcrumb.focusForeground', + defaults: { + dark: Color.lighten('foreground', 0.1), + light: Color.darken('foreground', 0.2), + hcDark: Color.lighten('foreground', 0.1), + hcLight: Color.lighten('foreground', 0.1) + }, + description: 'Color of breadcrumb item text when focused' + }, + { + id: 'breadcrumb.activeSelectionForeground', + defaults: { + dark: Color.lighten('foreground', 0.1), + light: Color.darken('foreground', 0.2), + hcDark: Color.lighten('foreground', 0.1), + hcLight: Color.lighten('foreground', 0.1) + }, + description: 'Color of selected breadcrumb item' + }, + { + id: 'breadcrumbPicker.background', + defaults: { + dark: 'editorWidget.background', + light: 'editorWidget.background', + hcDark: 'editorWidget.background', + hcLight: 'editorWidget.background' + }, + description: 'Background color of breadcrumb item picker' + }, + { + id: 'mainToolbar.background', + defaults: { + dark: Color.lighten('activityBar.background', 0.1), + light: Color.darken('activityBar.background', 0.1), + hcDark: Color.lighten('activityBar.background', 0.1), + hcLight: Color.lighten('activityBar.background', 0.1) + }, + description: 'Background color of shell\'s global toolbar' + }, + { + id: 'mainToolbar.foreground', defaults: { + dark: Color.darken('activityBar.foreground', 0.1), + light: Color.lighten('activityBar.foreground', 0.1), + hcDark: Color.lighten('activityBar.foreground', 0.1), + hcLight: Color.lighten('activityBar.foreground', 0.1), + }, description: 'Foreground color of active toolbar item', + }, + { + id: 'editorHoverWidgetInternalBorder', + defaults: { + dark: Color.transparent('editorHoverWidget.border', 0.5), + light: Color.transparent('editorHoverWidget.border', 0.5), + hcDark: Color.transparent('editorHoverWidget.border', 0.5), + hcLight: Color.transparent('editorHoverWidget.border', 0.5) + }, + description: 'The border between subelements of a hover widget' + } + ); + } +} diff --git a/packages/core/src/browser/common-menus.ts b/packages/core/src/browser/common-menus.ts new file mode 100644 index 0000000..a93bbbb --- /dev/null +++ b/packages/core/src/browser/common-menus.ts @@ -0,0 +1,60 @@ +// ***************************************************************************** +// Copyright (C) 2017 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { MAIN_MENU_BAR, MANAGE_MENU } from '../common/menu'; + +export namespace CommonMenus { + + export const FILE = [...MAIN_MENU_BAR, '1_file']; + export const FILE_NEW_TEXT = [...FILE, '1_new_text']; + export const FILE_NEW = [...FILE, '1_new']; + export const FILE_OPEN = [...FILE, '2_open']; + export const FILE_SAVE = [...FILE, '3_save']; + export const FILE_AUTOSAVE = [...FILE, '4_autosave']; + export const FILE_SETTINGS = [...FILE, '5_settings']; + export const FILE_SETTINGS_SUBMENU = [...FILE_SETTINGS, '1_settings_submenu']; + export const FILE_SETTINGS_SUBMENU_OPEN = [...FILE_SETTINGS_SUBMENU, '1_settings_submenu_open']; + export const FILE_SETTINGS_SUBMENU_THEME = [...FILE_SETTINGS_SUBMENU, '2_settings_submenu_theme']; + export const FILE_CLOSE = [...FILE, '6_close']; + + export const FILE_NEW_CONTRIBUTIONS = ['file', 'newFile']; + + export const EDIT = [...MAIN_MENU_BAR, '2_edit']; + export const EDIT_UNDO = [...EDIT, '1_undo']; + export const EDIT_CLIPBOARD = [...EDIT, '2_clipboard']; + export const EDIT_FIND = [...EDIT, '3_find']; + + export const VIEW = [...MAIN_MENU_BAR, '4_view']; + export const VIEW_PRIMARY = [...VIEW, '0_primary']; + export const VIEW_APPEARANCE = [...VIEW, '1_appearance']; + export const VIEW_APPEARANCE_SUBMENU = [...VIEW_APPEARANCE, '1_appearance_submenu']; + export const VIEW_APPEARANCE_SUBMENU_SCREEN = [...VIEW_APPEARANCE_SUBMENU, '2_appearance_submenu_screen']; + export const VIEW_APPEARANCE_SUBMENU_BAR = [...VIEW_APPEARANCE_SUBMENU, '3_appearance_submenu_bar']; + export const VIEW_EDITOR_SUBMENU = [...VIEW_APPEARANCE, '2_editor_submenu']; + export const VIEW_EDITOR_SUBMENU_SPLIT = [...VIEW_EDITOR_SUBMENU, '1_editor_submenu_split']; + export const VIEW_EDITOR_SUBMENU_ORTHO = [...VIEW_EDITOR_SUBMENU, '2_editor_submenu_ortho']; + export const VIEW_VIEWS = [...VIEW, '2_views']; + export const VIEW_LAYOUT = [...VIEW, '3_layout']; + export const VIEW_TOGGLE = [...VIEW, '4_toggle']; + + export const MANAGE_GENERAL = [...MANAGE_MENU, '1_manage_general']; + export const MANAGE_SETTINGS = [...MANAGE_MENU, '2_manage_settings']; + export const MANAGE_SETTINGS_THEMES = [...MANAGE_SETTINGS, '1_manage_settings_themes']; + + // last menu item + export const HELP = [...MAIN_MENU_BAR, '9_help']; + +} diff --git a/packages/core/src/browser/common-styling-participants.ts b/packages/core/src/browser/common-styling-participants.ts new file mode 100644 index 0000000..75c3bc1 --- /dev/null +++ b/packages/core/src/browser/common-styling-participants.ts @@ -0,0 +1,361 @@ +// ***************************************************************************** +// Copyright (C) 2022 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { injectable, interfaces } from 'inversify'; +import { ColorTheme, CssStyleCollector, StylingParticipant } from './styling-service'; +import { isHighContrast } from '../common/theme'; + +export function bindCommonStylingParticipants(bind: interfaces.Bind): void { + for (const participant of [ + ActionLabelStylingParticipant, + BadgeStylingParticipant, + BreadcrumbStylingParticipant, + ButtonStylingParticipant, + MenuStylingParticipant, + TabbarStylingParticipant, + TreeStylingParticipant, + StatusBarStylingParticipant + ]) { + bind(participant).toSelf().inSingletonScope(); + bind(StylingParticipant).toService(participant); + } +} + +@injectable() +export class ActionLabelStylingParticipant implements StylingParticipant { + registerThemeStyle(theme: ColorTheme, collector: CssStyleCollector): void { + const focusBorder = theme.getColor('focusBorder'); + + if (isHighContrast(theme.type) && focusBorder) { + if (focusBorder) { + collector.addRule(` + .action-label:hover { + outline: 1px dashed ${focusBorder}; + } + `); + } + } + } +} + +@injectable() +export class TreeStylingParticipant implements StylingParticipant { + registerThemeStyle(theme: ColorTheme, collector: CssStyleCollector): void { + const focusBorder = theme.getColor('focusBorder'); + + if (isHighContrast(theme.type) && focusBorder) { + collector.addRule(` + .theia-TreeNode { + outline-offset: -1px; + } + .theia-TreeNode:hover { + outline: 1px dashed ${focusBorder}; + } + .theia-Tree .theia-TreeNode.theia-mod-selected { + outline: 1px dotted ${focusBorder}; + } + .theia-Tree:focus .theia-TreeNode.theia-mod-selected, + .theia-Tree .ReactVirtualized__List:focus .theia-TreeNode.theia-mod-selected { + outline: 1px solid ${focusBorder}; + } + `); + } + } +} + +@injectable() +export class BreadcrumbStylingParticipant implements StylingParticipant { + registerThemeStyle(theme: ColorTheme, collector: CssStyleCollector): void { + const contrastBorder = theme.getColor('contrastBorder'); + + if (isHighContrast(theme.type) && contrastBorder) { + collector.addRule(` + .theia-tabBar-breadcrumb-row { + outline: 1px solid ${contrastBorder}; + } + `); + } + } +} + +@injectable() +export class StatusBarStylingParticipant implements StylingParticipant { + registerThemeStyle(theme: ColorTheme, collector: CssStyleCollector): void { + const focusBorder = theme.getColor('focusBorder'); + + if (isHighContrast(theme.type) && focusBorder) { + collector.addRule(` + #theia-statusBar .area .element.hasCommand:hover { + outline: 1px dashed ${focusBorder}; + } + #theia-statusBar .area .element.hasCommand:active { + outline: 1px solid ${focusBorder}; + } + .theia-mod-offline #theia-statusBar .area .element.hasCommand:hover { + outline: none; + } + .theia-mod-offline #theia-statusBar .area .element.hasCommand:active { + outline: none; + } + `); + } else { + collector.addRule(` + #theia-statusBar .area .element.hasCommand:hover { + background-color: var(--theia-statusBarItem-hoverBackground); + } + #theia-statusBar .area .element.hasCommand:active { + background-color: var(--theia-statusBarItem-activeBackground); + } + .theia-mod-offline #theia-statusBar .area .element.hasCommand:hover { + background-color: var(--theia-statusBarItem-offlineHoverBackground) !important; + } + .theia-mod-offline #theia-statusBar .area .element.hasCommand:active { + background-color: var(--theia-statusBarItem-offlineActiveBackground) !important; + } + `); + } + } +} + +@injectable() +export class MenuStylingParticipant implements StylingParticipant { + registerThemeStyle(theme: ColorTheme, collector: CssStyleCollector): void { + const focusBorder = theme.getColor('focusBorder'); + + if (isHighContrast(theme.type) && focusBorder) { + // Menu items + collector.addRule(` + .lm-Menu .lm-Menu-item.lm-mod-active { + outline: 1px solid ${focusBorder}; + outline-offset: -1px; + } + .lm-MenuBar .lm-MenuBar-item.lm-mod-active { + outline: 1px dashed ${focusBorder}; + } + .lm-MenuBar.lm-mod-active .lm-MenuBar-item.lm-mod-active { + outline: 1px solid ${focusBorder}; + } + `); + // Sidebar items + collector.addRule(` + .theia-sidebar-menu > :hover { + outline: 1px dashed ${focusBorder}; + outline-offset: -7px; + } + `); + } + } +} + +@injectable() +export class BadgeStylingParticipant implements StylingParticipant { + registerThemeStyle(theme: ColorTheme, collector: CssStyleCollector): void { + const contrastBorder = theme.getColor('contrastBorder'); + + if (isHighContrast(theme.type) && contrastBorder) { + collector.addRule(`.lm-TabBar .theia-badge-decorator-sidebar { + outline: 1px solid ${contrastBorder}; + }`); + } + } +} + +@injectable() +export class TabbarStylingParticipant implements StylingParticipant { + registerThemeStyle(theme: ColorTheme, collector: CssStyleCollector): void { + const focusBorder = theme.getColor('focusBorder'); + const contrastBorder = theme.getColor('contrastBorder'); + const highContrast = isHighContrast(theme.type); + + if (highContrast && focusBorder) { + collector.addRule(` + #theia-bottom-content-panel .lm-TabBar .lm-TabBar-tab, + #theia-main-content-panel .lm-TabBar .lm-TabBar-tab { + outline-offset: -4px; + } + #theia-bottom-content-panel .lm-TabBar .lm-TabBar-tab.lm-mod-current, + #theia-main-content-panel .lm-TabBar .lm-TabBar-tab.lm-mod-current { + outline: 1px solid ${focusBorder}; + } + #theia-bottom-content-panel .lm-TabBar:not(.theia-tabBar-active) .lm-TabBar-tab.lm-mod-current, + #theia-main-content-panel .lm-TabBar:not(.theia-tabBar-active) .lm-TabBar-tab.lm-mod-current { + outline: 1px dotted ${focusBorder}; + } + #theia-bottom-content-panel .lm-TabBar .lm-TabBar-tab:not(.lm-mod-current):hover, + #theia-main-content-panel .lm-TabBar .lm-TabBar-tab:not(.lm-mod-current):hover { + outline: 1px dashed ${focusBorder}; + } + `); + } + const tabActiveBackground = theme.getColor('tab.activeBackground'); + const tabActiveBorderTop = theme.getColor('tab.activeBorderTop'); + const tabUnfocusedActiveBorderTop = theme.getColor('tab.unfocusedActiveBorderTop'); + const tabActiveBorder = theme.getColor('tab.activeBorder') || (highContrast && contrastBorder) || 'transparent'; + const tabUnfocusedActiveBorder = theme.getColor('tab.unfocusedActiveBorder') || (highContrast && contrastBorder) || 'transparent'; + collector.addRule(` + #theia-main-content-panel .lm-TabBar .lm-TabBar-tab.lm-mod-current { + color: var(--theia-tab-activeForeground); + ${tabActiveBackground ? `background: ${tabActiveBackground};` : ''} + ${tabActiveBorderTop ? `border-top: 1px solid ${tabActiveBorderTop};` : ''} + border-bottom: 1px solid ${tabActiveBorder}; + } + #theia-main-content-panel .lm-TabBar:not(.theia-tabBar-active) .lm-TabBar-tab.lm-mod-current { + background: var(--theia-tab-unfocusedActiveBackground); + color: var(--theia-tab-unfocusedActiveForeground); + ${tabUnfocusedActiveBorderTop ? `border-top: 1px solid ${tabUnfocusedActiveBorderTop};` : ''} + border-bottom: 1px solid ${tabUnfocusedActiveBorder}; + } + `); + + // Highlight Modified Tabs + const tabActiveModifiedBorder = theme.getColor('tab.activeModifiedBorder'); + const tabUnfocusedInactiveModifiedBorder = theme.getColor('tab.unfocusedInactiveModifiedBorder'); + const tabInactiveModifiedBorder = theme.getColor('tab.inactiveModifiedBorder'); + if (tabActiveModifiedBorder || tabInactiveModifiedBorder) { + collector.addRule(` + body.theia-editor-highlightModifiedTabs + #theia-main-content-panel .lm-TabBar .lm-TabBar-tab.theia-mod-dirty { + border-top: 2px solid ${tabInactiveModifiedBorder}; + padding-bottom: 1px; + } + + body.theia-editor-highlightModifiedTabs + #theia-main-content-panel .lm-TabBar.theia-tabBar-active .lm-TabBar-tab.theia-mod-dirty.lm-mod-current { + border-top: 2px solid ${tabActiveModifiedBorder}; + } + + body.theia-editor-highlightModifiedTabs + #theia-main-content-panel .lm-TabBar:not(.theia-tabBar-active) .lm-TabBar-tab.theia-mod-dirty:not(.lm-mod-current) { + border-top: 2px solid ${tabUnfocusedInactiveModifiedBorder}; + } + `); + } + + // Activity Bar Active Border + const activityBarActiveBorder = theme.getColor('activityBar.activeBorder') || 'var(--theia-activityBar-foreground)'; + collector.addRule(` + .lm-TabBar.theia-app-left .lm-TabBar-tab.lm-mod-current { + border-top-color: transparent; + box-shadow: 2px 0 0 ${activityBarActiveBorder} inset; + } + + .lm-TabBar.theia-app-right .lm-TabBar-tab.lm-mod-current { + border-top-color: transparent; + box-shadow: -2px 0 0 ${activityBarActiveBorder} inset; + } + `); + // Hover Background + const tabHoverBackground = theme.getColor('tab.hoverBackground'); + if (tabHoverBackground) { + collector.addRule(` + #theia-main-content-panel .lm-TabBar .lm-TabBar-tab:hover { + background-color: ${tabHoverBackground}; + } + `); + } + + const tabUnfocusedHoverBackground = theme.getColor('tab.unfocusedHoverBackground'); + if (tabUnfocusedHoverBackground) { + collector.addRule(` + #theia-main-content-panel .lm-TabBar:not(.theia-tabBar-active) .lm-TabBar-tab:hover { + background-color: ${tabUnfocusedHoverBackground}; + } + `); + } + + // Hover Foreground + const tabHoverForeground = theme.getColor('tab.hoverForeground'); + if (tabHoverForeground) { + collector.addRule(` + #theia-main-content-panel .lm-TabBar .lm-TabBar-tab:hover { + color: ${tabHoverForeground}; + } + `); + } + + const tabUnfocusedHoverForeground = theme.getColor('tab.unfocusedHoverForeground'); + if (tabUnfocusedHoverForeground) { + collector.addRule(` + #theia-main-content-panel .lm-TabBar:not(.theia-tabBar-active) .lm-TabBar-tab:hover { + color: ${tabUnfocusedHoverForeground}; + } + `); + } + + // Hover Border + const tabHoverBorder = theme.getColor('tab.hoverBorder'); + if (tabHoverBorder) { + collector.addRule(` + #theia-main-content-panel .lm-TabBar .lm-TabBar-tab:hover { + box-shadow: 0 1px 0 ${tabHoverBorder} inset; + } + `); + } + + const tabUnfocusedHoverBorder = theme.getColor('tab.unfocusedHoverBorder'); + if (tabUnfocusedHoverBorder) { + collector.addRule(` + #theia-main-content-panel .lm-TabBar:not(.theia-tabBar-active) .lm-TabBar-tab:hover { + box-shadow: 0 1px 0 ${tabUnfocusedHoverBorder} inset; + } + `); + } + } +} + +@injectable() +export class ButtonStylingParticipant implements StylingParticipant { + registerThemeStyle(theme: ColorTheme, collector: CssStyleCollector): void { + const contrastBorder = theme.getColor('contrastBorder'); + + if (isHighContrast(theme.type) && contrastBorder) { + collector.addRule(` + .theia-button { + border: 1px solid ${contrastBorder}; + } + `); + } + + const buttonBackground = theme.getColor('button.background'); + collector.addRule(` + .theia-button { + background: ${buttonBackground || 'none'}; + } + `); + const buttonHoverBackground = theme.getColor('button.hoverBackground'); + if (buttonHoverBackground) { + collector.addRule(` + .theia-button:hover { + background-color: ${buttonHoverBackground}; + } + `); + } + const secondaryButtonBackground = theme.getColor('secondaryButton.background'); + collector.addRule(` + .theia-button.secondary { + background: ${secondaryButtonBackground || 'none'}; + } + `); + const secondaryButtonHoverBackground = theme.getColor('secondaryButton.hoverBackground'); + if (secondaryButtonHoverBackground) { + collector.addRule(` + .theia-button.secondary:hover { + background-color: ${secondaryButtonHoverBackground}; + } + `); + } + } +} diff --git a/packages/core/src/browser/connection-status-service.spec.ts b/packages/core/src/browser/connection-status-service.spec.ts new file mode 100644 index 0000000..3e3d8fb --- /dev/null +++ b/packages/core/src/browser/connection-status-service.spec.ts @@ -0,0 +1,200 @@ +// ***************************************************************************** +// Copyright (C) 2018 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { enableJSDOM } from '../browser/test/jsdom'; + +let disableJSDOM = enableJSDOM(); + +import { FrontendApplicationConfigProvider } from './frontend-application-config-provider'; +FrontendApplicationConfigProvider.set({}); + +import { expect } from 'chai'; +import { + ConnectionStatus, + ConnectionStatusOptions, + FrontendConnectionStatusService, + PingService +} from './connection-status-service'; +import { MockConnectionStatusService } from './test/mock-connection-status-service'; + +import * as sinon from 'sinon'; + +import { Container } from 'inversify'; +import { ILogger, Emitter, Loggable } from '../common'; +import { WebSocketConnectionSource } from './messaging/ws-connection-source'; + +disableJSDOM(); + +describe('connection-status', function (): void { + + let connectionStatusService: MockConnectionStatusService; + + before(() => { + disableJSDOM = enableJSDOM(); + }); + + after(() => { + disableJSDOM(); + }); + + beforeEach(() => { + connectionStatusService = new MockConnectionStatusService(); + }); + + afterEach(() => { + if (connectionStatusService !== undefined) { + connectionStatusService.dispose(); + } + }); + + it('should go from online to offline if the connection is down', async () => { + expect(connectionStatusService.currentStatus).to.be.equal(ConnectionStatus.ONLINE); + connectionStatusService.alive = false; + await pause(); + + expect(connectionStatusService.currentStatus).to.be.equal(ConnectionStatus.OFFLINE); + }); + + it('should go from offline to online if the connection is re-established', async () => { + expect(connectionStatusService.currentStatus).to.be.equal(ConnectionStatus.ONLINE); + connectionStatusService.alive = false; + await pause(); + expect(connectionStatusService.currentStatus).to.be.equal(ConnectionStatus.OFFLINE); + + connectionStatusService.alive = true; + await pause(); + expect(connectionStatusService.currentStatus).to.be.equal(ConnectionStatus.ONLINE); + }); + +}); + +describe('frontend-connection-status', function (): void { + const OFFLINE_TIMEOUT = 10; + + let testContainer: Container; + + const mockSocketOpenedEmitter: Emitter = new Emitter(); + const mockSocketClosedEmitter: Emitter = new Emitter(); + const mockIncomingMessageActivityEmitter: Emitter = new Emitter(); + + before(() => { + disableJSDOM = enableJSDOM(); + }); + + after(() => { + disableJSDOM(); + }); + + let timer: sinon.SinonFakeTimers; + let pingSpy: sinon.SinonSpy; + beforeEach(() => { + const mockWebSocketConnectionSource = sinon.createStubInstance(WebSocketConnectionSource); + const mockPingService: PingService = { + ping(): Promise { + return Promise.resolve(undefined); + } + }; + const mockILogger: ILogger = { + error(loggable: Loggable): Promise { + return Promise.resolve(undefined); + } + }; + + testContainer = new Container(); + testContainer.bind(FrontendConnectionStatusService).toSelf().inSingletonScope(); + testContainer.bind(PingService).toConstantValue(mockPingService); + testContainer.bind(ILogger).toConstantValue(mockILogger); + testContainer.bind(ConnectionStatusOptions).toConstantValue({ offlineTimeout: OFFLINE_TIMEOUT }); + testContainer.bind(WebSocketConnectionSource).toConstantValue(mockWebSocketConnectionSource); + + sinon.stub(mockWebSocketConnectionSource, 'onSocketDidOpen').value(mockSocketOpenedEmitter.event); + sinon.stub(mockWebSocketConnectionSource, 'onSocketDidClose').value(mockSocketClosedEmitter.event); + sinon.stub(mockWebSocketConnectionSource, 'onIncomingMessageActivity').value(mockIncomingMessageActivityEmitter.event); + + timer = sinon.useFakeTimers(); + + pingSpy = sinon.spy(mockPingService, 'ping'); + }); + + afterEach(() => { + pingSpy.restore(); + timer.restore(); + testContainer.unbindAll(); + }); + + it('should switch status to offline on websocket close', () => { + const frontendConnectionStatusService = testContainer.get(FrontendConnectionStatusService); + frontendConnectionStatusService['init'](); + expect(frontendConnectionStatusService.currentStatus).to.be.equal(ConnectionStatus.ONLINE); + mockSocketClosedEmitter.fire(undefined); + expect(frontendConnectionStatusService.currentStatus).to.be.equal(ConnectionStatus.OFFLINE); + }); + + it('should switch status to online on websocket established', () => { + const frontendConnectionStatusService = testContainer.get(FrontendConnectionStatusService); + frontendConnectionStatusService['init'](); + mockSocketClosedEmitter.fire(undefined); + expect(frontendConnectionStatusService.currentStatus).to.be.equal(ConnectionStatus.OFFLINE); + mockSocketOpenedEmitter.fire(undefined); + expect(frontendConnectionStatusService.currentStatus).to.be.equal(ConnectionStatus.ONLINE); + }); + + it('should switch status to online on any websocket activity', () => { + const frontendConnectionStatusService = testContainer.get(FrontendConnectionStatusService); + frontendConnectionStatusService['init'](); + mockSocketClosedEmitter.fire(undefined); + expect(frontendConnectionStatusService.currentStatus).to.be.equal(ConnectionStatus.OFFLINE); + mockIncomingMessageActivityEmitter.fire(undefined); + expect(frontendConnectionStatusService.currentStatus).to.be.equal(ConnectionStatus.ONLINE); + }); + + it('should perform ping request after socket activity', () => { + const frontendConnectionStatusService = testContainer.get(FrontendConnectionStatusService); + frontendConnectionStatusService['init'](); + mockIncomingMessageActivityEmitter.fire(undefined); + expect(frontendConnectionStatusService.currentStatus).to.be.equal(ConnectionStatus.ONLINE); + sinon.assert.notCalled(pingSpy); + timer.tick(OFFLINE_TIMEOUT); + sinon.assert.calledOnce(pingSpy); + }); + + it('should not perform ping request before desired timeout', () => { + const frontendConnectionStatusService = testContainer.get(FrontendConnectionStatusService); + frontendConnectionStatusService['init'](); + mockIncomingMessageActivityEmitter.fire(undefined); + expect(frontendConnectionStatusService.currentStatus).to.be.equal(ConnectionStatus.ONLINE); + sinon.assert.notCalled(pingSpy); + timer.tick(OFFLINE_TIMEOUT - 1); + sinon.assert.notCalled(pingSpy); + }); + + it('should switch to offline mode if ping request was rejected', () => { + const pingService = testContainer.get(PingService); + pingSpy.restore(); + const stub = sinon.stub(pingService, 'ping').onFirstCall().throws('failed to make a ping request'); + const frontendConnectionStatusService = testContainer.get(FrontendConnectionStatusService); + frontendConnectionStatusService['init'](); + mockIncomingMessageActivityEmitter.fire(undefined); + expect(frontendConnectionStatusService.currentStatus).to.be.equal(ConnectionStatus.ONLINE); + timer.tick(OFFLINE_TIMEOUT); + sinon.assert.calledOnce(stub); + expect(frontendConnectionStatusService.currentStatus).to.be.equal(ConnectionStatus.OFFLINE); + }); +}); + +function pause(time: number = 1): Promise { + return new Promise(resolve => setTimeout(resolve, time)); +} diff --git a/packages/core/src/browser/connection-status-service.ts b/packages/core/src/browser/connection-status-service.ts new file mode 100644 index 0000000..0a4b580 --- /dev/null +++ b/packages/core/src/browser/connection-status-service.ts @@ -0,0 +1,216 @@ +// ***************************************************************************** +// Copyright (C) 2018 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { inject, injectable, optional, postConstruct } from 'inversify'; +import { ILogger } from '../common/logger'; +import { Event, Emitter } from '../common/event'; +import { DefaultFrontendApplicationContribution } from './frontend-application-contribution'; +import { StatusBar, StatusBarAlignment } from './status-bar/status-bar'; +import { Disposable, DisposableCollection, nls } from '../common'; +import { WebSocketConnectionSource } from './messaging/ws-connection-source'; + +/** + * Service for listening on backend connection changes. + */ +export const ConnectionStatusService = Symbol('ConnectionStatusService'); +export interface ConnectionStatusService { + + /** + * The actual connection status. + */ + readonly currentStatus: ConnectionStatus; + + /** + * Clients can listen on connection status change events. + */ + readonly onStatusChange: Event; + +} + +/** + * The connection status. + */ +export enum ConnectionStatus { + + /** + * Connected to the backend. + */ + ONLINE, + + /** + * The connection is lost between frontend and backend. + */ + OFFLINE +} + +@injectable() +export class ConnectionStatusOptions { + + static DEFAULT: ConnectionStatusOptions = { + offlineTimeout: 5000, + }; + + /** + * Timeout in milliseconds before the application is considered offline. Must be a positive integer. + */ + readonly offlineTimeout: number; + +} + +export const PingService = Symbol('PingService'); +export interface PingService { + ping(): Promise; +} + +@injectable() +export abstract class AbstractConnectionStatusService implements ConnectionStatusService, Disposable { + + protected readonly statusChangeEmitter = new Emitter(); + + protected connectionStatus: ConnectionStatus = ConnectionStatus.ONLINE; + + @inject(ILogger) + protected logger: ILogger; + + constructor(@inject(ConnectionStatusOptions) @optional() protected readonly options: ConnectionStatusOptions = ConnectionStatusOptions.DEFAULT) { } + + get onStatusChange(): Event { + return this.statusChangeEmitter.event; + } + + get currentStatus(): ConnectionStatus { + return this.connectionStatus; + } + + dispose(): void { + this.statusChangeEmitter.dispose(); + } + + protected updateStatus(success: boolean): void { + const previousStatus = this.connectionStatus; + const newStatus = success ? ConnectionStatus.ONLINE : ConnectionStatus.OFFLINE; + if (previousStatus !== newStatus) { + this.connectionStatus = newStatus; + this.fireStatusChange(newStatus); + } + } + + protected fireStatusChange(status: ConnectionStatus): void { + this.statusChangeEmitter.fire(status); + } + +} + +@injectable() +export class FrontendConnectionStatusService extends AbstractConnectionStatusService { + + private scheduledPing: number | undefined; + + @inject(WebSocketConnectionSource) protected readonly wsConnectionProvider: WebSocketConnectionSource; + @inject(PingService) protected readonly pingService: PingService; + + @postConstruct() + protected init(): void { + this.wsConnectionProvider.onSocketDidOpen(() => { + this.updateStatus(true); + this.schedulePing(); + }); + this.wsConnectionProvider.onSocketDidClose(() => { + this.clearTimeout(this.scheduledPing); + this.updateStatus(false); + }); + this.wsConnectionProvider.onIncomingMessageActivity(() => { + // natural activity + this.updateStatus(true); + this.schedulePing(); + }); + } + + protected schedulePing(): void { + this.clearTimeout(this.scheduledPing); + this.scheduledPing = this.setTimeout(async () => { + await this.performPingRequest(); + this.schedulePing(); + }, this.options.offlineTimeout); + } + + protected async performPingRequest(): Promise { + try { + await this.pingService.ping(); + this.updateStatus(true); + } catch (e) { + this.updateStatus(false); + await this.logger.error(e); + } + } + + // eslint-disable-next-line @typescript-eslint/no-explicit-any + protected setTimeout(handler: (...args: any[]) => void, timeout: number): number { + return window.setTimeout(handler, timeout); + } + + protected clearTimeout(handle?: number): void { + if (handle !== undefined) { + window.clearTimeout(handle); + } + } +} + +@injectable() +export class ApplicationConnectionStatusContribution extends DefaultFrontendApplicationContribution { + + protected readonly toDisposeOnOnline = new DisposableCollection(); + + constructor( + @inject(ConnectionStatusService) protected readonly connectionStatusService: ConnectionStatusService, + @inject(StatusBar) protected readonly statusBar: StatusBar, + @inject(ILogger) protected readonly logger: ILogger + ) { + super(); + this.connectionStatusService.onStatusChange(state => this.onStateChange(state)); + } + + protected onStateChange(state: ConnectionStatus): void { + switch (state) { + case ConnectionStatus.OFFLINE: { + this.handleOffline(); + break; + } + case ConnectionStatus.ONLINE: { + this.handleOnline(); + break; + } + } + } + + private statusbarId = 'connection-status'; + + protected handleOnline(): void { + this.toDisposeOnOnline.dispose(); + } + + protected handleOffline(): void { + this.statusBar.setElement(this.statusbarId, { + alignment: StatusBarAlignment.LEFT, + text: nls.localize('theia/core/offline', 'Offline'), + tooltip: nls.localize('theia/localize/offlineTooltip', 'Cannot connect to backend.'), + priority: 5000 + }); + this.toDisposeOnOnline.push(Disposable.create(() => this.statusBar.removeElement(this.statusbarId))); + document.body.classList.add('theia-mod-offline'); + this.toDisposeOnOnline.push(Disposable.create(() => document.body.classList.remove('theia-mod-offline'))); + } +} diff --git a/packages/core/src/browser/context-key-service.ts b/packages/core/src/browser/context-key-service.ts new file mode 100644 index 0000000..078bafa --- /dev/null +++ b/packages/core/src/browser/context-key-service.ts @@ -0,0 +1,168 @@ +// ***************************************************************************** +// Copyright (C) 2019 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { injectable } from 'inversify'; +import { Emitter, Event } from '../common/event'; +import { Disposable } from '../common'; + +export type ContextKeyValue = null | undefined | boolean | number | string + | Array + | Record; + +export interface ContextKey { + set(value: T | undefined): void; + reset(): void; + get(): T | undefined; +} + +export namespace ContextKey { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + export const None: ContextKey = Object.freeze({ + set: () => { }, + reset: () => { }, + get: () => undefined + }); +} + +export interface ContextKeyChangeEvent { + affects(keys: { has(key: string): boolean }): boolean; +} + +export interface Context { + getValue(key: string): T | undefined; + readonly onDidChange?: Event; +} + +export const ContextKeyService = Symbol('ContextKeyService'); + +export interface ContextMatcher { + /** + * Whether the expression is satisfied. If `context` provided, the service will attempt to retrieve a context object associated with that element. + */ + match(expression: string, context?: HTMLElement): boolean; +} + +export interface ContextKeyService extends ContextMatcher { + readonly onDidChange: Event; + + createKey(key: string, defaultValue: T | undefined): ContextKey; + + /** + * @returns a Set of the keys used by the given `expression` or `undefined` if none are used or the expression cannot be parsed. + */ + parseKeys(expression: string): Set | undefined; + + /** + * Creates a temporary context that will use the `values` passed in when evaluating {@link callback}. + * {@link callback | The callback} must be synchronous. + */ + with(values: Record, callback: () => T): T; + + /** + * Creates a child service with a separate context scoped to the HTML element passed in. + * Useful for e.g. setting the {view} context value for particular widgets. + */ + createScoped(target: HTMLElement): ScopedValueStore; + + /** + * @param overlay values to be used in the new {@link ContextKeyService}. These values will be static. + * Creates a child service with a separate context and a set of fixed values to override parent values. + */ + createOverlay(overlay: Iterable<[string, unknown]>): ContextMatcher; + + /** + * Set or modify a value in the service's context. + */ + setContext(key: string, value: unknown): void; + + /** + * Gets the context keys that are locally defined (not inherited from parent contexts) + * at or above the given element. This is useful for determining which context keys + * are specific to a particular DOM element's scope. + * + * @param element The DOM element to get local context keys for + * @returns A Set of context key names that are locally defined, or an empty Set if none + */ + getLocalContextKeys(element: HTMLElement): Set; +} + +export type ScopedValueStore = Omit & Disposable & { + onDidChangeContext: Event; +}; + +@injectable() +export class ContextKeyServiceDummyImpl implements ContextKeyService { + protected readonly onDidChangeEmitter = new Emitter(); + readonly onDidChange = this.onDidChangeEmitter.event; + protected fireDidChange(event: ContextKeyChangeEvent): void { + this.onDidChangeEmitter.fire(event); + } + + onDidChangeContext: Event = this.onDidChangeEmitter.event; + + createKey(key: string, defaultValue: T | undefined): ContextKey { + return ContextKey.None; + } + /** + * It should be implemented by an extension, e.g. by the monaco extension. + */ + match(expression: string, context?: HTMLElement): boolean { + return true; + } + + /** + * It should be implemented by an extension, e.g. by the monaco extension. + */ + parseKeys(expression: string): Set | undefined { + return new Set(); + } + + /** + * Details should be implemented by an extension, e.g. by the monaco extension. + * Callback must be synchronous. + */ + with(values: Record, callback: () => T): T { + return callback(); + } + + /** + * Details should implemented by an extension, e.g. by the monaco extension. + */ + createScoped(target: HTMLElement): ScopedValueStore { + return this; + } + + /** + * Details should be implemented by an extension, e.g. the monaco extension. + */ + createOverlay(overlay: Iterable<[string, unknown]>): ContextMatcher { + return this; + } + + /** + * Details should be implemented by an extension, e.g. by the monaco extension. + */ + setContext(key: string, value: unknown): void { } + + /** + * It should be implemented by an extension, e.g. by the monaco extension. + */ + getLocalContextKeys(element: HTMLElement): Set { + return new Set(); + } + + dispose(): void { } +} diff --git a/packages/core/src/browser/context-menu-renderer.ts b/packages/core/src/browser/context-menu-renderer.ts new file mode 100644 index 0000000..ce6c679 --- /dev/null +++ b/packages/core/src/browser/context-menu-renderer.ts @@ -0,0 +1,158 @@ +// ***************************************************************************** +// Copyright (C) 2017 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +/* eslint-disable @typescript-eslint/no-explicit-any */ + +import { injectable, inject } from 'inversify'; +import { CompoundMenuNode, GroupImpl, MenuModelRegistry, MenuPath } from '../common/menu'; +import { Disposable, DisposableCollection } from '../common/disposable'; +import { ContextKeyService, ContextMatcher } from './context-key-service'; + +export interface Coordinate { x: number; y: number; } +export const Coordinate = Symbol('Coordinate'); + +export type Anchor = MouseEvent | Coordinate; + +export function coordinateFromAnchor(anchor: Anchor): Coordinate { + const { x, y } = anchor instanceof MouseEvent ? { x: anchor.clientX, y: anchor.clientY } : anchor; + return { x, y }; +} + +export class ContextMenuAccess implements Disposable { + + protected readonly toDispose = new DisposableCollection(); + readonly onDispose = this.toDispose.onDispose; + + constructor(toClose: Disposable) { + this.toDispose.push(toClose); + } + + get disposed(): boolean { + return this.toDispose.disposed; + } + + dispose(): void { + this.toDispose.dispose(); + } + +} + +@injectable() +export abstract class ContextMenuRenderer { + + @inject(MenuModelRegistry) menuRegistry: MenuModelRegistry; + @inject(ContextKeyService) + protected readonly contextKeyService: ContextKeyService; + + protected _current: ContextMenuAccess | undefined; + protected readonly toDisposeOnSetCurrent = new DisposableCollection(); + /** + * Currently opened context menu. + * Rendering a new context menu will close the current. + */ + get current(): ContextMenuAccess | undefined { + return this._current; + } + set current(current: ContextMenuAccess | undefined) { + this.setCurrent(current); + } + protected setCurrent(current: ContextMenuAccess | undefined): void { + if (this._current === current) { + return; + } + this.toDisposeOnSetCurrent.dispose(); + this._current = current; + if (current) { + this.toDisposeOnSetCurrent.push(current.onDispose(() => { + this._current = undefined; + })); + this.toDisposeOnSetCurrent.push(current); + } + } + + render(options: RenderContextMenuOptions): ContextMenuAccess { + let menu = options.menu; + if (!menu) { + menu = this.menuRegistry.getMenu(options.menuPath) || new GroupImpl('emtpyContextMenu'); + } + + const resolvedOptions = this.resolve(options); + + if (resolvedOptions.skipSingleRootNode) { + menu = MenuModelRegistry.removeSingleRootNode(menu); + } + + const access = this.doRender({ + menuPath: options.menuPath, + menu, + anchor: resolvedOptions.anchor, + contextMatcher: options.contextKeyService || this.contextKeyService, + args: resolvedOptions.args, + context: resolvedOptions.context, + onHide: resolvedOptions.onHide + }); + this.setCurrent(access); + return access; + } + + protected abstract doRender(params: { + menuPath: MenuPath, + menu: CompoundMenuNode, + anchor: Anchor, + contextMatcher: ContextMatcher, + args?: any[], + context?: HTMLElement, + onHide?: () => void + }): ContextMenuAccess; + + protected resolve(options: RenderContextMenuOptions): RenderContextMenuOptions { + const args: any[] = options.args ? options.args.slice() : []; + if (options.includeAnchorArg !== false) { + args.push(options.anchor); + } + return { + ...options, + args + }; + } + +} + +export interface RenderContextMenuOptions { + menu?: CompoundMenuNode, + menuPath: MenuPath; + anchor: Anchor; + args?: any[]; + /** + * Whether the anchor should be passed as an argument to the handlers of commands for this context menu. + * If true, the anchor will be appended to the list of arguments or passed as the only argument if no other + * arguments are supplied. + * Default is `true`. + */ + includeAnchorArg?: boolean; + /** + * A DOM context for the menu to be shown + * Will be used to attach the menu to a window and to evaluate enablement ("when"-clauses) + */ + context: HTMLElement; + contextKeyService?: ContextMatcher; + onHide?: () => void; + /** + * If true a single submenu in the context menu is not rendered but its children are rendered on the top level. + * Default is `false`. + */ + skipSingleRootNode?: boolean; +} diff --git a/packages/core/src/browser/credentials-service.ts b/packages/core/src/browser/credentials-service.ts new file mode 100644 index 0000000..2e380ca --- /dev/null +++ b/packages/core/src/browser/credentials-service.ts @@ -0,0 +1,115 @@ +// ***************************************************************************** +// Copyright (C) 2021 Red Hat, Inc. and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +// code copied and modified from https://github.com/microsoft/vscode/blob/1.55.2/src/vs/workbench/services/credentials/common/credentials.ts#L12 + +import { inject, injectable } from 'inversify'; +import { Emitter, Event } from '../common/event'; +import { KeyStoreService } from '../common/key-store'; + +export interface CredentialsProvider { + getPassword(service: string, account: string): Promise; + setPassword(service: string, account: string, password: string): Promise; + deletePassword(service: string, account: string): Promise; + findPassword(service: string): Promise; + findCredentials(service: string): Promise>; + keys(service: string): Promise; +} + +export const CredentialsService = Symbol('CredentialsService'); + +export interface CredentialsService extends CredentialsProvider { + readonly onDidChangePassword: Event; +} + +export interface CredentialsChangeEvent { + service: string + account: string; +} + +@injectable() +export class CredentialsServiceImpl implements CredentialsService { + private onDidChangePasswordEmitter = new Emitter(); + readonly onDidChangePassword = this.onDidChangePasswordEmitter.event; + + private credentialsProvider: CredentialsProvider; + + constructor(@inject(KeyStoreService) private readonly keytarService: KeyStoreService) { + this.credentialsProvider = new KeytarCredentialsProvider(this.keytarService); + } + + getPassword(service: string, account: string): Promise { + return this.credentialsProvider.getPassword(service, account); + } + + async setPassword(service: string, account: string, password: string): Promise { + await this.credentialsProvider.setPassword(service, account, password); + + this.onDidChangePasswordEmitter.fire({ service, account }); + } + + deletePassword(service: string, account: string): Promise { + const didDelete = this.credentialsProvider.deletePassword(service, account); + this.onDidChangePasswordEmitter.fire({ service, account }); + + return didDelete; + } + + findPassword(service: string): Promise { + return this.credentialsProvider.findPassword(service); + } + + findCredentials(service: string): Promise> { + return this.credentialsProvider.findCredentials(service); + } + + async keys(service: string): Promise { + return this.credentialsProvider.keys(service); + } +} + +class KeytarCredentialsProvider implements CredentialsProvider { + + constructor(private readonly keytarService: KeyStoreService) { } + + deletePassword(service: string, account: string): Promise { + return this.keytarService.deletePassword(service, account); + } + + findCredentials(service: string): Promise> { + return this.keytarService.findCredentials(service); + } + + findPassword(service: string): Promise { + return this.keytarService.findPassword(service); + } + + getPassword(service: string, account: string): Promise { + return this.keytarService.getPassword(service, account); + } + + setPassword(service: string, account: string, password: string): Promise { + return this.keytarService.setPassword(service, account, password); + } + + keys(service: string): Promise { + return this.keytarService.keys(service); + } +} diff --git a/packages/core/src/browser/decoration-style.ts b/packages/core/src/browser/decoration-style.ts new file mode 100644 index 0000000..cf9bb42 --- /dev/null +++ b/packages/core/src/browser/decoration-style.ts @@ -0,0 +1,65 @@ +// ***************************************************************************** +// Copyright (C) 2021 Ericsson and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +export namespace DecorationStyle { + + export function createStyleElement(styleId: string, container: HTMLElement = document.head): HTMLStyleElement { + const style = document.createElement('style'); + style.id = styleId; + style.type = 'text/css'; + style.media = 'screen'; + style.appendChild(document.createTextNode('')); // trick for webkit + container.appendChild(style); + return style; + } + + export function createStyleSheet(styleId: string, container?: HTMLElement): CSSStyleSheet { + return createStyleElement(styleId, container).sheet; + } + + function getRuleIndex(selector: string, styleSheet: CSSStyleSheet): number { + return Array.from(styleSheet.cssRules || styleSheet.rules).findIndex(rule => rule.type === CSSRule.STYLE_RULE && (rule).selectorText === selector); + } + + export function getOrCreateStyleRule(selector: string, styleSheet: CSSStyleSheet): CSSStyleRule { + let index = getRuleIndex(selector, styleSheet); + if (index === -1) { + // The given selector does not exist in the provided independent style sheet, rule index = 0 + index = styleSheet.insertRule(selector + '{}', 0); + } + + const rules = styleSheet.cssRules || styleSheet.rules; + const rule = rules[index]; + if (rule && rule.type === CSSRule.STYLE_RULE) { + return rule as CSSStyleRule; + } + styleSheet.deleteRule(index); + throw new Error('This function is only for CSS style rules. Other types of CSS rules are not allowed.'); + } + + export function deleteStyleRule(selector: string, styleSheet: CSSStyleSheet): void { + if (!styleSheet) { + return; + } + + // In general, only one rule exists for a given selector in the provided independent style sheet + const index = getRuleIndex(selector, styleSheet); + if (index !== -1) { + styleSheet.deleteRule(index); + } + } +} + diff --git a/packages/core/src/browser/decorations-service.ts b/packages/core/src/browser/decorations-service.ts new file mode 100644 index 0000000..6c5586b --- /dev/null +++ b/packages/core/src/browser/decorations-service.ts @@ -0,0 +1,209 @@ +// ***************************************************************************** +// Copyright (C) 2020 Red Hat, Inc. and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { injectable } from 'inversify'; +import { isThenable } from '../common/promise-util'; +import { CancellationToken, CancellationTokenSource, Disposable, Emitter, Event } from '../common'; +import { TernarySearchTree } from '../common/ternary-search-tree'; +import URI from '../common/uri'; + +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +// some code copied and modified from https://github.com/microsoft/vscode/blob/1.52.1/src/vs/workbench/services/decorations/browser/decorationsService.ts#L24-L23 + +export interface DecorationsProvider { + readonly onDidChange: Event; + provideDecorations(uri: URI, token: CancellationToken): Decoration | Promise | undefined; +} + +export interface Decoration { + readonly weight?: number; + readonly colorId?: string; + readonly letter?: string; + readonly tooltip?: string; + readonly bubble?: boolean; +} + +export interface ResourceDecorationChangeEvent { + affectsResource(uri: URI): boolean; +} +export const DecorationsService = Symbol('DecorationsService'); +export interface DecorationsService { + + readonly onDidChangeDecorations: Event>; + + registerDecorationsProvider(provider: DecorationsProvider): Disposable; + + getDecoration(uri: URI, includeChildren: boolean): Decoration[]; +} + +class DecorationDataRequest { + constructor( + readonly source: CancellationTokenSource, + readonly thenable: Promise, + ) { } +} + +class DecorationProviderWrapper { + + readonly data: TernarySearchTree; + readonly decorations: Map = new Map(); + private readonly disposable: Disposable; + + constructor( + readonly provider: DecorationsProvider, + readonly onDidChangeDecorationsEmitter: Emitter> + ) { + + this.data = TernarySearchTree.forUris(true); + + this.disposable = this.provider.onDidChange(async uris => { + this.decorations.clear(); + if (!uris) { + this.data.clear(); + } else { + for (const uri of uris) { + this.fetchData(uri); + const decoration = await provider.provideDecorations(uri, CancellationToken.None); + if (decoration) { + this.decorations.set(uri.toString(), decoration); + } + } + } + this.onDidChangeDecorationsEmitter.fire(this.decorations); + }); + } + + dispose(): void { + this.disposable.dispose(); + this.data.clear(); + } + + knowsAbout(uri: URI): boolean { + return !!this.data.get(uri) || Boolean(this.data.findSuperstr(uri)); + } + + getOrRetrieve(uri: URI, includeChildren: boolean, callback: (data: Decoration, isChild: boolean) => void): void { + + let item = this.data.get(uri); + + if (item === undefined) { + // unknown -> trigger request + item = this.fetchData(uri); + } + + if (item && !(item instanceof DecorationDataRequest)) { + // found something (which isn't pending anymore) + callback(item, false); + } + + if (includeChildren) { + // (resolved) children + const iter = this.data.findSuperstr(uri); + if (iter) { + let next = iter.next(); + while (!next.done) { + const value = next.value; + if (value && !(value instanceof DecorationDataRequest)) { + callback(value, true); + } + next = iter.next(); + } + } + } + } + + private fetchData(uri: URI): Decoration | undefined { + + // check for pending request and cancel it + const pendingRequest = this.data.get(uri); + if (pendingRequest instanceof DecorationDataRequest) { + pendingRequest.source.cancel(); + this.data.delete(uri); + } + + const source = new CancellationTokenSource(); + const dataOrThenable = this.provider.provideDecorations(uri, source.token); + if (!isThenable | undefined>(dataOrThenable)) { + // sync -> we have a result now + return this.keepItem(uri, dataOrThenable); + + } else { + // async -> we have a result soon + const request = new DecorationDataRequest(source, Promise.resolve(dataOrThenable).then(data => { + if (this.data.get(uri) === request) { + this.keepItem(uri, data); + } + }).catch(err => { + if (!(err instanceof Error && err.name === 'Canceled' && err.message === 'Canceled') && this.data.get(uri) === request) { + this.data.delete(uri); + } + })); + + this.data.set(uri, request); + return undefined; + } + } + + private keepItem(uri: URI, data: Decoration | undefined): Decoration | undefined { + const deco = data ? data : undefined; + this.data.set(uri, deco); + return deco; + } +} + +@injectable() +export class DecorationsServiceImpl implements DecorationsService { + + private readonly data: DecorationProviderWrapper[] = []; + private readonly onDidChangeDecorationsEmitter = new Emitter>(); + + readonly onDidChangeDecorations = this.onDidChangeDecorationsEmitter.event; + + dispose(): void { + this.onDidChangeDecorationsEmitter.dispose(); + } + + registerDecorationsProvider(provider: DecorationsProvider): Disposable { + + const wrapper = new DecorationProviderWrapper(provider, this.onDidChangeDecorationsEmitter); + this.data.push(wrapper); + + return Disposable.create(() => { + // fire event that says 'yes' for any resource + // known to this provider. then dispose and remove it. + this.data.splice(this.data.indexOf(wrapper), 1); + this.onDidChangeDecorationsEmitter.fire(new Map()); + wrapper.dispose(); + }); + } + + getDecoration(uri: URI, includeChildren: boolean): Decoration[] { + const data: Decoration[] = []; + let containsChildren: boolean = false; + for (const wrapper of this.data) { + wrapper.getOrRetrieve(uri, includeChildren, (deco, isChild) => { + if (!isChild || deco.bubble) { + data.push(deco); + containsChildren = isChild || containsChildren; + } + }); + } + return data; + } +} diff --git a/packages/core/src/browser/dialogs.ts b/packages/core/src/browser/dialogs.ts new file mode 100644 index 0000000..d143ca8 --- /dev/null +++ b/packages/core/src/browser/dialogs.ts @@ -0,0 +1,565 @@ +// ***************************************************************************** +// Copyright (C) 2017 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { injectable, inject, unmanaged } from 'inversify'; +import { Disposable, MaybePromise, CancellationTokenSource, nls } from '../common'; +import { Key } from './keyboard/keys'; +import { Widget, BaseWidget, Message, addKeyListener, codiconArray } from './widgets/widget'; +import { FrontendApplicationContribution } from './frontend-application-contribution'; + +@injectable() +export class DialogProps { + readonly title: string; + /** + * Determines the maximum width of the dialog in pixels. + * Default value is undefined, which would result in the css property 'max-width: none' being applied to the dialog. + */ + maxWidth?: number; + /** + * Determine the word wrapping behavior for content in the dialog. + * - `normal`: breaks words at allowed break points. + * - `break-word`: breaks otherwise unbreakable words. + * - `initial`: sets the property to it's default value. + * - `inherit`: inherit this property from it's parent element. + * Default value is undefined, which would result in the css property 'word-wrap' not being applied to the dialog. + */ + wordWrap?: 'normal' | 'break-word' | 'initial' | 'inherit'; +} + +export type DialogMode = 'open' | 'preview'; + +export type DialogError = string | boolean | { + message: string + result: boolean +}; +export namespace DialogError { + export function getResult(error: DialogError): boolean { + if (typeof error === 'string') { + return !error.length; + } + if (typeof error === 'boolean') { + return error; + } + return error.result; + } + export function getMessage(error: DialogError): string { + if (typeof error === 'string') { + return error; + } + if (typeof error === 'boolean') { + return ''; + } + return error.message; + } +} + +export namespace Dialog { + export const YES = nls.localizeByDefault('Yes'); + export const NO = nls.localizeByDefault('No'); + export const OK = nls.localizeByDefault('OK'); + export const CANCEL = nls.localizeByDefault('Cancel'); +} + +@injectable() +export class DialogOverlayService implements FrontendApplicationContribution { + + protected static INSTANCE: DialogOverlayService; + + static get(): DialogOverlayService { + return DialogOverlayService.INSTANCE; + } + + // eslint-disable-next-line @typescript-eslint/no-explicit-any + protected readonly dialogs: AbstractDialog[] = []; + protected readonly documents: Document[] = []; + + constructor() { + } + + initialize(): void { + DialogOverlayService.INSTANCE = this; + } + + // eslint-disable-next-line @typescript-eslint/no-explicit-any + protected get currentDialog(): AbstractDialog | undefined { + return this.dialogs[0]; + } + + // eslint-disable-next-line @typescript-eslint/no-explicit-any + push(dialog: AbstractDialog): Disposable { + if (this.documents.findIndex(document => document === dialog.node.ownerDocument) < 0) { + addKeyListener(dialog.node.ownerDocument.body, Key.ENTER, e => this.handleEnter(e)); + addKeyListener(dialog.node.ownerDocument.body, Key.ESCAPE, e => this.handleEscape(e)); + this.documents.push(dialog.node.ownerDocument); + } + this.dialogs.unshift(dialog); + return Disposable.create(() => { + const index = this.dialogs.indexOf(dialog); + if (index > -1) { + this.dialogs.splice(index, 1); + } + }); + } + + protected handleEscape(event: KeyboardEvent): boolean | void { + const dialog = this.currentDialog; + if (dialog) { + return dialog['handleEscape'](event); + } + return false; + } + + protected handleEnter(event: KeyboardEvent): boolean | void { + const dialog = this.currentDialog; + if (dialog) { + return dialog['handleEnter'](event); + } + return false; + } + +} + +@injectable() +export abstract class AbstractDialog extends BaseWidget { + + protected readonly titleNode: HTMLDivElement; + protected readonly contentNode: HTMLDivElement; + protected readonly closeCrossNode: HTMLElement; + protected readonly controlPanel: HTMLDivElement; + protected readonly errorMessageNode: HTMLDivElement; + + protected resolve: undefined | ((value: T | undefined) => void); + // eslint-disable-next-line @typescript-eslint/no-explicit-any + protected reject: undefined | ((reason: any) => void); + + protected closeButton: HTMLButtonElement | undefined; + protected acceptButton: HTMLButtonElement | undefined; + + protected activeElement: HTMLElement | undefined; + + constructor( + @unmanaged() protected readonly props: DialogProps, + @unmanaged() options?: Widget.IOptions + ) { + super(options); + this.id = 'theia-dialog-shell'; + this.addClass('dialogOverlay'); + this.toDispose.push(Disposable.create(() => { + if (this.reject) { + Widget.detach(this); + } + })); + const container = this.node.ownerDocument.createElement('div'); + container.classList.add('dialogBlock'); + if (props.maxWidth === undefined) { + container.setAttribute('style', 'max-width: none'); + } else if (props.maxWidth < 400) { + container.setAttribute('style', `max-width: ${props.maxWidth}px; min-width: 0px`); + } else { + container.setAttribute('style', `max-width: ${props.maxWidth}px`); + } + this.node.appendChild(container); + + const titleContentNode = this.node.ownerDocument.createElement('div'); + titleContentNode.classList.add('dialogTitle'); + container.appendChild(titleContentNode); + + this.titleNode = this.node.ownerDocument.createElement('div'); + this.titleNode.textContent = props.title; + titleContentNode.appendChild(this.titleNode); + + this.closeCrossNode = this.node.ownerDocument.createElement('i'); + this.closeCrossNode.classList.add(...codiconArray('close', true)); + this.closeCrossNode.classList.add('closeButton'); + titleContentNode.appendChild(this.closeCrossNode); + + this.contentNode = this.node.ownerDocument.createElement('div'); + this.contentNode.classList.add('dialogContent'); + if (props.wordWrap !== undefined) { + this.contentNode.setAttribute('style', `word-wrap: ${props.wordWrap}`); + } + container.appendChild(this.contentNode); + + this.controlPanel = this.node.ownerDocument.createElement('div'); + this.controlPanel.classList.add('dialogControl'); + container.appendChild(this.controlPanel); + + this.errorMessageNode = this.node.ownerDocument.createElement('div'); + this.errorMessageNode.classList.add('error'); + this.errorMessageNode.setAttribute('style', 'flex: 2'); + this.controlPanel.appendChild(this.errorMessageNode); + + this.update(); + } + + protected appendCloseButton(text: string = Dialog.CANCEL): HTMLButtonElement { + return this.closeButton = this.appendButton(text, false); + } + + protected appendAcceptButton(text: string = Dialog.OK): HTMLButtonElement { + return this.acceptButton = this.appendButton(text, true); + } + + protected appendButton(text: string, primary: boolean): HTMLButtonElement { + const button = this.createButton(text); + this.controlPanel.appendChild(button); + button.classList.add(primary ? 'main' : 'secondary'); + return button; + } + + protected createButton(text: string): HTMLButtonElement { + const button = document.createElement('button'); + button.classList.add('theia-button'); + button.textContent = text; + return button; + } + + protected override onAfterAttach(msg: Message): void { + super.onAfterAttach(msg); + if (this.closeButton) { + this.addCloseAction(this.closeButton, 'click'); + } + if (this.acceptButton) { + this.addAcceptAction(this.acceptButton, 'click'); + } + this.addCloseAction(this.closeCrossNode, 'click'); + this.toDisposeOnDetach.push(this.preventTabbingOutsideDialog()); + // TODO: use DI always to create dialog instances + this.toDisposeOnDetach.push(DialogOverlayService.get().push(this)); + } + + /** + * This prevents tabbing outside the dialog by marking elements as inert, i.e., non-clickable and non-focussable. + * + * @param elements the elements for which we disable tabbing. By default all elements within the body element are considered. + * Please note that this may also include other popups such as the suggestion overlay, the notification center or quick picks. + * @returns a disposable that will restore the previous tabbing behavior + */ + protected preventTabbingOutsideDialog(elements = Array.from(this.node.ownerDocument.body.children)): Disposable { // + const inertBlacklist = ['select-component-container']; // IDs of elements that should remain interactive + const nonInertElements = elements.filter(child => child !== this.node && !(child.hasAttribute('inert')) && !inertBlacklist.includes(child.id)); + nonInertElements.forEach(child => child.setAttribute('inert', '')); + return Disposable.create(() => nonInertElements.forEach(child => child.removeAttribute('inert'))); + } + + protected handleEscape(event: KeyboardEvent): boolean | void { + this.close(); + } + + protected handleEnter(event: KeyboardEvent): boolean | void { + if (event.target instanceof HTMLTextAreaElement) { + return false; + } + this.accept(); + } + + protected override onActivateRequest(msg: Message): void { + super.onActivateRequest(msg); + if (this.acceptButton) { + this.acceptButton.focus(); + } + } + + open(disposeOnResolve: boolean = true): Promise { + if (this.resolve) { + return Promise.reject(new Error('The dialog is already opened.')); + } + this.activeElement = this.node.ownerDocument.activeElement as HTMLElement; + return new Promise((resolve, reject) => { + this.resolve = value => { + resolve(value); + }; + this.reject = reject; + this.toDisposeOnDetach.push(Disposable.create(() => { + this.resolve = undefined; + this.reject = undefined; + })); + + Widget.attach(this, this.node.ownerDocument.body); + this.activate(); + }).finally(() => { + if (disposeOnResolve) { + this.dispose(); + } + }); + } + + protected override onCloseRequest(msg: Message): void { + // super.onCloseRequest() would automatically dispose the dialog, which we don't want because we're reusing it + if (this.parent) { + // eslint-disable-next-line no-null/no-null + this.parent = null; + } else if (this.isAttached) { + Widget.detach(this); + } + } + + override close(): void { + if (this.resolve) { + if (this.activeElement) { + this.activeElement.focus({ preventScroll: true }); + } + this.resolve(undefined); + } + this.activeElement = undefined; + super.close(); + } + protected override onUpdateRequest(msg: Message): void { + super.onUpdateRequest(msg); + this.validate(); + } + + protected validateCancellationSource = new CancellationTokenSource(); + protected async validate(): Promise { + if (!this.resolve) { + return; + } + this.validateCancellationSource.cancel(); + this.validateCancellationSource = new CancellationTokenSource(); + const token = this.validateCancellationSource.token; + const value = this.value; + const error = await this.isValid(value, 'preview'); + if (token.isCancellationRequested) { + return; + } + this.setErrorMessage(error); + } + + protected acceptCancellationSource = new CancellationTokenSource(); + protected async accept(): Promise { + if (!this.resolve) { + return; + } + this.acceptCancellationSource.cancel(); + this.acceptCancellationSource = new CancellationTokenSource(); + const token = this.acceptCancellationSource.token; + const value = this.value; + const error = await this.isValid(value, 'open'); + if (token.isCancellationRequested) { + return; + } + if (!DialogError.getResult(error)) { + this.setErrorMessage(error); + } else { + this.resolve(value); + Widget.detach(this); + } + } + + abstract get value(): T; + + /** + * Return a string of zero-length or true if valid. + */ + protected isValid(value: T, mode: DialogMode): MaybePromise { + return ''; + } + + protected setErrorMessage(error: DialogError): void { + if (this.acceptButton) { + this.acceptButton.disabled = !DialogError.getResult(error); + } + this.errorMessageNode.innerText = DialogError.getMessage(error); + } + + protected addAction(element: HTMLElement, callback: () => void, ...additionalEventTypes: K[]): void { + this.addKeyListener(element, Key.ENTER, callback, ...additionalEventTypes); + } + + protected addCloseAction(element: HTMLElement, ...additionalEventTypes: K[]): void { + this.addAction(element, () => this.close(), ...additionalEventTypes); + } + + protected addAcceptAction(element: HTMLElement, ...additionalEventTypes: K[]): void { + this.addAction(element, () => this.accept(), ...additionalEventTypes); + } + +} + +@injectable() +export class MessageDialogProps extends DialogProps { + readonly msg: string | HTMLElement; +} + +@injectable() +export class ConfirmDialogProps extends MessageDialogProps { + readonly cancel?: string; + readonly ok?: string; +} + +export class ConfirmDialog extends AbstractDialog { + + protected confirmed = true; + + constructor( + @inject(ConfirmDialogProps) protected override readonly props: ConfirmDialogProps + ) { + super(props); + + this.contentNode.appendChild(this.createMessageNode(this.props.msg)); + this.appendCloseButton(props.cancel); + this.appendAcceptButton(props.ok); + } + + protected override onCloseRequest(msg: Message): void { + super.onCloseRequest(msg); + this.confirmed = false; + this.accept(); + } + + get value(): boolean { + return this.confirmed; + } + + protected createMessageNode(msg: string | HTMLElement): HTMLElement { + if (typeof msg === 'string') { + const messageNode = this.node.ownerDocument.createElement('div'); + messageNode.textContent = msg; + return messageNode; + } + return msg; + } +} + +export async function confirmExit(): Promise { + const safeToExit = await new ConfirmDialog({ + title: nls.localizeByDefault('Are you sure you want to quit?'), + msg: nls.localize('theia/core/quitMessage', 'Any unsaved changes will not be saved.'), + ok: Dialog.YES, + cancel: Dialog.NO, + }).open(); + return safeToExit === true; +} + +export class ConfirmSaveDialogProps extends MessageDialogProps { + readonly cancel: string; + readonly dontSave: string; + readonly save: string; +} + +// Dialog prompting the user to confirm whether they wish to save changes or not +export class ConfirmSaveDialog extends AbstractDialog { + protected result?: boolean = false; + + constructor( + @inject(ConfirmSaveDialogProps) protected override readonly props: ConfirmSaveDialogProps + ) { + super(props); + // Append message and buttons to the dialog + this.contentNode.appendChild(this.createMessageNode(this.props.msg)); + this.closeButton = this.appendButtonAndSetResult(props.cancel, false); + this.appendButtonAndSetResult(props.dontSave, false, false); + this.acceptButton = this.appendButtonAndSetResult(props.save, true, true); + } + + get value(): boolean | undefined { + return this.result; + } + + protected createMessageNode(msg: string | HTMLElement): HTMLElement { + if (typeof msg === 'string') { + const messageNode = document.createElement('div'); + messageNode.textContent = msg; + return messageNode; + } + return msg; + } + + protected appendButtonAndSetResult(text: string, primary: boolean, result?: boolean): HTMLButtonElement { + const button = this.appendButton(text, primary); + button.addEventListener('click', () => { + this.result = result; + this.accept(); + }); + return button; + } + +} + +@injectable() +export class SingleTextInputDialogProps extends DialogProps { + readonly confirmButtonLabel?: string; + readonly initialValue?: string; + readonly placeholder?: string; + readonly initialSelectionRange?: { + start: number + end: number + direction?: 'forward' | 'backward' | 'none' + }; + readonly validate?: (input: string, mode: DialogMode) => MaybePromise; +} + +export class SingleTextInputDialog extends AbstractDialog { + + protected readonly inputField: HTMLInputElement; + + constructor( + @inject(SingleTextInputDialogProps) protected override props: SingleTextInputDialogProps + ) { + super(props); + + this.inputField = document.createElement('input'); + this.inputField.type = 'text'; + this.inputField.className = 'theia-input'; + this.inputField.spellcheck = false; + this.inputField.setAttribute('style', 'flex: 0;'); + this.inputField.placeholder = props.placeholder || ''; + this.inputField.value = props.initialValue || ''; + if (props.initialSelectionRange) { + this.inputField.setSelectionRange( + props.initialSelectionRange.start, + props.initialSelectionRange.end, + props.initialSelectionRange.direction + ); + } else { + this.inputField.select(); + } + + this.contentNode.appendChild(this.inputField); + this.controlPanel.removeChild(this.errorMessageNode); + this.contentNode.appendChild(this.errorMessageNode); + + this.appendAcceptButton(props.confirmButtonLabel); + } + + get value(): string { + return this.inputField.value; + } + + protected override isValid(value: string, mode: DialogMode): MaybePromise { + if (this.props.validate) { + return this.props.validate(value, mode); + } + return super.isValid(value, mode); + } + + protected override onAfterAttach(msg: Message): void { + super.onAfterAttach(msg); + this.addUpdateListener(this.inputField, 'input'); + } + + protected override onActivateRequest(msg: Message): void { + this.inputField.focus(); + } + + protected override handleEnter(event: KeyboardEvent): boolean | void { + if (event.target instanceof HTMLInputElement) { + return super.handleEnter(event); + } + return false; + } + +} diff --git a/packages/core/src/browser/dialogs/react-dialog.spec.tsx b/packages/core/src/browser/dialogs/react-dialog.spec.tsx new file mode 100644 index 0000000..12aec8a --- /dev/null +++ b/packages/core/src/browser/dialogs/react-dialog.spec.tsx @@ -0,0 +1,47 @@ +// ***************************************************************************** +// Copyright (C) 2024 Toro Cloud Pty Ltd and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import * as assert from 'assert'; +import * as React from 'react'; +import { enableJSDOM } from '../test/jsdom'; + +let disableJSDOM = enableJSDOM(); + +import { ReactDialog } from './react-dialog'; + +class MyDialog extends ReactDialog { + constructor() { + super({ title: '' }); + } + + override get value(): void { + return; + } + + protected override render(): React.ReactNode { + return <>; + } +} + +describe('ReactDialog', () => { + before(() => disableJSDOM = enableJSDOM()); + after(() => disableJSDOM()); + + it('should be extended', () => { + const dialog = new MyDialog(); + assert.equal(dialog instanceof ReactDialog, true); + }); +}); diff --git a/packages/core/src/browser/dialogs/react-dialog.tsx b/packages/core/src/browser/dialogs/react-dialog.tsx new file mode 100644 index 0000000..756450d --- /dev/null +++ b/packages/core/src/browser/dialogs/react-dialog.tsx @@ -0,0 +1,57 @@ +// ***************************************************************************** +// Copyright (C) 2019 Ericsson and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import * as React from 'react'; +import { injectable, inject } from 'inversify'; +import { Disposable } from '../../common'; +import { Message } from '../widgets'; +import { AbstractDialog, DialogProps } from '../dialogs'; +import { createRoot, Root } from 'react-dom/client'; + +@injectable() +export abstract class ReactDialog extends AbstractDialog { + protected contentNodeRoot: Root; + protected isMounted: boolean; + + constructor( + @inject(DialogProps) props: DialogProps + ) { + super(props); + this.contentNodeRoot = createRoot(this.contentNode); + this.isMounted = true; + this.toDispose.push(Disposable.create(() => { + this.contentNodeRoot.unmount(); + this.isMounted = false; + })); + } + + protected override onUpdateRequest(msg: Message): void { + super.onUpdateRequest(msg); + if (!this.isMounted) { + this.contentNodeRoot = createRoot(this.contentNode); + this.isMounted = true; + } + this.contentNodeRoot?.render(<>{this.render()}); + } + + /** + * Render the React widget in the DOM. + * - If the widget has been previously rendered, + * any subsequent calls will perform an update and only + * change the DOM if absolutely necessary. + */ + protected abstract render(): React.ReactNode; +} diff --git a/packages/core/src/browser/diff-uris.ts b/packages/core/src/browser/diff-uris.ts new file mode 100644 index 0000000..6b72336 --- /dev/null +++ b/packages/core/src/browser/diff-uris.ts @@ -0,0 +1,117 @@ +// ***************************************************************************** +// Copyright (C) 2017 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { injectable, inject } from 'inversify'; +import URI from '../common/uri'; +import { LabelProviderContribution, LabelProvider, DidChangeLabelEvent } from './label-provider'; +import { codicon } from './widgets'; + +export namespace DiffUris { + + export const DIFF_SCHEME = 'diff'; + + export function encode(left: URI, right: URI, label?: string): URI { + const diffUris = [ + left.toString(), + right.toString() + ]; + + const diffUriStr = JSON.stringify(diffUris); + + return new URI().withScheme(DIFF_SCHEME).withPath(label || '').withQuery(diffUriStr); + } + + export function decode(uri: URI): URI[] { + if (uri.scheme !== DIFF_SCHEME) { + throw new Error((`The URI must have scheme "diff". The URI was: ${uri}.`)); + } + const diffUris: string[] = JSON.parse(uri.query); + return diffUris.map(s => new URI(s)); + } + + export function isDiffUri(uri: URI): boolean { + return uri.scheme === DIFF_SCHEME; + } + +} + +@injectable() +export class DiffUriLabelProviderContribution implements LabelProviderContribution { + + constructor(@inject(LabelProvider) protected labelProvider: LabelProvider) { } + + canHandle(element: object): number { + if (element instanceof URI && DiffUris.isDiffUri(element)) { + return 20; + } + return 0; + } + + getLongName(uri: URI): string { + const label = uri.path.toString(); + if (label) { + return label; + } + const [left, right] = DiffUris.decode(uri); + const leftLongName = this.labelProvider.getLongName(left); + const rightLongName = this.labelProvider.getLongName(right); + if (leftLongName === rightLongName) { + return leftLongName; + } + return `${leftLongName} ⟷ ${rightLongName}`; + } + + getName(uri: URI): string { + const label = uri.path.toString(); + if (label) { + return label; + } + const [left, right] = DiffUris.decode(uri); + + if (left.path.toString() === right.path.toString() && left.query && right.query) { + const prefix = left.displayName ? `${left.displayName}: ` : ''; + return `${prefix}${left.query} ⟷ ${right.query}`; + } else { + let title; + if (uri.displayName && left.path.toString() !== right.path.toString() && left.displayName !== uri.displayName) { + title = `${uri.displayName}: `; + } else { + title = ''; + } + + const leftLongName = this.labelProvider.getName(left); + const rightLongName = this.labelProvider.getName(right); + if (leftLongName === rightLongName) { + return leftLongName; + } + return `${title}${leftLongName} ⟷ ${rightLongName}`; + } + } + + getIcon(uri: URI): string { + return codicon('split-horizontal'); + } + + affects(diffUri: URI, event: DidChangeLabelEvent): boolean { + for (const uri of DiffUris.decode(diffUri)) { + if (event.affects(uri)) { + return true; + } + } + return false; + } + +} diff --git a/packages/core/src/browser/encoding-registry.ts b/packages/core/src/browser/encoding-registry.ts new file mode 100644 index 0000000..21012bd --- /dev/null +++ b/packages/core/src/browser/encoding-registry.ts @@ -0,0 +1,97 @@ +// ***************************************************************************** +// Copyright (C) 2020 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +// based on https://github.com/microsoft/vscode/blob/04c36be045a94fee58e5f8992d3e3fd980294a84/src/vs/workbench/services/textfile/browser/textFileService.ts#L491 + +import { injectable, inject } from 'inversify'; +import URI from '../common/uri'; +import { Disposable } from '../common/disposable'; +import { EncodingService as EncodingService } from '../common/encoding-service'; +import { UTF8 } from '../common/encodings'; +import { CorePreferences } from '../common/core-preferences'; + +export interface EncodingOverride { + parent?: URI; + extension?: string; + scheme?: string; + encoding: string; +} + +@injectable() +export class EncodingRegistry { + + protected readonly encodingOverrides: EncodingOverride[] = []; + + @inject(CorePreferences) + protected readonly preferences: CorePreferences; + + @inject(EncodingService) + protected readonly encodingService: EncodingService; + + registerOverride(override: EncodingOverride): Disposable { + this.encodingOverrides.push(override); + return Disposable.create(() => { + const index = this.encodingOverrides.indexOf(override); + if (index !== -1) { + this.encodingOverrides.splice(index, 1); + } + }); + } + + getEncodingForResource(resource: URI, preferredEncoding?: string): string { + let fileEncoding: string; + + const override = this.getEncodingOverride(resource); + if (override) { + fileEncoding = override; // encoding override always wins + } else if (preferredEncoding) { + fileEncoding = preferredEncoding; // preferred encoding comes second + } else { + fileEncoding = this.preferences.get('files.encoding', undefined, resource.toString()); + } + + if (!fileEncoding || !this.encodingService.exists(fileEncoding)) { + return UTF8; // the default is UTF 8 + } + + return this.encodingService.toIconvEncoding(fileEncoding); + } + + protected getEncodingOverride(resource: URI): string | undefined { + if (this.encodingOverrides && this.encodingOverrides.length) { + for (const override of this.encodingOverrides) { + if (override.parent && resource.isEqualOrParent(override.parent)) { + return override.encoding; + } + + if (override.extension && resource.path.ext === `.${override.extension}`) { + return override.encoding; + } + + if (override.scheme && override.scheme === resource.scheme) { + return override.encoding; + } + } + } + + return undefined; + } + +} diff --git a/packages/core/src/browser/endpoint.spec.ts b/packages/core/src/browser/endpoint.spec.ts new file mode 100644 index 0000000..c009e01 --- /dev/null +++ b/packages/core/src/browser/endpoint.spec.ts @@ -0,0 +1,148 @@ +// ***************************************************************************** +// Copyright (C) 2017 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import * as chai from 'chai'; +import { Endpoint } from './endpoint'; + +const expect = chai.expect; + +describe('Endpoint', () => { + + describe('01 #getWebSocketUrl', () => { + + it('Should correctly join root pathname', () => { + expectWsUri( + { + httpScheme: 'ws', + path: '/miau/' + }, + { + host: 'example.org', + pathname: '/', + search: '', + protocol: '' + }, 'ws://example.org/miau/'); + }); + + it('Should correctly join pathname and path', () => { + expectWsUri( + { + httpScheme: 'ws', + path: '/miau/' + }, + { + host: 'example.org', + pathname: '/mainresource', + search: '', + protocol: '' + }, 'ws://example.org/mainresource/miau/'); + }); + + it('Should correctly join pathname and path, ignoring double slash in between', () => { + expectWsUri( + { + httpScheme: 'ws', + path: '/miau/' + }, + { + host: 'example.org', + pathname: '/mainresource/', + search: '', + protocol: '' + }, 'ws://example.org/mainresource/miau/'); + }); + + it('Should correctly join pathname and path, without trailing slash', () => { + expectWsUri( + { + httpScheme: 'ws', + path: '/miau' + }, + { + host: 'example.org', + pathname: '/mainresource', + search: '', + protocol: '' + }, 'ws://example.org/mainresource/miau'); + }); + }); + + describe('02 #httpScheme', () => { + + it('Should choose https:// if location protocol is https://', () => { + expectRestUri( + { + path: '/' + }, + { + host: 'example.org', + pathname: '/', + search: '', + protocol: 'https:' + }, 'https://example.org/'); + }); + + it("should return with the 'options.httpScheme' if defined", () => { + expect(new Endpoint({ httpScheme: 'foo:' }, { + host: 'example.org', + pathname: '/', + search: '', + protocol: 'https:' + }).httpScheme).to.be.equal('foo:'); + }); + + it('should return with the HTTP if the protocol is HTTP.', () => { + expect(new Endpoint({}, { + host: 'example.org', + pathname: '/', + search: '', + protocol: 'http:' + }).httpScheme).to.be.equal('http:'); + }); + + it('should return with the HTTPS if the protocol is HTTPS.', () => { + expect(new Endpoint({}, { + host: 'example.org', + pathname: '/', + search: '', + protocol: 'https:' + }).httpScheme).to.be.equal('https:'); + }); + + it('should return with the HTTP if the protocol is *not* HTTP or HTTPS.', () => { + expect(new Endpoint({}, { + host: 'example.org', + pathname: '/', + search: '', + protocol: 'file:' + }).httpScheme).to.be.equal('http:'); + }); + + }); + +}); + +function expectWsUri(options: Endpoint.Options, mockLocation: Endpoint.Location, expectedUri: string): void { + const cut = new Endpoint(options, mockLocation); + const uri = cut.getWebSocketUrl(); + expect(uri.toString()).to.eq(expectedUri); +} + +function expectRestUri(options: Endpoint.Options, mockLocation: Endpoint.Location, expectedUri: string): void { + const cut = new Endpoint(options, mockLocation); + const uri = cut.getRestUrl(); + expect(uri.toString()).to.eq(expectedUri); +} diff --git a/packages/core/src/browser/endpoint.ts b/packages/core/src/browser/endpoint.ts new file mode 100644 index 0000000..cf9cbb7 --- /dev/null +++ b/packages/core/src/browser/endpoint.ts @@ -0,0 +1,136 @@ +// ***************************************************************************** +// Copyright (C) 2017 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import URI from '../common/uri'; + +/** + * An endpoint provides URLs for http and ws, based on configuration and defaults. + */ +export class Endpoint { + static readonly PROTO_HTTPS: string = 'https:'; + static readonly PROTO_HTTP: string = 'http:'; + static readonly PROTO_WS: string = 'ws:'; + static readonly PROTO_WSS: string = 'wss:'; + static readonly PROTO_FILE: string = 'file:'; + + constructor( + protected readonly options: Endpoint.Options = {}, + protected readonly location: Endpoint.Location = self.location + ) { } + + getWebSocketUrl(): URI { + return new URI(`${this.wsScheme}//${this.host}${this.pathname}${this.path}`); + } + + getRestUrl(): URI { + return new URI(`${this.httpScheme}//${this.host}${this.pathname}${this.path}`); + } + + protected get pathname(): string { + if (this.location.protocol === Endpoint.PROTO_FILE) { + return ''; + } + if (this.location.pathname === '/') { + return ''; + } + if (this.location.pathname.endsWith('/')) { + return this.location.pathname.substring(0, this.location.pathname.length - 1); + } + return this.location.pathname; + } + + get host(): string { + if (this.options.host) { + return this.options.host; + } + if (this.location.host) { + return this.location.host; + } + return 'localhost:' + this.port; + } + + get origin(): string { + return `${this.httpScheme}//${this.host}`; + } + + protected get port(): string { + return this.getSearchParam('port', '3000'); + } + + protected getSearchParam(name: string, defaultValue: string): string { + const search = this.location.search; + if (!search) { + return defaultValue; + } + return search.substring(1).split('&') + .filter(value => value.startsWith(name + '=')) + .map(value => { + const encoded = value.substring(name.length + 1); + return decodeURIComponent(encoded); + })[0] || defaultValue; + } + + protected get wsScheme(): string { + if (this.options.wsScheme) { + return this.options.wsScheme; + } + return this.httpScheme === Endpoint.PROTO_HTTPS ? Endpoint.PROTO_WSS : Endpoint.PROTO_WS; + } + + /** + * The HTTP/HTTPS scheme of the endpoint, or the user defined one. + * See: `Endpoint.Options.httpScheme`. + */ + get httpScheme(): string { + if (this.options.httpScheme) { + return this.options.httpScheme; + } + if (this.location.protocol === Endpoint.PROTO_HTTP || + this.location.protocol === Endpoint.PROTO_HTTPS) { + return this.location.protocol; + } + return Endpoint.PROTO_HTTP; + } + + protected get path(): string { + if (this.options.path) { + if (this.options.path.startsWith('/')) { + return this.options.path; + } else { + return '/' + this.options.path; + } + } + return ''; + } +} + +export namespace Endpoint { + export class Options { + host?: string; + wsScheme?: string; + httpScheme?: string; + path?: string; + } + + // Necessary for running tests with dependency on TS lib on node + // FIXME figure out how to mock with ts-node + export class Location { + host: string; + pathname: string; + search: string; + protocol: string; + } +} diff --git a/packages/core/src/browser/external-uri-service.ts b/packages/core/src/browser/external-uri-service.ts new file mode 100644 index 0000000..315fc22 --- /dev/null +++ b/packages/core/src/browser/external-uri-service.ts @@ -0,0 +1,79 @@ +// ***************************************************************************** +// Copyright (C) 2019 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { environment } from '@theia/application-package/lib/environment'; +import { injectable } from 'inversify'; +import { MaybePromise } from '../common/types'; +import URI from '../common/uri'; +import { Endpoint } from './endpoint'; + +export interface AddressPort { + address: string + port: number +} + +@injectable() +export class ExternalUriService { + + /** + * Maps local to remote URLs. + * Should be no-op if the given URL is not a localhost URL. + * + * By default maps to an origin serving Theia. + * + * Use `parseLocalhost` to retrieve localhost address and port information. + */ + resolve(uri: URI): MaybePromise { + const address = this.parseLocalhost(uri); + if (address) { + return this.toRemoteUrl(uri, address); + } + return uri; + } + + parseLocalhost(uri: URI): AddressPort | undefined { + if (uri.scheme !== 'http' && uri.scheme !== 'https') { + return; + } + const localhostMatch = /^(localhost|127\.0\.0\.1|0\.0\.0\.0):(\d+)$/.exec(uri.authority); + if (!localhostMatch) { + return; + } + return { + address: localhostMatch[1], + port: +localhostMatch[2], + }; + } + + protected toRemoteUrl(uri: URI, address: AddressPort): URI { + return new Endpoint({ host: this.toRemoteHost(address) }) + .getRestUrl() + .withPath(uri.path) + .withFragment(uri.fragment) + .withQuery(uri.query); + } + + protected toRemoteHost(address: AddressPort): string { + return `${this.getRemoteHost()}:${address.port}`; + } + + /** + * @returns The remote host (where the backend is running). + */ + protected getRemoteHost(): string { + return environment.electron.is() ? 'localhost' : window.location.hostname; + } +} diff --git a/packages/core/src/browser/file-icons-js.d.ts b/packages/core/src/browser/file-icons-js.d.ts new file mode 100644 index 0000000..05d87dd --- /dev/null +++ b/packages/core/src/browser/file-icons-js.d.ts @@ -0,0 +1,20 @@ +// ***************************************************************************** +// Copyright (C) 2017 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +declare module 'file-icons-js' { + function getClass(filePath: string): string; + function getClassWithColor(filePath: string): string; +} diff --git a/packages/core/src/browser/frontend-application-bindings.ts b/packages/core/src/browser/frontend-application-bindings.ts new file mode 100644 index 0000000..d439f5e --- /dev/null +++ b/packages/core/src/browser/frontend-application-bindings.ts @@ -0,0 +1,57 @@ +// ***************************************************************************** +// Copyright (C) 2019 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { interfaces } from 'inversify'; +import { + bindContributionProvider, DefaultResourceProvider, MaybePromise, MessageClient, + MessageService, ResourceProvider, ResourceResolver +} from '../common'; +import { PreferenceProvider } from '../common/preferences/preference-provider'; +import { + bindPreferenceSchemaProvider, + PreferenceValidationService +} from './preferences'; +import { + InjectablePreferenceProxy, PreferenceProviderProvider, PreferenceProxyFactory, + PreferenceProxyOptions, PreferenceProxySchema, PreferenceSchema, PreferenceScope, PreferenceService, PreferenceServiceImpl +} from '../common/preferences'; + +export function bindMessageService(bind: interfaces.Bind): interfaces.BindingWhenOnSyntax { + bind(MessageClient).toSelf().inSingletonScope(); + return bind(MessageService).toSelf().inSingletonScope(); +} + +export function bindPreferenceService(bind: interfaces.Bind): void { + bind(PreferenceProviderProvider).toFactory(ctx => (scope: PreferenceScope) => ctx.container.getNamed(PreferenceProvider, scope)); + bind(PreferenceServiceImpl).toSelf().inSingletonScope(); + bind(PreferenceService).toService(PreferenceServiceImpl); + bindPreferenceSchemaProvider(bind); + bind(PreferenceValidationService).toSelf().inSingletonScope(); + bind(InjectablePreferenceProxy).toSelf(); + bind(PreferenceProxyFactory).toFactory(({ container }) => (schema: MaybePromise, options: PreferenceProxyOptions = {}) => { + const child = container.createChild(); + child.bind(PreferenceProxyOptions).toConstantValue(options ?? {}); + child.bind(PreferenceProxySchema).toConstantValue(() => schema); + const handler = child.get(InjectablePreferenceProxy); + return new Proxy(Object.create(null), handler); // eslint-disable-line no-null/no-null + }); +} + +export function bindResourceProvider(bind: interfaces.Bind): void { + bind(DefaultResourceProvider).toSelf().inSingletonScope(); + bind(ResourceProvider).toProvider(context => uri => context.container.get(DefaultResourceProvider).get(uri)); + bindContributionProvider(bind, ResourceResolver); +} diff --git a/packages/core/src/browser/frontend-application-config-provider.spec.ts b/packages/core/src/browser/frontend-application-config-provider.spec.ts new file mode 100644 index 0000000..560bbf1 --- /dev/null +++ b/packages/core/src/browser/frontend-application-config-provider.spec.ts @@ -0,0 +1,45 @@ +// ***************************************************************************** +// Copyright (C) 2021 Ericsson and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { enableJSDOM } from '../browser/test/jsdom'; +let disableJSDOM = enableJSDOM(); + +import { FrontendApplicationConfig } from '@theia/application-package/lib/'; +import { expect } from 'chai'; +import { FrontendApplicationConfigProvider } from './frontend-application-config-provider'; + +disableJSDOM(); + +const { DEFAULT } = FrontendApplicationConfig; + +describe('FrontendApplicationConfigProvider', function (): void { + + before(() => disableJSDOM = enableJSDOM()); + after(() => disableJSDOM()); + + it('should use defaults when calling `set`', function (): void { + FrontendApplicationConfigProvider.set({ + applicationName: DEFAULT.applicationName + ' Something Else', + }); + const config = FrontendApplicationConfigProvider.get(); + // custom values + expect(config.applicationName).not.equal(DEFAULT.applicationName); + // defaults + expect(config.defaultIconTheme).equal(DEFAULT.defaultIconTheme); + expect(config.defaultTheme).deep.equal(DEFAULT.defaultTheme); + expect(config.electron.windowOptions).deep.equal(DEFAULT.electron.windowOptions); + }); +}); diff --git a/packages/core/src/browser/frontend-application-config-provider.ts b/packages/core/src/browser/frontend-application-config-provider.ts new file mode 100644 index 0000000..e607010 --- /dev/null +++ b/packages/core/src/browser/frontend-application-config-provider.ts @@ -0,0 +1,50 @@ +// ***************************************************************************** +// Copyright (C) 2018 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { FrontendApplicationConfig, deepmerge } from '@theia/application-package/lib/application-props'; + +export const DEFAULT_BACKGROUND_COLOR_STORAGE_KEY = 'theme.background'; + +export class FrontendApplicationConfigProvider { + + private static KEY = Symbol('FrontendApplicationConfigProvider'); + + static get(): FrontendApplicationConfig { + const config = FrontendApplicationConfigProvider.doGet(); + if (config === undefined) { + throw new Error('The configuration is not set. Did you call FrontendApplicationConfigProvider#set?'); + } + return config; + } + + static set(config: FrontendApplicationConfig.Partial): void { + if (FrontendApplicationConfigProvider.doGet() !== undefined) { + throw new Error('The configuration is already set.'); + } + // eslint-disable-next-line @typescript-eslint/no-explicit-any + const globalObject = window as any; + const key = FrontendApplicationConfigProvider.KEY; + globalObject[key] = deepmerge(FrontendApplicationConfig.DEFAULT, config); + } + + private static doGet(): FrontendApplicationConfig | undefined { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + const globalObject = window as any; + const key = FrontendApplicationConfigProvider.KEY; + return globalObject[key]; + } + +} diff --git a/packages/core/src/browser/frontend-application-contribution.ts b/packages/core/src/browser/frontend-application-contribution.ts new file mode 100644 index 0000000..d6b40ba --- /dev/null +++ b/packages/core/src/browser/frontend-application-contribution.ts @@ -0,0 +1,110 @@ +// ***************************************************************************** +// Copyright (C) 2023 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import type { FrontendApplication } from './frontend-application'; +import { MaybePromise, isObject } from '../common/types'; +import { StopReason } from '../common/frontend-application-state'; +import { injectable } from 'inversify'; + +/** + * Clients can implement to get a callback for contributing widgets to a shell on start. + */ +export const FrontendApplicationContribution = Symbol('FrontendApplicationContribution'); +export interface FrontendApplicationContribution { + + /** + * Called on application startup before configure is called. + */ + initialize?(): void; + + /** + * Called before commands, key bindings and menus are initialized. + * Should return a promise if it runs asynchronously. + */ + configure?(app: FrontendApplication): MaybePromise; + + /** + * Called when the application is started. The application shell is not attached yet when this method runs. + * Should return a promise if it runs asynchronously. + */ + onStart?(app: FrontendApplication): MaybePromise; + + /** + * Called on `beforeunload` event, right before the window closes. + * Return `true` or an OnWillStopAction in order to prevent exit. + * Note: No async code allowed, this function has to run on one tick. + */ + onWillStop?(app: FrontendApplication): boolean | undefined | OnWillStopAction; + + /** + * Called when an application is stopped or unloaded. + * + * Note that this is implemented using `window.beforeunload` which doesn't allow any asynchronous code anymore. + * I.e. this is the last tick. + */ + onStop?(app: FrontendApplication): void; + + /** + * Called after the application shell has been attached in case there is no previous workbench layout state. + * Should return a promise if it runs asynchronously. + */ + initializeLayout?(app: FrontendApplication): MaybePromise; + + /** + * An event is emitted when a layout is initialized, but before the shell is attached. + */ + onDidInitializeLayout?(app: FrontendApplication): MaybePromise; +} + +export interface OnWillStopAction { + /** + * @resolves to a prepared value to be passed into the `action` function. + */ + prepare?: (stopReason?: StopReason) => MaybePromise; + /** + * @resolves to `true` if it is safe to close the application; `false` otherwise. + */ + action: (prepared: T, stopReason?: StopReason) => MaybePromise; + /** + * A descriptive string for the reason preventing close. + */ + reason: string; + /** + * A number representing priority. Higher priority items are run later. + * High priority implies that some options of this check will have negative impacts if + * the user subsequently cancels the shutdown. + */ + priority?: number; +} + +export namespace OnWillStopAction { + export function is(candidate: unknown): candidate is OnWillStopAction { + return isObject(candidate) && 'action' in candidate && 'reason' in candidate; + } +} + +/** + * Default frontend contribution that can be extended by clients if they do not want to implement any of the + * methods from the interface but still want to contribute to the frontend application. + */ +@injectable() +export abstract class DefaultFrontendApplicationContribution implements FrontendApplicationContribution { + + initialize(): void { + // NOOP + } + +} diff --git a/packages/core/src/browser/frontend-application-module.ts b/packages/core/src/browser/frontend-application-module.ts new file mode 100644 index 0000000..d801684 --- /dev/null +++ b/packages/core/src/browser/frontend-application-module.ts @@ -0,0 +1,486 @@ +// ***************************************************************************** +// Copyright (C) 2017 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import '../../src/browser/style/index.css'; +require('../../src/browser/style/materialcolors.css').use(); +import 'font-awesome/css/font-awesome.min.css'; +import 'file-icons-js/css/style.css'; +import '@vscode/codicons/dist/codicon.css'; + +import { ContainerModule } from 'inversify'; +import { + bindContributionProvider, + SelectionService, + ResourceResolver, + CommandContribution, CommandRegistry, CommandService, commandServicePath, + MenuModelRegistry, MenuContribution, + MessageClient, + InMemoryResources, + messageServicePath, + InMemoryTextResourceResolver, + UntitledResourceResolver, + MenuPath, + PreferenceService +} from '../common'; +import { KeybindingRegistry, KeybindingContext, KeybindingContribution } from './keybinding'; +import { FrontendApplication } from './frontend-application'; +import { FrontendApplicationContribution, DefaultFrontendApplicationContribution } from './frontend-application-contribution'; +import { DefaultOpenerService, OpenerService, OpenHandler } from './opener-service'; +import { HttpOpenHandler } from './http-open-handler'; +import { CommonFrontendContribution } from './common-frontend-contribution'; +import { LocalStorageService, StorageService } from './storage-service'; +import { WidgetFactory, WidgetManager } from './widget-manager'; +import { + ApplicationShell, ApplicationShellOptions, DockPanelRenderer, TabBarRenderer, + TabBarRendererFactory, ShellLayoutRestorer, + SidePanelHandler, SidePanelHandlerFactory, + SidebarMenuWidget, SidebarTopMenuWidgetFactory, + SplitPositionHandler, DockPanelRendererFactory, ApplicationShellLayoutMigration, ApplicationShellLayoutMigrationError, SidebarBottomMenuWidgetFactory, + ShellLayoutTransformer +} from './shell'; +import { LabelParser } from './label-parser'; +import { LabelProvider, LabelProviderContribution, DefaultUriLabelProviderContribution } from './label-provider'; +import { ContextMenuRenderer, Coordinate } from './context-menu-renderer'; +import { ThemeService } from './theming'; +import { ConnectionStatusService, FrontendConnectionStatusService, ApplicationConnectionStatusContribution, PingService } from './connection-status-service'; +import { DiffUriLabelProviderContribution } from './diff-uris'; +import { ApplicationServer, applicationPath } from '../common/application-protocol'; +import { WebSocketConnectionProvider } from './messaging'; +import { AboutDialog, AboutDialogProps } from './about-dialog'; +import { EnvVariablesServer, envVariablesPath, EnvVariable } from './../common/env-variables'; +import { FrontendApplicationStateService } from './frontend-application-state'; +import { JsonSchemaStore, JsonSchemaContribution, DefaultJsonSchemaContribution, JsonSchemaDataStore } from './json-schema-store'; +import { TabBarToolbarRegistry, TabBarToolbarContribution, TabBarToolbarFactory, TabBarToolbar } from './shell/tab-bar-toolbar'; +import { ContextKeyService, ContextKeyServiceDummyImpl } from './context-key-service'; +import { ResourceContextKey } from './resource-context-key'; +import { KeyboardLayoutService } from './keyboard/keyboard-layout-service'; +import { MimeService } from './mime-service'; +import { ApplicationShellMouseTracker } from './shell/application-shell-mouse-tracker'; +import { ViewContainer, ViewContainerIdentifier } from './view-container'; +import { QuickViewService } from './quick-input/quick-view-service'; +import { DialogOverlayService } from './dialogs'; +import { ProgressLocationService } from './progress-location-service'; +import { ProgressClient } from '../common/progress-service-protocol'; +import { ProgressService } from '../common/progress-service'; +import { DispatchingProgressClient } from './progress-client'; +import { ProgressStatusBarItem } from './progress-status-bar-item'; +import { TabBarDecoratorService, TabBarDecorator } from './shell/tab-bar-decorator'; +import { ContextMenuContext } from './menu/context-menu-context'; +import { bindResourceProvider, bindMessageService, bindPreferenceService } from './frontend-application-bindings'; +import { ColorRegistry } from './color-registry'; +import { ColorContribution, ColorApplicationContribution } from './color-application-contribution'; +import { ExternalUriService } from './external-uri-service'; +import { IconThemeService, NoneIconTheme } from './icon-theme-service'; +import { IconThemeApplicationContribution, IconThemeContribution, DefaultFileIconThemeContribution } from './icon-theme-contribution'; +import { TreeLabelProvider } from './tree/tree-label-provider'; +import { ProgressBar } from './progress-bar'; +import { ProgressBarFactory, ProgressBarOptions } from './progress-bar-factory'; +import { CommandOpenHandler } from './command-open-handler'; +import { LanguageService } from './language-service'; +import { EncodingRegistry } from './encoding-registry'; +import { EncodingService } from '../common/encoding-service'; +import { AuthenticationService, AuthenticationServiceImpl } from '../browser/authentication-service'; +import { DecorationsService, DecorationsServiceImpl } from './decorations-service'; +import { keyStoreServicePath, KeyStoreService } from '../common/key-store'; +import { CredentialsService, CredentialsServiceImpl } from './credentials-service'; +import { ContributionFilterRegistry, ContributionFilterRegistryImpl } from '../common/contribution-filter'; +import { QuickCommandFrontendContribution } from './quick-input/quick-command-frontend-contribution'; +import { QuickPickService, quickPickServicePath } from '../common/quick-pick-service'; +import { + QuickPickServiceImpl, + QuickInputFrontendContribution, + QuickAccessContribution, + QuickCommandService, + QuickHelpService +} from './quick-input'; +import { SidebarBottomMenuWidget } from './shell/sidebar-bottom-menu-widget'; +import { WindowContribution } from './window-contribution'; +import { + BreadcrumbID, + BreadcrumbPopupContainer, + BreadcrumbPopupContainerFactory, + BreadcrumbRenderer, + BreadcrumbsContribution, + BreadcrumbsRenderer, + BreadcrumbsRendererFactory, + BreadcrumbsService, + DefaultBreadcrumbRenderer, +} from './breadcrumbs'; +import { DockPanel, RendererHost } from './widgets'; +import { TooltipService, TooltipServiceImpl } from './tooltip-service'; +import { BackendRequestService, RequestService, REQUEST_SERVICE_PATH } from '@theia/request'; +import { bindFrontendStopwatch, bindBackendStopwatch } from './performance'; +import { SaveableService } from './saveable-service'; +import { SecondaryWindowHandler } from './secondary-window-handler'; +import { UserWorkingDirectoryProvider } from './user-working-directory-provider'; +import { WindowTitleService } from './window/window-title-service'; +import { WindowTitleUpdater } from './window/window-title-updater'; +import { TheiaDockPanel } from './shell/theia-dock-panel'; +import { bindStatusBar } from './status-bar'; +import { MarkdownRenderer, MarkdownRendererFactory, MarkdownRendererImpl } from './markdown-rendering/markdown-renderer'; +import { StylingParticipant, StylingService } from './styling-service'; +import { bindCommonStylingParticipants } from './common-styling-participants'; +import { HoverService } from './hover-service'; +import { AdditionalViewsMenuPath, AdditionalViewsMenuWidget, AdditionalViewsMenuWidgetFactory } from './shell/additional-views-menu-widget'; +import { LanguageIconLabelProvider } from './language-icon-provider'; +import { bindTreePreferences } from '../common/tree-preference'; +import { OpenWithService } from './open-with-service'; +import { ViewColumnService } from './shell/view-column-service'; +import { DomInputUndoRedoHandler, UndoRedoHandler, UndoRedoHandlerService } from './undo-redo-handler'; +import { WidgetStatusBarContribution, WidgetStatusBarService } from './widget-status-bar-service'; +import { SymbolIconColorContribution } from './symbol-icon-color-contribution'; +import { CorePreferences, bindCorePreferences } from '../common/core-preferences'; +import { bindBadgeDecoration } from './badges'; + +export { bindResourceProvider, bindMessageService, bindPreferenceService }; + +export const frontendApplicationModule = new ContainerModule((bind, _unbind, _isBound, _rebind) => { + bind(NoneIconTheme).toSelf().inSingletonScope(); + bind(LabelProviderContribution).toService(NoneIconTheme); + bind(IconThemeService).toSelf().inSingletonScope(); + bindContributionProvider(bind, IconThemeContribution); + bind(DefaultFileIconThemeContribution).toSelf().inSingletonScope(); + bind(IconThemeContribution).toService(DefaultFileIconThemeContribution); + bind(IconThemeApplicationContribution).toSelf().inSingletonScope(); + bind(FrontendApplicationContribution).toService(IconThemeApplicationContribution); + bind(LanguageIconLabelProvider).toSelf().inSingletonScope(); + bind(LabelProviderContribution).toService(LanguageIconLabelProvider); + + bind(ColorRegistry).toSelf().inSingletonScope(); + bindContributionProvider(bind, ColorContribution); + bind(ColorApplicationContribution).toSelf().inSingletonScope(); + bind(FrontendApplicationContribution).toService(ColorApplicationContribution); + + bind(FrontendApplication).toSelf().inSingletonScope(); + bind(FrontendApplicationStateService).toSelf().inSingletonScope(); + bind(DefaultFrontendApplicationContribution).toSelf(); + bindContributionProvider(bind, FrontendApplicationContribution); + + bind(ApplicationShellOptions).toConstantValue({}); + bind(ApplicationShell).toSelf().inSingletonScope(); + bind(SidePanelHandlerFactory).toAutoFactory(SidePanelHandler); + bind(SidePanelHandler).toSelf(); + bind(SidebarTopMenuWidgetFactory).toAutoFactory(SidebarMenuWidget); + bind(SidebarMenuWidget).toSelf(); + bind(SidebarBottomMenuWidget).toSelf(); + bind(SidebarBottomMenuWidgetFactory).toAutoFactory(SidebarBottomMenuWidget); + bind(AdditionalViewsMenuWidget).toSelf(); + bind(AdditionalViewsMenuWidgetFactory).toFactory(ctx => (side: 'left' | 'right') => { + const childContainer = ctx.container.createChild(); + childContainer.bind(AdditionalViewsMenuPath).toConstantValue(['additional_views_menu', side]); + return childContainer.resolve(AdditionalViewsMenuWidget); + }); + bind(SplitPositionHandler).toSelf().inSingletonScope(); + + bindContributionProvider(bind, TabBarToolbarContribution); + bind(TabBarToolbarRegistry).toSelf().inSingletonScope(); + bind(FrontendApplicationContribution).toService(TabBarToolbarRegistry); + bind(TabBarToolbarFactory).toFactory(context => () => { + const container = context.container.createChild(); + container.bind(TabBarToolbar).toSelf().inSingletonScope(); + return container.get(TabBarToolbar); + }); + + bind(DockPanelRendererFactory).toFactory(context => (document?: Document | ShadowRoot) => { + const renderer = context.container.get(DockPanelRenderer); + renderer.document = document; + return renderer; + }); + bind(DockPanelRenderer).toSelf(); + bind(TabBarRendererFactory).toFactory(({ container }) => () => { + const contextMenuRenderer = container.get(ContextMenuRenderer); + const tabBarDecoratorService = container.get(TabBarDecoratorService); + const iconThemeService = container.get(IconThemeService); + const selectionService = container.get(SelectionService); + const commandService = container.get(CommandService); + const corePreferences = container.get(CorePreferences); + const hoverService = container.get(HoverService); + const contextKeyService: ContextKeyService = container.get(ContextKeyService); + return new TabBarRenderer(contextMenuRenderer, tabBarDecoratorService, iconThemeService, + selectionService, commandService, corePreferences, hoverService, contextKeyService); + }); + bind(TheiaDockPanel.Factory).toFactory(({ container }) => (options?: DockPanel.IOptions, maximizeCallback?: (area: TheiaDockPanel) => void) => { + const corePreferences = container.get(CorePreferences); + return new TheiaDockPanel(options, corePreferences, maximizeCallback); + }); + + bindContributionProvider(bind, TabBarDecorator); + bind(TabBarDecoratorService).toSelf().inSingletonScope(); + bind(FrontendApplicationContribution).toService(TabBarDecoratorService); + + bindContributionProvider(bind, OpenHandler); + bind(DefaultOpenerService).toSelf().inSingletonScope(); + bind(OpenerService).toService(DefaultOpenerService); + + bind(ExternalUriService).toSelf().inSingletonScope(); + bind(HttpOpenHandler).toSelf().inSingletonScope(); + bind(OpenHandler).toService(HttpOpenHandler); + + bind(CommandOpenHandler).toSelf().inSingletonScope(); + bind(OpenHandler).toService(CommandOpenHandler); + + bind(OpenWithService).toSelf().inSingletonScope(); + + bind(TooltipServiceImpl).toSelf().inSingletonScope(); + bind(TooltipService).toService(TooltipServiceImpl); + + bindContributionProvider(bind, ApplicationShellLayoutMigration); + bind(ApplicationShellLayoutMigration).toConstantValue({ + layoutVersion: 2.0, + onWillInflateLayout({ layoutVersion }): void { + throw ApplicationShellLayoutMigrationError.create( + `It is not possible to migrate layout of version ${layoutVersion} to version ${this.layoutVersion}.` + ); + } + }); + + bindContributionProvider(bind, ShellLayoutTransformer); + + bindContributionProvider(bind, WidgetFactory); + bind(WidgetManager).toSelf().inSingletonScope(); + bind(ShellLayoutRestorer).toSelf().inSingletonScope(); + bind(CommandContribution).toService(ShellLayoutRestorer); + + bindResourceProvider(bind); + bind(InMemoryResources).toSelf().inSingletonScope(); + bind(ResourceResolver).toService(InMemoryResources); + + bind(InMemoryTextResourceResolver).toSelf().inSingletonScope(); + bind(ResourceResolver).toService(InMemoryTextResourceResolver); + + bind(UntitledResourceResolver).toSelf().inSingletonScope(); + bind(ResourceResolver).toService(UntitledResourceResolver); + + bind(SelectionService).toSelf().inSingletonScope(); + bind(CommandRegistry).toSelf().inSingletonScope().onActivation(({ container }, registry) => { + WebSocketConnectionProvider.createHandler(container, commandServicePath, registry); + return registry; + }); + bind(CommandService).toService(CommandRegistry); + bindContributionProvider(bind, CommandContribution); + + bind(ContextKeyService).to(ContextKeyServiceDummyImpl).inSingletonScope(); + + bind(MenuModelRegistry).toSelf().inSingletonScope(); + bindContributionProvider(bind, MenuContribution); + + bind(KeyboardLayoutService).toSelf().inSingletonScope(); + bind(KeybindingRegistry).toSelf().inSingletonScope(); + bindContributionProvider(bind, KeybindingContext); + bindContributionProvider(bind, KeybindingContribution); + + bindMessageService(bind).onActivation(({ container }, messages) => { + const client = container.get(MessageClient); + WebSocketConnectionProvider.createHandler(container, messageServicePath, client); + return messages; + }); + + bind(LanguageService).toSelf().inSingletonScope(); + + bind(EncodingService).toSelf().inSingletonScope(); + bind(EncodingRegistry).toSelf().inSingletonScope(); + + bind(ResourceContextKey).toSelf().inSingletonScope(); + bind(CommonFrontendContribution).toSelf().inSingletonScope(); + [FrontendApplicationContribution, CommandContribution, KeybindingContribution, MenuContribution, ColorContribution].forEach(serviceIdentifier => + bind(serviceIdentifier).toService(CommonFrontendContribution) + ); + bind(SymbolIconColorContribution).toSelf().inSingletonScope(); + bind(ColorContribution).toService(SymbolIconColorContribution); + + bindCommonStylingParticipants(bind); + + bind(QuickCommandFrontendContribution).toSelf().inSingletonScope(); + [CommandContribution, KeybindingContribution, MenuContribution].forEach(serviceIdentifier => + bind(serviceIdentifier).toService(QuickCommandFrontendContribution) + ); + bind(QuickCommandService).toSelf().inSingletonScope(); + bind(QuickAccessContribution).toService(QuickCommandService); + + bind(QuickHelpService).toSelf().inSingletonScope(); + bind(QuickAccessContribution).toService(QuickHelpService); + + bind(QuickPickService).to(QuickPickServiceImpl).inSingletonScope().onActivation(({ container }, quickPickService: QuickPickService) => { + WebSocketConnectionProvider.createHandler(container, quickPickServicePath, quickPickService); + return quickPickService; + }); + + bind(MarkdownRenderer).to(MarkdownRendererImpl).inSingletonScope(); + bind(MarkdownRendererFactory).toFactory(({ container }) => () => container.get(MarkdownRenderer)); + + bindContributionProvider(bind, QuickAccessContribution); + bind(QuickInputFrontendContribution).toSelf().inSingletonScope(); + bind(FrontendApplicationContribution).toService(QuickInputFrontendContribution); + + bind(LocalStorageService).toSelf().inSingletonScope(); + bind(StorageService).toService(LocalStorageService); + + bindStatusBar(bind); + bind(LabelParser).toSelf().inSingletonScope(); + + bindContributionProvider(bind, LabelProviderContribution); + bind(LabelProvider).toSelf().inSingletonScope(); + bind(FrontendApplicationContribution).toService(LabelProvider); + bind(DefaultUriLabelProviderContribution).toSelf().inSingletonScope(); + bind(LabelProviderContribution).toService(DefaultUriLabelProviderContribution); + bind(LabelProviderContribution).to(DiffUriLabelProviderContribution).inSingletonScope(); + + bind(TreeLabelProvider).toSelf().inSingletonScope(); + bind(LabelProviderContribution).toService(TreeLabelProvider); + + bindPreferenceService(bind); + bind(FrontendApplicationContribution).toService(PreferenceService); + + bindContributionProvider(bind, JsonSchemaContribution); + bind(JsonSchemaStore).toSelf().inSingletonScope(); + bind(FrontendApplicationContribution).toService(JsonSchemaStore); + bind(JsonSchemaDataStore).toSelf().inSingletonScope(); + bind(DefaultJsonSchemaContribution).toSelf().inSingletonScope(); + bind(JsonSchemaContribution).toService(DefaultJsonSchemaContribution); + + bind(PingService).toDynamicValue(ctx => { + // let's reuse a simple and cheap service from this package + const envServer: EnvVariablesServer = ctx.container.get(EnvVariablesServer); + return { + ping(): Promise { + return envServer.getValue('does_not_matter'); + } + }; + }); + bind(FrontendConnectionStatusService).toSelf().inSingletonScope(); + bind(ConnectionStatusService).toService(FrontendConnectionStatusService); + bind(ApplicationConnectionStatusContribution).toSelf().inSingletonScope(); + bind(FrontendApplicationContribution).toService(ApplicationConnectionStatusContribution); + + bind(ApplicationServer).toDynamicValue(ctx => { + const provider = ctx.container.get(WebSocketConnectionProvider); + return provider.createProxy(applicationPath); + }).inSingletonScope(); + + bind(AboutDialog).toSelf().inSingletonScope(); + bind(AboutDialogProps).toConstantValue({ title: 'Theia' }); + + bind(EnvVariablesServer).toDynamicValue(ctx => { + const connection = ctx.container.get(WebSocketConnectionProvider); + return connection.createProxy(envVariablesPath); + }).inSingletonScope(); + + bind(ThemeService).toSelf().inSingletonScope(); + + bindCorePreferences(bind); + bindTreePreferences(bind); + + bind(MimeService).toSelf().inSingletonScope(); + + bind(ApplicationShellMouseTracker).toSelf().inSingletonScope(); + bind(FrontendApplicationContribution).toService(ApplicationShellMouseTracker); + + bind(ViewContainer.Factory).toFactory(context => (options: ViewContainerIdentifier) => { + const container = context.container.createChild(); + container.bind(ViewContainerIdentifier).toConstantValue(options); + container.bind(ViewContainer).toSelf().inSingletonScope(); + return container.get(ViewContainer); + }); + + bind(QuickViewService).toSelf().inSingletonScope(); + bind(QuickAccessContribution).toService(QuickViewService); + + bind(DialogOverlayService).toSelf().inSingletonScope(); + bind(FrontendApplicationContribution).toService(DialogOverlayService); + + bind(DispatchingProgressClient).toSelf().inSingletonScope(); + bind(ProgressLocationService).toSelf().inSingletonScope(); + bind(ProgressStatusBarItem).toSelf().inSingletonScope(); + bind(ProgressClient).toService(DispatchingProgressClient); + bind(ProgressService).toSelf().inSingletonScope(); + bind(ProgressBarFactory).toFactory(context => (options: ProgressBarOptions) => { + const childContainer = context.container.createChild(); + childContainer.bind(ProgressBarOptions).toConstantValue(options); + childContainer.bind(ProgressBar).toSelf().inSingletonScope(); + return childContainer.get(ProgressBar); + }); + + bind(ContextMenuContext).toSelf().inSingletonScope(); + + bind(AuthenticationService).to(AuthenticationServiceImpl).inSingletonScope(); + bind(DecorationsService).to(DecorationsServiceImpl).inSingletonScope(); + + bind(KeyStoreService).toDynamicValue(ctx => { + const connection = ctx.container.get(WebSocketConnectionProvider); + return connection.createProxy(keyStoreServicePath); + }).inSingletonScope(); + + bind(CredentialsService).to(CredentialsServiceImpl); + + bind(ContributionFilterRegistry).to(ContributionFilterRegistryImpl).inSingletonScope(); + bind(WindowContribution).toSelf().inSingletonScope(); + for (const contribution of [CommandContribution, KeybindingContribution, MenuContribution]) { + bind(contribution).toService(WindowContribution); + } + bind(WindowTitleService).toSelf().inSingletonScope(); + bind(WindowTitleUpdater).toSelf().inSingletonScope(); + bind(FrontendApplicationContribution).toService(WindowTitleUpdater); + bindContributionProvider(bind, BreadcrumbsContribution); + bind(BreadcrumbsService).toSelf().inSingletonScope(); + bind(BreadcrumbsRenderer).toSelf(); + bind(BreadcrumbsRendererFactory).toFactory(ctx => + () => { + const childContainer = ctx.container.createChild(); + childContainer.bind(BreadcrumbRenderer).to(DefaultBreadcrumbRenderer).inSingletonScope(); + return childContainer.get(BreadcrumbsRenderer); + } + ); + bind(BreadcrumbPopupContainer).toSelf(); + bind(BreadcrumbPopupContainerFactory).toFactory(({ container }) => (parent: HTMLElement, breadcrumbId: string, position: Coordinate): BreadcrumbPopupContainer => { + const child = container.createChild(); + child.bind(RendererHost).toConstantValue(parent); + child.bind(BreadcrumbID).toConstantValue(breadcrumbId); + child.bind(Coordinate).toConstantValue(position); + return child.get(BreadcrumbPopupContainer); + }); + + bind(BackendRequestService).toDynamicValue(ctx => + WebSocketConnectionProvider.createProxy(ctx.container, REQUEST_SERVICE_PATH) + ).inSingletonScope(); + + bindFrontendStopwatch(bind); + bindBackendStopwatch(bind); + + bind(SaveableService).toSelf().inSingletonScope(); + bind(FrontendApplicationContribution).toService(SaveableService); + + bind(UserWorkingDirectoryProvider).toSelf().inSingletonScope(); + bind(FrontendApplicationContribution).toService(UserWorkingDirectoryProvider); + + bind(HoverService).toSelf().inSingletonScope(); + + bind(StylingService).toSelf().inSingletonScope(); + bindContributionProvider(bind, StylingParticipant); + bind(FrontendApplicationContribution).toService(StylingService); + + bind(SecondaryWindowHandler).toSelf().inSingletonScope(); + bind(ViewColumnService).toSelf().inSingletonScope(); + + bind(UndoRedoHandlerService).toSelf().inSingletonScope(); + bindContributionProvider(bind, UndoRedoHandler); + bind(DomInputUndoRedoHandler).toSelf().inSingletonScope(); + bind(UndoRedoHandler).toService(DomInputUndoRedoHandler); + + bind(WidgetStatusBarService).toSelf().inSingletonScope(); + bind(FrontendApplicationContribution).toService(WidgetStatusBarService); + bindContributionProvider(bind, WidgetStatusBarContribution); + bindBadgeDecoration(bind); +}); diff --git a/packages/core/src/browser/frontend-application-state.ts b/packages/core/src/browser/frontend-application-state.ts new file mode 100644 index 0000000..2673227 --- /dev/null +++ b/packages/core/src/browser/frontend-application-state.ts @@ -0,0 +1,74 @@ +// ***************************************************************************** +// Copyright (C) 2018 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { injectable, inject } from 'inversify'; +import { Emitter, Event } from '../common/event'; +import { Deferred } from '../common/promise-util'; +import { ILogger } from '../common/logger'; +import { FrontendApplicationState } from '../common/frontend-application-state'; + +export { FrontendApplicationState }; + +@injectable() +export class FrontendApplicationStateService { + + @inject(ILogger) + protected readonly logger: ILogger; + + private _state: FrontendApplicationState = 'init'; + + protected deferred: { [state: string]: Deferred } = {}; + protected readonly stateChanged = new Emitter(); + + get state(): FrontendApplicationState { + return this._state; + } + + set state(state: FrontendApplicationState) { + if (state !== this._state) { + this.doSetState(state); + } + } + + get onStateChanged(): Event { + return this.stateChanged.event; + } + + protected doSetState(state: FrontendApplicationState): void { + if (this.deferred[this._state] === undefined) { + this.deferred[this._state] = new Deferred(); + } + const oldState = this._state; + this._state = state; + if (this.deferred[state] === undefined) { + this.deferred[state] = new Deferred(); + } + this.deferred[state].resolve(); + this.logger.info(`Changed application state from '${oldState}' to '${this._state}'.`); + this.stateChanged.fire(state); + } + + reachedState(state: FrontendApplicationState): Promise { + if (this.deferred[state] === undefined) { + this.deferred[state] = new Deferred(); + } + return this.deferred[state].promise; + } + + reachedAnyState(...states: FrontendApplicationState[]): Promise { + return Promise.race(states.map(s => this.reachedState(s))); + } +} diff --git a/packages/core/src/browser/frontend-application.ts b/packages/core/src/browser/frontend-application.ts new file mode 100644 index 0000000..58c7977 --- /dev/null +++ b/packages/core/src/browser/frontend-application.ts @@ -0,0 +1,326 @@ +// ***************************************************************************** +// Copyright (C) 2017 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { inject, injectable, named } from 'inversify'; +import { ContributionProvider, CommandRegistry, MenuModelRegistry, isOSX, BackendStopwatch, LogLevel, Stopwatch } from '../common'; +import { MaybePromise } from '../common/types'; +import { KeybindingRegistry } from './keybinding'; +import { Widget } from './widgets'; +import { ApplicationShell } from './shell/application-shell'; +import { ShellLayoutRestorer, ApplicationShellLayoutMigrationError } from './shell/shell-layout-restorer'; +import { FrontendApplicationStateService } from './frontend-application-state'; +import { preventNavigation, parseCssTime, animationFrame } from './browser'; +import { CorePreferences } from '../common/core-preferences'; +import { WindowService } from './window/window-service'; +import { TooltipService } from './tooltip-service'; +import { FrontendApplicationContribution } from './frontend-application-contribution'; + +const TIMER_WARNING_THRESHOLD = 100; + +@injectable() +export class FrontendApplication { + + @inject(CorePreferences) + protected readonly corePreferences: CorePreferences; + + @inject(WindowService) + protected readonly windowsService: WindowService; + + @inject(TooltipService) + protected readonly tooltipService: TooltipService; + + @inject(Stopwatch) + protected readonly stopwatch: Stopwatch; + + @inject(BackendStopwatch) + protected readonly backendStopwatch: BackendStopwatch; + + constructor( + @inject(CommandRegistry) protected readonly commands: CommandRegistry, + @inject(MenuModelRegistry) protected readonly menus: MenuModelRegistry, + @inject(KeybindingRegistry) protected readonly keybindings: KeybindingRegistry, + @inject(ShellLayoutRestorer) protected readonly layoutRestorer: ShellLayoutRestorer, + @inject(ContributionProvider) @named(FrontendApplicationContribution) + protected readonly contributions: ContributionProvider, + @inject(ApplicationShell) protected readonly _shell: ApplicationShell, + @inject(FrontendApplicationStateService) protected readonly stateService: FrontendApplicationStateService + ) { } + + get shell(): ApplicationShell { + return this._shell; + } + + /** + * Start the frontend application. + * + * Start up consists of the following steps: + * - start frontend contributions + * - attach the application shell to the host element + * - initialize the application shell layout + * - reveal the application shell if it was hidden by a startup indicator + */ + async start(): Promise { + const startup = this.backendStopwatch.start('frontend'); + + await this.measure('startContributions', () => this.startContributions(), 'Start frontend contributions', false); + this.stateService.state = 'started_contributions'; + + const host = await this.getHost(); + this.attachShell(host); + this.attachTooltip(host); + await animationFrame(); + this.stateService.state = 'attached_shell'; + + await this.measure('initializeLayout', () => this.initializeLayout(), 'Initialize the workbench layout', false); + this.stateService.state = 'initialized_layout'; + await this.fireOnDidInitializeLayout(); + + await this.measure('revealShell', () => this.revealShell(host), 'Replace loading indicator with ready workbench UI (animation)', false); + this.registerEventListeners(); + this.stateService.state = 'ready'; + + startup.then(idToken => this.backendStopwatch.stop(idToken, 'Frontend application start', [])); + } + + /** + * Return a promise to the host element to which the application shell is attached. + */ + protected getHost(): Promise { + if (document.body) { + return Promise.resolve(document.body); + } + return new Promise(resolve => + window.addEventListener('load', () => resolve(document.body), { once: true }) + ); + } + + /** + * Return an HTML element that indicates the startup phase, e.g. with an animation or a splash screen. + */ + protected getStartupIndicator(host: HTMLElement): HTMLElement | undefined { + const startupElements = host.getElementsByClassName('theia-preload'); + return startupElements.length === 0 ? undefined : startupElements[0] as HTMLElement; + } + + /** + * Register global event listeners. + */ + protected registerEventListeners(): void { + this.windowsService.onUnload(() => { + this.stateService.state = 'closing_window'; + this.layoutRestorer.storeLayout(this); + this.stopContributions(); + }); + window.addEventListener('resize', () => this.shell.update()); + + this.keybindings.registerEventListeners(window); + + document.addEventListener('touchmove', event => { event.preventDefault(); }, { passive: false }); + // Prevent forward/back navigation by scrolling in OS X + if (isOSX) { + document.body.addEventListener('wheel', preventNavigation, { passive: false }); + } + // Prevent the default browser behavior when dragging and dropping files into the window. + document.addEventListener('dragenter', event => { + if (event.dataTransfer) { + event.dataTransfer.dropEffect = 'none'; + } + event.preventDefault(); + }, false); + document.addEventListener('dragover', event => { + if (event.dataTransfer) { + event.dataTransfer.dropEffect = 'none'; + } event.preventDefault(); + }, false); + document.addEventListener('drop', event => { + event.preventDefault(); + }, false); + + } + + /** + * Attach the application shell to the host element. If a startup indicator is present, the shell is + * inserted before that indicator so it is not visible yet. + */ + protected attachShell(host: HTMLElement): void { + const ref = this.getStartupIndicator(host); + Widget.attach(this.shell, host, ref); + } + + /** + * Attach the tooltip container to the host element. + */ + protected attachTooltip(host: HTMLElement): void { + this.tooltipService.attachTo(host); + } + + /** + * If a startup indicator is present, it is first hidden with the `theia-hidden` CSS class and then + * removed after a while. The delay until removal is taken from the CSS transition duration. + */ + protected revealShell(host: HTMLElement): Promise { + const startupElem = this.getStartupIndicator(host); + if (startupElem) { + return new Promise(resolve => { + window.requestAnimationFrame(() => { + startupElem.classList.add('theia-hidden'); + const preloadStyle = window.getComputedStyle(startupElem); + const transitionDuration = parseCssTime(preloadStyle.transitionDuration, 0); + window.setTimeout(() => { + const parent = startupElem.parentElement; + if (parent) { + parent.removeChild(startupElem); + } + resolve(); + }, transitionDuration); + }); + }); + } else { + return Promise.resolve(); + } + } + + /** + * Initialize the shell layout either using the layout restorer service or, if no layout has + * been stored, by creating the default layout. + */ + protected async initializeLayout(): Promise { + if (!await this.restoreLayout()) { + // Fallback: Create the default shell layout + await this.createDefaultLayout(); + } + await this.shell.pendingUpdates; + } + + /** + * Try to restore the shell layout from the storage service. Resolves to `true` if successful. + */ + protected async restoreLayout(): Promise { + try { + return await this.layoutRestorer.restoreLayout(this); + } catch (error) { + if (ApplicationShellLayoutMigrationError.is(error)) { + console.warn(error.message); + console.info('Initializing the default layout instead...'); + } else { + console.error('Could not restore layout', error); + } + return false; + } + } + + /** + * Let the frontend application contributions initialize the shell layout. Override this + * method in order to create an application-specific custom layout. + */ + protected async createDefaultLayout(): Promise { + for (const contribution of this.contributions.getContributions()) { + if (contribution.initializeLayout) { + await this.measure(contribution.constructor.name + '.initializeLayout', + () => contribution.initializeLayout!(this) + ); + } + } + } + + protected async fireOnDidInitializeLayout(): Promise { + for (const contribution of this.contributions.getContributions()) { + if (contribution.onDidInitializeLayout) { + await this.measure(contribution.constructor.name + '.onDidInitializeLayout', + () => contribution.onDidInitializeLayout!(this) + ); + } + } + } + + /** + * Initialize and start the frontend application contributions. + */ + protected async startContributions(): Promise { + for (const contribution of this.contributions.getContributions()) { + if (contribution.initialize) { + try { + await this.measure(contribution.constructor.name + '.initialize', + () => contribution.initialize!() + ); + } catch (error) { + console.error('Could not initialize contribution', error); + } + } + } + + for (const contribution of this.contributions.getContributions()) { + if (contribution.configure) { + try { + await this.measure(contribution.constructor.name + '.configure', + () => contribution.configure!(this) + ); + } catch (error) { + console.error('Could not configure contribution', error); + } + } + } + + /** + * FIXME: + * - decouple commands & menus + * - consider treat commands, keybindings and menus as frontend application contributions + */ + await this.measure('commands.onStart', + () => this.commands.onStart() + ); + await this.measure('keybindings.onStart', + () => this.keybindings.onStart() + ); + await this.measure('menus.onStart', + () => this.menus.onStart() + ); + for (const contribution of this.contributions.getContributions()) { + if (contribution.onStart) { + try { + await this.measure(contribution.constructor.name + '.onStart', + () => contribution.onStart!(this) + ); + } catch (error) { + console.error('Could not start contribution', error); + } + } + } + } + + /** + * Stop the frontend application contributions. This is called when the window is unloaded. + */ + protected stopContributions(): void { + console.info('>>> Stopping frontend contributions...'); + for (const contribution of this.contributions.getContributions()) { + if (contribution.onStop) { + try { + contribution.onStop(this); + } catch (error) { + console.error('Could not stop contribution', error); + } + } + } + console.info('<<< All frontend contributions have been stopped.'); + } + + protected async measure(name: string, fn: () => MaybePromise, message = `Frontend ${name}`, threshold = true): Promise { + return this.stopwatch.startAsync(name, message, fn, + threshold ? { thresholdMillis: TIMER_WARNING_THRESHOLD, defaultLogLevel: LogLevel.DEBUG } : {}); + } + +} diff --git a/packages/core/src/browser/hover-service.ts b/packages/core/src/browser/hover-service.ts new file mode 100644 index 0000000..03b62cc --- /dev/null +++ b/packages/core/src/browser/hover-service.ts @@ -0,0 +1,280 @@ +// ***************************************************************************** +// Copyright (C) 2022 Ericsson and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { inject, injectable } from 'inversify'; +import { Disposable, DisposableCollection, disposableTimeout, isOSX, PreferenceService } from '../common'; +import { MarkdownString } from '../common/markdown-rendering/markdown-string'; +import { animationFrame } from './browser'; +import { MarkdownRenderer, MarkdownRendererFactory } from './markdown-rendering/markdown-renderer'; + +import '../../src/browser/style/hover-service.css'; + +export type HoverPosition = 'left' | 'right' | 'top' | 'bottom'; + +// Threshold, in milliseconds, over which a mouse movement is not considered +// quick enough as to be ignored +const quickMouseThresholdMillis = 200; + +export namespace HoverPosition { + export function invertIfNecessary(position: HoverPosition, target: DOMRect, host: DOMRect, totalWidth: number, totalHeight: number): HoverPosition { + if (position === 'left') { + if (target.left - host.width - 5 < 0) { + return 'right'; + } + } else if (position === 'right') { + if (target.right + host.width + 5 > totalWidth) { + return 'left'; + } + } else if (position === 'top') { + if (target.top - host.height - 5 < 0) { + return 'bottom'; + } + } else if (position === 'bottom') { + if (target.bottom + host.height + 5 > totalHeight) { + return 'top'; + } + } + return position; + } +} + +export interface HoverRequest { + content: string | MarkdownString | HTMLElement + target: HTMLElement + /** + * The position where the hover should appear. + * Note that the hover service will try to invert the position (i.e. right -> left) + * if the specified content does not fit in the window next to the target element + */ + position: HoverPosition + /** + * Additional css classes that should be added to the hover box. + * Used to style certain boxes different e.g. for the extended tab preview. + */ + cssClasses?: string[] + /** + * A function to render a visual preview on the hover. + * Function that takes the desired width and returns a HTMLElement to be rendered. + */ + visualPreview?: (width: number) => HTMLElement | undefined; + /** + * Indicates if the hover contains interactive/clickable items. + * When true, the hover will register a click handler to allow interaction with elements in the hover area. + */ + interactive?: boolean; + /** + * If implemented, this method will be called when the hover is no longer shown or no longer scheduled to be shown. + */ + onHide?(): void; + /** + * When true, the hover will be shown immediately without any delay. + * Useful for explicitly triggered hovers (e.g., on click) where the user expects instant feedback. + * @default false + */ + skipHoverDelay?: boolean; +} + +@injectable() +export class HoverService { + protected static hostClassName = 'theia-hover'; + protected static styleSheetId = 'theia-hover-style'; + @inject(PreferenceService) protected readonly preferences: PreferenceService; + @inject(MarkdownRendererFactory) protected readonly markdownRendererFactory: MarkdownRendererFactory; + + protected _markdownRenderer: MarkdownRenderer | undefined; + protected get markdownRenderer(): MarkdownRenderer { + this._markdownRenderer ||= this.markdownRendererFactory(); + return this._markdownRenderer; + } + + protected _hoverHost: HTMLElement | undefined; + protected get hoverHost(): HTMLElement { + if (!this._hoverHost) { + this._hoverHost = document.createElement('div'); + this._hoverHost.classList.add(HoverService.hostClassName); + this._hoverHost.style.position = 'absolute'; + this._hoverHost.setAttribute('popover', 'hint'); + } + return this._hoverHost; + } + protected pendingTimeout: Disposable | undefined; + protected hoverTarget: HTMLElement | undefined; + protected lastHidHover = Date.now(); + protected readonly disposeOnHide = new DisposableCollection(); + + requestHover(request: HoverRequest): void { + this.cancelHover(); + const delay = request.skipHoverDelay ? 0 : this.getHoverDelay(); + this.pendingTimeout = disposableTimeout(() => this.renderHover(request), delay); + this.hoverTarget = request.target; + this.listenForMouseOut(); + this.listenForMouseClick(request); + } + + protected getHoverDelay(): number { + return Date.now() - this.lastHidHover < quickMouseThresholdMillis + ? 0 + : this.preferences.get('workbench.hover.delay', isOSX ? 1500 : 500); + } + + protected async renderHover(request: HoverRequest): Promise { + const host = this.hoverHost; + let firstChild: HTMLElement | undefined; + const { target, content, position, cssClasses, interactive, onHide } = request; + if (onHide) { + this.disposeOnHide.push({ dispose: onHide.bind(request) }); + } + if (cssClasses) { + host.classList.add(...cssClasses); + } + if (content instanceof HTMLElement) { + host.appendChild(content); + firstChild = content; + } else if (typeof content === 'string') { + host.textContent = content; + } else { + const renderedContent = this.markdownRenderer.render(content); + this.disposeOnHide.push(renderedContent); + host.appendChild(renderedContent.element); + firstChild = renderedContent.element; + } + // browsers might insert linebreaks when the hover appears at the edge of the window + // resetting the position prevents that + host.style.left = '0px'; + host.style.top = '0px'; + document.body.append(host); + if (!host.matches(':popover-open')) { + host.showPopover(); + } + + if (interactive) { + // Add a click handler to the hover host to ensure clicks within the hover area work properly + const clickHandler = (e: MouseEvent) => { + // Let click events within the hover area be processed by their handlers + // but prevent them from triggering document handlers that might dismiss the tooltip + e.stopImmediatePropagation(); + }; + host.addEventListener('click', clickHandler); + this.disposeOnHide.push({ dispose: () => host.removeEventListener('click', clickHandler) }); + } + + if (request.visualPreview) { + // If just a string is being rendered use the size of the outer box + const width = firstChild ? firstChild.offsetWidth : this.hoverHost.offsetWidth; + const visualPreview = request.visualPreview(width); + if (visualPreview) { + host.appendChild(visualPreview); + } + } + + await animationFrame(); // Allow the browser to size the host + const updatedPosition = this.setHostPosition(target, host, position); + + this.disposeOnHide.push({ + dispose: () => { + this.lastHidHover = Date.now(); + host.classList.remove(updatedPosition); + if (cssClasses) { + host.classList.remove(...cssClasses); + } + } + }); + } + + protected setHostPosition(target: HTMLElement, host: HTMLElement, position: HoverPosition): HoverPosition { + const targetDimensions = target.getBoundingClientRect(); + const hostDimensions = host.getBoundingClientRect(); + const documentWidth = document.body.getBoundingClientRect().width; + // document.body.getBoundingClientRect().height doesn't work as expected + // scrollHeight will always be accurate here: https://stackoverflow.com/a/44077777 + const documentHeight = document.documentElement.scrollHeight; + position = HoverPosition.invertIfNecessary(position, targetDimensions, hostDimensions, documentWidth, documentHeight); + if (position === 'top' || position === 'bottom') { + const targetMiddleWidth = targetDimensions.left + (targetDimensions.width / 2); + const middleAlignment = targetMiddleWidth - (hostDimensions.width / 2); + const furthestRight = Math.min(documentWidth - hostDimensions.width, middleAlignment); + const left = Math.max(0, furthestRight); + const top = position === 'top' + ? targetDimensions.top - hostDimensions.height - 5 + : targetDimensions.bottom + 5; + host.style.setProperty('--theia-hover-before-position', `${targetMiddleWidth - left - 5}px`); + host.style.top = `${top}px`; + host.style.left = `${left}px`; + } else { + const targetMiddleHeight = targetDimensions.top + (targetDimensions.height / 2); + const middleAlignment = targetMiddleHeight - (hostDimensions.height / 2); + const furthestTop = Math.min(documentHeight - hostDimensions.height, middleAlignment); + const top = Math.max(0, furthestTop); + const left = position === 'left' + ? targetDimensions.left - hostDimensions.width - 5 + : targetDimensions.right + 5; + host.style.setProperty('--theia-hover-before-position', `${targetMiddleHeight - top - 5}px`); + host.style.left = `${left}px`; + host.style.top = `${top}px`; + } + host.classList.add(position); + return position; + } + + protected listenForMouseOut(): void { + const handleMouseLeave = (e: MouseEvent) => { + this.disposeOnHide.push(disposableTimeout(() => { + if (!this.hoverHost.matches(':hover') && !this.hoverTarget?.matches(':hover')) { + this.cancelHover(); + } + }, quickMouseThresholdMillis)); + }; + this.hoverTarget?.addEventListener('mouseout', handleMouseLeave); + this.hoverHost.addEventListener('mouseout', handleMouseLeave); + this.disposeOnHide.push({ + dispose: () => { + this.hoverTarget?.removeEventListener('mouseout', handleMouseLeave); + this.hoverHost.removeEventListener('mouseout', handleMouseLeave); + } + }); + } + + cancelHover(): void { + this.pendingTimeout?.dispose(); + this.unRenderHover(); + this.disposeOnHide.dispose(); + this.hoverTarget = undefined; + } + + /** + * Listen for mouse click (mousedown) events and handle them based on hover interactivity. + * For non-interactive hovers, any mousedown cancels the hover immediately. + * For interactive hovers, the hover remains visible to allow interaction with its elements. + */ + protected listenForMouseClick(request: HoverRequest): void { + const handleMouseDown = (_e: MouseEvent) => { + const isInteractive = request.interactive; + if (!isInteractive) { + this.cancelHover(); + } + }; + document.addEventListener('mousedown', handleMouseDown, true); + this.disposeOnHide.push({ dispose: () => document.removeEventListener('mousedown', handleMouseDown, true) }); + } + + protected unRenderHover(): void { + if (this.hoverHost.matches(':popover-open')) { + this.hoverHost.hidePopover(); + } + this.hoverHost.remove(); + this.hoverHost.replaceChildren(); + } +} diff --git a/packages/core/src/browser/http-open-handler.ts b/packages/core/src/browser/http-open-handler.ts new file mode 100644 index 0000000..d8f467a --- /dev/null +++ b/packages/core/src/browser/http-open-handler.ts @@ -0,0 +1,49 @@ +// ***************************************************************************** +// Copyright (C) 2018 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { injectable, inject } from 'inversify'; +import URI from '../common/uri'; +import { OpenHandler } from './opener-service'; +import { WindowService } from './window/window-service'; +import { ExternalUriService } from './external-uri-service'; + +export interface HttpOpenHandlerOptions { + openExternal?: boolean +} + +@injectable() +export class HttpOpenHandler implements OpenHandler { + + static readonly PRIORITY: number = 500; + + readonly id = 'http'; + + @inject(WindowService) + protected readonly windowService: WindowService; + + @inject(ExternalUriService) + protected readonly externalUriService: ExternalUriService; + + canHandle(uri: URI, options?: HttpOpenHandlerOptions): number { + return ((options && options.openExternal) || uri.scheme.startsWith('http') || uri.scheme.startsWith('mailto')) ? HttpOpenHandler.PRIORITY : 0; + } + + async open(uri: URI): Promise { + const resolvedUri = await this.externalUriService.resolve(uri); + return this.windowService.openNewWindow(resolvedUri.toString(true), { external: true }); + } + +} diff --git a/packages/core/src/browser/i18n/i18n-frontend-module.ts b/packages/core/src/browser/i18n/i18n-frontend-module.ts new file mode 100644 index 0000000..a89d00c --- /dev/null +++ b/packages/core/src/browser/i18n/i18n-frontend-module.ts @@ -0,0 +1,27 @@ +// ***************************************************************************** +// Copyright (C) 2021 Ericsson and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { ContainerModule } from 'inversify'; +import { AsyncLocalizationProvider, localizationPath } from '../../common/i18n/localization'; +import { WebSocketConnectionProvider } from '../messaging/ws-connection-provider'; +import { LanguageQuickPickService } from './language-quick-pick-service'; + +export default new ContainerModule(bind => { + bind(AsyncLocalizationProvider).toDynamicValue( + ctx => ctx.container.get(WebSocketConnectionProvider).createProxy(localizationPath) + ).inSingletonScope(); + bind(LanguageQuickPickService).toSelf().inSingletonScope(); +}); diff --git a/packages/core/src/browser/i18n/language-quick-pick-service.ts b/packages/core/src/browser/i18n/language-quick-pick-service.ts new file mode 100644 index 0000000..d0b2fc9 --- /dev/null +++ b/packages/core/src/browser/i18n/language-quick-pick-service.ts @@ -0,0 +1,130 @@ +// ***************************************************************************** +// Copyright (C) 2022 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { inject, injectable } from 'inversify'; +import { nls } from '../../common/nls'; +import { AsyncLocalizationProvider, LanguageInfo } from '../../common/i18n/localization'; +import { QuickInputService, QuickPickItem, QuickPickSeparator } from '../quick-input'; +import { WindowService } from '../window/window-service'; + +export interface LanguageQuickPickItem extends QuickPickItem, LanguageInfo { + execute?(): Promise +} + +@injectable() +export class LanguageQuickPickService { + + @inject(QuickInputService) protected readonly quickInputService: QuickInputService; + @inject(AsyncLocalizationProvider) protected readonly localizationProvider: AsyncLocalizationProvider; + @inject(WindowService) protected readonly windowService: WindowService; + + async pickDisplayLanguage(): Promise { + const quickInput = this.quickInputService.createQuickPick(); + const installedItems = await this.getInstalledLanguages(); + const quickInputItems: (LanguageQuickPickItem | QuickPickSeparator)[] = [ + { + type: 'separator', + label: nls.localizeByDefault('Installed') + }, + ...installedItems + ]; + quickInput.items = quickInputItems; + quickInput.busy = true; + const selected = installedItems.find(item => nls.isSelectedLocale(item.languageId)); + if (selected) { + quickInput.activeItems = [selected]; + } + quickInput.placeholder = nls.localizeByDefault('Configure Display Language'); + quickInput.show(); + + this.getAvailableLanguages().then(availableItems => { + if (availableItems.length > 0) { + quickInputItems.push({ + type: 'separator', + label: nls.localizeByDefault('Available') + }); + const installed = new Set(installedItems.map(e => e.languageId)); + for (const available of availableItems) { + // Exclude already installed languages + if (!installed.has(available.languageId)) { + quickInputItems.push(available); + } + } + quickInput.items = quickInputItems; + } + }).finally(() => { + quickInput.busy = false; + }); + + return new Promise(resolve => { + quickInput.onDidAccept(async () => { + const selectedItem = quickInput.selectedItems[0]; + if (selectedItem) { + // Some language quick pick items want to install additional languages + // We have to await that before returning the selected locale + await selectedItem.execute?.(); + resolve(selectedItem); + } else { + resolve(undefined); + } + quickInput.hide(); + }); + quickInput.onDidHide(() => { + resolve(undefined); + }); + }); + } + + protected async getInstalledLanguages(): Promise { + const languageInfos = await this.localizationProvider.getAvailableLanguages(); + const items: LanguageQuickPickItem[] = []; + const en: LanguageInfo = { + languageId: 'en', + languageName: 'English', + localizedLanguageName: 'English' + }; + languageInfos.push(en); + for (const language of languageInfos.filter(e => !!e.languageId)) { + items.push(this.createLanguageQuickPickItem(language)); + } + return items; + } + + protected async getAvailableLanguages(): Promise { + return []; + } + + protected createLanguageQuickPickItem(language: LanguageInfo): LanguageQuickPickItem { + let label: string; + let description: string | undefined; + const languageName = language.localizedLanguageName || language.languageName; + const id = language.languageId; + const idLabel = id + (nls.isSelectedLocale(id) ? ` (${nls.localizeByDefault('Current')})` : ''); + if (languageName) { + label = languageName; + description = idLabel; + } else { + label = idLabel; + } + return { + label, + description, + languageId: id, + languageName: language.languageName, + localizedLanguageName: language.localizedLanguageName + }; + } +} diff --git a/packages/core/src/browser/icon-registry.ts b/packages/core/src/browser/icon-registry.ts new file mode 100644 index 0000000..f41728d --- /dev/null +++ b/packages/core/src/browser/icon-registry.ts @@ -0,0 +1,87 @@ +// ***************************************************************************** +// Copyright (C) 2023 Ericsson and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +// code copied and modified from https://github.com/Microsoft/vscode/blob/main/src/vs/platform/theme/common/iconRegistry.ts + +import { ThemeIcon } from '../common/theme'; +import { URI } from 'vscode-uri'; + +export interface IconDefinition { + font?: IconFontContribution; + fontCharacter: string; +} + +export interface IconContribution { + readonly id: string; + description: string | undefined; + deprecationMessage?: string; + readonly defaults: ThemeIcon | IconDefinition; +} + +export interface IconFontContribution { + readonly id: string; + readonly definition: IconFontDefinition; +} + +export interface IconFontDefinition { + readonly weight?: string; + readonly style?: string; + readonly src: IconFontSource[]; +} + +export interface IconFontSource { + readonly location: URI; + readonly format: string; +} +export const IconRegistry = Symbol('IconRegistry'); +export interface IconRegistry { + /** + * Register a icon to the registry. + * @param id The icon id + * @param defaults The default values + * @param description The description + */ + registerIcon(id: string, defaults: ThemeIcon | IconDefinition, description?: string): ThemeIcon; + + /** + * Deregister a icon from the registry. + * @param id The icon id + */ + deregisterIcon(id: string): void; + + /** + * Register a icon font to the registry. + * @param id The icon font id + * @param definition The icon font definition + */ + registerIconFont(id: string, definition: IconFontDefinition): IconFontDefinition; + + /** + * Deregister an icon font from the registry. + * @param id The icon font id + */ + deregisterIconFont(id: string): void; + + /** + * Get the icon font for the given id + * @param id The icon font id + */ + getIconFont(id: string): IconFontDefinition | undefined; +} + diff --git a/packages/core/src/browser/icon-theme-contribution.ts b/packages/core/src/browser/icon-theme-contribution.ts new file mode 100644 index 0000000..f4b27a4 --- /dev/null +++ b/packages/core/src/browser/icon-theme-contribution.ts @@ -0,0 +1,64 @@ +// ***************************************************************************** +// Copyright (C) 2019 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { injectable, inject, named } from 'inversify'; +import { FrontendApplicationContribution } from './frontend-application-contribution'; +import { ContributionProvider } from '../common/contribution-provider'; +import { IconThemeService, IconTheme } from './icon-theme-service'; +import { MaybePromise } from '../common/types'; +import { Disposable } from '../common/disposable'; + +export const IconThemeContribution = Symbol('IconThemeContribution'); +export interface IconThemeContribution { + registerIconThemes(iconThemes: IconThemeService): MaybePromise; +} + +@injectable() +export class IconThemeApplicationContribution implements FrontendApplicationContribution { + + @inject(IconThemeService) + protected readonly iconThemes: IconThemeService; + + @inject(ContributionProvider) @named(IconThemeContribution) + protected readonly iconThemeContributions: ContributionProvider; + + async onStart(): Promise { + for (const contribution of this.iconThemeContributions.getContributions()) { + await contribution.registerIconThemes(this.iconThemes); + } + } + +} + +@injectable() +export class DefaultFileIconThemeContribution implements IconTheme, IconThemeContribution { + + readonly id = 'theia-file-icons'; + readonly label = 'File Icons (Theia)'; + readonly hasFileIcons = true; + readonly hasFolderIcons = true; + readonly showLanguageModeIcons = true; + + registerIconThemes(iconThemes: IconThemeService): MaybePromise { + iconThemes.register(this); + } + + /* rely on behaviour before for backward-compatibility */ + activate(): Disposable { + return Disposable.NULL; + } + +} diff --git a/packages/core/src/browser/icon-theme-service.ts b/packages/core/src/browser/icon-theme-service.ts new file mode 100644 index 0000000..7e3ffc6 --- /dev/null +++ b/packages/core/src/browser/icon-theme-service.ts @@ -0,0 +1,218 @@ +// ***************************************************************************** +// Copyright (C) 2019 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { injectable, inject, postConstruct } from 'inversify'; +import { Emitter } from '../common/event'; +import { Disposable, DisposableCollection } from '../common/disposable'; +import { LabelProviderContribution, DidChangeLabelEvent } from './label-provider'; +import { FrontendApplicationConfigProvider } from './frontend-application-config-provider'; +import debounce = require('lodash.debounce'); +import { PreferenceSchemaService } from '../common/preferences/preference-schema'; +import { PreferenceService } from '../common/preferences'; + +const ICON_THEME_PREFERENCE_KEY = 'workbench.iconTheme'; + +export interface IconThemeDefinition { + readonly id: string + readonly label: string + readonly description?: string + readonly hasFileIcons?: boolean; + readonly hasFolderIcons?: boolean; + readonly hidesExplorerArrows?: boolean; + readonly showLanguageModeIcons?: boolean; +} + +export interface IconTheme extends IconThemeDefinition { + activate(): Disposable; +} + +@injectable() +export class NoneIconTheme implements IconTheme, LabelProviderContribution { + + readonly id = 'none'; + readonly label = 'None'; + readonly description = 'Disable file icons'; + readonly hasFileIcons = true; + readonly hasFolderIcons = true; + + protected readonly onDidChangeEmitter = new Emitter(); + readonly onDidChange = this.onDidChangeEmitter.event; + + protected readonly toDeactivate = new DisposableCollection(); + + activate(): Disposable { + if (this.toDeactivate.disposed) { + this.toDeactivate.push(Disposable.create(() => this.fireDidChange())); + this.fireDidChange(); + } + return this.toDeactivate; + } + + protected fireDidChange(): void { + this.onDidChangeEmitter.fire({ affects: () => true }); + } + + canHandle(): number { + if (this.toDeactivate.disposed) { + return 0; + } + return Number.MAX_SAFE_INTEGER - 1024; + } + + getIcon(): string { + return ''; + } + +} + +@injectable() +export class IconThemeService { + static readonly STORAGE_KEY = 'iconTheme'; + + protected readonly onDidChangeEmitter = new Emitter(); + readonly onDidChange = this.onDidChangeEmitter.event; + + protected readonly _iconThemes = new Map(); + get ids(): IterableIterator { + return this._iconThemes.keys(); + } + get definitions(): IterableIterator { + return this._iconThemes.values(); + } + getDefinition(id: string): IconThemeDefinition | undefined { + return this._iconThemes.get(id); + } + + @inject(NoneIconTheme) protected readonly noneIconTheme: NoneIconTheme; + @inject(PreferenceService) protected readonly preferences: PreferenceService; + @inject(PreferenceSchemaService) protected readonly schemaProvider: PreferenceSchemaService; + + protected readonly onDidChangeCurrentEmitter = new Emitter(); + readonly onDidChangeCurrent = this.onDidChangeCurrentEmitter.event; + + protected readonly toDeactivate = new DisposableCollection(); + + protected activeTheme: IconTheme; + + @postConstruct() + protected init(): void { + this.register(this.fallback); + this.setCurrent(this.fallback, false); + this.preferences.ready.then(() => { + this.validateActiveTheme(); + this.updateIconThemePreference(); + this.preferences.onPreferencesChanged(changes => { + if (ICON_THEME_PREFERENCE_KEY in changes) { + this.validateActiveTheme(); + } + }); + }); + } + + register(iconTheme: IconTheme): Disposable { + if (this._iconThemes.has(iconTheme.id)) { + console.warn(new Error(`Icon theme '${iconTheme.id}' has already been registered, skipping.`)); + return Disposable.NULL; + } + this._iconThemes.set(iconTheme.id, iconTheme); + this.onDidChangeEmitter.fire(undefined); + this.validateActiveTheme(); + this.updateIconThemePreference(); + return Disposable.create(() => { + this.unregister(iconTheme.id); + this.updateIconThemePreference(); + }); + } + + unregister(id: string): IconTheme | undefined { + const iconTheme = this._iconThemes.get(id); + if (!iconTheme) { + return undefined; + } + this._iconThemes.delete(id); + this.onDidChangeEmitter.fire(undefined); + if (id === this.getCurrent().id) { + this.setCurrent(this.default, false); + } + return iconTheme; + } + + get current(): string { + return this.getCurrent().id; + } + + set current(id: string) { + const newCurrent = this._iconThemes.get(id); + if (newCurrent && this.getCurrent().id !== newCurrent.id) { + this.setCurrent(newCurrent); + } + } + + getCurrent(): IconTheme { + return this.activeTheme; + } + + /** + * @param persistSetting If `true`, the theme's id will be set as the value of the `workbench.iconTheme` preference. (default: `true`) + */ + setCurrent(newCurrent: IconTheme, persistSetting = true): void { + if (newCurrent !== this.getCurrent()) { + this.activeTheme = newCurrent; + this.toDeactivate.dispose(); + this.toDeactivate.push(newCurrent.activate()); + this.onDidChangeCurrentEmitter.fire(newCurrent.id); + } + if (persistSetting) { + this.preferences.updateValue(ICON_THEME_PREFERENCE_KEY, newCurrent.id); + } + } + + protected getConfiguredTheme(): IconTheme | undefined { + const configuredId = this.preferences.get(ICON_THEME_PREFERENCE_KEY); + return configuredId ? this._iconThemes.get(configuredId) : undefined; + } + + protected validateActiveTheme(): void { + if (this.preferences.isReady) { + const configured = this.getConfiguredTheme(); + if (configured && configured !== this.getCurrent()) { + this.setCurrent(configured, false); + } + } + } + + protected updateIconThemePreference = debounce(() => this.doUpdateIconThemePreference(), 500); + + protected doUpdateIconThemePreference(): void { + const preference = this.schemaProvider.getSchemaProperty(ICON_THEME_PREFERENCE_KEY); + if (preference) { + const sortedThemes = Array.from(this.definitions).sort((a, b) => a.label.localeCompare(b.label)); + this.schemaProvider.updateSchemaProperty(ICON_THEME_PREFERENCE_KEY, { + ...preference, + enum: sortedThemes.map(e => e.id), + enumItemLabels: sortedThemes.map(e => e.label) + }); + } + } + + get default(): IconTheme { + return this._iconThemes.get(FrontendApplicationConfigProvider.get().defaultIconTheme) || this.fallback; + } + + get fallback(): IconTheme { + return this.noneIconTheme; + } +} diff --git a/packages/core/src/browser/icons/CollapseAll.svg b/packages/core/src/browser/icons/CollapseAll.svg new file mode 100644 index 0000000..f44a3b0 --- /dev/null +++ b/packages/core/src/browser/icons/CollapseAll.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/packages/core/src/browser/icons/CollapseAll_inverse.svg b/packages/core/src/browser/icons/CollapseAll_inverse.svg new file mode 100644 index 0000000..0d65cd8 --- /dev/null +++ b/packages/core/src/browser/icons/CollapseAll_inverse.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/packages/core/src/browser/icons/Refresh.svg b/packages/core/src/browser/icons/Refresh.svg new file mode 100644 index 0000000..82ac740 --- /dev/null +++ b/packages/core/src/browser/icons/Refresh.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/packages/core/src/browser/icons/Refresh_inverse.svg b/packages/core/src/browser/icons/Refresh_inverse.svg new file mode 100644 index 0000000..b0f180c --- /dev/null +++ b/packages/core/src/browser/icons/Refresh_inverse.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/packages/core/src/browser/icons/add-inverse.svg b/packages/core/src/browser/icons/add-inverse.svg new file mode 100644 index 0000000..16b2e28 --- /dev/null +++ b/packages/core/src/browser/icons/add-inverse.svg @@ -0,0 +1,4 @@ + + + +add diff --git a/packages/core/src/browser/icons/add.svg b/packages/core/src/browser/icons/add.svg new file mode 100644 index 0000000..d6ea404 --- /dev/null +++ b/packages/core/src/browser/icons/add.svg @@ -0,0 +1,4 @@ + + + +add diff --git a/packages/core/src/browser/icons/arrow-down-bright.svg b/packages/core/src/browser/icons/arrow-down-bright.svg new file mode 100644 index 0000000..d11046a --- /dev/null +++ b/packages/core/src/browser/icons/arrow-down-bright.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/packages/core/src/browser/icons/arrow-down-dark.svg b/packages/core/src/browser/icons/arrow-down-dark.svg new file mode 100644 index 0000000..06664fe --- /dev/null +++ b/packages/core/src/browser/icons/arrow-down-dark.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/packages/core/src/browser/icons/arrow-up-bright.svg b/packages/core/src/browser/icons/arrow-up-bright.svg new file mode 100644 index 0000000..1e18d22 --- /dev/null +++ b/packages/core/src/browser/icons/arrow-up-bright.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/packages/core/src/browser/icons/arrow-up-dark.svg b/packages/core/src/browser/icons/arrow-up-dark.svg new file mode 100644 index 0000000..4ff17a0 --- /dev/null +++ b/packages/core/src/browser/icons/arrow-up-dark.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/packages/core/src/browser/icons/case-sensitive-dark.svg b/packages/core/src/browser/icons/case-sensitive-dark.svg new file mode 100644 index 0000000..f4b6fcd --- /dev/null +++ b/packages/core/src/browser/icons/case-sensitive-dark.svg @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + diff --git a/packages/core/src/browser/icons/case-sensitive.svg b/packages/core/src/browser/icons/case-sensitive.svg new file mode 100644 index 0000000..94f9b32 --- /dev/null +++ b/packages/core/src/browser/icons/case-sensitive.svg @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + diff --git a/packages/core/src/browser/icons/chevron-right-dark.svg b/packages/core/src/browser/icons/chevron-right-dark.svg new file mode 100644 index 0000000..6ebaaf4 --- /dev/null +++ b/packages/core/src/browser/icons/chevron-right-dark.svg @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/packages/core/src/browser/icons/chevron-right-light.svg b/packages/core/src/browser/icons/chevron-right-light.svg new file mode 100644 index 0000000..5382fac --- /dev/null +++ b/packages/core/src/browser/icons/chevron-right-light.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/packages/core/src/browser/icons/circle-bright.svg b/packages/core/src/browser/icons/circle-bright.svg new file mode 100644 index 0000000..744b681 --- /dev/null +++ b/packages/core/src/browser/icons/circle-bright.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/packages/core/src/browser/icons/circle-dark.svg b/packages/core/src/browser/icons/circle-dark.svg new file mode 100644 index 0000000..377c05c --- /dev/null +++ b/packages/core/src/browser/icons/circle-dark.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/packages/core/src/browser/icons/clear-search-results-dark.svg b/packages/core/src/browser/icons/clear-search-results-dark.svg new file mode 100644 index 0000000..4779775 --- /dev/null +++ b/packages/core/src/browser/icons/clear-search-results-dark.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/packages/core/src/browser/icons/clear-search-results.svg b/packages/core/src/browser/icons/clear-search-results.svg new file mode 100644 index 0000000..b71f645 --- /dev/null +++ b/packages/core/src/browser/icons/clear-search-results.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/packages/core/src/browser/icons/close-all-bright.svg b/packages/core/src/browser/icons/close-all-bright.svg new file mode 100644 index 0000000..20288a2 --- /dev/null +++ b/packages/core/src/browser/icons/close-all-bright.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/packages/core/src/browser/icons/close-all-dark.svg b/packages/core/src/browser/icons/close-all-dark.svg new file mode 100644 index 0000000..4c78725 --- /dev/null +++ b/packages/core/src/browser/icons/close-all-dark.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/packages/core/src/browser/icons/close-bright.svg b/packages/core/src/browser/icons/close-bright.svg new file mode 100644 index 0000000..6657c53 --- /dev/null +++ b/packages/core/src/browser/icons/close-bright.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/packages/core/src/browser/icons/close-dark.svg b/packages/core/src/browser/icons/close-dark.svg new file mode 100644 index 0000000..90a3269 --- /dev/null +++ b/packages/core/src/browser/icons/close-dark.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/packages/core/src/browser/icons/collapse.svg b/packages/core/src/browser/icons/collapse.svg new file mode 100644 index 0000000..ee67753 --- /dev/null +++ b/packages/core/src/browser/icons/collapse.svg @@ -0,0 +1,4 @@ + + + + diff --git a/packages/core/src/browser/icons/edit-json-dark.svg b/packages/core/src/browser/icons/edit-json-dark.svg new file mode 100644 index 0000000..d084284 --- /dev/null +++ b/packages/core/src/browser/icons/edit-json-dark.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/packages/core/src/browser/icons/edit-json.svg b/packages/core/src/browser/icons/edit-json.svg new file mode 100644 index 0000000..df6e5b1 --- /dev/null +++ b/packages/core/src/browser/icons/edit-json.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/packages/core/src/browser/icons/expand.svg b/packages/core/src/browser/icons/expand.svg new file mode 100644 index 0000000..702292d --- /dev/null +++ b/packages/core/src/browser/icons/expand.svg @@ -0,0 +1,4 @@ + + + + diff --git a/packages/core/src/browser/icons/loading-dark.svg b/packages/core/src/browser/icons/loading-dark.svg new file mode 100644 index 0000000..d886fd0 --- /dev/null +++ b/packages/core/src/browser/icons/loading-dark.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/packages/core/src/browser/icons/loading-light.svg b/packages/core/src/browser/icons/loading-light.svg new file mode 100644 index 0000000..d46f258 --- /dev/null +++ b/packages/core/src/browser/icons/loading-light.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/packages/core/src/browser/icons/open-change-bright.svg b/packages/core/src/browser/icons/open-change-bright.svg new file mode 100644 index 0000000..8c2b0f8 --- /dev/null +++ b/packages/core/src/browser/icons/open-change-bright.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/packages/core/src/browser/icons/open-change-dark.svg b/packages/core/src/browser/icons/open-change-dark.svg new file mode 100644 index 0000000..4e655f0 --- /dev/null +++ b/packages/core/src/browser/icons/open-change-dark.svg @@ -0,0 +1,4 @@ + + + + diff --git a/packages/core/src/browser/icons/open-file-bright.svg b/packages/core/src/browser/icons/open-file-bright.svg new file mode 100644 index 0000000..4bb20e2 --- /dev/null +++ b/packages/core/src/browser/icons/open-file-bright.svg @@ -0,0 +1,4 @@ + + + + diff --git a/packages/core/src/browser/icons/open-file-dark.svg b/packages/core/src/browser/icons/open-file-dark.svg new file mode 100644 index 0000000..6bee93c --- /dev/null +++ b/packages/core/src/browser/icons/open-file-dark.svg @@ -0,0 +1,4 @@ + + + + diff --git a/packages/core/src/browser/icons/preview-bright.svg b/packages/core/src/browser/icons/preview-bright.svg new file mode 100644 index 0000000..d4282dc --- /dev/null +++ b/packages/core/src/browser/icons/preview-bright.svg @@ -0,0 +1,4 @@ + + + +PreviewInRightPanel_16x \ No newline at end of file diff --git a/packages/core/src/browser/icons/preview-dark.svg b/packages/core/src/browser/icons/preview-dark.svg new file mode 100644 index 0000000..f65df35 --- /dev/null +++ b/packages/core/src/browser/icons/preview-dark.svg @@ -0,0 +1,4 @@ + + + +PreviewInRightPanel_16x \ No newline at end of file diff --git a/packages/core/src/browser/icons/regex-dark.svg b/packages/core/src/browser/icons/regex-dark.svg new file mode 100644 index 0000000..5b0a7c7 --- /dev/null +++ b/packages/core/src/browser/icons/regex-dark.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/packages/core/src/browser/icons/regex.svg b/packages/core/src/browser/icons/regex.svg new file mode 100644 index 0000000..b83e696 --- /dev/null +++ b/packages/core/src/browser/icons/regex.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/packages/core/src/browser/icons/remove-all-inverse.svg b/packages/core/src/browser/icons/remove-all-inverse.svg new file mode 100644 index 0000000..628ebf5 --- /dev/null +++ b/packages/core/src/browser/icons/remove-all-inverse.svg @@ -0,0 +1,4 @@ + + + +remove-all diff --git a/packages/core/src/browser/icons/remove-all.svg b/packages/core/src/browser/icons/remove-all.svg new file mode 100644 index 0000000..b77d9a7 --- /dev/null +++ b/packages/core/src/browser/icons/remove-all.svg @@ -0,0 +1,4 @@ + + + +remove-all_16x diff --git a/packages/core/src/browser/icons/replace-all-inverse.svg b/packages/core/src/browser/icons/replace-all-inverse.svg new file mode 100644 index 0000000..cb1b7fc --- /dev/null +++ b/packages/core/src/browser/icons/replace-all-inverse.svg @@ -0,0 +1,13 @@ + + + + + + + + + + + diff --git a/packages/core/src/browser/icons/replace-all.svg b/packages/core/src/browser/icons/replace-all.svg new file mode 100644 index 0000000..edd6cc8 --- /dev/null +++ b/packages/core/src/browser/icons/replace-all.svg @@ -0,0 +1,13 @@ + + + + + + + + + + + diff --git a/packages/core/src/browser/icons/replace-inverse.svg b/packages/core/src/browser/icons/replace-inverse.svg new file mode 100644 index 0000000..ec99722 --- /dev/null +++ b/packages/core/src/browser/icons/replace-inverse.svg @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + diff --git a/packages/core/src/browser/icons/replace.svg b/packages/core/src/browser/icons/replace.svg new file mode 100644 index 0000000..82b26f2 --- /dev/null +++ b/packages/core/src/browser/icons/replace.svg @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + diff --git a/packages/core/src/browser/icons/spinner.gif b/packages/core/src/browser/icons/spinner.gif new file mode 100644 index 0000000..f72da4b Binary files /dev/null and b/packages/core/src/browser/icons/spinner.gif differ diff --git a/packages/core/src/browser/icons/whole-word-dark.svg b/packages/core/src/browser/icons/whole-word-dark.svg new file mode 100644 index 0000000..ae27a3e --- /dev/null +++ b/packages/core/src/browser/icons/whole-word-dark.svg @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + diff --git a/packages/core/src/browser/icons/whole-word.svg b/packages/core/src/browser/icons/whole-word.svg new file mode 100644 index 0000000..10878ec --- /dev/null +++ b/packages/core/src/browser/icons/whole-word.svg @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + diff --git a/packages/core/src/browser/index.ts b/packages/core/src/browser/index.ts new file mode 100644 index 0000000..2757003 --- /dev/null +++ b/packages/core/src/browser/index.ts @@ -0,0 +1,55 @@ +// ***************************************************************************** +// Copyright (C) 2017 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +export * from './shell'; +export * from './frontend-application'; +export * from './frontend-application-contribution'; +export * from './keyboard'; +export * from './opener-service'; +export * from './open-with-service'; +export * from './browser'; +export * from './context-menu-renderer'; +export * from './widgets'; +export * from './dialogs'; +export * from './tree'; +export * from './messaging'; +export * from './endpoint'; +export * from './common-frontend-contribution'; +export * from './common-menus'; +export * from './common-commands'; +export * from './quick-input'; +export * from './widget-manager'; +export * from './saveable'; +export * from './storage-service'; +export * from './preferences'; +export * from './keybinding'; +export * from './status-bar'; +export * from './label-provider'; +export * from './widget-open-handler'; +export * from './navigatable'; +export * from './diff-uris'; +export * from './view-container'; +export * from './breadcrumbs'; +export * from './tooltip-service'; +export * from './decoration-style'; +export * from './styling-service'; +export * from './hover-service'; +export * from './saveable-service'; +export * from './undo-redo-handler'; +export * from './widget-status-bar-service'; +export * from './badges'; +export * from './markdown-rendering/markdown-renderer'; +export * from './markdown-rendering/markdown'; diff --git a/packages/core/src/browser/json-schema-store.ts b/packages/core/src/browser/json-schema-store.ts new file mode 100644 index 0000000..be1a720 --- /dev/null +++ b/packages/core/src/browser/json-schema-store.ts @@ -0,0 +1,160 @@ +// ***************************************************************************** +// Copyright (C) 2018 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { injectable, inject, named } from 'inversify'; +import { ContributionProvider } from '../common/contribution-provider'; +import { FrontendApplicationContribution } from './frontend-application-contribution'; +import { Emitter, MaybePromise, URI } from '../common'; +import { timeout, Deferred } from '../common/promise-util'; +import { IJSONSchema } from '../common/json-schema'; + +export interface JsonSchemaConfiguration { + fileMatch: string | string[]; + url: string; +} + +export interface JsonSchemaRegisterContext { + registerSchema(config: JsonSchemaConfiguration): void; +} + +export const JsonSchemaContribution = Symbol('JsonSchemaContribution'); +export interface JsonSchemaContribution { + registerSchemas(store: JsonSchemaRegisterContext): MaybePromise +} + +@injectable() +export class JsonSchemaStore implements FrontendApplicationContribution { + + @inject(ContributionProvider) @named(JsonSchemaContribution) + protected readonly contributions: ContributionProvider; + + protected readonly _schemas = new Deferred(); + get schemas(): Promise { + return this._schemas.promise; + } + + onStart(): void { + const pendingRegistrations = []; + const schemas: JsonSchemaConfiguration[] = []; + const freeze = () => { + Object.freeze(schemas); + this._schemas.resolve(schemas); + }; + const registerTimeout = this.getRegisterTimeout(); + const frozenErrorCode = 'JsonSchemaRegisterContext.frozen'; + const context: JsonSchemaRegisterContext = { + registerSchema: schema => { + if (Object.isFrozen(schemas)) { + throw new Error(frozenErrorCode); + } + schemas.push(schema); + } + }; + for (const contribution of this.contributions.getContributions()) { + const result = contribution.registerSchemas(context); + if (result) { + pendingRegistrations.push(result.then(() => { }, e => { + if (e instanceof Error && e.message === frozenErrorCode) { + console.error(`${contribution.constructor.name}.registerSchemas is taking more than ${registerTimeout.toFixed(1)} ms, new schemas are ignored.`); + } else { + console.error(e); + } + })); + } + } + if (pendingRegistrations.length) { + let pending = Promise.all(pendingRegistrations).then(() => { }); + if (registerTimeout) { + pending = Promise.race([pending, timeout(registerTimeout)]); + } + pending.then(freeze); + } else { + freeze(); + } + } + + protected getRegisterTimeout(): number { + return 500; + } + +} + +@injectable() +export class JsonSchemaDataStore { + + protected readonly _schemas = new Map(); + + protected readonly onDidSchemaUpdateEmitter = new Emitter(); + readonly onDidSchemaUpdate = this.onDidSchemaUpdateEmitter.event; + + hasSchema(uri: URI): boolean { + return this._schemas.has(uri.toString()); + } + + getSchema(uri: URI): string | undefined { + return this._schemas.get(uri.toString()); + } + + setSchema(uri: URI, schema: IJSONSchema | string): void { + this._schemas.set(uri.toString(), typeof schema === 'string' ? schema : JSON.stringify(schema)); + this.notifySchemaUpdate(uri); + } + + deleteSchema(uri: URI): void { + if (this._schemas.delete(uri.toString())) { + this.notifySchemaUpdate(uri); + } + } + + notifySchemaUpdate(uri: URI): void { + this.onDidSchemaUpdateEmitter.fire(uri); + } + +} + +@injectable() +export class DefaultJsonSchemaContribution implements JsonSchemaContribution { + + private static excludedSchemaUrls = [ + 'https://www.schemastore.org/task.json' + ]; + + async registerSchemas(context: JsonSchemaRegisterContext): Promise { + const catalog = require('./catalog.json') as { schemas: DefaultJsonSchemaContribution.SchemaData[] }; + for (const s of catalog.schemas) { + if (s.fileMatch && this.shouldRegisterSchema(s)) { + context.registerSchema({ + fileMatch: s.fileMatch, + url: s.url + }); + } + } + } + + protected shouldRegisterSchema(s: DefaultJsonSchemaContribution.SchemaData): boolean { + return !DefaultJsonSchemaContribution.excludedSchemaUrls.includes(s.url); + } +} +export namespace DefaultJsonSchemaContribution { + export interface SchemaData { + name: string; + description: string; + fileMatch?: string[]; + url: string; + // eslint-disable-next-line @typescript-eslint/no-explicit-any + schema: any; + } +} diff --git a/packages/core/src/browser/keybinding.spec.ts b/packages/core/src/browser/keybinding.spec.ts new file mode 100644 index 0000000..46b90b6 --- /dev/null +++ b/packages/core/src/browser/keybinding.spec.ts @@ -0,0 +1,693 @@ +// ***************************************************************************** +// Copyright (C) 2017 Ericsson and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { enableJSDOM } from './test/jsdom'; +let disableJSDOM = enableJSDOM(); + +import { FrontendApplicationConfigProvider } from './frontend-application-config-provider'; +FrontendApplicationConfigProvider.set({}); + +import { Container, injectable, ContainerModule } from 'inversify'; +import { bindContributionProvider } from '../common/contribution-provider'; +import { KeyboardLayoutProvider, NativeKeyboardLayout, KeyboardLayoutChangeNotifier } from '../common/keyboard/keyboard-layout-provider'; +import { ILogger } from '../common/logger'; +import { KeybindingRegistry, KeybindingContext, KeybindingContribution, KeybindingScope } from './keybinding'; +import { Keybinding } from '../common/keybinding'; +import { KeyCode, Key, KeyModifier, KeySequence } from './keyboard/keys'; +import { KeyboardLayoutService } from './keyboard/keyboard-layout-service'; +import { CommandRegistry, CommandService, CommandContribution, Command } from '../common/command'; +import { LabelParser } from './label-parser'; +import { MockLogger } from '../common/test/mock-logger'; +import { FrontendApplicationStateService } from './frontend-application-state'; +import { ContextKeyService, ContextKeyServiceDummyImpl, ContextMatcher } from './context-key-service'; +import { CorePreferences } from '../common/core-preferences'; +import * as os from '../common/os'; +import * as chai from 'chai'; +import * as sinon from 'sinon'; +import { Emitter, Event } from '../common/event'; +import { bindPreferenceService } from './frontend-application-bindings'; +import { MarkdownRenderer, MarkdownRendererFactory, MarkdownRendererImpl } from './markdown-rendering/markdown-renderer'; +import { StatusBar } from './status-bar'; + +disableJSDOM(); + +const expect = chai.expect; + +let keybindingRegistry: KeybindingRegistry; +let commandRegistry: CommandRegistry; +let testContainer: Container; + +let stub: sinon.SinonStub; + +before(async () => { + disableJSDOM = enableJSDOM(); + + testContainer = new Container(); + const module = new ContainerModule((bind, unbind, isBound, rebind) => { + + /* Mock logger binding*/ + bind(ILogger).to(MockLogger); + + bind(KeyboardLayoutService).toSelf().inSingletonScope(); + bind(MockKeyboardLayoutProvider).toSelf().inSingletonScope(); + bind(KeyboardLayoutProvider).toService(MockKeyboardLayoutProvider); + bind(MockKeyboardLayoutChangeNotifier).toSelf().inSingletonScope(); + bind(KeyboardLayoutChangeNotifier).toService(MockKeyboardLayoutChangeNotifier); + + bindContributionProvider(bind, KeybindingContext); + + bind(CommandRegistry).toSelf().inSingletonScope(); + bindContributionProvider(bind, CommandContribution); + + bind(KeybindingRegistry).toSelf(); + bindContributionProvider(bind, KeybindingContribution); + + bind(TestContribution).toSelf().inSingletonScope(); + [CommandContribution, KeybindingContribution].forEach(serviceIdentifier => + bind(serviceIdentifier).toService(TestContribution) + ); + + bind(KeybindingContext).toConstantValue({ + id: 'testContext', + isEnabled(arg?: Keybinding): boolean { + return true; + } + }); + + bind(StatusBar).toConstantValue({} as StatusBar); + bind(MarkdownRendererImpl).toSelf().inSingletonScope(); + bind(MarkdownRenderer).toService(MarkdownRendererImpl); + bind(MarkdownRendererFactory).toFactory(({ container }) => () => container.get(MarkdownRenderer)); + + bind(CommandService).toService(CommandRegistry); + bind(LabelParser).toSelf().inSingletonScope(); + bind(ContextKeyService).to(MockContextKeyService).inSingletonScope(); + bind(FrontendApplicationStateService).toSelf().inSingletonScope(); + bind(CorePreferences).toConstantValue({}); + bindPreferenceService(bind); + }); + + testContainer.load(module); + + commandRegistry = testContainer.get(CommandRegistry); + commandRegistry.onStart(); + +}); + +after(() => { + disableJSDOM(); +}); + +beforeEach(async () => { + stub = sinon.stub(os, 'isOSX').value(false); + keybindingRegistry = testContainer.get(KeybindingRegistry); + await keybindingRegistry.onStart(); +}); + +afterEach(() => { + stub.restore(); +}); + +describe('keybindings', () => { + + it('should register the default keybindings', () => { + const keybinding = keybindingRegistry.getKeybindingsForCommand(TEST_COMMAND.id); + expect(keybinding).is.not.undefined; + + const keybinding2 = keybindingRegistry.getKeybindingsForCommand('undefined.command'); + expect(keybinding2.length).is.equal(0); + }); + + it('should set a keymap', () => { + const keybindings: Keybinding[] = [{ + command: TEST_COMMAND.id, + keybinding: 'ctrl+c' + }]; + + keybindingRegistry.setKeymap(KeybindingScope.USER, keybindings); + + const bindings = keybindingRegistry.getKeybindingsForCommand(TEST_COMMAND.id); + if (bindings) { + const keyCode = KeyCode.parse(bindings[0].keybinding); + expect(keyCode.key).to.be.equal(Key.KEY_C); + expect(keyCode.ctrl).to.be.true; + } + + }); + + it('should reset to default in case of invalid keybinding', () => { + const keybindings: Keybinding[] = [{ + command: TEST_COMMAND.id, + keybinding: 'ctrl+invalid' + }]; + + keybindingRegistry.setKeymap(KeybindingScope.USER, keybindings); + + const bindings = keybindingRegistry.getKeybindingsForCommand(TEST_COMMAND.id); + if (bindings) { + const keyCode = KeyCode.parse(bindings[0].keybinding); + expect(keyCode.key).to.be.equal(Key.KEY_A); + expect(keyCode.ctrl).to.be.true; + } + }); + + it('should remove all disabled keybindings from a command that has multiple keybindings', () => { + const keybindings: Keybinding[] = [{ + command: TEST_COMMAND2.id, + keybinding: 'F3' + }, + { + command: '-' + TEST_COMMAND2.id, + context: 'testContext', + keybinding: 'ctrl+f1' + }, + ]; + + keybindingRegistry.setKeymap(KeybindingScope.USER, keybindings); + + const bindings = keybindingRegistry.getKeybindingsForCommand(TEST_COMMAND2.id); + if (bindings) { + // a USER one and a DEFAULT one + expect(bindings.length).to.be.equal(2); + const keyCode = KeyCode.parse(bindings[0].keybinding); + expect(keyCode.key).to.be.equal(Key.F3); + expect(keyCode.ctrl).to.be.false; + const keyCode2 = KeyCode.parse(bindings[1].keybinding); + expect(keyCode2.key).to.be.equal(Key.F2); + expect(keyCode2.ctrl).to.be.true; + } + }); + + it('should register a keybinding', () => { + const keybinding: Keybinding = { + command: TEST_COMMAND2.id, + keybinding: 'F5' + }; + expect(isKeyBindingRegistered(keybinding)).to.be.false; + + keybindingRegistry.registerKeybinding(keybinding); + + expect(isKeyBindingRegistered(keybinding)).to.be.true; + } + ); + + it('should unregister all keybindings from a specific command', () => { + const otherKeybinding: Keybinding = { + command: TEST_COMMAND.id, + keybinding: 'F4' + }; + keybindingRegistry.registerKeybinding(otherKeybinding); + expect(isKeyBindingRegistered(otherKeybinding)).to.be.true; + + const keybinding: Keybinding = { + command: TEST_COMMAND2.id, + keybinding: 'F5' + }; + const keybinding2: Keybinding = { + command: TEST_COMMAND2.id, + keybinding: 'F6' + }; + + keybindingRegistry.registerKeybinding(keybinding); + keybindingRegistry.registerKeybinding(keybinding2); + expect(isKeyBindingRegistered(keybinding)).to.be.true; + expect(isKeyBindingRegistered(keybinding2)).to.be.true; + + keybindingRegistry.unregisterKeybinding(TEST_COMMAND2); + + expect(isKeyBindingRegistered(keybinding)).to.be.false; + expect(isKeyBindingRegistered(keybinding2)).to.be.false; + const bindingsAfterUnregister = keybindingRegistry.getKeybindingsForCommand(TEST_COMMAND2.id); + expect(bindingsAfterUnregister).not.to.be.undefined; + expect(bindingsAfterUnregister.length).to.be.equal(0); + expect(isKeyBindingRegistered(otherKeybinding)).to.be.true; + }); + + it('should unregister a specific keybinding', () => { + const otherKeybinding: Keybinding = { + command: TEST_COMMAND2.id, + keybinding: 'F4' + }; + + keybindingRegistry.registerKeybinding(otherKeybinding); + const keybinding: Keybinding = { + command: TEST_COMMAND2.id, + keybinding: 'F5' + }; + + keybindingRegistry.registerKeybinding(keybinding); + + expect(isKeyBindingRegistered(otherKeybinding)).to.be.true; + expect(isKeyBindingRegistered(keybinding)).to.be.true; + + keybindingRegistry.unregisterKeybinding(keybinding); + + expect(isKeyBindingRegistered(keybinding)).to.be.false; + expect(isKeyBindingRegistered(otherKeybinding)).to.be.true; + } + ); + + it('should unregister a specific key', () => { + const otherKeybinding: Keybinding = { + command: TEST_COMMAND.id, + keybinding: 'F4' + }; + + keybindingRegistry.registerKeybinding(otherKeybinding); + const testKey = 'F5'; + const keybinding: Keybinding = { + command: TEST_COMMAND2.id, + keybinding: testKey + }; + + const keybinding2: Keybinding = { + command: TEST_COMMAND.id, + keybinding: testKey + }; + + keybindingRegistry.registerKeybinding(keybinding); + keybindingRegistry.registerKeybinding(keybinding2); + + expect(isKeyBindingRegistered(otherKeybinding)).to.be.true; + expect(isKeyBindingRegistered(keybinding)).to.be.true; + expect(isKeyBindingRegistered(keybinding2)).to.be.true; + + keybindingRegistry.unregisterKeybinding(testKey); + + expect(isKeyBindingRegistered(otherKeybinding)).to.be.true; + expect(isKeyBindingRegistered(keybinding)).to.be.false; + expect(isKeyBindingRegistered(keybinding2)).to.be.false; + } + ); + + it('should register a correct keybinding, then default back to the original for a wrong one after', () => { + let keybindings: Keybinding[] = [{ + command: TEST_COMMAND.id, + keybinding: 'ctrl+c' + }]; + + // Get default binding + const keystroke = keybindingRegistry.getKeybindingsForCommand(TEST_COMMAND.id); + + // Set correct new binding + keybindingRegistry.setKeymap(KeybindingScope.USER, keybindings); + const bindings = keybindingRegistry.getKeybindingsForCommand(TEST_COMMAND.id); + if (bindings) { + const keyCode = KeyCode.parse(bindings[0].keybinding); + expect(keyCode.key).to.be.equal(Key.KEY_C); + expect(keyCode.ctrl).to.be.true; + } + + // Set invalid binding + keybindings = [{ + command: TEST_COMMAND.id, + keybinding: 'ControlLeft+Invalid' + }]; + + keybindingRegistry.setKeymap(KeybindingScope.USER, keybindings); + + const defaultBindings = keybindingRegistry.getKeybindingsForCommand(TEST_COMMAND.id); + if (defaultBindings) { + if (keystroke) { + const keyCode = KeyCode.parse(defaultBindings[0].keybinding); + const keyStrokeCode = KeyCode.parse(keystroke[0].keybinding); + expect(keyCode.key).to.be.equal(keyStrokeCode.key); + } + } + }); + + it('should only return the more specific keybindings when a keystroke is entered', () => { + const keybindingsUser: Keybinding[] = [{ + command: TEST_COMMAND.id, + keybinding: 'ctrl+b' + }]; + + keybindingRegistry.setKeymap(KeybindingScope.USER, keybindingsUser); + + const keybindingsSpecific: Keybinding[] = [{ + command: TEST_COMMAND.id, + keybinding: 'ctrl+c' + }]; + + const validKeyCode = KeyCode.createKeyCode({ first: Key.KEY_C, modifiers: [KeyModifier.CtrlCmd] }); + + keybindingRegistry.setKeymap(KeybindingScope.WORKSPACE, keybindingsSpecific); + + let match = keybindingRegistry.matchKeybinding([KeyCode.createKeyCode({ first: Key.KEY_A, modifiers: [KeyModifier.CtrlCmd] })]); + expect(match && match.kind).to.be.equal('full'); + + match = keybindingRegistry.matchKeybinding([KeyCode.createKeyCode({ first: Key.KEY_B, modifiers: [KeyModifier.CtrlCmd] })]); + expect(match && match.kind).to.be.equal('full'); + + match = keybindingRegistry.matchKeybinding([KeyCode.createKeyCode({ first: Key.KEY_C, modifiers: [KeyModifier.CtrlCmd] })]); + const keyCode = match && KeyCode.parse(match.binding.keybinding); + expect(keyCode?.key).to.be.equal(validKeyCode.key); + }); + + it('should return partial keybinding matches', () => { + const keybindingsUser: Keybinding[] = [{ + command: TEST_COMMAND.id, + keybinding: 'ctrlcmd+x t' + }]; + + keybindingRegistry.setKeymap(KeybindingScope.USER, keybindingsUser); + + const validKeyCodes = []; + validKeyCodes.push(KeyCode.createKeyCode({ first: Key.KEY_C, modifiers: [KeyModifier.CtrlCmd] })); + validKeyCodes.push(KeyCode.createKeyCode({ first: Key.KEY_T })); + + const match = keybindingRegistry.matchKeybinding(KeySequence.parse('ctrlcmd+x')); + expect(match && match.kind).to.be.equal('partial'); + }); + + it('should possible to override keybinding', () => { + const overriddenKeybinding = 'ctrlcmd+b a'; + const command = TEST_COMMAND_SHADOW.id; + const keybindingShadowing: Keybinding[] = [ + { + command, + keybinding: overriddenKeybinding + }, + { + command, + keybinding: 'ctrlcmd+b' + } + ]; + + keybindingRegistry.registerKeybindings(...keybindingShadowing); + + const bindings = keybindingRegistry.getKeybindingsForCommand(command); + expect(bindings.length).to.be.equal(2); + expect(bindings[0].keybinding).to.be.equal('ctrlcmd+b'); + expect(bindings[1].keybinding).to.be.equal(overriddenKeybinding); + }); + + it('overridden bindings should be returned last', () => { + const keyCode = KeyCode.createKeyCode({ first: Key.KEY_A, modifiers: [KeyModifier.Shift] }); + + const overriddenDefaultBinding: Keybinding = { + keybinding: keyCode.toString(), + command: 'test.overridden-default-command' + }; + + const defaultBinding: Keybinding = { + keybinding: keyCode.toString(), + command: 'test.default-command' + }; + + const userBinding: Keybinding = { + keybinding: keyCode.toString(), + command: 'test.user-command' + }; + + const workspaceBinding: Keybinding = { + keybinding: keyCode.toString(), + command: 'test.workspace-command' + }; + + keybindingRegistry.setKeymap(KeybindingScope.DEFAULT, [overriddenDefaultBinding, defaultBinding]); + keybindingRegistry.setKeymap(KeybindingScope.USER, [userBinding]); + keybindingRegistry.setKeymap(KeybindingScope.WORKSPACE, [workspaceBinding]); + // now WORKSPACE bindings are overriding the other scopes + + let match = keybindingRegistry.matchKeybinding([keyCode]); + expect(match?.kind).to.be.equal('full'); + expect(match?.binding?.command).to.be.equal(workspaceBinding.command); + + keybindingRegistry.resetKeybindingsForScope(KeybindingScope.WORKSPACE); + // now it should find USER bindings + + match = keybindingRegistry.matchKeybinding([keyCode]); + expect(match?.kind).to.be.equal('full'); + expect(match?.binding?.command).to.be.equal(userBinding.command); + + keybindingRegistry.resetKeybindingsForScope(KeybindingScope.USER); + // and finally it should fallback to DEFAULT bindings. + + match = keybindingRegistry.matchKeybinding([keyCode]); + expect(match?.kind).to.be.equal('full'); + expect(match?.binding?.command).to.be.equal(defaultBinding.command); + + keybindingRegistry.resetKeybindingsForScope(KeybindingScope.DEFAULT); + // now the registry should be empty + + match = keybindingRegistry.matchKeybinding([keyCode]); + expect(match).to.be.undefined; + + }); + + it('should not match disabled keybindings', () => { + const keyCode = KeyCode.createKeyCode({ first: Key.KEY_A, modifiers: [KeyModifier.Shift] }); + + const defaultBinding: Keybinding = { + keybinding: keyCode.toString(), + command: 'test.workspace-command' + }; + const disableDefaultBinding: Keybinding = { + keybinding: keyCode.toString(), + command: '-test.workspace-command' + }; + + keybindingRegistry.setKeymap(KeybindingScope.DEFAULT, [defaultBinding]); + let match = keybindingRegistry.matchKeybinding([keyCode]); + expect(match?.kind).to.be.equal('full'); + expect(match?.binding?.command).to.be.equal(defaultBinding.command); + + keybindingRegistry.setKeymap(KeybindingScope.USER, [disableDefaultBinding]); + match = keybindingRegistry.matchKeybinding([keyCode]); + expect(match).to.be.undefined; + + keybindingRegistry.resetKeybindingsForScope(KeybindingScope.USER); + match = keybindingRegistry.matchKeybinding([keyCode]); + expect(match?.kind).to.be.equal('full'); + expect(match?.binding?.command).to.be.equal(defaultBinding.command); + }); + + it('should prioritize bindings that use local context keys', () => { + // Ensure JSDOM is enabled for this test since it uses document + const disable = enableJSDOM(); + + const keyCode = KeyCode.createKeyCode({ first: Key.KEY_A, modifiers: [KeyModifier.Shift] }); + + // Register two commands with the same keybinding but different when clauses + const globalBinding: Keybinding = { + keybinding: keyCode.toString(), + command: 'test.global-command', + when: 'globalContextKey' + }; + + const localBinding: Keybinding = { + keybinding: keyCode.toString(), + command: 'test.local-command', + when: 'localContextKey' + }; + + // Register commands with handlers so they are enabled + commandRegistry.registerCommand({ id: 'test.global-command' }, { execute: () => { } }); + commandRegistry.registerCommand({ id: 'test.local-command' }, { execute: () => { } }); + + // globalBinding is registered first, so without local context prioritization it would win + keybindingRegistry.setKeymap(KeybindingScope.DEFAULT, [globalBinding, localBinding]); + + // Get the mock context key service + const contextKeyService = testContainer.get(ContextKeyService); + + // Set up mock to return 'localContextKey' as a local key + contextKeyService.setLocalContextKeys(new Set(['localContextKey'])); + + // Both when clauses should match + contextKeyService.setMatchResult(true); + + // Create a mock keyboard event with a target element + const targetElement = document.createElement('div'); + const mockEvent = new KeyboardEvent('keydown', { + key: 'A', + shiftKey: true + }); + Object.defineProperty(mockEvent, 'target', { value: targetElement }); + + const match = keybindingRegistry.matchKeybinding([keyCode], mockEvent); + + // The localBinding should be selected because it uses a local context key + expect(match?.kind).to.be.equal('full'); + expect(match?.binding?.command).to.be.equal('test.local-command'); + + disable(); + }); + + it('should fall back to first binding when no local context keys exist', () => { + // Ensure JSDOM is enabled for this test since it uses document + const disable = enableJSDOM(); + + const keyCode = KeyCode.createKeyCode({ first: Key.KEY_B, modifiers: [KeyModifier.Shift] }); + + const firstBinding: Keybinding = { + keybinding: keyCode.toString(), + command: 'test.first-command', + when: 'someContextKey' + }; + + const secondBinding: Keybinding = { + keybinding: keyCode.toString(), + command: 'test.second-command', + when: 'otherContextKey' + }; + + commandRegistry.registerCommand({ id: 'test.first-command' }, { execute: () => { } }); + commandRegistry.registerCommand({ id: 'test.second-command' }, { execute: () => { } }); + + // Note: bindings registered later (later in the array) have higher priority + // because insertBindingIntoScope inserts them at the front of the scope's keymap + keybindingRegistry.setKeymap(KeybindingScope.DEFAULT, [firstBinding, secondBinding]); + + const contextKeyService = testContainer.get(ContextKeyService); + + // No local context keys + contextKeyService.setLocalContextKeys(new Set()); + contextKeyService.setMatchResult(true); + + const targetElement = document.createElement('div'); + const mockEvent = new KeyboardEvent('keydown', { + key: 'B', + shiftKey: true + }); + Object.defineProperty(mockEvent, 'target', { value: targetElement }); + + const match = keybindingRegistry.matchKeybinding([keyCode], mockEvent); + + // Should fall back to first enabled binding in priority order (secondBinding was registered later, so it wins) + expect(match?.kind).to.be.equal('full'); + expect(match?.binding?.command).to.be.equal('test.second-command'); + + disable(); + }); +}); + +const TEST_COMMAND: Command = { + id: 'test.command' +}; + +const TEST_COMMAND2: Command = { + id: 'test.command2' +}; + +const TEST_COMMAND_SHADOW: Command = { + id: 'test.command-shadow' +}; + +@injectable() +class MockContextKeyService extends ContextKeyServiceDummyImpl { + private localKeys: Set = new Set(); + private shouldMatch: boolean = true; + private parsedKeys: Map> = new Map(); + + constructor() { + super(); + // Set up default parsed keys for test expressions + this.parsedKeys.set('globalContextKey', new Set(['globalContextKey'])); + this.parsedKeys.set('localContextKey', new Set(['localContextKey'])); + this.parsedKeys.set('someContextKey', new Set(['someContextKey'])); + this.parsedKeys.set('otherContextKey', new Set(['otherContextKey'])); + } + + setLocalContextKeys(keys: Set): void { + this.localKeys = keys; + } + + setMatchResult(result: boolean): void { + this.shouldMatch = result; + } + + override match(expression: string, context?: HTMLElement): boolean { + return this.shouldMatch; + } + + override parseKeys(expression: string): Set | undefined { + return this.parsedKeys.get(expression) || new Set([expression]); + } + + override getLocalContextKeys(element: HTMLElement): Set { + return this.localKeys; + } + + override createOverlay(overlay: Iterable<[string, unknown]>): ContextMatcher { + return this; + } +} + +@injectable() +class MockKeyboardLayoutProvider implements KeyboardLayoutProvider { + getNativeLayout(): Promise { + return Promise.resolve({ + info: { id: 'mock', lang: 'en' }, + mapping: {} + }); + } +} + +@injectable() +class MockKeyboardLayoutChangeNotifier implements KeyboardLayoutChangeNotifier { + private emitter = new Emitter(); + get onDidChangeNativeLayout(): Event { + return this.emitter.event; + } +} + +@injectable() +class TestContribution implements CommandContribution, KeybindingContribution { + + registerCommands(commands: CommandRegistry): void { + commands.registerCommand(TEST_COMMAND); + commands.registerCommand(TEST_COMMAND2); + commands.registerCommand(TEST_COMMAND_SHADOW); + } + + registerKeybindings(keybindings: KeybindingRegistry): void { + [{ + command: TEST_COMMAND.id, + context: 'testContext', + keybinding: 'ctrl+a' + }, + { + command: TEST_COMMAND2.id, + context: 'testContext', + keybinding: 'ctrl+f1' + }, + { + command: TEST_COMMAND2.id, + context: 'testContext', + keybinding: 'ctrl+f2' + }, + ].forEach(binding => { + keybindings.registerKeybinding(binding); + }); + } + +} + +function isKeyBindingRegistered(keybinding: Keybinding): boolean { + const bindings = keybindingRegistry.getKeybindingsForCommand(keybinding.command); + expect(bindings).not.to.be.undefined; + let keyBindingFound = false; + bindings.forEach( + (value: Keybinding) => { + if (value.command === keybinding.command && value.keybinding === keybinding.keybinding) { + keyBindingFound = true; + } + } + ); + return keyBindingFound; +} diff --git a/packages/core/src/browser/keybinding.ts b/packages/core/src/browser/keybinding.ts new file mode 100644 index 0000000..64d2937 --- /dev/null +++ b/packages/core/src/browser/keybinding.ts @@ -0,0 +1,898 @@ +// ***************************************************************************** +// Copyright (C) 2017 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { injectable, inject, named } from 'inversify'; +import { isOSX } from '../common/os'; +import { Emitter, Event } from '../common/event'; +import { CommandRegistry, Command } from '../common/command'; +import { Disposable, DisposableCollection } from '../common/disposable'; +import { KeyCode, KeySequence, Key } from './keyboard/keys'; +import { KeyboardLayoutService } from './keyboard/keyboard-layout-service'; +import { ContributionProvider } from '../common/contribution-provider'; +import { ILogger } from '../common/logger'; +import { StatusBarAlignment, StatusBar } from './status-bar/status-bar'; +import { ContextKeyService } from './context-key-service'; +import { CorePreferences } from '../common/core-preferences'; +import * as common from '../common/keybinding'; +import { nls } from '../common/nls'; +import { TernarySearchTree } from '../common/ternary-search-tree'; + +export enum KeybindingScope { + DEFAULT, + USER, + WORKSPACE, + END +} +export namespace KeybindingScope { + export const length = KeybindingScope.END - KeybindingScope.DEFAULT; +} + +/** + * @deprecated import from `@theia/core/lib/common/keybinding` instead + */ +export type Keybinding = common.Keybinding; +export const Keybinding = common.Keybinding; + +export interface ResolvedKeybinding extends common.Keybinding { + /** + * The KeyboardLayoutService may transform the `keybinding` depending on the + * user's keyboard layout. This property holds the transformed keybinding that + * should be used in the UI. The value is undefined if the KeyboardLayoutService + * has not been called yet to resolve the keybinding. + */ + resolved?: KeyCode[]; +} + +export interface ScopedKeybinding extends common.Keybinding { + /** Current keybinding scope */ + scope: KeybindingScope; +} + +export const KeybindingContribution = Symbol('KeybindingContribution'); +/** + * Allows extensions to contribute {@link common.Keybinding}s + */ +export interface KeybindingContribution { + /** + * Registers keybindings. + * @param keybindings the keybinding registry. + */ + registerKeybindings(keybindings: KeybindingRegistry): void; +} + +export const KeybindingContext = Symbol('KeybindingContext'); +export interface KeybindingContext { + /** + * The unique ID of the current context. + */ + readonly id: string; + + isEnabled(arg: common.Keybinding): boolean; +} +export namespace KeybindingContexts { + + export const NOOP_CONTEXT: KeybindingContext = { + id: 'noop.keybinding.context', + isEnabled: () => true + }; + + export const DEFAULT_CONTEXT: KeybindingContext = { + id: 'default.keybinding.context', + isEnabled: () => false + }; +} + +@injectable() +export class KeybindingRegistry { + + static readonly PASSTHROUGH_PSEUDO_COMMAND = 'passthrough'; + protected keySequence: KeySequence = []; + + protected readonly contexts: { [id: string]: KeybindingContext } = {}; + protected readonly keymaps: ScopedKeybinding[][] = [...Array(KeybindingScope.length)].map(() => []); + + /** + * Ternary search tree for efficient keybinding lookup. + * Maps resolved key sequences to arrays of bindings sorted by scope (highest first). + */ + protected keybindingTree: TernarySearchTree | undefined; + + @inject(CorePreferences) + protected readonly corePreferences: CorePreferences; + + @inject(KeyboardLayoutService) + protected readonly keyboardLayoutService: KeyboardLayoutService; + + @inject(ContributionProvider) @named(KeybindingContext) + protected readonly contextProvider: ContributionProvider; + + @inject(CommandRegistry) + protected readonly commandRegistry: CommandRegistry; + + @inject(ContributionProvider) @named(KeybindingContribution) + protected readonly contributions: ContributionProvider; + + @inject(StatusBar) + protected readonly statusBar: StatusBar; + + @inject(ILogger) + protected readonly logger: ILogger; + + @inject(ContextKeyService) + protected readonly whenContextService: ContextKeyService; + + async onStart(): Promise { + await this.keyboardLayoutService.initialize(); + this.keyboardLayoutService.onKeyboardLayoutChanged(newLayout => { + this.clearResolvedKeybindings(); + this.invalidateKeybindingTree(); + this.keybindingsChanged.fire(undefined); + }); + this.registerContext(KeybindingContexts.NOOP_CONTEXT); + this.registerContext(KeybindingContexts.DEFAULT_CONTEXT); + this.registerContext(...this.contextProvider.getContributions()); + for (const contribution of this.contributions.getContributions()) { + contribution.registerKeybindings(this); + } + } + + protected keybindingsChanged = new Emitter(); + + /** + * Event that is fired when the resolved keybindings change due to a different keyboard layout + * or when a new keymap is being set + */ + get onKeybindingsChanged(): Event { + return this.keybindingsChanged.event; + } + + /** + * Registers the keybinding context arguments into the application. Fails when an already registered + * context is being registered. + * + * @param contexts the keybinding contexts to register into the application. + */ + protected registerContext(...contexts: KeybindingContext[]): void { + for (const context of contexts) { + const { id } = context; + if (this.contexts[id]) { + this.logger.error(`A keybinding context with ID ${id} is already registered.`); + } else { + this.contexts[id] = context; + } + } + } + + /** + * Register a default keybinding to the registry. + * + * Keybindings registered later have higher priority during evaluation. + * + * @param binding the keybinding to be registered + */ + registerKeybinding(binding: common.Keybinding): Disposable { + return this.doRegisterKeybinding(binding); + } + + /** + * Register multiple default keybindings to the registry + * + * @param bindings An array of keybinding to be registered + */ + registerKeybindings(...bindings: common.Keybinding[]): Disposable { + return this.doRegisterKeybindings(bindings, KeybindingScope.DEFAULT); + } + + /** + * Unregister all keybindings from the registry that are bound to the key of the given keybinding + * + * @param binding a keybinding specifying the key to be unregistered + */ + unregisterKeybinding(binding: common.Keybinding): void; + /** + * Unregister all keybindings with the given key from the registry + * + * @param key a key to be unregistered + */ + unregisterKeybinding(key: string): void; + /** + * Unregister all existing keybindings for the given command + * @param command the command to unregister all keybindings for + */ + unregisterKeybinding(command: Command): void; + + unregisterKeybinding(arg: common.Keybinding | string | Command): void { + const keymap = this.keymaps[KeybindingScope.DEFAULT]; + const filter = Command.is(arg) + ? ({ command }: common.Keybinding) => command === arg.id + : ({ keybinding }: common.Keybinding) => Keybinding.is(arg) + ? keybinding === arg.keybinding + : keybinding === arg; + let removed = false; + for (const binding of keymap.filter(filter)) { + const idx = keymap.indexOf(binding); + if (idx !== -1) { + keymap.splice(idx, 1); + removed = true; + } + } + if (removed) { + this.invalidateKeybindingTree(); + } + } + + protected doRegisterKeybindings(bindings: common.Keybinding[], scope: KeybindingScope = KeybindingScope.DEFAULT): Disposable { + const toDispose = new DisposableCollection(); + for (const binding of bindings) { + toDispose.push(this.doRegisterKeybinding(binding, scope)); + } + return toDispose; + } + + protected doRegisterKeybinding(binding: common.Keybinding, scope: KeybindingScope = KeybindingScope.DEFAULT): Disposable { + try { + this.resolveKeybinding(binding); + const scoped = Object.assign(binding, { scope }); + this.insertBindingIntoScope(scoped, scope); + this.invalidateKeybindingTree(); + return Disposable.create(() => { + const index = this.keymaps[scope].indexOf(scoped); + if (index !== -1) { + this.keymaps[scope].splice(index, 1); + this.invalidateKeybindingTree(); + } + }); + } catch (error) { + this.logger.warn(`Could not register keybinding:\n ${common.Keybinding.stringify(binding)}\n${error}`); + return Disposable.NULL; + } + } + + /** + * Ensures that keybindings are inserted in order of increasing length of binding to ensure that if a + * user triggers a short keybinding (e.g. ctrl+k), the UI won't wait for a longer one (e.g. ctrl+k enter) + */ + protected insertBindingIntoScope(item: common.Keybinding & { scope: KeybindingScope; }, scope: KeybindingScope): void { + const scopedKeymap = this.keymaps[scope]; + const getNumberOfKeystrokes = (binding: common.Keybinding): number => (binding.keybinding.trim().match(/\s/g)?.length ?? 0) + 1; + const numberOfKeystrokesInBinding = getNumberOfKeystrokes(item); + const indexOfFirstItemWithEqualStrokes = scopedKeymap.findIndex(existingBinding => getNumberOfKeystrokes(existingBinding) === numberOfKeystrokesInBinding); + if (indexOfFirstItemWithEqualStrokes > -1) { + scopedKeymap.splice(indexOfFirstItemWithEqualStrokes, 0, item); + } else { + scopedKeymap.push(item); + } + } + + /** + * Ensure that the `resolved` property of the given binding is set by calling the KeyboardLayoutService. + */ + resolveKeybinding(binding: ResolvedKeybinding): KeyCode[] { + if (!binding.resolved) { + const sequence = KeySequence.parse(binding.keybinding); + binding.resolved = sequence.map(code => this.keyboardLayoutService.resolveKeyCode(code)); + } + return binding.resolved; + } + + /** + * Clear all `resolved` properties of registered keybindings so the KeyboardLayoutService is called + * again to resolve them. This is necessary when the user's keyboard layout has changed. + */ + protected clearResolvedKeybindings(): void { + for (let i = KeybindingScope.DEFAULT; i < KeybindingScope.END; i++) { + const bindings = this.keymaps[i]; + for (let j = 0; j < bindings.length; j++) { + const binding = bindings[j] as ResolvedKeybinding; + binding.resolved = undefined; + } + } + } + + /** + * Invalidates the keybinding tree, causing it to be rebuilt on next access. + */ + protected invalidateKeybindingTree(): void { + this.keybindingTree = undefined; + } + + /** + * Gets or builds the keybinding tree for efficient lookup. + * The tree maps resolved key sequences to arrays of bindings sorted by scope (highest first). + */ + protected getKeybindingTree(): TernarySearchTree { + if (!this.keybindingTree) { + this.keybindingTree = this.buildKeybindingTree(); + } + return this.keybindingTree; + } + + /** + * Builds a ternary search tree from all registered keybindings for efficient lookup. + * Bindings are indexed by their resolved key sequence. + * Bindings are stored in the order they should be checked: highest scope first, + * and within the same scope, in the order they appear in keymaps (later-registered first). + */ + protected buildKeybindingTree(): TernarySearchTree { + const tree = TernarySearchTree.forKeySequences(); + + // Process scopes from highest to lowest priority (WORKSPACE > USER > DEFAULT) + // Within each scope, maintain the keymaps order (later-registered bindings are at the front) + for (let scope = KeybindingScope.END - 1; scope >= KeybindingScope.DEFAULT; scope--) { + for (const binding of this.keymaps[scope]) { + try { + const resolved = this.resolveKeybinding(binding); + const existing = tree.get(resolved); + if (existing) { + // Append to maintain correct order: higher scopes first, then keymaps order within scope + existing.push(binding); + } else { + tree.set(resolved, [binding]); + } + } catch (error) { + // Skip bindings that can't be resolved + this.logger.warn(`Could not resolve keybinding for tree: ${common.Keybinding.stringify(binding)}`); + } + } + } + + return tree; + } + + /** + * Checks whether a colliding {@link common.Keybinding} exists in a specific scope. + * @param binding the keybinding to check + * @param scope the keybinding scope to check + * @returns true if there is a colliding keybinding + */ + containsKeybindingInScope(binding: common.Keybinding, scope = KeybindingScope.USER): boolean { + const bindingKeySequence = this.resolveKeybinding(binding); + const collisions = this.getKeySequenceCollisions(this.getUsableBindings(this.keymaps[scope]), bindingKeySequence) + .filter(b => b.context === binding.context && !b.when && !binding.when); + if (collisions.full.length > 0) { + return true; + } + if (collisions.partial.length > 0) { + return true; + } + if (collisions.shadow.length > 0) { + return true; + } + return false; + } + + /** + * Get a user visible representation of a {@link common.Keybinding}. + * @returns an array of strings representing all elements of the {@link KeySequence} defined by the {@link common.Keybinding} + * @param keybinding the keybinding + * @param separator the separator to be used to stringify {@link KeyCode}s that are part of the {@link KeySequence} + */ + acceleratorFor(keybinding: common.Keybinding, separator: string = ' ', asciiOnly = false): string[] { + const bindingKeySequence = this.resolveKeybinding(keybinding); + return this.acceleratorForSequence(bindingKeySequence, separator, asciiOnly); + } + + /** + * Get a user visible representation of a {@link KeySequence}. + * @returns an array of strings representing all elements of the {@link KeySequence} + * @param keySequence the keysequence + * @param separator the separator to be used to stringify {@link KeyCode}s that are part of the {@link KeySequence} + */ + acceleratorForSequence(keySequence: KeySequence, separator: string = ' ', asciiOnly = false): string[] { + return keySequence.map(keyCode => this.acceleratorForKeyCode(keyCode, separator, asciiOnly)); + } + + /** + * Get a user visible representation of a key code (a key with modifiers). + * @returns a string representing the {@link KeyCode} + * @param keyCode the keycode + * @param separator the separator used to separate keys (key and modifiers) in the returning string + * @param asciiOnly if `true`, no special characters will be substituted into the string returned. Ensures correct keyboard shortcuts in Electron menus. + */ + acceleratorForKeyCode(keyCode: KeyCode, separator: string = ' ', asciiOnly = false): string { + return this.componentsForKeyCode(keyCode, asciiOnly).join(separator); + } + + componentsForKeyCode(keyCode: KeyCode, asciiOnly = false): string[] { + const keyCodeResult = []; + const useSymbols = isOSX && !asciiOnly; + if (keyCode.meta && isOSX) { + keyCodeResult.push(useSymbols ? '⌘' : 'Cmd'); + } + if (keyCode.ctrl) { + keyCodeResult.push(useSymbols ? '⌃' : 'Ctrl'); + } + if (keyCode.alt) { + keyCodeResult.push(useSymbols ? '⌥' : 'Alt'); + } + if (keyCode.shift) { + keyCodeResult.push(useSymbols ? '⇧' : 'Shift'); + } + if (keyCode.key) { + keyCodeResult.push(this.acceleratorForKey(keyCode.key, asciiOnly)); + } + return keyCodeResult; + } + + /** + * @param asciiOnly if `true`, no special characters will be substituted into the string returned. Ensures correct keyboard shortcuts in Electron menus. + * + * Return a user visible representation of a single key. + */ + acceleratorForKey(key: Key, asciiOnly = false): string { + if (isOSX && !asciiOnly) { + if (key === Key.ARROW_LEFT) { + return '←'; + } + if (key === Key.ARROW_RIGHT) { + return '→'; + } + if (key === Key.ARROW_UP) { + return '↑'; + } + if (key === Key.ARROW_DOWN) { + return '↓'; + } + } + const keyString = this.keyboardLayoutService.getKeyboardCharacter(key); + if (key.keyCode >= Key.KEY_A.keyCode && key.keyCode <= Key.KEY_Z.keyCode || + key.keyCode >= Key.F1.keyCode && key.keyCode <= Key.F24.keyCode) { + return keyString.toUpperCase(); + } else if (keyString.length > 1) { + return keyString.charAt(0).toUpperCase() + keyString.slice(1); + } else { + return keyString; + } + } + + /** + * Finds collisions for a key sequence inside a list of bindings (error-free) + * + * @param bindings the reference bindings + * @param candidate the sequence to match + */ + protected getKeySequenceCollisions(bindings: ScopedKeybinding[], candidate: KeySequence): KeybindingRegistry.KeybindingsResult { + const result = new KeybindingRegistry.KeybindingsResult(); + for (const binding of bindings) { + try { + const bindingKeySequence = this.resolveKeybinding(binding); + const compareResult = KeySequence.compare(candidate, bindingKeySequence); + switch (compareResult) { + case KeySequence.CompareResult.FULL: { + result.full.push(binding); + break; + } + case KeySequence.CompareResult.PARTIAL: { + result.partial.push(binding); + break; + } + case KeySequence.CompareResult.SHADOW: { + result.shadow.push(binding); + break; + } + } + } catch (error) { + this.logger.warn(error); + } + } + return result; + } + + /** + * Get all keybindings associated to a commandId. + * + * @param commandId The ID of the command for which we are looking for keybindings. + * @returns an array of {@link ScopedKeybinding} + */ + getKeybindingsForCommand(commandId: string): ScopedKeybinding[] { + const result: ScopedKeybinding[] = []; + const disabledBindings = new Set(); + for (let scope = KeybindingScope.END - 1; scope >= KeybindingScope.DEFAULT; scope--) { + this.keymaps[scope].forEach(binding => { + if (binding.command?.startsWith('-')) { + disabledBindings.add(JSON.stringify({ command: binding.command.substring(1), binding: binding.keybinding, context: binding.context, when: binding.when })); + } else { + const command = this.commandRegistry.getCommand(binding.command); + if (command + && command.id === commandId + && !disabledBindings.has(JSON.stringify({ command: binding.command, binding: binding.keybinding, context: binding.context, when: binding.when }))) { + result.push({ ...binding, scope }); + } + } + }); + } + return result; + } + + protected isActive(binding: common.Keybinding): boolean { + /* Pseudo commands like "passthrough" are always active (and not found + in the command registry). */ + if (this.isPseudoCommand(binding.command)) { + return true; + } + + const command = this.commandRegistry.getCommand(binding.command); + return !!command && !!this.commandRegistry.getActiveHandler(command.id); + } + + /** + * Tries to execute a keybinding. + * + * @param binding to execute + * @param event keyboard event. + */ + protected executeKeyBinding(binding: common.Keybinding, event: KeyboardEvent): void { + if (this.isPseudoCommand(binding.command)) { + /* Don't do anything, let the event propagate. */ + } else { + const command = this.commandRegistry.getCommand(binding.command); + if (command) { + if (this.commandRegistry.isEnabled(binding.command, binding.args)) { + this.commandRegistry.executeCommand(binding.command, binding.args) + .catch(e => console.error('Failed to execute command:', e)); + } + + /* Note that if a keybinding is in context but the command is + not active we still stop the processing here. */ + event.preventDefault(); + event.stopPropagation(); + } + } + } + + /** + * Only execute if it has no context (global context) or if we're in that context. + */ + protected isEnabled(binding: common.Keybinding, event: KeyboardEvent): boolean { + return this.isEnabledInScope(binding, event.target); + } + + isEnabledInScope(binding: common.Keybinding, target: HTMLElement | undefined): boolean { + const context = binding.context && this.contexts[binding.context]; + if (binding.command && (!this.isPseudoCommand(binding.command) && !this.commandRegistry.isEnabled(binding.command, binding.args))) { + return false; + } + if (context && !context.isEnabled(binding)) { + return false; + } + if (binding.when && !this.whenContextService.match(binding.when, target)) { + return false; + } + return true; + } + + dispatchCommand(id: string, target?: EventTarget): void { + const keybindings = this.getKeybindingsForCommand(id); + if (keybindings.length) { + for (const keyCode of this.resolveKeybinding(keybindings[0])) { + this.dispatchKeyDown(keyCode, target); + } + } + } + + dispatchKeyDown(input: KeyboardEventInit | KeyCode | string, target: EventTarget = document.activeElement || window): void { + const eventInit = this.asKeyboardEventInit(input); + const emulatedKeyboardEvent = new KeyboardEvent('keydown', eventInit); + target.dispatchEvent(emulatedKeyboardEvent); + } + protected asKeyboardEventInit(input: KeyboardEventInit | KeyCode | string): KeyboardEventInit & Partial<{ keyCode: number }> { + if (typeof input === 'string') { + return this.asKeyboardEventInit(KeyCode.createKeyCode(input)); + } + if (input instanceof KeyCode) { + return { + metaKey: input.meta, + shiftKey: input.shift, + altKey: input.alt, + ctrlKey: input.ctrl, + code: input.key && input.key.code, + key: (input && input.character) || (input.key && input.key.code), + keyCode: input.key && input.key.keyCode + }; + } + return input; + } + + registerEventListeners(win: Window): Disposable { + /* vvv HOTFIX begin vvv + * + * This is a hotfix against issues eclipse/theia#6459 and gitpod-io/gitpod#875 . + * It should be reverted after Theia was updated to the newer Monaco. + */ + let inComposition = false; + const compositionStart = () => { + inComposition = true; + }; + win.document.addEventListener('compositionstart', compositionStart); + + const compositionEnd = () => { + inComposition = false; + }; + win.document.addEventListener('compositionend', compositionEnd); + + const keydown = (event: KeyboardEvent) => { + if (inComposition !== true) { + this.run(event); + } + }; + win.document.addEventListener('keydown', keydown, true); + + return Disposable.create(() => { + win.document.removeEventListener('compositionstart', compositionStart); + win.document.removeEventListener('compositionend', compositionEnd); + win.document.removeEventListener('keydown', keydown); + }); + } + /** + * Run the command matching to the given keyboard event. + */ + run(event: KeyboardEvent): void { + if (event.defaultPrevented) { + return; + } + + const eventDispatch = this.corePreferences['keyboard.dispatch']; + const keyCode = KeyCode.createKeyCode(event, eventDispatch); + /* Keycode is only a modifier, next keycode will be modifier + key. + Ignore this one. */ + if (keyCode.isModifierOnly()) { + return; + } + + this.keyboardLayoutService.validateKeyCode(keyCode); + this.keySequence.push(keyCode); + const match = this.matchKeybinding(this.keySequence, event); + + if (match && match.kind === 'partial') { + /* Accumulate the keysequence */ + event.preventDefault(); + event.stopPropagation(); + + this.statusBar.setElement('keybinding-status', { + text: nls.localize('theia/core/keybindingStatus', '{0} was pressed, waiting for more keys', `(${this.acceleratorForSequence(this.keySequence, '+')})`), + alignment: StatusBarAlignment.LEFT, + priority: 2 + }); + } else { + if (match && match.kind === 'full') { + this.executeKeyBinding(match.binding, event); + } + this.keySequence = []; + this.statusBar.removeElement('keybinding-status'); + } + } + + /** + * Match first binding in the current context. + * Keybindings ordered by a scope and by a registration order within the scope. + * + * Uses a ternary search tree for efficient O(log n) lookup instead of O(n) iteration. + * The tree is lazily built and invalidated when keybindings change. + * + * When multiple bindings match, bindings that use context keys local to the focused + * element are given priority over bindings that only use global context keys. + */ + matchKeybinding(keySequence: KeySequence, event?: KeyboardEvent): KeybindingRegistry.Match { + let disabled: Set | undefined; + const isEnabled = (binding: ScopedKeybinding) => { + const { command, context, when, keybinding } = binding; + if (!this.isUsable(binding)) { + disabled = disabled || new Set(); + disabled.add(JSON.stringify({ command: command.substring(1), context, when, keybinding })); + return false; + } + if (event && !this.isEnabled(binding, event)) { + return false; + } + return !disabled?.has(JSON.stringify({ command, context, when, keybinding })); + }; + + const tree = this.getKeybindingTree(); + + // Check for exact (FULL) matches first + const fullMatches = tree.get(keySequence); + if (fullMatches) { + // Collect all enabled bindings + const enabledBindings = fullMatches.filter(isEnabled); + + if (enabledBindings.length > 0) { + // If we have multiple enabled bindings, prioritize those using local context keys + const selectedBinding = this.selectBindingByLocalContext(enabledBindings, event); + return { kind: 'full', binding: selectedBinding }; + } + } + + // Check for PARTIAL matches (bindings that start with keySequence but are longer) + const partialIterator = tree.findSuperstr(keySequence); + if (partialIterator) { + // Collect all partial match bindings and sort by scope + const partialBindings: ScopedKeybinding[] = []; + let result = partialIterator.next(); + while (!result.done) { + partialBindings.push(...result.value); + result = partialIterator.next(); + } + // Sort by scope descending (highest scope first) + partialBindings.sort((a, b) => b.scope - a.scope); + + // Collect all enabled bindings + const enabledBindings = partialBindings.filter(isEnabled); + + if (enabledBindings.length > 0) { + // If we have multiple enabled bindings, prioritize those using local context keys + const selectedBinding = this.selectBindingByLocalContext(enabledBindings, event); + return { kind: 'partial', binding: selectedBinding }; + } + } + + return undefined; + } + + /** + * Selects the most appropriate binding from a list of enabled bindings. + * Prioritizes bindings whose `when` clause uses context keys that are locally + * defined at the focused element, as these are more specific to the user's + * current focus context. + * + * @param enabledBindings Array of enabled bindings to choose from (must not be empty) + * @param event Optional keyboard event to get the focused element from + * @returns The selected binding + */ + protected selectBindingByLocalContext(enabledBindings: ScopedKeybinding[], event?: KeyboardEvent): ScopedKeybinding { + if (enabledBindings.length === 1 || !event) { + return enabledBindings[0]; + } + + const target = event.target; + if (!(target instanceof HTMLElement)) { + return enabledBindings[0]; + } + + // Get context keys that are locally defined at the focused element + const localKeys = this.whenContextService.getLocalContextKeys(target); + if (localKeys.size === 0) { + return enabledBindings[0]; + } + + // Find bindings whose 'when' clause uses any local context key + // These are considered more specific to the focused element + for (const binding of enabledBindings) { + if (binding.when) { + const usedKeys = this.whenContextService.parseKeys(binding.when); + if (usedKeys) { + for (const key of usedKeys) { + if (localKeys.has(key)) { + return binding; + } + } + } + } + } + + // No binding uses local context keys, fall back to first enabled binding + return enabledBindings[0]; + } + + /** + * Returns true if the binding is usable + * @param binding Binding to be checked + */ + protected isUsable(binding: common.Keybinding): boolean { + return binding.command.charAt(0) !== '-'; + } + + /** + * Return a new filtered array containing only the usable bindings among the input bindings + * @param bindings Bindings to filter + */ + protected getUsableBindings(bindings: T[]): T[] { + return bindings.filter(binding => this.isUsable(binding)); + } + + /** + * Return true of string a pseudo-command id, in other words a command id + * that has a special meaning and that we won't find in the command + * registry. + * + * @param commandId commandId to test + */ + isPseudoCommand(commandId: string): boolean { + return commandId === KeybindingRegistry.PASSTHROUGH_PSEUDO_COMMAND; + } + + /** + * Sets a new keymap replacing all existing {@link common.Keybinding}s in the given scope. + * @param scope the keybinding scope + * @param bindings an array containing the new {@link common.Keybinding}s + */ + setKeymap(scope: KeybindingScope, bindings: common.Keybinding[]): void { + this.resetKeybindingsForScope(scope); + this.toResetKeymap.set(scope, this.doRegisterKeybindings(bindings, scope)); + this.invalidateKeybindingTree(); + this.keybindingsChanged.fire(undefined); + } + + protected readonly toResetKeymap = new Map(); + + /** + * Reset keybindings for a specific scope + * @param scope scope to reset the keybindings for + */ + resetKeybindingsForScope(scope: KeybindingScope): void { + const toReset = this.toResetKeymap.get(scope); + if (toReset) { + toReset.dispose(); + } + } + + /** + * Reset keybindings for all scopes(only leaves the default keybindings mapped) + */ + resetKeybindings(): void { + for (let i = KeybindingScope.DEFAULT + 1; i < KeybindingScope.END; i++) { + this.keymaps[i] = []; + } + this.invalidateKeybindingTree(); + } + + /** + * Get all {@link common.Keybinding}s for a {@link KeybindingScope}. + * @returns an array of {@link common.ScopedKeybinding} + * @param scope the keybinding scope to retrieve the {@link common.Keybinding}s for. + */ + getKeybindingsByScope(scope: KeybindingScope): ScopedKeybinding[] { + return this.keymaps[scope]; + } +} + +export namespace KeybindingRegistry { + export type Match = { + kind: 'full' | 'partial' + binding: ScopedKeybinding + } | undefined; + export class KeybindingsResult { + full: ScopedKeybinding[] = []; + partial: ScopedKeybinding[] = []; + shadow: ScopedKeybinding[] = []; + + /** + * Merge two results together inside `this` + * + * @param other the other KeybindingsResult to merge with + * @return this + */ + merge(other: KeybindingsResult): KeybindingsResult { + this.full.push(...other.full); + this.partial.push(...other.partial); + this.shadow.push(...other.shadow); + return this; + } + + /** + * Returns a new filtered KeybindingsResult + * + * @param fn callback filter on the results + * @return filtered new result + */ + filter(fn: (binding: common.Keybinding) => boolean): KeybindingsResult { + const result = new KeybindingsResult(); + result.full = this.full.filter(fn); + result.partial = this.partial.filter(fn); + result.shadow = this.shadow.filter(fn); + return result; + } + } +} diff --git a/packages/core/src/browser/keyboard/browser-keyboard-frontend-contribution.ts b/packages/core/src/browser/keyboard/browser-keyboard-frontend-contribution.ts new file mode 100644 index 0000000..c6ba47d --- /dev/null +++ b/packages/core/src/browser/keyboard/browser-keyboard-frontend-contribution.ts @@ -0,0 +1,108 @@ +// ***************************************************************************** +// Copyright (C) 2019 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { inject, injectable, optional } from 'inversify'; +import { isOSX } from '../../common/os'; +import { CommandContribution, CommandRegistry, Command } from '../../common/command'; +import { BrowserKeyboardLayoutProvider, KeyboardLayoutData } from './browser-keyboard-layout-provider'; +import { QuickPickValue, QuickInputService, QuickPickItemOrSeparator } from '../quick-input'; +import { nls } from '../../common/nls'; + +export namespace KeyboardCommands { + + const KEYBOARD_CATEGORY = 'Keyboard'; + const KEYBOARD_CATEGORY_KEY = nls.getDefaultKey(KEYBOARD_CATEGORY); + + export const CHOOSE_KEYBOARD_LAYOUT = Command.toLocalizedCommand({ + id: 'core.keyboard.choose', + category: KEYBOARD_CATEGORY, + label: 'Choose Keyboard Layout', + }, 'theia/core/keyboard/choose', KEYBOARD_CATEGORY_KEY); + +} + +@injectable() +export class BrowserKeyboardFrontendContribution implements CommandContribution { + + @inject(BrowserKeyboardLayoutProvider) + protected readonly layoutProvider: BrowserKeyboardLayoutProvider; + + @inject(QuickInputService) @optional() + protected readonly quickInputService: QuickInputService; + + registerCommands(commandRegistry: CommandRegistry): void { + commandRegistry.registerCommand(KeyboardCommands.CHOOSE_KEYBOARD_LAYOUT, { + execute: () => this.chooseLayout() + }); + } + + protected async chooseLayout(): Promise { + const current = this.layoutProvider.currentLayoutData; + const autodetect: QuickPickValue<'autodetect'> = { + label: nls.localizeByDefault('Auto Detect'), + description: this.layoutProvider.currentLayoutSource !== 'user-choice' ? nls.localize('theia/core/keyboard/current', '(current: {0})', current.name) : undefined, + detail: nls.localize('theia/core/keyboard/tryDetect', 'Try to detect the keyboard layout from browser information and pressed keys.'), + value: 'autodetect' + }; + const pcLayouts = this.layoutProvider.allLayoutData + .filter(layout => layout.hardware === 'pc') + .sort((a, b) => compare(a.name, b.name)) + .map(layout => this.toQuickPickValue(layout, current === layout)); + const macLayouts = this.layoutProvider.allLayoutData + .filter(layout => layout.hardware === 'mac') + .sort((a, b) => compare(a.name, b.name)) + .map(layout => this.toQuickPickValue(layout, current === layout)); + let layouts: Array | QuickPickItemOrSeparator>; + const macKeyboards = nls.localize('theia/core/keyboard/mac', 'Mac Keyboards'); + const pcKeyboards = nls.localize('theia/core/keyboard/pc', 'PC Keyboards'); + if (isOSX) { + layouts = [ + autodetect, + { type: 'separator', label: macKeyboards }, ...macLayouts, + { type: 'separator', label: pcKeyboards }, ...pcLayouts + ]; + } else { + layouts = [ + autodetect, + { type: 'separator', label: pcKeyboards }, ...pcLayouts, + { type: 'separator', label: macKeyboards }, ...macLayouts + ]; + } + const selectedItem = await this.quickInputService?.showQuickPick(layouts, { placeholder: nls.localize('theia/core/keyboard/chooseLayout', 'Choose a keyboard layout') }); + if (selectedItem && ('value' in selectedItem)) { + return this.layoutProvider.setLayoutData(selectedItem.value); + } + } + + protected toQuickPickValue(layout: KeyboardLayoutData, isCurrent: boolean): QuickPickValue { + return { + label: layout.name, + description: + `${layout.hardware === 'mac' ? 'Mac' : 'PC'} (${layout.language})${isCurrent ? nls.localize('theia/core/keyboard/currentLayout', ' - current layout') : ''}`, + value: layout + }; + } +} + +function compare(a: string, b: string): number { + if (a < b) { + return -1; + } + if (a > b) { + return 1; + } + return 0; +} diff --git a/packages/core/src/browser/keyboard/browser-keyboard-layout-provider.spec.ts b/packages/core/src/browser/keyboard/browser-keyboard-layout-provider.spec.ts new file mode 100644 index 0000000..4b19f1c --- /dev/null +++ b/packages/core/src/browser/keyboard/browser-keyboard-layout-provider.spec.ts @@ -0,0 +1,171 @@ +// ***************************************************************************** +// Copyright (C) 2019 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { enableJSDOM } from '../test/jsdom'; + +let disableJSDOM = enableJSDOM(); + +import { Container, injectable } from 'inversify'; +import type { IMacKeyboardLayoutInfo } from 'native-keymap'; +import * as chai from 'chai'; +import * as sinon from 'sinon'; +import * as os from '../../common/os'; +import { ILogger, Loggable } from '../../common/logger'; +import { LocalStorageService } from '../storage-service'; +import { MessageService } from '../../common/message-service'; +import { WindowService } from '../window/window-service'; +import { BrowserKeyboardLayoutProvider } from './browser-keyboard-layout-provider'; +import { Key } from './keys'; + +disableJSDOM(); + +describe('browser keyboard layout provider', function (): void { + + let stubOSX: sinon.SinonStub; + let stubWindows: sinon.SinonStub; + + before(() => disableJSDOM = enableJSDOM()); + after(() => disableJSDOM()); + + const setup = (system: 'mac' | 'win' | 'linux') => { + switch (system) { + case 'mac': + stubOSX = sinon.stub(os, 'isOSX').value(true); + stubWindows = sinon.stub(os, 'isWindows').value(false); + break; + case 'win': + stubOSX = sinon.stub(os, 'isOSX').value(false); + stubWindows = sinon.stub(os, 'isWindows').value(true); + break; + default: + stubOSX = sinon.stub(os, 'isOSX').value(false); + stubWindows = sinon.stub(os, 'isWindows').value(false); + } + // eslint-disable-next-line @typescript-eslint/no-explicit-any + const container = new Container(); + container.bind(BrowserKeyboardLayoutProvider).toSelf(); + container.bind(ILogger).to(MockLogger); + container.bind(LocalStorageService).toSelf().inSingletonScope(); + container.bind(MessageService).toConstantValue({} as MessageService); + container.bind(WindowService).toConstantValue({} as WindowService); + const service = container.get(BrowserKeyboardLayoutProvider); + return { service, container }; + }; + + afterEach(() => { + stubOSX.restore(); + stubWindows.restore(); + }); + + it('detects German Mac layout', async () => { + const { service } = setup('mac'); + let currentLayout = await service.getNativeLayout(); + service.onDidChangeNativeLayout(l => { + currentLayout = l; + }); + + chai.expect((currentLayout.info as IMacKeyboardLayoutInfo).id).to.equal('com.apple.keylayout.US'); + service.validateKey({ code: Key.SEMICOLON.code, character: 'ö' }); + chai.expect((currentLayout.info as IMacKeyboardLayoutInfo).id).to.equal('com.apple.keylayout.German'); + }); + + it('detects French Mac layout', async () => { + const { service } = setup('mac'); + let currentLayout = await service.getNativeLayout(); + service.onDidChangeNativeLayout(l => { + currentLayout = l; + }); + + chai.expect((currentLayout.info as IMacKeyboardLayoutInfo).id).to.equal('com.apple.keylayout.German'); + service.validateKey({ code: Key.SEMICOLON.code, character: 'm' }); + chai.expect((currentLayout.info as IMacKeyboardLayoutInfo).id).to.equal('com.apple.keylayout.French'); + }); + + it('detects keyboard layout change', async () => { + const { service } = setup('mac'); + let currentLayout = await service.getNativeLayout(); + service.onDidChangeNativeLayout(l => { + currentLayout = l; + }); + + service.validateKey({ code: Key.QUOTE.code, character: 'ä' }); + service.validateKey({ code: Key.SEMICOLON.code, character: 'ö' }); + service.validateKey({ code: Key.BRACKET_LEFT.code, character: 'ü' }); + chai.expect((currentLayout.info as IMacKeyboardLayoutInfo).id).to.equal('com.apple.keylayout.German'); + service.validateKey({ code: Key.SEMICOLON.code, character: 'm' }); + chai.expect((currentLayout.info as IMacKeyboardLayoutInfo).id).to.equal('com.apple.keylayout.French'); + }); + + it('applies layout chosen by the user', async () => { + const { service } = setup('mac'); + let currentLayout = await service.getNativeLayout(); + service.onDidChangeNativeLayout(l => { + currentLayout = l; + }); + + service.validateKey({ code: Key.SEMICOLON.code, character: 'm' }); + const spanishLayout = service.allLayoutData.find(data => data.name === 'Spanish' && data.hardware === 'mac')!; + await service.setLayoutData(spanishLayout); + chai.expect((currentLayout.info as IMacKeyboardLayoutInfo).id).to.equal('com.apple.keylayout.Spanish'); + await service.setLayoutData('autodetect'); + chai.expect((currentLayout.info as IMacKeyboardLayoutInfo).id).to.equal('com.apple.keylayout.French'); + }); + + it('restores pressed keys from last session', async () => { + const { service, container } = setup('mac'); + + service.validateKey({ code: Key.SEMICOLON.code, character: 'm' }); + const service2 = container.get(BrowserKeyboardLayoutProvider); + chai.expect(service2).to.not.equal(service); + const currentLayout = await service2.getNativeLayout(); + chai.expect((currentLayout.info as IMacKeyboardLayoutInfo).id).to.equal('com.apple.keylayout.French'); + }); + + it('restores user selection from last session', async () => { + const { service, container } = setup('mac'); + + const spanishLayout = service.allLayoutData.find(data => data.name === 'Spanish' && data.hardware === 'mac')!; + await service.setLayoutData(spanishLayout); + const service2 = container.get(BrowserKeyboardLayoutProvider); + chai.expect(service2).to.not.equal(service); + service2.validateKey({ code: Key.SEMICOLON.code, character: 'm' }); + const currentLayout = await service2.getNativeLayout(); + chai.expect((currentLayout.info as IMacKeyboardLayoutInfo).id).to.equal('com.apple.keylayout.Spanish'); + }); + +}); + +@injectable() +class MockLogger implements Partial { + trace(loggable: Loggable): Promise { + return Promise.resolve(); + } + debug(loggable: Loggable): Promise { + return Promise.resolve(); + } + info(loggable: Loggable): Promise { + return Promise.resolve(); + } + warn(loggable: Loggable): Promise { + return Promise.resolve(); + } + error(loggable: Loggable): Promise { + return Promise.resolve(); + } + fatal(loggable: Loggable): Promise { + return Promise.resolve(); + } +} diff --git a/packages/core/src/browser/keyboard/browser-keyboard-layout-provider.ts b/packages/core/src/browser/keyboard/browser-keyboard-layout-provider.ts new file mode 100644 index 0000000..80ac9e0 --- /dev/null +++ b/packages/core/src/browser/keyboard/browser-keyboard-layout-provider.ts @@ -0,0 +1,469 @@ +// ***************************************************************************** +// Copyright (C) 2019 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { injectable, postConstruct, inject } from 'inversify'; +import { isOSX } from '../../common/os'; +import { Emitter, Event } from '../../common/event'; +import { ILogger } from '../../common/logger'; +import { Deferred } from '../../common/promise-util'; +import { + NativeKeyboardLayout, KeyboardLayoutProvider, KeyboardLayoutChangeNotifier, KeyValidator, KeyValidationInput +} from '../../common/keyboard/keyboard-layout-provider'; +import { LocalStorageService } from '../storage-service'; + +export type KeyboardLayoutSource = 'navigator.keyboard' | 'user-choice' | 'pressed-keys'; + +@injectable() +export class BrowserKeyboardLayoutProvider implements KeyboardLayoutProvider, KeyboardLayoutChangeNotifier, KeyValidator { + + @inject(ILogger) + protected readonly logger: ILogger; + + @inject(LocalStorageService) + protected readonly storageService: LocalStorageService; + + protected readonly initialized = new Deferred(); + protected readonly nativeLayoutChanged = new Emitter(); + + get onDidChangeNativeLayout(): Event { + return this.nativeLayoutChanged.event; + } + + protected readonly tester = new KeyboardTester(loadAllLayouts()); + protected source: KeyboardLayoutSource = 'pressed-keys'; + protected currentLayout: KeyboardLayoutData = DEFAULT_LAYOUT_DATA; + + get allLayoutData(): KeyboardLayoutData[] { + return this.tester.candidates.slice(); + } + + get currentLayoutData(): KeyboardLayoutData { + return this.currentLayout; + } + + get currentLayoutSource(): KeyboardLayoutSource { + return this.source; + } + + @postConstruct() + protected init(): void { + this.doInit(); + } + + protected async doInit(): Promise { + await this.loadState(); + const keyboard = (navigator as NavigatorExtension).keyboard; + if (keyboard && keyboard.addEventListener) { + keyboard.addEventListener('layoutchange', async () => { + const newLayout = await this.getNativeLayout(); + this.nativeLayoutChanged.fire(newLayout); + }); + } + this.initialized.resolve(); + } + + async getNativeLayout(): Promise { + await this.initialized.promise; + if (this.source === 'user-choice') { + return this.currentLayout.raw; + } + const [layout, source] = await this.autodetect(); + this.setCurrent(layout, source); + return layout.raw; + } + + /** + * Set user-chosen keyboard layout data. + */ + async setLayoutData(layout: KeyboardLayoutData | 'autodetect'): Promise { + if (layout === 'autodetect') { + if (this.source === 'user-choice') { + const [newLayout, source] = await this.autodetect(); + this.setCurrent(newLayout, source); + this.nativeLayoutChanged.fire(newLayout.raw); + return newLayout; + } + return this.currentLayout; + } else { + if (this.source !== 'user-choice' || layout !== this.currentLayout) { + this.setCurrent(layout, 'user-choice'); + this.nativeLayoutChanged.fire(layout.raw); + } + return layout; + } + } + + /** + * Test all known keyboard layouts with the given combination of pressed key and + * produced character. Matching layouts have their score increased (see class + * KeyboardTester). If this leads to a change of the top-scoring layout, a layout + * change event is fired. + */ + validateKey(keyCode: KeyValidationInput): void { + if (this.source !== 'pressed-keys') { + return; + } + const accepted = this.tester.updateScores(keyCode); + if (!accepted) { + return; + } + const layout = this.selectLayout(); + if (layout !== this.currentLayout && layout !== DEFAULT_LAYOUT_DATA) { + this.setCurrent(layout, 'pressed-keys'); + this.nativeLayoutChanged.fire(layout.raw); + } + } + + protected setCurrent(layout: KeyboardLayoutData, source: KeyboardLayoutSource): void { + this.currentLayout = layout; + this.source = source; + this.saveState(); + if (this.tester.inputCount && (source === 'pressed-keys' || source === 'navigator.keyboard')) { + const from = source === 'pressed-keys' ? 'pressed keys' : 'browser API'; + const hardware = layout.hardware === 'mac' ? 'Mac' : 'PC'; + this.logger.info(`Detected keyboard layout from ${from}: ${layout.name} (${hardware})`); + } + } + + protected async autodetect(): Promise<[KeyboardLayoutData, KeyboardLayoutSource]> { + const keyboard = (navigator as NavigatorExtension).keyboard; + if (keyboard && keyboard.getLayoutMap) { + try { + const layoutMap = await keyboard.getLayoutMap(); + this.testLayoutMap(layoutMap); + return [this.selectLayout(), 'navigator.keyboard']; + } catch (error) { + this.logger.warn('Failed to obtain keyboard layout map.', error); + } + } + return [this.selectLayout(), 'pressed-keys']; + } + + /** + * @param layoutMap a keyboard layout map according to https://wicg.github.io/keyboard-map/ + */ + protected testLayoutMap(layoutMap: KeyboardLayoutMap): void { + this.tester.reset(); + for (const [code, key] of layoutMap.entries()) { + this.tester.updateScores({ code, character: key }); + } + } + + /** + * Select a layout based on the current tester state and the operating system + * and language detected from the browser. + */ + protected selectLayout(): KeyboardLayoutData { + const candidates = this.tester.candidates; + const scores = this.tester.scores; + const topScore = this.tester.topScore; + const language = navigator.language; + let matchingOScount = 0; + let topScoringCount = 0; + for (let i = 0; i < candidates.length; i++) { + if (scores[i] === topScore) { + const candidate = candidates[i]; + if (osMatches(candidate.hardware)) { + if (language && language.startsWith(candidate.language)) { + return candidate; + } + matchingOScount++; + } + topScoringCount++; + } + } + if (matchingOScount >= 1) { + return candidates.find((c, i) => scores[i] === topScore && osMatches(c.hardware))!; + } + if (topScoringCount >= 1) { + return candidates.find((_, i) => scores[i] === topScore)!; + } + return DEFAULT_LAYOUT_DATA; + } + + protected saveState(): Promise { + const data: LayoutProviderState = { + tester: this.tester.getState(), + source: this.source, + currentLayout: this.currentLayout !== DEFAULT_LAYOUT_DATA ? getLayoutId(this.currentLayout) : undefined + }; + return this.storageService.setData('keyboard', data); + } + + protected async loadState(): Promise { + const data = await this.storageService.getData('keyboard'); + if (data) { + this.tester.setState(data.tester || {}); + this.source = data.source || 'pressed-keys'; + if (data.currentLayout) { + const layout = this.tester.candidates.find(c => getLayoutId(c) === data.currentLayout); + if (layout) { + this.currentLayout = layout; + } + } else { + this.currentLayout = DEFAULT_LAYOUT_DATA; + } + } + } + +} + +export interface KeyboardLayoutData { + name: string; + hardware: 'pc' | 'mac'; + language: string; + raw: NativeKeyboardLayout; +} + +function osMatches(hardware: 'pc' | 'mac'): boolean { + return isOSX ? hardware === 'mac' : hardware === 'pc'; +} + +/** + * This is the fallback keyboard layout selected when nothing else matches. + * It has an empty mapping, so user inputs are handled like with a standard US keyboard. + */ +export const DEFAULT_LAYOUT_DATA: KeyboardLayoutData = { + name: 'US', + hardware: isOSX ? 'mac' : 'pc', + language: 'en', + raw: { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + info: {} as any, + mapping: {} + } +}; + +export interface LayoutProviderState { + tester?: KeyboardTesterState; + source?: KeyboardLayoutSource; + currentLayout?: string; +} + +export interface KeyboardTesterState { + scores?: { [id: string]: number }; + topScore?: number; + testedInputs?: { [key: string]: string } +} + +/** + * Holds score values for all known keyboard layouts. Scores are updated + * by comparing key codes with the corresponding character produced by + * the user's keyboard. + */ +export class KeyboardTester { + + readonly scores: number[]; + topScore: number = 0; + + private readonly testedInputs = new Map(); + + get inputCount(): number { + return this.testedInputs.size; + } + + constructor(readonly candidates: KeyboardLayoutData[]) { + this.scores = this.candidates.map(() => 0); + } + + reset(): void { + for (let i = 0; i < this.scores.length; i++) { + this.scores[i] = 0; + } + this.topScore = 0; + this.testedInputs.clear(); + } + + updateScores(input: KeyValidationInput): boolean { + let property: 'value' | 'withShift' | 'withAltGr' | 'withShiftAltGr'; + if (input.shiftKey && input.altKey) { + property = 'withShiftAltGr'; + } else if (input.shiftKey) { + property = 'withShift'; + } else if (input.altKey) { + property = 'withAltGr'; + } else { + property = 'value'; + } + const inputKey = `${input.code}.${property}`; + if (this.testedInputs.has(inputKey)) { + if (this.testedInputs.get(inputKey) === input.character) { + return false; + } else { + // The same input keystroke leads to a different character: + // probably a keyboard layout change, so forget all previous scores + this.reset(); + } + } + + const scores = this.scores; + for (let i = 0; i < this.candidates.length; i++) { + scores[i] += this.testCandidate(this.candidates[i], input, property); + if (scores[i] > this.topScore) { + this.topScore = scores[i]; + } + } + this.testedInputs.set(inputKey, input.character); + return true; + } + + protected testCandidate(candidate: KeyboardLayoutData, input: KeyValidationInput, + property: 'value' | 'withShift' | 'withAltGr' | 'withShiftAltGr'): number { + const keyMapping = candidate.raw.mapping[input.code]; + if (keyMapping && keyMapping[property]) { + return keyMapping[property] === input.character ? 1 : 0; + } else { + return 0; + } + } + + getState(): KeyboardTesterState { + const scores: { [id: string]: number } = {}; + for (let i = 0; i < this.scores.length; i++) { + scores[getLayoutId(this.candidates[i])] = this.scores[i]; + } + const testedInputs: { [key: string]: string } = {}; + for (const [key, character] of this.testedInputs.entries()) { + testedInputs[key] = character; + } + return { + scores, + topScore: this.topScore, + testedInputs + }; + } + + setState(state: KeyboardTesterState): void { + this.reset(); + if (state.scores) { + const layoutIds = this.candidates.map(getLayoutId); + for (const id in state.scores) { + if (state.scores.hasOwnProperty(id)) { + const index = layoutIds.indexOf(id); + if (index > 0) { + this.scores[index] = state.scores[id]; + } + } + } + } + if (state.topScore) { + this.topScore = state.topScore; + } + if (state.testedInputs) { + for (const key in state.testedInputs) { + if (state.testedInputs.hasOwnProperty(key)) { + this.testedInputs.set(key, state.testedInputs[key]); + } + } + } + } + +} + +/** + * API specified by https://wicg.github.io/keyboard-map/ + */ +interface NavigatorExtension extends Navigator { + keyboard: Keyboard; +} + +interface Keyboard { + getLayoutMap(): Promise; + addEventListener(type: 'layoutchange', listener: EventListenerOrEventListenerObject): void; +} + +type KeyboardLayoutMap = Map; + +function getLayoutId(layout: KeyboardLayoutData): string { + return `${layout.language}-${layout.name.replace(' ', '_')}-${layout.hardware}`; +} + +/** + * Keyboard layout files are expected to have the following name scheme: + * `language-name-hardware.json` + * + * - `language`: A language subtag according to IETF BCP 47 + * - `name`: Display name of the keyboard layout (without dashes) + * - `hardware`: `pc` or `mac` + */ +function loadLayout(fileName: string): KeyboardLayoutData { + const [language, name, hardware] = fileName.split('-'); + return { + name: name.replace('_', ' '), + hardware: hardware as 'pc' | 'mac', + language, + // Webpack knows what to do here and it should bundle all files under `../../../src/common/keyboard/layouts/` + // eslint-disable-next-line import/no-dynamic-require + raw: require('../../../src/common/keyboard/layouts/' + fileName + '.json') + }; +} + +function loadAllLayouts(): KeyboardLayoutData[] { + // The order of keyboard layouts is relevant for autodetection. Layouts with + // lower index have a higher chance of being selected. + // The current ordering approach is to sort by estimated number of developers + // in the respective country (taken from the Stack Overflow Developer Survey), + // but keeping all layouts of the same language together. + return [ + 'en-US-pc', + 'en-US-mac', + 'en-Dvorak-pc', + 'en-Dvorak-mac', + 'en-Dvorak_Lefthanded-pc', + 'en-Dvorak_Lefthanded-mac', + 'en-Dvorak_Righthanded-pc', + 'en-Dvorak_Righthanded-mac', + 'en-Colemak-mac', + 'en-British-pc', + 'en-British-mac', + 'de-German-pc', + 'de-German-mac', + 'de-Swiss_German-pc', + 'de-Swiss_German-mac', + 'fr-French-pc', + 'fr-French-mac', + 'fr-Canadian_French-pc', + 'fr-Canadian_French-mac', + 'fr-Swiss_French-pc', + 'fr-Swiss_French-mac', + 'fr-Bepo-pc', + 'pt-Portuguese-pc', + 'pt-Portuguese-mac', + 'pt-Brazilian-mac', + 'pl-Polish-pc', + 'pl-Polish-mac', + 'nl-Dutch-pc', + 'nl-Dutch-mac', + 'es-Spanish-pc', + 'es-Spanish-mac', + 'it-Italian-pc', + 'it-Italian-mac', + 'sv-Swedish-pc', + 'sv-Swedish-mac', + 'tr-Turkish_Q-pc', + 'tr-Turkish_Q-mac', + 'cs-Czech-pc', + 'cs-Czech-mac', + 'ro-Romanian-pc', + 'ro-Romanian-mac', + 'da-Danish-pc', + 'da-Danish-mac', + 'nb-Norwegian-pc', + 'nb-Norwegian-mac', + 'hu-Hungarian-pc', + 'hu-Hungarian-mac' + ].map(loadLayout); +} diff --git a/packages/core/src/browser/keyboard/browser-keyboard-module.ts b/packages/core/src/browser/keyboard/browser-keyboard-module.ts new file mode 100644 index 0000000..5609d63 --- /dev/null +++ b/packages/core/src/browser/keyboard/browser-keyboard-module.ts @@ -0,0 +1,30 @@ +// ***************************************************************************** +// Copyright (C) 2019 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { ContainerModule } from 'inversify'; +import { CommandContribution } from '../../common/command'; +import { KeyboardLayoutProvider, KeyboardLayoutChangeNotifier, KeyValidator } from '../../common/keyboard/keyboard-layout-provider'; +import { BrowserKeyboardLayoutProvider } from './browser-keyboard-layout-provider'; +import { BrowserKeyboardFrontendContribution } from './browser-keyboard-frontend-contribution'; + +export default new ContainerModule((bind, unbind, isBound, rebind) => { + bind(BrowserKeyboardLayoutProvider).toSelf().inSingletonScope(); + bind(KeyboardLayoutProvider).toService(BrowserKeyboardLayoutProvider); + bind(KeyboardLayoutChangeNotifier).toService(BrowserKeyboardLayoutProvider); + bind(KeyValidator).toService(BrowserKeyboardLayoutProvider); + bind(BrowserKeyboardFrontendContribution).toSelf().inSingletonScope(); + bind(CommandContribution).toService(BrowserKeyboardFrontendContribution); +}); diff --git a/packages/core/src/browser/keyboard/index.ts b/packages/core/src/browser/keyboard/index.ts new file mode 100644 index 0000000..d01d683 --- /dev/null +++ b/packages/core/src/browser/keyboard/index.ts @@ -0,0 +1,20 @@ +// ***************************************************************************** +// Copyright (C) 2019 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +export * from './keys'; +export * from './keyboard-layout-service'; +export * from './browser-keyboard-layout-provider'; +export * from './browser-keyboard-frontend-contribution'; diff --git a/packages/core/src/browser/keyboard/keyboard-layout-service.spec.ts b/packages/core/src/browser/keyboard/keyboard-layout-service.spec.ts new file mode 100644 index 0000000..ae42173 --- /dev/null +++ b/packages/core/src/browser/keyboard/keyboard-layout-service.spec.ts @@ -0,0 +1,121 @@ +// ***************************************************************************** +// Copyright (C) 2019 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { Container, injectable } from 'inversify'; +import { Emitter, Event } from '../../common/event'; +import { KeyCode } from './keys'; +import { KeyboardLayoutService } from './keyboard-layout-service'; +import { KeyboardLayoutProvider, NativeKeyboardLayout, KeyboardLayoutChangeNotifier } from '../../common/keyboard/keyboard-layout-provider'; +import * as os from '../../common/os'; +import * as chai from 'chai'; +import * as sinon from 'sinon'; + +describe('keyboard layout service', function (): void { + + let stubOSX: sinon.SinonStub; + let stubWindows: sinon.SinonStub; + + const setup = async (layout: NativeKeyboardLayout, system: 'mac' | 'win' | 'linux') => { + switch (system) { + case 'mac': + stubOSX = sinon.stub(os, 'isOSX').value(true); + stubWindows = sinon.stub(os, 'isWindows').value(false); + break; + case 'win': + stubOSX = sinon.stub(os, 'isOSX').value(false); + stubWindows = sinon.stub(os, 'isWindows').value(true); + break; + default: + stubOSX = sinon.stub(os, 'isOSX').value(false); + stubWindows = sinon.stub(os, 'isWindows').value(false); + } + const container = new Container(); + container.bind(KeyboardLayoutService).toSelf().inSingletonScope(); + @injectable() + class MockLayoutProvider implements KeyboardLayoutProvider, KeyboardLayoutChangeNotifier { + emitter = new Emitter(); + get onDidChangeNativeLayout(): Event { + return this.emitter.event; + } + getNativeLayout(): Promise { + return Promise.resolve(layout); + } + } + container.bind(KeyboardLayoutProvider).to(MockLayoutProvider); + container.bind(KeyboardLayoutChangeNotifier).to(MockLayoutProvider); + const service = container.get(KeyboardLayoutService); + await service.initialize(); + return service; + }; + + afterEach(() => { + stubOSX.restore(); + stubWindows.restore(); + }); + + it('resolves correct key bindings with German Mac layout', async () => { + const macGerman = require('../../../src/common/keyboard/layouts/de-German-mac.json'); + const service = await setup(macGerman, 'mac'); + + const toggleComment = service.resolveKeyCode(KeyCode.createKeyCode('Slash+M1')); + chai.expect(toggleComment.toString()).to.equal('meta+shift+7'); + chai.expect(service.getKeyboardCharacter(toggleComment.key!)).to.equal('7'); + + const indentLine = service.resolveKeyCode(KeyCode.createKeyCode('BracketRight+M1')); + chai.expect(indentLine.toString()).to.equal('meta+alt+ctrl+6'); + chai.expect(service.getKeyboardCharacter(indentLine.key!)).to.equal('6'); + }); + + it('resolves correct key bindings with French Mac layout', async () => { + const macFrench = require('../../../src/common/keyboard/layouts/fr-French-mac.json'); + const service = await setup(macFrench, 'mac'); + + const toggleComment = service.resolveKeyCode(KeyCode.createKeyCode('Slash+M1')); + chai.expect(toggleComment.toString()).to.equal('meta+shift+.'); + chai.expect(service.getKeyboardCharacter(toggleComment.key!)).to.equal(':'); + + const indentLine = service.resolveKeyCode(KeyCode.createKeyCode('BracketRight+M1')); + chai.expect(indentLine.toString()).to.equal('meta+shift+alt+ctrl+-'); + chai.expect(service.getKeyboardCharacter(indentLine.key!)).to.equal(')'); + }); + + it('resolves correct key bindings with German Windows layout', async () => { + const winGerman = require('../../../src/common/keyboard/layouts/de-German-pc.json'); + const service = await setup(winGerman, 'win'); + + const toggleComment = service.resolveKeyCode(KeyCode.createKeyCode('Slash+M1')); + chai.expect(toggleComment.toString()).to.equal('ctrl+\\'); + chai.expect(service.getKeyboardCharacter(toggleComment.key!)).to.equal('#'); + + const indentLine = service.resolveKeyCode(KeyCode.createKeyCode('BracketRight+M1')); + chai.expect(indentLine.toString()).to.equal('ctrl+='); + chai.expect(service.getKeyboardCharacter(indentLine.key!)).to.equal('´'); + }); + + it('resolves correct key bindings with French Windows layout', async () => { + const winFrench = require('../../../src/common/keyboard/layouts/fr-French-pc.json'); + const service = await setup(winFrench, 'win'); + + const toggleComment = service.resolveKeyCode(KeyCode.createKeyCode('Slash+M1')); + chai.expect(toggleComment.toString()).to.equal('ctrl+.'); + chai.expect(service.getKeyboardCharacter(toggleComment.key!)).to.equal(':'); + + const indentLine = service.resolveKeyCode(KeyCode.createKeyCode('BracketRight+M1')); + chai.expect(indentLine.toString()).to.equal('ctrl+['); + chai.expect(service.getKeyboardCharacter(indentLine.key!)).to.equal('^'); + }); + +}); diff --git a/packages/core/src/browser/keyboard/keyboard-layout-service.ts b/packages/core/src/browser/keyboard/keyboard-layout-service.ts new file mode 100644 index 0000000..6866d95 --- /dev/null +++ b/packages/core/src/browser/keyboard/keyboard-layout-service.ts @@ -0,0 +1,455 @@ +// ***************************************************************************** +// Copyright (C) 2019 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { injectable, inject, optional } from 'inversify'; +import type { IWindowsKeyMapping } from 'native-keymap'; +import { isWindows } from '../../common/os'; +import { + NativeKeyboardLayout, KeyboardLayoutProvider, KeyboardLayoutChangeNotifier, KeyValidator +} from '../../common/keyboard/keyboard-layout-provider'; +import { Emitter, Event } from '../../common/event'; +import { KeyCode, Key } from './keys'; + +export interface KeyboardLayout { + /** + * Mapping of standard US keyboard keys to the actual key codes to use. + * See `KeyboardLayoutService.getCharacterIndex` for the index computation. + */ + readonly key2KeyCode: KeyCode[]; + /** + * Mapping of KeyboardEvent codes to the characters shown on the user's keyboard + * for the respective keys. + */ + readonly code2Character: { [code: string]: string }; +} + +@injectable() +export class KeyboardLayoutService { + + @inject(KeyboardLayoutProvider) + protected readonly layoutProvider: KeyboardLayoutProvider; + + @inject(KeyboardLayoutChangeNotifier) + protected readonly layoutChangeNotifier: KeyboardLayoutChangeNotifier; + + @inject(KeyValidator) @optional() + protected readonly keyValidator?: KeyValidator; + + private currentLayout?: KeyboardLayout; + + protected updateLayout(newLayout: NativeKeyboardLayout): KeyboardLayout { + const transformed = this.transformNativeLayout(newLayout); + this.currentLayout = transformed; + this.keyboardLayoutChanged.fire(transformed); + return transformed; + } + + protected keyboardLayoutChanged = new Emitter(); + + get onKeyboardLayoutChanged(): Event { + return this.keyboardLayoutChanged.event; + } + + async initialize(): Promise { + this.layoutChangeNotifier.onDidChangeNativeLayout(newLayout => this.updateLayout(newLayout)); + const initialLayout = await this.layoutProvider.getNativeLayout(); + this.updateLayout(initialLayout); + } + + /** + * Resolve a KeyCode of a keybinding using the current keyboard layout. + * If no keyboard layout has been detected or the layout does not contain the + * key used in the KeyCode, the KeyCode is returned unchanged. + */ + resolveKeyCode(inCode: KeyCode): KeyCode { + const layout = this.currentLayout; + if (layout && inCode.key) { + for (let shift = 0; shift <= 1; shift++) { + const index = this.getCharacterIndex(inCode.key, !!shift); + const mappedCode = layout.key2KeyCode[index]; + if (mappedCode) { + const transformed = this.transformKeyCode(inCode, mappedCode, !!shift); + if (transformed) { + return transformed; + } + } + } + } + return inCode; + } + + /** + * Return the character shown on the user's keyboard for the given key. + * Use this to determine UI representations of keybindings. + */ + getKeyboardCharacter(key: Key): string { + const layout = this.currentLayout; + if (layout) { + const value = layout.code2Character[key.code]?.trim(); + // Special cases from native keymap + if (value === '\u001b') { + return 'escape'; + } + if (value === '\u007f') { + return 'delete'; + } + if (value === '\u0008') { + return 'backspace'; + } + if (value?.replace(/[\n\r\t]/g, '')) { + return value; + } + } + return key.easyString; + } + + /** + * Called when a KeyboardEvent is processed by the KeybindingRegistry. + * The KeyValidator may trigger a keyboard layout change. + */ + validateKeyCode(keyCode: KeyCode): void { + if (this.keyValidator && keyCode.key && keyCode.character) { + this.keyValidator.validateKey({ + code: keyCode.key.code, + character: keyCode.character, + shiftKey: keyCode.shift, + ctrlKey: keyCode.ctrl, + altKey: keyCode.alt + }); + } + } + + protected transformKeyCode(inCode: KeyCode, mappedCode: KeyCode, keyNeedsShift: boolean): KeyCode | undefined { + if (!inCode.shift && keyNeedsShift) { + return undefined; + } + if (mappedCode.alt && (inCode.alt || inCode.ctrl || inCode.shift && !keyNeedsShift)) { + return undefined; + } + return new KeyCode({ + key: mappedCode.key, + meta: inCode.meta, + ctrl: inCode.ctrl || mappedCode.alt, + shift: inCode.shift && !keyNeedsShift || mappedCode.shift, + alt: inCode.alt || mappedCode.alt + }); + } + + protected transformNativeLayout(nativeLayout: NativeKeyboardLayout): KeyboardLayout { + const key2KeyCode: KeyCode[] = new Array(2 * (Key.MAX_KEY_CODE + 1)); + const code2Character: { [code: string]: string } = {}; + const mapping = nativeLayout.mapping; + for (const code in mapping) { + if (mapping.hasOwnProperty(code)) { + const keyMapping = mapping[code]; + const mappedKey = Key.getKey(code); + if (mappedKey && this.shouldIncludeKey(code)) { + if (isWindows) { + this.addWindowsKeyMapping(key2KeyCode, mappedKey, (keyMapping as IWindowsKeyMapping).vkey, keyMapping.value); + } else { + if (keyMapping.value) { + this.addKeyMapping(key2KeyCode, mappedKey, keyMapping.value, false, false); + } + if (keyMapping.withShift) { + this.addKeyMapping(key2KeyCode, mappedKey, keyMapping.withShift, true, false); + } + if (keyMapping.withAltGr) { + this.addKeyMapping(key2KeyCode, mappedKey, keyMapping.withAltGr, false, true); + } + if (keyMapping.withShiftAltGr) { + this.addKeyMapping(key2KeyCode, mappedKey, keyMapping.withShiftAltGr, true, true); + } + } + } + if (keyMapping.value) { + code2Character[code] = keyMapping.value; + } + } + } + return { key2KeyCode, code2Character }; + } + + protected shouldIncludeKey(code: string): boolean { + // Exclude all numpad keys because they produce values that are already found elsewhere on the keyboard. + // This can cause problems, e.g. if `Numpad3` maps to `PageDown` then commands bound to `PageDown` would + // be resolved to `Digit3` (`Numpad3` is associated with `Key.DIGIT3`), effectively blocking the user + // from typing `3` in an editor. + return !code.startsWith('Numpad'); + } + + private addKeyMapping(key2KeyCode: KeyCode[], mappedKey: Key, value: string, shift: boolean, alt: boolean): void { + const key = VALUE_TO_KEY[value]; + if (key) { + const index = this.getCharacterIndex(key.key, key.shift); + if (key2KeyCode[index] === undefined) { + key2KeyCode[index] = new KeyCode({ + key: mappedKey, + shift, + alt, + character: value + }); + } + } + } + + private addWindowsKeyMapping(key2KeyCode: KeyCode[], mappedKey: Key, vkey: string, value: string): void { + const key = VKEY_TO_KEY[vkey]; + if (key) { + const index = this.getCharacterIndex(key); + if (key2KeyCode[index] === undefined) { + key2KeyCode[index] = new KeyCode({ + key: mappedKey, + character: value + }); + } + } + } + + protected getCharacterIndex(key: Key, shift?: boolean): number { + if (shift) { + return Key.MAX_KEY_CODE + key.keyCode + 1; + } else { + return key.keyCode; + } + } + +} + +/** + * Mapping of character values to the corresponding keys on a standard US keyboard layout. + */ +const VALUE_TO_KEY: { [value: string]: { key: Key, shift?: boolean } } = { + '`': { key: Key.BACKQUOTE }, + '~': { key: Key.BACKQUOTE, shift: true }, + '1': { key: Key.DIGIT1 }, + '!': { key: Key.DIGIT1, shift: true }, + '2': { key: Key.DIGIT2 }, + '@': { key: Key.DIGIT2, shift: true }, + '3': { key: Key.DIGIT3 }, + '#': { key: Key.DIGIT3, shift: true }, + '4': { key: Key.DIGIT4 }, + '$': { key: Key.DIGIT4, shift: true }, + '5': { key: Key.DIGIT5 }, + '%': { key: Key.DIGIT5, shift: true }, + '6': { key: Key.DIGIT6 }, + '^': { key: Key.DIGIT6, shift: true }, + '7': { key: Key.DIGIT7 }, + '&': { key: Key.DIGIT7, shift: true }, + '8': { key: Key.DIGIT8 }, + '*': { key: Key.DIGIT8, shift: true }, + '9': { key: Key.DIGIT9 }, + '(': { key: Key.DIGIT9, shift: true }, + '0': { key: Key.DIGIT0 }, + ')': { key: Key.DIGIT0, shift: true }, + '-': { key: Key.MINUS }, + '_': { key: Key.MINUS, shift: true }, + '=': { key: Key.EQUAL }, + '+': { key: Key.EQUAL, shift: true }, + + 'a': { key: Key.KEY_A }, + 'A': { key: Key.KEY_A, shift: true }, + 'b': { key: Key.KEY_B }, + 'B': { key: Key.KEY_B, shift: true }, + 'c': { key: Key.KEY_C }, + 'C': { key: Key.KEY_C, shift: true }, + 'd': { key: Key.KEY_D }, + 'D': { key: Key.KEY_D, shift: true }, + 'e': { key: Key.KEY_E }, + 'E': { key: Key.KEY_E, shift: true }, + 'f': { key: Key.KEY_F }, + 'F': { key: Key.KEY_F, shift: true }, + 'g': { key: Key.KEY_G }, + 'G': { key: Key.KEY_G, shift: true }, + 'h': { key: Key.KEY_H }, + 'H': { key: Key.KEY_H, shift: true }, + 'i': { key: Key.KEY_I }, + 'I': { key: Key.KEY_I, shift: true }, + 'j': { key: Key.KEY_J }, + 'J': { key: Key.KEY_J, shift: true }, + 'k': { key: Key.KEY_K }, + 'K': { key: Key.KEY_K, shift: true }, + 'l': { key: Key.KEY_L }, + 'L': { key: Key.KEY_L, shift: true }, + 'm': { key: Key.KEY_M }, + 'M': { key: Key.KEY_M, shift: true }, + 'n': { key: Key.KEY_N }, + 'N': { key: Key.KEY_N, shift: true }, + 'o': { key: Key.KEY_O }, + 'O': { key: Key.KEY_O, shift: true }, + 'p': { key: Key.KEY_P }, + 'P': { key: Key.KEY_P, shift: true }, + 'q': { key: Key.KEY_Q }, + 'Q': { key: Key.KEY_Q, shift: true }, + 'r': { key: Key.KEY_R }, + 'R': { key: Key.KEY_R, shift: true }, + 's': { key: Key.KEY_S }, + 'S': { key: Key.KEY_S, shift: true }, + 't': { key: Key.KEY_T }, + 'T': { key: Key.KEY_T, shift: true }, + 'u': { key: Key.KEY_U }, + 'U': { key: Key.KEY_U, shift: true }, + 'v': { key: Key.KEY_V }, + 'V': { key: Key.KEY_V, shift: true }, + 'w': { key: Key.KEY_W }, + 'W': { key: Key.KEY_W, shift: true }, + 'x': { key: Key.KEY_X }, + 'X': { key: Key.KEY_X, shift: true }, + 'y': { key: Key.KEY_Y }, + 'Y': { key: Key.KEY_Y, shift: true }, + 'z': { key: Key.KEY_Z }, + 'Z': { key: Key.KEY_Z, shift: true }, + + '[': { key: Key.BRACKET_LEFT }, + '{': { key: Key.BRACKET_LEFT, shift: true }, + ']': { key: Key.BRACKET_RIGHT }, + '}': { key: Key.BRACKET_RIGHT, shift: true }, + ';': { key: Key.SEMICOLON }, + ':': { key: Key.SEMICOLON, shift: true }, + "'": { key: Key.QUOTE }, + '"': { key: Key.QUOTE, shift: true }, + ',': { key: Key.COMMA }, + '<': { key: Key.COMMA, shift: true }, + '.': { key: Key.PERIOD }, + '>': { key: Key.PERIOD, shift: true }, + '/': { key: Key.SLASH }, + '?': { key: Key.SLASH, shift: true }, + '\\': { key: Key.BACKSLASH }, + '|': { key: Key.BACKSLASH, shift: true }, + + '\t': { key: Key.TAB }, + '\r': { key: Key.ENTER }, + '\n': { key: Key.ENTER }, + ' ': { key: Key.SPACE }, +}; + +/** + * Mapping of Windows Virtual Keys to the corresponding keys on a standard US keyboard layout. + */ +const VKEY_TO_KEY: { [value: string]: Key } = { + VK_SHIFT: Key.SHIFT_LEFT, + VK_LSHIFT: Key.SHIFT_LEFT, + VK_RSHIFT: Key.SHIFT_RIGHT, + VK_CONTROL: Key.CONTROL_LEFT, + VK_LCONTROL: Key.CONTROL_LEFT, + VK_RCONTROL: Key.CONTROL_RIGHT, + VK_MENU: Key.ALT_LEFT, + VK_COMMAND: Key.OS_LEFT, + VK_LWIN: Key.OS_LEFT, + VK_RWIN: Key.OS_RIGHT, + + VK_0: Key.DIGIT0, + VK_1: Key.DIGIT1, + VK_2: Key.DIGIT2, + VK_3: Key.DIGIT3, + VK_4: Key.DIGIT4, + VK_5: Key.DIGIT5, + VK_6: Key.DIGIT6, + VK_7: Key.DIGIT7, + VK_8: Key.DIGIT8, + VK_9: Key.DIGIT9, + VK_A: Key.KEY_A, + VK_B: Key.KEY_B, + VK_C: Key.KEY_C, + VK_D: Key.KEY_D, + VK_E: Key.KEY_E, + VK_F: Key.KEY_F, + VK_G: Key.KEY_G, + VK_H: Key.KEY_H, + VK_I: Key.KEY_I, + VK_J: Key.KEY_J, + VK_K: Key.KEY_K, + VK_L: Key.KEY_L, + VK_M: Key.KEY_M, + VK_N: Key.KEY_N, + VK_O: Key.KEY_O, + VK_P: Key.KEY_P, + VK_Q: Key.KEY_Q, + VK_R: Key.KEY_R, + VK_S: Key.KEY_S, + VK_T: Key.KEY_T, + VK_U: Key.KEY_U, + VK_V: Key.KEY_V, + VK_W: Key.KEY_W, + VK_X: Key.KEY_X, + VK_Y: Key.KEY_Y, + VK_Z: Key.KEY_Z, + + VK_OEM_1: Key.SEMICOLON, + VK_OEM_2: Key.SLASH, + VK_OEM_3: Key.BACKQUOTE, + VK_OEM_4: Key.BRACKET_LEFT, + VK_OEM_5: Key.BACKSLASH, + VK_OEM_6: Key.BRACKET_RIGHT, + VK_OEM_7: Key.QUOTE, + VK_OEM_PLUS: Key.EQUAL, + VK_OEM_COMMA: Key.COMMA, + VK_OEM_MINUS: Key.MINUS, + VK_OEM_PERIOD: Key.PERIOD, + + VK_F1: Key.F1, + VK_F2: Key.F2, + VK_F3: Key.F3, + VK_F4: Key.F4, + VK_F5: Key.F5, + VK_F6: Key.F6, + VK_F7: Key.F7, + VK_F8: Key.F8, + VK_F9: Key.F9, + VK_F10: Key.F10, + VK_F11: Key.F11, + VK_F12: Key.F12, + VK_F13: Key.F13, + VK_F14: Key.F14, + VK_F15: Key.F15, + VK_F16: Key.F16, + VK_F17: Key.F17, + VK_F18: Key.F18, + VK_F19: Key.F19, + + VK_BACK: Key.BACKSPACE, + VK_TAB: Key.TAB, + VK_RETURN: Key.ENTER, + VK_CAPITAL: Key.CAPS_LOCK, + VK_ESCAPE: Key.ESCAPE, + VK_SPACE: Key.SPACE, + VK_PRIOR: Key.PAGE_UP, + VK_NEXT: Key.PAGE_DOWN, + VK_END: Key.END, + VK_HOME: Key.HOME, + VK_INSERT: Key.INSERT, + VK_DELETE: Key.DELETE, + VK_LEFT: Key.ARROW_LEFT, + VK_UP: Key.ARROW_UP, + VK_RIGHT: Key.ARROW_RIGHT, + VK_DOWN: Key.ARROW_DOWN, + + VK_NUMLOCK: Key.NUM_LOCK, + VK_NUMPAD0: Key.DIGIT0, + VK_NUMPAD1: Key.DIGIT1, + VK_NUMPAD2: Key.DIGIT2, + VK_NUMPAD3: Key.DIGIT3, + VK_NUMPAD4: Key.DIGIT4, + VK_NUMPAD5: Key.DIGIT5, + VK_NUMPAD6: Key.DIGIT6, + VK_NUMPAD7: Key.DIGIT7, + VK_NUMPAD8: Key.DIGIT8, + VK_NUMPAD9: Key.DIGIT9, + VK_MULTIPLY: Key.MULTIPLY, + VK_ADD: Key.ADD, + VK_SUBTRACT: Key.SUBTRACT, + VK_DECIMAL: Key.DECIMAL, + VK_DIVIDE: Key.DIVIDE +}; diff --git a/packages/core/src/browser/keyboard/keys.spec.ts b/packages/core/src/browser/keyboard/keys.spec.ts new file mode 100644 index 0000000..3212b37 --- /dev/null +++ b/packages/core/src/browser/keyboard/keys.spec.ts @@ -0,0 +1,258 @@ +// ***************************************************************************** +// Copyright (C) 2017 Ericsson and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { enableJSDOM } from '../../browser/test/jsdom'; +let disableJSDOM = enableJSDOM(); + +import { KeyCode, Key, KeyModifier, KeySequence } from './keys'; +import * as os from '../../common/os'; +import * as chai from 'chai'; +import * as sinon from 'sinon'; + +disableJSDOM(); + +const expect = chai.expect; + +describe('keys api', () => { + const equalKeyCode = (keyCode1: KeyCode, keyCode2: KeyCode): boolean => + JSON.stringify(keyCode1) === JSON.stringify(keyCode2); + + before(() => { + disableJSDOM = enableJSDOM(); + }); + + after(() => { + disableJSDOM(); + }); + + it('should parse a string to a KeyCode correctly', () => { + + const keycode = KeyCode.parse('ctrl+b'); + expect(keycode.ctrl).to.be.true; + expect(keycode.key).is.equal(Key.KEY_B); + + // Invalid keystroke string + expect(() => KeyCode.parse('ctl+b')).to.throw(Error); + + }); + + it('should parse a string containing special modifiers to a KeyCode correctly', () => { + const stub = sinon.stub(os, 'isOSX').value(false); + const keycode = KeyCode.parse('ctrl+b'); + expect(keycode.ctrl).to.be.true; + expect(keycode.key).is.equal(Key.KEY_B); + + const keycodeOption = KeyCode.parse('option+b'); + expect(keycodeOption.alt).to.be.true; + expect(keycodeOption.key).is.equal(Key.KEY_B); + + expect(() => KeyCode.parse('cmd+b')).to.throw(/OSX only/); + + const keycodeCtrlOrCommand = KeyCode.parse('ctrlcmd+b'); + expect(keycodeCtrlOrCommand.meta).to.be.false; + expect(keycodeCtrlOrCommand.ctrl).to.be.true; + expect(keycodeCtrlOrCommand.key).is.equal(Key.KEY_B); + stub.restore(); + }); + + it('should parse a string containing special modifiers to a KeyCode correctly (macOS)', () => { + KeyCode.resetKeyBindings(); + const stub = sinon.stub(os, 'isOSX').value(true); + const keycode = KeyCode.parse('ctrl+b'); + expect(keycode.ctrl).to.be.true; + expect(keycode.key).is.equal(Key.KEY_B); + + const keycodeOption = KeyCode.parse('option+b'); + expect(keycodeOption.alt).to.be.true; + expect(keycodeOption.key).is.equal(Key.KEY_B); + + const keycodeCommand = KeyCode.parse('cmd+b'); + expect(keycodeCommand.meta).to.be.true; + expect(keycodeCommand.key).is.equal(Key.KEY_B); + + const keycodeCtrlOrCommand = KeyCode.parse('ctrlcmd+b'); + expect(keycodeCtrlOrCommand.meta).to.be.true; + expect(keycodeCtrlOrCommand.ctrl).to.be.false; + expect(keycodeCtrlOrCommand.key).is.equal(Key.KEY_B); + + stub.restore(); + }); + + it('should serialize a keycode properly with BACKQUOTE + M1', () => { + const stub = sinon.stub(os, 'isOSX').value(true); + let keyCode = KeyCode.createKeyCode({ first: Key.BACKQUOTE, modifiers: [KeyModifier.CtrlCmd] }); + let keyCodeString = keyCode.toString(); + expect(keyCodeString).to.be.equal('meta+`'); + let parsedKeyCode = KeyCode.parse(keyCodeString); + expect(equalKeyCode(parsedKeyCode, keyCode)).to.be.true; + + sinon.stub(os, 'isOSX').value(false); + keyCode = KeyCode.createKeyCode({ first: Key.BACKQUOTE, modifiers: [KeyModifier.CtrlCmd] }); + keyCodeString = keyCode.toString(); + expect(keyCodeString).to.be.equal('ctrl+`'); + parsedKeyCode = KeyCode.parse(keyCodeString); + expect(equalKeyCode(parsedKeyCode, keyCode)).to.be.true; + + stub.restore(); + }); + + it('should serialize a keycode properly with a + M2 + M3', () => { + const keyCode = KeyCode.createKeyCode({ first: Key.KEY_A, modifiers: [KeyModifier.Shift, KeyModifier.Alt] }); + const keyCodeString = keyCode.toString(); + expect(keyCodeString).to.be.equal('shift+alt+a'); + const parsedKeyCode = KeyCode.parse(keyCodeString); + expect(equalKeyCode(parsedKeyCode, keyCode)).to.be.true; + }); + + it('the order of the modifiers should not matter when parsing the key code', () => { + const left = KeySequence.parse('shift+alt+a'); + const right = KeySequence.parse('alt+shift+a'); + expect(KeySequence.compare(left, right)).to.be.equal(KeySequence.CompareResult.FULL); + + expect(KeySequence.compare( + [KeyCode.createKeyCode({ first: Key.KEY_A, modifiers: [KeyModifier.Alt, KeyModifier.Shift] })], right)).to.be.equal(KeySequence.CompareResult.FULL); + expect(KeySequence.compare( + left, [KeyCode.createKeyCode({ first: Key.KEY_A, modifiers: [KeyModifier.Alt, KeyModifier.Shift] })])).to.be.equal(KeySequence.CompareResult.FULL); + + expect(KeySequence.compare( + [KeyCode.createKeyCode({ first: Key.KEY_A, modifiers: [KeyModifier.Shift, KeyModifier.Alt] })], right)).to.be.equal(KeySequence.CompareResult.FULL); + expect(KeySequence.compare( + left, [KeyCode.createKeyCode({ first: Key.KEY_A, modifiers: [KeyModifier.Shift, KeyModifier.Alt] })])).to.be.equal(KeySequence.CompareResult.FULL); + }); + + it('should parse ctrl key properly on both OS X and other platforms', () => { + const event = new KeyboardEvent('keydown', { + key: Key.BACKQUOTE.easyString, + code: Key.BACKQUOTE.code, + ctrlKey: true, + }); + const stub = sinon.stub(os, 'isOSX').value(true); + expect(KeyCode.createKeyCode(event).toString()).to.be.equal('ctrl+`'); + sinon.stub(os, 'isOSX').value(false); + expect(KeyCode.createKeyCode(event).toString()).to.be.equal('ctrl+`'); + stub.restore(); + }); + + it('should properly handle eventDispatch', () => { + const event = new KeyboardEvent('keydown', { + code: Key.CAPS_LOCK.code, + }); + Object.defineProperty(event, 'keyCode', { get: () => Key.ESCAPE.keyCode }); + expect(KeyCode.createKeyCode(event, 'code').toString()).to.be.equal(Key.CAPS_LOCK.easyString); + expect(KeyCode.createKeyCode(event, 'keyCode').toString()).to.be.equal(Key.ESCAPE.easyString); + }); + + it('should serialize a keycode properly with a + M4', () => { + const stub = sinon.stub(os, 'isOSX').value(true); + const keyCode = KeyCode.createKeyCode({ first: Key.KEY_A, modifiers: [KeyModifier.MacCtrl] }); + const keyCodeString = keyCode.toString(); + expect(keyCodeString).to.be.equal('ctrl+a'); + const parsedKeyCode = KeyCode.parse(keyCodeString); + expect(equalKeyCode(parsedKeyCode, keyCode)).to.be.true; + stub.restore(); + }); + + it('it should parse a multi keycode keybinding', () => { + const validKeyCodes = []; + validKeyCodes.push(KeyCode.createKeyCode({ first: Key.KEY_A, modifiers: [KeyModifier.CtrlCmd] })); + validKeyCodes.push(KeyCode.createKeyCode({ first: Key.KEY_C, modifiers: [KeyModifier.CtrlCmd, KeyModifier.Shift] })); + + const parsedKeyCodes = KeySequence.parse('ctrlcmd+a ctrlcmd+shift+c'); + expect(parsedKeyCodes).to.deep.equal(validKeyCodes); + }); + + it('it should parse a multi keycode keybinding with no modifiers', () => { + const validKeyCodes = []; + validKeyCodes.push(KeyCode.createKeyCode({ first: Key.KEY_A, modifiers: [KeyModifier.CtrlCmd] })); + validKeyCodes.push(KeyCode.createKeyCode({ first: Key.KEY_C })); + + const parsedKeyCodes = KeySequence.parse('ctrlcmd+a c'); + expect(parsedKeyCodes).to.deep.equal(validKeyCodes); + }); + + it('should compare keysequences properly', () => { + let a = KeySequence.parse('ctrlcmd+a'); + let b = KeySequence.parse('ctrlcmd+a t'); + + expect(KeySequence.compare(a, b)).to.be.equal(KeySequence.CompareResult.PARTIAL); + + a = KeySequence.parse('ctrlcmd+a t'); + b = KeySequence.parse('ctrlcmd+a'); + + expect(KeySequence.compare(a, b)).to.be.equal(KeySequence.CompareResult.SHADOW); + + a = KeySequence.parse('ctrlcmd+a t'); + b = KeySequence.parse('ctrlcmd+a b c'); + expect(KeySequence.compare(a, b)).to.be.equal(KeySequence.CompareResult.NONE); + + a = KeySequence.parse('ctrlcmd+a t'); + b = KeySequence.parse('ctrlcmd+a a'); + expect(KeySequence.compare(a, b)).to.be.equal(KeySequence.CompareResult.NONE); + + a = KeySequence.parse('ctrlcmd+a t'); + b = KeySequence.parse('ctrlcmd+a t'); + expect(KeySequence.compare(a, b)).to.be.equal(KeySequence.CompareResult.FULL); + + a = KeySequence.parse('ctrlcmd+a t b'); + b = KeySequence.parse('ctrlcmd+a t b'); + expect(KeySequence.compare(a, b)).to.be.equal(KeySequence.CompareResult.FULL); + }); + + it('should be a modifier only', () => { + const keyCode = KeyCode.createKeyCode({ modifiers: [KeyModifier.CtrlCmd] }); + expect(keyCode).to.be.deep.equal(KeyCode.createKeyCode({ modifiers: [KeyModifier.CtrlCmd] })); + expect(keyCode.isModifierOnly()).to.be.true; + }); + + it('should be multiple modifiers only', () => { + const keyCode = KeyCode.createKeyCode({ modifiers: [KeyModifier.CtrlCmd, KeyModifier.Alt] }); + expect(keyCode).to.be.deep.equal(KeyCode.createKeyCode({ modifiers: [KeyModifier.CtrlCmd, KeyModifier.Alt] })); + expect(keyCode.isModifierOnly()).to.be.true; + }); + + it('parse bogus keybinding', () => { + const [first, second] = KeySequence.parse(' Ctrl+sHiFt+F10 b '); + expect(first.ctrl).to.be.true; + expect(first.shift).to.be.true; + expect(first.key).is.equal(Key.F10); + expect(second.key).is.equal(Key.KEY_B); + }); + + it('should parse minus as key', () => { + const keycode = KeyCode.parse('ctrl+-'); + expect(keycode.ctrl).to.be.true; + expect(keycode.key).is.equal(Key.MINUS); + }); + + it('should parse minus as key and separator', () => { + const keycode = KeyCode.parse('ctrl--'); + expect(keycode.ctrl).to.be.true; + expect(keycode.key).is.equal(Key.MINUS); + }); + + it('should parse plus as separator', () => { + const keycode = KeyCode.parse('ctrl-+-'); + expect(keycode.ctrl).to.be.true; + expect(keycode.key).is.equal(Key.MINUS); + }); + + it('should not parse plus as key but separator', () => { + const keycode = KeyCode.parse('ctrl++-'); + expect(keycode.ctrl).to.be.true; + expect(keycode.key).is.equal(Key.MINUS); + }); + +}); diff --git a/packages/core/src/browser/keyboard/keys.ts b/packages/core/src/browser/keyboard/keys.ts new file mode 100644 index 0000000..356e184 --- /dev/null +++ b/packages/core/src/browser/keyboard/keys.ts @@ -0,0 +1,20 @@ +// ***************************************************************************** +// Copyright (C) 2017-2019 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +/** + * @deprecated since 1.20.0. Import from `@theia/core/lib/common/keys` instead. + */ +export * from '../../common/keys'; diff --git a/packages/core/src/browser/keys.ts b/packages/core/src/browser/keys.ts new file mode 100644 index 0000000..5a5286a --- /dev/null +++ b/packages/core/src/browser/keys.ts @@ -0,0 +1,21 @@ +// ***************************************************************************** +// Copyright (C) 2019 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +// Reexporting here for backwards compatibility. +// Please import from '@theia/core/lib/browser' or '@theia/core/lib/browser/keyboard' instead of this module. +// This module might be removed in future releases. +import { KeySequence, Keystroke, KeyCode, KeyModifier, Key, SpecialCases, KeysOrKeyCodes } from './keyboard/keys'; +export { KeySequence, Keystroke, KeyCode, KeyModifier, Key, SpecialCases, KeysOrKeyCodes }; diff --git a/packages/core/src/browser/label-parser.spec.ts b/packages/core/src/browser/label-parser.spec.ts new file mode 100644 index 0000000..2c1be31 --- /dev/null +++ b/packages/core/src/browser/label-parser.spec.ts @@ -0,0 +1,165 @@ +// ***************************************************************************** +// Copyright (C) 2017 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** +import { LabelParser, LabelPart, LabelIcon } from './label-parser'; +import { CommandService } from './../common'; +import { Container } from 'inversify'; +import { expect } from 'chai'; + +let statusBarEntryUtility: LabelParser; + +before(() => { + const testContainer = new Container(); + testContainer.bind(LabelParser).toSelf().inSingletonScope(); + testContainer.bind(CommandService).toDynamicValue(ctx => ({ + executeCommand(): Promise { + return Promise.resolve(undefined); + } + })).inSingletonScope(); + + statusBarEntryUtility = testContainer.get(LabelParser); +}); + +describe('StatusBarEntryUtility', () => { + + let text: string; + + it('should create an empty array.', () => { + text = ''; + const iconArr: LabelPart[] = statusBarEntryUtility.parse(text); + expect(iconArr).to.have.lengthOf(0); + }); + + it('should create a string array with one entry.', () => { + text = 'foo bar'; + const iconArr: LabelPart[] = statusBarEntryUtility.parse(text); + expect(iconArr).to.have.lengthOf(1); + expect(iconArr[0]).equals('foo bar'); + }); + + it('should create a string array with one entry - text contains an $.', () => { + text = 'foo $ bar'; + const iconArr: LabelPart[] = statusBarEntryUtility.parse(text); + expect(iconArr).to.have.lengthOf(1); + expect(iconArr[0]).equals('foo $ bar'); + }); + + it('should create a string array with one entry - text contains an $( which does not close.', () => { + text = 'foo $(bar'; + const iconArr: LabelPart[] = statusBarEntryUtility.parse(text); + expect(iconArr).to.have.lengthOf(1); + expect(iconArr[0]).equals('foo $(bar'); + }); + + it('should create a string array with two entries. Second is a simple StatusBarIcon.', () => { + text = 'foo $(bar)'; + const iconArr: LabelPart[] = statusBarEntryUtility.parse(text); + expect(iconArr).to.have.lengthOf(2); + expect(iconArr[0]).equals('foo '); + expect(iconArr[1]).has.property('name'); + expect(iconArr[1]).has.property('animation'); + expect((iconArr[1] as LabelIcon).name).equals('bar'); + expect((iconArr[1] as LabelIcon).animation).to.be.undefined; + }); + + it('should create a string array with two entries. Second is a StatusBarIcon with an animation.', () => { + text = 'foo $(bar~baz)'; + const iconArr: LabelPart[] = statusBarEntryUtility.parse(text); + expect(iconArr).to.have.lengthOf(2); + expect(iconArr[0]).equals('foo '); + expect(iconArr[1]).has.property('name'); + expect(iconArr[1]).has.property('animation'); + expect((iconArr[1] as LabelIcon).name).equals('bar'); + expect((iconArr[1] as LabelIcon).animation).equals('baz'); + }); + + it("should create string array of 'foo $(icon1) bar $(icon2) baz $(icon3)'", () => { + text = 'foo $(icon1) bar $(icon2) baz $(icon3)'; + const iconArr: LabelPart[] = statusBarEntryUtility.parse(text); + expect(iconArr).to.have.lengthOf(6); + expect(iconArr[0]).equals('foo '); + expect(iconArr[2]).equals(' bar '); + }); + + it("should create string array of '$(icon1) foo bar $(icon2) baz $(icon3)'", () => { + text = '$(icon1) foo bar $(icon2~ani1) baz $(icon3)'; + const iconArr: LabelPart[] = statusBarEntryUtility.parse(text); + expect(iconArr).to.have.lengthOf(5); + expect(iconArr[0]).has.property('name'); + expect((iconArr[0] as LabelIcon).name).equals('icon1'); + expect(iconArr[2]).has.property('animation'); + expect((iconArr[2] as LabelIcon).animation).equals('ani1'); + }); + + it("should create an array with one element of '$(icon1)'", () => { + text = '$(icon1)'; + const iconArr: LabelPart[] = statusBarEntryUtility.parse(text); + expect(iconArr).to.have.lengthOf(1); + expect(iconArr[0]).has.property('name'); + expect((iconArr[0] as LabelIcon).name).equals('icon1'); + }); + + it("should create an array of '$(icon1)$(icon2) (icon3)'", () => { + text = '$(icon1)$(icon2) $(icon3)'; + const iconArr: LabelPart[] = statusBarEntryUtility.parse(text); + expect(iconArr).to.have.lengthOf(4); + expect(iconArr[0]).has.property('name'); + expect((iconArr[0] as LabelIcon).name).equals('icon1'); + expect(iconArr[1]).has.property('name'); + expect((iconArr[1] as LabelIcon).name).equals('icon2'); + expect(iconArr[2]).equals(' '); + expect(iconArr[3]).has.property('name'); + expect((iconArr[3] as LabelIcon).name).equals('icon3'); + }); + + it('should strip nothing from an empty string', () => { + text = ''; + const stripped: string = statusBarEntryUtility.stripIcons(text); + expect(stripped).to.be.equal(text); + }); + + it('should strip nothing from an string containing no icons', () => { + // Deliberate double space to verify not concatenating these words + text = 'foo bar'; + const stripped: string = statusBarEntryUtility.stripIcons(text); + expect(stripped).to.be.equal(text); + }); + + it("should strip a medial '$(icon)' from a string", () => { + text = 'foo $(icon) bar'; + const stripped: string = statusBarEntryUtility.stripIcons(text); + expect(stripped).to.be.equal('foo bar'); + }); + + it("should strip a terminal '$(icon)' from a string", () => { + // Deliberate double space to verify not concatenating these words + text = 'foo bar $(icon)'; + const stripped: string = statusBarEntryUtility.stripIcons(text); + expect(stripped).to.be.equal('foo bar'); + }); + + it("should strip an initial '$(icon)' from a string", () => { + // Deliberate double space to verify not concatenating these words + text = '$(icon) foo bar'; + const stripped: string = statusBarEntryUtility.stripIcons(text); + expect(stripped).to.be.equal('foo bar'); + }); + + it("should strip multiple '$(icon)' specifiers from a string", () => { + text = '$(icon1) foo $(icon2)$(icon3) bar $(icon4) $(icon5)'; + const stripped: string = statusBarEntryUtility.stripIcons(text); + expect(stripped).to.be.equal('foo bar'); + }); +}); diff --git a/packages/core/src/browser/label-parser.ts b/packages/core/src/browser/label-parser.ts new file mode 100644 index 0000000..2fcb9e1 --- /dev/null +++ b/packages/core/src/browser/label-parser.ts @@ -0,0 +1,108 @@ +// ***************************************************************************** +// Copyright (C) 2017 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** +import { injectable } from 'inversify'; +import { isObject, isString } from '../common'; + +export interface LabelIcon { + name: string; + animation?: string; +} + +export namespace LabelIcon { + export function is(val: unknown): val is LabelIcon { + return isObject(val) && isString(val.name); + } +} + +export type LabelPart = string | LabelIcon; + +@injectable() +export class LabelParser { + + /** + * Returns an array with parts of the given text. + * These parts are of type LabelPart which can be either a string or a LabelIcon. + * For splitting up the giving text the parser follows this rule: + * The text gets parsed for the following pattern: $(iconName~iconAnimation). + * If the parser finds such pattern a new LabelIcon object + * { name: 'iconName', animation: 'iconAnimation'} is added to the returned array. + * iconName can be for instance the name of an icon of e.g. FontAwesome and the (optional) iconAnimation + * the name of an animation class which must be supported by the particular icon toolkit. + * + * Every string before, between or after such icon patterns gets also added to the array + * before, between or after the related LabelIcon. + * + * @param text - the label text to parse + */ + parse(text: string): LabelPart[] { + const parserArray: LabelPart[] = []; + let arrPointer = 0; + let potentialIcon = ''; + + for (let idx = 0; idx < text.length; idx++) { + const char = text.charAt(idx); + parserArray[arrPointer] = parserArray[arrPointer] || ''; + if (potentialIcon === '') { + if (char === '$') { + potentialIcon += char; + } else { + parserArray[arrPointer] += char; + } + } else if (potentialIcon === '$') { + if (char === '(') { + potentialIcon += char; + } else { + parserArray[arrPointer] += potentialIcon + char; + potentialIcon = ''; + } + } else { + if (char === ')') { + const iconClassArr = potentialIcon.substring(2, potentialIcon.length).split('~'); + if (parserArray[arrPointer] !== '') { + arrPointer++; + } + parserArray[arrPointer] = { name: iconClassArr[0], animation: iconClassArr[1] }; + arrPointer++; + potentialIcon = ''; + } else { + potentialIcon += char; + } + } + } + + if (potentialIcon !== '') { + parserArray[arrPointer] += potentialIcon; + } + + return parserArray; + } + + /** + * Strips icon specifiers from the given `text`, leaving only a + * space-separated concatenation of the non-icon segments. + * + * @param text text to be stripped of icon specifiers + * @returns the `text` with icon specifiers stripped out + */ + stripIcons(text: string): string { + return this.parse(text) + .filter(item => !LabelIcon.is(item)) + .map(s => (s as string).trim()) + .filter(s => s.length) + .join(' '); + } + +} diff --git a/packages/core/src/browser/label-provider.spec.ts b/packages/core/src/browser/label-provider.spec.ts new file mode 100644 index 0000000..e95d4f4 --- /dev/null +++ b/packages/core/src/browser/label-provider.spec.ts @@ -0,0 +1,62 @@ +// ***************************************************************************** +// Copyright (C) 2017 Ericsson and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { expect } from 'chai'; +import { DefaultUriLabelProviderContribution, URIIconReference } from './label-provider'; +import URI from '../common/uri'; +import { OS } from '../common/os'; + +describe('DefaultUriLabelProviderContribution', function (): void { + + it('should return a short name', function (): void { + const prov = new DefaultUriLabelProviderContribution(); + const shortName = prov.getName(new URI('file:///tmp/hello/you.txt')); + + expect(shortName).eq('you.txt'); + }); + + it('should return a long name', function (): void { + const prov = new DefaultUriLabelProviderContribution(); + const longName = prov.getLongName(new URI('file:///tmp/hello/you.txt')); + + if (OS.backend.isWindows) { + expect(longName).eq('\\tmp\\hello\\you.txt'); + } else { + expect(longName).eq('/tmp/hello/you.txt'); + } + }); + + it('should return icon class for something that seems to be a file', function (): void { + const prov = new DefaultUriLabelProviderContribution(); + const icon = prov.getIcon(new URI('file:///tmp/hello/you.txt')); + + expect(icon).eq('text-icon medium-blue theia-file-icons-js'); + }); + + it('should return file icon class for something that seems to be a directory', function (): void { + const prov = new DefaultUriLabelProviderContribution(); + const icon = prov.getIcon(new URI('file:///tmp/hello')); + + expect(icon).eq(prov.defaultFileIcon); + }); + + it('should return folder icon class for something that is a directory', function (): void { + const prov = new DefaultUriLabelProviderContribution(); + const icon = prov.getIcon(URIIconReference.create('folder', new URI('file:///tmp/hello'))); + + expect(icon).eq(prov.defaultFolderIcon); + }); +}); diff --git a/packages/core/src/browser/label-provider.ts b/packages/core/src/browser/label-provider.ts new file mode 100644 index 0000000..037cf50 --- /dev/null +++ b/packages/core/src/browser/label-provider.ts @@ -0,0 +1,385 @@ +// ***************************************************************************** +// Copyright (C) 2017 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { inject, injectable, named, postConstruct } from 'inversify'; +import * as fileIcons from 'file-icons-js'; +import URI from '../common/uri'; +import { ContributionProvider } from '../common/contribution-provider'; +import { Event, Emitter, Disposable, isObject, Path, Prioritizeable } from '../common'; +import { FrontendApplicationContribution } from './frontend-application-contribution'; +import { EnvVariablesServer } from '../common/env-variables/env-variables-protocol'; +import { ResourceLabelFormatter, ResourceLabelFormatting } from '../common/label-protocol'; +import { codicon } from './widgets'; + +/** + * @internal don't export it, use `LabelProvider.folderIcon` instead. + */ +const DEFAULT_FOLDER_ICON = `${codicon('folder')} default-folder-icon`; +/** + * @internal don't export it, use `LabelProvider.fileIcon` instead. + */ +const DEFAULT_FILE_ICON = `${codicon('file')} default-file-icon`; + +export const LabelProviderContribution = Symbol('LabelProviderContribution'); +/** + * A {@link LabelProviderContribution} determines how specific elements/nodes are displayed in the workbench. + * Theia views use a common {@link LabelProvider} to determine the label and/or an icon for elements shown in the UI. This includes elements in lists + * and trees, but also view specific locations like headers. The common {@link LabelProvider} collects all {@links LabelProviderContribution} and delegates + * to the contribution with the highest priority. This is determined via calling the {@link LabelProviderContribution.canHandle} function, so contributions + * define which elements they are responsible for. + * As arbitrary views can consume LabelProviderContributions, they must be generic for the covered element type, not view specific. Label providers and + * contributions can be used for arbitrary element and node types, e.g. for markers or domain-specific elements. + */ +export interface LabelProviderContribution { + + /** + * Determines whether this contribution can handle the given element and with what priority. + * All contributions are ordered by the returned number if greater than zero. The highest number wins. + * If two or more contributions return the same positive number one of those will be used. It is undefined which one. + */ + canHandle(element: object): number; + + /** + * returns an icon class for the given element. + */ + getIcon?(element: object): string | undefined; + + /** + * returns a short name for the given element. + */ + getName?(element: object): string | undefined; + + /** + * returns a long name for the given element. + */ + getLongName?(element: object): string | undefined; + + /** + * A compromise between {@link getName} and {@link getLongName}. Can be used to supplement getName in contexts that allow both a primary display field and extra detail. + */ + getDetails?(element: object): string | undefined; + + /** + * Emit when something has changed that may result in this label provider returning a different + * value for one or more properties (name, icon etc). + */ + readonly onDidChange?: Event; + + /** + * Checks whether the given element is affected by the given change event. + * Contributions delegating to the label provider can use this hook + * to perform a recursive check. + */ + affects?(element: object, event: DidChangeLabelEvent): boolean; + +} + +export interface DidChangeLabelEvent { + affects(element: object): boolean; +} + +export interface URIIconReference { + kind: 'uriIconReference'; + id: 'file' | 'folder'; + uri?: URI +} +export namespace URIIconReference { + export function is(element: unknown): element is URIIconReference { + return isObject(element) && element.kind === 'uriIconReference'; + } + export function create(id: URIIconReference['id'], uri?: URI): URIIconReference { + return { kind: 'uriIconReference', id, uri }; + } +} + +@injectable() +export class DefaultUriLabelProviderContribution implements LabelProviderContribution { + + protected formatters: ResourceLabelFormatter[] = []; + protected readonly onDidChangeEmitter = new Emitter(); + protected homePath: string | undefined; + @inject(EnvVariablesServer) protected readonly envVariablesServer: EnvVariablesServer; + + @postConstruct() + init(): void { + this.envVariablesServer.getHomeDirUri().then(result => { + this.homePath = result; + this.fireOnDidChange(); + }); + } + + canHandle(element: object): number { + if (element instanceof URI || URIIconReference.is(element)) { + return 1; + } + return 0; + } + + getIcon(element: URI | URIIconReference): string { + if (URIIconReference.is(element) && element.id === 'folder') { + return this.defaultFolderIcon; + } + const uri = URIIconReference.is(element) ? element.uri : element; + if (uri) { + const iconClass = uri && this.getFileIcon(uri); + return iconClass || this.defaultFileIcon; + } + return ''; + } + + get defaultFolderIcon(): string { + return DEFAULT_FOLDER_ICON; + } + + get defaultFileIcon(): string { + return DEFAULT_FILE_ICON; + } + + protected getFileIcon(uri: URI): string | undefined { + const fileIcon = fileIcons.getClassWithColor(uri.displayName); + if (!fileIcon) { + return undefined; + } + return fileIcon + ' theia-file-icons-js'; + } + + getName(element: URI | URIIconReference): string | undefined { + const uri = this.getUri(element); + return uri && uri.displayName; + } + + getLongName(element: URI | URIIconReference): string | undefined { + const uri = this.getUri(element); + if (uri) { + const formatting = this.findFormatting(uri); + if (formatting) { + return this.formatUri(uri, formatting); + } + } + return uri && uri.path.fsPath(); + } + + getDetails(element: URI | URIIconReference): string | undefined { + const uri = this.getUri(element); + if (uri) { + return this.getLongName(uri.parent); + } + return this.getLongName(element); + } + + protected getUri(element: URI | URIIconReference): URI | undefined { + return URIIconReference.is(element) ? element.uri : element; + } + + registerFormatter(formatter: ResourceLabelFormatter): Disposable { + this.formatters.push(formatter); + this.fireOnDidChange(); + return Disposable.create(() => { + this.formatters = this.formatters.filter(f => f !== formatter); + this.fireOnDidChange(); + }); + } + + get onDidChange(): Event { + return this.onDidChangeEmitter.event; + } + + private fireOnDidChange(): void { + this.onDidChangeEmitter.fire({ + affects: (element: URI) => this.canHandle(element) > 0 + }); + } + + // copied and modified from https://github.com/microsoft/vscode/blob/1.44.2/src/vs/workbench/services/label/common/labelService.ts + /*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + private readonly labelMatchingRegexp = /\${(scheme|authority|path|query)}/g; + protected formatUri(resource: URI, formatting: ResourceLabelFormatting): string { + let label = formatting.label.replace(this.labelMatchingRegexp, (match, token) => { + switch (token) { + case 'scheme': return resource.scheme; + case 'authority': return resource.authority; + case 'path': return resource.path.toString(); + case 'query': return resource.query; + default: return ''; + } + }); + + // convert \c:\something => C:\something + if (formatting.normalizeDriveLetter && this.hasDriveLetter(label)) { + label = label.charAt(1).toUpperCase() + label.substring(2); + } + + if (formatting.tildify) { + label = Path.tildify(label, this.homePath ? this.homePath : ''); + } + if (formatting.authorityPrefix && resource.authority) { + label = formatting.authorityPrefix + label; + } + + return label.replace(/\//g, formatting.separator); + } + + private hasDriveLetter(path: string): boolean { + return !!(path && path[2] === ':'); + } + + protected findFormatting(resource: URI): ResourceLabelFormatting | undefined { + let bestResult: ResourceLabelFormatter | undefined; + + this.formatters.forEach(formatter => { + if (formatter.scheme === resource.scheme) { + if (!bestResult && !formatter.authority) { + bestResult = formatter; + return; + } + if (!formatter.authority) { + return; + } + + if ((formatter.authority.toLowerCase() === resource.authority.toLowerCase()) && + (!bestResult || !bestResult.authority || formatter.authority.length > bestResult.authority.length || + ((formatter.authority.length === bestResult.authority.length) && formatter.priority))) { + bestResult = formatter; + } + } + }); + + return bestResult ? bestResult.formatting : undefined; + } +} + +/** + * The {@link LabelProvider} determines how elements/nodes are displayed in the workbench. For any element, it can determine a short label, a long label + * and an icon. The {@link LabelProvider} is to be used in lists, trees and tables, but also view specific locations like headers. + * The common {@link LabelProvider} can be extended/adapted via {@link LabelProviderContribution}s. For every element, the {@links LabelProvider} will determine the + * {@link LabelProviderContribution} with the hightest priority and delegate to it. Theia registers default {@link LabelProviderContribution} for common types, e.g. + * the {@link DefaultUriLabelProviderContribution} for elements that have a URI. + * Using the {@link LabelProvider} across the workbench ensures a common look and feel for elements across multiple views. To adapt the way how specific + * elements/nodes are rendered, use a {@link LabelProviderContribution} rather than adapting or sub classing the {@link LabelProvider}. This way, your adaptation + * is applied to all views in Theia that use the {@link LabelProvider} + */ +@injectable() +export class LabelProvider implements FrontendApplicationContribution { + + protected readonly onDidChangeEmitter = new Emitter(); + + @inject(ContributionProvider) @named(LabelProviderContribution) + protected readonly contributionProvider: ContributionProvider; + + /** + * Start listening to contributions. + * + * Don't call this method directly! + * It's called by the frontend application during initialization. + */ + initialize(): void { + const contributions = this.contributionProvider.getContributions(); + for (const eventContribution of contributions) { + if (eventContribution.onDidChange) { + eventContribution.onDidChange(event => { + this.onDidChangeEmitter.fire({ + // TODO check eventContribution.canHandle as well + affects: element => this.affects(element, event) + }); + }); + } + } + } + + protected affects(element: object, event: DidChangeLabelEvent): boolean { + if (event.affects(element)) { + return true; + } + for (const contribution of this.findContribution(element)) { + if (contribution.affects && contribution.affects(element, event)) { + return true; + } + } + return false; + } + + get onDidChange(): Event { + return this.onDidChangeEmitter.event; + } + + /** + * Return a default file icon for the current icon theme. + */ + get fileIcon(): string { + return this.getIcon(URIIconReference.create('file')); + } + + /** + * Return a default folder icon for the current icon theme. + */ + get folderIcon(): string { + return this.getIcon(URIIconReference.create('folder')); + } + + /** + * Get the icon class from the list of available {@link LabelProviderContribution} for the given element. + * @return the icon class + */ + getIcon(element: object): string { + return this.handleRequest(element, 'getIcon') ?? ''; + } + + /** + * Get a short name from the list of available {@link LabelProviderContribution} for the given element. + * @return the short name + */ + getName(element: object): string { + return this.handleRequest(element, 'getName') ?? ''; + } + + /** + * Get a long name from the list of available {@link LabelProviderContribution} for the given element. + * @return the long name + */ + getLongName(element: object): string { + return this.handleRequest(element, 'getLongName') ?? ''; + } + + /** + * Get details from the list of available {@link LabelProviderContribution} for the given element. + * @return the details + * Can be used to supplement {@link getName} in contexts that allow both a primary display field and extra detail. + */ + getDetails(element: object): string { + return this.handleRequest(element, 'getDetails') ?? ''; + } + + protected handleRequest(element: object, method: keyof Omit): string | undefined { + for (const contribution of this.findContribution(element, method)) { + const value = contribution[method]?.(element); + if (value !== undefined) { + return value; + } + } + } + + protected findContribution(element: object, method?: keyof Omit): LabelProviderContribution[] { + const candidates = method + ? this.contributionProvider.getContributions().filter(candidate => candidate[method]) + : this.contributionProvider.getContributions(); + return Prioritizeable.prioritizeAllSync(candidates, contrib => + contrib.canHandle(element) + ).map(entry => entry.value); + } +} diff --git a/packages/core/src/browser/language-icon-provider.ts b/packages/core/src/browser/language-icon-provider.ts new file mode 100644 index 0000000..371695e --- /dev/null +++ b/packages/core/src/browser/language-icon-provider.ts @@ -0,0 +1,55 @@ +// ***************************************************************************** +// Copyright (C) 2023 EclipseSource and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { inject, injectable, postConstruct } from 'inversify'; +import { Emitter, Event } from '../common'; +import { IconThemeService } from './icon-theme-service'; +import { DidChangeLabelEvent, LabelProviderContribution } from './label-provider'; +import { LanguageService } from './language-service'; + +@injectable() +export class LanguageIconLabelProvider implements LabelProviderContribution { + @inject(IconThemeService) protected readonly iconThemeService: IconThemeService; + @inject(LanguageService) protected readonly languageService: LanguageService; + + protected readonly onDidChangeEmitter = new Emitter(); + + @postConstruct() + protected init(): void { + this.languageService.onDidChangeIcon(() => this.fireDidChange()); + } + + canHandle(element: object): number { + const current = this.iconThemeService.getDefinition(this.iconThemeService.current); + return current?.showLanguageModeIcons === true && this.languageService.getIcon(element) ? Number.MAX_SAFE_INTEGER : 0; + } + + getIcon(element: object): string | undefined { + const language = this.languageService.detectLanguage(element); + return this.languageService.getIcon(language!.id); + } + + get onDidChange(): Event { + return this.onDidChangeEmitter.event; + } + + protected fireDidChange(): void { + this.onDidChangeEmitter.fire({ + affects: element => this.canHandle(element) > 0 + }); + } + +} diff --git a/packages/core/src/browser/language-service.ts b/packages/core/src/browser/language-service.ts new file mode 100644 index 0000000..15d36fa --- /dev/null +++ b/packages/core/src/browser/language-service.ts @@ -0,0 +1,77 @@ +// ***************************************************************************** +// Copyright (C) 2020 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { injectable } from 'inversify'; +import { Disposable, Emitter, Event } from '../common'; + +export interface Language { + readonly id: string; + readonly name: string; + readonly extensions: Set; + readonly filenames: Set; + readonly iconClass?: string; +} + +@injectable() +export class LanguageService { + protected readonly onDidChangeIconEmitter = new Emitter(); + + /** + * It should be implemented by an extension, e.g. by the monaco extension. + */ + get languages(): Language[] { + return []; + } + + /** + * It should be implemented by an extension, e.g. by the monaco extension. + */ + getLanguage(languageId: string): Language | undefined { + return undefined; + } + + /** + * It should be implemented by an extension, e.g. by the monaco extension. + */ + detectLanguage(obj: unknown): Language | undefined { + return undefined; + } + + /** + * It should be implemented by an extension, e.g. by the monaco extension. + */ + registerIcon(languageId: string, iconClass: string): Disposable { + return Disposable.NULL; + } + + /** + * It should be implemented by an extension, e.g. by the monaco extension. + */ + getIcon(obj: unknown): string | undefined { + return undefined; + } + + /** + * Emit when the icon of a particular language was changed. + */ + get onDidChangeIcon(): Event { + return this.onDidChangeIconEmitter.event; + } +} + +export interface DidChangeIconEvent { + languageId: string; +} diff --git a/packages/core/src/browser/logger-frontend-module.ts b/packages/core/src/browser/logger-frontend-module.ts new file mode 100644 index 0000000..eb4a463 --- /dev/null +++ b/packages/core/src/browser/logger-frontend-module.ts @@ -0,0 +1,64 @@ +// ***************************************************************************** +// Copyright (C) 2017 Ericsson and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { ContainerModule, Container } from 'inversify'; +import { ILoggerServer, loggerPath, ConsoleLogger } from '../common/logger-protocol'; +import { ILogger, Logger, LoggerFactory, setRootLogger, LoggerName } from '../common/logger'; +import { LoggerWatcher } from '../common/logger-watcher'; +import { WebSocketConnectionProvider } from './messaging'; +import { FrontendApplicationContribution } from './frontend-application-contribution'; +import { EncodingError } from '../common/message-rpc/rpc-message-encoder'; +import { bindCommonLogger } from '../common/logger-binding'; + +export const loggerFrontendModule = new ContainerModule(bind => { + bind(FrontendApplicationContribution).toDynamicValue(ctx => ({ + initialize(): void { + setRootLogger(ctx.container.get(ILogger)); + } + })); + + bindCommonLogger(bind); + bind(ILoggerServer).toDynamicValue(ctx => { + const loggerWatcher = ctx.container.get(LoggerWatcher); + const connection = ctx.container.get(WebSocketConnectionProvider); + const target = connection.createProxy(loggerPath, loggerWatcher.getLoggerClient()); + function get(_: ILoggerServer, property: K): ILoggerServer[K] | ILoggerServer['log'] { + if (property === 'log') { + return (name, logLevel, message, params) => { + ConsoleLogger.log(name, logLevel, message, params); + return target.log(name, logLevel, message, params).catch(err => { + if (err instanceof EncodingError) { + // In case of an EncodingError no RPC call is sent to the backend `ILoggerServer`. Nevertheless, we want to continue normally. + return; + } + throw err; + }); + }; + } + return target[property]; + } + return new Proxy(target, { get }); + }).inSingletonScope(); + bind(LoggerFactory).toFactory(ctx => + (name: string) => { + const child = new Container({ defaultScope: 'Singleton' }); + child.parent = ctx.container; + child.bind(ILogger).to(Logger).inTransientScope(); + child.bind(LoggerName).toConstantValue(name); + return child.get(ILogger); + } + ); +}); diff --git a/packages/core/src/browser/markdown-rendering/markdown-renderer.ts b/packages/core/src/browser/markdown-rendering/markdown-renderer.ts new file mode 100644 index 0000000..9326065 --- /dev/null +++ b/packages/core/src/browser/markdown-rendering/markdown-renderer.ts @@ -0,0 +1,99 @@ +// ***************************************************************************** +// Copyright (C) 2022 Ericsson and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import * as DOMPurify from 'dompurify'; +import { injectable, inject, postConstruct } from 'inversify'; +import * as markdownit from 'markdown-it'; +import * as markdownitemoji from 'markdown-it-emoji'; +import { MarkdownString } from '../../common/markdown-rendering/markdown-string'; +import { Disposable, DisposableGroup } from '../../common'; +import { LabelParser } from '../label-parser'; +import { codicon } from '../widgets'; + +// #region Copied from Copied from https://github.com/microsoft/vscode/blob/7d9b1c37f8e5ae3772782ba3b09d827eb3fdd833/src/vs/base/browser/formattedTextRenderer.ts +export interface ContentActionHandler { + callback: (content: string, event?: MouseEvent | KeyboardEvent) => void; + readonly disposables: DisposableGroup; +} + +export interface FormattedTextRenderOptions { + readonly className?: string; + readonly inline?: boolean; + readonly actionHandler?: ContentActionHandler; + readonly renderCodeSegments?: boolean; +} + +// #endregion + +// #region Copied from Copied from https://github.com/microsoft/vscode/blob/7d9b1c37f8e5ae3772782ba3b09d827eb3fdd833/src/vs/base/browser/markdownRenderer.ts + +export interface MarkdownRenderResult extends Disposable { + element: HTMLElement; +} + +export interface MarkdownRenderOptions extends FormattedTextRenderOptions { + readonly codeBlockRenderer?: (languageId: string, value: string) => Promise; + readonly asyncRenderCallback?: () => void; +} + +// #endregion + +/** Use this directly if you aren't worried about circular dependencies in the Shell */ +export const MarkdownRenderer = Symbol('MarkdownRenderer'); +export interface MarkdownRenderer { + render(markdown: MarkdownString | undefined, options?: MarkdownRenderOptions): MarkdownRenderResult; +} + +/** Use this to avoid circular dependencies in the Shell */ +export const MarkdownRendererFactory = Symbol('MarkdownRendererFactory'); +export interface MarkdownRendererFactory { + (): MarkdownRenderer; +} + +@injectable() +export class MarkdownRendererImpl implements MarkdownRenderer { + @inject(LabelParser) protected readonly labelParser: LabelParser; + protected readonly markdownIt = markdownit().use(markdownitemoji.full); + protected resetRenderer: Disposable | undefined; + + @postConstruct() + protected init(): void { + this.markdownItPlugin(); + } + + render(markdown: MarkdownString | undefined, options?: MarkdownRenderOptions): MarkdownRenderResult { + const host = document.createElement('div'); + if (markdown) { + const html = this.markdownIt.render(markdown.value); + host.innerHTML = DOMPurify.sanitize(html, { + ALLOW_UNKNOWN_PROTOCOLS: true // DOMPurify usually strips non http(s) links from hrefs + }); + } + return { element: host, dispose: () => { } }; + } + + protected markdownItPlugin(): void { + this.markdownIt.renderer.rules.text = (tokens, idx) => { + const content = tokens[idx].content; + return this.labelParser.parse(content).map(chunk => { + if (typeof chunk === 'string') { + return chunk; + } + return ``; + }).join(''); + }; + } +} diff --git a/packages/core/src/browser/markdown-rendering/markdown.spec.tsx b/packages/core/src/browser/markdown-rendering/markdown.spec.tsx new file mode 100644 index 0000000..fdb983a --- /dev/null +++ b/packages/core/src/browser/markdown-rendering/markdown.spec.tsx @@ -0,0 +1,371 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import * as assert from 'assert'; +import * as React from 'react'; +import { createRoot, Root } from 'react-dom/client'; +import { enableJSDOM } from '../test/jsdom'; +import { Markdown, LocalizedMarkdown } from './markdown'; +import { MarkdownRenderer } from './markdown-renderer'; +import { MarkdownString, MarkdownStringImpl } from '../../common/markdown-rendering/markdown-string'; + +let disableJSDOM: () => void; + +describe('Markdown', () => { + let mockRenderer: MarkdownRenderer & { lastRenderedMarkdown?: MarkdownString }; + let container: HTMLElement; + let root: Root; + + before(() => disableJSDOM = enableJSDOM()); + after(() => disableJSDOM()); + + beforeEach(() => { + container = document.createElement('div'); + document.body.appendChild(container); + root = createRoot(container); + + mockRenderer = { + lastRenderedMarkdown: undefined, + render: (markdown: MarkdownString | undefined) => { + // Store the markdown for verification + if (typeof markdown === 'object' && 'value' in markdown) { + mockRenderer.lastRenderedMarkdown = markdown; + } + const div = document.createElement('div'); + if (markdown) { + const p = document.createElement('p'); + const value = typeof markdown === 'object' && 'value' in markdown + ? markdown.value + : String(markdown); + p.textContent = value; + div.appendChild(p); + } + return { + element: div, + dispose: () => { } + }; + } + }; + }); + + afterEach(() => { + root.unmount(); + document.body.removeChild(container); + }); + + it('should render markdown content', done => { + root.render( + + ); + + setTimeout(() => { + const div = container.querySelector('.test-class'); + assert.ok(div, 'Container should exist'); + assert.ok(div?.textContent?.includes('Hello World'), 'Should contain markdown text'); + done(); + }, 50); + }); + + it('should render empty div when markdown is undefined', done => { + root.render( + + ); + + setTimeout(() => { + const div = container.querySelector('.test-class'); + assert.ok(div, 'Container should exist'); + assert.strictEqual(div?.childNodes.length, 0, 'Should have no children'); + done(); + }, 50); + }); + + it('should render empty div when markdown is empty string', done => { + root.render( + + ); + + setTimeout(() => { + const div = container.querySelector('.test-class'); + assert.ok(div, 'Container should exist'); + assert.strictEqual(div?.childNodes.length, 0, 'Should have no children'); + done(); + }, 50); + }); + + it('should render empty div when markdown is whitespace only', done => { + root.render( + + ); + + setTimeout(() => { + const div = container.querySelector('.test-class'); + assert.ok(div, 'Container should exist'); + assert.strictEqual(div?.childNodes.length, 0, 'Should have no children'); + done(); + }, 50); + }); + + it('should accept MarkdownString object', done => { + const markdownString = new MarkdownStringImpl('**Bold Text**'); + root.render( + + ); + + setTimeout(() => { + const div = container.querySelector('.test-class'); + assert.ok(div, 'Container should exist'); + assert.ok(div?.textContent?.includes('Bold Text'), 'Should contain markdown text'); + done(); + }, 50); + }); + + it('should call onRender callback when content is rendered', done => { + let renderCallbackCalled = false; + let receivedElement: HTMLElement | undefined; + + root.render( + { + renderCallbackCalled = true; + receivedElement = element; + }} + /> + ); + + setTimeout(() => { + assert.ok(renderCallbackCalled, 'onRender should be called'); + assert.ok(receivedElement, 'Should receive element'); + done(); + }, 50); + }); + + it('should call onRender callback with undefined when content is empty', done => { + let renderCallbackCalled = false; + let receivedElement: HTMLElement | undefined = document.createElement('div'); // Initialize to non-undefined + + root.render( + { + renderCallbackCalled = true; + receivedElement = element; + }} + /> + ); + + setTimeout(() => { + assert.ok(renderCallbackCalled, 'onRender should be called even for empty content'); + assert.strictEqual(receivedElement, undefined, 'Should receive undefined for empty content'); + done(); + }, 100); + }); + + it('should apply className to container', done => { + root.render( + + ); + + setTimeout(() => { + const div = container.querySelector('.custom-class'); + assert.ok(div, 'Container with custom class should exist'); + done(); + }, 50); + }); +}); + +describe('LocalizedMarkdown', () => { + let mockRenderer: MarkdownRenderer & { lastRenderedMarkdown?: MarkdownString }; + let container: HTMLElement; + let root: Root; + + before(() => disableJSDOM = enableJSDOM()); + after(() => disableJSDOM()); + + beforeEach(() => { + container = document.createElement('div'); + document.body.appendChild(container); + root = createRoot(container); + + mockRenderer = { + lastRenderedMarkdown: undefined, + render: (markdown: MarkdownString | undefined) => { + // Store the markdown for verification + if (typeof markdown === 'object' && 'value' in markdown) { + mockRenderer.lastRenderedMarkdown = markdown; + } + const div = document.createElement('div'); + if (markdown) { + const p = document.createElement('p'); + const value = typeof markdown === 'object' && 'value' in markdown + ? markdown.value + : String(markdown); + p.textContent = value; + div.appendChild(p); + } + return { + element: div, + dispose: () => { } + }; + } + }; + }); + + afterEach(() => { + root.unmount(); + document.body.removeChild(container); + }); + + it('should render localized markdown content', done => { + root.render( + + ); + + setTimeout(() => { + const div = container.querySelector('.test-class'); + assert.ok(div, 'Container should exist'); + // The content should be localized (though in tests it will be the default) + assert.ok(div?.textContent?.includes('Theia'), 'Should contain localized text'); + done(); + }, 50); + }); + + it('should render localized markdown with parameters', done => { + root.render( + + ); + + setTimeout(() => { + const div = container.querySelector('.test-class'); + assert.ok(div, 'Container should exist'); + assert.ok(div?.textContent?.includes('Alice'), 'Should contain first parameter'); + assert.ok(div?.textContent?.includes('5'), 'Should contain second parameter'); + done(); + }, 50); + }); + + it('should render empty div when default markdown is empty', done => { + root.render( + + ); + + setTimeout(() => { + const div = container.querySelector('.test-class'); + assert.ok(div, 'Container should exist'); + assert.strictEqual(div?.childNodes.length, 0, 'Should have no children'); + done(); + }, 50); + }); + + it('should update when localization key changes', done => { + const { rerender } = { rerender: (element: React.ReactElement) => root.render(element) }; + + root.render( + + ); + + setTimeout(() => { + const div = container.querySelector('.test-class'); + assert.ok(div?.textContent?.includes('First'), 'Should contain first content'); + + rerender( + + ); + + setTimeout(() => { + const updatedDiv = container.querySelector('.test-class'); + assert.ok(updatedDiv?.textContent?.includes('Second'), 'Should contain second content'); + done(); + }, 50); + }, 50); + }); + + it('should pass markdown options correctly', done => { + root.render( + + ); + + setTimeout(() => { + const div = container.querySelector('.test-class'); + assert.ok(div, 'Container should exist'); + assert.ok(mockRenderer.lastRenderedMarkdown, 'Should have rendered markdown'); + assert.strictEqual(mockRenderer.lastRenderedMarkdown?.supportHtml, true, 'Should pass supportHtml option'); + assert.strictEqual(mockRenderer.lastRenderedMarkdown?.supportThemeIcons, true, 'Should pass supportThemeIcons option'); + assert.strictEqual(mockRenderer.lastRenderedMarkdown?.isTrusted, true, 'Should pass isTrusted option'); + done(); + }, 50); + }); +}); diff --git a/packages/core/src/browser/markdown-rendering/markdown.tsx b/packages/core/src/browser/markdown-rendering/markdown.tsx new file mode 100644 index 0000000..70e7845 --- /dev/null +++ b/packages/core/src/browser/markdown-rendering/markdown.tsx @@ -0,0 +1,282 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import * as React from 'react'; +import { MarkdownRenderer, MarkdownRenderResult } from './markdown-renderer'; +import { MarkdownString, MarkdownStringImpl } from '../../common/markdown-rendering/markdown-string'; +import { nls } from '../../common/nls'; +import { FormatType } from '../../common/i18n/localization'; + +export interface MarkdownProps { + /** + * The markdown content to render. Can be a string, a MarkdownString, or undefined. + * If undefined or empty, an empty div will be rendered. + */ + markdown?: string | MarkdownString; + + /** + * The MarkdownRenderer instance to use for rendering. + */ + markdownRenderer: MarkdownRenderer; + + /** + * Additional CSS class name(s) to apply to the container element. + */ + className?: string; + + /** + * Options to pass to MarkdownStringImpl if markdown is a string. + * Common options include: + * - supportHtml: Allow HTML in markdown (default: false) + * - supportThemeIcons: Allow theme icons (default: false) + * - isTrusted: Trust level for command execution (default: false) + */ + markdownOptions?: { + supportHtml?: boolean; + supportThemeIcons?: boolean; + isTrusted?: boolean | { enabledCommands: string[] }; + }; + + /** + * Optional callback that receives the rendered HTML element. + * Useful for post-processing or adding event listeners. + * Receives undefined when content is empty. + */ + onRender?: (element: HTMLElement | undefined) => void; +} + +/** + * A React component for rendering markdown content. + * + * @example Basic usage + * ```tsx + * const MyComponent = ({ markdownRenderer }: { markdownRenderer: MarkdownRenderer }) => { + * return ( + * + * ); + * }; + * ``` + * + * @example With localized content + * ```tsx + * const MyComponent = ({ markdownRenderer }: { markdownRenderer: MarkdownRenderer }) => { + * const content = nls.localize('my.key', 'Hello **{0}**!', 'World'); + * + * return ( + * + * ); + * }; + * ``` + * + * @example With command links + * ```tsx + * const content = nls.localize( + * 'my.key', + * 'Open [settings]({0}) to configure.', + * `command:${CommonCommands.OPEN_PREFERENCES.id}` + * ); + * + * return ( + * + * ); + * ``` + */ +const MarkdownComponent: React.FC = ({ + markdown, + markdownRenderer, + className, + markdownOptions, + onRender +}) => { + const ref = useMarkdown(markdown, markdownRenderer, markdownOptions, onRender); + return
    ; +}; +MarkdownComponent.displayName = 'Markdown'; + +export const Markdown = React.memo(MarkdownComponent); + +/** + * A React hook for rendering markdown content. + * + * This hook integrates MarkdownRenderer with React's lifecycle, + * ensuring that: + * - Markdown is rendered only when content or renderer changes + * - MarkdownRenderResult is properly disposed when component unmounts + * - DOM elements are correctly managed by React + * - Event listeners and other imperative DOM operations are preserved + * + * Returns a ref that should be attached to a DOM element. + * + * @example Basic usage + * ```tsx + * const MyComponent = ({ markdownRenderer }: { markdownRenderer: MarkdownRenderer }) => { + * const ref = useMarkdown('Hello **World**!', markdownRenderer, { supportHtml: true }); + * return
    ; + * }; + * ``` + * + * @example With localized content + * ```tsx + * const MyComponent = ({ markdownRenderer }: { markdownRenderer: MarkdownRenderer }) => { + * const content = nls.localize('my.key', 'Hello **{0}**!', 'World'); + * const ref = useMarkdown(content, markdownRenderer); + * return
    ; + * }; + * ``` + */ +export function useMarkdown( + markdown: string | MarkdownString | undefined, + markdownRenderer: MarkdownRenderer, + markdownOptions?: MarkdownProps['markdownOptions'], + onRender?: (element: HTMLElement | undefined) => void +): React.RefObject { + // eslint-disable-next-line no-null/no-null + const containerRef = React.useRef(null); + const renderResultRef = React.useRef(); + + const renderedElement = React.useMemo(() => { + renderResultRef.current?.dispose(); + renderResultRef.current = undefined; + + if (!markdown || (typeof markdown === 'string' && markdown.trim() === '')) { + return undefined; + } + + const markdownString = typeof markdown === 'string' + ? new MarkdownStringImpl(markdown, markdownOptions) + : markdown; + + const rendered = markdownRenderer.render(markdownString); + renderResultRef.current = rendered; + + return rendered.element; + }, [markdown, markdownRenderer, markdownOptions]); + + React.useEffect(() => { + if (containerRef.current && renderedElement) { + containerRef.current.replaceChildren(renderedElement); + onRender?.(renderedElement); + } else if (containerRef.current && !renderedElement) { + containerRef.current.replaceChildren(); + onRender?.(undefined); + } + }, [renderedElement, onRender]); + + React.useEffect(() => () => { + renderResultRef.current?.dispose(); + }, []); + + return containerRef; +} + +export interface LocalizedMarkdownProps extends MarkdownProps { + /** + * The localization key for the markdown content. + */ + localizationKey: string; + + /** + * The default markdown content (in English) with placeholders. + * Use {0}, {1}, etc. for parameter substitution. + */ + defaultMarkdown: string; + + /** + * Arguments to substitute into the markdown template. + * Can be strings, numbers, booleans, or undefined. + */ + args?: FormatType[]; +} + +/** + * A React component that combines localization with markdown rendering. + * + * This component automatically handles the localization of markdown content using `nls.localize` + * and then renders it using the Markdown component. + * + * @example Basic usage + * ```tsx + * + * ``` + * + * @example With parameters + * ```tsx + * + * ``` + * + * @example With command links + * ```tsx + * + * ``` + */ +export const LocalizedMarkdown: React.FC = ({ + localizationKey, + defaultMarkdown, + args = [], + markdownRenderer, + className, + markdownOptions, + onRender +}) => { + const localizedMarkdown = React.useMemo( + () => nls.localize(localizationKey, defaultMarkdown, ...args), + [localizationKey, defaultMarkdown, ...args] + ); + + return ( + + ); +}; +LocalizedMarkdown.displayName = 'LocalizedMarkdown'; diff --git a/packages/core/src/browser/menu/action-menu-node.ts b/packages/core/src/browser/menu/action-menu-node.ts new file mode 100644 index 0000000..6b7e912 --- /dev/null +++ b/packages/core/src/browser/menu/action-menu-node.ts @@ -0,0 +1,128 @@ +// ***************************************************************************** +// Copyright (C) 2022 Ericsson and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { KeybindingRegistry } from '../keybinding'; +import { ContextKeyService } from '../context-key-service'; +import { DisposableCollection, isObject, CommandRegistry, Emitter } from '../../common'; +import { CommandMenu, ContextExpressionMatcher, MenuAction, MenuPath } from '../../common/menu/menu-types'; + +export interface AcceleratorSource { + getAccelerator(context: HTMLElement | undefined): string[]; +} + +export namespace AcceleratorSource { + export function is(node: unknown): node is AcceleratorSource { + return isObject(node) && typeof node.getAccelerator === 'function'; + } +} + +/** + * Node representing an action in the menu tree structure. + * It's based on {@link MenuAction} for which it tries to determine the + * best label, icon and sortString with the given data. + */ +export class ActionMenuNode implements CommandMenu { + + protected readonly disposables = new DisposableCollection(); + protected readonly onDidChangeEmitter = new Emitter(); + + onDidChange = this.onDidChangeEmitter.event; + + constructor( + protected readonly action: MenuAction, + protected readonly commands: CommandRegistry, + protected readonly keybindingRegistry: KeybindingRegistry, + protected readonly contextKeyService: ContextKeyService + ) { + this.commands.getAllHandlers(action.commandId).forEach(handler => { + if (handler.onDidChangeEnabled) { + this.disposables.push(handler.onDidChangeEnabled(() => this.onDidChangeEmitter.fire())); + } + }); + + if (action.when) { + const contextKeys = new Set(); + this.contextKeyService.parseKeys(action.when)?.forEach(key => contextKeys.add(key)); + if (contextKeys.size > 0) { + this.disposables.push(this.contextKeyService.onDidChange(change => { + if (change.affects(contextKeys)) { + this.onDidChangeEmitter.fire(); + } + })); + } + } + } + + dispose(): void { + this.disposables.dispose(); + } + + isVisible(effeciveMenuPath: MenuPath, contextMatcher: ContextExpressionMatcher, context: T | undefined, ...args: unknown[]): boolean { + if (!this.commands.isVisible(this.action.commandId, ...args)) { + return false; + } + if (this.action.when) { + return contextMatcher.match(this.action.when, context); + } + return true; + } + + getAccelerator(context: HTMLElement | undefined): string[] { + const bindings = this.keybindingRegistry.getKeybindingsForCommand(this.action.commandId); + // Only consider the first active keybinding. + if (bindings.length) { + const binding = bindings.find(b => this.keybindingRegistry.isEnabledInScope(b, context)); + if (binding) { + return this.keybindingRegistry.acceleratorFor(binding, '+', true); + } + } + return []; + } + + isEnabled(effeciveMenuPath: MenuPath, ...args: unknown[]): boolean { + return this.commands.isEnabled(this.action.commandId, ...args); + } + isToggled(effeciveMenuPath: MenuPath, ...args: unknown[]): boolean { + return this.commands.isToggled(this.action.commandId, ...args); + } + async run(effeciveMenuPath: MenuPath, ...args: unknown[]): Promise { + return this.commands.executeCommand(this.action.commandId, ...args); + } + + get id(): string { return this.action.commandId; } + + get label(): string { + if (this.action.label) { + return this.action.label; + } + const cmd = this.commands.getCommand(this.action.commandId); + if (!cmd) { + console.debug(`No label for action menu node: No command "${this.action.commandId}" exists.`); + return ''; + } + return cmd.label || cmd.id; + } + + get icon(): string | undefined { + if (this.action.icon) { + return this.action.icon; + } + const command = this.commands.getCommand(this.action.commandId); + return command && command.iconClass; + } + + get sortString(): string { return this.action.order || this.label; } +} diff --git a/packages/core/src/browser/menu/browser-context-menu-renderer.ts b/packages/core/src/browser/menu/browser-context-menu-renderer.ts new file mode 100644 index 0000000..2c88296 --- /dev/null +++ b/packages/core/src/browser/menu/browser-context-menu-renderer.ts @@ -0,0 +1,54 @@ +// ***************************************************************************** +// Copyright (C) 2017 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { inject, injectable } from 'inversify'; +import { Menu } from '../widgets'; +import { Anchor, ContextMenuAccess, ContextMenuRenderer, coordinateFromAnchor } from '../context-menu-renderer'; +import { BrowserMainMenuFactory } from './browser-menu-plugin'; +import { ContextMatcher } from '../context-key-service'; +import { CompoundMenuNode, MenuPath } from '../../common'; + +export class BrowserContextMenuAccess extends ContextMenuAccess { + constructor( + public readonly menu: Menu + ) { + super(menu); + } +} + +@injectable() +export class BrowserContextMenuRenderer extends ContextMenuRenderer { + @inject(BrowserMainMenuFactory) private menuFactory: BrowserMainMenuFactory; + + protected doRender(params: { + menuPath: MenuPath, + menu: CompoundMenuNode, + anchor: Anchor, + contextMatcher: ContextMatcher, + args?: unknown[], + context?: HTMLElement, + onHide?: () => void + }): ContextMenuAccess { + const contextMenu = this.menuFactory.createContextMenu(params.menuPath, params.menu, params.contextMatcher, params.args, params.context); + const { x, y } = coordinateFromAnchor(params.anchor); + if (params.onHide) { + contextMenu.aboutToClose.connect(() => params.onHide!()); + } + contextMenu.open(x, y, { host: params.context?.ownerDocument.body }); + return new BrowserContextMenuAccess(contextMenu); + } + +} diff --git a/packages/core/src/browser/menu/browser-menu-module.ts b/packages/core/src/browser/menu/browser-menu-module.ts new file mode 100644 index 0000000..b65a894 --- /dev/null +++ b/packages/core/src/browser/menu/browser-menu-module.ts @@ -0,0 +1,32 @@ +// ***************************************************************************** +// Copyright (C) 2017 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { ContainerModule } from 'inversify'; +import { FrontendApplicationContribution } from '../frontend-application-contribution'; +import { ContextMenuRenderer } from '../context-menu-renderer'; +import { BrowserMenuBarContribution, BrowserMainMenuFactory } from './browser-menu-plugin'; +import { BrowserContextMenuRenderer } from './browser-context-menu-renderer'; +import { BrowserMenuNodeFactory } from './browser-menu-node-factory'; +import { MenuNodeFactory } from '../../common'; + +export default new ContainerModule(bind => { + bind(BrowserMainMenuFactory).toSelf().inSingletonScope(); + bind(ContextMenuRenderer).to(BrowserContextMenuRenderer).inSingletonScope(); + bind(BrowserMenuBarContribution).toSelf().inSingletonScope(); + bind(FrontendApplicationContribution).toService(BrowserMenuBarContribution); + bind(BrowserMenuNodeFactory).toSelf().inSingletonScope(); + bind(MenuNodeFactory).toService(BrowserMenuNodeFactory); +}); diff --git a/packages/core/src/browser/menu/browser-menu-node-factory.ts b/packages/core/src/browser/menu/browser-menu-node-factory.ts new file mode 100644 index 0000000..8572e0a --- /dev/null +++ b/packages/core/src/browser/menu/browser-menu-node-factory.ts @@ -0,0 +1,48 @@ +// ***************************************************************************** +// Copyright (C) 2024 STMicroelectronics and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { injectable, inject } from 'inversify'; +import { + ActionMenuNode, CommandMenu, CommandRegistry, Group, GroupImpl, MenuAction, MenuNode, MenuNodeFactory, + MutableCompoundMenuNode, SubMenuLink, Submenu, SubmenuImpl +} from '../../common'; +import { ContextKeyService } from '../context-key-service'; +import { KeybindingRegistry } from '../keybinding'; + +@injectable() +export class BrowserMenuNodeFactory implements MenuNodeFactory { + @inject(ContextKeyService) + protected readonly contextKeyService: ContextKeyService; + @inject(CommandRegistry) + protected readonly commandRegistry: CommandRegistry; + @inject(KeybindingRegistry) + protected readonly keybindingRegistry: KeybindingRegistry; + + createGroup(id: string, orderString?: string, when?: string): Group & MutableCompoundMenuNode { + return new GroupImpl(id, orderString, when); + } + + createCommandMenu(item: MenuAction): CommandMenu { + return new ActionMenuNode(item, this.commandRegistry, this.keybindingRegistry, this.contextKeyService); + } + createSubmenu(id: string, label: string, contextKeyOverlays: Record | undefined, orderString?: string, icon?: string, when?: string): + Submenu & MutableCompoundMenuNode { + return new SubmenuImpl(id, label, contextKeyOverlays, orderString, icon, when); + } + createSubmenuLink(delegate: Submenu, sortString?: string, when?: string): MenuNode { + return new SubMenuLink(delegate, sortString, when); + } +} diff --git a/packages/core/src/browser/menu/browser-menu-plugin.ts b/packages/core/src/browser/menu/browser-menu-plugin.ts new file mode 100644 index 0000000..f7dbc56 --- /dev/null +++ b/packages/core/src/browser/menu/browser-menu-plugin.ts @@ -0,0 +1,457 @@ +// ***************************************************************************** +// Copyright (C) 2017 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { injectable, inject } from 'inversify'; +import { Menu, MenuBar, Menu as MenuWidget, Widget } from '@lumino/widgets'; +import { CommandRegistry as LuminoCommandRegistry } from '@lumino/commands'; +import { + environment, DisposableCollection, + AcceleratorSource, + ArrayUtils, + PreferenceService +} from '../../common'; +import { KeybindingRegistry } from '../keybinding'; +import { FrontendApplication } from '../frontend-application'; +import { FrontendApplicationContribution } from '../frontend-application-contribution'; +import { ContextKeyService, ContextMatcher } from '../context-key-service'; +import { ContextMenuContext } from './context-menu-context'; +import { Message, waitForRevealed } from '../widgets'; +import { ApplicationShell } from '../shell'; +import { CorePreferences } from '../../common/core-preferences'; +import { ElementExt } from '@lumino/domutils'; +import { CommandMenu, CompoundMenuNode, MAIN_MENU_BAR, MenuNode, MenuPath, RenderedMenuNode, Submenu } from '../../common/menu/menu-types'; +import { MenuModelRegistry } from '../../common/menu/menu-model-registry'; + +export abstract class MenuBarWidget extends MenuBar { + abstract activateMenu(label: string, ...labels: string[]): Promise; + abstract triggerMenuItem(label: string, ...labels: string[]): Promise; +} + +export interface BrowserMenuOptions extends MenuWidget.IOptions { + context?: HTMLElement, +}; + +@injectable() +export class BrowserMainMenuFactory implements MenuWidgetFactory { + + @inject(ContextKeyService) + protected readonly contextKeyService: ContextKeyService; + + @inject(ContextMenuContext) + protected readonly context: ContextMenuContext; + + @inject(CorePreferences) + protected readonly corePreferences: CorePreferences; + + @inject(KeybindingRegistry) + protected readonly keybindingRegistry: KeybindingRegistry; + + @inject(MenuModelRegistry) + protected readonly menuProvider: MenuModelRegistry; + + createMenuBar(): MenuBarWidget { + const menuBar = new DynamicMenuBarWidget(); + menuBar.id = 'theia:menubar'; + this.corePreferences.ready.then(() => { + this.showMenuBar(menuBar); + }); + const disposable = new DisposableCollection( + this.corePreferences.onPreferenceChanged(change => { + if (change.preferenceName === 'window.menuBarVisibility') { + this.showMenuBar(menuBar, this.corePreferences['window.menuBarVisibility']); + } + }), + this.keybindingRegistry.onKeybindingsChanged(() => { + this.showMenuBar(menuBar); + }), + this.menuProvider.onDidChange(evt => { + if (ArrayUtils.startsWith(evt.path, MAIN_MENU_BAR)) { + this.showMenuBar(menuBar); + } + }) + ); + menuBar.disposed.connect(() => disposable.dispose()); + return menuBar; + } + + protected getMenuBarVisibility(): string { + return this.corePreferences.get('window.menuBarVisibility', 'classic'); + } + + protected showMenuBar(menuBar: DynamicMenuBarWidget, preference = this.getMenuBarVisibility()): void { + if (preference && ['classic', 'visible'].includes(preference)) { + menuBar.clearMenus(); + this.fillMenuBar(menuBar); + } else { + menuBar.clearMenus(); + } + } + + protected fillMenuBar(menuBar: MenuBarWidget): void { + const menuModel = this.menuProvider.getMenuNode(MAIN_MENU_BAR) as Submenu; + const menuCommandRegistry = new LuminoCommandRegistry(); + for (const menu of menuModel.children) { + if (CompoundMenuNode.is(menu) && RenderedMenuNode.is(menu)) { + const menuWidget = this.createMenuWidget(MAIN_MENU_BAR, menu, this.contextKeyService, { commands: menuCommandRegistry }); + menuBar.addMenu(menuWidget); + } + } + } + + createContextMenu(effectiveMenuPath: MenuPath, menuModel: CompoundMenuNode, contextMatcher: ContextMatcher, args?: unknown[], context?: HTMLElement): MenuWidget { + const menuCommandRegistry = new LuminoCommandRegistry(); + const contextMenu = this.createMenuWidget(effectiveMenuPath, menuModel, contextMatcher, { commands: menuCommandRegistry, context }, args); + return contextMenu; + } + + createMenuWidget(parentPath: MenuPath, menu: CompoundMenuNode, contextMatcher: ContextMatcher, options: BrowserMenuOptions, args?: unknown[]): DynamicMenuWidget { + return new DynamicMenuWidget(parentPath, menu, options, contextMatcher, this.services, args); + } + + protected get services(): MenuServices { + return { + contextKeyService: this.contextKeyService, + context: this.context, + menuWidgetFactory: this, + }; + } + +} + +export function isMenuElement(element: HTMLElement | null): boolean { + return !!element && element.className.includes('lm-Menu'); +} + +export class DynamicMenuBarWidget extends MenuBarWidget { + + /** + * We want to restore the focus after the menu closes. + */ + protected previousFocusedElement: HTMLElement | undefined; + + constructor() { + super(); + // HACK we need to hook in on private method _openChildMenu. Don't do this at home! + DynamicMenuBarWidget.prototype['_openChildMenu'] = () => { + if (this.activeMenu instanceof DynamicMenuWidget) { + // `childMenu` is `null` if we open the menu. For example, menu is not shown and you click on `Edit`. + // However, the `childMenu` is set, when `Edit` was already open and you move the mouse over `Select`. + // We want to save the focus object for the former case only. + if (!this.childMenu) { + const { activeElement } = document; + // we do not want to restore focus to menus + if (activeElement instanceof HTMLElement && !isMenuElement(activeElement)) { + this.previousFocusedElement = activeElement; + } + } + this.activeMenu.aboutToShow({ previousFocusedElement: this.previousFocusedElement }); + } + super['_openChildMenu'](); + }; + } + + async activateMenu(label: string, ...labels: string[]): Promise { + const menu = this.menus.find(m => m.title.label === label); + if (!menu) { + throw new Error(`could not find '${label}' menu`); + } + this.activeMenu = menu; + this.openActiveMenu(); + await waitForRevealed(menu); + + const menuPath = [label, ...labels]; + + let current = menu; + for (const itemLabel of labels) { + const item = current.items.find(i => i.label === itemLabel); + if (!item || !item.submenu) { + throw new Error(`could not find '${itemLabel}' submenu in ${menuPath.map(l => "'" + l + "'").join(' -> ')} menu`); + } + current.activeItem = item; + current.triggerActiveItem(); + current = item.submenu; + await waitForRevealed(current); + } + return current; + } + + async triggerMenuItem(label: string, ...labels: string[]): Promise { + if (!labels.length) { + throw new Error('menu item label is not specified'); + } + const menuPath = [label, ...labels.slice(0, labels.length - 1)]; + const menu = await this.activateMenu(menuPath[0], ...menuPath.slice(1)); + const item = menu.items.find(i => i.label === labels[labels.length - 1]); + if (!item) { + throw new Error(`could not find '${labels[labels.length - 1]}' item in ${menuPath.map(l => "'" + l + "'").join(' -> ')} menu`); + } + menu.activeItem = item; + menu.triggerActiveItem(); + return item; + } + +} + +export class MenuServices { + readonly contextKeyService: ContextKeyService; + readonly context: ContextMenuContext; + readonly menuWidgetFactory: MenuWidgetFactory; +} + +export interface MenuWidgetFactory { + createMenuWidget(effectiveMenuPath: MenuPath, menu: Submenu, contextMatcher: ContextMatcher, options: BrowserMenuOptions, args?: unknown[]): MenuWidget; +} + +/** + * A menu widget that would recompute its items on update. + */ +export class DynamicMenuWidget extends MenuWidget { + private static nextCommmandId = 0; + /** + * We want to restore the focus after the menu closes. + */ + protected previousFocusedElement: HTMLElement | undefined; + + constructor( + protected readonly effectiveMenuPath: MenuPath, + protected menu: CompoundMenuNode, + protected options: BrowserMenuOptions, + protected contextMatcher: ContextMatcher, + protected services: MenuServices, + protected args?: unknown[] + ) { + super(options); + if (RenderedMenuNode.is(this.menu)) { + if (this.menu.label) { + this.title.label = this.menu.label; + } + if (this.menu.icon) { + this.title.iconClass = this.menu.icon; + } + } + this.updateSubMenus(this.effectiveMenuPath, this, this.menu, this.options.commands, this.contextMatcher, this.options.context); + } + + protected override onAfterAttach(msg: Message): void { + super.onAfterAttach(msg); + this.node.ownerDocument.addEventListener('pointerdown', this, true); + } + + protected override onBeforeDetach(msg: Message): void { + this.node.ownerDocument.removeEventListener('pointerdown', this, true); + super.onBeforeDetach(msg); + } + + override handleEvent(event: Event): void { + if (event.type === 'pointerdown') { + this.handlePointerDown(event as PointerEvent); + } + super.handleEvent(event); + } + + handlePointerDown(event: PointerEvent): void { + // this code is copied from the superclass because we cannot use the hit + // test from the "Private" implementation namespace + if (this['_parentMenu']) { + return; + } + + // The mouse button which is pressed is irrelevant. If the press + // is not on a menu, the entire hierarchy is closed and the event + // is allowed to propagate. This allows other code to act on the + // event, such as focusing the clicked element. + if (!this.hitTestMenus(this, event.clientX, event.clientY)) { + this.close(); + } + } + + private hitTestMenus(menu: Menu, x: number, y: number): boolean { + for (let temp: Menu | null = menu; temp; temp = temp.childMenu) { + if (ElementExt.hitTest(temp.node, x, y)) { + return true; + } + } + return false; + } + + public aboutToShow({ previousFocusedElement }: { previousFocusedElement: HTMLElement | undefined }): void { + this.preserveFocusedElement(previousFocusedElement); + this.clearItems(); + this.runWithPreservedFocusContext(() => { + this.updateSubMenus(this.effectiveMenuPath, this, this.menu, this.options.commands, this.contextMatcher, this.options.context); + }); + } + + public override open(x: number, y: number, options?: MenuWidget.IOpenOptions): void { + const cb = () => { + this.restoreFocusedElement(); + this.aboutToClose.disconnect(cb); + }; + this.aboutToClose.connect(cb); + this.preserveFocusedElement(); + super.open(x, y, options); + } + + protected updateSubMenus(parentPath: MenuPath, parent: MenuWidget, menu: CompoundMenuNode, commands: LuminoCommandRegistry, + contextMatcher: ContextMatcher, context?: HTMLElement | undefined): void { + const items = this.createItems(parentPath, menu.children, commands, contextMatcher, context); + while (items[items.length - 1]?.type === 'separator') { + items.pop(); + } + for (const item of items) { + parent.addItem(item); + } + } + + protected createItems(parentPath: MenuPath, nodes: MenuNode[], phCommandRegistry: LuminoCommandRegistry, + contextMatcher: ContextMatcher, context?: HTMLElement): MenuWidget.IItemOptions[] { + const result: MenuWidget.IItemOptions[] = []; + + for (const node of nodes) { + const nodePath = node.effectiveMenuPath || [...parentPath, node.id]; + if (node.isVisible(nodePath, contextMatcher, context, ...(this.args || []))) { + if (CompoundMenuNode.is(node)) { + if (RenderedMenuNode.is(node)) { + const submenu = this.services.menuWidgetFactory.createMenuWidget(nodePath, node, this.contextMatcher, this.options, this.args); + if (submenu.items.length > 0) { + result.push({ type: 'submenu', submenu }); + } + } else if (node.id !== 'inline') { + const items = this.createItems(nodePath, node.children, phCommandRegistry, contextMatcher, context); + if (items.length > 0) { + if (result[result.length - 1]?.type !== 'separator') { + result.push({ type: 'separator' }); + } + result.push(...items); + result.push({ type: 'separator' }); + } + } + + } else if (CommandMenu.is(node)) { + const id = !phCommandRegistry.hasCommand(node.id) ? node.id : `${node.id}:${DynamicMenuWidget.nextCommmandId++}`; + const enabled = node.isEnabled(nodePath, ...(this.args || [])); + const toggled = node.isToggled ? !!node.isToggled(nodePath, ...(this.args || [])) : false; + phCommandRegistry.addCommand(id, { + execute: () => { node.run(nodePath, ...(this.args || [])); }, + isEnabled: () => enabled, + isToggled: () => toggled, + isVisible: () => true, + label: node.label, + iconClass: node.icon, + }); + + const accelerator = (AcceleratorSource.is(node) ? node.getAccelerator(this.options.context) : []); + if (accelerator.length > 0) { + phCommandRegistry.addKeyBinding({ + command: id, + keys: accelerator, + selector: '.p-Widget' // We have the PhosphorJS dependency anyway. + }); + } + result.push({ + command: id, + type: 'command' + }); + } + } + } + return result; + } + + protected preserveFocusedElement(previousFocusedElement: Element | null = document.activeElement): boolean { + if (!this.previousFocusedElement && previousFocusedElement instanceof HTMLElement && !isMenuElement(previousFocusedElement)) { + this.previousFocusedElement = previousFocusedElement; + return true; + } + return false; + } + + protected restoreFocusedElement(): boolean { + if (this.previousFocusedElement) { + this.previousFocusedElement.focus({ preventScroll: true }); + this.previousFocusedElement = undefined; + return true; + } + return false; + } + + protected runWithPreservedFocusContext(what: () => void): void { + let focusToRestore: HTMLElement | undefined = undefined; + const { activeElement } = document; + if (this.previousFocusedElement && + activeElement instanceof HTMLElement && + this.previousFocusedElement !== activeElement) { + focusToRestore = activeElement; + this.previousFocusedElement.focus({ preventScroll: true }); + } + try { + what(); + } finally { + if (focusToRestore && !isMenuElement(focusToRestore)) { + focusToRestore.focus({ preventScroll: true }); + } + } + } + +} + +@injectable() +export class BrowserMenuBarContribution implements FrontendApplicationContribution { + + @inject(ApplicationShell) + protected readonly shell: ApplicationShell; + + @inject(PreferenceService) + protected readonly preferenceService: PreferenceService; + + constructor( + @inject(BrowserMainMenuFactory) protected readonly factory: BrowserMainMenuFactory + ) { } + + onStart(app: FrontendApplication): void { + this.appendMenu(app.shell); + } + + get menuBar(): MenuBarWidget | undefined { + return this.shell.topPanel.widgets.find(w => w instanceof MenuBarWidget) as MenuBarWidget | undefined; + } + + protected appendMenu(shell: ApplicationShell): void { + const logo = this.createLogo(); + shell.addWidget(logo, { area: 'top' }); + const menu = this.factory.createMenuBar(); + shell.addWidget(menu, { area: 'top' }); + // Hiding the menu is only necessary in electron + // In the browser we hide the whole top panel + if (environment.electron.is()) { + this.preferenceService.ready.then(() => { + menu.setHidden(['compact', 'hidden'].includes(this.preferenceService.get('window.menuBarVisibility', ''))); + }); + this.preferenceService.onPreferenceChanged(change => { + if (change.preferenceName === 'window.menuBarVisibility') { + menu.setHidden(['compact', 'hidden'].includes(this.preferenceService.get('window.menuBarVisibility', 'classic'))); + } + }); + } + } + + protected createLogo(): Widget { + const logo = new Widget(); + logo.id = 'theia:icon'; + logo.addClass('theia-icon'); + return logo; + } +} diff --git a/packages/core/src/browser/menu/composite-menu-node.ts b/packages/core/src/browser/menu/composite-menu-node.ts new file mode 100644 index 0000000..be21458 --- /dev/null +++ b/packages/core/src/browser/menu/composite-menu-node.ts @@ -0,0 +1,140 @@ +// ***************************************************************************** +// Copyright (C) 2022 Ericsson and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { CompoundMenuNode, ContextExpressionMatcher, Group, MenuNode, MenuPath, Submenu } from '../../common/menu/menu-types'; +import { Event } from '../../common'; + +export class SubMenuLink implements CompoundMenuNode { + constructor(private readonly delegate: Submenu, private readonly _sortString?: string, private readonly _when?: string) { } + + get id(): string { return this.delegate.id; }; + get onDidChange(): Event | undefined { return this.delegate.onDidChange; }; + get children(): MenuNode[] { return this.delegate.children; } + get contextKeyOverlays(): Record | undefined { return this.delegate.contextKeyOverlays; } + get label(): string { return this.delegate.label; }; + get icon(): string | undefined { return this.delegate.icon; }; + + get sortString(): string { return this._sortString || this.delegate.sortString; }; + isVisible(effectiveMenuPath: MenuPath, contextMatcher: ContextExpressionMatcher, context: T | undefined, ...args: unknown[]): boolean { + return this.delegate.isVisible(effectiveMenuPath, contextMatcher, context) && this._when ? contextMatcher.match(this._when, context) : true; + } + + isEmpty(effectiveMenuPath: MenuPath, contextMatcher: ContextExpressionMatcher, context: T | undefined, ...args: unknown[]): boolean { + return this.delegate.isEmpty(effectiveMenuPath, contextMatcher, context, args); + } +} + +/** + * Node representing a (sub)menu in the menu tree structure. + */ +export abstract class AbstractCompoundMenuImpl implements MenuNode { + readonly children: MenuNode[] = []; + + protected constructor( + readonly id: string, + protected readonly orderString?: string, + protected readonly when?: string + ) { + } + + getOrCreate(menuPath: MenuPath, pathIndex: number, endIndex: number): CompoundMenuImpl { + if (pathIndex === endIndex) { + return this; + } + let child = this.getNode(menuPath[pathIndex]); + if (!child) { + child = new GroupImpl(menuPath[pathIndex]); + this.addNode(child); + } + if (child instanceof AbstractCompoundMenuImpl) { + return child.getOrCreate(menuPath, pathIndex + 1, endIndex); + } else { + throw new Error(`An item exists, but it's not a parent: ${menuPath} at ${pathIndex}`); + } + + } + + /** + * Menu nodes are sorted in ascending order based on their `sortString`. + */ + isVisible(effectiveMenuPath: MenuPath, contextMatcher: ContextExpressionMatcher, context: T | undefined, ...args: unknown[]): boolean { + return (!this.when || contextMatcher.match(this.when, context)); + } + + isEmpty(effectiveMenuPath: MenuPath, contextMatcher: ContextExpressionMatcher, context: T | undefined, ...args: unknown[]): boolean { + for (const child of this.children) { + if (child.isVisible(effectiveMenuPath, contextMatcher, context, args)) { + if (!CompoundMenuNode.is(child) || !child.isEmpty(effectiveMenuPath, contextMatcher, context, args)) { + return false; + } + } + } + return true; + } + + addNode(...node: MenuNode[]): void { + this.children.push(...node); + this.children.sort(CompoundMenuNode.sortChildren); + } + + getNode(id: string): MenuNode | undefined { + return this.children.find(node => node.id === id); + } + + removeById(id: string): void { + const idx = this.children.findIndex(node => node.id === id); + if (idx >= 0) { + this.children.splice(idx, 1); + } + } + + removeNode(node: MenuNode): void { + const idx = this.children.indexOf(node); + if (idx >= 0) { + this.children.splice(idx, 1); + } + } + + get sortString(): string { + return this.orderString || this.id; + } +} + +export class GroupImpl extends AbstractCompoundMenuImpl implements Group { + constructor( + id: string, + orderString?: string, + when?: string + ) { + super(id, orderString, when); + } +} + +export class SubmenuImpl extends AbstractCompoundMenuImpl implements Submenu { + + constructor( + id: string, + readonly label: string, + readonly contextKeyOverlays: Record | undefined, + orderString?: string, + readonly icon?: string, + when?: string, + ) { + super(id, orderString, when); + } +} + +export type CompoundMenuImpl = SubmenuImpl | GroupImpl; diff --git a/packages/core/src/browser/menu/context-menu-context.ts b/packages/core/src/browser/menu/context-menu-context.ts new file mode 100644 index 0000000..0db96c8 --- /dev/null +++ b/packages/core/src/browser/menu/context-menu-context.ts @@ -0,0 +1,41 @@ +// ***************************************************************************** +// Copyright (C) 2019 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { injectable } from 'inversify'; +import { OS } from '../../common/os'; + +@injectable() +export class ContextMenuContext { + + protected _altPressed = false; + get altPressed(): boolean { + return this._altPressed; + } + + protected setAltPressed(altPressed: boolean): void { + this._altPressed = altPressed; + } + + resetAltPressed(): void { + this.setAltPressed(false); + } + + constructor() { + document.addEventListener('keydown', e => this.setAltPressed(e.altKey || (OS.type() !== OS.Type.OSX && e.shiftKey)), true); + document.addEventListener('keyup', () => this.resetAltPressed(), true); + } + +} diff --git a/packages/core/src/browser/menu/menu.spec.ts b/packages/core/src/browser/menu/menu.spec.ts new file mode 100644 index 0000000..4e0141d --- /dev/null +++ b/packages/core/src/browser/menu/menu.spec.ts @@ -0,0 +1,135 @@ +// ***************************************************************************** +// Copyright (C) 2017 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import * as chai from 'chai'; +import { + CommandContribution, CommandMenu, CommandRegistry, CompoundMenuNode, Group, GroupImpl, MenuAction, MenuContribution, + MenuModelRegistry, MenuNode, MenuNodeFactory, MutableCompoundMenuNode, Submenu, + SubmenuImpl, + SubMenuLink +} from '../../common'; + +const expect = chai.expect; + +class TestMenuNodeFactory implements MenuNodeFactory { + createGroup(id: string, orderString?: string, when?: string): Group & MutableCompoundMenuNode { + return new GroupImpl(id, orderString, when); + } + createSubmenu(id: string, label: string, contextKeyOverlays: Record | undefined, orderString?: string, icon?: string, when?: string): + Submenu & MutableCompoundMenuNode { + return new SubmenuImpl(id, label, contextKeyOverlays, orderString, icon, when); + } + createSubmenuLink(delegate: Submenu, sortString?: string, when?: string): MenuNode { + return new SubMenuLink(delegate, sortString, when); + } + + createCommandMenu(item: MenuAction): CommandMenu { + return { + isVisible: () => true, + isEnabled: () => true, + isToggled: () => false, + id: item.commandId, + label: item.label || '', + sortString: item.order || '', + run: () => Promise.resolve() + }; + } +} + +describe('menu-model-registry', () => { + describe('01 #register', () => { + it('Should allow to register menu actions.', () => { + const fileMenu = ['main', 'File']; + const fileOpenMenu = [...fileMenu, '0_open']; + const service = createMenuRegistry({ + registerMenus(menuRegistry: MenuModelRegistry): void { + menuRegistry.registerSubmenu(fileMenu, 'File'); + menuRegistry.registerMenuAction(fileOpenMenu, { + commandId: 'open' + }); + menuRegistry.registerMenuAction(fileOpenMenu, { + commandId: 'open.with' + }); + } + }, { + registerCommands(reg: CommandRegistry): void { + reg.registerCommand({ + id: 'open', + label: 'A' + }); + reg.registerCommand({ + id: 'open.with', + label: 'B' + }); + } + }); + const main = service.getMenu(['main'])!; + expect(main.children.length).equals(1); + expect(main.id, 'main'); + const file = main.children[0] as Submenu; + expect(file.children.length).equals(1); + expect(file.label, 'File'); + const openGroup = file.children[0] as Submenu; + expect(openGroup.children.length).equals(2); + expect(openGroup.label).undefined; + + expect(service.getMenuNode([...fileOpenMenu, 'open'])).exist; + expect(service.getMenuNode([...fileOpenMenu, 'Gurkensalat'])).undefined; + }); + + it('Should not allow to register cyclic menus.', () => { + const fileMenu = ['main', 'File']; + const fileOpenMenu = [...fileMenu, '0_open']; + const fileCloseMenu = [...fileMenu, '1_close']; + const service = createMenuRegistry({ + registerMenus(menuRegistry: MenuModelRegistry): void { + menuRegistry.registerSubmenu(fileMenu, 'File'); + menuRegistry.registerSubmenu(fileOpenMenu, 'Open'); + menuRegistry.registerSubmenu(fileCloseMenu, 'Close'); + // open menu should not be added to open menu + try { + menuRegistry.linkCompoundMenuNode({ newParentPath: fileOpenMenu, submenuPath: fileOpenMenu }); + } catch (e) { + // expected + } + // close menu should be added + menuRegistry.linkCompoundMenuNode({ newParentPath: fileOpenMenu, submenuPath: fileCloseMenu }); + } + }, { + registerCommands(reg: CommandRegistry): void { } + }); + const main = service.getMenu(['main']) as CompoundMenuNode; + expect(menuStructureToString(main)).equals('File(0_open(1_close()),1_close())'); + }); + }); +}); + +function createMenuRegistry(menuContrib: MenuContribution, commandContrib: CommandContribution): MenuModelRegistry { + const cmdReg = new CommandRegistry({ getContributions: () => [commandContrib] }); + cmdReg.onStart(); + const menuReg = new MenuModelRegistry({ getContributions: () => [menuContrib] }, cmdReg, new TestMenuNodeFactory()); + menuReg.onStart(); + return menuReg; +} + +function menuStructureToString(node: CompoundMenuNode): string { + return node.children.map(c => { + if (CompoundMenuNode.is(c)) { + return `${c.id}(${menuStructureToString(c)})`; + } + return c.id; + }).join(','); +} diff --git a/packages/core/src/browser/messaging/connection-source.ts b/packages/core/src/browser/messaging/connection-source.ts new file mode 100644 index 0000000..8e48110 --- /dev/null +++ b/packages/core/src/browser/messaging/connection-source.ts @@ -0,0 +1,26 @@ +// ***************************************************************************** +// Copyright (C) 2023 STMicroelectronics and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { Channel, Event } from '../../common'; + +export const ConnectionSource = Symbol('ConnectionSource'); + +/** + * A ConnectionSource creates a Channel. The channel is valid until it sends a close event. + */ +export interface ConnectionSource { + onConnectionDidOpen: Event; +} diff --git a/packages/core/src/browser/messaging/frontend-id-provider.ts b/packages/core/src/browser/messaging/frontend-id-provider.ts new file mode 100644 index 0000000..9ec93c1 --- /dev/null +++ b/packages/core/src/browser/messaging/frontend-id-provider.ts @@ -0,0 +1,37 @@ +// ***************************************************************************** +// Copyright (C) 2023 STMicroelectronics and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { injectable } from 'inversify'; +import { generateUuid } from '../../common/uuid'; + +export const FrontendIdProvider = Symbol('FrontendIdProvider'); + +/** + * A FrontendIdProvider computes an id for an instance of the front end that may be reconnected to a back end + * connection context. + */ +export interface FrontendIdProvider { + getId(): string; +} + +@injectable() +export class BrowserFrontendIdProvider implements FrontendIdProvider { + protected readonly id = generateUuid(); // generate a new id each time we load the application + + getId(): string { + return this.id; + } +} diff --git a/packages/core/src/browser/messaging/index.ts b/packages/core/src/browser/messaging/index.ts new file mode 100644 index 0000000..5112fc9 --- /dev/null +++ b/packages/core/src/browser/messaging/index.ts @@ -0,0 +1,18 @@ +// ***************************************************************************** +// Copyright (C) 2018 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +export * from './ws-connection-provider'; +export * from './service-connection-provider'; diff --git a/packages/core/src/browser/messaging/messaging-frontend-module.ts b/packages/core/src/browser/messaging/messaging-frontend-module.ts new file mode 100644 index 0000000..a7c742c --- /dev/null +++ b/packages/core/src/browser/messaging/messaging-frontend-module.ts @@ -0,0 +1,41 @@ +// ***************************************************************************** +// Copyright (C) 2017 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { ContainerModule } from 'inversify'; +import { BrowserFrontendIdProvider, FrontendIdProvider } from './frontend-id-provider'; +import { WebSocketConnectionSource } from './ws-connection-source'; +import { LocalConnectionProvider, RemoteConnectionProvider, ServiceConnectionProvider } from './service-connection-provider'; +import { ConnectionSource } from './connection-source'; +import { ConnectionCloseService, connectionCloseServicePath } from '../../common/messaging/connection-management'; +import { WebSocketConnectionProvider } from './ws-connection-provider'; + +const backendServiceProvider = Symbol('backendServiceProvider'); + +export const messagingFrontendModule = new ContainerModule(bind => { + bind(ConnectionCloseService).toDynamicValue(ctx => WebSocketConnectionProvider.createProxy(ctx.container, connectionCloseServicePath)).inSingletonScope(); + bind(BrowserFrontendIdProvider).toSelf().inSingletonScope(); + bind(FrontendIdProvider).toService(BrowserFrontendIdProvider); + bind(WebSocketConnectionSource).toSelf().inSingletonScope(); + bind(backendServiceProvider).toDynamicValue(ctx => { + bind(ServiceConnectionProvider).toSelf().inSingletonScope(); + const container = ctx.container.createChild(); + container.bind(ConnectionSource).toService(WebSocketConnectionSource); + return container.get(ServiceConnectionProvider); + }).inSingletonScope(); + bind(LocalConnectionProvider).toService(backendServiceProvider); + bind(RemoteConnectionProvider).toService(backendServiceProvider); + bind(WebSocketConnectionProvider).toSelf().inSingletonScope(); +}); diff --git a/packages/core/src/browser/messaging/service-connection-provider.ts b/packages/core/src/browser/messaging/service-connection-provider.ts new file mode 100644 index 0000000..aee98b8 --- /dev/null +++ b/packages/core/src/browser/messaging/service-connection-provider.ts @@ -0,0 +1,140 @@ +// ***************************************************************************** +// Copyright (C) 2020 Ericsson and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { inject, injectable, interfaces, postConstruct } from 'inversify'; +import { Channel, RpcProxy, RpcProxyFactory } from '../../common'; +import { ChannelMultiplexer } from '../../common/message-rpc/channel'; +import { Deferred } from '../../common/promise-util'; +import { ConnectionSource } from './connection-source'; + +/** + * Service id for the local connection provider + */ +export const LocalConnectionProvider = Symbol('LocalConnectionProvider'); +/** + * Service id for the remote connection provider + */ +export const RemoteConnectionProvider = Symbol('RemoteConnectionProvider'); + +export namespace ServiceConnectionProvider { + export type ConnectionHandler = (path: String, channel: Channel) => void; +} + +/** + * This class manages the channels for remote services in the back end. + * + * Since we have the ability to use a remote back end via SSH, we need to distinguish + * between two types of services: those that will be redirected to the remote back end + * and those which must remain in the local back end. For example the service that manages + * the remote ssh connections and port forwarding to the remote instance must remain local + * while e.g. the file system service will run in the remote back end. For each set + * of services, we will bind an instance of this class to {@linkcode LocalConnectionProvider} + * and {@linkcode RemoteConnectionProvider} respectively. + */ +@injectable() +export class ServiceConnectionProvider { + + static createProxy(container: interfaces.Container, path: string, arg?: object): RpcProxy { + return container.get(RemoteConnectionProvider).createProxy(path, arg); + } + + static createLocalProxy(container: interfaces.Container, path: string, arg?: object): RpcProxy { + return container.get(LocalConnectionProvider).createProxy(path, arg); + } + + static createHandler(container: interfaces.Container, path: string, arg?: object): void { + const remote = container.get(RemoteConnectionProvider); + const local = container.get(LocalConnectionProvider); + remote.createProxy(path, arg); + if (remote !== local) { + local.createProxy(path, arg); + } + } + + protected readonly channelHandlers = new Map(); + + /** + * Create a proxy object to remote interface of T type + * over a web socket connection for the given path and proxy factory. + */ + createProxy(path: string, factory: RpcProxyFactory): RpcProxy; + /** + * Create a proxy object to remote interface of T type + * over a web socket connection for the given path. + * + * An optional target can be provided to handle + * notifications and requests from a remote side. + */ + createProxy(path: string, target?: object): RpcProxy; + createProxy(path: string, arg?: object): RpcProxy { + const factory = arg instanceof RpcProxyFactory ? arg : new RpcProxyFactory(arg); + this.listen(path, (_, c) => factory.listen(c), true); + return factory.createProxy(); + } + + protected channelMultiplexer: ChannelMultiplexer; + + private channelReadyDeferred = new Deferred(); + protected get channelReady(): Promise { + return this.channelReadyDeferred.promise; + } + + @postConstruct() + init(): void { + this.connectionSource.onConnectionDidOpen(channel => this.handleChannelCreated(channel)); + } + + @inject(ConnectionSource) + protected connectionSource: ConnectionSource; + + /** + * This method must be invoked by subclasses when they have created the main channel. + * @param mainChannel + */ + protected handleChannelCreated(channel: Channel): void { + channel.onClose(() => { + this.handleChannelClosed(channel); + }); + + this.channelMultiplexer = new ChannelMultiplexer(channel); + this.channelReadyDeferred.resolve(); + for (const entry of this.channelHandlers.entries()) { + this.openChannel(entry[0], entry[1]); + } + } + + handleChannelClosed(channel: Channel): void { + this.channelReadyDeferred = new Deferred(); + } + + /** + * Install a connection handler for the given path. + */ + listen(path: string, handler: ServiceConnectionProvider.ConnectionHandler, reconnect: boolean): void { + this.openChannel(path, handler).then(() => { + if (reconnect) { + this.channelHandlers.set(path, handler); + } + }); + + } + + private async openChannel(path: string, handler: ServiceConnectionProvider.ConnectionHandler): Promise { + await this.channelReady; + const newChannel = await this.channelMultiplexer.open(path); + handler(path, newChannel); + } +} diff --git a/packages/core/src/browser/messaging/ws-connection-provider.ts b/packages/core/src/browser/messaging/ws-connection-provider.ts new file mode 100644 index 0000000..642b3c3 --- /dev/null +++ b/packages/core/src/browser/messaging/ws-connection-provider.ts @@ -0,0 +1,49 @@ +// ***************************************************************************** +// Copyright (C) 2018 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { injectable, interfaces, decorate, unmanaged, inject } from 'inversify'; +import { RpcProxyFactory, RpcProxy } from '../../common'; +import { RemoteConnectionProvider, ServiceConnectionProvider } from './service-connection-provider'; + +decorate(injectable(), RpcProxyFactory); +decorate(unmanaged(), RpcProxyFactory, 0); + +/** + * @deprecated This class serves to keep API compatibility for a while. + * Use the {@linkcode RemoteConnectionProvider} as the injection symbol and {@linkcode ServiceConnectionProvider} as the type instead. + */ +@injectable() +export class WebSocketConnectionProvider { + @inject(RemoteConnectionProvider) + private readonly remoteConnectionProvider: ServiceConnectionProvider; + + static createProxy(container: interfaces.Container, path: string, arg?: object): RpcProxy { + return ServiceConnectionProvider.createProxy(container, path, arg); + } + + static createLocalProxy(container: interfaces.Container, path: string, arg?: object): RpcProxy { + return ServiceConnectionProvider.createLocalProxy(container, path, arg); + } + + static createHandler(container: interfaces.Container, path: string, arg?: object): void { + return ServiceConnectionProvider.createHandler(container, path, arg); + } + + createProxy(path: string, target?: object): RpcProxy; + createProxy(path: string, factory: RpcProxyFactory): RpcProxy { + return this.remoteConnectionProvider.createProxy(path, factory); + } +} diff --git a/packages/core/src/browser/messaging/ws-connection-source.ts b/packages/core/src/browser/messaging/ws-connection-source.ts new file mode 100644 index 0000000..24d7d79 --- /dev/null +++ b/packages/core/src/browser/messaging/ws-connection-source.ts @@ -0,0 +1,230 @@ +// ***************************************************************************** +// Copyright (C) 2023 STMicroelectronics and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { AbstractChannel, Channel, Disposable, DisposableCollection, Emitter, Event, servicesPath } from '../../common'; +import { ConnectionSource } from './connection-source'; +import { Socket, io } from 'socket.io-client'; +import { Endpoint } from '../endpoint'; +import { ForwardingChannel } from '../../common/message-rpc/channel'; +import { Uint8ArrayReadBuffer, Uint8ArrayWriteBuffer } from '../../common/message-rpc/uint8-array-message-buffer'; +import { inject, injectable, postConstruct } from 'inversify'; +import { FrontendIdProvider } from './frontend-id-provider'; +import { FrontendApplicationConfigProvider } from '../frontend-application-config-provider'; +import { SocketWriteBuffer } from '../../common/messaging/socket-write-buffer'; +import { ConnectionManagementMessages } from '../../common/messaging/connection-management'; + +@injectable() +export class WebSocketConnectionSource implements ConnectionSource { + static readonly NO_CONNECTION = ''; + + @inject(FrontendIdProvider) + protected readonly frontendIdProvider: FrontendIdProvider; + + private readonly writeBuffer = new SocketWriteBuffer(); + + private _socket: Socket; + get socket(): Socket { + return this._socket; + } + + protected currentChannel: AbstractChannel; + + protected readonly onConnectionDidOpenEmitter: Emitter = new Emitter(); + get onConnectionDidOpen(): Event { + return this.onConnectionDidOpenEmitter.event; + } + + protected readonly onSocketDidOpenEmitter: Emitter = new Emitter(); + get onSocketDidOpen(): Event { + return this.onSocketDidOpenEmitter.event; + } + + protected readonly onSocketDidCloseEmitter: Emitter = new Emitter(); + get onSocketDidClose(): Event { + return this.onSocketDidCloseEmitter.event; + } + + protected readonly onIncomingMessageActivityEmitter: Emitter = new Emitter(); + get onIncomingMessageActivity(): Event { + return this.onIncomingMessageActivityEmitter.event; + } + + constructor() { + } + + @postConstruct() + openSocket(): void { + const url = this.createWebSocketUrl(servicesPath); + this._socket = this.createWebSocket(url); + + this._socket.on('connect', () => { + this.onSocketDidOpenEmitter.fire(); + this.handleSocketConnected(); + }); + + this._socket.on('disconnect', () => { + this.onSocketDidCloseEmitter.fire(); + }); + + this._socket.on('error', reason => { + if (this.currentChannel) { + this.currentChannel.onErrorEmitter.fire(reason); + }; + }); + this._socket.connect(); + } + + protected negogiateReconnect(): void { + const reconnectListener = (hasConnection: boolean) => { + this._socket.off(ConnectionManagementMessages.RECONNECT, reconnectListener); + if (hasConnection) { + console.info(`reconnect succeeded on ${this.socket.id}`); + this.writeBuffer!.flush(this.socket); + } else { + if (FrontendApplicationConfigProvider.get().reloadOnReconnect) { + window.location.reload(); // this might happen in the preload module, when we have no window service yet + } else { + console.info(`reconnect failed on ${this.socket.id}`); + this.currentChannel.onCloseEmitter.fire({ reason: 'reconnecting channel' }); + this.currentChannel.close(); + this.writeBuffer.drain(); + this.socket.disconnect(); + this.socket.connect(); + this.negotiateInitialConnect(); + } + } + }; + this._socket.on(ConnectionManagementMessages.RECONNECT, reconnectListener); + console.info(`sending reconnect on ${this.socket.id}`); + this._socket.emit(ConnectionManagementMessages.RECONNECT, this.frontendIdProvider.getId()); + } + + protected negotiateInitialConnect(): void { + const initialConnectListener = () => { + console.info(`initial connect received on ${this.socket.id}`); + + this._socket.off(ConnectionManagementMessages.INITIAL_CONNECT, initialConnectListener); + this.connectNewChannel(); + }; + this._socket.on(ConnectionManagementMessages.INITIAL_CONNECT, initialConnectListener); + console.info(`sending initial connect on ${this.socket.id}`); + + this._socket.emit(ConnectionManagementMessages.INITIAL_CONNECT, this.frontendIdProvider.getId()); + } + + protected handleSocketConnected(): void { + if (this.currentChannel) { + this.negogiateReconnect(); + } else { + this.negotiateInitialConnect(); + } + } + + connectNewChannel(): void { + if (this.currentChannel) { + this.currentChannel.close(); + this.currentChannel.onCloseEmitter.fire({ reason: 'reconnecting channel' }); + } + this.writeBuffer.drain(); + this.currentChannel = this.createChannel(); + this.onConnectionDidOpenEmitter.fire(this.currentChannel); + } + + protected createChannel(): AbstractChannel { + const toDispose = new DisposableCollection(); + + // eslint-disable-next-line @typescript-eslint/no-explicit-any + const messageHandler = (data: any) => { + this.onIncomingMessageActivityEmitter.fire(); + if (this.currentChannel) { + // In the browser context socketIO receives binary messages as ArrayBuffers. + // So we have to convert them to a Uint8Array before delegating the message to the read buffer. + const buffer = data instanceof ArrayBuffer ? new Uint8Array(data) : data; + this.currentChannel.onMessageEmitter.fire(() => new Uint8ArrayReadBuffer(buffer)); + }; + }; + this._socket.on('message', messageHandler); + toDispose.push(Disposable.create(() => { + this.socket.off('message', messageHandler); + })); + + const channel = new ForwardingChannel('any', () => { + toDispose.dispose(); + }, () => { + const result = new Uint8ArrayWriteBuffer(); + + result.onCommit(buffer => { + if (this.socket.connected) { + this.socket.send(buffer); + } else { + this.writeBuffer.buffer(buffer); + } + }); + + return result; + }); + return channel; + } + + /** + * @param path The handler to reach in the backend. + */ + protected createWebSocketUrl(path: string): string { + // Since we are using Socket.io, the path should look like the following: + // proto://domain.com/{path} + return this.createEndpoint(path).getWebSocketUrl().withPath(path).toString(); + } + + protected createHttpWebSocketUrl(path: string): string { + return this.createEndpoint(path).getRestUrl().toString(); + } + + protected createEndpoint(path: string): Endpoint { + return new Endpoint({ path }); + } + + /** + * Creates a web socket for the given url + */ + protected createWebSocket(url: string): Socket { + return io(url, { + path: this.createSocketIoPath(url), + reconnection: true, + reconnectionDelay: 1000, + reconnectionDelayMax: 10000, + reconnectionAttempts: Infinity, + extraHeaders: { + // Socket.io strips the `origin` header + // We need to provide our own for validation + 'fix-origin': window.location.origin + } + }); + } + + /** + * Path for Socket.io to make its requests to. + */ + protected createSocketIoPath(url: string): string | undefined { + if (location.protocol === Endpoint.PROTO_FILE) { + return '/socket.io'; + } + let { pathname } = location; + if (!pathname.endsWith('/')) { + pathname += '/'; + } + return pathname + 'socket.io'; + } +} diff --git a/packages/core/src/browser/mime-service.ts b/packages/core/src/browser/mime-service.ts new file mode 100644 index 0000000..e14841b --- /dev/null +++ b/packages/core/src/browser/mime-service.ts @@ -0,0 +1,30 @@ +// ***************************************************************************** +// Copyright (C) 2019 Red Hat, Inc. and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { injectable } from 'inversify'; + +export interface MimeAssociation { + readonly id: string; + readonly filepattern: string; +} + +@injectable() +export class MimeService { + // should be overridden by an implementation + setAssociations(associations: MimeAssociation[]): void { + /* no-op by default */ + } +} diff --git a/packages/core/src/browser/navigatable-types.ts b/packages/core/src/browser/navigatable-types.ts new file mode 100644 index 0000000..8dc4035 --- /dev/null +++ b/packages/core/src/browser/navigatable-types.ts @@ -0,0 +1,81 @@ +// ***************************************************************************** +// Copyright (C) 2021 Ericsson and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { URI, isObject, MaybeArray } from '../common'; +import { Widget, BaseWidget } from './widgets'; + +/** + * `Navigatable` provides an access to an URI of an underlying instance of `Resource`. + */ +export interface Navigatable { + /** + * Return an underlying resource URI. + */ + getResourceUri(): URI | undefined; + /** + * Creates a new URI to which this navigatable should moved based on the given target resource URI. + */ + createMoveToUri(resourceUri: URI): URI | undefined; +} + +export namespace Navigatable { + export function is(arg: unknown): arg is Navigatable { + return isObject(arg) && 'getResourceUri' in arg && 'createMoveToUri' in arg; + } +} + +export type NavigatableWidget = BaseWidget & Navigatable; +export namespace NavigatableWidget { + export function is(arg: unknown): arg is NavigatableWidget { + return arg instanceof BaseWidget && Navigatable.is(arg); + } + export function getAffected( + widgets: Iterable, + context: MaybeArray + ): IterableIterator<[URI, T & NavigatableWidget]> { + const uris = Array.isArray(context) ? context : [context]; + return get(widgets, resourceUri => uris.some(uri => uri.isEqualOrParent(resourceUri))); + } + export function* get( + widgets: Iterable, + filter: (resourceUri: URI) => boolean = () => true + ): IterableIterator<[URI, T & NavigatableWidget]> { + for (const widget of widgets) { + if (NavigatableWidget.is(widget)) { + const resourceUri = widget.getResourceUri(); + if (resourceUri && filter(resourceUri)) { + yield [resourceUri, widget]; + } + } + } + } + export function getUri(widget?: Widget): URI | undefined { + if (is(widget)) { + return widget.getResourceUri(); + } + } +} + +export interface NavigatableWidgetOptions { + kind: 'navigatable'; + uri: string; + counter?: number; +} +export namespace NavigatableWidgetOptions { + export function is(arg: unknown): arg is NavigatableWidgetOptions { + return isObject(arg) && arg.kind === 'navigatable'; + } +} diff --git a/packages/core/src/browser/navigatable.ts b/packages/core/src/browser/navigatable.ts new file mode 100644 index 0000000..5e942d7 --- /dev/null +++ b/packages/core/src/browser/navigatable.ts @@ -0,0 +1,39 @@ +// ***************************************************************************** +// Copyright (C) 2018 Red Hat, Inc. and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import URI from '../common/uri'; +import { WidgetOpenHandler, WidgetOpenerOptions } from './widget-open-handler'; +import { NavigatableWidget, NavigatableWidgetOptions } from './navigatable-types'; +export * from './navigatable-types'; + +export abstract class NavigatableWidgetOpenHandler extends WidgetOpenHandler { + + protected createWidgetOptions(uri: URI, options?: WidgetOpenerOptions): NavigatableWidgetOptions { + return { + kind: 'navigatable', + uri: this.serializeUri(uri) + }; + } + + protected serializeUri(uri: URI): string { + if (uri.scheme === 'file') { + return uri.withoutFragment().normalizePath().toString(); + } else { + return uri.withoutFragment().toString(); + } + } + +} diff --git a/packages/core/src/browser/open-with-service.ts b/packages/core/src/browser/open-with-service.ts new file mode 100644 index 0000000..938e82c --- /dev/null +++ b/packages/core/src/browser/open-with-service.ts @@ -0,0 +1,144 @@ +// ***************************************************************************** +// Copyright (C) 2024 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { inject, injectable } from 'inversify'; +import { Disposable } from '../common/disposable'; +import { nls } from '../common/nls'; +import { MaybePromise } from '../common/types'; +import { URI } from '../common/uri'; +import { QuickInputService, QuickPickItem, QuickPickItemOrSeparator } from './quick-input'; +import { getDefaultHandler } from './opener-service'; +import { PreferenceService, PreferenceScope } from '../common'; + +export interface OpenWithHandler { + /** + * A unique id of this handler. + */ + readonly id: string; + /** + * A human-readable name of this handler. + */ + readonly label?: string; + /** + * A human-readable provider name of this handler. + */ + readonly providerName?: string; + /** + * A css icon class of this handler. + */ + readonly iconClass?: string; + /** + * Test whether this handler can open the given URI for given options. + * Return a nonzero number if this handler can open; otherwise it cannot. + * Never reject. + * + * A returned value indicating a priority of this handler. + */ + canHandle(uri: URI): number; + /** + * Test whether this handler can open the given URI + * and return the order of this handler in the list. + */ + getOrder?(uri: URI): number; + /** + * Open a widget for the given URI and options. + * Resolve to an opened widget or undefined, e.g. if a page is opened. + * Never reject if `canHandle` return a positive number; otherwise should reject. + */ + open(uri: URI): MaybePromise; +} + +export interface OpenWithQuickPickItem extends QuickPickItem { + handler: OpenWithHandler; +} + +@injectable() +export class OpenWithService { + + @inject(QuickInputService) + protected readonly quickInputService: QuickInputService; + + @inject(PreferenceService) + protected readonly preferenceService: PreferenceService; + + protected readonly handlers: OpenWithHandler[] = []; + + registerHandler(handler: OpenWithHandler): Disposable { + if (this.handlers.some(h => h.id === handler.id)) { + console.warn('Duplicate OpenWithHandler registration: ' + handler.id); + return Disposable.NULL; + } + this.handlers.push(handler); + return Disposable.create(() => { + const index = this.handlers.indexOf(handler); + if (index !== -1) { + this.handlers.splice(index, 1); + } + }); + } + + async openWith(uri: URI): Promise { + // Clone the object, because all objects returned by the preferences service are frozen. + const associations: Record = { ...this.preferenceService.get('workbench.editorAssociations') }; + const ext = `*${uri.path.ext}`; + const handlers = this.getHandlers(uri); + const ordered = handlers.slice().sort((a, b) => this.getOrder(b, uri) - this.getOrder(a, uri)); + const defaultHandler = getDefaultHandler(uri, this.preferenceService) ?? handlers[0]?.id; + const items = this.getQuickPickItems(ordered, defaultHandler); + // Only offer to select a default editor when the file has a file extension + const extraItems: QuickPickItemOrSeparator[] = uri.path.ext ? [{ + type: 'separator' + }, { + label: nls.localizeByDefault("Configure default editor for '{0}'...", ext) + }] : []; + const result = await this.quickInputService.pick([...items, ...extraItems], { + placeHolder: nls.localizeByDefault("Select editor for '{0}'", uri.path.base) + }); + if (result) { + if ('handler' in result) { + return result.handler.open(uri); + } else if (result.label) { + const configureResult = await this.quickInputService.pick(items, { + placeHolder: nls.localizeByDefault("Select new default editor for '{0}'", ext) + }); + if (configureResult) { + associations[ext] = configureResult.handler.id; + this.preferenceService.set('workbench.editorAssociations', associations, PreferenceScope.User); + return configureResult.handler.open(uri); + } + } + } + return undefined; + } + + protected getQuickPickItems(handlers: OpenWithHandler[], defaultHandler?: string): OpenWithQuickPickItem[] { + return handlers.map(handler => ({ + handler, + label: handler.label ?? handler.id, + detail: handler.providerName ?? '', + description: handler.id === defaultHandler ? nls.localizeByDefault('Default') : undefined + })); + } + + protected getOrder(handler: OpenWithHandler, uri: URI): number { + return handler.getOrder ? handler.getOrder(uri) : handler.canHandle(uri); + } + + getHandlers(uri: URI): OpenWithHandler[] { + const map = new Map(this.handlers.map(handler => [handler, handler.canHandle(uri)])); + return this.handlers.filter(handler => map.get(handler)! > 0).sort((a, b) => map.get(b)! - map.get(a)!); + } +} diff --git a/packages/core/src/browser/opener-service.spec.ts b/packages/core/src/browser/opener-service.spec.ts new file mode 100644 index 0000000..055018c --- /dev/null +++ b/packages/core/src/browser/opener-service.spec.ts @@ -0,0 +1,49 @@ +// ***************************************************************************** +// Copyright (C) 2017 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { DefaultOpenerService, OpenHandler } from './opener-service'; +import * as assert from 'assert'; +import { MaybePromise } from '../common/types'; +import * as chai from 'chai'; +const expect = chai.expect; + +const id = 'my-opener'; +const openHandler: OpenHandler = { + id, + label: 'My Opener', + canHandle(): MaybePromise { + return Promise.resolve(1); + }, + open(): MaybePromise { + return Promise.resolve(undefined); + } +}; +const openerService = new DefaultOpenerService({ + getContributions: () => [openHandler] +}); + +describe('opener-service', () => { + it('getOpeners', () => + openerService.getOpeners().then(openers => { + assert.deepStrictEqual([openHandler], openers); + })); + it('addHandler', () => { + openerService.addHandler(openHandler); + openerService.getOpeners().then(openers => { + expect(openers.length).is.equal(2); + }); + }); +}); diff --git a/packages/core/src/browser/opener-service.ts b/packages/core/src/browser/opener-service.ts new file mode 100644 index 0000000..bda7034 --- /dev/null +++ b/packages/core/src/browser/opener-service.ts @@ -0,0 +1,168 @@ +// ***************************************************************************** +// Copyright (C) 2017 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { named, injectable, inject } from 'inversify'; +import URI from '../common/uri'; +import { ContributionProvider, Prioritizeable, MaybePromise, Emitter, Event, Disposable, PreferenceService } from '../common'; +import { match } from '../common/glob'; + +export interface OpenerOptions { +} + +export const OpenHandler = Symbol('OpenHandler'); +/** + * `OpenHandler` should be implemented to provide a new opener. + */ +export interface OpenHandler { + /** + * A unique id of this handler. + */ + readonly id: string; + /** + * A human-readable name of this handler. + */ + readonly label?: string; + /** + * A css icon class of this handler. + */ + readonly iconClass?: string; + /** + * Test whether this handler can open the given URI for given options. + * Return a nonzero number if this handler can open; otherwise it cannot. + * Never reject. + * + * A returned value indicating a priority of this handler. + */ + canHandle(uri: URI, options?: OpenerOptions): MaybePromise; + /** + * Open a widget for the given URI and options. + * Resolve to an opened widget or undefined, e.g. if a page is opened. + * Never reject if `canHandle` return a positive number; otherwise should reject. + */ + open(uri: URI, options?: OpenerOptions): MaybePromise; +} + +export const OpenerService = Symbol('OpenerService'); +/** + * `OpenerService` provide an access to existing openers. + */ +export interface OpenerService { + /** + * Return all registered openers. + * Never reject. + */ + getOpeners(): Promise; + /** + * Return all openers able to open the given URI for given options + * ordered according their priority. + * Never reject. + */ + getOpeners(uri: URI, options?: OpenerOptions): Promise; + /** + * Return an opener with the higher priority for the given URI. + * Reject if such does not exist. + */ + getOpener(uri: URI, options?: OpenerOptions): Promise; + /** + * Add open handler i.e. for custom editors + */ + addHandler?(openHandler: OpenHandler): Disposable; + + /** + * Remove open handler + */ + removeHandler?(openHandler: OpenHandler): void; + + /** + * Event that fires when a new opener is added or removed. + */ + onDidChangeOpeners?: Event; +} + +export async function open(openerService: OpenerService, uri: URI, options?: OpenerOptions): Promise { + const opener = await openerService.getOpener(uri, options); + return opener.open(uri, options); +} + +export function getDefaultHandler(uri: URI, preferenceService: PreferenceService): string | undefined { + const associations = preferenceService.get('workbench.editorAssociations', {}); + const defaultHandler = Object.entries(associations).find(([key]) => match(key, uri.path.base))?.[1]; + if (typeof defaultHandler === 'string') { + return defaultHandler; + } + return undefined; +} + +export const defaultHandlerPriority = 100_000; + +@injectable() +export class DefaultOpenerService implements OpenerService { + // Collection of open-handlers for custom-editor contributions. + protected readonly customEditorOpenHandlers: OpenHandler[] = []; + + protected readonly onDidChangeOpenersEmitter = new Emitter(); + readonly onDidChangeOpeners = this.onDidChangeOpenersEmitter.event; + + constructor( + @inject(ContributionProvider) @named(OpenHandler) + protected readonly handlersProvider: ContributionProvider + ) { } + + addHandler(openHandler: OpenHandler): Disposable { + this.customEditorOpenHandlers.push(openHandler); + this.onDidChangeOpenersEmitter.fire(); + + return Disposable.create(() => { + this.removeHandler(openHandler); + }); + } + + removeHandler(openHandler: OpenHandler): void { + this.customEditorOpenHandlers.splice(this.customEditorOpenHandlers.indexOf(openHandler), 1); + this.onDidChangeOpenersEmitter.fire(); + } + + async getOpener(uri: URI, options?: OpenerOptions): Promise { + const handlers = await this.prioritize(uri, options); + if (handlers.length >= 1) { + return handlers[0]; + } + return Promise.reject(new Error(`There is no opener for ${uri}.`)); + } + + async getOpeners(uri?: URI, options?: OpenerOptions): Promise { + return uri ? this.prioritize(uri, options) : this.getHandlers(); + } + + protected async prioritize(uri: URI, options?: OpenerOptions): Promise { + const prioritized = await Prioritizeable.prioritizeAll(this.getHandlers(), async handler => { + try { + return await handler.canHandle(uri, options); + } catch { + return 0; + } + }); + return prioritized.map(p => p.value); + } + + protected getHandlers(): OpenHandler[] { + return [ + ...this.handlersProvider.getContributions(), + ...this.customEditorOpenHandlers + ]; + } + +} diff --git a/packages/core/src/browser/performance/frontend-stopwatch.ts b/packages/core/src/browser/performance/frontend-stopwatch.ts new file mode 100644 index 0000000..f8759d0 --- /dev/null +++ b/packages/core/src/browser/performance/frontend-stopwatch.ts @@ -0,0 +1,65 @@ +/******************************************************************************** +* Copyright (c) 2019, 2021 TypeFox, STMicroelectronics and others. +* +* This program and the accompanying materials are made available under the +* terms of the Eclipse Public License 2.0 which is available at +* http://www.eclipse.org/legal/epl-2.0. +* +* This Source Code may also be made available under the following Secondary +* Licenses when the conditions for such availability set forth in the Eclipse +* Public License v. 2.0 are satisfied: GNU General Public License, version 2 +* with the GNU Classpath Exception which is available at +* https://www.gnu.org/software/classpath/license.html. +* +* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +*******************************************************************************/ + +import { injectable } from 'inversify'; +import { Measurement, MeasurementOptions, Stopwatch } from '../../common'; + +@injectable() +export class FrontendStopwatch extends Stopwatch { + + constructor() { + super({ + owner: 'frontend', + now: () => performance.now(), + }); + } + + start(name: string, options?: MeasurementOptions): Measurement { + const startMarker = `${name}-start`; + const endMarker = `${name}-end`; + performance.clearMeasures(name); + performance.clearMarks(startMarker); + performance.clearMarks(endMarker); + + performance.mark(startMarker); + + return this.createMeasurement(name, () => { + performance.mark(endMarker); + + let duration: number; + let startTime: number; + + try { + performance.measure(name, startMarker, endMarker); + + const entries = performance.getEntriesByName(name); + // If no entries, then performance measurement was disabled or failed, so + // signal that with a `NaN` result + duration = entries[0].duration ?? Number.NaN; + startTime = entries[0].startTime ?? Number.NaN; + } catch (e) { + console.warn(e); + duration = Number.NaN; + startTime = Number.NaN; + } + + performance.clearMeasures(name); + performance.clearMarks(startMarker); + performance.clearMarks(endMarker); + return { startTime, duration }; + }, options); + } +}; diff --git a/packages/core/src/browser/performance/index.ts b/packages/core/src/browser/performance/index.ts new file mode 100644 index 0000000..1a60df6 --- /dev/null +++ b/packages/core/src/browser/performance/index.ts @@ -0,0 +1,18 @@ +// ***************************************************************************** +// Copyright (C) 2021 STMicroelectronics and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +export * from './frontend-stopwatch'; +export * from './measurement-frontend-bindings'; diff --git a/packages/core/src/browser/performance/measurement-frontend-bindings.ts b/packages/core/src/browser/performance/measurement-frontend-bindings.ts new file mode 100644 index 0000000..834128f --- /dev/null +++ b/packages/core/src/browser/performance/measurement-frontend-bindings.ts @@ -0,0 +1,31 @@ +/******************************************************************************** +* Copyright (c) 2021 STMicroelectronics and others. +* +* This program and the accompanying materials are made available under the +* terms of the Eclipse Public License 2.0 which is available at +* http://www.eclipse.org/legal/epl-2.0. +* +* This Source Code may also be made available under the following Secondary +* Licenses when the conditions for such availability set forth in the Eclipse +* Public License v. 2.0 are satisfied: GNU General Public License, version 2 +* with the GNU Classpath Exception which is available at +* https://www.gnu.org/software/classpath/license.html. +* +* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +*******************************************************************************/ + +import { interfaces } from 'inversify'; +import { BackendStopwatch, Stopwatch, stopwatchPath } from '../../common'; +import { WebSocketConnectionProvider } from '../messaging'; +import { FrontendStopwatch } from './frontend-stopwatch'; + +export function bindFrontendStopwatch(bind: interfaces.Bind): interfaces.BindingWhenOnSyntax { + return bind(Stopwatch).to(FrontendStopwatch).inSingletonScope(); +} + +export function bindBackendStopwatch(bind: interfaces.Bind): interfaces.BindingWhenOnSyntax { + return bind(BackendStopwatch).toDynamicValue(({ container }) => { + const connection = container.get(WebSocketConnectionProvider); + return connection.createProxy(stopwatchPath); + }).inSingletonScope(); +} diff --git a/packages/core/src/browser/preferences/frontend-config-preference-contributions.ts b/packages/core/src/browser/preferences/frontend-config-preference-contributions.ts new file mode 100644 index 0000000..f3d60c1 --- /dev/null +++ b/packages/core/src/browser/preferences/frontend-config-preference-contributions.ts @@ -0,0 +1,52 @@ +// ***************************************************************************** +// Copyright (C) 2018 Ericsson and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { injectable } from 'inversify'; +import { PreferenceContribution, PreferenceSchema, PreferenceSchemaService } from '../../common/preferences/preference-schema'; +import { FrontendApplicationConfigProvider } from '../frontend-application-config-provider'; +import { FrontendApplicationPreferenceConfig } from './preference-contribution'; +import { PreferenceLanguageOverrideService } from '../../common/preferences/preference-language-override-service'; +import { PreferenceScope } from '../../common/preferences'; +import { DefaultTheme } from '@theia/application-package/lib/application-props'; + +@injectable() +export class FrontendConfigPreferenceContribution implements PreferenceContribution { + schema: PreferenceSchema = { scope: PreferenceScope.Folder, properties: {} }; + async initSchema(service: PreferenceSchemaService): Promise { + const config = FrontendApplicationConfigProvider.get(); + if (FrontendApplicationPreferenceConfig.is(config)) { + service.registerOverride('workbench.colorTheme', undefined, DefaultTheme.defaultForOSTheme(config.defaultTheme)); + if (config.defaultIconTheme) { + service.registerOverride('workbench.iconTheme', undefined, config.defaultIconTheme); + } + try { + for (const [key, defaultValue] of Object.entries(config.preferences)) { + if (PreferenceLanguageOverrideService.testOverrideValue(key, defaultValue)) { + for (const [propertyName, value] of Object.entries(defaultValue)) { + service.registerOverride(propertyName, key.substring(1, key.length - 1), value); + } + } else { + // regular configuration override + service.registerOverride(key, undefined, defaultValue); + } + } + } catch (e) { + console.error('Failed to load preferences from frontend configuration.', e); + } + } + } + +} diff --git a/packages/core/src/browser/preferences/index.ts b/packages/core/src/browser/preferences/index.ts new file mode 100644 index 0000000..cd88605 --- /dev/null +++ b/packages/core/src/browser/preferences/index.ts @@ -0,0 +1,18 @@ +// ***************************************************************************** +// Copyright (C) 2017 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +export * from './preference-contribution'; +export * from './preference-validation-service'; diff --git a/packages/core/src/browser/preferences/preference-contribution.ts b/packages/core/src/browser/preferences/preference-contribution.ts new file mode 100644 index 0000000..6718d9f --- /dev/null +++ b/packages/core/src/browser/preferences/preference-contribution.ts @@ -0,0 +1,54 @@ +// ***************************************************************************** +// Copyright (C) 2018 Ericsson and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { interfaces } from 'inversify'; +import { bindContributionProvider, PreferenceProvider } from '../../common'; +import { PreferenceScope, ValidPreferenceScopes } from '../../common/preferences/preference-scope'; +import { FrontendApplicationConfig } from '@theia/application-package/lib/application-props'; +import { isObject } from '../../common/types'; +import { PreferenceSchemaServiceImpl } from '../../common/preferences/preference-schema-service'; +import { PreferenceContribution, PreferenceSchemaService } from '../../common/preferences/preference-schema'; +import { DefaultsPreferenceProvider } from '../../common/preferences/defaults-preference-provider'; +import { PreferenceLanguageOverrideService } from '../../common/preferences/preference-language-override-service'; +import { FrontendConfigPreferenceContribution } from './frontend-config-preference-contributions'; +import { bindPreferenceConfigurations } from '../../common/preferences/preference-configurations'; + +export function bindPreferenceSchemaProvider(bind: interfaces.Bind): void { + bindPreferenceConfigurations(bind); + bind(ValidPreferenceScopes).toConstantValue([PreferenceScope.Default, PreferenceScope.User, PreferenceScope.Workspace, PreferenceScope.Folder]); + bind(PreferenceSchemaServiceImpl).toSelf().inSingletonScope(); + bind(PreferenceSchemaService).toService(PreferenceSchemaServiceImpl); + bind(PreferenceProvider).to(DefaultsPreferenceProvider).inSingletonScope().whenTargetNamed(PreferenceScope.Default); + bind(PreferenceLanguageOverrideService).toSelf().inSingletonScope(); + bindContributionProvider(bind, PreferenceContribution); + bind(PreferenceContribution).to(FrontendConfigPreferenceContribution).inSingletonScope(); +} + +/** + * Specialized {@link FrontendApplicationConfig} to configure default + * preference values for the {@link PreferenceSchemaProvider}. + */ +export interface FrontendApplicationPreferenceConfig extends FrontendApplicationConfig { + preferences: { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + [preferenceName: string]: any + } +} +export namespace FrontendApplicationPreferenceConfig { + export function is(config: FrontendApplicationConfig): config is FrontendApplicationPreferenceConfig { + return isObject(config.preferences); + } +} diff --git a/packages/core/src/browser/preferences/preference-proxy.spec.ts b/packages/core/src/browser/preferences/preference-proxy.spec.ts new file mode 100644 index 0000000..fb9c9d9 --- /dev/null +++ b/packages/core/src/browser/preferences/preference-proxy.spec.ts @@ -0,0 +1,373 @@ +// ***************************************************************************** +// Copyright (C) 2018 Ericsson and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +/* eslint-disable @typescript-eslint/no-explicit-any */ + +import { enableJSDOM } from '../test/jsdom'; + +let disableJSDOM = enableJSDOM(); + +import * as assert from 'assert'; +import { Container } from 'inversify'; +import { bindPreferenceService } from '../frontend-application-bindings'; +import { bindMockPreferenceProviders, MockPreferenceProvider } from './test'; +import { PreferenceScope } from '../../common/preferences/preference-scope'; +import { FrontendApplicationConfigProvider } from '../frontend-application-config-provider'; +import { PreferenceProxyOptions, PreferenceProxy, PreferenceChangeEvent, createPreferenceProxy } from '../../common/preferences/preference-proxy'; +import { PreferenceProxyFactory } from '../../common/preferences/injectable-preference-proxy'; + +disableJSDOM(); + +process.on('unhandledRejection', (reason, promise) => { + console.error(reason); + throw reason; +}); + +import { expect } from 'chai'; +import { PreferenceProvider } from '../../common/preferences/preference-provider'; +import { PreferenceSchema, PreferenceSchemaService } from '../../common/preferences/preference-schema'; +import { PreferenceService, PreferenceServiceImpl } from '../../common/preferences'; +import { waitForEvent } from '../../common/promise-util'; +let testContainer: Container; + +function createTestContainer(): Container { + const result = new Container(); + bindPreferenceService(result.bind.bind(result)); + bindMockPreferenceProviders(result.bind.bind(result), result.unbind.bind(result)); + return result; +} + +describe('Preference Proxy', () => { + let prefService: PreferenceServiceImpl; + let prefSchema: PreferenceSchemaService; + + before(() => { + disableJSDOM = enableJSDOM(); + FrontendApplicationConfigProvider.set({}); + }); + + after(() => { + disableJSDOM(); + }); + + beforeEach(async () => { + testContainer = createTestContainer(); + prefSchema = testContainer.get(PreferenceSchemaService); + prefService = testContainer.get(PreferenceService) as PreferenceServiceImpl; + getProvider(PreferenceScope.User).markReady(); + getProvider(PreferenceScope.Workspace).markReady(); + getProvider(PreferenceScope.Folder).markReady(); + try { + await prefService.ready; + } catch (e) { + console.error(e); + } + }); + + afterEach(() => { + }); + + // Actually run the test suite with different parameters: + testPreferenceProxy('Synchronous Schema Definition + createPreferenceProxy', { asyncSchema: false }); + testPreferenceProxy('Asynchronous Schema Definition (1s delay) + createPreferenceProxy', { asyncSchema: true }); + testPreferenceProxy('Synchronous Schema Definition + Injectable Preference Proxy', { asyncSchema: false, useFactory: true }); + testPreferenceProxy('Asynchronous Schema Definition (1s delay) + Injectable Preference Proxy', { asyncSchema: true, useFactory: true }); + + function getProvider(scope: PreferenceScope): MockPreferenceProvider { + return testContainer.getNamed(PreferenceProvider, scope) as MockPreferenceProvider; + } + + function testPreferenceProxy(testDescription: string, testOptions: { asyncSchema: boolean, useFactory?: boolean }): void { + + describe(testDescription, () => { + + function getProxy(schema?: PreferenceSchema, options?: PreferenceProxyOptions): { + proxy: PreferenceProxy<{ [key: string]: any }>, + /** Only set if we are using a schema asynchronously. */ + promisedSchema?: Promise + } { + const s: PreferenceSchema = schema || { + scope: PreferenceScope.Folder, + properties: { + 'my.pref': { + type: 'string', + default: 'foo' + } + } + }; + if (testOptions.asyncSchema) { + const promisedSchema = new Promise(resolve => setTimeout(() => { + prefSchema.addSchema(s); + resolve(s); + }, 500)); + const proxy = testOptions.useFactory + ? testContainer.get(PreferenceProxyFactory)(promisedSchema, options) + : createPreferenceProxy(prefService, promisedSchema, options); + return { proxy, promisedSchema }; + } else { + prefSchema.addSchema(s); + const proxy = testOptions.useFactory + ? testContainer.get(PreferenceProxyFactory)(s, options) + : createPreferenceProxy(prefService, s, options); + return { proxy }; + } + } + + if (testOptions.asyncSchema) { + it('using the proxy before the schema is set should be no-op', async () => { + const { proxy, promisedSchema } = getProxy(); + let changed = 0; + proxy.onPreferenceChanged(event => { + changed += 1; + }); + expect(proxy['my.pref']).to.equal(undefined); + expect(Object.keys(proxy).length).to.equal(0); + // The proxy doesn't know the schema, so events shouldn't be forwarded: + await getProvider(PreferenceScope.User).setPreference('my.pref', 'bar'); + expect(changed).to.equal(0); + expect(proxy['my.pref']).to.equal(undefined); + expect(Object.keys(proxy).length).to.equal(0); + // Once the schema is resolved, operations should be working: + await promisedSchema!; + changed = 0; + expect(proxy['my.pref']).to.equal('bar'); + expect(Object.keys(proxy)).members(['my.pref']); + await getProvider(PreferenceScope.User).setPreference('my.pref', 'fizz'); + expect(changed).to.equal(1); + expect(proxy['my.pref']).to.equal('fizz'); + + }); + } + + it('by default, it should provide access in flat style but not deep', async () => { + const { proxy, promisedSchema } = getProxy(); + if (promisedSchema) { + await promisedSchema; + } + expect(proxy['my.pref']).to.equal('foo'); + expect(proxy.my).to.equal(undefined); + expect(Object.keys(proxy).join()).to.equal(['my.pref'].join()); + }); + + it('it should provide access in deep style but not flat', async () => { + const { proxy, promisedSchema } = getProxy(undefined, { style: 'deep' }); + if (promisedSchema) { + await promisedSchema; + } + expect(proxy['my.pref']).to.equal(undefined); + expect(proxy.my.pref).to.equal('foo'); + expect(Object.keys(proxy).join()).equal('my'); + }); + + it('it should provide access in to both styles', async () => { + const { proxy, promisedSchema } = getProxy(undefined, { style: 'both' }); + if (promisedSchema) { + await promisedSchema; + } + expect(proxy['my.pref']).to.equal('foo'); + expect(proxy.my.pref).to.equal('foo'); + expect(Object.keys(proxy).join()).to.equal(['my', 'my.pref'].join()); + }); + + it('it should forward change events', async () => { + const { proxy, promisedSchema } = getProxy(undefined, { style: 'both' }); + if (promisedSchema) { + await promisedSchema; + } + await waitForEvent(prefService.onPreferenceChanged, 500); + let theChange: PreferenceChangeEvent<{ [key: string]: any }>; + proxy.onPreferenceChanged(change => { + expect(theChange).to.equal(undefined); + theChange = change; + }); + let theSecondChange: PreferenceChangeEvent<{ [key: string]: any }>; + (proxy.my as PreferenceProxy<{ [key: string]: any }>).onPreferenceChanged(change => { + expect(theSecondChange).to.equal(undefined); + theSecondChange = change; + }); + + await getProvider(PreferenceScope.User).setPreference('my.pref', 'bar'); + + expect(theChange!.preferenceName).to.equal('my.pref'); + expect(theSecondChange!.preferenceName).to.equal('my.pref'); + }); + + it("should not forward changes that don't match the proxy's language override", async () => { + const { proxy, promisedSchema } = getProxy({ + scope: PreferenceScope.User, + properties: { + 'my.pref': { + type: 'string', + default: 'foo', + overridable: true, + } + } + }, { style: 'both', overrideIdentifier: 'typescript' }); + await promisedSchema; + let changeEventsEmittedByProxy = 0; + let changeEventsEmittedByService = 0; + prefSchema.registerOverrideIdentifier('swift'); + prefSchema.registerOverrideIdentifier('typescript'); + // The service will emit events related to updating the overrides - those are irrelevant + await waitForEvent(prefService.onPreferenceChanged, 500); + + prefService.onPreferencesChanged(() => changeEventsEmittedByService++); + proxy.onPreferenceChanged(() => changeEventsEmittedByProxy++); + await prefService.set(prefService.overridePreferenceName({ overrideIdentifier: 'swift', preferenceName: 'my.pref' }), 'boo', PreferenceScope.User); + expect(changeEventsEmittedByService, 'The service should have emitted an event for the non-matching override.').to.equal(1); + expect(changeEventsEmittedByProxy, 'The proxy should not have emitted an event for the non-matching override.').to.equal(0); + await prefService.set('my.pref', 'far', PreferenceScope.User); + expect(changeEventsEmittedByService, 'The service should have emitted an event for the base name.').to.equal(2); + expect(changeEventsEmittedByProxy, 'The proxy should have emitted for an event for the base name.').to.equal(1); + await prefService.set(prefService.overridePreferenceName({ preferenceName: 'my.pref', overrideIdentifier: 'typescript' }), 'faz', PreferenceScope.User); + expect(changeEventsEmittedByService, 'The service should have emitted an event for the matching override.').to.equal(3); + expect(changeEventsEmittedByProxy, 'The proxy should have emitted an event for the matching override.').to.equal(2); + await prefService.set('my.pref', 'yet another value', PreferenceScope.User); + expect(changeEventsEmittedByService, 'The service should have emitted another event for the base name.').to.equal(4); + expect(changeEventsEmittedByProxy, 'The proxy should not have emitted an event, because the value for TS has been overridden.').to.equal(2); + }); + + it('`affects` should only return `true` if the language overrides match', async () => { + const { proxy, promisedSchema } = getProxy({ + scope: PreferenceScope.User, + properties: { + 'my.pref': { + type: 'string', + default: 'foo', + overridable: true, + } + } + }, { style: 'both' }); + await promisedSchema; + prefSchema.registerOverrideIdentifier('swift'); + prefSchema.registerOverrideIdentifier('typescript'); + let changesNotAffectingTypescript = 0; + let changesAffectingTypescript = 0; + proxy.onPreferenceChanged(change => { + if (change.affects(undefined, 'typescript')) { + changesAffectingTypescript++; + } else { + changesNotAffectingTypescript++; + } + }); + await prefService.set('my.pref', 'bog', PreferenceScope.User); + expect(changesNotAffectingTypescript, 'Two events (one for `my.pref` and one for `[swift].my.pref`) should not have affected TS').to.equal(2); + expect(changesAffectingTypescript, 'One event should have been fired that does affect typescript.').to.equal(1); + }); + + it('toJSON with deep', async () => { + const { proxy, promisedSchema } = getProxy({ + scope: PreferenceScope.Default, + properties: { + 'foo.baz': { + type: 'number', + default: 4 + }, + 'foo.bar.x': { + type: 'boolean', + default: true + }, + 'foo.bar.y': { + type: 'boolean', + default: false + }, + 'a': { + type: 'string', + default: 'a' + } + } + }, { style: 'deep' }); + if (promisedSchema) { + await promisedSchema; + } + + const result = JSON.stringify(proxy, undefined, 2); + assert.equal(result, JSON.stringify({ + foo: { + baz: 4, + bar: { + x: true, + y: false + } + }, + a: 'a' + }, undefined, 2), 'there should not be foo.bar.x to avoid sending excessive data to remote clients'); + }); + + it('get nested default', async () => { + const { proxy, promisedSchema } = getProxy({ + scope: PreferenceScope.Default, + properties: { + 'foo': { + 'anyOf': [ + { + 'enum': [ + false + ] + }, + { + 'properties': { + 'bar': { + 'anyOf': [ + { + 'enum': [ + false + ] + }, + { + 'properties': { + 'x': { + type: 'boolean' + }, + 'y': { + type: 'boolean' + } + } + } + ] + } + } + } + ], + default: { + bar: { + x: true, + y: false + } + } + } + } + }, { style: 'both' }); + if (promisedSchema) { + await promisedSchema; + } + assert.deepStrictEqual(proxy['foo'], { + bar: { + x: true, + y: false + } + }); + assert.deepStrictEqual(proxy['foo.bar'], { + x: true, + y: false + }); + assert.strictEqual(proxy['foo.bar.x'], true); + assert.strictEqual(proxy['foo.bar.y'], false); + }); + }); + } + +}); diff --git a/packages/core/src/browser/preferences/preference-schema-provider.spec.ts b/packages/core/src/browser/preferences/preference-schema-provider.spec.ts new file mode 100644 index 0000000..47368ae --- /dev/null +++ b/packages/core/src/browser/preferences/preference-schema-provider.spec.ts @@ -0,0 +1,118 @@ +// ***************************************************************************** +// Copyright (C) 2021 Ericsson and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { enableJSDOM } from '../test/jsdom'; + +let disableJSDOM = enableJSDOM(); + +import * as assert from 'assert'; +import { Container } from 'inversify'; +import { bindPreferenceService } from '../frontend-application-bindings'; +import { FrontendApplicationConfigProvider } from '../frontend-application-config-provider'; +import { IndexedAccess, PreferenceDataProperty, PreferenceSchemaService } from '../../common/preferences/preference-schema'; +import { PreferenceProvider, PreferenceProviderProvider, PreferenceScope } from '../../common/preferences'; + +disableJSDOM(); + +process.on('unhandledRejection', (reason, promise) => { + console.error(reason); + throw reason; +}); + +// const { expect } = require('chai'); +let testContainer: Container; + +function createTestContainer(): Container { + const result = new Container(); + bindPreferenceService(result.bind.bind(result)); + return result; +} + +const EDITOR_FONT_SIZE_PROPERTIES: IndexedAccess = { + 'editor.fontSize': { + type: 'number', + default: 14, + overridable: true + }, +}; +const EDITOR_INSERT_SPACES_PROPERTIES: IndexedAccess = { + 'editor.insertSpaces': { + type: 'boolean', + default: true, + overridable: true + }, +}; + +describe('Preference Schema Provider', () => { + let prefSchema: PreferenceSchemaService; + let prefDefaults: PreferenceProvider; + + before(() => { + disableJSDOM = enableJSDOM(); + FrontendApplicationConfigProvider.set({ + preferences: { + 'editor.fontSize': 20, + '[typescript]': { 'editor.fontSize': 24 } + } + }); + }); + + after(() => { + disableJSDOM(); + }); + + beforeEach(async () => { + testContainer = createTestContainer(); + prefSchema = testContainer.get(PreferenceSchemaService); + await prefSchema.ready; + prefSchema.registerOverrideIdentifier('typescript'); + const providerProvider: PreferenceProviderProvider = testContainer.get(PreferenceProviderProvider); + prefDefaults = providerProvider(PreferenceScope.Default)!; + await prefDefaults.ready; + }); + + it('Should load all preferences specified in the frontend config.', () => { + assert.strictEqual(prefDefaults.get('editor.fontSize'), 20); + assert.strictEqual(prefDefaults.get('[typescript].editor.fontSize'), 24); + }); + + it('Should favor the default specified in the package.json over a default registered by a schema', () => { + prefSchema.addSchema({ + scope: PreferenceScope.User, + properties: { + ...EDITOR_FONT_SIZE_PROPERTIES + } + }); + + assert.strictEqual(prefDefaults.get('editor.fontSize'), 20); + }); + + it('Should merge language-specific overrides from schemas and the package.json', () => { + prefSchema.addSchema({ + properties: { + ...EDITOR_FONT_SIZE_PROPERTIES, + ...EDITOR_INSERT_SPACES_PROPERTIES, + }, + scope: PreferenceScope.Default + }); + + prefSchema.registerOverride('editor.insertSpaces', 'typescript', false); + + assert.strictEqual(prefDefaults.get('editor.insertSpaces'), true); + assert.strictEqual(prefDefaults.get('[typescript].editor.insertSpaces'), false); + assert.strictEqual(prefDefaults.get('[typescript].editor.fontSize'), 24); + }); +}); diff --git a/packages/core/src/browser/preferences/preference-service.spec.ts b/packages/core/src/browser/preferences/preference-service.spec.ts new file mode 100644 index 0000000..7770a0f --- /dev/null +++ b/packages/core/src/browser/preferences/preference-service.spec.ts @@ -0,0 +1,540 @@ +// ***************************************************************************** +// Copyright (C) 2018 Ericsson and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +/* eslint-disable @typescript-eslint/no-explicit-any */ + +import { enableJSDOM } from '../test/jsdom'; + +let disableJSDOM = enableJSDOM(); + +import * as assert from 'assert'; +import { Container } from 'inversify'; +import { PreferenceChange, PreferenceChanges, PreferenceProvider, PreferenceScope, PreferenceService, PreferenceServiceImpl } from '../../common/preferences'; +import { PreferenceSchema, PreferenceSchemaService } from '../../common/preferences/preference-schema'; +import { FrontendApplicationConfigProvider } from '../frontend-application-config-provider'; +import { bindMockPreferenceProviders, MockPreferenceProvider } from './test'; +import { PreferenceChangeEvent, createPreferenceProxy } from '../../common/preferences/preference-proxy'; +import { bindPreferenceService } from '../frontend-application-bindings'; + +disableJSDOM(); + +process.on('unhandledRejection', (reason, promise) => { + console.error(reason); + throw reason; +}); + +const { expect } = require('chai'); +let testContainer: Container; + +function createTestContainer(): Container { + const result = new Container(); + bindPreferenceService(result.bind.bind(result)); + bindMockPreferenceProviders(result.bind.bind(result), result.unbind.bind(result)); + return result; +} + +describe('Preference Service', () => { + let prefService: PreferenceServiceImpl; + let prefSchema: PreferenceSchemaService; + + before(() => { + disableJSDOM = enableJSDOM(); + FrontendApplicationConfigProvider.set({}); + }); + + after(() => { + disableJSDOM(); + }); + + beforeEach(async () => { + testContainer = createTestContainer(); + prefSchema = testContainer.get(PreferenceSchemaService); + prefService = testContainer.get(PreferenceService) as PreferenceServiceImpl; + getProvider(PreferenceScope.User).markReady(); + getProvider(PreferenceScope.Workspace).markReady(); + getProvider(PreferenceScope.Folder).markReady(); + console.log('before ready'); + try { + await prefService.ready; + } catch (e) { + console.error(e); + } + console.log('done'); + }); + + afterEach(() => { + }); + + function getProvider(scope: PreferenceScope): MockPreferenceProvider { + return testContainer.getNamed(PreferenceProvider, scope) as MockPreferenceProvider; + } + + it('should return the preference from the more specific scope (user > workspace)', () => { + prefSchema.addSchema({ + scope: PreferenceScope.Folder, + properties: { + 'test.number': { + type: 'number', + } + } + }); + const userProvider = getProvider(PreferenceScope.User); + const workspaceProvider = getProvider(PreferenceScope.Workspace); + const folderProvider = getProvider(PreferenceScope.Folder); + userProvider.setPreference('test.number', 1); + expect(prefService.get('test.number')).equals(1); + workspaceProvider.setPreference('test.number', 0); + expect(prefService.get('test.number')).equals(0); + folderProvider.setPreference('test.number', 2); + expect(prefService.get('test.number')).equals(2); + + // remove property on lower scope + folderProvider.setPreference('test.number', undefined); + expect(prefService.get('test.number')).equals(0); + }); + + it('should throw a TypeError if the preference (reference object) is modified', () => { + prefSchema.addSchema({ + scope: PreferenceScope.Folder, + properties: { + 'test.immutable': { + type: 'array', + items: { + type: 'string' + }, + } + } + }); + const userProvider = getProvider(PreferenceScope.User); + userProvider.setPreference('test.immutable', [ + 'test', 'test', 'test' + ]); + const immutablePref: string[] | undefined = prefService.get('test.immutable'); + expect(immutablePref).to.not.be.undefined; + if (immutablePref !== undefined) { + expect(() => immutablePref.push('fails')).to.throw(TypeError); + } + }); + + it('should still report the more specific preference even though the less specific one changed', () => { + prefSchema.addSchema({ + scope: PreferenceScope.Folder, + properties: { + 'test.number': { + type: 'number', + } + } + }); + const userProvider = getProvider(PreferenceScope.User); + const workspaceProvider = getProvider(PreferenceScope.Workspace); + userProvider.setPreference('test.number', 1); + workspaceProvider.setPreference('test.number', 0); + expect(prefService.get('test.number')).equals(0); + + userProvider.setPreference('test.number', 4); + expect(prefService.get('test.number')).equals(0); + }); + + it('should not fire events if preference schema is unset in the same tick ', async () => { + const events: PreferenceChange[] = []; + prefService.onPreferenceChanged(event => events.push(event)); + prefSchema.registerOverrideIdentifier('go'); + + const toUnset = prefSchema.addSchema({ + scope: PreferenceScope.User, + properties: { + 'editor.insertSpaces': { + type: 'boolean', + default: true, + overridable: true + } + } + }); + + prefSchema.registerOverride('editor.insertSpaces', 'go', false); + assert.deepStrictEqual([], events.map(e => e.preferenceName), 'events after set in the same tick'); + assert.strictEqual(prefService.get('editor.insertSpaces'), true, 'get before'); + assert.strictEqual(prefService.get('[go].editor.insertSpaces'), false, 'get before overridden'); + + toUnset.dispose(); + + assert.deepStrictEqual([], events.map(e => e.preferenceName), 'events after unset in the same tick'); + assert.strictEqual(prefService.get('editor.insertSpaces'), undefined, 'get after'); // removing the schema does not removes the default value + assert.strictEqual(prefService.get('[go].editor.insertSpaces'), false, 'get after overridden'); // but not the override + + assert.deepStrictEqual([], events.map(e => e.preferenceName), 'events in next tick'); + }); + + it('should fire events if preference schema is unset in another tick', async () => { + prefSchema.registerOverrideIdentifier('go'); + + let pending = new Promise(resolve => prefService.onPreferencesChanged(resolve)); + const toUnset = prefSchema.addSchema({ + scope: PreferenceScope.User, + properties: { + 'editor.insertSpaces': { + type: 'boolean', + default: true, + overridable: true + } + } + }); + prefSchema.registerOverride('editor.insertSpaces', 'go', false); + let changes = await pending; + + assert.deepStrictEqual([ + 'editor.insertSpaces', + '[go].editor.insertSpaces' + ], Object.keys(changes).map(key => changes[key].preferenceName), 'events before'); + assert.strictEqual(prefService.get('editor.insertSpaces'), true, 'get before'); + assert.strictEqual(prefService.get('[go].editor.insertSpaces'), false, 'get before overridden'); + + pending = new Promise(resolve => prefService.onPreferencesChanged(resolve)); + toUnset.dispose(); + changes = await pending; + + assert.deepStrictEqual([ + 'editor.insertSpaces', + '[go].editor.insertSpaces' + ], Object.keys(changes).map(key => changes[key].preferenceName), 'events after'); + assert.strictEqual(prefService.get('editor.insertSpaces'), undefined, 'get after'); + assert.strictEqual(prefService.get('[go].editor.insertSpaces'), false, 'get after overridden'); + }); + + function prepareServices(options?: { schema: PreferenceSchema }): { + preferences: PreferenceServiceImpl; + schema: PreferenceSchemaService; + } { + prefSchema.addSchema(options && options.schema || { + scope: PreferenceScope.User, + properties: { + 'editor.tabSize': { + type: 'number', + default: 4, + description: '', + overridable: true, + } + } + }); + + return { preferences: prefService, schema: prefSchema }; + } + + describe('PreferenceService.updateValues()', () => { + const TAB_SIZE = 'editor.tabSize'; + const DUMMY_URI = 'dummy_uri'; + async function generateAndCheckValues( + preferences: PreferenceService, + globalValue: number | undefined, + workspaceValue: number | undefined, + workspaceFolderValue: number | undefined + ): Promise { + await preferences.set(TAB_SIZE, globalValue, PreferenceScope.User); + await preferences.set(TAB_SIZE, workspaceValue, PreferenceScope.Workspace); + await preferences.set(TAB_SIZE, workspaceFolderValue, PreferenceScope.Folder, DUMMY_URI); + const expectedValue = workspaceFolderValue ?? workspaceValue ?? globalValue ?? 4; + checkValues(preferences, globalValue, workspaceValue, workspaceFolderValue, expectedValue); + } + + function checkValues( + preferences: PreferenceService, + globalValue: number | undefined, + workspaceValue: number | undefined, + workspaceFolderValue: number | undefined, + value: number = 4, + ): void { + const expected = { + preferenceName: 'editor.tabSize', + defaultValue: 4, + globalValue, + workspaceValue, + workspaceFolderValue, + value, + }; + const inspection = preferences.inspect(TAB_SIZE, DUMMY_URI); + assert.deepStrictEqual(inspection, expected); + } + + it('should modify the narrowest scope.', async () => { + const { preferences } = prepareServices(); + + await generateAndCheckValues(preferences, 1, 2, 3); + await preferences.updateValue(TAB_SIZE, 8, DUMMY_URI); + checkValues(preferences, 1, 2, 8, 8); + + await generateAndCheckValues(preferences, 1, 2, undefined); + await preferences.updateValue(TAB_SIZE, 8, DUMMY_URI); + checkValues(preferences, 1, 8, undefined, 8); + + await generateAndCheckValues(preferences, 1, undefined, undefined); + await preferences.updateValue(TAB_SIZE, 8, DUMMY_URI); + checkValues(preferences, 8, undefined, undefined, 8); + }); + + it('defaults to user scope.', async () => { + const { preferences } = prepareServices(); + checkValues(preferences, undefined, undefined, undefined); + await preferences.updateValue(TAB_SIZE, 8, DUMMY_URI); + checkValues(preferences, 8, undefined, undefined, 8); + }); + + it('clears all settings when input is undefined.', async () => { + const { preferences } = prepareServices(); + + await generateAndCheckValues(preferences, 1, 2, 3); + await preferences.updateValue(TAB_SIZE, undefined, DUMMY_URI); + checkValues(preferences, undefined, undefined, undefined); + }); + + it('deletes user setting if user is only defined scope and target is default value', async () => { + const { preferences } = prepareServices(); + + await generateAndCheckValues(preferences, 8, undefined, undefined); + await preferences.updateValue(TAB_SIZE, 4, DUMMY_URI); + checkValues(preferences, undefined, undefined, undefined); + }); + + it('does not delete setting in lower scopes, even if target is default', async () => { + const { preferences } = prepareServices(); + + await generateAndCheckValues(preferences, undefined, 2, undefined); + await preferences.updateValue(TAB_SIZE, 4, DUMMY_URI); + checkValues(preferences, undefined, 4, undefined); + }); + }); + + describe('overridden preferences', () => { + + it('get #0', () => { + const { preferences } = prepareServices(); + + preferences.set('[json].editor.tabSize', 2, PreferenceScope.User); + + expect(preferences.get('editor.tabSize')).to.equal(4); + expect(preferences.get('[json].editor.tabSize')).to.equal(2); + }); + + it('get #1', () => { + const { preferences, schema } = prepareServices(); + schema.registerOverrideIdentifier('json'); + + expect(preferences.get('editor.tabSize')).to.equal(4); + expect(preferences.get('[json].editor.tabSize')).to.equal(4); + + preferences.set('[json].editor.tabSize', 2, PreferenceScope.User); + + expect(preferences.get('editor.tabSize')).to.equal(4); + expect(preferences.get('[json].editor.tabSize')).to.equal(2); + }); + + it('get #2', () => { + const { preferences, schema } = prepareServices(); + schema.registerOverrideIdentifier('json'); + + expect(preferences.get('editor.tabSize')).to.equal(4); + expect(preferences.get('[json].editor.tabSize')).to.equal(4); + + preferences.set('editor.tabSize', 2, PreferenceScope.User); + + expect(preferences.get('editor.tabSize')).to.equal(2); + expect(preferences.get('[json].editor.tabSize')).to.equal(2); + }); + + it('has', () => { + const { preferences, schema } = prepareServices(); + + expect(preferences.has('editor.tabSize')).to.be.true; + expect(preferences.has('[json].editor.tabSize')).to.be.false; + + schema.registerOverrideIdentifier('json'); + + expect(preferences.has('editor.tabSize')).to.be.true; + expect(preferences.has('[json].editor.tabSize')).to.be.true; + }); + + it('inspect #0', () => { + const { preferences, schema } = prepareServices(); + + const expected = { + preferenceName: 'editor.tabSize', + defaultValue: 4, + globalValue: undefined, + workspaceValue: undefined, + workspaceFolderValue: undefined, + value: 4, + }; + assert.deepStrictEqual(expected, preferences.inspect('editor.tabSize')); + assert.ok(!preferences.has('[json].editor.tabSize')); + + schema.registerOverrideIdentifier('json'); + + assert.deepStrictEqual(expected, preferences.inspect('editor.tabSize')); + assert.deepStrictEqual({ + ...expected, + preferenceName: '[json].editor.tabSize' + }, preferences.inspect('[json].editor.tabSize')); + }); + + it('inspect #1', () => { + const { preferences, schema } = prepareServices(); + + const expected = { + preferenceName: 'editor.tabSize', + defaultValue: 4, + globalValue: 2, + workspaceValue: undefined, + workspaceFolderValue: undefined, + value: 2 + }; + preferences.set('editor.tabSize', 2, PreferenceScope.User); + + assert.deepStrictEqual(expected, preferences.inspect('editor.tabSize')); + assert.ok(!preferences.has('[json].editor.tabSize')); + + schema.registerOverrideIdentifier('json'); + + assert.deepStrictEqual(expected, preferences.inspect('editor.tabSize')); + assert.deepStrictEqual({ + ...expected, + preferenceName: '[json].editor.tabSize' + }, preferences.inspect('[json].editor.tabSize')); + }); + + it('inspect #2', () => { + const { preferences, schema } = prepareServices(); + + const expected = { + preferenceName: 'editor.tabSize', + defaultValue: 4, + globalValue: undefined, + workspaceValue: undefined, + workspaceFolderValue: undefined, + value: 4 + }; + assert.deepStrictEqual(expected, preferences.inspect('editor.tabSize')); + assert.ok(!preferences.has('[json].editor.tabSize')); + + schema.registerOverrideIdentifier('json'); + preferences.set('[json].editor.tabSize', 2, PreferenceScope.User); + + assert.deepStrictEqual(expected, preferences.inspect('editor.tabSize')); + assert.deepStrictEqual({ + ...expected, + preferenceName: '[json].editor.tabSize', + globalValue: 2, + value: 2, + }, preferences.inspect('[json].editor.tabSize')); + }); + + it('onPreferenceChanged #0', async () => { + const { preferences, schema } = prepareServices(); + + const events: PreferenceChange[] = []; + preferences.onPreferenceChanged(event => events.push(event)); + + schema.registerOverrideIdentifier('json'); + preferences.set('[json].editor.tabSize', 2, PreferenceScope.User); + await preferences.set('editor.tabSize', 3, PreferenceScope.User); + + assert.deepStrictEqual([ + '[json].editor.tabSize', + 'editor.tabSize' + ], events.map(e => e.preferenceName)); + }); + + it('onPreferenceChanged #1', async () => { + const { preferences, schema } = prepareServices(); + + const events: PreferenceChange[] = []; + preferences.onPreferenceChanged(event => events.push(event)); + + schema.registerOverrideIdentifier('json'); + await preferences.set('editor.tabSize', 2, PreferenceScope.User); + + assert.deepStrictEqual([ + 'editor.tabSize', + '[json].editor.tabSize' + ], events.map(e => e.preferenceName)); + }); + + it('onPreferenceChanged #2', async function (): Promise { + const { preferences, schema } = prepareServices(); + + schema.registerOverrideIdentifier('json'); + schema.registerOverrideIdentifier('javascript'); + preferences.set('[json].editor.tabSize', 2, PreferenceScope.User); + await preferences.set('editor.tabSize', 3, PreferenceScope.User); + + const events: PreferenceChangeEvent<{ [key: string]: any }>[] = []; + const proxy = createPreferenceProxy<{ [key: string]: any }>(preferences, schema.getJSONSchema(PreferenceScope.Folder), { overrideIdentifier: 'json' }); + proxy.onPreferenceChanged(event => events.push(event)); + + await preferences.set('[javascript].editor.tabSize', 4, PreferenceScope.User); + + assert.deepStrictEqual([], events.map(e => e.preferenceName), 'changes not relevant to json override should be ignored'); + }); + + it('onPreferenceChanged #3', async () => { + const { preferences, schema } = prepareServices(); + + schema.registerOverrideIdentifier('json'); + preferences.set('[json].editor.tabSize', 2, PreferenceScope.User); + await preferences.set('editor.tabSize', 3, PreferenceScope.User); + + const events: PreferenceChange[] = []; + preferences.onPreferenceChanged(event => events.push(event)); + + await preferences.set('[json].editor.tabSize', undefined, PreferenceScope.User); + + assert.deepStrictEqual(['[json].editor.tabSize'], events.map(e => e.preferenceName)); + }); + + it('defaultOverrides [go].editor.formatOnSave', () => { + const { preferences, schema } = prepareServices({ + schema: { + scope: PreferenceScope.Folder, + properties: { + 'editor.insertSpaces': { + type: 'boolean', + default: true, + overridable: true + }, + 'editor.formatOnSave': { + type: 'boolean', + default: false, + overridable: true + } + } + } + }); + + assert.strictEqual(true, preferences.get('editor.insertSpaces')); + assert.strictEqual(undefined, preferences.get('[go].editor.insertSpaces')); + assert.strictEqual(false, preferences.get('editor.formatOnSave')); + assert.strictEqual(undefined, preferences.get('[go].editor.formatOnSave')); + + schema.registerOverrideIdentifier('go'); + prefSchema.registerOverride('editor.insertSpaces', 'go', false); + prefSchema.registerOverride('editor.formatOnSave', 'go', true); + + assert.strictEqual(true, preferences.get('editor.insertSpaces')); + assert.strictEqual(false, preferences.get('[go].editor.insertSpaces')); + assert.strictEqual(false, preferences.get('editor.formatOnSave')); + assert.strictEqual(true, preferences.get('[go].editor.formatOnSave')); + }); + }); + +}); diff --git a/packages/core/src/browser/preferences/preference-validation-service.spec.ts b/packages/core/src/browser/preferences/preference-validation-service.spec.ts new file mode 100644 index 0000000..e5aba2b --- /dev/null +++ b/packages/core/src/browser/preferences/preference-validation-service.spec.ts @@ -0,0 +1,342 @@ +// ***************************************************************************** +// Copyright (C) 2022 Ericsson and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { Container } from 'inversify'; +import { PreferenceValidationService } from './preference-validation-service'; +import * as assert from 'assert'; +import { JSONValue } from '@lumino/coreutils'; +import { IJSONSchema, JsonType } from '../../common/json-schema'; +import { + DefaultsPreferenceProvider, Disposable, PreferenceDataProperty, PreferenceProvider, + PreferenceSchemaService, PreferenceSchemaServiceImpl, PreferenceScope +} from '../../common'; +import { PreferenceLanguageOverrideService } from '../../common/preferences/preference-language-override-service'; + +/* eslint-disable no-null/no-null */ + +describe('Preference Validation Service', () => { + const container = new Container(); + container.bind(PreferenceSchemaService).toConstantValue({ + getDefaultValue: PreferenceSchemaServiceImpl.prototype.getDefaultValue, + onDidChangeDefaultValue: () => Disposable.NULL + } as unknown as PreferenceSchemaService); + container.bind(PreferenceLanguageOverrideService).to(PreferenceLanguageOverrideService).inSingletonScope(); + container.bind(PreferenceProvider).to(DefaultsPreferenceProvider).inSingletonScope().whenTargetNamed(PreferenceScope.Default); + + const validator = container.resolve(PreferenceValidationService); + const validateBySchema: (value: JSONValue, schema: PreferenceDataProperty) => JSONValue = validator.validateBySchema.bind(validator, 'dummy'); + + describe('should validate strings', () => { + const expected = 'expected'; + it('good input -> should return the same string', () => { + const actual = validateBySchema(expected, { type: 'string' }); + assert.strictEqual(actual, expected); + }); + it('bad input -> should return the default', () => { + const actual = validateBySchema(3, { type: 'string', default: expected }); + assert.strictEqual(actual, expected); + }); + it('bad input -> should return string even if default is not a string', () => { + const actual = validateBySchema(3, { type: 'string', default: 3 }); + assert.strictEqual(typeof actual, 'string'); + assert.strictEqual(actual, '3'); + }); + it('bad input -> should return an empty string if no default', () => { + const actual = validateBySchema(3, { type: 'string' }); + assert.strictEqual(actual, ''); + }); + }); + describe('should validate numbers', () => { + const expected = 1.23; + it('good input -> should return the same number', () => { + const actual = validateBySchema(expected, { type: 'number' }); + assert.strictEqual(actual, expected); + }); + it('bad input -> should return the default', () => { + const actual = validateBySchema('zxy', { type: 'number', default: expected }); + assert.strictEqual(actual, expected); + }); + it('bad input -> should return a number even if the default is not a number', () => { + const actual = validateBySchema('zxy', { type: 'number', default: ['fun array'] }); + assert.strictEqual(actual, 0); + }); + it('bad input -> should return 0 if no default', () => { + const actual = validateBySchema('zxy', { type: 'number' }); + assert.strictEqual(actual, 0); + }); + it('should do its best to make a number of a string', () => { + const actual = validateBySchema(expected.toString(), { type: 'number' }); + assert.strictEqual(actual, expected); + }); + it('should return the max if input is greater than max', () => { + const maximum = 50; + const actual = validateBySchema(100, { type: 'number', maximum }); + assert.strictEqual(actual, maximum); + }); + it('should return the minimum if input is less than minimum', () => { + const minimum = 30; + const actual = validateBySchema(15, { type: 'number', minimum }); + assert.strictEqual(actual, minimum); + }); + }); + describe('should validate integers', () => { + const expected = 2; + it('good input -> should return the same number', () => { + const actual = validateBySchema(expected, { type: 'integer' }); + assert.strictEqual(actual, expected); + }); + it('bad input -> should return the default', () => { + const actual = validateBySchema('zxy', { type: 'integer', default: expected }); + assert.strictEqual(actual, expected); + }); + it('bad input -> should return 0 if no default', () => { + const actual = validateBySchema('zxy', { type: 'integer' }); + assert.strictEqual(actual, 0); + }); + it('should round a non-integer', () => { + const actual = validateBySchema(1.75, { type: 'integer' }); + assert.strictEqual(actual, expected); + }); + }); + describe('should validate booleans', () => { + it('good input -> should return the same value', () => { + assert.strictEqual(validateBySchema(true, { type: 'boolean' }), true); + assert.strictEqual(validateBySchema(false, { type: 'boolean' }), false); + }); + it('bad input -> should return the default', () => { + const actual = validateBySchema(['not a boolean!'], { type: 'boolean', default: true }); + assert.strictEqual(actual, true); + }); + it('bad input -> should return false if no default', () => { + const actual = validateBySchema({ isBoolean: 'no' }, { type: 'boolean' }); + assert.strictEqual(actual, false); + }); + it('should treat string "true" and "false" as equivalent to booleans', () => { + assert.strictEqual(validateBySchema('true', { type: 'boolean' }), true); + assert.strictEqual(validateBySchema('false', { type: 'boolean' }), false); + }); + }); + describe('should validate null', () => { + it('should always just return null', () => { + assert.strictEqual(validateBySchema({ whatever: ['anything'] }, { type: 'null' }), null); + assert.strictEqual(validateBySchema('not null', { type: 'null' }), null); + assert.strictEqual(validateBySchema(123, { type: 'null', default: 123 }), null); + }); + }); + describe('should validate enums', () => { + const expected = 'expected'; + const defaultValue = 'default'; + const options = [expected, defaultValue, 'other-value']; + it('good value -> should return same value', () => { + const actual = validateBySchema(expected, { enum: options }); + assert.strictEqual(actual, expected); + }); + it('bad value -> should return default value', () => { + const actual = validateBySchema('not-in-enum', { enum: options, default: defaultValue }); + assert.strictEqual(actual, defaultValue); + }); + it('bad value -> should return first value if no default or bad default', () => { + const noDefault = validateBySchema(['not-in-enum'], { enum: options }); + assert.strictEqual(noDefault, expected); + const badDefault = validateBySchema({ inEnum: false }, { enum: options, default: 'not-in-enum' }); + assert.strictEqual(badDefault, expected); + }); + }); + describe('should validate objects', () => { + it('should reject non object types', () => { + const schema = { type: 'object' } as const; + assert.deepStrictEqual(validateBySchema(null, schema), {}); + assert.deepStrictEqual(validateBySchema('null', schema), {}); + assert.deepStrictEqual(validateBySchema(3, schema), {}); + }); + it('should reject objects that are missing required fields', () => { + const schema: PreferenceDataProperty = { type: 'object', properties: { 'required': { type: 'string' }, 'not-required': { type: 'number' } }, required: ['required'] }; + assert.deepStrictEqual(validateBySchema({ 'not-required': 3 }, schema), {}); + const defaultValue = { required: 'present' }; + assert.deepStrictEqual(validateBySchema({ 'not-required': 3 }, { ...schema, default: defaultValue }), defaultValue); + }); + it('should reject objects that have impermissible extra properties', () => { + const schema: PreferenceDataProperty = { type: 'object', properties: { 'required': { type: 'string' } }, additionalProperties: false }; + assert.deepStrictEqual(validateBySchema({ 'required': 'hello', 'not-required': 3 }, schema), {}); + }); + it('should accept objects with extra properties if extra properties are not forbidden', () => { + const input = { 'required': 'hello', 'not-forbidden': 3 }; + const schema: PreferenceDataProperty = { type: 'object', properties: { 'required': { type: 'string' } }, additionalProperties: true }; + assert.deepStrictEqual(validateBySchema(input, schema), input); + assert.deepStrictEqual(validateBySchema(input, { ...schema, additionalProperties: undefined }), input); + }); + it("should reject objects with properties that violate the property's rules", () => { + const input = { required: 'not-a-number!' }; + const schema: PreferenceDataProperty = { type: 'object', properties: { required: { type: 'number' } } }; + assert.deepStrictEqual(validateBySchema(input, schema), {}); + }); + it('should reject objects with extra properties that violate the extra property rules', () => { + const input = { required: 3, 'not-required': 'not-a-number!' }; + const schema: PreferenceDataProperty = { type: 'object', properties: { required: { type: 'number' } }, additionalProperties: { type: 'number' } }; + assert.deepStrictEqual(validateBySchema(input, schema), {}); + }); + }); + describe('should validate arrays', () => { + const expected = ['one-string', 'two-string']; + it('good input -> should return same value', () => { + const actual = validateBySchema(expected, { type: 'array', items: { type: 'string' } }); + assert.deepStrictEqual(actual, expected); + const augmentedExpected = [3, ...expected, 4]; + const augmentedActual = validateBySchema(augmentedExpected, { type: 'array', items: { type: ['number', 'string'] } }); + assert.deepStrictEqual(augmentedActual, augmentedExpected); + }); + it('bad input -> should filter out impermissible items', () => { + const actual = validateBySchema([3, ...expected, []], { type: 'array', items: { type: 'string' } }); + assert.deepStrictEqual(actual, expected); + }); + }); + describe('should validate tuples', () => { + const schema: PreferenceDataProperty & { items: IJSONSchema[] } = { + 'type': 'array', + 'items': [{ + 'type': 'number', + }, + { + 'type': 'string', + }], + }; + it('good input -> returns same object', () => { + const expected = [1, 'two']; + assert.strictEqual(validateBySchema(expected, schema), expected); + }); + it('bad input -> should use the default if supplied present and valid', () => { + const defaultValue = [8, 'three']; + const withDefault = { ...schema, default: defaultValue }; + assert.strictEqual(validateBySchema('not even an array!', withDefault), defaultValue); + assert.strictEqual(validateBySchema(['first fails', 'second ok'], withDefault), defaultValue); + assert.strictEqual(validateBySchema([], withDefault), defaultValue); + assert.strictEqual(validateBySchema([2, ['second fails']], withDefault), defaultValue); + }); + it('bad input -> in the absence of a default, it should return any good values or the default for each subschema', () => { + const withSubDefault: PreferenceDataProperty = { ...schema, items: [{ type: 'string', default: 'cool' }, ...schema.items] }; + assert.deepStrictEqual(validateBySchema('not an array', withSubDefault), ['cool', 0, '']); + assert.deepStrictEqual(validateBySchema([2, 8, null], withSubDefault), ['cool', 8, '']); + }); + it("bad input -> uses the default, but fixes fields that don't match schema", () => { + const defaultValue = [8, 8]; + const withDefault = { ...schema, default: defaultValue }; + assert.deepStrictEqual(validateBySchema('something invalid', withDefault), [8, '']); + }); + }); + describe('should validate type arrays', () => { + const type: JsonType[] = ['boolean', 'string', 'number']; + it('good input -> returns same value', () => { + const goodBoolean = validateBySchema(true, { type }); + assert.strictEqual(goodBoolean, true); + const goodString = validateBySchema('string', { type }); + assert.strictEqual(goodString, 'string'); + const goodNumber = validateBySchema(1.23, { type }); + assert.strictEqual(goodNumber, 1.23); + }); + it('bad input -> returns default if default valid', () => { + const stringDefault = 'default'; + const booleanDefault = true; + const numberDefault = 100; + assert.strictEqual(validateBySchema([], { type, default: stringDefault }), stringDefault); + assert.strictEqual(validateBySchema([], { type, default: booleanDefault }), booleanDefault); + assert.strictEqual(validateBySchema([], { type, default: numberDefault }), numberDefault); + }); + it("bad input -> returns first validator's result if no default or bad default", () => { + assert.strictEqual(validateBySchema([], { type }), false); + assert.strictEqual(validateBySchema([], { type, default: {} }), false); + }); + }); + describe('should validate anyOfs', () => { + const schema: PreferenceDataProperty = { anyOf: [{ type: 'number', minimum: 1 }, { type: 'array', items: { type: 'string' } }], default: 5 }; + it('good input -> returns same value', () => { + assert.strictEqual(validateBySchema(3, schema), 3); + const goodArray = ['a string', 'here too']; + assert.strictEqual(validateBySchema(goodArray, schema), goodArray); + }); + it('bad input -> returns default if present and valid', () => { + assert.strictEqual(validateBySchema({}, schema), 5); + }); + it('bad input -> first validator, if default absent or default ill-formed', () => { + assert.strictEqual(validateBySchema({}, { ...schema, default: 0 }), 1); + assert.strictEqual(validateBySchema({}, { ...schema, default: undefined }), 1); + }); + }); + describe('should validate oneOfs', () => { + // Between 4 and 6 should be rejected + const schema: PreferenceDataProperty = { oneOf: [{ type: 'number', minimum: 1, maximum: 6 }, { type: 'number', minimum: 4, maximum: 10 }], default: 8 }; + it('good input -> returns same value', () => { + assert.strictEqual(validateBySchema(2, schema), 2); + assert.strictEqual(validateBySchema(7, schema), 7); + }); + it('bad input -> returns default if present and valid', () => { + assert.strictEqual(validateBySchema(5, schema), 8); + }); + it('bad input -> returns value if default absent or invalid.', () => { + assert.strictEqual(validateBySchema(5, { ...schema, default: undefined }), 5); + }); + }); + describe('should validate consts', () => { + const schema: PreferenceDataProperty = { const: { 'the only': 'possible value' }, default: 'ignore-the-default' }; + const goodValue = { 'the only': 'possible value' }; + it('good input -> returns same value', () => { + assert.strictEqual(validateBySchema(goodValue, schema), goodValue); + }); + it('bad input -> returns the const value for any other value', () => { + assert.deepStrictEqual(validateBySchema('literally anything else', schema), goodValue); + assert.deepStrictEqual(validateBySchema('ignore-the-default', schema), goodValue); + }); + }); + describe('should maintain triple equality for valid object types', () => { + const arraySchema: PreferenceDataProperty = { type: 'array', items: { type: 'string' } }; + it('maintains triple equality for arrays', () => { + const input = ['one-string', 'two-string']; + assert(validateBySchema(input, arraySchema) === input); + }); + it('does not maintain triple equality if the array is only partially correct', () => { + const input = ['one-string', 'two-string', 3]; + assert.notStrictEqual(validateBySchema(input, arraySchema), input); + }); + it('maintains triple equality for objects', () => { + const schema: PreferenceDataProperty = { + 'type': 'object', + properties: { + primitive: { type: 'string' }, + complex: { type: 'object', properties: { nested: { type: 'number' } } } + } + }; + const input = { primitive: 'is a string', complex: { nested: 3 } }; + assert(validateBySchema(input, schema) === input); + }); + }); + it('should return the value if any error occurs', () => { + let wasCalled = false; + const originalValidator = validator['validateString']; + validator['validateString'] = () => { + wasCalled = true; + throw new Error('Only a test!'); + }; + const input = { shouldBeValid: false }; + const output = validateBySchema(input, { type: 'string' }); + assert(wasCalled); + assert(input === output); + validator['validateString'] = originalValidator; + }); + it('should return the same object if no validation possible', () => { + for (const input of ['whatever', { valid: 'hard to say' }, 234, ["no one knows if I'm not", 'so I am']]) { + assert(validateBySchema(input, {}) === input); + } + }); +}); diff --git a/packages/core/src/browser/preferences/preference-validation-service.ts b/packages/core/src/browser/preferences/preference-validation-service.ts new file mode 100644 index 0000000..0befef8 --- /dev/null +++ b/packages/core/src/browser/preferences/preference-validation-service.ts @@ -0,0 +1,377 @@ +// ***************************************************************************** +// Copyright (C) 2022 Ericsson and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { JSONObject, JSONValue } from '../../../shared/@lumino/coreutils'; +import { inject, injectable } from '../../../shared/inversify'; +import { IJSONSchema, JsonType } from '../../common/json-schema'; +import { deepClone, unreachable } from '../../common'; +import { PreferenceLanguageOverrideService } from '../../common/preferences/preference-language-override-service'; +import { PreferenceSchemaService, PreferenceScope, PreferenceUtils, PreferenceDataProperty } from '../../common/preferences'; + +export interface PreferenceValidator { + name: string; + validate(value: unknown): T; +} + +export type ValueValidator = (value: JSONValue) => JSONValue; + +export interface PreferenceValidationResult { + original: JSONValue | undefined; + valid: T; + messages: string[]; +} + +type ValidatablePreferenceTuple = IJSONSchema & ({ items: IJSONSchema[] } | { prefixItems: IJSONSchema[] }); + +@injectable() +export class PreferenceValidationService { + @inject(PreferenceSchemaService) protected readonly schemaService: PreferenceSchemaService; + @inject(PreferenceLanguageOverrideService) protected readonly languageOverrideService: PreferenceLanguageOverrideService; + + validateOptions(options: Record): Record { + const valid: Record = {}; + let problemsDetected = false; + for (const [preferenceName, value] of Object.entries(options)) { + const validValue = this.validateByName(preferenceName, value); + if (validValue !== value) { + problemsDetected = true; + } + valid[preferenceName] = validValue; + } + return problemsDetected ? valid : options; + } + + validateByName(preferenceName: string, value: JSONValue): JSONValue { + const validValue = this.doValidateByName(preferenceName, value); + // If value is undefined, it means the preference wasn't set, not that a bad value was set. + if (validValue !== value && value !== undefined) { + console.warn(`While validating options, found impermissible value for ${preferenceName}. Using valid value`, validValue, 'instead of configured value', value); + } + return validValue; + } + + protected doValidateByName(preferenceName: string, value: JSONValue): JSONValue { + const schema = this.getSchema(preferenceName); + return this.validateBySchema(preferenceName, value, schema); + } + + validateBySchema(key: string, value: JSONValue, schema: IJSONSchema | undefined): JSONValue { + try { + if (!schema) { + console.warn('Request to validate preference with no schema registered:', key); + return value; + } + if (schema.const !== undefined) { + return this.validateConst(key, value, schema as IJSONSchema & { const: JSONValue }); + } + if (Array.isArray(schema.enum)) { + return this.validateEnum(key, value, schema as IJSONSchema & { enum: JSONValue[] }); + } + if (Array.isArray(schema.anyOf)) { + return this.validateAnyOf(key, value, schema as IJSONSchema & { anyOf: IJSONSchema[] }); + } + if (Array.isArray(schema.oneOf)) { + return this.validateOneOf(key, value, schema as IJSONSchema & { oneOf: IJSONSchema[] }); + } + if (schema.type === undefined) { + console.warn('Request to validate preference with no type information:', key); + return value; + } + if (Array.isArray(schema.type)) { + return this.validateMultiple(key, value, schema as IJSONSchema & { type: JsonType[] }); + } + switch (schema.type) { + case 'array': + return this.validateArray(key, value, schema); + case 'boolean': + return this.validateBoolean(key, value, schema); + case 'integer': + return this.validateInteger(key, value, schema); + case 'null': + return null; // eslint-disable-line no-null/no-null + case 'number': + return this.validateNumber(key, value, schema); + case 'object': + return this.validateObject(key, value, schema); + case 'string': + return this.validateString(key, value, schema); + default: + unreachable(schema.type, `Request to validate preference with unknown type in schema: ${key}`); + } + } catch (e) { + console.error('Encountered an error while validating', key, 'with value', value, 'against schema', schema, e); + return value; + } + } + + protected getSchema(name: string): IJSONSchema | undefined { + const combinedSchema = this.schemaService.getJSONSchema(PreferenceScope.Folder).properties!; + if (combinedSchema[name]) { + return combinedSchema[name]; + } + const baseName = this.languageOverrideService.overriddenPreferenceName(name)?.preferenceName; + return baseName !== undefined ? combinedSchema[baseName] : undefined; + } + + protected validateMultiple(key: string, value: JSONValue, schema: IJSONSchema & { type: JsonType[] }): JSONValue { + const validation: IJSONSchema = deepClone(schema); + const candidate = this.mapValidators(key, value, (function* (this: PreferenceValidationService): Iterable { + for (const type of schema.type) { + validation.type = type as JsonType; + yield toValidate => this.validateBySchema(key, toValidate, validation); + } + }).bind(this)()); + if (candidate !== value && (schema.default !== undefined || schema.default !== undefined)) { + const configuredDefault = this.getDefaultFromSchema(schema); + return this.validateMultiple(key, configuredDefault, { ...schema, default: undefined }); + } + return candidate; + } + + protected validateAnyOf(key: string, value: JSONValue, schema: IJSONSchema & { anyOf: IJSONSchema[] }): JSONValue { + const candidate = this.mapValidators(key, value, (function* (this: PreferenceValidationService): Iterable { + for (const option of schema.anyOf) { + yield toValidate => this.validateBySchema(key, toValidate, option); + } + }).bind(this)()); + if (candidate !== value && (schema.default !== undefined)) { + const configuredDefault = this.getDefaultFromSchema(schema); + return this.validateAnyOf(key, configuredDefault, { ...schema, default: undefined }); + } + return candidate; + } + + protected validateOneOf(key: string, value: JSONValue, schema: IJSONSchema & { oneOf: IJSONSchema[] }): JSONValue { + let passed = false; + for (const subSchema of schema.oneOf) { + const validValue = this.validateBySchema(key, value, subSchema); + if (!passed && validValue === value) { + passed = true; + } else if (passed && validValue === value) { + passed = false; + break; + } + } + if (passed) { + return value; + } + if (schema.default !== undefined) { + const configuredDefault = this.getDefaultFromSchema(schema); + return this.validateOneOf(key, configuredDefault, { ...schema, default: undefined }); + } + console.log(`While validating ${key}, failed to find a valid value or default value. Using configured value ${value}.`); + return value; + } + + protected mapValidators(key: string, value: JSONValue, validators: Iterable<(value: JSONValue) => JSONValue>): JSONValue { + const candidates = []; + for (const validator of validators) { + const candidate = validator(value); + if (candidate === value) { + return candidate; + } + candidates.push(candidate); + } + return candidates[0]; + } + protected validateArray(key: string, value: JSONValue, schema: IJSONSchema): JSONValue[] { + const candidate = Array.isArray(value) ? value : this.getDefaultFromSchema(schema); + if (!Array.isArray(candidate)) { + return []; + } + if (!schema.items && !schema.prefixItems) { + console.warn('Requested validation of array without item specification:', key); + return candidate; + } + if (Array.isArray(schema.items) || Array.isArray(schema.prefixItems)) { + return this.validateTuple(key, value, schema as ValidatablePreferenceTuple); + } + const itemSchema = schema.items!; + const valid = candidate.filter(item => this.validateBySchema(key, item, itemSchema) === item); + return valid.length === candidate.length ? candidate : valid; + } + + protected validateTuple(key: string, value: JSONValue, schema: ValidatablePreferenceTuple): JSONValue[] { + const defaultValue = this.getDefaultFromSchema(schema); + const maybeCandidate = Array.isArray(value) ? value : defaultValue; + // If we find that the provided value is not valid, we immediately bail and try the default value instead. + const shouldTryDefault = Array.isArray(schema.default) && !PreferenceUtils.deepEqual(defaultValue, maybeCandidate); + const tryDefault = () => this.validateTuple(key, defaultValue, schema); + const candidate = Array.isArray(maybeCandidate) ? maybeCandidate : []; + // Only `prefixItems` is officially part of the JSON Schema spec, but `items` as array was part of a draft and was used by VSCode. + const tuple = (schema.prefixItems ?? schema.items) as Required['prefixItems']; + const lengthIsWrong = candidate.length < tuple.length || (candidate.length > tuple.length && !schema.additionalItems); + if (lengthIsWrong && shouldTryDefault) { return tryDefault(); } + let valid = true; + const validItems: JSONValue[] = []; + for (const [index, subschema] of tuple.entries()) { + const targetItem = candidate[index]; + const validatedItem = targetItem === undefined ? this.getDefaultFromSchema(subschema) : this.validateBySchema(key, targetItem, subschema); + valid &&= validatedItem === targetItem; + if (!valid && shouldTryDefault) { return tryDefault(); } + validItems.push(validatedItem); + }; + if (candidate.length > tuple.length) { + if (!schema.additionalItems) { + return validItems; + } else if (schema.additionalItems === true && !valid) { + validItems.push(...candidate.slice(tuple.length)); + return validItems; + } else if (schema.additionalItems !== true) { + const applicableSchema = schema.additionalItems; + for (let i = tuple.length; i < candidate.length; i++) { + const targetItem = candidate[i]; + const validatedItem = this.validateBySchema(key, targetItem, applicableSchema); + if (validatedItem === targetItem) { + validItems.push(targetItem); + } else { + valid = false; + if (shouldTryDefault) { return tryDefault(); } + } + } + } + } + return valid ? candidate : validItems; + } + + protected validateConst(key: string, value: JSONValue, schema: IJSONSchema & { const: JSONValue }): JSONValue { + if (PreferenceUtils.deepEqual(value, schema.const)) { + return value; + } + return schema.const; + } + + protected validateEnum(key: string, value: JSONValue, schema: IJSONSchema & { enum: JSONValue[] }): JSONValue { + const options = schema.enum; + if (options.some(option => PreferenceUtils.deepEqual(option, value))) { + return value; + } + const configuredDefault = this.getDefaultFromSchema(schema); + if (options.some(option => PreferenceUtils.deepEqual(option, configuredDefault))) { + return configuredDefault; + } + return options[0]; + } + + protected validateBoolean(key: string, value: JSONValue, schema: IJSONSchema): boolean { + if (value === true || value === false) { + return value; + } + if (value === 'true') { + return true; + } + if (value === 'false') { + return false; + } + return Boolean(this.getDefaultFromSchema(schema)); + } + + protected validateInteger(key: string, value: JSONValue, schema: IJSONSchema): number { + return Math.round(this.validateNumber(key, value, schema)); + } + + protected validateNumber(key: string, value: JSONValue, schema: IJSONSchema): number { + let validated = Number(value); + if (isNaN(validated)) { + const configuredDefault = Number(this.getDefaultFromSchema(schema)); + validated = isNaN(configuredDefault) ? 0 : configuredDefault; + } + if (schema.minimum !== undefined) { + validated = Math.max(validated, schema.minimum); + } + if (schema.maximum !== undefined) { + validated = Math.min(validated, schema.maximum); + } + return validated; + } + + protected validateObject(key: string, value: JSONValue, schema: IJSONSchema): JSONObject { + if (this.objectMatchesSchema(key, value, schema)) { + return value; + } + const configuredDefault = this.getDefaultFromSchema(schema); + if (this.objectMatchesSchema(key, configuredDefault, schema)) { + return configuredDefault; + } + return {}; + } + + // This evaluates most of the fields that commonly appear on PreferenceItem, but it could be improved to evaluate all possible JSON schema specifications. + protected objectMatchesSchema(key: string, value: JSONValue, schema: IJSONSchema): value is JSONObject { + if (!value || typeof value !== 'object') { + return false; + } + if (schema.required && schema.required.some(requiredField => !(requiredField in value))) { + return false; + } + if (schema.additionalProperties === false && schema.properties && Object.keys(value).some(fieldKey => !(fieldKey in schema.properties!))) { + return false; + } + const additionalPropertyValidator = schema.additionalProperties !== true && !!schema.additionalProperties && schema.additionalProperties as IJSONSchema; + for (const [fieldKey, fieldValue] of Object.entries(value)) { + const fieldLabel = `${key}#${fieldKey}`; + if (schema.properties && fieldKey in schema.properties) { + const valid = this.validateBySchema(fieldLabel, fieldValue, schema.properties[fieldKey]); + if (valid !== fieldValue) { + return false; + } + } else if (additionalPropertyValidator) { + const valid = this.validateBySchema(fieldLabel, fieldValue, additionalPropertyValidator); + if (valid !== fieldValue) { + return false; + } + } + } + return true; + } + + protected validateString(key: string, value: JSONValue, schema: IJSONSchema): string { + if (typeof value === 'string') { + return value; + } + if (value instanceof String) { + return value.toString(); + } + const configuredDefault = this.getDefaultFromSchema(schema); + return (configuredDefault ?? '').toString(); + } + + protected getDefaultFromSchema(schema: IJSONSchema): JSONValue { + return this.getDefaultValue(schema); + } + + getDefaultValue(property: PreferenceDataProperty): JSONValue { + if (property.default !== undefined) { + return property.default; + } + const type = Array.isArray(property.type) ? property.type[0] : property.type; + switch (type) { + case 'boolean': + return false; + case 'integer': + case 'number': + return 0; + case 'string': + return ''; + case 'array': + return []; + case 'object': + return {}; + } + // eslint-disable-next-line no-null/no-null + return null; + } +} diff --git a/packages/core/src/browser/preferences/test/index.ts b/packages/core/src/browser/preferences/test/index.ts new file mode 100644 index 0000000..5efb20b --- /dev/null +++ b/packages/core/src/browser/preferences/test/index.ts @@ -0,0 +1,19 @@ +// ***************************************************************************** +// Copyright (C) 2018 Ericsson and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +export * from './mock-preference-service'; +export * from './mock-preference-proxy'; +export * from './mock-preference-provider'; diff --git a/packages/core/src/browser/preferences/test/mock-preference-provider.ts b/packages/core/src/browser/preferences/test/mock-preference-provider.ts new file mode 100644 index 0000000..6802545 --- /dev/null +++ b/packages/core/src/browser/preferences/test/mock-preference-provider.ts @@ -0,0 +1,47 @@ +// ***************************************************************************** +// Copyright (C) 2019 Ericsson and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +/* eslint-disable @typescript-eslint/no-explicit-any */ + +import { interfaces } from 'inversify'; +import { PreferenceProviderImpl, PreferenceScope, PreferenceProvider } from '../../../common/preferences'; + +export class MockPreferenceProvider extends PreferenceProviderImpl { + readonly prefs: { [p: string]: any } = {}; + + constructor(protected scope: PreferenceScope) { + super(); + } + + public markReady(): void { + this._ready.resolve(); + } + + getPreferences(): { [p: string]: any } { + return this.prefs; + } + setPreference(preferenceName: string, newValue: any, resourceUri?: string): Promise { + const oldValue = this.prefs[preferenceName]; + this.prefs[preferenceName] = newValue; + return this.emitPreferencesChangedEvent([{ preferenceName, oldValue, newValue, scope: this.scope, domain: [] }]); + } +} + +export function bindMockPreferenceProviders(bind: interfaces.Bind, unbind: interfaces.Unbind): void { + bind(PreferenceProvider).toDynamicValue(ctx => new MockPreferenceProvider(PreferenceScope.User)).inSingletonScope().whenTargetNamed(PreferenceScope.User); + bind(PreferenceProvider).toDynamicValue(ctx => new MockPreferenceProvider(PreferenceScope.Workspace)).inSingletonScope().whenTargetNamed(PreferenceScope.Workspace); + bind(PreferenceProvider).toDynamicValue(ctx => new MockPreferenceProvider(PreferenceScope.Folder)).inSingletonScope().whenTargetNamed(PreferenceScope.Folder); +} diff --git a/packages/core/src/browser/preferences/test/mock-preference-proxy.ts b/packages/core/src/browser/preferences/test/mock-preference-proxy.ts new file mode 100644 index 0000000..4ff3b86 --- /dev/null +++ b/packages/core/src/browser/preferences/test/mock-preference-proxy.ts @@ -0,0 +1,47 @@ +// ***************************************************************************** +// Copyright (C) 2018 Ericsson and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { Emitter, PreferenceChange } from '../../../common'; + +/* eslint-disable @typescript-eslint/no-explicit-any */ +export function createMockPreferenceProxy(preferences: { [p: string]: any }): any { + const unsupportedOperation = (_: any, __: string) => { + throw new Error('Unsupported operation'); + }; + return new Proxy({}, { + get: (_, property: string) => { + if (property === 'onPreferenceChanged') { + return new Emitter().event; + } + if (property === 'dispose') { + return () => { }; + } + if (property === 'ready') { + return Promise.resolve(); + } + // eslint-disable-next-line no-null/no-null + if (preferences[property] !== undefined && preferences[property] !== null) { + return preferences[property]; + } + return undefined; + }, + ownKeys: () => [], + getOwnPropertyDescriptor: (_, property: string) => ({}), + set: unsupportedOperation, + deleteProperty: unsupportedOperation, + defineProperty: unsupportedOperation + }); +} diff --git a/packages/core/src/browser/preferences/test/mock-preference-service.ts b/packages/core/src/browser/preferences/test/mock-preference-service.ts new file mode 100644 index 0000000..4f3d64c --- /dev/null +++ b/packages/core/src/browser/preferences/test/mock-preference-service.ts @@ -0,0 +1,60 @@ +// ***************************************************************************** +// Copyright (C) 2018 Ericsson and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { injectable } from 'inversify'; +import { Emitter, Event, OverridePreferenceName, PreferenceChange, PreferenceChanges, PreferenceInspection, PreferenceScope, PreferenceService } from '../../../common'; +import URI from '../../../common/uri'; + +@injectable() +export class MockPreferenceService implements PreferenceService { + constructor() { } + dispose(): void { } + get(preferenceName: string): T | undefined; + get(preferenceName: string, defaultValue: T): T; + get(preferenceName: string, defaultValue: T, resourceUri: string): T; + get(preferenceName: string, defaultValue?: T, resourceUri?: string): T | undefined { + return undefined; + } + resolve(preferenceName: string, defaultValue?: T, resourceUri?: string): { + configUri?: URI, + value?: T + } { + return {}; + } + inspect(preferenceName: string, resourceUri?: string): PreferenceInspection | undefined { + return undefined; + } + inspectInScope(preferenceName: string, scope: PreferenceScope, resourceUri?: string, forceLanguageOverride?: boolean): T | undefined { + return undefined; + } + // eslint-disable-next-line @typescript-eslint/no-explicit-any + set(preferenceName: string, value: any): Promise { return Promise.resolve(); } + updateValue(): Promise { return Promise.resolve(); } + readonly ready: Promise = Promise.resolve(); + readonly isReady = true; + readonly onPreferenceChanged: Event = new Emitter().event; + readonly onPreferencesChanged: Event = new Emitter().event; + overridePreferenceName(options: OverridePreferenceName): string { + return options.preferenceName; + } + overriddenPreferenceName(preferenceName: string): OverridePreferenceName | undefined { + return undefined; + } + + // eslint-disable-next-line @typescript-eslint/no-explicit-any + validate(name: string, value: any): boolean { return true; } + getConfigUri(scope: PreferenceScope, resourceUri?: string): URI | undefined { return undefined; } +} diff --git a/packages/core/src/browser/preload/i18n-preload-contribution.ts b/packages/core/src/browser/preload/i18n-preload-contribution.ts new file mode 100644 index 0000000..5d3b051 --- /dev/null +++ b/packages/core/src/browser/preload/i18n-preload-contribution.ts @@ -0,0 +1,70 @@ +// ***************************************************************************** +// Copyright (C) 2023 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { PreloadContribution } from './preloader'; +import { FrontendApplicationConfigProvider } from '../frontend-application-config-provider'; +import { nls } from '../../common/nls'; +import { inject, injectable, named } from 'inversify'; +import { LocalizationServer } from '../../common/i18n/localization-server'; +import { ContributionProvider } from '../../common'; +import { TextReplacementContribution } from './text-replacement-contribution'; + +@injectable() +export class I18nPreloadContribution implements PreloadContribution { + + @inject(LocalizationServer) + protected readonly localizationServer: LocalizationServer; + + @inject(ContributionProvider) @named(TextReplacementContribution) + protected readonly replacementContributions: ContributionProvider; + + async initialize(): Promise { + const defaultLocale = FrontendApplicationConfigProvider.get().defaultLocale; + if (defaultLocale && !nls.locale) { + Object.assign(nls, { + locale: defaultLocale + }); + } + let locale = nls.locale ?? nls.defaultLocale; + if (nls.locale) { + const localization = await this.localizationServer.loadLocalization(locale); + if (localization.languagePack) { + nls.localization = localization; + } else if (locale !== nls.defaultLocale) { + // In case the localization that we've loaded doesn't localize Theia completely (languagePack is false) + // We simply reset the locale to the default again + Object.assign(nls, { + locale: defaultLocale || undefined + }); + locale = defaultLocale; + } + } + const replacements = this.getReplacements(locale); + if (Object.keys(replacements).length > 0) { + nls.localization ??= { translations: {}, languageId: locale }; + nls.localization.replacements = replacements; + } + } + + protected getReplacements(locale: string): Record { + const replacements: Record = {}; + for (const contribution of this.replacementContributions.getContributions()) { + Object.assign(replacements, contribution.getReplacement(locale)); + } + return replacements; + } + +} diff --git a/packages/core/src/browser/preload/os-preload-contribution.ts b/packages/core/src/browser/preload/os-preload-contribution.ts new file mode 100644 index 0000000..6724b11 --- /dev/null +++ b/packages/core/src/browser/preload/os-preload-contribution.ts @@ -0,0 +1,37 @@ +// ***************************************************************************** +// Copyright (C) 2023 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { inject, injectable } from 'inversify'; +import { OS, OSBackendProvider } from '../../common'; +import { PreloadContribution } from './preloader'; + +@injectable() +export class OSPreloadContribution implements PreloadContribution { + + @inject(OSBackendProvider) + protected readonly osBackendProvider: OSBackendProvider; + + async initialize(): Promise { + const osType = await this.osBackendProvider.getBackendOS(); + const isWindows = osType === 'Windows'; + const isOSX = osType === 'OSX'; + OS.backend.isOSX = isOSX; + OS.backend.isWindows = isWindows; + OS.backend.type = () => osType; + OS.backend.EOL = isWindows ? '\r\n' : '\n'; + } + +} diff --git a/packages/core/src/browser/preload/preload-module.ts b/packages/core/src/browser/preload/preload-module.ts new file mode 100644 index 0000000..0ded253 --- /dev/null +++ b/packages/core/src/browser/preload/preload-module.ts @@ -0,0 +1,47 @@ +// ***************************************************************************** +// Copyright (C) 2023 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { ContainerModule } from 'inversify'; +import { PreloadContribution, Preloader } from './preloader'; +import { bindContributionProvider } from '../../common/contribution-provider'; +import { I18nPreloadContribution } from './i18n-preload-contribution'; +import { OSPreloadContribution } from './os-preload-contribution'; +import { ThemePreloadContribution } from './theme-preload-contribution'; +import { LocalizationServer, LocalizationServerPath } from '../../common/i18n/localization-server'; +import { ServiceConnectionProvider } from '../messaging/service-connection-provider'; +import { OSBackendProvider, OSBackendProviderPath } from '../../common/os'; +import { TextReplacementContribution } from './text-replacement-contribution'; + +export default new ContainerModule(bind => { + bind(Preloader).toSelf().inSingletonScope(); + bindContributionProvider(bind, PreloadContribution); + bindContributionProvider(bind, TextReplacementContribution); + + bind(LocalizationServer).toDynamicValue(ctx => + ServiceConnectionProvider.createProxy(ctx.container, LocalizationServerPath) + ).inSingletonScope(); + + bind(OSBackendProvider).toDynamicValue(ctx => + ServiceConnectionProvider.createProxy(ctx.container, OSBackendProviderPath) + ).inSingletonScope(); + + bind(I18nPreloadContribution).toSelf().inSingletonScope(); + bind(PreloadContribution).toService(I18nPreloadContribution); + bind(OSPreloadContribution).toSelf().inSingletonScope(); + bind(PreloadContribution).toService(OSPreloadContribution); + bind(ThemePreloadContribution).toSelf().inSingletonScope(); + bind(PreloadContribution).toService(ThemePreloadContribution); +}); diff --git a/packages/core/src/browser/preload/preloader.ts b/packages/core/src/browser/preload/preloader.ts new file mode 100644 index 0000000..907bb03 --- /dev/null +++ b/packages/core/src/browser/preload/preloader.ts @@ -0,0 +1,37 @@ +// ***************************************************************************** +// Copyright (C) 2023 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { MaybePromise } from '../../common/types'; +import { inject, injectable, interfaces, named } from 'inversify'; +import { ContributionProvider } from '../../common/contribution-provider'; + +export const PreloadContribution = Symbol('PreloadContribution') as symbol & interfaces.Abstract; + +export interface PreloadContribution { + initialize(): MaybePromise; +} + +@injectable() +export class Preloader { + + @inject(ContributionProvider) @named(PreloadContribution) + protected readonly contributions: ContributionProvider; + + async initialize(): Promise { + await Promise.allSettled(this.contributions.getContributions().map(contrib => contrib.initialize())); + } + +} diff --git a/packages/core/src/browser/preload/text-replacement-contribution.ts b/packages/core/src/browser/preload/text-replacement-contribution.ts new file mode 100644 index 0000000..05e62bd --- /dev/null +++ b/packages/core/src/browser/preload/text-replacement-contribution.ts @@ -0,0 +1,53 @@ +// ***************************************************************************** +// Copyright (C) 2025 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +export const TextReplacementContribution = Symbol('TextReplacementContribution'); + +/** + * Enables adopters to override text in the application. All `TextReplacementContribution`s need to be bound in the `frontendPreload` scope of the package.json. + * + * @example Create a text replacement contribution + * ```typescript + * import { TextReplacementContribution } from '@theia/core/lib/browser/preload/text-replacement-contribution'; + * export class TextSampleReplacementContribution implements TextReplacementContribution { + * getReplacement(locale: string): Record { + * switch (locale) { + * case 'en': { + * return { + * 'About': 'About Theia', + * }; + * } + * case 'de': { + * return { + * 'About': 'Über Theia', + * }; + * } + * } + * return {}; + * } + * } + * ``` + */ +export interface TextReplacementContribution { + /** + * This method returns a map of **default values** and their replacement values for the specified locale. + * **Do not** use the keys of the `nls.localization` call, but the English default values. + * + * @param locale The locale for which the replacement should be returned. + * @returns A map of default values and their replacement values. + */ + getReplacement(locale: string): Record; +} diff --git a/packages/core/src/browser/preload/theme-preload-contribution.ts b/packages/core/src/browser/preload/theme-preload-contribution.ts new file mode 100644 index 0000000..3a4f430 --- /dev/null +++ b/packages/core/src/browser/preload/theme-preload-contribution.ts @@ -0,0 +1,31 @@ +// ***************************************************************************** +// Copyright (C) 2023 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { PreloadContribution } from './preloader'; +import { DEFAULT_BACKGROUND_COLOR_STORAGE_KEY } from '../frontend-application-config-provider'; +import { injectable } from 'inversify'; +import { DefaultTheme } from '@theia/application-package/lib/application-props'; + +@injectable() +export class ThemePreloadContribution implements PreloadContribution { + + initialize(): void { + const dark = window.matchMedia?.('(prefers-color-scheme: dark)').matches; + const value = window.localStorage.getItem(DEFAULT_BACKGROUND_COLOR_STORAGE_KEY) || DefaultTheme.defaultBackgroundColor(dark); + document.documentElement.style.setProperty('--theia-editor-background', value); + } + +} diff --git a/packages/core/src/browser/progress-bar-factory.ts b/packages/core/src/browser/progress-bar-factory.ts new file mode 100644 index 0000000..d71f9d0 --- /dev/null +++ b/packages/core/src/browser/progress-bar-factory.ts @@ -0,0 +1,29 @@ +// ***************************************************************************** +// Copyright (C) 2019 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { ProgressBar } from './progress-bar'; + +export const ProgressBarFactory = Symbol('ProgressBarFactory'); +export interface ProgressBarFactory { + (options: ProgressBarOptions): ProgressBar; +} + +export const ProgressBarOptions = Symbol('ProgressBarOptions'); +export interface ProgressBarOptions { + locationId: string; + container: HTMLElement; + insertMode: 'append' | 'prepend'; +} diff --git a/packages/core/src/browser/progress-bar.ts b/packages/core/src/browser/progress-bar.ts new file mode 100644 index 0000000..3dd2238 --- /dev/null +++ b/packages/core/src/browser/progress-bar.ts @@ -0,0 +1,76 @@ +// ***************************************************************************** +// Copyright (C) 2019 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { LocationProgress, ProgressLocationService } from './progress-location-service'; +import { DisposableCollection, Disposable } from '../common'; +import { injectable, inject, postConstruct } from 'inversify'; +import { ProgressBarOptions } from './progress-bar-factory'; + +@injectable() +export class ProgressBar implements Disposable { + + @inject(ProgressLocationService) + protected readonly progressLocationService: ProgressLocationService; + + @inject(ProgressBarOptions) + protected readonly options: ProgressBarOptions; + + protected readonly toDispose = new DisposableCollection(); + dispose(): void { + this.toDispose.dispose(); + } + + protected progressBar: HTMLDivElement; + protected progressBarContainer: HTMLDivElement; + + constructor() { + this.progressBar = document.createElement('div'); + this.progressBar.className = 'theia-progress-bar'; + this.progressBar.style.display = 'none'; + this.progressBarContainer = document.createElement('div'); + this.progressBarContainer.className = 'theia-progress-bar-container'; + this.progressBarContainer.append(this.progressBar); + } + + @postConstruct() + protected init(): void { + const { container, insertMode, locationId } = this.options; + if (insertMode === 'prepend') { + container.prepend(this.progressBarContainer); + } else { + container.append(this.progressBarContainer); + } + this.toDispose.push(Disposable.create(() => this.progressBarContainer.remove())); + const onProgress = this.progressLocationService.onProgress(locationId); + this.toDispose.push(onProgress(event => this.onProgress(event))); + const current = this.progressLocationService.getProgress(locationId); + if (current) { + this.onProgress(current); + } + } + + protected onProgress(event: LocationProgress): void { + if (this.toDispose.disposed) { + return; + } + this.setVisible(event.show); + } + + protected setVisible(visible: boolean): void { + this.progressBar.style.display = visible ? 'block' : 'none'; + } + +} diff --git a/packages/core/src/browser/progress-client.ts b/packages/core/src/browser/progress-client.ts new file mode 100644 index 0000000..598ce57 --- /dev/null +++ b/packages/core/src/browser/progress-client.ts @@ -0,0 +1,53 @@ +// ***************************************************************************** +// Copyright (C) 2019 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { injectable, inject } from 'inversify'; +import { CancellationToken } from '../common/cancellation'; +import { ProgressClient } from '../common/progress-service-protocol'; +import { ProgressMessage, ProgressUpdate } from '../common/message-service-protocol'; +import { ProgressStatusBarItem } from './progress-status-bar-item'; +import { ProgressLocationService } from './progress-location-service'; + +@injectable() +export class DispatchingProgressClient implements ProgressClient { + + @inject(ProgressStatusBarItem) + protected statusBarItem: ProgressStatusBarItem; + + @inject(ProgressLocationService) + protected locationService: ProgressLocationService; + + showProgress(progressId: string, message: ProgressMessage, cancellationToken: CancellationToken): Promise { + const locationId = this.getLocationId(message); + if (locationId === 'window') { + return this.statusBarItem.showProgress(progressId, message, cancellationToken); + } + return this.locationService.showProgress(progressId, message, cancellationToken); + } + + reportProgress(progressId: string, update: ProgressUpdate, message: ProgressMessage, cancellationToken: CancellationToken): Promise { + const locationId = this.getLocationId(message); + if (locationId === 'window') { + return this.statusBarItem.reportProgress(progressId, update, message, cancellationToken); + } + return this.locationService.reportProgress(progressId, update, message, cancellationToken); + } + + protected getLocationId(message: ProgressMessage): string { + return message.options && message.options.location || 'unknownLocation'; + } + +} diff --git a/packages/core/src/browser/progress-location-service.spec.ts b/packages/core/src/browser/progress-location-service.spec.ts new file mode 100644 index 0000000..7066e6f --- /dev/null +++ b/packages/core/src/browser/progress-location-service.spec.ts @@ -0,0 +1,50 @@ +// ***************************************************************************** +// Copyright (C) 2020 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { expect } from 'chai'; +import { ProgressLocationService } from './progress-location-service'; +import { CancellationTokenSource } from '../common'; + +describe('progress-location-service', () => { + + const EXP = 'exp'; + const SCM = 'scm'; + const FOO = 'foo'; + + it('done event should be fired for multiple progress locations – bug #7311', async () => { + const eventLog = new Array(); + const logEvent = (location: string, show: boolean) => eventLog.push(`${location} show: ${show}`); + + const service = new ProgressLocationService(); + + [EXP, SCM, FOO].map(location => { + service.onProgress(location)(e => logEvent(location, e.show)); + const progressToken = new CancellationTokenSource(); + service.showProgress(`progress-${location}-${Date.now()}`, { text: '', options: { location } }, progressToken.token); + return progressToken; + }).forEach(t => t.cancel()); + + expect(eventLog.join('\n')).eq(` +exp show: true +scm show: true +foo show: true +exp show: false +scm show: false +foo show: false + `.trim()); + }); + +}); diff --git a/packages/core/src/browser/progress-location-service.ts b/packages/core/src/browser/progress-location-service.ts new file mode 100644 index 0000000..0420693 --- /dev/null +++ b/packages/core/src/browser/progress-location-service.ts @@ -0,0 +1,96 @@ +// ***************************************************************************** +// Copyright (C) 2019 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { injectable } from 'inversify'; +import { CancellationToken } from '../common/cancellation'; +import { ProgressClient } from '../common/progress-service-protocol'; +import { ProgressMessage, ProgressUpdate } from '../common/message-service-protocol'; +import { Deferred } from '../common/promise-util'; +import { Event, Emitter } from '../common/event'; + +export interface LocationProgress { + show: boolean; +} + +@injectable() +export class ProgressLocationService implements ProgressClient { + + protected emitters = new Map[]>(); + protected lastEvents = new Map(); + + getProgress(locationId: string): LocationProgress | undefined { + return this.lastEvents.get(locationId); + } + onProgress(locationId: string): Event { + const emitter = this.addEmitter(locationId); + return emitter.event; + } + protected addEmitter(locationId: string): Emitter { + const emitter = new Emitter(); + const list = this.emitters.get(locationId) || []; + list.push(emitter); + this.emitters.set(locationId, list); + return emitter; + } + + protected readonly progressByLocation = new Map>(); + + async showProgress(progressId: string, message: ProgressMessage, cancellationToken: CancellationToken): Promise { + const locationId = this.getLocationId(message); + const result = new Deferred(); + cancellationToken.onCancellationRequested(() => { + this.processEvent(progressId, locationId, 'done'); + result.resolve(ProgressMessage.Cancel); + }); + this.processEvent(progressId, locationId, 'start'); + return result.promise; + } + protected processEvent(progressId: string, locationId: string, event: 'start' | 'done'): void { + const progressSet = this.progressByLocation.get(locationId) || new Set(); + if (event === 'start') { + progressSet.add(progressId); + } else { + progressSet.delete(progressId); + } + this.progressByLocation.set(locationId, progressSet); + const show = !!progressSet.size; + this.fireEvent(locationId, show); + } + protected fireEvent(locationId: string, show: boolean): void { + const lastEvent = this.lastEvents.get(locationId); + const shouldFire = !lastEvent || lastEvent.show !== show; + if (shouldFire) { + this.lastEvents.set(locationId, { show }); + this.getOrCreateEmitters(locationId).forEach(e => e.fire({ show })); + } + } + protected getOrCreateEmitters(locationId: string): Emitter[] { + let emitters = this.emitters.get(locationId); + if (!emitters) { + emitters = [this.addEmitter(locationId)]; + } + return emitters; + } + + protected getLocationId(message: ProgressMessage): string { + return message.options && message.options.location || 'unknownLocation'; + } + + async reportProgress(progressId: string, update: ProgressUpdate, message: ProgressMessage, cancellationToken: CancellationToken): Promise { + /* NOOP */ + } + +} diff --git a/packages/core/src/browser/progress-status-bar-item.ts b/packages/core/src/browser/progress-status-bar-item.ts new file mode 100644 index 0000000..6bd97e6 --- /dev/null +++ b/packages/core/src/browser/progress-status-bar-item.ts @@ -0,0 +1,83 @@ +// ***************************************************************************** +// Copyright (C) 2019 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { injectable, inject } from 'inversify'; +import { CancellationToken } from '../../shared/vscode-languageserver-protocol'; +import { ProgressClient, ProgressMessage, ProgressUpdate } from '../common'; +import { StatusBar, StatusBarAlignment } from './status-bar'; +import { Deferred } from '../common/promise-util'; +import throttle = require('lodash.throttle'); + +@injectable() +export class ProgressStatusBarItem implements ProgressClient { + + protected readonly id = 'theia-progress-status-bar-item'; + + @inject(StatusBar) + protected readonly statusBar: StatusBar; + + protected messagesByProgress = new Map(); + + protected incomingQueue = new Array(); + + get currentProgress(): string | undefined { + return this.incomingQueue.slice(-1)[0]; + } + + showProgress(progressId: string, message: ProgressMessage, cancellationToken: CancellationToken): Promise { + const result = new Deferred(); + cancellationToken.onCancellationRequested(() => { + this.processEvent(progressId, 'done'); + result.resolve(ProgressMessage.Cancel); + }); + this.processEvent(progressId, 'start', message.text); + return result.promise; + } + + protected processEvent(progressId: string, event: 'start' | 'done', message?: string): void { + if (event === 'start') { + this.incomingQueue.push(progressId); + this.messagesByProgress.set(progressId, message); + } else { + this.incomingQueue = this.incomingQueue.filter(id => id !== progressId); + this.messagesByProgress.delete(progressId); + } + this.triggerUpdate(); + } + + protected readonly triggerUpdate = throttle(() => this.update(this.currentProgress), 250, { leading: true, trailing: true }); + + async reportProgress(progressId: string, update: ProgressUpdate, originalMessage: ProgressMessage, _cancellationToken: CancellationToken): Promise { + const newMessage = update.message ? `${originalMessage.text}: ${update.message}` : originalMessage.text; + this.messagesByProgress.set(progressId, newMessage); + this.triggerUpdate(); + } + + protected update(progressId: string | undefined): void { + const message = progressId && this.messagesByProgress.get(progressId); + if (!progressId || !message) { + this.statusBar.removeElement(this.id); + return; + } + const text = `$(codicon-sync~spin) ${message}`; + this.statusBar.setElement(this.id, { + text, + alignment: StatusBarAlignment.LEFT, + priority: 1 + }); + } + +} diff --git a/packages/core/src/browser/quick-input/index.ts b/packages/core/src/browser/quick-input/index.ts new file mode 100644 index 0000000..8d59874 --- /dev/null +++ b/packages/core/src/browser/quick-input/index.ts @@ -0,0 +1,23 @@ +// ***************************************************************************** +// Copyright (C) 2021 SAP SE or an SAP affiliate company and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** +export * from './quick-command-frontend-contribution'; +export * from './quick-command-service'; +export * from './quick-help-service'; +export * from './quick-access'; +export * from './quick-input-frontend-contribution'; +export * from './quick-input-service'; +export * from './quick-view-service'; +export * from './quick-pick-service-impl'; diff --git a/packages/core/src/browser/quick-input/quick-access.ts b/packages/core/src/browser/quick-input/quick-access.ts new file mode 100644 index 0000000..0a4e4dd --- /dev/null +++ b/packages/core/src/browser/quick-input/quick-access.ts @@ -0,0 +1,75 @@ +// ***************************************************************************** +// Copyright (C) 2021 SAP SE or an SAP affiliate company and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { CancellationToken, Disposable } from '../../common'; +import { QuickPicks } from './quick-input-service'; + +export const QuickAccessContribution = Symbol('QuickAccessContribution'); +/** + * Bind this contribution in order to register quick access providers with the + * QuickAccessRegistry at startup + */ +export interface QuickAccessContribution { + registerQuickAccessProvider(): void; +} + +export interface QuickAccessProvider { + getPicks(filter: string, token: CancellationToken): QuickPicks | Promise; + reset?(): void; +} + +export interface QuickAccessProviderHelp { + prefix?: string; + description: string; + needsEditor: boolean; +} + +export interface QuickAccessProviderDescriptor { + /** + * return an instance of QuickAccessProvider. Implementers are free to return that same instance multiple times + */ + readonly getInstance: () => QuickAccessProvider; + /** + * The prefix for quick access picker to use the provider for. + */ + readonly prefix: string; + /** + * A placeholder to use for the input field when the provider is active. + * This will also be read out by screen readers and thus helps for + * accessibility. + */ + readonly placeholder?: string; + /** + * Help entries for this quick access provider + */ + readonly helpEntries: QuickAccessProviderHelp[]; + /** + * A context key that will be set automatically when this quick access is being shown + */ + readonly contextKey?: string; +} + +export const QuickAccessRegistry = Symbol('QuickAccessRegistry'); + +/** + * A registry for quick access providers. + */ +export interface QuickAccessRegistry { + registerQuickAccessProvider(provider: QuickAccessProviderDescriptor): Disposable; + getQuickAccessProviders(): QuickAccessProviderDescriptor[]; + getQuickAccessProvider(prefix: string): QuickAccessProviderDescriptor | undefined; + clear(): void; +} diff --git a/packages/core/src/browser/quick-input/quick-command-frontend-contribution.ts b/packages/core/src/browser/quick-input/quick-command-frontend-contribution.ts new file mode 100644 index 0000000..53308e9 --- /dev/null +++ b/packages/core/src/browser/quick-input/quick-command-frontend-contribution.ts @@ -0,0 +1,89 @@ +// ***************************************************************************** +// Copyright (C) 2017 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** +import { injectable, inject, optional } from 'inversify'; +import { CommandRegistry, CommandContribution, MenuContribution, MenuModelRegistry, nls } from '../../common'; +import { KeybindingRegistry, KeybindingContribution } from '../keybinding'; +import { CommonMenus } from '../common-menus'; +import { CLOSE_QUICK_OPEN, CLEAR_COMMAND_HISTORY, quickCommand, QuickCommandService } from './quick-command-service'; +import { QuickInputService } from './quick-input-service'; +import { ConfirmDialog, Dialog } from '../dialogs'; + +@injectable() +export class QuickCommandFrontendContribution implements CommandContribution, KeybindingContribution, MenuContribution { + + @inject(QuickInputService) @optional() + protected readonly quickInputService: QuickInputService; + + @inject(QuickCommandService) @optional() + protected readonly quickCommandService: QuickCommandService; + + registerCommands(commands: CommandRegistry): void { + commands.registerCommand(quickCommand, { + execute: () => { + this.quickInputService?.open('>'); + } + }); + commands.registerCommand(CLEAR_COMMAND_HISTORY, { + execute: async () => { + const shouldClear = await new ConfirmDialog({ + title: nls.localizeByDefault('Clear Command History'), + msg: nls.localizeByDefault('Do you want to clear the history of recently used commands?'), + ok: nls.localizeByDefault('Clear'), + cancel: Dialog.CANCEL, + }).open(); + if (shouldClear) { + commands.clearCommandHistory(); + } + } + }); + commands.registerCommand(CLOSE_QUICK_OPEN, { + execute: () => this.quickInputService?.hide() + }); + } + + registerMenus(menus: MenuModelRegistry): void { + menus.registerMenuAction(CommonMenus.VIEW_PRIMARY, { + commandId: quickCommand.id, + label: nls.localizeByDefault('Command Palette...') + }); + menus.registerMenuAction(CommonMenus.MANAGE_GENERAL, { + commandId: quickCommand.id, + label: nls.localizeByDefault('Command Palette...'), + order: '0' + }); + } + + registerKeybindings(keybindings: KeybindingRegistry): void { + keybindings.registerKeybinding({ + command: quickCommand.id, + keybinding: 'f1' + }); + keybindings.registerKeybinding({ + command: quickCommand.id, + keybinding: 'ctrlcmd+shift+p' + }); + keybindings.registerKeybinding({ + command: CLOSE_QUICK_OPEN.id, + keybinding: 'esc', + when: 'inQuickOpen' + }); + keybindings.registerKeybinding({ + command: CLOSE_QUICK_OPEN.id, + keybinding: 'shift+esc', + when: 'inQuickOpen' + }); + } +} diff --git a/packages/core/src/browser/quick-input/quick-command-service.ts b/packages/core/src/browser/quick-input/quick-command-service.ts new file mode 100644 index 0000000..7c39918 --- /dev/null +++ b/packages/core/src/browser/quick-input/quick-command-service.ts @@ -0,0 +1,246 @@ +// ***************************************************************************** +// Copyright (C) 2021 SAP SE or an SAP affiliate company and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { inject, injectable } from 'inversify'; +import { KeybindingRegistry } from '../keybinding'; +import { Disposable, Command, CommandRegistry, CancellationToken, nls } from '../../common'; +import { ContextKeyService } from '../context-key-service'; +import { CorePreferences } from '../../common/core-preferences'; +import { QuickAccessContribution, QuickAccessProvider, QuickAccessRegistry } from './quick-access'; +import { filterItems, QuickPickItem, QuickPicks } from './quick-input-service'; +import { KeySequence } from '../keys'; +import { codiconArray } from '../widgets'; + +export const quickCommand: Command = { + id: 'workbench.action.showCommands' +}; + +export const CLEAR_COMMAND_HISTORY = Command.toDefaultLocalizedCommand({ + id: 'clear.command.history', + label: 'Clear Command History' +}); + +export const CLOSE_QUICK_OPEN: Command = { + id: 'workbench.action.closeQuickOpen' +}; + +@injectable() +export class QuickCommandService implements QuickAccessContribution, QuickAccessProvider { + static PREFIX = '>'; + + @inject(ContextKeyService) + protected readonly contextKeyService: ContextKeyService; + + @inject(CommandRegistry) + protected readonly commandRegistry: CommandRegistry; + + @inject(CorePreferences) + protected readonly corePreferences: CorePreferences; + + @inject(QuickAccessRegistry) + protected readonly quickAccessRegistry: QuickAccessRegistry; + + @inject(KeybindingRegistry) + protected readonly keybindingRegistry: KeybindingRegistry; + + // The list of exempted commands not to be displayed in the recently used list. + readonly exemptedCommands: Command[] = [ + CLEAR_COMMAND_HISTORY, + ]; + + private recentItems: QuickPickItem[] = []; + private otherItems: QuickPickItem[] = []; + + registerQuickAccessProvider(): void { + this.quickAccessRegistry.registerQuickAccessProvider({ + getInstance: () => this, + prefix: QuickCommandService.PREFIX, + placeholder: '', + helpEntries: [{ description: 'Quick Command', needsEditor: false }] + }); + } + + reset(): void { + const { recent, other } = this.getCommands(); + this.recentItems = []; + this.otherItems = []; + this.recentItems.push(...recent.map(command => this.toItem(command))); + this.otherItems.push(...other.map(command => this.toItem(command))); + } + + getPicks(filter: string, token: CancellationToken): QuickPicks { + const items: QuickPicks = []; + + // Update the list of commands by fetching them from the registry. + this.reset(); + const recentItems = filterItems(this.recentItems.slice(), filter); + const otherItems = filterItems(this.otherItems.slice(), filter); + + if (recentItems.length > 0) { + items.push({ type: 'separator', label: nls.localizeByDefault('recently used') }, ...recentItems); + } + + if (otherItems.length > 0) { + if (recentItems.length > 0) { + items.push({ type: 'separator', label: nls.localizeByDefault('other commands') }); + } + items.push(...otherItems); + } + return items; + } + + toItem(command: Command): QuickPickItem { + const label = (command.category) ? `${command.category}: ` + command.label! : command.label!; + const iconClasses = this.getItemIconClasses(command); + const activeElement = window.document.activeElement as HTMLElement; + + const originalLabel = command.originalLabel || command.label!; + const originalCategory = command.originalCategory || command.category; + let detail: string | undefined = originalCategory ? `${originalCategory}: ${originalLabel}` : originalLabel; + if (label === detail) { + detail = undefined; + } + + return { + label, + detail, + iconClasses, + alwaysShow: !!this.commandRegistry.getActiveHandler(command.id), + keySequence: this.getKeybinding(command), + execute: () => { + activeElement.focus({ preventScroll: true }); + this.commandRegistry.executeCommand(command.id); + this.commandRegistry.addRecentCommand(command); + } + }; + } + + private getKeybinding(command: Command): KeySequence | undefined { + const keybindings = this.keybindingRegistry.getKeybindingsForCommand(command.id); + if (!keybindings || keybindings.length === 0) { + return undefined; + } + + try { + return this.keybindingRegistry.resolveKeybinding(keybindings[0]); + } catch (error) { + return undefined; + } + } + + private getItemIconClasses(command: Command): string[] | undefined { + const toggledHandler = this.commandRegistry.getToggledHandler(command.id); + if (toggledHandler) { + return codiconArray('check'); + } + return undefined; + } + + protected readonly contexts = new Map(); + pushCommandContext(commandId: string, when: string): Disposable { + const contexts = this.contexts.get(commandId) || []; + contexts.push(when); + this.contexts.set(commandId, contexts); + return Disposable.create(() => { + const index = contexts.indexOf(when); + if (index !== -1) { + contexts.splice(index, 1); + } + }); + } + + /** + * Get the list of valid commands. + * + * @param commands the list of raw commands. + * @returns the list of valid commands. + */ + protected getValidCommands(raw: Command[]): Command[] { + const valid: Command[] = []; + raw.forEach(command => { + if (command.label) { + const contexts = this.contexts.get(command.id); + if (!contexts || contexts.some(when => this.contextKeyService.match(when))) { + valid.push(command); + } + } + }); + return valid; + } + + /** + * Get the list of recently used and other commands. + * + * @returns the list of recently used commands and other commands. + */ + getCommands(): { recent: Command[], other: Command[] } { + + // Get the list of recent commands. + const recentCommands = this.commandRegistry.recent; + + // Get the list of all valid commands. + const allCommands = this.getValidCommands(this.commandRegistry.commands); + + // Get the max history limit. + const limit = this.corePreferences['workbench.commandPalette.history']; + + // Build the list of recent commands. + let rCommands: Command[] = []; + if (limit > 0) { + rCommands.push(...recentCommands.filter(r => + !this.exemptedCommands.some(c => Command.equals(r, c)) && + allCommands.some(c => Command.equals(r, c))) + ); + if (rCommands.length > limit) { + rCommands = rCommands.slice(0, limit); + } + } + + // Build the list of other commands. + const oCommands = allCommands.filter(c => !rCommands.some(r => Command.equals(r, c))); + + // Normalize the list of recent commands. + const recent = this.normalize(rCommands); + + // Normalize, and sort the list of other commands. + const other = this.sort( + this.normalize(oCommands) + ); + + return { recent, other }; + } + + /** + * Normalizes a list of commands. + * Normalization includes obtaining commands that have labels, are visible, and are enabled. + * + * @param commands the list of commands. + * @returns the list of normalized commands. + */ + private normalize(commands: Command[]): Command[] { + return commands.filter((a: Command) => a.label && (this.commandRegistry.isVisible(a.id) && this.commandRegistry.isEnabled(a.id))); + } + + /** + * Sorts a list of commands alphabetically. + * + * @param commands the list of commands. + * @returns the list of sorted commands. + */ + private sort(commands: Command[]): Command[] { + return commands.sort((a: Command, b: Command) => Command.compareCommands(a, b)); + } +} diff --git a/packages/core/src/browser/quick-input/quick-help-service.ts b/packages/core/src/browser/quick-input/quick-help-service.ts new file mode 100644 index 0000000..debcf3d --- /dev/null +++ b/packages/core/src/browser/quick-input/quick-help-service.ts @@ -0,0 +1,87 @@ +// ***************************************************************************** +// Copyright (C) 2021 SAP SE or an SAP affiliate company and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { inject, injectable } from 'inversify'; +import { CancellationToken } from '../../common'; +import { QuickAccessContribution, QuickAccessProvider, QuickAccessRegistry } from './quick-access'; +import { QuickInputService, QuickPickItem, QuickPickSeparator } from './quick-input-service'; + +@injectable() +export class QuickHelpService implements QuickAccessProvider, QuickAccessContribution { + static PREFIX = '?'; + + @inject(QuickAccessRegistry) + protected quickAccessRegistry: QuickAccessRegistry; + + @inject(QuickInputService) + protected quickInputService: QuickInputService; + + getPicks(filter: string, token: CancellationToken): (QuickPickItem | QuickPickSeparator)[] { + const { editorProviders, globalProviders } = this.getQuickAccessProviders(); + const result: (QuickPickItem | QuickPickSeparator)[] = editorProviders.length === 0 || globalProviders.length === 0 ? + // Without groups + [ + ...(editorProviders.length === 0 ? globalProviders : editorProviders) + ] : + + // With groups + [ + { type: 'separator', label: 'global commands' }, + ...globalProviders, + { type: 'separator', label: 'editor commands' }, + ...editorProviders + ]; + return result; + } + + private getQuickAccessProviders(): { editorProviders: QuickPickItem[], globalProviders: QuickPickItem[] } { + const globalProviders: QuickPickItem[] = []; + const editorProviders: QuickPickItem[] = []; + + const providers = this.quickAccessRegistry.getQuickAccessProviders(); + + for (const provider of providers.sort((providerA, providerB) => providerA.prefix.localeCompare(providerB.prefix))) { + if (provider.prefix === QuickHelpService.PREFIX) { + continue; // exclude help which is already active + } + + for (const helpEntry of provider.helpEntries) { + const prefix = helpEntry.prefix || provider.prefix; + const label = prefix || '\u2026' /* ... */; + + (helpEntry.needsEditor ? editorProviders : globalProviders).push({ + label, + ariaLabel: `${label}, ${helpEntry.description}`, + description: helpEntry.description, + execute: () => this.quickInputService.open(prefix) + }); + } + } + + return { editorProviders, globalProviders }; + } + + registerQuickAccessProvider(): void { + this.quickAccessRegistry.registerQuickAccessProvider( + { + getInstance: () => this, + prefix: QuickHelpService.PREFIX, + placeholder: 'Type "?" to get help on the actions you can take from here.', + helpEntries: [{ description: 'Show all Quick Access Providers', needsEditor: false }] + } + ); + } +} diff --git a/packages/core/src/browser/quick-input/quick-input-frontend-contribution.ts b/packages/core/src/browser/quick-input/quick-input-frontend-contribution.ts new file mode 100644 index 0000000..b9ac60a --- /dev/null +++ b/packages/core/src/browser/quick-input/quick-input-frontend-contribution.ts @@ -0,0 +1,33 @@ +// ***************************************************************************** +// Copyright (C) 2021 SAP SE or an SAP affiliate company and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { injectable, inject, named } from 'inversify'; +import { ContributionProvider } from '../../common'; +import { FrontendApplicationContribution } from '../frontend-application-contribution'; +import { QuickAccessContribution } from './quick-access'; + +@injectable() +export class QuickInputFrontendContribution implements FrontendApplicationContribution { + + @inject(ContributionProvider) @named(QuickAccessContribution) + protected readonly contributionProvider: ContributionProvider; + + onStart(): void { + this.contributionProvider.getContributions().forEach(contrib => { + contrib.registerQuickAccessProvider(); + }); + } +} diff --git a/packages/core/src/browser/quick-input/quick-input-service.spec.ts b/packages/core/src/browser/quick-input/quick-input-service.spec.ts new file mode 100644 index 0000000..5c22d8b --- /dev/null +++ b/packages/core/src/browser/quick-input/quick-input-service.spec.ts @@ -0,0 +1,176 @@ +// ***************************************************************************** +// Copyright (C) 2021 Ericsson and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import * as chai from 'chai'; +import { filterItems, findMatches, QuickPickItem } from './quick-input-service'; + +const expect = chai.expect; + +describe('quick-input-service', () => { + + describe('#findMatches', () => { + + it('should return the proper highlights when matches are found', () => { + expect(findMatches('abc', 'a')).deep.equal([{ start: 0, end: 1 }]); + expect(findMatches('abc', 'ab')).deep.equal([{ start: 0, end: 1 }, { start: 1, end: 2 }]); + expect(findMatches('abc', 'ac')).deep.equal([{ start: 0, end: 1 }, { start: 2, end: 3 }]); + expect(findMatches('abc', 'abc')).deep.equal([{ start: 0, end: 1 }, { start: 1, end: 2 }, { start: 2, end: 3 }]); + }); + + it('should fail when out of order', () => { + expect(findMatches('abc', 'ba')).equal(undefined); + }); + + it('should return `undefined` when no matches are found', () => { + expect(findMatches('abc', 'f')).equal(undefined); + }); + + it('should return `undefined` when no filter is present', () => { + expect(findMatches('abc', '')).equal(undefined); + }); + + }); + + describe('#filterItems', () => { + + let items: QuickPickItem[] = []; + + beforeEach(() => { + items = [ + { label: 'a' }, + { label: 'abc', description: 'v' }, + { label: 'def', description: 'd', detail: 'y' }, + { label: 'z', description: 'z', detail: 'z' } + ]; + }); + + it('should return the full list when no filter is present', () => { + const result = filterItems(items, ''); + expect(result).deep.equal(items); + }); + + it('should filter items based on the label', () => { + const expectation: QuickPickItem = { + label: 'abc', + highlights: { + label: [ + { start: 0, end: 1 }, + { start: 1, end: 2 }, + { start: 2, end: 3 } + ] + } + }; + const result = filterItems(items, 'abc').filter(QuickPickItem.is); + expect(result).length(1); + expect(result[0].label).equal(expectation.label); + expect(result[0].highlights?.label).deep.equal(expectation.highlights?.label); + }); + + it('should filter items based on `description` if `label` does not match', () => { + const expectation: QuickPickItem = { + label: 'abc', + description: 'v', + highlights: { + description: [ + { start: 0, end: 1 } + ] + } + }; + const result = filterItems(items, 'v').filter(QuickPickItem.is); + expect(result).length(1); + expect(result[0].label).equal(expectation.label); + expect(result[0].description).equal(expectation.description); + expect(result[0].highlights?.label).equal(undefined); + expect(result[0].highlights?.description).deep.equal(expectation.highlights?.description); + }); + + it('should filter items based on `detail` if `label` and `description` does not match', () => { + const expectation: QuickPickItem = { + label: 'def', + description: 'd', + detail: 'y', + highlights: { + detail: [ + { start: 0, end: 1 } + ] + } + }; + const result = filterItems(items, 'y').filter(QuickPickItem.is); + expect(result).length(1); + expect(result[0].label).equal(expectation.label); + expect(result[0].description).equal(expectation.description); + expect(result[0].detail).equal(expectation.detail); + expect(result[0].highlights?.label).equal(undefined); + expect(result[0].highlights?.description).equal(undefined); + expect(result[0].highlights?.detail).deep.equal(expectation.highlights?.detail); + }); + + it('should return multiple highlights if it matches multiple properties', () => { + const expectation: QuickPickItem = { + label: 'z', + description: 'z', + detail: 'z', + highlights: { + label: [ + { start: 0, end: 1 } + ], + description: [ + { start: 0, end: 1 } + ], + detail: [ + { start: 0, end: 1 } + ] + } + }; + const result = filterItems(items, 'z').filter(QuickPickItem.is); + expect(result).length(1); + + expect(result[0].label).equal(expectation.label); + expect(result[0].description).equal(expectation.description); + expect(result[0].detail).equal(expectation.detail); + + expect(result[0].highlights?.label).deep.equal(expectation.highlights?.label); + expect(result[0].highlights?.description).deep.equal(expectation.highlights?.description); + expect(result[0].highlights?.detail).deep.equal(expectation.highlights?.detail); + }); + + it('should reset highlights upon subsequent searches', () => { + const expectation: QuickPickItem = { + label: 'abc', + highlights: { + label: [ + { start: 0, end: 1 }, + { start: 1, end: 2 }, + { start: 2, end: 3 } + ] + } + }; + let result = filterItems(items, 'abc').filter(QuickPickItem.is); + expect(result).length(1); + expect(result[0].label).equal(expectation.label); + expect(result[0].highlights?.label).deep.equal(expectation.highlights?.label); + + result = filterItems(items, '').filter(QuickPickItem.is); + expect(result[0].highlights?.label).equal(undefined); + }); + + it('should return an empty list when no matches are found', () => { + expect(filterItems(items, 'yyy')).deep.equal([]); + }); + + }); + +}); diff --git a/packages/core/src/browser/quick-input/quick-input-service.ts b/packages/core/src/browser/quick-input/quick-input-service.ts new file mode 100644 index 0000000..1a159da --- /dev/null +++ b/packages/core/src/browser/quick-input/quick-input-service.ts @@ -0,0 +1,17 @@ +// ***************************************************************************** +// Copyright (C) 2021 SAP SE or an SAP affiliate company and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +export * from '../../common/quick-pick-service'; diff --git a/packages/core/src/browser/quick-input/quick-pick-service-impl.ts b/packages/core/src/browser/quick-input/quick-pick-service-impl.ts new file mode 100644 index 0000000..8b2a2f6 --- /dev/null +++ b/packages/core/src/browser/quick-input/quick-pick-service-impl.ts @@ -0,0 +1,69 @@ +// ***************************************************************************** +// Copyright (C) 2018 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { injectable, inject, optional } from 'inversify'; +import { Emitter } from '../../common/event'; +import { QuickPickSeparator, QuickPickService } from '../../common/quick-pick-service'; +import { QuickInputService, QuickPickItem, QuickInputButtonHandle, QuickPick, QuickPickOptions } from './quick-input-service'; + +@injectable() +export class QuickPickServiceImpl implements QuickPickService { + + @inject(QuickInputService) @optional() + protected readonly quickInputService: QuickInputService; + + private readonly onDidHideEmitter = new Emitter(); + readonly onDidHide = this.onDidHideEmitter.event; + + private readonly onDidChangeValueEmitter = new Emitter<{ quickPick: QuickPick, filter: string }>(); + readonly onDidChangeValue = this.onDidChangeValueEmitter.event; + + private readonly onDidAcceptEmitter = new Emitter(); + readonly onDidAccept = this.onDidAcceptEmitter.event; + + private readonly onDidChangeActiveEmitter = new Emitter<{ quickPick: QuickPick, activeItems: Array }>(); + readonly onDidChangeActive = this.onDidChangeActiveEmitter.event; + + private readonly onDidChangeSelectionEmitter = new Emitter<{ quickPick: QuickPick, selectedItems: Array }>(); + readonly onDidChangeSelection = this.onDidChangeSelectionEmitter.event; + + private readonly onDidTriggerButtonEmitter = new Emitter(); + readonly onDidTriggerButton = this.onDidTriggerButtonEmitter.event; + + // eslint-disable-next-line @typescript-eslint/no-explicit-any + private items: Array = []; + + async show(items: Array, options?: QuickPickOptions): Promise { + this.items = items; + const opts = Object.assign({}, options, { + onDidAccept: () => this.onDidAcceptEmitter.fire(), + onDidChangeActive: (quickPick: QuickPick, activeItems: Array) => this.onDidChangeActiveEmitter.fire({ quickPick, activeItems }), + onDidChangeSelection: (quickPick: QuickPick, selectedItems: Array) => this.onDidChangeSelectionEmitter.fire({ quickPick, selectedItems }), + onDidChangeValue: (quickPick: QuickPick, filter: string) => this.onDidChangeValueEmitter.fire({ quickPick, filter }), + onDidHide: () => this.onDidHideEmitter.fire(), + onDidTriggerButton: (btn: QuickInputButtonHandle) => this.onDidTriggerButtonEmitter.fire(btn), + }); + return this.quickInputService?.showQuickPick(this.items, opts); + } + + hide(): void { + this.quickInputService?.hide(); + } + + setItems(items: Array): void { + this.items = items; + } +} diff --git a/packages/core/src/browser/quick-input/quick-view-service.ts b/packages/core/src/browser/quick-input/quick-view-service.ts new file mode 100644 index 0000000..092fbe1 --- /dev/null +++ b/packages/core/src/browser/quick-input/quick-view-service.ts @@ -0,0 +1,83 @@ +// ***************************************************************************** +// Copyright (C) 2021 SAP SE or an SAP affiliate company and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { inject, injectable } from 'inversify'; +import { CancellationToken, Disposable } from '../../common'; +import { ContextKeyService } from '../context-key-service'; +import { QuickAccessContribution, QuickAccessProvider, QuickAccessRegistry } from './quick-access'; +import { filterItems, QuickPickItem, QuickPicks } from './quick-input-service'; + +export interface QuickViewItem { + readonly label: string; + readonly when?: string; + readonly open: () => void; +} + +@injectable() +export class QuickViewService implements QuickAccessContribution, QuickAccessProvider { + static PREFIX = 'view '; + + protected readonly items: (QuickPickItem & { when?: string })[] = []; + private hiddenItemLabels = new Set(); + + @inject(QuickAccessRegistry) + protected readonly quickAccessRegistry: QuickAccessRegistry; + + @inject(ContextKeyService) + protected readonly contextKexService: ContextKeyService; + + registerItem(item: QuickViewItem): Disposable { + const quickOpenItem = { + label: item.label, + execute: () => item.open(), + when: item.when + }; + this.items.push(quickOpenItem); + this.items.sort((a, b) => a.label!.localeCompare(b.label!)); + + return Disposable.create(() => { + const index = this.items.indexOf(quickOpenItem); + if (index !== -1) { + this.items.splice(index, 1); + } + }); + } + + hideItem(label: string): void { + this.hiddenItemLabels.add(label); + } + + showItem(label: string): void { + this.hiddenItemLabels.delete(label); + } + + registerQuickAccessProvider(): void { + this.quickAccessRegistry.registerQuickAccessProvider({ + getInstance: () => this, + prefix: QuickViewService.PREFIX, + placeholder: '', + helpEntries: [{ description: 'Open View', needsEditor: false }] + }); + } + + getPicks(filter: string, token: CancellationToken): QuickPicks { + const items = this.items.filter(item => + (item.when === undefined || this.contextKexService.match(item.when)) && + (!this.hiddenItemLabels.has(item.label)) + ); + return filterItems(items, filter); + } +} diff --git a/packages/core/src/browser/request/browser-request-module.ts b/packages/core/src/browser/request/browser-request-module.ts new file mode 100644 index 0000000..2780d44 --- /dev/null +++ b/packages/core/src/browser/request/browser-request-module.ts @@ -0,0 +1,23 @@ +/******************************************************************************** + * Copyright (C) 2022 TypeFox and others. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the Eclipse + * Public License v. 2.0 are satisfied: GNU General Public License, version 2 + * with the GNU Classpath Exception which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 + ********************************************************************************/ + +import { ContainerModule } from 'inversify'; +import { RequestService } from '@theia/request'; +import { XHRBrowserRequestService } from './browser-request-service'; + +export default new ContainerModule(bind => { + bind(RequestService).to(XHRBrowserRequestService).inSingletonScope(); +}); diff --git a/packages/core/src/browser/request/browser-request-service.ts b/packages/core/src/browser/request/browser-request-service.ts new file mode 100644 index 0000000..cc04c94 --- /dev/null +++ b/packages/core/src/browser/request/browser-request-service.ts @@ -0,0 +1,172 @@ +/******************************************************************************** + * Copyright (C) 2022 TypeFox and others. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the Eclipse + * Public License v. 2.0 are satisfied: GNU General Public License, version 2 + * with the GNU Classpath Exception which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 + ********************************************************************************/ + +import { inject, injectable, postConstruct } from 'inversify'; +import { BackendRequestService, RequestConfiguration, RequestContext, RequestOptions, RequestService, CancellationToken } from '@theia/request'; +import { PreferenceService } from '../../common'; + +@injectable() +export abstract class AbstractBrowserRequestService implements RequestService { + + @inject(PreferenceService) + protected readonly preferenceService: PreferenceService; + + protected configurePromise: Promise = Promise.resolve(); + + @postConstruct() + protected init(): void { + this.configurePromise = this.preferenceService.ready.then(() => { + const proxyUrl = this.preferenceService.get('http.proxy'); + const proxyAuthorization = this.preferenceService.get('http.proxyAuthorization'); + const strictSSL = this.preferenceService.get('http.proxyStrictSSL'); + return this.configure({ + proxyUrl, + proxyAuthorization, + strictSSL + }); + }); + this.preferenceService.onPreferencesChanged(e => { + this.configurePromise.then(() => this.configure({ + proxyUrl: this.preferenceService.get('http.proxy'), + proxyAuthorization: this.preferenceService.get('http.proxyAuthorization'), + strictSSL: this.preferenceService.get('http.proxyStrictSSL') + })); + }); + } + + abstract configure(config: RequestConfiguration): Promise; + abstract request(options: RequestOptions, token?: CancellationToken): Promise; + abstract resolveProxy(url: string): Promise; + +} + +@injectable() +export class ProxyingBrowserRequestService extends AbstractBrowserRequestService { + + @inject(BackendRequestService) + protected readonly backendRequestService: RequestService; + + configure(config: RequestConfiguration): Promise { + return this.backendRequestService.configure(config); + } + + resolveProxy(url: string): Promise { + return this.backendRequestService.resolveProxy(url); + } + + async request(options: RequestOptions): Promise { + // Wait for both the preferences and the configuration of the backend service + await this.configurePromise; + const backendResult = await this.backendRequestService.request(options); + return RequestContext.decompress(backendResult); + } +} + +@injectable() +export class XHRBrowserRequestService extends ProxyingBrowserRequestService { + + protected authorization?: string; + + override configure(config: RequestConfiguration): Promise { + if (config.proxyAuthorization !== undefined) { + this.authorization = config.proxyAuthorization; + } + return super.configure(config); + } + + override async request(options: RequestOptions, token?: CancellationToken): Promise { + try { + const xhrResult = await this.xhrRequest(options, token); + const statusCode = xhrResult.res.statusCode ?? 200; + if (statusCode >= 400) { + // We might've been blocked by the firewall + // Try it through the backend request service + return super.request(options); + } + return xhrResult; + } catch { + return super.request(options); + } + } + + protected xhrRequest(options: RequestOptions, token?: CancellationToken): Promise { + const authorization = this.authorization || options.proxyAuthorization; + if (authorization) { + options.headers = { + ...(options.headers || {}), + 'Proxy-Authorization': authorization + }; + } + + const xhr = new XMLHttpRequest(); + return new Promise((resolve, reject) => { + + xhr.open(options.type || 'GET', options.url || '', true, options.user, options.password); + this.setRequestHeaders(xhr, options); + + xhr.responseType = 'arraybuffer'; + xhr.onerror = () => reject(new Error(xhr.statusText && ('XHR failed: ' + xhr.statusText) || 'XHR failed')); + xhr.onload = () => { + resolve({ + url: options.url, + res: { + statusCode: xhr.status, + headers: this.getResponseHeaders(xhr) + }, + buffer: new Uint8Array(xhr.response) + }); + }; + xhr.ontimeout = e => reject(new Error(`XHR timeout: ${options.timeout}ms`)); + + if (options.timeout) { + xhr.timeout = options.timeout; + } + + xhr.send(options.data); + + token?.onCancellationRequested(() => { + xhr.abort(); + reject(); + }); + }); + } + + protected setRequestHeaders(xhr: XMLHttpRequest, options: RequestOptions): void { + if (options.headers) { + for (const k of Object.keys(options.headers)) { + switch (k) { + case 'User-Agent': + case 'Accept-Encoding': + case 'Content-Length': + // unsafe headers + continue; + } + xhr.setRequestHeader(k, options.headers[k]); + } + } + } + + protected getResponseHeaders(xhr: XMLHttpRequest): { [name: string]: string } { + const headers: { [name: string]: string } = {}; + for (const line of xhr.getAllResponseHeaders().split(/\r\n|\n|\r/g)) { + if (line) { + const idx = line.indexOf(':'); + headers[line.substring(0, idx).trim().toLowerCase()] = line.substring(idx + 1).trim(); + } + } + return headers; + } +} diff --git a/packages/core/src/browser/resource-context-key.ts b/packages/core/src/browser/resource-context-key.ts new file mode 100644 index 0000000..37e2660 --- /dev/null +++ b/packages/core/src/browser/resource-context-key.ts @@ -0,0 +1,77 @@ +// ***************************************************************************** +// Copyright (C) 2019 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { injectable, inject, postConstruct } from 'inversify'; +import URI from '../common/uri'; +import { ContextKeyService, ContextKey } from './context-key-service'; +import { LanguageService } from './language-service'; + +@injectable() +export class ResourceContextKey { + + @inject(LanguageService) + protected readonly languages: LanguageService; + + @inject(ContextKeyService) + protected readonly contextKeyService: ContextKeyService; + + protected resource: ContextKey; + protected resourceSchemeKey: ContextKey; + protected resourceFileName: ContextKey; + protected resourceExtname: ContextKey; + protected resourceLangId: ContextKey; + protected resourceDirName: ContextKey; + protected resourcePath: ContextKey; + protected resourceSet: ContextKey; + + @postConstruct() + protected init(): void { + this.resource = this.contextKeyService.createKey('resource', undefined); + this.resourceSchemeKey = this.contextKeyService.createKey('resourceScheme', undefined); + this.resourceFileName = this.contextKeyService.createKey('resourceFilename', undefined); + this.resourceExtname = this.contextKeyService.createKey('resourceExtname', undefined); + this.resourceLangId = this.contextKeyService.createKey('resourceLangId', undefined); + this.resourceDirName = this.contextKeyService.createKey('resourceDirName', undefined); + this.resourcePath = this.contextKeyService.createKey('resourcePath', undefined); + this.resourceSet = this.contextKeyService.createKey('resourceSet', false); + } + + get(): string | undefined { + return this.resource.get(); + } + + set(resourceUri: URI | undefined): void { + this.resource.set(resourceUri?.toString()); + this.resourceSchemeKey.set(resourceUri?.scheme); + this.resourceFileName.set(resourceUri?.path.base); + this.resourceExtname.set(resourceUri?.path.ext); + this.resourceLangId.set(resourceUri && this.getLanguageId(resourceUri)); + this.resourceDirName.set(resourceUri?.path.dir.fsPath()); + this.resourcePath.set(resourceUri?.path.fsPath()); + this.resourceSet.set(Boolean(resourceUri)); + } + + protected getLanguageId(uri: URI | undefined): string | undefined { + if (uri) { + for (const language of this.languages.languages) { + if (language.extensions.has(uri.path.ext)) { + return language.id; + } + } + } + return undefined; + } +} diff --git a/packages/core/src/browser/saveable-service.ts b/packages/core/src/browser/saveable-service.ts new file mode 100644 index 0000000..e0d161a --- /dev/null +++ b/packages/core/src/browser/saveable-service.ts @@ -0,0 +1,341 @@ +/******************************************************************************** + * Copyright (C) 2022 Arm and others. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the Eclipse + * Public License v. 2.0 are satisfied: GNU General Public License, version 2 + * with the GNU Classpath Exception which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 + ********************************************************************************/ + +import type { ApplicationShell } from './shell'; +import { injectable } from 'inversify'; +import { UNTITLED_SCHEME, URI, Disposable, DisposableCollection, Emitter, Event } from '../common'; +import { Navigatable, NavigatableWidget } from './navigatable-types'; +import { AutoSaveMode, Saveable, SaveableSource, SaveableWidget, SaveOptions, SaveReason, setDirty, close, PostCreationSaveableWidget, ShouldSaveDialog } from './saveable'; +import { waitForClosed, Widget } from './widgets'; +import { FrontendApplicationContribution } from './frontend-application-contribution'; +import { FrontendApplication } from './frontend-application'; +import throttle = require('lodash.throttle'); + +@injectable() +export class SaveableService implements FrontendApplicationContribution { + + protected saveThrottles = new Map(); + protected saveMode: AutoSaveMode = 'off'; + protected saveDelay = 1000; + protected shell: ApplicationShell; + + protected readonly onDidAutoSaveChangeEmitter = new Emitter(); + protected readonly onDidAutoSaveDelayChangeEmitter = new Emitter(); + + get onDidAutoSaveChange(): Event { + return this.onDidAutoSaveChangeEmitter.event; + } + + get onDidAutoSaveDelayChange(): Event { + return this.onDidAutoSaveDelayChangeEmitter.event; + } + + get autoSave(): AutoSaveMode { + return this.saveMode; + } + + set autoSave(value: AutoSaveMode) { + this.updateAutoSaveMode(value); + } + + get autoSaveDelay(): number { + return this.saveDelay; + } + + set autoSaveDelay(value: number) { + this.updateAutoSaveDelay(value); + } + + onDidInitializeLayout(app: FrontendApplication): void { + this.shell = app.shell; + // Register restored editors first + for (const widget of this.shell.widgets) { + const saveable = Saveable.get(widget); + if (saveable) { + this.registerSaveable(widget, saveable); + } + } + this.shell.onDidAddWidget(e => { + const saveable = Saveable.get(e); + if (saveable) { + this.registerSaveable(e, saveable); + } + }); + this.shell.onDidChangeCurrentWidget(e => { + if (this.saveMode === 'onFocusChange') { + const widget = e.oldValue; + const saveable = Saveable.get(widget); + if (saveable && widget && this.shouldAutoSave(widget, saveable)) { + saveable.save({ + saveReason: SaveReason.FocusChange + }); + } + } + }); + this.shell.onDidRemoveWidget(e => { + this.saveThrottles.get(e)?.dispose(); + this.saveThrottles.delete(e); + }); + } + + protected updateAutoSaveMode(mode: AutoSaveMode): void { + this.saveMode = mode; + this.onDidAutoSaveChangeEmitter.fire(mode); + if (mode === 'onFocusChange') { + // If the new mode is onFocusChange, we need to save all dirty documents that are not focused + if (!this.shell) { + // Shell is not ready yet, skip auto-saving widgets + return; + } + const widgets = this.shell.widgets; + for (const widget of widgets) { + const saveable = Saveable.get(widget); + if (saveable && widget !== this.shell.currentWidget && this.shouldAutoSave(widget, saveable)) { + saveable.save({ + saveReason: SaveReason.FocusChange + }); + } + } + } + } + + protected updateAutoSaveDelay(delay: number): void { + this.saveDelay = delay; + this.onDidAutoSaveDelayChangeEmitter.fire(delay); + } + + registerSaveable(widget: Widget, saveable: Saveable): Disposable { + const saveThrottle = new AutoSaveThrottle( + saveable, + this, + () => { + if (this.saveMode === 'afterDelay' && this.shouldAutoSave(widget, saveable)) { + saveable.save({ + saveReason: SaveReason.AfterDelay + }); + } + }, + this.addBlurListener(widget, saveable) + ); + this.saveThrottles.set(widget, saveThrottle); + this.applySaveableWidget(widget, saveable); + return saveThrottle; + } + + protected addBlurListener(widget: Widget, saveable: Saveable): Disposable { + const document = widget.node.ownerDocument; + const listener = (() => { + if (this.saveMode === 'onWindowChange' && !this.windowHasFocus(document) && this.shouldAutoSave(widget, saveable)) { + saveable.save({ + saveReason: SaveReason.FocusChange + }); + } + }).bind(this); + document.addEventListener('blur', listener); + return Disposable.create(() => { + document.removeEventListener('blur', listener); + }); + } + + protected windowHasFocus(document: Document): boolean { + if (document.visibilityState === 'hidden') { + return false; + } else if (document.hasFocus()) { + return true; + } + // TODO: Add support for iframes + return false; + } + + protected shouldAutoSave(widget: Widget, saveable: Saveable): boolean { + const uri = NavigatableWidget.getUri(widget); + if (uri?.scheme === UNTITLED_SCHEME) { + // Never auto-save untitled documents + return false; + } else { + return saveable.autosaveable !== false && saveable.dirty; + } + } + + protected applySaveableWidget(widget: Widget, saveable: Saveable): void { + if (SaveableWidget.is(widget)) { + return; + } + const saveableWidget = widget as PostCreationSaveableWidget; + setDirty(saveableWidget, saveable.dirty); + saveable.onDirtyChanged(() => setDirty(saveableWidget, saveable.dirty)); + const closeWithSaving = this.createCloseWithSaving(); + const closeWithoutSaving = async () => { + const revert = Saveable.closingWidgetWouldLoseSaveable(saveableWidget, Array.from(this.saveThrottles.keys())); + await this.closeWithoutSaving(saveableWidget, revert); + }; + Object.assign(saveableWidget, { + closeWithoutSaving, + closeWithSaving, + close: closeWithSaving, + [close]: saveableWidget.close, + }); + } + + protected createCloseWithSaving(): (this: SaveableWidget, options?: SaveableWidget.CloseOptions) => Promise { + let closing = false; + const doSave = this.closeWithSaving.bind(this); + return async function (this: SaveableWidget, options?: SaveableWidget.CloseOptions): Promise { + if (closing) { + return; + } + closing = true; + try { + await doSave(this, options); + } finally { + closing = false; + } + }; + } + + protected async closeWithSaving(widget: PostCreationSaveableWidget, options?: SaveableWidget.CloseOptions): Promise { + const result = await this.shouldSaveWidget(widget, options); + if (typeof result === 'boolean') { + if (result) { + await this.save(widget, { + saveReason: SaveReason.AfterDelay + }); + if (!Saveable.isDirty(widget)) { + await widget.closeWithoutSaving(); + } + } else { + await widget.closeWithoutSaving(); + } + } + } + + protected async shouldSaveWidget(widget: PostCreationSaveableWidget, options?: SaveableWidget.CloseOptions): Promise { + if (!Saveable.isDirty(widget)) { + return false; + } + const saveable = Saveable.get(widget); + if (!saveable) { + console.warn('Saveable.get returned undefined on a known saveable widget. This is unexpected.'); + } + // Enter branch if saveable absent since we cannot check autosaveability more definitely. + if (this.autoSave !== 'off' && (!saveable || this.shouldAutoSave(widget, saveable))) { + return true; + } + const notLastWithDocument = !Saveable.closingWidgetWouldLoseSaveable(widget, Array.from(this.saveThrottles.keys())); + if (notLastWithDocument) { + await widget.closeWithoutSaving(false); + return undefined; + } + if (options && options.shouldSave) { + return options.shouldSave(); + } + return new ShouldSaveDialog(widget).open(); + } + + protected async closeWithoutSaving(widget: PostCreationSaveableWidget, doRevert: boolean = true): Promise { + const saveable = Saveable.get(widget); + if (saveable && doRevert && saveable.dirty && saveable.revert) { + await saveable.revert(); + } + widget[close](); + return waitForClosed(widget); + } + + /** + * Indicate if the document can be saved ('Save' command should be disable if not). + */ + canSave(widget?: Widget): widget is Widget & (Saveable | SaveableSource) { + return Saveable.isDirty(widget) && (this.canSaveNotSaveAs(widget) || this.canSaveAs(widget)); + } + + canSaveNotSaveAs(widget?: Widget): widget is Widget & (Saveable | SaveableSource) { + // By default, we never allow a document to be saved if it is untitled. + return Boolean(widget && NavigatableWidget.getUri(widget)?.scheme !== UNTITLED_SCHEME); + } + + /** + * Saves the document + * + * No op if the widget is not saveable. + */ + async save(widget: Widget | undefined, options?: SaveOptions): Promise { + if (this.canSaveNotSaveAs(widget)) { + await Saveable.save(widget, options); + return NavigatableWidget.getUri(widget); + } else if (this.canSaveAs(widget)) { + return this.saveAs(widget, options); + } + } + + canSaveAs(saveable?: Widget): saveable is Widget & SaveableSource & Navigatable { + return false; + } + + saveAs(sourceWidget: Widget & SaveableSource & Navigatable, options?: SaveOptions): Promise { + return Promise.reject('Unsupported: The base SaveResourceService does not support saveAs action.'); + } +} + +export class AutoSaveThrottle implements Disposable { + + private _saveable: Saveable; + private _callback: () => void; + private _saveService: SaveableService; + private _disposable: DisposableCollection; + private _throttle?: ReturnType; + + constructor(saveable: Saveable, saveService: SaveableService, callback: () => void, ...disposables: Disposable[]) { + this._callback = callback; + this._saveable = saveable; + this._saveService = saveService; + this._disposable = new DisposableCollection( + ...disposables, + saveable.onContentChanged(() => { + this.throttledSave(); + }), + saveable.onDirtyChanged(() => { + this.throttledSave(); + }), + saveService.onDidAutoSaveChange(() => { + this.throttledSave(); + }), + saveService.onDidAutoSaveDelayChange(() => { + this.throttledSave(true); + }) + ); + } + + protected throttledSave(reset = false): void { + this._throttle?.cancel(); + if (reset) { + this._throttle = undefined; + } + if (this._saveService.autoSave === 'afterDelay' && this._saveable.dirty) { + if (!this._throttle) { + this._throttle = throttle(() => this._callback(), this._saveService.autoSaveDelay, { + leading: false, + trailing: true + }); + } + this._throttle(); + } + } + + dispose(): void { + this._disposable.dispose(); + } + +} diff --git a/packages/core/src/browser/saveable.ts b/packages/core/src/browser/saveable.ts new file mode 100644 index 0000000..ad1134a --- /dev/null +++ b/packages/core/src/browser/saveable.ts @@ -0,0 +1,418 @@ +// ***************************************************************************** +// Copyright (C) 2017 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { Widget } from '@lumino/widgets'; +import { Message } from '@lumino/messaging'; +import { Emitter, Event } from '../common/event'; +import { MaybePromise } from '../common/types'; +import { Key } from './keyboard/keys'; +import { AbstractDialog } from './dialogs'; +import { nls } from '../common/nls'; +import { Disposable, DisposableCollection, isObject, URI } from '../common'; +import { BinaryBuffer } from '../common/buffer'; + +export type AutoSaveMode = 'off' | 'afterDelay' | 'onFocusChange' | 'onWindowChange'; + +export interface Saveable { + readonly dirty: boolean; + /** If false, the saveable will not participate in autosaving. */ + readonly autosaveable?: boolean; + /** + * This event is fired when the content of the `dirty` variable changes. + */ + readonly onDirtyChanged: Event; + /** + * This event is fired when the content of the saveable changes. + * While `onDirtyChanged` is fired to notify the UI that the widget is dirty, + * `onContentChanged` is used for the auto save throttling. + */ + readonly onContentChanged: Event; + /** + * Saves dirty changes. + */ + save(options?: SaveOptions): MaybePromise; + /** + * Performs the save operation with a new file name. + */ + saveAs?(options: SaveAsOptions): MaybePromise; + /** + * Reverts dirty changes. + */ + revert?(options?: Saveable.RevertOptions): Promise; + /** + * Creates a snapshot of the dirty state. See also {@link Saveable.Snapshot}. + */ + createSnapshot?(): Saveable.Snapshot; + /** + * Applies the given snapshot to the dirty state. + */ + applySnapshot?(snapshot: object): void; + /** + * Serializes the full state of the saveable item to a binary buffer. + */ + serialize?(): Promise; + + /** + * Optionally return file filters for the "Save As" dialog. + * The keys of the returned object are the names of the filters and the values are arrays of file extensions. + * For example: `{ 'Text Files': ['txt', 'text'], 'All Files': ['*'] }` + * If no filters are provided, a default filter of `All Files (*.*)` will be used. + */ + filters?(): { [name: string]: string[] }; +} + +export interface SaveableSource { + readonly saveable: Saveable; +} + +export class DelegatingSaveable implements Saveable { + dirty = false; + protected readonly onDirtyChangedEmitter = new Emitter(); + protected readonly onContentChangedEmitter = new Emitter(); + + get onDirtyChanged(): Event { + return this.onDirtyChangedEmitter.event; + } + + get onContentChanged(): Event { + return this.onContentChangedEmitter.event; + } + + async save(options?: SaveOptions): Promise { + await this._delegate?.save(options); + } + + revert?(options?: Saveable.RevertOptions): Promise; + createSnapshot?(): Saveable.Snapshot; + applySnapshot?(snapshot: object): void; + serialize?(): Promise; + saveAs?(options: SaveAsOptions): MaybePromise; + + protected _delegate?: Saveable; + protected toDispose = new DisposableCollection(); + + set delegate(delegate: Saveable) { + this.toDispose.dispose(); + this.toDispose = new DisposableCollection(); + this._delegate = delegate; + this.toDispose.push(delegate.onDirtyChanged(() => { + this.dirty = delegate.dirty; + this.onDirtyChangedEmitter.fire(); + })); + this.toDispose.push(delegate.onContentChanged(() => { + this.onContentChangedEmitter.fire(); + })); + if (this.dirty !== delegate.dirty) { + this.dirty = delegate.dirty; + this.onDirtyChangedEmitter.fire(); + } + this.revert = delegate.revert?.bind(delegate); + this.createSnapshot = delegate.createSnapshot?.bind(delegate); + this.applySnapshot = delegate.applySnapshot?.bind(delegate); + this.serialize = delegate.serialize?.bind(delegate); + this.saveAs = delegate.saveAs?.bind(delegate); + } + +} + +export class CompositeSaveable implements Saveable { + protected isDirty = false; + protected readonly onDirtyChangedEmitter = new Emitter(); + protected readonly onContentChangedEmitter = new Emitter(); + protected readonly toDispose = new DisposableCollection(this.onDirtyChangedEmitter, this.onContentChangedEmitter); + protected readonly saveablesMap = new Map(); + + get dirty(): boolean { + return this.isDirty; + } + + get onDirtyChanged(): Event { + return this.onDirtyChangedEmitter.event; + } + + get onContentChanged(): Event { + return this.onContentChangedEmitter.event; + } + + async save(options?: SaveOptions): Promise { + await Promise.all(this.saveables.map(saveable => saveable.save(options))); + } + + async revert(options?: Saveable.RevertOptions): Promise { + await Promise.all(this.saveables.map(saveable => saveable.revert?.(options))); + } + + get saveables(): readonly Saveable[] { + return Array.from(this.saveablesMap.keys()); + } + + add(saveable: Saveable): void { + if (this.saveablesMap.has(saveable)) { + return; + } + const toDispose = new DisposableCollection(); + this.toDispose.push(toDispose); + this.saveablesMap.set(saveable, toDispose); + toDispose.push(Disposable.create(() => { + this.saveablesMap.delete(saveable); + })); + toDispose.push(saveable.onDirtyChanged(() => { + const wasDirty = this.isDirty; + this.isDirty = this.saveables.some(s => s.dirty); + if (this.isDirty !== wasDirty) { + this.onDirtyChangedEmitter.fire(); + } + })); + toDispose.push(saveable.onContentChanged(() => { + this.onContentChangedEmitter.fire(); + })); + if (saveable.dirty && !this.isDirty) { + this.isDirty = true; + this.onDirtyChangedEmitter.fire(); + } + } + + remove(saveable: Saveable): boolean { + const toDispose = this.saveablesMap.get(saveable); + toDispose?.dispose(); + return !!toDispose; + } + + dispose(): void { + this.toDispose.dispose(); + } +} + +export namespace Saveable { + export interface RevertOptions { + /** + * If soft then only dirty flag should be updated, otherwise + * the underlying data should be reverted as well. + */ + soft?: boolean + } + + /** + * A snapshot of a saveable item. + * Applying a snapshot of a saveable on another (of the same type) using the `applySnapshot` should yield the state of the original saveable. + */ + export type Snapshot = { value: string } | { read(): string | null }; + export namespace Snapshot { + export function read(snapshot: Snapshot): string | undefined { + return 'value' in snapshot ? snapshot.value : (snapshot.read() ?? undefined); + } + } + export function isSource(arg: unknown): arg is SaveableSource { + return isObject(arg) && is(arg.saveable); + } + export function is(arg: unknown): arg is Saveable { + return isObject(arg) && 'dirty' in arg && 'onDirtyChanged' in arg; + } + export function get(arg: unknown): Saveable | undefined { + if (is(arg)) { + return arg; + } + if (isSource(arg)) { + return arg.saveable; + } + return undefined; + } + export function getDirty(arg: unknown): Saveable | undefined { + const saveable = get(arg); + if (saveable && saveable.dirty) { + return saveable; + } + return undefined; + } + export function isDirty(arg: unknown): boolean { + return !!getDirty(arg); + } + export async function save(arg: unknown, options?: SaveOptions): Promise { + const saveable = get(arg); + if (saveable) { + await saveable.save(options); + } + } + + export async function confirmSaveBeforeClose(toClose: Iterable, others: Widget[]): Promise { + for (const widget of toClose) { + const saveable = Saveable.get(widget); + if (saveable?.dirty) { + if (!closingWidgetWouldLoseSaveable(widget, others)) { + continue; + } + const userWantsToSave = await new ShouldSaveDialog(widget).open(); + if (userWantsToSave === undefined) { // User clicked cancel. + return undefined; + } else if (userWantsToSave) { + await saveable.save(); + } else { + await saveable.revert?.(); + } + } + } + return true; + } + + export function closingWidgetWouldLoseSaveable(widget: Widget, others: Widget[]): boolean { + const saveable = Saveable.get(widget); + return !!saveable && !others.some(otherWidget => otherWidget !== widget && Saveable.get(otherWidget) === saveable); + } +} + +export interface SaveableWidget extends Widget { + /** + * @param doRevert whether the saveable should be reverted before being saved. Defaults to `true`. + */ + closeWithoutSaving(doRevert?: boolean): Promise; + closeWithSaving(options?: SaveableWidget.CloseOptions): Promise; +} + +export const close = Symbol('close'); +/** + * An interface describing saveable widgets that are created by the `Saveable.apply` function. + * The original `close` function is reassigned to a locally-defined `Symbol` + */ +export interface PostCreationSaveableWidget extends SaveableWidget { + /** + * The original `close` function of the widget + */ + [close](): void; +} +export namespace SaveableWidget { + export function is(widget: Widget | undefined): widget is SaveableWidget { + return !!widget && 'closeWithoutSaving' in widget; + } + export function getDirty(widgets: Iterable): IterableIterator { + return get(widgets, Saveable.isDirty); + } + export function* get( + widgets: Iterable, + filter: (widget: T) => boolean = () => true + ): IterableIterator { + for (const widget of widgets) { + if (SaveableWidget.is(widget) && filter(widget)) { + yield widget; + } + } + } + export interface CloseOptions { + shouldSave?(): MaybePromise + } +} + +/** + * Possible formatting types when saving. + */ +export const enum FormatType { + /** + * Formatting should occur (default). + */ + ON = 1, + /** + * Formatting should not occur. + */ + OFF, + /** + * Formatting should only occur if the resource is dirty. + */ + DIRTY +}; + +export enum SaveReason { + Manual = 1, + AfterDelay = 2, + FocusChange = 3 +} + +export namespace SaveReason { + export function isManual(reason?: number): reason is typeof SaveReason.Manual { + return reason === SaveReason.Manual; + } +} + +export interface SaveOptions { + /** + * Formatting type to apply when saving. + */ + readonly formatType?: FormatType; + /** + * The reason for saving the resource. + */ + readonly saveReason?: SaveReason; +} + +export interface SaveAsOptions extends SaveOptions { + readonly target: URI; +} + +/** + * The class name added to the dirty widget's title. + */ +const DIRTY_CLASS = 'theia-mod-dirty'; +export function setDirty(widget: Widget, dirty: boolean): void { + const dirtyClass = ` ${DIRTY_CLASS}`; + widget.title.className = widget.title.className.replace(dirtyClass, ''); + if (dirty) { + widget.title.className += dirtyClass; + } +} + +export class ShouldSaveDialog extends AbstractDialog { + + protected shouldSave = true; + + protected readonly dontSaveButton: HTMLButtonElement; + + constructor(widget: Widget) { + super({ + title: nls.localizeByDefault('Do you want to save the changes you made to {0}?', widget.title.label || widget.title.caption) + }, { + node: widget.node.ownerDocument.createElement('div') + }); + + const messageNode = this.node.ownerDocument.createElement('div'); + messageNode.textContent = nls.localizeByDefault("Your changes will be lost if you don't save them."); + messageNode.setAttribute('style', 'flex: 1 100%; padding-bottom: calc(var(--theia-ui-padding)*3);'); + this.contentNode.appendChild(messageNode); + this.appendCloseButton(); + this.dontSaveButton = this.appendDontSaveButton(); + this.appendAcceptButton(nls.localizeByDefault('Save')); + } + + protected appendDontSaveButton(): HTMLButtonElement { + const button = this.createButton(nls.localizeByDefault("Don't Save")); + this.controlPanel.appendChild(button); + button.classList.add('secondary'); + return button; + } + + protected override onAfterAttach(msg: Message): void { + super.onAfterAttach(msg); + this.addKeyListener(this.dontSaveButton, Key.ENTER, () => { + this.shouldSave = false; + this.accept(); + }, 'click'); + } + + get value(): boolean { + return this.shouldSave; + } + + override async open(disposeOnResolve?: boolean): Promise { + return super.open(disposeOnResolve); + } +} diff --git a/packages/core/src/browser/secondary-window-handler.ts b/packages/core/src/browser/secondary-window-handler.ts new file mode 100644 index 0000000..62f27cb --- /dev/null +++ b/packages/core/src/browser/secondary-window-handler.ts @@ -0,0 +1,375 @@ +// ***************************************************************************** +// Copyright (C) 2022 STMicroelectronics, Ericsson, ARM, EclipseSource and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import debounce = require('lodash.debounce'); +import { inject, injectable } from 'inversify'; +import { BoxLayout, ExtractableWidget, TabBar, Widget } from './widgets'; +import { MessageService } from '../common/message-service'; +import { ApplicationShell, DockPanelRenderer, MAIN_AREA_CLASS, MAIN_BOTTOM_AREA_CLASS } from './shell/application-shell'; +import { Emitter } from '../common/event'; +import { isSecondaryWindow, SecondaryWindowRootWidget, SecondaryWindowService } from './window/secondary-window-service'; +import { KeybindingRegistry } from './keybinding'; +import { MAIN_AREA_ID, TheiaDockPanel } from './shell/theia-dock-panel'; + +/** Widgets to be contained inside a DockPanel in the secondary window. */ +class SecondaryWindowDockPanelWidget extends SecondaryWindowRootWidget { + + protected _widgets: Widget[] = []; + protected dockPanel: TheiaDockPanel; + + constructor( + dockPanelFactory: TheiaDockPanel.Factory, + dockPanelRendererFactory: (document?: Document | ShadowRoot) => DockPanelRenderer, + closeHandler: (sender: TabBar, args: TabBar.ITabCloseRequestedArgs) => boolean, + secondaryWindow: Window + ) { + super(); + this.secondaryWindow = secondaryWindow; + const boxLayout = new BoxLayout(); + + // reuse same tab bar classes and dock panel id as main window to inherit styling + const renderer = dockPanelRendererFactory(secondaryWindow.document); + renderer.tabBarClasses.push(MAIN_BOTTOM_AREA_CLASS); + renderer.tabBarClasses.push(MAIN_AREA_CLASS); + this.dockPanel = dockPanelFactory({ + disableDragAndDrop: true, + closeHandler, + mode: 'multiple-document', + renderer, + }); + this.dockPanel.id = MAIN_AREA_ID; + BoxLayout.setStretch(this.dockPanel, 1); + boxLayout.addWidget(this.dockPanel); + this.layout = boxLayout; + } + + override get widgets(): ReadonlyArray { + return this._widgets; + } + + addWidget(widget: Widget, disposeCallback: () => void, options?: TheiaDockPanel.AddOptions): void { + this._widgets.push(widget); + this.dockPanel.addWidget(widget, options); + + widget.disposed.connect(() => { + const index = this._widgets.indexOf(widget); + if (index > -1) { + this._widgets.splice(index, 1); + } + disposeCallback(); + }); + + this.dockPanel.activateWidget(widget); + } + + override getTabBar(widget: Widget): TabBar | undefined { + return this.dockPanel.findTabBar(widget.title); + } +} + +/** + * Offers functionality to move a widget out of the main window to a newly created window. + * Widgets must explicitly implement the `ExtractableWidget` interface to support this. + * + * This handler manages the opened secondary windows and sets up messaging between them and the Theia main window. + * In addition, it provides access to the extracted widgets and provides notifications when widgets are added to or removed from this handler. + * + */ +@injectable() +export class SecondaryWindowHandler { + /** List of widgets in secondary windows. */ + protected readonly _widgets: Widget[] = []; + + protected applicationShell: ApplicationShell; + + protected dockPanelRendererFactory: (document?: Document | ShadowRoot) => DockPanelRenderer; + + @inject(KeybindingRegistry) + protected keybindings: KeybindingRegistry; + + @inject(TheiaDockPanel.Factory) + protected dockPanelFactory: TheiaDockPanel.Factory; + + protected readonly onWillAddWidgetEmitter = new Emitter<[Widget, Window]>(); + /** Subscribe to get notified when a widget is added to this handler, i.e. the widget was moved to an secondary window . */ + readonly onWillAddWidget = this.onWillAddWidgetEmitter.event; + + protected readonly onDidAddWidgetEmitter = new Emitter<[Widget, Window]>(); + /** Subscribe to get notified when a widget is added to this handler, i.e. the widget was moved to an secondary window . */ + readonly onDidAddWidget = this.onDidAddWidgetEmitter.event; + + protected readonly onWillRemoveWidgetEmitter = new Emitter<[Widget, Window]>(); + /** Subscribe to get notified when a widget is removed from this handler, i.e. the widget's window was closed or the widget was disposed. */ + readonly onWillRemoveWidget = this.onWillRemoveWidgetEmitter.event; + + protected readonly onDidRemoveWidgetEmitter = new Emitter<[Widget, Window]>(); + /** Subscribe to get notified when a widget is removed from this handler, i.e. the widget's window was closed or the widget was disposed. */ + readonly onDidRemoveWidget = this.onDidRemoveWidgetEmitter.event; + + @inject(MessageService) + protected readonly messageService: MessageService; + + @inject(SecondaryWindowService) + protected readonly secondaryWindowService: SecondaryWindowService; + + /** @returns List of widgets in secondary windows. */ + get widgets(): ReadonlyArray { + // Create new array in case the original changes while this is used. + return [...this._widgets]; + } + + /** + * Sets up message forwarding from the main window to secondary windows. + * Does nothing if this service has already been initialized. + * + * @param shell The `ApplicationShell` that widgets will be moved out from. + * @param dockPanelRendererFactory A factory function to create a `DockPanelRenderer` for use in secondary windows. + */ + init(shell: ApplicationShell, dockPanelRendererFactory: (document?: Document | ShadowRoot) => DockPanelRenderer): void { + if (this.applicationShell) { + // Already initialized + return; + } + this.applicationShell = shell; + this.dockPanelRendererFactory = dockPanelRendererFactory; + + this.secondaryWindowService.beforeWidgetRestore(([widget, window]) => this.removeWidget(widget, window)); + } + + /** + * Moves the given widget to a new window. + * + * @param widget the widget to extract + */ + moveWidgetToSecondaryWindow(widget: ExtractableWidget): void { + if (!this.applicationShell) { + console.error('Widget cannot be extracted because the WidgetExtractionHandler has not been initialized.'); + return; + } + if (!widget.isExtractable) { + console.error('Widget is not extractable.', widget.id); + return; + } + + const newWindow = this.secondaryWindowService.createSecondaryWindow(widget, this.applicationShell); + + if (!newWindow) { + this.messageService.error('The widget could not be moved to a secondary window because the window creation failed. Please make sure to allow popups.'); + return; + } + + const mainWindowTitle = document.title; + + newWindow.addEventListener('load', () => { + this.keybindings.registerEventListeners(newWindow); + // Use the widget's title as the window title + // Even if the widget's label were malicious, this should be safe against XSS because the HTML standard defines this is inserted via a text node. + // See https://html.spec.whatwg.org/multipage/dom.html#document.title + newWindow.document.title = `${widget.title.label} — ${mainWindowTitle}`; + + const element = newWindow.document.getElementById('widget-host'); + if (!element) { + console.error('Could not find dom element to attach to in secondary window'); + return; + } + + this.onWillAddWidgetEmitter.fire([widget, newWindow]); + + widget.secondaryWindow = newWindow; + widget.previousArea = this.applicationShell.getAreaFor(widget); + const rootWidget: SecondaryWindowRootWidget = new SecondaryWindowDockPanelWidget(this.dockPanelFactory, this.dockPanelRendererFactory, this.onTabCloseRequested, + newWindow); + rootWidget.defaultRestoreArea = widget.previousArea; + rootWidget.addClass('secondary-widget-root'); + rootWidget.addClass('monaco-workbench'); // needed for compatility with VSCode styles + Widget.attach(rootWidget, element); + if (isSecondaryWindow(newWindow)) { + newWindow.rootWidget = rootWidget; + } + rootWidget.addWidget(widget, () => { + this.onWidgetRemove(widget, newWindow, rootWidget); + }); + widget.show(); + widget.update(); + + this.addWidget(widget, newWindow); + + // debounce to avoid rapid updates while resizing the secondary window + const updateWidget = debounce(() => { + rootWidget.update(); + }, 100); + newWindow.addEventListener('resize', () => { + updateWidget(); + }); + widget.activate(); + }); + } + + private onWidgetRemove(widget: Widget, newWindow: Window, rootWidget: SecondaryWindowRootWidget): void { + // Close the window if the widget is disposed, e.g. by a command closing all widgets. + this.onWillRemoveWidgetEmitter.fire([widget, newWindow]); + this.removeWidget(widget, newWindow); + if (!newWindow.closed && rootWidget.widgets.length === 0) { + // no remaining widgets in window -> close the window + newWindow.close(); + } + + } + + addWidgetToSecondaryWindow(widget: Widget, secondaryWindow: Window, options?: TheiaDockPanel.AddOptions): void { + const rootWidget = isSecondaryWindow(secondaryWindow) ? secondaryWindow.rootWidget : undefined; + if (!rootWidget) { + console.error('Given secondary window no known root.'); + return; + } + + // we allow to add any widget to an existing secondary window unless it is marked as not extractable or is already extracted + if (ExtractableWidget.is(widget)) { + if (!widget.isExtractable) { + console.error('Widget is not extractable.', widget.id); + return; + } + if (widget.secondaryWindow !== undefined) { + console.error('Widget is extracted already.', widget.id); + return; + } + widget.secondaryWindow = secondaryWindow; + widget.previousArea = this.applicationShell.getAreaFor(widget); + } + + rootWidget.addWidget(widget, () => { + this.onWidgetRemove(widget, secondaryWindow, rootWidget); + }, options); + widget.show(); + widget.update(); + this.addWidget(widget, secondaryWindow); + widget.activate(); + } + + onTabCloseRequested(_sender: TabBar, _args: TabBar.ITabCloseRequestedArgs): boolean { + // return false to keep default behavior + // override this method if you want to move tabs back instead of closing them + return false; + } + + /** + * If the given widget is tracked by this handler, activate it and focus its secondary window. + * + * @param widgetId The widget to activate specified by its id + * @returns The activated `ExtractableWidget` or `undefined` if the given widget id is unknown to this handler. + */ + activateWidget(widgetId: string): ExtractableWidget | Widget | undefined { + const trackedWidget = this.revealWidget(widgetId); + trackedWidget?.activate(); + return trackedWidget; + } + + /** + * If the given widget is tracked by this handler, reveal it by focussing its secondary window. + * + * @param widgetId The widget to reveal specified by its id + * @returns The revealed `ExtractableWidget` or `undefined` if the given widget id is unknown to this handler. + */ + revealWidget(widgetId: string): ExtractableWidget | Widget | undefined { + const trackedWidget = this._widgets.find(w => w.id === widgetId); + if (trackedWidget && this.getFocusedWindow()) { + if (ExtractableWidget.is(trackedWidget)) { + this.secondaryWindowService.focus(trackedWidget.secondaryWindow!); + return trackedWidget; + } else { + const window = extractSecondaryWindow(trackedWidget); + if (window) { + this.secondaryWindowService.focus(window); + return trackedWidget; + } + } + } + return undefined; + } + + getFocusedWindow(): Window | undefined { + return window.document.hasFocus() ? window : this.secondaryWindowService.getWindows().find(candidate => candidate.document.hasFocus()); + } + + protected addWidget(widget: Widget, win: Window): void { + if (!this._widgets.includes(widget)) { + this._widgets.push(widget); + this.onDidAddWidgetEmitter.fire([widget, win]); + } + } + + protected removeWidget(widget: Widget, win: Window): void { + const index = this._widgets.indexOf(widget); + if (index > -1) { + this._widgets.splice(index, 1); + this.onDidRemoveWidgetEmitter.fire([widget, win]); + } + } + + getTabBarFor(widget: Widget): TabBar | undefined { + const secondaryWindowRootWidget = extractSecondaryWindowRootWidget(widget); + if (secondaryWindowRootWidget && secondaryWindowRootWidget.getTabBar) { + return secondaryWindowRootWidget.getTabBar(widget); + } + return undefined; + } + +} + +export function getDefaultRestoreArea(window: Window): ApplicationShell.Area | undefined { + if (isSecondaryWindow(window) && window.rootWidget !== undefined) { + return window.rootWidget.defaultRestoreArea; + } + return undefined; +} + +export function getAllWidgetsFromSecondaryWindow(window: Window): ReadonlyArray | undefined { + if (isSecondaryWindow(window) && window.rootWidget !== undefined) { + return window.rootWidget.widgets; + } + return undefined; +} + +export function extractSecondaryWindowRootWidget(widget: Widget | undefined | null): SecondaryWindowRootWidget | undefined { + if (!widget) { + return undefined; + } + // check two levels of parent hierarchy, usually a root widget would have nested layout widget + if (widget.parent instanceof SecondaryWindowRootWidget) { + return widget.parent; + } + if (widget.parent?.parent instanceof SecondaryWindowRootWidget) { + return widget.parent.parent; + } +} + +export function extractSecondaryWindow(widget: Widget | undefined | null): Window | undefined { + if (!widget) { + return undefined; + } + if (ExtractableWidget.is(widget)) { + return widget.secondaryWindow; + } + if (widget instanceof SecondaryWindowRootWidget) { + return widget.secondaryWindow; + } + const secondaryWindowRootWidget = extractSecondaryWindowRootWidget(widget); + if (secondaryWindowRootWidget) { + return secondaryWindowRootWidget.secondaryWindow; + } + + return undefined; +} diff --git a/packages/core/src/browser/shell/additional-views-menu-widget.tsx b/packages/core/src/browser/shell/additional-views-menu-widget.tsx new file mode 100644 index 0000000..05f5791 --- /dev/null +++ b/packages/core/src/browser/shell/additional-views-menu-widget.tsx @@ -0,0 +1,71 @@ +// ***************************************************************************** +// Copyright (C) 2023 STMicroelectronics and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { inject, injectable } from '../../../shared/inversify'; +import { Command, CommandRegistry, Disposable, MenuModelRegistry, MenuPath, nls } from '../../common'; +import { Title, Widget, codicon } from '../widgets'; +import { SidebarMenuWidget } from './sidebar-menu-widget'; +import { SideTabBar } from './tab-bars'; + +export const AdditionalViewsMenuWidgetFactory = Symbol('AdditionalViewsMenuWidgetFactory'); +export type AdditionalViewsMenuWidgetFactory = (side: 'left' | 'right') => AdditionalViewsMenuWidget; + +export const AdditionalViewsMenuPath = Symbol('AdditionalViewsMenuPath'); +@injectable() +export class AdditionalViewsMenuWidget extends SidebarMenuWidget { + static readonly ID = 'sidebar.additional.views'; + + @inject(AdditionalViewsMenuPath) + protected menuPath: MenuPath; + + @inject(CommandRegistry) + protected readonly commandRegistry: CommandRegistry; + + @inject(MenuModelRegistry) + protected readonly menuModelRegistry: MenuModelRegistry; + + protected menuDisposables: Disposable[] = []; + + updateAdditionalViews(sender: SideTabBar, event: { titles: Title[], startIndex: number }): void { + if (event.startIndex === -1) { + this.removeMenu(AdditionalViewsMenuWidget.ID); + } else { + this.addMenu({ + title: nls.localizeByDefault('Additional Views'), + iconClass: codicon('ellipsis'), + id: AdditionalViewsMenuWidget.ID, + menuPath: this.menuPath, + order: 0 + }); + } + + this.menuDisposables.forEach(disposable => disposable.dispose()); + this.menuDisposables = []; + event.titles.forEach((title, i) => this.registerMenuAction(sender, title, i)); + } + + protected registerMenuAction(sender: SideTabBar, title: Title, index: number): void { + const command: Command = { id: `reveal.${title.label}.${index}`, label: title.label }; + this.menuDisposables.push(this.commandRegistry.registerCommand(command, { + execute: () => { + window.requestAnimationFrame(() => { + sender.currentIndex = sender.titles.indexOf(title); + }); + } + })); + this.menuDisposables.push(this.menuModelRegistry.registerMenuAction(this.menuPath, { commandId: command.id, order: index.toString() })); + } +} diff --git a/packages/core/src/browser/shell/application-shell-mouse-tracker.ts b/packages/core/src/browser/shell/application-shell-mouse-tracker.ts new file mode 100644 index 0000000..89a703b --- /dev/null +++ b/packages/core/src/browser/shell/application-shell-mouse-tracker.ts @@ -0,0 +1,103 @@ +// ***************************************************************************** +// Copyright (C) 2019 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { FrontendApplicationContribution } from '../frontend-application-contribution'; +import { ApplicationShell } from './application-shell'; +import { injectable, inject } from 'inversify'; +import { DisposableCollection, Disposable } from '../../common/disposable'; +import { Emitter, Event } from '../../common/event'; +import { FocusTracker, PanelLayout, SplitPanel } from '@lumino/widgets'; +import { addEventListener, Widget } from '../widgets'; +/** + * Contribution that tracks `mouseup` and `mousedown` events. + * + * This is required to be able to track the `TabBar`, `DockPanel`, and `SidePanel` resizing and drag and drop events correctly + * all over the application. By default, when the mouse is over an `iframe` we lose the mouse tracking ability, so whenever + * we click (`mousedown`), we overlay a transparent `div` over the `iframe` in the Mini Browser, then we set the `display` of + * the transparent `div` to `none` on `mouseup` events. + */ +@injectable() +export class ApplicationShellMouseTracker implements FrontendApplicationContribution { + + @inject(ApplicationShell) + protected readonly applicationShell: ApplicationShell; + + protected readonly toDispose = new DisposableCollection(); + protected readonly toDisposeOnActiveChange = new DisposableCollection(); + + protected readonly mouseupEmitter = new Emitter(); + protected readonly mousedownEmitter = new Emitter(); + protected readonly mouseupListener: (e: MouseEvent) => void = e => this.mouseupEmitter.fire(e); + protected readonly mousedownListener: (e: MouseEvent) => void = e => this.mousedownEmitter.fire(e); + + onStart(): void { + // Here we need to attach a `mousedown` listener to the `TabBar`s, `DockPanel`s and the `SidePanel`s. Otherwise, Lumino handles the event and stops the propagation. + // Track the `mousedown` on the `TabBar` for the currently active widget. + this.applicationShell.onDidChangeActiveWidget((args: FocusTracker.IChangedArgs) => { + this.toDisposeOnActiveChange.dispose(); + if (args.newValue) { + const tabBar = this.applicationShell.getTabBarFor(args.newValue); + if (tabBar) { + this.toDisposeOnActiveChange.push(addEventListener(tabBar.node, 'mousedown', this.mousedownListener, true)); + } + } + }); + + // Track the `mousedown` events for the `SplitPanel`s, if any. + const { layout } = this.applicationShell; + if (layout instanceof PanelLayout) { + this.toDispose.pushAll( + layout.widgets.filter(ApplicationShellMouseTracker.isSplitPanel).map(splitPanel => addEventListener(splitPanel.node, 'mousedown', this.mousedownListener, true)) + ); + } + // Track the `mousedown` on each `DockPanel`. + const { mainPanel, bottomPanel, leftPanelHandler, rightPanelHandler } = this.applicationShell; + this.toDispose.pushAll([mainPanel, bottomPanel, leftPanelHandler.dockPanel, rightPanelHandler.dockPanel] + .map(panel => addEventListener(panel.node, 'mousedown', this.mousedownListener, true))); + + // The `mouseup` event has to be tracked on the `document`. Lumino attaches to there. + document.addEventListener('mouseup', this.mouseupListener, true); + + // Make sure it is disposed in the end. + this.toDispose.pushAll([ + this.mousedownEmitter, + this.mouseupEmitter, + Disposable.create(() => document.removeEventListener('mouseup', this.mouseupListener, true)) + ]); + } + + onStop(): void { + this.toDispose.dispose(); + this.toDisposeOnActiveChange.dispose(); + } + + get onMouseup(): Event { + return this.mouseupEmitter.event; + } + + get onMousedown(): Event { + return this.mousedownEmitter.event; + } + +} + +export namespace ApplicationShellMouseTracker { + + export function isSplitPanel(arg: Widget): arg is SplitPanel { + return arg instanceof SplitPanel; + } + +} diff --git a/packages/core/src/browser/shell/application-shell.ts b/packages/core/src/browser/shell/application-shell.ts new file mode 100644 index 0000000..c95283c --- /dev/null +++ b/packages/core/src/browser/shell/application-shell.ts @@ -0,0 +1,2559 @@ +// ***************************************************************************** +// Copyright (C) 2018 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { injectable, inject, optional, postConstruct } from 'inversify'; +import { ArrayExt, find, toArray, each } from '@lumino/algorithm'; +import { + BoxLayout, BoxPanel, DockLayout, DockPanel, FocusTracker, Layout, Panel, SplitLayout, + SplitPanel, TabBar, Widget, Title +} from '@lumino/widgets'; +import { Message } from '@lumino/messaging'; +import { Drag } from '@lumino/dragdrop'; +import { RecursivePartial, Event as CommonEvent, DisposableCollection, Disposable, environment, isObject, UntitledResourceResolver, UNTITLED_SCHEME } from '../../common'; +import { animationFrame } from '../browser'; +import { Saveable, SaveableWidget, SaveOptions } from '../saveable'; +import { StatusBarImpl, StatusBarEntry, StatusBarAlignment } from '../status-bar/status-bar'; +import { TheiaDockPanel, BOTTOM_AREA_ID, MAIN_AREA_ID } from './theia-dock-panel'; +import { SidePanelHandler, SidePanel, SidePanelHandlerFactory } from './side-panel-handler'; +import { TabBarRendererFactory, SHELL_TABBAR_CONTEXT_MENU, ScrollableTabBar, ToolbarAwareTabBar } from './tab-bars'; +import { SplitPositionHandler, SplitPositionOptions } from './split-panels'; +import { FrontendApplicationStateService } from '../frontend-application-state'; +import { TabBarToolbarRegistry, TabBarToolbarFactory } from './tab-bar-toolbar'; +import { ContextKeyService } from '../context-key-service'; +import { Emitter } from '../../common/event'; +import { waitForRevealed, waitForClosed, PINNED_CLASS, UnsafeWidgetUtilities } from '../widgets'; +import { CorePreferences } from '../../common/core-preferences'; +import { BreadcrumbsRendererFactory } from '../breadcrumbs/breadcrumbs-renderer'; +import { Deferred } from '../../common/promise-util'; +import { SaveableService } from '../saveable-service'; +import { nls } from '../../common/nls'; +import { extractSecondaryWindow, SecondaryWindowHandler } from '../secondary-window-handler'; +import URI from '../../common/uri'; +import { OpenerService } from '../opener-service'; +import { PreviewableWidget } from '../widgets/previewable-widget'; +import { WindowService } from '../window/window-service'; +import { TheiaSplitPanel } from './theia-split-panel'; + +/** The class name added to ApplicationShell instances. */ +export const APPLICATION_SHELL_CLASS = 'theia-ApplicationShell'; +/** The class name added to the main and bottom area panels. */ +export const MAIN_BOTTOM_AREA_CLASS = 'theia-app-centers'; +/** Status bar entry identifier for the bottom panel toggle button. */ +export const BOTTOM_PANEL_TOGGLE_ID = 'bottom-panel-toggle'; +/** The class name added to the main area panel. */ +export const MAIN_AREA_CLASS = 'theia-app-main'; +/** The class name added to the bottom area panel. */ +export const BOTTOM_AREA_CLASS = 'theia-app-bottom'; + +export type ApplicationShellLayoutVersion = + /** layout versioning is introduced, unversioned layout are not compatible */ + 2.0 | + /** view containers are introduced, backward compatible to 2.0 */ + 3.0 | + /** git history view is replaced by a more generic scm history view, backward compatible to 3.0 */ + 4.0 | + /** Replace custom/font-awesome icons with codicons */ + 5.0 | + /** added the ability to drag and drop view parts between view containers */ + 6.0; + +/** + * When a version is increased, make sure to introduce a migration (ApplicationShellLayoutMigration) to this version. + */ +export const applicationShellLayoutVersion: ApplicationShellLayoutVersion = 5.0; + +export const ApplicationShellOptions = Symbol('ApplicationShellOptions'); +export const DockPanelRendererFactory = Symbol('DockPanelRendererFactory'); +export interface DockPanelRendererFactory { + (document?: Document | ShadowRoot): DockPanelRenderer +} + +/** + * A renderer for dock panels that supports context menus on tabs. + */ +@injectable() +export class DockPanelRenderer implements DockLayout.IRenderer { + readonly tabBarClasses: string[] = []; + + /** + * In case of DockPanels rendered in secondary windows, will be set + * to the document of that window + */ + document?: Document | ShadowRoot; + + private readonly onDidCreateTabBarEmitter = new Emitter>(); + + constructor( + @inject(TabBarRendererFactory) protected readonly tabBarRendererFactory: TabBarRendererFactory, + @inject(TabBarToolbarRegistry) protected readonly tabBarToolbarRegistry: TabBarToolbarRegistry, + @inject(TabBarToolbarFactory) protected readonly tabBarToolbarFactory: TabBarToolbarFactory, + @inject(BreadcrumbsRendererFactory) protected readonly breadcrumbsRendererFactory: BreadcrumbsRendererFactory, + @inject(CorePreferences) protected readonly corePreferences: CorePreferences, + ) { } + + get onDidCreateTabBar(): CommonEvent> { + return this.onDidCreateTabBarEmitter.event; + } + + createTabBar(): TabBar { + const getDynamicTabOptions: () => ScrollableTabBar.Options | undefined = () => { + if (this.corePreferences.get('workbench.tab.shrinkToFit.enabled')) { + return { + minimumTabSize: this.corePreferences.get('workbench.tab.shrinkToFit.minimumSize'), + defaultTabSize: this.corePreferences.get('workbench.tab.shrinkToFit.defaultSize') + }; + } else { + return undefined; + } + }; + + const renderer = this.tabBarRendererFactory(); + const tabBar = new ToolbarAwareTabBar( + this.tabBarToolbarRegistry, + this.tabBarToolbarFactory, + this.breadcrumbsRendererFactory, + { + document: this.document, + renderer + }, + { + // Scroll bar options + handlers: ['drag-thumb', 'keyboard', 'wheel', 'touch'], + useBothWheelAxes: true, + scrollXMarginOffset: 4, + suppressScrollY: true + }, + getDynamicTabOptions()); + this.tabBarClasses.forEach(c => tabBar.addClass(c)); + renderer.tabBar = tabBar; + renderer.contextMenuPath = SHELL_TABBAR_CONTEXT_MENU; + tabBar.currentChanged.connect(this.onCurrentTabChanged, this); + const prefChangeDisposable = this.corePreferences.onPreferenceChanged(change => { + if (change.preferenceName === 'workbench.tab.shrinkToFit.enabled' || + change.preferenceName === 'workbench.tab.shrinkToFit.minimumSize' || + change.preferenceName === 'workbench.tab.shrinkToFit.defaultSize') { + tabBar.dynamicTabOptions = getDynamicTabOptions(); + } + }); + tabBar.disposed.connect(() => { + prefChangeDisposable.dispose(); + renderer.dispose(); + }); + this.onDidCreateTabBarEmitter.fire(tabBar); + return tabBar; + } + + createHandle(): HTMLDivElement { + return DockPanel.defaultRenderer.createHandle(); + } + + protected onCurrentTabChanged(sender: ToolbarAwareTabBar, { currentIndex }: TabBar.ICurrentChangedArgs): void { + if (currentIndex >= 0) { + sender.revealTab(currentIndex); + } + } +} + +/** + * Data stored while dragging widgets in the shell. + */ +interface WidgetDragState { + startTime: number; + leftExpanded: boolean; + rightExpanded: boolean; + bottomExpanded: boolean; + lastDragOver?: Drag.Event; + leaveTimeout?: number; +} + +export const MAXIMIZED_CLASS = 'theia-maximized'; +/** + * The application shell manages the top-level widgets of the application. Use this class to + * add, remove, or activate a widget. + */ +@injectable() +export class ApplicationShell extends Widget { + + /** + * The dock panel in the main shell area. This is where editors usually go to. + */ + mainPanel: TheiaDockPanel; + + /** + * The dock panel in the bottom shell area. In contrast to the main panel, the bottom panel + * can be collapsed and expanded. + */ + bottomPanel: TheiaDockPanel; + + /** + * Handler for the left side panel. The primary application views go here, such as the + * file explorer and the git view. + */ + leftPanelHandler: SidePanelHandler; + + /** + * Handler for the right side panel. The secondary application views go here, such as the + * outline view. + */ + rightPanelHandler: SidePanelHandler; + + /** + * General options for the application shell. + */ + protected options: ApplicationShell.Options; + + /** + * The fixed-size panel shown on top. This one usually holds the main menu. + */ + topPanel: Panel; + + /** + * The current state of the bottom panel. + */ + protected readonly bottomPanelState: SidePanel.State = { + empty: true, + expansion: SidePanel.ExpansionState.collapsed, + pendingUpdate: Promise.resolve() + }; + + private readonly tracker = new FocusTracker(); + private dragState?: WidgetDragState; + additionalDraggedUris: URI[] | undefined; + + @inject(ContextKeyService) + protected readonly contextKeyService: ContextKeyService; + + @inject(OpenerService) + protected readonly openerService: OpenerService; + + @inject(UntitledResourceResolver) + protected readonly untitledResourceResolver: UntitledResourceResolver; + + protected readonly onDidAddWidgetEmitter = new Emitter(); + readonly onDidAddWidget = this.onDidAddWidgetEmitter.event; + protected fireDidAddWidget(widget: Widget): void { + this.onDidAddWidgetEmitter.fire(widget); + } + + protected readonly onDidRemoveWidgetEmitter = new Emitter(); + readonly onDidRemoveWidget = this.onDidRemoveWidgetEmitter.event; + protected fireDidRemoveWidget(widget: Widget): void { + this.onDidRemoveWidgetEmitter.fire(widget); + } + + protected readonly onDidChangeActiveWidgetEmitter = new Emitter>(); + readonly onDidChangeActiveWidget = this.onDidChangeActiveWidgetEmitter.event; + + protected readonly onDidChangeCurrentWidgetEmitter = new Emitter>(); + readonly onDidChangeCurrentWidget = this.onDidChangeCurrentWidgetEmitter.event; + + protected readonly onDidDoubleClickMainAreaEmitter = new Emitter(); + readonly onDidDoubleClickMainArea = this.onDidDoubleClickMainAreaEmitter.event; + + @inject(TheiaDockPanel.Factory) + protected readonly dockPanelFactory: TheiaDockPanel.Factory; + + private _mainPanelRenderer: DockPanelRenderer; + get mainPanelRenderer(): DockPanelRenderer { + return this._mainPanelRenderer; + } + + protected initializedDeferred = new Deferred(); + initialized = this.initializedDeferred.promise; + + protected readonly maximizedElement: HTMLElement; + + /** + * Construct a new application shell. + */ + constructor( + @inject(DockPanelRendererFactory) protected dockPanelRendererFactory: () => DockPanelRenderer, + @inject(StatusBarImpl) protected readonly statusBar: StatusBarImpl, + @inject(SidePanelHandlerFactory) protected readonly sidePanelHandlerFactory: () => SidePanelHandler, + @inject(SplitPositionHandler) protected splitPositionHandler: SplitPositionHandler, + @inject(FrontendApplicationStateService) protected readonly applicationStateService: FrontendApplicationStateService, + @inject(ApplicationShellOptions) @optional() options: RecursivePartial = {}, + @inject(CorePreferences) protected readonly corePreferences: CorePreferences, + @inject(SaveableService) protected readonly saveableService: SaveableService, + @inject(SecondaryWindowHandler) protected readonly secondaryWindowHandler: SecondaryWindowHandler, + @inject(WindowService) protected readonly windowService: WindowService + ) { + super(options as Widget.IOptions); + + this.maximizedElement = this.node.ownerDocument.createElement('div'); + this.maximizedElement.style.position = 'fixed'; + this.maximizedElement.style.display = 'none'; + this.maximizedElement.style.left = '0px'; + this.maximizedElement.style.bottom = '0px'; + this.maximizedElement.style.right = '0px'; + this.maximizedElement.style.background = 'var(--theia-editor-background)'; + this.maximizedElement.style.zIndex = '2000'; + this.node.ownerDocument.body.appendChild(this.maximizedElement); + + // Merge the user-defined application options with the default options + this.options = { + bottomPanel: { + ...ApplicationShell.DEFAULT_OPTIONS.bottomPanel, + ...options?.bottomPanel || {} + }, + leftPanel: { + ...ApplicationShell.DEFAULT_OPTIONS.leftPanel, + ...options?.leftPanel || {} + }, + rightPanel: { + ...ApplicationShell.DEFAULT_OPTIONS.rightPanel, + ...options?.rightPanel || {} + } + }; + if (corePreferences) { + corePreferences.onPreferenceChanged(preference => { + if (preference.preferenceName === 'window.menuBarVisibility') { + this.handleMenuBarVisibility(corePreferences['window.menuBarVisibility']); + } + }); + } + } + + @postConstruct() + protected init(): void { + this.initializeShell(); + this.initSidebarVisibleKeyContext(); + this.initFocusKeyContexts(); + + if (!environment.electron.is()) { + this.corePreferences.ready.then(() => { + this.setTopPanelVisibility(this.corePreferences['window.menuBarVisibility']); + }); + this.corePreferences.onPreferenceChanged(preference => { + if (preference.preferenceName === 'window.menuBarVisibility') { + this.setTopPanelVisibility(this.corePreferences['window.menuBarVisibility']); + } + }); + } + + this.corePreferences.onPreferenceChanged(preference => { + if (preference.preferenceName === 'window.tabbar.enhancedPreview') { + this.allTabBars.forEach(tabBar => { + tabBar.update(); + }); + } + }); + this.initializedDeferred.resolve(); + + // Close unwanted left sidebar widgets whenever they are added, + // regardless of which package adds them or when. + const hiddenLeftWidgets = new Set([ + 'scm-view-container', + 'debug', + 'vsx-extensions-view-container', + 'test-view-container', + ]); + this.leftPanelHandler.dockPanel.widgetAdded.connect((_, widget) => { + if (hiddenLeftWidgets.has(widget.id)) { + // Defer one frame so Lumino finishes wiring the widget before we close it + requestAnimationFrame(() => widget.close()); + } + }); + + // Apply Code mode layout on startup (Product OS default) + this.initialized.then(() => { + setTimeout(() => { + this.switchMode('code'); + }, 100); + }); + } + + protected initializeShell(): void { + this.addClass(APPLICATION_SHELL_CLASS); + this.addClass('monaco-workbench'); // needed for compatility with VSCode styles + this.id = 'theia-app-shell'; + + this.mainPanel = this.createMainPanel(); + this.topPanel = this.createTopPanel(); + this.bottomPanel = this.createBottomPanel(); + + this.leftPanelHandler = this.sidePanelHandlerFactory(); + this.leftPanelHandler.create('left', this.options.leftPanel); + this.leftPanelHandler.dockPanel.widgetAdded.connect((_, widget) => this.fireDidAddWidget(widget)); + this.leftPanelHandler.dockPanel.widgetRemoved.connect((_, widget) => this.fireDidRemoveWidget(widget)); + + this.rightPanelHandler = this.sidePanelHandlerFactory(); + this.rightPanelHandler.create('right', this.options.rightPanel); + this.rightPanelHandler.dockPanel.widgetAdded.connect((_, widget) => this.fireDidAddWidget(widget)); + this.rightPanelHandler.dockPanel.widgetRemoved.connect((_, widget) => this.fireDidRemoveWidget(widget)); + + this.secondaryWindowHandler.init(this, this.dockPanelRendererFactory); + this.secondaryWindowHandler.onDidAddWidget(([widget, window]) => this.fireDidAddWidget(widget)); + this.secondaryWindowHandler.onDidRemoveWidget(([widget, window]) => this.fireDidRemoveWidget(widget)); + + this.layout = this.createLayout(); + + this.tracker.currentChanged.connect(this.onCurrentChanged, this); + this.tracker.activeChanged.connect(this.onActiveChanged, this); + } + + protected initSidebarVisibleKeyContext(): void { + const leftSideBarPanel = this.leftPanelHandler.dockPanel; + const sidebarVisibleKey = this.contextKeyService.createKey('sidebarVisible', leftSideBarPanel.isVisible); + const onAfterShow = leftSideBarPanel['onAfterShow'].bind(leftSideBarPanel); + leftSideBarPanel['onAfterShow'] = (msg: Message) => { + onAfterShow(msg); + sidebarVisibleKey.set(true); + }; + const onAfterHide = leftSideBarPanel['onAfterHide'].bind(leftSideBarPanel); + leftSideBarPanel['onAfterHide'] = (msg: Message) => { + onAfterHide(msg); + sidebarVisibleKey.set(false); + }; + } + + protected initFocusKeyContexts(): void { + const sideBarFocus = this.contextKeyService.createKey('sideBarFocus', false); + const panelFocus = this.contextKeyService.createKey('panelFocus', false); + const updateFocusContextKeys = () => { + const area = this.activeWidget && this.getAreaFor(this.activeWidget); + sideBarFocus.set(area === 'left'); + panelFocus.set(area === 'main'); + }; + updateFocusContextKeys(); + this.onDidChangeActiveWidget(updateFocusContextKeys); + } + + protected setTopPanelVisibility(preference: string): void { + const hiddenPreferences = ['compact', 'hidden']; + this.topPanel.setHidden(hiddenPreferences.includes(preference)); + } + + protected override onBeforeAttach(msg: Message): void { + document.addEventListener('lm-dragenter', this, true); + document.addEventListener('lm-dragover', this, true); + document.addEventListener('lm-dragleave', this, true); + document.addEventListener('lm-drop', this, true); + } + + protected override onAfterDetach(msg: Message): void { + document.removeEventListener('lm-dragenter', this, true); + document.removeEventListener('lm-dragover', this, true); + document.removeEventListener('lm-dragleave', this, true); + document.removeEventListener('lm-drop', this, true); + } + + handleEvent(event: Event): void { + switch (event.type) { + case 'lm-dragenter': + this.onDragEnter(event as Drag.Event); + break; + case 'lm-dragover': + this.onDragOver(event as Drag.Event); + break; + case 'lm-drop': + this.onDrop(event as Drag.Event); + break; + case 'lm-dragleave': + this.onDragLeave(event as Drag.Event); + break; + } + } + + protected onDragEnter({ mimeData }: Drag.Event): void { + if (!this.dragState) { + if (mimeData && mimeData.hasData('application/vnd.lumino.widget-factory')) { + // The drag contains a widget, so we'll track it and expand side panels as needed + this.dragState = { + startTime: performance.now(), + leftExpanded: false, + rightExpanded: false, + bottomExpanded: false + }; + } + } + } + + protected onDragOver(event: Drag.Event): void { + const state = this.dragState; + if (state) { + state.lastDragOver = event; + if (state.leaveTimeout) { + window.clearTimeout(state.leaveTimeout); + state.leaveTimeout = undefined; + } + const { clientX, clientY } = event; + const { offsetLeft, offsetTop, clientWidth, clientHeight } = this.node; + + // Don't expand any side panels right after the drag has started + const allowExpansion = performance.now() - state.startTime >= 500; + const expLeft = allowExpansion && clientX >= offsetLeft + && clientX <= offsetLeft + this.options.leftPanel.expandThreshold; + const expRight = allowExpansion && clientX <= offsetLeft + clientWidth + && clientX >= offsetLeft + clientWidth - this.options.rightPanel.expandThreshold; + const expBottom = allowExpansion && !expLeft && !expRight && clientY <= offsetTop + clientHeight + && clientY >= offsetTop + clientHeight - this.options.bottomPanel.expandThreshold; + // eslint-disable-next-line no-null/no-null + if (expLeft && !state.leftExpanded && this.leftPanelHandler.tabBar.currentTitle === null) { + // The mouse cursor is moved close to the left border + this.leftPanelHandler.expand(); + this.leftPanelHandler.state.pendingUpdate.then(() => this.dispatchMouseMove()); + state.leftExpanded = true; + } else if (!expLeft && state.leftExpanded) { + // The mouse cursor is moved away from the left border + this.leftPanelHandler.collapse(); + state.leftExpanded = false; + } + // eslint-disable-next-line no-null/no-null + if (expRight && !state.rightExpanded && this.rightPanelHandler.tabBar.currentTitle === null) { + // The mouse cursor is moved close to the right border + this.rightPanelHandler.expand(); + this.rightPanelHandler.state.pendingUpdate.then(() => this.dispatchMouseMove()); + state.rightExpanded = true; + } else if (!expRight && state.rightExpanded) { + // The mouse cursor is moved away from the right border + this.rightPanelHandler.collapse(); + state.rightExpanded = false; + } + if (expBottom && !state.bottomExpanded && this.bottomPanel.isHidden) { + // The mouse cursor is moved close to the bottom border + this.expandBottomPanel(); + this.bottomPanelState.pendingUpdate.then(() => this.dispatchMouseMove()); + state.bottomExpanded = true; + } else if (!expBottom && state.bottomExpanded) { + // The mouse cursor is moved away from the bottom border + this.collapseBottomPanel(); + state.bottomExpanded = false; + } + } + } + + /** + * This method is called after a side panel has been expanded while dragging a widget. It fires + * a `mousemove` event so that the drag overlay markers are updated correctly in all dock panels. + */ + private dispatchMouseMove(): void { + if (this.dragState && this.dragState.lastDragOver) { + const { clientX, clientY } = this.dragState.lastDragOver; + const event = document.createEvent('MouseEvent'); + event.initMouseEvent('mousemove', true, true, window, 0, 0, 0, + // eslint-disable-next-line no-null/no-null + clientX, clientY, false, false, false, false, 0, null); + document.dispatchEvent(event); + } + } + + protected onDrop(event: Drag.Event): void { + const state = this.dragState; + if (state) { + if (state.leaveTimeout) { + window.clearTimeout(state.leaveTimeout); + } + this.dragState = undefined; + window.requestAnimationFrame(() => { + // Clean up the side panel state in the next frame + if (this.leftPanelHandler.dockPanel.isEmpty) { + this.leftPanelHandler.collapse(); + } + if (this.rightPanelHandler.dockPanel.isEmpty) { + this.rightPanelHandler.collapse(); + } + if (this.bottomPanel.isEmpty) { + this.collapseBottomPanel(); + } + }); + } + } + + protected onDragLeave(event: Drag.Event): void { + const state = this.dragState; + if (state) { + state.lastDragOver = undefined; + if (state.leaveTimeout) { + window.clearTimeout(state.leaveTimeout); + } + state.leaveTimeout = window.setTimeout(() => { + this.dragState = undefined; + if (state.leftExpanded || this.leftPanelHandler.dockPanel.isEmpty) { + this.leftPanelHandler.collapse(); + } + if (state.rightExpanded || this.rightPanelHandler.dockPanel.isEmpty) { + this.rightPanelHandler.collapse(); + } + if (state.bottomExpanded || this.bottomPanel.isEmpty) { + this.collapseBottomPanel(); + } + }, 100); + } + } + + /** + * Create the dock panel in the main shell area. + */ + protected createMainPanel(): TheiaDockPanel { + const renderer = this.dockPanelRendererFactory(); + renderer.tabBarClasses.push(MAIN_BOTTOM_AREA_CLASS); + renderer.tabBarClasses.push(MAIN_AREA_CLASS); + this._mainPanelRenderer = renderer; + const dockPanel = this.dockPanelFactory({ + mode: 'multiple-document', + renderer, + spacing: 0 + }, area => this.doToggleMaximized(area)); + dockPanel.id = MAIN_AREA_ID; + dockPanel.widgetAdded.connect((_, widget) => this.fireDidAddWidget(widget)); + dockPanel.widgetRemoved.connect((_, widget) => this.fireDidRemoveWidget(widget)); + + const openUri = async (fileUri: URI) => { + try { + const opener = await this.openerService.getOpener(fileUri); + opener.open(fileUri); + } catch (e) { + console.info(`no opener found for '${fileUri}'`); + } + }; + + dockPanel.node.addEventListener('drop', event => { + if (event.dataTransfer) { + const uris = this.additionalDraggedUris || ApplicationShell.getDraggedEditorUris(event.dataTransfer); + if (uris.length > 0) { + uris.forEach(openUri); + } else if (event.dataTransfer.files?.length > 0) { + // the files were dragged from the outside the workspace + Array.from(event.dataTransfer.files).forEach(async file => { + if (environment.electron.is()) { + const path = window.electronTheiaCore.getPathForFile(file); + if (path) { + const fileUri = URI.fromFilePath(path); + openUri(fileUri); + } + } else { + const fileContent = await file.text(); + const fileName = file.name; + const uri = new URI(`${UNTITLED_SCHEME}:/${fileName}`); + // Only create a new untitled resource if it doesn't already exist. + // VS Code does the same thing, and there's not really a better solution, + // since we want to keep the original name of the file, + // but also to prevent duplicates of the same file. + if (!this.untitledResourceResolver.has(uri)) { + const untitledResource = await this.untitledResourceResolver.createUntitledResource( + fileContent, + undefined, + new URI(`${UNTITLED_SCHEME}:/${fileName}`) + ); + openUri(untitledResource.uri); + } + } + }); + } + } + }); + + dockPanel.node.addEventListener('dblclick', event => { + const el = event.target as Element; + if (el.id === MAIN_AREA_ID || el.classList.contains('lm-TabBar-content')) { + this.onDidDoubleClickMainAreaEmitter.fire(); + } + }); + + const handler = (e: DragEvent) => { + if (e.dataTransfer) { + e.dataTransfer.dropEffect = 'link'; + e.preventDefault(); + e.stopPropagation(); + } + }; + dockPanel.node.addEventListener('dragover', handler); + dockPanel.node.addEventListener('dragenter', handler); + + return dockPanel; + } + + addAdditionalDraggedEditorUris(uris: URI[]): void { + this.additionalDraggedUris = uris; + } + + clearAdditionalDraggedEditorUris(): void { + this.additionalDraggedUris = undefined; + } + + static getDraggedEditorUris(dataTransfer: DataTransfer): URI[] { + const data = dataTransfer.getData('theia-editor-dnd'); + return data ? data.split('\n').map(entry => new URI(entry)) : []; + } + + static setDraggedEditorUris(dataTransfer: DataTransfer, uris: URI[]): void { + dataTransfer.setData('theia-editor-dnd', uris.map(uri => uri.toString()).join('\n')); + } + + /** + * Create the dock panel in the bottom shell area. + */ + protected createBottomPanel(): TheiaDockPanel { + const renderer = this.dockPanelRendererFactory(); + renderer.tabBarClasses.push(MAIN_BOTTOM_AREA_CLASS); + renderer.tabBarClasses.push(BOTTOM_AREA_CLASS); + const dockPanel = this.dockPanelFactory({ + mode: 'multiple-document', + renderer, + spacing: 0 + }, area => this.doToggleMaximized(area)); + dockPanel.id = BOTTOM_AREA_ID; + dockPanel.widgetAdded.connect((sender, widget) => { + this.refreshBottomPanelToggleButton(); + }); + dockPanel.widgetRemoved.connect((sender, widget) => { + if (sender.isEmpty) { + this.collapseBottomPanel(); + } + this.refreshBottomPanelToggleButton(); + }, this); + dockPanel.node.addEventListener('lm-dragenter', event => { + // Make sure that the main panel hides its overlay when the bottom panel is expanded + this.mainPanel.overlay.hide(0); + }); + dockPanel.hide(); + dockPanel.widgetAdded.connect((_, widget) => this.fireDidAddWidget(widget)); + dockPanel.widgetRemoved.connect((_, widget) => this.fireDidRemoveWidget(widget)); + return dockPanel; + } + + /** + * Create the top panel, which is used to hold the main menu. + */ + protected createTopPanel(): Panel { + const topPanel = new Panel(); + topPanel.id = 'theia-top-panel'; + topPanel.addClass('product-os-navbar'); + + // Create custom navigation bar + const navBar = new Widget(); + navBar.id = 'product-os-nav-bar'; + navBar.addClass('product-os-nav-content'); + navBar.node.innerHTML = ` +
    +
    Product OS
    + +
    + `; + + topPanel.addWidget(navBar); + + // Add mode switching click handlers + this.setupModeSwitch(navBar); + + // topPanel.hide(); // REMOVED - now visible! + return topPanel; + } + + /** + * Current Product OS mode + */ + private currentMode: 'code' | 'design' | 'content' | 'hosting' | 'analytics' | 'progress' = 'code'; + + /** + * Setup mode switching functionality + */ + protected setupModeSwitch(navBar: Widget): void { + const links = navBar.node.querySelectorAll('.product-os-nav-link'); + links.forEach(link => { + link.addEventListener('click', (e: Event) => { + e.preventDefault(); + const mode = (link as HTMLElement).getAttribute('data-mode') as 'code' | 'design' | 'content' | 'hosting' | 'analytics' | 'progress'; + if (mode && mode !== this.currentMode) { + this.switchMode(mode); + // Update active link styling + links.forEach(l => l.classList.remove('active')); + link.classList.add('active'); + } + }); + }); + } + + /** + * Switch between different Product OS modes (Code, Design, Content, Hosting, Analytics, Progress) + */ + protected switchMode(mode: 'code' | 'design' | 'content' | 'hosting' | 'analytics' | 'progress'): void { + console.log(`Switching to ${mode} mode`); + this.currentMode = mode; + + // This is where we'll configure different layouts for each mode + switch (mode) { + case 'code': + this.applyCodeLayout(); + break; + case 'design': + this.applyDesignLayout(); + break; + case 'content': + this.applyContentLayout(); + break; + case 'hosting': + this.applyHostingLayout(); + break; + case 'analytics': + this.applyAnalyticsLayout(); + break; + case 'progress': + this.applyProgressLayout(); + break; + } + } + + /** + * Apply Code mode layout (Product OS code navigation) + */ + protected applyCodeLayout(): void { + // Always show right panel with AI Chat + this.rightPanelHandler.state.expansion = SidePanel.ExpansionState.expanded; + + const aiChatWidget = this.getWidgets('right').find(w => w.id === 'chat-view'); + if (aiChatWidget) { + this.activateWidget(aiChatWidget.id); + } + + // Remove left sidebar views that are not needed + const toRemove = ['scm-view-container', 'debug', 'vsx-extensions-view-container', 'test-view-container']; + toRemove.forEach(id => { + const widget = this.getWidgets('left').find(w => w.id === id); + if (widget) { + widget.close(); + } + }); + } + + /** + * Apply Design mode layout (v0 fork integration) + */ + protected applyDesignLayout(): void { + console.log('Applied Design layout'); + // TODO: Left panel sections: + // - App pages + // - Website pages + // - Article pages + // - Social posts + // - Docs + } + + /** + * Apply Content mode layout (content management) + */ + protected applyContentLayout(): void { + console.log('Applied Content layout'); + // TODO: Left panel sections: + // - Articles + // - Posts + // - Emails + // - Videos + } + + /** + * Apply Hosting mode layout (Coolify integration - simplified Firebase) + */ + protected applyHostingLayout(): void { + console.log('Applied Hosting layout'); + // TODO: Coolify-based hosting interface + } + + /** + * Apply Analytics mode layout (BigQuery powered) + */ + protected applyAnalyticsLayout(): void { + console.log('Applied Analytics layout'); + // TODO: BigQuery framework integration + } + + /** + * Apply Progress mode layout (complete history tracking) + */ + protected applyProgressLayout(): void { + console.log('Applied Progress layout'); + // TODO: Custom tracking tool - stores progress, updates docs, complete history + } + + /** + * Create a box layout to assemble the application shell layout. + */ + protected createBoxLayout(widgets: Widget[], stretch?: number[], options?: BoxPanel.IOptions): BoxLayout { + const boxLayout = new BoxLayout(options); + for (let i = 0; i < widgets.length; i++) { + if (stretch !== undefined && i < stretch.length) { + BoxPanel.setStretch(widgets[i], stretch[i]); + } + boxLayout.addWidget(widgets[i]); + } + return boxLayout; + } + + /** + * Create a split layout to assemble the application shell layout. + */ + protected createSplitLayout(widgets: Widget[], stretch?: number[], options?: Partial): SplitLayout { + let optParam: SplitLayout.IOptions = { renderer: SplitPanel.defaultRenderer, }; + if (options) { + optParam = { ...optParam, ...options }; + } + const splitLayout = new SplitLayout(optParam); + for (let i = 0; i < widgets.length; i++) { + if (stretch !== undefined && i < stretch.length) { + SplitPanel.setStretch(widgets[i], stretch[i]); + } + splitLayout.addWidget(widgets[i]); + } + return splitLayout; + } + + /** + * Assemble the application shell layout. Override this method in order to change the arrangement + * of the main area and the side panels. + */ + protected createLayout(): Layout { + const bottomSplitLayout = this.createSplitLayout( + [this.mainPanel, this.bottomPanel], + [1, 0], + { orientation: 'vertical', spacing: 0 } + ); + const panelForBottomArea = new TheiaSplitPanel({ layout: bottomSplitLayout }); + panelForBottomArea.id = 'theia-bottom-split-panel'; + + const leftRightSplitLayout = this.createSplitLayout( + [this.leftPanelHandler.container, panelForBottomArea, this.rightPanelHandler.container], + [0, 1, 0], + { orientation: 'horizontal', spacing: 0 } + ); + const panelForSideAreas = new TheiaSplitPanel({ layout: leftRightSplitLayout }); + panelForSideAreas.id = 'theia-left-right-split-panel'; + + return this.createBoxLayout( + [this.topPanel, panelForSideAreas, this.statusBar], + [0, 1, 0], + { direction: 'top-to-bottom', spacing: 0 } + ); + } + + /** + * Create an object that describes the current shell layout. This object may contain references + * to widgets; these need to be transformed before the layout can be serialized. + */ + getLayoutData(): ApplicationShell.LayoutData { + return { + version: applicationShellLayoutVersion, + mainPanel: this.mainPanel.saveLayout(), + mainPanelPinned: this.getPinnedMainWidgets(), + bottomPanel: { + config: this.bottomPanel.saveLayout(), + pinned: this.getPinnedBottomWidgets(), + size: this.bottomPanel.isVisible ? this.getBottomPanelSize() : this.bottomPanelState.lastPanelSize, + expanded: this.isExpanded('bottom') + }, + leftPanel: this.leftPanelHandler.getLayoutData(), + rightPanel: this.rightPanelHandler.getLayoutData(), + activeWidgetId: this.activeWidget ? this.activeWidget.id : undefined + }; + } + + // Get an array corresponding to main panel widgets' pinned state. + getPinnedMainWidgets(): boolean[] { + const pinned: boolean[] = []; + + toArray(this.mainPanel.widgets()).forEach((a, i) => { + pinned[i] = a.title.className.includes(PINNED_CLASS); + }); + + return pinned; + } + + // Get an array corresponding to bottom panel widgets' pinned state. + getPinnedBottomWidgets(): boolean[] { + const pinned: boolean[] = []; + + toArray(this.bottomPanel.widgets()).forEach((a, i) => { + pinned[i] = a.title.className.includes(PINNED_CLASS); + }); + + return pinned; + } + + /** + * Compute the current height of the bottom panel. This implementation assumes that the container + * of the bottom panel is a `SplitPanel`. + */ + protected getBottomPanelSize(): number | undefined { + const parent = this.bottomPanel.parent; + if (parent instanceof SplitPanel && parent.isVisible) { + const index = parent.widgets.indexOf(this.bottomPanel) - 1; + if (index >= 0) { + const handle = parent.handles[index]; + if (!handle.classList.contains('lm-mod-hidden')) { + const parentHeight = parent.node.clientHeight; + return parentHeight - handle.offsetTop; + } + } + } + } + + /** + * Determine the default size to apply when the bottom panel is expanded for the first time. + */ + protected getDefaultBottomPanelSize(): number | undefined { + const parent = this.bottomPanel.parent; + if (parent && parent.isVisible) { + return parent.node.clientHeight * this.options.bottomPanel.initialSizeRatio; + } + } + + /** + * Apply a shell layout that has been previously created with `getLayoutData`. + */ + async setLayoutData(layoutData: ApplicationShell.LayoutData): Promise { + const { mainPanel, mainPanelPinned, bottomPanel, leftPanel, rightPanel, activeWidgetId } = layoutData; + if (leftPanel) { + this.leftPanelHandler.setLayoutData(leftPanel); + this.registerWithFocusTracker(leftPanel); + } + if (rightPanel) { + this.rightPanelHandler.setLayoutData(rightPanel); + this.registerWithFocusTracker(rightPanel); + } + // Proceed with the bottom panel once the side panels are set up + await Promise.all([this.leftPanelHandler.state.pendingUpdate, this.rightPanelHandler.state.pendingUpdate]); + if (bottomPanel) { + if (bottomPanel.config) { + this.bottomPanel.restoreLayout(bottomPanel.config); + this.registerWithFocusTracker(bottomPanel.config.main); + } + if (bottomPanel.size) { + this.bottomPanelState.lastPanelSize = bottomPanel.size; + } + if (bottomPanel.expanded) { + this.expandBottomPanel(); + } else { + this.collapseBottomPanel(); + } + const widgets = toArray(this.bottomPanel.widgets()); + this.bottomPanel.markActiveTabBar(widgets[0]?.title); + if (bottomPanel.pinned && bottomPanel.pinned.length === widgets.length) { + widgets.forEach((a, i) => { + if (bottomPanel.pinned![i]) { + a.title.className += ` ${PINNED_CLASS}`; + a.title.closable = false; + } + }); + } + this.refreshBottomPanelToggleButton(); + } + // Proceed with the main panel once all others are set up + await this.bottomPanelState.pendingUpdate; + if (mainPanel) { + this.mainPanel.restoreLayout(mainPanel); + this.registerWithFocusTracker(mainPanel.main); + const widgets = toArray(this.mainPanel.widgets()); + // We don't store information about the last active tabbar + // So we simply mark the first as being active + this.mainPanel.markActiveTabBar(widgets[0]?.title); + if (mainPanelPinned && mainPanelPinned.length === widgets.length) { + widgets.forEach((a, i) => { + if (mainPanelPinned[i]) { + a.title.className += ` ${PINNED_CLASS}`; + a.title.closable = false; + } + }); + } + } + if (activeWidgetId) { + this.activateWidget(activeWidgetId); + } + } + + /** + * Modify the height of the bottom panel. This implementation assumes that the container of the + * bottom panel is a `SplitPanel`. + */ + protected setBottomPanelSize(size: number): Promise { + const enableAnimation = this.applicationStateService.state === 'ready'; + const options: SplitPositionOptions = { + side: 'bottom', + duration: enableAnimation ? this.options.bottomPanel.expandDuration : 0, + referenceWidget: this.bottomPanel + }; + const promise = this.splitPositionHandler.setSidePanelSize(this.bottomPanel, size, options); + const result = new Promise(resolve => { + // Resolve the resulting promise in any case, regardless of whether resizing was successful + promise.then(() => resolve(), () => resolve()); + }); + this.bottomPanelState.pendingUpdate = this.bottomPanelState.pendingUpdate.then(() => result); + return result; + } + + /** + * A promise that is resolved when all currently pending updates are done. + */ + get pendingUpdates(): Promise { + return Promise.all([ + this.bottomPanelState.pendingUpdate, + this.leftPanelHandler.state.pendingUpdate, + this.rightPanelHandler.state.pendingUpdate + // eslint-disable-next-line @typescript-eslint/no-explicit-any + ]) as Promise; + } + + /** + * Track all widgets that are referenced by the given layout data. + */ + protected registerWithFocusTracker(data: DockLayout.ITabAreaConfig | DockLayout.ISplitAreaConfig | SidePanel.LayoutData | null): void { + if (data) { + if (data.type === 'tab-area') { + for (const widget of data.widgets) { + if (widget) { + this.track(widget); + } + } + } else if (data.type === 'split-area') { + for (const child of data.children) { + this.registerWithFocusTracker(child); + } + } else if (data.type === 'sidepanel' && data.items) { + for (const item of data.items) { + if (item.widget) { + this.track(item.widget); + } + } + } + } + } + + /** + * Add a widget to the application shell. The given widget must have a unique `id` property, + * which will be used as the DOM id. + * + * Widgets are removed from the shell by calling their `close` or `dispose` methods. + * + * Widgets added to the top area are not tracked regarding the _current_ and _active_ states. + */ + async addWidget(widget: Widget, options?: Readonly): Promise { + if (!widget.id) { + console.error('Widgets added to the application shell must have a unique id property.'); + return; + } + const { area, addOptions } = this.getInsertionOptions(options); + const sidePanelOptions: SidePanel.WidgetOptions = { rank: options?.rank }; + switch (area) { + case 'main': + this.mainPanel.addWidget(widget, addOptions); + break; + case 'top': + this.topPanel.addWidget(widget); + break; + case 'bottom': + this.bottomPanel.addWidget(widget, addOptions); + break; + case 'left': + this.leftPanelHandler.addWidget(widget, sidePanelOptions); + break; + case 'right': + this.rightPanelHandler.addWidget(widget, sidePanelOptions); + break; + case 'secondaryWindow': + const secondaryWindow = extractSecondaryWindow(addOptions.ref); + if (secondaryWindow) { + this.secondaryWindowHandler.addWidgetToSecondaryWindow(widget, secondaryWindow, addOptions); + } else { + // Fall back to adding widgets to the main area. This is preferred to throwing an error, because toolbar actions on secondary windows/commands + // may e.g. open further editors, e.g. a markdown preview. + this.mainPanel.addWidget(widget, { + ...addOptions, + ref: undefined + }); + } + + break; + default: + throw new Error('Unexpected area: ' + options?.area); + } + if (area !== 'top') { + this.track(widget); + } + } + + getInsertionOptions(options?: Readonly): { area: string; addOptions: TheiaDockPanel.AddOptions; } { + let ref: Widget | undefined = options?.ref; + let area: ApplicationShell.Area = options?.area || 'main'; + if (!ref && (area === 'main' || area === 'bottom')) { + const tabBar = this.getTabBarFor(area); + ref = tabBar && tabBar.currentTitle && tabBar.currentTitle.owner || undefined; + } + // make sure that ref belongs to area + area = ref && this.getAreaFor(ref) || area; + const addOptions: TheiaDockPanel.AddOptions = {}; + if (ApplicationShell.isOpenToSideMode(options?.mode)) { + const areaPanel = area === 'main' ? this.mainPanel : area === 'bottom' ? this.bottomPanel : undefined; + const sideRef = areaPanel && ref && (options?.mode === 'open-to-left' ? + areaPanel.previousTabBarWidget(ref) : + areaPanel.nextTabBarWidget(ref)); + if (sideRef) { + addOptions.ref = sideRef; + } else { + addOptions.ref = ref; + addOptions.mode = options?.mode === 'open-to-left' ? 'split-left' : 'split-right'; + } + } else if (ApplicationShell.isReplaceMode(options?.mode)) { + addOptions.ref = options?.ref; + addOptions.closeRef = true; + addOptions.mode = 'tab-after'; + } else { + addOptions.ref = ref; + addOptions.mode = options?.mode; + } + return { area, addOptions }; + } + + /** + * The widgets contained in the given shell area. + */ + getWidgets(area: ApplicationShell.Area): Widget[] { + switch (area) { + case 'main': + return toArray(this.mainPanel.widgets()); + case 'top': + return toArray(this.topPanel.widgets); + case 'bottom': + return toArray(this.bottomPanel.widgets()); + case 'left': + return toArray(this.leftPanelHandler.dockPanel.widgets()); + case 'right': + return toArray(this.rightPanelHandler.dockPanel.widgets()); + case 'secondaryWindow': + return toArray(this.secondaryWindowHandler.widgets); + default: + throw new Error('Illegal argument: ' + area); + } + } + + /** + * Find the widget that contains the given HTML element. The returned widget may be one + * that is managed by the application shell, or one that is embedded in another widget and + * not directly managed by the shell, or a tab bar. + */ + findWidgetForElement(element: HTMLElement): Widget | undefined { + let widgetNode: HTMLElement | null = element; + while (widgetNode && !widgetNode.classList.contains('lm-Widget')) { + widgetNode = widgetNode.parentElement; + } + if (widgetNode) { + return this.findWidgetForNode(widgetNode, this); + } + return undefined; + } + + private findWidgetForNode(widgetNode: HTMLElement, widget: Widget): Widget | undefined { + if (widget.node === widgetNode) { + return widget; + } + let result: Widget | undefined; + each(widget.children(), child => { + result = this.findWidgetForNode(widgetNode, child); + return !result; + }); + return result; + } + + /** + * Finds the title widget from the tab-bar. + * @param tabBar used for providing an array of titles. + * @returns the selected title widget, else returns the currentTitle or undefined. + */ + findTitle(tabBar: TabBar, event?: Event): Title | undefined { + if (event?.target instanceof HTMLElement) { + const tabNode = event.target; + + const titleIndex = Array.from(tabBar.contentNode.getElementsByClassName('lm-TabBar-tab')) + .findIndex(node => node.contains(tabNode)); + + if (titleIndex !== -1) { + return tabBar.titles[titleIndex]; + } + + } + return tabBar.currentTitle || undefined; + } + + /** + * Finds the tab-bar widget. + * @returns the selected tab-bar, else returns the currentTabBar. + */ + findTabBar(event?: Event): TabBar | undefined { + if (event?.target instanceof HTMLElement) { + const tabBar = this.findWidgetForElement(event.target); + if (tabBar instanceof TabBar) { + return tabBar; + } + } + return this.currentTabBar; + } + + /** + * @returns the widget whose title has been targeted by a DOM event on a tabbar, or undefined if none can be found. + */ + findTargetedWidget(event?: Event): Widget | undefined { + if (event) { + const tab = this.findTabBar(event); + const title = tab && this.findTitle(tab, event); + return title && title.owner; + } + } + + /** + * The current widget in the application shell. The current widget is the last widget that + * was active and not yet closed. See the remarks to `activeWidget` on what _active_ means. + */ + get currentWidget(): Widget | undefined { + return this.tracker.currentWidget || undefined; + } + + /** + * The active widget in the application shell. The active widget is the one that has focus + * (either the widget itself or any of its contents). + * + * _Note:_ Focus is taken by a widget through the `onActivateRequest` method. It is up to the + * widget implementation which DOM element will get the focus. The default implementation + * does not take any focus; in that case the widget is never returned by this property. + */ + get activeWidget(): Widget | undefined { + return this.tracker.activeWidget || undefined; + } + + /** + * Returns the last active widget in the given shell area. + */ + getCurrentWidget(area: ApplicationShell.Area): Widget | undefined { + let title: Title | null | undefined; + switch (area) { + case 'main': + title = this.mainPanel.currentTitle; + break; + case 'bottom': + title = this.bottomPanel.currentTitle; + break; + case 'left': + title = this.leftPanelHandler.tabBar.currentTitle; + break; + case 'right': + title = this.rightPanelHandler.tabBar.currentTitle; + break; + case 'secondaryWindow': + // The current widget in a secondary window is not tracked. + return undefined; + default: + throw new Error('Illegal argument: ' + area); + } + return title ? title.owner : undefined; + } + + /** + * Handle a change to the current widget. + */ + private onCurrentChanged(sender: FocusTracker, args: FocusTracker.IChangedArgs): void { + this.onDidChangeCurrentWidgetEmitter.fire(args); + } + + protected readonly toDisposeOnActiveChanged = new DisposableCollection(); + + /** + * Handle a change to the active widget. + */ + private onActiveChanged(sender: FocusTracker, args: FocusTracker.IChangedArgs): void { + this.toDisposeOnActiveChanged.dispose(); + const { newValue, oldValue } = args; + if (oldValue) { + let w: Widget | null = oldValue; + while (w) { + // Remove the mark of the previously active widget + w.title.className = w.title.className.replace(' theia-mod-active', ''); + w = w.parent; + } + } + if (newValue) { + let w: Widget | null = newValue; + while (w) { + // Mark the tab of the active widget + w.title.className += ' theia-mod-active'; + w = w.parent; + } + // Reveal the title of the active widget in its tab bar + const tabBar = this.getTabBarFor(newValue); + if (tabBar instanceof ScrollableTabBar) { + const index = tabBar.titles.indexOf(newValue.title); + if (index >= 0) { + tabBar.revealTab(index); + } + } + const widget = this.toTrackedStack(newValue.id).pop(); + const panel = this.findPanel(widget); + if (panel) { + // if widget was undefined, we wouldn't have gotten a panel back before + panel.markAsCurrent(widget!.title); + } + + // activate another widget if an active widget will be closed + const onCloseRequest = newValue['onCloseRequest']; + newValue['onCloseRequest'] = msg => { + const currentTabBar = this.currentTabBar; + if (currentTabBar) { + const recentlyUsedInTabBar = currentTabBar['_previousTitle'] as TabBar['currentTitle']; + if (recentlyUsedInTabBar && recentlyUsedInTabBar.owner !== newValue) { + currentTabBar.currentIndex = ArrayExt.firstIndexOf(currentTabBar.titles, recentlyUsedInTabBar); + if (currentTabBar.currentTitle) { + this.activateWidget(currentTabBar.currentTitle.owner.id); + } + } else if (!this.activateNextTabInTabBar(currentTabBar)) { + if (!this.activatePreviousTabBar(currentTabBar)) { + this.activateNextTabBar(currentTabBar); + } + } + } + newValue['onCloseRequest'] = onCloseRequest; + newValue['onCloseRequest'](msg); + }; + this.toDisposeOnActiveChanged.push(Disposable.create(() => newValue['onCloseRequest'] = onCloseRequest)); + if (PreviewableWidget.is(newValue)) { + newValue.loaded = true; + } + } + this.onDidChangeActiveWidgetEmitter.fire(args); + } + + /** + * Track the given widget so it is considered in the `current` and `active` state of the shell. + */ + protected track(widget: Widget): void { + if (this.tracker.widgets.indexOf(widget) !== -1) { + return; + } + this.tracker.add(widget); + this.checkActivation(widget); + if (ApplicationShell.TrackableWidgetProvider.is(widget)) { + for (const toTrack of widget.getTrackableWidgets()) { + this.track(toTrack); + } + if (widget.onDidChangeTrackableWidgets) { + widget.onDidChangeTrackableWidgets(widgets => widgets.forEach(w => this.track(w))); + } + } + } + + /** + * @returns an array of Widgets, all of which are tracked by the focus tracker + * The first member of the array is the widget whose id is passed in, and the other widgets + * are its tracked parents in ascending order + */ + protected toTrackedStack(id: string): Widget[] { + const tracked = new Map(this.tracker.widgets.map(w => [w.id, w] as [string, Widget])); + let current = tracked.get(id); + const stack: Widget[] = []; + while (current) { + if (tracked.has(current.id)) { + stack.push(current); + } + current = current.parent || undefined; + } + return stack; + } + + /** + * Activate a widget in the application shell. This makes the widget visible and usually + * also assigns focus to it. + * + * _Note:_ Focus is taken by a widget through the `onActivateRequest` method. It is up to the + * widget implementation which DOM element will get the focus. The default implementation + * does not take any focus. + * + * @returns the activated widget if it was found + */ + async activateWidget(id: string): Promise { + const stack = this.toTrackedStack(id); + let current = stack.pop(); + if (current && !this.doActivateWidget(current.id)) { + return undefined; + } + while (current && stack.length) { + const child = stack.pop()!; + if (ApplicationShell.TrackableWidgetProvider.is(current) && current.activateWidget) { + current = current.activateWidget(child.id); + } else { + child.activate(); + current = child; + } + } + if (!current) { + return undefined; + } + return Promise.all([ + this.waitForActivation(current.id), + waitForRevealed(current), + this.pendingUpdates + ]).then(() => current, () => undefined); + } + + waitForActivation(id: string): Promise { + if (this.activeWidget && this.activeWidget.id === id) { + return Promise.resolve(); + } + const activation = new Deferred(); + const success = this.onDidChangeActiveWidget(() => { + if (this.activeWidget && this.activeWidget.id === id) { + activation.resolve(); + } + }); + const failure = setTimeout(() => activation.reject(new Error(`Widget with id '${id}' failed to activate.`)), this.activationTimeout + 250); + return activation.promise.finally(() => { + success.dispose(); + clearTimeout(failure); + }); + } + + /** + * Activate top-level area widget. + */ + protected doActivateWidget(id: string): Widget | undefined { + let widget = find(this.mainPanel.widgets(), w => w.id === id); + if (widget) { + this.mainPanel.activateWidget(widget); + } + if (!widget) { + widget = find(this.bottomPanel.widgets(), w => w.id === id); + if (widget) { + this.expandBottomPanel(); + this.bottomPanel.activateWidget(widget); + } + } + if (!widget) { + widget = this.leftPanelHandler.activate(id); + } + + if (!widget) { + widget = this.rightPanelHandler.activate(id); + } + if (widget) { + this.focusWindowIfApplicationFocused(); + return widget; + } + return this.secondaryWindowHandler.activateWidget(id); + } + + protected focusWindowIfApplicationFocused(): void { + // If this application has focus, then on widget activation, activate the window. + // If this application does not have focus, do not routinely steal focus. + if (this.secondaryWindowHandler.getFocusedWindow()) { + this.windowService.focus(); + } + } + + /** + * Focus is taken by a widget through the `onActivateRequest` method. It is up to the + * widget implementation which DOM element will get the focus. The default implementation + * of Widget does not take any focus. This method can help finding such problems by logging + * a warning in case a widget was explicitly activated, but did not trigger a change of the + * `activeWidget` property. + */ + private checkActivation(widget: Widget): Widget { + const onActivateRequest = widget['onActivateRequest'].bind(widget); + widget['onActivateRequest'] = (msg: Message) => { + onActivateRequest(msg); + this.assertActivated(widget); + }; + return widget; + } + + private readonly activationTimeout = 2000; + private readonly toDisposeOnActivationCheck = new DisposableCollection(); + private assertActivated(widget: Widget): void { + this.toDisposeOnActivationCheck.dispose(); + + const onDispose = () => this.toDisposeOnActivationCheck.dispose(); + widget.disposed.connect(onDispose); + this.toDisposeOnActivationCheck.push(Disposable.create(() => widget.disposed.disconnect(onDispose))); + + let start = 0; + const step: FrameRequestCallback = () => { + const activeElement = widget.node.ownerDocument.activeElement; + if (activeElement && widget.node.contains(activeElement)) { + return; + } + const now = Date.now(); + if (!start) { + start = now; + } + const delta = now - start; + if (delta < this.activationTimeout) { + request = setTimeout(step, 0); + } else { + console.warn(`Widget was activated, but did not accept focus after ${this.activationTimeout}ms: ${widget.id}`); + } + }; + let request = setTimeout(step, 0); + this.toDisposeOnActivationCheck.push(Disposable.create(() => window.cancelAnimationFrame(request))); + } + + /** + * Reveal a widget in the application shell. This makes the widget visible, + * but does not activate it. + * + * @returns the revealed widget if it was found + */ + async revealWidget(id: string): Promise { + const stack = this.toTrackedStack(id); + let current = stack.pop(); + if (current && !this.doRevealWidget(current.id)) { + return undefined; + } + while (current && stack.length) { + const child = stack.pop()!; + if (ApplicationShell.TrackableWidgetProvider.is(current) && current.revealWidget) { + current = current.revealWidget(child.id); + } else { + current = child; + } + } + if (!current) { + return undefined; + } + await Promise.all([ + waitForRevealed(current), + this.pendingUpdates + ]); + return current; + } + + /** + * Reveal top-level area widget. + */ + protected doRevealWidget(id: string): Widget | undefined { + let widget = find(this.mainPanel.widgets(), w => w.id === id); + if (!widget) { + widget = find(this.bottomPanel.widgets(), w => w.id === id); + if (widget) { + this.expandBottomPanel(); + } + } + if (widget) { + const tabBar = this.getTabBarFor(widget); + if (tabBar) { + tabBar.currentTitle = widget.title; + } + } + if (!widget) { + widget = this.leftPanelHandler.expand(id); + } + if (!widget) { + widget = this.rightPanelHandler.expand(id); + } + if (widget) { + this.focusWindowIfApplicationFocused(); + return widget; + } else { + return this.secondaryWindowHandler.revealWidget(id); + } + } + + /** + * Expand the named side panel area. This makes sure that the panel is visible, even if there + * are no widgets in it. If the panel is already visible, nothing happens. If the panel is currently + * collapsed (see `collapsePanel`) and it contains widgets, the widgets are revealed that were + * visible before it was collapsed. + */ + expandPanel(area: ApplicationShell.Area): void { + switch (area) { + case 'bottom': + this.expandBottomPanel(); + break; + case 'left': + this.leftPanelHandler.expand(); + break; + case 'right': + this.rightPanelHandler.expand(); + break; + default: + throw new Error('Area cannot be expanded: ' + area); + } + } + + /** + * Adjusts the size of the given area in the application shell. + * + * @param size the desired size of the panel in pixels. + * @param area the area to resize. + */ + resize(size: number, area: ApplicationShell.Area): void { + switch (area) { + case 'bottom': + if (this.bottomPanel.isHidden) { + this.bottomPanelState.lastPanelSize = size; + } else { + this.setBottomPanelSize(size); + } + break; + case 'left': + this.leftPanelHandler.resize(size); + break; + case 'right': + this.rightPanelHandler.resize(size); + break; + default: + throw new Error('Area cannot be resized: ' + area); + } + } + + /** + * Expand the bottom panel. See `expandPanel` regarding the exact behavior. + */ + protected expandBottomPanel(): void { + const bottomPanel = this.bottomPanel; + if (bottomPanel.isHidden) { + let relativeSizes: number[] | undefined; + const parent = bottomPanel.parent; + if (parent instanceof SplitPanel) { + relativeSizes = parent.relativeSizes(); + } + bottomPanel.show(); + if (relativeSizes && parent instanceof SplitPanel) { + // Make sure that the expansion animation starts at the smallest possible size + parent.setRelativeSizes(relativeSizes); + } + + let size: number | undefined; + if (bottomPanel.isEmpty) { + bottomPanel.node.style.minHeight = '0'; + size = this.options.bottomPanel.emptySize; + } else if (this.bottomPanelState.lastPanelSize) { + size = this.bottomPanelState.lastPanelSize; + } else { + size = this.getDefaultBottomPanelSize(); + } + if (size) { + this.bottomPanelState.expansion = SidePanel.ExpansionState.expanding; + this.setBottomPanelSize(size).then(() => { + if (this.bottomPanelState.expansion === SidePanel.ExpansionState.expanding) { + this.bottomPanelState.expansion = SidePanel.ExpansionState.expanded; + } + }); + } else { + this.bottomPanelState.expansion = SidePanel.ExpansionState.expanded; + } + } + } + + /** + * Collapse the named side panel area. This makes sure that the panel is hidden, + * increasing the space that is available for other shell areas. + */ + collapsePanel(area: ApplicationShell.Area): Promise { + switch (area) { + case 'bottom': + return this.collapseBottomPanel(); + case 'left': + return this.leftPanelHandler.collapse(); + case 'right': + return this.rightPanelHandler.collapse(); + default: + throw new Error('Area cannot be collapsed: ' + area); + } + } + + /** + * Collapse the bottom panel. All contained widgets are hidden, but not closed. + * They can be restored by calling `expandBottomPanel`. + */ + protected collapseBottomPanel(): Promise { + const bottomPanel = this.bottomPanel; + if (bottomPanel.isHidden) { + return Promise.resolve(); + } + if (this.bottomPanelState.expansion === SidePanel.ExpansionState.expanded) { + const size = this.getBottomPanelSize(); + if (size) { + this.bottomPanelState.lastPanelSize = size; + } + } + this.bottomPanelState.expansion = SidePanel.ExpansionState.collapsed; + bottomPanel.hide(); + return animationFrame(); + } + + /** + * Refresh the toggle button for the bottom panel. This implementation creates a status bar entry + * and refers to the command `core.toggle.bottom.panel`. + */ + protected refreshBottomPanelToggleButton(): void { + if (this.bottomPanel.isEmpty) { + this.statusBar.removeElement(BOTTOM_PANEL_TOGGLE_ID); + } else { + const label = nls.localize('theia/core/common/collapseBottomPanel', 'Toggle Bottom Panel'); + const element: StatusBarEntry = { + name: label, + text: '$(codicon-window)', + alignment: StatusBarAlignment.RIGHT, + tooltip: label, + command: 'core.toggle.bottom.panel', + accessibilityInformation: { + label: label, + role: 'button' + }, + priority: -1000 + }; + this.statusBar.setElement(BOTTOM_PANEL_TOGGLE_ID, element); + } + } + + /** + * Check whether the named side panel area is expanded (returns `true`) or collapsed (returns `false`). + */ + isExpanded(area: ApplicationShell.Area): boolean { + switch (area) { + case 'bottom': + return this.bottomPanelState.expansion === SidePanel.ExpansionState.expanded; + case 'left': + return this.leftPanelHandler.state.expansion === SidePanel.ExpansionState.expanded; + case 'right': + return this.rightPanelHandler.state.expansion === SidePanel.ExpansionState.expanded; + default: + return true; + } + } + + /** + * Close all tabs or a selection of tabs in a specific part of the application shell. + * + * @param tabBarOrArea + * Either the name of a shell area or a `TabBar` that is contained in such an area. + * @param filter + * If undefined, all tabs are closed; otherwise only those tabs that match the filter are closed. + */ + async closeTabs(tabBarOrArea: TabBar | ApplicationShell.Area, + filter?: (title: Title, index: number) => boolean): Promise { + const titles: Array> = this.getWidgetTitles(tabBarOrArea, filter); + if (titles.length) { + await this.closeMany(titles.map(title => title.owner)); + } + } + + saveTabs(tabBarOrArea: TabBar | ApplicationShell.Area, + filter?: (title: Title, index: number) => boolean): void { + + const titles = this.getWidgetTitles(tabBarOrArea, filter); + for (let i = 0; i < titles.length; i++) { + const widget = titles[i].owner; + const saveable = Saveable.get(widget); + saveable?.save(); + } + } + + /** + * Collects all widget titles for the given tab bar or area and optionally filters them. + * + * @param tabBarOrArea The tab bar or area to retrieve the widget titles for + * @param filter The filter to apply to the result + * @returns The filtered array of widget titles or an empty array + */ + protected getWidgetTitles(tabBarOrArea: TabBar | ApplicationShell.Area, + filter?: (title: Title, index: number) => boolean): Title[] { + + const titles: Title[] = []; + if (tabBarOrArea === 'main') { + this.mainAreaTabBars.forEach(tabbar => titles.push(...toArray(tabbar.titles))); + } else if (tabBarOrArea === 'bottom') { + this.bottomAreaTabBars.forEach(tabbar => titles.push(...toArray(tabbar.titles))); + } else if (tabBarOrArea === 'secondaryWindow') { + titles.push(...this.secondaryWindowHandler.widgets.map(w => w.title)); + } else if (typeof tabBarOrArea === 'string') { + const tabbar = this.getTabBarFor(tabBarOrArea); + if (tabbar) { + titles.push(...toArray(tabbar.titles)); + } + } else if (tabBarOrArea) { + titles.push(...toArray(tabBarOrArea.titles)); + } + + return filter ? titles.filter(filter) : titles; + } + + /** + * @param targets the widgets to be closed + * @return an array of all the widgets that were actually closed. + */ + async closeMany(targets: Widget[], options?: ApplicationShell.CloseOptions): Promise { + if (options?.save === false || await Saveable.confirmSaveBeforeClose(targets, this.widgets.filter(widget => !targets.includes(widget)))) { + return (await Promise.all(targets.map(target => this.closeWidget(target.id, options)))).filter((widget): widget is Widget => widget !== undefined); + } + return []; + } + + /** + * @returns the widget that was closed, if any, `undefined` otherwise. + * + * If your use case requires closing multiple widgets, use {@link ApplicationShell#closeMany} instead. That method handles closing saveable widgets more reliably. + */ + async closeWidget(id: string, options?: ApplicationShell.CloseOptions): Promise { + // TODO handle save for composite widgets, i.e. the preference widget has 2 editors + const stack = this.toTrackedStack(id); + const current = stack.pop(); + if (!current) { + return undefined; + } + const saveableOptions = options && { shouldSave: () => options.save }; + const pendingClose = SaveableWidget.is(current) + ? current.closeWithSaving(saveableOptions) + : (current.close(), waitForClosed(current)); + await Promise.all([ + pendingClose, + this.pendingUpdates + ]); + return stack[0] || current; + } + + /** + * The shell area name of the currently active tab, or undefined. + */ + get currentTabArea(): ApplicationShell.Area | undefined { + const currentWidget = this.currentWidget; + if (currentWidget) { + return this.getAreaFor(currentWidget); + } + } + + /** + * Determine the name of the shell area where the given widget resides. The result is + * undefined if the widget does not reside directly in the shell. + */ + getAreaFor(input: TabBar | Widget): ApplicationShell.Area | undefined { + if (input instanceof TabBar) { + if (find(this.mainPanel.tabBars(), tb => tb === input)) { + return 'main'; + } + if (find(this.bottomPanel.tabBars(), tb => tb === input)) { + return 'bottom'; + } + if (this.leftPanelHandler.tabBar === input) { + return 'left'; + } + if (this.rightPanelHandler.tabBar === input) { + return 'right'; + } + } + const widget = this.toTrackedStack(input.id).pop(); + if (!widget) { + return undefined; + } + const title = widget.title; + const mainPanelTabBar = this.mainPanel.findTabBar(title); + if (mainPanelTabBar) { + return 'main'; + } + const bottomPanelTabBar = this.bottomPanel.findTabBar(title); + if (bottomPanelTabBar) { + return 'bottom'; + } + if (ArrayExt.firstIndexOf(this.leftPanelHandler.tabBar.titles, title) > -1) { + return 'left'; + } + if (ArrayExt.firstIndexOf(this.rightPanelHandler.tabBar.titles, title) > -1) { + return 'right'; + } + if (this.secondaryWindowHandler.widgets.includes(widget)) { + return 'secondaryWindow'; + } + return undefined; + } + + protected getAreaPanelFor(input: Widget): DockPanel | undefined { + const widget = this.toTrackedStack(input.id).pop(); + if (!widget) { + return undefined; + } + return this.findPanel(widget); + } + + /** + * Find the shell panel this top-level widget is part of + */ + protected findPanel(widget: Widget | undefined): TheiaDockPanel | undefined { + if (!widget) { + return undefined; + } + const title = widget.title; + const mainPanelTabBar = this.mainPanel.findTabBar(title); + if (mainPanelTabBar) { + return this.mainPanel; + } + const bottomPanelTabBar = this.bottomPanel.findTabBar(title); + if (bottomPanelTabBar) { + return this.bottomPanel; + } + if (ArrayExt.firstIndexOf(this.leftPanelHandler.tabBar.titles, title) > -1) { + return this.leftPanelHandler.dockPanel; + } + if (ArrayExt.firstIndexOf(this.rightPanelHandler.tabBar.titles, title) > -1) { + return this.rightPanelHandler.dockPanel; + } + return undefined; + } + + /** + * Return the tab bar that has the currently active widget, or undefined. + */ + get currentTabBar(): TabBar | undefined { + const currentWidget = this.currentWidget; + if (currentWidget) { + return this.getTabBarFor(currentWidget); + } + } + + /** + * Return the tab bar in the given shell area, or the tab bar that has the given widget, or undefined. + */ + getTabBarFor(widgetOrArea: Widget | ApplicationShell.Area): TabBar | undefined { + if (typeof widgetOrArea === 'string') { + switch (widgetOrArea) { + case 'main': + return this.mainPanel.currentTabBar; + case 'bottom': + return this.bottomPanel.currentTabBar; + case 'left': + return this.leftPanelHandler.tabBar; + case 'right': + return this.rightPanelHandler.tabBar; + case 'secondaryWindow': + // there may be multiple secondary windows, so we can't return a single tabbar here + return undefined; + default: + throw new Error('Illegal argument: ' + widgetOrArea); + } + } + const widget = this.toTrackedStack(widgetOrArea.id).pop(); + if (!widget) { + return undefined; + } + const widgetTitle = widget.title; + const mainPanelTabBar = this.mainPanel.findTabBar(widgetTitle); + if (mainPanelTabBar) { + return mainPanelTabBar; + } + const bottomPanelTabBar = this.bottomPanel.findTabBar(widgetTitle); + if (bottomPanelTabBar) { + return bottomPanelTabBar; + } + const leftPanelTabBar = this.leftPanelHandler.tabBar; + if (ArrayExt.firstIndexOf(leftPanelTabBar.titles, widgetTitle) > -1) { + return leftPanelTabBar; + } + const rightPanelTabBar = this.rightPanelHandler.tabBar; + if (ArrayExt.firstIndexOf(rightPanelTabBar.titles, widgetTitle) > -1) { + return rightPanelTabBar; + } + const secondaryWindowTabBar = this.secondaryWindowHandler.getTabBarFor(widget); + if (secondaryWindowTabBar) { + return secondaryWindowTabBar; + } + return undefined; + } + + /** + * The tab bars contained in the main shell area. If there is no widget in the main area, the + * returned array is empty. + */ + get mainAreaTabBars(): TabBar[] { + return toArray(this.mainPanel.tabBars()); + } + + /** + * The tab bars contained in the bottom shell area. If there is no widget in the bottom area, + * the returned array is empty. + */ + get bottomAreaTabBars(): TabBar[] { + return toArray(this.bottomPanel.tabBars()); + } + + /** + * The tab bars contained in all shell areas. + */ + get allTabBars(): TabBar[] { + return [...this.mainAreaTabBars, ...this.bottomAreaTabBars, this.leftPanelHandler.tabBar, this.rightPanelHandler.tabBar]; + } + + /* + * Activate the next tab in the current tab bar. + */ + activateNextTabInTabBar(current: TabBar | undefined = this.currentTabBar): boolean { + const index = this.nextTabIndexInTabBar(current); + if (!current || index === -1) { + return false; + } + current.currentIndex = index; + if (current.currentTitle) { + this.activateWidget(current.currentTitle.owner.id); + } + return true; + } + + nextTabIndexInTabBar(current: TabBar | undefined = this.currentTabBar): number { + if (!current || current.titles.length <= 1) { + return -1; + } + const index = current.currentIndex; + if (index === -1) { + return -1; + } + if (index < current.titles.length - 1) { + return index + 1; + } + // last item in tab bar. select the previous one. + if (index === current.titles.length - 1) { + return index - 1; + } + return 0; + } + + activateNextTab(): boolean { + const current = this.currentTabBar; + if (current) { + const ci = current.currentIndex; + if (ci !== -1) { + if (ci < current.titles.length - 1) { + current.currentIndex += 1; + if (current.currentTitle) { + this.activateWidget(current.currentTitle.owner.id); + } + return true; + } else if (ci === current.titles.length - 1) { + return this.activateNextTabBar(current); + } + } + } + return false; + } + + activateNextTabBar(current: TabBar | undefined = this.currentTabBar): boolean { + const nextBar = this.nextTabBar(current); + if (nextBar) { + nextBar.currentIndex = 0; + if (nextBar.currentTitle) { + this.activateWidget(nextBar.currentTitle.owner.id); + } + return true; + } + return false; + } + + /** + * Return the tab bar next to the given tab bar; return the given tab bar if there is no adjacent one. + */ + nextTabBar(current: TabBar | undefined = this.currentTabBar): TabBar | undefined { + let bars = toArray(this.bottomPanel.tabBars()); + let len = bars.length; + let ci = ArrayExt.firstIndexOf(bars, current); + if (ci < 0) { + bars = toArray(this.mainPanel.tabBars()); + len = bars.length; + ci = ArrayExt.firstIndexOf(bars, current); + } + if (ci >= 0 && ci < len - 1) { + return bars[ci + 1]; + } else if (ci >= 0 && ci === len - 1) { + return bars[0]; + } else { + return current; + } + } + + /* + * Activate the previous tab in the current tab bar. + */ + activatePreviousTabInTabBar(current: TabBar | undefined = this.currentTabBar): boolean { + const index = this.previousTabIndexInTabBar(current); + if (!current || index === -1) { + return false; + } + current.currentIndex = index; + if (current.currentTitle) { + this.activateWidget(current.currentTitle.owner.id); + } + return true; + } + + previousTabIndexInTabBar(current: TabBar | undefined = this.currentTabBar): number { + if (!current || current.titles.length <= 1) { + return -1; + } + const index = current.currentIndex; + if (index === -1) { + return -1; + } + if (index > 0) { + return index - 1; + } + return current.titles.length - 1; + } + + activatePreviousTab(): boolean { + const current = this.currentTabBar; + if (current) { + const ci = current.currentIndex; + if (ci !== -1) { + if (ci > 0) { + current.currentIndex -= 1; + if (current.currentTitle) { + this.activateWidget(current.currentTitle.owner.id); + } + return true; + } else if (ci === 0) { + if (current && current.titles.length > 0) { + current.currentIndex = current.titles.length - 1; + if (current.currentTitle) { + this.activateWidget(current.currentTitle.owner.id); + } + return true; + } + return this.activatePreviousTabBar(current); + } + } + } + return false; + } + + activatePreviousTabBar(current: TabBar | undefined = this.currentTabBar): boolean { + const prevBar = this.previousTabBar(current); + if (!prevBar) { + return false; + } + if (!prevBar.currentTitle) { + prevBar.currentIndex = prevBar.titles.length - 1; + } + if (prevBar.currentTitle) { + this.activateWidget(prevBar.currentTitle.owner.id); + } + return true; + } + + /** + * Return the tab bar previous to the given tab bar; return the given tab bar if there is no adjacent one. + */ + previousTabBar(current: TabBar | undefined = this.currentTabBar): TabBar | undefined { + const bars = toArray(this.mainPanel.tabBars()); + const len = bars.length; + const ci = ArrayExt.firstIndexOf(bars, current); + if (ci > 0) { + return bars[ci - 1]; + } else if (ci === 0) { + return bars[len - 1]; + } else { + return current; + } + } + + /** + * Test whether the current widget is dirty. + */ + canSave(): boolean { + return this.saveableService.canSave(this.currentWidget); + } + + /** + * Save the current widget if it is dirty. + */ + async save(options?: SaveOptions): Promise { + await this.saveableService.save(this.currentWidget, options); + } + + /** + * Test whether there is a dirty widget. + */ + canSaveAll(): boolean { + return this.tracker.widgets.some(widget => this.saveableService.canSave(widget)); + } + + /** + * Save all dirty widgets. + */ + async saveAll(options?: SaveOptions): Promise { + for (const widget of this.widgets) { + if (Saveable.isDirty(widget) && this.saveableService.canSaveNotSaveAs(widget)) { + await this.saveableService.save(widget, options); + } + } + } + + /** + * Returns a snapshot of all tracked widgets to allow async modifications. + */ + get widgets(): ReadonlyArray { + return [...this.tracker.widgets]; + } + + getWidgetById(id: string): Widget | undefined { + for (const widget of this.tracker.widgets) { + if (widget.id === id) { + return widget; + } + } + return undefined; + } + + canToggleMaximized(widget: Widget | undefined = this.currentWidget): boolean { + const area = widget && this.getAreaFor(widget); + return area === 'main' || area === 'bottom'; + } + + toggleMaximized(widget: Widget | undefined = this.currentWidget): void { + const area = widget && this.getAreaPanelFor(widget); + if (area instanceof TheiaDockPanel && (area === this.mainPanel || area === this.bottomPanel)) { + this.doToggleMaximized(area); + this.revealWidget(widget!.id); + } + } + + protected handleMenuBarVisibility(newValue: string): void { + if (newValue === 'visible') { + const topRect = this.topPanel.node.getBoundingClientRect(); + this.maximizedElement.style.top = `${topRect.bottom}px`; + } else { + this.maximizedElement.style.removeProperty('top'); + } + } + + protected readonly onDidToggleMaximizedEmitter = new Emitter(); + readonly onDidToggleMaximized = this.onDidToggleMaximizedEmitter.event; + + protected unmaximize: (() => void) | undefined; + doToggleMaximized(area: TheiaDockPanel): void { + if (this.unmaximize) { + this.unmaximize(); + this.unmaximize = undefined; + return; + } + + const removedListener = () => { + if (!area.widgets().next().value) { + this.doToggleMaximized(area); + } + }; + + const parent = area.parent as SplitPanel; + const layout = area.parent?.layout as SplitLayout; + const sizes = layout.relativeSizes().slice(); + const stretch = SplitPanel.getStretch(area); + const index = parent.widgets.indexOf(area); + parent.layout?.removeWidget(area); + + // eslint-disable-next-line no-null/no-null + this.maximizedElement.style.display = 'block'; + area.addClass(MAXIMIZED_CLASS); + const topRect = this.topPanel.node.getBoundingClientRect(); + UnsafeWidgetUtilities.attach(area, this.maximizedElement); + this.maximizedElement.style.top = `${topRect.bottom}px`; + area.fit(); + const observer = new ResizeObserver(entries => { + area.fit(); + }); + observer.observe(this.maximizedElement); + + this.unmaximize = () => { + observer.unobserve(this.maximizedElement); + observer.disconnect(); + this.maximizedElement.style.display = 'none'; + area.removeClass(MAXIMIZED_CLASS); + if (area.isAttached) { + UnsafeWidgetUtilities.detach(area); + } + parent?.insertWidget(index, area); + SplitPanel.setStretch(area, stretch); + layout.setRelativeSizes(sizes); + parent.fit(); + this.onDidToggleMaximizedEmitter.fire(area); + area.widgetRemoved.disconnect(removedListener); + }; + + area.widgetRemoved.connect(removedListener); + this.onDidToggleMaximizedEmitter.fire(area); + } +} + +/** + * The namespace for `ApplicationShell` class statics. + */ +export namespace ApplicationShell { + /** + * The areas of the application shell where widgets can reside. + */ + export type Area = 'main' | 'top' | 'left' | 'right' | 'bottom' | 'secondaryWindow'; + + export const areaLabels: Record = { + main: nls.localizeByDefault('Main'), + top: nls.localizeByDefault('Top'), + left: nls.localizeByDefault('Left'), + right: nls.localizeByDefault('Right'), + bottom: nls.localizeByDefault('Bottom'), + secondaryWindow: nls.localize('theia/shell-area/secondary', 'Secondary Window'), + }; + + /** + * The _side areas_ are those shell areas that can be collapsed and expanded, + * i.e. `left`, `right`, and `bottom`. + */ + export function isSideArea(area?: string): area is 'left' | 'right' | 'bottom' { + return area === 'left' || area === 'right' || area === 'bottom'; + } + + export function isValidArea(area?: unknown): area is ApplicationShell.Area { + const areas = ['main', 'top', 'left', 'right', 'bottom', 'secondaryWindow']; + return typeof area === 'string' && areas.includes(area); + } + + /** + * General options for the application shell. These are passed on construction and can be modified + * through dependency injection (`ApplicationShellOptions` symbol). + */ + export interface Options extends Widget.IOptions { + bottomPanel: BottomPanelOptions; + leftPanel: SidePanel.Options; + rightPanel: SidePanel.Options; + } + + export interface BottomPanelOptions extends SidePanel.Options { + } + + /** + * The default values for application shell options. + */ + export const DEFAULT_OPTIONS = Object.freeze({ + bottomPanel: Object.freeze({ + emptySize: 140, + expandThreshold: 160, + expandDuration: 0, + initialSizeRatio: 0.382 + }), + leftPanel: Object.freeze({ + emptySize: 140, + expandThreshold: 140, + expandDuration: 0, + initialSizeRatio: 0.191 + }), + rightPanel: Object.freeze({ + emptySize: 140, + expandThreshold: 140, + expandDuration: 0, + initialSizeRatio: 0.191 + }) + }); + + /** + * Whether a widget should be opened to the side tab bar relatively to the reference widget. + */ + export type OpenToSideMode = 'open-to-left' | 'open-to-right'; + + export function isOpenToSideMode(mode: unknown): mode is OpenToSideMode { + return mode === 'open-to-left' || mode === 'open-to-right'; + } + + /** + * Whether the `ref` of the options widget should be replaced. + */ + export type ReplaceMode = 'tab-replace'; + + export function isReplaceMode(mode: unknown): mode is ReplaceMode { + return mode === 'tab-replace'; + } + + /** + * Options for adding a widget to the application shell. + */ + export interface WidgetOptions extends SidePanel.WidgetOptions { + /** + * The area of the application shell where the widget will reside. + */ + area?: Area; + /** + * The insertion mode for adding the widget. + * + * The default is `'tab-after'`. + */ + mode?: DockLayout.InsertMode | OpenToSideMode | ReplaceMode + /** + * The reference widget for the insert location. + * + * The default is `undefined`. + */ + ref?: Widget; + } + + export interface CloseOptions { + /** + * if optional then a user will be prompted + * if undefined then close will be canceled + * if true then will be saved on close + * if false then won't be saved on close + */ + save?: boolean | undefined + } + + /** + * Data to save and load the application shell layout. + */ + export interface LayoutData { + version?: string | ApplicationShellLayoutVersion, + mainPanel?: DockPanel.ILayoutConfig; + mainPanelPinned?: boolean[]; + bottomPanel?: BottomPanelLayoutData; + leftPanel?: SidePanel.LayoutData; + rightPanel?: SidePanel.LayoutData; + activeWidgetId?: string; + } + + /** + * Data to save and load the bottom panel layout. + */ + export interface BottomPanelLayoutData { + config?: DockPanel.ILayoutConfig; + size?: number; + expanded?: boolean; + pinned?: boolean[]; + } + + /** + * Exposes widgets which activation state should be tracked by shell. + */ + export interface TrackableWidgetProvider { + getTrackableWidgets(): Widget[] + readonly onDidChangeTrackableWidgets?: CommonEvent + /** + * Make visible and focus a trackable widget for the given id. + * If not implemented then `activate` request will be sent to a child widget directly. + */ + activateWidget?(id: string): Widget | undefined; + /** + * Make visible a trackable widget for the given id. + * If not implemented then a widget should be always visible when an owner is visible. + */ + revealWidget?(id: string): Widget | undefined; + } + + export namespace TrackableWidgetProvider { + export function is(widget: unknown): widget is TrackableWidgetProvider { + return isObject(widget) && 'getTrackableWidgets' in widget; + } + } + +} diff --git a/packages/core/src/browser/shell/current-widget-command-adapter.ts b/packages/core/src/browser/shell/current-widget-command-adapter.ts new file mode 100644 index 0000000..c0cd399 --- /dev/null +++ b/packages/core/src/browser/shell/current-widget-command-adapter.ts @@ -0,0 +1,57 @@ +// ***************************************************************************** +// Copyright (C) 2021 Ericsson and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { CommandHandler } from '../../common'; +import { TabBar, Title, Widget } from '../widgets'; +import { ApplicationShell } from './application-shell'; + +type CurrentWidgetCommandAdapterBooleanCheck = (event: Event) => boolean; +type CurrentWidgetCommandHandlerBooleanCheck = (title: Title | undefined, tabbar: TabBar | undefined, event: Event) => boolean; + +export interface TabBarContextMenuCommandHandler extends CommandHandler { + execute(title: Title | undefined, tabbar: TabBar | undefined, event: Event): unknown; + isEnabled?: CurrentWidgetCommandHandlerBooleanCheck; + isVisible?: CurrentWidgetCommandHandlerBooleanCheck; + isToggled?: CurrentWidgetCommandHandlerBooleanCheck; +} + +/** + * Creates a command handler that acts on either the widget targeted by a DOM event or the current widget. + */ +export class CurrentWidgetCommandAdapter implements CommandHandler { + execute: (event: Event) => unknown; + isEnabled?: CurrentWidgetCommandAdapterBooleanCheck; + isVisible?: CurrentWidgetCommandAdapterBooleanCheck; + isToggled?: CurrentWidgetCommandAdapterBooleanCheck; + constructor(shell: ApplicationShell, handler: TabBarContextMenuCommandHandler) { + this.execute = (event: Event) => handler.execute(...this.transformArguments(shell, event)); + if (handler.isEnabled) { + this.isEnabled = (event: Event) => !!handler.isEnabled?.(...this.transformArguments(shell, event)); + } + if (handler.isVisible) { + this.isVisible = (event: Event) => !!handler.isVisible?.(...this.transformArguments(shell, event)); + } + if (handler.isToggled) { + this.isToggled = (event: Event) => !!handler.isToggled?.(...this.transformArguments(shell, event)); + } + } + + protected transformArguments(shell: ApplicationShell, event: Event): [Title | undefined, TabBar | undefined, Event] { + const tabBar = shell.findTabBar(event); + const title = tabBar && shell.findTitle(tabBar, event); + return [title, tabBar, event]; + } +} diff --git a/packages/core/src/browser/shell/index.ts b/packages/core/src/browser/shell/index.ts new file mode 100644 index 0000000..a829a0d --- /dev/null +++ b/packages/core/src/browser/shell/index.ts @@ -0,0 +1,24 @@ +// ***************************************************************************** +// Copyright (C) 2018 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +export * from './application-shell'; +export * from './shell-layout-restorer'; +export * from './side-panel-handler'; +export * from './sidebar-menu-widget'; +export * from './split-panels'; +export * from './tab-bars'; +export * from './view-contribution'; +export * from './theia-split-panel'; diff --git a/packages/core/src/browser/shell/shell-layout-restorer.ts b/packages/core/src/browser/shell/shell-layout-restorer.ts new file mode 100644 index 0000000..dcbd61e --- /dev/null +++ b/packages/core/src/browser/shell/shell-layout-restorer.ts @@ -0,0 +1,414 @@ +// ***************************************************************************** +// Copyright (C) 2017 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { injectable, inject, named } from 'inversify'; +import { Widget } from '@lumino/widgets'; +import { FrontendApplication } from '../frontend-application'; +import { WidgetManager, WidgetConstructionOptions } from '../widget-manager'; +import { StorageService } from '../storage-service'; +import { ILogger } from '../../common/logger'; +import { CommandContribution, CommandRegistry, Command } from '../../common/command'; +import { ThemeService } from '../theming'; +import { ContributionProvider } from '../../common/contribution-provider'; +import { ApplicationShell, applicationShellLayoutVersion, ApplicationShellLayoutVersion } from './application-shell'; +import { CommonCommands } from '../common-commands'; +import { WindowService } from '../window/window-service'; +import { StopReason } from '../../common/frontend-application-state'; +import { isFunction, isObject, MaybePromise } from '../../common'; + +/** + * A contract for widgets that want to store and restore their inner state, between sessions. + */ +export interface StatefulWidget { + + /** + * Called on unload to store the inner state. Returns 'undefined' if the widget cannot be stored. + */ + storeState(): object | undefined; + + /** + * Called when the widget got created by the storage service + */ + restoreState(oldState: object): void; +} + +export namespace StatefulWidget { + export function is(arg: unknown): arg is StatefulWidget { + return isObject(arg) && isFunction(arg.storeState) && isFunction(arg.restoreState); + } +} + +export interface WidgetDescription { + constructionOptions: WidgetConstructionOptions, + innerWidgetState?: string | object +} + +export interface ApplicationShellLayoutMigrationContext { + /** + * A resolved version of a current layout. + */ + layoutVersion: number + /** + * A layout to be inflated. + */ + layout: ApplicationShell.LayoutData + /** + * A parent widget is to be inflated. `undefined` if the application shell + */ + parent?: Widget +} + +export interface ApplicationShellLayoutMigrationError extends Error { + code: 'ApplicationShellLayoutMigrationError' +} +export namespace ApplicationShellLayoutMigrationError { + const code: ApplicationShellLayoutMigrationError['code'] = 'ApplicationShellLayoutMigrationError'; + export function create(message?: string): ApplicationShellLayoutMigrationError { + return Object.assign(new Error( + `Could not migrate layout to version ${applicationShellLayoutVersion}.` + (message ? '\n' + message : '') + ), { code }); + } + export function is(error: Error | undefined): error is ApplicationShellLayoutMigrationError { + return !!error && 'code' in error && error['code'] === code; + } +} + +export const ApplicationShellLayoutMigration = Symbol('ApplicationShellLayoutMigration'); +export interface ApplicationShellLayoutMigration { + /** + * A target migration version. + */ + readonly layoutVersion: ApplicationShellLayoutVersion; + + /** + * A migration can transform layout before it will be inflated. + * + * @throws `ApplicationShellLayoutMigrationError` if a layout cannot be migrated, + * in this case the default layout will be initialized. + */ + onWillInflateLayout?(context: ApplicationShellLayoutMigrationContext): MaybePromise; + + /** + * A migration can transform the given description before it will be inflated. + * + * @returns a migrated widget description, or `undefined` + * @throws `ApplicationShellLayoutMigrationError` if a widget description cannot be migrated, + * in this case the default layout will be initialized. + */ + onWillInflateWidget?(desc: WidgetDescription, context: ApplicationShellLayoutMigrationContext): MaybePromise; +} + +export const ShellLayoutTransformer = Symbol('ShellLayoutTransformer'); +/** + * This contribution point allows arbitrary modifications to the shell layout + * data when it is restored. + */ +export interface ShellLayoutTransformer { + /** + * Modifies the shell layout data before it is restored. + * @param layoutData + */ + transformLayoutOnRestore(layoutData: ApplicationShell.LayoutData): void; +} + +export const RESET_LAYOUT = Command.toLocalizedCommand({ + id: 'reset.layout', + category: CommonCommands.VIEW_CATEGORY, + label: 'Reset Workbench Layout' +}, 'theia/core/resetWorkbenchLayout', CommonCommands.VIEW_CATEGORY_KEY); + +@injectable() +export class ShellLayoutRestorer implements CommandContribution { + + protected storageKey = 'layout'; + protected shouldStoreLayout: boolean = true; + + @inject(ContributionProvider) @named(ApplicationShellLayoutMigration) protected readonly migrations: ContributionProvider; + @inject(ContributionProvider) @named(ShellLayoutTransformer) protected readonly transformations: ContributionProvider; + @inject(WindowService) protected readonly windowService: WindowService; + @inject(ThemeService) protected readonly themeService: ThemeService; + + constructor( + @inject(WidgetManager) protected widgetManager: WidgetManager, + @inject(ILogger) protected logger: ILogger, + @inject(StorageService) protected storageService: StorageService) { } + + registerCommands(commands: CommandRegistry): void { + commands.registerCommand(RESET_LAYOUT, { + execute: async () => this.resetLayout() + }); + } + + protected async resetLayout(): Promise { + if (await this.windowService.isSafeToShutDown(StopReason.Reload)) { + this.logger.info('>>> Resetting layout...'); + this.shouldStoreLayout = false; + this.storageService.setData(this.storageKey, undefined); + this.themeService.reset(); + this.logger.info('<<< The layout has been successfully reset.'); + this.windowService.reload(); + } + } + + storeLayout(app: FrontendApplication): void { + if (this.shouldStoreLayout) { + try { + this.logger.info('>>> Storing the layout...'); + const layoutData = app.shell.getLayoutData(); + const serializedLayoutData = this.deflate(layoutData); + this.storageService.setData(this.storageKey, serializedLayoutData); + this.logger.info('<<< The layout has been successfully stored.'); + } catch (error) { + this.storageService.setData(this.storageKey, undefined); + this.logger.error('Error during serialization of layout data', error); + } + } + } + + async restoreLayout(app: FrontendApplication): Promise { + this.logger.info('>>> Restoring the layout state...'); + const serializedLayoutData = await this.storageService.getData(this.storageKey); + if (serializedLayoutData === undefined) { + this.logger.info('<<< Nothing to restore.'); + return false; + } + const layoutData = await this.inflate(serializedLayoutData); + this.transformations.getContributions().forEach(transformation => transformation.transformLayoutOnRestore(layoutData)); + await app.shell.setLayoutData(layoutData); + this.logger.info('<<< The layout has been successfully restored.'); + return true; + } + + protected isWidgetProperty(propertyName: string): boolean { + return propertyName === 'widget'; + } + + protected isWidgetsProperty(propertyName: string): boolean { + return propertyName === 'widgets'; + } + + /** + * Turns the layout data to a string representation. + */ + protected deflate(data: object): string { + return JSON.stringify(data, (property: string, value) => { + if (this.isWidgetProperty(property)) { + const description = this.convertToDescription(value as Widget); + return description; + } else if (this.isWidgetsProperty(property)) { + const descriptions: WidgetDescription[] = []; + for (const widget of (value as Widget[])) { + const description = this.convertToDescription(widget); + if (description) { + descriptions.push(description); + } + } + return descriptions; + } + return value; + }); + } + + private convertToDescription(widget: Widget): WidgetDescription | undefined { + const desc = this.widgetManager.getDescription(widget); + if (desc) { + if (StatefulWidget.is(widget)) { + const innerState = widget.storeState(); + return innerState ? { + constructionOptions: desc, + innerWidgetState: this.deflate(innerState) + } : undefined; + } else { + return { + constructionOptions: desc, + innerWidgetState: undefined + }; + } + } + } + + /** + * Creates the layout data from its string representation. + */ + protected async inflate(layoutData: string): Promise { + const parseContext = new ShellLayoutRestorer.ParseContext(); + const layout = this.parse(layoutData, parseContext); + + const layoutVersion = Number(layout.version); + if (typeof layoutVersion !== 'number' || Number.isNaN(layoutVersion)) { + throw new Error('could not resolve a layout version'); + } + if (layoutVersion !== applicationShellLayoutVersion) { + if (layoutVersion < applicationShellLayoutVersion) { + console.warn(`Layout version ${layoutVersion} is behind current layout version ${applicationShellLayoutVersion}, trying to migrate...`); + } else { + console.warn(`Layout version ${layoutVersion} is ahead current layout version ${applicationShellLayoutVersion}, trying to load anyway...`); + } + console.info(`Please use '${RESET_LAYOUT.label}' command if the layout looks bogus.`); + } + + const migrations = this.migrations.getContributions() + .filter(m => m.layoutVersion > layoutVersion && m.layoutVersion <= applicationShellLayoutVersion) + .sort((m, m2) => m.layoutVersion - m2.layoutVersion); + if (migrations.length) { + console.info(`Found ${migrations.length} migrations from layout version ${layoutVersion} to version ${applicationShellLayoutVersion}, migrating...`); + } + + const context = { layout, layoutVersion, migrations }; + await this.fireWillInflateLayout(context); + await parseContext.inflate(context); + return layout; + } + + protected async fireWillInflateLayout(context: ShellLayoutRestorer.InflateContext): Promise { + for (const migration of context.migrations) { + if (migration.onWillInflateLayout) { + // don't catch exceptions, if one migration fails all should fail. + await migration.onWillInflateLayout(context); + } + } + } + + protected parse(layoutData: string, parseContext: ShellLayoutRestorer.ParseContext): T { + return JSON.parse(layoutData, (property: string, value) => { + if (this.isWidgetsProperty(property)) { + const widgets = parseContext.filteredArray(); + const descs = (value as WidgetDescription[]); + for (let i = 0; i < descs.length; i++) { + parseContext.push(async context => { + widgets[i] = await this.convertToWidget(descs[i], context); + }); + } + return widgets; + } else if (isObject(value) && !Array.isArray(value)) { + const copy: Record = {}; + for (const p in value) { + if (this.isWidgetProperty(p)) { + parseContext.push(async context => { + copy[p] = await this.convertToWidget(value[p] as WidgetDescription, context); + }); + } else { + copy[p] = value[p]; + } + } + return copy; + } + return value; + }); + } + + protected async fireWillInflateWidget(desc: WidgetDescription, context: ShellLayoutRestorer.InflateContext): Promise { + for (const migration of context.migrations) { + if (migration.onWillInflateWidget) { + // don't catch exceptions, if one migration fails all should fail. + const migrated = await migration.onWillInflateWidget(desc, context); + if (migrated) { + if (isObject(migrated.innerWidgetState)) { + // in order to inflate nested widgets + migrated.innerWidgetState = JSON.stringify(migrated.innerWidgetState); + } + desc = migrated; + } + } + } + return desc; + } + + protected async convertToWidget(desc: WidgetDescription, context: ShellLayoutRestorer.InflateContext): Promise { + if (!desc.constructionOptions) { + return undefined; + } + try { + desc = await this.fireWillInflateWidget(desc, context); + const widget = await this.widgetManager.getOrCreateWidget(desc.constructionOptions.factoryId, desc.constructionOptions.options); + if (StatefulWidget.is(widget) && desc.innerWidgetState !== undefined) { + try { + let oldState: object; + if (typeof desc.innerWidgetState === 'string') { + const parseContext = new ShellLayoutRestorer.ParseContext(); + oldState = this.parse(desc.innerWidgetState, parseContext); + await parseContext.inflate({ ...context, parent: widget }); + } else { + oldState = desc.innerWidgetState; + } + widget.restoreState(oldState); + } catch (e) { + if (ApplicationShellLayoutMigrationError.is(e)) { + throw e; + } + this.logger.warn(`Couldn't restore widget state for ${widget.id}. Error: ${e} `); + } + } + if (widget.isDisposed) { + return undefined; + } + return widget; + } catch (e) { + if (ApplicationShellLayoutMigrationError.is(e)) { + throw e; + } + this.logger.warn(`Couldn't restore widget for ${desc.constructionOptions.factoryId}. Error: ${e} `); + return undefined; + } + } + +} + +export namespace ShellLayoutRestorer { + + export class ParseContext { + protected readonly toInflate: Inflate[] = []; + protected readonly toFilter: Widgets[] = []; + + /** + * Returns an array, which will be filtered from undefined elements + * after resolving promises, that create widgets. + */ + filteredArray(): Widgets { + const array: Widgets = []; + this.toFilter.push(array); + return array; + } + + push(toInflate: Inflate): void { + this.toInflate.push(toInflate); + } + + async inflate(context: InflateContext): Promise { + const pending: Promise[] = []; + while (this.toInflate.length) { + pending.push(this.toInflate.pop()!(context)); + } + await Promise.all(pending); + + if (this.toFilter.length) { + this.toFilter.forEach(array => { + for (let i = 0; i < array.length; i++) { + if (array[i] === undefined) { + array.splice(i--, 1); + } + } + }); + } + } + } + + export type Widgets = (Widget | undefined)[]; + export type Inflate = (context: InflateContext) => Promise; + export interface InflateContext extends ApplicationShellLayoutMigrationContext { + readonly migrations: ApplicationShellLayoutMigration[]; + } +} diff --git a/packages/core/src/browser/shell/side-panel-handler.ts b/packages/core/src/browser/shell/side-panel-handler.ts new file mode 100644 index 0000000..87ba6c8 --- /dev/null +++ b/packages/core/src/browser/shell/side-panel-handler.ts @@ -0,0 +1,795 @@ +// ***************************************************************************** +// Copyright (C) 2018 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { injectable, inject } from 'inversify'; +import { find, map, toArray, some } from '@lumino/algorithm'; +import { TabBar, Widget, DockPanel, Title, Panel, BoxPanel, BoxLayout, SplitPanel, PanelLayout } from '@lumino/widgets'; +import { MimeData } from '@lumino/coreutils'; +import { Drag } from '@lumino/dragdrop'; +import { AttachedProperty } from '@lumino/properties'; +import { TabBarRendererFactory, TabBarRenderer, SHELL_TABBAR_CONTEXT_MENU, SideTabBar } from './tab-bars'; +import { SidebarMenuWidget, SidebarMenu, SidebarBottomMenuWidgetFactory, SidebarTopMenuWidgetFactory } from './sidebar-menu-widget'; +import { SplitPositionHandler, SplitPositionOptions } from './split-panels'; +import { animationFrame } from '../browser'; +import { FrontendApplicationStateService } from '../frontend-application-state'; +import { TheiaDockPanel } from './theia-dock-panel'; +import { SidePanelToolbar } from './side-panel-toolbar'; +import { TabBarToolbarRegistry, TabBarToolbarFactory, TabBarToolbar } from './tab-bar-toolbar'; +import { DisposableCollection, Disposable } from '../../common/disposable'; +import { ContextMenuRenderer } from '../context-menu-renderer'; +import { MenuPath } from '../../common/menu'; +import { SidebarBottomMenuWidget } from './sidebar-bottom-menu-widget'; +import { SidebarTopMenuWidget } from './sidebar-top-menu-widget'; +import { PINNED_CLASS } from '../widgets'; +import { AdditionalViewsMenuWidget, AdditionalViewsMenuWidgetFactory } from './additional-views-menu-widget'; + +/** The class name added to the left and right area panels. */ +export const LEFT_RIGHT_AREA_CLASS = 'theia-app-sides'; + +/** The class name added to collapsed side panels. */ +const COLLAPSED_CLASS = 'theia-mod-collapsed'; + +export const SidePanelHandlerFactory = Symbol('SidePanelHandlerFactory'); + +export const SIDE_PANEL_TOOLBAR_CONTEXT_MENU: MenuPath = ['SIDE_PANEL_TOOLBAR_CONTEXT_MENU']; + +/** + * A class which manages a dock panel and a related side bar. This is used for the left and right + * panel of the application shell. + */ +@injectable() +export class SidePanelHandler { + + /** + * A property that can be attached to widgets in order to determine the insertion index + * of their title in the tab bar. + */ + protected static readonly rankProperty = new AttachedProperty({ + name: 'sidePanelRank', + create: () => undefined + }); + + /** + * The tab bar displays the titles of the widgets in the side panel. Visibility of the widgets + * is controlled entirely through tab selection: a widget is revealed by setting the `currentTitle` + * accordingly in the tab bar, and the panel is hidden by setting that property to `null`. The + * tab bar itself remains visible as long as there is at least one widget. + */ + tabBar: SideTabBar; + /** + * Conditional menu placed below the tabBar. Manages overflowing/hidden tabs. + * Is only visible if there are overflowing tabs. + */ + additionalViewsMenu: AdditionalViewsMenuWidget; + /** + * The menu placed on the sidebar top. + * Displayed as icons. + * Open menus when on clicks. + */ + topMenu: SidebarMenuWidget; + /** + * The menu placed on the sidebar bottom. + * Displayed as icons. + * Open menus when on clicks. + */ + bottomMenu: SidebarMenuWidget; + /** + * A tool bar, which displays a title and widget specific command buttons. + */ + toolBar: SidePanelToolbar; + /** + * The widget container is a dock panel in `single-document` mode, which means that the panel + * cannot be split. + */ + dockPanel: TheiaDockPanel; + /** + * The panel that contains the tab bar and the dock panel. This one is hidden whenever the dock + * panel is empty. + */ + container: Panel; + /** + * The current state of the side panel. + */ + readonly state: SidePanel.State = { + empty: true, + expansion: SidePanel.ExpansionState.collapsed, + pendingUpdate: Promise.resolve() + }; + + /** + * The shell area where the panel is placed. This property should not be modified directly, but + * only by calling `create`. + */ + protected side: 'left' | 'right'; + /** + * Options that control the behavior of the side panel. + */ + protected options: SidePanel.Options; + + @inject(TabBarToolbarRegistry) protected tabBarToolBarRegistry: TabBarToolbarRegistry; + @inject(TabBarToolbarFactory) protected tabBarToolBarFactory: () => TabBarToolbar; + @inject(TabBarRendererFactory) protected tabBarRendererFactory: () => TabBarRenderer; + @inject(SidebarTopMenuWidgetFactory) protected sidebarTopWidgetFactory: () => SidebarTopMenuWidget; + @inject(SidebarBottomMenuWidgetFactory) protected sidebarBottomWidgetFactory: () => SidebarBottomMenuWidget; + @inject(AdditionalViewsMenuWidgetFactory) protected additionalViewsMenuFactory: AdditionalViewsMenuWidgetFactory; + @inject(SplitPositionHandler) protected splitPositionHandler: SplitPositionHandler; + @inject(FrontendApplicationStateService) protected readonly applicationStateService: FrontendApplicationStateService; + @inject(TheiaDockPanel.Factory) protected readonly dockPanelFactory: TheiaDockPanel.Factory; + + @inject(ContextMenuRenderer) + protected readonly contextMenuRenderer: ContextMenuRenderer; + + /** + * Create the side bar and dock panel widgets. + */ + create(side: 'left' | 'right', options: SidePanel.Options): void { + this.side = side; + this.options = options; + this.topMenu = this.createSidebarTopMenu(); + this.tabBar = this.createSideBar(); + this.additionalViewsMenu = this.createAdditionalViewsWidget(); + this.bottomMenu = this.createSidebarBottomMenu(); + this.toolBar = this.createToolbar(); + this.dockPanel = this.createSidePanel(); + this.container = this.createContainer(); + + this.refresh(); + } + + protected createSideBar(): SideTabBar { + const side = this.side; + const tabBarRenderer = this.tabBarRendererFactory(); + const sideBar = new SideTabBar({ + // Tab bar options + orientation: side === 'left' || side === 'right' ? 'vertical' : 'horizontal', + insertBehavior: 'none', + removeBehavior: 'select-previous-tab', + allowDeselect: false, + tabsMovable: true, + renderer: tabBarRenderer, + // Scroll bar options + handlers: ['drag-thumb', 'keyboard', 'wheel', 'touch'], + useBothWheelAxes: true, + scrollYMarginOffset: 8, + suppressScrollX: true + }); + tabBarRenderer.tabBar = sideBar; + sideBar.disposed.connect(() => tabBarRenderer.dispose()); + tabBarRenderer.contextMenuPath = SHELL_TABBAR_CONTEXT_MENU; + sideBar.addClass('theia-app-' + side); + sideBar.addClass(LEFT_RIGHT_AREA_CLASS); + + sideBar.tabAdded.connect((sender, { title }) => { + const widget = title.owner; + if (!some(this.dockPanel.widgets(), w => w === widget)) { + this.dockPanel.addWidget(widget); + } + }, this); + sideBar.tabActivateRequested.connect((sender, { title }) => title.owner.activate()); + sideBar.tabCloseRequested.connect((sender, { title }) => title.owner.close()); + sideBar.collapseRequested.connect(() => this.collapse(), this); + sideBar.currentChanged.connect(this.onCurrentTabChanged, this); + sideBar.tabDetachRequested.connect(this.onTabDetachRequested, this); + sideBar.tabsOverflowChanged.connect(this.onTabsOverflowChanged, this); + return sideBar; + } + + protected createSidePanel(): TheiaDockPanel { + const sidePanel = this.dockPanelFactory({ + mode: 'single-document' + }); + sidePanel.id = 'theia-' + this.side + '-side-panel'; + sidePanel.addClass('theia-side-panel'); + + sidePanel.widgetActivated.connect((sender, widget) => { + this.tabBar.currentTitle = widget.title; + }, this); + sidePanel.widgetAdded.connect(this.onWidgetAdded, this); + sidePanel.widgetRemoved.connect(this.onWidgetRemoved, this); + return sidePanel; + } + + protected createToolbar(): SidePanelToolbar { + const toolbar = new SidePanelToolbar(this.tabBarToolBarRegistry, this.tabBarToolBarFactory, this.side); + toolbar.onContextMenu(e => this.showContextMenu(e)); + return toolbar; + } + + protected createAdditionalViewsWidget(): AdditionalViewsMenuWidget { + const widget = this.additionalViewsMenuFactory(this.side); + widget.addClass('theia-sidebar-menu'); + widget.addClass('theia-additional-views-menu'); + return widget; + } + + protected createSidebarTopMenu(): SidebarTopMenuWidget { + return this.createSidebarMenu(this.sidebarTopWidgetFactory); + } + + protected createSidebarBottomMenu(): SidebarBottomMenuWidget { + return this.createSidebarMenu(this.sidebarBottomWidgetFactory); + } + + protected createSidebarMenu(factory: () => T): T { + const menu = factory(); + menu.addClass('theia-sidebar-menu'); + return menu; + } + + protected showContextMenu(e: MouseEvent): void { + const title = this.tabBar.currentTitle; + if (!title) { + return; + } + e.stopPropagation(); + e.preventDefault(); + + this.contextMenuRenderer.render({ + args: [title.owner], + menuPath: SIDE_PANEL_TOOLBAR_CONTEXT_MENU, + anchor: e, + context: e.currentTarget instanceof HTMLElement ? e.currentTarget : this.tabBar.node + }); + } + + protected createContainer(): Panel { + const contentBox = new BoxLayout({ direction: 'top-to-bottom', spacing: 0 }); + BoxPanel.setStretch(this.toolBar, 0); + contentBox.addWidget(this.toolBar); + BoxPanel.setStretch(this.dockPanel, 1); + contentBox.addWidget(this.dockPanel); + const contentPanel = new BoxPanel({ layout: contentBox }); + + const side = this.side; + let direction: BoxLayout.Direction; + switch (side) { + case 'left': + direction = 'left-to-right'; + break; + case 'right': + direction = 'right-to-left'; + break; + default: + throw new Error('Illegal argument: ' + side); + } + const containerLayout = new BoxLayout({ direction, spacing: 0 }); + const sidebarContainerLayout = new PanelLayout(); + const sidebarContainer = new Panel({ layout: sidebarContainerLayout }); + sidebarContainer.addClass('theia-app-sidebar-container'); + sidebarContainerLayout.addWidget(this.topMenu); + sidebarContainerLayout.addWidget(this.tabBar); + sidebarContainerLayout.addWidget(this.additionalViewsMenu); + sidebarContainerLayout.addWidget(this.bottomMenu); + + BoxPanel.setStretch(sidebarContainer, 0); + BoxPanel.setStretch(contentPanel, 1); + containerLayout.addWidget(sidebarContainer); + containerLayout.addWidget(contentPanel); + const boxPanel = new BoxPanel({ layout: containerLayout }); + boxPanel.id = 'theia-' + side + '-content-panel'; + return boxPanel; + } + + /** + * Create an object that describes the current side panel layout. This object may contain references + * to widgets; these need to be transformed before the layout can be serialized. + */ + getLayoutData(): SidePanel.LayoutData { + const currentTitle = this.tabBar.currentTitle; + const items = toArray(map(this.tabBar.titles, title => { + widget: title.owner, + rank: SidePanelHandler.rankProperty.get(title.owner), + expanded: title === currentTitle, + pinned: title.className.includes(PINNED_CLASS) + })); + // eslint-disable-next-line no-null/no-null + const size = currentTitle !== null ? this.getPanelSize() : this.state.lastPanelSize; + return { type: 'sidepanel', items, size }; + } + + /** + * Apply a side panel layout that has been previously created with `getLayoutData`. + */ + setLayoutData(layoutData: SidePanel.LayoutData): void { + // eslint-disable-next-line no-null/no-null + this.tabBar.currentTitle = null; + + let currentTitle: Title | undefined; + if (layoutData.items) { + for (const { widget, rank, expanded, pinned } of layoutData.items) { + if (widget) { + if (rank) { + SidePanelHandler.rankProperty.set(widget, rank); + } + if (expanded) { + currentTitle = widget.title; + } + if (pinned) { + widget.title.className += ` ${PINNED_CLASS}`; + widget.title.closable = false; + } + // Add the widgets directly to the tab bar in the same order as they are stored + this.tabBar.addTab(widget.title); + } + } + } + if (layoutData.size) { + this.state.lastPanelSize = layoutData.size; + } + + // If the layout data contains an expanded item, update the currentTitle property + // This implies a refresh through the `currentChanged` signal + if (currentTitle) { + this.tabBar.currentTitle = currentTitle; + } else { + this.refresh(); + } + } + + /** + * Activate a widget residing in the side panel by ID. + * + * @returns the activated widget if it was found + */ + activate(id: string): Widget | undefined { + const widget = this.expand(id); + if (widget) { + widget.activate(); + } + return widget; + } + + /** + * Expand a widget residing in the side panel by ID. If no ID is given and the panel is + * currently collapsed, the last active tab of this side panel is expanded. If no tab + * was expanded previously, the first one is taken. + * + * @returns the expanded widget if it was found + */ + expand(id?: string): Widget | undefined { + if (id) { + const widget = find(this.dockPanel.widgets(), w => w.id === id); + if (widget) { + this.tabBar.currentTitle = widget.title; + } + return widget; + } else if (this.tabBar.currentTitle) { + return this.tabBar.currentTitle.owner; + } else if (this.tabBar.titles.length > 0) { + let index = this.state.lastActiveTabIndex; + if (!index) { + index = 0; + } else if (index >= this.tabBar.titles.length) { + index = this.tabBar.titles.length - 1; + } + const title = this.tabBar.titles[index]; + this.tabBar.currentTitle = title; + return title.owner; + } else { + // Reveal the tab bar and dock panel even if there is no widget + // The next call to `refreshVisibility` will collapse them again + this.state.expansion = SidePanel.ExpansionState.expanding; + let relativeSizes: number[] | undefined; + const parent = this.container.parent; + if (parent instanceof SplitPanel) { + relativeSizes = parent.relativeSizes(); + } + this.container.removeClass(COLLAPSED_CLASS); + this.container.show(); + this.tabBar.show(); + this.dockPanel.node.style.minWidth = '0'; + this.dockPanel.show(); + if (relativeSizes && parent instanceof SplitPanel) { + // Make sure that the expansion animation starts at zero size + parent.setRelativeSizes(relativeSizes); + } + this.setPanelSize(this.options.emptySize).then(() => { + if (this.state.expansion === SidePanel.ExpansionState.expanding) { + this.state.expansion = SidePanel.ExpansionState.expanded; + } + }); + } + } + + /** + * Collapse the sidebar so no items are expanded. + */ + collapse(): Promise { + if (this.tabBar.currentTitle) { + // eslint-disable-next-line no-null/no-null + this.tabBar.currentTitle = null; + } else { + this.refresh(); + } + return animationFrame(); + } + + /** + * Add a widget and its title to the dock panel and side bar. + * + * If the widget is already added, it will be moved. + */ + addWidget(widget: Widget, options: SidePanel.WidgetOptions): void { + if (options.rank) { + SidePanelHandler.rankProperty.set(widget, options.rank); + } + this.dockPanel.addWidget(widget); + } + + /** + * Add a menu to the sidebar top. + * + * If the menu is already added, it will be ignored. + */ + addTopMenu(menu: SidebarMenu): void { + this.topMenu.addMenu(menu); + } + + /** + * Remove a menu from the sidebar top. + * + * @param menuId id of the menu to remove + */ + removeTopMenu(menuId: string): void { + this.topMenu.removeMenu(menuId); + } + + /** + * Add a menu to the sidebar bottom. + * + * If the menu is already added, it will be ignored. + */ + addBottomMenu(menu: SidebarMenu): void { + this.bottomMenu.addMenu(menu); + } + + /** + * Remove a menu from the sidebar bottom. + * + * @param menuId id of the menu to remove + */ + removeBottomMenu(menuId: string): void { + this.bottomMenu.removeMenu(menuId); + } + + // should be a property to preserve fn identity + protected updateToolbarTitle = (): void => { + const currentTitle = this.tabBar && this.tabBar.currentTitle; + this.toolBar.toolbarTitle = currentTitle || undefined; + }; + + /** + * Refresh the visibility of the side bar and dock panel. + */ + refresh(): void { + const container = this.container; + const parent = container.parent; + const tabBar = this.tabBar; + const dockPanel = this.dockPanel; + const isEmpty = tabBar.titles.length === 0; + const currentTitle = tabBar.currentTitle; + // eslint-disable-next-line no-null/no-null + const hideDockPanel = currentTitle === null; + this.updateSashState(this.container, hideDockPanel); + let relativeSizes: number[] | undefined; + + if (hideDockPanel) { + container.addClass(COLLAPSED_CLASS); + if (this.state.expansion === SidePanel.ExpansionState.expanded && !this.state.empty) { + // Update the lastPanelSize property + const size = this.getPanelSize(); + if (size) { + this.state.lastPanelSize = size; + } + } + this.state.expansion = SidePanel.ExpansionState.collapsed; + } else { + container.removeClass(COLLAPSED_CLASS); + let size: number | undefined; + if (this.state.expansion !== SidePanel.ExpansionState.expanded) { + if (this.state.lastPanelSize) { + size = this.state.lastPanelSize; + } else { + size = this.getDefaultPanelSize(); + } + } + if (size) { + // Restore the panel size to the last known size or the default size + this.state.expansion = SidePanel.ExpansionState.expanding; + if (parent instanceof SplitPanel) { + relativeSizes = parent.relativeSizes(); + } + this.setPanelSize(size).then(() => { + if (this.state.expansion === SidePanel.ExpansionState.expanding) { + this.state.expansion = SidePanel.ExpansionState.expanded; + } + }); + } else { + this.state.expansion = SidePanel.ExpansionState.expanded; + } + } + container.setHidden(isEmpty && hideDockPanel); + tabBar.setHidden(isEmpty); + dockPanel.setHidden(hideDockPanel); + this.state.empty = isEmpty; + if (currentTitle) { + dockPanel.selectWidget(currentTitle.owner); + } + if (relativeSizes && parent instanceof SplitPanel) { + // Make sure that the expansion animation starts at the smallest possible size + parent.setRelativeSizes(relativeSizes); + } + } + + /** + * Sets the size of the side panel. + * + * @param size the desired size (width) of the panel in pixels. + */ + resize(size: number): void { + if (this.dockPanel.isHidden) { + this.state.lastPanelSize = size; + } else { + this.setPanelSize(size); + } + } + + /** + * Compute the current width of the panel. This implementation assumes that the parent of + * the panel container is a `SplitPanel`. + */ + protected getPanelSize(): number | undefined { + const parent = this.container.parent; + if (parent instanceof SplitPanel && parent.isVisible) { + const index = parent.widgets.indexOf(this.container); + if (this.side === 'left') { + const handle = parent.handles[index]; + if (!handle.classList.contains('lm-mod-hidden')) { + return handle.offsetLeft; + } + } else if (this.side === 'right') { + const handle = parent.handles[index - 1]; + if (!handle.classList.contains('lm-mod-hidden')) { + const parentWidth = parent.node.clientWidth; + return parentWidth - handle.offsetLeft; + } + } + } + } + + /** + * Determine the default size to apply when the panel is expanded for the first time. + */ + protected getDefaultPanelSize(): number | undefined { + const parent = this.container.parent; + if (parent && parent.isVisible) { + return parent.node.clientWidth * this.options.initialSizeRatio; + } + } + + /** + * Modify the width of the panel. This implementation assumes that the parent of the panel + * container is a `SplitPanel`. + */ + protected setPanelSize(size: number): Promise { + const enableAnimation = this.applicationStateService.state === 'ready'; + const options: SplitPositionOptions = { + side: this.side, + duration: enableAnimation ? this.options.expandDuration : 0, + referenceWidget: this.dockPanel + }; + const promise = this.splitPositionHandler.setSidePanelSize(this.container, size, options); + const result = new Promise(resolve => { + // Resolve the resulting promise in any case, regardless of whether resizing was successful + promise.then(() => resolve(), () => resolve()); + }); + this.state.pendingUpdate = this.state.pendingUpdate.then(() => result); + return result; + } + + protected readonly toDisposeOnCurrentTabChanged = new DisposableCollection(); + + /** + * Handle a `currentChanged` signal from the sidebar. The side panel is refreshed so it displays + * the new selected widget. + */ + protected onCurrentTabChanged(sender: SideTabBar, { currentTitle, currentIndex }: TabBar.ICurrentChangedArgs): void { + this.toDisposeOnCurrentTabChanged.dispose(); + if (currentTitle) { + this.updateToolbarTitle(); + currentTitle.changed.connect(this.updateToolbarTitle); + this.toDisposeOnCurrentTabChanged.push(Disposable.create(() => currentTitle.changed.disconnect(this.updateToolbarTitle))); + } + if (currentIndex >= 0) { + this.state.lastActiveTabIndex = currentIndex; + sender.revealTab(currentIndex); + } + this.refresh(); + } + + /** + * Handle a `tabDetachRequested` signal from the sidebar. A drag is started so the widget can be + * moved to another application shell area. + */ + protected onTabDetachRequested(sender: SideTabBar, + { title, tab, clientX, clientY }: TabBar.ITabDetachRequestedArgs): void { + // Release the tab bar's hold on the mouse + sender.releaseMouse(); + + // Clone the selected tab and use that as drag image + const clonedTab = tab.cloneNode(true) as HTMLElement; + clonedTab.style.width = ''; + clonedTab.style.height = ''; + const label = clonedTab.getElementsByClassName('lm-TabBar-tabLabel')[0] as HTMLElement; + label.style.width = ''; + label.style.height = ''; + + // Create and start a drag to move the selected tab to another panel + const mimeData = new MimeData(); + mimeData.setData('application/vnd.lumino.widget-factory', () => title.owner); + const drag = new Drag({ + mimeData, + dragImage: clonedTab, + proposedAction: 'move', + supportedActions: 'move', + }); + + tab.classList.add('lm-mod-hidden'); + drag.start(clientX, clientY).then(() => { + // The promise is resolved when the drag has ended + tab.classList.remove('lm-mod-hidden'); + }); + } + + protected onTabsOverflowChanged(sender: SideTabBar, event: { titles: Title[], startIndex: number }): void { + if (event.startIndex > 0 && event.startIndex <= sender.currentIndex) { + sender.revealTab(sender.currentIndex); + } else { + this.additionalViewsMenu.updateAdditionalViews(sender, event); + } + } + + /* + * Handle the `widgetAdded` signal from the dock panel. The widget's title is inserted into the + * tab bar according to the `rankProperty` value that may be attached to the widget. + */ + protected onWidgetAdded(sender: DockPanel, widget: Widget): void { + const titles = this.tabBar.titles; + if (!find(titles, t => t.owner === widget)) { + const rank = SidePanelHandler.rankProperty.get(widget); + let index = titles.length; + if (rank !== undefined) { + for (let i = index - 1; i >= 0; i--) { + const r = SidePanelHandler.rankProperty.get(titles[i].owner); + if (r !== undefined && r > rank) { + index = i; + } + } + } + this.tabBar.insertTab(index, widget.title); + this.refresh(); + } + } + + /* + * Handle the `widgetRemoved` signal from the dock panel. The widget's title is also removed + * from the tab bar. + */ + protected onWidgetRemoved(sender: DockPanel, widget: Widget): void { + this.tabBar.removeTab(widget.title); + this.refresh(); + } + + protected updateSashState(sidePanelElement: Panel | null, sidePanelCollapsed: boolean): void { + if (sidePanelElement) { + // Hide the sash when the left/right side panel is collapsed + if (sidePanelElement.id === 'theia-left-content-panel' && sidePanelElement.node.nextElementSibling) { + sidePanelElement.node.nextElementSibling.classList.toggle('sash-hidden', sidePanelCollapsed); + } else if (sidePanelElement.id === 'theia-right-content-panel' && sidePanelElement.node.previousElementSibling) { + sidePanelElement.node.previousElementSibling.classList.toggle('sash-hidden', sidePanelCollapsed); + } + } + } + +} + +export namespace SidePanel { + /** + * Options that control the behavior of side panels. + */ + export interface Options { + /** + * When a widget is being dragged and the distance of the mouse cursor to the shell border + * is below this threshold, the respective side panel is expanded so the widget can be dropped + * into that panel. Set this to `-1` to disable expanding the side panel while dragging. + */ + expandThreshold: number; + /** + * The duration in milliseconds of the animation shown when a side panel is expanded. + * Set this to `0` to disable expansion animation. + */ + expandDuration: number; + /** + * The ratio of the available shell size to use as initial size for the side panel. + */ + initialSizeRatio: number + /** + * How large the panel should be when it's expanded and empty. + */ + emptySize: number; + } + + /** + * The options for adding a widget to a side panel. + */ + export interface WidgetOptions { + /** + * The rank order of the widget among its siblings. + */ + rank?: number; + } + + /** + * Data to save and load the layout of a side panel. + */ + export interface LayoutData { + type: 'sidepanel', + items?: WidgetItem[]; + size?: number; + } + + /** + * Data structure used to save and restore the side panel layout. + */ + export interface WidgetItem extends WidgetOptions { + /** Can be undefined in case the widget could not be restored. */ + widget?: Widget; + expanded?: boolean; + pinned?: boolean; + } + + export interface State { + /** + * Indicates whether the panel is empty. + */ + empty: boolean; + /** + * Indicates whether the panel is expanded, collapsed, or in a transition between the two. + */ + expansion: ExpansionState; + /** + * A promise that is resolved when the currently pending side panel updates are done. + */ + pendingUpdate: Promise; + /** + * The index of the last tab that was selected. When the panel is expanded, it tries to restore + * the tab selection to the previous state. + */ + lastActiveTabIndex?: number; + /** + * The width or height of the panel before it was collapsed. When the panel is expanded, it tries + * to restore its size to this value. + */ + lastPanelSize?: number; + } + + export enum ExpansionState { + collapsed = 'collapsed', + expanding = 'expanding', + expanded = 'expanded', + collapsing = 'collapsing' + } +} diff --git a/packages/core/src/browser/shell/side-panel-toolbar.ts b/packages/core/src/browser/shell/side-panel-toolbar.ts new file mode 100644 index 0000000..6186288 --- /dev/null +++ b/packages/core/src/browser/shell/side-panel-toolbar.ts @@ -0,0 +1,111 @@ +// ***************************************************************************** +// Copyright (C) 2019 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { Widget, Title } from '@lumino/widgets'; +import { TabBarToolbar, TabBarToolbarRegistry, TabBarToolbarFactory } from './tab-bar-toolbar'; +import { Message } from '@lumino/messaging'; +import { BaseWidget } from '../widgets'; +import { Emitter } from '../../common/event'; +import { ContextMenuAccess, Anchor } from '../context-menu-renderer'; + +export class SidePanelToolbar extends BaseWidget { + + protected titleContainer: HTMLElement | undefined; + private _toolbarTitle: Title | undefined; + protected toolbar: TabBarToolbar | undefined; + + protected readonly onContextMenuEmitter = new Emitter(); + readonly onContextMenu = this.onContextMenuEmitter.event; + + constructor( + protected readonly tabBarToolbarRegistry: TabBarToolbarRegistry, + protected readonly tabBarToolbarFactory: TabBarToolbarFactory, + protected readonly side: 'left' | 'right') { + super(); + this.toDispose.push(this.onContextMenuEmitter); + this.init(); + this.tabBarToolbarRegistry.onDidChange(() => this.update()); + } + + protected override onBeforeAttach(msg: Message): void { + super.onBeforeAttach(msg); + if (this.titleContainer) { + this.addEventListener(this.titleContainer, 'contextmenu', e => this.onContextMenuEmitter.fire(e)); + } + } + + protected override onAfterAttach(msg: Message): void { + if (this.toolbar) { + if (this.toolbar.isAttached) { + Widget.detach(this.toolbar); + } + Widget.attach(this.toolbar, this.node); + } + super.onAfterAttach(msg); + } + + protected override onBeforeDetach(msg: Message): void { + if (this.titleContainer) { + this.node.removeChild(this.titleContainer); + } + if (this.toolbar && this.toolbar.isAttached) { + Widget.detach(this.toolbar); + } + super.onBeforeDetach(msg); + } + + protected override onUpdateRequest(msg: Message): void { + super.onUpdateRequest(msg); + this.updateToolbar(); + } + + protected updateToolbar(): void { + if (!this.toolbar) { + return; + } + const widget = this._toolbarTitle?.owner ?? undefined; + this.toolbar.updateTarget(widget); + } + + protected init(): void { + this.titleContainer = document.createElement('div'); + this.titleContainer.classList.add('theia-sidepanel-title'); + this.titleContainer.classList.add('noWrapInfo'); + this.titleContainer.classList.add('noselect'); + this.node.appendChild(this.titleContainer); + this.node.classList.add('theia-sidepanel-toolbar'); + this.node.classList.add(`theia-${this.side}-side-panel`); + this.toolbar = this.tabBarToolbarFactory(); + this.update(); + } + + set toolbarTitle(title: Title | undefined) { + if (this.titleContainer && title) { + this._toolbarTitle = title; + this.titleContainer.innerText = this._toolbarTitle.label; + this.titleContainer.title = this._toolbarTitle.caption || this._toolbarTitle.label; + this.update(); + } + } + + showMoreContextMenu(anchor: Anchor): ContextMenuAccess { + if (this.toolbar) { + return this.toolbar.renderMoreContextMenu(anchor); + } + throw new Error(this.id + ' widget is not attached'); + } + +} diff --git a/packages/core/src/browser/shell/sidebar-bottom-menu-widget.tsx b/packages/core/src/browser/shell/sidebar-bottom-menu-widget.tsx new file mode 100644 index 0000000..f43f2f3 --- /dev/null +++ b/packages/core/src/browser/shell/sidebar-bottom-menu-widget.tsx @@ -0,0 +1,41 @@ +// ***************************************************************************** +// Copyright (C) 2020 Alibaba Inc. and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { SidebarMenuWidget } from './sidebar-menu-widget'; +import { MenuPath } from '../../common/menu'; +import { injectable } from 'inversify'; + +/** + * The menu widget placed on the bottom of the sidebar. + */ +@injectable() +export class SidebarBottomMenuWidget extends SidebarMenuWidget { + + protected override onClick(e: React.MouseEvent, menuPath: MenuPath): void { + const button = e.currentTarget.getBoundingClientRect(); + this.contextMenuRenderer.render({ + menuPath, + includeAnchorArg: false, + anchor: { + x: button.left + button.width, + y: button.top + button.height, + }, + context: e.currentTarget, + contextKeyService: this.contextKeyService + }); + } + +} diff --git a/packages/core/src/browser/shell/sidebar-menu-widget.tsx b/packages/core/src/browser/shell/sidebar-menu-widget.tsx new file mode 100644 index 0000000..9999c69 --- /dev/null +++ b/packages/core/src/browser/shell/sidebar-menu-widget.tsx @@ -0,0 +1,194 @@ +// ***************************************************************************** +// Copyright (C) 2020 Alibaba Inc. and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { injectable, inject } from 'inversify'; +import * as React from 'react'; +import { ReactWidget } from '../widgets'; +import { ContextMenuRenderer } from '../context-menu-renderer'; +import { CompoundMenuNode, MenuModelRegistry, MenuPath } from '../../common/menu'; +import { HoverService } from '../hover-service'; +import { Event, Disposable, Emitter, DisposableCollection } from '../../common'; +import { ContextKeyService } from '../context-key-service'; + +export const SidebarTopMenuWidgetFactory = Symbol('SidebarTopMenuWidgetFactory'); +export const SidebarBottomMenuWidgetFactory = Symbol('SidebarBottomMenuWidgetFactory'); + +export interface SidebarMenu { + id: string; + iconClass: string; + title: string; + menuPath: MenuPath; + onDidBadgeChange?: Event; + /* + * Used to sort menus. The lower the value the lower they are placed in the sidebar. + */ + order: number; +} + +export class SidebarMenuItem implements Disposable { + + readonly menu: SidebarMenu; + get badge(): string { + if (this._badge <= 0) { + return ''; + } else if (this._badge > 99) { + return '99+'; + } else { + return this._badge.toString(); + } + }; + protected readonly onDidBadgeChangeEmitter = new Emitter(); + readonly onDidBadgeChange: Event = this.onDidBadgeChangeEmitter.event; + protected _badge = 0; + + protected readonly toDispose = new DisposableCollection(); + + constructor(menu: SidebarMenu) { + this.menu = menu; + if (menu.onDidBadgeChange) { + this.toDispose.push(menu.onDidBadgeChange(value => { + this._badge = value; + this.onDidBadgeChangeEmitter.fire(value); + })); + } + } + + dispose(): void { + this.toDispose.dispose(); + this.onDidBadgeChangeEmitter.dispose(); + } + +} + +/** + * The menu widget placed on the sidebar. + */ +@injectable() +export class SidebarMenuWidget extends ReactWidget { + protected readonly items: SidebarMenuItem[]; + /** + * The element that had focus when a menu rendered by this widget was activated. + */ + protected preservedContext: HTMLElement | undefined; + /** + * Flag indicating whether a context menu is open. While a context menu is open, the `preservedContext` should not be cleared. + */ + protected preservingContext = false; + + @inject(ContextMenuRenderer) + protected readonly contextMenuRenderer: ContextMenuRenderer; + + @inject(MenuModelRegistry) + protected readonly menuRegistry: MenuModelRegistry; + + @inject(HoverService) + protected readonly hoverService: HoverService; + + @inject(ContextKeyService) + protected readonly contextKeyService: ContextKeyService; + + constructor() { + super(); + this.items = []; + } + + addMenu(menu: SidebarMenu): void { + const exists = this.items.find(item => item.menu.id === menu.id); + if (exists) { + return; + } + const newItem = new SidebarMenuItem(menu); + newItem.onDidBadgeChange(() => this.update()); + this.items.push(newItem); + this.items.sort((a, b) => a.menu.order - b.menu.order); + this.update(); + } + + removeMenu(menuId: string): void { + const index = this.items.findIndex(m => m.menu.id === menuId); + if (index !== -1) { + this.items[index].dispose(); + this.items.splice(index, 1); + this.update(); + } + } + + protected readonly onMouseDown = () => { + const { activeElement } = document; + if (activeElement instanceof HTMLElement && !this.node.contains(activeElement)) { + this.preservedContext = activeElement; + } + }; + + protected readonly onMouseOut = () => { + if (!this.preservingContext) { + this.preservedContext = undefined; + } + }; + + protected readonly onMouseEnter = (event: React.MouseEvent, title: string) => { + if (title && event.nativeEvent.currentTarget) { + this.hoverService.requestHover({ + content: title, + target: event.currentTarget, + position: 'right' + }); + } + }; + + protected onClick(e: React.MouseEvent, menuPath: MenuPath): void { + this.preservingContext = true; + const button = e.currentTarget.getBoundingClientRect(); + const menu = this.menuRegistry.getMenuNode(menuPath) as CompoundMenuNode; + this.contextMenuRenderer.render({ + menuPath: menuPath, + menu: menu, + includeAnchorArg: false, + anchor: { + x: button.left + button.width, + y: button.top, + }, + context: e.currentTarget, + contextKeyService: this.contextKeyService, + onHide: () => { + this.preservingContext = false; + if (this.preservedContext) { + this.preservedContext.focus({ preventScroll: true }); + this.preservedContext = undefined; + } + } + }); + } + + protected render(): React.ReactNode { + return + {this.items.map(item => this.renderItem(item))} + ; + } + + protected renderItem(item: SidebarMenuItem): React.ReactNode { + return
    this.onClick(e, item.menu.menuPath)} + onMouseDown={this.onMouseDown} + onMouseEnter={e => this.onMouseEnter(e, item.menu.title)} + onMouseLeave={this.onMouseOut}> + + {item.badge &&
    {item.badge}
    } +
    ; + } +} diff --git a/packages/core/src/browser/shell/sidebar-top-menu-widget.tsx b/packages/core/src/browser/shell/sidebar-top-menu-widget.tsx new file mode 100644 index 0000000..983e74a --- /dev/null +++ b/packages/core/src/browser/shell/sidebar-top-menu-widget.tsx @@ -0,0 +1,26 @@ +// ***************************************************************************** +// Copyright (C) 2020 Alibaba Inc. and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { SidebarMenuWidget } from './sidebar-menu-widget'; +import { injectable } from 'inversify'; + +/** + * The menu widget placed on the top of the sidebar. + */ +@injectable() +export class SidebarTopMenuWidget extends SidebarMenuWidget { + +} diff --git a/packages/core/src/browser/shell/split-panels.ts b/packages/core/src/browser/shell/split-panels.ts new file mode 100644 index 0000000..6b71aa1 --- /dev/null +++ b/packages/core/src/browser/shell/split-panels.ts @@ -0,0 +1,191 @@ +// ***************************************************************************** +// Copyright (C) 2018 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { injectable } from 'inversify'; +import { SplitPanel, SplitLayout, Widget } from '@lumino/widgets'; + +export interface SplitPositionOptions { + /** The side of the side panel that shall be resized. */ + side?: 'left' | 'right' | 'top' | 'bottom'; + /** The duration in milliseconds, or 0 for no animation. */ + duration: number; + /** When this widget is hidden, the animation is canceled. */ + referenceWidget?: Widget; +} + +export interface MoveEntry extends SplitPositionOptions { + parent: SplitPanel; + index: number; + started: boolean; + ended: boolean; + targetSize?: number; + targetPosition?: number; + startPosition?: number; + startTime?: number; + resolve?: (position: number) => void; + reject?: (reason: string) => void; +} + +@injectable() +export class SplitPositionHandler { + + private readonly splitMoves: MoveEntry[] = []; + private currentMoveIndex: number = 0; + + /** + * Set the position of a split handle asynchronously. This function makes sure that such movements + * are performed one after another in order to prevent the movements from overriding each other. + * When resolved, the returned promise yields the final position of the split handle. + */ + setSplitHandlePosition(parent: SplitPanel, index: number, targetPosition: number, options: SplitPositionOptions): Promise { + const move: MoveEntry = { + ...options, + parent, targetPosition, index, + started: false, + ended: false + }; + return this.moveSplitPos(move); + } + + /** + * Resize a side panel asynchronously. This function makes sure that such movements are performed + * one after another in order to prevent the movements from overriding each other. + * When resolved, the returned promise yields the final position of the split handle. + */ + setSidePanelSize(sidePanel: Widget, targetSize: number, options: SplitPositionOptions): Promise { + if (targetSize < 0) { + return Promise.reject(new Error('Cannot resize to negative value.')); + } + const parent = sidePanel.parent; + if (!(parent instanceof SplitPanel)) { + return Promise.reject(new Error('Widget must be contained in a SplitPanel.')); + } + let index = parent.widgets.indexOf(sidePanel); + if (index > 0 && (options.side === 'right' || options.side === 'bottom')) { + index--; + } + const move: MoveEntry = { + ...options, + parent, targetSize, index, + started: false, + ended: false + }; + return this.moveSplitPos(move); + } + + protected moveSplitPos(move: MoveEntry): Promise { + return new Promise((resolve, reject) => { + move.resolve = resolve; + move.reject = reject; + if (this.splitMoves.length === 0) { + setTimeout(this.animationFrame.bind(this), 10); + } + this.splitMoves.push(move); + }); + } + + protected animationFrame(): void { + const time = Date.now(); + const move = this.splitMoves[this.currentMoveIndex]; + let rejectedOrResolved = false; + if (move.ended || move.referenceWidget && move.referenceWidget.isHidden) { + this.splitMoves.splice(this.currentMoveIndex, 1); + if (move.startPosition === undefined || move.targetPosition === undefined) { + move.reject!('Panel is not visible.'); + } else { + move.resolve!(move.targetPosition); + } + rejectedOrResolved = true; + } else if (!move.started) { + this.startMove(move, time); + if (move.duration <= 0 || move.startPosition === undefined || move.targetPosition === undefined + || move.startPosition === move.targetPosition) { + this.endMove(move); + } + } else { + const elapsedTime = time - move.startTime!; + if (elapsedTime >= move.duration) { + this.endMove(move); + } else { + const t = elapsedTime / move.duration; + const start = move.startPosition || 0; + const target = move.targetPosition || 0; + const pos = start + (target - start) * t; + (move.parent.layout as SplitLayout).moveHandle(move.index, pos); + } + } + if (!rejectedOrResolved) { + this.currentMoveIndex++; + } + if (this.currentMoveIndex >= this.splitMoves.length) { + this.currentMoveIndex = 0; + } + if (this.splitMoves.length > 0) { + setTimeout(this.animationFrame.bind(this)); + } + } + + protected startMove(move: MoveEntry, time: number): void { + if (move.targetPosition === undefined && move.targetSize !== undefined) { + const { clientWidth, clientHeight } = move.parent.node; + if (clientWidth && clientHeight) { + switch (move.side) { + case 'left': + move.targetPosition = Math.max(Math.min(move.targetSize, clientWidth), 0); + break; + case 'right': + move.targetPosition = Math.max(Math.min(clientWidth - move.targetSize, clientWidth), 0); + break; + case 'top': + move.targetPosition = Math.max(Math.min(move.targetSize, clientHeight), 0); + break; + case 'bottom': + move.targetPosition = Math.max(Math.min(clientHeight - move.targetSize, clientHeight), 0); + break; + } + } + } + if (move.startPosition === undefined) { + move.startPosition = this.getCurrentPosition(move); + } + move.startTime = time; + move.started = true; + } + + protected endMove(move: MoveEntry): void { + if (move.targetPosition !== undefined) { + (move.parent.layout as SplitLayout).moveHandle(move.index, move.targetPosition); + } + move.ended = true; + } + + protected getCurrentPosition(move: MoveEntry): number | undefined { + const layout = move.parent.layout as SplitLayout; + let pos: number | null; + if (layout.orientation === 'horizontal') { + pos = layout.handles[move.index].offsetLeft; + } else { + pos = layout.handles[move.index].offsetTop; + } + // eslint-disable-next-line no-null/no-null + if (pos !== null) { + return pos; + } else { + return undefined; + } + } + +} diff --git a/packages/core/src/browser/shell/tab-bar-decorator.ts b/packages/core/src/browser/shell/tab-bar-decorator.ts new file mode 100644 index 0000000..bf2a149 --- /dev/null +++ b/packages/core/src/browser/shell/tab-bar-decorator.ts @@ -0,0 +1,106 @@ +// ***************************************************************************** +// Copyright (C) 2019 Ericsson and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import debounce = require('lodash.debounce'); +import { Title, Widget } from '@lumino/widgets'; +import { inject, injectable, named } from 'inversify'; +import { ContributionProvider, Emitter, Event } from '../../common'; +import { ColorRegistry } from '../color-registry'; +import { Decoration, DecorationsService, DecorationsServiceImpl } from '../decorations-service'; +import { FrontendApplicationContribution } from '../frontend-application-contribution'; +import { Navigatable } from '../navigatable-types'; +import { WidgetDecoration } from '../widget-decoration'; + +export const TabBarDecorator = Symbol('TabBarDecorator'); + +export interface TabBarDecorator { + + /** + * The unique identifier of the tab bar decorator. + */ + readonly id: string; + + /** + * Event that is fired when any of the available tab bar decorators has changes. + */ + readonly onDidChangeDecorations: Event; + + /** + * Decorate title. + * @param {Title} title the title + * @returns decoration data. + */ + decorate(title: Title): WidgetDecoration.Data[]; +} + +@injectable() +export class TabBarDecoratorService implements FrontendApplicationContribution { + + protected readonly onDidChangeDecorationsEmitter = new Emitter(); + + readonly onDidChangeDecorations = this.onDidChangeDecorationsEmitter.event; + + @inject(ContributionProvider) @named(TabBarDecorator) + protected readonly contributions: ContributionProvider; + + @inject(DecorationsService) + protected readonly decorationsService: DecorationsServiceImpl; + + @inject(ColorRegistry) + protected readonly colors: ColorRegistry; + + initialize(): void { + this.contributions.getContributions().map(decorator => decorator.onDidChangeDecorations(this.fireDidChangeDecorations)); + } + + fireDidChangeDecorations = debounce(() => this.onDidChangeDecorationsEmitter.fire(undefined), 150); + + /** + * Assign tabs the decorators provided by all the contributions. + * @param {Title} title the title + * @returns an array of its decoration data. + */ + getDecorations(title: Title): WidgetDecoration.Data[] { + const decorators = this.contributions.getContributions(); + const decorations: WidgetDecoration.Data[] = []; + for (const decorator of decorators) { + decorations.push(...decorator.decorate(title)); + } + if (Navigatable.is(title.owner)) { + const resourceUri = title.owner.getResourceUri(); + if (resourceUri) { + const serviceDecorations = this.decorationsService.getDecoration(resourceUri, false); + decorations.push(...serviceDecorations.map(d => this.fromDecoration(d))); + } + } + return decorations; + } + + protected fromDecoration(decoration: Decoration): WidgetDecoration.Data { + const colorVariable = decoration.colorId && this.colors.toCssVariableName(decoration.colorId); + return { + tailDecorations: [ + { + data: decoration.letter ? decoration.letter : '', + fontData: { + color: colorVariable && `var(${colorVariable})` + }, + tooltip: decoration.tooltip ? decoration.tooltip : '' + } + ] + }; + } +} diff --git a/packages/core/src/browser/shell/tab-bar-toolbar/index.ts b/packages/core/src/browser/shell/tab-bar-toolbar/index.ts new file mode 100644 index 0000000..124c457 --- /dev/null +++ b/packages/core/src/browser/shell/tab-bar-toolbar/index.ts @@ -0,0 +1,19 @@ +// ***************************************************************************** +// Copyright (C) 2022 Ericsson and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +export * from './tab-bar-toolbar'; +export * from './tab-bar-toolbar-registry'; +export * from './tab-bar-toolbar-types'; diff --git a/packages/core/src/browser/shell/tab-bar-toolbar/tab-bar-toolbar-menu-adapters.tsx b/packages/core/src/browser/shell/tab-bar-toolbar/tab-bar-toolbar-menu-adapters.tsx new file mode 100644 index 0000000..b5a106f --- /dev/null +++ b/packages/core/src/browser/shell/tab-bar-toolbar/tab-bar-toolbar-menu-adapters.tsx @@ -0,0 +1,338 @@ +// ***************************************************************************** +// Copyright (C) 2022 Ericsson and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { Widget } from '@lumino/widgets'; +import * as React from 'react'; +import { CommandRegistry, Event } from '../../../common'; +import { NAVIGATION, RenderedToolbarAction } from './tab-bar-toolbar-types'; +import { TabBarToolbar, toAnchor } from './tab-bar-toolbar'; +import { ACTION_ITEM, codicon } from '../../widgets'; +import { ContextMenuRenderer } from '../../context-menu-renderer'; +import { TabBarToolbarItem } from './tab-toolbar-item'; +import { ContextKeyService, ContextMatcher } from '../../context-key-service'; +import { CommandMenu, CompoundMenuNode, ContextExpressionMatcher, Group, MenuModelRegistry, MenuNode, MenuPath, RenderedMenuNode, Submenu } from '../../../common/menu'; + +export const TOOLBAR_WRAPPER_ID_SUFFIX = '-as-tabbar-toolbar-item'; + +abstract class AbstractToolbarMenuWrapper { + + constructor( + readonly effectiveMenuPath: MenuPath, + protected readonly commandRegistry: CommandRegistry, + protected readonly menuRegistry: MenuModelRegistry, + protected readonly contextKeyService: ContextKeyService, + protected readonly contextMenuRenderer: ContextMenuRenderer) { + } + + protected abstract menuNode: MenuNode | undefined; + protected abstract id: string; + protected abstract icon: string | undefined; + protected abstract tooltip: string | undefined; + protected abstract text: string | undefined; + protected abstract executeCommand(widget: Widget, e: React.MouseEvent): void; + + isEnabled(widget: Widget): boolean { + if (CommandMenu.is(this.menuNode)) { + return this.menuNode.isEnabled(this.effectiveMenuPath, widget); + } + return true; + } + isToggled(widget: Widget): boolean { + if (CommandMenu.is(this.menuNode) && this.menuNode.isToggled) { + return !!this.menuNode.isToggled(this.effectiveMenuPath, widget); + } + return false; + } + render(widget: Widget): React.ReactNode { + return this.renderMenuItem(widget); + } + + abstract toMenuNode(): MenuNode | undefined; + + /** + * Presents the menu to popup on the `event` that is the clicking of + * a menu toolbar item. + * + * @param menuPath the path of the registered menu to show + * @param event the mouse event triggering the menu + */ + showPopupMenu(widget: Widget | undefined, menuPath: MenuPath, event: React.MouseEvent, contextMatcher: ContextMatcher): void { + event.stopPropagation(); + event.preventDefault(); + const anchor = toAnchor(event); + + this.contextMenuRenderer.render({ + menuPath: this.effectiveMenuPath, + menu: this.menuNode as CompoundMenuNode, + args: [widget], + anchor, + context: widget?.node || event.target as HTMLElement, + contextKeyService: contextMatcher, + }); + } + + /** + * Renders a toolbar item that is a menu, presenting it as a button with a little + * chevron decoration that pops up a floating menu when clicked. + * + * @param item a toolbar item that is a menu item + * @returns the rendered toolbar item + */ + protected renderMenuItem(widget: Widget): React.ReactNode { + const icon = this.icon || 'ellipsis'; + const contextMatcher: ContextMatcher = this.contextKeyService; + const className = `${icon} ${ACTION_ITEM}`; + if (CompoundMenuNode.is(this.menuNode) && !this.menuNode.isEmpty(this.effectiveMenuPath, this.contextKeyService, widget.node)) { + return
    +
    this.executeCommand(widget, e)} + /> +
    this.showPopupMenu(widget, this.effectiveMenuPath!, event, contextMatcher)} > +
    +
    +
    ; + } else { + return
    +
    this.executeCommand(widget, e)} + /> +
    ; + } + } +} + +export class SubmenuAsToolbarItemWrapper extends AbstractToolbarMenuWrapper implements TabBarToolbarItem { + constructor( + effectiveMenuPath: MenuPath, + commandRegistry: CommandRegistry, + menuRegistry: MenuModelRegistry, + contextKeyService: ContextKeyService, + contextMenuRenderer: ContextMenuRenderer, + protected readonly menuNode: Submenu, + readonly group: string | undefined) { + super(effectiveMenuPath, commandRegistry, menuRegistry, contextKeyService, contextMenuRenderer); + } + priority?: number | undefined; + + executeCommand(widget: Widget, e: React.MouseEvent): void { + } + + isVisible(widget: Widget): boolean { + const menuNodeVisible = this.menuNode.isVisible(this.effectiveMenuPath, this.contextKeyService, widget.node, widget); + return menuNodeVisible && !MenuModelRegistry.isEmpty(this.menuNode); + } + + get id(): string { return this.menuNode.id + TOOLBAR_WRAPPER_ID_SUFFIX; } + get icon(): string | undefined { return this.menuNode.icon; } + get tooltip(): string | undefined { return this.menuNode.label; } + get text(): string | undefined { + return (this.group === NAVIGATION || this.group === undefined) ? undefined : this.menuNode.label; + } + get onDidChange(): Event | undefined { + return this.menuNode.onDidChange; + } + + override toMenuNode(): Group | undefined { + return new ToolbarItemAsSubmenuWrapper(this.menuNode!, this.effectiveMenuPath); + }; +} + +export class CommandMenuAsToolbarItemWrapper extends AbstractToolbarMenuWrapper implements TabBarToolbarItem { + constructor( + effectiveMenuPath: MenuPath, + commandRegistry: CommandRegistry, + menuRegistry: MenuModelRegistry, + contextKeyService: ContextKeyService, + contextMenuRenderer: ContextMenuRenderer, + protected readonly menuNode: CommandMenu, + readonly group: string | undefined) { + super(effectiveMenuPath, commandRegistry, menuRegistry, contextKeyService, contextMenuRenderer); + } + + isVisible(widget: Widget): boolean { + return this.menuNode.isVisible(this.effectiveMenuPath, this.contextKeyService, widget.node, widget); + } + + executeCommand(widget: Widget, e: React.MouseEvent): void { + this.menuNode.run(this.effectiveMenuPath, widget); + } + + get id(): string { return this.menuNode.id + TOOLBAR_WRAPPER_ID_SUFFIX; } + get icon(): string | undefined { return this.menuNode.icon; } + get tooltip(): string | undefined { return this.menuNode.label; } + get text(): string | undefined { + return (this.group === NAVIGATION || this.group === undefined) ? undefined : this.menuNode.label; + } + get onDidChange(): Event | undefined { + return this.menuNode.onDidChange; + } + + override toMenuNode(): MenuNode | undefined { + return new ToolbarItemAsCommandMenuWrapper(this.menuNode, this.effectiveMenuPath); + } +} + +export class ToolbarActionWrapper extends AbstractToolbarMenuWrapper implements TabBarToolbarItem { + constructor( + effectiveMenuPath: MenuPath, + commandRegistry: CommandRegistry, + menuRegistry: MenuModelRegistry, + contextKeyService: ContextKeyService, + contextMenuRenderer: ContextMenuRenderer, + protected readonly toolbarItem: RenderedToolbarAction + ) { + super(effectiveMenuPath, commandRegistry, menuRegistry, contextKeyService, contextMenuRenderer); + } + + override isEnabled(widget?: Widget): boolean { + return this.toolbarItem.command ? this.commandRegistry.isEnabled(this.toolbarItem.command, widget) : !!this.toolbarItem.menuPath; + } + + protected executeCommand(widget: Widget, e: React.MouseEvent): void { + e.preventDefault(); + e.stopPropagation(); + + if (!this.isEnabled(widget)) { + return; + } + + if (this.toolbarItem.command) { + this.commandRegistry.executeCommand(this.toolbarItem.command, widget); + } + }; + + isVisible(widget: Widget): boolean { + const menuNode = this.menuNode; + if (this.toolbarItem.isVisible && !this.toolbarItem.isVisible(widget)) { + return false; + } + if (!menuNode?.isVisible(this.effectiveMenuPath, this.contextKeyService, widget.node, widget)) { + return false; + } + if (this.toolbarItem.command) { + return true; + } + if (CompoundMenuNode.is(menuNode)) { + return !menuNode.isEmpty(this.effectiveMenuPath, this.contextKeyService, widget.node, widget); + } + return true; + } + group?: string | undefined; + priority?: number | undefined; + + get id(): string { return this.toolbarItem.id; } + get icon(): string | undefined { + if (typeof this.toolbarItem.icon === 'function') { + return this.toolbarItem.icon(); + } + if (this.toolbarItem.icon) { + return this.toolbarItem.icon; + } + if (this.toolbarItem.command) { + const command = this.commandRegistry.getCommand(this.toolbarItem.command); + return command?.iconClass; + } + return undefined; + } + get tooltip(): string | undefined { return this.toolbarItem.tooltip; } + get text(): string | undefined { return (this.toolbarItem.group === NAVIGATION || this.toolbarItem.group === undefined) ? undefined : this.toolbarItem.text; } + get onDidChange(): Event | undefined { + return this.menuNode?.onDidChange; + } + + get menuPath(): MenuPath { + return this.toolbarItem.menuPath!; + } + + get menuNode(): CompoundMenuNode | undefined { + return this.menuRegistry.getMenu(this.menuPath); + } + + override toMenuNode(): MenuNode | undefined { + return new ToolbarItemAsSubmenuWrapper(this.menuNode!, this.effectiveMenuPath); + } +} + +/** + * This class wraps a menu node, but replaces the effective menu path. Command parameters need to be mapped + * for commands contributed by extension and this mapping is keyed by the menu path + */ +abstract class AbstractMenuNodeAsToolbarItemWrapper { + constructor(protected readonly menuNode: T, readonly effectiveMenuPath: MenuPath) { } + + get label(): string | undefined { + if (RenderedMenuNode.is(this.menuNode)) { + return this.menuNode.label; + } + }; + /** + * Icon classes for the menu node. If present, these will produce an icon to the left of the label in browser-style menus. + */ + get icon(): string | undefined { + if (RenderedMenuNode.is(this.menuNode)) { + return this.menuNode.label; + } + } + get id(): string { + return this.menuNode.id; + } + get sortString(): string { + return this.menuNode.sortString; + } + + isVisible(effectiveMenuPath: MenuPath, contextMatcher: ContextExpressionMatcher, context: K | undefined, ...args: unknown[]): boolean { + return this.menuNode!.isVisible(this.effectiveMenuPath, contextMatcher, context, args); + } +} + +/** + * Wrapper form submenu nodes + */ +class ToolbarItemAsSubmenuWrapper extends AbstractMenuNodeAsToolbarItemWrapper implements Group { + + get contextKeyOverlays(): Record | undefined { + return this.menuNode.contextKeyOverlays; + } + isEmpty(effectiveMenuPath: MenuPath, contextMatcher: ContextExpressionMatcher, context: T | undefined, ...args: unknown[]): boolean { + return this.menuNode.isEmpty(this.effectiveMenuPath, contextMatcher, context, args); + } + get children(): MenuNode[] { + return this.menuNode.children; + } + +} +/** + * Wrapper for command menus + */ +class ToolbarItemAsCommandMenuWrapper extends AbstractMenuNodeAsToolbarItemWrapper implements CommandMenu { + + isEnabled(effectiveMenuPath: MenuPath, ...args: unknown[]): boolean { + return this.menuNode.isEnabled(this.effectiveMenuPath, ...args); + } + isToggled(effectiveMenuPath: MenuPath, ...args: unknown[]): boolean { + return this.menuNode.isToggled(this.effectiveMenuPath, ...args); + } + run(effectiveMenuPath: MenuPath, ...args: unknown[]): Promise { + return this.menuNode.run(this.effectiveMenuPath, args); + } + + override get label(): string { + return super.label!; + } + +} diff --git a/packages/core/src/browser/shell/tab-bar-toolbar/tab-bar-toolbar-registry.ts b/packages/core/src/browser/shell/tab-bar-toolbar/tab-bar-toolbar-registry.ts new file mode 100644 index 0000000..7193c1a --- /dev/null +++ b/packages/core/src/browser/shell/tab-bar-toolbar/tab-bar-toolbar-registry.ts @@ -0,0 +1,208 @@ +// ***************************************************************************** +// Copyright (C) 2022 Ericsson and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import debounce = require('lodash.debounce'); +import { inject, injectable, named } from 'inversify'; +// eslint-disable-next-line max-len +import { CommandRegistry, ContributionProvider, Disposable, DisposableCollection, Emitter, Event, MenuModelRegistry, MenuPath } from '../../../common'; +import { ContextKeyService } from '../../context-key-service'; +import { FrontendApplicationContribution } from '../../frontend-application-contribution'; +import { Widget } from '../../widgets'; +import { ReactTabBarToolbarAction, RenderedToolbarAction } from './tab-bar-toolbar-types'; +import { CommandMenuAsToolbarItemWrapper, SubmenuAsToolbarItemWrapper, ToolbarActionWrapper } from './tab-bar-toolbar-menu-adapters'; +import { KeybindingRegistry } from '../../keybinding'; +import { LabelParser } from '../../label-parser'; +import { ContextMenuRenderer } from '../../context-menu-renderer'; +import { CommandMenu, CompoundMenuNode, RenderedMenuNode } from '../../../common/menu'; +import { ReactToolbarItemImpl, RenderedToolbarItemImpl, TabBarToolbarItem } from './tab-toolbar-item'; + +/** + * Clients should implement this interface if they want to contribute to the tab-bar toolbar. + */ +export const TabBarToolbarContribution = Symbol('TabBarToolbarContribution'); +/** + * Representation of a tabbar toolbar contribution. + */ +export interface TabBarToolbarContribution { + /** + * Registers toolbar items. + * @param registry the tabbar toolbar registry. + */ + registerToolbarItems(registry: TabBarToolbarRegistry): void; +} + +const menuDelegateSeparator = '=@='; +interface MenuDelegate { + menuPath: MenuPath; + isVisible(widget?: Widget): boolean; +} +/** + * Main, shared registry for tab-bar toolbar items. + */ +@injectable() +export class TabBarToolbarRegistry implements FrontendApplicationContribution { + + protected items = new Map(); + protected menuDelegates = new Map(); + + @inject(CommandRegistry) protected readonly commandRegistry: CommandRegistry; + @inject(ContextKeyService) protected readonly contextKeyService: ContextKeyService; + @inject(MenuModelRegistry) protected readonly menuRegistry: MenuModelRegistry; + @inject(KeybindingRegistry) protected readonly keybindingRegistry: KeybindingRegistry; + @inject(LabelParser) protected readonly labelParser: LabelParser; + @inject(ContextMenuRenderer) protected readonly contextMenuRenderer: ContextMenuRenderer; + + @inject(ContributionProvider) @named(TabBarToolbarContribution) + protected readonly contributionProvider: ContributionProvider; + + protected readonly onDidChangeEmitter = new Emitter(); + readonly onDidChange: Event = this.onDidChangeEmitter.event; + // debounce in order to avoid to fire more than once in the same tick + protected fireOnDidChange = debounce(() => this.onDidChangeEmitter.fire(undefined), 0); + + onStart(): void { + const contributions = this.contributionProvider.getContributions(); + for (const contribution of contributions) { + contribution.registerToolbarItems(this); + } + } + + /** + * Registers the given item. Throws an error, if the corresponding command cannot be found or an item has been already registered for the desired command. + * + * @param item the item to register. + */ + registerItem(item: RenderedToolbarAction | ReactTabBarToolbarAction): Disposable { + if (ReactTabBarToolbarAction.is(item)) { + return this.doRegisterItem(new ReactToolbarItemImpl(this.commandRegistry, this.contextKeyService, item)); + } else { + if (item.menuPath) { + return this.doRegisterItem(new ToolbarActionWrapper(item.menuPath, + this.commandRegistry, this.menuRegistry, this.contextKeyService, this.contextMenuRenderer, item)); + } else { + const wrapper = new RenderedToolbarItemImpl(this.commandRegistry, this.contextKeyService, this.keybindingRegistry, this.labelParser, item); + const disposables = this.doRegisterItem(wrapper); + disposables.push(wrapper); + return disposables; + } + } + } + + doRegisterItem(item: TabBarToolbarItem): DisposableCollection { + if (this.items.has(item.id)) { + throw new Error(`A toolbar item is already registered with the '${item.id}' ID.`); + } + this.items.set(item.id, item); + this.fireOnDidChange(); + const toDispose = new DisposableCollection( + Disposable.create(() => { + this.items.delete(item.id); + this.fireOnDidChange(); + }) + ); + + if (item.onDidChange) { + toDispose.push(item.onDidChange(() => this.fireOnDidChange())); + } + return toDispose; + } + + /** + * Returns an array of tab-bar toolbar items which are visible when the `widget` argument is the current one. + * + * By default returns with all items where the command is enabled and `item.isVisible` is `true`. + */ + visibleItems(widget: Widget): Array { + if (widget.isDisposed) { + return []; + } + const result: Array = []; + for (const item of this.items.values()) { + if (item.isVisible(widget)) { + result.push(item); + } + } + + for (const delegate of this.menuDelegates.values()) { + if (delegate.isVisible(widget)) { + const menu = this.menuRegistry.getMenu(delegate.menuPath); + if (menu) { + for (const child of menu.children) { + if (child.isVisible([...delegate.menuPath, child.id], this.contextKeyService, widget.node)) { + if (CompoundMenuNode.is(child)) { + for (const grandchild of child.children) { + if (grandchild.isVisible([...delegate.menuPath, child.id, grandchild.id], + this.contextKeyService, widget.node) && RenderedMenuNode.is(grandchild)) { + if (CommandMenu.is(grandchild)) { + result.push(new CommandMenuAsToolbarItemWrapper([...delegate.menuPath, child.id, grandchild.id], this.commandRegistry, + this.menuRegistry, this.contextKeyService, this.contextMenuRenderer, grandchild, child.id)); + } else if (CompoundMenuNode.is(grandchild)) { + result.push(new SubmenuAsToolbarItemWrapper([...delegate.menuPath, child.id, grandchild.id], this.commandRegistry, this.menuRegistry, + this.contextKeyService, this.contextMenuRenderer, grandchild, child.id)); + } + + } + } + } else if (CommandMenu.is(child)) { + result.push(new CommandMenuAsToolbarItemWrapper([...delegate.menuPath, child.id], this.commandRegistry, this.menuRegistry, + this.contextKeyService, this.contextMenuRenderer, child, undefined)); + } + } + } + } + } + } + return result; + } + + unregisterItem(id: string): void { + if (this.items.delete(id)) { + this.fireOnDidChange(); + } + } + + registerMenuDelegate(menuPath: MenuPath, when?: ((widget: Widget) => boolean)): Disposable { + const id = this.toElementId(menuPath); + if (!this.menuDelegates.has(id)) { + + this.menuDelegates.set(id, { + menuPath, isVisible: (widget: Widget) => !when || when(widget) + }); + this.fireOnDidChange(); + return { dispose: () => this.unregisterMenuDelegate(menuPath) }; + } + console.warn('Unable to register menu delegate. Delegate has already been registered', menuPath); + return Disposable.NULL; + } + + unregisterMenuDelegate(menuPath: MenuPath): void { + if (this.menuDelegates.delete(this.toElementId(menuPath))) { + this.fireOnDidChange(); + } + } + + /** + * Generate a single ID string from a menu path that + * is likely to be unique amongst the items in the toolbar. + * + * @param menuPath a menubar path + * @returns a likely unique ID based on the path + */ + toElementId(menuPath: MenuPath): string { + return menuPath.join(menuDelegateSeparator); + } + +} diff --git a/packages/core/src/browser/shell/tab-bar-toolbar/tab-bar-toolbar-types.ts b/packages/core/src/browser/shell/tab-bar-toolbar/tab-bar-toolbar-types.ts new file mode 100644 index 0000000..f383689 --- /dev/null +++ b/packages/core/src/browser/shell/tab-bar-toolbar/tab-bar-toolbar-types.ts @@ -0,0 +1,140 @@ +// ***************************************************************************** +// Copyright (C) 2022 Ericsson and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import * as React from 'react'; +import { ArrayUtils, Event, isFunction, isObject } from '../../../common'; +import { Widget } from '../../widgets'; +import { MenuPath } from '../../../common/menu'; + +/** Items whose group is exactly 'navigation' will be rendered inline. */ +export const NAVIGATION = 'navigation'; +export const TAB_BAR_TOOLBAR_CONTEXT_MENU = ['TAB_BAR_TOOLBAR_CONTEXT_MENU']; + +export interface TabBarDelegator extends Widget { + getTabBarDelegate(): Widget | undefined; +} + +export namespace TabBarDelegator { + export function is(candidate?: Widget): candidate is TabBarDelegator { + return isObject(candidate) && isFunction(candidate.getTabBarDelegate); + } +} + +export type TabBarToolbarAction = RenderedToolbarAction | ReactTabBarToolbarAction; + +/** + * Representation of an item in the tab + */ +export interface TabBarToolbarActionBase { + /** + * The unique ID of the toolbar item. + */ + id: string; + /** + * The command to execute when the item is selected. + */ + command?: string; + + /** + * https://code.visualstudio.com/docs/getstarted/keybindings#_when-clause-contexts + */ + when?: string; + /** + * Checked before the item is shown. + */ + isVisible?(widget?: Widget): boolean; + + /** + * When defined, the container tool-bar will be updated if this event is fired. + * + * Note: currently, each item of the container toolbar will be re-rendered if any of the items have changed. + */ + onDidChange?: Event; + + /** + * Priority among the items. Can be negative. The smaller the number the left-most the item will be placed in the toolbar. It is `0` by default. + */ + priority?: number; + group?: string; + /** + * A menu path with which this item is associated. + */ + menuPath?: MenuPath; + + /** + * Optional ordering string for placing the item within its group + */ + order?: string; +} + +export interface RenderedToolbarAction extends TabBarToolbarActionBase { + /** + * Optional icon for the item. + */ + icon?: string | (() => string); + + /** + * Optional text of the item. + * + * Strings in the format `$(iconIdentifier~animationType) will be treated as icon references. + * If the iconIdentifier begins with fa-, Font Awesome icons will be used; otherwise it will be treated as Codicon name. + * + * You can find Codicon classnames here: https://microsoft.github.io/vscode-codicons/dist/codicon.html + * You can find Font Awesome classnames here: http://fontawesome.io/icons/ + * The type of animation can be either `spin` or `pulse`. + */ + text?: string; + + /** + * Optional tooltip for the item. + */ + tooltip?: string; +} + +/** + * Tab-bar toolbar item backed by a `React.ReactNode`. + * Unlike the `TabBarToolbarAction`, this item is not connected to the command service. + */ +export interface ReactTabBarToolbarAction extends TabBarToolbarActionBase { + render(widget?: Widget): React.ReactNode; +} + +export namespace ReactTabBarToolbarAction { + export function is(item: TabBarToolbarAction): item is ReactTabBarToolbarAction { + return isObject(item) && typeof item.render === 'function'; + } +} + +export namespace TabBarToolbarAction { + + /** + * Compares the items by `priority` in ascending. Undefined priorities will be treated as `0`. + */ + export const PRIORITY_COMPARATOR = (left: { group?: string, priority?: number }, right: { group?: string, priority?: number }) => { + const leftGroup: string = left.group ?? NAVIGATION; + const rightGroup: string = right.group ?? NAVIGATION; + if (leftGroup === NAVIGATION && rightGroup !== NAVIGATION) { + return ArrayUtils.Sort.LeftBeforeRight; + } + if (rightGroup === NAVIGATION && leftGroup !== NAVIGATION) { + return ArrayUtils.Sort.RightBeforeLeft; + } + if (leftGroup !== rightGroup) { + return leftGroup.localeCompare(rightGroup); + } + return (left.priority || 0) - (right.priority || 0); + }; +} diff --git a/packages/core/src/browser/shell/tab-bar-toolbar/tab-bar-toolbar.spec.ts b/packages/core/src/browser/shell/tab-bar-toolbar/tab-bar-toolbar.spec.ts new file mode 100644 index 0000000..6736f6b --- /dev/null +++ b/packages/core/src/browser/shell/tab-bar-toolbar/tab-bar-toolbar.spec.ts @@ -0,0 +1,62 @@ +// ***************************************************************************** +// Copyright (C) 2019 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { enableJSDOM } from '../../test/jsdom'; + +let disableJSDOM = enableJSDOM(); +import { expect } from 'chai'; +import { TabBarToolbarAction } from './tab-bar-toolbar-types'; + +disableJSDOM(); + +describe('tab-bar-toolbar', () => { + + describe('comparator', () => { + + before(() => { + disableJSDOM = enableJSDOM(); + }); + + after(() => { + disableJSDOM(); + }); + + const testMe = TabBarToolbarAction.PRIORITY_COMPARATOR; + + it("should favour the 'navigation' group before everything else", () => { + expect(testMe({ group: 'navigation' }, { group: 'other' })).to.be.equal(-1); + }); + + it("should treat 'undefined' groups as 'navigation'", () => { + expect(testMe({}, {})).to.be.equal(0); + expect(testMe({ group: 'navigation' }, {})).to.be.equal(0); + expect(testMe({}, { group: 'navigation' })).to.be.equal(0); + expect(testMe({}, { group: 'other' })).to.be.equal(-1); + }); + + it("should fall back to 'priority' if the groups are the same", () => { + expect(testMe({ priority: 1 }, { priority: 2 })).to.be.equal(-1); + expect(testMe({ group: 'navigation', priority: 1 }, { priority: 2 })).to.be.equal(-1); + expect(testMe({ priority: 1 }, { group: 'navigation', priority: 2 })).to.be.equal(-1); + expect(testMe({ priority: 1, group: 'other' }, { priority: 2 })).to.be.equal(1); + expect(testMe({ group: 'other', priority: 1 }, { priority: 2, group: 'other' })).to.be.equal(-1); + expect(testMe({ priority: 10 }, { group: 'other', priority: 2 })).to.be.equal(-1); + expect(testMe({ group: 'other', priority: 10 }, { group: 'other', priority: 10 })).to.be.equal(0); + }); + + }); + +}); diff --git a/packages/core/src/browser/shell/tab-bar-toolbar/tab-bar-toolbar.tsx b/packages/core/src/browser/shell/tab-bar-toolbar/tab-bar-toolbar.tsx new file mode 100644 index 0000000..6588b10 --- /dev/null +++ b/packages/core/src/browser/shell/tab-bar-toolbar/tab-bar-toolbar.tsx @@ -0,0 +1,222 @@ +// ***************************************************************************** +// Copyright (C) 2018 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { inject, injectable, postConstruct } from 'inversify'; +import * as React from 'react'; +import { ContextKeyService } from '../../context-key-service'; +import { CommandRegistry, Disposable, DisposableCollection, nls } from '../../../common'; +import { Anchor, ContextMenuAccess, ContextMenuRenderer } from '../../context-menu-renderer'; +import { LabelParser } from '../../label-parser'; +import { codicon, ReactWidget, Widget } from '../../widgets'; +import { TabBarToolbarRegistry } from './tab-bar-toolbar-registry'; +import { TAB_BAR_TOOLBAR_CONTEXT_MENU, TabBarDelegator, TabBarToolbarAction } from './tab-bar-toolbar-types'; +import { KeybindingRegistry } from '../..//keybinding'; +import { TabBarToolbarItem } from './tab-toolbar-item'; +import { GroupImpl, MenuModelRegistry } from '../../../common/menu'; + +/** + * Factory for instantiating tab-bar toolbars. + */ +export const TabBarToolbarFactory = Symbol('TabBarToolbarFactory'); +export interface TabBarToolbarFactory { + (): TabBarToolbar; +} + +export function toAnchor(event: React.MouseEvent): Anchor { + const itemBox = event.currentTarget.closest('.' + TabBarToolbar.Styles.TAB_BAR_TOOLBAR_ITEM)?.getBoundingClientRect(); + return itemBox ? { y: itemBox.bottom, x: itemBox.left } : event.nativeEvent; +} + +/** + * Tab-bar toolbar widget representing the active [tab-bar toolbar items](TabBarToolbarItem). + */ +@injectable() +export class TabBarToolbar extends ReactWidget { + + protected current: Widget | undefined; + protected inline = new Map(); + protected more = new Map(); + + protected contextKeyListener: Disposable | undefined; + protected toDisposeOnUpdateItems: DisposableCollection = new DisposableCollection(); + + protected keybindingContextKeys = new Set(); + + @inject(CommandRegistry) protected readonly commands: CommandRegistry; + @inject(LabelParser) protected readonly labelParser: LabelParser; + @inject(MenuModelRegistry) protected readonly menus: MenuModelRegistry; + @inject(ContextMenuRenderer) protected readonly contextMenuRenderer: ContextMenuRenderer; + @inject(TabBarToolbarRegistry) protected readonly toolbarRegistry: TabBarToolbarRegistry; + @inject(ContextKeyService) protected readonly contextKeyService: ContextKeyService; + @inject(KeybindingRegistry) protected readonly keybindings: KeybindingRegistry; + + constructor() { + super(); + this.addClass(TabBarToolbar.Styles.TAB_BAR_TOOLBAR); + this.hide(); + } + + @postConstruct() + protected init(): void { + this.toDispose.pushAll([ + this.keybindings.onKeybindingsChanged(() => this.maybeUpdate()), + this.contextKeyService.onDidChange(e => { + if (e.affects(this.keybindingContextKeys)) { + this.maybeUpdate(); + } + }), + Disposable.create(() => { + this.toDisposeOnUpdateItems.dispose(); + this.toDisposeOnSetCurrent.dispose(); + }) + ]); + } + + updateItems(items: Array, current: Widget | undefined): void { + this.toDisposeOnUpdateItems.dispose(); + this.toDisposeOnUpdateItems = new DisposableCollection(); + this.inline.clear(); + this.more.clear(); + + for (const item of items.sort(TabBarToolbarAction.PRIORITY_COMPARATOR).reverse()) { + + if (!('toMenuNode' in item) || item.group === undefined || item.group === 'navigation') { + this.inline.set(item.id, item); + } else { + this.more.set(item.id, item); + } + + if (item.onDidChange) { + this.toDisposeOnUpdateItems.push(item.onDidChange(() => this.maybeUpdate())); + } + } + + this.setCurrent(current); + if (items.length) { + this.show(); + } else { + this.hide(); + } + this.maybeUpdate(); + } + + updateTarget(current?: Widget): void { + const operativeWidget = TabBarDelegator.is(current) ? current.getTabBarDelegate() : current; + const items = operativeWidget ? this.toolbarRegistry.visibleItems(operativeWidget) : []; + this.updateItems(items, operativeWidget); + } + + protected readonly toDisposeOnSetCurrent = new DisposableCollection(); + protected setCurrent(current: Widget | undefined): void { + this.toDisposeOnSetCurrent.dispose(); + this.toDispose.push(this.toDisposeOnSetCurrent); + this.current = current; + if (current) { + const resetCurrent = () => { + this.setCurrent(undefined); + this.maybeUpdate(); + }; + current.disposed.connect(resetCurrent); + this.toDisposeOnSetCurrent.push(Disposable.create(() => + current.disposed.disconnect(resetCurrent) + )); + } + } + + protected render(): React.ReactNode { + this.keybindingContextKeys.clear(); + return + {this.renderMore()} + {[...this.inline.values()].map(item => item.render(this.current))} + ; + } + + protected renderMore(): React.ReactNode { + return !!this.more.size &&
    +
    +
    ; + } + + protected showMoreContextMenu = (event: React.MouseEvent) => { + event.stopPropagation(); + event.preventDefault(); + const anchor = toAnchor(event); + this.renderMoreContextMenu(anchor); + }; + + renderMoreContextMenu(anchor: Anchor): ContextMenuAccess { + const toDisposeOnHide = new DisposableCollection(); + this.addClass('menu-open'); + toDisposeOnHide.push(Disposable.create(() => this.removeClass('menu-open'))); + + const menu = new GroupImpl('contextMenu'); + for (const item of this.more.values()) { + if (item.toMenuNode) { + const node = item.toMenuNode(); + if (node) { + if (item.group) { + menu.getOrCreate([item.group], 0, 1).addNode(node); + } else { + menu.addNode(node); + } + } + } + } + return this.contextMenuRenderer.render({ + menu: MenuModelRegistry.removeSingleRootNodes(menu), + menuPath: TAB_BAR_TOOLBAR_CONTEXT_MENU, + args: [this.current], + anchor, + context: this.current?.node || this.node, + contextKeyService: this.contextKeyService, + includeAnchorArg: false, + onHide: () => toDisposeOnHide.dispose() + }); + } + + shouldHandleMouseEvent(event: MouseEvent): boolean { + return event.target instanceof Element && this.node.contains(event.target); + } + + protected commandIsEnabled(command: string): boolean { + return this.commands.isEnabled(command, this.current); + } + + protected commandIsToggled(command: string): boolean { + return this.commands.isToggled(command, this.current); + } + + protected evaluateWhenClause(whenClause: string | undefined): boolean { + return whenClause ? this.contextKeyService.match(whenClause, this.current?.node) : true; + } + + protected maybeUpdate(): void { + if (!this.isDisposed) { + this.update(); + } + } +} + +export namespace TabBarToolbar { + + export namespace Styles { + + export const TAB_BAR_TOOLBAR = 'lm-TabBar-toolbar'; + export const TAB_BAR_TOOLBAR_ITEM = 'item'; + + } +} diff --git a/packages/core/src/browser/shell/tab-bar-toolbar/tab-toolbar-item.tsx b/packages/core/src/browser/shell/tab-bar-toolbar/tab-toolbar-item.tsx new file mode 100644 index 0000000..46e25f9 --- /dev/null +++ b/packages/core/src/browser/shell/tab-bar-toolbar/tab-toolbar-item.tsx @@ -0,0 +1,259 @@ +// ***************************************************************************** +// Copyright (C) 2024 STMicroelectronics and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { ContextKeyService } from '../../context-key-service'; +import { ReactTabBarToolbarAction, RenderedToolbarAction, TabBarToolbarActionBase } from './tab-bar-toolbar-types'; +import { Widget } from '@lumino/widgets'; +import { LabelIcon, LabelParser } from '../../label-parser'; +import { CommandRegistry, Event, Disposable, Emitter, DisposableCollection } from '../../../common'; +import { KeybindingRegistry } from '../../keybinding'; +import { ACTION_ITEM } from '../../widgets'; +import { TabBarToolbar } from './tab-bar-toolbar'; +import * as React from 'react'; +import { ActionMenuNode, GroupImpl, MenuNode } from '../../../common/menu'; + +export interface TabBarToolbarItem { + id: string; + isVisible(widget: Widget): boolean; + isEnabled(widget: Widget): boolean; + isToggled(widget: Widget): boolean; + render(widget?: Widget): React.ReactNode; + onDidChange?: Event; + group?: string; + priority?: number; + toMenuNode?(): MenuNode | undefined; +} + +/** + * Class name indicating rendering of a toolbar item without an icon but instead with a text label. + */ +const NO_ICON_CLASS = 'no-icon'; + +class AbstractToolbarItemImpl { + constructor( + protected readonly commandRegistry: CommandRegistry, + protected readonly contextKeyService: ContextKeyService, + protected readonly action: T) { + } + + get id(): string { + return this.action.id; + } + get group(): string | undefined { + return this.action.group; + } + get priority(): number | undefined { + return this.action.priority; + } + + get onDidChange(): Event | undefined { + return this.action.onDidChange; + } + + isVisible(widget: Widget): boolean { + if (this.action.isVisible) { + return this.action.isVisible(widget); + } + const actionVisible = !this.action.command || this.commandRegistry.isVisible(this.action.command, widget); + const contextMatches = !this.action.when || this.contextKeyService.match(this.action.when); + + return actionVisible && contextMatches; + } + + isEnabled(widget: Widget): boolean { + return this.action.command ? this.commandRegistry.isEnabled(this.action.command, widget) : !!this.action.menuPath; + } + isToggled(widget: Widget): boolean { + return this.action.command ? this.commandRegistry.isToggled(this.action.command, widget) : false; + } +} + +export class RenderedToolbarItemImpl extends AbstractToolbarItemImpl implements TabBarToolbarItem { + protected contextKeyListener: Disposable | undefined; + protected disposables = new DisposableCollection(); + + constructor( + commandRegistry: CommandRegistry, + contextKeyService: ContextKeyService, + protected readonly keybindingRegistry: KeybindingRegistry, + protected readonly labelParser: LabelParser, + action: RenderedToolbarAction) { + super(commandRegistry, contextKeyService, action); + if (action.onDidChange) { + this.disposables.push(action.onDidChange(() => this.onDidChangeEmitter.fire())); + } + + this.disposables.push(Disposable.create(() => + this.contextKeyListener?.dispose() + )); + } + + dispose(): void { + this.disposables.dispose(); + } + + updateContextKeyListener(when: string): void { + if (this.contextKeyListener) { + this.contextKeyListener.dispose(); + this.contextKeyListener = undefined; + } + const contextKeys = new Set(); + this.contextKeyService.parseKeys(when)?.forEach(key => contextKeys.add(key)); + if (contextKeys.size > 0) { + this.contextKeyListener = this.contextKeyService.onDidChange(change => { + if (change.affects(contextKeys)) { + this.onDidChangeEmitter.fire(); + } + }); + } + } + + render(widget: Widget): React.ReactNode { + return this.renderItem(widget); + } + + protected getToolbarItemClassNames(widget: Widget): string[] { + const classNames = [TabBarToolbar.Styles.TAB_BAR_TOOLBAR_ITEM]; + if (this.isEnabled(widget)) { + classNames.push('enabled'); + } + if (this.isToggled(widget)) { + classNames.push('toggled'); + } + return classNames; + } + + protected resolveKeybindingForCommand(widget: Widget, command: string | undefined): string { + let result = ''; + if (this.action.command) { + const bindings = this.keybindingRegistry.getKeybindingsForCommand(this.action.command); + let found = false; + if (bindings && bindings.length > 0) { + bindings.forEach(binding => { + if (binding.when) { + this.updateContextKeyListener(binding.when); + } + if (!found && this.keybindingRegistry.isEnabledInScope(binding, widget?.node)) { + found = true; + result = ` (${this.keybindingRegistry.acceleratorFor(binding, '+')})`; + } + }); + } + } + return result; + } + + protected readonly onDidChangeEmitter = new Emitter; + override get onDidChange(): Event | undefined { + return this.onDidChangeEmitter.event; + } + + toMenuNode?(): MenuNode { + const action = new ActionMenuNode({ + label: this.action.tooltip, + commandId: this.action.command!, + when: this.action.when, + order: this.action.order + }, this.commandRegistry, this.keybindingRegistry, this.contextKeyService); + + // Register a submenu for the item, if the group is in format `//.../` + const menuPath = this.action.group?.split('/') || []; + if (menuPath.length > 1) { + let menu = new GroupImpl(menuPath[0], this.action.order); + menu = menu.getOrCreate(menuPath, 1, menuPath.length); + menu.addNode(action); + return menu; + } + return action; + } + + protected onMouseDownEvent = (e: React.MouseEvent) => { + if (e.button === 0) { + e.currentTarget.classList.add('active'); + } + }; + + protected onMouseUpEvent = (e: React.MouseEvent) => { + e.currentTarget.classList.remove('active'); + }; + + protected executeCommand(e: React.MouseEvent, widget: Widget): void { + e.preventDefault(); + e.stopPropagation(); + + if (!this.isEnabled(widget)) { + return; + } + + if (this.action.command) { + this.commandRegistry.executeCommand(this.action.command, widget); + } + }; + + protected renderItem(widget: Widget): React.ReactNode { + let innerText = ''; + const classNames = []; + const command = this.action.command ? this.commandRegistry.getCommand(this.action.command) : undefined; + // Fall back to the item ID in extremis so there is _something_ to render in the + // case that there is neither an icon nor a title + const itemText = this.action.text || command?.label || command?.id || this.action.id; + if (itemText) { + for (const labelPart of this.labelParser.parse(itemText)) { + if (LabelIcon.is(labelPart)) { + const className = `fa fa-${labelPart.name}${labelPart.animation ? ' fa-' + labelPart.animation : ''}`; + classNames.push(...className.split(' ')); + } else { + innerText = labelPart; + } + } + } + const iconClass = (typeof this.action.icon === 'function' && this.action.icon()) || this.action.icon as string || (command && command.iconClass); + if (iconClass) { + classNames.push(iconClass); + } + const tooltipText = this.action.tooltip || (command && command.label) || ''; + const tooltip = `${this.labelParser.stripIcons(tooltipText)}${this.resolveKeybindingForCommand(widget, command?.id)}`; + + // Only present text if there is no icon + if (classNames.length) { + innerText = ''; + } else if (innerText) { + // Make room for the label text + classNames.push(NO_ICON_CLASS); + } + + // In any case, this is an action item, with or without icon. + classNames.push(ACTION_ITEM); + + const toolbarItemClassNames = this.getToolbarItemClassNames(widget); + return
    +
    this.executeCommand(e, widget)} + title={tooltip} > {innerText} +
    +
    ; + } +} + +export class ReactToolbarItemImpl extends AbstractToolbarItemImpl implements TabBarToolbarItem { + render(widget?: Widget | undefined): React.ReactNode { + return this.action.render(widget); + } +} diff --git a/packages/core/src/browser/shell/tab-bars.spec.ts b/packages/core/src/browser/shell/tab-bars.spec.ts new file mode 100644 index 0000000..c9f6247 --- /dev/null +++ b/packages/core/src/browser/shell/tab-bars.spec.ts @@ -0,0 +1,63 @@ +// ***************************************************************************** +// Copyright (C) 2019 Ericsson and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { enableJSDOM } from '../test/jsdom'; +let disableJSDOM = enableJSDOM(); +import { expect } from 'chai'; + +import { Title, Widget } from '@lumino/widgets'; +import { TabBarRenderer } from './tab-bars'; + +disableJSDOM(); + +describe('tab bar', () => { + + before(() => { + disableJSDOM = enableJSDOM(); + }); + + after(() => { + disableJSDOM(); + }); + + it('should disambiguate tabs that have identical names', () => { + const tabBar = new TabBarRenderer(); + const owner = new Widget(); + + const tabLabels: string[] = ['index.ts', 'index.ts', 'index.ts', 'main.ts', 'main.ts', 'main.ts', 'uniqueFile.ts']; + const tabPaths: string[] = [ + 'root1/src/foo/bar/index.ts', + 'root1/lib/foo/bar/index.ts', + 'root2/src/foo/goo/bar/index.ts', + 'root1/aaa/main.ts', + 'root1/aaa/bbb/main.ts', + 'root1/aaa/bbb/ccc/main.ts', + 'root1/src/foo/bar/uniqueFile.ts' + ]; + const tabs: Title[] = tabLabels.map((label, i) => new Title({ + owner, label, caption: tabPaths[i] + })); + const pathMap = tabBar.findDuplicateLabels(tabs); + + expect(pathMap.get(tabPaths[0])).to.be.equal('.../src/...'); + expect(pathMap.get(tabPaths[1])).to.be.equal('.../lib/...'); + expect(pathMap.get(tabPaths[2])).to.be.equal('root2/...'); + expect(pathMap.get(tabPaths[3])).to.be.equal('root1/aaa'); + expect(pathMap.get(tabPaths[4])).to.be.equal('root1/aaa/bbb'); + expect(pathMap.get(tabPaths[5])).to.be.equal('.../ccc'); + expect(pathMap.get(tabPaths[6])).to.be.equal(undefined); + }); +}); diff --git a/packages/core/src/browser/shell/tab-bars.ts b/packages/core/src/browser/shell/tab-bars.ts new file mode 100644 index 0000000..bdd52d5 --- /dev/null +++ b/packages/core/src/browser/shell/tab-bars.ts @@ -0,0 +1,1497 @@ +// ***************************************************************************** +// Copyright (C) 2018 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import PerfectScrollbar from 'perfect-scrollbar'; +import { TabBar, Title, Widget } from '@lumino/widgets'; +import { VirtualElement, h, VirtualDOM, ElementInlineStyle } from '@lumino/virtualdom'; +import { Disposable, DisposableCollection, MenuPath, notEmpty, SelectionService, CommandService, nls, ArrayUtils } from '../../common'; +import { ContextMenuRenderer } from '../context-menu-renderer'; +import { Signal, Slot } from '@lumino/signaling'; +import { Message } from '@lumino/messaging'; +import { ArrayExt } from '@lumino/algorithm'; +import { ElementExt } from '@lumino/domutils'; +import { TabBarToolbarRegistry, TabBarToolbar } from './tab-bar-toolbar'; +import { TheiaDockPanel, MAIN_AREA_ID, BOTTOM_AREA_ID } from './theia-dock-panel'; +import { WidgetDecoration } from '../widget-decoration'; +import { TabBarDecoratorService } from './tab-bar-decorator'; +import { IconThemeService } from '../icon-theme-service'; +import { BreadcrumbsRenderer, BreadcrumbsRendererFactory } from '../breadcrumbs/breadcrumbs-renderer'; +import { NavigatableWidget } from '../navigatable-types'; +import { Drag } from '@lumino/dragdrop'; +import { LOCKED_CLASS, PINNED_CLASS } from '../widgets/widget'; +import { CorePreferences } from '../../common/core-preferences'; +import { HoverService } from '../hover-service'; +import { Root, createRoot } from 'react-dom/client'; +import { SelectComponent } from '../widgets/select-component'; +import { createElement } from 'react'; +import { PreviewableWidget } from '../widgets/previewable-widget'; +import { EnhancedPreviewWidget } from '../widgets/enhanced-preview-widget'; +import { isContextMenuEvent } from '../browser'; +import { ContextKeyService } from '../context-key-service'; + +/** The class name added to hidden content nodes, which are required to render vertical side bars. */ +const HIDDEN_CONTENT_CLASS = 'theia-TabBar-hidden-content'; + +/** Menu path for tab bars used throughout the application shell. */ +export const SHELL_TABBAR_CONTEXT_MENU: MenuPath = ['shell-tabbar-context-menu']; +export const SHELL_TABBAR_CONTEXT_CLOSE: MenuPath = [...SHELL_TABBAR_CONTEXT_MENU, '0_close']; +export const SHELL_TABBAR_CONTEXT_COPY: MenuPath = [...SHELL_TABBAR_CONTEXT_MENU, '1_copy']; +// Kept here in anticipation of tab pinning behavior implemented in tab-bars.ts +export const SHELL_TABBAR_CONTEXT_PIN: MenuPath = [...SHELL_TABBAR_CONTEXT_MENU, '4_pin']; +export const SHELL_TABBAR_CONTEXT_SPLIT: MenuPath = [...SHELL_TABBAR_CONTEXT_MENU, '5_split']; + +export const TabBarRendererFactory = Symbol('TabBarRendererFactory'); +export type TabBarRendererFactory = () => TabBarRenderer; + +/** + * Size information of DOM elements used for rendering tabs in side bars. + */ +export interface SizeData { + width: number; + height: number; +} + +/** + * Extension of the rendering data used for tabs in side bars of the application shell. + */ +export interface SideBarRenderData extends TabBar.IRenderData { + labelSize?: SizeData; + iconSize?: SizeData; + paddingTop?: number; + paddingBottom?: number; + visible?: boolean +} + +export interface ScrollableRenderData extends TabBar.IRenderData { + tabWidth?: number; +} + +/** + * A tab bar renderer that offers a context menu. In addition, this renderer is able to + * set an explicit position and size on the icon and label of each tab in a side bar. + * This is necessary because the elements of side bar tabs are rotated using the CSS + * `transform` property, disrupting the browser's ability to arrange those elements + * automatically. + */ +export class TabBarRenderer extends TabBar.Renderer { + /** + * The menu path used to render the context menu. + */ + contextMenuPath?: MenuPath; + + protected readonly toDispose = new DisposableCollection(); + + // TODO refactor shell, rendered should only receive props with event handlers + // events should be handled by clients, like ApplicationShell + // right now it is mess: (1) client logic belong to renderer, (2) cyclic dependencies between renderers and clients + constructor( + protected readonly contextMenuRenderer?: ContextMenuRenderer, + protected readonly decoratorService?: TabBarDecoratorService, + protected readonly iconThemeService?: IconThemeService, + protected readonly selectionService?: SelectionService, + protected readonly commandService?: CommandService, + protected readonly corePreferences?: CorePreferences, + protected readonly hoverService?: HoverService, + protected readonly contextKeyService?: ContextKeyService, + ) { + super(); + if (this.decoratorService) { + this.toDispose.push(Disposable.create(() => this.resetDecorations())); + this.toDispose.push(this.decoratorService.onDidChangeDecorations(() => this.resetDecorations())); + } + if (this.iconThemeService) { + this.toDispose.push(this.iconThemeService.onDidChangeCurrent(() => { + if (this._tabBar) { + this._tabBar.update(); + } + })); + } + if (this.corePreferences) { + this.toDispose.push( + this.corePreferences.onPreferenceChanged(event => { + if (event.preferenceName === 'window.tabCloseIconPlacement' && this._tabBar) { + this._tabBar.update(); + } + }) + ); + } + } + + dispose(): void { + this.toDispose.dispose(); + } + + protected _tabBar?: TabBar; + protected readonly toDisposeOnTabBar = new DisposableCollection(); + /** + * A reference to the tab bar is required in order to activate it when a context menu + * is requested. + */ + set tabBar(tabBar: TabBar | undefined) { + if (this.toDispose.disposed) { + throw new Error('disposed'); + } + if (this._tabBar === tabBar) { + return; + } + this.toDisposeOnTabBar.dispose(); + this.toDispose.push(this.toDisposeOnTabBar); + this._tabBar = tabBar; + if (tabBar) { + const listener: Slot> = (_, { title }) => this.resetDecorations(title); + tabBar.tabCloseRequested.connect(listener); + this.toDisposeOnTabBar.push(Disposable.create(() => tabBar.tabCloseRequested.disconnect(listener))); + } + this.resetDecorations(); + } + get tabBar(): TabBar | undefined { + return this._tabBar; + } + + /** + * Render tabs with the default DOM structure, but additionally register a context menu listener. + * @param {SideBarRenderData} data Data used to render the tab. + * @param {boolean} isInSidePanel An optional check which determines if the tab is in the side-panel. + * @param {boolean} isPartOfHiddenTabBar An optional check which determines if the tab is in the hidden horizontal tab bar. + * @returns {VirtualElement} The virtual element of the rendered tab. + */ + override renderTab(data: SideBarRenderData, isInSidePanel?: boolean, isPartOfHiddenTabBar?: boolean): VirtualElement { + // Putting the close icon at the start is only pertinent to the horizontal orientation + const isHorizontal = this.tabBar?.orientation === 'horizontal'; + const tabCloseIconStart = isHorizontal && this.corePreferences?.['window.tabCloseIconPlacement'] === 'start'; + + const title = data.title; + const id = this.createTabId(title, isPartOfHiddenTabBar); + const key = this.createTabKey(data); + const style = this.createTabStyle(data); + const className = `${this.createTabClass(data)}${tabCloseIconStart ? ' closeIcon-start' : ''}`; + const dataset = this.createTabDataset(data); + const closeIconTitle = data.title.className.includes(PINNED_CLASS) + ? nls.localizeByDefault('Unpin') + : nls.localizeByDefault('Close'); + + const hover = { + onmouseenter: this.handleMouseEnterEvent + }; + + const tabLabel = h.div( + { className: 'theia-tab-icon-label' }, + this.renderIcon(data, isInSidePanel), + this.renderLabel(data, isInSidePanel), + this.renderTailDecorations(data, isInSidePanel), + this.renderBadge(data, isInSidePanel), + this.renderLock(data, isInSidePanel) + ); + const tabCloseIcon = h.div({ + className: 'lm-TabBar-tabCloseIcon action-label', + title: closeIconTitle, + onclick: this.handleCloseClickEvent, + }); + + const tabContents = tabCloseIconStart ? [tabCloseIcon, tabLabel] : [tabLabel, tabCloseIcon]; + + return h.li( + { + ...hover, + key, className, id, style, dataset, + oncontextmenu: this.handleContextMenuEvent, + ondblclick: this.handleDblClickEvent, + onauxclick: (e: MouseEvent) => { + // If user closes the tab using mouse wheel, nothing should be pasted to an active editor + e.preventDefault(); + } + }, + ...tabContents + ); + } + + override createTabClass(data: SideBarRenderData): string { + let tabClass = super.createTabClass(data); + if (!(data.visible ?? true)) { + tabClass += ' lm-mod-invisible'; + } + return tabClass; + } + + /** + * Generate ID for an entry in the tab bar + * @param {Title} title Title of the widget controlled by this tab bar + * @param {boolean} isPartOfHiddenTabBar Tells us if this entry is part of the hidden horizontal tab bar. + * If yes, add a suffix to differentiate it's ID from the entry in the visible tab bar + * @returns {string} DOM element ID + */ + createTabId(title: Title, isPartOfHiddenTabBar = false): string { + return 'shell-tab-' + title.owner.id + (isPartOfHiddenTabBar ? '-hidden' : ''); + } + + /** + * If size information is available for the label and icon, set an explicit height on the tab. + * The height value also considers padding, which should be derived from CSS settings. + */ + override createTabStyle(data: SideBarRenderData & ScrollableRenderData): ElementInlineStyle { + const zIndex = `${data.zIndex}`; + const labelSize = data.labelSize; + const iconSize = data.iconSize; + let height: string | undefined; + let width: string | undefined; + if (labelSize || iconSize) { + const labelHeight = labelSize ? (this.tabBar && this.tabBar.orientation === 'horizontal' ? labelSize.height : labelSize.width) : 0; + const iconHeight = iconSize ? iconSize.height : 0; + let paddingTop = data.paddingTop || 0; + if (labelHeight > 0 && iconHeight > 0) { + // Leave some extra space between icon and label + paddingTop = paddingTop * 1.5; + } + const paddingBottom = data.paddingBottom || 0; + height = `${labelHeight + iconHeight + paddingTop + paddingBottom}px`; + } + if (data.tabWidth) { + width = `${data.tabWidth}px`; + } else { + width = ''; + } + return { zIndex, height, minWidth: width, maxWidth: width }; + } + + /** + * If size information is available for the label, set it as inline style. + * Tab padding and icon size are also considered in the `top` position. + * @param {SideBarRenderData} data Data used to render the tab. + * @param {boolean} isInSidePanel An optional check which determines if the tab is in the side-panel. + * @returns {VirtualElement} The virtual element of the rendered label. + */ + override renderLabel(data: SideBarRenderData, isInSidePanel?: boolean): VirtualElement { + const labelSize = data.labelSize; + const iconSize = data.iconSize; + let width: string | undefined; + let height: string | undefined; + let top: string | undefined; + if (labelSize) { + width = `${labelSize.width}px`; + height = `${labelSize.height}px`; + } + if (data.paddingTop || iconSize) { + const iconHeight = iconSize ? iconSize.height : 0; + let paddingTop = data.paddingTop || 0; + if (iconHeight > 0) { + // Leave some extra space between icon and label + paddingTop = paddingTop * 1.5; + } + top = `${paddingTop + iconHeight}px`; + } + const style: ElementInlineStyle = { width, height, top }; + // No need to check for duplicate labels if the tab is rendered in the side panel (title is not displayed), + // or if there are less than two files in the tab bar. + if (isInSidePanel || (this.tabBar && this.tabBar.titles.length < 2)) { + return h.div({ className: 'lm-TabBar-tabLabel', style }, data.title.label); + } + const originalToDisplayedMap = this.findDuplicateLabels([...this.tabBar!.titles]); + const labelDetails: string | undefined = originalToDisplayedMap.get(data.title.caption); + if (labelDetails) { + return h.div({ className: 'lm-TabBar-tabLabelWrapper' }, + h.div({ className: 'lm-TabBar-tabLabel', style }, data.title.label), + h.div({ className: 'lm-TabBar-tabLabelDetails', style }, labelDetails)); + } + return h.div({ className: 'lm-TabBar-tabLabel', style }, data.title.label); + } + + protected renderTailDecorations(renderData: SideBarRenderData, isInSidePanel?: boolean): VirtualElement[] { + if (!this.corePreferences?.get('workbench.editor.decorations.badges')) { + return []; + } + const tailDecorations = ArrayUtils.coalesce(this.getDecorationData(renderData.title, 'tailDecorations')).flat(); + if (tailDecorations === undefined || tailDecorations.length === 0) { + return []; + } + let dotDecoration: WidgetDecoration.TailDecoration.AnyPartial | undefined; + const otherDecorations: WidgetDecoration.TailDecoration.AnyPartial[] = []; + tailDecorations.reverse().forEach(decoration => { + const partial = decoration as WidgetDecoration.TailDecoration.AnyPartial; + if (WidgetDecoration.TailDecoration.isDotDecoration(partial)) { + dotDecoration ||= partial; + } else if (partial.data || partial.icon || partial.iconClass) { + otherDecorations.push(partial); + } + }); + const decorationsToRender = dotDecoration ? [dotDecoration, ...otherDecorations] : otherDecorations; + return decorationsToRender.map((decoration, index) => { + const { tooltip, data, fontData, color, icon, iconClass } = decoration; + const iconToRender = icon ?? iconClass; + const className = ['lm-TabBar-tail', 'flex'].join(' '); + const style = fontData ? fontData : color ? { color } : undefined; + const content = (data ? data : iconToRender + ? h.span({ className: this.getIconClass(iconToRender, iconToRender === 'circle' ? [WidgetDecoration.Styles.DECORATOR_SIZE_CLASS] : []) }) + : '') + (index !== decorationsToRender.length - 1 ? ',' : ''); + return h.span({ key: ('tailDecoration_' + index), className, style, title: tooltip ?? content }, content); + }); + } + + renderBadge(data: SideBarRenderData, isInSidePanel?: boolean): VirtualElement { + const totalBadge = this.getDecorationData(data.title, 'badge').reduce((sum, badge) => sum! + badge!, 0); + if (!totalBadge) { + return h.div({}); + } + const limitedBadge = totalBadge >= 100 ? '99+' : totalBadge; + return isInSidePanel + ? h.div({ className: 'theia-badge-decorator-sidebar' }, `${limitedBadge}`) + : h.div({ className: 'theia-badge-decorator-horizontal' }, `${limitedBadge}`); + } + + renderLock(data: SideBarRenderData, isInSidePanel?: boolean): VirtualElement { + return !isInSidePanel && data.title.className.includes(LOCKED_CLASS) + ? h.div({ className: 'lm-TabBar-tabLock' }) + : h.div({}); + } + + protected readonly decorations = new Map, WidgetDecoration.Data[]>(); + + protected resetDecorations(title?: Title): void { + if (title) { + this.decorations.delete(title); + } else { + this.decorations.clear(); + } + if (this.tabBar) { + this.tabBar.update(); + } + } + + /** + * Get all available decorations of a given tab. + * @param {string} title The widget title. + */ + protected getDecorations(title: Title): WidgetDecoration.Data[] { + if (this.tabBar && this.decoratorService) { + const owner: { resetTabBarDecorations?: () => void; } & Widget = title.owner; + if (!owner.resetTabBarDecorations) { + owner.resetTabBarDecorations = () => this.decorations.delete(title); + title.owner.disposed.connect(owner.resetTabBarDecorations); + } + + const decorations = this.decorations.get(title) || this.decoratorService.getDecorations(title); + this.decorations.set(title, decorations); + return decorations; + } + return []; + } + + /** + * Get the decoration data given the tab URI and the decoration data type. + * @param {string} title The title. + * @param {K} key The type of the decoration data. + */ + protected getDecorationData(title: Title, key: K): WidgetDecoration.Data[K][] { + return this.getDecorations(title).filter(data => data[key] !== undefined).map(data => data[key]); + } + + /** + * Get the class of an icon. + * @param {string | string[]} iconName The name of the icon. + * @param {string[]} additionalClasses Additional classes of the icon. + */ + protected getIconClass(iconName: string | string[], additionalClasses: string[] = []): string { + const iconClass = (typeof iconName === 'string') ? ['a', 'fa', `fa-${iconName}`] : ['a'].concat(iconName); + return iconClass.concat(additionalClasses).join(' '); + } + + /** + * Find duplicate labels from the currently opened tabs in the tab bar. + * Return the appropriate partial paths that can distinguish the identical labels. + * + * E.g., a/p/index.ts => a/..., b/p/index.ts => b/... + * + * To prevent excessively long path displayed, show at maximum three levels from the end by default. + * @param {Title[]} titles Array of titles in the current tab bar. + * @returns {Map} A map from each tab's original path to its displayed partial path. + */ + findDuplicateLabels(titles: Title[]): Map { + // Filter from all tabs to group them by the distinct label (file name). + // E.g., 'foo.js' => {0 (index) => 'a/b/foo.js', '2 => a/c/foo.js' }, + // 'bar.js' => {1 => 'a/d/bar.js', ...} + const labelGroups = new Map>(); + titles.forEach((title, index) => { + if (!labelGroups.has(title.label)) { + labelGroups.set(title.label, new Map()); + } + labelGroups.get(title.label)!.set(index, title.caption); + }); + + const originalToDisplayedMap = new Map(); + // Parse each group of editors with the same label. + labelGroups.forEach(labelGroup => { + // Filter to get groups that have duplicates. + if (labelGroup.size > 1) { + const paths: string[][] = []; + let maxPathLength = 0; + labelGroup.forEach((pathStr, index) => { + const steps = pathStr.split('/'); + maxPathLength = Math.max(maxPathLength, steps.length); + paths[index] = (steps.slice(0, steps.length - 1)); + // By default, show at maximum three levels from the end. + let defaultDisplayedPath = steps.slice(-4, -1).join('/'); + if (steps.length > 4) { + defaultDisplayedPath = '.../' + defaultDisplayedPath; + } + originalToDisplayedMap.set(pathStr, defaultDisplayedPath); + }); + + // Iterate through the steps of the path from the left to find the step that can distinguish it. + // E.g., ['root', 'foo', 'c'], ['root', 'bar', 'd'] => 'foo', 'bar' + let i = 0; + while (i < maxPathLength - 1) { + // Store indexes of all paths that have the identical element in each step. + const stepOccurrences = new Map(); + // Compare the current step of all paths + paths.forEach((path, index) => { + const step = path[i]; + if (path.length > 0) { + if (i > path.length - 1) { + paths[index] = []; + } else if (!stepOccurrences.has(step)) { + stepOccurrences.set(step, [index]); + } else { + stepOccurrences.get(step)!.push(index); + } + } + }); + // Set the displayed path for each tab. + stepOccurrences.forEach((indexArr, displayedPath) => { + if (indexArr.length === 1) { + const originalPath = labelGroup.get(indexArr[0]); + if (originalPath) { + const originalElements = originalPath.split('/'); + const displayedElements = displayedPath.split('/'); + if (originalElements.slice(-2)[0] !== displayedElements.slice(-1)[0]) { + displayedPath += '/...'; + } + if (originalElements[0] !== displayedElements[0]) { + displayedPath = '.../' + displayedPath; + } + originalToDisplayedMap.set(originalPath, displayedPath); + paths[indexArr[0]] = []; + } + } + }); + i++; + } + } + }); + return originalToDisplayedMap; + } + + /** + * If size information is available for the icon, set it as inline style. Tab padding + * is also considered in the `top` position. + * @param {SideBarRenderData} data Data used to render the tab icon. + * @param {boolean} isInSidePanel An optional check which determines if the tab is in the side-panel. + */ + override renderIcon(data: SideBarRenderData, isInSidePanel?: boolean): VirtualElement { + if (!isInSidePanel && this.iconThemeService && this.iconThemeService.current === 'none') { + return h.div(); + } + let top: string | undefined; + if (data.paddingTop) { + top = `${data.paddingTop || 0}px`; + } + const style: ElementInlineStyle = { top }; + const baseClassName = this.createIconClass(data); + + const overlayIcons: VirtualElement[] = []; + const decorationData = this.getDecorationData(data.title, 'iconOverlay'); + + // Check if the tab has decoration markers to be rendered on top. + if (decorationData.length > 0) { + const baseIcon: VirtualElement = h.div({ className: baseClassName, style }, data.title.iconLabel); + const wrapperClassName: string = WidgetDecoration.Styles.ICON_WRAPPER_CLASS; + const decoratorSizeClassName: string = isInSidePanel ? WidgetDecoration.Styles.DECORATOR_SIDEBAR_SIZE_CLASS : WidgetDecoration.Styles.DECORATOR_SIZE_CLASS; + + decorationData + .filter(notEmpty) + .map(overlay => [overlay.position, overlay] as [WidgetDecoration.IconOverlayPosition, WidgetDecoration.IconOverlay | WidgetDecoration.IconClassOverlay]) + .forEach(([position, overlay]) => { + const iconAdditionalClasses: string[] = [decoratorSizeClassName, WidgetDecoration.IconOverlayPosition.getStyle(position, isInSidePanel)]; + const overlayIconStyle = (color?: string) => { + if (color === undefined) { + return {}; + } + return { color }; + }; + // Parse the optional background (if it exists) of the overlay icon. + if (overlay.background) { + const backgroundIconClassName = this.getIconClass(overlay.background.shape, iconAdditionalClasses); + overlayIcons.push( + h.div({ key: data.title.label + '-background', className: backgroundIconClassName, style: overlayIconStyle(overlay.background.color) }) + ); + } + // Parse the overlay icon. + const overlayIcon = (overlay as WidgetDecoration.IconOverlay).icon || (overlay as WidgetDecoration.IconClassOverlay).iconClass; + const overlayIconClassName = this.getIconClass(overlayIcon, iconAdditionalClasses); + overlayIcons.push( + h.span({ key: data.title.label, className: overlayIconClassName, style: overlayIconStyle(overlay.color) }) + ); + }); + return h.div({ className: wrapperClassName, style }, [baseIcon, ...overlayIcons]); + } + return h.div({ className: baseClassName, style }, data.title.iconLabel); + } + + protected renderEnhancedPreview(title: Title): HTMLDivElement { + const hoverBox = document.createElement('div'); + hoverBox.classList.add('theia-horizontal-tabBar-hover-div'); + const labelElement = document.createElement('p'); + labelElement.classList.add('theia-horizontal-tabBar-hover-title'); + labelElement.textContent = title.label; + hoverBox.append(labelElement); + const widget = title.owner; + if (EnhancedPreviewWidget.is(widget)) { + const enhancedPreviewNode = widget.getEnhancedPreviewNode(); + if (enhancedPreviewNode) { + hoverBox.appendChild(enhancedPreviewNode); + } + } else if (title.caption) { + const captionElement = document.createElement('p'); + captionElement.classList.add('theia-horizontal-tabBar-hover-caption'); + captionElement.textContent = title.caption; + hoverBox.appendChild(captionElement); + } + return hoverBox; + }; + + protected renderVisualPreview(desiredWidth: number, title: Title): HTMLElement | undefined { + const widget = title.owner; + // Check that the widget is not currently shown, is a PreviewableWidget and it was already loaded before + if (this.tabBar && this.tabBar.currentTitle !== title && PreviewableWidget.isPreviewable(widget)) { + const html = document.getElementById(widget.id); + if (html) { + const previewNode: Node | undefined = widget.getPreviewNode(); + if (previewNode) { + const clonedNode = previewNode.cloneNode(true); + const visualPreviewDiv = document.createElement('div'); + visualPreviewDiv.classList.add('enhanced-preview-container'); + // Add the clonedNode and get it from the children to have a HTMLElement instead of a Node + visualPreviewDiv.append(clonedNode); + const visualPreview = visualPreviewDiv.children.item(visualPreviewDiv.children.length - 1); + if (visualPreview instanceof HTMLElement) { + visualPreview.classList.remove('lm-mod-hidden'); + visualPreview.classList.add('enhanced-preview'); + visualPreview.id = `preview:${widget.id}`; + + // Use the current visible editor as a fallback if not available + const height: number = visualPreview.style.height === '' ? this.tabBar.currentTitle!.owner.node.offsetHeight : parseFloat(visualPreview.style.height); + const width: number = visualPreview.style.width === '' ? this.tabBar.currentTitle!.owner.node.offsetWidth : parseFloat(visualPreview.style.width); + const desiredRatio = 9 / 16; + const desiredHeight = desiredWidth * desiredRatio; + const ratio = height / width; + visualPreviewDiv.style.width = `${desiredWidth}px`; + visualPreviewDiv.style.height = `${desiredHeight}px`; + + // If the view is wider than the desiredRatio scale the width and crop the height. If the view is longer its the other way around. + const scale = ratio < desiredRatio ? (desiredHeight / height) : (desiredWidth / width); + visualPreview.style.transform = `scale(${scale},${scale})`; + visualPreview.style.removeProperty('top'); + visualPreview.style.removeProperty('left'); + + // Copy canvases (They are cloned empty) + const originalCanvases = html.getElementsByTagName('canvas'); + const previewCanvases = visualPreview.getElementsByTagName('canvas'); + // If this is not given, something went wrong during the cloning + if (originalCanvases.length === previewCanvases.length) { + for (let i = 0; i < originalCanvases.length; i++) { + const original = originalCanvases[i]; + // Skip canvases with no dimensions to avoid InvalidStateError and hence showing the entire tooltip at 0,0 + if (original.width > 0 && original.height > 0) { + previewCanvases[i].getContext('2d')?.drawImage(original, 0, 0); + } + } + } + + return visualPreviewDiv; + } + } + } + } + return undefined; + } + + protected handleMouseEnterEvent = (event: MouseEvent) => { + if (!this.tabBar || !this.hoverService || !(event.currentTarget instanceof HTMLElement)) { return; } + const id = event.currentTarget.id; + const title = this.tabBar.titles.find(t => this.createTabId(t) === id); + if (!title) { return; } + if (this.tabBar.orientation === 'horizontal' && this.corePreferences?.['window.tabbar.enhancedPreview'] !== 'classic') { + this.hoverService.requestHover({ + content: this.renderEnhancedPreview(title), + target: event.currentTarget, + position: 'bottom', + cssClasses: ['extended-tab-preview'], + visualPreview: this.corePreferences?.['window.tabbar.enhancedPreview'] === 'visual' && PreviewableWidget.is(title.owner) + ? width => this.renderVisualPreview(width, title) + : undefined + }); + } else if (title.caption) { + const position = this.tabBar.orientation === 'horizontal' ? 'bottom' : 'right'; + const tooltip = ArrayUtils.coalesce([title.caption, ...this.getDecorationData(title, 'tooltip')]).join(' - '); + // Preserve multiple consecutive spaces by replacing with non-breaking spaces + const preservedTooltip = tooltip.replace(/ {2,}/g, match => '\u00A0'.repeat(match.length)); + this.hoverService.requestHover({ + content: preservedTooltip, + target: event.currentTarget, + position + }); + } + }; + + protected handleContextMenuEvent = (event: MouseEvent) => { + if (this.contextMenuRenderer && this.contextMenuPath && event.currentTarget instanceof HTMLElement) { + event.stopPropagation(); + event.preventDefault(); + let widget: Widget | undefined = undefined; + if (this.tabBar) { + const titleIndex = Array.from(this.tabBar.contentNode.getElementsByClassName('lm-TabBar-tab')) + .findIndex(node => node.contains(event.currentTarget as HTMLElement)); + if (titleIndex !== -1) { + widget = this.tabBar.titles[titleIndex].owner; + } + } + + const oldSelection = this.selectionService?.selection; + if (widget && this.selectionService) { + this.selectionService.selection = NavigatableWidget.is(widget) ? { uri: widget.getResourceUri() } : widget; + } + + const contextKeyServiceOverlay = this.contextKeyService?.createOverlay([['isTerminalTab', widget && 'terminalId' in widget]]); + this.contextMenuRenderer.render({ + menuPath: this.contextMenuPath!, + anchor: event, + args: [event], + context: event.currentTarget, + contextKeyService: contextKeyServiceOverlay, + // We'd like to wait until the command triggered by the context menu has been run, but this should let it get through the preamble, at least. + onHide: () => setTimeout(() => { if (this.selectionService) { this.selectionService.selection = oldSelection; } }) + }); + } + }; + + protected handleCloseClickEvent = (event: MouseEvent) => { + if (this.tabBar && event.currentTarget instanceof HTMLElement) { + const id = event.currentTarget.parentElement!.id; + const title = this.tabBar.titles.find(t => this.createTabId(t) === id); + if (title?.closable === false && title?.className.includes(PINNED_CLASS) && this.commandService) { + this.commandService.executeCommand('workbench.action.unpinEditor', event); + } + } + }; + + protected handleDblClickEvent = (event: MouseEvent) => { + if (!this.corePreferences?.get('workbench.tab.maximize')) { + return; + } + if (this.tabBar && event.currentTarget instanceof HTMLElement) { + const id = event.currentTarget.id; + const title = this.tabBar.titles.find(t => this.createTabId(t) === id); + const area = title?.owner.parent; + if (area instanceof TheiaDockPanel && (area.id === BOTTOM_AREA_ID || area.id === MAIN_AREA_ID)) { + area.toggleMaximized(); + } + } + }; + +} + +export interface TabBarPrivateMethods { + _releaseMouse(): void; +} + +/** + * A specialized tab bar for the main and bottom areas. + */ +export class ScrollableTabBar extends TabBar { + + protected scrollBar: PerfectScrollbar | undefined; + + protected pendingReveal?: Promise; + protected isMouseOver = false; + protected needsRecompute = false; + protected tabSize = 0; + protected _dynamicTabOptions?: ScrollableTabBar.Options; + protected contentContainer: HTMLElement; + protected topRow: HTMLElement; + + protected readonly toDispose = new DisposableCollection(); + protected openTabsContainer: HTMLDivElement; + protected openTabsRoot: Root; + + constructor(options?: TabBar.IOptions, protected readonly scrollbarOptions?: PerfectScrollbar.Options, dynamicTabOptions?: ScrollableTabBar.Options) { + super(options); + this._dynamicTabOptions = dynamicTabOptions; + this.topRow = document.createElement('div'); + this.topRow.classList.add('theia-tabBar-tab-row'); + this.node.appendChild(this.topRow); + + const contentNode = this.contentNode; + if (!contentNode) { + throw new Error('tab bar does not have the content node.'); + } + this.node.removeChild(contentNode); + this.contentContainer = document.createElement('div'); + this.contentContainer.classList.add(ScrollableTabBar.Styles.TAB_BAR_CONTENT_CONTAINER); + this.contentContainer.appendChild(contentNode); + this.topRow.appendChild(this.contentContainer); + + this.openTabsContainer = document.createElement('div'); + this.openTabsContainer.classList.add('theia-tabBar-open-tabs'); + this.openTabsRoot = createRoot(this.openTabsContainer); + this.topRow.appendChild(this.openTabsContainer); + } + + set dynamicTabOptions(options: ScrollableTabBar.Options | undefined) { + this._dynamicTabOptions = options; + this.updateTabs(); + } + + get dynamicTabOptions(): ScrollableTabBar.Options | undefined { + return this._dynamicTabOptions; + } + + override dispose(): void { + if (this.isDisposed) { + return; + } + super.dispose(); + this.toDispose.dispose(); + } + + protected override onBeforeAttach(msg: Message): void { + this.contentNode.addEventListener('pointerdown', this); + this.contentNode.addEventListener('dblclick', this); + this.contentNode.addEventListener('keydown', this); + } + + protected override onAfterDetach(msg: Message): void { + this.contentNode.removeEventListener('pointerdown', this); + this.contentNode.removeEventListener('dblclick', this); + this.contentNode.removeEventListener('keydown', this); + this.doReleaseMouse(); + } + + protected doReleaseMouse(): void { + (this as unknown as TabBarPrivateMethods)._releaseMouse(); + } + + protected override onAfterAttach(msg: Message): void { + this.node.addEventListener('mouseenter', () => { this.isMouseOver = true; }); + this.node.addEventListener('mouseleave', () => { + this.isMouseOver = false; + if (this.needsRecompute) { + this.updateTabs(); + } + }); + + super.onAfterAttach(msg); + this.scrollBar = new PerfectScrollbar(this.contentContainer, this.scrollbarOptions); + } + + protected override onBeforeDetach(msg: Message): void { + super.onBeforeDetach(msg); + this.scrollBar?.destroy(); + } + + protected override onUpdateRequest(msg: Message): void { + this.updateTabs(); + } + + protected updateTabs(): void { + const content = []; + if (this.dynamicTabOptions) { + + this.openTabsRoot.render(createElement(SelectComponent, { + options: this.titles, + onChange: (option, index) => { + this.currentIndex = index; + }, + alignment: 'right' + })); + + if (this.isMouseOver) { + this.needsRecompute = true; + } else { + this.needsRecompute = false; + if (this.orientation === 'horizontal') { + let availableWidth = this.contentNode.clientWidth; + let effectiveWidth = availableWidth; + if (!this.openTabsContainer.classList.contains('lm-mod-hidden')) { + availableWidth += this.openTabsContainer.getBoundingClientRect().width; + } + if (this.dynamicTabOptions.minimumTabSize * this.titles.length <= availableWidth) { + effectiveWidth += this.openTabsContainer.getBoundingClientRect().width; + this.openTabsContainer.classList.add('lm-mod-hidden'); + } else { + this.openTabsContainer.classList.remove('lm-mod-hidden'); + } + this.tabSize = Math.max(Math.min(effectiveWidth / this.titles.length, + this.dynamicTabOptions.defaultTabSize), this.dynamicTabOptions.minimumTabSize); + } + } + this.node.classList.add('dynamic-tabs'); + } else { + this.openTabsContainer.classList.add('lm-mod-hidden'); + this.node.classList.remove('dynamic-tabs'); + } + for (let i = 0, n = this.titles.length; i < n; ++i) { + const title = this.titles[i]; + const current = title === this.currentTitle; + const zIndex = current ? n : n - i - 1; + const renderData: ScrollableRenderData = { title: title, current: current, zIndex: zIndex }; + if (this.dynamicTabOptions && this.orientation === 'horizontal') { + renderData.tabWidth = this.tabSize; + } + content[i] = this.renderer.renderTab(renderData); + } + VirtualDOM.render(content, this.contentNode); + if (this.scrollBar) { + if (!(this.dynamicTabOptions && this.isMouseOver)) { + this.scrollBar.update(); + } + } + } + + protected override onResize(msg: Widget.ResizeMessage): void { + super.onResize(msg); + if (this.dynamicTabOptions) { + this.updateTabs(); + } + if (this.scrollBar) { + if (this.currentIndex >= 0) { + this.revealTab(this.currentIndex); + } + this.scrollBar.update(); + } + } + + /** + * Reveal the tab with the given index by moving the scroll bar if necessary. + */ + revealTab(index: number): Promise { + if (this.pendingReveal) { + // A reveal has already been scheduled + return this.pendingReveal; + } + const result = new Promise((resolve, reject) => { + // The tab might not have been created yet, so wait until the next frame + window.requestAnimationFrame(() => { + const tab = this.contentNode.children[index] as HTMLElement; + if (tab && this.isVisible) { + const parent = this.contentContainer; + if (this.orientation === 'horizontal') { + const scroll = parent.scrollLeft; + const left = tab.offsetLeft; + if (scroll > left) { + parent.scrollLeft = left; + } else { + const right = left + tab.clientWidth - parent.clientWidth; + if (scroll < right && tab.clientWidth < parent.clientWidth) { + parent.scrollLeft = right; + } + } + } else { + const scroll = parent.scrollTop; + const top = tab.offsetTop; + if (scroll > top) { + parent.scrollTop = top; + } else { + const bottom = top + tab.clientHeight - parent.clientHeight; + if (scroll < bottom && tab.clientHeight < parent.clientHeight) { + parent.scrollTop = bottom; + } + } + } + } + if (this.pendingReveal === result) { + this.pendingReveal = undefined; + } + resolve(); + }); + }); + this.pendingReveal = result; + return result; + } +} + +export namespace ScrollableTabBar { + + export interface Options { + minimumTabSize: number; + defaultTabSize: number; + } + export namespace Styles { + + export const TAB_BAR_CONTENT_CONTAINER = 'lm-TabBar-content-container'; + + } +} + +/** + * Specialized scrollable tab-bar which comes with toolbar support. + * Instead of the following DOM structure. + * + * +-------------------------+ + * |[TAB_0][TAB_1][TAB_2][TAB| + * +-------------Scrollable--+ + * + * There is a dedicated HTML element for toolbar which does **not** contained in the scrollable element. + * + * +-------------------------+-----------------+ + * |[TAB_0][TAB_1][TAB_2][TAB| Toolbar | + * +-------------Scrollable--+-Non-Scrollable-+ + * + */ +export class ToolbarAwareTabBar extends ScrollableTabBar { + protected toolbar: TabBarToolbar | undefined; + protected breadcrumbsContainer: HTMLElement; + protected readonly breadcrumbsRenderer: BreadcrumbsRenderer; + protected dockPanel: TheiaDockPanel; + + constructor( + protected readonly tabBarToolbarRegistry: TabBarToolbarRegistry, + protected readonly tabBarToolbarFactory: () => TabBarToolbar, + protected readonly breadcrumbsRendererFactory: BreadcrumbsRendererFactory, + options?: TabBar.IOptions, + scrollbarOptions?: PerfectScrollbar.Options, + dynamicTabOptions?: ScrollableTabBar.Options + ) { + super(options, scrollbarOptions, dynamicTabOptions); + + this.breadcrumbsRenderer = this.breadcrumbsRendererFactory(); + this.breadcrumbsContainer = document.createElement('div'); + this.breadcrumbsContainer.classList.add('theia-tabBar-breadcrumb-row'); + this.breadcrumbsContainer.appendChild(this.breadcrumbsRenderer.host); + this.node.appendChild(this.breadcrumbsContainer); + + this.toolbar = this.tabBarToolbarFactory(); + this.toDispose.push(this.toolbar); + this.toDispose.push(this.tabBarToolbarRegistry.onDidChange(() => this.update())); + this.toDispose.push(this.breadcrumbsRenderer); + + if (!this.breadcrumbsRenderer.active) { + this.breadcrumbsContainer.style.setProperty('display', 'none'); + } else { + this.node.classList.add('theia-tabBar-multirow'); + } + this.toDispose.push(this.breadcrumbsRenderer.onDidChangeActiveState(active => { + if (active) { + this.breadcrumbsContainer.style.removeProperty('display'); + this.node.classList.add('theia-tabBar-multirow'); + } else { + this.breadcrumbsContainer.style.setProperty('display', 'none'); + this.node.classList.remove('theia-tabBar-multirow'); + } + if (this.dockPanel) { + this.dockPanel.fit(); + } + })); + const handler = () => this.updateBreadcrumbs(); + this.currentChanged.connect(handler); + this.toDispose.push(Disposable.create(() => this.currentChanged.disconnect(handler))); + } + + setDockPanel(panel: TheiaDockPanel): void { + this.dockPanel = panel; + } + + protected async updateBreadcrumbs(): Promise { + const current = this.currentTitle?.owner; + const uri = NavigatableWidget.is(current) ? current.getResourceUri() : undefined; + await this.breadcrumbsRenderer.refresh(uri); + } + + protected override onAfterAttach(msg: Message): void { + if (this.toolbar) { + if (this.toolbar.isAttached) { + Widget.detach(this.toolbar); + } + Widget.attach(this.toolbar, this.topRow); + if (this.breadcrumbsContainer) { + this.node.appendChild(this.breadcrumbsContainer); + } + this.updateBreadcrumbs(); + } + super.onAfterAttach(msg); + } + + protected override onBeforeDetach(msg: Message): void { + if (this.toolbar && this.toolbar.isAttached) { + Widget.detach(this.toolbar); + } + super.onBeforeDetach(msg); + } + + protected override onUpdateRequest(msg: Message): void { + super.onUpdateRequest(msg); + this.updateToolbar(); + } + + protected updateToolbar(): void { + if (!this.toolbar) { + return; + } + const widget = this.currentTitle?.owner ?? undefined; + this.toolbar.updateTarget(widget); + this.updateTabs(); + } + + override handleEvent(event: Event): void { + if (event instanceof MouseEvent) { + if (isContextMenuEvent(event)) { + // Let this bubble up to handle the context menu + return; + } + if (this.toolbar && this.toolbar.shouldHandleMouseEvent(event) || this.isOver(event, this.openTabsContainer)) { + // if the mouse event is over the toolbar part don't handle it. + return; + } + } + super.handleEvent(event); + } + + protected isOver(event: Event, element: Element): boolean { + return element && event.target instanceof Element && element.contains(event.target); + } +} + +/** + * A specialized tab bar for side areas. + */ +export class SideTabBar extends ScrollableTabBar { + + protected static readonly DRAG_THRESHOLD = 5; + + /** + * Emitted when a tab is added to the tab bar. + */ + readonly tabAdded = new Signal }>(this); + /** + * Side panels can be collapsed by clicking on the currently selected tab. This signal is + * emitted when the mouse is released on the selected tab without initiating a drag. + */ + readonly collapseRequested = new Signal>(this); + + /** + * Emitted when the set of overflowing/hidden tabs changes. + */ + readonly tabsOverflowChanged = new Signal[], startIndex: number }>(this); + + protected mouseData?: { + pressX: number, + pressY: number, + mouseDownTabIndex: number + }; + + protected tabsOverflowData?: { + titles: Title[], + startIndex: number + }; + + constructor(options?: TabBar.IOptions & PerfectScrollbar.Options) { + super(options); + + // Create the hidden content node (see `hiddenContentNode` for explanation) + const hiddenContent = document.createElement('ul'); + hiddenContent.className = HIDDEN_CONTENT_CLASS; + this.node.appendChild(hiddenContent); + } + + /** + * Tab bars of the left and right side panel are arranged vertically by rotating their labels. + * Rotation is realized with the CSS `transform` property, which disrupts the browser's ability + * to arrange the involved elements automatically. Therefore the elements are arranged explicitly + * by the TabBarRenderer using inline `height` and `top` styles. However, the size of labels + * must still be computed by the browser, so the rendering is performed in two steps: first the + * tab bar is rendered horizontally inside a _hidden content node_, then it is rendered again + * vertically inside the proper content node. After the first step, size information is gathered + * from all labels so it can be applied during the second step. + */ + get hiddenContentNode(): HTMLUListElement { + return this.node.getElementsByClassName(HIDDEN_CONTENT_CLASS)[0] as HTMLUListElement; + } + + override insertTab(index: number, value: Title | Title.IOptions): Title { + const result = super.insertTab(index, value); + this.tabAdded.emit({ title: result }); + return result; + } + + protected override onAfterAttach(msg: Message): void { + this.updateTabs(); + this.node.addEventListener('lm-dragenter', this); + this.node.addEventListener('lm-dragover', this); + this.node.addEventListener('lm-dragleave', this); + document.addEventListener('lm-drop', this); + } + + protected override onAfterDetach(msg: Message): void { + super.onAfterDetach(msg); + this.node.removeEventListener('lm-dragenter', this); + this.node.removeEventListener('lm-dragover', this); + this.node.removeEventListener('lm-dragleave', this); + document.removeEventListener('lm-drop', this); + } + + protected override onUpdateRequest(msg: Message): void { + this.updateTabs(); + } + + protected override onResize(msg: Widget.ResizeMessage): void { + // Tabs need to be updated if there are already overflowing tabs or the current tabs don't fit + if (this.tabsOverflowData || this.node.clientHeight < this.contentNode.clientHeight) { + this.updateTabs(); + } + } + + /** + * Reveal the tab with the given index by moving it into the non-overflowing tabBar section + * if necessary. + */ + override revealTab(index: number): Promise { + if (this.pendingReveal) { + // A reveal has already been scheduled + return this.pendingReveal; + } + const result = new Promise(resolve => { + // The tab might not have been created yet, so wait until the next frame + window.requestAnimationFrame(() => { + if (this.tabsOverflowData && index >= this.tabsOverflowData.startIndex) { + const title = this.titles[index]; + this.insertTab(this.tabsOverflowData.startIndex - 1, title); + } + + if (this.pendingReveal === result) { + this.pendingReveal = undefined; + } + resolve(); + }); + }); + this.pendingReveal = result; + return result; + } + + /** + * Render the tab bar in the _hidden content node_ (see `hiddenContentNode` for explanation), + * then gather size information for labels and render it again in the proper content node. + */ + protected override updateTabs(): void { + if (this.isAttached) { + // Render into the invisible node + this.renderTabs(this.hiddenContentNode); + // Await a rendering frame + window.requestAnimationFrame(() => { + const hiddenContent = this.hiddenContentNode; + const n = hiddenContent.children.length; + const renderData = new Array>(n); + for (let i = 0; i < n; i++) { + const hiddenTab = hiddenContent.children[i]; + // Extract tab padding, and margin from the computed style + const tabStyle = window.getComputedStyle(hiddenTab); + const rd: Partial = { + paddingTop: parseFloat(tabStyle.paddingTop!), + paddingBottom: parseFloat(tabStyle.paddingBottom!) + }; + // Extract label size from the DOM + const labelElements = hiddenTab.getElementsByClassName('lm-TabBar-tabLabel'); + if (labelElements.length === 1) { + const label = labelElements[0]; + rd.labelSize = { width: label.clientWidth, height: label.clientHeight }; + } + // Extract icon size from the DOM + const iconElements = hiddenTab.getElementsByClassName('lm-TabBar-tabIcon'); + if (iconElements.length === 1) { + const icon = iconElements[0]; + rd.iconSize = { width: icon.clientWidth, height: icon.clientHeight }; + } + + renderData[i] = rd; + } + // Render into the visible node + this.renderTabs(this.contentNode, renderData); + this.computeOverflowingTabsData(); + }); + } + } + + protected computeOverflowingTabsData(): void { + // ensure that render tabs has completed + window.requestAnimationFrame(() => { + const startIndex = this.hideOverflowingTabs(); + if (startIndex === -1) { + if (this.tabsOverflowData) { + this.tabsOverflowData = undefined; + this.tabsOverflowChanged.emit({ titles: [], startIndex }); + } + return; + } + const newOverflowingTabs = this.titles.slice(startIndex); + + if (!this.tabsOverflowData) { + this.tabsOverflowData = { titles: newOverflowingTabs, startIndex }; + this.tabsOverflowChanged.emit(this.tabsOverflowData); + return; + } + + if ((newOverflowingTabs.length !== (this.tabsOverflowData?.titles.length ?? 0)) || + newOverflowingTabs.find((newTitle, i) => newTitle !== this.tabsOverflowData?.titles[i]) !== undefined) { + this.tabsOverflowData = { titles: newOverflowingTabs, startIndex }; + this.tabsOverflowChanged.emit(this.tabsOverflowData); + } + }); + } + + /** + * Hide overflowing tabs and return the index of the first hidden tab. + */ + protected hideOverflowingTabs(): number { + const availableHeight = this.node.clientHeight; + const invisibleClass = 'lm-mod-invisible'; + let startIndex = -1; + const n = this.contentNode.children.length; + for (let i = 0; i < n; i++) { + const tab = this.contentNode.children[i] as HTMLLIElement; + if (tab.offsetTop + tab.offsetHeight >= availableHeight) { + tab.classList.add(invisibleClass); + if (startIndex === -1) { + startIndex = i; + /* If only one element is overflowing and the additional menu widget is visible (i.e. this.tabsOverflowData is set) + * there might already be enough space to show the last tab. In this case, we need to include the size of the + * additional menu widget and recheck if the last tab is visible */ + if (startIndex === n - 1 && this.tabsOverflowData) { + const additionalViewsMenu = this.node.parentElement?.querySelector('.theia-additional-views-menu') as HTMLDivElement; + if (tab.offsetTop + tab.offsetHeight < availableHeight + additionalViewsMenu.offsetHeight) { + tab.classList.remove(invisibleClass); + startIndex = -1; + } + } + } + } else { + tab.classList.remove(invisibleClass); + } + } + return startIndex; + } + + /** + * Render the tab bar using the given DOM element as host. The optional `renderData` is forwarded + * to the TabBarRenderer. + */ + protected renderTabs(host: HTMLElement, renderData?: Partial[]): void { + const titles = this.titles; + const n = titles.length; + const renderer = this.renderer as TabBarRenderer; + const currentTitle = this.currentTitle; + const content = new Array(n); + for (let i = 0; i < n; i++) { + const title = titles[i]; + const current = title === currentTitle; + const zIndex = current ? n : n - i - 1; + let rd: SideBarRenderData; + if (renderData && i < renderData.length) { + rd = { title, current, zIndex, ...renderData[i] }; + } else { + rd = { title, current, zIndex }; + } + // Based on how renderTabs() is called, assume renderData will be undefined when invoked for this.hiddenContentNode + content[i] = renderer.renderTab(rd, true, renderData === undefined); + } + VirtualDOM.render(content, host); + } + + /** + * The following event processing is used to generate `collapseRequested` signals + * when the mouse goes up on the currently selected tab without too much movement + * between `mousedown` and `mouseup`. The movement threshold is the same that + * is used by the superclass to detect a drag event. The `allowDeselect` option + * of the TabBar constructor cannot be used here because it is triggered when the + * mouse goes down, and thus collides with dragging. + */ + override handleEvent(event: Event): void { + switch (event.type) { + case 'pointerdown': + if (!isContextMenuEvent(event as PointerEvent)) { + this.onMouseDown(event as PointerEvent); + super.handleEvent(event); + } + break; + case 'pointerup': + if (!isContextMenuEvent(event as PointerEvent)) { + super.handleEvent(event); + this.onMouseUp(event as PointerEvent); + } + break; + case 'mousemove': + if (!isContextMenuEvent(event as PointerEvent)) { + this.onMouseMove(event as PointerEvent); + super.handleEvent(event); + } + break; + case 'lm-dragenter': + this.onDragEnter(event as Drag.Event); + break; + case 'lm-dragover': + this.onDragOver(event as Drag.Event); + break; + case 'lm-dragleave': case 'lm-drop': + this.cancelViewContainerDND(); + break; + case 'contextmenu': + // Let the event bubble up instead of quashing it in the superclass + break; + default: + super.handleEvent(event); + } + } + + protected onMouseDown(event: MouseEvent): void { + // Check for left mouse button and current mouse status + if (event.button !== 0 || this.mouseData) { + return; + } + + // Check whether the mouse went down on the current tab + const tabs = this.contentNode.children; + const index = ArrayExt.findFirstIndex(tabs, tab => ElementExt.hitTest(tab, event.clientX, event.clientY)); + if (index < 0 || index !== this.currentIndex) { + return; + } + + // Check whether the close button was clicked + const icon = tabs[index].querySelector(this.renderer.closeIconSelector); + if (icon && icon.contains(event.target as HTMLElement)) { + return; + } + + this.mouseData = { + pressX: event.clientX, + pressY: event.clientY, + mouseDownTabIndex: index + }; + } + + protected onMouseUp(event: MouseEvent): void { + // Check for left mouse button and current mouse status + if (event.button !== 0 || !this.mouseData) { + return; + } + + // Check whether the mouse went up on the current tab + const mouseDownTabIndex = this.mouseData.mouseDownTabIndex; + this.mouseData = undefined; + const tabs = this.contentNode.children; + const index = ArrayExt.findFirstIndex(tabs, tab => ElementExt.hitTest(tab, event.clientX, event.clientY)); + if (index < 0 || index !== mouseDownTabIndex) { + return; + } + + // Collapse the side bar + this.collapseRequested.emit(this.titles[index]); + } + + protected onMouseMove(event: MouseEvent): void { + // Check for left mouse button and current mouse status + if (event.button !== 0 || !this.mouseData) { + return; + } + + const data = this.mouseData; + const dx = Math.abs(event.clientX - data.pressX); + const dy = Math.abs(event.clientY - data.pressY); + const threshold = SideTabBar.DRAG_THRESHOLD; + if (dx >= threshold || dy >= threshold) { + this.mouseData = undefined; + } + } + + toCancelViewContainerDND = new DisposableCollection(); + protected cancelViewContainerDND = () => { + this.toCancelViewContainerDND.dispose(); + }; + + /** + * Handles `viewContainerPart` drag enter. + */ + protected onDragEnter = (event: Drag.Event) => { + this.cancelViewContainerDND(); + if (event.mimeData.getData('application/vnd.lumino.view-container-factory')) { + event.preventDefault(); + event.stopPropagation(); + } + }; + + /** + * Handle `viewContainerPart` drag over, + * Defines the appropriate `dropAction` and opens the tab on which the mouse stands on for more than 800 ms. + */ + protected onDragOver = (event: Drag.Event) => { + const factory = event.mimeData.getData('application/vnd.lumino.view-container-factory'); + const widget = factory && factory(); + if (!widget) { + event.dropAction = 'none'; + return; + } + event.preventDefault(); + event.stopPropagation(); + if (!this.toCancelViewContainerDND.disposed) { + event.dropAction = event.proposedAction; + return; + } + + const { target, clientX, clientY } = event; + if (target instanceof HTMLElement) { + if (widget.options.disableDraggingToOtherContainers || widget.viewContainer.disableDNDBetweenContainers) { + event.dropAction = 'none'; + target.classList.add('theia-cursor-no-drop'); + this.toCancelViewContainerDND.push(Disposable.create(() => { + target.classList.remove('theia-cursor-no-drop'); + })); + } else { + event.dropAction = event.proposedAction; + } + const { top, bottom, left, right, height } = target.getBoundingClientRect(); + const mouseOnTop = (clientY - top) < (height / 2); + const dropTargetClass = `drop-target-${mouseOnTop ? 'top' : 'bottom'}`; + const tabs = this.contentNode.children; + const targetTab = ArrayExt.findFirstValue(tabs, t => ElementExt.hitTest(t, clientX, clientY)); + if (!targetTab) { + return; + } + targetTab.classList.add(dropTargetClass); + this.toCancelViewContainerDND.push(Disposable.create(() => { + if (targetTab) { + targetTab.classList.remove(dropTargetClass); + } + })); + const openTabTimer = setTimeout(() => { + const title = this.titles.find(t => (this.renderer as TabBarRenderer).createTabId(t) === targetTab.id); + if (title) { + const mouseStillOnTab = clientX >= left && clientX <= right && clientY >= top && clientY <= bottom; + if (mouseStillOnTab) { + this.currentTitle = title; + } + } + }, 800); + this.toCancelViewContainerDND.push(Disposable.create(() => { + clearTimeout(openTabTimer); + })); + } + }; + +} diff --git a/packages/core/src/browser/shell/theia-dock-panel.ts b/packages/core/src/browser/shell/theia-dock-panel.ts new file mode 100644 index 0000000..cbd1301 --- /dev/null +++ b/packages/core/src/browser/shell/theia-dock-panel.ts @@ -0,0 +1,293 @@ +// ***************************************************************************** +// Copyright (C) 2018 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { find, toArray } from '@lumino/algorithm'; +import { TabBar, Widget, DockPanel, Title } from '@lumino/widgets'; +import { Signal } from '@lumino/signaling'; +import { Disposable, DisposableCollection } from '../../common/disposable'; +import { CorePreferences } from '../../common/core-preferences'; +import { Emitter, Event, environment } from '../../common'; +import { ToolbarAwareTabBar } from './tab-bars'; + +export const ACTIVE_TABBAR_CLASS = 'theia-tabBar-active'; + +export const MAIN_AREA_ID = 'theia-main-content-panel'; +export const BOTTOM_AREA_ID = 'theia-bottom-content-panel'; + +/** + * This specialization of DockPanel adds various events that are used for implementing the + * side panels of the application shell. + */ +export class TheiaDockPanel extends DockPanel { + + /** + * Emitted when a widget is added to the panel. + */ + readonly widgetAdded = new Signal(this); + /** + * Emitted when a widget is activated by calling `activateWidget`. + */ + readonly widgetActivated = new Signal(this); + /** + * Emitted when a widget is removed from the panel. + */ + readonly widgetRemoved = new Signal(this); + + protected readonly onDidChangeCurrentEmitter = new Emitter | undefined>(); + protected disableDND: boolean | undefined = false; + protected tabWithDNDDisabledStyling?: HTMLElement = undefined; + + get onDidChangeCurrent(): Event | undefined> { + return this.onDidChangeCurrentEmitter.event; + } + + constructor(options?: DockPanel.IOptions, + protected readonly preferences?: CorePreferences, + protected readonly maximizeCallback?: (area: TheiaDockPanel) => void + ) { + super(options); + this.disableDND = TheiaDockPanel.isTheiaDockPanelIOptions(options) && options.disableDragAndDrop; + this['_onCurrentChanged'] = (sender: TabBar, args: TabBar.ICurrentChangedArgs) => { + this.markAsCurrent(args.currentTitle || undefined); + super['_onCurrentChanged'](sender, args); + }; + + this['_createTabBar'] = () => { + // necessary for https://github.com/eclipse-theia/theia/issues/15273 + const tabBar = super['_createTabBar'](); + if (tabBar instanceof ToolbarAwareTabBar) { + tabBar.setDockPanel(this); + } + if (this.disableDND) { + tabBar['tabDetachRequested'].disconnect(this['_onTabDetachRequested'], this); + tabBar['tabDetachRequested'].connect(this.onTabDetachRequestedWithDisabledDND, this); + + // eslint-disable-next-line @typescript-eslint/no-explicit-any, no-null/no-null + let dragDataValue: any = null; + Object.defineProperty(tabBar, '_dragData', { + get: () => dragDataValue, + // eslint-disable-next-line @typescript-eslint/no-explicit-any + set: (value: any) => { + dragDataValue = value; + // eslint-disable-next-line no-null/no-null + if (value === null) { + this.onNullTabDragDataWithDisabledDND(); + } + }, + configurable: true + }); + } + return tabBar; + }; + this['_onTabActivateRequested'] = (sender: TabBar, args: TabBar.ITabActivateRequestedArgs) => { + this.markAsCurrent(args.title); + super['_onTabActivateRequested'](sender, args); + }; + this['_onTabCloseRequested'] = (sender: TabBar, args: TabBar.ITabCloseRequestedArgs) => { + if (TheiaDockPanel.isTheiaDockPanelIOptions(options) && options.closeHandler !== undefined) { + if (options.closeHandler(sender, args)) { + return; + } + } + super['_onTabCloseRequested'](sender, args); + }; + } + + protected onTabDetachRequestedWithDisabledDND(sender: TabBar, args: TabBar.ITabDetachRequestedArgs): void { + // don't process the detach request at all. We still want to support other drag starts, e.g. tab reorder + // provide visual feedback that DnD is disabled by adding not-allowed class + const tab = sender.contentNode.children[args.index] as HTMLElement; + if (tab) { + tab.classList.add('theia-drag-not-allowed'); + this.tabWithDNDDisabledStyling = tab; + } + } + + protected onNullTabDragDataWithDisabledDND(): void { + if (this.tabWithDNDDisabledStyling) { + this.tabWithDNDDisabledStyling.classList.remove('theia-drag-not-allowed'); + this.tabWithDNDDisabledStyling = undefined; + } + } + + override handleEvent(event: globalThis.Event): void { + if (this.disableDND) { + switch (event.type) { + case 'lm-dragenter': + case 'lm-dragleave': + case 'lm-dragover': + case 'lm-drop': + /* no-op */ + break; + default: + super.handleEvent(event); + } + } + super.handleEvent(event); + } + + toggleMaximized(): void { + if (this.maximizeCallback) { + this.maximizeCallback(this); + } + } + + isElectron(): boolean { + return environment.electron.is(); + } + + protected _currentTitle: Title | undefined; + get currentTitle(): Title | undefined { + return this._currentTitle; + } + + get currentTabBar(): TabBar | undefined { + return this._currentTitle && this.findTabBar(this._currentTitle); + } + + findTabBar(title: Title): TabBar | undefined { + return find(this.tabBars(), bar => bar.titles.includes(title)); + } + + protected readonly toDisposeOnMarkAsCurrent = new DisposableCollection(); + markAsCurrent(title: Title | undefined): void { + this.toDisposeOnMarkAsCurrent.dispose(); + this._currentTitle = title; + this.markActiveTabBar(title); + if (title) { + const resetCurrent = () => this.markAsCurrent(undefined); + title.owner.disposed.connect(resetCurrent); + this.toDisposeOnMarkAsCurrent.push(Disposable.create(() => + title.owner.disposed.disconnect(resetCurrent) + )); + } + this.onDidChangeCurrentEmitter.fire(title); + } + + markActiveTabBar(title?: Title): void { + const tabBars = toArray(this.tabBars()); + tabBars.forEach(tabBar => tabBar.removeClass(ACTIVE_TABBAR_CLASS)); + const activeTabBar = title && this.findTabBar(title); + if (activeTabBar) { + activeTabBar.addClass(ACTIVE_TABBAR_CLASS); + } else if (tabBars.length > 0) { + // At least one tabbar needs to be active + tabBars[0].addClass(ACTIVE_TABBAR_CLASS); + } + } + + override addWidget(widget: Widget, options?: TheiaDockPanel.AddOptions): void { + if (this.mode === 'single-document' && widget.parent === this) { + return; + } + super.addWidget(widget, options); + if (options?.closeRef) { + options.ref?.close(); + } + this.widgetAdded.emit(widget); + this.markActiveTabBar(widget.title); + } + + override activateWidget(widget: Widget): void { + super.activateWidget(widget); + this.widgetActivated.emit(widget); + this.markActiveTabBar(widget.title); + } + + protected override onChildRemoved(msg: Widget.ChildMessage): void { + super.onChildRemoved(msg); + this.widgetRemoved.emit(msg.child); + } + + nextTabBarWidget(widget: Widget): Widget | undefined { + const current = this.findTabBar(widget.title); + const next = current && this.nextTabBarInPanel(current); + return next && next.currentTitle && next.currentTitle.owner || undefined; + } + + nextTabBarInPanel(tabBar: TabBar): TabBar | undefined { + const tabBars = toArray(this.tabBars()); + const index = tabBars.indexOf(tabBar); + if (index !== -1) { + return tabBars[index + 1]; + } + return undefined; + } + + previousTabBarWidget(widget: Widget): Widget | undefined { + const current = this.findTabBar(widget.title); + const previous = current && this.previousTabBarInPanel(current); + return previous && previous.currentTitle && previous.currentTitle.owner || undefined; + } + + previousTabBarInPanel(tabBar: TabBar): TabBar | undefined { + const tabBars = toArray(this.tabBars()); + const index = tabBars.indexOf(tabBar); + if (index !== -1) { + return tabBars[index - 1]; + } + return undefined; + } + + override dispose(): void { + super.dispose(); + this.onDidChangeCurrentEmitter.dispose(); + this._currentTitle = undefined; + this.toDisposeOnMarkAsCurrent.dispose(); + } +} +export namespace TheiaDockPanel { + export const Factory = Symbol('TheiaDockPanel#Factory'); + export interface Factory { + (options?: DockPanel.IOptions | TheiaDockPanel.IOptions, maximizeCallback?: (area: TheiaDockPanel) => void): TheiaDockPanel; + } + + export interface IOptions extends DockPanel.IOptions { + /** whether drag and drop for tabs should be disabled */ + disableDragAndDrop?: boolean; + + /** + * @param sender the tab bar + * @param args the widget (title) + * @returns true if the request was handled by this handler, false if the tabbar should handle the request + */ + closeHandler?: (sender: TabBar, args: TabBar.ITabCloseRequestedArgs) => boolean; + } + + export function isTheiaDockPanelIOptions(options: DockPanel.IOptions | undefined): options is IOptions { + if (options === undefined) { + return false; + } + if ('disableDragAndDrop' in options) { + if (options.disableDragAndDrop !== undefined && typeof options.disableDragAndDrop !== 'boolean') { + return false; + } + } + if ('closeHandler' in options) { + if (options.closeHandler !== undefined && typeof options.closeHandler !== 'function') { + return false; + } + } + return true; + } + + export interface AddOptions extends DockPanel.IAddOptions { + /** + * Whether to also close the widget referenced by `ref`. + */ + closeRef?: boolean + } +} diff --git a/packages/core/src/browser/shell/theia-split-panel.ts b/packages/core/src/browser/shell/theia-split-panel.ts new file mode 100644 index 0000000..e4555f0 --- /dev/null +++ b/packages/core/src/browser/shell/theia-split-panel.ts @@ -0,0 +1,56 @@ +// ***************************************************************************** +// Copyright (C) 2025 STMicroelectronics and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { SplitLayout, SplitPanel } from '@lumino/widgets'; + +export class TheiaSplitPanel extends SplitPanel { + constructor(options?: SplitPanel.IOptions) { + super(options); + + let oldCursor: string | undefined; + let pointerId: number | undefined; + + this['_evtPointerDown'] = (event: PointerEvent) => { + super['_evtPointerDown'](event); + if (this['_pressData']) { // indicating that the drag has started + this.node.setPointerCapture(event.pointerId); + pointerId = event.pointerId; + const layout = this.layout as SplitLayout; + const handle = layout.handles.find(h => h.contains(event.target as HTMLElement)); + if (handle) { + const style = window.getComputedStyle(handle); + oldCursor = this.node.style.cursor; + this.node.style.cursor = style.cursor; + } + } + }; + this['_releaseMouse'] = () => { + super['_releaseMouse'](); + if (oldCursor !== undefined) { + this.node.style.cursor = oldCursor; + oldCursor = undefined; + } + if (pointerId) { + this.node.releasePointerCapture(pointerId); + pointerId = undefined; + } + }; + } + + override handleEvent(event: Event): void { + super.handleEvent(event); + } +} diff --git a/packages/core/src/browser/shell/view-column-service.ts b/packages/core/src/browser/shell/view-column-service.ts new file mode 100644 index 0000000..2d0dbb5 --- /dev/null +++ b/packages/core/src/browser/shell/view-column-service.ts @@ -0,0 +1,125 @@ +// ***************************************************************************** +// Copyright (C) 2019 Red Hat, Inc. and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { injectable, inject } from 'inversify'; +import { Emitter, Event } from '../../common/event'; +import { ApplicationShell } from './application-shell'; +import { toArray } from '@lumino/algorithm'; +import { TabBar, Widget } from '@lumino/widgets'; + +@injectable() +export class ViewColumnService { + private readonly columnValues = new Map(); + private readonly viewColumnIds = new Map(); + + protected readonly onViewColumnChangedEmitter = new Emitter<{ id: string, viewColumn: number }>(); + + constructor( + @inject(ApplicationShell) private readonly shell: ApplicationShell, + ) { + let oldColumnValues = new Map(); + const update = async () => { + await new Promise((resolve => setTimeout(resolve))); + this.updateViewColumns(); + this.viewColumnIds.forEach((ids: string[], viewColumn: number) => { + ids.forEach((id: string) => { + if (!oldColumnValues.has(id) || oldColumnValues.get(id) !== viewColumn) { + this.onViewColumnChangedEmitter.fire({ id, viewColumn }); + } + }); + }); + oldColumnValues = new Map(this.columnValues.entries()); + }; + this.shell.mainPanel.widgetAdded.connect(() => update()); + this.shell.mainPanel.widgetRemoved.connect(() => update()); + } + + get onViewColumnChanged(): Event<{ id: string, viewColumn: number }> { + return this.onViewColumnChangedEmitter.event; + } + + updateViewColumns(): void { + this.columnValues.clear(); + this.viewColumnIds.clear(); + + const rows = new Map>(); + const columns = new Map>>(); + for (const tabBar of toArray(this.shell.mainPanel.tabBars())) { + if (!tabBar.node.style.top || !tabBar.node.style.left) { + continue; + } + const top = parseInt(tabBar.node.style.top); + const left = parseInt(tabBar.node.style.left); + + const row = rows.get(top) || new Set(); + row.add(left); + rows.set(top, row); + + const column = columns.get(left) || new Map>(); + column.set(top, tabBar); + columns.set(left, column); + } + const firstRow = rows.get([...rows.keys()].sort()[0]); + if (!firstRow) { + return; + } + const lefts = [...firstRow.keys()].sort(); + for (let i = 0; i < lefts.length; i++) { + const column = columns.get(lefts[i]); + if (!column) { + break; + } + const cellIndexes = [...column.keys()].sort(); + let viewColumn = Math.min(i, 2); + for (let j = 0; j < cellIndexes.length; j++) { + const cell = column.get(cellIndexes[j]); + if (!cell) { + break; + } + this.setViewColumn(cell, viewColumn); + if (viewColumn < 7) { + viewColumn += 3; + } + } + } + } + + protected setViewColumn(tabBar: TabBar, viewColumn: number): void { + const ids = []; + for (const title of tabBar.titles) { + const id = title.owner.id; + ids.push(id); + this.columnValues.set(id, viewColumn); + } + this.viewColumnIds.set(viewColumn, ids); + } + + getViewColumnIds(viewColumn: number): string[] { + return this.viewColumnIds.get(viewColumn) || []; + } + + getViewColumn(id: string): number | undefined { + return this.columnValues.get(id); + } + + hasViewColumn(id: string): boolean { + return this.columnValues.has(id); + } + + viewColumnsSize(): number { + return this.viewColumnIds.size; + } +} diff --git a/packages/core/src/browser/shell/view-contribution.ts b/packages/core/src/browser/shell/view-contribution.ts new file mode 100644 index 0000000..6229664 --- /dev/null +++ b/packages/core/src/browser/shell/view-contribution.ts @@ -0,0 +1,178 @@ +// ***************************************************************************** +// Copyright (C) 2018 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { injectable, inject, interfaces, optional, unmanaged } from 'inversify'; +import { Widget } from '@lumino/widgets'; +import { + MenuModelRegistry, Command, CommandContribution, + MenuContribution, CommandRegistry, nls +} from '../../common'; +import { KeybindingContribution, KeybindingRegistry } from '../keybinding'; +import { WidgetManager } from '../widget-manager'; +import { CommonMenus } from '../common-menus'; +import { ApplicationShell } from './application-shell'; +import { QuickViewService } from '../quick-input'; + +export interface OpenViewArguments extends ApplicationShell.WidgetOptions { + toggle?: boolean + activate?: boolean; + reveal?: boolean; +} + +export interface ViewContributionOptions { + widgetId: string; + viewContainerId?: string; + widgetName: string; + defaultWidgetOptions: ApplicationShell.WidgetOptions; + toggleCommandId?: string; + toggleKeybinding?: string; +} + +export function bindViewContribution>(bind: interfaces.Bind, identifier: interfaces.Newable): interfaces.BindingWhenOnSyntax { + const syntax = bind(identifier).toSelf().inSingletonScope(); + bind(CommandContribution).toService(identifier); + bind(KeybindingContribution).toService(identifier); + bind(MenuContribution).toService(identifier); + return syntax; +} + +/** + * An abstract superclass for frontend contributions that add a view to the application shell. + */ +@injectable() +export abstract class AbstractViewContribution implements CommandContribution, MenuContribution, KeybindingContribution { + + @inject(WidgetManager) protected readonly widgetManager: WidgetManager; + @inject(ApplicationShell) protected readonly shell: ApplicationShell; + + @inject(QuickViewService) @optional() + protected readonly quickView: QuickViewService; + + readonly toggleCommand?: Command; + + constructor( + @unmanaged() protected readonly options: ViewContributionOptions + ) { + if (options.toggleCommandId) { + this.toggleCommand = { + id: options.toggleCommandId, + category: nls.localizeByDefault('View'), + label: nls.localizeByDefault('Toggle {0}', this.viewLabel) + }; + } + } + + get viewId(): string { + return this.options.widgetId; + } + + get viewLabel(): string { + return this.options.widgetName; + } + + get defaultViewOptions(): ApplicationShell.WidgetOptions { + return this.options.defaultWidgetOptions; + } + + get widget(): Promise { + return this.widgetManager.getOrCreateWidget(this.viewId); + } + + tryGetWidget(): T | undefined { + return this.widgetManager.tryGetWidget(this.viewId); + } + + async openView(args: Partial = {}): Promise { + const shell = this.shell; + const widget = await this.widgetManager.getOrCreateWidget(this.options.viewContainerId || this.viewId); + const tabBar = shell.getTabBarFor(widget); + const area = shell.getAreaFor(widget); + if (!tabBar) { + // The widget is not attached yet, so add it to the shell + const widgetArgs: OpenViewArguments = { + ...this.defaultViewOptions, + ...args + }; + await shell.addWidget(widget, widgetArgs); + } else if (args.toggle && area && shell.isExpanded(area) && tabBar.currentTitle === widget.title) { + // The widget is attached and visible, so collapse the containing panel (toggle) + switch (area) { + case 'left': + case 'right': + await shell.collapsePanel(area); + break; + case 'bottom': + // Don't collapse the bottom panel if it's currently split + if (shell.bottomAreaTabBars.length === 1) { + await shell.collapsePanel('bottom'); + } + break; + default: + // The main area cannot be collapsed, so close the widget + await this.closeView(); + } + return this.widget; + } + if (widget.isAttached && args.activate) { + await shell.activateWidget(this.viewId); + } else if (widget.isAttached && args.reveal) { + await shell.revealWidget(this.viewId); + } + return this.widget; + } + + registerCommands(commands: CommandRegistry): void { + if (this.toggleCommand) { + commands.registerCommand(this.toggleCommand, { + execute: () => this.toggleView() + }); + } + this.quickView?.registerItem({ + label: this.viewLabel, + open: () => this.openView({ activate: true }) + }); + } + + async closeView(): Promise { + const widget = await this.shell.closeWidget(this.viewId); + return widget as T | undefined; + } + + toggleView(): Promise { + return this.openView({ + toggle: true, + activate: true + }); + } + + registerMenus(menus: MenuModelRegistry): void { + if (this.toggleCommand) { + menus.registerMenuAction(CommonMenus.VIEW_VIEWS, { + commandId: this.toggleCommand.id, + label: this.viewLabel + }); + } + } + + registerKeybindings(keybindings: KeybindingRegistry): void { + if (this.toggleCommand && this.options.toggleKeybinding) { + keybindings.registerKeybinding({ + command: this.toggleCommand.id, + keybinding: this.options.toggleKeybinding + }); + } + } +} diff --git a/packages/core/src/browser/source-tree/index.ts b/packages/core/src/browser/source-tree/index.ts new file mode 100644 index 0000000..a450303 --- /dev/null +++ b/packages/core/src/browser/source-tree/index.ts @@ -0,0 +1,19 @@ +// ***************************************************************************** +// Copyright (C) 2018 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +export * from './tree-source'; +export * from './source-tree'; +export * from './source-tree-widget'; diff --git a/packages/core/src/browser/source-tree/source-tree-widget.tsx b/packages/core/src/browser/source-tree/source-tree-widget.tsx new file mode 100644 index 0000000..fb13ce5 --- /dev/null +++ b/packages/core/src/browser/source-tree/source-tree-widget.tsx @@ -0,0 +1,107 @@ +// ***************************************************************************** +// Copyright (C) 2018 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import * as React from 'react'; +import { injectable, postConstruct, interfaces, Container } from 'inversify'; +import { DisposableCollection } from '../../common/disposable'; +import { TreeWidget, TreeNode, createTreeContainer, TreeProps, TreeModel, TREE_NODE_SEGMENT_GROW_CLASS } from '../tree'; +import { TreeSource, TreeElement } from './tree-source'; +import { SourceTree, TreeElementNode, TreeSourceNode } from './source-tree'; + +@injectable() +export class SourceTreeWidget extends TreeWidget { + + static createContainer(parent: interfaces.Container, props?: Partial): Container { + const child = createTreeContainer(parent, { + props, + tree: SourceTree, + widget: SourceTreeWidget, + }); + + return child; + } + + @postConstruct() + protected override init(): void { + super.init(); + this.addClass('theia-source-tree'); + this.toDispose.push(this.model.onOpenNode(node => { + if (TreeElementNode.is(node) && node.element.open) { + node.element.open(); + } + })); + } + + protected readonly toDisposeOnSource = new DisposableCollection(); + get source(): TreeSource | undefined { + const root = this.model.root; + return TreeSourceNode.is(root) ? root.source : undefined; + } + set source(source: TreeSource | undefined) { + if (this.source === source) { + return; + } + this.toDisposeOnSource.dispose(); + this.toDispose.push(this.toDisposeOnSource); + this.model.root = TreeSourceNode.to(source); + if (source) { + this.toDisposeOnSource.push(source.onDidChange(() => this.model.refresh())); + } + } + + get selectedElement(): TreeElement | undefined { + const node = this.model.selectedNodes[0]; + return TreeElementNode.is(node) && node.element || undefined; + } + + protected override renderTree(model: TreeModel): React.ReactNode { + if (TreeSourceNode.is(model.root) && model.root.children.length === 0) { + const { placeholder } = model.root.source; + if (placeholder) { + return
    {placeholder}
    ; + } + } + return super.renderTree(model); + + } + + protected override renderCaption(node: TreeNode): React.ReactNode { + if (TreeElementNode.is(node)) { + const classNames = this.createTreeElementNodeClassNames(node); + return
    {node.element.render(this)}
    ; + } + return undefined; + } + protected createTreeElementNodeClassNames(node: TreeElementNode): string[] { + return [TREE_NODE_SEGMENT_GROW_CLASS]; + } + + override storeState(): object { + // no-op + return {}; + } + protected superStoreState(): object { + return super.storeState(); + } + override restoreState(state: object): void { + // no-op + } + protected superRestoreState(state: object): void { + super.restoreState(state); + return; + } + +} diff --git a/packages/core/src/browser/source-tree/source-tree.ts b/packages/core/src/browser/source-tree/source-tree.ts new file mode 100644 index 0000000..ed54beb --- /dev/null +++ b/packages/core/src/browser/source-tree/source-tree.ts @@ -0,0 +1,147 @@ +// ***************************************************************************** +// Copyright (C) 2018 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +/* eslint-disable @typescript-eslint/no-explicit-any */ + +import { injectable } from 'inversify'; +import { MaybePromise } from '../../common/types'; +import { TreeImpl, CompositeTreeNode, TreeNode, SelectableTreeNode, ExpandableTreeNode } from '../tree'; +import { TreeElement, CompositeTreeElement, TreeSource } from './tree-source'; + +@injectable() +export class SourceTree extends TreeImpl { + + override async resolveChildren(parent: TreeElementNodeParent): Promise { + const elements = await this.resolveElements(parent); + const nodes: TreeNode[] = []; + let index = 0; + for (const element of elements) { + if (element.visible !== false) { + nodes.push(this.toNode(element, index++, parent)); + } + } + return nodes; + } + + protected resolveElements(parent: TreeElementNodeParent): MaybePromise> { + if (TreeSourceNode.is(parent)) { + return parent.source.getElements(); + } + return parent.element.getElements(); + } + + protected toNode(element: TreeElement, index: number, parent: TreeElementNodeParent): TreeElementNode { + const id = element.id ? String(element.id) : (parent.id + ':' + index); + const name = id; + const existing = this.getNode(id); + const updated = existing && Object.assign(existing, { element, parent }); + if (CompositeTreeElement.hasElements(element)) { + const expand = element.expandByDefault ? element.expandByDefault() : false; + if (updated) { + if (!ExpandableTreeNode.is(updated)) { + Object.assign(updated, { expanded: expand }); + } + if (!CompositeTreeNode.is(updated)) { + Object.assign(updated, { children: [] }); + } + return updated; + } + return { + element, + parent, + id, + name, + selected: false, + expanded: expand, + children: [] + } as TreeElementNode; + } + if (CompositeTreeElementNode.is(updated)) { + delete (updated as any).expanded; + delete (updated as any).children; + } + if (updated) { + if (ExpandableTreeNode.is(updated)) { + delete (updated as any).expanded; + } + if (CompositeTreeNode.is(updated)) { + delete (updated as any).children; + } + return updated; + } + return { + element, + parent, + id, + name, + selected: false + }; + } + +} + +export type TreeElementNodeParent = CompositeTreeElementNode | TreeSourceNode; + +export interface TreeElementNode extends TreeNode, SelectableTreeNode { + element: TreeElement + parent: TreeElementNodeParent +} +export namespace TreeElementNode { + export function is(node: TreeNode | undefined): node is TreeElementNode { + return SelectableTreeNode.is(node) && 'element' in node; + } +} + +export interface CompositeTreeElementNode extends TreeElementNode, CompositeTreeNode, ExpandableTreeNode { + element: CompositeTreeElement + children: TreeElementNode[] + parent: TreeElementNodeParent +} +export namespace CompositeTreeElementNode { + export function is(node: TreeNode | undefined): node is CompositeTreeElementNode { + return TreeElementNode.is(node) && CompositeTreeNode.is(node) && ExpandableTreeNode.is(node) && !!node.visible; + } +} + +export interface TreeSourceNode extends CompositeTreeNode, SelectableTreeNode { + visible: false + children: TreeElementNode[] + parent: undefined + source: TreeSource +} +export namespace TreeSourceNode { + export function is(node: TreeNode | undefined): node is TreeSourceNode { + return CompositeTreeNode.is(node) && !node.visible && 'source' in node; + } + export function to(source: undefined): undefined; + export function to(source: TreeSource): TreeSourceNode; + export function to(source: TreeSource | undefined): TreeSourceNode | undefined; + export function to(source: TreeSource | undefined): TreeSourceNode | undefined { + if (!source) { + return source; + } + const id = source.id || '__source__'; + return { + id, + name: id, + visible: false, + children: [], + source, + parent: undefined, + selected: false + }; + } +} diff --git a/packages/core/src/browser/source-tree/tree-source.ts b/packages/core/src/browser/source-tree/tree-source.ts new file mode 100644 index 0000000..a46a947 --- /dev/null +++ b/packages/core/src/browser/source-tree/tree-source.ts @@ -0,0 +1,74 @@ +// ***************************************************************************** +// Copyright (C) 2018 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +/* eslint-disable @typescript-eslint/no-explicit-any */ + +import { ReactNode } from 'react'; +import { injectable, unmanaged } from 'inversify'; +import { Disposable, DisposableCollection, Emitter, Event, isObject, MaybePromise } from '../../common'; +import { TreeWidget } from '../tree'; + +export interface TreeElement { + /** default: parent id + position among siblings */ + readonly id?: number | string | undefined + /** default: true */ + readonly visible?: boolean + render(host: TreeWidget): ReactNode + open?(): MaybePromise +} + +export interface CompositeTreeElement extends TreeElement { + /** default: true */ + readonly hasElements?: boolean + getElements(): MaybePromise> + expandByDefault?(): boolean +} +export namespace CompositeTreeElement { + export function is(element: unknown): element is CompositeTreeElement { + return isObject(element) && 'getElements' in element; + } + export function hasElements(element: unknown): element is CompositeTreeElement { + return is(element) && element.hasElements !== false; + } +} + +@injectable() +export abstract class TreeSource implements Disposable { + protected readonly onDidChangeEmitter = new Emitter(); + readonly onDidChange: Event = this.onDidChangeEmitter.event; + protected fireDidChange(): void { + this.onDidChangeEmitter.fire(undefined); + } + + readonly id: string | undefined; + readonly placeholder: string | undefined; + + constructor(@unmanaged() options: TreeSourceOptions = {}) { + this.id = options.id; + this.placeholder = options.placeholder; + } + + protected readonly toDispose = new DisposableCollection(this.onDidChangeEmitter); + dispose(): void { + this.toDispose.dispose(); + } + + abstract getElements(): MaybePromise>; +} +export interface TreeSourceOptions { + id?: string + placeholder?: string +} diff --git a/packages/core/src/browser/status-bar/index.ts b/packages/core/src/browser/status-bar/index.ts new file mode 100644 index 0000000..6278f2b --- /dev/null +++ b/packages/core/src/browser/status-bar/index.ts @@ -0,0 +1,29 @@ +// ***************************************************************************** +// Copyright (C) 2018 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { interfaces } from 'inversify'; +import { StatusBarImpl } from './status-bar'; +import { StatusBar } from './status-bar-types'; +import { StatusBarViewModel } from './status-bar-view-model'; +export * from './status-bar'; +export * from './status-bar-types'; +export * from './status-bar-view-model'; + +export function bindStatusBar(bind: interfaces.Bind): void { + bind(StatusBarImpl).toSelf().inSingletonScope(); + bind(StatusBar).to(StatusBarImpl).inSingletonScope(); + bind(StatusBarViewModel).toSelf().inSingletonScope(); +} diff --git a/packages/core/src/browser/status-bar/status-bar-types.ts b/packages/core/src/browser/status-bar/status-bar-types.ts new file mode 100644 index 0000000..dd6e471 --- /dev/null +++ b/packages/core/src/browser/status-bar/status-bar-types.ts @@ -0,0 +1,98 @@ +// ***************************************************************************** +// Copyright (C) 2022 Ericsson and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { MarkdownString } from '../../common/markdown-rendering/markdown-string'; +import { AccessibilityInformation } from '../../common/accessibility'; +import { CancellationToken, MaybePromise } from '../../common'; + +export interface StatusBarEntry { + /** + * For icons we use Codicons by default, and Font Awesome icons will also be respected. + * You can find Codicon classnames here: https://microsoft.github.io/vscode-codicons/dist/codicon.html + * You can find Font Awesome classnames here: http://fontawesome.io/icons/ + * + * + * Codicon: $() or $(codicon-) + * + * Font Awesome: $(fa-) + * + * To use animated icons use the following pattern: + * $(iconClassName~typeOfAnimation) + * Type of animation can be either spin or pulse. + * Look here for more information to animated icons: + * http://fontawesome.io/examples/#animated + */ + text: string; + alignment: StatusBarAlignment; + name?: string; + color?: string; + backgroundColor?: string; + className?: string; + tooltip?: string | MarkdownString | HTMLElement | ((token: CancellationToken) => MaybePromise); + command?: string; + arguments?: unknown[]; + priority?: number; + accessibilityInformation?: AccessibilityInformation; + affinity?: StatusBarAffinity; + onclick?: (e: MouseEvent) => void; +} + +export enum StatusBarAlignment { + LEFT, RIGHT +} + +export const STATUSBAR_WIDGET_FACTORY_ID = 'statusBar'; + +export const StatusBar = Symbol('StatusBar'); + +export interface StatusBar { + setBackgroundColor(color?: string): Promise; + setColor(color?: string): Promise; + setElement(id: string, entry: StatusBarEntry): Promise; + removeElement(id: string): Promise; +} + +export interface StatusBarAffinity { + /** + * a reference to the {@link StatusBarEntry.id id} of another entry relative to which this item should be positioned. + */ + id: string; + + /** + * Where to position this entry relative to the entry referred to in the `id` field. + */ + alignment: StatusBarAlignment; + + /** + * Whether to treat this entry and the reference entry as a single entity for positioning and hover highlights + */ + compact?: boolean; +} + +export interface StatusBarViewModelEntry { + id: string; + leftChildren: StatusBarViewModelEntry[]; + head: StatusBarEntry; + rightChildren: StatusBarViewModelEntry[]; +} + +export interface StatusBarViewEntry { + id: string, + entry: StatusBarEntry; + compact?: boolean; + /** Only present if compact = true */ + alignment?: StatusBarAlignment; +} diff --git a/packages/core/src/browser/status-bar/status-bar-view-model.ts b/packages/core/src/browser/status-bar/status-bar-view-model.ts new file mode 100644 index 0000000..4ae64d8 --- /dev/null +++ b/packages/core/src/browser/status-bar/status-bar-view-model.ts @@ -0,0 +1,209 @@ +// ***************************************************************************** +// Copyright (C) 2022 Ericsson and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { injectable } from 'inversify'; +import { ArrayUtils, Emitter, Event } from '../../common'; +import { StatusBarAlignment, StatusBarEntry, StatusBarViewEntry, StatusBarViewModelEntry } from './status-bar-types'; + +interface EntryLocation { + container: StatusBarViewModelEntry[]; + index: number; + entry: StatusBarViewModelEntry; +} + +@injectable() +export class StatusBarViewModel { + protected leftTree = new Array(); + protected rightTree = new Array(); + protected containerPointers = new Map(); + protected onDidChangeEmitter = new Emitter(); + get onDidChange(): Event { + return this.onDidChangeEmitter.event; + } + + *getLeft(): IterableIterator { + yield* this.getEntries(this.leftTree); + } + + *getRight(): IterableIterator { + yield* this.getEntries(this.rightTree); + } + + *getEntries(list: StatusBarViewModelEntry[]): IterableIterator { + for (const item of list) { + yield* this.getChildren(item.leftChildren, StatusBarAlignment.LEFT); + yield { entry: item.head, id: item.id }; + yield* this.getChildren(item.rightChildren, StatusBarAlignment.RIGHT); + } + } + + *getChildren(list: StatusBarViewModelEntry[], alignment: StatusBarAlignment, compact?: boolean): IterableIterator { + for (const item of list) { + if (item.leftChildren.length || item.rightChildren.length) { + console.warn(`Found embedded entries with affinity to ${item.id}. They will inherit alignment and compactness of parent.`); + } + yield* this.getChildren(item.leftChildren, alignment, item.head.affinity?.compact); + yield { entry: item.head, id: item.id, alignment, compact: compact || item.head.affinity?.compact }; + yield* this.getChildren(item.rightChildren, alignment, item.head.affinity?.compact); + } + } + + set(id: string, entry: StatusBarEntry): void { + const existing = this.findElement(id); + if (existing) { + const oldEntry = existing.entry.head; + existing.entry.head = entry; + if (!this.shareSameContainer(entry, oldEntry)) { + this.relocate(existing); + } else if (!this.shareSamePriority(entry, oldEntry)) { + this.sort(existing.container); + } + } else { + const container = this.getContainerFor(entry); + const viewModelEntry = { id, head: entry, leftChildren: [], rightChildren: [] }; + container.push(viewModelEntry); + this.containerPointers.set(id, container); + const pendingDependents = this.getDependentsOf(id); + pendingDependents.forEach(newChild => this.relocate(newChild, true)); + this.sortDependents(viewModelEntry.leftChildren); + this.sortDependents(viewModelEntry.rightChildren); + this.sort(container); + } + this.onDidChangeEmitter.fire(); + } + + protected relocate(locationData: EntryLocation, dontSort?: boolean): void { + const newContainer = this.getContainerFor(locationData.entry.head); + locationData.container.splice(locationData.index, 1); + newContainer.push(locationData.entry); + this.containerPointers.set(locationData.entry.id, newContainer); + if (!dontSort) { + this.sort(newContainer); + } + } + + protected getContainerFor(entry: StatusBarEntry): StatusBarViewModelEntry[] { + const affinityParent = entry.affinity && this.findElement(entry.affinity.id); + if (affinityParent) { + return entry.affinity!.alignment === StatusBarAlignment.LEFT ? affinityParent.entry.leftChildren : affinityParent.entry.rightChildren; + } + return entry.alignment === StatusBarAlignment.LEFT ? this.leftTree : this.rightTree; + } + + protected getDependentsOf(id: string): EntryLocation[] { + const dependents = []; + for (let index = 0; index < this.rightTree.length || index < this.leftTree.length; index++) { + if (this.rightTree[index]?.head.affinity?.id === id) { + dependents.push({ index, container: this.rightTree, entry: this.rightTree[index] }); + } + if (this.leftTree[index]?.head.affinity?.id === id) { + dependents.push({ index, container: this.leftTree, entry: this.leftTree[index] }); + } + } + return dependents; + } + + remove(id: string): boolean { + const location = this.findElement(id); + if (location) { + this.containerPointers.delete(id); + location.container.splice(location.index, 1); + const originalLeftLength = this.leftTree.length; + const originalRightLength = this.rightTree.length; + this.inline(location.entry.leftChildren, location.entry.rightChildren); + if (originalLeftLength !== this.leftTree.length) { + this.sortTop(this.leftTree); + } + if (originalRightLength !== this.rightTree.length) { + this.sortTop(this.rightTree); + } + this.onDidChangeEmitter.fire(); + return true; + } + return false; + } + + protected shareSamePositionParameters(left: StatusBarEntry, right: StatusBarEntry): boolean { + if ((left.priority ?? 0) !== (right.priority ?? 0)) { return false; } + if (this.affinityMatters(left, right)) { + return left.affinity?.id === right.affinity?.id && left.affinity?.alignment === right.affinity?.alignment && left.affinity?.compact === right.affinity?.compact; + } + return left.alignment === right.alignment; + } + + protected shareSameContainer(left: StatusBarEntry, right: StatusBarEntry): boolean { + if (this.affinityMatters(left, right)) { + return left.affinity?.id === right.affinity?.id && left.affinity?.alignment === right.affinity?.alignment; + } + return left.alignment === right.alignment; + } + + protected shareSamePriority(left: StatusBarEntry, right: StatusBarEntry): boolean { + return (left.priority ?? 0) === (right.priority ?? 0) && (!this.affinityMatters(left, right) || left.affinity?.compact === right.affinity?.compact); + } + + protected affinityMatters(left: StatusBarEntry, right: StatusBarEntry): boolean { + return (left.affinity && this.containerPointers.has(left.affinity.id)) || Boolean(right.affinity && this.containerPointers.has(right.affinity.id)); + } + + protected findElement(id?: string): EntryLocation | undefined { + const container = id !== undefined && this.containerPointers.get(id); + if (container) { + const index = container.findIndex(candidate => candidate.id === id); + if (index !== -1) { + return { index, entry: container[index], container }; + } + } + } + + protected sort(container: StatusBarViewModelEntry[]): void { + if (container === this.leftTree || container === this.rightTree) { + this.sortTop(container); + } else { + this.sortDependents(container); + } + } + + protected sortTop(container: StatusBarViewModelEntry[]): void { + container.sort((left, right) => this.comparePriority(left, right)); + } + + protected comparePriority(left: StatusBarViewModelEntry, right: StatusBarViewModelEntry): number { + return (right.head.priority ?? 0) - (left.head.priority ?? 0); + } + + protected sortDependents(container: StatusBarViewModelEntry[]): void { + container.sort((left, right) => { + if (left.head.affinity?.compact && !right.head.affinity?.compact) { + return ArrayUtils.Sort.LeftBeforeRight; + } else if (right.head.affinity?.compact) { + return ArrayUtils.Sort.RightBeforeLeft; + } + return this.comparePriority(left, right); + }); + } + + protected inline(left: StatusBarViewModelEntry[], right: StatusBarViewModelEntry[]): void { + for (const entry of left) { this.doAddTop(entry); } + for (const entry of right) { this.doAddTop(entry); } + } + + protected doAddTop(entry: StatusBarViewModelEntry): void { + const container = entry.head.alignment === StatusBarAlignment.LEFT ? this.leftTree : this.rightTree; + this.containerPointers.set(entry.id, container); + container.push(entry); + } +} diff --git a/packages/core/src/browser/status-bar/status-bar.tsx b/packages/core/src/browser/status-bar/status-bar.tsx new file mode 100644 index 0000000..bc7988a --- /dev/null +++ b/packages/core/src/browser/status-bar/status-bar.tsx @@ -0,0 +1,218 @@ +// ***************************************************************************** +// Copyright (C) 2017-2018 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import * as React from 'react'; +import { injectable, inject } from 'inversify'; +import debounce = require('lodash.debounce'); +import { CancellationTokenSource, CommandService, nls } from '../../common'; +import { ReactWidget } from '../widgets/react-widget'; +import { FrontendApplicationStateService } from '../frontend-application-state'; +import { LabelParser, LabelIcon } from '../label-parser'; +import { StatusBar, StatusBarEntry, StatusBarAlignment, StatusBarViewEntry } from './status-bar-types'; +import { StatusBarViewModel } from './status-bar-view-model'; +import { HoverService } from '../hover-service'; +import { codicon } from '../widgets'; +import { PreferenceService } from '../../common/preferences'; +import { MarkdownString } from '../../common/markdown-rendering'; +export { StatusBar, StatusBarAlignment, StatusBarEntry }; + +@injectable() +export class StatusBarImpl extends ReactWidget implements StatusBar { + + protected backgroundColor: string | undefined; + protected color: string | undefined; + + constructor( + @inject(CommandService) protected readonly commands: CommandService, + @inject(LabelParser) protected readonly entryService: LabelParser, + @inject(FrontendApplicationStateService) protected readonly applicationStateService: FrontendApplicationStateService, + @inject(PreferenceService) protected readonly preferences: PreferenceService, + @inject(StatusBarViewModel) protected readonly viewModel: StatusBarViewModel, + @inject(HoverService) protected readonly hoverService: HoverService, + ) { + super(); + delete this.scrollOptions; + this.id = 'theia-statusBar'; + this.addClass('noselect'); + // Hide the status bar until the `workbench.statusBar.visible` preference returns with a `true` value. + this.hide(); + this.preferences.ready.then(() => { + const preferenceValue = this.preferences.get('workbench.statusBar.visible', true); + this.setHidden(!preferenceValue); + }); + this.toDispose.push( + this.preferences.onPreferenceChanged(preference => { + if (preference.preferenceName === 'workbench.statusBar.visible') { + this.setHidden(!this.preferences.get('workbench.statusBar.visible', true)); + } + }) + ); + this.toDispose.push(this.viewModel.onDidChange(() => this.debouncedUpdate())); + } + + protected debouncedUpdate = debounce(() => this.update(), 50); + + protected get ready(): Promise { + return this.applicationStateService.reachedAnyState('initialized_layout', 'ready'); + } + + async setElement(id: string, entry: StatusBarEntry): Promise { + await this.ready; + this.viewModel.set(id, entry); + } + + async removeElement(id: string): Promise { + await this.ready; + this.viewModel.remove(id); + } + + async setBackgroundColor(color?: string): Promise { + await this.ready; + this.internalSetBackgroundColor(color); + this.update(); + } + + protected internalSetBackgroundColor(color?: string): void { + this.backgroundColor = color; + this.node.style.backgroundColor = this.backgroundColor || ''; + } + + async setColor(color?: string): Promise { + await this.ready; + this.internalSetColor(color); + this.update(); + } + + protected internalSetColor(color?: string): void { + this.color = color; + } + protected render(): JSX.Element { + const leftEntries = Array.from(this.viewModel.getLeft(), entry => this.renderElement(entry)); + const rightEntries = Array.from(this.viewModel.getRight(), entry => this.renderElement(entry)); + + return +
    {leftEntries}
    +
    {rightEntries}
    +
    ; + } + + protected triggerCommand(entry: StatusBarEntry): () => void { + return () => { + if (entry.command) { + const args = entry.arguments || []; + this.commands.executeCommand(entry.command, ...args); + } + }; + } + + /** + * Request a hover to be displayed for a status bar entry. + * @param e The mouse event that triggered the hover request + * @param entry The status bar entry to display hover for + * @param skipDelay When true, requests the hover immediately without delay (for click-triggered hovers) + */ + protected requestHover(e: React.MouseEvent, entry: StatusBarEntry, skipDelay = false): void { + const target = e.currentTarget; + if (typeof entry.tooltip === 'function') { + const cancellationSource = new CancellationTokenSource(); + this.doRequestHover(target, nls.localizeByDefault('Loading...'), skipDelay, () => cancellationSource.dispose()); + Promise.resolve(entry.tooltip(cancellationSource.token)) + .catch(() => undefined) + .then(res => res && !cancellationSource.token.isCancellationRequested && this.doRequestHover(target, res, skipDelay)); + } else { + this.doRequestHover(target, entry.tooltip!, skipDelay); + } + } + + protected doRequestHover(target: HTMLElement, content: string | HTMLElement | MarkdownString, skipDelay = false, onHide?: () => void): void { + this.hoverService.requestHover({ + content, + target, + position: 'top', + interactive: content instanceof HTMLElement || MarkdownString.is(content), + onHide, + skipHoverDelay: skipDelay + }); + } + + protected createAttributes(viewEntry: StatusBarViewEntry): React.Attributes & React.HTMLAttributes { + const attrs: React.Attributes & React.HTMLAttributes = {}; + const entry = viewEntry.entry; + attrs.id = 'status-bar-' + viewEntry.id; + attrs.className = 'element'; + if (entry.command || entry.onclick || entry.tooltip) { + attrs.className += ' hasCommand'; + } + if (entry.command) { + attrs.onClick = this.triggerCommand(entry); + } else if (entry.onclick) { + attrs.onClick = e => entry.onclick?.(e.nativeEvent); + } else { + attrs.onClick = e => this.requestHover(e, entry, true); + } + + if (viewEntry.compact && viewEntry.alignment !== undefined) { + attrs.className += viewEntry.alignment === StatusBarAlignment.RIGHT ? ' compact-right' : ' compact-left'; + } + + if (entry.tooltip) { + attrs.onMouseEnter = e => this.requestHover(e, entry); + } + if (entry.className) { + attrs.className += ' ' + entry.className; + } + if (entry.accessibilityInformation) { + attrs['aria-label'] = entry.accessibilityInformation.label; + attrs.role = entry.accessibilityInformation.role; + } else { + attrs['aria-label'] = [entry.text, entry.tooltip].join(', '); + } + if (entry.backgroundColor) { + attrs.className += ' has-background'; + } + + attrs.style = { + color: entry.color || this.color, + backgroundColor: entry.backgroundColor + }; + + return attrs; + } + + protected renderElement(entry: StatusBarViewEntry): JSX.Element { + const childStrings = this.entryService.parse(entry.entry.text); + const children: JSX.Element[] = []; + + childStrings.forEach((val, key) => { + if (LabelIcon.is(val)) { + const animation = val.animation ? ` fa-${val.animation}` : ''; + if (val.name.startsWith('codicon-')) { + children.push(); + } else if (val.name.startsWith('fa-')) { + children.push(); + } else { + children.push(); + } + } else { + children.push({val}); + } + }); + return
    + {children} +
    ; + } + +} diff --git a/packages/core/src/browser/storage-service.spec.ts b/packages/core/src/browser/storage-service.spec.ts new file mode 100644 index 0000000..898b3bd --- /dev/null +++ b/packages/core/src/browser/storage-service.spec.ts @@ -0,0 +1,76 @@ +// ***************************************************************************** +// Copyright (C) 2017 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { Container } from 'inversify'; +import { WindowService } from './window/window-service'; +import { MockWindowService } from './window/test/mock-window-service'; +import { LocalStorageService, StorageService } from './storage-service'; +import { expect } from 'chai'; +import { ILogger } from '../common/logger'; +import { MockLogger } from '../common/test/mock-logger'; +import * as sinon from 'sinon'; +import { MessageService, MessageClient } from '../common/'; + +let storageService: StorageService; + +before(() => { + const testContainer = new Container(); + testContainer.bind(ILogger).toDynamicValue(ctx => { + const logger = new MockLogger(); + /* Note this is not really needed but here we could just use the + MockLogger since it does what we need but this is there as a demo of + sinon for other uses-cases. We can remove this once this technique is + more generally used. */ + sinon.stub(logger, 'warn').callsFake(async () => { }); + return logger; + }); + testContainer.bind(StorageService).to(LocalStorageService).inSingletonScope(); + testContainer.bind(WindowService).to(MockWindowService).inSingletonScope(); + testContainer.bind(LocalStorageService).toSelf().inSingletonScope(); + + testContainer.bind(MessageClient).toSelf().inSingletonScope(); + testContainer.bind(MessageService).toSelf().inSingletonScope(); + + storageService = testContainer.get(StorageService); +}); + +describe('storage-service', () => { + + it('stores data', async () => { + storageService.setData('foo', { + test: 'foo' + }); + expect(await storageService.getData('bar', 'bar')).equals('bar'); + expect((await storageService.getData('foo', { + test: 'bar' + })).test).equals('foo'); + }); + + it('removes data', async () => { + storageService.setData('foo', { + test: 'foo' + }); + expect((await storageService.getData('foo', { + test: 'bar' + })).test).equals('foo'); + + storageService.setData('foo', undefined); + expect((await storageService.getData('foo', { + test: 'bar' + })).test).equals('bar'); + }); + +}); diff --git a/packages/core/src/browser/storage-service.ts b/packages/core/src/browser/storage-service.ts new file mode 100644 index 0000000..b0d844c --- /dev/null +++ b/packages/core/src/browser/storage-service.ts @@ -0,0 +1,129 @@ +// ***************************************************************************** +// Copyright (C) 2017 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { inject, injectable, postConstruct } from 'inversify'; +import { ILogger } from '../common/logger'; +import { MessageService } from '../common/message-service'; +import { WindowService } from './window/window-service'; +import { environment } from '@theia/application-package/lib/environment'; + +export const StorageService = Symbol('IStorageService'); +/** + * The storage service provides an interface to some data storage that allows extensions to keep state among sessions. + */ +export interface StorageService { + + /** + * Stores the given data under the given key. + */ + setData(key: string, data: T): Promise; + + /** + * Returns the data stored for the given key or the provided default value if nothing is stored for the given key. + */ + getData(key: string, defaultValue: T): Promise; + getData(key: string): Promise; +} + +interface LocalStorage { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + [key: string]: any; +} + +@injectable() +export class LocalStorageService implements StorageService { + private storage: LocalStorage; + + @inject(ILogger) protected logger: ILogger; + @inject(MessageService) protected readonly messageService: MessageService; + @inject(WindowService) protected readonly windowService: WindowService; + + @postConstruct() + protected init(): void { + if (typeof window !== 'undefined' && window.localStorage) { + this.storage = window.localStorage; + this.testLocalStorage(); + } else { + this.logger.warn(log => log("The browser doesn't support localStorage. state will not be persisted across sessions.")); + this.storage = {}; + } + } + + setData(key: string, data?: T): Promise { + if (data !== undefined) { + try { + this.storage[this.prefix(key)] = JSON.stringify(data); + } catch (e) { + this.showDiskQuotaExceededMessage(); + } + } else { + delete this.storage[this.prefix(key)]; + } + return Promise.resolve(); + } + + getData(key: string, defaultValue?: T): Promise { + const result = this.storage[this.prefix(key)]; + if (result === undefined) { + return Promise.resolve(defaultValue); + } + return Promise.resolve(JSON.parse(result)); + } + + protected prefix(key: string): string { + if (environment.electron.is()) { + return `theia:${key}`; + } + const pathname = typeof window === 'undefined' ? '' : window.location.pathname; + return `theia:${pathname}:${key}`; + } + + private async showDiskQuotaExceededMessage(): Promise { + const READ_INSTRUCTIONS_ACTION = 'Read Instructions'; + const CLEAR_STORAGE_ACTION = 'Clear Local Storage'; + const ERROR_MESSAGE = `Your preferred browser's local storage is almost full. + To be able to save your current workspace layout or data, you may need to free up some space. + You can refer to Theia's documentation page for instructions on how to manually clean + your browser's local storage or choose to clear all.`; + this.messageService.warn(ERROR_MESSAGE, READ_INSTRUCTIONS_ACTION, CLEAR_STORAGE_ACTION).then(async selected => { + if (READ_INSTRUCTIONS_ACTION === selected) { + this.windowService.openNewWindow('https://github.com/eclipse-theia/theia/wiki/Cleaning-Local-Storage', { external: true }); + } else if (CLEAR_STORAGE_ACTION === selected) { + this.clearStorage(); + } + }); + } + + /** + * Verify if there is still some spaces left to save another workspace configuration into the local storage of your browser. + * If we are close to the limit, use a dialog to notify the user. + */ + private testLocalStorage(): void { + const keyTest = this.prefix('Test'); + try { + this.storage[keyTest] = JSON.stringify(new Array(60000)); + } catch (error) { + this.showDiskQuotaExceededMessage(); + } finally { + this.storage.removeItem(keyTest); + } + } + + private clearStorage(): void { + this.storage.clear(); + } + +} diff --git a/packages/core/src/browser/style/about.css b/packages/core/src/browser/style/about.css new file mode 100644 index 0000000..4fccd5d --- /dev/null +++ b/packages/core/src/browser/style/about.css @@ -0,0 +1,36 @@ +/******************************************************************************** + * Copyright (C) 2018 Ericsson and others. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the Eclipse + * Public License v. 2.0 are satisfied: GNU General Public License, version 2 + * with the GNU Classpath Exception which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 + ********************************************************************************/ + +.theia-aboutDialog .about-details { + padding-left: 10px; +} + +.theia-aboutDialog .about-details a { + cursor: pointer; +} + +ul.theia-aboutDialog { + flex: 1 100%; + padding-bottom: calc(var(--theia-ui-padding) * 3); +} + +ul.theia-aboutExtensions { + height: 200px; + overflow: hidden; + overflow-y: scroll; + list-style-type: none; + padding: 0; +} diff --git a/packages/core/src/browser/style/alert-messages.css b/packages/core/src/browser/style/alert-messages.css new file mode 100644 index 0000000..c3093ff --- /dev/null +++ b/packages/core/src/browser/style/alert-messages.css @@ -0,0 +1,65 @@ +/******************************************************************************** + * Copyright (C) 2018 Ericsson and others. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the Eclipse + * Public License v. 2.0 are satisfied: GNU General Public License, version 2 + * with the GNU Classpath Exception which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 + ********************************************************************************/ + +/* message container */ +.theia-alert-message-container { + padding-block: calc(var(--theia-ui-padding) * 2); + padding-inline: calc(var(--theia-ui-padding) * 3) max(var(--theia-scrollbar-width), var(--theia-ui-padding)); + flex-shrink: 0; +} + +.theia-alert-message-container .theia-message-header { + display: flex; + align-items: center; + flex-wrap: wrap; + gap: var(--theia-ui-padding); +} + +.theia-alert-message-container .theia-message-header, +.theia-alert-message-container .theia-message-content { + text-overflow: ellipsis; + overflow: hidden; +} + +/* base alert message */ +.theia-alert { + display: grid; + gap: var(--theia-ui-padding); + border-radius: 4px; + padding: calc(var(--theia-ui-padding) * 2); + border: var(--theia-border-width) solid var(--theia-inputValidation-infoBorder); + line-height: 16px; +} + +/* information message */ +.theia-info-alert { + background-color: var(--theia-inputValidation-infoBackground); + color: var(--theia-inputValidation-infoForeground); +} + +/* warning message */ +.theia-warning-alert { + border-color: var(--theia-inputValidation-warningBorder); + background-color: var(--theia-inputValidation-warningBackground); + color: var(--theia-inputValidation-warningForeground); +} + +/* error message */ +.theia-error-alert { + border-color: var(--theia-inputValidation-errorBorder); + background-color: var(--theia-inputValidation-errorBackground); + color: var(--theia-inputValidation-errorForeground); +} diff --git a/packages/core/src/browser/style/ansi.css b/packages/core/src/browser/style/ansi.css new file mode 100644 index 0000000..85c867d --- /dev/null +++ b/packages/core/src/browser/style/ansi.css @@ -0,0 +1,88 @@ +/******************************************************************************** + * Copyright (C) 2018 TypeFox and others. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the Eclipse + * Public License v. 2.0 are satisfied: GNU General Public License, version 2 + * with the GNU Classpath Exception which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 + ********************************************************************************/ + +/* ANSI */ +.ansi-black-fg, +.ansi-black-bg { + color: var(--theia-terminal-ansiBlack); +} +.ansi-bright-black-fg, +.ansi-bright-black-bg { + color: var(--theia-terminal-ansiBrightBlack); +} + +.ansi-red-fg, +.ansi-red-bg { + color: var(--theia-terminal-ansiRed); +} +.ansi-bright-red-fg, +.ansi-bright-red-bg { + color: var(--theia-terminal-ansiBrightRed); +} + +.ansi-green-fg, +.ansi-green-bg { + color: var(--theia-terminal-ansiGreen); +} +.ansi-bright-green-fg, +.ansi-bright-green-bg { + color: var(--theia-terminal-ansiBrightGreen); +} + +.ansi-yellow-fg, +.ansi-yellow-bg { + color: var(--theia-terminal-ansiYellow); +} +.ansi-bright-yellow-fg, +.ansi-bright-yellow-bg { + color: var(--theia-terminal-ansiBrightYellow); +} + +.ansi-blue-fg, +.ansi-blue-bg { + color: var(--theia-terminal-ansiBlue); +} +.ansi-bright-blue-fg, +.ansi-bright-blue-bg { + color: var(--theia-terminal-ansiBrightBlue); +} + +.ansi-magenta-fg, +.ansi-magenta-bg { + color: var(--theia-terminal-ansiMagenta); +} +.ansi-bright-magenta-fg, +.ansi-bright-magenta-bg { + color: var(--theia-terminal-ansiBrightMagenta); +} + +.ansi-cyan-fg, +.ansi-cyan-bg { + color: var(--theia-terminal-ansiCyan); +} +.ansi-bright-cyan-fg, +.ansi-bright-cyan-bg { + color: var(--theia-terminal-ansiBrightCyan); +} + +.ansi-white-fg, +.ansi-white-bg { + color: var(--theia-terminal-ansiWhite); +} +.ansi-bright-white-fg, +.ansi-bright-white-bg { + color: var(--theia-terminal-ansiBrightWhite); +} diff --git a/packages/core/src/browser/style/breadcrumbs.css b/packages/core/src/browser/style/breadcrumbs.css new file mode 100644 index 0000000..21c98ea --- /dev/null +++ b/packages/core/src/browser/style/breadcrumbs.css @@ -0,0 +1,129 @@ +/******************************************************************************** + * Copyright (C) 2019 TypeFox and others. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the Eclipse + * Public License v. 2.0 are satisfied: GNU General Public License, version 2 + * with the GNU Classpath Exception which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 + ********************************************************************************/ + +:root { + --theia-breadcrumbs-height: 22px; +} + +.theia-breadcrumbs { + height: var(--theia-breadcrumbs-height); + position: relative; + user-select: none; + display: flex; + flex-direction: row; + flex-wrap: nowrap; + justify-content: flex-start; + align-items: center; + outline-style: none; + list-style-type: none; + overflow: hidden; + padding: 0; + margin: 0; + background-color: var(--theia-breadcrumb-background); +} + +.theia-breadcrumbs .ps__thumb-x { + /* Same scrollbar height as in tab bar. */ + height: var(--theia-private-horizontal-tab-scrollbar-height) !important; +} + +.theia-breadcrumbs .theia-breadcrumb-item { + display: flex; + align-items: center; + flex: 0 1 auto; + white-space: pre; + align-self: center; + height: 100%; + color: var(--theia-breadcrumb-foreground); + outline: none; +} + +.theia-breadcrumbs .theia-breadcrumb-item:hover { + color: var(--theia-breadcrumb-focusForeground); +} + +.theia-breadcrumbs .theia-breadcrumb-item:not(:last-of-type)::after { + font-family: codicon; + font-size: var(--theia-ui-font-size2); + content: "\eab6"; + display: flex; + align-items: center; + width: 0.8em; + text-align: right; + padding-inline: 3px 6px; +} + +.theia-breadcrumbs .theia-breadcrumb-item::before { + width: 16px; + height: 100%; + display: flex; + align-items: center; + justify-content: center; +} + +.theia-breadcrumbs .theia-breadcrumb-item:first-of-type::before { + content: " "; +} + +.theia-breadcrumb-item-haspopup:hover { + background: var(--theia-accent-color3); + cursor: pointer; +} + +#theia-breadcrumbs-popups-overlay { + height: 0px; +} + +.theia-breadcrumbs-popup { + position: fixed; + width: 300px; + max-height: 200px; + z-index: 10000; + padding: 0px; + background: var(--theia-breadcrumbPicker-background); + font-size: var(--theia-ui-font-size1); + color: var(--theia-ui-font-color1); + box-shadow: 0px 1px 6px rgba(0, 0, 0, 0.2); + overflow: hidden; +} + +.theia-breadcrumbs-popup:focus { + outline-width: 0; + outline-style: none; +} + +.theia-breadcrumbs-popup ul { + display: flex; + flex-direction: column; + outline-style: none; + list-style-type: none; + padding-inline-start: 0px; + margin: 0 0 0 4px; +} + +.theia-breadcrumbs-popup ul li { + display: flex; + align-items: center; + flex: 0 1 auto; + white-space: pre; + cursor: pointer; + outline: none; + padding: 0.25rem 0.25rem 0.25rem 0.25rem; +} + +.theia-breadcrumbs-popup ul li:hover { + background: var(--theia-accent-color3); +} diff --git a/packages/core/src/browser/style/dialog.css b/packages/core/src/browser/style/dialog.css new file mode 100644 index 0000000..3cdd83a --- /dev/null +++ b/packages/core/src/browser/style/dialog.css @@ -0,0 +1,133 @@ +/******************************************************************************** + * Copyright (C) 2017, 2018 TypeFox and others. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the Eclipse + * Public License v. 2.0 are satisfied: GNU General Public License, version 2 + * with the GNU Classpath Exception which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 + ********************************************************************************/ + +.lm-Widget.dialogOverlay { + z-index: 5000; + display: flex; + flex-direction: column; + position: fixed; + width: 100vw; + height: 100vh; + top: 0; + left: 0; + justify-content: center; + align-items: center; + background: rgba(0, 0, 0, 0.3); + font-size: var(--theia-ui-font-size1); + padding: 2px; +} +.lm-Widget.dialogOverlay .dialogBlock { + display: flex; + flex-direction: column; + min-width: 400px; + color: var(--theia-editorWidget-foreground); + background-color: var(--theia-editorWidget-background); + border: 1px solid var(--theia-contrastBorder); + border-radius: 4px; + overflow: hidden; + box-shadow: 0 0px 8px var(--theia-widget-shadow); +} +.lm-Widget.dialogOverlay .dialogTitle { + display: flex; + flex-direction: row; + flex-wrap: nowrap; + justify-content: space-between; + align-items: center; + text-align: center; + font-size: var(--theia-ui-font-size1); + background-color: var(--theia-statusBar-background); + color: var(--theia-statusBar-foreground); + padding-left: calc(var(--theia-ui-padding) * 2); + padding-right: var(--theia-ui-padding); + min-height: 30px; +} + +.lm-Widget.dialogOverlay .dialogTitle i.closeButton { + cursor: pointer; +} + +.lm-Widget.dialogOverlay .dialogContent { + display: flex; + flex-direction: column; + align-items: stretch; + position: relative; + padding: calc(var(--theia-ui-padding) * 2); + white-space: pre-line; + max-height: 70vh; + overflow-y: auto; +} + +/* Preserve multiple consecutive spaces in dialog content */ +.lm-Widget.dialogOverlay .dialogContent li, +.lm-Widget.dialogOverlay .dialogContent div { + white-space: pre-wrap; +} + +.lm-Widget.dialogOverlay .dialogControl { + padding: calc(var(--theia-ui-padding) * 2); + display: flex; + flex-direction: row; + align-content: right; + flex-wrap: nowrap; + justify-content: flex-end; + min-height: 21px; +} + +.lm-Widget.dialogOverlay.hidden { + display: none; +} +.lm-Widget.dialogOverlay.dialogErrorMessage { + display: none; +} +.lm-Widget.dialogOverlay .error { + color: var(--theia-inputValidation-errorForeground); +} +.lm-Widget.dialogOverlay .error.main { + color: var(--theia-inputValidation-errorForeground); + border-color: var(--theia-inputValidation-errorBorder); +} +.lm-Widget.dialogOverlay .error > .theia-button.main { + background-color: var(--theia-inputValidation-errorBackground); + color: var(--theia-inputValidation-errorForeground); +} +.lm-Widget.dialogOverlay .error > .dialogErrorMessage { + margin-top: calc(var(--theia-ui-padding) * 3); + font-size: var(--theia-ui-font-size1); + display: block; +} + +.theia-dialog-node { + line-height: var(--theia-content-line-height); + margin-top: calc(var(--theia-ui-padding) * 1.5); + margin-left: calc(var(--theia-ui-padding) * 2.5); +} + +.theia-dialog-node-content { + display: flex; + align-items: center; + margin-right: calc(var(--theia-ui-padding) * 1.5); +} + +.theia-dialog-node-segment { + flex-grow: 0; + user-select: none; + white-space: pre; +} + +.theia-dialog-icon { + align-content: center; + margin-right: calc(var(--theia-ui-padding) * 1.5); +} diff --git a/packages/core/src/browser/style/dockpanel.css b/packages/core/src/browser/style/dockpanel.css new file mode 100644 index 0000000..602b36e --- /dev/null +++ b/packages/core/src/browser/style/dockpanel.css @@ -0,0 +1,94 @@ +/******************************************************************************** + * Copyright (C) 2017, 2018 TypeFox and others. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the Eclipse + * Public License v. 2.0 are satisfied: GNU General Public License, version 2 + * with the GNU Classpath Exception which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 + ********************************************************************************/ + +/* + * Lumino sets the z-index of its panels to 0, which causes overlay issues + * See also https://github.com/eclipse-theia/theia/issues/14290 + */ +.lm-SplitPanel-child, +.lm-DockPanel, +.lm-DockPanel-widget { + z-index: initial; +} + +.lm-DockPanel.lm-SplitPanel-child { + padding: 0px; +} + +.lm-DockPanel-widget { + min-width: 100px; + min-height: 100px; +} + +.lm-DockPanel-handle[data-orientation="vertical"] { + min-height: var(--theia-border-width); + z-index: 3; +} + +.lm-DockPanel-handle[data-orientation="horizontal"] { + min-width: var(--theia-border-width); +} + +.lm-DockPanel-handle[data-orientation="horizontal"]::after { + min-width: var(--theia-sash-width); + transform: translateX(0%); + left: calc(-1 * var(--theia-sash-width) / 2); +} + +.lm-DockPanel-handle[data-orientation="vertical"]::after { + min-height: var(--theia-sash-width); + width: 100%; + transform: translateY(0%); + top: calc(-1 * var(--theia-sash-width) / 2); +} + +.lm-DockPanel-handle:hover::after { + background-color: var(--theia-sash-hoverBorder); + transition-delay: var(--theia-sash-hoverDelay); +} + +.lm-DockPanel-handle:active::after { + background-color: var(--theia-sash-activeBorder); + transition-delay: 0s !important; +} + +.lm-DockPanel-overlay { + background: var(--theia-editorGroup-dropBackground); + border: var(--theia-border-width) dashed var(--theia-contrastActiveBorder); + transition-property: top, left, right, bottom; + transition-duration: 150ms; + transition-timing-function: ease; + z-index: 2000; +} + +.lm-DockPanel-overlay.lm-mod-root-top, +.lm-DockPanel-overlay.lm-mod-root-left, +.lm-DockPanel-overlay.lm-mod-root-right, +.lm-DockPanel-overlay.lm-mod-root-bottom, +.lm-DockPanel-overlay.lm-mod-root-center { + border-width: 2px; +} + +.lm-DockPanel-overlay.lm-mod-root-bottom { + background: var(--theia-panel-dropBackground); +} + +.lm-TabBar-tab.theia-drag-not-allowed { + cursor: not-allowed !important; + background-color: var(--theia-errorBackground) !important; + opacity: 0.8; + transition: background-color 0.3s ease; +} diff --git a/packages/core/src/browser/style/hover-service.css b/packages/core/src/browser/style/hover-service.css new file mode 100644 index 0000000..a1d7dab --- /dev/null +++ b/packages/core/src/browser/style/hover-service.css @@ -0,0 +1,107 @@ +/******************************************************************************** + * Copyright (C) 2022 TypeFox and others. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the Eclipse + * Public License v. 2.0 are satisfied: GNU General Public License, version 2 + * with the GNU Classpath Exception which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 + ********************************************************************************/ + +/* Adapted from https://github.com/microsoft/vscode/blob/7d9b1c37f8e5ae3772782ba3b09d827eb3fdd833/src/vs/workbench/services/hover/browser/hoverService.ts */ + +:root { + --theia-hover-max-width: 500px; + --theia-hover-preview-width: 300px; +} + +.theia-hover { + font-family: var(--theia-ui-font-family); + font-size: var(--theia-ui-font-size1); + color: var(--theia-editorHoverWidget-foreground); + background-color: var(--theia-editorHoverWidget-background); + border: 1px solid var(--theia-editorHoverWidget-border); + padding: var(--theia-ui-padding); + max-width: var(--theia-hover-max-width); +} + +/* overwrite potentially different default user agent styles */ +.theia-hover[popover] { + inset: unset; + overflow: visible; +} + +.theia-hover .hover-row:not(:first-child):not(:empty) { + border-top: 1px solid var(--theia-editorHoverWidgetInternalBorder); +} + +.theia-hover hr { + border-top: 1px solid var(--theia-editorHoverWidgetInternalBorder); + border-bottom: 0px solid var(--theia-editorHoverWidgetInternalBorder); + margin: var(--theia-ui-padding) calc(var(--theia-ui-padding) * -1); +} + +.theia-hover a { + color: var(--theia-textLink-foreground); +} + +.theia-hover a:hover { + color: var(--theia-textLink-active-foreground); +} + +.theia-hover .hover-row .actions { + background-color: var(--theia-editorHoverWidget-statusBarBackground); +} + +.theia-hover code { + background-color: var(--theia-textCodeBlock-background); + font-family: var(--theia-code-font-family); +} + +.theia-hover::before { + content: ""; + position: absolute; +} + +.theia-hover.top::before { + left: var(--theia-hover-before-position); + bottom: -5px; + border-top: 5px solid var(--theia-editorHoverWidget-border); + border-left: 5px solid transparent; + border-right: 5px solid transparent; +} + +.theia-hover.bottom::before { + left: var(--theia-hover-before-position); + top: -5px; + border-bottom: 5px solid var(--theia-editorHoverWidget-border); + border-left: 5px solid transparent; + border-right: 5px solid transparent; +} + +.theia-hover.left::before { + top: var(--theia-hover-before-position); + right: -5px; + border-left: 5px solid var(--theia-editorHoverWidget-border); + border-top: 5px solid transparent; + border-bottom: 5px solid transparent; +} + +.theia-hover.right::before { + top: var(--theia-hover-before-position); + left: -5px; + border-right: 5px solid var(--theia-editorHoverWidget-border); + border-top: 5px solid transparent; + border-bottom: 5px solid transparent; +} + +.theia-hover.extended-tab-preview { + border-radius: 10px; + width: var(--theia-hover-preview-width); +} diff --git a/packages/core/src/browser/style/icons.css b/packages/core/src/browser/style/icons.css new file mode 100644 index 0000000..1b21517 --- /dev/null +++ b/packages/core/src/browser/style/icons.css @@ -0,0 +1,61 @@ +/******************************************************************************** + * Copyright (C) 2019 TypeFox and others. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the Eclipse + * Public License v. 2.0 are satisfied: GNU General Public License, version 2 + * with the GNU Classpath Exception which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 + ********************************************************************************/ + +.theia-open-change-icon { + width: var(--theia-icon-size); + height: var(--theia-icon-size); + background: var(--theia-icon-open-change) no-repeat; +} + +.theia-open-file-icon { + width: var(--theia-icon-size); + height: var(--theia-icon-size); + background: var(--theia-icon-open-file) no-repeat; +} + +.theia-open-preview-icon { + width: var(--theia-icon-size); + height: var(--theia-icon-size); + background: var(--theia-icon-preview) no-repeat; +} + +.theia-open-json-icon { + width: var(--theia-icon-size); + height: var(--theia-icon-size); + background: var(--theia-icon-open-json) no-repeat; +} + +.theia-collapse-all-icon { + background: var(--theia-icon-collapse-all) center center no-repeat; +} + +.theia-remove-all-icon { + background: var(--theia-icon-remove-all) center center no-repeat; +} + +.theia-add-icon { + background: var(--theia-icon-add) center center no-repeat; +} + +@keyframes theia-spin { + 100% { + transform: rotate(360deg); + } +} + +.theia-animation-spin { + animation: theia-spin 1.5s linear infinite; +} diff --git a/packages/core/src/browser/style/index.css b/packages/core/src/browser/style/index.css new file mode 100644 index 0000000..7fd7536 --- /dev/null +++ b/packages/core/src/browser/style/index.css @@ -0,0 +1,493 @@ +/******************************************************************************** + * Copyright (C) 2017, 2018 TypeFox and others. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the Eclipse + * Public License v. 2.0 are satisfied: GNU General Public License, version 2 + * with the GNU Classpath Exception which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 + ********************************************************************************/ + +@import url("~@lumino/widgets/style/index.css"); +@import url("~font-awesome/css/font-awesome.min.css"); + +/*----------------------------------------------------------------------------- +| General +|----------------------------------------------------------------------------*/ + +:root { + /* Product OS Design System Variables */ + --product-os-primary: #4285F4; + --product-os-primary-hover: #5294FF; + --product-os-bg-dark: #1E1E1E; + --product-os-bg-darker: #161616; + --product-os-text-primary: #FFFFFF; + --product-os-text-secondary: #B8B8B8; + --product-os-text-muted: #808080; + --product-os-border: rgba(255, 255, 255, 0.1); + --product-os-spacing-xs: 4px; + --product-os-spacing-sm: 8px; + --product-os-spacing-md: 12px; + --product-os-spacing-lg: 16px; + --product-os-spacing-xl: 24px; + --product-os-radius-sm: 4px; + --product-os-radius-md: 8px; + --product-os-font-body: 14px; + --product-os-font-small: 12px; + --product-os-font-heading: 16px; + --product-os-transition: all 0.2s ease; + + /* Borders: Width and color (dark to bright) */ + + --theia-border-width: 1px; + --theia-panel-border-width: 1px; + + /* UI fonts: Family, size and color (bright to dark) + --------------------------------------------------- + The UI font CSS variables are used for the typography all of the Theia + user interface elements that are not directly user-generated content. + */ + + --theia-ui-font-scale-factor: 1.2; + --theia-ui-font-size0: calc( + var(--theia-ui-font-size1) / var(--theia-ui-font-scale-factor) + ); + --theia-ui-font-size1: 13px; /* Base font size */ + --theia-ui-font-size2: calc( + var(--theia-ui-font-size1) * var(--theia-ui-font-scale-factor) + ); + --theia-ui-font-size3: calc( + var(--theia-ui-font-size2) * var(--theia-ui-font-scale-factor) + ); + --theia-ui-icon-font-size: 14px; /* Ensures px perfect FontAwesome icons */ + --theia-ui-font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; + + /* Content fonts: Family, size and color (bright to dark) + Content font variables are used for typography of user-generated content. + */ + + --theia-content-font-size: 13px; + --theia-content-line-height: 22px; + + --theia-code-font-size: 13px; + --theia-code-line-height: 17px; + --theia-code-padding: 5px; + --theia-code-font-family: Menlo, Monaco, Consolas, "Droid Sans Mono", + "Courier New", monospace, "Droid Sans Fallback"; + --theia-monospace-font-family: monospace; + --theia-ui-padding: 6px; + + /* Icons */ + --theia-icon-size: 16px; + + /* Scrollbars */ + --theia-scrollbar-width: 10px; + --theia-scrollbar-rail-width: 10px; + + /* Statusbar */ + --theia-statusBar-font-size: 12px; + + /* Opacity for disabled mod */ + --theia-mod-disabled-opacity: 0.4; +} + +html, +body { + height: 100vh; +} + +body { + margin: 0; + padding: 0; + overflow: hidden; + font-family: var(--theia-ui-font-family); + background: var(--theia-editor-background); + color: var(--theia-foreground); + border: 1px solid var(--theia-window-activeBorder); +} + +body:window-inactive, +body:-moz-window-inactive { + border-color: var(--theia-window-inactiveBorder); +} + +a { + color: var(--theia-textLink-foreground); +} + +a:active, +a:hover { + color: var(--theia-textLink-activeForeground); +} + +code { + color: var(--theia-textPreformat-foreground); +} + +blockquote { + margin: 0 7px 0 5px; + padding: 0px 16px 0px 10px; + background: var(--theia-textBlockQuote-background); + border-left: 5px solid var(--theia-textBlockQuote-border); +} + +.theia-input { + background: var(--theia-input-background); + color: var(--theia-input-foreground); + border: var(--theia-border-width) solid var(--theia-input-border); + font-family: var(--theia-ui-font-family); + font-size: var(--theia-ui-font-size1); + line-height: var(--theia-content-line-height); + padding: 3px 0 3px 8px; + border-radius: 2px; + min-height: 28px; + box-sizing: border-box; +} + +.theia-input[type="text"] { + text-overflow: ellipsis; + white-space: nowrap; +} + +.theia-input[type="checkbox"], +.theia-input[type="radio"] { + min-height: unset; +} + +.theia-input::placeholder { + color: var(--theia-input-placeholderForeground); + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + +.theia-maximized { + top: 0 !important; + left: 0 !important; + width: 100% !important; + height: 100% !important; +} + +.theia-ApplicationShell { + position: absolute; + top: 0; + left: 0; + right: 0; + bottom: 0; + background: var(--theia-editor-background); +} + +.theia-preload { + position: absolute; + top: 0; + left: 0; + right: 0; + bottom: 0; + z-index: 50000; + background: var(--theia-editor-background); + background-size: 60px 60px; + background-repeat: no-repeat; + background-attachment: fixed; + background-position: center; + transition: opacity 0.8s; + display: flex; + justify-content: center; + align-items: center; +} + +.theia-preload::after { + animation: 1s theia-preload-rotate infinite; + color: #777; /* color works on both light and dark themes */ + content: "\eb19"; /* codicon-load */ + font: normal normal normal 72px/1 codicon; +} + +@keyframes theia-preload-rotate { + 0% { + transform: rotate(0deg); + } + 100% { + transform: rotate(360deg); + } +} + +.theia-preload.theia-hidden { + opacity: 0; +} + +.theia-icon { + width: 32px; + height: 18px; + margin: 5px; + margin-left: 8px; +} + +.theia-mod-disabled, +.theia-mod-disabled:focus { + opacity: var(--theia-mod-disabled-opacity) !important; +} + +.theia-header { + text-transform: uppercase; + font-size: var(--theia-ui-font-size0); + font-weight: 700; +} + +.lm-Widget { + font-size: var(--theia-ui-font-size1); + /** We override the contain of lm-Widget to make sure Monaco autocomplete etc. is correctly applied */ + contain: none !important; +} + +.lm-Widget.lm-mod-hidden { + display: none !important; +} + +.noselect, +.no-select { + -webkit-touch-callout: none; /* iOS Safari */ + -webkit-user-select: none; /* Safari */ + -khtml-user-select: none; /* Konqueror HTML */ + -moz-user-select: none; /* Firefox */ + -ms-user-select: none; /* Internet Explorer/Edge */ + user-select: none; /* Non-prefixed version, currently + supported by Chrome and Opera */ + -o-user-select: none; +} + +/* Since an iframe has its own focus tracking, we don't show focus on iframes */ +:focus:not(iframe) { + outline-width: 1px; + outline-style: solid; + outline-offset: -1px; + opacity: 1; + outline-color: var(--theia-focusBorder); +} + +::selection { + background: var(--theia-selection-background); +} + +.action-label { + padding: 2px; + border-radius: 4px; + cursor: pointer; +} + +.action-label:hover { + background-color: var(--theia-toolbar-hoverBackground); +} + +.theia-button { + border: none; + color: var(--theia-button-foreground); + min-width: 65px; + outline: none; + cursor: pointer; + padding: 6px 9px; + margin-left: calc(var(--theia-ui-padding) * 2); + border-radius: 2px; +} + +.theia-button:focus { + outline: 1px solid var(--theia-focusBorder); + outline-offset: 1px; +} + +.theia-button.secondary { + color: var(--theia-secondaryButton-foreground); +} + +.theia-button[disabled] { + opacity: 0.6; + color: var(--theia-button-disabledForeground); + background-color: var(--theia-button-disabledBackground); + cursor: default; +} + +button.secondary[disabled], +.theia-button.secondary[disabled] { + color: var(--theia-secondaryButton-disabledForeground); + background-color: var(--theia-secondaryButton-disabledBackground); +} + +.theia-select { + color: var(--dropdown-foreground); + font-size: var(--theia-ui-font-size1); + border-radius: 2px; + border: 1px solid var(--theia-dropdown-border); + background: var(--theia-dropdown-background); + outline: none; + cursor: pointer; +} + +.theia-select option { + background: var(--theia-dropdown-listBackground); +} + +.theia-transparent-overlay { + background-color: transparent; + position: absolute; + top: 0; + left: 0; + height: 100%; + width: 100%; + z-index: 999; +} + +.theia-cursor-no-drop, +.theia-cursor-no-drop:active { + cursor: no-drop; +} + +/*----------------------------------------------------------------------------- +| Import children style files +|----------------------------------------------------------------------------*/ + +@import "./os.css"; +@import "./dockpanel.css"; +@import "./dialog.css"; +@import "./menus.css"; +@import "./sidepanel.css"; +@import "./tabs.css"; +@import "./scrollbars.css"; +@import "./tree.css"; +@import "./status-bar.css"; +@import "./tree-decorators.css"; +@import "./about.css"; +@import "./search-box.css"; +@import "./ansi.css"; +@import "./view-container.css"; +@import "./notification.css"; +@import "./alert-messages.css"; +@import "./icons.css"; +@import "./widget.css"; +@import "./quick-title-bar.css"; +@import "./progress-bar.css"; +@import "./breadcrumbs.css"; +@import "./tooltip.css"; +@import "./split-widget.css"; +@import "./symbol-icon.css"; + +/*----------------------------------------------------------------------------- +| Product OS - Custom Navigation Bar +|----------------------------------------------------------------------------*/ + +#theia-top-panel.product-os-navbar { + background: var(--product-os-bg-dark); + border-bottom: 1px solid var(--product-os-border); + min-height: 48px; + max-height: 48px; +} + +.product-os-nav-content { + width: 100%; + height: 48px; +} + +.product-os-nav-inner { + display: flex; + align-items: center; + justify-content: space-between; + height: 100%; + padding: 0 var(--product-os-spacing-lg); +} + +.product-os-nav-brand { + font-size: var(--product-os-font-heading); + font-weight: 600; + color: var(--product-os-text-primary); + letter-spacing: 0.5px; +} + +.product-os-nav-links { + display: flex; + gap: var(--product-os-spacing-xl); + flex: 1; + justify-content: center; +} + +.product-os-nav-link { + color: var(--product-os-text-secondary); + text-decoration: none; + font-size: var(--product-os-font-body); + padding: var(--product-os-spacing-sm) var(--product-os-spacing-md); + border-radius: var(--product-os-radius-sm); + transition: var(--product-os-transition); +} + +.product-os-nav-link:hover { + color: var(--product-os-text-primary); + background: var(--product-os-border); +} + +.product-os-nav-actions { + display: flex; + gap: var(--product-os-spacing-md); +} + +.product-os-nav-button { + background: var(--product-os-primary); + color: var(--product-os-text-primary); + border: none; + padding: var(--product-os-spacing-sm) var(--product-os-spacing-lg); + border-radius: var(--product-os-radius-sm); + font-size: var(--product-os-font-body); + font-weight: 500; + cursor: pointer; + transition: var(--product-os-transition); +} + +.product-os-nav-button:hover { + background: var(--product-os-primary-hover); + transform: translateY(-1px); +} + +.product-os-nav-button:active { + transform: translateY(0); +} + +/* Active nav link state */ +.product-os-nav-link.active { + color: var(--product-os-text-primary); + background: rgba(66, 133, 244, 0.2); + border-bottom: 2px solid var(--product-os-primary); +} + +/* Top panel stacking: menu bar on top, Product OS nav below */ +#theia-top-panel { + display: flex !important; + flex-direction: column !important; +} + +#theia-top-panel > .lm-Widget { + width: 100%; + flex-shrink: 0; +} + +#theia-top-panel .lm-MenuBar { + display: none !important; /* Hide menu bar for now */ +} + +#theia-top-panel #product-os-nav-bar { + order: 1; + display: block !important; +} + +/* Hide blocking icon element */ +#theia\:icon { + display: none !important; +} + + +/* Product OS: Always show AI Chat - hide close button */ +#chat-view .lm-TabBar-tabCloseIcon, +.lm-TabBar-tab[data-id="chat-view"] .lm-TabBar-tabCloseIcon { + display: none !important; +} diff --git a/packages/core/src/browser/style/materialcolors.css b/packages/core/src/browser/style/materialcolors.css new file mode 100644 index 0000000..332a4d5 --- /dev/null +++ b/packages/core/src/browser/style/materialcolors.css @@ -0,0 +1,279 @@ +/** + * google-material-color v1.2.6 + * https://github.com/danlevan/google-material-color + */ +:root { + --md-red-50: #FFEBEE; + --md-red-100: #FFCDD2; + --md-red-200: #EF9A9A; + --md-red-300: #E57373; + --md-red-400: #EF5350; + --md-red-500: #F44336; + --md-red-600: #E53935; + --md-red-700: #D32F2F; + --md-red-800: #C62828; + --md-red-900: #B71C1C; + --md-red-A100: #FF8A80; + --md-red-A200: #FF5252; + --md-red-A400: #FF1744; + --md-red-A700: #D50000; + + --md-pink-50: #FCE4EC; + --md-pink-100: #F8BBD0; + --md-pink-200: #F48FB1; + --md-pink-300: #F06292; + --md-pink-400: #EC407A; + --md-pink-500: #E91E63; + --md-pink-600: #D81B60; + --md-pink-700: #C2185B; + --md-pink-800: #AD1457; + --md-pink-900: #880E4F; + --md-pink-A100: #FF80AB; + --md-pink-A200: #FF4081; + --md-pink-A400: #F50057; + --md-pink-A700: #C51162; + + --md-purple-50: #F3E5F5; + --md-purple-100: #E1BEE7; + --md-purple-200: #CE93D8; + --md-purple-300: #BA68C8; + --md-purple-400: #AB47BC; + --md-purple-500: #9C27B0; + --md-purple-600: #8E24AA; + --md-purple-700: #7B1FA2; + --md-purple-800: #6A1B9A; + --md-purple-900: #4A148C; + --md-purple-A100: #EA80FC; + --md-purple-A200: #E040FB; + --md-purple-A400: #D500F9; + --md-purple-A700: #AA00FF; + + --md-deep-purple-50: #EDE7F6; + --md-deep-purple-100: #D1C4E9; + --md-deep-purple-200: #B39DDB; + --md-deep-purple-300: #9575CD; + --md-deep-purple-400: #7E57C2; + --md-deep-purple-500: #673AB7; + --md-deep-purple-600: #5E35B1; + --md-deep-purple-700: #512DA8; + --md-deep-purple-800: #4527A0; + --md-deep-purple-900: #311B92; + --md-deep-purple-A100: #B388FF; + --md-deep-purple-A200: #7C4DFF; + --md-deep-purple-A400: #651FFF; + --md-deep-purple-A700: #6200EA; + + --md-indigo-50: #E8EAF6; + --md-indigo-100: #C5CAE9; + --md-indigo-200: #9FA8DA; + --md-indigo-300: #7986CB; + --md-indigo-400: #5C6BC0; + --md-indigo-500: #3F51B5; + --md-indigo-600: #3949AB; + --md-indigo-700: #303F9F; + --md-indigo-800: #283593; + --md-indigo-900: #1A237E; + --md-indigo-A100: #8C9EFF; + --md-indigo-A200: #536DFE; + --md-indigo-A400: #3D5AFE; + --md-indigo-A700: #304FFE; + + --md-blue-50: #E3F2FD; + --md-blue-100: #BBDEFB; + --md-blue-200: #90CAF9; + --md-blue-300: #64B5F6; + --md-blue-400: #42A5F5; + --md-blue-500: #2196F3; + --md-blue-600: #1E88E5; + --md-blue-700: #1976D2; + --md-blue-800: #1565C0; + --md-blue-900: #0D47A1; + --md-blue-A100: #82B1FF; + --md-blue-A200: #448AFF; + --md-blue-A400: #2979FF; + --md-blue-A700: #2962FF; + + --md-light-blue-50: #E1F5FE; + --md-light-blue-100: #B3E5FC; + --md-light-blue-200: #81D4FA; + --md-light-blue-300: #4FC3F7; + --md-light-blue-400: #29B6F6; + --md-light-blue-500: #03A9F4; + --md-light-blue-600: #039BE5; + --md-light-blue-700: #0288D1; + --md-light-blue-800: #0277BD; + --md-light-blue-900: #01579B; + --md-light-blue-A100: #80D8FF; + --md-light-blue-A200: #40C4FF; + --md-light-blue-A400: #00B0FF; + --md-light-blue-A700: #0091EA; + + --md-cyan-50: #E0F7FA; + --md-cyan-100: #B2EBF2; + --md-cyan-200: #80DEEA; + --md-cyan-300: #4DD0E1; + --md-cyan-400: #26C6DA; + --md-cyan-500: #00BCD4; + --md-cyan-600: #00ACC1; + --md-cyan-700: #0097A7; + --md-cyan-800: #00838F; + --md-cyan-900: #006064; + --md-cyan-A100: #84FFFF; + --md-cyan-A200: #18FFFF; + --md-cyan-A400: #00E5FF; + --md-cyan-A700: #00B8D4; + + --md-teal-50: #E0F2F1; + --md-teal-100: #B2DFDB; + --md-teal-200: #80CBC4; + --md-teal-300: #4DB6AC; + --md-teal-400: #26A69A; + --md-teal-500: #009688; + --md-teal-600: #00897B; + --md-teal-700: #00796B; + --md-teal-800: #00695C; + --md-teal-900: #004D40; + --md-teal-A100: #A7FFEB; + --md-teal-A200: #64FFDA; + --md-teal-A400: #1DE9B6; + --md-teal-A700: #00BFA5; + + --md-green-50: #E8F5E9; + --md-green-100: #C8E6C9; + --md-green-200: #A5D6A7; + --md-green-300: #81C784; + --md-green-400: #66BB6A; + --md-green-500: #4CAF50; + --md-green-600: #43A047; + --md-green-700: #388E3C; + --md-green-800: #2E7D32; + --md-green-900: #1B5E20; + --md-green-A100: #B9F6CA; + --md-green-A200: #69F0AE; + --md-green-A400: #00E676; + --md-green-A700: #00C853; + + --md-light-green-50: #F1F8E9; + --md-light-green-100: #DCEDC8; + --md-light-green-200: #C5E1A5; + --md-light-green-300: #AED581; + --md-light-green-400: #9CCC65; + --md-light-green-500: #8BC34A; + --md-light-green-600: #7CB342; + --md-light-green-700: #689F38; + --md-light-green-800: #558B2F; + --md-light-green-900: #33691E; + --md-light-green-A100: #CCFF90; + --md-light-green-A200: #B2FF59; + --md-light-green-A400: #76FF03; + --md-light-green-A700: #64DD17; + + --md-lime-50: #F9FBE7; + --md-lime-100: #F0F4C3; + --md-lime-200: #E6EE9C; + --md-lime-300: #DCE775; + --md-lime-400: #D4E157; + --md-lime-500: #CDDC39; + --md-lime-600: #C0CA33; + --md-lime-700: #AFB42B; + --md-lime-800: #9E9D24; + --md-lime-900: #827717; + --md-lime-A100: #F4FF81; + --md-lime-A200: #EEFF41; + --md-lime-A400: #C6FF00; + --md-lime-A700: #AEEA00; + + --md-yellow-50: #FFFDE7; + --md-yellow-100: #FFF9C4; + --md-yellow-200: #FFF59D; + --md-yellow-300: #FFF176; + --md-yellow-400: #FFEE58; + --md-yellow-500: #FFEB3B; + --md-yellow-600: #FDD835; + --md-yellow-700: #FBC02D; + --md-yellow-800: #F9A825; + --md-yellow-900: #F57F17; + --md-yellow-A100: #FFFF8D; + --md-yellow-A200: #FFFF00; + --md-yellow-A400: #FFEA00; + --md-yellow-A700: #FFD600; + + --md-amber-50: #FFF8E1; + --md-amber-100: #FFECB3; + --md-amber-200: #FFE082; + --md-amber-300: #FFD54F; + --md-amber-400: #FFCA28; + --md-amber-500: #FFC107; + --md-amber-600: #FFB300; + --md-amber-700: #FFA000; + --md-amber-800: #FF8F00; + --md-amber-900: #FF6F00; + --md-amber-A100: #FFE57F; + --md-amber-A200: #FFD740; + --md-amber-A400: #FFC400; + --md-amber-A700: #FFAB00; + + --md-orange-50: #FFF3E0; + --md-orange-100: #FFE0B2; + --md-orange-200: #FFCC80; + --md-orange-300: #FFB74D; + --md-orange-400: #FFA726; + --md-orange-500: #FF9800; + --md-orange-600: #FB8C00; + --md-orange-700: #F57C00; + --md-orange-800: #EF6C00; + --md-orange-900: #E65100; + --md-orange-A100: #FFD180; + --md-orange-A200: #FFAB40; + --md-orange-A400: #FF9100; + --md-orange-A700: #FF6D00; + + --md-deep-orange-50: #FBE9E7; + --md-deep-orange-100: #FFCCBC; + --md-deep-orange-200: #FFAB91; + --md-deep-orange-300: #FF8A65; + --md-deep-orange-400: #FF7043; + --md-deep-orange-500: #FF5722; + --md-deep-orange-600: #F4511E; + --md-deep-orange-700: #E64A19; + --md-deep-orange-800: #D84315; + --md-deep-orange-900: #BF360C; + --md-deep-orange-A100: #FF9E80; + --md-deep-orange-A200: #FF6E40; + --md-deep-orange-A400: #FF3D00; + --md-deep-orange-A700: #DD2C00; + + --md-brown-50: #EFEBE9; + --md-brown-100: #D7CCC8; + --md-brown-200: #BCAAA4; + --md-brown-300: #A1887F; + --md-brown-400: #8D6E63; + --md-brown-500: #795548; + --md-brown-600: #6D4C41; + --md-brown-700: #5D4037; + --md-brown-800: #4E342E; + --md-brown-900: #3E2723; + + --md-grey-50: #FAFAFA; + --md-grey-100: #F5F5F5; + --md-grey-200: #EEEEEE; + --md-grey-300: #E0E0E0; + --md-grey-400: #BDBDBD; + --md-grey-500: #9E9E9E; + --md-grey-600: #757575; + --md-grey-700: #616161; + --md-grey-800: #2e2e2e; + --md-grey-900: #212121; + + --md-blue-grey-50: #ECEFF1; + --md-blue-grey-100: #CFD8DC; + --md-blue-grey-200: #b0bec5; + --md-blue-grey-300: #90A4AE; + --md-blue-grey-400: #78909C; + --md-blue-grey-500: #607D8B; + --md-blue-grey-600: #546E7A; + --md-blue-grey-700: #455A64; + --md-blue-grey-800: #37474F; + --md-blue-grey-900: #263238; + +} \ No newline at end of file diff --git a/packages/core/src/browser/style/menus.css b/packages/core/src/browser/style/menus.css new file mode 100644 index 0000000..5df0d8f --- /dev/null +++ b/packages/core/src/browser/style/menus.css @@ -0,0 +1,233 @@ +/******************************************************************************** + * Copyright (C) 2017, 2018 TypeFox and others. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the Eclipse + * Public License v. 2.0 are satisfied: GNU General Public License, version 2 + * with the GNU Classpath Exception which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 + ********************************************************************************/ + +/*----------------------------------------------------------------------------- +| Variables +|----------------------------------------------------------------------------*/ + +:root { + --theia-private-menubar-height: 32px; + --theia-private-menu-item-height: 24px; + --theia-menu-z-index: 10000; +} + +/*----------------------------------------------------------------------------- +| MenuBar +|----------------------------------------------------------------------------*/ + +.lm-Widget.lm-MenuBar { + display: flex; + align-items: center; + padding-left: 5px; + font-size: var(--theia-ui-font-size1); +} + +.lm-MenuBar-menu { + transform: translateY(calc(-2 * var(--theia-border-width))); +} + +.lm-MenuBar-content { + display: flex; + align-items: center; +} + +.lm-MenuBar-item { + padding: 0px 8px; + line-height: var(--theia-content-line-height); + border-radius: 4px; +} + +.lm-MenuBar-item .lm-MenuBar-itemLabel { + white-space: pre; +} + +.lm-MenuBar-item.lm-mod-active { + background: var(--theia-menubar-selectionBackground); + color: var(--theia-menubar-selectionForeground); + opacity: 1; +} + +.lm-MenuBar.lm-mod-active .lm-MenuBar-item.lm-mod-active { + z-index: calc(var(--theia-menu-z-index) - 1); + background: var(--theia-menubar-selectionBackground); + border-left: var(--theia-border-width) solid + var(--theia-menubar-selectionBorder); + border-right: var(--theia-border-width) solid + var(--theia-menubar-selectionBorder); +} + +.lm-MenuBar-item.lm-mod-disabled { + opacity: var(--theia-mod-disabled-opacity); +} + +.lm-MenuBar-item.lm-type-separator { + margin: 2px; + padding: 0; + border: none; + border-left: var(--theia-border-width) solid + var(--theia-menu-separatorBackground); +} + +.lm-MenuBar-itemMnemonic { + text-decoration: underline; +} + +#theia-top-panel { + background: var(--theia-titleBar-activeBackground); + color: var(--theia-titleBar-activeForeground); + display: flex; + min-height: var(--theia-private-menubar-height); + border-bottom: 1px solid var(--theia-titleBar-border); +} +#theia-top-panel:window-inactive, +#theia-top-panel:-moz-window-inactive { + background: var(--theia-titleBar-inactiveBackground); + color: var(--theia-titleBar-inactiveForeground); +} + +/*----------------------------------------------------------------------------- +| Menu +|----------------------------------------------------------------------------*/ + +.lm-Menu { + z-index: var(--theia-menu-z-index); + padding: 4px; + background: var(--theia-menu-background); + color: var(--theia-menu-foreground); + font-size: var(--theia-ui-font-size1); + box-shadow: 0px 1px 6px var(--theia-widget-shadow); + border: 1px solid var(--theia-menu-border); + border-radius: 5px; +} + +/* Remove focus outline for menu and context menu items */ +.lm-Menu:focus, +.lm-Menu-item:focus, +.lm-MenuBar-item:focus { + outline: none; +} + +.lm-Menu-item { + min-height: var(--theia-private-menu-item-height); + max-height: var(--theia-private-menu-item-height); + padding: 0px; + /** + * FireFox adds 0.5px to all menu items for some reason + * Subtracting that amount fixes the behavior on FireFox and doesn't introduce issues on Chromium + */ + line-height: calc(var(--theia-private-menu-item-height) - 0.5px); + overflow: hidden; +} + +.lm-Menu-item.lm-mod-active { + color: var(--theia-menu-selectionForeground); + border: thin solid var(--theia-menu-selectionBorder); + opacity: 1; + cursor: pointer; +} + +/** + * We cannot apply border-radius on items with `display: table-row` + * So we apply it to its first and last child + */ + +.lm-Menu-item.lm-mod-active > div { + background: var(--theia-menu-selectionBackground); +} + +.lm-Menu-item.lm-mod-active > div:first-child { + border-top-left-radius: 4px; + border-bottom-left-radius: 4px; +} + +.lm-Menu-item.lm-mod-active > div:last-child { + border-top-right-radius: 4px; + border-bottom-right-radius: 4px; +} + +.lm-Menu-item.lm-mod-disabled { + opacity: var(--theia-mod-disabled-opacity); +} + +.lm-Menu-itemIcon { + width: 21px; + padding: 0px 2px 0px 4px; + height: var(--theia-private-menu-item-height); +} + +.lm-Menu-itemLabel { + padding: 0px 32px 0px 2px; +} + +.lm-Menu-itemMnemonic { + text-decoration: underline; +} + +.lm-Menu-itemShortcut { + padding: 0px; +} + +.lm-Menu-itemSubmenuIcon { + width: var(--theia-icon-size); + padding: 0px 10px 0px 0px; +} + +.lm-Menu-item[data-type="separator"] > div { + padding: 0; + height: 9px; + opacity: 0.36; +} + +.lm-Menu-item[data-type="separator"] > div::after { + content: ""; + display: block; + position: relative; + top: 4px; + border-top: var(--theia-border-width) solid + var(--theia-menu-separatorBackground); +} + +.lm-Menu-item[data-type="separator"] > div:first-child:after { + margin-left: -4px; +} + +.lm-Menu-item[data-type="separator"] > div:last-child::after { + margin-right: -4px; +} + +.lm-Menu-itemIcon::before, +.lm-Menu-itemSubmenuIcon::before { + font: normal normal normal 16px/1 codicon; + display: inline-block; + text-decoration: none; + text-rendering: auto; + text-align: center; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + user-select: none; + -webkit-user-select: none; + -ms-user-select: none; + transform: translateY(20%); +} + +.lm-Menu-item.lm-mod-toggled > .lm-Menu-itemIcon::before { + content: "\eab2"; + transform: scale(0.8) translateY(20%); +} + +.lm-Menu-item[data-type="submenu"] > .lm-Menu-itemSubmenuIcon::before { + content: "\eab6"; +} diff --git a/packages/core/src/browser/style/notification.css b/packages/core/src/browser/style/notification.css new file mode 100644 index 0000000..3153b22 --- /dev/null +++ b/packages/core/src/browser/style/notification.css @@ -0,0 +1,39 @@ +/******************************************************************************** + * Copyright (C) 2018 Ericsson and others. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the Eclipse + * Public License v. 2.0 are satisfied: GNU General Public License, version 2 + * with the GNU Classpath Exception which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 + ********************************************************************************/ + +:root { + --theia-notification-count-height: 15.5px; + --theia-notification-count-width: 15.5px; +} + +.notification-count-container { + align-self: center; + background-color: var(--theia-badge-background); + border-radius: 20px; + color: var(--theia-badge-foreground); + display: flex; + font-size: calc(var(--theia-ui-font-size0) * 0.8); + font-weight: 500; + height: var(--theia-notification-count-height); + justify-content: center; + min-width: 6px; + padding: 0 5px; + text-align: center; +} + +.notification-count-container > .notification-count { + align-self: center; +} diff --git a/packages/core/src/browser/style/os.css b/packages/core/src/browser/style/os.css new file mode 100644 index 0000000..187011c --- /dev/null +++ b/packages/core/src/browser/style/os.css @@ -0,0 +1,87 @@ +/******************************************************************************** + * Copyright (C) 2019 TypeFox and others. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the Eclipse + * Public License v. 2.0 are satisfied: GNU General Public License, version 2 + * with the GNU Classpath Exception which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 + ********************************************************************************/ + +.mac { + --theia-ui-font-family: -apple-system,BlinkMacSystemFont,sans-serif +} + +.mac:lang(zh-Hans) { + --theia-ui-font-family: -apple-system,BlinkMacSystemFont,PingFang SC,Hiragino Sans GB,sans-serif +} + +.mac:lang(zh-Hant) { + --theia-ui-font-family: -apple-system,BlinkMacSystemFont,PingFang TC,sans-serif +} + +.mac:lang(ja) { + --theia-ui-font-family: -apple-system,BlinkMacSystemFont,Hiragino Kaku Gothic Pro,sans-serif +} + +.mac:lang(ko) { + --theia-ui-font-family: -apple-system,BlinkMacSystemFont,Nanum Gothic,Apple SD Gothic Neo,AppleGothic,sans-serif +} + +.windows { + --theia-ui-font-family: Segoe WPC,Segoe UI,sans-serif +} + +.windows:lang(zh-Hans) { + --theia-ui-font-family: Segoe WPC,Segoe UI,Microsoft YaHei,sans-serif +} + +.windows:lang(zh-Hant) { + --theia-ui-font-family: Segoe WPC,Segoe UI,Microsoft Jhenghei,sans-serif +} + +.windows:lang(ja) { + --theia-ui-font-family: Segoe WPC,Segoe UI,Yu Gothic UI,Meiryo UI,sans-serif +} + +.windows:lang(ko) { + --theia-ui-font-family: Segoe WPC,Segoe UI,Malgun Gothic,Dotom,sans-serif +} + +.linux { + --theia-ui-font-family: system-ui,Ubuntu,Droid Sans,sans-serif +} + +.linux:lang(zh-Hans) { + --theia-ui-font-family: system-ui,Ubuntu,Droid Sans,Source Han Sans SC,Source Han Sans CN,Source Han Sans,sans-serif +} + +.linux:lang(zh-Hant) { + --theia-ui-font-family: system-ui,Ubuntu,Droid Sans,Source Han Sans TC,Source Han Sans TW,Source Han Sans,sans-serif +} + +.linux:lang(ja) { + --theia-ui-font-family: system-ui,Ubuntu,Droid Sans,Source Han Sans J,Source Han Sans JP,Source Han Sans,sans-serif +} + +.linux:lang(ko) { + --theia-ui-font-family: system-ui,Ubuntu,Droid Sans,Source Han Sans K,Source Han Sans JR,Source Han Sans,UnDotum,FBaekmuk Gulim,sans-serif +} + +.mac { + --monaco-monospace-font: "SF Mono",Monaco,Menlo,Courier,monospace +} + +.windows { + --monaco-monospace-font: Consolas,"Courier New",monospace +} + +.linux { + --monaco-monospace-font: "Ubuntu Mono","Liberation Mono","DejaVu Sans Mono","Courier New",monospace +} diff --git a/packages/core/src/browser/style/progress-bar.css b/packages/core/src/browser/style/progress-bar.css new file mode 100644 index 0000000..9858619 --- /dev/null +++ b/packages/core/src/browser/style/progress-bar.css @@ -0,0 +1,46 @@ +/******************************************************************************** + * Copyright (C) 2019 TypeFox and others. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the Eclipse + * Public License v. 2.0 are satisfied: GNU General Public License, version 2 + * with the GNU Classpath Exception which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 + ********************************************************************************/ + +.theia-progress-bar-container { + position: absolute; + top: -2px; + left: 0; + width: 100%; + height: 2px; +} + +.theia-progress-bar { + background-color: var(--theia-progressBar-background); + height: 2px; + width: 3%; + animation: progress-animation 1.3s 0s infinite + cubic-bezier(0.645, 0.045, 0.355, 1); +} + +@keyframes progress-animation { + 0% { + margin-left: 0%; + width: 3%; + } + 60% { + margin-left: 45%; + width: 20%; + } + 100% { + margin-left: 99%; + width: 1%; + } +} diff --git a/packages/core/src/browser/style/quick-title-bar.css b/packages/core/src/browser/style/quick-title-bar.css new file mode 100644 index 0000000..3969cd3 --- /dev/null +++ b/packages/core/src/browser/style/quick-title-bar.css @@ -0,0 +1,45 @@ +/******************************************************************************** + * Copyright (C) 2019 Red Hat, Inc. and others. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the Eclipse + * Public License v. 2.0 are satisfied: GNU General Public License, version 2 + * with the GNU Classpath Exception which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 + ********************************************************************************/ + +.theia-quick-title-container { + display: flex; + padding: calc(var(--theia-ui-padding) / 2); + justify-content: space-between; + align-items: center; + background: var(--theia-titleBar-activeBackground); +} + +.theia-quick-title-left-bar { + display: flex; + text-align: left; +} + +.theia-quick-title-right-bar { + display: flex; + text-align: right; +} + +.theia-quick-title-header { + text-align: center; +} + +.theia-quick-title-button { + width: var(--theia-icon-size); + height: var(--theia-icon-size); + display: flex; + align-items: center; + cursor: pointer; +} diff --git a/packages/core/src/browser/style/scrollbars.css b/packages/core/src/browser/style/scrollbars.css new file mode 100644 index 0000000..17e9605 --- /dev/null +++ b/packages/core/src/browser/style/scrollbars.css @@ -0,0 +1,172 @@ +/******************************************************************************** + * Copyright (C) 2017, 2018 TypeFox and others. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the Eclipse + * Public License v. 2.0 are satisfied: GNU General Public License, version 2 + * with the GNU Classpath Exception which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 + ********************************************************************************/ + +@import url("~perfect-scrollbar/css/perfect-scrollbar.css"); + +::-webkit-scrollbar { + height: var(--theia-scrollbar-width); + width: var(--theia-scrollbar-width); + background: transparent; +} + +::-webkit-scrollbar-thumb { + background: var(--theia-scrollbarSlider-background); +} + +::-webkit-scrollbar:hover { + background: transparent; +} + +::-webkit-scrollbar-thumb:hover { + background: var(--theia-scrollbarSlider-hoverBackground); +} + +::-webkit-scrollbar-thumb:active { + background: var(--theia-scrollbarSlider-activeBackground); +} + +::-webkit-scrollbar-corner { + background: transparent; +} + +/*----------------------------------------------------------------------------- +| Perfect scrollbar +|----------------------------------------------------------------------------*/ + +#theia-app-shell .ps__rail-x, +#theia-dialog-shell .ps__rail-x, +#theia-breadcrumbs-popups-overlay .ps__rail-x { + height: var(--theia-scrollbar-rail-width); +} + +#theia-app-shell .ps__rail-x > .ps__thumb-x, +#theia-dialog-shell .ps__rail-x > .ps__thumb-x, +#theia-breadcrumbs-popups-overlay .ps__thumb-x { + height: var(--theia-scrollbar-width); + bottom: calc( + (var(--theia-scrollbar-rail-width) - var(--theia-scrollbar-width)) / 2 + ); + background: var(--theia-scrollbarSlider-background); + border-radius: 0px; +} + +#theia-app-shell .ps__rail-x:hover, +#theia-app-shell .ps__rail-x:focus, +#theia-dialog-shell .ps__rail-x:hover, +#theia-dialog-shell .ps__rail-x:focus, +#theia-breadcrumbs-popups-overlay .ps__rail-x:hover, +#theia-breadcrumbs-popups-overlay .ps__rail-x:focus { + height: var(--theia-scrollbar-rail-width); +} + +#theia-app-shell .ps__rail-x:hover > .ps__thumb-x, +#theia-app-shell .ps__rail-x:focus > .ps__thumb-x, +#theia-app-shell .ps__rail-x.ps--clicking .ps__thumb-x, +#theia-dialog-shell .ps__rail-x:hover > .ps__thumb-x, +#theia-dialog-shell .ps__rail-x:focus > .ps__thumb-x, +#theia-dialog-shell .ps__rail-x.ps--clicking .ps__thumb-x, +#theia-breadcrumbs-popups-overlay .ps__rail-x:hover > .ps__thumb-x, +#theia-breadcrumbs-popups-overlay .ps__rail-x:focus > .ps__thumb-x, +#theia-breadcrumbs-popups-overlay .ps__rail-x.ps--clicking .ps__thumb-x { + height: var(--theia-scrollbar-width); +} + +#theia-app-shell .ps__rail-y, +#theia-dialog-shell .ps__rail-y, +#theia-breadcrumbs-popups-overlay .ps__rail-y { + width: var(--theia-scrollbar-rail-width); +} + +#theia-app-shell .ps__rail-y > .ps__thumb-y, +#theia-dialog-shell .ps__rail-y > .ps__thumb-y, +#theia-breadcrumbs-popups-overlay .ps__rail-y > .ps__thumb-y { + width: var(--theia-scrollbar-width); + right: calc( + (var(--theia-scrollbar-rail-width) - var(--theia-scrollbar-width)) / 2 + ); + background: var(--theia-scrollbarSlider-background); + border-radius: 0px; +} + +#theia-app-shell .ps__rail-y:hover, +#theia-app-shell .ps__rail-y:focus, +#theia-dialog-shell .ps__rail-y:hover, +#theia-dialog-shell .ps__rail-y:focus, +#theia-breadcrumbs-popups-overlay .ps__rail-y:hover, +#theia-breadcrumbs-popups-overlay .ps__rail-y:focus { + width: var(--theia-scrollbar-rail-width); +} + +#theia-app-shell .ps__rail-y:hover > .ps__thumb-y, +#theia-app-shell .ps__rail-y:focus > .ps__thumb-y, +#theia-app-shell .ps__rail-y.ps--clicking .ps__thumb-y, +#theia-dialog-shell .ps__rail-y:hover > .ps__thumb-y, +#theia-dialog-shell .ps__rail-y:focus > .ps__thumb-y, +#theia-dialog-shell .ps__rail-y.ps--clicking .ps__thumb-y, +#theia-breadcrumbs-popups-overlay .ps__rail-y:hover > .ps__thumb-y, +#theia-breadcrumbs-popups-overlay .ps__rail-y:focus > .ps__thumb-y, +#theia-breadcrumbs-popups-overlay .ps__rail-y.ps--clicking .ps__thumb-y { + right: calc( + (var(--theia-scrollbar-rail-width) - var(--theia-scrollbar-width)) / 2 + ); + width: var(--theia-scrollbar-width); +} + +#theia-app-shell .ps [class^="ps__rail"].ps--clicking > [class^="ps__thumb"], +#theia-dialog-shell .ps [class^="ps__rail"].ps--clicking > [class^="ps__thumb"], +#theia-breadcrumbs-popups-overlay + .ps + [class^="ps__rail"].ps--clicking + > [class^="ps__thumb"] { + background-color: var(--theia-scrollbarSlider-activeBackground); +} + +#theia-app-shell .ps [class^="ps__rail"] > [class^="ps__thumb"]:hover, +#theia-app-shell .ps [class^="ps__rail"] > [class^="ps__thumb"]:focus, +#theia-dialog-shell .ps [class^="ps__rail"] > [class^="ps__thumb"]:hover, +#theia-dialog-shell .ps [class^="ps__rail"] > [class^="ps__thumb"]:focus, +#theia-breadcrumbs-popups-overlay + .ps + [class^="ps__rail"] + > [class^="ps__thumb"]:hover, +#theia-breadcrumbs-popups-overlay + .ps + [class^="ps__rail"] + > [class^="ps__thumb"]:focus { + background: var(--theia-scrollbarSlider-hoverBackground); +} + +#theia-app-shell .ps [class^="ps__rail"] > [class^="ps__thumb"]:active, +#theia-dialog-shell .ps [class^="ps__rail"] > [class^="ps__thumb"]:active, +#theia-breadcrumbs-popups-overlay + .ps + [class^="ps__rail"] + > [class^="ps__thumb"]:active { + background: var(--theia-scrollbarSlider-activeBackground); +} + +#theia-app-shell .ps:hover > [class^="ps__rail"], +#theia-app-shell .ps--focus > [class^="ps__rail"], +#theia-app-shell .ps--scrolling-y > [class^="ps__rail"], +#theia-dialog-shell .ps:hover > [class^="ps__rail"], +#theia-dialog-shell .ps--focus > [class^="ps__rail"], +#theia-dialog-shell .ps--scrolling-y > [class^="ps__rail"], +#theia-breadcrumbs-popups-overlay .ps:hover > [class^="ps__rail"], +#theia-breadcrumbs-popups-overlay .ps--focus > [class^="ps__rail"], +#theia-breadcrumbs-popups-overlay .ps--scrolling-y > [class^="ps__rail"] { + opacity: 1; + background: transparent; +} diff --git a/packages/core/src/browser/style/search-box.css b/packages/core/src/browser/style/search-box.css new file mode 100644 index 0000000..e7da40c --- /dev/null +++ b/packages/core/src/browser/style/search-box.css @@ -0,0 +1,60 @@ +/******************************************************************************** + * Copyright (C) 2018 TypeFox and others. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the Eclipse + * Public License v. 2.0 are satisfied: GNU General Public License, version 2 + * with the GNU Classpath Exception which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 + ********************************************************************************/ + +:root { + --theia-search-box-radius: 2px; + --theia-search-box-max-width: 500px; +} + +.theia-search-box-widget { + position: absolute; + top: 0; + right: var(--theia-scrollbar-width); + background-color: var(--theia-sideBar-background); + z-index: calc(var(--theia-tabbar-toolbar-z-index) + 1); + border-radius: var(--theia-search-box-radius); +} + +.theia-search-box-widget .theia-search-box { + display: flex; + padding: calc(var(--theia-ui-padding) / 2); + border: var(--theia-border-width) solid var(--theia-widget-border, var(--theia-list-hoverBackground)); +} + +.theia-search-box-widget .theia-search-box.no-match { + border: var(--theia-border-width) solid var(--theia-inputValidation-errorBorder); +} + +.theia-search-box-widget .theia-search-input { + flex-grow: 1; + user-select: none; + background-color: var(--theia-input-background); + padding: calc(var(--theia-ui-padding) / 2); +} + +.theia-search-box-widget .theia-search-box>.theia-search-buttons-wrapper { + max-width: var(--theia-search-box-max-width); + display: flex; + align-items: center; +} + +.theia-search-box-widget .theia-search-button { + padding: 2px; +} + +.theia-search-box-widget .theia-search-button.no-match { + opacity: var(--theia-mod-disabled-opacity); +} diff --git a/packages/core/src/browser/style/select-component.css b/packages/core/src/browser/style/select-component.css new file mode 100644 index 0000000..3ba615a --- /dev/null +++ b/packages/core/src/browser/style/select-component.css @@ -0,0 +1,104 @@ +/******************************************************************************** + * Copyright (C) 2022 TypeFox and others. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the Eclipse + * Public License v. 2.0 are satisfied: GNU General Public License, version 2 + * with the GNU Classpath Exception which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 + ********************************************************************************/ + +.theia-select-component-container { + /* required to set z-index */ + position: fixed; + /* dialog overlay has a z-index of 5000 */ + z-index: 6000; +} + +.theia-select-component { + background-color: var(--theia-dropdown-background); + cursor: pointer; + outline: var(--theia-dropdown-border) solid 1px; + outline-offset: -1px; + min-height: 23px; + min-width: 90px; + padding: 0px 8px; + display: flex; + align-items: center; + user-select: none; + border-radius: 2px; +} + +.theia-select-component .theia-select-component-label { + width: 100%; + color: var(--theia-dropdown-foreground); + white-space: nowrap; + text-overflow: ellipsis; + overflow: hidden; +} + +.theia-select-component-dropdown { + font-family: var(--theia-ui-font-family); + font-size: var(--theia-ui-font-size1); + color: var(--theia-foreground); + background-color: var(--theia-settings-dropdownBackground); + outline: var(--theia-focusBorder) solid 1px; + outline-offset: -1px; + user-select: none; + overflow: auto; + border-radius: 2px; + margin-top: 2px; +} + +.theia-select-component-dropdown .theia-select-component-option { + text-overflow: ellipsis; + overflow: hidden; + display: flex; + padding: 0px 5px; + line-height: 22px; +} + +.theia-select-component-dropdown .theia-select-component-description { + padding: 6px 5px; +} + +.theia-select-component-dropdown .theia-select-component-description:first-child { + border-bottom: 1px solid var(--theia-editorWidget-border); + margin-bottom: 2px; +} + +.theia-select-component-dropdown .theia-select-component-description:last-child { + border-top: 1px solid var(--theia-editorWidget-border); + margin-top: 2px; +} + +.theia-select-component-dropdown .theia-select-component-option .theia-select-component-option-value { + width: 100%; +} + +.theia-select-component-dropdown .theia-select-component-option .theia-select-component-option-detail { + padding-left: 4px; +} + +.theia-select-component-dropdown .theia-select-component-option:not(.selected) .theia-select-component-option-detail { + color: var(--theia-textLink-foreground); +} + +.theia-select-component-dropdown .theia-select-component-option.selected { + color: var(--theia-list-activeSelectionForeground); + cursor: pointer; + background: var(--theia-list-activeSelectionBackground); +} + +.theia-select-component-dropdown .theia-select-component-separator { + width: 84px; + height: 1px; + margin: 3px 3px; + background: var(--theia-foreground); +} diff --git a/packages/core/src/browser/style/sidepanel.css b/packages/core/src/browser/style/sidepanel.css new file mode 100644 index 0000000..7833f49 --- /dev/null +++ b/packages/core/src/browser/style/sidepanel.css @@ -0,0 +1,365 @@ +/******************************************************************************** + * Copyright (C) 2017, 2018 TypeFox and others. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the Eclipse + * Public License v. 2.0 are satisfied: GNU General Public License, version 2 + * with the GNU Classpath Exception which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 + ********************************************************************************/ + +/*----------------------------------------------------------------------------- +| Variables +|----------------------------------------------------------------------------*/ + +:root { + --theia-private-sidebar-tab-width: 48px; + --theia-private-sidebar-tab-height: 32px; + --theia-private-sidebar-tab-padding-top-and-bottom: 11px; + --theia-private-sidebar-tab-padding-left-and-right: 10px; + --theia-private-sidebar-scrollbar-rail-width: 7px; + --theia-private-sidebar-scrollbar-width: 5px; + --theia-private-sidebar-icon-size: 24px; +} + +/*----------------------------------------------------------------------------- +| SideBars (left and right) +|----------------------------------------------------------------------------*/ + +.lm-TabBar.theia-app-sides { + display: block; + color: var(--theia-activityBar-inactiveForeground); + font-size: var(--theia-ui-font-size1); + min-width: var(--theia-private-sidebar-tab-width); + max-width: var(--theia-private-sidebar-tab-width); + overflow: hidden; +} + +.lm-TabBar-content { + gap: 4px 0px; +} + +.lm-TabBar.theia-app-sides .lm-TabBar-content { + z-index: 1; +} + +.lm-TabBar.theia-app-sides .lm-TabBar-tab { + position: relative; + flex-direction: column; + justify-content: center; + align-items: center; + min-height: var(--theia-private-sidebar-tab-height); + cursor: pointer; +} + +.lm-TabBar.theia-app-sides .lm-TabBar-tab.lm-mod-current, +.lm-TabBar.theia-app-sides .lm-TabBar-tab:hover { + color: var(--theia-activityBar-foreground); + background-color: var(--theia-activityBar-activeBackground); + min-height: var(--theia-private-sidebar-tab-height); + height: var(--theia-private-sidebar-tab-height); + border-top: none; +} + +.lm-TabBar.theia-app-left .lm-TabBar-tab.lm-mod-current { + border-top-color: transparent; + box-shadow: 2px 0 0 var(--theia-activityBar-activeBorder) inset; +} + +.lm-TabBar.theia-app-right .lm-TabBar-tab.lm-mod-current { + border-top-color: transparent; + box-shadow: -2px 0 0 var(--theia-activityBar-activeBorder) inset; +} + +.lm-TabBar.theia-app-sides .lm-TabBar-tabLabel, +.lm-TabBar.theia-app-sides .lm-TabBar-tabCloseIcon { + display: none; +} + +/* inactive common icons */ +.lm-TabBar.theia-app-sides .lm-TabBar-tabIcon { + display: flex; + align-items: center; + justify-content: center; + font-size: var(--theia-private-sidebar-icon-size); + text-align: center; + color: inherit; + + /* svg */ + width: var(--theia-private-sidebar-tab-width); + height: var(--theia-private-sidebar-tab-width); + mask-repeat: no-repeat; + -webkit-mask-repeat: no-repeat; + mask-size: var(--theia-private-sidebar-icon-size); + -webkit-mask-size: var(--theia-private-sidebar-icon-size); + mask-position: 50% 50%; + -webkit-mask-position: 50% 50%; +} + +/* inactive legacy/plugin icons */ +.lm-TabBar.theia-app-sides .lm-TabBar-tabIcon:not(.codicon) { + background: var(--theia-activityBar-inactiveForeground); +} + +/* inactive file icons */ +.lm-TabBar.theia-app-sides .file-icon.lm-TabBar-tabIcon { + background: inherit !important; +} + +/* inactive font-awesome icons */ +.lm-TabBar.theia-app-sides .fa.lm-TabBar-tabIcon { + background: none !important; +} + +/* active icons */ +.lm-TabBar.theia-app-sides .lm-TabBar-tabIcon:hover, +.lm-TabBar.theia-app-sides .lm-mod-current .lm-TabBar-tabIcon { + color: var(--theia-activityBar-foreground); +} + +/* active legacy/plugin icons */ +.lm-TabBar.theia-app-sides .lm-TabBar-tabIcon:not(.codicon):hover, +.lm-TabBar.theia-app-sides .lm-mod-current .lm-TabBar-tabIcon:not(.codicon) { + background-color: var(--theia-activityBar-foreground); +} + +.lm-TabBar.theia-app-left .lm-TabBar-tabLabel { + transform-origin: top left 0; + transform: rotate(-90deg) translateX(-100%); +} + +.lm-TabBar.theia-app-right .lm-TabBar-tabLabel { + transform-origin: top left 0; + transform: rotate(90deg) translateY(-50%); +} + +#theia-left-content-panel.theia-mod-collapsed, +#theia-right-content-panel.theia-mod-collapsed { + max-width: var(--theia-private-sidebar-tab-width); +} + +#theia-left-content-panel.theia-mod-collapsed .theia-app-sidebar-container { + border-right: none; +} + +#theia-right-content-panel.theia-mod-collapsed .theia-app-sidebar-container { + border-left: none; +} + +#theia-left-content-panel > .lm-Panel { + border-right: var(--theia-panel-border-width) solid + var(--theia-activityBar-border); +} + +#theia-right-content-panel > .lm-Panel { + border-left: var(--theia-panel-border-width) solid + var(--theia-activityBar-border); +} + +.theia-side-panel { + background-color: var(--theia-sideBar-background); +} + +.lm-Widget.theia-side-panel .lm-Widget, +.lm-Widget .theia-sidepanel-toolbar { + color: var(--theia-sideBar-foreground); +} + +.theia-app-sidebar-container { + min-width: var(--theia-private-sidebar-tab-width); + max-width: var(--theia-private-sidebar-tab-width); + background: var(--theia-activityBar-background); + display: flex; + flex-direction: column; +} + +.theia-app-sidebar-container .theia-app-sides { + flex-grow: 1; +} + +.theia-app-sidebar-container .theia-sidebar-menu { + flex-shrink: 0; +} + +.lm-Widget.theia-sidebar-menu { + background-color: var(--theia-activityBar-background); + display: flex; + flex-direction: column-reverse; +} + +.lm-Widget .theia-sidebar-menu-item { + cursor: pointer; +} + +.lm-Widget.theia-sidebar-menu i { + padding: var(--theia-private-sidebar-tab-padding-top-and-bottom) + var(--theia-private-sidebar-tab-padding-left-and-right); + display: flex; + justify-content: center; + align-items: center; + color: var(--theia-activityBar-inactiveForeground); + background-color: var(--theia-activityBar-background); + font-size: var(--theia-private-sidebar-icon-size); +} + +.theia-sidebar-menu .theia-sidebar-menu-item:hover i { + color: var(--theia-activityBar-foreground); +} + +.theia-sidebar-menu i.theia-compact-menu { + font-size: 16px; +} + +.lm-SplitPanel-handle.sash-hidden { + visibility: hidden; +} + +/*----------------------------------------------------------------------------- +| Perfect scrollbar +|----------------------------------------------------------------------------*/ + +.lm-TabBar.theia-app-sides > .ps__rail-y { + width: var(--theia-private-sidebar-scrollbar-rail-width); + z-index: 1000; +} + +#theia-app-shell .lm-TabBar.theia-app-sides > .ps__rail-y > .ps__thumb-y { + width: var(--theia-private-sidebar-scrollbar-width); + right: calc( + ( + var(--theia-private-sidebar-scrollbar-rail-width) - + var(--theia-private-sidebar-scrollbar-width) + ) / 2 + ); +} + +.lm-TabBar.theia-app-sides > .ps__rail-y:hover, +.lm-TabBar.theia-app-sides > .ps__rail-y:focus { + width: var(--theia-private-sidebar-scrollbar-rail-width); +} + +.lm-TabBar.theia-app-sides > .ps__rail-y:hover > .ps__thumb-y, +.lm-TabBar.theia-app-sides > .ps__rail-y:focus > .ps__thumb-y { + width: var(--theia-private-sidebar-scrollbar-width); + right: calc( + ( + var(--theia-private-sidebar-scrollbar-rail-width) - + var(--theia-private-sidebar-scrollbar-width) + ) / 2 + ); +} + +/*----------------------------------------------------------------------------- +| Bottom content panel +|----------------------------------------------------------------------------*/ + +#theia-bottom-content-panel { + background: var(--theia-panel-background); +} + +#theia-bottom-content-panel .theia-input { + border-color: var(--theia-panelInput-border); +} + +#theia-bottom-content-panel .lm-DockPanel-handle[data-orientation="horizontal"] { + border-left: var(--theia-border-width) solid var(--theia-panel-border); +} + +#theia-bottom-content-panel .lm-TabBar { + border-top: var(--theia-border-width) solid var(--theia-panel-border); + background: inherit; +} + +#theia-bottom-content-panel .lm-TabBar-tab { + background: inherit; +} + +#theia-bottom-content-panel .lm-TabBar-tab:not(.lm-mod-current) { + color: var(--theia-panelTitle-inactiveForeground); +} + +#theia-bottom-content-panel .lm-TabBar-tab.lm-mod-current { + color: var(--theia-panelTitle-activeForeground); + box-shadow: 0 var(--theia-border-width) 0 var(--theia-panelTitle-activeBorder) + inset; +} + +#theia-bottom-content-panel + .lm-TabBar:not(.theia-tabBar-active) + .lm-TabBar-tab + .theia-tab-icon-label { + color: var(--theia-tab-unfocusedInactiveForeground); +} + +#theia-bottom-content-panel + .lm-TabBar:not(.theia-tabBar-active) + .lm-TabBar-tab.lm-mod-current + .theia-tab-icon-label { + color: var(--theia-tab-unfocusedActiveForeground); +} + +/*----------------------------------------------------------------------------- +| Hidden tab bars used for rendering vertical side bars +|----------------------------------------------------------------------------*/ + +.theia-TabBar-hidden-content { + display: flex; + position: absolute; + visibility: hidden; + padding-inline-start: 0px; +} + +.lm-TabBar.theia-app-sides > .theia-TabBar-hidden-content .lm-TabBar-tab { + line-height: var(--theia-private-sidebar-tab-width); +} + +.lm-TabBar.theia-app-left > .theia-TabBar-hidden-content .lm-TabBar-tabLabel { + transform: none; +} + +.lm-TabBar.theia-app-right > .theia-TabBar-hidden-content .lm-TabBar-tabLabel { + transform: none; +} + +/*----------------------------------------------------------------------------- +| Sidepanel Toolbar +|----------------------------------------------------------------------------*/ + +.theia-sidepanel-toolbar { + display: flex; + align-items: center; + min-height: var(--theia-horizontal-toolbar-height); + background-color: var(--theia-sideBar-background); + overflow: hidden; +} + +.theia-sidepanel-toolbar .theia-sidepanel-title { + color: var(--theia-settings-headerForeground); + flex: 1; + margin-left: calc(var(--theia-ui-padding) * 3); + text-transform: uppercase; + font-size: var(--theia-ui-font-size0); + min-width: 1rem; +} + +.theia-sidepanel-toolbar .lm-TabBar-toolbar .item { + color: var(--theia-icon-foreground); +} + +.noWrapInfo { + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} + +.noWrapInfoTree { + white-space: pre; + overflow: hidden; + text-overflow: ellipsis; +} diff --git a/packages/core/src/browser/style/split-widget.css b/packages/core/src/browser/style/split-widget.css new file mode 100644 index 0000000..40772cb --- /dev/null +++ b/packages/core/src/browser/style/split-widget.css @@ -0,0 +1,42 @@ +/******************************************************************************** + * Copyright (C) 2024 1C-Soft LLC and others. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the Eclipse + * Public License v. 2.0 are satisfied: GNU General Public License, version 2 + * with the GNU Classpath Exception which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 + ********************************************************************************/ + +.theia-split-widget > .lm-SplitPanel { + height: 100%; + width: 100%; + outline: none; +} + +.theia-split-widget > .lm-SplitPanel > .lm-SplitPanel-child { + min-width: 50px; + min-height: var(--theia-content-line-height); +} + +.lm-SplitPanel-handle { + z-index: 6; /* Upper than the minimap */ +} + +.theia-split-widget > .lm-SplitPanel > .lm-SplitPanel-handle { + box-sizing: border-box; +} + +.theia-split-widget > .lm-SplitPanel[data-orientation="horizontal"] > .lm-SplitPanel-handle { + border-left: var(--theia-border-width) solid var(--theia-sideBarSectionHeader-border); +} + +.theia-split-widget > .lm-SplitPanel[data-orientation="vertical"] > .lm-SplitPanel-handle { + border-top: var(--theia-border-width) solid var(--theia-sideBarSectionHeader-border); +} diff --git a/packages/core/src/browser/style/status-bar.css b/packages/core/src/browser/style/status-bar.css new file mode 100644 index 0000000..501ca58 --- /dev/null +++ b/packages/core/src/browser/style/status-bar.css @@ -0,0 +1,130 @@ +/******************************************************************************** + * Copyright (C) 2017 TypeFox and others. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the Eclipse + * Public License v. 2.0 are satisfied: GNU General Public License, version 2 + * with the GNU Classpath Exception which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 + ********************************************************************************/ + +:root { + --theia-statusBar-height: 22px; +} + +#theia-statusBar { + background: var(--theia-statusBar-background); + display: flex; + min-height: var(--theia-statusBar-height); + white-space: nowrap; + border-top: var(--theia-border-width) solid var(--theia-statusBar-border); +} + +body.theia-no-open-workspace #theia-statusBar { + background: var(--theia-statusBar-noFolderBackground); + color: var(--theia-statusBar-noFolderForeground); + border-top: var(--theia-border-width) solid + var(--theia-statusBar-noFolderBorder); +} + +#theia-statusBar .area { + flex: 1; + display: flex; + align-items: stretch; + gap: var(--theia-ui-padding) +} + +#theia-statusBar .area.left { + justify-content: flex-start; + padding-left: var(--theia-ui-padding); +} + +#theia-statusBar .area.right { + justify-content: flex-end; + padding-right: var(--theia-ui-padding); +} + +#theia-statusBar .area .element { + color: var(--theia-statusBar-foreground); + display: flex; + align-items: center; + justify-content: center; + font-size: var(--theia-statusBar-font-size); + min-width: var(--theia-statusBar-height); +} + +#theia-statusBar .area.left .element.has-background { + padding-inline: var(--theia-ui-padding); +} + +#theia-statusBar .area.left .element.has-background { + margin-left: calc(-1 * var(--theia-ui-padding)); +} + +/* Icons */ +#theia-statusBar .area .element .codicon { + /* Scaling down codicons from 16 to 14 pixels */ + font-size: 14px; + margin: auto; +} + +/* Icon with text */ +#theia-statusBar .area .element .codicon:has(+ span) { + margin-inline: calc(var(--theia-ui-padding) / 2); +} + +/* Text labels */ +#theia-statusBar .area .element>span:not(.codicon) { + margin-inline: calc(var(--theia-ui-padding) / 2) +} + +#theia-statusBar .area .element>span:not(.codicon):empty { + display: none; +} + +.theia-mod-offline #theia-statusBar { + background-color: var(--theia-statusBar-offlineBackground) !important; +} + +.theia-mod-offline #theia-statusBar .area .element { + color: var(--theia-statusBar-offlineForeground) !important; +} + +#theia-statusBar .area.right .element.compact-right, +#theia-statusBar .area.right .element.compact-left + .element { + margin-left: 0; +} + +#theia-statusBar .area.left .element.compact-left { + margin-right: 0; +} + +#theia-statusBar .area.left .element.compact-right { + margin-left: calc(-1 * var(--theia-ui-padding)); +} + +#theia-statusBar .area .element.hasCommand:hover { + cursor: pointer; +} + +#theia-statusBar .area .element.hasCommand:active { + cursor: pointer; +} + +#theia-statusBar .element { + /* https://css-tricks.com/os-specific-fonts-css/#article-header-id-0 */ + /* https://github.com/Microsoft/vscode/blob/5dbdc8d19c8cf6dd10d558eabcc48bba962ea45f/src/vs/workbench/browser/media/style.css#L8-L24 */ + font-family: -apple-system, BlinkMacSystemFont, "Segoe WPC", "Segoe UI", + "Ubuntu", "Droid Sans", sans-serif; + font-size: 12px; + text-rendering: auto; + text-decoration: none; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; +} diff --git a/packages/core/src/browser/style/symbol-icon.css b/packages/core/src/browser/style/symbol-icon.css new file mode 100644 index 0000000..5531819 --- /dev/null +++ b/packages/core/src/browser/style/symbol-icon.css @@ -0,0 +1,258 @@ +/******************************************************************************** + * Copyright (C) 2025 TypeFox and others. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the Eclipse + * Public License v. 2.0 are satisfied: GNU General Public License, version 2 + * with the GNU Classpath Exception which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 + ********************************************************************************/ + +/* + We need to explicitly select the specific panels + Otherwise, the codicon styles are applied to all codicons in the application. + This leads to issues in the side panels, where the codicons are supposed to use the foreground color. + */ + + +:is(#theia-main-content-panel, + #theia-left-side-panel, + #theia-right-side-panel, + #theia-bottom-content-panel) .codicon.codicon-symbol-array { + color: var(--theia-symbolIcon-arrayForeground); +} + +:is(#theia-main-content-panel, + #theia-left-side-panel, + #theia-right-side-panel, + #theia-bottom-content-panel) .codicon.codicon-symbol-boolean { + color: var(--theia-symbolIcon-booleanForeground); +} + +:is(#theia-main-content-panel, + #theia-left-side-panel, + #theia-right-side-panel, + #theia-bottom-content-panel) .codicon.codicon-symbol-class { + color: var(--theia-symbolIcon-classForeground); +} + +:is(#theia-main-content-panel, + #theia-left-side-panel, + #theia-right-side-panel, + #theia-bottom-content-panel) .codicon.codicon-symbol-method { + color: var(--theia-symbolIcon-methodForeground); +} + +:is(#theia-main-content-panel, + #theia-left-side-panel, + #theia-right-side-panel, + #theia-bottom-content-panel) .codicon.codicon-symbol-color { + color: var(--theia-symbolIcon-colorForeground); +} + +:is(#theia-main-content-panel, + #theia-left-side-panel, + #theia-right-side-panel, + #theia-bottom-content-panel) .codicon.codicon-symbol-constant { + color: var(--theia-symbolIcon-constantForeground); +} + +:is(#theia-main-content-panel, + #theia-left-side-panel, + #theia-right-side-panel, + #theia-bottom-content-panel) .codicon.codicon-symbol-constructor { + color: var(--theia-symbolIcon-constructorForeground); +} + +:is(#theia-main-content-panel, + #theia-left-side-panel, + #theia-right-side-panel, + #theia-bottom-content-panel) .codicon.codicon-symbol-value, +:is(#theia-main-content-panel, + #theia-left-side-panel, + #theia-right-side-panel, + #theia-bottom-content-panel) .codicon.codicon-symbol-enum { + color: var(--theia-symbolIcon-enumeratorForeground); +} + +:is(#theia-main-content-panel, + #theia-left-side-panel, + #theia-right-side-panel, + #theia-bottom-content-panel) .codicon.codicon-symbol-enum-member { + color: var(--theia-symbolIcon-enumeratorMemberForeground); +} + +:is(#theia-main-content-panel, + #theia-left-side-panel, + #theia-right-side-panel, + #theia-bottom-content-panel) .codicon.codicon-symbol-event { + color: var(--theia-symbolIcon-eventForeground); +} + +:is(#theia-main-content-panel, + #theia-left-side-panel, + #theia-right-side-panel, + #theia-bottom-content-panel) .codicon.codicon-symbol-field { + color: var(--theia-symbolIcon-fieldForeground); +} + +:is(#theia-main-content-panel, + #theia-left-side-panel, + #theia-right-side-panel, + #theia-bottom-content-panel) .codicon.codicon-symbol-file { + color: var(--theia-symbolIcon-fileForeground); +} + +:is(#theia-main-content-panel, + #theia-left-side-panel, + #theia-right-side-panel, + #theia-bottom-content-panel) .codicon.codicon-symbol-folder { + color: var(--theia-symbolIcon-folderForeground); +} + +:is(#theia-main-content-panel, + #theia-left-side-panel, + #theia-right-side-panel, + #theia-bottom-content-panel) .codicon.codicon-symbol-function { + color: var(--theia-symbolIcon-functionForeground); +} + +:is(#theia-main-content-panel, + #theia-left-side-panel, + #theia-right-side-panel, + #theia-bottom-content-panel) .codicon.codicon-symbol-interface { + color: var(--theia-symbolIcon-interfaceForeground); +} + +:is(#theia-main-content-panel, + #theia-left-side-panel, + #theia-right-side-panel, + #theia-bottom-content-panel) .codicon.codicon-symbol-key { + color: var(--theia-symbolIcon-keyForeground); +} + +:is(#theia-main-content-panel, + #theia-left-side-panel, + #theia-right-side-panel, + #theia-bottom-content-panel) .codicon.codicon-symbol-keyword { + color: var(--theia-symbolIcon-keywordForeground); +} + +:is(#theia-main-content-panel, + #theia-left-side-panel, + #theia-right-side-panel, + #theia-bottom-content-panel) .codicon.codicon-symbol-module { + color: var(--theia-symbolIcon-moduleForeground); +} + +:is(#theia-main-content-panel, + #theia-left-side-panel, + #theia-right-side-panel, + #theia-bottom-content-panel) .codicon.codicon-symbol-namespace { + color: var(--theia-symbolIcon-namespaceForeground); +} + +:is(#theia-main-content-panel, + #theia-left-side-panel, + #theia-right-side-panel, + #theia-bottom-content-panel) .codicon.codicon-symbol-null { + color: var(--theia-symbolIcon-nullForeground); +} + +:is(#theia-main-content-panel, + #theia-left-side-panel, + #theia-right-side-panel, + #theia-bottom-content-panel) .codicon.codicon-symbol-number { + color: var(--theia-symbolIcon-numberForeground); +} + +:is(#theia-main-content-panel, + #theia-left-side-panel, + #theia-right-side-panel, + #theia-bottom-content-panel) .codicon.codicon-symbol-object { + color: var(--theia-symbolIcon-objectForeground); +} + +:is(#theia-main-content-panel, + #theia-left-side-panel, + #theia-right-side-panel, + #theia-bottom-content-panel) .codicon.codicon-symbol-operator { + color: var(--theia-symbolIcon-operatorForeground); +} + +:is(#theia-main-content-panel, + #theia-left-side-panel, + #theia-right-side-panel, + #theia-bottom-content-panel) .codicon.codicon-symbol-package { + color: var(--theia-symbolIcon-packageForeground); +} + +:is(#theia-main-content-panel, + #theia-left-side-panel, + #theia-right-side-panel, + #theia-bottom-content-panel) .codicon.codicon-symbol-property { + color: var(--theia-symbolIcon-propertyForeground); +} + +:is(#theia-main-content-panel, + #theia-left-side-panel, + #theia-right-side-panel, + #theia-bottom-content-panel) .codicon.codicon-symbol-reference { + color: var(--theia-symbolIcon-referenceForeground); +} + +:is(#theia-main-content-panel, + #theia-left-side-panel, + #theia-right-side-panel, + #theia-bottom-content-panel) .codicon.codicon-symbol-snippet { + color: var(--theia-symbolIcon-snippetForeground); +} + +:is(#theia-main-content-panel, + #theia-left-side-panel, + #theia-right-side-panel, + #theia-bottom-content-panel) .codicon.codicon-symbol-string { + color: var(--theia-symbolIcon-stringForeground); +} + + +:is(#theia-main-content-panel, + #theia-left-side-panel, + #theia-right-side-panel, + #theia-bottom-content-panel) .codicon.codicon-symbol-struct { + color: var(--theia-symbolIcon-structForeground); +} + +:is(#theia-main-content-panel, + #theia-left-side-panel, + #theia-right-side-panel, + #theia-bottom-content-panel) .codicon.codicon-symbol-text { + color: var(--theia-symbolIcon-textForeground); +} + +:is(#theia-main-content-panel, + #theia-left-side-panel, + #theia-right-side-panel, + #theia-bottom-content-panel) .codicon.codicon-symbol-type-parameter { + color: var(--theia-symbolIcon-typeParameterForeground); +} + +:is(#theia-main-content-panel, + #theia-left-side-panel, + #theia-right-side-panel, + #theia-bottom-content-panel) .codicon.codicon-symbol-unit { + color: var(--theia-symbolIcon-unitForeground); +} + +:is(#theia-main-content-panel, + #theia-left-side-panel, + #theia-right-side-panel, + #theia-bottom-content-panel) .codicon.codicon-symbol-variable { + color: var(--theia-symbolIcon-variableForeground); +} diff --git a/packages/core/src/browser/style/tabs.css b/packages/core/src/browser/style/tabs.css new file mode 100644 index 0000000..6d98e72 --- /dev/null +++ b/packages/core/src/browser/style/tabs.css @@ -0,0 +1,573 @@ +/*----------------------------------------------------------------------------- +| Variables +|----------------------------------------------------------------------------*/ + +:root { + /* These need to be root because tabs get attached to the body during dragging. */ + --theia-private-horizontal-tab-height: 35px; + --theia-horizontal-toolbar-height: var(--theia-private-horizontal-tab-height); + --theia-private-horizontal-tab-scrollbar-rail-height: 7px; + --theia-private-horizontal-tab-scrollbar-height: 5px; + --theia-tabbar-toolbar-z-index: 1001; + --theia-toolbar-active-transform-scale: 1.272019649; + --theia-dragover-tab-border-width: 2px; +} + +/*----------------------------------------------------------------------------- +| General tab bar style +|----------------------------------------------------------------------------*/ + +.lm-TabBar { + font-size: var(--theia-ui-font-size1); +} + +.lm-TabBar[data-orientation="horizontal"] { + min-height: var(--theia-horizontal-toolbar-height); +} + +.lm-TabBar .lm-TabBar-content { + cursor: pointer; +} + +.lm-TabBar[data-orientation="horizontal"] .lm-TabBar-tab { + flex: none; + height: var(--theia-horizontal-toolbar-height); + line-height: var(--theia-horizontal-toolbar-height); + min-width: 35px; + padding: 0px 8px; + align-items: center; + overflow: hidden; +} + +.lm-TabBar[data-orientation="vertical"] .lm-TabBar-tab { + border-top: var(--theia-dragover-tab-border-width) solid transparent !important; + border-bottom: var(--theia-dragover-tab-border-width) solid transparent !important; +} + +.lm-TabBar[data-orientation="vertical"] .lm-TabBar-tab.drop-target-top { + border-top-color: var(--theia-activityBar-activeBorder) !important; +} + +.lm-TabBar[data-orientation="vertical"] .lm-TabBar-tab.drop-target-bottom { + border-bottom-color: var(--theia-activityBar-activeBorder) !important; +} + +.lm-TabBar[data-orientation="horizontal"] .lm-TabBar-tab .theia-tab-icon-label, +.lm-TabBar-tab.lm-mod-drag-image .theia-tab-icon-label { + display: flex; + line-height: var(--theia-content-line-height); + align-items: center; +} + +/*----------------------------------------------------------------------------- +| Tabs in the center area (main and bottom) +|----------------------------------------------------------------------------*/ + +#theia-main-content-panel, +#theia-main-content-panel .lm-Widget.lm-DockPanel-widget { + background: var(--theia-editor-background); +} + +#theia-main-content-panel .lm-DockPanel-handle[data-orientation="horizontal"] { + border-left: var(--theia-border-width) solid var(--theia-editorGroup-border); +} + +#theia-main-content-panel .lm-DockPanel-handle[data-orientation="vertical"]+.lm-TabBar { + border-top: var(--theia-border-width) solid var(--theia-editorGroup-border); +} + +#theia-main-content-panel .lm-TabBar .lm-TabBar-tab { + border-right: 1px solid var(--theia-tab-border); + border-top: 1px solid transparent; + border-bottom: 1px solid transparent; + background: var(--theia-tab-inactiveBackground); + color: var(--theia-tab-inactiveForeground); +} + +#theia-main-content-panel .lm-TabBar:not(.theia-tabBar-active) .lm-TabBar-tab { + color: var(--theia-tab-unfocusedInactiveForeground); +} + +.lm-TabBar.theia-app-centers { + background: var(--theia-editorGroupHeader-tabsBackground); +} + +.lm-TabBar.theia-app-centers::after { + content: ""; + position: absolute; + bottom: 0; + left: 0; + pointer-events: none; + background-color: var(--theia-editorGroupHeader-tabsBorder); + width: 100%; + height: 1px; +} + +.lm-TabBar.theia-app-centers .lm-TabBar-tabIcon, +.lm-TabBar.theia-app-centers .lm-TabBar-tabLabel, +.lm-TabBar.theia-app-centers .lm-TabBar-tabLabelDetails, +.lm-TabBar.theia-app-centers .lm-TabBar-tabCloseIcon { + display: inline-block; +} + +.lm-TabBar.theia-app-centers .lm-TabBar-tabLabelDetails { + margin-left: 5px; + color: var(--theia-descriptionForeground); + flex: 1 1 auto; + overflow: hidden; + white-space: pre; +} + +.lm-TabBar-tail { + padding-left: 5px; + text-align: center; + justify-content: center; +} + +.lm-TabBar.theia-app-centers .lm-TabBar-tabLabelWrapper { + display: flex; +} + +.lm-TabBar-tab-secondary-label { + color: var(--theia-settings-headerForeground); + cursor: pointer; + font-size: var(--theia-ui-font-size0); + margin-left: 5px; + text-decoration-line: underline; + + -webkit-appearance: none; + -moz-appearance: none; + background-image: linear-gradient(45deg, + transparent 50%, + var(--theia-icon-foreground) 50%), + linear-gradient(135deg, var(--theia-icon-foreground) 50%, transparent 50%); + background-position: calc(100% - 6px) 8px, calc(100% - 2px) 8px, 100% 0; + background-size: 4px 5px; + background-repeat: no-repeat; + padding: 2px 14px 0 0; +} + +.lm-TabBar .lm-TabBar-tabIcon, +.lm-TabBar-tab.lm-mod-drag-image .lm-TabBar-tabIcon { + width: 15px; + line-height: 1.7; + font-size: 12px; + text-align: center; + background-repeat: no-repeat; +} + +/* common icons */ +.lm-TabBar.theia-app-centers .lm-TabBar-tabIcon, +.lm-TabBar-tab.lm-mod-drag-image .lm-TabBar-tabIcon { + min-height: 14px; + background-size: 13px; + background-position-y: 3px; + background: var(--theia-icon-foreground); + -webkit-mask-repeat: no-repeat; + -webkit-mask-size: auto 13px; + mask-repeat: no-repeat; + mask-size: auto 13px; + padding-right: 8px; +} + +.lm-TabBar.theia-app-centers .lm-TabBar-tabIcon[class*="plugin-icon-"], +.lm-TabBar-tab.lm-mod-drag-image .lm-TabBar-tabIcon[class*="plugin-icon-"] { + background: none; + height: var(--theia-icon-size); +} + +.lm-TabBar.theia-app-centers .lm-TabBar-tabIcon[class*="plugin-icon-"]::before, +.lm-TabBar-tab.lm-mod-drag-image .lm-TabBar-tabIcon[class*="plugin-icon-"]::before { + display: inline-block; +} + +/* codicons */ +.lm-TabBar.theia-app-centers .lm-TabBar-tabIcon.codicon, +.lm-TabBar-tab.lm-mod-drag-image .lm-TabBar-tabIcon.codicon { + background: none; +} + +.lm-TabBar-tabLock:after { + content: "\ebe7"; + opacity: 0.75; + margin-left: 4px; + color: inherit; + font-family: codicon; + font-size: 16px; + font-weight: normal; + display: inline-block; + vertical-align: top; +} + +/* file icons */ +.lm-TabBar[data-orientation="horizontal"] .lm-TabBar-tabIcon.file-icon, +.lm-TabBar-tab.lm-mod-drag-image .lm-TabBar-tabIcon.file-icon { + background: none; + padding-bottom: 0px; + min-height: 20px; +} + +.lm-TabBar[data-orientation="horizontal"] .lm-TabBar-tabIcon.fa, +.lm-TabBar-tab.lm-mod-drag-image .lm-TabBar-tabIcon.fa { + background: none; + min-height: 0; + height: inherit; +} + +.lm-TabBar[data-orientation="vertical"] .lm-TabBar-tab.lm-mod-invisible { + visibility: hidden; +} + +.lm-TabBar.theia-app-centers .lm-TabBar-tab.lm-mod-closable>.lm-TabBar-tabCloseIcon, +.lm-TabBar.theia-app-centers .lm-TabBar-tab.theia-mod-pinned>.lm-TabBar-tabCloseIcon { + padding: 2px; + margin-left: 4px; + height: var(--theia-icon-size); + width: var(--theia-icon-size); + font: normal normal normal 16px/1 codicon; + display: inline-block; + text-decoration: none; + text-rendering: auto; + text-align: center; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + user-select: none; + -webkit-user-select: none; + -ms-user-select: none; +} + +.lm-TabBar.theia-app-centers .lm-TabBar-tab.lm-mod-closable.closeIcon-start > .lm-TabBar-tabCloseIcon, +.lm-TabBar.theia-app-centers .lm-TabBar-tab.theia-mod-pinned.closeIcon-start > .lm-TabBar-tabCloseIcon { + margin-left: inherit; + margin-right: 4px; +} + +.lm-TabBar.theia-app-centers.dynamic-tabs .lm-TabBar-tab.lm-mod-closable>.lm-TabBar-tabCloseIcon, +.lm-TabBar.theia-app-centers.dynamic-tabs .lm-TabBar-tab.theia-mod-pinned>.lm-TabBar-tabCloseIcon { + /* hide close icon for dynamic tabs strategy*/ + display: none; +} + +.lm-TabBar.theia-app-centers .lm-TabBar-tab.lm-mod-current>.lm-TabBar-tabCloseIcon, +.lm-TabBar.theia-app-centers .lm-TabBar-tab:hover.lm-mod-closable>.lm-TabBar-tabCloseIcon, +.lm-TabBar.theia-app-centers .lm-TabBar-tab:hover.theia-mod-pinned>.lm-TabBar-tabCloseIcon { + display: inline-block; +} + +.lm-TabBar.theia-app-centers .lm-TabBar-tab.lm-mod-closable>.lm-TabBar-tabCloseIcon:hover { + border-radius: 5px; + background-color: rgba(50%, 50%, 50%, 0.2); +} + +.lm-TabBar.theia-app-centers .lm-TabBar-tab.lm-mod-closable:not(.closeIcon-start), +.lm-TabBar.theia-app-centers .lm-TabBar-tab.theia-mod-pinned:not(.closeIcon-start) { + padding-right: 4px; +} + +.lm-TabBar.theia-app-centers .lm-TabBar-tab.lm-mod-closable.closeIcon-start, +.lm-TabBar.theia-app-centers .lm-TabBar-tab.theia-mod-pinned.closeIcon-start { + padding-left: 4px; +} + +.lm-TabBar.theia-app-centers .lm-TabBar-tab.lm-mod-closable:not(.theia-mod-dirty):hover>.lm-TabBar-tabCloseIcon:before, +.lm-TabBar.theia-app-centers .lm-TabBar-tab.lm-mod-closable:not(.theia-mod-dirty).lm-TabBar-tab.lm-mod-current>.lm-TabBar-tabCloseIcon:before, +.lm-TabBar.theia-app-centers .lm-TabBar-tab.lm-mod-closable.theia-mod-dirty>.lm-TabBar-tabCloseIcon:hover:before { + content: "\ea76"; +} + +.lm-TabBar.theia-app-centers .lm-TabBar-tab.lm-mod-closable.theia-mod-dirty>.lm-TabBar-tabCloseIcon:before { + content: "\ea71"; +} + +.lm-TabBar.theia-app-centers .lm-TabBar-tab.theia-mod-pinned>.lm-TabBar-tabCloseIcon:before { + content: "\eba0"; +} + +.lm-TabBar.theia-app-centers .lm-TabBar-tab.theia-mod-pinned.theia-mod-dirty>.lm-TabBar-tabCloseIcon:before { + content: "\ebb2"; +} + +.lm-TabBar-tabIcon.no-icon { + display: none !important; +} + +.theia-badge-decorator-sidebar { + background-color: var(--theia-activityBarBadge-background); + border-radius: 20px; + color: var(--theia-activityBarBadge-foreground); + font-size: calc(var(--theia-ui-font-size0) * 0.85); + font-weight: 600; + height: var(--theia-notification-count-height); + width: var(--theia-notification-count-width); + padding: calc(var(--theia-ui-padding) / 6); + line-height: calc(var(--theia-content-line-height) * 0.7); + position: absolute; + top: calc(var(--theia-ui-padding) * 4); + right: calc(var(--theia-ui-padding) * 1.33); + text-align: center; +} + +.lm-TabBar .theia-badge-decorator-horizontal { + background-color: var(--theia-badge-background); + border-radius: 20px; + box-sizing: border-box; + color: var(--theia-activityBarBadge-foreground); + font-size: calc(var(--theia-ui-font-size0) * 0.8); + font-weight: 400; + height: var(--theia-notification-count-height); + width: var(--theia-notification-count-width); + padding: calc(var(--theia-ui-padding) / 6); + line-height: calc(var(--theia-content-line-height) * 0.61); + margin-left: var(--theia-ui-padding); + text-align: center; +} + +/*----------------------------------------------------------------------------- +| Perfect scrollbar +|----------------------------------------------------------------------------*/ + +.lm-TabBar[data-orientation="horizontal"] .lm-TabBar-content-container>.ps__rail-x { + height: var(--theia-private-horizontal-tab-scrollbar-rail-height) !important; + background: transparent !important; + z-index: 1000; +} + +.lm-TabBar[data-orientation="horizontal"] .lm-TabBar-content-container>.ps__rail-x>.ps__thumb-x { + height: var(--theia-private-horizontal-tab-scrollbar-height) !important; + bottom: calc((var(--theia-private-horizontal-tab-scrollbar-rail-height) - var(--theia-private-horizontal-tab-scrollbar-height)) / 2); +} + +.lm-TabBar[data-orientation="horizontal"] .lm-TabBar-content-container>.ps__rail-x:hover, +.lm-TabBar[data-orientation="horizontal"] .lm-TabBar-content-container>.ps__rail-x:focus { + height: var(--theia-private-horizontal-tab-scrollbar-rail-height) !important; +} + +.lm-TabBar[data-orientation="vertical"] .lm-TabBar-content-container>.ps__rail-y { + width: var(--theia-private-horizontal-tab-scrollbar-rail-height); + z-index: 1000; +} + +.lm-TabBar[data-orientation="vertical"] .lm-TabBar-content-container>.ps__rail-y>.ps__thumb-y { + width: var(--theia-private-horizontal-tab-scrollbar-height) !important; + right: calc((var(--theia-private-horizontal-tab-scrollbar-rail-height) - var(--theia-private-horizontal-tab-scrollbar-height)) / 2); +} + +.lm-TabBar[data-orientation="vertical"] .lm-TabBar-content-container { + display: block; +} + +/*----------------------------------------------------------------------------- +| Dragged tabs +|----------------------------------------------------------------------------*/ + +.lm-TabBar-tab.lm-mod-drag-image { + transform: translateX(-40%) translateY(-58%); + opacity: 0.8; + line-height: var(--theia-private-horizontal-tab-height); + height: var(--theia-private-horizontal-tab-height); + min-height: var(--theia-private-horizontal-tab-height); + padding: 0px 10px; + font-size: var(--theia-ui-font-size1); + background: var(--theia-editorGroupHeader-tabsBackground); + border: var(--theia-border-width) solid var(--theia-contrastBorder); + box-shadow: 1px 1px 2px var(--theia-widget-shadow); + display: flex; + align-items: center; +} + +/*----------------------------------------------------------------------------- +| Tab-bar toolbar +|----------------------------------------------------------------------------*/ + +.lm-TabBar-toolbar { + z-index: var(--theia-tabbar-toolbar-z-index); + /* Due to the scrollbar (`z-index: 1000;`) it has a greater `z-index`. */ + display: flex; + flex-direction: row-reverse; + align-items: center; + justify-content: center; + padding-inline: var(--theia-ui-padding); + gap: 2px; +} + +.lm-TabBar-content-container { + display: flex; + flex: 1; + position: relative; + /* This is necessary for perfect-scrollbar */ +} + +.lm-TabBar-toolbar .item { + opacity: var(--theia-mod-disabled-opacity); + cursor: default; + display: flex; + flex-direction: row; + column-gap: 0px; + align-items: center; +} + +.lm-TabBar-toolbar .item>div { + height: 100%; +} + +.lm-TabBar-toolbar .item.enabled { + opacity: 1; + cursor: pointer; +} + +.lm-TabBar-toolbar > :not(.item.enabled) > .action-label { + background: transparent; + cursor: default; +} + +.lm-TabBar-toolbar .item.toggled { + border: var(--theia-border-width) var(--theia-inputOption-activeBorder) solid; + background-color: var(--theia-inputOption-activeBackground); +} + +.lm-TabBar-toolbar .item>div { + min-width: var(--theia-icon-size); + height: var(--theia-icon-size); + line-height: var(--theia-icon-size); + background-repeat: no-repeat; +} + +.lm-TabBar-toolbar .item>div.no-icon { + /* Make room for a text label instead of an icon. */ + width: 100%; +} + +.lm-TabBar-toolbar .item .collapse-all { + background: var(--theia-icon-collapse-all) no-repeat; +} + +.lm-TabBar-toolbar .item .close { + background: var(--theia-icon-collapse-all) no-repeat; +} + +.lm-TabBar-toolbar .item .clear-all { + background: var(--theia-icon-clear) no-repeat; +} + +.lm-TabBar-toolbar .item .refresh { + background: var(--theia-icon-refresh) no-repeat; +} + +.lm-TabBar-toolbar .item .cancel { + background: var(--theia-icon-close) no-repeat; +} + +/** + * The chevron for the pop-up menu indication is shrunk and + * stuffed in the bottom-right corner. + */ +.lm-TabBar-toolbar .item.menu .chevron { + font-size: 8px; + vertical-align: bottom; +} + +#theia-main-content-panel .lm-TabBar:not(.theia-tabBar-active) .lm-TabBar-toolbar { + display: none; +} + +.theia-tabBar-breadcrumb-row { + width: 100%; +} + +.lm-TabBar.theia-tabBar-multirow[data-orientation="horizontal"] { + min-height: calc(var(--theia-breadcrumbs-height) + var(--theia-horizontal-toolbar-height)); + flex-direction: column; +} + +.lm-TabBar[data-orientation="horizontal"] .theia-tabBar-tab-row { + display: flex; + flex-flow: row nowrap; + width: 100%; +} + +.lm-TabBar[data-orientation="vertical"] .theia-tabBar-tab-row { + display: flex; + flex-flow: column nowrap; + height: 100%; +} + +.lm-TabBar[data-orientation="horizontal"] .lm-TabBar-content { + flex-direction: row; + min-height: var(--theia-horizontal-toolbar-height); +} + +.lm-TabBar[data-orientation="vertical"] .lm-TabBar-content { + flex-direction: column; +} + +.lm-TabBar.theia-app-centers[data-orientation="horizontal"].dynamic-tabs .lm-TabBar-tabLabel { + /* fade out text with dynamic tabs strategy */ + mask-image: linear-gradient(to left, + rgba(0, 0, 0, 0.3), + rgba(0, 0, 0, 1) 15px); + -webkit-mask-image: linear-gradient(to left, + rgba(0, 0, 0, 0.3), + rgba(0, 0, 0, 1) 15px); + flex: 1; +} + +.lm-TabBar[data-orientation="horizontal"] .lm-TabBar-tab .theia-tab-icon-label { + flex: 1; + overflow: hidden; +} + +.theia-horizontal-tabBar-hover-div { + margin: 0px 4px; +} + +.enhanced-preview-container { + margin: 4px 4px; + pointer-events: none; + background: var(--theia-editor-background); + position: relative; + overflow: hidden; +} + +.enhanced-preview { + transform-origin: top left; +} + +.theia-horizontal-tabBar-hover-title { + font-weight: bolder; + max-width: var(--theia-hover-preview-width); + word-wrap: break-word; + white-space: pre-wrap !important; + font-size: medium; + margin: 0px 0px; +} + +.theia-horizontal-tabBar-hover-caption { + font-size: small; + max-width: var(--theia-hover-preview-width); + word-wrap: break-word; + white-space: pre-wrap !important; + margin: 0px 0px; + margin-top: 4px; +} + +/*----------------------------------------------------------------------------- +| Open tabs dropdown +|----------------------------------------------------------------------------*/ +.theia-tabBar-open-tabs>.theia-select-component .theia-select-component-label { + display: none; +} + +.theia-tabBar-open-tabs>.theia-select-component { + min-width: auto; + height: 100%; +} + +.theia-tabBar-open-tabs { + flex: 0 0 auto; + display: flex; + align-items: center; +} + +.theia-tabBar-open-tabs.lm-mod-hidden { + display: none; +} diff --git a/packages/core/src/browser/style/tooltip.css b/packages/core/src/browser/style/tooltip.css new file mode 100644 index 0000000..a5ff007 --- /dev/null +++ b/packages/core/src/browser/style/tooltip.css @@ -0,0 +1,29 @@ +/******************************************************************************** + * Copyright (C) 2021 Arm and others. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the Eclipse + * Public License v. 2.0 are satisfied: GNU General Public License, version 2 + * with the GNU Classpath Exception which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 + ********************************************************************************/ + +.theia-tooltip { + color: var(--theia-editorHoverWidget-foreground) !important; + background: var(--theia-editorHoverWidget-background) !important; + border: 1px solid !important; + border-color: var(--theia-editorHoverWidget-border) !important; + white-space: pre-wrap !important; +} + +/* Hide tooltip arrow */ +.theia-tooltip::before, +.theia-tooltip::after { + border: none !important; +} diff --git a/packages/core/src/browser/style/tree-decorators.css b/packages/core/src/browser/style/tree-decorators.css new file mode 100644 index 0000000..60eb9ca --- /dev/null +++ b/packages/core/src/browser/style/tree-decorators.css @@ -0,0 +1,81 @@ +/******************************************************************************** + * Copyright (C) 2018 TypeFox and others. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the Eclipse + * Public License v. 2.0 are satisfied: GNU General Public License, version 2 + * with the GNU Classpath Exception which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 + ********************************************************************************/ + +.theia-caption-prefix { + white-space: pre; + padding-right: 2px; +} + +.theia-caption-suffix { + white-space: pre; + padding: 0px 2px 0px 2px; +} + +.theia-caption-suffix-tail { + min-width: 1rem; + text-align: center; + font-size: var(--theia-ui-font-size0); +} + +.theia-icon-wrapper { + top: 0px !important; + position: relative; + display: inline-flex; +} + +.theia-decorator-size { + transform: scale(0.7); + text-align: center; + height: 100%; + width: 100%; +} + +.theia-decorator-sidebar-size { + height: 100%; + text-align: center; + transform: scale(1.2); + width: 100%; +} + +.theia-top-right { + position: absolute; + bottom: 40%; + left: 25%; +} + +.theia-bottom-right { + position: absolute; + top: 40%; + left: 25%; +} + +.theia-bottom-right-sidebar { + position: absolute; + top: 80%; + left: 50%; +} + +.theia-bottom-left { + position: absolute; + top: 40%; + right: 25%; +} + +.theia-top-left { + position: absolute; + bottom: 40%; + right: 25%; +} diff --git a/packages/core/src/browser/style/tree.css b/packages/core/src/browser/style/tree.css new file mode 100644 index 0000000..9ef336b --- /dev/null +++ b/packages/core/src/browser/style/tree.css @@ -0,0 +1,236 @@ +/******************************************************************************** + * Copyright (C) 2017, 2018 TypeFox and others. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the Eclipse + * Public License v. 2.0 are satisfied: GNU General Public License, version 2 + * with the GNU Classpath Exception which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 + ********************************************************************************/ + +:root { + --theia-welcomeView-horizontal-padding: 20px; + --theia-welcomeView-elements-margin: 13px; + --theia-welcomeView-button-maxWidth: 260px; +} + +.theia-Tree { + overflow: hidden; + font-size: var(--theia-ui-font-size1); + max-height: calc(100% - var(--theia-border-width)); + position: relative; +} + +.theia-Tree:focus .theia-TreeContainer.empty::before, +.theia-Tree:focus .theia-TreeContainer.focused::before { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + pointer-events: none; + z-index: 10; + content: ""; + outline-width: 1px; + outline-style: solid; + outline-offset: -1px; + opacity: 1 !important; + outline-color: var(--theia-focusBorder); +} + +.theia-Tree:focus, +.theia-TreeContainer .ReactVirtualized__List:focus { + outline: 0; + box-shadow: none; + border: none; +} + +.theia-TreeContainer .ReactVirtualized__Grid__innerScrollContainer { + margin-bottom: calc(var(--theia-ui-padding) * 3); +} + +.theia-TreeContainer { + height: 100%; +} + +.theia-TreeNode { + line-height: var(--theia-content-line-height); + display: flex; +} + +.theia-TreeNode:hover { + background: var(--theia-list-hoverBackground); + color: var(--theia-list-hoverForeground); + cursor: pointer; +} + +.theia-TreeNodeContent { + display: flex; + align-items: center; + width: 100%; + padding-right: var(--theia-ui-padding); + box-sizing: border-box; +} + +.theia-ExpansionToggle { + display: flex; + justify-content: center; + padding-left: calc(var(--theia-ui-padding) / 3); + padding-right: calc(var(--theia-ui-padding) / 3); + min-width: var(--theia-icon-size); + min-height: var(--theia-icon-size); +} + +.theia-ExpansionToggle.theia-mod-busy { + animation: theia-spin 1.25s linear infinite; +} + +.theia-ExpansionToggle:not(.theia-mod-busy):hover { + cursor: pointer; +} + +.theia-ExpansionToggle.theia-mod-collapsed:not(.theia-mod-busy) { + transform: rotate(-90deg); +} + +.theia-Tree:focus-within .theia-TreeNode.theia-mod-selected { + background: var(--theia-list-activeSelectionBackground); + color: var(--theia-list-activeSelectionForeground) !important; + outline: var(--theia-focusBorder) solid 1px; + outline-offset: -1px; +} + +.theia-Tree:focus-within .theia-TreeNode.theia-mod-selected .theia-TreeNodeTail, +.theia-Tree:focus-within + .theia-TreeNode.theia-mod-selected + .theia-caption-suffix, +.theia-Tree:focus-within .theia-TreeNode.theia-mod-selected .theia-TreeNodeInfo, +.theia-Tree:focus-within + .theia-TreeNode.theia-mod-selected + .theia-TreeNodeSegment { + color: var(--theia-list-activeSelectionForeground) !important; +} + +.theia-Tree:focus-within .theia-TreeNode.theia-mod-focus, +.theia-Tree + .ReactVirtualized__List:focus-within + .theia-TreeNode.theia-mod-focus { + outline-width: 1px; + outline-style: solid; + outline-offset: -1px; + outline-color: var(--theia-focusBorder); +} + +.theia-TreeNodeInfo { + color: var(--theia-foreground); + opacity: 0.7; +} + +.theia-Tree .theia-TreeNode.theia-mod-selected { + background: var(--theia-list-inactiveSelectionBackground); + color: var(--theia-list-inactiveSelectionForeground); +} + +.theia-TreeNode.theia-mod-not-selectable { + color: var(--theia-descriptionForeground); +} + +.theia-TreeNode.theia-mod-not-selectable:hover { + background: none; + cursor: default; +} + +.theia-TreeNodeSegment { + align-items: center; + flex-grow: 0; + user-select: none; + white-space: pre; +} + +.theia-TreeNodeSegment.flex { + display: flex; +} + +.theia-TreeNodeSegmentGrow { + flex-grow: 1 !important; + overflow: hidden; + text-overflow: ellipsis; + white-space: pre; +} + +.theia-TreeNodeTail { + min-width: 1rem; + text-align: center; + justify-content: center; +} + +.open-editors-node-row .theia-TreeNode .theia-TreeNodeContent .noWrapInfo > * { + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + display: inline; +} + +.theia-TreeNodeSegment mark { + background-color: var(--theia-list-filterMatchBackground); + color: var(--theia-list-inactiveSelectionForeground); +} + +.theia-tree-source-node-placeholder { + text-align: center; + font-style: italic; + opacity: var(--theia-mod-disabled-opacity); +} + +.theia-tree-node-indent { + position: absolute; + height: var(--theia-content-line-height); + border-right: var(--theia-border-width) solid transparent; + pointer-events: none; +} + +.theia-tree-node-indent.always, +.theia-TreeContainer:hover .theia-tree-node-indent.hover { + border-color: var(--theia-tree-inactiveIndentGuidesStroke); +} + +.theia-tree-node-indent.active { + border-color: var(--theia-tree-indentGuidesStroke); +} + +.theia-TreeContainer .theia-WelcomeView { + padding-top: var(--theia-ui-padding); + padding-right: var(--theia-welcomeView-horizontal-padding); + padding-left: var(--theia-welcomeView-horizontal-padding); +} + +.theia-TreeContainer .theia-WelcomeView > * { + margin: var(--theia-welcomeView-elements-margin) 0; +} + +.theia-TreeContainer .theia-WelcomeView .theia-WelcomeViewButtonWrapper { + display: flex; + padding: 0 var(--theia-ui-padding); +} + +.theia-TreeContainer .theia-WelcomeView .theia-WelcomeViewButton { + width: 100%; + max-width: var(--theia-welcomeView-button-maxWidth); + margin: auto; +} + +.theia-TreeContainer .theia-WelcomeView .theia-WelcomeViewCommandLink { + cursor: pointer; +} + +.theia-TreeContainer .theia-WelcomeView .theia-WelcomeViewCommandLink.disabled { + pointer-events: none; + cursor: default; + opacity: var(--theia-mod-disabled-opacity); +} diff --git a/packages/core/src/browser/style/view-container.css b/packages/core/src/browser/style/view-container.css new file mode 100644 index 0000000..6d698df --- /dev/null +++ b/packages/core/src/browser/style/view-container.css @@ -0,0 +1,170 @@ +/******************************************************************************** + * Copyright (C) 2018 TypeFox and others. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the Eclipse + * Public License v. 2.0 are satisfied: GNU General Public License, version 2 + * with the GNU Classpath Exception which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 + ********************************************************************************/ + +:root { + --theia-view-container-title-height: 24px; + --theia-view-container-content-height: calc(100% - var(--theia-view-container-title-height)); +} + +.theia-view-container { + height: 100%; + display: flex; + flex-direction: column; +} + +.theia-view-container>.lm-SplitPanel { + height: 100%; + width: 100%; +} + +.theia-view-container>.lm-SplitPanel>.lm-SplitPanel-child { + min-width: 50px; + min-height: var(--theia-content-line-height); +} + +.theia-view-container>.lm-SplitPanel>.lm-SplitPanel-handle::after { + min-height: 2px; + min-width: 2px; +} + +.lm-SplitPanel>.lm-SplitPanel-handle:hover::after { + background-color: var(--theia-sash-hoverBorder); + transition-delay: var(--theia-sash-hoverDelay); +} + +.lm-SplitPanel>.lm-SplitPanel-handle:active::after { + background-color: var(--theia-sash-activeBorder); + transition-delay: 0s !important; +} + +.lm-SplitPanel[data-orientation="horizontal"]>.lm-SplitPanel-handle::after { + min-width: var(--theia-sash-width); +} + +.lm-SplitPanel[data-orientation="vertical"]>.lm-SplitPanel-handle::after { + min-height: var(--theia-sash-width); +} + +.theia-view-container .part { + height: 100%; +} + +.theia-view-container-part-header { + cursor: pointer; + display: flex; + align-items: center; + background: var(--theia-sideBarSectionHeader-background); + line-height: var(--theia-view-container-title-height); + z-index: 10; + color: var(--theia-sideBarSectionHeader-foreground); + font-weight: 700; + overflow: hidden; +} + +.lm-Widget>.theia-view-container-part-header { + box-shadow: 0 1px 0 var(--theia-sideBarSectionHeader-border) inset; +} + +.lm-Widget.lm-first-visible>.theia-view-container-part-header { + box-shadow: none; +} + +.theia-view-container>.lm-SplitPanel[data-orientation="horizontal"] .part>.theia-header .theia-ExpansionToggle::before { + display: none; + padding-left: 0px; +} + +.theia-view-container>.lm-SplitPanel[data-orientation="horizontal"] .part>.theia-header .theia-ExpansionToggle { + padding-left: 0px; +} + +.theia-view-container-part-header .label { + flex: 0; + flex-basis: fit-content; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + +.theia-view-container-part-header .description { + flex: 1; + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; + padding-left: var(--theia-ui-padding); + text-transform: none; + opacity: 0.6; +} + +.theia-view-container-part-header .notification-count-container { + margin-right: var(--theia-ui-padding); +} + +.theia-view-container .part>.body { + height: var(--theia-view-container-content-height); + min-width: 50px; + min-height: 50px; + position: relative; +} + +.theia-view-container .part>.body .theia-tree-source-node-placeholder { + padding-top: 4px; + height: 100%; +} + +.theia-view-container .part:hover>.body { + display: block; +} + +.theia-view-container .part.drop-target { + background: var(--theia-list-dropBackground); + border: var(--theia-border-width) dashed var(--theia-contrastActiveBorder); + transition-property: top, left, right, bottom; + transition-duration: 150ms; + transition-timing-function: ease; +} + +.theia-view-container-drag-image { + background: var(--theia-sideBarSectionHeader-background); + color: var(--theia-sideBarSectionHeader-foreground); + line-height: var(--theia-content-line-height); + position: absolute; + z-index: 999; + text-transform: uppercase; + font-size: var(--theia-ui-font-size0); + font-weight: 500; + padding: 0 var(--theia-ui-padding) 0 var(--theia-ui-padding); +} + +.lm-TabBar-toolbar.theia-view-container-part-title { + overflow: visible !important; + padding: 0px; + padding-right: var(--theia-ui-padding); +} + +.theia-view-container-part-title { + display: none; +} + +.theia-view-container-part-title.menu-open, +.lm-Widget.part:not(.collapsed):hover .theia-view-container-part-header .theia-view-container-part-title, +.lm-Widget.part:not(.collapsed):focus-within .theia-view-container-part-header .theia-view-container-part-title { + display: flex; +} + +.no-pointer-events { + pointer-events: none; +} diff --git a/packages/core/src/browser/style/widget.css b/packages/core/src/browser/style/widget.css new file mode 100644 index 0000000..08e0254 --- /dev/null +++ b/packages/core/src/browser/style/widget.css @@ -0,0 +1,19 @@ +/******************************************************************************** + * Copyright (C) 2019 Ericsson and others. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the Eclipse + * Public License v. 2.0 are satisfied: GNU General Public License, version 2 + * with the GNU Classpath Exception which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 + ********************************************************************************/ + +.theia-widget-noInfo { + padding: calc(var(--theia-ui-padding) * 2); +} diff --git a/packages/core/src/browser/styling-service.ts b/packages/core/src/browser/styling-service.ts new file mode 100644 index 0000000..2215777 --- /dev/null +++ b/packages/core/src/browser/styling-service.ts @@ -0,0 +1,96 @@ +// ***************************************************************************** +// Copyright (C) 2022 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { inject, injectable, named } from 'inversify'; +import { ContributionProvider } from '../common/contribution-provider'; +import { Theme, ThemeType } from '../common/theme'; +import { ColorRegistry } from './color-registry'; +import { DecorationStyle } from './decoration-style'; +import { FrontendApplicationContribution } from './frontend-application-contribution'; +import { ThemeService } from './theming'; +import { SecondaryWindowHandler } from './secondary-window-handler'; + +export const StylingParticipant = Symbol('StylingParticipant'); + +export interface StylingParticipant { + registerThemeStyle(theme: ColorTheme, collector: CssStyleCollector): void +} + +export interface ColorTheme { + type: ThemeType + label: string + getColor(color: string): string | undefined; +} + +export interface CssStyleCollector { + addRule(rule: string): void; +} + +@injectable() +export class StylingService implements FrontendApplicationContribution { + protected cssElements = new Map(); + + @inject(ThemeService) + protected readonly themeService: ThemeService; + + @inject(ColorRegistry) + protected readonly colorRegistry: ColorRegistry; + + @inject(ContributionProvider) @named(StylingParticipant) + protected readonly themingParticipants: ContributionProvider; + + @inject(SecondaryWindowHandler) + protected readonly secondaryWindowHandler: SecondaryWindowHandler; + + onStart(): void { + this.registerWindow(window); + this.secondaryWindowHandler.onWillAddWidget(([widget, window]) => { + this.registerWindow(window); + }); + this.secondaryWindowHandler.onWillRemoveWidget(([widget, window]) => { + this.cssElements.delete(window); + }); + + this.themeService.onDidColorThemeChange(e => this.applyStylingToWindows(e.newTheme)); + } + + registerWindow(win: Window): void { + const cssElement = DecorationStyle.createStyleElement('contributedColorTheme', win.document.head); + this.cssElements.set(win, cssElement); + this.applyStyling(this.themeService.getCurrentTheme(), cssElement); + } + + protected applyStylingToWindows(theme: Theme): void { + this.cssElements.forEach(cssElement => this.applyStyling(theme, cssElement)); + } + + protected applyStyling(theme: Theme, cssElement: HTMLStyleElement): void { + const rules: string[] = []; + const colorTheme: ColorTheme = { + type: theme.type, + label: theme.label, + getColor: color => this.colorRegistry.getCurrentColor(color) + }; + const styleCollector: CssStyleCollector = { + addRule: rule => rules.push(rule) + }; + for (const themingParticipant of this.themingParticipants.getContributions()) { + themingParticipant.registerThemeStyle(colorTheme, styleCollector); + } + const fullCss = rules.join('\n'); + cssElement.innerText = fullCss; + } +} diff --git a/packages/core/src/browser/symbol-icon-color-contribution.ts b/packages/core/src/browser/symbol-icon-color-contribution.ts new file mode 100644 index 0000000..e678343 --- /dev/null +++ b/packages/core/src/browser/symbol-icon-color-contribution.ts @@ -0,0 +1,242 @@ +// ***************************************************************************** +// Copyright (C) 2025 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { injectable } from 'inversify'; +import { ColorContribution } from './color-application-contribution'; +import { ColorRegistry } from './color-registry'; + +@injectable() +export class SymbolIconColorContribution implements ColorContribution { + registerColors(colors: ColorRegistry): void { + colors.register( + { + id: 'symbolIcon.arrayForeground', + defaults: 'editor.foreground', + description: 'The foreground color for array symbols. These symbols appear in the outline, breadcrumb, and suggest widget.' + }, + { + id: 'symbolIcon.booleanForeground', + defaults: 'editor.foreground', + description: 'The foreground color for boolean symbols. These symbols appear in the outline, breadcrumb, and suggest widget.' + }, + { + id: 'symbolIcon.classForeground', + defaults: { + dark: '#EE9D28', + light: '#D67E00', + hcDark: '#EE9D28', + hcLight: '#D67E00' + }, + description: 'The foreground color for class symbols. These symbols appear in the outline, breadcrumb, and suggest widget.' + }, + { + id: 'symbolIcon.colorForeground', + defaults: 'editor.foreground', + description: 'The foreground color for color symbols. These symbols appear in the outline, breadcrumb, and suggest widget.' + }, + { + id: 'symbolIcon.constantForeground', + defaults: 'editor.foreground', + description: 'The foreground color for constant symbols. These symbols appear in the outline, breadcrumb, and suggest widget.' + }, + { + id: 'symbolIcon.constructorForeground', + defaults: { + dark: '#B180D7', + light: '#652D90', + hcDark: '#B180D7', + hcLight: '#652D90' + }, + description: 'The foreground color for constructor symbols. These symbols appear in the outline, breadcrumb, and suggest widget.' + }, + { + id: 'symbolIcon.enumeratorForeground', + defaults: { + dark: '#EE9D28', + light: '#D67E00', + hcDark: '#EE9D28', + hcLight: '#D67E00' + }, + description: 'The foreground color for enumerator symbols. These symbols appear in the outline, breadcrumb, and suggest widget.' + }, + { + id: 'symbolIcon.enumeratorMemberForeground', + defaults: { + dark: '#75BEFF', + light: '#007ACC', + hcDark: '#75BEFF', + hcLight: '#007ACC' + }, + description: 'The foreground color for enumerator member symbols. These symbols appear in the outline, breadcrumb, and suggest widget.' + }, + { + id: 'symbolIcon.eventForeground', + defaults: { + dark: '#EE9D28', + light: '#D67E00', + hcDark: '#EE9D28', + hcLight: '#D67E00' + }, + description: 'The foreground color for event symbols. These symbols appear in the outline, breadcrumb, and suggest widget.' + }, + { + id: 'symbolIcon.fieldForeground', + defaults: { + dark: '#75BEFF', + light: '#007ACC', + hcDark: '#75BEFF', + hcLight: '#007ACC' + }, + description: 'The foreground color for field symbols. These symbols appear in the outline, breadcrumb, and suggest widget.' + }, + { + id: 'symbolIcon.fileForeground', + defaults: 'editor.foreground', + description: 'The foreground color for file symbols. These symbols appear in the outline, breadcrumb, and suggest widget.' + }, + { + id: 'symbolIcon.folderForeground', + defaults: 'editor.foreground', + description: 'The foreground color for folder symbols. These symbols appear in the outline, breadcrumb, and suggest widget.' + }, + { + id: 'symbolIcon.functionForeground', + defaults: { + dark: '#B180D7', + light: '#652D90', + hcDark: '#B180D7', + hcLight: '#652D90' + }, + description: 'The foreground color for function symbols. These symbols appear in the outline, breadcrumb, and suggest widget.' + }, + { + id: 'symbolIcon.interfaceForeground', + defaults: { + dark: '#75BEFF', + light: '#007ACC', + hcDark: '#75BEFF', + hcLight: '#007ACC' + }, + description: 'The foreground color for interface symbols. These symbols appear in the outline, breadcrumb, and suggest widget.' + }, + { + id: 'symbolIcon.keyForeground', + defaults: 'editor.foreground', + description: 'The foreground color for key symbols. These symbols appear in the outline, breadcrumb, and suggest widget.' + }, + { + id: 'symbolIcon.keywordForeground', + defaults: 'editor.foreground', + description: 'The foreground color for keyword symbols. These symbols appear in the outline, breadcrumb, and suggest widget.' + }, + { + id: 'symbolIcon.methodForeground', + defaults: { + dark: '#B180D7', + light: '#652D90', + hcDark: '#B180D7', + hcLight: '#652D90' + }, + description: 'The foreground color for method symbols. These symbols appear in the outline, breadcrumb, and suggest widget.' + }, + { + id: 'symbolIcon.moduleForeground', + defaults: 'editor.foreground', + description: 'The foreground color for module symbols. These symbols appear in the outline, breadcrumb, and suggest widget.' + }, + { + id: 'symbolIcon.namespaceForeground', + defaults: 'editor.foreground', + description: 'The foreground color for namespace symbols. These symbols appear in the outline, breadcrumb, and suggest widget.' + }, + { + id: 'symbolIcon.nullForeground', + defaults: 'editor.foreground', + description: 'The foreground color for null symbols. These symbols appear in the outline, breadcrumb, and suggest widget.' + }, + { + id: 'symbolIcon.numberForeground', + defaults: 'editor.foreground', + description: 'The foreground color for number symbols. These symbols appear in the outline, breadcrumb, and suggest widget.' + }, + { + id: 'symbolIcon.objectForeground', + defaults: 'editor.foreground', + description: 'The foreground color for object symbols. These symbols appear in the outline, breadcrumb, and suggest widget.' + }, + { + id: 'symbolIcon.operatorForeground', + defaults: 'editor.foreground', + description: 'The foreground color for operator symbols. These symbols appear in the outline, breadcrumb, and suggest widget.' + }, + { + id: 'symbolIcon.packageForeground', + defaults: 'editor.foreground', + description: 'The foreground color for package symbols. These symbols appear in the outline, breadcrumb, and suggest widget.' + }, + { + id: 'symbolIcon.propertyForeground', + defaults: 'editor.foreground', + description: 'The foreground color for property symbols. These symbols appear in the outline, breadcrumb, and suggest widget.' + }, + { + id: 'symbolIcon.referenceForeground', + defaults: 'editor.foreground', + description: 'The foreground color for reference symbols. These symbols appear in the outline, breadcrumb, and suggest widget.' + }, + { + id: 'symbolIcon.snippetForeground', + defaults: 'editor.foreground', + description: 'The foreground color for snippet symbols. These symbols appear in the outline, breadcrumb, and suggest widget.' + }, + { + id: 'symbolIcon.stringForeground', + defaults: 'editor.foreground', + description: 'The foreground color for string symbols. These symbols appear in the outline, breadcrumb, and suggest widget.' + }, + { + id: 'symbolIcon.structForeground', + defaults: 'editor.foreground', + description: 'The foreground color for struct symbols. These symbols appear in the outline, breadcrumb, and suggest widget.' + }, + { + id: 'symbolIcon.textForeground', + defaults: 'editor.foreground', + description: 'The foreground color for text symbols. These symbols appear in the outline, breadcrumb, and suggest widget.' + }, + { + id: 'symbolIcon.typeParameterForeground', + defaults: 'editor.foreground', + description: 'The foreground color for type parameter symbols. These symbols appear in the outline, breadcrumb, and suggest widget.' + }, + { + id: 'symbolIcon.unitForeground', + defaults: 'editor.foreground', + description: 'The foreground color for unit symbols. These symbols appear in the outline, breadcrumb, and suggest widget.' + }, + { + id: 'symbolIcon.variableForeground', + defaults: { + dark: '#75BEFF', + light: '#007ACC', + hcDark: '#75BEFF', + hcLight: '#007ACC' + }, + description: 'The foreground color for variable symbols. These symbols appear in the outline, breadcrumb, and suggest widget.' + } + ); + } +} diff --git a/packages/core/src/browser/test/jsdom.ts b/packages/core/src/browser/test/jsdom.ts new file mode 100644 index 0000000..5488702 --- /dev/null +++ b/packages/core/src/browser/test/jsdom.ts @@ -0,0 +1,74 @@ +// ***************************************************************************** +// Copyright (C) 2018 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +// eslint-disable-next-line import/no-extraneous-dependencies +import { JSDOM } from 'jsdom'; + +/** + * ```typescript + * const disableJSDOM = enableJSDOM(); + * // actions require DOM + * disableJSDOM(); + * ``` + */ +export function enableJSDOM(): () => void { + /* eslint-disable @typescript-eslint/no-explicit-any */ + /* eslint-disable no-unused-expressions */ + + // do nothing if running in browser + try { + global; + } catch (e) { + return () => { }; + } + // no need to enable twice + if (typeof (global as any)['_disableJSDOM'] === 'function') { + return (global as any)['_disableJSDOM']; + } + const dom = new JSDOM('', { + url: 'http://localhost/' + }); + (global as any)['document'] = dom.window.document; + (global as any)['window'] = dom.window; + try { + (global as any)['navigator'] = { userAgent: 'node.js', platform: 'Mac' }; + + } catch (e) { + // node 21+ already has a navigator object + } + + const toCleanup: string[] = []; + Object.getOwnPropertyNames((dom.window as any)).forEach(property => { + if (!(property in global)) { + (global as any)[property] = (dom.window as any)[property]; + toCleanup.push(property); + } + }); + (dom.window.document as any)['queryCommandSupported'] = function (): void { }; + + const disableJSDOM = (global as any)['_disableJSDOM'] = () => { + let property: string | undefined; + while (property = toCleanup.pop()) { + delete (global as any)[property]; + } + delete (dom.window.document as any)['queryCommandSupported']; + delete (global as any)['document']; + delete (global as any)['window']; + delete (global as any)['navigator']; + delete (global as any)['_disableJSDOM']; + }; + return disableJSDOM; +} diff --git a/packages/core/src/browser/test/mock-connection-status-service.ts b/packages/core/src/browser/test/mock-connection-status-service.ts new file mode 100644 index 0000000..41a46bb --- /dev/null +++ b/packages/core/src/browser/test/mock-connection-status-service.ts @@ -0,0 +1,33 @@ +// ***************************************************************************** +// Copyright (C) 2018 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { MockLogger } from '../../common/test/mock-logger'; +import { AbstractConnectionStatusService } from '../connection-status-service'; + +export class MockConnectionStatusService extends AbstractConnectionStatusService { + + constructor() { + super({ + offlineTimeout: 10 + }); + this.logger = new MockLogger(); + } + + set alive(alive: boolean) { + this.updateStatus(alive); + } + +} diff --git a/packages/core/src/browser/test/mock-env-variables-server.ts b/packages/core/src/browser/test/mock-env-variables-server.ts new file mode 100644 index 0000000..26c30ec --- /dev/null +++ b/packages/core/src/browser/test/mock-env-variables-server.ts @@ -0,0 +1,47 @@ +// ***************************************************************************** +// Copyright (C) 2020 Red Hat, Inc. and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import URI from '../../common/uri'; +import { EnvVariablesServer, EnvVariable } from '../../common/env-variables'; + +export class MockEnvVariablesServerImpl implements EnvVariablesServer { + + constructor(protected readonly configDirUri: URI) { } + + getHomeDirUri(): Promise { + return Promise.resolve(''); + } + getDrives(): Promise { + throw new Error('Method not implemented.'); + } + + async getConfigDirUri(): Promise { + return this.configDirUri.toString(); + } + + getExecPath(): Promise { + throw new Error('Method not implemented.'); + } + + getVariables(): Promise { + throw new Error('Method not implemented.'); + } + + getValue(key: string): Promise { + throw new Error('Method not implemented.'); + } + +} diff --git a/packages/core/src/browser/test/mock-opener-service.ts b/packages/core/src/browser/test/mock-opener-service.ts new file mode 100644 index 0000000..f84f47b --- /dev/null +++ b/packages/core/src/browser/test/mock-opener-service.ts @@ -0,0 +1,34 @@ +// ***************************************************************************** +// Copyright (C) 2018 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { injectable } from 'inversify'; +import { OpenerService, OpenHandler } from '../opener-service'; + +/** + * Mock opener service implementation for testing. Never provides handlers, but always rejects :) + */ +@injectable() +export class MockOpenerService implements OpenerService { + + async getOpeners(): Promise { + return []; + } + + async getOpener(): Promise { + throw new Error('MockOpenerService is for testing only.'); + } + +} diff --git a/packages/core/src/browser/test/mock-storage-service.ts b/packages/core/src/browser/test/mock-storage-service.ts new file mode 100644 index 0000000..4fe74c2 --- /dev/null +++ b/packages/core/src/browser/test/mock-storage-service.ts @@ -0,0 +1,49 @@ +// ***************************************************************************** +// Copyright (C) 2018 Ericsson and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { StorageService } from '../storage-service'; +import { injectable } from 'inversify'; + +/** + * A StorageService suitable to use during tests. + */ +@injectable() +export class MockStorageService implements StorageService { + readonly data = new Map(); + + // eslint-disable-next-line @typescript-eslint/no-explicit-any + onSetDataCallback?: (key: string, data?: any) => void; + + // eslint-disable-next-line @typescript-eslint/no-explicit-any + onSetData(callback: (key: string, data?: any) => void): void { + this.onSetDataCallback = callback; + } + + setData(key: string, data?: T): Promise { + this.data.set(key, data); + if (this.onSetDataCallback) { + this.onSetDataCallback(key, data); + } + return Promise.resolve(); + } + + getData(key: string, defaultValue?: T): Promise { + if (this.data.has(key)) { + return Promise.resolve(this.data.get(key) as T); + } + return Promise.resolve(defaultValue); + } +} diff --git a/packages/core/src/browser/theming.ts b/packages/core/src/browser/theming.ts new file mode 100644 index 0000000..da6f176 --- /dev/null +++ b/packages/core/src/browser/theming.ts @@ -0,0 +1,207 @@ +// ***************************************************************************** +// Copyright (C) 2017 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { ApplicationProps, DefaultTheme } from '@theia/application-package/lib/application-props'; +import { inject, injectable, postConstruct } from 'inversify'; +import { Disposable } from '../common/disposable'; +import { Emitter, Event } from '../common/event'; +import { PreferenceSchemaService } from '../common/preferences/preference-schema'; +import { Deferred } from '../common/promise-util'; +import { Theme, ThemeChangeEvent } from '../common/theme'; +import { FrontendApplicationConfigProvider } from './frontend-application-config-provider'; +import debounce = require('lodash.debounce'); +import { PreferenceService } from '../common/preferences'; + +const COLOR_THEME_PREFERENCE_KEY = 'workbench.colorTheme'; +const NO_THEME = { id: 'no-theme', label: 'Not a real theme.', type: 'dark' } as const; + +@injectable() +export class ThemeService { + static readonly STORAGE_KEY = 'theme'; + + @inject(PreferenceService) protected readonly preferences: PreferenceService; + @inject(PreferenceSchemaService) protected readonly schemaProvider: PreferenceSchemaService; + + protected themes: { [id: string]: Theme } = {}; + protected activeTheme: Theme = NO_THEME; + protected readonly themeChange = new Emitter(); + protected readonly deferredInitializer = new Deferred(); + get initialized(): Promise { + return this.deferredInitializer.promise; + } + + readonly onDidColorThemeChange: Event = this.themeChange.event; + + @postConstruct() + protected init(): void { + this.register(...BuiltinThemeProvider.themes); + this.loadUserTheme(); + this.preferences.ready.then(() => { + this.validateActiveTheme(); + this.updateColorThemePreference(); + this.preferences.onPreferencesChanged(changes => { + if (COLOR_THEME_PREFERENCE_KEY in changes) { + this.validateActiveTheme(); + } + }); + }); + } + + register(...themes: Theme[]): Disposable { + for (const theme of themes) { + this.themes[theme.id] = theme; + } + this.validateActiveTheme(); + this.updateColorThemePreference(); + return Disposable.create(() => { + for (const theme of themes) { + delete this.themes[theme.id]; + if (this.activeTheme === theme) { + this.setCurrentTheme(this.defaultTheme.id, false); + } + } + this.updateColorThemePreference(); + }); + } + + protected validateActiveTheme(): void { + if (this.preferences.isReady) { + const configuredTheme = this.getConfiguredTheme(); + if (configuredTheme && configuredTheme !== this.activeTheme) { + this.setCurrentTheme(configuredTheme.id, false); + } + } + } + + protected updateColorThemePreference = debounce(() => this.doUpdateColorThemePreference(), 500); + + protected doUpdateColorThemePreference(): void { + const preference = this.schemaProvider.getSchemaProperty(COLOR_THEME_PREFERENCE_KEY); + if (preference) { + const sortedThemes = this.getThemes().sort((a, b) => a.label.localeCompare(b.label)); + this.schemaProvider.updateSchemaProperty(COLOR_THEME_PREFERENCE_KEY, { + ...preference, + enum: sortedThemes.map(e => e.id), + enumItemLabels: sortedThemes.map(e => e.label) + }); + } + } + + getThemes(): Theme[] { + const result = []; + for (const o in this.themes) { + if (this.themes.hasOwnProperty(o)) { + result.push(this.themes[o]); + } + } + return result; + } + + getTheme(themeId: string): Theme { + return this.themes[themeId] || this.defaultTheme; + } + + protected tryGetTheme(themeId: string): Theme | undefined { + return this.themes[themeId]; + } + + /** Should only be called at startup. */ + loadUserTheme(): void { + const storedThemeId = window.localStorage.getItem(ThemeService.STORAGE_KEY) ?? this.defaultTheme.id; + const theme = this.getTheme(storedThemeId); + this.setCurrentTheme(theme.id, false); + this.deferredInitializer.resolve(); + } + + /** + * @param persist If `true`, the value of the `workbench.colorTheme` preference will be set to the provided ID. + */ + setCurrentTheme(themeId: string, persist = true): void { + const newTheme = this.tryGetTheme(themeId); + const oldTheme = this.activeTheme; + if (newTheme && newTheme !== oldTheme) { + oldTheme?.deactivate?.(); + newTheme.activate?.(); + this.activeTheme = newTheme; + this.themeChange.fire({ newTheme, oldTheme }); + } + if (persist) { + this.preferences.updateValue(COLOR_THEME_PREFERENCE_KEY, themeId); + } + } + + getCurrentTheme(): Theme { + return this.activeTheme; + } + + protected getConfiguredTheme(): Theme | undefined { + const configuredId = this.preferences.get(COLOR_THEME_PREFERENCE_KEY); + return configuredId ? this.themes[configuredId.toString()] : undefined; + } + + /** + * The default theme. If that is not applicable, returns with the fallback theme. + */ + get defaultTheme(): Theme { + return this.tryGetTheme(DefaultTheme.defaultForOSTheme(FrontendApplicationConfigProvider.get().defaultTheme)) + ?? this.getTheme(DefaultTheme.defaultForOSTheme(ApplicationProps.DEFAULT.frontend.config.defaultTheme)); + } + + /** + * Resets the state to the user's default, or to the fallback theme. Also discards any persisted state in the local storage. + */ + reset(): void { + this.setCurrentTheme(this.defaultTheme.id); + } +} + +export class BuiltinThemeProvider { + + static readonly darkTheme: Theme = { + id: 'dark', + type: 'dark', + label: 'Dark (Theia)', + editorTheme: 'dark-theia' // loaded in /packages/monaco/src/browser/textmate/monaco-theme-registry.ts + }; + + static readonly lightTheme: Theme = { + id: 'light', + type: 'light', + label: 'Light (Theia)', + editorTheme: 'light-theia' // loaded in /packages/monaco/src/browser/textmate/monaco-theme-registry.ts + }; + + static readonly hcTheme: Theme = { + id: 'hc-theia', + type: 'hc', + label: 'High Contrast (Theia)', + editorTheme: 'hc-theia' // loaded in /packages/monaco/src/browser/textmate/monaco-theme-registry.ts + }; + + static readonly hcLightTheme: Theme = { + id: 'hc-theia-light', + type: 'hcLight', + label: 'High Contrast Light (Theia)', + editorTheme: 'hc-theia-light' // loaded in /packages/monaco/src/browser/textmate/monaco-theme-registry.ts + }; + + static readonly themes = [ + BuiltinThemeProvider.darkTheme, + BuiltinThemeProvider.lightTheme, + BuiltinThemeProvider.hcTheme, + BuiltinThemeProvider.hcLightTheme + ]; +} diff --git a/packages/core/src/browser/tooltip-service.tsx b/packages/core/src/browser/tooltip-service.tsx new file mode 100644 index 0000000..72595b1 --- /dev/null +++ b/packages/core/src/browser/tooltip-service.tsx @@ -0,0 +1,96 @@ +// ***************************************************************************** +// Copyright (C) 2021 Arm and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { injectable, inject, optional, postConstruct } from 'inversify'; +import * as React from 'react'; +import ReactTooltip from 'react-tooltip'; +import { ReactRenderer, RendererHost } from './widgets/react-renderer'; +import { generateUuid } from '../common/uuid'; +import { CorePreferences } from '../common/core-preferences'; + +export const TooltipService = Symbol('TooltipService'); + +export interface TooltipService { + tooltipId: string; + attachTo(host: HTMLElement): void; + update(fullRender?: boolean): void; +} + +/** + * Attributes to be added to an HTML element to enable + * rich HTML tooltip rendering + */ +export interface TooltipAttributes { + /** + * HTML to render in the tooltip. + */ + 'data-tip': string; + /** + * The ID of the tooltip renderer. Should be TOOLTIP_ID. + */ + 'data-for': string; +} + +const DELAY_PREFERENCE = 'workbench.hover.delay'; + +@injectable() +export class TooltipServiceImpl extends ReactRenderer implements TooltipService { + + @inject(CorePreferences) + protected readonly corePreferences: CorePreferences; + + public readonly tooltipId: string; + protected rendered = false; + + constructor( + @inject(RendererHost) @optional() host?: RendererHost + ) { + super(host); + this.tooltipId = generateUuid(); + } + + @postConstruct() + protected init(): void { + this.toDispose.push(this.corePreferences.onPreferenceChanged(preference => { + if (preference.preferenceName === DELAY_PREFERENCE) { + this.update(true); + } + })); + } + + public attachTo(host: HTMLElement): void { + host.appendChild(this.host); + } + + public update(fullRender = false): void { + if (fullRender || !this.rendered) { + this.render(); + this.rendered = true; + } + + ReactTooltip.rebuild(); + } + + protected override doRender(): React.ReactNode { + const hoverDelay = this.corePreferences.get(DELAY_PREFERENCE); + return ; + } + + public override dispose(): void { + this.toDispose.dispose(); + super.dispose(); + } +} diff --git a/packages/core/src/browser/tree/fuzzy-search.spec.ts b/packages/core/src/browser/tree/fuzzy-search.spec.ts new file mode 100644 index 0000000..e52a42e --- /dev/null +++ b/packages/core/src/browser/tree/fuzzy-search.spec.ts @@ -0,0 +1,99 @@ +// ***************************************************************************** +// Copyright (C) 2018 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { expect } from 'chai'; +import { FuzzySearch } from './fuzzy-search'; + +describe('fuzzy-search', () => { + + ([ + { + pattern: 'a', + items: ['alma'], + expected: [ + { + item: 'alma', + ranges: [ + { offset: 0, length: 1 } + ] + } + ] + }, + { + pattern: 'a', + items: ['körte'], + expected: [] + }, + { + pattern: 'bcn', + items: ['baconing', 'narwhal', 'a mighty bear canoe'], + expected: [ + { + item: 'baconing', + ranges: [ + { offset: 0, length: 1 }, + { offset: 2, length: 1 }, + { offset: 4, length: 1 } + ] + }, + { + item: 'a mighty bear canoe', + ranges: [ + { offset: 9, length: 1 }, + { offset: 14, length: 1 }, + { offset: 16, length: 1 } + ] + } + ] + } + ] as { + readonly pattern: string, + readonly items: string[], + readonly expected: FuzzySearch.Match[] + }[]).forEach(test => { + const { pattern, items, expected } = test; + it(`should match ${expected.length} item${expected.length === 1 ? '' : 's'} when filtering [${items.join(', ')}] with pattern: '${pattern}'`, async () => { + expectSearch(await search(pattern, items), expected); + }); + }); + + ([ + ['con', ['configs', 'base.tsconfig.json', 'tsconfig.json', 'base.nyc.json', 'CONTRIBUTING.MD']], + ['bcn', ['baconing', 'narwhal', 'a mighty bear canoe'], ['baconing', 'a mighty bear canoe']] + ] as ([string, string[], string[]])[]).forEach(test => { + const [pattern, items, expected] = test; + it(`should match the order of items after the filtering with pattern: '${pattern}'`, async () => { + expectOrder(await search(pattern, items), expected || items); + }); + }); + + function expectOrder(actual: FuzzySearch.Match[], expected: string[]): void { + expect(actual.map(result => result.item)).to.be.deep.equal(expected); + } + + function expectSearch(actual: FuzzySearch.Match[], expected: FuzzySearch.Match[]): void { + expect(actual).to.be.deep.equal(expected); + } + + async function search(pattern: string, items: string[]): Promise[]> { + return new FuzzySearch().filter({ + items, + pattern, + transform: arg => arg + }); + } + +}); diff --git a/packages/core/src/browser/tree/fuzzy-search.ts b/packages/core/src/browser/tree/fuzzy-search.ts new file mode 100644 index 0000000..00784c9 --- /dev/null +++ b/packages/core/src/browser/tree/fuzzy-search.ts @@ -0,0 +1,136 @@ +// ***************************************************************************** +// Copyright (C) 2018 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import * as fuzzy from 'fuzzy'; +import { injectable } from 'inversify'; + +@injectable() +export class FuzzySearch { + + private static readonly PRE = '\x01'; + private static readonly POST = '\x02'; + + /** + * Filters the input and returns with an array that contains all items that match the pattern. + */ + async filter(input: FuzzySearch.Input): Promise[]> { + return fuzzy.filter(input.pattern, input.items.slice(), { + pre: FuzzySearch.PRE, + post: FuzzySearch.POST, + extract: input.transform + }).sort(this.sortResults.bind(this)).map(this.mapResult.bind(this)); + } + + protected sortResults(left: fuzzy.FilterResult, right: fuzzy.FilterResult): number { + return left.index - right.index; + } + + protected mapResult(result: fuzzy.FilterResult): FuzzySearch.Match { + return { + item: result.original, + ranges: this.mapRanges(result.string) + }; + } + + protected mapRanges(input: string): ReadonlyArray { + const copy = input.split('').filter(s => s !== ''); + const ranges: FuzzySearch.Range[] = []; + const validate = (pre: number, post: number) => { + if (preIndex > postIndex || (preIndex === -1) !== (postIndex === -1)) { + throw new Error(`Error when trying to map ranges. Escaped string was: '${input}. [${[...input].join('|')}]'`); + } + }; + let preIndex = copy.indexOf(FuzzySearch.PRE); + let postIndex = copy.indexOf(FuzzySearch.POST); + validate(preIndex, postIndex); + while (preIndex !== -1 && postIndex !== -1) { + ranges.push({ + offset: preIndex, + length: postIndex - preIndex - 1 + }); + copy.splice(postIndex, 1); + copy.splice(preIndex, 1); + preIndex = copy.indexOf(FuzzySearch.PRE); + postIndex = copy.indexOf(FuzzySearch.POST); + } + if (ranges.length === 0) { + throw new Error(`Unexpected zero ranges for match-string: ${input}.`); + } + return ranges; + } + +} + +/** + * Fuzzy searcher. + */ +export namespace FuzzySearch { + + /** + * A range representing the match region. + */ + export interface Range { + + /** + * The zero based offset of the match region. + */ + readonly offset: number; + + /** + * The length of the match region. + */ + readonly length: number; + } + + /** + * A fuzzy search match. + */ + export interface Match { + + /** + * The original item. + */ + readonly item: T; + + /** + * An array of ranges representing the match regions. + */ + readonly ranges: ReadonlyArray; + } + + /** + * The fuzzy search input. + */ + export interface Input { + + /** + * The pattern to match. + */ + readonly pattern: string; + + /** + * The items to filter based on the `pattern`. + */ + readonly items: ReadonlyArray; + + /** + * Function that extracts the string from the inputs which will be used to evaluate the fuzzy matching filter. + */ + readonly transform: (item: T) => string; + + } + +} diff --git a/packages/core/src/browser/tree/index.ts b/packages/core/src/browser/tree/index.ts new file mode 100644 index 0000000..2361b0b --- /dev/null +++ b/packages/core/src/browser/tree/index.ts @@ -0,0 +1,28 @@ +// ***************************************************************************** +// Copyright (C) 2017 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +export * from './tree'; +export * from './tree-selection'; +export * from './tree-expansion'; +export * from './tree-navigation'; +export * from './tree-iterator'; +export * from './tree-model'; +export * from './tree-widget'; +export * from './tree-view-welcome-widget'; +export * from './tree-container'; +export * from './tree-decorator'; +export * from './tree-search'; +export * from './tree-compression'; diff --git a/packages/core/src/browser/tree/search-box-debounce.ts b/packages/core/src/browser/tree/search-box-debounce.ts new file mode 100644 index 0000000..5511c65 --- /dev/null +++ b/packages/core/src/browser/tree/search-box-debounce.ts @@ -0,0 +1,96 @@ +// ***************************************************************************** +// Copyright (C) 2018 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { Event, Emitter } from '../../common/event'; +import { Disposable, DisposableCollection } from '../../common/disposable'; + +import debounce = require('lodash.debounce'); + +/** + * Options for the search term debounce. + */ +export interface SearchBoxDebounceOptions { + + /** + * The delay (in milliseconds) before the debounce notifies clients about its content change. + */ + readonly delay: number; + +} + +export namespace SearchBoxDebounceOptions { + + /** + * The default debounce option. + */ + export const DEFAULT: SearchBoxDebounceOptions = { + delay: 200 + }; + +} + +/** + * It notifies the clients, once if the underlying search term has changed after a given amount of delay. + */ +export class SearchBoxDebounce implements Disposable { + + protected readonly disposables = new DisposableCollection(); + protected readonly emitter = new Emitter(); + protected readonly handler: () => void; + + protected state: string | undefined; + + constructor(protected readonly options: SearchBoxDebounceOptions) { + this.disposables.push(this.emitter); + this.handler = debounce(() => this.fireChanged(this.state), this.options.delay).bind(this); + } + + append(input: string | undefined): string | undefined { + if (input === undefined) { + this.reset(); + return undefined; + } + if (this.state === undefined) { + this.state = input; + } else { + if (input === '\b') { + this.state = this.state.length === 1 ? '' : this.state.substring(0, this.state.length - 1); + } else { + this.state += input; + } + } + this.handler(); + return this.state; + } + + get onChanged(): Event { + return this.emitter.event; + } + + dispose(): void { + this.disposables.dispose(); + } + + protected fireChanged(value: string | undefined): void { + this.emitter.fire(value); + } + + protected reset(): void { + this.state = undefined; + this.fireChanged(undefined); + } + +} diff --git a/packages/core/src/browser/tree/search-box.tsx b/packages/core/src/browser/tree/search-box.tsx new file mode 100644 index 0000000..3cfb11f --- /dev/null +++ b/packages/core/src/browser/tree/search-box.tsx @@ -0,0 +1,284 @@ +// ***************************************************************************** +// Copyright (C) 2018 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { SearchBoxDebounce, SearchBoxDebounceOptions } from '../tree/search-box-debounce'; +import { ReactWidget, codicon } from '../widgets'; +import { Emitter, Event } from '../../common/event'; +import { KeyCode, Key } from '../keyboard/keys'; +import { nls } from '../../common/nls'; +import * as React from 'react'; + +/** + * Initializer properties for the search box widget. + */ +export interface SearchBoxProps extends SearchBoxDebounceOptions { + + /** + * If `true`, the `Previous`, `Next`, and `Close` buttons will be visible. Otherwise, `false`. Defaults to `false`. + */ + readonly showButtons?: boolean; + + /** + * If `true`, `Filter` and `Close` buttons will be visible, and clicking the `Filter` button will triggers filter on the search term. Defaults to `false`. + */ + readonly showFilter?: boolean; + +} + +export namespace SearchBoxProps { + + /** + * The default search box widget option. + */ + export const DEFAULT: SearchBoxProps = SearchBoxDebounceOptions.DEFAULT; + +} + +/** + * The search box widget. + */ +export class SearchBox extends ReactWidget { + + protected static SPECIAL_KEYS = [ + Key.ESCAPE, + Key.BACKSPACE + ]; + + protected static MAX_CONTENT_LENGTH = 15; + + protected readonly nextEmitter = new Emitter(); + protected readonly previousEmitter = new Emitter(); + protected readonly closeEmitter = new Emitter(); + protected readonly textChangeEmitter = new Emitter(); + protected readonly filterToggleEmitter = new Emitter(); + protected _isFiltering: boolean = false; + + protected hasMatch: boolean = true; + protected inputText: string = ''; + + constructor(protected readonly props: SearchBoxProps, + protected readonly debounce: SearchBoxDebounce) { + + super(); + this.toDispose.pushAll([ + this.nextEmitter, + this.previousEmitter, + this.closeEmitter, + this.textChangeEmitter, + this.filterToggleEmitter, + this.debounce, + this.debounce.onChanged(data => this.fireTextChange(data)) + ]); + this.hide(); + this.addClass('theia-search-box-widget'); + this.node.setAttribute('tabIndex', '0'); + } + + get onPrevious(): Event { + return this.previousEmitter.event; + } + + get onNext(): Event { + return this.nextEmitter.event; + } + + get onClose(): Event { + return this.closeEmitter.event; + } + + get onTextChange(): Event { + return this.textChangeEmitter.event; + } + + get onFilterToggled(): Event { + return this.filterToggleEmitter.event; + } + + get isFiltering(): boolean { + return this._isFiltering; + } + + get keyCodePredicate(): KeyCode.Predicate { + return this.canHandle.bind(this); + } + + protected firePrevious(): void { + this.previousEmitter.fire(undefined); + } + + protected fireNext(): void { + this.nextEmitter.fire(undefined); + } + + protected fireClose(): void { + this.closeEmitter.fire(undefined); + } + + protected fireTextChange(input: string | undefined): void { + this.textChangeEmitter.fire(input); + } + + protected fireFilterToggle(): void { + this.doFireFilterToggle(); + } + + protected doFireFilterToggle(toggleTo: boolean = !this._isFiltering): void { + this._isFiltering = toggleTo; + this.filterToggleEmitter.fire(toggleTo); + this.update(); + } + + handle(event: KeyboardEvent): void { + event.preventDefault(); + const keyCode = KeyCode.createKeyCode(event); + if (this.canHandle(keyCode)) { + if (Key.equals(Key.ESCAPE, keyCode) || this.isCtrlBackspace(keyCode)) { + this.hide(); + } else { + this.show(); + this.handleKey(keyCode); + } + } + } + + protected handleArrowUp(): void { + this.firePrevious(); + } + + protected handleArrowDown(): void { + this.fireNext(); + } + + override onBeforeHide(): void { + this.hasMatch = true; + this.doFireFilterToggle(false); + this.inputText = ''; + this.debounce.append(undefined); + this.fireClose(); + } + + protected handleKey(keyCode: KeyCode): void { + const character = Key.equals(Key.BACKSPACE, keyCode) ? '\b' : keyCode.character; + const data = this.debounce.append(character); + if (data) { + this.inputText = data; + this.update(); + } else { + this.hide(); + } + } + + protected getTrimmedContent(data: string): string { + if (data.length > SearchBox.MAX_CONTENT_LENGTH) { + return '...' + data.substring(data.length - SearchBox.MAX_CONTENT_LENGTH); + } + return data; + } + + protected canHandle(keyCode: KeyCode | undefined): boolean { + if (keyCode === undefined) { + return false; + } + const { ctrl, alt, meta } = keyCode; + if (this.isCtrlBackspace(keyCode)) { + return true; + } + if (ctrl || alt || meta || keyCode.key === Key.SPACE) { + return false; + } + if (keyCode.character || (this.isVisible && SearchBox.SPECIAL_KEYS.some(key => Key.equals(key, keyCode)))) { + return true; + } + return false; + } + + protected isCtrlBackspace(keyCode: KeyCode): boolean { + if (keyCode.ctrl && Key.equals(Key.BACKSPACE, keyCode)) { + return true; + } + return false; + } + + updateHighlightInfo(info: SearchBox.HighlightInfo): void { + if (info.filterText && info.filterText.length > 0) { + this.hasMatch = info.matched > 0; + this.update(); + } + } + + protected render(): React.ReactNode { + const displayText = this.inputText ? this.getTrimmedContent(this.inputText) : ''; + + return ( +
    + + {displayText} + +
    + {this.props.showFilter && +
    this.fireFilterToggle()} + />} + {this.props.showButtons && + <> +
    this.hasMatch && this.firePrevious()} + /> +
    this.hasMatch && this.fireNext()} + /> + } + {(this.props.showButtons || this.props.showFilter) && +
    this.hide()} + />} +
    +
    + ); + } + +} + +export namespace SearchBox { + export interface HighlightInfo { + filterText: string | undefined, + matched: number, + total: number + } +} + +/** + * Search box factory. + */ +export const SearchBoxFactory = Symbol('SearchBoxFactory'); +export interface SearchBoxFactory { + + /** + * Creates a new search box with the given initializer properties. + */ + (props: SearchBoxProps): SearchBox; + +} diff --git a/packages/core/src/browser/tree/test/mock-selectable-tree-model.ts b/packages/core/src/browser/tree/test/mock-selectable-tree-model.ts new file mode 100644 index 0000000..7a6c263 --- /dev/null +++ b/packages/core/src/browser/tree/test/mock-selectable-tree-model.ts @@ -0,0 +1,109 @@ +// ***************************************************************************** +// Copyright (C) 2023 Ericsson and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { CompositeTreeNode } from '../tree'; +import { SelectableTreeNode } from '../tree-selection'; +import { ExpandableTreeNode } from '../tree-expansion'; + +export namespace MockSelectableTreeModel { + + export interface SelectableNode { + readonly id: string; + readonly selected: boolean; + readonly focused?: boolean; + readonly children?: SelectableNode[]; + } + + export namespace SelectableNode { + export function toTreeNode(root: SelectableNode, parent?: SelectableTreeNode & CompositeTreeNode): SelectableTreeNode { + const { id } = root; + const name = id; + const selected = false; + const focus = false; + const expanded = true; + const node: CompositeTreeNode & SelectableTreeNode = { + id, + name, + selected, + focus, + parent: parent, + children: [] + }; + const children = (root.children || []).map(child => SelectableNode.toTreeNode(child, node)); + if (children.length === 0) { + return node; + } else { + node.children = children; + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (node as any).expanded = expanded; + return node as CompositeTreeNode & SelectableTreeNode & ExpandableTreeNode; + } + } + } + + export const HIERARCHICAL_MOCK_ROOT = () => SelectableNode.toTreeNode({ + 'id': '1', + 'selected': false, + 'children': [ + { + 'id': '1.1', + 'selected': false, + 'children': [ + { + 'id': '1.1.1', + 'selected': false, + }, + { + 'id': '1.1.2', + 'selected': false, + } + ] + }, + { + 'id': '1.2', + 'selected': false, + 'children': [ + { + 'id': '1.2.1', + 'selected': false, + 'children': [ + { + 'id': '1.2.1.1', + 'selected': false, + }, + { + 'id': '1.2.1.2', + 'selected': false, + } + ] + }, + { + 'id': '1.2.2', + 'selected': false, + }, + { + 'id': '1.2.3', + 'selected': false, + } + ] + }, + { + 'id': '1.3', + 'selected': false, + } + ] + }); +} diff --git a/packages/core/src/browser/tree/test/mock-tree-model.ts b/packages/core/src/browser/tree/test/mock-tree-model.ts new file mode 100644 index 0000000..ebb04d6 --- /dev/null +++ b/packages/core/src/browser/tree/test/mock-tree-model.ts @@ -0,0 +1,136 @@ +// ***************************************************************************** +// Copyright (C) 2018 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { TreeNode, CompositeTreeNode } from '../tree'; +import { SelectableTreeNode } from '../tree-selection'; +import { ExpandableTreeNode } from '../tree-expansion'; + +export namespace MockTreeModel { + + export interface Node { + readonly id: string; + readonly children?: Node[]; + } + + export namespace Node { + export function toTreeNode(root: Node, parent?: CompositeTreeNode): TreeNode { + const { id } = root; + const name = id; + const selected = false; + const focus = false; + const expanded = true; + const node: CompositeTreeNode & SelectableTreeNode = { + id, + name, + selected, + focus, + parent: parent, + children: [] + }; + const children = (root.children || []).map(child => Node.toTreeNode(child, node)); + if (children.length === 0) { + return node; + } else { + node.children = children; + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (node as any).expanded = expanded; + return node as CompositeTreeNode & SelectableTreeNode & ExpandableTreeNode; + } + } + } + + export const HIERARCHICAL_MOCK_ROOT = () => Node.toTreeNode({ + 'id': '1', + 'children': [ + { + 'id': '1.1', + 'children': [ + { + 'id': '1.1.1' + }, + { + 'id': '1.1.2' + } + ] + }, + { + 'id': '1.2', + 'children': [ + { + 'id': '1.2.1', + 'children': [ + { + 'id': '1.2.1.1' + }, + { + 'id': '1.2.1.2' + } + ] + }, + { + 'id': '1.2.2' + }, + { + 'id': '1.2.3' + } + ] + }, + { + 'id': '1.3' + } + ] + }); + + export const FLAT_MOCK_ROOT = () => Node.toTreeNode({ + 'id': 'ROOT', + 'children': [ + { + 'id': '1' + }, + { + 'id': '2' + }, + { + 'id': '3' + }, + { + 'id': '4' + }, + { + 'id': '5' + }, + { + 'id': '6' + }, + { + 'id': '7' + }, + { + 'id': '8' + }, + { + 'id': '9' + }, + { + 'id': '10' + }, + { + 'id': '11' + } + ] + }); + +} diff --git a/packages/core/src/browser/tree/test/tree-test-container.ts b/packages/core/src/browser/tree/test/tree-test-container.ts new file mode 100644 index 0000000..37765bc --- /dev/null +++ b/packages/core/src/browser/tree/test/tree-test-container.ts @@ -0,0 +1,50 @@ +// ***************************************************************************** +// Copyright (C) 2019 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { TreeImpl, Tree } from '../tree'; +import { TreeModel, TreeModelImpl } from '../tree-model'; +import { Container } from 'inversify'; +import { TreeSelectionServiceImpl } from '../tree-selection-impl'; +import { TreeSelectionService } from '../tree-selection'; +import { TreeExpansionServiceImpl, TreeExpansionService } from '../tree-expansion'; +import { TreeNavigationService } from '../tree-navigation'; +import { TreeSearch } from '../tree-search'; +import { FuzzySearch } from '../fuzzy-search'; +import { MockLogger } from '../../../common/test/mock-logger'; +import { ILogger, bindContributionProvider } from '../../../common'; +import { LabelProviderContribution, LabelProvider } from '../../label-provider'; +import { TreeFocusService, TreeFocusServiceImpl } from '../tree-focus-service'; + +export function createTreeTestContainer(): Container { + const container = new Container({ defaultScope: 'Singleton' }); + container.bind(TreeImpl).toSelf(); + container.bind(Tree).toService(TreeImpl); + container.bind(TreeSelectionServiceImpl).toSelf(); + container.bind(TreeSelectionService).toService(TreeSelectionServiceImpl); + container.bind(TreeExpansionServiceImpl).toSelf(); + container.bind(TreeExpansionService).toService(TreeExpansionServiceImpl); + container.bind(TreeNavigationService).toSelf(); + container.bind(TreeModelImpl).toSelf(); + container.bind(TreeModel).toService(TreeModelImpl); + container.bind(TreeSearch).toSelf(); + container.bind(FuzzySearch).toSelf(); + container.bind(MockLogger).toSelf(); + container.bind(TreeFocusService).to(TreeFocusServiceImpl); + container.bind(ILogger).to(MockLogger); + bindContributionProvider(container, LabelProviderContribution); + container.bind(LabelProvider).toSelf().inSingletonScope(); + return container; +} diff --git a/packages/core/src/browser/tree/tree-compression/compressed-tree-expansion-service.ts b/packages/core/src/browser/tree/tree-compression/compressed-tree-expansion-service.ts new file mode 100644 index 0000000..fbd466d --- /dev/null +++ b/packages/core/src/browser/tree/tree-compression/compressed-tree-expansion-service.ts @@ -0,0 +1,46 @@ +// ***************************************************************************** +// Copyright (C) 2022 Ericsson and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { injectable, inject } from 'inversify'; +import { CompressionToggle, TreeCompressionService } from './tree-compression-service'; +import { ExpandableTreeNode, TreeExpansionServiceImpl } from '../tree-expansion'; + +@injectable() +export class CompressedExpansionService extends TreeExpansionServiceImpl { + @inject(CompressionToggle) protected readonly compressionToggle: CompressionToggle; + @inject(TreeCompressionService) protected readonly compressionService: TreeCompressionService; + + override async expandNode(raw: ExpandableTreeNode): Promise { + if (!this.compressionToggle.compress) { return super.expandNode(raw); } + const participants = this.compressionService.getCompressionChain(raw); + let expansionRoot; + for (const node of participants ?? [raw]) { + const next = await super.expandNode(node); + expansionRoot = expansionRoot ?? next; + } + return expansionRoot; + } + + override async collapseNode(raw: ExpandableTreeNode): Promise { + if (!this.compressionToggle.compress) { return super.collapseNode(raw); } + const participants = this.compressionService.getCompressionChain(raw); + let didCollapse = false; + for (const participant of participants ?? [raw]) { + didCollapse = await super.collapseNode(participant) || didCollapse; + } + return didCollapse; + } +} diff --git a/packages/core/src/browser/tree/tree-compression/compressed-tree-model.ts b/packages/core/src/browser/tree/tree-compression/compressed-tree-model.ts new file mode 100644 index 0000000..a2d5c36 --- /dev/null +++ b/packages/core/src/browser/tree/tree-compression/compressed-tree-model.ts @@ -0,0 +1,88 @@ +// ***************************************************************************** +// Copyright (C) 2022 Ericsson and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { injectable, inject } from 'inversify'; +import { CompressionToggle, TreeCompressionService } from './tree-compression-service'; +import { CompositeTreeNode, TreeNode } from '../tree'; +import { TreeModelImpl } from '../tree-model'; +import { SelectableTreeNode, TreeSelection } from '../tree-selection'; +import { ExpandableTreeNode } from '../tree-expansion'; +import { TopDownTreeIterator, TreeIterator } from '../tree-iterator'; + +export class TopDownCompressedTreeIterator extends TopDownTreeIterator { + protected override isCollapsed(candidate: TreeNode): boolean { + return ExpandableTreeNode.isCollapsed(candidate) && !TreeCompressionService.prototype.isCompressionParent(candidate); + } +} + +enum BackOrForward { + Forward, + Backward, +} + +@injectable() +export class CompressedTreeModel extends TreeModelImpl { + @inject(CompressionToggle) protected readonly compressionToggle: CompressionToggle; + @inject(TreeCompressionService) protected readonly compressionService: TreeCompressionService; + + protected selectAdjacentRow( + direction: BackOrForward, + type: TreeSelection.SelectionType = TreeSelection.SelectionType.DEFAULT, + startingPoint: Readonly | undefined = this.getFocusedNode() + ): void { + if (!startingPoint && this.root) { + this.selectAdjacentRow(BackOrForward.Forward, type, this.root); + } + if (this.compressionService.isCompressionParticipant(startingPoint)) { + const chain = this.compressionService.getCompressionChain(startingPoint); + startingPoint = (direction === BackOrForward.Backward ? chain?.head() : chain?.tail()) ?? startingPoint; + } + + const iterator = direction === BackOrForward.Backward ? this.createBackwardIterator(startingPoint) : this.createIterator(startingPoint); + + const test = (candidate: TreeNode): candidate is SelectableTreeNode => SelectableTreeNode.isVisible(candidate) + && (this.compressionService.isCompressionHead(candidate) || !this.compressionService.isCompressionParticipant(candidate)); + + const rowRoot = iterator && this.doGetNextNode(iterator, test); + const nodes: Array = (this.compressionService.getCompressionChain(rowRoot) ?? [rowRoot]).reverse(); + + const node = nodes.find(SelectableTreeNode.is); + + if (node) { + this.addSelection({ node, type }); + } + } + + selectPrevRow(type?: TreeSelection.SelectionType): void { + this.selectAdjacentRow(BackOrForward.Backward, type); + } + + selectNextRow(type?: TreeSelection.SelectionType): void { + this.selectAdjacentRow(BackOrForward.Forward, type); + } + + protected override createForwardIteratorForNode(node: TreeNode): TreeIterator { + return new TopDownCompressedTreeIterator(node, { pruneCollapsed: true }); + } + + protected override selectIfAncestorOfSelected(node: Readonly): void { + if (!this.compressionToggle.compress) { return super.selectIfAncestorOfSelected(node); } + const tail = this.compressionService.getCompressionChain(node)?.tail() ?? node; + if (SelectableTreeNode.is(tail) && !tail.expanded && this.selectedNodes.some(selectedNode => CompositeTreeNode.isAncestor(tail, selectedNode))) { + this.selectNode(tail); + } + } +} diff --git a/packages/core/src/browser/tree/tree-compression/compressed-tree-widget.tsx b/packages/core/src/browser/tree/tree-compression/compressed-tree-widget.tsx new file mode 100644 index 0000000..b950232 --- /dev/null +++ b/packages/core/src/browser/tree/tree-compression/compressed-tree-widget.tsx @@ -0,0 +1,203 @@ +// ***************************************************************************** +// Copyright (C) 2022 Ericsson and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import '../../../../src/browser/tree/tree-compression/tree-compression.css'; +import { injectable, inject } from 'inversify'; +import * as React from 'react'; +import { ArrayUtils } from '../../../common/types'; +import { ContextMenuRenderer } from '../../context-menu-renderer'; +import { CompressionToggle, TreeCompressionService } from './tree-compression-service'; +import { CompositeTreeNode, TreeNode } from '../tree'; +import { NodeProps, TreeProps, TreeWidget } from '../tree-widget'; +import { SelectableTreeNode, TreeSelection } from '../tree-selection'; +import { ExpandableTreeNode } from '../tree-expansion'; +import { TreeViewWelcomeWidget } from '../tree-view-welcome-widget'; +import { CompressedTreeModel } from './compressed-tree-model'; + +export interface CompressedChildren { + compressionChain?: ArrayUtils.HeadAndTail; +} + +export interface CompressedNodeRow extends TreeWidget.NodeRow, CompressedChildren { } + +export interface CompressedNodeProps extends NodeProps, CompressedChildren { } + +@injectable() +export class CompressedTreeWidget extends TreeViewWelcomeWidget { + + @inject(CompressionToggle) protected readonly compressionToggle: CompressionToggle; + @inject(TreeCompressionService) protected readonly compressionService: TreeCompressionService; + + constructor( + @inject(TreeProps) props: TreeProps, + @inject(CompressedTreeModel) override readonly model: CompressedTreeModel, + @inject(ContextMenuRenderer) contextMenuRenderer: ContextMenuRenderer, + ) { + super(props, model, contextMenuRenderer); + } + + protected override rows = new Map(); + + toggleCompression(newCompression = !this.compressionToggle.compress): void { + if (newCompression !== this.compressionToggle.compress) { + this.compressionToggle.compress = newCompression; + this.updateRows(); + } + } + + protected override shouldRenderIndent(node: TreeNode): boolean { + return !this.compressionToggle.compress + || !this.compressionService.isCompressionParticipant(node) + || this.compressionService.getCompressionHead(node) === node; + } + + protected override shouldDisplayNode(node: TreeNode): boolean { + if (this.compressionToggle.compress && this.compressionService.isCompressionParticipant(node) && !this.compressionService.isCompressionHead(node)) { + return false; + } + return super.shouldDisplayNode(node); + } + + protected override getDepthForNode(node: TreeNode, depths: Map): number { + if (!this.compressionToggle.compress) { + return super.getDepthForNode(node, depths); + } + const parent = this.compressionService.getCompressionHead(node.parent) ?? node.parent; + const parentDepth = depths.get(parent); + return parentDepth === undefined ? 0 : TreeNode.isVisible(node.parent) ? parentDepth + 1 : parentDepth; + } + + protected override toNodeRow(node: TreeNode, index: number, depth: number): CompressedNodeRow { + if (!this.compressionToggle.compress) { + return super.toNodeRow(node, index, depth); + } + const row: CompressedNodeRow = { node, index, depth }; + if (this.compressionService.isCompressionHead(node)) { + row.compressionChain = this.compressionService.getCompressionChain(node); + } + return row; + } + + protected override doRenderNodeRow({ node, depth, compressionChain }: CompressedNodeRow): React.ReactNode { + const nodeProps: CompressedNodeProps = { depth, compressionChain }; + return <> + {this.renderIndent(node, nodeProps)} + {this.renderNode(node, nodeProps)} + ; + } + + protected override rowIsSelected(node: TreeNode, props: CompressedNodeProps): boolean { + if (this.compressionToggle.compress && props.compressionChain) { + return props.compressionChain.some(participant => SelectableTreeNode.isSelected(participant)); + } + return SelectableTreeNode.isSelected(node); + } + + protected override getCaptionAttributes(node: TreeNode, props: CompressedNodeProps): React.Attributes & React.HTMLAttributes { + const operativeNode = props.compressionChain?.tail() ?? node; + return super.getCaptionAttributes(operativeNode, props); + } + + protected override getCaptionChildren(node: TreeNode, props: CompressedNodeProps): React.ReactNode { + if (!this.compressionToggle.compress || !props.compressionChain) { + return super.getCaptionChildren(node, props); + } + return props.compressionChain.map((subNode, index, self) => { + const classes = ['theia-tree-compressed-label-part']; + if (SelectableTreeNode.isSelected(subNode)) { + classes.push('theia-tree-compressed-selected'); + } + const handlers = this.getCaptionChildEventHandlers(subNode, props); + const caption = {super.getCaptionChildren(subNode, props)}; + if (index === self.length - 1) { + return caption; + } + return [ + caption, + {this.getSeparatorContent(node, props)} + ]; + }); + } + + protected getCaptionChildEventHandlers(node: TreeNode, props: CompressedNodeProps): React.Attributes & React.HtmlHTMLAttributes { + return { + onClick: event => (event.stopPropagation(), this.handleClickEvent(node, event)), + onDoubleClick: event => (event.stopPropagation(), this.handleDblClickEvent(node, event)), + onContextMenu: event => (event.stopPropagation(), this.handleContextMenuEvent(node, event)), + }; + } + + protected override handleUp(event: KeyboardEvent): void { + if (!this.compressionToggle.compress) { + return super.handleUp(event); + } + const type = this.props.multiSelect && this.hasShiftMask(event) ? TreeSelection.SelectionType.RANGE : undefined; + this.model.selectPrevRow(type); + this.node.focus(); + } + + protected override handleDown(event: KeyboardEvent): void { + if (!this.compressionToggle.compress) { + return super.handleDown(event); + } + const type = this.props.multiSelect && this.hasShiftMask(event) ? TreeSelection.SelectionType.RANGE : undefined; + this.model.selectNextRow(type); + this.node.focus(); + } + + protected override async handleLeft(event: KeyboardEvent): Promise { + if (!this.compressionToggle.compress) { + return super.handleLeft(event); + } + if (Boolean(this.props.multiSelect) && (this.hasCtrlCmdMask(event) || this.hasShiftMask(event))) { + return; + } + const active = this.focusService.focusedNode; + if (ExpandableTreeNode.isExpanded(active) + && ( + this.compressionService.isCompressionHead(active) + || !this.compressionService.isCompressionParticipant(active) + )) { + await this.model.collapseNode(active); + } else { + this.model.selectParent(); + } + } + + protected override async handleRight(event: KeyboardEvent): Promise { + if (!this.compressionToggle.compress) { + return super.handleRight(event); + } + if (Boolean(this.props.multiSelect) && (this.hasCtrlCmdMask(event) || this.hasShiftMask(event))) { + return; + } + const active = this.focusService.focusedNode; + + if (ExpandableTreeNode.isCollapsed(active) + && ( + !this.compressionService.isCompressionParticipant(active) + || this.compressionService.isCompressionTail(active) + )) { + await this.model.expandNode(active); + } else if (ExpandableTreeNode.is(active)) { + this.model.selectNextNode(); + } + } + + protected getSeparatorContent(node: TreeNode, props: CompressedNodeProps): React.ReactNode { + return '/'; + } +} diff --git a/packages/core/src/browser/tree/tree-compression/index.ts b/packages/core/src/browser/tree/tree-compression/index.ts new file mode 100644 index 0000000..8f63151 --- /dev/null +++ b/packages/core/src/browser/tree/tree-compression/index.ts @@ -0,0 +1,20 @@ +// ***************************************************************************** +// Copyright (C) 2022 Ericsson and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +export * from './compressed-tree-expansion-service'; +export * from './compressed-tree-model'; +export * from './compressed-tree-widget'; +export * from './tree-compression-service'; diff --git a/packages/core/src/browser/tree/tree-compression/tree-compression-service.ts b/packages/core/src/browser/tree/tree-compression/tree-compression-service.ts new file mode 100644 index 0000000..868524d --- /dev/null +++ b/packages/core/src/browser/tree/tree-compression/tree-compression-service.ts @@ -0,0 +1,125 @@ +// ***************************************************************************** +// Copyright (C) 2021 SAP SE or an SAP affiliate company and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { injectable } from 'inversify'; +import { ArrayUtils } from '../../../common/types'; +import { TreeNode } from '../tree'; +import { ExpandableTreeNode } from '../tree-expansion'; + +export interface CompressionParent extends ExpandableTreeNode { + children: [CompressionChild]; +} + +export interface CompressionChild extends ExpandableTreeNode { + parent: CompressionParent; +} + +export type CompressionParticipant = CompressionChild | CompressionParent; + +export interface CompressionHead extends CompressionParent { + parent: ExpandableTreeNode; +} + +export interface CompressionTail extends CompressionChild { } + +export const CompressionToggle = Symbol('CompressionToggle'); +export interface CompressionToggle { + compress: boolean; +} + +@injectable() +export class TreeCompressionService { + /** + * @returns `true` if the node has a single child that is a CompositeTreeNode + * In that case, the child can be shown in the same row as the parent. + */ + isCompressionParent(node?: unknown): node is CompressionParent { + return this.isVisibleExpandableNode(node) && node.children.length === 1 && this.isVisibleExpandableNode(node.children[0]); + } + + protected isVisibleExpandableNode(node?: unknown): node is ExpandableTreeNode { + return ExpandableTreeNode.is(node) && TreeNode.isVisible(node); + } + + /** + * @returns `true` if the node is a CompositeTreeNode and is its parent's sole child + * In that case, the node can be shown in the same row as its parent. + */ + isCompressionChild(node?: TreeNode): node is CompressionChild { + return this.isCompressionParent(node?.parent); + } + + /** + * @returns `true` if the node is a CompositeTreeNode with a sole child, and the same is not true of its parent. + * In that case, the node will appear as the first member of a compressed row. + */ + isCompressionHead(node?: unknown): node is CompressionHead { + return this.isCompressionParent(node) && !this.isCompressionParent(node.parent); + } + + /** + * @returns `true` if the node's parent is a CompositeTreeNode with a sole child, and the same is not true of the node. + * In that case, the node will appear as the last member of a compressed row. + */ + isCompressionTail(node?: TreeNode): node is CompressionTail { + return this.isCompressionChild(node) && !this.isCompressionParent(node); + } + + /** + * @returns `true` if the node is part of a compression row, either a {@link CompressionChild} or {@link CompressionParent} + */ + isCompressionParticipant(node?: TreeNode): node is CompressionParticipant { + return this.isCompressionParent(node) || this.isCompressionChild(node); + } + + /** + * @returns a sequence of compressed items for the node if it is a {@link CompressionHead}. + */ + getCompressedChildren(node?: CompressionHead): ArrayUtils.Tail; + getCompressedChildren(node: unknown): ArrayUtils.Tail | undefined { + if (this.isCompressionHead(node)) { + const items = []; + let next: TreeNode = node.children[0]; + while (this.isCompressionChild(next)) { + items.push(next); + next = next.children[0]; + } + return ArrayUtils.asTail(items); + } + } + + /** + * @returns The {@link CompressionHead} of the node's compression chain, or undefined if the node is not a {@link CompressionParticipant}. + */ + getCompressionHead(node?: TreeNode): CompressionHead | undefined { + while (this.isCompressionParticipant(node)) { + if (this.isCompressionHead(node)) { + return node; + } + node = node.parent; + } + } + + /** + * @returns The compression chain of which the `node` is a part, or `undefined` if the `node` is not a {@link CompressionParticipant} + */ + getCompressionChain(node?: TreeNode): ArrayUtils.HeadAndTail | undefined { + const head = this.getCompressionHead(node); + if (head) { + return ArrayUtils.asHeadAndTail([head as CompressionParticipant].concat(this.getCompressedChildren(head))); + } + } +} diff --git a/packages/core/src/browser/tree/tree-compression/tree-compression.css b/packages/core/src/browser/tree/tree-compression/tree-compression.css new file mode 100644 index 0000000..fed54b7 --- /dev/null +++ b/packages/core/src/browser/tree/tree-compression/tree-compression.css @@ -0,0 +1,28 @@ +/******************************************************************************** + * Copyright (C) 2022 Ericsson and others. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the Eclipse + * Public License v. 2.0 are satisfied: GNU General Public License, version 2 + * with the GNU Classpath Exception which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 + ********************************************************************************/ + +.theia-tree-compressed-selected { + text-decoration: underline; +} + +.theia-tree-compressed-label-separator { + padding: 0 2px; + opacity: 0.5; +} + +.theia-tree-compressed-label-part:hover { + text-decoration: underline; +} diff --git a/packages/core/src/browser/tree/tree-consistency.spec.ts b/packages/core/src/browser/tree/tree-consistency.spec.ts new file mode 100644 index 0000000..4004cb7 --- /dev/null +++ b/packages/core/src/browser/tree/tree-consistency.spec.ts @@ -0,0 +1,105 @@ +// ***************************************************************************** +// Copyright (C) 2019 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import * as assert from 'assert'; +import { injectable } from 'inversify'; +import { createTreeTestContainer } from './test/tree-test-container'; +import { TreeImpl, CompositeTreeNode, TreeNode } from './tree'; +import { TreeModel } from './tree-model'; +import { ExpandableTreeNode } from './tree-expansion'; +import { TreeLabelProvider } from './tree-label-provider'; + +@injectable() +class ConsistencyTestTree extends TreeImpl { + + public resolveCounter = 0; + + protected override async resolveChildren(parent: CompositeTreeNode): Promise { + if (parent.id === 'expandable') { + const step: () => Promise = async () => { + // a predicate to emulate bad timing, i.e. + // children of a node gets resolved when a root is changed + if (this.root && this.root !== parent.parent) { + this.resolveCounter++; + return []; + } else { + await new Promise(resolve => setTimeout(resolve, 10)); + return step(); + } + }; + return step(); + } + return super.resolveChildren(parent); + } + +} + +/** + * Return roots having the same id, but not object identity. + */ +function createConsistencyTestRoot(rootName: string): CompositeTreeNode { + const children: TreeNode[] = []; + const root: CompositeTreeNode = { + id: 'root', + name: rootName, + parent: undefined, + children + }; + const parent: ExpandableTreeNode = { + id: 'expandable', + name: 'expandable', + parent: root, + expanded: true, + children: [] + }; + children.push(parent); + return root; +} + +describe('Tree Consistency', () => { + + it('setting different tree roots should finish', async () => { + const container = createTreeTestContainer(); + container.bind(TreeLabelProvider).toSelf().inSingletonScope(); + const labelProvider = container.get(TreeLabelProvider); + + container.bind(ConsistencyTestTree).toSelf(); + container.rebind(TreeImpl).toService(ConsistencyTestTree); + const tree = container.get(ConsistencyTestTree); + + const model = container.get(TreeModel); + + model.root = createConsistencyTestRoot('Foo'); + await new Promise(resolve => setTimeout(resolve, 50)); + + model.root = createConsistencyTestRoot('Bar'); + await new Promise(resolve => setTimeout(resolve, 50)); + + let resolveCounter = tree.resolveCounter; + assert.deepStrictEqual(tree.resolveCounter, 1); + for (let i = 0; i < 10; i++) { + await new Promise(resolve => setTimeout(resolve, 50)); + if (resolveCounter === tree.resolveCounter) { + assert.deepStrictEqual(tree.resolveCounter, 1); + assert.deepStrictEqual(labelProvider.getName(model.root)!, 'Bar'); + return; + } + resolveCounter = tree.resolveCounter; + } + assert.ok(false, 'Resolving does not stop, attempts: ' + tree.resolveCounter); + }); + +}); diff --git a/packages/core/src/browser/tree/tree-container.spec.ts b/packages/core/src/browser/tree/tree-container.spec.ts new file mode 100644 index 0000000..9032078 --- /dev/null +++ b/packages/core/src/browser/tree/tree-container.spec.ts @@ -0,0 +1,45 @@ +// ***************************************************************************** +// Copyright (C) 2022 Ericsson and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import * as assert from 'assert'; +import { Container } from 'inversify'; +import { createTreeContainer, isTreeServices } from './tree-container'; +import { TreeSearch } from './tree-search'; +import { defaultTreeProps, TreeProps } from './tree-widget'; + +describe('TreeContainer', () => { + describe('IsTreeServices should accurately distinguish TreeProps from TreeContainerProps', () => { + it('should assign search:boolean to TreeProps', () => { + assert(isTreeServices({ + ...defaultTreeProps, search: true, multiSelect: true, globalSelection: true, contextMenuPath: ['so-contextual'] + }) === false); + }); + it('should assign search:not-a-boolean to TreeContainerProps', () => { + assert(isTreeServices({ search: TreeSearch }) === true); + }); + const nonDefault = { search: !defaultTreeProps.search, contextMenu: ['no-default-for-this'] }; + it('should use props passed in as just props', () => { + const parent = new Container(); + const child = createTreeContainer(parent, nonDefault); + assert.deepStrictEqual(child.get(TreeProps), { ...defaultTreeProps, ...nonDefault }); + }); + it('should use props passed in as part of TreeContainerProps', () => { + const parent = new Container(); + const child = createTreeContainer(parent, { props: nonDefault }); + assert.deepStrictEqual(child.get(TreeProps), { ...defaultTreeProps, ...nonDefault }); + }); + }); +}); diff --git a/packages/core/src/browser/tree/tree-container.ts b/packages/core/src/browser/tree/tree-container.ts new file mode 100644 index 0000000..569aa8e --- /dev/null +++ b/packages/core/src/browser/tree/tree-container.ts @@ -0,0 +1,155 @@ +// ***************************************************************************** +// Copyright (C) 2017 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { interfaces, Container } from 'inversify'; +import { TreeWidget, TreeProps, defaultTreeProps } from './tree-widget'; +import { TreeModelImpl, TreeModel } from './tree-model'; +import { TreeImpl, Tree } from './tree'; +import { TreeSelectionService } from './tree-selection'; +import { TreeSelectionServiceImpl } from './tree-selection-impl'; +import { TreeExpansionService, TreeExpansionServiceImpl } from './tree-expansion'; +import { TreeNavigationService } from './tree-navigation'; +import { TreeDecoratorService, NoopTreeDecoratorService } from './tree-decorator'; +import { TreeSearch } from './tree-search'; +import { FuzzySearch } from './fuzzy-search'; +import { SearchBox, SearchBoxFactory } from './search-box'; +import { SearchBoxDebounce } from './search-box-debounce'; +import { TreeFocusService, TreeFocusServiceImpl } from './tree-focus-service'; + +export function isTreeServices(candidate?: Partial | Partial): candidate is TreeContainerProps { + if (candidate) { + const maybeServices = candidate as TreeContainerProps; + for (const key of Object.keys(maybeServices)) { + // This key is in both TreeProps and TreeContainerProps, so we have to handle it separately + if (key === 'search' && typeof maybeServices[key] === 'boolean') { + return false; + } + if (key in defaultImplementations) { + return true; + } + } + } + return false; +} + +export function createTreeContainer(parent: interfaces.Container, props?: Partial): Container; +/** + * @deprecated Please use TreeContainerProps instead of TreeProps + * @since 1.23.0 + */ +export function createTreeContainer(parent: interfaces.Container, props?: Partial): Container; +export function createTreeContainer(parent: interfaces.Container, props?: Partial | Partial): Container { + const child = new Container({ defaultScope: 'Singleton' }); + child.parent = parent; + const overrideServices: Partial = isTreeServices(props) ? props : { props: props as Partial | undefined }; + for (const key of Object.keys(serviceIdentifiers) as (keyof TreeIdentifiers)[]) { + if (key === 'props') { + const { service, identifier } = getServiceAndIdentifier(key, overrideServices); + child.bind(identifier).toConstantValue({ + ...defaultImplementations.props, + ...service + }); + } else if (key === 'searchBoxFactory') { + const { service, identifier } = getServiceAndIdentifier(key, overrideServices); + child.bind(identifier).toFactory(context => service(context)); + } else { + const { service, identifier } = getServiceAndIdentifier(key, overrideServices); + child.bind(service).toSelf().inSingletonScope(); + if (identifier !== service) { + child.bind(identifier as interfaces.ServiceIdentifier).toService(service); + } + } + } + return child; +} + +function getServiceAndIdentifier( + key: Key, overrides: Partial +): { service: TreeContainerProps[Key], identifier: TreeIdentifiers[Key] } { + const override = overrides[key] as TreeContainerProps[Key] | undefined; + const service = override ?? defaultImplementations[key]; + return { + service, + identifier: serviceIdentifiers[key] + }; +} + +export interface SearchBoxFactoryFactory { + (context: interfaces.Context): SearchBoxFactory; +} + +const defaultSearchBoxFactoryFactory: SearchBoxFactoryFactory = () => options => { + const debounce = new SearchBoxDebounce(options); + return new SearchBox(options, debounce); +}; + +interface TreeConstants { + searchBoxFactory: SearchBoxFactory, + props: TreeProps, +} + +interface TreeServices { + tree: Tree, + selectionService: TreeSelectionService, + expansionService: TreeExpansionService, + navigationService: TreeNavigationService, + model: TreeModel, + widget: TreeWidget, + search: TreeSearch, + fuzzy: FuzzySearch, + decoratorService: TreeDecoratorService, + focusService: TreeFocusService, +} + +interface TreeTypes extends TreeServices, TreeConstants { } + +export type TreeIdentifiers = { [K in keyof TreeTypes]: interfaces.ServiceIdentifier; }; +type TreeServiceProviders = { [K in keyof TreeServices]: interfaces.Newable }; + +export interface TreeContainerProps extends TreeServiceProviders { + props: Partial, + searchBoxFactory: SearchBoxFactoryFactory; +} + +const defaultImplementations: TreeContainerProps & { props: TreeProps } = { + tree: TreeImpl, + selectionService: TreeSelectionServiceImpl, + expansionService: TreeExpansionServiceImpl, + navigationService: TreeNavigationService, + model: TreeModelImpl, + widget: TreeWidget, + search: TreeSearch, + fuzzy: FuzzySearch, + decoratorService: NoopTreeDecoratorService, + focusService: TreeFocusServiceImpl, + props: defaultTreeProps, + searchBoxFactory: defaultSearchBoxFactoryFactory, +}; + +const serviceIdentifiers: TreeIdentifiers = { + tree: Tree, + selectionService: TreeSelectionService, + expansionService: TreeExpansionService, + navigationService: TreeNavigationService, + model: TreeModel, + widget: TreeWidget, + props: TreeProps, + search: TreeSearch, + fuzzy: FuzzySearch, + searchBoxFactory: SearchBoxFactory, + decoratorService: TreeDecoratorService, + focusService: TreeFocusService +}; diff --git a/packages/core/src/browser/tree/tree-decorator.spec.ts b/packages/core/src/browser/tree/tree-decorator.spec.ts new file mode 100644 index 0000000..0481a14 --- /dev/null +++ b/packages/core/src/browser/tree/tree-decorator.spec.ts @@ -0,0 +1,162 @@ +// ***************************************************************************** +// Copyright (C) 2018 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { expect } from 'chai'; +import { TreeDecoratorService, AbstractTreeDecoratorService, TreeDecoration } from './tree-decorator'; + +class MockTreeDecoratorService extends AbstractTreeDecoratorService { + + constructor() { + super([]); + } + +} + +describe('tree-decorator', () => { + + describe('tree-decorator-service', () => { + + const decoratorService: TreeDecoratorService = new MockTreeDecoratorService(); + + it('should inflate an empty object into an empty map', () => { + expect(decoratorService.inflateDecorators({})).to.be.empty; + }); + + it('should inflate an object into the corresponding map', () => { + const expected = new Map(); + expected.set('id_1', [ + { + tooltip: 'tooltip' + }, + { + fontData: { + color: 'blue' + } + } + ]); + expected.set('id_2', [ + { + backgroundColor: 'yellow' + }, + { + priority: 100 + } + ]); + expect(decoratorService.inflateDecorators( + { + 'id_1': [ + { + 'tooltip': 'tooltip' + }, + { + 'fontData': { + 'color': 'blue' + } + } + ], + 'id_2': [ + { + 'backgroundColor': 'yellow' + }, + { + 'priority': 100 + } + ] + } + )).to.be.deep.equal(expected); + }); + + it('should deflate an empty map into an empty object', () => { + expect(decoratorService.inflateDecorators({})).to.be.empty; + }); + + it('should inflate an object into the corresponding map', () => { + const decorations = new Map(); + decorations.set('id_1', [ + { + tooltip: 'tooltip' + }, + { + fontData: { + color: 'blue' + } + } + ]); + decorations.set('id_2', [ + { + backgroundColor: 'yellow' + }, + { + priority: 100 + } + ]); + expect(decoratorService.deflateDecorators(decorations)).to.be.deep.equal({ + 'id_1': [ + { + 'tooltip': 'tooltip' + }, + { + 'fontData': { + 'color': 'blue' + } + } + ], + 'id_2': [ + { + 'backgroundColor': 'yellow' + }, + { + 'priority': 100 + } + ] + }); + }); + + }); + + describe('caption-highlight', () => { + + describe('range-contains', () => { + ([ + [1, 2, 3, false], + [0, 0, 1, true], + [1, 0, 1, true], + [1, 1, 1, true], + [2, 1, 1, true], + [3, 1, 1, false], + [1, 1, -100, false], + ] as [number, number, number, boolean][]).forEach(test => { + const [input, offset, length, expected] = test; + it(`${input} should ${expected ? '' : 'not '}be contained in the [${offset}:${length}] range`, () => { + expect(TreeDecoration.CaptionHighlight.Range.contains(input, { offset, length })).to.be.equal(expected); + }); + }); + }); + + it('split', () => { + const actual = TreeDecoration.CaptionHighlight.split('alma', { + ranges: [{ offset: 0, length: 1 }] + }); + expect(actual).has.lengthOf(2); + expect(actual[0].highlight).to.be.true; + expect(actual[0].data).to.be.equal('a'); + expect(actual[1].highlight).to.be.undefined; + expect(actual[1].data).to.be.equal('lma'); + }); + + }); + +}); diff --git a/packages/core/src/browser/tree/tree-decorator.ts b/packages/core/src/browser/tree/tree-decorator.ts new file mode 100644 index 0000000..6b2c05b --- /dev/null +++ b/packages/core/src/browser/tree/tree-decorator.ts @@ -0,0 +1,238 @@ +// ***************************************************************************** +// Copyright (C) 2018 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { injectable, unmanaged } from 'inversify'; +import { Tree, TreeNode } from './tree'; +import { Event, Emitter, Disposable, DisposableCollection, MaybePromise } from '../../common'; +import { WidgetDecoration } from '../widget-decoration'; + +/** + * The {@link TreeDecorator} allows adapting the look and the style of the tree items within a widget. Changes are reflected in + * the form of `decoration data`. This `decoration data` is a map storing {@link TreeDecoration.Data} for affected tree nodes (using the unique node id as key). + * It is important to notice that there is no common contribution point for `TreeDecorators`. Instead, each {@link TreeDecoratorService} is + * supposed to declare its own contribution provider for `TreeDecorators`. + * + * ### Example usage + * A simple tree decorator that changes the background color of each tree node to `red`. + * + * ```typescript + * @injectable() + * export class MyTreeDecorator implements TreeDecorator { + * id = 'myTreeDecorator'; + * + * protected readonly emitter = new Emitter<(tree: Tree) => Map>(); + * + * get onDidChangeDecorations(): Event<(tree: Tree) => Map> { + * return this.emitter.event; + * } + * + * decorations(tree: Tree): MaybePromise> { + * const result = new Map(); + * + * if (tree.root === undefined) { + * return result; + * } + * for (const treeNode of new DepthFirstTreeIterator(tree.root)) { + * result.set(treeNode.id,{backgroundColor:'red'}) + * } + * return result; + * } + * } + * ``` + */ +export interface TreeDecorator { + + /** + * The unique identifier of the decorator. Ought to be unique in the application. + */ + readonly id: string; + + /** + * Fired when this decorator has calculated all the `decoration data` for the tree nodes. + */ + readonly onDidChangeDecorations: Event<(tree: Tree) => Map>; + + /** + * Computes the current `decoration data` for the given tree. Might return a promise if the computation is handled asynchronously. + * + * @param tree the tree to decorate. + * + * @returns (a promise of) a map containing the current {@linkTreeDecoration.Data} for each node. Keys are the unique identifier of the tree nodes. + */ + decorations(tree: Tree): MaybePromise>; + +} + +export const TreeDecoratorService = Symbol('TreeDecoratorService'); + +/** + * The {@link TreeDecoratorService} manages a set of known {link TreeDecorator}s and emits events when + * any of the known decorators has changes. Typically, a `TreeDecoratorService` provides a contribution point that can be used to + * register {@link TreeDecorator}s exclusively for this service. + * + * ### Example usage + * ```typescript + * export const MyTreeDecorator = Symbol('MyTreeDecorator'); + * + * @injectable() + * export class MyDecorationService extends AbstractTreeDecoratorService { + * constructor(@inject(ContributionProvider) @named(MyTreeDecorator) protected readonly contributions: ContributionProvider) { + * super(contributions.getContributions()); + * } + * } + * ``` + */ +export interface TreeDecoratorService extends Disposable { + + /** + * Fired when any of the available tree decorators has changes. + */ + readonly onDidChangeDecorations: Event; + + /** + * Computes the decorations for the tree based on the actual state of this decorator service. + * + * @param tree the tree to decorate + * + * @returns (a promise of) the computed `decoration data` + */ + getDecorations(tree: Tree): MaybePromise>; + + /** + * Transforms the `decoration data` into an object, so that it can be safely serialized into JSON. + * @param decorations the `decoration data` that should be deflated + * + * @returns the `decoration data` as serializable JSON object + */ + deflateDecorators(decorations: Map): object; + + /** + * Counterpart of the [deflateDecorators](#deflateDecorators) method. Restores the argument into a Map + * of tree node IDs and the corresponding decorations data array (`decoration data`). + * + * @returns the deserialized `decoration data + */ + // eslint-disable-next-line @typescript-eslint/no-explicit-any + inflateDecorators(state: any): Map; + +} + +/** + * The default tree decorator service. Does nothing at all. One has to rebind to a concrete implementation + * if decorators have to be supported in the tree widget. + */ +@injectable() +export class NoopTreeDecoratorService implements TreeDecoratorService { + + protected readonly emitter = new Emitter(); + readonly onDidChangeDecorations = this.emitter.event; + + dispose(): void { + this.emitter.dispose(); + } + + // eslint-disable-next-line @typescript-eslint/no-explicit-any + getDecorations(): Map { + return new Map(); + } + + deflateDecorators(): object { + return {}; + } + + inflateDecorators(): Map { + return new Map(); + } + +} + +/** + * Abstract decorator service implementation which emits events from all known tree decorators and caches the current state. + */ +@injectable() +export abstract class AbstractTreeDecoratorService implements TreeDecoratorService { + + protected readonly onDidChangeDecorationsEmitter = new Emitter(); + readonly onDidChangeDecorations = this.onDidChangeDecorationsEmitter.event; + + protected readonly toDispose = new DisposableCollection(); + + constructor(@unmanaged() protected readonly decorators: ReadonlyArray) { + this.toDispose.push(this.onDidChangeDecorationsEmitter); + this.toDispose.pushAll(this.decorators.map(decorator => + decorator.onDidChangeDecorations(data => + this.onDidChangeDecorationsEmitter.fire(undefined) + )) + ); + } + + dispose(): void { + this.toDispose.dispose(); + } + + async getDecorations(tree: Tree): Promise> { + const changes = new Map(); + for (const decorator of this.decorators) { + for (const [id, data] of (await decorator.decorations(tree)).entries()) { + if (changes.has(id)) { + changes.get(id)!.push(data); + } else { + changes.set(id, [data]); + } + } + } + return changes; + } + + deflateDecorators(decorations: Map): object { + // eslint-disable-next-line no-null/no-null + const state = Object.create(null); + for (const [id, data] of decorations) { + state[id] = data; + } + return state; + } + + // eslint-disable-next-line @typescript-eslint/no-explicit-any + inflateDecorators(state: any): Map { + const decorators = new Map(); + for (const id of Object.keys(state)) { + decorators.set(id, state[id]); + } + return decorators; + } + +} + +/** + * @deprecated import from `@theia/core/lib/browser/widget-decoration` instead. + */ +export import TreeDecoration = WidgetDecoration; + +export interface DecoratedTreeNode extends TreeNode { + /** + * The additional tree decoration data attached to the tree node itself. + */ + readonly decorationData: TreeDecoration.Data; +} +export namespace DecoratedTreeNode { + /** + * Type-guard for decorated tree nodes. + */ + export function is(node: TreeNode | undefined): node is DecoratedTreeNode { + return !!node && 'decorationData' in node; + } +} diff --git a/packages/core/src/browser/tree/tree-expansion.spec.ts b/packages/core/src/browser/tree/tree-expansion.spec.ts new file mode 100644 index 0000000..bca6ff1 --- /dev/null +++ b/packages/core/src/browser/tree/tree-expansion.spec.ts @@ -0,0 +1,173 @@ +// ***************************************************************************** +// Copyright (C) 2019 Thomas Drosdzoll. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { expect, assert } from 'chai'; +import { MockTreeModel } from './test/mock-tree-model'; +import { TreeModel } from './tree-model'; +import { TreeNode, CompositeTreeNode, Tree, TreeImpl } from './tree'; +import { ExpandableTreeNode } from './tree-expansion'; +import { createTreeTestContainer } from './test/tree-test-container'; +import { timeout } from '../../common/promise-util'; + +describe('TreeExpansionService', () => { + let model: TreeModel; + beforeEach(() => { + model = createTreeModel(); + model.root = MockTreeModel.HIERARCHICAL_MOCK_ROOT(); + }); + describe('expandNode', () => { + it("won't expand an already expanded node", done => { + const node: ExpandableTreeNode = retrieveNode('1'); + model.expandNode(node).then(result => { + expect(result).to.be.undefined; + done(); + }); + }); + + it('will expand a collapsed node', done => { + const node: ExpandableTreeNode = retrieveNode('1'); + model.collapseNode(node).then(() => { + model.expandNode(node).then(result => { + expect(result).to.be.eq(result); + done(); + }); + }); + }); + + it("won't expand an undefined node", done => { + model.expandNode(undefined).then(result => { + expect(result).to.be.undefined; + done(); + }); + }); + }); + + describe('collapseNode', () => { + it('will collapse an expanded node', done => { + const node: ExpandableTreeNode = retrieveNode('1'); + model.collapseNode(node).then(result => { + expect(result).to.be.eq(result); + done(); + }); + }); + + it("won't collapse an already collapsed node", done => { + const node: ExpandableTreeNode = retrieveNode('1'); + model.collapseNode(node).then(() => { + model.collapseNode(node).then(result => { + expect(result).to.be.false; + done(); + }); + }); + }); + + it('cannot collapse a leaf node', done => { + const node: ExpandableTreeNode = retrieveNode('1.1.2'); + model.collapseNode(node).then(result => { + expect(result).to.be.false; + done(); + }); + }); + }); + + describe('collapseAll', () => { + it('will collapse all nodes recursively', done => { + model.collapseAll(retrieveNode('1')).then(result => { + expect(result).to.be.eq(result); + done(); + }); + }); + + it("won't collapse nodes recursively if the root node is collapsed already", done => { + model.collapseNode(retrieveNode('1')).then(() => { + model.collapseAll(retrieveNode('1')).then(result => { + expect(result).to.be.eq(result); + done(); + }); + }); + }); + }); + + describe('toggleNodeExpansion', () => { + it('changes the expansion state from expanded to collapsed', done => { + const node = retrieveNode('1'); + model.onExpansionChanged((e: Readonly) => { + expect(e).to.be.equal(node); + expect(e.expanded).to.be.false; + }); + model.toggleNodeExpansion(node).then(() => { + done(); + }); + }); + + it('changes the expansion state from collapsed to expanded', done => { + const node = retrieveNode('1'); + model.collapseNode(node).then(() => { + }); + model.onExpansionChanged((e: Readonly) => { + expect(e).to.be.equal(node); + expect(e.expanded).to.be.true; + }); + model.toggleNodeExpansion(node).then(() => { + done(); + }); + }); + }); + + it('node should be refreshed on expansion', async () => { + const container = createTreeTestContainer(); + container.rebind(Tree).to(class extends TreeImpl { + + protected override async resolveChildren(parent: CompositeTreeNode): Promise { + await timeout(200); + return [{ + id: 'child', + parent + }]; + } + + }); + const root: ExpandableTreeNode = { + id: 'parent', + parent: undefined, + children: [], + expanded: false + }; + + const treeModel = container.get(TreeModel); + treeModel.root = root; + + assert.isFalse(root.expanded, 'before'); + assert.equal(root.children.length, 0, 'before'); + + const expanding = treeModel.expandNode(root); + assert.isFalse(root.expanded, 'between'); + assert.equal(root.children.length, 0, 'between'); + + await expanding; + assert.isTrue(root.expanded, 'after'); + assert.equal(root.children.length, 1, 'after'); + }); + + function createTreeModel(): TreeModel { + const container = createTreeTestContainer(); + return container.get(TreeModel); + } + function retrieveNode(id: string): Readonly { + const readonlyNode: Readonly = model.getNode(id) as T; + return readonlyNode; + } +}); diff --git a/packages/core/src/browser/tree/tree-expansion.ts b/packages/core/src/browser/tree/tree-expansion.ts new file mode 100644 index 0000000..3bf7e0d --- /dev/null +++ b/packages/core/src/browser/tree/tree-expansion.ts @@ -0,0 +1,165 @@ +// ***************************************************************************** +// Copyright (C) 2017 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { injectable, inject, postConstruct } from 'inversify'; +import { Emitter, Event, Disposable } from '../../common'; +import { CompositeTreeNode, TreeNode, Tree } from './tree'; + +export const TreeExpansionService = Symbol('TreeExpansionService'); + +/** + * The tree expandable service. + */ +export interface TreeExpansionService extends Disposable { + /** + * Emit when the node is expanded or collapsed. + */ + readonly onExpansionChanged: Event>; + /** + * Expand a node for the given node id if it is valid and collapsed. + * Expanding a node refreshes all its children. + * + * Return a valid expanded refreshed node or `undefined` if such does not exist. + */ + expandNode(node: Readonly): Promise | undefined>; + /** + * If the given node is valid and expanded then collapse it. + * + * Return true if a node has been collapsed; otherwise false. + */ + collapseNode(node: Readonly): Promise; + /** + * If the given node is valid then collapse it recursively. + * + * Return true if a node has been collapsed; otherwise false. + */ + collapseAll(node: Readonly): Promise; + /** + * If the given node is invalid then does nothing. + * If the given node is collapsed then expand it; otherwise collapse it. + */ + toggleNodeExpansion(node: Readonly): Promise; +} + +/** + * The expandable tree node. + */ +export interface ExpandableTreeNode extends CompositeTreeNode { + /** + * Test whether this tree node is expanded. + */ + expanded: boolean; +} + +export namespace ExpandableTreeNode { + export function is(node: unknown): node is ExpandableTreeNode { + return !!node && CompositeTreeNode.is(node) && 'expanded' in node; + } + + export function isExpanded(node: unknown): node is ExpandableTreeNode { + return ExpandableTreeNode.is(node) && node.expanded; + } + + export function isCollapsed(node: unknown): node is ExpandableTreeNode { + return ExpandableTreeNode.is(node) && !node.expanded; + } +} + +@injectable() +export class TreeExpansionServiceImpl implements TreeExpansionService { + + @inject(Tree) protected readonly tree: Tree; + protected readonly onExpansionChangedEmitter = new Emitter(); + + @postConstruct() + protected init(): void { + this.tree.onNodeRefreshed(node => { + for (const child of node.children) { + if (ExpandableTreeNode.isExpanded(child)) { + node.waitUntil(this.tree.refresh(child)); + } + } + }); + } + + dispose(): void { + this.onExpansionChangedEmitter.dispose(); + } + + get onExpansionChanged(): Event { + return this.onExpansionChangedEmitter.event; + } + + protected fireExpansionChanged(node: ExpandableTreeNode): void { + this.onExpansionChangedEmitter.fire(node); + } + + async expandNode(raw: ExpandableTreeNode): Promise { + const node = this.tree.validateNode(raw); + if (ExpandableTreeNode.isCollapsed(node)) { + return this.doExpandNode(node); + } + return undefined; + } + + protected async doExpandNode(node: ExpandableTreeNode): Promise { + const refreshed = await this.tree.refresh(node); + if (ExpandableTreeNode.is(refreshed)) { + refreshed.expanded = true; + this.fireExpansionChanged(refreshed); + return refreshed; + } + return undefined; + } + + async collapseNode(raw: ExpandableTreeNode): Promise { + const node = this.tree.validateNode(raw); + return this.doCollapseNode(node); + } + + async collapseAll(raw: CompositeTreeNode): Promise { + const node = this.tree.validateNode(raw); + return this.doCollapseAll(node); + } + + protected doCollapseAll(node: TreeNode | undefined): boolean { + let result = false; + if (CompositeTreeNode.is(node)) { + for (const child of node.children) { + result = this.doCollapseAll(child) || result; + } + } + return this.doCollapseNode(node) || result; + } + + protected doCollapseNode(node: TreeNode | undefined): boolean { + if (!ExpandableTreeNode.isExpanded(node)) { + return false; + } + node.expanded = false; + this.fireExpansionChanged(node); + return true; + } + + async toggleNodeExpansion(node: ExpandableTreeNode): Promise { + if (node.expanded) { + await this.collapseNode(node); + } else { + await this.expandNode(node); + } + } + +} diff --git a/packages/core/src/browser/tree/tree-focus-service.ts b/packages/core/src/browser/tree/tree-focus-service.ts new file mode 100644 index 0000000..d1e8a37 --- /dev/null +++ b/packages/core/src/browser/tree/tree-focus-service.ts @@ -0,0 +1,55 @@ +// ***************************************************************************** +// Copyright (C) 2022 Ericsson and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { inject, injectable } from 'inversify'; +import { Emitter, Event } from '../../common'; +import { Tree, TreeNode } from './tree'; +import { SelectableTreeNode } from './tree-selection'; + +export interface TreeFocusService { + readonly focusedNode: SelectableTreeNode | undefined; + readonly onDidChangeFocus: Event; + setFocus(node?: SelectableTreeNode): void; + hasFocus(node?: TreeNode): boolean; +} +export const TreeFocusService = Symbol('TreeFocusService'); + +@injectable() +export class TreeFocusServiceImpl implements TreeFocusService { + protected focusedId: string | undefined; + protected onDidChangeFocusEmitter = new Emitter(); + get onDidChangeFocus(): Event { return this.onDidChangeFocusEmitter.event; } + + @inject(Tree) protected readonly tree: Tree; + + get focusedNode(): SelectableTreeNode | undefined { + const candidate = this.tree.getNode(this.focusedId); + if (SelectableTreeNode.is(candidate)) { + return candidate; + } + } + + setFocus(node?: SelectableTreeNode): void { + if (node?.id !== this.focusedId) { + this.focusedId = node?.id; + this.onDidChangeFocusEmitter.fire(node); + } + } + + hasFocus(node?: TreeNode): boolean { + return !!node && node?.id === this.focusedId; + } +} diff --git a/packages/core/src/browser/tree/tree-iterator.spec.ts b/packages/core/src/browser/tree/tree-iterator.spec.ts new file mode 100644 index 0000000..2208d45 --- /dev/null +++ b/packages/core/src/browser/tree/tree-iterator.spec.ts @@ -0,0 +1,170 @@ +// ***************************************************************************** +// Copyright (C) 2018 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { expect } from 'chai'; +import { notEmpty } from '../../common/objects'; +import { MockTreeModel } from './test/mock-tree-model'; +import { TreeModel } from './tree-model'; +import { DepthFirstTreeIterator, BreadthFirstTreeIterator, BottomUpTreeIterator, TopDownTreeIterator, Iterators } from './tree-iterator'; +import { createTreeTestContainer } from './test/tree-test-container'; +import { ExpandableTreeNode } from './tree-expansion'; + +describe('tree-iterator', () => { + + const model = createTreeModel(); + const findNode = (id: string) => model.getNode(id); + + beforeEach(() => { + model.root = MockTreeModel.HIERARCHICAL_MOCK_ROOT(); + }); + + it('should include root', () => { + const expected = ['1']; + const actual = [...new BottomUpTreeIterator(findNode('1')!)].map(node => node.id); + expect(expected).to.be.deep.equal(actual); + }); + + it('should return `undefined` after consuming the iterator', () => { + const itr = new BottomUpTreeIterator(findNode('1')!); + let next = itr.next(); + while (!next.done) { + expect(next.value).to.be.not.undefined; + next = itr.next(); + } + expect(next.done).to.be.true; + expect(next.value).to.be.undefined; + }); + + it('depth-first (no collapsed nodes)', () => { + const expected = ['1', '1.1', '1.1.1', '1.1.2', '1.2', '1.2.1', '1.2.1.1', '1.2.1.2', '1.2.2', '1.2.3', '1.3']; + const actual = [...new DepthFirstTreeIterator(model.root!)].map(node => node.id); + expect(expected).to.be.deep.equal(actual); + }); + + it('depth-first (with collapsed nodes)', () => { + collapseNode('1.1', '1.2.1'); + const expected = ['1', '1.1', '1.2', '1.2.1', '1.2.2', '1.2.3', '1.3']; + const actual = [...new DepthFirstTreeIterator(model.root!, { pruneCollapsed: true })].map(node => node.id); + expect(expected).to.be.deep.equal(actual); + }); + + it('breadth-first (no collapsed nodes)', () => { + const expected = ['1', '1.1', '1.2', '1.3', '1.1.1', '1.1.2', '1.2.1', '1.2.2', '1.2.3', '1.2.1.1', '1.2.1.2']; + const actual = [...new BreadthFirstTreeIterator(model.root!)].map(node => node.id); + expect(expected).to.be.deep.equal(actual); + }); + + it('breadth-first (with collapsed nodes)', () => { + collapseNode('1.1', '1.2.1'); + const expected = ['1', '1.1', '1.2', '1.3', '1.2.1', '1.2.2', '1.2.3']; + const actual = [...new BreadthFirstTreeIterator(model.root!, { pruneCollapsed: true })].map(node => node.id); + expect(expected).to.be.deep.equal(actual); + }); + + it('bottom-up (no collapsed nodes)', () => { + const expected = ['1.2.2', '1.2.1.2', '1.2.1.1', '1.2.1', '1.2', '1.1.2', '1.1.1', '1.1', '1']; + const actual = [...new BottomUpTreeIterator(findNode('1.2.2')!)].map(node => node.id); + expect(expected).to.be.deep.equal(actual); + }); + + it('bottom-up (with collapsed nodes)', () => { + collapseNode('1.1', '1.2.1'); + const expected = ['1.2.2', '1.2.1', '1.2', '1.1', '1']; + const actual = [...new BottomUpTreeIterator(findNode('1.2.2')!, { pruneCollapsed: true })].map(node => node.id); + expect(expected).to.be.deep.equal(actual); + }); + + it('top-down (no collapsed nodes)', () => { + const expected = ['1.1.2', '1.2', '1.2.1', '1.2.1.1', '1.2.1.2', '1.2.2', '1.2.3', '1.3']; + const actual = [...new TopDownTreeIterator(findNode('1.1.2')!)].map(node => node.id); + expect(expected).to.be.deep.equal(actual); + }); + + it('top-down (with collapsed nodes)', () => { + collapseNode('1.2.1'); + const expected = ['1.1.2', '1.2', '1.2.1', '1.2.2', '1.2.3', '1.3']; + const actual = [...new TopDownTreeIterator(findNode('1.1.2')!, { pruneCollapsed: true })].map(node => node.id); + expect(expected).to.be.deep.equal(actual); + }); + + function collapseNode(...ids: string[]): void { + ids.map(findNode).filter(notEmpty).filter(ExpandableTreeNode.is).forEach(node => { + model.collapseNode(node); + expect(node).to.have.property('expanded', false); + }); + } + + function createTreeModel(): TreeModel { + return createTreeTestContainer().get(TreeModel); + } + +}); + +describe('iterators', () => { + + it('as-iterator', () => { + const array = [1, 2, 3, 4]; + const itr = Iterators.asIterator(array); + let next = itr.next(); + while (!next.done) { + const { value } = next; + expect(value).to.be.not.undefined; + const index = array.indexOf(value); + expect(index).to.be.not.equal(-1); + array.splice(index, 1); + next = itr.next(); + } + expect(array).to.be.empty; + }); + + it('cycle - without start', function (): void { + this.timeout(1000); + const array = [1, 2, 3, 4]; + const itr = Iterators.cycle(array); + const visitedItems = new Set(); + let next = itr.next(); + while (!next.done) { + const { value } = next; + expect(value).to.be.not.undefined; + if (visitedItems.has(value)) { + expect(Array.from(visitedItems).sort()).to.be.deep.equal(array.sort()); + break; + } + visitedItems.add(value); + next = itr.next(); + } + }); + + it('cycle - with start', function (): void { + this.timeout(1000); + const array = [1, 2, 3, 4]; + const itr = Iterators.cycle(array, 2); + const visitedItems = new Set(); + let next = itr.next(); + expect(next.value).to.be.equal(2); + while (!next.done) { + const { value } = next; + expect(value).to.be.not.undefined; + if (visitedItems.has(value)) { + expect(Array.from(visitedItems).sort()).to.be.deep.equal(array.sort()); + break; + } + visitedItems.add(value); + next = itr.next(); + } + }); + +}); diff --git a/packages/core/src/browser/tree/tree-iterator.ts b/packages/core/src/browser/tree/tree-iterator.ts new file mode 100644 index 0000000..9102a4f --- /dev/null +++ b/packages/core/src/browser/tree/tree-iterator.ts @@ -0,0 +1,256 @@ +// ***************************************************************************** +// Copyright (C) 2017 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { TreeNode, CompositeTreeNode } from './tree'; +import { ExpandableTreeNode } from './tree-expansion'; + +export interface TreeIterator extends Iterator { +} + +export namespace TreeIterator { + + export interface Options { + readonly pruneCollapsed: boolean + readonly pruneSiblings: boolean + } + + export const DEFAULT_OPTIONS: Options = { + pruneCollapsed: false, + pruneSiblings: false + }; + +} + +export abstract class AbstractTreeIterator implements TreeIterator, Iterable { + + protected readonly delegate: IterableIterator; + protected readonly options: TreeIterator.Options; + + constructor(protected readonly root: TreeNode, options?: Partial) { + this.options = { + ...TreeIterator.DEFAULT_OPTIONS, + ...options + }; + this.delegate = this.iterator(this.root); + } + + // tslint:disable-next-line:typedef + [Symbol.iterator]() { + return this.delegate; + } + + next(): IteratorResult { + return this.delegate.next(); + } + + protected abstract iterator(node: TreeNode): IterableIterator; + + protected children(node: TreeNode): TreeNode[] | undefined { + if (!CompositeTreeNode.is(node)) { + return undefined; + } + if (this.options.pruneCollapsed && this.isCollapsed(node)) { + return undefined; + } + return node.children.slice(); + } + + protected isCollapsed(node: TreeNode): boolean { + return ExpandableTreeNode.isCollapsed(node); + } + + protected isEmpty(nodes: TreeNode[] | undefined): boolean { + return nodes === undefined || nodes.length === 0; + } + +} + +export class DepthFirstTreeIterator extends AbstractTreeIterator { + + protected iterator(root: TreeNode): IterableIterator { + return Iterators.depthFirst(root, this.children.bind(this)); + } + +} + +export class BreadthFirstTreeIterator extends AbstractTreeIterator { + + protected iterator(root: TreeNode): IterableIterator { + return Iterators.breadthFirst(root, this.children.bind(this)); + } + +} + +/** + * This tree iterator visits all nodes from top to bottom considering the following rules. + * + * Let assume the following tree: + * ``` + * R + * | + * +---1 + * | | + * | +---1.1 + * | | + * | +---1.2 + * | | + * | +---1.3 + * | | | + * | | +---1.3.1 + * | | | + * | | +---1.3.2 + * | | + * | +---1.4 + * | + * +---2 + * | + * +---2.1 + * ``` + * When selecting `1.2` as the root, the normal `DepthFirstTreeIterator` would stop on `1.2` as it does not have children, + * but this iterator will visit the next sibling (`1.3` and `1.4` but **not** `1.1`) nodes. So the expected traversal order will be + * `1.2`, `1.3`, `1.3.1`, `1.3.2`, and `1.4` then jumps to `2` and continues with `2.1`. + */ +export class TopDownTreeIterator extends AbstractTreeIterator { + + protected iterator(root: TreeNode): IterableIterator { + const doNext = this.doNext.bind(this); + return (function* (): IterableIterator { + let next = root; + while (next) { + yield next; + next = doNext(next); + } + }).bind(this)(); + } + + protected doNext(node: TreeNode): TreeNode | undefined { + return this.findFirstChild(node) || this.findNextSibling(node); + } + + protected findFirstChild(node: TreeNode): TreeNode | undefined { + return (this.children(node) || [])[0]; + } + + protected findNextSibling(node: TreeNode | undefined): TreeNode | undefined { + if (!node) { + return undefined; + } + if (this.options.pruneSiblings && node === this.root) { + return undefined; + } + if (node.nextSibling) { + return node.nextSibling; + } + return this.findNextSibling(node.parent); + } + +} + +/** + * Unlike other tree iterators, this does not visit all the nodes, it stops once it reaches the root node + * while traversing up the tree hierarchy in an inverse pre-order fashion. This is the counterpart of the `TopDownTreeIterator`. + */ +export class BottomUpTreeIterator extends AbstractTreeIterator { + + protected iterator(root: TreeNode): IterableIterator { + const doNext = this.doNext.bind(this); + return (function* (): IterableIterator { + let next = root; + while (next) { + yield next; + next = doNext(next); + } + }).bind(this)(); + } + + protected doNext(node: TreeNode): TreeNode | undefined { + const previousSibling = node.previousSibling; + const lastChild = this.lastChild(previousSibling); + return lastChild || node.parent; + } + + protected lastChild(node: TreeNode | undefined): TreeNode | undefined { + const children = node ? this.children(node) : []; + if (this.isEmpty(children)) { + return node; + } + if (CompositeTreeNode.is(node)) { + const lastChild = CompositeTreeNode.getLastChild(node); + return this.lastChild(lastChild); + } + return undefined; + } + +} + +export namespace Iterators { + + /** + * Generator for depth first, pre-order tree traversal iteration. + */ + export function* depthFirst(root: T, children: (node: T) => T[] | undefined, include: (node: T) => boolean = () => true): IterableIterator { + let stack: T[] = []; + stack.push(root); + while (stack.length > 0) { + const top = stack.pop()!; + yield top; + stack = stack.concat((children(top) || []).filter(include).reverse()); + } + } + + /** + * Generator for breadth first tree traversal iteration. + */ + export function* breadthFirst(root: T, children: (node: T) => T[] | undefined, include: (node: T) => boolean = () => true): IterableIterator { + let queue: T[] = []; + queue.push(root); + while (queue.length > 0) { + const head = queue.shift()!; + yield head; + queue = queue.concat((children(head) || []).filter(include)); + } + } + + /** + * Returns with the iterator of the argument. + */ + export function asIterator(elements: ReadonlyArray): IterableIterator { + return elements.slice()[Symbol.iterator](); + } + + /** + * Returns an iterator that cycles indefinitely over the elements of iterable. + * - If `start` is given it starts the iteration from that element. Otherwise, it starts with the first element of the array. + * - If `start` is given, it must contain by the `elements` array. Otherwise, an error will be thrown. + * + * **Warning**: Typical uses of the resulting iterator may produce an infinite loop. You should use an explicit break. + */ + export function* cycle(elements: ReadonlyArray, start?: T): IterableIterator { + const copy = elements.slice(); + let index = !!start ? copy.indexOf(start) : 0; + if (index === -1) { + throw new Error(`${start} is not contained in ${copy}.`); + } + while (true) { + yield copy[index]; + index++; + if (index === copy.length) { + index = 0; + } + } + } + +} diff --git a/packages/core/src/browser/tree/tree-label-provider.ts b/packages/core/src/browser/tree/tree-label-provider.ts new file mode 100644 index 0000000..9fcd658 --- /dev/null +++ b/packages/core/src/browser/tree/tree-label-provider.ts @@ -0,0 +1,40 @@ +// ***************************************************************************** +// Copyright (C) 2019 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { injectable } from 'inversify'; +import { LabelProviderContribution } from '../label-provider'; +import { TreeNode } from './tree'; + +@injectable() +export class TreeLabelProvider implements LabelProviderContribution { + + canHandle(element: object): number { + return TreeNode.is(element) ? 50 : 0; + } + + getIcon(node: TreeNode): string | undefined { + return node.icon; + } + + getName(node: TreeNode): string | undefined { + return node.name; + } + + getLongName(node: TreeNode): string | undefined { + return node.description; + } + +} diff --git a/packages/core/src/browser/tree/tree-model.ts b/packages/core/src/browser/tree/tree-model.ts new file mode 100644 index 0000000..d4a6dda --- /dev/null +++ b/packages/core/src/browser/tree/tree-model.ts @@ -0,0 +1,562 @@ +// ***************************************************************************** +// Copyright (C) 2017 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { inject, injectable, postConstruct } from 'inversify'; +import { Event, Emitter, WaitUntilEvent } from '../../common/event'; +import { DisposableCollection } from '../../common/disposable'; +import { CancellationToken } from '../../common/cancellation'; +import { ILogger } from '../../common/logger'; +import { SelectionProvider } from '../../common/selection-service'; +import { Tree, TreeNode, CompositeTreeNode } from './tree'; +import { TreeSelectionService, SelectableTreeNode, TreeSelection } from './tree-selection'; +import { TreeExpansionService, ExpandableTreeNode } from './tree-expansion'; +import { TreeNavigationService } from './tree-navigation'; +import { TreeIterator, BottomUpTreeIterator, TopDownTreeIterator, Iterators } from './tree-iterator'; +import { TreeSearch } from './tree-search'; +import { TreeFocusService } from './tree-focus-service'; + +/** + * The tree model. + */ +export const TreeModel = Symbol('TreeModel'); +export interface TreeModel extends Tree, TreeSelectionService, TreeExpansionService { + + /** + * Expands the given node. If the `node` argument is `undefined`, then expands the currently selected tree node. + * If multiple tree nodes are selected, expands the most recently selected tree node. + */ + expandNode(node?: Readonly): Promise | undefined>; + + /** + * Collapses the given node. If the `node` argument is `undefined`, then collapses the currently selected tree node. + * If multiple tree nodes are selected, collapses the most recently selected tree node. + */ + collapseNode(node?: Readonly): Promise; + + /** + * Collapses recursively. If the `node` argument is `undefined`, then collapses the currently selected tree node. + * If multiple tree nodes are selected, collapses the most recently selected tree node. + */ + collapseAll(node?: Readonly): Promise; + + /** + * Toggles the expansion state of the given node. If not give, then it toggles the expansion state of the currently selected node. + * If multiple nodes are selected, then the most recently selected tree node's expansion state will be toggled. + */ + toggleNodeExpansion(node?: Readonly): Promise; + + /** + * Opens the given node or the currently selected on if the argument is `undefined`. + * If multiple nodes are selected, open the most recently selected node. + */ + openNode(node?: Readonly | undefined): void; + + /** + * Event when a node should be opened. + */ + readonly onOpenNode: Event>; + + /** + * Selects the parent node relatively to the selected taking into account node expansion. + */ + selectParent(): void; + + /** + * Navigates to the given node if it is defined. This method accepts both the tree node and its ID as an argument. + * Navigation sets a node as a root node and expand it. Resolves to the node if the navigation was successful. Otherwise, + * resolves to `undefined`. + */ + navigateTo(nodeOrId: Readonly | string | undefined): Promise; + /** + * Tests whether it is possible to navigate forward. + */ + canNavigateForward(): boolean; + + /** + * Tests whether it is possible to navigate backward. + */ + canNavigateBackward(): boolean; + + /** + * Navigates forward. + */ + navigateForward(): Promise; + /** + * Navigates backward. + */ + navigateBackward(): Promise; + + /** + * Selects the previous tree node, regardless of its selection or visibility state. + */ + selectPrev(): void; + + /** + * Selects the previous node relatively to the currently selected one. This method takes the expansion state of the tree into consideration. + */ + selectPrevNode(type?: TreeSelection.SelectionType): void; + + /** + * Returns the previous tree node, regardless of its selection or visibility state. + */ + getPrevNode(node?: TreeNode): TreeNode | undefined; + + /** + * Returns the previous selectable tree node. + */ + getPrevSelectableNode(node?: TreeNode): SelectableTreeNode | undefined; + + /** + * Selects the next tree node, regardless of its selection or visibility state. + */ + selectNext(): void; + + /** + * Selects the next node relatively to the currently selected one. This method takes the expansion state of the tree into consideration. + */ + selectNextNode(type?: TreeSelection.SelectionType): void; + + /** + * Returns the next tree node, regardless of its selection or visibility state. + */ + getNextNode(node?: TreeNode): TreeNode | undefined; + + /** + * Returns the next selectable tree node. + */ + getNextSelectableNode(node?: TreeNode): SelectableTreeNode | undefined; + + /** + * Selects the given tree node. Has no effect when the node does not exist in the tree. Discards any previous selection state. + */ + selectNode(node: Readonly): void; + + /** + * Selects the given node if it was not yet selected, or unselects it if it was. Keeps the previous selection state and updates it + * with the current toggle selection. + */ + toggleNode(node: Readonly): void; + + /** + * Selects a range of tree nodes. The target of the selection range is the argument, the from tree node is the previous selected node. + * If no node was selected previously, invoking this method does nothing. + */ + selectRange(node: Readonly): void; + + /** + * Returns the node currently in focus in this tree, or undefined if no node is focused. + */ + getFocusedNode(): SelectableTreeNode | undefined +} + +@injectable() +export class TreeModelImpl implements TreeModel, SelectionProvider>> { + + @inject(ILogger) protected readonly logger: ILogger; + @inject(Tree) protected readonly tree: Tree; + @inject(TreeSelectionService) protected readonly selectionService: TreeSelectionService; + @inject(TreeExpansionService) protected readonly expansionService: TreeExpansionService; + @inject(TreeNavigationService) protected readonly navigationService: TreeNavigationService; + @inject(TreeFocusService) protected readonly focusService: TreeFocusService; + @inject(TreeSearch) protected readonly treeSearch: TreeSearch; + + protected readonly onChangedEmitter = new Emitter(); + protected readonly onOpenNodeEmitter = new Emitter(); + protected readonly toDispose = new DisposableCollection(); + + @postConstruct() + protected init(): void { + this.toDispose.push(this.tree); + this.toDispose.push(this.tree.onChanged(() => this.fireChanged())); + + this.toDispose.push(this.selectionService); + + this.toDispose.push(this.expansionService); + this.toDispose.push(this.expansionService.onExpansionChanged(node => { + this.fireChanged(); + this.handleExpansion(node); + })); + + this.toDispose.push(this.onOpenNodeEmitter); + this.toDispose.push(this.onChangedEmitter); + this.toDispose.push(this.treeSearch); + } + + dispose(): void { + this.toDispose.dispose(); + } + + protected handleExpansion(node: Readonly): void { + this.selectIfAncestorOfSelected(node); + } + + /** + * Select the given node if it is the ancestor of a selected node. + */ + protected selectIfAncestorOfSelected(node: Readonly): void { + if (!node.expanded && this.selectedNodes.some(selectedNode => CompositeTreeNode.isAncestor(node, selectedNode))) { + if (SelectableTreeNode.isVisible(node)) { + this.selectNode(node); + } + } + } + + get root(): TreeNode | undefined { + return this.tree.root; + } + + set root(root: TreeNode | undefined) { + this.tree.root = root; + } + + get onChanged(): Event { + return this.onChangedEmitter.event; + } + + get onOpenNode(): Event { + return this.onOpenNodeEmitter.event; + } + + protected fireChanged(): void { + this.onChangedEmitter.fire(undefined); + } + + get onNodeRefreshed(): Event & WaitUntilEvent> { + return this.tree.onNodeRefreshed; + } + + getNode(id: string | undefined): TreeNode | undefined { + return this.tree.getNode(id); + } + + getFocusedNode(): SelectableTreeNode | undefined { + return this.focusService.focusedNode; + } + + validateNode(node: TreeNode | undefined): TreeNode | undefined { + return this.tree.validateNode(node); + } + + async refresh(parent?: Readonly): Promise { + if (parent) { + return this.tree.refresh(parent); + } + return this.tree.refresh(); + } + + // tslint:disable-next-line:typedef + get selectedNodes() { + return this.selectionService.selectedNodes; + } + + // tslint:disable-next-line:typedef + get onSelectionChanged() { + return this.selectionService.onSelectionChanged; + } + + get onExpansionChanged(): Event> { + return this.expansionService.onExpansionChanged; + } + + async expandNode(raw?: Readonly): Promise { + for (const node of this.getExpansionCandidates(raw)) { + if (ExpandableTreeNode.is(node)) { + return this.expansionService.expandNode(node); + } + } + return undefined; + } + + protected *getExpansionCandidates(raw?: Readonly): IterableIterator { + yield raw; + yield this.getFocusedNode(); + yield* this.selectedNodes; + } + + async collapseNode(raw?: Readonly): Promise { + for (const node of this.getExpansionCandidates(raw)) { + if (ExpandableTreeNode.is(node)) { + return this.expansionService.collapseNode(node); + } + } + return false; + } + + async collapseAll(raw?: Readonly): Promise { + const node = raw || this.getFocusedNode(); + if (SelectableTreeNode.is(node)) { + this.selectNode(node); + } + if (CompositeTreeNode.is(node)) { + return this.expansionService.collapseAll(node); + } + return false; + } + + async toggleNodeExpansion(raw?: Readonly): Promise { + for (const node of raw ? [raw] : this.selectedNodes) { + if (ExpandableTreeNode.is(node)) { + await this.expansionService.toggleNodeExpansion(node); + } + } + } + + selectPrev(): void { + const node = this.getPrevNode(); + this.selectNodeIfSelectable(node); + } + + selectPrevNode(type: TreeSelection.SelectionType = TreeSelection.SelectionType.DEFAULT): void { + const node = this.getPrevSelectableNode(); + if (node) { + this.addSelection({ node, type }); + } + } + + getPrevNode(node: TreeNode | undefined = this.getFocusedNode()): TreeNode | undefined { + const iterator = this.createBackwardTreeIterator(node); + return iterator && this.doGetNode(iterator); + } + + getPrevSelectableNode(node: TreeNode | undefined = this.getFocusedNode()): SelectableTreeNode | undefined { + if (!node) { + return this.getNextSelectableNode(this.root); + } + const iterator = this.createBackwardIterator(node); + return iterator && this.doGetNextNode(iterator, this.isVisibleSelectableNode.bind(this)); + } + + selectNext(): void { + const node = this.getNextNode(); + this.selectNodeIfSelectable(node); + } + + selectNextNode(type: TreeSelection.SelectionType = TreeSelection.SelectionType.DEFAULT): void { + const node = this.getNextSelectableNode(); + if (node) { + this.addSelection({ node, type }); + } + } + + getNextNode(node: TreeNode | undefined = this.getFocusedNode()): TreeNode | undefined { + const iterator = this.createTreeIterator(node); + return iterator && this.doGetNode(iterator); + } + + getNextSelectableNode(node: TreeNode | undefined = this.getFocusedNode() ?? this.root): SelectableTreeNode | undefined { + const iterator = this.createIterator(node); + return iterator && this.doGetNextNode(iterator, this.isVisibleSelectableNode.bind(this)); + } + + protected selectNodeIfSelectable(node: TreeNode | undefined): void { + if (SelectableTreeNode.is(node)) { + this.addSelection(node); + } + } + + protected doGetNode(iterator: TreeIterator): TreeNode | undefined { + iterator.next(); + const result = iterator.next(); + return result.done ? undefined : result.value; + } + + protected doGetNextNode(iterator: TreeIterator, criterion: (node: TreeNode) => node is T): T | undefined { + // Skip the first item. // TODO: clean this up, and skip the first item in a different way without loading everything. + iterator.next(); + let result = iterator.next(); + while (!result.done) { + if (criterion(result.value)) { + return result.value; + } + result = iterator.next(); + } + return undefined; + } + + protected isVisibleSelectableNode(node: TreeNode): node is SelectableTreeNode { + return SelectableTreeNode.isVisible(node); + } + + protected createBackwardTreeIterator(node: TreeNode | undefined): TreeIterator | undefined { + const { filteredNodes } = this.treeSearch; + if (filteredNodes.length === 0) { + return node ? new BottomUpTreeIterator(node!, { pruneCollapsed: false }) : undefined; + } + if (node && filteredNodes.indexOf(node) === -1) { + return undefined; + } + return Iterators.cycle(filteredNodes.slice().reverse(), node); + } + + protected createBackwardIterator(node: TreeNode | undefined): TreeIterator | undefined { + const { filteredNodes } = this.treeSearch; + if (filteredNodes.length === 0) { + return node ? new BottomUpTreeIterator(node!, { pruneCollapsed: true }) : undefined; + } + if (node && filteredNodes.indexOf(node) === -1) { + return undefined; + } + return Iterators.cycle(filteredNodes.slice().reverse(), node); + } + + protected createTreeIterator(node: TreeNode | undefined): TreeIterator | undefined { + const { filteredNodes } = this.treeSearch; + if (filteredNodes.length === 0) { + return node && new TopDownTreeIterator(node, { pruneCollapsed: false }); + } + if (node && filteredNodes.indexOf(node) === -1) { + return undefined; + } + return Iterators.cycle(filteredNodes, node); + } + + protected createIterator(node: TreeNode | undefined): TreeIterator | undefined { + const { filteredNodes } = this.treeSearch; + if (filteredNodes.length === 0) { + return node && this.createForwardIteratorForNode(node); + } + if (node && filteredNodes.indexOf(node) === -1) { + return undefined; + } + return Iterators.cycle(filteredNodes, node); + } + + protected createForwardIteratorForNode(node: TreeNode): TreeIterator { + return new TopDownTreeIterator(node, { pruneCollapsed: true }); + } + + openNode(raw?: TreeNode | undefined): void { + const node = raw ?? this.focusService.focusedNode; + if (node) { + this.doOpenNode(node); + this.onOpenNodeEmitter.fire(node); + } + } + + protected doOpenNode(node: TreeNode): void { + if (ExpandableTreeNode.is(node)) { + this.toggleNodeExpansion(node); + } + } + + selectParent(): void { + const node = this.getFocusedNode(); + if (node) { + const parent = SelectableTreeNode.getVisibleParent(node); + if (parent) { + this.selectNode(parent); + } + } + } + + async navigateTo(nodeOrId: TreeNode | string | undefined): Promise { + if (nodeOrId) { + const node = typeof nodeOrId === 'string' ? this.getNode(nodeOrId) : nodeOrId; + if (node) { + this.navigationService.push(node); + await this.doNavigate(node); + return node; + } + } + return undefined; + } + + canNavigateForward(): boolean { + return !!this.navigationService.next; + } + + canNavigateBackward(): boolean { + return !!this.navigationService.prev; + } + + async navigateForward(): Promise { + const node = this.navigationService.advance(); + if (node) { + await this.doNavigate(node); + } + } + + async navigateBackward(): Promise { + const node = this.navigationService.retreat(); + if (node) { + await this.doNavigate(node); + } + } + + protected async doNavigate(node: TreeNode): Promise { + this.tree.root = node; + if (ExpandableTreeNode.is(node)) { + await this.expandNode(node); + } + if (SelectableTreeNode.is(node)) { + this.selectNode(node); + } + } + + addSelection(selectionOrTreeNode: TreeSelection | Readonly): void { + this.selectionService.addSelection(selectionOrTreeNode); + } + + clearSelection(): void { + this.selectionService.clearSelection(); + } + + selectNode(node: Readonly): void { + this.addSelection(node); + } + + toggleNode(node: Readonly): void { + this.addSelection({ node, type: TreeSelection.SelectionType.TOGGLE }); + } + + selectRange(node: Readonly): void { + this.addSelection({ node, type: TreeSelection.SelectionType.RANGE }); + } + + storeState(): TreeModelImpl.State { + return { + selection: this.selectionService.storeState() + }; + } + + restoreState(state: TreeModelImpl.State): void { + if (state.selection) { + this.selectionService.restoreState(state.selection); + } + } + + get onDidChangeBusy(): Event { + return this.tree.onDidChangeBusy; + } + + markAsBusy(node: Readonly, ms: number, token: CancellationToken): Promise { + return this.tree.markAsBusy(node, ms, token); + } + + get onDidUpdate(): Event { + return this.tree.onDidUpdate; + } + + markAsChecked(node: TreeNode, checked: boolean): void { + this.tree.markAsChecked(node, checked); + } + +} +export namespace TreeModelImpl { + export interface State { + selection: object + } +} diff --git a/packages/core/src/browser/tree/tree-navigation.ts b/packages/core/src/browser/tree/tree-navigation.ts new file mode 100644 index 0000000..e966503 --- /dev/null +++ b/packages/core/src/browser/tree/tree-navigation.ts @@ -0,0 +1,58 @@ +// ***************************************************************************** +// Copyright (C) 2017 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { injectable } from 'inversify'; +import { TreeNode } from './tree'; + +@injectable() +export class TreeNavigationService { + + protected index: number = -1; + protected nodes: TreeNode[] = []; + + get next(): TreeNode | undefined { + return this.nodes[this.index + 1]; + } + + get prev(): TreeNode | undefined { + return this.nodes[this.index - 1]; + } + + advance(): TreeNode | undefined { + const node = this.next; + if (node) { + this.index = this.index + 1; + return node; + } + return undefined; + } + + retreat(): TreeNode | undefined { + const node = this.prev; + if (node) { + this.index = this.index - 1; + return node; + } + return undefined; + } + + push(node: TreeNode): void { + this.nodes = this.nodes.slice(0, this.index + 1); + this.nodes.push(node); + this.index = this.index + 1; + } + +} diff --git a/packages/core/src/browser/tree/tree-search.ts b/packages/core/src/browser/tree/tree-search.ts new file mode 100644 index 0000000..a6e5d9a --- /dev/null +++ b/packages/core/src/browser/tree/tree-search.ts @@ -0,0 +1,128 @@ +// ***************************************************************************** +// Copyright (C) 2018 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { inject, injectable, postConstruct } from 'inversify'; +import { Disposable, DisposableCollection } from '../../common/disposable'; +import { Event, Emitter } from '../../common/event'; +import { Tree, TreeNode } from './tree'; +import { TreeDecoration } from './tree-decorator'; +import { FuzzySearch } from './fuzzy-search'; +import { TopDownTreeIterator } from './tree-iterator'; +import { LabelProvider } from '../label-provider'; + +@injectable() +export class TreeSearch implements Disposable { + + @inject(Tree) + protected readonly tree: Tree; + + @inject(FuzzySearch) + protected readonly fuzzySearch: FuzzySearch; + + @inject(LabelProvider) + protected readonly labelProvider: LabelProvider; + + protected readonly disposables = new DisposableCollection(); + protected readonly filteredNodesEmitter = new Emitter>>(); + + protected _filterResult: FuzzySearch.Match[] = []; + protected _filteredNodes: ReadonlyArray> = []; + protected _filteredNodesAndParents: Set = new Set(); + + @postConstruct() + protected init(): void { + this.disposables.push(this.filteredNodesEmitter); + } + + getHighlights(): Map { + return new Map(this._filterResult.map(m => [m.item.id, this.toCaptionHighlight(m)] as [string, TreeDecoration.CaptionHighlight])); + } + + /** + * Resolves to all the visible tree nodes that match the search pattern. + */ + async filter(pattern: string | undefined): Promise>> { + const { root } = this.tree; + this._filteredNodesAndParents = new Set(); + if (!pattern || !root) { + this._filterResult = []; + this._filteredNodes = []; + this.fireFilteredNodesChanged(this._filteredNodes); + return []; + } + const items = [...new TopDownTreeIterator(root)]; + const transform = (node: TreeNode) => this.labelProvider.getName(node); + this._filterResult = await this.fuzzySearch.filter({ + items, + pattern, + transform + }); + this._filteredNodes = this._filterResult.map(({ item }) => { + this.addAllParentsToFilteredSet(item); + return item; + }); + this.fireFilteredNodesChanged(this._filteredNodes); + return this._filteredNodes.slice(); + } + + protected addAllParentsToFilteredSet(node: TreeNode): void { + let toAdd: TreeNode | undefined = node; + while (toAdd && !this._filteredNodesAndParents.has(toAdd.id)) { + this._filteredNodesAndParents.add(toAdd.id); + toAdd = toAdd.parent; + }; + } + + /** + * Returns with the filtered nodes after invoking the `filter` method. + */ + get filteredNodes(): ReadonlyArray> { + return this._filteredNodes.slice(); + } + + /** + * Event that is fired when the filtered nodes have been changed. + */ + get onFilteredNodesChanged(): Event>> { + return this.filteredNodesEmitter.event; + } + + passesFilters(node: TreeNode): boolean { + return this._filteredNodesAndParents.has(node.id); + } + + dispose(): void { + this.disposables.dispose(); + } + + protected fireFilteredNodesChanged(nodes: ReadonlyArray>): void { + this.filteredNodesEmitter.fire(nodes); + } + + protected toCaptionHighlight(match: FuzzySearch.Match): TreeDecoration.CaptionHighlight { + return { + ranges: match.ranges.map(this.mapRange.bind(this)) + }; + } + + protected mapRange(range: FuzzySearch.Range): TreeDecoration.CaptionHighlight.Range { + const { offset, length } = range; + return { + offset, + length + }; + } +} diff --git a/packages/core/src/browser/tree/tree-selectable.spec.ts b/packages/core/src/browser/tree/tree-selectable.spec.ts new file mode 100644 index 0000000..b8cc16d --- /dev/null +++ b/packages/core/src/browser/tree/tree-selectable.spec.ts @@ -0,0 +1,152 @@ +// ***************************************************************************** +// Copyright (C) 2018 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { TreeNode } from './tree'; +import { TreeModel } from './tree-model'; +import { notEmpty } from '../../common/objects'; +import { expect } from 'chai'; +import { createTreeTestContainer } from './test/tree-test-container'; +import { SelectableTreeNode } from './tree-selection'; +import { MockSelectableTreeModel } from './test/mock-selectable-tree-model'; +import { ExpandableTreeNode } from './tree-expansion'; + +describe('Selectable Tree', () => { + let model: TreeModel; + function assertNodeRetrieval(method: () => TreeNode | undefined, sequence: string[]): void { + for (const expectedNodeId of sequence) { + const actualNode = method(); + const expectedNode = retrieveNode(expectedNodeId); + expect(actualNode?.id).to.be.equal(expectedNode.id); + model.addSelection(expectedNode); + } + } + function assertNodeSelection(method: () => void, sequence: string[]): void { + for (const expectedNodeId of sequence) { + method(); + const node = retrieveNode(expectedNodeId); + expect(node.selected).to.be.true; + } + } + describe('Get and Set Next Nodes Methods', () => { + const uncollapsedSelectionOrder = ['1.1', '1.1.1', '1.1.2', '1.2', '1.2.1', '1.2.1.1', '1.2.1.2', '1.2.2', '1.2.3', '1.3']; + const collapsedSelectionOrder = ['1.1', '1.2', '1.2.1', '1.2.2', '1.2.3', '1.3']; + beforeEach(() => { + model = createTreeModel(); + model.root = MockSelectableTreeModel.HIERARCHICAL_MOCK_ROOT(); + model.addSelection(retrieveNode('1')); + + }); + it('`getNextNode()` should select each node in sequence (uncollapsed)', done => { + assertNodeRetrieval(model.getNextNode.bind(model), uncollapsedSelectionOrder); + done(); + }); + it('`getNextNode()` should select each node in sequence (collapsed)', done => { + collapseNode('1.1', '1.2.1'); + assertNodeRetrieval(model.getNextNode.bind(model), uncollapsedSelectionOrder); + done(); + }); + it('`getNextSelectableNode()` should select each node in sequence (uncollapsed)', done => { + assertNodeRetrieval(model.getNextSelectableNode.bind(model), uncollapsedSelectionOrder); + done(); + }); + it('`getNextSelectableNode()` should select each node in sequence (collapsed)', done => { + collapseNode('1.1', '1.2.1'); + assertNodeRetrieval(model.getNextSelectableNode.bind(model), collapsedSelectionOrder); + done(); + }); + it('`selectNext()` should select each node in sequence (uncollapsed)', done => { + assertNodeSelection(model.selectNext.bind(model), uncollapsedSelectionOrder); + done(); + }); + it('`selectNext()` should select each node in sequence (collapsed)', done => { + collapseNode('1.1', '1.2.1'); + assertNodeSelection(model.selectNext.bind(model), uncollapsedSelectionOrder); + done(); + }); + it('`selectNextNode()` should select each node in sequence (uncollapsed)', done => { + assertNodeSelection(model.selectNextNode.bind(model), uncollapsedSelectionOrder); + done(); + }); + it('`selectNextNode()` should select each node in sequence (collapsed)', done => { + collapseNode('1.1', '1.2.1'); + assertNodeSelection(model.selectNextNode.bind(model), collapsedSelectionOrder); + done(); + }); + }); + + describe('Get and Set Previous Nodes Methods', () => { + const uncollapsedSelectionOrder = ['1.2.3', '1.2.2', '1.2.1.2', '1.2.1.1', '1.2.1', '1.2', '1.1.2', '1.1.1', '1.1']; + const collapsedSelectionOrder = ['1.2.3', '1.2.2', '1.2.1', '1.2', '1.1']; + beforeEach(() => { + model = createTreeModel(); + model.root = MockSelectableTreeModel.HIERARCHICAL_MOCK_ROOT(); + model.addSelection(retrieveNode('1.3')); + }); + it('`getPrevNode()` should select each node in reverse sequence (uncollapsed)', done => { + assertNodeRetrieval(model.getPrevNode.bind(model), uncollapsedSelectionOrder); + done(); + }); + it('`getPrevNode()` should select each node in reverse sequence (collapsed)', done => { + collapseNode('1.1', '1.2.1'); + assertNodeRetrieval(model.getPrevNode.bind(model), uncollapsedSelectionOrder); + done(); + }); + it('`getPrevSelectableNode()` should select each node in reverse sequence (uncollapsed)', done => { + assertNodeRetrieval(model.getPrevSelectableNode.bind(model), uncollapsedSelectionOrder); + done(); + }); + it('`getPrevSelectableNode()` should select each node in reverse sequence (collapsed)', done => { + collapseNode('1.1', '1.2.1'); + assertNodeRetrieval(model.getPrevSelectableNode.bind(model), collapsedSelectionOrder); + done(); + }); + it('`selectPrev()` should select each node in reverse sequence (uncollapsed)', done => { + assertNodeSelection(model.selectPrev.bind(model), uncollapsedSelectionOrder); + done(); + }); + it('`selectPrev()` should select each node in reverse sequence (collapsed)', done => { + collapseNode('1.1', '1.2.1'); + assertNodeSelection(model.selectPrev.bind(model), uncollapsedSelectionOrder); + done(); + }); + it('`selectPrevNode()` should select each node in reverse sequence (uncollapsed)', done => { + assertNodeSelection(model.selectPrevNode.bind(model), uncollapsedSelectionOrder); + done(); + }); + it('`selectPrevNode()` should select each node in reverse sequence (collapsed)', done => { + collapseNode('1.1', '1.2.1'); + assertNodeSelection(model.selectPrevNode.bind(model), collapsedSelectionOrder); + done(); + }); + }); + + const findNode = (id: string) => model.getNode(id); + function createTreeModel(): TreeModel { + const container = createTreeTestContainer(); + return container.get(TreeModel); + } + function retrieveNode(id: string): Readonly { + const readonlyNode: Readonly = model.getNode(id) as T; + return readonlyNode; + } + function collapseNode(...ids: string[]): void { + ids.map(findNode).filter(notEmpty).filter(ExpandableTreeNode.is).forEach(node => { + model.collapseNode(node); + expect(node).to.have.property('expanded', false); + }); + } + +}); diff --git a/packages/core/src/browser/tree/tree-selection-impl.ts b/packages/core/src/browser/tree/tree-selection-impl.ts new file mode 100644 index 0000000..4ba7ba2 --- /dev/null +++ b/packages/core/src/browser/tree/tree-selection-impl.ts @@ -0,0 +1,176 @@ +// ***************************************************************************** +// Copyright (C) 2018 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { injectable, inject, postConstruct } from 'inversify'; +import { Tree, TreeNode } from './tree'; +import { Event, Emitter } from '../../common'; +import { TreeSelectionState, FocusableTreeSelection } from './tree-selection-state'; +import { TreeSelectionService, SelectableTreeNode, TreeSelection } from './tree-selection'; +import { TreeFocusService } from './tree-focus-service'; + +@injectable() +export class TreeSelectionServiceImpl implements TreeSelectionService { + + @inject(Tree) protected readonly tree: Tree; + @inject(TreeFocusService) protected readonly focusService: TreeFocusService; + + protected readonly onSelectionChangedEmitter = new Emitter>>(); + + protected state: TreeSelectionState; + + @postConstruct() + protected init(): void { + this.state = new TreeSelectionState(this.tree); + } + + dispose(): void { + this.onSelectionChangedEmitter.dispose(); + } + + get selectedNodes(): ReadonlyArray> { + return this.state.selection(); + } + + get onSelectionChanged(): Event>> { + return this.onSelectionChangedEmitter.event; + } + + protected fireSelectionChanged(): void { + this.onSelectionChangedEmitter.fire(this.state.selection()); + } + + addSelection(selectionOrTreeNode: TreeSelection | Readonly): void { + const selection = ((arg: TreeSelection | Readonly): TreeSelection => { + const type = TreeSelection.SelectionType.DEFAULT; + if (TreeSelection.is(arg)) { + return { + type, + ...arg + }; + } + return { + type, + node: arg + }; + })(selectionOrTreeNode); + + const node = this.validateNode(selection.node); + if (node === undefined) { + return; + } + Object.assign(selection, { node }); + + const newState = this.state.nextState(selection); + this.transiteTo(newState); + } + + clearSelection(): void { + this.transiteTo(new TreeSelectionState(this.tree), false); + } + + protected transiteTo(newState: TreeSelectionState, setFocus = true): void { + const oldNodes = this.state.selection(); + const newNodes = newState.selection(); + + const toUnselect = this.difference(oldNodes, newNodes); + const toSelect = this.difference(newNodes, oldNodes); + + this.unselect(toUnselect); + this.select(toSelect); + this.removeFocus(oldNodes, newNodes); + if (setFocus) { + this.addFocus(newState.node); + } + + this.state = newState; + this.fireSelectionChanged(); + } + + protected unselect(nodes: ReadonlyArray): void { + nodes.forEach(node => node.selected = false); + } + + protected select(nodes: ReadonlyArray): void { + nodes.forEach(node => node.selected = true); + } + + protected removeFocus(...nodes: ReadonlyArray[]): void { + nodes.forEach(node => node.forEach(n => n.focus = false)); + } + + protected addFocus(node: SelectableTreeNode | undefined): void { + if (node) { + node.focus = true; + } + this.focusService.setFocus(node); + } + + /** + * Returns an array of the difference of two arrays. The returned array contains all elements that are contained by + * `left` and not contained by `right`. `right` may also contain elements not present in `left`: these are simply ignored. + */ + protected difference(left: ReadonlyArray, right: ReadonlyArray): ReadonlyArray { + return left.filter(item => right.indexOf(item) === -1); + } + + /** + * Returns a reference to the argument if the node exists in the tree. Otherwise, `undefined`. + */ + protected validateNode(node: Readonly): Readonly | undefined { + const result = this.tree.validateNode(node); + return SelectableTreeNode.is(result) ? result : undefined; + } + + storeState(): TreeSelectionServiceImpl.State { + return { + selectionStack: this.state.selectionStack.map(s => ({ + focus: s.focus && s.focus.id || undefined, + node: s.node && s.node.id || undefined, + type: s.type + })) + }; + } + + restoreState(state: TreeSelectionServiceImpl.State): void { + const selectionStack: FocusableTreeSelection[] = []; + for (const selection of state.selectionStack) { + const node = selection.node && this.tree.getNode(selection.node) || undefined; + if (!SelectableTreeNode.is(node)) { + break; + } + const focus = selection.focus && this.tree.getNode(selection.focus) || undefined; + selectionStack.push({ + node, + focus: SelectableTreeNode.is(focus) && focus || undefined, + type: selection.type + }); + } + if (selectionStack.length) { + this.transiteTo(new TreeSelectionState(this.tree, selectionStack)); + } + } + +} +export namespace TreeSelectionServiceImpl { + export interface State { + selectionStack: ReadonlyArray + } + export interface FocusableTreeSelectionState { + focus?: string + node?: string + type?: TreeSelection.SelectionType + } +} diff --git a/packages/core/src/browser/tree/tree-selection-state.spec.ts b/packages/core/src/browser/tree/tree-selection-state.spec.ts new file mode 100644 index 0000000..2c6cc15 --- /dev/null +++ b/packages/core/src/browser/tree/tree-selection-state.spec.ts @@ -0,0 +1,462 @@ +// ***************************************************************************** +// Copyright (C) 2018 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { expect } from 'chai'; +import { MockTreeModel } from './test/mock-tree-model'; +import { createTreeTestContainer } from './test/tree-test-container'; +import { TreeModel } from './tree-model'; +import { SelectableTreeNode, TreeSelection } from './tree-selection'; +import { TreeSelectionState } from './tree-selection-state'; + +namespace TreeSelectionState { + + export interface Expectation { + readonly focus?: string | undefined; + readonly selection?: string[]; + } + + export interface Assert { + readonly nextState: (type: 'default' | 'toggle' | 'range', nodeId: string, expectation?: Expectation) => Assert; + } + +} + +const LARGE_FLAT_MOCK_ROOT = (length = 250000) => { + const children = Array.from({ length }, (_, idx) => ({ 'id': (idx + 1).toString() })); + return MockTreeModel.Node.toTreeNode({ + 'id': 'ROOT', + 'children': [ + ...children + ] + }); +}; + +describe('tree-selection-state', () => { + + const model = createTreeModel(); + const findNode = (nodeId: string) => model.getNode(nodeId) as (SelectableTreeNode); + + beforeEach(() => { + model.root = MockTreeModel.FLAT_MOCK_ROOT(); + expect(model.selectedNodes).to.be.empty; + }); + + it('should remove the selection but not the focus when toggling the one and only selected node', () => { + newState() + .nextState('toggle', '1', { + focus: '1', + selection: ['1'] + }) + .nextState('toggle', '1', { + focus: '1', + selection: [] + }); + }); + + it('should keep the focus on the `fromNode` when selecting a range', () => { + newState() + .nextState('toggle', '1') + .nextState('range', '3', { + focus: '1', + selection: ['1', '2', '3'] + }); + }); + + it('should always have one single focus node when toggling node in a range', () => { + newState() + .nextState('toggle', '1') + .nextState('range', '3') + .nextState('toggle', '2', { + focus: '1', + selection: ['1', '3'] + }) + .nextState('toggle', '2', { + focus: '1', + selection: ['1', '2', '3'] + }); + }); + + it('should calculate the range from the focus even unselecting a node in the previously created range', () => { + newState() + .nextState('toggle', '5') + .nextState('range', '2', { + focus: '5', + selection: ['2', '3', '4', '5'] + }) + .nextState('toggle', '3', { + focus: '5', + selection: ['2', '4', '5'] + }) + .nextState('range', '7', { + focus: '5', + selection: ['2', '4', '5', '6', '7'] + }); + }); + + it('should discard the previous range selection state if the current one has the same focus with other direction', () => { + newState() + .nextState('toggle', '4') + .nextState('range', '1') + .nextState('range', '6', { + focus: '4', + selection: ['4', '5', '6'] + }); + }); + + it('should discard the previous range selection state if the current one overlaps the previous one', () => { + newState() + .nextState('toggle', '4') + .nextState('range', '6') + .nextState('range', '8', { + focus: '4', + selection: ['4', '5', '6', '7', '8'] + }); + }); + + it('should move the focus to the most recently selected node if the previous selection was a toggle', () => { + newState() + .nextState('toggle', '4') + .nextState('toggle', '5', { + focus: '5', + selection: ['4', '5'] + }); + }); + + it('should keep the focus on the previous node if the current toggling happens in the most recent range', () => { + newState() + .nextState('toggle', '4') + .nextState('range', '2', { + focus: '4', + selection: ['4', '3', '2'] + }); + }); + + it('should move the focus to the next toggle node if that is out of the latest range selection', () => { + newState() + .nextState('toggle', '3') + .nextState('range', '5', { + focus: '3', + selection: ['3', '4', '5'] + }) + .nextState('toggle', '1', { + focus: '1', + selection: ['3', '4', '5', '1'] + }); + }); + + it('should not change the focus when removing a selection from an individual node', () => { + newState() + .nextState('toggle', '3') + .nextState('range', '5', { + focus: '3', + selection: ['5', '4', '3'] + }) + .nextState('toggle', '1', { + focus: '1', + selection: ['1', '5', '4', '3'] + }) + .nextState('toggle', '4', { + focus: '1', + selection: ['1', '5', '3'] + }); + }); + + it('should discard the previously selected range if each node from the previous range is contained in the current one', () => { + newState() + .nextState('toggle', '5') + .nextState('range', '2') + .nextState('toggle', '3', { + focus: '5', + selection: ['5', '4', '2'] + }) + .nextState('range', '1', { + focus: '5', + selection: ['5', '4', '3', '2', '1'] + }) + .nextState('range', '7', { + focus: '5', + selection: ['5', '6', '7'] + }); + }); + + it('should be possible to remove the selection of a node which is contained in two overlapping ranges', () => { + newState() + .nextState('toggle', '5') + .nextState('range', '4') + .nextState('toggle', '3') + .nextState('range', '2', { + focus: '3', + selection: ['2', '3', '4', '5'] + }) + .nextState('range', '5', { + focus: '3', + selection: ['5', '4', '3'] + }) + .nextState('toggle', '4', { + focus: '3', + selection: ['5', '3'] + }); + }); + + it('should be possible to traverse with range selections', () => { + newState() + .nextState('toggle', '2') + .nextState('range', '3', { + focus: '2', // In VSCode this is 3. + selection: ['2', '3'] + }) + .nextState('range', '4', { + focus: '2', // In VSCode this is 4. They distinguish between `Shift + Up Arrow` and `Shift + Click`. + selection: ['2', '3', '4'] + }); + }); + + it('should remove the selection from a node inside a range instead of setting the focus', () => { + newState() + .nextState('toggle', '2') + .nextState('range', '3', { + focus: '2', + selection: ['2', '3'] + }) + .nextState('toggle', '5', { + focus: '5', + selection: ['2', '3', '5'] + }) + .nextState('range', '6', { + focus: '5', + selection: ['2', '3', '5', '6'] + }) + .nextState('toggle', '3', { + focus: '5', + selection: ['2', '5', '6'] + }); + }); + + it('should merge all individual selections into a range', () => { + newState() + .nextState('toggle', '1') + .nextState('toggle', '3') + .nextState('toggle', '6') + .nextState('toggle', '2') + .nextState('range', '7', { + focus: '2', + selection: ['1', '2', '3', '4', '5', '6', '7'] + }); + }); + + it('should keep focus on the most recent even when removing selection from individual nodes', () => { + newState() + .nextState('toggle', '9') + .nextState('range', '6', { + focus: '9', + selection: ['9', '8', '7', '6'] + }) + .nextState('range', '10', { + focus: '9', + selection: ['9', '10'] + }) + .nextState('range', '2', { + focus: '9', + selection: ['9', '8', '7', '6', '5', '4', '3', '2'] + }) + .nextState('toggle', '4', { + focus: '9', + selection: ['9', '8', '7', '6', '5', '3', '2'] + }) + .nextState('toggle', '5', { + focus: '9', + selection: ['9', '8', '7', '6', '3', '2'] + }) + .nextState('toggle', '6', { + focus: '9', + selection: ['9', '8', '7', '3', '2'] + }) + .nextState('toggle', '7', { + focus: '9', + selection: ['9', '8', '3', '2'] + }) + .nextState('range', '5', { + focus: '9', + selection: ['9', '8', '7', '6', '5', '3', '2'] + }); + }); + + it('should expand the range instead of discarding it if individual elements have created a hole in the range', () => { + newState() + .nextState('toggle', '9') + .nextState('range', '3', { + focus: '9', + selection: ['9', '8', '7', '6', '5', '4', '3'] + }) + .nextState('toggle', '4', { + focus: '9', + selection: ['9', '8', '7', '6', '5', '3'] + }) + .nextState('range', '10', { + focus: '9', + selection: ['10', '9', '8', '7', '6', '5', '3'] + }); + }); + + it('should reset the selection state and the focus when using the default selection', () => { + newState() + .nextState('toggle', '1') + .nextState('toggle', '2', { + focus: '2', + selection: ['1', '2'] + }) + .nextState('default', '2', { + focus: '2', + selection: ['2'] + }) + .nextState('toggle', '1', { + focus: '1', + selection: ['1', '2'] + }) + .nextState('default', '2', { + focus: '2', + selection: ['2'] + }); + }); + + it('should remove the selection but keep the focus when toggling the single selected node', () => { + newState() + .nextState('toggle', '1', { + focus: '1', + selection: ['1'] + }) + .nextState('toggle', '1', { + focus: '1', + selection: [] + }); + }); + + it('should treat ranges with the same from and to node as a single element range', () => { + newState() + .nextState('toggle', '2') + .nextState('range', '1', { + focus: '2', + selection: ['1', '2'] + }) + .nextState('range', '2', { + focus: '2', + selection: ['2'] + }) + .nextState('range', '3', { + focus: '2', + selection: ['2', '3'] + }) + .nextState('range', '2', { + focus: '2', + selection: ['2'] + }) + .nextState('range', '1', { + focus: '2', + selection: ['1', '2'] + }); + }); + + it('should remember the most recent range selection start after toggling individual nodes', () => { + newState() + .nextState('toggle', '10', { + focus: '10', + selection: ['10'] + }) + .nextState('range', '3', { + focus: '10', + selection: ['3', '4', '5', '6', '7', '8', '9', '10'] + }) + .nextState('toggle', '7', { + focus: '10', + selection: ['3', '4', '5', '6', '8', '9', '10'] + }) + .nextState('toggle', '8', { + focus: '10', + selection: ['3', '4', '5', '6', '9', '10'] + }) + .nextState('toggle', '6', { + focus: '10', + selection: ['3', '4', '5', '9', '10'] + }) + .nextState('toggle', '5', { + focus: '10', + selection: ['3', '4', '9', '10'] + }) + .nextState('range', '2', { + focus: '10', + selection: ['2', '3', '4', '5', '6', '7', '8', '9', '10'] + }); + }); + + it('should be able to handle range selection on large tree', () => { + model.root = LARGE_FLAT_MOCK_ROOT(); + expect(model.selectedNodes).to.be.empty; + + const start = 10; + const end = 20; + newState() + .nextState('toggle', start.toString(), { + focus: start.toString(), + selection: [start.toString()] + }) + .nextState('range', end.toString(), { + focus: start.toString(), + selection: Array.from({ length: end - start + 1 }, (_, idx) => (start + idx).toString()) + }); + }); + + function newState(): TreeSelectionState.Assert { + return nextState(new TreeSelectionState(model)); + } + + function nextState(state: TreeSelectionState): TreeSelectionState.Assert { + return { + nextState: (nextType, nextId, expectation) => { + const node = findNode(nextId); + const type = ((t: 'default' | 'toggle' | 'range') => { + switch (t) { + case 'default': return TreeSelection.SelectionType.DEFAULT; + case 'toggle': return TreeSelection.SelectionType.TOGGLE; + case 'range': return TreeSelection.SelectionType.RANGE; + default: throw new Error(`Unexpected selection type: ${t}.`); + } + })(nextType); + const next = state.nextState({ node, type }); + if (!!expectation) { + const { focus, selection } = expectation; + if ('focus' in expectation) { + if (focus === undefined) { + expect(next.focus).to.be.undefined; + } else { + expect(next.focus).to.be.not.undefined; + expect(next.focus!.id).to.be.equal(focus); + // TODO: we need tree-selection tests too, otherwise, we cannot verify whether there is one focus or not. + } + } + if (selection) { + expect(next.selection().map(n => n.id).sort()).to.be.deep.equal(selection.sort()); + } + } + return nextState(next); + } + }; + } + + function createTreeModel(): TreeModel { + return createTreeTestContainer().get(TreeModel); + } + +}); diff --git a/packages/core/src/browser/tree/tree-selection-state.ts b/packages/core/src/browser/tree/tree-selection-state.ts new file mode 100644 index 0000000..ef9f92a --- /dev/null +++ b/packages/core/src/browser/tree/tree-selection-state.ts @@ -0,0 +1,245 @@ +// ***************************************************************************** +// Copyright (C) 2018 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { Tree, TreeNode } from './tree'; +import { DepthFirstTreeIterator } from './tree-iterator'; +import { TreeSelection, SelectableTreeNode } from './tree-selection'; + +/** + * A tree selection that might contain additional information about the tree node that has the focus. + */ +export interface FocusableTreeSelection extends TreeSelection { + + /** + * The tree node that has the focus in the tree selection. In case of a range selection, + * the `focus` differs from the `node`. + */ + readonly focus?: SelectableTreeNode; + +} + +export namespace FocusableTreeSelection { + + /** + * `true` if the argument is a focusable tree selection. Otherwise, `false`. + */ + export function is(arg: unknown): arg is FocusableTreeSelection { + return TreeSelection.is(arg) && 'focus' in arg; + } + + /** + * Returns with the tree node that has the focus if the argument is a focusable tree selection. + * Otherwise, returns `undefined`. + */ + export function focus(arg: TreeSelection | undefined): SelectableTreeNode | undefined { + return is(arg) ? arg.focus : undefined; + } +} + +/** + * Class for representing and managing the selection state and the focus of a tree. + */ +export class TreeSelectionState { + + constructor( + protected readonly tree: Tree, + readonly selectionStack: ReadonlyArray = []) { + } + + nextState(selection: FocusableTreeSelection): TreeSelectionState { + const { node, type } = { + type: TreeSelection.SelectionType.DEFAULT, + ...selection + }; + switch (type) { + case TreeSelection.SelectionType.DEFAULT: return this.handleDefault(this, node); + case TreeSelection.SelectionType.TOGGLE: return this.handleToggle(this, node); + case TreeSelection.SelectionType.RANGE: return this.handleRange(this, node); + default: throw new Error(`Unexpected tree selection type: ${type}.`); + } + } + + selection(): ReadonlyArray { + const copy = this.checkNoDefaultSelection(this.selectionStack); + const nodeIds = new Set(); + for (let i = 0; i < copy.length; i++) { + const { node, type } = copy[i]; + if (TreeSelection.isRange(type)) { + const selection = copy[i]; + for (const id of this.selectionRange(selection).map(n => n.id)) { + nodeIds.add(id); + } + } else if (TreeSelection.isToggle(type)) { + if (nodeIds.has(node.id)) { + nodeIds.delete(node.id); + } else { + nodeIds.add(node.id); + } + } + } + return Array.from(nodeIds.keys()).map(id => this.tree.getNode(id)).filter(SelectableTreeNode.is).reverse(); + } + + get focus(): SelectableTreeNode | undefined { + const copy = this.checkNoDefaultSelection(this.selectionStack); + const candidate = copy[copy.length - 1]?.focus; + return this.toSelectableTreeNode(candidate); + } + + get node(): SelectableTreeNode | undefined { + const copy = this.checkNoDefaultSelection(this.selectionStack); + return this.toSelectableTreeNode(copy[copy.length - 1]?.node); + } + + protected handleDefault(state: TreeSelectionState, node: Readonly): TreeSelectionState { + const { tree } = state; + return new TreeSelectionState(tree, [{ + node, + type: TreeSelection.SelectionType.TOGGLE, + focus: node + }]); + } + + protected handleToggle(state: TreeSelectionState, node: Readonly): TreeSelectionState { + const { tree, selectionStack } = state; + const copy = this.checkNoDefaultSelection(selectionStack).slice(); + const focus = (() => { + const allRanges = copy.filter(selection => TreeSelection.isRange(selection)); + for (let i = allRanges.length - 1; i >= 0; i--) { + const latestRangeIndex = copy.indexOf(allRanges[i]); + const latestRangeSelection = copy[latestRangeIndex]; + const latestRange = latestRangeSelection?.focus ? this.selectionRange(latestRangeSelection) : []; + if (latestRange.indexOf(node) !== -1) { + if (this.focus === latestRangeSelection.focus) { + return latestRangeSelection.focus || node; + } else { + return this.focus; + } + } + } + return node; + })(); + return new TreeSelectionState(tree, [...copy, { + node, + type: TreeSelection.SelectionType.TOGGLE, + focus + }]); + } + + protected handleRange(state: TreeSelectionState, node: Readonly): TreeSelectionState { + const { tree, selectionStack } = state; + const copy = this.checkNoDefaultSelection(selectionStack).slice(); + let focus = FocusableTreeSelection.focus(copy[copy.length - 1]); + + // Drop the previous range when we are trying to modify that. + if (TreeSelection.isRange(copy[copy.length - 1])) { + const range = this.selectionRange(copy.pop()!); + // And we drop all preceding individual nodes that were contained in the range we are dropping. + // That means, anytime we cover individual nodes with a range, they will belong to the range so we need to drop them now. + for (let i = copy.length - 1; i >= 0; i--) { + if (range.indexOf(copy[i].node) !== -1) { + // Make sure to keep a reference to the focus while we are discarding previous elements. Otherwise, we lose this information. + focus = copy[i].focus; + copy.splice(i, 1); + } + } + } + return new TreeSelectionState(tree, [...copy, { + node, + type: TreeSelection.SelectionType.RANGE, + focus + }]); + } + + /** + * Returns with an array of items representing the selection range. The from node is the `focus` the to node + * is the selected node itself on the tree selection. Both the `from` node and the `to` node are inclusive. + */ + protected selectionRange(selection: FocusableTreeSelection): Readonly[] { + const fromNode = selection.focus; + const toNode = selection.node; + if (fromNode === undefined) { + return []; + } + if (toNode === fromNode) { + return [toNode]; + } + const { root } = this.tree; + if (root === undefined) { + return []; + } + const to = this.tree.validateNode(toNode); + if (to === undefined) { + return []; + } + const from = this.tree.validateNode(fromNode); + if (from === undefined) { + return []; + } + let started = false; + let finished = false; + const range = []; + for (const node of new DepthFirstTreeIterator(root, { pruneCollapsed: true })) { + if (finished) { + break; + } + // Only collect items which are between (inclusive) the `from` node and the `to` node. + if (node === from || node === to) { + if (started) { + finished = true; + } else { + started = true; + } + } + if (started) { + range.push(node); + } + } + + // We need to reverse the selection range order. + if (range.indexOf(from) > range.indexOf(to)) { + range.reverse(); + } + return range.filter(SelectableTreeNode.is); + } + + protected toSelectableTreeNode(node: TreeNode | undefined): SelectableTreeNode | undefined { + if (!!node) { + const candidate = this.tree.getNode(node.id); + if (!!candidate) { + if (SelectableTreeNode.is(candidate)) { + return candidate; + } else { + console.warn(`Could not map to a selectable tree node. Node with ID: ${node.id} is not a selectable node.`); + } + } else { + console.warn(`Could not map to a selectable tree node. Node does not exist with ID: ${node.id}.`); + } + } + return undefined; + } + + /** + * Checks whether the argument contains any `DEFAULT` tree selection type. If yes, throws an error, otherwise returns with a reference the argument. + */ + protected checkNoDefaultSelection(selections: ReadonlyArray): ReadonlyArray { + if (selections.some(selection => selection.type === undefined || selection.type === TreeSelection.SelectionType.DEFAULT)) { + throw new Error(`Unexpected DEFAULT selection type. [${selections.map(selection => `ID: ${selection.node.id} | ${selection.type}`).join(', ')}]`); + } + return selections; + } + +} diff --git a/packages/core/src/browser/tree/tree-selection.ts b/packages/core/src/browser/tree/tree-selection.ts new file mode 100644 index 0000000..9f000be --- /dev/null +++ b/packages/core/src/browser/tree/tree-selection.ts @@ -0,0 +1,159 @@ +// ***************************************************************************** +// Copyright (C) 2017 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { TreeNode } from './tree'; +import { Event, Disposable, isObject, SelectionProvider } from '../../common'; + +/** + * The tree selection service. + */ +export const TreeSelectionService = Symbol('TreeSelectionService'); +export interface TreeSelectionService extends Disposable, SelectionProvider>> { + + /** + * The tree selection, representing the selected nodes from the tree. If nothing is selected, the + * result will be empty. + */ + readonly selectedNodes: ReadonlyArray>; + + /** + * Emitted when the selection has changed in the tree. + */ + readonly onSelectionChanged: Event>>; + + /** + * Registers the given selection into the tree selection service. If the selection state changes after adding the + * `selectionOrTreeNode` argument, a selection changed event will be fired. If the argument is a tree node, + * a it will be treated as a tree selection with the default selection type. + */ + addSelection(selectionOrTreeNode: TreeSelection | Readonly): void; + + /** + * Clears all selected nodes + */ + clearSelection(): void; + + /** + * Store selection state. + */ + storeState(): object; + + /** + * Restore selection state. + */ + restoreState(state: object): void; + +} + +/** + * Representation of a tree selection. + */ +export interface TreeSelection { + + /** + * The actual item that has been selected. + */ + readonly node: Readonly; + + /** + * The optional tree selection type. Defaults to `SelectionType.DEFAULT`; + */ + readonly type?: TreeSelection.SelectionType; + +} + +export namespace TreeSelection { + + /** + * Enumeration of selection types. + */ + export enum SelectionType { + DEFAULT, + TOGGLE, + RANGE + } + + export function is(arg: unknown): arg is TreeSelection { + return isObject(arg) && 'node' in arg; + } + + export function isRange(arg: TreeSelection | SelectionType | undefined): boolean { + return isSelectionTypeOf(arg, SelectionType.RANGE); + } + + export function isToggle(arg: TreeSelection | SelectionType | undefined): boolean { + return isSelectionTypeOf(arg, SelectionType.TOGGLE); + } + + function isSelectionTypeOf(arg: TreeSelection | SelectionType | undefined, expected: SelectionType): boolean { + if (arg === undefined) { + return false; + } + const type = typeof arg === 'number' ? arg : arg.type; + return type === expected; + } + +} + +/** + * A selectable tree node. + */ +export interface SelectableTreeNode extends TreeNode { + + /** + * `true` if the tree node is selected. Otherwise, `false`. + */ + selected: boolean; + + /** + * @deprecated @since 1.27.0. Use TreeFocusService to track the focused node. + * + * `true` if the tree node has the focus. Otherwise, `false`. Defaults to `false`. + */ + focus?: boolean; + +} + +export namespace SelectableTreeNode { + + export function is(node: unknown): node is SelectableTreeNode { + return TreeNode.is(node) && 'selected' in node; + } + + export function isSelected(node: unknown): node is SelectableTreeNode { + return is(node) && node.selected; + } + + /** + * @deprecated @since 1.27.0. Use TreeFocusService to track the focused node. + */ + export function hasFocus(node: TreeNode | undefined): boolean { + return is(node) && node.focus === true; + } + + export function isVisible(node: TreeNode | undefined): node is SelectableTreeNode { + return is(node) && TreeNode.isVisible(node); + } + + export function getVisibleParent(node: TreeNode | undefined): SelectableTreeNode | undefined { + if (node) { + if (isVisible(node.parent)) { + return node.parent; + } + return getVisibleParent(node.parent); + } + } +} diff --git a/packages/core/src/browser/tree/tree-view-welcome-widget.tsx b/packages/core/src/browser/tree/tree-view-welcome-widget.tsx new file mode 100644 index 0000000..8d0a354 --- /dev/null +++ b/packages/core/src/browser/tree/tree-view-welcome-widget.tsx @@ -0,0 +1,299 @@ +// ***************************************************************************** +// Copyright (C) 2020 SAP SE or an SAP affiliate company and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +/*--------------------------------------------------------------------------------------------- +* Copyright (c) Microsoft Corporation. All rights reserved. +* Licensed under the MIT License. See License.txt in the project root for license information. +*--------------------------------------------------------------------------------------------*/ +// some code is copied and modified from: https://github.com/microsoft/vscode/blob/573e5145ae3b50523925a6f6315d373e649d1b06/src/vs/base/common/linkedText.ts +// aligned the API and enablement behavior to https://github.com/microsoft/vscode/blob/c711bc9333ba339fde1a530de0094b3fa32f09de/src/vs/base/common/linkedText.ts + +import React = require('react'); +import { inject, injectable } from 'inversify'; +import { URI as CodeUri } from 'vscode-uri'; +import { CommandRegistry, DisposableCollection } from '../../common'; +import URI from '../../common/uri'; +import { ContextKeyService } from '../context-key-service'; +import { LabelIcon, LabelParser } from '../label-parser'; +import { OpenerService, open } from '../opener-service'; +import { codicon } from '../widgets'; +import { WindowService } from '../window/window-service'; +import { TreeModel } from './tree-model'; +import { TreeWidget } from './tree-widget'; + +export interface ViewWelcome { + readonly view: string; + readonly content: string; + readonly when?: string; + readonly enablement?: string; + readonly order: number; +} + +export interface IItem { + readonly welcomeInfo: ViewWelcome; + visible: boolean; +} + +export interface ILink { + readonly label: string; + readonly href: string; + readonly title?: string; +} + +type LinkedTextItem = string | ILink; + +@injectable() +export class TreeViewWelcomeWidget extends TreeWidget { + + @inject(CommandRegistry) + protected readonly commands: CommandRegistry; + + @inject(ContextKeyService) + protected readonly contextService: ContextKeyService; + + @inject(WindowService) + protected readonly windowService: WindowService; + + @inject(LabelParser) + protected readonly labelParser: LabelParser; + + @inject(OpenerService) + protected readonly openerService: OpenerService; + + protected readonly toDisposeBeforeUpdateViewWelcomeNodes = new DisposableCollection(); + + protected viewWelcomeNodes: React.ReactNode[] = []; + protected defaultItem: IItem | undefined; + protected items: IItem[] = []; + get visibleItems(): ViewWelcome[] { + const visibleItems = this.items.filter(v => v.visible); + if (visibleItems.length && this.defaultItem) { + return [this.defaultItem.welcomeInfo]; + } + return visibleItems.map(v => v.welcomeInfo); + } + + protected override renderTree(model: TreeModel): React.ReactNode { + if (this.shouldShowWelcomeView() && this.visibleItems.length) { + return this.renderViewWelcome(); + } + return super.renderTree(model); + } + + protected shouldShowWelcomeView(): boolean { + return false; + } + + protected renderViewWelcome(): React.ReactNode { + return ( +
    + {...this.viewWelcomeNodes} +
    + ); + } + + handleViewWelcomeContentChange(viewWelcomes: ViewWelcome[]): void { + this.items = []; + for (const welcomeInfo of viewWelcomes) { + if (welcomeInfo.when === 'default') { + this.defaultItem = { welcomeInfo, visible: true }; + } else { + const visible = welcomeInfo.when === undefined || this.contextService.match(welcomeInfo.when); + this.items.push({ welcomeInfo, visible }); + } + } + this.updateViewWelcomeNodes(); + this.update(); + } + + handleWelcomeContextChange(): void { + let didChange = false; + + for (const item of this.items) { + if (!item.welcomeInfo.when || item.welcomeInfo.when === 'default') { + continue; + } + + const visible = item.welcomeInfo.when === undefined || this.contextService.match(item.welcomeInfo.when); + + if (item.visible === visible) { + continue; + } + + item.visible = visible; + didChange = true; + } + + if (didChange) { + this.updateViewWelcomeNodes(); + this.update(); + } + } + + protected updateViewWelcomeNodes(): void { + this.viewWelcomeNodes = []; + this.toDisposeBeforeUpdateViewWelcomeNodes.dispose(); + const items = this.visibleItems.sort((a, b) => a.order - b.order); + + const enablementKeys: Set[] = []; + // the plugin-view-registry will push the changes when there is a change in the `when` prop which controls the visibility + // this listener is to update the enablement of the components in the view welcome + this.toDisposeBeforeUpdateViewWelcomeNodes.push( + this.contextService.onDidChange(event => { + if (enablementKeys.some(keys => event.affects(keys))) { + this.updateViewWelcomeNodes(); + this.update(); + } + }) + ); + // Note: VS Code does not support the `renderSecondaryButtons` prop in welcome content either. + for (const { content, enablement } of items) { + const itemEnablementKeys = enablement + ? this.contextService.parseKeys(enablement) + : undefined; + if (itemEnablementKeys) { + enablementKeys.push(itemEnablementKeys); + } + const lines = content.split('\n'); + + for (let line of lines) { + line = line.trim(); + + if (!line) { + continue; + } + + const linkedTextItems = this.parseLinkedText(line); + + if (linkedTextItems.length === 1 && typeof linkedTextItems[0] !== 'string') { + const node = linkedTextItems[0]; + this.viewWelcomeNodes.push( + this.renderButtonNode( + node, + this.viewWelcomeNodes.length, + enablement + ) + ); + } else { + const renderNode = (item: LinkedTextItem, index: number) => typeof item == 'string' + ? this.renderTextNode(item, index) + : this.renderLinkNode(item, index, enablement); + + this.viewWelcomeNodes.push( +

    + {...linkedTextItems.flatMap(renderNode)} +

    + ); + } + } + } + } + + protected renderButtonNode(node: ILink, lineKey: string | number, enablement: string | undefined): React.ReactNode { + return ( +
    + +
    + ); + } + + protected renderTextNode(node: string, textKey: string | number): React.ReactNode { + return + {this.labelParser.parse(node) + .map((segment, index) => + LabelIcon.is(segment) + ? + : {segment})}; + } + + protected renderLinkNode(node: ILink, linkKey: string | number, enablement: string | undefined): React.ReactNode { + return ( + this.openLinkOrCommand(e, node.href)}> + {node.label} + + ); + } + + protected getLinkClassName(href: string, enablement: string | undefined): string { + const classNames = ['theia-WelcomeViewCommandLink']; + // Only command-backed links can be disabled. All other, https:, file: remain enabled + if (href.startsWith('command:') && !this.isEnabledClick(enablement)) { + classNames.push('disabled'); + } + return classNames.join(' '); + } + + protected isEnabledClick(enablement: string | undefined): boolean { + return typeof enablement === 'string' + ? this.contextService.match(enablement) + : true; + } + + protected openLinkOrCommand = (event: React.MouseEvent, value: string): void => { + event.stopPropagation(); + + if (value.startsWith('command:')) { + const command = value.replace('command:', ''); + this.commands.executeCommand(command); + } else if (value.startsWith('file:')) { + const uri = value.replace('file:', ''); + open(this.openerService, new URI(CodeUri.file(uri).toString())); + } else { + this.windowService.openNewWindow(value, { external: true }); + } + }; + + protected parseLinkedText(text: string): LinkedTextItem[] { + const result: LinkedTextItem[] = []; + + const linkRegex = /\[([^\]]+)\]\(((?:https?:\/\/|command:|file:)[^\)\s]+)(?: (["'])(.+?)(\3))?\)/gi; + let index = 0; + let match: RegExpExecArray | null; + + while (match = linkRegex.exec(text)) { + if (match.index - index > 0) { + result.push(text.substring(index, match.index)); + } + + const [, label, href, , title] = match; + + if (title) { + result.push({ label, href, title }); + } else { + result.push({ label, href }); + } + + index = match.index + match[0].length; + } + + if (index < text.length) { + result.push(text.substring(index)); + } + + return result; + } +} diff --git a/packages/core/src/browser/tree/tree-widget-selection.ts b/packages/core/src/browser/tree/tree-widget-selection.ts new file mode 100644 index 0000000..4846f27 --- /dev/null +++ b/packages/core/src/browser/tree/tree-widget-selection.ts @@ -0,0 +1,45 @@ +// ***************************************************************************** +// Copyright (C) 2019 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { TreeWidget } from './tree-widget'; +import { SelectableTreeNode } from './tree-selection'; + +export type TreeWidgetSelection = ReadonlyArray> & { + source: TreeWidget +}; +export namespace TreeWidgetSelection { + export function isSource(selection: unknown, source: TreeWidget): selection is TreeWidgetSelection { + return getSource(selection) === source; + } + export function getSource(selection: unknown): TreeWidget | undefined { + return is(selection) ? selection.source : undefined; + } + export function is(selection: unknown): selection is TreeWidgetSelection { + return Array.isArray(selection) && ('source' in selection) && (selection as TreeWidgetSelection).source instanceof TreeWidget; + } + + export function create(source: TreeWidget): TreeWidgetSelection { + const focusedNode = source.model.getFocusedNode(); + const selectedNodes = source.model.selectedNodes; + const focusedIndex = selectedNodes.indexOf(focusedNode as SelectableTreeNode); + // Ensure that the focused node is at index 0 - used as default single selection. + if (focusedNode && focusedIndex > 0) { + const selection = [focusedNode, ...selectedNodes.slice(0, focusedIndex), ...selectedNodes.slice(focusedIndex + 1)]; + return Object.assign(selection, { source }); + } + return Object.assign(selectedNodes, { source }); + } +} diff --git a/packages/core/src/browser/tree/tree-widget.tsx b/packages/core/src/browser/tree/tree-widget.tsx new file mode 100644 index 0000000..01540ba --- /dev/null +++ b/packages/core/src/browser/tree/tree-widget.tsx @@ -0,0 +1,1728 @@ +// ***************************************************************************** +// Copyright (C) 2018 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { injectable, inject, postConstruct } from 'inversify'; +import { Message } from '@lumino/messaging'; +import { Disposable, MenuPath, SelectionService, Event as TheiaEvent, Emitter } from '../../common'; +import { Key, KeyCode, KeyModifier } from '../keyboard/keys'; +import { ContextMenuRenderer } from '../context-menu-renderer'; +import { StatefulWidget } from '../shell'; +import { + EXPANSION_TOGGLE_CLASS, SELECTED_CLASS, COLLAPSED_CLASS, FOCUS_CLASS, BUSY_CLASS, CODICON_TREE_ITEM_CLASSES, CODICON_LOADING_CLASSES, Widget, UnsafeWidgetUtilities, + addEventListener +} from '../widgets'; +import { TreeNode, CompositeTreeNode } from './tree'; +import { TreeModel } from './tree-model'; +import { ExpandableTreeNode } from './tree-expansion'; +import { SelectableTreeNode, TreeSelection } from './tree-selection'; +import { TreeDecoratorService, TreeDecoration, DecoratedTreeNode } from './tree-decorator'; +import { notEmpty } from '../../common/objects'; +import { isOSX } from '../../common/os'; +import { ReactWidget } from '../widgets/react-widget'; +import * as React from 'react'; +import { Virtuoso, VirtuosoHandle, VirtuosoProps } from 'react-virtuoso'; +import { TopDownTreeIterator } from './tree-iterator'; +import { SearchBox, SearchBoxFactory, SearchBoxProps } from './search-box'; +import { TreeSearch } from './tree-search'; +import { ElementExt } from '@lumino/domutils'; +import { TreeWidgetSelection } from './tree-widget-selection'; +import { MaybePromise } from '../../common/types'; +import { LabelProvider } from '../label-provider'; +import { CorePreferences } from '../../common/core-preferences'; +import { TreeFocusService } from './tree-focus-service'; +import { useEffect } from 'react'; +import { PREFERENCE_NAME_TREE_INDENT } from '../../common/tree-preference'; +import { PreferenceService, PreferenceChange } from '../../common/preferences'; + +const debounce = require('lodash.debounce'); + +export const TREE_CLASS = 'theia-Tree'; +export const TREE_CONTAINER_CLASS = 'theia-TreeContainer'; +export const TREE_NODE_CLASS = 'theia-TreeNode'; +export const TREE_NODE_CONTENT_CLASS = 'theia-TreeNodeContent'; +export const TREE_NODE_INFO_CLASS = 'theia-TreeNodeInfo'; +export const TREE_NODE_TAIL_CLASS = 'theia-TreeNodeTail'; +export const TREE_NODE_SEGMENT_CLASS = 'theia-TreeNodeSegment'; +export const TREE_NODE_SEGMENT_GROW_CLASS = 'theia-TreeNodeSegmentGrow'; + +export const EXPANDABLE_TREE_NODE_CLASS = 'theia-ExpandableTreeNode'; +export const COMPOSITE_TREE_NODE_CLASS = 'theia-CompositeTreeNode'; +export const TREE_NODE_CAPTION_CLASS = 'theia-TreeNodeCaption'; +export const TREE_NODE_INDENT_GUIDE_CLASS = 'theia-tree-node-indent'; + +/** + * Threshold in pixels to consider the view as being scrolled to the bottom + */ +export const SCROLL_BOTTOM_THRESHOLD = 30; + +/** + * Tree scroll event data. + */ +export interface TreeScrollEvent { + readonly scrollTop: number; + readonly scrollLeft: number; +} + +/** + * Tree scroll state data. + */ +export interface TreeScrollState { + readonly scrollTop: number; + readonly isAtBottom: boolean; + readonly scrollHeight?: number; + readonly clientHeight?: number; +} + +export const TreeProps = Symbol('TreeProps'); + +/** + * Representation of tree properties. + */ +export interface TreeProps { + + /** + * The path of the context menu that one can use to contribute context menu items to the tree widget. + */ + readonly contextMenuPath?: MenuPath; + + /** + * The size of the padding (in pixels) for the root node of the tree. + */ + readonly leftPadding: number; + + readonly expansionTogglePadding: number; + + /** + * `true` if the tree widget support multi-selection. Otherwise, `false`. Defaults to `false`. + */ + readonly multiSelect?: boolean; + + /** + * `true` if the tree widget support searching. Otherwise, `false`. Defaults to `false`. + */ + readonly search?: boolean + + /** + * `true` if the tree widget should be virtualized searching. Otherwise, `false`. Defaults to `true`. + */ + readonly virtualized?: boolean + + /** + * `true` if the selected node should be auto scrolled only if the widget is active. Otherwise, `false`. Defaults to `false`. + */ + readonly scrollIfActive?: boolean + + /** + * `true` if a tree widget contributes to the global selection. Defaults to `false`. + */ + readonly globalSelection?: boolean; + + /** + * `true` if the tree widget supports expansion only when clicking the expansion toggle. Defaults to `false`. + */ + readonly expandOnlyOnExpansionToggleClick?: boolean; + + /** + * Props that are forwarded to the virtuoso list rendered. Defaults to `{}`. + */ + readonly viewProps?: VirtuosoProps; +} + +/** + * Representation of node properties. + */ +export interface NodeProps { + + /** + * A root relative number representing the hierarchical depth of the actual node. Root is `0`, its children have `1` and so on. + */ + readonly depth: number; + +} + +/** + * The default tree properties. + */ +export const defaultTreeProps: TreeProps = { + leftPadding: 8, + expansionTogglePadding: 22 +}; + +export namespace TreeWidget { + + /** + * Bare minimum common interface of the keyboard and the mouse event with respect to the key maskings. + */ + export interface ModifierAwareEvent { + /** + * Determines if the modifier aware event has the `meta` key masking. + */ + readonly metaKey: boolean; + /** + * Determines if the modifier aware event has the `ctrl` key masking. + */ + readonly ctrlKey: boolean; + /** + * Determines if the modifier aware event has the `shift` key masking. + */ + readonly shiftKey: boolean; + } + +} + +@injectable() +export class TreeWidget extends ReactWidget implements StatefulWidget { + + protected searchBox: SearchBox; + protected searchHighlights: Map; + + protected readonly onScrollEmitter = new Emitter(); + readonly onScroll: TheiaEvent = this.onScrollEmitter.event; + + @inject(TreeDecoratorService) + protected readonly decoratorService: TreeDecoratorService; + @inject(TreeSearch) + protected readonly treeSearch: TreeSearch; + @inject(SearchBoxFactory) + protected readonly searchBoxFactory: SearchBoxFactory; + @inject(TreeFocusService) + protected readonly focusService: TreeFocusService; + + protected decorations: Map = new Map(); + + @inject(SelectionService) + protected readonly selectionService: SelectionService; + + @inject(PreferenceService) + protected readonly preferenceService: PreferenceService; + + @inject(LabelProvider) + protected readonly labelProvider: LabelProvider; + + @inject(CorePreferences) + protected readonly corePreferences: CorePreferences; + + protected shouldScrollToRow = true; + + protected treeIndent: number = 8; + + constructor( + @inject(TreeProps) readonly props: TreeProps, + @inject(TreeModel) readonly model: TreeModel, + @inject(ContextMenuRenderer) protected readonly contextMenuRenderer: ContextMenuRenderer, + ) { + super(); + this.scrollOptions = { + suppressScrollX: true, + minScrollbarLength: 35 + }; + this.addClass(TREE_CLASS); + this.node.tabIndex = 0; + } + + @postConstruct() + protected init(): void { + this.treeIndent = this.preferenceService.get(PREFERENCE_NAME_TREE_INDENT, this.treeIndent); + if (this.props.search) { + this.searchBox = this.searchBoxFactory({ ...SearchBoxProps.DEFAULT, showButtons: true, showFilter: true }); + this.searchBox.node.addEventListener('focus', () => { + this.node.focus(); + }); + this.toDispose.pushAll([ + this.searchBox, + this.searchBox.onTextChange(async data => { + await this.treeSearch.filter(data); + this.searchHighlights = this.treeSearch.getHighlights(); + this.searchBox.updateHighlightInfo({ + filterText: data, + total: this.rows.size, + matched: this.searchHighlights.size + }); + this.update(); + }), + this.searchBox.onClose(data => this.treeSearch.filter(undefined)), + this.searchBox.onNext(() => { + // Enable next selection if there are currently highlights. + if (this.searchHighlights.size > 1) { + this.model.selectNextNode(); + } + }), + this.searchBox.onPrevious(() => { + // Enable previous selection if there are currently highlights. + if (this.searchHighlights.size > 1) { + this.model.selectPrevNode(); + } + }), + this.searchBox.onFilterToggled(e => { + this.updateRows(); + }), + this.treeSearch, + this.treeSearch.onFilteredNodesChanged(nodes => { + if (this.searchBox.isFiltering) { + this.updateRows(); + } + const node = nodes.find(SelectableTreeNode.is); + if (node) { + this.model.selectNode(node); + } + }), + ]); + } + this.node.addEventListener('mousedown', this.handleMiddleClickEvent.bind(this)); + this.node.addEventListener('mouseup', this.handleMiddleClickEvent.bind(this)); + this.node.addEventListener('auxclick', this.handleMiddleClickEvent.bind(this)); + this.toDispose.pushAll([ + this.onScrollEmitter, + this.model, + this.model.onChanged(() => this.updateRows()), + this.model.onSelectionChanged(() => this.scheduleUpdateScrollToRow({ resize: false })), + this.focusService.onDidChangeFocus(() => this.scheduleUpdateScrollToRow({ resize: false })), + this.model.onDidChangeBusy(() => this.update()), + this.model.onDidUpdate(() => this.update()), + this.model.onNodeRefreshed(() => this.updateDecorations()), + this.model.onExpansionChanged(() => this.updateDecorations()), + this.decoratorService, + this.decoratorService.onDidChangeDecorations(() => this.updateDecorations()), + this.labelProvider.onDidChange(e => { + for (const row of this.rows.values()) { + if (e.affects(row)) { + this.update(); + return; + } + } + }), + this.preferenceService.onPreferenceChanged((event: PreferenceChange) => { + if (event.preferenceName === PREFERENCE_NAME_TREE_INDENT) { + this.treeIndent = this.preferenceService.get(PREFERENCE_NAME_TREE_INDENT, 8); + this.update(); + } + }) + ]); + setTimeout(() => { + this.updateRows(); + this.updateDecorations(); + }); + if (this.props.globalSelection) { + this.registerGlobalSelectionHandlers(); + } + + this.toDispose.push(this.corePreferences.onPreferenceChanged(preference => { + if (preference.preferenceName === 'workbench.tree.renderIndentGuides') { + this.update(); + } + })); + } + + protected registerGlobalSelectionHandlers(): void { + this.model.onSelectionChanged(this.handleGlobalSelectionOnModelSelectionChange, this, this.toDispose); + this.focusService.onDidChangeFocus(this.handleGlobalSelectionOnFocusServiceFocusChange, this, this.toDispose); + this.toDispose.push(addEventListener(this.node, 'focusin', this.handleGlobalSelectionOnFocusIn.bind(this))); + this.toDispose.push(Disposable.create(this.handleGlobalSelectionOnDisposal.bind(this))); + } + + protected handleGlobalSelectionOnModelSelectionChange(): void { + if (this.shouldUpdateGlobalSelection()) { + this.updateGlobalSelection(); + } + } + + protected handleGlobalSelectionOnFocusServiceFocusChange(focus: SelectableTreeNode | undefined): void { + if (focus && this.shouldUpdateGlobalSelection() && this.model.selectedNodes[0] !== focus && this.model.selectedNodes.includes(focus)) { + this.updateGlobalSelection(); + } + } + + protected handleGlobalSelectionOnFocusIn(): void { + if (this.model.selectedNodes.length && (!this.selectionService.selection || !TreeWidgetSelection.isSource(this.selectionService.selection, this))) { + this.updateGlobalSelection(); + } + } + + protected handleGlobalSelectionOnDisposal(): void { + if (TreeWidgetSelection.isSource(this.selectionService.selection, this)) { + this.selectionService.selection = undefined; + } + } + + protected shouldUpdateGlobalSelection(): boolean { + return this.node.contains(document.activeElement) || TreeWidgetSelection.isSource(this.selectionService.selection, this); + } + + /** + * Update the global selection for the tree. + */ + protected updateGlobalSelection(): void { + this.selectionService.selection = TreeWidgetSelection.create(this); + } + + protected rows = new Map(); + protected updateRows = debounce(() => this.doUpdateRows(), 10); + protected doUpdateRows(): void { + const root = this.model.root; + const rowsToUpdate: Array<[string, TreeWidget.NodeRow]> = []; + if (root) { + const depths = new Map(); + let index = 0; + for (const node of new TopDownTreeIterator(root, { + pruneCollapsed: true, + pruneSiblings: true + })) { + if (this.shouldDisplayNode(node)) { + const depth = this.getDepthForNode(node, depths); + if (CompositeTreeNode.is(node)) { + depths.set(node, depth); + } + rowsToUpdate.push([node.id, this.toNodeRow(node, index++, depth)]); + } + } + } + this.rows = new Map(rowsToUpdate); + this.update(); + this.scheduleUpdateScrollToRow(); + } + + protected getDepthForNode(node: TreeNode, depths: Map): number { + const parentDepth = depths.get(node.parent); + return parentDepth === undefined ? 0 : TreeNode.isVisible(node.parent) ? parentDepth + 1 : parentDepth; + } + + protected toNodeRow(node: TreeNode, index: number, depth: number): TreeWidget.NodeRow { + return { node, index, depth }; + } + + protected shouldDisplayNode(node: TreeNode): boolean { + return TreeNode.isVisible(node) && (!this.searchBox?.isFiltering || this.treeSearch.passesFilters(node)); + } + + /** + * Row index to ensure visibility. + * - Used to forcefully scroll if necessary. + */ + protected scrollToRow: number | undefined; + /** + * Update the `scrollToRow`. + * @param updateOptions the tree widget force update options. + */ + protected updateScrollToRow(): void { + this.scrollToRow = this.getScrollToRow(); + this.update(); + } + + protected scheduleUpdateScrollToRow = debounce(this.updateScrollToRow); + + /** + * Get the `scrollToRow`. + * + * @returns the `scrollToRow` if available. + */ + protected getScrollToRow(): number | undefined { + if (!this.shouldScrollToRow) { + return undefined; + } + const { focusedNode } = this.focusService; + return focusedNode && this.rows.get(focusedNode.id)?.index; + } + + /** + * Update tree decorations. + * - Updating decorations are debounced in order to limit the number of expensive updates. + */ + protected readonly updateDecorations = debounce(() => this.doUpdateDecorations(), 150); + protected async doUpdateDecorations(): Promise { + this.decorations = await this.decoratorService.getDecorations(this.model); + this.update(); + } + + protected override onActivateRequest(msg: Message): void { + super.onActivateRequest(msg); + this.node.focus({ preventScroll: true }); + } + + /** + * Actually focus the tree node. + */ + protected doFocus(): void { + if (!this.model.selectedNodes.length) { + const node = this.getNodeToFocus(); + if (SelectableTreeNode.is(node)) { + this.model.selectNode(node); + } + } + } + + /** + * Get the tree node to focus. + * + * @returns the node to focus if available. + */ + protected getNodeToFocus(): SelectableTreeNode | undefined { + const { focusedNode } = this.focusService; + if (focusedNode) { + return focusedNode; + } + const { root } = this.model; + if (SelectableTreeNode.isVisible(root)) { + return root; + } + return this.model.getNextSelectableNode(root); + } + + protected override onUpdateRequest(msg: Message): void { + if (!this.isAttached || !this.isVisible) { + return; + } + super.onUpdateRequest(msg); + } + + protected override handleVisiblityChanged(isNowVisible: boolean): void { + super.handleVisiblityChanged(isNowVisible); + if (isNowVisible) { + this.update(); + } + } + + protected override onResize(msg: Widget.ResizeMessage): void { + super.onResize(msg); + this.update(); + } + + protected render(): React.ReactNode { + return React.createElement('div', this.createContainerAttributes(), this.renderTree(this.model)); + } + + /** + * Create the container attributes for the widget. + */ + protected createContainerAttributes(): React.HTMLAttributes { + const classNames = [TREE_CONTAINER_CLASS]; + if (!this.rows.size) { + classNames.push('empty'); + } + if (this.model.selectedNodes.length === 0 && !this.focusService.focusedNode) { + classNames.push('focused'); + } + return { + className: classNames.join(' '), + onContextMenu: event => this.handleContextMenuEvent(this.getContainerTreeNode(), event) + }; + } + /** + * Get the container tree node. + * + * @returns the tree node for the container if available. + */ + protected getContainerTreeNode(): TreeNode | undefined { + return this.model.root; + } + + protected ScrollingRowRenderer: React.FC<{ rows: TreeWidget.NodeRow[] }> = ({ rows }) => { + useEffect(() => this.scrollToSelected()); + return <>{rows.map(row =>
    {this.renderNodeRow(row)}
    )}; + }; + + protected view: TreeWidget.View | undefined; + /** + * Render the tree widget. + * @param model the tree model. + */ + protected renderTree(model: TreeModel): React.ReactNode { + if (model.root) { + const rows = Array.from(this.rows.values()); + if (this.props.virtualized === false) { + return ; + } + return this.view = (view || undefined)} + width={this.node.offsetWidth} + height={this.node.offsetHeight} + rows={rows} + renderNodeRow={this.renderNodeRow} + scrollToRow={this.scrollToRow} + onScrollEmitter={this.onScrollEmitter} + {...this.props.viewProps} + />; + } + // eslint-disable-next-line no-null/no-null + return null; + } + + scrollArea: Element = this.node; + /** + * Scroll to the selected tree node. + */ + protected scrollToSelected(): void { + if (this.props.scrollIfActive === true && !this.node.contains(document.activeElement)) { + return; + } + const focus = this.node.getElementsByClassName(FOCUS_CLASS)[0]; + if (focus) { + ElementExt.scrollIntoViewIfNeeded(this.scrollArea, focus); + } else { + const selected = this.node.getElementsByClassName(SELECTED_CLASS)[0]; + if (selected) { + ElementExt.scrollIntoViewIfNeeded(this.scrollArea, selected); + } + } + } + + /** + * Render the node row. + */ + protected readonly renderNodeRow = (row: TreeWidget.NodeRow) => this.doRenderNodeRow(row); + /** + * Actually render the node row. + */ + protected doRenderNodeRow({ node, depth }: TreeWidget.NodeRow): React.ReactNode { + return + {this.renderIndent(node, { depth })} + {this.renderNode(node, { depth })} + ; + } + + /** + * Render the tree node given the node properties. + * @param node the tree node. + * @param props the node properties. + */ + protected renderIcon(node: TreeNode, props: NodeProps): React.ReactNode { + // eslint-disable-next-line no-null/no-null + return null; + } + + /** + * Toggle the node. + */ + protected readonly toggle = (event: React.MouseEvent) => this.doToggle(event); + /** + * Actually toggle the tree node. + * @param event the mouse click event. + */ + protected doToggle(event: React.MouseEvent): void { + const nodeId = event.currentTarget.getAttribute('data-node-id'); + if (nodeId) { + const node = this.model.getNode(nodeId); + if (node && this.props.expandOnlyOnExpansionToggleClick) { + if (this.isExpandable(node) && !this.hasShiftMask(event) && !this.hasCtrlCmdMask(event)) { + this.model.toggleNodeExpansion(node); + } + } else { + this.handleClickEvent(node, event); + } + } + event.stopPropagation(); + } + + /** + * Render the node expansion toggle. + * @param node the tree node. + * @param props the node properties. + */ + protected renderExpansionToggle(node: TreeNode, props: NodeProps): React.ReactNode { + if (!this.isExpandable(node)) { + // eslint-disable-next-line no-null/no-null + return null; + } + const classes = [TREE_NODE_SEGMENT_CLASS, EXPANSION_TOGGLE_CLASS]; + if (!node.expanded) { + classes.push(COLLAPSED_CLASS); + } + if (node.busy) { + classes.push(BUSY_CLASS, ...CODICON_LOADING_CLASSES); + } else { + classes.push(...CODICON_TREE_ITEM_CLASSES); + } + const className = classes.join(' '); + return
    +
    ; + } + + /** + * Render the node expansion toggle. + * @param node the tree node. + * @param props the node properties. + */ + protected renderCheckbox(node: TreeNode, props: NodeProps): React.ReactNode { + if (node.checkboxInfo === undefined) { + // eslint-disable-next-line no-null/no-null + return null; + } + return this.toggleChecked(event)} />; + } + + protected toggleChecked(event: React.MouseEvent): void { + const nodeId = event.currentTarget.getAttribute('data-node-id'); + if (nodeId) { + const node = this.model.getNode(nodeId); + if (node) { + this.model.markAsChecked(node, !node.checkboxInfo!.checked); + } else { + this.handleClickEvent(node, event); + } + } + event.preventDefault(); + event.stopPropagation(); + } + /** + * Render the tree node caption given the node properties. + * @param node the tree node. + * @param props the node properties. + */ + protected renderCaption(node: TreeNode, props: NodeProps): React.ReactNode { + const attrs = this.getCaptionAttributes(node, props); + const children = this.getCaptionChildren(node, props); + return React.createElement('div', attrs, children); + } + + protected getCaptionAttributes(node: TreeNode, props: NodeProps): React.Attributes & React.HTMLAttributes { + const tooltip = this.getDecorationData(node, 'tooltip').filter(notEmpty).join(' • '); + const classes = [TREE_NODE_SEGMENT_CLASS]; + if (!this.hasTrailingSuffixes(node)) { + classes.push(TREE_NODE_SEGMENT_GROW_CLASS); + } + const className = classes.join(' '); + let attrs = this.decorateCaption(node, { + className, id: node.id + }); + if (tooltip.length > 0) { + attrs = { + ...attrs, + title: tooltip + }; + } + return attrs; + } + + protected getCaptionChildren(node: TreeNode, props: NodeProps): React.ReactNode { + const children = []; + const caption = this.toNodeName(node); + const highlight = this.getDecorationData(node, 'highlight')[0]; + if (highlight) { + children.push(this.toReactNode(caption, highlight)); + } + const searchHighlight = this.searchHighlights ? this.searchHighlights.get(node.id) : undefined; + if (searchHighlight) { + children.push(...this.toReactNode(caption, searchHighlight)); + } else if (!highlight) { + children.push(caption); + } + return children; + } + + /** + * Update the node given the caption and highlight. + * @param caption the caption. + * @param highlight the tree decoration caption highlight. + */ + protected toReactNode(caption: string, highlight: TreeDecoration.CaptionHighlight): React.ReactNode[] { + let style: React.CSSProperties = {}; + if (highlight.color) { + style = { + ...style, + color: highlight.color + }; + } + if (highlight.backgroundColor) { + style = { + ...style, + backgroundColor: highlight.backgroundColor + }; + } + const createChildren = (fragment: TreeDecoration.CaptionHighlight.Fragment, index: number) => { + const { data } = fragment; + if (fragment.highlight) { + return {data}; + } else { + return data; + } + }; + return TreeDecoration.CaptionHighlight.split(caption, highlight).map(createChildren); + } + + /** + * Decorate the tree caption. + * @param node the tree node. + * @param attrs the additional attributes. + */ + protected decorateCaption(node: TreeNode, attrs: React.HTMLAttributes): React.Attributes & React.HTMLAttributes { + const style = this.getDecorationData(node, 'fontData') + .filter(notEmpty) + .reverse() + .map(fontData => this.applyFontStyles({}, fontData)) + .reduce((acc, current) => ({ + ...acc, + ...current + }), {}); + return { + ...attrs, + style + }; + } + + /** + * Determine if the tree node contains trailing suffixes. + * @param node the tree node. + * + * @returns `true` if the tree node contains trailing suffices. + */ + protected hasTrailingSuffixes(node: TreeNode): boolean { + return this.getDecorationData(node, 'captionSuffixes').filter(notEmpty).reduce((acc, current) => acc.concat(current), []).length > 0; + } + + /** + * Apply font styles to the tree. + * @param original the original css properties. + * @param fontData the optional `fontData`. + */ + protected applyFontStyles(original: React.CSSProperties, fontData: TreeDecoration.FontData | undefined): React.CSSProperties { + if (fontData === undefined) { + return original; + } + const modified = { ...original }; // make a copy to mutate + const { color, style } = fontData; + if (color) { + modified.color = color; + } + if (style) { + (Array.isArray(style) ? style : [style]).forEach(s => { + switch (s) { + case 'bold': + modified.fontWeight = s; + break; + case 'normal': + case 'oblique': + case 'italic': + modified.fontStyle = s; + break; + case 'underline': + case 'line-through': + modified.textDecoration = s; + break; + default: + throw new Error(`Unexpected font style: "${s}".`); + } + }); + } + return modified; + } + + /** + * Render caption affixes for the given tree node. + * @param node the tree node. + * @param props the node properties. + * @param affixKey the affix key. + */ + protected renderCaptionAffixes(node: TreeNode, props: NodeProps, affixKey: 'captionPrefixes' | 'captionSuffixes'): React.ReactNode { + const suffix = affixKey === 'captionSuffixes'; + const affixClass = suffix ? TreeDecoration.Styles.CAPTION_SUFFIX_CLASS : TreeDecoration.Styles.CAPTION_PREFIX_CLASS; + const classes = [TREE_NODE_SEGMENT_CLASS, affixClass]; + const affixes = this.getDecorationData(node, affixKey).filter(notEmpty).reduce((acc, current) => acc.concat(current), []); + const children: React.ReactNode[] = []; + for (let i = 0; i < affixes.length; i++) { + const affix = affixes[i]; + if (suffix && i === affixes.length - 1) { + classes.push(TREE_NODE_SEGMENT_GROW_CLASS); + } + const style = this.applyFontStyles({}, affix.fontData); + const className = classes.join(' '); + const key = node.id + '_' + i; + const attrs = { + className, + style, + key + }; + children.push(React.createElement('div', attrs, affix.data)); + } + return {children}; + } + + /** + * Decorate the tree node icon. + * @param node the tree node. + * @param icon the icon. + */ + protected decorateIcon(node: TreeNode, icon: React.ReactNode): React.ReactNode { + if (!icon) { + return; + } + const overlayIcons: React.ReactNode[] = []; + // if multiple overlays have the same overlay.position attribute, we'll de-duplicate those and only process the first one from the decoration array + const seenPositions = new Set(); + const overlays = this.getDecorationData(node, 'iconOverlay').filter(notEmpty); + + for (const overlay of overlays) { + if (!seenPositions.has(overlay.position)) { + seenPositions.add(overlay.position); + const iconClasses = [TreeDecoration.Styles.DECORATOR_SIZE_CLASS, TreeDecoration.IconOverlayPosition.getStyle(overlay.position)]; + const style = (color?: string) => color === undefined ? {} : { color }; + + if (overlay.background) { + overlayIcons.push(); + } + + const overlayIcon = 'icon' in overlay ? overlay.icon : overlay.iconClass; + overlayIcons.push(); + } + } + + if (overlayIcons.length > 0) { + return
    {icon}{overlayIcons}
    ; + } + + return icon; + } + + /** + * Render the tree node tail decorations. + * @param node the tree node. + * @param props the node properties. + */ + protected renderTailDecorations(node: TreeNode, props: NodeProps): React.ReactNode { + const tailDecorations = this.getDecorationData(node, 'tailDecorations').reduce((acc, current) => acc.concat(current), []); + if (tailDecorations.length === 0) { + return; + } + return this.renderTailDecorationsForNode(node, props, tailDecorations); + } + + protected renderTailDecorationsForNode(node: TreeNode, props: NodeProps, tailDecorations: TreeDecoration.TailDecoration.AnyPartial[]): React.ReactNode { + let dotDecoration: TreeDecoration.TailDecoration.AnyPartial | undefined; + const otherDecorations: TreeDecoration.TailDecoration.AnyPartial[] = []; + tailDecorations.reverse().forEach(decoration => { + if (TreeDecoration.TailDecoration.isDotDecoration(decoration)) { + dotDecoration ||= decoration; + } else if (decoration.data || decoration.icon || decoration.iconClass) { + otherDecorations.push(decoration); + } + }); + const decorationsToRender = dotDecoration ? [dotDecoration, ...otherDecorations] : otherDecorations; + return + {decorationsToRender.map((decoration, index) => { + const { tooltip, data, fontData, color, icon, iconClass } = decoration; + const iconToRender = icon ?? iconClass; + const className = [TREE_NODE_SEGMENT_CLASS, TREE_NODE_TAIL_CLASS, 'flex'].join(' '); + const style = fontData ? this.applyFontStyles({}, fontData) : color ? { color } : undefined; + const content = data ? data : iconToRender + ? + : ''; + return
    + {content}{index !== decorationsToRender.length - 1 ? ',' : ''} +
    ; + })} +
    ; + } + + /** + * Determine the classes to use for an icon + * - Assumes a Font Awesome name when passed a single string, otherwise uses the passed string array + * @param iconName the icon name or list of icon names. + * @param additionalClasses additional CSS classes. + * + * @returns the icon class name. + */ + protected getIconClass(iconName: string | string[], additionalClasses: string[] = []): string { + const iconClass = (typeof iconName === 'string') ? ['a', 'fa', `fa-${iconName}`] : ['a'].concat(iconName); + return iconClass.concat(additionalClasses).join(' '); + } + + /** + * Render indent for the file tree based on the depth + * @param node the tree node. + * @param depth the depth of the tree node. + */ + protected renderIndent(node: TreeNode, props: NodeProps): React.ReactNode { + const renderIndentGuides = this.corePreferences['workbench.tree.renderIndentGuides']; + if (renderIndentGuides === 'none') { + return undefined; + } + + const indentDivs: React.ReactNode[] = []; + let current: TreeNode | undefined = node; + let depth = props.depth; + while (current && depth) { + if (this.shouldRenderIndent(current)) { + const classNames: string[] = [TREE_NODE_INDENT_GUIDE_CLASS]; + if (this.needsActiveIndentGuideline(current)) { + classNames.push('active'); + } else { + classNames.push(renderIndentGuides === 'onHover' ? 'hover' : 'always'); + } + const paddingLeft = this.getDepthPadding(depth); + indentDivs.unshift(
    ); + depth--; + } + current = current.parent; + } + return indentDivs; + } + + /** + * Determines whether an indentation div should be rendered for the specified tree node. + * If there are multiple tree nodes inside of a single rendered row, + * this method should only return true for the first node. + */ + protected shouldRenderIndent(node: TreeNode): boolean { + return true; + } + + protected needsActiveIndentGuideline(node: TreeNode): boolean { + const parent = node.parent; + if (!parent || !this.isExpandable(parent)) { + return false; + } + if (SelectableTreeNode.isSelected(parent)) { + return true; + } + if (parent.expanded) { + for (const sibling of parent.children) { + if (SelectableTreeNode.isSelected(sibling) && !(this.isExpandable(sibling) && sibling.expanded)) { + return true; + } + } + } + return false; + } + + /** + * Render the node given the tree node and node properties. + * @param node the tree node. + * @param props the node properties. + */ + protected renderNode(node: TreeNode, props: NodeProps): React.ReactNode { + if (!TreeNode.isVisible(node)) { + return undefined; + } + const attributes = this.createNodeAttributes(node, props); + const content =
    + {this.renderExpansionToggle(node, props)} + {this.renderCheckbox(node, props)} + {this.decorateIcon(node, this.renderIcon(node, props))} + {this.renderCaptionAffixes(node, props, 'captionPrefixes')} + {this.renderCaption(node, props)} + {this.renderCaptionAffixes(node, props, 'captionSuffixes')} + {this.renderTailDecorations(node, props)} +
    ; + return React.createElement('div', attributes, content); + } + + /** + * Create node attributes for the tree node given the node properties. + * @param node the tree node. + * @param props the node properties. + */ + protected createNodeAttributes(node: TreeNode, props: NodeProps): React.Attributes & React.HTMLAttributes { + const className = this.createNodeClassNames(node, props).join(' '); + const style = this.createNodeStyle(node, props); + return { + className, + style, + onClick: event => this.handleClickEvent(node, event), + onDoubleClick: event => this.handleDblClickEvent(node, event), + onAuxClick: event => this.handleAuxClickEvent(node, event), + onContextMenu: event => this.handleContextMenuEvent(node, event), + }; + } + + /** + * Create the node class names. + * @param node the tree node. + * @param props the node properties. + * + * @returns the list of tree node class names. + */ + protected createNodeClassNames(node: TreeNode, props: NodeProps): string[] { + const classNames = [TREE_NODE_CLASS]; + if (CompositeTreeNode.is(node)) { + classNames.push(COMPOSITE_TREE_NODE_CLASS); + } + if (this.isExpandable(node)) { + classNames.push(EXPANDABLE_TREE_NODE_CLASS); + } + if (this.rowIsSelected(node, props)) { + classNames.push(SELECTED_CLASS); + } + if (this.focusService.hasFocus(node)) { + classNames.push(FOCUS_CLASS); + } + return classNames; + } + + protected rowIsSelected(node: TreeNode, props: NodeProps): boolean { + return SelectableTreeNode.isSelected(node); + } + + /** + * Get the default node style. + * @param node the tree node. + * @param props the node properties. + * + * @returns the CSS properties if available. + */ + protected getDefaultNodeStyle(node: TreeNode, props: NodeProps): React.CSSProperties | undefined { + const paddingLeft = this.getPaddingLeft(node, props) + 'px'; + return { paddingLeft }; + } + + protected getPaddingLeft(node: TreeNode, props: NodeProps): number { + return this.getDepthPadding(props.depth) + (this.needsExpansionTogglePadding(node) ? this.props.expansionTogglePadding : 0); + } + + /** + * If the node is a composite, a toggle will be rendered. + * Otherwise we need to add the width and the left, right padding => 18px + */ + protected needsExpansionTogglePadding(node: TreeNode): boolean { + return !this.isExpandable(node); + } + + /** + * Create the tree node style. + * @param node the tree node. + * @param props the node properties. + */ + protected createNodeStyle(node: TreeNode, props: NodeProps): React.CSSProperties | undefined { + return this.decorateNodeStyle(node, this.getDefaultNodeStyle(node, props)); + } + + /** + * Decorate the node style. + * @param node the tree node. + * @param style the optional CSS properties. + * + * @returns the CSS styles if available. + */ + protected decorateNodeStyle(node: TreeNode, style: React.CSSProperties | undefined): React.CSSProperties | undefined { + const backgroundColor = this.getDecorationData(node, 'backgroundColor').filter(notEmpty).shift(); + if (backgroundColor) { + style = { + ...(style || {}), + backgroundColor + }; + } + return style; + } + + /** + * Determine if the tree node is expandable. + * @param node the tree node. + * + * @returns `true` if the tree node is expandable. + */ + protected isExpandable(node: TreeNode): node is ExpandableTreeNode { + return ExpandableTreeNode.is(node); + } + + /** + * Get the tree node decorations. + * @param node the tree node. + * + * @returns the list of tree decoration data. + */ + protected getDecorations(node: TreeNode): TreeDecoration.Data[] { + const decorations: TreeDecoration.Data[] = []; + if (DecoratedTreeNode.is(node)) { + decorations.push(node.decorationData); + } + if (this.decorations.has(node.id)) { + decorations.push(...this.decorations.get(node.id)!); + } + return decorations.sort(TreeDecoration.Data.comparePriority); + } + + /** + * Get the tree decoration data for the given key. + * @param node the tree node. + * @param key the tree decoration data key. + * + * @returns the tree decoration data at the given key. + */ + protected getDecorationData(node: TreeNode, key: K): Required>[K][] { + return this.getDecorations(node).filter(data => data[key] !== undefined).map(data => data[key]); + } + + /** + * Store the last scroll state. + */ + protected lastScrollState: { + /** + * The scroll top value. + */ + scrollTop: number, + /** + * The scroll left value. + */ + scrollLeft: number + } | undefined; + + /** + * Get the scroll container. + */ + protected override getScrollContainer(): MaybePromise { + this.toDisposeOnDetach.push(Disposable.create(() => { + const { scrollTop, scrollLeft } = this.node; + this.lastScrollState = { scrollTop, scrollLeft }; + })); + if (this.lastScrollState) { + const { scrollTop, scrollLeft } = this.lastScrollState; + this.node.scrollTop = scrollTop; + this.node.scrollLeft = scrollLeft; + } + return this.node; + } + + /** + * Get the current scroll state from the virtualized view. + * This should be used instead of accessing the DOM scroll properties directly + * when the tree is virtualized. + */ + protected getVirtualizedScrollState(): TreeScrollState | undefined { + return this.view?.getScrollState(); + } + + /** + * Check if the tree is scrolled to the bottom. + * Works with both virtualized and non-virtualized trees. + */ + isScrolledToBottom(): boolean { + if (this.props.virtualized !== false && this.view) { + // Use virtualized scroll state + const scrollState = this.getVirtualizedScrollState(); + return scrollState?.isAtBottom ?? true; + } else { + // Fallback to DOM-based calculation for non-virtualized trees + const scrollContainer = this.node; + const scrollHeight = scrollContainer.scrollHeight; + const scrollTop = scrollContainer.scrollTop; + const clientHeight = scrollContainer.clientHeight; + + if (scrollHeight <= clientHeight) { + return true; + } + + return scrollHeight - scrollTop - clientHeight <= SCROLL_BOTTOM_THRESHOLD; + } + } + + protected override onAfterAttach(msg: Message): void { + const up = [ + Key.ARROW_UP, + KeyCode.createKeyCode({ first: Key.ARROW_UP, modifiers: [KeyModifier.Shift] }) + ]; + const down = [ + Key.ARROW_DOWN, + KeyCode.createKeyCode({ first: Key.ARROW_DOWN, modifiers: [KeyModifier.Shift] }) + ]; + if (this.props.search) { + if (this.searchBox.isAttached) { + Widget.detach(this.searchBox); + } + UnsafeWidgetUtilities.attach(this.searchBox, this.node.parentElement!); + this.addKeyListener(this.node, this.searchBox.keyCodePredicate.bind(this.searchBox), this.searchBox.handle.bind(this.searchBox)); + this.toDisposeOnDetach.push(Disposable.create(() => { + Widget.detach(this.searchBox); + })); + } + super.onAfterAttach(msg); + this.addKeyListener(this.node, Key.ARROW_LEFT, event => this.handleLeft(event)); + this.addKeyListener(this.node, Key.ARROW_RIGHT, event => this.handleRight(event)); + this.addKeyListener(this.node, up, event => this.handleUp(event)); + this.addKeyListener(this.node, down, event => this.handleDown(event)); + this.addKeyListener(this.node, Key.ENTER, event => this.handleEnter(event)); + this.addKeyListener(this.node, Key.SPACE, event => this.handleSpace(event)); + this.addKeyListener(this.node, Key.ESCAPE, event => this.handleEscape(event)); + // eslint-disable-next-line @typescript-eslint/no-explicit-any + this.addEventListener(this.node, 'ps-scroll-y', (e: Event & { target: { scrollTop: number } }) => { + if (this.view && this.view.list) { + const { scrollTop } = e.target; + this.view.list.scrollTo({ + top: scrollTop + }); + } + }); + } + + /** + * Handle the `left arrow` keyboard event. + * @param event the `left arrow` keyboard event. + */ + protected async handleLeft(event: KeyboardEvent): Promise { + if (!!this.props.multiSelect && (this.hasCtrlCmdMask(event) || this.hasShiftMask(event))) { + return; + } + if (!await this.model.collapseNode()) { + this.model.selectParent(); + } + } + + /** + * Handle the `right arrow` keyboard event. + * @param event the `right arrow` keyboard event. + */ + protected async handleRight(event: KeyboardEvent): Promise { + if (!!this.props.multiSelect && (this.hasCtrlCmdMask(event) || this.hasShiftMask(event))) { + return; + } + if (!await this.model.expandNode()) { + this.model.selectNextNode(); + } + } + + /** + * Handle the `up arrow` keyboard event. + * @param event the `up arrow` keyboard event. + */ + protected handleUp(event: KeyboardEvent): void { + if (!!this.props.multiSelect && this.hasShiftMask(event)) { + this.model.selectPrevNode(TreeSelection.SelectionType.RANGE); + } else { + this.model.selectPrevNode(); + } + this.node.focus(); + } + + /** + * Handle the `down arrow` keyboard event. + * @param event the `down arrow` keyboard event. + */ + protected handleDown(event: KeyboardEvent): void { + if (!!this.props.multiSelect && this.hasShiftMask(event)) { + this.model.selectNextNode(TreeSelection.SelectionType.RANGE); + } else { + this.model.selectNextNode(); + } + this.node.focus(); + } + + /** + * Handle the `enter key` keyboard event. + * - `enter` opens the tree node. + * @param event the `enter key` keyboard event. + */ + protected handleEnter(event: KeyboardEvent): void { + this.model.openNode(); + } + + /** + * Handle the `space key` keyboard event. + * - If the element has a checkbox, it will be toggled. + * - Otherwise, it should be similar to a single-click action. + * @param event the `space key` keyboard event. + */ + protected handleSpace(event: KeyboardEvent): void { + const { focusedNode } = this.focusService; + if (focusedNode && focusedNode.checkboxInfo) { + this.model.markAsChecked(focusedNode, !focusedNode.checkboxInfo.checked); + } else if (!this.props.multiSelect || (!event.ctrlKey && !event.metaKey && !event.shiftKey)) { + this.tapNode(focusedNode); + } + } + + protected handleEscape(event: KeyboardEvent): void { + if (this.model.selectedNodes.length <= 1) { + this.focusService.setFocus(undefined); + this.node.focus(); + } + this.model.clearSelection(); + } + + /** + * Handle the single-click mouse event. + * @param node the tree node if available. + * @param event the mouse single-click event. + */ + protected handleClickEvent(node: TreeNode | undefined, event: React.MouseEvent): void { + if (node) { + event.stopPropagation(); + const shiftMask = this.hasShiftMask(event); + const ctrlCmdMask = this.hasCtrlCmdMask(event); + if (this.props.multiSelect && (shiftMask || ctrlCmdMask) && SelectableTreeNode.is(node)) { + if (shiftMask) { + this.model.selectRange(node); + } else if (ctrlCmdMask) { + this.model.toggleNode(node); + } + } else { + this.tapNode(node); + } + } + } + + /** + * The effective handler of an unmodified single-click event. + */ + protected tapNode(node?: TreeNode): void { + if (SelectableTreeNode.is(node)) { + this.model.selectNode(node); + } + if (node && !this.props.expandOnlyOnExpansionToggleClick && this.isExpandable(node)) { + this.model.toggleNodeExpansion(node); + } + } + + /** + * Handle the double-click mouse event. + * @param node the tree node if available. + * @param event the double-click mouse event. + */ + protected handleDblClickEvent(node: TreeNode | undefined, event: React.MouseEvent): void { + this.model.openNode(node); + event.stopPropagation(); + } + + /** + * Handle the middle-click mouse event. + * @param node the tree node if available. + * @param event the middle-click mouse event. + */ + protected handleAuxClickEvent(node: TreeNode | undefined, event: React.MouseEvent): void { + if (event.button === 1) { + this.model.openNode(node); + if (SelectableTreeNode.is(node)) { + this.model.selectNode(node); + } + } + event.stopPropagation(); + } + + /** + * Handle the middle-click mouse event. + * @param event the middle-click mouse event. + */ + protected handleMiddleClickEvent(event: MouseEvent): void { + // Prevents auto-scrolling behavior when middle-clicking. + if (event.button === 1) { + event.preventDefault(); + } + } + + /** + * Handle the context menu click event. + * - The context menu click event is triggered by the right-click. + * @param node the tree node if available. + * @param event the right-click mouse event. + */ + protected handleContextMenuEvent(node: TreeNode | undefined, event: React.MouseEvent): void { + if (SelectableTreeNode.is(node)) { + // Keep the selection for the context menu, if the widget support multi-selection and the right click happens on an already selected node. + if (!this.props.multiSelect || !node.selected) { + const type = !!this.props.multiSelect && this.hasCtrlCmdMask(event) ? TreeSelection.SelectionType.TOGGLE : TreeSelection.SelectionType.DEFAULT; + this.model.addSelection({ node, type }); + } + this.focusService.setFocus(node); + const contextMenuPath = this.props.contextMenuPath; + if (contextMenuPath) { + const { x, y } = event.nativeEvent; + const args = this.toContextMenuArgs(node); + const target = event.currentTarget; + setTimeout(() => this.contextMenuRenderer.render({ + menuPath: contextMenuPath, + context: target, + anchor: { x, y }, + args + }), 10); + } + } + event.stopPropagation(); + event.preventDefault(); + } + + /** + * Handle the double-click mouse event on the expansion toggle. + */ + protected readonly handleExpansionToggleDblClickEvent = (event: React.MouseEvent) => this.doHandleExpansionToggleDblClickEvent(event); + /** + * Actually handle the double-click mouse event on the expansion toggle. + * @param event the double-click mouse event. + */ + protected doHandleExpansionToggleDblClickEvent(event: React.MouseEvent): void { + if (this.props.expandOnlyOnExpansionToggleClick) { + // Ignore the double-click event. + event.stopPropagation(); + } + } + + /** + * Convert the tree node to context menu arguments. + * @param node the selectable tree node. + */ + // eslint-disable-next-line @typescript-eslint/no-explicit-any + protected toContextMenuArgs(node: SelectableTreeNode): any[] | undefined { + return undefined; + } + + /** + * Determine if the tree modifier aware event has a `ctrlcmd` mask. + * @param event the tree modifier aware event. + * + * @returns `true` if the tree modifier aware event contains the `ctrlcmd` mask. + */ + protected hasCtrlCmdMask(event: TreeWidget.ModifierAwareEvent): boolean { + return isOSX ? event.metaKey : event.ctrlKey; + } + + /** + * Determine if the tree modifier aware event has a `shift` mask. + * @param event the tree modifier aware event. + * + * @returns `true` if the tree modifier aware event contains the `shift` mask. + */ + protected hasShiftMask(event: TreeWidget.ModifierAwareEvent): boolean { + // Ctrl/Cmd mask overrules the Shift mask. + if (this.hasCtrlCmdMask(event)) { + return false; + } + return event.shiftKey; + } + + /** + * Deflate the tree node for storage. + * @param node the tree node. + */ + protected deflateForStorage(node: TreeNode): object { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + const copy = Object.assign({}, node) as any; + if (copy.parent) { + delete copy.parent; + } + if ('previousSibling' in copy) { + delete copy.previousSibling; + } + if ('nextSibling' in copy) { + delete copy.nextSibling; + } + if ('busy' in copy) { + delete copy.busy; + } + if (CompositeTreeNode.is(node)) { + copy.children = []; + for (const child of node.children) { + copy.children.push(this.deflateForStorage(child)); + } + } + return copy; + } + + /** + * Inflate the tree node from storage. + * @param node the tree node. + * @param parent the optional tree node. + */ + // eslint-disable-next-line @typescript-eslint/no-explicit-any + protected inflateFromStorage(node: any, parent?: TreeNode): TreeNode { + if (node.selected) { + node.selected = false; + } + if (parent) { + node.parent = parent; + } + if (Array.isArray(node.children)) { + for (const child of node.children as TreeNode[]) { + this.inflateFromStorage(child, node); + } + } + return node; + } + + /** + * Store the tree state. + */ + storeState(): object { + const decorations = this.decoratorService.deflateDecorators(this.decorations); + let state: object = { + decorations + }; + if (this.model.root) { + state = { + ...state, + root: this.deflateForStorage(this.model.root), + model: this.model.storeState(), + focusedNodeId: this.focusService.focusedNode?.id + }; + } + + return state; + } + + /** + * Restore the state. + * @param oldState the old state object. + */ + restoreState(oldState: object): void { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + const { root, decorations, model, focusedNodeId } = (oldState as any); + if (root) { + this.model.root = this.inflateFromStorage(root); + } + if (decorations) { + this.decorations = this.decoratorService.inflateDecorators(decorations); + } + if (model) { + this.model.restoreState(model); + } + if (focusedNodeId) { + const candidate = this.model.getNode(focusedNodeId); + if (SelectableTreeNode.is(candidate)) { + this.focusService.setFocus(candidate); + } + } + } + + protected toNodeIcon(node: TreeNode): string { + return this.labelProvider.getIcon(node); + } + + protected toNodeName(node: TreeNode): string { + return this.labelProvider.getName(node); + } + + protected toNodeDescription(node: TreeNode): string { + return this.labelProvider.getLongName(node); + } + protected getDepthPadding(depth: number): number { + if (depth === 1) { + return this.props.leftPadding; + } + return depth * this.treeIndent; + } +} +export namespace TreeWidget { + /** + * Representation of a tree node row. + */ + export interface NodeRow { + /** + * The node row index. + */ + index: number + /** + * The actual node. + */ + node: TreeNode + /** + * A root relative number representing the hierarchical depth of the actual node. Root is `0`, its children have `1` and so on. + */ + depth: number + } + /** + * Representation of the tree view properties. + */ + export interface ViewProps extends VirtuosoProps { + /** + * The width property. + */ + width: number + /** + * The height property. + */ + height: number + /** + * The scroll to row value. + */ + scrollToRow?: number + /** + * The list of node rows. + */ + rows: NodeRow[] + renderNodeRow: (row: NodeRow) => React.ReactNode + /** + * Optional scroll event emitter. + */ + onScrollEmitter?: Emitter + } + export class View extends React.Component { + list: VirtuosoHandle | undefined; + private lastScrollState: TreeScrollState = { scrollTop: 0, isAtBottom: true, scrollHeight: 0, clientHeight: 0 }; + /** + * Ensure the selected row is scrolled into view when virtualization finishes updating. + */ + protected readonly scrollIntoViewIfNeeded = () => { + const { scrollToRow } = this.props; + if (this.list && scrollToRow !== undefined) { + this.list.scrollIntoView({ + index: scrollToRow, + align: 'center' + }); + } + }; + + override componentDidMount(): void { + this.scrollIntoViewIfNeeded(); + } + + override componentDidUpdate(prevProps: ViewProps): void { + if (this.props.scrollToRow !== prevProps.scrollToRow) { + this.scrollIntoViewIfNeeded(); + } + } + + override render(): React.ReactNode { + const { rows, width, height, scrollToRow, renderNodeRow, onScrollEmitter, ...other } = this.props; + return { + this.list = (list || undefined); + this.scrollIntoViewIfNeeded(); + }} + // eslint-disable-next-line @typescript-eslint/no-explicit-any + onScroll={(e: any) => { + const scrollTop = e.target.scrollTop; + const scrollHeight = e.target.scrollHeight; + const clientHeight = e.target.clientHeight; + const isAtBottom = scrollHeight - scrollTop - clientHeight <= SCROLL_BOTTOM_THRESHOLD; + + // Store scroll state before firing the event to prevent jitter during inference and scrolling + this.lastScrollState = { scrollTop, isAtBottom, scrollHeight, clientHeight }; + onScrollEmitter?.fire({ scrollTop, scrollLeft: e.target.scrollLeft || 0 }); + }} + atBottomStateChange={(atBottom: boolean) => { + this.lastScrollState = { + ...this.lastScrollState, + isAtBottom: atBottom + }; + }} + atBottomThreshold={SCROLL_BOTTOM_THRESHOLD} + totalCount={rows.length} + itemContent={index => renderNodeRow(rows[index])} + width={width} + height={height} + // This is a pixel value that determines how many pixels to render outside the visible area + // Higher value provides smoother scrolling experience especially during inference, but uses more memory + overscan={800} + {...other} + />; + } + + getScrollState(): TreeScrollState { + return { ...this.lastScrollState }; + } + } +} diff --git a/packages/core/src/browser/tree/tree.spec.ts b/packages/core/src/browser/tree/tree.spec.ts new file mode 100644 index 0000000..f94f6d6 --- /dev/null +++ b/packages/core/src/browser/tree/tree.spec.ts @@ -0,0 +1,241 @@ +// ***************************************************************************** +// Copyright (C) 2018 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import * as assert from 'assert'; +import { TreeNode, CompositeTreeNode } from './tree'; +import { TreeModel } from './tree-model'; +import { MockTreeModel } from './test/mock-tree-model'; +import { expect } from 'chai'; +import { createTreeTestContainer } from './test/tree-test-container'; + +describe('Tree', () => { + + it('addChildren', () => { + assertTreeNode(`{ + "id": "parent", + "name": "parent", + "children": [ + { + "id": "foo", + "name": "foo", + "parent": "parent", + "nextSibling": "bar" + }, + { + "id": "bar", + "name": "bar", + "parent": "parent", + "previousSibling": "foo", + "nextSibling": "baz" + }, + { + "id": "baz", + "name": "baz", + "parent": "parent", + "previousSibling": "bar" + } + ] +}`, getNode()); + }); + + it('removeChild - first', () => { + const node = getNode(); + CompositeTreeNode.removeChild(node, node.children[0]); + assertTreeNode(`{ + "id": "parent", + "name": "parent", + "children": [ + { + "id": "bar", + "name": "bar", + "parent": "parent", + "nextSibling": "baz" + }, + { + "id": "baz", + "name": "baz", + "parent": "parent", + "previousSibling": "bar" + } + ] +}`, node); + }); + + it('removeChild - second', () => { + const node = getNode(); + CompositeTreeNode.removeChild(node, node.children[1]); + assertTreeNode(`{ + "id": "parent", + "name": "parent", + "children": [ + { + "id": "foo", + "name": "foo", + "parent": "parent", + "nextSibling": "baz" + }, + { + "id": "baz", + "name": "baz", + "parent": "parent", + "previousSibling": "foo" + } + ] +}`, node); + }); + + it('removeChild - third', () => { + const node = getNode(); + CompositeTreeNode.removeChild(node, node.children[2]); + assertTreeNode(`{ + "id": "parent", + "name": "parent", + "children": [ + { + "id": "foo", + "name": "foo", + "parent": "parent", + "nextSibling": "bar" + }, + { + "id": "bar", + "name": "bar", + "parent": "parent", + "previousSibling": "foo" + } + ] +}`, node); + }); + + let model: TreeModel; + beforeEach(() => { + model = createTreeModel(); + model.root = MockTreeModel.HIERARCHICAL_MOCK_ROOT(); + }); + describe('getNode', () => { + it('returns undefined for undefined nodes', done => { + expect(model.getNode(undefined)).to.be.undefined; + done(); + }); + + it('returns undefined for a non-existing id', done => { + expect(model.getNode('10')).to.be.undefined; + done(); + }); + + it('returns a valid node for existing an id', done => { + expect(model.getNode('1.1')).not.to.be.undefined; + done(); + }); + }); + + describe('validateNode', () => { + it('returns undefined for undefined nodes', done => { + expect(model.validateNode(undefined)).to.be.undefined; + done(); + }); + + it('returns undefined for non-existing nodes', done => { + expect(model.validateNode(MockTreeModel.Node.toTreeNode({ 'id': '10' }))).to.be.undefined; + done(); + }); + + it('returns a valid node for an existing node', done => { + expect(model.validateNode(retrieveNode('1.1'))).not.to.be.undefined; + done(); + }); + }); + + describe('refresh', () => { + it('refreshes all composite nodes starting with the root', done => { + let result: Boolean = true; + const expectedRefreshedNodes = new Set([ + retrieveNode('1'), + retrieveNode('1.1'), + retrieveNode('1.2'), + retrieveNode('1.2.1')]); + model.onNodeRefreshed((e: Readonly) => { + result = result && expectedRefreshedNodes.has(e); + expectedRefreshedNodes.delete(e); + }); + model.refresh().then(() => { + expect(result).to.be.true; + expect(expectedRefreshedNodes.size).to.be.equal(0); + done(); + }); + }); + }); + + describe('refresh(parent: Readonly)', () => { + it('refreshes all composite nodes starting with the provided node', done => { + let result: Boolean = true; + const expectedRefreshedNodes = new Set([ + retrieveNode('1.2'), + retrieveNode('1.2.1') + ]); + model.onNodeRefreshed((e: Readonly) => { + result = result && expectedRefreshedNodes.has(e); + expectedRefreshedNodes.delete(e); + }); + model.refresh(retrieveNode('1.2')).then(() => { + expect(result).to.be.true; + expect(expectedRefreshedNodes.size).to.be.equal(0); + done(); + }); + }); + }); + + function getNode(): CompositeTreeNode { + return CompositeTreeNode.addChildren({ + id: 'parent', + name: 'parent', + children: [], + parent: undefined + }, [{ + id: 'foo', + name: 'foo', + parent: undefined + }, { + id: 'bar', + name: 'bar', + parent: undefined + }, { + id: 'baz', + name: 'baz', + parent: undefined + }]); + } + + function assertTreeNode(expectation: string, node: TreeNode): void { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + assert.deepStrictEqual(expectation, JSON.stringify(node, (key: keyof CompositeTreeNode, value: any) => { + if (key === 'parent' || key === 'previousSibling' || key === 'nextSibling') { + return value && value.id; + } + return value; + }, 2)); + } + + function createTreeModel(): TreeModel { + const container = createTreeTestContainer(); + return container.get(TreeModel); + } + function retrieveNode(id: string): Readonly { + const readonlyNode: Readonly = model.getNode(id) as T; + return readonlyNode; + } + +}); diff --git a/packages/core/src/browser/tree/tree.ts b/packages/core/src/browser/tree/tree.ts new file mode 100644 index 0000000..6e56a73 --- /dev/null +++ b/packages/core/src/browser/tree/tree.ts @@ -0,0 +1,426 @@ +// ***************************************************************************** +// Copyright (C) 2017 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { injectable } from 'inversify'; +import { Event, Emitter, WaitUntilEvent } from '../../common/event'; +import { Disposable, DisposableCollection } from '../../common/disposable'; +import { CancellationToken, CancellationTokenSource } from '../../common/cancellation'; +import { timeout } from '../../common/promise-util'; +import { isObject, Mutable } from '../../common'; +import { AccessibilityInformation } from '../../common/accessibility'; + +export const Tree = Symbol('Tree'); + +/** + * The tree - an abstract data type. + */ +export interface Tree extends Disposable { + /** + * A root node of this tree. + * Undefined if there is no root node. + * Setting a root node refreshes the tree. + */ + root: TreeNode | undefined; + /** + * Emit when the tree is changed. + */ + readonly onChanged: Event; + /** + * Return a node for the given identifier or undefined if such does not exist. + */ + getNode(id: string | undefined): TreeNode | undefined; + /** + * Return a valid node in this tree matching to the given; otherwise undefined. + */ + validateNode(node: TreeNode | undefined): TreeNode | undefined; + /** + * Refresh children of the root node. + * + * Return a valid refreshed composite root or `undefined` if such does not exist. + */ + refresh(): Promise | undefined>; + /** + * Refresh children of a node for the give node id if it is valid. + * + * Return a valid refreshed composite node or `undefined` if such does not exist. + */ + refresh(parent: Readonly): Promise | undefined>; + /** + * Emit when the children of the given node are refreshed. + */ + readonly onNodeRefreshed: Event & WaitUntilEvent>; + /** + * Emits when the busy state of the given node is changed. + */ + readonly onDidChangeBusy: Event; + /** + * Marks the give node as busy after a specified number of milliseconds. + * A token source of the given token should be canceled to unmark. + */ + markAsBusy(node: Readonly, ms: number, token: CancellationToken): Promise; + + /** + * An update to the tree node occurred, but the tree structure remains unchanged + */ + readonly onDidUpdate: Event; + + markAsChecked(node: TreeNode, checked: boolean): void; +} + +export interface TreeViewItemCheckboxInfo { + checked: boolean; + tooltip?: string; + accessibilityInformation?: AccessibilityInformation +} + +/** + * The tree node. + */ +export interface TreeNode { + /** + * An unique id of this node. + */ + readonly id: string; + /** + * A human-readable name of this tree node. + * + * @deprecated use `LabelProvider.getName` instead or move this property to your tree node type + */ + readonly name?: string; + /** + * A css string for this tree node icon. + * + * @deprecated use `LabelProvider.getIcon` instead or move this property to your tree node type + */ + readonly icon?: string; + /** + * A human-readable description of this tree node. + * + * @deprecated use `LabelProvider.getLongName` instead or move this property to your tree node type + */ + readonly description?: string; + /** + * Test whether this node should be rendered. + * If undefined then node will be rendered. + */ + readonly visible?: boolean; + /** + * A parent node of this tree node. + * Undefined if this node is root. + */ + readonly parent: Readonly | undefined; + /** + * A previous sibling of this tree node. + */ + readonly previousSibling?: TreeNode; + /** + * A next sibling of this tree node. + */ + readonly nextSibling?: TreeNode; + /** + * Whether this node is busy. Greater than 0 then busy; otherwise not. + */ + readonly busy?: number; + + /** + * Whether this node is checked. + */ + readonly checkboxInfo?: TreeViewItemCheckboxInfo; +} + +export namespace TreeNode { + export function is(node: unknown): node is TreeNode { + return isObject(node) && 'id' in node && 'parent' in node; + } + + export function equals(left: TreeNode | undefined, right: TreeNode | undefined): boolean { + return left === right || (!!left && !!right && left.id === right.id); + } + + export function isVisible(node: TreeNode | undefined): boolean { + return !!node && (node.visible === undefined || node.visible); + } +} + +/** + * The composite tree node. + */ +export interface CompositeTreeNode extends TreeNode { + /** + * Child nodes of this tree node. + */ + children: ReadonlyArray; +} + +export namespace CompositeTreeNode { + export function is(node: unknown): node is CompositeTreeNode { + return isObject(node) && 'children' in node; + } + + export function getFirstChild(parent: CompositeTreeNode): TreeNode | undefined { + return parent.children[0]; + } + + export function getLastChild(parent: CompositeTreeNode): TreeNode | undefined { + return parent.children[parent.children.length - 1]; + } + + export function isAncestor(parent: CompositeTreeNode, child: TreeNode | undefined): boolean { + if (!child) { + return false; + } + if (TreeNode.equals(parent, child.parent)) { + return true; + } + return isAncestor(parent, child.parent); + } + + export function indexOf(parent: CompositeTreeNode, node: TreeNode | undefined): number { + if (!node) { + return -1; + } + return parent.children.findIndex(child => TreeNode.equals(node, child)); + } + + export function addChildren(parent: CompositeTreeNode, children: TreeNode[]): CompositeTreeNode { + for (const child of children) { + addChild(parent, child); + } + return parent; + } + + export function addChild(parent: CompositeTreeNode, child: TreeNode): CompositeTreeNode { + const children = parent.children as TreeNode[]; + const index = children.findIndex(value => value.id === child.id); + if (index !== -1) { + children.splice(index, 1, child); + setParent(child, index, parent); + } else { + children.push(child); + setParent(child, parent.children.length - 1, parent); + } + return parent; + } + + export function removeChild(parent: CompositeTreeNode, child: TreeNode): void { + const children = parent.children as TreeNode[]; + const index = children.findIndex(value => value.id === child.id); + if (index === -1) { + return; + } + children.splice(index, 1); + const { previousSibling, nextSibling } = child; + if (previousSibling) { + Object.assign(previousSibling, { nextSibling }); + } + if (nextSibling) { + Object.assign(nextSibling, { previousSibling }); + } + } + + export function setParent(child: TreeNode, index: number, parent: CompositeTreeNode): void { + const previousSibling = parent.children[index - 1]; + const nextSibling = parent.children[index + 1]; + Object.assign(child, { parent, previousSibling, nextSibling }); + if (previousSibling) { + Object.assign(previousSibling, { nextSibling: child }); + } + if (nextSibling) { + Object.assign(nextSibling, { previousSibling: child }); + } + } +} + +/** + * A default implementation of the tree. + */ +@injectable() +export class TreeImpl implements Tree { + + protected _root: TreeNode | undefined; + protected readonly onChangedEmitter = new Emitter(); + protected readonly onNodeRefreshedEmitter = new Emitter(); + protected readonly toDispose = new DisposableCollection(); + + protected readonly onDidChangeBusyEmitter = new Emitter(); + readonly onDidChangeBusy = this.onDidChangeBusyEmitter.event; + protected readonly onDidUpdateEmitter = new Emitter(); + readonly onDidUpdate = this.onDidUpdateEmitter.event; + + protected nodes: { + [id: string]: Mutable | undefined + } = {}; + + constructor() { + this.toDispose.push(this.onChangedEmitter); + this.toDispose.push(this.onNodeRefreshedEmitter); + this.toDispose.push(this.onDidChangeBusyEmitter); + this.toDispose.push(Disposable.create(() => this.toDisposeOnSetRoot.dispose())); + } + + dispose(): void { + this.nodes = {}; + this.toDispose.dispose(); + } + + get root(): TreeNode | undefined { + return this._root; + } + + protected toDisposeOnSetRoot = new DisposableCollection(); + set root(root: TreeNode | undefined) { + this.toDisposeOnSetRoot.dispose(); + const cancelRefresh = new CancellationTokenSource(); + this.toDisposeOnSetRoot.push(cancelRefresh); + this.nodes = {}; + this._root = root; + this.addNode(root); + this.refresh(undefined, cancelRefresh.token); + } + + get onChanged(): Event { + return this.onChangedEmitter.event; + } + + protected fireChanged(): void { + this.onChangedEmitter.fire(undefined); + } + + get onNodeRefreshed(): Event { + return this.onNodeRefreshedEmitter.event; + } + + protected async fireNodeRefreshed(parent: CompositeTreeNode): Promise { + await WaitUntilEvent.fire(this.onNodeRefreshedEmitter, parent); + this.fireChanged(); + } + + getNode(id: string | undefined): TreeNode | undefined { + return id !== undefined ? this.nodes[id] : undefined; + } + + validateNode(node: TreeNode | undefined): TreeNode | undefined { + const id = !!node ? node.id : undefined; + return this.getNode(id); + } + + async refresh(raw?: CompositeTreeNode, cancellationToken?: CancellationToken): Promise { + const parent = !raw ? this._root : this.validateNode(raw); + let result: CompositeTreeNode | undefined; + if (CompositeTreeNode.is(parent)) { + const busySource = new CancellationTokenSource(); + this.doMarkAsBusy(parent, 800, busySource.token); + try { + result = parent; + const children = await this.resolveChildren(parent); + if (cancellationToken?.isCancellationRequested) { return; } + result = await this.setChildren(parent, children); + if (cancellationToken?.isCancellationRequested) { return; } + } finally { + busySource.cancel(); + } + } + this.fireChanged(); + return result; + } + + protected resolveChildren(parent: CompositeTreeNode): Promise { + return Promise.resolve(Array.from(parent.children)); + } + + protected async setChildren(parent: CompositeTreeNode, children: TreeNode[]): Promise { + const root = this.getRootNode(parent); + if (this.nodes[root.id] && this.nodes[root.id] !== root) { + console.error(`Child node '${parent.id}' does not belong to this '${root.id}' tree.`); + return undefined; + } + this.removeNode(parent); + parent.children = children; + this.addNode(parent); + await this.fireNodeRefreshed(parent); + return parent; + } + + protected removeNode(node: TreeNode | undefined): void { + if (CompositeTreeNode.is(node)) { + node.children.forEach(child => this.removeNode(child)); + } + if (node) { + delete this.nodes[node.id]; + } + } + + protected getRootNode(node: TreeNode): TreeNode { + if (node.parent === undefined) { + return node; + } else { + return this.getRootNode(node.parent); + } + } + + protected addNode(node: TreeNode | undefined): void { + if (node) { + this.nodes[node.id] = node; + } + if (CompositeTreeNode.is(node)) { + const { children } = node; + children.forEach((child, index) => { + CompositeTreeNode.setParent(child, index, node); + this.addNode(child); + }); + } + } + + async markAsBusy(raw: TreeNode, ms: number, token: CancellationToken): Promise { + const node = this.validateNode(raw); + if (node) { + await this.doMarkAsBusy(node, ms, token); + } + } + + markAsChecked(node: Mutable, checked: boolean): void { + node.checkboxInfo!.checked = checked; + this.onDidUpdateEmitter.fire([node]); + } + + protected async doMarkAsBusy(node: Mutable, ms: number, token: CancellationToken): Promise { + try { + token.onCancellationRequested(() => this.doResetBusy(node)); + await timeout(ms, token); + if (token.isCancellationRequested) { return; } + this.doSetBusy(node); + } catch { + /* no-op */ + } + } + protected doSetBusy(node: Mutable): void { + const oldBusy = node.busy || 0; + node.busy = oldBusy + 1; + if (oldBusy === 0) { + this.onDidChangeBusyEmitter.fire(node); + } + } + protected doResetBusy(node: Mutable): void { + const oldBusy = node.busy || 0; + if (oldBusy > 0) { + node.busy = oldBusy - 1; + if (node.busy === 0) { + this.onDidChangeBusyEmitter.fire(node); + } + } + } + +} diff --git a/packages/core/src/browser/undo-redo-handler.ts b/packages/core/src/browser/undo-redo-handler.ts new file mode 100644 index 0000000..180ab90 --- /dev/null +++ b/packages/core/src/browser/undo-redo-handler.ts @@ -0,0 +1,85 @@ +// ***************************************************************************** +// Copyright (C) 2024 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { inject, injectable, named, postConstruct } from 'inversify'; +import { ContributionProvider } from '../common'; + +export const UndoRedoHandler = Symbol('UndoRedoHandler'); + +export interface UndoRedoHandler { + priority: number; + select(): T | undefined; + undo(item: T): void; + redo(item: T): void; +} + +@injectable() +export class UndoRedoHandlerService { + + @inject(ContributionProvider) @named(UndoRedoHandler) + protected readonly provider: ContributionProvider>; + + protected handlers: UndoRedoHandler[]; + + @postConstruct() + protected init(): void { + this.handlers = this.provider.getContributions().sort((a, b) => b.priority - a.priority); + } + + undo(): void { + for (const handler of this.handlers) { + const selection = handler.select(); + if (selection) { + handler.undo(selection); + return; + } + } + } + + redo(): void { + for (const handler of this.handlers) { + const selection = handler.select(); + if (selection) { + handler.redo(selection); + return; + } + } + } + +} + +@injectable() +export class DomInputUndoRedoHandler implements UndoRedoHandler { + + priority = 1000; + + select(): Element | undefined { + const element = document.activeElement; + if (element && ['input', 'textarea'].includes(element.tagName.toLowerCase())) { + return element; + } + return undefined; + } + + undo(item: Element): void { + document.execCommand('undo'); + } + + redo(item: Element): void { + document.execCommand('redo'); + } + +} diff --git a/packages/core/src/browser/user-working-directory-provider.ts b/packages/core/src/browser/user-working-directory-provider.ts new file mode 100644 index 0000000..ccc9c63 --- /dev/null +++ b/packages/core/src/browser/user-working-directory-provider.ts @@ -0,0 +1,77 @@ +// ***************************************************************************** +// Copyright (C) 2022 Ericsson and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { inject, injectable } from 'inversify'; +import URI from '../common/uri'; +import { MaybePromise, SelectionService, UNTITLED_SCHEME, UriSelection } from '../common'; +import { EnvVariablesServer } from '../common/env-variables'; +import { FrontendApplication } from './frontend-application'; +import { FrontendApplicationContribution } from './frontend-application-contribution'; +import { Widget } from './widgets'; +import { Navigatable } from './navigatable-types'; + +@injectable() +export class UserWorkingDirectoryProvider implements FrontendApplicationContribution { + @inject(SelectionService) protected readonly selectionService: SelectionService; + @inject(EnvVariablesServer) protected readonly envVariables: EnvVariablesServer; + + protected lastOpenResource: URI | undefined; + + configure(app: FrontendApplication): void { + app.shell.onDidChangeCurrentWidget(e => this.setLastOpenResource(e.newValue ?? undefined)); + this.setLastOpenResource(app.shell.currentWidget); + } + + protected setLastOpenResource(widget?: Widget): void { + if (Navigatable.is(widget)) { + const uri = widget.getResourceUri(); + if (uri && uri.scheme !== UNTITLED_SCHEME) { + this.lastOpenResource = uri; + } + } + } + + /** + * @returns A {@link URI} that represents a good guess about the directory in which the user is currently operating. + * + * Factors considered may include the current widget, current selection, user home directory, or other application state. + */ + async getUserWorkingDir(): Promise { + return await this.getFromSelection() + ?? this.getFromUserHome(); + } + + protected getFromSelection(): MaybePromise { + const uri = UriSelection.getUri(this.selectionService.selection); + if (uri?.scheme === UNTITLED_SCHEME) { + // An untitled file is not a valid working directory context. + return undefined; + } + return this.ensureIsDirectory(uri); + } + + protected getFromLastOpenResource(): MaybePromise { + return this.ensureIsDirectory(this.lastOpenResource); + } + + protected getFromUserHome(): MaybePromise { + return this.envVariables.getHomeDirUri().then(home => new URI(home)); + } + + protected ensureIsDirectory(uri?: URI): MaybePromise { + return uri?.parent; + } +} diff --git a/packages/core/src/browser/view-container.ts b/packages/core/src/browser/view-container.ts new file mode 100644 index 0000000..400b93f --- /dev/null +++ b/packages/core/src/browser/view-container.ts @@ -0,0 +1,1666 @@ +// ***************************************************************************** +// Copyright (C) 2018-2019 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { interfaces, injectable, inject, postConstruct } from 'inversify'; +import { find, some, every, map, ArrayExt } from '@lumino/algorithm'; +import { + Widget, EXPANSION_TOGGLE_CLASS, COLLAPSED_CLASS, CODICON_TREE_ITEM_CLASSES, MessageLoop, Message, SplitPanel, + BaseWidget, addEventListener, SplitLayout, LayoutItem, PanelLayout, addKeyListener, waitForRevealed, UnsafeWidgetUtilities, DockPanel, PINNED_CLASS +} from './widgets'; +import { Event as CommonEvent, Emitter } from '../common/event'; +import { Disposable, DisposableCollection } from '../common/disposable'; +import { CommandRegistry } from '../common/command'; +import { MenuModelRegistry, MenuPath, MenuAction, SubmenuImpl, ActionMenuNode, Submenu } from '../common/menu'; +import { ApplicationShell, StatefulWidget, SplitPositionHandler, SplitPositionOptions, SIDE_PANEL_TOOLBAR_CONTEXT_MENU } from './shell'; +import { MAIN_AREA_ID, BOTTOM_AREA_ID } from './shell/theia-dock-panel'; +import { FrontendApplicationStateService } from './frontend-application-state'; +import { ContextMenuRenderer, Anchor } from './context-menu-renderer'; +import { parseCssMagnitude } from './browser'; +import { TabBarToolbarRegistry, TabBarToolbarFactory, TabBarToolbar, TabBarDelegator } from './shell/tab-bar-toolbar'; +import { isEmpty, isObject, nls } from '../common'; +import { WidgetManager } from './widget-manager'; +import { Key } from './keys'; +import { ProgressBarFactory } from './progress-bar-factory'; +import { Drag } from '@lumino/dragdrop'; +import { MimeData } from '@lumino/coreutils'; +import { ElementExt } from '@lumino/domutils'; +import { TabBarDecoratorService } from './shell/tab-bar-decorator'; +import { ContextKeyService } from './context-key-service'; +import { KeybindingRegistry } from './keybinding'; +import { SubmenuAsToolbarItemWrapper } from './shell/tab-bar-toolbar/tab-bar-toolbar-menu-adapters'; +import { TheiaSplitPanel } from './shell/theia-split-panel'; + +export interface ViewContainerTitleOptions { + label: string; + caption?: string; + iconClass?: string; + closeable?: boolean; +} + +@injectable() +export class ViewContainerIdentifier { + id: string; + progressLocationId?: string; +} + +export interface DescriptionWidget { + description: string; + onDidChangeDescription: CommonEvent; +} + +export interface BadgeWidget { + badge?: number; + badgeTooltip?: string; + onDidChangeBadge: CommonEvent; + onDidChangeBadgeTooltip: CommonEvent; +} + +export namespace DescriptionWidget { + export function is(arg: unknown): arg is DescriptionWidget { + return isObject(arg) && 'onDidChangeDescription' in arg; + } +} + +export namespace BadgeWidget { + export function is(arg: unknown): arg is BadgeWidget { + return isObject(arg) && 'onDidChangeBadge' in arg && 'onDidChangeBadgeTooltip' in arg; + } +} + +/** + * A widget that may change it's internal structure dynamically. + * Current use is to update the toolbar when a contributed view is constructed "lazily". + */ +export interface DynamicToolbarWidget { + onDidChangeToolbarItems: CommonEvent; +} + +export namespace DynamicToolbarWidget { + export function is(arg: unknown): arg is DynamicToolbarWidget { + return isObject(arg) && 'onDidChangeToolbarItems' in arg; + } +} + +class PartsMenuToolbarItem extends SubmenuAsToolbarItemWrapper { + constructor( + protected readonly target: () => Widget | undefined, + effectiveMenuPath: MenuPath, + commandRegistry: CommandRegistry, + menuRegistry: MenuModelRegistry, + contextKeyService: ContextKeyService, + contextMenuRenderer: ContextMenuRenderer, + menuNode: Submenu, + group: string | undefined, + menuPath?: MenuPath, + ) { + super(effectiveMenuPath, commandRegistry, menuRegistry, contextKeyService, contextMenuRenderer, menuNode, group); + } + + override isVisible(widget: Widget): boolean { + return widget === this.target() && super.isVisible(widget); + } +} + +/** + * A view container holds an arbitrary number of widgets inside a split panel. + * Each widget is wrapped in a _part_ that displays the widget title and toolbar + * and allows to collapse / expand the widget content. + */ +@injectable() +export class ViewContainer extends BaseWidget implements StatefulWidget, ApplicationShell.TrackableWidgetProvider, TabBarDelegator { + + protected panel: SplitPanel; + + protected currentPart: ViewContainerPart | undefined; + + /** + * Disable dragging parts from/to this view container. + */ + disableDNDBetweenContainers = false; + + @inject(FrontendApplicationStateService) + protected readonly applicationStateService: FrontendApplicationStateService; + + @inject(ContextMenuRenderer) + protected readonly contextMenuRenderer: ContextMenuRenderer; + + @inject(CommandRegistry) + protected readonly commandRegistry: CommandRegistry; + + @inject(MenuModelRegistry) + protected readonly menuRegistry: MenuModelRegistry; + + @inject(WidgetManager) + protected readonly widgetManager: WidgetManager; + + @inject(SplitPositionHandler) + protected readonly splitPositionHandler: SplitPositionHandler; + + @inject(ViewContainerIdentifier) + readonly options: ViewContainerIdentifier; + + @inject(TabBarToolbarRegistry) + protected readonly toolbarRegistry: TabBarToolbarRegistry; + + @inject(TabBarToolbarFactory) + protected readonly toolbarFactory: TabBarToolbarFactory; + + protected readonly onDidChangeTrackableWidgetsEmitter = new Emitter(); + readonly onDidChangeTrackableWidgets = this.onDidChangeTrackableWidgetsEmitter.event; + + @inject(ProgressBarFactory) + protected readonly progressBarFactory: ProgressBarFactory; + + @inject(ApplicationShell) + protected readonly shell: ApplicationShell; + + @inject(TabBarDecoratorService) + protected readonly decoratorService: TabBarDecoratorService; + + @inject(ContextKeyService) + protected readonly contextKeyService: ContextKeyService; + + @inject(KeybindingRegistry) + protected readonly keybindingRegistry: KeybindingRegistry; + + @postConstruct() + protected init(): void { + this.toDispose.push(Disposable.create(() => { + this.toDisposeOnUpdateTitle.dispose(); + this.toDisposeOnDragEnd.dispose(); + })); + this.id = this.options.id; + this.addClass('theia-view-container'); + const layout = new PanelLayout(); + this.layout = layout; + this.panel = new TheiaSplitPanel({ + layout: new ViewContainerLayout({ + renderer: SplitPanel.defaultRenderer, + orientation: this.orientation, + spacing: 2, + headerSize: ViewContainerPart.HEADER_HEIGHT, + animationDuration: 200 + }, this.splitPositionHandler) + }); + this.panel.node.tabIndex = -1; + this.configureLayout(layout); + + const { commandRegistry, menuRegistry, contextMenuRenderer } = this; + this.toDispose.pushAll([ + addEventListener(this.node, 'contextmenu', event => { + if (event.button === 2 && every(this.containerLayout.iter(), part => !!part.isHidden)) { + event.stopPropagation(); + event.preventDefault(); + contextMenuRenderer.render({ + menuPath: this.contextMenuPath, + anchor: event, + context: event.currentTarget instanceof HTMLElement ? event.currentTarget : this.node + }); + } + }), + commandRegistry.registerCommand({ id: this.globalHideCommandId }, { + execute: (anchor: Anchor) => { + const toHide = this.findPartForAnchor(anchor); + if (toHide && toHide.canHide) { + toHide.hide(); + } + }, + isVisible: (anchor: Anchor) => { + const toHide = this.findPartForAnchor(anchor); + if (toHide) { + return toHide.canHide && !toHide.isHidden; + } else { + return some(this.containerLayout.iter(), part => !part.isHidden); + } + } + }), + menuRegistry.registerMenuAction([...this.contextMenuPath, '0_global'], { + commandId: this.globalHideCommandId, + label: nls.localizeByDefault('Hide') + }), + this.onDidChangeTrackableWidgetsEmitter, + this.onDidChangeTrackableWidgets(() => this.decoratorService.fireDidChangeDecorations()) + ]); + if (this.options.progressLocationId) { + this.toDispose.push(this.progressBarFactory({ container: this.node, insertMode: 'prepend', locationId: this.options.progressLocationId })); + } + } + + protected configureLayout(layout: PanelLayout): void { + layout.addWidget(this.panel); + } + + protected updateCurrentPart(part?: ViewContainerPart): void { + if (part && this.getParts().indexOf(part) !== -1) { + this.currentPart = part; + } + if (this.currentPart && !this.currentPart.isDisposed) { + return; + } + const visibleParts = this.getParts().filter(p => !p.isHidden); + const expandedParts = visibleParts.filter(p => !p.collapsed); + this.currentPart = expandedParts[0] || visibleParts[0]; + } + + protected updateSplitterVisibility(): void { + const className = 'lm-first-visible'; + let firstFound = false; + for (const part of this.getParts()) { + if (!part.isHidden && !firstFound) { + part.addClass(className); + firstFound = true; + } else { + part.removeClass(className); + } + } + } + + protected titleOptions: ViewContainerTitleOptions | undefined; + + setTitleOptions(titleOptions: ViewContainerTitleOptions | undefined): void { + this.titleOptions = titleOptions; + this.updateTitle(); + } + + protected toDisposeOnUpdateTitle = new DisposableCollection(); + + protected _tabBarDelegate: Widget = this; + updateTabBarDelegate(): void { + const visibleParts = this.getParts().filter(part => !part.isHidden); + if (visibleParts.length === 1) { + this._tabBarDelegate = visibleParts[0].wrapped; + } else { + this._tabBarDelegate = this; + } + } + + getTabBarDelegate(): Widget | undefined { + return this._tabBarDelegate; + } + + protected updateTitle(): void { + this.toDisposeOnUpdateTitle.dispose(); + this.toDisposeOnUpdateTitle = new DisposableCollection(); + this.updateTabBarDelegate(); + let title = Object.assign({}, this.titleOptions); + if (isEmpty(title)) { + return; + } + const allParts = this.getParts(); + const visibleParts = allParts.filter(part => !part.isHidden); + this.title.label = title.label; + // If there's only one visible part - inline it's title into the container title except in case the part + // isn't originally belongs to this container but there are other **original** hidden parts. + if (visibleParts.length === 1 && (visibleParts[0].originalContainerId === this.id || !this.findOriginalPart())) { + const part = visibleParts[0]; + this.toDisposeOnUpdateTitle.push(part.onTitleChanged(() => this.updateTitle())); + const partLabel = part.wrapped.title.label; + // Change the container title if it contains only one part that originally belongs to another container. + if (allParts.length === 1 && part.originalContainerId !== this.id && !this.isCurrentTitle(part.originalContainerTitle)) { + title = Object.assign({}, part.originalContainerTitle); + this.setTitleOptions(title); + return; + } + if (partLabel) { + if (this.title.label && this.title.label !== partLabel) { + this.title.label += ': ' + partLabel; + } else { + this.title.label = partLabel; + } + } + part.collapsed = false; + part.hideTitle(); + } else { + visibleParts.forEach(part => part.showTitle()); + // If at least one part originally belongs to this container the title should return to its original value. + const originalPart = this.findOriginalPart(); + if (originalPart && !this.isCurrentTitle(originalPart.originalContainerTitle)) { + title = Object.assign({}, originalPart.originalContainerTitle); + this.setTitleOptions(title); + return; + } + } + this.updateToolbarItems(allParts); + this.title.caption = title?.caption || title?.label; + if (title.iconClass) { + this.title.iconClass = title.iconClass; + } + if (this.title.className.includes(PINNED_CLASS)) { + this.title.closable &&= false; + } else if (title.closeable !== undefined) { + this.title.closable = title.closeable; + } + } + + protected updateToolbarItems(allParts: ViewContainerPart[]): void { + if (allParts.length > 1) { + const group = new SubmenuImpl(`toggleParts-${this.id}`, this.getToggleVisibilityGroupLabel(), undefined, '000'); + for (const part of allParts) { + const existingId = this.toggleVisibilityCommandId(part); + const { label } = part.wrapped.title; + group.addNode(new ActionMenuNode({ + commandId: existingId, + label: label + }, this.commandRegistry, this.keybindingRegistry, this.contextKeyService)); + } + + // widget === this.getTabBarDelegate() + + const toolbarItem = new PartsMenuToolbarItem(() => this.getTabBarDelegate(), [this.id], this.commandRegistry, this.menuRegistry, + this.contextKeyService, this.contextMenuRenderer, group, '000_views', [this.id]); + this.toDisposeOnUpdateTitle.push(this.toolbarRegistry.doRegisterItem(toolbarItem)); + } + } + + protected getToggleVisibilityGroupLabel(): string { + return 'Views'; + } + + protected findOriginalPart(): ViewContainerPart | undefined { + return this.getParts().find(part => part.originalContainerId === this.id); + } + + protected isCurrentTitle(titleOptions: ViewContainerTitleOptions | undefined): boolean { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + return (!!titleOptions && !!this.titleOptions && Object.keys(titleOptions).every(key => (titleOptions as any)[key] === (this.titleOptions as any)[key])) + || (!titleOptions && !this.titleOptions); + } + + protected findPartForAnchor(anchor: Anchor): ViewContainerPart | undefined { + const element = document.elementFromPoint(anchor.x, anchor.y); + if (element instanceof Element) { + const closestPart = ViewContainerPart.closestPart(element); + if (closestPart && closestPart.id) { + return find(this.containerLayout.iter(), part => part.id === closestPart.id); + } + } + return undefined; + } + + protected readonly toRemoveWidgets = new Map(); + + protected createPartId(widget: Widget): string { + const description = this.widgetManager.getDescription(widget); + return widget.id || JSON.stringify(description); + } + + addWidget(widget: Widget, options?: ViewContainer.Factory.WidgetOptions, originalContainerId?: string, originalContainerTitle?: ViewContainerTitleOptions): Disposable { + const existing = this.toRemoveWidgets.get(widget.id); + if (existing) { + return existing; + } + const partId = this.createPartId(widget); + const newPart = this.createPart(widget, partId, originalContainerId || this.id, originalContainerTitle || this.titleOptions, options); + return this.attachNewPart(newPart); + } + + protected attachNewPart(newPart: ViewContainerPart, insertIndex?: number): Disposable { + const toRemoveWidget = new DisposableCollection(); + this.toDispose.push(toRemoveWidget); + this.toRemoveWidgets.set(newPart.wrapped.id, toRemoveWidget); + toRemoveWidget.push(Disposable.create(() => this.toRemoveWidgets.delete(newPart.wrapped.id))); + this.registerPart(newPart); + if (insertIndex !== undefined || (newPart.options && newPart.options.order !== undefined)) { + const index = insertIndex ?? this.getParts().findIndex(part => part.options.order === undefined || part.options.order > newPart.options.order!); + if (index >= 0) { + this.containerLayout.insertWidget(index, newPart); + } else { + this.containerLayout.addWidget(newPart); + } + } else { + this.containerLayout.addWidget(newPart); + } + this.refreshMenu(newPart); + this.updateTitle(); + this.updateCurrentPart(); + this.updateSplitterVisibility(); + this.update(); + this.fireDidChangeTrackableWidgets(); + toRemoveWidget.pushAll([ + Disposable.create(() => { + if (newPart.currentViewContainerId === this.id) { + newPart.dispose(); + } + this.unregisterPart(newPart); + if (!newPart.isDisposed && this.getPartIndex(newPart.id) > -1) { + this.containerLayout.removeWidget(newPart); + } + if (!this.isDisposed) { + this.update(); + this.updateTitle(); + this.updateCurrentPart(); + this.updateSplitterVisibility(); + this.fireDidChangeTrackableWidgets(); + } + }), + this.registerDND(newPart), + newPart.onDidChangeVisibility(() => { + this.updateTitle(); + this.updateCurrentPart(); + this.updateSplitterVisibility(); + this.containerLayout.updateSashes(); + }), + newPart.onCollapsed(() => { + this.containerLayout.updateCollapsed(newPart, this.enableAnimation); + this.containerLayout.updateSashes(); + this.updateCurrentPart(); + }), + newPart.onContextMenu(event => { + if (event.button === 2) { + event.preventDefault(); + event.stopPropagation(); + this.contextMenuRenderer.render({ menuPath: this.contextMenuPath, anchor: event, context: this.node }); + } + }), + newPart.onTitleChanged(() => this.refreshMenu(newPart)), + newPart.onDidFocus(() => this.updateCurrentPart(newPart)) + ]); + + newPart.disposed.connect(() => toRemoveWidget.dispose()); + return toRemoveWidget; + } + + protected createPart(widget: Widget, partId: string, originalContainerId: string, originalContainerTitle?: ViewContainerTitleOptions, + options?: ViewContainer.Factory.WidgetOptions): ViewContainerPart { + + return new ViewContainerPart(widget, partId, this.id, originalContainerId, originalContainerTitle, this.toolbarRegistry, this.toolbarFactory, options); + } + + removeWidget(widget: Widget): boolean { + const disposable = this.toRemoveWidgets.get(widget.id); + if (disposable) { + disposable.dispose(); + return true; + } + return false; + } + + getParts(): ViewContainerPart[] { + return this.containerLayout.widgets; + } + + protected getPartIndex(partId: string | undefined): number { + if (partId) { + return this.getParts().findIndex(part => part.id === partId); + } + return -1; + } + + getPartFor(widget: Widget): ViewContainerPart | undefined { + return this.getParts().find(p => p.wrapped.id === widget.id); + } + + get containerLayout(): ViewContainerLayout { + const layout = this.panel.layout; + if (layout instanceof ViewContainerLayout) { + return layout; + } + throw new Error('view container is disposed'); + } + + protected get orientation(): SplitLayout.Orientation { + return ViewContainer.getOrientation(this.node); + } + + protected get enableAnimation(): boolean { + return this.applicationStateService.state === 'ready'; + } + + protected lastVisibleState: ViewContainer.State | undefined; + + storeState(): ViewContainer.State { + if (!this.isVisible && this.lastVisibleState) { + return this.lastVisibleState; + } + return this.doStoreState(); + } + protected doStoreState(): ViewContainer.State { + const parts = this.getParts(); + const availableSize = this.containerLayout.getAvailableSize(); + const orientation = this.orientation; + const partStates = parts.map(part => { + let size = this.containerLayout.getPartSize(part); + if (size && size > ViewContainerPart.HEADER_HEIGHT && orientation === 'vertical') { + size -= ViewContainerPart.HEADER_HEIGHT; + } + return { + widget: part.wrapped, + partId: part.partId, + collapsed: part.collapsed, + hidden: part.isHidden, + relativeSize: size && availableSize ? size / availableSize : undefined, + originalContainerId: part.originalContainerId, + originalContainerTitle: part.originalContainerTitle + }; + }); + return { parts: partStates, title: this.titleOptions }; + } + + restoreState(state: ViewContainer.State): void { + this.lastVisibleState = state; + this.doRestoreState(state); + } + protected doRestoreState(state: ViewContainer.State): void { + this.setTitleOptions(state.title); + // restore widgets + for (const part of state.parts) { + if (part.widget) { + this.addWidget(part.widget, undefined, part.originalContainerId, part.originalContainerTitle || {} as ViewContainerTitleOptions); + } + } + const partStates = state.parts.filter(partState => some(this.containerLayout.iter(), p => p.partId === partState.partId)); + + // Reorder the parts according to the stored state + for (let index = 0; index < partStates.length; index++) { + const partState = partStates[index]; + const widget = this.getParts().find(part => part.partId === partState.partId); + if (widget) { + this.containerLayout.insertWidget(index, widget); + } + } + + // Restore visibility and collapsed state + const parts = this.getParts(); + for (let index = 0; index < parts.length; index++) { + const part = parts[index]; + const partState = partStates.find(s => part.partId === s.partId); + if (partState) { + part.setHidden(partState.hidden); + part.collapsed = partState.collapsed || !partState.relativeSize; + } else if (part.canHide) { + part.hide(); + } + this.refreshMenu(part); + } + + // Restore part sizes + waitForRevealed(this).then(() => { + this.containerLayout.setPartSizes(partStates.map(partState => partState.relativeSize)); + this.updateSplitterVisibility(); + }); + } + + /** + * Register a command to toggle the visibility of the new part. + */ + protected registerPart(toRegister: ViewContainerPart): void { + const commandId = this.toggleVisibilityCommandId(toRegister); + this.commandRegistry.registerCommand({ id: commandId }, { + execute: () => { + const toHide = find(this.containerLayout.iter(), part => part.id === toRegister.id); + if (toHide) { + toHide.setHidden(!toHide.isHidden); + } + }, + isToggled: () => { + if (!toRegister.canHide) { + return true; + } + const widgetToToggle = find(this.containerLayout.iter(), part => part.id === toRegister.id); + if (widgetToToggle) { + return !widgetToToggle.isHidden; + } + return false; + }, + isEnabled: arg => toRegister.canHide && (!this.titleOptions || !(arg instanceof Widget) || arg === this.getTabBarDelegate()), + isVisible: arg => !this.titleOptions || !(arg instanceof Widget) || arg === this.getTabBarDelegate() + }); + } + + /** + * Register a menu action to toggle the visibility of the new part. + * The menu action is unregistered first to enable refreshing the order of menu actions. + */ + protected refreshMenu(part: ViewContainerPart): void { + const commandId = this.toggleVisibilityCommandId(part); + this.menuRegistry.unregisterMenuAction(commandId); + if (!part.wrapped.title.label) { + return; + } + const { dataset: { visibilityCommandLabel }, caption, label } = part.wrapped.title; + const action: MenuAction = { + commandId: commandId, + label: visibilityCommandLabel || caption || label, + order: this.getParts().indexOf(part).toString() + }; + this.menuRegistry.registerMenuAction([...this.contextMenuPath, '1_widgets'], action); + if (this.titleOptions) { + this.menuRegistry.registerMenuAction([...SIDE_PANEL_TOOLBAR_CONTEXT_MENU, 'navigation'], action); + } + } + + protected unregisterPart(part: ViewContainerPart): void { + const commandId = this.toggleVisibilityCommandId(part); + this.commandRegistry.unregisterCommand(commandId); + this.menuRegistry.unregisterMenuAction(commandId); + } + + protected get contextMenuPath(): MenuPath { + return [`${this.id}-context-menu`]; + } + + protected toggleVisibilityCommandId(part: ViewContainerPart): string { + return `${this.id}:toggle-visibility-${part.id}`; + } + + protected get globalHideCommandId(): string { + return `${this.id}:toggle-visibility`; + } + + protected moveBefore(toMovedId: string, moveBeforeThisId: string): void { + const parts = this.getParts(); + const indexToMove = parts.findIndex(part => part.id === toMovedId); + const targetIndex = parts.findIndex(part => part.id === moveBeforeThisId); + if (indexToMove >= 0 && targetIndex >= 0) { + this.containerLayout.insertWidget(targetIndex, parts[indexToMove]); + for (let index = Math.min(indexToMove, targetIndex); index < parts.length; index++) { + this.refreshMenu(parts[index]); + this.activate(); + } + } + this.updateSplitterVisibility(); + } + + getTrackableWidgets(): Widget[] { + return this.getParts().map(w => w.wrapped); + } + + protected fireDidChangeTrackableWidgets(): void { + this.onDidChangeTrackableWidgetsEmitter.fire(this.getTrackableWidgets()); + } + + activateWidget(id: string): Widget | undefined { + const part = this.revealPart(id); + if (!part) { + return undefined; + } + this.updateCurrentPart(part); + part.collapsed = false; + return part.wrapped; + } + + revealWidget(id: string): Widget | undefined { + const part = this.revealPart(id); + return part && part.wrapped; + } + + protected revealPart(id: string): ViewContainerPart | undefined { + const part = this.getParts().find(p => p.wrapped.id === id); + if (!part) { + return undefined; + } + part.setHidden(false); + return part; + } + + protected override onActivateRequest(msg: Message): void { + super.onActivateRequest(msg); + if (this.currentPart) { + this.currentPart.activate(); + } else { + this.panel.node.focus({ preventScroll: true }); + } + } + + protected override onAfterAttach(msg: Message): void { + const orientation = this.orientation; + this.containerLayout.orientation = orientation; + if (orientation === 'horizontal') { + for (const part of this.getParts()) { + part.collapsed = false; + } + } + super.onAfterAttach(msg); + } + + protected override onBeforeHide(msg: Message): void { + super.onBeforeHide(msg); + this.lastVisibleState = this.storeState(); + } + + protected override onAfterShow(msg: Message): void { + super.onAfterShow(msg); + this.updateTitle(); + this.lastVisibleState = undefined; + } + + protected override onBeforeAttach(msg: Message): void { + super.onBeforeAttach(msg); + this.node.addEventListener('lm-dragenter', this, true); + this.node.addEventListener('lm-dragover', this, true); + this.node.addEventListener('lm-dragleave', this, true); + this.node.addEventListener('lm-drop', this, true); + } + + protected override onAfterDetach(msg: Message): void { + super.onAfterDetach(msg); + this.node.removeEventListener('lm-dragenter', this, true); + this.node.removeEventListener('lm-dragover', this, true); + this.node.removeEventListener('lm-dragleave', this, true); + this.node.removeEventListener('lm-drop', this, true); + } + + handleEvent(event: Event): void { + switch (event.type) { + case 'lm-dragenter': + this.handleDragEnter(event as Drag.Event); + break; + case 'lm-dragover': + this.handleDragOver(event as Drag.Event); + break; + case 'lm-dragleave': + this.handleDragLeave(event as Drag.Event); + break; + case 'lm-drop': + this.handleDrop(event as Drag.Event); + break; + } + } + + handleDragEnter(event: Drag.Event): void { + if (event.mimeData.hasData('application/vnd.lumino.view-container-factory')) { + event.preventDefault(); + event.stopPropagation(); + } + } + + toDisposeOnDragEnd = new DisposableCollection(); + handleDragOver(event: Drag.Event): void { + const factory = event.mimeData.getData('application/vnd.lumino.view-container-factory'); + const widget = factory && factory(); + if (!(widget instanceof ViewContainerPart)) { + return; + } + event.preventDefault(); + event.stopPropagation(); + + const sameContainers = this.id === widget.currentViewContainerId; + const targetPart = ArrayExt.findFirstValue(this.getParts(), (p => ElementExt.hitTest(p.node, event.clientX, event.clientY))); + if (!targetPart && sameContainers) { + event.dropAction = 'none'; + return; + } + if (targetPart) { + // add overlay class style to the `targetPart` node. + targetPart.node.classList.add('drop-target'); + this.toDisposeOnDragEnd.push(Disposable.create(() => targetPart.node.classList.remove('drop-target'))); + } else { + // show panel overlay. + const dockPanel = this.getDockPanel(); + if (dockPanel) { + dockPanel.overlay.show({ top: 0, bottom: 0, right: 0, left: 0 }); + this.toDisposeOnDragEnd.push(Disposable.create(() => dockPanel.overlay.hide(100))); + } + } + + const isDraggingOutsideDisabled = this.disableDNDBetweenContainers || widget.viewContainer?.disableDNDBetweenContainers + || widget.options.disableDraggingToOtherContainers; + if (isDraggingOutsideDisabled && !sameContainers) { + const { target } = event; + if (target instanceof HTMLElement) { + target.classList.add('theia-cursor-no-drop'); + this.toDisposeOnDragEnd.push(Disposable.create(() => { + target.classList.remove('theia-cursor-no-drop'); + })); + } + event.dropAction = 'none'; + return; + }; + + event.dropAction = event.proposedAction; + }; + + handleDragLeave(event: Drag.Event): void { + this.toDisposeOnDragEnd.dispose(); + if (event.mimeData.hasData('application/vnd.lumino.view-container-factory')) { + event.preventDefault(); + event.stopPropagation(); + } + }; + + handleDrop(event: Drag.Event): void { + this.toDisposeOnDragEnd.dispose(); + const factory = event.mimeData.getData('application/vnd.lumino.view-container-factory'); + const draggedPart = factory && factory(); + if (!(draggedPart instanceof ViewContainerPart)) { + event.dropAction = 'none'; + return; + } + event.preventDefault(); + event.stopPropagation(); + const parts = this.getParts(); + const toIndex = ArrayExt.findFirstIndex(parts, part => ElementExt.hitTest(part.node, event.clientX, event.clientY)); + if (draggedPart.currentViewContainerId !== this.id) { + this.attachNewPart(draggedPart, toIndex > -1 ? toIndex + 1 : toIndex); + draggedPart.onPartMoved(this); + } else { + this.moveBefore(draggedPart.id, parts[toIndex].id); + } + event.dropAction = event.proposedAction; + } + + protected registerDND(part: ViewContainerPart): Disposable { + part.headerElement.draggable = true; + + return new DisposableCollection( + addEventListener(part.headerElement, 'dragstart', + event => { + event.preventDefault(); + const mimeData = new MimeData(); + mimeData.setData('application/vnd.lumino.view-container-factory', () => part); + const clonedHeader = part.headerElement.cloneNode(true) as HTMLElement; + clonedHeader.style.width = part.node.style.width; + clonedHeader.style.opacity = '0.6'; + const drag = new Drag({ + mimeData, + dragImage: clonedHeader, + proposedAction: 'move', + supportedActions: 'move' + }); + part.node.classList.add('lm-mod-hidden'); + drag.start(event.clientX, event.clientY).then(dropAction => { + // The promise is resolved when the drag has ended + if (dropAction === 'move' && part.currentViewContainerId !== this.id) { + this.removeWidget(part.wrapped); + this.lastVisibleState = this.doStoreState(); + } + }); + setTimeout(() => { part.node.classList.remove('lm-mod-hidden'); }, 0); + }, false)); + } + + protected getDockPanel(): DockPanel | undefined { + let panel: DockPanel | undefined; + let parent = this.parent; + while (!panel && parent) { + if (this.isSideDockPanel(parent)) { + panel = parent as DockPanel; + } else { + parent = parent.parent; + } + } + return panel; + } + + protected isSideDockPanel(widget: Widget): boolean { + const { leftPanelHandler, rightPanelHandler } = this.shell; + if (widget instanceof DockPanel && (widget.id === rightPanelHandler.dockPanel.id || widget.id === leftPanelHandler.dockPanel.id)) { + return true; + } + return false; + } + +} + +export namespace ViewContainer { + + export const Factory = Symbol('ViewContainerFactory'); + export interface Factory { + (options: ViewContainerIdentifier): ViewContainer; + } + + export namespace Factory { + + export interface WidgetOptions { + readonly order?: number; + readonly weight?: number; + readonly initiallyCollapsed?: boolean; + readonly canHide?: boolean; + readonly initiallyHidden?: boolean; + /** + * Disable dragging this part from its original container to other containers, + * But allow dropping parts from other containers on it, + * This option only applies to the `ViewContainerPart` and has no effect on the ViewContainer. + */ + readonly disableDraggingToOtherContainers?: boolean; + } + + export interface WidgetDescriptor { + readonly widget: Widget | interfaces.ServiceIdentifier; + readonly options?: WidgetOptions; + } + + } + + export interface State { + title?: ViewContainerTitleOptions; + parts: ViewContainerPart.State[] + } + + export function getOrientation(node: HTMLElement): 'horizontal' | 'vertical' { + if (node.closest(`#${MAIN_AREA_ID}`) || node.closest(`#${BOTTOM_AREA_ID}`)) { + return 'horizontal'; + } + return 'vertical'; + } +} + +/** + * Wrapper around a widget held by a view container. Adds a header to display the + * title, toolbar, and collapse / expand handle. + */ +export class ViewContainerPart extends BaseWidget { + + protected readonly header: HTMLElement; + protected readonly body: HTMLElement; + protected readonly collapsedEmitter = new Emitter(); + protected readonly contextMenuEmitter = new Emitter(); + + protected readonly onTitleChangedEmitter = new Emitter(); + readonly onTitleChanged = this.onTitleChangedEmitter.event; + protected readonly onDidFocusEmitter = new Emitter(); + readonly onDidFocus = this.onDidFocusEmitter.event; + protected readonly onPartMovedEmitter = new Emitter(); + readonly onDidMove = this.onPartMovedEmitter.event; + protected readonly onDidChangeDescriptionEmitter = new Emitter(); + readonly onDidChangeDescription = this.onDidChangeDescriptionEmitter.event; + protected readonly onDidChangeBadgeEmitter = new Emitter(); + readonly onDidChangeBadge = this.onDidChangeBadgeEmitter.event; + protected readonly onDidChangeBadgeTooltipEmitter = new Emitter(); + readonly onDidChangeBadgeTooltip = this.onDidChangeBadgeTooltipEmitter.event; + + protected readonly toolbar: TabBarToolbar; + + protected _collapsed: boolean; + + uncollapsedSize: number | undefined; + animatedSize: number | undefined; + + protected readonly toNoDisposeWrapped: Disposable; + + constructor( + readonly wrapped: Widget, + readonly partId: string, + protected currentContainerId: string, + readonly originalContainerId: string, + readonly originalContainerTitle: ViewContainerTitleOptions | undefined, + protected readonly toolbarRegistry: TabBarToolbarRegistry, + protected readonly toolbarFactory: TabBarToolbarFactory, + readonly options: ViewContainer.Factory.WidgetOptions = {} + ) { + super(); + wrapped.parent = this; + wrapped.disposed.connect(() => this.dispose()); + this.id = `${originalContainerId}--${wrapped.id}`; + this.addClass('part'); + + const fireTitleChanged = () => this.onTitleChangedEmitter.fire(undefined); + this.wrapped.title.changed.connect(fireTitleChanged); + this.toDispose.push(Disposable.create(() => this.wrapped.title.changed.disconnect(fireTitleChanged))); + + if (DescriptionWidget.is(this.wrapped)) { + this.wrapped?.onDidChangeDescription(() => this.onDidChangeDescriptionEmitter.fire(), undefined, this.toDispose); + } + + if (BadgeWidget.is(this.wrapped)) { + this.wrapped.onDidChangeBadge(() => this.onDidChangeBadgeEmitter.fire(), undefined, this.toDispose); + this.wrapped.onDidChangeBadgeTooltip(() => this.onDidChangeBadgeTooltipEmitter.fire(), undefined, this.toDispose); + } + + if (DynamicToolbarWidget.is(this.wrapped)) { + this.wrapped.onDidChangeToolbarItems(() => { + this.toolbar.updateTarget(this.wrapped); + this.viewContainer?.update(); + }); + } + + const { header, body, disposable } = this.createContent(); + this.header = header; + this.body = body; + + this.toNoDisposeWrapped = this.toDispose.push(wrapped); + this.toolbar = this.toolbarFactory(); + this.toolbar.addClass('theia-view-container-part-title'); + + this.toDispose.pushAll([ + disposable, + this.toolbar, + this.toolbarRegistry.onDidChange(() => this.toolbar.updateTarget(this.wrapped)), + this.collapsedEmitter, + this.contextMenuEmitter, + this.onTitleChangedEmitter, + this.onDidChangeDescriptionEmitter, + this.onDidChangeBadgeEmitter, + this.onDidChangeBadgeTooltipEmitter, + this.registerContextMenu(), + this.onDidFocusEmitter, + // focus event does not bubble, capture it + addEventListener(this.node, 'focus', () => this.onDidFocusEmitter.fire(this), true) + ]); + this.scrollOptions = { + suppressScrollX: true, + minScrollbarLength: 35 + }; + this.collapsed = !!options.initiallyCollapsed; + if (options.initiallyHidden && this.canHide) { + this.hide(); + } + } + + get viewContainer(): ViewContainer | undefined { + return this.parent ? this.parent.parent as ViewContainer : undefined; + } + + get currentViewContainerId(): string { + return this.currentContainerId; + } + + get headerElement(): HTMLElement { + return this.header; + } + + get collapsed(): boolean { + return this._collapsed; + } + + set collapsed(collapsed: boolean) { + // Cannot collapse/expand if the orientation of the container is `horizontal`. + const orientation = ViewContainer.getOrientation(this.node); + if (this._collapsed === collapsed || (orientation === 'horizontal' && collapsed)) { + return; + } + this._collapsed = collapsed; + this.node.classList.toggle('collapsed', collapsed); + + if (collapsed && this.wrapped.node.contains(document.activeElement)) { + this.header.focus(); + } + this.wrapped.setHidden(collapsed); + const toggleIcon = this.header.querySelector(`span.${EXPANSION_TOGGLE_CLASS}`); + if (toggleIcon) { + if (collapsed) { + toggleIcon.classList.add(COLLAPSED_CLASS); + } else { + toggleIcon.classList.remove(COLLAPSED_CLASS); + } + } + this.update(); + this.collapsedEmitter.fire(collapsed); + } + + onPartMoved(newContainer: ViewContainer): void { + this.currentContainerId = newContainer.id; + this.onPartMovedEmitter.fire(newContainer); + } + + override setHidden(hidden: boolean): void { + if (!this.canHide) { + return; + } + super.setHidden(hidden); + } + + get canHide(): boolean { + return this.options.canHide === undefined || this.options.canHide; + } + + get onCollapsed(): CommonEvent { + return this.collapsedEmitter.event; + } + + get onContextMenu(): CommonEvent { + return this.contextMenuEmitter.event; + } + + get minSize(): number { + const style = getComputedStyle(this.body); + if (ViewContainer.getOrientation(this.node) === 'horizontal') { + return parseCssMagnitude(style.minWidth, 0); + } else { + return parseCssMagnitude(style.minHeight, 0); + } + } + + protected readonly toShowHeader = new DisposableCollection(); + showTitle(): void { + this.toShowHeader.dispose(); + } + + hideTitle(): void { + if (this.titleHidden) { + return; + } + const display = this.header.style.display; + const height = this.body.style.height; + this.body.style.height = '100%'; + this.header.style.display = 'none'; + this.toShowHeader.push(Disposable.create(() => { + this.header.style.display = display; + this.body.style.height = height; + })); + } + + get titleHidden(): boolean { + return !this.toShowHeader.disposed || this.collapsed; + } + + protected override getScrollContainer(): HTMLElement { + return this.body; + } + + protected registerContextMenu(): Disposable { + return new DisposableCollection( + addEventListener(this.header, 'contextmenu', event => { + this.contextMenuEmitter.fire(event); + }) + ); + } + + protected createContent(): { header: HTMLElement, body: HTMLElement, disposable: Disposable } { + const disposable = new DisposableCollection(); + const { header, disposable: headerDisposable } = this.createHeader(); + const body = document.createElement('div'); + body.classList.add('body'); + this.node.appendChild(header); + this.node.appendChild(body); + disposable.push(headerDisposable); + return { + header, + body, + disposable, + }; + } + + protected createHeader(): { header: HTMLElement, disposable: Disposable } { + const disposable = new DisposableCollection(); + const header = document.createElement('div'); + header.tabIndex = 0; + header.classList.add('theia-header', 'header', 'theia-view-container-part-header'); + disposable.push(addEventListener(header, 'click', event => { + if (this.toolbar && this.toolbar.shouldHandleMouseEvent(event)) { + return; + } + this.collapsed = !this.collapsed; + })); + disposable.push(addKeyListener(header, Key.ARROW_LEFT, () => this.collapsed = true)); + disposable.push(addKeyListener(header, Key.ARROW_RIGHT, () => this.collapsed = false)); + disposable.push(addKeyListener(header, Key.ENTER, () => this.collapsed = !this.collapsed)); + + const toggleIcon = document.createElement('span'); + toggleIcon.classList.add(EXPANSION_TOGGLE_CLASS, ...CODICON_TREE_ITEM_CLASSES); + if (this.collapsed) { + toggleIcon.classList.add(COLLAPSED_CLASS); + } + header.appendChild(toggleIcon); + + const title = document.createElement('span'); + title.classList.add('label', 'noselect'); + + const description = document.createElement('span'); + description.classList.add('description'); + + const badgeSpan = document.createElement('span'); + badgeSpan.classList.add('notification-count'); + + const badgeContainer = document.createElement('div'); + badgeContainer.classList.add('notification-count-container'); + badgeContainer.appendChild(badgeSpan); + const badgeContainerDisplay = badgeContainer.style.display; + + const updateTitle = () => { + if (this.currentContainerId !== this.originalContainerId && this.originalContainerTitle?.label) { + // Creating a title in format: : . + title.innerText = this.originalContainerTitle.label + ': ' + this.wrapped.title.label; + } else { + title.innerText = this.wrapped.title.label; + } + }; + const updateCaption = () => title.title = this.wrapped.title.caption || this.wrapped.title.label; + const updateDescription = () => { + description.innerText = DescriptionWidget.is(this.wrapped) && !this.collapsed && this.wrapped.description || ''; + }; + const updateBadge = () => { + if (BadgeWidget.is(this.wrapped)) { + const visibleToolBarItems = this.toolbarRegistry.visibleItems(this.wrapped).length > 0; + const badge = this.wrapped.badge; + if (badge && !visibleToolBarItems) { + badgeSpan.innerText = badge.toString(); + badgeSpan.title = this.wrapped.badgeTooltip || ''; + badgeContainer.style.display = badgeContainerDisplay; + return; + } + } + badgeContainer.style.display = 'none'; + }; + + updateTitle(); + updateCaption(); + updateDescription(); + updateBadge(); + + disposable.pushAll([ + this.onTitleChanged(updateTitle), + this.onTitleChanged(updateCaption), + this.onDidMove(updateTitle), + this.onDidChangeDescription(updateDescription), + this.onDidChangeBadge(updateBadge), + this.onDidChangeBadgeTooltip(updateBadge), + this.onCollapsed(updateDescription) + ]); + header.appendChild(title); + header.appendChild(description); + header.appendChild(badgeContainer); + + return { + header, + disposable + }; + } + + protected handleResize(): void { + const handleMouseEnter = () => { + this.node?.classList.add('no-pointer-events'); + setTimeout(() => { + this.node?.classList.remove('no-pointer-events'); + this.node?.removeEventListener('mouseenter', handleMouseEnter); + }, 100); + }; + this.node?.addEventListener('mouseenter', handleMouseEnter); + } + + protected override onResize(msg: Widget.ResizeMessage): void { + this.handleResize(); + if (this.wrapped.isAttached && !this.collapsed) { + MessageLoop.sendMessage(this.wrapped, Widget.ResizeMessage.UnknownSize); + } + super.onResize(msg); + } + + protected override onUpdateRequest(msg: Message): void { + if (this.wrapped.isAttached && !this.collapsed) { + MessageLoop.sendMessage(this.wrapped, msg); + } + super.onUpdateRequest(msg); + } + + protected override onAfterAttach(msg: Message): void { + if (!this.wrapped.isAttached) { + UnsafeWidgetUtilities.attach(this.wrapped, this.body); + } + UnsafeWidgetUtilities.attach(this.toolbar, this.header); + super.onAfterAttach(msg); + } + + protected override onBeforeDetach(msg: Message): void { + super.onBeforeDetach(msg); + if (this.toolbar.isAttached) { + Widget.detach(this.toolbar); + } + if (this.wrapped.isAttached) { + UnsafeWidgetUtilities.detach(this.wrapped); + } + } + + protected override onBeforeShow(msg: Message): void { + if (this.wrapped.isAttached && !this.collapsed) { + MessageLoop.sendMessage(this.wrapped, msg); + } + super.onBeforeShow(msg); + } + + protected override onAfterShow(msg: Message): void { + super.onAfterShow(msg); + if (this.wrapped.isAttached && !this.collapsed) { + MessageLoop.sendMessage(this.wrapped, msg); + } + } + + protected override onBeforeHide(msg: Message): void { + if (this.wrapped.isAttached && !this.collapsed) { + MessageLoop.sendMessage(this.wrapped, msg); + } + super.onBeforeShow(msg); + } + + protected override onAfterHide(msg: Message): void { + super.onAfterHide(msg); + if (this.wrapped.isAttached && !this.collapsed) { + MessageLoop.sendMessage(this.wrapped, msg); + } + } + + protected override onChildRemoved(msg: Widget.ChildMessage): void { + super.onChildRemoved(msg); + // if wrapped is not disposed, but detached then we should not dispose it, but only get rid of this part + this.toNoDisposeWrapped.dispose(); + this.dispose(); + } + + protected override onActivateRequest(msg: Message): void { + super.onActivateRequest(msg); + if (this.collapsed) { + this.header.focus(); + } else { + this.wrapped.activate(); + } + } +} + +export namespace ViewContainerPart { + + /** + * Make sure to adjust the `line-height` of the `.theia-view-container .part > .header` CSS class when modifying this, and vice versa. + */ + export const HEADER_HEIGHT = 22; + + export interface State { + widget?: Widget + partId: string; + collapsed: boolean; + hidden: boolean; + relativeSize?: number; + description?: string; + /** The original container to which this part belongs */ + originalContainerId: string; + originalContainerTitle?: ViewContainerTitleOptions; + } + + export function closestPart(element: Element | EventTarget | null, selector: string = 'div.part'): Element | undefined { + if (element instanceof Element) { + const part = element.closest(selector); + if (part instanceof Element) { + return part; + } + } + return undefined; + } +} + +export class ViewContainerLayout extends SplitLayout { + + constructor(protected options: ViewContainerLayout.Options, protected readonly splitPositionHandler: SplitPositionHandler) { + super(options); + } + + protected get items(): ReadonlyArray { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + return (this as any)._items as Array; + } + + iter(): IterableIterator { + return map(this.items, item => item.widget); + } + + // @ts-expect-error TS2611 `SplitLayout.widgets` is declared as `readonly widgets` but is implemented as a getter. + get widgets(): ViewContainerPart[] { + return Array.from(this.iter()); + } + + override attachWidget(index: number, widget: ViewContainerPart): void { + super.attachWidget(index, widget); + if (index > -1 && this.parent && this.parent.node.contains(this.widgets[index + 1]?.node)) { + // Set the correct attach index to the DOM elements. + const ref = this.widgets[index + 1].node; + this.parent.node.insertBefore(widget.node, ref); + this.parent.node.insertBefore(this.handles[index], ref); + this.parent.fit(); + } + } + + getPartSize(part: ViewContainerPart): number | undefined { + if (part.collapsed || part.isHidden) { + return part.uncollapsedSize; + } + if (this.orientation === 'horizontal') { + return part.node.offsetWidth; + } else { + return part.node.offsetHeight; + } + } + + /** + * Set the sizes of the view container parts according to the given weights + * by moving the split handles. This is similar to `setRelativeSizes` defined + * in `SplitLayout`, but here we properly consider the collapsed / expanded state. + */ + setPartSizes(weights: (number | undefined)[]): void { + const parts = this.widgets; + const availableSize = this.getAvailableSize(); + + // Sum up the weights of visible parts + let totalWeight = 0; + let weightCount = 0; + for (let index = 0; index < weights.length && index < parts.length; index++) { + const part = parts[index]; + const weight = weights[index]; + if (weight && !part.isHidden && !part.collapsed) { + totalWeight += weight; + weightCount++; + } + } + if (weightCount === 0 || availableSize === 0) { + return; + } + + // Add the average weight for visible parts without weight + const averageWeight = totalWeight / weightCount; + for (let index = 0; index < weights.length && index < parts.length; index++) { + const part = parts[index]; + const weight = weights[index]; + if (!weight && !part.isHidden && !part.collapsed) { + totalWeight += averageWeight; + } + } + + // Apply the weights to compute actual sizes + let position = 0; + for (let index = 0; index < weights.length && index < parts.length - 1; index++) { + const part = parts[index]; + if (!part.isHidden) { + if (this.orientation === 'vertical') { + position += this.options.headerSize; + } + const weight = weights[index]; + if (part.collapsed) { + if (weight) { + part.uncollapsedSize = weight / totalWeight * availableSize; + } + } else { + let contentSize = (weight || averageWeight) / totalWeight * availableSize; + const minSize = part.minSize; + if (contentSize < minSize) { + contentSize = minSize; + } + position += contentSize; + } + this.setHandlePosition(index, position); + position += this.spacing; + } + } + } + + /** + * Determine the size of the split panel area that is available for widget content, + * i.e. excluding part headers and split handles. + */ + getAvailableSize(): number { + if (!this.parent || !this.parent.isAttached) { + return 0; + } + const parts = this.widgets; + const visiblePartCount = parts.filter(part => !part.isHidden).length; + let availableSize: number; + if (this.orientation === 'horizontal') { + availableSize = this.parent.node.offsetWidth; + } else { + availableSize = this.parent.node.offsetHeight; + availableSize -= visiblePartCount * this.options.headerSize; + } + availableSize -= (visiblePartCount - 1) * this.spacing; + if (availableSize < 0) { + return 0; + } + return availableSize; + } + + /** + * Update a view container part that has been collapsed or expanded. The transition + * to the new state is animated. + */ + updateCollapsed(part: ViewContainerPart, enableAnimation: boolean): void { + const index = this.items.findIndex(item => item.widget === part); + if (index < 0 || !this.parent || part.isHidden) { + return; + } + // Do not store the height of the "stretched item". Otherwise, we mess up the "hint height". + // Store the height only if there are other expanded items. + const currentSize = this.orientation === 'horizontal' ? part.node.offsetWidth : part.node.offsetHeight; + if (part.collapsed && this.items.some(item => !item.widget.collapsed && !item.widget.isHidden)) { + part.uncollapsedSize = currentSize; + } + + if (!enableAnimation || this.options.animationDuration <= 0) { + MessageLoop.postMessage(this.parent, Widget.Msg.FitRequest); + return; + } + let startTime: number | undefined = undefined; + const duration = this.options.animationDuration; + const direction = part.collapsed ? 'collapse' : 'expand'; + let fullSize: number; + if (direction === 'collapse') { + fullSize = currentSize - this.options.headerSize; + } else { + fullSize = Math.max((part.uncollapsedSize || 0) - this.options.headerSize, part.minSize); + if (this.items.filter(item => !item.widget.collapsed && !item.widget.isHidden).length === 1) { + // Expand to full available size + fullSize = Math.max(fullSize, this.getAvailableSize()); + } + } + + // The update function is called on every animation frame until the predefined duration has elapsed. + const updateFunc = (time: number) => { + if (!this.parent) { + part.animatedSize = undefined; + return; + } + if (startTime === undefined) { + startTime = time; + } + if (time - startTime < duration) { + // Render an intermediate state for the animation + const t = this.tween((time - startTime) / duration); + if (direction === 'collapse') { + part.animatedSize = (1 - t) * fullSize; + } else { + part.animatedSize = t * fullSize; + } + requestAnimationFrame(updateFunc); + } else { + // The animation is finished + if (direction === 'collapse') { + part.animatedSize = undefined; + } else { + part.animatedSize = fullSize; + // Request another frame to reset the part to variable size + requestAnimationFrame(() => { + part.animatedSize = undefined; + if (this.parent) { + MessageLoop.sendMessage(this.parent, Widget.Msg.FitRequest); + } + }); + } + } + MessageLoop.sendMessage(this.parent, Widget.Msg.FitRequest); + }; + requestAnimationFrame(updateFunc); + } + + updateSashes(): void { + const { widgets, handles } = this; + if (widgets.length !== handles.length) { + console.warn('Unexpected mismatch between number of widgets and number of handles.'); + return; + } + const firstUncollapsed = this.getFirstUncollapsedWidgetIndex(); + const lastUncollapsed = firstUncollapsed === undefined ? undefined : this.getLastUncollapsedWidgetIndex(); + const allHidden = firstUncollapsed === lastUncollapsed; + for (const [index, handle] of this.handles.entries()) { + // The or clauses are added for type checking. If they're true, allHidden will also have been true. + if (allHidden || firstUncollapsed === undefined || lastUncollapsed === undefined) { + handle.classList.add('sash-hidden'); + } else if (index < lastUncollapsed && index >= firstUncollapsed) { + handle.classList.remove('sash-hidden'); + } else { + handle.classList.add('sash-hidden'); + } + } + } + + protected getFirstUncollapsedWidgetIndex(): number | undefined { + const index = this.widgets.findIndex(widget => !widget.collapsed && !widget.isHidden); + return index === -1 ? undefined : index; + } + + protected getLastUncollapsedWidgetIndex(): number | undefined { + for (let i = this.widgets.length - 1; i >= 0; i--) { + if (!this.widgets[i].collapsed && !this.widgets[i].isHidden) { + return i; + } + } + } + + protected override onFitRequest(msg: Message): void { + for (const part of this.widgets) { + const style = part.node.style; + if (part.animatedSize !== undefined) { + // The part size has been fixed for animating the transition to collapsed / expanded state + const fixedSize = `${this.options.headerSize + part.animatedSize}px`; + style.minHeight = fixedSize; + style.maxHeight = fixedSize; + } else if (part.collapsed) { + // The part size is fixed to the header size + const fixedSize = `${this.options.headerSize}px`; + style.minHeight = fixedSize; + style.maxHeight = fixedSize; + } else { + const minSize = `${this.options.headerSize + part.minSize}px`; + style.minHeight = minSize; + style.maxHeight = ''; + } + } + super.onFitRequest(msg); + } + + /** + * Sinusoidal tween function for smooth animation. + */ + protected tween(t: number): number { + return 0.5 * (1 - Math.cos(Math.PI * t)); + } + + setHandlePosition(index: number, position: number): Promise { + const options: SplitPositionOptions = { + referenceWidget: this.widgets[index], + duration: 0 + }; + // eslint-disable-next-line @typescript-eslint/no-explicit-any + return this.splitPositionHandler.setSplitHandlePosition(this.parent as SplitPanel, index, position, options) as Promise; + } + +} + +export namespace ViewContainerLayout { + + export interface Options extends SplitLayout.IOptions { + headerSize: number; + animationDuration: number; + } + + export interface Item { + readonly widget: ViewContainerPart; + } + +} diff --git a/packages/core/src/browser/widget-decoration.ts b/packages/core/src/browser/widget-decoration.ts new file mode 100644 index 0000000..6ddfd31 --- /dev/null +++ b/packages/core/src/browser/widget-decoration.ts @@ -0,0 +1,358 @@ +// ***************************************************************************** +// Copyright (C) 2019 Ericsson and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +/** + * Namespace for the decoration data and the styling refinements for the decorated widgets. + */ +export namespace WidgetDecoration { + + /** + * CSS styles for the decorators. + */ + export namespace Styles { + export const CAPTION_HIGHLIGHT_CLASS = 'theia-caption-highlight'; + export const CAPTION_PREFIX_CLASS = 'theia-caption-prefix'; + export const CAPTION_SUFFIX_CLASS = 'theia-caption-suffix'; + export const ICON_WRAPPER_CLASS = 'theia-icon-wrapper'; + export const DECORATOR_SIZE_CLASS = 'theia-decorator-size'; + export const DECORATOR_SIDEBAR_SIZE_CLASS = 'theia-decorator-sidebar-size'; + export const TOP_RIGHT_CLASS = 'theia-top-right'; + export const BOTTOM_RIGHT_CLASS = 'theia-bottom-right'; + export const BOTTOM_RIGHT_SIDEBAR_CLASS = 'theia-bottom-right-sidebar'; + export const BOTTOM_LEFT_CLASS = 'theia-bottom-left'; + export const TOP_LEFT_CLASS = 'theia-top-left'; + } + /** + * For the sake of simplicity, we have merged the `font-style`, `font-weight`, and the `text-decoration` together. + */ + export type FontStyle = 'normal' | 'bold' | 'italic' | 'oblique' | 'underline' | 'line-through'; + /** + * A string that could be: + * + * - one of the browser colors, (E.g.: `blue`, `red`, `magenta`), + * - the case insensitive hexadecimal color code, (for instance, `#ee82ee`, `#20B2AA`, `#f09` ), or + * - either the `rgb()` or the `rgba()` functions. + * + * For more details, see: https://developer.mozilla.org/en-US/docs/Web/CSS/color_value. + * + * Note, it is highly recommended to use one of the predefined colors of Theia, so the desired color will + * look nice with both the `light` and the `dark` theme too. + */ + export type Color = string; + /** + * Encapsulates styling information of the font. + */ + export interface FontData { + /** + * Zero to any font style. + */ + readonly style?: FontStyle | FontStyle[]; + /** + * The color of the font. + */ + readonly color?: Color; + } + /** + * Arbitrary information that has to be shown either before or after the caption as a prefix or a suffix. + */ + export interface CaptionAffix { + /** + * The text content of the prefix or the suffix. + */ + readonly data: string; + /** + * Font data for customizing the prefix of the suffix. + */ + readonly fontData?: FontData; + } + export interface BaseTailDecoration { + /** + * Optional tooltip for the tail decoration. + */ + readonly tooltip?: string; + } + /** + * Unlike caption suffixes, tail decorations appears right-aligned after the caption and the caption suffixes (is any). + */ + export interface TailDecoration extends BaseTailDecoration { + /** + * The text content of the tail decoration. + */ + readonly data: string; + /** + * Font data for customizing the content. + */ + readonly fontData?: FontData; + } + + export namespace TailDecoration { + /** + * Combines all fields of all `TailDecoration` variants + */ + export type AnyPartial = Partial; + /** + * Represents any permissible concrete `TailDecoration` variation. + */ + export type AnyConcrete = TailDecoration | TailDecorationIcon | TailDecorationIconClass; + export function isDotDecoration(decoration: AnyPartial): decoration is TailDecorationIcon { + return decoration.icon === 'circle'; + } + } + export interface TailDecorationIcon extends BaseTailDecoration { + /** + * This should be the name of the Font Awesome icon with out the `fa fa-` prefix, just the name, for instance `paw`. + * For the existing icons, see here: https://fontawesome.com/v4.7.0/icons/. + */ + readonly icon: string; + /** + * The color of the icon. + */ + readonly color?: Color; + } + export interface TailDecorationIconClass extends BaseTailDecoration { + /** + * This should be the entire Font Awesome class array, for instance ['fa', 'fa-paw'] + * For the existing icons, see here: https://fontawesome.com/v4.7.0/icons/. + */ + readonly iconClass: string[]; + /** + * The color of the icon. + */ + readonly color?: Color; + } + /** + * Enumeration for the quadrant to overlay the image on. + */ + export enum IconOverlayPosition { + /** + * Overlays the top right quarter of the original image. + */ + TOP_RIGHT, + /** + * Overlays the bottom right of the original image. + */ + BOTTOM_RIGHT, + /** + * Overlays the bottom left segment of the original image. + */ + BOTTOM_LEFT, + /** + * Occupies the top left quarter of the original icon. + */ + TOP_LEFT + } + export namespace IconOverlayPosition { + /** + * Returns with the CSS class style for the enum. + */ + export function getStyle(position: IconOverlayPosition, inSideBar?: boolean): string { + switch (position) { + case IconOverlayPosition.TOP_RIGHT: + return WidgetDecoration.Styles.TOP_RIGHT_CLASS; + case IconOverlayPosition.BOTTOM_RIGHT: + return inSideBar ? WidgetDecoration.Styles.BOTTOM_RIGHT_SIDEBAR_CLASS : WidgetDecoration.Styles.BOTTOM_RIGHT_CLASS; + case IconOverlayPosition.BOTTOM_LEFT: + return WidgetDecoration.Styles.BOTTOM_LEFT_CLASS; + case IconOverlayPosition.TOP_LEFT: + return WidgetDecoration.Styles.TOP_LEFT_CLASS; + } + } + } + /** + * A shape that can be optionally rendered behind the overlay icon. Can be used to further refine colors. + */ + export interface IconOverlayBackground { + /** + * Either `circle` or `square`. + */ + readonly shape: 'circle' | 'square'; + /** + * The color of the background shape. + */ + readonly color?: Color; + } + /** + * Has not effect if the widget being decorated has no associated icon. + */ + export interface BaseOverlay { + /** + * The position where the decoration will be placed on the top of the original icon. + */ + readonly position: IconOverlayPosition; + /** + * The color of the overlaying icon. If not specified, then the default icon color will be used. + */ + readonly color?: Color; + /** + * The optional background color of the overlay icon. + */ + readonly background?: IconOverlayBackground; + } + export interface IconOverlay extends BaseOverlay { + /** + * This should be the name of the Font Awesome icon with out the `fa fa-` prefix, just the name, for instance `paw`. + * For the existing icons, see here: https://fontawesome.com/v4.7.0/icons/. + */ + readonly icon: string; + } + export interface IconClassOverlay extends BaseOverlay { + /** + * This should be the entire Font Awesome class array, for instance ['fa', 'fa-paw'] + * For the existing icons, see here: https://fontawesome.com/v4.7.0/icons/. + */ + readonly iconClass: string[]; + } + /** + * The caption highlighting with the highlighted ranges and an optional background color. + */ + export interface CaptionHighlight { + /** + * The ranges to highlight in the caption. + */ + readonly ranges: CaptionHighlight.Range[]; + /** + * The optional color of the text data that is being highlighted. Falls back to the default `mark` color values defined under a widget segment class. + */ + readonly color?: Color; + /** + * The optional background color of the text data that is being highlighted. + */ + readonly backgroundColor?: Color; + } + export namespace CaptionHighlight { + /** + * A pair of offset and length that has to be highlighted as a range. + */ + export interface Range { + /** + * Zero based offset of the highlighted region. + */ + readonly offset: number; + /** + * The length of the highlighted region. + */ + readonly length: number; + } + export namespace Range { + /** + * `true` if the `arg` is contained in the range. The ranges are closed ranges, hence the check is inclusive. + */ + export function contains(arg: number, range: Range): boolean { + return arg >= range.offset && arg <= (range.offset + range.length); + } + } + /** + * The result of a caption splitting based on the highlighting information. + */ + export interface Fragment { + /** + * The text data of the fragment. + */ + readonly data: string; + /** + * Has to be highlighted if defined. + */ + readonly highlight?: true; + } + /** + * Splits the `caption` argument based on the ranges from the `highlight` argument. + */ + export function split(caption: string, highlight: CaptionHighlight): Fragment[] { + const result: Fragment[] = []; + const ranges = highlight.ranges.slice(); + const containerOf = (index: number) => ranges.findIndex(range => Range.contains(index, range)); + let data = ''; + for (let i = 0; i < caption.length; i++) { + const containerIndex = containerOf(i); + if (containerIndex === -1) { + data += caption[i]; + } else { + if (data.length > 0) { + result.push({ data }); + } + const { length } = ranges.splice(containerIndex, 1).shift()!; + result.push({ data: caption.substring(i, i + length), highlight: true }); + data = ''; + i = i + length - 1; + } + } + if (data.length > 0) { + result.push({ data }); + } + if (ranges.length !== 0) { + throw new Error('Error occurred when splitting the caption. There was a mismatch between the caption and the corresponding highlighting ranges.'); + } + return result; + } + } + /** + * Encapsulates styling information that has to be applied on the widget which we decorate. + */ + export interface Data { + /** + * The higher number has higher priority. If not specified, treated as `0`. + * When multiple decorators are available for the same item, and decoration data cannot be merged together, + * then the higher priority item will be applied on the decorated element and the lower priority will be ignored. + */ + readonly priority?: number; + /** + * The font data for the caption. + */ + readonly fontData?: FontData; + /** + * The background color of the entire row. + */ + readonly backgroundColor?: Color; + /** + * Optional, leading prefixes right before the caption. + */ + readonly captionPrefixes?: CaptionAffix[]; + /** + * Suffixes that might come after the caption as an additional information. + */ + readonly captionSuffixes?: CaptionAffix[]; + /** + * Optional right-aligned decorations that appear after the widget caption and after the caption suffixes (is any). + */ + readonly tailDecorations?: Array; + /** + * Custom tooltip for the decorated item. Tooltip will be appended to the original tooltip, if any. + */ + readonly tooltip?: string; + /** + * Sets the color of the icon. Ignored if the decorated item has no icon. + */ + readonly iconColor?: Color; + /** + * Has not effect if given, but the widget does not have an associated image. + */ + readonly iconOverlay?: IconOverlay | IconClassOverlay; + /** + * An array of ranges to highlight the caption. + */ + readonly highlight?: CaptionHighlight; + /** + * A count badge for widgets. + */ + readonly badge?: number; + } + export namespace Data { + /** + * Compares the decoration data based on the priority. Lowest priorities come first (i.e. left.priority - right.priority). + */ + export const comparePriority = (left: Data, right: Data): number => (left.priority || 0) - (right.priority || 0); + } +} diff --git a/packages/core/src/browser/widget-manager.spec.ts b/packages/core/src/browser/widget-manager.spec.ts new file mode 100644 index 0000000..2d361fe --- /dev/null +++ b/packages/core/src/browser/widget-manager.spec.ts @@ -0,0 +1,102 @@ +// ***************************************************************************** +// Copyright (C) 2017 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { enableJSDOM } from './test/jsdom'; + +let disableJsDom = enableJSDOM(); +import { Container, ContainerModule } from 'inversify'; +import { expect } from 'chai'; +import { WidgetManager, WidgetFactory } from './widget-manager'; +import { Widget } from '@lumino/widgets'; +import { ILogger } from '../common/logger'; +import { MockLogger } from '../common/test/mock-logger'; +import { bindContributionProvider } from '../common'; + +disableJsDom(); + +class TestWidgetFactory implements WidgetFactory { + + invocations = 0; + id = 'test'; + + async createWidget(name: string): Promise { + this.invocations++; + const result = new Widget; + result.id = name; + return result; + } +} + +describe('widget-manager', () => { + let widgetManager: WidgetManager; + before(() => { + disableJsDom = enableJSDOM(); + }); + + beforeEach(() => { + const testContainer = new Container(); + + const module = new ContainerModule(bind => { + bind(ILogger).to(MockLogger); + bindContributionProvider(bind, WidgetFactory); + bind(WidgetFactory).toConstantValue(new TestWidgetFactory()); + bind(WidgetManager).toSelf().inSingletonScope(); + }); + testContainer.load(module); + + widgetManager = testContainer.get(WidgetManager); + }); + + after(() => { + disableJsDom(); + }); + + it('creates and caches widgets', async () => { + const wA = await widgetManager.getOrCreateWidget('test', 'widgetA'); + const wB = await widgetManager.getOrCreateWidget('test', 'widgetB'); + expect(wA).not.equals(wB); + expect(wA).equals(await widgetManager.getOrCreateWidget('test', 'widgetA')); + }); + + describe('tryGetWidget', () => { + it('Returns undefined if the widget has not been created', () => { + expect(widgetManager.tryGetWidget('test', 'widgetA')).to.be.undefined; + }); + it('Returns undefined if the widget is created asynchronously and has not finished being created', () => { + widgetManager.getOrCreateWidget('test', 'widgetA'); + expect(widgetManager.tryGetWidget('test', 'widgetA')).to.be.undefined; + }); + it('Returns the widget if the widget is created asynchronously and has finished being created', async () => { + await widgetManager.getOrCreateWidget('test', 'widgetA'); + expect(widgetManager.tryGetWidget('test', 'widgetA')).not.to.be.undefined; + }); + }); + + it('produces the same widget key regardless of object key order', () => { + const options1 = { + factoryId: 'a', + key1: 1, + key2: 2, + }; + const options2 = { + key2: 2, + key1: 1, + factoryId: 'a', + }; + expect(widgetManager['toKey'](options1)).equals(widgetManager['toKey'](options2)); + }); + +}); diff --git a/packages/core/src/browser/widget-manager.ts b/packages/core/src/browser/widget-manager.ts new file mode 100644 index 0000000..a0a3e7d --- /dev/null +++ b/packages/core/src/browser/widget-manager.ts @@ -0,0 +1,318 @@ +// ***************************************************************************** +// Copyright (C) 2017 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { inject, named, injectable } from 'inversify'; +import { Widget } from '@lumino/widgets'; +import { ILogger, Emitter, Event, ContributionProvider, MaybePromise, WaitUntilEvent } from '../common'; +import stableJsonStringify = require('fast-json-stable-stringify'); + +/* eslint-disable @typescript-eslint/no-explicit-any */ +export const WidgetFactory = Symbol('WidgetFactory'); + +/** + * A {@link WidgetFactory} is used to create new widgets. Factory-specific information (options) can be passed as serializable JSON data. + * The common {@link WidgetManager} collects `WidgetFactory` contributions and delegates to the corresponding factory when + * a widget should be created or restored. To identify widgets the `WidgetManager` uses a description composed of the factory id and the options. + * The `WidgetFactory` does support both, synchronous and asynchronous widget creation. + * + * ### Example usage + * + * ```typescript + * export class MyWidget extends BaseWidget { + * } + * + * @injectable() + * export class MyWidgetFactory implements WidgetFactory { + * id = 'myWidgetFactory'; + * + * createWidget(): MaybePromise { + * return new MyWidget(); + * } + * } + * ``` + */ +export interface WidgetFactory { + + /** + * The factory id. + */ + readonly id: string; + + /** + * Creates a widget using the given options. + * @param options factory specific information as serializable JSON data. + * + * @returns the newly created widget or a promise of the widget + */ + createWidget(options?: any): MaybePromise; +} + +/** + * Representation of the `WidgetConstructionOptions`. + * Defines a serializable description to create widgets. + */ +export interface WidgetConstructionOptions { + /** + * The id of the widget factory to use. + */ + factoryId: string, + + /** + * The widget factory specific information. + */ + options?: any +} + +/** + * Representation of a `willCreateWidgetEvent`. + */ +export interface WillCreateWidgetEvent extends WaitUntilEvent { + /** + * The widget which will be created. + */ + readonly widget: Widget; + /** + * The widget factory id. + */ + readonly factoryId: string; +} + +/** + * Representation of a `didCreateWidgetEvent`. + */ +export interface DidCreateWidgetEvent { + /** + * The widget which was created. + */ + readonly widget: Widget; + /** + * The widget factory id. + */ + readonly factoryId: string; +} + +/** + * The {@link WidgetManager} is the common component responsible for creating and managing widgets. Additional widget factories + * can be registered by using the {@link WidgetFactory} contribution point. To identify a widget, created by a factory, the factory id and + * the creation options are used. This key is commonly referred to as `description` of the widget. + */ +@injectable() +export class WidgetManager { + + protected _cachedFactories: Map; + protected readonly widgets = new Map(); + protected readonly pendingWidgetPromises = new Map>(); + + @inject(ContributionProvider) @named(WidgetFactory) + protected readonly factoryProvider: ContributionProvider; + + @inject(ILogger) + protected readonly logger: ILogger; + + protected readonly onWillCreateWidgetEmitter = new Emitter(); + /** + * An event can be used to participate in the widget creation. + * Listeners may not dispose the given widget. + */ + readonly onWillCreateWidget: Event = this.onWillCreateWidgetEmitter.event; + + protected readonly onDidCreateWidgetEmitter = new Emitter(); + + readonly onDidCreateWidget: Event = this.onDidCreateWidgetEmitter.event; + + /** + * Get the list of widgets created by the given widget factory. + * @param factoryId the widget factory id. + * + * @returns the list of widgets created by the factory with the given id. + */ + getWidgets(factoryId: string): Widget[] { + const result: Widget[] = []; + for (const [key, widget] of this.widgets.entries()) { + if (this.fromKey(key).factoryId === factoryId) { + result.push(widget); + } + } + return result; + } + + /** + * Try to get the existing widget for the given description. + * @param factoryId The widget factory id. + * @param options The widget factory specific information. + * + * @returns the widget if available, else `undefined`. + * + * The widget is 'available' if it has been created with the same {@link factoryId} and {@link options} by the {@link WidgetManager}. + * If the widget's creation is asynchronous, it is only available when the associated `Promise` is resolved. + */ + tryGetWidget(factoryId: string, options?: any): T | undefined { + const key = this.toKey({ factoryId, options }); + const existing = this.widgets.get(key); + if (existing instanceof Widget) { + return existing as T; + } + return undefined; + } + + /** + * Try to get the existing widget for the given description. + * @param factoryId The widget factory id. + * @param options The widget factory specific information. + * + * @returns A promise that resolves to the widget, if any exists. The promise may be pending, so be cautious when assuming that it will not reject. + */ + tryGetPendingWidget(factoryId: string, options?: any): MaybePromise | undefined { + const key = this.toKey({ factoryId, options }); + return this.doGetWidget(key); + } + + /** + * Get the widget for the given description. + * @param factoryId The widget factory id. + * @param options The widget factory specific information. + * + * @returns a promise resolving to the widget if available, else `undefined`. + */ + async getWidget(factoryId: string, options?: any): Promise { + const key = this.toKey({ factoryId, options }); + const pendingWidget = this.doGetWidget(key); + const widget = pendingWidget && await pendingWidget; + return widget; + } + + /** + * Finds a widget that matches the given test predicate. + * @param factoryId The widget factory id. + * @param predicate The test predicate. + * + * @returns a promise resolving to the widget if available, else `undefined`. + */ + async findWidget(factoryId: string, predicate: (options?: any) => boolean): Promise { + for (const [key, widget] of this.widgets.entries()) { + if (this.testPredicate(key, factoryId, predicate)) { + return widget as T; + } + } + for (const [key, widgetPromise] of this.pendingWidgetPromises.entries()) { + if (this.testPredicate(key, factoryId, predicate)) { + return widgetPromise as Promise; + } + } + } + + protected testPredicate(key: string, factoryId: string, predicate: (options?: any) => boolean): boolean { + const constructionOptions = this.fromKey(key); + return constructionOptions.factoryId === factoryId && predicate(constructionOptions.options); + } + + protected doGetWidget(key: string): MaybePromise | undefined { + const pendingWidget = this.widgets.get(key) ?? this.pendingWidgetPromises.get(key); + if (pendingWidget) { + return pendingWidget as MaybePromise; + } + return undefined; + } + + /** + * Creates a new widget or returns the existing widget for the given description. + * @param factoryId the widget factory id. + * @param options the widget factory specific information. + * + * @returns a promise resolving to the widget. + */ + async getOrCreateWidget(factoryId: string, options?: any): Promise { + const key = this.toKey({ factoryId, options }); + const existingWidget = this.doGetWidget(key); + if (existingWidget) { + return existingWidget; + } + const factory = this.factories.get(factoryId); + if (!factory) { + throw Error("No widget factory '" + factoryId + "' has been registered."); + } + const widgetPromise = this.doCreateWidget(factory, options).then(widget => { + this.widgets.set(key, widget); + widget.disposed.connect(() => this.widgets.delete(key)); + this.onDidCreateWidgetEmitter.fire({ factoryId, widget }); + return widget; + }).finally(() => this.pendingWidgetPromises.delete(key)); + this.pendingWidgetPromises.set(key, widgetPromise); + return widgetPromise; + } + + protected async doCreateWidget(factory: WidgetFactory, options?: any): Promise { + const widget = await factory.createWidget(options); + // Note: the widget creation process also includes the 'onWillCreateWidget' part, which can potentially fail + try { + await WaitUntilEvent.fire(this.onWillCreateWidgetEmitter, { factoryId: factory.id, widget }); + } catch (e) { + widget.dispose(); + throw e; + } + return widget as T; + } + + /** + * Get the widget construction options. + * @param widget the widget. + * + * @returns the widget construction options if the widget was created through the manager, else `undefined`. + */ + getDescription(widget: Widget): WidgetConstructionOptions | undefined { + for (const [key, aWidget] of this.widgets.entries()) { + if (aWidget === widget) { + return this.fromKey(key); + } + } + return undefined; + } + + /** + * Convert the widget construction options to string. + * @param options the widget construction options. + * + * @returns the widget construction options represented as a string. + */ + protected toKey(options: WidgetConstructionOptions): string { + return stableJsonStringify(options); + } + + /** + * Convert the key into the widget construction options object. + * @param key the key. + * + * @returns the widget construction options object. + */ + protected fromKey(key: string): WidgetConstructionOptions { + return JSON.parse(key); + } + + protected get factories(): Map { + if (!this._cachedFactories) { + this._cachedFactories = new Map(); + for (const factory of this.factoryProvider.getContributions()) { + if (factory.id) { + this._cachedFactories.set(factory.id, factory); + } else { + this.logger.error('Invalid ID for factory: ' + factory + ". ID was: '" + factory.id + "'."); + } + } + } + return this._cachedFactories; + } + +} diff --git a/packages/core/src/browser/widget-open-handler.ts b/packages/core/src/browser/widget-open-handler.ts new file mode 100644 index 0000000..b254f9c --- /dev/null +++ b/packages/core/src/browser/widget-open-handler.ts @@ -0,0 +1,168 @@ +// ***************************************************************************** +// Copyright (C) 2018 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { inject, postConstruct, injectable } from 'inversify'; +import URI from '../common/uri'; +import { MaybePromise, Emitter, Event } from '../common'; +import { BaseWidget } from './widgets'; +import { ApplicationShell } from './shell'; +import { OpenHandler, OpenerOptions } from './opener-service'; +import { WidgetManager } from './widget-manager'; + +export type WidgetOpenMode = 'open' | 'reveal' | 'activate'; +/** + * `WidgetOpenerOptions` define generic options used by the {@link WidgetOpenHandler}. + * + * _Note:_ This object may contain references to widgets (e.g. `widgetOptions.ref`); + * these need to be transformed before it can be serialized. + */ +export interface WidgetOpenerOptions extends OpenerOptions { + /** + * Determines whether the widget should be only opened, revealed or activated. + * By default is `activate`. + */ + mode?: WidgetOpenMode; + /** + * Specify how an opened widget should be added to the shell. + * By default to the main area. + */ + widgetOptions?: ApplicationShell.WidgetOptions; +} + +/** + * Generic base class for {@link OpenHandler}s that are opening a widget for a given {@link URI}. + */ +@injectable() +export abstract class WidgetOpenHandler implements OpenHandler { + + @inject(ApplicationShell) + protected readonly shell: ApplicationShell; + + @inject(WidgetManager) + protected readonly widgetManager: WidgetManager; + + protected readonly onCreatedEmitter = new Emitter(); + /** + * Emit when a new widget is created. + */ + readonly onCreated: Event = this.onCreatedEmitter.event; + + @postConstruct() + protected init(): void { + this.widgetManager.onDidCreateWidget(({ factoryId, widget }) => { + if (factoryId === this.id) { + this.onCreatedEmitter.fire(widget as W); + } + }); + } + + /** + * The widget open handler id. + * + * #### Implementation + * - A widget factory for this id should be registered. + * - Subclasses should not implement `WidgetFactory` + * to avoid exposing capabilities to create a widget outside of `WidgetManager`. + */ + abstract readonly id: string; + abstract canHandle(uri: URI, options?: WidgetOpenerOptions): MaybePromise; + + /** + * Open a widget for the given uri and options. + * Reject if the given options are not widget options or a widget cannot be opened. + * @param uri the uri of the resource that should be opened. + * @param options the widget opener options. + * + * @returns promise of the widget that resolves when the widget has been opened. + */ + async open(uri: URI, options?: WidgetOpenerOptions): Promise { + const widget = await this.getOrCreateWidget(uri, options); + await this.doOpen(widget, uri, options); + return widget; + } + protected async doOpen(widget: W, uri: URI, options?: WidgetOpenerOptions): Promise { + const op: WidgetOpenerOptions = { + mode: 'activate', + ...options + }; + if (!widget.isAttached) { + await this.shell.addWidget(widget, op.widgetOptions || { area: 'main' }); + } + if (op.mode === 'activate') { + await this.shell.activateWidget(widget.id); + } else if (op.mode === 'reveal') { + await this.shell.revealWidget(widget.id); + } + } + + /** + * Tries to get an existing widget for the given uri. + * @param uri the uri of the widget. + * + * @returns a promise that resolves to the existing widget or `undefined` if no widget for the given uri exists. + */ + getByUri(uri: URI): Promise { + return this.getWidget(uri); + } + + /** + * Return an existing widget for the given uri or creates a new one. + * + * It does not open a widget, use {@link WidgetOpenHandler#open} instead. + * @param uri uri of the widget. + * + * @returns a promise of the existing or newly created widget. + */ + getOrCreateByUri(uri: URI): Promise { + return this.getOrCreateWidget(uri); + } + + /** + * Retrieves all open widgets that have been opened by this handler. + * + * @returns all open widgets for this open handler. + */ + get all(): W[] { + return this.widgetManager.getWidgets(this.id) as W[]; + } + + protected tryGetPendingWidget(uri: URI, options?: WidgetOpenerOptions): MaybePromise | undefined { + const factoryOptions = this.createWidgetOptions(uri, options); + return this.widgetManager.tryGetPendingWidget(this.id, factoryOptions); + } + + protected getWidget(uri: URI, options?: WidgetOpenerOptions): Promise { + const widgetOptions = this.createWidgetOptions(uri, options); + return this.widgetManager.getWidget(this.id, widgetOptions); + } + + protected getOrCreateWidget(uri: URI, options?: WidgetOpenerOptions): Promise { + const widgetOptions = this.createWidgetOptions(uri, options); + return this.widgetManager.getOrCreateWidget(this.id, widgetOptions); + } + + protected abstract createWidgetOptions(uri: URI, options?: WidgetOpenerOptions): Object; + + /** + * Closes all widgets that have been opened by this open handler. + * @param options the close options that should be applied to all widgets. + * + * @returns a promise of all closed widgets that resolves after they have been closed. + */ + async closeAll(options?: ApplicationShell.CloseOptions): Promise { + return this.shell.closeMany(this.all, options) as Promise; + } +} diff --git a/packages/core/src/browser/widget-status-bar-service.ts b/packages/core/src/browser/widget-status-bar-service.ts new file mode 100644 index 0000000..d705880 --- /dev/null +++ b/packages/core/src/browser/widget-status-bar-service.ts @@ -0,0 +1,84 @@ +// ***************************************************************************** +// Copyright (C) 2024 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { inject, injectable, named } from 'inversify'; +import { Widget } from './widgets'; +import { StatusBar } from './status-bar'; +import { FrontendApplicationContribution } from './frontend-application-contribution'; +import { ContributionProvider } from '../common'; +import { FrontendApplication } from './frontend-application'; + +export const WidgetStatusBarContribution = Symbol('WidgetStatusBarContribution'); + +export interface WidgetStatusBarContribution { + canHandle(widget: Widget): widget is T; + activate(statusBar: StatusBar, widget: T): void; + deactivate(statusBar: StatusBar): void; +} + +/** + * Creates an empty {@link WidgetStatusBarContribution} that does nothing. + * Useful for widgets that are not handled by any other contribution, for example: + * * Settings widget + * * Welcome widget + * * Webview widget + * + * @param prototype Prototype to identify the kind of the widget. + * @returns An empty {@link WidgetStatusBarContribution}. + */ +export function noopWidgetStatusBarContribution(prototype: Function): WidgetStatusBarContribution { + return { + canHandle(widget: Widget): widget is Widget { + return widget instanceof prototype; + }, + activate: () => { }, + deactivate: () => { } + }; +} + +@injectable() +export class WidgetStatusBarService implements FrontendApplicationContribution { + + @inject(ContributionProvider) @named(WidgetStatusBarContribution) + protected readonly contributionProvider: ContributionProvider>; + + @inject(StatusBar) + protected readonly statusBar: StatusBar; + + onStart(app: FrontendApplication): void { + app.shell.onDidChangeCurrentWidget(event => { + if (event.newValue) { + this.show(event.newValue); + } + }); + } + + protected show(widget: Widget): void { + const contributions = this.contributionProvider.getContributions(); + // If any contribution can handle the widget, activate it + // If none can, keep everything as is + if (contributions.some(contribution => contribution.canHandle(widget))) { + for (const contribution of contributions) { + // Deactivate all contributions + contribution.deactivate(this.statusBar); + if (contribution.canHandle(widget)) { + // Selectively re-activate them + contribution.activate(this.statusBar, widget); + } + } + } + } +} diff --git a/packages/core/src/browser/widgets/alert-message.tsx b/packages/core/src/browser/widgets/alert-message.tsx new file mode 100644 index 0000000..fb5ceed --- /dev/null +++ b/packages/core/src/browser/widgets/alert-message.tsx @@ -0,0 +1,56 @@ +// ***************************************************************************** +// Copyright (C) 2018 Ericsson and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import React = require('react'); +import { codicon } from './widget'; + +export type MessageType = keyof AlertMessageIcon; + +interface AlertMessageIcon { + INFO: string; + SUCCESS: string; + WARNING: string; + ERROR: string; +} + +const AlertMessageIcon = { + INFO: codicon('info'), + SUCCESS: codicon('pass'), + WARNING: codicon('warning'), + ERROR: codicon('error') +}; + +export interface AlertMessageProps { + type: MessageType; + header: string; + children?: React.ReactNode +} + +export class AlertMessage extends React.Component { + + override render(): React.ReactNode { + return
    +
    +
    + + {this.props.header} +
    +
    {this.props.children}
    +
    +
    ; + } + +} diff --git a/packages/core/src/browser/widgets/enhanced-preview-widget.ts b/packages/core/src/browser/widgets/enhanced-preview-widget.ts new file mode 100644 index 0000000..923394d --- /dev/null +++ b/packages/core/src/browser/widgets/enhanced-preview-widget.ts @@ -0,0 +1,27 @@ +// ***************************************************************************** +// Copyright (C) 2023 STMicroelectronics and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { isFunction, isObject } from '../../common'; + +export interface EnhancedPreviewWidget { + getEnhancedPreviewNode(): Node | undefined; +} + +export namespace EnhancedPreviewWidget { + export function is(arg: unknown): arg is EnhancedPreviewWidget { + return isObject(arg) && isFunction(arg.getEnhancedPreviewNode); + } +} diff --git a/packages/core/src/browser/widgets/extractable-widget.ts b/packages/core/src/browser/widgets/extractable-widget.ts new file mode 100644 index 0000000..263f4e3 --- /dev/null +++ b/packages/core/src/browser/widgets/extractable-widget.ts @@ -0,0 +1,36 @@ +// ***************************************************************************** +// Copyright (C) 2022 STMicroelectronics, Ericsson, ARM, EclipseSource and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { ApplicationShell } from '../shell'; +import { Widget } from './widget'; + +/** + * A contract for widgets that are extractable to a secondary window. + */ +export interface ExtractableWidget extends Widget { + /** Set to `true` to mark the widget to be extractable. */ + isExtractable: boolean; + /** The secondary window that the window was extracted to or `undefined` if it is not yet extracted. */ + secondaryWindow: Window | undefined; + /** Stores the area which contained the widget before being extracted. This is undefined if the widget wasn't extracted or if the area could not be determined */ + previousArea?: ApplicationShell.Area; +} + +export namespace ExtractableWidget { + export function is(widget: unknown): widget is ExtractableWidget { + return widget instanceof Widget && 'isExtractable' in widget && (widget as ExtractableWidget).isExtractable === true; + } +} diff --git a/packages/core/src/browser/widgets/index.ts b/packages/core/src/browser/widgets/index.ts new file mode 100644 index 0000000..48ef9cf --- /dev/null +++ b/packages/core/src/browser/widgets/index.ts @@ -0,0 +1,21 @@ +// ***************************************************************************** +// Copyright (C) 2017 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +export * from './widget'; +export * from './react-renderer'; +export * from './react-widget'; +export * from './extractable-widget'; +export * from './split-widget'; diff --git a/packages/core/src/browser/widgets/previewable-widget.ts b/packages/core/src/browser/widgets/previewable-widget.ts new file mode 100644 index 0000000..f8ee868 --- /dev/null +++ b/packages/core/src/browser/widgets/previewable-widget.ts @@ -0,0 +1,31 @@ +// ***************************************************************************** +// Copyright (C) 2023 STMicroelectronics and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { isFunction, isObject } from '../../common'; + +export interface PreviewableWidget { + loaded?: boolean; + getPreviewNode(): Node | undefined; +} + +export namespace PreviewableWidget { + export function is(arg: unknown): arg is PreviewableWidget { + return isObject(arg) && isFunction(arg.getPreviewNode); + } + export function isPreviewable(arg: unknown): arg is PreviewableWidget { + return isObject(arg) && isFunction(arg.getPreviewNode) && arg.loaded === true; + } +} diff --git a/packages/core/src/browser/widgets/react-renderer.tsx b/packages/core/src/browser/widgets/react-renderer.tsx new file mode 100644 index 0000000..ff81764 --- /dev/null +++ b/packages/core/src/browser/widgets/react-renderer.tsx @@ -0,0 +1,53 @@ +// ***************************************************************************** +// Copyright (C) 2018 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { inject, injectable, optional } from 'inversify'; +import * as React from 'react'; +import { createRoot, Root } from 'react-dom/client'; +import { Disposable, DisposableCollection } from '../../common'; + +export type RendererHost = HTMLElement; +export const RendererHost = Symbol('RendererHost'); + +@injectable() +export class ReactRenderer implements Disposable { + protected readonly toDispose = new DisposableCollection(); + readonly host: HTMLElement; + protected hostRoot: Root; + + constructor( + @inject(RendererHost) @optional() host?: RendererHost + ) { + this.host = host || document.createElement('div'); + this.hostRoot = createRoot(this.host); + this.toDispose.push(Disposable.create(() => this.hostRoot.unmount())); + } + + dispose(): void { + this.toDispose.dispose(); + } + + render(): void { + // Ignore all render calls after the host element has unmounted + if (!this.toDispose.disposed) { + this.hostRoot.render({this.doRender()}); + } + } + + protected doRender(): React.ReactNode { + return undefined; + } +} diff --git a/packages/core/src/browser/widgets/react-widget.tsx b/packages/core/src/browser/widgets/react-widget.tsx new file mode 100644 index 0000000..5467c7e --- /dev/null +++ b/packages/core/src/browser/widgets/react-widget.tsx @@ -0,0 +1,53 @@ +// ***************************************************************************** +// Copyright (C) 2018 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import * as React from 'react'; +import { injectable, unmanaged } from 'inversify'; +import { Disposable } from '../../common'; +import { BaseWidget, Message } from './widget'; +import { Widget } from '@lumino/widgets'; +import { createRoot, Root } from 'react-dom/client'; + +@injectable() +export abstract class ReactWidget extends BaseWidget { + + protected nodeRoot: Root; + + constructor(@unmanaged() options?: Widget.IOptions) { + super(options); + this.scrollOptions = { + suppressScrollX: true, + minScrollbarLength: 35, + }; + this.nodeRoot = createRoot(this.node); + this.toDispose.push(Disposable.create(() => this.nodeRoot.unmount())); + } + + protected override onUpdateRequest(msg: Message): void { + super.onUpdateRequest(msg); + if (!this.isDisposed) { + this.nodeRoot.render({this.render()}); + } + } + + /** + * Render the React widget in the DOM. + * - If the widget has been previously rendered, + * any subsequent calls will perform an update and only + * change the DOM if absolutely necessary. + */ + protected abstract render(): React.ReactNode; +} diff --git a/packages/core/src/browser/widgets/select-component.tsx b/packages/core/src/browser/widgets/select-component.tsx new file mode 100644 index 0000000..f4d7668 --- /dev/null +++ b/packages/core/src/browser/widgets/select-component.tsx @@ -0,0 +1,390 @@ +// ***************************************************************************** +// Copyright (C) 2022 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import * as React from 'react'; +import * as ReactDOM from 'react-dom'; +import * as DOMPurify from 'dompurify'; +import { codicon } from './widget'; +import { measureTextHeight, measureTextWidth } from '../browser'; + +import '../../../src/browser/style/select-component.css'; + +export interface SelectOption { + value?: string + label?: string + separator?: boolean + disabled?: boolean + detail?: string + description?: string + markdown?: boolean + userData?: string +} + +export interface SelectComponentProps { + id?: string + className?: string + options: readonly SelectOption[] + defaultValue?: string | number + onChange?: (option: SelectOption, index: number) => void, + onBlur?: () => void, + onFocus?: () => void, + alignment?: 'left' | 'right'; +} + +export interface SelectComponentState { + dimensions?: DOMRect + selected: number + original: number + hover: number +} + +export const SELECT_COMPONENT_CONTAINER = 'select-component-container'; + +export class SelectComponent extends React.Component { + protected dropdownElement: HTMLElement; + protected fieldRef = React.createRef(); + protected dropdownRef = React.createRef(); + protected mountedListeners: Map = new Map(); + protected optimalWidth = 0; + protected optimalHeight = 0; + + constructor(props: SelectComponentProps) { + super(props); + const selected = this.getInitialSelectedIndex(props); + this.state = { + selected, + original: selected, + hover: selected + }; + + let list = document.getElementById(SELECT_COMPONENT_CONTAINER); + if (!list) { + list = document.createElement('div'); + list.id = SELECT_COMPONENT_CONTAINER; + list.className = 'theia-select-component-container'; + document.body.appendChild(list); + } + this.dropdownElement = list; + } + + protected getInitialSelectedIndex(props: SelectComponentProps): number { + let selected = 0; + if (typeof props.defaultValue === 'number') { + selected = props.defaultValue; + } else if (typeof props.defaultValue === 'string') { + selected = Math.max(props.options.findIndex(e => e.value === props.defaultValue), 0); + } + return selected; + } + + override componentDidUpdate(prevProps: SelectComponentProps): void { + if (prevProps.defaultValue !== this.props.defaultValue || prevProps.options !== this.props.options) { + const selected = this.getInitialSelectedIndex(this.props); + this.setState({ + selected, + original: selected, + hover: selected + }); + } + } + + get options(): readonly SelectOption[] { + return this.props.options; + } + + get value(): string | number | undefined { + return this.props.options[this.state.selected].value ?? this.state.selected; + } + + set value(value: string | number | undefined) { + let index = -1; + if (typeof value === 'number') { + index = value; + } else if (typeof value === 'string') { + index = this.props.options.findIndex(e => e.value === value); + } + if (index >= 0) { + this.setState({ + selected: index, + original: index, + hover: index + }); + } + } + + protected get alignLeft(): boolean { + return this.props.alignment !== 'right'; + } + + protected getOptimalWidth(): number { + const textWidth = measureTextWidth(this.props.options.map(e => e.label || e.value || '' + (e.detail || ''))); + return Math.ceil(textWidth + 16); + } + + protected getOptimalHeight(maxWidth?: number): number { + const firstLine = this.props.options.find(e => e.label || e.value || e.detail); + if (!firstLine) { + return 0; + } + if (maxWidth) { + maxWidth = Math.ceil(maxWidth) + 10; // Increase width by 10 due to side padding + } + const descriptionHeight = measureTextHeight(this.props.options.map(e => e.description || ''), { maxWidth: `${maxWidth}px` }) + 18; + const singleLineHeight = measureTextHeight(firstLine.label || firstLine.value || firstLine.detail || '') + 6; + const optimal = descriptionHeight + singleLineHeight * this.props.options.length; + return optimal + 20; // Just to be safe, add another 20 pixels here + } + + protected attachListeners(): void { + const hide = (event: MouseEvent) => { + if (!this.dropdownRef.current?.contains(event.target as Node)) { + this.hide(); + } + }; + this.mountedListeners.set('scroll', hide); + this.mountedListeners.set('wheel', hide); + + let parent = this.fieldRef.current?.parentElement; + while (parent) { + // Workaround for perfect scrollbar, since using `overflow: hidden` + // neither triggers the `scroll`, `wheel` nor `blur` event + if (parent.classList.contains('ps')) { + parent.addEventListener('ps-scroll-y', hide); + } + parent = parent.parentElement; + } + + for (const [key, listener] of this.mountedListeners.entries()) { + window.addEventListener(key, listener); + } + } + + override componentWillUnmount(): void { + if (this.mountedListeners.size > 0) { + const eventListener = this.mountedListeners.get('scroll')!; + let parent = this.fieldRef.current?.parentElement; + while (parent) { + parent.removeEventListener('ps-scroll-y', eventListener); + parent = parent.parentElement; + } + for (const [key, listener] of this.mountedListeners.entries()) { + window.removeEventListener(key, listener); + } + } + } + + override render(): React.ReactNode { + const { options } = this.props; + let { selected } = this.state; + if (options[selected]?.separator) { + selected = this.nextNotSeparator('forwards'); + } + const selectedItemLabel = options[selected]?.label ?? options[selected]?.value; + return <> +
    this.handleClickEvent(e)} + onBlur={ + () => { + this.hide(); + this.props.onBlur?.(); + } + } + onFocus={() => this.props.onFocus?.()} + onKeyDown={e => this.handleKeypress(e)} + > +
    {selectedItemLabel}
    +
    +
    + {ReactDOM.createPortal(this.renderDropdown(), this.dropdownElement)} + ; + } + + protected nextNotSeparator(direction: 'forwards' | 'backwards'): number { + const { options } = this.props; + const step = direction === 'forwards' ? 1 : -1; + const length = this.props.options.length; + let selected = this.state.selected; + let count = 0; + do { + selected = (selected + step) % length; + if (selected < 0) { + selected = length - 1; + } + count++; + } + while (options[selected]?.separator && count < length); + return selected; + } + + protected handleKeypress(ev: React.KeyboardEvent): void { + if (!this.fieldRef.current) { + return; + } + if (ev.key === 'ArrowUp') { + const selected = this.nextNotSeparator('backwards'); + this.setState({ + selected, + hover: selected + }); + } else if (ev.key === 'ArrowDown') { + if (this.state.dimensions) { + const selected = this.nextNotSeparator('forwards'); + this.setState({ + selected, + hover: selected + }); + } else { + this.toggleVisibility(); + this.setState({ + selected: 0, + hover: 0, + }); + } + } else if (ev.key === 'Enter') { + if (!this.state.dimensions) { + this.toggleVisibility(); + } else { + const selected = this.state.selected; + this.selectOption(selected, this.props.options[selected]); + } + } else if (ev.key === 'Escape' || ev.key === 'Tab') { + this.hide(undefined, true); + } + ev.stopPropagation(); + ev.nativeEvent.stopImmediatePropagation(); + } + + protected handleClickEvent(event: React.MouseEvent): void { + this.toggleVisibility(); + event.stopPropagation(); + event.nativeEvent.stopImmediatePropagation(); + } + + protected toggleVisibility(): void { + if (!this.fieldRef.current) { + return; + } + if (!this.state.dimensions) { + const rect = this.fieldRef.current.getBoundingClientRect(); + this.setState({ dimensions: rect }); + } else { + this.hide(); + } + } + + protected hide(index?: number, releaseFocus = false): void { + const selectedIndex = index === undefined ? this.state.original : index; + this.setState({ + dimensions: undefined, + selected: selectedIndex, + original: selectedIndex, + hover: selectedIndex + }); + // Force releasing focus of the select element to allow closing via escape later on + if (releaseFocus && document.activeElement && document.activeElement === this.fieldRef.current) { + this.fieldRef.current.blur(); + } + } + + protected renderDropdown(): React.ReactNode { + if (!this.state.dimensions) { + return; + } + + const shellArea = document.getElementById('theia-app-shell')!.getBoundingClientRect(); + const maxWidth = this.alignLeft ? shellArea.width - this.state.dimensions.left : this.state.dimensions.right; + if (this.mountedListeners.size === 0) { + // Only attach our listeners once we render our dropdown menu + this.attachListeners(); + // We can now also calculate the optimal width + this.optimalWidth = this.getOptimalWidth(); + this.optimalHeight = this.getOptimalHeight(Math.max(this.state.dimensions.width, this.optimalWidth)); + } + const availableTop = this.state.dimensions.top - shellArea.top; + const availableBottom = shellArea.top + shellArea.height - this.state.dimensions.bottom; + // prefer rendering to the bottom unless there is not enough space and more content can be shown to the top + const invert = availableBottom < this.optimalHeight && (availableBottom - this.optimalHeight) < (availableTop - this.optimalHeight); + + const { options } = this.props; + const { hover } = this.state; + const description = options[hover].description; + const markdown = options[hover].markdown; + const items = options.map((item, i) => this.renderOption(i, item)); + if (description) { + let descriptionNode: React.ReactNode | undefined; + const className = 'theia-select-component-description'; + if (markdown) { + descriptionNode =
    ; // eslint-disable-line react/no-danger + } else { + descriptionNode =
    + {description} +
    ; + } + if (invert) { + items.unshift(descriptionNode); + } else { + items.push(descriptionNode); + } + } + + return
    + {items} +
    ; + } + + protected renderOption(index: number, option: SelectOption): React.ReactNode { + if (option.separator) { + return
    ; + } + const selected = this.state.hover; + return ( +
    { + this.setState({ + hover: index + }); + }} + onMouseDown={() => { + this.selectOption(index, option); + }} + > +
    {option.label ?? option.value}
    + {option.detail &&
    {option.detail}
    } +
    + ); + } + + protected selectOption(index: number, option: SelectOption): void { + this.props.onChange?.(option, index); + this.hide(index); + } +} diff --git a/packages/core/src/browser/widgets/split-widget.ts b/packages/core/src/browser/widgets/split-widget.ts new file mode 100644 index 0000000..ff54f21 --- /dev/null +++ b/packages/core/src/browser/widgets/split-widget.ts @@ -0,0 +1,162 @@ +// ***************************************************************************** +// Copyright (C) 2024 1C-Soft LLC and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { ApplicationShell, StatefulWidget } from '../shell'; +import { BaseWidget, Message, PanelLayout, SplitPanel, Widget } from './widget'; +import { CompositeSaveable, Saveable, SaveableSource } from '../saveable'; +import { Navigatable } from '../navigatable-types'; +import { Emitter, URI } from '../../common'; + +/** + * A widget containing a number of panes in a split layout. + */ +export class SplitWidget extends BaseWidget implements ApplicationShell.TrackableWidgetProvider, SaveableSource, Navigatable, StatefulWidget { + + protected readonly splitPanel: SplitPanel; + + protected readonly onDidChangeTrackableWidgetsEmitter = new Emitter(); + readonly onDidChangeTrackableWidgets = this.onDidChangeTrackableWidgetsEmitter.event; + + protected readonly compositeSaveable = new CompositeSaveable(); + + protected navigatable?: Navigatable; + + constructor(options?: SplitPanel.IOptions & { navigatable?: Navigatable }) { + super(); + + this.toDispose.pushAll([this.onDidChangeTrackableWidgetsEmitter]); + + this.addClass('theia-split-widget'); + + const layout = new PanelLayout(); + this.layout = layout; + const that = this; + this.splitPanel = new class extends SplitPanel { + + protected override onChildAdded(msg: Widget.ChildMessage): void { + super.onChildAdded(msg); + that.onPaneAdded(msg.child); + } + + protected override onChildRemoved(msg: Widget.ChildMessage): void { + super.onChildRemoved(msg); + that.onPaneRemoved(msg.child); + } + }({ + spacing: 1, // --theia-border-width + ...options + }); + this.splitPanel.node.tabIndex = -1; + layout.addWidget(this.splitPanel); + + this.navigatable = options?.navigatable; + } + + get orientation(): SplitPanel.Orientation { + return this.splitPanel.orientation; + } + + set orientation(value: SplitPanel.Orientation) { + this.splitPanel.orientation = value; + } + + relativeSizes(): number[] { + return this.splitPanel.relativeSizes(); + } + + setRelativeSizes(sizes: number[]): void { + this.splitPanel.setRelativeSizes(sizes); + } + + get handles(): readonly HTMLDivElement[] { + return this.splitPanel.handles; + } + + get saveable(): Saveable { + return this.compositeSaveable; + } + + getResourceUri(): URI | undefined { + return this.navigatable?.getResourceUri(); + } + + createMoveToUri(resourceUri: URI): URI | undefined { + return this.navigatable?.createMoveToUri(resourceUri); + } + + storeState(): SplitWidget.State { + return { orientation: this.orientation, widgets: this.panes, relativeSizes: this.relativeSizes() }; + } + + restoreState(oldState: SplitWidget.State): void { + const { orientation, widgets, relativeSizes } = oldState; + if (orientation) { + this.orientation = orientation; + } + for (const widget of widgets) { + this.addPane(widget); + } + if (relativeSizes) { + this.setRelativeSizes(relativeSizes); + } + } + + get panes(): readonly Widget[] { + return this.splitPanel.widgets; + } + + getTrackableWidgets(): Widget[] { + return [...this.panes]; + } + + protected fireDidChangeTrackableWidgets(): void { + this.onDidChangeTrackableWidgetsEmitter.fire(this.getTrackableWidgets()); + } + + addPane(pane: Widget): void { + this.splitPanel.addWidget(pane); + } + + insertPane(index: number, pane: Widget): void { + this.splitPanel.insertWidget(index, pane); + } + + protected onPaneAdded(pane: Widget): void { + if (Saveable.isSource(pane)) { + this.compositeSaveable.add(pane.saveable); + } + this.fireDidChangeTrackableWidgets(); + } + + protected onPaneRemoved(pane: Widget): void { + if (Saveable.isSource(pane)) { + this.compositeSaveable.remove(pane.saveable); + } + this.fireDidChangeTrackableWidgets(); + } + + protected override onActivateRequest(msg: Message): void { + this.splitPanel.node.focus(); + } +} + +export namespace SplitWidget { + export interface State { + orientation?: SplitPanel.Orientation; + widgets: readonly Widget[]; // note: don't rename this property; it has special meaning for `ShellLayoutRestorer` + relativeSizes?: number[]; + } +} diff --git a/packages/core/src/browser/widgets/widget.ts b/packages/core/src/browser/widgets/widget.ts new file mode 100644 index 0000000..c826c5c --- /dev/null +++ b/packages/core/src/browser/widgets/widget.ts @@ -0,0 +1,438 @@ +// ***************************************************************************** +// Copyright (C) 2017 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +/* eslint-disable @typescript-eslint/no-explicit-any */ + +import { injectable, decorate, unmanaged } from 'inversify'; +import { Title, Widget } from '@lumino/widgets'; +import { Message, MessageLoop } from '@lumino/messaging'; +import { Emitter, Event, Disposable, DisposableCollection, MaybePromise, isObject } from '../../common'; +import { KeyCode, KeysOrKeyCodes } from '../keyboard/keys'; + +import PerfectScrollbar from 'perfect-scrollbar'; +import { PreviewableWidget } from '../widgets/previewable-widget'; +import { Slot } from '@lumino/signaling'; + +decorate(injectable(), Widget); +decorate(unmanaged(), Widget, 0); + +export * from '@lumino/widgets'; +export * from '@lumino/messaging'; + +export const ACTION_ITEM = 'action-label'; + +export function codiconArray(name: string, actionItem = false): string[] { + const array = ['codicon', `codicon-${name}`]; + if (actionItem) { + array.push(ACTION_ITEM); + } + return array; +} + +export function codicon(name: string, actionItem = false): string { + return `codicon codicon-${name}${actionItem ? ` ${ACTION_ITEM}` : ''}`; +} + +export const DISABLED_CLASS = 'theia-mod-disabled'; +export const EXPANSION_TOGGLE_CLASS = 'theia-ExpansionToggle'; +export const CODICON_TREE_ITEM_CLASSES = codiconArray('chevron-down'); +export const COLLAPSED_CLASS = 'theia-mod-collapsed'; +export const BUSY_CLASS = 'theia-mod-busy'; +export const CODICON_LOADING_CLASSES = codiconArray('loading'); +export const SELECTED_CLASS = 'theia-mod-selected'; +export const FOCUS_CLASS = 'theia-mod-focus'; +export const PINNED_CLASS = 'theia-mod-pinned'; +export const LOCKED_CLASS = 'theia-mod-locked'; +export const DEFAULT_SCROLL_OPTIONS: PerfectScrollbar.Options = { + suppressScrollX: true, + minScrollbarLength: 35, +}; + +/** + * At a number of places in the code, we have effectively reimplemented Lumino's Widget.attach and Widget.detach, + * but omitted the checks that Lumino expects to be performed for those operations. That is a bad idea, because it + * means that we are telling widgets that they are attached or detached when not all the conditions that should apply + * do apply. We should explicitly mark those locations so that we know where we should go fix them later. + */ +export namespace UnsafeWidgetUtilities { + /** + * Ordinarily, the following checks should be performed before detaching a widget: + * It should not be the child of another widget + * It should be attached and it should be a child of document.body + */ + export function detach(widget: Widget): void { + MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach); + widget.node.remove(); + MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach); + }; + /** + * @param ref The child of the host element to insert the widget before. + * Ordinarily the following checks should be performed: + * The widget should have no parent + * The widget should not be attached, and its node should not be a child of document.body + * The host should be a child of document.body + * We often violate the last condition. + */ + // eslint-disable-next-line no-null/no-null + export function attach(widget: Widget, host: HTMLElement, ref: HTMLElement | null = null): void { + MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach); + host.insertBefore(widget.node, ref); + MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach); + }; +} + +@injectable() +export class BaseWidget extends Widget implements PreviewableWidget { + + protected readonly onScrollYReachEndEmitter = new Emitter(); + readonly onScrollYReachEnd: Event = this.onScrollYReachEndEmitter.event; + protected readonly onScrollUpEmitter = new Emitter(); + readonly onScrollUp: Event = this.onScrollUpEmitter.event; + protected readonly onDidChangeVisibilityEmitter = new Emitter(); + readonly onDidChangeVisibility = this.onDidChangeVisibilityEmitter.event; + protected readonly onDidDisposeEmitter = new Emitter(); + readonly onDidDispose = this.onDidDisposeEmitter.event; + + protected readonly toDispose = new DisposableCollection( + this.onDidDisposeEmitter, + Disposable.create(() => this.onDidDisposeEmitter.fire()), + Disposable.create(() => this.toDisposeOnDetach.dispose()), + this.onScrollYReachEndEmitter, + this.onScrollUpEmitter, + this.onDidChangeVisibilityEmitter + ); + protected readonly toDisposeOnDetach = new DisposableCollection(); + protected scrollBar?: PerfectScrollbar; + protected scrollOptions?: PerfectScrollbar.Options; + + constructor(@unmanaged() options?: Widget.IOptions) { + super(options); + } + + override get isVisible(): boolean { + // Reverted to @lumino/widgets pre-2.7.0 behavior using the IsVisible flag instead of the recursive parent check. + // Theia relies on this flag-based implementation and we need to transition to the new behavior in a follow-up (GH-16585) + return this.testFlag(Widget.Flag.IsVisible); + } + + override dispose(): void { + if (this.isDisposed) { + return; + } + super.dispose(); + this.toDispose.dispose(); + } + + protected override onCloseRequest(msg: Message): void { + super.onCloseRequest(msg); + this.dispose(); + } + + protected override onBeforeAttach(msg: Message): void { + if (this.title.iconClass === '') { + this.title.iconClass = 'no-icon'; + } + super.onBeforeAttach(msg); + } + + protected override onAfterDetach(msg: Message): void { + if (this.title.iconClass === 'no-icon') { + this.title.iconClass = ''; + } + super.onAfterDetach(msg); + } + + protected override onBeforeDetach(msg: Message): void { + this.toDisposeOnDetach.dispose(); + super.onBeforeDetach(msg); + } + + protected override onAfterAttach(msg: Message): void { + super.onAfterAttach(msg); + if (this.scrollOptions) { + (async () => { + const container = await this.getScrollContainer(); + container.style.overflow = 'hidden'; + this.scrollBar = new PerfectScrollbar(container, this.scrollOptions); + this.disableScrollBarFocus(container); + this.toDisposeOnDetach.push(addEventListener(container, 'ps-y-reach-end', () => { this.onScrollYReachEndEmitter.fire(undefined); })); + this.toDisposeOnDetach.push(addEventListener(container, 'ps-scroll-up', () => { this.onScrollUpEmitter.fire(undefined); })); + this.toDisposeOnDetach.push(Disposable.create(() => { + if (this.scrollBar) { + this.scrollBar.destroy(); + this.scrollBar = undefined; + } + container.style.overflow = 'initial'; + })); + })(); + } + } + + protected getScrollContainer(): MaybePromise { + return this.node; + } + + protected disableScrollBarFocus(scrollContainer: HTMLElement): void { + for (const thumbs of [scrollContainer.getElementsByClassName('ps__thumb-x'), scrollContainer.getElementsByClassName('ps__thumb-y')]) { + for (let i = 0; i < thumbs.length; i++) { + const element = thumbs.item(i); + if (element) { + element.removeAttribute('tabIndex'); + } + } + } + } + + protected override onUpdateRequest(msg: Message): void { + super.onUpdateRequest(msg); + if (this.scrollBar) { + this.scrollBar.update(); + } + } + + protected addUpdateListener(element: HTMLElement, type: K, useCapture?: boolean): void { + this.addEventListener(element, type, e => { + this.update(); + e.preventDefault(); + }, useCapture); + } + + protected addEventListener(element: HTMLElement, type: K, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void { + this.toDisposeOnDetach.push(addEventListener(element, type, listener, useCapture)); + } + + protected addKeyListener( + element: HTMLElement, + keysOrKeyCodes: KeyCode.Predicate | KeysOrKeyCodes, + action: EventHandler, + ...additionalEventTypes: K[]): void { + this.toDisposeOnDetach.push(addKeyListener(element, keysOrKeyCodes, action, ...additionalEventTypes)); + } + + protected addClipboardListener(element: HTMLElement, type: K, listener: EventListenerOrEventListenerObject): void { + this.toDisposeOnDetach.push(addClipboardListener(element, type, listener)); + } + + getPreviewNode(): Node | undefined { + return this.node; + } + + override setFlag(flag: Widget.Flag): void { + super.setFlag(flag); + if (flag === Widget.Flag.IsVisible) { + this.handleVisiblityChanged(this.isVisible); + } + } + + protected handleVisiblityChanged(isNowVisible: boolean): void { + this.onDidChangeVisibilityEmitter.fire(isNowVisible); + } + + override clearFlag(flag: Widget.Flag): void { + const wasVisible = this.isVisible; + super.clearFlag(flag); + const isVisible = this.isVisible; + if (isVisible !== wasVisible) { + this.handleVisiblityChanged(isVisible); + } + } +} + +export function setEnabled(element: HTMLElement, enabled: boolean): void { + element.classList.toggle(DISABLED_CLASS, !enabled); + element.tabIndex = enabled ? 0 : -1; +} + +export function createIconButton(...classNames: string[]): HTMLSpanElement { + const icon = document.createElement('i'); + icon.classList.add(...classNames); + const button = document.createElement('span'); + button.tabIndex = 0; + button.appendChild(icon); + return button; +} + +// eslint-disable-next-line @typescript-eslint/no-explicit-any +export type EventListener = (this: HTMLElement, event: HTMLElementEventMap[K]) => any; +// eslint-disable-next-line @typescript-eslint/no-explicit-any +export type EventHandler = (event: HTMLElementEventMap[K]) => any; +export interface EventListenerObject { + handleEvent(evt: HTMLElementEventMap[K]): void; +} +export namespace EventListenerObject { + export function is(listener: unknown): listener is EventListenerObject { + return isObject(listener) && 'handleEvent' in listener; + } +} +export type EventListenerOrEventListenerObject = EventListener | EventListenerObject; +export function addEventListener( + element: HTMLElement, type: K, listener: EventListenerOrEventListenerObject, useCapture?: boolean +): Disposable { + element.addEventListener(type, listener, useCapture); + return Disposable.create(() => + element.removeEventListener(type, listener, useCapture) + ); +} + +export function addKeyListener( + element: HTMLElement, + keysOrKeyCodes: KeyCode.Predicate | KeysOrKeyCodes, + action: EventHandler, + ...additionalEventTypes: K[]): Disposable { + type HandledEvent = Parameters[0]; + + const toDispose = new DisposableCollection(); + const keyCodePredicate = (() => { + if (typeof keysOrKeyCodes === 'function') { + return keysOrKeyCodes; + } else { + return (actual: KeyCode) => KeysOrKeyCodes.toKeyCodes(keysOrKeyCodes).some(k => k.equals(actual)); + } + })(); + + toDispose.push(addEventListener(element, 'keydown', e => { + const kc = KeyCode.createKeyCode(e); + if (keyCodePredicate(kc)) { + const result = action(e as HandledEvent); + if (typeof result !== 'boolean' || result) { + e.stopPropagation(); + e.preventDefault(); + } + } + })); + for (const type of additionalEventTypes) { + toDispose.push(addEventListener(element, type, e => { + const result = action(e as HandledEvent); + if (typeof result !== 'boolean' || result) { + e.stopPropagation(); + e.preventDefault(); + } + })); + } + return toDispose; +} + +export function addClipboardListener(element: HTMLElement, type: K, listener: EventListenerOrEventListenerObject): Disposable { + const documentListener = (e: ClipboardEvent) => { + const activeElement = document.activeElement; + if (activeElement && element.contains(activeElement)) { + if (EventListenerObject.is(listener)) { + listener.handleEvent(e); + } else { + listener.bind(element)(e); + } + } + }; + document.addEventListener(type, documentListener); + return Disposable.create(() => + document.removeEventListener(type, documentListener) + ); +} + +/** + * Resolves when the given widget is detached and hidden. + */ +export function waitForClosed(widget: Widget): Promise { + return waitForVisible(widget, false, false); +} + +/** + * Resolves when the given widget is attached and visible. + */ +export function waitForRevealed(widget: Widget): Promise { + return waitForVisible(widget, true, true); +} + +/** + * Resolves when the given widget is hidden regardless of attachment. + */ +export function waitForHidden(widget: Widget): Promise { + return waitForVisible(widget, false); +} + +function waitForVisible(widget: Widget, visible: boolean, attached?: boolean): Promise { + if ((typeof attached !== 'boolean' || widget.isAttached === attached) && + (widget.isVisible === visible || (widget.node.style.visibility !== 'hidden') === visible) + ) { + return new Promise(resolve => setTimeout(() => resolve(), 0)); + } + return new Promise(resolve => { + const waitFor = () => setTimeout(() => { + if ((typeof attached !== 'boolean' || widget.isAttached === attached) && + (widget.isVisible === visible || (widget.node.style.visibility !== 'hidden') === visible)) { + setTimeout(() => resolve(), 0); + } else { + waitFor(); + } + }, 0); + waitFor(); + }); +} + +const pinnedTitles = new Map, [boolean, Slot]>(); + +export function isPinned(title: Title): boolean { + const pinnedState = !title.closable && title.className.includes(PINNED_CLASS); + return pinnedState; +} + +export function pin(title: Title): void { + const l = () => { + pinnedTitles.delete(title); + }; + pinnedTitles.set(title, [title.closable, l]); + title.owner.disposed.connect(l); + title.closable = false; + if (!title.className.includes(PINNED_CLASS)) { + title.className += ` ${PINNED_CLASS}`; + } +} + +export function unpin(title: Title): void { + const entry = pinnedTitles.get(title); + if (entry) { + title.owner.disposed.disconnect(entry[1]); + title.closable = entry[0]; + pinnedTitles.delete(title); + } else { + title.closable = true; + } + title.className = title.className.replace(PINNED_CLASS, '').trim(); +} + +export function isLocked(title: Title): boolean { + return title.className.includes(LOCKED_CLASS); +} + +export function lock(title: Title): void { + if (!title.className.includes(LOCKED_CLASS)) { + title.className += ` ${LOCKED_CLASS}`; + } +} + +export function unlock(title: Title): void { + title.className = title.className.replace(LOCKED_CLASS, '').trim(); +} + +export function togglePinned(title?: Title): void { + if (title) { + if (isPinned(title)) { + unpin(title); + } else { + pin(title); + } + } +} diff --git a/packages/core/src/browser/window-contribution.ts b/packages/core/src/browser/window-contribution.ts new file mode 100644 index 0000000..a01d7c1 --- /dev/null +++ b/packages/core/src/browser/window-contribution.ts @@ -0,0 +1,64 @@ +// ***************************************************************************** +// Copyright (C) 2021 Ericsson and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { inject, injectable } from 'inversify'; +import { Command, CommandContribution, CommandRegistry, environment } from '../common'; +import { WindowService } from './window/window-service'; +import { KeybindingContribution, KeybindingRegistry } from './keybinding'; +import { MenuContribution, MenuModelRegistry } from '../common/menu'; +import { CommonMenus } from './common-menus'; + +export namespace WindowCommands { + + export const NEW_WINDOW = Command.toDefaultLocalizedCommand({ + id: 'workbench.action.newWindow', + label: 'New Window' + }); +} + +@injectable() +export class WindowContribution implements CommandContribution, KeybindingContribution, MenuContribution { + + @inject(WindowService) + protected windowService: WindowService; + + registerCommands(commands: CommandRegistry): void { + commands.registerCommand(WindowCommands.NEW_WINDOW, { + execute: () => { + this.windowService.openNewDefaultWindow(); + } + }); + } + + registerKeybindings(registry: KeybindingRegistry): void { + registry.registerKeybindings({ + command: WindowCommands.NEW_WINDOW.id, + keybinding: this.isElectron() ? 'ctrlcmd+shift+n' : 'alt+shift+n' + }); + } + + registerMenus(registry: MenuModelRegistry): void { + registry.registerMenuAction(CommonMenus.FILE_NEW_TEXT, { + commandId: WindowCommands.NEW_WINDOW.id, + order: 'c' + }); + } + + private isElectron(): boolean { + return environment.electron.is(); + } + +} diff --git a/packages/core/src/browser/window/browser-window-module.ts b/packages/core/src/browser/window/browser-window-module.ts new file mode 100644 index 0000000..6480168 --- /dev/null +++ b/packages/core/src/browser/window/browser-window-module.ts @@ -0,0 +1,35 @@ +// ***************************************************************************** +// Copyright (C) 2017 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { ContainerModule } from 'inversify'; +import { WindowService } from '../../browser/window/window-service'; +import { DefaultWindowService } from '../../browser/window/default-window-service'; +import { FrontendApplicationContribution } from '../frontend-application-contribution'; +import { ClipboardService } from '../clipboard-service'; +import { BrowserClipboardService } from '../browser-clipboard-service'; +import { SecondaryWindowService } from './secondary-window-service'; +import { DefaultSecondaryWindowService } from './default-secondary-window-service'; +import { bindContributionProvider } from '../../common'; +import { WindowTitleContribution } from './window-title-service'; + +export default new ContainerModule(bind => { + bind(DefaultWindowService).toSelf().inSingletonScope(); + bind(WindowService).toService(DefaultWindowService); + bind(FrontendApplicationContribution).toService(DefaultWindowService); + bind(ClipboardService).to(BrowserClipboardService).inSingletonScope(); + bind(SecondaryWindowService).to(DefaultSecondaryWindowService).inSingletonScope(); + bindContributionProvider(bind, WindowTitleContribution); +}); diff --git a/packages/core/src/browser/window/default-secondary-window-service.ts b/packages/core/src/browser/window/default-secondary-window-service.ts new file mode 100644 index 0000000..d3911a5 --- /dev/null +++ b/packages/core/src/browser/window/default-secondary-window-service.ts @@ -0,0 +1,240 @@ +// ***************************************************************************** +// Copyright (C) 2022 STMicroelectronics, Ericsson, ARM, EclipseSource and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** +import { inject, injectable, postConstruct } from 'inversify'; +import { SecondaryWindow, SecondaryWindowService } from './secondary-window-service'; +import { WindowService } from './window-service'; +import { ExtractableWidget, Widget } from '../widgets'; +import { ApplicationShell } from '../shell'; +import { Saveable } from '../saveable'; +import { Emitter, environment, Event, PreferenceService } from '../../common'; +import { SaveableService } from '../saveable-service'; +import { getAllWidgetsFromSecondaryWindow, getDefaultRestoreArea } from '../secondary-window-handler'; + +@injectable() +export class DefaultSecondaryWindowService implements SecondaryWindowService { + protected readonly onWindowOpenedEmitter = new Emitter; + readonly onWindowOpened: Event = this.onWindowOpenedEmitter.event; + protected readonly onWindowClosedEmitter = new Emitter; + readonly onWindowClosed: Event = this.onWindowClosedEmitter.event; + protected readonly beforeWidgetRestoreEmitter = new Emitter<[Widget, Window]>; + readonly beforeWidgetRestore: Event<[Widget, Window]> = this.beforeWidgetRestoreEmitter.event; + // secondary-window.html is part of Theia's generated code. It is generated by dev-packages/application-manager/src/generator/frontend-generator.ts + protected static SECONDARY_WINDOW_URL = 'secondary-window.html'; + + /** + * Randomized prefix to be included in opened windows' ids. + * This avoids conflicts when creating sub-windows from multiple theia instances (e.g. by opening Theia multiple times in the same browser) + */ + protected readonly prefix = crypto.getRandomValues(new Uint32Array(1))[0]; + /** Unique id. Increase after every access. */ + private nextId = 0; + + protected secondaryWindows: Window[] = []; + + @inject(WindowService) + protected readonly windowService: WindowService; + + @inject(PreferenceService) + protected readonly preferenceService: PreferenceService; + + @inject(SaveableService) + protected readonly saveResourceService: SaveableService; + + @postConstruct() + init(): void { + // Set up messaging with secondary windows + window.addEventListener('message', (event: MessageEvent) => { + console.trace('Message on main window', event); + if (event.data.fromSecondary) { + console.trace('Message comes from secondary window'); + return; + } + if (event.data.fromMain) { + console.trace('Message has mainWindow marker, therefore ignore it'); + return; + } + + // Filter setImmediate messages. Do not forward because these come in with very high frequency. + // They are not needed in secondary windows because these messages are just a work around + // to make setImmediate work in the main window: https://developer.mozilla.org/en-US/docs/Web/API/Window/setImmediate + if (typeof event.data === 'string' && event.data.startsWith('setImmediate')) { + return; + } + + console.trace('Delegate main window message to secondary windows', event); + this.secondaryWindows.forEach(secondaryWindow => { + if (!secondaryWindow.window.closed) { + secondaryWindow.window.postMessage({ ...event.data, fromMain: true }, '*'); + } + }); + }); + + this.registerShutdownListeners(); + } + + protected registerShutdownListeners(): void { + // Close all open windows when the main window is closed. + this.windowService.onUnload(() => { + // Iterate backwards because calling window.close might remove the window from the array + for (let i = this.secondaryWindows.length - 1; i >= 0; i--) { + this.secondaryWindows[i].close(); + } + }); + } + + createSecondaryWindow(widget: ExtractableWidget, shell: ApplicationShell): Window | SecondaryWindow | undefined { + const [height, width, left, top] = this.findSecondaryWindowCoordinates(widget); + let options = `popup=1,width=${width},height=${height},left=${left},top=${top}`; + if (this.preferenceService.get('window.secondaryWindowAlwaysOnTop')) { + options += ',alwaysOnTop=true'; + } + const newWindow = window.open(DefaultSecondaryWindowService.SECONDARY_WINDOW_URL, this.nextWindowId(), options) ?? undefined; + if (newWindow) { + this.secondaryWindows.push(newWindow); + this.onWindowOpenedEmitter.fire(newWindow); + newWindow.addEventListener('DOMContentLoaded', () => { + newWindow.addEventListener('beforeunload', evt => { + const widgets = getAllWidgetsFromSecondaryWindow(newWindow) ?? [widget]; + for (const w of widgets) { + const saveable = Saveable.get(w); + const wouldLoseState = !!saveable && saveable.dirty && this.saveResourceService.autoSave === 'off'; + if (wouldLoseState) { + evt.returnValue = ''; + evt.preventDefault(); + return 'non-empty'; + } + } + }, { capture: true }); + + newWindow.addEventListener('unload', () => { + const extIndex = this.secondaryWindows.indexOf(newWindow); + if (extIndex > -1) { + this.onWindowClosedEmitter.fire(newWindow); + this.secondaryWindows.splice(extIndex, 1); + }; + }); + this.windowCreated(newWindow, widget, shell); + }); + } + (newWindow as SecondaryWindow).rootWidget = undefined; + return newWindow; + } + + protected windowCreated(newWindow: Window, widget: ExtractableWidget, shell: ApplicationShell): void { + newWindow.addEventListener('unload', () => { + this.restoreWidgets(newWindow, widget, shell); + }); + } + + protected findWindow(windowName: string): Window | undefined { + for (const w of this.secondaryWindows) { + if (w.name === windowName) { + return w; + } + } + return undefined; + } + + protected findSecondaryWindowCoordinates(widget: ExtractableWidget): (number | undefined)[] { + const clientBounds = widget.node.getBoundingClientRect(); + const preference = this.preferenceService.get('window.secondaryWindowPlacement'); + + let height; let width; let left; let top; + const offsetY = 20; // Offset to avoid the window title bar + + switch (preference) { + case 'originalSize': { + height = widget.node.clientHeight; + width = widget.node.clientWidth; + left = window.screenLeft + clientBounds.x; + top = window.screenTop + (window.outerHeight - window.innerHeight) + offsetY; + if (environment.electron.is()) { + top = window.screenTop + clientBounds.y; + } + break; + } + case 'halfWidth': { + height = window.innerHeight - (window.outerHeight - window.innerHeight); + width = window.innerWidth / 2; + left = window.screenLeft; + top = window.screenTop; + if (!environment.electron.is()) { + height = window.innerHeight + clientBounds.y - offsetY; + } + break; + } + case 'fullSize': { + height = window.innerHeight - (window.outerHeight - window.innerHeight); + width = window.innerWidth; + left = window.screenLeft; + top = window.screenTop; + if (!environment.electron.is()) { + height = window.innerHeight + clientBounds.y - offsetY; + } + break; + } + } + return [height, width, left, top]; + } + + getWindows(): Window[] { + return this.secondaryWindows; + } + + focus(win: Window): void { + win.focus(); + } + + protected nextWindowId(): string { + return `${this.prefix}-secondaryWindow-${this.nextId++}`; + } + + /** + * Restore the widgets back to the main window. SecondaryWindowHandler needs to get informated about this. + */ + protected async restoreWidgets(newWindow: Window, extractableWidget: ExtractableWidget, shell: ApplicationShell): Promise { + const widgets = getAllWidgetsFromSecondaryWindow(newWindow) ?? new Set([extractableWidget]); + const defaultRestoreArea = getDefaultRestoreArea(newWindow); + + let allMovedOrDisposed = true; + for (const widget of widgets) { + if (widget.isDisposed) { + continue; + } + try { + const preferredRestoreArea = ExtractableWidget.is(widget) ? widget.previousArea : defaultRestoreArea; + const area = (preferredRestoreArea === undefined || preferredRestoreArea === 'top' || preferredRestoreArea === 'secondaryWindow') ? 'main' : preferredRestoreArea; + // fire removed event before adding it to shell + this.beforeWidgetRestoreEmitter.fire([widget, newWindow]); + // reset ExtractableWidget properties before moving back so that handler evaluation is correct immediately + if (ExtractableWidget.is(widget)) { + widget.secondaryWindow = undefined; + widget.previousArea = undefined; + } + await shell.addWidget(widget, { area }); + await shell.activateWidget(widget.id); + } catch (e) { + // we can't move back, close instead + // otherwise the window will just stay open with no way to close it + await shell.closeWidget(widget.id); + if (!widget.isDisposed) { + allMovedOrDisposed = false; + } + } + } + return allMovedOrDisposed; + } +} diff --git a/packages/core/src/browser/window/default-window-service.spec.ts b/packages/core/src/browser/window/default-window-service.spec.ts new file mode 100644 index 0000000..f2d1a36 --- /dev/null +++ b/packages/core/src/browser/window/default-window-service.spec.ts @@ -0,0 +1,78 @@ +// ***************************************************************************** +// Copyright (C) 2020 Ericsson and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { Container } from 'inversify'; +import { ContributionProvider } from '../../common'; +import { CorePreferences } from '../../common/core-preferences'; +import { FrontendApplicationContribution } from '../frontend-application-contribution'; +import { DefaultWindowService } from './default-window-service'; +import assert = require('assert'); + +describe('DefaultWindowService', () => { + class TestFrontendApplicationContribution implements FrontendApplicationContribution { + constructor(private preventUnload: boolean) { } + onWillStopCalled = false; + onWillStop(): boolean { + this.onWillStopCalled = true; + return this.preventUnload; + } + } + function setupWindowService(confirmExit: CorePreferences['application.confirmExit'], frontendContributions: FrontendApplicationContribution[]): DefaultWindowService { + const container = new Container(); + container.bind(DefaultWindowService).toSelf().inSingletonScope(); + container.bind>>(ContributionProvider) + .toConstantValue({ + getContributions: () => frontendContributions, + }) + .whenTargetNamed(FrontendApplicationContribution); + container.bind>(CorePreferences) + .toConstantValue({ + 'application.confirmExit': confirmExit, + }); + return container.get(DefaultWindowService); + } + it('onWillStop should be called on every contribution (never)', () => { + const frontendContributions: TestFrontendApplicationContribution[] = [ + // preventUnload should be ignored here + new TestFrontendApplicationContribution(true), + ]; + const windowService = setupWindowService('never', frontendContributions); + assert(frontendContributions.every(contribution => !contribution.onWillStopCalled), 'contributions should not be called yet'); + assert(windowService['collectContributionUnloadVetoes']().length === 0, 'there should be no vetoes'); + assert(frontendContributions.every(contribution => contribution.onWillStopCalled), 'contributions should have been called'); + }); + it('onWillStop should be called on every contribution (ifRequired)', () => { + const frontendContributions: TestFrontendApplicationContribution[] = [ + new TestFrontendApplicationContribution(true), + // canUnload should not stop at the previous contribution + new TestFrontendApplicationContribution(false), + ]; + const windowService = setupWindowService('ifRequired', frontendContributions); + assert(frontendContributions.every(contribution => !contribution.onWillStopCalled), 'contributions should not be called yet'); + assert(windowService['collectContributionUnloadVetoes']().length > 0, 'There should be vetoes'); + assert(frontendContributions.every(contribution => contribution.onWillStopCalled), 'contributions should have been called'); + }); + it('onWillStop should be called on every contribution (always)', () => { + const frontendContributions: TestFrontendApplicationContribution[] = [ + // canUnload should return false despite preventUnload not being set + new TestFrontendApplicationContribution(false), + ]; + const windowService = setupWindowService('always', frontendContributions); + assert(frontendContributions.every(contribution => !contribution.onWillStopCalled), 'contributions should not be called yet'); + assert(windowService['collectContributionUnloadVetoes']().length > 0, 'there should be vetoes'); + assert(frontendContributions.every(contribution => contribution.onWillStopCalled), 'contributions should have been called'); + }); +}); diff --git a/packages/core/src/browser/window/default-window-service.ts b/packages/core/src/browser/window/default-window-service.ts new file mode 100644 index 0000000..d9228c3 --- /dev/null +++ b/packages/core/src/browser/window/default-window-service.ts @@ -0,0 +1,171 @@ +// ***************************************************************************** +// Copyright (C) 2017 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { inject, injectable, named } from 'inversify'; +import { Event, Emitter } from '../../common'; +import { CorePreferences } from '../../common/core-preferences'; +import { ContributionProvider } from '../../common/contribution-provider'; +import { FrontendApplicationContribution, OnWillStopAction } from '../frontend-application-contribution'; +import { WindowService } from './window-service'; +import { DEFAULT_WINDOW_HASH } from '../../common/window'; +import { confirmExit } from '../dialogs'; +import { StopReason } from '../../common/frontend-application-state'; +import { FrontendApplication } from '../frontend-application'; + +@injectable() +export class DefaultWindowService implements WindowService, FrontendApplicationContribution { + + protected frontendApplication: FrontendApplication; + protected allowVetoes = true; + + protected onUnloadEmitter = new Emitter(); + get onUnload(): Event { + return this.onUnloadEmitter.event; + } + + @inject(CorePreferences) + protected readonly corePreferences: CorePreferences; + + @inject(ContributionProvider) + @named(FrontendApplicationContribution) + protected readonly contributions: ContributionProvider; + + onStart(app: FrontendApplication): void { + this.frontendApplication = app; + this.registerUnloadListeners(); + } + + openNewWindow(url: string): undefined { + window.open(url, undefined, 'noopener'); + return undefined; + } + + openNewDefaultWindow(): void { + this.openNewWindow(`#${DEFAULT_WINDOW_HASH}`); + } + + focus(): void { + window.focus(); + } + + /** + * Returns a list of actions that {@link FrontendApplicationContribution}s would like to take before shutdown + * It is expected that this will succeed - i.e. return an empty array - at most once per session. If no vetoes are received + * during any cycle, no further checks will be made. In that case, shutdown should proceed unconditionally. + */ + protected collectContributionUnloadVetoes(): OnWillStopAction[] { + const vetoes: OnWillStopAction[] = []; + if (this.allowVetoes) { + const shouldConfirmExit = this.corePreferences['application.confirmExit']; + for (const contribution of this.contributions.getContributions()) { + const veto = contribution.onWillStop?.(this.frontendApplication); + if (veto && shouldConfirmExit !== 'never') { // Ignore vetoes if we should not prompt the user on exit. + if (OnWillStopAction.is(veto)) { + vetoes.push(veto); + } else { + vetoes.push({ reason: 'No reason given', action: () => false }); + } + } + } + vetoes.sort((a, b) => (a.priority ?? -Infinity) - (b.priority ?? -Infinity)); + if (vetoes.length === 0 && shouldConfirmExit === 'always') { + vetoes.push({ reason: 'application.confirmExit preference', action: () => confirmExit() }); + } + if (vetoes.length === 0) { + this.allowVetoes = false; + } + } + return vetoes; + } + + /** + * Implement the mechanism to detect unloading of the page. + */ + protected registerUnloadListeners(): void { + window.addEventListener('beforeunload', event => this.handleBeforeUnloadEvent(event)); + // In a browser, `unload` is correctly fired when the page unloads, unlike Electron. + // If `beforeunload` is cancelled, the user will be prompted to leave or stay. + // If the user stays, the page won't be unloaded, so `unload` is not fired. + // If the user leaves, the page will be unloaded, so `unload` is fired. + window.addEventListener('unload', () => this.onUnloadEmitter.fire()); + } + + async isSafeToShutDown(stopReason: StopReason): Promise { + const vetoes = this.collectContributionUnloadVetoes(); + if (vetoes.length === 0) { + return true; + } + const preparedValues = await Promise.all(vetoes.map(e => e.prepare?.(stopReason))); + console.debug('Shutdown prevented by', vetoes.map(({ reason }) => reason).join(', ')); + for (let i = 0; i < vetoes.length; i++) { + try { + const result = await vetoes[i].action(preparedValues[i], stopReason); + if (!result) { + return false; + } + } catch (e) { + console.error(e); + } + } + console.debug('OnWillStop actions resolved; allowing shutdown'); + this.allowVetoes = false; + return true; + } + + setSafeToShutDown(): void { + this.allowVetoes = false; + } + + /** + * Called when the `window` is about to `unload` its resources. + * At this point, the `document` is still visible and the [`BeforeUnloadEvent`](https://developer.mozilla.org/en-US/docs/Web/API/Window/beforeunload_event) + * event will be canceled if the return value of this method is `false`. + * + * In Electron, handleCloseRequestEvent is is run instead. + */ + protected handleBeforeUnloadEvent(event: BeforeUnloadEvent): string | void { + const vetoes = this.collectContributionUnloadVetoes(); + if (vetoes.length) { + // In the browser, we don't call the functions because this has to finish in a single tick, so we treat any desired action as a veto. + console.debug('Shutdown prevented by', vetoes.map(({ reason }) => reason).join(', ')); + return this.preventUnload(event); + } + console.debug('Shutdown will proceed.'); + } + + /** + * Notify the browser that we do not want to unload. + * + * Notes: + * - Shows a confirmation popup in browsers. + * - Prevents the window from closing without confirmation in electron. + * + * @param event The beforeunload event + */ + protected preventUnload(event: BeforeUnloadEvent): string | void { + event.returnValue = ''; + event.preventDefault(); + return ''; + } + + reload(): void { + this.isSafeToShutDown(StopReason.Reload).then(isSafe => { + if (isSafe) { + window.location.reload(); + } + }); + } +} diff --git a/packages/core/src/browser/window/secondary-window-service.ts b/packages/core/src/browser/window/secondary-window-service.ts new file mode 100644 index 0000000..f794030 --- /dev/null +++ b/packages/core/src/browser/window/secondary-window-service.ts @@ -0,0 +1,64 @@ +// ***************************************************************************** +// Copyright (C) 2022 STMicroelectronics, Ericsson, ARM, EclipseSource and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { Event } from '../../common'; +import { ApplicationShell } from '../shell'; +import { TheiaDockPanel } from '../shell/theia-dock-panel'; +import { ExtractableWidget, TabBar, Widget } from '../widgets'; + +export abstract class SecondaryWindowRootWidget extends Widget { + secondaryWindow: Window | SecondaryWindow; + defaultRestoreArea?: ApplicationShell.Area; + abstract widgets: ReadonlyArray; + abstract addWidget(widget: Widget, disposeCallback: () => void, options?: TheiaDockPanel.AddOptions): void; + getTabBar?(widget: Widget): TabBar | undefined; +} + +export interface SecondaryWindow extends Window { + rootWidget: SecondaryWindowRootWidget | undefined; +} + +export function isSecondaryWindow(window: unknown): window is SecondaryWindow { + if (!window) { + return false; + } + return typeof window === 'object' && 'rootWidget' in window; +} + +export const SecondaryWindowService = Symbol('SecondaryWindowService'); + +/** + * Service for opening new secondary windows to contain widgets extracted from the application shell. + * + * @experimental The functionality provided by this service and its implementation is still under development. Use with caution. + */ +export interface SecondaryWindowService { + /** + * Creates a new secondary window for a widget to be extracted from the application shell. + * The created window is closed automatically when the current theia instance is closed. + * + * @param onClose optional callback that is invoked when the secondary window is closed + * @returns the created window or `undefined` if it could not be created + */ + createSecondaryWindow(widget: ExtractableWidget, shell: ApplicationShell): SecondaryWindow | Window | undefined; + readonly onWindowOpened: Event; + readonly onWindowClosed: Event; + readonly beforeWidgetRestore: Event<[Widget, Window]>; + + /** Handles focussing the given secondary window in the browser and on Electron. */ + focus(win: Window): void; + getWindows(): Window[]; +} diff --git a/packages/core/src/browser/window/test/mock-window-service.ts b/packages/core/src/browser/window/test/mock-window-service.ts new file mode 100644 index 0000000..245c0c6 --- /dev/null +++ b/packages/core/src/browser/window/test/mock-window-service.ts @@ -0,0 +1,29 @@ +// ***************************************************************************** +// Copyright (C) 2017 Ericsson and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** +import { injectable } from 'inversify'; +import { Event } from '../../../common/event'; +import { WindowService } from '../window-service'; + +@injectable() +export class MockWindowService implements WindowService { + openNewWindow(): undefined { return undefined; } + openNewDefaultWindow(): void { } + focus(): void { } + reload(): void { } + isSafeToShutDown(): Promise { return Promise.resolve(true); } + setSafeToShutDown(): void { } + get onUnload(): Event { return Event.None; } +} diff --git a/packages/core/src/browser/window/window-service.ts b/packages/core/src/browser/window/window-service.ts new file mode 100644 index 0000000..6f1a0fc --- /dev/null +++ b/packages/core/src/browser/window/window-service.ts @@ -0,0 +1,78 @@ +// ***************************************************************************** +// Copyright (C) 2017 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { StopReason } from '../../common/frontend-application-state'; +import { Event } from '../../common/event'; +import { NewWindowOptions, WindowSearchParams } from '../../common/window'; + +export interface WindowReloadOptions { + search?: WindowSearchParams, + hash?: string +} + +/** + * Service for opening new browser windows. + */ +export const WindowService = Symbol('WindowService'); + +export interface WindowService { + /** + * Opens a new window and loads the content from the given URL. + * In a browser, opening a new Theia tab or open a link is the same thing. + * But in Electron, we want to open links in a browser, not in Electron. + */ + openNewWindow(url: string, options?: NewWindowOptions): undefined; + + /** + * Opens a new default window. + * - In electron and in the browser it will open the default window without a pre-defined content. + */ + openNewDefaultWindow(params?: WindowReloadOptions): void; + + /** + * Reveal and focuses the current window + */ + focus(): void; + + /** + * Fires when the `window` unloads. The unload event is inevitable. On this event, the frontend application can save its state and release resource. + * Saving the state and releasing any resources must be a synchronous call. Any asynchronous calls invoked after emitting this event might be ignored. + */ + readonly onUnload: Event; + + /** + * Checks `FrontendApplicationContribution#willStop` for impediments to shutdown and runs any actions returned. + * Can be used safely in browser and Electron when triggering reload or shutdown programmatically. + * Should _only_ be called before a shutdown - if this returns `true`, `FrontendApplicationContribution#willStop` + * will not be called again in the current session. I.e. if this return `true`, the shutdown should proceed without + * further condition. + */ + isSafeToShutDown(reason: StopReason): Promise; + + /** + * Will prevent subsequent checks of `FrontendApplicationContribution#willStop`. Should only be used after requesting + * user confirmation. + * + * This is primarily intended programmatic restarts due to e.g. change of display language. It allows for a single confirmation + * of intent, rather than one warning and then several warnings from other contributions. + */ + setSafeToShutDown(): void; + + /** + * Reloads the window according to platform. + */ + reload(params?: WindowReloadOptions): void; +} diff --git a/packages/core/src/browser/window/window-title-service.ts b/packages/core/src/browser/window/window-title-service.ts new file mode 100644 index 0000000..bb3bf9e --- /dev/null +++ b/packages/core/src/browser/window/window-title-service.ts @@ -0,0 +1,120 @@ +// ***************************************************************************** +// Copyright (C) 2022 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { inject, injectable, named, postConstruct } from 'inversify'; +import { escapeRegExpCharacters } from '../../common/strings'; +import { Emitter, Event } from '../../common/event'; +import { CorePreferences } from '../../common/core-preferences'; +import { FrontendApplicationConfigProvider } from '../frontend-application-config-provider'; +import { ContributionProvider } from '../../common'; + +export const WindowTitleContribution = Symbol('WindowTitleAddOnContribution'); +export interface WindowTitleContribution { + enhanceTitle(title: string, parts: Map): string; +} + +export const InitialWindowTitleParts = { + activeEditorShort: undefined, + activeEditorMedium: undefined, + activeEditorLong: undefined, + activeFolderShort: undefined, + activeFolderMedium: undefined, + activeFolderLong: undefined, + folderName: undefined, + folderPath: undefined, + rootName: undefined, + rootPath: undefined, + appName: FrontendApplicationConfigProvider.get().applicationName, + remoteName: undefined, + dirty: undefined, + developmentHost: undefined +}; + +@injectable() +export class WindowTitleService { + + @inject(CorePreferences) + protected readonly preferences: CorePreferences; + + @inject(ContributionProvider) @named(WindowTitleContribution) + protected readonly titleContributions: ContributionProvider; + + protected _title = ''; + protected titleTemplate?: string; + + protected onDidChangeTitleEmitter = new Emitter(); + protected titleParts = new Map(Object.entries(InitialWindowTitleParts)); + protected separator = ' - '; + + @postConstruct() + protected init(): void { + this.titleTemplate = this.preferences['window.title']; + this.separator = this.preferences['window.titleSeparator']; + this.updateTitle(); + this.preferences.onPreferenceChanged(e => { + if (e.preferenceName === 'window.title') { + this.titleTemplate = this.preferences['window.title']; + this.updateTitle(); + } else if (e.preferenceName === 'window.titleSeparator') { + this.separator = this.preferences['window.titleSeparator']; + this.updateTitle(); + } + }); + } + + get onDidChangeTitle(): Event { + return this.onDidChangeTitleEmitter.event; + } + + get title(): string { + return this._title; + } + + update(parts: Record): void { + for (const [key, value] of Object.entries(parts)) { + this.titleParts.set(key, value); + } + this.updateTitle(); + } + + protected updateTitle(): void { + if (!this.titleTemplate) { + this._title = ''; + } else { + let title = this.titleTemplate; + for (const [key, value] of this.titleParts.entries()) { + if (key !== 'developmentHost') { + const label = `$\{${key}\}`; + const regex = new RegExp(escapeRegExpCharacters(label), 'g'); + title = title.replace(regex, value ?? ''); + } + } + const separatedTitle = title.split('${separator}').filter(e => e.trim().length > 0); + this._title = separatedTitle.join(this.separator); + const contributions = this.titleContributions.getContributions(); + for (const contribution of contributions) { + this._title = contribution.enhanceTitle(this.title, this.titleParts); + } + } + const developmentHost = this.titleParts.get('developmentHost'); + if (developmentHost) { + this._title = developmentHost + this.separator + this._title; + } + document.title = this._title || FrontendApplicationConfigProvider.get().applicationName; + this.onDidChangeTitleEmitter.fire(this._title); + } + +} diff --git a/packages/core/src/browser/window/window-title-updater.ts b/packages/core/src/browser/window/window-title-updater.ts new file mode 100644 index 0000000..65d1725 --- /dev/null +++ b/packages/core/src/browser/window/window-title-updater.ts @@ -0,0 +1,95 @@ +// ***************************************************************************** +// Copyright (C) 2022 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { Widget } from '../widgets'; +import { FrontendApplication } from '../frontend-application'; +import { FrontendApplicationContribution } from '../frontend-application-contribution'; +import { NavigatableWidget } from '../navigatable-types'; +import { inject, injectable } from 'inversify'; +import { WindowTitleService } from './window-title-service'; +import { LabelProvider } from '../label-provider'; +import { Saveable } from '../saveable'; +import { Disposable } from '../../common'; + +@injectable() +export class WindowTitleUpdater implements FrontendApplicationContribution { + + @inject(WindowTitleService) + protected readonly windowTitleService: WindowTitleService; + + @inject(LabelProvider) + protected readonly labelProvider: LabelProvider; + + onStart(app: FrontendApplication): void { + app.shell.mainPanel.onDidChangeCurrent(title => this.handleWidgetChange(title?.owner)); + this.handleWidgetChange(app.shell.getCurrentWidget('main')); + } + + protected toDisposeOnWidgetChanged: Disposable = Disposable.NULL; + protected handleWidgetChange(widget?: Widget): void { + this.toDisposeOnWidgetChanged.dispose(); + const saveable = Saveable.get(widget); + if (saveable) { + this.toDisposeOnWidgetChanged = saveable.onDirtyChanged(() => this.windowTitleService.update({ dirty: saveable.dirty ? '●' : '' })); + } else { + this.toDisposeOnWidgetChanged = Disposable.NULL; + } + this.updateTitleWidget(widget); + } + + /** + * Updates the title of the application based on the currently opened widget. + * + * @param widget The current widget in the `main` application area. `undefined` if no widget is currently open in that area. + */ + protected updateTitleWidget(widget?: Widget): void { + let activeEditorLong: string | undefined; + let activeEditorMedium: string | undefined; + let activeEditorShort: string | undefined; + let activeFolderLong: string | undefined; + let activeFolderMedium: string | undefined; + let activeFolderShort: string | undefined; + let dirty: string | undefined; + const uri = NavigatableWidget.getUri(widget); + if (uri) { + activeEditorLong = uri.path.fsPath(); + activeEditorMedium = this.labelProvider.getLongName(uri); + activeEditorShort = this.labelProvider.getName(uri); + const parent = uri.parent; + activeFolderLong = parent.path.fsPath(); + activeFolderMedium = this.labelProvider.getLongName(parent); + activeFolderShort = this.labelProvider.getName(parent); + } else if (widget) { + const widgetTitle = widget.title.label; + activeEditorLong = widgetTitle; + activeEditorMedium = widgetTitle; + activeEditorShort = widgetTitle; + } + if (Saveable.isDirty(widget)) { + dirty = '●'; + } + this.windowTitleService.update({ + activeEditorLong, + activeEditorMedium, + activeEditorShort, + activeFolderLong, + activeFolderMedium, + activeFolderShort, + dirty + }); + } + +} diff --git a/packages/core/src/common/accessibility.ts b/packages/core/src/common/accessibility.ts new file mode 100644 index 0000000..a630f92 --- /dev/null +++ b/packages/core/src/common/accessibility.ts @@ -0,0 +1,33 @@ +// ***************************************************************************** +// Copyright (C) 2022 STMicroelectronics and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +/** + * Accessibility information which controls screen reader behavior. + */ +export interface AccessibilityInformation { + /** + * Label to be read out by a screen reader once the item has focus. + */ + readonly label: string; + + /** + * Role of the widget which defines how a screen reader interacts with it. + * The role should be set in special cases when for example a tree-like element behaves like a checkbox. + * If role is not specified the editor will pick the appropriate role automatically. + * More about aria roles can be found here https://w3c.github.io/aria/#widget_roles + */ + readonly role?: string; +} diff --git a/packages/core/src/common/application-error.spec.ts b/packages/core/src/common/application-error.spec.ts new file mode 100644 index 0000000..ff54968 --- /dev/null +++ b/packages/core/src/common/application-error.spec.ts @@ -0,0 +1,27 @@ +// ***************************************************************************** +// Copyright (C) 2022 Ericsson and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { ApplicationError } from './application-error'; +import { expect } from 'chai'; + +describe('ApplicationError', () => { + + it('should not be able to use the same code twice', () => { + const code = 12345; + ApplicationError.declare(code, (message, data) => ({ message, data })); + expect(() => ApplicationError.declare(code, (message, data) => ({ message, data }))).throw(); + }); +}); diff --git a/packages/core/src/common/application-error.ts b/packages/core/src/common/application-error.ts new file mode 100644 index 0000000..667da2e --- /dev/null +++ b/packages/core/src/common/application-error.ts @@ -0,0 +1,76 @@ +// ***************************************************************************** +// Copyright (C) 2018 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +/* eslint-disable @typescript-eslint/no-explicit-any */ + +export interface ApplicationError extends Error { + readonly code: C + readonly data: D + toJson(): ApplicationError.Literal +} +export namespace ApplicationError { + export interface Literal { + message: string + data: D + stack?: string + } + export interface Constructor { + (...args: any[]): ApplicationError; + code: C; + is(arg: object | undefined): arg is ApplicationError + } + const codes = new Set(); + export function declare(code: C, factory: (...args: any[]) => Literal): Constructor { + if (codes.has(code)) { + throw new Error(`An application error for '${code}' code is already declared`); + } + codes.add(code); + const constructorOpt = Object.assign((...args: any[]) => new Impl(code, factory(...args), constructorOpt), { + code, + is(arg: object | undefined): arg is ApplicationError { + return arg instanceof Impl && arg.code === code; + } + }); + return constructorOpt; + } + export function is(arg: object | undefined): arg is ApplicationError { + return arg instanceof Impl; + } + export function fromJson(code: C, raw: Literal): ApplicationError { + return new Impl(code, raw); + } + class Impl extends Error implements ApplicationError { + readonly data: D; + constructor( + readonly code: C, + raw: ApplicationError.Literal, + constructorOpt?: Function + ) { + super(raw.message); + this.data = raw.data; + Object.setPrototypeOf(this, Impl.prototype); + if (raw.stack) { + this.stack = raw.stack; + } else if (Error.captureStackTrace && constructorOpt) { + Error.captureStackTrace(this, constructorOpt); + } + } + toJson(): ApplicationError.Literal { + const { message, data, stack } = this; + return { message, data, stack }; + } + } +} diff --git a/packages/core/src/common/application-protocol.ts b/packages/core/src/common/application-protocol.ts new file mode 100644 index 0000000..a96361a --- /dev/null +++ b/packages/core/src/common/application-protocol.ts @@ -0,0 +1,42 @@ +// ***************************************************************************** +// Copyright (C) 2018 Ericsson and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { OS } from './os'; + +export const applicationPath = '/services/application'; + +export const ApplicationServer = Symbol('ApplicationServer'); + +export interface ApplicationServer { + getExtensionsInfos(): Promise; + getApplicationInfo(): Promise; + getApplicationRoot(): Promise; + getApplicationPlatform(): Promise; + /** + * @deprecated since 1.25.0. Use `OS.backend.type()` instead. + */ + getBackendOS(): Promise; +} + +export interface ExtensionInfo { + name: string; + version: string; +} + +export interface ApplicationInfo { + name: string; + version: string; +} diff --git a/packages/core/src/common/array-utils.ts b/packages/core/src/common/array-utils.ts new file mode 100644 index 0000000..3740be7 --- /dev/null +++ b/packages/core/src/common/array-utils.ts @@ -0,0 +1,207 @@ +// ***************************************************************************** +// Copyright (C) 2023 Ericsson and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +export namespace ArrayUtils { + export interface Head extends Array { + head(): T; + } + + export interface Tail extends Array { + tail(): T; + } + + export interface Children extends Array { + children(): Tail + } + + export const TailImpl = { + tail(this: Array): T { + return this[this.length - 1]; + }, + }; + + export const HeadAndChildrenImpl = { + head(this: Array): T { + return this[0]; + }, + + children(this: Array): Tail { + return Object.assign(this.slice(1), TailImpl); + } + }; + + export interface HeadAndTail extends Head, Tail, Children { } + + export function asTail(array: Array): Tail { + return Object.assign(array, TailImpl); + } + + export function asHeadAndTail(array: Array): HeadAndTail { + return Object.assign(array, HeadAndChildrenImpl, TailImpl); + } + + export enum Sort { + LeftBeforeRight = -1, + RightBeforeLeft = 1, + Equal = 0, + } + + // Copied from https://github.com/microsoft/vscode/blob/9c29becfad5f68270b9b23efeafb147722c5feba/src/vs/base/common/arrays.ts + /** + * Performs a binary search algorithm over a sorted collection. Useful for cases + * when we need to perform a binary search over something that isn't actually an + * array, and converting data to an array would defeat the use of binary search + * in the first place. + * + * @param length The collection length. + * @param compareToKey A function that takes an index of an element in the + * collection and returns zero if the value at this index is equal to the + * search key, a negative number if the value precedes the search key in the + * sorting order, or a positive number if the search key precedes the value. + * @return A non-negative index of an element, if found. If not found, the + * result is -(n+1) (or ~n, using bitwise notation), where n is the index + * where the key should be inserted to maintain the sorting order. + */ + export function binarySearch2(length: number, compareToKey: (index: number) => number): number { + let low = 0; + let high = length - 1; + + while (low <= high) { + const mid = ((low + high) / 2) | 0; + const comp = compareToKey(mid); + if (comp < 0) { + low = mid + 1; + } else if (comp > 0) { + high = mid - 1; + } else { + return mid; + } + } + return -(low + 1); + } + + export function partition(array: T[], filter: (e: T, idx: number, arr: T[]) => boolean | undefined): [T[], T[]] { + const pass: T[] = []; + const fail: T[] = []; + array.forEach((e, idx, arr) => (filter(e, idx, arr) ? pass : fail).push(e)); + return [pass, fail]; + } + + /** + * @returns New array with all falsy values removed. The original array IS NOT modified. + */ + export function coalesce(array: ReadonlyArray): T[] { + return array.filter(e => !!e); + } + + /** + * groups array elements through a comparator function + * @param data array of elements to group + * @param compare comparator function: return of 0 means should group, anything above means not group + * @returns array of arrays with grouped elements + */ + export function groupBy(data: ReadonlyArray, compare: (a: T, b: T) => number): T[][] { + const result: T[][] = []; + let currentGroup: T[] | undefined = undefined; + for (const element of data.slice(0).sort(compare)) { + if (!currentGroup || compare(currentGroup[0], element) !== 0) { + currentGroup = [element]; + result.push(currentGroup); + } else { + currentGroup.push(element); + } + } + return result; + } + + export function shallowEqual(left: readonly T[], right: readonly T[]): boolean { + if (left.length !== right.length) { + return false; + } + for (let i = 0; i < left.length; i++) { + if (left[i] !== right[i]) { + return false; + } + } + return true; + } + + export function startsWith(left: readonly T[], right: readonly T[]): boolean { + if (right.length > left.length) { + return false; + } + + for (let i = 0; i < right.length; i++) { + if (left[i] !== right[i]) { + return false; + } + } + return true; + } + + export function equals(one: ReadonlyArray | undefined, other: ReadonlyArray | undefined, itemEquals: (a: T, b: T) => boolean = (a, b) => a === b): boolean { + if (one === other) { + return true; + } + + if (!one || !other) { + return false; + } + + if (one.length !== other.length) { + return false; + } + + for (let i = 0, len = one.length; i < len; i++) { + if (!itemEquals(one[i], other[i])) { + return false; + } + } + + return true; + } + + export function findLast(array: readonly T[], predicate: (item: T) => boolean): T | undefined { + const idx = findLastIdx(array, predicate); + if (idx === -1) { + return undefined; + } + return array[idx]; + } + + export function findLastIdx(array: readonly T[], predicate: (item: T) => boolean, fromIndex = array.length - 1): number { + for (let i = fromIndex; i >= 0; i--) { + const element = array[i]; + + if (predicate(element)) { + return i; + } + } + + return -1; + } + + export function checkAdjacentItems(items: readonly T[], predicate: (item1: T, item2: T) => boolean): boolean { + for (let i = 0; i < items.length - 1; i++) { + const a = items[i]; + const b = items[i + 1]; + if (!predicate(a, b)) { + return false; + } + } + return true; + } +} diff --git a/packages/core/src/common/buffer.ts b/packages/core/src/common/buffer.ts new file mode 100644 index 0000000..3e0ba7b --- /dev/null +++ b/packages/core/src/common/buffer.ts @@ -0,0 +1,228 @@ +// ***************************************************************************** +// Copyright (C) 2020 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +// based on https://github.com/microsoft/vscode/blob/04c36be045a94fee58e5f8992d3e3fd980294a84/src/vs/base/common/buffer.ts + +/* eslint-disable no-null/no-null */ + +import { Buffer as SaferBuffer } from 'safer-buffer'; +import * as iconv from 'iconv-lite'; +import * as streams from './stream'; + +const hasBuffer = (typeof Buffer !== 'undefined'); +const hasTextEncoder = (typeof TextEncoder !== 'undefined'); +const hasTextDecoder = (typeof TextDecoder !== 'undefined'); + +let textEncoder: TextEncoder | null; +let textDecoder: TextDecoder | null; + +export class BinaryBuffer { + + static alloc(byteLength: number): BinaryBuffer { + if (hasBuffer) { + return new BinaryBuffer(Buffer.allocUnsafe(byteLength)); + } else { + return new BinaryBuffer(new Uint8Array(byteLength)); + } + } + + static wrap(actual: Uint8Array): BinaryBuffer { + if (hasBuffer && !(Buffer.isBuffer(actual))) { + // https://nodejs.org/dist/latest-v10.x/docs/api/buffer.html#buffer_class_method_buffer_from_arraybuffer_byteoffset_length + // Create a zero-copy Buffer wrapper around the ArrayBuffer pointed to by the Uint8Array + actual = Buffer.from(actual.buffer, actual.byteOffset, actual.byteLength); + } + return new BinaryBuffer(actual); + } + + static fromString(source: string): BinaryBuffer { + if (hasBuffer) { + return new BinaryBuffer(Buffer.from(source)); + } else if (hasTextEncoder) { + if (!textEncoder) { + textEncoder = new TextEncoder(); + } + return new BinaryBuffer(textEncoder.encode(source)); + } else { + return new BinaryBuffer(iconv.encode(source, 'utf8')); + } + } + + static concat(buffers: BinaryBuffer[], totalLength?: number): BinaryBuffer { + if (typeof totalLength === 'undefined') { + totalLength = 0; + for (let i = 0, len = buffers.length; i < len; i++) { + totalLength += buffers[i].byteLength; + } + } + + const ret = BinaryBuffer.alloc(totalLength); + let offset = 0; + for (let i = 0, len = buffers.length; i < len; i++) { + const element = buffers[i]; + ret.set(element, offset); + offset += element.byteLength; + } + + return ret; + } + + readonly buffer: Uint8Array; + readonly byteLength: number; + + private constructor(buffer: Uint8Array) { + this.buffer = buffer; + this.byteLength = this.buffer.byteLength; + } + + toString(): string { + if (hasBuffer) { + return this.buffer.toString(); + } else if (hasTextDecoder) { + if (!textDecoder) { + textDecoder = new TextDecoder(); + } + return textDecoder.decode(this.buffer); + } else { + return iconv.decode(SaferBuffer.from(this.buffer), 'utf8'); + } + } + + slice(start?: number, end?: number): BinaryBuffer { + // IMPORTANT: use subarray instead of slice because TypedArray#slice + // creates shallow copy and NodeBuffer#slice doesn't. The use of subarray + // ensures the same, performant, behaviour. + return new BinaryBuffer(this.buffer.subarray(start, end)); + } + + set(array: BinaryBuffer, offset?: number): void; + set(array: Uint8Array, offset?: number): void; + set(array: BinaryBuffer | Uint8Array, offset?: number): void { + if (array instanceof BinaryBuffer) { + this.buffer.set(array.buffer, offset); + } else { + this.buffer.set(array, offset); + } + } + + readUInt32BE(offset: number): number { + return ( + this.buffer[offset] * 2 ** 24 + + this.buffer[offset + 1] * 2 ** 16 + + this.buffer[offset + 2] * 2 ** 8 + + this.buffer[offset + 3] + ); + } + + writeUInt32BE(value: number, offset: number): void { + this.buffer[offset + 3] = value; + value = value >>> 8; + this.buffer[offset + 2] = value; + value = value >>> 8; + this.buffer[offset + 1] = value; + value = value >>> 8; + this.buffer[offset] = value; + } + + readUInt32LE(offset: number): number { + return ( + ((this.buffer[offset + 0] << 0) >>> 0) | + ((this.buffer[offset + 1] << 8) >>> 0) | + ((this.buffer[offset + 2] << 16) >>> 0) | + ((this.buffer[offset + 3] << 24) >>> 0) + ); + } + + writeUInt32LE(value: number, offset: number): void { + this.buffer[offset + 0] = (value & 0b11111111); + value = value >>> 8; + this.buffer[offset + 1] = (value & 0b11111111); + value = value >>> 8; + this.buffer[offset + 2] = (value & 0b11111111); + value = value >>> 8; + this.buffer[offset + 3] = (value & 0b11111111); + } + + readUInt8(offset: number): number { + return this.buffer[offset]; + } + + writeUInt8(value: number, offset: number): void { + this.buffer[offset] = value; + } + +} + +export interface BinaryBufferReadable extends streams.Readable { } +export namespace BinaryBufferReadable { + export function toBuffer(readable: BinaryBufferReadable): BinaryBuffer { + return streams.consumeReadable(readable, chunks => BinaryBuffer.concat(chunks)); + } + export function fromBuffer(buffer: BinaryBuffer): BinaryBufferReadable { + return streams.toReadable(buffer); + } + export function fromReadable(readable: streams.Readable): BinaryBufferReadable { + return { + read(): BinaryBuffer | null { + const value = readable.read(); + + if (typeof value === 'string') { + return BinaryBuffer.fromString(value); + } + + return null; + } + }; + } +} + +export interface BinaryBufferReadableStream extends streams.ReadableStream { } +export namespace BinaryBufferReadableStream { + export function toBuffer(stream: BinaryBufferReadableStream): Promise { + return streams.consumeStream(stream, chunks => BinaryBuffer.concat(chunks)); + } + export function fromBuffer(buffer: BinaryBuffer): BinaryBufferReadableStream { + return streams.toStream(buffer, chunks => BinaryBuffer.concat(chunks)); + } +} + +export interface BinaryBufferReadableBufferedStream extends streams.ReadableBufferedStream { } +export namespace BinaryBufferReadableBufferedStream { + export async function toBuffer(bufferedStream: streams.ReadableBufferedStream): Promise { + if (bufferedStream.ended) { + return BinaryBuffer.concat(bufferedStream.buffer); + } + + return BinaryBuffer.concat([ + + // Include already read chunks... + ...bufferedStream.buffer, + + // ...and all additional chunks + await BinaryBufferReadableStream.toBuffer(bufferedStream.stream) + ]); + } +} + +export interface BinaryBufferWriteableStream extends streams.WriteableStream { } +export namespace BinaryBufferWriteableStream { + export function create(options?: streams.WriteableStreamOptions): BinaryBufferWriteableStream { + return streams.newWriteableStream(chunks => BinaryBuffer.concat(chunks), options); + } +} diff --git a/packages/core/src/common/cancellation.ts b/packages/core/src/common/cancellation.ts new file mode 100644 index 0000000..e701fe8 --- /dev/null +++ b/packages/core/src/common/cancellation.ts @@ -0,0 +1,163 @@ +// ***************************************************************************** +// Copyright (C) 2017 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation and others. All rights reserved. + * Licensed under the MIT License. See https://github.com/Microsoft/vscode/blob/master/LICENSE.txt for license information. + *--------------------------------------------------------------------------------------------*/ + +import { Event, Emitter } from './event'; +import { isBoolean, isObject } from './types'; +import { Disposable } from './disposable'; + +export interface CancellationToken { + readonly isCancellationRequested: boolean; + /* + * An event emitted when cancellation is requested + * @event + */ + readonly onCancellationRequested: Event; +} + +// eslint-disable-next-line @typescript-eslint/no-explicit-any +const shortcutEvent: Event = Object.freeze(Object.assign(function (callback: any, context?: any): any { + const handle = setTimeout(callback.bind(context), 0); + return { dispose(): void { clearTimeout(handle); } }; +}, { + get maxListeners(): number { return 0; }, + set maxListeners(maxListeners: number) { } +})); + +export namespace CancellationToken { + + export const None: CancellationToken = Object.freeze({ + isCancellationRequested: false, + onCancellationRequested: Event.None + }); + + export const Cancelled: CancellationToken = Object.freeze({ + isCancellationRequested: true, + onCancellationRequested: shortcutEvent + }); + + export function is(value: unknown): value is CancellationToken { + return isObject(value) && (value === CancellationToken.None + || value === CancellationToken.Cancelled + || (isBoolean(value.isCancellationRequested) && !!value.onCancellationRequested)); + } +} + +export class CancellationError extends Error { + constructor() { + super('Canceled'); + this.name = this.message; + } +} + +class MutableToken implements CancellationToken { + + private _isCancelled: boolean = false; + private _emitter: Emitter | undefined; + + public cancel(): void { + if (!this._isCancelled) { + this._isCancelled = true; + if (this._emitter) { + this._emitter.fire(undefined); + this._emitter = undefined; + } + } + } + + get isCancellationRequested(): boolean { + return this._isCancelled; + } + + get onCancellationRequested(): Event { + if (this._isCancelled) { + return shortcutEvent; + } + if (!this._emitter) { + this._emitter = new Emitter(); + } + return this._emitter.event; + } + + public dispose(): void { + if (this._emitter) { + this._emitter.dispose(); + this._emitter = undefined; + } + } +} + +export class CancellationTokenSource { + + private _token: CancellationToken; + private _parentListener?: Disposable = undefined; + + constructor(parent?: CancellationToken) { + this._parentListener = parent && parent.onCancellationRequested(this.cancel, this); + } + + get token(): CancellationToken { + if (!this._token) { + // be lazy and create the token only when + // actually needed + this._token = new MutableToken(); + } + return this._token; + } + + cancel(): void { + if (!this._token) { + // save an object by returning the default + // cancelled token when cancellation happens + // before someone asks for the token + this._token = CancellationToken.Cancelled; + } else if (this._token !== CancellationToken.Cancelled) { + (this._token).cancel(); + } + } + + dispose(): void { + this.cancel(); + this._parentListener?.dispose(); + if (!this._token) { + // ensure to initialize with an empty token if we had none + this._token = CancellationToken.None; + + } else if (this._token instanceof MutableToken) { + // actually dispose + this._token.dispose(); + } + } +} + +const cancelledMessage = 'Cancelled'; + +export function cancelled(): Error { + return new Error(cancelledMessage); +} + +export function isCancelled(err: Error | undefined): boolean { + return !!err && err.message === cancelledMessage; +} + +export function checkCancelled(token?: CancellationToken): void { + if (!!token && token.isCancellationRequested) { + throw cancelled(); + } +} diff --git a/packages/core/src/common/char-code.ts b/packages/core/src/common/char-code.ts new file mode 100644 index 0000000..2715128 --- /dev/null +++ b/packages/core/src/common/char-code.ts @@ -0,0 +1,438 @@ +// ***************************************************************************** +// Copyright (C) 2018 Red Hat, Inc. and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +// copied from https://github.com/Microsoft/vscode/blob/bf7ac9201e7a7d01741d4e6e64b5dc9f3197d97b/src/vs/base/common/charCode.ts +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +'use strict'; + +// Names from https://blog.codinghorror.com/ascii-pronunciation-rules-for-programmers/ + +/** + * An inlined enum containing useful character codes (to be used with String.charCodeAt). + * Please leave the const keyword such that it gets inlined when compiled to JavaScript! + */ +export const enum CharCode { + Null = 0, + /** + * The `\t` character. + */ + Tab = 9, + /** + * The `\n` character. + */ + LineFeed = 10, + /** + * The `\r` character. + */ + CarriageReturn = 13, + Space = 32, + /** + * The `!` character. + */ + ExclamationMark = 33, + /** + * The `"` character. + */ + DoubleQuote = 34, + /** + * The `#` character. + */ + Hash = 35, + /** + * The `$` character. + */ + DollarSign = 36, + /** + * The `%` character. + */ + PercentSign = 37, + /** + * The `&` character. + */ + Ampersand = 38, + /** + * The `'` character. + */ + SingleQuote = 39, + /** + * The `(` character. + */ + OpenParen = 40, + /** + * The `)` character. + */ + CloseParen = 41, + /** + * The `*` character. + */ + Asterisk = 42, + /** + * The `+` character. + */ + Plus = 43, + /** + * The `,` character. + */ + Comma = 44, + /** + * The `-` character. + */ + Dash = 45, + /** + * The `.` character. + */ + Period = 46, + /** + * The `/` character. + */ + Slash = 47, + + Digit0 = 48, + Digit1 = 49, + Digit2 = 50, + Digit3 = 51, + Digit4 = 52, + Digit5 = 53, + Digit6 = 54, + Digit7 = 55, + Digit8 = 56, + Digit9 = 57, + + /** + * The `:` character. + */ + Colon = 58, + /** + * The `;` character. + */ + Semicolon = 59, + /** + * The `<` character. + */ + LessThan = 60, + /** + * The `=` character. + */ + Equals = 61, + /** + * The `>` character. + */ + GreaterThan = 62, + /** + * The `?` character. + */ + QuestionMark = 63, + /** + * The `@` character. + */ + AtSign = 64, + + A = 65, + B = 66, + C = 67, + D = 68, + E = 69, + F = 70, + G = 71, + H = 72, + I = 73, + J = 74, + K = 75, + L = 76, + M = 77, + N = 78, + O = 79, + P = 80, + Q = 81, + R = 82, + S = 83, + T = 84, + U = 85, + V = 86, + W = 87, + X = 88, + Y = 89, + Z = 90, + + /** + * The `[` character. + */ + OpenSquareBracket = 91, + /** + * The `\` character. + */ + Backslash = 92, + /** + * The `]` character. + */ + CloseSquareBracket = 93, + /** + * The `^` character. + */ + Caret = 94, + /** + * The `_` character. + */ + Underline = 95, + /** + * The ``(`)`` character. + */ + BackTick = 96, + + a = 97, + b = 98, + c = 99, + d = 100, + e = 101, + f = 102, + g = 103, + h = 104, + i = 105, + j = 106, + k = 107, + l = 108, + m = 109, + n = 110, + o = 111, + p = 112, + q = 113, + r = 114, + s = 115, + t = 116, + u = 117, + v = 118, + w = 119, + x = 120, + y = 121, + z = 122, + + /** + * The `{` character. + */ + OpenCurlyBrace = 123, + /** + * The `|` character. + */ + Pipe = 124, + /** + * The `}` character. + */ + CloseCurlyBrace = 125, + /** + * The `~` character. + */ + Tilde = 126, + + U_Combining_Grave_Accent = 0x0300, // U+0300 Combining Grave Accent + U_Combining_Acute_Accent = 0x0301, // U+0301 Combining Acute Accent + U_Combining_Circumflex_Accent = 0x0302, // U+0302 Combining Circumflex Accent + U_Combining_Tilde = 0x0303, // U+0303 Combining Tilde + U_Combining_Macron = 0x0304, // U+0304 Combining Macron + U_Combining_Overline = 0x0305, // U+0305 Combining Overline + U_Combining_Breve = 0x0306, // U+0306 Combining Breve + U_Combining_Dot_Above = 0x0307, // U+0307 Combining Dot Above + U_Combining_Diaeresis = 0x0308, // U+0308 Combining Diaeresis + U_Combining_Hook_Above = 0x0309, // U+0309 Combining Hook Above + U_Combining_Ring_Above = 0x030A, // U+030A Combining Ring Above + U_Combining_Double_Acute_Accent = 0x030B, // U+030B Combining Double Acute Accent + U_Combining_Caron = 0x030C, // U+030C Combining Caron + U_Combining_Vertical_Line_Above = 0x030D, // U+030D Combining Vertical Line Above + U_Combining_Double_Vertical_Line_Above = 0x030E, // U+030E Combining Double Vertical Line Above + U_Combining_Double_Grave_Accent = 0x030F, // U+030F Combining Double Grave Accent + U_Combining_Candrabindu = 0x0310, // U+0310 Combining Candrabindu + U_Combining_Inverted_Breve = 0x0311, // U+0311 Combining Inverted Breve + U_Combining_Turned_Comma_Above = 0x0312, // U+0312 Combining Turned Comma Above + U_Combining_Comma_Above = 0x0313, // U+0313 Combining Comma Above + U_Combining_Reversed_Comma_Above = 0x0314, // U+0314 Combining Reversed Comma Above + U_Combining_Comma_Above_Right = 0x0315, // U+0315 Combining Comma Above Right + U_Combining_Grave_Accent_Below = 0x0316, // U+0316 Combining Grave Accent Below + U_Combining_Acute_Accent_Below = 0x0317, // U+0317 Combining Acute Accent Below + U_Combining_Left_Tack_Below = 0x0318, // U+0318 Combining Left Tack Below + U_Combining_Right_Tack_Below = 0x0319, // U+0319 Combining Right Tack Below + U_Combining_Left_Angle_Above = 0x031A, // U+031A Combining Left Angle Above + U_Combining_Horn = 0x031B, // U+031B Combining Horn + U_Combining_Left_Half_Ring_Below = 0x031C, // U+031C Combining Left Half Ring Below + U_Combining_Up_Tack_Below = 0x031D, // U+031D Combining Up Tack Below + U_Combining_Down_Tack_Below = 0x031E, // U+031E Combining Down Tack Below + U_Combining_Plus_Sign_Below = 0x031F, // U+031F Combining Plus Sign Below + U_Combining_Minus_Sign_Below = 0x0320, // U+0320 Combining Minus Sign Below + U_Combining_Palatalized_Hook_Below = 0x0321, // U+0321 Combining Palatalized Hook Below + U_Combining_Retroflex_Hook_Below = 0x0322, // U+0322 Combining Retroflex Hook Below + U_Combining_Dot_Below = 0x0323, // U+0323 Combining Dot Below + U_Combining_Diaeresis_Below = 0x0324, // U+0324 Combining Diaeresis Below + U_Combining_Ring_Below = 0x0325, // U+0325 Combining Ring Below + U_Combining_Comma_Below = 0x0326, // U+0326 Combining Comma Below + U_Combining_Cedilla = 0x0327, // U+0327 Combining Cedilla + U_Combining_Ogonek = 0x0328, // U+0328 Combining Ogonek + U_Combining_Vertical_Line_Below = 0x0329, // U+0329 Combining Vertical Line Below + U_Combining_Bridge_Below = 0x032A, // U+032A Combining Bridge Below + U_Combining_Inverted_Double_Arch_Below = 0x032B, // U+032B Combining Inverted Double Arch Below + U_Combining_Caron_Below = 0x032C, // U+032C Combining Caron Below + U_Combining_Circumflex_Accent_Below = 0x032D, // U+032D Combining Circumflex Accent Below + U_Combining_Breve_Below = 0x032E, // U+032E Combining Breve Below + U_Combining_Inverted_Breve_Below = 0x032F, // U+032F Combining Inverted Breve Below + U_Combining_Tilde_Below = 0x0330, // U+0330 Combining Tilde Below + U_Combining_Macron_Below = 0x0331, // U+0331 Combining Macron Below + U_Combining_Low_Line = 0x0332, // U+0332 Combining Low Line + U_Combining_Double_Low_Line = 0x0333, // U+0333 Combining Double Low Line + U_Combining_Tilde_Overlay = 0x0334, // U+0334 Combining Tilde Overlay + U_Combining_Short_Stroke_Overlay = 0x0335, // U+0335 Combining Short Stroke Overlay + U_Combining_Long_Stroke_Overlay = 0x0336, // U+0336 Combining Long Stroke Overlay + U_Combining_Short_Solidus_Overlay = 0x0337, // U+0337 Combining Short Solidus Overlay + U_Combining_Long_Solidus_Overlay = 0x0338, // U+0338 Combining Long Solidus Overlay + U_Combining_Right_Half_Ring_Below = 0x0339, // U+0339 Combining Right Half Ring Below + U_Combining_Inverted_Bridge_Below = 0x033A, // U+033A Combining Inverted Bridge Below + U_Combining_Square_Below = 0x033B, // U+033B Combining Square Below + U_Combining_Seagull_Below = 0x033C, // U+033C Combining Seagull Below + U_Combining_X_Above = 0x033D, // U+033D Combining X Above + U_Combining_Vertical_Tilde = 0x033E, // U+033E Combining Vertical Tilde + U_Combining_Double_Overline = 0x033F, // U+033F Combining Double Overline + U_Combining_Grave_Tone_Mark = 0x0340, // U+0340 Combining Grave Tone Mark + U_Combining_Acute_Tone_Mark = 0x0341, // U+0341 Combining Acute Tone Mark + U_Combining_Greek_Perispomeni = 0x0342, // U+0342 Combining Greek Perispomeni + U_Combining_Greek_Koronis = 0x0343, // U+0343 Combining Greek Koronis + U_Combining_Greek_Dialytika_Tonos = 0x0344, // U+0344 Combining Greek Dialytika Tonos + U_Combining_Greek_Ypogegrammeni = 0x0345, // U+0345 Combining Greek Ypogegrammeni + U_Combining_Bridge_Above = 0x0346, // U+0346 Combining Bridge Above + U_Combining_Equals_Sign_Below = 0x0347, // U+0347 Combining Equals Sign Below + U_Combining_Double_Vertical_Line_Below = 0x0348, // U+0348 Combining Double Vertical Line Below + U_Combining_Left_Angle_Below = 0x0349, // U+0349 Combining Left Angle Below + U_Combining_Not_Tilde_Above = 0x034A, // U+034A Combining Not Tilde Above + U_Combining_Homothetic_Above = 0x034B, // U+034B Combining Homothetic Above + U_Combining_Almost_Equal_To_Above = 0x034C, // U+034C Combining Almost Equal To Above + U_Combining_Left_Right_Arrow_Below = 0x034D, // U+034D Combining Left Right Arrow Below + U_Combining_Upwards_Arrow_Below = 0x034E, // U+034E Combining Upwards Arrow Below + U_Combining_Grapheme_Joiner = 0x034F, // U+034F Combining Grapheme Joiner + U_Combining_Right_Arrowhead_Above = 0x0350, // U+0350 Combining Right Arrowhead Above + U_Combining_Left_Half_Ring_Above = 0x0351, // U+0351 Combining Left Half Ring Above + U_Combining_Fermata = 0x0352, // U+0352 Combining Fermata + U_Combining_X_Below = 0x0353, // U+0353 Combining X Below + U_Combining_Left_Arrowhead_Below = 0x0354, // U+0354 Combining Left Arrowhead Below + U_Combining_Right_Arrowhead_Below = 0x0355, // U+0355 Combining Right Arrowhead Below + U_Combining_Right_Arrowhead_And_Up_Arrowhead_Below = 0x0356, // U+0356 Combining Right Arrowhead And Up Arrowhead Below + U_Combining_Right_Half_Ring_Above = 0x0357, // U+0357 Combining Right Half Ring Above + U_Combining_Dot_Above_Right = 0x0358, // U+0358 Combining Dot Above Right + U_Combining_Asterisk_Below = 0x0359, // U+0359 Combining Asterisk Below + U_Combining_Double_Ring_Below = 0x035A, // U+035A Combining Double Ring Below + U_Combining_Zigzag_Above = 0x035B, // U+035B Combining Zigzag Above + U_Combining_Double_Breve_Below = 0x035C, // U+035C Combining Double Breve Below + U_Combining_Double_Breve = 0x035D, // U+035D Combining Double Breve + U_Combining_Double_Macron = 0x035E, // U+035E Combining Double Macron + U_Combining_Double_Macron_Below = 0x035F, // U+035F Combining Double Macron Below + U_Combining_Double_Tilde = 0x0360, // U+0360 Combining Double Tilde + U_Combining_Double_Inverted_Breve = 0x0361, // U+0361 Combining Double Inverted Breve + U_Combining_Double_Rightwards_Arrow_Below = 0x0362, // U+0362 Combining Double Rightwards Arrow Below + U_Combining_Latin_Small_Letter_A = 0x0363, // U+0363 Combining Latin Small Letter A + U_Combining_Latin_Small_Letter_E = 0x0364, // U+0364 Combining Latin Small Letter E + U_Combining_Latin_Small_Letter_I = 0x0365, // U+0365 Combining Latin Small Letter I + U_Combining_Latin_Small_Letter_O = 0x0366, // U+0366 Combining Latin Small Letter O + U_Combining_Latin_Small_Letter_U = 0x0367, // U+0367 Combining Latin Small Letter U + U_Combining_Latin_Small_Letter_C = 0x0368, // U+0368 Combining Latin Small Letter C + U_Combining_Latin_Small_Letter_D = 0x0369, // U+0369 Combining Latin Small Letter D + U_Combining_Latin_Small_Letter_H = 0x036A, // U+036A Combining Latin Small Letter H + U_Combining_Latin_Small_Letter_M = 0x036B, // U+036B Combining Latin Small Letter M + U_Combining_Latin_Small_Letter_R = 0x036C, // U+036C Combining Latin Small Letter R + U_Combining_Latin_Small_Letter_T = 0x036D, // U+036D Combining Latin Small Letter T + U_Combining_Latin_Small_Letter_V = 0x036E, // U+036E Combining Latin Small Letter V + U_Combining_Latin_Small_Letter_X = 0x036F, // U+036F Combining Latin Small Letter X + + /** + * Unicode Character 'LINE SEPARATOR' (U+2028) + * http://www.fileformat.info/info/unicode/char/2028/index.htm + */ + LINE_SEPARATOR_2028 = 8232, + + // http://www.fileformat.info/info/unicode/category/Sk/list.htm + U_CIRCUMFLEX = 0x005E, // U+005E CIRCUMFLEX + U_GRAVE_ACCENT = 0x0060, // U+0060 GRAVE ACCENT + U_DIAERESIS = 0x00A8, // U+00A8 DIAERESIS + U_MACRON = 0x00AF, // U+00AF MACRON + U_ACUTE_ACCENT = 0x00B4, // U+00B4 ACUTE ACCENT + U_CEDILLA = 0x00B8, // U+00B8 CEDILLA + U_MODIFIER_LETTER_LEFT_ARROWHEAD = 0x02C2, // U+02C2 MODIFIER LETTER LEFT ARROWHEAD + U_MODIFIER_LETTER_RIGHT_ARROWHEAD = 0x02C3, // U+02C3 MODIFIER LETTER RIGHT ARROWHEAD + U_MODIFIER_LETTER_UP_ARROWHEAD = 0x02C4, // U+02C4 MODIFIER LETTER UP ARROWHEAD + U_MODIFIER_LETTER_DOWN_ARROWHEAD = 0x02C5, // U+02C5 MODIFIER LETTER DOWN ARROWHEAD + U_MODIFIER_LETTER_CENTRED_RIGHT_HALF_RING = 0x02D2, // U+02D2 MODIFIER LETTER CENTRED RIGHT HALF RING + U_MODIFIER_LETTER_CENTRED_LEFT_HALF_RING = 0x02D3, // U+02D3 MODIFIER LETTER CENTRED LEFT HALF RING + U_MODIFIER_LETTER_UP_TACK = 0x02D4, // U+02D4 MODIFIER LETTER UP TACK + U_MODIFIER_LETTER_DOWN_TACK = 0x02D5, // U+02D5 MODIFIER LETTER DOWN TACK + U_MODIFIER_LETTER_PLUS_SIGN = 0x02D6, // U+02D6 MODIFIER LETTER PLUS SIGN + U_MODIFIER_LETTER_MINUS_SIGN = 0x02D7, // U+02D7 MODIFIER LETTER MINUS SIGN + U_BREVE = 0x02D8, // U+02D8 BREVE + U_DOT_ABOVE = 0x02D9, // U+02D9 DOT ABOVE + U_RING_ABOVE = 0x02DA, // U+02DA RING ABOVE + U_OGONEK = 0x02DB, // U+02DB OGONEK + U_SMALL_TILDE = 0x02DC, // U+02DC SMALL TILDE + U_DOUBLE_ACUTE_ACCENT = 0x02DD, // U+02DD DOUBLE ACUTE ACCENT + U_MODIFIER_LETTER_RHOTIC_HOOK = 0x02DE, // U+02DE MODIFIER LETTER RHOTIC HOOK + U_MODIFIER_LETTER_CROSS_ACCENT = 0x02DF, // U+02DF MODIFIER LETTER CROSS ACCENT + U_MODIFIER_LETTER_EXTRA_HIGH_TONE_BAR = 0x02E5, // U+02E5 MODIFIER LETTER EXTRA-HIGH TONE BAR + U_MODIFIER_LETTER_HIGH_TONE_BAR = 0x02E6, // U+02E6 MODIFIER LETTER HIGH TONE BAR + U_MODIFIER_LETTER_MID_TONE_BAR = 0x02E7, // U+02E7 MODIFIER LETTER MID TONE BAR + U_MODIFIER_LETTER_LOW_TONE_BAR = 0x02E8, // U+02E8 MODIFIER LETTER LOW TONE BAR + U_MODIFIER_LETTER_EXTRA_LOW_TONE_BAR = 0x02E9, // U+02E9 MODIFIER LETTER EXTRA-LOW TONE BAR + U_MODIFIER_LETTER_YIN_DEPARTING_TONE_MARK = 0x02EA, // U+02EA MODIFIER LETTER YIN DEPARTING TONE MARK + U_MODIFIER_LETTER_YANG_DEPARTING_TONE_MARK = 0x02EB, // U+02EB MODIFIER LETTER YANG DEPARTING TONE MARK + U_MODIFIER_LETTER_UNASPIRATED = 0x02ED, // U+02ED MODIFIER LETTER UNASPIRATED + U_MODIFIER_LETTER_LOW_DOWN_ARROWHEAD = 0x02EF, // U+02EF MODIFIER LETTER LOW DOWN ARROWHEAD + U_MODIFIER_LETTER_LOW_UP_ARROWHEAD = 0x02F0, // U+02F0 MODIFIER LETTER LOW UP ARROWHEAD + U_MODIFIER_LETTER_LOW_LEFT_ARROWHEAD = 0x02F1, // U+02F1 MODIFIER LETTER LOW LEFT ARROWHEAD + U_MODIFIER_LETTER_LOW_RIGHT_ARROWHEAD = 0x02F2, // U+02F2 MODIFIER LETTER LOW RIGHT ARROWHEAD + U_MODIFIER_LETTER_LOW_RING = 0x02F3, // U+02F3 MODIFIER LETTER LOW RING + U_MODIFIER_LETTER_MIDDLE_GRAVE_ACCENT = 0x02F4, // U+02F4 MODIFIER LETTER MIDDLE GRAVE ACCENT + U_MODIFIER_LETTER_MIDDLE_DOUBLE_GRAVE_ACCENT = 0x02F5, // U+02F5 MODIFIER LETTER MIDDLE DOUBLE GRAVE ACCENT + U_MODIFIER_LETTER_MIDDLE_DOUBLE_ACUTE_ACCENT = 0x02F6, // U+02F6 MODIFIER LETTER MIDDLE DOUBLE ACUTE ACCENT + U_MODIFIER_LETTER_LOW_TILDE = 0x02F7, // U+02F7 MODIFIER LETTER LOW TILDE + U_MODIFIER_LETTER_RAISED_COLON = 0x02F8, // U+02F8 MODIFIER LETTER RAISED COLON + U_MODIFIER_LETTER_BEGIN_HIGH_TONE = 0x02F9, // U+02F9 MODIFIER LETTER BEGIN HIGH TONE + U_MODIFIER_LETTER_END_HIGH_TONE = 0x02FA, // U+02FA MODIFIER LETTER END HIGH TONE + U_MODIFIER_LETTER_BEGIN_LOW_TONE = 0x02FB, // U+02FB MODIFIER LETTER BEGIN LOW TONE + U_MODIFIER_LETTER_END_LOW_TONE = 0x02FC, // U+02FC MODIFIER LETTER END LOW TONE + U_MODIFIER_LETTER_SHELF = 0x02FD, // U+02FD MODIFIER LETTER SHELF + U_MODIFIER_LETTER_OPEN_SHELF = 0x02FE, // U+02FE MODIFIER LETTER OPEN SHELF + U_MODIFIER_LETTER_LOW_LEFT_ARROW = 0x02FF, // U+02FF MODIFIER LETTER LOW LEFT ARROW + U_GREEK_LOWER_NUMERAL_SIGN = 0x0375, // U+0375 GREEK LOWER NUMERAL SIGN + U_GREEK_TONOS = 0x0384, // U+0384 GREEK TONOS + U_GREEK_DIALYTIKA_TONOS = 0x0385, // U+0385 GREEK DIALYTIKA TONOS + U_GREEK_KORONIS = 0x1FBD, // U+1FBD GREEK KORONIS + U_GREEK_PSILI = 0x1FBF, // U+1FBF GREEK PSILI + U_GREEK_PERISPOMENI = 0x1FC0, // U+1FC0 GREEK PERISPOMENI + U_GREEK_DIALYTIKA_AND_PERISPOMENI = 0x1FC1, // U+1FC1 GREEK DIALYTIKA AND PERISPOMENI + U_GREEK_PSILI_AND_VARIA = 0x1FCD, // U+1FCD GREEK PSILI AND VARIA + U_GREEK_PSILI_AND_OXIA = 0x1FCE, // U+1FCE GREEK PSILI AND OXIA + U_GREEK_PSILI_AND_PERISPOMENI = 0x1FCF, // U+1FCF GREEK PSILI AND PERISPOMENI + U_GREEK_DASIA_AND_VARIA = 0x1FDD, // U+1FDD GREEK DASIA AND VARIA + U_GREEK_DASIA_AND_OXIA = 0x1FDE, // U+1FDE GREEK DASIA AND OXIA + U_GREEK_DASIA_AND_PERISPOMENI = 0x1FDF, // U+1FDF GREEK DASIA AND PERISPOMENI + U_GREEK_DIALYTIKA_AND_VARIA = 0x1FED, // U+1FED GREEK DIALYTIKA AND VARIA + U_GREEK_DIALYTIKA_AND_OXIA = 0x1FEE, // U+1FEE GREEK DIALYTIKA AND OXIA + U_GREEK_VARIA = 0x1FEF, // U+1FEF GREEK VARIA + U_GREEK_OXIA = 0x1FFD, // U+1FFD GREEK OXIA + U_GREEK_DASIA = 0x1FFE, // U+1FFE GREEK DASIA + + U_OVERLINE = 0x203E, // Unicode Character 'OVERLINE' + + /** + * UTF-8 BOM + * Unicode Character 'ZERO WIDTH NO-BREAK SPACE' (U+FEFF) + * http://www.fileformat.info/info/unicode/char/feff/index.htm + */ + UTF8_BOM = 65279 +} diff --git a/packages/core/src/common/collections.ts b/packages/core/src/common/collections.ts new file mode 100644 index 0000000..0ced117 --- /dev/null +++ b/packages/core/src/common/collections.ts @@ -0,0 +1,125 @@ +// ***************************************************************************** +// Copyright (C) 2023 STMicroelectronics and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +/** + * A convenience class for managing a "map of maps" of arbitrary depth + */ +export class MultiKeyMap { + private rootMap = new Map(); + + constructor(private readonly keyLength: number) { + } + + static create(keyLength: number, data: [S[], T][]): MultiKeyMap { + const result = new MultiKeyMap(keyLength); + for (const entry of data) { + result.set(entry[0], entry[1]); + } + return result; + } + + set(key: readonly K[], value: V): V | undefined { + if (this.keyLength !== key.length) { + throw new Error(`inappropriate key length: ${key.length}, should be ${this.keyLength}`); + } + let map = this.rootMap; + for (let i = 0; i < this.keyLength - 1; i++) { + let existing = map.get(key[i]); + if (!existing) { + existing = new Map(); + map.set(key[i], existing); + } + map = existing; + } + const oldValue = map.get(key[this.keyLength - 1]); + map.set(key[this.keyLength - 1], value); + return oldValue; + } + + get(key: readonly K[]): V | undefined { + if (this.keyLength !== key.length) { + throw new Error(`inappropriate key length: ${key.length}, should be ${this.keyLength}`); + } + let map = this.rootMap; + for (let i = 0; i < this.keyLength - 1; i++) { + map = map.get(key[i]); + if (!map) { + return undefined; + } + } + return map.get(key[this.keyLength - 1]); + } + + /** + * Checks whether the given key is present in the map + * @param key the key to test. It can have a length < the key length + * @returns whether the key exists + */ + has(key: readonly K[]): boolean { + if (this.keyLength < key.length) { + throw new Error(`inappropriate key length: ${key.length}, should <= ${this.keyLength}`); + } + let map = this.rootMap; + for (let i = 0; i < key.length - 1; i++) { + map = map.get(key[i]); + if (!map) { + return false; + } + } + return map.has(key[key.length - 1]); + } + + /** + * Deletes the value with the given key from the map + * @param key the key to remove. It can have a length < the key length + * @returns whether the key was present in the map + */ + delete(key: readonly K[]): boolean { + if (this.keyLength < key.length) { + throw new Error(`inappropriate key length: ${key.length}, should <= ${this.keyLength}`); + } + let map = this.rootMap; + for (let i = 0; i < this.keyLength - 1; i++) { + map = map.get(key[i]); + if (!map) { + return false; + } + } + return map.delete(key[key.length - 1]); + } + + /** + * Iterates over all entries in the map. The ordering semantics are like iterating over a map of maps. + * @param handler Handler for each entry + */ + forEach(handler: (value: V, key: K[]) => void): void { + this.doForeach(handler, this.rootMap, []); + } + + // eslint-disable-next-line @typescript-eslint/no-explicit-any + private doForeach(handler: (value: V, key: K[]) => void, currentMap: Map, keys: K[]): void { + if (keys.length === this.keyLength - 1) { + currentMap.forEach((v, k) => { + handler(v, [...keys, k]); + }); + } else { + currentMap.forEach((v, k) => { + this.doForeach(handler, v, [...keys, k]); + }); + + } + } +} diff --git a/packages/core/src/common/color.ts b/packages/core/src/common/color.ts new file mode 100644 index 0000000..d27b2b3 --- /dev/null +++ b/packages/core/src/common/color.ts @@ -0,0 +1,153 @@ +// ***************************************************************************** +// Copyright (C) 2019 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { isObject } from './types'; + +/** + * Either be a reference to an existing color or a color value as a hex string, rgba, or hsla. + */ +export type Color = string | RGBA | HSLA | ColorTransformation; +export namespace Color { + export function rgba(r: number, g: number, b: number, a: number = 1): Color { + return { r, g, b, a }; + } + export function hsla(h: number, s: number, l: number, a: number = 1): Color { + return { h, s, l, a }; + } + export const white = rgba(255, 255, 255, 1); + export const black = rgba(0, 0, 0, 1); + export function transparent(v: string, f: number): ColorTransformation { + return { v, f, kind: 'transparent' }; + } + export function lighten(v: string, f: number): ColorTransformation { + return { v, f, kind: 'lighten' }; + } + export function darken(v: string, f: number): ColorTransformation { + return { v, f, kind: 'darken' }; + } + export function is(value: unknown): value is Color { + return typeof value === 'string' || (ColorTransformation.is(value) || RGBA.is(value) || HSLA.is(value)); + } +} +export interface ColorTransformation { + kind: 'transparent' | 'lighten' | 'darken' + v: string + f: number +} +export namespace ColorTransformation { + export function is(value: unknown): value is ColorTransformation { + return isObject(value) + && (value.kind === 'transparent' || value.kind === 'lighten' || value.kind === 'darken') + && typeof value.v === 'string' + && typeof value.f === 'number'; + } +} +export interface RGBA { + /** + * Red: integer in [0-255] + */ + readonly r: number; + + /** + * Green: integer in [0-255] + */ + readonly g: number; + + /** + * Blue: integer in [0-255] + */ + readonly b: number; + + /** + * Alpha: float in [0-1] + */ + readonly a: number; +} +export namespace RGBA { + export function is(value: unknown): value is RGBA { + return isObject(value) && typeof value.r === 'number' && typeof value.g === 'number' && typeof value.b === 'number' && typeof value.a === 'number'; + } +} +export interface HSLA { + /** + * Hue: integer in [0, 360] + */ + readonly h: number; + /** + * Saturation: float in [0, 1] + */ + readonly s: number; + /** + * Luminosity: float in [0, 1] + */ + readonly l: number; + /** + * Alpha: float in [0, 1] + */ + readonly a: number; +} +export namespace HSLA { + export function is(value: unknown): value is HSLA { + return isObject(value) && typeof value.h === 'number' && typeof value.s === 'number' && typeof value.l === 'number' && typeof value.a === 'number'; + } +} + +export interface ColorDefaults { + light?: Color + dark?: Color + /** @deprecated @since 1.28.0 Please use hcDark and hcLight. This field will be ignored unless `hcDark` is absent. */ + hc?: Color + hcDark?: Color; + hcLight?: Color; +} + +export namespace ColorDefaults { + export function getLight(defaults: ColorDefaults | Color | undefined): Color | undefined { + if (Color.is(defaults)) { + return defaults; + } + return defaults?.light; + } + export function getDark(defaults: ColorDefaults | Color | undefined): Color | undefined { + if (Color.is(defaults)) { + return defaults; + } + return defaults?.dark; + } + export function getHCDark(defaults: ColorDefaults | Color | undefined): Color | undefined { + if (Color.is(defaults)) { + return defaults; + } + return defaults?.hcDark ?? defaults?.hc; + } + export function getHCLight(defaults: ColorDefaults | Color | undefined): Color | undefined { + if (Color.is(defaults)) { + return defaults; + } + return defaults?.hcLight; + } +} + +export interface ColorDefinition { + id: string + defaults?: ColorDefaults | Color; + description: string +} + +export interface ColorCssVariable { + name: string + value: string +} diff --git a/packages/core/src/common/command.spec.ts b/packages/core/src/common/command.spec.ts new file mode 100644 index 0000000..580aa5e --- /dev/null +++ b/packages/core/src/common/command.spec.ts @@ -0,0 +1,208 @@ +// ***************************************************************************** +// Copyright (C) 2018 Red Hat and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { CommandRegistry, CommandHandler, Command, CommandContribution } from './command'; +import { ContributionProvider } from './contribution-provider'; +import * as chai from 'chai'; + +const expect = chai.expect; +let commandRegistry: CommandRegistry; + +describe('Commands', () => { + + beforeEach(() => { + commandRegistry = new CommandRegistry(new EmptyContributionProvider()); + }); + + it('should register and execute a given command', async () => { + const concatId = 'concat'; + const command: Command = { id: concatId }; + commandRegistry.registerCommand(command, new ConcatCommandHandler()); + const result = await commandRegistry.executeCommand(concatId, 'a', 'b', 'c'); + expect('abc').equals(result); + }); + + it('should add command to recently used', async () => { + const commandId = 'stub'; + const command: Command = { id: commandId }; + commandRegistry.registerCommand(command, new StubCommandHandler()); + commandRegistry.addRecentCommand(command); + expect(commandRegistry.recent.length).equal(1); + }); + + it('should add multiple commands to recently used in the order they were used', async () => { + const commandIds = ['a', 'b', 'c']; + const commands: Command[] = [ + { id: commandIds[0] }, + { id: commandIds[1] }, + { id: commandIds[2] }, + ]; + + // Register each command. + commands.forEach((c: Command) => { + commandRegistry.registerCommand(c, new StubCommandHandler()); + }); + + // Execute order c, b, a. + commandRegistry.addRecentCommand(commands[2]); + commandRegistry.addRecentCommand(commands[1]); + commandRegistry.addRecentCommand(commands[0]); + + // Expect recently used to be a, b, c. + const result: Command[] = commandRegistry.recent; + + expect(result.length).equal(3); + expect(result[0].id).equal(commandIds[0]); + expect(result[1].id).equal(commandIds[1]); + expect(result[2].id).equal(commandIds[2]); + }); + + it('should add a previously used command to the top of the most recently used', async () => { + const commandIds = ['a', 'b', 'c']; + const commands: Command[] = [ + { id: commandIds[0] }, + { id: commandIds[1] }, + { id: commandIds[2] }, + ]; + + // Register each command. + commands.forEach((c: Command) => { + commandRegistry.registerCommand(c, new StubCommandHandler()); + }); + + // Execute order a, b, c, a. + commandRegistry.addRecentCommand(commands[0]); + commandRegistry.addRecentCommand(commands[1]); + commandRegistry.addRecentCommand(commands[2]); + commandRegistry.addRecentCommand(commands[0]); + + // Expect recently used to be a, b, c. + const result: Command[] = commandRegistry.recent; + + expect(result.length).equal(3); + expect(result[0].id).equal(commandIds[0]); + expect(result[1].id).equal(commandIds[2]); + expect(result[2].id).equal(commandIds[1]); + }); + + it('should clear the recently used command history', async () => { + const commandIds = ['a', 'b', 'c']; + const commands: Command[] = [ + { id: commandIds[0] }, + { id: commandIds[1] }, + { id: commandIds[2] }, + ]; + + // Register each command. + commands.forEach((c: Command) => { + commandRegistry.registerCommand(c, new StubCommandHandler()); + }); + + // Execute each command. + commandRegistry.addRecentCommand(commands[0]); + commandRegistry.addRecentCommand(commands[1]); + commandRegistry.addRecentCommand(commands[2]); + + // Clear the list of recently used commands. + commandRegistry.clearCommandHistory(); + expect(commandRegistry.recent.length).equal(0); + }); + + it('should return with an empty array of handlers if the command is not registered', () => { + expect(commandRegistry.getCommand('missing')).to.be.undefined; + expect(commandRegistry.getAllHandlers('missing')).to.be.empty; + }); + + it('should return with an empty array of handlers if the command has no registered handlers', () => { + commandRegistry.registerCommand({ id: 'id' }); + expect(commandRegistry.getCommand('id')).to.be.not.undefined; + expect(commandRegistry.getAllHandlers('id')).to.be.empty; + }); + + it('should return all handlers including the non active ones', () => { + commandRegistry.registerCommand({ id: 'id' }); + commandRegistry.registerHandler('id', new StubCommandHandler()); + commandRegistry.registerHandler('id', new NeverActiveStubCommandHandler()); + expect(commandRegistry.getAllHandlers('id').length).to.be.equal(2); + }); + + describe('compareCommands', () => { + + it('should sort command \'a\' before command \'b\' with categories', () => { + const a: Command = { id: 'a', category: 'a', label: 'a' }; + const b: Command = { id: 'b', category: 'b', label: 'b' }; + expect(Command.compareCommands(a, b)).to.equal(-1); + expect(Command.compareCommands(b, a)).to.equal(1); + }); + + it('should sort command \'a\' before command \'b\' without categories', () => { + const a: Command = { id: 'a', label: 'a' }; + const b: Command = { id: 'b', label: 'b' }; + expect(Command.compareCommands(a, b)).to.equal(-1); + expect(Command.compareCommands(b, a)).to.equal(1); + }); + + it('should sort command \'a\' before command \'b\' with mix-match categories', () => { + const a: Command = { id: 'a', category: 'a', label: 'a' }; + const b: Command = { id: 'b', label: 'a' }; + expect(Command.compareCommands(a, b)).to.equal(1); + expect(Command.compareCommands(b, a)).to.equal(-1); + }); + + it('should sort irregardless of casing', () => { + const lowercase: Command = { id: 'a', label: 'a' }; + const uppercase: Command = { id: 'a', label: 'A' }; + expect(Command.compareCommands(lowercase, uppercase)).to.equal(0); + }); + + it('should not sort if commands are equal', () => { + const a: Command = { id: 'a', label: 'a' }; + expect(Command.compareCommands(a, a)).to.equal(0); + }); + + it('should not sort commands without labels', () => { + const a: Command = { id: 'a' }; + const b: Command = { id: 'b' }; + expect(Command.compareCommands(a, b)).to.equal(0); + }); + + }); + +}); + +class EmptyContributionProvider implements ContributionProvider { + getContributions(recursive?: boolean | undefined): CommandContribution[] { + return []; + } +} + +class ConcatCommandHandler implements CommandHandler { + execute(...args: string[]): string { + let concat = ''; + args.forEach(element => { + concat += element; + }); + return concat; + } +} + +class StubCommandHandler implements CommandHandler { + execute(...args: string[]): undefined { return undefined; } +} + +class NeverActiveStubCommandHandler extends StubCommandHandler { + isEnabled(): boolean { return false; } +} diff --git a/packages/core/src/common/command.ts b/packages/core/src/common/command.ts new file mode 100644 index 0000000..0e32824 --- /dev/null +++ b/packages/core/src/common/command.ts @@ -0,0 +1,489 @@ +// ***************************************************************************** +// Copyright (C) 2017 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { injectable, inject, named } from 'inversify'; +import { Event, Emitter, WaitUntilEvent } from './event'; +import { Disposable, DisposableCollection } from './disposable'; +import { ContributionProvider } from './contribution-provider'; +import { nls } from './nls'; +import debounce = require('p-debounce'); +import { isObject } from './types'; + +/** + * A command is a unique identifier of a function + * which can be executed by a user via a keyboard shortcut, + * a menu action or directly. + */ +export interface Command { + /** + * A unique identifier of this command. + */ + id: string; + /** + * A label of this command. + */ + label?: string; + originalLabel?: string; + /** + * An icon class of this command. + */ + iconClass?: string; + /** + * A short title used for display in menus. + */ + shortTitle?: string; + /** + * A category of this command. + */ + category?: string; + originalCategory?: string; +} + +export namespace Command { + /* Determine whether object is a Command */ + export function is(arg: unknown): arg is Command { + return isObject(arg) && 'id' in arg; + } + + /** Utility function to easily translate commands */ + export function toLocalizedCommand(command: Command, nlsLabelKey: string = command.id, nlsCategoryKey?: string): Command { + return { + ...command, + label: command.label && nls.localize(nlsLabelKey, command.label), + originalLabel: command.label, + category: nlsCategoryKey && command.category && nls.localize(nlsCategoryKey, command.category) || command.category, + originalCategory: command.category, + }; + } + + export function toDefaultLocalizedCommand(command: Command): Command { + return { + ...command, + label: command.label && nls.localizeByDefault(command.label), + originalLabel: command.label, + category: command.category && nls.localizeByDefault(command.category), + originalCategory: command.category, + }; + } + + /** Comparator function for when sorting commands */ + export function compareCommands(a: Command, b: Command): number { + if (a.label && b.label) { + const aCommand = (a.category ? `${a.category}: ${a.label}` : a.label).toLowerCase(); + const bCommand = (b.category ? `${b.category}: ${b.label}` : b.label).toLowerCase(); + return (aCommand).localeCompare(bCommand); + } else { + return 0; + } + } + + /** + * Determine if two commands are equal. + * + * @param a the first command for comparison. + * @param b the second command for comparison. + */ + export function equals(a: Command, b: Command): boolean { + return ( + a.id === b.id && + a.label === b.label && + a.iconClass === b.iconClass && + a.category === b.category + ); + } +} + +/** + * A command handler is an implementation of a command. + * + * A command can have multiple handlers + * but they should be active in different contexts, + * otherwise first active will be executed. + */ +export interface CommandHandler { + /** + * Execute this handler. + * + * Don't call it directly, use `CommandService.executeCommand` instead. + */ + // eslint-disable-next-line @typescript-eslint/no-explicit-any + execute(...args: any[]): any; + /** + * Test whether this handler is enabled (active). + */ + // eslint-disable-next-line @typescript-eslint/no-explicit-any + isEnabled?(...args: any[]): boolean; + onDidChangeEnabled?: Event; + /** + * Test whether menu items for this handler should be visible. + */ + // eslint-disable-next-line @typescript-eslint/no-explicit-any + isVisible?(...args: any[]): boolean; + /** + * Test whether menu items for this handler should be toggled. + */ + // eslint-disable-next-line @typescript-eslint/no-explicit-any + isToggled?(...args: any[]): boolean; +} + +export const CommandContribution = Symbol('CommandContribution'); +/** + * The command contribution should be implemented to register custom commands and handler. + */ +export interface CommandContribution { + /** + * Register commands and handlers. + */ + registerCommands(commands: CommandRegistry): void; +} + +export interface CommandEvent { + commandId: string; + // eslint-disable-next-line @typescript-eslint/no-explicit-any + args: any[] +} + +export interface WillExecuteCommandEvent extends WaitUntilEvent, CommandEvent { +} + +export const commandServicePath = '/services/commands'; +export const CommandService = Symbol('CommandService'); +/** + * The command service should be used to execute commands. + */ +export interface CommandService { + /** + * Execute the active handler for the given command and arguments. + * + * Reject if a command cannot be executed. + */ + // eslint-disable-next-line @typescript-eslint/no-explicit-any + executeCommand(command: string, ...args: any[]): Promise; + /** + * An event is emitted when a command is about to be executed. + * + * It can be used to install or activate a command handler. + */ + readonly onWillExecuteCommand: Event; + /** + * An event is emitted when a command was executed. + */ + readonly onDidExecuteCommand: Event; +} + +/** + * The command registry manages commands and handlers. + */ +@injectable() +export class CommandRegistry implements CommandService { + + protected readonly _commands: { [id: string]: Command } = {}; + protected readonly _handlers: { [id: string]: CommandHandler[] } = {}; + + protected readonly toUnregisterCommands = new Map(); + + // List of recently used commands. + protected _recent: string[] = []; + + protected readonly onWillExecuteCommandEmitter = new Emitter(); + readonly onWillExecuteCommand = this.onWillExecuteCommandEmitter.event; + + protected readonly onDidExecuteCommandEmitter = new Emitter(); + readonly onDidExecuteCommand = this.onDidExecuteCommandEmitter.event; + + protected readonly onCommandsChangedEmitter = new Emitter(); + readonly onCommandsChanged = this.onCommandsChangedEmitter.event; + + constructor( + @inject(ContributionProvider) @named(CommandContribution) + protected readonly contributionProvider: ContributionProvider + ) { } + + onStart(): void { + const contributions = this.contributionProvider.getContributions(); + for (const contrib of contributions) { + contrib.registerCommands(this); + } + } + + *getAllCommands(): IterableIterator> { + for (const command of Object.values(this._commands)) { + yield { ...command, handlers: this._handlers[command.id] ?? [] }; + } + } + + /** + * Register the given command and handler if present. + * + * Throw if a command is already registered for the given command identifier. + */ + registerCommand(command: Command, handler?: CommandHandler): Disposable { + if (this._commands[command.id]) { + console.warn(`A command ${command.id} is already registered.`); + return Disposable.NULL; + } + const toDispose = new DisposableCollection(this.doRegisterCommand(command)); + if (handler) { + toDispose.push(this.registerHandler(command.id, handler)); + } + this.toUnregisterCommands.set(command.id, toDispose); + toDispose.push(Disposable.create(() => this.toUnregisterCommands.delete(command.id))); + return toDispose; + } + + protected doRegisterCommand(command: Command): Disposable { + this._commands[command.id] = command; + return { + dispose: () => { + delete this._commands[command.id]; + } + }; + } + + /** + * Unregister command from the registry + * + * @param command + */ + unregisterCommand(command: Command): void; + /** + * Unregister command from the registry + * + * @param id + */ + unregisterCommand(id: string): void; + unregisterCommand(commandOrId: Command | string): void { + const id = Command.is(commandOrId) ? commandOrId.id : commandOrId; + const toUnregister = this.toUnregisterCommands.get(id); + if (toUnregister) { + toUnregister.dispose(); + } + } + + /** + * Register the given handler for the given command identifier. + * + * If there is already a handler for the given command + * then the given handler is registered as more specific, and + * has higher priority during enablement, visibility and toggle state evaluations. + */ + registerHandler(commandId: string, handler: CommandHandler): Disposable { + let handlers = this._handlers[commandId]; + if (!handlers) { + this._handlers[commandId] = handlers = []; + } + handlers.unshift(handler); + this.fireDidChange(); + return { + dispose: () => { + const idx = handlers.indexOf(handler); + if (idx >= 0) { + handlers.splice(idx, 1); + this.fireDidChange(); + } + } + }; + } + + protected fireDidChange = debounce(() => this.doFireDidChange(), 0); + + protected doFireDidChange(): void { + this.onCommandsChangedEmitter.fire(); + } + + /** + * Test whether there is an active handler for the given command. + */ + // eslint-disable-next-line @typescript-eslint/no-explicit-any + isEnabled(command: string, ...args: any[]): boolean { + return typeof this.getActiveHandler(command, ...args) !== 'undefined'; + } + + /** + * Test whether there is a visible handler for the given command. + */ + // eslint-disable-next-line @typescript-eslint/no-explicit-any + isVisible(command: string, ...args: any[]): boolean { + return typeof this.getVisibleHandler(command, ...args) !== 'undefined'; + } + + /** + * Test whether there is a toggled handler for the given command. + */ + // eslint-disable-next-line @typescript-eslint/no-explicit-any + isToggled(command: string, ...args: any[]): boolean { + return typeof this.getToggledHandler(command, ...args) !== 'undefined'; + } + + /** + * Execute the active handler for the given command and arguments. + * + * Reject if a command cannot be executed. + */ + // eslint-disable-next-line @typescript-eslint/no-explicit-any + async executeCommand(commandId: string, ...args: any[]): Promise { + const handler = this.getActiveHandler(commandId, ...args); + if (handler) { + await this.fireWillExecuteCommand(commandId, args); + const result = await handler.execute(...args); + this.onDidExecuteCommandEmitter.fire({ commandId, args }); + return result; + } + throw Object.assign(new Error(`The command '${commandId}' cannot be executed. There are no active handlers available for the command.`), { code: 'NO_ACTIVE_HANDLER' }); + } + + // eslint-disable-next-line @typescript-eslint/no-explicit-any + protected async fireWillExecuteCommand(commandId: string, args: any[] = []): Promise { + await WaitUntilEvent.fire(this.onWillExecuteCommandEmitter, { commandId, args }, 30000); + } + + /** + * Get a visible handler for the given command or `undefined`. + */ + // eslint-disable-next-line @typescript-eslint/no-explicit-any + getVisibleHandler(commandId: string, ...args: any[]): CommandHandler | undefined { + const handlers = this._handlers[commandId]; + if (handlers) { + for (const handler of handlers) { + try { + if (!handler.isVisible || handler.isVisible(...args)) { + return handler; + } + } catch (error) { + console.error(error); + } + } + } + return undefined; + } + + /** + * Get an active handler for the given command or `undefined`. + */ + // eslint-disable-next-line @typescript-eslint/no-explicit-any + getActiveHandler(commandId: string, ...args: any[]): CommandHandler | undefined { + const handlers = this._handlers[commandId]; + if (handlers) { + for (const handler of handlers) { + try { + if (!handler.isEnabled || handler.isEnabled(...args)) { + return handler; + } + } catch (error) { + console.error(error); + } + } + } + return undefined; + } + + /** + * Get a toggled handler for the given command or `undefined`. + */ + // eslint-disable-next-line @typescript-eslint/no-explicit-any + getToggledHandler(commandId: string, ...args: any[]): CommandHandler | undefined { + const handlers = this._handlers[commandId]; + if (handlers) { + for (const handler of handlers) { + try { + if (handler.isToggled && handler.isToggled(...args)) { + return handler; + } + } catch (error) { + console.error(error); + } + } + } + return undefined; + } + + /** + * Returns with all handlers for the given command. If the command does not have any handlers, + * or the command is not registered, returns an empty array. + */ + getAllHandlers(commandId: string): CommandHandler[] { + const handlers = this._handlers[commandId]; + return handlers ? handlers.slice() : []; + } + + /** + * Get all registered commands. + */ + get commands(): Command[] { + return Object.values(this._commands); + } + + /** + * Get a command for the given command identifier. + */ + getCommand(id: string): Command | undefined { + return this._commands[id]; + } + + /** + * Get all registered commands identifiers. + */ + get commandIds(): string[] { + return Object.keys(this._commands); + } + + /** + * Get the list of recently used commands. + */ + get recent(): Command[] { + const commands: Command[] = []; + for (const recentId of this._recent) { + const command = this.getCommand(recentId); + if (command) { + commands.push(command); + } + } + return commands; + } + + /** + * Set the list of recently used commands. + * @param commands the list of recently used commands. + */ + set recent(commands: Command[]) { + this._recent = Array.from(new Set(commands.map(e => e.id))); + } + + /** + * Adds a command to recently used list. + * Prioritizes commands that were recently executed to be most recent. + * + * @param recent a recent command, or array of recent commands. + */ + addRecentCommand(recent: Command | Command[]): void { + for (const recentCommand of Array.isArray(recent) ? recent : [recent]) { + // Determine if the command currently exists in the recently used list. + const index = this._recent.findIndex(commandId => commandId === recentCommand.id); + // If the command exists, remove it from the array so it can later be placed at the top. + if (index >= 0) { this._recent.splice(index, 1); } + // Add the recent command to the beginning of the array (most recent). + this._recent.unshift(recentCommand.id); + } + } + + /** + * Clear the list of recently used commands. + */ + clearCommandHistory(): void { + this.recent = []; + } + +} diff --git a/packages/core/src/common/content-replacer-v2-impl.spec.ts b/packages/core/src/common/content-replacer-v2-impl.spec.ts new file mode 100644 index 0000000..2c4cbd4 --- /dev/null +++ b/packages/core/src/common/content-replacer-v2-impl.spec.ts @@ -0,0 +1,344 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { expect } from 'chai'; +import { ContentReplacerV2Impl } from './content-replacer-v2-impl'; +import { Replacement } from './content-replacer'; + +describe('ContentReplacerV2Impl', () => { + let contentReplacer: ContentReplacerV2Impl; + + before(() => { + contentReplacer = new ContentReplacerV2Impl(); + }); + + // All original V1 test cases for backward compatibility + describe('V1 compatibility tests', () => { + it('should replace content when oldContent matches exactly', () => { + const originalContent = 'Hello World!'; + const replacements: Replacement[] = [ + { oldContent: 'World', newContent: 'Universe' } + ]; + const expectedContent = 'Hello Universe!'; + const result = contentReplacer.applyReplacements(originalContent, replacements); + expect(result.updatedContent).to.equal(expectedContent); + expect(result.errors).to.be.empty; + }); + + it('should replace content when oldContent matches after trimming lines', () => { + const originalContent = 'Line one\n Line two \nLine three'; + const replacements: Replacement[] = [ + { oldContent: 'Line two', newContent: 'Second Line' } + ]; + const expectedContent = 'Line one\n Second Line \nLine three'; + const result = contentReplacer.applyReplacements(originalContent, replacements); + expect(result.updatedContent).to.equal(expectedContent); + expect(result.errors).to.be.empty; + }); + + it('should return an error when oldContent is not found', () => { + const originalContent = 'Sample content'; + const replacements: Replacement[] = [ + { oldContent: 'Nonexistent', newContent: 'Replacement' } + ]; + const result = contentReplacer.applyReplacements(originalContent, replacements); + expect(result.updatedContent).to.equal(originalContent); + expect(result.errors).to.include('Content to replace not found: "Nonexistent"'); + }); + + it('should return an error when oldContent has multiple occurrences', () => { + const originalContent = 'Repeat Repeat Repeat'; + const replacements: Replacement[] = [ + { oldContent: 'Repeat', newContent: 'Once' } + ]; + const result = contentReplacer.applyReplacements(originalContent, replacements); + expect(result.updatedContent).to.equal(originalContent); + expect(result.errors.some(candidate => candidate.startsWith('Multiple occurrences found for: "Repeat"'))).to.be.true; + }); + + it('should prepend newContent when oldContent is an empty string', () => { + const originalContent = 'Existing content'; + const replacements: Replacement[] = [ + { oldContent: '', newContent: 'Prepended content\n' } + ]; + const expectedContent = 'Prepended content\nExisting content'; + const result = contentReplacer.applyReplacements(originalContent, replacements); + expect(result.updatedContent).to.equal(expectedContent); + expect(result.errors).to.be.empty; + }); + + it('should handle multiple replacements correctly', () => { + const originalContent = 'Foo Bar Baz'; + const replacements: Replacement[] = [ + { oldContent: 'Foo', newContent: 'FooModified' }, + { oldContent: 'Bar', newContent: 'BarModified' }, + { oldContent: 'Baz', newContent: 'BazModified' } + ]; + const expectedContent = 'FooModified BarModified BazModified'; + const result = contentReplacer.applyReplacements(originalContent, replacements); + expect(result.updatedContent).to.equal(expectedContent); + expect(result.errors).to.be.empty; + }); + + it('should replace all occurrences when multiple is true', () => { + const originalContent = 'Repeat Repeat Repeat'; + const replacements: Replacement[] = [ + { oldContent: 'Repeat', newContent: 'Once', multiple: true } + ]; + const expectedContent = 'Once Once Once'; + const result = contentReplacer.applyReplacements(originalContent, replacements); + expect(result.updatedContent).to.equal(expectedContent); + expect(result.errors).to.be.empty; + }); + + it('should return an error when multiple is false and multiple occurrences are found', () => { + const originalContent = 'Repeat Repeat Repeat'; + const replacements: Replacement[] = [ + { oldContent: 'Repeat', newContent: 'Once', multiple: false } + ]; + const result = contentReplacer.applyReplacements(originalContent, replacements); + expect(result.updatedContent).to.equal(originalContent); + expect(result.errors.some(candidate => candidate.startsWith('Multiple occurrences found for: "Repeat"'))).to.be.true; + }); + + it('should return an error when conflicting replacements for the same oldContent are provided', () => { + const originalContent = 'Conflict test content'; + const replacements: Replacement[] = [ + { oldContent: 'test', newContent: 'test1' }, + { oldContent: 'test', newContent: 'test2' } + ]; + const result = contentReplacer.applyReplacements(originalContent, replacements); + expect(result.updatedContent).to.equal(originalContent); + expect(result.errors).to.include('Conflicting replacement values for: "test"'); + }); + }); + + // New V2 feature tests + describe('V2 enhanced features', () => { + describe('Line ending normalization', () => { + it('should match content with different line endings (CRLF vs LF)', () => { + const originalContent = 'Line one\r\nLine two\r\nLine three'; + const replacements: Replacement[] = [ + { oldContent: 'Line one\nLine two', newContent: 'Modified lines' } + ]; + const expectedContent = 'Modified lines\r\nLine three'; + const result = contentReplacer.applyReplacements(originalContent, replacements); + expect(result.updatedContent).to.equal(expectedContent); + expect(result.errors).to.be.empty; + }); + + it('should preserve original line endings when replacing', () => { + const originalContent = 'Line one\r\nLine two\r\nLine three'; + const replacements: Replacement[] = [ + { oldContent: 'Line two', newContent: 'New line\nWith LF' } + ]; + const expectedContent = 'Line one\r\nNew line\r\nWith LF\r\nLine three'; + const result = contentReplacer.applyReplacements(originalContent, replacements); + expect(result.updatedContent).to.equal(expectedContent); + expect(result.errors).to.be.empty; + }); + + it('should handle mixed line endings', () => { + const originalContent = 'Line one\nLine two\r\nLine three\rLine four'; + const replacements: Replacement[] = [ + { oldContent: 'Line two\nLine three', newContent: 'Replaced content' } + ]; + const result = contentReplacer.applyReplacements(originalContent, replacements); + expect(result.errors).to.be.empty; + expect(result.updatedContent).to.include('Replaced content'); + }); + }); + + describe('Multi-line fuzzy matching', () => { + it('should match multi-line content with different indentation', () => { + const originalContent = ' function test() {\n console.log("hello");\n return true;\n }'; + const replacements: Replacement[] = [ + { + oldContent: 'function test() {\nconsole.log("hello");\nreturn true;\n}', + newContent: 'function test() {\n console.log("modified");\n return false;\n}' + } + ]; + const expectedContent = ' function test() {\n console.log("modified");\n return false;\n }'; + const result = contentReplacer.applyReplacements(originalContent, replacements); + expect(result.updatedContent).to.equal(expectedContent); + expect(result.errors).to.be.empty; + }); + + it('should match content with extra whitespace between lines', () => { + const originalContent = 'function test() {\n \n console.log("hello");\n \n}'; + const replacements: Replacement[] = [ + { + oldContent: 'function test() {\nconsole.log("hello");\n}', + newContent: 'function modified() {\n console.log("world");\n}' + } + ]; + const result = contentReplacer.applyReplacements(originalContent, replacements); + expect(result.errors).to.be.empty; + expect(result.updatedContent).to.include('function modified()'); + expect(result.updatedContent).to.include('console.log("world")'); + }); + + it('should match content with trailing whitespace on lines', () => { + const originalContent = 'const x = 1; \nconst y = 2; \n'; + const replacements: Replacement[] = [ + { + oldContent: 'const x = 1;\nconst y = 2;', + newContent: 'const a = 3;\nconst b = 4;' + } + ]; + const result = contentReplacer.applyReplacements(originalContent, replacements); + expect(result.errors).to.be.empty; + expect(result.updatedContent).to.include('const a = 3;'); + expect(result.updatedContent).to.include('const b = 4;'); + }); + }); + + describe('Indentation preservation', () => { + it('should preserve indentation when replacing single line', () => { + const originalContent = ' const x = 1;\n const y = 2;'; + const replacements: Replacement[] = [ + { oldContent: 'const x = 1;', newContent: 'const a = 3;' } + ]; + const expectedContent = ' const a = 3;\n const y = 2;'; + const result = contentReplacer.applyReplacements(originalContent, replacements); + expect(result.updatedContent).to.equal(expectedContent); + expect(result.errors).to.be.empty; + }); + + it('should preserve relative indentation in multi-line replacements', () => { + const originalContent = ' if (condition) {\n doSomething();\n }'; + const replacements: Replacement[] = [ + { + oldContent: 'if (condition) {\n doSomething();\n}', + newContent: 'if (newCondition) {\n doFirst();\n doSecond();\n}' + } + ]; + const expectedContent = ' if (newCondition) {\n doFirst();\n doSecond();\n }'; + const result = contentReplacer.applyReplacements(originalContent, replacements); + expect(result.updatedContent).to.equal(expectedContent); + expect(result.errors).to.be.empty; + }); + + it('should handle tabs and spaces correctly', () => { + const originalContent = '\tfunction test() {\n\t\tconsole.log("hello");\n\t}'; + const replacements: Replacement[] = [ + { + oldContent: 'function test() {\n console.log("hello");\n}', + newContent: 'function modified() {\n console.log("world");\n}' + } + ]; + const result = contentReplacer.applyReplacements(originalContent, replacements); + expect(result.errors).to.be.empty; + expect(result.updatedContent).to.match(/^\tfunction modified/); + expect(result.updatedContent).to.include('\t\tconsole.log("world")'); + }); + }); + + describe('Error handling improvements', () => { + it('should truncate long content in error messages', () => { + const longContent = 'a'.repeat(200); + const originalContent = 'Some content'; + const replacements: Replacement[] = [ + { oldContent: longContent, newContent: 'replacement' } + ]; + const result = contentReplacer.applyReplacements(originalContent, replacements); + expect(result.errors.length).to.equal(1); + expect(result.errors[0].length).to.be.lessThan(250); // Error message should be truncated + expect(result.errors[0]).to.include('...'); + }); + }); + + describe('Complex scenarios', () => { + it('should handle multiple replacements with different matching strategies', () => { + const originalContent = 'Line 1\r\n Line 2 \nLine 3\nExact match here'; + const replacements: Replacement[] = [ + { oldContent: 'Line 1\nLine 2', newContent: 'Modified 1-2' }, // Line ending normalization + { oldContent: 'Line 3', newContent: 'Modified 3' }, // Trimmed match + { oldContent: 'Exact match here', newContent: 'Exact replaced' } // Exact match + ]; + const result = contentReplacer.applyReplacements(originalContent, replacements); + expect(result.errors).to.be.empty; + expect(result.updatedContent).to.include('Modified 1-2'); + expect(result.updatedContent).to.include('Modified 3'); + expect(result.updatedContent).to.include('Exact replaced'); + }); + + it('should handle code blocks with varying indentation', () => { + const originalContent = ` +class MyClass { + constructor() { + this.value = 42; + } + + getValue() { + return this.value; + } +}`; + const replacements: Replacement[] = [ + { + oldContent: `getValue() { +return this.value; +}`, + newContent: `getValue() { + console.log('Getting value'); + return this.value; +}` + } + ]; + const result = contentReplacer.applyReplacements(originalContent, replacements); + expect(result.errors).to.be.empty; + expect(result.updatedContent).to.include("console.log('Getting value')"); + // Check that indentation is preserved + expect(result.updatedContent).to.match(/ getValue\(\) \{[\r\n\s]*console\.log/); + }); + + it('should handle empty lines in multi-line matches', () => { + const originalContent = 'function test() {\n\n return true;\n\n}'; + const replacements: Replacement[] = [ + { + oldContent: 'function test() {\n\nreturn true;\n\n}', + newContent: 'function test() {\n return false;\n}' + } + ]; + const result = contentReplacer.applyReplacements(originalContent, replacements); + expect(result.errors).to.be.empty; + expect(result.updatedContent).to.include('return false'); + }); + }); + + describe('Multiple occurrences with fuzzy matching', () => { + it('should handle multiple occurrences with fuzzy matching when multiple is true', () => { + const originalContent = ' item1\n\n item2\n\n item1'; + const replacements: Replacement[] = [ + { oldContent: 'item1', newContent: 'replaced', multiple: true } + ]; + const result = contentReplacer.applyReplacements(originalContent, replacements); + expect(result.errors).to.be.empty; + expect(result.updatedContent.match(/replaced/g)).to.have.length(2); + }); + + it('should detect multiple fuzzy matches and error when multiple is false', () => { + const originalContent = ' function a() {}\n\n function a() {}'; + const replacements: Replacement[] = [ + { oldContent: 'function a() {}', newContent: 'function b() {}', multiple: false } + ]; + const result = contentReplacer.applyReplacements(originalContent, replacements); + expect(result.updatedContent).to.equal(originalContent); + expect(result.errors.some(err => err.includes('Multiple occurrences found'))).to.be.true; + }); + }); + }); +}); diff --git a/packages/core/src/common/content-replacer-v2-impl.ts b/packages/core/src/common/content-replacer-v2-impl.ts new file mode 100644 index 0000000..cec9a2c --- /dev/null +++ b/packages/core/src/common/content-replacer-v2-impl.ts @@ -0,0 +1,471 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { ContentReplacer, Replacement } from './content-replacer'; + +/** + * Represents a match with its position and the actual matched content + */ +interface MatchInfo { + startIndex: number; + endIndex: number; + matchedContent: string; +} + +/** + * Result of finding matches + */ +interface MatchResult { + matches: MatchInfo[]; + strategy: string; +} + +export class ContentReplacerV2Impl implements ContentReplacer { + /** + * Applies a list of replacements to the original content using a multi-step matching strategy with improved flexibility. + * @param originalContent The original file content. + * @param replacements Array of Replacement objects. + * @returns An object containing the updated content and any error messages. + */ + applyReplacements(originalContent: string, replacements: Replacement[]): { updatedContent: string, errors: string[] } { + let updatedContent = originalContent; + const errorMessages: string[] = []; + + // Guard against conflicting replacements: if the same oldContent appears with different newContent, return with an error. + const conflictMap = new Map(); + for (const replacement of replacements) { + if (conflictMap.has(replacement.oldContent) && conflictMap.get(replacement.oldContent) !== replacement.newContent) { + return { updatedContent: originalContent, errors: [`Conflicting replacement values for: "${replacement.oldContent}"`] }; + } + conflictMap.set(replacement.oldContent, replacement.newContent); + } + + replacements.forEach(({ oldContent, newContent, multiple }) => { + // If the old content is empty, prepend the new content to the beginning of the file (e.g. in new file) + if (oldContent === '') { + updatedContent = newContent + updatedContent; + return; + } + + // Try multiple matching strategies + const matchResult = this.findMatches(updatedContent, oldContent); + + if (matchResult.matches.length === 0) { + const truncatedOld = this.truncateForError(oldContent); + errorMessages.push(`Content to replace not found: "${truncatedOld}"`); + } else if (matchResult.matches.length > 1) { + if (multiple) { + updatedContent = this.replaceAllMatches(updatedContent, matchResult.matches, newContent); + } else { + const truncatedOld = this.truncateForError(oldContent); + errorMessages.push(`Multiple occurrences found for: "${truncatedOld}". Set 'multiple' to true if multiple occurrences of the oldContent are expected to be\ + replaced at once.`); + } + } else { + updatedContent = this.replaceSingleMatch(updatedContent, matchResult.matches[0], newContent); + } + }); + + return { updatedContent, errors: errorMessages }; + } + + /** + * Normalizes line endings to LF + */ + private normalizeLineEndings(text: string): string { + return text.replace(/\r\n/g, '\n').replace(/\r/g, '\n'); + } + + /** + * Finds matches using multiple strategies with increasing flexibility + */ + private findMatches(content: string, search: string): MatchResult { + // Strategy 1: Exact match + const exactMatches = this.findExactMatches(content, search); + if (exactMatches.length > 0) { + return { matches: exactMatches, strategy: 'exact' }; + } + + // Strategy 2: Match with normalized line endings + const normalizedMatches = this.findNormalizedLineEndingMatches(content, search); + if (normalizedMatches.length > 0) { + return { matches: normalizedMatches, strategy: 'normalized-line-endings' }; + } + + // Strategy 3: Single line trimmed match (for backward compatibility) + const lineTrimmedMatches = this.findLineTrimmedMatches(content, search); + if (lineTrimmedMatches.length > 0) { + return { matches: lineTrimmedMatches, strategy: 'line-trimmed' }; + } + + // Strategy 4: Multi-line fuzzy match with trimmed comparison + const fuzzyMatches = this.findFuzzyMultilineMatches(content, search); + if (fuzzyMatches.length > 0) { + return { matches: fuzzyMatches, strategy: 'fuzzy-multiline' }; + } + + return { matches: [], strategy: 'none' }; + } + + /** + * Finds all exact matches of a substring within a string. + */ + private findExactMatches(content: string, search: string): MatchInfo[] { + const matches: MatchInfo[] = []; + let startIndex = 0; + + while ((startIndex = content.indexOf(search, startIndex)) !== -1) { + matches.push({ + startIndex, + endIndex: startIndex + search.length, + matchedContent: search + }); + startIndex += search.length; + } + + return matches; + } + + /** + * Finds matches after normalizing line endings + */ + private findNormalizedLineEndingMatches(content: string, search: string): MatchInfo[] { + const normalizedContent = this.normalizeLineEndings(content); + const normalizedSearch = this.normalizeLineEndings(search); + + const matches: MatchInfo[] = []; + let startIndex = 0; + + while ((startIndex = normalizedContent.indexOf(normalizedSearch, startIndex)) !== -1) { + // Map back to original content position + const originalStartIndex = this.mapNormalizedPositionToOriginal(content, startIndex); + const originalEndIndex = this.mapNormalizedPositionToOriginal(content, startIndex + normalizedSearch.length); + + matches.push({ + startIndex: originalStartIndex, + endIndex: originalEndIndex, + matchedContent: content.substring(originalStartIndex, originalEndIndex) + }); + startIndex += normalizedSearch.length; + } + + return matches; + } + + /** + * Maps a position in normalized content back to the original content + */ + private mapNormalizedPositionToOriginal(originalContent: string, normalizedPosition: number): number { + let originalPos = 0; + let normalizedPos = 0; + + while (normalizedPos < normalizedPosition && originalPos < originalContent.length) { + if (originalPos + 1 < originalContent.length && + originalContent[originalPos] === '\r' && + originalContent[originalPos + 1] === '\n') { + // CRLF in original maps to single LF in normalized + originalPos += 2; + normalizedPos += 1; + } else if (originalContent[originalPos] === '\r') { + // Single CR in original maps to LF in normalized + originalPos += 1; + normalizedPos += 1; + } else { + // All other characters map 1:1 + originalPos += 1; + normalizedPos += 1; + } + } + + return originalPos; + } + + /** + * Attempts to find matches by trimming whitespace from lines (single line only, for backward compatibility) + */ + private findLineTrimmedMatches(content: string, search: string): MatchInfo[] { + const trimmedSearch = search.trim(); + const lines = content.split(/\r?\n/); + + for (let i = 0; i < lines.length; i++) { + const trimmedLine = lines[i].trim(); + if (trimmedLine === trimmedSearch) { + // Calculate the starting index of this line in the original content + const startIndex = this.getLineStartIndex(content, i); + const endIndex = startIndex + lines[i].length; + return [{ + startIndex, + endIndex, + matchedContent: lines[i] + }]; + } + } + + return []; + } + + /** + * Finds matches using fuzzy multi-line comparison with trimmed lines + */ + private findFuzzyMultilineMatches(content: string, search: string): MatchInfo[] { + // Extract non-empty lines from search for matching + const searchLines = search.split(/\r?\n/); + const nonEmptySearchLines = searchLines + .map(line => line.trim()) + .filter(line => line.length > 0); + + if (nonEmptySearchLines.length === 0) { return []; } + + const contentLines = content.split(/\r?\n/); + const matches: MatchInfo[] = []; + + // Try to find sequences in content that match all non-empty lines from search + for (let contentStart = 0; contentStart < contentLines.length; contentStart++) { + // First, check if this could be a valid starting position + const startLineTrimmed = contentLines[contentStart].trim(); + if (startLineTrimmed.length === 0 || startLineTrimmed !== nonEmptySearchLines[0]) { + continue; + } + + let searchIndex = 1; // We already matched the first line + let contentIndex = contentStart + 1; + let lastMatchedLine = contentStart; + + // Try to match remaining non-empty lines from search + while (searchIndex < nonEmptySearchLines.length && contentIndex < contentLines.length) { + const contentLineTrimmed = contentLines[contentIndex].trim(); + + if (contentLineTrimmed.length === 0) { + // Skip empty lines in content + contentIndex++; + } else if (contentLineTrimmed === nonEmptySearchLines[searchIndex]) { + // Found a match + lastMatchedLine = contentIndex; + searchIndex++; + contentIndex++; + } else { + // No match, this starting position doesn't work + break; + } + } + + // Check if we matched all non-empty lines + if (searchIndex === nonEmptySearchLines.length) { + const startIndex = this.getLineStartIndex(content, contentStart); + const endIndex = this.getLineEndIndex(content, lastMatchedLine); + + matches.push({ + startIndex, + endIndex, + matchedContent: content.substring(startIndex, endIndex) + }); + } + } + + return matches; + } + + /** + * Calculates the starting index of a specific line number in the content. + */ + private getLineStartIndex(content: string, lineNumber: number): number { + if (lineNumber === 0) { return 0; } + + let index = 0; + let currentLine = 0; + + while (currentLine < lineNumber && index < content.length) { + if (content[index] === '\r' && index + 1 < content.length && content[index + 1] === '\n') { + index += 2; // CRLF + currentLine++; + } else if (content[index] === '\r' || content[index] === '\n') { + index += 1; // CR or LF + currentLine++; + } else { + index += 1; + } + } + + return index; + } + + /** + * Calculates the ending index of a specific line number in the content (including the line). + */ + private getLineEndIndex(content: string, lineNumber: number): number { + const lines = content.split(/\r?\n/); + if (lineNumber >= lines.length) { + return content.length; + } + + let index = 0; + for (let i = 0; i <= lineNumber; i++) { + index += lines[i].length; + if (i < lineNumber) { + // Add line ending length + const searchPos = index; + if (content.indexOf('\r\n', searchPos) === searchPos) { + index += 2; // CRLF + } else if (index < content.length && (content[index] === '\r' || content[index] === '\n')) { + index += 1; // CR or LF + } + } + } + + return index; + } + + /** + * Replaces a single match while preserving indentation + */ + private replaceSingleMatch(content: string, match: MatchInfo, newContent: string): string { + const beforeMatch = content.substring(0, match.startIndex); + const afterMatch = content.substring(match.endIndex); + + // Detect the line ending style from entire original content, not just the match + const originalLineEnding = content.includes('\r\n') ? '\r\n' : + content.includes('\r') ? '\r' : '\n'; + + // Convert line endings in newContent to match original + const newContentWithCorrectLineEndings = this.convertLineEndings(newContent, originalLineEnding); + + // Preserve indentation from the matched content + const preservedReplacement = this.preserveIndentation(match.matchedContent, newContentWithCorrectLineEndings, originalLineEnding); + + return beforeMatch + preservedReplacement + afterMatch; + } + + /** + * Replaces all matches + */ + private replaceAllMatches(content: string, matches: MatchInfo[], newContent: string): string { + // Sort matches by position (descending) to avoid position shifts + const sortedMatches = [...matches].sort((a, b) => b.startIndex - a.startIndex); + + // Detect the line ending style from entire original content + const originalLineEnding = content.includes('\r\n') ? '\r\n' : + content.includes('\r') ? '\r' : '\n'; + + let result = content; + for (const match of sortedMatches) { + const beforeMatch = result.substring(0, match.startIndex); + const afterMatch = result.substring(match.endIndex); + + // Convert line endings in newContent to match original + const newContentWithCorrectLineEndings = this.convertLineEndings(newContent, originalLineEnding); + + const preservedReplacement = this.preserveIndentation(match.matchedContent, newContentWithCorrectLineEndings, originalLineEnding); + result = beforeMatch + preservedReplacement + afterMatch; + } + + return result; + } + + /** + * Preserves the indentation from the original content when applying the replacement + */ + private preserveIndentation(originalContent: string, newContent: string, lineEnding: string): string { + const originalLines = originalContent.split(/\r?\n/); + const newLines = newContent.split(/\r?\n/); + + if (originalLines.length === 0 || newLines.length === 0) { + return newContent; + } + + // Find first non-empty line in original to get base indentation + let originalBaseIndent = ''; + let originalUseTabs = false; + for (const line of originalLines) { + if (line.trim().length > 0) { + originalBaseIndent = line.match(/^\s*/)?.[0] || ''; + originalUseTabs = originalBaseIndent.includes('\t'); + break; + } + } + + // Find first non-empty line in new content to get base indentation + let newBaseIndent = ''; + for (const line of newLines) { + if (line.trim().length > 0) { + newBaseIndent = line.match(/^\s*/)?.[0] || ''; + break; + } + } + + // Apply the indentation to all lines of new content + const result = newLines.map(line => { + // Empty lines remain empty + if (line.trim().length === 0) { + return ''; + } + + // Get current line's indentation + const currentIndent = line.match(/^\s*/)?.[0] || ''; + + // Calculate relative indentation + let relativeIndent = currentIndent; + if (newBaseIndent.length > 0) { + // If the current line has at least the base indentation, preserve relative indentation + if (currentIndent.startsWith(newBaseIndent)) { + relativeIndent = currentIndent.substring(newBaseIndent.length); + } else { + // If current line has less indentation than base, use it as-is + relativeIndent = ''; + } + } + + // Convert spaces to tabs if original uses tabs + let convertedIndent = originalBaseIndent + relativeIndent; + if (originalUseTabs && !relativeIndent.includes('\t')) { + // Convert 4 spaces to 1 tab (common convention) + convertedIndent = convertedIndent.replace(/ /g, '\t'); + } + + // Apply converted indentation + trimmed content + return convertedIndent + line.trim(); + }); + + return result.join(lineEnding); + } + + /** + * Converts line endings in content to the specified line ending style + */ + private convertLineEndings(content: string, lineEnding: string): string { + // First normalize to LF + const normalized = content.replace(/\r\n/g, '\n').replace(/\r/g, '\n'); + + // Then convert to target line ending + if (lineEnding === '\r\n') { + return normalized.replace(/\n/g, '\r\n'); + } else if (lineEnding === '\r') { + return normalized.replace(/\n/g, '\r'); + } + return normalized; + } + + /** + * Truncates content for error messages to avoid overly long error messages + */ + private truncateForError(content: string, maxLength: number = 100): string { + if (content.length <= maxLength) { + return content; + } + + const half = Math.floor(maxLength / 2) - 3; // -3 for "..." + return content.substring(0, half) + '...' + content.substring(content.length - half); + } +} diff --git a/packages/core/src/common/content-replacer.spec.ts b/packages/core/src/common/content-replacer.spec.ts new file mode 100644 index 0000000..95a4c81 --- /dev/null +++ b/packages/core/src/common/content-replacer.spec.ts @@ -0,0 +1,124 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ** + +import { expect } from 'chai'; +import { ContentReplacerV1Impl, Replacement } from './content-replacer'; + +describe('ContentReplacerV1Impl', () => { + let contentReplacer: ContentReplacerV1Impl; + + before(() => { + contentReplacer = new ContentReplacerV1Impl(); + }); + + it('should replace content when oldContent matches exactly', () => { + const originalContent = 'Hello World!'; + const replacements: Replacement[] = [ + { oldContent: 'World', newContent: 'Universe' } + ]; + const expectedContent = 'Hello Universe!'; + const result = contentReplacer.applyReplacements(originalContent, replacements); + expect(result.updatedContent).to.equal(expectedContent); + expect(result.errors).to.be.empty; + }); + + it('should replace content when oldContent matches after trimming lines', () => { + const originalContent = 'Line one\n Line two \nLine three'; + const replacements: Replacement[] = [ + { oldContent: 'Line two', newContent: 'Second Line' } + ]; + const expectedContent = 'Line one\n Second Line \nLine three'; + const result = contentReplacer.applyReplacements(originalContent, replacements); + expect(result.updatedContent).to.equal(expectedContent); + expect(result.errors).to.be.empty; + }); + + it('should return an error when oldContent is not found', () => { + const originalContent = 'Sample content'; + const replacements: Replacement[] = [ + { oldContent: 'Nonexistent', newContent: 'Replacement' } + ]; + const result = contentReplacer.applyReplacements(originalContent, replacements); + expect(result.updatedContent).to.equal(originalContent); + expect(result.errors).to.include('Content to replace not found: "Nonexistent"'); + }); + + it('should return an error when oldContent has multiple occurrences', () => { + const originalContent = 'Repeat Repeat Repeat'; + const replacements: Replacement[] = [ + { oldContent: 'Repeat', newContent: 'Once' } + ]; + const result = contentReplacer.applyReplacements(originalContent, replacements); + expect(result.updatedContent).to.equal(originalContent); + expect(result.errors.some(candidate => candidate.startsWith('Multiple occurrences found for: "Repeat"'))).to.be.true; + }); + + it('should prepend newContent when oldContent is an empty string', () => { + const originalContent = 'Existing content'; + const replacements: Replacement[] = [ + { oldContent: '', newContent: 'Prepended content\n' } + ]; + const expectedContent = 'Prepended content\nExisting content'; + const result = contentReplacer.applyReplacements(originalContent, replacements); + expect(result.updatedContent).to.equal(expectedContent); + expect(result.errors).to.be.empty; + }); + + it('should handle multiple replacements correctly', () => { + const originalContent = 'Foo Bar Baz'; + const replacements: Replacement[] = [ + { oldContent: 'Foo', newContent: 'FooModified' }, + { oldContent: 'Bar', newContent: 'BarModified' }, + { oldContent: 'Baz', newContent: 'BazModified' } + ]; + const expectedContent = 'FooModified BarModified BazModified'; + const result = contentReplacer.applyReplacements(originalContent, replacements); + expect(result.updatedContent).to.equal(expectedContent); + expect(result.errors).to.be.empty; + }); + + it('should replace all occurrences when mutiple is true', () => { + const originalContent = 'Repeat Repeat Repeat'; + const replacements: Replacement[] = [ + { oldContent: 'Repeat', newContent: 'Once', multiple: true } + ]; + const expectedContent = 'Once Once Once'; + const result = contentReplacer.applyReplacements(originalContent, replacements); + expect(result.updatedContent).to.equal(expectedContent); + expect(result.errors).to.be.empty; + }); + + it('should return an error when mutiple is false and multiple occurrences are found', () => { + const originalContent = 'Repeat Repeat Repeat'; + const replacements: Replacement[] = [ + { oldContent: 'Repeat', newContent: 'Once', multiple: false } + ]; + const result = contentReplacer.applyReplacements(originalContent, replacements); + expect(result.updatedContent).to.equal(originalContent); + expect(result.errors.some(candidate => candidate.startsWith('Multiple occurrences found for: "Repeat"'))).to.be.true; + }); + + it('should return an error when conflicting replacements for the same oldContent are provided', () => { + const originalContent = 'Conflict test content'; + const replacements: Replacement[] = [ + { oldContent: 'test', newContent: 'test1' }, + { oldContent: 'test', newContent: 'test2' } + ]; + const result = contentReplacer.applyReplacements(originalContent, replacements); + expect(result.updatedContent).to.equal(originalContent); + expect(result.errors).to.include('Conflicting replacement values for: "test"'); + }); +}); diff --git a/packages/core/src/common/content-replacer.ts b/packages/core/src/common/content-replacer.ts new file mode 100644 index 0000000..b308fa0 --- /dev/null +++ b/packages/core/src/common/content-replacer.ts @@ -0,0 +1,162 @@ +// ***************************************************************************** +// Copyright (C) 2025 EclipseSource GmbH. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +export interface Replacement { + oldContent: string; + newContent: string; + multiple?: boolean; +} + +export interface ContentReplacer { + /** + * Applies a list of replacements to the original content using a multi-step matching strategy. + * @param originalContent The original file content. + * @param replacements Array of Replacement objects. + * @returns An object containing the updated content and any error messages. + */ + applyReplacements(originalContent: string, replacements: Replacement[]): { updatedContent: string, errors: string[] }; +} + +export class ContentReplacerV1Impl implements ContentReplacer { + /** + * Applies a list of replacements to the original content using a multi-step matching strategy. + * @param originalContent The original file content. + * @param replacements Array of Replacement objects. + * @param allowMultiple If true, all occurrences of each oldContent will be replaced. If false, an error is returned when multiple occurrences are found. + * @returns An object containing the updated content and any error messages. + */ + applyReplacements(originalContent: string, replacements: Replacement[]): { updatedContent: string, errors: string[] } { + let updatedContent = originalContent; + const errorMessages: string[] = []; + + // Guard against conflicting replacements: if the same oldContent appears with different newContent, return with an error. + const conflictMap = new Map(); + for (const replacement of replacements) { + if (conflictMap.has(replacement.oldContent) && conflictMap.get(replacement.oldContent) !== replacement.newContent) { + return { updatedContent: originalContent, errors: [`Conflicting replacement values for: "${replacement.oldContent}"`] }; + } + conflictMap.set(replacement.oldContent, replacement.newContent); + } + + replacements.forEach(({ oldContent, newContent, multiple }) => { + // If the old content is empty, prepend the new content to the beginning of the file (e.g. in new file) + if (oldContent === '') { + updatedContent = newContent + updatedContent; + return; + } + + let matchIndices = this.findExactMatches(updatedContent, oldContent); + + if (matchIndices.length === 0) { + matchIndices = this.findLineTrimmedMatches(updatedContent, oldContent); + } + + if (matchIndices.length === 0) { + errorMessages.push(`Content to replace not found: "${oldContent}"`); + } else if (matchIndices.length > 1) { + if (multiple) { + updatedContent = this.replaceContentAll(updatedContent, oldContent, newContent); + } else { + errorMessages.push(`Multiple occurrences found for: "${oldContent}". Set 'multiple' to true if multiple occurrences of the oldContent are expected to be\ + replaced at once.`); + } + } else { + updatedContent = this.replaceContentOnce(updatedContent, oldContent, newContent); + } + }); + + return { updatedContent, errors: errorMessages }; + } + + /** + * Finds all exact matches of a substring within a string. + * @param content The content to search within. + * @param search The substring to search for. + * @returns An array of starting indices where the exact substring is found. + */ + private findExactMatches(content: string, search: string): number[] { + const indices: number[] = []; + let startIndex = 0; + + while ((startIndex = content.indexOf(search, startIndex)) !== -1) { + indices.push(startIndex); + startIndex += search.length; + } + + return indices; + } + + /** + * Attempts to find matches by trimming whitespace from lines in the original content and the search string. + * @param content The original content. + * @param search The substring to search for, potentially with varying whitespace. + * @returns An array of starting indices where a trimmed match is found. + */ + private findLineTrimmedMatches(content: string, search: string): number[] { + const trimmedSearch = search.trim(); + const lines = content.split('\n'); + + for (let i = 0; i < lines.length; i++) { + const trimmedLine = lines[i].trim(); + if (trimmedLine === trimmedSearch) { + // Calculate the starting index of this line in the original content + const startIndex = this.getLineStartIndex(content, i); + return [startIndex]; + } + } + + return []; + } + + /** + * Calculates the starting index of a specific line number in the content. + * @param content The original content. + * @param lineNumber The zero-based line number. + * @returns The starting index of the specified line. + */ + private getLineStartIndex(content: string, lineNumber: number): number { + const lines = content.split('\n'); + let index = 0; + for (let i = 0; i < lineNumber; i++) { + index += lines[i].length + 1; // +1 for the newline character + } + return index; + } + + /** + * Replaces the first occurrence of oldContent with newContent in the content. + * @param content The original content. + * @param oldContent The content to be replaced. + * @param newContent The content to replace with. + * @returns The content after replacement. + */ + private replaceContentOnce(content: string, oldContent: string, newContent: string): string { + const index = content.indexOf(oldContent); + if (index === -1) { return content; } + return content.substring(0, index) + newContent + content.substring(index + oldContent.length); + } + + /** + * Replaces all occurrences of oldContent with newContent in the content. + * @param content The original content. + * @param oldContent The content to be replaced. + * @param newContent The content to replace with. + * @returns The content after all replacements. + */ + private replaceContentAll(content: string, oldContent: string, newContent: string): string { + return content.split(oldContent).join(newContent); + } +} diff --git a/packages/core/src/common/contribution-filter/contribution-filter-registry.ts b/packages/core/src/common/contribution-filter/contribution-filter-registry.ts new file mode 100644 index 0000000..829fb94 --- /dev/null +++ b/packages/core/src/common/contribution-filter/contribution-filter-registry.ts @@ -0,0 +1,79 @@ +// ***************************************************************************** +// Copyright (C) 2021 STMicroelectronics and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { injectable, multiInject, optional } from 'inversify'; +import { ContributionFilterRegistry, ContributionType, FilterContribution } from './contribution-filter'; +import { Filter } from './filter'; + +/** + * Registry of contribution filters. + * + * Implement/bind to the `FilterContribution` interface/symbol to register your contribution filters. + */ +@injectable() +export class ContributionFilterRegistryImpl implements ContributionFilterRegistry { + + protected initialized = false; + protected genericFilters: Filter[] = []; + protected typeToFilters = new Map[]>(); + + constructor( + @multiInject(FilterContribution) @optional() contributions: FilterContribution[] = [] + ) { + for (const contribution of contributions) { + contribution.registerContributionFilters(this); + } + this.initialized = true; + } + + addFilters(types: '*' | ContributionType[], filters: Filter[]): void { + if (this.initialized) { + throw new Error('cannot add filters after initialization is done.'); + } else if (types === '*') { + this.genericFilters.push(...filters); + } else { + for (const type of types) { + this.getOrCreate(type).push(...filters); + } + } + } + + applyFilters(toFilter: T[], type: ContributionType): T[] { + const filters = this.getFilters(type); + if (filters.length === 0) { + return toFilter; + } + return toFilter.filter( + object => filters.every(filter => filter(object)) + ); + } + + protected getOrCreate(type: ContributionType): Filter[] { + let value = this.typeToFilters.get(type); + if (value === undefined) { + this.typeToFilters.set(type, value = []); + } + return value; + } + + protected getFilters(type: ContributionType): Filter[] { + return [ + ...this.typeToFilters.get(type) || [], + ...this.genericFilters + ]; + } +} + diff --git a/packages/core/src/common/contribution-filter/contribution-filter.ts b/packages/core/src/common/contribution-filter/contribution-filter.ts new file mode 100644 index 0000000..baa9c0d --- /dev/null +++ b/packages/core/src/common/contribution-filter/contribution-filter.ts @@ -0,0 +1,64 @@ +// ***************************************************************************** +// Copyright (C) 2021 STMicroelectronics and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { interfaces } from 'inversify'; +import { Filter } from './filter'; + +// eslint-disable-next-line @typescript-eslint/no-explicit-any +export type ContributionType = interfaces.ServiceIdentifier; + +export const ContributionFilterRegistry = Symbol('ContributionFilterRegistry'); +export interface ContributionFilterRegistry { + + /** + * Add filters to be applied for every type of contribution. + */ + addFilters(types: '*', filters: Filter[]): void; + + /** + * Given a list of contribution types, register filters to apply. + * @param types types for which to register the filters. + */ + addFilters(types: ContributionType[], filters: Filter[]): void; + + /** + * Applies the filters for the given contribution type. Generic filters will be applied on any given type. + * @param toFilter the elements to filter + * @param type the contribution type for which potentially filters were registered + * @returns the filtered elements + */ + applyFilters(toFilter: T[], type: ContributionType): T[] +} + +export const FilterContribution = Symbol('FilterContribution'); +/** + * Register filters to remove contributions. + */ +export interface FilterContribution { + /** + * Use the registry to register your contribution filters. + * * Note that filtering contributions based on their class (constructor) name is discouraged. + * Class names are minified in production builds and therefore not reliable. + * Use instance of checks or direct constructor comparison instead: + * + * ```ts + * registry.addFilters('*', [ + * contrib => !(contrib instanceof SampleFilteredCommandContribution) + * ]); + * ``` + */ + registerContributionFilters(registry: ContributionFilterRegistry): void; +} diff --git a/packages/core/src/common/contribution-filter/filter.ts b/packages/core/src/common/contribution-filter/filter.ts new file mode 100644 index 0000000..7a15611 --- /dev/null +++ b/packages/core/src/common/contribution-filter/filter.ts @@ -0,0 +1,23 @@ +// ***************************************************************************** +// Copyright (C) 2021 STMicroelectronics and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +export const Filter = Symbol('Filter'); + +/** + * @param toTest Object that should be tested + * @returns `true` if the object passes the test, `false` otherwise. + */ +export type Filter = (toTest: T) => boolean; diff --git a/packages/core/src/common/contribution-filter/index.ts b/packages/core/src/common/contribution-filter/index.ts new file mode 100644 index 0000000..a03f24e --- /dev/null +++ b/packages/core/src/common/contribution-filter/index.ts @@ -0,0 +1,19 @@ +// ***************************************************************************** +// Copyright (C) 2021 STMicroelectronics and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +export * from './contribution-filter'; +export * from './contribution-filter-registry'; +export * from './filter'; diff --git a/packages/core/src/common/contribution-provider.ts b/packages/core/src/common/contribution-provider.ts new file mode 100644 index 0000000..e49f144 --- /dev/null +++ b/packages/core/src/common/contribution-provider.ts @@ -0,0 +1,96 @@ +// ***************************************************************************** +// Copyright (C) 2017 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { interfaces } from 'inversify'; +import { ContributionFilterRegistry } from './contribution-filter'; + +export const ContributionProvider = Symbol('ContributionProvider'); + +export interface ContributionProvider { + + /** + * @param recursive `true` if the contributions should be collected from the parent containers as well. Otherwise, `false`. It is `false` by default. + */ + getContributions(recursive?: boolean): T[] +} + +class ContainerBasedContributionProvider implements ContributionProvider { + + protected services: T[] | undefined; + + constructor( + protected readonly serviceIdentifier: interfaces.ServiceIdentifier, + protected readonly container: interfaces.Container + ) { } + + getContributions(recursive?: boolean): T[] { + if (this.services === undefined) { + const currentServices: T[] = []; + let filterRegistry: ContributionFilterRegistry | undefined; + let currentContainer: interfaces.Container | null = this.container; + // eslint-disable-next-line no-null/no-null + while (currentContainer !== null) { + if (currentContainer.isBound(this.serviceIdentifier)) { + try { + currentServices.push(...currentContainer.getAll(this.serviceIdentifier)); + } catch (error) { + console.error(error); + } + } + if (filterRegistry === undefined && currentContainer.isBound(ContributionFilterRegistry)) { + filterRegistry = currentContainer.get(ContributionFilterRegistry); + } + // eslint-disable-next-line no-null/no-null + currentContainer = recursive === true ? currentContainer.parent : null; + } + + this.services = filterRegistry ? filterRegistry.applyFilters(currentServices, this.serviceIdentifier) : currentServices; + + } + return this.services; + } +} + +export type Bindable = interfaces.Bind | interfaces.Container; +export namespace Bindable { + export function isContainer(arg: Bindable): arg is interfaces.Container { + return typeof arg !== 'function' + // https://github.com/eclipse-theia/theia/issues/3204#issue-371029654 + // In InversifyJS `4.14.0` containers no longer have a property `guid`. + && ('guid' in arg || 'parent' in arg); + } +} + +export function bindContributionProvider(bindable: Bindable, id: symbol): void { + const bindingToSyntax = (Bindable.isContainer(bindable) ? bindable.bind(ContributionProvider) : bindable(ContributionProvider)); + bindingToSyntax + .toDynamicValue(ctx => new ContainerBasedContributionProvider(id, ctx.container)) + .inSingletonScope().whenTargetNamed(id); +} + +/** + * Helper function to bind a service to a list of contributions easily. + * @param bindable a Container or the bind function directly. + * @param service an already bound service to refer the contributions to. + * @param contributions array of contribution identifiers to bind the service to. + */ +// eslint-disable-next-line @typescript-eslint/no-explicit-any +export function bindContribution(bindable: Bindable, service: interfaces.ServiceIdentifier, contributions: interfaces.ServiceIdentifier[]): void { + const bind: interfaces.Bind = Bindable.isContainer(bindable) ? bindable.bind.bind(bindable) : bindable; + for (const contribution of contributions) { + bind(contribution).toService(service); + } +} diff --git a/packages/core/src/common/core-preferences.ts b/packages/core/src/common/core-preferences.ts new file mode 100644 index 0000000..095b533 --- /dev/null +++ b/packages/core/src/common/core-preferences.ts @@ -0,0 +1,358 @@ +// ***************************************************************************** +// Copyright (C) 2018 Google and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { interfaces } from 'inversify'; +import { environment } from '@theia/application-package/lib/environment'; +import { SUPPORTED_ENCODINGS } from './supported-encodings'; +import { isOSX } from '../common/os'; +import { nls } from '../common/nls'; +import { PreferenceContribution, PreferenceSchema } from '../common/preferences/preference-schema'; +import { createPreferenceProxy, PreferenceProxy, PreferenceService } from '../common/preferences'; +import { PreferenceScope } from '../common/preferences/preference-scope'; + +/* eslint-disable max-len */ +const windowTitleDescription = [ + nls.localizeByDefault('Controls the window title based on the current context such as the opened workspace or active editor. Variables are substituted based on the context:'), + nls.localizeByDefault('`${activeEditorShort}`: the file name (e.g. myFile.txt).'), + nls.localizeByDefault('`${activeEditorMedium}`: the path of the file relative to the workspace folder (e.g. myFolder/myFileFolder/myFile.txt).'), + nls.localizeByDefault('`${activeEditorLong}`: the full path of the file (e.g. /Users/Development/myFolder/myFileFolder/myFile.txt).'), + nls.localizeByDefault('`${activeFolderShort}`: the name of the folder the file is contained in (e.g. myFileFolder).'), + nls.localizeByDefault('`${activeFolderMedium}`: the path of the folder the file is contained in, relative to the workspace folder (e.g. myFolder/myFileFolder).'), + nls.localizeByDefault('`${activeFolderLong}`: the full path of the folder the file is contained in (e.g. /Users/Development/myFolder/myFileFolder).'), + nls.localizeByDefault('`${folderName}`: name of the workspace folder the file is contained in (e.g. myFolder).'), + nls.localizeByDefault('`${folderPath}`: file path of the workspace folder the file is contained in (e.g. /Users/Development/myFolder).'), + nls.localizeByDefault('`${rootName}`: name of the workspace with optional remote name and workspace indicator if applicable (e.g. myFolder, myRemoteFolder [SSH] or myWorkspace (Workspace)).'), + nls.localizeByDefault('`${rootPath}`: file path of the opened workspace or folder (e.g. /Users/Development/myWorkspace).'), + nls.localizeByDefault('`${appName}`: e.g. VS Code.'), + nls.localizeByDefault('`${remoteName}`: e.g. SSH'), + nls.localizeByDefault('`${dirty}`: an indicator for when the active editor has unsaved changes.'), + nls.localizeByDefault('`${separator}`: a conditional separator (" - ") that only shows when surrounded by variables with values or static text.') +].join('\n- '); + +export const corePreferenceSchema: PreferenceSchema = { + properties: { + 'application.confirmExit': { + type: 'string', + enum: [ + 'never', + 'ifRequired', + 'always', + ], + default: 'ifRequired', + description: nls.localizeByDefault('Controls whether to show a confirmation dialog before closing the browser tab or window. Note that even if enabled, browsers may still decide to close a tab or window without confirmation and that this setting is only a hint that may not work in all cases.'), + }, + 'breadcrumbs.enabled': { + 'type': 'boolean', + 'default': true, + 'description': nls.localizeByDefault('Enable/disable navigation breadcrumbs.'), + 'scope': PreferenceScope.User + }, + 'files.encoding': { + 'type': 'string', + 'enum': Object.keys(SUPPORTED_ENCODINGS), + 'default': 'utf8', + 'description': nls.localizeByDefault( + 'The default character set encoding to use when reading and writing files. This setting can also be configured per language.'), + 'scope': PreferenceScope.Folder, + 'enumDescriptions': Object.keys(SUPPORTED_ENCODINGS).map(key => SUPPORTED_ENCODINGS[key].labelLong), + 'included': Object.keys(SUPPORTED_ENCODINGS).length > 1 + }, + 'keyboard.dispatch': { + type: 'string', + enum: [ + 'code', + 'keyCode', + ], + default: 'code', + markdownDescription: nls.localizeByDefault('Controls the dispatching logic for key presses to use either `code` (recommended) or `keyCode`.') + }, + 'window.tabbar.enhancedPreview': { + type: 'string', + enum: ['classic', 'enhanced', 'visual'], + markdownEnumDescriptions: [ + nls.localize('theia/core/enhancedPreview/classic', 'Display a simple preview of the tab with basic information.'), + nls.localize('theia/core/enhancedPreview/enhanced', 'Display an enhanced preview of the tab with additional information.'), + nls.localize('theia/core/enhancedPreview/visual', 'Display a visual preview of the tab.'), + ], + default: 'classic', + description: nls.localize('theia/core/enhancedPreview', 'Controls what information about the tab should be displayed in horizontal tab bars, when hovering.') + }, + 'window.menuBarVisibility': { + type: 'string', + enum: ['classic', 'visible', 'hidden', 'compact'], + markdownEnumDescriptions: [ + nls.localizeByDefault('Menu is displayed at the top of the window and only hidden in full screen mode.'), + nls.localizeByDefault('Menu is always visible at the top of the window even in full screen mode.'), + nls.localizeByDefault('Menu is always hidden.'), + environment.electron.is() + // we do not support the window.menuStyle setting yet, so we do not use the default string in this case yet + ? nls.localize('theia/core/window.menuBarVisibility', 'Menu is displayed as a compact button in the side bar. This value is ignored when {0} is {1}.', '`#window.titleBarStyle#`', '`native`') + : nls.localizeByDefault('Menu is displayed as a compact button in the side bar.') + ], + default: 'classic', + scope: PreferenceScope.User, + markdownDescription: nls.localizeByDefault("Control the visibility of the menu bar. A setting of 'toggle' means that the menu bar is hidden and a single press of the Alt key will show it. A setting of 'compact' will move the menu into the side bar."), + included: !(isOSX && environment.electron.is()) + }, + 'window.title': { + type: 'string', + default: isOSX + ? '${activeEditorShort}${separator}${rootName}' + : '${dirty} ${activeEditorShort}${separator}${rootName}${separator}${appName}', + scope: PreferenceScope.User, + markdownDescription: windowTitleDescription + }, + 'window.titleSeparator': { + type: 'string', + default: ' - ', + scope: PreferenceScope.User, + markdownDescription: nls.localizeByDefault('Separator used by {0}.', '`#window.title#`') + }, + 'window.tabCloseIconPlacement': { + type: 'string', + enum: ['end', 'start'], + enumDescriptions: [ + nls.localize('theia/core/window/tabCloseIconPlacement/end', 'Place the close icon at the end of the label. In left-to-right languages, this is the right side of the tab.'), + nls.localize('theia/core/window/tabCloseIconPlacement/start', 'Place the close icon at the start of the label. In left-to-right languages, this is the left side of the tab.'), + ], + default: 'end', + scope: PreferenceScope.User, + description: nls.localize('theia/core/window/tabCloseIconPlacement/description', 'Place the close icons on tab titles at the start or end of the tab. The default is end on all platforms.'), + included: isOSX + }, + 'window.secondaryWindowPlacement': { + type: 'string', + enum: ['originalSize', 'halfWidth', 'fullSize'], + enumDescriptions: [ + nls.localize('theia/core/secondaryWindow/originalSize', 'The position and size of the extracted widget will be the same as the original widget.'), + nls.localize('theia/core/secondaryWindow/halfWidth', 'The position and size of the extracted widget will be half the width of the running Theia application.'), + nls.localize('theia/core/secondaryWindow/fullSize', 'The position and size of the extracted widget will be the same as the running Theia application.'), + ], + default: 'originalSize', + description: nls.localize('theia/core/secondaryWindow/description', 'Sets the initial position and size of the extracted secondary window.'), + }, + 'window.secondaryWindowAlwaysOnTop': { + type: 'boolean', + default: false, + description: nls.localize('theia/core/secondaryWindow/alwaysOnTop', 'When enabled, the secondary window stays above all other windows, including those of different applications.'), + }, + 'http.proxy': { + type: 'string', + pattern: '^https?://([^:]*(:[^@]*)?@)?([^:]+|\\[[:0-9a-fA-F]+\\])(:\\d+)?/?$|^$', + markdownDescription: nls.localizeByDefault('The proxy setting to use. If not set, will be inherited from the `http_proxy` and `https_proxy` environment variables. When during [remote development](https://aka.ms/vscode-remote) the {0} setting is disabled this setting can be configured in the local and the remote settings separately.'), + scope: PreferenceScope.User + }, + 'http.proxyStrictSSL': { + type: 'boolean', + default: true, + description: nls.localizeByDefault('Controls whether the proxy server certificate should be verified against the list of supplied CAs. When during [remote development](https://aka.ms/vscode-remote) the {0} setting is disabled this setting can be configured in the local and the remote settings separately.'), + scope: PreferenceScope.User + }, + 'http.proxyAuthorization': { + type: 'string', + markdownDescription: nls.localizeByDefault('The value to send as the `Proxy-Authorization` header for every network request. When during [remote development](https://aka.ms/vscode-remote) the {0} setting is disabled this setting can be configured in the local and the remote settings separately.'), + scope: PreferenceScope.User + }, + 'http.proxySupport': { + type: 'string', + enum: ['off', 'on', 'fallback', 'override'], + enumDescriptions: [ + nls.localizeByDefault('Disable proxy support for extensions.'), + nls.localizeByDefault('Enable proxy support for extensions.'), + nls.localizeByDefault('Enable proxy support for extensions, fall back to request options, when no proxy found.'), + nls.localizeByDefault('Enable proxy support for extensions, override request options.'), + ], + default: 'override', + description: nls.localizeByDefault('Use the proxy support for extensions. When during [remote development](https://aka.ms/vscode-remote) the {0} setting is disabled this setting can be configured in the local and the remote settings separately.'), + scope: PreferenceScope.User + }, + 'http.systemCertificates': { + type: 'boolean', + default: true, + description: nls.localizeByDefault('Controls whether CA certificates should be loaded from the OS. On Windows and macOS, a reload of the window is required after turning this off. When during [remote development](https://aka.ms/vscode-remote) the {0} setting is disabled this setting can be configured in the local and the remote settings separately.'), + scope: PreferenceScope.User + }, + 'workbench.list.openMode': { + type: 'string', + enum: [ + 'singleClick', + 'doubleClick' + ], + default: 'singleClick', + description: nls.localizeByDefault('Controls how to open items in trees and lists using the mouse (if supported). Note that some trees and lists might choose to ignore this setting if it is not applicable.') + }, + 'workbench.editor.highlightModifiedTabs': { + 'type': 'boolean', + 'markdownDescription': nls.localize('theia/core/highlightModifiedTabs', 'Controls whether a top border is drawn on modified (dirty) editor tabs or not.'), + 'default': false + }, + 'workbench.editor.closeOnFileDelete': { + 'type': 'boolean', + 'description': nls.localizeByDefault('Controls whether editors showing a file that was opened during the session should close automatically when getting deleted or renamed by some other process. Disabling this will keep the editor open on such an event. Note that deleting from within the application will always close the editor and that editors with unsaved changes will never close to preserve your data.'), + 'default': false + }, + 'workbench.editor.mouseBackForwardToNavigate': { + 'type': 'boolean', + 'description': nls.localizeByDefault("Enables the use of mouse buttons four and five for commands 'Go Back' and 'Go Forward'."), + 'default': true + }, + 'workbench.editor.revealIfOpen': { + 'type': 'boolean', + 'description': nls.localizeByDefault('Controls whether an editor is revealed in any of the visible groups if opened. If disabled, an editor will prefer to open in the currently active editor group. If enabled, an already opened editor will be revealed instead of opened again in the currently active editor group. Note that there are some cases where this setting is ignored, such as when forcing an editor to open in a specific group or to the side of the currently active group.'), + 'default': false + }, + 'workbench.editor.decorations.badges': { + 'type': 'boolean', + 'description': nls.localizeByDefault('Controls whether editor file decorations should use badges.'), + 'default': true + }, + 'workbench.commandPalette.history': { + type: 'number', + default: 50, + minimum: 0, + description: nls.localizeByDefault('Controls the number of recently used commands to keep in history for the command palette. Set to 0 to disable command history.') + }, + 'workbench.colorTheme': { + type: 'string', + enum: ['dark', 'light', 'hc-theia'], + enumItemLabels: ['Dark (Theia)', 'Light (Theia)', 'High Contrast (Theia)'], + default: 'light', + description: nls.localizeByDefault('Specifies the color theme used in the workbench when {0} is not enabled.', '`#window.autoDetectColorScheme#`') + }, + 'workbench.iconTheme': { + type: ['string'], + enum: ['none', 'theia-file-icons'], + enumItemLabels: [nls.localizeByDefault('None'), 'File Icons (Theia)'], + default: 'none', + description: nls.localizeByDefault("Specifies the file icon theme used in the workbench or 'null' to not show any file icons.") + }, + 'workbench.silentNotifications': { + type: 'boolean', + default: false, + description: nls.localize('theia/core/silentNotifications', 'Controls whether to suppress notification popups.') + }, + 'workbench.statusBar.visible': { + type: 'boolean', + default: true, + description: nls.localizeByDefault('Controls the visibility of the status bar at the bottom of the workbench.') + }, + 'workbench.tree.renderIndentGuides': { + type: 'string', + enum: ['onHover', 'none', 'always'], + default: 'onHover', + description: nls.localizeByDefault('Controls whether the tree should render indent guides.') + }, + 'workbench.hover.delay': { + type: 'number', + default: isOSX ? 1500 : 500, + description: nls.localizeByDefault('Controls the delay in milliseconds after which the hover is shown.') + }, + 'workbench.sash.hoverDelay': { + type: 'number', + default: 300, + minimum: 0, + maximum: 2000, + description: nls.localizeByDefault('Controls the hover feedback delay in milliseconds of the dragging area in between views/editors.') + }, + 'workbench.sash.size': { + type: 'number', + default: 4, + minimum: 1, + maximum: 20, + description: nls.localizeByDefault('Controls the feedback area size in pixels of the dragging area in between views/editors. Set it to a larger value if you feel it\'s hard to resize views using the mouse.') + }, + 'workbench.tab.maximize': { + type: 'boolean', + default: false, + description: nls.localize('theia/core/tabMaximize', 'Controls whether to maximize tabs on double click.') + }, + 'workbench.tab.shrinkToFit.enabled': { + type: 'boolean', + default: false, + description: nls.localize('theia/core/tabShrinkToFit', 'Shrink tabs to fit available space.') + }, + 'workbench.tab.shrinkToFit.minimumSize': { + type: 'number', + default: 50, + minimum: 10, + description: nls.localize('theia/core/tabMinimumSize', 'Specifies the minimum size for tabs.') + }, + 'workbench.tab.shrinkToFit.defaultSize': { + type: 'number', + default: 200, + minimum: 10, + description: nls.localize('theia/core/tabDefaultSize', 'Specifies the default size for tabs.') + }, + 'workbench.editorAssociations': { + type: 'object', + markdownDescription: nls.localizeByDefault('Configure [glob patterns](https://aka.ms/vscode-glob-patterns) to editors (for example `"*.hex": "hexEditor.hexedit"`). These have precedence over the default behavior.'), + patternProperties: { + '.*': { + type: 'string' + } + } + } + } +}; + +export interface CoreConfiguration { + 'application.confirmExit': 'never' | 'ifRequired' | 'always'; + 'breadcrumbs.enabled': boolean; + 'files.encoding': string; + 'keyboard.dispatch': 'code' | 'keyCode'; + 'window.tabbar.enhancedPreview': 'classic' | 'enhanced' | 'visual'; + 'window.menuBarVisibility': 'classic' | 'visible' | 'hidden' | 'compact'; + 'window.title': string; + 'window.titleSeparator': string; + 'window.tabCloseIconPlacement': 'end' | 'start'; + 'workbench.list.openMode': 'singleClick' | 'doubleClick'; + 'workbench.commandPalette.history': number; + 'workbench.editor.highlightModifiedTabs': boolean; + 'workbench.editor.mouseBackForwardToNavigate': boolean; + 'workbench.editor.closeOnFileDelete': boolean; + 'workbench.editor.revealIfOpen': boolean; + 'workbench.editor.decorations.badges': boolean; + 'workbench.colorTheme': string; + 'workbench.iconTheme': string; + 'workbench.silentNotifications': boolean; + 'workbench.statusBar.visible': boolean; + 'workbench.tree.renderIndentGuides': 'onHover' | 'none' | 'always'; + 'workbench.hover.delay': number; + 'workbench.sash.hoverDelay': number; + 'workbench.sash.size': number; + 'workbench.tab.maximize': boolean; + 'workbench.tab.shrinkToFit.enabled': boolean; + 'workbench.tab.shrinkToFit.minimumSize': number; + 'workbench.tab.shrinkToFit.defaultSize': number; +} + +export const CorePreferenceContribution = Symbol('CorePreferenceContribution'); +export const CorePreferences = Symbol('CorePreferences'); +export type CorePreferences = PreferenceProxy; + +export function createCorePreferences(preferences: PreferenceService, schema: PreferenceSchema = corePreferenceSchema): CorePreferences { + return createPreferenceProxy(preferences, schema); +} + +export function bindCorePreferences(bind: interfaces.Bind): void { + bind(CorePreferences).toDynamicValue(ctx => { + const preferences = ctx.container.get(PreferenceService); + const contribution = ctx.container.get(CorePreferenceContribution); + return createCorePreferences(preferences, contribution.schema); + }).inSingletonScope(); + bind(CorePreferenceContribution).toConstantValue({ schema: corePreferenceSchema }); + bind(PreferenceContribution).toService(CorePreferenceContribution); +} diff --git a/packages/core/src/common/diff.ts b/packages/core/src/common/diff.ts new file mode 100644 index 0000000..1fde924 --- /dev/null +++ b/packages/core/src/common/diff.ts @@ -0,0 +1,56 @@ +// ***************************************************************************** +// Copyright (C) 2025 1C-Soft LLC and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { Range } from 'vscode-languageserver-protocol'; +import { CancellationToken } from './cancellation'; +import URI from './uri'; + +/** Represents a textual diff. */ +export interface Diff { + readonly changes: readonly DetailedLineRangeMapping[]; +} + +export interface DetailedLineRangeMapping extends LineRangeMapping { + readonly innerChanges?: readonly RangeMapping[]; +} + +export interface LineRangeMapping { + readonly left: LineRange; + readonly right: LineRange; +} + +/** Represents a range of whole lines of text. */ +export interface LineRange { + /** A zero-based number of the start line. */ + readonly start: number; + /** A zero-based number of the end line, exclusive. */ + readonly end: number; +} + +export interface RangeMapping { + readonly left: Range; + readonly right: Range; +} + +export const DiffComputer = Symbol('DiffComputer'); + +export interface DiffComputer { + computeDiff(left: URI, right: URI, options?: DiffComputerOptions): Promise; +} + +export interface DiffComputerOptions { + readonly cancellationToken?: CancellationToken; +} diff --git a/packages/core/src/common/disposable.spec.ts b/packages/core/src/common/disposable.spec.ts new file mode 100644 index 0000000..e80d83b --- /dev/null +++ b/packages/core/src/common/disposable.spec.ts @@ -0,0 +1,94 @@ +// ***************************************************************************** +// Copyright (C) 2022 Ericsson and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { expect, spy, use } from 'chai'; +import { DisposableCollection, Disposable } from './disposable'; +import * as spies from 'chai-spies'; + +use(spies); + +describe('Disposables', () => { + it('Is safe to use Disposable.NULL', () => { + const collectionA = new DisposableCollection(Disposable.NULL); + const collectionB = new DisposableCollection(Disposable.NULL); + expect(!collectionA.disposed && !collectionB.disposed, 'Neither should be disposed before either is disposed.').to.be.true; + collectionA.dispose(); + expect(collectionA.disposed, 'A should be disposed after being disposed.').to.be.true; + expect(collectionB.disposed, 'B should not be disposed because A was disposed.').to.be.false; + }); + + it('Collection is auto-pruned when an element is disposed', () => { + const onDispose = spy(() => { }); + const elementDispose = () => { }; + + const collection = new DisposableCollection(); + collection.onDispose(onDispose); + + const disposable1 = Disposable.create(elementDispose); + collection.push(disposable1); + expect(collection['disposables']).to.have.lengthOf(1); + + const disposable2 = Disposable.create(elementDispose); + collection.push(disposable2); + expect(collection['disposables']).to.have.lengthOf(2); + + disposable1.dispose(); + expect(collection['disposables']).to.have.lengthOf(1); + expect(onDispose).to.have.not.been.called(); + expect(collection.disposed).is.false; + + // Test that calling dispose on an already disposed element doesn't + // alter the collection state + disposable1.dispose(); + expect(collection['disposables']).to.have.lengthOf(1); + expect(onDispose).to.have.not.been.called(); + expect(collection.disposed).is.false; + + disposable2.dispose(); + expect(collection['disposables']).to.be.empty; + expect(collection.disposed).is.true; + expect(onDispose).to.have.been.called.once; + }); + + it('onDispose is only called once on actual disposal of elements', () => { + const onDispose = spy(() => { }); + const elementDispose = spy(() => { }); + + const collection = new DisposableCollection(); + collection.onDispose(onDispose); + + // if the collection is empty 'onDispose' is not called + collection.dispose(); + expect(onDispose).to.not.have.been.called(); + + // 'onDispose' is called because we actually dispose an element + collection.push(Disposable.create(elementDispose)); + collection.dispose(); + expect(elementDispose).to.have.been.called.once; + expect(onDispose).to.have.been.called.once; + + // if the collection is empty 'onDispose' is not called and no further element is disposed + collection.dispose(); + expect(elementDispose).to.have.been.called.once; + expect(onDispose).to.have.been.called.once; + + // 'onDispose' is not called again even if we actually dispose an element + collection.push(Disposable.create(elementDispose)); + collection.dispose(); + expect(elementDispose).to.have.been.called.twice; + expect(onDispose).to.have.been.called.once; + }); +}); diff --git a/packages/core/src/common/disposable.ts b/packages/core/src/common/disposable.ts new file mode 100644 index 0000000..3eb7765 --- /dev/null +++ b/packages/core/src/common/disposable.ts @@ -0,0 +1,188 @@ +// ***************************************************************************** +// Copyright (C) 2017 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { Event, Emitter } from './event'; +import { isFunction, isObject } from './types'; + +export interface Disposable { + /** + * Dispose this object. + */ + dispose(): void; +} + +export namespace Disposable { + export function is(arg: unknown): arg is Disposable { + return isObject(arg) && isFunction(arg.dispose); + } + export function create(func: () => void): Disposable { + return { dispose: func }; + } + /** Always provides a reference to a new disposable. */ + export declare const NULL: Disposable; +} + +/** + * Ensures that every reference to {@link Disposable.NULL} returns a new object, + * as sharing a disposable between multiple {@link DisposableCollection} can have unexpected side effects + */ +Object.defineProperty(Disposable, 'NULL', { + configurable: false, + enumerable: true, + get(): Disposable { + return { dispose: () => { } }; + } +}); + +/** + * Utility for tracking a collection of Disposable objects. + * + * This utility provides a number of benefits over just using an array of + * Disposables: + * + * - the collection is auto-pruned when an element it contains is disposed by + * any code that has a reference to it + * - you can register to be notified when all elements in the collection have + * been disposed [1] + * - you can conveniently dispose all elements by calling dispose() + * on the collection + * + * Unlike an array, however, this utility does not give you direct access to + * its elements. + * + * Being notified when all elements are disposed is simple: + * ``` + * const dc = new DisposableCollection(myDisposables); + * dc.onDispose(() => { + * console.log('All elements in the collection have been disposed'); + * }); + * ``` + * + * [1] The collection will notify only once. It will continue to function in so + * far as accepting new Disposables and pruning them when they are disposed, but + * such activity will never result in another notification. + */ +export class DisposableCollection implements Disposable { + + protected readonly disposables: Disposable[] = []; + protected readonly onDisposeEmitter = new Emitter(); + + constructor(...toDispose: Disposable[]) { + toDispose.forEach(d => this.push(d)); + } + + /** + * This event is fired only once + * on first dispose of not empty collection. + */ + get onDispose(): Event { + return this.onDisposeEmitter.event; + } + + protected checkDisposed(): void { + if (this.disposed && !this.disposingElements) { + this.onDisposeEmitter.fire(undefined); + this.onDisposeEmitter.dispose(); + } + } + + get disposed(): boolean { + return this.disposables.length === 0; + } + + private disposingElements = false; + dispose(): void { + if (this.disposed || this.disposingElements) { + return; + } + this.disposingElements = true; + while (!this.disposed) { + try { + this.disposables.pop()!.dispose(); + } catch (e) { + console.error(e); + } + } + this.disposingElements = false; + this.checkDisposed(); + } + + push(disposable: Disposable): Disposable { + const disposables = this.disposables; + disposables.push(disposable); + const originalDispose = disposable.dispose.bind(disposable); + const toRemove = Disposable.create(() => { + const index = disposables.indexOf(disposable); + if (index !== -1) { + disposables.splice(index, 1); + } + this.checkDisposed(); + }); + disposable.dispose = () => { + toRemove.dispose(); + disposable.dispose = originalDispose; + originalDispose(); + }; + return toRemove; + } + + pushAll(disposables: Disposable[]): Disposable[] { + return disposables.map(disposable => + this.push(disposable) + ); + } + +} + +export type DisposableGroup = { push(disposable: Disposable): void } | { add(disposable: Disposable): void }; +export namespace DisposableGroup { + export function canPush(candidate?: DisposableGroup): candidate is { push(disposable: Disposable): void } { + return Boolean(candidate && (candidate as { push(): void }).push); + } + export function canAdd(candidate?: DisposableGroup): candidate is { add(disposable: Disposable): void } { + return Boolean(candidate && (candidate as { add(): void }).add); + } +} + +export function disposableTimeout(...args: Parameters): Disposable { + const handle = setTimeout(...args); + return { dispose: () => clearTimeout(handle) }; +} + +/** + * Wrapper for a {@link Disposable} that is not available immediately. + */ +export class DisposableWrapper implements Disposable { + + private disposed = false; + private disposable: Disposable | undefined = undefined; + + set(disposable: Disposable): void { + if (this.disposed) { + disposable.dispose(); + } else { + this.disposable = disposable; + } + } + + dispose(): void { + this.disposed = true; + if (this.disposable) { + this.disposable.dispose(); + this.disposable = undefined; + } + } +} diff --git a/packages/core/src/common/encoding-service.ts b/packages/core/src/common/encoding-service.ts new file mode 100644 index 0000000..1e4aaaf --- /dev/null +++ b/packages/core/src/common/encoding-service.ts @@ -0,0 +1,380 @@ +// ***************************************************************************** +// Copyright (C) 2020 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +// based on https://github.com/microsoft/vscode/blob/04c36be045a94fee58e5f8992d3e3fd980294a84/src/vs/workbench/services/textfile/common/encoding.ts + +/* eslint-disable no-null/no-null */ + +import * as iconv from 'iconv-lite'; +import { Buffer } from 'safer-buffer'; +import { injectable } from 'inversify'; +import { BinaryBuffer, BinaryBufferReadableStream, BinaryBufferReadable } from './buffer'; +import { UTF8, UTF8_with_bom, UTF16be, UTF16le, UTF16be_BOM, UTF16le_BOM, UTF8_BOM } from './encodings'; +import { newWriteableStream, ReadableStream, Readable } from './stream'; + +const ZERO_BYTE_DETECTION_BUFFER_MAX_LEN = 512; // number of bytes to look at to decide about a file being binary or not +const NO_ENCODING_GUESS_MIN_BYTES = 512; // when not auto guessing the encoding, small number of bytes are enough +const AUTO_ENCODING_GUESS_MIN_BYTES = 512 * 8; // with auto guessing we want a lot more content to be read for guessing +const AUTO_ENCODING_GUESS_MAX_BYTES = 512 * 128; // set an upper limit for the number of bytes we pass on to jschardet + +// we explicitly ignore a specific set of encodings from auto guessing +// - ASCII: we never want this encoding (most UTF-8 files would happily detect as +// ASCII files and then you could not type non-ASCII characters anymore) +// - UTF-16: we have our own detection logic for UTF-16 +// - UTF-32: we do not support this encoding in VSCode +const IGNORE_ENCODINGS = ['ascii', 'utf-16', 'utf-32']; + +export interface ResourceEncoding { + encoding: string + hasBOM: boolean +} + +export interface DetectedEncoding { + encoding?: string + seemsBinary?: boolean +} + +export interface DecodeStreamOptions { + guessEncoding?: boolean; + minBytesRequiredForDetection?: number; + + overwriteEncoding(detectedEncoding: string | undefined): Promise; +} +export interface DecodeStreamResult { + stream: ReadableStream; + detected: DetectedEncoding; +} + +@injectable() +export class EncodingService { + + encode(value: string, options?: ResourceEncoding): BinaryBuffer { + let encoding = options?.encoding; + const addBOM = options?.hasBOM; + encoding = this.toIconvEncoding(encoding); + if (encoding === UTF8 && !addBOM) { + return BinaryBuffer.fromString(value); + } + const buffer = iconv.encode(value, encoding, { addBOM }); + return BinaryBuffer.wrap(buffer); + } + + decode(value: BinaryBuffer, encoding?: string): string { + const buffer = Buffer.from(value.buffer); + encoding = this.toIconvEncoding(encoding); + return iconv.decode(buffer, encoding); + } + + exists(encoding: string): boolean { + encoding = this.toIconvEncoding(encoding); + return iconv.encodingExists(encoding); + } + + toIconvEncoding(encoding?: string): string { + if (encoding === UTF8_with_bom || !encoding) { + return UTF8; // iconv does not distinguish UTF 8 with or without BOM, so we need to help it + } + return encoding; + } + + async toResourceEncoding(encoding: string, options: { + overwriteEncoding?: boolean, + read: (length: number) => Promise + }): Promise { + // Some encodings come with a BOM automatically + if (encoding === UTF16be || encoding === UTF16le || encoding === UTF8_with_bom) { + return { encoding, hasBOM: true }; + } + + // Ensure that we preserve an existing BOM if found for UTF8 + // unless we are instructed to overwrite the encoding + const overwriteEncoding = options?.overwriteEncoding; + if (!overwriteEncoding && encoding === UTF8) { + try { + // stream here to avoid fetching the whole content on write + const buffer = await options.read(UTF8_BOM.length); + if (this.detectEncodingByBOMFromBuffer(Buffer.from(buffer), buffer.byteLength) === UTF8_with_bom) { + return { encoding, hasBOM: true }; + } + } catch (error) { + // ignore - file might not exist + } + } + + return { encoding, hasBOM: false }; + } + + async detectEncoding(data: BinaryBuffer, autoGuessEncoding?: boolean): Promise { + const buffer = Buffer.from(data.buffer); + const bytesRead = data.byteLength; + // Always first check for BOM to find out about encoding + let encoding = this.detectEncodingByBOMFromBuffer(buffer, bytesRead); + + // Detect 0 bytes to see if file is binary or UTF-16 LE/BEÏ + // unless we already know that this file has a UTF-16 encoding + let seemsBinary = false; + if (encoding !== UTF16be && encoding !== UTF16le && buffer) { + let couldBeUTF16LE = true; // e.g. 0xAA 0x00 + let couldBeUTF16BE = true; // e.g. 0x00 0xAA + let containsZeroByte = false; + + // This is a simplified guess to detect UTF-16 BE or LE by just checking if + // the first 512 bytes have the 0-byte at a specific location. For UTF-16 LE + // this would be the odd byte index and for UTF-16 BE the even one. + // Note: this can produce false positives (a binary file that uses a 2-byte + // encoding of the same format as UTF-16) and false negatives (a UTF-16 file + // that is using 4 bytes to encode a character). + for (let i = 0; i < bytesRead && i < ZERO_BYTE_DETECTION_BUFFER_MAX_LEN; i++) { + const isEndian = (i % 2 === 1); // assume 2-byte sequences typical for UTF-16 + const isZeroByte = (buffer.readUInt8(i) === 0); + + if (isZeroByte) { + containsZeroByte = true; + } + + // UTF-16 LE: expect e.g. 0xAA 0x00 + if (couldBeUTF16LE && (isEndian && !isZeroByte || !isEndian && isZeroByte)) { + couldBeUTF16LE = false; + } + + // UTF-16 BE: expect e.g. 0x00 0xAA + if (couldBeUTF16BE && (isEndian && isZeroByte || !isEndian && !isZeroByte)) { + couldBeUTF16BE = false; + } + + // Return if this is neither UTF16-LE nor UTF16-BE and thus treat as binary + if (isZeroByte && !couldBeUTF16LE && !couldBeUTF16BE) { + break; + } + } + + // Handle case of 0-byte included + if (containsZeroByte) { + if (couldBeUTF16LE) { + encoding = UTF16le; + } else if (couldBeUTF16BE) { + encoding = UTF16be; + } else { + seemsBinary = true; + } + } + } + + // Auto guess encoding if configured + if (autoGuessEncoding && !seemsBinary && !encoding && buffer) { + const guessedEncoding = await this.guessEncodingByBuffer(buffer.slice(0, bytesRead)); + return { + seemsBinary: false, + encoding: guessedEncoding + }; + } + + return { seemsBinary, encoding }; + } + + protected detectEncodingByBOMFromBuffer(buffer: Buffer, bytesRead: number): typeof UTF8_with_bom | typeof UTF16le | typeof UTF16be | undefined { + if (!buffer || bytesRead < UTF16be_BOM.length) { + return undefined; + } + + const b0 = buffer.readUInt8(0); + const b1 = buffer.readUInt8(1); + + // UTF-16 BE + if (b0 === UTF16be_BOM[0] && b1 === UTF16be_BOM[1]) { + return UTF16be; + } + + // UTF-16 LE + if (b0 === UTF16le_BOM[0] && b1 === UTF16le_BOM[1]) { + return UTF16le; + } + + if (bytesRead < UTF8_BOM.length) { + return undefined; + } + + const b2 = buffer.readUInt8(2); + + // UTF-8 + if (b0 === UTF8_BOM[0] && b1 === UTF8_BOM[1] && b2 === UTF8_BOM[2]) { + return UTF8_with_bom; + } + + return undefined; + } + + protected async guessEncodingByBuffer(buffer: Buffer): Promise { + const jschardet = await import('jschardet'); + + const guessed = jschardet.detect(buffer.slice(0, AUTO_ENCODING_GUESS_MAX_BYTES)); // ensure to limit buffer for guessing due to https://github.com/aadsm/jschardet/issues/53 + if (!guessed || !guessed.encoding) { + return undefined; + } + + const enc = guessed.encoding.toLowerCase(); + if (0 <= IGNORE_ENCODINGS.indexOf(enc)) { + return undefined; // see comment above why we ignore some encodings + } + + return this.toIconvEncoding(guessed.encoding); + } + + decodeStream(source: BinaryBufferReadableStream, options: DecodeStreamOptions): Promise { + const minBytesRequiredForDetection = options.minBytesRequiredForDetection ?? options.guessEncoding ? AUTO_ENCODING_GUESS_MIN_BYTES : NO_ENCODING_GUESS_MIN_BYTES; + + return new Promise((resolve, reject) => { + const target = newWriteableStream(strings => strings.join('')); + + const bufferedChunks: BinaryBuffer[] = []; + let bytesBuffered = 0; + + let decoder: iconv.DecoderStream | undefined = undefined; + + const createDecoder = async () => { + try { + + // detect encoding from buffer + const detected = await this.detectEncoding(BinaryBuffer.concat(bufferedChunks), options.guessEncoding); + + // ensure to respect overwrite of encoding + detected.encoding = await options.overwriteEncoding(detected.encoding); + + // decode and write buffered content + decoder = iconv.getDecoder(this.toIconvEncoding(detected.encoding)); + const decoded = decoder.write(Buffer.from(BinaryBuffer.concat(bufferedChunks).buffer)); + target.write(decoded); + + bufferedChunks.length = 0; + bytesBuffered = 0; + + // signal to the outside our detected encoding and final decoder stream + resolve({ + stream: target, + detected + }); + } catch (error) { + reject(error); + } + }; + + // Stream error: forward to target + source.on('error', error => target.error(error)); + + // Stream data + source.on('data', async chunk => { + + // if the decoder is ready, we just write directly + if (decoder) { + target.write(decoder.write(Buffer.from(chunk.buffer))); + } else { + bufferedChunks.push(chunk); + bytesBuffered += chunk.byteLength; + + // buffered enough data for encoding detection, create stream + if (bytesBuffered >= minBytesRequiredForDetection) { + + // pause stream here until the decoder is ready + source.pause(); + + await createDecoder(); + + // resume stream now that decoder is ready but + // outside of this stack to reduce recursion + setTimeout(() => source.resume()); + } + } + }); + + // Stream end + source.on('end', async () => { + + // we were still waiting for data to do the encoding + // detection. thus, wrap up starting the stream even + // without all the data to get things going + if (!decoder) { + await createDecoder(); + } + + // end the target with the remainders of the decoder + target.end(decoder?.end()); + }); + }); + } + + encodeStream(value: string | Readable, options?: ResourceEncoding): Promise; + encodeStream(value?: string | Readable, options?: ResourceEncoding): Promise; + async encodeStream(value: string | Readable | undefined, options?: ResourceEncoding): Promise { + let encoding = options?.encoding; + const addBOM = options?.hasBOM; + encoding = this.toIconvEncoding(encoding); + if (encoding === UTF8 && !addBOM) { + return value === undefined ? undefined : typeof value === 'string' ? + BinaryBuffer.fromString(value) : BinaryBufferReadable.fromReadable(value); + } + + value = value || ''; + const readable = typeof value === 'string' ? Readable.fromString(value) : value; + const encoder = iconv.getEncoder(encoding, { addBOM }); + + let bytesWritten = false; + let done = false; + + return { + read(): BinaryBuffer | null { + if (done) { + return null; + } + + const chunk = readable.read(); + if (typeof chunk !== 'string') { + done = true; + + // If we are instructed to add a BOM but we detect that no + // bytes have been written, we must ensure to return the BOM + // ourselves so that we comply with the contract. + if (!bytesWritten && addBOM) { + switch (encoding) { + case UTF8: + case UTF8_with_bom: + return BinaryBuffer.wrap(Uint8Array.from(UTF8_BOM)); + case UTF16be: + return BinaryBuffer.wrap(Uint8Array.from(UTF16be_BOM)); + case UTF16le: + return BinaryBuffer.wrap(Uint8Array.from(UTF16le_BOM)); + } + } + + const leftovers = encoder.end(); + if (leftovers && leftovers.length > 0) { + bytesWritten = true; + return BinaryBuffer.wrap(leftovers); + } + + return null; + } + + bytesWritten = true; + + return BinaryBuffer.wrap(encoder.write(chunk)); + } + }; + } + +} diff --git a/packages/core/src/common/encodings.ts b/packages/core/src/common/encodings.ts new file mode 100644 index 0000000..50fecb1 --- /dev/null +++ b/packages/core/src/common/encodings.ts @@ -0,0 +1,24 @@ +// ***************************************************************************** +// Copyright (C) 2020 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +export const UTF8 = 'utf8'; +export const UTF8_with_bom = 'utf8bom'; +export const UTF16be = 'utf16be'; +export const UTF16le = 'utf16le'; + +export const UTF16be_BOM = [0xFE, 0xFF]; +export const UTF16le_BOM = [0xFF, 0xFE]; +export const UTF8_BOM = [0xEF, 0xBB, 0xBF]; diff --git a/packages/core/src/common/env-variables/env-variables-protocol.ts b/packages/core/src/common/env-variables/env-variables-protocol.ts new file mode 100644 index 0000000..73d5a3f --- /dev/null +++ b/packages/core/src/common/env-variables/env-variables-protocol.ts @@ -0,0 +1,38 @@ +// ***************************************************************************** +// Copyright (C) 2018 Red Hat, Inc. and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +export const envVariablesPath = '/services/envs'; + +export const EnvVariablesServer = Symbol('EnvVariablesServer'); +export interface EnvVariablesServer { + getExecPath(): Promise + getVariables(): Promise + getValue(key: string): Promise + getConfigDirUri(): Promise; + /** + * Resolves to a URI representing the current user's home directory. + */ + getHomeDirUri(): Promise; + /** + * Resolves to an array of URIs pointing to the available drives on the filesystem. + */ + getDrives(): Promise; +} + +export interface EnvVariable { + readonly name: string + readonly value: string | undefined +} diff --git a/packages/core/src/common/env-variables/index.ts b/packages/core/src/common/env-variables/index.ts new file mode 100644 index 0000000..d13510f --- /dev/null +++ b/packages/core/src/common/env-variables/index.ts @@ -0,0 +1,17 @@ +// ***************************************************************************** +// Copyright (C) 2018 Red Hat, Inc. and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +export * from './env-variables-protocol'; diff --git a/packages/core/src/common/event.spec.ts b/packages/core/src/common/event.spec.ts new file mode 100644 index 0000000..040c1bd --- /dev/null +++ b/packages/core/src/common/event.spec.ts @@ -0,0 +1,32 @@ +// ***************************************************************************** +// Copyright (C) 2018 Ericsson and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { expect } from 'chai'; +import { Emitter } from './event'; + +describe('Event Objects', () => { + + it('Emitter firing should be synchronous', () => { + const emitter = new Emitter(); + let counter = 0; + + emitter.event(() => counter++); + expect(counter).eq(0); + emitter.fire(undefined); + expect(counter).eq(1); + }); + +}); diff --git a/packages/core/src/common/event.ts b/packages/core/src/common/event.ts new file mode 100644 index 0000000..94912d7 --- /dev/null +++ b/packages/core/src/common/event.ts @@ -0,0 +1,493 @@ +// ***************************************************************************** +// Copyright (C) 2017 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +/* eslint-disable @typescript-eslint/no-explicit-any */ + +import { Disposable, DisposableGroup, DisposableCollection } from './disposable'; +import { MaybePromise } from './types'; + +/** + * Represents a typed event. + */ +export interface Event { + + /** + * + * @param listener The listener function will be call when the event happens. + * @param thisArgs The 'this' which will be used when calling the event listener. + * @param disposables An array to which a {{IDisposable}} will be added. + * @return a disposable to remove the listener again. + */ + (listener: (e: T) => any, thisArgs?: any, disposables?: DisposableGroup): Disposable; +} + +export namespace Event { + const _disposable = { dispose(): void { } }; + export function getMaxListeners(event: Event): number { + const { maxListeners } = event as any; + return typeof maxListeners === 'number' ? maxListeners : 0; + } + export function setMaxListeners(event: Event, maxListeners: N): N { + if (typeof (event as any).maxListeners === 'number') { + return (event as any).maxListeners = maxListeners; + } + return maxListeners; + } + export function addMaxListeners(event: Event, add: number): number { + if (typeof (event as any).maxListeners === 'number') { + return (event as any).maxListeners += add; + } + return add; + } + export const None: Event = Object.assign(function (): { dispose(): void } { return _disposable; }, { + get maxListeners(): number { return 0; }, + set maxListeners(maxListeners: number) { } + }); + + /** + * Given an event, returns another event which only fires once. + */ + export function once(event: Event): Event { + return (listener, thisArgs = undefined, disposables?) => { + // we need this, in case the event fires during the listener call + let didFire = false; + let result: Disposable | undefined = undefined; + result = event(e => { + if (didFire) { + return; + } else if (result) { + result.dispose(); + } else { + didFire = true; + } + + return listener.call(thisArgs, e); + }, undefined, disposables); + + if (didFire) { + result.dispose(); + } + + return result; + }; + } + + export function toPromise(event: Event): Promise { + return new Promise(resolve => once(event)(resolve)); + } + + export function filter(event: Event, predicate: (e: T) => unknown): Event; + export function filter(event: Event, predicate: (e: T) => e is S): Event; + export function filter(event: Event, predicate: (e: T) => unknown): Event { + return (listener, thisArg, disposables) => event(e => predicate(e) && listener.call(thisArg, e), undefined, disposables); + } + + /** + * Given an event and a `map` function, returns another event which maps each element + * through the mapping function. + */ + export function map(event: Event, mapFunc: (i: I) => O): Event { + return Object.assign((listener: (e: O) => any, thisArgs?: any, disposables?: Disposable[]) => event(i => listener.call(thisArgs, mapFunc(i)), undefined, disposables), { + get maxListeners(): number { return 0; }, + set maxListeners(maxListeners: number) { } + }); + } + + /** + * Given a collection of events, returns a single event which emits whenever any of the provided events emit. + */ + export function any(...events: Event[]): Event; + export function any(...events: Event[]): Event; + export function any(...events: Event[]): Event { + return (listener, thisArgs = undefined, disposables?: Disposable[]) => + new DisposableCollection(...events.map(event => event(e => listener.call(thisArgs, e), undefined, disposables))); + } +} + +type Callback = (...args: any[]) => any; +class CallbackList implements Iterable { + + private _callbacks: Function[] | undefined; + private _contexts: any[] | undefined; + + get length(): number { + return this._callbacks && this._callbacks.length || 0; + } + + public add(callback: Function, context: any = undefined, bucket?: Disposable[]): void { + if (!this._callbacks) { + this._callbacks = []; + this._contexts = []; + } + this._callbacks.push(callback); + this._contexts!.push(context); + + if (Array.isArray(bucket)) { + bucket.push({ dispose: () => this.remove(callback, context) }); + } + } + + public remove(callback: Function, context: any = undefined): void { + if (!this._callbacks) { + return; + } + + let foundCallbackWithDifferentContext = false; + for (let i = 0; i < this._callbacks.length; i++) { + if (this._callbacks[i] === callback) { + if (this._contexts![i] === context) { + // callback & context match => remove it + this._callbacks.splice(i, 1); + this._contexts!.splice(i, 1); + return; + } else { + foundCallbackWithDifferentContext = true; + } + } + } + + if (foundCallbackWithDifferentContext) { + throw new Error('When adding a listener with a context, you should remove it with the same context'); + } + } + + // tslint:disable-next-line:typedef + public [Symbol.iterator]() { + if (!this._callbacks) { + return [][Symbol.iterator](); + } + const callbacks = this._callbacks.slice(0); + const contexts = this._contexts!.slice(0); + + return callbacks.map((callback, i) => + (...args: any[]) => callback.apply(contexts[i], args) + )[Symbol.iterator](); + } + + public invoke(...args: any[]): any[] { + const ret: any[] = []; + for (const callback of this) { + try { + ret.push(callback(...args)); + } catch (e) { + console.error(e); + } + } + return ret; + } + + public isEmpty(): boolean { + return !this._callbacks || this._callbacks.length === 0; + } + + public dispose(): void { + this._callbacks = undefined; + this._contexts = undefined; + } +} + +export interface EmitterOptions { + onFirstListenerAdd?: Function; + onLastListenerRemove?: Function; +} + +export class Emitter { + + private static LEAK_WARNING_THRESHHOLD = 175; + + private static _noop = function (): void { }; + + private _event: Event; + protected _callbacks: CallbackList | undefined; + private _disposed = false; + + private _leakingStacks: Map | undefined; + private _leakWarnCountdown = 0; + + constructor( + private _options?: EmitterOptions + ) { } + + /** + * For the public to allow to subscribe + * to events from this Emitter + */ + get event(): Event { + if (!this._event) { + this._event = Object.assign((listener: (e: T) => any, thisArgs?: any, disposables?: DisposableGroup) => { + if (!this._callbacks) { + this._callbacks = new CallbackList(); + } + if (this._options && this._options.onFirstListenerAdd && this._callbacks.isEmpty()) { + this._options.onFirstListenerAdd(this); + } + this._callbacks.add(listener, thisArgs); + const removeMaxListenersCheck = this.checkMaxListeners(Event.getMaxListeners(this._event)); + + const result: Disposable = { + dispose: () => { + if (removeMaxListenersCheck) { + removeMaxListenersCheck(); + } + result.dispose = Emitter._noop; + if (!this._disposed) { + this._callbacks!.remove(listener, thisArgs); + result.dispose = Emitter._noop; + if (this._options && this._options.onLastListenerRemove && this._callbacks!.isEmpty()) { + this._options.onLastListenerRemove(this); + } + } + } + }; + if (DisposableGroup.canPush(disposables)) { + disposables.push(result); + } else if (DisposableGroup.canAdd(disposables)) { + disposables.add(result); + } + + return result; + }, { + maxListeners: Emitter.LEAK_WARNING_THRESHHOLD + }); + } + return this._event; + } + + protected checkMaxListeners(maxListeners: number): (() => void) | undefined { + if (maxListeners === 0 || !this._callbacks) { + return undefined; + } + const listenerCount = this._callbacks.length; + if (listenerCount <= maxListeners) { + return undefined; + } + + const popStack = this.pushLeakingStack(); + + this._leakWarnCountdown -= 1; + if (this._leakWarnCountdown <= 0) { + // only warn on first exceed and then every time the limit + // is exceeded by 50% again + this._leakWarnCountdown = maxListeners * 0.5; + + let topStack: string; + let topCount = 0; + this._leakingStacks!.forEach((stackCount, stack) => { + if (!topStack || topCount < stackCount) { + topStack = stack; + topCount = stackCount; + } + }); + + // eslint-disable-next-line max-len + console.warn(`Possible Emitter memory leak detected. ${listenerCount} listeners added. Use event.maxListeners to increase the limit (${maxListeners}). MOST frequent listener (${topCount}):`); + console.warn(topStack!); + } + + return popStack; + } + + protected pushLeakingStack(): () => void { + if (!this._leakingStacks) { + this._leakingStacks = new Map(); + } + const stack = new Error().stack!.split('\n').slice(3).join('\n'); + const count = (this._leakingStacks.get(stack) || 0); + this._leakingStacks.set(stack, count + 1); + return () => this.popLeakingStack(stack); + } + + protected popLeakingStack(stack: string): void { + if (!this._leakingStacks) { + return; + } + const count = (this._leakingStacks.get(stack) || 0); + this._leakingStacks.set(stack, count - 1); + } + + /** + * To be kept private to fire an event to + * subscribers + */ + fire(event: T): any { + if (this._callbacks) { + return this._callbacks.invoke(event); + } + } + + /** + * Process each listener one by one. + * Return `false` to stop iterating over the listeners, `true` to continue. + */ + async sequence(processor: (listener: (e: T) => any) => MaybePromise): Promise { + if (this._callbacks) { + for (const listener of this._callbacks) { + if (!await processor(listener)) { + break; + } + } + } + } + + dispose(): void { + if (this._leakingStacks) { + this._leakingStacks.clear(); + this._leakingStacks = undefined; + } + if (this._callbacks) { + this._callbacks.dispose(); + this._callbacks = undefined; + } + this._disposed = true; + } +} + +export type WaitUntilData = Omit; + +export interface WaitUntilEvent { + /** + * A cancellation token. + */ + token: CancellationToken; + /** + * Allows to pause the event loop until the provided thenable resolved. + * + * *Note:* It can only be called during event dispatch and not in an asynchronous manner + * + * @param thenable A thenable that delays execution. + */ + waitUntil(thenable: Promise): void; +} +export namespace WaitUntilEvent { + /** + * Fire all listeners in the same tick. + * + * Use `AsyncEmitter.fire` to fire listeners async one after another. + */ + export async function fire( + emitter: Emitter, + event: WaitUntilData, + timeout?: number, + token = CancellationToken.None + ): Promise { + const waitables: Promise[] = []; + const asyncEvent = Object.assign(event, { + token, + waitUntil: (thenable: Promise) => { + if (Object.isFrozen(waitables)) { + throw new Error('waitUntil cannot be called asynchronously.'); + } + waitables.push(thenable); + } + }) as T; + try { + emitter.fire(asyncEvent); + // Asynchronous calls to `waitUntil` should fail. + Object.freeze(waitables); + } finally { + delete (asyncEvent as any)['waitUntil']; + } + if (!waitables.length) { + return; + } + if (timeout !== undefined) { + await Promise.race([Promise.all(waitables), new Promise(resolve => setTimeout(resolve, timeout))]); + } else { + await Promise.all(waitables); + } + } +} + +import { CancellationToken } from './cancellation'; + +export class AsyncEmitter extends Emitter { + + protected deliveryQueue: Promise | undefined; + + /** + * Fire listeners async one after another. + */ + override fire(event: WaitUntilData, token: CancellationToken = CancellationToken.None, + promiseJoin?: (p: Promise, listener: Function) => Promise): Promise { + const callbacks = this._callbacks; + if (!callbacks) { + return Promise.resolve(); + } + const listeners = [...callbacks]; + if (this.deliveryQueue) { + return this.deliveryQueue = this.deliveryQueue.then(() => this.deliver(listeners, event, token, promiseJoin)); + } + return this.deliveryQueue = this.deliver(listeners, event, token, promiseJoin); + } + + protected async deliver(listeners: Callback[], event: WaitUntilData, token: CancellationToken, + promiseJoin?: (p: Promise, listener: Function) => Promise): Promise { + for (const listener of listeners) { + if (token.isCancellationRequested) { + return; + } + const waitables: Promise[] = []; + const asyncEvent = Object.assign(event, { + token, + waitUntil: (thenable: Promise) => { + if (Object.isFrozen(waitables)) { + throw new Error('waitUntil cannot be called asynchronously.'); + } + if (promiseJoin) { + thenable = promiseJoin(thenable, listener); + } + waitables.push(thenable); + } + }) as T; + try { + listener(event); + // Asynchronous calls to `waitUntil` should fail. + Object.freeze(waitables); + } catch (e) { + console.error(e); + } finally { + delete (asyncEvent as any)['waitUntil']; + } + if (!waitables.length) { + continue; + } + try { + await Promise.all(waitables); + } catch (e) { + console.error(e); + } + } + } + +} + +export class QueueableEmitter extends Emitter { + + currentQueue?: T[]; + + queue(...arg: T[]): void { + if (!this.currentQueue) { + this.currentQueue = []; + } + this.currentQueue.push(...arg); + } + + override fire(): void { + super.fire(this.currentQueue || []); + this.currentQueue = undefined; + } + +} diff --git a/packages/core/src/common/file-uri.ts b/packages/core/src/common/file-uri.ts new file mode 100644 index 0000000..f92af9f --- /dev/null +++ b/packages/core/src/common/file-uri.ts @@ -0,0 +1,61 @@ +// ***************************************************************************** +// Copyright (C) 2017 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { URI as Uri } from 'vscode-uri'; +import URI from './uri'; +import { isWindows } from './os'; + +export namespace FileUri { + + const windowsDriveRegex = /^([^:/?#]+?):$/; + + /** + * Creates a new file URI from the filesystem path argument. + * @param fsPath the filesystem path. + */ + export function create(fsPath_: string): URI { + return new URI(Uri.file(fsPath_)); + } + + /** + * Returns with the platform specific FS path that is represented by the URI argument. + * + * @param uri the file URI that has to be resolved to a platform specific FS path. + */ + export function fsPath(uri: URI | string): string { + if (typeof uri === 'string') { + return fsPath(new URI(uri)); + } else { + /* + * A uri for the root of a Windows drive, eg file:\\\c%3A, is converted to c: + * by the Uri class. However file:\\\c%3A is unambiguously a uri to the root of + * the drive and c: is interpreted as the default directory for the c drive + * (by, for example, the readdir function in the fs-extra module). + * A backslash must be appended to the drive, eg c:\, to ensure the correct path. + */ + // eslint-disable-next-line @typescript-eslint/no-explicit-any + const fsPathFromVsCodeUri = (uri as any).codeUri.fsPath; + if (isWindows) { + const isWindowsDriveRoot = windowsDriveRegex.exec(fsPathFromVsCodeUri); + if (isWindowsDriveRoot) { + return fsPathFromVsCodeUri + '\\'; + } + } + return fsPathFromVsCodeUri; + } + } + +} diff --git a/packages/core/src/common/frontend-application-state.ts b/packages/core/src/common/frontend-application-state.ts new file mode 100644 index 0000000..55feff9 --- /dev/null +++ b/packages/core/src/common/frontend-application-state.ts @@ -0,0 +1,38 @@ +// ***************************************************************************** +// Copyright (C) 2022 Ericsson and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +export type FrontendApplicationState = + 'init' + | 'started_contributions' + | 'attached_shell' + | 'initialized_layout' + | 'ready' + | 'closing_window'; + +export enum StopReason { + /** + * Closing the window with no prospect of restart. + */ + Close, + /** + * Reload without closing the window. + */ + Reload, + /** + * Reload that includes closing the window. + */ + Restart, +} diff --git a/packages/core/src/common/glob.ts b/packages/core/src/common/glob.ts new file mode 100644 index 0000000..1676fc4 --- /dev/null +++ b/packages/core/src/common/glob.ts @@ -0,0 +1,741 @@ +// ***************************************************************************** +// Copyright (C) 2018 Red Hat, Inc. and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** +// copied from https://github.com/Microsoft/vscode/blob/bf7ac9201e7a7d01741d4e6e64b5dc9f3197d97b/src/vs/base/common/glob.ts +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +'use strict'; + +import * as strings from './strings'; +import * as paths from './paths'; +import { CharCode } from './char-code'; + +/* eslint-disable @typescript-eslint/no-shadow, no-null/no-null */ +export interface IExpression { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + [pattern: string]: boolean | SiblingClause | any; +} + +export interface IRelativePattern { + base: string; + pattern: string; + pathToRelative(from: string, to: string): string; +} + +export function getEmptyExpression(): IExpression { + return Object.create(null); +} + +export interface SiblingClause { + when: string; +} + +const GLOBSTAR = '**'; +const GLOB_SPLIT = '/'; +const PATH_REGEX = '[/\\\\]'; // any slash or backslash +const NO_PATH_REGEX = '[^/\\\\]'; // any non-slash and non-backslash +const ALL_FORWARD_SLASHES = /\//g; + +function starsToRegExp(starCount: number): string { + switch (starCount) { + case 0: + return ''; + case 1: + return `${NO_PATH_REGEX}*?`; // 1 star matches any number of characters except path separator (/ and \) - non greedy (?) + default: + // Matches: (Path Sep OR Path Val followed by Path Sep OR Path Sep followed by Path Val) 0-many times + // Group is non capturing because we don't need to capture at all (?:...) + // Overall we use non-greedy matching because it could be that we match too much + return `(?:${PATH_REGEX}|${NO_PATH_REGEX}+${PATH_REGEX}|${PATH_REGEX}${NO_PATH_REGEX}+)*?`; + } +} + +export function splitGlobAware(pattern: string, splitChar: string): string[] { + if (!pattern) { + return []; + } + + const segments: string[] = []; + + let inBraces = false; + let inBrackets = false; + + let char: string; + let curVal = ''; + for (let i = 0; i < pattern.length; i++) { + char = pattern[i]; + + switch (char) { + case splitChar: + if (!inBraces && !inBrackets) { + segments.push(curVal); + curVal = ''; + + continue; + } + break; + case '{': + inBraces = true; + break; + case '}': + inBraces = false; + break; + case '[': + inBrackets = true; + break; + case ']': + inBrackets = false; + break; + } + + curVal += char; + } + + // Tail + if (curVal) { + segments.push(curVal); + } + + return segments; +} + +function parseRegExp(pattern: string): string { + if (!pattern) { + return ''; + } + + let regEx = ''; + + // Split up into segments for each slash found + // eslint-disable-next-line prefer-const + let segments = splitGlobAware(pattern, GLOB_SPLIT); + + // Special case where we only have globstars + if (segments.every(s => s === GLOBSTAR)) { + regEx = '.*'; + } + + // Build regex over segments + // tslint:disable-next-line:one-line + else { + let previousSegmentWasGlobStar = false; + segments.forEach((segment, index) => { + + // Globstar is special + if (segment === GLOBSTAR) { + + // if we have more than one globstar after another, just ignore it + if (!previousSegmentWasGlobStar) { + regEx += starsToRegExp(2); + previousSegmentWasGlobStar = true; + } + + return; + } + + // States + let inBraces = false; + let braceVal = ''; + + let inBrackets = false; + let bracketVal = ''; + + let char: string; + for (let i = 0; i < segment.length; i++) { + char = segment[i]; + + // Support brace expansion + if (char !== '}' && inBraces) { + braceVal += char; + continue; + } + + // Support brackets + if (inBrackets && (char !== ']' || !bracketVal) /* ] is literally only allowed as first character in brackets to match it */) { + let res: string; + + // range operator + if (char === '-') { + res = char; + } + + // negation operator (only valid on first index in bracket) + // tslint:disable-next-line:one-line + else if ((char === '^' || char === '!') && !bracketVal) { + res = '^'; + } + + // glob split matching is not allowed within character ranges + // see http://man7.org/linux/man-pages/man7/glob.7.html + // tslint:disable-next-line:one-line + else if (char === GLOB_SPLIT) { + res = ''; + } + + // anything else gets escaped + // tslint:disable-next-line:one-line + else { + res = strings.escapeRegExpCharacters(char); + } + + bracketVal += res; + continue; + } + + switch (char) { + case '{': + inBraces = true; + continue; + + case '[': + inBrackets = true; + continue; + + case '}': + // eslint-disable-next-line prefer-const + let choices = splitGlobAware(braceVal, ','); + + // Converts {foo,bar} => [foo|bar] + // eslint-disable-next-line prefer-const + let braceRegExp = `(?:${choices.map(c => parseRegExp(c)).join('|')})`; + + regEx += braceRegExp; + + inBraces = false; + braceVal = ''; + + break; + + case ']': + regEx += ('[' + bracketVal + ']'); + + inBrackets = false; + bracketVal = ''; + + break; + + case '?': + regEx += NO_PATH_REGEX; // 1 ? matches any single character except path separator (/ and \) + continue; + + case '*': + regEx += starsToRegExp(1); + continue; + + default: + regEx += strings.escapeRegExpCharacters(char); + } + } + + // Tail: Add the slash we had split on if there is more to come and the remaining pattern is not a globstar + // For example if pattern: some/**/*.js we want the "/" after some to be included in the RegEx to prevent + // a folder called "something" to match as well. + // However, if pattern: some/**, we tolerate that we also match on "something" because our globstar behavior + // is to match 0-N segments. + if (index < segments.length - 1 && (segments[index + 1] !== GLOBSTAR || index + 2 < segments.length)) { + regEx += PATH_REGEX; + } + + // reset state + previousSegmentWasGlobStar = false; + }); + } + + return regEx; +} + +// regexes to check for trivial glob patterns that just check for String#endsWith +const T1 = /^\*\*\/\*\.[\w\.-]+$/; // **/*.something +const T2 = /^\*\*\/([\w\.-]+)\/?$/; // **/something +const T3 = /^{\*\*\/[\*\.]?[\w\.-]+\/?(,\*\*\/[\*\.]?[\w\.-]+\/?)*}$/; // {**/*.something,**/*.else} or {**/package.json,**/project.json} +const T3_2 = /^{\*\*\/[\*\.]?[\w\.-]+(\/(\*\*)?)?(,\*\*\/[\*\.]?[\w\.-]+(\/(\*\*)?)?)*}$/; // Like T3, with optional trailing /** +const T4 = /^\*\*((\/[\w\.-]+)+)\/?$/; // **/something/else +const T5 = /^([\w\.-]+(\/[\w\.-]+)*)\/?$/; // something/else + +export type ParsedPattern = (path: string, basename?: string) => boolean; + +// The ParsedExpression returns a Promise iff hasSibling returns a Promise. +// eslint-disable-next-line max-len +export type ParsedExpression = (path: string, basename?: string, hasSibling?: (name: string) => boolean | Promise) => string | Promise /* the matching pattern */; + +export interface IGlobOptions { + /** + * Simplify patterns for use as exclusion filters during tree traversal to skip entire subtrees. Cannot be used outside of a tree traversal. + */ + trimForExclusions?: boolean; +} + +interface ParsedStringPattern { + (path: string, basename: string): string | Promise /* the matching pattern */; + basenames?: string[]; + patterns?: string[]; + allBasenames?: string[]; + allPaths?: string[]; +} +interface ParsedExpressionPattern { + (path: string, basename: string, name: string, hasSibling: (name: string) => boolean | Promise): string | Promise /* the matching pattern */; + requiresSiblings?: boolean; + allBasenames?: string[]; + allPaths?: string[]; +} + +const CACHE = new Map(); // new LRUCache(10000); // bounded to 10000 elements + +const FALSE = function (): boolean { + return false; +}; + +const NULL = function (): string { + return null!; +}; + +function parsePattern(arg1: string | IRelativePattern, options: IGlobOptions): ParsedStringPattern { + if (!arg1) { + return NULL; + } + + // Handle IRelativePattern + let pattern: string; + if (typeof arg1 !== 'string') { + pattern = arg1.pattern; + } else { + pattern = arg1; + } + + // Whitespace trimming + pattern = pattern.trim(); + + // Check cache + const patternKey = `${pattern}_${!!options.trimForExclusions}`; + let parsedPattern = CACHE.get(patternKey); + if (parsedPattern) { + return wrapRelativePattern(parsedPattern, arg1); + } + + // Check for Trivias + let match: RegExpExecArray; + if (T1.test(pattern)) { // common pattern: **/*.txt just need endsWith check + const base = pattern.substring(4); // '**/*'.length === 4 + parsedPattern = function (path, basename): string { + return path && strings.endsWith(path, base) ? pattern : null!; + }; + } else if (match = T2.exec(trimForExclusions(pattern, options))!) { // common pattern: **/some.txt just need basename check + parsedPattern = trivia2(match[1], pattern); + } else if ((options.trimForExclusions ? T3_2 : T3).test(pattern)) { // repetition of common patterns (see above) {**/*.txt,**/*.png} + parsedPattern = trivia3(pattern, options); + } else if (match = T4.exec(trimForExclusions(pattern, options))!) { // common pattern: **/something/else just need endsWith check + parsedPattern = trivia4and5(match[1].substring(1), pattern, true); + } else if (match = T5.exec(trimForExclusions(pattern, options))!) { // common pattern: something/else just need equals check + parsedPattern = trivia4and5(match[1], pattern, false); + } + + // Otherwise convert to pattern + // tslint:disable-next-line:one-line + else { + parsedPattern = toRegExp(pattern); + } + + // Cache + CACHE.set(patternKey, parsedPattern); + + return wrapRelativePattern(parsedPattern, arg1); +} + +function wrapRelativePattern(parsedPattern: ParsedStringPattern, arg2: string | IRelativePattern): ParsedStringPattern { + if (typeof arg2 === 'string') { + return parsedPattern; + } + + return function (path, basename): string | Promise { + if (!paths.isEqualOrParent(path, arg2.base)) { + return null!; + } + + return parsedPattern(paths.normalize(arg2.pathToRelative(arg2.base, path)), basename); + }; +} + +function trimForExclusions(pattern: string, options: IGlobOptions): string { + return options.trimForExclusions && strings.endsWith(pattern, '/**') ? pattern.substring(0, pattern.length - 2) : pattern; // dropping **, tailing / is dropped later +} + +// common pattern: **/some.txt just need basename check +function trivia2(base: string, originalPattern: string): ParsedStringPattern { + const slashBase = `/${base}`; + const backslashBase = `\\${base}`; + const parsedPattern: ParsedStringPattern = function (path, basename): string { + if (!path) { + return null!; + } + if (basename) { + return basename === base ? originalPattern : null!; + } + return path === base || strings.endsWith(path, slashBase) || strings.endsWith(path, backslashBase) ? originalPattern : null!; + }; + const basenames = [base]; + parsedPattern.basenames = basenames; + parsedPattern.patterns = [originalPattern]; + parsedPattern.allBasenames = basenames; + return parsedPattern; +} + +// repetition of common patterns (see above) {**/*.txt,**/*.png} +function trivia3(pattern: string, options: IGlobOptions): ParsedStringPattern { + const parsedPatterns = aggregateBasenameMatches(pattern.slice(1, -1).split(',') + .map(pattern => parsePattern(pattern, options)) + .filter(pattern => pattern !== NULL), pattern); + const n = parsedPatterns.length; + if (!n) { + return NULL; + } + if (n === 1) { + return parsedPatterns[0]; + } + const parsedPattern: ParsedStringPattern = function (path: string, basename: string): string { + for (let i = 0, n = parsedPatterns.length; i < n; i++) { + if ((parsedPatterns[i])(path, basename)) { + return pattern; + } + } + return null!; + }; + const withBasenames = parsedPatterns.find(pattern => !!(pattern).allBasenames); + // const withBasenames = arrays.first(parsedPatterns, pattern => !!(pattern).allBasenames); + if (withBasenames) { + parsedPattern.allBasenames = (withBasenames).allBasenames; + } + const allPaths = parsedPatterns.reduce((all, current) => current.allPaths ? all.concat(current.allPaths) : all, []); + if (allPaths.length) { + parsedPattern.allPaths = allPaths; + } + return parsedPattern; +} + +// common patterns: **/something/else just need endsWith check, something/else just needs and equals check +function trivia4and5(path: string, pattern: string, matchPathEnds: boolean): ParsedStringPattern { + const nativePath = paths.nativeSep !== paths.sep ? path.replace(ALL_FORWARD_SLASHES, paths.nativeSep) : path; + const nativePathEnd = paths.nativeSep + nativePath; + // eslint-disable-next-line @typescript-eslint/no-shadow + const parsedPattern: ParsedStringPattern = matchPathEnds ? function (path, basename): string { + return path && (path === nativePath || strings.endsWith(path, nativePathEnd)) ? pattern : null!; + // eslint-disable-next-line @typescript-eslint/no-shadow + } : function (path, basename): string { + return path && path === nativePath ? pattern : null!; + }; + parsedPattern.allPaths = [(matchPathEnds ? '*/' : './') + path]; + return parsedPattern; +} + +function toRegExp(pattern: string): ParsedStringPattern { + try { + const regExp = new RegExp(`^${parseRegExp(pattern)}$`); + return function (path: string, basename: string): string { + regExp.lastIndex = 0; // reset RegExp to its initial state to reuse it! + return path && regExp.test(path) ? pattern : null!; + }; + } catch (error) { + return NULL; + } +} + +/** + * Simplified glob matching. Supports a subset of glob patterns: + * - `*` matches anything inside a path segment + * - `?` matches 1 character inside a path segment + * - `**` matches anything including an empty path segment + * - simple brace expansion (`{js,ts}` => js or ts) + * - character ranges (using [...]) + */ +export function match(pattern: string | IRelativePattern, path: string): boolean; +export function match(expression: IExpression, path: string, hasSibling?: (name: string) => boolean): string /* the matching pattern */; +// eslint-disable-next-line @typescript-eslint/no-explicit-any +export function match(arg1: string | IExpression | IRelativePattern, path: string, hasSibling?: (name: string) => boolean): any { + if (!arg1 || !path) { + return false; + } + + return parse(arg1)(path, undefined, hasSibling); +} + +/** + * Simplified glob matching. Supports a subset of glob patterns: + * - * matches anything inside a path segment + * - ? matches 1 character inside a path segment + * - ** matches anything including an empty path segment + * - simple brace expansion ({js,ts} => js or ts) + * - character ranges (using [...]) + */ +export function parse(pattern: string | IRelativePattern, options?: IGlobOptions): ParsedPattern; +export function parse(expression: IExpression, options?: IGlobOptions): ParsedExpression; +// eslint-disable-next-line @typescript-eslint/no-explicit-any +export function parse(arg1: string | IExpression | IRelativePattern, options: IGlobOptions = {}): any { + if (!arg1) { + return FALSE; + } + + // Glob with String + if (typeof arg1 === 'string' || isRelativePattern(arg1)) { + const parsedPattern = parsePattern(arg1 as string | IRelativePattern, options); + if (parsedPattern === NULL) { + return FALSE; + } + const resultPattern = function (path: string, basename: string): boolean { + return !!parsedPattern(path, basename); + }; + if (parsedPattern.allBasenames) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (resultPattern).allBasenames = parsedPattern.allBasenames; + } + if (parsedPattern.allPaths) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (resultPattern).allPaths = parsedPattern.allPaths; + } + return resultPattern; + } + + // Glob with Expression + return parsedExpression(arg1, options); +} + +export function hasSiblingPromiseFn(siblingsFn?: () => Promise): ((name: string) => Promise) | undefined { + if (!siblingsFn) { + return undefined; + } + + let siblings: Promise>; + return (name: string) => { + if (!siblings) { + siblings = (siblingsFn() || Promise.resolve([])) + .then(list => list ? listToMap(list) : {}); + } + return siblings.then(map => !!map[name]); + }; +} + +export function hasSiblingFn(siblingsFn?: () => string[]): ((name: string) => boolean) | undefined { + if (!siblingsFn) { + return undefined; + } + + let siblings: Record; + return (name: string) => { + if (!siblings) { + const list = siblingsFn(); + siblings = list ? listToMap(list) : {}; + } + return !!siblings[name]; + }; +} + +function listToMap(list: string[]): Record { + const map: Record = {}; + for (const key of list) { + map[key] = true; + } + return map; +} + +export function isRelativePattern(obj: unknown): obj is IRelativePattern { + const rp = obj as IRelativePattern; + + return !!rp && typeof rp === 'object' && typeof rp.base === 'string' && typeof rp.pattern === 'string' && typeof rp.pathToRelative === 'function'; +} + +/** + * Same as `parse`, but the ParsedExpression is guaranteed to return a Promise + */ +export function parseToAsync(expression: IExpression, options?: IGlobOptions): ParsedExpression { + // eslint-disable-next-line @typescript-eslint/no-shadow + const parsedExpression = parse(expression, options); + return (path: string, basename?: string, hasSibling?: (name: string) => boolean | Promise): string | Promise => { + const result = parsedExpression(path, basename, hasSibling); + return result instanceof Promise ? result : Promise.resolve(result); + }; +} + +export function getBasenameTerms(patternOrExpression: ParsedPattern | ParsedExpression): string[] { + return (patternOrExpression).allBasenames || []; +} + +export function getPathTerms(patternOrExpression: ParsedPattern | ParsedExpression): string[] { + return (patternOrExpression).allPaths || []; +} + +function parsedExpression(expression: IExpression, options: IGlobOptions): ParsedExpression { + const parsedPatterns = aggregateBasenameMatches(Object.getOwnPropertyNames(expression) + .map(pattern => parseExpressionPattern(pattern, expression[pattern], options)) + .filter(pattern => pattern !== NULL)); + + const n = parsedPatterns.length; + if (!n) { + return NULL; + } + + if (!parsedPatterns.some(parsedPattern => (parsedPattern).requiresSiblings!)) { + if (n === 1) { + return parsedPatterns[0]; + } + + // eslint-disable-next-line @typescript-eslint/no-shadow + const resultExpression: ParsedStringPattern = function (path: string, basename: string): string | Promise { + // eslint-disable-next-line @typescript-eslint/no-shadow + // tslint:disable-next-line:one-variable-per-declaration + for (let i = 0, n = parsedPatterns.length; i < n; i++) { + // Pattern matches path + const result = (parsedPatterns[i])(path, basename); + if (result) { + return result; + } + } + + return null!; + }; + + // eslint-disable-next-line @typescript-eslint/no-shadow + const withBasenames = parsedPatterns.find(pattern => !!(pattern).allBasenames); + if (withBasenames) { + resultExpression.allBasenames = (withBasenames).allBasenames; + } + + // eslint-disable-next-line @typescript-eslint/no-shadow + const allPaths = parsedPatterns.reduce((all, current) => current.allPaths ? all.concat(current.allPaths) : all, []); + if (allPaths.length) { + resultExpression.allPaths = allPaths; + } + + return resultExpression; + } + + const resultExpression: ParsedStringPattern = function (path: string, basename: string, hasSibling?: (name: string) => boolean | Promise): string | Promise { + let name: string = null!; + + // eslint-disable-next-line @typescript-eslint/no-shadow + for (let i = 0, n = parsedPatterns.length; i < n; i++) { + // Pattern matches path + const parsedPattern = (parsedPatterns[i]); + if (parsedPattern.requiresSiblings && hasSibling) { + if (!basename) { + basename = paths.basename(path); + } + if (!name) { + name = basename.substring(0, basename.length - paths.extname(path).length); + } + } + const result = parsedPattern(path, basename, name, hasSibling!); + if (result) { + return result; + } + } + + return null!; + }; + + const withBasenames = parsedPatterns.find(pattern => !!(pattern).allBasenames); + if (withBasenames) { + resultExpression.allBasenames = (withBasenames).allBasenames; + } + + const allPaths = parsedPatterns.reduce((all, current) => current.allPaths ? all.concat(current.allPaths) : all, []); + if (allPaths.length) { + resultExpression.allPaths = allPaths; + } + + return resultExpression; +} + +// eslint-disable-next-line @typescript-eslint/no-explicit-any +function parseExpressionPattern(pattern: string, value: any, options: IGlobOptions): (ParsedStringPattern | ParsedExpressionPattern) { + if (value === false) { + return NULL; // pattern is disabled + } + + const parsedPattern = parsePattern(pattern, options); + if (parsedPattern === NULL) { + return NULL; + } + + // Expression Pattern is + if (typeof value === 'boolean') { + return parsedPattern; + } + + // Expression Pattern is + if (value) { + const when = (value).when; + if (typeof when === 'string') { + const result: ParsedExpressionPattern = (path: string, basename: string, name: string, hasSibling: (name: string) => boolean | Promise) => { + if (!hasSibling || !parsedPattern(path, basename)) { + return null!; + } + + const clausePattern = when.replace('$(basename)', name); + const matched = hasSibling(clausePattern); + return matched instanceof Promise ? + matched.then(m => m ? pattern : null!) : + matched ? pattern : null!; + }; + result.requiresSiblings = true; + return result; + } + } + + // Expression is Anything + return parsedPattern; +} + +function aggregateBasenameMatches(parsedPatterns: (ParsedStringPattern | ParsedExpressionPattern)[], result?: string): (ParsedStringPattern | ParsedExpressionPattern)[] { + const basenamePatterns = parsedPatterns.filter(parsedPattern => !!(parsedPattern).basenames); + if (basenamePatterns.length < 2) { + return parsedPatterns; + } + + const basenames = basenamePatterns.reduce((all, current) => all.concat((current).basenames!), []); + let patterns: string[]; + if (result) { + patterns = []; + // tslint:disable-next-line:one-variable-per-declaration + for (let i = 0, n = basenames.length; i < n; i++) { + patterns.push(result); + } + } else { + patterns = basenamePatterns.reduce((all, current) => all.concat((current).patterns!), []); + } + const aggregate: ParsedStringPattern = function (path, basename): string { + if (!path) { + return null!; + } + if (!basename) { + let i: number; + for (i = path.length; i > 0; i--) { + const ch = path.charCodeAt(i - 1); + if (ch === CharCode.Slash || ch === CharCode.Backslash) { + break; + } + } + basename = path.substring(i); + } + const index = basenames.indexOf(basename); + return index !== -1 ? patterns[index] : null!; + }; + aggregate.basenames = basenames; + aggregate.patterns = patterns; + aggregate.allBasenames = basenames; + + const aggregatedPatterns = parsedPatterns.filter(parsedPattern => !(parsedPattern).basenames); + aggregatedPatterns.push(aggregate); + return aggregatedPatterns; +} diff --git a/packages/core/src/common/hash.ts b/packages/core/src/common/hash.ts new file mode 100644 index 0000000..254b85d --- /dev/null +++ b/packages/core/src/common/hash.ts @@ -0,0 +1,85 @@ +// ***************************************************************************** +// Copyright (C) 2023 Mathieu Bussieres and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation and others. All rights reserved. + * Licensed under the MIT License. See https://github.com/Microsoft/vscode/blob/master/LICENSE.txt for license information. + *--------------------------------------------------------------------------------------------*/ + +// based on https://github.com/microsoft/vscode/blob/1.72.2/src/vs/base/common/hash.ts + +/** + * Return a hash value for an object. + */ +// eslint-disable-next-line @typescript-eslint/no-explicit-any +export function hash(obj: any): number { + return doHash(obj, 0); +} + +// eslint-disable-next-line @typescript-eslint/no-explicit-any +export function doHash(obj: any, hashVal: number): number { + switch (typeof obj) { + case 'object': + // eslint-disable-next-line no-null/no-null + if (obj === null) { + return numberHash(349, hashVal); + } else if (Array.isArray(obj)) { + return arrayHash(obj, hashVal); + } + return objectHash(obj, hashVal); + case 'string': + return stringHash(obj, hashVal); + case 'boolean': + return booleanHash(obj, hashVal); + case 'number': + return numberHash(obj, hashVal); + case 'undefined': + return numberHash(937, hashVal); + default: + return numberHash(617, hashVal); + } +} + +export function numberHash(val: number, initialHashVal: number): number { + return (((initialHashVal << 5) - initialHashVal) + val) | 0; // hashVal * 31 + ch, keep as int32 +} + +function booleanHash(b: boolean, initialHashVal: number): number { + return numberHash(b ? 433 : 863, initialHashVal); +} + +export function stringHash(s: string, hashVal: number): number { + hashVal = numberHash(149417, hashVal); + for (let i = 0, length = s.length; i < length; i++) { + hashVal = numberHash(s.charCodeAt(i), hashVal); + } + return hashVal; +} + +// eslint-disable-next-line @typescript-eslint/no-explicit-any +function arrayHash(arr: any[], initialHashVal: number): number { + initialHashVal = numberHash(104579, initialHashVal); + return arr.reduce((hashVal, item) => doHash(item, hashVal), initialHashVal); +} + +// eslint-disable-next-line @typescript-eslint/no-explicit-any +function objectHash(obj: any, initialHashVal: number): number { + initialHashVal = numberHash(181387, initialHashVal); + return Object.keys(obj).sort().reduce((hashVal, key) => { + hashVal = stringHash(key, hashVal); + return doHash(obj[key], hashVal); + }, initialHashVal); +} diff --git a/packages/core/src/common/i18n/localization-server.ts b/packages/core/src/common/i18n/localization-server.ts new file mode 100644 index 0000000..dcddb81 --- /dev/null +++ b/packages/core/src/common/i18n/localization-server.ts @@ -0,0 +1,25 @@ +// ***************************************************************************** +// Copyright (C) 2023 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +import { Localization } from './localization'; + +export const LocalizationServerPath = '/localization-server'; + +export const LocalizationServer = Symbol('LocalizationServer'); + +export interface LocalizationServer { + loadLocalization(languageId: string): Promise; +} diff --git a/packages/core/src/common/i18n/localization.ts b/packages/core/src/common/i18n/localization.ts new file mode 100644 index 0000000..e2c33f6 --- /dev/null +++ b/packages/core/src/common/i18n/localization.ts @@ -0,0 +1,86 @@ +// ***************************************************************************** +// Copyright (C) 2021 TypeFox and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +export const localizationPath = '/services/i18n'; + +export const AsyncLocalizationProvider = Symbol('AsyncLocalizationProvider'); +export interface AsyncLocalizationProvider { + getCurrentLanguage(): Promise + setCurrentLanguage(languageId: string): Promise + getAvailableLanguages(): Promise + loadLocalization(languageId: string): Promise +} + +export interface Localization extends LanguageInfo { + translations: Record; + replacements?: Record; +} + +export interface LanguageInfo { + languageId: string; + languageName?: string; + languagePack?: boolean; + localizedLanguageName?: string; +} + +export type FormatType = string | number | boolean | undefined; + +export namespace Localization { + + const formatRegexp = /{([^}]+)}/g; + + export function format(message: string, args: FormatType[]): string; + export function format(message: string, args: Record): string; + export function format(message: string, args: Record | FormatType[]): string { + return message.replace(formatRegexp, (match, group) => (args[group] ?? match) as string); + } + + export function localize(localization: Localization | undefined, key: string, defaultValue: string, ...args: FormatType[]): string { + let value = defaultValue; + if (localization) { + const replacement = localization.replacements?.[defaultValue]; + if (typeof replacement === 'string') { + value = replacement; + } else { + const translation = localization.translations[key]; + if (translation) { + value = normalize(translation); + } + } + } + return format(value, args); + } + + /** + * This function normalizes values from VSCode's localizations, which often contain additional mnemonics (`&&`). + * The normalization removes the mnemonics from the input string. + * + * @param value Localization value coming from VSCode + * @returns A normalized localized value + */ + export function normalize(value: string): string { + return value.replace(/&&/g, ''); + } + + export function transformKey(key: string): string { + let nlsKey = key; + const keySlashIndex = key.lastIndexOf('/'); + if (keySlashIndex >= 0) { + nlsKey = key.substring(keySlashIndex + 1); + } + return nlsKey; + } +} diff --git a/packages/core/src/common/i18n/nls.metadata.json b/packages/core/src/common/i18n/nls.metadata.json new file mode 100644 index 0000000..6667601 --- /dev/null +++ b/packages/core/src/common/i18n/nls.metadata.json @@ -0,0 +1,42229 @@ +{ + "keys": { + "vs/base/browser/ui/actionbar/actionViewItems": [ + { + "key": "titleLabel", + "comment": [ + "action title", + "action keybinding" + ] + } + ], + "vs/base/browser/ui/button/button": [ + "button dropdown more actions" + ], + "vs/base/browser/ui/dialog/dialog": [ + "ok", + "dialogInfoMessage", + "dialogErrorMessage", + "dialogWarningMessage", + "dialogPendingMessage", + "dialogClose" + ], + "vs/base/browser/ui/dropdown/dropdownActionViewItem": [ + "moreActions" + ], + "vs/base/browser/ui/findinput/findInput": [ + "defaultLabel" + ], + "vs/base/browser/ui/findinput/findInputToggles": [ + "caseDescription", + "wordsDescription", + "regexDescription" + ], + "vs/base/browser/ui/findinput/replaceInput": [ + "defaultLabel", + "label.preserveCaseToggle" + ], + "vs/base/browser/ui/hover/hoverWidget": [ + "acessibleViewHint", + "acessibleViewHintNoKbOpen" + ], + "vs/base/browser/ui/icons/iconSelectBox": [ + "iconSelect.placeholder", + "iconSelect.noResults" + ], + "vs/base/browser/ui/inputbox/inputBox": [ + "alertErrorMessage", + "alertWarningMessage", + "alertInfoMessage", + { + "key": "history.inputbox.hint.suffix.noparens", + "comment": [ + "Text is the suffix of an input field placeholder coming after the action the input field performs, this will be used when the input field ends in a closing parenthesis \")\", for example \"Filter (e.g. text, !exclude)\". The character inserted into the final string is ⇅ to represent the up and down arrow keys." + ] + }, + { + "key": "history.inputbox.hint.suffix.inparens", + "comment": [ + "Text is the suffix of an input field placeholder coming after the action the input field performs, this will be used when the input field does NOT end in a closing parenthesis (eg. \"Find\"). The character inserted into the final string is ⇅ to represent the up and down arrow keys." + ] + }, + "clearedInput" + ], + "vs/base/browser/ui/keybindingLabel/keybindingLabel": [ + "unbound" + ], + "vs/base/browser/ui/menu/menubar": [ + "mAppMenu", + "mMore" + ], + "vs/base/browser/ui/selectBox/selectBoxCustom": [ + { + "key": "selectBox", + "comment": [ + "Behave like native select dropdown element." + ] + } + ], + "vs/base/browser/ui/splitview/paneview": [ + "viewSection" + ], + "vs/base/browser/ui/toolbar/toolbar": [ + "moreActions" + ], + "vs/base/browser/ui/tree/abstractTree": [ + "type to search", + "close", + "type to search", + "not found", + "replFindNoResults", + "foundResults", + "type to filter", + "type to search", + "filter", + "fuzzySearch" + ], + "vs/base/browser/ui/tree/asyncDataTree": [ + "type to filter", + "type to search" + ], + "vs/base/browser/ui/tree/treeDefaults": [ + "collapse all" + ], + "vs/base/common/actions": [ + "submenu.empty" + ], + "vs/base/common/date": [ + "date.fromNow.in", + "date.fromNow.now", + "date.fromNow.seconds.singular.ago.fullWord", + "date.fromNow.seconds.singular.ago", + "date.fromNow.seconds.plural.ago.fullWord", + "date.fromNow.seconds.plural.ago", + "date.fromNow.seconds.singular.fullWord", + "date.fromNow.seconds.singular", + "date.fromNow.seconds.plural.fullWord", + "date.fromNow.seconds.plural", + "date.fromNow.minutes.singular.ago.fullWord", + "date.fromNow.minutes.singular.ago", + "date.fromNow.minutes.plural.ago.fullWord", + "date.fromNow.minutes.plural.ago", + "date.fromNow.minutes.singular.fullWord", + "date.fromNow.minutes.singular", + "date.fromNow.minutes.plural.fullWord", + "date.fromNow.minutes.plural", + "date.fromNow.hours.singular.ago.fullWord", + "date.fromNow.hours.singular.ago", + "date.fromNow.hours.plural.ago.fullWord", + "date.fromNow.hours.plural.ago", + "date.fromNow.hours.singular.fullWord", + "date.fromNow.hours.singular", + "date.fromNow.hours.plural.fullWord", + "date.fromNow.hours.plural", + "date.fromNow.days.singular.ago", + "date.fromNow.days.plural.ago", + "date.fromNow.days.singular", + "date.fromNow.days.plural", + "date.fromNow.weeks.singular.ago.fullWord", + "date.fromNow.weeks.singular.ago", + "date.fromNow.weeks.plural.ago.fullWord", + "date.fromNow.weeks.plural.ago", + "date.fromNow.weeks.singular.fullWord", + "date.fromNow.weeks.singular", + "date.fromNow.weeks.plural.fullWord", + "date.fromNow.weeks.plural", + "date.fromNow.months.singular.ago.fullWord", + "date.fromNow.months.singular.ago", + "date.fromNow.months.plural.ago.fullWord", + "date.fromNow.months.plural.ago", + "date.fromNow.months.singular.fullWord", + "date.fromNow.months.singular", + "date.fromNow.months.plural.fullWord", + "date.fromNow.months.plural", + "date.fromNow.years.singular.ago.fullWord", + "date.fromNow.years.singular.ago", + "date.fromNow.years.plural.ago.fullWord", + "date.fromNow.years.plural.ago", + "date.fromNow.years.singular.fullWord", + "date.fromNow.years.singular", + "date.fromNow.years.plural.fullWord", + "date.fromNow.years.plural", + "today", + "yesterday", + "duration.ms.full", + "duration.ms", + "duration.s.full", + "duration.s", + "duration.m.full", + "duration.m", + "duration.h.full", + "duration.h", + "duration.d" + ], + "vs/base/common/errorMessage": [ + "stackTrace.format", + "nodeExceptionMessage", + "error.defaultMessage", + "error.defaultMessage", + "error.moreErrors", + "error.defaultMessage" + ], + "vs/base/common/jsonErrorMessages": [ + "error.invalidSymbol", + "error.invalidNumberFormat", + "error.propertyNameExpected", + "error.valueExpected", + "error.colonExpected", + "error.commaExpected", + "error.closeBraceExpected", + "error.closeBracketExpected", + "error.endOfFileExpected" + ], + "vs/base/common/keybindingLabels": [ + { + "key": "ctrlKey", + "comment": [ + "This is the short form for the Control key on the keyboard" + ] + }, + { + "key": "shiftKey", + "comment": [ + "This is the short form for the Shift key on the keyboard" + ] + }, + { + "key": "altKey", + "comment": [ + "This is the short form for the Alt key on the keyboard" + ] + }, + { + "key": "windowsKey", + "comment": [ + "This is the short form for the Windows key on the keyboard" + ] + }, + { + "key": "ctrlKey", + "comment": [ + "This is the short form for the Control key on the keyboard" + ] + }, + { + "key": "shiftKey", + "comment": [ + "This is the short form for the Shift key on the keyboard" + ] + }, + { + "key": "altKey", + "comment": [ + "This is the short form for the Alt key on the keyboard" + ] + }, + { + "key": "superKey", + "comment": [ + "This is the short form for the Super key on the keyboard" + ] + }, + { + "key": "ctrlKey.long", + "comment": [ + "This is the long form for the Control key on the keyboard" + ] + }, + { + "key": "shiftKey.long", + "comment": [ + "This is the long form for the Shift key on the keyboard" + ] + }, + { + "key": "optKey.long", + "comment": [ + "This is the long form for the Alt/Option key on the keyboard" + ] + }, + { + "key": "cmdKey.long", + "comment": [ + "This is the long form for the Command key on the keyboard" + ] + }, + { + "key": "ctrlKey.long", + "comment": [ + "This is the long form for the Control key on the keyboard" + ] + }, + { + "key": "shiftKey.long", + "comment": [ + "This is the long form for the Shift key on the keyboard" + ] + }, + { + "key": "altKey.long", + "comment": [ + "This is the long form for the Alt key on the keyboard" + ] + }, + { + "key": "windowsKey.long", + "comment": [ + "This is the long form for the Windows key on the keyboard" + ] + }, + { + "key": "ctrlKey.long", + "comment": [ + "This is the long form for the Control key on the keyboard" + ] + }, + { + "key": "shiftKey.long", + "comment": [ + "This is the long form for the Shift key on the keyboard" + ] + }, + { + "key": "altKey.long", + "comment": [ + "This is the long form for the Alt key on the keyboard" + ] + }, + { + "key": "superKey.long", + "comment": [ + "This is the long form for the Super key on the keyboard" + ] + } + ], + "vs/base/common/policy": [ + "extensionsConfigurationTitle", + "terminalIntegratedConfigurationTitle", + "interactiveSessionConfigurationTitle", + "telemetryConfigurationTitle", + "updateConfigurationTitle" + ], + "vs/base/node/zip": [ + "invalid file", + "incompleteExtract", + "notFound" + ], + "vs/code/electron-main/app": [ + "confirmOpenMessageWorkspace", + "confirmOpenMessageFolder", + "confirmOpenMessageFileOrFolder", + { + "key": "open", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "cancel", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "confirmOpenDetail", + "doNotAskAgainLocal", + "doNotAskAgainRemote" + ], + "vs/code/electron-main/main": [ + "mainLog", + "secondInstanceAdmin", + "secondInstanceAdminDetail", + "secondInstanceNoResponse", + "secondInstanceNoResponseDetail", + "statusWarning", + "startupDataDirError", + "startupUserDataAndExtensionsDirErrorDetail", + { + "key": "close", + "comment": [ + "&& denotes a mnemonic" + ] + } + ], + "vs/code/electron-utility/sharedProcess/sharedProcessMain": [ + "sharedLog", + "sharedLog", + "networkk" + ], + "vs/code/node/cliProcessMain": [ + "cli" + ], + "vs/editor/browser/controller/editContext/native/screenReaderSupport": [ + "editor" + ], + "vs/editor/browser/controller/editContext/screenReaderUtils": [ + "accessibilityModeOff", + "accessibilityOffAriaLabel", + "accessibilityOffAriaLabelNoKb", + "accessibilityOffAriaLabelNoKbs" + ], + "vs/editor/browser/controller/editContext/textArea/textAreaEditContext": [ + "editor" + ], + "vs/editor/browser/coreCommands": [ + "stickydesc", + "stickydesc", + "removedCursor" + ], + "vs/editor/browser/editorExtensions": [ + { + "key": "miUndo", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "undo", + "undo", + { + "key": "miRedo", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "redo", + "redo", + { + "key": "miSelectAll", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "selectAll", + "selectAll" + ], + "vs/editor/browser/gpu/viewGpuContext": [ + "editor.dom.render" + ], + "vs/editor/browser/services/inlineCompletionsService": [ + "inlineCompletions.snoozed", + "snooze.placeholder", + "action.inlineSuggest.snooze", + "action.inlineSuggest.cancelSnooze" + ], + "vs/editor/browser/widget/codeEditor/codeEditorWidget": [ + "cursors.maximum", + "goToSetting" + ], + "vs/editor/browser/widget/diffEditor/commands": [ + "toggleCollapseUnchangedRegions", + "toggleShowMovedCodeBlocks", + "toggleUseInlineViewWhenSpaceIsLimited", + "diffEditor", + "switchSide", + "exitCompareMove", + "collapseAllUnchangedRegions", + "showAllUnchangedRegions", + "revert", + "accessibleDiffViewer", + "editor.action.accessibleDiffViewer.next", + "editor.action.accessibleDiffViewer.prev" + ], + "vs/editor/browser/widget/diffEditor/components/accessibleDiffViewer": [ + "accessibleDiffViewerInsertIcon", + "accessibleDiffViewerRemoveIcon", + "accessibleDiffViewerCloseIcon", + "label.close", + "ariaLabel", + "no_lines_changed", + "one_line_changed", + "more_lines_changed", + { + "key": "header", + "comment": [ + "This is the ARIA label for a git diff header.", + "A git diff header looks like this: @@ -154,12 +159,39 @@.", + "That encodes that at original line 154 (which is now line 159), 12 lines were removed/changed with 39 lines.", + "Variables 0 and 1 refer to the diff index out of total number of diffs.", + "Variables 2 and 4 will be numbers (a line number).", + "Variables 3 and 5 will be \"no lines changed\", \"1 line changed\" or \"X lines changed\", localized separately." + ] + }, + "blankLine", + { + "key": "unchangedLine", + "comment": [ + "The placeholders are contents of the line and should not be translated." + ] + }, + "equalLine", + "insertLine", + "deleteLine" + ], + "vs/editor/browser/widget/diffEditor/components/diffEditorEditors": [ + "diff-aria-navigation-tip" + ], + "vs/editor/browser/widget/diffEditor/components/diffEditorViewZones/inlineDiffDeletedCodeMargin": [ + "diff.clipboard.copyDeletedLinesContent.label", + "diff.clipboard.copyDeletedLinesContent.single.label", + "diff.clipboard.copyChangedLinesContent.label", + "diff.clipboard.copyChangedLinesContent.single.label", + "diff.clipboard.copyDeletedLineContent.label", + "diff.clipboard.copyChangedLineContent.label", + "diff.inline.revertChange.label" + ], + "vs/editor/browser/widget/diffEditor/diffEditor.contribution": [ + "useInlineViewWhenSpaceIsLimited", + "showMoves", + "revertHunk", + "revertSelection", + "Open Accessible Diff Viewer" + ], + "vs/editor/browser/widget/diffEditor/features/hideUnchangedRegionsFeature": [ + "foldUnchanged", + "hiddenLines", + "diff.hiddenLines.top", + "showUnchangedRegion", + "diff.bottom", + "hiddenLines", + "diff.hiddenLines.expandAll" + ], + "vs/editor/browser/widget/diffEditor/features/movedBlocksLinesFeature": [ + "codeMovedToWithChanges", + "codeMovedFromWithChanges", + "codeMovedTo", + "codeMovedFrom" + ], + "vs/editor/browser/widget/diffEditor/features/revertButtonsFeature": [ + "revertSelectedChanges", + "revertChange" + ], + "vs/editor/browser/widget/diffEditor/registrations.contribution": [ + "diffEditor.move.border", + "diffEditor.moveActive.border", + "diffEditor.unchangedRegionShadow", + "diffInsertIcon", + "diffRemoveIcon" + ], + "vs/editor/browser/widget/multiDiffEditor/colors": [ + "multiDiffEditor.headerBackground", + "multiDiffEditor.background", + "multiDiffEditor.border" + ], + "vs/editor/browser/widget/multiDiffEditor/multiDiffEditorWidgetImpl": [ + "loading", + "noChangedFiles" + ], + "vs/editor/common/config/editorConfigurationSchema": [ + "editorConfigurationTitle", + "tabSize", + "indentSize", + "insertSpaces", + "detectIndentation", + "trimAutoWhitespace", + "largeFileOptimizations", + "wordBasedSuggestions.off", + "wordBasedSuggestions.offWithInlineSuggestions", + "wordBasedSuggestions.currentDocument", + "wordBasedSuggestions.matchingDocuments", + "wordBasedSuggestions.allDocuments", + "wordBasedSuggestions", + "semanticHighlighting.true", + "semanticHighlighting.false", + "semanticHighlighting.configuredByTheme", + "semanticHighlighting.enabled", + "stablePeek", + "maxTokenizationLineLength", + "editor.experimental.asyncTokenization", + "editor.experimental.asyncTokenizationLogging", + "editor.experimental.asyncTokenizationVerification", + "editor.experimental.treeSitterTelemetry", + "editor.experimental.preferTreeSitter.css", + "editor.experimental.preferTreeSitter.typescript", + "editor.experimental.preferTreeSitter.ini", + "editor.experimental.preferTreeSitter.regex", + "schema.brackets", + "schema.openBracket", + "schema.closeBracket", + "schema.colorizedBracketPairs", + "schema.openBracket", + "schema.closeBracket", + "maxComputationTime", + "maxFileSize", + "sideBySide", + "renderSideBySideInlineBreakpoint", + "useInlineViewWhenSpaceIsLimited", + "renderMarginRevertIcon", + "renderGutterMenu", + "ignoreTrimWhitespace", + "renderIndicators", + "codeLens", + "wordWrap.off", + "wordWrap.on", + "wordWrap.inherit", + "diffAlgorithm.legacy", + "diffAlgorithm.advanced", + "hideUnchangedRegions.enabled", + "hideUnchangedRegions.revealLineCount", + "hideUnchangedRegions.minimumLineCount", + "hideUnchangedRegions.contextLineCount", + "showMoves", + "showEmptyDecorations", + "useTrueInlineView" + ], + "vs/editor/common/config/editorOptions": [ + "accessibilitySupport.auto", + "accessibilitySupport.on", + "accessibilitySupport.off", + "accessibilitySupport", + "comments.insertSpace", + "comments.ignoreEmptyLines", + "emptySelectionClipboard", + "find.cursorMoveOnType", + "editor.find.seedSearchStringFromSelection.never", + "editor.find.seedSearchStringFromSelection.always", + "editor.find.seedSearchStringFromSelection.selection", + "find.seedSearchStringFromSelection", + "editor.find.autoFindInSelection.never", + "editor.find.autoFindInSelection.always", + "editor.find.autoFindInSelection.multiline", + "find.autoFindInSelection", + "find.globalFindClipboard", + "find.addExtraSpaceOnTop", + "find.loop", + "editor.find.history.never", + "editor.find.history.workspace", + "find.history", + "editor.find.replaceHistory.never", + "editor.find.replaceHistory.workspace", + "find.replaceHistory", + "find.findOnType", + "fontLigatures", + "fontFeatureSettings", + "fontLigaturesGeneral", + "fontVariations", + "fontVariationSettings", + "fontVariationsGeneral", + "fontSize", + "fontWeightErrorMessage", + "fontWeight", + "editor.gotoLocation.multiple.peek", + "editor.gotoLocation.multiple.gotoAndPeek", + "editor.gotoLocation.multiple.goto", + "editor.gotoLocation.multiple.deprecated", + "editor.editor.gotoLocation.multipleDefinitions", + "editor.editor.gotoLocation.multipleTypeDefinitions", + "editor.editor.gotoLocation.multipleDeclarations", + "editor.editor.gotoLocation.multipleImplemenattions", + "editor.editor.gotoLocation.multipleReferences", + "alternativeDefinitionCommand", + "alternativeTypeDefinitionCommand", + "alternativeDeclarationCommand", + "alternativeImplementationCommand", + "alternativeReferenceCommand", + "hover.enabled.on", + "hover.enabled.off", + "hover.enabled.onKeyboardModifier", + "hover.enabled", + "hover.delay", + "hover.sticky", + "hover.hidingDelay", + "hover.above", + "wrappingStrategy.simple", + "wrappingStrategy.advanced", + "wrappingStrategy", + "editor.lightbulb.enabled.off", + "editor.lightbulb.enabled.onCode", + "editor.lightbulb.enabled.on", + "enabled", + "editor.stickyScroll.enabled", + "editor.stickyScroll.maxLineCount", + "editor.stickyScroll.defaultModel", + "editor.stickyScroll.scrollWithEditor", + "inlayHints.enable", + "editor.inlayHints.on", + "editor.inlayHints.onUnlessPressed", + "editor.inlayHints.offUnlessPressed", + "editor.inlayHints.off", + "inlayHints.fontSize", + "inlayHints.fontFamily", + "inlayHints.padding", + "inlayHints.maximumLength", + "lineHeight", + "minimap.enabled", + "minimap.autohide.none", + "minimap.autohide.mouseover", + "minimap.autohide.scroll", + "minimap.autohide", + "minimap.size.proportional", + "minimap.size.fill", + "minimap.size.fit", + "minimap.size", + "minimap.side", + "minimap.showSlider", + "minimap.scale", + "minimap.renderCharacters", + "minimap.maxColumn", + "minimap.showRegionSectionHeaders", + "minimap.showMarkSectionHeaders", + "minimap.markSectionHeaderRegex", + "minimap.sectionHeaderFontSize", + "minimap.sectionHeaderLetterSpacing", + "padding.top", + "padding.bottom", + "parameterHints.enabled", + "parameterHints.cycle", + "on", + "inline", + "off", + "quickSuggestions.strings", + "quickSuggestions.comments", + "quickSuggestions.other", + "quickSuggestions", + "lineNumbers.off", + "lineNumbers.on", + "lineNumbers.relative", + "lineNumbers.interval", + "lineNumbers", + "rulers.size", + "rulers.color", + "rulers", + "scrollbar.vertical.auto", + "scrollbar.vertical.visible", + "scrollbar.vertical.fit", + "scrollbar.vertical", + "scrollbar.horizontal.auto", + "scrollbar.horizontal.visible", + "scrollbar.horizontal.fit", + "scrollbar.horizontal", + "scrollbar.verticalScrollbarSize", + "scrollbar.horizontalScrollbarSize", + "scrollbar.scrollByPage", + "scrollbar.ignoreHorizontalScrollbarInContentHeight", + "unicodeHighlight.nonBasicASCII", + "unicodeHighlight.invisibleCharacters", + "unicodeHighlight.ambiguousCharacters", + "unicodeHighlight.includeComments", + "unicodeHighlight.includeStrings", + "unicodeHighlight.allowedCharacters", + "unicodeHighlight.allowedLocales", + "inlineSuggest.enabled", + "inlineSuggest.showToolbar.always", + "inlineSuggest.showToolbar.onHover", + "inlineSuggest.showToolbar.never", + "inlineSuggest.showToolbar", + "inlineSuggest.syntaxHighlightingEnabled", + "inlineSuggest.suppressSuggestions", + "inlineSuggest.suppressInSnippetMode", + "inlineSuggest.minShowDelay", + "inlineSuggest.suppressInlineSuggestions", + "inlineSuggest.emptyResponseInformation", + "inlineSuggest.triggerCommandOnProviderChange", + "inlineSuggest.showOnSuggestConflict", + "inlineSuggest.fontFamily", + "inlineSuggest.edits.allowCodeShifting", + "inlineSuggest.edits.showLongDistanceHint", + "inlineSuggest.edits.renderSideBySide", + "editor.inlineSuggest.edits.renderSideBySide.auto", + "editor.inlineSuggest.edits.renderSideBySide.never", + "inlineSuggest.edits.showCollapsed", + "bracketPairColorization.enabled", + "bracketPairColorization.independentColorPoolPerBracketType", + "editor.guides.bracketPairs.true", + "editor.guides.bracketPairs.active", + "editor.guides.bracketPairs.false", + "editor.guides.bracketPairs", + "editor.guides.bracketPairsHorizontal.true", + "editor.guides.bracketPairsHorizontal.active", + "editor.guides.bracketPairsHorizontal.false", + "editor.guides.bracketPairsHorizontal", + "editor.guides.highlightActiveBracketPair", + "editor.guides.indentation", + "editor.guides.highlightActiveIndentation.true", + "editor.guides.highlightActiveIndentation.always", + "editor.guides.highlightActiveIndentation.false", + "editor.guides.highlightActiveIndentation", + "suggest.insertMode.insert", + "suggest.insertMode.replace", + "suggest.insertMode", + "suggest.filterGraceful", + "suggest.localityBonus", + "suggest.shareSuggestSelections", + "suggest.insertMode.always", + "suggest.insertMode.never", + "suggest.insertMode.whenTriggerCharacter", + "suggest.insertMode.whenQuickSuggestion", + "suggest.selectionMode", + "suggest.snippetsPreventQuickSuggestions", + "suggest.showIcons", + "suggest.showStatusBar", + "suggest.preview", + "suggest.showInlineDetails", + "suggest.maxVisibleSuggestions.dep", + "deprecated", + "editor.suggest.showMethods", + "editor.suggest.showFunctions", + "editor.suggest.showConstructors", + "editor.suggest.showDeprecated", + "editor.suggest.matchOnWordStartOnly", + "editor.suggest.showFields", + "editor.suggest.showVariables", + "editor.suggest.showClasss", + "editor.suggest.showStructs", + "editor.suggest.showInterfaces", + "editor.suggest.showModules", + "editor.suggest.showPropertys", + "editor.suggest.showEvents", + "editor.suggest.showOperators", + "editor.suggest.showUnits", + "editor.suggest.showValues", + "editor.suggest.showConstants", + "editor.suggest.showEnums", + "editor.suggest.showEnumMembers", + "editor.suggest.showKeywords", + "editor.suggest.showTexts", + "editor.suggest.showColors", + "editor.suggest.showFiles", + "editor.suggest.showReferences", + "editor.suggest.showCustomcolors", + "editor.suggest.showFolders", + "editor.suggest.showTypeParameters", + "editor.suggest.showSnippets", + "editor.suggest.showUsers", + "editor.suggest.showIssues", + "selectLeadingAndTrailingWhitespace", + "selectSubwords", + "wordSegmenterLocales", + "wrappingIndent.none", + "wrappingIndent.same", + "wrappingIndent.indent", + "wrappingIndent.deepIndent", + "wrappingIndent", + "dropIntoEditor.enabled", + "dropIntoEditor.showDropSelector", + "dropIntoEditor.showDropSelector.afterDrop", + "dropIntoEditor.showDropSelector.never", + "pasteAs.enabled", + "pasteAs.showPasteSelector", + "pasteAs.showPasteSelector.afterPaste", + "pasteAs.showPasteSelector.never", + "acceptSuggestionOnCommitCharacter", + "acceptSuggestionOnEnterSmart", + "acceptSuggestionOnEnter", + "accessibilityPageSize", + "allowVariableLineHeights", + "allowVariableFonts", + "allowVariableFontsInAccessibilityMode", + "editorViewAccessibleLabel", + "screenReaderAnnounceInlineSuggestion", + "editor.autoClosingBrackets.languageDefined", + "editor.autoClosingBrackets.beforeWhitespace", + "autoClosingBrackets", + "editor.autoClosingComments.languageDefined", + "editor.autoClosingComments.beforeWhitespace", + "autoClosingComments", + "editor.autoClosingDelete.auto", + "autoClosingDelete", + "editor.autoClosingOvertype.auto", + "autoClosingOvertype", + "editor.autoClosingQuotes.languageDefined", + "editor.autoClosingQuotes.beforeWhitespace", + "autoClosingQuotes", + "editor.autoIndent.none", + "editor.autoIndent.keep", + "editor.autoIndent.brackets", + "editor.autoIndent.advanced", + "editor.autoIndent.full", + "autoIndent", + "autoIndentOnPaste", + "autoIndentOnPasteWithinString", + "editor.autoSurround.languageDefined", + "editor.autoSurround.quotes", + "editor.autoSurround.brackets", + "autoSurround", + "stickyTabStops", + "codeLens", + "codeLensFontFamily", + "codeLensFontSize", + "colorDecorators", + "editor.colorDecoratorActivatedOn.clickAndHover", + "editor.colorDecoratorActivatedOn.hover", + "editor.colorDecoratorActivatedOn.click", + "colorDecoratorActivatedOn", + "colorDecoratorsLimit", + "columnSelection", + "copyWithSyntaxHighlighting", + "cursorBlinking", + "cursorSmoothCaretAnimation.off", + "cursorSmoothCaretAnimation.explicit", + "cursorSmoothCaretAnimation.on", + "cursorSmoothCaretAnimation", + "cursorStyle", + "overtypeCursorStyle", + "cursorSurroundingLines", + "cursorSurroundingLinesStyle.default", + "cursorSurroundingLinesStyle.all", + "cursorSurroundingLinesStyle", + "cursorWidth", + "cursorHeight", + "dragAndDrop", + "editContext", + "renderRichScreenReaderContent", + "experimentalGpuAcceleration.off", + "experimentalGpuAcceleration.on", + "experimentalGpuAcceleration", + "experimentalWhitespaceRendering.svg", + "experimentalWhitespaceRendering.font", + "experimentalWhitespaceRendering.off", + "experimentalWhitespaceRendering", + "fastScrollSensitivity", + "folding", + "foldingStrategy.auto", + "foldingStrategy.indentation", + "foldingStrategy", + "foldingHighlight", + "foldingImportsByDefault", + "foldingMaximumRegions", + "unfoldOnClickAfterEndOfLine", + "fontFamily", + "formatOnPaste", + "formatOnType", + "glyphMargin", + "hideCursorInOverviewRuler", + "inertialScroll", + "letterSpacing", + "linkedEditing", + "links", + "matchBrackets", + "mouseWheelScrollSensitivity", + "mouseWheelZoom.mac", + "mouseWheelZoom", + "multiCursorMergeOverlapping", + "multiCursorModifier.ctrlCmd", + "multiCursorModifier.alt", + { + "key": "multiCursorModifier", + "comment": [ + "- `ctrlCmd` refers to a value the setting can take and should not be localized.", + "- `Control` and `Command` refer to the modifier keys Ctrl or Cmd on the keyboard and can be localized." + ] + }, + "mouseMiddleClickAction", + "multiCursorPaste.spread", + "multiCursorPaste.full", + "multiCursorPaste", + "multiCursorLimit", + "occurrencesHighlight.off", + "occurrencesHighlight.singleFile", + "occurrencesHighlight.multiFile", + "occurrencesHighlight", + "occurrencesHighlightDelay", + "overtypeOnPaste", + "overviewRulerBorder", + "peekWidgetDefaultFocus.tree", + "peekWidgetDefaultFocus.editor", + "peekWidgetDefaultFocus", + "definitionLinkOpensInPeek", + "quickSuggestionsDelay", + "renameOnType", + "renameOnTypeDeprecate", + "renderControlCharacters", + "renderFinalNewline", + "renderLineHighlight.all", + "renderLineHighlight", + "renderLineHighlightOnlyWhenFocus", + "renderWhitespace.boundary", + "renderWhitespace.selection", + "renderWhitespace.trailing", + "renderWhitespace", + "roundedSelection", + "scrollBeyondLastColumn", + "scrollBeyondLastLine", + "scrollOnMiddleClick", + "scrollPredominantAxis", + "selectionClipboard", + "selectionHighlight", + "selectionHighlightMaxLength", + "selectionHighlightMultiline", + "showFoldingControls.always", + "showFoldingControls.never", + "showFoldingControls.mouseover", + "showFoldingControls", + "showUnused", + "showDeprecated", + "snippetSuggestions.top", + "snippetSuggestions.bottom", + "snippetSuggestions.inline", + "snippetSuggestions.none", + "snippetSuggestions", + "smoothScrolling", + "inlineCompletionsAccessibilityVerbose", + "suggestFontSize", + "suggestLineHeight", + "suggestOnTriggerCharacters", + "suggestSelection.first", + "suggestSelection.recentlyUsed", + "suggestSelection.recentlyUsedByPrefix", + "suggestSelection", + "tabCompletion.on", + "tabCompletion.off", + "tabCompletion.onlySnippets", + "tabCompletion", + "trimWhitespaceOnDelete", + "unusualLineTerminators.auto", + "unusualLineTerminators.off", + "unusualLineTerminators.prompt", + "unusualLineTerminators", + "useTabStops", + "wordBreak.normal", + "wordBreak.keepAll", + "wordBreak", + "wordSeparators", + "wordWrap.off", + "wordWrap.on", + { + "key": "wordWrap.wordWrapColumn", + "comment": [ + "- `editor.wordWrapColumn` refers to a different setting and should not be localized." + ] + }, + { + "key": "wordWrap.bounded", + "comment": [ + "- viewport means the edge of the visible window size.", + "- `editor.wordWrapColumn` refers to a different setting and should not be localized." + ] + }, + { + "key": "wordWrap", + "comment": [ + "- 'off', 'on', 'wordWrapColumn' and 'bounded' refer to values the setting can take and should not be localized.", + "- `editor.wordWrapColumn` refers to a different setting and should not be localized." + ] + }, + { + "key": "wordWrapColumn", + "comment": [ + "- `editor.wordWrap` refers to a different setting and should not be localized.", + "- 'wordWrapColumn' and 'bounded' refer to values the different setting can take and should not be localized." + ] + }, + "wrapOnEscapedLineFeeds", + "editor.defaultColorDecorators.auto", + "editor.defaultColorDecorators.always", + "editor.defaultColorDecorators.never", + "defaultColorDecorators", + "tabFocusMode" + ], + "vs/editor/common/core/editorColorRegistry": [ + "lineHighlight", + "inactiveLineHighlight", + "lineHighlightBorderBox", + "rangeHighlight", + "rangeHighlightBorder", + "symbolHighlight", + "symbolHighlightBorder", + "caret", + "editorCursorBackground", + "editorMultiCursorPrimaryForeground", + "editorMultiCursorPrimaryBackground", + "editorMultiCursorSecondaryForeground", + "editorMultiCursorSecondaryBackground", + "editorWhitespaces", + "editorLineNumbers", + "editorIndentGuides", + "deprecatedEditorIndentGuides", + "editorActiveIndentGuide", + "deprecatedEditorActiveIndentGuide", + "editorIndentGuides1", + "editorIndentGuides2", + "editorIndentGuides3", + "editorIndentGuides4", + "editorIndentGuides5", + "editorIndentGuides6", + "editorActiveIndentGuide1", + "editorActiveIndentGuide2", + "editorActiveIndentGuide3", + "editorActiveIndentGuide4", + "editorActiveIndentGuide5", + "editorActiveIndentGuide6", + "editorActiveLineNumber", + "deprecatedEditorActiveLineNumber", + "editorActiveLineNumber", + "editorDimmedLineNumber", + "editorRuler", + "editorCodeLensForeground", + "editorBracketMatchBackground", + "editorBracketMatchBorder", + "editorOverviewRulerBorder", + "editorOverviewRulerBackground", + "editorGutter", + "unnecessaryCodeBorder", + "unnecessaryCodeOpacity", + "editorGhostTextBorder", + "editorGhostTextForeground", + "editorGhostTextBackground", + "overviewRulerRangeHighlight", + "overviewRuleError", + "overviewRuleWarning", + "overviewRuleInfo", + "editorBracketHighlightForeground1", + "editorBracketHighlightForeground2", + "editorBracketHighlightForeground3", + "editorBracketHighlightForeground4", + "editorBracketHighlightForeground5", + "editorBracketHighlightForeground6", + "editorBracketHighlightUnexpectedBracketForeground", + "editorBracketPairGuide.background1", + "editorBracketPairGuide.background2", + "editorBracketPairGuide.background3", + "editorBracketPairGuide.background4", + "editorBracketPairGuide.background5", + "editorBracketPairGuide.background6", + "editorBracketPairGuide.activeBackground1", + "editorBracketPairGuide.activeBackground2", + "editorBracketPairGuide.activeBackground3", + "editorBracketPairGuide.activeBackground4", + "editorBracketPairGuide.activeBackground5", + "editorBracketPairGuide.activeBackground6", + "editorUnicodeHighlight.border", + "editorUnicodeHighlight.background" + ], + "vs/editor/common/editorContextKeys": [ + "editorTextFocus", + "editorFocus", + "textInputFocus", + "editorReadonly", + "inDiffEditor", + "isEmbeddedDiffEditor", + "inMultiDiffEditor", + "multiDiffEditorAllCollapsed", + "diffEditorHasChanges", + "comparingMovedCode", + "accessibleDiffViewerVisible", + "diffEditorRenderSideBySideInlineBreakpointReached", + "diffEditorInlineMode", + "diffEditorOriginalWritable", + "diffEditorModifiedWritable", + "diffEditorOriginalUri", + "diffEditorModifiedUri", + "editorColumnSelection", + "editorHasSelection", + "editorHasMultipleSelections", + "editorTabMovesFocus", + "editorHoverVisible", + "editorHoverFocused", + "stickyScrollFocused", + "stickyScrollVisible", + "standaloneColorPickerVisible", + "standaloneColorPickerFocused", + "inCompositeEditor", + "editorLangId", + "editorHasCompletionItemProvider", + "editorHasCodeActionsProvider", + "editorHasCodeLensProvider", + "editorHasDefinitionProvider", + "editorHasDeclarationProvider", + "editorHasImplementationProvider", + "editorHasTypeDefinitionProvider", + "editorHasHoverProvider", + "editorHasDocumentHighlightProvider", + "editorHasDocumentSymbolProvider", + "editorHasReferenceProvider", + "editorHasRenameProvider", + "editorHasSignatureHelpProvider", + "editorHasInlayHintsProvider", + "editorHasDocumentFormattingProvider", + "editorHasDocumentSelectionFormattingProvider", + "editorHasMultipleDocumentFormattingProvider", + "editorHasMultipleDocumentSelectionFormattingProvider" + ], + "vs/editor/common/languages": [ + "suggestWidget.kind.method", + "suggestWidget.kind.function", + "suggestWidget.kind.constructor", + "suggestWidget.kind.field", + "suggestWidget.kind.variable", + "suggestWidget.kind.class", + "suggestWidget.kind.struct", + "suggestWidget.kind.interface", + "suggestWidget.kind.module", + "suggestWidget.kind.property", + "suggestWidget.kind.event", + "suggestWidget.kind.operator", + "suggestWidget.kind.unit", + "suggestWidget.kind.value", + "suggestWidget.kind.constant", + "suggestWidget.kind.enum", + "suggestWidget.kind.enumMember", + "suggestWidget.kind.keyword", + "suggestWidget.kind.text", + "suggestWidget.kind.color", + "suggestWidget.kind.file", + "suggestWidget.kind.reference", + "suggestWidget.kind.customcolor", + "suggestWidget.kind.folder", + "suggestWidget.kind.typeParameter", + "suggestWidget.kind.user", + "suggestWidget.kind.issue", + "suggestWidget.kind.tool", + "suggestWidget.kind.snippet", + "Array", + "Boolean", + "Class", + "Constant", + "Constructor", + "Enum", + "EnumMember", + "Event", + "Field", + "File", + "Function", + "Interface", + "Key", + "Method", + "Module", + "Namespace", + "Null", + "Number", + "Object", + "Operator", + "Package", + "Property", + "String", + "Struct", + "TypeParameter", + "Variable", + "symbolAriaLabel" + ], + "vs/editor/common/languages/modesRegistry": [ + "plainText.alias" + ], + "vs/editor/common/model/editStack": [ + "edit" + ], + "vs/editor/common/standaloneStrings": [ + "accessibilityHelpTitle", + "openingDocs", + "readonlyDiffEditor", + "editableDiffEditor", + "readonlyEditor", + "editableEditor", + "defaultWindowTitleIncludesEditorState", + "defaultWindowTitleExcludingEditorState", + "toolbar", + "changeConfigToOnMac", + "changeConfigToOnWinLinux", + "auto_on", + "auto_off", + "screenReaderModeEnabled", + "screenReaderModeDisabled", + "tabFocusModeOnMsg", + "tabFocusModeOffMsg", + "stickScrollKb", + "suggestActionsKb", + "acceptSuggestAction", + "toggleSuggestionFocus", + "codeFolding", + "intellisense", + "showOrFocusHover", + "goToSymbol", + "showAccessibilityHelpAction", + "listSignalSoundsCommand", + "listAnnouncementsCommand", + "announceCursorPosition", + "quickChatCommand", + "startInlineChatCommand", + "debug.startDebugging", + "debugConsole.setBreakpoint", + "debugConsole.addToWatch", + "debugConsole.executeSelection", + "chatEditorModification", + "chatEditorRequestInProgress", + "chatEditing.navigation", + "inspectTokens", + "gotoLineActionLabel", + "gotoOffsetActionLabel", + "helpQuickAccess", + "quickCommandActionLabel", + "quickCommandActionHelp", + "quickOutlineActionLabel", + "quickOutlineByCategoryActionLabel", + "editorViewAccessibleLabel", + "toggleHighContrast", + "bulkEditServiceSummary" + ], + "vs/editor/common/viewLayout/viewLineRenderer": [ + "showMore", + "overflow.chars" + ], + "vs/editor/contrib/anchorSelect/browser/anchorSelect": [ + "selectionAnchor", + "anchorSet", + "setSelectionAnchor", + "goToSelectionAnchor", + "selectFromAnchorToCursor", + "cancelSelectionAnchor" + ], + "vs/editor/contrib/bracketMatching/browser/bracketMatching": [ + "overviewRulerBracketMatchForeground", + { + "key": "miGoToBracket", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "smartSelect.jumpBracket", + "smartSelect.selectToBracket", + "smartSelect.selectToBracketDescription", + "smartSelect.removeBrackets" + ], + "vs/editor/contrib/caretOperations/browser/caretOperations": [ + "caret.moveLeft", + "caret.moveRight" + ], + "vs/editor/contrib/caretOperations/browser/transpose": [ + "transposeLetters.label" + ], + "vs/editor/contrib/clipboard/browser/clipboard": [ + { + "key": "miCut", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "actions.clipboard.cutLabel", + "actions.clipboard.cutLabel", + "actions.clipboard.cutLabel", + { + "key": "miCopy", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "actions.clipboard.copyLabel", + "actions.clipboard.copyLabel", + "actions.clipboard.copyLabel", + { + "key": "miPaste", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "actions.clipboard.pasteLabel", + "actions.clipboard.pasteLabel", + "actions.clipboard.pasteLabel", + "copy as", + "copy as", + "share", + "share", + "actions.clipboard.copyWithSyntaxHighlightingLabel" + ], + "vs/editor/contrib/codeAction/browser/codeAction": [ + "applyCodeActionFailed" + ], + "vs/editor/contrib/codeAction/browser/codeActionCommands": [ + "args.schema.kind", + "args.schema.apply", + "args.schema.apply.first", + "args.schema.apply.ifSingle", + "args.schema.apply.never", + "args.schema.preferred", + "editor.action.quickFix.noneMessage", + "editor.action.codeAction.noneMessage.preferred.kind", + "editor.action.codeAction.noneMessage.kind", + "editor.action.codeAction.noneMessage.preferred", + "editor.action.codeAction.noneMessage", + "editor.action.refactor.noneMessage.preferred.kind", + "editor.action.refactor.noneMessage.kind", + "editor.action.refactor.noneMessage.preferred", + "editor.action.refactor.noneMessage", + "editor.action.source.noneMessage.preferred.kind", + "editor.action.source.noneMessage.kind", + "editor.action.source.noneMessage.preferred", + "editor.action.source.noneMessage", + "editor.action.organize.noneMessage", + "fixAll.noneMessage", + "editor.action.autoFix.noneMessage", + "quickfix.trigger.label", + "refactor.label", + "source.label", + "organizeImports.label", + "organizeImports.description", + "fixAll.label", + "autoFix.label" + ], + "vs/editor/contrib/codeAction/browser/codeActionContributions": [ + "showCodeActionHeaders", + "includeNearbyQuickFixes", + "triggerOnFocusChange" + ], + "vs/editor/contrib/codeAction/browser/codeActionController": [ + "editingNewSelection", + "hideMoreActions", + "showMoreActions" + ], + "vs/editor/contrib/codeAction/browser/codeActionMenu": [ + "codeAction.widget.id.more", + "codeAction.widget.id.quickfix", + "codeAction.widget.id.extract", + "codeAction.widget.id.inline", + "codeAction.widget.id.convert", + "codeAction.widget.id.move", + "codeAction.widget.id.surround", + "codeAction.widget.id.source" + ], + "vs/editor/contrib/codeAction/browser/lightBulbWidget": [ + "gutterLightbulbWidget", + "gutterLightbulbAutoFixWidget", + "gutterLightbulbAIFixWidget", + "gutterLightbulbAIFixAutoFixWidget", + "gutterLightbulbSparkleFilledWidget", + "codeActionAutoRun", + "preferredcodeActionWithKb", + "codeActionWithKb", + "codeAction" + ], + "vs/editor/contrib/codelens/browser/codelensController": [ + "placeHolder", + "showLensOnLine" + ], + "vs/editor/contrib/colorPicker/browser/colorPickerParts/colorPickerCloseButton": [ + "closeIcon" + ], + "vs/editor/contrib/colorPicker/browser/colorPickerParts/colorPickerHeader": [ + "clickToToggleColorOptions" + ], + "vs/editor/contrib/colorPicker/browser/hoverColorPicker/hoverColorPickerParticipant": [ + "hoverAccessibilityColorParticipant" + ], + "vs/editor/contrib/colorPicker/browser/standaloneColorPicker/standaloneColorPickerActions": [ + { + "key": "mishowOrFocusStandaloneColorPicker", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "showOrFocusStandaloneColorPicker", + "showOrFocusStandaloneColorPickerDescription", + { + "key": "hideColorPicker", + "comment": [ + "Action that hides the color picker" + ] + }, + "hideColorPickerDescription", + { + "key": "insertColorWithStandaloneColorPicker", + "comment": [ + "Action that inserts color with standalone color picker" + ] + }, + "insertColorWithStandaloneColorPickerDescription" + ], + "vs/editor/contrib/comment/browser/comment": [ + { + "key": "miToggleLineComment", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miToggleBlockComment", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "comment.line", + "comment.line.add", + "comment.line.remove", + "comment.block" + ], + "vs/editor/contrib/contextmenu/browser/contextmenu": [ + "context.minimap.minimap", + "context.minimap.renderCharacters", + "context.minimap.size", + "context.minimap.size.proportional", + "context.minimap.size.fill", + "context.minimap.size.fit", + "context.minimap.slider", + "context.minimap.slider.mouseover", + "context.minimap.slider.always", + "action.showContextMenu.label" + ], + "vs/editor/contrib/cursorUndo/browser/cursorUndo": [ + "cursor.undo", + "cursor.redo" + ], + "vs/editor/contrib/dropOrPasteInto/browser/copyPasteContribution": [ + "pasteAs.kind", + "pasteAs.preferences", + "pasteAs", + "pasteAsText" + ], + "vs/editor/contrib/dropOrPasteInto/browser/copyPasteController": [ + "pasteWidgetVisible", + "postPasteWidgetTitle", + "noPreferences", + "pasteAsError", + "resolveProcess", + "pasteIntoEditorProgress", + "pasteAsDefault", + "pasteAsPickerPlaceholder", + "pasteAsProgress" + ], + "vs/editor/contrib/dropOrPasteInto/browser/defaultProviders": [ + "text.label", + "defaultDropProvider.uriList.uris", + "defaultDropProvider.uriList.uri", + "defaultDropProvider.uriList.paths", + "defaultDropProvider.uriList.path", + "defaultDropProvider.uriList.relativePaths", + "defaultDropProvider.uriList.relativePath", + "pasteHtmlLabel" + ], + "vs/editor/contrib/dropOrPasteInto/browser/dropIntoEditorController": [ + "dropWidgetVisible", + "postDropWidgetTitle", + "dropIntoEditorProgress" + ], + "vs/editor/contrib/dropOrPasteInto/browser/postEditWidget": [ + "resolveError", + "applyError" + ], + "vs/editor/contrib/editorState/browser/keybindingCancellation": [ + "cancellableOperation" + ], + "vs/editor/contrib/find/browser/findController": [ + "too.large.for.replaceall", + { + "key": "miFind", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "findMatchAction.noResults", + "findMatchAction.inputPlaceHolder", + "findMatchAction.inputValidationMessage", + "findMatchAction.inputValidationMessage", + { + "key": "miReplace", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "startFindAction", + "startFindWithArgsAction", + "startFindWithSelectionAction", + "findNextMatchAction", + "findPreviousMatchAction", + "findMatchAction.goToMatch", + "nextSelectionMatchFindAction", + "previousSelectionMatchFindAction", + "startReplace" + ], + "vs/editor/contrib/find/browser/findWidget": [ + "findCollapsedIcon", + "findExpandedIcon", + "findSelectionIcon", + "findReplaceIcon", + "findReplaceAllIcon", + "findPreviousMatchIcon", + "findNextMatchIcon", + "label.findDialog", + "label.find", + "placeholder.find", + "label.previousMatchButton", + "label.nextMatchButton", + "label.toggleSelectionFind", + "label.closeButton", + "label.replace", + "placeholder.replace", + "label.replaceButton", + "label.replaceAllButton", + "label.toggleReplaceButton", + "title.matchesCountLimit", + "label.matchesLocation", + "label.noResults", + "ariaSearchNoResultEmpty", + "ariaSearchNoResult", + "ariaSearchNoResultWithLineNum", + "ariaSearchNoResultWithLineNumNoCurrentMatch" + ], + "vs/editor/contrib/folding/browser/folding": [ + "unfoldAction.label", + "unFoldRecursivelyAction.label", + "foldAction.label", + "toggleFoldAction.label", + "foldRecursivelyAction.label", + "toggleFoldRecursivelyAction.label", + "foldAllBlockComments.label", + "foldAllMarkerRegions.label", + "unfoldAllMarkerRegions.label", + "foldAllExcept.label", + "unfoldAllExcept.label", + "foldAllAction.label", + "unfoldAllAction.label", + "gotoParentFold.label", + "gotoPreviousFold.label", + "gotoNextFold.label", + "createManualFoldRange.label", + "removeManualFoldingRanges.label", + "toggleImportFold.label", + "foldLevelAction.label" + ], + "vs/editor/contrib/folding/browser/foldingDecorations": [ + "foldBackgroundBackground", + "collapsedTextColor", + "editorGutter.foldingControlForeground", + "foldingExpandedIcon", + "foldingCollapsedIcon", + "foldingManualCollapedIcon", + "foldingManualExpandedIcon", + "linesCollapsed", + "linesExpanded" + ], + "vs/editor/contrib/fontZoom/browser/fontZoom": [ + "EditorFontZoomIn.label", + "EditorFontZoomOut.label", + "EditorFontZoomReset.label" + ], + "vs/editor/contrib/format/browser/formatActions": [ + "formatDocument.label", + "formatSelection.label" + ], + "vs/editor/contrib/gotoError/browser/gotoError": [ + "nextMarkerIcon", + "previousMarkerIcon", + { + "key": "miGotoNextProblem", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miGotoPreviousProblem", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "markerAction.next.label", + "markerAction.previous.label", + "markerAction.nextInFiles.label", + "markerAction.previousInFiles.label" + ], + "vs/editor/contrib/gotoError/browser/gotoErrorWidget": [ + "Error", + "Warning", + "Info", + "Hint", + "marker aria", + "problems", + "change", + "editorMarkerNavigationError", + "editorMarkerNavigationErrorHeaderBackground", + "editorMarkerNavigationWarning", + "editorMarkerNavigationWarningBackground", + "editorMarkerNavigationInfo", + "editorMarkerNavigationInfoHeaderBackground", + "editorMarkerNavigationBackground" + ], + "vs/editor/contrib/gotoSymbol/browser/goToCommands": [ + "peek.submenu", + "def.title", + "noResultWord", + "generic.noResults", + { + "key": "miGotoDefinition", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "decl.title", + "decl.noResultWord", + "decl.generic.noResults", + { + "key": "miGotoDeclaration", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "decl.noResultWord", + "decl.generic.noResults", + "typedef.title", + "goToTypeDefinition.noResultWord", + "goToTypeDefinition.generic.noResults", + { + "key": "miGotoTypeDefinition", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "impl.title", + "goToImplementation.noResultWord", + "goToImplementation.generic.noResults", + { + "key": "miGotoImplementation", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "references.no", + "references.noGeneric", + { + "key": "miGotoReference", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "ref.title", + "ref.title", + "generic.title", + "generic.noResult", + "ref.title", + "actions.goToDecl.label", + "actions.goToDeclToSide.label", + "actions.previewDecl.label", + "actions.goToDeclaration.label", + "actions.peekDecl.label", + "actions.goToTypeDefinition.label", + "actions.peekTypeDefinition.label", + "actions.goToImplementation.label", + "actions.peekImplementation.label", + "goToReferences.label", + "references.action.label", + "label.generic" + ], + "vs/editor/contrib/gotoSymbol/browser/link/goToDefinitionAtPosition": [ + "multipleResults" + ], + "vs/editor/contrib/gotoSymbol/browser/peek/referencesController": [ + "referenceSearchVisible", + "labelLoading", + "metaTitle.N" + ], + "vs/editor/contrib/gotoSymbol/browser/peek/referencesTree": [ + "referencesCount", + "referenceCount", + "treeAriaLabel" + ], + "vs/editor/contrib/gotoSymbol/browser/peek/referencesWidget": [ + "missingPreviewMessage", + "noResults", + "peekView.alternateTitle" + ], + "vs/editor/contrib/gotoSymbol/browser/referencesModel": [ + "aria.oneReference", + { + "key": "aria.oneReference.preview", + "comment": [ + "Placeholders are: 0: filename, 1:line number, 2: column number, 3: preview snippet of source code" + ] + }, + "aria.fileReferences.1", + "aria.fileReferences.N", + "aria.result.0", + "aria.result.1", + "aria.result.n1", + "aria.result.nm" + ], + "vs/editor/contrib/gotoSymbol/browser/symbolNavigation": [ + "hasSymbols", + "location.kb", + "location" + ], + "vs/editor/contrib/gpu/browser/gpuActions": [ + "logTextureAtlasStats.label", + "saveTextureAtlas.label", + "drawGlyph.label", + "gpuDebug.label" + ], + "vs/editor/contrib/hover/browser/contentHoverRendered": [ + "hoverAccessibilityStatusBar", + "hoverAccessibilityStatusBarActionWithKeybinding", + "hoverAccessibilityStatusBarActionWithoutKeybinding" + ], + "vs/editor/contrib/hover/browser/hoverAccessibleViews": [ + "increaseVerbosity", + "decreaseVerbosity" + ], + "vs/editor/contrib/hover/browser/hoverActionIds": [ + { + "key": "increaseHoverVerbosityLevel", + "comment": [ + "Label for action that will increase the hover verbosity level." + ] + }, + { + "key": "decreaseHoverVerbosityLevel", + "comment": [ + "Label for action that will decrease the hover verbosity level." + ] + } + ], + "vs/editor/contrib/hover/browser/hoverActions": [ + "showOrFocusHover.focus.noAutoFocus", + "showOrFocusHover.focus.focusIfVisible", + "showOrFocusHover.focus.autoFocusImmediately", + { + "key": "showOrFocusHover", + "comment": [ + "Label for action that will trigger the showing/focusing of a hover in the editor.", + "If the hover is not visible, it will show the hover.", + "This allows for users to show the hover without using the mouse." + ] + }, + "showOrFocusHoverDescription", + { + "key": "showDefinitionPreviewHover", + "comment": [ + "Label for action that will trigger the showing of definition preview hover in the editor.", + "This allows for users to show the definition preview hover without using the mouse." + ] + }, + "showDefinitionPreviewHoverDescription", + { + "key": "hideHover", + "comment": [ + "Label for action that will hide the hover in the editor." + ] + }, + { + "key": "scrollUpHover", + "comment": [ + "Action that allows to scroll up in the hover widget with the up arrow when the hover widget is focused." + ] + }, + "scrollUpHoverDescription", + { + "key": "scrollDownHover", + "comment": [ + "Action that allows to scroll down in the hover widget with the up arrow when the hover widget is focused." + ] + }, + "scrollDownHoverDescription", + { + "key": "scrollLeftHover", + "comment": [ + "Action that allows to scroll left in the hover widget with the left arrow when the hover widget is focused." + ] + }, + "scrollLeftHoverDescription", + { + "key": "scrollRightHover", + "comment": [ + "Action that allows to scroll right in the hover widget with the right arrow when the hover widget is focused." + ] + }, + "scrollRightHoverDescription", + { + "key": "pageUpHover", + "comment": [ + "Action that allows to page up in the hover widget with the page up command when the hover widget is focused." + ] + }, + "pageUpHoverDescription", + { + "key": "pageDownHover", + "comment": [ + "Action that allows to page down in the hover widget with the page down command when the hover widget is focused." + ] + }, + "pageDownHoverDescription", + { + "key": "goToTopHover", + "comment": [ + "Action that allows to go to the top of the hover widget with the home command when the hover widget is focused." + ] + }, + "goToTopHoverDescription", + { + "key": "goToBottomHover", + "comment": [ + "Action that allows to go to the bottom in the hover widget with the end command when the hover widget is focused." + ] + }, + "goToBottomHoverDescription" + ], + "vs/editor/contrib/hover/browser/hoverCopyButton": [ + "hover.copy", + "hover.copied" + ], + "vs/editor/contrib/hover/browser/markdownHoverParticipant": [ + "increaseHoverVerbosity", + "decreaseHoverVerbosity", + "modesContentHover.loading", + "stopped rendering", + "too many characters", + "increaseVerbosityWithKb", + "increaseVerbosity", + "decreaseVerbosityWithKb", + "decreaseVerbosity" + ], + "vs/editor/contrib/hover/browser/markerHoverParticipant": [ + "view problem", + "noQuickFixes", + "checkingForQuickFixes", + "noQuickFixes", + "quick fixes" + ], + "vs/editor/contrib/indentation/browser/indentation": [ + "configuredTabSize", + "defaultTabSize", + "currentTabSize", + { + "key": "selectTabWidth", + "comment": [ + "Tab corresponds to the tab key" + ] + }, + "indentationToSpaces", + "indentationToSpacesDescription", + "indentationToTabs", + "indentationToTabsDescription", + "indentUsingTabs", + "indentUsingTabsDescription", + "indentUsingSpaces", + "indentUsingSpacesDescription", + "changeTabDisplaySize", + "changeTabDisplaySizeDescription", + "detectIndentation", + "detectIndentationDescription", + "editor.reindentlines", + "editor.reindentlinesDescription", + "editor.reindentselectedlines", + "editor.reindentselectedlinesDescription" + ], + "vs/editor/contrib/inlayHints/browser/inlayHintsHover": [ + "hint.dbl", + "links.navigate.kb.meta.mac", + "links.navigate.kb.meta", + "links.navigate.kb.alt.mac", + "links.navigate.kb.alt", + "hint.defAndCommand", + "hint.def", + "hint.cmd" + ], + "vs/editor/contrib/inlineCompletions/browser/controller/commands": [ + "inlineSuggest.trigger.description", + "inlineSuggest.trigger.args", + "noInlineSuggestionAvailable", + "acceptWord", + "acceptLine", + "accept", + "accept", + "jump", + "reject", + "action.inlineSuggest.alwaysShowToolbar", + "action.inlineSuggest.dev.extractRepro", + "action.inlineSuggest.showNext", + "action.inlineSuggest.showPrevious", + "action.inlineSuggest.trigger", + "action.inlineSuggest.acceptNextWord", + "action.inlineSuggest.acceptNextLine", + "action.inlineSuggest.accept", + "action.inlineSuggest.acceptAlternativeAction", + "action.inlineSuggest.jump", + "action.inlineSuggest.hide", + "action.inlineSuggest.toggleShowCollapsed" + ], + "vs/editor/contrib/inlineCompletions/browser/controller/inlineCompletionContextKeys": [ + "inlineSuggestionVisible", + "inlineSuggestionAlternativeActionVisible", + "inlineSuggestionHasIndentation", + "inlineSuggestionHasIndentationLessThanTabSize", + "suppressSuggestions", + "cursorBeforeGhostText", + "cursorInIndentation", + "editor.hasSelection", + "cursorAtInlineEdit", + "inlineEditVisible", + "tabShouldJumpToInlineEdit", + "tabShouldAcceptInlineEdit", + "inInlineEditsPreviewEditor" + ], + "vs/editor/contrib/inlineCompletions/browser/controller/inlineCompletionsController": [ + "showAccessibleViewHint" + ], + "vs/editor/contrib/inlineCompletions/browser/hintsWidget/hoverParticipant": [ + "hoverAccessibilityStatusBar", + "inlineSuggestionFollows" + ], + "vs/editor/contrib/inlineCompletions/browser/hintsWidget/inlineCompletionsHintsWidget": [ + "parameterHintsNextIcon", + "parameterHintsPreviousIcon", + { + "key": "content", + "comment": [ + "A label", + "A keybinding" + ] + }, + "previous", + "next" + ], + "vs/editor/contrib/inlineCompletions/browser/model/renameSymbolProcessor": [ + "rename", + "rename" + ], + "vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/components/gutterIndicatorMenu": [ + "goto", + "accept", + "reject", + "showExpanded", + "showCollapsed", + "snooze", + "settings" + ], + "vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/components/gutterIndicatorView": [ + "inlineSuggestion" + ], + "vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsWordReplacementView": [ + "labelOccurence", + "labelOccurences", + "shiftToSeeOccurences" + ], + "vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/theme": [ + "inlineEdit.originalBackground", + "inlineEdit.modifiedBackground", + "inlineEdit.originalChangedLineBackground", + "inlineEdit.originalChangedTextBackground", + "inlineEdit.modifiedChangedLineBackground", + "inlineEdit.modifiedChangedTextBackground", + "inlineEdit.gutterIndicator.primaryForeground", + "inlineEdit.gutterIndicator.primaryBorder", + "inlineEdit.gutterIndicator.primaryBackground", + "inlineEdit.gutterIndicator.secondaryForeground", + "inlineEdit.gutterIndicator.secondaryBorder", + "inlineEdit.gutterIndicator.secondaryBackground", + "inlineEdit.gutterIndicator.successfulForeground", + "inlineEdit.gutterIndicator.successfulBorder", + "inlineEdit.gutterIndicator.successfulBackground", + "inlineEdit.gutterIndicator.background", + "inlineEdit.originalBorder", + "inlineEdit.modifiedBorder", + "inlineEdit.tabWillAcceptModifiedBorder", + "inlineEdit.tabWillAcceptOriginalBorder" + ], + "vs/editor/contrib/inPlaceReplace/browser/inPlaceReplace": [ + "InPlaceReplaceAction.previous.label", + "InPlaceReplaceAction.next.label" + ], + "vs/editor/contrib/insertFinalNewLine/browser/insertFinalNewLine": [ + "insertFinalNewLine" + ], + "vs/editor/contrib/lineSelection/browser/lineSelection": [ + "expandLineSelection" + ], + "vs/editor/contrib/linesOperations/browser/linesOperations": [ + { + "key": "miCopyLinesUp", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miCopyLinesDown", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miDuplicateSelection", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miMoveLinesUp", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miMoveLinesDown", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "lines.copyUp", + "lines.copyDown", + "duplicateSelection", + "lines.moveUp", + "lines.moveDown", + "lines.sortAscending", + "lines.sortDescending", + "lines.deleteDuplicates", + "lines.reverseLines", + "lines.trimTrailingWhitespace", + "lines.delete", + "lines.indent", + "lines.outdent", + "lines.insertBefore", + "lines.insertAfter", + "lines.deleteAllLeft", + "lines.deleteAllRight", + "lines.joinLines", + "editor.transpose", + "editor.transformToUppercase", + "editor.transformToLowercase", + "editor.transformToTitlecase", + "editor.transformToSnakecase", + "editor.transformToCamelcase", + "editor.transformToPascalcase", + "editor.transformToKebabcase" + ], + "vs/editor/contrib/linkedEditing/browser/linkedEditing": [ + "editorLinkedEditingBackground", + "linkedEditing.label" + ], + "vs/editor/contrib/links/browser/links": [ + "invalid.url", + "missing.url", + "links.navigate.executeCmd", + "links.navigate.follow", + "links.navigate.kb.meta.mac", + "links.navigate.kb.meta", + "links.navigate.kb.alt.mac", + "links.navigate.kb.alt", + "tooltip.explanation", + "label" + ], + "vs/editor/contrib/message/browser/messageController": [ + "messageVisible" + ], + "vs/editor/contrib/multicursor/browser/multicursor": [ + "cursorAdded", + "cursorsAdded", + { + "key": "miInsertCursorAbove", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miInsertCursorBelow", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miInsertCursorAtEndOfEachLineSelected", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miAddSelectionToNextFindMatch", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miAddSelectionToPreviousFindMatch", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miSelectHighlights", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "mutlicursor.focusNextCursor.description", + "mutlicursor.focusPreviousCursor.description", + "mutlicursor.insertAbove", + "mutlicursor.insertBelow", + "mutlicursor.insertAtEndOfEachLineSelected", + "mutlicursor.addCursorsToBottom", + "mutlicursor.addCursorsToTop", + "addSelectionToNextFindMatch", + "addSelectionToPreviousFindMatch", + "moveSelectionToNextFindMatch", + "moveSelectionToPreviousFindMatch", + "selectAllOccurrencesOfFindMatch", + "changeAll.label", + "mutlicursor.focusNextCursor", + "mutlicursor.focusPreviousCursor" + ], + "vs/editor/contrib/parameterHints/browser/parameterHints": [ + "parameterHints.trigger.label" + ], + "vs/editor/contrib/parameterHints/browser/parameterHintsWidget": [ + "parameterHintsNextIcon", + "parameterHintsPreviousIcon", + "hint", + "editorHoverWidgetHighlightForeground" + ], + "vs/editor/contrib/peekView/browser/peekView": [ + "inReferenceSearchEditor", + "label.close", + "peekViewTitleBackground", + "peekViewTitleForeground", + "peekViewTitleInfoForeground", + "peekViewBorder", + "peekViewResultsBackground", + "peekViewResultsMatchForeground", + "peekViewResultsFileForeground", + "peekViewResultsSelectionBackground", + "peekViewResultsSelectionForeground", + "peekViewEditorBackground", + "peekViewEditorGutterBackground", + "peekViewEditorStickScrollBackground", + "peekViewEditorStickyScrollGutterBackground", + "peekViewResultsMatchHighlight", + "peekViewEditorMatchHighlight", + "peekViewEditorMatchHighlightBorder" + ], + "vs/editor/contrib/placeholderText/browser/placeholderText.contribution": [ + "placeholderForeground" + ], + "vs/editor/contrib/quickAccess/browser/gotoLineQuickAccess": [ + "gotoLine.noEditor", + "gotoLineToggleButton", + "gotoLine.noEditor", + "gotoLine.offsetPromptZero", + "gotoLine.offsetPrompt", + "gotoLine.goToPosition", + "gotoLine.linePrompt", + "gotoLine.lineColumnPrompt", + "gotoLine.columnPrompt", + "gotoLine.goToPosition" + ], + "vs/editor/contrib/quickAccess/browser/gotoSymbolQuickAccess": [ + "cannotRunGotoSymbolWithoutEditor", + "cannotRunGotoSymbolWithoutSymbolProvider", + "noMatchingSymbolResults", + "noSymbolResults", + "openToSide", + "openToBottom", + "symbols", + "property", + "method", + "function", + "_constructor", + "variable", + "class", + "struct", + "event", + "operator", + "interface", + "namespace", + "package", + "typeParameter", + "modules", + "property", + "enum", + "enumMember", + "string", + "file", + "array", + "number", + "boolean", + "object", + "key", + "field", + "constant" + ], + "vs/editor/contrib/readOnlyMessage/browser/contribution": [ + "editor.simple.readonly", + "editor.readonly" + ], + "vs/editor/contrib/rename/browser/rename": [ + "no result", + "resolveRenameLocationFailed", + "label", + "quotableLabel", + "aria", + "rename.failedApply", + "rename.failed", + "enablePreview", + "rename.label", + "focusNextRenameSuggestion", + "focusPreviousRenameSuggestion" + ], + "vs/editor/contrib/rename/browser/renameWidget": [ + "renameInputVisible", + "renameInputFocused", + { + "key": "label", + "comment": [ + "placeholders are keybindings, e.g \"F2 to Rename, Shift+F2 to Preview\"" + ] + }, + "renameSuggestionsReceivedAria", + "renameAriaLabel", + "generateRenameSuggestionsButton", + "cancelRenameSuggestionsButton" + ], + "vs/editor/contrib/smartSelect/browser/smartSelect": [ + { + "key": "miSmartSelectGrow", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miSmartSelectShrink", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "smartSelect.expand", + "smartSelect.shrink" + ], + "vs/editor/contrib/snippet/browser/snippetController2": [ + "inSnippetMode", + "hasNextTabstop", + "hasPrevTabstop", + "next" + ], + "vs/editor/contrib/snippet/browser/snippetVariables": [ + "Sunday", + "Monday", + "Tuesday", + "Wednesday", + "Thursday", + "Friday", + "Saturday", + "SundayShort", + "MondayShort", + "TuesdayShort", + "WednesdayShort", + "ThursdayShort", + "FridayShort", + "SaturdayShort", + "January", + "February", + "March", + "April", + "May", + "June", + "July", + "August", + "September", + "October", + "November", + "December", + "JanuaryShort", + "FebruaryShort", + "MarchShort", + "AprilShort", + "MayShort", + "JuneShort", + "JulyShort", + "AugustShort", + "SeptemberShort", + "OctoberShort", + "NovemberShort", + "DecemberShort" + ], + "vs/editor/contrib/stickyScroll/browser/stickyScrollActions": [ + { + "key": "mitoggleStickyScroll", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "stickyScroll", + { + "key": "miStickyScroll", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "mifocusEditorStickyScroll", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "toggleEditorStickyScroll", + "toggleEditorStickyScroll.description", + "focusStickyScroll", + "selectNextStickyScrollLine.title", + "selectPreviousStickyScrollLine.title", + "goToFocusedStickyScrollLine.title", + "selectEditor.title" + ], + "vs/editor/contrib/suggest/browser/suggest": [ + "suggestWidgetHasSelection", + "suggestWidgetDetailsVisible", + "suggestWidgetDetailsFocused", + "suggestWidgetMultipleSuggestions", + "suggestionMakesTextEdit", + "acceptSuggestionOnEnter", + "suggestionHasInsertAndReplaceRange", + "suggestionInsertMode", + "suggestionCanResolve" + ], + "vs/editor/contrib/suggest/browser/suggestController": [ + "aria.alert.snippet", + "accept.insert", + "accept.insert", + "accept.replace", + "accept.replace", + "accept.insert", + "focus.suggestion", + "detail.more", + "detail.less", + "suggest.trigger.label", + "suggest.reset.label" + ], + "vs/editor/contrib/suggest/browser/suggestWidget": [ + "editorSuggestWidgetBackground", + "editorSuggestWidgetBorder", + "editorSuggestWidgetForeground", + "editorSuggestWidgetSelectedForeground", + "editorSuggestWidgetSelectedIconForeground", + "editorSuggestWidgetSelectedBackground", + "editorSuggestWidgetHighlightForeground", + "editorSuggestWidgetFocusHighlightForeground", + "editorSuggestWidgetStatusForeground", + "suggestWidget.loading", + "suggestWidget.noSuggestions", + "suggest", + "label.full", + "label.detail", + "label.desc", + "label", + "ariaCurrenttSuggestionReadDetails" + ], + "vs/editor/contrib/suggest/browser/suggestWidgetDetails": [ + "details.close", + "loading" + ], + "vs/editor/contrib/suggest/browser/suggestWidgetRenderer": [ + "suggestMoreInfoIcon", + "readMore" + ], + "vs/editor/contrib/suggest/browser/wordContextKey": [ + "desc" + ], + "vs/editor/contrib/symbolIcons/browser/symbolIcons": [ + "symbolIcon.arrayForeground", + "symbolIcon.booleanForeground", + "symbolIcon.classForeground", + "symbolIcon.colorForeground", + "symbolIcon.constantForeground", + "symbolIcon.constructorForeground", + "symbolIcon.enumeratorForeground", + "symbolIcon.enumeratorMemberForeground", + "symbolIcon.eventForeground", + "symbolIcon.fieldForeground", + "symbolIcon.fileForeground", + "symbolIcon.folderForeground", + "symbolIcon.functionForeground", + "symbolIcon.interfaceForeground", + "symbolIcon.keyForeground", + "symbolIcon.keywordForeground", + "symbolIcon.methodForeground", + "symbolIcon.moduleForeground", + "symbolIcon.namespaceForeground", + "symbolIcon.nullForeground", + "symbolIcon.numberForeground", + "symbolIcon.objectForeground", + "symbolIcon.operatorForeground", + "symbolIcon.packageForeground", + "symbolIcon.propertyForeground", + "symbolIcon.referenceForeground", + "symbolIcon.snippetForeground", + "symbolIcon.stringForeground", + "symbolIcon.structForeground", + "symbolIcon.textForeground", + "symbolIcon.typeParameterForeground", + "symbolIcon.unitForeground", + "symbolIcon.variableForeground" + ], + "vs/editor/contrib/toggleTabFocusMode/browser/toggleTabFocusMode": [ + "toggle.tabMovesFocus.on", + "toggle.tabMovesFocus.off", + { + "key": "toggle.tabMovesFocus", + "comment": [ + "Turn on/off use of tab key for moving focus around VS Code" + ] + }, + "tabMovesFocusDescriptions" + ], + "vs/editor/contrib/tokenization/browser/tokenization": [ + "forceRetokenize" + ], + "vs/editor/contrib/unicodeHighlighter/browser/bannerController": [ + "closeBanner" + ], + "vs/editor/contrib/unicodeHighlighter/browser/unicodeHighlighter": [ + "warningIcon", + "unicodeHighlighting.thisDocumentHasManyNonBasicAsciiUnicodeCharacters", + "unicodeHighlighting.thisDocumentHasManyAmbiguousUnicodeCharacters", + "unicodeHighlighting.thisDocumentHasManyInvisibleUnicodeCharacters", + "unicodeHighlight.configureUnicodeHighlightOptions", + "unicodeHighlight.characterIsAmbiguousASCII", + "unicodeHighlight.characterIsAmbiguous", + "unicodeHighlight.characterIsInvisible", + "unicodeHighlight.characterIsNonBasicAscii", + "unicodeHighlight.adjustSettings", + "unicodeHighlight.disableHighlightingInComments.shortLabel", + "unicodeHighlight.disableHighlightingInStrings.shortLabel", + "unicodeHighlight.disableHighlightingOfAmbiguousCharacters.shortLabel", + "unicodeHighlight.disableHighlightingOfInvisibleCharacters.shortLabel", + "unicodeHighlight.disableHighlightingOfNonBasicAsciiCharacters.shortLabel", + "unicodeHighlight.excludeInvisibleCharFromBeingHighlighted", + "unicodeHighlight.excludeCharFromBeingHighlighted", + "unicodeHighlight.allowCommonCharactersInLanguage", + "action.unicodeHighlight.disableHighlightingInComments", + "action.unicodeHighlight.disableHighlightingInStrings", + "action.unicodeHighlight.disableHighlightingOfAmbiguousCharacters", + "action.unicodeHighlight.disableHighlightingOfInvisibleCharacters", + "action.unicodeHighlight.disableHighlightingOfNonBasicAsciiCharacters", + "action.unicodeHighlight.showExcludeOptions" + ], + "vs/editor/contrib/unusualLineTerminators/browser/unusualLineTerminators": [ + "unusualLineTerminators.title", + "unusualLineTerminators.message", + "unusualLineTerminators.detail", + { + "key": "unusualLineTerminators.fix", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "unusualLineTerminators.ignore" + ], + "vs/editor/contrib/wordHighlighter/browser/highlightDecorations": [ + "wordHighlight", + "wordHighlightStrong", + "wordHighlightText", + "wordHighlightBorder", + "wordHighlightStrongBorder", + "wordHighlightTextBorder", + "overviewRulerWordHighlightForeground", + "overviewRulerWordHighlightStrongForeground", + "overviewRulerWordHighlightTextForeground" + ], + "vs/editor/contrib/wordHighlighter/browser/wordHighlighter": [ + "wordHighlight.next.label", + "wordHighlight.previous.label", + "wordHighlight.trigger.label" + ], + "vs/editor/contrib/wordOperations/browser/wordOperations": [ + "deleteInsideWord.args.onlyWord", + "deleteInsideWord", + "deleteInsideWord.description" + ], + "vs/platform/accessibilitySignal/browser/accessibilitySignalService": [ + "accessibilitySignals.positionHasError.name", + "accessibility.signals.positionHasError", + "accessibilitySignals.positionHasWarning.name", + "accessibility.signals.positionHasWarning", + "accessibilitySignals.lineHasError.name", + "accessibility.signals.lineHasError", + "accessibilitySignals.lineHasWarning.name", + "accessibility.signals.lineHasWarning", + "accessibilitySignals.lineHasFoldedArea.name", + "accessibility.signals.lineHasFoldedArea", + "accessibilitySignals.lineHasBreakpoint.name", + "accessibility.signals.lineHasBreakpoint", + "accessibilitySignals.lineHasInlineSuggestion.name", + "accessibilitySignals.nextEditSuggestion.name", + "accessibility.signals.nextEditSuggestion", + "accessibilitySignals.terminalQuickFix.name", + "accessibility.signals.terminalQuickFix", + "accessibilitySignals.onDebugBreak.name", + "accessibility.signals.onDebugBreak", + "accessibilitySignals.noInlayHints", + "accessibility.signals.noInlayHints", + "accessibilitySignals.taskCompleted", + "accessibility.signals.taskCompleted", + "accessibilitySignals.taskFailed", + "accessibility.signals.taskFailed", + "accessibilitySignals.terminalCommandFailed", + "accessibility.signals.terminalCommandFailed", + "accessibilitySignals.terminalCommandSucceeded", + "accessibility.signals.terminalCommandSucceeded", + "accessibilitySignals.terminalBell", + "accessibility.signals.terminalBell", + "accessibilitySignals.notebookCellCompleted", + "accessibility.signals.notebookCellCompleted", + "accessibilitySignals.notebookCellFailed", + "accessibility.signals.notebookCellFailed", + "accessibilitySignals.diffLineInserted", + "accessibilitySignals.diffLineDeleted", + "accessibilitySignals.diffLineModified", + "accessibilitySignals.chatEditModifiedFile", + "accessibility.signals.chatEditModifiedFile", + "accessibilitySignals.chatRequestSent", + "accessibility.signals.chatRequestSent", + "accessibilitySignals.chatResponseReceived", + "accessibilitySignals.codeActionRequestTriggered", + "accessibility.signals.codeActionRequestTriggered", + "accessibilitySignals.codeActionApplied", + "accessibilitySignals.progress", + "accessibility.signals.progress", + "accessibilitySignals.clear", + "accessibility.signals.clear", + "accessibilitySignals.save", + "accessibility.signals.save", + "accessibilitySignals.format", + "accessibility.signals.format", + "accessibilitySignals.voiceRecordingStarted", + "accessibilitySignals.voiceRecordingStopped", + "accessibilitySignals.editsKept", + "accessibility.signals.editsKept", + "accessibilitySignals.editsUndone", + "accessibility.signals.editsUndone", + "accessibilitySignals.chatUserActionRequired", + "accessibility.signals.chatUserActionRequired" + ], + "vs/platform/action/common/actionCommonCategories": [ + "view", + "help", + "test", + "file", + "preferences", + { + "key": "developer", + "comment": [ + "A developer on Code itself or someone diagnosing issues in Code" + ] + } + ], + "vs/platform/actions/browser/buttonbar": [ + "labelWithKeybinding", + "moreActions", + "moreActions" + ], + "vs/platform/actions/browser/dropdownActionViewItemWithKeybinding": [ + "titleAndKb" + ], + "vs/platform/actions/browser/menuEntryActionViewItem": [ + "titleAndKb", + "titleAndKb", + "titleAndKbAndAlt", + { + "key": "content2", + "comment": [ + "A label with keybindg like \"ESC to dismiss\"" + ] + }, + { + "key": "content", + "comment": [ + "A label", + "A keybinding" + ] + } + ], + "vs/platform/actions/browser/toolbar": [ + "hide", + "resetThisMenu" + ], + "vs/platform/actions/common/menuResetAction": [ + "title" + ], + "vs/platform/actions/common/menuService": [ + "hide.label", + "configure keybinding" + ], + "vs/platform/actionWidget/browser/actionList": [ + { + "key": "label-preview", + "comment": [ + "placeholders are keybindings, e.g \"F2 to Apply, Shift+F2 to Preview\"" + ] + }, + { + "key": "label", + "comment": [ + "placeholder is a keybinding, e.g \"F2 to Apply\"" + ] + }, + { + "key": "customQuickFixWidget.labels", + "comment": [ + "Action widget labels for accessibility." + ] + }, + { + "key": "customQuickFixWidget", + "comment": [ + "An action widget option" + ] + } + ], + "vs/platform/actionWidget/browser/actionWidget": [ + "actionBar.toggledBackground", + "codeActionMenuVisible", + "hideCodeActionWidget.title", + "selectPrevCodeAction.title", + "selectNextCodeAction.title", + "acceptSelected.title", + "previewSelected.title" + ], + "vs/platform/configuration/common/configurationRegistry": [ + "defaultLanguageConfigurationOverrides.title", + "defaultLanguageConfiguration.description", + "overrideSettings.defaultDescription", + "overrideSettings.errorMessage", + "overrideSettings.defaultDescription", + "overrideSettings.errorMessage", + "config.property.empty", + "config.property.languageDefault", + "config.property.duplicate", + "config.policy.duplicate" + ], + "vs/platform/contextkey/browser/contextKeyService": [ + "getContextKeyInfo" + ], + "vs/platform/contextkey/common/contextkey": [ + "contextkey.parser.error.emptyString", + "contextkey.parser.error.emptyString.hint", + "contextkey.parser.error.noInAfterNot", + "contextkey.parser.error.closingParenthesis", + "contextkey.parser.error.unexpectedToken", + "contextkey.parser.error.unexpectedToken.hint", + "contextkey.parser.error.unexpectedEOF", + "contextkey.parser.error.unexpectedEOF.hint", + "contextkey.parser.error.expectedButGot", + "contextkey.scanner.errorForLinterWithHint", + "contextkey.scanner.errorForLinter" + ], + "vs/platform/contextkey/common/contextkeys": [ + "isMac", + "isLinux", + "isWindows", + "isWeb", + "isMacNative", + "isIOS", + "isMobile", + "productQualityType", + "inputFocus" + ], + "vs/platform/contextkey/common/scanner": [ + "contextkey.scanner.hint.didYouMean1", + "contextkey.scanner.hint.didYouMean2", + "contextkey.scanner.hint.didYouMean3", + "contextkey.scanner.hint.didYouForgetToOpenOrCloseQuote", + "contextkey.scanner.hint.didYouForgetToEscapeSlash" + ], + "vs/platform/dialogs/browser/dialog": [ + "aboutDetail" + ], + "vs/platform/dialogs/common/dialogs": [ + { + "key": "yesButton", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "cancelButton", + "cancelButton", + "cancelButton", + { + "key": "okButton", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "okButton", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "cancelButton", + "moreFile", + "moreFiles" + ], + "vs/platform/dialogs/electron-browser/dialog": [ + { + "key": "aboutDetail", + "comment": [ + "Electron, Chromium, Node.js and V8 are product names that need no translation" + ] + } + ], + "vs/platform/dialogs/electron-main/dialogMainService": [ + "open", + "openFolder", + { + "key": "selectFolder", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "openFile", + "openWorkspaceTitle", + { + "key": "openWorkspace", + "comment": [ + "&& denotes a mnemonic" + ] + } + ], + "vs/platform/dnd/browser/dnd": [ + "fileTooLarge" + ], + "vs/platform/environment/node/argv": [ + "optionsUpperCase", + "extensionsManagement", + "troubleshooting", + "mcp", + "prompt", + "chatMode", + "addFile", + "chatMaximize", + "reuseWindowForChat", + "newWindowForChat", + "profileName", + "help", + "cliDataDir", + "cliDataDir", + "diff", + "merge", + "add", + "remove", + "goto", + "newWindow", + "reuseWindow", + "wait", + "locale", + "userDataDir", + "profileName", + "help", + "extensionHomePath", + "listExtensions", + "showVersions", + "category", + "installExtension", + "install prerelease", + "uninstallExtension", + "updateExtensions", + "experimentalApis", + "addMcp", + "version", + "verbose", + "log", + "status", + "prof-startup", + "disableExtensions", + "disableExtension", + "turn sync", + "inspect-extensions", + "inspect-brk-extensions", + "disableLCDText", + "disableGPU", + "disableChromiumSandbox", + "locateShellIntegrationPath", + "telemetry", + "transient", + "deprecated.useInstead", + "cliPrompt", + "paths", + "usage", + "options", + "subcommands", + "stdinUsage", + "unknownVersion", + "unknownCommit" + ], + "vs/platform/environment/node/argvHelper": [ + "multipleValues", + "emptyValue", + "deprecatedArgument", + "unknownSubCommandOption", + "unknownOption", + "gotoValidation" + ], + "vs/platform/extensionManagement/common/abstractExtensionManagementService": [ + "not allowed to install", + "incompatible platform", + "learn why", + "MarketPlaceDisabled", + "malicious extension", + "notFoundDeprecatedReplacementExtension", + "incompatible platform", + "incompatibleAPI", + "notFoundReleaseExtension", + "notFoundCompatibleDependency", + "singleDependentError", + "twoDependentsError", + "multipleDependentsError", + "singleIndirectDependentError", + "twoIndirectDependentsError", + "multipleIndirectDependentsError" + ], + "vs/platform/extensionManagement/common/allowedExtensionsService": [ + "specific extension not allowed", + "extension prerelease not allowed", + "specific version of extension not allowed", + "publisher not allowed", + "prerelease versions from this publisher not allowed" + ], + "vs/platform/extensionManagement/common/extensionManagement": [ + "extensionsConfigurationTitle", + "extensions.allowed", + "extensions.allowed.none", + "extensions.allowed.all", + "extensions.allowed.policy", + "extensions.allow.description", + "extensions.allowed.enable.desc", + "extensions.allowed.disable.desc", + "extensions.allowed.disable.stable.desc", + "extensions.allow.version.description", + "extension.publisher.allow.description", + "extensions.publisher.allowed.enable.desc", + "extensions.publisher.allowed.disable.desc", + "extensions.publisher.allowed.disable.stable.desc", + "extensions.allow.all.description", + "extensions.allow.all.enable", + "extensions.allow.all.disable", + "extensions", + "preferences" + ], + "vs/platform/extensionManagement/common/extensionManagementCLI": [ + "notFound", + "useId", + "listFromLocation", + "installingExtensionsOnLocation", + "installingExtensions", + "error while installing extensions", + "installation failed", + { + "key": "updateExtensionsQuery", + "comment": [ + "Placeholder is for the count of extensions" + ] + }, + "updateExtensionsNoExtensions", + "updateExtensionsNewVersionsAvailable", + "errorUpdatingExtension", + "successUpdate", + "alreadyInstalled-checkAndUpdate", + "alreadyInstalled", + "alreadyInstalled", + "updateMessage", + "installing builtin with version", + "installing builtin ", + "installing with version", + "installing", + "errorInstallingExtension", + "successInstall", + "successVsixInstall", + "cancelVsixInstall", + "forceDowngrade", + "builtin", + "forceUninstall", + "uninstalling", + "successUninstallFromLocation", + "successUninstall", + "notInstalleddOnLocation", + "notInstalled" + ], + "vs/platform/extensionManagement/common/extensionNls": [ + "missingNLSKey" + ], + "vs/platform/extensionManagement/common/extensionsScannerService": [ + "fileReadFail", + "jsonParseFail", + "jsonParseInvalidType", + "jsonsParseReportErrors", + "jsonInvalidFormat", + "jsonsParseReportErrors", + "jsonInvalidFormat" + ], + "vs/platform/extensionManagement/node/extensionManagementService": [ + "incompatible", + "notAllowed", + "invalidManifest", + "signature verification not executed", + "signature verification failed", + "signature verification failed", + "errorDeleting", + "cannot read", + "restartCode", + "restartCode" + ], + "vs/platform/extensionManagement/node/extensionManagementUtil": [ + "invalidManifest" + ], + "vs/platform/extensions/common/extensionValidator": [ + "extensionDescription.publisher", + "extensionDescription.name", + "extensionDescription.version", + "extensionDescription.engines", + "extensionDescription.engines.vscode", + "extensionDescription.extensionDependencies", + "extensionDescription.activationEvents1", + "extensionDescription.activationEvents2", + "extensionDescription.extensionKind", + "extensionDescription.main1", + "extensionDescription.main2", + "extensionDescription.browser1", + "extensionDescription.browser2", + "notSemver", + "apiProposalMismatch1", + "apiProposalMismatch2", + "versionSyntax", + "versionSpecificity1", + "versionSpecificity2", + "versionMismatch" + ], + "vs/platform/externalTerminal/node/externalTerminalService": [ + "console.title", + "mac.terminal.script.failed", + "mac.terminal.type.not.supported", + "press.any.key", + "linux.term.failed", + "ext.term.app.not.found" + ], + "vs/platform/files/browser/htmlFileSystemProvider": [ + "fileSystemRenameError", + "fileSystemNotAllowedError" + ], + "vs/platform/files/browser/indexedDBFileSystemProvider": [ + "fileNotExists", + "fileIsDirectory", + "fileNotDirectory", + "dirIsNotEmpty", + "fileExceedsStorageQuota", + "internal" + ], + "vs/platform/files/common/files": [ + "unknownError", + "sizeB", + "sizeKB", + "sizeMB", + "sizeGB", + "sizeTB" + ], + "vs/platform/files/common/fileService": [ + "invalidPath", + "noProviderFound", + "fileNotFoundError", + "fileExists", + "err.write", + "writeFailedUnlockUnsupported", + "writeFailedAtomicUnsupported1", + "writeFailedAtomicUnsupported2", + "writeFailedAtomicUnlock", + "fileIsDirectoryWriteError", + "fileModifiedError", + "err.read", + "fileIsDirectoryReadError", + "fileNotModifiedError", + "fileTooLargeError", + "unableToMoveCopyError1", + "unableToMoveCopyError2", + "unableToMoveCopyError3", + "unableToMoveCopyError4", + "mkdirExistsError", + "deleteFailedTrashUnsupported", + "deleteFailedAtomicUnsupported", + "deleteFailedTrashAndAtomicUnsupported", + "deleteFailedNotFound", + "deleteFailedNonEmptyFolder", + "err.readonly", + "err.readonly" + ], + "vs/platform/files/common/io": [ + "fileTooLargeError" + ], + "vs/platform/files/electron-main/diskFileSystemProviderServer": [ + "binFailed", + "trashFailed" + ], + "vs/platform/files/node/diskFileSystemProvider": [ + "fileExists", + "fileNotExists", + "moveError", + "copyError", + "fileCopyErrorPathCase", + "fileMoveCopyErrorNotFound", + "fileMoveCopyErrorExists" + ], + "vs/platform/history/browser/contextScopedHistoryWidget": [ + "suggestWidgetVisible" + ], + "vs/platform/hover/browser/hoverWidget": [ + "hoverhint" + ], + "vs/platform/hover/browser/updatableHoverWidget": [ + "iconLabel.loading" + ], + "vs/platform/keybinding/common/abstractKeybindingService": [ + "first.chord", + "next.chord", + "missing.chord", + "missing.chord" + ], + "vs/platform/keyboardLayout/common/keyboardConfig": [ + "keyboardConfigurationTitle", + "dispatch", + "mapAltGrToCtrlAlt" + ], + "vs/platform/languagePacks/common/languagePacks": [ + "currentDisplayLanguage" + ], + "vs/platform/languagePacks/common/localizedStrings": [ + "open", + "close", + "find" + ], + "vs/platform/list/browser/listService": [ + "workbenchConfigurationTitle", + "multiSelectModifier.ctrlCmd", + "multiSelectModifier.alt", + { + "key": "multiSelectModifier", + "comment": [ + "- `ctrlCmd` refers to a value the setting can take and should not be localized.", + "- `Control` and `Command` refer to the modifier keys Ctrl or Cmd on the keyboard and can be localized." + ] + }, + { + "key": "openModeModifier", + "comment": [ + "`singleClick` and `doubleClick` refers to a value the setting can take and should not be localized." + ] + }, + "horizontalScrolling setting", + "list.scrollByPage", + "tree indent setting", + "render tree indent guides", + "list smoothScrolling setting", + "Mouse Wheel Scroll Sensitivity", + "Fast Scroll Sensitivity", + "defaultFindModeSettingKey.highlight", + "defaultFindModeSettingKey.filter", + "defaultFindModeSettingKey", + "keyboardNavigationSettingKey.simple", + "keyboardNavigationSettingKey.highlight", + "keyboardNavigationSettingKey.filter", + "keyboardNavigationSettingKey", + "keyboardNavigationSettingKeyDeprecated", + "defaultFindMatchTypeSettingKey.fuzzy", + "defaultFindMatchTypeSettingKey.contiguous", + "defaultFindMatchTypeSettingKey", + "expand mode", + "sticky scroll", + "sticky scroll maximum items", + "typeNavigationMode2" + ], + "vs/platform/log/common/log": [ + "trace", + "debug", + "info", + "warn", + "error", + "off" + ], + "vs/platform/markers/common/markers": [ + "sev.error", + "sev.warning", + "sev.info", + "sev.errors", + "sev.warnings", + "sev.infos" + ], + "vs/platform/markers/common/markerService": [ + "filtered", + "filtered.network" + ], + "vs/platform/mcp/common/allowedMcpServersService": [ + "mcp servers are not allowed" + ], + "vs/platform/mcp/common/mcpGalleryService": [ + "noReadme", + "readme.viewInBrowser" + ], + "vs/platform/mcp/common/mcpManagementService": [ + "not allowed to install" + ], + "vs/platform/menubar/electron-main/menubar": [ + { + "key": "miNewWindow", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "mFile", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "mEdit", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "mSelection", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "mView", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "mGoto", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "mRun", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "mTerminal", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "mWindow", + { + "key": "mHelp", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "mAbout", + { + "key": "miPreferences", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "mServices", + "mHide", + "mHideOthers", + "mShowAll", + "miQuit", + { + "key": "quit", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "exit", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "cancel", + "quitMessageMac", + "quitMessage", + "mMinimize", + "mZoom", + "mBringToFront", + { + "key": "miSwitchWindow", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "mNewTab", + "mShowPreviousTab", + "mShowNextTab", + "mMoveTabToNewWindow", + "mMergeAllWindows", + "miCheckForUpdates", + "miCheckingForUpdates", + "miDownloadUpdate", + "miDownloadingUpdate", + "miInstallUpdate", + "miInstallingUpdate", + "miRestartToUpdate" + ], + "vs/platform/native/electron-main/nativeHostMainService": [ + "warnEscalation", + { + "key": "ok", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "cancel", + "cantCreateBinFolder", + "warnEscalationUninstall", + { + "key": "ok", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "cancel", + "cantUninstall", + "sourceMissing", + "openExternalErrorLinkMessage", + "openExternalProgramErrorMessage", + { + "key": "copyLink", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "cancel", + { + "key": "ok", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "trace.message", + "trace.detail", + { + "key": "trace.ok", + "comment": [ + "&& denotes a mnemonic" + ] + } + ], + "vs/platform/notification/common/notification": [ + "severityPrefix.error", + "severityPrefix.warning", + "severityPrefix.info" + ], + "vs/platform/process/electron-main/processMainService": [ + "local" + ], + "vs/platform/quickinput/browser/commandsQuickAccess": [ + "recentlyUsed", + "suggested", + "commonlyUsed", + "morecCommands", + "suggested", + "commandPickAriaLabelWithKeybinding", + "removeFromRecentlyUsed", + "canNotRun" + ], + "vs/platform/quickinput/browser/helpQuickAccess": [ + "helpPickAriaLabel" + ], + "vs/platform/quickinput/browser/quickInput": [ + "inQuickInput", + "quickInputAlignment", + "quickInputType", + "cursorAtEndOfQuickInputBox", + "quickInput.back", + "inputModeEntry", + "quickInput.steps", + "quickInputBox.ariaLabel", + "ok", + "inputModeEntryDescription" + ], + "vs/platform/quickinput/browser/quickInputActions": [ + "quickInput", + "quickPick", + "quickInput.nextSeparatorWithQuickAccessFallback", + "quickInput.previousSeparatorWithQuickAccessFallback", + "nonQuickWidget" + ], + "vs/platform/quickinput/browser/quickInputController": [ + "quickInput.checkAll", + { + "key": "quickInput.visibleCount", + "comment": [ + "This tells the user how many items are shown in a list of items to select from. The items can be anything. Currently not visible, but read by screen readers." + ] + }, + { + "key": "quickInput.countSelected", + "comment": [ + "This tells the user how many items are selected in a list of items to select from. The items can be anything." + ] + }, + "ok", + "custom", + "quickInput.backWithKeybinding", + "quickInput.back" + ], + "vs/platform/quickinput/browser/quickInputList": [ + "quickInput" + ], + "vs/platform/quickinput/browser/quickInputUtils": [ + "executeCommand" + ], + "vs/platform/quickinput/browser/quickPickPin": [ + "terminal.commands.pinned", + "pinCommand", + "pinnedCommand" + ], + "vs/platform/quickinput/browser/tree/quickInputTreeAccessibilityProvider": [ + "quickTree" + ], + "vs/platform/quickinput/browser/tree/quickTree": [ + "quickInputBox.ariaLabel" + ], + "vs/platform/remoteTunnel/common/remoteTunnel": [ + "remoteTunnelLog" + ], + "vs/platform/remoteTunnel/node/remoteTunnelService": [ + "remoteTunnelService.building", + { + "key": "remoteTunnelService.authorizing", + "comment": [ + "{0} is a user account name, {1} a provider name (e.g. Github)" + ] + }, + { + "key": "remoteTunnelService.openTunnelWithName", + "comment": [ + "{0} is a tunnel name" + ] + }, + "remoteTunnelService.openTunnel", + "remoteTunnelService.serviceInstallFailed" + ], + "vs/platform/request/common/request": [ + "httpConfigurationTitle", + "useLocalProxy", + "httpConfigurationTitle", + "electronFetch", + "httpConfigurationTitle", + "proxy", + "strictSSL", + "proxyKerberosServicePrincipal", + "noProxy", + "proxyAuthorization", + "proxySupportOff", + "proxySupportOn", + "proxySupportFallback", + "proxySupportOverride", + "proxySupport", + "systemCertificates", + "systemCertificatesNode", + "systemCertificatesV2", + "fetchAdditionalSupport", + "networkInterfaceCheckInterval" + ], + "vs/platform/shell/node/shellEnv": [ + "resolveShellEnvTimeout", + "resolveShellEnvError", + "resolveShellEnvExitError" + ], + "vs/platform/telemetry/common/telemetryLogAppender": [ + "telemetryLog" + ], + "vs/platform/telemetry/common/telemetryService": [ + "telemetry.telemetryLevelMd", + "telemetry.docsStatement", + "telemetry.docsAndPrivacyStatement", + "telemetry.restart", + "telemetry.crashReports", + "telemetry.errors", + "telemetry.usage", + "telemetry.telemetryLevel.tableDescription", + "telemetry.telemetryLevel.deprecated", + "telemetryConfigurationTitle", + "telemetry.telemetryLevel.default", + "telemetry.telemetryLevel.error", + "telemetry.telemetryLevel.crash", + "telemetry.telemetryLevel.off", + "telemetry.telemetryLevel.policyDescription", + "telemetry.telemetryLevel.default", + "telemetry.telemetryLevel.error", + "telemetry.telemetryLevel.crash", + "telemetry.telemetryLevel.off", + "telemetry.feedback.enabled", + "telemetry.feedback.enabled", + "telemetry.enableTelemetry", + "telemetry.enableTelemetryMd", + "enableTelemetryDeprecated" + ], + "vs/platform/telemetry/common/telemetryUtils": [ + "telemetryLogName" + ], + "vs/platform/terminal/common/terminalLogService": [ + "terminalLoggerName" + ], + "vs/platform/terminal/common/terminalPlatformConfiguration": [ + "terminalProfile.args", + "terminalProfile.icon", + "terminalProfile.color", + "terminalProfile.env", + "terminalProfile.path", + "terminalProfile.overrideName", + "terminalAutomationProfile.path", + { + "key": "terminal.integrated.profile", + "comment": [ + "{0} is the platform, {1} is a code block, {2} and {3} are a link start and end" + ] + }, + "terminalIntegratedConfigurationTitle", + "terminal.integrated.automationProfile.linux", + "terminal.integrated.automationProfile.osx", + "terminal.integrated.automationProfile.windows", + "terminalProfile.windowsSource", + "terminalProfile.windowsExtensionIdentifier", + "terminalProfile.windowsExtensionId", + "terminalProfile.windowsExtensionTitle", + "terminalProfile.osxExtensionIdentifier", + "terminalProfile.osxExtensionId", + "terminalProfile.osxExtensionTitle", + "terminalProfile.linuxExtensionIdentifier", + "terminalProfile.linuxExtensionId", + "terminalProfile.linuxExtensionTitle", + "terminal.integrated.useWslProfiles", + "terminal.integrated.inheritEnv", + "terminal.integrated.persistentSessionScrollback", + "terminal.integrated.showLinkHover", + "terminal.integrated.confirmIgnoreProcesses", + "terminalIntegratedConfigurationTitle", + "terminal.integrated.defaultProfile.linux", + "terminal.integrated.defaultProfile.osx", + "terminal.integrated.defaultProfile.windows" + ], + "vs/platform/terminal/common/terminalProfiles": [ + "terminalAutomaticProfile" + ], + "vs/platform/terminal/node/ptyHostMain": [ + "ptyHost" + ], + "vs/platform/terminal/node/ptyService": [ + "terminal-history-restored" + ], + "vs/platform/terminal/node/terminalProcess": [ + "launchFail.cwdNotDirectory", + "launchFail.cwdDoesNotExist", + "launchFail.executableDoesNotExist", + "launchFail.executableIsNotFileOrSymlink" + ], + "vs/platform/theme/common/colors/baseColors": [ + "foreground", + "disabledForeground", + "errorForeground", + "descriptionForeground", + "iconForeground", + "focusBorder", + "contrastBorder", + "activeContrastBorder", + "selectionBackground", + "textLinkForeground", + "textLinkActiveForeground", + "textSeparatorForeground", + "textPreformatForeground", + "textPreformatBackground", + "textPreformatBorder", + "textBlockQuoteBackground", + "textBlockQuoteBorder", + "textCodeBlockBackground" + ], + "vs/platform/theme/common/colors/chartsColors": [ + "chartsForeground", + "chartsLines", + "chartsRed", + "chartsBlue", + "chartsYellow", + "chartsOrange", + "chartsGreen", + "chartsPurple" + ], + "vs/platform/theme/common/colors/editorColors": [ + "editorBackground", + "editorForeground", + "editorStickyScrollBackground", + "editorStickyScrollGutterBackground", + "editorStickyScrollHoverBackground", + "editorStickyScrollBorder", + "editorStickyScrollShadow", + "editorWidgetBackground", + "editorWidgetForeground", + "editorWidgetBorder", + "editorWidgetResizeBorder", + "editorError.background", + "editorError.foreground", + "errorBorder", + "editorWarning.background", + "editorWarning.foreground", + "warningBorder", + "editorInfo.background", + "editorInfo.foreground", + "infoBorder", + "editorHint.foreground", + "hintBorder", + "activeLinkForeground", + "editorSelectionBackground", + "editorSelectionForeground", + "editorInactiveSelection", + "editorSelectionHighlight", + "editorSelectionHighlightBorder", + "editorCompositionBorder", + "editorFindMatch", + "editorFindMatchForeground", + "findMatchHighlight", + "findMatchHighlightForeground", + "findRangeHighlight", + "editorFindMatchBorder", + "findMatchHighlightBorder", + "findRangeHighlightBorder", + "hoverHighlight", + "hoverBackground", + "hoverForeground", + "hoverBorder", + "statusBarBackground", + "editorInlayHintForeground", + "editorInlayHintBackground", + "editorInlayHintForegroundTypes", + "editorInlayHintBackgroundTypes", + "editorInlayHintForegroundParameter", + "editorInlayHintBackgroundParameter", + "editorLightBulbForeground", + "editorLightBulbAutoFixForeground", + "editorLightBulbAiForeground", + "snippetTabstopHighlightBackground", + "snippetTabstopHighlightBorder", + "snippetFinalTabstopHighlightBackground", + "snippetFinalTabstopHighlightBorder", + "diffEditorInserted", + "diffEditorRemoved", + "diffEditorInsertedLines", + "diffEditorRemovedLines", + "diffEditorInsertedLineGutter", + "diffEditorRemovedLineGutter", + "diffEditorOverviewInserted", + "diffEditorOverviewRemoved", + "diffEditorInsertedOutline", + "diffEditorRemovedOutline", + "diffEditorBorder", + "diffDiagonalFill", + "diffEditor.unchangedRegionBackground", + "diffEditor.unchangedRegionForeground", + "diffEditor.unchangedCodeBackground", + "widgetShadow", + "widgetBorder", + "toolbarHoverBackground", + "toolbarHoverOutline", + "toolbarActiveBackground", + "breadcrumbsFocusForeground", + "breadcrumbsBackground", + "breadcrumbsFocusForeground", + "breadcrumbsSelectedForeground", + "breadcrumbsSelectedBackground", + "mergeCurrentHeaderBackground", + "mergeCurrentContentBackground", + "mergeIncomingHeaderBackground", + "mergeIncomingContentBackground", + "mergeCommonHeaderBackground", + "mergeCommonContentBackground", + "mergeBorder", + "overviewRulerCurrentContentForeground", + "overviewRulerIncomingContentForeground", + "overviewRulerCommonContentForeground", + "overviewRulerFindMatchForeground", + "overviewRulerSelectionHighlightForeground", + "problemsErrorIconForeground", + "problemsWarningIconForeground", + "problemsInfoIconForeground" + ], + "vs/platform/theme/common/colors/inputColors": [ + "inputBoxBackground", + "inputBoxForeground", + "inputBoxBorder", + "inputBoxActiveOptionBorder", + "inputOption.hoverBackground", + "inputOption.activeBackground", + "inputOption.activeForeground", + "inputPlaceholderForeground", + "inputValidationInfoBackground", + "inputValidationInfoForeground", + "inputValidationInfoBorder", + "inputValidationWarningBackground", + "inputValidationWarningForeground", + "inputValidationWarningBorder", + "inputValidationErrorBackground", + "inputValidationErrorForeground", + "inputValidationErrorBorder", + "dropdownBackground", + "dropdownListBackground", + "dropdownForeground", + "dropdownBorder", + "buttonForeground", + "buttonSeparator", + "buttonBackground", + "buttonHoverBackground", + "buttonBorder", + "buttonSecondaryForeground", + "buttonSecondaryBackground", + "buttonSecondaryHoverBackground", + "radioActiveForeground", + "radioBackground", + "radioActiveBorder", + "radioInactiveForeground", + "radioInactiveBackground", + "radioInactiveBorder", + "radioHoverBackground", + "checkbox.background", + "checkbox.select.background", + "checkbox.foreground", + "checkbox.border", + "checkbox.select.border", + "checkbox.disabled.background", + "checkbox.disabled.foreground", + "keybindingLabelBackground", + "keybindingLabelForeground", + "keybindingLabelBorder", + "keybindingLabelBottomBorder" + ], + "vs/platform/theme/common/colors/listColors": [ + "listFocusBackground", + "listFocusForeground", + "listFocusOutline", + "listFocusAndSelectionOutline", + "listActiveSelectionBackground", + "listActiveSelectionForeground", + "listActiveSelectionIconForeground", + "listInactiveSelectionBackground", + "listInactiveSelectionForeground", + "listInactiveSelectionIconForeground", + "listInactiveFocusBackground", + "listInactiveFocusOutline", + "listHoverBackground", + "listHoverForeground", + "listDropBackground", + "listDropBetweenBackground", + "highlight", + "listFocusHighlightForeground", + "invalidItemForeground", + "listErrorForeground", + "listWarningForeground", + "listFilterWidgetBackground", + "listFilterWidgetOutline", + "listFilterWidgetNoMatchesOutline", + "listFilterWidgetShadow", + "listFilterMatchHighlight", + "listFilterMatchHighlightBorder", + "listDeemphasizedForeground", + "treeIndentGuidesStroke", + "treeInactiveIndentGuidesStroke", + "tableColumnsBorder", + "tableOddRowsBackgroundColor", + "editorActionListBackground", + "editorActionListForeground", + "editorActionListFocusForeground", + "editorActionListFocusBackground" + ], + "vs/platform/theme/common/colors/menuColors": [ + "menuBorder", + "menuForeground", + "menuBackground", + "menuSelectionForeground", + "menuSelectionBackground", + "menuSelectionBorder", + "menuSeparatorBackground" + ], + "vs/platform/theme/common/colors/minimapColors": [ + "minimapFindMatchHighlight", + "minimapSelectionOccurrenceHighlight", + "minimapSelectionHighlight", + "minimapInfo", + "overviewRuleWarning", + "minimapError", + "minimapBackground", + "minimapForegroundOpacity", + "minimapSliderBackground", + "minimapSliderHoverBackground", + "minimapSliderActiveBackground" + ], + "vs/platform/theme/common/colors/miscColors": [ + "sashActiveBorder", + "badgeBackground", + "badgeForeground", + "activityWarningBadge.foreground", + "activityWarningBadge.background", + "activityErrorBadge.foreground", + "activityErrorBadge.background", + "scrollbarShadow", + "scrollbarSliderBackground", + "scrollbarSliderHoverBackground", + "scrollbarSliderActiveBackground", + "scrollbarBackground", + "progressBarBackground", + "chartLine", + "chartAxis", + "chartGuide" + ], + "vs/platform/theme/common/colors/quickpickColors": [ + "pickerBackground", + "pickerForeground", + "pickerTitleBackground", + "pickerGroupForeground", + "pickerGroupBorder", + "quickInput.list.focusBackground deprecation", + "quickInput.listFocusForeground", + "quickInput.listFocusIconForeground", + "quickInput.listFocusBackground" + ], + "vs/platform/theme/common/colors/searchColors": [ + "search.resultsInfoForeground", + "searchEditor.queryMatch", + "searchEditor.editorFindMatchBorder" + ], + "vs/platform/theme/common/colorUtils": [ + "transparecyRequired", + "useDefault" + ], + "vs/platform/theme/common/iconRegistry": [ + "schema.fontId.formatError", + "iconDefinition.fontId", + "iconDefinition.fontCharacter", + "widgetClose", + "previousChangeIcon", + "nextChangeIcon" + ], + "vs/platform/theme/common/sizes/baseSizes": [ + "bodyFontSize", + "bodyFontSizeSmall", + "bodyFontSizeXSmall", + "codiconFontSize", + "cornerRadiusMedium", + "cornerRadiusXSmall", + "cornerRadiusSmall", + "cornerRadiusLarge", + "cornerRadiusXLarge", + "cornerRadiusCircle", + "strokeThickness" + ], + "vs/platform/theme/common/tokenClassificationRegistry": [ + "schema.token.settings", + "schema.token.foreground", + "schema.token.background.warning", + "schema.token.fontStyle", + "schema.fontStyle.error", + "schema.token.fontStyle.none", + "schema.token.bold", + "schema.token.italic", + "schema.token.underline", + "schema.token.strikethrough", + "comment", + "string", + "keyword", + "number", + "regexp", + "operator", + "namespace", + "type", + "struct", + "class", + "interface", + "enum", + "typeParameter", + "function", + "member", + "method", + "macro", + "variable", + "parameter", + "property", + "enumMember", + "event", + "decorator", + "labels", + "declaration", + "documentation", + "static", + "abstract", + "deprecated", + "modification", + "async", + "readonly" + ], + "vs/platform/undoRedo/common/undoRedoService": [ + { + "key": "externalRemoval", + "comment": [ + "{0} is a list of filenames" + ] + }, + { + "key": "noParallelUniverses", + "comment": [ + "{0} is a list of filenames" + ] + }, + { + "key": "cannotWorkspaceUndo", + "comment": [ + "{0} is a label for an operation. {1} is another message." + ] + }, + { + "key": "cannotWorkspaceUndo", + "comment": [ + "{0} is a label for an operation. {1} is another message." + ] + }, + { + "key": "cannotWorkspaceUndoDueToChanges", + "comment": [ + "{0} is a label for an operation. {1} is a list of filenames." + ] + }, + { + "key": "cannotWorkspaceUndoDueToInProgressUndoRedo", + "comment": [ + "{0} is a label for an operation. {1} is a list of filenames." + ] + }, + { + "key": "cannotWorkspaceUndoDueToInMeantimeUndoRedo", + "comment": [ + "{0} is a label for an operation. {1} is a list of filenames." + ] + }, + "confirmWorkspace", + { + "key": "ok", + "comment": [ + "{0} denotes a number that is > 1, && denotes a mnemonic" + ] + }, + { + "key": "nok", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "cannotResourceUndoDueToInProgressUndoRedo", + "comment": [ + "{0} is a label for an operation." + ] + }, + "confirmDifferentSource", + { + "key": "confirmDifferentSource.yes", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "confirmDifferentSource.no", + { + "key": "cannotWorkspaceRedo", + "comment": [ + "{0} is a label for an operation. {1} is another message." + ] + }, + { + "key": "cannotWorkspaceRedo", + "comment": [ + "{0} is a label for an operation. {1} is another message." + ] + }, + { + "key": "cannotWorkspaceRedoDueToChanges", + "comment": [ + "{0} is a label for an operation. {1} is a list of filenames." + ] + }, + { + "key": "cannotWorkspaceRedoDueToInProgressUndoRedo", + "comment": [ + "{0} is a label for an operation. {1} is a list of filenames." + ] + }, + { + "key": "cannotWorkspaceRedoDueToInMeantimeUndoRedo", + "comment": [ + "{0} is a label for an operation. {1} is a list of filenames." + ] + }, + { + "key": "cannotResourceRedoDueToInProgressUndoRedo", + "comment": [ + "{0} is a label for an operation." + ] + } + ], + "vs/platform/update/common/update.config.contribution": [ + "updateConfigurationTitle", + "updateMode", + "none", + "manual", + "start", + "default", + "updateMode", + "none", + "manual", + "start", + "default", + "updateMode", + "deprecated", + "enableWindowsBackgroundUpdatesTitle", + "enableWindowsBackgroundUpdates", + "showReleaseNotes" + ], + "vs/platform/userDataProfile/common/userDataProfile": [ + "defaultProfile" + ], + "vs/platform/userDataSync/common/abstractSynchronizer": [ + { + "key": "incompatible", + "comment": [ + "This is an error while syncing a resource that its local version is not compatible with its remote version." + ] + }, + "incompatible sync data" + ], + "vs/platform/userDataSync/common/keybindingsSync": [ + "errorInvalidSettings", + "errorInvalidSettings" + ], + "vs/platform/userDataSync/common/settingsSync": [ + "errorInvalidSettings" + ], + "vs/platform/userDataSync/common/userDataAutoSyncService": [ + "default service changed", + "service changed", + "turned off", + "default service changed", + "service changed", + "session expired", + "turned off machine" + ], + "vs/platform/userDataSync/common/userDataSync": [ + "settings sync", + "settingsSync.keybindingsPerPlatform", + "settingsSync.ignoredExtensions", + "app.extension.identifier.errorMessage", + "settingsSync.ignoredSettings" + ], + "vs/platform/userDataSync/common/userDataSyncLog": [ + "userDataSyncLog" + ], + "vs/platform/userDataSync/common/userDataSyncMachines": [ + "error incompatible" + ], + "vs/platform/userDataSync/common/userDataSyncResourceProvider": [ + "incompatible sync data" + ], + "vs/platform/windows/electron-main/windowImpl": [ + { + "key": "reopen", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "close", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "wait", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "appStalled", + "appStalledDetail", + "doNotRestoreEditors", + "appGone", + "appGoneDetails", + { + "key": "reopen", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "newWindow", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "close", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "appGoneDetailWorkspace", + "appGoneDetailEmptyWindow", + "doNotRestoreEditors", + "hiddenMenuBar" + ], + "vs/platform/windows/electron-main/windowsMainService": [ + { + "key": "ok", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "pathNotExistTitle", + "uriInvalidTitle", + "pathNotExistDetail", + "uriInvalidDetail", + { + "key": "allow", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "cancel", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "learnMore", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "confirmOpenMessage", + "confirmOpenDetail", + "doNotAskAgain" + ], + "vs/platform/workspace/common/workspace": [ + "codeWorkspace" + ], + "vs/platform/workspaces/electron-main/workspacesHistoryMainService": [ + { + "key": "clearButtonLabel", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "cancel", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "confirmClearRecentsMessage", + "confirmClearDetail", + "newWindow", + "newWindowDesc", + "recentFoldersAndWorkspaces", + "recentFolders", + "untitledWorkspace", + "workspaceName" + ], + "vs/platform/workspaces/electron-main/workspacesManagementMainService": [ + { + "key": "ok", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "workspaceOpenedMessage", + "workspaceOpenedDetail" + ], + "vs/server/node/remoteExtensionHostAgentCli": [ + "remotecli" + ], + "vs/server/node/serverEnvironmentService": [ + "host", + "port", + "socket-path", + "server-base-path", + "connection-token", + "connection-token-file", + "without-connection-token", + "acceptLicenseTerms", + "serverDataDir", + "telemetry-level", + "default-folder", + "default-workspace", + "start-server", + "reconnection-grace-time" + ], + "vs/server/node/serverServices": [ + "remoteExtensionLog" + ], + "vs/workbench/api/browser/mainThreadAuthentication": [ + "yes", + "no", + "confirmRelogin", + "confirmLogin", + { + "key": "allow", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "learnMore", + "incorrectAccount", + "incorrectAccountDetail", + "keep", + "loginWith", + "deviceCodeTitle", + "deviceCodeDetail", + "copyAndContinue", + "failedToOpenUri", + "dcrNotSupported", + "dcrNotSupportedDetail", + "dcrCopyUrlsAndProceed", + "dcrFailedToCopy", + "cancel", + "addClientRegistrationDetails", + "clientIdPrompt", + "clientIdPlaceholder", + "clientIdRequired", + "clientSecretPrompt", + "clientSecretPlaceholder" + ], + "vs/workbench/api/browser/mainThreadChatSessions": [ + "interruptActiveResponse", + "chatEditorContributionName" + ], + "vs/workbench/api/browser/mainThreadCLICommands": [ + "cannot be installed" + ], + "vs/workbench/api/browser/mainThreadComments": [ + "commentsViewIcon" + ], + "vs/workbench/api/browser/mainThreadCustomEditors": [ + "vetoExtHostRestart", + "defaultEditLabel" + ], + "vs/workbench/api/browser/mainThreadEditSessionIdentityParticipant": [ + "timeout.onWillCreateEditSessionIdentity" + ], + "vs/workbench/api/browser/mainThreadExtensionService": [ + "reload window", + "reload", + "notSupportedInWorkspace", + "restrictedMode", + "manageWorkspaceTrust", + "disabledDep", + "enable dep", + "disabledDepNoAction", + "uninstalledDep", + "install missing dep", + "unknownDep" + ], + "vs/workbench/api/browser/mainThreadFileSystemEventService": [ + "ask.1.create", + "ask.1.copy", + "ask.1.move", + "ask.1.delete", + { + "key": "ask.N.create", + "comment": [ + "{0} is a number, e.g \"3 extensions want...\"" + ] + }, + { + "key": "ask.N.copy", + "comment": [ + "{0} is a number, e.g \"3 extensions want...\"" + ] + }, + { + "key": "ask.N.move", + "comment": [ + "{0} is a number, e.g \"3 extensions want...\"" + ] + }, + { + "key": "ask.N.delete", + "comment": [ + "{0} is a number, e.g \"3 extensions want...\"" + ] + }, + "preview", + "cancel", + { + "key": "ok", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "preview", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "cancel", + "again", + "msg-create", + "msg-rename", + "msg-copy", + "msg-delete", + "msg-write", + "label" + ], + "vs/workbench/api/browser/mainThreadLanguageModels": [ + "languageModelsAccountId", + "confirmLanguageModelAccess" + ], + "vs/workbench/api/browser/mainThreadMcp": [ + "incorrectAccount", + "incorrectAccountDetail", + "keep", + "loginWith", + "mcpAuthSessionRemoved", + "confirmRelogin", + "confirmLogin", + { + "key": "allow", + "comment": [ + "&& denotes a mnemonic" + ] + } + ], + "vs/workbench/api/browser/mainThreadMessageService": [ + "defaultSource", + "manageExtension", + "cancel", + { + "key": "ok", + "comment": [ + "&& denotes a mnemonic" + ] + } + ], + "vs/workbench/api/browser/mainThreadNotebookSaveParticipant": [ + "timeout.onWillSave" + ], + "vs/workbench/api/browser/mainThreadOutputService": [ + "status.showOutput", + "status.showOutputAria", + "status.showOutputTooltip" + ], + "vs/workbench/api/browser/mainThreadProgress": [ + "manageExtension" + ], + "vs/workbench/api/browser/mainThreadSaveParticipant": [ + "timeout.onWillSave" + ], + "vs/workbench/api/browser/mainThreadTask": [ + "task.label" + ], + "vs/workbench/api/browser/mainThreadTunnelService": [ + "remote.tunnel.openTunnel", + "remote.tunnelsView.elevationButton" + ], + "vs/workbench/api/browser/mainThreadUriOpeners": [ + "openerFailedUseDefault", + { + "key": "openerFailedMessage", + "comment": [ + "{0} is the id of the opener. {1} is the url being opened." + ] + } + ], + "vs/workbench/api/browser/mainThreadWebviews": [ + "errorMessage" + ], + "vs/workbench/api/browser/mainThreadWorkspace": [ + "folderStatusMessageAddSingleFolder", + "folderStatusMessageAddMultipleFolders", + "folderStatusMessageRemoveSingleFolder", + "folderStatusMessageRemoveMultipleFolders", + "folderStatusChangeFolder" + ], + "vs/workbench/api/browser/statusBarExtensionPoint": [ + "id", + "name", + "text", + "tooltip", + "command", + "alignment", + "priority", + "accessibilityInformation", + "accessibilityInformation.role", + "accessibilityInformation.label", + "vscode.extension.contributes.statusBarItems", + "invalid" + ], + "vs/workbench/api/browser/viewsExtensionPoint": [ + { + "key": "vscode.extension.contributes.views.containers.id", + "comment": [ + "Contribution refers to those that an extension contributes to VS Code through an extension/contribution point. " + ] + }, + "vscode.extension.contributes.views.containers.title", + "vscode.extension.contributes.views.containers.icon", + "vscode.extension.contributes.viewsContainers", + "views.container.activitybar", + "views.container.panel", + "views.container.secondarySidebar", + "vscode.extension.contributes.view.type", + "vscode.extension.contributes.view.tree", + "vscode.extension.contributes.view.webview", + "vscode.extension.contributes.view.id", + "vscode.extension.contributes.view.name", + "vscode.extension.contributes.view.when", + "vscode.extension.contributes.view.icon", + "vscode.extension.contributes.view.contextualTitle", + "vscode.extension.contributes.view.initialState", + "vscode.extension.contributes.view.initialState.visible", + "vscode.extension.contributes.view.initialState.hidden", + "vscode.extension.contributes.view.initialState.collapsed", + "vscode.extension.contributs.view.size", + "vscode.extension.contributes.view.accessibilityHelpContent", + "vscode.extension.contributes.view.id", + "vscode.extension.contributes.view.name", + "vscode.extension.contributes.view.when", + "vscode.extension.contributes.view.group", + "vscode.extension.contributes.view.remoteName", + "vscode.extension.contributes.views", + "views.explorer", + "views.debug", + "views.scm", + "views.test", + "views.remote", + "views.contributed", + "viewcontainer requirearray", + "requireidstring", + "requireidstring", + "requirestring", + "requirestring", + "requirenonemptystring", + "ViewContainerRequiresProposedAPI", + "RequiresChatSessionsProposedAPI", + "ViewContainerDoesnotExist", + "duplicateView1", + "duplicateView2", + "unknownViewType", + "requirearray", + "requirestring", + "requirestring", + "optstring", + "optstring", + "optstring", + "optenum", + "view container id", + "view container title", + "view container location", + "view id", + "view name title", + "view container location", + "viewsContainers", + "views" + ], + "vs/workbench/api/common/configurationExtensionPoint": [ + "vscode.extension.contributes.configuration.title", + "vscode.extension.contributes.configuration.order", + "vscode.extension.contributes.configuration.properties", + "vscode.extension.contributes.configuration.property.empty", + "vscode.extension.contributes.configuration.properties.schema", + "scope.application.description", + "scope.machine.description", + "scope.window.description", + "scope.resource.description", + "scope.language-overridable.description", + "scope.machine-overridable.description", + "scope.description", + "scope.enumDescriptions", + "scope.markdownEnumDescriptions", + "scope.enumItemLabels", + "scope.markdownDescription", + "scope.deprecationMessage", + "scope.markdownDeprecationMessage", + "scope.singlelineText.description", + "scope.multilineText.description", + "scope.editPresentation", + "scope.order", + "scope.ignoreSync", + "accessibility", + "advanced", + "experimental", + "preview", + "telemetry", + "usesOnlineServices", + "scope.tags", + "config.property.preventDefaultConfiguration.warning", + "config.property.defaultConfiguration.warning", + "vscode.extension.contributes.configuration", + "invalid.title", + "invalid.properties", + "config.property.duplicate", + "invalid.property", + "invalid.allOf", + "workspaceConfig.folders.description", + "workspaceConfig.path.description", + "workspaceConfig.name.description", + "workspaceConfig.uri.description", + "workspaceConfig.name.description", + "workspaceConfig.settings.description", + "workspaceConfig.launch.description", + "workspaceConfig.tasks.description", + "workspaceConfig.mcp.description", + "workspaceConfig.extensions.description", + "workspaceConfig.remoteAuthority", + "workspaceConfig.transient", + "unknownWorkspaceProperty", + "setting name", + "description", + "default", + "settings", + "language", + "setting", + "default override value", + "settings default overrides" + ], + "vs/workbench/api/common/extHostAuthentication": [ + "url handler", + "authenticatingTo", + "userCanceledContinue", + "continueWith", + "completeAuth" + ], + "vs/workbench/api/common/extHostDiagnostics": [ + { + "key": "limitHit", + "comment": [ + "amount of errors/warning skipped due to limits" + ] + } + ], + "vs/workbench/api/common/extHostExtensionService": [ + "extensionTestError1", + "extensionTestError" + ], + "vs/workbench/api/common/extHostLanguageFeatures": [ + "defaultPasteLabel", + "defaultDropLabel" + ], + "vs/workbench/api/common/extHostLanguageModels": [ + "chatAccessWithJustification" + ], + "vs/workbench/api/common/extHostLogService": [ + "remote", + "worker", + "local" + ], + "vs/workbench/api/common/extHostNotebook": [ + "err.readonly", + "fileModifiedError" + ], + "vs/workbench/api/common/extHostStatusBar": [ + "extensionLabel", + "status.extensionMessage" + ], + "vs/workbench/api/common/extHostTelemetry": [ + "extensionTelemetryLog" + ], + "vs/workbench/api/common/extHostTerminalService": [ + "launchFail.idMissingOnExtHost" + ], + "vs/workbench/api/common/extHostTreeViews": [ + "treeView.duplicateElement" + ], + "vs/workbench/api/common/extHostTunnelService": [ + "tunnelPrivacy.private", + "tunnelPrivacy.public" + ], + "vs/workbench/api/common/extHostWorkspace": [ + "updateerror" + ], + "vs/workbench/api/common/jsonValidationExtensionPoint": [ + "contributes.jsonValidation", + "contributes.jsonValidation.fileMatch", + "contributes.jsonValidation.url", + "invalid.jsonValidation", + "invalid.fileMatch", + "invalid.url", + "invalid.path.1", + "invalid.url.fileschema", + "invalid.url.schema", + "fileMatch", + "schema", + "jsonValidation" + ], + "vs/workbench/api/node/extHostAuthentication": [ + "loopback", + "device code", + "completeAuth", + "waitingForAuth" + ], + "vs/workbench/api/node/extHostDebugService": [ + "debug.terminal.title" + ], + "vs/workbench/api/test/browser/mainThreadTreeViews.test": [ + "test", + "Test View 1" + ], + "vs/workbench/browser/actions/developerActions": [ + "storageLogDialogMessage", + "storageLogDialogDetails", + "largeStorageItemDetail", + "global", + "profile", + "workspace", + "machine", + "user", + "removeLargeStorageEntriesPickerButton", + "removeLargeStorageEntriesPickerPlaceholder", + "removeLargeStorageEntriesPickerDescriptionNoEntries", + "removeLargeStorageEntriesConfirmRemove", + "removeLargeStorageEntriesConfirmRemoveDetail", + { + "key": "removeLargeStorageEntriesButtonLabel", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "screencastModeConfigurationTitle", + "screencastMode.location.verticalPosition", + "screencastMode.fontSize", + "screencastMode.keyboardOptions.description", + "screencastMode.keyboardOptions.showKeys", + "screencastMode.keyboardOptions.showKeybindings", + "screencastMode.keyboardOptions.showCommands", + "screencastMode.keyboardOptions.showCommandGroups", + "screencastMode.keyboardOptions.showSingleEditorCursorMoves", + "screencastMode.keyboardOverlayTimeout", + "screencastMode.mouseIndicatorColor", + "screencastMode.mouseIndicatorSize", + "inspect context keys", + "toggle screencast mode", + { + "key": "logStorage", + "comment": [ + "A developer only action to log the contents of the storage for the current window." + ] + }, + { + "key": "logWorkingCopies", + "comment": [ + "A developer only action to log the working copies that exist." + ] + }, + "removeLargeStorageDatabaseEntries", + "startTrackDisposables", + "snapshotTrackedDisposables", + "stopTrackDisposables", + "policyDiagnostics" + ], + "vs/workbench/browser/actions/helpActions": [ + { + "key": "miKeyboardShortcuts", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miVideoTutorials", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miTipsAndTricks", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miDocumentation", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miYouTube", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miUserVoice", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miLicense", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miPrivacyStatement", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "keybindingsReference", + "openVideoTutorialsUrl", + "openTipsAndTricksUrl", + "openDocumentationUrl", + "newsletterSignup", + "openYouTubeUrl", + "openUserVoiceUrl", + "openLicenseUrl", + "openPrivacyStatement", + "getStartedWithAccessibilityFeatures", + "askVScode", + "askVScode" + ], + "vs/workbench/browser/actions/layoutActions": [ + "menuBarIcon", + "activityBarLeft", + "activityBarRight", + "panelLeft", + "panelLeftOff", + "panelRight", + "panelRightOff", + "panelBottom", + "statusBarIcon", + "panelBottomLeft", + "panelBottomRight", + "panelBottomCenter", + "panelBottomJustify", + "quickInputAlignmentTop", + "quickInputAlignmentCenter", + "fullScreenIcon", + "centerLayoutIcon", + "zenModeIcon", + { + "key": "miToggleCenteredLayout", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "toggleSidebarPosition", + "moveSidebarRight", + "moveSidebarLeft", + "cofigureLayoutIcon", + "configureLayout", + "move side bar right", + "move sidebar left", + "move second sidebar left", + "move second sidebar right", + { + "key": "miMoveSidebarRight", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miMoveSidebarLeft", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miShowEditorArea", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miAppearance", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "compositePart.hideSideBarLabel", + "primary sidebar", + { + "key": "primary sidebar mnemonic", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "openAndCloseSidebar", + "sidebarHidden", + "sidebarVisible", + "compositePart.hideSideBarLabel", + "toggleSideBar", + "toggleSideBar", + { + "key": "miStatusbar", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "tabBar", + "tabBar", + "editorActionsPosition", + { + "key": "miToggleZenMode", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miMenuBar", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "miMenuBarNoMnemonic", + "sidebarContainer", + "panelContainer", + "secondarySideBarContainer", + "moveFocusedView.selectView", + "moveFocusedView.error.noFocusedView", + "moveFocusedView.error.nonMovableView", + "moveFocusedView.selectDestination", + { + "key": "moveFocusedView.title", + "comment": [ + "{0} indicates the title of the view the user has selected to move." + ] + }, + { + "key": "moveFocusedView.newContainerInPanel", + "comment": [ + "Creates a new top-level tab in the panel." + ] + }, + "moveFocusedView.newContainerInSidebar", + "moveFocusedView.newContainerInSidePanel", + "sidebar", + "panel", + "secondarySideBar", + "resetFocusedView.error.noFocusedView", + "selectToHide", + "selectToShow", + "active", + "menuBar", + "activityBar", + "sideBar", + "secondarySideBar", + "panel", + "statusBar", + "leftSideBar", + "rightSideBar", + "leftPanel", + "rightPanel", + "centerPanel", + "justifyPanel", + "top", + "center", + "fullscreen", + "zenMode", + "centeredLayout", + "toggleVisibility", + "sideBarPosition", + "panelAlignment", + "quickOpen", + "layoutModes", + "customizeLayoutQuickPickTitle", + "close", + "restore defaults", + "toggleCenteredLayout", + "moveSidebarRight", + "moveSidebarLeft", + "toggleSidebarPosition", + "toggleEditor", + "toggleSidebar", + "toggleStatusbar", + "hideEditorTabs", + "hideEditorTabsDescription", + "hideEditorTabsZenMode", + "hideEditorTabsZenModeDescription", + "showMultipleEditorTabs", + "showMultipleEditorTabsDescription", + "showMultipleEditorTabsZenMode", + "showMultipleEditorTabsZenModeDescription", + "showSingleEditorTab", + "showSingleEditorTabDescription", + "showSingleEditorTabZenMode", + "showSingleEditorTabZenModeDescription", + "moveEditorActionsToTitleBar", + "moveEditorActionsToTitleBarDescription", + "moveEditorActionsToTabBar", + "moveEditorActionsToTabBarDescription", + "hideEditorActons", + "hideEditorActonsDescription", + "showEditorActons", + "showEditorActonsDescription", + "configureTabs", + "configureEditors", + "toggleSeparatePinnedEditorTabs", + "toggleSeparatePinnedEditorTabsDescription", + "toggleZenMode", + "toggleMenuBar", + "resetViewLocations", + "moveView", + "moveFocusedView", + "resetFocusedViewLocation", + "increaseViewSize", + "increaseEditorWidth", + "increaseEditorHeight", + "decreaseViewSize", + "decreaseEditorWidth", + "decreaseEditorHeight", + "alignQuickInputTop", + "alignQuickInputCenter", + "customizeLayout" + ], + "vs/workbench/browser/actions/listCommands": [ + { + "key": "mitoggleTreeStickyScroll", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "toggleTreeStickyScrollDescription", + "toggleTreeStickyScroll" + ], + "vs/workbench/browser/actions/navigationActions": [ + "navigateLeft", + "navigateRight", + "navigateUp", + "navigateDown", + "focusNextPart", + "focusPreviousPart" + ], + "vs/workbench/browser/actions/quickAccessActions": [ + "quickOpenWithModes", + "quickOpen", + "quickNavigateNext", + "quickNavigatePrevious", + "quickSelectNext", + "quickSelectPrevious" + ], + "vs/workbench/browser/actions/textInputActions": [ + "undo", + "redo", + "cut", + "copy", + "paste", + "selectAll" + ], + "vs/workbench/browser/actions/windowActions": [ + "remove", + "dirtyRecentlyOpenedFolder", + "dirtyRecentlyOpenedWorkspace", + "openedRecentlyOpenedFolder", + "openedRecentlyOpenedWorkspace", + "activeOpenedRecentlyOpenedFolder", + "activeOpenedRecentlyOpenedWorkspace", + "workspacesAndFolders", + "folders", + "files", + "openRecentPlaceholderMac", + "openRecentPlaceholder", + "dirtyWorkspace", + "dirtyFolder", + "dirtyWorkspaceConfirm", + "dirtyFolderConfirm", + "dirtyWorkspaceConfirmDetail", + "dirtyFolderConfirmDetail", + "recentDirtyWorkspaceAriaLabel", + "recentDirtyFolderAriaLabel", + { + "key": "miMore", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miToggleFullScreen", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miAbout", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miNewWindow", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "miConfirmClose", + { + "key": "miOpenRecent", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "openRecent", + "quickOpenRecent", + "toggleFullScreen", + "reloadWindow", + "about", + "newWindow", + "blur" + ], + "vs/workbench/browser/actions/workspaceActions": [ + { + "key": "miOpenFile", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miOpenFolder", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miOpenFolder", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miOpen", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miOpenWorkspace", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miAddFolderToWorkspace", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "miSaveWorkspaceAs", + "duplicateWorkspace", + { + "key": "miCloseFolder", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miCloseWorkspace", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "workspaces", + "openFile", + "openFolder", + "openFolder", + "openFileFolder", + "openWorkspaceAction", + "closeWorkspace", + "openWorkspaceConfigFile", + "globalRemoveFolderFromWorkspace", + "saveWorkspaceAsAction", + "duplicateWorkspaceInNewWindow" + ], + "vs/workbench/browser/actions/workspaceCommands": [ + { + "key": "add", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "addFolderToWorkspaceTitle", + "workspaceFolderPickerPlaceholder", + "addFolderToWorkspace" + ], + "vs/workbench/browser/editor": [ + "preview", + "pinned" + ], + "vs/workbench/browser/labels": [ + "notebookCellLabel", + "notebookCellLabel", + "notebookCellOutputLabel", + "notebookCellOutputLabelSimple" + ], + "vs/workbench/browser/parts/activitybar/activitybarPart": [ + "menu", + "hideMenu", + "activity bar position", + { + "key": "miDefaultActivityBar", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "default", + { + "key": "miTopActivityBar", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "top", + { + "key": "miBottomActivityBar", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "bottom", + { + "key": "miHideActivityBar", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "hide", + "positionActivituBar", + "positionActivituBar", + "positionActivityBarDefault", + "positionActivityBarTop", + "positionActivityBarBottom", + "hideActivityBar", + "previousSideBarView", + "nextSideBarView", + "focusActivityBar" + ], + "vs/workbench/browser/parts/auxiliarybar/auxiliaryBarActions": [ + "maximizeIcon", + "closeIcon", + "toggleAuxiliaryIconRight", + "toggleAuxiliaryIconRightOn", + "toggleAuxiliaryIconLeft", + "toggleAuxiliaryIconLeftOn", + "closeSecondarySideBar", + { + "key": "miCloseSecondarySideBar", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "openAndCloseAuxiliaryBar", + "auxiliaryBarHidden", + "auxiliaryBarVisible", + "closeSecondarySideBar", + "toggleSecondarySideBar", + "toggleSecondarySideBar", + "maximizeAuxiliaryBarTooltip", + "restoreAuxiliaryBarTooltip", + "toggleAuxiliaryBar", + "closeSecondarySideBar", + "focusAuxiliaryBar", + "hideAuxiliaryBar", + "previousAuxiliaryBarView", + "nextAuxiliaryBarView", + "maximizeAuxiliaryBar", + "restoreAuxiliaryBar", + "toggleMaximizedAuxiliaryBar" + ], + "vs/workbench/browser/parts/auxiliarybar/auxiliaryBarPart": [ + "showIcons", + "showLabels", + "activity bar position", + "move second side bar left", + "move second side bar right", + "hide second side bar" + ], + "vs/workbench/browser/parts/banner/bannerPart": [ + "closeBanner", + "focusBanner" + ], + "vs/workbench/browser/parts/compositeBar": [ + "activityBarAriaLabel" + ], + "vs/workbench/browser/parts/compositeBarActions": [ + "titleKeybinding", + "additionalViews", + "numberBadge", + "hide", + "keep", + "hideBadge", + "showBadge", + "toggle", + "toggleBadge" + ], + "vs/workbench/browser/parts/compositePart": [ + "ariaCompositeToolbarLabel", + "viewsAndMoreActions", + "titleTooltip" + ], + "vs/workbench/browser/parts/dialogs/dialogHandler": [ + { + "key": "copy", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "ok" + ], + "vs/workbench/browser/parts/editor/auxiliaryEditorPart": [ + "enableCompactAuxiliaryWindow", + "disableCompactAuxiliaryWindow", + "toggleCompactAuxiliaryWindow" + ], + "vs/workbench/browser/parts/editor/binaryDiffEditor": [ + "metadataDiff" + ], + "vs/workbench/browser/parts/editor/binaryEditor": [ + "binaryEditor", + "binaryError", + "openAnyway" + ], + "vs/workbench/browser/parts/editor/breadcrumbs": [ + "title", + "enabled", + "filepath", + "filepath.on", + "filepath.off", + "filepath.last", + "symbolpath", + "symbolpath.on", + "symbolpath.off", + "symbolpath.last", + "symbolSortOrder", + "symbolSortOrder.position", + "symbolSortOrder.name", + "symbolSortOrder.type", + "icons", + "symbolPathSeparator", + "filteredTypes.file", + "filteredTypes.module", + "filteredTypes.namespace", + "filteredTypes.package", + "filteredTypes.class", + "filteredTypes.method", + "filteredTypes.property", + "filteredTypes.field", + "filteredTypes.constructor", + "filteredTypes.enum", + "filteredTypes.interface", + "filteredTypes.function", + "filteredTypes.variable", + "filteredTypes.constant", + "filteredTypes.string", + "filteredTypes.number", + "filteredTypes.boolean", + "filteredTypes.array", + "filteredTypes.object", + "filteredTypes.key", + "filteredTypes.null", + "filteredTypes.enumMember", + "filteredTypes.struct", + "filteredTypes.event", + "filteredTypes.operator", + "filteredTypes.typeParameter" + ], + "vs/workbench/browser/parts/editor/breadcrumbsControl": [ + "separatorIcon", + "breadcrumbsPossible", + "breadcrumbsVisible", + "breadcrumbsActive", + "empty", + "cmd.toggle2", + { + "key": "miBreadcrumbs2", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "cmd.toggle", + "cmd.toggle.short", + "cmd.focusAndSelect", + "cmd.focus", + "cmd.copyPath" + ], + "vs/workbench/browser/parts/editor/breadcrumbsPicker": [ + "breadcrumbs" + ], + "vs/workbench/browser/parts/editor/diffEditorCommands": [ + "compare", + "compare", + "compare.openSide", + "compare.nextChange", + "compare.previousChange", + "toggleInlineView", + "swapDiffSides" + ], + "vs/workbench/browser/parts/editor/editor.contribution": [ + "textEditor", + "textDiffEditor", + "binaryDiffEditor", + "sideBySideEditor", + "editorQuickAccessPlaceholder", + "activeGroupEditorsByMostRecentlyUsedQuickAccess", + "editorQuickAccessPlaceholder", + "allEditorsByAppearanceQuickAccess", + "editorQuickAccessPlaceholder", + "allEditorsByMostRecentlyUsedQuickAccess", + "lockGroupAction", + "unlockGroupAction", + "closeGroupAction", + "splitUp", + "splitDown", + "splitLeft", + "splitRight", + "newWindow", + "toggleLockGroup", + "close", + "splitUp", + "splitDown", + "splitLeft", + "splitRight", + "moveEditorGroupToNewWindow", + "copyEditorGroupToNewWindow", + "tabBar", + "multipleTabs", + "singleTab", + "hideTabs", + "tabBar", + "multipleTabs", + "singleTab", + "hideTabs", + "editorActionsPosition", + "tabBar", + "titleBar", + "hidden", + "configureTabs", + "close", + "closeOthers", + "closeRight", + "closeAllSaved", + "closeAll", + "reopenWith", + "keepOpen", + "pin", + "unpin", + "splitRight", + "splitDown", + "splitAndMoveEditor", + "moveToNewWindow", + "copyToNewWindow", + "share", + "splitUp", + "splitDown", + "splitLeft", + "splitRight", + "moveAbove", + "moveBelow", + "moveLeft", + "moveRight", + "splitInGroup", + "joinInGroup", + "inlineView", + "showOpenedEditors", + "closeAll", + "closeAllSaved", + "togglePreviewMode", + "maximizeGroup", + "unmaximizeGroup", + "lockGroup", + "configureEditors", + "splitEditorRight", + "splitEditorDown", + "splitEditorDown", + "splitEditorRight", + "toggleSplitEditorInGroupLayout", + "close", + "closeAll", + "close", + "closeAll", + "unpin", + "close", + "unpin", + "close", + "lockEditorGroup", + "unlockEditorGroup", + "previousChangeIcon", + "navigate.prev.label", + "nextChangeIcon", + "navigate.next.label", + "swapDiffSides", + "toggleWhitespace", + "ignoreTrimWhitespace.label", + { + "key": "miReopenClosedEditor", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miClearRecentOpen", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "miShare", + { + "key": "miEditorLayout", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miSplitEditorUp", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miSplitEditorDown", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miSplitEditorLeft", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miSplitEditorRight", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miSplitEditorInGroup", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miJoinEditorInGroup", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miMoveEditorToNewWindow", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miCopyEditorToNewWindow", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miSingleColumnEditorLayout", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miTwoColumnsEditorLayout", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miThreeColumnsEditorLayout", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miTwoRowsEditorLayout", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miThreeRowsEditorLayout", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miTwoByTwoGridEditorLayout", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miTwoRowsRightEditorLayout", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miTwoColumnsBottomEditorLayout", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miLastEditLocation", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miFirstSideEditor", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miSecondSideEditor", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miNextEditor", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miPreviousEditor", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miNextRecentlyUsedEditor", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miPreviousRecentlyUsedEditor", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miNextEditorInGroup", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miPreviousEditorInGroup", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miNextUsedEditorInGroup", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miPreviousUsedEditorInGroup", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miSwitchEditor", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miFocusFirstGroup", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miFocusSecondGroup", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miFocusThirdGroup", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miFocusFourthGroup", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miFocusFifthGroup", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miNextGroup", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miPreviousGroup", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miFocusLeftGroup", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miFocusRightGroup", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miFocusAboveGroup", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miFocusBelowGroup", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miSwitchGroup", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "keepEditor", + "pinEditor", + "unpinEditor", + "closeEditor", + "closePinnedEditor", + "closeEditorsInGroup", + "closeSavedEditors", + "closeOtherEditors", + "closeRightEditors", + "closeEditorGroup", + "reopenWith", + "miSplitEditorUpWithoutMnemonic", + "miSplitEditorDownWithoutMnemonic", + "miSplitEditorLeftWithoutMnemonic", + "miSplitEditorRightWithoutMnemonic", + "miSplitEditorInGroupWithoutMnemonic", + "miJoinEditorInGroupWithoutMnemonic", + "moveEditorToNewWindow", + "copyEditorToNewWindow", + "miSingleColumnEditorLayoutWithoutMnemonic", + "miTwoColumnsEditorLayoutWithoutMnemonic", + "miThreeColumnsEditorLayoutWithoutMnemonic", + "miTwoRowsEditorLayoutWithoutMnemonic", + "miThreeRowsEditorLayoutWithoutMnemonic", + "miTwoByTwoGridEditorLayoutWithoutMnemonic", + "miTwoRowsRightEditorLayoutWithoutMnemonic", + "miTwoColumnsBottomEditorLayoutWithoutMnemonic" + ], + "vs/workbench/browser/parts/editor/editorActions": [ + "splitEditorGroupUp", + "splitEditorGroupDown", + "closeEditor", + "unpinEditor", + "closeOneEditor", + "reverting", + "unmaximizeGroup", + "navigateForward", + { + "key": "miForward", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "navigateBack", + { + "key": "miBack", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "confirmClearRecentsMessage", + "confirmClearDetail", + { + "key": "clearButtonLabel", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "confirmClearEditorHistoryMessage", + "confirmClearDetail", + { + "key": "clearButtonLabel", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "splitEditorToLeftGroup", + { + "key": "miMoveEditorToNewWindow", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miCopyEditorToNewWindow", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miMoveEditorGroupToNewWindow", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miCopyEditorGroupToNewWindow", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miRestoreEditorsToMainWindow", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miNewEmptyEditorWindow", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "splitEditor", + "splitEditorOrthogonal", + "splitEditorGroupLeft", + "splitEditorGroupRight", + "splitEditorGroupUp", + "splitEditorGroupDown", + "joinTwoGroups", + "joinAllGroups", + "navigateEditorGroups", + "focusActiveEditorGroup", + "focusFirstEditorGroup", + "focusLastEditorGroup", + "focusNextGroup", + "focusPreviousGroup", + "focusLeftGroup", + "focusRightGroup", + "focusAboveGroup", + "focusBelowGroup", + "revertAndCloseActiveEditor", + "closeEditorsToTheLeft", + "closeAllEditors", + "closeAllGroups", + "closeEditorsInOtherGroups", + "closeEditorInAllGroups", + "moveActiveGroupLeft", + "moveActiveGroupRight", + "moveActiveGroupUp", + "moveActiveGroupDown", + "duplicateActiveGroupLeft", + "duplicateActiveGroupRight", + "duplicateActiveGroupUp", + "duplicateActiveGroupDown", + "minimizeOtherEditorGroups", + "minimizeOtherEditorGroupsHideSidebar", + "evenEditorGroups", + "toggleEditorWidths", + "maximizeEditorHideSidebar", + "toggleMaximizeEditorGroup", + "openNextEditor", + "openPreviousEditor", + "nextEditorInGroup", + "openPreviousEditorInGroup", + "firstEditorInGroup", + "lastEditorInGroup", + "navigateForward", + "navigateBack", + "navigatePrevious", + "navigateForwardInEdits", + "navigateBackInEdits", + "navigatePreviousInEdits", + "navigateToLastEditLocation", + "navigateForwardInNavigations", + "navigateBackInNavigations", + "navigatePreviousInNavigationLocations", + "navigateToLastNavigationLocation", + "reopenClosedEditor", + "clearRecentFiles", + "showEditorsInActiveGroup", + "showAllEditors", + "showAllEditorsByMostRecentlyUsed", + "quickOpenPreviousRecentlyUsedEditor", + "quickOpenLeastRecentlyUsedEditor", + "quickOpenPreviousRecentlyUsedEditorInGroup", + "quickOpenLeastRecentlyUsedEditorInGroup", + "navigateEditorHistoryByInput", + "openNextRecentlyUsedEditor", + "openPreviousRecentlyUsedEditor", + "openNextRecentlyUsedEditorInGroup", + "openPreviousRecentlyUsedEditorInGroup", + "clearEditorHistoryWithoutConfirm", + "clearEditorHistory", + "moveEditorLeft", + "moveEditorRight", + "moveEditorToStart", + "moveEditorToEnd", + "moveEditorToPreviousGroup", + "moveEditorToNextGroup", + "moveEditorToAboveGroup", + "moveEditorToBelowGroup", + "moveEditorToLeftGroup", + "moveEditorToRightGroup", + "moveEditorToFirstGroup", + "moveEditorToLastGroup", + "splitEditorToPreviousGroup", + "splitEditorToNextGroup", + "splitEditorToAboveGroup", + "splitEditorToBelowGroup", + "splitEditorToLeftGroup", + "splitEditorToRightGroup", + "splitEditorToFirstGroup", + "splitEditorToLastGroup", + "editorLayoutSingle", + "editorLayoutTwoColumns", + "editorLayoutThreeColumns", + "editorLayoutTwoRows", + "editorLayoutThreeRows", + "editorLayoutTwoByTwoGrid", + "editorLayoutTwoColumnsBottom", + "editorLayoutTwoRowsRight", + "newGroupLeft", + "newGroupRight", + "newGroupAbove", + "newGroupBelow", + "toggleEditorType", + "reopenTextEditor", + "moveEditorToNewWindow", + "copyEditorToNewWindow", + "moveEditorGroupToNewWindow", + "copyEditorGroupToNewWindow", + "restoreEditorsToMainWindow", + "newEmptyEditorWindow" + ], + "vs/workbench/browser/parts/editor/editorCommands": [ + "editorCommand.activeEditorMove.description", + "editorCommand.activeEditorMove.arg.name", + "editorCommand.activeEditorMove.arg.description", + "editorCommand.activeEditorCopy.description", + "editorCommand.activeEditorCopy.arg.name", + "editorCommand.activeEditorCopy.arg.description", + "editorGroupLayout.horizontal", + "editorGroupLayout.vertical", + "splitEditorInGroup", + "joinEditorInGroup", + "toggleJoinEditorInGroup", + "toggleSplitEditorInGroupLayout", + "focusLeftSideEditor", + "focusRightSideEditor", + "focusOtherSideEditor", + "toggleEditorGroupLock", + "lockEditorGroup", + "unlockEditorGroup" + ], + "vs/workbench/browser/parts/editor/editorConfiguration": [ + "interactiveWindow", + "markdownPreview", + "simpleBrowser", + "livePreview", + "workbench.editor.autoLockGroups", + "workbench.editor.defaultBinaryEditor", + "editor.editorAssociations", + "editorLargeFileSizeConfirmation" + ], + "vs/workbench/browser/parts/editor/editorDropTarget": [ + "dropIntoEditorPrompt" + ], + "vs/workbench/browser/parts/editor/editorGroupView": [ + "ariaLabelGroupActions", + "emptyEditorGroup", + "groupLabelLong", + "groupLabel", + "groupAriaLabelLong", + "groupAriaLabel", + "moveErrorDetails" + ], + "vs/workbench/browser/parts/editor/editorGroupWatermark": [ + "watermark.openChat", + "watermark.showCommands", + "watermark.quickAccess", + "watermark.openFile", + "watermark.openFolder", + "watermark.openFileFolder", + "watermark.openRecent", + "watermark.newUntitledFile", + "watermark.findInFiles", + { + "key": "watermark.toggleTerminal", + "comment": [ + "toggle is a verb here" + ] + }, + "watermark.startDebugging", + "watermark.openSettings" + ], + "vs/workbench/browser/parts/editor/editorPanes": [ + "editorOpenErrorDialog", + { + "key": "ok", + "comment": [ + "&& denotes a mnemonic" + ] + } + ], + "vs/workbench/browser/parts/editor/editorParts": [ + "groupLabel" + ], + "vs/workbench/browser/parts/editor/editorPlaceholder": [ + "trustRequiredEditor", + "requiresFolderTrustText", + "requiresWorkspaceTrustText", + "manageTrust", + "errorEditor", + "unavailableResourceErrorEditorText", + "unknownErrorEditorTextWithError", + "unknownErrorEditorTextWithoutError", + "retry", + "showLogs" + ], + "vs/workbench/browser/parts/editor/editorQuickAccess": [ + "noViewResults", + "entryAriaLabelWithGroupDirty", + "entryAriaLabelWithGroup", + "entryAriaLabelDirty", + "closeEditor" + ], + "vs/workbench/browser/parts/editor/editorStatus": [ + "singleSelectionRange", + "singleSelection", + "multiSelectionRange", + "multiSelection", + "endOfLineLineFeed", + "endOfLineCarriageReturnLineFeed", + "noEditor", + "noWritableCodeEditor", + "indentConvert", + "indentView", + "pickAction", + "tabFocusModeEnabled", + "status.editor.tabFocusMode", + "disableTabMode", + "inputModeOvertype", + "status.editor.enableInsertMode", + "columnSelectionModeEnabled", + "status.editor.columnSelectionMode", + "disableColumnSelectionMode", + "status.editor.selection", + "gotoLine", + "status.editor.indentation", + "selectIndentation", + "status.editor.encoding", + "selectEncoding", + "status.editor.eol", + "selectEOL", + "status.editor.mode", + "selectLanguageMode", + "status.editor.info", + "fileInfo", + "spacesSize", + "spacesAndTabsSize", + { + "key": "tabSize", + "comment": [ + "Tab corresponds to the tab key" + ] + }, + "currentProblem", + "currentProblem", + "showLanguageExtensions", + "changeLanguageMode.description", + "changeLanguageMode.arg.name", + "noEditor", + "languageDescription", + "languageDescriptionConfigured", + "languagesPicks", + "configureModeSettings", + "configureAssociationsExt", + "autoDetect", + "pickLanguage", + "currentAssociation", + "pickLanguageToConfigure", + "noEditor", + "noWritableCodeEditor", + "pickEndOfLine", + "noEditor", + "noEditor", + "noFileEditor", + "saveWithEncoding", + "reopenWithEncoding", + "pickAction", + "guessedEncoding", + "pickEncodingForReopen", + "pickEncodingForSave", + "reopenWithEncodingWarning", + "reopenWithEncodingDetail", + "reopen", + "changeMode", + "changeEndOfLine", + "changeEncoding" + ], + "vs/workbench/browser/parts/editor/editorTabsControl": [ + "ariaLabelEditorActions", + "draggedEditorGroup" + ], + "vs/workbench/browser/parts/editor/multiEditorTabsControl": [ + "ariaLabelTabActions" + ], + "vs/workbench/browser/parts/editor/sideBySideEditor": [ + "sideBySideEditor" + ], + "vs/workbench/browser/parts/editor/textCodeEditor": [ + "textEditor" + ], + "vs/workbench/browser/parts/editor/textDiffEditor": [ + "textDiffEditor", + "fileTooLargeForHeapErrorWithSize", + "fileTooLargeForHeapErrorWithoutSize" + ], + "vs/workbench/browser/parts/editor/textEditor": [ + "editor" + ], + "vs/workbench/browser/parts/globalCompositeBar": [ + "accountsViewBarIcon", + "hideAccounts", + "manage", + "accounts", + "accounts", + "loading", + "authProviderUnavailable", + "manageTrustedExtensions", + "manageTrustedMCPServers", + "signOut", + "manageDynamicAuthProviders", + "authProviderUnavailable", + "manageTrustedMCPServers", + "signOut", + "manage", + "manage profile", + "hideAccounts", + "accounts", + "manage" + ], + "vs/workbench/browser/parts/notifications/notificationAccessibleView": [ + "notification.accessibleViewSrc", + "clearNotification", + "clearNotification" + ], + "vs/workbench/browser/parts/notifications/notificationsActions": [ + "clearIcon", + "clearAllIcon", + "hideIcon", + "expandIcon", + "collapseIcon", + "configureIcon", + "doNotDisturbIcon", + "clearNotification", + "clearNotifications", + "toggleDoNotDisturbMode", + "toggleDoNotDisturbModeBySource", + "configureDoNotDisturbMode", + "hideNotificationsCenter", + "expandNotification", + "collapseNotification", + "configureNotification", + "copyNotification" + ], + "vs/workbench/browser/parts/notifications/notificationsAlerts": [ + "alertErrorMessage", + "alertWarningMessage", + "alertInfoMessage" + ], + "vs/workbench/browser/parts/notifications/notificationsCenter": [ + "notificationsEmpty", + "notifications", + "notificationsToolbar", + "turnOnNotifications", + "turnOffNotifications", + "moreSources", + "notificationsCenterWidgetAriaLabel" + ], + "vs/workbench/browser/parts/notifications/notificationsCommands": [ + "selectSources", + "notifications", + "showNotifications", + "hideNotifications", + "clearAllNotifications", + "acceptNotificationPrimaryAction", + "toggleDoNotDisturbMode", + "toggleDoNotDisturbModeBySource", + "focusNotificationToasts" + ], + "vs/workbench/browser/parts/notifications/notificationsList": [ + "notificationAccessibleViewHint", + "notificationAccessibleViewHintNoKb", + "notificationAriaLabelHint", + "notificationAriaLabel", + "notificationWithSourceAriaLabelHint", + "notificationWithSourceAriaLabel", + "notificationsList" + ], + "vs/workbench/browser/parts/notifications/notificationsStatus": [ + "status.notifications", + "status.notifications", + "status.doNotDisturb", + "status.doNotDisturbTooltip", + "hideNotifications", + "zeroNotifications", + "noNotifications", + "oneNotification", + { + "key": "notifications", + "comment": [ + "{0} will be replaced by a number" + ] + }, + { + "key": "noNotificationsWithProgress", + "comment": [ + "{0} will be replaced by a number" + ] + }, + { + "key": "oneNotificationWithProgress", + "comment": [ + "{0} will be replaced by a number" + ] + }, + { + "key": "notificationsWithProgress", + "comment": [ + "{0} and {1} will be replaced by a number" + ] + }, + "status.message" + ], + "vs/workbench/browser/parts/notifications/notificationsToasts": [ + "notificationAriaLabel", + "notificationWithSourceAriaLabel" + ], + "vs/workbench/browser/parts/notifications/notificationsViewer": [ + "executeCommand", + "notificationActions", + "turnOnNotifications", + "turnOffNotifications", + "notificationSource" + ], + "vs/workbench/browser/parts/paneCompositeBar": [ + "moveToMenu", + "resetLocation", + "resetLocation", + "panel", + "sidebar", + "auxiliarybar" + ], + "vs/workbench/browser/parts/paneCompositePart": [ + "pane.emptyMessage", + "moreActions", + "views" + ], + "vs/workbench/browser/parts/panel/panelActions": [ + "maximizeIcon", + "closeIcon", + "togglePanelOffIcon", + "togglePanelOnIcon", + "closePanel", + { + "key": "miTogglePanelMnemonic", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "openAndClosePanel", + "closePanel", + "focusPanel", + "positionPanelTopShort", + "positionPanelLeftShort", + "positionPanelRightShort", + "positionPanelBottomShort", + "alignPanelLeftShort", + "alignPanelRightShort", + "alignPanelCenterShort", + "alignPanelJustifyShort", + "positionPanel", + "alignPanel", + "maximizePanel", + "minimizePanel", + "panelMaxNotSupported", + "togglePanel", + "togglePanelVisibility", + "closePanel", + "focusPanel", + "positionPanelTop", + "positionPanelLeft", + "positionPanelRight", + "positionPanelBottom", + "alignPanelLeft", + "alignPanelRight", + "alignPanelCenter", + "alignPanelJustify", + "previousPanelView", + "nextPanelView", + "toggleMaximizedPanel", + "movePanelToSecondarySideBar", + "movePanelToSecondarySideBar", + "moveSidePanelToPanel", + "moveSidePanelToPanel" + ], + "vs/workbench/browser/parts/panel/panelPart": [ + "showIcons", + "showLabels", + "panel position", + "align panel", + "hidePanel" + ], + "vs/workbench/browser/parts/sidebar/sidebarActions": [ + "closeSidebar", + "focusSideBar" + ], + "vs/workbench/browser/parts/sidebar/sidebarPart": [ + "toggleActivityBar" + ], + "vs/workbench/browser/parts/statusbar/statusbarActions": [ + "hide", + "manageExtension", + "focusStatusBar" + ], + "vs/workbench/browser/parts/statusbar/statusbarPart": [ + "hideStatusBar" + ], + "vs/workbench/browser/parts/titlebar/commandCenterControl": [ + "label.dfl", + "label1", + "label2", + "title", + "title2", + "title3" + ], + "vs/workbench/browser/parts/titlebar/menubarControl": [ + { + "key": "mFile", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "mEdit", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "mSelection", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "mView", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "mGoto", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "mTerminal", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "mHelp", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "mPreferences", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "menubar.customTitlebarAccessibilityNotification", + "goToSetting", + { + "key": "checkForUpdates", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "checkingForUpdates", + { + "key": "download now", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "DownloadingUpdate", + { + "key": "installUpdate...", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "installingUpdate", + { + "key": "restartToUpdate", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "focusMenu" + ], + "vs/workbench/browser/parts/titlebar/titlebarActions": [ + "toggle.commandCenter", + "toggle.commandCenterDescription", + "toggle.navigation", + "toggle.navigationDescription", + "toggle.layout", + "toggle.layoutDescription", + "toggle.hideCustomTitleBar", + "toggle.hideCustomTitleBarInFullScreen", + "toggle.customTitleBar", + "toggle.editorActions", + "accounts", + "accounts", + "manage", + "manage", + "showCustomTitleBar", + "hideCustomTitleBar", + "hideCustomTitleBarInFullScreen" + ], + "vs/workbench/browser/parts/titlebar/titlebarPart": [ + "ariaLabelTitleActions", + "focusTitleBar" + ], + "vs/workbench/browser/parts/titlebar/windowTitle": [ + "userIsAdmin", + "userIsSudo", + "devExtensionWindowTitlePrefix" + ], + "vs/workbench/browser/parts/views/checkbox": [ + "checked", + "unchecked" + ], + "vs/workbench/browser/parts/views/treeView": [ + "no-dataprovider", + "treeView.enableCollapseAll", + "treeView.enableRefresh", + "refresh", + "collapseAll", + "treeView.toggleCollapseAll", + "command-error" + ], + "vs/workbench/browser/parts/views/viewFilter": [ + "more filters" + ], + "vs/workbench/browser/parts/views/viewPane": [ + "viewPaneContainerExpandedIcon", + "viewPaneContainerCollapsedIcon", + "viewToolbarAriaLabel", + "viewAccessibilityHelp" + ], + "vs/workbench/browser/parts/views/viewPaneContainer": [ + "views", + "viewMoveUp", + "viewMoveLeft", + "viewMoveDown", + "viewMoveRight", + "viewsMove" + ], + "vs/workbench/browser/quickaccess": [ + "inQuickOpen" + ], + "vs/workbench/browser/web.main": [ + "reset user data message", + "reset" + ], + "vs/workbench/browser/window": [ + "quitMessageMac", + "quitMessage", + "closeWindowMessage", + { + "key": "quitButtonLabel", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "exitButtonLabel", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "closeWindowButtonLabel", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "doNotAskAgain", + "shutdownError", + "shutdownErrorDetail", + { + "key": "reload", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "unableToOpenExternal", + "unableToOpenWindowDetail", + { + "key": "retry", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "openExternalDialogButtonRetry.v2", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "openExternalDialogDetail.v2", + { + "key": "openExternalDialogButtonInstall.v3", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "openExternalDialogDetailNoInstall", + "openExternalDialogTitle" + ], + "vs/workbench/browser/workbench.contribution": [ + "browser", + "workbench.editor.titleScrollbarSizing.default", + "workbench.editor.titleScrollbarSizing.large", + "tabScrollbarHeight", + "workbench.editor.titleScrollbarVisibility.auto", + "workbench.editor.titleScrollbarVisibility.visible", + "workbench.editor.titleScrollbarVisibility.hidden", + "titleScrollbarVisibility", + "workbench.editor.showTabs.multiple", + "workbench.editor.showTabs.single", + "workbench.editor.showTabs.none", + "showEditorTabs", + { + "comment": [ + "{0} will be a setting name rendered as a link" + ], + "key": "workbench.editor.editorActionsLocation.default" + }, + { + "comment": [ + "{0} will be a setting name rendered as a link" + ], + "key": "workbench.editor.editorActionsLocation.titleBar" + }, + "workbench.editor.editorActionsLocation.hidden", + "editorActionsLocation", + "alwaysShowEditorActions", + { + "comment": [ + "{0}, {1} will be a setting name rendered as a link" + ], + "key": "wrapTabs" + }, + { + "comment": [ + "{0}, {1} will be a setting name rendered as a link" + ], + "key": "scrollToSwitchTabs" + }, + { + "comment": [ + "{0}, {1} will be a setting name rendered as a link" + ], + "key": "highlightModifiedTabs" + }, + "decorations.badges", + "decorations.colors", + "workbench.editor.label.enabled", + "workbench.editor.label.patterns", + "workbench.editor.label.dirname", + "workbench.editor.label.nthdirname", + "workbench.editor.label.filename", + "workbench.editor.label.extname", + "workbench.editor.label.nthextname", + "customEditorLabelDescriptionExample", + "workbench.editor.label.template", + "workbench.editor.labelFormat.default", + "workbench.editor.labelFormat.short", + "workbench.editor.labelFormat.medium", + "workbench.editor.labelFormat.long", + "tabDescription", + "workbench.editor.untitled.labelFormat.content", + "workbench.editor.untitled.labelFormat.name", + "untitledLabelFormat", + "workbench.editor.empty.hint", + "workbench.editor.languageDetection", + "workbench.editor.historyBasedLanguageDetection", + "workbench.editor.preferBasedLanguageDetection", + "workbench.editor.showLanguageDetectionHints", + "workbench.editor.showLanguageDetectionHints.editors", + "workbench.editor.showLanguageDetectionHints.notebook", + { + "comment": [ + "{0} will be a setting name rendered as a link" + ], + "key": "tabActionLocation" + }, + "workbench.editor.tabActionCloseVisibility", + "workbench.editor.tabActionUnpinVisibility", + { + "comment": [ + "{0}, {1} will be a setting name rendered as a link" + ], + "key": "showTabIndex" + }, + "workbench.editor.tabSizing.fit", + "workbench.editor.tabSizing.shrink", + "workbench.editor.tabSizing.fixed", + { + "comment": [ + "{0}, {1} will be a setting name rendered as a link" + ], + "key": "tabSizing" + }, + { + "comment": [ + "{0}, {1} will be a setting name rendered as a link" + ], + "key": "workbench.editor.tabSizingFixedMinWidth" + }, + { + "comment": [ + "{0}, {1} will be a setting name rendered as a link" + ], + "key": "workbench.editor.tabSizingFixedMaxWidth" + }, + { + "comment": [ + "{0}, {1} will be a setting name rendered as a link" + ], + "key": "workbench.editor.tabHeight" + }, + "workbench.editor.pinnedTabSizing.normal", + "workbench.editor.pinnedTabSizing.compact", + "workbench.editor.pinnedTabSizing.shrink", + { + "comment": [ + "{0}, {1} will be a setting name rendered as a link" + ], + "key": "pinnedTabSizing" + }, + { + "comment": [ + "{0}, {1} will be a setting name rendered as a link" + ], + "key": "workbench.editor.pinnedTabsOnSeparateRow" + }, + "workbench.editor.preventPinnedEditorClose.always", + "workbench.editor.preventPinnedEditorClose.onlyKeyboard", + "workbench.editor.preventPinnedEditorClose.onlyMouse", + "workbench.editor.preventPinnedEditorClose.never", + "workbench.editor.preventPinnedEditorClose", + "workbench.editor.splitSizingAuto", + "workbench.editor.splitSizingDistribute", + "workbench.editor.splitSizingSplit", + "splitSizing", + "splitOnDragAndDrop", + "dragToOpenWindow", + "focusRecentEditorAfterClose", + "showIcons", + "enablePreview", + { + "comment": [ + "{0}, {1} will be a setting name rendered as a link" + ], + "key": "enablePreviewFromQuickOpen" + }, + { + "comment": [ + "{0}, {1} will be a setting name rendered as a link" + ], + "key": "enablePreviewFromCodeNavigation" + }, + "closeOnFileDelete", + { + "comment": [ + "{0}, {1}, {2}, {3} will be a setting name rendered as a link" + ], + "key": "editorOpenPositioning" + }, + "sideBySideDirection", + "closeEmptyGroups", + "revealIfOpen", + "swipeToNavigate", + "mouseBackForwardToNavigate", + "navigationScope", + "workbench.editor.navigationScopeDefault", + "workbench.editor.navigationScopeEditorGroup", + "workbench.editor.navigationScopeEditor", + "restoreViewState", + "sharedViewState", + "splitInGroupLayout", + "workbench.editor.splitInGroupLayoutVertical", + "workbench.editor.splitInGroupLayoutHorizontal", + "centeredLayoutAutoResize", + "centeredLayoutDynamicWidth", + { + "comment": [ + "{0}, {1} will be a setting name rendered as a link" + ], + "key": "doubleClickTabToToggleEditorGroupSizes" + }, + "workbench.editor.doubleClickTabToToggleEditorGroupSizes.maximize", + "workbench.editor.doubleClickTabToToggleEditorGroupSizes.expand", + "workbench.editor.doubleClickTabToToggleEditorGroupSizes.off", + "limitEditorsEnablement", + "limitEditorsMaximum", + "limitEditorsExcludeDirty", + "perEditorGroup", + "localHistoryEnabled", + "localHistoryMaxFileSize", + "localHistoryMaxFileEntries", + "exclude", + "mergeWindow", + "commandHistory", + "preserveInput", + "suggestCommands", + "askChatLocation", + "askChatLocation.chatView", + "askChatLocation.quickChat", + "showAskInChat", + "enableNaturalLanguageSearch", + "closeOnFocusLost", + "workbench.quickOpen.preserveInput", + "openDefaultSettings", + "useSplitJSON", + "openDefaultKeybindings", + "alwaysShowAdvancedSettings", + "sideBarLocation", + "panelShowLabels", + "panelDefaultLocation", + "panelOpensMaximized", + "workbench.panel.opensMaximized.always", + "workbench.panel.opensMaximized.never", + "workbench.panel.opensMaximized.preserve", + "secondarySideBarDefaultVisibility", + "workbench.secondarySideBar.defaultVisibility.hidden", + "workbench.secondarySideBar.defaultVisibility.visibleInWorkspace", + "workbench.secondarySideBar.defaultVisibility.visible", + "workbench.secondarySideBar.defaultVisibility.maximizedInWorkspace", + "workbench.secondarySideBar.defaultVisibility.maximized", + "secondarySideBarShowLabels", + "statusBarVisibility", + { + "comment": [ + "This is the description for a setting" + ], + "key": "activityBarLocation" + }, + "workbench.activityBar.location.default", + "workbench.activityBar.location.top", + "workbench.activityBar.location.bottom", + "workbench.activityBar.location.hide", + { + "comment": [ + "{0}, {1} will be a setting name rendered as a link" + ], + "key": "activityBarIconClickBehavior" + }, + "workbench.activityBar.iconClickBehavior.toggle", + "workbench.activityBar.iconClickBehavior.focus", + "viewVisibility", + "workbench.view.showQuietly", + "workbench.panel.output", + "fontAliasing", + "workbench.fontAliasing.default", + "workbench.fontAliasing.antialiased", + "workbench.fontAliasing.none", + "workbench.fontAliasing.auto", + "settings.editor.ui", + "settings.editor.json", + "settings.editor.desc", + "settings.showAISearchToggle", + "workbench.hover.delay", + "workbench.reduceMotion", + "workbench.reduceMotion.on", + "workbench.reduceMotion.off", + "workbench.reduceMotion.auto", + "navigationControlEnabledWeb", + { + "key": "navigationControlEnabled", + "comment": [ + "{0}, {1} is a placeholder for a setting identifier." + ] + }, + "layoutControlEnabledWeb", + { + "key": "layoutControlEnabled", + "comment": [ + "{0}, {1} is a placeholder for a setting identifier." + ] + }, + "layoutcontrol.type.menu", + "layoutcontrol.type.toggles", + "layoutcontrol.type.both", + "layoutControlType", + "tips.enabled", + "windowTitle", + "activeEditorShort", + "activeEditorMedium", + "activeEditorLong", + "activeEditorLanguageId", + "activeFolderShort", + "activeFolderMedium", + "activeFolderLong", + "folderName", + "folderPath", + "rootName", + "rootNameShort", + "rootPath", + "profileName", + "appName", + "remoteName", + "dirty", + "focusedView", + "activeRepositoryName", + "activeRepositoryBranchName", + "activeEditorState", + "separator", + "window.titleSeparator", + "window.commandCenterWeb", + { + "key": "window.commandCenter", + "comment": [ + "{0}, {1} is a placeholder for a setting identifier." + ] + }, + "window.menuBarVisibility.classic", + "window.menuBarVisibility.visible", + "window.menuBarVisibility.toggle.mac", + "window.menuBarVisibility.toggle", + "window.menuBarVisibility.hidden", + "window.menuBarVisibility.compact.web", + { + "key": "window.menuBarVisibility.compact", + "comment": [ + "{0}, {1} is a placeholder for a setting identifier." + ] + }, + "menuBarVisibility.mac", + "menuBarVisibility", + "enableMenuBarMnemonics", + "customMenuBarAltFocus", + "window.openFilesInNewWindow.on", + "window.openFilesInNewWindow.off", + "window.openFilesInNewWindow.defaultMac", + "window.openFilesInNewWindow.default", + "openFilesInNewWindowMac", + "openFilesInNewWindow", + "window.openFoldersInNewWindow.on", + "window.openFoldersInNewWindow.off", + "window.openFoldersInNewWindow.default", + "openFoldersInNewWindow", + "window.confirmBeforeClose.always.web", + "window.confirmBeforeClose.always", + "window.confirmBeforeClose.keyboardOnly.web", + "window.confirmBeforeClose.keyboardOnly", + "window.confirmBeforeClose.never.web", + "window.confirmBeforeClose.never", + "confirmBeforeCloseWeb", + "confirmBeforeClose", + "problems.visibility", + "zenModeConfigurationTitle", + "zenMode.fullScreen", + "zenMode.centerLayout", + "zenMode.showTabs", + "zenMode.showTabs.multiple", + "zenMode.showTabs.single", + "zenMode.showTabs.none", + "zenMode.hideStatusBar", + "zenMode.hideActivityBar", + "zenMode.hideLineNumbers", + "zenMode.restore", + "zenMode.silentNotifications" + ], + "vs/workbench/common/configuration": [ + "applicationConfigurationTitle", + "workbenchConfigurationTitle", + "securityConfigurationTitle", + "problemsConfigurationTitle", + "windowConfigurationTitle", + "security.allowedUNCHosts.patternErrorMessage", + "security.allowedUNCHosts", + "security.restrictUNCAccess", + "active window", + "newWindowProfile" + ], + "vs/workbench/common/contextkeys": [ + "workbenchState", + "workspaceFolderCount", + "dirtyWorkingCopies", + "remoteName", + "virtualWorkspace", + "temporaryWorkspace", + "embedderIdentifier", + "inAutomation", + "isFullscreen", + "isAuxiliaryWindowFocusedContext", + "isWindowAlwaysOnTop", + "isAuxiliaryWindow", + "activeEditorIsDirty", + "activeEditorIsNotPreview", + "activeEditorIsFirstInGroup", + "activeEditorIsLastInGroup", + "activeEditorIsPinned", + "activeEditorIsReadonly", + "activeCompareEditorCanSwap", + "activeEditorCanToggleReadonly", + "activeEditorCanRevert", + "activeEditor", + "activeEditorAvailableEditorIds", + "textCompareEditorVisible", + "textCompareEditorActive", + "sideBySideEditorActive", + "groupEditorsCount", + "activeEditorGroupEmpty", + "activeEditorGroupIndex", + "activeEditorGroupLast", + "activeEditorGroupLocked", + "multipleEditorGroups", + "multipleEditorsSelectedInGroup", + "twoEditorsSelectedInGroup", + "SelectedEditorsInGroupFileOrUntitledResourceContextKey", + "editorPartMultipleEditorGroups", + "editorPartEditorGroupMaximized", + "editorIsOpen", + "inZenMode", + "isMainEditorCenteredLayout", + "splitEditorsVertically", + "mainEditorAreaVisible", + "editorTabsVisible", + "sideBarVisible", + "sideBarFocus", + "activeViewlet", + "statusBarFocused", + "titleBarStyle", + "titleBarVisible", + "isCompactTitleBar", + "bannerFocused", + "notificationFocus", + "notificationCenterVisible", + "notificationToastsVisible", + "activeAuxiliary", + "auxiliaryBarFocus", + "auxiliaryBarVisible", + "auxiliaryBarMaximized", + "activePanel", + "panelFocus", + "panelPosition", + "panelAlignment", + "panelVisible", + "panelMaximized", + "focusedView", + "resourceScheme", + "resourceFilename", + "resourceDirname", + "resourcePath", + "resourceLangId", + "resource", + "resourceExtname", + "resourceSet", + "isFileSystemResource" + ], + "vs/workbench/common/editor": [ + "promptOpenWith.defaultEditor.displayName", + "builtinProviderDisplayName", + "openLargeFile", + "configureEditorLargeFileConfirmation" + ], + "vs/workbench/common/editor/diffEditorInput": [ + "sideBySideLabels" + ], + "vs/workbench/common/editor/sideBySideEditorInput": [ + "sideBySideLabels" + ], + "vs/workbench/common/editor/textEditorModel": [ + "languageAutoDetected" + ], + "vs/workbench/common/theme": [ + "tabActiveBackground", + "tabUnfocusedActiveBackground", + "tabInactiveBackground", + "tabUnfocusedInactiveBackground", + "tabActiveForeground", + "tabInactiveForeground", + "tabUnfocusedActiveForeground", + "tabUnfocusedInactiveForeground", + "tabHoverBackground", + "tabUnfocusedHoverBackground", + "tabHoverForeground", + "tabUnfocusedHoverForeground", + "tabBorder", + "lastPinnedTabBorder", + "tabActiveBorder", + "tabActiveUnfocusedBorder", + "tabActiveBorderTop", + "tabActiveUnfocusedBorderTop", + "tabSelectedBorderTop", + "tabSelectedBackground", + "tabSelectedForeground", + "tabHoverBorder", + "tabUnfocusedHoverBorder", + "tabDragAndDropBorder", + "tabActiveModifiedBorder", + "tabInactiveModifiedBorder", + "unfocusedActiveModifiedBorder", + "unfocusedINactiveModifiedBorder", + "editorPaneBackground", + "editorGroupEmptyBackground", + "editorGroupFocusedEmptyBorder", + "tabsContainerBackground", + "tabsContainerBorder", + "editorGroupHeaderBackground", + "editorTitleContainerBorder", + "editorGroupBorder", + "editorDragAndDropBackground", + "editorDropIntoPromptForeground", + "editorDropIntoPromptBackground", + "editorDropIntoPromptBorder", + "sideBySideEditor.horizontalBorder", + "sideBySideEditor.verticalBorder", + "outputViewBackground", + "outputViewStickyScrollBackground", + "banner.background", + "banner.foreground", + "banner.iconForeground", + "statusBarForeground", + "statusBarNoFolderForeground", + "statusBarBackground", + "statusBarNoFolderBackground", + "statusBarBorder", + "statusBarFocusBorder", + "statusBarNoFolderBorder", + "statusBarItemActiveBackground", + "statusBarItemFocusBorder", + "statusBarItemHoverBackground", + "statusBarItemHoverForeground", + "statusBarItemCompactHoverBackground", + "statusBarProminentItemForeground", + "statusBarProminentItemBackground", + "statusBarProminentItemHoverForeground", + "statusBarProminentItemHoverBackground", + "statusBarErrorItemBackground", + "statusBarErrorItemForeground", + "statusBarErrorItemHoverForeground", + "statusBarErrorItemHoverBackground", + "statusBarWarningItemBackground", + "statusBarWarningItemForeground", + "statusBarWarningItemHoverForeground", + "statusBarWarningItemHoverBackground", + "activityBarBackground", + "activityBarForeground", + "activityBarInActiveForeground", + "activityBarBorder", + "activityBarActiveBorder", + "activityBarActiveFocusBorder", + "activityBarActiveBackground", + "activityBarDragAndDropBorder", + "activityBarBadgeBackground", + "activityBarBadgeForeground", + "activityBarTop", + "activityBarTopActiveFocusBorder", + "activityBarTopActiveBackground", + "activityBarTopInActiveForeground", + "activityBarTopDragAndDropBorder", + "activityBarTopBackground", + "panelBackground", + "panelBorder", + "panelTitleBorder", + "panelActiveTitleForeground", + "panelInactiveTitleForeground", + "panelActiveTitleBorder", + "panelTitleBadgeBackground", + "panelTitleBadgeForeground", + "panelInputBorder", + "panelDragAndDropBorder", + "panelSectionDragAndDropBackground", + "panelSectionHeaderBackground", + "panelSectionHeaderForeground", + "panelSectionHeaderBorder", + "panelSectionBorder", + "panelStickyScrollBackground", + "panelStickyScrollBorder", + "panelStickyScrollShadow", + "profileBadgeBackground", + "profileBadgeForeground", + "statusBarItemRemoteBackground", + "statusBarItemRemoteForeground", + "statusBarRemoteItemHoverForeground", + "statusBarRemoteItemHoverBackground", + "statusBarItemOfflineBackground", + "statusBarItemOfflineForeground", + "statusBarOfflineItemHoverForeground", + "statusBarOfflineItemHoverBackground", + "extensionBadge.remoteBackground", + "extensionBadge.remoteForeground", + "sideBarBackground", + "sideBarForeground", + "sideBarBorder", + "sideBarTitleBackground", + "sideBarTitleForeground", + "sideBarTitleBorder", + "sideBarDragAndDropBackground", + "sideBarSectionHeaderBackground", + "sideBarSectionHeaderForeground", + "sideBarSectionHeaderBorder", + "sideBarActivityBarTopBorder", + "sideBarStickyScrollBackground", + "sideBarStickyScrollBorder", + "sideBarStickyScrollShadow", + "titleBarActiveForeground", + "titleBarInactiveForeground", + "titleBarActiveBackground", + "titleBarInactiveBackground", + "titleBarBorder", + "menubarSelectionForeground", + "menubarSelectionBackground", + "menubarSelectionBorder", + "commandCenter-foreground", + "commandCenter-activeForeground", + "commandCenter-inactiveForeground", + "commandCenter-background", + "commandCenter-activeBackground", + "commandCenter-border", + "commandCenter-activeBorder", + "commandCenter-inactiveBorder", + "notificationCenterBorder", + "notificationToastBorder", + "notificationsForeground", + "notificationsBackground", + "notificationsLink", + "notificationCenterHeaderForeground", + "notificationCenterHeaderBackground", + "notificationsBorder", + "notificationsErrorIconForeground", + "notificationsWarningIconForeground", + "notificationsInfoIconForeground", + "windowActiveBorder", + "windowInactiveBorder" + ], + "vs/workbench/common/views": [ + "views log", + "defaultViewIcon", + "duplicateId", + "treeView.notRegistered" + ], + "vs/workbench/contrib/accessibility/browser/accessibilityConfiguration": [ + "accessibilityConfigurationTitle", + "sound.enabled.auto", + "sound.enabled.on", + "sound.enabled.off", + "announcement.enabled.auto", + "announcement.enabled.off", + "verbosity.terminal.description", + "verbosity.diffEditor.description", + "verbosity.chat.description", + "verbosity.interactiveEditor.description", + "verbosity.terminalChatOutput.description", + "verbosity.inlineCompletions.description", + "verbosity.keybindingsEditor.description", + "verbosity.notebook", + "verbosity.hover", + "verbosity.notification", + "verbosity.emptyEditorHint", + "verbosity.replEditor.description", + "verbosity.comments", + "verbosity.diffEditorActive", + "verbosity.debug", + "verbosity.walkthrough", + "terminal.integrated.accessibleView.closeOnKeyPress", + "verbosity.scm", + "accessibility.signalOptions.volume", + "accessibility.signalOptions.debouncePositionChanges", + "accessibility.signalOptions.delays.general.announcement", + "accessibility.signalOptions.delays.general.sound", + "accessibility.signalOptions.delays.warningAtPosition.announcement", + "accessibility.signalOptions.delays.warningAtPosition.sound", + "accessibility.signalOptions.delays.errorAtPosition.announcement", + "accessibility.signalOptions.delays.errorAtPosition.sound", + "accessibility.signals.lineHasBreakpoint", + "accessibility.signals.lineHasBreakpoint.sound", + "accessibility.signals.lineHasBreakpoint.announcement", + "accessibility.signals.lineHasInlineSuggestion", + "accessibility.signals.lineHasInlineSuggestion.sound", + "accessibility.signals.nextEditSuggestion", + "accessibility.signals.nextEditSuggestion.sound", + "accessibility.signals.nextEditSuggestion.announcement", + "accessibility.signals.lineHasError", + "accessibility.signals.lineHasError.sound", + "accessibility.signals.lineHasError.announcement", + "accessibility.signals.lineHasFoldedArea", + "accessibility.signals.lineHasFoldedArea.sound", + "accessibility.signals.lineHasFoldedArea.announcement", + "accessibility.signals.lineHasWarning", + "accessibility.signals.lineHasWarning.sound", + "accessibility.signals.lineHasWarning.announcement", + "accessibility.signals.positionHasError", + "accessibility.signals.positionHasError.sound", + "accessibility.signals.positionHasError.announcement", + "accessibility.signals.positionHasWarning", + "accessibility.signals.positionHasWarning.sound", + "accessibility.signals.positionHasWarning.announcement", + "accessibility.signals.onDebugBreak", + "accessibility.signals.onDebugBreak.sound", + "accessibility.signals.onDebugBreak.announcement", + "accessibility.signals.noInlayHints", + "accessibility.signals.noInlayHints.sound", + "accessibility.signals.noInlayHints.announcement", + "accessibility.signals.taskCompleted", + "accessibility.signals.taskCompleted.sound", + "accessibility.signals.taskCompleted.announcement", + "accessibility.signals.taskFailed", + "accessibility.signals.taskFailed.sound", + "accessibility.signals.taskFailed.announcement", + "accessibility.signals.terminalCommandFailed", + "accessibility.signals.terminalCommandFailed.sound", + "accessibility.signals.terminalCommandFailed.announcement", + "accessibility.signals.terminalCommandSucceeded", + "accessibility.signals.terminalCommandSucceeded.sound", + "accessibility.signals.terminalCommandSucceeded.announcement", + "accessibility.signals.terminalQuickFix", + "accessibility.signals.terminalQuickFix.sound", + "accessibility.signals.terminalQuickFix.announcement", + "accessibility.signals.terminalBell", + "accessibility.signals.terminalBell.sound", + "accessibility.signals.terminalBell.announcement", + "accessibility.signals.diffLineInserted", + "accessibility.signals.sound", + "accessibility.signals.diffLineModified", + "accessibility.signals.diffLineModified.sound", + "accessibility.signals.diffLineDeleted", + "accessibility.signals.diffLineDeleted.sound", + "accessibility.signals.chatEditModifiedFile", + "accessibility.signals.chatEditModifiedFile.sound", + "accessibility.signals.notebookCellCompleted", + "accessibility.signals.notebookCellCompleted.sound", + "accessibility.signals.notebookCellCompleted.announcement", + "accessibility.signals.notebookCellFailed", + "accessibility.signals.notebookCellFailed.sound", + "accessibility.signals.notebookCellFailed.announcement", + "accessibility.signals.progress", + "accessibility.signals.progress.sound", + "accessibility.signals.progress.announcement", + "accessibility.signals.chatRequestSent", + "accessibility.signals.chatRequestSent.sound", + "accessibility.signals.chatRequestSent.announcement", + "accessibility.signals.chatResponseReceived", + "accessibility.signals.chatResponseReceived.sound", + "accessibility.signals.codeActionTriggered", + "accessibility.signals.codeActionTriggered.sound", + "accessibility.signals.codeActionApplied", + "accessibility.signals.codeActionApplied.sound", + "accessibility.signals.voiceRecordingStarted", + "accessibility.signals.voiceRecordingStarted.sound", + "accessibility.signals.voiceRecordingStopped", + "accessibility.signals.voiceRecordingStopped.sound", + "accessibility.signals.clear", + "accessibility.signals.clear.sound", + "accessibility.signals.clear.announcement", + "accessibility.signals.editsUndone", + "accessibility.signals.editsUndone.sound", + "accessibility.signals.editsUndone.announcement", + "accessibility.signals.editsKept", + "accessibility.signals.editsKept.sound", + "accessibility.signals.editsKept.announcement", + "accessibility.signals.save", + "accessibility.signals.save.sound", + "accessibility.signals.save.sound.userGesture", + "accessibility.signals.save.sound.always", + "accessibility.signals.save.sound.never", + "accessibility.signals.save.announcement", + "accessibility.signals.save.announcement.userGesture", + "accessibility.signals.save.announcement.always", + "accessibility.signals.save.announcement.never", + "accessibility.signals.format", + "accessibility.signals.format.sound", + "accessibility.signals.format.userGesture", + "accessibility.signals.format.always", + "accessibility.signals.format.never", + "accessibility.signals.format.announcement", + "accessibility.signals.format.announcement.userGesture", + "accessibility.signals.format.announcement.always", + "accessibility.signals.format.announcement.never", + "accessibility.signals.chatUserActionRequired", + "accessibility.signals.chatUserActionRequired.sound", + "sound.enabled.autoWindow", + "sound.enabled.on", + "sound.enabled.off", + "accessibility.signals.chatUserActionRequired.announcement", + "accessibility.underlineLinks", + "accessibility.debugWatchVariableAnnouncements", + "accessibility.replEditor.readLastExecutedOutput", + "replEditor.autoFocusAppendedCell", + "accessibility.windowTitleOptimized", + "accessibility.openChatEditedFiles", + "accessibility.verboseChatProgressUpdates", + "dimUnfocusedEnabled", + "dimUnfocusedOpacity", + "accessibility.hideAccessibleView", + "accessibility.verboseChatProgressUpdates", + "voice.speechTimeout", + "voice.ignoreCodeBlocks", + "voice.speechLanguage", + "accessibility.voice.autoSynthesize.on", + "accessibility.voice.autoSynthesize.off", + "autoSynthesize", + "speechLanguage.auto" + ], + "vs/workbench/contrib/accessibility/browser/accessibilityStatus": [ + "screenReaderDetectedExplanation.question", + "screenReaderDetectedExplanation.answerYes", + "screenReaderDetectedExplanation.answerNo", + "screenReaderDetectedExplanation.answerLearnMore", + "screenReaderDetected", + "status.editor.screenReaderMode" + ], + "vs/workbench/contrib/accessibility/browser/accessibleView": [ + "keybindings", + "selectKeybinding", + "symbolLabel", + "symbolLabelAria", + "disableAccessibilityHelp", + "ariaAccessibleViewActionsBottom", + "ariaAccessibleViewActions", + "accessibility-help", + "accessible-view", + "accessible-view-hint", + "accessibility-help-hint", + "accessibleHelpToolbar", + "accessibleViewToolbar", + "toolbar", + "intro", + "insertAtCursor", + "insertIntoNewFile", + "runInTerminal", + "accessibleViewNextPreviousHint", + "acessibleViewDisableHint", + "goToSymbolHint", + "configureKb", + "configureKbAssigned", + "exit", + "openDoc", + "acessibleViewHint", + "acessibleViewHintNoKbEither", + "accessibleViewSymbolQuickPickPlaceholder", + "accessibleViewSymbolQuickPickTitle" + ], + "vs/workbench/contrib/accessibility/browser/accessibleViewActions": [ + "editor.action.accessibleViewNext", + "editor.action.accessibleViewNextCodeBlock", + "editor.action.accessibleViewPreviousCodeBlock", + "editor.action.accessibleViewPrevious", + "editor.action.accessibleViewGoToSymbol", + "editor.action.accessibilityHelp", + "editor.action.accessibleView", + "editor.action.accessibleViewDisableHint", + "editor.action.accessibilityHelpConfigureUnassignedKeybindings", + "editor.action.accessibilityHelpConfigureAssignedKeybindings", + "editor.action.accessibilityHelpOpenHelpLink", + "editor.action.accessibleViewAcceptInlineCompletionAction" + ], + "vs/workbench/contrib/accessibilitySignals/browser/commands": [ + "accessibility.sound.help.description", + "sounds.help.settings", + "sounds.help.placeholder", + "accessibility.announcement.help.description", + "announcement.help.settings", + "announcement.help.placeholder", + "announcement.help.placeholder.disabled", + "signals.sound.help", + "accessibility.announcement.help" + ], + "vs/workbench/contrib/accessibilitySignals/browser/openDiffEditorAnnouncement": [ + "openDiffEditorAnnouncement" + ], + "vs/workbench/contrib/authentication/browser/actions/manageAccountPreferencesForExtensionAction": [ + "selectExtension", + "pickAProviderTitle", + "noAccountUsage", + "selectProvider", + "pickAProviderTitle", + "use new account", + "placeholder v2", + "title", + "currentAccount", + "noAccounts", + "manageAccountPreferenceForExtension", + "accounts" + ], + "vs/workbench/contrib/authentication/browser/actions/manageAccountPreferencesForMcpServerAction": [ + "noAccountUsage", + "selectProvider", + "pickAProviderTitle", + "use new account", + "placeholder v2", + "title", + "currentAccount", + "noAccounts", + "manageAccountPreferenceForMcpServer", + "accounts" + ], + "vs/workbench/contrib/authentication/browser/actions/manageAccountsAction": [ + "pickAccount", + "noActiveAccounts", + "manageAccount", + "selectAction", + "manageTrustedExtensions", + "manageTrustedMCPServers", + "signOut", + "manageAccounts", + "accounts" + ], + "vs/workbench/contrib/authentication/browser/actions/manageDynamicAuthenticationProvidersAction": [ + "noDynamicProviders", + "noDynamicProvidersDetail", + "clientId", + "selectProviderToRemove", + "confirmDeleteSingleProvider", + "confirmDeleteMultipleProviders", + "confirmDeleteDetail", + "remove", + "removeDynamicAuthProviders", + "authenticationCategory" + ], + "vs/workbench/contrib/authentication/browser/actions/manageTrustedExtensionsForAccountAction": [ + "viewExtensionDetails", + "accountPreferences", + "pickAccount", + "noTrustedExtensions", + "trustedExtensions", + { + "key": "accountLastUsedDate", + "comment": [ + "The placeholder {0} is a string with time information, such as \"3 days ago\"" + ] + }, + "notUsed", + "trustedExtensionTooltip", + "manageTrustedExtensions.cancel", + "manageTrustedExtensions", + "manageExtensions", + "manageTrustedExtensionsForAccount", + "accounts" + ], + "vs/workbench/contrib/authentication/browser/actions/manageTrustedMcpServersForAccountAction": [ + "pickAccount", + "noTrustedMcpServers", + "trustedMcpServers", + { + "key": "accountLastUsedDate", + "comment": [ + "The placeholder {0} is a string with time information, such as \"3 days ago\"" + ] + }, + "notUsed", + "trustedMcpServerTooltip", + "accountPreferences", + "manageTrustedMcpServers.cancel", + "manageTrustedMcpServers", + "manageMcpServers", + "manageTrustedMcpServersForAccount", + "accounts" + ], + "vs/workbench/contrib/authentication/browser/actions/signOutOfAccountAction": [ + "signOutOfAccount", + "signOutMessage", + "signOutMessageSimple", + { + "key": "signOut", + "comment": [ + "&& denotes a mnemonic" + ] + } + ], + "vs/workbench/contrib/authentication/browser/authentication.contribution": [ + "authenticationlabel", + "authenticationid", + "authenticationMcpAuthorizationServers", + "authentication" + ], + "vs/workbench/contrib/bulkEdit/browser/bulkEditService": [ + "summary.0", + "summary.nm", + "summary.n0", + "summary.textFiles", + "workspaceEdit", + "workspaceEdit", + "nothing", + "closeTheWindow.message", + "changeWorkspace.message", + "reloadTheWindow.message", + "quitMessageMac", + "quitMessage", + "areYouSureQuiteBulkEdit.detail", + "fileOperation", + "refactoring.autoSave" + ], + "vs/workbench/contrib/bulkEdit/browser/preview/bulkEdit.contribution": [ + "overlap", + "detail", + { + "key": "continue", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "refactorPreviewViewIcon", + "apply", + "cat", + "Discard", + "cat", + "toogleSelection", + "cat", + "groupByFile", + "cat", + "groupByType", + "cat", + "groupByType", + "cat", + "panel", + "panel" + ], + "vs/workbench/contrib/bulkEdit/browser/preview/bulkEditPane": [ + "ok", + "cancel", + "empty.msg", + "conflict.1", + "conflict.N" + ], + "vs/workbench/contrib/bulkEdit/browser/preview/bulkEditPreview": [ + "default" + ], + "vs/workbench/contrib/bulkEdit/browser/preview/bulkEditTree": [ + "bulkEdit", + "aria.renameAndEdit", + "aria.createAndEdit", + "aria.deleteAndEdit", + "aria.editOnly", + "aria.rename", + "aria.create", + "aria.delete", + "aria.replace", + "aria.del", + "aria.insert", + "rename.label", + "detail.rename", + "detail.create", + "detail.del", + "title" + ], + "vs/workbench/contrib/callHierarchy/browser/callHierarchy.contribution": [ + "editorHasCallHierarchyProvider", + "callHierarchyVisible", + "callHierarchyDirection", + "no.item", + "error", + "showIncomingCallsIcons", + "showOutgoingCallsIcon", + "close", + "title", + "title.incoming", + "title.outgoing", + "title.refocus" + ], + "vs/workbench/contrib/callHierarchy/browser/callHierarchyPeek": [ + "callFrom", + "callsTo", + "title.loading", + "empt.callsFrom", + "empt.callsTo" + ], + "vs/workbench/contrib/callHierarchy/browser/callHierarchyTree": [ + "tree.aria", + "from", + "to" + ], + "vs/workbench/contrib/chat/browser/accessibility/chatAccessibilityProvider": [ + "toolPostApprovalTitle", + "toolInvocationsHintKb", + "toolInvocationsHint", + "toolInvocationsHintDetails", + "chat", + "singleTableHint", + "multiTableHint", + "singleFileTreeHint", + "multiFileTreeHint", + "noCodeBlocksHint", + "noCodeBlocks", + "singleCodeBlockHint", + "singleCodeBlock", + "multiCodeBlockHint", + "multiCodeBlock" + ], + "vs/workbench/contrib/chat/browser/accessibility/chatAccessibilityService": [ + "chat.backgroundRequest", + "chatTitle", + "chat.untitledChat", + "notificationDetail" + ], + "vs/workbench/contrib/chat/browser/accessibility/chatResponseAccessibleView": [ + "toolPostApprovalA11yView" + ], + "vs/workbench/contrib/chat/browser/actions/chatAccessibilityActions": [ + "focusChatConfirmation", + "chat.category", + "noChatSession", + "chatNotReady", + "noConfirmationRequired" + ], + "vs/workbench/contrib/chat/browser/actions/chatAccessibilityHelp": [ + "chat.overview", + "chat.differenceQuick", + "chat.differencePanel", + "workbench.action.chat.newChat", + "workbench.action.chat.history", + "workbench.action.chat.focusAgentSessionsViewer", + "chat.requestHistory", + "chat.attachments.removal", + "chat.inspectResponse", + "workbench.action.chat.focus", + "workbench.action.chat.focusLastFocusedItem", + "workbench.action.chat.focusInput", + "chat.progressVerbosity", + "chat.announcement", + "workbench.action.chat.nextCodeBlock", + "workbench.action.chat.nextUserPrompt", + "workbench.action.chat.previousUserPrompt", + "workbench.action.chat.announceConfirmation", + "chat.showHiddenTerminals", + "chat.focusMostRecentTerminal", + "chat.focusMostRecentTerminalOutput", + "chatAgent.overview", + "chatEditing.overview", + "chatEditing.format", + "chatEditing.expectation", + "chatEditing.review", + "chatEditing.sections", + "chatEditing.acceptHunk", + "chatEditing.undoKeepSounds", + "chatAgent.userActionRequired", + "chatAgent.runCommand", + "chatAgent.autoApprove", + "chatAgent.acceptTool", + "chatAgent.openEditedFilesSetting", + "chatEditing.helpfulCommands", + "workbench.action.chat.undoEdits", + "workbench.action.chat.editing.attachFiles", + "chatEditing.removeFileFromWorkingSet", + "chatEditing.acceptFile", + "chatEditing.saveAllFiles", + "chatEditing.acceptAllFiles", + "chatEditing.discardAllFiles", + "chatEditing.openFileInDiff", + "inlineChat.overview", + "inlineChat.access", + "inlineChat.requestHistory", + "inlineChat.inspectResponse", + "inlineChat.contextActions", + "inlineChat.fix", + "inlineChat.diff", + "inlineChat.toolbar", + "chat.signals" + ], + "vs/workbench/contrib/chat/browser/actions/chatActions": [ + "upgradeChat", + "chatQuotaExceeded", + "completionsQuotaExceeded", + "chatAndCompletionsQuotaExceeded", + "quotaResetDate", + "upgradeToPro", + "copilotQuotaReached", + "dismiss", + "upgradePro", + "upgradePlan", + "resetTrustedToolsSuccess", + "openChatFeatureSettings.short", + "title4", + "title4", + "toggle.chatControl", + "toggle.chatControlsDescription", + "more", + "openChat", + "toggleChat", + "signInToChatSetup", + "chatQuotaExceededButton", + "switchMode.confirmPhrase", + "agent.newSession", + "agent.newSessionMessage", + "agent.newSession.confirm", + "generateCode", + "chat.category", + "openChat", + "openChatMode", + "toggleChat", + "interactiveSession.open", + "interactiveSession.newChatWindow", + "interactiveSession.clearHistory.label", + "actions.interactiveSession.focus", + "actions.interactiveSession.focusLastFocused", + "interactiveSession.focusInput.label", + "manageChat", + "showCopilotUsageExtensions", + "configureCompletions", + "resetTrustedTools", + "generateInstructions", + "generateInstructions.short", + "openChatFeatureSettings", + "config.label", + "chat.toggleDefaultVisibility.label", + "chat.editToolApproval.label", + "chat.editToolApproval.description", + "chat.toggleChatViewTitle.label", + "chat.toggleChatViewWelcome.label" + ], + "vs/workbench/contrib/chat/browser/actions/chatAgentRecommendationActions": [ + "chat.installRecommendation" + ], + "vs/workbench/contrib/chat/browser/actions/chatCodeblockActions": [ + "interactive.applyInEditorWithURL.label", + "interactive.copyCodeBlock.label", + "interactive.applyInEditor.label", + "interactive.insertCodeBlock.label", + "interactive.insertIntoNewFile.label", + "interactive.runInTerminal.label", + "interactive.nextCodeBlock.label", + "interactive.previousCodeBlock.label", + "interactive.compare.apply", + "interactive.compare.discard" + ], + "vs/workbench/contrib/chat/browser/actions/chatContext": [ + "chatContext.tools", + "chatContext.tools.placeholder", + "chatContext.editors", + "chatContext.relatedFiles", + "relatedFiles", + "imageFromClipboard", + "pastedImage", + "pastedImage", + "terminal", + "chatContext.attachScreenshot.labelElectron.Window", + "chatContext.attachScreenshot.labelWeb" + ], + "vs/workbench/contrib/chat/browser/actions/chatContextActions": [ + "chatContext.attach.placeholder", + "goBack", + "workbench.action.chat.attachFile.label", + "workbench.action.chat.attachFolder.label", + "workbench.action.chat.attachSelection.label", + "chat.insertSearchResults", + "workbench.action.chat.attachContext.label.2" + ], + "vs/workbench/contrib/chat/browser/actions/chatContinueInAction": [ + "continueChatInSession", + "chat.learnMore", + "chat.learnMore", + "continueSessionIn", + "continueIn", + "continueSessionIn", + "continueIn", + "continueInEllipsis", + "continueChatInSession" + ], + "vs/workbench/contrib/chat/browser/actions/chatCopyActions": [ + "interactive.copyAll.label", + "interactive.copyItem.label", + "chat.copyKatexMathSource.label" + ], + "vs/workbench/contrib/chat/browser/actions/chatDeveloperActions": [ + "workbench.action.chat.logInputHistory.label", + "workbench.action.chat.logChatIndex.label", + "workbench.action.chat.inspectChatModel.label" + ], + "vs/workbench/contrib/chat/browser/actions/chatElicitationActions": [ + "chat.acceptElicitation" + ], + "vs/workbench/contrib/chat/browser/actions/chatExecuteActions": [ + "chat.removeLast.confirmation.message2", + "chat.removeLast.confirmation.multipleEdits.message", + "chat.remove.confirmation.message2", + "chat.remove.confirmation.multipleEdits.message", + "chat.removeLast.confirmation.title", + "chat.remove.confirmation.title", + "chat.remove.confirmation.primaryButton", + "chat.remove.confirmation.checkbox", + "sendToAgent", + "setChatMode", + "interactive.submit.label", + "chat.newChat.label", + "interactive.submit.panel.label", + "interactive.toggleAgent.label", + "interactive.switchToNextModel.label", + "interactive.openModelPicker.label", + "interactive.openModePicker.label", + "interactive.openChatSessionPrimaryPicker.label", + "interactive.changeModel.label", + "edits.submit.label", + "chat.newChat.label", + "interactive.submitWithoutDispatch.label", + "actions.chat.submitWithCodebase", + "chat.newChat.label", + "interactive.cancel.label", + "interactive.cancelEdit.label" + ], + "vs/workbench/contrib/chat/browser/actions/chatFileTreeActions": [ + "interactive.nextFileTree.label", + "interactive.previousFileTree.label" + ], + "vs/workbench/contrib/chat/browser/actions/chatImportExport": [ + "chat.file.label", + "chat.export.label", + "chat.import.label" + ], + "vs/workbench/contrib/chat/browser/actions/chatLanguageModelActions": [ + "noLanguageModels", + "noLanguageModelsDetail", + "extensionOwner", + "openExtension", + "trustedExtension", + "openExtension", + "noAllowedExtensions", + "noAccessDescription", + "languageModelAuthTitle", + "languageModelAuthPlaceholder", + "manageLanguageModelAuthentication" + ], + "vs/workbench/contrib/chat/browser/actions/chatMoveActions": [ + "interactiveSession.openInSecondarySidebar.label", + "interactiveSession.openInPrimarySidebar.label", + "interactiveSession.openInPanel.label", + "chat.openInEditor.label", + "chat.openInNewWindow.label", + "interactiveSession.openInSidebar.label" + ], + "vs/workbench/contrib/chat/browser/actions/chatNewActions": [ + "chat.newEdits.label", + "chat.newChat.label", + "chat.newEdits.label", + "chat.goBack", + "chat.undoEdit.label", + "chat.redoEdit.label", + "chat.redoEdit.label2", + "chat.redoEdit.tooltip" + ], + "vs/workbench/contrib/chat/browser/actions/chatPromptNavigationActions": [ + "interactive.nextUserPrompt.label", + "interactive.previousUserPrompt.label" + ], + "vs/workbench/contrib/chat/browser/actions/chatQuickInputActions": [ + "toggle.desc", + "toggle.query", + "toggle.isPartialQuery", + "toggle.query", + "chat.openInChatView.label", + "chat.closeQuickChat.label", + "quickChat", + "interactiveSession.open" + ], + "vs/workbench/contrib/chat/browser/actions/chatTitleActions": [ + "chat.retryLast.confirmation.title2", + "chat.retry.confirmation.message2", + "chat.retryLast.confirmation.message2", + "chat.retry.confirmation.primaryButton", + "chat.retry.confirmation.checkbox", + "interactive.helpful.label", + "interactive.unhelpful.label", + "interactive.reportIssueForBug.label", + "chat.retry.label", + "interactive.insertIntoNotebook.label" + ], + "vs/workbench/contrib/chat/browser/actions/chatToolActions": [ + "label", + "chat.tools.placeholder.session", + "chat.tools.description.session", + "chat.tools.placeholder.agent", + "chat.tools.description.agent", + "chat.tools.placeholder.readOnlyAgent", + "chat.tools.description.readOnlyAgent", + "chat.tools.placeholder.global", + "chat.tools.description.global", + "chatTools.tooManyEnabled", + "chat.accept", + "chat.skip" + ], + "vs/workbench/contrib/chat/browser/actions/chatToolPicker": [ + "editUserBucket", + "configMcpCol", + "configMcpCol", + "mcpShowOutput", + "mcpUpdate", + "defaultBucketLabel", + "userBucket", + "noTools", + "toolLimitExceeded", + "addMcpServer", + "addExtensionButton", + "configToolSets", + "configureTools" + ], + "vs/workbench/contrib/chat/browser/actions/codeBlockOperations": [ + "insertCodeBlock.noActiveEditor", + "insertCodeBlock.readonlyNotebook", + "insertCodeBlock.readonly", + "applyCodeBlock.errorOpeningFile", + "applyCodeBlock.noActiveEditor", + "activeEditor", + "newUntitledFile", + "createFile", + "selectOption", + "applyCodeBlock.fileWriteError", + "applyCodeBlock.readonlyNotebook", + "applyCodeBlock.noCodeMapper", + "applyCodeBlock.progress", + "applyCodeBlock.error", + "applyCodeBlock.readonly", + "applyCodeBlock.noCodeMapper", + "applyCodeBlock.progress", + "applyCodeBlock.error" + ], + "vs/workbench/contrib/chat/browser/agentSessions/agentSessions.contribution": [ + "agentSessionsQuickAccessPlaceholder", + "agentSessionsQuickAccessHelp", + "filterAgentSessions" + ], + "vs/workbench/contrib/chat/browser/agentSessions/agentSessions": [ + "chat.session.providerLabel.local", + "chat.session.providerLabel.background", + "chat.session.providerLabel.cloud", + "agentSessionReadIndicatorForeground", + "agentSessionSelectedBadgeBorder", + "agentSessionSelectedUnfocusedBadgeBorder" + ], + "vs/workbench/contrib/chat/browser/agentSessions/agentSessionsActions": [ + "archiveAllSessions.confirmSingle", + "archiveAllSessions.confirm", + "archiveAllSessions.detail", + "archiveAllSessions.archive", + "archiveSectionSessions.confirmSingle", + "archiveSectionSessions.confirm", + "archiveSectionSessions.detail", + "archiveSectionSessions.archive", + "archiveSession", + "archiveSessionDescription", + "newChatTitle", + "deleteSession.confirm", + "deleteSession.detail", + "deleteSession.delete", + "deleteAllChats.confirmSingle", + "deleteAllChats.confirm", + "deleteAllChats.detail", + "deleteAllChats.button", + "chat.toggleChatViewSessions.label", + "chat.sessionsOrientation", + "chat.sessionsOrientation.stacked", + "chat.sessionsOrientation.sideBySide", + "agentSessions.open", + "archiveAll.label", + "archiveSection", + "markUnread", + "markRead", + "archive", + "unarchive", + "rename", + "delete", + "agentSessions.deleteAll", + "chat.openSessionInEditorGroup.label", + "chat.openSessionInNewEditorGroup.label", + "chat.openSessionInNewWindow.label", + "refresh", + "find", + "showAgentSessionsSidebar", + "hideAgentSessionsSidebar", + "toggleAgentSessionsSidebar", + "chat.focusAgentSessionsViewer.label" + ], + "vs/workbench/contrib/chat/browser/agentSessions/agentSessionsFilter": [ + "agentSessionStatus.completed", + "agentSessionStatus.inProgress", + "agentSessionStatus.needsInput", + "agentSessionStatus.failed", + "agentSessions.filter.archived", + "agentSessions.filter.read", + "agentSessions.filter.reset" + ], + "vs/workbench/contrib/chat/browser/agentSessions/agentSessionsPicker": [ + "archiveSession", + "unarchiveSession", + "renameSession", + "deleteSession", + "chatAgentPickerPlaceholder" + ], + "vs/workbench/contrib/chat/browser/agentSessions/agentSessionsQuickAccess": [ + "noAgentSessionResults" + ], + "vs/workbench/contrib/chat/browser/agentSessions/agentSessionsViewer": [ + "diffFile", + "diffFiles", + "chat.session.status.inProgress", + "chat.session.status.needsInput", + "chat.session.status.failedAfter", + "chat.session.status.completedAfter", + "chat.session.status.failed", + "chat.session.status.completed", + "tooltip.file", + "tooltip.files", + "tooltip.archived", + "agentSessionNeedsInput", + "agentSessionInProgress", + "agentSessionFailed", + "agentSessionCompleted", + "agentSessions", + "agentSessionSectionAriaLabel", + "agentSessionItemAriaLabel", + "agentSessions.inProgressSection", + "agentSessions.todaySection", + "agentSessions.yesterdaySection", + "agentSessions.weekSection", + "agentSessions.olderSection", + "agentSessions.archivedSection", + "agentSessions.dragLabel" + ], + "vs/workbench/contrib/chat/browser/attachments/chatAttachmentResolveService": [ + "imageTooLarge", + "imageTooLargeMessage" + ], + "vs/workbench/contrib/chat/browser/attachments/chatAttachmentWidgets": [ + "chat.attachment.clearButton", + "chat.fileAttachmentWithRange", + "chat.fileAttachment", + "chat.omittedFileAttachment", + "chat.fileAttachmentHover", + "chat.terminalCommand", + "chat.terminalCommandHoverCommandTitleExit", + "chat.terminalCommandHoverCommandTitle", + "chat.terminalCommandHoverOutputTitle", + "chat.omittedImageAttachment", + "chat.partiallyOmittedImageAttachment", + "chat.imageAttachment", + "chat.imageAttachmentHover", + "chat.imageAttachmentWarning", + "chat.attachment", + "chat.attachment", + "chat.promptAttachment", + "chat.instructionsAttachment", + "prompt", + "instructions", + "instructions.label", + "chat.attachment", + "toolset", + "tool", + "chat.NotebookImageAttachment", + "chat.omittedNotebookImageAttachment", + "chat.partiallyOmittedNotebookImageAttachment", + "chat.elementAttachment", + "chat.clickToViewContents", + "chat.attachment", + "chat.attachment", + "chat.attachment", + "resource" + ], + "vs/workbench/contrib/chat/browser/attachments/chatInputRelatedFilesContrib": [ + "relatedFile" + ], + "vs/workbench/contrib/chat/browser/attachments/chatScreenshotContext": [ + "screenshot" + ], + "vs/workbench/contrib/chat/browser/attachments/implicitContextAttachment": [ + "cell.lowercase", + "file.lowercase", + "disable", + "pinSelection", + "disable", + "enable", + "openFile", + "cell.lowercase", + "file.lowercase", + "chat.fileAttachmentWithRange", + "chat.fileAttachment", + "openEditor", + "enableHint" + ], + "vs/workbench/contrib/chat/browser/attachments/simpleBrowserEditorOverlay": [ + "elementSelectionMessage", + "selectElementDropdown", + "continuousSelectionDropdown", + "elementSelectionInProgress", + "finishSelectionLabel", + "elementSelectionComplete", + "selectAnElement", + "startSelection", + "cancelSelection", + "cancelSelectionLabel", + "chat.configureElements", + "chat.hideOverlay", + "chat.nextSelection", + "chat.expandOverlay", + "elementSelectionInProgress", + "elementSelectionComplete", + "elementCancelMessage", + "connectingWebviewElement", + "reopenErrorWebviewElement" + ], + "vs/workbench/contrib/chat/browser/chat.contribution": [ + "interactiveSessionConfigurationTitle", + "chat.fontSize", + "chat.fontFamily", + "interactiveSession.editor.fontSize", + "interactiveSession.editor.fontFamily", + "interactiveSession.editor.fontWeight", + "interactiveSession.editor.wordWrap", + "interactiveSession.editor.lineHeight", + "chat.commandCenter.enabled", + "chat.implicitContext.enabled.1", + "chat.implicitContext.value", + "chat.implicitContext.value.never", + "chat.implicitContext.value.first", + "chat.implicitContext.value.always", + "chat.implicitContext.suggestedContext", + "chat.editing.autoAcceptDelay", + "chat.editing.confirmEditRequestRemoval", + "chat.editing.confirmEditRequestRetry", + "chat.experimental.detectParticipant.enabled.deprecated", + "chat.experimental.detectParticipant.enabled", + "chat.detectParticipant.enabled", + "chat.renderRelatedFiles", + "chat.notifyWindowOnConfirmation", + "autoApprove2.description", + "chat.tools.autoApprove.edits", + "chat.tools.fetchPage.approvedUrls", + "chat.tools.eligibleForAutoApproval", + "chat.tools.eligibleForAutoApproval", + "chat.suspendThrottling", + "chat.sendElementsToChat.enabled", + "chat.sendElementsToChat.attachCSS", + "chat.sendElementsToChat.attachImages", + "chat.undoRequests.restoreInput", + "chat.editRequests", + "chat.welcome.enabled", + "chat.viewSessions.enabled", + "chat.viewSessions.orientation.stacked", + "chat.viewSessions.orientation.sideBySide", + "chat.viewSessions.orientation", + "chat.viewTitle.enabled", + "chat.notifyWindowOnResponseReceived", + "chat.checkpoints.enabled", + "chat.checkpoints.showFileChanges", + "chat.mcp.access", + "chat.mcp.access.none", + "chat.mcp.access.registry", + "chat.mcp.access.any", + "chat.mcp.access", + "chat.mcp.access.none", + "chat.mcp.access.registry", + "chat.mcp.access.any", + "chat.mcp.autostart", + "chat.mcp.autostart.never", + "chat.mcp.autostart.onlyNew", + "chat.mcp.autostart.newAndOutdated", + "chat.mcp.serverSampling", + "mcp.list", + "chat.mcp.serverSampling.allowedDuringChat", + "chat.mcp.serverSampling.allowedOutsideChat", + "chat.mcp.serverSampling.model", + "chat.mcp.assisted.nuget.enabled.description", + "chat.edits2Enabled", + "chat.extensionToolsEnabled", + "chat.extensionToolsEnabled", + "chat.agent.enabled.description", + "chat.agent.enabled.description", + "chat.mathEnabled.description", + "chat.codeBlock.showProgressAnimation.description", + "chat.statusWidget.sku.free", + "chat.statusWidget.sku.anonymous", + "chat.statusWidget.enabled.description", + "mcp.discovery.enabled", + "chat.mcp.gallery.enabled", + "mcp.gallery.serviceUrl", + "mcp.gallery.serviceUrl", + "chat.instructions.config.locations.title", + "chat.instructions.config.locations.description", + "chat.reusablePrompts.config.locations.title", + "chat.reusablePrompts.config.locations.description", + "chat.mode.config.locations.title", + "chat.mode.config.locations.description", + "chat.mode.config.locations.deprecated", + "chat.useAgentMd.title", + "chat.useAgentMd.description", + "chat.useNestedAgentMd.title", + "chat.useNestedAgentMd.description", + "chat.useAgentSkills.title", + "chat.useAgentSkills.description", + "chat.promptFilesRecommendations.title", + "chat.promptFilesRecommendations.description", + "chat.tools.todos.showWidget", + "chat.todoListTool.writeOnly", + "chat.todoListTool.descriptionField", + "chat.agent.thinkingMode.collapsed", + "chat.agent.thinkingMode.collapsedPreview", + "chat.agent.thinkingMode.fixedScrolling", + "chat.agent.thinkingStyle", + "chat.agent.thinking.generateTitles", + "chat.agent.thinking.collapsedTools.off", + "chat.agent.thinking.collapsedTools.withThinking", + "chat.agent.thinking.collapsedTools.always", + "chat.agent.thinking.collapsedTools", + "chat.disableAIFeatures", + "chat.allowAnonymousAccess", + "chat.restoreLastPanelSession", + "chat.exitAfterDelegation", + "chat.extensionUnification.enabled", + "chat.subagentTool.customAgents", + "chat", + "chat", + "interactiveSessionConfigurationTitle", + "chat.agent.maxRequests", + "chat.toolReferenceName.description", + "clear" + ], + "vs/workbench/contrib/chat/browser/chatEditing/chatEditingActions": [ + "accept", + "acceptAllEdits", + "discard", + "discardAllEdits", + "chat.editing.discardAll.confirmation.title", + "chat.editing.discardAll.confirmation.oneFile", + "chat.editing.discardAll.confirmation.manyFiles", + "chat.editing.discardAll.confirmation.primaryButton", + "chatEditing.viewChanges", + "chatEditing.allChanges.title", + "chat.removeLast.confirmation.message2", + "chat.removeLast.confirmation.multipleEdits.message", + "chat.remove.confirmation.message2", + "chat.remove.confirmation.multipleEdits.message", + "chat.removeLast.confirmation.title", + "chat.remove.confirmation.title", + "chat.remove.confirmation.primaryButton", + "chat.remove.confirmation.checkbox", + "chat.openFileUpdatedBySnapshot.label", + "chat.openSnapshot.label", + "chatEditing.snapshot", + "chatEditing.viewPreviousEdits", + "open.fileInDiff", + "accept.file", + "discard.file", + "chatEditing.viewAllSessionChanges", + "chat.undoEdits.label", + "chat.restoreCheckpoint.label", + "chat.restoreCheckpoint.tooltip", + "chat.restoreLastCheckpoint.label", + "chat.editRequests.label", + "addFilesFromReferences" + ], + "vs/workbench/contrib/chat/browser/chatEditing/chatEditingCodeEditorIntegration": [ + "diff.generic" + ], + "vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorActions": [ + "accept4", + "discard4", + "label", + "next", + "prev", + "accept", + "discard", + "accept2", + "discard2", + "accept3", + "discard3", + "acceptHunk", + "undo", + "acceptHunkShort", + "undoShort", + "diff", + "accessibleDiff", + "review", + "acceptAllEdits", + "acceptAllEditsTooltip" + ], + "vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorContextKeys": [ + "chat.ctxEditSessionIsGlobal", + "chat.hasEditorModifications", + "chat.isCurrentlyBeingModified", + "chat.ctxReviewModeEnabled", + "chat.ctxHasRequestInProgress", + "chatEdits.requestCount", + "chat.ctxCursorInChangeRange" + ], + "vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorOverlay": [ + "working", + "working", + "nOfM", + "0Of0", + "tooltip_11", + "tooltip_1n", + "tooltip_n1", + "tooltip_nm", + "tooltip_busy", + "tooltip" + ], + "vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedDocumentEntry": [ + "default", + "chatEditing1", + "chatEditing2" + ], + "vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedFileEntry": [ + "editorSelectionBackground" + ], + "vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedNotebookEntry": [ + "chatNotebookEdit1", + "chatNotebookEdit2" + ], + "vs/workbench/contrib/chat/browser/chatEditing/chatEditingServiceImpl": [ + "join.chatEditingSession", + "chat", + "chatEditing.modified2" + ], + "vs/workbench/contrib/chat/browser/chatEditing/chatEditingSession": [ + "multiDiffEditorInput.name" + ], + "vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingNotebookEditorIntegration": [ + "diff.generic" + ], + "vs/workbench/contrib/chat/browser/chatManagement/chatManagement.contribution": [ + "chatManagementEditor", + "modelsManagementEditor", + "openAiManagement", + "models.clearResults" + ], + "vs/workbench/contrib/chat/browser/chatManagement/chatManagementEditor": [ + "chatManagementSashBorder", + "plan.usage", + "plan.models", + "sectionsListAriaLabel", + "plan.copilot", + "plan.free", + "plan.upgradeToProPlus", + "plan.upgradeToPro", + "upgradeToCopilotPro", + "enableAIFeatures", + "enableMoreAIFeatures", + "enableCopilotButton", + "signInToUseAIFeatures", + "plan.proName", + "plan.proPlusName", + "plan.businessName", + "plan.enterpriseName", + "plan.freeName" + ], + "vs/workbench/contrib/chat/browser/chatManagement/chatManagementEditorInput": [ + "aiManagementEditorLabelIcon", + "modelsManagementEditorLabelIcon", + "aiManagementEditorInputName", + "modelsManagementEditorInputName" + ], + "vs/workbench/contrib/chat/browser/chatManagement/chatModelsViewModel": [ + "visible", + "hidden" + ], + "vs/workbench/contrib/chat/browser/chatManagement/chatModelsWidget": [ + "models.cost", + "models.contextSize", + "models.input", + "models.output", + "models.capabilities", + "models.toolCalling", + "models.vision", + "models.agentMode", + "filter", + "groupByTooltip", + "filterByProvider", + "filterByCapability", + "filterByVisible", + "filter.visible", + "filter.hidden", + "capability.tools", + "capability.vision", + "capability.agent", + "groupBy.provider", + "groupBy.visibility", + "groupBy", + "expand", + "collapse", + "models.hide", + "models.show", + "models.visible", + "models.hidden", + "models.userSelectable", + "multiplier.tooltip", + "models.contextSize", + "models.input", + "models.output", + "models.tools", + "models.vision", + "models.manageProvider", + "Search.FullTextSearchPlaceholder", + "clearSearch", + "collapseAll", + "models.enableModelProvider", + "modelName", + "provider", + "tokenLimits", + "capabilities", + "cost", + "vendor.ariaLabel", + "visible.ariaLabel", + "hidden.ariaLabel", + "model.name", + "model.contextSize", + "model.capabilities", + "multiplier.tooltip", + "model.visible", + "model.hidden", + "modelsTable.ariaLabel", + "models.manageProvider" + ], + "vs/workbench/contrib/chat/browser/chatManagement/chatUsageWidget": [ + "completionsLabel", + "chatsLabel", + "plan.inlineSuggestions", + "plan.chatMessages", + "plan.premiumRequests", + "plan.additionalPaidEnabled", + "plan.allowanceResets", + "plan.included", + "plan.included", + "quotaLimited" + ], + "vs/workbench/contrib/chat/browser/chatOutputItemRenderer": [ + "chatOutputRenderer.viewType", + "chatOutputRenderer.mimeTypes", + "vscode.extension.contributes.chatOutputRenderer" + ], + "vs/workbench/contrib/chat/browser/chatParticipant.contribution": [ + { + "key": "miToggleChat", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "vscode.extension.contributes.chatParticipant", + "chatParticipantId", + "chatParticipantName", + "chatParticipantFullName", + "chatParticipantDescription", + "chatCommandSticky", + "chatSampleRequest", + "chatParticipantWhen", + "chatParticipantDisambiguation", + "chatParticipantDisambiguationCategory", + "chatParticipantDisambiguationDescription", + "chatParticipantDisambiguationExamples", + "chatCommandsDescription", + "chatCommand", + "chatCommandDescription", + "chatCommandWhen", + "chatCommandSampleRequest", + "chatCommandSticky", + "chatCommandDisambiguation", + "chatCommandDisambiguationCategory", + "chatCommandDisambiguationDescription", + "chatCommandDisambiguationExamples", + "showExtension", + "chatFailErrorMessage", + "participantName", + "participantFullName", + "participantDescription", + "participantCommands", + "chatParticipants", + "chat.viewContainer.label", + "chat.viewContainer.label" + ], + "vs/workbench/contrib/chat/browser/chatSessions/chatSessionPickerActionItem": [ + "chat.sessionPicker.label" + ], + "vs/workbench/contrib/chat/browser/chatSessions/chatSessions.contribution": [ + "chatSessionsExtPoint", + "chatSessionsExtPoint.chatSessionType", + "chatSessionsExtPoint.name", + "chatSessionsExtPoint.displayName", + "chatSessionsExtPoint.description", + "chatSessionsExtPoint.when", + "chatSessionsExtPoint.icon", + "icon.light", + "icon.dark", + "chatSessionsExtPoint.order", + "chatSessionsExtPoint.alternativeIds", + "chatSessionsExtPoint.welcomeTitle", + "chatSessionsExtPoint.welcomeMessage", + "chatSessionsExtPoint.welcomeTips", + "chatSessionsExtPoint.inputPlaceholder", + "chatSessionsExtPoint.capabilities", + "chatSessionsExtPoint.supportsFileAttachments", + "chatSessionsExtPoint.supportsToolAttachments", + "chatSessionsExtPoint.supportsMCPAttachments", + "chatSessionsExtPoint.supportsImageAttachments", + "chatSessionsExtPoint.supportsSearchResultAttachments", + "chatSessionsExtPoint.supportsInstructionAttachments", + "chatSessionsExtPoint.supportsSourceControlAttachments", + "chatSessionsExtPoint.supportsProblemAttachments", + "chatSessionsExtPoint.supportsSymbolAttachments", + "chatCommandsDescription", + "chatCommand", + "chatCommandDescription", + "chatCommandWhen", + "chatSessionsExtPoint.canDelegate", + "chatEditorContributionName", + "chat.sessions.description.waitingForConfirmation", + "chat.sessions.description.thinking", + "interactiveSession.openSessionWithPrompt", + "interactiveSession.openNewSessionEditor", + "interactiveSession.openNewSessionSidebar" + ], + "vs/workbench/contrib/chat/browser/chatSetup/chatSetupContributions": [ + "setupErrorDialog", + "retry", + "explain", + "fix", + "review", + "generateDocs", + "generateTests", + "restartExtensionHost.reason.enable", + "restartExtensionHost.reason.disable", + "triggerChatSetup", + "forceSignIn", + "triggerChatSetupFromAccounts", + "managePlan", + "chat.category", + "manageOverages", + "chat.category", + "hideChatSetup" + ], + "vs/workbench/contrib/chat/browser/chatSetup/chatSetupController": [ + "setupChatProgress", + "unknownSignInError", + "unknownSignInErrorDetail", + "retry", + "unknownSetupError", + "retry", + "enterpriseInstance", + "enterpriseInstancePlaceholder", + "willResolveTo", + "invalidEnterpriseInstance" + ], + "vs/workbench/contrib/chat/browser/chatSetup/chatSetupProviders": [ + "setupToolDisplayName", + "setupToolsDescription", + "settingUpCopilotNeeded", + "trustNeeded", + "waitingChat", + "copilotUnavailableWarning", + "waitingChat2", + "chatTookLongWarningAnonymous", + "chatTookLongWarning", + "setupChatSignIn2", + "installingChat", + "chatSetupError", + "generate", + "modify", + "fix", + "explain", + "modify", + "generate", + "explain", + "fix", + "vscodeAgentDescription", + "workspaceAgentDescription", + "terminalAgentDescription" + ], + "vs/workbench/contrib/chat/browser/chatSetup/chatSetupRunner": [ + "chatWorkspaceTrust", + "continueWith", + "continueWith", + "continueWith", + "continueWith", + "setupAIButton", + "skipForNow", + "startUsing", + "enableMore", + "signIn", + "startUsing", + { + "key": "settingsAnonymous", + "comment": [ + "{Locked=\"[\"}", + "{Locked=\"]({1})\"}", + "{Locked=\"]({2})\"}" + ] + }, + { + "key": "settings", + "comment": [ + "{Locked=\"[\"}", + "{Locked=\"]({1})\"}", + "{Locked=\"]({2})\"}", + "{Locked=\"]({4})\"}", + "{Locked=\"]({5})\"}" + ] + } + ], + "vs/workbench/contrib/chat/browser/chatStatus/chatStatusDashboard": [ + "gaugeForeground", + "gaugeBackground", + "gaugeBorder", + "gaugeWarningForeground", + "gaugeWarningBackground", + "gaugeErrorForeground", + "gaugeErrorBackground", + "usageTitle", + "quotaLabel", + "quotaTooltip", + "completionsLabel", + "chatsLabel", + "premiumChatsLabel", + "limitQuota", + "upgradeToCopilotPro", + "anonymousTitle", + "quotaLimited", + "completionsLabel", + "quotaLimited", + "chatsLabel", + "chatAgentSessionsTitle", + "viewChatSessionsLabel", + "viewChatSessionsTooltip", + "inProgressChatSession", + "inlineSuggestions", + "settingsLabel", + "settingsTooltip", + "modelLabel", + "selectModel", + "selectModel", + "settings.snooze", + { + "key": "activeDescriptionAnonymous", + "comment": [ + "{Locked=\"]({2})\"}", + "{Locked=\"]({3})\"}" + ] + }, + "activateDescription", + "enableMoreDescription", + "enableDescription", + "signInDescription", + "enableAIFeatures", + "enableMoreAIFeatures", + "enableCopilotButton", + "signInToUseAIFeatures", + "learnMore", + "learnMore", + "enableAdditionalUsage", + "quotaUnlimited", + "quotaDisplayWithOverage", + "quotaDisplay", + "additionalUsageEnabled", + "additionalUsageDisabled", + "settings.codeCompletions.allFiles", + "settings.codeCompletions.language", + "settings.nextEditSuggestions", + "cancelSnooze", + "completions.snooze5minutesTitle", + "completions.snooze5minutes", + "completions.remainingTime", + "completions.snoozeTimeDescription", + "completions.plus5min", + "completions.snoozeAdditional5minutes", + "currentModel.description", + "selectModelFor" + ], + "vs/workbench/contrib/chat/browser/chatStatus/chatStatusEntry": [ + "chatStatusAria", + "finishSetup", + "copilotDisabledStatus", + "chatSessionsInProgressStatus", + "chatSessionInProgressStatus", + "notSignedIn", + "chatQuotaExceededStatus", + "completionsQuotaExceededStatus", + "chatAndCompletionsQuotaExceededStatus", + "completionsDisabledStatus", + "completionsSnoozedStatus", + "chatStatus" + ], + "vs/workbench/contrib/chat/browser/chatWindowNotifier": [ + "chatTitle", + "chat.untitledChat", + "notificationDetail" + ], + "vs/workbench/contrib/chat/browser/contextContrib/chatContext.contribution": [ + "chatContextExtPoint", + "chatContextExtPoint.id", + "chatContextExtPoint.icon", + "chatContextExtPoint.title" + ], + "vs/workbench/contrib/chat/browser/promptSyntax/attachInstructionsAction": [ + "commands.prompt.manage-dialog.placeholder", + "chatContext.attach.instructions.label", + "placeholder", + "configureInstructions", + "configure-instructions", + "configure-instructions.short" + ], + "vs/workbench/contrib/chat/browser/promptSyntax/chatModeActions": [ + "configure.agent.prompts.placeholder", + "managedByOrganization", + "configure-agents.short", + "managedByOrganization", + "select-agent", + "configure-agents" + ], + "vs/workbench/contrib/chat/browser/promptSyntax/newPromptFileActions": [ + "workbench.command.prompts.create.user.enable-sync-notification", + "enable.capitalized", + "learnMore.capitalized", + "commands.new.prompt.local.title", + "commands.new.instructions.local.title", + "commands.new.agent.local.title", + "commands.new.untitled.prompt.title" + ], + "vs/workbench/contrib/chat/browser/promptSyntax/pickers/askForPromptName": [ + "askForPromptFileName.error.empty", + "askForPromptFileName.error.invalid", + "askForPromptFileName.error.exists", + "askForInstructionsFileName.placeholder", + "askForPromptFileName.placeholder", + "askForAgentFileName.placeholder", + "askForRenamedInstructionsFileName.placeholder", + "askForRenamedPromptFileName.placeholder", + "askForRenamedAgentFileName.placeholder" + ], + "vs/workbench/contrib/chat/browser/promptSyntax/pickers/askForPromptSourceFolder": [ + "current.folder", + "commands.prompts.create.source-folder.current-workspace", + "workbench.command.instructions.create.location.placeholder", + "workbench.command.prompt.create.location.placeholder", + "workbench.command.agent.create.location.placeholder", + "instructions.move.location.placeholder", + "prompt.move.location.placeholder", + "agent.move.location.placeholder", + "instructions.copy.location.placeholder", + "prompt.copy.location.placeholder", + "agent.copy.location.placeholder", + "commands.prompts.create.ask-folder.empty.docs-label", + "commands.instructions.create.ask-folder.empty.docs-label", + "commands.agent.create.ask-folder.empty.docs-label", + "commands.instructions.create.ask-folder.empty.placeholder", + "commands.prompts.create.ask-folder.empty.placeholder", + "commands.agent.create.ask-folder.empty.placeholder" + ], + "vs/workbench/contrib/chat/browser/promptSyntax/pickers/promptFilePickers": [ + "help.prompt", + "help.instructions", + "help.agent", + "commands.new-promptfile.select-dialog.label", + "commands.new-instructionsfile.select-dialog.label", + "commands.update-instructions.select-dialog.label", + "commands.new-agentfile.select-dialog.label", + "open", + "delete", + "rename", + "makeACopy", + "makeVisible", + "makeInvisible", + "searching", + "separator.workspace", + "separator.workspace-agent-instructions", + "separator.extensions", + "separator.user", + "hiddenLabelInfo", + "hiddenInAgentPicker", + "commands.prompts.use.select-dialog.delete-prompt.confirm.message" + ], + "vs/workbench/contrib/chat/browser/promptSyntax/promptCodingAgentActionOverlay": [ + "runPromptWithCodingAgent", + "runWithCodingAgent.label" + ], + "vs/workbench/contrib/chat/browser/promptSyntax/promptToolsCodeLensProvider": [ + "configure-tools.capitalized.ellipsis", + "placeholder" + ], + "vs/workbench/contrib/chat/browser/promptSyntax/promptUrlHandler": [ + "failed", + "confirmOpenDetail2", + "confirmOpenDetail3", + "confirmInstallPrompt", + "confirmInstallInstructions", + "confirmInstallAgent", + { + "key": "yesButton", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "noButton" + ], + "vs/workbench/contrib/chat/browser/promptSyntax/runPromptAction": [ + "commands.prompt.select-dialog.placeholder", + "commands.prompt.manage-dialog.placeholder", + "run-prompt.capitalized", + "run-prompt.capitalized.ellipses", + "configure-prompts", + "configure-prompts.short", + "run-prompt-in-new-chat.capitalized" + ], + "vs/workbench/contrib/chat/browser/promptSyntax/saveAsPromptFileActions": [ + "promptfile.savePromptFile", + "promptfile.savePromptFile.description", + "promptfile.saveAgentFile", + "promptfile.saveAgentFile.description", + "promptfile.saveInstructionsFile", + "promptfile.saveInstructionsFile.description" + ], + "vs/workbench/contrib/chat/browser/tools/languageModelToolsConfirmationService": [ + "runWithoutApproval", + "continueWithoutReviewingResults", + "allowSession", + "allowSessionTooltip", + "allowWorkspace", + "allowWorkspaceTooltip", + "allowGlobally", + "allowGloballyTooltip", + "allowServerSession", + "allowServerSessionTooltip", + "allowServerWorkspace", + "allowServerWorkspaceTooltip", + "allowServerGlobally", + "allowServerGloballyTooltip", + "allowSessionPost", + "allowSessionPostTooltip", + "allowWorkspacePost", + "allowWorkspacePostTooltip", + "allowGloballyPost", + "allowGloballyPostTooltip", + "allowServerSessionPost", + "allowServerSessionPostTooltip", + "allowServerWorkspacePost", + "allowServerWorkspacePostTooltip", + "allowServerGloballyPost", + "allowServerGloballyPostTooltip", + "continueWithoutReviewing", + "runToolsWithoutApproval", + "workspaceScope", + "configureSessionToolApprovals", + "configureWorkspaceToolApprovals", + "configureGlobalToolApprovals" + ], + "vs/workbench/contrib/chat/browser/tools/languageModelToolsService": [ + "copilot.toolSet.vscode.description", + "copilot.toolSet.execute.description", + "copilot.toolSet.read.description", + "defaultToolConfirmation.title", + "defaultToolConfirmation.message", + "defaultToolConfirmation.disclaimer", + "defaultToolConfirmation.disclaimer", + "autoApprove2.title", + "autoApprove2.button.enable", + "autoApprove2.button.disable", + { + "key": "autoApprove2.markdown", + "comment": [ + "{Locked='](https://github.com/features/codespaces)'}", + "{Locked='](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers)'}", + "{Locked='](https://code.visualstudio.com/docs/copilot/security)'}", + "{Locked='**'}" + ] + } + ], + "vs/workbench/contrib/chat/browser/tools/toolSetsContribution": [ + "schema.default", + "toolsetSchema.json", + "schema.tools", + "schema.icon", + "schema.description", + "tool.description", + "chat.configureToolSets.short", + "chat.configureToolSets.add", + "chat.configureToolSets.placeholder", + "input.placeholder", + "bad_name1", + "bad_name2", + "chat.configureToolSets" + ], + "vs/workbench/contrib/chat/browser/viewsWelcome/chatViewsWelcomeHandler": [ + "chatViewsWelcome.icon", + "chatViewsWelcome.title", + "chatViewsWelcome.content", + "chatViewsWelcome.when", + "vscode.extension.contributes.chatViewsWelcome" + ], + "vs/workbench/contrib/chat/browser/viewsWelcome/chatViewWelcomeController": [ + "chatWidget.suggestedActions", + "suggestedPromptAriaLabelWithDescription", + "suggestedPromptAriaLabel", + "runPromptTitle", + "editPromptFile" + ], + "vs/workbench/contrib/chat/browser/widget/chatAgentHover": [ + "reservedName", + "viewExtensionLabel" + ], + "vs/workbench/contrib/chat/browser/widget/chatContentParts/chatAgentCommandContentPart": [ + "rerun" + ], + "vs/workbench/contrib/chat/browser/widget/chatContentParts/chatAnonymousRateLimitedPart": [ + "anonymousRateLimited", + "enableMoreAIFeatures" + ], + "vs/workbench/contrib/chat/browser/widget/chatContentParts/chatChangesSummaryPart": [ + "chat.viewFileChangesSummary" + ], + "vs/workbench/contrib/chat/browser/widget/chatContentParts/chatCodeCitationContentPart": [ + "viewMatches" + ], + "vs/workbench/contrib/chat/browser/widget/chatContentParts/chatCommandContentPart": [ + "commandButtonDisabled" + ], + "vs/workbench/contrib/chat/browser/widget/chatContentParts/chatConfirmationContentPart": [ + "accept", + "dismiss" + ], + "vs/workbench/contrib/chat/browser/widget/chatContentParts/chatConfirmationWidget": [ + "chat.confirmationWidget.ariaLabel" + ], + "vs/workbench/contrib/chat/browser/widget/chatContentParts/chatExtensionsContentPart": [ + "chat.extensions.loading" + ], + "vs/workbench/contrib/chat/browser/widget/chatContentParts/chatInlineAnchorWidget": [ + "chat.inlineAnchor.ariaLabel.line", + "chat.inlineAnchor.ariaLabel.range", + { + "key": "miGotoDefinition", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miGotoTypeDefinition", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miGotoImplementations", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miGotoReference", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "actions.attach.label", + "actions.copy.label", + "actions.openToSide.label", + "actions.goToDecl.label", + "goToTypeDefinitions.label", + "goToImplementations.label", + "goToReferences.label" + ], + "vs/workbench/contrib/chat/browser/widget/chatContentParts/chatMarkdownContentPart": [ + "chat.codeblock.applyingEdits", + "chat.codeblock.generating", + "chat.codeblock.applyingPercentage", + "chat.codeblock.edited", + "chat.codeblock.insertions.one", + "chat.codeblock.insertions", + "chat.codeblock.deletions.one", + "chat.codeblock.deletions", + "summary" + ], + "vs/workbench/contrib/chat/browser/widget/chatContentParts/chatMcpServersInteractionContentPart": [ + "mcp.skip.link", + "mcp.working.mcp", + "mcp.starting.servers", + "mcp.start.single", + "mcp.start.multiple", + "mcp.starting" + ], + "vs/workbench/contrib/chat/browser/widget/chatContentParts/chatMultiDiffContentPart": [ + "chatMultiDiff.oneFile", + "chatMultiDiff.manyFiles", + "chatMultiDiff.openAllChanges", + "chatMultiDiffList", + "chatEditingSession.fileCounts" + ], + "vs/workbench/contrib/chat/browser/widget/chatContentParts/chatProgressContentPart": [ + "workingMessage", + "toolCallUnresponsive" + ], + "vs/workbench/contrib/chat/browser/widget/chatContentParts/chatPullRequestContentPart": [ + "chatPullRequest.seeMore" + ], + "vs/workbench/contrib/chat/browser/widget/chatContentParts/chatQuotaExceededPart": [ + "enableAdditionalUsage", + "upgradeToCopilotPro", + "waitWarning", + "clickToContinue" + ], + "vs/workbench/contrib/chat/browser/widget/chatContentParts/chatReferencesContentPart": [ + "usedReferencesPlural", + "usedReferencesSingular", + "chatCollapsibleList", + "setting.hover", + "chatEditingSession.fileCounts", + "addToChat", + "copyLink" + ], + "vs/workbench/contrib/chat/browser/widget/chatContentParts/chatSuggestNextWidget": [ + "chat.currentMode", + "chat.proceedFrom", + "chat.suggestNext.item", + "chat.suggestNext.moreOptions", + "continueIn" + ], + "vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTextEditContentPart": [ + "edits0", + "editsSummary" + ], + "vs/workbench/contrib/chat/browser/widget/chatContentParts/chatThinkingContentPart": [ + "chat.thinking.header", + "chat.thinking.finished.withTools", + "chat.thinking.finished" + ], + "vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTodoListWidget": [ + "chat.todoList.itemWithDescription", + "chat.todoList.item", + "chat.todoList.status.completed", + "chat.todoList.status.inProgress", + "chat.todoList.status.notStarted", + "chat.todoList.title", + "chat.todoList.itemWithDescription", + "chat.todoList.item", + "chatTodoList", + "chat.todoList.clearButton.disabled", + "chat.todoList.clearButton", + "chat.todoList.collapseButton", + "chat.todoList.expandButton", + "chat.todoList.titleWithCount", + "chat.todoList.title", + "chat.todoList.currentTask", + "chat.todoList.titleWithCount", + "chat.todoList.status.completed", + "chat.todoList.status.inProgress", + "chat.todoList.status.notStarted" + ], + "vs/workbench/contrib/chat/browser/widget/chatContentParts/chatToolInputOutputContentPart": [ + "chat.input", + "chat.output" + ], + "vs/workbench/contrib/chat/browser/widget/chatContentParts/chatToolOutputContentSubPart": [ + "chat.saveResources.error", + "chat.saveResources.progress", + "chat.saveResources.reveal", + "chat.saveResources.title", + "chat.saveResources" + ], + "vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTreeContentPart": [ + "treeAriaLabel" + ], + "vs/workbench/contrib/chat/browser/widget/chatContentParts/codeBlockPart": [ + "chat.codeBlockHelp", + "chat.codeBlockLabel", + "chat.codeBlockToolbarLabel", + "vulnerabilitiesPlural", + "vulnerabilitiesSingular", + "chat.codeBlockHelp", + "original", + "modified", + "chat.codeBlock.toolbar", + "chat.compareCodeBlockLabel", + "chat.edits.1", + "chat.edits.rejected", + "chat.edits.N", + "interactive.compare.apply.confirm", + "interactive.compare.apply.confirm.detail" + ], + "vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/abstractToolConfirmationSubPart": [ + "skip" + ], + "vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatExtensionsInstallToolSubPart": [ + "allow", + "cancel", + "installExtensions", + "installExtensionsConfirmation" + ], + "vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatTerminalToolConfirmationSubPart": [ + "autoApprove.enable", + "ruleTooltip", + "newRule.session", + "newRule.session.plural", + "newRule.workspace", + "newRule.workspace.plural", + "newRule.user", + "newRule.user.plural", + "sessionApproval", + "sessionApproval.disable", + "tool.allow", + "tool.skip", + "skip.detail", + "autoApprove.title", + "autoApprove.button.enable", + "autoApprove.markdown", + "autoApprove.markdown2" + ], + "vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatTerminalToolProgressPart": [ + "terminalToolCommand", + "chatTerminalOutputAriaLabel", + "chatTerminalOutputAccessibleViewHeader", + "chat.terminalOutputEmpty", + "chatTerminalOutputUnavailable", + "chat.terminalOutputEmpty", + "chatTerminalOutputTruncated", + "chat.terminalOutputEmpty", + "chat.terminalOutputEmpty", + "chat.terminalOutputTerminalMissing", + "chat.terminalOutputCommandMissing", + "showTerminalOutput", + "hideTerminalOutput", + "showTerminalOutput", + "showTerminal", + "focusTerminal", + "showAndFocusTerminal", + "focusTerminal" + ], + "vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolConfirmationSubPart": [ + "allowReview", + "allow", + "skip.detail", + "allowSkip", + "showMore", + "chat.input", + "seeMore" + ], + "vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolOutputPart": [ + "loading", + "chat.toolOutputError" + ], + "vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolPartUtilities": [ + "chat.autoapprove.setting", + "chat.autoapprove.lmServicePerTool.session", + "chat.autoapprove.lmServicePerTool.workspace", + "chat.autoapprove.lmServicePerTool.profile", + "edit" + ], + "vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolPostExecuteConfirmationPart": [ + "allow", + "skip.post", + "approveToolResult", + "noResults", + "noDisplayableResults" + ], + "vs/workbench/contrib/chat/browser/widget/chatDragAndDrop": [ + "file", + "file", + "folder", + "image", + "symbol", + "problem", + "url", + "notebookOutput", + "scmHistoryItem", + "dragAndDroppedImageName", + "attacAsContext" + ], + "vs/workbench/contrib/chat/browser/widget/chatListRenderer": [ + "checkpointRestore", + "usedAgentSlashCommand", + "usedAgent", + "working", + "chatConfirmationAction", + "renderFailMsg", + "requestMarkdownPartTitle", + "incorrectCode", + "didNotFollowInstructions", + "missingContext", + "offensiveOrUnsafe", + "poorlyWrittenOrFormatted", + "refusedAValidRequest", + "incompleteCode", + "reportIssue", + "other" + ], + "vs/workbench/contrib/chat/browser/widget/chatWidget": [ + "chatDisclaimer", + "scrollDownButtonLabel", + { + "key": "settings", + "comment": [ + "{Locked=\"]({2})\"}", + "{Locked=\"]({3})\"}" + ] + }, + "chatWidget.instructions", + "copilotCodingAgentMessage", + "genericCodingAgentMessage", + "codingAgentTitle", + "chatDescription", + "editsTitle", + "agentTitle", + "chatWidget.suggestedPrompts.gettingStarted", + "chatWidget.suggestedPrompts.gettingStartedPrompt", + "chatWidget.suggestedPrompts.newProject", + "chatWidget.suggestedPrompts.newProjectPrompt", + "chatWidget.suggestedPrompts.buildWorkspace", + "chatWidget.suggestedPrompts.buildWorkspacePrompt", + "chatWidget.suggestedPrompts.findConfig", + "chatWidget.suggestedPrompts.findConfigPrompt", + "chatWidget.promptFile.commandLabel", + "chat.input.placeholder.lockedToAgent" + ], + "vs/workbench/contrib/chat/browser/widget/input/chatFollowups": [ + "followUpAriaLabel" + ], + "vs/workbench/contrib/chat/browser/widget/input/chatInputPart": [ + "chatInput.model", + "chatInput.mode.custom", + "chatInput.mode.agent", + "chatInput.mode.edit", + "chatInput.mode.ask", + "actions.chat.accessibiltyHelp", + "chatInput.accessibilityHelpNoKb", + "chatInput.accessibilityHelp", + "chatAttachFiles", + "chatEditingSession.toggleWorkingSet", + "chatEditingSession.oneFile.1", + "chatEditingSession.manyFiles.1", + "chatEditingSession.oneFile.2", + "chatEditingSession.manyFiles.2", + "chatEditingSession.ariaLabelWithCounts", + "chatEditingSession.allChanges", + "suggeste.title", + "chatEditingSession.addSuggestion", + "chatEditingSession.addSuggested" + ], + "vs/workbench/contrib/chat/browser/widget/input/chatStatusWidget": [ + "chat.anonymousRateLimited.message", + "chat.anonymousRateLimited.signIn", + "chat.anonymousRateLimited.signIn.ariaLabel", + "chat.freeQuotaExceeded.message", + "chat.freeQuotaExceeded.upgrade", + "chat.freeQuotaExceeded.upgrade.ariaLabel" + ], + "vs/workbench/contrib/chat/browser/widget/input/editor/chatInputCompletions": [ + "installLabel", + "mcp.prompt.error", + "mcp.prompt.resource", + "mcp.prompt.image", + "mcp.prompt.image", + "fileEntryDescription", + "activeFile", + "tool_source_completion" + ], + "vs/workbench/contrib/chat/browser/widget/input/editor/chatInputEditorHover": [ + "hoverAccessibilityChatAgent" + ], + "vs/workbench/contrib/chat/browser/widget/input/editor/chatPasteProviders": [ + "pastedImageName", + "pastedImageAttachment", + "pastedChatAttachments", + "pastedCodeAttachment", + "pastedAttachment.oneLine", + "pastedAttachment.multipleLines", + "pastedAttachment.multiple" + ], + "vs/workbench/contrib/chat/browser/widget/input/modelPickerActionItem": [ + "chat.modelPicker.auto", + "chat.modelPicker.auto", + "chat.manageModels", + "chat.manageModels.tooltip", + "chat.moreModels", + "chat.morePremiumModels", + "chat.moreModels.tooltip", + "chat.morePremiumModels.tooltip", + "chat.modelPicker.auto", + "chat.modelPicker.label", + "chat.modelPicker.auto" + ], + "vs/workbench/contrib/chat/browser/widget/input/modePickerActionItem": [ + "built-in", + "custom", + "managedByOrganization" + ], + "vs/workbench/contrib/chat/browser/widgetHosts/chatQuick": [ + { + "key": "termsDisclaimer", + "comment": [ + "{Locked=\"]({2})\"}", + "{Locked=\"]({3})\"}" + ] + } + ], + "vs/workbench/contrib/chat/browser/widgetHosts/editor/chatEditor": [ + "chatEditor.loadingSession" + ], + "vs/workbench/contrib/chat/browser/widgetHosts/editor/chatEditorInput": [ + "chatEditorLabelIcon", + "chatEditorConfirmTitle", + "chat.startEditing.confirmation.pending.message.default", + "chatEditorName", + "chat.startEditing.confirmation.pending.message.default1", + "chat.startEditing.confirmation.title", + "chat.startEditing.confirmation.pending.message.2", + "chat.startEditing.confirmation.acceptEdits", + "chat.startEditing.confirmation.discardEdits" + ], + "vs/workbench/contrib/chat/browser/widgetHosts/viewPane/chatViewPane": [ + "showAllSessions", + "showRecentSessions", + "showAllSessions", + "showRecentSessions", + "recentSessions", + "allSessions" + ], + "vs/workbench/contrib/chat/browser/widgetHosts/viewPane/chatViewTitleControl": [ + "chat", + "chat.pickAgentSession" + ], + "vs/workbench/contrib/chat/common/actions/chatContextKeys": [ + "interactiveSessionResponseVote", + "chatSessionResponseDetectedAgentOrCommand", + "chatResponseSupportsIssueReporting", + "chatResponseFiltered", + "chatResponseErrored", + "interactiveSessionRequestInProgress", + "interactiveSessionCurrentlyEditing", + "interactiveSessionCurrentlyEditingInput", + "chatResponse", + "chatRequest", + "chatItemId", + "chatLastItemId", + "chatEditApplied", + "interactiveInputHasText", + "interactiveInputHasFocus", + "inInteractiveInput", + "inChat", + "inChatEditor", + "inChatTerminalToolOutput", + "agentKind", + "chatToolCount", + "chatToolGroupingThreshold", + "chatIsEnabled", + "lockedToCodingAgent", + "agentSupportsAttachments", + "withinEditSessionDiff", + "filePartOfEditSession", + "chatPanelExtensionParticipantRegistered", + "chatParticipantRegistered", + "chatEditingCanUndo", + "chatEditingCanRedo", + "chatModelsAreUserSelectable", + "chatSessionHasModels", + "chatExtensionInvalid", + "inQuickChat", + "chatHasFileAttachments", + "chatSessionIsEmpty", + "chatRemoteJobCreating", + "hasRemoteCodingAgent", + "chatHasCanDelegateProviders", + "enableRemoteCodingAgentPromptFileOverlay", + "chatSkipRequestInProgressMessage", + "chatEditingHasToolConfirmation", + "chatEditingHasElicitationRequest", + "toolsCount", + "chatHasAgents", + "chatAgentModeDisabledByPolicy", + "chatPanelLocation", + "agentSessionsViewerFocused", + "agentSessionsViewerLimited", + "agentSessionsViewerOrientation", + "agentSessionsViewerPosition", + "agentSessionsViewerVisible", + "agentSessionType", + "agentSessionSection", + "agentSessionIsArchived", + "agentSessionIsRead", + "agentSessionHasChanges", + "chatIsKatexMathElement" + ], + "vs/workbench/contrib/chat/common/attachments/chatVariableEntries": [ + "chat.attachment.problems.all", + "chat.attachment.problems.inFile" + ], + "vs/workbench/contrib/chat/common/chatModes": [ + "chatDescription", + "editsDescription", + "agentDescription" + ], + "vs/workbench/contrib/chat/common/chatService/chatServiceImpl": [ + "newChat", + "emptyResponse" + ], + "vs/workbench/contrib/chat/common/editing/chatEditingService": [ + "chatMultidiff.autoGenerated", + "chatEditingWidgetFileState", + "chatEditingAgentSupportsReadonlyReferences" + ], + "vs/workbench/contrib/chat/common/languageModels": [ + "vscode.extension.contributes.languageModels.vendor", + "vscode.extension.contributes.languageModels.displayName", + "vscode.extension.contributes.languageModels.managementCommand", + "vscode.extension.contributes.languageModels.when", + "vscode.extension.contributes.languageModelChatProviders", + "vscode.extension.contributes.languageModels.vendorAlreadyRegistered", + "vscode.extension.contributes.languageModels.emptyVendor", + "vscode.extension.contributes.languageModels.whitespaceVendor" + ], + "vs/workbench/contrib/chat/common/languageModelStats": [ + "Language Models", + "languageModels", + "chat" + ], + "vs/workbench/contrib/chat/common/model/chatModel": [ + "editsSummary", + "copyrightContentRetry", + "filteredContentRetry", + "codeCitation", + "codeCitations" + ], + "vs/workbench/contrib/chat/common/model/chatProgressTypes/chatToolInvocation": [ + "toolInvocationMessage" + ], + "vs/workbench/contrib/chat/common/model/chatSessionStore": [ + "join.chatSessionStore", + "newChat" + ], + "vs/workbench/contrib/chat/common/promptSyntax/chatPromptFilesContribution": [ + "chatContribution.schema.description", + "chatContribution.property.path", + "chatContribution.property.name", + "chatContribution.property.name.deprecated", + "chatContribution.property.description", + "chatContribution.property.description.deprecated", + "extension.missing.path", + "extension.invalid.path", + "extension.registration.failed" + ], + "vs/workbench/contrib/chat/common/promptSyntax/computeAutomaticInstructions": [ + "instruction.file.reason.allFiles", + "instruction.file.reason.specificFile", + "instruction.file.reason.copilot", + "instruction.file.reason.agentsmd", + "instruction.file.description.agentsmd.root", + "instruction.file.description.agentsmd.folder", + "instruction.file.reason.referenced" + ], + "vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptCodeActions": [ + "renameToAgent", + "migrateToAgent", + "updateToolName", + "expandToolNames", + "updateAllToolNames" + ], + "vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptHeaderAutocompletion": [ + "promptHeaderAutocompletion.addHeader", + "promptHeaderAutocompletion.handoffsExample" + ], + "vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptHovers": [ + "promptHeader.instructions.name", + "promptHeader.instructions.description", + "promptHeader.instructions.applyToRange", + "promptHeader.agent.name", + "promptHeader.agent.description", + "promptHeader.agent.argumentHint", + "promptHeader.agent.model", + "promptHeader.agent.tools", + "promptHeader.agent.target", + "promptHeader.agent.infer", + "promptHeader.prompt.name", + "promptHeader.prompt.description", + "promptHeader.prompt.argumentHint", + "promptHeader.prompt.model", + "promptHeader.prompt.tools", + "toolSetName", + "promptHeader.agent.model.githubCopilot", + "modelName", + "modelFamily", + "modelVendor", + "promptHeader.prompt.agent.builtInDesc", + "promptHeader.prompt.agent.customDesc", + "promptHeader.prompt.agent.description", + "promptHeader.prompt.agent.builtin", + "promptHeader.prompt.agent.custom", + "promptHeader.prompt.agent.customDesc", + "promptHeader.agent.handoffs", + "promptHeader.agent.handoffs.githubCopilot" + ], + "vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptValidator": [ + "promptValidator.chatModesRenamedToAgents", + "promptValidator.chatModesRenamedToAgentsNoMove", + "promptValidator.invalidFileReference", + "promptValidator.fileNotFound", + "promptValidator.deprecatedVariableReference", + "promptValidator.deprecatedVariableReferenceMultipleNames", + "promptValidator.unknownVariableReference", + "promptValidator.disabledTool", + "promptValidator.unknownAttribute.prompt", + "promptValidator.unknownAttribute.github-agent", + "promptValidator.ignoredAttribute.vscode-agent", + "promptValidator.unknownAttribute.vscode-agent", + "promptValidator.unknownAttribute.instructions", + "promptValidator.nameMustBeString", + "promptValidator.nameShouldNotBeEmpty", + "promptValidator.descriptionMustBeString", + "promptValidator.descriptionShouldNotBeEmpty", + "promptValidator.argumentHintMustBeString", + "promptValidator.argumentHintShouldNotBeEmpty", + "promptValidator.modelMustBeString", + "promptValidator.modelMustBeNonEmpty", + "promptValidator.modelNotFound", + "promptValidator.modelNotSuited", + "promptValidator.modeDeprecated", + "promptValidator.modeDeprecated.useAgent", + "promptValidator.attributeMustBeString", + "promptValidator.attributeMustBeNonEmpty", + "promptValidator.agentNotFound", + "promptValidator.toolsOnlyInAgent", + "promptValidator.toolsMustBeArrayOrMap", + "promptValidator.eachToolMustBeString", + "promptValidator.toolDeprecated", + "promptValidator.toolDeprecatedMultipleNames", + "promptValidator.toolNotFound", + "promptValidator.applyToMustBeString", + "promptValidator.applyToMustBeValidGlob", + "promptValidator.applyToMustBeValidGlob", + "promptValidator.applyToMustBeValidGlob", + "promptValidator.excludeAgentMustBeArray", + "promptValidator.handoffsMustBeArray", + "promptValidator.eachHandoffMustBeObject", + "promptValidator.handoffLabelMustBeNonEmptyString", + "promptValidator.handoffAgentMustBeNonEmptyString", + "promptValidator.handoffPromptMustBeString", + "promptValidator.handoffSendMustBeBoolean", + "promptValidator.handoffShowContinueOnMustBeBoolean", + "promptValidator.unknownHandoffProperty", + "promptValidator.missingHandoffProperties", + "promptValidator.inferMustBeBoolean", + "promptValidator.targetMustBeString", + "promptValidator.targetMustBeNonEmpty", + "promptValidator.targetInvalidValue" + ], + "vs/workbench/contrib/chat/common/promptSyntax/service/promptsServiceImpl": [ + "user-data-dir.capitalized", + "extension.with.id" + ], + "vs/workbench/contrib/chat/common/tools/builtinTools/chatUrlFetchingConfirmation": [ + "delete", + "approveRequestTo", + "approveResponseFrom", + "moreOptions", + "moreOptionsMultiple", + "selectApproval", + "allowRequestsCheckbox", + "allowResponsesCheckbox", + "approveAll", + "denyAll", + "requests", + "responses", + "approves", + "noApprovals", + "moreOptionsManage", + "openSettings" + ], + "vs/workbench/contrib/chat/common/tools/builtinTools/manageTodoListTool": [ + "tool.manageTodoList.displayName", + "tool.manageTodoList.userDescription", + "todo.readOperation", + "todo.updatedList", + "todo.created.single", + "todo.created.multiple", + "todo.starting", + "todo.completed", + "todo.added.single", + "todo.added.multiple", + "todo.updated" + ], + "vs/workbench/contrib/chat/common/tools/builtinTools/runSubagentTool": [ + "tool.runSubagent.displayName", + "tool.runSubagent.userDescription" + ], + "vs/workbench/contrib/chat/common/tools/builtinTools/tools": [ + "toolset.custom-agent" + ], + "vs/workbench/contrib/chat/common/tools/languageModelToolsContribution": [ + "vscode.extension.contributes.tools", + "toolName", + "toolName2", + "toolDisplayName", + "toolUserDescription", + "toolModelDescription", + "parametersSchema", + "canBeReferencedInPrompt", + "icon", + "icon.light", + "icon.dark", + "condition", + "toolTags", + "vscode.extension.contributes.toolSets", + "toolSetName", + "toolSetDescription", + "toolSetIcon", + "toolSetTools", + "toolTableName", + "toolTableDisplayName", + "toolTableDescription", + "langModelTools", + "name", + "reference", + "tools", + "descriptions", + "langModelToolSets" + ], + "vs/workbench/contrib/chat/common/tools/languageModelToolsService": [ + "builtin", + "user", + "toolResultDataPartA11y" + ], + "vs/workbench/contrib/chat/common/voiceChatService": [ + "voiceChatInProgress" + ], + "vs/workbench/contrib/chat/common/widget/chatColors": [ + "chat.requestBorder", + "chat.requestBackground", + "chat.slashCommandBackground", + "chat.slashCommandForeground", + "chat.avatarBackground", + "chat.avatarForeground", + "chat.editedFileForeground", + "chat.requestCodeBorder", + "chat.requestBubbleBackground", + "chat.requestBubbleHoverBackground", + "chatCheckpointSeparator", + "chat.linesAddedForeground", + "chat.linesRemovedForeground" + ], + "vs/workbench/contrib/chat/common/widget/input/modelPickerWidget": [ + "chat.modelPicker.other" + ], + "vs/workbench/contrib/chat/electron-browser/actions/chatDeveloperActions": [ + "workbench.action.chat.openStorageFolder.label" + ], + "vs/workbench/contrib/chat/electron-browser/actions/voiceChatActions": [ + "scopedVoiceChatGettingReady", + "scopedVoiceChatInProgress", + "listening", + "scopedChatSynthesisInProgress", + "voice.keywordActivation.off", + "voice.keywordActivation.chatInView", + "voice.keywordActivation.quickChat", + "voice.keywordActivation.inlineChat", + "voice.keywordActivation.chatInContext", + "voice.keywordActivation", + "keywordActivation.status.name", + "keywordActivation.status.active", + "keywordActivation.status.inactive", + "workbench.action.chat.voiceChatInView.label", + "workbench.action.chat.holdToVoiceChatInChatView.label", + "workbench.action.chat.inlineVoiceChat", + "workbench.action.chat.quickVoiceChat.label", + "workbench.action.chat.startVoiceChat.label", + "workbench.action.chat.stopListening.label", + "workbench.action.chat.stopListeningAndSubmit.label", + "workbench.action.chat.readChatResponseAloud", + "workbench.action.speech.stopReadAloud", + "workbench.action.chat.stopReadChatItemAloud" + ], + "vs/workbench/contrib/chat/electron-browser/builtInTools/fetchPageTool": [ + "fetchWebPage.urlsDescription", + "fetchWebPage.noValidUrls", + "fetchWebPage.binaryNotSupported", + "fetchWebPage.pastTenseMessage.plural", + "fetchWebPage.pastTenseMessage.singular", + "fetchWebPage.pastTenseMessageResult.plural", + "fetchWebPage.invocationMessage.plural", + { + "key": "fetchWebPage.pastTenseMessageResult.singularAsLink", + "comment": [ + "{Locked=\"]({0})\"}" + ] + }, + { + "key": "fetchWebPage.invocationMessage.singularAsLink", + "comment": [ + "{Locked=\"]({0})\"}" + ] + }, + "fetchWebPage.pastTenseMessageResult.singular", + "fetchWebPage.invocationMessage.singular", + "fetchWebPage.urlMentionedInPrompt", + "fetchWebPage.confirmationTitle.singular", + "fetchWebPage.confirmationTitle.plural", + "fetchWebPage.confirmationMessage.plural", + "fetchWebPage.fetchedFrom", + "fetchWebPage.invalidUrl" + ], + "vs/workbench/contrib/chat/electron-browser/chat.contribution": [ + "copilotWorkspaceTrust", + "chatRequestInProgress", + "closeTheWindow.message", + "closeTheWindow.detail", + "changeWorkspace.message", + "changeWorkspace.detail", + "reloadTheWindow.message", + "reloadTheWindow.detail", + "quit.message", + "exit.message", + "quit.detail", + "exit.detail" + ], + "vs/workbench/contrib/codeActions/browser/codeActionsContribution": [ + "alwaysSave", + "explicitSave", + "neverSave", + "explicitSaveBoolean", + "neverSaveBoolean", + "explicit", + "never", + "explicitBoolean", + "neverBoolean", + "editor.codeActionsOnSave", + "notebook.codeActionsOnSave", + "codeActionsOnSave.generic", + "codeActionsOnSave.generic" + ], + "vs/workbench/contrib/codeEditor/browser/accessibility/accessibility": [ + "screenReader.lineColPosition", + "toggleScreenReaderMode", + "toggleScreenReaderModeDescription", + "announceCursorPosition", + "announceCursorPosition.description" + ], + "vs/workbench/contrib/codeEditor/browser/dictation/editorDictation": [ + "stopDictationShort1", + "stopDictationShort2", + "voiceCategory", + "startDictation", + "stopDictation" + ], + "vs/workbench/contrib/codeEditor/browser/diffEditorAccessibilityHelp": [ + "msg3", + "msg5", + "msg1", + "msg2", + "msg4" + ], + "vs/workbench/contrib/codeEditor/browser/diffEditorHelper": [ + "hintWhitespace", + "hintTimeout", + "removeTimeout" + ], + "vs/workbench/contrib/codeEditor/browser/emptyTextEditorHint/emptyTextEditorHint": [ + "disableEditorEmptyHint", + "disableEditorEmptyHint", + { + "key": "emptyTextEditorHintWithInlineChat", + "comment": [ + "Preserve double-square brackets and their order", + "language refers to a programming language" + ] + }, + { + "key": "emptyTextEditorHintWithoutInlineChat", + "comment": [ + "Preserve double-square brackets and their order", + "language refers to a programming language" + ] + }, + "defaultHintAriaLabelWithInlineChat", + "defaultHintAriaLabelWithoutInlineChat", + "disableHint" + ], + "vs/workbench/contrib/codeEditor/browser/find/simpleFindWidget": [ + "label.find", + "placeholder.find", + "label.previousMatchButton", + "label.nextMatchButton", + "label.closeButton", + "ariaSearchNoInput", + "ariaSearchNoResultEmpty", + "ariaSearchNoResult", + "ariaSearchNoResultWithLineNumNoCurrentMatch", + "simpleFindWidget.sashBorder" + ], + "vs/workbench/contrib/codeEditor/browser/inspectEditorTokens/inspectEditorTokens": [ + "inspectTMScopesWidget.loading", + "inspectEditorTokens" + ], + "vs/workbench/contrib/codeEditor/browser/inspectKeybindings": [ + "workbench.action.inspectKeyMap", + "workbench.action.inspectKeyMapJSON" + ], + "vs/workbench/contrib/codeEditor/browser/largeFileOptimizations": [ + { + "key": "largeFile", + "comment": [ + "Variable 0 will be a file name." + ] + }, + "removeOptimizations", + "reopenFilePrompt" + ], + "vs/workbench/contrib/codeEditor/browser/outline/documentSymbolsOutline": [ + "document" + ], + "vs/workbench/contrib/codeEditor/browser/outline/documentSymbolsTree": [ + "title.template", + "1.problem", + "N.problem", + "deep.problem" + ], + "vs/workbench/contrib/codeEditor/browser/quickaccess/gotoLineQuickAccess": [ + "gotoLineQuickAccessPlaceholder", + "gotoLineQuickAccess", + "gotoLineQuickAccessPlaceholder", + "gotoOffsetQuickAccess", + "gotoLine", + "gotoOffset" + ], + "vs/workbench/contrib/codeEditor/browser/quickaccess/gotoSymbolQuickAccess": [ + "empty", + { + "key": "miGotoSymbolInEditor", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "gotoSymbolQuickAccessPlaceholder", + "gotoSymbolQuickAccess", + "gotoSymbolByCategoryQuickAccess", + "gotoSymbol" + ], + "vs/workbench/contrib/codeEditor/browser/saveParticipants": [ + { + "key": "formatting2", + "comment": [ + "[configure]({1}) is a link. Only translate `configure`. Do not change brackets and parentheses or {1}" + ] + }, + "codeaction", + { + "key": "codeaction.get2", + "comment": [ + "[configure]({1}) is a link. Only translate `configure`. Do not change brackets and parentheses or {1}" + ] + }, + "codeAction.apply" + ], + "vs/workbench/contrib/codeEditor/browser/toggleColumnSelection": [ + { + "key": "miColumnSelection", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "toggleColumnSelection" + ], + "vs/workbench/contrib/codeEditor/browser/toggleMinimap": [ + { + "key": "miMinimap", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "toggleMinimap" + ], + "vs/workbench/contrib/codeEditor/browser/toggleMultiCursorModifier": [ + "miMultiCursorAlt", + "miMultiCursorCmd", + "miMultiCursorCtrl", + "toggleLocation" + ], + "vs/workbench/contrib/codeEditor/browser/toggleOvertype": [ + { + "key": "mitoggleOvertypeInsertMode", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "toggleOvertypeInsertMode", + "toggleOvertypeMode.description" + ], + "vs/workbench/contrib/codeEditor/browser/toggleRenderControlCharacter": [ + { + "key": "miToggleRenderControlCharacters", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "toggleRenderControlCharacters" + ], + "vs/workbench/contrib/codeEditor/browser/toggleRenderWhitespace": [ + { + "key": "miToggleRenderWhitespace", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "toggleRenderWhitespace" + ], + "vs/workbench/contrib/codeEditor/browser/toggleWordWrap": [ + "editorWordWrap", + "unwrapMinified", + "wrapMinified", + { + "key": "miToggleWordWrap", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "toggle.wordwrap" + ], + "vs/workbench/contrib/codeEditor/common/languageConfigurationExtensionPoint": [ + "parseErrors", + "formatError", + "schema.openBracket", + "schema.closeBracket", + "schema.comments", + "schema.blockComments", + "schema.blockComment.begin", + "schema.blockComment.end", + "schema.lineComment.object", + "schema.lineComment.comment", + "schema.lineComment.noIndent", + "schema.brackets", + "schema.colorizedBracketPairs", + "schema.autoClosingPairs", + "schema.autoClosingPairs.notIn", + "schema.autoCloseBefore", + "schema.surroundingPairs", + "schema.wordPattern", + "schema.wordPattern.pattern", + "schema.wordPattern.flags", + "schema.wordPattern.flags.errorMessage", + "schema.indentationRules", + "schema.indentationRules.increaseIndentPattern", + "schema.indentationRules.increaseIndentPattern.pattern", + "schema.indentationRules.increaseIndentPattern.flags", + "schema.indentationRules.increaseIndentPattern.errorMessage", + "schema.indentationRules.decreaseIndentPattern", + "schema.indentationRules.decreaseIndentPattern.pattern", + "schema.indentationRules.decreaseIndentPattern.flags", + "schema.indentationRules.decreaseIndentPattern.errorMessage", + "schema.indentationRules.indentNextLinePattern", + "schema.indentationRules.indentNextLinePattern.pattern", + "schema.indentationRules.indentNextLinePattern.flags", + "schema.indentationRules.indentNextLinePattern.errorMessage", + "schema.indentationRules.unIndentedLinePattern", + "schema.indentationRules.unIndentedLinePattern.pattern", + "schema.indentationRules.unIndentedLinePattern.flags", + "schema.indentationRules.unIndentedLinePattern.errorMessage", + "schema.folding", + "schema.folding.offSide", + "schema.folding.markers", + "schema.folding.markers.start", + "schema.folding.markers.end", + "schema.onEnterRules", + "schema.onEnterRules", + "schema.onEnterRules.beforeText", + "schema.onEnterRules.beforeText.pattern", + "schema.onEnterRules.beforeText.flags", + "schema.onEnterRules.beforeText.errorMessage", + "schema.onEnterRules.afterText", + "schema.onEnterRules.afterText.pattern", + "schema.onEnterRules.afterText.flags", + "schema.onEnterRules.afterText.errorMessage", + "schema.onEnterRules.previousLineText", + "schema.onEnterRules.previousLineText.pattern", + "schema.onEnterRules.previousLineText.flags", + "schema.onEnterRules.previousLineText.errorMessage", + "schema.onEnterRules.action", + "schema.onEnterRules.action.indent", + "schema.onEnterRules.action.indent.none", + "schema.onEnterRules.action.indent.indent", + "schema.onEnterRules.action.indent.indentOutdent", + "schema.onEnterRules.action.indent.outdent", + "schema.onEnterRules.action.appendText", + "schema.onEnterRules.action.removeText" + ], + "vs/workbench/contrib/codeEditor/electron-browser/selectionClipboard": [ + "actions.pasteSelectionClipboard" + ], + "vs/workbench/contrib/codeEditor/electron-browser/startDebugTextMate": [ + "startDebugTextMate" + ], + "vs/workbench/contrib/commands/common/commands.contribution": [ + "runCommands.description", + "runCommands.commands", + "runCommands.invalidArgs", + "runCommands.noCommandsToRun", + "runCommands" + ], + "vs/workbench/contrib/comments/browser/commentColors": [ + "resolvedCommentIcon", + "unresolvedCommentIcon", + "commentReplyInputBackground", + "resolvedCommentBorder", + "unresolvedCommentBorder", + "commentThreadRangeBackground", + "commentThreadActiveRangeBackground" + ], + "vs/workbench/contrib/comments/browser/commentGlyphWidget": [ + "editorGutterCommentRangeForeground", + "editorOverviewRuler.commentForeground", + "editorOverviewRuler.commentUnresolvedForeground", + "editorOverviewRuler.commentDraftForeground", + "editorGutterCommentGlyphForeground", + "editorGutterCommentUnresolvedGlyphForeground", + "editorGutterCommentDraftGlyphForeground" + ], + "vs/workbench/contrib/comments/browser/commentNode": [ + "commentToggleReaction", + "commentToggleReactionError", + "commentToggleReactionDefaultError", + "commentDeleteReactionError", + "commentDeleteReactionDefaultError", + "commentAddReactionError", + "commentAddReactionDefaultError" + ], + "vs/workbench/contrib/comments/browser/commentReply": [ + "reply", + "newComment", + "reply", + "reply" + ], + "vs/workbench/contrib/comments/browser/comments.contribution": [ + "collapseAll", + "expandAll", + "reply", + "commentsConfigurationTitle", + "openComments", + "comments.openPanel.deprecated", + "comments.openView.never", + "comments.openView.file", + "comments.openView.firstFile", + "comments.openView.firstFileUnresolved", + "comments.openView", + "useRelativeTime", + "comments.visible", + "comments.maxHeight", + "collapseOnResolve", + "confirmOnCollapse.whenHasUnsubmittedComments", + "confirmOnCollapse.never", + "confirmOnCollapse", + "totalUnresolvedComments" + ], + "vs/workbench/contrib/comments/browser/commentsAccessibility": [ + "intro", + "introWidget", + "commentCommands", + "escape", + "next", + "previous", + "nextCommentThreadKb", + "previousCommentThreadKb", + "nextCommentedRangeKb", + "previousCommentedRangeKb", + "addCommentNoKb", + "submitComment" + ], + "vs/workbench/contrib/comments/browser/commentsController": [ + "commentRange", + "commentRangeStart", + "hasCommentRangesKb", + "hasCommentRangesNoKb", + "hasCommentRanges", + "comments.addCommand.error", + "comments.addFileCommentCommand.error", + "pickCommentService" + ], + "vs/workbench/contrib/comments/browser/commentsEditorContribution": [ + "comments.NextCommentedRange", + "commentsCategory", + "comments.previousCommentedRange", + "commentsCategory", + "comments.nextCommentingRange", + "commentsCategory", + "comments.previousCommentingRange", + "commentsCategory", + "comments.toggleCommenting", + "commentsCategory", + "comments.addCommand", + "commentsCategory", + "comments.focusCommentOnCurrentLine", + "commentsCategory", + "comments.focusCommand.error", + "comments.collapseAll", + "commentsCategory", + "comments.expandAll", + "commentsCategory", + "comments.expandUnresolved", + "commentsCategory", + "comments.focusCommand.error" + ], + "vs/workbench/contrib/comments/browser/commentsModel": [ + "noComments" + ], + "vs/workbench/contrib/comments/browser/commentsTreeViewer": [ + "commentsCountReplies", + "commentsCountReply", + "commentCount", + "imageWithLabel", + "image", + "outdated", + "commentLine", + "commentRange", + "lastReplyFrom", + "comments.view.title" + ], + "vs/workbench/contrib/comments/browser/commentsView": [ + "comments.filter.placeholder", + "comments.filter.ariaLabel", + "showing filtered results", + "fileCommentLabel", + "oneLineCommentLabel", + "multiLineCommentLabel", + "accessibleViewHint", + "acessibleViewHintNoKbOpen", + "resourceWithCommentLabelOutdated", + "resourceWithCommentLabel", + "resourceWithRepliesLabel", + "replyCount", + "rootCommentsLabel", + "resourceWithCommentThreadsLabel" + ], + "vs/workbench/contrib/comments/browser/commentsViewActions": [ + "focusCommentsList", + "commentsClearFilterText", + "focusCommentsFilter", + "toggle unresolved", + "comments", + "unresolved", + "toggle resolved", + "comments", + "resolved", + "comment sorts", + "toggle sorting by updated at", + "comments", + "sorting by updated at", + "toggle sorting by resource", + "comments", + "sorting by position in file" + ], + "vs/workbench/contrib/comments/browser/commentThreadBody": [ + "commentThreadAria.withRange", + "commentThreadAria.document", + "commentThreadAria" + ], + "vs/workbench/contrib/comments/browser/commentThreadHeader": [ + "collapseIcon", + "label.collapse", + "startThread" + ], + "vs/workbench/contrib/comments/browser/commentThreadWidget": [ + "commentLabel", + "commentLabelWithKeybinding", + "commentLabelWithKeybindingNoKeybinding" + ], + "vs/workbench/contrib/comments/browser/commentThreadZoneWidget": [ + "confirmCollapse", + "discard", + "neverAskAgain" + ], + "vs/workbench/contrib/comments/browser/reactionsAction": [ + "pickReactions", + "comment.toggleableReaction", + { + "key": "comment.reactionLabelNone", + "comment": [ + "This is a tooltip for an emoji button so that the current user can toggle their reaction to a comment.", + "The first arg is localized message \"Toggle reaction\" or empty if the user doesn't have permission to toggle the reaction, the second is the name of the reaction." + ] + }, + { + "key": "comment.reactionLabelOne", + "comment": [ + "This is a tooltip for an emoji that is a \"reaction\" to a comment where the count of the reactions is 1.", + "The emoji is also a button so that the current user can also toggle their own emoji reaction.", + "The first arg is localized message \"Toggle reaction\" or empty if the user doesn't have permission to toggle the reaction, the second is the name of the reaction." + ] + }, + { + "key": "comment.reactionLabelMany", + "comment": [ + "This is a tooltip for an emoji that is a \"reaction\" to a comment where the count of the reactions is greater than 1.", + "The emoji is also a button so that the current user can also toggle their own emoji reaction.", + "The first arg is localized message \"Toggle reaction\" or empty if the user doesn't have permission to toggle the reaction, the second is number of users who have reacted with that reaction, and the third is the name of the reaction." + ] + }, + { + "key": "comment.reactionLessThanTen", + "comment": [ + "This is a tooltip for an emoji that is a \"reaction\" to a comment where the count of the reactions is less than or equal to 10.", + "The emoji is also a button so that the current user can also toggle their own emoji reaction.", + "The first arg is localized message \"Toggle reaction\" or empty if the user doesn't have permission to toggle the reaction, the second iis a list of the reactors, and the third is the name of the reaction." + ] + }, + { + "key": "comment.reactionMoreThanTen", + "comment": [ + "This is a tooltip for an emoji that is a \"reaction\" to a comment where the count of the reactions is less than or equal to 10.", + "The emoji is also a button so that the current user can also toggle their own emoji reaction.", + "The first arg is localized message \"Toggle reaction\" or empty if the user doesn't have permission to toggle the reaction, the second iis a list of the reactors, and the third is the name of the reaction." + ] + } + ], + "vs/workbench/contrib/comments/common/commentContextKeys": [ + "hasCommentingRange", + "hasComment", + "editorHasCommentingRange", + "hasCommentingProvider", + "commentThreadIsEmpty", + "commentIsEmpty", + "comment", + "commentThread", + "commentController", + "commentFocused", + "commentingEnabled" + ], + "vs/workbench/contrib/customEditor/browser/customEditorInput": [ + "editorUnsupportedInWindow", + "reopenInOriginalWindow", + "editorCannotMove" + ], + "vs/workbench/contrib/customEditor/common/contributedCustomEditors": [ + "builtinProviderDisplayName" + ], + "vs/workbench/contrib/customEditor/common/customEditor": [ + "context.customEditor" + ], + "vs/workbench/contrib/customEditor/common/customTextEditorModel": [ + "vetoExtHostRestart" + ], + "vs/workbench/contrib/customEditor/common/extensionPoint": [ + "contributes.viewType", + "contributes.displayName", + "contributes.selector", + "contributes.selector.filenamePattern", + "contributes.priority", + "contributes.priority.default", + "contributes.priority.option", + "contributes.customEditors", + "customEditors view type", + "customEditors priority", + "customEditors filenamePattern", + "customEditors" + ], + "vs/workbench/contrib/debug/browser/baseDebugView": [ + "debug.lazyButton.tooltip" + ], + "vs/workbench/contrib/debug/browser/breakpointEditorContribution": [ + "breakpointHelper", + "logPoint", + "breakpoint", + "breakpointHasConditionDisabled", + "message", + "condition", + "breakpointHasConditionEnabled", + "message", + "condition", + { + "key": "removeLogPoint", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "disableLogPoint", + { + "key": "disable", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "enable", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "logPoint", + "breakpoint", + "removeBreakpoint", + "editBreakpoint", + "disableBreakpoint", + "enableBreakpoint", + "removeBreakpoints", + "removeInlineBreakpointOnColumn", + "removeLineBreakpoint", + "editBreakpoints", + "editInlineBreakpointOnColumn", + "editLineBreakpoint", + "enableDisableBreakpoints", + "disableInlineColumnBreakpoint", + "disableBreakpointOnLine", + "enableBreakpoints", + "enableBreakpointOnLine", + "addBreakpoint", + "addConditionalBreakpoint", + "addLogPoint", + "addTriggeredBreakpoint", + "runToLine", + "debugIcon.breakpointForeground", + "debugIcon.breakpointDisabledForeground", + "debugIcon.breakpointUnverifiedForeground", + "debugIcon.breakpointCurrentStackframeForeground", + "debugIcon.breakpointStackframeForeground" + ], + "vs/workbench/contrib/debug/browser/breakpointsView": [ + "removeBreakpointsInFile", + "removeBreakpointsInFile", + "loading", + "emptyLine", + "lineNotFound", + "cannotLoadLine", + "unverifiedExceptionBreakpoint", + "expressionCondition", + "expressionAndHitCount", + "functionBreakpointsNotSupported", + "dataBreakpointsNotSupported", + "read", + "write", + "access", + "expressionAndHitCount", + "debug.decimal.address", + "functionBreakpointPlaceholder", + "functionBreakPointInputAriaLabel", + "functionBreakpointExpressionPlaceholder", + "functionBreakPointExpresionAriaLabel", + "functionBreakpointHitCountPlaceholder", + "functionBreakPointHitCountAriaLabel", + "dataBreakpointExpressionPlaceholder", + "dataBreakPointExpresionAriaLabel", + "dataBreakpointHitCountPlaceholder", + "dataBreakPointHitCountAriaLabel", + "exceptionBreakpointAriaLabel", + "exceptionBreakpointPlaceholder", + "breakpoints", + "breakpointFolder", + "disabledLogpoint", + "disabledBreakpoint", + "unverifiedLogpoint", + "unverifiedBreakpoint", + "dataBreakpointUnsupported", + "dataBreakpoint", + "functionBreakpointUnsupported", + "functionBreakpoint", + "expression", + "hitCount", + "instructionBreakpointUnsupported", + "instructionBreakpointAtAddress", + "instructionBreakpoint", + "hitCount", + "breakpointUnsupported", + "logMessage", + "expression", + "hitCount", + "triggeredBy", + "breakpoint", + { + "key": "miFunctionBreakpoint", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "dataBreakpointError", + "dataBreakpointAccessType", + "dataBreakpointMemoryRangePrompt", + "dataBreakpointMemoryRangePlaceholder", + "dataBreakpointAddrFormat", + "dataBreakpointAddrStartEnd", + "dataBreakpointAddrOrder", + { + "key": "miDataBreakpoint", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "removeBreakpoint", + { + "key": "miRemoveAllBreakpoints", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miEnableAllBreakpoints", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miDisableAllBreakpoints", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "editCondition", + "editCondition", + "editHitCount", + "editBreakpoint", + "editHitCount", + "editMode", + "selectBreakpointMode", + "addFunctionBreakpoint", + "addDataBreakpointOnAddress", + "editDataBreakpointOnAddress", + "activateBreakpoints", + "removeAllBreakpoints", + "enableAllBreakpoints", + "disableAllBreakpoints", + "reapplyAllBreakpoints", + "toggleBreakpointsPresentation" + ], + "vs/workbench/contrib/debug/browser/breakpointWidget": [ + "breakpointWidgetLogMessagePlaceholder", + "breakpointWidgetHitCountPlaceholder", + "breakpointWidgetExpressionPlaceholder", + "expression", + "hitCount", + "logMessage", + "triggeredBy", + "breakpointType", + "bpMode", + "noTriggerByBreakpoint", + "triggerByLoading", + "noBpSource", + "selectBreakpoint", + "ok" + ], + "vs/workbench/contrib/debug/browser/callStackEditorContribution": [ + "topStackFrameLineHighlight", + "focusedStackFrameLineHighlight" + ], + "vs/workbench/contrib/debug/browser/callStackView": [ + { + "key": "running", + "comment": [ + "indicates state" + ] + }, + "showMoreStackFrames2", + { + "key": "session", + "comment": [ + "Session is a noun" + ] + }, + { + "key": "running", + "comment": [ + "indicates state" + ] + }, + "restartFrame", + "loadAllStackFrames", + "showMoreAndOrigin", + "showMoreStackFrames", + { + "key": "pausedOn", + "comment": [ + "indicates reason for program being paused" + ] + }, + "paused", + { + "comment": [ + "Debug is a noun in this context, not a verb." + ], + "key": "callStackAriaLabel" + }, + { + "key": "threadAriaLabel", + "comment": [ + "Placeholders stand for the thread name and the thread state.For example \"Thread 1\" and \"Stopped" + ] + }, + "stackFrameAriaLabel", + { + "key": "running", + "comment": [ + "indicates state" + ] + }, + { + "key": "sessionLabel", + "comment": [ + "Placeholders stand for the session name and the session state. For example \"Launch Program\" and \"Running\"" + ] + }, + "showMoreStackFrames", + "collapse" + ], + "vs/workbench/contrib/debug/browser/callStackWidget": [ + { + "comment": [ + "{0} is an extension-defined label, then line number and filename" + ], + "key": "stackTraceLabel" + }, + "stackTrace", + "stackFrameLocation", + "failedToLoadFrames", + "goToFile" + ], + "vs/workbench/contrib/debug/browser/debug.contribution": [ + "debugCategory", + "startDebugPlaceholder", + "startDebuggingHelp", + "tasksQuickAccessPlaceholder", + "tasksQuickAccessHelp", + "terminateThread", + "restartFrame", + "copyStackTrace", + "viewMemory", + "setValue", + "breakWhenValueIsRead", + "breakWhenValueChanges", + "breakWhenValueIsAccessed", + "viewMemory", + "breakWhenValueIsRead", + "breakWhenValueChanges", + "breakWhenValueIsAccessed", + "editWatchExpression", + "setValue", + "copyValue", + "viewMemory", + "removeWatchExpression", + "breakWhenValueIsRead", + "breakWhenValueChanges", + "breakWhenValueIsAccessed", + { + "key": "mRun", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miStartDebugging", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miRun", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miStopDebugging", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miRestart Debugging", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miAddConfiguration", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miStepOver", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miStepInto", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miStepOut", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miContinue", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miInlineBreakpoint", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miNewBreakpoint", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miToggleBreakpoint", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miInstallAdditionalDebuggers", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miToggleDebugConsole", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miViewRun", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "disassembly", + "debugConfigurationTitle", + { + "comment": [ + "This is the description for a setting" + ], + "key": "showVariableTypes" + }, + { + "comment": [ + "This is the description for a setting" + ], + "key": "allowBreakpointsEverywhere" + }, + { + "comment": [ + "This is the description for a setting" + ], + "key": "gutterMiddleClickAction" + }, + "debug.gutterMiddleClickAction.logpoint", + "debug.gutterMiddleClickAction.conditionalBreakpoint", + "debug.gutterMiddleClickAction.triggeredBreakpoint", + "debug.gutterMiddleClickAction.none", + { + "comment": [ + "This is the description for a setting" + ], + "key": "openExplorerOnEnd" + }, + { + "comment": [ + "This is the description for a setting" + ], + "key": "closeReadonlyTabsOnEnd" + }, + { + "comment": [ + "This is the description for a setting" + ], + "key": "inlineValues" + }, + "inlineValues.on", + "inlineValues.off", + "inlineValues.focusNoScroll", + { + "comment": [ + "This is the description for a setting" + ], + "key": "toolBarLocation" + }, + "debugToolBar.floating", + "debugToolBar.docked", + "debugToolBar.commandCenter", + "debugToolBar.hidden", + "never", + "always", + "onFirstSessionStart", + { + "comment": [ + "This is the description for a setting" + ], + "key": "showInStatusBar" + }, + "debug.console.closeOnEnd", + { + "comment": [ + "This is the description for a setting" + ], + "key": "debug.terminal.clearBeforeReusing" + }, + "openDebug", + { + "comment": [ + "This is the description for a setting" + ], + "key": "showSubSessionsInToolBar" + }, + "debug.console.fontSize", + "debug.console.fontFamily", + "debug.console.lineHeight", + "debug.console.wordWrap", + "debug.console.historySuggestions", + "debug.console.collapseIdenticalLines", + "debug.console.acceptSuggestionOnEnter", + "debug.console.maximumLines", + { + "comment": [ + "This is the description for a setting" + ], + "key": "launch" + }, + "debug.focusWindowOnBreak", + "debug.focusEditorOnBreak", + "debugAnyway", + "showErrors", + "prompt", + "cancel", + "debug.onTaskErrors", + { + "comment": [ + "This is the description for a setting" + ], + "key": "showBreakpointsInOverviewRuler" + }, + "debug.breakpointsView.presentation", + { + "comment": [ + "This is the description for a setting" + ], + "key": "showInlineBreakpointCandidates" + }, + "debug.saveBeforeStart", + "debug.saveBeforeStart.allEditorsInActiveGroup", + "debug.saveBeforeStart.nonUntitledEditorsInActiveGroup", + "debug.saveBeforeStart.none", + "debug.confirmOnExit", + "debug.confirmOnExit.never", + "debug.confirmOnExit.always", + "debug.disassemblyView.showSourceCode", + "debug.autoExpandLazyVariables.auto", + "debug.autoExpandLazyVariables.on", + "debug.autoExpandLazyVariables.off", + "debug.autoExpandLazyVariables", + "debug.enableStatusBarColor", + { + "comment": [ + "This is the description for a setting" + ], + "key": "debug.hideLauncherWhileDebugging" + }, + "debug.hideSlowPreLaunchWarning", + "terminateThread", + "jumpToCursor", + "SetNextStatement", + "inlineBreakpoint", + "run", + "runMenu", + { + "comment": [ + "Debug is a noun in this context, not a verb." + ], + "key": "debugPanel" + }, + { + "comment": [ + "Debug is a noun in this context, not a verb." + ], + "key": "debugPanel" + }, + "run and debug", + "variables", + "watch", + "callStack", + "breakpoints", + "loadedScripts" + ], + "vs/workbench/contrib/debug/browser/debugActionViewItems": [ + "debugLaunchConfigurations", + "noConfigurations", + "addConfigTo", + "addConfiguration", + "commentLabelWithKeybinding", + "commentLabelWithKeybindingNoKeybinding", + "debugSession" + ], + "vs/workbench/contrib/debug/browser/debugAdapterManager": [ + "debugNoType", + "debugName", + "debugServer", + "debugPrelaunchTask", + "debugPostDebugTask", + "suppressMultipleSessionWarning", + "CouldNotFindLanguage", + { + "key": "findExtension", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "suggestedDebuggers", + "moreOptionsForDebugType", + "installLanguage", + "installExt", + "selectDebug" + ], + "vs/workbench/contrib/debug/browser/debugChatIntegration": [ + "chatContext.debugSession", + "selectDebugData", + "expressionValue", + "watchExpressions", + "allVariablesInScope", + "typeExpression", + "noDebugSession", + "noResult", + "evaluationError", + "addToChat", + "addToChat", + "addToChat" + ], + "vs/workbench/contrib/debug/browser/debugColors": [ + "debugToolBarBackground", + "debugToolBarBorder", + "debugIcon.startForeground", + "debugIcon.pauseForeground", + "debugIcon.stopForeground", + "debugIcon.disconnectForeground", + "debugIcon.restartForeground", + "debugIcon.stepOverForeground", + "debugIcon.stepIntoForeground", + "debugIcon.stepOutForeground", + "debugIcon.continueForeground", + "debugIcon.stepBackForeground" + ], + "vs/workbench/contrib/debug/browser/debugCommands": [ + "openLaunchJson", + "chooseLocation", + "noExecutableCode", + "jumpToCursor", + "editor.debug.action.stepIntoTargets.none", + "addInlineBreakpoint", + "selectExceptionBreakpointsPlaceholder", + "debug", + "restartDebug", + "stepOverDebug", + "stepIntoDebug", + "stepIntoTargetDebug", + "stepOutDebug", + "pauseDebug", + "disconnect", + "disconnectSuspend", + "stop", + "continueDebug", + "focusSession", + "selectAndStartDebugging", + "startDebug", + "startWithoutDebugging", + "nextDebugConsole", + "prevDebugConsole", + "openLoadedScript", + "callStackTop", + "callStackBottom", + "callStackUp", + "callStackDown", + "copyAsExpression", + "copyValue", + "copyAddress", + "addToWatchExpressions", + "selectDebugConsole", + "selectDebugSession", + "addConfiguration", + "toggleExceptionBreakpoints", + "attachToCurrentCodeRenderer" + ], + "vs/workbench/contrib/debug/browser/debugConfigurationManager": [ + "selectConfiguration", + "editLaunchConfig", + "DebugConfig.failed", + "workspace", + "user settings" + ], + "vs/workbench/contrib/debug/browser/debugConsoleQuickAccess": [ + "workbench.action.debug.startDebug" + ], + "vs/workbench/contrib/debug/browser/debugEditorActions": [ + { + "key": "miToggleBreakpoint", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miConditionalBreakpoint", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miLogPoint", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "triggerByBreakpointEditorAction", + { + "key": "miTriggerByBreakpoint", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "EditBreakpointEditorAction", + { + "key": "miEditBreakpoint", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miDisassemblyView", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "mitogglesource", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "editor.debug.action.stepIntoTargets.notAvailable", + { + "key": "stepIntoTargets", + "comment": [ + "Step Into Targets lets the user step into an exact function he or she is interested in." + ] + }, + "toggleBreakpointAction", + "conditionalBreakpointEditorAction", + "logPointEditorAction", + "openDisassemblyView", + "toggleDisassemblyViewSourceCode", + "toggleDisassemblyViewSourceCodeDescription", + "runToCursor", + "evaluateInDebugConsole", + "addToWatch", + "showDebugHover", + "goToNextBreakpoint", + "goToPreviousBreakpoint", + "closeExceptionWidget" + ], + "vs/workbench/contrib/debug/browser/debugEditorContribution": [ + "editor.inlineValuesForeground", + "editor.inlineValuesBackground" + ], + "vs/workbench/contrib/debug/browser/debugHover": [ + { + "key": "quickTip", + "comment": [ + "\"switch to editor language hover\" means to show the programming language hover widget instead of the debug hover" + ] + }, + "treeAriaLabel", + { + "key": "variableAriaLabel", + "comment": [ + "Do not translate placeholders. Placeholders are name and value of a variable." + ] + } + ], + "vs/workbench/contrib/debug/browser/debugIcons": [ + "debugConsoleViewIcon", + "runViewIcon", + "variablesViewIcon", + "watchViewIcon", + "callStackViewIcon", + "breakpointsViewIcon", + "loadedScriptsViewIcon", + "debugBreakpoint", + "debugBreakpointDisabled", + "debugBreakpointUnverified", + "debugBreakpointPendingOnTrigger", + "debugBreakpointFunction", + "debugBreakpointFunctionDisabled", + "debugBreakpointFunctionUnverified", + "debugBreakpointConditional", + "debugBreakpointConditionalDisabled", + "debugBreakpointConditionalUnverified", + "debugBreakpointData", + "debugBreakpointDataDisabled", + "debugBreakpointDataUnverified", + "debugBreakpointLog", + "debugBreakpointLogDisabled", + "debugBreakpointLogUnverified", + "debugBreakpointHint", + "debugBreakpointUnsupported", + "debugStackframe", + "debugStackframeFocused", + "debugGripper", + "debugRestartFrame", + "debugStop", + "debugDisconnect", + "debugRestart", + "debugStepOver", + "debugStepInto", + "debugStepOut", + "debugStepBack", + "debugPause", + "debugContinue", + "debugReverseContinue", + "debugRun", + "debugStart", + "debugConfigure", + "debugConsole", + "debugRemoveConfig", + "debugCollapseAll", + "callstackViewSession", + "debugConsoleClearAll", + "watchExpressionsRemoveAll", + "watchExpressionRemove", + "watchExpressionsAdd", + "watchExpressionsAddFuncBreakpoint", + "watchExpressionsAddDataBreakpoint", + "breakpointsRemoveAll", + "breakpointsActivate", + "debugConsoleEvaluationInput", + "debugConsoleEvaluationPrompt", + "debugInspectMemory" + ], + "vs/workbench/contrib/debug/browser/debugQuickAccess": [ + "noDebugResults", + "customizeLaunchConfig", + "mostRecent", + { + "key": "contributed", + "comment": [ + "contributed is lower case because it looks better like that in UI. Nothing preceeds it. It is a name of the grouping of debug configurations." + ] + }, + "removeLaunchConfig", + { + "key": "providerAriaLabel", + "comment": [ + "Placeholder stands for the provider label. For example \"NodeJS\"." + ] + }, + "configure", + "addConfigTo", + "addConfiguration" + ], + "vs/workbench/contrib/debug/browser/debugService": [ + "1activeSession", + "nActiveSessions", + "active debug session", + "runTrust", + "debugTrust", + { + "key": "compoundMustHaveConfigurations", + "comment": [ + "compound indicates a \"compounds\" configuration item", + "\"configurations\" is an attribute and should not be localized" + ] + }, + "noConfigurationNameInWorkspace", + "multipleConfigurationNamesInWorkspace", + "noFolderWithName", + "configMissing", + "launchJsonDoesNotExist", + "debugRequestNotSupported", + "debugRequesMissing", + "debugTypeNotSupported", + "debugTypeMissing", + { + "key": "installAdditionalDebuggers", + "comment": [ + "Placeholder is the debug type, so for example \"node\", \"python\"" + ] + }, + "noFolderWorkspaceDebugError", + "multipleSession", + "debugAdapterCrash", + { + "key": "debuggingPaused", + "comment": [ + "First placeholder is the file line content, second placeholder is the reason why debugging is stopped, for example \"breakpoint\", third is the stack frame name, and last is the line number." + ] + }, + "breakpointAdded", + "breakpointRemoved" + ], + "vs/workbench/contrib/debug/browser/debugSession": [ + "noDebugAdapter", + "noDebugAdapter", + "noDebugAdapter", + "noDebugAdapter", + "noDebugAdapter", + "sessionDoesNotSupporBytesBreakpoints", + "noDebugAdapter", + "sessionNotReadyForBreakpoints", + "noDebugAdapter", + "noDebugAdapter", + "noDebugAdapter", + "noDebugAdapter", + "noDebugAdapter", + "noDebugAdapter", + "noDebugAdapter", + "noDebugAdapter", + "noDebugAdapter", + "noDebugAdapter", + "noDebugAdapter", + "noDebugAdapter", + "noDebugAdapter", + "noDebugAdapter", + "noDebugAdapter", + "noDebugAdapter", + "noDebugAdapter", + "noDebugAdapter", + "noDebugAdapter", + "noDebugAdapter", + "noDebugAdapter", + "noDebugAdapter", + "noDebugAdapter", + "noDebugAdapter", + "noDebugAdapter", + "noDebugAdapter", + "noDebugAdapter", + "noDebugAdapter", + "noDebugAdapter", + "noDebugAdapter", + "noDebugAdapter", + "noDebugAdapter", + "debuggingStartedNoDebug", + "debuggingStarted", + "debuggingStopped" + ], + "vs/workbench/contrib/debug/browser/debugSessionPicker": [ + "moveFocusedView.selectView", + "workbench.action.debug.startDebug", + "workbench.action.debug.spawnFrom" + ], + "vs/workbench/contrib/debug/browser/debugStatus": [ + "status.debug", + "debugTarget", + "selectAndStartDebug" + ], + "vs/workbench/contrib/debug/browser/debugTaskRunner": [ + "abort", + { + "key": "debugAnyway", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "debugAnywayNoMemo", + "preLaunchTaskErrors", + "preLaunchTaskError", + "preLaunchTaskExitCode", + "preLaunchTaskTerminated", + { + "key": "showErrors", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "remember", + { + "key": "debugAnyway", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "rememberTask", + "invalidTaskReference", + "DebugTaskNotFoundWithTaskId", + "DebugTaskNotFound", + "taskNotTracked", + "runningTask", + "configureTask" + ], + "vs/workbench/contrib/debug/browser/debugToolBar": [ + "notebook.moreRunActionsLabel", + "stepBackDebug", + "reverseContinue" + ], + "vs/workbench/contrib/debug/browser/debugViewlet": [ + { + "key": "miOpenConfigurations", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "selectWorkspaceFolder", + "comment": [ + "User picks a workspace folder or a workspace configuration file here. Workspace configuration files can contain settings and thus a launch.json configuration can be written into one." + ] + }, + "debugPanel", + "startAdditionalSession", + "openLaunchConfigDescription" + ], + "vs/workbench/contrib/debug/browser/disassemblyView": [ + "instructionNotAvailable", + "disassemblyTableColumnLabel", + "editorOpenedFromDisassemblyDescription", + "disassemblyView", + "instructionAddress", + "instructionBytes", + "instructionText" + ], + "vs/workbench/contrib/debug/browser/exceptionWidget": [ + "debugExceptionWidgetBorder", + "debugExceptionWidgetBackground", + "exceptionThrownWithId", + "exceptionThrown", + "close" + ], + "vs/workbench/contrib/debug/browser/linkDetector": [ + "followForwardedLink", + "followLink", + "fileLinkWithPathMac", + "fileLinkWithPath", + "fileLinkMac", + "fileLink" + ], + "vs/workbench/contrib/debug/browser/loadedScriptsView": [ + "loadedScriptsSession", + { + "comment": [ + "Debug is a noun in this context, not a verb." + ], + "key": "loadedScriptsAriaLabel" + }, + "loadedScriptsRootFolderAriaLabel", + "loadedScriptsSessionAriaLabel", + "loadedScriptsFolderAriaLabel", + "loadedScriptsSourceAriaLabel", + "collapse" + ], + "vs/workbench/contrib/debug/browser/rawDebugSession": [ + "noDebugAdapterStart", + "canNotStart", + { + "key": "continue", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "noDebugAdapter", + "moreInfo" + ], + "vs/workbench/contrib/debug/browser/repl": [ + { + "key": "workbench.debug.filter.placeholder", + "comment": [ + "Text in the brackets after e.g. is not localizable" + ] + }, + "showing filtered repl lines", + "debugConsole", + "commentLabelWithKeybinding", + "commentLabelWithKeybindingNoKeybinding", + "startDebugFirst", + "repl.action.filter", + "repl.action.find", + "actions.repl.copyAll", + "selectRepl", + "collapse", + "paste", + "copyAll", + "copy", + { + "key": "actions.repl.acceptInput", + "comment": [ + "Apply input from the debug console input box" + ] + }, + "clearRepl", + "clearRepl.descriotion", + { + "comment": [ + "Debug is a noun in this context, not a verb." + ], + "key": "debugFocusConsole" + } + ], + "vs/workbench/contrib/debug/browser/replAccessibilityHelp": [ + "repl.help", + "repl.output", + "repl.input", + "repl.history", + "repl.accessibleView", + "repl.showRunAndDebug", + "repl.clear", + "repl.lazyVariables" + ], + "vs/workbench/contrib/debug/browser/replViewer": [ + "debugConsole", + "replVariableAriaLabel", + { + "key": "occurred", + "comment": [ + "Front will the value of the debug console element. Placeholder will be replaced by a number which represents occurrance count." + ] + }, + "replRawObjectAriaLabel", + "replGroup" + ], + "vs/workbench/contrib/debug/browser/runAndDebugAccessibilityHelp": [ + "debug.showRunAndDebug", + "debug.startDebugging", + "debug.help", + "onceDebugging", + "debug.restartDebugging", + "debug.stopDebugging", + "debug.continue", + "debug.stepInto", + "debug.stepOver", + "debug.stepOut", + "debug.views", + "debug.focusBreakpoints", + "debug.focusCallStack", + "debug.focusVariables", + "debug.focusWatch", + "debug.watchSetting" + ], + "vs/workbench/contrib/debug/browser/statusbarColorProvider": [ + "statusBarDebuggingBackground", + "statusBarDebuggingForeground", + "statusBarDebuggingBorder", + "commandCenter-activeBackground" + ], + "vs/workbench/contrib/debug/browser/variablesView": [ + "variableValueAriaLabel", + "removeVisualizer", + "variableValueAriaLabel", + "useVisualizer", + "variablesAriaTreeLabel", + "variableScopeAriaLabel", + { + "key": "variableAriaLabel", + "comment": [ + "Placeholders are variable name and variable value respectivly. They should not be translated." + ] + }, + "viewMemory.prompt", + "collapse" + ], + "vs/workbench/contrib/debug/browser/watchExpressionsView": [ + "typeNewValue", + "watchExpressionInputAriaLabel", + "watchExpressionPlaceholder", + { + "comment": [ + "Debug is a noun in this context, not a verb." + ], + "key": "watchAriaTreeLabel" + }, + "watchExpressionAriaLabel", + "watchVariableAriaLabel", + "collapse", + "addWatchExpression", + "removeAllWatchExpressions", + "copyWatchExpression" + ], + "vs/workbench/contrib/debug/browser/welcomeView": [ + { + "key": "openAFileWhichCanBeDebugged", + "comment": [ + "Please do not translate the word \"command\", it is part of our internal syntax which must not change", + "{Locked=\"](command:{0})\"}" + ] + }, + "runAndDebugAction", + { + "key": "customizeRunAndDebug2", + "comment": [ + "{Locked=\"launch.json\"}", + "{Locked=\"[\"}", + "{Locked=\"]({0})\"}" + ] + }, + { + "key": "customizeRunAndDebugOpenFolder2", + "comment": [ + "{Locked=\"launch.json\"}", + "{Locked=\"[\"}", + "{Locked=\"]({0})\"}" + ] + }, + "allDebuggersDisabled", + "run" + ], + "vs/workbench/contrib/debug/common/abstractDebugAdapter": [ + "timeout" + ], + "vs/workbench/contrib/debug/common/debug": [ + "debugType", + "debugConfigurationType", + "debugState", + "debugUX", + "hasDebugged", + "inDebugMode", + "inDebugRepl", + "breakpointWidgetVisibile", + "inBreakpointWidget", + "breakpointsFocused", + "watchExpressionsFocused", + "watchExpressionsExist", + "variablesFocused", + "expressionSelected", + "breakpointInputFocused", + "callStackItemType", + "callStackSessionIsAttach", + "callStackItemStopped", + "callStackSessionHasOneThread", + "callStackFocused", + "watchItemType", + "canViewMemory", + "breakpointItemType", + "breakpointItemIsDataBytes", + "breakpointHasModes", + "breakpointSupportsCondition", + "loadedScriptsSupported", + "loadedScriptsItemType", + "focusedSessionIsAttach", + "focusedSessionIsNoDebug", + "stepBackSupported", + "restartFrameSupported", + "stackFrameSupportsRestart", + "jumpToCursorSupported", + "stepIntoTargetsSupported", + "breakpointsExist", + "debuggersAvailable", + "debugExtensionsAvailable", + "debugProtocolVariableMenuContext", + "debugSetVariableSupported", + "debugSetDataBreakpointAddressSupported", + "debugSetExpressionSupported", + "breakWhenValueChangesSupported", + "breakWhenValueIsAccessedSupported", + "breakWhenValueIsReadSupported", + "terminateDebuggeeSupported", + "suspendDebuggeeSupported", + "terminateThreadsSupported", + "variableEvaluateNamePresent", + "variableIsReadonly", + "variableValue", + "variableType", + "variableInterfaces", + "variableName", + "variableLanguage", + "variableExtensionId", + "exceptionWidgetVisible", + "multiSessionRepl", + "multiSessionDebug", + "disassembleRequestSupported", + "disassemblyViewFocus", + "languageSupportsDisassembleRequest", + "focusedStackFrameHasInstructionReference", + "debuggerDisabled", + "internalConsoleOptions" + ], + "vs/workbench/contrib/debug/common/debugContentProvider": [ + "unable", + "canNotResolveSourceWithError", + "canNotResolveSource" + ], + "vs/workbench/contrib/debug/common/debugger": [ + "cannot.find.da", + "launch.config.comment1", + "launch.config.comment2", + "launch.config.comment3", + "debugType", + "debugTypeNotRecognised", + "node2NotSupported", + "debugRequest", + "debugWindowsConfiguration", + "debugOSXConfiguration", + "debugLinuxConfiguration" + ], + "vs/workbench/contrib/debug/common/debugLifecycle": [ + "debug.debugSessionCloseConfirmationSingular", + "debug.debugSessionCloseConfirmationPlural", + { + "key": "debug.stop", + "comment": [ + "&& denotes a mnemonic" + ] + } + ], + "vs/workbench/contrib/debug/common/debugModel": [ + "invalidVariableAttributes", + "startDebugFirst", + "notAvailable", + { + "key": "pausedOn", + "comment": [ + "indicates reason for program being paused" + ] + }, + "paused", + { + "key": "running", + "comment": [ + "indicates state" + ] + }, + "breakpointDirtydHover" + ], + "vs/workbench/contrib/debug/common/debugSchemas": [ + "vscode.extension.contributes.debuggers", + "vscode.extension.contributes.debuggers.type", + "vscode.extension.contributes.debuggers.label", + "vscode.extension.contributes.debuggers.program", + "vscode.extension.contributes.debuggers.args", + "vscode.extension.contributes.debuggers.runtime", + "vscode.extension.contributes.debuggers.runtimeArgs", + "vscode.extension.contributes.debuggers.variables", + "vscode.extension.contributes.debuggers.initialConfigurations", + "vscode.extension.contributes.debuggers.languages", + "vscode.extension.contributes.debuggers.configurationSnippets", + "vscode.extension.contributes.debuggers.configurationAttributes", + "vscode.extension.contributes.debuggers.when", + "vscode.extension.contributes.debuggers.hiddenWhen", + "vscode.extension.contributes.debuggers.deprecated", + "vscode.extension.contributes.debuggers.windows", + "vscode.extension.contributes.debuggers.windows.runtime", + "vscode.extension.contributes.debuggers.osx", + "vscode.extension.contributes.debuggers.osx.runtime", + "vscode.extension.contributes.debuggers.linux", + "vscode.extension.contributes.debuggers.linux.runtime", + "vscode.extension.contributes.debuggers.strings", + "vscode.extension.contributes.debuggers.strings.unverifiedBreakpoints", + "vscode.extension.contributes.breakpoints", + "vscode.extension.contributes.breakpoints.language", + "vscode.extension.contributes.breakpoints.when", + "presentation", + "presentation.hidden", + "presentation.group", + "presentation.order", + "app.launch.json.title", + "app.launch.json.version", + "app.launch.json.configurations", + "app.launch.json.compounds", + "app.launch.json.compound.name", + "useUniqueNames", + "app.launch.json.compound.name", + "app.launch.json.compound.folder", + "app.launch.json.compounds.configurations", + "app.launch.json.compound.stopAll", + "compoundPrelaunchTask", + "debugger name", + "debugger type", + "debuggers" + ], + "vs/workbench/contrib/debug/common/debugSource": [ + "unknownSource" + ], + "vs/workbench/contrib/debug/common/disassemblyViewInput": [ + "disassemblyEditorLabelIcon", + "disassemblyInputName" + ], + "vs/workbench/contrib/debug/common/loadedScriptsPicker": [ + "moveFocusedView.selectView" + ], + "vs/workbench/contrib/debug/common/replModel": [ + "consoleCleared" + ], + "vs/workbench/contrib/debug/node/debugAdapter": [ + "debugAdapterBinNotFound", + { + "key": "debugAdapterCannotDetermineExecutable", + "comment": [ + "Adapter executable file not found" + ] + }, + "unableToLaunchDebugAdapter", + "unableToLaunchDebugAdapterNoArgs" + ], + "vs/workbench/contrib/dropOrPasteInto/browser/commands": [ + "configureDefaultPaste.label", + "configureDefaultDrop.label" + ], + "vs/workbench/contrib/dropOrPasteInto/browser/configurationSchema": [ + "dropPreferredDescription", + "dropKind", + "pastePreferredDescription", + "pasteKind" + ], + "vs/workbench/contrib/editSessions/browser/editSessions.contribution": [ + "continueOn.installAdditional", + "resuming working changes window", + "autoStoreWorkingChanges", + "check for pending cloud changes", + "store working changes", + "store your working changes", + "storing working changes", + "checkingForWorkingChanges", + "no cloud changes", + "no cloud changes for ref", + "client too old", + "resume edit session warning many", + "resume edit session warning 1", + "resume failed", + "editSessionPartialMatch", + "resume", + "payload too large", + "no working changes to store", + "payload too large", + "payload failed", + "continue with cloud changes", + "with cloud changes", + "without cloud changes", + "continueEditSession.openLocalFolder.title.v2", + "continueWorkingOn.existingLocalFolder", + "continueEditSessionPick.title.v2", + "continueEditSessionItem.openInLocalFolder.v2", + "continueEditSessionItem.builtin", + "learnMoreTooltip", + "continueEditSessionExtPoint", + "continueEditSessionExtPoint.command", + "continueEditSessionExtPoint.group", + "continueEditSessionExtPoint.qualifiedName", + "continueEditSessionExtPoint.description", + "continueEditSessionExtPoint.remoteGroup", + "continueEditSessionExtPoint.when", + "autoStoreWorkingChanges.onShutdown", + "autoStoreWorkingChanges.off", + "autoStoreWorkingChangesDescription", + "autoResumeWorkingChanges.onReload", + "autoResumeWorkingChanges.off", + "autoResumeWorkingChanges", + "continueOnCloudChanges.promptForAuth", + "continueOnCloudChanges.off", + "continueOnCloudChanges", + "cloudChangesPartialMatchesEnabled", + "continue working on", + "continue edit session in local folder", + "show log", + "show cloud changes", + "resume latest cloud changes", + "resume cloud changes", + "store working changes in cloud" + ], + "vs/workbench/contrib/editSessions/browser/editSessionsStorageService": [ + "choose account read placeholder", + "choose account placeholder", + "signed in", + "others", + "sign in using account", + "sign in", + "sign in badge", + "reset auth.v3", + "sign out of cloud changes clear data prompt", + "delete all cloud changes" + ], + "vs/workbench/contrib/editSessions/browser/editSessionsViews": [ + "noStoredChanges", + "storeWorkingChangesTitle", + "workbench.editSessions.actions.resume.v2", + "workbench.editSessions.actions.store.v2", + "workbench.editSessions.actions.delete.v2", + "confirm delete.v2", + "confirm delete detail.v2", + "workbench.editSessions.actions.deleteAll", + "confirm delete all", + "confirm delete all detail", + "compare changes", + "local copy", + "cloud changes", + "open file" + ], + "vs/workbench/contrib/editSessions/common/editSessions": [ + "editSessionViewIcon", + "cloud changes", + "cloud changes" + ], + "vs/workbench/contrib/editSessions/common/editSessionsLogService": [ + "cloudChangesLog" + ], + "vs/workbench/contrib/editTelemetry/browser/editStats/aiStatsStatusBar": [ + "inlineSuggestions", + "inlineSuggestionsStatusBar", + "aiStatsStatusBarHeader", + "aiStats.statusBar.configure", + "text1", + "text2" + ], + "vs/workbench/contrib/editTelemetry/browser/editTelemetry.contribution": [ + "editTelemetry", + "telemetry.editStats.enabled", + "editor.aiStats.enabled", + "telemetry.editStats.detailed.enabled", + "telemetry.editStats.showStatusBar", + "telemetry.editStats.showDecorations" + ], + "vs/workbench/contrib/emmet/browser/actions/expandAbbreviation": [ + { + "key": "miEmmetExpandAbbreviation", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "expandAbbreviationAction" + ], + "vs/workbench/contrib/extensions/browser/abstractRuntimeExtensionsEditor": [ + { + "key": "starActivation", + "comment": [ + "{0} will be an extension identifier" + ] + }, + { + "key": "workspaceContainsGlobActivation", + "comment": [ + "{0} will be a glob pattern", + "{1} will be an extension identifier" + ] + }, + { + "key": "workspaceContainsFileActivation", + "comment": [ + "{0} will be a file name", + "{1} will be an extension identifier" + ] + }, + { + "key": "workspaceContainsTimeout", + "comment": [ + "{0} will be a glob pattern", + "{1} will be an extension identifier" + ] + }, + { + "key": "startupFinishedActivation", + "comment": [ + "This refers to an extension. {0} will be an activation event." + ] + }, + "languageActivation", + { + "key": "workspaceGenericActivation", + "comment": [ + "{0} will be an activation event, like e.g. 'language:typescript', 'debug', etc.", + "{1} will be an extension identifier" + ] + }, + "extensionActivating", + "unresponsive.title", + "errors", + "requests count", + "session requests count", + "requests count title", + "runtimeExtensions", + "copy id", + "disable workspace", + "disable", + "showRuntimeExtensions" + ], + "vs/workbench/contrib/extensions/browser/configBasedRecommendations": [ + "exeBasedRecommendation" + ], + "vs/workbench/contrib/extensions/browser/exeBasedRecommendations": [ + "exeBasedRecommendation" + ], + "vs/workbench/contrib/extensions/browser/extensionEditor": [ + "extension version", + "name", + "preview", + "preview", + "builtin", + "details", + "detailstooltip", + "features", + "featurestooltip", + "changelog", + "changelogtooltip", + "dependencies", + "dependenciestooltip", + "extensionpack", + "extensionpacktooltip", + "noReadme", + "Readme title", + "extension pack", + "noReadme", + "Readme title", + "noChangelog", + "Changelog title", + "noDependencies", + "categories", + "repository", + "issues", + "license", + "Marketplace", + "resources", + "Install Info", + "id", + "Version", + "last updated", + "vsix", + "other", + "source", + "size when installed", + "size", + "disk space used", + "cache size", + "Marketplace Info", + "id", + "Version", + "published", + "last released", + "find", + "find next", + "find previous" + ], + "vs/workbench/contrib/extensions/browser/extensionEnablementWorkspaceTrustTransitionParticipant": [ + "restartExtensionHost.reason" + ], + "vs/workbench/contrib/extensions/browser/extensionFeaturesTab": [ + "activation", + "label", + "chartDescription", + "uncaught errors", + "messaages", + "runtime", + "noFeatures", + "extension features list", + "revoked", + "accessExtensionFeature", + "disableAccessExtensionFeatureMessage", + "enableAccessExtensionFeatureMessage", + "revoke", + "grant", + "cancel", + "revoke", + "enable" + ], + "vs/workbench/contrib/extensions/browser/extensionRecommendationNotificationService": [ + "ignoreExtensionRecommendations", + "ignoreAll", + "no", + { + "key": "this repository", + "comment": [ + "this repository means the current repository that is opened" + ] + }, + "extensionFromPublisher", + "extensionsFromMultiplePublishers", + "extensionsFromPublishers", + "extensionsFromPublisher", + "recommended", + { + "key": "exeRecommended", + "comment": [ + "Placeholder string is the name of the software that is installed." + ] + }, + "donotShowAgain", + "donotShowAgainExtension", + "donotShowAgainExtensionSingle", + "install", + "install and do no sync", + "show recommendations" + ], + "vs/workbench/contrib/extensions/browser/extensions.contribution": [ + "manageExtensionsQuickAccessPlaceholder", + "manageExtensionsHelp", + "extension", + { + "key": "miViewExtensions", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "extensionsConfigurationTitle", + "all", + "enabled", + "none", + "extensions.autoUpdate.true", + "extensions.autoUpdate.enabled", + "extensions.autoUpdate.false", + "extensions.autoUpdate", + "extensionsCheckUpdates", + "extensionsIgnoreRecommendations", + "extensionsShowRecommendationsOnlyOnDemand_Deprecated", + "extensionsCloseExtensionDetailsOnViewChange", + "handleUriConfirmedExtensions", + "extensionsWebWorker.true", + "extensionsWebWorker.false", + "extensionsWebWorker.auto", + "extensionsWebWorker", + "extensions.supportVirtualWorkspaces", + "extensions.affinity", + "extensions.supportUntrustedWorkspaces", + "extensions.supportUntrustedWorkspaces.true", + "extensions.supportUntrustedWorkspaces.false", + "extensions.supportUntrustedWorkspaces.limited", + "extensions.supportUntrustedWorkspaces.supported", + "extensions.supportUntrustedWorkspaces.version", + "extensionsDeferredStartupFinishedActivation", + "extensionsInQuickAccess", + "extensions.verifySignature", + "autoRestart", + "extensions.gallery.serviceUrl", + "extensions.gallery.serviceUrl", + "extensionsSupportNodeGlobalNavigator", + "extensionsRequestTimeout", + "notFound", + "workbench.extensions.installExtension.description", + "workbench.extensions.installExtension.arg.decription", + "workbench.extensions.installExtension.option.installOnlyNewlyAddedFromExtensionPackVSIX", + "workbench.extensions.installExtension.option.installPreReleaseVersion", + "workbench.extensions.installExtension.option.donotSync", + "workbench.extensions.installExtension.option.justification", + "workbench.extensions.installExtension.option.enable", + "workbench.extensions.installExtension.option.context", + "notFound", + "workbench.extensions.uninstallExtension.description", + "workbench.extensions.uninstallExtension.arg.name", + "id required", + "notInstalled", + "builtin", + "workbench.extensions.search.description", + "workbench.extensions.search.arg.name", + "installExtensionQuickAccessPlaceholder", + "installExtensionQuickAccessHelp", + { + "key": "miPreferencesExtensions", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "showExtensions", + "importKeyboardShortcutsFroms", + "noUpdatesAvailable", + "installFromVSIX", + { + "key": "installButton", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "installVSIX", + "InstallVSIXs.successReload", + "InstallVSIXAction.successReload", + "InstallVSIXAction.reloadNow", + "InstallVSIXs.successRestart", + "InstallVSIXAction.successRestart", + "InstallVSIXAction.restartExtensions", + "InstallVSIXs.successNoReload", + "InstallVSIXAction.successNoReload", + "installFromLocation", + "install button", + "installFromLocationPlaceHolder", + "installFromLocation", + "filterExtensions", + "featured filter", + "most popular filter", + "most popular recommended", + "recently published filter", + "filter by category", + "installed filter", + "builtin filter", + "extension updates filter", + "workspace unsupported filter", + "enabled filter", + "disabled filter", + "sorty by", + "sort by installs", + "sort by rating", + "sort by name", + "sort by published date", + "sort by update date", + "installWorkspaceRecommendedExtensions", + "enablePreRleaseLabel", + "disablePreRleaseLabel", + "install", + "install installAndDonotSync", + "installPrereleaseAndDonotSync", + "extensionInfoName", + "extensionInfoId", + "extensionInfoDescription", + "extensionInfoVersion", + "extensionInfoPublisher", + "extensionInfoVSMarketplaceLink", + "download VSIX", + "download pre-release", + "download specific version", + "trustedPublishers", + "trustedPublishersPlaceholder", + "extensions", + "focusExtensions", + "installExtensions", + "showRecommendedKeymapExtensionsShort", + "showLanguageExtensionsShort", + "checkForUpdates", + "enableAutoUpdate", + "disableAutoUpdate", + "updateAll", + "enableAll", + "enableAllWorkspace", + "disableAll", + "disableAllWorkspace", + "InstallFromVSIX", + "installExtensionFromLocation", + "showFeaturedExtensions", + "showPopularExtensions", + "showRecommendedExtensions", + "recentlyPublishedExtensions", + "installedExtensions", + "showBuiltInExtensions", + "extensionUpdates", + "showWorkspaceUnsupportedExtensions", + "showEnabledExtensions", + "showDisabledExtensions", + "clearExtensionsSearchResults", + "refreshExtension", + "show pre-release version", + "show released version", + "workbench.extensions.action.copyExtension", + "workbench.extensions.action.copyExtensionId", + "workbench.extensions.action.copyLink", + "workbench.extensions.action.configure", + "workbench.extensions.action.changeAccountPreference", + "workbench.extensions.action.configureKeybindings", + "workbench.extensions.action.toggleApplyToAllProfiles", + "workbench.extensions.action.toggleIgnoreExtension", + "workbench.extensions.action.ignoreRecommendation", + "workbench.extensions.action.undoIgnoredRecommendation", + "workbench.extensions.action.addExtensionToWorkspaceRecommendations", + "workbench.extensions.action.removeExtensionFromWorkspaceRecommendations", + "workbench.extensions.action.addToWorkspaceRecommendations", + "workbench.extensions.action.addToWorkspaceFolderRecommendations", + "workbench.extensions.action.addToWorkspaceIgnoredRecommendations", + "workbench.extensions.action.addToWorkspaceFolderIgnoredRecommendations", + "workbench.extensions.action.manageTrustedPublishers", + "signInToMarketplace" + ], + "vs/workbench/contrib/extensions/browser/extensions.web.contribution": [ + "runtimeExtension" + ], + "vs/workbench/contrib/extensions/browser/extensionsActions": [ + "VS Code for Web", + "cannot be installed", + { + "key": "more information", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "close", + "install prerelease", + "cancel", + "not signed", + "install anyway", + "verification failed", + "learn more", + "install donot verify", + "verification failed", + "learn more", + "report issue", + "report issue title", + "report issue body", + "install donot verify", + "update operation", + "install operation", + "check logs", + "download", + "install vsix", + "installVSIX", + "install", + "not signed", + "not signed detail", + "install anyway", + "deprecated message", + "install anyway", + "deprecated with alternate extension message", + { + "key": "Show alternate extension", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "deprecated with alternate settings message", + { + "key": "configure in settings", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "install confirmation", + "installExtensionStart", + "installExtensionComplete", + "install workspace version", + "install pre-release", + "install pre-release version", + "install", + "install release version", + "install", + "installing", + "install", + "installing", + "installExtensionStart", + { + "key": "install in remote", + "comment": [ + "This is the name of the action to install an extension in remote server. Placeholder is for the name of remote server." + ] + }, + "install locally", + "install browser", + "uninstallAction", + "Uninstalling", + "uninstallAll", + "uninstallExtensionStart", + "uninstallExtensionComplete", + "update", + "update to", + "update", + "updateExtensionConsentTitle", + "updateExtensionConsent", + "update", + "review", + "cancel", + "updateExtensionStart", + "updateExtensionComplete", + "enableAutoUpdate", + "disableAutoUpdate", + "toggleAutoUpdatesForPublisherLabel", + "ignoreExtensionUpdatePublisher", + "enableAutoUpdate", + "disableAutoUpdate", + "migrateExtension", + "migrate to", + "migrate", + "manage", + "manage", + "togglePreRleaseLabel", + "togglePreRleaseDisableLabel", + "togglePreRleaseDisableTooltip", + "switchToPreReleaseLabel", + "switchToPreReleaseTooltip", + "install another version", + "no versions", + "pre-release", + "current", + "selectVersion", + "enableForWorkspaceAction", + "enableForWorkspaceActionToolTip", + "enableGloballyAction", + "enableGloballyActionToolTip", + "disableForWorkspaceAction", + "disableForWorkspaceActionToolTip", + "disableGloballyAction", + "disableGloballyActionToolTip", + "reload window", + "restart extensions", + "restart product", + "update product", + "current", + "select color theme", + "select file icon theme", + "select product icon theme", + "showRecommendedExtension", + "installRecommendedExtension", + "ignoreExtensionRecommendation", + "undo", + "OpenExtensionsFile.failed", + "configureWorkspaceRecommendedExtensions", + "configureWorkspaceFolderRecommendedExtensions", + "installed", + "updated", + "uninstalled", + "enabled", + "disabled", + "ignored", + "synced", + "sync", + "do not sync", + "malicious tooltip", + "not signed tooltip", + "deprecated with alternate extension tooltip", + "settings", + "deprecated with alternate settings tooltip", + "deprecated tooltip", + "missing from gallery tooltip", + "auto update message", + "disabled - not allowed", + "disabled by environment", + "enabled by environment", + "disabled because of virtual workspace", + "extension limited because of virtual workspace", + "extension disabled because of unification", + "extension disabled because of trust requirement", + "extension limited because of trust requirement", + "Install in remote server to enable", + "learn more", + "Install in local server to enable", + "learn more", + "Defined to run in desktop", + "learn more", + "Cannot be enabled", + "learn more", + "manage access", + "Install language pack also in remote server", + "Install language pack also locally", + "enabled remotely", + "learn more", + "enabled locally", + "learn more", + "enabled in web worker", + "learn more", + "extension disabled because of dependency", + "dependencies", + "workspace enabled", + "extension enabled on remote", + "globally disabled", + "workspace disabled", + "install previous version", + "selectExtension", + "select extensions to install", + "no local extensions", + "installing extensions", + "finished installing", + "select and install local extensions", + "install local extensions title", + "select and install remote extensions", + "install remote extensions", + "extensionButtonBackground", + "extensionButtonForeground", + "extensionButtonHoverBackground", + "extensionButtonSeparator", + "extensionButtonProminentBackground", + "extensionButtonProminentForeground", + "extensionButtonProminentHoverBackground", + "enableAutoUpdateLabel", + "workbench.extensions.action.setColorTheme", + "workbench.extensions.action.setFileIconTheme", + "workbench.extensions.action.setProductIconTheme", + "workbench.extensions.action.setDisplayLanguage", + "workbench.extensions.action.clearLanguage" + ], + "vs/workbench/contrib/extensions/browser/extensionsActivationProgress": [ + "activation" + ], + "vs/workbench/contrib/extensions/browser/extensionsCompletionItemsProvider": [ + "exampleExtension" + ], + "vs/workbench/contrib/extensions/browser/extensionsDependencyChecker": [ + "extensions", + "auto install missing deps", + "finished installing missing deps", + "reload", + "no missing deps" + ], + "vs/workbench/contrib/extensions/browser/extensionsIcons": [ + "extensionsViewIcon", + "manageExtensionIcon", + "clearSearchResultsIcon", + "refreshIcon", + "filterIcon", + "installLocalInRemoteIcon", + "installWorkspaceRecommendedIcon", + "configureRecommendedIcon", + "syncEnabledIcon", + "syncIgnoredIcon", + "remoteIcon", + "installCountIcon", + "lockIcon", + "ratingIcon", + "preReleaseIcon", + "sponsorIcon", + "starFullIcon", + "starHalfIcon", + "starEmptyIcon", + "errorIcon", + "warningIcon", + "infoIcon", + "trustIcon", + "activationtimeIcon" + ], + "vs/workbench/contrib/extensions/browser/extensionsQuickAccess": [ + "type", + "searchFor", + "install", + "manage" + ], + "vs/workbench/contrib/extensions/browser/extensionsViewer": [ + "extension.arialabel.verifiedPublisher", + "extension.arialabel.publisher", + "extension.arialabel.deprecated", + "extension.arialabel.rating", + "extensions", + "error", + "Unknown Extension", + "extensions" + ], + "vs/workbench/contrib/extensions/browser/extensionsViewlet": [ + "sign in", + "access denied", + "installed", + "searchExtensions", + "click show", + "show", + "dismiss", + "dismiss hover", + "extensionFoundInSection", + "extensionFound", + "extensionsFoundInSection", + "extensionsFound", + "suggestProxyError", + "open user settings", + "extensionToUpdate", + "extensionsToUpdate", + "extensionToReload", + "extensionsToReload", + "restartNow", + "reloadNow", + "learnMore", + "malicious warning", + "signInRequired", + "accessDenied", + "sign in enterprise marketplace", + { + "key": "remote", + "comment": [ + "Remote as in remote machine" + ] + }, + "marketPlace", + "select and install local extensions", + "install remote in local", + "popularExtensions", + "recommendedExtensions", + "enabledExtensions", + "disabledExtensions", + "marketPlace", + "installed", + "recently updated", + "enabled", + "disabled", + "availableUpdates", + "builtin", + "workspaceUnsupported", + "workspaceRecommendedExtensions", + "otherRecommendedExtensions", + "builtinFeatureExtensions", + "builtInThemesExtensions", + "builtinProgrammingLanguageExtensions", + "untrustedUnsupportedExtensions", + "untrustedPartiallySupportedExtensions", + "virtualUnsupportedExtensions", + "virtualPartiallySupportedExtensions", + "deprecated" + ], + "vs/workbench/contrib/extensions/browser/extensionsViews": [ + "showing local extensions only", + "no extensions found", + "offline error", + "error", + "no local extensions" + ], + "vs/workbench/contrib/extensions/browser/extensionsWidgets": [ + "install count", + "ratedLabel", + "publisher", + "verified publisher", + "sponsor", + "remote extension title", + "privateExtension", + "workspace extension", + "local extension", + "syncingore.label", + "feature access label", + "privateExtension", + "sponsor", + "workspace extension", + "local extension", + "publisher verified tooltip", + "updateRequired", + "activation", + "startup", + "uncaught error", + "uncaught errors", + "message", + "messages", + "feature usage label", + "total", + "Show prerelease version", + "has prerelease", + "recommendationHasBeenIgnored", + "extensionIconStarForeground", + "extensionPreReleaseForeground", + "extensionIcon.sponsorForeground", + "extensionIcon.private" + ], + "vs/workbench/contrib/extensions/browser/extensionsWorkbenchService": [ + "Manifest is not found", + "confirmEnableDisableAutoUpdate", + "confirmEnableAutoUpdate", + "confirmDisableAutoUpdate", + "confirmEnableDisableAutoUpdateDetail", + "updatingExtensions", + "disallowed extensions by policy", + "disallowed extensions", + "incompatibleExtensions", + "invalidExtensions", + "deprecated extensions", + "restart", + "extensionsAutoRestart", + "reload", + "restart extensions", + "postUninstallTooltip", + "postUpdateDownloadTooltip", + "postUpdateUpdateTooltip", + "postUpdateRestartTooltip", + "postUpdateTooltip", + "enable locally", + "enable remote", + "postEnableTooltip", + "postEnableTooltip", + "postDisableTooltip", + "postEnableTooltip", + "postEnableTooltip", + "extension not found", + "allplatforms", + "platform placeholder", + "download title", + "download", + "downloading...", + "download.completed", + "download.failed", + "no versions", + "pre-release", + "selectVersion", + "consentRequiredToUpdateRepublishedExtension", + "consentRequiredToUpdate", + "not an extension", + "malicious", + "disallowed", + "not signed", + "cannot be installed", + "cannot be installed", + "malicious", + "report issue", + "not found version", + "not found", + { + "key": "installButtonLabel", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "installButtonLabelWithAction", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "open", + "installExtensionTitle", + "installExtensionMessage", + "installVSIXMessage", + "sync extension", + "unknown", + "enableExtensionTitle", + "enableExtensionMessage", + { + "key": "enableButtonLabel", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "enableButtonLabelWithAction", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "incompatible", + "uninstallApplicationScoped", + "uninstallApplicationScopedMessage", + "uninstallAllProfiles", + "uninstallDependents", + "uninstallAll", + "uninstallingExtension", + "singleDependentUninstallError", + "twoDependentsUninstallError", + "multipleDependentsUninstallError", + "installing named extension", + "installing extension", + "disableDependents", + "disable all", + "singleDependentError", + "twoDependentsError", + "multipleDependentsError" + ], + "vs/workbench/contrib/extensions/browser/fileBasedRecommendations": [ + "fileBasedRecommendation", + "languageName" + ], + "vs/workbench/contrib/extensions/browser/webRecommendations": [ + "reason" + ], + "vs/workbench/contrib/extensions/browser/workspaceRecommendations": [ + "workspaceRecommendation", + "workspaceRecommendation" + ], + "vs/workbench/contrib/extensions/common/extensions": [ + "extensions" + ], + "vs/workbench/contrib/extensions/common/extensionsFileTemplate": [ + "app.extensions.json.title", + "app.extensions.json.recommendations", + "app.extension.identifier.errorMessage", + "app.extensions.json.unwantedRecommendations", + "app.extension.identifier.errorMessage" + ], + "vs/workbench/contrib/extensions/common/extensionsInput": [ + "extensionsEditorLabelIcon", + "extensionsInputName" + ], + "vs/workbench/contrib/extensions/common/extensionsUtils": [ + "disableOtherKeymapsConfirmation", + "yes", + "no" + ], + "vs/workbench/contrib/extensions/common/installExtensionsTool": [ + "installExtensionsTool.displayName", + "installExtensionsTool.userDescription", + "installExtensionsTool.confirmationTitle", + "installExtensionsTool.confirmationMessage", + "installExtensionsTool.resultMessage", + "installExtensionsTool.noResultMessage" + ], + "vs/workbench/contrib/extensions/common/reportExtensionIssueAction": [ + "reportExtensionIssue" + ], + "vs/workbench/contrib/extensions/common/runtimeExtensionsInput": [ + "runtimeExtensionEditorLabelIcon", + "extensionsInputName" + ], + "vs/workbench/contrib/extensions/common/searchExtensionsTool": [ + "searchExtensionsTool.displayName", + "searchExtensionsTool.userDescription", + "searchExtensionsTool.noInput" + ], + "vs/workbench/contrib/extensions/electron-browser/debugExtensionHostAction": [ + "selectExtensionHost", + "restart1", + "restart2", + { + "key": "restart3", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "debugExtensionHost.progress", + "debugExtensionHost.launch.name", + "openDevToolsForExtensionHost", + "debugExtensionHost" + ], + "vs/workbench/contrib/extensions/electron-browser/extensionProfileService": [ + "status.profiler", + "profilingExtensionHost", + "profilingExtensionHost", + "selectAndStartDebug", + "profilingExtensionHostTime", + "restart1", + "restart2", + { + "key": "restart3", + "comment": [ + "&& denotes a mnemonic" + ] + } + ], + "vs/workbench/contrib/extensions/electron-browser/extensions.contribution": [ + "runtimeExtension" + ], + "vs/workbench/contrib/extensions/electron-browser/extensionsActions": [ + "openExtensionsFolder", + "cleanUpExtensionsFolder" + ], + "vs/workbench/contrib/extensions/electron-browser/extensionsAutoProfiler": [ + "unresponsive-exthost", + "show" + ], + "vs/workbench/contrib/extensions/electron-browser/extensionsSlowActions": [ + "cmd.reportOrShow", + "cmd.report", + "attach.title", + "attach.msg", + "cmd.show", + "attach.title", + "attach.msg2" + ], + "vs/workbench/contrib/extensions/electron-browser/runtimeExtensionsEditor": [ + "extensionHostProfileStart", + "stopExtensionHostProfileStart", + "openExtensionHostProfile", + "saveExtensionHostProfile", + "saveprofile.dialogTitle" + ], + "vs/workbench/contrib/externalTerminal/browser/externalTerminal.contribution": [ + "scopedConsoleAction.Integrated", + "scopedConsoleAction.external", + "scopedConsoleAction.wt" + ], + "vs/workbench/contrib/externalTerminal/electron-browser/externalTerminal.contribution": [ + "terminal.kind.integrated", + "terminal.kind.external", + "terminal.kind.both", + "terminalConfigurationTitle", + "explorer.openInTerminalKind", + "sourceControlRepositories.openInTerminalKind", + "terminal.external.windowsExec", + "terminal.external.osxExec", + "terminal.external.linuxExec", + "globalConsoleAction" + ], + "vs/workbench/contrib/externalUriOpener/common/configuration": [ + "externalUriOpeners", + "externalUriOpeners.uri", + "externalUriOpeners.uri", + "externalUriOpeners.defaultId" + ], + "vs/workbench/contrib/externalUriOpener/common/externalUriOpenerService": [ + "selectOpenerDefaultLabel.web", + "selectOpenerDefaultLabel", + "selectOpenerConfigureTitle", + "selectOpenerPlaceHolder" + ], + "vs/workbench/contrib/files/browser/editors/binaryFileEditor": [ + "binaryFileEditor" + ], + "vs/workbench/contrib/files/browser/editors/textFileEditor": [ + "textFileEditor", + "openFolder", + "reveal", + "fileIsDirectory", + "fileTooLargeForHeapErrorWithSize", + "fileTooLargeForHeapErrorWithoutSize", + "unavailableResourceErrorEditorText", + "createFile" + ], + "vs/workbench/contrib/files/browser/editors/textFileSaveErrorHandler": [ + "userGuide", + "staleSaveError", + "readonlySaveErrorAdmin", + "readonlySaveErrorSudo", + "readonlySaveError", + "permissionDeniedSaveError", + "permissionDeniedSaveErrorSudo", + { + "key": "genericSaveError", + "comment": [ + "{0} is the resource that failed to save and {1} the error message" + ] + }, + "learnMore", + "dontShowAgain", + "compareChanges", + "saveConflictDiffLabel", + "overwriteElevated", + "overwriteElevatedSudo", + "saveElevated", + "saveElevatedSudo", + "retry", + "revert", + "overwrite", + "overwrite", + "configure" + ], + "vs/workbench/contrib/files/browser/explorerViewlet": [ + "explorerViewIcon", + "openEditorsIcon", + { + "key": "miViewExplorer", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "openFolder", + "addAFolder", + "openRecent", + { + "key": "noWorkspaceHelp", + "comment": [ + "Please do not translate the word \"command\", it is part of our internal syntax which must not change" + ] + }, + { + "key": "noFolderHelpWeb", + "comment": [ + "Please do not translate the word \"command\", it is part of our internal syntax which must not change" + ] + }, + { + "key": "remoteNoFolderHelp", + "comment": [ + "Please do not translate the word \"command\", it is part of our internal syntax which must not change" + ] + }, + { + "key": "noFolderButEditorsHelp", + "comment": [ + "Please do not translate the word \"command\", it is part of our internal syntax which must not change" + ] + }, + { + "key": "noFolderHelp", + "comment": [ + "Please do not translate the word \"command\", it is part of our internal syntax which must not change" + ] + }, + "folders", + "explore", + "explore" + ], + "vs/workbench/contrib/files/browser/fileActions.contribution": [ + "copyPath", + "copyRelativePath", + "revealInSideBar", + "acceptLocalChanges", + "revertLocalChanges", + "openToSide", + "reopenWith", + "revert", + "saveAll", + "compareWithSaved", + "compareWithSelected", + "compareSource", + "compareSelected", + "close", + "closeOthers", + "closeSaved", + "closeAll", + "explorerOpenWith", + "cut", + "deleteFile", + "deleteFile", + "newFile", + "openFile", + { + "key": "miNewFile", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miSave", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miSaveAs", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miSaveAll", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miAutoSave", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miRevert", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miCloseEditor", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miGotoFile", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "copyPathOfActive", + "copyRelativePathOfActive", + "saveAllInGroup", + "saveFiles", + "revert", + "compareActiveWithSaved", + "compareActiveWithSavedMeta", + "newFolderDescription" + ], + "vs/workbench/contrib/files/browser/fileActions": [ + "rename", + "delete", + "copyFile", + "pasteFile", + "download", + "upload", + "deleteButtonLabelRecycleBin", + { + "key": "deleteButtonLabelTrash", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "deleteButtonLabel", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "dirtyMessageFilesDelete", + "dirtyMessageFolderOneDelete", + "dirtyMessageFolderDelete", + "dirtyMessageFileDelete", + "dirtyWarning", + "readonlyMessageFilesDelete", + "readonlyMessageFolderOneDelete", + "readonlyMessageFolderDelete", + "continueDetail", + "continueButtonLabel", + "irreversible", + "restorePlural", + "restore", + "undoBinFiles", + "undoBin", + "undoTrashFiles", + "undoTrash", + "doNotAskAgain", + { + "key": "deleteBulkEdit", + "comment": [ + "Placeholder will be replaced by the number of files deleted" + ] + }, + { + "key": "deleteFileBulkEdit", + "comment": [ + "Placeholder will be replaced by the name of the file deleted" + ] + }, + { + "key": "deletingBulkEdit", + "comment": [ + "Placeholder will be replaced by the number of files deleted" + ] + }, + { + "key": "deletingFileBulkEdit", + "comment": [ + "Placeholder will be replaced by the name of the file deleted" + ] + }, + "binFailed", + "trashFailed", + { + "key": "deletePermanentlyButtonLabel", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "retryButtonLabel", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "confirmMoveTrashMessageFilesAndDirectories", + "confirmMoveTrashMessageMultipleDirectories", + "confirmMoveTrashMessageMultiple", + "confirmMoveTrashMessageFolder", + "confirmMoveTrashMessageFile", + "confirmDeleteMessageFilesAndDirectories", + "confirmDeleteMessageMultipleDirectories", + "confirmDeleteMessageMultiple", + "confirmDeleteMessageFolder", + "confirmDeleteMessageFile", + "confirmOverwrite", + "replaceButtonLabel", + "saveAllInGroup", + "closeGroup", + "openFileToShowInNewWindow.unsupportedschema", + "emptyFileNameError", + "fileNameStartsWithSlashError", + "fileNameExistsError", + "invalidFileNameError", + "fileNameWhitespaceWarning", + "clipboardComparisonLabel", + "retry", + "createBulkEdit", + "creatingBulkEdit", + "renameBulkEdit", + "renamingBulkEdit", + "confirmMultiPasteNative", + "confirmPasteNative", + "doNotAskAgain", + { + "key": "pasteButtonLabel", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "fileIsAncestor", + { + "key": "movingBulkEdit", + "comment": [ + "Placeholder will be replaced by the number of files being moved" + ] + }, + { + "key": "movingFileBulkEdit", + "comment": [ + "Placeholder will be replaced by the name of the file moved." + ] + }, + { + "key": "moveBulkEdit", + "comment": [ + "Placeholder will be replaced by the number of files being moved" + ] + }, + { + "key": "moveFileBulkEdit", + "comment": [ + "Placeholder will be replaced by the name of the file moved." + ] + }, + "fileDeleted", + { + "key": "copyingBulkEdit", + "comment": [ + "Placeholder will be replaced by the number of files being copied" + ] + }, + { + "key": "copyingFileBulkEdit", + "comment": [ + "Placeholder will be replaced by the name of the file copied." + ] + }, + { + "key": "copyBulkEdit", + "comment": [ + "Placeholder will be replaced by the number of files being copied" + ] + }, + { + "key": "copyFileBulkEdit", + "comment": [ + "Placeholder will be replaced by the name of the file copied." + ] + }, + "newFile", + "newFolder", + "globalCompareFile", + "compareFileWithMeta", + "toggleAutoSave", + "toggleAutoSaveDescription", + "focusFilesExplorer", + "focusFilesExplorerMetadata", + "showInExplorer", + "showInExplorerMetadata", + "openFileInEmptyWorkspace", + "openFileInEmptyWorkspaceMetadata", + "compareNewUntitledTextFiles", + "compareNewUntitledTextFilesMeta", + "compareWithClipboard", + "compareWithClipboardMeta", + "setActiveEditorReadonlyInSession", + "setActiveEditorWriteableInSession", + "toggleActiveEditorReadonlyInSession", + "resetActiveEditorReadonlyInSession" + ], + "vs/workbench/contrib/files/browser/fileCommands": [ + "modifiedLabel", + "retry", + "revertAll", + "revert", + { + "key": "genericSaveError", + "comment": [ + "{0} is the resource that failed to save and {1} the error message" + ] + }, + "genericRevertError", + "newFileCommand.saveLabel" + ], + "vs/workbench/contrib/files/browser/fileConstants": [ + "removeFolderFromWorkspace", + "saveAs", + "save", + "saveWithoutFormatting", + "saveAll", + "newUntitledFile" + ], + "vs/workbench/contrib/files/browser/fileImportExport": [ + "uploadingFiles", + "overwrite", + "overwriting", + "uploadProgressSmallMany", + "uploadProgressLarge", + "copyingFiles", + "copyFolders", + "copyFolder", + "addFolders", + "addFolder", + "dropFolders", + "dropFolder", + "copyfolders", + "copyfolder", + "filesInaccessible", + "fileInaccessible", + { + "comment": [ + "substitution will be the name of the file that was imported" + ], + "key": "importFile" + }, + { + "comment": [ + "substitution will be the number of files that were imported" + ], + "key": "importnFile" + }, + { + "comment": [ + "substitution will be the name of the file that was copied" + ], + "key": "copyingFile" + }, + { + "comment": [ + "substitution will be the number of files that were copied" + ], + "key": "copyingnFile" + }, + "downloadingFiles", + "downloadProgressSmallMany", + "downloadProgressLarge", + "downloadButton", + "chooseWhereToDownload", + "downloadBulkEdit", + "downloadingBulkEdit", + "confirmOverwrite", + "irreversible", + { + "key": "replaceButtonLabel", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "confirmManyOverwrites", + "irreversible", + { + "key": "replaceButtonLabel", + "comment": [ + "&& denotes a mnemonic" + ] + } + ], + "vs/workbench/contrib/files/browser/files.contribution": [ + "textFileEditor", + "binaryFileEditor", + "hotExit.off", + "hotExit.onExit", + "hotExit.onExitAndWindowClose", + "hotExit", + "hotExit.off", + "hotExit.onExitAndWindowCloseBrowser", + "hotExit", + "filesConfigurationTitle", + "exclude", + "trueDescription", + "falseDescription", + "files.exclude.boolean", + { + "key": "files.exclude.when", + "comment": [ + "\\$(basename) should not be translated" + ] + }, + "associations", + "encoding", + "autoGuessEncoding", + "candidateGuessEncodings", + "eol.LF", + "eol.CRLF", + "eol.auto", + "eol", + "useTrash", + "trimTrailingWhitespace", + "trimTrailingWhitespaceInRegexAndStrings", + "insertFinalNewline", + "trimFinalNewlines", + { + "comment": [ + "This is the description for a setting. Values surrounded by single quotes are not to be translated." + ], + "key": "files.autoSave.off" + }, + { + "comment": [ + "This is the description for a setting. Values surrounded by single quotes are not to be translated." + ], + "key": "files.autoSave.afterDelay" + }, + { + "comment": [ + "This is the description for a setting. Values surrounded by single quotes are not to be translated." + ], + "key": "files.autoSave.onFocusChange" + }, + { + "comment": [ + "This is the description for a setting. Values surrounded by single quotes are not to be translated." + ], + "key": "files.autoSave.onWindowChange" + }, + { + "comment": [ + "This is the description for a setting. Values surrounded by single quotes are not to be translated." + ], + "key": "autoSave" + }, + { + "comment": [ + "This is the description for a setting. Values surrounded by single quotes are not to be translated." + ], + "key": "autoSaveDelay" + }, + "autoSaveWorkspaceFilesOnly", + "autoSaveWhenNoErrors", + "watcherExclude", + "watcherInclude", + "defaultLanguage", + "filesReadonlyInclude", + "filesReadonlyExclude", + "filesReadonlyFromPermissions", + "files.restoreUndoStack", + "askUser", + "overwriteFileOnDisk", + "files.saveConflictResolution", + "defaultPathErrorMessage", + "fileDialogDefaultPath", + "files.simpleDialog.enable", + "files.participants.timeout", + "formatOnSave", + { + "key": "everything", + "comment": [ + "This is the description of an option" + ] + }, + { + "key": "modification", + "comment": [ + "This is the description of an option" + ] + }, + { + "key": "modificationIfAvailable", + "comment": [ + "This is the description of an option" + ] + }, + "formatOnSaveMode", + "explorerConfigurationTitle", + { + "key": "openEditorsVisible", + "comment": [ + "Open is an adjective" + ] + }, + { + "key": "openEditorsVisibleMin", + "comment": [ + "Open is an adjective" + ] + }, + { + "key": "openEditorsSortOrder", + "comment": [ + "Open is an adjective" + ] + }, + "sortOrder.editorOrder", + "sortOrder.alphabetical", + "sortOrder.fullPath", + "autoReveal.on", + "autoReveal.off", + "autoReveal.focusNoScroll", + "autoReveal", + "autoRevealExclude", + "explorer.autoRevealExclude.boolean", + "explorer.autoRevealExclude.when", + "enableDragAndDrop", + "confirmDragAndDrop", + "confirmPasteNative", + "confirmDelete", + "enableUndo", + "confirmUndo", + "enableUndo.verbose", + "enableUndo.default", + "enableUndo.light", + "expandSingleFolderWorkspaces", + "sortOrder.default", + "sortOrder.mixed", + "sortOrder.filesFirst", + "sortOrder.type", + "sortOrder.modified", + "sortOrder.foldersNestsFiles", + "sortOrder", + "sortOrderLexicographicOptions.default", + "sortOrderLexicographicOptions.upper", + "sortOrderLexicographicOptions.lower", + "sortOrderLexicographicOptions.unicode", + "sortOrderLexicographicOptions", + "sortOrderReverse", + "explorer.decorations.colors", + "explorer.decorations.badges", + "simple", + "smart", + "disabled", + "explorer.incrementalNaming", + "autoOpenDroppedFile", + "compressSingleChildFolders", + "copyRelativePathSeparator.slash", + "copyRelativePathSeparator.backslash", + "copyRelativePathSeparator.auto", + "copyRelativePathSeparator", + "copyPathSeparator.slash", + "copyPathSeparator.backslash", + "copyPathSeparator.auto", + "copyPathSeparator", + "excludeGitignore", + "fileNestingEnabled", + "fileNestingExpand", + "fileNestingPatterns", + "fileNesting.description" + ], + "vs/workbench/contrib/files/browser/views/emptyView": [ + "noWorkspace" + ], + "vs/workbench/contrib/files/browser/views/explorerDecorationsProvider": [ + "canNotResolve", + "symbolicLlink", + "unknown", + "label" + ], + "vs/workbench/contrib/files/browser/views/explorerView": [ + "explorerSection", + "createNewFile", + "createNewFolder", + "refreshExplorer", + "refreshExplorerMetadata", + "collapseExplorerFolders", + "collapseExplorerFoldersMetadata" + ], + "vs/workbench/contrib/files/browser/views/explorerViewer": [ + "searchMaxResultsWarning", + "searchMaxResultsWarning", + "treeAriaLabel", + "explorerHighlightFolderBadgeTitle", + "fileInputAriaLabel", + "confirmRootsMove", + "confirmMultiMove", + "confirmRootMove", + "confirmMove", + "doNotAskAgain", + { + "key": "moveButtonLabel", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "copy", + "copying", + "move", + "moving", + "numberOfFolders", + "numberOfFiles" + ], + "vs/workbench/contrib/files/browser/views/openEditorsView": [ + "dirtyCounter", + "openEditors", + { + "key": "miToggleEditorLayout", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "openEditors", + "comment": [ + "Open is an adjective" + ] + }, + "flipLayout", + "miToggleEditorLayoutWithoutMnemonic", + "newUntitledFile" + ], + "vs/workbench/contrib/files/browser/workspaceWatcher": [ + "enospcError", + "learnMore", + "eshutdownError", + "reload" + ], + "vs/workbench/contrib/files/common/dirtyFilesIndicator": [ + "dirtyFile", + "dirtyFiles" + ], + "vs/workbench/contrib/files/common/files": [ + "explorerViewletVisible", + "foldersViewVisible", + "explorerResourceIsFolder", + "explorerResourceReadonly", + "explorerResourceParentReadonly", + "explorerResourceIsRoot", + "explorerResourceCut", + "explorerResourceMoveableToTrash", + "filesExplorerFocus", + "openEditorsFocus", + "explorerViewletFocus", + "explorerFindProviderActive", + "explorerViewletCompressedFocus", + "explorerViewletCompressedFirstFocus", + "explorerViewletCompressedLastFocus", + "viewHasSomeCollapsibleItem" + ], + "vs/workbench/contrib/files/electron-browser/fileActions.contribution": [ + "miShare", + "revealInWindows", + "revealInMac", + "openContainer", + "filesCategory" + ], + "vs/workbench/contrib/folding/browser/folding.contribution": [ + "null", + "nullFormatterDescription", + "formatter.default" + ], + "vs/workbench/contrib/format/browser/formatActionsMultiple": [ + "null", + "nullFormatterDescription", + "miss.1", + "miss.2", + "config.needed", + "config.bad", + "miss", + { + "key": "do.config", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "do.config.notification", + "select", + "do.config.command", + "summary", + "formatter", + "formatter.default", + "def", + "config", + "format.placeHolder", + "select", + "formatDocument.label.multiple", + "formatSelection.label.multiple" + ], + "vs/workbench/contrib/format/browser/formatActionsNone": [ + "too.large", + "no.provider", + { + "key": "install.formatter", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "formatDocument.label.multiple" + ], + "vs/workbench/contrib/format/browser/formatModified": [ + "formatChanges" + ], + "vs/workbench/contrib/inlayHints/browser/inlayHintsAccessibilty": [ + "isReadingLineWithInlayHints", + "description", + "read.title", + "stop.title" + ], + "vs/workbench/contrib/inlineChat/browser/inlineChat.contribution": [ + "send.edit", + "send.generate", + "cancel", + "cancelShort" + ], + "vs/workbench/contrib/inlineChat/browser/inlineChatActions": [ + "startInlineChat", + "arrowUp", + "arrowDown", + "apply2", + "discard", + "rerun", + "close", + "viewInChat", + "run", + "focus", + "unstash", + "cat", + "apply1", + "chat.rerun.label", + "configure", + "moveToNextHunk", + "moveToPreviousHunk", + "showChanges", + "cat", + "Keep", + "close2" + ], + "vs/workbench/contrib/inlineChat/browser/inlineChatController": [ + "create.fail", + "welcome.2", + "empty", + "responseWasEmpty", + "err.apply", + "err.discard", + "askOrEditInContext", + "placeholder", + "placeholderWithSelection", + "loading", + "fixN", + "fix1" + ], + "vs/workbench/contrib/inlineChat/browser/inlineChatSessionServiceImpl": [ + "name", + "confirm.title", + "confirm", + "confirm.detail", + "confirm.yes", + "confirm.cancel", + "chat.remove.confirmation.checkbox", + "resetChoice.label" + ], + "vs/workbench/contrib/inlineChat/browser/inlineChatWidget": [ + "feedbackThanks", + "inlineChat.accessibilityHelp", + "inlineChat.accessibilityHelpNoKb", + { + "key": "termsDisclaimer", + "comment": [ + "{Locked=\"]({2})\"}", + "{Locked=\"]({3})\"}" + ] + }, + "aria-label" + ], + "vs/workbench/contrib/inlineChat/browser/inlineChatZoneWidget": [ + "inlineChatClosed" + ], + "vs/workbench/contrib/inlineChat/common/inlineChat": [ + "finishOnType", + "holdToSpeech", + "enableV2", + "notebookAgent", + "inlineChatHasPossible", + "inlineChatHasEditsAgent", + "inlineChatHasNotebookInline", + "inlineChatHasNotebookAgent", + "inlineChatVisible", + "inlineChatFocused", + "inlineChatEditing", + "inlineChatResponseFocused", + "inlineChatEmpty", + "inlineChatInnerCursorFirst", + "inlineChatInnerCursorLast", + "inlineChatOuterCursorPosition", + "inlineChatHasStashedSession", + "inlineChatChangeHasDiff", + "inlineChatChangeShowsDiff", + "inlineChatRequestInProgress", + "inlineChatResponseTypes", + "inlineChat.foreground", + "inlineChat.background", + "inlineChat.border", + "inlineChat.shadow", + "inlineChatInput.border", + "inlineChatInput.focusBorder", + "inlineChatInput.placeholderForeground", + "inlineChatInput.background", + "inlineChatDiff.inserted", + "editorOverviewRuler.inlineChatInserted", + "editorMinimap.inlineChatInserted", + "inlineChatDiff.removed", + "editorOverviewRuler.inlineChatRemoved" + ], + "vs/workbench/contrib/inlineChat/electron-browser/inlineChatActions": [ + "holdForSpeech" + ], + "vs/workbench/contrib/inlineCompletions/browser/inlineCompletionLanguageStatusBarContribution": [ + "inlineSuggestionLoading", + "inlineCompletionAvailable", + "inlineEditAvailable", + "noInlineSuggestionAvailable", + "inlineSuggestionsSmall", + "inlineSuggestions" + ], + "vs/workbench/contrib/interactive/browser/interactive.contribution": [ + "interactive.open", + "interactiveScrollToTop", + "interactiveScrollToBottom", + "interactive.activeCodeBorder", + "interactive.inactiveCodeBorder", + "interactiveWindow.alwaysScrollOnNewCell", + "interactiveWindow.promptToSaveOnClose", + "interactiveWindow.executeWithShiftEnter", + "interactiveWindow.showExecutionHint", + "interactiveWindow", + "interactive.open", + "interactive.execute", + "interactive.input.clear", + "interactive.history.previous", + "interactive.history.next", + "interactive.input.focus", + "interactive.history.focus" + ], + "vs/workbench/contrib/interactive/browser/replInputHintContentWidget": [ + "emptyHintText", + "ReplInputAriaLabelHelp", + "ReplInputAriaLabelHelpNoKb", + "disableHint" + ], + "vs/workbench/contrib/issue/browser/baseIssueReporterService": [ + "create", + "preview", + "privateCreate", + "internalPreviewMessage", + "acknowledge", + "createOnGitHub", + "createOnGitHub", + "previewOnGitHub", + "createInternally", + "selectExtension", + "hide", + "show", + "vscodePlaceholder", + "extensionPlaceholder", + "marketplacePlaceholder", + "undefinedPlaceholder", + "similarIssues", + "open", + "closed", + "open", + "closed", + "bugReporter", + "featureRequest", + "performanceIssue", + "selectSource", + "vscode", + "extension", + "marketplace", + "unknown", + "saveExtensionData", + "handlesIssuesElsewhere", + "elsewhereDescription", + "openIssueReporter", + "stepsToReproduce", + "bugDescription", + "stepsToReproduce", + "performanceIssueDesciption", + "description", + "featureRequestDescription", + "pasteData", + "disabledExtensions" + ], + "vs/workbench/contrib/issue/browser/issue.contribution": [ + "statusUnsupported" + ], + "vs/workbench/contrib/issue/browser/issueFormService": [ + "confirmCloseIssueReporter", + { + "key": "yes", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "cancel", + "issueReporterWriteToClipboard", + { + "key": "ok", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "cancel" + ], + "vs/workbench/contrib/issue/browser/issueQuickAccess": [ + "reportExtensionMarketplace", + "extensions", + "contributedIssuePage" + ], + "vs/workbench/contrib/issue/browser/issueReporterPage": [ + "sendSystemInfo", + "sendProcessInfo", + "sendWorkspaceInfo", + "sendExtensions", + "sendExperiments", + "sendExtensionData", + "acknowledgements", + { + "key": "reviewGuidanceLabel", + "comment": [ + "{Locked=\"\"}", + "{Locked=\"\"}" + ] + }, + "completeInEnglish", + "issueTypeLabel", + "issueSourceLabel", + "issueSourceEmptyValidation", + "disableExtensionsLabelText", + "disableExtensions", + "chooseExtension", + "extensionWithNonstandardBugsUrl", + "extensionWithNoBugsUrl", + "issueTitleLabel", + "issueTitleRequired", + "titleEmptyValidation", + "titleLengthValidation", + "details", + "descriptionEmptyValidation", + "descriptionTooShortValidation", + "show", + "downloadExtensionData", + "extensionData", + "show", + "show", + "show", + "show", + "show" + ], + "vs/workbench/contrib/issue/browser/issueReporterService": [ + "undefinedPlaceholder" + ], + "vs/workbench/contrib/issue/browser/issueTroubleshoot": [ + "troubleshoot issue", + "detail.start", + { + "key": "msg", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "profile.extensions.disabled", + "empty.profile", + "issue is with configuration", + "issue is in core", + "I cannot reproduce", + "This is Bad", + "Stop", + "troubleshoot issue", + "use insiders", + "troubleshoot issue", + "download insiders", + "report anyway", + "ask to download insiders", + "troubleshoot issue", + "good", + "bad", + "stop", + "ask to reproduce issue", + "troubleshootIssue", + "title.stop" + ], + "vs/workbench/contrib/issue/common/issue.contribution": [ + { + "key": "miReportIssue", + "comment": [ + "&& denotes a mnemonic", + "Translate this to \"Report Issue in English\" in all languages please!" + ] + }, + { + "key": "reportIssueInEnglish", + "comment": [ + "Translate this to \"Report Issue in English\" in all languages please!" + ] + } + ], + "vs/workbench/contrib/issue/electron-browser/issue.contribution": [ + "tasksQuickAccessPlaceholder", + "openIssueReporter", + { + "key": "reportPerformanceIssue", + "comment": [ + "Here, 'issue' means problem or bug" + ] + } + ], + "vs/workbench/contrib/issue/electron-browser/issueReporterService": [ + "updateAvailable", + "undefinedPlaceholder", + "saveExtensionData", + "pasteData", + "noCurrentExperiments" + ], + "vs/workbench/contrib/keybindings/browser/keybindings.contribution": [ + "toggleKeybindingsLog" + ], + "vs/workbench/contrib/languageDetection/browser/languageDetection.contribution": [ + "status.autoDetectLanguage", + "langDetection.name", + "langDetection.aria", + "noDetection", + "detectlang" + ], + "vs/workbench/contrib/languageStatus/browser/languageStatus": [ + "langStatus.name", + "langStatus.aria", + "unpin", + "pin", + "aria.1", + "aria.2", + "name.pattern", + "reset" + ], + "vs/workbench/contrib/limitIndicator/browser/limitIndicator.contribution": [ + "status.button.configure", + "colorDecoratorsStatusItem.name", + "status.limitedColorDecorators.short", + "colorDecoratorsStatusItem.source", + "foldingRangesStatusItem.name", + "status.limitedFoldingRanges.short", + "foldingRangesStatusItem.source", + "status.limited.details" + ], + "vs/workbench/contrib/list/browser/listResizeColumnAction": [ + "list.resizeColumn", + "list" + ], + "vs/workbench/contrib/list/browser/tableColumnResizeQuickPick": [ + "table.column.selection", + "table.column.resizeValue.placeHolder", + "table.column.resizeValue.prompt", + "table.column.resizeValue.invalidType", + "table.column.resizeValue.invalidRange" + ], + "vs/workbench/contrib/localHistory/browser/localHistory": [ + "localHistoryIcon", + "localHistoryRestore" + ], + "vs/workbench/contrib/localHistory/browser/localHistoryCommands": [ + "localHistoryRestore.source", + "confirmRestoreMessage", + "confirmRestoreDetail", + { + "key": "restoreButtonLabel", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "unableToRestore", + "restoreViaPicker.filePlaceholder", + "restoreViaPicker.entryPlaceholder", + "renameLocalHistoryEntryTitle", + "renameLocalHistoryPlaceholder", + "confirmDeleteMessage", + "confirmDeleteDetail", + { + "key": "deleteButtonLabel", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "confirmDeleteAllMessage", + "confirmDeleteAllDetail", + { + "key": "deleteAllButtonLabel", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "createLocalHistoryEntryTitle", + "createLocalHistoryPlaceholder", + "localHistoryEditorLabel", + "localHistoryCompareToFileEditorLabel", + "localHistoryCompareToPreviousEditorLabel", + "localHistory.category", + "localHistory.compareWithFile", + "localHistory.compareWithPrevious", + "localHistory.selectForCompare", + "localHistory.compareWithSelected", + "localHistory.open", + "localHistory.restore", + "localHistory.restoreViaPicker", + "localHistory.restoreViaPickerMenu", + "localHistory.rename", + "localHistory.delete", + "localHistory.deleteAll", + "localHistory.create" + ], + "vs/workbench/contrib/localHistory/browser/localHistoryTimeline": [ + "localHistory" + ], + "vs/workbench/contrib/localHistory/electron-browser/localHistoryCommands": [ + "revealInWindows", + "revealInMac", + "openContainer" + ], + "vs/workbench/contrib/localization/common/localization.contribution": [ + "vscode.extension.contributes.localizations", + "vscode.extension.contributes.localizations.languageId", + "vscode.extension.contributes.localizations.languageName", + "vscode.extension.contributes.localizations.languageNameLocalized", + "vscode.extension.contributes.localizations.translations", + "vscode.extension.contributes.localizations.translations.id", + "vscode.extension.contributes.localizations.translations.id.pattern", + "vscode.extension.contributes.localizations.translations.path", + "language id", + "localizations language name", + "localizations localized language name", + "localizations" + ], + "vs/workbench/contrib/localization/common/localizationsActions": [ + "chooseLocale", + "installed", + "available", + "moreInfo", + "configureLocale", + "configureLocaleDescription", + "clearDisplayLanguage" + ], + "vs/workbench/contrib/localization/electron-browser/localization.contribution": [ + "updateLocale", + "changeAndRestart", + "neverAgain" + ], + "vs/workbench/contrib/localization/electron-browser/minimalTranslations": [ + "showLanguagePackExtensions", + "searchMarketplace", + "installAndRestartMessage", + "installAndRestart" + ], + "vs/workbench/contrib/logs/common/logs.contribution": [ + "remote name", + "setDefaultLogLevel", + "show window log" + ], + "vs/workbench/contrib/logs/common/logsActions": [ + "all", + "extensionLogs", + "loggers", + "selectlog", + "selectLogLevelFor", + "selectLogLevel", + "resetLogLevel", + "default", + "current", + "sessions placeholder", + "log placeholder", + "setLogLevel", + "openSessionLogFile" + ], + "vs/workbench/contrib/logs/electron-browser/logsActions": [ + "openLogsFolder", + "openExtensionLogsFolder" + ], + "vs/workbench/contrib/markdown/browser/markdownSettingRenderer": [ + "viewInSettings", + "viewInSettingsDetailed", + "restorePreviousValue", + "alreadysetBoolTrue", + "alreadysetBoolFalse", + "trueMessage", + "falseMessage", + "alreadysetString", + "stringValue", + "alreadysetNum", + "numberValue", + "changeSettingTitle", + "copySettingId", + "copySettingId" + ], + "vs/workbench/contrib/markdown/common/markdownColors": [ + "markdownAlertNoteForeground", + "markdownAlertTipForeground", + "markdownAlertImportantForeground", + "markdownAlertWarningForeground", + "markdownAlertCautionForeground" + ], + "vs/workbench/contrib/markers/browser/markers.contribution": [ + "markersViewIcon", + { + "key": "miMarker", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "viewAsTree", + "viewAsTable", + "show errors", + "problems", + "show warnings", + "problems", + "show infos", + "problems", + "show active file", + "problems", + "show excluded files", + "problems", + "focusProblemsList", + "focusProblemsFilter", + "problems", + "problems", + "clearFiltersText", + "problems", + "collapseAll", + "status.problems", + "status.problemsVisibilityOff", + "status.problemsVisibility", + "totalErrors", + "totalWarnings", + "totalInfos", + "noProblems", + "manyProblems", + "totalProblems", + "viewAsTreeDescription", + "viewAsTableDescription", + "toggleErrorsDescription", + "toggleWarningsDescription", + "toggleInfosDescription", + "toggleActiveFileDescription", + "toggleExcludedFilesDescription", + "copyMarker", + "copyMessage", + "copyMessage", + "show multiline", + "show singleline" + ], + "vs/workbench/contrib/markers/browser/markersChatContext": [ + "chatContext.diagnstic", + "chatContext.diagnstic.placeholder", + "markers.panel.at.ln.col.number", + "markers.panel.allErrors" + ], + "vs/workbench/contrib/markers/browser/markersFileDecorations": [ + "label", + "tooltip.1", + "tooltip.N", + "markers.showOnFile" + ], + "vs/workbench/contrib/markers/browser/markersTable": [ + "codeColumnLabel", + "messageColumnLabel", + "fileColumnLabel", + "sourceColumnLabel" + ], + "vs/workbench/contrib/markers/browser/markersTreeViewer": [ + "problemsView", + "expandedIcon", + "collapsedIcon", + "single line", + "multi line" + ], + "vs/workbench/contrib/markers/browser/markersView": [ + "showing filtered problems", + "No problems filtered", + "problems filtered", + "clearFilter" + ], + "vs/workbench/contrib/markers/browser/messages": [ + "problems.view.toggle.label", + "problems.panel.configuration.title", + "problems.panel.configuration.autoreveal", + "problems.panel.configuration.viewMode", + "problems.panel.configuration.showCurrentInStatus", + "problems.panel.configuration.compareOrder", + "problems.panel.configuration.compareOrder.severity", + "problems.panel.configuration.compareOrder.position", + "markers.panel.no.problems.build", + "markers.panel.no.problems.activeFile.build", + "markers.panel.no.problems.filters", + "markers.panel.action.moreFilters", + "markers.panel.filter.showErrors", + "markers.panel.filter.showWarnings", + "markers.panel.filter.showInfos", + "markers.panel.filter.useFilesExclude", + "markers.panel.filter.activeFile", + "markers.panel.action.filter", + "markers.panel.action.quickfix", + "markers.panel.filter.ariaLabel", + "markers.panel.filter.placeholder", + "markers.panel.filter.errors", + "markers.panel.filter.warnings", + "markers.panel.filter.infos", + "markers.panel.single.error.label", + "markers.panel.multiple.errors.label", + "markers.panel.single.warning.label", + "markers.panel.multiple.warnings.label", + "markers.panel.single.info.label", + "markers.panel.multiple.infos.label", + "markers.panel.single.unknown.label", + "markers.panel.multiple.unknowns.label", + "markers.panel.at.ln.col.number", + "problems.tree.aria.label.resource", + "problems.tree.aria.label.marker.relatedInformation", + "problems.tree.aria.label.error.marker", + "problems.tree.aria.label.error.marker.nosource", + "problems.tree.aria.label.warning.marker", + "problems.tree.aria.label.warning.marker.nosource", + "problems.tree.aria.label.info.marker", + "problems.tree.aria.label.info.marker.nosource", + "problems.tree.aria.label.marker", + "problems.tree.aria.label.marker.nosource", + "problems.tree.aria.label.relatedinfo.message", + "errors.warnings.show.label", + "problems.view.focus.label", + "markers.panel.title.problems" + ], + "vs/workbench/contrib/mcp/browser/mcp.contribution": [ + "mcpServer", + "mcp.quickaccess.placeholder", + "mcp.quickaccess.add" + ], + "vs/workbench/contrib/mcp/browser/mcpAddContextContribution": [ + "mcp.addContext", + "mcp.addContext.placeholder" + ], + "vs/workbench/contrib/mcp/browser/mcpCommands": [ + "mcp.selectServer", + "mcp.addServer", + "mcp.addServer.description", + "mcp.actions.status", + "mcp.start", + "mcp.stop", + "mcp.restart", + "mcp.config", + "mcp.showOutput", + "mcp.actions.sampling", + "mcp.configAccess", + "mcp.showOutput.description", + "mcp.samplingLog", + "mcp.samplingLog.description", + "mcp.actions.resources", + "mcp.resources", + "mcp.selectAction", + "mcp.samplingLog.title", + "mcp.disconnect", + "mcp.signOut", + "mcp.newTools.md.single", + "mcp.newTools.md.multi", + "mcp.err.md.single", + "mcp.err.md.multi", + "mcp.autoStart", + "mcp.newTools", + "mcp.toolError", + "mcp.toolRefresh", + "mcp.configureSamplingModels.ph", + "mcp.list", + "mcp.options", + "mcp.options", + "mcp.resetTrust", + "mcp.resetCachedTools", + "mcp.addConfiguration", + "mcp.addConfiguration.description", + "mcp.resetCachedTools", + "mcp.editStoredInput", + "mcp.command.showConfiguration", + "mcp.command.showOutput", + "mcp.command.restartServer", + "mcp.command.startServer", + "mcp.command.stopServer", + "mcp.command.browse", + "mcp.command.browse.tooltip", + "mcp.command.browse.mcp", + "mcp.command.show.installed", + "mcp.servers", + "mcp.command.openUserMcp", + "mcp.command.openRemoteUserMcp", + "mcp.command.openWorkspaceFolderMcp", + "mcp.command.openWorkspaceMcp", + "mcp.browseResources", + "mcp.configureSamplingModels", + "mcp.startPromptingServer", + "mcp.skipCurrentAutostart" + ], + "vs/workbench/contrib/mcp/browser/mcpCommandsAddConfiguration": [ + "mcp.npm.title", + "mcp.npm.placeholder", + "mcp.serverType.npm", + "mcp.serverType.npm.description", + "mcp.pip.title", + "mcp.pip.placeholder", + "mcp.serverType.pip", + "mcp.serverType.pip.description", + "mcp.nuget.title", + "mcp.nuget.placeholder", + "mcp.serverType.nuget", + "mcp.serverType.nuget.description", + "mcp.docker.title", + "mcp.docker.placeholder", + "mcp.serverType.docker", + "mcp.serverType.docker.description", + "mcp.serverType.command", + "mcp.serverType.command.description", + "mcp.serverType.http", + "mcp.serverType.http.description", + "mcp.serverType.manual", + "mcp.serverType.copilot", + "mcp.servers.discovery", + "mcp.servers.browse", + "mcp.serverType.placeholder", + "mcp.command.title", + "mcp.command.placeholder", + "mcp.url.title", + "mcp.url.placeholder", + "mcp.serverId.title", + "mcp.serverId.placeholder", + "mcp.target.user", + "mcp.target.user.description", + "mcp.target.remote", + "mcp.target..remote.description", + "mcp.target.workspace", + "mcp.target.workspace.description.remote", + "mcp.target.workspace", + "mcp.target.workspace.description", + "mcp.target.title", + "mcp.target.placeholder", + "mcp.loading.title", + "mcp.error.openHelpUri", + "mcp.error.retry", + "cancel", + "mcp.confirmPublish", + "allow", + "cancel", + "install.title", + "install.start", + "install.show", + "install.rename", + "cancel", + "install.error", + "install.newName" + ], + "vs/workbench/contrib/mcp/browser/mcpElicitationService": [ + "mcp.elicit.enum.none", + "mcp.elicit.enum.none.description", + "mcp.elicit.title", + "msg.subtitle", + "mcp.elicit.accept", + "mcp.elicit.reject", + "mcp.elicit.source", + "mcp.elicit.give", + "mcp.elicit.cancel", + "mcp.elicit.url.title", + "mcp.elicit.url.instruction", + "msg.subtitle", + "mcp.elicit.url.open", + "mcp.elicit.reject", + "mcp.elicit.url.instruction2", + "mcp.elicit.source", + "mcp.elicit.url.open2", + "mcp.elicit.cancel", + "optional", + "optional", + "mcp.elicit.useDefault", + "mcp.elicit.validation.minLength", + "mcp.elicit.validation.maxLength", + "mcp.elicit.validation.email", + "mcp.elicit.validation.uri", + "mcp.elicit.validation.date", + "mcp.elicit.validation.date", + "mcp.elicit.validation.dateTime", + "mcp.elicit.validation.number", + "mcp.elicit.validation.integer", + "mcp.elicit.validation.minimum", + "mcp.elicit.validation.maximum" + ], + "vs/workbench/contrib/mcp/browser/mcpLanguageFeatures": [ + "mcp.variableNotFound", + "server.error", + "mcp.restart", + "mcp.debug", + "server.starting", + "cancel", + "server.running", + "mcp.stop", + "mcp.restart", + "mcp.debug", + "mcp.start", + "mcp.debug", + "server.toolCount", + "server.promptcount", + "mcp.server.more", + "edit", + "clear", + "clearAll" + ], + "vs/workbench/contrib/mcp/browser/mcpMigration": [ + "mcp.migration.remoteConfigFound", + "mcp.migration.userConfigFound", + "mcp.migration.openRemoteConfig", + "mcp.migration.openUserConfig", + "mcp.migration.update" + ], + "vs/workbench/contrib/mcp/browser/mcpPromptArgumentPick": [ + "optional", + "mcp.prompt.pick.title", + "loading", + "mcp.arg.suggestions", + "mcp.arg.activeFiles", + "mcp.arg.files", + "mcp.arg.asText", + "mcp.arg.asCommand", + "mcp.arg.asCommand.description", + "mcp.arg.required", + "mcp.arg.activeFile", + "mcp.arg.selectedText.singleLine", + "mcp.arg.selectedText.multiLine", + "mcp.arg.selectedText", + "mcp.terminal.name" + ], + "vs/workbench/contrib/mcp/browser/mcpResourceQuickAccess": [ + "mcp.resource.template", + "mcp.resource.template.notFound", + "mcp.resource.template.placeholder", + "mcp.resource.template.optional", + "mcp.resource.template.empty", + "mcp.quickaccess.attach", + "goBack", + "mcp.quickaccess.placeholder" + ], + "vs/workbench/contrib/mcp/browser/mcpServerActions": [ + "install", + "mcpServerInstallation", + "installInWorkspace", + "mcpServerInstallation", + "install in workspace folder", + "mcp.target.workspace", + "mcp.target.title", + "installInRemote", + "installInRemoteLabel", + "mcpServerInstallation", + "installing", + "uninstall", + "uninstall", + "manage", + "start", + "start", + "stop", + "stop", + "restart", + "restart", + "mcp.signOut", + "mcp.disconnect", + "restart", + "output", + "output", + "config", + "configJson", + "mcp.configAccess", + "mcp.configAccess", + "mcp.samplingLog", + "mcp.samplingLog.title", + "mcp.resources" + ], + "vs/workbench/contrib/mcp/browser/mcpServerEditor": [ + "name", + "details", + "detailstooltip", + "manifest", + "manifesttooltip", + "configuration", + "configurationtooltip", + "configuration", + "configurationtooltip", + "noReadme", + "Readme title", + "noManifest", + "noConfig", + "serverName", + "serverType", + "command", + "arguments", + "url", + "packages", + "packageName", + "packagearguments", + "runtimeargs", + "environmentVariables", + "remotes", + "url", + "transport", + "headers", + "tags", + "repository", + "support", + "resources", + "Install Info", + "id", + "Version", + "Marketplace Info", + "id", + "Version", + "last updated", + "published" + ], + "vs/workbench/contrib/mcp/browser/mcpServerEditorInput": [ + "mcpServerEditorLabelIcon", + "extensionsInputName" + ], + "vs/workbench/contrib/mcp/browser/mcpServerIcons": [ + "mcpServer", + "mcpServerRemoteIcon", + "mcpServerWorkspaceIcon", + "starredIcon", + "licenseIcon" + ], + "vs/workbench/contrib/mcp/browser/mcpServersView": [ + "mcp servers", + "mcp.welcome.title", + "mcp.welcome.settings.tooltip", + "mcp.welcome.descriptionWithLink", + "mcp.gallery.enableDialog.setting", + "mcp.welcome.enableGalleryButton", + "mcp.welcome.enableGalleryButton", + "mcp.gallery.enableDialog.title", + "mcp.gallery.enableDialog.setting", + "mcp.gallery.enableDialog.enable", + "mcp.gallery.enableDialog.cancel", + "no extensions found", + "mcp-installed", + "mcp", + "mcp", + "mcp", + "mcp" + ], + "vs/workbench/contrib/mcp/browser/mcpServerWidgets": [ + "publisher", + "verified publisher", + "workspace extension", + "remote user extension", + "mcpIconStarForeground" + ], + "vs/workbench/contrib/mcp/browser/mcpWorkbenchService": [ + "overwriting", + "overwriting", + "not an extension", + "cannot be installed", + "mcp.configuration.userLocalValue", + "disabled - all not allowed", + "disabled - some not allowed", + "disabled - some not allowed" + ], + "vs/workbench/contrib/mcp/common/discovery/extensionMcpDiscovery": [ + "invalidData", + "invalidId", + "invalidLabel", + "invalidWhen" + ], + "vs/workbench/contrib/mcp/common/discovery/nativeMcpDiscoveryAbstract": [ + "onRemoteLabel" + ], + "vs/workbench/contrib/mcp/common/mcpConfiguration": [ + "mcp.discovery.source.claude-desktop", + "mcp.discovery.source.windsurf", + "mcp.discovery.source.cursor-global", + "mcp.discovery.source.cursor-workspace", + "mcp.discovery.source.claude-desktop.config", + "mcp.discovery.source.windsurf.config", + "mcp.discovery.source.cursor-global.config", + "mcp.discovery.source.cursor-workspace.config", + "app.mcp.dev", + "app.mcp.dev.watch", + "app.mcp.dev.debug", + "app.mcp.dev.debug.type.node", + "app.mcp.dev.debug.type.python", + "app.mcp.dev.debug.debugpyPath", + "app.mcp.json.type", + "app.mcp.json.command", + "app.mcp.json.cwd", + "app.mcp.args.command", + "app.mcp.envFile.command", + "app.mcp.env.command", + "app.mcp.json.title", + "app.mcp.json.type", + "app.mcp.json.url.pattern", + "app.mcp.json.url", + "app.mcp.json.headers", + "vscode.extension.contributes.mcp", + "vscode.extension.contributes.mcp.id", + "vscode.extension.contributes.mcp.label", + "vscode.extension.contributes.mcp.when", + "id", + "name", + "mcpServerDefinitionProviders" + ], + "vs/workbench/contrib/mcp/common/mcpContextKeys": [ + "mcp.serverCount.description", + "mcp.hasUnknownTools.description", + "mcp.hasServersWithErrors.description", + "mcp.toolsCount.description" + ], + "vs/workbench/contrib/mcp/common/mcpDevMode": [ + "mcp.debug.nodeBinReq", + "mcp.debug.pythonBinReq" + ], + "vs/workbench/contrib/mcp/common/mcpLanguageModelToolContribution": [ + "mcp.toolset", + "mcp.tool.warning", + "msg.title", + "msg.run", + "msg.ran", + "msg.subtitle" + ], + "vs/workbench/contrib/mcp/common/mcpRegistry": [ + "trustFromExt", + "trustTitleWithOrigin", + "mcp.trust.details", + "mcp.trust.yes", + "mcp.trust.no", + "trustTitleWithOriginMulti", + "mcp.trust.detailsMulti", + "mcp.trust.yes", + "mcp.trust.pick", + "mcp.trust.no", + "mcp.launchError", + "mcp.launchError.openConfig" + ], + "vs/workbench/contrib/mcp/common/mcpSamplingLog": [ + "mcp.sampling.rpd" + ], + "vs/workbench/contrib/mcp/common/mcpSamplingService": [ + "mcp.sampling.allowDuringChat.title", + "mcp.sampling.allowDuringChat.desc", + "mcp.sampling.allowOutsideChat.title", + "mcp.sampling.allowOutsideChat.desc", + "mcp.sampling.needsModels", + "configure", + "cancel", + "mcp.sampling.allow.inSession", + "mcp.sampling.allow.always", + "mcp.sampling.allow.notNow", + "mcp.sampling.allow.never" + ], + "vs/workbench/contrib/mcp/common/mcpServer": [ + "mcp.command.showOutput", + "mcpDebugPyHelp", + "mcpViewDocs", + "mcpServerInstall", + "mcpServerNotFound", + "mcpServerError", + "mcpBadSchema.tool", + "mcpBadSchema", + "mcpBadSchema.show" + ], + "vs/workbench/contrib/mcp/common/mcpServerConnection": [ + "mcpServer.starting", + "mcpServer.state", + "mcpServer.stopping" + ], + "vs/workbench/contrib/mcp/common/mcpTypes": [ + "mcpstate.stopped", + "mcpstate.starting", + "mcpstate.running", + "mcpstate.error" + ], + "vs/workbench/contrib/mergeEditor/browser/commands/commands": [ + "mergeEditor.compareWithBase", + "mergeEditor.compareWithBase", + "mergeEditor.resetResultToBaseAndAutoMerge.short", + "mergeEditor.acceptMerge.unhandledConflicts.message", + "mergeEditor.acceptMerge.unhandledConflicts.detail", + { + "key": "mergeEditor.acceptMerge.unhandledConflicts.accept", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "title", + "layout.mixed", + "layout.column", + "showNonConflictingChanges", + "layout.showBase", + "layout.showBaseTop", + "layout.showBaseCenter", + "mergeEditor", + "openfile", + "merge.goToNextUnhandledConflict", + "merge.goToPreviousUnhandledConflict", + "merge.toggleCurrentConflictFromLeft", + "merge.toggleCurrentConflictFromRight", + "mergeEditor.compareInput1WithBase", + "mergeEditor.compareInput2WithBase", + "merge.openBaseEditor", + "merge.acceptAllInput1", + "merge.acceptAllInput2", + "mergeEditor.resetResultToBaseAndAutoMerge", + "mergeEditor.resetChoice", + "mergeEditor.acceptAllCombination", + "mergeEditor.acceptMerge", + "mergeEditor.toggleBetweenInputs" + ], + "vs/workbench/contrib/mergeEditor/browser/commands/devCommands": [ + "mergeEditor.name", + "mergeEditor.noActiveMergeEditor", + "mergeEditor.name", + "mergeEditor.successfullyCopiedMergeEditorContents", + "mergeEditor.name", + "mergeEditor.noActiveMergeEditor", + "mergeEditor.selectFolderToSaveTo", + "mergeEditor.name", + "mergeEditor.successfullySavedMergeEditorContentsToFolder", + "mergeEditor.selectFolderToSaveTo", + "mergeEditor", + "merge.dev.copyState", + "merge.dev.saveContentsToFolder", + "merge.dev.loadContentsFromFolder" + ], + "vs/workbench/contrib/mergeEditor/browser/mergeEditor.contribution": [ + "name", + "diffAlgorithm.legacy", + "diffAlgorithm.advanced" + ], + "vs/workbench/contrib/mergeEditor/browser/mergeEditorAccessibilityHelp": [ + "msg1", + "msg2", + "msg3", + "msg4", + "msg5" + ], + "vs/workbench/contrib/mergeEditor/browser/mergeEditorInput": [ + "name", + "mergeEditor.input1", + "mergeEditor.input2", + "mergeEditor.result" + ], + "vs/workbench/contrib/mergeEditor/browser/mergeEditorInputModel": [ + "messageN", + "message1", + { + "key": "saveWithConflict", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "save", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "discard", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "detailNConflicts", + "detail1Conflicts", + "detailN", + "detail1", + "saveTempFile.message", + "saveTempFile.detail", + { + "key": "acceptMerge", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "merge-editor.source", + "workspace.messageN", + "workspace.message1", + "workspace.detailN.unhandled", + "workspace.detail1.unhandled", + "workspace.detailN.handled", + "workspace.detail1.handled", + { + "key": "workspace.saveWithConflict", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "workspace.save", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "workspace.doNotSave", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "workspace.messageN.nonDirty", + "workspace.message1.nonDirty", + "workspace.detailN.unhandled.nonDirty", + "workspace.detail1.unhandled.nonDirty", + { + "key": "workspace.closeWithConflicts", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "workspace.close", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "noMoreWarn" + ], + "vs/workbench/contrib/mergeEditor/browser/mergeMarkers/mergeMarkersController": [ + "conflictingLine", + "conflictingLines" + ], + "vs/workbench/contrib/mergeEditor/browser/model/mergeEditorModel": [ + "setInputHandled", + "undoMarkAsHandled" + ], + "vs/workbench/contrib/mergeEditor/browser/view/colors": [ + "mergeEditor.change.background", + "mergeEditor.change.word.background", + "mergeEditor.changeBase.background", + "mergeEditor.changeBase.word.background", + "mergeEditor.conflict.unhandledUnfocused.border", + "mergeEditor.conflict.unhandledFocused.border", + "mergeEditor.conflict.handledUnfocused.border", + "mergeEditor.conflict.handledFocused.border", + "mergeEditor.conflict.handled.minimapOverViewRuler", + "mergeEditor.conflict.unhandled.minimapOverViewRuler", + "mergeEditor.conflictingLines.background", + "mergeEditor.conflict.input1.background", + "mergeEditor.conflict.input2.background" + ], + "vs/workbench/contrib/mergeEditor/browser/view/conflictActions": [ + "accept", + "acceptTooltip", + "acceptBoth0First", + "acceptBoth", + "acceptBothTooltip", + "append", + "appendTooltip", + "combine", + "acceptBothTooltip", + "ignore", + "markAsHandledTooltip", + "manualResolution", + "manualResolutionTooltip", + "noChangesAccepted", + "noChangesAcceptedTooltip", + "remove", + "removeTooltip", + "remove", + "removeTooltip", + "resetToBase", + "resetToBaseTooltip" + ], + "vs/workbench/contrib/mergeEditor/browser/view/editors/baseCodeEditorView": [ + "base", + "compareWith", + "compareWithTooltip" + ], + "vs/workbench/contrib/mergeEditor/browser/view/editors/inputCodeEditorView": [ + "input1", + "input2", + "mergeEditor.accept", + "mergeEditor.accept", + "mergeEditor.acceptBoth", + "mergeEditor.swap", + "mergeEditor.markAsHandled", + "accept.excluded", + "accept.conflicting", + "accept.first", + "accept.second" + ], + "vs/workbench/contrib/mergeEditor/browser/view/editors/resultCodeEditorView": [ + "result", + "mergeEditor.remainingConflicts", + "mergeEditor.remainingConflict", + "goToNextConflict", + "allConflictHandled" + ], + "vs/workbench/contrib/mergeEditor/browser/view/mergeEditor": [ + "mergeEditor" + ], + "vs/workbench/contrib/mergeEditor/browser/view/viewModel": [ + "noConflictMessage" + ], + "vs/workbench/contrib/mergeEditor/common/mergeEditor": [ + "is", + "isr", + "editorLayout", + "showBase", + "showBaseAtTop", + "showNonConflictingChanges", + "baseUri", + "resultUri" + ], + "vs/workbench/contrib/mergeEditor/electron-browser/devCommands": [ + "mergeEditor.enterJSON", + "mergeEditor", + "merge.dev.openState", + "merge.dev.openSelectionInTemporaryMergeEditor" + ], + "vs/workbench/contrib/multiDiffEditor/browser/actions": [ + "goToFile", + "goToNextChange", + "goToPreviousChange", + "collapseAllDiffs", + "ExpandAllDiffs" + ], + "vs/workbench/contrib/multiDiffEditor/browser/icons.contribution": [ + "multiDiffEditorLabelIcon" + ], + "vs/workbench/contrib/multiDiffEditor/browser/multiDiffEditor.contribution": [ + "name" + ], + "vs/workbench/contrib/multiDiffEditor/browser/multiDiffEditorInput": [ + "name", + { + "key": "nameWithOneFile", + "comment": [ + "{0} is the name of the editor" + ] + }, + { + "key": "nameWithFiles", + "comment": [ + "{0} is the name of the editor", + "{1} is the number of files being shown" + ] + } + ], + "vs/workbench/contrib/multiDiffEditor/browser/scmMultiDiffSourceResolver": [ + "openChanges" + ], + "vs/workbench/contrib/notebook/browser/contrib/cellCommands/cellCommands": [ + "notebookActions.toggleOutputs", + "notebookActions.moveCellUp", + "notebookActions.moveCellDown", + "notebookActions.copyCellUp", + "notebookActions.copyCellDown", + "notebookActions.splitCell", + "notebookActions.joinCellAbove", + "notebookActions.joinCellBelow", + "notebookActions.joinSelectedCells", + "notebookActions.changeCellToCode", + "notebookActions.changeCellToMarkdown", + "notebookActions.collapseCellInput", + "notebookActions.expandCellInput", + "notebookActions.collapseCellOutput", + "notebookActions.expandCellOutput", + "notebookActions.toggleOutputs", + "notebookActions.collapseAllCellInput", + "notebookActions.expandAllCellInput", + "notebookActions.collapseAllCellOutput", + "notebookActions.expandAllCellOutput", + "notebookActions.toggleScrolling" + ], + "vs/workbench/contrib/notebook/browser/contrib/cellDiagnostics/cellDiagnosticsActions": [ + "cellCommands.quickFix.noneMessage", + "notebookActions.cellFailureActions", + "notebookActions.chatFixCellError", + "notebookActions.chatExplainCellError" + ], + "vs/workbench/contrib/notebook/browser/contrib/cellDiagnostics/diagnosticCellStatusBarContrib": [ + "notebook.cell.status.diagnostic" + ], + "vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/executionStatusBarItemController": [ + "notebook.cell.status.success", + "notebook.cell.status.failed", + "notebook.cell.status.pending", + "notebook.cell.status.executing", + "notebook.cell.statusBar.timerTooltip.reportIssueFootnote", + "notebook.cell.statusBar.timerTooltip", + "notebook.cell.statusBar.timerVerbose" + ], + "vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/statusBarProviders": [ + "notebook.cell.status.searchLanguageExtensions", + "notebook.cell.status.language", + "notebook.cell.status.autoDetectLanguage" + ], + "vs/workbench/contrib/notebook/browser/contrib/chat/notebookChatUtils": [ + "notebookOutputCellLabel" + ], + "vs/workbench/contrib/notebook/browser/contrib/clipboard/notebookClipboard": [ + "notebookActions.copy", + "notebookActions.cut", + "notebookActions.paste", + "notebookActions.pasteAbove", + "notebook.cell.output.selectAll", + "toggleNotebookClipboardLog" + ], + "vs/workbench/contrib/notebook/browser/contrib/editorStatusBar/editorStatusBar": [ + "notebook.info", + "tooltop", + "notebook.select", + "kernel.select.label", + "kernel.select.label", + "notebook.activeCellStatusName", + "notebook.multiActiveCellIndicator", + "notebook.singleActiveCellIndicator", + "notebook.indentation", + "selectNotebookIndentation" + ], + "vs/workbench/contrib/notebook/browser/contrib/find/notebookFind": [ + "notebookActions.hideFind", + "notebookActions.findInNotebook", + "notebook.findNext.fromWidget", + "notebook.findPrevious.fromWidget" + ], + "vs/workbench/contrib/notebook/browser/contrib/find/notebookFindReplaceWidget": [ + "label.find", + "placeholder.find", + "label.previousMatchButton", + "label.nextMatchButton", + "label.toggleSelectionFind", + "label.closeButton", + "label.toggleReplaceButton", + "label.replace", + "placeholder.replace", + "label.replaceButton", + "label.replaceAllButton", + "findFilterIcon", + "notebook.find.filter.filterAction", + "notebook.find.filter.findInMarkupInput", + "notebook.find.filter.findInMarkupPreview", + "notebook.find.filter.findInCodeInput", + "notebook.find.filter.findInCodeOutput" + ], + "vs/workbench/contrib/notebook/browser/contrib/find/notebookFindWidget": [ + "ariaSearchNoResultEmpty", + "ariaSearchNoResult", + "ariaSearchNoResultWithLineNumNoCurrentMatch" + ], + "vs/workbench/contrib/notebook/browser/contrib/format/formatting": [ + "label", + "formatCells.label", + "format.title", + "formatCell.label" + ], + "vs/workbench/contrib/notebook/browser/contrib/gettingStarted/notebookGettingStarted": [ + "workbench.notebook.layout.gettingStarted.label" + ], + "vs/workbench/contrib/notebook/browser/contrib/layout/layoutActions": [ + "notebook.toggleCellToolbarPosition" + ], + "vs/workbench/contrib/notebook/browser/contrib/multicursor/notebookMulticursor": [ + "selectAllFindMatches", + "addFindMatchToSelection", + "exitMultiSelection", + "deleteLeftMultiSelection", + "deleteRightMultiSelection" + ], + "vs/workbench/contrib/notebook/browser/contrib/navigation/arrow": [ + "notebook.cell.webviewHandledEvents", + "cursorMoveDown", + "cursorMoveUp", + "focusFirstCell", + "focusLastCell", + "focusOutputOut", + "notebookActions.centerActiveCell", + "cursorPageUp", + "cursorPageUpSelect", + "cursorPageDown", + "cursorPageDownSelect", + "notebook.navigation.allowNavigateToSurroundingCells", + "focusOutput" + ], + "vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookInlineVariables": [ + "clearAllInlineValues" + ], + "vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariableCommands": [ + "copyWorkspaceVariableValue", + "executeNotebookVariableProvider" + ], + "vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariables": [ + "notebookVariables" + ], + "vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesDataSource": [ + "notebook.indexedChildrenLimitReached" + ], + "vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesTree": [ + "notebookVariableAriaLabel", + "notebook.notebookVariables", + "notebook.ReplVariables" + ], + "vs/workbench/contrib/notebook/browser/contrib/outline/notebookOutline": [ + "outline.showMarkdownHeadersOnly", + "outline.showCodeCells", + "outline.showCodeCellSymbols", + "breadcrumbs.showCodeCells", + "notebook.gotoSymbols.showAllSymbols", + "filter", + "toggleShowMarkdownHeadersOnly", + "toggleCodeCells", + "toggleCodeCellSymbols" + ], + "vs/workbench/contrib/notebook/browser/contrib/profile/notebookProfile": [ + "setProfileTitle" + ], + "vs/workbench/contrib/notebook/browser/contrib/saveParticipants/saveParticipants": [ + "notebookFormatSave.formatting", + "formatNotebook", + "trimNotebookWhitespace", + "trimNotebookNewlines", + "insertFinalNewLine", + "notebookSaveParticipants.notebookCodeActions", + "notebookSaveParticipants.cellCodeActions", + "notebookSaveParticipants.formatCodeActions", + { + "key": "codeaction.get2", + "comment": [ + "[configure]({1}) is a link. Only translate `configure`. Do not change brackets and parentheses or {1}" + ] + }, + "codeAction.apply", + { + "key": "codeaction.get2", + "comment": [ + "[configure]({1}) is a link. Only translate `configure`. Do not change brackets and parentheses or {1}" + ] + }, + "codeAction.apply" + ], + "vs/workbench/contrib/notebook/browser/contrib/troubleshoot/layout": [ + "workbench.notebook.toggleLayoutTroubleshoot", + "workbench.notebook.inspectLayout", + "workbench.notebook.clearNotebookEdtitorTypeCache" + ], + "vs/workbench/contrib/notebook/browser/controller/cellOperations": [ + "notebookActions.joinSelectedCells", + "notebookActions.joinSelectedCells.label" + ], + "vs/workbench/contrib/notebook/browser/controller/cellOutputActions": [ + "notebookActions.showAllOutput", + "notebookActions.copyOutput", + "notebookActions.openOutputInEditor", + "notebookActions.saveOutputImage", + "imageFiles", + "notebookActions.openOutputInNotebookOutputEditor" + ], + "vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions": [ + "notebookActions.menu.insertCodeCellWithChat", + "notebookActions.menu.insertCodeCellWithChat.tooltip", + "notebookActions.menu.insertCodeCellWithChat.tooltip", + "notebookActions.menu.insertCodeCellWithChat", + "notebookActions.menu.insertCodeCellWithChat.tooltip", + "notebookActions.menu.insertCode.ontoolbar", + "notebookActions.menu.insertCode.tooltip", + "notebook.apply2", + "notebook.apply3", + "notebook.apply1" + ], + "vs/workbench/contrib/notebook/browser/controller/chat/notebook.chat.contribution": [ + "pickKernelVariableLabel", + "selectKernelVariablePlaceholder", + "noKernelVariables", + "chatContext.notebook.kernelVariable", + "chatContext.notebook.kernelVariable.placeholder", + "notebookActions.addOutputToChat" + ], + "vs/workbench/contrib/notebook/browser/controller/chat/notebookChatContext": [ + "notebookChatAgentRegistered" + ], + "vs/workbench/contrib/notebook/browser/controller/coreActions": [ + "notebookMenu.insertCell", + "notebookMenu.cellTitle", + "miShare", + "notebookActions.category" + ], + "vs/workbench/contrib/notebook/browser/controller/editActions": [ + "notebookActions.editCell", + "notebookActions.quitEdit", + "notebookActions.quitEditAllCells", + "notebookActions.deleteCell", + "confirmDeleteButton", + "confirmDeleteButtonMessage", + "doNotAskAgain", + "clearCellOutputs", + "clearAllCellsOutputs", + "changeLanguage", + "changeLanguage", + "languageDescription", + "languageDescriptionConfigured", + "autoDetect", + "languagesPicks", + "pickLanguageToConfigure", + "noDetection", + "noNotebookEditor", + "noWritableCodeEditor", + "indentConvert", + "indentView", + "pickAction", + "commentSelectedCells", + "detectLanguage", + "selectNotebookIndentation" + ], + "vs/workbench/contrib/notebook/browser/controller/executeActions": [ + "notebookActions.renderMarkdown", + "notebookActions.executeNotebook", + "notebookActions.executeNotebook", + "notebookActions.execute", + "notebookActions.execute", + "notebookActions.executeAbove", + "notebookActions.executeBelow", + "notebookActions.executeAndFocusContainer", + "notebookActions.executeAndFocusContainer", + "notebookActions.cancel", + "notebookActions.cancel", + "notebookActions.executeAndSelectBelow", + "notebookActions.executeAndInsertBelow", + "revealRunningCellShort", + "revealRunningCell", + "revealRunningCell", + "revealRunningCell", + "revealLastFailedCell", + "revealLastFailedCell", + "revealLastFailedCellShort", + "notebookActions.cancelNotebook", + "notebookActions.interruptNotebook" + ], + "vs/workbench/contrib/notebook/browser/controller/foldingController": [ + "fold.cell", + "unfold.cell", + "fold.cell" + ], + "vs/workbench/contrib/notebook/browser/controller/insertCellActions": [ + "notebookActions.insertCodeCellAbove", + "notebookActions.insertCodeCellAboveAndFocusContainer", + "notebookActions.insertCodeCellBelow", + "notebookActions.insertCodeCellBelowAndFocusContainer", + "notebookActions.insertMarkdownCellAbove", + "notebookActions.insertMarkdownCellBelow", + "notebookActions.insertCodeCellAtTop", + "notebookActions.insertMarkdownCellAtTop", + "notebookActions.menu.insertCode", + "notebookActions.menu.insertCode.tooltip", + "notebookActions.menu.insertCode.minimalToolbar", + "notebookActions.menu.insertCode.tooltip", + "notebookActions.menu.insertCode.ontoolbar", + "notebookActions.menu.insertCode.tooltip", + "notebookActions.menu.insertCode", + "notebookActions.menu.insertCode.tooltip", + "notebookActions.menu.insertCode.minimaltoolbar", + "notebookActions.menu.insertCode.tooltip", + "notebookActions.menu.insertMarkdown", + "notebookActions.menu.insertMarkdown.tooltip", + "notebookActions.menu.insertMarkdown.ontoolbar", + "notebookActions.menu.insertMarkdown.tooltip", + "notebookActions.menu.insertMarkdown", + "notebookActions.menu.insertMarkdown.tooltip" + ], + "vs/workbench/contrib/notebook/browser/controller/layoutActions": [ + "notebook.showLineNumbers", + "cmd.toggle2", + "notebook.placeholder", + "saveTarget.machine", + "saveTarget.workspace", + { + "key": "mitoggleNotebookStickyScroll", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "notebookStickyScroll", + { + "key": "mitoggleNotebookStickyScroll", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "workbench.notebook.layout.select.label", + "workbench.notebook.layout.configure.label", + "workbench.notebook.layout.configure.label", + "customizeNotebook", + "notebook.toggleLineNumbers", + "notebook.toggleLineNumbers.short", + "notebook.toggleCellToolbarPosition", + "notebook.toggleBreadcrumb", + "notebook.toggleBreadcrumb.short", + "notebook.saveMimeTypeOrder", + "workbench.notebook.layout.webview.reset.label", + "toggleStickyScroll", + "toggleStickyScroll.short" + ], + "vs/workbench/contrib/notebook/browser/controller/notebookIndentationActions": [ + "indentUsingTabs", + "indentUsingSpaces", + "changeTabDisplaySize", + "convertIndentationToSpaces", + "convertIndentationToTabs", + { + "key": "selectTabWidth", + "comment": [ + "Tab corresponds to the tab key" + ] + }, + "convertIndentation" + ], + "vs/workbench/contrib/notebook/browser/controller/sectionActions": [ + { + "key": "mirunCell", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "runCell", + { + "key": "mirunCellsInSection", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "runCellsInSection", + { + "key": "mifoldSection", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "foldSection", + { + "key": "miexpandSection", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "expandSection", + "runCell", + "runCellsInSection", + "foldSection", + "expandSection" + ], + "vs/workbench/contrib/notebook/browser/controller/variablesActions": [ + "notebookActions.openVariablesView" + ], + "vs/workbench/contrib/notebook/browser/diff/diffComponents": [ + "hiddenCell", + "hiddenCells", + "showUnchangedCells", + "hideUnchangedCells" + ], + "vs/workbench/contrib/notebook/browser/diff/diffElementOutputs": [ + "mimeTypePicker", + "empty", + "noRenderer.2", + "curruentActiveMimeType", + "promptChooseMimeTypeInSecure.placeHolder", + "promptChooseMimeType.placeHolder", + "builtinRenderInfo" + ], + "vs/workbench/contrib/notebook/browser/diff/notebookDiffActions": [ + "notebook.diff.revertMetadata", + "notebook.diff.cell.revertInput", + "notebook.diff.cell.revertOutputs", + "notebook.diff.cell.revertMetadata", + "notebook.diff.cell.switchOutputRenderingStyleToText", + "notebook.diff.cell.revertOutputs", + "ignoreTrimWhitespace.label", + "notebook.diff.action.previous.title", + "notebook.diff.action.next.title", + "notebook.diff.inline.toggle.title", + "notebook.diff.ignoreMetadata", + "notebook.diff.ignoreOutputs", + "notebook.diff.toggleInline", + "notebook.diff.openFile", + "notebook.diff.cell.toggleCollapseUnchangedRegions", + "notebook.diff.switchToText", + "showUnchangedCells", + "hideUnchangedCells", + "goToCell", + "notebook.diff.showOutputs", + "notebook.diff.showMetadata" + ], + "vs/workbench/contrib/notebook/browser/diff/notebookDiffEditor": [ + "notebookTreeAriaLabel" + ], + "vs/workbench/contrib/notebook/browser/diff/notebookDiffEditorBrowser": [ + "notebook.diffEditor.allCollapsed", + "notebook.diffEditor.hasUnchangedCells", + "notebook.diffEditor.unchangedCellsAreHidden", + "notebook.diffEditor.item.kind", + "notebook.diffEditor.item.state" + ], + "vs/workbench/contrib/notebook/browser/diff/notebookDiffList": [ + "notebook.diff.hiddenCells.expandAll" + ], + "vs/workbench/contrib/notebook/browser/diff/notebookMultiDiffEditor": [ + "notebookCellLabel", + "notebookCellMetadataLabel", + "notebookCellOutputLabel" + ], + "vs/workbench/contrib/notebook/browser/notebook.contribution": [ + "notebook.editorOptions.experimentalCustomization", + "notebookConfigurationTitle", + "notebook.displayOrder.description", + "notebook.cellToolbarLocation.description", + "notebook.cellToolbarLocation.viewType", + "notebook.showCellStatusbar.description", + "notebook.showCellStatusbar.hidden.description", + "notebook.showCellStatusbar.visible.description", + "notebook.showCellStatusbar.visibleAfterExecute.description", + "notebook.cellExecutionTimeVerbosity.description", + "notebook.cellExecutionTimeVerbosity.default.description", + "notebook.cellExecutionTimeVerbosity.verbose.description", + "notebook.diff.enablePreview.description", + "notebook.diff.enableOverviewRuler.description", + "notebook.cellToolbarVisibility.description", + "notebook.undoRedoPerCell.description", + "notebook.compactView.description", + "notebook.focusIndicator.description", + "notebook.insertToolbarPosition.description", + "insertToolbarLocation.betweenCells", + "insertToolbarLocation.notebookToolbar", + "insertToolbarLocation.both", + "insertToolbarLocation.hidden", + "notebook.globalToolbar.description", + "notebook.stickyScrollEnabled.description", + "notebook.stickyScrollMode.description", + "notebook.stickyScrollMode.flat", + "notebook.stickyScrollMode.indented", + "notebook.consolidatedOutputButton.description", + "notebook.showFoldingControls.description", + "showFoldingControls.always", + "showFoldingControls.never", + "showFoldingControls.mouseover", + "notebook.dragAndDrop.description", + "notebook.consolidatedRunButton.description", + "notebook.globalToolbarShowLabel", + "notebook.textOutputLineLimit", + "notebook.disableOutputFilePathLinks", + "notebook.minimalErrorRendering", + "notebook.markup.fontSize", + "notebook.markdown.lineHeight", + "notebook.interactiveWindow.collapseCodeCells", + "notebook.outputLineHeight", + "notebook.outputFontSize", + "notebook.outputFontFamily", + "notebook.outputScrolling", + "notebook.outputWordWrap", + "notebookFormatter.default", + "notebook.formatOnSave", + "notebook.insertFinalNewline", + "notebook.formatOnCellExecution", + "notebook.confirmDeleteRunningCell", + "notebook.findFilters", + "notebook.remoteSaving", + "notebook.scrolling.revealNextCellOnExecute.description", + "notebook.scrolling.revealNextCellOnExecute.fullCell.description", + "notebook.scrolling.revealNextCellOnExecute.firstLine.description", + "notebook.scrolling.revealNextCellOnExecute.none.description", + "notebook.cellGenerate", + "notebook.VariablesView.description", + "notebook.inlineValues.description", + "notebook.inlineValues.on", + "notebook.inlineValues.auto", + "notebook.inlineValues.off", + "notebook.cellFailureDiagnostics", + "notebook.backup.sizeLimit", + "notebook.multiCursor.enabled", + "notebook.markup.fontFamily" + ], + "vs/workbench/contrib/notebook/browser/notebookAccessibilityHelp": [ + "notebook.overview", + "notebook.cell.edit", + "notebook.cell.quitEdit", + "notebook.cell.focusInOutput", + "notebook.focusNextEditor", + "notebook.focusPreviousEditor", + "notebook.cellNavigation", + "notebook.cell.executeAndFocusContainer", + "notebook.cell.insertCodeCellBelowAndFocusContainer", + "notebook.changeCellType" + ], + "vs/workbench/contrib/notebook/browser/notebookAccessibilityProvider": [ + "replHistoryTreeAriaLabel", + "notebookTreeAriaLabel", + "notebookTreeAriaLabelHelp", + "notebookTreeAriaLabelHelpNoKb" + ], + "vs/workbench/contrib/notebook/browser/notebookEditor": [ + "fail.noEditor", + "fail.noEditor.extensionMissing", + "notebookOpenEnableMissingViewType", + "notebookOpenInstallMissingViewType", + "notebookOpenAsText", + "notebookTooLargeForHeapErrorWithSize", + "notebookTooLargeForHeapErrorWithoutSize", + "notebookOpenInTextEditor" + ], + "vs/workbench/contrib/notebook/browser/notebookEditorWidget": [ + "notebook.cellBorderColor", + "notebook.focusedEditorBorder", + "notebookStatusSuccessIcon.foreground", + "notebookEditorOverviewRuler.runningCellForeground", + "notebookStatusErrorIcon.foreground", + "notebookStatusRunningIcon.foreground", + "notebook.outputContainerBorderColor", + "notebook.outputContainerBackgroundColor", + "notebook.cellToolbarSeparator", + "focusedCellBackground", + "selectedCellBackground", + "notebook.cellHoverBackground", + "notebook.selectedCellBorder", + "notebook.inactiveSelectedCellBorder", + "notebook.focusedCellBorder", + "notebook.inactiveFocusedCellBorder", + "notebook.cellStatusBarItemHoverBackground", + "notebook.cellInsertionIndicator", + "notebookScrollbarSliderBackground", + "notebookScrollbarSliderHoverBackground", + "notebookScrollbarSliderActiveBackground", + "notebook.symbolHighlightBackground", + "notebook.cellEditorBackground", + "notebook.editorBackground" + ], + "vs/workbench/contrib/notebook/browser/notebookExtensionPoint": [ + "contributes.notebook.provider", + "contributes.notebook.provider.viewType", + "contributes.notebook.provider.displayName", + "contributes.notebook.provider.selector", + "contributes.notebook.provider.selector.filenamePattern", + "contributes.notebook.selector.provider.excludeFileNamePattern", + "contributes.priority", + "contributes.priority.default", + "contributes.priority.option", + "contributes.notebook.renderer", + "contributes.notebook.renderer.viewType", + "contributes.notebook.renderer.displayName", + "contributes.notebook.renderer.hardDependencies", + "contributes.notebook.renderer.optionalDependencies", + "contributes.notebook.renderer.requiresMessaging.always", + "contributes.notebook.renderer.requiresMessaging.optional", + "contributes.notebook.renderer.requiresMessaging.never", + "contributes.notebook.renderer.requiresMessaging", + "contributes.notebook.selector", + "contributes.notebook.renderer.entrypoint", + "contributes.notebook.renderer.entrypoint", + "contributes.notebook.renderer.entrypoint.extends", + "contributes.notebook.renderer.entrypoint", + "contributes.preload.provider", + "contributes.preload.provider.viewType", + "contributes.preload.entrypoint", + "contributes.preload.localResourceRoots", + "Notebook id", + "Notebook name", + "Notebook renderer name", + "Notebook mimetypes", + "notebooks", + "notebookRenderer" + ], + "vs/workbench/contrib/notebook/browser/notebookIcons": [ + "selectKernelIcon", + "executeIcon", + "executeAboveIcon", + "executeBelowIcon", + "stopIcon", + "deleteCellIcon", + "executeAllIcon", + "editIcon", + "stopEditIcon", + "moveUpIcon", + "moveDownIcon", + "clearIcon", + "splitCellIcon", + "successStateIcon", + "errorStateIcon", + "pendingStateIcon", + "executingStateIcon", + "collapsedIcon", + "expandedIcon", + "openAsTextIcon", + "revertIcon", + "toggleWhitespace", + "renderOutputIcon", + "mimetypeIcon", + "copyIcon", + "saveIcon", + "previousChangeIcon", + "nextChangeIcon", + "variablesViewIcon" + ], + "vs/workbench/contrib/notebook/browser/outputEditor/notebookOutputEditor": [ + "notebookOutputEditor", + "empty", + "noRenderer.2" + ], + "vs/workbench/contrib/notebook/browser/outputEditor/notebookOutputEditorInput": [ + "notebookOutputEditorInput" + ], + "vs/workbench/contrib/notebook/browser/services/notebookExecutionServiceImpl": [ + "notebookRunTrust" + ], + "vs/workbench/contrib/notebook/browser/services/notebookKernelHistoryServiceImpl": [ + "workbench.notebook.clearNotebookKernelsMRUCache" + ], + "vs/workbench/contrib/notebook/browser/services/notebookKeymapServiceImpl": [ + "disableOtherKeymapsConfirmation", + "yes", + "no" + ], + "vs/workbench/contrib/notebook/browser/services/notebookLoggingServiceImpl": [ + "renderChannelName" + ], + "vs/workbench/contrib/notebook/browser/services/notebookServiceImpl": [ + "notebookOpenInstallMissingViewType" + ], + "vs/workbench/contrib/notebook/browser/view/cellParts/cellEditorOptions": [ + "notebook.lineNumbers", + "notebook.showLineNumbers", + "notebook.cell.toggleLineNumbers.title", + "notebook.toggleLineNumbers", + "notebook.toggleLineNumbers.short" + ], + "vs/workbench/contrib/notebook/browser/view/cellParts/cellOutput": [ + "empty", + "noRenderer.2", + "pickMimeType", + "curruentActiveMimeType", + "installJupyterPrompt", + "promptChooseMimeTypeInSecure.placeHolder", + "promptChooseMimeType.placeHolder", + "unavailableRenderInfo" + ], + "vs/workbench/contrib/notebook/browser/view/cellParts/codeCell": [ + "cellExpandInputButtonLabelWithDoubleClick", + "cellExpandInputButtonLabel" + ], + "vs/workbench/contrib/notebook/browser/view/cellParts/codeCellExecutionIcon": [ + "notebook.cell.status.success", + "notebook.cell.status.failure", + "notebook.cell.status.pending", + "notebook.cell.status.executing" + ], + "vs/workbench/contrib/notebook/browser/view/cellParts/codeCellRunToolbar": [ + "notebook.moreRunActionsLabel" + ], + "vs/workbench/contrib/notebook/browser/view/cellParts/collapsedCellOutput": [ + "cellOutputsCollapsedMsg", + "cellExpandOutputButtonLabelWithDoubleClick", + "cellExpandOutputButtonLabel" + ], + "vs/workbench/contrib/notebook/browser/view/cellParts/foldedCellHint": [ + "hiddenCellsLabel", + "hiddenCellsLabelPlural" + ], + "vs/workbench/contrib/notebook/browser/view/cellParts/markupCell": [ + "cellExpandInputButtonLabelWithDoubleClick", + "cellExpandInputButtonLabel" + ], + "vs/workbench/contrib/notebook/browser/view/renderers/backLayerWebView": [ + "notebook.emptyMarkdownPlaceholder", + { + "key": "notebook.error.rendererNotFound", + "comment": [ + "$0 is a placeholder for the mime type" + ] + }, + { + "key": "notebook.error.rendererFallbacksExhausted", + "comment": [ + "$0 is a placeholder for the mime type" + ] + }, + "webview title" + ], + "vs/workbench/contrib/notebook/browser/view/renderers/cellRenderer": [ + "cellExecutionOrderCountLabel" + ], + "vs/workbench/contrib/notebook/browser/viewModel/notebookOutlineEntryFactory": [ + "empty" + ], + "vs/workbench/contrib/notebook/browser/viewParts/notebookKernelQuickPickStrategy": [ + "current1", + "current2", + "prompt.placeholder.change", + "prompt.placeholder.select", + "installSuggestedKernel", + "searchForKernels", + "selectAnotherKernel.more", + "select", + "selectAnotherKernel", + "selectKernel.placeholder", + "learnMoreTooltip", + "selectKernelFromExtension", + "kernels.selectedKernelAndKernelDetectionRunning", + "kernels.detecting", + "kernels.detecting", + "select" + ], + "vs/workbench/contrib/notebook/browser/viewParts/notebookKernelView": [ + "notebookActions.selectKernel.args", + "notebookActions.selectKernel" + ], + "vs/workbench/contrib/notebook/browser/viewParts/notebookViewZones": [ + "workbench.notebook.developer.addViewZones" + ], + "vs/workbench/contrib/notebook/common/notebookEditorInput": [ + "vetoAutoExtHostRestart", + "vetoExtHostRestart" + ], + "vs/workbench/contrib/outline/browser/outline.contribution": [ + "outlineViewIcon", + "outlineConfigurationTitle", + "outline.showIcons", + "outline.initialState", + "outline.initialState.collapsed", + "outline.initialState.expanded", + "outline.showProblem", + "outline.problem.colors", + "outline.problems.badges", + "filteredTypes.file", + "filteredTypes.module", + "filteredTypes.namespace", + "filteredTypes.package", + "filteredTypes.class", + "filteredTypes.method", + "filteredTypes.property", + "filteredTypes.field", + "filteredTypes.constructor", + "filteredTypes.enum", + "filteredTypes.interface", + "filteredTypes.function", + "filteredTypes.variable", + "filteredTypes.constant", + "filteredTypes.string", + "filteredTypes.number", + "filteredTypes.boolean", + "filteredTypes.array", + "filteredTypes.object", + "filteredTypes.key", + "filteredTypes.null", + "filteredTypes.enumMember", + "filteredTypes.struct", + "filteredTypes.event", + "filteredTypes.operator", + "filteredTypes.typeParameter", + "name" + ], + "vs/workbench/contrib/outline/browser/outlineActions": [ + "collapse", + "expand", + "followCur", + "filterOnType", + "sortByPosition", + "sortByName", + "sortByKind" + ], + "vs/workbench/contrib/outline/browser/outlinePane": [ + "no-editor", + "loading", + "no-symbols" + ], + "vs/workbench/contrib/output/browser/output.contribution": [ + "outputViewIcon", + { + "key": "miToggleOutput", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "switchBetweenOutputs.label", + "switchToOutput.label", + "extensionLogs", + "selectlog", + "nocustumoutput", + "selectlog", + "selectOutput", + "outputScrollOff", + "outputScrollOn", + "logLevel.label", + "logLevelDefault.label", + "extensionLogs", + "selectlog", + "logFile", + "selectlogFile", + "clearFiltersText", + "extensionLogs", + "userLogs", + "selectlog", + "importLogFile", + "logFiles", + "output", + "output.smartScroll.enabled", + "output", + "output", + "addCompoundLog", + "output", + "removeLog", + "output", + "showOutputChannels", + "output", + "clearOutput.label", + "toggleAutoScroll", + "openActiveOutputFile", + "openActiveOutputFileInNewWindow", + "saveActiveOutputAs", + "showLogs", + "openLogFile", + "toggleTraceDescription", + "exportLogs", + "importLog" + ], + "vs/workbench/contrib/output/browser/outputServices": [ + "saveLog.dialogTitle" + ], + "vs/workbench/contrib/output/browser/outputView": [ + "outputView.filter.placeholder", + "output model title", + "channel", + "output", + "outputViewAriaLabel" + ], + "vs/workbench/contrib/performance/browser/performance.contribution": [ + "show.label", + "cycles", + "insta.trace", + "emitter" + ], + "vs/workbench/contrib/performance/browser/perfviewEditor": [ + "name" + ], + "vs/workbench/contrib/performance/electron-browser/performance.contribution": [ + "experimental.rendererProfiling" + ], + "vs/workbench/contrib/performance/electron-browser/startupProfiler": [ + "prof.message", + "prof.detail", + { + "key": "prof.restartAndFileIssue", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "prof.restart", + "prof.thanks", + "prof.detail.restart", + { + "key": "prof.restart.button", + "comment": [ + "&& denotes a mnemonic" + ] + } + ], + "vs/workbench/contrib/preferences/browser/keybindingsEditor": [ + "recordKeysLabel", + "sortByPrecedeneLabel", + "SearchKeybindings.FullTextSearchPlaceholder", + "SearchKeybindings.KeybindingsSearchPlaceholder", + "clearInput", + "recording", + "command", + "keybinding", + "when", + "source", + "foundResults", + "show sorted keybindings", + "show keybindings", + "changeLabel", + "addLabel", + "addLabel", + "editWhen", + "removeLabel", + "resetLabel", + "showSameKeybindings", + "copyLabel", + "copyCommandLabel", + "copyCommandTitleLabel", + "error", + "editKeybindingLabelWithKey", + "editKeybindingLabel", + "addKeybindingLabelWithKey", + "addKeybindingLabel", + "title", + "extension label", + "keybindingsLabel", + "noKeybinding", + "noWhen", + "keyboard shortcuts aria label" + ], + "vs/workbench/contrib/preferences/browser/keybindingsEditorContribution": [ + "defineKeybinding.kbLayoutErrorMessage", + { + "key": "defineKeybinding.kbLayoutLocalAndUSMessage", + "comment": [ + "Please translate maintaining the stars (*) around the placeholders such that they will be rendered in bold.", + "The placeholders will contain a keyboard combination e.g. Ctrl+Shift+/" + ] + }, + { + "key": "defineKeybinding.kbLayoutLocalMessage", + "comment": [ + "Please translate maintaining the stars (*) around the placeholder such that it will be rendered in bold.", + "The placeholder will contain a keyboard combination e.g. Ctrl+Shift+/" + ] + } + ], + "vs/workbench/contrib/preferences/browser/keybindingWidgets": [ + "defineKeybinding.initial", + "defineKeybinding.oneExists", + "defineKeybinding.existing", + "defineKeybinding.chordsTo" + ], + "vs/workbench/contrib/preferences/browser/keyboardLayoutPicker": [ + "status.workbench.keyboardLayout", + "keyboardLayout", + "keyboardLayout", + "keyboardLayout", + "displayLanguage", + "doc", + "layoutPicks", + "configureKeyboardLayout", + "autoDetect", + "pickKeyboardLayout", + "fail.createSettings", + "keyboard.chooseLayout" + ], + "vs/workbench/contrib/preferences/browser/preferences.contribution": [ + "settingsEditor2", + "preferencesEditor", + "keybindingsEditor", + { + "key": "miOpenSettings", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "openFolderSettings", + { + "key": "miOpenOnlineSettings", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miOpenTelemetrySettings", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "settings.focusFile", + "settings.focusFile", + "settings.focusSettingsList", + "settings.focusSettingControl", + "keyboardShortcuts", + "keyboardShortcuts", + "clear", + "clearHistory", + { + "key": "miPreferences", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "openSettings2", + "openUserSettingsJson", + "openApplicationSettingsJson", + "settings", + "openSettings2", + "workbench.action.openSettingsJson.description", + "openGlobalSettings", + "openRawDefaultSettings", + "openWorkspaceSettings", + "openAccessibilitySettings", + "openWorkspaceSettingsFile", + "openFolderSettings", + "openFolderSettingsFile", + "settings.toggleAiSearch", + "filterUntrusted", + "openRemoteSettings", + "openRemoteSettingsJSON", + "settings.focusSearch", + "settings.clearResults", + "settings.focusSettingsTOC", + "settings.showContextMenu", + "settings.focusLevelUp", + "preferences", + "openGlobalKeybindings", + "openDefaultKeybindingsFile", + "openGlobalKeybindingsFile", + "showDefaultKeybindings", + "showExtensionKeybindings", + "showUserKeybindings", + "defineKeybinding.start", + "openSettingsJson" + ], + "vs/workbench/contrib/preferences/browser/preferencesActions": [ + "languageDescriptionConfigured", + "pickLanguage", + "configureLanguageBasedSettings" + ], + "vs/workbench/contrib/preferences/browser/preferencesEditor": [ + "preferencesTabSwitcherBarAriaLabel", + "FullTextSearchPlaceholder", + "FullTextSearchPlaceholder" + ], + "vs/workbench/contrib/preferences/browser/preferencesIcons": [ + "settingsScopeDropDownIcon", + "settingsMoreActionIcon", + "keybindingsRecordKeysIcon", + "keybindingsSortIcon", + "keybindingsEditIcon", + "keybindingsAddIcon", + "settingsEditIcon", + "settingsRemoveIcon", + "preferencesDiscardIcon", + "preferencesClearInput", + "preferencesAiResults", + "settingsFilter", + "preferencesOpenSettings" + ], + "vs/workbench/contrib/preferences/browser/preferencesRenderers": [ + "editTtile", + "replaceDefaultValue", + "copyDefaultValue", + "replaceDefaultValue", + "copyDefaultValue", + "unsupportedPolicySetting", + "unsupportLanguageOverrideSetting", + "defaultProfileSettingWhileNonDefaultActive", + "allProfileSettingWhileInNonDefaultProfileSetting", + "unsupportedRemoteMachineSetting", + "unsupportedWindowSetting", + "unsupportedApplicationSetting", + "unsupportedMachineSetting", + "untrustedSetting", + "unknown configuration setting", + "manage workspace trust", + "manage workspace trust", + "mcp.renderer.remoteConfigFound", + "mcp.renderer.userConfigFound", + "mcp.renderer.openRemoteConfig", + "mcp.renderer.openUserConfig", + "unsupportedProperty" + ], + "vs/workbench/contrib/preferences/browser/preferencesWidgets": [ + "userSettings", + "userSettingsRemote", + "workspaceSettings", + "folderSettings", + "settingsSwitcherBarAriaLabel", + "userSettings", + "userSettingsRemote", + "workspaceSettings", + "userSettings", + "workspaceSettings" + ], + "vs/workbench/contrib/preferences/browser/settingsEditor2": [ + "SearchSettings.AriaLabel", + "showAiResultsEnabled", + "showAiResultsDisabled", + "clearInput", + "filterInput", + "noAiResults", + "noResults", + "clearSearchFilters", + "settings", + "settings require trust", + "noResultsWithAiAvailable", + "oneResultWithAiAvailable", + "moreThanOneResultWithAiAvailable", + "noResults", + "oneResult", + "moreThanOneResult", + "turnOnSyncButton", + "lastSyncedLabel" + ], + "vs/workbench/contrib/preferences/browser/settingsEditorSettingIndicators": [ + "workspaceUntrustedLabel", + "trustLabel", + "manageWorkspaceTrust", + "extensionSyncIgnoredLabel", + "syncIgnoredTitle", + "defaultOverriddenLabel", + "advancedLabel", + "previewLabel", + "experimentalLabel", + "user", + "workspace", + "remote", + "policyLabelText", + "policyDescription", + "policyFilterLink", + "applicationSetting", + "applicationSettingDescription", + "alsoConfiguredIn", + "configuredIn", + "alsoConfiguredElsewhere", + "configuredElsewhere", + "alsoModifiedInScopes", + "modifiedInScopes", + "hasDefaultOverridesForLanguages", + "defaultOverriddenDetails", + "multipledefaultOverriddenDetails", + "user", + "workspace", + "remote", + "modifiedInScopeForLanguage", + "user", + "workspace", + "remote", + "modifiedInScopeForLanguageMidSentence", + "previewLabel", + "experimentalLabel", + "advancedLabel", + "workspaceUntrustedAriaLabel", + "policyDescriptionAccessible", + "applicationSettingDescriptionAccessible", + "alsoConfiguredIn", + "configuredIn", + "syncIgnoredAriaLabel", + "defaultOverriddenDetailsAriaLabel", + "multipleDefaultOverriddenDetailsAriaLabel", + "defaultOverriddenLanguagesList" + ], + "vs/workbench/contrib/preferences/browser/settingsLayout": [ + "commonlyUsed", + "textEditor", + "cursor", + "find", + "font", + "formatting", + "diffEditor", + "multiDiffEditor", + "minimap", + "suggestions", + "files", + "workbench", + "appearance", + "breadcrumbs", + "editorManagement", + "settings", + "zenMode", + "screencastMode", + "window", + "newWindow", + "features", + "accessibility.signals", + "accessibility", + "fileExplorer", + "search", + "debug", + "testing", + "scm", + "extensions", + "terminal", + "task", + "problems", + "output", + "comments", + "remote", + "timeline", + "notebook", + "mergeEditor", + "chat", + "issueReporter", + "application", + "proxy", + "keyboard", + "update", + "telemetry", + "settingsSync", + "experimental", + "other", + "security", + "workspace" + ], + "vs/workbench/contrib/preferences/browser/settingsSearchMenu": [ + "modifiedSettingsSearch", + "modifiedSettingsSearchTooltip", + "extSettingsSearch", + "extSettingsSearchTooltip", + "featureSettingsSearch", + "featureSettingsSearchTooltip", + "tagSettingsSearch", + "tagSettingsSearchTooltip", + "langSettingsSearch", + "langSettingsSearchTooltip", + "idSettingsSearch", + "idSettingsSearchTooltip", + "onlineSettingsSearch", + "onlineSettingsSearchTooltip", + "policySettingsSearch", + "policySettingsSearchTooltip", + "stableSettings", + "stableSettingsSearchTooltip", + "previewSettings", + "previewSettingsSearchTooltip", + "experimental", + "experimentalSettingsSearchTooltip", + "advancedSettingsSearch", + "advancedSettingsSearchTooltip" + ], + "vs/workbench/contrib/preferences/browser/settingsTree": [ + "extensions", + "modified", + "settingsContextMenuTitle", + "newExtensionsButtonLabel", + "editInSettingsJson", + "editLanguageSettingLabel", + "settings.Default", + "modified", + "showExtension", + "dismiss", + "resetSettingLabel", + "validationError", + "validationError", + "settings.Modified", + "settings", + "copySettingIdLabel", + "copySettingAsJSONLabel", + "copySettingAsURLLabel", + "stopSyncingSetting", + "applyToAllProfiles" + ], + "vs/workbench/contrib/preferences/browser/settingsWidgets": [ + "okButton", + "cancelButton", + "listValueHintLabel", + "listSiblingHintLabel", + "removeItem", + "editItem", + "addItem", + "itemInputPlaceholder", + "listSiblingInputPlaceholder", + "excludePatternHintLabel", + "excludeSiblingHintLabel", + "excludeIncludeSource", + "removeExcludeItem", + "editExcludeItem", + "addPattern", + "excludePatternInputPlaceholder", + "excludeSiblingInputPlaceholder", + "includePatternHintLabel", + "includeSiblingHintLabel", + "excludeIncludeSource", + "removeIncludeItem", + "editIncludeItem", + "addPattern", + "includePatternInputPlaceholder", + "includeSiblingInputPlaceholder", + "okButton", + "cancelButton", + "objectKeyInputPlaceholder", + "objectValueInputPlaceholder", + "objectPairHintLabelWithSource", + "objectPairHintLabel", + "removeItem", + "resetItem", + "editItem", + "addItem", + "objectKeyHeader", + "objectValueHeader", + "objectPairHintLabel", + "removeItem", + "resetItem", + "editItem", + "addItem", + "objectKeyHeader", + "objectValueHeader" + ], + "vs/workbench/contrib/preferences/browser/tocTree": [ + { + "key": "settingsTOC", + "comment": [ + "A label for the table of contents for the full settings list" + ] + }, + "groupRowAriaLabel" + ], + "vs/workbench/contrib/preferences/common/preferences": [ + "previewIndicatorDescription", + "experimentalIndicatorDescription", + "advancedIndicatorDescription" + ], + "vs/workbench/contrib/preferences/common/preferencesContribution": [ + "splitSettingsEditorLabel", + "enableNaturalLanguageSettingsSearch", + "settingsSearchTocBehavior.hide", + "settingsSearchTocBehavior.filter", + "settingsSearchTocBehavior" + ], + "vs/workbench/contrib/preferences/common/settingsEditorColorRegistry": [ + "headerForeground", + "settingsHeaderHoverForeground", + "modifiedItemForeground", + "settingsHeaderBorder", + "settingsSashBorder", + "settingsDropdownBackground", + "settingsDropdownForeground", + "settingsDropdownBorder", + "settingsDropdownListBorder", + "settingsCheckboxBackground", + "settingsCheckboxForeground", + "settingsCheckboxBorder", + "textInputBoxBackground", + "textInputBoxForeground", + "textInputBoxBorder", + "numberInputBoxBackground", + "numberInputBoxForeground", + "numberInputBoxBorder", + "focusedRowBackground", + "settings.rowHoverBackground", + "settings.focusedRowBorder" + ], + "vs/workbench/contrib/processExplorer/browser/processExplorer.contribution": [ + "promptOpenWith.processExplorer.displayName", + { + "key": "miOpenProcessExplorerer", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "openProcessExplorer" + ], + "vs/workbench/contrib/processExplorer/browser/processExplorer.web.contribution": [ + "processExplorer" + ], + "vs/workbench/contrib/processExplorer/browser/processExplorerControl": [ + "processName", + "processCpu", + "processPid", + "processMemory", + "processExplorer", + "killProcess", + "forceKillProcess", + "copy", + "copyAll", + "debug" + ], + "vs/workbench/contrib/processExplorer/browser/processExplorerEditorInput": [ + "processExplorerEditorLabelIcon", + "processExplorerInputName" + ], + "vs/workbench/contrib/processExplorer/electron-browser/processExplorer.contribution": [ + "processExplorer" + ], + "vs/workbench/contrib/quickaccess/browser/commandsQuickAccess": [ + "noCommandResults", + "configure keybinding", + "commandsQuickAccess.askInChat", + "commandsQuickAccess.configureAskInChatSetting", + "commandWithCategory", + "confirmClearMessage", + "confirmClearDetail", + { + "key": "clearButtonLabel", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "showTriggerActions", + "clearCommandHistory" + ], + "vs/workbench/contrib/quickaccess/browser/quickAccess.contribution": [ + "helpQuickAccessPlaceholder", + "helpQuickAccess", + "more", + "viewQuickAccessPlaceholder", + "viewQuickAccess", + "commandsQuickAccessPlaceholder", + "commandsQuickAccess", + { + "key": "miCommandPalette", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miShowAllCommands", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miOpenView", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miGotoLine", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "commandPalette", + "commandPalette" + ], + "vs/workbench/contrib/quickaccess/browser/viewQuickAccess": [ + "noViewResults", + "views", + "panels", + "secondary side bar", + "terminalTitle", + "terminals", + "debugConsoles", + "channels", + "openView", + "quickOpenView" + ], + "vs/workbench/contrib/relauncher/browser/relauncher.contribution": [ + "relaunchSettingMessage", + "relaunchSettingMessageWeb", + "relaunchSettingDetail", + "relaunchSettingDetailWeb", + { + "key": "restart", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "restartWeb", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "restartExtensionHost.reason" + ], + "vs/workbench/contrib/remote/browser/explorerViewItems": [ + "switchRemote.label" + ], + "vs/workbench/contrib/remote/browser/remote": [ + "remote.help.getStarted", + "remote.help.documentation", + "remote.help.issues", + "remote.help.report", + "pickRemoteExtension", + "remotehelp", + "remote.explorer", + "reconnectionWaitOne", + "reconnectionWaitMany", + "reconnectNow", + "reloadWindow", + "connectionLost", + "reconnectionRunning", + "reconnectionPermanentFailure", + { + "key": "reloadWindow.dialog", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "remote.help", + "remote.explorer" + ], + "vs/workbench/contrib/remote/browser/remoteConnectionHealth": [ + "unsupportedGlibcWarning", + { + "key": "allow", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "learnMore", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "remember", + "unsupportedGlibcBannerLearnMore", + "unsupportedGlibcWarning.banner" + ], + "vs/workbench/contrib/remote/browser/remoteExplorer": [ + "remoteNoPorts", + "noRemoteNoPorts", + "1forwardedPort", + "nForwardedPorts", + "remote.forwardedPorts.statusbarTextNone", + "remote.forwardedPorts.statusbarTooltip", + "status.forwardedPorts", + "remote.autoForwardPortsSource.fallback", + "remote.autoForwardPortsSource.fallback.switchBack", + "remote.autoForwardPortsSource.fallback.showPortSourceSetting", + "remote.tunnelsView.automaticForward", + { + "key": "remote.tunnelsView.notificationLink2", + "comment": [ + "[See all forwarded ports]({0}) is a link. Only translate `See all forwarded ports`. Do not change brackets and parentheses or {0}" + ] + }, + "remote.tunnelsView.elevationMessage", + "remote.tunnelsView.makePublic", + "remote.tunnelsView.elevationButton", + "ports" + ], + "vs/workbench/contrib/remote/browser/remoteIcons": [ + "getStartedIcon", + "documentationIcon", + "feedbackIcon", + "reviewIssuesIcon", + "reportIssuesIcon", + "remoteExplorerViewIcon", + "portsViewIcon", + "portIcon", + "privatePortIcon", + "forwardPortIcon", + "stopForwardIcon", + "openBrowserIcon", + "openPreviewIcon", + "copyAddressIcon", + "labelPortIcon", + "forwardedPortWithoutProcessIcon", + "forwardedPortWithProcessIcon" + ], + "vs/workbench/contrib/remote/browser/remoteIndicator": [ + { + "key": "miCloseRemote", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "host.open", + "host.open", + "host.reconnecting", + "disconnectedFrom", + { + "key": "host.tooltip", + "comment": [ + "{0} is a remote host name, e.g. Dev Container" + ] + }, + { + "key": "workspace.tooltip", + "comment": [ + "{0} is a remote workspace name, e.g. GitHub" + ] + }, + { + "key": "workspace.tooltip2", + "comment": [ + "[features are not available]({1}) is a link. Only translate `features are not available`. Do not change brackets and parentheses or {0}" + ] + }, + "noHost.tooltip", + "remoteHost", + "networkStatusOfflineTooltip", + "networkStatusHighLatencyTooltip", + "unknownSetupError", + "retry", + "remote.startActions.help", + "remote.startActions.install", + "closeRemoteConnection.title", + "reloadWindow", + "closeVirtualWorkspace.title", + "remoteActions", + "remote.startActions.installingExtension", + "remote.showExtensionRecommendations", + "remote.category", + "remote.showMenu", + "remote.close", + "remote.install" + ], + "vs/workbench/contrib/remote/browser/remoteStartEntry": [ + "remote.category", + "remote.showWebStartEntryActions" + ], + "vs/workbench/contrib/remote/browser/tunnelFactory": [ + "tunnelPrivacy.private", + "tunnelPrivacy.public" + ], + "vs/workbench/contrib/remote/browser/tunnelView": [ + "remote.tunnelsView.addPort", + "tunnelPrivacy.private", + "tunnel.portColumn.label", + "tunnel.portColumn.tooltip", + "tunnel.addressColumn.label", + "tunnel.addressColumn.tooltip", + "portsLink.followLinkAlt.mac", + "portsLink.followLinkAlt", + "portsLink.followLinkCmd", + "portsLink.followLinkCtrl", + "tunnel.processColumn.label", + "tunnel.processColumn.tooltip", + "tunnel.originColumn.label", + "tunnel.originColumn.tooltip", + "tunnel.privacyColumn.label", + "tunnel.privacyColumn.tooltip", + "remote.tunnelsView.input", + "tunnelView.runningProcess.inacessable", + "remote.tunnel.tooltipForwarded", + "remote.tunnel.tooltipCandidate", + "tunnel.iconColumn.running", + "tunnel.iconColumn.notRunning", + "remote.tunnel.tooltipName", + "tunnelPrivacy.unknown", + "tunnelPrivacy.private", + "tunnel.focusContext", + "tunnelView", + "remote.tunnel.label", + "remote.tunnelsView.labelPlaceholder", + "remote.tunnelsView.portNumberValid", + "remote.tunnelsView.portNumberToHigh", + "remote.tunnelView.inlineElevationMessage", + "remote.tunnelView.alreadyForwarded", + "remote.tunnel.forwardItem", + "remote.tunnel.forwardPrompt", + "remote.tunnel.forwardError", + "remote.tunnel.forwardErrorProvided", + "remote.tunnel.closeNoPorts", + "remote.tunnel.closePlaceholder", + "remote.tunnel.open", + "remote.tunnel.openPreview", + "remote.tunnel.openCommandPalette", + "remote.tunnel.openCommandPaletteNone", + "remote.tunnel.openCommandPaletteView", + "remote.tunnel.openCommandPalettePick", + "remote.tunnel.copyAddressInline", + "remote.tunnel.copyAddressCommandPalette", + "remote.tunnel.copyAddressPlaceholdter", + "remote.tunnel.changeLocalPort", + "remote.tunnelsView.portShouldBeNumber", + "remote.tunnel.changeLocalPortNumber", + "remote.tunnelsView.changePort", + "remote.tunnel.protocolHttp", + "remote.tunnel.protocolHttps", + "tunnelContext.privacyMenu", + "tunnelContext.protocolMenu", + "portWithRunningProcess.foreground", + "remote.tunnel", + "remote.tunnel.forward", + "remote.tunnel.close" + ], + "vs/workbench/contrib/remote/common/remote.contribution": [ + "invalidWorkspaceMessage", + "invalidWorkspaceDetail", + { + "key": "invalidWorkspacePrimary", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "ui", + "workspace", + "remote", + "remote.extensionKind", + "remote.restoreForwardedPorts", + "remote.autoForwardPorts", + "remote.autoForwardPortsSource", + "remote.autoForwardPortsSource.process", + "remote.autoForwardPortsSource.output", + "remote.autoForwardPortsSource.hybrid", + "remote.autoForwardPortFallback", + "remote.forwardOnClick", + "remote.portsAttributes.port", + "remote.portsAttributes.notify", + "remote.portsAttributes.openBrowser", + "remote.portsAttributes.openBrowserOnce", + "remote.portsAttributes.openPreview", + "remote.portsAttributes.silent", + "remote.portsAttributes.ignore", + "remote.portsAttributes.onForward", + "remote.portsAttributes.elevateIfNeeded", + "remote.portsAttributes.label", + "remote.portsAttributes.labelDefault", + "remote.portsAttributes.requireLocalPort", + "remote.portsAttributes.protocol", + "remote.portsAttributes.labelDefault", + "remote.portsAttributes", + "remote.portsAttributes.patternError", + "remote.portsAttributes.notify", + "remote.portsAttributes.openBrowser", + "remote.portsAttributes.openPreview", + "remote.portsAttributes.silent", + "remote.portsAttributes.ignore", + "remote.portsAttributes.onForward", + "remote.portsAttributes.elevateIfNeeded", + "remote.portsAttributes.label", + "remote.portsAttributes.labelDefault", + "remote.portsAttributes.requireLocalPort", + "remote.portsAttributes.protocol", + "remote.portsAttributes.defaults", + "remote.localPortHost", + "remote.defaultExtensionsIfInstalledLocally.markdownDescription", + "remote.defaultExtensionsIfInstalledLocally.invalidFormat", + "triggerReconnect", + "pauseSocketWriting" + ], + "vs/workbench/contrib/remote/electron-browser/remote.contribution": [ + "wslFeatureInstalled", + "remote", + "remote.downloadExtensionsLocally", + "remote.actions.closeUnusedPorts", + "remote.category" + ], + "vs/workbench/contrib/remoteCodingAgents/browser/remoteCodingAgents.contribution": [ + "remoteCodingAgentsExtPoint", + "remoteCodingAgentsExtPoint.id", + "remoteCodingAgentsExtPoint.command", + "remoteCodingAgentsExtPoint.displayName", + "remoteCodingAgentsExtPoint.description", + "remoteCodingAgentsExtPoint.followUpRegex", + "remoteCodingAgentsExtPoint.when" + ], + "vs/workbench/contrib/remoteTunnel/electron-browser/remoteTunnel.contribution": [ + "remoteTunnel.actions.turnOn", + "remoteTunnel.actions.turnOff", + "remoteTunnel.actions.showLog", + "remoteTunnel.actions.configure", + "remoteTunnel.actions.copyToClipboard", + "remoteTunnel.actions.learnMore", + { + "key": "recommend.remoteExtension", + "comment": [ + "{0} will be a tunnel name, {1} will the link address to the web UI, {6} an extension name. [label](command:commandId) is a markdown link. Only translate the label, do not modify the format" + ] + }, + "action.showExtension", + "action.doNotShowAgain", + { + "key": "initialize.progress.title", + "comment": [ + "Only translate 'Looking for remote tunnel', do not change the format of the rest (markdown link format)" + ] + }, + { + "key": "startTunnel.progress.title", + "comment": [ + "Only translate 'Starting remote tunnel', do not change the format of the rest (markdown link format)" + ] + }, + { + "key": "remoteTunnel.serviceInstallFailed", + "comment": [ + "{Locked=\"](command:{0})\"}" + ] + }, + "accountPreference.placeholder", + "signed in", + "others", + { + "key": "sign in using account", + "comment": [ + "{0} will be a auth provider (e.g. Github)" + ] + }, + "tunnel.preview", + { + "key": "enable", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "tunnel.enable.placeholder", + "tunnel.enable.session", + "tunnel.enable.session.description", + "tunnel.enable.service", + "tunnel.enable.service.description", + { + "key": "progress.turnOn.final", + "comment": [ + "{0} will be the tunnel name, {1} will the link address to the web UI, {6} an extension name, {7} a link to the extension documentation. [label](command:commandId) is a markdown link. Only translate the label, do not modify the format" + ] + }, + "action.copyToClipboard", + "action.showExtension", + "progress.turnOn.failed", + "remoteTunnel.actions.manage.on.v2", + "remoteTunnel.actions.manage.connecting", + "remoteTunnel.turnOffAttached.confirm", + "remoteTunnel.turnOff.confirm", + "manage.placeholder", + { + "key": "manage.title.attached", + "comment": [ + "{0} is the tunnel name" + ] + }, + { + "key": "manage.title.orunning", + "comment": [ + "{0} is the tunnel name" + ] + }, + "manage.title.off", + "manage.showLog", + "manage.tunnelName", + "remoteTunnelAccess.machineName", + "remoteTunnelAccess.machineNameRegex", + "remoteTunnelAccess.preventSleep", + "remoteTunnel.category" + ], + "vs/workbench/contrib/replNotebook/browser/repl.contribution": [ + "repl.focusLastReplOutput", + "repl.input.focus", + "repl.execute" + ], + "vs/workbench/contrib/replNotebook/browser/replEditor": [ + "replEditorInput" + ], + "vs/workbench/contrib/replNotebook/browser/replEditorAccessibilityHelp": [ + "replEditor.inputOverview", + "replEditor.execute", + "replEditor.configReadExecution", + "replEditor.autoFocusRepl", + "replEditor.focusLastItemAdded", + "replEditor.inputAccessibilityView", + "replEditor.focusReplInput", + "replEditor.historyOverview", + "replEditor.focusCellEditor", + "replEditor.cellNavigation", + "replEditor.accessibilityView", + "replEditor.focusInOutput", + "replEditor.focusReplInputFromHistory", + "replEditor.focusLastItemAdded" + ], + "vs/workbench/contrib/replNotebook/browser/replEditorInput": [ + "replEditorLabelIcon" + ], + "vs/workbench/contrib/sash/browser/sash.contribution": [ + "sashSize", + "sashHoverDelay" + ], + "vs/workbench/contrib/scm/browser/activity": [ + "scmPendingChangesBadge", + "status.scm", + "status.scm.provider", + "scmActiveResourceHasChanges", + "scmActiveResourceRepository" + ], + "vs/workbench/contrib/scm/browser/menus": [ + "miShare" + ], + "vs/workbench/contrib/scm/browser/quickDiffDecorator": [ + "diffAdded", + "diffModified", + "diffDeleted" + ], + "vs/workbench/contrib/scm/browser/quickDiffWidget": [ + "remotes", + "quickDiff.base.switch", + "changes", + "change", + "multiChanges", + "multiChange", + "label.close", + { + "key": "miGotoNextChange", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miGotoPreviousChange", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "show previous change", + "show next change", + "move to previous change", + "move to next change" + ], + "vs/workbench/contrib/scm/browser/scm.contribution": [ + "sourceControlViewIcon", + "source control view", + "no open repo", + "no open repo in an untrusted workspace", + "manageWorkspaceTrustAction", + "no history items", + "source control repositories", + { + "key": "miViewSCM", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "source control graph", + "scmConfigurationTitle", + "scm.diffDecorations.all", + "scm.diffDecorations.gutter", + "scm.diffDecorations.overviewRuler", + "scm.diffDecorations.minimap", + "scm.diffDecorations.none", + "diffDecorations", + "diffGutterWidth", + "scm.diffDecorationsGutterVisibility.always", + "scm.diffDecorationsGutterVisibility.hover", + "scm.diffDecorationsGutterVisibility", + "scm.diffDecorationsGutterAction.diff", + "scm.diffDecorationsGutterAction.none", + "scm.diffDecorationsGutterAction", + "diffGutterPattern", + "diffGutterPatternAdded", + "diffGutterPatternModifed", + "scm.diffDecorationsIgnoreTrimWhitespace.true", + "scm.diffDecorationsIgnoreTrimWhitespace.false", + "scm.diffDecorationsIgnoreTrimWhitespace.inherit", + "diffDecorationsIgnoreTrimWhitespace", + "alwaysShowActions", + "scm.countBadge.all", + "scm.countBadge.focused", + "scm.countBadge.off", + "scm.countBadge", + "scm.providerCountBadge.hidden", + "scm.providerCountBadge.auto", + "scm.providerCountBadge.visible", + "scm.providerCountBadge", + "scm.defaultViewMode.tree", + "scm.defaultViewMode.list", + "scm.defaultViewMode", + "scm.defaultViewSortKey.name", + "scm.defaultViewSortKey.path", + "scm.defaultViewSortKey.status", + "scm.defaultViewSortKey", + "autoReveal", + "inputFontFamily", + "inputFontSize", + "inputMaxLines", + "inputMinLines", + "alwaysShowRepository", + "scm.repositoriesSortOrder.discoveryTime", + "scm.repositoriesSortOrder.name", + "scm.repositoriesSortOrder.path", + "repositoriesSortOrder", + "providersVisible", + "scm.repositories.selectionMode.multiple", + "scm.repositories.selectionMode.single", + "scm.repositories.selectionMode", + "scm.repositories.explorer", + "showActionButton", + "showInputActionButton", + "scm.workingSets.enabled", + "scm.workingSets.default.empty", + "scm.workingSets.default.current", + "scm.workingSets.default", + "scm.compactFolders", + "scm.graph.pageOnScroll", + "scm.graph.pageSize", + "scm.graph.badges.all", + "scm.graph.badges.filter", + "scm.graph.badges", + "scm.graph.showIncomingChanges", + "scm.graph.showOutgoingChanges", + "scm accept", + "scm view next commit", + "scm view previous commit", + "scmActiveRepositoryPlaceHolder", + "scmActiveRepositoryAutoDescription", + "open in external terminal", + "open in integrated terminal", + "quickDiffDecoration", + "scmEditorResolveMergeConflict", + "source control", + "scmRepositories", + "scmChanges", + "scmGraph" + ], + "vs/workbench/contrib/scm/browser/scmAccessibilityHelp": [ + "state-msg1", + "state-msg2", + "state-msg3", + "state-msg4", + "enabled", + "disabled", + "state-msg5", + "state-msg6", + "scm-repositories-msg1", + "scm-repositories-msg2", + "scm-repositories-msg3", + "scm-repositories-msg4", + "scm-repositories-msg5", + "scm-repositories-msg6", + "scm-msg1", + "scm-msg2", + "scm-msg3", + "scm-msg4", + "scm-msg5", + "scm-graph-msg1", + "scm-graph-msg2", + "scm-graph-msg3", + "scm-graph-msg4", + "scm-graph-msg5" + ], + "vs/workbench/contrib/scm/browser/scmHistory": [ + "scmGraphHistoryItemRefColor", + "scmGraphHistoryItemRemoteRefColor", + "scmGraphHistoryItemBaseRefColor", + "scmGraphHistoryItemHoverDefaultLabelForeground", + "scmGraphHistoryItemHoverDefaultLabelBackground", + "scmGraphHistoryItemHoverLabelForeground", + "scmGraph.HistoryItemHoverAdditionsForeground", + "scmGraph.HistoryItemHoverDeletionsForeground", + "scmGraphForeground1", + "scmGraphForeground2", + "scmGraphForeground3", + "scmGraphForeground4", + "scmGraphForeground5", + "incomingChanges", + "outgoingChanges" + ], + "vs/workbench/contrib/scm/browser/scmHistoryChatContext": [ + "chatContext.scmHistoryItems", + "chatContext.scmHistoryItems.placeholder", + "files", + "chat.action.scmHistoryItemContext", + "chat.action.scmHistoryItemSummarize", + "chat.action.scmHistoryItemContext" + ], + "vs/workbench/contrib/scm/browser/scmHistoryViewPane": [ + "all", + "auto", + "items", + "allHistoryItemRefs", + "repositoryPicker", + "referencePicker", + "goToCurrentHistoryItem", + "refreshGraph", + "setListViewMode", + "setTreeViewMode", + "openChanges", + "openFile", + "incomingChanges", + "outgoingChanges", + "loadMore", + "scm history", + "auto", + "activeRepository", + "scmGraphRepository", + "all", + "allHistoryItemRefs", + "auto", + "currentHistoryItemRef", + "scmGraphHistoryItemRef", + "scmGraphViewOutdated", + "incomingChanges", + "outgoingChanges" + ], + "vs/workbench/contrib/scm/browser/scmRepositoriesViewPane": [ + "scm" + ], + "vs/workbench/contrib/scm/browser/scmViewPane": [ + "scm", + "scmInput", + "scmInputRow.accessibilityHelp", + "scmInputRow.accessibilityHelpNoKb", + "sortAction", + "repositories", + "setListViewMode", + "setTreeViewMode", + "repositorySortByDiscoveryTime", + "repositorySortByName", + "repositorySortByPath", + "repositorySingleSelectionMode", + "repositoryMultiSelectionMode", + "sortChangesByName", + "sortChangesByPath", + "sortChangesByStatus", + "collapse all", + "expand all", + "scmInputGenerateCommitMessage", + "scmInputMoreActions", + "scmInputCancelAction", + "scmInput.accessibilityHelp", + "scmInput.accessibilityHelpNoKb", + "label.close" + ], + "vs/workbench/contrib/scm/browser/scmViewService": [ + "auto" + ], + "vs/workbench/contrib/scm/common/quickDiff": [ + "editorGutterModifiedBackground", + "editorGutterModifiedSecondaryBackground", + "editorGutterAddedBackground", + "editorGutterAddedSecondaryBackground", + "editorGutterDeletedBackground", + "editorGutterDeletedSecondaryBackground", + "minimapGutterModifiedBackground", + "minimapGutterAddedBackground", + "minimapGutterDeletedBackground", + "overviewRulerModifiedForeground", + "overviewRulerAddedForeground", + "overviewRulerDeletedForeground", + "editorGutterItemGlyphForeground", + "editorGutterItemBackground" + ], + "vs/workbench/contrib/scrollLocking/browser/scrollLocking": [ + "mouseScrolllingLocked", + "mouseLockScrollingEnabled", + { + "key": "miToggleLockedScrolling", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "synchronizeScrolling", + { + "key": "miHoldLockedScrolling", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "toggleLockedScrolling", + "holdLockedScrolling" + ], + "vs/workbench/contrib/search/browser/anythingQuickAccess": [ + "noAnythingResults", + "recentlyOpenedSeparator", + "recentlyOpenedSeparator", + "fileAndSymbolResultsSeparator", + "fileResultsSeparator", + "helpPickAriaLabel", + "chat", + { + "key": "openToSide", + "comment": [ + "Open this file in a split editor on the left/right side" + ] + }, + { + "key": "openToBottom", + "comment": [ + "Open this file in a split editor on the bottom" + ] + }, + "closeEditor", + "filePickAriaLabelDirty" + ], + "vs/workbench/contrib/search/browser/patternInputWidget": [ + "defaultLabel", + "onlySearchInOpenEditors", + "useExcludesAndIgnoreFilesDescription" + ], + "vs/workbench/contrib/search/browser/quickTextSearch/textSearchQuickAccess": [ + "goToSearch", + "QuickSearchSeeMoreFiles", + "QuickSearchOpenInFile", + "QuickSearchMore", + "showMore", + "enterSearchTerm", + "noAnythingResults" + ], + "vs/workbench/contrib/search/browser/replaceService": [ + "searchReplace.source", + "fileReplaceChanges" + ], + "vs/workbench/contrib/search/browser/search.contribution": [ + { + "key": "miViewSearch", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "anythingQuickAccessPlaceholder", + "anythingQuickAccess", + "symbolsQuickAccessPlaceholder", + "symbolsQuickAccess", + "textSearchPickerPlaceholder", + "textSearchPickerHelp", + "searchConfigurationTitle", + "exclude", + "exclude.boolean", + { + "key": "exclude.when", + "comment": [ + "\\$(basename) should not be translated" + ] + }, + "search.mode", + "search.mode.view", + "search.mode.reuseEditor", + "search.mode.newEditor", + "useRipgrep", + "useRipgrepDeprecated", + "maintainFileSearchCacheDeprecated", + "search.maintainFileSearchCache", + "useIgnoreFiles", + "useGlobalIgnoreFiles", + "useParentIgnoreFiles", + "search.quickOpen.includeSymbols", + "search.ripgrep.maxThreads", + "search.quickOpen.includeHistory", + "filterSortOrder.default", + "filterSortOrder.recency", + "filterSortOrder", + "search.followSymlinks", + "search.smartCase", + "search.globalFindClipboard", + "search.location", + "search.location.deprecationMessage", + "search.maxResults", + "search.collapseResults.auto", + "search.collapseAllResults", + "search.useReplacePreview", + "search.showLineNumbers", + "search.usePCRE2", + "usePCRE2Deprecated", + "search.actionsPositionAuto", + "search.actionsPositionRight", + "search.actionsPosition", + "search.searchOnType", + "search.seedWithNearestWord", + "search.seedOnFocus", + "search.searchOnTypeDebouncePeriod", + "search.searchEditor.doubleClickBehaviour.selectWord", + "search.searchEditor.doubleClickBehaviour.goToLocation", + "search.searchEditor.doubleClickBehaviour.openLocationToSide", + "search.searchEditor.doubleClickBehaviour", + "search.searchEditor.singleClickBehaviour.default", + "search.searchEditor.singleClickBehaviour.peekDefinition", + "search.searchEditor.singleClickBehaviour", + { + "key": "search.searchEditor.reusePriorSearchConfiguration", + "comment": [ + "\"Search Editor\" is a type of editor that can display search results. \"includes, excludes, and flags\" refers to the \"files to include\" and \"files to exclude\" input boxes, and the flags that control whether a query is case-sensitive or a regex." + ] + }, + "search.searchEditor.defaultNumberOfContextLines", + "search.searchEditor.focusResultsOnSearch", + "searchSortOrder.default", + "searchSortOrder.filesOnly", + "searchSortOrder.type", + "searchSortOrder.modified", + "searchSortOrder.countDescending", + "searchSortOrder.countAscending", + "search.sortOrder", + "search.decorations.colors", + "search.decorations.badges", + "scm.defaultViewMode.tree", + "scm.defaultViewMode.list", + "search.defaultViewMode", + "search.quickAccess.preserveInput", + "search.experimental.closedNotebookResults", + "search.searchView.semanticSearchBehavior", + "search.searchView.semanticSearchBehavior.manual", + "search.searchView.semanticSearchBehavior.runOnEmpty", + "search.searchView.semanticSearchBehavior.auto", + "search.searchView.keywordSuggestions", + "search", + "search" + ], + "vs/workbench/contrib/search/browser/searchActionsBase": [ + "search" + ], + "vs/workbench/contrib/search/browser/searchActionsCopy": [ + "copyMatchLabel", + "copyPathLabel", + "copyAllLabel", + "getSearchResultsLabel" + ], + "vs/workbench/contrib/search/browser/searchActionsFind": [ + "search.expandRecursively", + { + "key": "miFindInFiles", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "findInFiles.description", + "findInFiles.args", + "restrictResultsToFolder", + "excludeFolderFromSearch", + "excludeFileTypeFromSearch", + "includeFileTypeInSearch", + "revealInSideBar", + "findInFiles", + "findInFolder", + "findInWorkspace" + ], + "vs/workbench/contrib/search/browser/searchActionsNav": [ + "ToggleQueryDetailsAction.label", + "CloseReplaceWidget.label", + "ToggleCaseSensitiveCommandId.label", + "ToggleWholeWordCommandId.label", + "ToggleRegexCommandId.label", + "TogglePreserveCaseId.label", + "OpenMatch.label", + "OpenMatchToSide.label", + "AddCursorsAtSearchResults.label", + "FocusNextInputAction.label", + "FocusPreviousInputAction.label", + "FocusSearchFromResults.label", + "toggleTabs", + "focusSearchListCommandLabel", + "FocusNextSearchResult.label", + "FocusPreviousSearchResult.label", + "replaceInFiles" + ], + "vs/workbench/contrib/search/browser/searchActionsRemoveReplace": [ + "RemoveAction.label", + "match.replace.label", + "file.replaceAll.label", + "file.replaceAll.label" + ], + "vs/workbench/contrib/search/browser/searchActionsSymbol": [ + "showTriggerActions", + { + "key": "miGotoSymbolInWorkspace", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "showTriggerActions" + ], + "vs/workbench/contrib/search/browser/searchActionsTextQuickAccess": [ + "quickTextSearch" + ], + "vs/workbench/contrib/search/browser/searchActionsTopBar": [ + "clearSearchHistoryLabel", + "CancelSearchAction.label", + "RefreshAction.label", + "CollapseDeepestExpandedLevelAction.label", + "ExpandAllAction.label", + "ClearSearchResultsAction.label", + "ViewAsTreeAction.label", + "ViewAsListAction.label", + "SearchWithAIAction.label" + ], + "vs/workbench/contrib/search/browser/searchChatContext": [ + "chatContext.searchResults", + "symbols", + "select.symb", + "chatContext.folder", + "chatContext.attach.files.placeholder" + ], + "vs/workbench/contrib/search/browser/searchFindInput": [ + "searchFindInputNotebookFilter.label" + ], + "vs/workbench/contrib/search/browser/searchIcons": [ + "searchDetailsIcon", + "searchSeeMoreIcon", + "searchShowContextIcon", + "searchHideReplaceIcon", + "searchShowReplaceIcon", + "searchReplaceAllIcon", + "searchReplaceIcon", + "searchRemoveIcon", + "searchRefreshIcon", + "searchCollapseAllIcon", + "searchExpandAllIcon", + "searchShowAsTree", + "searchShowAsList", + "searchClearIcon", + "searchStopIcon", + "searchViewIcon", + "searchNewEditorIcon", + "searchOpenInFile", + "searchSparkleFilled", + "searchSparkleEmpty" + ], + "vs/workbench/contrib/search/browser/searchMessage": [ + "unable to open trust", + "unable to open" + ], + "vs/workbench/contrib/search/browser/searchResultsView": [ + "searchFolderMatch.plainText.label", + { + "key": "searchFolderMatch.aiText.label", + "comment": [ + "This is displayed before the AI text search results, now always \"AI-assisted results\"." + ] + }, + "searchFolderMatch.other.label", + "searchFolderMatch.other.label", + "searchFileMatches", + "searchFileMatch", + "searchMatches", + "searchMatch", + "lineNumStr", + "numLinesStr", + "search", + "folderMatchAriaLabel", + "otherFilesAriaLabel", + "fileMatchAriaLabel", + "replacePreviewResultAria", + "searchResultAria" + ], + "vs/workbench/contrib/search/browser/searchView": [ + "searchCanceled", + "moreSearch", + "searchScope.includes", + "placeholder.includes", + "searchScope.excludes", + "placeholder.excludes", + "replaceAll.confirmation.title", + { + "key": "replaceAll.confirm.button", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "replaceAll.occurrence.file.message", + "removeAll.occurrence.file.message", + "replaceAll.occurrence.files.message", + "removeAll.occurrence.files.message", + "replaceAll.occurrences.file.message", + "removeAll.occurrences.file.message", + "replaceAll.occurrences.files.message", + "removeAll.occurrences.files.message", + "removeAll.occurrence.file.confirmation.message", + "replaceAll.occurrence.file.confirmation.message", + "removeAll.occurrence.files.confirmation.message", + "replaceAll.occurrence.files.confirmation.message", + "removeAll.occurrences.file.confirmation.message", + "replaceAll.occurrences.file.confirmation.message", + "removeAll.occurrences.files.confirmation.message", + "replaceAll.occurrences.files.confirmation.message", + "emptySearch", + "searchPathNotFoundError", + "triggerAISearch.tooltip", + "searchWithAIButtonTooltip", + "noOpenEditorResultsIncludesExcludes", + "noOpenEditorResultsIncludes", + "noOpenEditorResultsExcludes", + "noOpenEditorResultsFound", + "noResultsIncludesExcludes", + "noResultsIncludes", + "noResultsExcludes", + "noResultsFound", + "rerunSearch.message", + "rerunSearchInAll.message", + "openSettings.message", + "ariaSearchResultsStatus", + "searchMaxResultsWarning", + "forTerm", + "useIgnoresAndExcludesDisabled", + "excludes.enable", + "useExcludesAndIgnoreFilesDescription", + "onlyOpenEditors", + "openEditors.disable", + "disableOpenEditors", + "openInEditor.tooltip", + "openInEditor.message", + "keywordSuggestion.message", + "search.file.result", + "search.files.result", + "search.file.results", + "search.files.results", + "searchWithoutFolder", + "openFolder" + ], + "vs/workbench/contrib/search/browser/searchWidget": [ + "search.action.replaceAll.disabled.label", + "search.action.replaceAll.enabled.label", + "search.replace.toggle.button.title", + "label.Search", + "search.placeHolder", + "showContext", + "label.Replace", + "search.replace.placeHolder" + ], + "vs/workbench/contrib/search/browser/symbolsQuickAccess": [ + "noSymbolResults", + "openToSide", + "openToBottom" + ], + "vs/workbench/contrib/searchEditor/browser/searchEditor.contribution": [ + "searchEditor", + "promptOpenWith.searchEditor.displayName", + "search.openNewEditor", + "search", + "searchEditor.deleteResultBlock", + "search.openNewSearchEditor", + "search.openSearchEditor", + "search.openNewEditorToSide", + "search.openResultsInEditor", + "search.rerunSearchInEditor", + "search.action.focusQueryEditorWidget", + "search.action.focusFilesToInclude", + "search.action.focusFilesToExclude", + "searchEditor.action.toggleSearchEditorCaseSensitive", + "searchEditor.action.toggleSearchEditorWholeWord", + "searchEditor.action.toggleSearchEditorRegex", + "searchEditor.action.toggleSearchEditorContextLines", + "searchEditor.action.increaseSearchEditorContextLines", + "searchEditor.action.decreaseSearchEditorContextLines", + "searchEditor.action.selectAllSearchEditorMatches" + ], + "vs/workbench/contrib/searchEditor/browser/searchEditor": [ + "moreSearch", + "searchScope.includes", + "label.includes", + "searchScope.excludes", + "label.excludes", + "runSearch", + "searchResultItem", + "searchEditor", + "textInputBoxBorder" + ], + "vs/workbench/contrib/searchEditor/browser/searchEditorInput": [ + "searchEditorLabelIcon", + "searchTitle.withQuery", + "searchTitle.withQuery", + "searchTitle" + ], + "vs/workbench/contrib/searchEditor/browser/searchEditorSerialization": [ + "invalidQueryStringError", + "numFiles", + "oneFile", + "numResults", + "oneResult", + "noResults", + "searchMaxResultsWarning" + ], + "vs/workbench/contrib/share/browser/share.contribution": [ + "generating link", + "shareTextSuccess", + "shareSuccess", + "close", + "open link", + "experimental.share.enabled", + "share" + ], + "vs/workbench/contrib/share/browser/shareService": [ + "shareProviderCount", + "type to filter", + "toggle.share", + "toggle.shareDescription" + ], + "vs/workbench/contrib/snippets/browser/commands/abstractSnippetsActions": [ + "snippets" + ], + "vs/workbench/contrib/snippets/browser/commands/configureSnippets": [ + "global.scope", + "global.1", + "detail.label", + "name", + "bad_name1", + "bad_name2", + "bad_name3", + { + "key": "miOpenSnippets", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "new.global_scope", + "new.global", + "new.workspace_scope", + "new.folder", + "group.global", + "new.global.sep", + "new.global.sep", + "openSnippet.pickLanguage", + "openSnippet.label", + "userSnippets" + ], + "vs/workbench/contrib/snippets/browser/commands/fileTemplateSnippets": [ + "placeholder", + "label" + ], + "vs/workbench/contrib/snippets/browser/commands/insertSnippet": [ + "snippet.suggestions.label" + ], + "vs/workbench/contrib/snippets/browser/commands/surroundWithSnippet": [ + "label" + ], + "vs/workbench/contrib/snippets/browser/snippetCodeActionProvider": [ + "more", + "codeAction", + "overflow.start.title", + "title" + ], + "vs/workbench/contrib/snippets/browser/snippetCompletionProvider": [ + "detail.snippet", + "snippetSuggest.longLabel", + "snippetSuggest.longLabel" + ], + "vs/workbench/contrib/snippets/browser/snippetPicker": [ + "sep.userSnippet", + "sep.workspaceSnippet", + "disableSnippet", + "isDisabled", + "enable.snippet", + "pick.placeholder", + "pick.noSnippetAvailable" + ], + "vs/workbench/contrib/snippets/browser/snippets.contribution": [ + "editor.snippets.codeActions.enabled", + "snippetSchema.json.prefix", + "snippetSchema.json.isFileTemplate", + "snippetSchema.json.body", + "snippetSchema.json.description", + "snippetSchema.json.default", + "snippetSchema.json", + "snippetSchema.json.default", + "snippetSchema.json", + "snippetSchema.json.scope" + ], + "vs/workbench/contrib/snippets/browser/snippetsFile": [ + "source.workspaceSnippetGlobal", + "source.userSnippetGlobal", + "source.userSnippet" + ], + "vs/workbench/contrib/snippets/browser/snippetsService": [ + "invalid.path.0", + "invalid.language.0", + "invalid.language", + "invalid.path.1", + "vscode.extension.contributes.snippets", + "vscode.extension.contributes.snippets-language", + "vscode.extension.contributes.snippets-path", + "badVariableUse", + "badFile" + ], + "vs/workbench/contrib/speech/browser/speechService": [ + "vscode.extension.contributes.speechProvider", + "speechProviderName", + "speechProviderDescription" + ], + "vs/workbench/contrib/speech/common/speechService": [ + "hasSpeechProvider", + "speechToTextInProgress", + "textToSpeechInProgress", + "speechLanguage.da-DK", + "speechLanguage.de-DE", + "speechLanguage.en-AU", + "speechLanguage.en-CA", + "speechLanguage.en-GB", + "speechLanguage.en-IE", + "speechLanguage.en-IN", + "speechLanguage.en-NZ", + "speechLanguage.en-US", + "speechLanguage.es-ES", + "speechLanguage.es-MX", + "speechLanguage.fr-CA", + "speechLanguage.fr-FR", + "speechLanguage.hi-IN", + "speechLanguage.it-IT", + "speechLanguage.ja-JP", + "speechLanguage.ko-KR", + "speechLanguage.nl-NL", + "speechLanguage.pt-PT", + "speechLanguage.pt-BR", + "speechLanguage.ru-RU", + "speechLanguage.sv-SE", + "speechLanguage.tr-TR", + "speechLanguage.zh-CN", + "speechLanguage.zh-HK", + "speechLanguage.zh-TW" + ], + "vs/workbench/contrib/surveys/browser/languageSurveys.contribution": [ + "helpUs", + "takeShortSurvey", + "remindLater", + "neverAgain" + ], + "vs/workbench/contrib/surveys/browser/nps.contribution": [ + "surveyQuestion", + "takeSurvey", + "remindLater", + "neverAgain" + ], + "vs/workbench/contrib/tasks/browser/abstractTaskService": [ + "tasks", + "TaskService.pickBuildTaskForLabel", + "taskEvent", + "TaskService.skippingReconnection", + "TaskService.notConnecting", + "TaskService.reconnecting", + "TaskService.reconnected", + "task.longRunningTaskCompletedWithLabel", + "task.longRunningTaskCompleted", + "task.longRunningTaskDurationMinutesSeconds", + "task.longRunningTaskDurationMinutes", + "task.longRunningTaskDurationSeconds", + "TaskService.noTasks", + "TaskService.reconnectingTasks", + "runTask.arg", + "runTask.label", + "runTask.type", + "runTask.task", + "troubleshootWithChat", + "showOutput", + "taskServiceOutputPromptChat", + "taskServiceOutputPrompt", + "TaskServer.folderIgnored", + "TaskService.providerUnavailable", + "taskService.gettingCachedTasks", + "taskService.getSavedTasks", + "taskService.getSavedTasks.reading", + "taskService.getSavedTasks.error", + "taskService.getSavedTasks.resolved", + "taskService.getSavedTasks.unresolved", + "taskService.removePersistentTask", + "taskService.setPersistentTask", + "savePersistentTask", + "TaskService.noTestTask1", + "TaskService.noTestTask2", + "TaskService.noBuildTask1", + "TaskService.noBuildTask2", + "TaskServer.noTask", + "TaskService.associate", + "TaskService.attachProblemMatcher.continueWithout", + "TaskService.attachProblemMatcher.never", + "TaskService.attachProblemMatcher.neverType", + "TaskService.attachProblemMatcher.learnMoreAbout", + "selectProblemMatcher", + "customizeParseErrors", + "tasksJsonComment", + "moreThanOneBuildTask", + "TaskSystem.saveBeforeRun.prompt.title", + "detail", + { + "key": "saveBeforeRun.save", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "saveBeforeRun.dontSave", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "TaskSystem.active", + "TaskSystem.InstancePolicy.warn", + "TaskService.instanceToTerminate", + "TaskService.noInstanceRunning", + "TaskSystem.restartFailed", + "TaskSystem.taskNoLongerExists", + "unexpectedTaskType", + "TaskService.providerUnavailable", + "TaskService.noConfiguration", + "TaskSystem.configurationErrors", + { + "key": "TaskSystem.invalidTaskJsonOther", + "comment": [ + "Message notifies of an error in one of several places there is tasks related json, not necessarily in a file named tasks.json" + ] + }, + { + "key": "TaskSystem.invalidTaskJsonOther", + "comment": [ + "Message notifies of an error in one of several places there is tasks related json, not necessarily in a file named tasks.json" + ] + }, + "TasksSystem.locationWorkspaceConfig", + "TaskSystem.versionWorkspaceFile", + "TasksSystem.locationUserConfig", + "TaskSystem.versionSettings", + "TaskSystem.configurationErrors", + "taskService.ignoringFolder", + "TaskSystem.invalidTaskJson", + "TaskSystem.invalidTaskJson", + "TerminateAction.label", + "TaskSystem.unknownError", + "configureTask", + "recentlyUsed", + "configured", + "detected", + "TaskService.ignoredFolder", + "TaskService.notAgain", + "TaskService.requestTrust", + "TaskService.pickRunTask", + "TaskService.noEntryToRun", + "TaskService.noEntryToRun", + "TaskService.fetchingBuildTasks", + "TaskService.pickBuildTask", + "TaskService.noBuildTask", + "TaskService.fetchingTestTasks", + "TaskService.pickTestTask", + "TaskService.noTestTaskTerminal", + "TaskService.taskToTerminate", + "TaskService.noTaskRunning", + "TaskService.terminateAllRunningTasks", + "TerminateAction.noProcess", + "TerminateAction.failed", + "TaskService.taskToRestart", + "TaskService.noTaskToRestart", + "TaskService.noRunningTasks", + "TaskService.template", + "taskQuickPick.userSettings", + "TaskService.createJsonFile", + "TaskService.openJsonFile", + "TaskService.pickTask", + "TaskService.defaultBuildTaskExists", + "TaskService.pickTask", + "TaskService.pickDefaultBuildTask", + "TaskService.defaultTestTaskExists", + "TaskService.pickDefaultTestTask", + "TaskService.pickShowTask", + "TaskService.noTaskIsRunning", + "taskService.upgradeVersion", + "taskService.upgradeVersionPlural", + "taskService.openDiff", + "taskService.openDiffs", + "ConfigureTaskRunnerAction.label" + ], + "vs/workbench/contrib/tasks/browser/runAutomaticTasks": [ + "workbench.action.tasks.manageAutomaticRunning", + "workbench.action.tasks.allowAutomaticTasks", + "workbench.action.tasks.disallowAutomaticTasks" + ], + "vs/workbench/contrib/tasks/browser/task.contribution": [ + "building", + "status.runningTasks", + "numberOfRunningTasks", + "runningTasks", + { + "key": "miRunTask", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miBuildTask", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miRunningTask", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miRestartTask", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miTerminateTask", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miConfigureTask", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miConfigureBuildTask", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "tasks", + "tasksQuickAccessPlaceholder", + "tasksQuickAccessHelp", + "tasksConfigurationTitle", + "task.problemMatchers.neverPrompt", + "task.problemMatchers.neverPrompt.boolean", + "task.problemMatchers.neverPrompt.array", + "task.autoDetect", + "task.slowProviderWarning", + "task.slowProviderWarning.boolean", + "task.slowProviderWarning.array", + "task.quickOpen.history", + "task.quickOpen.detail", + "task.quickOpen.skip", + "task.quickOpen.showAll", + "task.allowAutomaticTasks.on", + "task.allowAutomaticTasks.off", + "task.allowAutomaticTasks", + "task.reconnection", + "task.saveBeforeRun", + "task.saveBeforeRun.always", + "task.saveBeforeRun.never", + "task.SaveBeforeRun.prompt", + "task.NotifyWindowOnTaskCompletion", + "task.verboseLogging", + "workbench.action.tasks.openWorkspaceFileTasks", + "ShowLogAction.label", + "RunTaskAction.label", + "ReRunTaskAction.label", + "RestartTaskAction.label", + "RerunAllRunningTasksAction.label", + "ShowTasksAction.label", + "TerminateAction.label", + "BuildAction.label", + "TestAction.label", + "ConfigureDefaultBuildTask.label", + "ConfigureDefaultTestTask.label", + "workbench.action.tasks.openUserTasks", + "workbench.action.tasks.rerunForActiveTerminal" + ], + "vs/workbench/contrib/tasks/browser/taskQuickPick": [ + "taskQuickPick.showAll", + "configureTaskIcon", + "removeTaskIcon", + "configureTask", + "contributedTasks", + "taskType", + "removeRecent", + "recentlyUsed", + "configured", + "configured", + "TaskQuickPick.changeSettingDetails", + "TaskQuickPick.changeSettingNo", + "TaskService.pickRunTask", + "TaskQuickPick.changeSettingsOptions", + "TaskQuickPick.goBack", + "TaskQuickPick.noTasksForType", + "noProviderForTask" + ], + "vs/workbench/contrib/tasks/browser/taskService": [ + "taskService.processTaskSystem" + ], + "vs/workbench/contrib/tasks/browser/tasksQuickAccess": [ + "noTaskResults", + "TaskService.pickRunTask" + ], + "vs/workbench/contrib/tasks/browser/taskTerminalStatus": [ + "taskTerminalStatus.active", + "taskTerminalStatus.succeeded", + "taskTerminalStatus.succeededInactive", + "taskTerminalStatus.errors", + "taskTerminalStatus.errorsInactive", + "taskTerminalStatus.warnings", + "taskTerminalStatus.warningsInactive", + "taskTerminalStatus.infos", + "taskTerminalStatus.infosInactive", + "task.watchFirstError" + ], + "vs/workbench/contrib/tasks/browser/terminalTaskSystem": [ + "rerunTask", + "TerminalTaskSystem.unknownError", + "TerminalTaskSystem.taskLoadReporting", + "dependencyCycle", + "dependencyFailed", + "TerminalTaskSystem.nonWatchingMatcher", + { + "key": "task.executingInFolder", + "comment": [ + "The workspace folder the task is running in", + "The task command line or label" + ] + }, + { + "key": "task.executing.shellIntegration", + "comment": [ + "The task command line or label" + ] + }, + { + "key": "task.executingInFolder", + "comment": [ + "The workspace folder the task is running in", + "The task command line or label" + ] + }, + { + "key": "task.executing.shell-integration", + "comment": [ + "The task command line or label" + ] + }, + { + "key": "task.executing", + "comment": [ + "The task command line or label" + ] + }, + "TerminalTaskSystem", + "unknownProblemMatcher", + "closeTerminal", + "reuseTerminal" + ], + "vs/workbench/contrib/tasks/common/jsonSchema_v1": [ + "JsonSchema.version.deprecated", + "JsonSchema.version", + "JsonSchema._runner", + "JsonSchema.runner", + "JsonSchema.windows", + "JsonSchema.mac", + "JsonSchema.linux", + "JsonSchema.shell" + ], + "vs/workbench/contrib/tasks/common/jsonSchema_v2": [ + "JsonSchema.shell", + "JsonSchema.tasks.isShellCommand.deprecated", + "JsonSchema.hide", + "JsonSchema.tasks.dependsOn.identifier", + "JsonSchema.tasks.dependsOn.string", + "JsonSchema.tasks.dependsOn.array", + "JsonSchema.tasks.dependsOn", + "JsonSchema.tasks.dependsOrder.parallel", + "JsonSchema.tasks.dependsOrder.sequence", + "JsonSchema.tasks.dependsOrder", + "JsonSchema.tasks.detail", + "JsonSchema.tasks.icon", + "JsonSchema.tasks.icon.id", + "JsonSchema.tasks.icon.color", + "JsonSchema.tasks.presentation", + "JsonSchema.tasks.presentation.echo", + "JsonSchema.tasks.presentation.focus", + "JsonSchema.tasks.presentation.revealProblems.always", + "JsonSchema.tasks.presentation.revealProblems.onProblem", + "JsonSchema.tasks.presentation.revealProblems.never", + "JsonSchema.tasks.presentation.revealProblems", + "JsonSchema.tasks.presentation.reveal.always", + "JsonSchema.tasks.presentation.reveal.silent", + "JsonSchema.tasks.presentation.reveal.never", + "JsonSchema.tasks.presentation.reveal", + "JsonSchema.tasks.presentation.instance", + "JsonSchema.tasks.presentation.showReuseMessage", + "JsonSchema.tasks.presentation.clear", + "JsonSchema.tasks.presentation.group", + "JsonSchema.tasks.presentation.close", + "JsonSchema.tasks.presentation.preserveTerminalName", + "JsonSchema.tasks.terminal", + "JsonSchema.tasks.group.build", + "JsonSchema.tasks.group.test", + "JsonSchema.tasks.group.none", + "JsonSchema.tasks.group.kind", + "JsonSchema.tasks.group.isDefault", + "JsonSchema.tasks.group.defaultBuild", + "JsonSchema.tasks.group.defaultTest", + "JsonSchema.tasks.group", + "JsonSchema.tasks.type", + "JsonSchema.commandArray", + "JsonSchema.commandArray", + "JsonSchema.command.quotedString.value", + "JsonSchema.tasks.quoting.escape", + "JsonSchema.tasks.quoting.strong", + "JsonSchema.tasks.quoting.weak", + "JsonSchema.command.quotesString.quote", + "JsonSchema.command", + "JsonSchema.args.quotedString.value", + "JsonSchema.tasks.quoting.escape", + "JsonSchema.tasks.quoting.strong", + "JsonSchema.tasks.quoting.weak", + "JsonSchema.args.quotesString.quote", + "JsonSchema.tasks.args", + "JsonSchema.tasks.label", + "JsonSchema.version", + "JsonSchema.tasks.identifier", + "JsonSchema.tasks.identifier.deprecated", + "JsonSchema.tasks.reevaluateOnRerun", + "JsonSchema.tasks.runOn", + "JsonSchema.tasks.instanceLimit", + "JsonSchema.tasks.instancePolicy.terminateNewest", + "JsonSchema.tasks.instancePolicy.terminateOldest", + "JsonSchema.tasks.instancePolicy.prompt", + "JsonSchema.tasks.instancePolicy.warn", + "JsonSchema.tasks.instancePolicy.silent", + "JsonSchema.tasks.instancePolicy", + "JsonSchema.tasks.runOptions", + "JsonSchema.tasks.taskLabel", + "JsonSchema.tasks.taskName", + "JsonSchema.tasks.taskName.deprecated", + "JsonSchema.tasks.background", + "JsonSchema.tasks.promptOnClose", + "JsonSchema.tasks.matchers", + "JsonSchema.customizations.customizes.type", + "JsonSchema.tasks.customize.deprecated", + "JsonSchema.tasks.taskName.deprecated", + "JsonSchema.tasks.showOutput.deprecated", + "JsonSchema.tasks.echoCommand.deprecated", + "JsonSchema.tasks.suppressTaskName.deprecated", + "JsonSchema.tasks.isBuildCommand.deprecated", + "JsonSchema.tasks.isTestCommand.deprecated", + "JsonSchema.tasks.type", + "JsonSchema.tasks.suppressTaskName.deprecated", + "JsonSchema.tasks.taskSelector.deprecated", + "JsonSchema.windows", + "JsonSchema.mac", + "JsonSchema.linux" + ], + "vs/workbench/contrib/tasks/common/jsonSchemaCommon": [ + "JsonSchema.options", + "JsonSchema.options.cwd", + "JsonSchema.options.env", + "JsonSchema.tasks.matcherError", + "JsonSchema.tasks.matcherError", + "JsonSchema.shellConfiguration", + "JsonSchema.shell.executable", + "JsonSchema.shell.args", + "JsonSchema.command", + "JsonSchema.tasks.args", + "JsonSchema.tasks.taskName", + "JsonSchema.command", + "JsonSchema.tasks.args", + "JsonSchema.tasks.windows", + "JsonSchema.tasks.matchers", + "JsonSchema.tasks.mac", + "JsonSchema.tasks.matchers", + "JsonSchema.tasks.linux", + "JsonSchema.tasks.matchers", + "JsonSchema.tasks.suppressTaskName", + "JsonSchema.tasks.showOutput", + "JsonSchema.echoCommand", + "JsonSchema.tasks.watching.deprecation", + "JsonSchema.tasks.watching", + "JsonSchema.tasks.background", + "JsonSchema.tasks.promptOnClose", + "JsonSchema.tasks.build", + "JsonSchema.tasks.test", + "JsonSchema.tasks.matchers", + "JsonSchema.command", + "JsonSchema.args", + "JsonSchema.showOutput", + "JsonSchema.watching.deprecation", + "JsonSchema.watching", + "JsonSchema.background", + "JsonSchema.promptOnClose", + "JsonSchema.echoCommand", + "JsonSchema.suppressTaskName", + "JsonSchema.taskSelector", + "JsonSchema.matchers", + "JsonSchema.tasks" + ], + "vs/workbench/contrib/tasks/common/problemMatcher": [ + "ProblemPatternParser.problemPattern.missingRegExp", + "ProblemPatternParser.loopProperty.notLast", + "ProblemPatternParser.problemPattern.emptyPattern", + "ProblemPatternParser.problemPattern.emptyPattern", + "ProblemPatternParser.problemPattern.kindProperty.notFirst", + "ProblemPatternParser.problemPattern.missingProperty", + "ProblemPatternParser.problemPattern.missingLocation", + "ProblemPatternParser.invalidRegexp", + "ProblemPatternSchema.regexp", + "ProblemPatternSchema.kind", + "ProblemPatternSchema.file", + "ProblemPatternSchema.location", + "ProblemPatternSchema.line", + "ProblemPatternSchema.column", + "ProblemPatternSchema.endLine", + "ProblemPatternSchema.endColumn", + "ProblemPatternSchema.severity", + "ProblemPatternSchema.code", + "ProblemPatternSchema.message", + "ProblemPatternSchema.loop", + "NamedProblemPatternSchema.name", + "NamedMultiLineProblemPatternSchema.name", + "NamedMultiLineProblemPatternSchema.patterns", + "WatchingPatternSchema.regexp", + "WatchingPatternSchema.file", + "PatternTypeSchema.name", + "PatternTypeSchema.description", + "ProblemMatcherSchema.base", + "ProblemMatcherSchema.owner", + "ProblemMatcherSchema.source", + "ProblemMatcherSchema.severity", + "ProblemMatcherSchema.applyTo", + "ProblemMatcherSchema.fileLocation", + "ProblemMatcherSchema.background", + "ProblemMatcherSchema.background.activeOnStart", + "ProblemMatcherSchema.background.beginsPattern", + "ProblemMatcherSchema.background.endsPattern", + "ProblemMatcherSchema.watching.deprecated", + "ProblemMatcherSchema.watching", + "ProblemMatcherSchema.watching.activeOnStart", + "ProblemMatcherSchema.watching.beginsPattern", + "ProblemMatcherSchema.watching.endsPattern", + "LegacyProblemMatcherSchema.watchedBegin.deprecated", + "LegacyProblemMatcherSchema.watchedBegin", + "LegacyProblemMatcherSchema.watchedEnd.deprecated", + "LegacyProblemMatcherSchema.watchedEnd", + "NamedProblemMatcherSchema.name", + "NamedProblemMatcherSchema.label", + "ProblemPatternExtPoint", + "ProblemPatternRegistry.error", + "ProblemPatternRegistry.error", + "ProblemMatcherParser.noProblemMatcher", + "ProblemMatcherParser.noProblemPattern", + "ProblemMatcherParser.noOwner", + "ProblemMatcherParser.noFileLocation", + "ProblemMatcherParser.unknownSeverity", + "ProblemMatcherParser.noDefinedPatter", + "ProblemMatcherParser.noIdentifier", + "ProblemMatcherParser.noValidIdentifier", + "ProblemMatcherParser.problemPattern.watchingMatcher", + "ProblemMatcherParser.invalidRegexp", + "ProblemMatcherExtPoint", + "msCompile", + "lessCompile", + "gulp-tsc", + "jshint", + "jshint-stylish", + "eslint-compact", + "eslint-stylish", + "go" + ], + "vs/workbench/contrib/tasks/common/taskConfiguration": [ + "ConfigurationParser.invalidCWD", + "ConfigurationParser.inValidArg", + "ConfigurationParser.noShell", + "ConfigurationParser.noName", + "ConfigurationParser.unknownMatcherKind", + "ConfigurationParser.invalidVariableReference", + "ConfigurationParser.noTaskType", + "ConfigurationParser.noTypeDefinition", + "ConfigurationParser.missingType", + "ConfigurationParser.incorrectType", + "ConfigurationParser.notCustom", + "ConfigurationParser.noTaskName", + "taskConfiguration.providerUnavailable", + "taskConfiguration.noCommandOrDependsOn", + "taskConfiguration.noCommand", + { + "key": "TaskParse.noOsSpecificGlobalTasks", + "comment": [ + "\"Task version 2.0.0\" refers to the 2.0.0 version of the task system. The \"version 2.0.0\" is not localizable as it is a json key and value." + ] + } + ], + "vs/workbench/contrib/tasks/common/taskDefinitionRegistry": [ + "TaskDefinition.description", + "TaskDefinition.properties", + "TaskDefinition.when", + "TaskTypeConfiguration.noType", + "TaskDefinitionExtPoint" + ], + "vs/workbench/contrib/tasks/common/tasks": [ + "tasks.taskRunningContext", + "taskTerminalActive", + "TaskDefinition.missingRequiredProperty", + "rerunTaskIcon", + "tasksCategory" + ], + "vs/workbench/contrib/tasks/common/taskService": [ + "tasks.customExecutionSupported", + "tasks.shellExecutionSupported", + "tasks.taskCommandsRegistered", + "tasks.processExecutionSupported", + "tasks.serverlessWebContext", + "tasks.tasksAvailable" + ], + "vs/workbench/contrib/tasks/common/taskTemplates": [ + "dotnetCore", + "msbuild", + "externalCommand", + "Maven" + ], + "vs/workbench/contrib/tasks/electron-browser/taskService": [ + "TaskSystem.runningTask", + { + "key": "TaskSystem.terminateTask", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "TaskSystem.noProcess", + { + "key": "TaskSystem.exitAnyways", + "comment": [ + "&& denotes a mnemonic" + ] + } + ], + "vs/workbench/contrib/telemetry/browser/telemetry.contribution": [ + "showTelemetry" + ], + "vs/workbench/contrib/terminal/browser/baseTerminalBackend": [ + "ptyHostStatus", + "ptyHostStatus.short", + "nonResponsivePtyHost", + "ptyHostStatus.ariaLabel" + ], + "vs/workbench/contrib/terminal/browser/environmentVariableInfo": [ + "extensionEnvironmentContributionInfoStale", + "relaunchTerminalLabel", + "extensionEnvironmentContributionInfoActive", + "showEnvironmentContributions", + "ScopedEnvironmentContributionInfo" + ], + "vs/workbench/contrib/terminal/browser/terminal.contribution": [ + { + "key": "miToggleIntegratedTerminal", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "terminal", + "terminal" + ], + "vs/workbench/contrib/terminal/browser/terminalActions": [ + "showTerminalTabs", + "workbench.action.terminal.newWorkspacePlaceholder", + "terminalLaunchHelp", + "workbench.action.terminal.runActiveFile.noFile", + "noUnattachedTerminals", + "workbench.action.terminal.newWithCwd.cwd", + "workbench.action.terminal.renameWithArg.name", + "workbench.action.terminal.renameWithArg.noName", + "workbench.action.terminal.join.insufficientTerminals", + "workbench.action.terminal.join.onlySplits", + "emptyTerminalNameInfo", + "workbench.action.terminal.newWithProfile.profileName", + "newWithProfile.location", + "newWithProfile.location.view", + "newWithProfile.location.editor", + "workbench.action.terminal.newWorkspacePlaceholder", + "workbench.action.terminal.overriddenCwdDescription", + "workbench.action.terminal.newWorkspacePlaceholder", + "workbench.action.terminal.rename.prompt", + "workbench.action.terminal.newInActiveWorkspace", + "workbench.action.terminal.createTerminalEditor", + "workbench.action.terminal.createTerminalEditor", + "workbench.action.terminal.createTerminalEditorSide", + "workbench.action.terminal.focusPreviousPane", + "workbench.action.terminal.focusNextPane", + "workbench.action.terminal.resizePaneLeft", + "workbench.action.terminal.resizePaneRight", + "workbench.action.terminal.resizePaneUp", + "workbench.action.terminal.resizePaneDown", + "workbench.action.terminal.focus.tabsView", + "workbench.action.terminal.focusNext", + "workbench.action.terminal.focusPrevious", + "workbench.action.terminal.runSelectedText", + "workbench.action.terminal.runActiveFile", + "workbench.action.terminal.scrollDown", + "workbench.action.terminal.scrollDownPage", + "workbench.action.terminal.scrollToBottom", + "workbench.action.terminal.scrollUp", + "workbench.action.terminal.scrollUpPage", + "workbench.action.terminal.scrollToTop", + "workbench.action.terminal.clearSelection", + "workbench.action.terminal.detachSession", + "workbench.action.terminal.attachToSession", + "workbench.action.terminal.selectToPreviousCommand", + "workbench.action.terminal.selectToNextCommand", + "workbench.action.terminal.selectToPreviousLine", + "workbench.action.terminal.selectToNextLine", + "workbench.action.terminal.relaunch", + "workbench.action.terminal.joinInstance", + "workbench.action.terminal.join", + "workbench.action.terminal.splitInActiveWorkspace", + "workbench.action.terminal.selectAll", + "workbench.action.terminal.new", + "workbench.action.terminal.kill", + "workbench.action.terminal.killAll", + "workbench.action.terminal.killEditor", + "workbench.action.terminal.clear", + "workbench.action.terminal.selectDefaultShell", + "workbench.action.terminal.openSettings", + "workbench.action.terminal.setFixedDimensions", + "workbench.action.terminal.switchTerminal", + "workbench.action.terminal.newWithProfile" + ], + "vs/workbench/contrib/terminal/browser/terminalEditorInput": [ + "confirmDirtyTerminal.message", + { + "key": "confirmDirtyTerminal.button", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "confirmDirtyTerminals.detail", + "confirmDirtyTerminal.detail" + ], + "vs/workbench/contrib/terminal/browser/terminalIcons": [ + "terminalViewIcon", + "renameTerminalIcon", + "killTerminalIcon", + "newTerminalIcon", + "configureTerminalProfileIcon", + "terminalDecorationMark", + "terminalDecorationIncomplete", + "terminalDecorationError", + "terminalDecorationSuccess", + "terminalCommandHistoryRemove", + "terminalCommandHistoryOutput", + "terminalCommandHistoryFuzzySearch", + "terminalCommandHistoryOpenFile" + ], + "vs/workbench/contrib/terminal/browser/terminalInstance": [ + "terminal.integrated.a11yPromptLabel", + "terminal.integrated.useAccessibleBuffer", + "terminal.integrated.useAccessibleBufferNoKb", + "bellStatus", + "shellIntegration.rich", + "shellIntegration.basic", + "shellIntegration.injectionFailed", + "shellIntegration.no", + "shellIntegration", + "shellIntegration", + "keybindingHandling", + "configureTerminalSettings", + "disconnectStatus", + "workspaceNotTrustedCreateTerminal", + "workspaceNotTrustedCreateTerminalCwd", + "launchFailed.exitCodeOnlyShellIntegration", + "shellIntegration.learnMore", + "shellIntegration.openSettings", + "terminal.requestTrust", + "terminalTextBoxAriaLabelNumberAndTitle", + "terminalTextBoxAriaLabel", + "terminalScreenReaderMode", + "terminalHelpAriaLabel", + "setTerminalDimensionsColumn", + "setTerminalDimensionsRow", + "terminalStaleTextBoxAriaLabel", + "changeColor", + "launchFailed.exitCodeAndCommandLine", + "launchFailed.exitCodeOnly", + "terminated.exitCodeAndCommandLine", + "terminated.exitCodeOnly", + "launchFailed.errorMessage" + ], + "vs/workbench/contrib/terminal/browser/terminalMenus": [ + { + "key": "miNewTerminal", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miNewInNewWindow", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miSplitTerminal", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miRunActiveFile", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miRunSelectedText", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "workbench.action.terminal.copySelection.short", + "workbench.action.terminal.copySelectionAsHtml", + "workbench.action.terminal.paste.short", + "workbench.action.terminal.clear", + "workbench.action.terminal.selectAll", + "workbench.action.terminal.copySelection.short", + "workbench.action.terminal.copySelectionAsHtml", + "workbench.action.terminal.paste.short", + "workbench.action.terminal.clear", + "workbench.action.terminal.selectAll", + "workbench.action.terminal.newWithProfile.short", + "workbench.action.terminal.openSettings", + "workbench.action.tasks.runTask", + "workbench.action.tasks.configureTaskRunner", + "workbench.action.terminal.clearLong", + "workbench.action.terminal.runActiveFile", + "workbench.action.terminal.runSelectedText", + "workbench.action.terminal.startVoice", + "workbench.action.terminal.stopVoice", + "workbench.action.terminal.renameInstance", + "workbench.action.terminal.changeIcon", + "workbench.action.terminal.changeColor", + "workbench.action.terminal.joinInstance", + "workbench.action.terminal.clearLong", + "workbench.action.terminal.runActiveFile", + "workbench.action.terminal.runSelectedText", + "workbench.action.terminal.startVoiceEditor", + "workbench.action.terminal.stopVoiceEditor", + "defaultTerminalProfile", + "defaultTerminalProfile", + "defaultTerminalProfile", + "split.profile", + "launchProfile", + "workbench.action.terminal.selectDefaultProfile", + "workbench.action.terminal.switchTerminal" + ], + "vs/workbench/contrib/terminal/browser/terminalProcessManager": [ + "killportfailure", + "ptyHostRelaunch" + ], + "vs/workbench/contrib/terminal/browser/terminalProfileQuickpick": [ + "terminal.integrated.selectProfileToCreate", + "terminal.integrated.chooseDefaultProfile", + "enterTerminalProfileName", + "terminalProfileAlreadyExists", + "terminalProfiles", + "ICreateContributedTerminalProfileOptions", + "terminalProfiles.detected", + "unsafePathWarning", + "yes", + "cancel", + "createQuickLaunchProfile" + ], + "vs/workbench/contrib/terminal/browser/terminalService": [ + "terminalService.terminalCloseConfirmationSingular", + "terminalService.terminalCloseConfirmationPlural", + { + "key": "terminate", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "localTerminalVirtualWorkspace", + "localTerminalRemote" + ], + "vs/workbench/contrib/terminal/browser/terminalTabbedView": [ + "moveTabsRight", + "moveTabsLeft", + "hideTabs" + ], + "vs/workbench/contrib/terminal/browser/terminalTabsChatEntry": [ + "terminal.tabs.chatEntryTooltip", + "terminal.tabs.chatEntryLabelSingle", + "terminal.tabs.chatEntryLabelPlural", + "terminal.tabs.chatEntryAriaLabelSingle", + "terminal.tabs.chatEntryAriaLabelPlural" + ], + "vs/workbench/contrib/terminal/browser/terminalTabsList": [ + "terminalInputAriaLabel", + "terminal.tabs", + { + "key": "splitTerminalAriaLabel", + "comment": [ + "The terminal's ID", + "The terminal's title", + "The terminal's split number", + "The terminal group's total split number" + ] + }, + { + "key": "terminalAriaLabel", + "comment": [ + "The terminal's ID", + "The terminal's title" + ] + }, + "label" + ], + "vs/workbench/contrib/terminal/browser/terminalTooltip": [ + "hideDetails", + "showDetails", + { + "key": "shellProcessTooltip.processId", + "comment": [ + "The first arg is \"PID\" which shouldn't be translated" + ] + }, + "shellProcessTooltip.commandLine" + ], + "vs/workbench/contrib/terminal/browser/terminalView": [ + "terminal.useMonospace", + "terminal.monospaceOnly", + "terminals", + "terminalConnectingLabel" + ], + "vs/workbench/contrib/terminal/browser/xterm/decorationAddon": [ + "workbench.action.terminal.toggleVisibility", + "terminal.rerunCommand", + "rerun", + "yes", + "no", + "terminal.copyCommand", + "terminal.copyCommandAndOutput", + "terminal.copyOutput", + "terminal.copyOutputAsHtml", + "workbench.action.terminal.runRecentCommand", + "workbench.action.terminal.goToRecentDirectory", + "terminal.learnShellIntegration", + "terminal.attachToChat", + "toggleVisibility", + "gutter", + "overviewRuler" + ], + "vs/workbench/contrib/terminal/browser/xterm/decorationStyles": [ + "terminalPromptContextMenu", + "terminalPromptCommandFailed.duration", + "terminalPromptCommandFailedWithExitCode.duration", + "terminalPromptCommandSuccess.duration", + "terminalPromptCommandFailed", + "terminalPromptCommandFailedWithExitCode", + "terminalPromptCommandSuccess", + "terminalCommandDecoration.unknown", + "terminalCommandDecoration.running", + "terminalPromptCommandFailed.duration", + "terminalPromptCommandFailedWithExitCode.duration", + "terminalPromptCommandSuccess.duration", + "terminalPromptCommandFailed", + "terminalPromptCommandFailedWithExitCode", + "terminalPromptCommandSuccess." + ], + "vs/workbench/contrib/terminal/browser/xterm/xtermTerminal": [ + "terminal.integrated.copySelection.noSelection" + ], + "vs/workbench/contrib/terminal/common/terminal": [ + "vscode.extension.contributes.terminal", + "vscode.extension.contributes.terminal.profiles", + "vscode.extension.contributes.terminal.profiles.id", + "vscode.extension.contributes.terminal.profiles.title", + "vscode.extension.contributes.terminal.types.icon", + "vscode.extension.contributes.terminal.types.icon.light", + "vscode.extension.contributes.terminal.types.icon.dark", + "vscode.extension.contributes.terminal.completionProviders", + "vscode.extension.contributes.terminal.completionProviders.description" + ], + "vs/workbench/contrib/terminal/common/terminalColorRegistry": [ + "terminal.background", + "terminal.foreground", + "terminalCursor.foreground", + "terminalCursor.background", + "terminal.selectionBackground", + "terminal.inactiveSelectionBackground", + "terminal.selectionForeground", + "terminalCommandDecoration.defaultBackground", + "terminalCommandDecoration.successBackground", + "terminalCommandDecoration.errorBackground", + "terminalOverviewRuler.cursorForeground", + "terminal.border", + "terminalOverviewRuler.border", + "terminal.findMatchBackground", + "terminal.hoverHighlightBackground", + "terminal.findMatchBorder", + "terminal.findMatchHighlightBackground", + "terminal.findMatchHighlightBorder", + "terminalOverviewRuler.findMatchHighlightForeground", + "terminal.dragAndDropBackground", + "terminal.tab.activeBorder", + "terminalInitialHintForeground", + "terminal.ansiColor" + ], + "vs/workbench/contrib/terminal/common/terminalConfiguration": [ + "cwd", + "cwdFolder", + "workspaceFolder", + "workspaceFolderName", + "local", + "process", + "progress", + "separator", + "sequence", + "task", + "shellType", + "shellCommand", + "shellPromptInput", + "terminalTitle", + "terminalDescription", + "terminal.integrated.sendKeybindingsToShell", + "terminal.integrated.tabs.defaultColor", + "terminal.integrated.tabs.defaultIcon", + "terminal.integrated.tabs.enabled", + "terminal.integrated.tabs.enableAnimation", + "terminal.integrated.tabs.hideCondition", + "terminal.integrated.tabs.hideCondition.never", + "terminal.integrated.tabs.hideCondition.singleTerminal", + "terminal.integrated.tabs.hideCondition.singleGroup", + "terminal.integrated.tabs.showActiveTerminal", + "terminal.integrated.tabs.showActiveTerminal.always", + "terminal.integrated.tabs.showActiveTerminal.singleTerminal", + "terminal.integrated.tabs.showActiveTerminal.singleTerminalOrNarrow", + "terminal.integrated.tabs.showActiveTerminal.never", + "terminal.integrated.tabs.showActions", + "terminal.integrated.tabs.showActions.always", + "terminal.integrated.tabs.showActions.singleTerminal", + "terminal.integrated.tabs.showActions.singleTerminalOrNarrow", + "terminal.integrated.tabs.showActions.never", + "terminal.integrated.tabs.location.left", + "terminal.integrated.tabs.location.right", + "terminal.integrated.tabs.location", + "terminal.integrated.defaultLocation.editor", + "terminal.integrated.defaultLocation.view", + "terminal.integrated.defaultLocation", + "terminal.integrated.tabs.focusMode.singleClick", + "terminal.integrated.tabs.focusMode.doubleClick", + "terminal.integrated.tabs.focusMode", + "terminal.integrated.macOptionIsMeta", + "terminal.integrated.macOptionClickForcesSelection", + "terminal.integrated.altClickMovesCursor", + "terminal.integrated.copyOnSelection", + "terminal.integrated.enableMultiLinePasteWarning", + "terminal.integrated.enableMultiLinePasteWarning.auto", + "terminal.integrated.enableMultiLinePasteWarning.always", + "terminal.integrated.enableMultiLinePasteWarning.never", + "terminal.integrated.drawBoldTextInBrightColors", + "terminal.integrated.fontFamily", + "terminal.integrated.fontLigatures.enabled", + "terminal.integrated.fontLigatures.featureSettings", + "terminal.integrated.fontLigatures.fallbackLigatures", + "terminal.integrated.fontSize", + "terminal.integrated.letterSpacing", + "terminal.integrated.lineHeight", + "terminal.integrated.minimumContrastRatio", + "terminal.integrated.tabStopWidth", + "terminal.integrated.fastScrollSensitivity", + "terminal.integrated.mouseWheelScrollSensitivity", + "terminal.integrated.bellDuration", + "terminal.integrated.fontWeightError", + "terminal.integrated.fontWeight", + "terminal.integrated.fontWeightError", + "terminal.integrated.fontWeightBold", + "terminal.integrated.cursorBlinking", + "terminal.integrated.cursorStyle", + "terminal.integrated.cursorStyleInactive", + "terminal.integrated.cursorWidth", + "terminal.integrated.scrollback", + "terminal.integrated.detectLocale", + "terminal.integrated.detectLocale.auto", + "terminal.integrated.detectLocale.off", + "terminal.integrated.detectLocale.on", + "terminal.integrated.gpuAcceleration.auto", + "terminal.integrated.gpuAcceleration.on", + "terminal.integrated.gpuAcceleration.off", + "terminal.integrated.gpuAcceleration", + "terminal.integrated.tabs.separator", + "terminal.integrated.rightClickBehavior.default", + "terminal.integrated.rightClickBehavior.copyPaste", + "terminal.integrated.rightClickBehavior.paste", + "terminal.integrated.rightClickBehavior.selectWord", + "terminal.integrated.rightClickBehavior.nothing", + "terminal.integrated.rightClickBehavior", + "terminal.integrated.middleClickBehavior.default", + "terminal.integrated.middleClickBehavior.paste", + "terminal.integrated.middleClickBehavior", + "terminal.integrated.cwd", + "terminal.integrated.confirmOnExit", + "terminal.integrated.confirmOnExit.never", + "terminal.integrated.confirmOnExit.always", + "terminal.integrated.confirmOnExit.hasChildProcesses", + "terminal.integrated.confirmOnKill", + "terminal.integrated.confirmOnKill.never", + "terminal.integrated.confirmOnKill.editor", + "terminal.integrated.confirmOnKill.panel", + "terminal.integrated.confirmOnKill.always", + "terminal.integrated.enableBell", + "terminal.integrated.enableVisualBell", + "terminal.integrated.commandsToSkipShell", + "openDefaultSettingsJson", + "openDefaultSettingsJson.capitalized", + "terminal.integrated.allowChords", + "terminal.integrated.allowMnemonics", + "terminal.integrated.env.osx", + "terminal.integrated.env.linux", + "terminal.integrated.env.windows", + "terminal.integrated.environmentChangesRelaunch", + "terminal.integrated.showExitAlert", + "terminal.integrated.windowsUseConptyDll", + "terminal.integrated.splitCwd", + "terminal.integrated.splitCwd.workspaceRoot", + "terminal.integrated.splitCwd.initial", + "terminal.integrated.splitCwd.inherited", + "terminal.integrated.windowsEnableConpty", + "terminal.integrated.wordSeparators", + "terminal.integrated.enableFileLinks", + "enableFileLinks.off", + "enableFileLinks.on", + "enableFileLinks.notRemote", + "terminal.integrated.allowedLinkSchemes", + "terminal.integrated.unicodeVersion.six", + "terminal.integrated.unicodeVersion.eleven", + "terminal.integrated.unicodeVersion", + "terminal.integrated.enablePersistentSessions", + "terminal.integrated.persistentSessionReviveProcess", + "terminal.integrated.persistentSessionReviveProcess.onExit", + "terminal.integrated.persistentSessionReviveProcess.onExitAndWindowClose", + "terminal.integrated.persistentSessionReviveProcess.never", + "terminal.integrated.hideOnStartup", + "hideOnStartup.never", + "hideOnStartup.whenEmpty", + "hideOnStartup.always", + "terminal.integrated.hideOnLastClosed", + "terminal.integrated.customGlyphs", + "terminal.integrated.rescaleOverlappingGlyphs", + "terminal.integrated.shellIntegration.enabled", + "terminal.integrated.shellIntegration.decorationsEnabled", + "terminal.integrated.shellIntegration.decorationsEnabled.both", + "terminal.integrated.shellIntegration.decorationsEnabled.gutter", + "terminal.integrated.shellIntegration.decorationsEnabled.overviewRuler", + "terminal.integrated.shellIntegration.decorationsEnabled.never", + "terminal.integrated.shellIntegration.timeout", + "terminal.integrated.shellIntegration.quickFixEnabled", + "terminal.integrated.shellIntegration.environmentReporting", + "terminal.integrated.smoothScrolling", + "terminal.integrated.ignoreBracketedPasteMode", + "terminal.integrated.enableImages", + "terminal.integrated.focusAfterRun", + "terminal.integrated.focusAfterRun.terminal", + "terminal.integrated.focusAfterRun.accessible-buffer", + "terminal.integrated.focusAfterRun.none", + "terminal.integrated.developer.ptyHost.latency", + "terminal.integrated.developer.ptyHost.startupDelay", + "terminal.integrated.developer.devMode", + "terminalIntegratedConfigurationTitle" + ], + "vs/workbench/contrib/terminal/common/terminalContextKey": [ + "terminalFocusContextKey", + "terminalFocusInAnyContextKey", + "terminalEditorFocusContextKey", + "terminalCountContextKey", + "terminalTabsFocusContextKey", + "terminalShellTypeContextKey", + "terminalAltBufferActive", + "terminalSuggestWidgetVisible", + "terminalViewShowing", + "terminalTextSelectedContextKey", + "terminalTextSelectedInFocusedContextKey", + "terminalProcessSupportedContextKey", + "terminalTabsSingularSelectedContextKey", + "isSplitTerminalContextKey", + "splitPaneActive", + "inTerminalRunCommandPickerContextKey", + "terminalShellIntegrationEnabled" + ], + "vs/workbench/contrib/terminal/common/terminalStrings": [ + "terminal", + "terminal.new", + "doNotShowAgain", + "currentSessionCategory", + "previousSessionCategory", + "task", + "local", + "killTerminal.short", + "splitTerminal.short", + "terminalCategory", + "workbench.action.terminal.focus", + "workbench.action.terminal.focusInstance", + "workbench.action.terminal.focusAndHideAccessibleBuffer", + "killTerminal", + "moveToEditor", + "moveIntoNewWindow", + "newInNewWindow", + "workbench.action.terminal.moveToTerminalPanel", + "workbench.action.terminal.changeIcon", + "workbench.action.terminal.changeColor", + "splitTerminal", + "unsplitTerminal", + "workbench.action.terminal.rename", + "workbench.action.terminal.sizeToContentWidthInstance", + "workbench.action.terminal.focusHover", + "workbench.action.terminal.newWithCwd", + "workbench.action.terminal.renameWithArg", + "workbench.action.terminal.scrollToPreviousCommand", + "workbench.action.terminal.scrollToNextCommand", + "workbench.action.terminal.revealCommand" + ], + "vs/workbench/contrib/terminal/electron-browser/terminalRemote": [ + "workbench.action.terminal.newLocal" + ], + "vs/workbench/contrib/terminalContrib/accessibility/browser/terminal.accessibility.contribution": [ + "workbench.action.terminal.focusAccessibleBuffer", + "workbench.action.terminal.accessibleBufferGoToNextCommand", + "workbench.action.terminal.accessibleBufferGoToPreviousCommand", + "workbench.action.terminal.scrollToBottomAccessibleView", + "workbench.action.terminal.scrollToTopAccessibleView" + ], + "vs/workbench/contrib/terminalContrib/accessibility/browser/terminalAccessibilityHelp": [ + "focusAccessibleTerminalView", + "preserveCursor", + "openDetectedLink", + "newWithProfile", + "focusAfterRun", + "focusViewOnExecution", + "suggestTrigger", + "suggest", + "suggestCommands", + "suggestCommandsMore", + "suggestLearnMore", + "suggestConfigure", + "commandPromptMigration", + "shellIntegration", + "goToNextCommand", + "goToPreviousCommand", + "goToSymbol", + "runRecentCommand", + "goToRecentDirectory", + "noShellIntegration" + ], + "vs/workbench/contrib/terminalContrib/accessibility/common/terminalAccessibilityConfiguration": [ + "terminal.integrated.accessibleViewPreserveCursorPosition", + "terminal.integrated.accessibleViewFocusOnCommandExecution" + ], + "vs/workbench/contrib/terminalContrib/autoReplies/common/terminalAutoRepliesConfiguration": [ + "terminal.integrated.autoReplies", + "terminal.integrated.autoReplies.reply" + ], + "vs/workbench/contrib/terminalContrib/chat/browser/terminalChat": [ + "chatFocusedContextKey", + "chatVisibleContextKey", + "chatRequestActiveContextKey", + "chatInputHasTextContextKey", + "chatResponseContainsCodeBlockContextKey", + "chatResponseContainsMultipleCodeBlocksContextKey", + "chatAgentRegisteredContextKey", + "terminalHasChatTerminals", + "terminalHasHiddenChatTerminals" + ], + "vs/workbench/contrib/terminalContrib/chat/browser/terminalChatAccessibilityHelp": [ + "inlineChat.overview", + "inlineChat.access", + "inlineChat.input", + "inlineChat.inputNoKb", + "inlineChat.inspectResponseMessage", + "inlineChat.inspectResponseNoKb", + "inlineChat.focusResponse", + "inlineChat.focusResponseNoKb", + "inlineChat.focusInput", + "inlineChat.focusInputNoKb", + "inlineChat.runCommand", + "inlineChat.runCommandNoKb", + "inlineChat.insertCommand", + "inlineChat.insertCommandNoKb", + "inlineChat.toolbar", + "chat.signals" + ], + "vs/workbench/contrib/terminalContrib/chat/browser/terminalChatActions": [ + "chat.focusMostRecentTerminal", + "chat.focusMostRecentTerminalOutput", + "startChat", + "terminalCategory", + "closeChat", + "runCommand", + "run", + "runFirstCommand", + "runFirst", + "insertCommand", + "insert", + "insertFirstCommand", + "insertFirst", + "chat.rerun.label", + "viewInChat", + "viewHiddenChatTerminals", + "terminalCategory2", + "chatTerminal.lastCommand", + "selectChatTerminal", + "showChatTerminals.title" + ], + "vs/workbench/contrib/terminalContrib/chat/browser/terminalChatWidget": [ + "askAboutCommands" + ], + "vs/workbench/contrib/terminalContrib/chatAgentTools/browser/runInTerminalHelpers": [ + "autoApprove.exactCommand1", + "autoApprove.exactCommand2", + "autoApprove.exactCommand", + "allowSession", + "allowSessionTooltip", + "autoApprove.configure" + ], + "vs/workbench/contrib/terminalContrib/chatAgentTools/browser/terminal.chatAgentTools.contribution": [ + "addTerminalSelection", + "terminalSelection", + "terminalSelection" + ], + "vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/autoApprove/npmScriptAutoApprover": [ + "autoApprove.npmScript" + ], + "vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/commandLineAutoApproveAnalyzer": [ + "autoApprove.session", + "autoApprove.session.disable", + "runInTerminal.promptInjectionDisclaimer", + "autoApproveRule.sessionIndicator", + "ruleTooltip", + "autoApprove.global", + "ruleTooltip.global", + "autoApprove.rule", + "autoApprove.rule", + "autoApprove.rules", + "autoApproveDenied.rule", + "autoApproveDenied.rule", + "autoApproveDenied.rules" + ], + "vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/commandLineFileWriteAnalyzer": [ + "runInTerminal.fileWriteBlockedDisclaimer", + "runInTerminal.fileWriteDisclaimer" + ], + "vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/getTerminalLastCommandTool": [ + "terminalLastCommandTool.displayName", + "getTerminalLastCommand.progressive", + "getTerminalLastCommand.past" + ], + "vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/getTerminalOutputTool": [ + "getTerminalOutputTool.displayName", + "bg.progressive", + "bg.past" + ], + "vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/getTerminalSelectionTool": [ + "terminalSelectionTool.displayName", + "getTerminalSelection.progressive", + "getTerminalSelection.past" + ], + "vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/monitoring/outputMonitor": [ + "poll.terminal.waiting", + "poll.terminal.polling", + "poll.terminal.accept", + "poll.terminal.reject", + "poll.terminal.inputRequest", + "poll.terminal.requireInput", + "poll.terminal.enterInput", + "poll.terminal.confirmRequired", + "poll.terminal.confirmRunDetail", + "poll.terminal.acceptRun", + "poll.terminal.rejectRun" + ], + "vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/runInTerminalConfirmationTool": [ + "confirmTerminalCommandTool.displayName", + "confirmTerminalCommandTool.userDescription" + ], + "vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/runInTerminalTool": [ + "runInTerminalTool.displayName", + "runInTerminalTool.userDescription", + "runInTerminalTool.altBufferMessage", + "runInTerminal.background", + "runInTerminal" + ], + "vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/task/createAndRunTaskTool": [ + "copilotChat.fetchingTask", + "copilotChat.taskNotFound", + "copilotChat.runningTask", + "copilotChat.noTerminal", + "taskExists", + "taskExistsPast", + "alreadyRunning", + "alreadyRunning", + "createdTask", + "createdTaskPast", + "allowTaskCreationExecution", + "createTask", + "createAndRunTask.displayName", + "createAndRunTask.userDescription" + ], + "vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/task/getTaskOutputTool": [ + "getTaskOutputTool.displayName", + "copilotChat.taskNotFound", + "copilotChat.taskAlreadyRunning", + "copilotChat.checkingTerminalOutput", + "copilotChat.checkedTerminalOutput", + "copilotChat.taskNotFound", + "copilotChat.terminalNotFound" + ], + "vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/task/runTaskTool": [ + "chat.taskNotFound", + "chat.taskAlreadyRunning", + "chat.noTerminal", + "chat.noTerminal", + "chat.taskNotFound", + "chat.taskAlreadyActive", + "chat.taskIsAlreadyRunning", + "chat.taskWasAlreadyRunning", + "chat.runningTask", + "chat.startedTask", + "chat.ranTask", + "chat.allowTaskRunTitle", + "chat.allowTaskRunMsg", + "runInTerminalTool.displayName", + "runInTerminalTool.userDescription" + ], + "vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/task/taskHelpers": [ + "copilotChat.taskFailedWithExitCode" + ], + "vs/workbench/contrib/terminalContrib/chatAgentTools/common/terminalChatAgentToolsConfiguration": [ + "autoApprove.true", + "autoApprove.false", + "autoApprove.key", + "terminalChatAgentProfile.path", + "autoApproveMode.description", + "autoApproveMode.description", + "autoApprove.description.intro", + "autoApprove.description.values", + "autoApprove.description.subCommands", + "autoApprove.description.commandLine", + "autoApprove.defaults", + "autoApprove.description.examples.title", + "autoApprove.description.examples.value", + "autoApprove.description.examples.description", + "autoApprove.description.examples.mkdir", + "autoApprove.description.examples.npmRunBuild", + "autoApprove.description.examples.binTest", + "autoApprove.description.examples.regexGit", + "autoApprove.description.examples.regexCase", + "autoApprove.description.examples.regexAll", + "autoApprove.description.examples.rm", + "autoApprove.description.examples.ps1", + "autoApprove.description.examples.rmUnset", + "autoApprove.matchCommandLine.true", + "autoApprove.matchCommandLine.false", + "autoApprove.matchCommandLine", + "autoApprove.null", + "ignoreDefaultAutoApproveRules.description", + "autoApproveWorkspaceNpmScripts.description", + "blockFileWrites.never", + "blockFileWrites.outsideWorkspace", + "blockFileWrites.all", + "blockFileWrites.description", + "shellIntegrationTimeout.description", + "shellIntegrationTimeout.deprecated", + "terminalChatAgentProfile.linux", + "terminalChatAgentProfile.osx", + "terminalChatAgentProfile.windows", + "autoReplyToPrompts.key", + "outputLocation.description", + "outputLocation.terminal", + "outputLocation.none", + "preventShellHistory.description", + "preventShellHistory.description.bash", + "preventShellHistory.description.zsh", + "preventShellHistory.description.fish", + "preventShellHistory.description.pwsh", + "autoApprove.deprecated" + ], + "vs/workbench/contrib/terminalContrib/clipboard/browser/terminal.clipboard.contribution": [ + "workbench.action.terminal.copyLastCommand", + "workbench.action.terminal.copyLastCommandOutput", + "workbench.action.terminal.copyLastCommandAndOutput", + "workbench.action.terminal.copySelection", + "workbench.action.terminal.copyAndClearSelection", + "workbench.action.terminal.copySelectionAsHtml", + "workbench.action.terminal.paste", + "workbench.action.terminal.pasteSelection" + ], + "vs/workbench/contrib/terminalContrib/clipboard/browser/terminalClipboard": [ + "preview", + "confirmMoveTrashMessageFilesAndDirectories", + { + "key": "multiLinePasteButton", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "multiLinePasteButton.oneLine", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "doNotAskAgain" + ], + "vs/workbench/contrib/terminalContrib/commandGuide/browser/terminal.commandGuide.contribution": [ + "terminalCommandGuide.foreground" + ], + "vs/workbench/contrib/terminalContrib/commandGuide/common/terminalCommandGuideConfiguration": [ + "showCommandGuide" + ], + "vs/workbench/contrib/terminalContrib/developer/browser/terminal.developer.contribution": [ + "workbench.action.terminal.writeDataToTerminal.prompt", + "workbench.action.terminal.recordSession.recording", + "workbench.action.terminal.showTextureAtlas", + "workbench.action.terminal.writeDataToTerminal", + "workbench.action.terminal.recordSession", + "workbench.action.terminal.restartPtyHost" + ], + "vs/workbench/contrib/terminalContrib/environmentChanges/browser/terminal.environmentChanges.contribution": [ + "envChanges", + "extension", + "ScopedEnvironmentContributionInfo", + "workbench.action.terminal.showEnvironmentContributions" + ], + "vs/workbench/contrib/terminalContrib/find/browser/terminal.find.contribution": [ + "workbench.action.terminal.focusFind", + "workbench.action.terminal.hideFind", + "workbench.action.terminal.toggleFindRegex", + "workbench.action.terminal.toggleFindWholeWord", + "workbench.action.terminal.toggleFindCaseSensitive", + "workbench.action.terminal.findNext", + "workbench.action.terminal.findPrevious", + "workbench.action.terminal.searchWorkspace" + ], + "vs/workbench/contrib/terminalContrib/history/browser/terminal.history.contribution": [ + "workbench.action.terminal.clearPreviousSessionHistory", + "workbench.action.terminal.goToRecentDirectory", + "goToRecentDirectory.metadata", + "workbench.action.terminal.runRecentCommand" + ], + "vs/workbench/contrib/terminalContrib/history/browser/terminalRunRecentQuickPick": [ + "removeCommand", + "viewCommandOutput", + "selectRecentCommandMac", + "selectRecentCommand", + "openShellHistoryFile", + "shellFileHistoryCategory", + "selectRecentDirectoryMac", + "selectRecentDirectory", + "fuzzySearch" + ], + "vs/workbench/contrib/terminalContrib/history/common/terminal.history": [ + "terminal.integrated.shellIntegration.history" + ], + "vs/workbench/contrib/terminalContrib/inlineHint/browser/terminal.initialHint.contribution": [ + "emptyHintText", + { + "key": "inlineChatHint", + "comment": [ + "Preserve double-square brackets and their order" + ] + }, + "openChatHint", + "showSuggestHint", + { + "key": "hintTextDismiss", + "comment": [ + "Preserve double-square brackets and their order" + ] + }, + "hintTextDismissAriaLabel", + "disableHint", + "disableInitialHint", + "disableInitialHint" + ], + "vs/workbench/contrib/terminalContrib/inlineHint/common/terminalInitialHintConfiguration": [ + "terminal.integrated.initialHint" + ], + "vs/workbench/contrib/terminalContrib/links/browser/terminal.links.contribution": [ + "workbench.action.terminal.openDetectedLink", + "workbench.action.terminal.openLastUrlLink", + "workbench.action.terminal.openLastUrlLink.description", + "workbench.action.terminal.openLastLocalFileLink" + ], + "vs/workbench/contrib/terminalContrib/links/browser/terminalLinkDetectorAdapter": [ + "searchWorkspace", + "openFile", + "focusFolder", + "openFolder", + "followLink" + ], + "vs/workbench/contrib/terminalContrib/links/browser/terminalLinkManager": [ + "scheme", + "allow", + "terminalLinkHandler.followLinkAlt.mac", + "terminalLinkHandler.followLinkAlt", + "terminalLinkHandler.followLinkCmd", + "terminalLinkHandler.followLinkCtrl", + "followLink", + "followForwardedLink", + "followLinkUrl" + ], + "vs/workbench/contrib/terminalContrib/links/browser/terminalLinkQuickpick": [ + "terminal.integrated.urlLinks", + "terminal.integrated.localFileLinks", + "terminal.integrated.localFolderLinks", + "terminal.integrated.searchLinks", + "terminal.integrated.openDetectedLink", + "terminal.integrated.urlLinks", + "terminal.integrated.localFileLinks", + "terminal.integrated.localFolderLinks", + "terminal.integrated.searchLinks" + ], + "vs/workbench/contrib/terminalContrib/quickAccess/browser/terminal.quickAccess.contribution": [ + "tasksQuickAccessPlaceholder", + "tasksQuickAccessHelp", + "quickAccessTerminal" + ], + "vs/workbench/contrib/terminalContrib/quickAccess/browser/terminalQuickAccess": [ + "workbench.action.terminal.newplus", + "workbench.action.terminal.newWithProfilePlus", + "renameTerminal" + ], + "vs/workbench/contrib/terminalContrib/quickFix/browser/quickFixAddon": [ + "quickFix.command", + "quickFix.opener", + "codeAction.widget.id.quickfix" + ], + "vs/workbench/contrib/terminalContrib/quickFix/browser/terminal.quickFix.contribution": [ + "workbench.action.terminal.showQuickFixes" + ], + "vs/workbench/contrib/terminalContrib/quickFix/browser/terminalQuickFixBuiltinActions": [ + "terminal.freePort", + "terminal.createPR" + ], + "vs/workbench/contrib/terminalContrib/quickFix/browser/terminalQuickFixService": [ + "vscode.extension.contributes.terminalQuickFixes", + "vscode.extension.contributes.terminalQuickFixes.id", + "vscode.extension.contributes.terminalQuickFixes.commandLineMatcher", + "vscode.extension.contributes.terminalQuickFixes.outputMatcher", + "vscode.extension.contributes.terminalQuickFixes.commandExitResult", + "vscode.extension.contributes.terminalQuickFixes.kind" + ], + "vs/workbench/contrib/terminalContrib/sendSequence/browser/terminal.sendSequence.contribution": [ + "workbench.action.terminal.sendSequence.prompt", + "sendSequence.text.desc", + "sendSequence" + ], + "vs/workbench/contrib/terminalContrib/sendSignal/browser/terminal.sendSignal.contribution": [ + "sendSignal.signal.desc", + "SIGINT", + "SIGTERM", + "SIGKILL", + "SIGSTOP", + "SIGCONT", + "SIGHUP", + "SIGQUIT", + "SIGUSR1", + "SIGUSR2", + "manualSignal", + "selectSignal", + "manualSignal", + "enterSignal", + "sendSignal" + ], + "vs/workbench/contrib/terminalContrib/stickyScroll/browser/terminal.stickyScroll.contribution": [ + "stickyScroll", + { + "key": "miStickyScroll", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "workbench.action.terminal.toggleStickyScroll" + ], + "vs/workbench/contrib/terminalContrib/stickyScroll/browser/terminalStickyScrollColorRegistry": [ + "terminalStickyScroll.background", + "terminalStickyScrollHover.background", + "terminalStickyScroll.border" + ], + "vs/workbench/contrib/terminalContrib/stickyScroll/browser/terminalStickyScrollOverlay": [ + "stickyScrollHoverTitle", + "labelWithKeybinding", + "labelWithKeybinding" + ], + "vs/workbench/contrib/terminalContrib/stickyScroll/common/terminalStickyScrollConfiguration": [ + "stickyScroll.enabled", + "stickyScroll.maxLineCount" + ], + "vs/workbench/contrib/terminalContrib/suggest/browser/terminal.suggest.contribution": [ + "workbench.action.terminal.changeSelectionMode.never", + "workbench.action.terminal.changeSelectionMode.never.tooltip", + "workbench.action.terminal.changeSelectionMode.partial", + "workbench.action.terminal.changeSelectionMode.partial.tooltip", + "workbench.action.terminal.changeSelectionMode.always", + "workbench.action.terminal.changeSelectionMode.always.tooltip", + "workbench.action.terminal.doNotShowSuggestOnType", + "workbench.action.terminal.showSuggestOnType", + "workbench.action.terminal.learnMore", + "workbench.action.terminal.configureSuggestSettings", + "workbench.action.terminal.triggerSuggest", + "workbench.action.terminal.resetSuggestWidgetSize", + "workbench.action.terminal.selectPrevSuggestion", + "workbench.action.terminal.selectPrevPageSuggestion", + "workbench.action.terminal.selectNextSuggestion", + "workbench.action.terminal.suggestToggleExplainMode", + "workbench.action.terminal.suggestToggleDetailsFocus", + "workbench.action.terminal.suggestToggleDetails", + "workbench.action.terminal.selectNextPageSuggestion", + "workbench.action.terminal.acceptSelectedSuggestion", + "workbench.action.terminal.acceptSelectedSuggestionEnter", + "workbench.action.terminal.hideSuggestWidget", + "workbench.action.terminal.hideSuggestWidgetAndNavigateHistory" + ], + "vs/workbench/contrib/terminalContrib/suggest/browser/terminalSuggestAddon": [ + "file", + "folder", + "symbolicLinkFile", + "symbolicLinkFolder", + "method", + "alias", + "argument", + "option", + "optionValue", + "flag", + "commit", + "branch", + "tag", + "stash", + "remote", + "pullRequest", + "pullRequestDone", + "inlineSuggestion", + "inlineSuggestionAlwaysOnTop" + ], + "vs/workbench/contrib/terminalContrib/suggest/browser/terminalSymbolIcons": [ + "terminalSymbolIcon.flagForeground", + "terminalSymbolIcon.aliasForeground", + "terminalSymbolIcon.enumMemberForeground", + "terminalSymbolIcon.methodForeground", + "terminalSymbolIcon.argumentForeground", + "terminalSymbolIcon.optionForeground", + "terminalSymbolIcon.inlineSuggestionForeground", + "terminalSymbolIcon.fileForeground", + "terminalSymbolIcon.folderForeground", + "terminalSymbolIcon.commitForeground", + "terminalSymbolIcon.branchForeground", + "terminalSymbolIcon.tagForeground", + "terminalSymbolIcon.stashForeground", + "terminalSymbolIcon.remoteForeground", + "terminalSymbolIcon.pullRequestForeground", + "terminalSymbolIcon.pullRequestDoneForeground", + "terminalSymbolIcon.symbolicLinkFileForeground", + "terminalSymbolIcon.symbolicLinkFolderForeground", + "terminalSymbolIcon.symbolTextForeground", + "terminalSymbolFlagIcon", + "terminalSymbolAliasIcon", + "terminalSymbolOptionValue", + "terminalSymbolMethodIcon", + "terminalSymbolArgumentIcon", + "terminalSymbolOptionIcon", + "terminalSymbolInlineSuggestionIcon", + "terminalSymbolFileIcon", + "terminalSymbolFolderIcon", + "terminalSymbolCommitIcon", + "terminalSymbolBranchIcon", + "terminalSymbolTagIcon", + "terminalSymbolStashIcon", + "terminalSymbolRemoteIcon", + "terminalSymbolPullRequestIcon", + "terminalSymbolPullRequestDoneIcon", + "terminalSymbolSymbolicLinkFileIcon", + "terminalSymbolSymbolicLinkFolderIcon", + "terminalSymbolSymboTextIcon" + ], + "vs/workbench/contrib/terminalContrib/suggest/common/terminalSuggestConfiguration": [ + "suggest.enabled", + "suggest.providers", + "suggest.quickSuggestions", + "suggest.quickSuggestions.commands", + "suggest.quickSuggestions.arguments", + "suggest.quickSuggestions.unknown", + "suggest.suggestOnTriggerCharacters", + "suggest.runOnEnter", + "runOnEnter.never", + "runOnEnter.exactMatch", + "runOnEnter.exactMatchIgnoreExtension", + "runOnEnter.always", + "terminal.integrated.selectionMode", + "terminal.integrated.selectionMode.partial", + "terminal.integrated.selectionMode.always", + "terminal.integrated.selectionMode.never", + "terminalWindowsExecutableSuggestionSetting", + "suggest.showStatusBar", + "suggest.cdPath", + "suggest.cdPath.off", + "suggest.cdPath.relative", + "suggest.cdPath.absolute", + "suggest.inlineSuggestion", + "suggest.inlineSuggestion.off", + "suggest.inlineSuggestion.alwaysOnTopExceptExactMatch", + "suggest.inlineSuggestion.alwaysOnTop", + "suggest.upArrowNavigatesHistory", + "suggest.insertTrailingSpace", + "suggest.provider.lsp.description", + "suggest.provider.title", + "terminalSuggestProvidersConfigurationTitle", + "suggest.providersEnabledByDefault" + ], + "vs/workbench/contrib/terminalContrib/typeAhead/common/terminalTypeAheadConfiguration": [ + "terminal.integrated.localEchoLatencyThreshold", + "terminal.integrated.localEchoEnabled", + "terminal.integrated.localEchoEnabled.on", + "terminal.integrated.localEchoEnabled.off", + "terminal.integrated.localEchoEnabled.auto", + "terminal.integrated.localEchoExcludePrograms", + "terminal.integrated.localEchoStyle" + ], + "vs/workbench/contrib/terminalContrib/voice/browser/terminalVoice": [ + "terminalVoiceTextInserted" + ], + "vs/workbench/contrib/terminalContrib/voice/browser/terminalVoiceActions": [ + "terminal.voice.enableSpeechExtension", + "enableExtension", + "terminal.voice.installSpeechExtension", + "installExtension", + "terminal.voice.detail", + "voiceCategory", + "workbench.action.terminal.startDictation", + "workbench.action.terminal.stopDictation" + ], + "vs/workbench/contrib/terminalContrib/wslRecommendation/browser/terminal.wslRecommendation.contribution": [ + "useWslExtension.title", + "install" + ], + "vs/workbench/contrib/terminalContrib/zoom/browser/terminal.zoom.contribution": [ + "fontZoomIn", + "fontZoomOut", + "fontZoomReset" + ], + "vs/workbench/contrib/terminalContrib/zoom/common/terminal.zoom": [ + "terminal.integrated.mouseWheelZoom.mac", + "terminal.integrated.mouseWheelZoom" + ], + "vs/workbench/contrib/testing/browser/codeCoverageDecorations": [ + "testing.toggleInlineCoverage", + "coverage.branches", + "coverage.branchNotCovered", + "coverage.branchCoveredYes", + "coverage.branchCovered", + "coverage.declExecutedNo", + "coverage.declExecutedCount", + "coverage.declExecutedYes", + "testing.hideInlineCoverage", + "testing.showInlineCoverage", + "testing.coverageForTestAvailable", + "testing.rerun", + "coverage.hideInline", + "testing.hideCoverageInExplorer", + "testing.goToNextMissedLine", + "testing.goToPreviousMissedLine", + "coverage.toggleInline", + "testing.toggleToolbarTitle", + "testing.toggleToolbarDesc", + "testing.filterActionLabel", + "testing.toggleCoverageInExplorerTitle", + "testing.toggleCoverageInExplorerDesc", + "testing.goToNextMissedLineDesc", + "testing.goToPreviousMissedLineDesc" + ], + "vs/workbench/contrib/testing/browser/codeCoverageDisplayUtils": [ + "testing.coverageForTest", + "changePerTestFilter", + "testing.percentCoverage", + "testing.allTests", + "testing.pickTest" + ], + "vs/workbench/contrib/testing/browser/icons": [ + "testViewIcon", + "testingResultsIcon", + "testingRunIcon", + "testingRerunIcon", + "testingRunAllIcon", + "testingDebugAllIcon", + "testingDebugIcon", + "testingCoverageIcon", + "testingRunAllWithCoverageIcon", + "testingCancelIcon", + "filterIcon", + "hiddenIcon", + "testingShowAsList", + "testingShowAsTree", + "testingUpdateProfiles", + "testingRefreshTests", + "testingTurnContinuousRunOn", + "testingTurnContinuousRunOff", + "testingTurnContinuousRunIsOn", + "testingCancelRefreshTests", + "testingCoverage", + "testingWasCovered", + "testingMissingBranch", + "testingErrorIcon", + "testingFailedIcon", + "testingPassedIcon", + "testingQueuedIcon", + "testingSkippedIcon", + "testingUnsetIcon" + ], + "vs/workbench/contrib/testing/browser/testCoverageBars": [ + "statementCoverage", + "functionCoverage", + "branchCoverage" + ], + "vs/workbench/contrib/testing/browser/testCoverageView": [ + "functionsWithoutCoverage", + "filteredToTest", + "loadingCoverageDetails", + "testCoverageItemLabel", + "testCoverageTreeLabel", + "testing.coverageSortByLocation", + "testing.coverageSortByLocationDescription", + "testing.coverageSortByCoverage", + "testing.coverageSortByCoverageDescription", + "testing.coverageSortByName", + "testing.coverageSortByNameDescription", + "testing.coverageSortPlaceholder", + "testing.changeCoverageFilter", + "testing.changeCoverageSort", + "testing.coverageCollapseAll" + ], + "vs/workbench/contrib/testing/browser/testExplorerActions": [ + "testing.toggleContinuousRunOff", + "configureProfile", + "testing.noProfiles", + "testing.selectContinuousProfiles", + "discoveringTests", + "noTestProvider", + "noDebugTestProvider", + "noCoverageTestProvider", + "noTestsAtCursor", + "noTests", + "noTestsInFile", + "testing.noCoverage", + "relatedTests", + "noTestFound", + "relatedCode", + "noRelatedCode", + "runSelectedTests", + "debugSelectedTests", + "coverageSelectedTests", + "hideTest", + "unhideTest", + "unhideAllTests", + "debug test", + "run with cover test", + "testing.runUsing", + "run test", + "testing.selectDefaultTestProfiles", + "testing.toggleContinuousRunOn", + "testing.startContinuousRunUsing", + "testing.configureProfile", + "testing.stopContinuous", + "testing.startContinuous", + "getSelectedProfiles", + "getExplorerSelection", + "runAllTests", + "debugAllTests", + "runAllWithCoverage", + "testing.cancelRun", + "testing.viewAsList", + "testing.viewAsTree", + "testing.sortByStatus", + "testing.sortByLocation", + "testing.sortByDuration", + "testing.showMostRecentOutput", + "testing.collapseAll", + "testing.clearResults", + "testing.editFocusedTest", + "testing.runAtCursor", + "testing.debugAtCursor", + "testing.coverageAtCursor", + "testing.runCurrentFile", + "testing.debugCurrentFile", + "testing.coverageCurrentFile", + "testing.reRunFailTests", + "testing.debugFailTests", + "testing.reRunLastRun", + "testing.debugLastRun", + "testing.coverageLastRun", + "testing.reRunFailedFromLastRun", + "testing.debugFailedFromLastRun", + "testing.searchForTestExtension", + "testing.openOutputPeek", + "testing.toggleInlineTestOutput", + "testing.refreshTests", + "testing.cancelTestRefresh", + "testing.clearCoverage", + "testing.openCoverage", + "testing.goToRelatedTest", + "testing.peekToRelatedTest", + "testing.goToRelatedCode", + "testing.peekToRelatedCode", + "testing.toggleResultsViewLayout" + ], + "vs/workbench/contrib/testing/browser/testing.contribution": [ + { + "key": "miViewTesting", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "noTestProvidersRegistered", + "searchForAdditionalTestExtensions", + "test", + "testResultsPanelName", + "testResultsPanelName", + "testExplorer", + "testCoverage" + ], + "vs/workbench/contrib/testing/browser/testingConfigurationUi": [ + "testConfigurationUi.pick", + "updateTestConfiguration" + ], + "vs/workbench/contrib/testing/browser/testingDecorations": [ + "peekTestOutout", + "expected.title", + "actual.title", + "testing.gutterMsg.contextMenu", + "testing.gutterMsg.debug", + "testing.gutterMsg.coverage", + "testing.gutterMsg.run", + "run test", + "debug test", + "coverage test", + "testing.runUsing", + "peek failure", + "testing.cancelRun", + "reveal test", + "run all test", + "run all test with coverage", + "debug all test", + "testOverflowItems", + "selectTestToRun" + ], + "vs/workbench/contrib/testing/browser/testingExplorerFilter": [ + "testing.filters.showOnlyFailed", + "testing.filters.showOnlyExecuted", + "testing.filters.currentFile", + "testing.filters.openedFiles", + "testing.filters.showExcludedTests", + "testing.filters.menu", + "testExplorerFilterLabel", + "testExplorerFilter", + "testing.filters.fuzzyMatch", + "testing.filters.showExcludedTests", + "testing.filters.removeTestExclusions" + ], + "vs/workbench/contrib/testing/browser/testingExplorerView": [ + "defaultTestProfile", + "selectDefaultConfigs", + "configureTestProfiles", + "testingSelectConfig", + "noResults", + "testingContinuousBadge", + "testingCountBadgePassed", + "testingCountBadgeSkipped", + "testingCountBadgeFailed", + "testingNoTest", + "testingFindExtension", + { + "key": "testing.treeElementLabelDuration", + "comment": [ + "{0} is the original label in testing.treeElementLabel, {1} is a duration" + ] + }, + { + "key": "testing.treeElementLabelOutdated", + "comment": [ + "{0} is the original label in testing.treeElementLabel" + ] + }, + "testExplorer" + ], + "vs/workbench/contrib/testing/browser/testingOutputPeek": [ + "testing.markdownPeekError", + "testOutputTitle", + "close", + "testing.goToNextMessage", + "testing.goToNextMessage.description", + "testing.goToPreviousMessage", + "testing.goToPreviousMessage.description", + "testing.collapsePeekStack", + "testing.openMessageInEditor", + "testing.toggleTestingPeekHistory", + "testing.toggleTestingPeekHistory.description" + ], + "vs/workbench/contrib/testing/browser/testingViewPaneContainer": [ + "testing" + ], + "vs/workbench/contrib/testing/browser/testResultsView/testResultsOutput": [ + "testingOutputExpected", + "testingOutputActual", + "caseNoOutput", + "runNoOutput", + "runNoOutputForPast" + ], + "vs/workbench/contrib/testing/browser/testResultsView/testResultsTree": [ + "openTestCoverage", + "closeTestCoverage", + "oneOlderResult", + "nOlderResults", + "messageMoreLinesN", + "messageMoreLines1", + "testingPeekLabel", + "testing.showResultOutput", + "testing.cancelRun", + "testing.reRunLastRun", + "testing.reRunFailedFromLastRun", + "testing.debugLastRun", + "testing.debugFailedFromLastRun", + "testing.showResultOutput", + "testing.reRunTest", + "testing.reRunFailedFromLastRun", + "testing.debugTest", + "testing.debugFailedFromLastRun", + "testing.goToTest", + "testing.showResultOutput", + "testing.revealInExplorer", + "run test", + "debug test", + "testing.goToError" + ], + "vs/workbench/contrib/testing/browser/testResultsView/testResultsViewContent": [ + "testing.callStack.run", + "testing.callStack.debug", + "testFollowup.more" + ], + "vs/workbench/contrib/testing/browser/theme": [ + "testing.iconFailed", + "testing.iconErrored", + "testing.iconPassed", + "testing.runAction", + "testing.iconQueued", + "testing.iconUnset", + "testing.iconSkipped", + "testing.peekBorder", + "testing.messagePeekBorder", + "testing.peekBorder", + "testing.messagePeekHeaderBackground", + "testing.coveredBackground", + "testing.coveredBorder", + "testing.coveredGutterBackground", + "testing.uncoveredBranchBackground", + "testing.uncoveredBackground", + "testing.uncoveredBorder", + "testing.uncoveredGutterBackground", + "testing.coverCountBadgeBackground", + "testing.coverCountBadgeForeground", + "testing.message.error.badgeBackground", + "testing.message.error.badgeBorder", + "testing.message.error.badgeForeground", + "testing.message.error.marginBackground", + "testing.message.info.decorationForeground", + "testing.message.info.marginBackground", + "testing.iconErrored.retired", + "testing.iconFailed.retired", + "testing.iconPassed.retired", + "testing.iconQueued.retired", + "testing.iconUnset.retired", + "testing.iconSkipped.retired" + ], + "vs/workbench/contrib/testing/common/configuration": [ + "testConfigurationTitle", + "testing.automaticallyOpenPeekView", + "testing.automaticallyOpenPeekView.failureAnywhere", + "testing.automaticallyOpenPeekView.failureInVisibleDocument", + "testing.automaticallyOpenPeekView.never", + "testing.showAllMessages", + "testing.automaticallyOpenPeekViewDuringContinuousRun", + "testing.countBadge", + "testing.countBadge.failed", + "testing.countBadge.off", + "testing.countBadge.passed", + "testing.countBadge.skipped", + "testing.followRunningTest", + "testing.defaultGutterClickAction", + "testing.defaultGutterClickAction.run", + "testing.defaultGutterClickAction.debug", + "testing.defaultGutterClickAction.coverage", + "testing.defaultGutterClickAction.contextMenu", + "testing.gutterEnabled", + "testing.saveBeforeTest", + "testing.openTesting.neverOpen", + "testing.openTesting.openOnTestStart", + "testing.openTesting.openOnTestFailure", + "testing.openTesting.openExplorerOnTestStart", + "testing.openTesting", + "testing.alwaysRevealTestOnStateChange", + "testing.ShowCoverageInExplorer", + "testing.displayedCoveragePercent", + "testing.displayedCoveragePercent.totalCoverage", + "testing.displayedCoveragePercent.statement", + "testing.displayedCoveragePercent.minimum", + "testing.coverageBarThresholds", + "testing.coverageToolbarEnabled", + "testing.resultsView.layout", + "testing.resultsView.layout.treeRight", + "testing.resultsView.layout.treeLeft" + ], + "vs/workbench/contrib/testing/common/constants": [ + "testState.errored", + "testState.failed", + "testState.passed", + "testState.queued", + "testState.running", + "testState.skipped", + "testState.unset", + { + "key": "testing.treeElementLabel", + "comment": [ + "label then the unit tests state, for example \"Addition Tests (Running)\"" + ] + }, + "testGroup.debug", + "testGroup.run", + "testGroup.coverage" + ], + "vs/workbench/contrib/testing/common/testingChatAgentTool": [ + "runTestTool.userDescription", + "runTestTool.noTests", + "runTestTool.invoke.progress", + "runTestTool.noRunStarted", + "runTestTool.invoke.cancelled", + "runTestTool.invoke.cancelled", + "runTestTool.invoke.filterProgress", + "runTestTool.invoke.filesProgress", + "runTestTool.confirm.title", + "runTestTool.confirm.invocation", + "runTestTool.confirm.message", + "runTestTool.confirm.all" + ], + "vs/workbench/contrib/testing/common/testingContentProvider": [ + "runNoOutout" + ], + "vs/workbench/contrib/testing/common/testingContextKeys": [ + "testing.canRefresh", + "testing.isRefreshing", + "testing.isContinuousModeOn", + "testing.hasDebuggableTests", + "testing.hasRunnableTests", + "testing.hasCoverableTests", + "testing.hasNonDefaultConfig", + "testing.hasConfigurableConfig", + "testing.supportsContinuousRun", + "testing.isParentRunningContinuously", + "testing.activeEditorHasTests", + "testing.cursorInsideTestRange", + "testing.isTestCoverageOpen", + "testing.hasCoverageInFile", + "testing.hasPerTestCoverage", + "testing.hasInlineCoverageDetails", + "testing.isCoverageFilteredToTest", + "testing.coverageToolbarEnabled", + "testing.inlineCoverageEnabled", + "testing.canGoToRelatedCode", + "testing.canGoToRelatedTest", + "testing.peekHasStack", + "testing.peekItemType", + "testing.controllerId", + "testing.testId", + "testing.testItemHasUri", + "testing.testItemIsHidden", + "testing.testMessage", + "testing.testResultOutdated", + "testing.testResultState", + "testing.profile.context.group" + ], + "vs/workbench/contrib/testing/common/testingProgressMessages": [ + "testProgress.runningInitial", + "testProgress.running", + "testProgressWithSkip.running", + "testProgress.completed", + "testProgressWithSkip.completed" + ], + "vs/workbench/contrib/testing/common/testResult": [ + "runFinished", + "testUnnamedTask" + ], + "vs/workbench/contrib/testing/common/testServiceImpl": [ + "testTrust", + "testError", + "testTrust", + "testError" + ], + "vs/workbench/contrib/testing/common/testTypes": [ + "testing.runProfileBitset.run", + "testing.runProfileBitset.debug", + "testing.runProfileBitset.coverage" + ], + "vs/workbench/contrib/themes/browser/themes.contribution": [ + "manageExtensionIcon", + "themes.selectMarketplaceTheme", + "search.error", + "installExtension.confirm", + "installExtension.button.ok", + "installing extensions", + "themes.selectTheme.darkScheme", + "themes.selectTheme.lightScheme", + "themes.selectTheme.darkHC", + "themes.selectTheme.lightHC", + "themes.selectTheme.default", + "themes.configure.switchingEnabled", + "themes.configure.switchingDisabled", + "installColorThemes", + "browseColorThemes", + "themes.category.light", + "themes.category.dark", + "themes.category.hc", + "installIconThemes", + "themes.selectIconTheme", + "fileIconThemeCategory", + "noIconThemeLabel", + "noIconThemeDesc", + "installProductIconThemes", + "browseProductIconThemes", + "themes.selectProductIconTheme", + "productIconThemeCategory", + "defaultProductIconThemeLabel", + "manage extension", + { + "key": "cannotToggle", + "comment": [ + "{0} is a setting name" + ] + }, + "goToSetting", + "themes", + { + "key": "miSelectTheme", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "selectTheme.label", + "themes.selectIconTheme.label", + "themes.selectProductIconTheme.label", + "selectTheme.label", + "selectIconTheme.label", + "selectProductIconTheme.label", + "generateColorTheme.label", + "toggleLightDarkThemes.label", + "browseColorThemeInMarketPlace.label" + ], + "vs/workbench/contrib/timeline/browser/timeline.contribution": [ + "timelineViewIcon", + "timelineOpenIcon", + "timelineConfigurationTitle", + "timeline.pageSize", + "timeline.pageOnScroll", + "files.openTimeline", + "timelineFilter", + "filterTimeline" + ], + "vs/workbench/contrib/timeline/browser/timelinePane": [ + "timeline.loadingMore", + "timeline.loadMore", + "timeline.editorCannotProvideTimeline", + "timeline.noTimelineSourcesEnabled", + "timeline.noLocalHistoryYet", + "timeline.noTimelineInfoFromEnabledSources", + "timeline.noTimelineInfo", + "timeline.noSCM", + "timeline.editorCannotProvideTimeline", + "timeline.aria.item", + "timeline", + "timeline.loading", + "timelineRefresh", + "timelinePin", + "timelineUnpin", + "timeline", + "refresh", + "timeline", + "timeline.toggleFollowActiveEditorCommand.follow", + "timeline", + "timeline.toggleFollowActiveEditorCommand.unfollow", + "timeline" + ], + "vs/workbench/contrib/typeHierarchy/browser/typeHierarchy.contribution": [ + "editorHasTypeHierarchyProvider", + "typeHierarchyVisible", + "typeHierarchyDirection", + "no.item", + "error", + "close", + "title", + "title.supertypes", + "title.subtypes", + "title.refocusTypeHierarchy" + ], + "vs/workbench/contrib/typeHierarchy/browser/typeHierarchyPeek": [ + "supertypes", + "subtypes", + "title.loading", + "empt.supertypes", + "empt.subtypes" + ], + "vs/workbench/contrib/typeHierarchy/browser/typeHierarchyTree": [ + "tree.aria", + "supertypes", + "subtypes" + ], + "vs/workbench/contrib/update/browser/releaseNotesEditor": [ + "releaseNotesInputName", + "unassigned", + "showOnUpdate" + ], + "vs/workbench/contrib/update/browser/update.contribution": [ + { + "key": "mshowReleaseNotes", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "update.noReleaseNotesOnline", + { + "key": "mshowReleaseNotes", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "releaseNotesFromFileNone", + "pickUpdate", + { + "key": "updateButton", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "showReleaseNotes", + "showReleaseNotesCurrentFile", + "developerCategory", + "checkForUpdates", + "downloadUpdate", + "installUpdate", + "restartToUpdate", + "openDownloadPage", + "applyUpdate" + ], + "vs/workbench/contrib/update/browser/update": [ + "update.noReleaseNotesOnline", + "read the release notes", + "releaseNotes", + "update service disabled", + "learn more", + "updateIsReady", + "checkingForUpdates", + "downloading", + "updating", + "update service", + "noUpdatesAvailable", + "thereIsUpdateAvailable", + "download update", + "later", + "releaseNotes", + "updateAvailable", + "installUpdate", + "later", + "releaseNotes", + "updateNow", + "later", + "releaseNotes", + "updateAvailableAfterRestart", + "checkForUpdates", + "checkingForUpdates2", + "download update_1", + "DownloadingUpdate", + "installUpdate...", + "installingUpdate", + "showUpdateReleaseNotes", + "restartToUpdate", + "switchToInsiders", + "switchToStable", + "relaunchMessage", + "relaunchDetailInsiders", + "relaunchDetailStable", + { + "key": "reload", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "selectSyncService.message", + "selectSyncService.detail", + { + "key": "use insiders", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "use stable", + "comment": [ + "&& denotes a mnemonic" + ] + } + ], + "vs/workbench/contrib/url/browser/trustedDomains": [ + "trustedDomain.trustDomain", + "trustedDomain.trustAllPorts", + "trustedDomain.trustSubDomain", + "trustedDomain.trustAllDomains", + "trustedDomain.manageTrustedDomains", + "trustedDomain.manageTrustedDomain" + ], + "vs/workbench/contrib/url/browser/trustedDomainsValidator": [ + "openExternalLinkAt", + { + "key": "open", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "copy", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "configureTrustedDomains", + "comment": [ + "&& denotes a mnemonic" + ] + } + ], + "vs/workbench/contrib/url/browser/url.contribution": [ + "urlToOpen", + "workbench.trustedDomains.promptInTrustedWorkspace", + "openUrl" + ], + "vs/workbench/contrib/userDataProfile/browser/userDataProfile": [ + "userdataprofilesEditor", + "profiles", + "New Profile Window", + "new window with profile", + "pick profile", + "selectProfile", + { + "key": "miOpenProfiles", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "current", + "delete specific profile", + "pick profile to delete", + "change profile", + "newWindowWithProfile", + "openShort", + "open profile", + "open", + "switchProfile", + "manage profiles", + "open profiles", + "export profile", + "export profile in share", + "save profile as", + "create profile", + "delete profile" + ], + "vs/workbench/contrib/userDataProfile/browser/userDataProfileActions": [ + "create temporary profile", + "cleanup profile", + "reset workspaces" + ], + "vs/workbench/contrib/userDataProfile/browser/userDataProfilesEditor": [ + "editIcon", + "removeIcon", + "profilesSashBorder", + "profiles", + "from template", + "importProfile", + "newProfile", + "newProfile", + "new from template", + "importProfile", + "import from url", + "import from file", + "import profile quick pick title", + "import profile placeholder", + "import profile dialog", + "activeProfile", + "settings", + "keybindings", + "snippets", + "tasks", + "mcp", + "extensions", + "name", + "profileName", + "profileName", + "name required", + "profileExists", + "defaultProfileName", + "profileName", + "icon-label", + "icon", + "icon-description", + "defaultProfileIcon", + "changeIcon", + "use for curren window", + "enable for current window", + "use for new windows", + "enable for new windows", + "create from", + "copy from description", + "copy profile from", + "empty profile", + "from templates", + "from existing profiles", + "contents", + "options", + "contents", + "default profile contents description", + "contents source description", + "copy from default", + "copy info", + "default info", + "none info", + "folders_workspaces", + "hostColumnLabel", + "pathColumnLabel", + "trustedFolderAriaLabel", + "trustedFolderWithHostAriaLabel", + "trustedFoldersAndWorkspaces", + "addButton", + "addButton", + "addFolder", + "addFolderTitle", + "folders_workspaces_description", + "no_folder_description", + "default", + "default description", + "current description", + "default", + "default description", + "none", + "none description", + "copy from default", + "copy from profile description", + "copy description", + "change profile", + "open", + "deleteTrustedUri", + "localAuthority", + "userDataProfiles" + ], + "vs/workbench/contrib/userDataProfile/browser/userDataProfilesEditorModel": [ + "name required", + "profileExists", + "invalid configurations", + "open", + "open", + "applyToAllProfiles", + "copy from", + "untitled", + "active", + "copyFromProfile", + "export", + "delete", + "open new window", + "new profile exists", + "discard", + "cancel", + "create", + "import in desktop", + "cancel", + "preview", + "export", + "replace", + "create", + "deleteProfile", + "delete", + "cancel" + ], + "vs/workbench/contrib/userDataSync/browser/userDataSync.contribution": [ + { + "key": "local too many requests - reload", + "comment": [ + "Settings Sync is the name of the feature" + ] + }, + { + "key": "local too many requests - restart", + "comment": [ + "Settings Sync is the name of the feature" + ] + }, + "show sync logs", + "reload", + "restart", + "operationId", + { + "key": "server too many requests", + "comment": [ + "Settings Sync is the name of the feature" + ] + }, + "settings sync", + "show sync logs" + ], + "vs/workbench/contrib/userDataSync/browser/userDataSync": [ + "syncing", + "synced with time", + "conflicts detected", + "replace remote", + "replace local", + "show conflicts", + "accept failed", + "accept failed", + "session expired", + "turn on sync", + "turned off", + "turn on sync", + "too large", + "too many profiles", + "error upgrade required", + "operationId", + "method not found", + "operationId", + "show sync logs", + "report issue", + "error reset required", + "reset", + "show synced data action", + "service switched to insiders", + "service switched to stable", + "using separate service", + "service changed and turned off", + "turn on sync", + "operationId", + "open file", + "errorInvalidConfiguration", + "open file", + "has conflicts", + "turning on syncing", + "sign in to sync", + "no authentication providers", + "too large while starting sync", + "error upgrade required while starting sync", + "operationId", + "error reset required while starting sync", + "reset", + "show synced data action", + "auth failed", + "turn on failed with user data sync error", + { + "key": "turn on failed", + "comment": [ + "Substitution is for error reason" + ] + }, + "sign in and turn on", + "configure and turn on sync detail", + "configure sync title", + "configure sync placeholder", + "turn off sync confirmation", + "turn off sync detail", + { + "key": "turn off", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "turn off sync everywhere", + "switchSyncService.title", + "switchSyncService.description", + "default", + "insiders", + "stable", + "turning on sync", + "cancel turning on sync", + "sign in global", + "sign in accounts", + "sync is on", + "turn off failed", + "configure", + "show sync log title", + "show sync log toolrip", + "complete merges title", + "download sync activity complete", + "workbench.actions.syncData.reset", + "stop sync", + "configure sync", + "sync now", + "sync settings", + "show synced data", + "global activity turn on sync", + "resolveConflicts_global" + ], + "vs/workbench/contrib/userDataSync/browser/userDataSyncConflictsView": [ + "explanation", + { + "key": "workbench.actions.sync.openConflicts", + "comment": [ + "This is an action title to show the conflicts between local and remote version of resources" + ] + }, + "workbench.actions.sync.acceptRemote", + "workbench.actions.sync.acceptLocal", + { + "key": "remoteResourceName", + "comment": [ + "remote as in file in cloud" + ] + }, + "localResourceName", + "Theirs", + "Yours" + ], + "vs/workbench/contrib/userDataSync/browser/userDataSyncViews": [ + "workbench.actions.sync.editMachineName", + "workbench.actions.sync.turnOffSyncOnMachine", + "workbench.actions.sync.loadActivity", + "select sync activity file", + "workbench.actions.sync.resolveResourceRef", + "workbench.actions.sync.compareWithLocal", + "remoteToLocalDiff", + { + "key": "leftResourceName", + "comment": [ + "remote as in file in cloud" + ] + }, + { + "key": "rightResourceName", + "comment": [ + "local as in file in disk" + ] + }, + "workbench.actions.sync.replaceCurrent", + { + "key": "confirm replace", + "comment": [ + "A confirmation message to replace current user data (settings, extensions, keybindings, snippets) with selected version" + ] + }, + "reset", + "sideBySideLabels", + { + "key": "current", + "comment": [ + "Represents current machine" + ] + }, + { + "key": "current", + "comment": [ + "Represents current machine" + ] + }, + "no machines", + { + "key": "current", + "comment": [ + "Current machine" + ] + }, + "not found", + "turn off sync on multiple machines", + "turn off sync on machine", + { + "key": "turn off", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "placeholder", + "not found", + "valid message", + "sync logs", + "last sync states", + { + "key": "current", + "comment": [ + "Represents current log file" + ] + }, + "conflicts", + "synced machines", + "remote sync activity title", + "local sync activity title", + "downloaded sync activity title", + "troubleshoot" + ], + "vs/workbench/contrib/userDataSync/electron-browser/userDataSync.contribution": [ + "no backups", + "download sync activity complete", + "open", + "Open Backup folder" + ], + "vs/workbench/contrib/webview/browser/webview.contribution": [ + "cut", + "copy", + "paste" + ], + "vs/workbench/contrib/webview/browser/webviewElement": [ + "fatalErrorMessage" + ], + "vs/workbench/contrib/webview/electron-browser/webviewCommands": [ + "openToolsDescription", + "iframeWebviewAlert", + "openToolsLabel" + ], + "vs/workbench/contrib/webviewPanel/browser/webviewCommands": [ + "editor.action.webvieweditor.showFind", + "editor.action.webvieweditor.hideFind", + "editor.action.webvieweditor.findNext", + "editor.action.webvieweditor.findPrevious", + "refreshWebviewLabel" + ], + "vs/workbench/contrib/webviewPanel/browser/webviewEditor": [ + "context.activeWebviewId" + ], + "vs/workbench/contrib/webviewPanel/browser/webviewPanel.contribution": [ + "webview.editor.label" + ], + "vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted.contribution": [ + "welcome", + "welcome.markStepComplete", + "welcome.markStepInomplete", + "pickWalkthroughs", + "workspacePlatform", + "workbench.welcomePage.walkthroughs.openOnInstall", + { + "comment": [ + "This is the description for a setting. Values surrounded by single quotes are not to be translated." + ], + "key": "workbench.startupEditor.none" + }, + { + "comment": [ + "This is the description for a setting. Values surrounded by single quotes are not to be translated." + ], + "key": "workbench.startupEditor.welcomePage" + }, + { + "comment": [ + "This is the description for a setting. Values surrounded by single quotes are not to be translated." + ], + "key": "workbench.startupEditor.readme" + }, + { + "comment": [ + "This is the description for a setting. Values surrounded by single quotes are not to be translated." + ], + "key": "workbench.startupEditor.newUntitledFile" + }, + { + "comment": [ + "This is the description for a setting. Values surrounded by single quotes are not to be translated." + ], + "key": "workbench.startupEditor.welcomePageInEmptyWorkbench" + }, + { + "comment": [ + "This is the description for a setting. Values surrounded by single quotes are not to be translated." + ], + "key": "workbench.startupEditor.terminal" + }, + "workbench.startupEditor", + "deprecationMessage", + "workbench.welcomePage.preferReducedMotion", + "miWelcome", + "minWelcomeDescription", + "welcome", + "welcome.goBack", + "welcome.showAllWalkthroughs" + ], + "vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted": [ + "welcomeAriaLabel", + "stepDone", + "stepNotDone", + "stepAutoCompleted", + "pickWalkthroughs", + "videoAltText", + "acessibleViewHint", + "acessibleViewHintNoKbOpen", + "goBack", + "checkboxTitle", + "welcomePage.showOnStartup", + { + "key": "gettingStarted.editingEvolved", + "comment": [ + "Shown as subtitle on the Welcome page." + ] + }, + "welcomePage.openFolderWithPath", + "welcomePage.removeRecent", + "welcomePage.removeRecentAriaLabel", + "recent", + "noRecents", + "openFolder", + "toStart", + "show more recents", + "showAll", + "start", + "new", + { + "key": "newItems", + "comment": [ + "Shown when a list of items has changed based on an update from a remote source" + ] + }, + "close", + "closeAriaLabel", + "walkthroughs", + "showAll", + "gettingStarted.allStepsComplete", + "gettingStarted.someStepsComplete", + "gettingStarted.keyboardTip", + "stepDone", + "stepNotDone", + "imageShowing", + "videoShowing", + "allDone", + "nextOne", + "privacy statement", + "optOut", + { + "key": "footer", + "comment": [ + "fist substitution is \"vs code\", second is \"privacy statement\", third is \"opt out\"." + ] + }, + "welcome", + "goBack" + ], + "vs/workbench/contrib/welcomeGettingStarted/browser/gettingStartedAccessibleView": [ + "gettingStarted.step", + "gettingStarted.title", + "gettingStarted.description" + ], + "vs/workbench/contrib/welcomeGettingStarted/browser/gettingStartedColors": [ + "welcomePage.background", + "welcomePage.tileBackground", + "welcomePage.tileHoverBackground", + "welcomePage.tileBorder", + "welcomePage.progress.background", + "welcomePage.progress.foreground", + "walkthrough.stepTitle.foreground" + ], + "vs/workbench/contrib/welcomeGettingStarted/browser/gettingStartedExtensionPoint": [ + "title", + "walkthroughs", + "walkthroughs.id", + "walkthroughs.title", + "walkthroughs.icon", + "walkthroughs.description", + "walkthroughs.featuredFor", + "walkthroughs.when", + "walkthroughs.steps", + "walkthroughs.steps.id", + "walkthroughs.steps.title", + "walkthroughs.steps.description.interpolated", + "walkthroughs.steps.button.deprecated.interpolated", + "walkthroughs.steps.media", + "pathDeprecated", + "walkthroughs.steps.media.image.path.string", + "walkthroughs.steps.media.image.path.dark.string", + "walkthroughs.steps.media.image.path.light.string", + "walkthroughs.steps.media.image.path.hc.string", + "walkthroughs.steps.media.image.path.hcLight.string", + "walkthroughs.steps.media.altText", + "walkthroughs.steps.media.image.path.svg", + "walkthroughs.steps.media.altText", + "pathDeprecated", + "walkthroughs.steps.media.markdown.path", + "walkthroughs.steps.completionEvents", + "walkthroughs.steps.completionEvents.onCommand", + "walkthroughs.steps.completionEvents.onLink", + "walkthroughs.steps.completionEvents.onView", + "walkthroughs.steps.completionEvents.onSettingChanged", + "walkthroughs.steps.completionEvents.onContext", + "walkthroughs.steps.completionEvents.extensionInstalled", + "walkthroughs.steps.completionEvents.stepSelected", + "walkthroughs.steps.doneOn", + "walkthroughs.steps.doneOn.deprecation", + "walkthroughs.steps.oneOn.command", + "walkthroughs.steps.when" + ], + "vs/workbench/contrib/welcomeGettingStarted/browser/gettingStartedIcons": [ + "gettingStartedUnchecked", + "gettingStartedChecked" + ], + "vs/workbench/contrib/welcomeGettingStarted/browser/gettingStartedInput": [ + "walkthroughPageTitle", + "getStarted" + ], + "vs/workbench/contrib/welcomeGettingStarted/browser/gettingStartedService": [ + "builtin", + "developer", + "resetWelcomePageWalkthroughProgress", + "resetGettingStartedProgressDescription" + ], + "vs/workbench/contrib/welcomeGettingStarted/browser/startupPage": [ + "welcome.displayName", + "startupPage.markdownPreviewError" + ], + "vs/workbench/contrib/welcomeGettingStarted/common/gettingStartedContent": [ + { + "key": "settings", + "comment": [ + "{Locked=\"[\"}", + "{Locked=\"]({0})\"}", + "{Locked=\"]({1})\"}" + ] + }, + "getting-started-setup-icon", + "getting-started-beginner-icon", + "gettingStarted.newFile.title", + "gettingStarted.newFile.description", + "gettingStarted.openMac.title", + "gettingStarted.openMac.description", + "gettingStarted.openFile.title", + "gettingStarted.openFile.description", + "gettingStarted.openFolder.title", + "gettingStarted.openFolder.description", + "gettingStarted.openFolder.title", + "gettingStarted.openFolder.description", + "gettingStarted.topLevelGitClone.title", + "gettingStarted.topLevelGitClone.description", + "gettingStarted.topLevelGitOpen.title", + "gettingStarted.topLevelGitOpen.description", + "gettingStarted.topLevelRemoteOpen.title", + "gettingStarted.topLevelRemoteOpen.description", + "gettingStarted.topLevelOpenTunnel.title", + "gettingStarted.topLevelOpenTunnel.description", + "gettingStarted.newWorkspaceChat.title", + "gettingStarted.newWorkspaceChat.description", + "gettingStarted.copilotSetup.title", + { + "key": "gettingStarted.copilotSetup.description", + "comment": [ + "{Locked=\"[\"}", + "{Locked=\"]({0})\"}" + ] + }, + { + "key": "gettingStarted.copilotSetup.terms", + "comment": [ + "{Locked=\"]({2})\"}", + "{Locked=\"]({3})\"}" + ] + }, + "setupCopilotButton.setup", + "setupCopilotButton.setup", + "setupCopilotButton.setup", + "setupCopilotButton.chatWithCopilot", + "gettingStarted.setup.title", + "gettingStarted.setup.description", + "gettingStarted.setup.walkthroughPageTitle", + "gettingStarted.pickColor.title", + "gettingStarted.pickColor.description.interpolated", + "titleID", + "gettingStarted.videoTutorial.title", + "gettingStarted.videoTutorial.description.interpolated", + "watch", + "gettingStarted.setupWeb.title", + "gettingStarted.setupWeb.description", + "gettingStarted.setupWeb.walkthroughPageTitle", + "gettingStarted.pickColor.title", + "gettingStarted.pickColor.description.interpolated", + "titleID", + "gettingStarted.menuBar.title", + "gettingStarted.menuBar.description.interpolated", + "toggleMenuBar", + "gettingStarted.extensions.title", + "gettingStarted.extensionsWeb.description.interpolated", + "browsePopularWeb", + "gettingStarted.findLanguageExts.title", + "gettingStarted.findLanguageExts.description.interpolated", + "browseLangExts", + "gettingStarted.settingsSync.title", + "gettingStarted.settingsSync.description.interpolated", + "enableSync", + "gettingStarted.commandPalette.title", + "gettingStarted.commandPalette.description.interpolated", + "commandPalette", + "gettingStarted.setup.OpenFolder.title", + "gettingStarted.setup.OpenFolderWeb.description.interpolated", + "openFolder", + "openRepository", + "gettingStarted.quickOpen.title", + "gettingStarted.quickOpen.description.interpolated", + "quickOpen", + "gettingStarted.setupAccessibility.title", + "gettingStarted.setupAccessibility.description", + "gettingStarted.setupAccessibility.walkthroughPageTitle", + "gettingStarted.accessibilityHelp.title", + "gettingStarted.accessibilityHelp.description.interpolated", + "openAccessibilityHelp", + "gettingStarted.accessibleView.title", + "gettingStarted.accessibleView.description.interpolated", + "openAccessibleView", + "gettingStarted.verbositySettings.title", + "gettingStarted.verbositySettings.description.interpolated", + "openVerbositySettings", + "gettingStarted.commandPaletteAccessibility.title", + "gettingStarted.commandPaletteAccessibility.description.interpolated", + "commandPalette", + "gettingStarted.keyboardShortcuts.title", + "gettingStarted.keyboardShortcuts.description.interpolated", + "keyboardShortcuts", + "gettingStarted.accessibilitySignals.title", + "gettingStarted.accessibilitySignals.description.interpolated", + "listSignalSounds", + "listSignalAnnouncements", + "gettingStarted.hover.title", + "gettingStarted.hover.description.interpolated", + "showOrFocusHover", + "gettingStarted.goToSymbol.title", + "gettingStarted.goToSymbol.description.interpolated", + "openGoToSymbol", + "gettingStarted.codeFolding.title", + "gettingStarted.codeFolding.description.interpolated", + "toggleFold", + "toggleFoldRecursively", + "gettingStarted.intellisense.title", + "gettingStarted.intellisense.description.interpolated", + "triggerIntellisense", + "triggerInlineSuggestion", + "gettingStarted.accessibilitySettings.title", + "gettingStarted.accessibilitySettings.description.interpolated", + "openAccessibilitySettings", + "gettingStarted.dictation.title", + "gettingStarted.dictation.description.interpolated", + "toggleDictation", + "terminalStartDictation", + "terminalStopDictation", + "gettingStarted.beginner.title", + "gettingStarted.beginner.description", + "gettingStarted.beginner.walkthroughPageTitle", + "gettingStarted.settings.title", + "gettingStarted.settingsAndSync.description.interpolated", + "tweakSettings", + "gettingStarted.extensions.title", + "gettingStarted.extensions.description.interpolated", + "browsePopular", + "gettingStarted.terminal.title", + "gettingStarted.terminal.description.interpolated", + "showTerminal", + "gettingStarted.debug.title", + "gettingStarted.debug.description.interpolated", + "runProject", + "gettingStarted.scm.title", + "gettingStarted.scmClone.description.interpolated", + "cloneRepo", + "gettingStarted.scm.title", + "gettingStarted.scmSetup.description.interpolated", + "initRepo", + "gettingStarted.scm.title", + "gettingStarted.scm.description.interpolated", + "openSCM", + "gettingStarted.installGit.title", + { + "key": "gettingStarted.installGit.description.interpolated", + "comment": [ + "The placeholders are command link items should not be translated" + ] + }, + "installGit", + "gettingStarted.tasks.title", + "gettingStarted.tasks.description.interpolated", + "runTasks", + "gettingStarted.shortcuts.title", + "gettingStarted.shortcuts.description.interpolated", + "keyboardShortcuts", + "gettingStarted.workspaceTrust.title", + "gettingStarted.workspaceTrust.description.interpolated", + "workspaceTrust", + "enableTrust", + "gettingStarted.notebook.title", + "gettingStarted.notebook.walkthroughPageTitle", + "gettingStarted.notebookProfile.title", + "gettingStarted.notebookProfile.description" + ], + "vs/workbench/contrib/welcomeGettingStarted/common/media/notebookProfile": [ + "default", + "jupyter", + "colab" + ], + "vs/workbench/contrib/welcomeGettingStarted/common/media/theme_picker_small": [ + "dark", + "light", + "HighContrast", + "HighContrastLight" + ], + "vs/workbench/contrib/welcomeGettingStarted/common/media/theme_picker": [ + "dark", + "light", + "HighContrast", + "HighContrastLight", + "seeMore" + ], + "vs/workbench/contrib/welcomeViews/common/newFile.contribution": [ + "Built-In", + "newFileTitle", + "newFilePlaceholder", + "file", + "notebook", + "change keybinding", + "miNewFileWithName", + "miNewFile2", + "Create", + "welcome.newFile" + ], + "vs/workbench/contrib/welcomeViews/common/viewsWelcomeContribution": [ + "ViewsWelcomeExtensionPoint.proposedAPI" + ], + "vs/workbench/contrib/welcomeViews/common/viewsWelcomeExtensionPoint": [ + "contributes.viewsWelcome", + "contributes.viewsWelcome.view", + "contributes.viewsWelcome.view.view", + "contributes.viewsWelcome.view.view", + "contributes.viewsWelcome.view.contents", + "contributes.viewsWelcome.view.when", + "contributes.viewsWelcome.view.group", + "contributes.viewsWelcome.view.enablement" + ], + "vs/workbench/contrib/welcomeWalkthrough/browser/editor/editorWalkThrough": [ + "editorWalkThrough.title", + "editorWalkThrough", + "editorWalkThroughMetadata" + ], + "vs/workbench/contrib/welcomeWalkthrough/browser/walkThrough.contribution": [ + "walkThrough.editor.label", + { + "key": "miPlayground", + "comment": [ + "&& denotes a mnemonic" + ] + } + ], + "vs/workbench/contrib/welcomeWalkthrough/browser/walkThroughPart": [ + "walkThrough.unboundCommand", + "walkThrough.gitNotFound" + ], + "vs/workbench/contrib/welcomeWalkthrough/common/walkThroughUtils": [ + "walkThrough.embeddedEditorBackground" + ], + "vs/workbench/contrib/workspace/browser/workspace.contribution": [ + "openLooseFileWorkspaceDetails", + "openLooseFileWindowDetails", + "openLooseFileLearnMore", + "openLooseFileWorkspaceMesssage", + "openLooseFileWindowMesssage", + { + "key": "open", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "newWindow", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "openLooseFileWorkspaceCheckbox", + "workspaceTrust", + "folderTrust", + "immediateTrustRequestMessage", + { + "key": "grantWorkspaceTrustButton", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "grantFolderTrustButton", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "manageWorkspaceTrustButton", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "cancelWorkspaceTrustButton", + "immediateTrustRequestLearnMore", + "addWorkspaceFolderMessage", + "addWorkspaceFolderDetail", + "no", + "workspaceTrust", + "folderTrust", + "checkboxString", + { + "key": "trustOption", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "trustFolderOptionDescription", + "trustWorkspaceOptionDescription", + { + "key": "dontTrustOption", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "dontTrustFolderOptionDescription", + "dontTrustWorkspaceOptionDescription", + "workspaceStartupTrustDetails", + "folderStartupTrustDetails", + "startupTrustRequestLearnMore", + "restrictedModeBannerManage", + "restrictedModeBannerLearnMore", + "restrictedModeBannerAriaLabelWindow", + "restrictedModeBannerAriaLabelFolder", + "restrictedModeBannerAriaLabelWorkspace", + "restrictedModeBannerMessageWindow", + "restrictedModeBannerMessageFolder", + "restrictedModeBannerMessageWorkspace", + "status.ariaUntrustedWindow", + { + "key": "status.tooltipUntrustedWindow2", + "comment": [ + "[abc]({n}) are links. Only translate `features are disabled` and `window is not trusted`. Do not change brackets and parentheses or {n}" + ] + }, + "status.ariaUntrustedFolder", + { + "key": "status.tooltipUntrustedFolder2", + "comment": [ + "[abc]({n}) are links. Only translate `features are disabled` and `folder is not trusted`. Do not change brackets and parentheses or {n}" + ] + }, + "status.ariaUntrustedWorkspace", + { + "key": "status.tooltipUntrustedWorkspace2", + "comment": [ + "[abc]({n}) are links. Only translate `features are disabled` and `workspace is not trusted`. Do not change brackets and parentheses or {n}" + ] + }, + "status.WorkspaceTrust", + "untrusted", + "workspaceTrustEditor", + "workspace.trust.description", + "workspace.trust.startupPrompt.description", + "workspace.trust.startupPrompt.always", + "workspace.trust.startupPrompt.once", + "workspace.trust.startupPrompt.never", + "workspace.trust.banner.description", + "workspace.trust.banner.always", + "workspace.trust.banner.untilDismissed", + "workspace.trust.banner.never", + "workspace.trust.untrustedFiles.description", + "workspace.trust.untrustedFiles.prompt", + "workspace.trust.untrustedFiles.open", + "workspace.trust.untrustedFiles.newWindow", + "workspace.trust.emptyWindow.description", + "workspacesCategory", + "configureWorkspaceTrustSettings", + "manageWorkspaceTrust" + ], + "vs/workbench/contrib/workspace/browser/workspaceTrustEditor": [ + "shieldIcon", + "checkListIcon", + "xListIcon", + "folderPickerIcon", + "editIcon", + "removeIcon", + "hostColumnLabel", + "pathColumnLabel", + "trustedFolderAriaLabel", + "trustedFolderWithHostAriaLabel", + "trustedFoldersAndWorkspaces", + "addButton", + "addButton", + "trustUri", + "selectTrustedUri", + "trustedFoldersDescription", + "noTrustedFoldersDescriptions", + { + "key": "trustAll", + "comment": [ + "The {0} will be a host name where repositories are hosted." + ] + }, + { + "key": "trustOrg", + "comment": [ + "The {0} will be an organization or user name.", + "The {1} will be a host name where repositories are hosted." + ] + }, + "invalidTrust", + "trustUri", + "selectTrustedUri", + "editTrustedUri", + "pickerTrustedUri", + "deleteTrustedUri", + "localAuthority", + "trustedUnsettableWindow", + "trustedHeaderWindow", + "trustedHeaderFolder", + "trustedHeaderWorkspace", + "untrustedHeader", + "trustedWindow", + "untrustedWorkspace", + "trustedWindowSubtitle", + "untrustedWindowSubtitle", + "trustedFolder", + "untrustedWorkspace", + "trustedFolderSubtitle", + "untrustedFolderSubtitle", + "trustedWorkspace", + "untrustedWorkspace", + "trustedWorkspaceSubtitle", + "untrustedWorkspaceSubtitle", + "trustedDescription", + "untrustedDescription", + { + "key": "workspaceTrustEditorHeaderActions", + "comment": [ + "Please ensure the markdown link syntax is not broken up with whitespace [text block](link block)" + ] + }, + "root element label", + "trustedFoldersAndWorkspaces", + "trustedTasks", + "trustedDebugging", + "trustedExtensions", + "trustedTasks", + "trustedDebugging", + "trustedSettings", + "trustedExtensions", + "untrustedTasks", + "untrustedDebugging", + { + "key": "untrustedExtensions", + "comment": [ + "Please ensure the markdown link syntax is not broken up with whitespace [text block](link block)" + ] + }, + "untrustedTasks", + "untrustedDebugging", + { + "key": "untrustedSettings", + "comment": [ + "Please ensure the markdown link syntax is not broken up with whitespace [text block](link block)" + ] + }, + "no untrustedSettings", + { + "key": "untrustedExtensions", + "comment": [ + "Please ensure the markdown link syntax is not broken up with whitespace [text block](link block)" + ] + }, + "keyboardShortcut", + "trustButton", + "trustMessage", + "trustParentButton", + "dontTrustButton", + "untrustedWorkspaceReason", + "untrustedFolderReason", + "trustedForcedReason" + ], + "vs/workbench/contrib/workspace/common/workspace": [ + "workspaceTrustEnabledCtx", + "workspaceTrustedCtx" + ], + "vs/workbench/contrib/workspaces/browser/workspaces.contribution": [ + { + "key": "foundWorkspace", + "comment": [ + "{Locked=\"]({1})\"}" + ] + }, + "openWorkspace", + { + "key": "foundWorkspaces", + "comment": [ + "{Locked=\"]({0})\"}" + ] + }, + "selectWorkspace", + "selectToOpen", + "alreadyOpen", + "openWorkspace" + ], + "vs/workbench/electron-browser/actions/developerActions": [ + "stopTracing.message", + { + "key": "stopTracing.button", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "stopTracing.title", + "stopTracing.detail", + "toggleDevTools", + "configureRuntimeArguments", + "reloadWindowWithExtensionsDisabled", + "revealUserDataFolder", + "showGPUInfo", + "showContentTracing", + "stopTracing" + ], + "vs/workbench/electron-browser/actions/installActions": [ + "successIn", + "successFrom", + "shellCommand", + "install", + "uninstall" + ], + "vs/workbench/electron-browser/actions/windowActions": [ + { + "key": "miCloseWindow", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miZoomIn", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miZoomOut", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "miZoomReset", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "close", + "close", + "closeActive", + "windowGroup", + "windowDirtyAriaLabel", + "current", + "current", + "switchWindowPlaceHolder", + "enableWindowAlwaysOnTop", + "disableWindowAlwaysOnTop", + "closeWindow", + "closeOtherWindows", + "zoomIn", + "zoomOut", + "zoomReset", + "switchWindow", + "quickSwitchWindow", + "toggleWindowAlwaysOnTop" + ], + "vs/workbench/electron-browser/desktop.contribution": [ + { + "key": "miExit", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "application.shellEnvironmentResolutionTimeout", + "windowConfigurationTitle", + "confirmSaveUntitledWorkspace", + "window.openWithoutArgumentsInNewWindow.on", + "window.openWithoutArgumentsInNewWindow.off", + "openWithoutArgumentsInNewWindow", + "window.reopenFolders.preserve", + "window.reopenFolders.all", + "window.reopenFolders.folders", + "window.reopenFolders.one", + "window.reopenFolders.none", + "restoreWindows", + "restoreFullscreen", + { + "comment": [ + "{0} will be a setting name rendered as a link" + ], + "key": "zoomLevel" + }, + { + "comment": [ + "{0} will be a setting name rendered as a link" + ], + "key": "zoomPerWindow" + }, + "window.newWindowDimensions.default", + "window.newWindowDimensions.inherit", + "window.newWindowDimensions.offset", + "window.newWindowDimensions.maximized", + "window.newWindowDimensions.fullscreen", + "newWindowDimensions", + "closeWhenEmpty", + "window.doubleClickIconToClose", + "titleBarStyle", + "controlsStyle", + "window.customTitleBarVisibility.auto", + "window.customTitleBarVisibility.windowed", + "window.customTitleBarVisibility.never", + "window.customTitleBarVisibility", + "window.menuStyle.custom.mac", + "window.menuStyle.native.mac", + "window.menuStyle.inherit.mac", + "window.menuStyle.custom", + "window.menuStyle.native", + "window.menuStyle.inherit", + "window.menuStyle.mac", + "window.menuStyle", + "dialogStyle", + "window.nativeTabs", + "window.nativeFullScreen", + "window.clickThroughInactive", + "window.border.prefix", + "window.border.default", + "window.border.system", + "window.border.off", + "window.border.color", + "window.border.suffix", + "telemetryConfigurationTitle", + "telemetry.enableCrashReporting", + "enableCrashReporterDeprecated", + "keyboardConfigurationTitle", + "touchbar.enabled", + "touchbar.ignored", + "security.promptForLocalFileProtocolHandling", + "security.promptForRemoteFileProtocolHandling", + "argv.locale", + "argv.disableLcdText", + "argv.proxyBypassList", + "argv.disableHardwareAcceleration", + "argv.forceColorProfile", + "argv.enableCrashReporter", + "argv.crashReporterId", + "argv.enebleProposedApi", + "argv.logLevel", + "argv.disableChromiumSandbox", + "argv.useInMemorySecretStorage", + "argv.remoteDebuggingPort", + "argv.force-renderer-accessibility", + "argv.passwordStore", + "argv.enableRDPDisplayTracking", + "newTab", + "showPreviousTab", + "showNextWindowTab", + "moveWindowTabToNewWindow", + "mergeAllWindowTabs", + "toggleWindowTabsBar" + ], + "vs/workbench/electron-browser/desktop.main": [ + "join.closeStorage" + ], + "vs/workbench/electron-browser/parts/dialogs/dialogHandler": [ + { + "key": "copy", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "okButton" + ], + "vs/workbench/electron-browser/window": [ + "sharedProcessCrash", + "restart", + "restart", + "configure", + "learnMore", + "keychainWriteError", + "troubleshooting", + "runningTranslated", + "downloadArmBuild", + "showArgvParseWarning", + "showArgvParseWarningAction", + "proxyAuthRequired", + { + "key": "loginButton", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "username", + "password", + "proxyDetail", + "rememberCredentials", + "shutdownErrorDetail", + "willShutdownDetail", + "shutdownErrorClose", + "shutdownErrorQuit", + "shutdownErrorReload", + "shutdownErrorLoad", + "shutdownTitleClose", + "shutdownTitleQuit", + "shutdownTitleReload", + "shutdownTitleLoad", + "shutdownForceClose", + "shutdownForceQuit", + "shutdownForceReload", + "shutdownForceLoad", + "runningAsRoot", + "appRootWarning.banner", + "macoseolmessage", + "learnMore", + "resolveShellEnvironment", + "learnMore", + "zoomOut", + "zoomIn", + "zoomReset", + "zoomResetLabel", + "zoomSettings", + "status.windowZoom", + "zoomNumber" + ], + "vs/workbench/services/accounts/common/defaultAccount": [ + "sign in" + ], + "vs/workbench/services/actions/common/menusExtensionPoint": [ + "menus.commandPalette", + "menus.touchBar", + "menus.editorTitle", + "menus.editorTitleRun", + "menus.editorContext", + "menus.editorContextCopyAs", + "menus.editorContextShare", + "menus.explorerContext", + "menus.explorerContextShare", + "menus.editorTabContext", + "menus.editorTitleContextShare", + "menus.debugCallstackContext", + "menus.debugVariablesContext", + "menus.debugWatchContext", + "menus.debugToolBar", + "menus.debugCreateConfiguation", + "menus.notebookVariablesContext", + "menus.home", + "menus.opy", + "menus.scmTitle", + "menus.scmSourceControl", + "menus.scmSourceControlTitle", + "menus.scmSourceControlInline", + "menus.resourceStateContext", + "menus.resourceFolderContext", + "menus.resourceGroupContext", + "menus.changeTitle", + "menus.input", + "menus.scmHistoryTitle", + "menus.historyItemContext", + "menus.historyItemRefContext", + "menus.artifactGroupContext", + "menus.artifactContext", + "menus.statusBarRemoteIndicator", + "menus.terminalContext", + "menus.terminalTabContext", + "view.viewTitle", + "view.containerTitle", + "view.itemContext", + "commentThread.editorActions", + "commentThread.title", + "commentThread.actions", + "commentThread.actions", + "commentThread.titleContext", + "comment.title", + "comment.actions", + "comment.commentContext", + "commentsView.threadActions", + "notebook.toolbar", + "notebook.kernelSource", + "notebook.cell.title", + "notebook.cell.execute", + "interactive.toolbar", + "interactive.cell.title", + "issue.reporter", + "testing.item.context", + "testing.item.gutter.title", + "testing.profiles.context.title", + "testing.item.result.title", + "testing.message.context.title", + "testing.message.content.title", + "menus.extensionContext", + "view.timelineTitle", + "view.timelineContext", + "view.tunnelContext", + "view.tunnelOriginInline", + "view.tunnelPortInline", + "file.newFile", + "webview.context", + "menus.share", + "inlineCompletions.actions", + "merge.toolbar", + "editorLineNumberContext", + "menus.mergeEditorResult", + "menus.multiDiffEditorContent", + "menus.multiDiffEditorResource", + "menus.diffEditorGutterToolBarMenus", + "menus.diffEditorGutterToolBarMenus", + "searchPanel.aiResultsCommands", + "menus.chatTextEditor", + "menus.chatEditingSessionChangesToolbar", + "menus.chatSessions", + "menus.chatSessionsNewSession", + "menus.chatMultiDiffContext", + "requirestring", + "optstring", + "optstring", + "optstring", + "requirestring", + "optstring", + "optstring", + "requirearray", + "require", + "requirestring", + "requirestring", + "vscode.extension.contributes.menuItem.command", + "vscode.extension.contributes.menuItem.alt", + "vscode.extension.contributes.menuItem.when", + "vscode.extension.contributes.menuItem.group", + "vscode.extension.contributes.menuItem.submenu", + "vscode.extension.contributes.menuItem.when", + "vscode.extension.contributes.menuItem.group", + "vscode.extension.contributes.submenu.id", + "vscode.extension.contributes.submenu.label", + { + "key": "vscode.extension.contributes.submenu.icon", + "comment": [ + "do not translate or change \"\\$(zap)\", \\ in front of $ is important." + ] + }, + "vscode.extension.contributes.submenu.icon.light", + "vscode.extension.contributes.submenu.icon.dark", + "vscode.extension.contributes.menus", + "proposed", + "vscode.extension.contributes.submenus", + "nonempty", + "requirestring", + "optstring", + "opticon", + "requireStringOrObject", + "requirestring", + "requirestrings", + "vscode.extension.contributes.commandType.command", + "vscode.extension.contributes.commandType.title", + "vscode.extension.contributes.commandType.shortTitle", + "vscode.extension.contributes.commandType.category", + "vscode.extension.contributes.commandType.precondition", + { + "key": "vscode.extension.contributes.commandType.icon", + "comment": [ + "do not translate or change \"\\$(zap)\", \\ in front of $ is important." + ] + }, + "vscode.extension.contributes.commandType.icon.light", + "vscode.extension.contributes.commandType.icon.dark", + "vscode.extension.contributes.commands", + "dup1", + "dup0", + "submenuId.invalid.id", + "submenuId.duplicate.id", + "submenuId.invalid.label", + "proposedAPI.invalid", + "missing.command", + "missing.altCommand", + "dupe.command", + "unsupported.submenureference", + "missing.submenu", + "submenuItem.duplicate", + "viewContainerTitle.when", + "command name", + "command title", + "keyboard shortcuts", + "menuContexts", + "commands" + ], + "vs/workbench/services/assignment/common/assignmentService": [ + "workbench.enableExperiments" + ], + "vs/workbench/services/authentication/browser/authenticationExtensionsService": [ + "sign in", + "confirmAuthenticationAccess", + { + "key": "allow", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "deny", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "useOtherAccount", + { + "key": "selectAccount", + "comment": [ + "The placeholder {0} is the name of an extension. {1} is the name of the type of account, such as Microsoft or GitHub." + ] + }, + "getSessionPlateholder", + { + "key": "accessRequest", + "comment": [ + "The placeholder {0} will be replaced with an authentication provider''s label. {1} will be replaced with an extension name. (1) is to indicate that this menu item contributes to a badge count" + ] + }, + { + "key": "signInRequest", + "comment": [ + "The placeholder {0} will be replaced with an authentication provider's label. {1} will be replaced with an extension name. (1) is to indicate that this menu item contributes to a badge count." + ] + } + ], + "vs/workbench/services/authentication/browser/authenticationMcpService": [ + "sign in", + "confirmAuthenticationAccess", + { + "key": "allow", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "deny", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "useOtherAccount", + { + "key": "selectAccount", + "comment": [ + "The placeholder {0} is the name of a MCP server. {1} is the name of the type of account, such as Microsoft or GitHub." + ] + }, + "getSessionPlateholder", + { + "key": "accessRequest", + "comment": [ + "The placeholder {0} will be replaced with an authentication provider''s label. {1} will be replaced with a MCP server name. (1) is to indicate that this menu item contributes to a badge count" + ] + }, + { + "key": "signInRequest", + "comment": [ + "The placeholder {0} will be replaced with an authentication provider's label. {1} will be replaced with a MCP server name. (1) is to indicate that this menu item contributes to a badge count." + ] + } + ], + "vs/workbench/services/authentication/browser/authenticationService": [ + "authentication.id", + "authentication.label", + "authentication.authorizationServerGlobs", + "authentication.authorizationServerGlobsDescription", + { + "key": "authenticationExtensionPoint", + "comment": [ + "'Contributes' means adds here" + ] + }, + "authentication.missingId", + "authentication.missingLabel", + "authentication.idConflict", + "authentication.missingId", + "authentication.missingLabel", + "authentication.idConflict" + ], + "vs/workbench/services/auxiliaryWindow/browser/auxiliaryWindowService": [ + "lifecycleVeto", + "unableToOpenWindowError", + "unableToOpenWindow", + "unableToOpenWindowDetail", + { + "key": "retry", + "comment": [ + "&& denotes a mnemonic" + ] + } + ], + "vs/workbench/services/auxiliaryWindow/electron-browser/auxiliaryWindowService": [ + "backupErrorDetails" + ], + "vs/workbench/services/chat/common/chatEntitlementService": [ + "signUpNoResponseError", + "signUpUnexpectedStatusError", + "signUpNoResponseContentsError", + "signUpInvalidResponseError", + "unknownSignUpError", + "retry", + "unprocessableSignUpError", + "ok", + "learnMore" + ], + "vs/workbench/services/clipboard/browser/clipboardService": [ + "clipboardError", + "retry", + "learnMore" + ], + "vs/workbench/services/configuration/browser/configurationService": [ + "configurationDefaults.description", + "setting description" + ], + "vs/workbench/services/configuration/common/configurationEditing": [ + "fsError", + "openTasksConfiguration", + "openLaunchConfiguration", + "openMcpConfiguration", + "open", + "openTasksConfiguration", + "openLaunchConfiguration", + "saveAndRetry", + "saveAndRetry", + "open", + "errorPolicyConfiguration", + "errorUnknownKey", + "errorInvalidWorkspaceConfigurationApplication", + "errorInvalidWorkspaceConfigurationMachine", + "errorInvalidFolderConfiguration", + "errorInvalidUserTarget", + "errorInvalidWorkspaceTarget", + "errorInvalidFolderTarget", + "errorInvalidResourceLanguageConfiguration", + "errorNoWorkspaceOpened", + "errorInvalidTaskConfiguration", + "errorInvalidLaunchConfiguration", + "errorInvalidMCPConfiguration", + "errorInvalidConfiguration", + "errorInvalidRemoteConfiguration", + "errorInvalidConfigurationWorkspace", + "errorInvalidConfigurationFolder", + "errorTasksConfigurationFileDirty", + "errorLaunchConfigurationFileDirty", + "errorMCPConfigurationFileDirty", + "errorConfigurationFileDirty", + "errorRemoteConfigurationFileDirty", + "errorConfigurationFileDirtyWorkspace", + "errorConfigurationFileDirtyFolder", + "errorTasksConfigurationFileModifiedSince", + "errorLaunchConfigurationFileModifiedSince", + "errorMCPConfigurationFileModifiedSince", + "errorConfigurationFileModifiedSince", + "errorRemoteConfigurationFileModifiedSince", + "errorConfigurationFileModifiedSinceWorkspace", + "errorConfigurationFileModifiedSinceFolder", + "errorUnknown", + "userTarget", + "remoteUserTarget", + "workspaceTarget", + "folderTarget" + ], + "vs/workbench/services/configuration/common/jsonEditingService": [ + "errorInvalidFile" + ], + "vs/workbench/services/configurationResolver/browser/baseConfigurationResolverService": [ + "commandVariable.noStringType", + "inputVariable.noInputSection", + "inputVariable.missingAttribute", + "inputVariable.defaultInputValue", + "inputVariable.command.noStringType", + "inputVariable.unknownType", + "inputVariable.undefinedVariable" + ], + "vs/workbench/services/configurationResolver/common/configurationResolverSchema": [ + "JsonSchema.input.id", + "JsonSchema.input.type", + "JsonSchema.input.description", + "JsonSchema.input.default", + "JsonSchema.inputs", + "JsonSchema.input.type.promptString", + "JsonSchema.input.password", + "JsonSchema.input.type.pickString", + "JsonSchema.input.options", + "JsonSchema.input.pickString.optionLabel", + "JsonSchema.input.pickString.optionValue", + "JsonSchema.input.type.command", + "JsonSchema.input.command.command", + "JsonSchema.input.command.args", + "JsonSchema.input.command.args", + "JsonSchema.input.command.args" + ], + "vs/workbench/services/configurationResolver/common/configurationResolverUtils": [ + "deprecatedVariables" + ], + "vs/workbench/services/configurationResolver/common/variableResolver": [ + "canNotResolveFile", + "canNotResolveFolderForFile", + "canNotFindFolder", + "canNotResolveWorkspaceFolderMultiRoot", + "canNotResolveWorkspaceFolder", + "missingEnvVarName", + "configNotFound", + "configNoString", + "missingConfigName", + "extensionNotInstalled", + "missingExtensionName", + "canNotResolveUserHome", + "canNotResolveLineNumber", + "canNotResolveColumnNumber", + "canNotResolveSelectedText", + "noValueForCommand" + ], + "vs/workbench/services/decorations/browser/decorationsService": [ + "bubbleTitle" + ], + "vs/workbench/services/dialogs/browser/abstractFileDialogService": [ + "saveChangesDetail", + "saveChangesMessage", + "saveChangesMessages", + { + "key": "saveAll", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "save", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "dontSave", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "openFileOrFolder.title", + "openFile.title", + "openFolder.title", + "openWorkspace.title", + "filterName.workspace", + "saveFileAs.title", + "saveAsTitle", + "allFiles", + "noExt" + ], + "vs/workbench/services/dialogs/browser/fileDialogService": [ + "pickFolderAndOpen", + "pickFolderAndOpen", + "pickWorkspaceAndOpen", + { + "key": "openRemote", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "learnMore", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "openFiles", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "unsupportedBrowserMessage", + "unsupportedBrowserDetail" + ], + "vs/workbench/services/dialogs/browser/simpleFileDialog": [ + "openLocalFile", + "saveLocalFile", + "openLocalFolder", + "openLocalFileFolder", + "remoteFileDialog.notConnectedToRemote", + "remoteFileDialog.placeholder", + "remoteFileDialog.local", + "remoteFileDialog.hideDotFiles", + "remoteFileDialog.showDotFiles", + "remoteFileDialog.badPath", + "remoteFileDialog.cancel", + "remoteFileDialog.invalidPath", + "remoteFileDialog.validateFolder", + "remoteFileDialog.validateExisting", + "remoteFileDialog.validateBadFilename", + "remoteFileDialog.validateCreateDirectory", + "remoteFileDialog.validateNonexistentDir", + "remoteFileDialog.validateReadonlyFolder", + "remoteFileDialog.validateNonexistentDir", + "remoteFileDialog.windowsDriveLetter", + "remoteFileDialog.validateFileOnly", + "remoteFileDialog.validateFolderOnly" + ], + "vs/workbench/services/editor/browser/editorResolverService": [ + "editorResolver.conflictingDefaults", + "editorResolver.configureDefault", + "editorResolver.keepDefault", + "promptOpenWith.currentlyActive", + "promptOpenWith.currentDefault", + "promptOpenWith.currentDefaultAndActive", + "promptOpenWith.configureDefault", + "promptOpenWith.updateDefaultPlaceHolder", + "promptOpenWith.placeHolder" + ], + "vs/workbench/services/editor/common/editorResolverService": [ + "editor.editorAssociations" + ], + "vs/workbench/services/extensionManagement/browser/extensionBisect": [ + "I cannot reproduce", + "This is Bad", + "bisect.singular", + "bisect.plural", + "msg.start", + "detail.start", + { + "key": "msg2", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "done.msg", + "done.detail2", + "done.msg", + { + "key": "report", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "continue", + "done.detail", + "done.disbale", + "msg.next", + "bisect", + { + "key": "next.good", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "next.bad", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "next.stop", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "next.cancel", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "title.start", + "title.isBad", + "title.stop" + ], + "vs/workbench/services/extensionManagement/browser/extensionEnablementService": [ + "extensionsDisabled", + "Reload", + "cannot disable language pack extension", + "cannot disable auth extension", + "cannot change enablement environment", + "cannot change disablement environment", + "cannot change enablement malicious", + "cannot change enablement virtual workspace", + "cannot change enablement extension kind", + "cannot change disallowed extension enablement", + "cannot change invalid extension enablement", + "cannot change enablement dependency", + "noWorkspace", + "cannot disable auth extension in workspace" + ], + "vs/workbench/services/extensionManagement/browser/webExtensionsScannerService": [ + "not a web extension", + "openInstalledWebExtensionsResource" + ], + "vs/workbench/services/extensionManagement/common/extensionFeaturesManagemetService": [ + "accessExtensionFeature", + "accessExtensionFeatureMessage", + "allow", + "disallow" + ], + "vs/workbench/services/extensionManagement/common/extensionManagementServerService": [ + "remote", + "browser" + ], + "vs/workbench/services/extensionManagement/common/extensionManagementService": [ + "singleDependentError", + "twoDependentsError", + "multipleDependentsError", + "manifest is not found", + "cannot be installed", + "cannot be installed", + "Manifest is not found", + "Manifest is not found", + "Manifest is not found", + "Manifest is not found", + "cannot be installed in server", + "cannot be installed", + "install extension", + "install extensions", + "install single extension", + "install multiple extensions", + { + "key": "install", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "install and do no sync", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "Manifest is not found", + { + "key": "trust publishers and install", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "trust and install", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "learnMore", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "checkTrustedPublisherTitle", + "checkTwoTrustedPublishersTitle", + "checkAllTrustedPublishersTitle", + "extension published by message", + "singleUntrustedPublisher", + "message3", + "firstTimeInstallingMessage", + "message1", + "multiInstallMessage", + "verifiedPublisherWithName", + "unverifiedPublisherWithName", + "unverifiedPublishers", + "allUnverifed", + "message4", + "message2", + "extensionInstallWorkspaceTrustButton", + "extensionInstallWorkspaceTrustContinueButton", + "extensionInstallWorkspaceTrustManageButton", + "extensionInstallWorkspaceTrustMessage", + "VS Code for Web", + "limited support", + { + "key": "install anyways", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "showExtensions", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "non web extensions detail", + "non web extensions", + "main.notFound" + ], + "vs/workbench/services/extensionManagement/common/extensionsIcons": [ + "extensionDefault", + "verifiedPublisher", + "extensionIconVerifiedForeground" + ], + "vs/workbench/services/extensionManagement/electron-browser/extensionGalleryManifestService": [ + "extensionGalleryManifestService.accountChange", + { + "key": "restart", + "comment": [ + "&& denotes a mnemonic" + ] + } + ], + "vs/workbench/services/extensionManagement/electron-browser/extensionManagementServerService": [ + "local", + "remote" + ], + "vs/workbench/services/extensionManagement/electron-browser/remoteExtensionManagementService": [ + "incompatibleAPI", + "notFoundReleaseExtension", + "notFoundCompatibleDependency" + ], + "vs/workbench/services/extensionRecommendations/common/workspaceExtensionsConfig": [ + "select for remove", + "select for add", + "select for remove", + "select for add", + "workspace folder", + "workspace" + ], + "vs/workbench/services/extensions/browser/extensionUrlHandler": [ + "confirmUrl", + "rememberConfirmUrl", + { + "key": "open", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "installDetail", + "openUri", + "reloadAndHandle", + { + "key": "reloadAndOpen", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "no", + "manage", + "extensions" + ], + "vs/workbench/services/extensions/common/abstractExtensionService": [ + "disconnectRemote", + "stopExtensionHosts", + "looping", + "looping", + "extensionTestError", + "extensionStopVetoError", + "extensionStopVetoMessage", + "proceedAnyways", + "extensionService.autoRestart", + "extensionService.crash", + "restart", + "activation" + ], + "vs/workbench/services/extensions/common/extensionHostManager": [ + "measureExtHostLatency" + ], + "vs/workbench/services/extensions/common/extensionsProposedApi": [ + "enabledProposedAPIs" + ], + "vs/workbench/services/extensions/common/extensionsRegistry": [ + "ui", + "workspace", + "vscode.extension.engines", + "vscode.extension.engines.vscode", + "vscode.extension.publisher", + "vscode.extension.displayName", + "vscode.extension.categories", + "vscode.extension.category.languages.deprecated", + "vscode.extension.galleryBanner", + "vscode.extension.galleryBanner.color", + "vscode.extension.galleryBanner.theme", + "vscode.extension.contributes", + "vscode.extension.preview", + "vscode.extension.enableProposedApi.deprecated", + "vscode.extension.enabledApiProposals", + "vscode.extension.api", + "vscode.extension.api.none", + "vscode.extension.activationEvents", + "vscode.extension.activationEvents.onWebviewPanel", + "vscode.extension.activationEvents.onLanguage", + "vscode.extension.activationEvents.onCommand", + "vscode.extension.activationEvents.onDebug", + "vscode.extension.activationEvents.onDebugInitialConfigurations", + "vscode.extension.activationEvents.onDebugDynamicConfigurations", + "vscode.extension.activationEvents.onDebugResolve", + "vscode.extension.activationEvents.onDebugAdapterProtocolTracker", + "vscode.extension.activationEvents.workspaceContains", + "vscode.extension.activationEvents.onStartupFinished", + "vscode.extension.activationEvents.onTaskType", + "vscode.extension.activationEvents.onFileSystem", + "vscode.extension.activationEvents.onEditSession", + "vscode.extension.activationEvents.onSearch", + "vscode.extension.activationEvents.onView", + "vscode.extension.activationEvents.onUri", + "vscode.extension.activationEvents.onOpenExternalUri", + "vscode.extension.activationEvents.onCustomEditor", + "vscode.extension.activationEvents.onNotebook", + "vscode.extension.activationEvents.onAuthenticationRequest", + "vscode.extension.activationEvents.onRenderer", + "vscode.extension.activationEvents.onTerminalProfile", + "vscode.extension.activationEvents.onTerminalQuickFixRequest", + "vscode.extension.activationEvents.onWalkthrough", + "vscode.extension.activationEvents.onIssueReporterOpened", + "vscode.extension.activationEvents.onChatParticipant", + "vscode.extension.activationEvents.onLanguageModelChatProvider", + "vscode.extension.activationEvents.onLanguageModelTool", + "vscode.extension.activationEvents.onTerminal", + "vscode.extension.activationEvents.onTerminalShellIntegration", + "vscode.extension.activationEvents.onMcpCollection", + "vscode.extension.activationEvents.star", + "vscode.extension.badges", + "vscode.extension.badges.url", + "vscode.extension.badges.href", + "vscode.extension.badges.description", + "vscode.extension.markdown", + "vscode.extension.qna", + "vscode.extension.extensionDependencies", + "vscode.extension.contributes.extensionPack", + "extensionKind", + "extensionKind.ui", + "extensionKind.workspace", + "extensionKind.ui-workspace", + "extensionKind.workspace-ui", + "extensionKind.empty", + "vscode.extension.capabilities", + "vscode.extension.capabilities.virtualWorkspaces", + "vscode.extension.capabilities.virtualWorkspaces.supported", + "vscode.extension.capabilities.virtualWorkspaces.supported.limited", + "vscode.extension.capabilities.virtualWorkspaces.supported.true", + "vscode.extension.capabilities.virtualWorkspaces.supported.false", + "vscode.extension.capabilities.virtualWorkspaces.description", + "vscode.extension.capabilities.untrustedWorkspaces", + "vscode.extension.capabilities.untrustedWorkspaces.supported", + "vscode.extension.capabilities.untrustedWorkspaces.supported.limited", + "vscode.extension.capabilities.untrustedWorkspaces.supported.true", + "vscode.extension.capabilities.untrustedWorkspaces.supported.false", + "vscode.extension.capabilities.untrustedWorkspaces.restrictedConfigurations", + "vscode.extension.capabilities.untrustedWorkspaces.description", + "vscode.extension.contributes.sponsor", + "vscode.extension.contributes.sponsor.url", + "vscode.extension.scripts.prepublish", + "vscode.extension.scripts.uninstall", + "vscode.extension.icon", + { + "key": "vscode.extension.l10n", + "comment": [ + "{Locked=\"bundle.l10n._locale_.json\"}", + "{Locked=\"vscode.l10n API\"}" + ] + }, + "vscode.extension.pricing", + "product.extensionEnabledApiProposals" + ], + "vs/workbench/services/extensions/common/extensionsUtil": [ + "overwritingExtension", + "overwritingExtension", + "overwritingWithWorkspaceExtension", + "extensionUnderDevelopment" + ], + "vs/workbench/services/extensions/electron-browser/cachedExtensionScanner": [ + "extensionUnderDevelopment.invalid", + "extensionsUnderDevelopment.invalid", + "extensionCache.invalid", + "reloadWindow" + ], + "vs/workbench/services/extensions/electron-browser/localProcessExtensionHost": [ + "extensionHost.startupFailDebug", + "extensionHost.startupFail", + "reloadWindow", + "join.extensionDevelopment" + ], + "vs/workbench/services/extensions/electron-browser/nativeExtensionService": [ + "extensionService.versionMismatchCrash", + "relaunch", + "extensionService.autoRestart", + "startBisect", + "devTools", + "restart", + "learnMore", + "extensionService.crash", + "getEnvironmentFailure", + "enableResolver", + "enable", + "installResolver", + "install", + "resolverExtensionNotFound", + "restartExtensionHost.reason", + "restartExtensionHost" + ], + "vs/workbench/services/files/electron-browser/diskFileSystemProvider": [ + "fileWatcher" + ], + "vs/workbench/services/files/electron-browser/elevatedFileService": [ + "fileNotTrustedMessageWindows", + "fileNotTrustedMessagePosix", + "fileNotTrusted" + ], + "vs/workbench/services/filesConfiguration/common/filesConfigurationService": [ + "providerReadonly", + { + "key": "sessionReadonly", + "comment": [ + "Please do not translate the word \"command\", it is part of our internal syntax which must not change", + "{Locked=\"](command:{0})\"}" + ] + }, + { + "key": "configuredReadonly", + "comment": [ + "Please do not translate the word \"command\", it is part of our internal syntax which must not change", + "{Locked=\"](command:{0})\"}" + ] + }, + { + "key": "fileLocked", + "comment": [ + "Please do not translate the word \"command\", it is part of our internal syntax which must not change", + "{Locked=\"](command:{0})\"}" + ] + }, + "fileReadonly" + ], + "vs/workbench/services/history/browser/historyService": [ + "canNavigateBack", + "canNavigateForward", + "canNavigateBackInNavigationLocations", + "canNavigateForwardInNavigationLocations", + "canNavigateToLastNavigationLocation", + "canNavigateBackInEditLocations", + "canNavigateForwardInEditLocations", + "canNavigateToLastEditLocation", + "canReopenClosedEditor" + ], + "vs/workbench/services/host/browser/browserHostService": [ + "unableToOpenExternalWorkspace", + "unableToOpenExternal", + "unableToOpenWindowDetail", + { + "key": "retry", + "comment": [ + "&& denotes a mnemonic" + ] + } + ], + "vs/workbench/services/integrity/electron-browser/integrityService": [ + "integrity.prompt", + "integrity.moreInformation", + "integrity.dontShowAgain" + ], + "vs/workbench/services/keybinding/browser/keybindingService": [ + "nonempty", + "requirestring", + "optstring", + "optstring", + "optstring", + "optstring", + "optstring", + "vscode.extension.contributes.keybindings.command", + "vscode.extension.contributes.keybindings.args", + "vscode.extension.contributes.keybindings.key", + "vscode.extension.contributes.keybindings.mac", + "vscode.extension.contributes.keybindings.linux", + "vscode.extension.contributes.keybindings.win", + "vscode.extension.contributes.keybindings.when", + "vscode.extension.contributes.keybindings", + "invalid.keybindings", + "unboundCommands", + "keybindings.json.title", + "keybindings.json.command", + "keybindings.json.removalCommand", + "keybindings.json.key", + "keybindings.commandsIsArray", + "keybindings.json.when", + "keybindings.json.args" + ], + "vs/workbench/services/keybinding/browser/keyboardLayoutService": [ + "keyboardConfigurationTitle", + "keyboard.layout.config" + ], + "vs/workbench/services/keybinding/common/keybindingEditing": [ + "errorKeybindingsFileDirty", + "parseErrors", + "errorInvalidConfiguration", + "emptyKeybindingsHeader" + ], + "vs/workbench/services/label/common/labelService": [ + "vscode.extension.contributes.resourceLabelFormatters", + "vscode.extension.contributes.resourceLabelFormatters.scheme", + "vscode.extension.contributes.resourceLabelFormatters.authority", + "vscode.extension.contributes.resourceLabelFormatters.formatting", + "vscode.extension.contributes.resourceLabelFormatters.label", + "vscode.extension.contributes.resourceLabelFormatters.separator", + "vscode.extension.contributes.resourceLabelFormatters.stripPathStartingSeparator", + "vscode.extension.contributes.resourceLabelFormatters.tildify", + "vscode.extension.contributes.resourceLabelFormatters.formatting.workspaceSuffix", + "untitledWorkspace", + "temporaryWorkspace", + "workspaceNameVerbose", + "workspaceName" + ], + "vs/workbench/services/language/common/languageService": [ + "vscode.extension.contributes.languages", + "vscode.extension.contributes.languages.id", + "vscode.extension.contributes.languages.aliases", + "vscode.extension.contributes.languages.extensions", + "vscode.extension.contributes.languages.filenames", + "vscode.extension.contributes.languages.filenamePatterns", + "vscode.extension.contributes.languages.mimetypes", + "vscode.extension.contributes.languages.firstLine", + "vscode.extension.contributes.languages.configuration", + "vscode.extension.contributes.languages.icon", + "vscode.extension.contributes.languages.icon.light", + "vscode.extension.contributes.languages.icon.dark", + "language id", + "language name", + "file extensions", + "grammar", + "snippets", + "languages", + "invalid", + "invalid.empty", + "require.id", + "opt.extensions", + "opt.filenames", + "opt.firstLine", + "opt.configuration", + "opt.aliases", + "opt.mimetypes", + "opt.icon" + ], + "vs/workbench/services/lifecycle/browser/lifecycleService": [ + "lifecycleVeto" + ], + "vs/workbench/services/localization/browser/localeService": [ + "relaunchDisplayLanguageMessage", + "relaunchDisplayLanguageDetail", + { + "key": "reload", + "comment": [ + "&& denotes a mnemonic character" + ] + }, + "clearDisplayLanguageMessage", + "clearDisplayLanguageDetail", + { + "key": "reload", + "comment": [ + "&& denotes a mnemonic character" + ] + } + ], + "vs/workbench/services/localization/electron-browser/localeService": [ + "argvInvalid", + "openArgv", + "installing", + "restartDisplayLanguageMessage1", + "restartDisplayLanguageDetail1", + { + "key": "restart", + "comment": [ + "&& denotes a mnemonic character" + ] + } + ], + "vs/workbench/services/log/common/logConstants": [ + "window" + ], + "vs/workbench/services/notification/common/notificationService": [ + "neverShowAgain", + "neverShowAgain" + ], + "vs/workbench/services/preferences/browser/keybindingsEditorInput": [ + "keybindingsEditorLabelIcon", + "keybindingsInputName" + ], + "vs/workbench/services/preferences/browser/keybindingsEditorModel": [ + "default", + "extension", + "user", + "cat.title", + "cat.title", + "option", + "meta" + ], + "vs/workbench/services/preferences/browser/preferencesService": [ + "openFolderFirst", + "emptyKeybindingsHeader", + "defaultKeybindings", + "defaultKeybindings", + "fail.createSettings" + ], + "vs/workbench/services/preferences/common/preferencesEditorInput": [ + "settingsEditorLabelIcon", + "settingsEditor2InputName", + "preferencesEditorLabelIcon", + "preferencesEditorInputName" + ], + "vs/workbench/services/preferences/common/preferencesModels": [ + "commonlyUsed", + "defaultKeybindingsHeader" + ], + "vs/workbench/services/preferences/common/preferencesValidation": [ + "validations.booleanIncorrectType", + "validations.expectedNumeric", + "validations.stringIncorrectEnumOptions", + "validations.stringIncorrectType", + "invalidTypeError", + "regexParsingError", + "validations.maxLength", + "validations.minLength", + "validations.regex", + "validations.colorFormat", + "validations.uriEmpty", + "validations.uriMissing", + "validations.uriSchemeMissing", + "validations.invalidStringEnumValue", + "validations.exclusiveMax", + "validations.exclusiveMin", + "validations.max", + "validations.min", + "validations.multipleOf", + "validations.expectedInteger", + "validations.arrayIncorrectType", + "validations.stringArrayUniqueItems", + "validations.stringArrayMinItem", + "validations.stringArrayMaxItem", + "validations.stringArrayIncorrectType", + "validations.stringArrayItemPattern", + "validations.stringArrayItemEnum", + "validations.objectIncorrectType", + "validations.objectPattern" + ], + "vs/workbench/services/progress/browser/progressService": [ + "progress.text2", + "progress.title3", + "progress.title2", + "progress.title2", + "status.progress", + "cancel", + "cancel", + "dismiss" + ], + "vs/workbench/services/remote/browser/remoteAgentService": [ + "connectionError", + "connectionErrorDetail", + { + "key": "reload", + "comment": [ + "&& denotes a mnemonic" + ] + } + ], + "vs/workbench/services/remote/common/remoteExplorerService": [ + "getStartedWalkthrough.id", + "RemoteHelpInformationExtPoint", + "RemoteHelpInformationExtPoint.getStarted", + "RemoteHelpInformationExtPoint.documentation", + "RemoteHelpInformationExtPoint.feedback", + "RemoteHelpInformationExtPoint.feedback.deprecated", + "RemoteHelpInformationExtPoint.reportIssue", + "RemoteHelpInformationExtPoint.issues" + ], + "vs/workbench/services/remote/common/tunnelModel": [ + "tunnel.forwardedPortsViewEnabled", + "tunnel.forwardedPortsViewEnabled", + "tunnel.source.user", + "tunnel.source.auto", + "remote.localPortMismatch.single", + "tunnel.staticallyForwarded" + ], + "vs/workbench/services/remote/electron-browser/remoteAgentService": [ + "devTools", + "directUrl", + "connectionError" + ], + "vs/workbench/services/request/browser/requestService": [ + "network" + ], + "vs/workbench/services/request/electron-browser/requestService": [ + "network" + ], + "vs/workbench/services/search/browser/searchService": [ + "errorSearchText", + "errorSearchFile" + ], + "vs/workbench/services/search/common/queryBuilder": [ + "search.noWorkspaceWithName" + ], + "vs/workbench/services/secrets/electron-browser/secretStorageService": [ + "troubleshootingButton", + "encryptionNotAvailableJustTroubleshootingGuide", + "usePlainTextExtraSentence", + "usePlainText", + "isGnome", + "isKwallet" + ], + "vs/workbench/services/suggest/browser/simpleSuggestWidget": [ + "simpleSuggestWidgetHasFocusedSuggestion", + "simpleSuggestWidgetHasNavigated", + "simpleSuggestWidgetFirstSuggestionFocused", + "suggestWidget.loading", + "suggestWidget.noSuggestions", + "suggest", + "label.full", + "label.detail", + "label.desc", + "label", + "ariaCurrenttSuggestionReadDetails" + ], + "vs/workbench/services/suggest/browser/simpleSuggestWidgetDetails": [ + "details.close", + "loading" + ], + "vs/workbench/services/textfile/browser/textFileService": [ + "textFileCreate.source", + "textFileOverwrite.source", + "textFileModelDecorations", + "readonlyAndDeleted", + "readonly", + "deleted", + "fileBinaryError", + "confirmOverwrite", + "overwriteIrreversible", + { + "key": "replaceButtonLabel", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "confirmMakeWriteable", + "confirmMakeWriteableDetail", + { + "key": "makeWriteableButtonLabel", + "comment": [ + "&& denotes a mnemonic" + ] + } + ], + "vs/workbench/services/textfile/common/textFileEditorModel": [ + "textFileCreate.source", + "saveParticipants", + "saveTextFile" + ], + "vs/workbench/services/textfile/common/textFileEditorModelManager": [ + { + "key": "genericSaveError", + "comment": [ + "{0} is the resource that failed to save and {1} the error message" + ] + } + ], + "vs/workbench/services/textfile/common/textFileSaveParticipant": [ + "saveParticipants1", + "skip" + ], + "vs/workbench/services/textfile/electron-browser/nativeTextFileService": [ + "join.textFiles" + ], + "vs/workbench/services/textMate/browser/textMateTokenizationFeatureImpl": [ + "alreadyDebugging", + "stop", + "progress1", + "progress2", + "invalid.language", + "invalid.scopeName", + "invalid.path.0", + "invalid.injectTo", + "invalid.embeddedLanguages", + "invalid.tokenTypes", + "invalid.path.1" + ], + "vs/workbench/services/textMate/common/TMGrammars": [ + "vscode.extension.contributes.grammars", + "vscode.extension.contributes.grammars.language", + "vscode.extension.contributes.grammars.scopeName", + "vscode.extension.contributes.grammars.path", + "vscode.extension.contributes.grammars.embeddedLanguages", + "vscode.extension.contributes.grammars.tokenTypes", + "vscode.extension.contributes.grammars.injectTo", + "vscode.extension.contributes.grammars.balancedBracketScopes", + "vscode.extension.contributes.grammars.unbalancedBracketScopes" + ], + "vs/workbench/services/themes/browser/fileIconThemeData": [ + "error.cannotparseicontheme", + "error.invalidformat" + ], + "vs/workbench/services/themes/browser/productIconThemeData": [ + "error.parseicondefs", + "defaultTheme", + "error.cannotparseicontheme", + "error.invalidformat", + "error.missingProperties", + "error.fontWeight", + "error.fontStyle", + "error.fontSrc", + "error.noFontSrc", + "error.fontId", + "error.icon.font", + "error.icon.fontCharacter" + ], + "vs/workbench/services/themes/browser/workbenchThemeService": [ + "error.cannotloadtheme" + ], + "vs/workbench/services/themes/common/colorExtensionPoint": [ + "contributes.color", + "contributes.color.id", + "contributes.color.id.format", + "contributes.color.description", + "contributes.defaults.light", + "contributes.defaults.dark", + "contributes.defaults.highContrast", + "contributes.defaults.highContrastLight", + "invalid.colorConfiguration", + "invalid.default.colorType", + "invalid.id", + "invalid.id.format", + "invalid.description", + "invalid.defaults", + "invalid.defaults.highContrast", + "invalid.defaults.highContrastLight", + "id", + "description", + "defaultDark", + "defaultLight", + "defaultHC", + "colors" + ], + "vs/workbench/services/themes/common/colorThemeData": [ + "error.cannotparsejson", + "error.invalidformat", + { + "key": "error.invalidformat.colors", + "comment": [ + "{0} will be replaced by a path. Values in quotes should not be translated." + ] + }, + { + "key": "error.invalidformat.tokenColors", + "comment": [ + "{0} will be replaced by a path. Values in quotes should not be translated." + ] + }, + { + "key": "error.invalidformat.semanticTokenColors", + "comment": [ + "{0} will be replaced by a path. Values in quotes should not be translated." + ] + }, + "error.plist.invalidformat", + "error.cannotparse", + "error.cannotload" + ], + "vs/workbench/services/themes/common/colorThemeSchema": [ + "schema.token.settings", + "schema.token.foreground", + "schema.token.background.warning", + "schema.token.fontStyle", + "schema.fontStyle.error", + "schema.token.fontStyle.none", + "schema.token.fontFamily", + "schema.token.fontSize", + "schema.token.lineHeight", + "schema.properties.name", + "schema.properties.scope", + "schema.workbenchColors", + "schema.tokenColors.path", + "schema.colors", + "schema.supportsSemanticHighlighting", + "schema.semanticTokenColors" + ], + "vs/workbench/services/themes/common/fileIconThemeSchema": [ + "schema.folderExpanded", + "schema.folder", + "schema.file", + "schema.rootFolder", + "schema.rootFolderExpanded", + "schema.rootFolderNames", + "schema.folderName", + "schema.rootFolderNamesExpanded", + "schema.rootFolderNameExpanded", + "schema.folderNames", + "schema.folderName", + "schema.folderNamesExpanded", + "schema.folderNameExpanded", + "schema.fileExtensions", + "schema.fileExtension", + "schema.fileNames", + "schema.fileName", + "schema.languageIds", + "schema.languageId", + "schema.fonts", + "schema.id", + "schema.src", + "schema.font-path", + "schema.font-format", + "schema.font-weight", + "schema.font-style", + "schema.font-size", + "schema.iconDefinitions", + "schema.iconDefinition", + "schema.iconPath", + "schema.fontCharacter", + "schema.fontColor", + "schema.fontSize", + "schema.fontId", + "schema.light", + "schema.highContrast", + "schema.hidesExplorerArrows", + "schema.showLanguageModeIcons" + ], + "vs/workbench/services/themes/common/iconExtensionPoint": [ + "contributes.icons", + "contributes.icon.id", + "contributes.icon.id.format", + "contributes.icon.description", + "contributes.icon.default.fontPath", + "contributes.icon.default.fontCharacter", + "contributes.icon.default", + "invalid.icons.configuration", + "invalid.icons.id.format", + "invalid.icons.description", + "invalid.icons.default.fontPath.extension", + "invalid.icons.default.fontPath.path", + "invalid.icons.default" + ], + "vs/workbench/services/themes/common/productIconThemeSchema": [ + "schema.id", + "schema.src", + "schema.font-path", + "schema.font-format", + "schema.font-weight", + "schema.font-style", + "schema.iconDefinitions" + ], + "vs/workbench/services/themes/common/themeConfiguration": [ + { + "key": "colorTheme", + "comment": [ + "{0} will become a link to another setting." + ] + }, + "colorThemeError", + { + "key": "preferredDarkColorTheme", + "comment": [ + "{0} will become a link to another setting." + ] + }, + "colorThemeError", + { + "key": "preferredLightColorTheme", + "comment": [ + "{0} will become a link to another setting." + ] + }, + "colorThemeError", + { + "key": "preferredHCDarkColorTheme", + "comment": [ + "{0} will become a link to another setting." + ] + }, + "colorThemeError", + { + "key": "preferredHCLightColorTheme", + "comment": [ + "{0} will become a link to another setting." + ] + }, + "colorThemeError", + { + "key": "detectColorScheme", + "comment": [ + "{0} and {1} will become links to other settings." + ] + }, + "workbenchColors", + "iconTheme", + "noIconThemeLabel", + "noIconThemeDesc", + "iconThemeError", + "productIconTheme", + "defaultProductIconThemeLabel", + "defaultProductIconThemeDesc", + "productIconThemeError", + { + "key": "autoDetectHighContrast", + "comment": [ + "{0} and {1} will become links to other settings." + ] + }, + "editorColors.comments", + "editorColors.strings", + "editorColors.keywords", + "editorColors.numbers", + "editorColors.types", + "editorColors.functions", + "editorColors.variables", + "editorColors.textMateRules", + "editorColors.semanticHighlighting", + "editorColors.semanticHighlighting.deprecationMessage", + { + "key": "editorColors.semanticHighlighting.deprecationMessageMarkdown", + "comment": [ + "{0} will become a link to another setting." + ] + }, + "editorColors", + "editorColors.semanticHighlighting.enabled", + "editorColors.semanticHighlighting.rules", + "semanticTokenColors" + ], + "vs/workbench/services/themes/common/themeExtensionPoints": [ + "vscode.extension.contributes.themes", + "vscode.extension.contributes.themes.id", + "vscode.extension.contributes.themes.label", + "vscode.extension.contributes.themes.uiTheme", + "vscode.extension.contributes.themes.path", + "vscode.extension.contributes.iconThemes", + "vscode.extension.contributes.iconThemes.id", + "vscode.extension.contributes.iconThemes.label", + "vscode.extension.contributes.iconThemes.path", + "vscode.extension.contributes.productIconThemes", + "vscode.extension.contributes.productIconThemes.id", + "vscode.extension.contributes.productIconThemes.label", + "vscode.extension.contributes.productIconThemes.path", + "color themes", + "file icon themes", + "product icon themes", + "themes", + "reqarray", + "reqpath", + "reqid", + "invalid.path.1" + ], + "vs/workbench/services/themes/common/tokenClassificationExtensionPoint": [ + "contributes.semanticTokenTypes", + "contributes.semanticTokenTypes.id", + "contributes.semanticTokenTypes.id.format", + "contributes.semanticTokenTypes.superType", + "contributes.semanticTokenTypes.superType.format", + "contributes.color.description", + "contributes.semanticTokenModifiers", + "contributes.semanticTokenModifiers.id", + "contributes.semanticTokenModifiers.id.format", + "contributes.semanticTokenModifiers.description", + "contributes.semanticTokenScopes", + "contributes.semanticTokenScopes.languages", + "contributes.semanticTokenScopes.scopes", + "invalid.id", + "invalid.id.format", + "invalid.superType.format", + "invalid.description", + "invalid.semanticTokenTypeConfiguration", + "invalid.semanticTokenModifierConfiguration", + "invalid.semanticTokenScopes.configuration", + "invalid.semanticTokenScopes.language", + "invalid.semanticTokenScopes.scopes", + "invalid.semanticTokenScopes.scopes.value", + "invalid.semanticTokenScopes.scopes.selector" + ], + "vs/workbench/services/themes/electron-browser/themes.contribution": [ + "window.systemColorTheme.default", + "window.systemColorTheme.auto", + "window.systemColorTheme.light", + "window.systemColorTheme.dark", + { + "key": "window.systemColorTheme", + "comment": [ + "{0} and {1} will become links to other settings." + ] + } + ], + "vs/workbench/services/userDataProfile/browser/extensionsResource": [ + "installingExtension", + "extensions", + "all profiles and disabled", + "exclude", + "exclude" + ], + "vs/workbench/services/userDataProfile/browser/globalStateResource": [ + "globalState" + ], + "vs/workbench/services/userDataProfile/browser/keybindingsResource": [ + "keybindings" + ], + "vs/workbench/services/userDataProfile/browser/mcpProfileResource": [ + "mcp" + ], + "vs/workbench/services/userDataProfile/browser/settingsResource": [ + "settings" + ], + "vs/workbench/services/userDataProfile/browser/snippetsResource": [ + "snippets", + "exclude" + ], + "vs/workbench/services/userDataProfile/browser/tasksResource": [ + "tasks" + ], + "vs/workbench/services/userDataProfile/browser/userDataProfileImportExportService": [ + "create from profile", + "installing extensions", + "create from profile", + "creating settings", + "create keybindings", + "create tasks", + "create snippets", + "applying global state", + "installing extensions", + "troubleshoot issue", + "troubleshoot profile progress", + "progress extensions", + "switching profile", + "profiles.exporting", + "export success", + { + "key": "copy", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "open", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "open in", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "close", + "invalid profile content", + "invalid profile content", + "progress settings", + "progress keybindings", + "progress tasks", + "progress snippets", + "progress global state", + "progress extensions", + "select profile content handler", + "profile already exists", + { + "key": "overwrite", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "local", + "file", + "export profile dialog", + "select profile", + "select", + "select", + "from default", + "export profile name", + "export profile title", + "profile name required" + ], + "vs/workbench/services/userDataProfile/browser/userDataProfileManagement": [ + "reload message when removed", + "reload message when switched", + "reload message when updated", + "cannotRenameDefaultProfile", + "cannotDeleteDefaultProfile", + "switch profile", + "reload message", + "reload button" + ], + "vs/workbench/services/userDataProfile/common/userDataProfile": [ + "defaultProfileIcon", + "profile", + "profiles" + ], + "vs/workbench/services/userDataProfile/common/userDataProfileIcons": [ + "settingsViewBarIcon" + ], + "vs/workbench/services/userDataSync/browser/userDataSyncWorkbenchService": [ + "no authentication providers", + "no account", + "sync in progress", + "settings sync", + { + "key": "yes", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "no", + "sync turned on", + "turning on", + "resolving conflicts", + "syncing...", + "and", + "conflicts detected", + "resolve", + { + "key": "show conflicts", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "replace local single", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "replace local", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "replace remote single", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "replace remote", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "reset", + "reset title", + { + "key": "resetButton", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "download sync activity dialog title", + "download sync activity dialog open label", + "no authentication providers during signin", + "choose account placeholder", + "signed in", + "last used", + "others", + "sign in using account" + ], + "vs/workbench/services/userDataSync/common/userDataSync": [ + "settings", + "keybindings", + "snippets", + "prompts", + "tasks", + "mcp", + "extensions", + "ui state label", + "profiles", + "workspace state label", + "syncViewIcon", + "sync category", + "download sync activity title" + ], + "vs/workbench/services/views/browser/viewDescriptorService": [ + "user", + "hideView", + "toggleVisibilityDescription", + "hideViewDescription", + "resetViewLocation" + ], + "vs/workbench/services/views/browser/viewsService": [ + "editor", + "show view", + "toggle view", + "show view", + "toggle view", + "open view", + "preserveFocus", + { + "key": "focus view", + "comment": [ + "{0} indicates the name of the view to be focused." + ] + }, + "resetViewLocation" + ], + "vs/workbench/services/views/test/browser/viewContainerModel.test": [ + "test", + "test", + "Test View 1", + "test", + "Test View 1", + "test", + "Test View 1", + "Test View 2", + "test", + "Test View 1", + "Test View 2", + "test", + "Test View 1", + "Test View 2", + "Test View 3", + "test", + "Test View 1", + "Test View 2", + "Test View 3", + "test", + "Test View 1", + "test", + "Test View 1", + "test", + "Test View 1", + "Test View 2", + "Test View 3", + "test", + "Test View 1", + "test", + "Test View 1", + "test", + "Test View 1", + "test", + "Test View 1", + "test", + "Test View 5", + "Test View 2", + "Test View 4", + "Test View 3", + "Test View 1", + "test", + "Test View 1", + "test", + "Test View 1", + "test", + "Test View 1", + "test", + "Test View 1", + "Test View 2", + "Test View 3", + "test", + "Test View 1", + "Test View 2", + "Test View 3", + "test", + "Test View 1", + "Test View 2", + "Test View 3", + "Test View 4", + "test", + "Test View 1" + ], + "vs/workbench/services/views/test/browser/viewDescriptorService.test": [ + "test", + "test", + "Test View 1", + "Test View 2", + "Test View 3", + "Test View 1", + "Test View 2", + "Test View 3", + "Test View 1", + "Test View 2", + "Test View 3", + "Test View 1", + "Test View 2", + "Test View 3", + "Test View 1", + "Test View 2", + "Test View 3", + "test", + "Test View 1", + "Test View 2", + "Test View 3", + "Test View 4", + "test", + "Test View 1", + "Test View 2", + "Test View 3", + "Test View 4", + "Test View 1", + "Test View 2", + "Test View 3", + "Test View 1", + "test", + "Test View 1", + "Test View 2", + "Test View 3", + "Test View 4", + "test", + "Test View 1", + "test", + "Test View 1", + "Test View 2", + "test", + "Test View 1", + "Test View 2" + ], + "vs/workbench/services/workingCopy/common/fileWorkingCopyManager": [ + "fileWorkingCopyCreate.source", + "fileWorkingCopyReplace.source", + "fileWorkingCopyDecorations", + "readonlyAndDeleted", + "readonly", + "deleted", + "confirmOverwrite", + "overwriteIrreversible", + { + "key": "replaceButtonLabel", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "confirmMakeWriteable", + "confirmMakeWriteableDetail", + { + "key": "makeWriteableButtonLabel", + "comment": [ + "&& denotes a mnemonic" + ] + } + ], + "vs/workbench/services/workingCopy/common/storedFileWorkingCopy": [ + "saveParticipants", + "saveTextFile", + "staleSaveError", + "overwrite", + "revert", + "overwriteElevated", + "overwriteElevatedSudo", + "saveElevated", + "saveElevatedSudo", + "overwrite", + "retry", + "saveAs", + "revert", + "readonlySaveErrorAdmin", + "readonlySaveErrorSudo", + "readonlySaveError", + "permissionDeniedSaveError", + "permissionDeniedSaveErrorSudo", + { + "key": "genericSaveError", + "comment": [ + "{0} is the resource that failed to save and {1} the error message" + ] + } + ], + "vs/workbench/services/workingCopy/common/storedFileWorkingCopyManager": [ + "join.fileWorkingCopyManager" + ], + "vs/workbench/services/workingCopy/common/storedFileWorkingCopySaveParticipant": [ + "saveParticipants1", + "skip" + ], + "vs/workbench/services/workingCopy/common/workingCopyHistoryService": [ + "default.source", + "moved.source", + "renamed.source", + "join.workingCopyHistory" + ], + "vs/workbench/services/workingCopy/common/workingCopyHistoryTracker": [ + "undoRedo.source" + ], + "vs/workbench/services/workingCopy/electron-browser/workingCopyBackupService": [ + "join.workingCopyBackups" + ], + "vs/workbench/services/workingCopy/electron-browser/workingCopyBackupTracker": [ + "backupTrackerBackupFailed", + "backupTrackerConfirmFailed", + "backupErrorDetails", + { + "key": "ok", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "shutdownForceClose", + "shutdownForceQuit", + "shutdownForceReload", + "backupBeforeShutdownMessage", + "backupBeforeShutdownDetail", + "saveBeforeShutdown", + "revertBeforeShutdown", + "discardBackupsBeforeShutdown" + ], + "vs/workbench/services/workspaces/browser/abstractWorkspaceEditingService": [ + "save", + "saveWorkspace", + "errorInvalidTaskConfiguration", + "openWorkspaceConfigurationFile" + ], + "vs/workbench/services/workspaces/browser/workspaceTrustEditorInput": [ + "workspaceTrustEditorLabelIcon", + "workspaceTrustEditorInputName" + ], + "vs/workbench/services/workspaces/electron-browser/workspaceEditingService": [ + "saveWorkspaceMessage", + "saveWorkspaceDetail", + { + "key": "save", + "comment": [ + "&& denotes a mnemonic" + ] + }, + { + "key": "doNotSave", + "comment": [ + "&& denotes a mnemonic" + ] + }, + "doNotAskAgain", + "workspaceOpenedMessage", + "workspaceOpenedDetail", + "restartExtensionHost.reason" + ] + }, + "messages": { + "vs/base/browser/ui/actionbar/actionViewItems": [ + "{0} ({1})" + ], + "vs/base/browser/ui/button/button": [ + "More Actions..." + ], + "vs/base/browser/ui/dialog/dialog": [ + "OK", + "Info", + "Error", + "Warning", + "In Progress", + "Close Dialog" + ], + "vs/base/browser/ui/dropdown/dropdownActionViewItem": [ + "More Actions..." + ], + "vs/base/browser/ui/findinput/findInput": [ + "input" + ], + "vs/base/browser/ui/findinput/findInputToggles": [ + "Match Case", + "Match Whole Word", + "Use Regular Expression" + ], + "vs/base/browser/ui/findinput/replaceInput": [ + "input", + "Preserve Case" + ], + "vs/base/browser/ui/hover/hoverWidget": [ + "Inspect this in the accessible view with {0}.", + "Inspect this in the accessible view via the command Open Accessible View which is currently not triggerable via keybinding." + ], + "vs/base/browser/ui/icons/iconSelectBox": [ + "Search icons", + "No results" + ], + "vs/base/browser/ui/inputbox/inputBox": [ + "Error: {0}", + "Warning: {0}", + "Info: {0}", + " or {0} for history", + " ({0} for history)", + "Cleared Input" + ], + "vs/base/browser/ui/keybindingLabel/keybindingLabel": [ + "Unbound" + ], + "vs/base/browser/ui/menu/menubar": [ + "Application Menu", + "More" + ], + "vs/base/browser/ui/selectBox/selectBoxCustom": [ + "Select Box" + ], + "vs/base/browser/ui/splitview/paneview": [ + "{0} Section" + ], + "vs/base/browser/ui/toolbar/toolbar": [ + "More Actions..." + ], + "vs/base/browser/ui/tree/abstractTree": [ + "Type to search", + "Close", + "Type to search", + "No results found.", + "No results", + "{0} results", + "Type to filter", + "Type to search", + "Filter", + "Fuzzy Match" + ], + "vs/base/browser/ui/tree/asyncDataTree": [ + "Type to filter", + "Type to search" + ], + "vs/base/browser/ui/tree/treeDefaults": [ + "Collapse All" + ], + "vs/base/common/actions": [ + "(empty)" + ], + "vs/base/common/date": [ + "in {0}", + "now", + "{0} second ago", + "{0} sec ago", + "{0} seconds ago", + "{0} secs ago", + "{0} second", + "{0} sec", + "{0} seconds", + "{0} secs", + "{0} minute ago", + "{0} min ago", + "{0} minutes ago", + "{0} mins ago", + "{0} minute", + "{0} min", + "{0} minutes", + "{0} mins", + "{0} hour ago", + "{0} hr ago", + "{0} hours ago", + "{0} hrs ago", + "{0} hour", + "{0} hr", + "{0} hours", + "{0} hrs", + "{0} day ago", + "{0} days ago", + "{0} day", + "{0} days", + "{0} week ago", + "{0} wk ago", + "{0} weeks ago", + "{0} wks ago", + "{0} week", + "{0} wk", + "{0} weeks", + "{0} wks", + "{0} month ago", + "{0} mo ago", + "{0} months ago", + "{0} mos ago", + "{0} month", + "{0} mo", + "{0} months", + "{0} mos", + "{0} year ago", + "{0} yr ago", + "{0} years ago", + "{0} yrs ago", + "{0} year", + "{0} yr", + "{0} years", + "{0} yrs", + "Today", + "Yesterday", + "{0} milliseconds", + "{0}ms", + "{0} seconds", + "{0}s", + "{0} minutes", + "{0} mins", + "{0} hours", + "{0} hrs", + "{0} days" + ], + "vs/base/common/errorMessage": [ + "{0}: {1}", + "A system error occurred ({0})", + "An unknown error occurred. Please consult the log for more details.", + "An unknown error occurred. Please consult the log for more details.", + "{0} ({1} errors in total)", + "An unknown error occurred. Please consult the log for more details." + ], + "vs/base/common/jsonErrorMessages": [ + "Invalid symbol", + "Invalid number format", + "Property name expected", + "Value expected", + "Colon expected", + "Comma expected", + "Closing brace expected", + "Closing bracket expected", + "End of file expected" + ], + "vs/base/common/keybindingLabels": [ + "Ctrl", + "Shift", + "Alt", + "Windows", + "Ctrl", + "Shift", + "Alt", + "Super", + "Control", + "Shift", + "Option", + "Command", + "Control", + "Shift", + "Alt", + "Windows", + "Control", + "Shift", + "Alt", + "Super" + ], + "vs/base/common/policy": [ + "Extensions", + "Integrated Terminal", + "Chat", + "Telemetry", + "Update" + ], + "vs/base/node/zip": [ + "Error extracting {0}. Invalid file.", + "Incomplete. Found {0} of {1} entries", + "{0} not found inside zip." + ], + "vs/code/electron-main/app": [ + "An external application wants to open '{0}' in {1}. Do you want to open this workspace file?", + "An external application wants to open '{0}' in {1}. Do you want to open this folder?", + "An external application wants to open '{0}' in {1}. Do you want to open this file or folder?", + "&&Yes", + "&&No", + "If you did not initiate this request, it may represent an attempted attack on your system. Unless you took an explicit action to initiate this request, you should press 'No'", + "Allow opening local paths without asking", + "Allow opening remote paths without asking" + ], + "vs/code/electron-main/main": [ + "Main", + "Another instance of {0} is already running as administrator.", + "Please close the other instance and try again.", + "Another instance of {0} is running but not responding", + "Please close all other instances and try again.", + "Warning: The --status argument can only be used if {0} is already running. Please run it again after {0} has started.", + "Unable to write program user data.", + "{0}\n\nPlease make sure the following directories are writeable:\n\n{1}", + "&&Close" + ], + "vs/code/electron-utility/sharedProcess/sharedProcessMain": [ + "Shared", + "Shared", + "Network" + ], + "vs/code/node/cliProcessMain": [ + "CLI" + ], + "vs/editor/browser/controller/editContext/native/screenReaderSupport": [ + "editor" + ], + "vs/editor/browser/controller/editContext/screenReaderUtils": [ + "The editor is not accessible at this time.", + "{0} To enable screen reader optimized mode, use {1}", + "{0} To enable screen reader optimized mode, open the quick pick with {1} and run the command Toggle Screen Reader Accessibility Mode, which is currently not triggerable via keyboard.", + "{0} Please assign a keybinding for the command Toggle Screen Reader Accessibility Mode by accessing the keybindings editor with {1} and run it." + ], + "vs/editor/browser/controller/editContext/textArea/textAreaEditContext": [ + "editor" + ], + "vs/editor/browser/coreCommands": [ + "Stick to the end even when going to longer lines", + "Stick to the end even when going to longer lines", + "Removed secondary cursors" + ], + "vs/editor/browser/editorExtensions": [ + "&&Undo", + "Undo", + "Undo", + "&&Redo", + "Redo", + "Redo", + "&&Select All", + "Select All", + "Select All" + ], + "vs/editor/browser/gpu/viewGpuContext": [ + "Use DOM-based rendering" + ], + "vs/editor/browser/services/inlineCompletionsService": [ + "Whether inline completions are currently snoozed", + "Select snooze duration for Inline Suggestions", + "Snooze Inline Suggestions", + "Cancel Snooze Inline Suggestions" + ], + "vs/editor/browser/widget/codeEditor/codeEditorWidget": [ + "The number of cursors has been limited to {0}. Consider using [find and replace](https://code.visualstudio.com/docs/editor/codebasics#_find-and-replace) for larger changes or increase the editor multi cursor limit setting.", + "Increase Multi Cursor Limit" + ], + "vs/editor/browser/widget/diffEditor/commands": [ + "Toggle Collapse Unchanged Regions", + "Toggle Show Moved Code Blocks", + "Toggle Use Inline View When Space Is Limited", + "Diff Editor", + "Switch Side", + "Exit Compare Move", + "Collapse All Unchanged Regions", + "Show All Unchanged Regions", + "Revert", + "Accessible Diff Viewer", + "Go to Next Difference", + "Go to Previous Difference" + ], + "vs/editor/browser/widget/diffEditor/components/accessibleDiffViewer": [ + "Icon for 'Insert' in accessible diff viewer.", + "Icon for 'Remove' in accessible diff viewer.", + "Icon for 'Close' in accessible diff viewer.", + "Close", + "Accessible Diff Viewer. Use arrow up and down to navigate.", + "no lines changed", + "1 line changed", + "{0} lines changed", + "Difference {0} of {1}: original line {2}, {3}, modified line {4}, {5}", + "blank", + "{0} unchanged line {1}", + "{0} original line {1} modified line {2}", + "+ {0} modified line {1}", + "- {0} original line {1}" + ], + "vs/editor/browser/widget/diffEditor/components/diffEditorEditors": [ + " use {0} to open the accessibility help." + ], + "vs/editor/browser/widget/diffEditor/components/diffEditorViewZones/inlineDiffDeletedCodeMargin": [ + "Copy deleted lines", + "Copy deleted line", + "Copy changed lines", + "Copy changed line", + "Copy deleted line ({0})", + "Copy changed line ({0})", + "Revert this change" + ], + "vs/editor/browser/widget/diffEditor/diffEditor.contribution": [ + "Use Inline View When Space Is Limited", + "Show Moved Code Blocks", + "Revert Block", + "Revert Selection", + "Open Accessible Diff Viewer" + ], + "vs/editor/browser/widget/diffEditor/features/hideUnchangedRegionsFeature": [ + "Fold Unchanged Region", + "{0} hidden lines", + "Click or drag to show more above", + "Show Unchanged Region", + "Click or drag to show more below", + "{0} hidden lines", + "Double click to unfold" + ], + "vs/editor/browser/widget/diffEditor/features/movedBlocksLinesFeature": [ + "Code moved with changes to line {0}-{1}", + "Code moved with changes from line {0}-{1}", + "Code moved to line {0}-{1}", + "Code moved from line {0}-{1}" + ], + "vs/editor/browser/widget/diffEditor/features/revertButtonsFeature": [ + "Revert Selected Changes", + "Revert Change" + ], + "vs/editor/browser/widget/diffEditor/registrations.contribution": [ + "The border color for text that got moved in the diff editor.", + "The active border color for text that got moved in the diff editor.", + "The color of the shadow around unchanged region widgets.", + "Line decoration for inserts in the diff editor.", + "Line decoration for removals in the diff editor." + ], + "vs/editor/browser/widget/multiDiffEditor/colors": [ + "The background color of the diff editor's header", + "The background color of the multi file diff editor", + "The border color of the multi file diff editor" + ], + "vs/editor/browser/widget/multiDiffEditor/multiDiffEditorWidgetImpl": [ + "Loading...", + "No Changed Files" + ], + "vs/editor/common/config/editorConfigurationSchema": [ + "Editor", + "The number of spaces a tab is equal to. This setting is overridden based on the file contents when {0} is on.", + "The number of spaces used for indentation or `\"tabSize\"` to use the value from `#editor.tabSize#`. This setting is overridden based on the file contents when `#editor.detectIndentation#` is on.", + "Insert spaces when pressing `Tab`. This setting is overridden based on the file contents when {0} is on.", + "Controls whether {0} and {1} will be automatically detected when a file is opened based on the file contents.", + "Remove trailing auto inserted whitespace.", + "Special handling for large files to disable certain memory intensive features.", + "Turn off Word Based Suggestions.", + "Turn off Word Based Suggestions when Inline Suggestions are present.", + "Only suggest words from the active document.", + "Suggest words from all open documents of the same language.", + "Suggest words from all open documents.", + "Controls whether completions should be computed based on words in the document and from which documents they are computed.", + "Semantic highlighting enabled for all color themes.", + "Semantic highlighting disabled for all color themes.", + "Semantic highlighting is configured by the current color theme's `semanticHighlighting` setting.", + "Controls whether the semanticHighlighting is shown for the languages that support it.", + "Keep peek editors open even when double-clicking their content or when hitting `Escape`.", + "Lines above this length will not be tokenized for performance reasons", + "Controls whether the tokenization should happen asynchronously on a web worker.", + "Controls whether async tokenization should be logged. For debugging only.", + "Controls whether async tokenization should be verified against legacy background tokenization. Might slow down tokenization. For debugging only.", + "Controls whether tree sitter parsing should be turned on and telemetry collected. Setting `#editor.experimental.preferTreeSitter#` for specific languages will take precedence.", + "Controls whether tree sitter parsing should be turned on for css. This will take precedence over `#editor.experimental.treeSitterTelemetry#` for css.", + "Controls whether tree sitter parsing should be turned on for typescript. This will take precedence over `#editor.experimental.treeSitterTelemetry#` for typescript.", + "Controls whether tree sitter parsing should be turned on for ini. This will take precedence over `#editor.experimental.treeSitterTelemetry#` for ini.", + "Controls whether tree sitter parsing should be turned on for regex. This will take precedence over `#editor.experimental.treeSitterTelemetry#` for regex.", + "Defines the bracket symbols that increase or decrease the indentation.", + "The opening bracket character or string sequence.", + "The closing bracket character or string sequence.", + "Defines the bracket pairs that are colorized by their nesting level if bracket pair colorization is enabled.", + "The opening bracket character or string sequence.", + "The closing bracket character or string sequence.", + "Timeout in milliseconds after which diff computation is cancelled. Use 0 for no timeout.", + "Maximum file size in MB for which to compute diffs. Use 0 for no limit.", + "Controls whether the diff editor shows the diff side by side or inline.", + "If the diff editor width is smaller than this value, the inline view is used.", + "If enabled and the editor width is too small, the inline view is used.", + "When enabled, the diff editor shows arrows in its glyph margin to revert changes.", + "When enabled, the diff editor shows a special gutter for revert and stage actions.", + "When enabled, the diff editor ignores changes in leading or trailing whitespace.", + "Controls whether the diff editor shows +/- indicators for added/removed changes.", + "Controls whether the editor shows CodeLens.", + "Lines will never wrap.", + "Lines will wrap at the viewport width.", + "Lines will wrap according to the {0} setting.", + "Uses the legacy diffing algorithm.", + "Uses the advanced diffing algorithm.", + "Controls whether the diff editor shows unchanged regions.", + "Controls how many lines are used for unchanged regions.", + "Controls how many lines are used as a minimum for unchanged regions.", + "Controls how many lines are used as context when comparing unchanged regions.", + "Controls whether the diff editor should show detected code moves.", + "Controls whether the diff editor shows empty decorations to see where characters got inserted or deleted.", + "If enabled and the editor uses the inline view, word changes are rendered inline." + ], + "vs/editor/common/config/editorOptions": [ + "Use platform APIs to detect when a Screen Reader is attached.", + "Optimize for usage with a Screen Reader.", + "Assume a screen reader is not attached.", + "Controls if the UI should run in a mode where it is optimized for screen readers.", + "Controls whether a space character is inserted when commenting.", + "Controls if empty lines should be ignored with toggle, add or remove actions for line comments.", + "Controls whether copying without a selection copies the current line.", + "Controls whether the cursor should jump to find matches while typing.", + "Never seed search string from the editor selection.", + "Always seed search string from the editor selection, including word at cursor position.", + "Only seed search string from the editor selection.", + "Controls whether the search string in the Find Widget is seeded from the editor selection.", + "Never turn on Find in Selection automatically (default).", + "Always turn on Find in Selection automatically.", + "Turn on Find in Selection automatically when multiple lines of content are selected.", + "Controls the condition for turning on Find in Selection automatically.", + "Controls whether the Find Widget should read or modify the shared find clipboard on macOS.", + "Controls whether the Find Widget should add extra lines on top of the editor. When true, you can scroll beyond the first line when the Find Widget is visible.", + "Controls whether the search automatically restarts from the beginning (or the end) when no further matches can be found.", + "Do not store search history from the find widget.", + "Store search history across the active workspace", + "Controls how the find widget history should be stored", + "Do not store history from the replace widget.", + "Store replace history across the active workspace", + "Controls how the replace widget history should be stored", + "Controls whether the Find Widget should search as you type.", + "Enables/Disables font ligatures ('calt' and 'liga' font features). Change this to a string for fine-grained control of the 'font-feature-settings' CSS property.", + "Explicit 'font-feature-settings' CSS property. A boolean can be passed instead if one only needs to turn on/off ligatures.", + "Configures font ligatures or font features. Can be either a boolean to enable/disable ligatures or a string for the value of the CSS 'font-feature-settings' property.", + "Enables/Disables the translation from font-weight to font-variation-settings. Change this to a string for fine-grained control of the 'font-variation-settings' CSS property.", + "Explicit 'font-variation-settings' CSS property. A boolean can be passed instead if one only needs to translate font-weight to font-variation-settings.", + "Configures font variations. Can be either a boolean to enable/disable the translation from font-weight to font-variation-settings or a string for the value of the CSS 'font-variation-settings' property.", + "Controls the font size in pixels.", + "Only \"normal\" and \"bold\" keywords or numbers between 1 and 1000 are allowed.", + "Controls the font weight. Accepts \"normal\" and \"bold\" keywords or numbers between 1 and 1000.", + "Show Peek view of the results (default)", + "Go to the primary result and show a Peek view", + "Go to the primary result and enable Peek-less navigation to others", + "This setting is deprecated, please use separate settings like 'editor.editor.gotoLocation.multipleDefinitions' or 'editor.editor.gotoLocation.multipleImplementations' instead.", + "Controls the behavior the 'Go to Definition'-command when multiple target locations exist.", + "Controls the behavior the 'Go to Type Definition'-command when multiple target locations exist.", + "Controls the behavior the 'Go to Declaration'-command when multiple target locations exist.", + "Controls the behavior the 'Go to Implementations'-command when multiple target locations exist.", + "Controls the behavior the 'Go to References'-command when multiple target locations exist.", + "Alternative command id that is being executed when the result of 'Go to Definition' is the current location.", + "Alternative command id that is being executed when the result of 'Go to Type Definition' is the current location.", + "Alternative command id that is being executed when the result of 'Go to Declaration' is the current location.", + "Alternative command id that is being executed when the result of 'Go to Implementation' is the current location.", + "Alternative command id that is being executed when the result of 'Go to Reference' is the current location.", + "Hover is enabled.", + "Hover is disabled.", + "Hover is shown when holding `{0}` or `Alt` (the opposite modifier of `#editor.multiCursorModifier#`)", + "Controls whether the hover is shown.", + "Controls the delay in milliseconds after which the hover is shown.", + "Controls whether the hover should remain visible when mouse is moved over it.", + "Controls the delay in milliseconds after which the hover is hidden. Requires `#editor.hover.sticky#` to be enabled.", + "Prefer showing hovers above the line, if there's space.", + "Assumes that all characters are of the same width. This is a fast algorithm that works correctly for monospace fonts and certain scripts (like Latin characters) where glyphs are of equal width.", + "Delegates wrapping points computation to the browser. This is a slow algorithm, that might cause freezes for large files, but it works correctly in all cases.", + "Controls the algorithm that computes wrapping points. Note that when in accessibility mode, advanced will be used for the best experience.", + "Disable the code action menu.", + "Show the code action menu when the cursor is on lines with code.", + "Show the code action menu when the cursor is on lines with code or on empty lines.", + "Enables the Code Action lightbulb in the editor.", + "Shows the nested current scopes during the scroll at the top of the editor.", + "Defines the maximum number of sticky lines to show.", + "Defines the model to use for determining which lines to stick. If the outline model does not exist, it will fall back on the folding provider model which falls back on the indentation model. This order is respected in all three cases.", + "Enable scrolling of Sticky Scroll with the editor's horizontal scrollbar.", + "Enables the inlay hints in the editor.", + "Inlay hints are enabled", + "Inlay hints are showing by default and hide when holding {0}", + "Inlay hints are hidden by default and show when holding {0}", + "Inlay hints are disabled", + "Controls font size of inlay hints in the editor. As default the {0} is used when the configured value is less than {1} or greater than the editor font size.", + "Controls font family of inlay hints in the editor. When set to empty, the {0} is used.", + "Enables the padding around the inlay hints in the editor.", + "Maximum overall length of inlay hints, for a single line, before they get truncated by the editor. Set to `0` to never truncate", + "Controls the line height. \n - Use 0 to automatically compute the line height from the font size.\n - Values between 0 and 8 will be used as a multiplier with the font size.\n - Values greater than or equal to 8 will be used as effective values.", + "Controls whether the minimap is shown.", + "The minimap is always shown.", + "The minimap is hidden when mouse is not over the minimap and shown when mouse is over the minimap.", + "The minimap is only shown when the editor is scrolled", + "Controls whether the minimap is hidden automatically.", + "The minimap has the same size as the editor contents (and might scroll).", + "The minimap will stretch or shrink as necessary to fill the height of the editor (no scrolling).", + "The minimap will shrink as necessary to never be larger than the editor (no scrolling).", + "Controls the size of the minimap.", + "Controls the side where to render the minimap.", + "Controls when the minimap slider is shown.", + "Scale of content drawn in the minimap: 1, 2 or 3.", + "Render the actual characters on a line as opposed to color blocks.", + "Limit the width of the minimap to render at most a certain number of columns.", + "Controls whether named regions are shown as section headers in the minimap.", + "Controls whether MARK: comments are shown as section headers in the minimap.", + "Defines the regular expression used to find section headers in comments. The regex must contain a named match group `label` (written as `(?